/*! For license information please see vtk-gltf.js.LICENSE.txt */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.vtk=t():e.vtk=t()}(globalThis,()=>(()=>{var e={581(e,t,r){"use strict";r.d(t,{default:()=>J_});var n={};r.r(n),r.d(n,{add:()=>Q,adjoint:()=>y,clone:()=>c,copy:()=>d,create:()=>u,determinant:()=>v,equals:()=>ne,exactEquals:()=>re,frob:()=>J,fromQuat:()=>U,fromQuat2:()=>M,fromRotation:()=>D,fromRotationTranslation:()=>N,fromRotationTranslationScale:()=>L,fromRotationTranslationScaleOrigin:()=>k,fromScaling:()=>E,fromTranslation:()=>A,fromValues:()=>p,fromXRotation:()=>P,fromYRotation:()=>I,fromZRotation:()=>O,frustum:()=>V,getRotation:()=>B,getScaling:()=>F,getTranslation:()=>R,identity:()=>h,invert:()=>g,lookAt:()=>$,mul:()=>oe,multiply:()=>b,multiplyScalar:()=>ee,multiplyScalarAndAdd:()=>te,ortho:()=>K,orthoNO:()=>H,orthoZO:()=>X,perspective:()=>z,perspectiveFromFieldOfView:()=>W,perspectiveNO:()=>G,perspectiveZO:()=>j,rotate:()=>S,rotateX:()=>C,rotateY:()=>T,rotateZ:()=>w,scale:()=>_,set:()=>f,str:()=>Y,sub:()=>ie,subtract:()=>Z,targetTo:()=>q,translate:()=>x,transpose:()=>m});var o={};r.r(o),r.d(o,{add:()=>Ie,adjoint:()=>me,clone:()=>le,copy:()=>ue,create:()=>ae,determinant:()=>ge,equals:()=>Fe,exactEquals:()=>Re,frob:()=>Pe,fromMat2d:()=>Te,fromMat4:()=>se,fromQuat:()=>we,fromRotation:()=>Se,fromScaling:()=>Ce,fromTranslation:()=>_e,fromValues:()=>ce,identity:()=>pe,invert:()=>he,mul:()=>Be,multiply:()=>ye,multiplyScalar:()=>Ne,multiplyScalarAndAdd:()=>Me,normalFromMat4:()=>Ae,projection:()=>Ee,rotate:()=>be,scale:()=>xe,set:()=>de,str:()=>De,sub:()=>Le,subtract:()=>Oe,translate:()=>ve,transpose:()=>fe});var i=1e-6,a="undefined"!=typeof Float32Array?Float32Array:Array;Math.random;var s=Math.PI/180;function l(e){return e*s}function u(){var e=new a(16);return a!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function c(e){var t=new a(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function d(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function p(e,t,r,n,o,i,s,l,u,c,d,p,f,h,m,g){var y=new a(16);return y[0]=e,y[1]=t,y[2]=r,y[3]=n,y[4]=o,y[5]=i,y[6]=s,y[7]=l,y[8]=u,y[9]=c,y[10]=d,y[11]=p,y[12]=f,y[13]=h,y[14]=m,y[15]=g,y}function f(e,t,r,n,o,i,a,s,l,u,c,d,p,f,h,m,g){return e[0]=t,e[1]=r,e[2]=n,e[3]=o,e[4]=i,e[5]=a,e[6]=s,e[7]=l,e[8]=u,e[9]=c,e[10]=d,e[11]=p,e[12]=f,e[13]=h,e[14]=m,e[15]=g,e}function h(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function m(e,t){if(e===t){var r=t[1],n=t[2],o=t[3],i=t[6],a=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=r,e[6]=t[9],e[7]=t[13],e[8]=n,e[9]=i,e[11]=t[14],e[12]=o,e[13]=a,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function g(e,t){var r=t[0],n=t[1],o=t[2],i=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=t[9],p=t[10],f=t[11],h=t[12],m=t[13],g=t[14],y=t[15],v=r*s-n*a,b=r*l-o*a,x=r*u-i*a,_=n*l-o*s,S=n*u-i*s,C=o*u-i*l,T=c*m-d*h,w=c*g-p*h,A=c*y-f*h,E=d*g-p*m,D=d*y-f*m,P=p*y-f*g,I=v*P-b*D+x*E+_*A-S*w+C*T;return I?(I=1/I,e[0]=(s*P-l*D+u*E)*I,e[1]=(o*D-n*P-i*E)*I,e[2]=(m*C-g*S+y*_)*I,e[3]=(p*S-d*C-f*_)*I,e[4]=(l*A-a*P-u*w)*I,e[5]=(r*P-o*A+i*w)*I,e[6]=(g*x-h*C-y*b)*I,e[7]=(c*C-p*x+f*b)*I,e[8]=(a*D-s*A+u*T)*I,e[9]=(n*A-r*D-i*T)*I,e[10]=(h*S-m*x+y*v)*I,e[11]=(d*x-c*S-f*v)*I,e[12]=(s*w-a*E-l*T)*I,e[13]=(r*E-n*w+o*T)*I,e[14]=(m*b-h*_-g*v)*I,e[15]=(c*_-d*b+p*v)*I,e):null}function y(e,t){var r=t[0],n=t[1],o=t[2],i=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=t[9],p=t[10],f=t[11],h=t[12],m=t[13],g=t[14],y=t[15];return e[0]=s*(p*y-f*g)-d*(l*y-u*g)+m*(l*f-u*p),e[1]=-(n*(p*y-f*g)-d*(o*y-i*g)+m*(o*f-i*p)),e[2]=n*(l*y-u*g)-s*(o*y-i*g)+m*(o*u-i*l),e[3]=-(n*(l*f-u*p)-s*(o*f-i*p)+d*(o*u-i*l)),e[4]=-(a*(p*y-f*g)-c*(l*y-u*g)+h*(l*f-u*p)),e[5]=r*(p*y-f*g)-c*(o*y-i*g)+h*(o*f-i*p),e[6]=-(r*(l*y-u*g)-a*(o*y-i*g)+h*(o*u-i*l)),e[7]=r*(l*f-u*p)-a*(o*f-i*p)+c*(o*u-i*l),e[8]=a*(d*y-f*m)-c*(s*y-u*m)+h*(s*f-u*d),e[9]=-(r*(d*y-f*m)-c*(n*y-i*m)+h*(n*f-i*d)),e[10]=r*(s*y-u*m)-a*(n*y-i*m)+h*(n*u-i*s),e[11]=-(r*(s*f-u*d)-a*(n*f-i*d)+c*(n*u-i*s)),e[12]=-(a*(d*g-p*m)-c*(s*g-l*m)+h*(s*p-l*d)),e[13]=r*(d*g-p*m)-c*(n*g-o*m)+h*(n*p-o*d),e[14]=-(r*(s*g-l*m)-a*(n*g-o*m)+h*(n*l-o*s)),e[15]=r*(s*p-l*d)-a*(n*p-o*d)+c*(n*l-o*s),e}function v(e){var t=e[0],r=e[1],n=e[2],o=e[3],i=e[4],a=e[5],s=e[6],l=e[7],u=e[8],c=e[9],d=e[10],p=e[11],f=e[12],h=e[13],m=e[14],g=e[15];return(t*a-r*i)*(d*g-p*m)-(t*s-n*i)*(c*g-p*h)+(t*l-o*i)*(c*m-d*h)+(r*s-n*a)*(u*g-p*f)-(r*l-o*a)*(u*m-d*f)+(n*l-o*s)*(u*h-c*f)}function b(e,t,r){var n=t[0],o=t[1],i=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],p=t[9],f=t[10],h=t[11],m=t[12],g=t[13],y=t[14],v=t[15],b=r[0],x=r[1],_=r[2],S=r[3];return e[0]=b*n+x*s+_*d+S*m,e[1]=b*o+x*l+_*p+S*g,e[2]=b*i+x*u+_*f+S*y,e[3]=b*a+x*c+_*h+S*v,b=r[4],x=r[5],_=r[6],S=r[7],e[4]=b*n+x*s+_*d+S*m,e[5]=b*o+x*l+_*p+S*g,e[6]=b*i+x*u+_*f+S*y,e[7]=b*a+x*c+_*h+S*v,b=r[8],x=r[9],_=r[10],S=r[11],e[8]=b*n+x*s+_*d+S*m,e[9]=b*o+x*l+_*p+S*g,e[10]=b*i+x*u+_*f+S*y,e[11]=b*a+x*c+_*h+S*v,b=r[12],x=r[13],_=r[14],S=r[15],e[12]=b*n+x*s+_*d+S*m,e[13]=b*o+x*l+_*p+S*g,e[14]=b*i+x*u+_*f+S*y,e[15]=b*a+x*c+_*h+S*v,e}function x(e,t,r){var n,o,i,a,s,l,u,c,d,p,f,h,m=r[0],g=r[1],y=r[2];return t===e?(e[12]=t[0]*m+t[4]*g+t[8]*y+t[12],e[13]=t[1]*m+t[5]*g+t[9]*y+t[13],e[14]=t[2]*m+t[6]*g+t[10]*y+t[14],e[15]=t[3]*m+t[7]*g+t[11]*y+t[15]):(n=t[0],o=t[1],i=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],p=t[9],f=t[10],h=t[11],e[0]=n,e[1]=o,e[2]=i,e[3]=a,e[4]=s,e[5]=l,e[6]=u,e[7]=c,e[8]=d,e[9]=p,e[10]=f,e[11]=h,e[12]=n*m+s*g+d*y+t[12],e[13]=o*m+l*g+p*y+t[13],e[14]=i*m+u*g+f*y+t[14],e[15]=a*m+c*g+h*y+t[15]),e}function _(e,t,r){var n=r[0],o=r[1],i=r[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*o,e[5]=t[5]*o,e[6]=t[6]*o,e[7]=t[7]*o,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function S(e,t,r,n){var o,a,s,l,u,c,d,p,f,h,m,g,y,v,b,x,_,S,C,T,w,A,E,D,P=n[0],I=n[1],O=n[2],N=Math.hypot(P,I,O);return N0?(r[0]=2*(l*s+d*n+u*i-c*o)/p,r[1]=2*(u*s+d*o+c*n-l*i)/p,r[2]=2*(c*s+d*i+l*o-u*n)/p):(r[0]=2*(l*s+d*n+u*i-c*o),r[1]=2*(u*s+d*o+c*n-l*i),r[2]=2*(c*s+d*i+l*o-u*n)),N(e,t,r),e}function R(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function F(e,t){var r=t[0],n=t[1],o=t[2],i=t[4],a=t[5],s=t[6],l=t[8],u=t[9],c=t[10];return e[0]=Math.hypot(r,n,o),e[1]=Math.hypot(i,a,s),e[2]=Math.hypot(l,u,c),e}function B(e,t){var r=new a(3);F(r,t);var n=1/r[0],o=1/r[1],i=1/r[2],s=t[0]*n,l=t[1]*o,u=t[2]*i,c=t[4]*n,d=t[5]*o,p=t[6]*i,f=t[8]*n,h=t[9]*o,m=t[10]*i,g=s+d+m,y=0;return g>0?(y=2*Math.sqrt(g+1),e[3]=.25*y,e[0]=(p-h)/y,e[1]=(f-u)/y,e[2]=(l-c)/y):s>d&&s>m?(y=2*Math.sqrt(1+s-d-m),e[3]=(p-h)/y,e[0]=.25*y,e[1]=(l+c)/y,e[2]=(f+u)/y):d>m?(y=2*Math.sqrt(1+d-s-m),e[3]=(f-u)/y,e[0]=(l+c)/y,e[1]=.25*y,e[2]=(p+h)/y):(y=2*Math.sqrt(1+m-s-d),e[3]=(l-c)/y,e[0]=(f+u)/y,e[1]=(p+h)/y,e[2]=.25*y),e}function L(e,t,r,n){var o=t[0],i=t[1],a=t[2],s=t[3],l=o+o,u=i+i,c=a+a,d=o*l,p=o*u,f=o*c,h=i*u,m=i*c,g=a*c,y=s*l,v=s*u,b=s*c,x=n[0],_=n[1],S=n[2];return e[0]=(1-(h+g))*x,e[1]=(p+b)*x,e[2]=(f-v)*x,e[3]=0,e[4]=(p-b)*_,e[5]=(1-(d+g))*_,e[6]=(m+y)*_,e[7]=0,e[8]=(f+v)*S,e[9]=(m-y)*S,e[10]=(1-(d+h))*S,e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function k(e,t,r,n,o){var i=t[0],a=t[1],s=t[2],l=t[3],u=i+i,c=a+a,d=s+s,p=i*u,f=i*c,h=i*d,m=a*c,g=a*d,y=s*d,v=l*u,b=l*c,x=l*d,_=n[0],S=n[1],C=n[2],T=o[0],w=o[1],A=o[2],E=(1-(m+y))*_,D=(f+x)*_,P=(h-b)*_,I=(f-x)*S,O=(1-(p+y))*S,N=(g+v)*S,M=(h+b)*C,R=(g-v)*C,F=(1-(p+m))*C;return e[0]=E,e[1]=D,e[2]=P,e[3]=0,e[4]=I,e[5]=O,e[6]=N,e[7]=0,e[8]=M,e[9]=R,e[10]=F,e[11]=0,e[12]=r[0]+T-(E*T+I*w+M*A),e[13]=r[1]+w-(D*T+O*w+R*A),e[14]=r[2]+A-(P*T+N*w+F*A),e[15]=1,e}function U(e,t){var r=t[0],n=t[1],o=t[2],i=t[3],a=r+r,s=n+n,l=o+o,u=r*a,c=n*a,d=n*s,p=o*a,f=o*s,h=o*l,m=i*a,g=i*s,y=i*l;return e[0]=1-d-h,e[1]=c+y,e[2]=p-g,e[3]=0,e[4]=c-y,e[5]=1-u-h,e[6]=f+m,e[7]=0,e[8]=p+g,e[9]=f-m,e[10]=1-u-d,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function V(e,t,r,n,o,i,a){var s=1/(r-t),l=1/(o-n),u=1/(i-a);return e[0]=2*i*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*i*l,e[6]=0,e[7]=0,e[8]=(r+t)*s,e[9]=(o+n)*l,e[10]=(a+i)*u,e[11]=-1,e[12]=0,e[13]=0,e[14]=a*i*2*u,e[15]=0,e}function G(e,t,r,n,o){var i,a=1/Math.tan(t/2);return e[0]=a/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=o&&o!==1/0?(i=1/(n-o),e[10]=(o+n)*i,e[14]=2*o*n*i):(e[10]=-1,e[14]=-2*n),e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var z=G;function j(e,t,r,n,o){var i,a=1/Math.tan(t/2);return e[0]=a/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=o&&o!==1/0?(i=1/(n-o),e[10]=o*i,e[14]=o*n*i):(e[10]=-1,e[14]=-n),e}function W(e,t,r,n){var o=Math.tan(t.upDegrees*Math.PI/180),i=Math.tan(t.downDegrees*Math.PI/180),a=Math.tan(t.leftDegrees*Math.PI/180),s=Math.tan(t.rightDegrees*Math.PI/180),l=2/(a+s),u=2/(o+i);return e[0]=l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=u,e[6]=0,e[7]=0,e[8]=-(a-s)*l*.5,e[9]=(o-i)*u*.5,e[10]=n/(r-n),e[11]=-1,e[12]=0,e[13]=0,e[14]=n*r/(r-n),e[15]=0,e}function H(e,t,r,n,o,i,a){var s=1/(t-r),l=1/(n-o),u=1/(i-a);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*u,e[11]=0,e[12]=(t+r)*s,e[13]=(o+n)*l,e[14]=(a+i)*u,e[15]=1,e}var K=H;function X(e,t,r,n,o,i,a){var s=1/(t-r),l=1/(n-o),u=1/(i-a);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=u,e[11]=0,e[12]=(t+r)*s,e[13]=(o+n)*l,e[14]=i*u,e[15]=1,e}function $(e,t,r,n){var o,a,s,l,u,c,d,p,f,m,g=t[0],y=t[1],v=t[2],b=n[0],x=n[1],_=n[2],S=r[0],C=r[1],T=r[2];return Math.abs(g-S)0&&(c*=f=1/Math.sqrt(f),d*=f,p*=f);var h=l*p-u*d,m=u*c-s*p,g=s*d-l*c;return(f=h*h+m*m+g*g)>0&&(h*=f=1/Math.sqrt(f),m*=f,g*=f),e[0]=h,e[1]=m,e[2]=g,e[3]=0,e[4]=d*g-p*m,e[5]=p*h-c*g,e[6]=c*m-d*h,e[7]=0,e[8]=c,e[9]=d,e[10]=p,e[11]=0,e[12]=o,e[13]=i,e[14]=a,e[15]=1,e}function Y(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"}function J(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}function Q(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e[9]=t[9]+r[9],e[10]=t[10]+r[10],e[11]=t[11]+r[11],e[12]=t[12]+r[12],e[13]=t[13]+r[13],e[14]=t[14]+r[14],e[15]=t[15]+r[15],e}function Z(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e[9]=t[9]-r[9],e[10]=t[10]-r[10],e[11]=t[11]-r[11],e[12]=t[12]-r[12],e[13]=t[13]-r[13],e[14]=t[14]-r[14],e[15]=t[15]-r[15],e}function ee(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e[9]=t[9]*r,e[10]=t[10]*r,e[11]=t[11]*r,e[12]=t[12]*r,e[13]=t[13]*r,e[14]=t[14]*r,e[15]=t[15]*r,e}function te(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e[3]=t[3]+r[3]*n,e[4]=t[4]+r[4]*n,e[5]=t[5]+r[5]*n,e[6]=t[6]+r[6]*n,e[7]=t[7]+r[7]*n,e[8]=t[8]+r[8]*n,e[9]=t[9]+r[9]*n,e[10]=t[10]+r[10]*n,e[11]=t[11]+r[11]*n,e[12]=t[12]+r[12]*n,e[13]=t[13]+r[13]*n,e[14]=t[14]+r[14]*n,e[15]=t[15]+r[15]*n,e}function re(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}function ne(e,t){var r=e[0],n=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],d=e[8],p=e[9],f=e[10],h=e[11],m=e[12],g=e[13],y=e[14],v=e[15],b=t[0],x=t[1],_=t[2],S=t[3],C=t[4],T=t[5],w=t[6],A=t[7],E=t[8],D=t[9],P=t[10],I=t[11],O=t[12],N=t[13],M=t[14],R=t[15];return Math.abs(r-b)<=i*Math.max(1,Math.abs(r),Math.abs(b))&&Math.abs(n-x)<=i*Math.max(1,Math.abs(n),Math.abs(x))&&Math.abs(o-_)<=i*Math.max(1,Math.abs(o),Math.abs(_))&&Math.abs(a-S)<=i*Math.max(1,Math.abs(a),Math.abs(S))&&Math.abs(s-C)<=i*Math.max(1,Math.abs(s),Math.abs(C))&&Math.abs(l-T)<=i*Math.max(1,Math.abs(l),Math.abs(T))&&Math.abs(u-w)<=i*Math.max(1,Math.abs(u),Math.abs(w))&&Math.abs(c-A)<=i*Math.max(1,Math.abs(c),Math.abs(A))&&Math.abs(d-E)<=i*Math.max(1,Math.abs(d),Math.abs(E))&&Math.abs(p-D)<=i*Math.max(1,Math.abs(p),Math.abs(D))&&Math.abs(f-P)<=i*Math.max(1,Math.abs(f),Math.abs(P))&&Math.abs(h-I)<=i*Math.max(1,Math.abs(h),Math.abs(I))&&Math.abs(m-O)<=i*Math.max(1,Math.abs(m),Math.abs(O))&&Math.abs(g-N)<=i*Math.max(1,Math.abs(g),Math.abs(N))&&Math.abs(y-M)<=i*Math.max(1,Math.abs(y),Math.abs(M))&&Math.abs(v-R)<=i*Math.max(1,Math.abs(v),Math.abs(R))}var oe=b,ie=Z;function ae(){var e=new a(9);return a!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function se(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}function le(e){var t=new a(9);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function ue(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function ce(e,t,r,n,o,i,s,l,u){var c=new a(9);return c[0]=e,c[1]=t,c[2]=r,c[3]=n,c[4]=o,c[5]=i,c[6]=s,c[7]=l,c[8]=u,c}function de(e,t,r,n,o,i,a,s,l,u){return e[0]=t,e[1]=r,e[2]=n,e[3]=o,e[4]=i,e[5]=a,e[6]=s,e[7]=l,e[8]=u,e}function pe(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function fe(e,t){if(e===t){var r=t[1],n=t[2],o=t[5];e[1]=t[3],e[2]=t[6],e[3]=r,e[5]=t[7],e[6]=n,e[7]=o}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}function he(e,t){var r=t[0],n=t[1],o=t[2],i=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=c*a-s*u,p=-c*i+s*l,f=u*i-a*l,h=r*d+n*p+o*f;return h?(h=1/h,e[0]=d*h,e[1]=(-c*n+o*u)*h,e[2]=(s*n-o*a)*h,e[3]=p*h,e[4]=(c*r-o*l)*h,e[5]=(-s*r+o*i)*h,e[6]=f*h,e[7]=(-u*r+n*l)*h,e[8]=(a*r-n*i)*h,e):null}function me(e,t){var r=t[0],n=t[1],o=t[2],i=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8];return e[0]=a*c-s*u,e[1]=o*u-n*c,e[2]=n*s-o*a,e[3]=s*l-i*c,e[4]=r*c-o*l,e[5]=o*i-r*s,e[6]=i*u-a*l,e[7]=n*l-r*u,e[8]=r*a-n*i,e}function ge(e){var t=e[0],r=e[1],n=e[2],o=e[3],i=e[4],a=e[5],s=e[6],l=e[7],u=e[8];return t*(u*i-a*l)+r*(-u*o+a*s)+n*(l*o-i*s)}function ye(e,t,r){var n=t[0],o=t[1],i=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],p=r[0],f=r[1],h=r[2],m=r[3],g=r[4],y=r[5],v=r[6],b=r[7],x=r[8];return e[0]=p*n+f*a+h*u,e[1]=p*o+f*s+h*c,e[2]=p*i+f*l+h*d,e[3]=m*n+g*a+y*u,e[4]=m*o+g*s+y*c,e[5]=m*i+g*l+y*d,e[6]=v*n+b*a+x*u,e[7]=v*o+b*s+x*c,e[8]=v*i+b*l+x*d,e}function ve(e,t,r){var n=t[0],o=t[1],i=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],p=r[0],f=r[1];return e[0]=n,e[1]=o,e[2]=i,e[3]=a,e[4]=s,e[5]=l,e[6]=p*n+f*a+u,e[7]=p*o+f*s+c,e[8]=p*i+f*l+d,e}function be(e,t,r){var n=t[0],o=t[1],i=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],p=Math.sin(r),f=Math.cos(r);return e[0]=f*n+p*a,e[1]=f*o+p*s,e[2]=f*i+p*l,e[3]=f*a-p*n,e[4]=f*s-p*o,e[5]=f*l-p*i,e[6]=u,e[7]=c,e[8]=d,e}function xe(e,t,r){var n=r[0],o=r[1];return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=o*t[3],e[4]=o*t[4],e[5]=o*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function _e(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=t[0],e[7]=t[1],e[8]=1,e}function Se(e,t){var r=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=r,e[2]=0,e[3]=-r,e[4]=n,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function Ce(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=t[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function Te(e,t){return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=t[2],e[4]=t[3],e[5]=0,e[6]=t[4],e[7]=t[5],e[8]=1,e}function we(e,t){var r=t[0],n=t[1],o=t[2],i=t[3],a=r+r,s=n+n,l=o+o,u=r*a,c=n*a,d=n*s,p=o*a,f=o*s,h=o*l,m=i*a,g=i*s,y=i*l;return e[0]=1-d-h,e[3]=c-y,e[6]=p+g,e[1]=c+y,e[4]=1-u-h,e[7]=f-m,e[2]=p-g,e[5]=f+m,e[8]=1-u-d,e}function Ae(e,t){var r=t[0],n=t[1],o=t[2],i=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],d=t[9],p=t[10],f=t[11],h=t[12],m=t[13],g=t[14],y=t[15],v=r*s-n*a,b=r*l-o*a,x=r*u-i*a,_=n*l-o*s,S=n*u-i*s,C=o*u-i*l,T=c*m-d*h,w=c*g-p*h,A=c*y-f*h,E=d*g-p*m,D=d*y-f*m,P=p*y-f*g,I=v*P-b*D+x*E+_*A-S*w+C*T;return I?(I=1/I,e[0]=(s*P-l*D+u*E)*I,e[1]=(l*A-a*P-u*w)*I,e[2]=(a*D-s*A+u*T)*I,e[3]=(o*D-n*P-i*E)*I,e[4]=(r*P-o*A+i*w)*I,e[5]=(n*A-r*D-i*T)*I,e[6]=(m*C-g*S+y*_)*I,e[7]=(g*x-h*C-y*b)*I,e[8]=(h*S-m*x+y*v)*I,e):null}function Ee(e,t,r){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/r,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e}function De(e){return"mat3("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+")"}function Pe(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}function Ie(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e}function Oe(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e}function Ne(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e}function Me(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e[3]=t[3]+r[3]*n,e[4]=t[4]+r[4]*n,e[5]=t[5]+r[5]*n,e[6]=t[6]+r[6]*n,e[7]=t[7]+r[7]*n,e[8]=t[8]+r[8]*n,e}function Re(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]}function Fe(e,t){var r=e[0],n=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],d=e[8],p=t[0],f=t[1],h=t[2],m=t[3],g=t[4],y=t[5],v=t[6],b=t[7],x=t[8];return Math.abs(r-p)<=i*Math.max(1,Math.abs(r),Math.abs(p))&&Math.abs(n-f)<=i*Math.max(1,Math.abs(n),Math.abs(f))&&Math.abs(o-h)<=i*Math.max(1,Math.abs(o),Math.abs(h))&&Math.abs(a-m)<=i*Math.max(1,Math.abs(a),Math.abs(m))&&Math.abs(s-g)<=i*Math.max(1,Math.abs(s),Math.abs(g))&&Math.abs(l-y)<=i*Math.max(1,Math.abs(l),Math.abs(y))&&Math.abs(u-v)<=i*Math.max(1,Math.abs(u),Math.abs(v))&&Math.abs(c-b)<=i*Math.max(1,Math.abs(c),Math.abs(b))&&Math.abs(d-x)<=i*Math.max(1,Math.abs(d),Math.abs(x))}var Be=ye,Le=Oe,ke=r(17);const Ue=r(170)(),Ve={vtkObject:()=>null};function Ge(e){if(null==e)return e;if(e.isA)return e;if(!e.vtkClass)return Ue.console&&Ue.console.error&&Ue.console.error("Invalid VTK object"),null;const t=Ve[e.vtkClass];if(!t)return Ue.console&&Ue.console.error&&Ue.console.error(`No vtk class found for Object of type ${e.vtkClass}`),null;const r={...e};Object.keys(r).forEach(e=>{r[e]&&"object"==typeof r[e]&&r[e].vtkClass&&(r[e]=Ge(r[e]))});const n=t(r);return n&&n.modified&&n.modified(),n}Ge.register=function(e,t){Ve[e]=t};class ze extends Array{push(){for(let e=0;e{throw new Error(`Named parameter '${e}' is missing`)},He=Symbol("void"),Ke={};function Xe(){}["log","debug","info","warn","error","time","timeEnd","group","groupEnd"].forEach(e=>{Ke[e]=Xe}),Ue.console=console.hasOwnProperty("log")?console:Ke;const $e={debug:Xe,error:Ue.console.error||Xe,info:Ue.console.info||Xe,log:Ue.console.log||Xe,warn:Ue.console.warn||Xe};function qe(e,t){$e[e]&&($e[e]=t||Xe)}function Ye(){$e.log(...arguments)}function Je(){$e.info(...arguments)}function Qe(){$e.debug(...arguments)}function Ze(){$e.error(...arguments)}function et(){$e.warn(...arguments)}const tt={};function rt(e){tt[e]||($e.error(e),tt[e]=!0)}const nt=Object.create(null);nt.Float32Array=Float32Array,nt.Float64Array=Float64Array,nt.Uint8Array=Uint8Array,nt.Int8Array=Int8Array,nt.Uint16Array=Uint16Array,nt.Int16Array=Int16Array,nt.Uint32Array=Uint32Array,nt.Int32Array=Int32Array,nt.Uint8ClampedArray=Uint8ClampedArray;try{nt.BigInt64Array=BigInt64Array,nt.BigUint64Array=BigUint64Array}catch{}function ot(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n1?t-1:0),n=1;n1&&void 0!==arguments[1]?arguments[1]:2,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;const n=["TB","GB","MB","KB"];let o=Number(e),i="B";for(;o>r;)o/=r,i=n.pop();return`${o.toFixed(t)} ${i}`}function ct(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ";const r=[];let n=e;for(;n>1e3;)r.push(("000"+n%1e3).slice(-3)),n=Math.floor(n/1e3);return n>0&&r.push(n),r.reverse(),r.join(t)}function dt(e){Object.keys(e).forEach(t=>{Array.isArray(e[t])&&(e[t]=[].concat(e[t]))})}function pt(e){return e&&e.isA?e.getState():e}function ft(e){setTimeout(e,0)}function ht(e,t){const r=performance.now();e.finally(()=>{const e=performance.now()-r;t(e)})}function mt(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};dt(t);const r=[];if(Number.isInteger(t.mtime)||(t.mtime=++je),"classHierarchy"in t){if(!(t.classHierarchy instanceof ze)){const e=new ze;for(let r=0;r!!t.deleted,e.modified=n=>{t.deleted?Ze("instance deleted - cannot call any method"):n&&nt&&t(e)))},e.onModified=e=>{if(t.deleted)return Ze("instance deleted - cannot call any method"),null;const o=r.length;return r.push(e),function(e){return Object.freeze({unsubscribe:function(){n(e)}})}(o)},e.getMTime=()=>t.mtime,e.isA=e=>{let r=t.classHierarchy.length;for(;r--;)if(t.classHierarchy[r]===e)return!0;return!1},e.getClassName=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.classHierarchy[t.classHierarchy.length-1-e]},e.set=function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=!1;return Object.keys(r).forEach(a=>{const s=o?null:e[`set${at(a)}`];s&&Array.isArray(r[a])&&s.length>1?i=s(...r[a])||i:s?i=s(r[a])||i:(-1!==["mtime"].indexOf(a)||n||et(`Warning: Set value to model directly ${a}, ${r[a]}`),i=t[a]!==r[a]||i,t[a]=r[a])}),i},e.get=function(){for(var e=arguments.length,r=new Array(e),n=0;n{o[e]=t[e]}),o},e.getReferenceByName=e=>t[e],e.delete=()=>{Object.keys(t).forEach(e=>delete t[e]),r.forEach((e,t)=>n(t)),t.deleted=!0},e.getState=()=>{if(t.deleted)return null;const r={...t,vtkClass:e.getClassName()};Object.keys(r).forEach(e=>{null===r[e]||void 0===r[e]||"_"===e[0]?delete r[e]:r[e].isA?r[e]=r[e].getState():Array.isArray(r[e])?r[e]=r[e].map(pt):function(e){return Object.values(nt).some(t=>e instanceof t)}(r[e])&&(r[e]=Array.from(r[e]))});const n={};return Object.keys(r).sort().forEach(e=>{n[e]=r[e]}),n.mtime&&delete n.mtime,n},e.shallowCopy=function(r){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(r.getClassName()!==e.getClassName())throw new Error(`Cannot ShallowCopy ${r.getClassName()} into ${e.getClassName()}`);const o=r.get(),i=Object.keys(t).sort();Object.keys(o).sort().forEach(e=>{const r=i.indexOf(e);-1===r?n&&Qe(`add ${e} in shallowCopy`):i.splice(r,1),t[e]=o[e]}),i.length&&n&&Qe(`Untouched keys: ${i.join(", ")}`),e.modified()},e.toJSON=function(){return e.getState()},e}const gt={object:(e,t,r)=>function(){return{...t[r.name]}}};function yt(e,t,r){r.forEach(r=>{if("object"==typeof r){const n=gt[r.type];e[`get${st(r.name)}`]=n?n(e,t,r):()=>t[r.name]}else e[`get${st(r)}`]=()=>t[r]})}const vt={enum(e,t,r){const n=`_on${st(r.name)}Changed`;return o=>{if("string"==typeof o){if(void 0!==r.enum[o])return t[r.name]!==r.enum[o]&&(t[r.name]=r.enum[o],e.modified(),!0);throw Ze(`Set Enum with invalid argument ${r}, ${o}`),new RangeError("Set Enum with invalid string argument")}if("number"==typeof o){if(t[r.name]!==o){if(-1!==Object.keys(r.enum).map(e=>r.enum[e]).indexOf(o)){const i=t[r.name];return t[r.name]=o,t[n]?.(e,t,o,i),e.modified(),!0}throw Ze(`Set Enum outside numeric range ${r}, ${o}`),new RangeError("Set Enum outside numeric range")}return!1}throw Ze(`Set Enum with invalid argument (String/Number) ${r}, ${o}`),new TypeError("Set Enum with invalid argument (String/Number)")}},object(e,t,r){1===r.params?.length&&et('Setter of type "object" with a single "param" field is not supported');const n=`_on${st(r.name)}Changed`;return function(){for(var o=arguments.length,i=new Array(o),a=0;a1&&r.params?.length?r.params.reduce((e,t,r)=>Object.assign(e,{[t]:i[r]}),{}):i[0],!ke(t[r.name],s)){const o=t[r.name];return t[r.name]=s,t[n]?.(e,t,s,o),e.modified(),!0}return!1}}};function bt(e){if("object"==typeof e){const t=vt[e.type];if(t)return(r,n)=>t(r,n,e);throw Ze(`No setter for field ${e}`),new TypeError("No setter for field")}return function(t,r){const n=`_on${st(e)}Changed`;return function(o){if(r.deleted)return Ze("instance deleted - cannot call any method"),!1;if(r[e]!==o){const i=r[e.name];return r[e]=o,r[n]?.(t,r,o,i),t.modified(),!0}return!1}}}function xt(e,t,r){r.forEach(r=>{"object"==typeof r?e[`set${st(r.name)}`]=bt(r)(e,t):e[`set${st(r)}`]=bt(r)(e,t)})}function _t(e,t,r){yt(e,t,r),xt(e,t,r)}function St(e,t,r){r.forEach(r=>{e[`get${st(r)}`]=()=>t[r]?Array.from(t[r]):t[r],e[`get${st(r)}ByReference`]=()=>t[r]})}function Ct(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;r.forEach(r=>{if(t[r]&&n&&t[r].length!==n)throw new RangeError(`Invalid initial number of values for array (${r})`);const i=`_on${st(r)}Changed`;e[`set${st(r)}`]=function(){if(t.deleted)return Ze("instance deleted - cannot call any method"),!1;for(var a=arguments.length,s=new Array(a),l=0;l=0)&&(c=c[0],d=!0),null==c)u=t[r]!==c;else{if(n&&c.length!==n){if(!(c.length{const n=t[r];e.forEach((e,t)=>{n[t]=e})}})}function Tt(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;St(e,t,r),Ct(e,t,r,n,o)}function wt(e,t,r){for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0;t.deleted?Ze("instance deleted - cannot call any method"):n>=t.numberOfInputs?Ze(`algorithm ${e.getClassName()} only has ${t.numberOfInputs} input ports. To add more input ports, use addInputData()`):(t.inputData[n]!==r||t.inputConnection[n])&&(t.inputData[n]=r,t.inputConnection[n]=null,e.modified&&e.modified())}function i(r){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(t.deleted)Ze("instance deleted - cannot call any method");else{if(n>=t.numberOfInputs){let r=`algorithm ${e.getClassName()} only has `;return r+=`${t.numberOfInputs}`,r+=" input ports. To add more input ports, use addInputConnection()",void Ze(r)}t.inputData[n]=null,t.inputConnection[n]=r}}function a(){let e=t.numberOfInputs;for(;e&&!t.inputData[e-1]&&!t.inputConnection[e-1];)e--;return e===t.numberOfInputs&&t.numberOfInputs++,e}function s(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.deleted?(Ze("instance deleted - cannot call any method"),null):(e.shouldUpdate()&&e.update(),t.output[r])}if(t.inputData?t.inputData=t.inputData.map(Ge):t.inputData=[],t.inputConnection?t.inputConnection=t.inputConnection.map(Ge):t.inputConnection=[],t.output?t.output=t.output.map(Ge):t.output=[],t.inputArrayToProcess?t.inputArrayToProcess=t.inputArrayToProcess.map(Ge):t.inputArrayToProcess=[],t.numberOfInputs=r,e.shouldUpdate=()=>{const r=e.getMTime();let o=1/0,i=n;for(;i--;){if(!t.output[i]||t.output[i].isDeleted())return!0;const e=t.output[i].getMTime();if(eo)return!0;return!1},t.numberOfInputs){let r=t.numberOfInputs;for(;r--;)t.inputData.push(null),t.inputConnection.push(null);e.setInputData=o,e.setInputConnection=i,e.addInputData=function(e){t.deleted?Ze("instance deleted - cannot call any method"):o(e,a())},e.addInputConnection=function(e){t.deleted?Ze("instance deleted - cannot call any method"):i(e,a())},e.getInputData=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.inputConnection[e]&&(t.inputData[e]=t.inputConnection[e]()),t.inputData[e]},e.getInputConnection=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.inputConnection[e]}}n&&(e.getOutputData=s,e.getOutputPort=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const r=()=>s(t);return r.filter=e,r}),e.update=()=>{const r=[];if(t.numberOfInputs){let n=0;for(;nt.numberOfInputs,e.getNumberOfOutputPorts=()=>n||t.output.length,e.getInputArrayToProcess=e=>{const r=t.inputArrayToProcess[e],n=t.inputData[e];return r&&n?n[`get${r.fieldAssociation}`]().getArray(r.arrayName):null},e.setInputArrayToProcess=function(e,r,n){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"Scalars";for(;t.inputArrayToProcess.lengthn.apply(e,arguments),1-o);else if(n.apply(e,arguments)===Et)break}},e[`on${st(r)}`]=function(e){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!e.apply)return console.error(`Invalid callback for event ${r}`),null;if(t.deleted)return Ze("instance deleted - cannot call any method"),null;const s=i++;return n.push([s,e,o]),n.sort((e,t)=>t[2]-e[2]),function(e){return Object.freeze({unsubscribe:function(){a(e)}})}(s)},e.delete=()=>{o(),n.forEach(e=>{let[t]=e;return a(t)})}}function Pt(e,t){const r=function(){const t={};return e(t,{},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Object.freeze(t)};return t&&Ge.register(t,r),r}function It(){for(var e=arguments.length,t=new Array(e),r=0;r!!e).map(e=>e(...r))}}function Ot(e){return e&&e.isA&&e.isA("vtkObject")}function Nt(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(Ot(e)){if(n.indexOf(e)>=0)return r;n.push(e);const o=t(e);void 0!==o&&r.push(o);const i=e.get();Object.keys(i).forEach(e=>{const o=i[e];Array.isArray(o)?o.forEach(e=>{Nt(e,t,r,n)}):Nt(o,t,r,n)})}return r}function Mt(e,t,r){var n=this;let o;const i=function(){for(var i=arguments.length,a=new Array(i),s=0;s{o=null,r||e.apply(l,a)},t),u&&e.apply(l,a)};return i.cancel=()=>clearTimeout(o),i}function Rt(e,t){let r=!1,n=null;function o(){r=!1,null!==n&&(i(...n),n=null)}function i(){for(var i=arguments.length,a=new Array(i),s=0;s2&&void 0!==arguments[2]?arguments[2]:{};t.keystore=Object.assign(t.keystore||{},r),e.setKey=(e,r)=>{t.keystore[e]=r},e.getKey=e=>t.keystore[e],e.getAllKeys=()=>Object.keys(t.keystore),e.deleteKey=e=>delete t.keystore[e],e.clearKeystore=()=>e.getAllKeys().forEach(e=>delete t.keystore[e])}let Bt=1;const Lt="__root__";function kt(e,t){Ft(e,t);const r=e.delete;t.proxyId=""+Bt++,t.ui=JSON.parse(JSON.stringify(t.ui||[])),yt(e,t,["proxyId","proxyGroup","proxyName"]),_t(e,t,["proxyManager"]);const n={},o={};function i(e,t){o[t]||(o[t]=[]);const r=o[t];for(let t=0;t0&&void 0!==arguments[0]?arguments[0]:Lt;const n=[],i=t.proxyId,s=function(){return o[arguments.length>0&&void 0!==arguments[0]?arguments[0]:Lt]}(r)||[];for(let t=0;t{t.ui=JSON.parse(JSON.stringify(r||[])),Object.keys(n).forEach(e=>delete n[e]),Object.keys(o).forEach(e=>delete o[e]),i(t.ui,Lt),e.modified()},e.updateProxyProperty=(e,t)=>{const r=n[e];r?Object.assign(r,t):n[e]={...t}},e.activate=()=>{if(t.proxyManager){const r=`setActive${st(e.getProxyGroup().slice(0,-1))}`;t.proxyManager[r]&&t.proxyManager[r](e)}},t.propertyLinkSubscribers={},e.registerPropertyLinkForGC=(e,r)=>{r in t.propertyLinkSubscribers||(t.propertyLinkSubscribers[r]=[]),t.propertyLinkSubscribers[r].push(e)},e.gcPropertyLinks=r=>{const n=t.propertyLinkSubscribers[r]||[];for(;n.length;)n.pop().unbind(e)},t.propertyLinkMap={},e.getPropertyLink=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t.propertyLinkMap[e])return t.propertyLinkMap[e];let n=null;const o=[];let i=0,a=!1;function s(r){let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(a)return null;const l=[];let u=null;for(i=o.length;i--;){const e=o[i];e.instance===r?u=e:l.push(e)}if(!u)return null;const c=u.instance[`get${st(u.propertyName)}`]();if(!function(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0;r2&&void 0!==arguments[2]&&arguments[2];const a=r.onModified(s),u=o[0];return o.push({instance:r,propertyName:n,subscription:a}),i&&(t.propertyLinkMap[e].persistent&&void 0!==t.propertyLinkMap[e].value?r.set({[n]:t.propertyLinkMap[e].value}):u&&s(u.instance,!0)),{unsubscribe:()=>l(r,n)}},unbind:l,unsubscribe:function(){for(;o.length;)o.pop().subscription.unsubscribe()},persistent:r};return t.propertyLinkMap[e]=u,u},e.listPropertyNames=()=>a().map(e=>e.name),e.getPropertyByName=e=>a().find(t=>t.name===e),e.getPropertyDomainByName=e=>(n[e]||{}).domain,e.getProxySection=()=>({id:t.proxyId,name:t.proxyGroup,ui:t.ui,properties:a()}),e.delete=()=>{const n=Object.keys(t.propertyLinkMap);let o=n.length;for(;o--;)t.propertyLinkMap[n[o]].unsubscribe();Object.keys(t.propertyLinkSubscribers).forEach(e.gcPropertyLinks),r()},e.getState=()=>null,ft(function(){if(t.links)for(let r=0;r{for(;o.length;)o.pop().unsubscribe();n()}}function Vt(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};function o(e){const r=Object.keys(e);let n=r.length;for(;n--;){const o=r[n];t[o].set(e[o])}}t.this=e;const i=Object.keys(n);let a=i.length;for(;a--;){const s=i[a];t[s]=n[s];const l=r[s];e[`set${st(s)}`]=r=>{r!==t[s]&&(t[s]=r,o(l[r]),e.modified())}}i.length&&yt(e,t,i)}function Gt(e){let t=0,r=0,n=0,o=0;return"detail"in e&&(r=e.detail),"wheelDelta"in e&&(r=-e.wheelDelta/120),"wheelDeltaY"in e&&(r=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(t=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(t=r,r=0),n=10*t,o=10*r,"deltaY"in e&&(o=e.deltaY),"deltaX"in e&&(n=e.deltaX),(n||o)&&e.deltaMode&&(1===e.deltaMode?(n*=40,o*=40):(n*=800,o*=800)),n&&!t&&(t=n<1?-1:1),o&&!r&&(r=o<1?-1:1),{spinX:t,spinY:r||t,pixelX:n,pixelY:o||n}}var zt={algo:At,capitalize:at,chain:It,debounce:Mt,enumToString:function(e,t){return Object.keys(e).find(r=>e[r]===t)},event:Dt,EVENT_ABORT:Et,formatBytesToProperUnit:ut,formatNumbersWithThousandSeparator:ct,get:yt,getArray:St,getCurrentGlobalMTime:function(){return je},getStateArrayMapFunc:pt,isVtkObject:Ot,keystore:Ft,measurePromiseExecution:ht,moveToProtected:wt,newInstance:Pt,newTypedArray:ot,newTypedArrayFrom:it,normalizeWheel:Gt,obj:mt,proxy:kt,proxyPropertyMapping:Ut,proxyPropertyState:Vt,safeArrays:dt,set:xt,setArray:Ct,setGet:_t,setGetArray:Tt,setImmediate:ft,setLoggerFunction:qe,throttle:Rt,traverseInstanceTree:Nt,TYPED_ARRAYS:nt,uncapitalize:lt,VOID:He,vtkDebugMacro:Qe,vtkErrorMacro:Ze,vtkInfoMacro:Je,vtkLogMacro:Ye,vtkOnceErrorMacro:rt,vtkWarningMacro:et,objectSetterMap:vt,requiredParam:We},jt=Object.freeze({__proto__:null,requiredParam:We,VOID:He,setLoggerFunction:qe,vtkLogMacro:Ye,vtkInfoMacro:Je,vtkDebugMacro:Qe,vtkErrorMacro:Ze,vtkWarningMacro:et,vtkOnceErrorMacro:rt,TYPED_ARRAYS:nt,newTypedArray:ot,newTypedArrayFrom:it,capitalize:at,_capitalize:st,uncapitalize:lt,formatBytesToProperUnit:ut,formatNumbersWithThousandSeparator:ct,setImmediateVTK:ft,measurePromiseExecution:ht,obj:mt,get:yt,set:xt,setGet:_t,getArray:St,setArray:Ct,setGetArray:Tt,moveToProtected:wt,algo:At,EVENT_ABORT:Et,event:Dt,newInstance:Pt,chain:It,isVtkObject:Ot,traverseInstanceTree:Nt,debounce:Mt,throttle:Rt,keystore:Ft,proxy:kt,proxyPropertyMapping:Ut,proxyPropertyState:Vt,normalizeWheel:Gt,default:zt});const{vtkErrorMacro:Wt}=zt,Ht={renderable:null,myFactory:null,children:[],visited:!1};function Kt(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ht,r),zt.obj(e,t),zt.event(e,t,"event"),t._renderableChildMap=new Map,zt.get(e,t,["visited"]),zt.setGet(e,t,["_parent","renderable","myFactory"]),zt.getArray(e,t,["children"]),zt.moveToProtected(e,t,["parent"]),function(e,t){function r(e,r){for(let n=0;n{},e.render=e=>{},e.traverse=r=>{const n=r.getTraverseOperation(),o=e[n];if(o)o(r);else{e.apply(r,!0);for(let e=0;e{const n=e[t.getOperation()];n&&n(r,t)},e.getViewNodeFor=function(r){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(n&&n.renderable===r)return n;if(t.renderable===r)return e;for(let e=0;et._parent?t._parent.isA(e)?t._parent:t._parent.getFirstAncestorOfType(e):null,e.getLastAncestorOfType=e=>t._parent?t._parent.getLastAncestorOfType(e)||(t._parent.isA(e)?t._parent:null):null,e.addMissingNode=r=>{if(!r)return;const n=t._renderableChildMap.get(r);if(void 0!==n)return n.setVisited(!0),n;const o=e.createViewNode(r);return o?(o.setParent(e),o.setVisited(!0),t._renderableChildMap.set(r,o),t.children.push(o),o):void 0},e.addMissingNodes=function(n){let o,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(n&&n.length)for(let a=0;a{if(r&&r.length)for(let n=0;n{const r=t.children.findIndex(t=>t===e);if(r<0)return!1;const n=e.getRenderable();return n&&t._renderableChildMap.delete(n),e.delete(),t.children.splice(r,1),!0},e.prepareNodes=()=>{for(let e=0;e{t.visited=e},e.removeUnusedNodes=()=>{let e=0;for(let r=0;r{if(!t.myFactory)return Wt("Cannot create view nodes without my own factory"),null;const r=t.myFactory.createNode(e);return r&&r.setRenderable(e),r};const n=e.delete;e.delete=()=>{for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,$t,r),zt.obj(e,t),function(e,t){t.overrides||(t.overrides={}),t.classHierarchy.push("vtkViewNodeFactory"),e.createNode=r=>{if(r.isDeleted())return null;let n=0,o=r.getClassName(n++),i=!1;const a=Object.keys(t.overrides);for(;o&&!i;)-1!==a.indexOf(o)?i=!0:o=r.getClassName(n++);if(!i)return null;const s=t.overrides[o]();return s.setMyFactory(e),s}}(e,t)}var Yt={newInstance:zt.newInstance(qt,"vtkViewNodeFactory"),extend:qt};const Jt=Object.create(null);function Qt(e,t){Jt[e]=t}const Zt={};function er(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Zt,r),t.overrides=Jt,Yt.extend(e,t,r),function(e,t){t.classHierarchy.push("vtkOpenGLViewNodeFactory")}(0,t)}var tr={newInstance:zt.newInstance(er,"vtkOpenGLViewNodeFactory"),extend:er};const rr={context:null,lastRenderer:null,keyMatrixTime:null,keyMatrices:null};const nr=Pt(function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,rr,r),Xt.extend(e,t,r),t.keyMatrixTime={},mt(t.keyMatrixTime),t.keyMatrices={normalMatrix:new Float64Array(9),vcpc:new Float64Array(16),wcvc:new Float64Array(16),wcpc:new Float64Array(16)},_t(e,t,["context","keyMatrixTime"]),function(e,t){t.classHierarchy.push("vtkOpenGLCamera"),e.buildPass=r=>{r&&(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext())},e.opaquePass=e=>{if(e){const e=t._openGLRenderer.getTiledSizeAndOrigin();t.context.viewport(e.lowerLeftU,e.lowerLeftV,e.usize,e.vsize),t.context.scissor(e.lowerLeftU,e.lowerLeftV,e.usize,e.vsize)}},e.translucentPass=e.opaquePass,e.zBufferPass=e.opaquePass,e.opaqueZBufferPass=e.opaquePass,e.volumePass=e.opaquePass,e.getKeyMatrices=r=>{if(r!==t.lastRenderer||t._openGLRenderWindow.getMTime()>t.keyMatrixTime.getMTime()||e.getMTime()>t.keyMatrixTime.getMTime()||r.getMTime()>t.keyMatrixTime.getMTime()||t.renderable.getMTime()>t.keyMatrixTime.getMTime()){d(t.keyMatrices.wcvc,t.renderable.getViewMatrix()),se(t.keyMatrices.normalMatrix,t.keyMatrices.wcvc),he(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),m(t.keyMatrices.wcvc,t.keyMatrices.wcvc);const e=t._openGLRenderer.getAspectRatio();d(t.keyMatrices.vcpc,t.renderable.getProjectionMatrix(e,-1,1)),m(t.keyMatrices.vcpc,t.keyMatrices.vcpc),b(t.keyMatrices.wcpc,t.keyMatrices.vcpc,t.keyMatrices.wcvc),t.keyMatrixTime.modified(),t.lastRenderer=r}return t.keyMatrices}}(e,t)});Qt("vtkCamera",nr);const{vtkDebugMacro:or}=jt,ir={context:null,_openGLRenderWindow:null,selector:null};const ar=Pt(function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ir,r),Xt.extend(e,t,r),yt(e,t,["shaderCache"]),_t(e,t,["selector"]),wt(0,t,["openGLRenderWindow"]),function(e,t){t.classHierarchy.push("vtkOpenGLRenderer"),e.buildPass=r=>{if(r){if(!t.renderable)return;e.updateLights(),e.prepareNodes(),e.addMissingNode(t.renderable.getActiveCamera()),e.addMissingNodes(t.renderable.getViewPropsWithNestedProps(),!0),e.removeUnusedNodes()}},e.updateLights=()=>{let e=0;const r=t.renderable.getLightsByReference();for(let t=0;t0&&e++;return e||(or("No lights are on, creating one."),t.renderable.createLight()),e},e.zBufferPass=r=>{if(r){let r=0;const n=t.context;t.renderable.getTransparent()||(t.context.clearColor(1,0,0,1),r|=n.COLOR_BUFFER_BIT),t.renderable.getPreserveDepthBuffer()||(n.clearDepth(1),r|=n.DEPTH_BUFFER_BIT,t.context.depthMask(!0));const o=e.getTiledSizeAndOrigin();n.enable(n.SCISSOR_TEST),n.scissor(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),n.viewport(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),n.colorMask(!0,!0,!0,!0),r&&n.clear(r),n.enable(n.DEPTH_TEST)}},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.cameraPass=t=>{t&&e.clear()},e.getAspectRatio=()=>{const e=t._parent.getSizeByReference(),r=t.renderable.getViewportByReference();return e[0]*(r[2]-r[0])/((r[3]-r[1])*e[1])},e.getTiledSizeAndOrigin=()=>{const e=t.renderable.getViewportByReference(),r=[0,0,1,1],n=e[0]-r[0],o=e[1]-r[1],i=t._parent.normalizedDisplayToDisplay(n,o),a=Math.round(i[0]),s=Math.round(i[1]),l=e[2]-r[0],u=e[3]-r[1],c=t._parent.normalizedDisplayToDisplay(l,u);let d=Math.round(c[0])-a,p=Math.round(c[1])-s;return d<0&&(d=0),p<0&&(p=0),{usize:d,vsize:p,lowerLeftU:a,lowerLeftV:s}},e.clear=()=>{let r=0;const n=t.context;if(!t.renderable.getTransparent()){const e=t.renderable.getBackgroundByReference();n.clearColor(e[0],e[1],e[2],e[3]),r|=n.COLOR_BUFFER_BIT}t.renderable.getPreserveDepthBuffer()||(n.clearDepth(1),r|=n.DEPTH_BUFFER_BIT,n.depthMask(!0)),n.colorMask(!0,!0,!0,!0);const o=e.getTiledSizeAndOrigin();n.enable(n.SCISSOR_TEST),n.scissor(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),n.viewport(o.lowerLeftU,o.lowerLeftV,o.usize,o.vsize),r&&n.clear(r),n.enable(n.DEPTH_TEST)},e.releaseGraphicsResources=()=>{null!==t.selector&&t.selector.releaseGraphicsResources(),t.renderable&&t.renderable.getViewProps().forEach(e=>{e.modified()})},e.setOpenGLRenderWindow=r=>{t._openGLRenderWindow!==r&&(e.releaseGraphicsResources(),t._openGLRenderWindow=r,t.context=null,r&&(t.context=t._openGLRenderWindow.getContext()))}}(e,t)},"vtkOpenGLRenderer");Qt("vtkRenderer",ar);const sr={context:null,keyMatrixTime:null,keyMatrices:null,activeTextures:null};const lr=Pt(function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,sr,r),Xt.extend(e,t,r),t.keyMatrixTime={},mt(t.keyMatrixTime,{mtime:0}),t.keyMatrices={normalMatrix:pe(new Float64Array(9)),mcwc:h(new Float64Array(16))},_t(e,t,["context"]),yt(e,t,["activeTextures"]),function(e,t){t.classHierarchy.push("vtkOpenGLActor"),e.buildPass=r=>{if(r){t._openGLRenderWindow=e.getLastAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNodes(t.renderable.getTextures()),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes(),t.ogltextures=null,t.activeTextures=null;for(let e=0;e{t.renderable&&t.renderable.getNestedVisibility()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(r,!0),t.oglmapper.traverse(r),e.apply(r,!1))},e.traverseOpaqueZBufferPass=t=>e.traverseOpaquePass(t),e.traverseOpaquePass=r=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(r,!0),t.oglmapper.traverse(r),e.apply(r,!1))},e.traverseTranslucentPass=r=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t._openGLRenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(r,!0),t.oglmapper.traverse(r),e.apply(r,!1))},e.activateTextures=()=>{if(t.ogltextures){t.activeTextures=[];for(let e=0;e{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?r.incrementOpaqueActorCount():r.incrementTranslucentActorCount()}},e.zBufferPass=(t,r)=>e.opaquePass(t,r),e.opaqueZBufferPass=(t,r)=>e.opaquePass(t,r),e.opaquePass=(r,n)=>{if(r)t.context.depthMask(!0),e.activateTextures();else if(t.activeTextures)for(let e=0;e{if(r)t.context.depthMask(t._openGLRenderer.getSelector()&&t.renderable.getNestedPickable()),e.activateTextures();else if(t.activeTextures)for(let e=0;e(t.renderable.getMTime()>t.keyMatrixTime.getMTime()&&(t.renderable.computeMatrix(),d(t.keyMatrices.mcwc,t.renderable.getMatrix()),m(t.keyMatrices.mcwc,t.keyMatrices.mcwc),t.renderable.getIsIdentity()?pe(t.keyMatrices.normalMatrix):(se(t.keyMatrices.normalMatrix,t.keyMatrices.mcwc),he(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),fe(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix)),t.keyMatrixTime.modified()),t.keyMatrices)}(e,t)});Qt("vtkActor",lr);const ur={context:null,activeTextures:null};const cr=Pt(function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ur,r),Xt.extend(e,t,r),_t(e,t,["context"]),yt(e,t,["activeTextures"]),function(e,t){t.classHierarchy.push("vtkOpenGLActor2D"),e.buildPass=r=>{if(r){if(!t.renderable)return;t._openGLRenderWindow=e.getLastAncestorOfType("vtkOpenGLRenderWindow"),t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t._openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNodes(t.renderable.getTextures()),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes(),t.ogltextures=null,t.activeTextures=null;for(let e=0;e{if(e){if(!t.renderable||!t.renderable.getVisibility())return;r.incrementOverlayActorCount()}},e.traverseOpaquePass=r=>{t.oglmapper&&t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(r,!0),t.oglmapper.traverse(r),e.apply(r,!1))},e.traverseTranslucentPass=r=>{t.oglmapper&&t.renderable&&t.renderable.getNestedVisibility()&&!t.renderable.getIsOpaque()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(r,!0),t.oglmapper.traverse(r),e.apply(r,!1))},e.traverseOverlayPass=r=>{t.oglmapper&&t.renderable&&t.renderable.getNestedVisibility()&&(!t._openGLRenderer.getSelector()||t.renderable.getNestedPickable)&&(e.apply(r,!0),t.oglmapper.traverse(r),e.apply(r,!1))},e.activateTextures=()=>{if(t.ogltextures){t.activeTextures=[];for(let e=0;e{if(r)t.context.depthMask(!0),e.activateTextures();else if(t.activeTextures)for(let e=0;e{if(r)t.context.depthMask(!1),e.activateTextures();else if(t.activeTextures)for(let e=0;e{if(r)t.context.depthMask(!0),e.activateTextures();else if(t.activeTextures)for(let e=0;e0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function xr(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function _r(e,t,r){var n=t[0],o=t[1],i=t[2],a=r[0],s=r[1],l=r[2];return e[0]=o*l-i*s,e[1]=i*a-n*l,e[2]=n*s-o*a,e}function Sr(e,t,r){var n=t[0],o=t[1],i=t[2],a=r[3]*n+r[7]*o+r[11]*i+r[15];return a=a||1,e[0]=(r[0]*n+r[4]*o+r[8]*i+r[12])/a,e[1]=(r[1]*n+r[5]*o+r[9]*i+r[13])/a,e[2]=(r[2]*n+r[6]*o+r[10]*i+r[14])/a,e}function Cr(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function Tr(e,t){var r=e[0],n=e[1],o=e[2],a=t[0],s=t[1],l=t[2];return Math.abs(r-a)<=i*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-s)<=i*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(o-l)<=i*Math.max(1,Math.abs(o),Math.abs(l))}Qt("vtkActor2D",cr);var wr=yr,Ar=pr;dr();const Er=Math.sqrt(50),Dr=Math.sqrt(10),Pr=Math.sqrt(2);function Ir(e,t,r){const n=(t-e)/Math.max(0,r),o=Math.floor(Math.log10(n)),i=n/Math.pow(10,o),a=i>=Er?10:i>=Dr?5:i>=Pr?2:1;let s,l,u;return o<0?(u=Math.pow(10,-o)/a,s=Math.round(e*u),l=Math.round(t*u),s/ut&&--l,u=-u):(u=Math.pow(10,o)*a,s=Math.round(e/u),l=Math.round(t/u),s*ut&&--l),lt?1:e>=t?0:NaN}function Mr(e,t){return null==e||null==t?NaN:te?1:t>=e?0:NaN}function Rr(e){let t,r,n;function o(e,n,o=0,i=e.length){if(o>>1;r(e[t],n)<0?o=t+1:i=t}while(oNr(e(t),r),n=(t,r)=>e(t)-r):(t=e===Nr||e===Mr?e:Fr,r=e,n=e),{left:o,center:function(e,t,r=0,i=e.length){const a=o(e,t,r,i-1);return a>r&&n(e[a-1],t)>-n(e[a],t)?a-1:a},right:function(e,n,o=0,i=e.length){if(o>>1;r(e[t],n)<=0?o=t+1:i=t}while(o>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===r?an(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===r?an(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=$r.exec(e))?new ln(t[1],t[2],t[3],1):(t=qr.exec(e))?new ln(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=Yr.exec(e))?an(t[1],t[2],t[3],t[4]):(t=Jr.exec(e))?an(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=Qr.exec(e))?hn(t[1],t[2]/100,t[3]/100,1):(t=Zr.exec(e))?hn(t[1],t[2]/100,t[3]/100,t[4]):en.hasOwnProperty(e)?on(en[e]):"transparent"===e?new ln(NaN,NaN,NaN,0):null}function on(e){return new ln(e>>16&255,e>>8&255,255&e,1)}function an(e,t,r,n){return n<=0&&(e=t=r=NaN),new ln(e,t,r,n)}function sn(e,t,r,n){return 1===arguments.length?((o=e)instanceof Gr||(o=nn(o)),o?new ln((o=o.rgb()).r,o.g,o.b,o.opacity):new ln):new ln(e,t,r,null==n?1:n);var o}function ln(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}function un(){return`#${fn(this.r)}${fn(this.g)}${fn(this.b)}`}function cn(){const e=dn(this.opacity);return`${1===e?"rgb(":"rgba("}${pn(this.r)}, ${pn(this.g)}, ${pn(this.b)}${1===e?")":`, ${e})`}`}function dn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function pn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function fn(e){return((e=pn(e))<16?"0":"")+e.toString(16)}function hn(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new gn(e,t,r,n)}function mn(e){if(e instanceof gn)return new gn(e.h,e.s,e.l,e.opacity);if(e instanceof Gr||(e=nn(e)),!e)return new gn;if(e instanceof gn)return e;var t=(e=e.rgb()).r/255,r=e.g/255,n=e.b/255,o=Math.min(t,r,n),i=Math.max(t,r,n),a=NaN,s=i-o,l=(i+o)/2;return s?(a=t===i?(r-n)/s+6*(r0&&l<1?0:a,new gn(a,s,l,e.opacity)}function gn(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}function yn(e){return(e=(e||0)%360)<0?e+360:e}function vn(e){return Math.max(0,Math.min(1,e||0))}function bn(e,t,r){return 255*(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)}function xn(e,t,r,n,o){var i=e*e,a=i*e;return((1-3*e+3*i-a)*t+(4-6*i+3*a)*r+(1+3*e+3*i-3*a)*n+a*o)/6}Ur(Gr,nn,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:tn,formatHex:tn,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return mn(this).formatHsl()},formatRgb:rn,toString:rn}),Ur(ln,sn,Vr(Gr,{brighter(e){return e=null==e?jr:Math.pow(jr,e),new ln(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?zr:Math.pow(zr,e),new ln(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ln(pn(this.r),pn(this.g),pn(this.b),dn(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:un,formatHex:un,formatHex8:function(){return`#${fn(this.r)}${fn(this.g)}${fn(this.b)}${fn(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:cn,toString:cn})),Ur(gn,function(e,t,r,n){return 1===arguments.length?mn(e):new gn(e,t,r,null==n?1:n)},Vr(Gr,{brighter(e){return e=null==e?jr:Math.pow(jr,e),new gn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?zr:Math.pow(zr,e),new gn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,o=2*r-n;return new ln(bn(e>=240?e-240:e+120,o,n),bn(e,o,n),bn(e<120?e+240:e-120,o,n),this.opacity)},clamp(){return new gn(yn(this.h),vn(this.s),vn(this.l),dn(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=dn(this.opacity);return`${1===e?"hsl(":"hsla("}${yn(this.h)}, ${100*vn(this.s)}%, ${100*vn(this.l)}%${1===e?")":`, ${e})`}`}}));const _n=e=>()=>e;function Sn(e,t){var r=t-e;return r?function(e,t){return function(r){return e+r*t}}(e,r):_n(isNaN(e)?t:e)}const Cn=function e(t){var r=function(e){return 1===(e=+e)?Sn:function(t,r){return r-t?function(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}(t,r,e):_n(isNaN(t)?r:t)}}(t);function n(e,t){var n=r((e=sn(e)).r,(t=sn(t)).r),o=r(e.g,t.g),i=r(e.b,t.b),a=Sn(e.opacity,t.opacity);return function(t){return e.r=n(t),e.g=o(t),e.b=i(t),e.opacity=a(t),e+""}}return n.gamma=e,n}(1);function Tn(e){return function(t){var r,n,o=t.length,i=new Array(o),a=new Array(o),s=new Array(o);for(r=0;r=1?(r=1,t-1):Math.floor(r*t),o=e[n],i=e[n+1],a=n>0?e[n-1]:2*o-i,s=ni&&(o=t.slice(i,o),s[a]?s[a]+=o:s[++a]=o),(r=r[0])===(n=n[0])?s[a]?s[a]+=n:s[++a]=n:(s[++a]=null,l.push({i:a,x:En(r,n)})),i=In.lastIndex;return i=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Wn(e){if(!(t=jn.exec(e)))throw new Error("invalid format: "+e);var t;return new Hn({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function Hn(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function Kn(e,t){if(!isFinite(e)||0===e)return null;var r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function Xn(e){return(e=Kn(Math.abs(e)))?e[1]:NaN}function $n(e,t){var r=Kn(e,t);if(!r)return e+"";var n=r[0],o=r[1];return o<0?"0."+new Array(-o).join("0")+n:n.length>o+1?n.slice(0,o+1)+"."+n.slice(o+1):n+new Array(o-n.length+2).join("0")}Wn.prototype=Hn.prototype,Hn.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const qn={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>$n(100*e,t),r:$n,s:function(e,t){var r=Kn(e,t);if(!r)return zn=void 0,e.toPrecision(t);var n=r[0],o=r[1],i=o-(zn=3*Math.max(-8,Math.min(8,Math.floor(o/3))))+1,a=n.length;return i===a?n:i>a?n+new Array(i-a+1).join("0"):i>0?n.slice(0,i)+"."+n.slice(i):"0."+new Array(1-i).join("0")+Kn(e,Math.max(0,t+i-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Yn(e){return e}var Jn,Qn,Zn,eo=Array.prototype.map,to=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function ro(e){var t=e.domain;return e.ticks=function(e){var r=t();return function(e,t,r){if(!((r=+r)>0))return[];if((e=+e)===(t=+t))return[e];const n=t=o))return[];const s=i-o+1,l=new Array(s);if(n)if(a<0)for(let e=0;e0;){if((o=Or(l,u,r))===n)return i[a]=l,i[s]=u,t(i);if(o>0)l=Math.floor(l/o)*o,u=Math.ceil(u/o)*o;else{if(!(o<0))break;l=Math.ceil(l*o)/o,u=Math.floor(u*o)/o}n=o}return e},e}function no(){var e=function(){var e,t,r,n,o,i,a=Bn,s=Bn,l=Mn,u=Ln;function c(){var e,t,r,l=Math.min(a.length,s.length);return u!==Ln&&(e=a[0],t=a[l-1],e>t&&(r=e,e=t,t=r),u=function(r){return Math.max(e,Math.min(t,r))}),n=l>2?Vn:Un,o=i=null,d}function d(t){return null==t||isNaN(t=+t)?r:(o||(o=n(a.map(e),s,l)))(e(u(t)))}return d.invert=function(r){return u(t((i||(i=n(s,a.map(e),En)))(r)))},d.domain=function(e){return arguments.length?(a=Array.from(e,Fn),c()):a.slice()},d.range=function(e){return arguments.length?(s=Array.from(e),c()):s.slice()},d.rangeRound=function(e){return s=Array.from(e),l=Rn,c()},d.clamp=function(e){return arguments.length?(u=!!e||Ln,c()):u!==Ln},d.interpolate=function(e){return arguments.length?(l=e,c()):l},d.unknown=function(e){return arguments.length?(r=e,d):r},function(r,n){return e=r,t=n,c()}}()(Ln,Ln);return e.copy=function(){return t=e,no().domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown());var t},Gn.apply(e,arguments),ro(e)}Jn=function(e){var t,r,n=void 0===e.grouping||void 0===e.thousands?Yn:(t=eo.call(e.grouping,Number),r=e.thousands+"",function(e,n){for(var o=e.length,i=[],a=0,s=t[0],l=0;o>0&&s>0&&(l+s+1>n&&(s=Math.max(1,n-l)),i.push(e.substring(o-=s,o+s)),!((l+=s+1)>n));)s=t[a=(a+1)%t.length];return i.reverse().join(r)}),o=void 0===e.currency?"":e.currency[0]+"",i=void 0===e.currency?"":e.currency[1]+"",a=void 0===e.decimal?".":e.decimal+"",s=void 0===e.numerals?Yn:function(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}(eo.call(e.numerals,String)),l=void 0===e.percent?"%":e.percent+"",u=void 0===e.minus?"−":e.minus+"",c=void 0===e.nan?"NaN":e.nan+"";function d(e,t){var r=(e=Wn(e)).fill,d=e.align,p=e.sign,f=e.symbol,h=e.zero,m=e.width,g=e.comma,y=e.precision,v=e.trim,b=e.type;"n"===b?(g=!0,b="g"):qn[b]||(void 0===y&&(y=12),v=!0,b="g"),(h||"0"===r&&"="===d)&&(h=!0,r="0",d="=");var x=(t&&void 0!==t.prefix?t.prefix:"")+("$"===f?o:"#"===f&&/[boxX]/.test(b)?"0"+b.toLowerCase():""),_=("$"===f?i:/[%p]/.test(b)?l:"")+(t&&void 0!==t.suffix?t.suffix:""),S=qn[b],C=/[defgprs%]/.test(b);function T(e){var t,o,i,l=x,f=_;if("c"===b)f=S(e)+f,e="";else{var T=(e=+e)<0||1/e<0;if(e=isNaN(e)?c:S(Math.abs(e),y),v&&(e=function(e){e:for(var t,r=e.length,n=1,o=-1;n0&&(o=0)}return o>0?e.slice(0,o)+e.slice(t+1):e}(e)),T&&0===+e&&"+"!==p&&(T=!1),l=(T?"("===p?p:u:"-"===p||"("===p?"":p)+l,f=("s"!==b||isNaN(e)||void 0===zn?"":to[8+zn/3])+f+(T&&"("===p?")":""),C)for(t=-1,o=e.length;++t(i=e.charCodeAt(t))||i>57){f=(46===i?a+e.slice(t+1):e.slice(t))+f,e=e.slice(0,t);break}}g&&!h&&(e=n(e,1/0));var w=l.length+e.length+f.length,A=w>1)+l+e+f+A.slice(w);break;default:e=A+l+e+f}return s(e)}return y=void 0===y?6:/[gprs]/.test(b)?Math.max(1,Math.min(21,y)):Math.max(0,Math.min(20,y)),T.toString=function(){return e+""},T}return{format:d,formatPrefix:function(e,t){var r=3*Math.max(-8,Math.min(8,Math.floor(Xn(t)/3))),n=Math.pow(10,-r),o=d(((e=Wn(e)).type="f",e),{suffix:to[8+r/3]});return function(e){return o(n*e)}}}}({thousands:",",grouping:[3],currency:["$",""]}),Qn=Jn.format,Zn=Jn.formatPrefix;var oo=r(391);const io=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],ao=[1,0,0,0,1,0,0,0,1],so=1e-6,lo=1e-12,{vtkErrorMacro:uo,vtkWarningMacro:co}=zt;let po=0;function fo(e){return()=>uo(`vtkMath::${e} - NOT IMPLEMENTED`)}function ho(e,t,r,n){let o;for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:3;const t=Array(e);for(let r=0;r1&&void 0!==arguments[1]?arguments[1]:3;switch(t){case 1:return Math.abs(e);case 2:return Math.sqrt(e[0]*e[0]+e[1]*e[1]);case 3:return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);default:{let r=0;for(let n=0;n2&&void 0!==arguments[2]?arguments[2]:so;return e.length===t.length&&e.every(function(e,n){return Math.abs(e-t[n])<=r})}const $o=Xo;function qo(e){for(let t=0;t<3;t++)e[3*t]=e[3*t+1]=e[3*t+2]=0,e[3*t+t]=1}function Yo(e,t){for(let r=0;r1&&void 0!==arguments[1]?arguments[1]:0;if(!`${e}`.includes("e"))return+`${Math.round(`${e}e+${t}`)}e-${t}`;const r=`${e}`.split("e");let n="";return+r[1]+t>0&&(n="+"),+`${Math.round(`${+r[0]}e${n}${+r[1]+t}`)}e-${t}`}function Zo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return t[0]=Qo(e[0],r),t[1]=Qo(e[1],r),t[2]=Qo(e[2],r),t}function ei(e,t,r,n){let o,i,a,s,l,u,c,d,p,f,h,m,g,y,v,b;const x=go(t),_=go(t),S=(e,t,r)=>{y=e[t],g=e[r],e[t]=y-m*(g+y*f),e[r]=g+m*(y-g*f)};for(Yo(t,n),l=0;l3&&Math.abs(r[l])+y===Math.abs(r[l])&&Math.abs(r[s])+y===Math.abs(r[s]))e[l*t+s]=0;else if(Math.abs(e[l*t+s])>c){for(g=r[s]-r[l],Math.abs(g)+y===Math.abs(g)?p=e[l*t+s]/g:(d=.5*g/e[l*t+s],p=1/(Math.abs(d)+Math.sqrt(1+d*d)),d<0&&(p=-p)),v=1/Math.sqrt(1+p*p),m=p*v,f=m/(1+v),g=p*e[l*t+s],_[l]-=g,_[s]+=g,r[l]-=g,r[s]+=g,e[l*t+s]=0,i=0;i<=l-1;i++)S(e,i*t+l,i*t+s);for(i=l+1;i<=s-1;i++)S(e,l*t+i,i*t+s);for(i=s+1;i=20)return co("vtkMath::Jacobi: Error extracting eigenfunctions"),0;for(i=0;i=b||Math.abs(r[o]-b)>1)+(1&t);for(u=0,o=0;o=0&&u++;if(un?i:n,o=a>o?a:o,r[e]=1,0!==o&&(r[e]/=o)}const i=Math.abs(t[0])*r[0],a=Math.abs(t[3])*r[1],s=Math.abs(t[6])*r[2];n[0]=0,o=i,a>=o&&(o=a,n[0]=1),s>=o&&(n[0]=2),0!==n[0]&&(mo(t,3,n[0],0),r[n[0]]=r[0]);const l=Math.abs(t[4])*r[1],u=Math.abs(t[7])*r[2];n[1]=1,o=l,u>=o&&(n[1]=2,mo(t,3,1,2)),n[2]=2;let c=0;if(Ko(t)<0){c=1;for(let e=0;e<9;e++)t[e]=-t[e]}const d=go(4);if(ti(t,d),Jo(d,t),c)for(let e=0;e<9;e++)t[e]=-t[e];1!==n[1]&&mo(t,3,n[1],1),0!==n[0]&&mo(t,3,n[0],0)}function ni(e,t,r){let n,o,i,a,s,l;if(ei([...e],3,t,r),t[0]!==t[1]||t[0]!==t[2]){for(Ho(r,r),n=0;n<3;n++)if(t[(n+1)%3]===t[(n+2)%3]){for(l=Math.abs(r[3*n]),a=0,o=1;o<3;o++)l<(s=Math.abs(r[3*n+o]))&&(l=s,a=o);a!==n&&(s=t[a],t[a]=t[n],t[n]=s,ho(r,3,n,a)),r[3*a+a]<0&&(r[3*a]=-r[3*a],r[3*a+1]=-r[3*a+1],r[3*a+2]=-r[3*a+2]),o=(a+1)%3,i=(a+2)%3,r[3*o]=0,r[3*o+1]=0,r[3*o+2]=0,r[3*o+o]=1;const e=Fo([r[3*a],r[3*a+1],r[3*a+2]],[r[3*o],r[3*o+1],r[3*o+2]],[]);Lo(e);const u=Fo(e,[r[3*a],r[3*a+1],r[3*a+2]],[]);for(let t=0;t<3;t++)r[3*i+t]=e[t],r[3*o+t]=u[t];return void Ho(r,r)}for(l=Math.abs(r[0]),a=0,n=1;n<3;n++)l<(s=Math.abs(r[3*n]))&&(l=s,a=n);if(0!==a){const e=t[a];t[a]=t[0],t[0]=e,ho(r,3,a,0)}if(Math.abs(r[4])a&&(a=u);if(0===a)return co("Unable to factor linear system"),0;d[n]=1/a}for(o=0;o=a&&(a=l,c=n)}if(o!==c){for(i=0;i=0)for(i=a;i<=o-1;i++)l-=e[o*n+i]*r[i];else 0!==l&&(a=o);r[o]=l}for(o=n-1;o>=0;o--){for(l=r[o],i=o+1;i4&&void 0!==arguments[4]?arguments[4]:null;const o=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:null)||go(r),i=n||go(r);if(0===oi(e,o,r))return null;for(let n=0;nl?l=i:il?l=a:a0?(l-u)/l:0,n>0?(r=o===l?s*(i-a)/(l-u):i===l?1/3+s*(a-o)/(l-u):2/3+s*(o-i)/(l-u),r<0&&(r+=1)):r=0,t[0]=r,t[1]=n,t[2]=c}function ci(e,t){const[r,n,o]=e,i=1/3,a=1/6,s=2/3,l=5/6;let u,c,d;r>a&&r<=i?(c=1,u=(i-r)/a,d=0):r>i&&r<=.5?(c=1,d=(r-i)/a,u=0):r>.5&&r<=s?(d=1,c=(s-r)/a,u=0):r>s&&r<=l?(d=1,u=(r-s)/a,c=0):r>l&&r<=1?(u=1,d=(1-r)/a,c=0):(u=1,c=r/a,d=0),u=n*u+(1-n),c=n*c+(1-n),d=n*d+(1-n),u*=o,c*=o,d*=o,t[0]=u,t[1]=c,t[2]=d}function di(e,t){const[r,n,o]=e;let i=(r+16)/116,a=n/500+i,s=i-o/200;i**3>.008856?i**=3:i=(i-16/116)/7.787,a**3>.008856?a**=3:a=(a-16/116)/7.787,s**3>.008856?s**=3:s=(s-16/116)/7.787,t[0]=.9505*a,t[1]=1*i,t[2]=1.089*s}function pi(e,t){const[r,n,o]=e;let i=r/.9505,a=n/1,s=o/1.089;i>.008856?i**=1/3:i=7.787*i+16/116,a>.008856?a**=1/3:a=7.787*a+16/116,s>.008856?s**=1/3:s=7.787*s+16/116,t[0]=116*a-16,t[1]=500*(i-a),t[2]=200*(a-s)}function fi(e,t){const[r,n,o]=e;let i=3.2406*r+-1.5372*n+-.4986*o,a=-.9689*r+1.8758*n+.0415*o,s=.0557*r+-.204*n+1.057*o;i>.0031308?i=1.055*i**(1/2.4)-.055:i*=12.92,a>.0031308?a=1.055*a**(1/2.4)-.055:a*=12.92,s>.0031308?s=1.055*s**(1/2.4)-.055:s*=12.92;let l=i;l1&&(i/=l,a/=l,s/=l),i<0&&(i=0),a<0&&(a=0),s<0&&(s=0),t[0]=i,t[1]=a,t[2]=s}function hi(e,t){let[r,n,o]=e;r>.04045?r=((r+.055)/1.055)**2.4:r/=12.92,n>.04045?n=((n+.055)/1.055)**2.4:n/=12.92,o>.04045?o=((o+.055)/1.055)**2.4:o/=12.92,t[0]=.4124*r+.3576*n+.1805*o,t[1]=.2126*r+.7152*n+.0722*o,t[2]=.0193*r+.1192*n+.9505*o}function mi(e,t){const r=[0,0,0];hi(e,r),pi(r,t)}function gi(e,t){const r=[0,0,0];di(e,r),fi(r,t)}function yi(e){return e[0]=1,e[1]=-1,e[2]=1,e[3]=-1,e[4]=1,e[5]=-1,e}function vi(e){return!(e[1]-e[0]<0)}function bi(e,t,r){return er?r:e}function xi(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[0,0,0];return n[0]=bi(e[0],t[0],r[0]),n[1]=bi(e[1],t[1],r[1]),n[2]=bi(e[2],t[2],r[2]),n}const _i=fo("GetScalarTypeFittingRange"),Si=fo("GetAdjustedScalarRange");const Ci=e=>!Number.isFinite(e),{isFinite:Ti,isNaN:wi}=Number,Ai=wi;function Ei(){return[].concat([Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE])}function Di(e){const t=Math.floor(255*e);return t>15?t.toString(16):`0${t.toString(16)}`}function Pi(e){return Math.round(255*e)}var Ii,Oi={Pi:()=>Math.PI,ldexp:function(e,t){return t>1023?e*2**1023*2**(t-1023):t<-1074?5e-324*e*2**(t+1074):e*2**t},radiansFromDegrees:yo,degreesFromRadians:vo,round:bo,floor:xo,ceil:_o,ceilLog2:To,min:So,max:Co,arrayMin:function(e){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=1/0;for(let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=e.length;n2&&void 0!==arguments[2]?arguments[2]:1,r=-1/0;for(let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=e.length;n2&&void 0!==arguments[2]?arguments[2]:1,r=1/0,n=-1/0;for(let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=e.length;o=0;--o)if(r[o]0&&void 0!==arguments[0]?arguments[0]:0;return e+((arguments.length>1&&void 0!==arguments[1]?arguments[1]:1)-e)*Math.random()},gaussian:Do,add:Po,subtract:Io,multiplyScalar:Oo,multiplyScalar2D:No,multiplyAccumulate:Mo,multiplyAccumulate2D:function(e,t,r,n){return n[0]=e[0]+t[0]*r,n[1]=e[1]+t[1]*r,n},dot:Ro,outer:function(e,t,r){r[0]=e[0]*t[0],r[1]=e[0]*t[1],r[2]=e[0]*t[2],r[3]=e[1]*t[0],r[4]=e[1]*t[1],r[5]=e[1]*t[2],r[6]=e[2]*t[0],r[7]=e[2]*t[1],r[8]=e[2]*t[2]},cross:Fo,norm:Bo,normalize:Lo,perpendiculars:function(e,t,r,n){const o=e[0]*e[0],i=e[1]*e[1],a=e[2]*e[2],s=Math.sqrt(o+i+a);let l,u,c;o>i&&o>a?(l=0,u=1,c=2):i>a?(l=1,u=2,c=0):(l=2,u=0,c=1);const d=e[l]/s,p=e[u]/s,f=e[c]/s,h=Math.sqrt(d*d+f*f);if(0!==n){const e=Math.sin(n),o=Math.cos(n);t&&(t[l]=(f*o-d*p*e)/h,t[u]=e*h,t[c]=(-d*o-p*f*e)/h),r&&(r[l]=(-f*e-d*p*o)/h,r[u]=o*h,r[c]=(d*e-p*f*o)/h)}else t&&(t[l]=f/h,t[u]=0,t[c]=-d/h),r&&(r[l]=-d*p/h,r[u]=h,r[c]=-p*f/h)},projectVector:function(e,t,r){const n=Ro(t,t);if(0===n)return r[0]=0,r[1]=0,r[2]=0,!1;const o=Ro(e,t)/n;for(let e=0;e<3;e++)r[e]=t[e];return Oo(r,o),!0},projectVector2D:function(e,t,r){const n=Uo(t,t);if(0===n)return r[0]=0,r[1]=0,!1;const o=Uo(e,t)/n;for(let e=0;e<2;e++)r[e]=t[e];return No(r,o),!0},distance2BetweenPoints:Vo,angleBetweenVectors:function(e,t){const r=[0,0,0];return Fo(e,t,r),Math.atan2(Bo(r),Ro(e,t))},gaussianAmplitude:function(e,t,r){const n=Math.abs(e-r);return 1/Math.sqrt(2*Math.PI*t)*Math.exp(-(n**2)/(2*t))},gaussianWeight:function(e,t,r){const n=Math.abs(e-r);return Math.exp(-(n**2)/(2*t))},dot2D:Uo,outer2D:function(e,t,r){r[0]=e[0]*t[0],r[1]=e[0]*t[1],r[2]=e[1]*t[0],r[3]=e[1]*t[1]},norm2D:Go,normalize2D:zo,determinant2x2:jo,LUFactor3x3:function(e,t){let r,n,o;const i=[0,0,0];for(let t=0;t<3;t++)o=Math.abs(e[3*t]),(n=Math.abs(e[3*t+1]))>o&&(o=n),(n=Math.abs(e[3*t+2]))>o&&(o=n),i[t]=1/o;o=i[0]*Math.abs(e[0]),r=0,(n=i[1]*Math.abs(e[3]))>=o&&(o=n,r=1),(n=i[2]*Math.abs(e[6]))>=o&&(r=2),0!==r&&(ho(e,3,r,0),i[r]=i[0]),t[0]=r,e[3]/=e[0],e[6]/=e[0],e[4]-=e[3]*e[1],e[7]-=e[6]*e[1],o=i[1]*Math.abs(e[4]),r=1,(n=i[2]*Math.abs(e[7]))>=o&&(r=2,ho(e,3,1,2),i[2]=i[1]),t[1]=r,e[7]/=e[4],e[5]-=e[3]*e[2],e[8]-=e[6]*e[2]+e[7]*e[5],t[2]=2},LUSolve3x3:function(e,t,r){let n=r[t[0]];r[t[0]]=r[0],r[0]=n,n=r[t[1]],r[t[1]]=r[1],r[1]=n-e[3]*r[0],n=r[t[2]],r[t[2]]=r[2],r[2]=n-e[6]*r[0]-e[7]*r[1],r[2]/=e[8],r[1]=(r[1]-e[5]*r[2])/e[4],r[0]=(r[0]-e[1]*r[1]-e[2]*r[2])/e[0]},linearSolve3x3:function(e,t,r){const n=e[0],o=e[1],i=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],d=e[8],p=+jo(s,c,l,d),f=-jo(a,u,l,d),h=+jo(a,u,s,c),m=-jo(o,c,i,d),g=+jo(n,u,i,d),y=-jo(n,u,o,c),v=+jo(o,s,i,l),b=-jo(n,a,i,l),x=+jo(n,a,o,s),_=n*p+o*f+i*h,S=p*t[0]+m*t[1]+v*t[2],C=f*t[0]+g*t[1]+b*t[2],T=h*t[0]+y*t[1]+x*t[2];r[0]=S/_,r[1]=C/_,r[2]=T/_},multiply3x3_vect3:function(e,t,r){const n=e[0]*t[0]+e[1]*t[1]+e[2]*t[2],o=e[3]*t[0]+e[4]*t[1]+e[5]*t[2],i=e[6]*t[0]+e[7]*t[1]+e[8]*t[2];r[0]=n,r[1]=o,r[2]=i},multiply3x3_mat3:Wo,multiplyMatrix:function(e,t,r,n,o,i,a){n!==o&&uo("Number of columns of A must match number of rows of B.");const s=[...e],l=[...t];for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:so)},isIdentity3x3:function(e){return $o(e,ao,arguments.length>1&&void 0!==arguments[1]?arguments[1]:so)},determinant3x3:Ko,quaternionToMatrix3x3:Jo,areEquals:Xo,areMatricesEqual:$o,roundNumber:Qo,roundVector:Zo,matrix3x3ToQuaternion:ti,multiplyQuaternion:function(e,t,r){const n=e[0]*t[0],o=e[0]*t[1],i=e[0]*t[2],a=e[0]*t[3],s=e[1]*t[0],l=e[1]*t[1],u=e[1]*t[2],c=e[1]*t[3],d=e[2]*t[0],p=e[2]*t[1],f=e[2]*t[2],h=e[2]*t[3],m=e[3]*t[0],g=e[3]*t[1],y=e[3]*t[2],v=e[3]*t[3];r[0]=n-l-f-v,r[1]=o+s+h-y,r[2]=i-c+d+g,r[3]=a+u-p+m},orthogonalize3x3:ri,diagonalize3x3:ni,singularValueDecomposition3x3:function(e,t,r,n){let o;const i=[...e],a=Ko(i);if(a<0)for(o=0;o<9;o++)i[o]=-i[o];ri(i,t),Ho(i,i),Wo(i,t,n),ni(n,r,n),Wo(t,n,t),Ho(n,n),a<0&&(r[0]=-r[0],r[1]=-r[1],r[2]=-r[2])},solveLinearSystem:ai,invertMatrix:si,luFactorLinearSystem:oi,luSolveLinearSystem:ii,estimateMatrixCondition:function(e,t){let r=+Number.MAX_VALUE,n=-Number.MAX_VALUE;for(let r=0;rn&&(n=Math.abs(e[r*t+o]));for(let n=0;n6&&void 0!==arguments[6])||arguments[6];if(elo&&(p=0,s[c]=0);if(p&&1===o)return co("Detected homogeneous system (Y=0), calling SolveHomogeneousLeastSquares()"),li(e,t,r,i);if(p)h=1;else for(c=0;c1&&void 0!==arguments[1]?arguments[1]:[0,.5,1];switch(e.length){case 3:return t[0]=17*parseInt(e[0],16)/255,t[1]=17*parseInt(e[1],16)/255,t[2]=17*parseInt(e[2],16)/255,t;case 4:return t[0]=17*parseInt(e[1],16)/255,t[1]=17*parseInt(e[2],16)/255,t[2]=17*parseInt(e[3],16)/255,t;case 6:return t[0]=parseInt(e.substr(0,2),16)/255,t[1]=parseInt(e.substr(2,2),16)/255,t[2]=parseInt(e.substr(4,2),16)/255,t;case 7:return t[0]=parseInt(e.substr(1,2),16)/255,t[1]=parseInt(e.substr(3,2),16)/255,t[2]=parseInt(e.substr(5,2),16)/255,t;case 9:return t[0]=parseInt(e.substr(1,2),16)/255,t[1]=parseInt(e.substr(3,2),16)/255,t[2]=parseInt(e.substr(5,2),16)/255,t[3]=parseInt(e.substr(7,2),16)/255,t;default:return t}},rgb2hsv:ui,hsv2rgb:ci,lab2xyz:di,xyz2lab:pi,xyz2rgb:fi,rgb2xyz:hi,rgb2lab:mi,lab2rgb:gi,uninitializeBounds:yi,areBoundsInitialized:vi,computeBoundsFromPoints:function(e,t,r){return r[0]=Math.min(e[0],t[0]),r[1]=Math.max(e[0],t[0]),r[2]=Math.min(e[1],t[1]),r[3]=Math.max(e[1],t[1]),r[4]=Math.min(e[2],t[2]),r[5]=Math.max(e[2],t[2]),r},clampValue:bi,clampVector:xi,clampAndNormalizeValue:function(e,t){let r=0;return t[0]!==t[1]&&(r=et[1]?t[1]:e,r=(r-t[0])/(t[1]-t[0])),r},getScalarTypeFittingRange:_i,getAdjustedScalarRange:Si,extentIsWithinOtherExtent:function(e,t){if(!e||!t)return 0;for(let r=0;r<6;r+=2)if(e[r]t[r+1]||e[r+1]t[r+1])return 0;return 1},boundsIsWithinOtherBounds:function(e,t,r){if(!e||!t)return 0;for(let n=0;n<6;n+=2)if(e[n]+r[n/2]t[n+1]||e[n+1]+r[n/2]t[n+1])return 0;return 1},pointIsWithinBounds:function(e,t,r){if(!e||!t||!r)return 0;for(let n=0;n<3;n++)if(e[n]+r[n]t[2*n+1])return 0;return 1},solve3PointCircle:function(e,t,r,n){const o=go(3),i=go(3),a=go(3),s=go(3),l=go(3),u=go(3);for(let n=0;n<3;++n)o[n]=e[n]-t[n],i[n]=t[n]-r[n],a[n]=r[n]-e[n],s[n]=-o[n],l[n]=-i[n],u[n]=-a[n];const c=Bo(s),d=Bo(l),p=Bo(a),f=go(3);Fo(o,i,f);const h=Bo(f),m=c*d*p/(2*h),g=2*h*h,y=d*d*Ro(o,u)/g,v=p*p*Ro(s,i)/g,b=c*c*Ro(a,l)/g;for(let o=0;o<3;++o)n[o]=y*e[o]+v*t[o]+b*r[o];return m},inf:1/0,negInf:-1/0,isInf:Ci,isNan:wi,isNaN:wi,isFinite:Ti,createUninitializedBounds:Ei,getMajorAxisIndex:function(e){let t=-1,r=-1;for(let n=0;nt&&(r=n,t=o)}return r},getSparseOrthogonalMatrix:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;const r=new Array(t),n=new Array(t);for(let e=0;e0;o--){let i=-1/0,a=0,s=0;for(let l=0;l<=o;++l){const u=r[l];for(let r=0;r<=o;++r){const o=n[r],c=Math.abs(e[u+t*o]);c>i&&(i=c,a=l,s=r)}}[r[o],r[a]]=[r[a],r[o]],[n[o],n[s]]=[n[s],n[o]]}const o=new Array(t*t).fill(0);for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:"#"}${e.map(Di).join("")}`},float2CssRGBA:function(e){return 3===e.length?`rgb(${e.map(Pi).join(", ")})`:`rgba(${Pi(e[0]||0)}, ${Pi(e[1]||0)}, ${Pi(e[2]||0)}, ${e[3]||0})`}};function Ni(e,t,r){var n=t[0],o=t[1],i=t[2],a=t[3];return e[0]=r[0]*n+r[4]*o+r[8]*i+r[12]*a,e[1]=r[1]*n+r[5]*o+r[9]*i+r[13]*a,e[2]=r[2]*n+r[6]*o+r[10]*i+r[14]*a,e[3]=r[3]*n+r[7]*o+r[11]*i+r[15]*a,e}function Mi(){var e=new a(4);return a!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function Ri(e,t,r){r*=.5;var n=Math.sin(r);return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=Math.cos(r),e}function Fi(e,t){var r=2*Math.acos(t[3]),n=Math.sin(r/2);return n>i?(e[0]=t[0]/n,e[1]=t[1]/n,e[2]=t[2]/n):(e[0]=1,e[1]=0,e[2]=0),r}function Bi(e,t,r){var n=t[0],o=t[1],i=t[2],a=t[3],s=r[0],l=r[1],u=r[2],c=r[3];return e[0]=n*c+a*s+o*u-i*l,e[1]=o*c+a*l+i*s-n*u,e[2]=i*c+a*u+n*l-o*s,e[3]=a*c-n*s-o*l-i*u,e}function Li(e,t,r,n){var o,a,s,l,u,c=t[0],d=t[1],p=t[2],f=t[3],h=r[0],m=r[1],g=r[2],y=r[3];return(a=c*h+d*m+p*g+f*y)<0&&(a=-a,h=-h,m=-m,g=-g,y=-y),1-a>i?(o=Math.acos(a),s=Math.sin(o),l=Math.sin((1-n)*o)/s,u=Math.sin(n*o)/s):(l=1-n,u=n),e[0]=l*c+u*h,e[1]=l*d+u*m,e[2]=l*p+u*g,e[3]=l*f+u*y,e}Ii=new a(4),a!=Float32Array&&(Ii[0]=0,Ii[1]=0,Ii[2]=0,Ii[3]=0);var ki=function(e,t,r,n){var o=new a(4);return o[0]=e,o[1]=t,o[2]=r,o[3]=n,o};dr(),fr(1,0,0),fr(0,1,0),Mi(),Mi(),ae();const Ui={};function Vi(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ui,r),zt.obj(e,t),zt.setGet(e,t,["transform"]),function(e,t){t.classHierarchy.push("vtkImplicitFunction"),e.functionValue=r=>{if(!t.transform)return e.evaluateFunction(r);const n=[];return t.transform.transformPoint(r,n),e.evaluateFunction(n)},e.evaluateFunction=e=>{zt.vtkErrorMacro("not implemented")}}(e,t)}var Gi={newInstance:zt.newInstance(Vi,"vtkImplicitFunction"),extend:Vi};const zi=1e-6,ji="coincide",Wi="disjoint";function Hi(e,t,r){const n=r[0]*(e[0]-t[0])+r[1]*(e[1]-t[1])+r[2]*(e[2]-t[2]);return Math.abs(n)}function Ki(e,t,r,n){const o=[];Io(e,t,o);const i=Ro(r,o);n[0]=e[0]-i*r[0],n[1]=e[1]-i*r[1],n[2]=e[2]-i*r[2]}function Xi(e,t,r){const n=Ro(e,t);let o=Ro(t,t);return 0===o&&(o=1),r[0]=e[0]-n*t[0]/o,r[1]=e[1]-n*t[1]/o,r[2]=e[2]-n*t[2]/o,r}function $i(e,t,r,n){const o=[];Io(e,t,o);const i=Ro(r,o),a=Ro(r,r);0!==a?(n[0]=e[0]-i*r[0]/a,n[1]=e[1]-i*r[1]/a,n[2]=e[2]-i*r[2]/a):(n[0]=e[0],n[1]=e[1],n[2]=e[2])}function qi(e,t,r,n){const o={intersection:!1,betweenPoints:!1,t:Number.MAX_VALUE,x:[]},i=[],a=[];Io(t,e,i),Io(r,e,a);const s=Ro(n,a),l=Ro(n,i);let u,c;return u=l<0?-l:l,c=s<0?-s*zi:s*zi,u<=c||(o.t=s/l,o.x[0]=e[0]+o.t*i[0],o.x[1]=e[1]+o.t*i[1],o.x[2]=e[2]+o.t*i[2],o.intersection=!0,o.betweenPoints=o.t>=0&&o.t<=1),o}function Yi(e,t,r,n){const o={intersection:!1,l0:[],l1:[],error:null},i=[];Fo(t,n,i);const a=i.map(e=>Math.abs(e));if(a[0]+a[1]+a[2]a[1]&&a[0]>a[2]?"x":a[1]>a[2]?"y":"z";const l=[],u=-Ro(t,e),c=-Ro(n,r);switch(s){case"x":l[0]=0,l[1]=(c*t[2]-u*n[2])/i[0],l[2]=(u*n[1]-c*t[1])/i[0];break;case"y":l[0]=(u*n[2]-c*t[2])/i[1],l[1]=0,l[2]=(c*t[0]-u*n[0])/i[1];break;case"z":l[0]=(c*t[1]-u*n[1])/i[2],l[1]=(u*n[0]-c*t[0])/i[2],l[2]=0}return o.l0=l,Po(l,i,o.l1),o.intersection=!0,o}const Ji={evaluate:function(e,t,r){return e[0]*(r[0]-t[0])+e[1]*(r[1]-t[1])+e[2]*(r[2]-t[2])},distanceToPlane:Hi,projectPoint:Ki,projectVector:Xi,generalizedProjectPoint:$i,intersectWithLine:qi,intersectWithPlane:Yi,DISJOINT:Wi,COINCIDE:ji},Qi={normal:[0,0,1],origin:[0,0,0]};function Zi(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qi,r),Gi.extend(e,t,r),zt.setGetArray(e,t,["normal","origin"],3),function(e,t){t.classHierarchy.push("vtkPlane"),e.distanceToPlane=e=>Hi(e,t.origin,t.normal),e.projectPoint=(e,r)=>{Ki(e,t.origin,t.normal,r)},e.projectVector=(e,r)=>Xi(e,t.normal,r),e.push=e=>{if(0!==e)for(let r=0;r<3;r++)t.origin[r]+=e*t.normal[r]},e.generalizedProjectPoint=(e,r)=>{$i(e,t.origin,t.normal,r)},e.evaluateFunction=(e,r,n)=>Array.isArray(e)?t.normal[0]*(e[0]-t.origin[0])+t.normal[1]*(e[1]-t.origin[1])+t.normal[2]*(e[2]-t.origin[2]):t.normal[0]*(e-t.origin[0])+t.normal[1]*(r-t.origin[1])+t.normal[2]*(n-t.origin[2]),e.evaluateGradient=e=>[t.normal[0],t.normal[1],t.normal[2]],e.intersectWithLine=(e,r)=>qi(e,r,t.origin,t.normal),e.intersectWithPlane=(e,r)=>Yi(e,r,t.origin,t.normal)}(e,t)}var ea={newInstance:zt.newInstance(Zi,"vtkPlane"),extend:Zi,...Ji};const ta=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE];function ra(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]}function na(e){return e?.length>=6&&e[0]<=e[1]&&e[2]<=e[3]&&e[4]<=e[5]}function oa(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function ia(e){return oa(e,ta)}function aa(e,t,r,n){const[o,i,a,s,l,u]=e;return e[0]=ot?i:t,e[2]=ar?s:r,e[4]=ln?u:n,e}function sa(e,t){if(0===t.length)return e;if(Array.isArray(t[0]))for(let r=0;ri?t:i,e[2]=r,e[3]=r>s?r:s,e[4]=n,e[5]=n>u?n:u,o!==t||a!==r||l!==n}function ca(e,t,r,n){const[o,i,a,s,l,u]=e;return e[0]=tn&&(n=o,r=i),t[i]=o>0?1:0;if(r<0)return da(e,.5);for(let r=0;r<3;++r)if(!t[r]){const t=.005*n;e[2*r]-=t,e[2*r+1]+=t}return e}(e):(e[0]-=t,e[1]+=t,e[2]-=t,e[3]+=t,e[4]-=t,e[5]+=t,e)}function pa(e,t,r,n){return!!na(e)&&(t>=0?(e[0]*=t,e[1]*=t):(e[0]=t*e[1],e[1]=t*e[0]),r>=0?(e[2]*=r,e[3]*=r):(e[2]=r*e[3],e[3]=r*e[2]),n>=0?(e[4]*=n,e[5]*=n):(e[4]=n*e[5],e[5]=n*e[4]),!0)}function fa(e){return[.5*(e[0]+e[1]),.5*(e[2]+e[3]),.5*(e[4]+e[5])]}function ha(e,t){return e[2*t+1]-e[2*t]}function ma(e){return[ha(e,0),ha(e,1),ha(e,2)]}function ga(e){return e.slice(0,2)}function ya(e){return e.slice(2,4)}function va(e){return e.slice(4,6)}function ba(e){const t=ma(e);return t[0]>t[1]?t[0]>t[2]?t[0]:t[2]:t[1]>t[2]?t[1]:t[2]}function xa(e){if(na(e)){const t=ma(e);return t[0]*t[0]+t[1]*t[1]+t[2]*t[2]}return null}function _a(e){const t=xa(e);return null!==t?Math.sqrt(t):null}function Sa(e){return[e[0],e[2],e[4]]}function Ca(e){return[e[1],e[3],e[5]]}function Ta(e,t){return e<=0&&t>=0||e>=0&&t<=0}function wa(e,t){return t[0]=[e[0],e[2],e[4]],t[1]=[e[0],e[2],e[5]],t[2]=[e[0],e[3],e[4]],t[3]=[e[0],e[3],e[5]],t[4]=[e[1],e[2],e[4]],t[5]=[e[1],e[2],e[5]],t[6]=[e[1],e[3],e[4]],t[7]=[e[1],e[3],e[5]],t}function Aa(e,t,r){return t[0]=e[0],t[1]=e[2],t[2]=e[4],r[0]=e[1],r[1]=e[3],r[2]=e[5],t}function Ea(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];const n=wa(e,[]);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:[];return t[0]=.5*(e[1]-e[0]),t[1]=.5*(e[3]-e[2]),t[2]=.5*(e[5]-e[4]),t}function Pa(e,t,r,n){const o=[].concat(ta),i=e.getData();for(let e=0;ee[2*r+1]?(a[r]=0,u[r]=e[2*r+1],i=!1):a[r]=2;if(i)return n[0]=t[0],n[1]=t[1],n[2]=t[2],o[0]=0,1;for(let e=0;e<3;e++)2!==a[e]&&0!==r[e]?l[e]=(u[e]-t[e])/r[e]:l[e]=-1;for(let e=0;e<3;e++)l[s]1||l[s]<0)return 0;o[0]=l[s];for(let o=0;o<3;o++)if(s!==o){if(n[o]=t[o]+l[s]*r[o],n[o]e[2*o+1])return 0}else n[o]=u[o];return 1}function Oa(e,t,r){const n=[];let o=0,i=1,a=1;for(let s=4;s<=5;++s){n[2]=e[s];for(let s=2;s<=3;++s){n[1]=e[s];for(let s=0;s<=1;++s)if(n[0]=e[s],o=ea.evaluate(r,t,n),a&&(i=o>=0?1:-1,a=0),0===o||i>0&&o<0||i<0&&o>0)return 1}}return 0}function Na(e,t){if(!na(e)||!na(t))return!1;const r=[0,0,0,0,0,0];let n;for(let o=0;o<3;o++)if(n=!1,t[2*o]>=e[2*o]&&t[2*o]<=e[2*o+1]?(n=!0,r[2*o]=t[2*o]):e[2*o]>=t[2*o]&&e[2*o]<=t[2*o+1]&&(n=!0,r[2*o]=e[2*o]),t[2*o+1]>=e[2*o]&&t[2*o+1]<=e[2*o+1]?(n=!0,r[2*o+1]=t[2*o+1]):e[2*o+1]>=t[2*o]&&e[2*o+1]<=t[2*o+1]&&(n=!0,r[2*o+1]=e[2*o+1]),!n)return!1;return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],!0}function Ma(e,t){if(!na(e)||!na(t))return!1;for(let r=0;r<3;r++)if(!(t[2*r]>=e[2*r]&&t[2*r]<=e[2*r+1]||e[2*r]>=t[2*r]&&e[2*r]<=t[2*r+1]||t[2*r+1]>=e[2*r]&&t[2*r+1]<=e[2*r+1]||e[2*r+1]>=t[2*r]&&e[2*r+1]<=t[2*r+1]))return!1;return!0}function Ra(e,t,r,n){return!(te[1]||re[3]||ne[5])}function Fa(e,t,r){const n=[[0,1,2,3,4,5,6,7],[0,1,4,5,2,3,6,7],[0,2,4,6,1,3,5,7]],o=[0,0,0,0,0,0,0,0];let i=0;for(let n=0;n<2;n++)for(let a=2;a<4;a++)for(let s=4;s<6;s++){const l=[e[n],e[a],e[s]];o[i++]=ea.evaluate(r,t,l)}let a=2;for(;a--&&!(Ta(o[n[a][0]],o[n[a][4]])&&Ta(o[n[a][1]],o[n[a][5]])&&Ta(o[n[a][2]],o[n[a][6]])&&Ta(o[n[a][3]],o[n[a][7]])););if(a<0)return!1;const s=Math.sign(r[a]),l=Math.abs((e[2*a+1]-e[2*a])*r[a]);let u=s>0?1:0;for(let e=0;e<4;e++){if(0===l)continue;const t=Math.abs(o[n[a][e]])/l;s>0&&tu&&(u=t)}const c=(1-u)*e[2*a]+u*e[2*a+1];return s>0?e[2*a]=c:e[2*a+1]=c,!0}function Ba(e,t){for(let e=0;e<3;++e)t[e]=t[e]<1?1:t[e];let r=t[0]*t[1]*t[2];for(;r>e;){for(let e=0;e<3;++e)t[e]=t[e]>1?t[e]-1:1;r=t[0]*t[1]*t[2]}}function La(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];t=t<=0?1:t;let o=0;const i=[0,0,0];let a=-1,s=0;const l=ma(e),u=l[0]+l[1]+l[2],c=u*(.001/3);for(let e=0;e<3;++e)l[e]>s&&(a=e,s=l[e]),l[e]>c?(i[e]=1,o++):i[e]=0;const d=Sa(e),p=Ca(e);if(o<1)return r[0]=1,r[1]=1,r[2]=1,n[0]=d[0]-.5,n[1]=p[0]+.5,n[2]=d[1]-.5,n[3]=p[1]+.5,n[4]=d[2]-.5,n[5]=p[2]+.5,1;let f=t;f/=i[0]?l[0]/u:1,f/=i[1]?l[1]/u:1,f/=i[2]?l[2]/u:1,f**=1/o;for(let e=0;e<3;++e)r[e]=i[e]?Math.floor(f*l[e]/u):1,r[e]=r[e]<1?1:r[e];Ba(t,r);const h=.5*l[a]/r[a];for(let e=0;e<3;++e)i[e]?(n[2*e]=d[e],n[2*e+1]=p[e]):(n[2*e]=d[e]-h,n[2*e+1]=p[e]+h);return r[0]*r[1]*r[2]}function ka(e,t){if(e[0]>=t[0]&&e[0]<=t[1]&&e[1]>=t[2]&&e[1]<=t[3]&&e[2]>=t[4]&&e[2]<=t[5])return 0;const r=[0,0,0];return e[0]t[1]&&(r[0]=e[0]-t[1]),e[1]t[3]&&(r[1]=e[1]-t[3]),e[2]t[5]&&(r[2]=e[2]-t[5]),Ro(r,r)}class Ua{constructor(e){this.bounds=e,this.bounds||(this.bounds=new Float64Array(ta))}getBounds(){return this.bounds}equals(e){return ra(this.bounds,e)}isValid(){return na(this.bounds)}setBounds(e){return oa(this.bounds,e)}reset(){return ia(this.bounds)}addPoint(){for(var e=arguments.length,t=new Array(e),r=0;r1&&void 0!==arguments[1]?arguments[1]:[];return Ea(this.bounds,e,t)}computeScale3(e){return Da(this.bounds,e)}cutWithPlane(e,t){return Fa(this.bounds,e,t)}intersectBox(e,t,r,n){return Ia(this.bounds,e,t,r,n)}intersectPlane(e,t){return Oa(this.bounds,e,t)}intersect(e){return Na(this.bounds,e)}intersects(e){return Ma(this.bounds,e)}containsPoint(e,t,r){return Ra(this.bounds,e,t,r)}contains(e){return Ma(this.bounds,e)}computeDivisions(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return La(this.bounds,e,t,r)}distance2ToBounds(e){return ka(e,this.bounds)}}var Va={newInstance:function(e){const t=e&&e.bounds;return new Ua(t)},equals:ra,isValid:na,setBounds:oa,reset:ia,addPoint:aa,addPoints:sa,addBounds:la,setMinPoint:ua,setMaxPoint:ca,inflate:da,scale:pa,scaleAboutCenter:function(e,t,r,n){if(!na(e))return!1;const o=fa(e);return e[0]-=o[0],e[1]-=o[0],e[2]-=o[1],e[3]-=o[1],e[4]-=o[2],e[5]-=o[2],pa(e,t,r,n),e[0]+=o[0],e[1]+=o[0],e[2]+=o[1],e[3]+=o[1],e[4]+=o[2],e[5]+=o[2],!0},getCenter:fa,getLength:ha,getLengths:ma,getMaxLength:ba,getDiagonalLength:_a,getDiagonalLength2:xa,getMinPoint:Sa,getMaxPoint:Ca,getXRange:ga,getYRange:ya,getZRange:va,getCorners:wa,computeCornerPoints:Aa,computeLocalBounds:Pa,transformBounds:Ea,computeScale3:Da,cutWithPlane:Fa,intersectBox:Ia,intersectPlane:Oa,intersect:Na,intersects:Ma,containsPoint:Ra,contains:function(e,t){return!!Ma(e,t)&&!!Ra(e,...Sa(t))&&!!Ra(e,...Ca(t))},computeDivisions:La,clampDivisions:Ba,distance2ToBounds:ka,INIT_BOUNDS:ta},Ga={CoordinateSystem:{DISPLAY:0,WORLD:1}};const{CoordinateSystem:za}=Ga;function ja(e){return()=>zt.vtkErrorMacro(`vtkProp::${e} - NOT IMPLEMENTED`)}const Wa={allocatedRenderTime:10,coordinateSystem:za.WORLD,dragable:!0,estimatedRenderTime:0,paths:null,pickable:!0,renderTimeMultiplier:1,savedEstimatedRenderTime:0,textures:[],useBounds:!0,visibility:!0};function Ha(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Wa,r),zt.obj(e,t),zt.get(e,t,["estimatedRenderTime","allocatedRenderTime"]),zt.setGet(e,t,["_parentProp","coordinateSystem","dragable","pickable","renderTimeMultiplier","useBounds","visibility"]),zt.moveToProtected(e,t,["parentProp"]),function(e,t){t.classHierarchy.push("vtkProp"),e.getMTime=()=>{let e=t.mtime;for(let r=0;re&&(e=n)}return e},e.processSelectorPixelBuffers=(e,t)=>{},e.getNestedProps=()=>null,e.getActors=()=>[],e.getActors2D=()=>[],e.getVolumes=()=>[],e.pick=ja("pick"),e.hasKey=ja("hasKey"),e.getNestedVisibility=()=>t.visibility&&(!t._parentProp||t._parentProp.getNestedVisibility()),e.getNestedPickable=()=>t.pickable&&(!t._parentProp||t._parentProp.getNestedPickable()),e.getNestedDragable=()=>t.dragable&&(!t._parentProp||t._parentProp.getNestedDragable()),e.getRedrawMTime=()=>t.mtime,e.setEstimatedRenderTime=e=>{t.estimatedRenderTime=e,t.savedEstimatedRenderTime=e},e.restoreEstimatedRenderTime=()=>{t.estimatedRenderTime=t.savedEstimatedRenderTime},e.addEstimatedRenderTime=e=>{t.estimatedRenderTime+=e},e.setAllocatedRenderTime=e=>{t.allocatedRenderTime=e,t.savedEstimatedRenderTime=t.estimatedRenderTime,t.estimatedRenderTime=0},e.getSupportsSelection=()=>!1,e.getTextures=()=>t.textures,e.hasTexture=e=>-1!==t.textures.indexOf(e),e.addTexture=r=>{r&&!e.hasTexture(r)&&(t.textures=t.textures.concat(r),e.modified())},e.removeTexture=r=>{const n=t.textures.filter(e=>e!==r);t.textures.length!==n.length&&(t.textures=n,e.modified())},e.removeAllTextures=()=>{t.textures=[],e.modified()},e.setCoordinateSystemToWorld=()=>e.setCoordinateSystem(za.WORLD),e.setCoordinateSystemToDisplay=()=>e.setCoordinateSystem(za.DISPLAY)}(e,t)}var Ka={newInstance:zt.newInstance(Ha,"vtkProp"),extend:Ha,...Ga};const Xa={origin:[0,0,0],position:[0,0,0],orientation:[0,0,0],rotation:null,scale:[1,1,1],bounds:[...Va.INIT_BOUNDS],properties:[],userMatrix:null,userMatrixMTime:null,cachedProp3D:null,isIdentity:!0,matrixMTime:null};function $a(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xa,r),Ka.extend(e,t,r),t.matrixMTime={},zt.obj(t.matrixMTime),zt.get(e,t,["isIdentity"]),zt.getArray(e,t,["orientation"]),zt.setGetArray(e,t,["origin","position","scale"],3),zt.setGet(e,t,["properties"]),t.matrix=h(new Float64Array(16)),t.rotation=h(new Float64Array(16)),t.userMatrix=h(new Float64Array(16)),t.transform=null,function(e,t){t.classHierarchy.push("vtkProp3D"),e.addPosition=r=>{t.position=t.position.map((e,t)=>e+r[t]),e.modified()},e.getOrientationWXYZ=()=>{const e=Mi();B(e,t.rotation);const r=new Float64Array(3);return[vo(Fi(r,e)),r[0],r[1],r[2]]},e.getOrientationQuaternion=function(){return B(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t.rotation)},e.rotateX=r=>{0!==r&&(C(t.rotation,t.rotation,yo(r)),e.modified())},e.rotateY=r=>{0!==r&&(T(t.rotation,t.rotation,yo(r)),e.modified())},e.rotateZ=r=>{0!==r&&(w(t.rotation,t.rotation,yo(r)),e.modified())},e.rotateWXYZ=(r,n,o,i)=>{if(0===r||0===n&&0===o&&0===i)return;const a=yo(r),s=Mi();Ri(s,[n,o,i],a);const l=new Float64Array(16);U(l,s),b(t.rotation,t.rotation,l),e.modified()},e.rotateQuaternion=r=>{if(Math.abs(r[3])>=.999999)return;const n=U(new Float64Array(16),r);b(t.rotation,t.rotation,n),e.modified()},e.setOrientation=(r,n,o)=>(r!==t.orientation[0]||n!==t.orientation[1]||o!==t.orientation[2])&&(t.orientation=[r,n,o],h(t.rotation),e.rotateZ(o),e.rotateX(r),e.rotateY(n),e.modified(),!0),e.setOrientationFromQuaternion=r=>{const n=u();return U(n,r),!$o(n,t.rotation)&&(t.rotation=n,e.modified(),!0)},e.setUserMatrix=r=>!$o(t.userMatrix,r)&&(d(t.userMatrix,r),e.modified(),!0),e.getMatrix=()=>(e.computeMatrix(),t.matrix),e.computeMatrix=()=>{if(e.getMTime()>t.matrixMTime.getMTime()){h(t.matrix),t.userMatrix&&b(t.matrix,t.matrix,t.userMatrix),x(t.matrix,t.matrix,t.origin),x(t.matrix,t.matrix,t.position),b(t.matrix,t.matrix,t.rotation),_(t.matrix,t.matrix,t.scale),x(t.matrix,t.matrix,[-t.origin[0],-t.origin[1],-t.origin[2]]),m(t.matrix,t.matrix),t.isIdentity=!0;for(let e=0;e<4;++e)for(let r=0;r<4;++r)(e===r?1:0)!==t.matrix[e+4*r]&&(t.isIdentity=!1);t.matrixMTime.modified()}},e.getBoundsByReference=()=>{if(null===t.mapper)return t.bounds;const r=t.mapper.getBounds();if(!r||6!==r.length)return r;if(r[0]>r[1])return t.mapperBounds=r,t.bounds=[...Va.INIT_BOUNDS],t.boundsMTime.modified(),r;if(!t.mapperBounds||!r.every((e,n)=>r[n]===t.mapperBounds[n])||e.getMTime()>t.boundsMTime.getMTime()){zt.vtkDebugMacro("Recomputing bounds..."),t.mapperBounds=r,e.computeMatrix();const n=new Float64Array(16);m(n,t.matrix),Va.transformBounds(r,n,t.bounds),t.boundsMTime.modified()}return t.bounds},e.getBounds=()=>{const t=e.getBoundsByReference();try{return[...t]}catch{return t}},e.getCenter=()=>Va.getCenter(t.bounds),e.getLength=()=>Va.getLength(t.bounds),e.getXRange=()=>Va.getXRange(t.bounds),e.getYRange=()=>Va.getYRange(t.bounds),e.getZRange=()=>Va.getZRange(t.bounds),e.getUserMatrix=()=>t.userMatrix,e.onModified(function(){e.computeMatrix()}),e.getProperty=function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return null==t.properties[r]&&(t.properties[r]=e.makeProperty?.()),t.properties[r]},e.getProperties=()=>(0===t.properties.length&&(t.properties[0]=e.makeProperty?.()),t.properties),e.setProperty=(e,r)=>{const n=Number.isInteger(e),[o,i]=n?[e,r]:[0,e];return t.properties[o]!==i&&(t.properties[o]=i,!0)},e.getMTime=()=>{let e=t.mtime;return t.properties.forEach(t=>{if(null!==t){const r=t.getMTime();e=r>e?r:e}}),e}}(e,t)}var qa={newInstance:zt.newInstance($a,"vtkProp3D"),extend:$a};const Ya={FLAT:0,GOURAUD:1,PHONG:2},Ja={POINTS:0,WIREFRAME:1,SURFACE:2};var Qa={Shading:Ya,Representation:Ja,Interpolation:Ya};const{Representation:Za,Interpolation:es}=Qa;function ts(e){return()=>zt.vtkErrorMacro(`vtkProperty::${e} - NOT IMPLEMENTED`)}const rs={color:[1,1,1],ambientColor:[1,1,1],diffuseColor:[1,1,1],specularColor:[1,1,1],edgeColor:[0,0,0],ambient:0,diffuse:1,metallic:0,roughness:.6,normalStrength:1,emission:1,baseIOR:1.45,specular:0,specularPower:1,opacity:1,interpolation:es.GOURAUD,representation:Za.SURFACE,edgeVisibility:!1,backfaceCulling:!1,frontfaceCulling:!1,pointSize:1,lineWidth:1,lighting:!0,shading:!1,materialName:null,ORMTexture:null,RMTexture:null};function ns(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,rs,r),zt.obj(e,t),zt.setGet(e,t,["lighting","interpolation","ambient","diffuse","metallic","roughness","normalStrength","emission","baseIOR","specular","specularPower","opacity","edgeVisibility","lineWidth","pointSize","backfaceCulling","frontfaceCulling","representation","diffuseTexture","metallicTexture","roughnessTexture","normalTexture","ambientOcclusionTexture","emissionTexture","ORMTexture","RMTexture"]),zt.setGetArray(e,t,["ambientColor","specularColor","diffuseColor","edgeColor"],3),function(e,t){t.classHierarchy.push("vtkProperty"),e.setColor=(r,n,o)=>{Array.isArray(r)?t.color[0]===r[0]&&t.color[1]===r[1]&&t.color[2]===r[2]||(t.color[0]=r[0],t.color[1]=r[1],t.color[2]=r[2],e.modified()):t.color[0]===r&&t.color[1]===n&&t.color[2]===o||(t.color[0]=r,t.color[1]=n,t.color[2]=o,e.modified()),e.setDiffuseColor(t.color),e.setAmbientColor(t.color),e.setSpecularColor(t.color)},e.computeCompositeColor=ts("ComputeCompositeColor"),e.getColor=()=>{let e=0;t.ambient+t.diffuse+t.specular>0&&(e=1/(t.ambient+t.diffuse+t.specular));for(let r=0;r<3;r++)t.color[r]=e*(t.ambient*t.ambientColor[r]+t.diffuse*t.diffuseColor[r]+t.specular*t.specularColor[r]);return[].concat(t.color)},e.setSpecularPower=r=>{const n=1/Math.max(1,r);t.roughness===n&&t.specularPower===r||(t.specularPower=r,t.roughness=n,e.modified())},e.addShaderVariable=ts("AddShaderVariable"),e.setInterpolationToFlat=()=>e.setInterpolation(es.FLAT),e.setInterpolationToGouraud=()=>e.setInterpolation(es.GOURAUD),e.setInterpolationToPhong=()=>e.setInterpolation(es.PHONG),e.getInterpolationAsString=()=>zt.enumToString(es,t.interpolation),e.setRepresentationToWireframe=()=>e.setRepresentation(Za.WIREFRAME),e.setRepresentationToSurface=()=>e.setRepresentation(Za.SURFACE),e.setRepresentationToPoints=()=>e.setRepresentation(Za.POINTS),e.getRepresentationAsString=()=>zt.enumToString(Za,t.representation)}(e,t)}var os={newInstance:zt.newInstance(ns,"vtkProperty"),extend:ns,...Qa};const is={mapper:null,backfaceProperty:null,forceOpaque:!1,forceTranslucent:!1};function as(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,is,r),qa.extend(e,t,r),t.boundsMTime={},zt.obj(t.boundsMTime),zt.setGet(e,t,["backfaceProperty","forceOpaque","forceTranslucent","mapper"]),function(e,t){t.classHierarchy.push("vtkActor");const r={...e};e.getActors=()=>[e],e.getIsOpaque=()=>{if(t.forceOpaque)return!0;if(t.forceTranslucent)return!1;t.properties[0]||e.getProperty();let r=t.properties[0].getOpacity()>=1;return r=r&&(!t.texture||!t.texture.isTranslucent()),r=r&&(!t.mapper||t.mapper.getIsOpaque()),r},e.hasTranslucentPolygonalGeometry=()=>null!==t.mapper&&(t.properties[0]||e.getProperty(),!e.getIsOpaque()),e.makeProperty=os.newInstance,e.getMTime=()=>{let e=r.getMTime();if(null!==t.backfaceProperty){const r=t.backfaceProperty.getMTime();e=r>e?r:e}return e},e.getRedrawMTime=()=>{let e=t.mtime;if(null!==t.mapper){let r=t.mapper.getMTime();e=r>e?r:e,null!==t.mapper.getInput()&&(t.mapper.getInputAlgorithm().update(),r=t.mapper.getInput().getMTime(),e=r>e?r:e)}return e},e.getSupportsSelection=()=>!!t.mapper&&t.mapper.getSupportsSelection(),e.processSelectorPixelBuffers=(e,r)=>{t.mapper&&t.mapper.processSelectorPixelBuffers&&t.mapper.processSelectorPixelBuffers(e,r)}}(e,t)}var ss={newInstance:zt.newInstance(as,"vtkActor"),extend:as};const ls={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},us={VOID:"",CHAR:"Int8Array",SIGNED_CHAR:"Int8Array",UNSIGNED_CHAR:"Uint8Array",UNSIGNED_CHAR_CLAMPED:"Uint8ClampedArray",SHORT:"Int16Array",UNSIGNED_SHORT:"Uint16Array",INT:"Int32Array",UNSIGNED_INT:"Uint32Array",FLOAT:"Float32Array",DOUBLE:"Float64Array"};var cs={DefaultDataType:us.FLOAT,DataTypeByteSize:ls,VtkDataTypes:us};const{vtkErrorMacro:ds}=jt,{DefaultDataType:ps}=cs;function fs(e,t,r){const n=e.length;let o,i,a=Number.MAX_VALUE,s=-Number.MAX_VALUE;for(i=t;is&&(s=o);return{min:a,max:s}}function hs(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(t<0&&r>1){const t=e.length/r,n=new Float64Array(t);for(let o=0,i=0;o1&&void 0!==arguments[1]?arguments[1]:0;const r=e||[];for(;r.length<=t;)r.push(null);return r}function gs(e){return Object.prototype.toString.call(e).slice(8,-1)}const ys={computeRange:hs,createRangeHelper:function(){let e=Number.MAX_VALUE,t=-Number.MAX_VALUE,r=0,n=0;return{add(o){e>o&&(e=o),t({min:e,max:t,count:r,sum:n,mean:n/r}),getRange:()=>({min:e,max:t})}},fastComputeRange:fs,getDataType:gs,getMaxNorm:function(e){const t=e.getNumberOfComponents();let r=0;const n=new Array(t);for(let o=0;or&&(r=i)}return r}},vs={name:"",numberOfComponents:1,dataType:ps,rangeTuple:[0,0]};function bs(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,vs,r),Array.isArray(r.values)&&void 0===r.dataType&&console.warn("vtkDataArray.newInstance: no dataType provided, converting to Float32Array"),!t.empty&&!t.values&&!t.size)throw new TypeError("Cannot create vtkDataArray object without: size > 0, values");if(t.values?Array.isArray(t.values)&&(t.values=it(t.dataType,t.values)):t.values=ot(t.dataType,t.size),t.values&&(t.size=t.size??t.values.length,t.dataType=gs(t.values)),mt(e,t),xt(e,t,["name","numberOfComponents"]),t.size%t.numberOfComponents!==0)throw new RangeError("model.size is not a multiple of model.numberOfComponents");!function(e,t){function r(r){if(r<0)return!1;const n=e.getNumberOfComponents(),o=t.values.length/(n>0?n:1);if(r===o)return!0;if(r>o){const e=t.values;return t.values=ot(t.dataType,(r+o)*n),t.values.set(e),!0}return t.size>r*n&&(t.size=r*n,e.dataChange()),!0}t.classHierarchy.push("vtkDataArray"),e.dataChange=()=>{t.ranges=null,e.modified()},e.allocate=t=>{r(e.getNumberOfTuples()+t)},e.resize=n=>{r(n);const o=n*e.getNumberOfComponents();return t.size!==o&&(t.size=o,e.dataChange(),!0)},e.initialize=()=>(e.resize(0),e),e.getElementComponentSize=()=>t.values.BYTES_PER_ELEMENT,e.getComponent=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.values[e*t.numberOfComponents+r]},e.setComponent=(r,n,o)=>{o!==t.values[r*t.numberOfComponents+n]&&(t.values[r*t.numberOfComponents+n]=o,e.dataChange())},e.getValue=r=>{const n=r/t.numberOfComponents,o=r%t.numberOfComponents;return e.getComponent(n,o)},e.setValue=(r,n)=>{const o=r/t.numberOfComponents,i=r%t.numberOfComponents;e.setComponent(o,i,n)},e.getData=()=>t.size===t.values.length?t.values:t.values.subarray(0,t.size),e.getRange=function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,n=r;n<0&&(n=1===t.numberOfComponents?0:t.numberOfComponents);let o=null;return t.ranges||(t.ranges=ms(t.ranges,t.numberOfComponents)),o=t.ranges[n],o?(t.rangeTuple[0]=o.min,t.rangeTuple[1]=o.max,t.rangeTuple):(o=hs(e.getData(),r,t.numberOfComponents),t.ranges[n]=o,t.rangeTuple[0]=o.min,t.rangeTuple[1]=o.max,t.rangeTuple)},e.setRange=(e,r)=>{t.ranges||(t.ranges=ms(t.ranges,t.numberOfComponents));const n={min:e.min,max:e.max};return t.ranges[r]=n,t.rangeTuple[0]=n.min,t.rangeTuple[1]=n.max,t.rangeTuple},e.getRanges=function(){if(arguments.length>0&&void 0!==arguments[0]&&!arguments[0])return structuredClone(t.ranges);const r=[];for(let n=0;n1){const[t,n]=e.getRange(-1),o={min:t,max:n};r.push(o)}return r},e.setTuple=(e,r)=>{const n=e*t.numberOfComponents;for(let e=0;e{let n=e*t.numberOfComponents;const o=Math.min(r.length,t.size-n);for(let e=0;e(t.size<=n*t.numberOfComponents&&(t.size=(n+1)*t.numberOfComponents,r(n+1)),e.setTuple(n,o),n),e.insertTuples=(n,o)=>{const i=n+o.length/t.numberOfComponents;return t.size{const n=t.size/t.numberOfComponents;return e.insertTuple(n,r)},e.insertNextTuples=r=>{const n=t.size/t.numberOfComponents;return e.insertTuples(n,r)},e.findTuple=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e-6;for(let n=0;nr){o=!1;break}if(o)return n/t.numberOfComponents}return-1},e.getTuple=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const n=t.numberOfComponents||1,o=e*n;switch(n){case 4:r[3]=t.values[o+3];case 3:r[2]=t.values[o+2];case 2:r[1]=t.values[o+1];case 1:r[0]=t.values[o];break;default:for(let e=n-1;e>=0;--e)r[e]=t.values[o+e]}return r},e.getTuples=(r,n)=>{const o=(r??0)*t.numberOfComponents,i=(n??e.getNumberOfTuples())*t.numberOfComponents,a=e.getData().subarray(o,i);return a.length>0?a:null},e.getTupleLocation=function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:1)*t.numberOfComponents},e.getNumberOfComponents=()=>t.numberOfComponents,e.getNumberOfValues=()=>t.size,e.getNumberOfTuples=()=>t.size/t.numberOfComponents,e.getDataType=()=>t.dataType,e.newClone=()=>xs({empty:!0,name:t.name,dataType:t.dataType,numberOfComponents:t.numberOfComponents}),e.getName=()=>(t.name||(e.modified(),t.name=`vtkDataArray${e.getMTime()}`),t.name),e.setData=(r,n)=>{t.values=r,t.size=r.length,t.dataType=gs(r),n&&(t.numberOfComponents=n),t.size%t.numberOfComponents!==0&&(t.numberOfComponents=1),e.dataChange()},e.getState=()=>{if(t.deleted)return null;const r={...t,vtkClass:e.getClassName()};r.values=Array.from(r.values),delete r.buffer,Object.keys(r).forEach(e=>{r[e]||delete r[e]});const n={};return Object.keys(r).sort().forEach(e=>{n[e]=r[e]}),n.mtime&&delete n.mtime,n},e.deepCopy=r=>{const n=e.getDataType(),o=t.values;e.shallowCopy(r),t.ranges=structuredClone(r.getRanges()),o?.length>=r.getNumberOfValues()&&n===r.getDataType()?(o.set(r.getData()),t.values=o,e.dataChange()):e.setData(r.getData().slice())},e.interpolateTuple=(r,n,o,i,a,s)=>{const l=t.numberOfComponents||1;l===n.getNumberOfComponents()&&l===i.getNumberOfComponents()||ds("numberOfComponents must match");const u=n.getTuple(o),c=i.getTuple(a),d=[];switch(d.length=l,l){case 4:d[3]=u[3]+(c[3]-u[3])*s;case 3:d[2]=u[2]+(c[2]-u[2])*s;case 2:d[1]=u[1]+(c[1]-u[1])*s;case 1:d[0]=u[0]+(c[0]-u[0])*s;break;default:for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ss,r),zt.obj(e,t),zt.algo(e,t,1,0),t.clippingPlanes||(t.clippingPlanes=[]),function(e,t){t.classHierarchy.push("vtkAbstractMapper"),e.update=()=>{e.getInputData()},e.addClippingPlane=r=>!!r.isA("vtkPlane")&&!t.clippingPlanes.includes(r)&&(t.clippingPlanes.push(r),e.modified(),!0),e.getNumberOfClippingPlanes=()=>t.clippingPlanes.length,e.removeAllClippingPlanes=()=>0!==t.clippingPlanes.length&&(t.clippingPlanes.length=0,e.modified(),!0),e.removeClippingPlane=r=>{const n=t.clippingPlanes.indexOf(r);return-1!==n&&(t.clippingPlanes.splice(n,1),e.modified(),!0)},e.getClippingPlanes=()=>t.clippingPlanes,e.setClippingPlanes=t=>{if(t)if(Array.isArray(t)){const r=t.length;for(let n=0;n{const o=t.clippingPlanes,i=e;if(o){const e=o.length;if(r>=0&&r2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,(e=>({bounds:[...Va.INIT_BOUNDS],center:[0,0,0],viewSpecificProperties:{},...e}))(r)),Cs(e,t,r),zt.setGet(e,t,["viewSpecificProperties"]),function(e,t){e.getBounds=()=>(zt.vtkErrorMacro("vtkAbstractMapper3D.getBounds - NOT IMPLEMENTED"),Ei()),e.getCenter=()=>{const r=e.getBounds();return t.center=Va.isValid(r)?Va.getCenter(r):null,t.center?.slice()},e.getLength=()=>{const t=e.getBounds();return Va.getDiagonalLength(t)}}(e,t)};const{vtkErrorMacro:ws,vtkWarningMacro:As}=zt,Es={arrays:[],copyFieldFlags:[],doCopyAllOn:!0,doCopyAllOff:!1};function Ds(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Es,r),zt.obj(e,t),function(e,t){t.classHierarchy.push("vtkFieldData");const r=e.getState;t.arrays&&(t.arrays=t.arrays.map(e=>({data:Ge(e.data)}))),e.initialize=()=>{e.initializeFields(),e.copyAllOn(),e.clearFieldFlags()},e.initializeFields=()=>{t.arrays=[],t.copyFieldFlags={},e.modified()},e.copyStructure=r=>{e.initializeFields(),t.copyFieldFlags=r.getCopyFieldFlags().map(e=>e),t.arrays=r.getArrays().map(e=>({data:e}))},e.getNumberOfArrays=()=>t.arrays.length,e.getNumberOfActiveArrays=()=>t.arrays.length,e.addArray=r=>{const n=r.getName(),{array:o,index:i}=e.getArrayWithIndex(n);return null!=o?(t.arrays[i]={data:r},i):(t.arrays=[].concat(t.arrays,{data:r}),t.arrays.length-1)},e.removeAllArrays=()=>{t.arrays=[]},e.removeArray=r=>{const n=t.arrays.findIndex(e=>e.data.getName()===r);return e.removeArrayByIndex(n)},e.removeArrayByIndex=e=>-1!==e&&et.arrays.map(e=>e.data),e.getArray=t=>"number"==typeof t?e.getArrayByIndex(t):e.getArrayByName(t),e.getArrayByName=e=>t.arrays.reduce((t,r,n)=>r.data.getName()===e?r.data:t,null),e.getArrayWithIndex=e=>{const r=t.arrays.findIndex(t=>t.data.getName()===e);return{array:-1!==r?t.arrays[r].data:null,index:r}},e.getArrayByIndex=e=>e>=0&&ee.getArrayWithIndex(t).index>=0,e.getArrayName=e=>{const r=t.arrays[e];return r?r.data.getName():""},e.getCopyFieldFlags=()=>t.copyFieldFlags,e.getFlag=e=>t.copyFieldFlags[e],e.passData=function(r){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;r.getArrays().forEach(i=>{const a=e.getFlag(i.getName());if(!1!==a&&(!t.doCopyAllOff||!0===a)&&i){let t=e.getArrayByName(i.getName());if(t)if(i.getNumberOfComponents()===t.getNumberOfComponents())if(n>-1&&n-1?o:n;t.insertTuple(e,i.getTuple(n))}else t.insertTuples(0,i.getTuples());else ws("Unhandled case in passData");else if(n<0||n>i.getNumberOfTuples())e.addArray(i),r.getAttributes(i).forEach(t=>{e.setAttribute(i,t)});else{const a=i.getNumberOfComponents();let s=i.getNumberOfValues();const l=o>-1?o:n;s<=l*a&&(s=(l+1)*a),t=_s.newInstance({name:i.getName(),dataType:i.getDataType(),numberOfComponents:a,values:zt.newTypedArray(i.getDataType(),s),size:0}),t.insertTuple(l,i.getTuple(n)),e.addArray(t),r.getAttributes(i).forEach(r=>{e.setAttribute(t,r)})}}})},e.interpolateData=function(r){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.5;r.getArrays().forEach(s=>{const l=e.getFlag(s.getName());if(!1!==l&&(!t.doCopyAllOff||!0===l)&&s){let t=e.getArrayByName(s.getName());if(t)if(s.getNumberOfComponents()===t.getNumberOfComponents())if(n>-1&&n-1?i:n;t.interpolateTuple(e,s,n,s,o,a),As("Unexpected case in interpolateData")}else t.insertTuples(s.getTuples());else ws("Unhandled case in interpolateData");else if(n<0||o<0||n>s.getNumberOfTuples())e.addArray(s),r.getAttributes(s).forEach(t=>{e.setAttribute(s,t)});else{const l=s.getNumberOfComponents();let u=s.getNumberOfValues();const c=i>-1?i:n;u<=c*l&&(u=(c+1)*l),t=_s.newInstance({name:s.getName(),dataType:s.getDataType(),numberOfComponents:l,values:zt.newTypedArray(s.getDataType(),u),size:0}),t.interpolateTuple(c,s,n,s,o,a),e.addArray(t),r.getAttributes(s).forEach(r=>{e.setAttribute(t,r)})}}})},e.copyFieldOn=e=>{t.copyFieldFlags[e]=!0},e.copyFieldOff=e=>{t.copyFieldFlags[e]=!1},e.copyAllOn=()=>{t.doCopyAllOn&&!t.doCopyAllOff||(t.doCopyAllOn=!0,t.doCopyAllOff=!1,e.modified())},e.copyAllOff=()=>{!t.doCopyAllOn&&t.doCopyAllOff||(t.doCopyAllOn=!1,t.doCopyAllOff=!0,e.modified())},e.clearFieldFlags=()=>{t.copyFieldFlags={}},e.deepCopy=e=>{t.arrays=e.getArrays().map(e=>{const t=e.newClone();return t.deepCopy(e),{data:t}})},e.copyFlags=e=>e.getCopyFieldFlags().map(e=>e),e.reset=()=>t.arrays.forEach(e=>e.data.reset()),e.getMTime=()=>t.arrays.reduce((e,t)=>t.data.getMTime()>e?t.data.getMTime():e,t.mtime),e.getNumberOfComponents=()=>t.arrays.reduce((e,t)=>e+t.data.getNumberOfComponents(),0),e.getNumberOfTuples=()=>t.arrays.length>0?t.arrays[0].getNumberOfTuples():0,e.getState=()=>{const e=r();return e&&(e.arrays=t.arrays.map(e=>({data:e.data.getState()}))),e}}(e,t)}var Ps={newInstance:zt.newInstance(Ds,"vtkFieldData"),extend:Ds};const Is={SCALARS:0,VECTORS:1,NORMALS:2,TCOORDS:3,TENSORS:4,GLOBALIDS:5,PEDIGREEIDS:6,EDGEFLAG:7,NUM_ATTRIBUTES:8};var Os={AttributeCopyOperations:{COPYTUPLE:0,INTERPOLATE:1,PASSDATA:2,ALLCOPY:3},AttributeLimitTypes:{MAX:0,EXACT:1,NOLIMIT:2},AttributeTypes:Is,CellGhostTypes:{DUPLICATECELL:1,HIGHCONNECTIVITYCELL:2,LOWCONNECTIVITYCELL:4,REFINEDCELL:8,EXTERIORCELL:16,HIDDENCELL:32},DesiredOutputPrecision:{DEFAULT:0,SINGLE:1,DOUBLE:2},PointGhostTypes:{DUPLICATEPOINT:1,HIDDENPOINT:2},ghostArrayName:"vtkGhostType"};const{AttributeTypes:Ns,AttributeCopyOperations:Ms}=Os,{vtkWarningMacro:Rs}=zt,Fs={activeScalars:-1,activeVectors:-1,activeTensors:-1,activeNormals:-1,activeTCoords:-1,activeGlobalIds:-1,activePedigreeIds:-1};function Bs(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Fs,r),Ps.extend(e,t,r),zt.setGet(e,t,["activeScalars","activeNormals","activeTCoords","activeVectors","activeTensors","activeGlobalIds","activePedigreeIds"]),t.arrays||(t.arrays={}),function(e,t){const r=["Scalars","Vectors","Normals","TCoords","Tensors","GlobalIds","PedigreeIds"];function n(e){let t=r.find(t=>Ns[t.toUpperCase()]===e||"number"!=typeof e&&t.toLowerCase()===e.toLowerCase());return void 0===t&&(t=null),t}t.classHierarchy.push("vtkDataSetAttributes");const o={...e};e.checkNumberOfComponents=e=>!0,e.setAttribute=(r,o)=>{const i=n(o);if(r&&"PEDIGREEIDS"===i.toUpperCase()&&!r.isA("vtkDataArray"))return Rs(`Cannot set attribute ${i}. The attribute must be a vtkDataArray.`),-1;if(r&&!e.checkNumberOfComponents(r,i))return Rs(`Cannot set attribute ${i}. Incorrect number of components.`),-1;if(r){const n=e.addArray(r);t[`active${i}`]=n}else t[`active${i}`]=-1;return e.modified(),t[`active${i}`]},e.getAttributes=t=>r.filter(r=>e[`get${r}`]()===t),e.setActiveAttributeByName=(t,r)=>e.setActiveAttributeByIndex(e.getArrayWithIndex(t).index,r),e.setActiveAttributeByIndex=(r,o)=>{const i=n(o);if(r>=0&&r{const r=n(t);return e[`get${r}`]()},e.removeAllArrays=()=>{r.forEach(e=>{t[`active${e}`]=-1}),o.removeAllArrays()},e.removeArrayByIndex=e=>(-1!==e&&r.forEach(r=>{e===t[`active${r}`]?t[`active${r}`]=-1:e{const n=`active${r}`;e[`get${r}`]=()=>e.getArrayByIndex(t[n]),e[`set${r}`]=t=>e.setAttribute(t,r),e[`setActive${r}`]=t=>e.setActiveAttributeByIndex(e.getArrayWithIndex(t).index,r),e[`copy${r}Off`]=()=>{const e=r.toUpperCase();t.copyAttributeFlags[Ms.PASSDATA][Ns[e]]=!1},e[`copy${r}On`]=()=>{const e=r.toUpperCase();t.copyAttributeFlags[Ms.PASSDATA][Ns[e]]=!0}}),e.initializeAttributeCopyFlags=()=>{t.copyAttributeFlags=[],Object.keys(Ms).filter(e=>"ALLCOPY"!==e).forEach(e=>{t.copyAttributeFlags[Ms[e]]=Object.keys(Ns).filter(e=>"NUM_ATTRIBUTES"!==e).reduce((e,t)=>(e[Ns[t]]=!0,e),[])}),t.copyAttributeFlags[Ms.COPYTUPLE][Ns.GLOBALIDS]=!1,t.copyAttributeFlags[Ms.INTERPOLATE][Ns.GLOBALIDS]=!1,t.copyAttributeFlags[Ms.COPYTUPLE][Ns.PEDIGREEIDS]=!1},e.initialize=zt.chain(e.initialize,e.initializeAttributeCopyFlags),t.dataArrays&&Object.keys(t.dataArrays).length&&Object.keys(t.dataArrays).forEach(r=>{t.dataArrays[r].ref||"vtkDataArray"!==t.dataArrays[r].type||e.addArray(_s.newInstance(t.dataArrays[r]))});const i=e.shallowCopy;e.shallowCopy=(e,r)=>{i(e,r),t.arrays=e.getArrays().map(e=>{const t=e.newClone();return t.shallowCopy(e,r),{data:t}})},e.initializeAttributeCopyFlags()}(e,t)}var Ls={newInstance:zt.newInstance(Bs,"vtkDataSetAttributes"),extend:Bs,...Os};const ks=["pointData","cellData","fieldData"],Us={};function Vs(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Us,r),zt.obj(e,t),zt.setGet(e,t,ks),zt.getArray(e,t,["bounds"],6),function(e,t){t.classHierarchy.push("vtkDataSet"),ks.forEach(e=>{t[e]?t[e]=Ge(t[e]):t[e]=Ls.newInstance()}),e.computeBounds=()=>{if(t.modifiedTime&&t.computeTime&&t.modifiedTime>t.computeTime||!t.computeTime){const r=e.getPoints();r?.getNumberOfPoints()?Va.setBounds(t.bounds,r.getBoundsByReference()):t.bounds=Oi.createUninitializedBounds(),t.computeTime=zt.getCurrentGlobalMTime()}},e.getLength2=()=>{const t=e.getBoundsByReference();return t&&6===t.length?Va.getDiagonalLength2(t):0},e.getLength=()=>Math.sqrt(e.getLength2()),e.getCenter=()=>{const t=e.getBoundsByReference();return t&&6===t.length?Va.getCenter(t):[0,0,0]},e.getCellBounds=t=>{const r=e.getCell(t);return r?r.getBounds():Oi.createUninitializedBounds()},e.getBounds=zt.chain(()=>e.computeBounds,e.getBounds),e.getBoundsByReference=zt.chain(()=>e.computeBounds,e.getBoundsByReference);const r=e.shallowCopy;e.shallowCopy=function(e){r(e,arguments.length>1&&void 0!==arguments[1]&&arguments[1]),ks.forEach(r=>{t[r]=Ls.newInstance(),t[r].shallowCopy(e.getReferenceByName(r))})};const n=e.getMTime;e.getMTime=()=>ks.reduce((e,r)=>Math.max(e,t[r]?.getMTime()??e),n()),e.initialize=()=>(ks.forEach(e=>t[e]?.initialize()),e)}(e,t)}var Gs={newInstance:zt.newInstance(Vs,"vtkDataSet"),extend:Vs,FieldDataTypes:{UNIFORM:0,DATA_OBJECT_FIELD:0,COORDINATE:1,POINT_DATA:1,POINT:2,POINT_FIELD_DATA:2,CELL:3,CELL_FIELD_DATA:3,VERTEX:4,VERTEX_FIELD_DATA:4,EDGE:5,EDGE_FIELD_DATA:5,ROW:6,ROW_DATA:6},FieldAssociations:{FIELD_ASSOCIATION_POINTS:0,FIELD_ASSOCIATION_CELLS:1,FIELD_ASSOCIATION_NONE:2,FIELD_ASSOCIATION_POINTS_THEN_CELLS:3,FIELD_ASSOCIATION_VERTICES:4,FIELD_ASSOCIATION_EDGES:5,FIELD_ASSOCIATION_ROWS:6,NUMBER_OF_ASSOCIATIONS:7}};const zs={UNCHANGED:0,SINGLE_POINT:1,X_LINE:2,Y_LINE:3,Z_LINE:4,XY_PLANE:5,YZ_PLANE:6,XZ_PLANE:7,XYZ_GRID:8,EMPTY:9};var js={StructuredType:zs};const{StructuredType:Ws}=js;var Hs={getDataDescriptionFromExtent:function(e){let t=0;for(let r=0;r<3;++r)e[2*r]e[1]||e[2]>e[3]||e[4]>e[5]?Ws.EMPTY:3===t?Ws.XYZ_GRID:2===t?e[0]===e[1]?Ws.YZ_PLANE:e[2]===e[3]?Ws.XZ_PLANE:Ws.XY_PLANE:1===t?e[0]2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xs,r),Gs.extend(e,t,r),t.direction?Array.isArray(t.direction)&&(t.direction=new Float64Array(t.direction.slice(0,9))):t.direction=pe(new Float64Array(9)),t.indexToWorld=new Float64Array(16),t.worldToIndex=new Float64Array(16),zt.get(e,t,["indexToWorld","worldToIndex"]),zt.setGetArray(e,t,["origin","spacing"],3),zt.setGetArray(e,t,["direction"],9),zt.getArray(e,t,["extent"],6),function(e,t){t.classHierarchy.push("vtkImageData"),e.setExtent=function(){if(t.deleted)return Ks("instance deleted - cannot call any method"),!1;for(var r=arguments.length,n=new Array(r),o=0;oe!==i[t]);return a&&(t.extent=i.slice(),t.dataDescription=Hs.getDataDescriptionFromExtent(t.extent),e.modified()),a},e.setDimensions=function(){let r,n,o;if(t.deleted)Ks("instance deleted - cannot call any method");else{if(1===arguments.length){const e=arguments.length<=0?void 0:arguments[0];r=e[0],n=e[1],o=e[2]}else{if(3!==arguments.length)return void Ks("Bad dimension specification");r=arguments.length<=0?void 0:arguments[0],n=arguments.length<=1?void 0:arguments[1],o=arguments.length<=2?void 0:arguments[2]}e.setExtent(0,r-1,0,n-1,0,o-1)}},e.getDimensions=()=>[t.extent[1]-t.extent[0]+1,t.extent[3]-t.extent[2]+1,t.extent[5]-t.extent[4]+1],e.getNumberOfCells=()=>{const t=e.getDimensions();let r=1;for(let e=0;e<3;e++){if(0===t[e])return 0;t[e]>1&&(r*=t[e]-1)}return r},e.getNumberOfPoints=()=>{const t=e.getDimensions();return t[0]*t[1]*t[2]},e.getPoint=r=>{const n=e.getDimensions();if(0===n[0]||0===n[1]||0===n[2])return Ks("Requesting a point from an empty image."),null;const o=new Float64Array(3);switch(t.dataDescription){case zs.EMPTY:return null;case zs.SINGLE_POINT:break;case zs.X_LINE:o[0]=r;break;case zs.Y_LINE:o[1]=r;break;case zs.Z_LINE:o[2]=r;break;case zs.XY_PLANE:o[0]=r%n[0],o[1]=r/n[0];break;case zs.YZ_PLANE:o[1]=r%n[1],o[2]=r/n[1];break;case zs.XZ_PLANE:o[0]=r%n[0],o[2]=r/n[0];break;case zs.XYZ_GRID:o[0]=r%n[0],o[1]=r/n[0]%n[1],o[2]=r/(n[0]*n[1]);break;default:Ks("Invalid dataDescription")}const i=[0,0,0];return e.indexToWorld(o,i),i},e.getBounds=()=>e.extentToBounds(e.getSpatialExtent()),e.extentToBounds=e=>Va.transformBounds(e,t.indexToWorld),e.getSpatialExtent=()=>Va.inflate([...t.extent],.5),e.computeTransforms=()=>{A(t.indexToWorld,t.origin),t.indexToWorld[0]=t.direction[0],t.indexToWorld[1]=t.direction[1],t.indexToWorld[2]=t.direction[2],t.indexToWorld[4]=t.direction[3],t.indexToWorld[5]=t.direction[4],t.indexToWorld[6]=t.direction[5],t.indexToWorld[8]=t.direction[6],t.indexToWorld[9]=t.direction[7],t.indexToWorld[10]=t.direction[8],_(t.indexToWorld,t.indexToWorld,t.spacing),g(t.worldToIndex,t.indexToWorld)},e.indexToWorld=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Sr(r,e,t.indexToWorld),r},e.indexToWorldVec3=e.indexToWorld,e.worldToIndex=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Sr(r,e,t.worldToIndex),r},e.worldToIndexVec3=e.worldToIndex,e.indexToWorldBounds=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Va.transformBounds(e,t.indexToWorld,r)},e.worldToIndexBounds=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Va.transformBounds(e,t.worldToIndex,r)},t._onOriginChanged=e.computeTransforms,t._onDirectionChanged=e.computeTransforms,t._onSpacingChanged=e.computeTransforms,e.computeTransforms(),e.getCenter=()=>Va.getCenter(e.getBounds()),e.computeHistogram=function(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const n=[0,0,0,0,0,0];e.worldToIndexBounds(t,n);const o=[0,0,0],i=[0,0,0];Va.computeCornerPoints(n,o,i),Zo(o,o),Zo(i,i);const a=e.getDimensions();xi(o,[0,0,0],[a[0]-1,a[1]-1,a[2]-1],o),xi(i,[0,0,0],[a[0]-1,a[1]-1,a[2]-1],i);const s=a[0],l=a[0]*a[1],u=e.getPointData().getScalars().getData();let c=-1/0,d=1/0,p=0,f=0,h=0;for(let e=o[2];e<=i[2];e++)for(let t=o[1];t<=i[1];t++){let a=o[0]+t*s+e*l;for(let s=o[0];s<=i[0];s++){if(!r||r([s,t,e],n)){const e=u[a];e>c&&(c=e),e0?f/h:0,g=h?Math.abs(p/h-m*m):0;return{minimum:d,maximum:c,average:m,variance:g,sigma:Math.sqrt(g),count:h}},e.computeIncrements=function(e){const t=[];let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;for(let n=0;n<3;++n)t[n]=r,r*=e[2*n+1]-e[2*n]+1;return t},e.computeOffsetIndex=t=>{let[r,n,o]=t;const i=e.getExtent(),a=e.getPointData().getScalars().getNumberOfComponents(),s=e.computeIncrements(i,a);return Math.floor((Math.round(r)-i[0])*s[0]+(Math.round(n)-i[2])*s[1]+(Math.round(o)-i[4])*s[2])},e.getOffsetIndexFromWorld=t=>{const r=e.getExtent(),n=e.worldToIndex(t);for(let e=0;e<3;++e)if(n[e]r[2*e+1])return Ks(`GetScalarPointer: Pixel ${n} is not in memory. Current extent = ${r}`),NaN;return e.computeOffsetIndex(n)},e.getScalarValueFromWorld=function(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=e.getPointData().getScalars().getNumberOfComponents();if(r<0||r>=n)return Ks(`GetScalarPointer: Scalar Component ${r} is not within bounds. Current Scalar numberOfComponents: ${n}`),NaN;const o=e.getOffsetIndexFromWorld(t);return Number.isNaN(o)?o:e.getPointData().getScalars().getComponent(o,r)};const r=e.initialize;e.initialize=()=>(e.set({direction:pe(t.direction),spacing:[1,1,1],origin:[0,0,0],extent:[0,-1,0,-1,0,-1],dataDescription:zs.EMPTY}),r())}(e,t)}var qs={newInstance:zt.newInstance($s,"vtkImageData"),extend:$s};const Ys={LUMINANCE:1,LUMINANCE_ALPHA:2,RGB:3,RGBA:4};var Js={VectorMode:{MAGNITUDE:0,COMPONENT:1,RGBCOLORS:2},ScalarMappingTarget:Ys,Scale:{LINEAR:0,LOG10:1}},Qs={ColorMode:{DEFAULT:0,MAP_SCALARS:1,DIRECT_SCALARS:2},GetArray:{BY_ID:0,BY_NAME:1},ScalarMode:{DEFAULT:0,USE_POINT_DATA:1,USE_CELL_DATA:2,USE_POINT_FIELD_DATA:3,USE_CELL_FIELD_DATA:4,USE_FIELD_DATA:5}};const{ScalarMappingTarget:Zs,Scale:el,VectorMode:tl}=Js,{VtkDataTypes:rl}=_s,{ColorMode:nl}=Qs,{vtkErrorMacro:ol}=zt;function il(e){return e}function al(e){return Math.floor(255*e+.5)}const sl={alpha:1,vectorComponent:0,vectorSize:-1,vectorMode:tl.COMPONENT,mappingRange:null,annotationArray:null,annotatedValueMap:null,indexedLookup:!1,scale:el.LINEAR};function ll(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,sl,r),zt.obj(e,t),t.mappingRange=[0,255],t.annotationArray=[],t.annotatedValueMap=[],zt.setGet(e,t,["vectorSize","vectorComponent","vectorMode","alpha","indexedLookup"]),zt.setArray(e,t,["mappingRange"],2),zt.getArray(e,t,["mappingRange"]),function(e,t){t.classHierarchy.push("vtkScalarsToColors"),e.setVectorModeToMagnitude=()=>e.setVectorMode(tl.MAGNITUDE),e.setVectorModeToComponent=()=>e.setVectorMode(tl.COMPONENT),e.setVectorModeToRGBColors=()=>e.setVectorMode(tl.RGBCOLORS),e.build=()=>{},e.isOpaque=()=>!0,e.setAnnotations=(r,n)=>{if(!(r&&!n||!r&&n))if(r&&n&&r.length!==n.length)ol("Values and annotations do not have the same number of tuples so ignoring");else{if(t.annotationArray=[],n&&r){const e=n.length;for(let o=0;o{let o=e.checkForAnnotatedValue(r),i=!1;return o>=0?t.annotationArray[o].annotation!==n&&(t.annotationArray[o].annotation=n,i=!0):(t.annotationArray.push({value:r,annotation:n}),o=t.annotationArray.length-1,i=!0),i&&(e.updateAnnotatedValueMap(),e.modified()),o},e.getNumberOfAnnotatedValues=()=>t.annotationArray.length,e.getAnnotatedValue=e=>e<0||e>=t.annotationArray.length?null:t.annotationArray[e].value,e.getAnnotation=e=>void 0===t.annotationArray[e]?null:t.annotationArray[e].annotation,e.getAnnotatedValueIndex=r=>t.annotationArray.length?e.checkForAnnotatedValue(r):-1,e.removeAnnotation=r=>{const n=e.checkForAnnotatedValue(r),o=n>=0;return o&&(t.annotationArray.splice(n,1),e.updateAnnotatedValueMap(),e.modified()),o},e.resetAnnotations=()=>{t.annotationArray=[],t.annotatedValueMap=[],e.modified()},e.getAnnotationColor=(r,n)=>{if(t.indexedLookup){const t=e.getAnnotatedValueIndex(r);e.getIndexedColor(t,n)}else e.getColor(parseFloat(r),n),n[3]=1},e.checkForAnnotatedValue=t=>e.getAnnotatedValueIndexInternal(t),e.getAnnotatedValueIndexInternal=e=>{if(void 0!==t.annotatedValueMap[e]){const r=t.annotationArray.length;return t.annotatedValueMap[e]%r}return-1},e.getIndexedColor=(e,t)=>{t[0]=0,t[1]=0,t[2]=0,t[3]=0},e.updateAnnotatedValueMap=()=>{t.annotatedValueMap=[];const e=t.annotationArray.length;for(let r=0;r{const o=t.getNumberOfComponents();let i=null;if(r===nl.DEFAULT&&(t.getDataType()===rl.UNSIGNED_CHAR||t.getDataType()===rl.UNSIGNED_CHAR_CLAMPED)||r===nl.DIRECT_SCALARS&&t)i=e.convertToRGBA(t,o,t.getNumberOfTuples());else{const r={type:"vtkDataArray",name:"temp",numberOfComponents:4,dataType:rl.UNSIGNED_CHAR},a=zt.newTypedArray(r.dataType,4*t.getNumberOfTuples());r.values=a,r.size=a.length,i=_s.newInstance(r);let s=n;s<0&&o>1?e.mapVectorsThroughTable(t,i,Zs.RGBA,-1,-1):(s<0&&(s=0),s>=o&&(s=o-1),e.mapScalarsThroughTable(t,i,Zs.RGBA,s))}return i},e.mapVectorsToMagnitude=(e,t,r)=>{const n=e.getNumberOfTuples(),o=e.getNumberOfComponents(),i=t.getData(),a=e.getData();for(let e=0;e{let a=e.getVectorMode(),s=i,l=o;const u=t.getNumberOfComponents();a===tl.COMPONENT?(-1===l&&(l=e.getVectorComponent()),l<0&&(l=0),l>=u&&(l=u-1)):(-1===s&&(s=e.getVectorSize()),s<=0?(l=0,s=u):(l<0&&(l=0),l>=u&&(l=u-1),l+s>u&&(s=u-l)),a!==tl.MAGNITUDE||1!==u&&1!==s||(a=tl.COMPONENT));let c=0;switch(l>0&&(c=l),a){case tl.COMPONENT:e.mapScalarsThroughTable(t,r,n,c);break;case tl.RGBCOLORS:break;case tl.MAGNITUDE:default:{const o=_s.newInstance({numberOfComponents:1,values:new Float32Array(t.getNumberOfTuples())});e.mapVectorsToMagnitude(t,o,s),e.mapScalarsThroughTable(o,r,n,0);break}}},e.luminanceToRGBA=(e,t,r,n)=>{const o=n(r),i=t.getData(),a=e.getData(),s=i.length;let l=0;for(let e=0;e{const o=t.getData(),i=e.getData(),a=o.length;let s=0;for(let e=0;e{const o=al(r),i=t.getData(),a=e.getData(),s=i.length;let l=0;for(let e=0;e{const o=t.getData(),i=e.getData(),a=o.length;let s=0;for(let e=0;e{let{alpha:i}=t;if(4===n&&i>=1&&r.getDataType()===rl.UNSIGNED_CHAR)return r;const a=_s.newInstance({numberOfComponents:4,empty:!0,size:4*o,dataType:rl.UNSIGNED_CHAR});if(o<=0)return a;i=i>0?i:0,i=i<1?i:1;let s=il;switch(r.getDataType()!==rl.FLOAT&&r.getDataType()!==rl.DOUBLE||(s=al),n){case 1:e.luminanceToRGBA(a,r,i,s);break;case 2:e.luminanceAlphaToRGBA(a,r,s);break;case 3:e.rGBToRGBA(a,r,i,s);break;case 4:e.rGBAToRGBA(a,r,i,s);break;default:return ol("Cannot convert colors"),null}return a},e.usingLogScale=()=>!1,e.getNumberOfAvailableColors=()=>16777216,e.setRange=(t,r)=>e.setMappingRange(t,r),e.getRange=()=>e.getMappingRange(),e.areScalarsOpaque=(r,n,o)=>{if(!r)return e.isOpaque();const i=r.getNumberOfComponents();return(n!==nl.DEFAULT||r.getDataType()!==rl.UNSIGNED_CHAR)&&n!==nl.DIRECT_SCALARS||(3===i||1===i?t.alpha>=1:255===r.getRange(i-1)[0])}}(e,t)}var ul={newInstance:zt.newInstance(ll,"vtkScalarsToColors"),extend:ll,...Js};const{vtkErrorMacro:cl}=zt,dl={numberOfColors:256,hueRange:[0,.66667],saturationRange:[1,1],valueRange:[1,1],alphaRange:[1,1],nanColor:[.5,0,0,1],belowRangeColor:[0,0,0,1],aboveRangeColor:[1,1,1,1],useAboveRangeColor:!1,useBelowRangeColor:!1,alpha:1};function pl(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,dl,r),ul.extend(e,t,r),t.table||(t.table=[]),t.buildTime={},zt.obj(t.buildTime),t.opaqueFlagBuildTime={},zt.obj(t.opaqueFlagBuildTime,{mtime:0}),t.insertTime={},zt.obj(t.insertTime,{mtime:0}),zt.get(e,t,["buildTime"]),zt.setGet(e,t,["numberOfColors","useAboveRangeColor","useBelowRangeColor"]),zt.setArray(e,t,["alphaRange","hueRange","saturationRange","valueRange"],2),zt.setArray(e,t,["nanColor","belowRangeColor","aboveRangeColor"],4),zt.getArray(e,t,["hueRange","saturationRange","valueRange","alphaRange","nanColor","belowRangeColor","aboveRangeColor"]),function(e,t){t.classHierarchy.push("vtkLookupTable"),e.isOpaque=()=>{if(t.opaqueFlagBuildTime.getMTime()!1,e.getNumberOfAvailableColors=()=>t.table.length/4-3,e.linearIndexLookup=(e,t)=>{let r=0;const n=Number(e);return nt.range[1]?r=t.maxIndex+1+1.5:(r=(n+t.shift)*t.scale,r=r{let o=0;o=Ai(t)?Math.floor(n.maxIndex+1.5+2):e.linearIndexLookup(t,n);const i=4*o;return r.slice(i,i+4)},e.indexedLookupFunction=(r,n,o)=>{let i=e.getAnnotatedValueIndexInternal(r);-1===i&&(i=t.numberOfColors+2);const a=4*i;return[n[a],n[a+1],n[a+2],n[a+3]]},e.lookupShiftAndScale=(e,t)=>{t.shift=-e[0],t.scale=Number.MAX_VALUE,e[1]>e[0]&&(t.scale=(t.maxIndex+1)/(e[1]-e[0]))},e.mapScalarsThroughTable=(r,n,o,i)=>{let a=e.linearLookup;t.indexedLookup&&(a=e.indexedLookupFunction);const s=e.getMappingRange(),l={maxIndex:e.getNumberOfColors()-1,range:s,shift:0,scale:0};e.lookupShiftAndScale(s,l);const u=e.getAlpha(),c=r.getNumberOfTuples(),d=r.getNumberOfComponents(),p=n.getData(),f=r.getData();if(u>=1){if(o===Ys.RGBA)for(let e=0;e{let r=0,n=0,o=0,i=0;const a=t.numberOfColors-1;a&&(r=(t.hueRange[1]-t.hueRange[0])/a,n=(t.saturationRange[1]-t.saturationRange[0])/a,o=(t.valueRange[1]-t.valueRange[0])/a,i=(t.alphaRange[1]-t.alphaRange[0])/a),t.table.length=4*a+16;const s=[],l=[];for(let e=0;e<=a;e++)s[0]=t.hueRange[0]+e*r,s[1]=t.saturationRange[0]+e*n,s[2]=t.valueRange[0]+e*o,ci(s,l),l[3]=t.alphaRange[0]+e*i,t.table[4*e]=255*l[0]+.5,t.table[4*e+1]=255*l[1]+.5,t.table[4*e+2]=255*l[2]+.5,t.table[4*e+3]=255*l[3]+.5;e.buildSpecialColors(),t.buildTime.modified()},e.setTable=r=>{if(Array.isArray(r)){const n=r[0].length;t.numberOfColors=r.length;const o=4-n;let i=0;for(let e=0;e{const{numberOfColors:e}=t,r=t.table;let n=4*(e+0);t.useBelowRangeColor||0===e?(r[n]=255*t.belowRangeColor[0]+.5,r[n+1]=255*t.belowRangeColor[1]+.5,r[n+2]=255*t.belowRangeColor[2]+.5,r[n+3]=255*t.belowRangeColor[3]+.5):(r[n]=r[0],r[n+1]=r[1],r[n+2]=r[2],r[n+3]=r[3]),n=4*(e+1),t.useAboveRangeColor||0===e?(r[n]=255*t.aboveRangeColor[0]+.5,r[n+1]=255*t.aboveRangeColor[1]+.5,r[n+2]=255*t.aboveRangeColor[2]+.5,r[n+3]=255*t.aboveRangeColor[3]+.5):(r[n]=r[4*(e-1)+0],r[n+1]=r[4*(e-1)+1],r[n+2]=r[4*(e-1)+2],r[n+3]=r[4*(e-1)+3]),n=4*(e+2),r[n]=255*t.nanColor[0]+.5,r[n+1]=255*t.nanColor[1]+.5,r[n+2]=255*t.nanColor[2]+.5,r[n+3]=255*t.nanColor[3]+.5},e.build=()=>{(t.table.length<1||e.getMTime()>t.buildTime.getMTime()&&t.insertTime.getMTime()<=t.buildTime.getMTime())&&e.forceBuild()},t.table.length>0&&(e.buildSpecialColors(),t.insertTime.modified())}(e,t)}var fl={newInstance:zt.newInstance(pl,"vtkLookupTable"),extend:pl};const hl={Off:0,PolygonOffset:1};let ml=hl.PolygonOffset,gl=hl.Off;const yl=["VTK_RESOLVE_OFF","VTK_RESOLVE_POLYGON_OFFSET"];function vl(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const t=gl===e;return gl=e,t}var bl={Resolve:hl,getResolveCoincidentTopologyAsString:function(){return yl[gl]},getResolveCoincidentTopologyPolygonOffsetFaces:function(){return ml},getResolveCoincidentTopology:function(){return gl},setResolveCoincidentTopology:vl,setResolveCoincidentTopologyPolygonOffsetFaces:function(e){const t=ml===e;return ml=e,t},setResolveCoincidentTopologyToDefault:function(){return vl(hl.Off)},setResolveCoincidentTopologyToOff:function(){return vl(hl.Off)},setResolveCoincidentTopologyToPolygonOffset:function(){return vl(hl.PolygonOffset)}};function xl(e,t,r){r.forEach(r=>{e[`get${r.method}`]=()=>t[r.key],e[`set${r.method}`]=zt.objectSetterMap.object(e,t,{name:r.key,params:["factor","offset"]})})}const _l=["Polygon","Line","Point"],Sl={modified:()=>{}};xl(Sl,{Polygon:{factor:2,offset:0},Line:{factor:1,offset:-1},Point:{factor:0,offset:-2}},_l.map(e=>({key:e,method:`ResolveCoincidentTopology${e}OffsetParameters`})));var Cl={implementCoincidentTopologyMethods:function(e,t){void 0===t.resolveCoincidentTopology&&(t.resolveCoincidentTopology=!1),zt.setGet(e,t,["resolveCoincidentTopology"]),t.topologyOffset={Polygon:{factor:0,offset:0},Line:{factor:0,offset:0},Point:{factor:0,offset:0}},Object.keys(bl).forEach(t=>{e[t]=bl[t]}),Object.keys(Sl).filter(e=>"modified"!==e).forEach(t=>{e[t]=Sl[t]}),xl(e,t.topologyOffset,_l.map(e=>({key:e,method:`RelativeCoincidentTopology${e}OffsetParameters`}))),e.getCoincidentTopologyPolygonOffsetParameters=()=>{const t=Sl.getResolveCoincidentTopologyPolygonOffsetParameters(),r=e.getRelativeCoincidentTopologyPolygonOffsetParameters();return{factor:t.factor+r.factor,offset:t.offset+r.offset}},e.getCoincidentTopologyLineOffsetParameters=()=>{const t=Sl.getResolveCoincidentTopologyLineOffsetParameters(),r=e.getRelativeCoincidentTopologyLineOffsetParameters();return{factor:t.factor+r.factor,offset:t.offset+r.offset}},e.getCoincidentTopologyPointOffsetParameter=()=>{const t=Sl.getResolveCoincidentTopologyPointOffsetParameters(),r=e.getRelativeCoincidentTopologyPointOffsetParameters();return{factor:t.factor+r.factor,offset:t.offset+r.offset}}},staticOffsetAPI:Sl,otherStaticMethods:bl,CATEGORIES:_l,Resolve:hl};const Tl={MIN_KNOWN_PASS:0,ACTOR_PASS:0,COMPOSITE_INDEX_PASS:1,ID_LOW24:2,ID_HIGH24:3,MAX_KNOWN_PASS:3};var wl={PassTypes:Tl};const{FieldAssociations:Al}=Gs,{staticOffsetAPI:El,otherStaticMethods:Dl}=Cl,{ColorMode:Pl,ScalarMode:Il,GetArray:Ol}=Qs,{VectorMode:Nl}=Js,{VtkDataTypes:Ml}=_s;function Rl(e){return()=>zt.vtkErrorMacro(`vtkMapper::${e} - NOT IMPLEMENTED`)}function Fl(e,t){const r=e[1]%2==0?1:-1;if(e[0]+=r,e[0]>=t[0]||e[0]<0){const n=e[2]%2==0?1:-1;e[0]-=r,e[1]+=n,(e[1]>=t[1]||e[1]<0)&&(e[1]-=n,e[2]++)}}function Bl(e,t){return e[0]+t[0]*(e[1]+t[1]*e[2])}function Ll(e,t,r){const n=Math.floor(t),o=n%(2*r[0]);let i,a;o2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ul,r),Ts(e,t,r),zt.get(e,t,["areScalarsMappedFromCells","colorCoordinates","colorMapColors","colorTextureMap","numberOfColorsInRange","selectionWebGLIdsToVTKIds"]),zt.setGet(e,t,["colorByArrayName","arrayAccessMode","colorMode","fieldDataTupleId","interpolateScalarsBeforeMapping","lookupTable","populateSelectionSettings","renderTime","scalarMode","scalarVisibility","static","useLookupTableScalarRange","customShaderAttributes"]),zt.setGetArray(e,t,["scalarRange"],2),Cl.implementCoincidentTopologyMethods(e,t),function(e,t){t.classHierarchy.push("vtkMapper"),e.getBounds=()=>{const r=e.getInputData();return r?(t.static||e.update(),t.bounds=r.getBounds()):t.bounds=Ei(),t.bounds},e.setForceCompileOnly=e=>{t.forceCompileOnly=e},e.setSelectionWebGLIdsToVTKIds=e=>{t.selectionWebGLIdsToVTKIds=e},e.createDefaultLookupTable=()=>{t.lookupTable=fl.newInstance()},e.getColorModeAsString=()=>zt.enumToString(Pl,t.colorMode),e.setColorModeToDefault=()=>e.setColorMode(0),e.setColorModeToMapScalars=()=>e.setColorMode(1),e.setColorModeToDirectScalars=()=>e.setColorMode(2),e.getScalarModeAsString=()=>zt.enumToString(Il,t.scalarMode),e.setScalarModeToDefault=()=>e.setScalarMode(0),e.setScalarModeToUsePointData=()=>e.setScalarMode(1),e.setScalarModeToUseCellData=()=>e.setScalarMode(2),e.setScalarModeToUsePointFieldData=()=>e.setScalarMode(3),e.setScalarModeToUseCellFieldData=()=>e.setScalarMode(4),e.setScalarModeToUseFieldData=()=>e.setScalarMode(5),e.getAbstractScalars=(e,r,n,o,i)=>{if(!e||!t.scalarVisibility)return{scalars:null,cellFlag:!1};let a=null,s=!1;if(r===Il.DEFAULT)a=e.getPointData().getScalars(),a||(a=e.getCellData().getScalars(),s=!0);else if(r===Il.USE_POINT_DATA)a=e.getPointData().getScalars();else if(r===Il.USE_CELL_DATA)a=e.getCellData().getScalars(),s=!0;else if(r===Il.USE_POINT_FIELD_DATA){const t=e.getPointData();a=n===Ol.BY_ID?t.getArrayByIndex(o):t.getArrayByName(i)}else if(r===Il.USE_CELL_FIELD_DATA){const t=e.getCellData();s=!0,a=n===Ol.BY_ID?t.getArrayByIndex(o):t.getArrayByName(i)}else if(r===Il.USE_FIELD_DATA){const t=e.getFieldData();a=n===Ol.BY_ID?t.getArrayByIndex(o):t.getArrayByName(i)}return{scalars:a,cellFlag:s}},e.mapScalars=(r,n)=>{const{scalars:o,cellFlag:i}=e.getAbstractScalars(r,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName);if(t.areScalarsMappedFromCells=i,!o)return t.colorCoordinates=null,t.colorTextureMap=null,void(t.colorMapColors=null);const a=`${e.getMTime()}${o.getMTime()}${n}`;if(t.colorBuildString!==a){if(t.useLookupTableScalarRange||e.getLookupTable().setRange(t.scalarRange[0],t.scalarRange[1]),e.canUseTextureMapForColoring(o,i))t.mapScalarsToTexture(o,i,n);else{t.colorCoordinates=null,t.colorTextureMap=null;const r=e.getLookupTable();r&&(r.build(),t.colorMapColors=r.mapScalars(o,t.colorMode,t.fieldDataTupleId))}t.colorBuildString=`${e.getMTime()}${o.getMTime()}${n}`}},t.mapScalarsToTexture=(r,n,o)=>{const i=t.lookupTable.getRange(),a=t.lookupTable.usingLogScale(),s=t.lookupTable.getAlpha(),l=a?[Math.log10(i[0]),Math.log10(i[1])]:i;if(t.colorMapColors=null,null==t.colorTextureMap||e.getMTime()>t.colorTextureMap.getMTime()||t.lookupTable.getMTime()>t.colorTextureMap.getMTime()||t.lookupTable.getAlpha()!==o){t.lookupTable.setAlpha(o),t.colorTextureMap=null,t.lookupTable.build();const e=t.lookupTable.getNumberOfAvailableColors(),r=2048,i=2,u=n?r**3-3:4094;t.numberOfColorsInRange=Math.min(Math.max(e,i),u);const c=t.numberOfColorsInRange+3,d=t.numberOfColorsInRange+2,p=n?[Math.min(Math.ceil(c/r**0),r),Math.min(Math.ceil(c/r**1),r),Math.min(Math.ceil(c/r**2),r)]:[d,2,1],f=p[0]*p[1]*p[2],h=new Float64Array(f);h.fill(NaN);const m=t.numberOfColorsInRange,g=m+2,y=[0,0,0],v=l[0],b=l[1]-l[0];for(let e=0;e1?-1:t.lookupTable.getVectorComponent();t.colorCoordinates=function(e,t,r,n,o,i,a){const s=new Array(arguments.length);for(let e=0;e=b,_=i[2]<=1?2:3,S=_s.newInstance({numberOfComponents:_,values:new Float32Array(v*_)}),C=S.getData(),T=[0,0,0];Ll(T,o+2,i);let w=0,A=0;const E=[.5,.5,.5];for(let e=0;eo&&(t=o+1),Ll(E,t,i)}else{E[1]=.49;const t=(e-f)*h;E[0]=t>1e3?1e3:t<-1e3?-1e3:t}for(let e=0;e<_;++e)C[A++]=E[e]}return kl.set(e,{stringHash:l,textureCoordinates:S}),S}(r,u,l,a,t.numberOfColorsInRange,t.colorTextureMap.getDimensions(),n)},e.getIsOpaque=()=>{const r=e.getInputData(),n=e.getAbstractScalars(r,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName).scalars;if(!t.scalarVisibility||null==n)return!0;const o=e.getLookupTable();return!o||(o.build(),o.areScalarsOpaque(n,t.colorMode,-1))},e.canUseTextureMapForColoring=(e,r)=>!((!r||t.colorMode===Pl.DIRECT_SCALARS)&&(!t.interpolateScalarsBeforeMapping||t.lookupTable&&t.lookupTable.getIndexedLookup()||!e||t.colorMode===Pl.DEFAULT&&e.getDataType()===Ml.UNSIGNED_CHAR||t.colorMode===Pl.DIRECT_SCALARS)),e.clearColorArrays=()=>{t.colorMapColors=null,t.colorCoordinates=null,t.colorTextureMap=null},e.getLookupTable=()=>(t.lookupTable||e.createDefaultLookupTable(),t.lookupTable),e.getMTime=()=>{let e=t.mtime;if(null!==t.lookupTable){const r=t.lookupTable.getMTime();e=r>e?r:e}return e},e.getPrimitiveCount=()=>{const t=e.getInputData();return{points:t.getPoints().getNumberOfValues()/3,verts:t.getVerts().getNumberOfValues()-t.getVerts().getNumberOfCells(),lines:t.getLines().getNumberOfValues()-2*t.getLines().getNumberOfCells(),triangles:t.getPolys().getNumberOfValues()-3*t.getPolys().getNumberOfCells()}},e.acquireInvertibleLookupTable=Rl("AcquireInvertibleLookupTable"),e.valueToColor=Rl("ValueToColor"),e.colorToValue=Rl("ColorToValue"),e.useInvertibleColorFor=Rl("UseInvertibleColorFor"),e.clearInvertibleColor=Rl("ClearInvertibleColor"),e.processSelectorPixelBuffers=(e,r)=>{if(!e||!t.selectionWebGLIdsToVTKIds||!t.populateSelectionSettings)return;const n=e.getRawPixelBuffer(Tl.ID_LOW24),o=e.getRawPixelBuffer(Tl.ID_HIGH24),i=e.getCurrentPass(),a=e.getFieldAssociation();let s=null;a===Al.FIELD_ASSOCIATION_POINTS?s=t.selectionWebGLIdsToVTKIds.points:a===Al.FIELD_ASSOCIATION_CELLS&&(s=t.selectionWebGLIdsToVTKIds.cells),s&&r.forEach(t=>{if(i===Tl.ID_LOW24){let r=0;o&&(r+=o[t],r*=256),r+=n[t+2],r*=256,r+=n[t+1],r*=256,r+=n[t];const i=s[r],a=e.getPixelBuffer(Tl.ID_LOW24);a[t]=255&i,a[t+1]=(65280&i)>>8,a[t+2]=(16711680&i)>>16}else if(i===Tl.ID_HIGH24&&o){let r=0;r+=o[t],r*=256,r+=n[t+2],r*=256,r+=n[t+1],r*=256,r+=n[t];const i=s[r];e.getPixelBuffer(Tl.ID_HIGH24)[t]=(4278190080&i)>>24}})}}(e,t)}var Gl={newInstance:zt.newInstance(Vl,"vtkMapper"),extend:Vl,...El,...Dl,...Qs};const{isVtkObject:zl}=zt;function jl(e){let t=0;return e.filter((e,r)=>r===t&&(t+=e+1,!0))}function Wl(e){let t=0;for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:{};_s.extend(e,t,function(e){return{empty:!0,numberOfComponents:1,dataType:us.UNSIGNED_INT,...e}}(r)),function(e,t){t.classHierarchy.push("vtkCellArray");const r={...e};e.getNumberOfCells=r=>void 0===t.numberOfCells||r?(t.cellSizes?t.numberOfCells=t.cellSizes.length:t.numberOfCells=Wl(e.getData()),t.numberOfCells):t.numberOfCells,e.getCellSizes=r=>void 0===t.cellSizes||r?(t.cellSizes=jl(e.getData()),t.cellSizes):t.cellSizes,e.resize=n=>{const o=e.getNumberOfTuples();r.resize(n);const i=e.getNumberOfTuples();i{r.setData(e,1),t.numberOfCells=void 0,t.cellSizes=void 0},e.getCell=e=>{let r=e;const n=t.values[r++];return t.values.subarray(r,r+n)},e.insertNextCell=r=>{let n;n=zl(r)?r.getPointsIds():r;const o=e.getNumberOfCells();return e.insertNextTuples([n.length,...n]),++t.numberOfCells,null!=t.cellSizes&&t.cellSizes.push(n.length),o},e.getMaxCellSize=()=>e.getCellSizes().reduce((e,t)=>Math.max(e,t),0)}(e,t)}var Xl={newInstance:zt.newInstance(Kl,"vtkCellArray"),extend:Kl,...Hl};const{vtkErrorMacro:$l}=zt,ql={empty:!0,numberOfComponents:3,dataType:us.FLOAT,bounds:[1,-1,1,-1,1,-1]};function Yl(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ql,r),_s.extend(e,t,r),zt.getArray(e,t,["bounds"],6),function(e,t){let r=0;t.classHierarchy.push("vtkPoints"),e.getNumberOfPoints=e.getNumberOfTuples,e.setNumberOfPoints=function(r){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;e.getNumberOfPoints()!==r&&(t.size=r*n,t.values=zt.newTypedArray(t.dataType,t.size),e.setNumberOfComponents(n),e.modified())},e.setPoint=function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;oe.insertNextTuple([t,r,n]),e.insertPoint=(t,r)=>e.insertTuple(t,r);const n=e.getBounds;e.getBounds=()=>(r(r{if(3===e.getNumberOfComponents()){const r=e.getRange(0);t.bounds[0]=r[0],t.bounds[1]=r[1];const n=e.getRange(1);t.bounds[2]=n[0],t.bounds[3]=n[1];const o=e.getRange(2);t.bounds[4]=o[0],t.bounds[5]=o[1]}else if(2===e.getNumberOfComponents()){const r=e.getRange(0);t.bounds[0]=r[0],t.bounds[1]=r[1];const n=e.getRange(1);t.bounds[2]=n[0],t.bounds[3]=n[1],t.bounds[4]=0,t.bounds[5]=0}else $l(`getBounds called on an array with components of ${e.getNumberOfComponents()}`),yi(t.bounds);r=zt.getCurrentGlobalMTime()},e.setNumberOfComponents(t.numberOfComponents<2?3:t.numberOfComponents)}(e,t)}var Jl={newInstance:zt.newInstance(Yl,"vtkPoints"),extend:Yl};const Ql={bounds:[-1,-1,-1,-1,-1,-1],pointsIds:[]};function Zl(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ql,r),zt.obj(e,t),t.points||(t.points=Jl.newInstance()),zt.get(e,t,["points","pointsIds"]),function(e,t){t.classHierarchy.push("vtkCell"),e.initialize=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(r){t.pointsIds=r;let n=t.points.getData();n.length!==3*t.pointsIds.length&&(n=zt.newTypedArray(e.getDataType(),3*t.pointsIds.length));const o=e.getData();t.pointsIds.forEach((e,t)=>{let r=3*e,i=3*t;n[i]=o[r],n[++i]=o[++r],n[++i]=o[++r]}),t.points.setData(n)}else{t.points=e,t.pointsIds=new Array(e.getNumberOfPoints());for(let r=e.getNumberOfPoints()-1;r>=0;--r)t.pointsIds[r]=r}},e.getBounds=()=>t.points.getBounds(),e.getLength2=()=>{const t=Va.getLengths(e.getBounds());return t[0]*t[0]+t[1]*t[1]+t[2]*t[2]},e.getParametricDistance=e=>{let t,r=0;for(let n=0;n<3;n++)t=e[n]<0?-e[n]:e[n]>1?e[n]-1:0,t>r&&(r=t);return r},e.getNumberOfPoints=()=>t.points.getNumberOfPoints(),e.deepCopy=e=>{e.initialize(t.points,t.pointsIds)},e.getCellDimension=()=>{},e.intersectWithLine=(e,t,r,n,o,i,a)=>{},e.evaluatePosition=(e,t,r,n,o,i)=>{zt.vtkErrorMacro("vtkCell.evaluatePosition is not implemented.")}}(e,t)}var eu={newInstance:zt.newInstance(Zl,"vtkCell"),extend:Zl};const tu={array:null,maxId:0,extend:0};function ru(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,tu,r),zt.obj(e,t),function(e,t){t.classHierarchy.push("vtkCellLinks"),e.buildLinks=r=>{const n=r.getPoints().getNumberOfPoints(),o=r.getNumberOfCells(),i=new Uint32Array(n);if(r.isA("vtkPolyData")){for(let t=0;t{e.incrementLinkCount(t)})}e.allocateLinks(n),t.maxId=n-1;for(let t=0;t{e.insertCellReference(r,i[r]++,t)})}}else{for(let t=0;t{e.incrementLinkCount(t)});e.allocateLinks(n),t.maxId=n-1;for(let t=0;t{e.insertCellReference(r,i[r]++,t)})}},e.allocate=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;t.array=Array(e).fill().map(()=>({ncells:0,cells:null})),t.extend=r,t.maxId=-1},e.initialize=()=>{t.array=null},e.getLink=e=>t.array[e],e.getNcells=e=>t.array[e].ncells,e.getCells=e=>t.array[e].cells,e.insertNextPoint=e=>{t.array.push({ncells:e,cells:Array(e)}),++t.maxId},e.insertNextCellReference=(e,r)=>{t.array[e].cells[t.array[e].ncells++]=r},e.deletePoint=e=>{t.array[e].ncells=0,t.array[e].cells=null},e.removeCellReference=(e,r)=>{t.array[r].cells=t.array[r].cells.filter(t=>t!==e),t.array[r].ncells=t.array[r].cells.length},e.addCellReference=(e,r)=>{t.array[r].cells[t.array[r].ncells++]=e},e.resizeCellList=(e,r)=>{t.array[e].cells.length=r},e.squeeze=()=>{!function(e,t){let r=t;for(t>=e.array.length&&(r+=e.array.length);r>e.array.length;)e.array.push({ncells:0,cells:null});e.array.length=r}(t,t.maxId+1)},e.reset=()=>{t.maxId=-1},e.deepCopy=e=>{t.array=[...e.array],t.extend=e.extend,t.maxId=e.maxId},e.incrementLinkCount=e=>{++t.array[e].ncells},e.allocateLinks=e=>{for(let r=0;r{t.array[e].cells[r]=n}}(e,t)}var nu={newInstance:zt.newInstance(ru,"vtkCellLinks"),extend:ru};const ou=0,iu=1,au=2,su=3,lu=4,uu=5,cu=6,du=7,pu=9,fu=21,hu=41,mu=42,gu=["vtkEmptyCell","vtkVertex","vtkPolyVertex","vtkLine","vtkPolyLine","vtkTriangle","vtkTriangleStrip","vtkPolygon","vtkPixel","vtkQuad","vtkTetra","vtkVoxel","vtkHexahedron","vtkWedge","vtkPyramid","vtkPentagonalPrism","vtkHexagonalPrism","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkQuadraticEdge","vtkQuadraticTriangle","vtkQuadraticQuad","vtkQuadraticTetra","vtkQuadraticHexahedron","vtkQuadraticWedge","vtkQuadraticPyramid","vtkBiQuadraticQuad","vtkTriQuadraticHexahedron","vtkQuadraticLinearQuad","vtkQuadraticLinearWedge","vtkBiQuadraticQuadraticWedge","vtkBiQuadraticQuadraticHexahedron","vtkBiQuadraticTriangle","vtkCubicLine","vtkQuadraticPolygon","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkConvexPointSet","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkParametricCurve","vtkParametricSurface","vtkParametricTriSurface","vtkParametricQuadSurface","vtkParametricTetraRegion","vtkParametricHexRegion","UnknownClass","UnknownClass","UnknownClass","vtkHigherOrderEdge","vtkHigherOrderTriangle","vtkHigherOrderQuad","vtkHigherOrderPolygon","vtkHigherOrderTetrahedron","vtkHigherOrderWedge","vtkHigherOrderPyramid","vtkHigherOrderHexahedron"],yu={getClassNameFromTypeId:function(e){return e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,vu,r),zt.obj(e,t),zt.get(e,t,["size","maxId","extend"]),zt.getArray(e,t,["typeArray","locationArray"]),function(e,t){t.classHierarchy.push("vtkCellTypes"),e.allocate=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:512,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;t.size=e>0?e:1,t.extend=r>0?r:1,t.maxId=-1,t.typeArray=new Uint8Array(e),t.locationArray=new Uint32Array(e)},e.insertCell=(e,r,n)=>{t.typeArray[e]=r,t.locationArray[e]=n,e>t.maxId&&(t.maxId=e)},e.insertNextCell=(r,n)=>(e.insertCell(++t.maxId,r,n),t.maxId),e.setCellTypes=(e,r,n)=>{t.size=e,t.typeArray=r,t.locationArray=n,t.maxId=e-1},e.getCellLocation=e=>t.locationArray[e],e.deleteCell=e=>{t.typeArray[e]=ou},e.getNumberOfTypes=()=>t.maxId+1,e.isType=t=>{const r=e.getNumberOfTypes();for(let n=0;ne.insertNextCell(t,-1),e.getCellType=e=>t.typeArray[e],e.reset=()=>{t.maxId=-1},e.deepCopy=r=>{e.allocate(r.getSize(),r.getExtend()),t.typeArray.set(r.getTypeArray()),t.locationArray.set(r.getLocationArray()),t.maxId=r.getMaxId()}}(e,t)}var xu={newInstance:zt.newInstance(bu,"vtkCellTypes"),extend:bu,...yu};const _u={NO_INTERSECTION:0,YES_INTERSECTION:1,ON_LINE:2};var Su={IntersectionState:_u};const{IntersectionState:Cu}=Su;function Tu(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const o={t:Number.MIN_VALUE,distance:0},i=[];let a;i[0]=r[0]-t[0],i[1]=r[1]-t[1],i[2]=r[2]-t[2];const s=i[0]*(e[0]-t[0])+i[1]*(e[1]-t[1])+i[2]*(e[2]-t[2]),l=Ro(i,i);let u=1e-5*s;return 0!==l&&(o.t=s/l),u<0&&(u=-u),-u1?a=r:(a=i,i[0]=t[0]+o.t*i[0],i[1]=t[1]+o.t*i[1],i[2]=t[2]+o.t*i[2]),n&&(n[0]=a[0],n[1]=a[1],n[2]=a[2]),o.distance=Vo(a,e),o}function wu(e,t,r,n,o,i){const a=[],s=[],l=[];o[0]=0,i[0]=0,Io(t,e,a),Io(n,r,s),Io(r,e,l);const u=[Ro(a,a),-Ro(a,s),-Ro(a,s),Ro(s,s)],c=[];if(c[0]=Ro(a,l),c[1]=-Ro(s,l),0===ai(u,c,2)){let a=Number.MAX_VALUE;const s=[e,t,r,n],l=[r,r,e,e],u=[n,n,t,t];let c;i[0],i[0],o[0],o[0],o[0],o[0],i[0],i[0];for(let e=0;e<4;e++)c=Tu(s[e],l[e],u[e]),c.distance=0&&o[0]<=1&&i[0]>=0&&i[0]<=1?Cu.YES_INTERSECTION:Cu.NO_INTERSECTION}const Au={distanceToLine:Tu,intersection:wu},Eu={orientations:null};function Du(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Eu,r),eu.extend(e,t,r),zt.setGet(e,t,["orientations"]),function(e,t){t.classHierarchy.push("vtkLine"),e.getCellDimension=()=>1,e.intersectWithLine=(e,r,n,o,i)=>{const a={intersect:0,t:Number.MAX_VALUE,subId:0,betweenPoints:null};i[1]=0,i[2]=0;const s=[],l=[],u=[];t.points.getPoint(0,l),t.points.getPoint(1,u);const c=[],d=[],p=wu(e,r,l,u,c,d);var f;if(a.t=c[0],a.betweenPoints=(f=a.t)>=0&&f<=1,i[0]=d[0],p===Cu.YES_INTERSECTION){for(let t=0;t<3;t++)o[t]=l[t]+i[0]*(u[t]-l[t]),s[t]=e[t]+a.t*(r[t]-e[t]);if(Vo(o,s)<=n*n)return a.intersect=1,a}else{let t;if(a.t<0)return t=Tu(e,l,u,o),t.distance<=n*n?(a.t=0,a.intersect=1,a.betweenPoints=!0,a):a;if(a.t>1)return t=Tu(r,l,u,o),t.distance<=n*n?(a.t=1,a.intersect=1,a.betweenPoints=!0,a):a;if(i[0]<0)return i[0]=0,t=Tu(l,e,r,o),a.t=t.t,t.distance<=n*n?(a.intersect=1,a):a;if(i[0]>1)return i[0]=1,t=Tu(u,e,r,o),a.t=t.t,t.distance<=n*n?(a.intersect=1,a):a}return a},e.evaluateLocation=(e,r,n)=>{const o=[],i=[];t.points.getPoint(0,o),t.points.getPoint(1,i);for(let t=0;t<3;t++)r[t]=o[t]+e[0]*(i[t]-o[t]);n[0]=1-e[0],n[1]=e[0]},e.evaluateOrientation=(e,r,n)=>!!t.orientations&&(Li(r,t.orientations[0],t.orientations[1],e[0]),n[0]=1-e[0],n[1]=e[0],!0)}(e,t)}var Pu={newInstance:zt.newInstance(Du,"vtkLine"),extend:Du,...Au,...Su};const Iu={};function Ou(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Iu,r),Gs.extend(e,t,r),zt.setGet(e,t,["points"]),function(e,t){t.classHierarchy.push("vtkPointSet"),t.points?t.points=Ge(t.points):t.points=Jl.newInstance(),e.getNumberOfPoints=()=>t.points.getNumberOfPoints(),e.getBounds=()=>t.points.getBounds(),e.computeBounds=()=>{e.getBounds()};const r=e.shallowCopy;e.shallowCopy=function(e){r(e,arguments.length>1&&void 0!==arguments[1]&&arguments[1]),t.points=Jl.newInstance(),t.points.shallowCopy(e.getPoints())};const n=e.getMTime;e.getMTime=()=>{const e=n();return Math.max(e,t.points?.getMTime()??e)};const o=e.initialize;e.initialize=()=>(t.points?.initialize(),o())}(e,t)}var Nu={newInstance:zt.newInstance(Ou,"vtkPointSet"),extend:Ou};const Mu={orientations:null,distanceFunction:function(e,t){var r=t[0]-e[0],n=t[1]-e[1],o=t[2]-e[2];return Math.hypot(r,n,o)}};function Ru(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Mu,r),eu.extend(e,t,r),zt.setGet(e,t,["orientations","distanceFunction"]),t.distancesTime={},zt.obj(t.distancesTime,{mtime:0}),function(e,t){t.classHierarchy.push("vtkPolyLine");const r=Pu.newInstance();r.getPoints().setNumberOfPoints(2),e.getCellDimension=()=>1,e.intersectWithLine=(n,o,i,a,s,l,u)=>{const c={intersect:0,t:Number.MAX_VALUE,subId:0,betweenPoints:null},d=e.getNumberOfPoints()-1;let p=Number.MAX_VALUE;for(let e=0;e=n&&f.t<=o){c.intersect=1;const t=r.getParametricDistance(d);if(t(r.getPoints().getData().set(t.points.getData().subarray(3*e,3*(e+2))),r.evaluateLocation(n,o,i)),e.evaluateOrientation=(e,n,o,i)=>(t.orientations?r.setOrientations([t.orientations[e],t.orientations[e+1]]):r.setOrientations(null),r.evaluateOrientation(n,o,i)),e.getDistancesToFirstPoint=()=>{const r=t.distancesTime.getMTime();if(r0){const e=new Array(3),n=new Array(3);let o=0;t.distances[0]=o,t.points.getPoint(0,e);for(let i=1;i{const r=e.getDistancesToFirstPoint();if(r.length<2)return-1;let n=0,o=r.length-1;if(tr[o]||0===r[o])return-1;for(;o-n>1;){const e=Math.floor((n+o)/2);r[e]<=t?n=e:o=e}return n}}(e,t)}var Fu={newInstance:zt.newInstance(Ru,"vtkPolyLine"),extend:Ru};const Bu={elements:[]};function Lu(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bu,r),zt.obj(e,t),function(e,t){t.classHierarchy.push("vtkPriorityQueue"),e.push=(e,r)=>{const n=t.elements.findIndex(t=>t.priority>e);t.elements.splice(n,0,{priority:e,element:r})},e.pop=()=>t.elements.length>0?t.elements.shift().element:null,e.deleteById=e=>{t.elements=t.elements.filter(t=>{let{element:r}=t;return r.id!==e})},e.length=()=>t.elements.length}(e,t)}var ku={newInstance:zt.newInstance(Lu,"vtkPriorityQueue"),extend:Lu};const Uu=1e-6,Vu=1.1920929e-7,Gu={FAILURE:-1,OUTSIDE:0,INSIDE:1,INTERSECTION:2,ON_LINE:3};function zu(e,t,r,n,o){return(n[e]-r[e])*(o[t]-r[t])-(o[e]-r[e])*(n[t]-r[t])}const ju={PolygonWithPointIntersectionState:Gu,pointInPolygon:function(e,t,r,n){if(e[0]r[1]||e[1]r[3]||e[2]r[5])return Gu.OUTSIDE;if(Lo(n)<=Vu)return Gu.FAILURE;let o=1e-8*((r[1]-r[0])*(r[1]-r[0])+(r[3]-r[2])*(r[3]-r[2])+(r[5]-r[4])*(r[5]-r[4]));o*=o,o=0===o?Vu:o;const i=[],a=[];for(let r=0;r0&&s<1)return Gu.INSIDE}let s,l;Math.abs(n[0])>Math.abs(n[1])?Math.abs(n[0])>Math.abs(n[2])?(s=1,l=2):(s=0,l=1):Math.abs(n[1])>Math.abs(n[2])?(s=0,l=2):(s=0,l=1);let u=0;for(let r=0;re[l]&&zu(s,l,i,a,e)>0&&++u:a[l]<=e[l]&&zu(s,l,i,a,e)<0&&--u;return 0===u?Gu.OUTSIDE:Gu.INSIDE},getBounds:function(e,t,r){const n=e.length,o=[];t.getPoint(e[0],o),r[0]=o[0],r[1]=o[0],r[2]=o[1],r[3]=o[1],r[4]=o[2],r[5]=o[2];for(let i=1;i2&&void 0!==arguments[2]?arguments[2]:[0,0,0];r[0]=0,r[1]=0,r[2]=0;const n=e.length,o=[];for(let i=0;iUu?1:a<-1e-6?-1:0,l=s<0?1:0;for(let e=n.next.next;e.id!==r.id;e=e.next){const t=e.previous;a=ea.evaluate(i,r.point,e.point);const o=a>Uu?1:a<-1e-6?-1:0;if(o!==s){if(l||(l=o<=0?1:0),Pu.intersection(r.point,n.point,e.point,t.point,[0],[0])===_u.YES_INTERSECTION)return!1;s=o}}return 1===l}function o(e,n){t.pointCount-=1;const o=e.previous,i=e.next;t.tris=t.tris.concat(e.point),t.tris=t.tris.concat(i.point),t.tris=t.tris.concat(o.point),o.next=i,i.previous=o,n.deleteById(o.id),n.deleteById(i.id);const a=r(o);a>0&&n.push(a,o);const s=r(i);s>0&&n.push(s,i),e.id===t.firstPoint.id&&(t.firstPoint=i)}t.classHierarchy.push("vtkPolygon"),e.triangulate=()=>t.firstPoint?function(){!function(){const e=[0,0,0],r=[0,0,0];t.normal=[0,0,0];const n=[...t.firstPoint.point];let o=t.firstPoint;for(let i=0;i0&&e.push(t,i),i=i.next}for(;t.pointCount>2&&e.length()>0;)if(t.pointCount===e.length())o(e.pop(),e);else{const t=e.pop();n(t)&&o(t,e)}return t.pointCount<=2}():null,e.setPoints=e=>{t.pointCount=e.length,t.firstPoint={id:0,point:e[0],next:null,previous:null};let r=t.firstPoint;for(let n=1;nt.tris}const Hu={firstPoint:null,pointCount:0,tris:[]};function Ku(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Hu,r),zt.obj(e,t),Wu(e,t)}var Xu={newInstance:zt.newInstance(Ku,"vtkPolygon"),extend:Ku,...ju};function $u(e,t,r,n){const o=r[0]-t[0],i=r[1]-t[1],a=r[2]-t[2],s=e[0]-t[0],l=e[1]-t[1],u=e[2]-t[2];n[0]=i*u-a*l,n[1]=a*s-o*u,n[2]=o*l-i*s}function qu(e,t,r,n){$u(e,t,r,n);const o=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);0!==o&&(n[0]/=o,n[1]/=o,n[2]/=o)}function Yu(e){e[0]=-1,e[1]=1,e[2]=0,e[3]=-1,e[4]=0,e[5]=1}const Ju={computeNormalDirection:$u,computeNormal:qu,interpolationDerivs:Yu,intersectWithTriangle:function(e,t,r,n,o,i){let a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1e-6,s=!1;const l=[],u=[],c=[],d=[],p=[];qu(e,t,r,d),qu(n,o,i,p);const f=-Ro(d,e),h=-Ro(p,n),m=[Ro(p,e)+h,Ro(p,t)+h,Ro(p,r)+h];if(m[0]*m[1]>a&&m[0]*m[2]>a)return{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};const g=[Ro(d,n)+f,Ro(d,o)+f,Ro(d,i)+f];if(g[0]*g[1]>a&&g[0]*g[2]>a)return{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};if(Math.abs(d[0]-p[0])<1e-9&&Math.abs(d[1]-p[1])<1e-9&&Math.abs(d[2]-p[2])<1e-9&&Math.abs(f-h)<1e-9)return s=!0,{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};const y=[e,t,r],v=[n,o,i],b=Ro(d,p),x=(f-h*b)/(b*b-1),_=(h-f*b)/(b*b-1),S=[x*d[0]+_*p[0],x*d[1]+_*p[1],x*d[2]+_*p[2]],C=Fo(d,p,[]);Lo(C);let T=0,w=0;const A=[],E=[];let D,P,I=50,O=50;for(let t=0;t<3;t++){const r=t,o=(t+1)%3,i=ea.intersectWithLine(y[r],y[o],n,p);i.intersection&&i.t>0-a&&i.t<1+a&&(i.t<1+a&&i.t>1-a&&(I=T),A[T++]=Ro(i.x,C)-Ro(S,C));const s=ea.intersectWithLine(v[r],v[o],e,d);s.intersection&&s.t>0-a&&s.t<1+a&&(s.t<1+a&&s.t>1-a&&(O=w),E[w++]=Ro(s.x,C)-Ro(S,C))}if(T>2){T--;const e=A[2];A[2]=A[I],A[I]=e}if(w>2){w--;const e=E[2];E[2]=E[O],E[O]=e}if(2!==T||2!==w)return{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};if(Number.isNaN(A[0])||Number.isNaN(A[1])||Number.isNaN(E[0])||Number.isNaN(E[1]))return{intersect:!1,coplanar:s,pt1:l,pt2:u,surfaceId:c};if(A[0]>A[1]){const e=A[1];A[1]=A[0],A[0]=e}if(E[0]>E[1]){const e=E[1];E[1]=E[0],E[0]=e}return A[1]2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qu,r),eu.extend(e,t,r),function(e,t){t.classHierarchy.push("vtkTriangle"),e.getCellDimension=()=>2,e.intersectWithLine=(r,n,o,i,a)=>{const s={subId:0,t:Number.MAX_VALUE,intersect:0,betweenPoints:!1};a[2]=0;const l=[],u=o*o,c=[],d=[],p=[];t.points.getPoint(0,c),t.points.getPoint(1,d),t.points.getPoint(2,p);const f=[],h=[];if(qu(c,d,p,f),0!==f[0]||0!==f[1]||0!==f[2]){const t=ea.intersectWithLine(r,n,c,f);if(s.betweenPoints=t.betweenPoints,s.t=t.t,i[0]=t.x[0],i[1]=t.x[1],i[2]=t.x[2],!t.intersection)return a[0]=0,a[1]=0,s.intersect=0,s;const o=e.evaluatePosition(i,l,a,h);if(o.evaluation>=0)return o.dist2<=u?(s.intersect=1,s):(s.intersect=o.evaluation,s)}const m=Vo(c,d),g=Vo(d,p),y=Vo(p,c);t.line||(t.line=Pu.newInstance()),m>g&&m>y?(t.line.getPoints().setPoint(0,c),t.line.getPoints().setPoint(1,d)):g>y&&g>m?(t.line.getPoints().setPoint(0,d),t.line.getPoints().setPoint(1,p)):(t.line.getPoints().setPoint(0,p),t.line.getPoints().setPoint(1,c));const v=t.line.intersectWithLine(r,n,o,i,a);if(s.betweenPoints=v.betweenPoints,s.t=v.t,v.intersect){const e=[],t=[],r=[];for(let n=0;n<3;n++)e[n]=c[n]-p[n],t[n]=d[n]-p[n],r[n]=i[n]-p[n];return a[0]=Ro(r,e)/y,a[1]=Ro(r,t)/g,s.intersect=1,s}return a[0]=0,a[1]=0,s.intersect=0,s},e.evaluatePosition=(e,r,n,o)=>{const i={subId:0,dist2:0,evaluation:-1};let a,s;const l=[],u=[],c=[],d=[];let p;const f=[],h=[],m=[];let g=0,y=0;const v=[];let b,x,_,S=[];const C=[],T=[],w=[];i.subId=0,n[2]=0,t.points.getPoint(1,l),t.points.getPoint(2,u),t.points.getPoint(0,c),$u(l,u,c,d),ea.generalizedProjectPoint(e,l,d,w);let A=0;for(a=0;a<3;a++)p=d[a]<0?-d[a]:d[a],p>A&&(A=p,y=a);for(s=0,a=0;a<3;a++)a!==y&&(v[s++]=a);for(a=0;a<2;a++)f[a]=w[v[a]]-c[v[a]],h[a]=l[v[a]]-c[v[a]],m[a]=u[v[a]]-c[v[a]];if(g=jo(h,m),0===g)return n[0]=0,n[1]=0,i.evaluation=-1,i;if(n[0]=jo(f,m)/g,n[1]=jo(h,f)/g,o[0]=1-(n[0]+n[1]),o[1]=n[0],o[2]=n[1],o[0]>=0&&o[0]<=1&&o[1]>=0&&o[1]<=1&&o[2]>=0&&o[2]<=1)r&&(i.dist2=Vo(w,e),r[0]=w[0],r[1]=w[1],r[2]=w[2]),i.evaluation=1;else{let t;if(r)if(o[1]<0&&o[2]<0)for(b=Vo(e,c),x=Pu.distanceToLine(e,l,c,t,C),_=Pu.distanceToLine(e,c,u,t,T),b{const o=[],i=[],a=[];t.points.getPoint(0,o),t.points.getPoint(1,i),t.points.getPoint(2,a);const s=1-e[0]-e[1];for(let t=0;t<3;t++)r[t]=o[t]*s+i[t]*e[0]+a[t]*e[1];n[0]=s,n[1]=e[0],n[2]=e[1]},e.getParametricDistance=e=>{let t,r=0;const n=[];n[0]=e[0],n[1]=e[1],n[2]=1-e[0]-e[1];for(let e=0;e<3;e++)t=n[e]<0?-n[e]:n[e]>1?n[e]-1:0,t>r&&(r=t);return r},e.derivatives=(e,r,n,o,i)=>{const a=t.points.getPoint(0),s=t.points.getPoint(1),l=t.points.getPoint(2),u=[],c=[],d=[],p=[];qu(a,s,l,u),Io(s,a,c),Io(l,a,p),Fo(u,c,d);const f=Lo(c);if(f<=0||Lo(d)<=0){for(let e=0;e{const o=r[0]-r[1],i=.5*(1-r[0])-r[1],a=2*r[0]+r[1]-1;return o>=0&&i>=0?(n[0]=t.pointsIds[0],n[1]=t.pointsIds[1]):i<0&&a>=0?(n[0]=t.pointsIds[1],n[1]=t.pointsIds[2]):(n[0]=t.pointsIds[2],n[1]=t.pointsIds[0]),!(r[0]<0||r[1]<0||r[0]>1||r[1]>1||1-r[0]-r[1]<0)}}(e,t)}var ec={newInstance:zt.newInstance(Zu,"vtkTriangle"),extend:Zu,...Ju};const tc={};function rc(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,tc,r),eu.extend(e,t,r),function(e,t){t.classHierarchy.push("vtkQuad"),e.getCellDimension=()=>2,e.getCellType=()=>pu,e.getNumberOfEdges=()=>4,e.getNumberOfFaces=()=>0,e.intersectWithLine=(e,r,n,o,i)=>{let a,s={subId:0,t:Number.MAX_VALUE,intersect:0,betweenPoints:!1};const l=t.points.getPoint(0,[]),u=t.points.getPoint(1,[]),c=t.points.getPoint(2,[]),d=t.points.getPoint(3,[]),p=Vo(l,c),f=Vo(u,d);if(p===f){let e,r=0,n=0;for(let o=0;o<4;o++)e=t.pointsIds[o],e>r&&(r=e,n=o);a=0===n||2===n?0:1}else a=p{const r=1-e[0],n=1-e[1];t[0]=r*n,t[1]=e[0]*n,t[2]=e[0]*e[1],t[3]=r*e[1]},e.evaluateLocation=(r,n,o)=>{const i=[];e.interpolationFunctions(r,o),n[0]=0,n[1]=0,n[2]=0;for(let e=0;e<4;e++){t.points.getPoint(e,i);for(let t=0;t<3;t++)n[t]+=i[t]*o[e]}}}(e,t)}var nc={newInstance:zt.newInstance(rc,"vtkQuad"),extend:rc};const{vtkErrorMacro:oc}=zt;function ic(e){return()=>oc(`vtkTriangleStrip.${e} - NOT IMPLEMENTED`)}const ac={decomposeStrip:function(e,t){if(!Array.isArray(e)||e.length<3)return void oc("decomposeStrip - Invalid points array");let r=e[0],n=e[1];for(let o=0;o2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,sc,r),eu.extend(e,t,r),t.line||(t.line=Pu.newInstance()),t.triangle||(t.triangle=ec.newInstance()),function(e,t){t.classHierarchy.push("vtkTriangleStrip");const r=e.initialize;e.initialize=(e,n)=>{t.triangle.initialize(e,n),r(e,n)},e.getCellType=()=>cu,e.getCellDimension=()=>2,e.getNumberOfEdges=()=>t.pointsIds.length,e.getNumberOfFaces=()=>0,e.evaluatePosition=(e,r,n,o,i)=>{const a=[0,0,0];let s=Number.MAX_VALUE,l=0;const u=[],c=[],d=[];n[2]=0,c[0]=0,c[1]=0,c[2]=0;const p=t.triangle.getPoints();p.setNumberOfPoints(3);const f=t.triangle.getPointsIds().length;for(let e=0;e=0&&(g{const i=[[0,1,2],[1,0,2]],a=e%2,s=t.pointsIds.length;for(let e=0;e{const o=[[0,1,2],[1,0,2]],i=e%2,a=t.triangle.getPointsIds();return a[0]=t.pointsIds[o[i][0]],a[1]=t.pointsIds[o[i][1]],a[2]=t.pointsIds[o[i][2]],t.triangle.cellBoundary(0,r,n)},e.getEdge=e=>{let r,n;const o=t.pointsIds.length;return 0===e?(r=0,n=1):e===o-1?(r=e-1,n=e):(r=e-1,n=e+1),t.line.getPointsIds()[0]=t.pointsIds[r],t.line.getPointsIds()[1]=t.pointsIds[n],t.line.getPoints().setPoint(0,t.points.getPoint(r)),t.line.getPoints().setPoint(1,t.points.getPoint(n)),t.line},e.intersectWithLine=(e,r,n,o,i)=>{const a=t.pointsIds.length-2,s=t.triangle.getPoints();s.setNumberOfPoints(3);for(let l=0;l{const e=t.points.getNumberOfPoints()-2;t.tris=new Array(3*e);const r=[[0,1,2],[1,0,2]];for(let n=0;nt.tris,e.derivatives=(e,r,n,o,i)=>{const a=[];t.points.getPoint(e,a);const s=[];t.points.getPoint(e+1,s);const l=[];t.points.getPoint(e+2,l);const u=t.triangle.getPoints();u.setPoint(0,...a),u.setPoint(1,...s),u.setPoint(2,...l),t.triangle.derivatives(0,r,n,o,i)},e.getParametricCenter=e=>(e[0]=.333333,e[1]=.333333,e[2]=0,Math.floor((t.pointsIds.length-2)/2)),e.contour=(e,t,r,n,o,i,a,s,l,u,c)=>ic("contour")(),e.clip=(e,t,r,n,o,i,a,s,l,u)=>ic("clip")()}(e,t)}var uc={newInstance:zt.newInstance(lc,"vtkTriangleStrip"),extend:lc,...ac};const cc=["verts","lines","polys","strips"],{vtkWarningMacro:dc}=zt,pc={[su]:Pu,[pu]:nc,[lu]:Pu,[uu]:ec,[cu]:uc,[lu]:Fu,[du]:Xu},fc={};function hc(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fc,r),Nu.extend(e,t,r),zt.get(e,t,["cells","links"]),zt.setGet(e,t,["verts","lines","polys","strips"]),function(e,t){function r(e){return e.replace(/(?:^\w|[A-Z]|\b\w)/g,e=>e.toUpperCase()).replace(/\s+/g,"")}function n(){t.cells=void 0,t.links=void 0}t.classHierarchy.push("vtkPolyData"),cc.forEach(o=>{e[`getNumberOf${r(o)}`]=()=>t[o].getNumberOfCells(),t[o]?t[o]=Ge(t[o]):t[o]=Xl.newInstance(),t[`_on${r(o)}Changed`]=n}),e.getNumberOfCells=()=>cc.reduce((e,r)=>e+t[r].getNumberOfCells(),0);const o=e.shallowCopy;e.shallowCopy=function(e){o(e,arguments.length>1&&void 0!==arguments[1]&&arguments[1]),cc.forEach(r=>{t[r]=Xl.newInstance(),t[r].shallowCopy(e.getReferenceByName(r))})};const i=e.getMTime;e.getMTime=()=>cc.reduce((e,r)=>Math.max(e,t[r]?.getMTime()??e),i());const a=e.initialize;e.initialize=()=>(cc.forEach(e=>t[e]?.initialize()),n(),a()),e.buildCells=()=>{const r=e.getNumberOfVerts(),n=e.getNumberOfLines(),o=e.getNumberOfPolys(),i=e.getNumberOfStrips(),a=r+n+o+i,s=new Uint8Array(a);let l=s;const u=new Uint32Array(a);let c=u;if(r){let e=0;t.verts.getCellSizes().forEach((t,r)=>{c[r]=e,l[r]=t>1?au:iu,e+=t+1}),c=c.subarray(r),l=l.subarray(r)}if(n){let e=0;t.lines.getCellSizes().forEach((t,r)=>{c[r]=e,l[r]=t>2?lu:su,1===t&&dc("Building VTK_LINE ",r," with only one point, but VTK_LINE needs at least two points. Check the input."),e+=t+1}),c=c.subarray(n),l=l.subarray(n)}if(o){let e=0;t.polys.getCellSizes().forEach((t,r)=>{switch(c[r]=e,t){case 3:l[r]=uu;break;case 4:l[r]=pu;break;default:l[r]=du}t<3&&dc("Building VTK_TRIANGLE ",r," with less than three points, but VTK_TRIANGLE needs at least three points. Check the input."),e+=t+1}),c+=c.subarray(o),l+=l.subarray(o)}if(i){let e=0;l.fill(cu,0,i),t.strips.getCellSizes().forEach((t,r)=>{c[r]=e,e+=t+1})}t.cells=xu.newInstance(),t.cells.setCellTypes(a,s,u)},e.buildLinks=function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;null==t.cells&&e.buildCells(),t.links=nu.newInstance(),r>0?t.links.allocate(r):t.links.allocate(e.getPoints().getNumberOfPoints()),t.links.buildLinks(e)},e.getCellType=e=>t.cells.getCellType(e),e.getCellPoints=r=>{const n=e.getCellType(r);let o=null;switch(n){case iu:case au:o=t.verts;break;case su:case lu:o=t.lines;break;case uu:case pu:case du:o=t.polys;break;case cu:o=t.strips;break;default:return o=null,{type:0,cellPointIds:null}}const i=t.cells.getCellLocation(r);return{cellType:n,cellPointIds:o.getCell(i)}},e.getPointCells=e=>t.links.getCells(e),e.getCellEdgeNeighbors=(e,r,n)=>{const o=t.links.getLink(r),i=t.links.getLink(n);return o.cells.filter(t=>t!==e&&-1!==i.cells.indexOf(t))},e.getCell=function(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const n=e.getCellPoints(t),o=r||pc[n.cellType].newInstance();return o.initialize(e.getPoints(),n.cellPointIds),o},e.getMaxCellSize=()=>cc.reduce((e,r)=>Math.max(e,t[r]?.getMaxCellSize?.()??0),0)}(e,t)}var mc={newInstance:zt.newInstance(hc,"vtkPolyData"),extend:hc};const gc={image:null,canvas:null,jsImageData:null,imageBitmap:null,imageLoaded:!1,repeat:!1,interpolate:!1,edgeClamp:!1,mipLevel:0,resizable:!1};function yc(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,gc,r),zt.obj(e,t),zt.algo(e,t,6,0),zt.get(e,t,["canvas","image","jsImageData","imageBitmap","imageLoaded","resizable"]),zt.setGet(e,t,["repeat","edgeClamp","interpolate","mipLevel"]),function(e,t){t.classHierarchy.push("vtkTexture"),e.imageLoaded=()=>{t.image.removeEventListener("load",e.imageLoaded),t.imageLoaded=!0,e.modified()},e.setJsImageData=r=>{t.jsImageData!==r&&(null!==r&&(e.setInputData(null),e.setInputConnection(null),t.image=null,t.canvas=null,t.imageBitmap=null),t.jsImageData=r,t.imageLoaded=!0,e.modified())},e.setImageBitmap=r=>{t.imageBitmap!==r&&(null!==r&&(e.setInputData(null),e.setInputConnection(null),t.image=null,t.canvas=null,t.jsImageData=null),t.imageBitmap=r,t.imageLoaded=!0,e.modified())},e.setCanvas=r=>{t.canvas!==r&&(null!==r&&(e.setInputData(null),e.setInputConnection(null),t.image=null,t.imageBitmap=null,t.jsImageData=null),t.canvas=r,e.modified())},e.setImage=r=>{t.image!==r&&(null!==r&&(e.setInputData(null),e.setInputConnection(null),t.canvas=null,t.jsImageData=null,t.imageBitmap=null),t.image=r,t.imageLoaded=!1,r.complete?e.imageLoaded():r.addEventListener("load",e.imageLoaded),e.modified())},e.getDimensionality=()=>{let r=0,n=0,o=1;if(e.getInputData()){const t=e.getInputData();r=t.getDimensions()[0],n=t.getDimensions()[1],o=t.getDimensions()[2]}return t.jsImageData&&(r=t.jsImageData.width,n=t.jsImageData.height),t.canvas&&(r=t.canvas.width,n=t.canvas.height),t.image&&(r=t.image.width,n=t.image.height),t.imageBitmap&&(r=t.imageBitmap.width,n=t.imageBitmap.height),(r>1)+(n>1)+(o>1)},e.getInputAsJsImageData=()=>{if(!t.imageLoaded||e.getInputData())return null;if(t.jsImageData)return t.jsImageData;if(t.imageBitmap)return t.imageBitmap;if(t.canvas)return t.canvas.getContext("2d").getImageData(0,0,t.canvas.width,t.canvas.height);if(t.image){const e=t.image.width,r=t.image.height,n=new OffscreenCanvas(e,r).getContext("2d");return n.translate(0,r),n.scale(1,-1),n.drawImage(t.image,0,0,e,r),n.getImageData(0,0,e,r)}return null}}(e,t)}var vc={newInstance:zt.newInstance(yc,"vtkTexture"),extend:yc,generateMipmaps:(e,t,r)=>{const n=e.createShaderModule({code:"\n @group(0) @binding(0) var inputTexture: texture_2d;\n @group(0) @binding(1) var outputTexture: texture_storage_2d;\n\n @compute @workgroup_size(8, 8)\n fn main(@builtin(global_invocation_id) global_id: vec3) {\n let texelCoord = vec2(global_id.xy);\n let outputSize = textureDimensions(outputTexture);\n\n if (texelCoord.x >= i32(outputSize.x) || texelCoord.y >= i32(outputSize.y)) {\n return;\n }\n\n let inputSize = textureDimensions(inputTexture);\n let scale = vec2(inputSize) / vec2(outputSize);\n\n // Compute the floating-point source coordinate\n let srcCoord = (vec2(texelCoord) + 0.5) * scale - 0.5;\n\n // Get integer coordinates for the four surrounding texels\n let x0 = i32(floor(srcCoord.x));\n let x1 = min(x0 + 1, i32(inputSize.x) - 1);\n let y0 = i32(floor(srcCoord.y));\n let y1 = min(y0 + 1, i32(inputSize.y) - 1);\n\n // Compute the weights\n let wx = srcCoord.x - f32(x0);\n let wy = srcCoord.y - f32(y0);\n\n // Fetch the four texels\n let c00 = textureLoad(inputTexture, vec2(x0, y0), 0);\n let c10 = textureLoad(inputTexture, vec2(x1, y0), 0);\n let c01 = textureLoad(inputTexture, vec2(x0, y1), 0);\n let c11 = textureLoad(inputTexture, vec2(x1, y1), 0);\n\n // Bilinear interpolation\n let color = mix(\n mix(c00, c10, wx),\n mix(c01, c11, wx),\n wy\n );\n\n textureStore(outputTexture, texelCoord, color);\n }\n "}),o=e.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.COMPUTE,texture:{sampleType:"float"}},{binding:1,visibility:GPUShaderStage.COMPUTE,storageTexture:{format:"rgba8unorm",access:"write-only"}},{binding:2,visibility:GPUShaderStage.COMPUTE,sampler:{type:"filtering"}}]}),i=e.createPipelineLayout({bindGroupLayouts:[o]}),a=e.createComputePipeline({label:"ComputeMipmapPipeline",layout:i,compute:{module:n,entryPoint:"main"}}),s=e.createSampler({magFilter:"linear",minFilter:"linear"});for(let n=1;n>n),d=Math.max(1,t.height>>n),p=Math.ceil(c/8),f=Math.ceil(d/8);u.dispatchWorkgroups(p,f),u.end(),e.queue.submit([l.finish()])}}};const bc=[[-1,0,0],[1,0,0],[0,-1,0],[0,1,0],[0,0,-1],[0,0,1]],xc=[[8,7,11,3],[9,1,10,5],[4,9,0,8],[2,11,6,10],[0,3,2,1],[4,5,6,7]],_c=[[0,1],[1,3],[2,3],[0,2],[4,5],[5,7],[6,7],[4,6],[0,4],[1,5],[3,7],[2,6]],Sc=[0,1,0,1,0,1,0,1,2,2,2,2],Cc=[[1,2],[1,2],[0,2],[0,2],[0,1],[0,1]],Tc=new Float64Array(3),wc=new Float64Array(3),Ac=new Float64Array(3),Ec=new Float64Array(3),Dc=new Float64Array(3),Pc=new Float64Array(3),Ic=new Float64Array(16);function Oc(e,t){e.strokeStyle=t.strokeColor,e.lineWidth=t.strokeSize,e.fillStyle=t.fontColor,e.font=`${t.fontStyle} ${t.fontSize}px ${t.fontFamily}`}function Nc(e){const t=[],r=[];for(let n=0;n<3;n++){const o=no().domain([e[2*n],e[2*n+1]]);t[n]=o.ticks(5);const i=o.tickFormat(5);r[n]=t[n].map(i)}return{ticks:t,tickStrings:r}}const Mc=zt.newInstance(function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{renderable:null};Object.assign(t,{},r),zt.obj(e,t),t.tmPolyData=mc.newInstance(),t.tmMapper=Gl.newInstance(),t.tmMapper.setInputData(t.tmPolyData),t.tmActor=ss.newInstance({parentProp:e}),t.tmActor.setMapper(t.tmMapper),zt.setGet(e,t,["renderable"]),zt.get(e,t,["lastSize","lastAspectRatio","axisTextStyle","tickTextStyle","tmActor","ticks"]),t.forceUpdate=!1,t.lastRedrawTime={},zt.obj(t.lastRedrawTime,{mtime:0}),t.lastRebuildTime={},zt.obj(t.lastRebuildTime,{mtime:0}),t.lastSize=[-1,-1],t.lastTickBounds=[],function(e,t){t.classHierarchy.push("vtkCubeAxesActorHelper"),e.setRenderable=r=>{t.renderable!==r&&(t.renderable=r,t.tmActor.addTexture(t.renderable.getTmTexture()),t.tmActor.setProperty(r.getProperty()),t.tmActor.setParentProp(r),e.modified())},e.createPolyDataForOneLabel=(e,r,n,o,i,a,s)=>{const l=t.renderable.get_tmAtlas().get(e);if(!l)return;const u=t.renderable.getTextPolyData().getPoints().getData(),c=t.lastSize;Tc[0]=u[3*r],Tc[1]=u[3*r+1],Tc[2]=u[3*r+2],Sr(Ac,Tc,n),Ac[0]+=.1,Sr(wc,Ac,o),yr(Dc,wc,Tc),Ac[0]-=.1,Ac[1]+=.1,Sr(wc,Ac,o),yr(Pc,wc,Tc);for(let e=0;e<3;e++)Dc[e]/=.05*c[0],Pc[e]/=.05*c[1];let d=s.ptIdx,p=s.cellIdx;Tc[0]=u[3*r],Tc[1]=u[3*r+1],Tc[2]=u[3*r+2],i[0]<-.5?vr(Ac,Dc,i[0]*a-l.width):i[0]>.5?vr(Ac,Dc,i[0]*a):vr(Ac,Dc,i[0]*a-l.width/2),gr(Tc,Tc,Ac),vr(Ac,Pc,i[1]*a-l.height/2),gr(Tc,Tc,Ac),s.points[3*d]=Tc[0],s.points[3*d+1]=Tc[1],s.points[3*d+2]=Tc[2],s.tcoords[2*d]=l.tcoords[0],s.tcoords[2*d+1]=l.tcoords[1],d++,vr(Ac,Dc,l.width),gr(Tc,Tc,Ac),s.points[3*d]=Tc[0],s.points[3*d+1]=Tc[1],s.points[3*d+2]=Tc[2],s.tcoords[2*d]=l.tcoords[2],s.tcoords[2*d+1]=l.tcoords[3],d++,vr(Ac,Pc,l.height),gr(Tc,Tc,Ac),s.points[3*d]=Tc[0],s.points[3*d+1]=Tc[1],s.points[3*d+2]=Tc[2],s.tcoords[2*d]=l.tcoords[4],s.tcoords[2*d+1]=l.tcoords[5],d++,vr(Ac,Dc,l.width),yr(Tc,Tc,Ac),s.points[3*d]=Tc[0],s.points[3*d+1]=Tc[1],s.points[3*d+2]=Tc[2],s.tcoords[2*d]=l.tcoords[6],s.tcoords[2*d+1]=l.tcoords[7],d++,s.polys[4*p]=3,s.polys[4*p+1]=d-4,s.polys[4*p+2]=d-3,s.polys[4*p+3]=d-2,p++,s.polys[4*p]=3,s.polys[4*p+1]=d-4,s.polys[4*p+2]=d-2,s.polys[4*p+3]=d-1,s.ptIdx+=4,s.cellIdx+=2},e.updateTexturePolyData=()=>{const r=t.camera.getCompositeProjectionMatrix(t.lastAspectRatio,-1,1);m(r,r);const n=t.renderable.getTextValues().length,o=4*n,i=2*n,a=new Float64Array(3*o),s=new Uint16Array(4*i),l=new Float32Array(2*o);g(Ic,r);const u={ptIdx:0,cellIdx:0,polys:s,points:a,tcoords:l};let c=0,d=0,p=0;const f=t.renderable.getTextPolyData().getPoints().getData(),h=t.renderable.getTextValues();for(;c{t.lastSize[0]===r[0]&&t.lastSize[1]===r[1]||(t.lastSize[0]=r[0],t.lastSize[1]=r[1],t.lastAspectRatio=r[0]/r[1],t.forceUpdate=!0),t.camera=n,e.updateTexturePolyData()}}(e,t)},"vtkCubeAxesActorHelper");function Rc(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};ss.extend(e,t,function(e,t,r){return{boundsScaleFactor:1.3,camera:null,dataBounds:[...Va.INIT_BOUNDS],faceVisibilityAngle:8,gridLines:!0,axisLabels:null,axisTitlePixelOffset:35,tickLabelPixelOffset:12,generateTicks:Nc,...r,axisTextStyle:{fontColor:"white",fontStyle:"normal",fontSize:18,fontFamily:"serif",...r?.axisTextStyle},tickTextStyle:{fontColor:"white",fontStyle:"normal",fontSize:14,fontFamily:"serif",...r?.tickTextStyle}}}(0,0,r)),t.lastFacesToDraw=[!1,!1,!1,!1,!1,!1],t.axisLabels=["X-Axis","Y-Axis","Z-Axis"],t.tickCounts=[],t.textValues=[],t.lastTickBounds=[],t.tmCanvas=document.createElement("canvas"),t.tmContext=t.tmCanvas.getContext("2d"),t._tmAtlas=new Map,t.tmTexture=vc.newInstance({resizable:!0}),t.tmTexture.setInterpolate(!1),e.getProperty().setDiffuse(0),e.getProperty().setAmbient(1),t.gridMapper=Gl.newInstance(),t.polyData=mc.newInstance(),t.gridMapper.setInputData(t.polyData),t.gridActor=ss.newInstance(),t.gridActor.setMapper(t.gridMapper),t.gridActor.setProperty(e.getProperty()),t.gridActor.setParentProp(e),t.textPolyData=mc.newInstance(),zt.setGet(e,t,["axisTitlePixelOffset","boundsScaleFactor","faceVisibilityAngle","gridLines","tickLabelPixelOffset","generateTicks"]),zt.setGetArray(e,t,["dataBounds"],6),zt.setGetArray(e,t,["axisLabels"],3),zt.get(e,t,["axisTextStyle","tickTextStyle","camera","tmTexture","textValues","textPolyData","tickCounts","gridActor"]),function(e,t){t.classHierarchy.push("vtkCubeAxesActor"),e.setCamera=r=>{t.camera!==r&&(t.cameraModifiedSub&&(t.cameraModifiedSub.unsubscribe(),t.cameraModifiedSub=null),t.camera=r,r&&(t.cameraModifiedSub=r.onModified(e.update)),e.update(),e.modified())},e.computeFacesToDraw=()=>{const e=t.camera.getViewMatrix();m(e,e);let r=!1;const n=Va.getDiagonalLength(t.dataBounds),o=Math.sin(t.faceVisibilityAngle*Math.PI/180);for(let i=0;i<6;i++){let a=!1;const s=Math.floor(i/2),l=(s+1)%3,u=(s+2)%3;t.dataBounds[2*l]!==t.dataBounds[2*l+1]&&t.dataBounds[2*u]!==t.dataBounds[2*u+1]&&(Tc[s]=t.dataBounds[i]-.1*n*bc[i][s],Tc[l]=.5*(t.dataBounds[2*l]+t.dataBounds[2*l+1]),Tc[u]=.5*(t.dataBounds[2*u]+t.dataBounds[2*u+1]),Sr(Ac,Tc,e),Tc[s]=t.dataBounds[i],Sr(Ec,Tc,e),yr(Ac,Ec,Ac),br(Ac,Ac),a=Ac[2]>o,t.camera.getParallelProjection()||(br(Ec,Ec),a=xr(Ec,Ac)>o)),a!==t.lastFacesToDraw[i]&&(t.lastFacesToDraw[i]=a,r=!0)}return r},e.updatePolyData=(e,r,n)=>{let o=0,i=0;o+=8;let a=0;for(let e=0;e<12;e++)r[e]>0&&a++;if(i+=a,t.gridLines)for(let t=0;t<6;t++)e[t]&&(o+=2*n[Cc[t][0]].length+2*n[Cc[t][1]].length,i+=n[Cc[t][0]].length+n[Cc[t][1]].length);const s=new Float64Array(3*o),l=new Uint32Array(3*i);let u=0,c=0;for(let e=0;e<2;e++)for(let r=0;r<2;r++)for(let n=0;n<2;n++)s[3*u]=t.dataBounds[n],s[3*u+1]=t.dataBounds[2+r],s[3*u+2]=t.dataBounds[4+e],u++;for(let e=0;e<12;e++)r[e]>0&&(l[3*c]=2,l[3*c+1]=_c[e][0],l[3*c+2]=_c[e][1],c++);if(t.gridLines)for(let r=0;r<6;r++)if(e[r]){const e=Math.floor(r/2);let o=n[Cc[r][0]];for(let n=0;n{let i=0;for(let e=0;e<12;e++)1===r[e]&&(i+=2,i+=n[Sc[e]].length);const a=t.polyData.getPoints().getData(),s=new Float64Array(3*i);let l=0,u=0,c=0;for(let i=0;i<6;i++)if(e[i])for(let e=0;e<4;e++){const d=xc[i][e];if(1===r[d]){const e=Sc[d],r=3*_c[d][0],p=3*_c[d][1];s[3*l]=.5*(a[r]+a[p]),s[3*l+1]=.5*(a[r+1]+a[p+1]),s[3*l+2]=.5*(a[r+2]+a[p+2]),l++,s[3*l+Math.floor(i/2)]=t.dataBounds[i],s[3*l+Cc[i][0]]=.5*(t.dataBounds[2*Cc[i][0]]+t.dataBounds[2*Cc[i][0]+1]),s[3*l+Cc[i][1]]=.5*(t.dataBounds[2*Cc[i][1]]+t.dataBounds[2*Cc[i][1]+1]),l++,t.textValues[u]=t.axisLabels[e],u++;const f=(e+1)%3,h=(e+2)%3,m=n[e],g=o[e];t.tickCounts[c]=m.length;for(let n=0;n{if(!t.camera)return;const r=e.computeFacesToDraw(),n=t.lastFacesToDraw;let o=!1;for(let e=0;e<6;e++)t.dataBounds[e]!==t.lastTickBounds[e]&&(o=!0,t.lastTickBounds[e]=t.dataBounds[e]);if(r||o||t.forceUpdate){const r=new Array(12).fill(0);for(let e=0;e<6;e++)if(n[e])for(let t=0;t<4;t++)r[xc[e][t]]++;const i=t.generateTicks(t.dataBounds);e.updatePolyData(n,r,i.ticks),e.updateTextData(n,r,i.ticks,i.tickStrings),(o||t.forceUpdate)&&e.updateTextureAtlas(i.tickStrings)}t.forceUpdate=!1},e.updateTextureAtlas=e=>{t.tmContext.textBaseline="bottom",t.tmContext.textAlign="left",t._tmAtlas.clear();let r=0,n=1;for(let o=0;o<3;o++){if(!t._tmAtlas.has(t.axisLabels[o])){Oc(t.tmContext,t.axisTextStyle);const e=t.tmContext.measureText(t.axisLabels[o]),i={height:e.actualBoundingBoxAscent+2,startingHeight:n,width:e.width+2,textStyle:t.axisTextStyle};t._tmAtlas.set(t.axisLabels[o],i),n+=i.height,r{e.tcoords=[0,(n-e.startingHeight-e.height)/n,e.width/r,(n-e.startingHeight-e.height)/n,e.width/r,(n-e.startingHeight)/n,0,(n-e.startingHeight)/n]}),t.tmCanvas.width=r,t.tmCanvas.height=n,t.tmContext.textBaseline="bottom",t.tmContext.textAlign="left",t.tmContext.clearRect(0,0,r,n),t._tmAtlas.forEach((e,r)=>{Oc(t.tmContext,e.textStyle),t.tmContext.fillText(r,1,e.startingHeight+e.height-1)}),t.tmTexture.setCanvas(t.tmCanvas),t.tmTexture.modified()},e.onModified(()=>{t.forceUpdate=!0,e.update()}),e.setTickTextStyle=r=>{t.tickTextStyle={...t.tickTextStyle,...r},e.modified()},e.setAxisTextStyle=r=>{t.axisTextStyle={...t.axisTextStyle,...r},e.modified()},e.get_tmAtlas=()=>t._tmAtlas,e.getBounds=()=>(e.update(),Va.setBounds(t.bounds,t.gridActor.getBounds()),Va.scaleAboutCenter(t.bounds,t.boundsScaleFactor,t.boundsScaleFactor,t.boundsScaleFactor),t.bounds);const r=zt.chain(e.setProperty,t.gridActor.setProperty);e.setProperty=e=>r(e)[0]}(e,t)}var Fc={newInstance:zt.newInstance(Rc,"vtkCubeAxesActor"),extend:Rc,newCubeAxesActorHelper:Mc,defaultGenerateTicks:Nc};const Bc={};const Lc=Pt(function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bc,r),Xt.extend(e,t,r),t.CubeAxesActorHelper=Fc.newCubeAxesActorHelper(),function(e,t){t.classHierarchy.push("vtkOpenGLCubeAxesActor"),e.buildPass=r=>{r&&(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.CubeAxesActorHelper.getRenderable()||t.CubeAxesActorHelper.setRenderable(t.renderable),e.prepareNodes(),e.addMissingNode(t.CubeAxesActorHelper.getTmActor()),e.addMissingNode(t.renderable.getGridActor()),e.removeUnusedNodes())},e.opaquePass=(e,r)=>{if(e){const e=t._openGLRenderer?t._openGLRenderer.getRenderable().getActiveCamera():null,r=t._openGLRenderer.getTiledSizeAndOrigin();t.CubeAxesActorHelper.updateAPISpecificData([r.usize,r.vsize],e,t._openGLRenderWindow.getRenderable())}}}(e,t)},"vtkOpenGLCubeAxesActor");Qt("vtkCubeAxesActor",Lc);const kc={ARRAY_BUFFER:0,ELEMENT_ARRAY_BUFFER:1,TEXTURE_BUFFER:2};var Uc={ObjectType:kc};const{ObjectType:Vc}=Uc,Gc={objectType:Vc.ARRAY_BUFFER,context:null,allocatedGPUMemoryInBytes:0};function zc(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Gc,r),zt.obj(e,t),zt.get(e,t,["_openGLRenderWindow","allocatedGPUMemoryInBytes"]),zt.moveToProtected(e,t,["openGLRenderWindow"]),function(e,t){function r(e){switch(e){case Vc.ELEMENT_ARRAY_BUFFER:return t.context.ELEMENT_ARRAY_BUFFER;case Vc.TEXTURE_BUFFER:if("TEXTURE_BUFFER"in t.context)return t.context.TEXTURE_BUFFER;case Vc.ARRAY_BUFFER:default:return t.context.ARRAY_BUFFER}}t.classHierarchy.push("vtkOpenGLBufferObject");let n=null,o=null,i=!0,a="";e.getType=()=>n,e.setType=e=>{n=e},e.getHandle=()=>o,e.isReady=()=>!1===i,e.generateBuffer=e=>{const i=r(e);return null===o&&(o=t.context.createBuffer(),n=e),r(n)===i},e.upload=(s,l)=>e.generateBuffer(l)?(t.context.bindBuffer(r(n),o),t.context.bufferData(r(n),s,t.context.STATIC_DRAW),t.allocatedGPUMemoryInBytes=s.length*s.BYTES_PER_ELEMENT,i=!1,!0):(a="Trying to upload array buffer to incompatible buffer.",!1),e.bind=()=>!!o&&(t.context.bindBuffer(r(n),o),!0),e.release=()=>!!o&&(t.context.bindBuffer(r(n),null),!0),e.releaseGraphicsResources=()=>{null!==o&&(t.context.bindBuffer(r(n),null),t.context.deleteBuffer(o),o=null,t.allocatedGPUMemoryInBytes=0)},e.setOpenGLRenderWindow=r=>{t._openGLRenderWindow!==r&&(e.releaseGraphicsResources(),t._openGLRenderWindow=r,t.context=null,r&&(t.context=t._openGLRenderWindow.getContext()))},e.getError=()=>a}(e,t)}var jc={newInstance:zt.newInstance(zc),extend:zc,...Uc};const{vtkErrorMacro:Wc}=zt;function Hc(e,t){t.classHierarchy.push("vtkOpenGLCellArrayBufferObject"),e.setType(kc.ARRAY_BUFFER),e.createVBO=function(r,n,o,i){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;if(!r.getData()||!r.getData().length)return t.elementCount=0,0;t.blockSize=3,t.vertexOffset=0,t.normalOffset=0,t.tCoordOffset=0,t.tCoordComponents=0,t.colorComponents=0,t.colorOffset=0,t.customData=[];const s=i.points.getData();let l=null,u=null,c=null;const d=i.colors?i.colors.getNumberOfComponents():0,p=i.tcoords?i.tcoords.getNumberOfComponents():0;i.normals&&(t.normalOffset=4*t.blockSize,t.blockSize+=3,l=i.normals.getData()),i.customAttributes&&i.customAttributes.forEach(e=>{e&&(t.customData.push({data:e.getData(),offset:4*t.blockSize,components:e.getNumberOfComponents(),name:e.getName()}),t.blockSize+=e.getNumberOfComponents())}),i.tcoords&&(t.tCoordOffset=4*t.blockSize,t.tCoordComponents=p,t.blockSize+=p,u=i.tcoords.getData()),i.colors?(t.colorComponents=i.colors.getNumberOfComponents(),t.colorOffset=0,c=i.colors.getData(),t.colorBO||(t.colorBO=jc.newInstance()),t.colorBO.setOpenGLRenderWindow(t._openGLRenderWindow)):t.colorBO=null,t.stride=4*t.blockSize;let f,h=0,m=0,g=0,y=0,v=0,b=0;const x={anythingToPoints(e,t,r,n){for(let o=0;o2)for(let o=0;o2){for(let o=0;oe,linesToWireframe:(e,t)=>e>1?2*(e-1):0,polysToWireframe:(e,t)=>e>2?2*e:0,stripsToWireframe:(e,t)=>e>2?4*e-6:0,polysToSurface:(e,t)=>e>2?3*(e-2):0,stripsToSurface:(e,t,r)=>e>2?3*(e-2):0};let S=null,C=null;o===Ja.POINTS||"verts"===n?(S=x.anythingToPoints,C=_.anythingToPoints):o===Ja.WIREFRAME||"lines"===n?(S=x[`${n}ToWireframe`],C=_[`${n}ToWireframe`]):(S=x[`${n}ToSurface`],C=_[`${n}ToSurface`]);const T=r.getData(),w=T.length;let A=0;for(let e=0;e0&&(Math.abs(r)/t>1e6||Math.abs(Math.log10(t))>3||0===t&&r>1e6);if(n){const t=new Float64Array(3),r=new Float64Array(3);for(let n=0;n<3;++n){const o=e.getRange(n),i=o[1]-o[0];t[n]=.5*(o[1]+o[0]),r[n]=i>0?1/i:1}return{useShiftAndScale:n,coordShift:t,coordScale:r}}return{useShiftAndScale:n,coordShift:new Float32Array([0,0,0]),coordScale:new Float32Array([1,1,1])}}(i.points);if(O?e.setCoordShiftAndScale(N,M):!0===t.coordShiftAndScaleEnabled&&e.setCoordShiftAndScale(null,null),a)if(a.points||a.cells){const e=new Int32Array(A+a.points.length);e.set(a.points),a.points=e;const t=new Int32Array(A+a.cells.length);t.set(a.cells),a.cells=t}else a.points=new Int32Array(A),a.cells=new Int32Array(A);let R=i.vertexOffset;f=function(e,r){if(a&&(a.points[R]=e,a.cells[R]=b+i.cellOffset),++R,h=3*e,t.coordShiftAndScaleEnabled?(D[P++]=(s[h++]-t.coordShift[0])*t.coordScale[0],D[P++]=(s[h++]-t.coordShift[1])*t.coordScale[1],D[P++]=(s[h++]-t.coordShift[2])*t.coordScale[2]):(D[P++]=s[h++],D[P++]=s[h++],D[P++]=s[h++]),null!==l&&(m=i.haveCellNormals?3*(b+i.cellOffset):3*e,D[P++]=l[m++],D[P++]=l[m++],D[P++]=l[m++]),t.customData.forEach(t=>{v=e*t.components;for(let e=0;e{null===e||e.constructor===Float64Array&&3===e.length?null===r||r.constructor===Float64Array&&3===r.length?(null!==t.coordShift&&null!==e&&Tr(e,t.coordShift)||(t.coordShift=e),null!==t.coordScale&&null!==r&&Tr(r,t.coordScale)||(t.coordScale=r),t.coordShiftAndScaleEnabled=function(e,t){return null!==e&&null!==t&&!(Cr(e,[0,0,0])&&Cr(t,[1,1,1]))}(t.coordShift,t.coordScale),t.coordShiftAndScaleEnabled?t.inverseShiftAndScaleMatrix=function(e,t){const r=new Float64Array(3);var n,o;o=t,(n=r)[0]=1/o[0],n[1]=1/o[1],n[2]=1/o[2];const i=new Float64Array(16);return L(i,Mi(),e,r),i}(t.coordShift,t.coordScale):t.inverseShiftAndScaleMatrix=null):Wc("Wrong type for coordScale, expected vec3 or null"):Wc("Wrong type for coordShift, expected vec3 or null")}}const Kc={elementCount:0,stride:0,colorBOStride:0,vertexOffset:0,normalOffset:0,tCoordOffset:0,tCoordComponents:0,colorOffset:0,colorComponents:0,tcoordBO:null,customData:[],coordShift:null,coordScale:null,coordShiftAndScaleEnabled:!1,inverseShiftAndScaleMatrix:null};function Xc(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Kc,r),jc.extend(e,t,r),zt.setGet(e,t,["colorBO","elementCount","stride","colorBOStride","vertexOffset","normalOffset","tCoordOffset","tCoordComponents","colorOffset","colorComponents","customData"]),zt.get(e,t,["coordShift","coordScale","coordShiftAndScaleEnabled","inverseShiftAndScaleMatrix"]),Hc(e,t)}var $c={newInstance:zt.newInstance(Xc),extend:Xc};const{vtkErrorMacro:qc}=zt,Yc={shaderType:"Unknown",source:"",error:"",handle:0,dirty:!1,context:null};function Jc(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Yc,r),zt.obj(e,t),zt.setGet(e,t,["shaderType","source","error","handle","context"]),function(e,t){t.classHierarchy.push("vtkShader"),e.compile=()=>{let e=t.context.VERTEX_SHADER;if(!t.source||!t.source.length||"Unknown"===t.shaderType)return!1;if(0!==t.handle&&(t.context.deleteShader(t.handle),t.handle=0),e="Fragment"===t.shaderType?t.context.FRAGMENT_SHADER:t.context.VERTEX_SHADER,t.handle=t.context.createShader(e),t.context.shaderSource(t.handle,t.source),t.context.compileShader(t.handle),!t.context.getShaderParameter(t.handle,t.context.COMPILE_STATUS)){const e=t.context.getShaderInfoLog(t.handle);return qc(`Error compiling shader '${t.source}': ${e}`),t.context.deleteShader(t.handle),t.handle=0,!1}return!0},e.cleanup=()=>{"Unknown"!==t.shaderType&&0!==t.handle&&(t.context.deleteShader(t.handle),t.handle=0,t.dirty=!0)}}(e,t)}var Qc={newInstance:zt.newInstance(Jc,"vtkShader"),extend:Jc};const{vtkErrorMacro:Zc}=zt,ed={vertexShaderHandle:0,fragmentShaderHandle:0,geometryShaderHandle:0,vertexShader:null,fragmentShader:null,geometryShader:null,linked:!1,bound:!1,compiled:!1,error:"",handle:0,numberOfOutputs:0,attributesLocs:null,uniformLocs:null,md5Hash:0,context:null,lastCameraMTime:null};function td(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ed,r),t.attributesLocs={},t.uniformLocs={},t.vertexShader=Qc.newInstance(),t.vertexShader.setShaderType("Vertex"),t.fragmentShader=Qc.newInstance(),t.fragmentShader.setShaderType("Fragment"),t.geometryShader=Qc.newInstance(),t.geometryShader.setShaderType("Geometry"),zt.obj(e,t),zt.get(e,t,["lastCameraMTime"]),zt.setGet(e,t,["error","handle","compiled","bound","md5Hash","vertexShader","fragmentShader","geometryShader","linked"]),function(e,t){t.classHierarchy.push("vtkShaderProgram"),e.compileShader=()=>t.vertexShader.compile()?t.fragmentShader.compile()?e.attachShader(t.vertexShader)&&e.attachShader(t.fragmentShader)?e.link()?(e.setCompiled(!0),1):(Zc(`Links failed: ${t.error}`),0):(Zc(t.error),0):(Zc(t.fragmentShader.getSource().split("\n").map((e,t)=>`${t}: ${e}`).join("\n")),Zc(t.fragmentShader.getError()),0):(Zc(t.vertexShader.getSource().split("\n").map((e,t)=>`${t}: ${e}`).join("\n")),Zc(t.vertexShader.getError()),0),e.cleanup=()=>{"Unknown"!==t.shaderType&&0!==t.handle&&(e.release(),0!==t.vertexShaderHandle&&(t.context.detachShader(t.handle,t.vertexShaderHandle),t.vertexShaderHandle=0),0!==t.fragmentShaderHandle&&(t.context.detachShader(t.handle,t.fragmentShaderHandle),t.fragmentShaderHandle=0),t.context.deleteProgram(t.handle),t.handle=0,e.setCompiled(!1))},e.bind=()=>!(!t.linked&&!e.link()||(t.context.useProgram(t.handle),e.setBound(!0),0)),e.isBound=()=>!!t.bound,e.release=()=>{t.context.useProgram(null),e.setBound(!1)},e.setContext=e=>{t.vertexShader.setContext(e),t.fragmentShader.setContext(e),t.geometryShader.setContext(e)},e.link=()=>{if(t.linked)return!0;if(0===t.handle)return t.error="Program has not been initialized, and/or does not have shaders.",!1;if(t.uniformLocs={},t.context.linkProgram(t.handle),!t.context.getProgramParameter(t.handle,t.context.LINK_STATUS)){const e=t.context.getProgramInfoLog(t.handle);return Zc(`Error linking shader ${e}`),t.handle=0,!1}return e.setLinked(!0),t.attributeLocs={},!0},e.setUniformMatrix=(r,n)=>{const o=e.findUniform(r);if(-1===o)return t.error=`Could not set uniform ${r} . No such uniform.`,!1;const i=new Float32Array(n);return t.context.uniformMatrix4fv(o,!1,i),!0},e.setUniformMatrix3x3=(r,n)=>{const o=e.findUniform(r);if(-1===o)return t.error=`Could not set uniform ${r} . No such uniform.`,!1;const i=new Float32Array(n);return t.context.uniformMatrix3fv(o,!1,i),!0},e.setUniformf=(r,n)=>{const o=e.findUniform(r);return-1===o?(t.error=`Could not set uniform ${r} . No such uniform.`,!1):(t.context.uniform1f(o,n),!0)},e.setUniformfv=(r,n)=>{const o=e.findUniform(r);return-1===o?(t.error=`Could not set uniform ${r} . No such uniform.`,!1):(t.context.uniform1fv(o,n),!0)},e.setUniformi=(r,n)=>{const o=e.findUniform(r);return-1===o?(t.error=`Could not set uniform ${r} . No such uniform.`,!1):(t.context.uniform1i(o,n),!0)},e.setUniformiv=(r,n)=>{const o=e.findUniform(r);return-1===o?(t.error=`Could not set uniform ${r} . No such uniform.`,!1):(t.context.uniform1iv(o,n),!0)},e.setUniform2f=(r,n,o)=>{const i=e.findUniform(r);if(-1===i)return t.error=`Could not set uniform ${r} . No such uniform.`,!1;if(void 0===o)throw new RangeError("Invalid number of values for array");return t.context.uniform2f(i,n,o),!0},e.setUniform2fv=(r,n)=>{const o=e.findUniform(r);return-1===o?(t.error=`Could not set uniform ${r} . No such uniform.`,!1):(t.context.uniform2fv(o,n),!0)},e.setUniform2i=(r,n,o)=>{const i=e.findUniform(r);if(-1===i)return t.error=`Could not set uniform ${r} . No such uniform.`,!1;if(void 0===o)throw new RangeError("Invalid number of values for array");return t.context.uniform2i(i,n,o),!0},e.setUniform2iv=(r,n)=>{const o=e.findUniform(r);return-1===o?(t.error=`Could not set uniform ${r} . No such uniform.`,!1):(t.context.uniform2iv(o,n),!0)},e.setUniform3f=(r,n,o,i)=>{const a=e.findUniform(r);if(-1===a)return t.error=`Could not set uniform ${r} . No such uniform.`,!1;if(void 0===i)throw new RangeError("Invalid number of values for array");return t.context.uniform3f(a,n,o,i),!0},e.setUniform3fArray=(r,n)=>{const o=e.findUniform(r);if(-1===o)return t.error=`Could not set uniform ${r} . No such uniform.`,!1;if(!Array.isArray(n)||3!==n.length)throw new RangeError("Invalid number of values for array");return t.context.uniform3f(o,n[0],n[1],n[2]),!0},e.setUniform3fv=(r,n)=>{const o=e.findUniform(r);return-1===o?(t.error=`Could not set uniform ${r} . No such uniform.`,!1):(t.context.uniform3fv(o,n),!0)},e.setUniform3i=function(r){const n=e.findUniform(r);if(-1===n)return t.error=`Could not set uniform ${r} . No such uniform.`,!1;for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a{const o=e.findUniform(r);return-1===o?(t.error=`Could not set uniform ${r} . No such uniform.`,!1):(t.context.uniform3iv(o,n),!0)},e.setUniform4f=function(r){const n=e.findUniform(r);if(-1===n)return t.error=`Could not set uniform ${r} . No such uniform.`,!1;for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a{const o=e.findUniform(r);return-1===o?(t.error=`Could not set uniform ${r} . No such uniform.`,!1):(t.context.uniform4fv(o,n),!0)},e.setUniform4i=function(r){const n=e.findUniform(r);if(-1===n)return t.error=`Could not set uniform ${r} . No such uniform.`,!1;for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a{const o=e.findUniform(r);return-1===o?(t.error=`Could not set uniform ${r} . No such uniform.`,!1):(t.context.uniform4iv(o,n),!0)},e.findUniform=e=>{if(!e||!t.linked)return-1;let r=t.uniformLocs[e];return void 0!==r?r:(r=t.context.getUniformLocation(t.handle,e),null===r?(t.error=`Uniform ${e} not found in current shader program.`,t.uniformLocs[e]=-1,-1):(t.uniformLocs[e]=r,r))},e.isUniformUsed=e=>{if(!e)return!1;let r=t.uniformLocs[e];return void 0!==r?null!==r:t.linked?(r=t.context.getUniformLocation(t.handle,e),t.uniformLocs[e]=r,null!==r):(Zc("attempt to find uniform when the shader program is not linked"),!1)},e.isAttributeUsed=e=>{if(!e)return!1;if(e in t.attributeLocs)return!0;if(!t.linked)return Zc("attempt to find uniform when the shader program is not linked"),!1;const r=t.context.getAttribLocation(t.handle,e);return-1!==r&&(t.attributeLocs[e]=r,!0)},e.attachShader=r=>{if(0===r.getHandle())return t.error="Shader object was not initialized, cannot attach it.",!1;if("Unknown"===r.getShaderType())return t.error="Shader object is of type Unknown and cannot be used.",!1;if(0===t.handle){const e=t.context.createProgram();if(0===e)return t.error="Could not create shader program.",!1;t.handle=e,t.linked=!1}return"Vertex"===r.getShaderType()&&(0!==t.vertexShaderHandle&&t.context.detachShader(t.handle,t.vertexShaderHandle),t.vertexShaderHandle=r.getHandle()),"Fragment"===r.getShaderType()&&(0!==t.fragmentShaderHandle&&t.context.detachShader(t.handle,t.fragmentShaderHandle),t.fragmentShaderHandle=r.getHandle()),t.context.attachShader(t.handle,r.getHandle()),e.setLinked(!1),!0},e.detachShader=e=>{if(0===e.getHandle())return t.error="shader object was not initialized, cannot attach it.",!1;if("Unknown"===e.getShaderType())return t.error="Shader object is of type Unknown and cannot be used.",!1;switch(0===t.handle&&(t.error="This shader program has not been initialized yet."),e.getShaderType()){case"Vertex":return t.vertexShaderHandle!==e.getHandle()?(t.error="The supplied shader was not attached to this program.",!1):(t.context.detachShader(t.handle,e.getHandle()),t.vertexShaderHandle=0,t.linked=!1,!0);case"Fragment":return t.fragmentShaderHandle!==e.getHandle()?(t.error="The supplied shader was not attached to this program.",!1):(t.context.detachShader(t.handle,e.getHandle()),t.fragmentShaderHandle=0,t.linked=!1,!0);default:return!1}},e.setContext=e=>{t.context=e,t.vertexShader.setContext(e),t.fragmentShader.setContext(e),t.geometryShader.setContext(e)},e.setLastCameraMTime=e=>{t.lastCameraMTime=e}}(e,t)}var rd={newInstance:zt.newInstance(td,"vtkShaderProgram"),extend:td,substitute:function(e,t,r,n){const o="string"==typeof r?r:r.join("\n"),i=!1===n?t:new RegExp(t,"g"),a=e.replace(i,o);return{replace:a!==o,result:a}}};const nd={forceEmulation:!1,handleVAO:0,handleProgram:0,supported:!0,buffers:null,context:null};function od(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,nd,r),t.buffers=[],zt.obj(e,t),zt.get(e,t,["supported"]),zt.setGet(e,t,["forceEmulation"]),function(e,t){t.classHierarchy.push("vtkOpenGLVertexArrayObject"),e.exposedMethod=()=>{},e.initialize=()=>{t.instancingExtension=null,t._openGLRenderWindow.getWebgl2()||(t.instancingExtension=t.context.getExtension("ANGLE_instanced_arrays")),!t.forceEmulation&&t._openGLRenderWindow&&t._openGLRenderWindow.getWebgl2()?(t.extension=null,t.supported=!0,t.handleVAO=t.context.createVertexArray()):(t.extension=t.context.getExtension("OES_vertex_array_object"),!t.forceEmulation&&t.extension?(t.supported=!0,t.handleVAO=t.extension.createVertexArrayOES()):t.supported=!1)},e.isReady=()=>0!==t.handleVAO||!1===t.supported,e.bind=()=>{if(e.isReady()||e.initialize(),e.isReady()&&t.supported)t.extension?t.extension.bindVertexArrayOES(t.handleVAO):t.context.bindVertexArray(t.handleVAO);else if(e.isReady()){const e=t.context;for(let r=0;r0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(o.index+r,1):e.vertexAttribDivisor(o.index+r,1))}}}},e.release=()=>{if(e.isReady()&&t.supported)t.extension?t.extension.bindVertexArrayOES(null):t.context.bindVertexArray(null);else if(e.isReady()){const e=t.context;for(let r=0;r0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(o.index+r,0):e.vertexAttribDivisor(o.index+r,0)),e.disableVertexAttribArray(o.index+r)}}}},e.shaderProgramChanged=()=>{e.release(),t.handleVAO&&(t.extension?t.extension.deleteVertexArrayOES(t.handleVAO):t.context.deleteVertexArray(t.handleVAO)),t.handleVAO=0,t.handleProgram=0},e.releaseGraphicsResources=()=>{e.shaderProgramChanged(),t.handleVAO&&(t.extension?t.extension.deleteVertexArrayOES(t.handleVAO):t.context.deleteVertexArray(t.handleVAO)),t.handleVAO=0,t.supported=!0,t.handleProgram=0},e.addAttributeArray=(t,r,n,o,i,a,s,l)=>e.addAttributeArrayWithDivisor(t,r,n,o,i,a,s,l,0,!1),e.addAttributeArrayWithDivisor=(r,n,o,i,a,s,l,u,c,d)=>{if(!r)return!1;if(!r.isBound()||0===n.getHandle()||n.getType()!==kc.ARRAY_BUFFER)return!1;if(0===t.handleProgram&&(t.handleProgram=r.getHandle()),e.isReady()||e.initialize(),!e.isReady()||t.handleProgram!==r.getHandle())return!1;const p=t.context,f={};if(f.name=o,f.index=p.getAttribLocation(t.handleProgram,o),f.offset=i,f.stride=a,f.type=s,f.size=l,f.normalize=u,f.isMatrix=d,f.divisor=c,-1===f.Index)return!1;if(n.bind(),p.enableVertexAttribArray(f.index),p.vertexAttribPointer(f.index,f.size,f.type,f.normalize,f.stride,f.offset),c>0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(f.index,1):p.vertexAttribDivisor(f.index,1)),f.buffer=n.getHandle(),!t.supported){let e=!1;for(let r=0;r{const d=e.addAttributeArrayWithDivisor(r,n,o,i,a,s,l,u,c,!0);if(!d)return d;const p=t.context,f=p.getAttribLocation(t.handleProgram,o);for(let e=1;e0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(f+e,1):p.vertexAttribDivisor(f+e,1));return!0},e.removeAttributeArray=r=>{if(!e.isReady()||0===t.handleProgram)return!1;if(!t.supported)for(let e=0;e{t._openGLRenderWindow!==r&&(e.releaseGraphicsResources(),t._openGLRenderWindow=r,t.context=null,r&&(t.context=t._openGLRenderWindow.getContext()))}}(e,t)}var id={newInstance:zt.newInstance(od,"vtkOpenGLVertexArrayObject"),extend:od};const ad={Start:0,Points:0,Lines:1,Tris:2,TriStrips:3,TrisEdges:4,TriStripsEdges:5,End:6},sd={context:null,program:null,shaderSourceTime:null,VAO:null,attributeUpdateTime:null,CABO:null,primitiveType:0,pointPicking:!1};function ld(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,sd,r),zt.obj(e,t),t.shaderSourceTime={},zt.obj(t.shaderSourceTime),t.attributeUpdateTime={},zt.obj(t.attributeUpdateTime),zt.setGet(e,t,["program","shaderSourceTime","VAO","attributeUpdateTime","CABO","primitiveType","pointPicking"]),t.program=rd.newInstance(),t.VAO=id.newInstance(),t.CABO=$c.newInstance(),function(e,t){t.classHierarchy.push("vtkOpenGLHelper"),e.setOpenGLRenderWindow=e=>{t.context=e.getContext(),t.program.setContext(t.context),t.VAO.setOpenGLRenderWindow(e),t.CABO.setOpenGLRenderWindow(e)},e.releaseGraphicsResources=e=>{t.VAO.releaseGraphicsResources(),t.CABO.releaseGraphicsResources(),t.CABO.setElementCount(0)},e.drawArrays=(r,n,o,i)=>{if(t.CABO.getElementCount()){const a=e.getOpenGLMode(o),s=e.haveWideLines(r,n),l=t.context,u=l.getParameter(l.DEPTH_WRITEMASK);t.pointPicking&&l.depthMask(!1),a===l.LINES&&s?(e.updateShaders(r,n,i),l.drawArraysInstanced(a,0,t.CABO.getElementCount(),2*Math.ceil(n.getProperty().getLineWidth()))):(l.lineWidth(n.getProperty().getLineWidth()),e.updateShaders(r,n,i),l.drawArrays(a,0,t.CABO.getElementCount()),l.lineWidth(1));const c=(a===l.POINTS?1:0)||(a===l.LINES?2:3);return t.pointPicking&&l.depthMask(u),t.CABO.getElementCount()/c}return 0},e.getOpenGLMode=e=>{if(t.pointPicking)return t.context.POINTS;const r=t.primitiveType;return e===Ja.POINTS||r===ad.Points?t.context.POINTS:e===Ja.WIREFRAME||r===ad.Lines||r===ad.TrisEdges||r===ad.TriStripsEdges?t.context.LINES:t.context.TRIANGLES},e.haveWideLines=(e,r)=>r.getProperty().getLineWidth()>1&&!(t.CABO.getOpenGLRenderWindow()&&t.CABO.getOpenGLRenderWindow().getHardwareMaximumLineWidth()>=r.getProperty().getLineWidth()),e.getNeedToRebuildShaders=(t,r,n)=>!!(n.getNeedToRebuildShaders(e,t,r)||0===e.getProgram()||e.getShaderSourceTime().getMTime(){if(e.getNeedToRebuildShaders(r,n,o)){const i={Vertex:null,Fragment:null,Geometry:null};o.buildShaders(i,r,n);const a=t.CABO.getOpenGLRenderWindow().getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);a!==e.getProgram()&&(e.setProgram(a),e.getVAO().releaseGraphicsResources()),e.getShaderSourceTime().modified()}else t.CABO.getOpenGLRenderWindow().getShaderCache().readyShaderProgram(e.getProgram());e.getVAO().bind(),o.setMapperShaderParameters(e,r,n),o.setPropertyShaderParameters(e,r,n),o.setCameraShaderParameters(e,r,n),o.setLightingShaderParameters(e,r,n),o.invokeShaderCallbacks(e,r,n)},e.setMapperShaderParameters=(r,n,o)=>{if(e.haveWideLines(r,n)){e.getProgram().setUniform2f("viewportSize",o.usize,o.vsize);const t=parseFloat(n.getProperty().getLineWidth()),r=t/2;e.getProgram().setUniformf("lineWidthStepSize",t/Math.ceil(t)),e.getProgram().setUniformf("halfLineWidth",r)}t.primitiveType===ad.Points||n.getProperty().getRepresentation()===Ja.POINTS?e.getProgram().setUniformf("pointSize",n.getProperty().getPointSize()):t.pointPicking&&e.getProgram().setUniformf("pointSize",e.getPointPickingPrimitiveSize())},e.replaceShaderPositionVC=(r,n,o)=>{let i=r.Vertex;i=rd.substitute(i,"//VTK::PositionVC::Dec",["//VTK::PositionVC::Dec","uniform float pointSize;"]).result,i=rd.substitute(i,"//VTK::PositionVC::Impl",["//VTK::PositionVC::Impl"," gl_PointSize = pointSize;"],!1).result,e.getOpenGLMode(o.getProperty().getRepresentation())===t.context.LINES&&e.haveWideLines(n,o)&&(i=rd.substitute(i,"//VTK::PositionVC::Dec",["//VTK::PositionVC::Dec","uniform vec2 viewportSize;","uniform float lineWidthStepSize;","uniform float halfLineWidth;"]).result,i=rd.substitute(i,"//VTK::PositionVC::Impl",["//VTK::PositionVC::Impl"," if (halfLineWidth > 0.0)"," {"," float offset = float(gl_InstanceID / 2) * lineWidthStepSize - halfLineWidth;"," vec4 tmpPos = gl_Position;"," vec3 tmpPos2 = tmpPos.xyz / tmpPos.w;"," tmpPos2.x = tmpPos2.x + 2.0 * mod(float(gl_InstanceID), 2.0) * offset / viewportSize[0];"," tmpPos2.y = tmpPos2.y + 2.0 * mod(float(gl_InstanceID + 1), 2.0) * offset / viewportSize[1];"," gl_Position = vec4(tmpPos2.xyz * tmpPos.w, tmpPos.w);"," }"]).result),r.Vertex=i},e.getPointPickingPrimitiveSize=()=>t.primitiveType===ad.Points?2:t.primitiveType===ad.Lines?4:6,e.getAllocatedGPUMemoryInBytes=()=>e.getCABO().getAllocatedGPUMemoryInBytes()}(e,t)}var ud={newInstance:zt.newInstance(ld),extend:ld,primTypes:ad};const cd={NEAREST:0,LINEAR:1,NEAREST_MIPMAP_NEAREST:2,NEAREST_MIPMAP_LINEAR:3,LINEAR_MIPMAP_NEAREST:4,LINEAR_MIPMAP_LINEAR:5};var dd={Wrap:{CLAMP_TO_EDGE:0,REPEAT:1,MIRRORED_REPEAT:2},Filter:cd};const pd=new Float32Array(1),fd=new Int32Array(pd.buffer);var hd={fromHalf:function(e){const t=(32768&e)>>15,r=(31744&e)>>10,n=1023&e;return 0===r?(t?-1:1)*2**-14*(n/1024):31===r?n?NaN:1/0*(t?-1:1):(t?-1:1)*2**(r-15)*(1+n/1024)},toHalf:function(e){pd[0]=e;const t=fd[0];let r=t>>16&32768,n=t>>12&2047;const o=t>>23&255;return o<103?r:o>142?(r|=31744,r|=(255===o?0:1)&&8388607&t,r):o<113?(n|=2048,r|=(n>>114-o)+(n>>113-o&1),r):(r|=o-112<<10|n>>1,r+=1&n,r)}};let md;const{Wrap:gd,Filter:yd}=dd,{VtkDataTypes:vd}=_s,{vtkDebugMacro:bd,vtkErrorMacro:xd,vtkWarningMacro:_d,requiredParam:Sd}=jt,{toHalf:Cd}=hd;function Td(e,t){function r(){return{internalFormat:t.internalFormat,format:t.format,openGLDataType:t.openGLDataType,width:t.width,height:t.height}}t.classHierarchy.push("vtkOpenGLTexture"),e.render=function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(r?t._openGLRenderWindow=r:(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getLastAncestorOfType("vtkOpenGLRenderWindow")),t.context=t._openGLRenderWindow.getContext(),t.renderable.getInterpolate()?(t.generateMipmap?e.setMinificationFilter(yd.LINEAR_MIPMAP_LINEAR):e.setMinificationFilter(yd.LINEAR),e.setMagnificationFilter(yd.LINEAR)):(e.setMinificationFilter(yd.NEAREST),e.setMagnificationFilter(yd.NEAREST)),t.renderable.getRepeat()&&(e.setWrapR(gd.REPEAT),e.setWrapS(gd.REPEAT),e.setWrapT(gd.REPEAT)),t.renderable.getInputData()&&t.renderable.setImage(null),!t.handle||t.renderable.getMTime()>t.textureBuildTime.getMTime()){if(null!==t.renderable.getImageBitmap()&&(t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(yd.LINEAR_MIPMAP_LINEAR)),t.renderable.getImageBitmap()&&t.renderable.getImageLoaded()&&(e.create2DFromImageBitmap(t.renderable.getImageBitmap()),e.activate(),e.sendParameters(),t.textureBuildTime.modified())),null!==t.renderable.getImage()&&(t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(yd.LINEAR_MIPMAP_LINEAR)),t.renderable.getImage()&&t.renderable.getImageLoaded()&&(e.create2DFromImage(t.renderable.getImage()),e.activate(),e.sendParameters(),t.textureBuildTime.modified())),null!==t.renderable.getCanvas()){t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(yd.LINEAR_MIPMAP_LINEAR));const r=t.renderable.getCanvas();e.create2DFromRaw({width:r.width,height:r.height,numComps:4,dataType:vd.UNSIGNED_CHAR,data:r,flip:!0}),e.activate(),e.sendParameters(),t.textureBuildTime.modified()}if(null!==t.renderable.getJsImageData()){const r=t.renderable.getJsImageData();t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(yd.LINEAR_MIPMAP_LINEAR)),e.create2DFromRaw({width:r.width,height:r.height,numComps:4,dataType:vd.UNSIGNED_CHAR,data:r.data,flip:!0}),e.activate(),e.sendParameters(),t.textureBuildTime.modified()}const r=t.renderable.getInputData(0);if(r&&r.getPointData().getScalars()){const n=r.getExtent(),o=r.getPointData().getScalars(),i=[];for(let e=0;e{if(t.minificationFilter!==yd.LINEAR&&t.magnificationFilter!==yd.LINEAR||(void 0===md&&(md=function(){try{const e=4,t=2,r=1,n=new Int16Array([0,32767]),o=[1,1],i=document.createElement("canvas");i.width=e,i.height=e;const a=i.getContext("webgl2");if(!a)return!1;const s=a.getExtension("EXT_texture_norm16");if(!s)return!1;const l=`#version 300 es\n void main() {\n gl_PointSize = ${e.toFixed(1)};\n gl_Position = vec4(0, 0, 0, 1);\n }\n `,u="#version 300 es\n precision highp float;\n precision highp int;\n precision highp sampler2D;\n\n uniform sampler2D u_image;\n\n out vec4 color;\n\n void main() {\n vec4 intColor = texture(u_image, gl_PointCoord.xy);\n color = vec4(vec3(intColor.rrr), 1);\n }\n ",c=a.createShader(a.VERTEX_SHADER);if(a.shaderSource(c,l),a.compileShader(c),!a.getShaderParameter(c,a.COMPILE_STATUS))return!1;const d=a.createShader(a.FRAGMENT_SHADER);if(a.shaderSource(d,u),a.compileShader(d),!a.getShaderParameter(d,a.COMPILE_STATUS))return!1;const p=a.createProgram();if(a.attachShader(p,c),a.attachShader(p,d),a.linkProgram(p),!a.getProgramParameter(p,a.LINK_STATUS))return!1;const f=a.createTexture();a.bindTexture(a.TEXTURE_2D,f),a.texImage2D(a.TEXTURE_2D,0,s.R16_SNORM_EXT,t,r,0,a.RED,a.SHORT,n),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),a.useProgram(p),a.drawArrays(a.POINTS,0,1);const h=new Uint8Array(4);a.readPixels(o[0],o[1],1,1,a.RGBA,a.UNSIGNED_BYTE,h);const[m,g,y]=h,v=a.getExtension("WEBGL_lose_context");return v&&v.loseContext(),m===g&&g===y&&0!==m}catch(e){return!1}}()),md))return t.oglNorm16Ext};function o(e){const[t,r,n,o,i,a]=e;return[r-t+1,o-n+1,a-i+1]}function i(e){const[t,r,n]=o(e);return t*r*n}function a(e,r){const n=new((arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)||e.constructor)(r.reduce((e,t)=>e+i(t),0)),o=[t.width,t.height,t.depth];let a=0;return r.forEach(t=>{!function(e,t,r,n,o){const[i,a,s,l,u,c]=r,[d,p]=t,f=d*p;let h=o;for(let t=u;t<=c;t++){const r=t*f;for(let t=s;t<=l;t++){const o=r+t*d;for(let t=o+i,r=o+a;t<=r;t++,h++)n[h]=e[t]}}}(e,o,t,n,a),a+=i(t)}),n}function s(e){if(t._openGLRenderWindow.getWebgl2())return e;const r=[],n=t.width,o=t.height,i=t.components;if(e&&(!Eo(n)||!Eo(o))){const a=t.context.getExtension("OES_texture_half_float"),s=Ao(n),l=Ao(o),u=s*l*t.components;for(let c=0;c=o&&(u=o-1);const m=a-l,g=1-m;l=l*n*i,u=u*n*i;for(let t=0;t=n&&(p=n-1);const y=a-s;s*=i,p*=i;for(let t=0;t2048||o<-2048||o>2048)return!1}return!0}(n,o)||i;let s=!1;if(t._openGLRenderWindow.getWebgl2())s=t.openGLDataType===t.context.FLOAT&&null===t.context.getExtension("OES_texture_float_linear")&&a||t.openGLDataType===t.context.HALF_FLOAT;else{const e=t.context.getExtension("OES_texture_half_float");s=e&&t.openGLDataType===e.HALF_FLOAT_OES}t.canUseHalfFloat=s&&a}(i,u.offset,u.scale,n),e.useHalfFloat()||e.getOpenGLDataType(i,!0),{numComps:o,dataType:i,data:a,scaleOffsets:u}}e.destroyTexture=()=>{e.deactivate(),t.context&&t.handle&&t.context.deleteTexture(t.handle),t._prevTexParams=null,t.handle=0,t.numberOfDimensions=0,t.target=0,t.components=0,t.width=0,t.height=0,t.depth=0,e.resetFormatAndType()},e.createTexture=()=>{t.handle||(t.handle=t.context.createTexture(),t.target&&(t.context.bindTexture(t.target,t.handle),t.context.texParameteri(t.target,t.context.TEXTURE_MIN_FILTER,e.getOpenGLFilterMode(t.minificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_MAG_FILTER,e.getOpenGLFilterMode(t.magnificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_S,e.getOpenGLWrapMode(t.wrapS)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_T,e.getOpenGLWrapMode(t.wrapT)),t._openGLRenderWindow.getWebgl2()&&t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_R,e.getOpenGLWrapMode(t.wrapR)),t.context.bindTexture(t.target,null)))},e.getTextureUnit=()=>t._openGLRenderWindow?t._openGLRenderWindow.getTextureUnitForTexture(e):-1,e.activate=()=>{t._openGLRenderWindow.activateTexture(e),e.bind()},e.deactivate=()=>{t._openGLRenderWindow&&t._openGLRenderWindow.deactivateTexture(e)},e.releaseGraphicsResources=r=>{r&&t.handle&&(r.activateTexture(e),r.deactivateTexture(e),t.context.deleteTexture(t.handle),t._prevTexParams=null,t.handle=0,t.numberOfDimensions=0,t.target=0,t.internalFormat=0,t.format=0,t.openGLDataType=0,t.components=0,t.width=0,t.height=0,t.depth=0,t.allocatedGPUMemoryInBytes=0),t.shaderProgram&&(t.shaderProgram.releaseGraphicsResources(r),t.shaderProgram=null)},e.bind=()=>{t.context.bindTexture(t.target,t.handle),t.autoParameters&&e.getMTime()>t.sendParametersTime.getMTime()&&e.sendParameters()},e.isBound=()=>{let e=!1;if(t.context&&t.handle){let r=0;t.target===t.context.TEXTURE_2D?r=t.context.TEXTURE_BINDING_2D:_d("impossible case"),e=t.context.getIntegerv(r)===t.handle}return e},e.sendParameters=()=>{t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_S,e.getOpenGLWrapMode(t.wrapS)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_T,e.getOpenGLWrapMode(t.wrapT)),t._openGLRenderWindow.getWebgl2()&&t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_R,e.getOpenGLWrapMode(t.wrapR)),t.context.texParameteri(t.target,t.context.TEXTURE_MIN_FILTER,e.getOpenGLFilterMode(t.minificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_MAG_FILTER,e.getOpenGLFilterMode(t.magnificationFilter)),t._openGLRenderWindow.getWebgl2()&&(t.context.texParameteri(t.target,t.context.TEXTURE_BASE_LEVEL,t.baseLevel),t.context.texParameteri(t.target,t.context.TEXTURE_MAX_LEVEL,t.maxLevel)),t.sendParametersTime.modified()},e.getInternalFormat=(r,n)=>(t._forceInternalFormat||(t.internalFormat=e.getDefaultInternalFormat(r,n)),t.internalFormat||bd(`Unable to find suitable internal format for T=${r} NC= ${n}`),[t.context.R32F,t.context.RG32F,t.context.RGB32F,t.context.RGBA32F].includes(t.internalFormat)&&!t.context.getExtension("OES_texture_float_linear")&&_d("Failed to load OES_texture_float_linear. Texture filtering is not available for *32F internal formats."),t.internalFormat),e.getDefaultInternalFormat=(r,o)=>{let i=0;return i=t._openGLRenderWindow.getDefaultTextureInternalFormat(r,o,n(),e.useHalfFloat()),i||(i||(bd("Unsupported internal texture type!"),bd(`Unable to find suitable internal format for T=${r} NC= ${o}`)),i)},e.useHalfFloat=()=>t.enableUseHalfFloat&&t.canUseHalfFloat,e.setInternalFormat=r=>{t._forceInternalFormat=!0,r!==t.internalFormat&&(t.internalFormat=r,e.modified())},e.getFormat=(r,n)=>(t.format=e.getDefaultFormat(r,n),t.format),e.getDefaultFormat=(e,r)=>{if(t._openGLRenderWindow.getWebgl2())switch(r){case 1:return t.context.RED;case 2:return t.context.RG;case 3:default:return t.context.RGB;case 4:return t.context.RGBA}else switch(r){case 1:return t.context.LUMINANCE;case 2:return t.context.LUMINANCE_ALPHA;case 3:default:return t.context.RGB;case 4:return t.context.RGBA}},e.resetFormatAndType=()=>{t._prevTexParams=null,t.format=0,t.internalFormat=0,t._forceInternalFormat=!1,t.openGLDataType=0},e.getDefaultDataType=r=>{const o=e.useHalfFloat();if(t._openGLRenderWindow.getWebgl2())switch(r){case vd.UNSIGNED_CHAR:return t.context.UNSIGNED_BYTE;case n()&&!o&&vd.SHORT:return t.context.SHORT;case n()&&!o&&vd.UNSIGNED_SHORT:return t.context.UNSIGNED_SHORT;case o&&vd.SHORT:case o&&vd.UNSIGNED_SHORT:return t.context.HALF_FLOAT;case vd.FLOAT:case vd.VOID:default:return t.context.FLOAT}switch(r){case vd.UNSIGNED_CHAR:return t.context.UNSIGNED_BYTE;case vd.FLOAT:case vd.VOID:default:if(t.context.getExtension("OES_texture_float")&&t.context.getExtension("OES_texture_float_linear"))return t.context.FLOAT;{const e=t.context.getExtension("OES_texture_half_float");if(e&&t.context.getExtension("OES_texture_half_float_linear"))return e.HALF_FLOAT_OES}return t.context.UNSIGNED_BYTE}},e.getOpenGLDataType=function(r){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t.openGLDataType&&!n||(t.openGLDataType=e.getDefaultDataType(r)),t.openGLDataType},e.getShiftAndScale=()=>{let e=0,r=1;switch(t.openGLDataType){case t.context.BYTE:r=127.5,e=r-128;break;case t.context.UNSIGNED_BYTE:r=255,e=0;break;case t.context.SHORT:r=32767.5,e=r-32768;break;case t.context.UNSIGNED_SHORT:r=65536,e=0;break;case t.context.INT:r=2147483647.5,e=r-2147483648;break;case t.context.UNSIGNED_INT:r=4294967295,e=0;case t.context.FLOAT:}return{shift:e,scale:r}},e.getOpenGLFilterMode=e=>{switch(e){case yd.NEAREST:return t.context.NEAREST;case yd.LINEAR:return t.context.LINEAR;case yd.NEAREST_MIPMAP_NEAREST:return t.context.NEAREST_MIPMAP_NEAREST;case yd.NEAREST_MIPMAP_LINEAR:return t.context.NEAREST_MIPMAP_LINEAR;case yd.LINEAR_MIPMAP_NEAREST:return t.context.LINEAR_MIPMAP_NEAREST;case yd.LINEAR_MIPMAP_LINEAR:return t.context.LINEAR_MIPMAP_LINEAR;default:return t.context.NEAREST}},e.getOpenGLWrapMode=e=>{switch(e){case gd.CLAMP_TO_EDGE:return t.context.CLAMP_TO_EDGE;case gd.REPEAT:return t.context.REPEAT;case gd.MIRRORED_REPEAT:return t.context.MIRRORED_REPEAT;default:return t.context.CLAMP_TO_EDGE}},e.updateArrayDataTypeForGL=function(e,r){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];const i=[];let s=t.width*t.height*t.components;n&&(s*=t.depth);const l=!!o.length;if(e!==vd.FLOAT&&t.openGLDataType===t.context.FLOAT)for(let e=0;es?r[e].subarray(0,s):r[e];i.push(new Float32Array(t))}else i.push(null);if(e!==vd.UNSIGNED_CHAR&&t.openGLDataType===t.context.UNSIGNED_BYTE)for(let e=0;es?r[e].subarray(0,s):r[e];i.push(new Uint8Array(t))}else i.push(null);let u=!1;if(t._openGLRenderWindow.getWebgl2())u=t.openGLDataType===t.context.HALF_FLOAT;else{const e=t.context.getExtension("OES_texture_half_float");u=e&&t.openGLDataType===e.HALF_FLOAT_OES}if(u)for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:{};if(e.getOpenGLDataType(a,!0),e.getInternalFormat(a,i),e.getFormat(a,i),!t.internalFormat||!t.format||!t.openGLDataType)return xd("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=i,t.width=r,t.height=o,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind();const d=[u],p=s(e.updateArrayDataTypeForGL(a,d));return t.context.pixelStorei(t.context.UNPACK_FLIP_Y_WEBGL,c),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),l(a)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=p[0]&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,p[0])):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,p[0]),t.generateMipmap&&t.context.generateMipmap(t.target),c&&t.context.pixelStorei(t.context.UNPACK_FLIP_Y_WEBGL,!1),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*i*t._openGLRenderWindow.getDefaultTextureByteSize(a,n(),e.useHalfFloat()),e.deactivate(),!0},e.createCubeFromRaw=function(){let{width:r=Sd("width"),height:o=Sd("height"),numComps:i=Sd("numComps"),dataType:a=Sd("dataType"),data:u=Sd("data")}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e.getOpenGLDataType(a),e.getInternalFormat(a,i),e.getFormat(a,i),!t.internalFormat||!t.format||!t.openGLDataType)return xd("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_CUBE_MAP,t.components=i,t.width=r,t.height=o,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),t.maxLevel=u.length/6-1,e.createTexture(),e.bind();const c=s(e.updateArrayDataTypeForGL(a,u)),d=[];let p=t.width,f=t.height;for(let e=0;e=1&&o>=1;){let i=null;r<=t.maxLevel&&(i=d[6*r+e]),l(a)?null!=i&&t.context.texSubImage2D(t.context.TEXTURE_CUBE_MAP_POSITIVE_X+e,r,0,0,n,o,t.format,t.openGLDataType,i):t.context.texImage2D(t.context.TEXTURE_CUBE_MAP_POSITIVE_X+e,r,t.internalFormat,n,o,0,t.format,t.openGLDataType,i),r++,n/=2,o/=2}}return t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*i*t._openGLRenderWindow.getDefaultTextureByteSize(a,n(),e.useHalfFloat()),e.deactivate(),!0},e.createDepthFromRaw=function(){let{width:r=Sd("width"),height:o=Sd("height"),dataType:i=Sd("dataType"),data:a=Sd("data")}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.getOpenGLDataType(i),t.format=t.context.DEPTH_COMPONENT,t._openGLRenderWindow.getWebgl2()?i===vd.FLOAT?t.internalFormat=t.context.DEPTH_COMPONENT32F:t.internalFormat=t.context.DEPTH_COMPONENT16:t.internalFormat=t.context.DEPTH_COMPONENT,t.internalFormat&&t.format&&t.openGLDataType?(t.target=t.context.TEXTURE_2D,t.components=1,t.width=r,t.height=o,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),l(i)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),null!=a&&t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,a)):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,a),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(i,n(),e.useHalfFloat()),e.deactivate(),!0):(xd("Failed to determine texture parameters."),!1)},e.create2DFromImage=r=>{if(e.getOpenGLDataType(vd.UNSIGNED_CHAR),e.getInternalFormat(vd.UNSIGNED_CHAR,4),e.getFormat(vd.UNSIGNED_CHAR,4),!t.internalFormat||!t.format||!t.openGLDataType)return xd("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=4,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind();const o=!(t._openGLRenderWindow.getWebgl2()||Eo(r.width)&&Eo(r.height));let i=r,a=r.width,s=r.height,u=!0;const c=window.chrome;if(o||c){const e=new OffscreenCanvas(Ao(r.width),Ao(r.height));a=e.width,s=e.height;const t=e.getContext("2d");t.translate(0,e.height),t.scale(1,-1),t.drawImage(r,0,0,r.width,r.height,0,0,e.width,e.height),i=e,u=!1}return t.width=a,t.height=s,t.context.pixelStorei(t.context.UNPACK_FLIP_Y_WEBGL,u),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),l(vd.UNSIGNED_CHAR)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,i)):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,i),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(vd.UNSIGNED_CHAR,n(),e.useHalfFloat()),e.deactivate(),!0},e.create2DFromImageBitmap=r=>(e.getOpenGLDataType(vd.UNSIGNED_CHAR),e.getInternalFormat(vd.UNSIGNED_CHAR,4),e.getFormat(vd.UNSIGNED_CHAR,4),t.internalFormat&&t.format&&t.openGLDataType?(t.target=t.context.TEXTURE_2D,t.components=4,t.depth=1,t.numberOfDimensions=2,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),t.width=r.width,t.height=r.height,l(vd.UNSIGNED_CHAR)?(t.context.texStorage2D(t.target,1,t.internalFormat,t.width,t.height),t.context.texSubImage2D(t.target,0,0,0,t.width,t.height,t.format,t.openGLDataType,r)):t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,r),t.generateMipmap&&t.context.generateMipmap(t.target),t.allocatedGPUMemoryInBytes=t.width*t.height*t.depth*t.components*t._openGLRenderWindow.getDefaultTextureByteSize(vd.UNSIGNED_CHAR,n(),e.useHalfFloat()),e.deactivate(),!0):(xd("Failed to determine texture parameters."),!1)),e.create2DFilterableFromRaw=function(){let{width:t=Sd("width"),height:r=Sd("height"),numComps:n=Sd("numComps"),dataType:o=Sd("dataType"),data:i=Sd("data"),preferSizeOverAccuracy:a=!1,ranges:s}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.create2DFilterableFromDataArray({width:t,height:r,dataArray:_s.newInstance({numberOfComponents:n,dataType:o,values:i,ranges:s}),preferSizeOverAccuracy:a})},e.create2DFilterableFromDataArray=function(){let{width:t=Sd("width"),height:r=Sd("height"),dataArray:n=Sd("dataArray"),preferSizeOverAccuracy:o=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{numComps:i,dataType:a,data:s}=u(n,o);e.create2DFromRaw({width:t,height:r,numComps:i,dataType:a,data:s})},e.updateVolumeInfoForGL=(r,o)=>{let i=!1;const a=e.useHalfFloat();t.volumeInfo?.scale&&t.volumeInfo?.offset||(t.volumeInfo={scale:new Array(o),offset:new Array(o)});for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:{},m=p,g=f;if(!e.updateVolumeInfoForGL(m,d)&&g){const e=a*u*c,r=structuredClone(t.volumeInfo),n=new Float32Array(e*d);t.volumeInfo.offset=r.offset,t.volumeInfo.scale=r.scale;let o=0;const i=r.scale.map(e=>1/e);for(let t=0;t0,v=!y||!ke(t._prevTexParams,r()),b=[g],x=s(e.updateArrayDataTypeForGL(m,b,!0,v?[]:h));if(t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),v)l(m)?(t.context.texStorage3D(t.target,1,t.internalFormat,t.width,t.height,t.depth),null!=x[0]&&t.context.texSubImage3D(t.target,0,0,0,0,t.width,t.height,t.depth,t.format,t.openGLDataType,x[0])):t.context.texImage3D(t.target,0,t.internalFormat,t.width,t.height,t.depth,0,t.format,t.openGLDataType,x[0]),t._prevTexParams=r();else if(y){const e=x[0];let r=0;for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:{};return e.create3DFilterableFromDataArray({width:t,height:r,depth:n,dataArray:_s.newInstance({numberOfComponents:o,dataType:i,values:a,ranges:l}),preferSizeOverAccuracy:s,updatedExtents:u})},e.create3DFilterableFromDataArray=function(){let{width:r=Sd("width"),height:n=Sd("height"),depth:o=Sd("depth"),dataArray:i=Sd("dataArray"),preferSizeOverAccuracy:a=!1,updatedExtents:s=[]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{numComps:c,dataType:d,data:p,scaleOffsets:f}=u(i,a),h=[],m=[];for(let e=0;e{e[t]=r},b=vd.UNSIGNED_CHAR;if(d===vd.UNSIGNED_CHAR)for(let e=0;e{e[t]=(r-n)/o}):(b=vd.UNSIGNED_CHAR,v=(e,t,r,n,o)=>{e[t]=255*(r-n)/o});if(e.getOpenGLDataType(b),e.getInternalFormat(b,c),e.getFormat(b,c),!t.internalFormat||!t.format||!t.openGLDataType)return xd("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=c,t.depth=1,t.numberOfDimensions=2;let x=t.context.getParameter(t.context.MAX_TEXTURE_SIZE);x>4096&&(b===vd.FLOAT||c>=3)&&(x=4096);let _=1,S=1;g>x*x&&(_=Math.ceil(Math.sqrt(g/(x*x))),S=_);let C=Math.sqrt(g)/_;C=Ao(C);const T=Math.floor(C*_/r),w=Math.ceil(o/T),A=Ao(n*w/S);let E;t.width=C,t.height=A,t._openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.volumeInfo.xreps=T,t.volumeInfo.yreps=w,t.volumeInfo.xstride=_,t.volumeInfo.ystride=S,t.volumeInfo.offset=y.offset,t.volumeInfo.scale=y.scale;const D=C*A*c;E=b===vd.FLOAT?new Float32Array(D):new Uint8Array(D);let P=0;const I=Math.floor(r/_),O=Math.floor(n/S);for(let e=0;e{t._openGLRenderWindow!==r&&(e.releaseGraphicsResources(),t._openGLRenderWindow=r,t.context=null,r&&(t.context=t._openGLRenderWindow.getContext()))},e.getMaximumTextureSize=e=>e&&e.isCurrent()?e.getIntegerv(e.MAX_TEXTURE_SIZE):-1,e.enableUseHalfFloat=e=>{t.enableUseHalfFloat=e}}const wd={_openGLRenderWindow:null,_forceInternalFormat:!1,_prevTexParams:null,context:null,handle:0,sendParametersTime:null,textureBuildTime:null,numberOfDimensions:0,target:0,format:0,openGLDataType:0,components:0,width:0,height:0,depth:0,autoParameters:!0,wrapS:gd.CLAMP_TO_EDGE,wrapT:gd.CLAMP_TO_EDGE,wrapR:gd.CLAMP_TO_EDGE,minificationFilter:yd.NEAREST,magnificationFilter:yd.NEAREST,minLOD:-1e3,maxLOD:1e3,baseLevel:0,maxLevel:1e3,generateMipmap:!1,oglNorm16Ext:null,allocatedGPUMemoryInBytes:0,enableUseHalfFloat:!0,canUseHalfFloat:!1};function Ad(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,wd,r),Xt.extend(e,t,r),t.sendParametersTime={},mt(t.sendParametersTime,{mtime:0}),t.textureBuildTime={},mt(t.textureBuildTime,{mtime:0}),xt(e,t,["format","openGLDataType"]),_t(e,t,["keyMatrixTime","minificationFilter","magnificationFilter","wrapS","wrapT","wrapR","generateMipmap","oglNorm16Ext"]),yt(e,t,["width","height","volumeInfo","components","handle","target","allocatedGPUMemoryInBytes"]),wt(0,t,["openGLRenderWindow"]),Td(e,t)}const Ed=Pt(Ad,"vtkOpenGLTexture");var Dd={newInstance:Ed,extend:Ad,...dd};Qt("vtkTexture",Ed);var Pd=function(e,t){e.replaceShaderCoincidentOffset=(r,n,o)=>{const i=e.getCoincidentParameters(n,o);if(i&&(0!==i.factor||0!==i.offset)){let e=r.Fragment;e=rd.substitute(e,"//VTK::Coincident::Dec",["uniform float cfactor;","uniform float coffset;"]).result,t.context.getExtension("EXT_frag_depth")&&(0!==i.factor?(e=rd.substitute(e,"//VTK::UniformFlow::Impl",["float cscale = length(vec2(dFdx(gl_FragCoord.z),dFdy(gl_FragCoord.z)));","//VTK::UniformFlow::Impl"],!1).result,e=rd.substitute(e,"//VTK::Depth::Impl","gl_FragDepthEXT = gl_FragCoord.z + cfactor*cscale + 0.000016*coffset;").result):e=rd.substitute(e,"//VTK::Depth::Impl","gl_FragDepthEXT = gl_FragCoord.z + 0.000016*coffset;").result),t._openGLRenderWindow.getWebgl2()&&(0!==i.factor?(e=rd.substitute(e,"//VTK::UniformFlow::Impl",["float cscale = length(vec2(dFdx(gl_FragCoord.z),dFdy(gl_FragCoord.z)));","//VTK::UniformFlow::Impl"],!1).result,e=rd.substitute(e,"//VTK::Depth::Impl","gl_FragDepth = gl_FragCoord.z + cfactor*cscale + 0.000016*coffset;").result):e=rd.substitute(e,"//VTK::Depth::Impl","gl_FragDepth = gl_FragCoord.z + 0.000016*coffset;").result),r.Fragment=e}}},Id=function(e,t){e.applyShaderReplacements=(e,t,r)=>{let n=null;if(t&&(n=t.ShaderReplacements),n)for(let t=0;t{e.getReplacedShaderTemplate(r,n,o),t.lastRenderPassShaderReplacement=t.currentRenderPass?t.currentRenderPass.getShaderReplacement():null,t.lastRenderPassShaderReplacement&&t.lastRenderPassShaderReplacement(r);const i=t.renderable.getViewSpecificProperties().OpenGL;e.applyShaderReplacements(r,i,!0),e.replaceShaderValues(r,n,o),e.applyShaderReplacements(r,i)},e.getReplacedShaderTemplate=(r,n,o)=>{const i=t.renderable.getViewSpecificProperties().OpenGL;e.getShaderTemplate(r,n,o);let a=r.Vertex;if(i){const e=i.VertexShaderCode;void 0!==e&&""!==e&&(a=e)}r.Vertex=a;let s=r.Fragment;if(i){const e=i.FragmentShaderCode;void 0!==e&&""!==e&&(s=e)}r.Fragment=s;let l=r.Geometry;if(i){const e=i.GeometryShaderCode;void 0!==e&&(l=e)}r.Geometry=l}};const{FieldAssociations:Od}=Gs,{primTypes:Nd}=ud,{Representation:Md,Shading:Rd}=os,{ScalarMode:Fd}=Gl,{Filter:Bd,Wrap:Ld}=Dd,{vtkErrorMacro:kd}=jt,Ud={type:"StartEvent"},Vd={type:"EndEvent"},{CoordinateSystem:Gd}=Ka;const zd={context:null,VBOBuildTime:0,VBOBuildString:null,primitives:null,primTypes:null,shaderRebuildString:null,tmpMat4:null,ambientColor:[],diffuseColor:[],specularColor:[],lightColor:[],lightDirection:[],lastHaveSeenDepthRequest:!1,haveSeenDepthRequest:!1,lastSelectionState:Tl.MIN_KNOWN_PASS-1,selectionStateChanged:null,selectionWebGLIdsToVTKIds:null,pointPicking:!1};const jd=Pt(function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,zd,r),Xt.extend(e,t,r),Pd(e,t,r),Id(e,t,r),t.primitives=[],t.primTypes=Nd,t.tmpMat3=pe(new Float64Array(9)),t.tmpMat4=h(new Float64Array(16));for(let e=Nd.Start;e0===n?r?t.copy(e,r):t.identity(e):r?t.multiply(e,e,r):e,r)}t.classHierarchy.push("vtkOpenGLPolyDataMapper"),e.buildPass=r=>{r&&(t.currentRenderPass=null,t.openGLActor=e.getFirstAncestorOfType("vtkOpenGLActor"),t._openGLRenderer=t.openGLActor.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getLastAncestorOfType("vtkOpenGLRenderWindow"),t.openGLCamera=t._openGLRenderer.getViewNodeFor(t._openGLRenderer.getRenderable().getActiveCamera(),t.openGLCamera))},e.translucentPass=(r,n)=>{r&&(t.currentRenderPass=n,e.render())},e.zBufferPass=r=>{r&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.opaqueZBufferPass=t=>e.zBufferPass(t),e.opaquePass=t=>{t&&e.render()},e.render=()=>{const r=t._openGLRenderWindow.getContext();if(t.context!==r){t.context=r;for(let e=Nd.Start;e{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\nattribute vec4 vertexMC;\n\n// frag position in VC\n//VTK::PositionVC::Dec\n\n// optional normal declaration\n//VTK::Normal::Dec\n\n// extra lighting parameters\n//VTK::Light::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// material property values\n//VTK::Color::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\n// picking support\n//VTK::Picking::Dec\n\nvoid main()\n{\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Clip::Impl\n\n //VTK::PrimID::Impl\n\n //VTK::PositionVC::Impl\n\n //VTK::Light::Impl\n\n //VTK::Picking::Impl\n}\n",e.Fragment="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the polydata mappers fragment shader\n\nuniform int PrimitiveIDOffset;\n\n// VC position of this fragment\n//VTK::PositionVC::Dec\n\n// optional color passed in from the vertex shader, vertexColor\n//VTK::Color::Dec\n\n// optional surface normal declaration\n//VTK::Normal::Dec\n\n// extra lighting parameters\n//VTK::Light::Dec\n\n// define vtkImageLabelOutlineOn\n//VTK::ImageLabelOutlineOn\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// Depth Peeling Support\n//VTK::DepthPeeling::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// label outline \n//VTK::LabelOutline::Dec\n\n// the output of this shader\n//VTK::Output::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\n// handle coincident offsets\n//VTK::Coincident::Dec\n\n//VTK::ZBuffer::Dec\n\n//VTK::LabelOutlineHelperFunction\n\nvoid main()\n{\n // VC position of this fragment. This should not branch/return/discard.\n //VTK::PositionVC::Impl\n\n // Place any calls that require uniform flow (e.g. dFdx) here.\n //VTK::UniformFlow::Impl\n\n // Set gl_FragDepth here (gl_FragCoord.z by default)\n //VTK::Depth::Impl\n\n // Early depth peeling abort:\n //VTK::DepthPeeling::PreColor\n\n // Apple Bug\n //VTK::PrimID::Impl\n\n //VTK::Clip::Impl\n\n //VTK::Color::Impl\n\n // Generate the normal if we are not passed in one\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Light::Impl\n\n if (gl_FragData[0].a <= 0.0)\n {\n discard;\n }\n\n //VTK::DepthPeeling::Impl\n\n //VTK::Picking::Impl\n\n // handle coincident offsets\n //VTK::Coincident::Impl\n\n //VTK::ZBuffer::Impl\n\n //VTK::RenderPassFragmentShader::Impl\n}\n",e.Geometry=""},e.replaceShaderColor=(e,r,n)=>{let o=e.Vertex,i=e.Geometry,a=e.Fragment;const s=t.lastBoundBO.getReferenceByName("lastLightComplexity");let l=["uniform float ambient;","uniform float diffuse;","uniform float specular;","uniform float opacityUniform; // the fragment opacity","uniform vec3 ambientColorUniform;","uniform vec3 diffuseColorUniform;"];s&&(l=l.concat(["uniform vec3 specularColorUniform;","uniform float specularPowerUniform;"]));let u=["vec3 ambientColor;"," vec3 diffuseColor;"," float opacity;"];s&&(u=u.concat([" vec3 specularColor;"," float specularPower;"])),u=u.concat([" ambientColor = ambientColorUniform;"," diffuseColor = diffuseColorUniform;"," opacity = opacityUniform;"]),s&&(u=u.concat([" specularColor = specularColorUniform;"," specularPower = specularPowerUniform;"])),0===t.lastBoundBO.getCABO().getColorComponents()||t.drawingEdges||(l=l.concat(["varying vec4 vertexColorVSOutput;"]),o=rd.substitute(o,"//VTK::Color::Dec",["attribute vec4 scalarColor;","varying vec4 vertexColorVSOutput;"]).result,o=rd.substitute(o,"//VTK::Color::Impl",["vertexColorVSOutput = scalarColor;"]).result,i=rd.substitute(i,"//VTK::Color::Dec",["in vec4 vertexColorVSOutput[];","out vec4 vertexColorGSOutput;"]).result,i=rd.substitute(i,"//VTK::Color::Impl",["vertexColorGSOutput = vertexColorVSOutput[i];"]).result),0===t.lastBoundBO.getCABO().getColorComponents()||t.drawingEdges?(t.renderable.getAreScalarsMappedFromCells()||t.renderable.getInterpolateScalarsBeforeMapping())&&t.renderable.getColorCoordinates()&&!t.drawingEdges?a=rd.substitute(a,"//VTK::Color::Impl",u.concat([" vec4 texColor = texture2D(texture1, tcoordVCVSOutput.st);"," diffuseColor = texColor.rgb;"," ambientColor = texColor.rgb;"," opacity = opacity*texColor.a;"])).result:(n.getBackfaceProperty()&&!t.drawingEdges&&(l=l.concat(["uniform float opacityUniformBF; // the fragment opacity","uniform float ambientIntensityBF; // the material ambient","uniform float diffuseIntensityBF; // the material diffuse","uniform vec3 ambientColorUniformBF; // ambient material color","uniform vec3 diffuseColorUniformBF; // diffuse material color"]),s?(l=l.concat(["uniform float specularIntensityBF; // the material specular intensity","uniform vec3 specularColorUniformBF; // intensity weighted color","uniform float specularPowerUniformBF;"]),u=u.concat(["if (gl_FrontFacing == false) {"," ambientColor = ambientIntensityBF * ambientColorUniformBF;"," diffuseColor = diffuseIntensityBF * diffuseColorUniformBF;"," specularColor = specularIntensityBF * specularColorUniformBF;"," specularPower = specularPowerUniformBF;"," opacity = opacityUniformBF; }"])):u=u.concat(["if (gl_FrontFacing == false) {"," ambientColor = ambientIntensityBF * ambientColorUniformBF;"," diffuseColor = diffuseIntensityBF * diffuseColorUniformBF;"," opacity = opacityUniformBF; }"])),t.haveCellScalars&&!t.drawingEdges&&(l=l.concat(["uniform samplerBuffer texture1;"])),a=rd.substitute(a,"//VTK::Color::Impl",u).result):a=rd.substitute(a,"//VTK::Color::Impl",u.concat([" diffuseColor = vertexColorVSOutput.rgb;"," ambientColor = vertexColorVSOutput.rgb;"," opacity = opacity*vertexColorVSOutput.a;"])).result,a=rd.substitute(a,"//VTK::Color::Dec",l).result,e.Vertex=o,e.Geometry=i,e.Fragment=a},e.replaceShaderLight=(e,r,n)=>{let o=e.Fragment;const i=t.lastBoundBO.getReferenceByName("lastLightComplexity"),a=t.lastBoundBO.getReferenceByName("lastLightCount");let s=[];switch(i){case 0:o=rd.substitute(o,"//VTK::Light::Impl",[" gl_FragData[0] = vec4(ambientColor * ambient + diffuseColor * diffuse, opacity);"," //VTK::Light::Impl"],!1).result;break;case 1:o=rd.substitute(o,"//VTK::Light::Impl",[" float df = max(0.0, normalVCVSOutput.z);"," float sf = pow(df, specularPower);"," vec3 diffuseL = df * diffuseColor;"," vec3 specularL = sf * specularColor;"," gl_FragData[0] = vec4(ambientColor * ambient + diffuseL * diffuse + specularL * specular, opacity);"," //VTK::Light::Impl"],!1).result;break;case 2:for(let e=0;e= cos(radians(lightConeAngle${e})))`," {",` attenuation = attenuation * pow(coneDot, lightExponent${e});`," }"," else"," {"," attenuation = 0.0;"," }"," }"," }"," df = max(0.0, attenuation*dot(normalVCVSOutput, -vertLightDirectionVC));",` diffuseL += ((df) * lightColor${e});`," if (dot(normalVCVSOutput, vertLightDirectionVC) < 0.0)"," {",` float sf = sign(df)*attenuation*pow(max(1e-5,\n dot(reflect(lightDirectionVC${e},\n normalVCVSOutput),\n normalize(-vertexVC.xyz))),\n specularPower);`,` specularL += ((sf) * lightColor${e});`," }"]);s=s.concat([" diffuseL = diffuseL * diffuseColor;"," specularL = specularL * specularColor;"," gl_FragData[0] = vec4(ambientColor * ambient + diffuseL * diffuse + specularL * specular, opacity);"," //VTK::Light::Impl"]),o=rd.substitute(o,"//VTK::Light::Impl",s,!1).result;break;default:kd("bad light complexity")}e.Fragment=o},e.replaceShaderNormal=(e,r,n)=>{if(t.lastBoundBO.getReferenceByName("lastLightComplexity")>0){let r=e.Vertex,o=e.Geometry,i=e.Fragment;t.lastBoundBO.getCABO().getNormalOffset()?(r=rd.substitute(r,"//VTK::Normal::Dec",["attribute vec3 normalMC;","uniform mat3 normalMatrix;","varying vec3 normalVCVSOutput;"]).result,r=rd.substitute(r,"//VTK::Normal::Impl",["normalVCVSOutput = normalMatrix * normalMC;"]).result,o=rd.substitute(o,"//VTK::Normal::Dec",["in vec3 normalVCVSOutput[];","out vec3 normalVCGSOutput;"]).result,o=rd.substitute(o,"//VTK::Normal::Impl",["normalVCGSOutput = normalVCVSOutput[i];"]).result,i=rd.substitute(i,"//VTK::Normal::Dec",["varying vec3 normalVCVSOutput;"]).result,i=rd.substitute(i,"//VTK::Normal::Impl",["vec3 normalVCVSOutput = normalize(normalVCVSOutput);"," if (gl_FrontFacing == false) { normalVCVSOutput = -normalVCVSOutput; }"]).result):t.haveCellNormals?(i=rd.substitute(i,"//VTK::Normal::Dec",["uniform mat3 normalMatrix;","uniform samplerBuffer textureN;"]).result,i=rd.substitute(i,"//VTK::Normal::Impl",["vec3 normalVCVSOutput = normalize(normalMatrix *"," texelFetchBuffer(textureN, gl_PrimitiveID + PrimitiveIDOffset).xyz);"," if (gl_FrontFacing == false) { normalVCVSOutput = -normalVCVSOutput; }"]).result):t.lastBoundBO.getOpenGLMode(n.getProperty().getRepresentation())===t.context.LINES?(i=rd.substitute(i,"//VTK::UniformFlow::Impl",[" vec3 fdx = dFdx(vertexVC.xyz);"," vec3 fdy = dFdy(vertexVC.xyz);"," //VTK::UniformFlow::Impl"]).result,i=rd.substitute(i,"//VTK::Normal::Impl",["vec3 normalVCVSOutput;"," if (abs(fdx.x) > 0.0)"," { fdx = normalize(fdx); normalVCVSOutput = normalize(cross(vec3(fdx.y, -fdx.x, 0.0), fdx)); }"," else { fdy = normalize(fdy); normalVCVSOutput = normalize(cross(vec3(fdy.y, -fdy.x, 0.0), fdy));}"]).result):(i=rd.substitute(i,"//VTK::Normal::Dec",["uniform int cameraParallel;"]).result,i=rd.substitute(i,"//VTK::UniformFlow::Impl",[" vec3 fdx = dFdx(vertexVC.xyz);"," vec3 fdy = dFdy(vertexVC.xyz);"," //VTK::UniformFlow::Impl"]).result,i=rd.substitute(i,"//VTK::Normal::Impl",[" fdx = normalize(fdx);"," fdy = normalize(fdy);"," vec3 normalVCVSOutput = normalize(cross(fdx,fdy));"," if (cameraParallel == 1 && normalVCVSOutput.z < 0.0) { normalVCVSOutput = -1.0*normalVCVSOutput; }"," if (cameraParallel == 0 && dot(normalVCVSOutput,vertexVC.xyz) > 0.0) { normalVCVSOutput = -1.0*normalVCVSOutput; }"]).result),e.Vertex=r,e.Geometry=o,e.Fragment=i}},e.replaceShaderPositionVC=(e,r,n)=>{t.lastBoundBO.replaceShaderPositionVC(e,r,n);let o=e.Vertex,i=e.Geometry,a=e.Fragment;t.lastBoundBO.getReferenceByName("lastLightComplexity")>0?(o=rd.substitute(o,"//VTK::PositionVC::Dec",["varying vec4 vertexVCVSOutput;"]).result,o=rd.substitute(o,"//VTK::PositionVC::Impl",["vertexVCVSOutput = MCVCMatrix * vertexMC;"," gl_Position = MCPCMatrix * vertexMC;"]).result,o=rd.substitute(o,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;","uniform mat4 MCVCMatrix;"]).result,i=rd.substitute(i,"//VTK::PositionVC::Dec",["in vec4 vertexVCVSOutput[];","out vec4 vertexVCGSOutput;"]).result,i=rd.substitute(i,"//VTK::PositionVC::Impl",["vertexVCGSOutput = vertexVCVSOutput[i];"]).result,a=rd.substitute(a,"//VTK::PositionVC::Dec",["varying vec4 vertexVCVSOutput;"]).result,a=rd.substitute(a,"//VTK::PositionVC::Impl",["vec4 vertexVC = vertexVCVSOutput;"]).result):(o=rd.substitute(o,"//VTK::Camera::Dec",["uniform mat4 MCPCMatrix;"]).result,o=rd.substitute(o,"//VTK::PositionVC::Impl",[" gl_Position = MCPCMatrix * vertexMC;"]).result),e.Vertex=o,e.Geometry=i,e.Fragment=a},e.replaceShaderTCoord=(e,r,n)=>{if(t.lastBoundBO.getCABO().getTCoordOffset()){let r=e.Vertex,n=e.Geometry,o=e.Fragment;if(t.drawingEdges)return;r=rd.substitute(r,"//VTK::TCoord::Impl","tcoordVCVSOutput = tcoordMC;").result;const i=t.openGLActor.getActiveTextures();let a=2,s=2;if(i&&i.length>0&&(a=i[0].getComponents(),i[0].getTarget()===t.context.TEXTURE_CUBE_MAP&&(s=3)),t.renderable.getColorTextureMap()&&(a=t.renderable.getColorTextureMap().getPointData().getScalars().getNumberOfComponents(),s=2),2===s){if(r=rd.substitute(r,"//VTK::TCoord::Dec","attribute vec2 tcoordMC; varying vec2 tcoordVCVSOutput;").result,n=rd.substitute(n,"//VTK::TCoord::Dec",["in vec2 tcoordVCVSOutput[];","out vec2 tcoordVCGSOutput;"]).result,n=rd.substitute(n,"//VTK::TCoord::Impl","tcoordVCGSOutput = tcoordVCVSOutput[i];").result,o=rd.substitute(o,"//VTK::TCoord::Dec",["varying vec2 tcoordVCVSOutput;","uniform sampler2D texture1;"]).result,i&&i.length>=1)switch(a){case 1:o=rd.substitute(o,"//VTK::TCoord::Impl",[" vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);"," ambientColor = ambientColor*tcolor.r;"," diffuseColor = diffuseColor*tcolor.r;"]).result;break;case 2:o=rd.substitute(o,"//VTK::TCoord::Impl",[" vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);"," ambientColor = ambientColor*tcolor.r;"," diffuseColor = diffuseColor*tcolor.r;"," opacity = opacity * tcolor.g;"]).result;break;default:o=rd.substitute(o,"//VTK::TCoord::Impl",[" vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);"," ambientColor = ambientColor*tcolor.rgb;"," diffuseColor = diffuseColor*tcolor.rgb;"," opacity = opacity * tcolor.a;"]).result}}else switch(r=rd.substitute(r,"//VTK::TCoord::Dec","attribute vec3 tcoordMC; varying vec3 tcoordVCVSOutput;").result,n=rd.substitute(n,"//VTK::TCoord::Dec",["in vec3 tcoordVCVSOutput[];","out vec3 tcoordVCGSOutput;"]).result,n=rd.substitute(n,"//VTK::TCoord::Impl","tcoordVCGSOutput = tcoordVCVSOutput[i];").result,o=rd.substitute(o,"//VTK::TCoord::Dec",["varying vec3 tcoordVCVSOutput;","uniform samplerCube texture1;"]).result,a){case 1:o=rd.substitute(o,"//VTK::TCoord::Impl",[" vec4 tcolor = textureCube(texture1, tcoordVCVSOutput);"," ambientColor = ambientColor*tcolor.r;"," diffuseColor = diffuseColor*tcolor.r;"]).result;break;case 2:o=rd.substitute(o,"//VTK::TCoord::Impl",[" vec4 tcolor = textureCube(texture1, tcoordVCVSOutput);"," ambientColor = ambientColor*tcolor.r;"," diffuseColor = diffuseColor*tcolor.r;"," opacity = opacity * tcolor.g;"]).result;break;default:o=rd.substitute(o,"//VTK::TCoord::Impl",[" vec4 tcolor = textureCube(texture1, tcoordVCVSOutput);"," ambientColor = ambientColor*tcolor.rgb;"," diffuseColor = diffuseColor*tcolor.rgb;"," opacity = opacity * tcolor.a;"]).result}e.Vertex=r,e.Geometry=n,e.Fragment=o}},e.replaceShaderClip=(e,r,n)=>{let o=e.Vertex,i=e.Fragment;if(t.renderable.getNumberOfClippingPlanes()){const e=t.renderable.getNumberOfClippingPlanes();o=rd.substitute(o,"//VTK::Clip::Dec",["uniform int numClipPlanes;",`uniform vec4 clipPlanes[${e}];`,`varying float clipDistancesVSOutput[${e}];`]).result,o=rd.substitute(o,"//VTK::Clip::Impl",[`for (int planeNum = 0; planeNum < ${e}; planeNum++)`," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);"," }"]).result,i=rd.substitute(i,"//VTK::Clip::Dec",["uniform int numClipPlanes;",`varying float clipDistancesVSOutput[${e}];`]).result,i=rd.substitute(i,"//VTK::Clip::Impl",[`for (int planeNum = 0; planeNum < ${e}; planeNum++)`," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," if (clipDistancesVSOutput[planeNum] < 0.0) discard;"," }"]).result}e.Vertex=o,e.Fragment=i},e.getCoincidentParameters=(e,r)=>{let n={factor:0,offset:0};const o=r.getProperty();if(t.renderable.getResolveCoincidentTopology()==hl.PolygonOffset||o.getEdgeVisibility()&&o.getRepresentation()===Md.SURFACE){const e=t.lastBoundBO.getPrimitiveType();e===Nd.Points||o.getRepresentation()===Md.POINTS?n=t.renderable.getCoincidentTopologyPointOffsetParameter():e===Nd.Lines||o.getRepresentation()===Md.WIREFRAME?n=t.renderable.getCoincidentTopologyLineOffsetParameters():e!==Nd.Tris&&e!==Nd.TriStrips||(n=t.renderable.getCoincidentTopologyPolygonOffsetParameters()),e!==Nd.TrisEdges&&e!==Nd.TriStripsEdges||(n=t.renderable.getCoincidentTopologyPolygonOffsetParameters(),n.factor/=2,n.offset/=2)}const i=t._openGLRenderer.getSelector();return i&&i.getFieldAssociation()===Od.FIELD_ASSOCIATION_POINTS&&(n.offset-=2),n},e.replaceShaderPicking=(e,r,n)=>{let o=e.Fragment,i=e.Vertex;if(o=rd.substitute(o,"//VTK::Picking::Dec",["uniform int picking;","//VTK::Picking::Dec"]).result,t._openGLRenderer.getSelector()){switch(t.lastSelectionState!==Tl.ID_LOW24&&t.lastSelectionState!==Tl.ID_HIGH24||(i=rd.substitute(i,"//VTK::Picking::Dec",["flat out int vertexIDVSOutput;\n","uniform int VertexIDOffset;\n"]).result,i=rd.substitute(i,"//VTK::Picking::Impl"," vertexIDVSOutput = gl_VertexID + VertexIDOffset;\n").result,o=rd.substitute(o,"//VTK::Picking::Dec","flat in int vertexIDVSOutput;\n").result,o=rd.substitute(o,"//VTK::Picking::Impl",[" int idx = vertexIDVSOutput;","//VTK::Picking::Impl"]).result),t.lastSelectionState){case Tl.ID_LOW24:o=rd.substitute(o,"//VTK::Picking::Impl"," gl_FragData[0] = vec4(float(idx%256)/255.0, float((idx/256)%256)/255.0, float((idx/65536)%256)/255.0, 1.0);").result;break;case Tl.ID_HIGH24:o=rd.substitute(o,"//VTK::Picking::Impl"," gl_FragData[0] = vec4(float((idx/16777216)%256)/255.0, 0.0, 0.0, 1.0);").result;break;default:o=rd.substitute(o,"//VTK::Picking::Dec","uniform vec3 mapperIndex;").result,o=rd.substitute(o,"//VTK::Picking::Impl"," gl_FragData[0] = picking != 0 ? vec4(mapperIndex,1.0) : gl_FragData[0];").result}e.Fragment=o,e.Vertex=i}},e.replaceShaderValues=(r,n,o)=>{if(e.replaceShaderColor(r,n,o),e.replaceShaderNormal(r,n,o),e.replaceShaderLight(r,n,o),e.replaceShaderTCoord(r,n,o),e.replaceShaderPicking(r,n,o),e.replaceShaderClip(r,n,o),e.replaceShaderCoincidentOffset(r,n,o),e.replaceShaderPositionVC(r,n,o),t.haveSeenDepthRequest){let e=r.Fragment;e=rd.substitute(e,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,e=rd.substitute(e,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result,r.Fragment=e}},e.getNeedToRebuildShaders=(e,r,n)=>{let o=0,i=0;const a=e.getPrimitiveType(),s=t.currentInput;let l=!1;const u=s.getPointData().getNormals(),c=s.getCellData().getNormals(),d=n.getProperty().getInterpolation()===Rd.FLAT,p=n.getProperty().getRepresentation(),f=e.getOpenGLMode(p,a);if(f===t.context.TRIANGLES||c&&!u||!d&&u?l=!0:d||f!==t.context.LINES||(l=!0),n.getProperty().getLighting()&&l){o=0;const e=r.getLightsByReference();for(let t=0;t0&&(i++,0===o&&(o=1)),1===o&&(i>1||1!==r.getIntensity()||!r.lightTypeIsHeadLight())&&(o=2),o<3&&r.getPositional()&&(o=3)}}let h=!1;const m=t.lastBoundBO.getReferenceByName("lastLightComplexity"),g=t.lastBoundBO.getReferenceByName("lastLightCount");return m===o&&g===i||(t.lastBoundBO.set({lastLightComplexity:o},!0),t.lastBoundBO.set({lastLightCount:i},!0),h=!0),(!t.currentRenderPass&&t.lastRenderPassShaderReplacement||t.currentRenderPass&&t.currentRenderPass.getShaderReplacement()!==t.lastRenderPassShaderReplacement)&&(h=!0),!!(t.lastHaveSeenDepthRequest!==t.haveSeenDepthRequest||e.getShaderSourceTime().getMTime(){const o=t.renderable.getViewSpecificProperties().ShadersCallbacks;o&&o.forEach(t=>{t.callback(t.userData,e,r,n)})},e.setMapperShaderParameters=(r,n,o)=>{if(r.getProgram().isUniformUsed("PrimitiveIDOffset")&&r.getProgram().setUniformi("PrimitiveIDOffset",t.primitiveIDOffset),r.getProgram().isUniformUsed("VertexIDOffset")&&r.getProgram().setUniformi("VertexIDOffset",t.vertexIDOffset),r.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>r.getAttributeUpdateTime().getMTime()||r.getShaderSourceTime().getMTime()>r.getAttributeUpdateTime().getMTime())){const e=t.lastBoundBO.getReferenceByName("lastLightComplexity");r.getProgram().isAttributeUsed("vertexMC")&&(r.getVAO().addAttributeArray(r.getProgram(),r.getCABO(),"vertexMC",r.getCABO().getVertexOffset(),r.getCABO().getStride(),t.context.FLOAT,3,!1)||kd("Error setting vertexMC in shader VAO.")),r.getProgram().isAttributeUsed("normalMC")&&r.getCABO().getNormalOffset()&&e>0?r.getVAO().addAttributeArray(r.getProgram(),r.getCABO(),"normalMC",r.getCABO().getNormalOffset(),r.getCABO().getStride(),t.context.FLOAT,3,!1)||kd("Error setting normalMC in shader VAO."):r.getVAO().removeAttributeArray("normalMC"),t.renderable.getCustomShaderAttributes().forEach((e,n)=>{r.getProgram().isAttributeUsed(`${e}MC`)&&(r.getVAO().addAttributeArray(r.getProgram(),r.getCABO(),`${e}MC`,r.getCABO().getCustomData()[n].offset,r.getCABO().getStride(),t.context.FLOAT,r.getCABO().getCustomData()[n].components,!1)||kd(`Error setting ${e}MC in shader VAO.`))}),r.getProgram().isAttributeUsed("tcoordMC")&&r.getCABO().getTCoordOffset()?r.getVAO().addAttributeArray(r.getProgram(),r.getCABO(),"tcoordMC",r.getCABO().getTCoordOffset(),r.getCABO().getStride(),t.context.FLOAT,r.getCABO().getTCoordComponents(),!1)||kd("Error setting tcoordMC in shader VAO."):r.getVAO().removeAttributeArray("tcoordMC"),r.getProgram().isAttributeUsed("scalarColor")&&r.getCABO().getColorComponents()?r.getVAO().addAttributeArray(r.getProgram(),r.getCABO().getColorBO(),"scalarColor",r.getCABO().getColorOffset(),r.getCABO().getColorBOStride(),t.context.UNSIGNED_BYTE,4,!0)||kd("Error setting scalarColor in shader VAO."):r.getVAO().removeAttributeArray("scalarColor"),r.getAttributeUpdateTime().modified()}if(t.renderable.getNumberOfClippingPlanes()){const e=t.renderable.getNumberOfClippingPlanes(),n=[],i=r.getCABO().getCoordShiftAndScaleEnabled()?r.getCABO().getInverseShiftAndScaleMatrix():null,a=i?d(t.tmpMat4,o.getMatrix()):o.getMatrix();i&&(m(a,a),b(a,a,i),m(a,a));for(let r=0;r{const o=t.lastBoundBO.getReferenceByName("lastLightComplexity");if(o<2)return;const i=e.getProgram();let a=0;const s=r.getLightsByReference();for(let e=0;e0){const e=n.getColorByReference(),o=n.getIntensity();t.lightColor[0]=e[0]*o,t.lightColor[1]=e[1]*o,t.lightColor[2]=e[2]*o;const s=n.getDirection(),l=r.getActiveCamera().getViewMatrix(),u=[...s];n.lightTypeIsSceneLight()&&(u[0]=l[0]*s[0]+l[1]*s[1]+l[2]*s[2],u[1]=l[4]*s[0]+l[5]*s[1]+l[6]*s[2],u[2]=l[8]*s[0]+l[9]*s[1]+l[10]*s[2],Lo(u)),t.lightDirection[0]=u[0],t.lightDirection[1]=u[1],t.lightDirection[2]=u[2],Lo(t.lightDirection),i.setUniform3fArray(`lightColor${a}`,t.lightColor),i.setUniform3fArray(`lightDirectionVC${a}`,t.lightDirection),a++}}if(o<3)return;const l=r.getActiveCamera().getViewMatrix();m(l,l),a=0;for(let e=0;e0){const e=t.getTransformedPosition(),r=new Float64Array(3);Sr(r,e,l),i.setUniform3fArray(`lightAttenuation${a}`,t.getAttenuationValuesByReference()),i.setUniformi(`lightPositional${a}`,t.getPositional()),i.setUniformf(`lightExponent${a}`,t.getExponent()),i.setUniformf(`lightConeAngle${a}`,t.getConeAngle()),i.setUniform3fArray(`lightPositionVC${a}`,[r[0],r[1],r[2]]),a++}}},e.setCameraShaderParameters=(e,i,a)=>{const s=e.getProgram(),l=t.openGLCamera.getKeyMatrices(i),u=i.getActiveCamera(),c=t.openGLCamera.getKeyMatrixTime().getMTime(),d=s.getLastCameraMTime(),p=e.getCABO().getCoordShiftAndScaleEnabled()?e.getCABO().getInverseShiftAndScaleMatrix():null,f=a.getIsIdentity(),m=f?{mcwc:null,normalMatrix:null}:t.openGLActor.getKeyMatrices();if(a.getCoordinateSystem()===Gd.DISPLAY){const e=t._openGLRenderer.getTiledSizeAndOrigin();h(t.tmpMat4),t.tmpMat4[0]=2/e.usize,t.tmpMat4[12]=-1,t.tmpMat4[5]=2/e.vsize,t.tmpMat4[13]=-1,b(t.tmpMat4,t.tmpMat4,p),s.setUniformMatrix("MCPCMatrix",t.tmpMat4)}else s.setUniformMatrix("MCPCMatrix",r([l.wcpc,m.mcwc,p],n,t.tmpMat4));s.isUniformUsed("MCVCMatrix")&&s.setUniformMatrix("MCVCMatrix",r([l.wcvc,m.mcwc,p],n,t.tmpMat4)),s.isUniformUsed("normalMatrix")&&s.setUniformMatrix3x3("normalMatrix",r([l.normalMatrix,m.normalMatrix],o,t.tmpMat3)),d!==c&&(s.isUniformUsed("cameraParallel")&&s.setUniformi("cameraParallel",u.getParallelProjection()),s.setLastCameraMTime(c)),f||s.setLastCameraMTime(0)},e.setPropertyShaderParameters=(e,r,n)=>{const o=e.getProgram();let i=n.getProperty(),a=i.getOpacity(),s=t.drawingEdges?i.getEdgeColorByReference():i.getAmbientColorByReference(),l=t.drawingEdges?i.getEdgeColorByReference():i.getDiffuseColorByReference(),u=t.drawingEdges?1:i.getAmbient(),c=t.drawingEdges?0:i.getDiffuse(),d=t.drawingEdges?0:i.getSpecular();const p=i.getSpecularPower();o.setUniformf("opacityUniform",a),o.setUniform3fArray("ambientColorUniform",s),o.setUniform3fArray("diffuseColorUniform",l),o.setUniformf("ambient",u),o.setUniformf("diffuse",c);const f=t.lastBoundBO.getReferenceByName("lastLightComplexity");if(f<1)return;let h=i.getSpecularColorByReference();if(o.setUniform3fArray("specularColorUniform",h),o.setUniformf("specularPowerUniform",p),o.setUniformf("specular",d),o.isUniformUsed("ambientIntensityBF")){if(i=n.getBackfaceProperty(),a=i.getOpacity(),s=i.getAmbientColor(),u=i.getAmbient(),l=i.getDiffuseColor(),c=i.getDiffuse(),h=i.getSpecularColor(),d=i.getSpecular(),o.setUniformf("ambientIntensityBF",u),o.setUniformf("diffuseIntensityBF",c),o.setUniformf("opacityUniformBF",a),o.setUniform3fArray("ambientColorUniformBF",s),o.setUniform3fArray("diffuseColorUniformBF",l),f<1)return;o.setUniformf("specularIntensityBF",d),o.setUniform3fArray("specularColorUniformBF",h),o.setUniformf("specularPowerUniformBF",p)}},e.updateMaximumPointCellIds=(e,r)=>{const n=t._openGLRenderer.getSelector();if(n){if(t.selectionWebGLIdsToVTKIds?.points?.length){const e=t.selectionWebGLIdsToVTKIds.points.length;n.setMaximumPointId(e-1)}if(t.selectionWebGLIdsToVTKIds?.cells?.length){const e=t.selectionWebGLIdsToVTKIds.cells.length;n.setMaximumCellId(e-1)}n.getFieldAssociation()===Od.FIELD_ASSOCIATION_POINTS&&(t.pointPicking=!0)}},e.renderPieceStart=(r,n)=>{t.primitiveIDOffset=0,t.vertexIDOffset=0;const o=function(e){const t=e.getSelector();return t?t.getCurrentPass():Tl.MIN_KNOWN_PASS-1}(t._openGLRenderer);t.lastSelectionState!==o&&(t.selectionStateChanged.modified(),t.lastSelectionState=o),t._openGLRenderer.getSelector()&&t._openGLRenderer.getSelector().renderProp(n),e.updateBufferObjects(r,n),t.renderable.getColorTextureMap()&&t.internalColorTexture.activate(),t.lastBoundBO=null},e.renderPieceDraw=(r,n)=>{const o=n.getProperty().getRepresentation(),i=n.getProperty().getEdgeVisibility()&&o===Md.SURFACE,a=t._openGLRenderer.getSelector(),s=a&&a.getFieldAssociation()===Od.FIELD_ASSOCIATION_POINTS&&(t.lastSelectionState===Tl.ID_LOW24||t.lastSelectionState===Tl.ID_HIGH24);for(let a=Nd.Start;a=0)||(t.lastBoundBO=t.primitives[a],t.primitiveIDOffset+=t.primitives[a].drawArrays(r,n,o,e),t.vertexIDOffset+=t.primitives[a].getCABO().getElementCount()))},e.renderPieceFinish=(e,r)=>{t.LastBoundBO&&t.LastBoundBO.getVAO().release(),t.renderable.getColorTextureMap()&&t.internalColorTexture.deactivate()},e.renderPiece=(r,n)=>{if(e.invokeEvent(Ud),t.renderable.getStatic()||t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.invokeEvent(Vd),!t.currentInput)return void kd("No input!");if(!t.currentInput.getPoints||!t.currentInput.getPoints().getNumberOfValues())return;const o=t.context,i=n.getProperty().getBackfaceCulling(),a=n.getProperty().getFrontfaceCulling();i||a?a?(t._openGLRenderWindow.enableCullFace(),o.cullFace(o.FRONT)):(t._openGLRenderWindow.enableCullFace(),o.cullFace(o.BACK)):t._openGLRenderWindow.disableCullFace(),e.renderPieceStart(r,n),e.renderPieceDraw(r,n),e.renderPieceFinish(r,n)},e.updateBufferObjects=(t,r)=>{e.getNeedToRebuildBufferObjects(t,r)&&e.buildBufferObjects(t,r),e.updateMaximumPointCellIds()},e.getNeedToRebuildBufferObjects=(r,n)=>{const o=t.VBOBuildTime.getMTime();return o{const n=t.currentInput;if(null===n)return;t.renderable.mapScalars(n,1);const o=t.renderable.getColorMapColors();t.haveCellScalars=!1;const i=t.renderable.getScalarMode();t.renderable.getScalarVisibility()&&(i!==Fd.USE_CELL_DATA&&i!==Fd.USE_CELL_FIELD_DATA&&i!==Fd.USE_FIELD_DATA&&n.getPointData().getScalars()||i===Fd.USE_POINT_FIELD_DATA||!o||(t.haveCellScalars=!0));let a=r.getProperty().getInterpolation()!==Rd.FLAT?n.getPointData().getNormals():null;null===a&&n.getCellData().getNormals()&&(t.haveCellNormals=!0,a=n.getCellData().getNormals());const s=r.getProperty().getRepresentation();let l=n.getPointData().getTCoords();t.openGLActor.getActiveTextures()||(l=null);let u=!1;if(t.renderable.getColorCoordinates()){l=t.renderable.getColorCoordinates(),u=t.renderable.getAreScalarsMappedFromCells(),t.internalColorTexture||(t.internalColorTexture=Dd.newInstance({resizable:!0}));const e=t.internalColorTexture;e.setMinificationFilter(Bd.NEAREST),e.setMagnificationFilter(Bd.NEAREST),e.setWrapS(Ld.CLAMP_TO_EDGE),e.setWrapT(Ld.CLAMP_TO_EDGE),e.setOpenGLRenderWindow(t._openGLRenderWindow);const r=t.renderable.getColorTextureMap(),n=r.getExtent(),o=r.getPointData().getScalars();e.create2DFromRaw({width:n[1]-n[0]+1,height:n[3]-n[2]+1,numComps:o.getNumberOfComponents(),dataType:o.getDataType(),data:o.getData()}),e.activate(),e.sendParameters(),e.deactivate()}const c=t.renderable.getCustomShaderAttributes().map(e=>n.getPointData().getArrayByName(e)),d=`${n.getMTime()}A${s}B${n.getMTime()}C${a?a.getMTime():1}D${o?o.getMTime():1}E${r.getProperty().getEdgeVisibility()}F${l?l.getMTime():1}G${c.map(e=>e.getMTime()).join(",")}`;if(t.VBOBuildString!==d){const e={points:n.getPoints(),normals:a,tcoords:l,colors:o,cellOffset:0,vertexOffset:0,useTCoordsPerCell:u,haveCellScalars:t.haveCellScalars,haveCellNormals:t.haveCellNormals,customAttributes:c};t.renderable.getPopulateSelectionSettings()&&(t.selectionWebGLIdsToVTKIds={points:null,cells:null});const i=[{inRep:"verts",cells:n.getVerts()},{inRep:"lines",cells:n.getLines()},{inRep:"polys",cells:n.getPolys()},{inRep:"strips",cells:n.getStrips()},{inRep:"polys",cells:n.getPolys()},{inRep:"strips",cells:n.getStrips()}],p=r.getProperty().getEdgeVisibility()&&s===Md.SURFACE;for(let r=Nd.Start;r{let e=0;return t.primitives.forEach(t=>{e+=t.getAllocatedGPUMemoryInBytes()}),e}}(e,t)},"vtkOpenGLPolyDataMapper");Qt("vtkMapper",jd);const Wd={BACKGROUND:0,FOREGROUND:1};var Hd={DisplayLocation:Wd};const{primTypes:Kd}=ud,{Filter:Xd,Wrap:$d}=Dd,{vtkErrorMacro:qd}=jt,Yd={type:"StartEvent"},Jd={type:"EndEvent"},Qd={context:null,VBOBuildTime:0,VBOBuildString:null,primitives:null,primTypes:null,shaderRebuildString:null};const Zd=Pt(function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qd,r),Xt.extend(e,t,r),Pd(e,t,r),Id(e,t,r),t.primitives=[],t.primTypes=Kd,t.tmpMat4=h(new Float64Array(16));for(let e=Kd.Start;e{r&&(t.openGLActor2D=e.getFirstAncestorOfType("vtkOpenGLActor2D"),t._openGLRenderer=t.openGLActor2D.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getLastAncestorOfType("vtkOpenGLRenderWindow"),t.openGLCamera=t._openGLRenderer.getViewNodeFor(t._openGLRenderer.getRenderable().getActiveCamera(),t.openGLCamera))},e.overlayPass=t=>{t&&e.render()},e.getShaderTemplate=(e,t,r)=>{e.Vertex="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyData2DVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\n// all variables that represent positions or directions have a suffix\n// indicating the coordinate system they are in. The possible values are\n// MC - Model Coordinates\n// WC - WC world coordinates\n// VC - View Coordinates\n// DC - Display Coordinates\n\nin vec4 vertexWC;\n\n// frag position in VC\n//VTK::PositionVC::Dec\n\n// material property values\n//VTK::Color::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\nuniform mat4 WCVCMatrix; // World to view matrix\n\nvoid main()\n{\n // Apple Bug\n //VTK::PrimID::Impl\n\n gl_Position = WCVCMatrix*vertexWC;\n\n //VTK::TCoord::Impl\n\n //VTK::Color::Impl\n\n //VTK::PositionVC::Impl\n}\n",e.Fragment="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyData2DFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n\nuniform int PrimitiveIDOffset;\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// Scalar coloring\n//VTK::Color::Dec\n\n// Depth Peeling\n//VTK::DepthPeeling::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// the output of this shader\n//VTK::Output::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\nvoid main()\n{\n // Apple Bug\n //VTK::PrimID::Impl\n\n //VTK::Color::Impl\n //VTK::TCoord::Impl\n\n //VTK::DepthPeeling::Impl\n //VTK::Picking::Impl\n\n if (gl_FragData[0].a <= 0.0)\n {\n discard;\n }\n}\n",e.Geometry=""},e.render=()=>{const r=t._openGLRenderWindow.getContext();if(t.context!==r){t.context=r;for(let e=Kd.Start;e{if(e.invokeEvent(Yd),t.renderable.getStatic()||t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.invokeEvent(Jd),!t.currentInput)return void qd("No input!");if(!t.currentInput.getPoints||!t.currentInput.getPoints().getNumberOfValues())return;const o=t.context;t._openGLRenderWindow.enableCullFace(),o.cullFace(o.BACK),e.renderPieceStart(r,n),e.renderPieceDraw(r,n),e.renderPieceFinish(r,n)},e.renderPieceStart=(r,n)=>{t.primitiveIDOffset=0,t._openGLRenderer.getSelector()&&(t._openGLRenderer.getSelector().getCurrentPass(),t._openGLRenderer.getSelector().renderProp(n)),t.renderable.getColorTextureMap()&&t.internalColorTexture.activate(),e.updateBufferObjects(r,n),t.lastBoundBO=null},e.getNeedToRebuildShaders=(e,r,n)=>e.getShaderSourceTime().getMTime(){e.getNeedToRebuildBufferObjects(t,r)&&e.buildBufferObjects(t,r)},e.getNeedToRebuildBufferObjects=(r,n)=>{const o=t.VBOBuildTime.getMTime();return!!(o{const n=t.currentInput;if(null===n)return;t.renderable.mapScalars(n,r.getProperty().getOpacity());const o=t.renderable.getColorMapColors(),i=r.getProperty().getRepresentation();let a=n.getPointData().getTCoords();t.openGLActor2D.getActiveTextures()||(a=null);let s=!1;if(t.renderable.getColorCoordinates()){a=t.renderable.getColorCoordinates(),s=t.renderable.getAreScalarsMappedFromCells(),t.internalColorTexture||(t.internalColorTexture=Dd.newInstance({resizable:!0}));const e=t.internalColorTexture;e.setMinificationFilter(Xd.NEAREST),e.setMagnificationFilter(Xd.NEAREST),e.setWrapS($d.CLAMP_TO_EDGE),e.setWrapT($d.CLAMP_TO_EDGE),e.setOpenGLRenderWindow(t._openGLRenderWindow);const r=t.renderable.getColorTextureMap(),n=r.getExtent(),o=r.getPointData().getScalars();e.create2DFromRaw({width:n[1]-n[0]+1,height:n[3]-n[2]+1,numComps:o.getNumberOfComponents(),dataType:o.getDataType(),data:o.getData()}),e.activate(),e.sendParameters(),e.deactivate()}const l=t.renderable.getTransformCoordinate(),u=e.getRenderWindow().getViews()[0].getViewportSize(e),c=`${n.getMTime()}A${i}B${n.getMTime()}C${o?o.getMTime():1}D${a?a.getMTime():1}E${l?e.getMTime():1}F${u}`;if(t.VBOBuildString!==c){let r=n.getPoints();if(l){const t=Jl.newInstance(),n=r.getNumberOfPoints();t.setNumberOfPoints(n);const o=[];for(let i=0;in.getPointData().getArrayByName(e))};u.cellOffset+=t.primitives[Kd.Points].getCABO().createVBO(n.getVerts(),"verts",i,u),u.cellOffset+=t.primitives[Kd.Lines].getCABO().createVBO(n.getLines(),"lines",i,u),u.cellOffset+=t.primitives[Kd.Tris].getCABO().createVBO(n.getPolys(),"polys",i,u),u.cellOffset+=t.primitives[Kd.TriStrips].getCABO().createVBO(n.getStrips(),"strips",i,u),t.VBOBuildTime.modified(),t.VBOBuildString=c}},e.renderPieceDraw=(r,n)=>{const o=n.getProperty().getRepresentation();t.context.depthMask(!0);for(let i=Kd.Start;i{t.lastBoundBO&&t.lastBoundBO.getVAO().release(),t.renderable.getColorTextureMap()&&t.internalColorTexture.deactivate()},e.replaceShaderValues=(t,r,n)=>{e.replaceShaderColor(t,r,n),e.replaceShaderTCoord(t,r,n),e.replaceShaderPicking(t,r,n),e.replaceShaderPositionVC(t,r,n)},e.replaceShaderColor=(e,r,n)=>{let o=e.Vertex,i=e.Geometry,a=e.Fragment,s=["uniform vec3 diffuseColorUniform;","uniform float opacityUniform;"],l=["vec3 diffuseColor = diffuseColorUniform;","float opacity = opacityUniform;"];0!==t.lastBoundBO.getCABO().getColorComponents()?(s=s.concat(["varying vec4 vertexColorVSOutput;"]),o=rd.substitute(o,"//VTK::Color::Dec",["attribute vec4 scalarColor;","varying vec4 vertexColorVSOutput;"]).result,o=rd.substitute(o,"//VTK::Color::Impl",["vertexColorVSOutput = scalarColor;"]).result,i=rd.substitute(i,"//VTK::Color::Dec",["in vec4 vertexColorVSOutput[];","out vec4 vertexColorGSOutput;"]).result,i=rd.substitute(i,"//VTK::Color::Impl",["vertexColorGSOutput = vertexColorVSOutput[i];"]).result,a=rd.substitute(a,"//VTK::Color::Impl",l.concat([" diffuseColor = vertexColorVSOutput.rgb;"," opacity = opacity*vertexColorVSOutput.a;"])).result):t.renderable.getAreScalarsMappedFromCells()&&(l=l.concat([" vec4 texColor = texture2D(texture1, tcoordVCVSOutput.st);"," diffuseColor = texColor.rgb;"," opacity = opacity*texColor.a;"])),l=l.concat(["gl_FragData[0] = vec4(diffuseColor, opacity);"]),a=rd.substitute(a,"//VTK::Color::Dec",s).result,a=rd.substitute(a,"//VTK::Color::Impl",l).result,e.Vertex=o,e.Geometry=i,e.Fragment=a},e.replaceShaderTCoord=(e,r,n)=>{if(t.lastBoundBO.getCABO().getTCoordOffset()){let r=e.Vertex,n=e.Geometry,o=e.Fragment;const i=t.lastBoundBO.getCABO().getTCoordComponents();1===i?(r=rd.substitute(r,"//VTK::TCoord::Dec",["in float tcoordMC;","out float tcoordVCVSOutput;"]).result,r=rd.substitute(r,"//VTK::TCoord::Impl",["tcoordVCVSOutput = tcoordMC;"]).result,n=rd.substitute(n,"//VTK::TCoord::Dec",["in float tcoordVCVSOutput[];\n","out float tcoordVCGSOutput;"]).result,n=rd.substitute(n,["//VTK::TCoord::Impl","tcoordVCGSOutput = tcoordVCVSOutput[i];"]).result,o=rd.substitute(o,"//VTK::TCoord::Dec",["in float tcoordVCVSOutput;","uniform sampler2D texture1;"]).result,o=rd.substitute(o,"//VTK::TCoord::Impl",["gl_FragData[0] = gl_FragData[0]*texture2D(texture1, vec2(tcoordVCVSOutput,0));"]).result):2===i&&(r=rd.substitute(r,"//VTK::TCoord::Dec",["in vec2 tcoordMC;","out vec2 tcoordVCVSOutput;"]).result,r=rd.substitute(r,"//VTK::TCoord::Impl",["tcoordVCVSOutput = tcoordMC;"]).result,n=rd.substitute(n,"//VTK::TCoord::Dec",["in vec2 tcoordVCVSOutput[];\n","out vec2 tcoordVCGSOutput;"]).result,n=rd.substitute(n,"//VTK::TCoord::Impl",["tcoordVCGSOutput = tcoordVCVSOutput[i];"]).result,o=rd.substitute(o,"//VTK::TCoord::Dec",["in vec2 tcoordVCVSOutput;","uniform sampler2D texture1;"]).result,o=rd.substitute(o,"//VTK::TCoord::Impl",["gl_FragData[0] = gl_FragData[0]*texture2D(texture1, tcoordVCVSOutput.st);"]).result),t.renderable.getAreScalarsMappedFromCells()&&(n=rd.substitute(n,"//VTK::PrimID::Impl",["gl_PrimitiveID = gl_PrimitiveIDIn;"]).result),e.Vertex=r,e.Geometry=n,e.Fragment=o}},e.replaceShaderPicking=(e,t,r)=>{let n=e.Fragment;n=rd.substitute(n,"//VTK::Picking::Dec",["uniform vec3 mapperIndex;","uniform int picking;"]).result,n=rd.substitute(n,"//VTK::Picking::Impl"," gl_FragData[0] = picking != 0 ? vec4(mapperIndex,1.0) : gl_FragData[0];").result,e.Fragment=n},e.replaceShaderPositionVC=(e,r,n)=>{t.lastBoundBO.replaceShaderPositionVC(e,r,n)},e.invokeShaderCallbacks=(e,r,n)=>{const o=t.renderable.getViewSpecificProperties().ShadersCallbacks;o&&o.forEach(t=>{t.callback(t.userData,e,r,n)})},e.setMapperShaderParameters=(e,r,n)=>{if(e.getProgram().isUniformUsed("PrimitiveIDOffset")&&e.getProgram().setUniformi("PrimitiveIDOffset",t.primitiveIDOffset),e.getProgram().isAttributeUsed("vertexWC")&&(e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),"vertexWC",e.getCABO().getVertexOffset(),e.getCABO().getStride(),t.context.FLOAT,3,!1)||qd("Error setting vertexWC in shader VAO.")),e.getCABO().getElementCount()&&(t.VBOBuildTime.getMTime()>e.getAttributeUpdateTime().getMTime()||e.getShaderSourceTime().getMTime()>e.getAttributeUpdateTime().getMTime())){t.renderable.getCustomShaderAttributes().forEach((r,n)=>{e.getProgram().isAttributeUsed(`${r}MC`)&&(e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),`${r}MC`,e.getCABO().getCustomData()[n].offset,e.getCABO().getStride(),t.context.FLOAT,e.getCABO().getCustomData()[n].components,!1)||qd(`Error setting ${r}MC in shader VAO.`))}),e.getProgram().isAttributeUsed("tcoordMC")&&e.getCABO().getTCoordOffset()?e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),"tcoordMC",e.getCABO().getTCoordOffset(),e.getCABO().getStride(),t.context.FLOAT,e.getCABO().getTCoordComponents(),!1)||qd("Error setting tcoordMC in shader VAO."):e.getVAO().removeAttributeArray("tcoordMC"),e.getProgram().isAttributeUsed("scalarColor")&&e.getCABO().getColorComponents()?e.getVAO().addAttributeArray(e.getProgram(),e.getCABO().getColorBO(),"scalarColor",e.getCABO().getColorOffset(),e.getCABO().getColorBOStride(),t.context.UNSIGNED_BYTE,4,!0)||qd("Error setting scalarColor in shader VAO."):e.getVAO().removeAttributeArray("scalarColor"),t.internalColorTexture&&e.getProgram().isUniformUsed("texture1")&&t.internalColorTexture.getTextureUnit()>-1&&e.getProgram().setUniformi("texture1",t.internalColorTexture.getTextureUnit());const o=t.openGLActor2D.getActiveTextures();if(o)for(let t=0;t{const o=t.renderable.getColorMapColors();if(!o||0===o.getNumberOfComponents()){const t=e.getProgram(),r=n.getProperty(),o=r.getOpacity();t.setUniformf("opacityUniform",o);const i=r.getColor();t.setUniform3fArray("diffuseColorUniform",i)}},e.setLightingShaderParameters=(e,t,r)=>{},e.setCameraShaderParameters=(e,r,o)=>{const i=e.getProgram(),a=e.getCABO().getCoordShiftAndScaleEnabled()?e.getCABO().getInverseShiftAndScaleMatrix():null,s=r.getRenderWindow().getViews()[0].getViewportSize(r),l=r.getViewport(),u=o.getActualPositionCoordinate().getComputedDoubleViewportValue(r),c=[0,0,1,1],d=[0,0,1,1];if(d[0]=l[0]>=c[0]?l[0]:c[0],d[1]=l[1]>=c[1]?l[1]:c[1],d[2]=l[2]<=c[2]?l[2]:c[2],d[3]=l[3]<=c[3]?l[3]:c[3],d[0]>=d[2])return;if(d[1]>=d[3])return;s[0]=bo(s[0]*(d[2]-d[0])/(l[2]-l[0])),s[1]=bo(s[1]*(d[3]-d[1])/(l[3]-l[1]));const p=t._openGLRenderer.getParent().getSize(),f=bo(u[0]-(d[0]-l[0])*p[0]),g=bo(u[1]-(d[1]-l[1])*p[1]),y=-f;let v=-f+s[0];const b=-g;let x=-g+s[1];y===v&&(v=y+1),b===x&&(x=b+1);const _=h(new Float64Array(16));var S,C,T;_[0]=2/(v-y),_[5]=2/(x-b),_[3]=-1*(v+y)/(v-y),_[7]=-1*(x+b)/(x-b),_[10]=0,_[11]=o.getProperty().getDisplayLocation()===Wd.FOREGROUND?-1:1,_[15]=1,m(_,_),i.setUniformMatrix("WCVCMatrix",(S=[_,a],C=n,T=t.tmpMat4,C.identity(T),S.reduce((e,t,r)=>0===r?t?C.copy(e,t):C.identity(e):t?C.multiply(e,e,t):e,T)))},e.getAllocatedGPUMemoryInBytes=()=>{let e=0;return t.primitives.forEach(t=>{e+=t.getAllocatedGPUMemoryInBytes()}),e}}(e,t)},"vtkOpenGLPolyDataMapper2D");Qt("vtkMapper2D",Zd);var ep={Orientation:{HORIZONTAL:"horizontal",VERTICAL:"vertical",AUTO:"auto"}};const{VectorMode:tp}=ul,{Orientation:rp}=ep;function np(e,t,r){e.strokeStyle=t.strokeColor,e.lineWidth=t.strokeSize,e.fillStyle=t.fontColor;const n=t.fontSize??r;e.font=`${t.fontStyle} ${n}px ${t.fontFamily}`}function op(e,t){return e=>{const r=e.getLastSize(),n=(r[0]/700)**.8,o=(r[1]/700)**.8,i=Math.min(n,o),a=e.getAxisTextStyle(),s=e.getTickTextStyle();Object.assign(a,t.axisTextStyle),Object.assign(s,t.tickTextStyle),void 0===a.fontSize&&(a.fontSize=Math.max(24*i,12)),void 0===s.fontSize&&(e.getLastAspectRatio()>1?s.fontSize=Math.max(20*i,10):s.fontSize=Math.max(16*i,10));const l=e.updateTextureAtlas();e.setTopTitle(!1);const u=e.getBoxSizeByReference();let c=!1;if(c=t.orientation===rp.VERTICAL||t.orientation!==rp.HORIZONTAL&&e.getLastAspectRatio()>1,c)e.setTickLabelPixelOffset(.3*s.fontSize),l.titleWidth<=l.tickWidth+e.getTickLabelPixelOffset()+.8*s.fontSize?(e.setTopTitle(!0),e.setAxisTitlePixelOffset(.2*s.fontSize),u[0]=2*(l.tickWidth+e.getTickLabelPixelOffset()+.8*s.fontSize)/r[0],e.setBoxPosition([.98-u[0],-.92])):(e.setAxisTitlePixelOffset(.2*s.fontSize),u[0]=2*(l.titleHeight+e.getAxisTitlePixelOffset()+l.tickWidth+e.getTickLabelPixelOffset()+.8*s.fontSize)/r[0],e.setBoxPosition([.99-u[0],-.92])),u[1]=Math.max(1.2,Math.min(1.84/o,1.84));else{e.setAxisTitlePixelOffset(1.2*s.fontSize),e.setTickLabelPixelOffset(.1*s.fontSize);const t=2*(.8*s.fontSize+l.titleHeight+e.getAxisTitlePixelOffset())/r[1],n=2*l.tickWidth/r[0];u[0]=Math.min(1.9,Math.max(1.4,1.4*n*(e.getTicks().length+3))),u[1]=t,e.setBoxPosition([-.5*u[0],-.97])}e.recomputeBarSegments(l)}}function ip(e,t){return e=>{const t=e.getLastTickBounds(),r=no().domain([t[0],t[1]]),n=r.ticks(5),o=r.tickFormat(5);e.setTicks(n),e.setTickStrings(n.map(o))}}const ap=zt.newInstance(function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{renderable:null};Object.assign(t,{},r),zt.obj(e,t),zt.setGet(e,t,["axisTitlePixelOffset","tickLabelPixelOffset","renderable","topTitle","ticks","tickStrings","tickPositions"]),zt.get(e,t,["lastSize","lastAspectRatio","lastTickBounds","axisTextStyle","tickTextStyle","barActor","tmActor"]),zt.getArray(e,t,["boxPosition","boxSize"]),zt.setArray(e,t,["boxPosition","boxSize"],2),t.forceUpdate=!1,t.lastRebuildTime={},zt.obj(t.lastRebuildTime,{mtime:0}),t.lastSize=[-1,-1],t.tmCanvas=document.createElement("canvas"),t.tmContext=t.tmCanvas.getContext("2d"),t._tmAtlas=new Map,t.barMapper=Gl.newInstance(),t.barMapper.setInterpolateScalarsBeforeMapping(!0),t.barMapper.setUseLookupTableScalarRange(!0),t.polyData=mc.newInstance(),t.barMapper.setInputData(t.polyData),t.barActor=ss.newInstance(),t.barActor.setMapper(t.barMapper),t.tmPolyData=mc.newInstance(),t.tmMapper=Gl.newInstance(),t.tmMapper.setInputData(t.tmPolyData),t.tmTexture=vc.newInstance({resizable:!0}),t.tmTexture.setInterpolate(!1),t.tmActor=ss.newInstance({parentProp:e}),t.tmActor.setMapper(t.tmMapper),t.tmActor.addTexture(t.tmTexture),t.barPosition=[0,0],t.barSize=[0,0],t.boxPosition=[.88,-.92],t.boxSize=[.1,1.1],t.lastTickBounds=[],function(e,t){t.classHierarchy.push("vtkScalarBarActorHelper"),e.setRenderable=r=>{t.renderable!==r&&(t.renderable=r,t.barActor.setProperty(r.getProperty()),t.barActor.setParentProp(r),t.barActor.setCoordinateSystemToDisplay(),t.tmActor.setProperty(r.getProperty()),t.tmActor.setParentProp(r),t.tmActor.setCoordinateSystemToDisplay(),t.generateTicks=r.generateTicks,t.axisTextStyle={...r.getAxisTextStyle()},t.tickTextStyle={...r.getTickTextStyle()},e.modified())},e.updateAPISpecificData=(r,n,o)=>{t.lastSize[0]===r[0]&&t.lastSize[1]===r[1]||(t.lastSize[0]=r[0],t.lastSize[1]=r[1],t.lastAspectRatio=r[0]/r[1],t.forceUpdate=!0);const i=t.renderable.getScalarsToColors();if(i&&t.renderable.getVisibility()&&(t.barMapper.setLookupTable(i),t.camera=n,t.renderWindow=o,t.forceUpdate||Math.max(i.getMTime(),e.getMTime(),t.renderable.getMTime())>t.lastRebuildTime.getMTime())){const r=i.getMappingRange();if(t.lastTickBounds=[...r],t.renderable.getGenerateTicks()(e),t.renderable.getAutomated())t.renderable.getAutoLayout()(e);else{t.axisTextStyle={...t.renderable.getAxisTextStyle()},t.tickTextStyle={...t.renderable.getTickTextStyle()},t.barPosition=[...t.renderable.getBarPosition()],t.barSize=[...t.renderable.getBarSize()],t.boxPosition=[...t.renderable.getBoxPosition()],t.boxSize=[...t.renderable.getBoxSize()],t.axisTitlePixelOffset=t.renderable.getAxisTitlePixelOffset(),t.tickLabelPixelOffset=t.renderable.getTickLabelPixelOffset();const r=e.updateTextureAtlas();e.recomputeBarSegments(r)}e.updatePolyDataForLabels(),e.updatePolyDataForBarSegments(),t.lastRebuildTime.modified(),t.forceUpdate=!1}},e.updateTextureAtlas=()=>{t.tmContext.textBaseline="bottom",t.tmContext.textAlign="left";const r={},n=new Map;let o=0,i=1;np(t.tmContext,t.axisTextStyle,18);let a=t.tmContext.measureText(t.renderable.getAxisLabel()),s={height:a.actualBoundingBoxAscent+2,startingHeight:i,width:a.width+2,textStyle:t.axisTextStyle};n.set(t.renderable.getAxisLabel(),s),i+=s.height,o=s.width,r.titleWidth=s.width,r.titleHeight=s.height,r.tickWidth=0,r.tickHeight=0,np(t.tmContext,t.tickTextStyle,14);const l=[...e.getTickStrings(),"NaN","Below","Above"];for(let e=0;e{e.tcoords=[0,(i-e.startingHeight-e.height)/i,e.width/o,(i-e.startingHeight-e.height)/i,e.width/o,(i-e.startingHeight)/i,0,(i-e.startingHeight)/i]}),t.tmCanvas.width=o,t.tmCanvas.height=i,t.tmContext.textBaseline="bottom",t.tmContext.textAlign="left",t.tmContext.clearRect(0,0,o,i),n.forEach((e,r)=>{const n=e.textStyle===t.axisTextStyle?18:14;np(t.tmContext,e.textStyle,n),t.tmContext.fillText(r,1,e.startingHeight+e.height-1)}),t.tmTexture.setCanvas(t.tmCanvas),t.tmTexture.modified(),t._tmAtlas=n,r},e.computeBarSize=e=>{t.vertical=t.boxSize[1]>t.boxSize[0];const r=2*e.tickHeight/t.lastSize[1],n=[1,1];if(t.vertical){const o=2*(e.tickWidth+t.tickLabelPixelOffset)/t.lastSize[0];if(t.topTitle){const r=2*(e.titleHeight+t.axisTitlePixelOffset)/t.lastSize[1];t.barSize[0]=t.boxSize[0]-o,t.barSize[1]=t.boxSize[1]-r}else{const r=2*(e.titleHeight+t.axisTitlePixelOffset)/t.lastSize[0];t.barSize[0]=t.boxSize[0]-r-o,t.barSize[1]=t.boxSize[1]}t.barPosition[0]=t.boxPosition[0]+o,t.barPosition[1]=t.boxPosition[1],n[1]=r}else{const r=(2*e.tickWidth-8)/t.lastSize[0],o=2*(e.titleHeight+t.axisTitlePixelOffset)/t.lastSize[1];t.barSize[0]=t.boxSize[0],t.barPosition[0]=t.boxPosition[0],t.barSize[1]=t.boxSize[1]-o,t.barPosition[1]=t.boxPosition[1],n[0]=r}return n},e.recomputeBarSegments=r=>{const n=e.computeBarSize(r);t.barSegments=[];const o=[0,0],i=t.vertical?1:0,a=t.vertical?.01:.02;function s(e,r){t.barSegments.push({corners:[[...o],[o[0]+n[0],o[1]],[o[0]+n[0],o[1]+n[1]],[o[0],o[1]+n[1]]],scalars:r,title:e}),o[i]+=n[i]+a}t.renderable.getDrawNanAnnotation()&&t.renderable.getScalarsToColors().getNanColor()&&s("NaN",[NaN,NaN,NaN,NaN]),t.renderable.getDrawBelowRangeSwatch()&&t.renderable.getScalarsToColors().getUseBelowRangeColor?.()&&s("Below",[-.1,-.1,-.1,-.1]);const l=t.renderable.getScalarsToColors().getUseAboveRangeColor?.();o[i]+=a;const u=n[i];n[i]=l?1-2*a-n[i]-o[i]:1-a-o[i],s("ticks",t.vertical?[0,0,.995,.995]:[0,.995,.995,0]),t.renderable.getDrawAboveRangeSwatch()&&l&&(n[i]=u,o[i]+=a,s("Above",[1.1,1.1,1.1,1.1]))};const r=new Float64Array(3);e.createPolyDataForOneLabel=(e,n,o,i,a,s)=>{const l=t._tmAtlas.get(e);if(!l)return;let u=s.ptIdx,c=s.cellIdx;r[0]=(.5*n[0]+.5)*t.lastSize[0],r[1]=(.5*n[1]+.5)*t.lastSize[1],r[2]=n[2],r[0]+=a[0],r[1]+=a[1];const d=[],p="vertical"===i?[1,0]:[0,1];"vertical"===i?(d[0]=l.width,d[1]=-l.height,"middle"===o[0]?r[1]-=l.width/2:"right"===o[0]&&(r[1]-=l.width),"middle"===o[1]?r[0]+=l.height/2:"top"===o[1]&&(r[0]+=l.height)):(d[0]=l.width,d[1]=l.height,"middle"===o[0]?r[0]-=l.width/2:"right"===o[0]&&(r[0]-=l.width),"middle"===o[1]?r[1]-=l.height/2:"top"===o[1]&&(r[1]-=l.height)),s.points[3*u]=r[0],s.points[3*u+1]=r[1],s.points[3*u+2]=r[2],s.tcoords[2*u]=l.tcoords[0],s.tcoords[2*u+1]=l.tcoords[1],u++,r[p[0]]+=d[0],s.points[3*u]=r[0],s.points[3*u+1]=r[1],s.points[3*u+2]=r[2],s.tcoords[2*u]=l.tcoords[2],s.tcoords[2*u+1]=l.tcoords[3],u++,r[p[1]]+=d[1],s.points[3*u]=r[0],s.points[3*u+1]=r[1],s.points[3*u+2]=r[2],s.tcoords[2*u]=l.tcoords[4],s.tcoords[2*u+1]=l.tcoords[5],u++,r[p[0]]-=d[0],s.points[3*u]=r[0],s.points[3*u+1]=r[1],s.points[3*u+2]=r[2],s.tcoords[2*u]=l.tcoords[6],s.tcoords[2*u+1]=l.tcoords[7],u++,s.polys[4*c]=3,s.polys[4*c+1]=u-4,s.polys[4*c+2]=u-3,s.polys[4*c+3]=u-2,c++,s.polys[4*c]=3,s.polys[4*c+1]=u-4,s.polys[4*c+2]=u-2,s.polys[4*c+3]=u-1,s.ptIdx+=4,s.cellIdx+=2};const n=new Float64Array(3);e.updatePolyDataForLabels=()=>{const r=e.getTickStrings().length+t.barSegments.length,o=4*r,i=2*r,a=new Float64Array(3*o),s=new Uint16Array(4*i),l=new Float32Array(2*o),u={ptIdx:0,cellIdx:0,polys:s,points:a,tcoords:l},c=t.vertical?0:1,d=t.vertical?1:0;n[2]=-.99;const p=t.vertical?["right","middle"]:["middle","bottom"];let f=[0,1];const h=[0,0];t.vertical?(h[0]=-t.tickLabelPixelOffset,t.topTitle?(n[0]=t.boxPosition[0]+.5*t.boxSize[0],n[1]=t.barPosition[1]+t.barSize[1],e.createPolyDataForOneLabel(t.renderable.getAxisLabel(),n,["middle","bottom"],"horizontal",[0,t.axisTitlePixelOffset],u)):(n[0]=t.barPosition[0]+t.barSize[0],n[1]=t.barPosition[1]+.5*t.barSize[1],e.createPolyDataForOneLabel(t.renderable.getAxisLabel(),n,["middle","top"],"vertical",[t.axisTitlePixelOffset,0],u)),f=[-1,0]):(h[1]=t.tickLabelPixelOffset,n[0]=t.barPosition[0]+.5*t.barSize[0],n[1]=t.barPosition[1]+t.barSize[1],e.createPolyDataForOneLabel(t.renderable.getAxisLabel(),n,["middle","bottom"],"horizontal",[0,t.axisTitlePixelOffset],u)),n[c]=t.barPosition[c]+(.5*f[c]+.5)*t.barSize[c],n[d]=t.barPosition[d]+.5*t.barSize[d];let m=null;for(let r=0;r{const e=t.renderable.getScalarsToColors();let r=0;t.renderable.getDrawNanAnnotation()&&e.getNanColor()&&(r+=1),t.renderable.getDrawBelowRangeSwatch()&&e.getUseBelowRangeColor?.()&&(r+=1),t.renderable.getDrawAboveRangeSwatch()&&e.getUseAboveRangeColor?.()&&(r+=1);const o=4*(1+r),i=o;let a=1;e.getVectorMode()===tp.COMPONENT&&(a=e.getVectorComponent()+1);const s=new Float64Array(3*o),l=new Uint16Array(5*i),u=new Float32Array(o*a);let c=0,d=0;for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,function(e){return{automated:!0,autoLayout:null,axisLabel:"Scalar Value",barPosition:[0,0],barSize:[0,0],boxPosition:[.88,-.92],boxSize:[.1,1.1],scalarToColors:null,axisTitlePixelOffset:36,axisTextStyle:{fontColor:"white",fontStyle:"normal",fontSize:void 0,fontFamily:"serif"},tickLabelPixelOffset:14,tickTextStyle:{fontColor:"white",fontStyle:"normal",fontSize:void 0,fontFamily:"serif"},generateTicks:null,drawNanAnnotation:!0,drawBelowRangeSwatch:!0,drawAboveRangeSwatch:!0,orientation:null,...e}}(r)),t.autoLayout||(t.autoLayout=op(0,t)),t.generateTicks||(t.generateTicks=ip()),ss.extend(e,t,r),e.getProperty().setDiffuse(0),e.getProperty().setAmbient(1),zt.setGet(e,t,["automated","autoLayout","axisTitlePixelOffset","axisLabel","scalarsToColors","tickLabelPixelOffset","generateTicks","drawNanAnnotation","drawBelowRangeSwatch","drawAboveRangeSwatch","orientation"]),zt.get(e,t,["axisTextStyle","tickTextStyle"]),zt.getArray(e,t,["barPosition","barSize","boxPosition","boxSize"]),zt.setArray(e,t,["barPosition","barSize","boxPosition","boxSize"],2),function(e,t){t.classHierarchy.push("vtkScalarBarActor"),e.setTickTextStyle=r=>{t.tickTextStyle={...t.tickTextStyle,...r},e.modified()},e.setAxisTextStyle=r=>{t.axisTextStyle={...t.axisTextStyle,...r},e.modified()},e.setOrientationToHorizontal=()=>e.setOrientation(rp.HORIZONTAL),e.setOrientationToVertical=()=>e.setOrientation(rp.VERTICAL),e.resetAutoLayoutToDefault=()=>{e.setAutoLayout(op(0,t))},e.resetGenerateTicksToDefault=()=>{e.setGenerateTicks(ip())}}(e,t)}var lp={newInstance:zt.newInstance(sp,"vtkScalarBarActor"),extend:sp,newScalarBarActorHelper:ap,...ep};const up={};const cp=Pt(function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,up,r),Xt.extend(e,t,r),t.scalarBarActorHelper=lp.newScalarBarActorHelper(),function(e,t){t.classHierarchy.push("vtkOpenGLScalarBarActor"),e.buildPass=r=>{r&&(t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.scalarBarActorHelper.getRenderable()||t.scalarBarActorHelper.setRenderable(t.renderable),e.prepareNodes(),e.addMissingNode(t.scalarBarActorHelper.getBarActor()),e.addMissingNode(t.scalarBarActorHelper.getTmActor()),e.removeUnusedNodes())},e.opaquePass=(e,r)=>{if(e){const e=t._openGLRenderer?t._openGLRenderer.getRenderable().getActiveCamera():null,r=t._openGLRenderer.getTiledSizeAndOrigin();t.scalarBarActorHelper.updateAPISpecificData([r.usize,r.vsize],e,t._openGLRenderWindow.getRenderable())}}}(e,t)},"vtkOpenGLScalarBarActor");Qt("vtkScalarBarActor",cp);const{vtkErrorMacro:dp}=jt,pp={context:null};const fp=Pt(function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,pp,r),Xt.extend(e,t,r),t.openGLTexture=Dd.newInstance(),t.tris=ud.newInstance(),t.keyMatrixTime={},mt(t.keyMatrixTime,{mtime:0}),t.keyMatrices={normalMatrix:pe(new Float64Array(9)),mcwc:h(new Float64Array(16))},_t(e,t,["context"]),yt(e,t,["activeTextures"]),function(e,t){t.classHierarchy.push("vtkOpenGLSkybox"),e.buildPass=r=>{if(r){t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getParent(),t.context=t._openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t._openGLRenderWindow),t.openGLTexture.setOpenGLRenderWindow(t._openGLRenderWindow);const r=t._openGLRenderer.getRenderable();t.openGLCamera=t._openGLRenderer.getViewNodeFor(r.getActiveCamera(),t.openGLCamera)}},e.queryPass=(e,r)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;r.incrementOpaqueActorCount()}},e.opaquePass=(r,n)=>{if(r&&!t._openGLRenderer.getSelector()){e.updateBufferObjects(),t.context.depthMask(!0),t._openGLRenderWindow.getShaderCache().readyShaderProgram(t.tris.getProgram()),t.openGLTexture.render(t._openGLRenderWindow);const r=t.openGLTexture.getTextureUnit();t.tris.getProgram().setUniformi("sbtexture",r);const n=t._openGLRenderer.getRenderable(),o=t.openGLCamera.getKeyMatrices(n),i=new Float64Array(16);if(g(i,o.wcpc),t.tris.getProgram().setUniformMatrix("IMCPCMatrix",i),"box"===t.lastFormat){const e=n.getActiveCamera().getPosition();t.tris.getProgram().setUniform3f("camPos",e[0],e[1],e[2])}t.tris.getVAO().bind(),t.context.drawArrays(t.context.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release(),t.openGLTexture.deactivate()}},e.updateBufferObjects=()=>{if(!t.tris.getCABO().getElementCount()){const e=new Float32Array(12);for(let t=0;t<4;t++)e[3*t]=t%2*2-1,e[3*t+1]=t>1?1:-1,e[3*t+2]=1;const r=_s.newInstance({numberOfComponents:3,values:e});r.setName("points");const n=new Uint16Array(8);n[0]=3,n[1]=0,n[2]=1,n[3]=3,n[4]=3,n[5]=0,n[6]=3,n[7]=2;const o=_s.newInstance({numberOfComponents:1,values:n});t.tris.getCABO().createVBO(o,"polys",Ja.SURFACE,{points:r,cellOffset:0})}t.renderable.getFormat()!==t.lastFormat&&(t.lastFormat=t.renderable.getFormat(),"box"===t.lastFormat&&t.tris.setProgram(t._openGLRenderWindow.getShaderCache().readyShaderProgramArray("//VTK::System::Dec\n attribute vec3 vertexMC;\n uniform mat4 IMCPCMatrix;\n varying vec3 TexCoords;\n void main () {\n gl_Position = vec4(vertexMC.xyz, 1.0);\n vec4 wpos = IMCPCMatrix * gl_Position;\n TexCoords = wpos.xyz/wpos.w;\n }","//VTK::System::Dec\n //VTK::Output::Dec\n varying vec3 TexCoords;\n uniform samplerCube sbtexture;\n uniform vec3 camPos;\n void main () {\n // skybox looks from inside out\n // which means we have to adjust\n // our tcoords. Otherwise text would\n // be flipped\n vec3 tc = normalize(TexCoords - camPos);\n if (abs(tc.z) < max(abs(tc.x),abs(tc.y)))\n {\n tc = vec3(1.0, 1.0, -1.0) * tc;\n }\n else\n {\n tc = vec3(-1.0, 1.0, 1.0) * tc;\n }\n gl_FragData[0] = textureCube(sbtexture, tc);\n }","")),"background"===t.lastFormat&&t.tris.setProgram(t._openGLRenderWindow.getShaderCache().readyShaderProgramArray("//VTK::System::Dec\n attribute vec3 vertexMC;\n uniform mat4 IMCPCMatrix;\n varying vec2 TexCoords;\n void main () {\n gl_Position = vec4(vertexMC.xyz, 1.0);\n vec4 wpos = IMCPCMatrix * gl_Position;\n TexCoords = vec2(vertexMC.x, vertexMC.y)*0.5 + 0.5;\n }","//VTK::System::Dec\n //VTK::Output::Dec\n varying vec2 TexCoords;\n uniform sampler2D sbtexture;\n void main () {\n gl_FragData[0] = texture2D(sbtexture, TexCoords);\n }","")),t.tris.getShaderSourceTime().modified(),t.tris.getVAO().bind(),t.tris.getVAO().addAttributeArray(t.tris.getProgram(),t.tris.getCABO(),"vertexMC",t.tris.getCABO().getVertexOffset(),t.tris.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||dp("Error setting vertexMC in shader VAO."));const e=t.renderable.getTextures();e.length||dp("vtkSkybox requires a texture map"),t.openGLTexture.getRenderable()!==e[0]&&(t.openGLTexture.releaseGraphicsResources(t._openGLRenderWindow),t.openGLTexture.setRenderable(e[0]))}}(e,t)});Qt("vtkSkybox",fp);const{vtkDebugMacro:hp}=jt,mp={};const gp=Pt(function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,mp,r),Xt.extend(e,t,r),function(e,t){t.classHierarchy.push("vtkOpenGLPixelSpaceCallbackMapper"),e.opaquePass=(r,n)=>{t._openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t._openGLRenderWindow=t._openGLRenderer.getLastAncestorOfType("vtkOpenGLRenderWindow");const o=t._openGLRenderer.getAspectRatio(),i=t._openGLRenderer?t._openGLRenderer.getRenderable().getActiveCamera():null,a=t._openGLRenderer.getTiledSizeAndOrigin();let s=null;if(t.renderable.getUseZValues()){const e=n.getZBufferTexture(),r=Math.floor(e.getWidth()),o=Math.floor(e.getHeight()),i=t._openGLRenderWindow.getContext();e.bind();const a=n.getFramebuffer();a?a.saveCurrentBindingsAndBuffers():hp("No framebuffer to save/restore");const l=i.createFramebuffer();i.bindFramebuffer(i.FRAMEBUFFER,l),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e.getHandle(),0),i.checkFramebufferStatus(i.FRAMEBUFFER)===i.FRAMEBUFFER_COMPLETE&&(s=new Uint8Array(r*o*4),i.viewport(0,0,r,o),i.readPixels(0,0,r,o,i.RGBA,i.UNSIGNED_BYTE,s)),a&&a.restorePreviousBindingsAndBuffers(),i.deleteFramebuffer(l)}t.renderable.invokeCallback(t.renderable.getInputData(),i,o,a,s)},e.queryPass=(e,r)=>{e&&t.renderable.getUseZValues()&&r.requestDepth()}}(e,t)},"vtkOpenGLPixelSpaceCallbackMapper");Qt("vtkPixelSpaceCallbackMapper",gp);const yp=Object.create(null);function vp(e,t){yp[e]=t}const bp={};function xp(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,bp,r),t.overrides=yp,Yt.extend(e,t,r),function(e,t){t.classHierarchy.push("vtkWebGPUViewNodeFactory")}(0,t)}var _p={newInstance:zt.newInstance(xp,"vtkWebGPUViewNodeFactory"),extend:xp};const Sp={keyMatrixTime:null,keyMatrices:null};const Cp=zt.newInstance(function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Sp,r),Xt.extend(e,t,r),t.keyMatrixTime={},zt.obj(t.keyMatrixTime),t.keyMatrices={normalMatrix:new Float64Array(16),vcpc:new Float64Array(16),pcsc:new Float64Array(16),wcvc:new Float64Array(16),scpc:new Float64Array(16),scvc:new Float64Array(16)},zt.setGet(e,t,["keyMatrixTime"]),function(e,t){t.classHierarchy.push("vtkWebGPUCamera"),e.getProjectionMatrix=(e,r,n,o)=>{if(h(e),t.renderable.getParallelProjection()){const i=t.renderable.getParallelScale(),a=i*r,s=i,l=(o[0]-1)*a,u=(o[0]+1)*a,c=(o[1]-1)*s,d=(o[1]+1)*s,p=1/(u-l),f=1/(d-c);e[0]=2*p,e[5]=2*f,e[10]=1/(n[1]-n[0]),e[12]=(u+l)*p,e[13]=(d+c)*f,e[14]=n[1]/(n[1]-n[0])}else{const i=Math.tan(Math.PI*t.renderable.getViewAngle()/360);let a,s;!0===t.renderable.getUseHorizontalViewAngle()?(a=n[0]*i,s=n[0]*i/r):(a=n[0]*i*r,s=n[0]*i);const l=(o[0]-1)*a,u=(o[0]+1)*a,c=(o[1]-1)*s,d=(o[1]+1)*s;e[0]=2*n[0]/(u-l),e[5]=2*n[0]/(d-c),e[12]=(l+u)/(u-l),e[13]=(c+d)/(d-c),e[10]=0,e[14]=n[0],e[11]=-1,e[15]=0}},e.convertToOpenGLDepth=e=>{if(t.renderable.getParallelProjection())return 1-e;const r=t.renderable.getClippingRangeByReference();let n=-r[0]/e;return n=(r[0]+r[1])/(r[1]-r[0])+2*r[0]*r[1]/(n*(r[1]-r[0])),.5*n+.5},e.getKeyMatrices=r=>{const n=r.getRenderable(),o=r.getParent();if(Math.max(o.getMTime(),e.getMTime(),n.getMTime(),t.renderable.getMTime(),r.getStabilizedTime())>t.keyMatrixTime.getMTime()){const n=t.renderable.getViewMatrix();d(t.keyMatrices.normalMatrix,n),t.keyMatrices.normalMatrix[3]=0,t.keyMatrices.normalMatrix[7]=0,t.keyMatrices.normalMatrix[11]=0,g(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),m(t.keyMatrices.wcvc,n);const o=r.getStabilizedCenterByReference();x(t.keyMatrices.scvc,t.keyMatrices.wcvc,o);const i=r.getAspectRatio(),a=t.renderable.getClippingRangeByReference();e.getProjectionMatrix(t.keyMatrices.vcpc,i,a,t.renderable.getWindowCenterByReference()),b(t.keyMatrices.scpc,t.keyMatrices.vcpc,t.keyMatrices.scvc),g(t.keyMatrices.pcsc,t.keyMatrices.scpc),t.keyMatrixTime.modified()}return t.keyMatrices}}(e,t)});vp("vtkCamera",Cp);const Tp={device:null,handle:null,label:null};function wp(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tp,r),zt.obj(e,t),t.bindables=[],t.bindGroupTime={},zt.obj(t.bindGroupTime,{mtime:0}),zt.get(e,t,["bindGroupTime","handle","sizeInBytes","usage"]),zt.setGet(e,t,["label","device","arrayInformation"]),function(e,t){t.classHierarchy.push("vtkWebGPUBindGroup"),e.setBindables=r=>{if(t.bindables.length===r.length){let e=!0;for(let n=0;n{const r=[];for(let e=0;e{let n=e.getMTime();for(let e=0;en?r:n}if(n{const r=[],n=e.getBindGroupLayoutCount(t.label);for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ep,r),zt.obj(e,t),zt.get(e,t,["lastCameraMTime"]),zt.setGet(e,t,["device","handle"]),function(e,t){t.classHierarchy.push("vtkWebGPUShaderModule"),e.initialize=(e,r)=>{t.device=e,t.handle=t.device.getHandle().createShaderModule({code:r.getCode()})}}(e,t)}var Pp={newInstance:zt.newInstance(Dp,"vtkWebGPUShaderModule"),extend:Dp};const Ip={shaderModules:null,device:null,window:null};function Op(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ip,r),t._shaderModules=new Map,zt.obj(e,t),zt.setGet(e,t,["device","window"]),function(e,t){t.classHierarchy.push("vtkWebGPUShaderCache"),e.getShaderModule=e=>{const r=e.getType(),n=e.getHash(),o=t._shaderModules.keys();for(let e=0;e3&&void 0!==arguments[3])||arguments[3];const o=Array.isArray(r)?r.join("\n"):r;let i=!1;-1!==e.search(t)&&(i=!0);let a="";n&&(a="g");const s=new RegExp(t,a);return{replace:i,result:e.replace(s,o)}}};const Mp={handle:null,layouts:null,renderEncoder:null,shaderDescriptions:null,vertexState:null,topology:null,pipelineDescription:null};function Rp(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Mp,r),mt(e,t),t.layouts=[],t.shaderDescriptions=[],yt(e,t,["handle","pipelineDescription"]),_t(e,t,["device","renderEncoder","topology","vertexState"]),function(e,t){t.classHierarchy.push("vtkWebGPUPipeline"),e.getShaderDescriptions=()=>t.shaderDescriptions,e.initialize=(e,r)=>{t.pipelineDescription=t.renderEncoder.getPipelineSettings(),t.pipelineDescription.primitive.topology=t.topology,t.pipelineDescription.vertex=t.vertexState,t.pipelineDescription.label=r;const n=[];for(let e=0;e{for(let r=0;r{e&&t.layouts.push({layout:e.getBindGroupLayout(t.device),label:e.getLabel()})},e.getBindGroupLayout=e=>t.layouts[e].layout,e.getBindGroupLayoutCount=e=>{for(let r=0;r{t.bindBuffers(e)}}(e,t)}var Fp={newInstance:Pt(Rp,"vtkWebGPUPipeline"),extend:Rp};const Bp={type:null,hash:null,code:null,outputNames:null,outputTypes:null};function Lp(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bp,r),t.outputNames=[],t.outputTypes=[],t.outputInterpolations=[],t.builtinOutputNames=[],t.builtinOutputTypes=[],t.builtinInputNames=[],t.builtinInputTypes=[],zt.obj(e,t),zt.setGet(e,t,["type","hash","code"]),zt.getArray(e,t,["outputTypes","outputNames","outputInterpolations"]),function(e,t){t.classHierarchy.push("vtkWebGPUShaderDescription"),e.hasOutput=e=>t.outputNames.includes(e),e.addOutput=function(e,r){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;t.outputTypes.push(e),t.outputNames.push(r),t.outputInterpolations.push(n)},e.addBuiltinOutput=(e,r)=>{t.builtinOutputTypes.push(e),t.builtinOutputNames.push(r)},e.addBuiltinInput=(e,r)=>{t.builtinInputTypes.push(e),t.builtinInputNames.push(r)},e.replaceShaderCode=(e,r)=>{const n=[];let o=[];if(r&&n.push(r.getShaderCode()),e||t.builtinInputNames.length){const r=[];if(r.push(`struct ${t.type}Input\n{`),e){const t=e.getOutputNamesByReference(),n=e.getOutputTypesByReference(),o=e.getOutputInterpolationsByReference();for(let e=0;e1&&(r.push("};"),o=r,n[n.length-1]+=",",n.push(`input: ${t.type}Input`))}if(n.length&&(t.code=Np.substitute(t.code,"//VTK::IOStructs::Input",n).result),t.outputNames.length+t.builtinOutputNames.length){const e=[`struct ${t.type}Output\n{`];for(let r=0;r ${t.type}Output`]).result}t.code=Np.substitute(t.code,"//VTK::IOStructs::Dec",o).result}}(e,t)}var kp={newInstance:zt.newInstance(Lp,"vtkWebGPUShaderDescription"),extend:Lp};const Up={r8unorm:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"float"},r8snorm:{numComponents:1,nativeType:Int8Array,stride:1,elementSize:1,sampleType:"float"},r8uint:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"uint"},r8sint:{numComponents:1,nativeType:Int8Array,stride:1,elementSize:1,sampleType:"sint"},r16uint:{numComponents:1,nativeType:Uint16Array,stride:2,elementSize:2,sampleType:"uint"},r16sint:{numComponents:1,nativeType:Int16Array,stride:2,elementSize:2,sampleType:"sint"},r16float:{numComponents:1,nativeType:Float32Array,stride:2,elementSize:2,sampleType:"float"},rg8unorm:{numComponents:2,nativeType:Uint8Array,stride:2,elementSize:1,sampleType:"float"},rg8snorm:{numComponents:2,nativeType:Int8Array,stride:2,elementSize:1,sampleType:"float"},rg8uint:{numComponents:2,nativeType:Uint8Array,stride:2,elementSize:1,sampleType:"uint"},rg8sint:{numComponents:2,nativeType:Int8Array,stride:2,elementSize:1,sampleType:"sint"},r32uint:{numComponents:1,nativeType:Uint32Array,stride:4,elementSize:4,sampleType:"uint"},r32sint:{numComponents:1,nativeType:Int32Array,stride:4,elementSize:4,sampleType:"sint"},r32float:{numComponents:1,nativeType:Float32Array,stride:4,elementSize:4,sampleType:"unfilterable-float"},rg16uint:{numComponents:2,nativeType:Uint16Array,stride:4,elementSize:2,sampleType:"uint"},rg16sint:{numComponents:2,nativeType:Int16Array,stride:4,elementSize:2,sampleType:"sint"},rg16float:{numComponents:2,nativeType:Float32Array,stride:4,elementSize:2,sampleType:"float"},rgba8unorm:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},"rgba8unorm-srgb":{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},rgba8snorm:{numComponents:4,nativeType:Int8Array,stride:4,elementSize:1,sampleType:"float"},rgba8uint:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"uint"},rgba8sint:{numComponents:4,nativeType:Int8Array,stride:4,elementSize:1,sampleType:"sint"},bgra8unorm:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},"bgra8unorm-srgb":{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},rgb9e5ufloat:{numComponents:4,nativeType:Uint32Array,stride:4,sampleType:"float"},rgb10a2unorm:{numComponents:4,nativeType:Uint32Array,stride:4,sampleType:"float"},rg11b10ufloat:{numComponents:4,nativeType:Float32Array,stride:4,sampleType:"float"},rg32uint:{numComponents:2,nativeType:Uint32Array,stride:8,elementSize:4,sampleType:"uint"},rg32sint:{numComponents:2,nativeType:Int32Array,stride:8,elementSize:4,sampleType:"sint"},rg32float:{numComponents:2,nativeType:Float32Array,stride:8,elementSize:4,sampleType:"unfilterable-float"},rgba16uint:{numComponents:4,nativeType:Uint16Array,stride:8,elementSize:2,sampleType:"uint"},rgba16sint:{numComponents:4,nativeType:Int16Array,stride:8,elementSize:2,sampleType:"sint"},rgba16float:{numComponents:4,nativeType:Float32Array,stride:8,elementSize:2,sampleType:"float"},rgba32uint:{numComponents:4,nativeType:Uint32Array,stride:16,elementSize:4,sampleType:"uint"},rgba32sint:{numComponents:4,nativeType:Int32Array,stride:16,elementSize:4,sampleType:"sint"},rgba32float:{numComponents:4,nativeType:Float32Array,stride:16,elementSize:4,sampleType:"unfilterable-float"},stencil8:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"uint"},depth16unorm:{numComponents:1,nativeType:Uint16Array,stride:2,elementSize:2,sampleType:"depth"},depth24plus:{numComponents:1,nativeType:Uint32Array,stride:4,elementSize:3,sampleType:"depth"},"depth24plus-stencil8":{numComponents:2,nativeType:Uint32Array,stride:4,sampleType:"mixed"},depth32float:{numComponents:1,nativeType:Float32Array,stride:4,elementSize:4,sampleType:"depth"}};var Vp=function(e){return!e||e.length<6?0:e in Up==1?Up[e]:(Ze(`unknown format ${e}`),null)},Gp=function(e){if(!e||e.length<5)return 0;let t=1;"x"===e[e.length-2]&&(t=Number(e[e.length-1]));const r=1===t?e.length-1:e.length-3,n=Number(e[r]);return Number.isNaN(n)?(Ze(`unknown format ${e}`),0):t*(5-n/2)},zp=function(e){if(!e||e.length<5)return 0;let t=1;return"x"===e[e.length-2]&&(t=Number(e[e.length-1])),t},jp=function(e){if(!e||e.length<5)return 0;let t;if("f"===e[0])t="Float";else if("s"===e[0])t="Int";else{if("u"!==e[0])return void Ze(`unknown format ${e}`);t="Uint"}const r=e.split("x")[0],n=Number(r[r.length-1]);if(!Number.isNaN(n))return t+=8*(5-n/2),t+="Array",t;Ze(`unknown format ${e}`)},Wp=function(e){let t;if("f"===e[0]||"n"===e[1])t="f32";else if("s"===e[0]&&"i"===e[1])t="i32";else{if("u"!==e[0]||"i"!==e[1])return void Ze(`unknown format ${e}`);t="u32"}let r=1;return"x"===e[e.length-2]&&(r=Number(e[e.length-1])),4===r?`vec4<${t}>`:3===r?`vec3<${t}>`:2===r?`vec2<${t}>`:t},Hp=function(e){if(!e)return 0;let t=1;return"vec"===e.substring(0,3)?t=Number(e[3]):"mat"===e.substring(0,3)&&(t=e[3]*e[5]),4*t},Kp=function(e){if(e)return e.includes("f32")?"Float32Array":e.includes("i32")?"Int32Array":e.includes("u32")?"Uint32Array":void Ze(`unknown format ${e}`)};function Xp(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,$p,r),mt(e,t),t.bindingDescriptions=[],t.attributeDescriptions=[],t.inputs=[],_t(e,t,["created","device","handle","indexBuffer"]),function(e,t){t.classHierarchy.push("vtkWebGPUVertexInput"),e.addBuffer=function(e,r){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"vertex",o=r;Array.isArray(o)||(o=[o]);for(let r=0;re.names[0]t.names[0]?1:0)},e.removeBufferIfPresent=e=>{for(let r=0;r{for(let r=0;r{for(let r=0;r{for(let r=0;r{let e="",r=0;for(let n=0;n0&&(e+=",\n"),e=`${e} @location(${r}) ${t.inputs[n].names[o]} : ${a}`,r++}return e},e.getVertexInputInformation=()=>{const e={};if(t.inputs.length){const r=[];let n=0;for(let e=0;e{for(let r=0;r{},e.releaseGraphicsResources=()=>{t.created&&(t.inputs=[],t.bindingDescriptions=[],t.attributeDescriptions=[])}}(e,t)}var Yp={newInstance:Pt(qp,"vtkWebGPUVertexInput"),extend:qp};const Jp={additionalBindables:void 0,bindGroup:null,device:null,fragmentShaderTemplate:null,numberOfInstances:1,numberOfVertices:0,pipelineHash:null,shaderReplacements:null,SSBO:null,textureViews:null,topology:"triangle-list",UBO:null,vertexShaderTemplate:null,WebGPURenderer:null};function Qp(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Jp,r),Xt.extend(e,t,r),t.textureViews=[],t.vertexInput=Yp.newInstance(),t.bindGroup=Ap.newInstance({label:"mapperBG"}),t.additionalBindables=[],t.fragmentShaderTemplate=t.fragmentShaderTemplate||"\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : fragmentOutput;\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::Light::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Select::Impl\n\n // var computedColor:vec4 = vec4(1.0,0.5,0.5,1.0);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n",t.vertexShaderTemplate=t.vertexShaderTemplate||"\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@vertex\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : vertexOutput;\n\n // var vertex: vec4 = vertexBC;\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Select::Impl\n\n //VTK::Position::Impl\n\n return output;\n}\n",t.shaderReplacements=new Map,zt.get(e,t,["pipeline","vertexInput"]),zt.setGet(e,t,["additionalBindables","device","fragmentShaderTemplate","interpolate","numberOfInstances","numberOfVertices","pipelineHash","shaderReplacements","SSBO","textureViews","topology","UBO","vertexShaderTemplate","WebGPURenderer"]),function(e,t){t.classHierarchy.push("vtkWebGPUSimpleMapper"),e.generateShaderDescriptions=(r,n,o)=>{const i=kp.newInstance({type:"vertex",hash:r,code:t.vertexShaderTemplate}),a=kp.newInstance({type:"fragment",hash:r,code:t.fragmentShaderTemplate}),s=n.getShaderDescriptions();s.push(i),s.push(a);const l=t.vertexShaderTemplate+t.fragmentShaderTemplate,u=new RegExp("//VTK::[^:]*::","g"),c=l.match(u).filter((e,t,r)=>r.indexOf(e)===t),d=c.map(e=>`replaceShader${e.substring(7,e.length-2)}`);for(let e=0;e{const n=t.getShaderDescription("vertex");n.replaceShaderCode(null,r),t.getShaderDescription("fragment").replaceShaderCode(n)},e.replaceShaderRenderEncoder=(e,r,n)=>{t.renderEncoder.replaceShaderCode(r)},t.shaderReplacements.set("replaceShaderRenderEncoder",e.replaceShaderRenderEncoder),e.replaceShaderRenderer=(e,r,n)=>{if(!t.WebGPURenderer)return;const o=t.WebGPURenderer.getBindGroup().getShaderCode(r),i=r.getShaderDescription("vertex");let a=i.getCode();a=Np.substitute(a,"//VTK::Renderer::Dec",[o]).result,i.setCode(a);const s=r.getShaderDescription("fragment");a=s.getCode(),a=Np.substitute(a,"//VTK::Renderer::Dec",[o]).result,s.setCode(a)},t.shaderReplacements.set("replaceShaderRenderer",e.replaceShaderRenderer),e.replaceShaderMapper=(e,r,n)=>{const o=t.bindGroup.getShaderCode(r),i=r.getShaderDescription("vertex");let a=i.getCode();a=Np.substitute(a,"//VTK::Mapper::Dec",[o]).result,i.setCode(a);const s=r.getShaderDescription("fragment");s.addBuiltinInput("bool","@builtin(front_facing) frontFacing"),a=s.getCode(),a=Np.substitute(a,"//VTK::Mapper::Dec",[o]).result,s.setCode(a)},t.shaderReplacements.set("replaceShaderMapper",e.replaceShaderMapper),e.replaceShaderPosition=(e,t,r)=>{const n=t.getShaderDescription("vertex");n.addBuiltinOutput("vec4","@builtin(position) Position");let o=n.getCode();o=Np.substitute(o,"//VTK::Position::Impl",[" output.Position = rendererUBO.SCPCMatrix*vertexBC;"]).result,n.setCode(o)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderTCoord=(e,t,r)=>{t.getShaderDescription("vertex").addOutput("vec2","tcoordVS")},t.shaderReplacements.set("replaceShaderTCoord",e.replaceShaderTCoord),e.addTextureView=e=>{t.textureViews.includes(e)||t.textureViews.push(e)},e.prepareToDraw=r=>{t.renderEncoder=r,e.updateInput(),e.updateBuffers(),e.updateBindings(),e.updatePipeline()},e.updateInput=()=>{},e.updateBuffers=()=>{},e.updateBindings=()=>{t.bindGroup.setBindables(e.getBindables())},e.computePipelineHash=()=>{},e.registerDrawCallback=r=>{r.registerDrawCallback(t.pipeline,e.draw)},e.prepareAndDraw=r=>{e.prepareToDraw(r),r.setPipeline(t.pipeline),e.draw(r)},e.draw=e=>{const r=e.getBoundPipeline();e.activateBindGroup(t.bindGroup),t.WebGPURenderer&&t.WebGPURenderer.bindUBO(e),r.bindVertexInput(e,t.vertexInput);const n=t.vertexInput.getIndexBuffer();n?e.drawIndexed(n.getIndexCount(),t.numberOfInstances,0,0,0):e.draw(t.numberOfVertices,t.numberOfInstances,0,0)},e.getBindables=()=>{const e=[...t.additionalBindables];t.UBO&&e.push(t.UBO),t.SSBO&&e.push(t.SSBO);for(let r=0;r{e.computePipelineHash(),t.pipeline=t.device.getPipeline(t.pipelineHash),t.pipeline||(t.pipeline=Fp.newInstance(),t.pipeline.setDevice(t.device),t.WebGPURenderer&&t.pipeline.addBindGroupLayout(t.WebGPURenderer.getBindGroup()),t.pipeline.addBindGroupLayout(t.bindGroup),e.generateShaderDescriptions(t.pipelineHash,t.pipeline,t.vertexInput),t.pipeline.setTopology(t.topology),t.pipeline.setRenderEncoder(t.renderEncoder),t.pipeline.setVertexState(t.vertexInput.getVertexInputInformation()),t.device.createPipeline(t.pipelineHash,t.pipeline))}}(e,t)}var Zp={newInstance:zt.newInstance(Qp,"vtkWebGPUSimpleMapper"),extend:Qp};const ef={};function tf(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ef,r),Zp.extend(e,t,r),function(e,t){t.classHierarchy.push("vtkWebGPUFullScreenQuad"),e.replaceShaderPosition=(e,t,r)=>{const n=t.getShaderDescription("vertex");n.addBuiltinOutput("vec4","@builtin(position) Position"),n.addOutput("vec4","vertexVC");let o=n.getCode();o=Np.substitute(o,"//VTK::Position::Impl",["output.tcoordVS = vec2(vertexBC.x * 0.5 + 0.5, 1.0 - vertexBC.y * 0.5 - 0.5);","output.Position = vec4(vertexBC, 1.0);","output.vertexVC = vec4(vertexBC, 1);"]).result,n.setCode(o)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.updateBuffers=()=>{const e=t.device.getBufferManager().getFullScreenQuadBuffer();t.vertexInput.addBuffer(e,["vertexBC"]),t.numberOfVertices=6}}(e,t)}var rf={newInstance:zt.newInstance(tf,"vtkWebGPUFullScreenQuad"),extend:tf},nf={BufferUsage:{Verts:0,Lines:1,Triangles:2,Strips:3,LinesFromStrips:4,LinesFromTriangles:5,Points:6,UniformArray:7,PointArray:8,NormalsFromPoints:9,Texture:10,RawVertex:11,Storage:12,Index:13},PrimitiveTypes:{Start:0,Points:0,Lines:1,Triangles:2,TriangleStrips:3,TriangleEdges:4,TriangleStripEdges:5,End:6}};const of=["getMappedRange","mapAsync","unmap"];const af={device:null,handle:null,sizeInBytes:0,strideInBytes:0,arrayInformation:null,usage:null,label:null,sourceTime:null};function sf(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,af,r),zt.obj(e,t),zt.get(e,t,["handle","sizeInBytes","usage"]),zt.setGet(e,t,["strideInBytes","device","arrayInformation","label","sourceTime"]),function(e,t){t.classHierarchy.push("vtkWebGPUBuffer"),e.create=(e,r)=>{t.handle=t.device.getHandle().createBuffer({size:e,usage:r,label:t.label}),t.sizeInBytes=e,t.usage=r},e.write=e=>{!function(e,t,r,n){const o=n.byteLength,i=e.createBuffer({size:o,usage:GPUBufferUsage.COPY_SRC,mappedAtCreation:!0}),a=i.getMappedRange(0,o);new Uint8Array(a).set(new Uint8Array(n)),i.unmap();const s=e.createCommandEncoder();s.copyBufferToBuffer(i,0,t,0,o);const l=s.finish();e.queue.submit([l]),i.destroy()}(t.device.getHandle(),t.handle,0,e.buffer)},e.createAndWrite=(e,r)=>{const n=4*Math.ceil(e.byteLength/4);t.handle=t.device.getHandle().createBuffer({size:n,usage:r,mappedAtCreation:!0,label:t.label}),t.sizeInBytes=n,t.usage=r,new Uint8Array(t.handle.getMappedRange()).set(new Uint8Array(e.buffer)),t.handle.unmap()};for(let r=0;r2)for(let i=0;i2){for(let i=0;i2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,xf,r),lf.extend(e,t,r),zt.setGet(e,t,["flatIdToPointId","flatIdToCellId","flatSize","indexCount"]),function(e,t){t.classHierarchy.push("vtkWebGPUIndexBuffer"),e.buildIndexBuffer=e=>{const r=e.cells,n=e.primitiveType,o=e.representation,i=e.cellOffset,a=r.getData(),s=a.length,l=function(e){switch(e){case cf.Points:return"points";case cf.Lines:return"lines";case cf.Triangles:case cf.TriangleEdges:return"polys";case cf.TriangleStripEdges:case cf.TriangleStrips:return"strips";default:return""}}(n),u=e.numberOfPoints,c={provokedPointIds:new Uint8Array(u),extraPoints:0,iboSize:0,flatId:0,iboId:0,cellProvokedMap:new df};let d=null;d=o===uf.POINTS||n===cf.Points?bf.anythingToPoints:o===uf.WIREFRAME||n===cf.Lines?bf[`${l}ToWireframe`]:bf[`${l}ToSurface`],mf=hf;let p=i||0;for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Df,r),mt(e,t),_t(e,t,["device"]),function(e,t){function r(e){let r,n;if(e.dataArray&&!e.nativeArray&&(e.nativeArray=e.dataArray.getData()),e.usage===Cf.Index&&(r=Sf.newInstance({label:e.label}),r.setDevice(t.device),n=GPUBufferUsage.INDEX|GPUBufferUsage.COPY_DST,r.buildIndexBuffer(e),r.createAndWrite(e.nativeArray,n),r.setArrayInformation([{format:e.format}])),r||(r=lf.newInstance({label:e.label}),r.setDevice(t.device)),e.usage===Cf.UniformArray&&(n=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,r.createAndWrite(e.nativeArray,n)),e.usage===Cf.Storage&&(n=GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST,r.createAndWrite(e.nativeArray,n)),e.usage===Cf.Texture&&(n=GPUBufferUsage.COPY_SRC,r.createAndWrite(e.nativeArray,n)),e.usage===Cf.PointArray){n=GPUBufferUsage.VERTEX;const t=jp(e.format),o=Af(e.indexBuffer,e.dataArray.getData(),e.dataArray.getNumberOfComponents(),t,{packExtra:e.packExtra,shift:e.shift,scale:e.scale,cellData:e.cellData,cellOffset:e.cellOffset});r.createAndWrite(o.nativeArray,n),r.setStrideInBytes(Gp(e.format)),r.setArrayInformation([{offset:0,format:e.format,interpolation:e.cellData?"flat":"perspective"}])}if(e.usage===Cf.NormalsFromPoints){n=GPUBufferUsage.VERTEX;const t=jp(e.format),o=function(e,t){const r=t.getData(),n=e.getData();if(!n||!r)return null;const o=new Int8Array(4*e.getNumberOfCells()),i=n.length;let a=0;for(let e=0;et.device.hasCachedObject(e),e.getBuffer=e=>e.hash?t.device.getCachedObject(e.hash,r,e):r(e),e.getBufferForPointArray=(t,r)=>{const n=function(e){let t;switch(e.getDataType()){case wf.UNSIGNED_CHAR:t="uint8";break;case wf.FLOAT:t="float32";break;case wf.UNSIGNED_INT:t="uint32";break;case wf.INT:t="sint32";break;case wf.DOUBLE:t="float32";break;case wf.UNSIGNED_SHORT:t="uint16";break;case wf.SHORT:t="sin16";break;default:t="float32"}switch(e.getNumberOfComponents()){case 2:t+="x2";break;case 3:t.includes("32")||Tf(`unsupported x3 type for ${t}`),t+="x3";break;case 4:t+="x4"}return t}(t),o={hash:`${t.getMTime()}I${r.getMTime()}${n}`,usage:Cf.PointArray,format:n,dataArray:t,indexBuffer:r};return e.getBuffer(o)},e.getFullScreenQuadBuffer=()=>{if(t.fullScreenQuadBuffer)return t.fullScreenQuadBuffer;t.fullScreenQuadBuffer=lf.newInstance(),t.fullScreenQuadBuffer.setDevice(t.device);const e=new Float32Array([-1,-1,0,1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,1,0]);return t.fullScreenQuadBuffer.createAndWrite(e,GPUBufferUsage.VERTEX),t.fullScreenQuadBuffer.setStrideInBytes(12),t.fullScreenQuadBuffer.setArrayInformation([{offset:0,format:"float32x3"}]),t.fullScreenQuadBuffer}}(e,t)}var If={newInstance:Pt(Pf),extend:Pf,...nf};const{BufferUsage:Of}=If,{vtkErrorMacro:Nf}=zt,Mf={bufferEntries:null,bufferEntryNames:null,sizeInBytes:0,label:null,numberOfInstances:1};function Rf(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Mf,r),zt.obj(e,t),t._bufferEntryNames=new Map,t.bufferEntries=[],t._sendTime={},zt.obj(t._sendTime,{mtime:0}),t.bindGroupTime={},zt.obj(t.bindGroupTime,{mtime:0}),t.bindGroupLayoutEntry=t.bindGroupLayoutEntry||{buffer:{type:"read-only-storage"}},zt.get(e,t,["bindGroupTime"]),zt.setGet(e,t,["device","bindGroupLayoutEntry","label","numberOfInstances","sizeInBytes"]),function(e,t){t.classHierarchy.push("vtkWebGPUStorageBuffer"),e.addEntry=(e,r)=>{if(t._bufferEntryNames.has(e))return void Nf(`entry named ${e} already exists`);t._bufferEntryNames.set(e,t.bufferEntries.length);const n=Hp(r);t.bufferEntries.push({name:e,type:r,sizeInBytes:n,offset:t.sizeInBytes,nativeType:Kp(r)}),t.sizeInBytes+=n},e.send=e=>{if(!t._buffer){const r={nativeArray:t.Float32Array,usage:Of.Storage,label:t.label};return t._buffer=e.getBufferManager().getBuffer(r),t.bindGroupTime.modified(),void t._sendTime.modified()}e.getHandle().queue.writeBuffer(t._buffer.getHandle(),0,t.arrayBuffer,0,t.sizeInBytes*t.numberOfInstances),t._sendTime.modified()},e.createView=e=>{e in t==0&&(t.arrayBuffer||(t.arrayBuffer=new ArrayBuffer(t.sizeInBytes*t.numberOfInstances)),t[e]=zt.newTypedArray(e,t.arrayBuffer))},e.setValue=(r,n,o)=>{const i=t._bufferEntryNames.get(r);if(void 0===i)return void Nf(`entry named ${r} not found in UBO`);const a=t.bufferEntries[i];e.createView(a.nativeType);const s=t[a.nativeType];s[(a.offset+n*t.sizeInBytes)/s.BYTES_PER_ELEMENT]=o},e.setArray=(r,n,o)=>{const i=t._bufferEntryNames.get(r);if(void 0===i)return void Nf(`entry named ${r} not found in UBO`);const a=t.bufferEntries[i];e.createView(a.nativeType);const s=t[a.nativeType],l=(a.offset+n*t.sizeInBytes)/s.BYTES_PER_ELEMENT;for(let e=0;e{const o=t._bufferEntryNames.get(r);if(void 0===o)return void Nf(`entry named ${r} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType],s=n.length/t.numberOfInstances;for(let e=0;e{const o=t._bufferEntryNames.get(r);if(void 0===o)return void Nf(`entry named ${r} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType],s=n.length/t.numberOfInstances;for(let e=0;e{const o=t._bufferEntryNames.get(r);if(void 0===o)return void Nf(`entry named ${r} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType];for(let e=0;et._sendTime.getMTime(),e.getShaderCode=(e,r)=>{const n=[`struct ${t.label}StructEntry\n{`];for(let e=0;e,\n};\n@binding(${e}) @group(${r}) var ${t.label}: ${t.label}Struct;\n`),n.join("\n")},e.getBindGroupEntry=()=>({resource:{buffer:t._buffer.getHandle()}}),e.clearData=()=>{t.numberOfInstances=0,t.sizeInBytes=0,t.bufferEntries=[],t._bufferEntryNames=new Map,t._buffer=null,delete t.arrayBuffer,delete t.Float32Array}}(e,t)}var Ff={newInstance:zt.newInstance(Rf,"vtkWebGPUStorageBuffer"),extend:Rf};const{BufferUsage:Bf}=If,{vtkErrorMacro:Lf}=zt,kf={bufferEntries:null,bufferEntryNames:null,sizeInBytes:0,label:null,bindGroupLayoutEntry:null,bindGroupEntry:null};function Uf(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,kf,r),zt.obj(e,t),t._bufferEntryNames=new Map,t.bufferEntries=[],t.bindGroupLayoutEntry=t.bindGroupLayoutEntry||{buffer:{type:"uniform"}},t.sendTime={},zt.obj(t.sendTime,{mtime:0}),t.bindGroupTime={},zt.obj(t.bindGroupTime,{mtime:0}),t.sendDirty=!0,t.sortDirty=!0,zt.get(e,t,["binding","bindGroupTime"]),zt.setGet(e,t,["bindGroupLayoutEntry","device","label","sizeInBytes"]),function(e,t){t.classHierarchy.push("vtkWebGPUUniformBuffer"),e.addEntry=(e,r)=>{t._bufferEntryNames.has(e)?Lf(`entry named ${e} already exists`):(t.sortDirty=!0,t._bufferEntryNames.set(e,t.bufferEntries.length),t.bufferEntries.push({name:e,type:r,sizeInBytes:Hp(r),offset:-1,nativeType:Kp(r),packed:!1}))},e.sortBufferEntries=()=>{if(!t.sortDirty)return;let e=0;const r=[];let n=4;for(let e=0;e4&&(o.packed=!0,o.offset=e,r.push(o),e+=o.sizeInBytes)}for(let n=0;n{if(!t.UBO){const r={nativeArray:t.Float32Array,usage:Bf.UniformArray,label:t.label};t.UBO=e.getBufferManager().getBuffer(r),t.bindGroupTime.modified(),t.sendDirty=!1}t.sendDirty&&(e.getHandle().queue.writeBuffer(t.UBO.getHandle(),0,t.arrayBuffer,0,t.sizeInBytes),t.sendDirty=!1),t.sendTime.modified()},e.createView=e=>{e in t==0&&(t.arrayBuffer||(t.arrayBuffer=new ArrayBuffer(t.sizeInBytes)),t[e]=zt.newTypedArray(e,t.arrayBuffer))},e.setValue=(r,n)=>{e.sortBufferEntries();const o=t._bufferEntryNames.get(r);if(void 0===o)return void Lf(`entry named ${r} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType];i.lastValue!==n&&(a[i.offset/a.BYTES_PER_ELEMENT]=n,t.sendDirty=!0),i.lastValue=n},e.setArray=(r,n)=>{e.sortBufferEntries();const o=t._bufferEntryNames.get(r);if(void 0===o)return void Lf(`entry named ${r} not found in UBO`);const i=t.bufferEntries[o];e.createView(i.nativeType);const a=t[i.nativeType];let s=!1;for(let e=0;e({resource:{buffer:t.UBO.getHandle()}}),e.getSendTime=()=>t.sendTime.getMTime(),e.getShaderCode=(r,n)=>{e.sortBufferEntries();const o=[`struct ${t.label}Struct\n{`];for(let e=0;e ${t.label}: ${t.label}Struct;`),o.join("\n")}}(e,t)}var Vf={newInstance:zt.newInstance(Uf,"vtkWebGPUUniformBuffer"),extend:Uf};const{vtkDebugMacro:Gf}=jt,zf="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = mapperUBO.BackgroundColor;\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n",jf=new Float64Array(16),Wf=new Float64Array(16);function Hf(e){return e.getPositional()?e.getConeAngle()>=90?0:2:1}const Kf={bindGroup:null,selector:null,renderEncoder:null,recenterThreshold:20,suppressClear:!1,stabilizedCenter:[0,0,0]};const Xf=Pt(function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Kf,r),Xt.extend(e,t,r),t.UBO=Vf.newInstance({label:"rendererUBO"}),t.UBO.addEntry("WCVCMatrix","mat4x4"),t.UBO.addEntry("SCPCMatrix","mat4x4"),t.UBO.addEntry("PCSCMatrix","mat4x4"),t.UBO.addEntry("SCVCMatrix","mat4x4"),t.UBO.addEntry("VCPCMatrix","mat4x4"),t.UBO.addEntry("WCVCNormals","mat4x4"),t.UBO.addEntry("viewportSize","vec2"),t.UBO.addEntry("LightCount","i32"),t.UBO.addEntry("MaxEnvironmentMipLevel","f32"),t.UBO.addEntry("BackgroundDiffuseStrength","f32"),t.UBO.addEntry("BackgroundSpecularStrength","f32"),t.UBO.addEntry("cameraParallel","u32"),t.SSBO=Ff.newInstance({label:"rendererLightSSBO"}),t.lightTimeString="",t.bindGroup=Ap.newInstance({label:"rendererBG"}),t.bindGroup.setBindables([t.UBO,t.SSBO]),t.tmpMat4=h(new Float64Array(16)),t.stabilizedTime={},mt(t.stabilizedTime,{mtime:0}),yt(e,t,["bindGroup","stabilizedTime"]),St(e,t,["stabilizedCenter"]),_t(e,t,["renderEncoder","selector","suppressClear","UBO"]),function(e,t){t.classHierarchy.push("vtkWebGPURenderer"),e.buildPass=r=>{if(r){if(!t.renderable)return;t.camera=t.renderable.getActiveCamera(),e.updateLights(),e.prepareNodes(),e.addMissingNode(t.camera),e.addMissingNodes(t.renderable.getViewPropsWithNestedProps()),e.removeUnusedNodes(),t.webgpuCamera=e.getViewNodeFor(t.camera,t.webgpuCamera),e.updateStabilizedMatrix()}},e.updateStabilizedMatrix=()=>{const e=t.camera.getClippingRange(),r=t.camera.getPositionByReference(),n=[],o=[];vr(o,t.camera.getDirectionOfProjectionByReference(),.5*(e[0]+e[1])),gr(n,r,o),wr(o,n,t.stabilizedCenter),Ar(o)/(e[1]-e[0])>t.recenterThreshold&&(t.stabilizedCenter=n,t.stabilizedTime.modified())},e.updateLights=()=>{let e=0;const r=t.renderable.getLightsByReference();for(let t=0;t0&&e++;return e||(Gf("No lights are on, creating one."),t.renderable.createLight()),e},e.updateUBO=()=>{const r=t.UBO.getSendTime();if(t._parent.getMTime()>r||e.getMTime()>r||t.camera.getMTime()>r||t.renderable.getMTime()>r){const r=t.webgpuCamera.getKeyMatrices(e);t.UBO.setArray("WCVCMatrix",r.wcvc),t.UBO.setArray("SCPCMatrix",r.scpc),t.UBO.setArray("PCSCMatrix",r.pcsc),t.UBO.setArray("SCVCMatrix",r.scvc),t.UBO.setArray("VCPCMatrix",r.vcpc),t.UBO.setArray("WCVCNormals",r.normalMatrix),t.UBO.setValue("LightCount",t.renderable.getLights().length),t.UBO.setValue("MaxEnvironmentMipLevel",t.renderable.getEnvironmentTexture()?.getMipLevel()),t.UBO.setValue("BackgroundDiffuseStrength",t.renderable.getEnvironmentTextureDiffuseStrength()),t.UBO.setValue("BackgroundSpecularStrength",t.renderable.getEnvironmentTextureSpecularStrength());const n=e.getYInvertedTiledSizeAndOrigin();t.UBO.setArray("viewportSize",[n.usize,n.vsize]),t.UBO.setValue("cameraParallel",t.camera.getParallelProjection());const o=t._parent.getDevice();t.UBO.sendIfNeeded(o)}},e.updateSSBO=()=>{const r=t.renderable.getLights(),n=t.webgpuCamera.getKeyMatrices(e);let o=`${t.renderable.getMTime()}`;for(let e=0;e"),t.SSBO.addEntry("LightDir","vec4"),t.SSBO.addEntry("LightColor","vec4"),t.SSBO.addEntry("LightData","vec4"),t.SSBO.setAllInstancesFromArray("LightPos",e),t.SSBO.setAllInstancesFromArray("LightDir",o),t.SSBO.setAllInstancesFromArray("LightColor",i),t.SSBO.setAllInstancesFromArray("LightData",a);const s=t._parent.getDevice();t.SSBO.send(s)}t.lightTimeString=o},e.scissorAndViewport=t=>{const r=e.getYInvertedTiledSizeAndOrigin();t.getHandle().setViewport(r.lowerLeftU,r.lowerLeftV,r.usize,r.vsize,0,1),t.getHandle().setScissorRect(r.lowerLeftU,r.lowerLeftV,r.usize,r.vsize)},e.bindUBO=e=>{e.activateBindGroup(t.bindGroup)},e.opaquePass=r=>{r?(t.renderEncoder.begin(t._parent.getCommandEncoder()),e.updateUBO(),e.updateSSBO()):(e.scissorAndViewport(t.renderEncoder),e.clear(),t.renderEncoder.end())},e.clear=()=>{if(t.renderable.getTransparent()||t.suppressClear)return;const r=t._parent.getDevice();if(!t.clearFSQ){t.clearFSQ=rf.newInstance(),t.clearFSQ.setDevice(r),t.clearFSQ.setPipelineHash("clearfsq"),t.clearFSQ.setFragmentShaderTemplate(zf);const e=Vf.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e),t.backgroundTex=t.renderable.getEnvironmentTexture()}if("clearfsqwithtexture"!==t.clearFSQ.getPipelineHash()&&t.renderable.getUseEnvironmentTextureAsBackground()&&t.backgroundTex?.getImageLoaded()){t.clearFSQ.setFragmentShaderTemplate("\nfn vecToRectCoord(dir: vec3) -> vec2 {\n var tau: f32 = 6.28318530718;\n var pi: f32 = 3.14159265359;\n var out: vec2 = vec2(0.0);\n\n out.x = atan2(dir.z, dir.x) / tau;\n out.x += 0.5;\n\n var phix: f32 = length(vec2(dir.x, dir.z));\n out.y = atan2(dir.y, phix) / pi + 0.5;\n\n return out;\n}\n\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var tcoord: vec4 = vec4(input.vertexVC.xy, -1, 1);\n var V: vec4 = normalize(mapperUBO.FSQMatrix * tcoord); // vec2((input.tcoordVS.x - 0.5) * 2, -(input.tcoordVS.y - 0.5) * 2);\n // textureSampleLevel gets rid of some ugly artifacts\n var background = textureSampleLevel(EnvironmentTexture, EnvironmentTextureSampler, vecToRectCoord(V.xyz), 0.0);\n var computedColor: vec4 = vec4(background.rgb, 1);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n");const e=Vf.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e);const n=r.getTextureManager().getTextureForVTKTexture(t.backgroundTex,"EnvironmentTexture");if(n.getReady()){const e=n.createView("EnvironmentTexture");t.clearFSQ.setTextureViews([e]),t.backgroundTexLoaded=!0;const o=t.backgroundTex.getInterpolate()?"linear":"nearest";e.addSampler(r,{addressModeU:"repeat",addressModeV:"clamp-to-edge",addressModeW:"repeat",minFilter:o,magFilter:o,mipmapFilter:"linear"})}t.clearFSQ.setPipelineHash("clearfsqwithtexture")}else if("clearfsqwithtexture"===t.clearFSQ.getPipelineHash()&&!t.renderable.getUseEnvironmentTextureAsBackground()){t.clearFSQ=rf.newInstance(),t.clearFSQ.setDevice(r),t.clearFSQ.setPipelineHash("clearfsq"),t.clearFSQ.setFragmentShaderTemplate(zf);const e=Vf.newInstance({label:"mapperUBO"});e.addEntry("FSQMatrix","mat4x4"),e.addEntry("BackgroundColor","vec4"),t.clearFSQ.setUBO(e)}const n=t.webgpuCamera.getKeyMatrices(e),o=t.renderable.getBackgroundByReference();t.clearFSQ.getUBO().setArray("BackgroundColor",o),m(Wf,n.normalMatrix),oe(jf,n.scvc,n.pcsc),oe(jf,Wf,jf),t.clearFSQ.getUBO().setArray("FSQMatrix",jf),t.clearFSQ.getUBO().sendIfNeeded(r),t.clearFSQ.prepareAndDraw(t.renderEncoder)},e.translucentPass=r=>{r?t.renderEncoder.begin(t._parent.getCommandEncoder()):(e.scissorAndViewport(t.renderEncoder),t.renderEncoder.end())},e.volumeDepthRangePass=r=>{r?t.renderEncoder.begin(t._parent.getCommandEncoder()):(e.scissorAndViewport(t.renderEncoder),t.renderEncoder.end())},e.getAspectRatio=()=>{const e=t._parent.getSizeByReference(),r=t.renderable.getViewportByReference();return e[0]*(r[2]-r[0])/((r[3]-r[1])*e[1])},e.convertToOpenGLDepth=e=>t.webgpuCamera.convertToOpenGLDepth(e),e.getYInvertedTiledSizeAndOrigin=()=>{const r=e.getTiledSizeAndOrigin(),n=t._parent.getSizeByReference();return r.lowerLeftV=n[1]-r.vsize-r.lowerLeftV,r},e.getTiledSizeAndOrigin=()=>{const e=t.renderable.getViewportByReference(),r=[0,0,1,1],n=e[0]-r[0],o=e[1]-r[1],i=t._parent.normalizedDisplayToDisplay(n,o),a=Math.round(i[0]),s=Math.round(i[1]),l=e[2]-r[0],u=e[3]-r[1],c=t._parent.normalizedDisplayToDisplay(l,u);let d=Math.round(c[0])-a,p=Math.round(c[1])-s;return d<0&&(d=0),p<0&&(p=0),{usize:d,vsize:p,lowerLeftU:a,lowerLeftV:s}},e.getPropFromID=e=>{for(let r=0;rt.stabilizedTime.getMTime(),e.releaseGraphicsResources=()=>{null!==t.selector&&t.selector.releaseGraphicsResources()}}(e,t)},"vtkWebGPURenderer");vp("vtkRenderer",Xf);const{CoordinateSystem:$f}=Ka,qf={keyMatricesTime:null,keyMatrices:null,propID:void 0,bufferShift:void 0};const Yf=zt.newInstance(function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,qf,r),Xt.extend(e,t,r),t.keyMatricesTime={},zt.obj(t.keyMatricesTime,{mtime:0}),t.keyMatrices={normalMatrix:new Float64Array(16),bcwc:new Float64Array(16),bcsc:new Float64Array(16)},zt.get(e,t,["propID","keyMatricesTime"]),t.bufferShift=[0,0,0,0],function(e,t){t.classHierarchy.push("vtkWebGPUActor"),e.buildPass=r=>{r&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes())},e.traverseOpaquePass=r=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t.WebGPURenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(r,!0),t.children[0]&&t.children[0].traverse(r),e.apply(r,!1))},e.traverseTranslucentPass=r=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t.WebGPURenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(r,!0),t.children[0]&&t.children[0].traverse(r),e.apply(r,!1))},e.queryPass=(e,r)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?r.incrementOpaqueActorCount():r.incrementTranslucentActorCount()}},e.getBufferShift=r=>(e.getKeyMatrices(r),t.bufferShift),e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.renderable.computeMatrix();const r=t.renderable.getMatrix();t.bufferShift[0]=r[3],t.bufferShift[1]=r[7],t.bufferShift[2]=r[11];const n=e.getStabilizedCenterByReference();t.renderable.getCoordinateSystem()===$f.WORLD&&(t.bufferShift[0]-=n[0],t.bufferShift[1]-=n[1],t.bufferShift[2]-=n[2]),m(t.keyMatrices.bcwc,r),t.renderable.getIsIdentity()?h(t.keyMatrices.normalMatrix):(d(t.keyMatrices.normalMatrix,t.keyMatrices.bcwc),t.keyMatrices.normalMatrix[3]=0,t.keyMatrices.normalMatrix[7]=0,t.keyMatrices.normalMatrix[11]=0,g(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),m(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix)),x(t.keyMatrices.bcwc,t.keyMatrices.bcwc,[-t.bufferShift[0],-t.bufferShift[1],-t.bufferShift[2]]),t.renderable.getCoordinateSystem()===$f.WORLD?x(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-n[0],-n[1],-n[2]]):d(t.keyMatrices.bcsc,t.keyMatrices.bcwc),t.keyMatricesTime.modified()}return t.keyMatrices}}(e,t)});vp("vtkActor",Yf);const{CoordinateSystem:Jf}=Ka,Qf={keyMatricesTime:null,keyMatrices:null,propID:void 0,bufferShift:void 0};const Zf=zt.newInstance(function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qf,r),Xt.extend(e,t,r),t.keyMatricesTime={},zt.obj(t.keyMatricesTime,{mtime:0}),t.keyMatrices={normalMatrix:new Float64Array(16),bcwc:new Float64Array(16),bcsc:new Float64Array(16)},zt.get(e,t,["propID","keyMatricesTime"]),t.bufferShift=[0,0,0,0],function(e,t){t.classHierarchy.push("vtkWebGPUActor2D"),e.buildPass=r=>{r&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getFirstAncestorOfType("vtkWebGPURenderWindow"),void 0===t.propID&&(t.propID=t.WebGPURenderWindow.getUniquePropID()),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes())},e.traverseOpaquePass=r=>{t.renderable&&t.renderable.getNestedVisibility()&&t.renderable.getIsOpaque()&&(!t.WebGPURenderer.getSelector()||t.renderable.getNestedPickable())&&(e.apply(r,!0),t.children[0]&&t.children[0].traverse(r),e.apply(r,!1))},e.traverseTranslucentPass=r=>{!t.renderable||!t.renderable.getNestedVisibility()||t.renderable.getIsOpaque()||t.WebGPURenderer.getSelector()&&!t.renderable.getNestedPickable()||(e.apply(r,!0),t.children[0]&&t.children[0].traverse(r),e.apply(r,!1))},e.queryPass=(e,r)=>{if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?r.incrementOpaqueActorCount():r.incrementTranslucentActorCount()}},e.getBufferShift=r=>(e.getKeyMatrices(r),t.bufferShift),e.getKeyMatrices=e=>{if(Math.max(t.renderable.getMTime(),e.getStabilizedTime())>t.keyMatricesTime.getMTime()){t.bufferShift[0]=0,t.bufferShift[1]=0,t.bufferShift[2]=0;const r=e.getStabilizedCenterByReference();t.renderable.getCoordinateSystem()===Jf.WORLD&&(t.bufferShift[0]-=r[0],t.bufferShift[1]-=r[1],t.bufferShift[2]-=r[2]),h(t.keyMatrices.bcwc),h(t.keyMatrices.normalMatrix),x(t.keyMatrices.bcwc,t.keyMatrices.bcwc,[-t.bufferShift[0],-t.bufferShift[1],-t.bufferShift[2]]),t.renderable.getCoordinateSystem()===Jf.WORLD?x(t.keyMatrices.bcsc,t.keyMatrices.bcwc,[-r[0],-r[1],-r[2]]):d(t.keyMatrices.bcsc,t.keyMatrices.bcwc),t.keyMatricesTime.modified()}return t.keyMatrices}}(e,t)});vp("vtkActor2D",Zf);const eh={};const th=Pt(function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,eh,r),Xt.extend(e,t,r),t.CubeAxesActorHelper=Fc.newCubeAxesActorHelper(),function(e,t){t.classHierarchy.push("vtkWebGPUCubeAxesActor"),e.buildPass=r=>{r&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent(),t.CubeAxesActorHelper.getRenderable()||t.CubeAxesActorHelper.setRenderable(t.renderable),e.prepareNodes(),e.addMissingNode(t.CubeAxesActorHelper.getTmActor()),e.addMissingNode(t.renderable.getGridActor()),e.removeUnusedNodes())},e.opaquePass=(e,r)=>{if(e){const e=t.WebGPURenderer?t.WebGPURenderer.getRenderable().getActiveCamera():null,r=t.WebGPURenderer.getTiledSizeAndOrigin();t.CubeAxesActorHelper.updateAPISpecificData([r.usize,r.vsize],e,t.WebGPURenderWindow.getRenderable())}}}(e,t)},"vtkWebGPUCubeAxesActor");vp("vtkCubeAxesActor",th);const{DisplayLocation:rh}=Hd,nh={color:[1,1,1],opacity:1,pointSize:1,lineWidth:1,representation:Ja.SURFACE,displayLocation:rh.FOREGROUND};function oh(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,nh,r),zt.obj(e,t),zt.setGet(e,t,["opacity","lineWidth","pointSize","displayLocation","representation"]),zt.setGetArray(e,t,["color"],3),function(e,t){t.classHierarchy.push("vtkProperty2D"),e.setDisplayLocationToBackground=()=>e.setDisplayLocation(rh.BACKGROUND),e.setDisplayLocationToForeground=()=>e.setDisplayLocation(rh.FOREGROUND),e.setRepresentationToWireframe=()=>e.setRepresentation(Ja.WIREFRAME),e.setRepresentationToSurface=()=>e.setRepresentation(Ja.SURFACE),e.setRepresentationToPoints=()=>e.setRepresentation(Ja.POINTS),e.getRepresentationAsString=()=>zt.enumToString(Ja,t.representation)}(e,t)}var ih={newInstance:zt.newInstance(oh,"vtkProperty2D"),extend:oh,...Hd};const{BufferUsage:ah,PrimitiveTypes:sh}=If,{Representation:lh}=os,{ScalarMode:uh}=Gl,{CoordinateSystem:ch}=Ka,{DisplayLocation:dh}=ih;function ph(e){return e.indexOf("edge")>=0}const fh={is2D:!1,cellArray:null,currentInput:null,cellOffset:0,primitiveType:0,colorTexture:null,renderEncoder:null,textures:null};function hh(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fh,r),Zp.extend(e,t,r),t.fragmentShaderTemplate='\nstruct PBRData {\n diffuse: vec3,\n specular: vec3,\n}\n\nstruct Material {\n ior: f32,\n roughness: f32,\n metallic: f32,\n base: vec3,\n};\n\nstruct DirectionalLight {\n direction: vec3,\n color: vec3,\n};\n\nstruct PointLight {\n position: vec3,\n color: vec3,\n};\n\nstruct SpotLight {\n position: vec3,\n direction: vec3,\n cones: vec2,\n color: vec3,\n};\n\nconst pi: f32 = 3.14159265359;\n\n// Dot product with the max already in it\nfn mdot(a: vec3, b: vec3) -> f32 {\n return max(0.0, dot(a, b));\n}\n// Dot product with a max in it that does not allow for negative values\n// Physically based rendering is accurate as long as normals are accurate,\n// however this is pretty often not the case. In order to prevent negative\n// values from ruining light calculations and creating zones of zero light,\n// this remapping is used, which smoothly clamps the dot product between\n// zero and one while still maintaining a good amount of accuracy.\nfn cdot(a: vec3, b: vec3) -> f32 {\n var d: f32 = max(0.0, dot(a, b));\n d = pow((d + 1.0) / 2.0, 2.6);\n return d;\n}\n\n// Lambertian diffuse model\nfn lambertDiffuse(base: vec3, N: vec3, L: vec3) -> vec3 {\n var NdotL: f32 = mdot(N, L);\n NdotL = pow(NdotL, 1.5);\n return (base/pi)*NdotL;\n}\n\n// Yasuhiro Fujii improvement on the Oren-Nayar model\n// https://mimosa-pudica.net/improved-oren-nayar.html\n// p is surface color, o is roughness\nfn fujiiOrenNayar(p: vec3, o: f32, N: vec3, L: vec3, V: vec3) -> vec3 {\n var invpi: f32 = 0.31830988618; // 1/pi\n\n var o2 = o*o;\n var NdotL: f32 = mdot(N, L);\n NdotL = pow(NdotL, 1.5); // Less physically accurate, but hides the "seams" between lights better\n\n var NdotV: f32 = mdot(N, V);\n var LdotV: f32 = mdot(L, V);\n\n var s: f32 = LdotV - NdotL*NdotV;\n var t: f32 = mix(1.0, max(NdotL, NdotV), step(0.0, s)); // Mix with step is the equivalent of an if statement\n var A: vec3 = 0.5*(o2 / (o2 + 0.33)) + 0.17*p*(o2 / (o2 + 0.13));\n A = invpi*(1 - A);\n var B: f32 = 0.45*(o2 / (o2 + 0.09));\n B = invpi*B;\n\n return p*NdotL*(A + B*(s/t));\n}\n\n// Fresnel portion of BRDF (IOR only, simplified)\nfn schlickFresnelIOR(V: vec3, N: vec3, ior: f32, k: f32) -> f32 {\n var NdotV: f32 = mdot(V, N);\n var F0: f32 = (pow((ior - 1.0), 2.0) + k*k) / (pow((ior + 1.0), 2.0) + k*k); // This takes into account the roughness, which the other one does not\n return F0 + (1.0 - F0) * pow((1.0-NdotV), 5.0);\n}\n\n// Fresnel portion of BRDF (Color ior, better)\nfn schlickFresnelRGB(V: vec3, N: vec3, F0: vec3) -> vec3 {\n var NdotV: f32 = mdot(V, N);\n return F0 + (1.0 - F0) * pow((1-NdotV), 5.0);\n}\n\n// Normal portion of BRDF\n// https://learnopengl.com/PBR/Theory\n// Trowbridge-Reitz GGX functions: normal, halfway, roughness^2\nfn trGGX(N: vec3, H: vec3, a: f32) -> f32 {\n var a2: f32 = a*a;\n var NdotH = mdot(N, H);\n var NdotH2 = NdotH*NdotH;\n\n var denom: f32 = NdotH2 * (a2 - 1.0) + 1.0;\n\n return a2 / max((pi*denom*denom), 0.000001);\n}\n\n// A VERY bad approximation of anisotropy. Real anisotropic calculations require tangent and bitangent\nfn anisotrophicTrGGX(N: vec3, H: vec3, O: vec3, s: f32, a: f32) -> f32 {\n var Op: vec3 = (rendererUBO.WCVCNormals * vec4(normalize(O) * s, 0.)).xyz;\n\n var ggx1: f32 = trGGX(N + Op*s, H, a);\n var ggx2: f32 = trGGX(N - Op*s, H, a);\n return (0.5 * ggx1 + 0.5 * ggx2);\n}\n\n// Geometry portion of BRDF\nfn schlickGGX(N: vec3, X: vec3, k: f32) -> f32 {\n var NdotX = cdot(N, X);\n return NdotX / max(0.000001, (NdotX*(1.0-k) + k));\n}\n\nfn smithSurfaceRoughness(N: vec3, V: vec3, L: vec3, k: f32) -> f32 {\n var ggx1: f32 = min(1.0, schlickGGX(N, V, k));\n var ggx2: f32 = min(1.0, schlickGGX(N, L, k));\n return ggx1*ggx2;\n}\n\n// BRDF Combination\nfn cookTorrance(D: f32, F: f32, G: f32, N: vec3, V: vec3, L: vec3) -> f32 {\n var num: f32 = D*F*G;\n var denom: f32 = 4*cdot(V, N)*cdot(L, N);\n\n return num / max(denom, 0.000001);\n}\n\n// Different lighting calculations for different light sources\nfn calcDirectionalLight(N: vec3, V: vec3, mat: Material, light: DirectionalLight) -> PBRData {\n var L: vec3 = normalize(light.direction); // Light Vector\n var H: vec3 = normalize(L + V); // Halfway Vector\n\n var alpha = mat.roughness * mat.roughness;\n var k: f32 = alpha * alpha / 2.0;\n\n var D: f32 = trGGX(N, H, alpha); // Distribution\n // var F: f32 = schlickFresnelIOR(V, N, ior, k); // Fresnel\n var G: f32 = smithSurfaceRoughness(N, V, L, k); // Geometry\n\n var brdf: f32 = cookTorrance(D, 1.0, G, N, V, L); // Fresnel term is replaced with 1 because it is added later\n var incoming: vec3 = light.color;\n var angle: f32 = mdot(L, N);\n angle = pow(angle, 1.5);\n\n var specular: vec3 = brdf * incoming * angle;\n // Oren-Nayar gives a clay-like effect when fully rough which some people may not want, so it might be better to give a separate\n // control property for the diffuse vs specular roughness\n var diffuse: vec3 = incoming * fujiiOrenNayar(mat.base, mat.roughness, N, L, V);\n // Stores the specular and diffuse separately to allow for finer post processing\n var out = PBRData(diffuse, specular);\n\n return out; // Returns angle along with color of light so the final color can be multiplied by angle as well (creates black areas)\n}\n\nfn calcPointLight(N: vec3, V: vec3, fragPos: vec3, mat: Material, light: PointLight) -> PBRData {\n var L: vec3 = normalize(light.position - fragPos);\n var H: vec3 = normalize(L + V);\n var dist = distance(light.position, fragPos);\n\n var alpha = mat.roughness * mat.roughness;\n var k: f32 = alpha * alpha / 2.0;\n\n var D: f32 = trGGX(N, H, alpha); // Distribution\n var F: f32 = schlickFresnelIOR(V, N, mat.ior, k); // Fresnel\n var G: f32 = smithSurfaceRoughness(N, V, L, k); // Geometry\n\n var brdf: f32 = cookTorrance(D, 1.0, G, N, V, L);\n var incoming: vec3 = light.color * (1.0 / (dist * dist));\n var angle: f32 = mdot(L, N);\n angle = pow(angle, 1.5); // Smoothing factor makes it less accurate, but reduces ugly "seams" between light sources\n\n var specular: vec3 = brdf * incoming * angle;\n var diffuse: vec3 = incoming * fujiiOrenNayar(mat.base, mat.roughness, N, L, V);\n // Stores the specular and diffuse separately to allow for finer post processing\n // Could also be done (propably more properly) with a struct\n var out = PBRData(diffuse, specular);\n\n return out; // Returns angle along with color of light so the final color can be multiplied by angle as well (creates black areas)\n}\n\n// For a reason unknown to me, spheres dont seem to behave propperly with head-on spot lights\nfn calcSpotLight(N: vec3, V: vec3, fragPos: vec3, mat: Material, light: SpotLight) -> PBRData {\n var L: vec3 = normalize(light.position - fragPos);\n var H: vec3 = normalize(L + V); // Halfway Vector\n var dist = distance(light.position, fragPos);\n\n var alpha = mat.roughness * mat.roughness;\n var k: f32 = alpha * alpha / 2.0; // could also be pow(alpha + 1.0, 2) / 8\n\n var D: f32 = trGGX(N, H, alpha); // Distribution\n // var F: f32 = schlickFresnelIOR(V, N, ior, k); // Fresnel\n var G: f32 = smithSurfaceRoughness(N, V, L, k); // Geometry\n\n var brdf: f32 = cookTorrance(D, 1.0, G, N, V, L);\n\n var theta: f32 = mdot(normalize(light.direction), L);\n var epsilon: f32 = light.cones.x - light.cones.y;\n var intensity: f32 = (theta - light.cones.y) / epsilon;\n intensity = clamp(intensity, 0.0, 1.0);\n intensity /= dist * dist;\n\n var incoming: vec3 = light.color * intensity;\n\n var angle: f32 = mdot(L, N);\n angle = pow(angle, 1.5); // Smoothing factor makes it less accurate, but reduces ugly "seams" between light sources\n\n var specular: vec3 = brdf * incoming * angle;\n var diffuse: vec3 = incoming * fujiiOrenNayar(mat.base, mat.roughness, N, L, V);\n\n // Stores the specular and diffuse separately to allow for finer post processing\n // Could also be done (propably more properly) with a struct\n var out = PBRData(diffuse, specular);\n\n return out; // Returns angle along with color of light so the final color can be multiplied by angle as well (creates black areas)\n}\n\n// Environment mapping stuff\n// Takes in a vector and converts it to an equivalent coordinate in a rectilinear texture. Should be replaced with cubemaps at some point\nfn vecToRectCoord(dir: vec3) -> vec2 {\n var tau: f32 = 6.28318530718;\n var out: vec2 = vec2(0.0);\n\n out.x = atan2(dir.z, dir.x) / tau;\n out.x += 0.5;\n\n var phix: f32 = length(vec2(dir.x, dir.z));\n out.y = atan2(dir.y, phix) / pi + 0.5;\n\n return out;\n}\n\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::TCoord::Dec\n\n// optional surface normal declaration\n//VTK::Normal::Dec\n\n//VTK::Select::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : fragmentOutput;\n\n // Temporary ambient, diffuse, and opacity\n var ambientColor: vec4 = mapperUBO.AmbientColor;\n var diffuseColor: vec4 = mapperUBO.DiffuseColor;\n var opacity: f32 = mapperUBO.Opacity;\n var ior: f32 = mapperUBO.BaseIOR;\n\n // This should be declared somewhere else\n var _diffuseMap: vec4 = vec4(1.0);\n var _roughnessMap: vec4 = vec4(1.0);\n var _metallicMap: vec4 = vec4(1.0);\n var _normalMap: vec4 = vec4(0.0, 0.0, 1.0, 0.0); // normal map was setting off the normal vector detection in fragment\n var _ambientOcclusionMap: vec4 = vec4(1.);\n var _emissionMap: vec4 = vec4(0.);\n\n //VTK::Color::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Normal::Impl\n\n var computedColor: vec4 = vec4(diffuseColor.rgb, 1.0);\n\n //VTK::Light::Impl\n\n //VTK::Select::Impl\n\n // Use texture alpha for transparency\n computedColor.a = mapperUBO.Opacity * _diffuseMap.a;\n if (computedColor.a == 0.0) { discard; };\n\n //VTK::Position::Impl\n\n //VTK::RenderEncoder::Impl\n\n return output;\n}\n',t.vertexShaderTemplate="\n//VTK::Renderer::Dec\n\n//VTK::Color::Dec\n\n//VTK::Normal::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Select::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@vertex\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : vertexOutput;\n\n var vertex: vec4 = vertexBC;\n\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Select::Impl\n\n //VTK::Position::Impl\n\n return output;\n}\n",t._tmpMat3=pe(new Float64Array(9)),t._tmpMat4=h(new Float64Array(16)),t.UBO=Vf.newInstance({label:"mapperUBO"}),t.UBO.addEntry("BCWCMatrix","mat4x4"),t.UBO.addEntry("BCSCMatrix","mat4x4"),t.UBO.addEntry("MCWCNormals","mat4x4"),t.UBO.addEntry("AmbientColor","vec4"),t.UBO.addEntry("DiffuseColor","vec4"),t.UBO.addEntry("EdgeColor","vec4"),t.UBO.addEntry("SpecularColor","vec4"),t.UBO.addEntry("AmbientIntensity","f32"),t.UBO.addEntry("DiffuseIntensity","f32"),t.UBO.addEntry("Roughness","f32"),t.UBO.addEntry("Metallic","f32"),t.UBO.addEntry("Ambient","f32"),t.UBO.addEntry("Normal","f32"),t.UBO.addEntry("Emission","f32"),t.UBO.addEntry("NormalStrength","f32"),t.UBO.addEntry("BaseIOR","f32"),t.UBO.addEntry("SpecularIntensity","f32"),t.UBO.addEntry("LineWidth","f32"),t.UBO.addEntry("Opacity","f32"),t.UBO.addEntry("ZValue","f32"),t.UBO.addEntry("PropID","u32"),t.UBO.addEntry("ClipNear","f32"),t.UBO.addEntry("ClipFar","f32"),t.UBO.addEntry("Time","u32"),_t(e,t,["cellArray","currentInput","cellOffset","is2D","primitiveType","renderEncoder"]),t.textures=[],function(e,t){t.classHierarchy.push("vtkWebGPUCellArrayMapper"),e.buildPass=r=>{r&&(t.is2D?(t.WebGPUActor=e.getFirstAncestorOfType("vtkWebGPUActor2D"),t.forceZValue=!0):(t.WebGPUActor=e.getFirstAncestorOfType("vtkWebGPUActor"),t.forceZValue=!1),t.coordinateSystem=t.WebGPUActor.getRenderable().getCoordinateSystem(),t.useRendererMatrix=t.coordinateSystem!==ch.DISPLAY,t.WebGPURenderer=t.WebGPUActor.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent(),t.device=t.WebGPURenderWindow.getDevice())},e.translucentPass=r=>{r&&(e.prepareToDraw(t.WebGPURenderer.getRenderEncoder()),t.renderEncoder.registerDrawCallback(t.pipeline,e.draw))},e.opaquePass=r=>{r&&(e.prepareToDraw(t.WebGPURenderer.getRenderEncoder()),t.renderEncoder.registerDrawCallback(t.pipeline,e.draw))},e.updateUBO=()=>{const r=t.WebGPUActor.getRenderable().getProperty(),n=t.UBO.getSendTime();if(e.getMTime()<=n&&r.getMTime()<=n&&t.renderable.getMTime()<=n)return;const o=t.WebGPUActor.getKeyMatrices(t.WebGPURenderer);if(t.UBO.setArray("BCWCMatrix",o.bcwc),t.UBO.setArray("BCSCMatrix",o.bcsc),t.UBO.setArray("MCWCNormals",o.normalMatrix),t.is2D){const e=r.getDisplayLocation?.()??dh.BACKGROUND;t.UBO.setValue("ZValue",e===dh.FOREGROUND?1:0);const n=r.getColorByReference();t.UBO.setValue("AmbientIntensity",1),t.UBO.setArray("DiffuseColor",[...n,1]),t.UBO.setValue("DiffuseIntensity",0),t.UBO.setValue("SpecularIntensity",0)}else t.UBO.setValue("AmbientIntensity",r.getAmbient()),t.UBO.setArray("AmbientColor",[...r.getAmbientColorByReference(),1]),t.UBO.setValue("DiffuseIntensity",r.getDiffuse()),t.UBO.setArray("DiffuseColor",[...r.getDiffuseColorByReference(),1]),t.UBO.setValue("Roughness",r.getRoughness()),t.UBO.setValue("BaseIOR",r.getBaseIOR()),t.UBO.setValue("Metallic",r.getMetallic()),t.UBO.setValue("NormalStrength",r.getNormalStrength()),t.UBO.setValue("Emission",r.getEmission()),t.UBO.setValue("SpecularIntensity",r.getSpecular()),r.getSpecularColorByReference()&&t.UBO.setArray("SpecularColor",[...r.getSpecularColorByReference(),1]);const i=r.getEdgeColorByReference?.();i&&t.UBO.setArray("EdgeColor",[...i,1]),t.UBO.setValue("LineWidth",r.getLineWidth()),t.UBO.setValue("Opacity",r.getOpacity()),t.UBO.setValue("PropID",t.WebGPUActor.getPropID()),t.UBO.sendIfNeeded(t.WebGPURenderWindow.getDevice())},e.haveWideLines=()=>{const e=t.WebGPUActor.getRenderable(),r=e.getProperty().getRepresentation();return!(e.getProperty().getLineWidth()<=1)&&t.primitiveType!==sh.Verts&&(t.primitiveType!==sh.Triangles&&t.primitiveType!==sh.TriangleStrips||r===lh.WIREFRAME)},e.replaceShaderPosition=(r,n,o)=>{const i=n.getShaderDescription("vertex");i.addBuiltinOutput("vec4","@builtin(position) Position"),i.hasOutput("vertexVC")||i.addOutput("vec4","vertexVC");let a=i.getCode();t.useRendererMatrix?(a=Np.substitute(a,"//VTK::Position::Impl",[" var pCoord: vec4 = rendererUBO.SCPCMatrix*mapperUBO.BCSCMatrix*vertexBC;"," output.vertexVC = rendererUBO.SCVCMatrix * mapperUBO.BCSCMatrix * vec4(vertexBC.xyz, 1.0);","//VTK::Position::Impl"]).result,t.forceZValue&&(a=Np.substitute(a,"//VTK::Position::Impl",["pCoord = vec4(pCoord.xyz/pCoord.w, 1.0);","pCoord.z = mapperUBO.ZValue;","//VTK::Position::Impl"]).result)):(a=Np.substitute(a,"//VTK::Position::Impl",[" var pCoord: vec4 = mapperUBO.BCSCMatrix*vertexBC;"," pCoord.x = 2.0* pCoord.x / rendererUBO.viewportSize.x - 1.0;"," pCoord.y = 2.0* pCoord.y / rendererUBO.viewportSize.y - 1.0;"," pCoord.z = 0.5 - 0.5 * pCoord.z;","//VTK::Position::Impl"]).result,t.forceZValue&&(a=Np.substitute(a,"//VTK::Position::Impl",[" pCoord.z = mapperUBO.ZValue;","//VTK::Position::Impl"]).result)),e.haveWideLines()&&(i.addBuiltinInput("u32","@builtin(instance_index) instanceIndex"),a=Np.substitute(a,"//VTK::Position::Impl",[" var tmpPos: vec4 = pCoord;"," var numSteps: f32 = ceil(mapperUBO.LineWidth - 1.0);"," var offset: f32 = (mapperUBO.LineWidth - 1.0) * (f32(input.instanceIndex / 2u) - numSteps/2.0) / numSteps;"," var tmpPos2: vec3 = tmpPos.xyz / tmpPos.w;"," tmpPos2.x = tmpPos2.x + 2.0 * (f32(input.instanceIndex) % 2.0) * offset / rendererUBO.viewportSize.x;"," tmpPos2.y = tmpPos2.y + 2.0 * (f32(input.instanceIndex + 1u) % 2.0) * offset / rendererUBO.viewportSize.y;"," tmpPos2.z = min(1.0, tmpPos2.z + 0.00001);"," pCoord = vec4(tmpPos2.xyz * tmpPos.w, tmpPos.w);","//VTK::Position::Impl"]).result),a=Np.substitute(a,"//VTK::Position::Impl",[" output.Position = pCoord;"]).result,i.setCode(a)},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderNormal=(e,r,n)=>{const o=n.getBuffer("normalMC"),i=t.WebGPUActor.getRenderable();if(o){const e=r.getShaderDescription("vertex");e.hasOutput("normalVC")||e.addOutput("vec3","normalVC",o.getArrayInformation()[0].interpolation),e.hasOutput("tangentVC")||e.addOutput("vec3","tangentVC",o.getArrayInformation()[0].interpolation),e.hasOutput("bitangentVC")||e.addOutput("vec3","bitangentVC",o.getArrayInformation()[0].interpolation);let t=e.getCode();t=Np.substitute(t,"//VTK::Normal::Impl",[" output.normalVC = normalize((rendererUBO.WCVCNormals * mapperUBO.MCWCNormals * normalMC).xyz);"," var c1: vec3 = cross(output.normalVC, vec3(0, 0, 1));"," var c2: vec3 = cross(output.normalVC, vec3(0, 1, 0));"," var tangent: vec3 = mix(c1, c2, distance(c1, c2));"," output.tangentVC = normalize(tangent);"," output.bitangentVC = normalize(cross(output.normalVC, tangent));"]).result,e.setCode(t);const n=r.getShaderDescription("fragment");t=n.getCode(),t=i.getProperty().getNormalTexture()?Np.substitute(t,"//VTK::Normal::Impl",[" var normal: vec3 = input.normalVC;"," if (!input.frontFacing) { normal = -normal; }"," var tangent: vec3 = input.tangentVC;"," var bitangent: vec3 = input.bitangentVC;"," var TCVCMatrix: mat3x3 = mat3x3("," tangent.x, bitangent.x, normal.x,"," tangent.y, bitangent.y, normal.y,"," tangent.z, bitangent.z, normal.z,"," );"," var mappedNormal: vec3 = TCVCMatrix * (_normalMap.xyz * 2 - 1);"," normal = mix(normal, mappedNormal, mapperUBO.NormalStrength);"," normal = normalize(normal);"]).result:Np.substitute(t,"//VTK::Normal::Impl",[" var normal: vec3 = input.normalVC;"," if (!input.frontFacing) { normal = -normal; }"," normal = normalize(normal);"]).result,n.setCode(t)}},t.shaderReplacements.set("replaceShaderNormal",e.replaceShaderNormal),e.replaceShaderLight=(e,r,n)=>{if(e.includes("sel"))return;const o=r.getShaderDescription("vertex");o.hasOutput("vertexVC")||o.addOutput("vec4","vertexVC");const i=t.WebGPURenderer.getRenderable(),a=r.getShaderDescription("fragment");let s=a.getCode();if(!s.includes("var normal:")||!t.useRendererMatrix||ph(e)||t.is2D||e.includes("sel"))s=Np.substitute(s,"//VTK::Light::Impl",[" let diffuse = diffuseColor.rgb;"," let specular = mapperUBO.SpecularColor.rgb * mapperUBO.SpecularColor.a;"," computedColor = vec4(diffuse * _diffuseMap.rgb, mapperUBO.Opacity);"]).result,a.setCode(s);else{const e=[" let fragPos = vec3(input.vertexVC.xyz);"," let V = mix(normalize(-fragPos), vec3(0, 0, 1), f32(rendererUBO.cameraParallel)); // View Vector"," let baseColor = _diffuseMap.rgb * diffuseColor.rgb;"," let roughness = max(0.000001, mapperUBO.Roughness * _roughnessMap.r);"," let metallic = mapperUBO.Metallic * _metallicMap.r;"," let alpha = roughness * roughness;"," let k = alpha * alpha / 2.0;"," var diffuse = vec3(0.);"," var specular = vec3(0.);"," let emission = _emissionMap.rgb * mapperUBO.Emission;",""," // Material struct"," let mat = Material(ior, roughness, metallic, baseColor);",""," {"," var i = 0;"," loop {"," if (!(i < rendererUBO.LightCount)) { break; }"," switch (i32(rendererLightSSBO.values[i].LightData.x)) {"," // Point Light"," case 0 {"," let color = rendererLightSSBO.values[i].LightColor.rgb * rendererLightSSBO.values[i].LightColor.w;"," let pos = (rendererLightSSBO.values[i].LightPos).xyz;"," let pointLight = PointLight(pos, color);"," let result = calcPointLight(normal, V, fragPos, mat, pointLight);"," diffuse += max(vec3(0), result.diffuse);"," specular += max(vec3(0), result.specular);"," }"," // Directional light"," case 1 {"," let dir = normalize((rendererUBO.WCVCNormals * vec4(normalize(rendererLightSSBO.values[i].LightDir.xyz), 0.)).xyz);"," let color = rendererLightSSBO.values[i].LightColor.rgb * rendererLightSSBO.values[i].LightColor.w;"," let dirLight = DirectionalLight(dir, color);"," let result = calcDirectionalLight(normal, V, mat, dirLight); // diffuseColor.rgb needs to be fixed with a more dynamic diffuse color"," diffuse += max(vec3(0), result.diffuse);"," specular += max(vec3(0), result.specular);"," }"," // Spot Light"," case 2 {"," let color = rendererLightSSBO.values[i].LightColor.rgb * rendererLightSSBO.values[i].LightColor.w;"," let pos = (rendererLightSSBO.values[i].LightPos).xyz;"," let dir = normalize((rendererUBO.WCVCNormals * vec4(normalize(rendererLightSSBO.values[i].LightDir.xyz), 0.)).xyz);"," let cones = vec2(rendererLightSSBO.values[i].LightData.y, rendererLightSSBO.values[i].LightData.z);"," let spotLight = SpotLight(pos, dir, cones, color);"," let result = calcSpotLight(normal, V, fragPos, mat, spotLight);"," diffuse += max(vec3(0), result.diffuse);"," specular += max(vec3(0), result.specular);"," }"," default { continue; }"," }"," continuing { i++; }"," }"," }"," let fresnel = min(1.0, schlickFresnelIOR(V, normal, ior, k)); // Fresnel"," // This could be controlled with its own variable (that isnt base color) for better artistic control"," let fresnelMetallic = schlickFresnelRGB(V, normal, baseColor); // Fresnel for metal, takes color into account"," let kS = min(vec3(1.0), mix(vec3(fresnel), fresnelMetallic, metallic));"," let kD = (1.0 - kS) * (1.0 - metallic);"," let PBR = mapperUBO.DiffuseIntensity * kD * diffuse + kS * specular;"," computedColor = vec4(PBR + emission, mapperUBO.Opacity);"];i.getEnvironmentTexture()?.getImageLoaded()&&e.push(" // To get diffuse IBL, the texture is sampled with normals in worldspace"," let diffuseIBLCoords = (transpose(rendererUBO.WCVCNormals) * vec4(normal, 1.)).xyz;"," let diffuseCoords = vecToRectCoord(diffuseIBLCoords);"," // To get specular IBL, the texture is sampled as the worldspace reflection between the normal and view vectors"," // Reflections are first calculated in viewspace, then converted to worldspace to sample the environment"," let VreflN = normalize(reflect(-V, normal));"," let reflectionIBLCoords = (transpose(rendererUBO.WCVCNormals) * vec4(VreflN, 1.)).xyz;"," let specularCoords = vecToRectCoord(reflectionIBLCoords);"," let diffuseIBL = textureSampleLevel(EnvironmentTexture, EnvironmentTextureSampler, diffuseCoords, rendererUBO.MaxEnvironmentMipLevel);"," let level = roughness * rendererUBO.MaxEnvironmentMipLevel;"," let specularIBL = textureSampleLevel(EnvironmentTexture, EnvironmentTextureSampler, specularCoords, level);"," let specularIBLContribution = specularIBL.rgb * rendererUBO.BackgroundSpecularStrength;"," computedColor += vec4(specularIBLContribution * kS, 0);"," let diffuseIBLContribution = diffuseIBL.rgb * rendererUBO.BackgroundDiffuseStrength;"," computedColor += vec4(diffuseIBLContribution * baseColor * _ambientOcclusionMap.rgb * kD, 0);"),s=Np.substitute(s,"//VTK::Light::Impl",e).result,a.setCode(s)}},t.shaderReplacements.set("replaceShaderLight",e.replaceShaderLight),e.replaceShaderColor=(e,t,r)=>{if(ph(e)){const e=t.getShaderDescription("fragment");let r=e.getCode();return r=Np.substitute(r,"//VTK::Color::Impl",["ambientColor = mapperUBO.EdgeColor;","diffuseColor = mapperUBO.EdgeColor;"]).result,void e.setCode(r)}const n=r.getBuffer("colorVI");if(!n)return;const o=t.getShaderDescription("vertex");o.addOutput("vec4","color",n.getArrayInformation()[0].interpolation);let i=o.getCode();i=Np.substitute(i,"//VTK::Color::Impl",[" output.color = colorVI;"]).result,o.setCode(i);const a=t.getShaderDescription("fragment");i=a.getCode(),i=Np.substitute(i,"//VTK::Color::Impl",["ambientColor = input.color;","diffuseColor = input.color;","opacity = mapperUBO.Opacity * input.color.a;"]).result,a.setCode(i)},t.shaderReplacements.set("replaceShaderColor",e.replaceShaderColor),e.replaceShaderTCoord=(e,r,n)=>{if(!n.hasAttribute("tcoord"))return;const o=r.getShaderDescription("vertex"),i=n.getBuffer("tcoord"),a=zp(i.getArrayInformation()[0].format);let s=o.getCode();o.addOutput(`vec${a}`,"tcoordVS"),s=Np.substitute(s,"//VTK::TCoord::Impl",[" output.tcoordVS = tcoord;"]).result,o.setCode(s);const l=r.getShaderDescription("fragment");s=l.getCode();const u=t.WebGPUActor.getRenderable(),c=u.getProperty(),d=e=>!!e&&e.getDimensionality()===a,p=[],f=c.getDiffuseTexture?.();(f?.getImageLoaded()||u.getTextures()[0]||t.colorTexture)&&(d(f)||d(u.getTextures()[0])||d(t.colorTexture))&&p.push("_diffuseMap = textureSample(DiffuseTexture, DiffuseTextureSampler, input.tcoordVS);");const h=c.getORMTexture?.(),m=c.getRMTexture?.(),g=c.getRoughnessTexture?.(),y=c.getMetallicTexture?.(),v=c.getAmbientOcclusionTexture?.(),b=c.getEmissionTexture?.(),x=c.getNormalTexture?.();h?.getImageLoaded()?d(h)&&p.push("_ambientOcclusionMap = textureSample(ORMTexture, ORMTextureSampler, input.tcoordVS).rrra;","_roughnessMap = textureSample(ORMTexture, ORMTextureSampler, input.tcoordVS).ggga;","_metallicMap = textureSample(ORMTexture, ORMTextureSampler, input.tcoordVS).bbba;"):m?.getImageLoaded()?d(m)&&p.push("_roughnessMap = textureSample(RMTexture, RMTextureSampler, input.tcoordVS).ggga;","_metallicMap = textureSample(RMTexture, RMTextureSampler, input.tcoordVS).bbba;"):(g?.getImageLoaded()&&d(g)&&p.push("_roughnessMap = textureSample(RoughnessTexture, RoughnessTextureSampler, input.tcoordVS).ggga;"),y?.getImageLoaded()&&d(y)&&p.push("_metallicMap = textureSample(MetallicTexture, MetallicTextureSampler, input.tcoordVS).bbba;"),v?.getImageLoaded()&&d(v)&&p.push("_ambientOcclusionMap = textureSample(AmbientOcclusionTexture, AmbientOcclusionTextureSampler, input.tcoordVS).rrra;")),b?.getImageLoaded()&&d(b)&&p.push("_emissionMap = textureSample(EmissionTexture, EmissionTextureSampler, input.tcoordVS);"),x?.getImageLoaded()&&d(x)&&p.push("_normalMap = textureSample(NormalTexture, NormalTextureSampler, input.tcoordVS);"),s=Np.substitute(s,"//VTK::TCoord::Impl",p).result,l.setCode(s)},t.shaderReplacements.set("replaceShaderTCoord",e.replaceShaderTCoord),e.replaceShaderSelect=(e,t,r)=>{if(e.includes("sel")){const e=t.getShaderDescription("fragment");let r=e.getCode();r=Np.substitute(r,"//VTK::Select::Impl",[" var compositeID: u32 = 0u;"]).result,e.setCode(r)}},t.shaderReplacements.set("replaceShaderSelect",e.replaceShaderSelect),e.getUsage=(e,t)=>e===lh.POINTS||t===sh.Points?ah.Verts:t===sh.Lines?ah.Lines:e===lh.WIREFRAME?t===sh.Triangles?ah.LinesFromTriangles:ah.LinesFromStrips:t===sh.Triangles?ah.Triangles:t===sh.TriangleStrips?ah.Strips:t===sh.TriangleEdges?ah.LinesFromTriangles:ah.LinesFromStrips,e.getHashFromUsage=e=>`pt${e}`,e.getTopologyFromUsage=e=>{switch(e){case ah.Triangles:return"triangle-list";case ah.Verts:return"point-list";case ah.Lines:default:return"line-list"}},e.buildVertexInput=()=>{const r=t.currentInput,n=t.cellArray,o=t.primitiveType;let i=t.WebGPUActor.getRenderable().getProperty().getRepresentation();const a=t.WebGPURenderWindow.getDevice();let s=!1;o===sh.TriangleEdges&&(s=!0,i=lh.WIREFRAME);const l=t.vertexInput,u=r.getPoints();let c=null;if(n?(c=a.getBufferManager().getBuffer({hash:`R${i}P${o}${n.getMTime()}`,usage:ah.Index,cells:n,numberOfPoints:u.getNumberOfPoints(),primitiveType:o,representation:i}),l.setIndexBuffer(c)):l.setIndexBuffer(null),u){const e=t.WebGPUActor.getBufferShift(t.WebGPURenderer);l.addBuffer(a.getBufferManager().getBuffer({hash:`${u.getMTime()}I${c?.getMTime?.()??0}${e.join()}float32x4`,usage:ah.PointArray,format:"float32x4",dataArray:u,indexBuffer:c,shift:e,packExtra:!0}),["vertexBC"])}else l.removeBufferIfPresent("vertexBC");const d=e.getUsage(i,o);if(t._usesCellNormals=!1,t.is2D||d!==ah.Triangles&&d!==ah.Strips)l.removeBufferIfPresent("normalMC");else{const e=r.getPointData().getNormals(),i={format:"snorm8x4",indexBuffer:c,packExtra:!0,shift:0,scale:127};e?(i.hash=`${e.getMTime()}I${c.getMTime()}snorm8x4`,i.dataArray=e,i.usage=ah.PointArray,l.addBuffer(a.getBufferManager().getBuffer(i),["normalMC"])):o===sh.Triangles?(t._usesCellNormals=!0,i.hash=`PFN${u.getMTime()}I${c.getMTime()}snorm8x4`,i.dataArray=u,i.cells=n,i.usage=ah.NormalsFromPoints,l.addBuffer(a.getBufferManager().getBuffer(i),["normalMC"])):l.removeBufferIfPresent("normalMC")}let p=!1;if(t.renderable.getScalarVisibility()){const e=t.renderable.getColorMapColors();if(e&&!s){const n=t.renderable.getScalarMode(),o=(n===uh.USE_CELL_DATA||n===uh.USE_CELL_FIELD_DATA||n===uh.USE_FIELD_DATA||!r.getPointData().getScalars())&&n!==uh.USE_POINT_FIELD_DATA&&e;l.addBuffer(a.getBufferManager().getBuffer({usage:ah.PointArray,format:"unorm8x4",hash:`${o}${e.getMTime()}I${c.getMTime()}unorm8x4`,dataArray:e,indexBuffer:c,cellData:o,cellOffset:0}),["colorVI"]),p=!0}}p||l.removeBufferIfPresent("colorVI");let f=null;f=t.renderable.getInterpolateScalarsBeforeMapping?.()&&t.renderable.getColorCoordinates()?t.renderable.getColorCoordinates():r.getPointData().getTCoords(),f&&!s?l.addBuffer(a.getBufferManager().getBufferForPointArray(f,l.getIndexBuffer()),["tcoord"]):l.removeBufferIfPresent("tcoord")},e.updateTextures=()=>{const e=[],r=[],n=t.renderable.getColorTextureMap?.();n&&!t.colorTexture&&(t.colorTexture=vc.newInstance({label:"polyDataColor"})),n&&(t.colorTexture.setInputData(n),r.push(["DiffuseTexture",t.colorTexture]));const o=t.WebGPUActor.getRenderable(),i=t.WebGPURenderer.getRenderable();[["DiffuseTexture",o.getProperty().getDiffuseTexture?.()],["DiffuseTexture",o.getTextures()[0]],["DiffuseTexture",t.colorTexture],["ORMTexture",o.getProperty().getORMTexture?.()],["RMTexture",o.getProperty().getRMTexture?.()],["RoughnessTexture",o.getProperty().getRoughnessTexture?.()],["MetallicTexture",o.getProperty().getMetallicTexture?.()],["NormalTexture",o.getProperty().getNormalTexture?.()],["AmbientOcclusionTexture",o.getProperty().getAmbientOcclusionTexture?.()],["EmissionTexture",o.getProperty().getEmissionTexture?.()],["EnvironmentTexture",i.getEnvironmentTexture?.()]].forEach(e=>{let[t,n]=e;n&&((n.getInputData()||n.getJsImageData()||n.getCanvas()||n.getImageBitmap())&&r.push([t,n]),n.getImage()&&n.getImageLoaded()&&r.push([t,n]))}),r.forEach(r=>{let[n,o]=r;const i=t.device.getTextureManager().getTextureForVTKTexture(o,n);if(!i.getReady())return;let a=!1;for(let r=0;r=0;r--)e[r]||(t.textures.splice(r,1),t.textureViews.splice(r,1))},e.computePipelineHash=()=>{let r=`pd${t.useRendererMatrix?"r":""}${t.forceZValue?"z":""}`;if(t.primitiveType===sh.TriangleEdges||t.primitiveType===sh.TriangleStripEdges)r+="edge";else{if(t.vertexInput.hasAttribute("normalMC")&&(r+="n"),t.vertexInput.hasAttribute("colorVI")&&(r+="c"),t.vertexInput.hasAttribute("tcoord")){const e=t.vertexInput.getBuffer("tcoord");r+=`t${zp(e.getArrayInformation()[0].format)}`}t.textures.length&&(r+=`tx${t.textures.length}`)}t._usesCellNormals&&(r+="cn"),t.SSBO&&(r+="ssbo"),r+=e.getHashFromUsage(t.usage),r+=t.renderEncoder.getPipelineHash(),t.pipelineHash=r},e.updateBuffers=()=>{t.primitiveType!==sh.TriangleEdges&&t.primitiveType!==sh.TriangleStripEdges&&e.updateTextures();const r=t.WebGPUActor.getRenderable(),n=r.getProperty().getRepresentation();t.usage=e.getUsage(n,t.primitiveType),e.buildVertexInput();const o=t.vertexInput.getBuffer("vertexBC");if(e.setNumberOfVertices(o.getSizeInBytes()/o.getStrideInBytes()),e.setTopology(e.getTopologyFromUsage(t.usage)),e.updateUBO(),e.haveWideLines()){const t=r.getProperty();e.setNumberOfInstances(Math.ceil(2*t.getLineWidth()))}else e.setNumberOfInstances(1)}}(e,t)}var mh={newInstance:Pt(hh,"vtkWebGPUCellArrayMapper"),extend:hh};const{PrimitiveTypes:gh}=If,yh={primitives:null};const vh=Pt(function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,yh,r),Xt.extend(e,t,r),t.primitives=[],function(e,t){t.classHierarchy.push("vtkWebGPUPolyDataMapper"),e.createCellArrayMapper=()=>mh.newInstance(),e.buildPass=r=>{if(r){t.WebGPUActor=e.getFirstAncestorOfType("vtkWebGPUActor"),t.renderable.getStatic()||t.renderable.update();const r=t.renderable.getInputData();t.renderable.mapScalars(r,1),e.updateCellArrayMappers(r)}},e.updateCellArrayMappers=r=>{if(!r)return void Ze("No input!");const n=[r.getVerts(),r.getLines(),r.getPolys(),r.getStrips()],o=[];let i=0;for(let a=gh.Points;a<=gh.TriangleStrips;a++)if(n[a].getNumberOfValues()>0){t.primitives[a]||(t.primitives[a]=e.createCellArrayMapper());const s=t.primitives[a];s.setCellArray(n[a]),s.setCurrentInput(r),s.setCellOffset(i),s.setPrimitiveType(a),s.setRenderable(t.renderable),i+=n[a].getNumberOfCells(),o.push(s)}else t.primitives[a]=null;if(t.WebGPUActor.getRenderable().getProperty().getEdgeVisibility()){if(n[gh.Triangles].getNumberOfValues()>0){const i=gh.TriangleEdges;t.primitives[i]||(t.primitives[i]=e.createCellArrayMapper());const a=t.primitives[i];a.setCellArray(n[gh.Triangles]),a.setCurrentInput(r),a.setCellOffset(t.primitives[gh.Triangles].getCellOffset()),a.setPrimitiveType(i),a.setRenderable(t.renderable),o.push(a)}else t.primitives[gh.TriangleEdges]=null;if(n[gh.TriangleStrips].getNumberOfValues()>0){const i=gh.TriangleStripEdges;t.primitives[i]||(t.primitives[i]=e.createCellArrayMapper());const a=t.primitives[i];a.setCellArray(n[gh.TriangleStrips]),a.setCurrentInput(r),a.setCellOffset(t.primitives[gh.TriangleStrips].getCellOffset()),a.setPrimitiveType(i),a.setRenderable(t.renderable),o.push(a)}else t.primitives[gh.TriangleStripEdges]=null}e.prepareNodes(),e.addMissingChildren(o),e.removeUnusedNodes()}}(e,t)},"vtkWebGPUPolyDataMapper");vp("vtkMapper",vh);const{PrimitiveTypes:bh}=If;const xh=Pt(function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,function(e){return{primitives:[],...e}}(r)),Xt.extend(e,t,r),t.primitives=[],function(e,t){t.classHierarchy.push("vtkWebGPUPolyDataMapper2D"),e.createCellArrayMapper=()=>mh.newInstance(),e.buildPass=r=>{if(r){t.WebGPUActor=e.getFirstAncestorOfType("vtkWebGPUActor2D"),t.renderable.getStatic()||t.renderable.update();const r=t.renderable.getInputData();t.renderable.mapScalars(r,1),e.updateCellArrayMappers(r)}},e.updateCellArrayMappers=r=>{const n=[r.getVerts(),r.getLines(),r.getPolys(),r.getStrips()],o=[];let i=0;for(let a=bh.Points;a<=bh.Triangles;a++)if(n[a].getNumberOfValues()>0){t.primitives[a]||(t.primitives[a]=e.createCellArrayMapper());const s=t.primitives[a];s.setCellArray(n[a]),s.setCurrentInput(r),s.setCellOffset(i),s.setPrimitiveType(a),s.setRenderable(t.renderable),s.setIs2D(!0),i+=n[a].getNumberOfCells(),o.push(s)}else t.primitives[a]=null;e.prepareNodes(),e.addMissingChildren(o),e.removeUnusedNodes()}}(e,t)},"vtkWebGPUPolyDataMapper2D");vp("vtkMapper2D",xh);const _h={};const Sh=Pt(function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,_h,r),Xt.extend(e,t,r),t.scalarBarActorHelper=lp.newScalarBarActorHelper(),function(e,t){t.classHierarchy.push("vtkWebGPUScalarBarActor"),e.buildPass=r=>{r&&(t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent(),t.scalarBarActorHelper.getRenderable()||t.scalarBarActorHelper.setRenderable(t.renderable),e.prepareNodes(),e.addMissingNode(t.scalarBarActorHelper.getBarActor()),e.addMissingNode(t.scalarBarActorHelper.getTmActor()),e.removeUnusedNodes())},e.opaquePass=(e,r)=>{if(e){const e=t.WebGPURenderer?t.WebGPURenderer.getRenderable().getActiveCamera():null,r=t.WebGPURenderer.getTiledSizeAndOrigin();t.scalarBarActorHelper.updateAPISpecificData([r.usize,r.vsize],e,t.WebGPURenderWindow.getRenderable())}}}(e,t)},"vtkWebGPUScalarBarActor");vp("vtkScalarBarActor",Sh);const Ch={device:null,handle:null,label:null,options:null};function Th(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ch,r),zt.obj(e,t),t.options={},t.bindGroupLayoutEntry={visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,sampler:{}},t.bindGroupTime={},zt.obj(t.bindGroupTime,{mtime:0}),zt.get(e,t,["bindGroupTime","handle","options"]),zt.setGet(e,t,["bindGroupLayoutEntry","device","label"]),function(e,t){t.classHierarchy.push("vtkWebGPUSampler"),e.create=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.device=e,t.options.addressModeU=r.addressModeU?r.addressModeU:"clamp-to-edge",t.options.addressModeV=r.addressModeV?r.addressModeV:"clamp-to-edge",t.options.addressModeW=r.addressModeW?r.addressModeW:"clamp-to-edge",t.options.magFilter=r.magFilter?r.magFilter:"nearest",t.options.minFilter=r.minFilter?r.minFilter:"nearest",t.options.mipmapFilter=r.mipmapFilter?r.mipmapFilter:"nearest",t.options.label=t.label,t.handle=t.device.getHandle().createSampler(t.options),t.bindGroupTime.modified()},e.getShaderCode=(e,r)=>`@binding(${e}) @group(${r}) var ${t.label}: sampler;`,e.getBindGroupEntry=()=>({resource:t.handle})}(e,t)}var wh={newInstance:zt.newInstance(Th),extend:Th};const Ah={texture:null,handle:null,sampler:null,label:null};function Eh(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ah,r),zt.obj(e,t),t.bindGroupLayoutEntry={visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},t.bindGroupTime={},zt.obj(t.bindGroupTime,{mtime:0}),zt.get(e,t,["bindGroupTime","texture"]),zt.setGet(e,t,["bindGroupLayoutEntry","label","sampler"]),function(e,t){t.classHierarchy.push("vtkWebGPUTextureView"),e.create=(e,r)=>{t.texture=e,t.options=r,t.options.dimension=t.options.dimension||"2d",t.options.label=t.label,t.textureHandle=e.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupLayoutEntry.texture.viewDimension=t.options.dimension;const n=Vp(t.texture.getFormat());t.bindGroupLayoutEntry.texture.sampleType=n.sampleType},e.createFromTextureHandle=(e,r)=>{t.texture=null,t.options=r,t.options.dimension=t.options.dimension||"2d",t.options.label=t.label,t.textureHandle=e,t.handle=t.textureHandle.createView(t.options),t.bindGroupLayoutEntry.texture.viewDimension=t.options.dimension;const n=Vp(r.format);t.bindGroupLayoutEntry.texture.sampleType=n.sampleType,t.bindGroupTime.modified()},e.getBindGroupEntry=()=>({resource:e.getHandle()}),e.getShaderCode=(e,r)=>{let n="f32";"sint"===t.bindGroupLayoutEntry.texture.sampleType?n="i32":"uint"===t.bindGroupLayoutEntry.texture.sampleType&&(n="u32");let o=`@binding(${e}) @group(${r}) var ${t.label}: texture_${t.options.dimension}<${n}>;`;return"depth"===t.bindGroupLayoutEntry.texture.sampleType&&(o=`@binding(${e}) @group(${r}) var ${t.label}: texture_depth_${t.options.dimension};`),o},e.addSampler=(r,n)=>{const o=wh.newInstance({label:`${t.label}Sampler`});o.create(r,n),e.setSampler(o)},e.getBindGroupTime=()=>(t.texture&&t.texture.getHandle()!==t.textureHandle&&(t.textureHandle=t.texture.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupTime.modified()),t.bindGroupTime),e.getHandle=()=>(t.texture&&t.texture.getHandle()!==t.textureHandle&&(t.textureHandle=t.texture.getHandle(),t.handle=t.textureHandle.createView(t.options),t.bindGroupTime.modified()),t.handle)}(e,t)}var Dh={newInstance:zt.newInstance(Eh),extend:Eh};const Ph={device:null,handle:null,buffer:null,ready:!1,label:null};function Ih(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ph,r),zt.obj(e,t),zt.get(e,t,["handle","ready","width","height","depth","format","usage"]),zt.setGet(e,t,["device","label"]),function(e,t){t.classHierarchy.push("vtkWebGPUTexture"),e.create=(e,r)=>{t.device=e,t.width=r.width,t.height=r.height,t.depth=r.depth?r.depth:1;const n=1===t.depth?"2d":"3d";t.format=r.format?r.format:"rgba8unorm",t.mipLevel=r.mipLevel?r.mipLevel:0,t.usage=r.usage?r.usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST,t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label,dimension:n,mipLevelCount:t.mipLevel+1})},e.assignFromHandle=(e,r,n)=>{t.device=e,t.handle=r,t.width=n.width,t.height=n.height,t.depth=n.depth?n.depth:1,t.format=n.format?n.format:"rgba8unorm",t.usage=n.usage?n.usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST},e.writeImageData=r=>{let n=[];const o=n=>{t.device.getHandle().queue.copyExternalImageToTexture({source:n,flipY:r.flip},{texture:t.handle,premultipliedAlpha:!0,mipLevel:0,origin:{x:0,y:0,z:0}},[n.width,n.height,t.depth]),3!==e.getDimensionality()&&t.mipLevel>0&&vc.generateMipmaps(t.device.getHandle(),t.handle,t.mipLevel+1),t.ready=!0};if(r.canvas)return void o(r.canvas);if(r.imageBitmap)return r.width=r.imageBitmap.width,r.height=r.imageBitmap.height,r.depth=1,r.format="rgba8unorm",r.flip=!0,void o(r.imageBitmap);if(r.jsImageData)return r.width=r.jsImageData.width,r.height=r.jsImageData.height,r.depth=1,r.format="rgba8unorm",r.flip=!0,void o(r.jsImageData);if(r.image)return r.width=r.image.width,r.height=r.image.height,r.depth=1,r.format="rgba8unorm",r.flip=!0,void o(r.image);const i=Vp(t.format);let a=t.width*i.stride;r.nativeArray&&(n=r.nativeArray);const s=3===e.getDimensionality(),l=((e,t,r)=>{const n=2===i.elementSize&&"float"===i.sampleType,o=e.BYTES_PER_ELEMENT,a=e.length/(t*r)*o;if(!n&&a%256==0)return[e,a];const s=a/o,l=i.elementSize,u=256*Math.floor((s*l+255)/256),c=u/l,d=zt.newTypedArray(n?"Uint16Array":e.constructor.name,c*t*r),p=t*r;if(n)for(let t=0;t0&&vc.generateMipmaps(t.device.getHandle(),t.handle,t.mipLevel+1),t.ready=!0},e.getScale=()=>{const e=Vp(t.format);return 2===e.elementSize&&"float"===e.sampleType?1:255},e.getNumberOfComponents=()=>Vp(t.format).numComponents,e.getDimensionality=()=>{let e=0;return t.width>1&&e++,t.height>1&&e++,t.depth>1&&e++,e},e.resizeToMatch=e=>{e.getWidth()===t.width&&e.getHeight()===t.height&&e.getDepth()===t.depth||(t.width=e.getWidth(),t.height=e.getHeight(),t.depth=e.getDepth(),t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label}))},e.resize=function(e,r){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;e===t.width&&r===t.height&&n===t.depth||(t.width=e,t.height=r,t.depth=n,t.handle=t.device.getHandle().createTexture({size:[t.width,t.height,t.depth],format:t.format,usage:t.usage,label:t.label}))},e.createView=function(r){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n.dimension||(n.dimension=1===t.depth?"2d":"3d");const o=Dh.newInstance({label:r});return o.create(e,n),o}}(e,t)}var Oh={newInstance:zt.newInstance(Ih),extend:Ih};const Nh={};const Mh=zt.newInstance(function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Nh,r),Xt.extend(e,t,r),function(e,t){t.classHierarchy.push("vtkWebGPUPixelSpaceCallbackMapper"),e.opaquePass=(r,n)=>{t.WebGPURenderer=e.getFirstAncestorOfType("vtkWebGPURenderer"),t.WebGPURenderWindow=t.WebGPURenderer.getParent();const o=t.WebGPURenderer.getAspectRatio(),i=t.WebGPURenderer?t.WebGPURenderer.getRenderable().getActiveCamera():null,a=t.WebGPURenderer.getTiledSizeAndOrigin();t.renderable.getUseZValues(),t.renderable.invokeCallback(t.renderable.getInputData(),i,o,a,null)}}(e,t)},"vtkWebGPUPixelSpaceCallbackMapper");vp("vtkPixelSpaceCallbackMapper",Mh);const{vtkDebugMacro:Rh}=zt,Fh={position:[0,0,1],focalPoint:[0,0,0],viewUp:[0,1,0],directionOfProjection:[0,0,-1],parallelProjection:!1,useHorizontalViewAngle:!1,viewAngle:30,parallelScale:1,clippingRange:[.01,1000.01],windowCenter:[0,0],viewPlaneNormal:[0,0,1],useOffAxisProjection:!1,screenBottomLeft:[-.5,-.5,-.5],screenBottomRight:[.5,-.5,-.5],screenTopRight:[.5,.5,-.5],freezeFocalPoint:!1,projectionMatrix:null,viewMatrix:null,modelTransformMatrix:null,cameraLightTransform:u(),physicalTranslation:[0,0,0],physicalScale:1,physicalViewUp:[0,1,0],physicalViewNorth:[0,0,-1]};function Bh(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Fh,r),zt.obj(e,t),zt.get(e,t,["distance"]),zt.setGet(e,t,["parallelProjection","useHorizontalViewAngle","viewAngle","parallelScale","useOffAxisProjection","freezeFocalPoint","physicalScale"]),zt.getArray(e,t,["directionOfProjection","viewPlaneNormal","position","focalPoint"]),zt.setGetArray(e,t,["clippingRange","windowCenter"],2),zt.setGetArray(e,t,["viewUp","screenBottomLeft","screenBottomRight","screenTopRight","physicalTranslation","physicalViewUp","physicalViewNorth"],3),function(e,t){t.classHierarchy.push("vtkCamera");const r=new Float64Array(3),n=new Float64Array([0,0,-1]),o=new Float64Array([0,1,0]),i=h(new Float64Array(16)),a=h(new Float64Array(16)),s=new Float64Array(3),l=new Float64Array(3),u=new Float64Array(3),c=h(new Float64Array(16)),p=h(new Float64Array(16)),f=new Float64Array(3),y=new Float64Array(3);function v(){t.viewPlaneNormal[0]=-t.directionOfProjection[0],t.viewPlaneNormal[1]=-t.directionOfProjection[1],t.viewPlaneNormal[2]=-t.directionOfProjection[2]}e.orthogonalizeViewUp=()=>{const r=e.getViewMatrix();t.viewUp[0]=r[4],t.viewUp[1]=r[5],t.viewUp[2]=r[6],e.modified()},e.setPosition=(r,n,o)=>{r===t.position[0]&&n===t.position[1]&&o===t.position[2]||(t.position[0]=r,t.position[1]=n,t.position[2]=o,e.computeDistance(),e.modified())},e.setFocalPoint=(r,n,o)=>{r===t.focalPoint[0]&&n===t.focalPoint[1]&&o===t.focalPoint[2]||(t.focalPoint[0]=r,t.focalPoint[1]=n,t.focalPoint[2]=o,e.computeDistance(),e.modified())},e.setDistance=r=>{if(t.distance===r)return;t.distance=r,t.distance<1e-20&&(t.distance=1e-20,Rh("Distance is set to minimum."));const n=t.directionOfProjection;t.focalPoint[0]=t.position[0]+n[0]*t.distance,t.focalPoint[1]=t.position[1]+n[1]*t.distance,t.focalPoint[2]=t.position[2]+n[2]*t.distance,e.modified()},e.computeDistance=()=>{const e=t.focalPoint[0]-t.position[0],r=t.focalPoint[1]-t.position[1],n=t.focalPoint[2]-t.position[2];if(t.distance=Math.sqrt(e*e+r*r+n*n),t.distance<1e-20){t.distance=1e-20,Rh("Distance is set to minimum.");const e=t.directionOfProjection;t.focalPoint[0]=t.position[0]+e[0]*t.distance,t.focalPoint[1]=t.position[1]+e[1]*t.distance,t.focalPoint[2]=t.position[2]+e[2]*t.distance}t.directionOfProjection[0]=e/t.distance,t.directionOfProjection[1]=r/t.distance,t.directionOfProjection[2]=n/t.distance,v()},e.dolly=r=>{if(r<=0)return;const n=t.distance/r;e.setPosition(t.focalPoint[0]-n*t.directionOfProjection[0],t.focalPoint[1]-n*t.directionOfProjection[1],t.focalPoint[2]-n*t.directionOfProjection[2])},e.roll=r=>{const n=t.position,o=t.focalPoint,i=t.viewUp,a=new Float64Array([i[0],i[1],i[2],0]);h(c);const s=new Float64Array([o[0]-n[0],o[1]-n[1],o[2]-n[2]]);S(c,c,yo(r),s),Ni(a,a,c),t.viewUp[0]=a[0],t.viewUp[1]=a[1],t.viewUp[2]=a[2],e.modified()},e.azimuth=r=>{const n=t.focalPoint;h(p),x(p,p,n),S(p,p,yo(r),t.viewUp),x(p,p,[-n[0],-n[1],-n[2]]),Sr(f,t.position,p),e.setPosition(f[0],f[1],f[2])},e.yaw=r=>{const n=t.position;h(p),x(p,p,n),S(p,p,yo(r),t.viewUp),x(p,p,[-n[0],-n[1],-n[2]]),Sr(y,t.focalPoint,p),e.setFocalPoint(y[0],y[1],y[2])},e.elevation=r=>{const n=t.focalPoint,o=e.getViewMatrix(),i=[-o[0],-o[1],-o[2]];h(p),x(p,p,n),S(p,p,yo(r),i),x(p,p,[-n[0],-n[1],-n[2]]),Sr(f,t.position,p),e.setPosition(f[0],f[1],f[2])},e.pitch=r=>{const n=t.position,o=e.getViewMatrix(),i=[o[0],o[1],o[2]];h(p),x(p,p,n),S(p,p,yo(r),i),x(p,p,[-n[0],-n[1],-n[2]]),Sr(y,t.focalPoint,p),e.setFocalPoint(...y)},e.zoom=r=>{r<=0||(t.parallelProjection?t.parallelScale/=r:t.viewAngle/=r,e.modified())},e.translate=(r,n,o)=>{const i=[r,n,o];Po(t.position,i,t.position),Po(t.focalPoint,i,t.focalPoint),e.computeDistance(),e.modified()},e.applyTransform=r=>{const n=[...t.viewUp,1],o=[],i=[],a=[];n[0]+=t.position[0],n[1]+=t.position[1],n[2]+=t.position[2],Ni(o,[...t.position,1],r),Ni(i,[...t.focalPoint,1],r),Ni(a,n,r),a[0]-=o[0],a[1]-=o[1],a[2]-=o[2],e.setPosition(...o.slice(0,3)),e.setFocalPoint(...i.slice(0,3)),e.setViewUp(...a.slice(0,3))},e.getThickness=()=>t.clippingRange[1]-t.clippingRange[0],e.setThickness=r=>{let n=r;n<1e-20&&(n=1e-20,Rh("Thickness is set to minimum.")),e.setClippingRange(t.clippingRange[0],t.clippingRange[0]+n)},e.setThicknessFromFocalPoint=r=>{let n=r;n<1e-20&&(n=1e-20,Rh("Thickness is set to minimum.")),e.setClippingRange(t.distance-n/2,t.distance+n/2)},e.setRoll=e=>{},e.getRoll=()=>{},e.setObliqueAngles=(e,t)=>{},e.getOrientation=()=>{},e.getOrientationWXYZ=()=>{},e.getFrustumPlanes=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Float64Array(24);const n=[[1,0,0,1],[-1,0,0,1],[0,1,0,1],[0,-1,0,1],[0,0,1,1],[0,0,-1,1]],o=e.getCompositeProjectionMatrix(t,-1,1);for(let e=0;e<6;e++)Ni(n[e],n[e],o),ko(n[e]),r[4*e+0]=n[e][0],r[4*e+1]=n[e][1],r[4*e+2]=n[e][2],r[4*e+3]=n[e][3];return r},e.getCameraLightTransformMatrix=e=>(d(e,t.cameraLightTransform),e),e.computeCameraLightTransform=()=>{d(i,e.getViewMatrix()),g(i,i),E(a,[t.distance,t.distance,t.distance]),b(i,i,a),h(t.cameraLightTransform),x(t.cameraLightTransform,i,[0,0,-1])},e.deepCopy=e=>{},e.physicalOrientationToWorldDirection=e=>{const t=ki(e[0],e[1],e[2],e[3]),r=Mi(),n=ki(0,0,1,0);var o,i;return i=t,(o=r)[0]=-i[0],o[1]=-i[1],o[2]=-i[2],o[3]=i[3],Bi(n,t,n),Bi(n,n,r),[n[0],n[1],n[2]]},e.getPhysicalToWorldMatrix=t=>{e.getWorldToPhysicalMatrix(t),g(t,t)},e.getWorldToPhysicalMatrix=e=>{h(e);const r=[3];Fo(t.physicalViewNorth,t.physicalViewUp,r),e[0]=r[0],e[1]=r[1],e[2]=r[2],e[4]=t.physicalViewUp[0],e[5]=t.physicalViewUp[1],e[6]=t.physicalViewUp[2],e[8]=-t.physicalViewNorth[0],e[9]=-t.physicalViewNorth[1],e[10]=-t.physicalViewNorth[2],m(e,e),mr(s,1/t.physicalScale,1/t.physicalScale,1/t.physicalScale),_(e,e,s),x(e,e,t.physicalTranslation)},e.computeViewParametersFromViewMatrix=a=>{g(i,a),Sr(s,r,i),e.computeDistance();const c=t.distance;e.setPosition(s[0],s[1],s[2]),Sr(l,n,i),yr(l,l,s),br(l,l),e.setDirectionOfProjection(l[0],l[1],l[2]),Sr(u,o,i),yr(u,u,s),br(u,u),e.setViewUp(u[0],u[1],u[2]),e.setDistance(c)},e.computeViewParametersFromPhysicalMatrix=t=>{e.getWorldToPhysicalMatrix(i),b(i,t,i),e.computeViewParametersFromViewMatrix(i)},e.setModelTransformMatrix=e=>{t.modelTransformMatrix=e},e.getModelTransformMatrix=()=>t.modelTransformMatrix,e.setViewMatrix=r=>{t.viewMatrix=r,t.viewMatrix&&(d(i,t.viewMatrix),e.computeViewParametersFromViewMatrix(i),m(t.viewMatrix,t.viewMatrix))},e.getViewMatrix=()=>{if(t.viewMatrix)return t.modelTransformMatrix?(b(i,t.viewMatrix,t.modelTransformMatrix),i):t.viewMatrix;$(i,t.position,t.focalPoint,t.viewUp),m(i,i);const e=new Float64Array(16);return t.modelTransformMatrix?b(e,i,t.modelTransformMatrix):d(e,i),e},e.setProjectionMatrix=e=>{t.projectionMatrix=e},e.getProjectionMatrix=(e,r,n)=>{const o=new Float64Array(16);if(h(o),t.projectionMatrix){const e=1/t.physicalScale;return mr(s,e,e,e),d(o,t.projectionMatrix),_(o,o,s),m(o,o),o}h(i);const a=t.clippingRange[1]-t.clippingRange[0],l=[t.clippingRange[0]+(r+1)*a/2,t.clippingRange[0]+(n+1)*a/2];if(t.parallelProjection){const r=t.parallelScale*e,n=t.parallelScale,o=(t.windowCenter[0]-1)*r,a=(t.windowCenter[0]+1)*r,s=(t.windowCenter[1]-1)*n,u=(t.windowCenter[1]+1)*n;K(i,o,a,s,u,l[0],l[1]),m(i,i)}else{if(t.useOffAxisProjection)throw new Error("Off-Axis projection is not supported at this time");{const r=Math.tan(yo(t.viewAngle)/2);let n,o;!0===t.useHorizontalViewAngle?(n=t.clippingRange[0]*r,o=t.clippingRange[0]*r/e):(n=t.clippingRange[0]*r*e,o=t.clippingRange[0]*r);const a=(t.windowCenter[0]-1)*n,s=(t.windowCenter[0]+1)*n,u=(t.windowCenter[1]-1)*o,c=(t.windowCenter[1]+1)*o,d=l[0],p=l[1];i[0]=2*d/(s-a),i[5]=2*d/(c-u),i[2]=(a+s)/(s-a),i[6]=(u+c)/(c-u),i[10]=-(d+p)/(p-d),i[14]=-1,i[11]=-2*d*p/(p-d),i[15]=0}}return d(o,i),o},e.getCompositeProjectionMatrix=(t,r,n)=>{const o=e.getViewMatrix(),i=e.getProjectionMatrix(t,r,n);return b(i,o,i),i},e.setDirectionOfProjection=(e,r,n)=>{if(t.directionOfProjection[0]===e&&t.directionOfProjection[1]===r&&t.directionOfProjection[2]===n)return;t.directionOfProjection[0]=e,t.directionOfProjection[1]=r,t.directionOfProjection[2]=n;const o=t.directionOfProjection;t.focalPoint[0]=t.position[0]+o[0]*t.distance,t.focalPoint[1]=t.position[1]+o[1]*t.distance,t.focalPoint[2]=t.position[2]+o[2]*t.distance,v()},e.setDeviceAngles=(r,n,o,i)=>{const a=[3];Fo(t.physicalViewNorth,t.physicalViewUp,a);const s=h(new Float64Array(16));S(s,s,yo(r),t.physicalViewUp),S(s,s,yo(n),a),S(s,s,yo(o),t.physicalViewNorth),S(s,s,yo(-i),t.physicalViewUp);const l=new Float64Array([-t.physicalViewUp[0],-t.physicalViewUp[1],-t.physicalViewUp[2]]),u=new Float64Array(t.physicalViewNorth);Sr(l,l,s),Sr(u,u,s),e.setDirectionOfProjection(l[0],l[1],l[2]),e.setViewUp(u[0],u[1],u[2]),e.modified()},e.setOrientationWXYZ=(t,r,n,o)=>{const i=h(new Float64Array(16));if(0!==t&&(0!==r||0!==n||0!==o)){const e=yo(t),a=Mi();Ri(a,[r,n,o],e),U(i,a)}const a=new Float64Array(3);Sr(a,[0,0,-1],i);const s=new Float64Array(3);Sr(s,[0,1,0],i),e.setDirectionOfProjection(...a),e.setViewUp(...s),e.modified()},e.computeClippingRange=e=>{let r=null,n=null;r=t.viewPlaneNormal,n=t.position;const o=-r[0],i=-r[1],a=-r[2],s=-(o*n[0]+i*n[1]+a*n[2]),l=[o*e[0]+i*e[2]+a*e[4]+s,1e-18];for(let t=0;t<2;t++)for(let r=0;r<2;r++)for(let n=0;n<2;n++){const u=o*e[n]+i*e[2+r]+a*e[4+t]+s;l[0]=ul[1]?u:l[1]}return l}}(e,t)}var Lh={newInstance:zt.newInstance(Bh,"vtkCamera"),extend:Bh};const kh={switch:!0,intensity:1,color:[1,1,1],position:[0,0,1],focalPoint:[0,0,0],positional:!1,exponent:1,coneAngle:30,coneFalloff:5,attenuationValues:[1,0,0],transformMatrix:null,lightType:"SceneLight",shadowAttenuation:1,direction:[0,0,0],directionMTime:0};function Uh(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,kh,r),zt.obj(e,t),zt.setGet(e,t,["intensity","switch","positional","exponent","coneAngle","coneFalloff","transformMatrix","lightType","shadowAttenuation","attenuationValues"]),zt.setGetArray(e,t,["color","position","focalPoint","attenuationValues"],3),function(e,t){t.classHierarchy.push("vtkLight");const r=new Float64Array(3);e.getTransformedPosition=()=>(t.transformMatrix?Sr(r,t.position,t.transformMatrix):mr(r,t.position[0],t.position[1],t.position[2]),r),e.getTransformedFocalPoint=()=>(t.transformMatrix?Sr(r,t.focalPoint,t.transformMatrix):mr(r,t.focalPoint[0],t.focalPoint[1],t.focalPoint[2]),r),e.getDirection=()=>(t.directionMTime{const r=new Float64Array(3);wr(r,t.position,e),t.focalPoint=r},e.setDirectionAngle=(t,r)=>{const n=yo(t),o=yo(r);e.setPosition(Math.cos(n)*Math.sin(o),Math.sin(n),Math.cos(n)*Math.cos(o)),e.setFocalPoint(0,0,0),e.setPositional(0)},e.setLightTypeToHeadLight=()=>{e.setLightType("HeadLight")},e.setLightTypeToCameraLight=()=>{e.setLightType("CameraLight")},e.setLightTypeToSceneLight=()=>{e.setTransformMatrix(null),e.setLightType("SceneLight")},e.lightTypeIsHeadLight=()=>"HeadLight"===t.lightType,e.lightTypeIsSceneLight=()=>"SceneLight"===t.lightType,e.lightTypeIsCameraLight=()=>"CameraLight"===t.lightType}(e,t)}var Vh={newInstance:zt.newInstance(Uh,"vtkLight"),extend:Uh,LIGHT_TYPES:["HeadLight","CameraLight","SceneLight"]};const{vtkErrorMacro:Gh}=zt;const zh={background:[0,0,0],background2:[.2,.2,.2],gradientBackground:!1,viewport:[0,0,1,1],aspect:[1,1],pixelAspect:[1,1],props:[],actors2D:[]};function jh(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,zh,r),zt.obj(e,t),zt.event(e,t,"event"),zt.setGetArray(e,t,["viewport"],4),zt.setGetArray(e,t,["background","background2"],3),function(e,t){function r(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];t.push(e);const n=e.getNestedProps();if(n&&n.length)for(let e=0;et.props,e.hasViewProp=e=>t.props.includes(e),e.addViewProp=r=>{r&&!e.hasViewProp(r)&&t.props.push(r)},e.removeViewProp=e=>{const r=t.props.filter(t=>t!==e);t.props.length!==r.length&&(t.props=r)},e.removeAllViewProps=()=>{t.props=[]},e.getViewPropsWithNestedProps=()=>{let e=[];t.actors2D=[];for(let n=0;n0)?t.actors2D=t.actors2D.concat(o):r(t.props[n],e)}return t.actors2D.sort((e,t)=>e.getLayerNumber()-t.getLayerNumber()),e=e.concat(t.actors2D),e},e.addActor2D=e.addViewProp,e.removeActor2D=t=>{e.removeViewProp(t)},e.getActors2D=()=>(t.actors2D=[],t.props.forEach(e=>{t.actors2D=t.actors2D.concat(e.getActors2D())}),t.actors2D),e.displayToView=()=>Gh("call displayToView on your view instead"),e.viewToDisplay=()=>Gh("callviewtodisplay on your view instead"),e.getSize=()=>Gh("call getSize on your View instead"),e.normalizedDisplayToProjection=(t,r,n)=>{const o=e.normalizedDisplayToNormalizedViewport(t,r,n);return e.normalizedViewportToProjection(o[0],o[1],o[2])},e.normalizedDisplayToNormalizedViewport=(e,r,n)=>{const o=[t.viewport[2]-t.viewport[0],t.viewport[3]-t.viewport[1]];return[(e-t.viewport[0])/o[0],(r-t.viewport[1])/o[1],n]},e.normalizedViewportToProjection=(e,t,r)=>[2*e-1,2*t-1,2*r-1],e.projectionToNormalizedDisplay=(t,r,n)=>{const o=e.projectionToNormalizedViewport(t,r,n);return e.normalizedViewportToNormalizedDisplay(o[0],o[1],o[2])},e.normalizedViewportToNormalizedDisplay=(e,r,n)=>{const o=[t.viewport[2]-t.viewport[0],t.viewport[3]-t.viewport[1]];return[e*o[0]+t.viewport[0],r*o[1]+t.viewport[1],n]},e.projectionToNormalizedViewport=(e,t,r)=>[.5*(e+1),.5*(t+1),.5*(r+1)],e.PickPropFrom=()=>Gh("vtkViewport::PickPropFrom - NOT IMPLEMENTED")}(e,t)}var Wh={newInstance:zt.newInstance(jh,"vtkViewport"),extend:jh};const{vtkDebugMacro:Hh,vtkErrorMacro:Kh,vtkWarningMacro:Xh}=jt;function $h(e){return()=>Kh(`vtkRenderer::${e} - NOT IMPLEMENTED`)}const qh={pickedProp:null,activeCamera:null,allBounds:[],ambient:[1,1,1],allocatedRenderTime:100,timeFactor:1,automaticLightCreation:!0,twoSidedLighting:!0,lastRenderTimeInSeconds:-1,renderWindow:null,lights:[],actors:[],volumes:[],lightFollowCamera:!0,numberOfPropsRendered:0,propArray:null,pathArray:null,layer:0,preserveColorBuffer:!1,preserveDepthBuffer:!1,computeVisiblePropBounds:Ei(),interactive:!0,nearClippingPlaneTolerance:0,clippingRangeExpansion:.05,erase:!0,draw:!0,useShadows:!1,useDepthPeeling:!1,occlusionRatio:0,maximumNumberOfPeels:4,selector:null,delegate:null,texturedBackground:!1,backgroundTexture:null,environmentTexture:null,environmentTextureDiffuseStrength:1,environmentTextureSpecularStrength:1,useEnvironmentTextureAsBackground:!1,pass:0};function Yh(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};for(Object.assign(t,qh,r),Wh.extend(e,t,r),t.background||(t.background=[0,0,0,1]);t.background.length<3;)t.background.push(0);3===t.background.length&&t.background.push(1),yt(e,t,["_renderWindow","allocatedRenderTime","timeFactor","lastRenderTimeInSeconds","numberOfPropsRendered","lastRenderingUsedDepthPeeling","selector"]),_t(e,t,["twoSidedLighting","lightFollowCamera","automaticLightCreation","erase","draw","nearClippingPlaneTolerance","clippingRangeExpansion","backingStore","interactive","layer","preserveColorBuffer","preserveDepthBuffer","useDepthPeeling","occlusionRatio","maximumNumberOfPeels","delegate","backgroundTexture","texturedBackground","environmentTexture","environmentTextureDiffuseStrength","environmentTextureSpecularStrength","useEnvironmentTextureAsBackground","useShadows","pass"]),St(e,t,["actors","volumes","lights"]),Tt(e,t,["background"],4,1),wt(0,t,["renderWindow"]),function(e,t){t.classHierarchy.push("vtkRenderer");const r={type:"ComputeVisiblePropBoundsEvent",renderer:e},n={type:"ResetCameraClippingRangeEvent",renderer:e},o={type:"ResetCameraEvent",renderer:e};e.updateCamera=()=>(t.activeCamera||(Hh("No cameras are on, creating one."),e.getActiveCameraAndResetIfCreated()),t.activeCamera.render(e),!0),e.updateLightsGeometryToFollowCamera=()=>{const r=e.getActiveCameraAndResetIfCreated();t.lights.forEach(e=>{e.lightTypeIsSceneLight()||(e.lightTypeIsHeadLight()?(e.setPositionFrom(r.getPositionByReference()),e.setFocalPointFrom(r.getFocalPointByReference()),e.modified(r.getMTime())):e.lightTypeIsCameraLight()?e.setTransformMatrix(r.getCameraLightTransformMatrix(u())):Kh("light has unknown light type",e.get()))})},e.updateLightGeometry=()=>!t.lightFollowCamera||e.updateLightsGeometryToFollowCamera(),e.allocateTime=$h("allocateTime"),e.updateGeometry=$h("updateGeometry"),e.getVTKWindow=()=>t._renderWindow,e.setLayer=r=>{Hh(e.getClassName(),e,"setting Layer to ",r),t.layer!==r&&(t.layer=r,e.modified()),e.setPreserveColorBuffer(!!r)},e.setActiveCamera=r=>t.activeCamera!==r&&(t.activeCamera=r,e.modified(),e.invokeEvent({type:"ActiveCameraEvent",camera:r}),!0),e.makeCamera=()=>{const t=Lh.newInstance();return e.invokeEvent({type:"CreateCameraEvent",camera:t}),t},e.getActiveCamera=()=>(t.activeCamera||(t.activeCamera=e.makeCamera()),t.activeCamera),e.getActiveCameraAndResetIfCreated=()=>(t.activeCamera||(e.getActiveCamera(),e.resetCamera()),t.activeCamera),e.getActors=()=>(t.actors=[],t.props.forEach(e=>{t.actors=t.actors.concat(e.getActors())}),t.actors),e.addActor=e.addViewProp,e.removeActor=r=>{t.actors=t.actors.filter(e=>e!==r),e.removeViewProp(r),e.modified()},e.removeAllActors=()=>{e.getActors().forEach(t=>{e.removeViewProp(t)}),t.actors=[],e.modified()},e.getVolumes=()=>(t.volumes=[],t.props.forEach(e=>{t.volumes=t.volumes.concat(e.getVolumes())}),t.volumes),e.addVolume=e.addViewProp,e.removeVolume=r=>{t.volumes=t.volumes.filter(e=>e!==r),e.removeViewProp(r),e.modified()},e.removeAllVolumes=()=>{e.getVolumes().forEach(t=>{e.removeViewProp(t)}),t.volumes=[],e.modified()},e.hasLight=e=>t.lights.includes(e),e.addLight=r=>{r&&!e.hasLight(r)&&(t.lights.push(r),e.modified())},e.removeLight=r=>{t.lights=t.lights.filter(e=>e!==r),e.modified()},e.removeAllLights=()=>{t.lights=[],e.modified()},e.setLightCollection=r=>{t.lights=r,e.modified()},e.makeLight=Vh.newInstance,e.createLight=()=>{t.automaticLightCreation&&(t._createdLight&&(e.removeLight(t._createdLight),t._createdLight.delete(),t._createdLight=null),t._createdLight=e.makeLight(),e.addLight(t._createdLight),t._createdLight.setLightTypeToHeadLight(),t._createdLight.setPosition(e.getActiveCamera().getPosition()),t._createdLight.setFocalPoint(e.getActiveCamera().getFocalPoint()))},e.normalizedDisplayToWorld=(t,r,n,o)=>{let i=e.normalizedDisplayToProjection(t,r,n);return i=e.projectionToView(i[0],i[1],i[2],o),e.viewToWorld(i[0],i[1],i[2])},e.worldToNormalizedDisplay=(t,r,n,o)=>{let i=e.worldToView(t,r,n);return i=e.viewToProjection(i[0],i[1],i[2],o),e.projectionToNormalizedDisplay(i[0],i[1],i[2])},e.viewToWorld=(e,r,n)=>{if(null===t.activeCamera)return Kh("ViewToWorld: no active camera, cannot compute view to world, returning 0,0,0"),[0,0,0];const o=t.activeCamera.getViewMatrix();g(o,o),m(o,o);const i=new Float64Array([e,r,n]);return Sr(i,i,o),i},e.projectionToView=(e,r,n,o)=>{if(null===t.activeCamera)return Kh("ProjectionToView: no active camera, cannot compute projection to view, returning 0,0,0"),[0,0,0];const i=t.activeCamera.getProjectionMatrix(o,-1,1);g(i,i),m(i,i);const a=new Float64Array([e,r,n]);return Sr(a,a,i),a},e.worldToView=(e,r,n)=>{if(null===t.activeCamera)return Kh("WorldToView: no active camera, cannot compute view to world, returning 0,0,0"),[0,0,0];const o=t.activeCamera.getViewMatrix();m(o,o);const i=new Float64Array([e,r,n]);return Sr(i,i,o),i},e.viewToProjection=(e,r,n,o)=>{if(null===t.activeCamera)return Kh("ViewToProjection: no active camera, cannot compute view to projection, returning 0,0,0"),[0,0,0];const i=t.activeCamera.getProjectionMatrix(o,-1,1);m(i,i);const a=new Float64Array([e,r,n]);return Sr(a,a,i),a},e.computeVisiblePropBounds=()=>{t.allBounds[0]=Va.INIT_BOUNDS[0],t.allBounds[1]=Va.INIT_BOUNDS[1],t.allBounds[2]=Va.INIT_BOUNDS[2],t.allBounds[3]=Va.INIT_BOUNDS[3],t.allBounds[4]=Va.INIT_BOUNDS[4],t.allBounds[5]=Va.INIT_BOUNDS[5];let n=!0;e.invokeEvent(r);for(let e=0;et.allBounds[1]&&(t.allBounds[1]=e[1]),e[2]t.allBounds[3]&&(t.allBounds[3]=e[3]),e[4]t.allBounds[5]&&(t.allBounds[5]=e[5]))}}return n&&(yi(t.allBounds),Hh("Can't compute bounds, no 3D props are visible")),t.allBounds},e.resetCamera=function(){const r=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:null)||e.computeVisiblePropBounds(),n=[0,0,0];if(!vi(r))return Hh("Cannot reset camera!"),!1;let i=null;if(!e.getActiveCamera())return Kh("Trying to reset non-existent camera"),!1;i=t.activeCamera.getViewPlaneNormal(),t.activeCamera.setViewAngle(30),n[0]=(r[0]+r[1])/2,n[1]=(r[2]+r[3])/2,n[2]=(r[4]+r[5])/2;let a=r[1]-r[0],s=r[3]-r[2],l=r[5]-r[4];a*=a,s*=s,l*=l;let u=a+s+l;u=0===u?1:u,u=.5*Math.sqrt(u);const c=yo(t.activeCamera.getViewAngle()),d=u,p=u/Math.sin(.5*c),f=t.activeCamera.getViewUp();return Math.abs(Ro(f,i))>.999&&(Xh("Resetting view-up since view plane normal is parallel"),t.activeCamera.setViewUp(-f[2],f[0],f[1])),t.activeCamera.setFocalPoint(n[0],n[1],n[2]),t.activeCamera.setPosition(n[0]+p*i[0],n[1]+p*i[1],n[2]+p*i[2]),e.resetCameraClippingRange(r),t.activeCamera.setParallelScale(d),t.activeCamera.setPhysicalScale(u),t.activeCamera.setPhysicalTranslation(-n[0],-n[1],-n[2]),e.invokeEvent(o),!0},e.resetCameraClippingRange=function(){const r=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:null)||e.computeVisiblePropBounds();if(!vi(r))return Hh("Cannot reset camera clipping range!"),!1;if(e.getActiveCameraAndResetIfCreated(),!t.activeCamera)return Kh("Trying to reset clipping range of non-existent camera"),!1;const o=t.activeCamera.computeClippingRange(r);let i=0;if(t.activeCamera.getParallelProjection())i=.2*t.activeCamera.getParallelScale();else{const e=yo(t.activeCamera.getViewAngle());i=.2*Math.tan(e/2)*o[1]}return o[1]-o[0]=o[1]?.01*o[1]:o[0],t.nearClippingPlaneTolerance||(t.nearClippingPlaneTolerance=.01),o[0]{e!==t._renderWindow&&(t._vtkWindow=e,t._renderWindow=e)},e.visibleActorCount=()=>t.props.filter(e=>e.getVisibility()).length,e.visibleVolumeCount=e.visibleActorCount,e.getMTime=()=>{let e=t.mtime;const r=t.activeCamera?t.activeCamera.getMTime():0;r>e&&(e=r);const n=t._createdLight?t._createdLight.getMTime():0;return n>e&&(e=n),e},e.getTransparent=()=>!!t.preserveColorBuffer,e.isActiveCameraCreated=()=>!!t.activeCamera}(e,t)}var Jh={newInstance:Pt(Yh,"vtkRenderer"),extend:Yh};const Qh=Object.create(null);function Zh(e,t){Qh[e]=t}function em(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Qh[e]&&Qh[e](t)}const tm={defaultViewAPI:"WebGL",renderers:[],views:[],interactor:null,neverRendered:!0,numberOfLayers:1,childRenderWindows:[]};function rm(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,tm,r),zt.obj(e,t),zt.setGet(e,t,["interactor","numberOfLayers","_views","defaultViewAPI"]),zt.get(e,t,["neverRendered"]),zt.getArray(e,t,["renderers","childRenderWindows"]),zt.moveToProtected(e,t,["views"]),zt.event(e,t,"completion"),function(e,t){t.classHierarchy.push("vtkRenderWindow"),e.addRenderer=r=>{e.hasRenderer(r)||(r.setRenderWindow(e),t.renderers.push(r),e.modified())},e.removeRenderer=r=>{t.renderers=t.renderers.filter(e=>e!==r),e.modified()},e.hasRenderer=e=>-1!==t.renderers.indexOf(e),e.newAPISpecificView=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return em(e||t.defaultViewAPI,r)},e.addView=r=>{e.hasView(r)||(r.setRenderable(e),t._views.push(r),e.modified())},e.removeView=r=>{t._views=t._views.filter(e=>e!==r),e.modified()},e.hasView=e=>-1!==t._views.indexOf(e),e.preRender=()=>{t.renderers.forEach(e=>{e.isActiveCameraCreated()||e.resetCamera()})},e.render=()=>{e.preRender(),t.interactor?t.interactor.render():t._views.forEach(e=>e.traverseAllPasses())},e.getStatistics=()=>{const e={propCount:0,invisiblePropCount:0,gpuMemoryMB:0};return t._views.forEach(t=>{t.getGraphicsMemoryInfo&&(e.gpuMemoryMB+=t.getGraphicsMemoryInfo()/1e6)}),t.renderers.forEach(r=>{const n=r.getViewProps(),o=t._views[0].getViewNodeFor(r);n.forEach(t=>{if(t.getVisibility()){e.propCount+=1;const r=t.getMapper&&t.getMapper();if(r&&r.getPrimitiveCount){const t=o.getViewNodeFor(r);if(t){t.getAllocatedGPUMemoryInBytes&&(e.gpuMemoryMB+=t.getAllocatedGPUMemoryInBytes()/1e6);const n=r.getPrimitiveCount();Object.keys(n).forEach(t=>{e[t]||(e[t]=0),e[t]+=n[t]})}}}else e.invisiblePropCount+=1})}),e.str=Object.keys(e).map(t=>`${t}: ${e[t]}`).join("\n"),e},e.captureImages=function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return zt.setImmediate(e.render),t._views.map(e=>e.captureNextImage?e.captureNextImage(r,n):void 0).filter(e=>!!e)},e.addRenderWindow=r=>!t.childRenderWindows.includes(r)&&(t.childRenderWindows.push(r),e.modified(),!0),e.removeRenderWindow=r=>{const n=t.childRenderWindows.findIndex(e=>e===r);return!(n<0||(t.childRenderWindows.splice(n,1),e.modified(),0))}}(e,t)}var nm={newInstance:zt.newInstance(rm,"vtkRenderWindow"),extend:rm,registerViewConstructor:Zh,listViewAPIs:function(){return Object.keys(Qh)},newAPISpecificView:em};const om={Unknown:0,LeftController:1,RightController:2},im={Unknown:0,Trigger:1,TrackPad:2,Grip:3,Thumbstick:4,A:5,B:6,ApplicationMenu:7};var am={Device:om,Input:im,Axis:{Unknown:0,TouchpadX:1,TouchpadY:2,ThumbstickX:3,ThumbstickY:4},MouseButton:{LeftButton:1,MiddleButton:2,RightButton:3}};const{Device:sm,Input:lm}=am,{vtkWarningMacro:um,vtkErrorMacro:cm,normalizeWheel:dm,vtkOnceErrorMacro:pm}=zt,fm={ctrlKey:!1,altKey:!1,shiftKey:!1},hm={"xr-standard":[lm.Trigger,lm.Grip,lm.TrackPad,lm.Thumbstick,lm.A,lm.B]},mm=["StartAnimation","Animation","EndAnimation","PointerEnter","PointerLeave","MouseEnter","MouseLeave","StartMouseMove","MouseMove","EndMouseMove","LeftButtonPress","LeftButtonRelease","MiddleButtonPress","MiddleButtonRelease","RightButtonPress","RightButtonRelease","KeyPress","KeyDown","KeyUp","StartMouseWheel","MouseWheel","EndMouseWheel","StartPinch","Pinch","EndPinch","StartPan","Pan","EndPan","StartRotate","Rotate","EndRotate","Button3D","Move3D","StartPointerLock","EndPointerLock","StartInteraction","Interaction","EndInteraction","AnimationFrameRateUpdate"];function gm(e){e.cancelable&&e.preventDefault()}function ym(e){const t=Object.create(null);return e.forEach(e=>{let{pointerId:r,position:n}=e;t[r]=n}),t}const vm={renderWindow:null,interactorStyle:null,picker:null,pickingManager:null,initialized:!1,enabled:!1,enableRender:!0,currentRenderer:null,lightFollowCamera:!0,desiredUpdateRate:30,stillUpdateRate:2,container:null,recognizeGestures:!0,currentGesture:"Start",animationRequest:null,lastFrameTime:.1,recentAnimationFrameRate:10,wheelTimeoutID:0,moveTimeoutID:0,lastGamepadValues:{},preventDefaultOnPointerDown:!1,preventDefaultOnPointerUp:!1,mouseScrollDebounceByPass:!1};function bm(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,vm,r),zt.obj(e,t),t._animationExtendedEnd=0,zt.event(e,t,"RenderEvent"),mm.forEach(r=>zt.event(e,t,r)),zt.get(e,t,["initialized","interactorStyle","lastFrameTime","recentAnimationFrameRate","_view"]),zt.setGet(e,t,["container","lightFollowCamera","enabled","enableRender","recognizeGestures","desiredUpdateRate","stillUpdateRate","picker","preventDefaultOnPointerDown","preventDefaultOnPointerUp","mouseScrollDebounceByPass"]),zt.moveToProtected(e,t,["view"]),function(e,t){t.classHierarchy.push("vtkRenderWindowInteractor");const r={...e},n=new Set,o=new Map;let i=1;function a(r,n){t._forcedRenderer||(t.currentRenderer=e.findPokedRenderer(r,n))}e.start=()=>{(t.initialized||(e.initialize(),t.initialized))&&e.startEventLoop()},e.setRenderWindow=e=>{cm("you want to call setView(view) instead of setRenderWindow on a vtk.js interactor")},e.setInteractorStyle=r=>{t.interactorStyle!==r&&(null!=t.interactorStyle&&t.interactorStyle.setInteractor(null),t.interactorStyle=r,null!=t.interactorStyle&&t.interactorStyle.getInteractor()!==e&&t.interactorStyle.setInteractor(e))},e.initialize=()=>{t.initialized=!0,e.enable(),e.render()},e.enable=()=>e.setEnabled(!0),e.disable=()=>e.setEnabled(!1),e.startEventLoop=()=>um("empty event loop"),e.getCurrentRenderer=()=>(t.currentRenderer||a(0,0),t.currentRenderer);const s=t._getScreenEventPositionFor||function(e){const r=t._view.getCanvas(),n=r.getBoundingClientRect(),i=r.width/n.width,s=r.height/n.height,l={x:i*(e.clientX-n.left),y:s*(n.height-e.clientY+n.top),z:0,movementX:i*e.movementX,movementY:s*e.movementY};return(o.size<=1||!t.currentRenderer)&&a(l.x,l.y),l};function l(e){return{controlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey}}function u(e){const t=l(e);return{key:e.key,keyCode:e.charCode,...t}}function c(e){return e.pointerType||""}const d=()=>{if(null===t.container)return;const{container:r}=t;r.addEventListener("contextmenu",gm),r.addEventListener("wheel",e.handleWheel),r.addEventListener("DOMMouseScroll",e.handleWheel),r.addEventListener("pointerenter",e.handlePointerEnter),r.addEventListener("pointerleave",e.handlePointerLeave),r.addEventListener("pointermove",e.handlePointerMove,{passive:!1}),r.addEventListener("pointerdown",e.handlePointerDown,{passive:!1}),r.addEventListener("pointerup",e.handlePointerUp),r.addEventListener("pointercancel",e.handlePointerCancel),r.addEventListener("keypress",e.handleKeyPress),r.addEventListener("keydown",e.handleKeyDown),document.addEventListener("keyup",e.handleKeyUp),document.addEventListener("pointerlockchange",e.handlePointerLockChange),r.tabIndex=0,r.style.touchAction="none",r.style.userSelect="none",r.style.webkitTapHighlightColor="rgba(0,0,0,0)"};e.bindEvents=e=>{null!==e&&r.setContainer(e)&&d()};const p=()=>{clearTimeout(t.moveTimeoutID),clearTimeout(t.wheelTimeoutID),t.moveTimeoutID=0,t.wheelTimeoutID=0,i=1;const{container:r}=t;r&&(r.removeEventListener("contextmenu",gm),r.removeEventListener("wheel",e.handleWheel),r.removeEventListener("DOMMouseScroll",e.handleWheel),r.removeEventListener("pointerenter",e.handlePointerEnter),r.removeEventListener("pointerleave",e.handlePointerLeave),r.removeEventListener("pointermove",e.handlePointerMove,{passive:!1}),r.removeEventListener("pointerdown",e.handlePointerDown,{passive:!1}),r.removeEventListener("pointerup",e.handlePointerUp),r.removeEventListener("pointercancel",e.handlePointerCancel),r.removeEventListener("keypress",e.handleKeyPress),r.removeEventListener("keydown",e.handleKeyDown)),document.removeEventListener("keyup",e.handleKeyUp),document.removeEventListener("pointerlockchange",e.handlePointerLockChange),o.clear()};function f(){t._view&&t.enabled&&t.enableRender&&(t.inRender=!0,t._view.traverseAllPasses(),t.inRender=!1),e.invokeRenderEvent()}e.unbindEvents=()=>{p(),r.setContainer(null)},e.handleKeyPress=t=>{const r=u(t);e.keyPressEvent(r)},e.handleKeyDown=t=>{const r=u(t);e.keyDownEvent(r)},e.handleKeyUp=t=>{const r=u(t);e.keyUpEvent(r)},e.handlePointerEnter=t=>{const r={...l(t),position:s(t),deviceType:c(t)};e.pointerEnterEvent(r),"mouse"===r.deviceType&&e.mouseEnterEvent(r)},e.handlePointerLeave=t=>{const r={...l(t),position:s(t),deviceType:c(t)};e.pointerLeaveEvent(r),"mouse"===r.deviceType&&e.mouseLeaveEvent(r)},e.handlePointerDown=r=>{if(!(r.button>2||e.isPointerLocked()))switch(t.preventDefaultOnPointerDown&&gm(r),r.target.hasPointerCapture(r.pointerId)&&r.target.releasePointerCapture(r.pointerId),t.container.setPointerCapture(r.pointerId),o.has(r.pointerId)&&um("[RenderWindowInteractor] duplicate pointerId detected"),o.set(r.pointerId,{pointerId:r.pointerId,position:s(r)}),r.pointerType){case"pen":case"touch":e.handleTouchStart(r);break;default:e.handleMouseDown(r)}},e.handlePointerUp=r=>{if(o.has(r.pointerId))switch(t.preventDefaultOnPointerUp&&gm(r),o.delete(r.pointerId),t.container.releasePointerCapture(r.pointerId),r.pointerType){case"pen":case"touch":e.handleTouchEnd(r);break;default:e.handleMouseUp(r)}},e.handlePointerCancel=t=>{if(o.has(t.pointerId))switch(o.delete(t.pointerId),t.pointerType){case"pen":case"touch":e.handleTouchEnd(t);break;default:e.handleMouseUp(t)}},e.handlePointerMove=t=>{switch(o.has(t.pointerId)&&(o.get(t.pointerId).position=s(t)),t.pointerType){case"pen":case"touch":e.handleTouchMove(t);break;default:e.handleMouseMove(t)}},e.handleMouseDown=t=>{const r={...l(t),position:s(t),deviceType:c(t)};switch(t.button){case 0:e.leftButtonPressEvent(r);break;case 1:e.middleButtonPressEvent(r);break;case 2:e.rightButtonPressEvent(r);break;default:cm(`Unknown mouse button pressed: ${t.button}`)}},e.requestPointerLock=()=>{t.container&&t.container.requestPointerLock()},e.exitPointerLock=()=>document.exitPointerLock?.(),e.isPointerLocked=()=>!!t.container&&document.pointerLockElement===t.container,e.handlePointerLockChange=()=>{e.isPointerLocked()?e.startPointerLockEvent():e.endPointerLockEvent()},e.requestAnimation=r=>{void 0!==r?n.has(r)?um("requester is already registered for animating"):(n.add(r),t.animationRequest||1!==n.size||t.xrAnimation||(t._animationStartTime=Date.now(),t._animationFrameCount=0,t.animationRequest=requestAnimationFrame(e.handleAnimation),e.startAnimationEvent())):cm("undefined requester, can not start animating")},e.extendAnimation=r=>{const o=Date.now()+r;t._animationExtendedEnd=Math.max(t._animationExtendedEnd,o),t.animationRequest||0!==n.size||t.xrAnimation||(t._animationStartTime=Date.now(),t._animationFrameCount=0,t.animationRequest=requestAnimationFrame(e.handleAnimation),e.startAnimationEvent())},e.isAnimating=()=>t.xrAnimation||null!==t.animationRequest,e.cancelAnimation=function(r){let o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(n.has(r))n.delete(r),t.animationRequest&&0===n.size&&Date.now()>t._animationExtendedEnd&&(cancelAnimationFrame(t.animationRequest),t.animationRequest=null,e.endAnimationEvent(),e.render());else if(!o){const e=r&&r.getClassName?r.getClassName():r;um(`${e} did not request an animation`)}},e.switchToXRAnimation=()=>{t.animationRequest&&(cancelAnimationFrame(t.animationRequest),t.animationRequest=null),t.xrAnimation=!0},e.returnFromXRAnimation=()=>{t.xrAnimation=!1,0!==n.size&&(t.recentAnimationFrameRate=10,t.animationRequest=requestAnimationFrame(e.handleAnimation))},e.updateXRGamepads=(r,n,o)=>{r.inputSources.forEach(r=>{const i=null==r.gripSpace?null:n.getPose(r.gripSpace,o),a=null==r.gripSpace?null:n.getPose(r.targetRaySpace,o),s=r.gamepad,l=r.handedness;if(s){s.index in t.lastGamepadValues||(t.lastGamepadValues[s.index]={left:{buttons:{}},right:{buttons:{}},none:{buttons:{}}});for(let n=0;n{const n={...l(r),position:s(r),deviceType:c(r)};0===t.moveTimeoutID?e.startMouseMoveEvent(n):(e.mouseMoveEvent(n),clearTimeout(t.moveTimeoutID)),t.moveTimeoutID=setTimeout(()=>{e.endMouseMoveEvent(),t.moveTimeoutID=0},200)},e.handleAnimation=()=>{const r=Date.now();t._animationFrameCount++,r-t._animationStartTime>1e3&&t._animationFrameCount>1&&(t.recentAnimationFrameRate=1e3*(t._animationFrameCount-1)/(r-t._animationStartTime),t.lastFrameTime=1/t.recentAnimationFrameRate,e.animationFrameRateUpdateEvent(),t._animationStartTime=r,t._animationFrameCount=1),e.animationEvent(),f(),n.size>0||Date.now(){gm(r);const n={...dm(r),...l(r),position:s(r),deviceType:c(r)};0===t.wheelTimeoutID&&(i=Math.abs(n.spinY)>=.3?Math.abs(n.spinY):1),n.spinY/=i,0===t.wheelTimeoutID?(e.startMouseWheelEvent(n),e.mouseWheelEvent(n)):(e.mouseWheelEvent(n),clearTimeout(t.wheelTimeoutID)),t.mouseScrollDebounceByPass?(e.extendAnimation(600),e.endMouseWheelEvent(),t.wheelTimeoutID=0):t.wheelTimeoutID=setTimeout(()=>{e.extendAnimation(600),e.endMouseWheelEvent(),t.wheelTimeoutID=0},200)},e.handleMouseUp=t=>{const r={...l(t),position:s(t),deviceType:c(t)};switch(t.button){case 0:e.leftButtonReleaseEvent(r);break;case 1:e.middleButtonReleaseEvent(r);break;case 2:e.rightButtonReleaseEvent(r);break;default:cm(`Unknown mouse button released: ${t.button}`)}},e.handleTouchStart=r=>{const n=[...o.values()];if(t.recognizeGestures&&n.length>1){const t=ym(o);if(2===n.length){const t={...l(fm),position:n[0].position,deviceType:c(r)};e.leftButtonReleaseEvent(t)}e.recognizeGesture("TouchStart",t)}else if(1===n.length){const t={...l(fm),position:s(r),deviceType:c(r)};e.leftButtonPressEvent(t)}},e.handleTouchMove=r=>{const n=[...o.values()];if(t.recognizeGestures&&n.length>1){const t=ym(o);e.recognizeGesture("TouchMove",t)}else if(1===n.length){const t={...l(fm),position:n[0].position,deviceType:c(r)};e.mouseMoveEvent(t)}},e.handleTouchEnd=r=>{const n=[...o.values()];if(t.recognizeGestures)if(0===n.length){const t={...l(fm),position:s(r),deviceType:c(r)};e.leftButtonReleaseEvent(t)}else if(1===n.length){const t=ym(o);e.recognizeGesture("TouchEnd",t);const i={...l(fm),position:n[0].position,deviceType:c(r)};e.leftButtonPressEvent(i)}else{const t=ym(o);e.recognizeGesture("TouchMove",t)}else if(1===n.length){const t={...l(fm),position:n[0].position,deviceType:c(r)};e.leftButtonReleaseEvent(t)}},e.setView=r=>{t._view!==r&&(t._view=r,t._view.getRenderable().setInteractor(e),e.modified())},e.getFirstRenderer=()=>t._view?.getRenderable()?.getRenderersByReference()?.[0],e.findPokedRenderer=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!t._view)return null;const n=t._view?.getRenderable()?.getRenderers();if(!n||0===n.length)return null;n.sort((e,t)=>e.getLayer()-t.getLayer());let o=null,i=null,a=null,s=n.length;for(;s--;){const l=n[s];if(t._view.isInViewport(e,r,l)&&l.getInteractive()){a=l;break}null===o&&l.getInteractive()&&(o=l),null===i&&t._view.isInViewport(e,r,l)&&(i=l)}return null===a&&(a=o),null===a&&(a=i),null==a&&(a=n[0]),a},e.render=()=>{e.isAnimating()||t.inRender||f()},mm.forEach(r=>{const n=r.charAt(0).toLowerCase()+r.slice(1);e[`${n}Event`]=n=>{if(!t.enabled)return;if(!e.getCurrentRenderer())return void pm("\n Can not forward events without a current renderer on the interactor.\n ");const o={type:r,pokedRenderer:t.currentRenderer,firstRenderer:e.getFirstRenderer(),...n};e[`invoke${r}`](o)}}),e.recognizeGesture=(r,n)=>{if(Object.keys(n).length>2)return;if(t.startingEventPositions||(t.startingEventPositions={}),"TouchStart"===r)return Object.keys(n).forEach(e=>{t.startingEventPositions[e]=n[e]}),void(t.currentGesture="Start");if("TouchEnd"===r)return"Pinch"===t.currentGesture&&(e.render(),e.endPinchEvent()),"Rotate"===t.currentGesture&&(e.render(),e.endRotateEvent()),"Pan"===t.currentGesture&&(e.render(),e.endPanEvent()),t.currentGesture="Start",void(t.startingEventPositions={});let o=0;const i=[],a=[];Object.keys(n).forEach(e=>{i[o]=n[e],a[o]=t.startingEventPositions[e],o++});const s=Math.sqrt((a[0].x-a[1].x)*(a[0].x-a[1].x)+(a[0].y-a[1].y)*(a[0].y-a[1].y)),l=Math.sqrt((i[0].x-i[1].x)*(i[0].x-i[1].x)+(i[0].y-i[1].y)*(i[0].y-i[1].y));let u=vo(Math.atan2(a[1].y-a[0].y,a[1].x-a[0].x)),c=vo(Math.atan2(i[1].y-i[0].y,i[1].x-i[0].x)),d=c-u;c=c+180>=360?c-180:c+180,u=u+180>=360?u-180:u+180,Math.abs(c-u)r&&o>i&&o>a){t.currentGesture="Pinch";const r={scale:1,touches:n};e.startPinchEvent(r)}else if(i>r&&i>a){t.currentGesture="Rotate";const r={rotation:0,touches:n};e.startRotateEvent(r)}else if(a>r){t.currentGesture="Pan";const r={translation:[0,0],touches:n};e.startPanEvent(r)}}else{if("Rotate"===t.currentGesture){const t={rotation:d,touches:n};e.rotateEvent(t)}if("Pinch"===t.currentGesture){const t={scale:l/s,touches:n};e.pinchEvent(t)}if("Pan"===t.currentGesture){const t={translation:p,touches:n};e.panEvent(t)}}},e.handleVisibilityChange=()=>{t._animationStartTime=Date.now(),t._animationFrameCount=0},e.setCurrentRenderer=e=>{t._forcedRenderer=!!e,t.currentRenderer=e},e.setContainer=e=>{p();const t=r.setContainer(e??null);return t&&d(),t},e.delete=()=>{for(;n.size;)e.cancelAnimation(n.values().next().value);void 0!==document.hidden&&document.removeEventListener("visibilitychange",e.handleVisibilityChange),t.container&&e.setContainer(null),r.delete()},void 0!==document.hidden&&document.addEventListener("visibilitychange",e.handleVisibilityChange,!1)}(e,t)}var xm={newInstance:zt.newInstance(bm,"vtkRenderWindowInteractor"),extend:bm,handledEvents:mm,...am};const{vtkErrorMacro:_m,VOID:Sm}=zt,Cm={enabled:!0,priority:0,processEvents:!0,subscribedEvents:[]};function Tm(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Cm,r),zt.obj(e,t),zt.event(e,t,"InteractionEvent"),zt.event(e,t,"StartInteractionEvent"),zt.event(e,t,"EndInteractionEvent"),zt.get(e,t,["_interactor","enabled"]),zt.setGet(e,t,["priority","processEvents"]),zt.moveToProtected(e,t,["interactor"]),function(e,t){t.classHierarchy.push("vtkInteractorObserver");const r={...e};function n(){for(;t.subscribedEvents.length;)t.subscribedEvents.pop().unsubscribe()}function o(){xm.handledEvents.forEach(r=>{e[`handle${r}`]&&t.subscribedEvents.push(t._interactor[`on${r}`](n=>t.processEvents?e[`handle${r}`](n):Sm,t.priority))})}e.setInteractor=r=>{r!==t._interactor&&(n(),t._interactor=r,r&&t.enabled&&o(),e.modified())},e.setEnabled=r=>{r!==t.enabled&&(n(),r&&(t._interactor?o():_m("\n The interactor must be set before subscribing to events\n ")),t.enabled=r,e.modified())},e.computeDisplayToWorld=(e,r,n,o)=>e?t._interactor.getView().displayToWorld(r,n,o,e):null,e.computeWorldToDisplay=(e,r,n,o)=>e?t._interactor.getView().worldToDisplay(r,n,o,e):null,e.setPriority=e=>{r.setPriority(e)&&t._interactor&&(n(),o())}}(e,t)}var wm={newInstance:zt.newInstance(Tm,"vtkInteractorObserver"),extend:Tm,computeWorldToDisplay:function(e,t,r,n){return e.getRenderWindow().getViews()[0].worldToDisplay(t,r,n,e)},computeDisplayToWorld:function(e,t,r,n){return e.getRenderWindow().getViews()[0].displayToWorld(t,r,n,e)}},Am={States:{IS_START:0,IS_NONE:0,IS_ROTATE:1,IS_PAN:2,IS_SPIN:3,IS_DOLLY:4,IS_CAMERA_POSE:11,IS_WINDOW_LEVEL:1024,IS_SLICE:1025}};const{States:Em}=Am,Dm={Rotate:Em.IS_ROTATE,Pan:Em.IS_PAN,Spin:Em.IS_SPIN,Dolly:Em.IS_DOLLY,CameraPose:Em.IS_CAMERA_POSE,WindowLevel:Em.IS_WINDOW_LEVEL,Slice:Em.IS_SLICE},Pm={state:Em.IS_NONE,handleObservers:1,autoAdjustCameraClippingRange:1};function Im(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Pm,r),wm.extend(e,t,r),zt.setGet(e,t,["focusedRenderer"]),function(e,t){t.classHierarchy.push("vtkInteractorStyle"),Object.keys(Dm).forEach(r=>{zt.event(e,t,`Start${r}Event`),e[`start${r}`]=()=>{t.state===Em.IS_NONE&&(t.state=Dm[r],t._interactor.requestAnimation(e),e.invokeStartInteractionEvent({type:"StartInteractionEvent"}),e[`invokeStart${r}Event`]({type:`Start${r}Event`}))},zt.event(e,t,`End${r}Event`),e[`end${r}`]=()=>{t.state===Dm[r]&&(t.state=Em.IS_NONE,t._interactor.cancelAnimation(e),e.invokeEndInteractionEvent({type:"EndInteractionEvent"}),e[`invokeEnd${r}Event`]({type:`End${r}Event`}),t._interactor.render())}}),t.getRenderer=e=>t.focusedRenderer||e.pokedRenderer,e.handleKeyPress=e=>{const r=t._interactor;let n=null;switch(e.key){case"r":case"R":t.getRenderer(e).resetCamera(),r.render();break;case"w":case"W":n=t.getRenderer(e).getActors(),n.forEach(e=>{const t=e.getProperty();t.setRepresentationToWireframe&&t.setRepresentationToWireframe()}),r.render();break;case"s":case"S":n=t.getRenderer(e).getActors(),n.forEach(e=>{const t=e.getProperty();t.setRepresentationToSurface&&t.setRepresentationToSurface()}),r.render();break;case"v":case"V":n=t.getRenderer(e).getActors(),n.forEach(e=>{const t=e.getProperty();t.setRepresentationToPoints&&t.setRepresentationToPoints()}),r.render()}}}(e,t)}var Om={newInstance:zt.newInstance(Im,"vtkInteractorStyle"),extend:Im,...Am};const{States:Nm}=Am,Mm={motionFactor:10,zoomFactor:10};function Rm(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Mm,r),Om.extend(e,t,r),zt.setGet(e,t,["motionFactor","zoomFactor"]),function(e,t){t.classHierarchy.push("vtkInteractorStyleTrackballCamera"),e.handleMouseMove=r=>{const n=r.position,o=t.getRenderer(r);switch(t.state){case Nm.IS_ROTATE:e.handleMouseRotate(o,n),e.invokeInteractionEvent({type:"InteractionEvent"});break;case Nm.IS_PAN:e.handleMousePan(o,n),e.invokeInteractionEvent({type:"InteractionEvent"});break;case Nm.IS_DOLLY:e.handleMouseDolly(o,n),e.invokeInteractionEvent({type:"InteractionEvent"});break;case Nm.IS_SPIN:e.handleMouseSpin(o,n),e.invokeInteractionEvent({type:"InteractionEvent"})}t.previousPosition=n},e.handleButton3D=r=>{!r||!r.pressed||r.device!==om.RightController||r.input!==im.Trigger&&r.input!==im.TrackPad?!r||r.pressed||r.device!==om.RightController||r.input!==im.Trigger&&r.input!==im.TrackPad||t.state!==Nm.IS_CAMERA_POSE||e.endCameraPose():e.startCameraPose()},e.handleMove3D=r=>{t.state===Nm.IS_CAMERA_POSE&&e.updateCameraPose(r)},e.updateCameraPose=e=>{const r=t.getRenderer(e).getActiveCamera(),n=r.getPhysicalTranslation(),o=.025*r.getPhysicalScale(),i=r.physicalOrientationToWorldDirection([e.orientation.x,e.orientation.y,e.orientation.z,e.orientation.w]);r.setPhysicalTranslation(n[0]+i[0]*o,n[1]+i[1]*o,n[2]+i[2]*o)},e.handleLeftButtonPress=r=>{const n=r.position;t.previousPosition=n,r.shiftKey?r.controlKey||r.altKey?e.startDolly():e.startPan():r.controlKey||r.altKey?e.startSpin():e.startRotate()},e.handleLeftButtonRelease=()=>{switch(t.state){case Nm.IS_DOLLY:e.endDolly();break;case Nm.IS_PAN:e.endPan();break;case Nm.IS_SPIN:e.endSpin();break;case Nm.IS_ROTATE:e.endRotate()}},e.handleStartMouseWheel=()=>{e.startDolly()},e.handleEndMouseWheel=()=>{e.endDolly()},e.handleStartPinch=r=>{t.previousScale=r.scale,e.startDolly()},e.handleEndPinch=()=>{e.endDolly()},e.handleStartRotate=r=>{t.previousRotation=r.rotation,e.startRotate()},e.handleEndRotate=()=>{e.endRotate()},e.handleStartPan=r=>{t.previousTranslation=r.translation,e.startPan()},e.handleEndPan=()=>{e.endPan()},e.handlePinch=r=>{e.dollyByFactor(t.getRenderer(r),r.scale/t.previousScale),t.previousScale=r.scale},e.handlePan=r=>{const n=t.getRenderer(r).getActiveCamera();let o=n.getFocalPoint();o=e.computeWorldToDisplay(t.getRenderer(r),o[0],o[1],o[2]);const i=o[2],a=r.translation,s=t.previousTranslation,l=e.computeDisplayToWorld(t.getRenderer(r),o[0]+a[0]-s[0],o[1]+a[1]-s[1],i),u=e.computeDisplayToWorld(t.getRenderer(r),o[0],o[1],i),c=[];c[0]=u[0]-l[0],c[1]=u[1]-l[1],c[2]=u[2]-l[2],o=n.getFocalPoint();const d=n.getPosition();n.setFocalPoint(c[0]+o[0],c[1]+o[1],c[2]+o[2]),n.setPosition(c[0]+d[0],c[1]+d[1],c[2]+d[2]),t._interactor.getLightFollowCamera()&&t.getRenderer(r).updateLightsGeometryToFollowCamera(),n.orthogonalizeViewUp(),t.previousTranslation=r.translation},e.handleRotate=e=>{const r=t.getRenderer(e).getActiveCamera();r.roll(e.rotation-t.previousRotation),r.orthogonalizeViewUp(),t.previousRotation=e.rotation},e.handleMouseRotate=(e,r)=>{if(!t.previousPosition)return;const n=t._interactor,o=r.x-t.previousPosition.x,i=r.y-t.previousPosition.y,a=n.getView().getViewportSize(e);let s=-.1,l=-.1;a[0]&&a[1]&&(s=-20/a[1],l=-20/a[0]);const u=o*l*t.motionFactor,c=i*s*t.motionFactor,d=e.getActiveCamera();Number.isNaN(u)||Number.isNaN(c)||(d.azimuth(u),d.elevation(c),d.orthogonalizeViewUp()),t.autoAdjustCameraClippingRange&&e.resetCameraClippingRange(),n.getLightFollowCamera()&&e.updateLightsGeometryToFollowCamera()},e.handleMouseSpin=(e,r)=>{if(!t.previousPosition)return;const n=t._interactor,o=e.getActiveCamera(),i=n.getView().getViewportCenter(e),a=vo(Math.atan2(t.previousPosition.y-i[1],t.previousPosition.x-i[0])),s=vo(Math.atan2(r.y-i[1],r.x-i[0]))-a;Number.isNaN(s)||(o.roll(s),o.orthogonalizeViewUp())},e.handleMousePan=(r,n)=>{if(!t.previousPosition)return;const o=r.getActiveCamera();let i=o.getFocalPoint();i=e.computeWorldToDisplay(r,i[0],i[1],i[2]);const a=i[2],s=e.computeDisplayToWorld(r,n.x,n.y,a),l=e.computeDisplayToWorld(r,t.previousPosition.x,t.previousPosition.y,a),u=[];u[0]=l[0]-s[0],u[1]=l[1]-s[1],u[2]=l[2]-s[2],i=o.getFocalPoint();const c=o.getPosition();o.setFocalPoint(u[0]+i[0],u[1]+i[1],u[2]+i[2]),o.setPosition(u[0]+c[0],u[1]+c[1],u[2]+c[2]),t._interactor.getLightFollowCamera()&&r.updateLightsGeometryToFollowCamera()},e.handleMouseDolly=(r,n)=>{if(!t.previousPosition)return;const o=n.y-t.previousPosition.y,i=t._interactor.getView().getViewportCenter(r),a=t.motionFactor*o/i[1];e.dollyByFactor(r,1.1**a)},e.handleMouseWheel=r=>{const n=1-r.spinY/t.zoomFactor;e.dollyByFactor(t.getRenderer(r),n)},e.dollyByFactor=(e,r)=>{if(Number.isNaN(r))return;const n=e.getActiveCamera();n.getParallelProjection()?n.setParallelScale(n.getParallelScale()/r):(n.dolly(r),t.autoAdjustCameraClippingRange&&e.resetCameraClippingRange()),t._interactor.getLightFollowCamera()&&e.updateLightsGeometryToFollowCamera()}}(e,t)}var Fm={newInstance:zt.newInstance(Rm,"vtkInteractorStyleTrackballCamera"),extend:Rm};function Bm(e){return e}function Lm(e){return null===e||"null"===e?null:"true"===e||"false"!==e&&(void 0!==e&&"undefined"!==e?"["===e[0]&&"]"===e[e.length-1]?e.substring(1,e.length-1).split(",").map(e=>Lm(e.trim())):""===e||Number.isNaN(Number(e))?e:Number(e):void 0)}var km=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.location.search;const r={},n=e?Lm:Bm;return new URLSearchParams(t).forEach((e,t)=>{t&&(r[t]=!e||n(e))}),r};const Um={glFramebuffer:null,colorBuffers:null,depthTexture:null,previousDrawBinding:0,previousReadBinding:0,previousDrawBuffer:0,previousReadBuffer:0,previousActiveFramebuffer:null};function Vm(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Um,r),mt(e,t),t.colorBuffers&&Ze("you cannot initialize colorBuffers through the constructor. You should call setColorBuffer() instead."),t.colorBuffers=[],St(e,t,["colorBuffers"]),function(e,t){t.classHierarchy.push("vtkFramebuffer"),e.getBothMode=()=>t.context.FRAMEBUFFER,e.saveCurrentBindingsAndBuffers=t=>{const r=void 0!==t?t:e.getBothMode();e.saveCurrentBindings(r),e.saveCurrentBuffers(r)},e.saveCurrentBindings=e=>{if(!t.context)return void Ze("you must set the OpenGLRenderWindow before calling saveCurrentBindings");const r=t.context;t.previousDrawBinding=r.getParameter(t.context.FRAMEBUFFER_BINDING),t.previousActiveFramebuffer=t._openGLRenderWindow.getActiveFramebuffer()},e.saveCurrentBuffers=e=>{},e.restorePreviousBindingsAndBuffers=t=>{const r=void 0!==t?t:e.getBothMode();e.restorePreviousBindings(r),e.restorePreviousBuffers(r)},e.restorePreviousBindings=e=>{if(!t.context)return void Ze("you must set the OpenGLRenderWindow before calling restorePreviousBindings");const r=t.context;r.bindFramebuffer(r.FRAMEBUFFER,t.previousDrawBinding),t._openGLRenderWindow.setActiveFramebuffer(t.previousActiveFramebuffer)},e.restorePreviousBuffers=e=>{},e.bind=function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;null===r&&(r=t.context.FRAMEBUFFER),t.context.bindFramebuffer(r,t.glFramebuffer);for(let e=0;e{t.context?(t.glFramebuffer=t.context.createFramebuffer(),t.glFramebuffer.width=e,t.glFramebuffer.height=r):Ze("you must set the OpenGLRenderWindow before calling create")},e.setColorBuffer=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=t.context;if(!n)return void Ze("you must set the OpenGLRenderWindow before calling setColorBuffer");let o=n.COLOR_ATTACHMENT0;if(r>0){if(!t._openGLRenderWindow.getWebgl2())return void Ze("Using multiple framebuffer attachments requires WebGL 2");o+=r}t.colorBuffers[r]=e,n.framebufferTexture2D(n.FRAMEBUFFER,o,n.TEXTURE_2D,e.getHandle(),0)},e.removeColorBuffer=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const r=t.context;if(!r)return void Ze("you must set the OpenGLRenderWindow before calling removeColorBuffer");let n=r.COLOR_ATTACHMENT0;if(e>0){if(!t._openGLRenderWindow.getWebgl2())return void Ze("Using multiple framebuffer attachments requires WebGL 2");n+=e}r.framebufferTexture2D(r.FRAMEBUFFER,n,r.TEXTURE_2D,null,0),t.colorBuffers=t.colorBuffers.splice(e,1)},e.setDepthBuffer=e=>{if(t.context)if(t._openGLRenderWindow.getWebgl2()){const r=t.context;r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,e.getHandle(),0)}else Ze("Attaching depth buffer textures to fbo requires WebGL 2");else Ze("you must set the OpenGLRenderWindow before calling setDepthBuffer")},e.removeDepthBuffer=()=>{if(t.context)if(t._openGLRenderWindow.getWebgl2()){const e=t.context;e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,null,0)}else Ze("Attaching depth buffer textures to framebuffers requires WebGL 2");else Ze("you must set the OpenGLRenderWindow before calling removeDepthBuffer")},e.getGLFramebuffer=()=>t.glFramebuffer,e.setOpenGLRenderWindow=r=>{t._openGLRenderWindow!==r&&(e.releaseGraphicsResources(),t._openGLRenderWindow=r,t.context=null,r&&(t.context=t._openGLRenderWindow.getContext()))},e.releaseGraphicsResources=()=>{t.glFramebuffer&&t.context.deleteFramebuffer(t.glFramebuffer)},e.getSize=()=>null==t.glFramebuffer?null:[t.glFramebuffer.width,t.glFramebuffer.height],e.populateFramebuffer=()=>{if(!t.context)return void Ze("you must set the OpenGLRenderWindow before calling populateFrameBuffer");e.bind();const r=t.context,n=Dd.newInstance();n.setOpenGLRenderWindow(t._openGLRenderWindow),n.setMinificationFilter(cd.LINEAR),n.setMagnificationFilter(cd.LINEAR),n.create2DFromRaw({width:t.glFramebuffer.width,height:t.glFramebuffer.height,numComps:4,dataType:us.UNSIGNED_CHAR,data:null}),e.setColorBuffer(n),t.depthTexture=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,t.depthTexture),r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_COMPONENT16,t.glFramebuffer.width,t.glFramebuffer.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,t.depthTexture)},e.getColorTexture=()=>t.colorBuffers[0]}(e,t)}var Gm={newInstance:Pt(Vm,"vtkFramebuffer"),extend:Vm};const zm={delegates:[],currentOperation:null,preDelegateOperations:[],postDelegateOperations:[],currentParent:null};function jm(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,zm,r),zt.obj(e,t),zt.get(e,t,["currentOperation"]),zt.setGet(e,t,["delegates","_currentParent","preDelegateOperations","postDelegateOperations"]),zt.moveToProtected(e,t,["currentParent"]),function(e,t){t.classHierarchy.push("vtkRenderPass"),e.getOperation=()=>t.currentOperation,e.setCurrentOperation=e=>{t.currentOperation=e,t.currentTraverseOperation=`traverse${zt.capitalize(t.currentOperation)}`},e.getTraverseOperation=()=>t.currentTraverseOperation,e.traverse=function(r){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;t.deleted||(t._currentParent=n,t.preDelegateOperations.forEach(t=>{e.setCurrentOperation(t),r.traverse(e)}),t.delegates.forEach(t=>{t.traverse(r,e)}),t.postDelegateOperations.forEach(t=>{e.setCurrentOperation(t),r.traverse(e)}))}}(e,t)}var Wm={newInstance:zt.newInstance(jm,"vtkRenderPass"),extend:jm};const{Representation:Hm}=os,{vtkErrorMacro:Km}=zt;function Xm(e){const t=rd.substitute(e.Fragment,"//VTK::RenderPassFragmentShader::Impl","\n float weight = gl_FragData[0].a * pow(max(1.1 - gl_FragCoord.z, 0.0), 2.0);\n gl_FragData[0] = vec4(gl_FragData[0].rgb*weight, gl_FragData[0].a);\n gl_FragData[1].r = weight;\n ",!1);e.Fragment=t.result}const $m={framebuffer:null,copyShader:null,tris:null};function qm(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,$m,r),Wm.extend(e,t,r),t.VBOBuildTime={},zt.obj(t.VBOBuildTime,{mtime:0}),t.tris=ud.newInstance(),zt.get(e,t,["framebuffer"]),function(e,t){t.classHierarchy.push("vtkOpenGLOrderIndependentTranslucentPass"),e.createVertexBuffer=()=>{const e=new Float32Array([-1,-1,-1,1,-1,-1,-1,1,-1,1,1,-1]),r=new Float32Array([0,0,1,0,0,1,1,1]),n=new Uint16Array([4,0,1,3,2]),o=_s.newInstance({numberOfComponents:3,values:e});o.setName("points");const i=_s.newInstance({numberOfComponents:2,values:r});i.setName("tcoords");const a=_s.newInstance({numberOfComponents:1,values:n});t.tris.getCABO().createVBO(a,"polys",Hm.SURFACE,{points:o,tcoords:i,cellOffset:0}),t.VBOBuildTime.modified()},e.createFramebuffer=e=>{const r=e.getSize(),n=e.getContext();t.framebuffer=Gm.newInstance(),t.framebuffer.setOpenGLRenderWindow(e),t.framebuffer.create(...r),t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.bind(),t.translucentRGBATexture=Dd.newInstance(),t.translucentRGBATexture.setInternalFormat(n.RGBA16F),t.translucentRGBATexture.setFormat(n.RGBA),t.translucentRGBATexture.setOpenGLDataType(n.HALF_FLOAT),t.translucentRGBATexture.setOpenGLRenderWindow(e),t.translucentRGBATexture.create2DFromRaw({width:r[0],height:r[1],numComps:4,dataType:"Float32Array",data:null}),t.translucentRTexture=Dd.newInstance(),t.translucentRTexture.setInternalFormat(n.R16F),t.translucentRTexture.setFormat(n.RED),t.translucentRTexture.setOpenGLDataType(n.HALF_FLOAT),t.translucentRTexture.setOpenGLRenderWindow(e),t.translucentRTexture.create2DFromRaw({width:r[0],height:r[1],numComps:1,dataType:"Float32Array",data:null}),t.translucentZTexture=Dd.newInstance(),t.translucentZTexture.setOpenGLRenderWindow(e),t.translucentZTexture.createDepthFromRaw({width:r[0],height:r[1],dataType:"Float32Array",data:null}),t.framebuffer.setColorBuffer(t.translucentRGBATexture,0),t.framebuffer.setColorBuffer(t.translucentRTexture,1),t.framebuffer.setDepthBuffer(t.translucentZTexture)},e.createCopyShader=e=>{t.copyShader=e.getShaderCache().readyShaderProgramArray(["//VTK::System::Dec","attribute vec4 vertexDC;","attribute vec2 tcoordTC;","varying vec2 tcoord;","void main() { tcoord = tcoordTC; gl_Position = vertexDC; }"].join("\n"),"//VTK::System::Dec\n\nin vec2 tcoord;\n\nuniform sampler2D translucentRTexture;\nuniform sampler2D translucentRGBATexture;\n\n// the output of this shader\n//VTK::Output::Dec\n\nvoid main()\n{\n vec4 t1Color = texture(translucentRGBATexture, tcoord);\n float t2Color = texture(translucentRTexture, tcoord).r;\n gl_FragData[0] = vec4(t1Color.rgb/max(t2Color,0.01), 1.0 - t1Color.a);\n}\n","")},e.createVBO=r=>{const n=r.getContext();t.tris.setOpenGLRenderWindow(r),e.createVertexBuffer();const o=t.copyShader;t.tris.getCABO().bind(),t.copyVAO.addAttributeArray(o,t.tris.getCABO(),"vertexDC",t.tris.getCABO().getVertexOffset(),t.tris.getCABO().getStride(),n.FLOAT,3,n.FALSE)||Km("Error setting vertexDC in copy shader VAO."),t.copyVAO.addAttributeArray(o,t.tris.getCABO(),"tcoordTC",t.tris.getCABO().getTCoordOffset(),t.tris.getCABO().getStride(),n.FLOAT,2,n.FALSE)||Km("Error setting vertexDC in copy shader VAO.")},e.traverse=(r,n,o)=>{if(t.deleted)return;const i=r.getSize(),a=r.getContext();if(t._supported=!1,n.getSelector()||!a||!r.getWebgl2()||!a.getExtension("EXT_color_buffer_half_float")&&!a.getExtension("EXT_color_buffer_float"))return e.setCurrentOperation("translucentPass"),void n.traverse(e);if(t._supported=!0,null===t.framebuffer)e.createFramebuffer(r);else{const n=t.framebuffer.getSize();null===n||n[0]!==i[0]||n[1]!==i[1]?(t.framebuffer.releaseGraphicsResources(),t.translucentRGBATexture.releaseGraphicsResources(r),t.translucentRTexture.releaseGraphicsResources(r),t.translucentZTexture.releaseGraphicsResources(r),e.createFramebuffer(r)):(t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.bind())}a.drawBuffers([a.COLOR_ATTACHMENT0]),a.clearBufferfv(a.COLOR,0,[0,0,0,0]),a.clearBufferfv(a.DEPTH,0,[1]),a.colorMask(!1,!1,!1,!1),o.getOpaqueActorCount()>0&&(o.setCurrentOperation("opaqueZBufferPass"),n.traverse(o)),a.colorMask(!0,!0,!0,!0),a.drawBuffers([a.COLOR_ATTACHMENT0,a.COLOR_ATTACHMENT1]),a.viewport(0,0,i[0],i[1]),a.scissor(0,0,i[0],i[1]),a.clearBufferfv(a.COLOR,0,[0,0,0,1]),a.clearBufferfv(a.COLOR,1,[0,0,0,0]),a.enable(a.DEPTH_TEST),a.enable(a.BLEND),a.blendFuncSeparate(a.ONE,a.ONE,a.ZERO,a.ONE_MINUS_SRC_ALPHA),e.setCurrentOperation("translucentPass"),n.traverse(e),a.drawBuffers([a.NONE]),t.framebuffer.restorePreviousBindingsAndBuffers(),null===t.copyShader?e.createCopyShader(r):r.getShaderCache().readyShaderProgram(t.copyShader),t.copyVAO||(t.copyVAO=id.newInstance(),t.copyVAO.setOpenGLRenderWindow(r)),t.copyVAO.bind(),t.VBOBuildTime.getMTime()t._supported?Xm:null,e.releaseGraphicsResources=r=>{t.framebuffer&&(t.framebuffer.releaseGraphicsResources(r),t.framebuffer=null),t.translucentRGBATexture&&(t.translucentRGBATexture.releaseGraphicsResources(r),t.translucentRGBATexture=null),t.translucentRTexture&&(t.translucentRTexture.releaseGraphicsResources(r),t.translucentRTexture=null),t.translucentZTexture&&(t.translucentZTexture.releaseGraphicsResources(r),t.translucentZTexture=null),t.copyVAO&&(t.copyVAO.releaseGraphicsResources(r),t.copyVAO=null),t.copyShader&&(t.copyShader.releaseGraphicsResources(r),t.copyShader=null),t.tris&&(t.tris.releaseGraphicsResources(r),t.tris=null),e.modified()}}(e,t)}var Ym={newInstance:zt.newInstance(qm,"vtkOpenGLOrderIndependentTranslucentPass"),extend:qm};const Jm={opaqueActorCount:0,translucentActorCount:0,volumeCount:0,overlayActorCount:0,framebuffer:null,depthRequested:!1};function Qm(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Jm,r),Wm.extend(e,t,r),zt.get(e,t,["framebuffer","opaqueActorCount","translucentActorCount","volumeCount"]),function(e,t){t.classHierarchy.push("vtkForwardPass"),e.traverse=function(r){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t.deleted)return;t._currentParent=n,e.setCurrentOperation("buildPass"),r.traverse(e);const o=r.getRenderable().getNumberOfLayers(),i=r.getRenderable().getRenderersByReference();for(let n=0;n0||t.translucentActorCount>0)&&t.volumeCount>0||t.depthRequested){const n=r.getFramebufferSize();null===t.framebuffer&&(t.framebuffer=Gm.newInstance()),t.framebuffer.setOpenGLRenderWindow(r),t.framebuffer.saveCurrentBindingsAndBuffers();const o=t.framebuffer.getSize();null!==o&&o[0]===n[0]&&o[1]===n[1]||(t.framebuffer.create(n[0],n[1]),t.framebuffer.populateFramebuffer()),t.framebuffer.bind(),e.setCurrentOperation("zBufferPass"),s.traverse(e),t.framebuffer.restorePreviousBindingsAndBuffers(),t.depthRequested=!1}e.setCurrentOperation("cameraPass"),s.traverse(e),t.opaqueActorCount>0&&(e.setCurrentOperation("opaquePass"),s.traverse(e)),t.translucentActorCount>0&&(t.translucentPass||(t.translucentPass=Ym.newInstance()),t.translucentPass.traverse(r,s,e)),t.volumeCount>0&&(e.setCurrentOperation("volumePass"),s.traverse(e)),t.overlayActorCount>0&&(e.setCurrentOperation("overlayPass"),s.traverse(e))}}},e.getZBufferTexture=()=>t.framebuffer?t.framebuffer.getColorTexture():null,e.requestDepth=()=>{t.depthRequested=!0},e.incrementOpaqueActorCount=()=>t.opaqueActorCount++,e.incrementTranslucentActorCount=()=>t.translucentActorCount++,e.incrementVolumeCount=()=>t.volumeCount++,e.incrementOverlayActorCount=()=>t.overlayActorCount++}(e,t)}var Zm={newInstance:zt.newInstance(Qm,"vtkForwardPass"),extend:Qm};const{FieldAssociations:eg}=Gs,tg={fieldAssociation:eg.FIELD_ASSOCIATION_CELLS,captureZValues:!1};function rg(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,tg,r),zt.obj(e,t),zt.setGet(e,t,["fieldAssociation","captureZValues"]),function(e,t){t.classHierarchy.push("vtkHardwareSelector"),e.getSourceDataAsync=async(e,t,r,n,o)=>{},e.selectAsync=async(t,r,n,o,i)=>{const a=await e.getSourceDataAsync(t,r,n,o,i);return a?a.generateSelection(r,n,o,i):[]}}(e,t)}var ng={newInstance:zt.newInstance(rg,"vtkHardwareSelector"),extend:rg};const og={contentType:-1,fieldType:-1,properties:null,selectionList:[]};function ig(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,og,r),zt.obj(e,t),t.properties={},zt.setGet(e,t,["contentType","fieldType","properties","selectionList"]),function(e,t){t.classHierarchy.push("vtkSelectionNode"),e.getBounds=()=>t.points.getBounds()}(e,t)}var ag={newInstance:zt.newInstance(ig,"vtkSelectionNode"),extend:ig,SelectionContent:{GLOBALIDS:0,PEDIGREEIDS:1,VALUES:2,INDICES:3,FRUSTUM:4,LOCATIONS:5,THRESHOLDS:6,BLOCKS:7,QUERY:8},SelectionField:{CELL:0,POINT:1,FIELD:2,VERTEX:3,EDGE:4,ROW:5}};const{PassTypes:sg}=wl,{SelectionContent:lg,SelectionField:ug}=ag,{FieldAssociations:cg}=Gs,{vtkErrorMacro:dg}=zt;function pg(e){return`${e.propID} ${e.compositeID}`}function fg(e,t,r,n){return r?r[4*(t*(n[2]-n[0]+1)+e)+3]:0}function hg(e,t,r,n){if(!r)return 0;const o=4*(t*(n[2]-n[0]+1)+e),i=r[o],a=r[o+1];return 256*(256*r[o+2]+a)+i}function mg(e,t){let r=t;return r<<=24,r|=e,r}function gg(e,t,r,n){const o=r<0?0:r;if(0===o){if(n[0]=t[0],n[1]=t[1],t[0]e.area[2]||t[1]e.area[3])return null;const r=[t[0]-e.area[0],t[1]-e.area[1]],o=hg(r[0],r[1],e.pixBuffer[sg.ACTOR_PASS],e.area);if(o<=0||o-1>=e.props.length)return null;const i={valid:!0};i.propID=o-1,i.prop=e.props[i.propID];let a=hg(r[0],r[1],e.pixBuffer[sg.COMPOSITE_INDEX_PASS],e.area);if((a<0||a>16777215)&&(a=0),i.compositeID=a-1,e.captureZValues){const n=4*(r[1]*(e.area[2]-e.area[0]+1)+r[0]);i.zValue=(256*e.zBuffer[n]+e.zBuffer[n+1])/65535,i.displayPosition=t}if(e.pixBuffer[sg.ID_LOW24]&&0===fg(r[0],r[1],e.pixBuffer[sg.ID_LOW24],e.area))return i;const s=hg(r[0],r[1],e.pixBuffer[sg.ID_LOW24],e.area),l=hg(r[0],r[1],e.pixBuffer[sg.ID_HIGH24],e.area);return i.attributeID=mg(s,l),i}const i=[t[0],t[1]],a=[0,0];let s=gg(e,t,0,n);if(s&&s.valid)return s;for(let t=1;tt?i[1]-t:0;r<=i[1]+t;++r){if(a[1]=r,i[0]>=t&&(a[0]=i[0]-t,s=gg(e,a,0,n),s&&s.valid))return s;if(a[0]=i[0]+t,s=gg(e,a,0,n),s&&s.valid)return s}for(let r=i[0]>=t?i[0]-(t-1):0;r<=i[0]+(t-1);++r){if(a[0]=r,i[1]>=t&&(a[1]=i[1]-t,s=gg(e,a,0,n),s&&s.valid))return s;if(a[1]=i[1]+t,s=gg(e,a,0,n),s&&s.valid)return s}}return n[0]=t[0],n[1]=t[1],null}function yg(e,t,r,n,o){const i=[];let a=0;return t.forEach((t,s)=>{const l=ag.newInstance();switch(l.setContentType(lg.INDICES),e){case cg.FIELD_ASSOCIATION_CELLS:l.setFieldType(ug.CELL);break;case cg.FIELD_ASSOCIATION_POINTS:l.setFieldType(ug.POINT);break;default:dg("Unknown field association")}l.getProperties().propID=t.info.propID,l.getProperties().prop=t.info.prop,l.getProperties().compositeID=t.info.compositeID,l.getProperties().attributeID=t.info.attributeID,l.getProperties().pixelCount=t.pixelCount,r&&(l.getProperties().displayPosition=[t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue],l.getProperties().worldPosition=o.displayToWorld(t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue,n)),l.setSelectionList(t.attributeIDs),i[a]=l,a++}),i}const vg={area:void 0,currentPass:-1,propColorValue:null,props:null,maximumPointId:0,maximumCellId:0,idOffset:1};function bg(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,vg,r),ng.extend(e,t,r),t.propColorValue=[0,0,0],t.props=[],t.area||(t.area=[0,0,0,0]),zt.setGetArray(e,t,["area"],4),zt.setGet(e,t,["_renderer","currentPass","_openGLRenderWindow","maximumPointId","maximumCellId"]),zt.setGetArray(e,t,["propColorValue"],3),zt.moveToProtected(e,t,["renderer","openGLRenderWindow"]),zt.event(e,t,"event"),function(e,t){t.classHierarchy.push("vtkOpenGLHardwareSelector"),e.releasePixBuffers=()=>{t.rawPixBuffer=[],t.pixBuffer=[],t.zBuffer=null},e.beginSelection=()=>{t._openGLRenderer=t._openGLRenderWindow.getViewNodeFor(t._renderer,t._openGLRenderer),t.maxAttributeId=0;const r=t._openGLRenderWindow.getSize();if(t.framebuffer){t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.saveCurrentBindingsAndBuffers();const e=t.framebuffer.getSize();e&&e[0]===r[0]&&e[1]===r[1]?t.framebuffer.bind():(t.framebuffer.create(r[0],r[1]),t.framebuffer.populateFramebuffer())}else t.framebuffer=Gm.newInstance(),t.framebuffer.setOpenGLRenderWindow(t._openGLRenderWindow),t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.create(r[0],r[1]),t.framebuffer.populateFramebuffer();if(t._openGLRenderer.clear(),t._openGLRenderer.setSelector(e),t.hitProps={},t.propPixels={},t.props=[],e.releasePixBuffers(),t.fieldAssociation===cg.FIELD_ASSOCIATION_POINTS){const e=t._openGLRenderWindow.getContext(),r=e.isEnabled(e.BLEND);e.disable(e.BLEND),t._openGLRenderWindow.traverseAllPasses(),r&&e.enable(e.BLEND)}},e.endSelection=()=>{t.hitProps={},t._openGLRenderer.setSelector(null),t.framebuffer.restorePreviousBindingsAndBuffers()},e.preCapturePass=()=>{const e=t._openGLRenderWindow.getContext();t.originalBlending=e.isEnabled(e.BLEND),e.disable(e.BLEND)},e.postCapturePass=()=>{const e=t._openGLRenderWindow.getContext();t.originalBlending&&e.enable(e.BLEND)},e.select=()=>{let r=null;return e.captureBuffers()&&(r=e.generateSelection(t.area[0],t.area[1],t.area[2],t.area[3]),e.releasePixBuffers()),r},e.getSourceDataAsync=async(r,n,o,i,a)=>{if(t._renderer=r,void 0===n){const r=t._openGLRenderWindow.getSize();e.setArea(0,0,r[0]-1,r[1]-1)}else e.setArea(n,o,i,a);if(!e.captureBuffers())return!1;const s={area:[...t.area],pixBuffer:[...t.pixBuffer],captureZValues:t.captureZValues,zBuffer:t.zBuffer,props:[...t.props],fieldAssociation:t.fieldAssociation,renderer:r,openGLRenderWindow:t._openGLRenderWindow,generateSelection:function(){for(var e=arguments.length,t=new Array(e),r=0;r{if(!t._renderer||!t._openGLRenderWindow)return dg("Renderer and view must be set before calling Select."),!1;t._openGLRenderer=t._openGLRenderWindow.getViewNodeFor(t._renderer,t._openGLRenderer),t._openGLRenderWindow.getRenderable().preRender(),e.invokeEvent({type:"StartEvent"}),t.originalBackground=t._renderer.getBackgroundByReference(),t._renderer.setBackground(0,0,0,0);const r=t._openGLRenderWindow.getRenderPasses();e.beginSelection();const n=[];for(t.currentPass=sg.MIN_KNOWN_PASS;t.currentPass<=sg.MAX_KNOWN_PASS;t.currentPass++)e.passRequired(t.currentPass)&&(e.preCapturePass(t.currentPass),t.captureZValues&&t.currentPass===sg.ACTOR_PASS&&"function"==typeof r[0].requestDepth&&"function"==typeof r[0].getFramebuffer?(r[0].requestDepth(),t._openGLRenderWindow.traverseAllPasses()):t._openGLRenderWindow.traverseAllPasses(),e.postCapturePass(t.currentPass),e.savePixelBuffer(t.currentPass),n.push(t.currentPass));return n.forEach(r=>{t.currentPass=r,e.processPixelBuffers()}),t.currentPass=sg.MAX_KNOWN_PASS,e.endSelection(),t._renderer.setBackground(t.originalBackground),e.invokeEvent({type:"EndEvent"}),!0},e.processPixelBuffers=()=>{t.props.forEach((r,n)=>{e.isPropHit(n)&&r.processSelectorPixelBuffers(e,t.propPixels[n])})},e.passRequired=e=>{if(e===sg.ID_HIGH24){if(t.fieldAssociation===cg.FIELD_ASSOCIATION_POINTS)return t.maximumPointId>16777215;if(t.fieldAssociation===cg.FIELD_ASSOCIATION_CELLS)return t.maximumCellId>16777215}return!0},e.savePixelBuffer=r=>{if(t.pixBuffer[r]=t._openGLRenderWindow.getPixelData(t.area[0],t.area[1],t.area[2],t.area[3]),!t.rawPixBuffer[r]){const e=(t.area[2]-t.area[0]+1)*(t.area[3]-t.area[1]+1)*4;t.rawPixBuffer[r]=new Uint8Array(e),t.rawPixBuffer[r].set(t.pixBuffer[r])}if(r===sg.ACTOR_PASS){if(t.captureZValues){const e=t._openGLRenderWindow.getRenderPasses();if("function"==typeof e[0].requestDepth&&"function"==typeof e[0].getFramebuffer){const r=e[0].getFramebuffer();r.saveCurrentBindingsAndBuffers(),r.bind(),t.zBuffer=t._openGLRenderWindow.getPixelData(t.area[0],t.area[1],t.area[2],t.area[3]),r.restorePreviousBindingsAndBuffers()}}e.buildPropHitList(t.rawPixBuffer[r])}},e.buildPropHitList=e=>{let r=0;for(let n=0;n<=t.area[3]-t.area[1];n++)for(let o=0;o<=t.area[2]-t.area[0];o++){let i=hg(o,n,e,t.area);i>0&&(i--,i in t.hitProps||(t.hitProps[i]=!0,t.propPixels[i]=[]),t.propPixels[i].push(4*r)),++r}},e.renderProp=r=>{t.currentPass===sg.ACTOR_PASS&&(e.setPropColorValueFromInt(t.props.length+1),t.props.push(r))},e.renderCompositeIndex=r=>{t.currentPass===sg.COMPOSITE_INDEX_PASS&&e.setPropColorValueFromInt(r+1)},e.renderAttributeId=e=>{e<0||(t.maxAttributeId=e>t.maxAttributeId?e:t.maxAttributeId)},e.passTypeToString=e=>zt.enumToString(sg,e),e.isPropHit=e=>Boolean(t.hitProps[e]),e.setPropColorValueFromInt=e=>{t.propColorValue[0]=e%256/255,t.propColorValue[1]=Math.floor(e/256)%256/255,t.propColorValue[2]=Math.floor(e/65536)%256/255},e.getPixelInformation=(r,n,o)=>{const i=n<0?0:n;if(console.log("getPixelInformation called",i),0===i){if(o[0]=r[0],o[1]=r[1],r[0]t.area[2]||r[1]t.area[3])return null;console.log(r),console.log(t.area);const e=[r[0]-t.area[0],r[1]-t.area[1]];console.log("adjusted displayPosition",e);const n=hg(e[0],e[1],t.pixBuffer[sg.ACTOR_PASS],t.area);if(console.log("actorid",n),n<=0||n-1>=t.props.length)return null;const i={valid:!0};i.propID=n-1,i.prop=t.props[i.propID];let a=hg(e[0],e[1],t.pixBuffer[sg.COMPOSITE_INDEX_PASS],t.area);if((a<0||a>16777215)&&(a=0),i.compositeID=a-1,t.captureZValues){const n=4*(e[1]*(t.area[2]-t.area[0]+1)+e[0]);i.zValue=(256*t.zBuffer[n]+t.zBuffer[n+1])/65535,i.displayPosition=r}if(t.pixBuffer[sg.ID_LOW24]&&0===fg(e[0],e[1],t.pixBuffer[sg.ID_LOW24],t.area))return i;const s=hg(e[0],e[1],t.pixBuffer[sg.ID_LOW24],t.area),l=hg(e[0],e[1],t.pixBuffer[sg.ID_HIGH24],t.area);return i.attributeID=mg(s,l),i}const a=[r[0],r[1]],s=[0,0];let l=e.getPixelInformation(r,0,o);if(l&&l.valid)return l;for(let t=1;tt?a[1]-t:0;r<=a[1]+t;++r){if(s[1]=r,a[0]>=t&&(s[0]=a[0]-t,l=e.getPixelInformation(s,0,o),l&&l.valid))return l;if(s[0]=a[0]+t,l=e.getPixelInformation(s,0,o),l&&l.valid)return l}for(let r=a[0]>=t?a[0]-(t-1):0;r<=a[0]+(t-1);++r){if(s[0]=r,a[1]>=t&&(s[1]=a[1]-t,l=e.getPixelInformation(s,0,o),l&&l.valid))return l;if(s[1]=a[1]+t,l=e.getPixelInformation(s,0,o),l&&l.valid)return l}}return o[0]=r[0],o[1]=r[1],null},e.generateSelection=(r,n,o,i)=>{const a=Math.floor(r),s=Math.floor(n),l=Math.floor(o),u=Math.floor(i),c=new Map,d=[0,0];for(let r=s;r<=u;r++)for(let n=a;n<=l;n++){const o=[n,r],i=e.getPixelInformation(o,0,d);if(i&&i.valid){const e=pg(i);if(c.has(e)){const r=c.get(e);r.pixelCount++,t.captureZValues&&i.zValuet.rawPixBuffer[e],e.getPixelBuffer=e=>t.pixBuffer[e],e.attach=(e,r)=>{t._openGLRenderWindow=e,t._renderer=r};const r=e.setArea;e.setArea=function(){return!!r(...arguments)&&(t.area[0]=Math.floor(t.area[0]),t.area[1]=Math.floor(t.area[1]),t.area[2]=Math.floor(t.area[2]),t.area[3]=Math.floor(t.area[3]),!0)}}(e,t)}var xg={newInstance:zt.newInstance(bg,"vtkOpenGLHardwareSelector"),extend:bg,...wl},_g=r(735);const Sg=["lastShaderProgramBound","context","_openGLRenderWindow"],Cg={lastShaderProgramBound:null,shaderPrograms:null,context:null};function Tg(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Cg,r),t.shaderPrograms={},zt.obj(e,t),zt.setGet(e,t,Sg),zt.moveToProtected(e,t,["openGLRenderWindow"]),function(e,t){t.classHierarchy.push("vtkShaderCache"),e.replaceShaderValues=(e,r,n)=>{let o=r;n.length>0&&(o=rd.substitute(o,"VSOut","GSOut").result);const i=t._openGLRenderWindow.getWebgl2();let a="\n",s="#version 100\n";i?s="#version 300 es\n#define attribute in\n#define textureCube texture\n#define texture2D texture\n#define textureCubeLod textureLod\n#define texture2DLod textureLod\n":(t.context.getExtension("OES_standard_derivatives"),t.context.getExtension("EXT_frag_depth")&&(a="#extension GL_EXT_frag_depth : enable\n"),t.context.getExtension("EXT_shader_texture_lod")&&(a+="#extension GL_EXT_shader_texture_lod : enable\n#define textureCubeLod textureCubeLodEXT\n#define texture2DLod texture2DLodEXT")),o=rd.substitute(o,"//VTK::System::Dec",[`${s}\n`,i?"":"#extension GL_OES_standard_derivatives : enable\n",a,"#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","precision highp int;","#else","precision mediump float;","precision mediump int;","#endif"]).result;let l=rd.substitute(e,"//VTK::System::Dec",[`${s}\n`,"#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","precision highp int;","#else","precision mediump float;","precision mediump int;","#endif"]).result;if(i){l=rd.substitute(l,"varying","out").result,o=rd.substitute(o,"varying","in").result;let e="",t=0;for(;o.includes(`gl_FragData[${t}]`);)o=rd.substitute(o,`gl_FragData\\[${t}\\]`,`fragOutput${t}`).result,e+=`layout(location = ${t}) out vec4 fragOutput${t};\n`,t++;o=rd.substitute(o,"//VTK::Output::Dec",e).result}return{VSSource:l,FSSource:o,GSSource:rd.substitute(n,"//VTK::System::Dec",s).result}},e.readyShaderProgramArray=(t,r,n)=>{const o=e.replaceShaderValues(t,r,n),i=e.getShaderProgram(o.VSSource,o.FSSource,o.GSSource);return e.readyShaderProgram(i)},e.readyShaderProgram=t=>t&&(t.getCompiled()||t.compileShader())&&e.bindShaderProgram(t)?t:null,e.getShaderProgram=(e,r,n)=>{const o=`${e}${r}${n}`,i=_g.hash(o);if(!(i in t.shaderPrograms)){const o=rd.newInstance();return o.setContext(t.context),o.getVertexShader().setSource(e),o.getFragmentShader().setSource(r),n&&o.getGeometryShader().setSource(n),o.setMd5Hash(i),t.shaderPrograms[i]=o,o}return t.shaderPrograms[i]},e.releaseGraphicsResources=r=>{e.releaseCurrentShaderProgram(),Object.keys(t.shaderPrograms).map(e=>t.shaderPrograms[e]).forEach(e=>e.cleanup()),t.shaderPrograms={}},e.releaseCurrentShaderProgram=()=>{t.lastShaderProgramBound&&(t.lastShaderProgramBound.cleanup(),t.lastShaderProgramBound=null)},e.bindShaderProgram=e=>(t.lastShaderProgramBound===e||(t.lastShaderProgramBound&&t.lastShaderProgramBound.release(),e.bind(),t.lastShaderProgramBound=e),1)}(e,t)}var wg={newInstance:zt.newInstance(Tg,"vtkShaderCache"),extend:Tg};const{vtkErrorMacro:Ag}=zt,Eg={context:null,numberOfTextureUnits:0,textureUnits:0};function Dg(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Eg,r),zt.obj(e,t),t.textureUnits=[],zt.get(e,t,["numberOfTextureUnits"]),zt.setGet(e,t,["context"]),function(e,t){t.classHierarchy.push("vtkOpenGLTextureUnitManager"),e.deleteTable=()=>{for(let e=0;e{if(t.context!==r){if(0!==t.context&&e.deleteTable(),t.context=r,t.context){t.numberOfTextureUnits=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS);for(let e=0;e{for(let r=0;re.isAllocated(r)?-1:(t.textureUnits[r]=!0,r),e.isAllocated=e=>t.textureUnits[e],e.free=e=>{t.textureUnits[e]=!1},e.freeAll=()=>{for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ig,r),t.size||(t.size=[300,300]),zt.getArray(e,t,["size"],2),zt.get(e,t,["selector"]),Xt.extend(e,t,r),function(e,t){t.classHierarchy.push("vtkRenderWindowViewNode"),e.getViewNodeFactory=()=>null,e.getAspectRatio=()=>t.size[0]/t.size[1],e.getAspectRatioForRenderer=e=>{const r=e.getViewportByReference();return t.size[0]*(r[2]-r[0])/((r[3]-r[1])*t.size[1])},e.isInViewport=(t,r,n)=>{const o=n.getViewportByReference(),i=e.getFramebufferSize();return o[0]*i[0]<=t&&o[2]*i[0]>=t&&o[1]*i[1]<=r&&o[3]*i[1]>=r},e.getViewportSize=t=>{const r=t.getViewportByReference(),n=e.getFramebufferSize();return[(r[2]-r[0])*n[0],(r[3]-r[1])*n[1]]},e.getViewportCenter=t=>{const r=e.getViewportSize(t);return[.5*r[0],.5*r[1]]},e.displayToNormalizedDisplay=(t,r,n)=>{const o=e.getFramebufferSize();return[t/o[0],r/o[1],n]},e.normalizedDisplayToDisplay=(t,r,n)=>{const o=e.getFramebufferSize();return[t*o[0],r*o[1],n]},e.worldToView=(e,t,r,n)=>n.worldToView(e,t,r),e.viewToWorld=(e,t,r,n)=>n.viewToWorld(e,t,r),e.worldToDisplay=(t,r,n,o)=>{const i=o.worldToView(t,r,n),a=e.getViewportSize(o),s=o.viewToProjection(i[0],i[1],i[2],a[0]/a[1]),l=o.projectionToNormalizedDisplay(s[0],s[1],s[2]);return e.normalizedDisplayToDisplay(l[0],l[1],l[2])},e.displayToWorld=(t,r,n,o)=>{const i=e.displayToNormalizedDisplay(t,r,n),a=o.normalizedDisplayToProjection(i[0],i[1],i[2]),s=e.getViewportSize(o),l=o.projectionToView(a[0],a[1],a[2],s[0]/s[1]);return o.viewToWorld(l[0],l[1],l[2])},e.normalizedDisplayToViewport=(t,r,n,o)=>{let i=o.getViewportByReference();i=e.normalizedDisplayToDisplay(i[0],i[1],0);const a=e.normalizedDisplayToDisplay(t,r,n);return[a[0]-i[0]-.5,a[1]-i[1]-.5,n]},e.viewportToNormalizedViewport=(t,r,n,o)=>{const i=e.getViewportSize(o);return i&&0!==i[0]&&0!==i[1]?[t/(i[0]-1),r/(i[1]-1),n]:[t,r,n]},e.normalizedViewportToViewport=(t,r,n,o)=>{const i=e.getViewportSize(o);return[t*(i[0]-1),r*(i[1]-1),n]},e.displayToLocalDisplay=(t,r,n)=>[t,e.getFramebufferSize()[1]-r-1,n],e.viewportToNormalizedDisplay=(t,r,n,o)=>{let i=o.getViewportByReference();i=e.normalizedDisplayToDisplay(i[0],i[1],0);const a=t+i[0]+.5,s=r+i[1]+.5;return e.displayToNormalizedDisplay(a,s,n)},e.getComputedDevicePixelRatio=()=>t.size[0]/e.getContainerSize()[0],e.getContainerSize=()=>{zt.vtkErrorMacro("not implemented")},e.getPixelData=(e,t,r,n)=>{zt.vtkErrorMacro("not implemented")},e.createSelector=()=>{zt.vtkErrorMacro("not implemented")}}(e,t)}var Ng={newInstance:zt.newInstance(Og,"vtkRenderWindowViewNode"),extend:Og};const{vtkDebugMacro:Mg,vtkErrorMacro:Rg}=zt,Fg={position:"absolute",top:0,left:0,width:"100%",height:"100%"},Bg=["activateTexture","deactivateTexture","disableCullFace","enableCullFace","get3DContext","getActiveFramebuffer","getContext","getDefaultTextureByteSize","getDefaultTextureInternalFormat","getDefaultToWebgl2","getGLInformations","getGraphicsMemoryInfo","getGraphicsResourceForObject","getHardwareMaximumLineWidth","getPixelData","getShaderCache","getTextureUnitForTexture","getTextureUnitManager","getWebgl2","makeCurrent","releaseGraphicsResources","registerGraphicsResourceUser","unregisterGraphicsResourceUser","restoreContext","setActiveFramebuffer","setContext","setDefaultToWebgl2","setGraphicsResourceForObject"];function Lg(e,t,r){const n=e.createFramebuffer(),o=e.createTexture();e.bindTexture(e.TEXTURE_2D,o),e.texImage2D(e.TEXTURE_2D,0,t,2,2,0,t,r,null),e.bindFramebuffer(e.FRAMEBUFFER,n),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,o,0);const i=e.checkFramebufferStatus(e.FRAMEBUFFER);return e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindTexture(e.TEXTURE_2D,null),i===e.FRAMEBUFFER_COMPLETE}let kg=0;const Ug=[];function Vg(e){e.preventDefault()}function Gg(e,t){let r;t.classHierarchy.push("vtkOpenGLRenderWindow"),e.getViewNodeFactory=()=>t.myFactory,t.canvas.addEventListener("webglcontextlost",Vg,!1),t.canvas.addEventListener("webglcontextrestored",e.restoreContext,!1);const n=[0,0];let o;e.onModified(function(){t.renderable&&(t.size[0]===n[0]&&t.size[1]===n[1]||(n[0]=t.size[0],n[1]=t.size[1],t.canvas.setAttribute("width",t.size[0]),t.canvas.setAttribute("height",t.size[1]))),t.viewStream&&t.viewStream.setSize(t.size[0],t.size[1]),t.canvas.style.display=t.useOffScreen?"none":"block",t.el&&(t.el.style.cursor=t.cursorVisibility?t.cursor:"none"),t.containerSize=null}),e.buildPass=r=>{if(r){if(!t.renderable)return;e.prepareNodes(),e.addMissingNodes(t.renderable.getRenderersByReference()),e.addMissingNodes(t.renderable.getChildRenderWindowsByReference()),e.removeUnusedNodes(),e.initialize(),t.children.forEach(t=>{t.setOpenGLRenderWindow?.(e)})}},e.initialize=()=>{if(!t.initialized){if(t.rootOpenGLRenderWindow=e.getLastAncestorOfType("vtkOpenGLRenderWindow"),t.rootOpenGLRenderWindow)t.context2D=e.get2DContext();else{t.context=e.get3DContext(),e.resizeFromChildRenderWindows(),t.context&&(kg++,Ug.forEach(e=>e(kg))),t.textureUnitManager=Pg.newInstance(),t.textureUnitManager.setContext(t.context),t.shaderCache.setContext(t.context);const r=t.context;r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA),r.depthFunc(r.LEQUAL),r.enable(r.BLEND)}t.initialized=!0}},e.makeCurrent=()=>{t.context.makeCurrent()},e.setContainer=r=>{t.el&&t.el!==r&&(t.canvas.parentNode!==t.el&&Rg("Error: canvas parent node does not match container"),t.el.removeChild(t.canvas),t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)),t.el!==r&&(t.el=r,t.el&&(t.el.appendChild(t.canvas),t.useBackgroundImage&&t.el.appendChild(t.bgImage)),e.modified())},e.getContainer=()=>t.el,e.getContainerSize=()=>{if(!t.containerSize&&t.el){const{width:e,height:r}=t.el.getBoundingClientRect();t.containerSize=[e,r]}return t.containerSize||t.size},e.getFramebufferSize=()=>{const e=t.activeFramebuffer?.getSize();return e||t.size},e.getPixelData=(e,r,n,o)=>{const i=new Uint8Array((n-e+1)*(o-r+1)*4);return t.context.readPixels(e,r,n-e+1,o-r+1,t.context.RGBA,t.context.UNSIGNED_BYTE,i),i},e.get3DContext=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{preserveDrawingBuffer:!1,depth:!0,alpha:!0,powerPreference:"high-performance"},n=null;const o="undefined"!=typeof WebGL2RenderingContext;return t.webgl2=!1,t.defaultToWebgl2&&o&&(n=t.canvas.getContext("webgl2",e),n&&(t.webgl2=!0,Mg("using webgl2"))),n||(Mg("using webgl1"),n=t.canvas.getContext("webgl",e)||t.canvas.getContext("experimental-webgl",e)),n||Rg("no webgl context"),new Proxy(n,(r||(r=function(){const e=new Map,t={apply:(t,r,n)=>e.has(n[0])?e.get(n[0]):t.apply(r,n)},r=Object.create(null);return r.getParameter=(e,r,n,o)=>new Proxy(o.bind(e),t),r.depthMask=(t,r,n,o)=>{return new Proxy(o.bind(t),(i=t.DEPTH_WRITEMASK,{apply:(t,r,n)=>(e.set(i,n[0]),t.apply(r,n))}));var i},{get(e,t,n){if("__getUnderlyingContext"===t)return()=>e;let o=Reflect.get(e,t,e);o instanceof Function&&(o=o.bind(e));const i=r[t];return i?i(e,t,n,o):o}}}()),r))},e.get2DContext=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.canvas.getContext("2d",e)},e.restoreContext=()=>{const t=Wm.newInstance();t.setCurrentOperation("Release"),t.traverse(e,null)},e.activateTexture=r=>{const n=t._textureResourceIds.get(r);if(void 0!==n)return void t.context.activeTexture(t.context.TEXTURE0+n);const o=e.getTextureUnitManager().allocate();o<0?Rg("Hardware does not support the number of textures defined."):(t._textureResourceIds.set(r,o),t.context.activeTexture(t.context.TEXTURE0+o))},e.deactivateTexture=r=>{const n=t._textureResourceIds.get(r);void 0!==n&&(e.getTextureUnitManager().free(n),t._textureResourceIds.delete(r))},e.getTextureUnitForTexture=e=>{const r=t._textureResourceIds.get(e);return void 0!==r?r:-1},e.getDefaultTextureByteSize=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t.webgl2)switch(e){case us.CHAR:case us.SIGNED_CHAR:case us.UNSIGNED_CHAR:return 1;case r:case n:case us.UNSIGNED_SHORT:case us.SHORT:case us.VOID:return 2;default:return 4}return 1},e.getDefaultTextureInternalFormat=function(e,r){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(t.webgl2)switch(e){case us.UNSIGNED_CHAR:switch(r){case 1:return t.context.R8;case 2:return t.context.RG8;case 3:return t.context.RGB8;default:return t.context.RGBA8}case n&&!o&&us.UNSIGNED_SHORT:switch(r){case 1:return n.R16_EXT;case 2:return n.RG16_EXT;case 3:return n.RGB16_EXT;default:return n.RGBA16_EXT}case n&&!o&&us.SHORT:switch(r){case 1:return n.R16_SNORM_EXT;case 2:return n.RG16_SNORM_EXT;case 3:return n.RGB16_SNORM_EXT;default:return n.RGBA16_SNORM_EXT}default:switch(r){case 1:return o?t.context.R16F:t.context.R32F;case 2:return o?t.context.RG16F:t.context.RG32F;case 3:return o?t.context.RGB16F:t.context.RGB32F;default:return o?t.context.RGBA16F:t.context.RGBA32F}}switch(r){case 1:return t.context.LUMINANCE;case 2:return t.context.LUMINANCE_ALPHA;case 3:return t.context.RGB;default:return t.context.RGBA}},e.setBackgroundImage=e=>{t.bgImage.src=e.src},e.setUseBackgroundImage=e=>{t.useBackgroundImage=e,t.useBackgroundImage&&!t.el.contains(t.bgImage)?t.el.appendChild(t.bgImage):!t.useBackgroundImage&&t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)},e.captureNextImage=function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",{resetCamera:n=!1,size:o=null,scale:i=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.deleted)return null;t.imageFormat=r;const a=t.notifyStartCaptureImage;return t.notifyStartCaptureImage=!0,t._screenshot={size:o||1!==i?o||t.size.map(e=>e*i):null},new Promise((r,o)=>{const i=e.onImageReady(o=>{if(null===t._screenshot.size)t.notifyStartCaptureImage=a,i.unsubscribe(),t._screenshot.placeHolder&&(t.size=t._screenshot.originalSize,e.modified(),t._screenshot.cameras&&t._screenshot.cameras.forEach(e=>{let{restoreParamsFn:t,arg:r}=e;return t(r)}),e.traverseAllPasses(),t.el.removeChild(t._screenshot.placeHolder),t._screenshot.placeHolder.remove(),t._screenshot=null),r(o);else{const r=document.createElement("img");if(r.style=Fg,r.src=o,t._screenshot.placeHolder=t.el.appendChild(r),t.canvas.style.display="none",t._screenshot.originalSize=t.size,t.size=t._screenshot.size,t.rootOpenGLRenderWindow?.resizeFromChildRenderWindows(),t._screenshot.size=null,e.modified(),n){const e=!0!==n;t._screenshot.cameras=t.renderable.getRenderers().map(t=>{const r=t.getActiveCamera(),o=r.get("focalPoint","position","parallelScale");return{resetCameraArgs:e?{renderer:t}:void 0,resetCameraFn:e?n:t.resetCamera,restoreParamsFn:r.set,arg:JSON.parse(JSON.stringify(o))}}),t._screenshot.cameras.forEach(e=>{let{resetCameraFn:t,resetCameraArgs:r}=e;return t(r)})}e.traverseAllPasses()}})})},e.getHardwareMaximumLineWidth=()=>{if(null!=o)return o;const t=e.get3DContext(),r=t.getParameter(t.ALIASED_LINE_WIDTH_RANGE);return o=r[1],r[1]},e.getGLInformations=()=>{if(t._glInformation)return t._glInformation;const r=e.get3DContext(),n=r.getExtension("OES_texture_float"),o=r.getExtension("OES_texture_half_float"),i=r.getExtension("WEBGL_debug_renderer_info"),a=r.getExtension("WEBGL_draw_buffers"),s=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),l=[["Max Vertex Attributes","MAX_VERTEX_ATTRIBS",r.getParameter(r.MAX_VERTEX_ATTRIBS)],["Max Varying Vectors","MAX_VARYING_VECTORS",r.getParameter(r.MAX_VARYING_VECTORS)],["Max Vertex Uniform Vectors","MAX_VERTEX_UNIFORM_VECTORS",r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS)],["Max Fragment Uniform Vectors","MAX_FRAGMENT_UNIFORM_VECTORS",r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS)],["Max Fragment Texture Image Units","MAX_TEXTURE_IMAGE_UNITS",r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS)],["Max Vertex Texture Image Units","MAX_VERTEX_TEXTURE_IMAGE_UNITS",r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS)],["Max Combined Texture Image Units","MAX_COMBINED_TEXTURE_IMAGE_UNITS",r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS)],["Max 2D Texture Size","MAX_TEXTURE_SIZE",r.getParameter(r.MAX_TEXTURE_SIZE)],["Max Cube Texture Size","MAX_CUBE_MAP_TEXTURE_SIZE",r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE)],["Max Texture Anisotropy","MAX_TEXTURE_MAX_ANISOTROPY_EXT",s&&r.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT)],["Point Size Range","ALIASED_POINT_SIZE_RANGE",r.getParameter(r.ALIASED_POINT_SIZE_RANGE).join(" - ")],["Line Width Range","ALIASED_LINE_WIDTH_RANGE",r.getParameter(r.ALIASED_LINE_WIDTH_RANGE).join(" - ")],["Max Viewport Dimensions","MAX_VIEWPORT_DIMS",r.getParameter(r.MAX_VIEWPORT_DIMS).join(" - ")],["Max Renderbuffer Size","MAX_RENDERBUFFER_SIZE",r.getParameter(r.MAX_RENDERBUFFER_SIZE)],["Framebuffer Red Bits","RED_BITS",r.getParameter(r.RED_BITS)],["Framebuffer Green Bits","GREEN_BITS",r.getParameter(r.GREEN_BITS)],["Framebuffer Blue Bits","BLUE_BITS",r.getParameter(r.BLUE_BITS)],["Framebuffer Alpha Bits","ALPHA_BITS",r.getParameter(r.ALPHA_BITS)],["Framebuffer Depth Bits","DEPTH_BITS",r.getParameter(r.DEPTH_BITS)],["Framebuffer Stencil Bits","STENCIL_BITS",r.getParameter(r.STENCIL_BITS)],["Framebuffer Subpixel Bits","SUBPIXEL_BITS",r.getParameter(r.SUBPIXEL_BITS)],["MSAA Samples","SAMPLES",r.getParameter(r.SAMPLES)],["MSAA Sample Buffers","SAMPLE_BUFFERS",r.getParameter(r.SAMPLE_BUFFERS)],["Supported Formats for UByte Render Targets ","UNSIGNED_BYTE RENDER TARGET FORMATS",[n&&Lg(r,r.RGBA,r.UNSIGNED_BYTE)?"RGBA":"",n&&Lg(r,r.RGB,r.UNSIGNED_BYTE)?"RGB":"",n&&Lg(r,r.LUMINANCE,r.UNSIGNED_BYTE)?"LUMINANCE":"",n&&Lg(r,r.ALPHA,r.UNSIGNED_BYTE)?"ALPHA":"",n&&Lg(r,r.LUMINANCE_ALPHA,r.UNSIGNED_BYTE)?"LUMINANCE_ALPHA":""].join(" ")],["Supported Formats for Half Float Render Targets","HALF FLOAT RENDER TARGET FORMATS",[o&&Lg(r,r.RGBA,o.HALF_FLOAT_OES)?"RGBA":"",o&&Lg(r,r.RGB,o.HALF_FLOAT_OES)?"RGB":"",o&&Lg(r,r.LUMINANCE,o.HALF_FLOAT_OES)?"LUMINANCE":"",o&&Lg(r,r.ALPHA,o.HALF_FLOAT_OES)?"ALPHA":"",o&&Lg(r,r.LUMINANCE_ALPHA,o.HALF_FLOAT_OES)?"LUMINANCE_ALPHA":""].join(" ")],["Supported Formats for Full Float Render Targets","FLOAT RENDER TARGET FORMATS",[n&&Lg(r,r.RGBA,r.FLOAT)?"RGBA":"",n&&Lg(r,r.RGB,r.FLOAT)?"RGB":"",n&&Lg(r,r.LUMINANCE,r.FLOAT)?"LUMINANCE":"",n&&Lg(r,r.ALPHA,r.FLOAT)?"ALPHA":"",n&&Lg(r,r.LUMINANCE_ALPHA,r.FLOAT)?"LUMINANCE_ALPHA":""].join(" ")],["Max Multiple Render Targets Buffers","MAX_DRAW_BUFFERS_WEBGL",a?r.getParameter(a.MAX_DRAW_BUFFERS_WEBGL):0],["High Float Precision in Vertex Shader","HIGH_FLOAT VERTEX_SHADER",[r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision," (-2",r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).rangeMin," - 2",r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).rangeMax,")"].join("")],["Medium Float Precision in Vertex Shader","MEDIUM_FLOAT VERTEX_SHADER",[r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision," (-2",r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).rangeMin," - 2",r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).rangeMax,")"].join("")],["Low Float Precision in Vertex Shader","LOW_FLOAT VERTEX_SHADER",[r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.LOW_FLOAT).precision," (-2",r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.LOW_FLOAT).rangeMin," - 2",r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.LOW_FLOAT).rangeMax,")"].join("")],["High Float Precision in Fragment Shader","HIGH_FLOAT FRAGMENT_SHADER",[r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision," (-2",r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).rangeMin," - 2",r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).rangeMax,")"].join("")],["Medium Float Precision in Fragment Shader","MEDIUM_FLOAT FRAGMENT_SHADER",[r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision," (-2",r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).rangeMin," - 2",r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).rangeMax,")"].join("")],["Low Float Precision in Fragment Shader","LOW_FLOAT FRAGMENT_SHADER",[r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.LOW_FLOAT).precision," (-2",r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.LOW_FLOAT).rangeMin," - 2",r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.LOW_FLOAT).rangeMax,")"].join("")],["High Int Precision in Vertex Shader","HIGH_INT VERTEX_SHADER",[r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_INT).precision," (-2",r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_INT).rangeMin," - 2",r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_INT).rangeMax,")"].join("")],["Medium Int Precision in Vertex Shader","MEDIUM_INT VERTEX_SHADER",[r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_INT).precision," (-2",r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_INT).rangeMin," - 2",r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_INT).rangeMax,")"].join("")],["Low Int Precision in Vertex Shader","LOW_INT VERTEX_SHADER",[r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.LOW_INT).precision," (-2",r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.LOW_INT).rangeMin," - 2",r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.LOW_INT).rangeMax,")"].join("")],["High Int Precision in Fragment Shader","HIGH_INT FRAGMENT_SHADER",[r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_INT).precision," (-2",r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_INT).rangeMin," - 2",r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_INT).rangeMax,")"].join("")],["Medium Int Precision in Fragment Shader","MEDIUM_INT FRAGMENT_SHADER",[r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_INT).precision," (-2",r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_INT).rangeMin," - 2",r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_INT).rangeMax,")"].join("")],["Low Int Precision in Fragment Shader","LOW_INT FRAGMENT_SHADER",[r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.LOW_INT).precision," (-2",r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.LOW_INT).rangeMin," - 2",r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.LOW_INT).rangeMax,")"].join("")],["Supported Extensions","EXTENSIONS",r.getSupportedExtensions().join("
\t\t\t\t\t ")],["WebGL Renderer","RENDERER",r.getParameter(r.RENDERER)],["WebGL Vendor","VENDOR",r.getParameter(r.VENDOR)],["WebGL Version","VERSION",r.getParameter(r.VERSION)],["Shading Language Version","SHADING_LANGUAGE_VERSION",r.getParameter(r.SHADING_LANGUAGE_VERSION)],["Unmasked Renderer","UNMASKED_RENDERER",i&&r.getParameter(i.UNMASKED_RENDERER_WEBGL)],["Unmasked Vendor","UNMASKED_VENDOR",i&&r.getParameter(i.UNMASKED_VENDOR_WEBGL)],["WebGL Version","WEBGL_VERSION",t.webgl2?2:1]],u={};for(;l.length;){const[e,t,r]=l.pop();t&&(u[t]={label:e,value:r})}return t._glInformation=u,u},e.traverseAllPasses=()=>{if(t.renderPasses)for(let r=0;r0&&void 0!==arguments[0]?arguments[0]:t.imageFormat;const n=document.createElement("canvas"),o=n.getContext("2d");n.width=t.canvas.width,n.height=t.canvas.height,o.drawImage(t.canvas,0,0);const i=t.canvas.getBoundingClientRect();t.renderable.getRenderers().forEach(e=>{e.getViewProps().forEach(e=>{if(e.getContainer){const t=e.getContainer().getElementsByTagName("canvas");for(let e=0;e{const e=t.rootOpenGLRenderWindow;if(!e||!t.context2D||t.children.some(e=>!!e.getSelector?.()))return;const r=e.getCanvas(),n=t.canvas;t.context2D.drawImage(r,0,r.height-n.height,n.width,n.height,0,0,n.width,n.height)},e.resizeFromChildRenderWindows=()=>{const r=t.renderable.getChildRenderWindowsByReference();if(r.length>0){const t=[0,0];for(let n=0;nt[0]?o[0]:t[0],t[1]=o[1]>t[1]?o[1]:t[1])}e.setSize(...t)}},e.disableCullFace=()=>{t.cullFaceEnabled&&(t.context.disable(t.context.CULL_FACE),t.cullFaceEnabled=!1)},e.enableCullFace=()=>{t.cullFaceEnabled||(t.context.enable(t.context.CULL_FACE),t.cullFaceEnabled=!0)},e.setViewStream=r=>t.viewStream!==r&&(t.subscription&&(t.subscription.unsubscribe(),t.subscription=null),t.viewStream=r,t.viewStream&&(t.renderable.getRenderers()[0].getBackgroundByReference()[3]=0,e.setUseBackgroundImage(!0),t.subscription=t.viewStream.onImageReady(t=>e.setBackgroundImage(t.image)),t.viewStream.setSize(t.size[0],t.size[1]),t.viewStream.invalidateCache(),t.viewStream.render(),e.modified()),!0),e.createSelector=()=>{const t=xg.newInstance();return t.setOpenGLRenderWindow(e),t},e.delete=zt.chain(()=>{t.context&&(kg--,Ug.forEach(e=>e(kg))),e.setContainer(),e.setViewStream()},function(){t.canvas.removeEventListener("webglcontextlost",Vg),t.canvas.removeEventListener("webglcontextrestored",e.restoreContext)},e.delete),e.setActiveFramebuffer=e=>{t.activeFramebuffer=e};const i=e.setSize;e.setSize=(t,r)=>{const n=i(t,r);return n&&e.invokeWindowResizeEvent({width:t,height:r}),n},e.registerGraphicsResourceUser=(r,n)=>{t._graphicsResources.has(r)||e.setGraphicsResourceForObject(r,null,null);const o=t._graphicsResources.get(r);o?.users.add(n)},e.unregisterGraphicsResourceUser=(r,n)=>{const o=t._graphicsResources.get(r);o&&(o.users.delete(n),o.users.size||(o.oglObject?.releaseGraphicsResources(e),t._graphicsResources.delete(r)))},e.getGraphicsResourceForObject=e=>t._graphicsResources.get(e),e.setGraphicsResourceForObject=(r,n,o)=>{if(!r)return;const i=t._graphicsResources.get(r);i?.oglObject?.releaseGraphicsResources(e),t._graphicsResources.set(r,{coreObject:r,oglObject:n,hash:o,users:i?.users??new Set})},e.getGraphicsMemoryInfo=()=>{let e=0;return t._graphicsResources.forEach(t=>{let{oglObject:r}=t;e+=r.getAllocatedGPUMemoryInBytes()}),e},e.releaseGraphicsResources=()=>{null!==t.shaderCache&&t.shaderCache.releaseGraphicsResources(e),t._graphicsResources.forEach(t=>{let{oglObject:r}=t;r.releaseGraphicsResources(e)}),t._graphicsResources.clear(),null!==t.textureUnitManager&&t.textureUnitManager.freeAll(),t.renderable.getRenderersByReference().forEach(t=>{const r=e.getViewNodeFor(t);r?.releaseGraphicsResources()})};const a={...e};Bg.forEach(r=>{e[r]=function(){return t.rootOpenGLRenderWindow?t.rootOpenGLRenderWindow[r](...arguments):a[r](...arguments)}})}const zg={cullFaceEnabled:!1,shaderCache:null,initialized:!1,context:null,context2D:null,canvas:null,cursorVisibility:!0,cursor:"pointer",textureUnitManager:null,textureResourceIds:null,containerSize:null,renderPasses:[],notifyStartCaptureImage:!1,webgl2:!1,defaultToWebgl2:!0,activeFramebuffer:null,imageFormat:"image/png",useOffScreen:!1,useBackgroundImage:!1};function jg(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,zg,r),Ng.extend(e,t,r),t.canvas||(t.canvas=document.createElement("canvas"),t.canvas.style.width="100%"),t.selector||(t.selector=xg.newInstance(),t.selector.setOpenGLRenderWindow(e)),t.bgImage=new Image,t.bgImage.style.position="absolute",t.bgImage.style.left="0",t.bgImage.style.top="0",t.bgImage.style.width="100%",t.bgImage.style.height="100%",t.bgImage.style.zIndex="-1",t._textureResourceIds=new Map,t._graphicsResources=new Map,t._glInformation=null,t.myFactory=tr.newInstance(),t.shaderCache=wg.newInstance(),t.shaderCache.setOpenGLRenderWindow(e),t.renderPasses[0]=Zm.newInstance(),zt.get(e,t,["shaderCache","textureUnitManager","webgl2","useBackgroundImage","activeFramebuffer","rootOpenGLRenderWindow"]),zt.setGet(e,t,["initialized","context","context2D","canvas","renderPasses","notifyStartCaptureImage","defaultToWebgl2","cursor","useOffScreen"]),zt.setGetArray(e,t,["size"],2),zt.event(e,t,"imageReady"),zt.event(e,t,"windowResizeEvent"),Gg(e,t)}const Wg=zt.newInstance(jg,"vtkOpenGLRenderWindow");Zh("WebGL",Wg);var Hg={newInstance:Wg,extend:jg,pushMonitorGLContextCount:function(e){Ug.push(e)},popMonitorGLContextCount:function(e){return Ug.pop()}};Qt("vtkRenderWindow",Wg);const Kg=["setBindGroup","setIndexBuffer","setVertexBuffer","draw","drawIndexed"],Xg={description:null,handle:null,boundPipeline:null,pipelineHash:null,pipelineSettings:null,replaceShaderCodeFunction:null,depthTextureView:null,label:null};function $g(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xg,r),mt(e,t),t.description={colorAttachments:[{view:void 0,loadOp:"load",storeOp:"store"}],depthStencilAttachment:{view:void 0,depthLoadOp:"clear",depthClearValue:0,depthStoreOp:"store"}},t.replaceShaderCodeFunction=e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let r=t.getCode();r=Np.substitute(r,"//VTK::RenderEncoder::Impl",["output.outColor = computedColor;"]).result,t.setCode(r)},t.pipelineSettings={primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!0,depthCompare:"greater-equal",format:"depth32float"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha"}}}]}},t.colorTextureViews=[],yt(e,t,["boundPipeline","colorTextureViews"]),_t(e,t,["depthTextureView","description","handle","label","pipelineHash","pipelineSettings","replaceShaderCodeFunction"]),function(e,t){t.classHierarchy.push("vtkWebGPURenderEncoder"),e.begin=e=>{t.drawCallbacks=[],t.handle=e.beginRenderPass(t.description),t.label&&t.handle.pushDebugGroup(t.label)},e.end=()=>{for(let r=0;r{if(t.boundPipeline===e)return;t.handle.setPipeline(e.getHandle());const r=e.getPipelineDescription();if(t.colorTextureViews.length!==r.fragment.targets.length)console.log(`mismatched attachment counts on pipeline ${r.fragment.targets.length} while encoder has ${t.colorTextureViews.length}`),console.trace();else for(let e=0;e{t.replaceShaderCodeFunction(e)},e.setColorTextureView=(e,r)=>{t.colorTextureViews[e]!==r&&(t.colorTextureViews[e]=r)},e.activateBindGroup=e=>{const r=t.boundPipeline.getDevice(),n=t.boundPipeline.getBindGroupLayoutCount(e.getLabel());t.handle.setBindGroup(n,e.getBindGroup(r));const o=r.getBindGroupLayoutDescription(e.getBindGroupLayout(r)),i=r.getBindGroupLayoutDescription(t.boundPipeline.getBindGroupLayout(n));o!==i&&(console.log(`renderEncoder ${t.pipelineHash} mismatched bind group layouts bind group has\n${o}\n versus pipeline\n${i}\n`),console.trace())},e.attachTextureViews=()=>{for(let e=0;e{for(let n=0;n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Yg,r),Wm.extend(e,t,r),zt.get(e,t,["colorTexture","depthTexture"]),function(e,t){t.classHierarchy.push("vtkWebGPUOpaquePass"),e.traverse=(r,n)=>{if(t.deleted)return;t._currentParent=n;const o=n.getDevice();if(t.renderEncoder)t.colorTexture.resize(n.getCanvas().width,n.getCanvas().height),t.depthTexture.resize(n.getCanvas().width,n.getCanvas().height);else{e.createRenderEncoder(),t.colorTexture=Oh.newInstance({label:"opaquePassColor"}),t.colorTexture.create(o,{width:n.getCanvas().width,height:n.getCanvas().height,format:"rgba16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC});const r=t.colorTexture.createView("opaquePassColorTexture");t.renderEncoder.setColorTextureView(0,r),t.depthFormat="depth32float",t.depthTexture=Oh.newInstance({label:"opaquePassDepth"}),t.depthTexture.create(o,{width:n.getCanvas().width,height:n.getCanvas().height,format:t.depthFormat,usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC});const i=t.depthTexture.createView("opaquePassDepthTexture");t.renderEncoder.setDepthTextureView(i)}t.renderEncoder.attachTextureViews(),e.setCurrentOperation("opaquePass"),r.setRenderEncoder(t.renderEncoder),r.traverse(e)},e.getColorTextureView=()=>t.renderEncoder.getColorTextureViews()[0],e.getDepthTextureView=()=>t.renderEncoder.getDepthTextureView(),e.createRenderEncoder=()=>{t.renderEncoder=qg.newInstance({label:"OpaquePass"}),t.renderEncoder.setPipelineHash("op")}}(e,t)}var Qg={newInstance:zt.newInstance(Jg,"vtkWebGPUOpaquePass"),extend:Jg};const Zg={colorTextureView:null,depthTextureView:null};function ey(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Zg,r),Wm.extend(e,t,r),zt.setGet(e,t,["colorTextureView","depthTextureView"]),function(e,t){t.classHierarchy.push("vtkWebGPUOrderIndependentTranslucentPass"),e.traverse=(r,n)=>{if(t.deleted)return;t._currentParent=n;const o=n.getDevice();if(t.translucentRenderEncoder)t.translucentColorTexture.resizeToMatch(t.colorTextureView.getTexture()),t.translucentAccumulateTexture.resizeToMatch(t.colorTextureView.getTexture());else{e.createRenderEncoder(),e.createFinalEncoder(),t.translucentColorTexture=Oh.newInstance({label:"translucentPassColor"}),t.translucentColorTexture.create(o,{width:n.getCanvas().width,height:n.getCanvas().height,format:"rgba16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const r=t.translucentColorTexture.createView("oitpColorTexture");t.translucentRenderEncoder.setColorTextureView(0,r),t.translucentAccumulateTexture=Oh.newInstance({label:"translucentPassAccumulate"}),t.translucentAccumulateTexture.create(o,{width:n.getCanvas().width,height:n.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const i=t.translucentAccumulateTexture.createView("oitpAccumTexture");t.translucentRenderEncoder.setColorTextureView(1,i),t.fullScreenQuad=rf.newInstance(),t.fullScreenQuad.setDevice(n.getDevice()),t.fullScreenQuad.setPipelineHash("oitpfsq"),t.fullScreenQuad.setTextureViews(t.translucentRenderEncoder.getColorTextureViews()),t.fullScreenQuad.setFragmentShaderTemplate("\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var tcoord: vec2 = vec2(i32(input.fragPos.x), i32(input.fragPos.y));\n var reveal: f32 = textureLoad(oitpAccumTexture, tcoord, 0).r;\n if (reveal == 1.0) { discard; }\n var tcolor: vec4 = textureLoad(oitpColorTexture, tcoord, 0);\n var total: f32 = max(tcolor.a, 0.01);\n var computedColor: vec4 = vec4(tcolor.r/total, tcolor.g/total, tcolor.b/total, 1.0 - reveal);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n")}t.translucentRenderEncoder.setDepthTextureView(t.depthTextureView),t.translucentRenderEncoder.attachTextureViews(),e.setCurrentOperation("translucentPass"),r.setRenderEncoder(t.translucentRenderEncoder),r.traverse(e),e.finalPass(n,r)},e.finalPass=(e,r)=>{t.translucentFinalEncoder.setColorTextureView(0,t.colorTextureView),t.translucentFinalEncoder.attachTextureViews(),t.translucentFinalEncoder.begin(e.getCommandEncoder()),r.scissorAndViewport(t.translucentFinalEncoder),t.fullScreenQuad.prepareAndDraw(t.translucentFinalEncoder),t.translucentFinalEncoder.end()},e.getTextures=()=>[t.translucentColorTexture,t.translucentAccumulateTexture],e.createRenderEncoder=()=>{t.translucentRenderEncoder=qg.newInstance({label:"translucentRender"});const e=t.translucentRenderEncoder.getDescription();e.colorAttachments=[{view:void 0,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"},{view:void 0,clearValue:[1,0,0,0],loadOp:"clear",storeOp:"store"}],e.depthStencilAttachment={view:void 0,depthLoadOp:"load",depthStoreOp:"store"},t.translucentRenderEncoder.setReplaceShaderCodeFunction(e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor"),t.addOutput("f32","outAccum"),t.addBuiltinInput("vec4","@builtin(position) fragPos");let r=t.getCode();r=Np.substitute(r,"//VTK::RenderEncoder::Impl",["var w: f32 = computedColor.a * pow(0.1 + input.fragPos.z, 2.0);","output.outColor = vec4(computedColor.rgb*w, w);","output.outAccum = computedColor.a;"]).result,t.setCode(r)}),t.translucentRenderEncoder.setPipelineHash("oitpr"),t.translucentRenderEncoder.setPipelineSettings({primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!1,depthCompare:"greater",format:"depth32float"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"one",dstFactor:"one"},alpha:{srcFactor:"one",dstFactor:"one"}}},{format:"r16float",blend:{color:{srcFactor:"zero",dstFactor:"one-minus-src"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createFinalEncoder=()=>{t.translucentFinalEncoder=qg.newInstance({label:"translucentFinal"}),t.translucentFinalEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t.translucentFinalEncoder.setReplaceShaderCodeFunction(e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor"),t.addBuiltinInput("vec4","@builtin(position) fragPos");let r=t.getCode();r=Np.substitute(r,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(computedColor.rgb, computedColor.a);"]).result,t.setCode(r)}),t.translucentFinalEncoder.setPipelineHash("oitpf"),t.translucentFinalEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})}}(e,t)}var ty={newInstance:zt.newInstance(ey,"vtkWebGPUOrderIndependentTranslucentPass"),extend:ey};const ry=0,ny=1,oy=2,iy=3,ay=4,sy=new Float64Array(16),ly=new Float64Array(16),uy={volumes:null,rowLength:1024,lastVolumeLength:0};function cy(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,uy,r),rf.extend(e,t,r),t.fragmentShaderTemplate="\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Volume::TraverseDec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\nfn getTextureValue(vTex: texture_3d, tpos: vec4) -> f32\n{\n // todo multicomponent support\n return textureSampleLevel(vTex, clampSampler, tpos.xyz, 0.0).r;\n}\n\nfn getGradient(vTex: texture_3d, tpos: vec4, vNum: i32, scalar: f32) -> vec4\n{\n var result: vec4;\n\n var tstep: vec4 = volumeSSBO.values[vNum].tstep;\n result.x = getTextureValue(vTex, tpos + vec4(tstep.x, 0.0, 0.0, 1.0)) - scalar;\n result.y = getTextureValue(vTex, tpos + vec4(0.0, tstep.y, 0.0, 1.0)) - scalar;\n result.z = getTextureValue(vTex, tpos + vec4(0.0, 0.0, tstep.z, 1.0)) - scalar;\n result.w = 0.0;\n\n // divide by spacing as that is our delta\n result = result / volumeSSBO.values[vNum].spacing;\n // now we have a gradient in unit tcoords\n\n var grad: f32 = length(result.xyz);\n if (grad > 0.0)\n {\n // rotate to View Coords, needed for lighting and shading\n var nMat: mat4x4 = rendererUBO.SCVCMatrix * volumeSSBO.values[vNum].planeNormals;\n result = nMat * result;\n result = result / length(result);\n }\n\n // store gradient magnitude in .w\n result.w = grad;\n\n return result;\n}\n\nfn processVolume(vTex: texture_3d, vNum: i32, cNum: i32, posSC: vec4, tfunRows: f32) -> vec4\n{\n var outColor: vec4 = vec4(0.0, 0.0, 0.0, 0.0);\n\n // convert to tcoords and reject if outside the volume\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*posSC;\n if (tpos.x < 0.0 || tpos.y < 0.0 || tpos.z < 0.0 ||\n tpos.x > 1.0 || tpos.y > 1.0 || tpos.z > 1.0) { return outColor; }\n\n var scalar: f32 = getTextureValue(vTex, tpos);\n\n var coord: vec2 =\n vec2(scalar * componentSSBO.values[cNum].cScale + componentSSBO.values[cNum].cShift,\n (0.5 + 2.0 * f32(vNum)) / tfunRows);\n var color: vec4 = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);\n\n var gofactor: f32 = 1.0;\n var normal: vec4 = vec4(0.0,0.0,0.0,0.0);\n if (componentSSBO.values[cNum].gomin < 1.0 || volumeSSBO.values[vNum].shade[0] > 0.0)\n {\n normal = getGradient(vTex, tpos, vNum, scalar);\n if (componentSSBO.values[cNum].gomin < 1.0)\n {\n gofactor = clamp(normal.a*componentSSBO.values[cNum].goScale + componentSSBO.values[cNum].goShift,\n componentSSBO.values[cNum].gomin, componentSSBO.values[cNum].gomax);\n }\n }\n\n coord.x = (scalar * componentSSBO.values[cNum].oScale + componentSSBO.values[cNum].oShift);\n var opacity: f32 = textureSampleLevel(ofunTexture, clampSampler, coord, 0.0).r;\n\n if (volumeSSBO.values[vNum].shade[0] > 0.0)\n {\n color = color*abs(normal.z);\n }\n\n outColor = vec4(color.rgb, gofactor * opacity);\n\n return outColor;\n}\n\n// adjust the start and end point of a raycast such that it intersects the unit cube.\n// This function is used to take a raycast starting point and step vector\n// and numSteps and return the startijng and ending steps for intersecting the\n// unit cube. Recall for a 3D texture, the unit cube is the range of texture coordsinates\n// that have valid values. So this funtion can be used to take a ray in texture coordinates\n// and bound it to intersecting the texture.\n//\nfn adjustBounds(tpos: vec4, tstep: vec4, numSteps: f32) -> vec2\n{\n var result: vec2 = vec2(0.0, numSteps);\n var tpos2: vec4 = tpos + tstep*numSteps;\n\n // move tpos to the start of the volume\n var adjust: f32 =\n min(\n max(tpos.x/tstep.x, (tpos.x - 1.0)/tstep.x),\n min(\n max((tpos.y - 1.0)/tstep.y, tpos.y/tstep.y),\n max((tpos.z - 1.0)/tstep.z, tpos.z/tstep.z)));\n if (adjust < 0.0)\n {\n result.x = result.x - adjust;\n }\n\n // adjust length to the end\n adjust =\n max(\n min(tpos2.x/tstep.x, (tpos2.x - 1.0)/tstep.x),\n max(\n min((tpos2.y - 1.0)/tstep.y, tpos2.y/tstep.y),\n min((tpos2.z - 1.0)/tstep.z, tpos2.z/tstep.z)));\n if (adjust > 0.0)\n {\n result.y = result.y - adjust;\n }\n\n return result;\n}\n\nfn getSimpleColor(scalar: f32, vNum: i32, cNum: i32) -> vec4\n{\n // how many rows (tfuns) do we have in our tfunTexture\n var tfunRows: f32 = f32(textureDimensions(tfunTexture).y);\n\n var coord: vec2 =\n vec2(scalar * componentSSBO.values[cNum].cScale + componentSSBO.values[cNum].cShift,\n (0.5 + 2.0 * f32(vNum)) / tfunRows);\n var color: vec4 = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);\n coord.x = (scalar * componentSSBO.values[cNum].oScale + componentSSBO.values[cNum].oShift);\n var opacity: f32 = textureSampleLevel(ofunTexture, clampSampler, coord, 0.0).r;\n return vec4(color.rgb, opacity);\n}\n\nfn traverseMax(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var maxVal: f32 = -1.0e37;\n loop\n {\n var scalar: f32 = getTextureValue(vTex, tpos);\n if (scalar > maxVal)\n {\n maxVal = scalar;\n }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(maxVal, vNum, cNum);\n}\n\nfn traverseMin(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var minVal: f32 = 1.0e37;\n loop\n {\n var scalar: f32 = getTextureValue(vTex, tpos);\n if (scalar < minVal)\n {\n minVal = scalar;\n }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(minVal, vNum, cNum);\n}\n\nfn traverseAverage(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n let ipRange: vec4 = volumeSSBO.values[vNum].ipScalarRange;\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var avgVal: f32 = 0.0;\n var sampleCount: f32 = 0.0;\n loop\n {\n var sample: f32 = getTextureValue(vTex, tpos);\n // right now leave filtering off until WebGL changes get merged\n // if (ipRange.z == 0.0 || sample >= ipRange.x && sample <= ipRange.y)\n // {\n avgVal = avgVal + sample;\n sampleCount = sampleCount + 1.0;\n // }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n if (sampleCount <= 0.0)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(avgVal/sampleCount, vNum, cNum);\n}\n\nfn traverseAdditive(vTex: texture_3d, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4 = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4 = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4 = tpos2 - tpos;\n\n var rayBounds: vec2 = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n let ipRange: vec4 = volumeSSBO.values[vNum].ipScalarRange;\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var sumVal: f32 = 0.0;\n loop\n {\n var sample: f32 = getTextureValue(vTex, tpos);\n // right now leave filtering off until WebGL changes get merged\n // if (ipRange.z == 0.0 || sample >= ipRange.x && sample <= ipRange.y)\n // {\n sumVal = sumVal + sample;\n // }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(sumVal, vNum, cNum);\n}\n\nfn composite(rayLengthSC: f32, minPosSC: vec4, rayStepSC: vec4) -> vec4\n{\n // initial ray position is at the beginning\n var rayPosSC: vec4 = minPosSC;\n\n // how many rows (tfuns) do we have in our tfunTexture\n var tfunRows: f32 = f32(textureDimensions(tfunTexture).y);\n\n var curDist: f32 = 0.0;\n var computedColor: vec4 = vec4(0.0, 0.0, 0.0, 0.0);\n var sampleColor: vec4;\n//VTK::Volume::TraverseCalls\n\n loop\n {\n // for each volume, sample and accumulate color\n//VTK::Volume::CompositeCalls\n\n // increment position\n curDist = curDist + mapperUBO.SampleDistance;\n rayPosSC = rayPosSC + rayStepSC;\n\n // check if we have reached a terminating condition\n if (curDist > rayLengthSC) { break; }\n if (computedColor.a > 0.98) { break; }\n }\n return computedColor;\n}\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var rayMax: f32 = textureSampleLevel(maxTexture, clampSampler, input.tcoordVS, 0.0).r;\n var rayMin: f32 = textureSampleLevel(minTexture, clampSampler, input.tcoordVS, 0.0).r;\n\n // discard empty rays\n if (rayMax <= rayMin) { discard; }\n else\n {\n // compute start and end ray positions in view coordinates\n var minPosSC: vec4 = rendererUBO.PCSCMatrix*vec4(2.0 * input.tcoordVS.x - 1.0, 1.0 - 2.0 * input.tcoordVS.y, rayMax, 1.0);\n minPosSC = minPosSC * (1.0 / minPosSC.w);\n var maxPosSC: vec4 = rendererUBO.PCSCMatrix*vec4(2.0 * input.tcoordVS.x - 1.0, 1.0 - 2.0 * input.tcoordVS.y, rayMin, 1.0);\n maxPosSC = maxPosSC * (1.0 / maxPosSC.w);\n\n var rayLengthSC: f32 = distance(minPosSC.xyz, maxPosSC.xyz);\n var rayStepSC: vec4 = (maxPosSC - minPosSC)*(mapperUBO.SampleDistance/rayLengthSC);\n rayStepSC.w = 0.0;\n\n var computedColor: vec4;\n\n//VTK::Volume::Loop\n\n//VTK::RenderEncoder::Impl\n }\n\n return output;\n}\n",t.UBO=Vf.newInstance({label:"mapperUBO"}),t.UBO.addEntry("SampleDistance","f32"),t.SSBO=Ff.newInstance({label:"volumeSSBO"}),t.componentSSBO=Ff.newInstance({label:"componentSSBO"}),t.lutBuildTime={},zt.obj(t.lutBuildTime,{mtime:0}),function(e,t){t.classHierarchy.push("vtkWebGPUVolumePassFSQ"),e.replaceShaderPosition=(e,t,r)=>{const n=t.getShaderDescription("vertex");n.addBuiltinOutput("vec4","@builtin(position) Position");let o=n.getCode();o=Np.substitute(o,"//VTK::Position::Impl",["output.tcoordVS = vec2(vertexBC.x * 0.5 + 0.5, 1.0 - vertexBC.y * 0.5 - 0.5);","output.Position = vec4(vertexBC, 1.0);"]).result,n.setCode(o),t.getShaderDescription("fragment").addBuiltinInput("vec4","@builtin(position) fragPos")},t.shaderReplacements.set("replaceShaderPosition",e.replaceShaderPosition),e.replaceShaderVolume=(e,r,n)=>{const o=r.getShaderDescription("fragment");let i=o.getCode();const a=[],s=[];for(let e=0;e(\n sampleColor.a * sampleColor.rgb * (1.0 - computedColor.a) + computedColor.rgb,\n (1.0 - computedColor.a)*sampleColor.a + computedColor.a);")):(s.push(` sampleColor = traverseVals[${e}];`),s.push(" computedColor = vec4(\n sampleColor.a * sampleColor.rgb * (1.0 - computedColor.a) + computedColor.rgb,\n (1.0 - computedColor.a)*sampleColor.a + computedColor.a);"));i=Np.substitute(i,"//VTK::Volume::CompositeCalls",a).result,i=Np.substitute(i,"//VTK::Volume::TraverseCalls",s).result,i=Np.substitute(i,"//VTK::Volume::TraverseDec",[`var traverseVals: array,${t.volumes.length}>;`]).result;let l=!1;for(let e=0;e{let n=e.getMTime();for(let e=0;e{let n=Math.max(e.getMTime(),t.WebGPURenderer.getStabilizedTime());for(let e=0;e"),t.SSBO.addEntry("planeNormals","mat4x4"),t.SSBO.addEntry("shade","vec4"),t.SSBO.addEntry("tstep","vec4"),t.SSBO.addEntry("spacing","vec4"),t.SSBO.addEntry("ipScalarRange","vec4"),t.SSBO.setAllInstancesFromArray("SCTCMatrix",i),t.SSBO.setAllInstancesFromArray("planeNormals",a),t.SSBO.setAllInstancesFromArray("shade",l),t.SSBO.setAllInstancesFromArray("tstep",s),t.SSBO.setAllInstancesFromArray("spacing",u),t.SSBO.setAllInstancesFromArray("ipScalarRange",c),t.SSBO.send(r),t.componentSSBO.clearData(),t.componentSSBO.setNumberOfInstances(t.numRows);const d=new Float64Array(t.numRows),p=new Float64Array(t.numRows),f=new Float64Array(t.numRows),y=new Float64Array(t.numRows),v=new Float64Array(t.numRows),S=new Float64Array(t.numRows),C=new Float64Array(t.numRows),T=new Float64Array(t.numRows);let w=0;for(let e=0;e{r();let n=t.volumes[0].getRenderable().getMapper().getSampleDistance();for(let e=0;e{t.pipelineHash="volfsq";for(let e=0;e{if(!t.volumes||t.volumes.length!==r.length)return t.volumes=[...r],void e.modified();for(let n=0;n{const e=n();return e.push(t.componentSSBO),e.push(t.clampSampler),e}}(e,t)}var dy={newInstance:zt.newInstance(cy,"vtkWebGPUVolumePassFSQ"),extend:cy};const{Representation:py}=os,{BufferUsage:fy,PrimitiveTypes:hy}=If,my=[[0,4,6],[0,6,2],[1,3,7],[1,7,5],[0,5,4],[0,1,5],[2,6,7],[2,7,3],[0,3,1],[0,2,3],[4,5,7],[4,7,6]],gy={colorTextureView:null,depthTextureView:null,volumes:null};function yy(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,gy,r),Wm.extend(e,t,r),t._mapper=Zp.newInstance(),t._mapper.setFragmentShaderTemplate("\n//VTK::Renderer::Dec\n\n//VTK::Select::Dec\n\n//VTK::VolumePass::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : fragmentOutput;\n\n //VTK::Select::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::VolumePass::Impl\n\n // use the maximum (closest) of the current value and the zbuffer\n // the blend func will then take the min to find the farthest stop value\n var stopval: f32 = max(input.fragPos.z, textureLoad(opaquePassDepthTexture, vec2(i32(input.fragPos.x), i32(input.fragPos.y)), 0));\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n"),t._mapper.getShaderReplacements().set("replaceShaderVolumePass",(e,t,r)=>{t.getShaderDescription("fragment").addBuiltinInput("vec4","@builtin(position) fragPos")}),t._boundsPoly=mc.newInstance(),t._lastMTimes=[],zt.setGet(e,t,["colorTextureView","depthTextureView"]),function(e,t){t.classHierarchy.push("vtkWebGPUVolumePass"),e.initialize=r=>{t._clearEncoder||e.createClearEncoder(r),t._mergeEncoder||e.createMergeEncoder(r),t._copyEncoder||e.createCopyEncoder(r),t._depthRangeEncoder||e.createDepthRangeEncoder(r),t.fullScreenQuad||(t.fullScreenQuad=dy.newInstance(),t.fullScreenQuad.setDevice(r.getDevice()),t.fullScreenQuad.setTextureViews([...t._depthRangeEncoder.getColorTextureViews()])),t._volumeCopyQuad||(t._volumeCopyQuad=rf.newInstance(),t._volumeCopyQuad.setPipelineHash("volpassfsq"),t._volumeCopyQuad.setDevice(r.getDevice()),t._volumeCopyQuad.setFragmentShaderTemplate("\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = textureSample(volumePassColorTexture,\n volumePassColorTextureSampler, mapperUBO.tscale*input.tcoordVS);\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n"),t._copyUBO=Vf.newInstance({label:"mapperUBO"}),t._copyUBO.addEntry("tscale","vec2"),t._volumeCopyQuad.setUBO(t._copyUBO),t._volumeCopyQuad.setTextureViews([t._colorTextureView]))},e.traverse=(r,n)=>{if(t.deleted)return;t._currentParent=n,e.initialize(n),e.computeTiming(n),e.renderDepthBounds(r,n),t._firstGroup=!0;const o=n.getDevice(),i=o.getHandle().limits.maxSampledTexturesPerShaderStage-4;if(t.volumes.length>i){const o=r.getRenderable().getActiveCamera().getPosition(),a=[];for(let e=0;ea[t]-a[e]);let l=[],u=s.length%i;for(let o=0;o=u&&(e.rayCastPass(n,r,l),l=[],u=i,t._firstGroup=!1)}else e.rayCastPass(n,r,t.volumes);if(t._volumeCopyQuad.setWebGPURenderer(r),t._useSmallViewport){const e=t._colorTextureView.getTexture().getWidth(),r=t._colorTextureView.getTexture().getHeight();t._copyUBO.setArray("tscale",[t._smallViewportWidth/e,t._smallViewportHeight/r])}else t._copyUBO.setArray("tscale",[1,1]);t._copyUBO.sendIfNeeded(o),t._copyEncoder.setColorTextureView(0,t.colorTextureView),t._copyEncoder.attachTextureViews(),t._copyEncoder.begin(n.getCommandEncoder()),r.scissorAndViewport(t._copyEncoder),t._volumeCopyQuad.prepareAndDraw(t._copyEncoder),t._copyEncoder.end()},e.delete=zt.chain(()=>{t._animationRateSubscription&&(t._animationRateSubscription.unsubscribe(),t._animationRateSubscription=null)},e.delete),e.computeTiming=e=>{const r=e.getRenderable().getInteractor();if(null==t._lastScale){const e=t.volumes[0].getRenderable().getMapper();t._lastScale=e.getInitialInteractionScale()||1}t._useSmallViewport=!1,r.isAnimating()&&t._lastScale>1.5&&(t._useSmallViewport=!0),t._colorTexture.resize(e.getCanvas().width,e.getCanvas().height),t._animationRateSubscription||(t._animationRateSubscription=r.onAnimationFrameRateUpdate(()=>{const e=t.volumes[0].getRenderable().getMapper();if(e.getAutoAdjustSampleDistances()){const e=r.getRecentAnimationFrameRate(),n=t._lastScale*r.getDesiredUpdateRate()/e;t._lastScale=n,t._lastScale>400&&(t._lastScale=400)}else t._lastScale=e.getImageSampleDistance()*e.getImageSampleDistance();t._lastScale<1.5&&(t._lastScale=1.5)}))},e.rayCastPass=(e,r,n)=>{const o=t._firstGroup?t._clearEncoder:t._mergeEncoder;o.attachTextureViews(),o.begin(e.getCommandEncoder());let i=t._colorTextureView.getTexture().getWidth(),a=t._colorTextureView.getTexture().getHeight();if(t._useSmallViewport){const r=e.getCanvas(),n=1/Math.sqrt(t._lastScale);t._smallViewportWidth=Math.ceil(n*r.width),t._smallViewportHeight=Math.ceil(n*r.height),i=t._smallViewportWidth,a=t._smallViewportHeight}o.getHandle().setViewport(0,0,i,a,0,1),o.getHandle().setScissorRect(0,0,i,a),t.fullScreenQuad.setWebGPURenderer(r),t.fullScreenQuad.setVolumes(n),t.fullScreenQuad.prepareAndDraw(o),o.end()},e.renderDepthBounds=(r,n)=>{e.updateDepthPolyData(r);const o=t._boundsPoly,i=o.getPoints(),a=o.getPolys();let s={hash:`vp${a.getMTime()}`,usage:fy.Index,cells:a,numberOfPoints:i.getNumberOfPoints(),primitiveType:hy.Triangles,representation:py.SURFACE};const l=n.getDevice().getBufferManager().getBuffer(s);t._mapper.getVertexInput().setIndexBuffer(l),s={usage:fy.PointArray,format:"float32x4",hash:`vp${i.getMTime()}${a.getMTime()}`,dataArray:i,indexBuffer:l,packExtra:!0};const u=n.getDevice().getBufferManager().getBuffer(s);t._mapper.getVertexInput().addBuffer(u,["vertexBC"]),t._mapper.setNumberOfVertices(u.getSizeInBytes()/u.getStrideInBytes()),e.drawDepthRange(r,n)},e.updateDepthPolyData=e=>{let r=!1;for(let e=0;e{t._depthRangeTexture.resizeToMatch(t.colorTextureView.getTexture()),t._depthRangeTexture2.resizeToMatch(t.colorTextureView.getTexture()),t._depthRangeEncoder.attachTextureViews(),e.setCurrentOperation("volumeDepthRangePass"),r.setRenderEncoder(t._depthRangeEncoder),r.volumeDepthRangePass(!0),t._mapper.setWebGPURenderer(r),t._mapper.prepareToDraw(t._depthRangeEncoder),t._mapper.registerDrawCallback(t._depthRangeEncoder),r.volumeDepthRangePass(!1)},e.createDepthRangeEncoder=e=>{const r=e.getDevice();t._depthRangeEncoder=qg.newInstance({label:"VolumePass DepthRange"}),t._depthRangeEncoder.setPipelineHash("volr"),t._depthRangeEncoder.setReplaceShaderCodeFunction(e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor1"),t.addOutput("vec4","outColor2");let r=t.getCode();r=Np.substitute(r,"//VTK::RenderEncoder::Impl",["output.outColor1 = vec4(input.fragPos.z, 0.0, 0.0, 0.0);","output.outColor2 = vec4(stopval, 0.0, 0.0, 0.0);"]).result,t.setCode(r)}),t._depthRangeEncoder.setDescription({colorAttachments:[{view:null,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"},{view:null,clearValue:[1,1,1,1],loadOp:"clear",storeOp:"store"}]}),t._depthRangeEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"r16float",blend:{color:{srcFactor:"one",dstFactor:"one",operation:"max"},alpha:{srcFactor:"one",dstFactor:"one",operation:"max"}}},{format:"r16float",blend:{color:{srcFactor:"one",dstFactor:"one",operation:"min"},alpha:{srcFactor:"one",dstFactor:"one",operation:"min"}}}]}}),t._depthRangeTexture=Oh.newInstance({label:"volumePassMaxDepth"}),t._depthRangeTexture.create(r,{width:e.getCanvas().width,height:e.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const n=t._depthRangeTexture.createView("maxTexture");t._depthRangeEncoder.setColorTextureView(0,n),t._depthRangeTexture2=Oh.newInstance({label:"volumePassDepthMin"}),t._depthRangeTexture2.create(r,{width:e.getCanvas().width,height:e.getCanvas().height,format:"r16float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING});const o=t._depthRangeTexture2.createView("minTexture");t._depthRangeEncoder.setColorTextureView(1,o),t._mapper.setDevice(e.getDevice()),t._mapper.setTextureViews([t.depthTextureView])},e.createClearEncoder=e=>{t._colorTexture=Oh.newInstance({label:"volumePassColor"}),t._colorTexture.create(e.getDevice(),{width:e.getCanvas().width,height:e.getCanvas().height,format:"bgra8unorm",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC}),t._colorTextureView=t._colorTexture.createView("volumePassColorTexture"),t._colorTextureView.addSampler(e.getDevice(),{minFilter:"linear",magFilter:"linear"}),t._clearEncoder=qg.newInstance({label:"VolumePass Clear"}),t._clearEncoder.setColorTextureView(0,t._colorTextureView),t._clearEncoder.setDescription({colorAttachments:[{view:null,clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store"}]}),t._clearEncoder.setPipelineHash("volpf"),t._clearEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"bgra8unorm",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createCopyEncoder=e=>{t._copyEncoder=qg.newInstance({label:"volumePassCopy"}),t._copyEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._copyEncoder.setPipelineHash("volcopypf"),t._copyEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"rgba16float",blend:{color:{srcFactor:"one",dstFactor:"one-minus-src-alpha"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.createMergeEncoder=e=>{t._mergeEncoder=qg.newInstance({label:"volumePassMerge"}),t._mergeEncoder.setColorTextureView(0,t._colorTextureView),t._mergeEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._mergeEncoder.setReplaceShaderCodeFunction(e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let r=t.getCode();r=Np.substitute(r,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(computedColor.rgb, computedColor.a);"]).result,t.setCode(r)}),t._mergeEncoder.setPipelineHash("volpf"),t._mergeEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:"bgra8unorm",blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha"}}}]}})},e.setVolumes=r=>{if(!t.volumes||t.volumes.length!==r.length)return t.volumes=[...r],void e.modified();for(let n=0;n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,by,r),Wm.extend(e,t,r),zt.setGet(e,t,["opaquePass","translucentPass","volumePass"]),function(e,t){t.classHierarchy.push("vtkForwardPass"),e.traverse=function(r){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t.deleted)return;t._currentParent=n,e.setCurrentOperation("buildPass"),r.traverse(e),t.opaquePass||(t.opaquePass=Qg.newInstance());const o=r.getRenderable().getNumberOfLayers(),i=r.getChildren();for(let n=0;n0&&(t.translucentPass||(t.translucentPass=ty.newInstance()),t.translucentPass.setColorTextureView(t.opaquePass.getColorTextureView()),t.translucentPass.setDepthTextureView(t.opaquePass.getDepthTextureView()),t.translucentPass.traverse(a,r)),t.volumes.length>0&&(t.volumePass||(t.volumePass=vy.newInstance()),t.volumePass.setColorTextureView(t.opaquePass.getColorTextureView()),t.volumePass.setDepthTextureView(t.opaquePass.getDepthTextureView()),t.volumePass.setVolumes(t.volumes),t.volumePass.traverse(a,r)),e.finalPass(r,a))}},e.finalPass=(r,n)=>{t._finalBlitEncoder||e.createFinalBlitEncoder(r),t._finalBlitOutputTextureView.createFromTextureHandle(r.getCurrentTexture(),{depth:1,format:r.getPresentationFormat()}),t._finalBlitEncoder.attachTextureViews(),t._finalBlitEncoder.begin(r.getCommandEncoder()),n.scissorAndViewport(t._finalBlitEncoder),t._fullScreenQuad.prepareAndDraw(t._finalBlitEncoder),t._finalBlitEncoder.end()},e.createFinalBlitEncoder=e=>{t._finalBlitEncoder=qg.newInstance({label:"forwardPassBlit"}),t._finalBlitEncoder.setDescription({colorAttachments:[{view:null,loadOp:"load",storeOp:"store"}]}),t._finalBlitEncoder.setPipelineHash("fpf"),t._finalBlitEncoder.setPipelineSettings({primitive:{cullMode:"none"},fragment:{targets:[{format:e.getPresentationFormat(),blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha"}}}]}}),t._fsqSampler=wh.newInstance({label:"finalPassSampler"}),t._fsqSampler.create(e.getDevice(),{minFilter:"linear",magFilter:"linear"}),t._fullScreenQuad=rf.newInstance(),t._fullScreenQuad.setDevice(e.getDevice()),t._fullScreenQuad.setPipelineHash("fpfsq"),t._fullScreenQuad.setTextureViews([t.opaquePass.getColorTextureView()]),t._fullScreenQuad.setAdditionalBindables([t._fsqSampler]),t._fullScreenQuad.setFragmentShaderTemplate("\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4 = clamp(textureSampleLevel(opaquePassColorTexture, finalPassSampler, input.tcoordVS, 0.0),vec4(0.0),vec4(1.0));\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n"),t._finalBlitOutputTextureView=Dh.newInstance(),t._finalBlitEncoder.setColorTextureView(0,t._finalBlitOutputTextureView)},e.incrementOpaqueActorCount=()=>t.opaqueActorCount++,e.incrementTranslucentActorCount=()=>t.translucentActorCount++,e.addVolume=e=>{t.volumes.push(e)}}(e,t)}var _y={newInstance:zt.newInstance(xy,"vtkForwardPass"),extend:xy};const{VtkDataTypes:Sy}=_s,Cy={handle:null,device:null};function Ty(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Cy,r),zt.obj(e,t),zt.setGet(e,t,["device"]),function(e,t){function r(e){if(e.imageData){e.dataArray=e.imageData.getPointData().getScalars(),e.time=e.dataArray.getMTime(),e.nativeArray=e.dataArray.getData();const t=e.imageData.getDimensions();switch(e.width=t[0],e.height=t[1],e.depth=t[2],e.dataArray.getNumberOfComponents()){case 1:e.format="r";break;case 2:e.format="rg";break;default:e.format="rgba"}switch(e.dataArray.getDataType()){case Sy.UNSIGNED_CHAR:e.format+="8unorm";break;case Sy.FLOAT:case Sy.UNSIGNED_INT:case Sy.INT:case Sy.DOUBLE:case Sy.UNSIGNED_SHORT:case Sy.SHORT:default:e.format+="16float"}}e.image&&(e.width=e.image.width,e.height=e.image.height,e.depth=1,e.format="rgba8unorm",e.flip=!0,e.usage=GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.RENDER_ATTACHMENT),e.jsImageData&&(e.width=e.jsImageData.width,e.height=e.jsImageData.height,e.depth=1,e.format="rgba8unorm",e.flip=!0,e.nativeArray=e.jsImageData.data,e.usage=GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.RENDER_ATTACHMENT),e.imageBitmap&&(e.width=e.imageBitmap.width,e.height=e.imageBitmap.height,e.depth=1,e.format="rgba8unorm",e.flip=!0,e.usage=GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.RENDER_ATTACHMENT),e.canvas&&(e.width=e.canvas.width,e.height=e.canvas.height,e.depth=1,e.format="rgba8unorm",e.flip=!0,e.usage=GPUTextureUsage.STORAGE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.RENDER_ATTACHMENT)}function n(e){const r=Oh.newInstance({label:e.label});return r.create(t.device,{width:e.width,height:e.height,depth:e.depth,format:e.format,usage:e.usage,mipLevel:e.mipLevel}),(e.nativeArray||e.image||e.canvas||e.imageBitmap)&&r.writeImageData(e),r}t.classHierarchy.push("vtkWebGPUTextureManager"),e.getTexture=e=>e.hash?t.device.getCachedObject(e.hash,n,e):n(e),e.getTextureForImageData=e=>{const n={time:e.getMTime()};return n.imageData=e,r(n),n.hash=n.time+n.format+n.mipLevel,t.device.getTextureManager().getTexture(n)},e.getTextureForVTKTexture=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;const o={time:e.getMTime(),label:n};return e.getInputData()?o.imageData=e.getInputData():e.getImage()?o.image=e.getImage():e.getJsImageData()?o.jsImageData=e.getJsImageData():e.getImageBitmap()?o.imageBitmap=e.getImageBitmap():e.getCanvas()&&(o.canvas=e.getCanvas()),r(o),o.mipLevel=e.getMipLevel(),o.hash=o.time+o.format+o.mipLevel,t.device.getTextureManager().getTexture(o)}}(e,t)}var wy={newInstance:zt.newInstance(Ty),extend:Ty};class Ay extends Map{constructor(){super(),this.registry=new FinalizationRegistry(e=>{const t=super.get(e);t&&t.deref&&void 0===t.deref()&&super.delete(e)})}getValue(e){const t=super.get(e);if(t){const r=t.deref();if(void 0!==r)return r;super.delete(e)}}setValue(e,t){let r;return t&&"object"==typeof t&&(r=new WeakRef(t),this.registry.register(t,e),super.set(e,r)),r}}const Ey={handle:null,pipelines:null,shaderCache:null,bindGroupLayouts:null,bufferManager:null,textureManager:null};function Dy(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ey,r),mt(e,t),_t(e,t,["handle"]),yt(e,t,["bufferManager","shaderCache","textureManager"]),t.objectCache=new Ay,t.shaderCache=Np.newInstance(),t.shaderCache.setDevice(e),t.bindGroupLayouts=[],t.bufferManager=If.newInstance(),t.bufferManager.setDevice(e),t.textureManager=wy.newInstance(),t.textureManager.setDevice(e),t.pipelines={},function(e,t){t.classHierarchy.push("vtkWebGPUDevice"),e.initialize=e=>{t.handle=e},e.createCommandEncoder=()=>t.handle.createCommandEncoder(),e.submitCommandEncoder=e=>{t.handle.queue.submit([e.finish()])},e.getShaderModule=e=>t.shaderCache.getShaderModule(e),e.getBindGroupLayout=e=>{if(!e.entries)return null;for(let t=0;t{for(let r=0;re in t.pipelines?t.pipelines[e]:null,e.createPipeline=(r,n)=>{n.initialize(e,r),t.pipelines[r]=n},e.onSubmittedWorkDone=()=>t.handle.queue.onSubmittedWorkDone(),e.hasCachedObject=e=>t.objectCache.getValue(e),e.getCachedObject=function(e,r){if(!e)return vtkErrorMacro("attempt to cache an object without a hash"),null;const n=t.objectCache.getValue(e);if(n)return n;for(var o=arguments.length,i=new Array(o>2?o-2:0),a=2;a2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Iy,r),Wm.extend(e,t,r),zt.get(e,t,["colorTexture","depthTexture"]),function(e,t){t.classHierarchy.push("vtkWebGPUHardwareSelectionPass"),e.traverse=(r,n)=>{if(t.deleted)return;t._currentParent=null,e.setCurrentOperation("buildPass"),r.traverse(e);const o=r.getDevice();if(t.selectionRenderEncoder)t.colorTexture.resize(r.getCanvas().width,r.getCanvas().height),t.depthTexture.resizeToMatch(t.colorTexture);else{e.createRenderEncoder(),t.colorTexture=Oh.newInstance({label:"hardwareSelectorColor"}),t.colorTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"rgba32uint",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC});const n=t.colorTexture.createView("hardwareSelectColorTexture");t.selectionRenderEncoder.setColorTextureView(0,n),t.depthTexture=Oh.newInstance({label:"hardwareSelectorDepth"}),t.depthTexture.create(o,{width:r.getCanvas().width,height:r.getCanvas().height,format:"depth32float",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC});const i=t.depthTexture.createView("hardwareSelectDepthTexture");t.selectionRenderEncoder.setDepthTextureView(i)}t.selectionRenderEncoder.attachTextureViews(),n.setRenderEncoder(t.selectionRenderEncoder),e.setCurrentOperation("cameraPass"),n.traverse(e),e.setCurrentOperation("opaquePass"),n.traverse(e)},e.createRenderEncoder=()=>{t.selectionRenderEncoder=qg.newInstance({label:"HardwareSelectionPass"}),t.selectionRenderEncoder.setPipelineHash("sel"),t.selectionRenderEncoder.setReplaceShaderCodeFunction(e=>{const t=e.getShaderDescription("fragment");t.addOutput("vec4","outColor");let r=t.getCode();r=Np.substitute(r,"//VTK::RenderEncoder::Impl",["output.outColor = vec4(mapperUBO.PropID, compositeID, 0u, 0u);"]).result,t.setCode(r)}),t.selectionRenderEncoder.getDescription().colorAttachments[0].clearValue=[0,0,0,0],t.selectionRenderEncoder.setPipelineSettings({primitive:{cullMode:"none"},depthStencil:{depthWriteEnabled:!0,depthCompare:"greater",format:"depth32float"},fragment:{targets:[{format:"rgba32uint",blend:void 0}]}})}}(e,t)}var Ny={newInstance:zt.newInstance(Oy,"vtkWebGPUHardwareSelectionPass"),extend:Oy};const{SelectionContent:My,SelectionField:Ry}=ag,{FieldAssociations:Fy}=Gs,{vtkErrorMacro:By}=zt;function Ly(e){return`${e.propID} ${e.compositeID}`}function ky(e,t,r,n){const o=4*((r.height-t-1)*r.colorBufferWidth+e)+n;return r.colorValues[o]}function Uy(e,t,r,n){const o=r<0?0:r;if(0===o){if(n[0]=t[0],n[1]=t[1],t[0]<0||t[0]>=e.width||t[1]<0||t[1]>=e.height)return null;const r=ky(t[0],t[1],e,0);if(r<=0)return null;const o={};o.propID=r;let i=ky(t[0],t[1],e,1);if((i<0||i>16777215)&&(i=0),o.compositeID=i,e.captureZValues){const r=(e.height-t[1]-1)*e.zbufferBufferWidth+t[0];o.zValue=e.depthValues[r],o.zValue=e.webGPURenderer.convertToOpenGLDepth(o.zValue),o.displayPosition=t}return o}const i=[t[0],t[1]],a=[0,0];let s=Uy(e,t,0,n);if(s)return s;for(let t=1;tt?i[1]-t:0;r<=i[1]+t;++r){if(a[1]=r,i[0]>=t&&(a[0]=i[0]-t,s=Uy(e,a,0,n),s))return s;if(a[0]=i[0]+t,s=Uy(e,a,0,n),s)return s}for(let r=i[0]>=t?i[0]-(t-1):0;r<=i[0]+(t-1);++r){if(a[0]=r,i[1]>=t&&(a[1]=i[1]-t,s=Uy(e,a,0,n),s))return s;if(a[1]=i[1]+t,s=Uy(e,a,0,n),s)return s}}return n[0]=t[0],n[1]=t[1],null}const Vy={};function Gy(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Vy,r),ng.extend(e,t,r),t._selectionPass=Ny.newInstance(),zt.setGet(e,t,["_WebGPURenderWindow"]),zt.moveToProtected(e,t,["WebGPURenderWindow"]),function(e,t){t.classHierarchy.push("vtkWebGPUHardwareSelector"),e.endSelection=()=>{t.WebGPURenderer.setSelector(null)},e.getSourceDataAsync=async e=>{if(!e||!t._WebGPURenderWindow)return By("Renderer and view must be set before calling Select."),!1;t._WebGPURenderWindow.getRenderable().preRender(),t._WebGPURenderWindow.getInitialized()||(t._WebGPURenderWindow.initialize(),await new Promise(e=>{t._WebGPURenderWindow.onInitialized(e)}));const r=t._WebGPURenderWindow.getViewNodeFor(e);if(!r)return!1;const n=r.getSuppressClear();r.setSuppressClear(!0),t._selectionPass.traverse(t._WebGPURenderWindow,r),r.setSuppressClear(n);const o=t._WebGPURenderWindow.getDevice(),i=t._selectionPass.getColorTexture(),a=t._selectionPass.getDepthTexture(),s={area:[0,0,i.getWidth()-1,i.getHeight()-1],captureZValues:t.captureZValues,fieldAssociation:t.fieldAssociation,renderer:e,webGPURenderer:r,webGPURenderWindow:t._WebGPURenderWindow,width:i.getWidth(),height:i.getHeight()};s.colorBufferWidth=16*Math.floor((s.width+15)/16),s.colorBufferSizeInBytes=s.colorBufferWidth*s.height*4*4;const l=lf.newInstance({label:"hardwareSelectColorBuffer"});l.setDevice(o),l.create(s.colorBufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST);const u=t._WebGPURenderWindow.getCommandEncoder();let c;u.copyTextureToBuffer({texture:i.getHandle()},{buffer:l.getHandle(),bytesPerRow:16*s.colorBufferWidth,rowsPerImage:s.height},{width:s.width,height:s.height,depthOrArrayLayers:1}),t.captureZValues&&(s.zbufferBufferWidth=64*Math.floor((s.width+63)/64),c=lf.newInstance({label:"hardwareSelectDepthBuffer"}),c.setDevice(o),s.zbufferSizeInBytes=s.height*s.zbufferBufferWidth*4,c.create(s.zbufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST),u.copyTextureToBuffer({texture:a.getHandle(),aspect:"depth-only"},{buffer:c.getHandle(),bytesPerRow:4*s.zbufferBufferWidth,rowsPerImage:s.height},{width:s.width,height:s.height,depthOrArrayLayers:1})),o.submitCommandEncoder(u);const d=l.mapAsync(GPUMapMode.READ);if(t.captureZValues){const e=c.mapAsync(GPUMapMode.READ);await Promise.all([d,e]),s.depthValues=new Float32Array(c.getMappedRange().slice()),c.unmap()}else await d;return s.colorValues=new Uint32Array(l.getMappedRange().slice()),l.unmap(),s.generateSelection=(e,t,r,n)=>function(e,t,r,n,o){const i=Math.floor(t),a=Math.floor(r),s=Math.floor(n),l=Math.floor(o),u=new Map,c=[0,0];for(let t=a;t<=l;t++)for(let r=i;r<=s;r++){const n=Uy(e,[r,t],0,c);if(n){const t=Ly(n);if(u.has(t)){const r=u.get(t);r.pixelCount++,e.captureZValues&&n.zValue{const a=ag.newInstance();switch(a.setContentType(My.INDICES),e){case Fy.FIELD_ASSOCIATION_CELLS:a.setFieldType(Ry.CELL);break;case Fy.FIELD_ASSOCIATION_POINTS:a.setFieldType(Ry.POINT);break;default:By("Unknown field association")}a.getProperties().propID=t.info.propID;const s=r.webGPURenderer.getPropFromID(t.info.propID);a.getProperties().prop=s.getRenderable(),a.getProperties().compositeID=t.info.compositeID,a.getProperties().pixelCount=t.pixelCount,r.captureZValues&&(a.getProperties().displayPosition=[t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue],a.getProperties().worldPosition=r.webGPURenderWindow.displayToWorld(t.info.displayPosition[0],t.info.displayPosition[1],t.info.zValue,r.renderer)),a.setSelectionList(t.attributeIDs),n[o]=a,o++}),n}(e.fieldAssociation,u,e)}(s,e,t,r,n),s}}(e,t)}var zy={newInstance:zt.newInstance(Gy,"vtkWebGPUHardwareSelector"),extend:Gy};const{vtkErrorMacro:jy}=zt,Wy={position:"absolute",top:0,left:0,width:"100%",height:"100%"};const Hy={initialized:!1,context:null,adapter:null,device:null,canvas:null,cursorVisibility:!0,cursor:"pointer",containerSize:null,renderPasses:[],notifyStartCaptureImage:!1,imageFormat:"image/png",useOffScreen:!1,useBackgroundImage:!1,nextPropID:1,xrSupported:!1,presentationFormat:null};const Ky=zt.newInstance(function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Hy,r),t.canvas=document.createElement("canvas"),t.canvas.style.width="100%",t.bgImage=new Image,t.bgImage.style.position="absolute",t.bgImage.style.left="0",t.bgImage.style.top="0",t.bgImage.style.width="100%",t.bgImage.style.height="100%",t.bgImage.style.zIndex="-1",Ng.extend(e,t,r),t.myFactory=_p.newInstance(),t.renderPasses[0]=_y.newInstance(),t.selector||(t.selector=zy.newInstance(),t.selector.setWebGPURenderWindow(e)),zt.event(e,t,"imageReady"),zt.event(e,t,"initialized"),zt.get(e,t,["commandEncoder","device","presentationFormat","useBackgroundImage","xrSupported"]),zt.setGet(e,t,["initialized","context","canvas","device","renderPasses","notifyStartCaptureImage","cursor","useOffScreen"]),zt.setGetArray(e,t,["size"],2),zt.event(e,t,"windowResizeEvent"),function(e,t){t.classHierarchy.push("vtkWebGPURenderWindow"),e.getViewNodeFactory=()=>t.myFactory;const r=[0,0];e.onModified(function(){t.renderable&&(t.size[0]===r[0]&&t.size[1]===r[1]||(r[0]=t.size[0],r[1]=t.size[1],t.canvas.setAttribute("width",t.size[0]),t.canvas.setAttribute("height",t.size[1]),e.recreateSwapChain())),t.viewStream&&t.viewStream.setSize(t.size[0],t.size[1]),t.canvas.style.display=t.useOffScreen?"none":"block",t.el&&(t.el.style.cursor=t.cursorVisibility?t.cursor:"none"),t.containerSize=null}),e.recreateSwapChain=()=>{t.context&&(t.context.unconfigure(),t.presentationFormat=navigator.gpu.getPreferredCanvasFormat(t.adapter),t.context.configure({device:t.device.getHandle(),format:t.presentationFormat,alphaMode:"premultiplied",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_DST,width:t.size[0],height:t.size[1]}),t._configured=!0)},e.getCurrentTexture=()=>t.context.getCurrentTexture(),e.buildPass=r=>{if(r){if(!t.renderable)return;e.prepareNodes(),e.addMissingNodes(t.renderable.getRenderersByReference()),e.removeUnusedNodes(),e.initialize()}else t.initialized&&(t._configured||e.recreateSwapChain(),t.commandEncoder=t.device.createCommandEncoder())},e.initialize=()=>{if(!t.initializing){if(t.initializing=!0,!navigator.gpu)return void jy("WebGPU is not enabled.");e.create3DContextAsync().then(()=>{t.initialized=!0,t.deleted||e.invokeInitialized()})}},e.setContainer=r=>{t.el&&t.el!==r&&(t.canvas.parentNode!==t.el&&jy("Error: canvas parent node does not match container"),t.el.removeChild(t.canvas),t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)),t.el!==r&&(t.el=r,t.el&&(t.el.appendChild(t.canvas),t.useBackgroundImage&&t.el.appendChild(t.bgImage)),e.modified())},e.getContainer=()=>t.el,e.getContainerSize=()=>{if(!t.containerSize&&t.el){const{width:e,height:r}=t.el.getBoundingClientRect();t.containerSize=[e,r]}return t.containerSize||t.size},e.getFramebufferSize=()=>t.size,e.create3DContextAsync=async()=>{t.adapter=await navigator.gpu.requestAdapter({powerPreference:"high-performance"}),t.deleted||(t.device=Py.newInstance(),t.device.initialize(await t.adapter.requestDevice()),t.deleted?t.device=null:t.context=t.canvas.getContext("webgpu"))},e.releaseGraphicsResources=()=>{const r=Wm.newInstance();r.setCurrentOperation("Release"),r.traverse(e,null),t.adapter=null,t.device=null,t.context=null,t.initialized=!1,t.initializing=!1},e.setBackgroundImage=e=>{t.bgImage.src=e.src},e.setUseBackgroundImage=e=>{t.useBackgroundImage=e,t.useBackgroundImage&&!t.el.contains(t.bgImage)?t.el.appendChild(t.bgImage):!t.useBackgroundImage&&t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)},e.captureNextImage=function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",{resetCamera:n=!1,size:o=null,scale:i=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.deleted)return null;t.imageFormat=r;const a=t.notifyStartCaptureImage;return t.notifyStartCaptureImage=!0,t._screenshot={size:o||1!==i?o||t.size.map(e=>e*i):null},new Promise((r,o)=>{const i=e.onImageReady(o=>{if(null===t._screenshot.size)t.notifyStartCaptureImage=a,i.unsubscribe(),t._screenshot.placeHolder&&(t.size=t._screenshot.originalSize,e.modified(),t._screenshot.cameras&&t._screenshot.cameras.forEach(e=>{let{restoreParamsFn:t,arg:r}=e;return t(r)}),e.traverseAllPasses(),t.el.removeChild(t._screenshot.placeHolder),t._screenshot.placeHolder.remove(),t._screenshot=null),r(o);else{const r=document.createElement("img");if(r.style=Wy,r.src=o,t._screenshot.placeHolder=t.el.appendChild(r),t.canvas.style.display="none",t._screenshot.originalSize=t.size,t.size=t._screenshot.size,t._screenshot.size=null,e.modified(),n){const e=!0!==n;t._screenshot.cameras=t.renderable.getRenderers().map(t=>{const r=t.getActiveCamera(),o=r.get("focalPoint","position","parallelScale");return{resetCameraArgs:e?{renderer:t}:void 0,resetCameraFn:e?n:t.resetCamera,restoreParamsFn:r.set,arg:JSON.parse(JSON.stringify(o))}}),t._screenshot.cameras.forEach(e=>{let{resetCameraFn:t,resetCameraArgs:r}=e;return t(r)})}e.traverseAllPasses()}})})},e.traverseAllPasses=()=>{if(!t.deleted)if(t.initialized){if(t.renderPasses)for(let r=0;r{!async function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.imageFormat;const n=document.createElement("canvas"),o=n.getContext("2d");n.width=t.canvas.width,n.height=t.canvas.height;const i=await e.getPixelsAsync(),a=new ImageData(i.colorValues,i.width,i.height);o.putImageData(a,0,0);const s=t.canvas.getBoundingClientRect();t.renderable.getRenderers().forEach(e=>{e.getViewProps().forEach(e=>{if(e.getContainer){const t=e.getContainer().getElementsByTagName("canvas");for(let e=0;e{t.unsubscribe(),e.traverseAllPasses()})}},e.setViewStream=r=>t.viewStream!==r&&(t.subscription&&(t.subscription.unsubscribe(),t.subscription=null),t.viewStream=r,t.viewStream&&(t.renderable.getRenderers()[0].getBackgroundByReference()[3]=0,e.setUseBackgroundImage(!0),t.subscription=t.viewStream.onImageReady(t=>e.setBackgroundImage(t.image)),t.viewStream.setSize(t.size[0],t.size[1]),t.viewStream.invalidateCache(),t.viewStream.render(),e.modified()),!0),e.getUniquePropID=()=>t.nextPropID++,e.getPropFromID=e=>{for(let r=0;r{const e=t.device,r=t.renderPasses[0].getOpaquePass().getColorTexture(),n={width:r.getWidth(),height:r.getHeight()};n.colorBufferWidth=32*Math.floor((n.width+31)/32),n.colorBufferSizeInBytes=n.colorBufferWidth*n.height*8;const o=lf.newInstance();o.setDevice(e),o.create(n.colorBufferSizeInBytes,GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST);const i=t.device.createCommandEncoder();i.copyTextureToBuffer({texture:r.getHandle()},{buffer:o.getHandle(),bytesPerRow:8*n.colorBufferWidth,rowsPerImage:n.height},{width:n.width,height:n.height,depthOrArrayLayers:1}),e.submitCommandEncoder(i);const a=o.mapAsync(GPUMapMode.READ);await a,n.colorValues=new Uint16Array(o.getMappedRange().slice()),o.unmap();const s=new Uint8ClampedArray(n.height*n.width*4);for(let e=0;e{const t=zy.newInstance();return t.setWebGPURenderWindow(e),t};const n=e.setSize;e.setSize=(t,r)=>{const o=n(t,r);return o&&e.invokeWindowResizeEvent({width:t,height:r}),o},e.delete=zt.chain(e.delete,e.setViewStream)}(e,t)},"vtkWebGPURenderWindow");Zh("WebGPU",Ky),vp("vtkRenderWindow",Ky);const Xy=km(),$y={margin:"0",padding:"0",position:"absolute",top:"0",left:"0",width:"100%",height:"100%",overflow:"hidden"},qy={position:"absolute",left:"25px",top:"25px",backgroundColor:"white",borderRadius:"5px",listStyle:"none",padding:"5px 10px",margin:"0",display:"block",border:"solid 1px black",maxWidth:"calc(100% - 70px)",maxHeight:"calc(100% - 60px)",overflow:"auto"};function Yy(e,t){Object.keys(t).forEach(r=>{e.style[r]=t[r]})}const Jy={background:[.32,.34,.43],containerStyle:null,controlPanelStyle:null,listenWindowResize:!0,resizeCallback:null,controllerVisibility:!0};function Qy(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Jy,r),zt.obj(e,t),zt.get(e,t,["renderWindow","renderer","apiSpecificRenderWindow","interactor","rootContainer","container","controlContainer"]),function(e,t){t.classHierarchy.push("vtkFullScreenRenderWindow");const r=document.querySelector("body");function n(t){"c"===String.fromCharCode(t.charCode)&&e.toggleControllerVisibility()}t.rootContainer||(t.rootContainer=r),t.container||(t.container=document.createElement("div"),Yy(t.container,t.containerStyle||$y),t.rootContainer.appendChild(t.container)),t.rootContainer===r&&(document.documentElement.style.height="100%",r.style.height="100%",r.style.padding="0",r.style.margin="0"),t.renderWindow=nm.newInstance(),t.renderer=Jh.newInstance(),t.renderWindow.addRenderer(t.renderer),t.apiSpecificRenderWindow=t.renderWindow.newAPISpecificView(Xy.viewAPI??t.defaultViewAPI),t.apiSpecificRenderWindow.setContainer(t.container),t.renderWindow.addView(t.apiSpecificRenderWindow),t.interactor=xm.newInstance(),t.interactor.setInteractorStyle(Fm.newInstance()),t.interactor.setView(t.apiSpecificRenderWindow),t.interactor.initialize(),t.interactor.bindEvents(t.container),e.setBackground=t.renderer.setBackground,e.removeController=()=>{const e=t.controlContainer;e&&e.parentNode.removeChild(e)},e.setControllerVisibility=e=>{t.controllerVisibility=e,t.controlContainer&&(t.controlContainer.style.display=e?"block":"none")},e.toggleControllerVisibility=()=>{e.setControllerVisibility(!t.controllerVisibility)},e.addController=r=>{t.controlContainer=document.createElement("div"),Yy(t.controlContainer,t.controlPanelStyle||qy),t.rootContainer.appendChild(t.controlContainer),t.controlContainer.innerHTML=r,e.setControllerVisibility(t.controllerVisibility),t.rootContainer.addEventListener("keypress",n)},e.setBackground(...t.background),e.addRepresentation=e=>{e.getActors().forEach(e=>{t.renderer.addActor(e)})},e.removeRepresentation=e=>{e.getActors().forEach(e=>t.renderer.removeActor(e))},e.delete=zt.chain(e.setContainer,t.apiSpecificRenderWindow.delete,()=>{t.rootContainer?.removeEventListener("keypress",n),window.removeEventListener("resize",e.resize)},e.delete),e.resize=()=>{const e=t.container.getBoundingClientRect(),r=window.devicePixelRatio||1;t.apiSpecificRenderWindow.setSize(Math.floor(e.width*r),Math.floor(e.height*r)),t.resizeCallback&&t.resizeCallback(e),t.renderWindow.render()},e.setResizeCallback=r=>{t.resizeCallback=r,e.resize()},t.listenWindowResize&&window.addEventListener("resize",e.resize),e.resize()}(e,t)}var Zy={newInstance:zt.newInstance(Qy),extend:Qy};const ev=e=>e,tv=1e-6;class rv{constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.matrix=h(new Float64Array(16)),this.tmp=new Float64Array(3),this.angleConv=e?l:ev}rotateFromDirections(e,t){const r=new Float64Array(3),n=new Float64Array(3),o=new Float64Array(16);mr(r,e[0],e[1],e[2]),mr(n,t[0],t[1],t[2]),br(r,r),br(n,n);const i=xr(r,n);return i>=1||(_r(this.tmp,r,n),pr(this.tmp)1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;if($o(io,this.matrix))return this;const n=-1===r?e.length:t+3*r;for(let r=t;r2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,sv,r),zt.obj(e,t),zt.setGet(e,t,["xLength","yLength","zLength","generate3DTextureCoordinates","generateFaces","generateLines"]),zt.setGetArray(e,t,["center","rotations"],3),zt.setGetArray(e,t,["matrix"],16),t._polys=Xl.newInstance({values:Uint16Array.from(av)}),t._lineCells=Xl.newInstance({values:Uint16Array.from(iv)}),zt.moveToProtected(e,t,["polys","lineCells"]),zt.algo(e,t,0,1),function(e,t){t.classHierarchy.push("vtkCubeSource"),e.requestData=(e,r)=>{const n=r[0]?.initialize()||mc.newInstance();r[0]=n;const o=zt.newTypedArray(t.pointType,72);n.getPoints().setData(o,3);const i=zt.newTypedArray(t.pointType,72),a=_s.newInstance({name:"Normals",values:i,numberOfComponents:3});n.getPointData().setNormals(a);let s=2;!0===t.generate3DTextureCoordinates&&(s=3);const l=zt.newTypedArray(t.pointType,24*s),u=_s.newInstance({name:"TextureCoordinates",values:l,numberOfComponents:s});n.getPointData().setTCoords(u);const c=[0,0,0],d=[0,0,0],p=[0,0];let f=0;c[0]=-t.xLength/2,d[0]=-1,d[1]=0,d[2]=0;for(let e=0;e<2;e++){c[1]=-t.yLength/2;for(let r=0;r<2;r++){p[1]=c[1]+.5,c[2]=-t.zLength/2;for(let n=0;n<2;n++)p[0]=(c[2]+.5)*(1-2*e),o[3*f]=c[0],o[3*f+1]=c[1],o[3*f+2]=c[2],i[3*f]=d[0],i[3*f+1]=d[1],i[3*f+2]=d[2],2===s?(l[f*s]=p[0],l[f*s+1]=p[1]):(l[f*s]=2*e-1,l[f*s+1]=2*r-1,l[f*s+2]=2*n-1),f++,c[2]+=t.zLength;c[1]+=t.yLength}c[0]+=t.xLength,d[0]+=2}c[1]=-t.yLength/2,d[1]=-1,d[0]=0,d[2]=0;for(let e=0;e<2;e++){c[0]=-t.xLength/2;for(let r=0;r<2;r++){p[0]=(c[0]+.5)*(2*e-1),c[2]=-t.zLength/2;for(let n=0;n<2;n++)p[1]=-1*(c[2]+.5),o[3*f]=c[0],o[3*f+1]=c[1],o[3*f+2]=c[2],i[3*f]=d[0],i[3*f+1]=d[1],i[3*f+2]=d[2],2===s?(l[f*s]=p[0],l[f*s+1]=p[1]):(l[f*s]=2*r-1,l[f*s+1]=2*e-1,l[f*s+2]=2*n-1),f++,c[2]+=t.zLength;c[0]+=t.xLength}c[1]+=t.yLength,d[1]+=2}c[2]=-t.zLength/2,d[2]=-1,d[0]=0,d[1]=0;for(let e=0;e<2;e++){c[1]=-t.yLength/2;for(let r=0;r<2;r++){p[1]=c[1]+.5,c[0]=-t.xLength/2;for(let n=0;n<2;n++)p[0]=(c[0]+.5)*(2*e-1),o[3*f]=c[0],o[3*f+1]=c[1],o[3*f+2]=c[2],i[3*f]=d[0],i[3*f+1]=d[1],i[3*f+2]=d[2],2===s?(l[f*s]=p[0],l[f*s+1]=p[1]):(l[f*s]=2*n-1,l[f*s+1]=2*r-1,l[f*s+2]=2*e-1),f++,c[0]+=t.xLength;c[1]+=t.yLength}c[2]+=t.zLength,d[2]+=2}if(t.rotations&&nv().rotateX(t.rotations[0]).rotateY(t.rotations[1]).rotateZ(t.rotations[2]).apply(o).apply(i),t.center&&ov().translate(...t.center).apply(o),t.matrix){ov().setMatrix(t.matrix).apply(o);const e=[t.matrix[0],t.matrix[1],t.matrix[2],0,t.matrix[4],t.matrix[5],t.matrix[6],0,t.matrix[8],t.matrix[9],t.matrix[10],0,0,0,0,1];ov().setMatrix(e).apply(i)}t.generateFaces?n.getPolys().deepCopy(t._polys):n.getPolys().initialize(),t.generateLines?(n.getLines().deepCopy(t._lineCells),n.getPointData().setNormals(null)):n.getLines().initialize(),n.modified()},e.setBounds=function(){let t=[];if(Array.isArray(arguments.length<=0?void 0:arguments[0]))t=arguments.length<=0?void 0:arguments[0];else for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:[0,0,0,0];const[r,n,o,i]=t,a=e.getContext("2d").getImageData(r,n,o||e.width,i||e.height),s=qs.newInstance({type:"vtkImageData"});s.setOrigin(0,0,0),s.setSpacing(1,1,1),s.setExtent(0,(o||e.width)-1,0,(i||e.height)-1,0,0);const l=_s.newInstance({numberOfComponents:4,values:new Uint8Array(a.data.buffer)});return l.setName("scalars"),s.getPointData().setScalars(l),s}var dv={canvasToImageData:cv,imageToImageData:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{flipX:!1,flipY:!1,rotate:0};const r=document.createElement("canvas");r.width=e.width,r.height=e.height;const n=r.getContext("2d"),{flipX:o,flipY:i,rotate:a}=t;return n.translate(r.width/2,r.height/2),n.scale(o?-1:1,i?-1:1),n.rotate(a*Math.PI/180),n.drawImage(e,-e.width/2,-e.height/2),cv(r)}};const pv={default:{defaultStyle:{fontStyle:"bold",fontFamily:"Arial",fontColor:"black",fontSizeScale:e=>e/2,faceColor:"white",edgeThickness:.1,edgeColor:"black",resolution:400},xMinusFaceProperty:{text:"X-",faceColor:"yellow"},xPlusFaceProperty:{text:"X+",faceColor:"yellow"},yMinusFaceProperty:{text:"Y-",faceColor:"red"},yPlusFaceProperty:{text:"Y+",faceColor:"red"},zMinusFaceProperty:{text:"Z-",faceColor:"#008000"},zPlusFaceProperty:{text:"Z+",faceColor:"#008000"}},lps:{xMinusFaceProperty:{text:"R",faceRotation:-90},xPlusFaceProperty:{text:"L",faceRotation:90},yMinusFaceProperty:{text:"A",faceRotation:0},yPlusFaceProperty:{text:"P",faceRotation:180},zMinusFaceProperty:{text:"I",faceRotation:180},zPlusFaceProperty:{text:"S",faceRotation:0}}};function fv(e,t){t.set(e)}var hv={applyDefinitions:fv,applyPreset:function(e,t){return fv(pv[e],t)},registerStylePreset:function(e,t){pv[e]=t}};const mv={xPlus:0,xMinus:1,yPlus:2,yMinus:3,zPlus:4,zMinus:5},gv={defaultStyle:{text:"",faceColor:"white",faceRotation:0,fontFamily:"Arial",fontColor:"black",fontStyle:"normal",fontSizeScale:e=>e/1.8,edgeThickness:.1,edgeColor:"black",resolution:200}};function yv(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,gv,r),ss.extend(e,t,r),zt.get(e,t,["defaultStyle","xPlusFaceProperty","xMinusFaceProperty","yPlusFaceProperty","yMinusFaceProperty","zPlusFaceProperty","zMinusFaceProperty"]),function(e,t){t.classHierarchy.push("vtkAnnotatedCubeActor"),t.xPlusFaceProperty={...t.xPlusFaceProperty},t.xMinusFaceProperty={...t.xMinusFaceProperty},t.yPlusFaceProperty={...t.yPlusFaceProperty},t.yMinusFaceProperty={...t.yMinusFaceProperty},t.zPlusFaceProperty={...t.zPlusFaceProperty},t.zMinusFaceProperty={...t.zMinusFaceProperty};let r=null;const n=document.createElement("canvas"),o=Gl.newInstance(),i=vc.newInstance();function a(r){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;o&&Object.assign(t[`${r}FaceProperty`],o);const a={...t.defaultStyle,...t[`${r}FaceProperty`]};n.width=a.resolution,n.height=a.resolution;const s=n.getContext("2d");s.fillStyle=a.faceColor,s.fillRect(0,0,n.width,n.height),a.edgeThickness>0&&(s.strokeStyle=a.edgeColor,s.lineWidth=a.edgeThickness*n.width,s.strokeRect(0,0,n.width,n.height)),s.save(),s.translate(0,n.height),s.scale(1,-1),s.translate(n.width/2,n.height/2),s.rotate(-Math.PI*(a.faceRotation/180));const l=a.fontSizeScale(a.resolution);s.fillStyle=a.fontColor,s.textAlign="center",s.textBaseline="middle",s.font=`${a.fontStyle} ${l}px "${a.fontFamily}"`,s.fillText(a.text,0,0),s.restore();const u=dv.canvasToImageData(n);i.setInputData(u,mv[r]),e.modified()}function s(){r=uv.newInstance({generate3DTextureCoordinates:!0}),o.setInputConnection(r.getOutputPort()),a("xPlus"),a("xMinus"),a("yPlus"),a("yMinus"),a("zPlus"),a("zMinus")}i.setInterpolate(!0),e.setDefaultStyle=e=>{t.defaultStyle={...t.defaultStyle,...e},s()},e.setXPlusFaceProperty=e=>a("xPlus",e),e.setXMinusFaceProperty=e=>a("xMinus",e),e.setYPlusFaceProperty=e=>a("yPlus",e),e.setYMinusFaceProperty=e=>a("yMinus",e),e.setZPlusFaceProperty=e=>a("zPlus",e),e.setZMinusFaceProperty=e=>a("zMinus",e),s(),o.setInputConnection(r.getOutputPort()),e.setMapper(o),e.addTexture(i)}(e,t)}var vv={newInstance:zt.newInstance(yv,"vtkAnnotatedCubeActor"),extend:yv,Presets:hv},bv={Corners:{TOP_LEFT:"TOP_LEFT",TOP_RIGHT:"TOP_RIGHT",BOTTOM_LEFT:"BOTTOM_LEFT",BOTTOM_RIGHT:"BOTTOM_RIGHT"}};const{vtkErrorMacro:xv}=zt,{Corners:_v}=bv,Sv={viewportCorner:bv.Corners.BOTTOM_LEFT,viewportSize:.2,minPixelSize:50,maxPixelSize:200,parentRenderer:null,interactiveRenderer:!1};function Cv(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Sv,r),zt.obj(e,t),zt.get(e,t,["enabled","viewportCorner","viewportSize","interactiveRenderer"]),zt.setGet(e,t,["_interactor","minPixelSize","maxPixelSize","parentRenderer"]),zt.get(e,t,["actor"]),zt.moveToProtected(e,t,["interactor"]),function(e,t){t.classHierarchy.push("vtkOrientationMarkerWidget");const r={...e},n=[],o=Jh.newInstance(),i=new ResizeObserver(t=>{e.updateViewport()});let a=null,s=null,l=null,u=null,c=null;function d(){t._interactor.isAnimating()||e.updateMarkerOrientation()}t._onParentRendererChanged=()=>e.updateViewport(),e.computeViewport=()=>{const e=t.parentRenderer||t._interactor.getCurrentRenderer(),[r,n,o,i]=e.getViewport(),a=t._interactor.getView(),s=a.getSize(),[l,u]=a.getViewportSize(e),c=Math.min(l,u);let d=t.viewportSize*c;d=Math.max(Math.min(t.minPixelSize,c),Math.min(t.maxPixelSize,d));const p=d/s[0],f=d/s[1];switch(t.viewportCorner){case _v.TOP_LEFT:return[r,i-f,r+p,i];case _v.TOP_RIGHT:return[o-p,i-f,o,i];case _v.BOTTOM_LEFT:return[r,n,r+p,n+f];case _v.BOTTOM_RIGHT:return[o-p,n,o,n+f];default:return xv("Invalid widget corner"),null}},e.updateViewport=()=>{t.enabled&&(o.setViewport(...e.computeViewport()),t._interactor.render())},e.updateMarkerOrientation=()=>{const e=(t.parentRenderer||t._interactor.getCurrentRenderer()).getActiveCamera();if(!e)return;const r=e.getReferenceByName("position"),i=e.getReferenceByName("focalPoint"),a=e.getReferenceByName("viewUp");if(n[0]!==r[0]||n[1]!==r[1]||n[2]!==r[2]||n[3]!==i[0]||n[4]!==i[1]||n[5]!==i[2]||n[6]!==a[0]||n[7]!==a[1]||n[8]!==a[2]){n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=i[0],n[4]=i[1],n[5]=i[2],n[6]=a[0],n[7]=a[1],n[8]=a[2];const e=o.getActiveCamera();e.setPosition(r[0],r[1],r[2]),e.setFocalPoint(i[0],i[1],i[2]),e.setViewUp(a[0],a[1],a[2]),o.resetCamera()}},e.setEnabled=r=>{if(r){if(t.enabled)return;if(!t.actor)return void xv("Must set actor before enabling orientation marker.");if(!t._interactor)return void xv("Must set interactor before enabling orientation marker.");const r=t.parentRenderer||t._interactor.getCurrentRenderer(),n=r.getRenderWindow();n.addRenderer(o),n.getNumberOfLayers()<2&&n.setNumberOfLayers(2),o.setLayer(n.getNumberOfLayers()-1),o.setInteractive(t.interactiveRenderer),o.addViewProp(t.actor),t.actor.setVisibility(!0),a=r.onEvent(e=>{"ActiveCameraEvent"===e.type&&(s&&s.unsubscribe(),s=e.camera.onModified(d))}),s=r.getActiveCamera().onModified(d),l=t._interactor.onAnimation(e.updateMarkerOrientation),u=t._interactor.onEndAnimation(e.updateMarkerOrientation),i.observe(t._interactor.getView().getCanvas()),e.updateViewport(),e.updateMarkerOrientation(),t.enabled=!0}else{if(!t.enabled)return;t.enabled=!1,i.disconnect(),a.unsubscribe(),a=null,s.unsubscribe(),s=null,l.unsubscribe(),l=null,u.unsubscribe(),u=null,t.actor.setVisibility(!1),o.removeViewProp(t.actor);const e=t._interactor?.findPokedRenderer()?.getRenderWindow();e&&e.removeRenderer(o)}e.modified()},e.setViewportCorner=r=>{r!==t.viewportCorner&&(t.viewportCorner=r,e.updateViewport())},e.setViewportSize=r=>{const n=Math.min(1,Math.max(0,r));n!==t.viewportSize&&(t.viewportSize=n,e.updateViewport())},e.setActor=r=>{const n=t.enabled;e.setEnabled(!1),t.actor=r,e.setEnabled(n)},e.getRenderer=()=>o,e.delete=()=>{r.delete(),c&&(c.unsubscribe(),c=null),a&&(a.unsubscribe(),a=null),s&&(s.unsubscribe(),s=null),l&&(l.unsubscribe(),l=null),u&&(u.unsubscribe(),u=null),i.disconnect()},c=e.onModified(e.updateViewport)}(e,t)}var Tv={newInstance:zt.newInstance(Cv,"vtkOrientationMarkerWidget"),extend:Cv,...bv};function wv(e){return new TextDecoder("latin1").decode(e)}var Av={arrayBufferToString:wv,extractBinary:function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const n=wv(e),o=t.exec(n);if(!o)return{text:n};const i=o.index+o[0].length,a=n.substring(0,i);let s=null;const l=r?r.exec(n):null;return s=l?{text:a+n.substr(l.index),binaryBuffer:e.slice(i,l.index)}:{text:a,binaryBuffer:e.slice(i)},s}};const Ev={};function Dv(e){return!!Ev[e]}function Pv(e,t){Ev[e]=t}var Iv=function(){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Ev[arguments.length>0&&void 0!==arguments[0]?arguments[0]:"http"](e)};function Ov(){const e=new ArrayBuffer(4),t=new Uint8Array(e),r=new Uint32Array(e);return t[0]=161,t[1]=178,t[2]=195,t[3]=212,3569595041===r[0]?"LittleEndian":2712847316===r[0]?"BigEndian":null}var Nv=Ov(),Mv=function(e,t){if(t<2)return;const r=new Int8Array(e),n=r.length,o=[];for(let e=0;e(Rv("LiteHttpDataAccessHelper does not support compression. Need to register HttpDataAccessHelper instead."),Promise.reject(new Error("LiteHttpDataAccessHelper does not support compression. Need to register HttpDataAccessHelper instead.")));let Lv=0;function kv(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=new XMLHttpRequest;return n.open(e,t,!0),r.headers&&Object.entries(r.headers).forEach(e=>{let[t,r]=e;return n.setRequestHeader(t,r)}),r.progressCallback&&n.addEventListener("progress",r.progressCallback),n}const Uv={fetchArray:function(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return n&&n.compression?Bv():r.ref&&!r.ref.pending?new Promise((o,i)=>{const a=kv("GET",[t,r.ref.basepath,r.ref.id].join("/"),n);a.onreadystatechange=t=>{1===a.readyState&&(r.ref.pending=!0,1===++Lv&&e?.invokeBusy&&e.invokeBusy(!0)),4===a.readyState&&(r.ref.pending=!1,200===a.status||0===a.status?(r.buffer=a.response,"JSON"===r.ref.encode?r.values=JSON.parse(r.buffer):(Nv!==r.ref.encode&&Nv&&(Fv(`Swap bytes of ${r.name}`),Mv(r.buffer,ls[r.dataType])),r.values=zt.newTypedArray(r.dataType,r.buffer)),r.values.length!==r.size&&Rv(`Error in FetchArray: ${r.name}, does not have the proper array size. Got ${r.values.length}, instead of ${r.size}`),delete r.ref,0===--Lv&&e?.invokeBusy&&e.invokeBusy(!1),e?.modified&&e.modified(),o(r)):i({xhr:a,e:t}))},a.responseType="string"!==r.dataType?"arraybuffer":"text",a.send()}):Promise.resolve(r)},fetchJSON:function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r&&r.compression?Bv():new Promise((n,o)=>{const i=kv("GET",t,r);i.onreadystatechange=t=>{1===i.readyState&&1===++Lv&&e?.invokeBusy&&e.invokeBusy(!0),4===i.readyState&&(0===--Lv&&e?.invokeBusy&&e.invokeBusy(!1),200===i.status||0===i.status?n(JSON.parse(i.responseText)):o({xhr:i,e:t}))},i.responseType="text",i.send()})},fetchText:function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r&&r.compression?Bv():new Promise((n,o)=>{const i=kv("GET",t,r);i.onreadystatechange=t=>{1===i.readyState&&1===++Lv&&e?.invokeBusy&&e.invokeBusy(!0),4===i.readyState&&(0===--Lv&&e?.invokeBusy&&e.invokeBusy(!1),200===i.status||0===i.status?n(i.responseText):o({xhr:i,e:t}))},i.responseType="text",i.send()})},fetchBinary:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((r,n)=>{const o=kv("GET",e,t);o.onreadystatechange=e=>{4===o.readyState&&(200===o.status||0===o.status?r(o.response):n({xhr:o,e}))},o.responseType="arraybuffer",o.send()})},fetchImage:function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise((e,n)=>{const o=new Image;r.crossOrigin&&(o.crossOrigin=r.crossOrigin),o.onload=()=>e(o),o.onerror=n,o.src=t})}};Dv("http")||Pv("http",e=>Uv);const{vtkErrorMacro:Vv}=zt;function Gv(e,t){for(let r=0;re).slice(-3).map(Number);for(Gv(u,o);-1!==e[t+s].indexOf("vertex");){const n=e[t+s].split(/[ \t]+/).filter(e=>e).slice(-3).map(Number);Gv(n,r),a++,s++}n.push(a);for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,jv,r),zt.obj(e,t),zt.get(e,t,["url","baseURL"]),zt.setGet(e,t,["dataAccessHelper","removeDuplicateVertices"]),zt.algo(e,t,0,1),function(e,t){function r(e){const r=t.output[0],n=r.getPoints().getData(),o=r.getPolys().getData();if(!n||!o)return void console.warn("No valid polydata.");const i=new Map,a=new Map;let s=0,l=!1;for(let t=0;t+t*10**-e);t[a]=s[0],t[a+1]=s[1],t[a+2]=s[2]}const s=new Int32Array(o.length);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:{binary:!0};t.url=r;const o=r.split("/");return o.pop(),t.baseURL=o.join("/"),e.loadData(n)},e.loadData=function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=function(r){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const o=void 0!==n.compression?n.compression:t.compression,i=void 0!==n.progressCallback?n.progressCallback:t.progressCallback;return n.binary?t.dataAccessHelper.fetchBinary(r,{compression:o,progressCallback:i}):t.dataAccessHelper.fetchText(e,r,{compression:o,progressCallback:i})}(t.url,r);return n.then(e.parse),n},e.parse=t=>{"string"==typeof t?e.parseAsText(t):e.parseAsArrayBuffer(t)},e.parseAsArrayBuffer=n=>{if(!n)return;if(n===t.parseData)return;e.modified(),t.parseData=n;let o=!1;if(o=84+50*new DataView(n,0,84).getUint32(80,!0)===n.byteLength,!o)return void e.parseAsText(Av.arrayBufferToString(n));const i=n.slice(0,80),a=function(e){const t=e.split(" ").filter(e=>e.indexOf("=")>-1),r={};for(let e=0;e=0&&r(t.removeDuplicateVertices)},e.parseAsText=n=>{if(!n)return;if(n===t.parseData)return;e.modified(),t.parseData=n;const o=n.split("\n");let i=1;const a=[],s=[],l=[];for(;-1!==i;)i=zv(o,i,a,s,l);const u=mc.newInstance();u.getPoints().setData(Float32Array.from(a),3),u.getPolys().setData(Uint32Array.from(s)),u.getCellData().setNormals(_s.newInstance({name:"Normals",values:Float32Array.from(l),numberOfComponents:3})),t.output[0]=u,t.removeDuplicateVertices>=0&&r(t.removeDuplicateVertices)},e.requestData=(r,n)=>{e.parse(t.parseData)}}(e,t),t.compression||(t.compression=null),t.progressCallback||(t.progressCallback=null)}var Hv={extend:Wv,newInstance:zt.newInstance(Wv,"vtkSTLReader")};const Kv="ascii",Xv={diffuse_red:"red",diffuse_green:"green",diffuse_blue:"blue"},$v={patternHeader:/ply([\s\S]*)end_header\r?\n/,patternBody:/end_header\s([\s\S]*)$/};function qv(e){let t="",r=0;const n=$v.patternHeader.exec(e);null!==n&&(t=n[1],r=n[0].length);const o={comments:[],elements:[],headerLength:r},i=t.split("\n");let a,s,l;for(let e=0;e"vertex"===e.name),i=t.find(e=>"face"===e.name);let a=0,s=0;o&&(a=o.count),i&&(s=i.count);let l=new Float32Array(3*a),u=new Uint8Array(3*a),c=new Float32Array(2*a),d=new Float32Array(3*a);const p=e.colors.length>0,f=e.uvs.length>0,h=e.normals.length>0,m=e.faceVertexUvs.length>0,g=new Map;let y=a;for(let t=0;t0){let t=0,o=0;if(n){const n=[],i=[],f=[],m=[];for(let a=0;ar||Math.abs(b[1]-v[1])>r){const s=`${v[0]},${v[1]}`;let c=-1;if(g.has(s)){const e=g.get(s);for(let t=0,n=e.length;t0){const e=a+n.length/3,t=new Float32Array(3*e),r=new Float32Array(2*e),o=p?new Uint8Array(3*e):null,s=h?new Float32Array(3*e):null;t.set(l),r.set(c),p&&o&&o.set(u),h&&s&&s.set(d),t.set(n,3*a),r.set(m,2*a),p&&o&&o.set(i,3*a),h&&s&&s.set(f,3*a),l=t,c=r,p&&(u=o),h&&(d=s)}}else for(let r=0;r0)v.getPolys().setData(Uint32Array.from(e.indices));else{const e=new Uint32Array(2*a);for(let t=0;t0&&(e.indices.push(t.length),t.forEach((t,r)=>{e.indices.push(t)})),e.faceVertexUvs.push(n)}}function eb(e,t,r,n){let o;switch(r){case"int8":case"char":o=[e.getInt8(t),1];break;case"uint8":case"uchar":o=[e.getUint8(t),1];break;case"int16":case"short":o=[e.getInt16(t,n),2];break;case"uint16":case"ushort":o=[e.getUint16(t,n),2];break;case"int32":case"int":o=[e.getInt32(t,n),4];break;case"uint32":case"uint":o=[e.getUint32(t,n),4];break;case"float32":case"float":o=[e.getFloat32(t,n),4];break;case"float64":case"double":o=[e.getFloat64(t,n),8];break;default:console.log("Unsupported type")}return o}function tb(e,t,r,n){const o={};let i,a=0;for(let s=0;s2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,rb,r),zt.obj(e,t),zt.get(e,t,["url","baseURL","duplicatePointsForFaceTexture","faceTextureTolerance"]),zt.setGet(e,t,["dataAccessHelper"]),zt.algo(e,t,0,1),function(e,t){t.classHierarchy.push("vtkPLYReader"),t.dataAccessHelper||(t.dataAccessHelper=Iv("http")),e.setUrl=function(r){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{binary:!0};t.url=r;const o=r.split("/");return o.pop(),t.baseURL=o.join("/"),t.compression=n.compression,e.loadData({progressCallback:n.progressCallback,binary:!!n.binary})},e.loadData=function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=function(r){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{compression:o,progressCallback:i}=t;return n.binary?t.dataAccessHelper.fetchBinary(r,{compression:o,progressCallback:i}):t.dataAccessHelper.fetchText(e,r,{compression:o,progressCallback:i})}(t.url,r);return n.then(e.parse),n},e.parse=t=>{"string"==typeof t?e.parseAsText(t):e.parseAsArrayBuffer(t)},e.parseAsArrayBuffer=r=>{if(!r)return;if(r===t.parseData)return;e.modified();let n=r;r instanceof ArrayBuffer&&(n=Av.arrayBufferToString(r));const o=qv(n);if(o.format===Kv)return void e.parseAsText(n);t.parseData=r;const i={indices:[],vertices:[],normals:[],uvs:[],faceVertexUvs:[],colors:[]},a="binary_little_endian"===o.format,s=r instanceof ArrayBuffer?r:r.buffer,l=new DataView(s,o.headerLength);let u,c=0;for(let e=0;e{if(!r)return;if(r===t.parseData)return;e.modified(),t.parseData=r;let n=r;r instanceof ArrayBuffer&&(n=Av.arrayBufferToString(r));const o=qv(n);if(o.format!==Kv)return void e.parseAsArrayBuffer(r);const i={indices:[],vertices:[],normals:[],uvs:[],faceVertexUvs:[],colors:[]},a=$v.patternBody.exec(n);let s="";null!==a&&(s=a[1]);const l=s.split("\n");let u=0,c=0;for(let e=0;e=o.elements[u].count&&(u++,c=0);const e=Qv(o.elements[u].properties,t);Zv(i,o.elements[u].name,e),c++}}const d=Yv(i,o.elements,t.faceTextureTolerance,t.duplicatePointsForFaceTexture);t.output[0]=d},e.requestData=(r,n)=>{e.parse(t.parseData)}}(e,t),t.compression||(t.compression=null),t.progressCallback||(t.progressCallback=null)}var ob={extend:nb,newInstance:zt.newInstance(nb,"vtkPLYReader")};const ib={};function ab(e,t,r,n,o){for(let i=0;iNumber(e));let r=t[0]-1;r=r<0?r+1+ib.v.length/3:r;let n=t[1]?t[1]-1:r;n=n<0?n+1+ib.vt.length/2:n;let o=t[2]?t[2]-1:r;return o=o<0?o+1+ib.vn.length/3:o,[r,n,o]}function lb(e){if("#"===e[0])return;const t=e.split(/[ \t]+/);if(t[0]===ib.splitOn)t.shift(),ib.pieces.push(t.join(" ").trim()),ib.f.push([]),ib.size++;else if("v"===t[0])ib.v.push(Number(t[1])),ib.v.push(Number(t[2])),ib.v.push(Number(t[3]));else if("vt"===t[0])ib.vt.push(Number(t[1])),ib.vt.push(Number(t[2]));else if("vn"===t[0])ib.vn.push(Number(t[1])),ib.vn.push(Number(t[2])),ib.vn.push(Number(t[3]));else if("f"===t[0]){0===ib.size&&ib.size++;const e=ib.f[ib.size-1];t.shift();const r=t.filter(e=>e.length>0&&"\r"!==e),n=r.length;e.push(n);for(let t=0;t2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,cb,r),zt.obj(e,t),zt.get(e,t,["url","baseURL"]),zt.setGet(e,t,["dataAccessHelper","splitMode","trackDuplicates"]),zt.algo(e,t,0,1),zt.event(e,t,"busy"),function(e,t){t.classHierarchy.push("vtkOBJReader"),t.dataAccessHelper||(t.dataAccessHelper=Iv("http")),e.setUrl=function(r){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(-1!==r.indexOf(".obj")||n.fullpath){t.url=r;const e=r.split("/");e.pop(),t.baseURL=e.join("/")}else t.baseURL=r,t.url=`${r}/index.obj`;return e.loadData(n)},e.loadData=function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.dataAccessHelper.fetchText(e,r,n)}(t.url,r).then(t=>!e.isDeleted()&&e.parseAsText(t))},e.parseAsText=r=>{return!r||(r!==t.parseData&&e.modified(),t.parseData=r,t.numberOfOutputs=0,n=t.splitMode,ib.splitOn=n,ib.pieces=[],ib.v=[],ib.vt=[],ib.vn=[],ib.f=[[]],ib.size=0,r.split("\n").forEach(lb),function(e){const t=!!ib.vt.length,r=!!ib.vn.length;if(e.splitMode){e.numberOfOutputs=ib.size;for(let n=0;n1?a+r:t;for(let o=1;o{e.parseAsText(t.parseData)},e.isBusy=()=>!!t.requestCount,e.getNumberOfOutputPorts=()=>t.numberOfOutputs}(e,t)}var pb={newInstance:zt.newInstance(db,"vtkOBJReader"),extend:db,...ub},fb=r(570),hb=Uint8Array,mb=Uint16Array,gb=Uint32Array,yb=new hb([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),vb=new hb([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),bb=new hb([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),xb=function(e,t){for(var r=new mb(31),n=0;n<31;++n)r[n]=t+=1<>>1|(21845&Eb)<<1;Db=(61680&(Db=(52428&Db)>>>2|(13107&Db)<<2))>>>4|(3855&Db)<<4,Ab[Eb]=((65280&Db)>>>8|(255&Db)<<8)>>>1}var Pb=function(e,t,r){for(var n=e.length,o=0,i=new mb(t);o>>l]=u}else for(a=new mb(n),o=0;o>>15-e[o]);return a},Ib=new hb(288);for(Eb=0;Eb<144;++Eb)Ib[Eb]=8;for(Eb=144;Eb<256;++Eb)Ib[Eb]=9;for(Eb=256;Eb<280;++Eb)Ib[Eb]=7;for(Eb=280;Eb<288;++Eb)Ib[Eb]=8;var Ob=new hb(32);for(Eb=0;Eb<32;++Eb)Ob[Eb]=5;var Nb=Pb(Ib,9,1),Mb=Pb(Ob,5,1),Rb=function(e){for(var t=e[0],r=1;rt&&(t=e[r]);return t},Fb=function(e,t,r){var n=t/8|0;return(e[n]|e[n+1]<<8)>>(7&t)&r},Bb=function(e,t){var r=t/8|0;return(e[r]|e[r+1]<<8|e[r+2]<<16)>>(7&t)},Lb=function(e){return(e+7)/8|0},kb=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Ub=function(e,t,r){var n=new Error(t||kb[e]);if(n.code=e,Error.captureStackTrace&&Error.captureStackTrace(n,Ub),!r)throw n;return n},Vb=function(e,t,r){var n=e.length;if(!n||r&&r.f&&!r.l)return t||new hb(0);var o=!t||r,i=!r||r.i;r||(r={}),t||(t=new hb(3*n));var a=function(e){var r=t.length;if(e>r){var n=new hb(Math.max(2*r,e));n.set(t),t=n}},s=r.f||0,l=r.p||0,u=r.b||0,c=r.l,d=r.d,p=r.m,f=r.n,h=8*n;do{if(!c){s=Fb(e,l,1);var m=Fb(e,l+1,3);if(l+=3,!m){var g=e[(E=Lb(l)+4)-4]|e[E-3]<<8,y=E+g;if(y>n){i&&Ub(0);break}o&&a(u+g),t.set(e.subarray(E,y),u),r.b=u+=g,r.p=l=8*y,r.f=s;continue}if(1==m)c=Nb,d=Mb,p=9,f=5;else if(2==m){var v=Fb(e,l,31)+257,b=Fb(e,l+10,15)+4,x=v+Fb(e,l+5,31)+1;l+=14;for(var _=new hb(x),S=new hb(19),C=0;C>>4)<16)_[C++]=E;else{var P=0,I=0;for(16==E?(I=3+Fb(e,l,3),l+=2,P=_[C-1]):17==E?(I=3+Fb(e,l,7),l+=3):18==E&&(I=11+Fb(e,l,127),l+=7);I--;)_[C++]=P}}var O=_.subarray(0,v),N=_.subarray(v);p=Rb(O),f=Rb(N),c=Pb(O,p,1),d=Pb(N,f,1)}else Ub(1);if(l>h){i&&Ub(0);break}}o&&a(u+131072);for(var M=(1<>>4;if((l+=15&P)>h){i&&Ub(0);break}if(P||Ub(2),B<256)t[u++]=B;else{if(256==B){F=l,c=null;break}var L=B-254;if(B>264){var k=yb[C=B-257];L=Fb(e,l,(1<>>4;if(U||Ub(3),l+=15&U,N=wb[V],V>3&&(k=vb[V],N+=Bb(e,l)&(1<h){i&&Ub(0);break}o&&a(u+131072);for(var G=u+L;ue.length)&&(r=e.length);var n=new(2==e.BYTES_PER_ELEMENT?mb:4==e.BYTES_PER_ELEMENT?gb:hb)(r-t);return n.set(e.subarray(t,r)),n}(t,0,u)},Gb=new hb(0);function zb(e,t){return Vb(e.subarray(function(e){31==e[0]&&139==e[1]&&8==e[2]||Ub(6,"invalid gzip data");var t=e[3],r=10;4&t&&(r+=e[10]|2+(e[11]<<8));for(var n=(t>>3&1)+(t>>4&1);n>0;n-=!e[r++]);return r+(2&t)}(e),-8),t||new hb((n=(r=e).length,(r[n-4]|r[n-3]<<8|r[n-2]<<16|r[n-1]<<24)>>>0)));var r,n}function jb(e,t){return Vb(((8!=(15&(r=e)[0])||r[0]>>>4>7||(r[0]<<8|r[1])%31)&&Ub(6,"invalid zlib data"),32&r[1]&&Ub(6,"invalid zlib data: preset dictionaries not supported"),e.subarray(2,-4)),t);var r}var Wb="undefined"!=typeof TextDecoder&&new TextDecoder;try{Wb.decode(Gb,{stream:!0})}catch(e){}"function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout&&setTimeout;const Hb=[];Hb["-".charCodeAt(0)]=62,Hb["_".charCodeAt(0)]=63;const Kb="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(let e=0;e<64;e++)Hb[Kb.charCodeAt(e)]=e;function Xb(e){return void 0!==Hb[e.charCodeAt(0)]}function $b(e,t,r,n){const{start:o,count:i}=t,a=i%4,s=Math.floor(i/4);let l=o,u=null,c=r;for(let t=0;t>16&255,n[c++]=u>>8&255,n[c++]=255&u}switch(a){case 3:for(;!Xb(e[l]);)l++;for(u=Hb[e.charCodeAt(l++)]<<10;!Xb(e[l]);)l++;for(u|=Hb[e.charCodeAt(l++)]<<4;!Xb(e[l]);)l++;u|=Hb[e.charCodeAt(l++)]>>2,n[c++]=u>>8&255,n[c++]=255&u;break;case 2:for(;!Xb(e[l]);)l++;for(u=Hb[e.charCodeAt(l++)]<<2;!Xb(e[l]);)l++;u|=Hb[e.charCodeAt(l++)]>>4,n[c++]=255&u;break;case 1:throw new Error("BASE64: remain 1 should not happen")}return c}var qb=function(e){const t=function(e){const t=e.length,r=[];let n=null;for(let o=0;o2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,Yb,r),!t.empty&&!t.values&&!t.size)throw new TypeError("Cannot create vtkStringArray object without: size > 0, values");t.values?Array.isArray(t.values)&&(t.values=[...t.values]):t.values=[],t.values&&(t.size=t.values.length),zt.obj(e,t),zt.set(e,t,["name"]),function(e,t){t.classHierarchy.push("vtkStringArray"),e.getComponent=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.values[e*t.numberOfComponents+r]},e.setComponent=(r,n,o)=>{o!==t.values[r*t.numberOfComponents+n]&&(t.values[r*t.numberOfComponents+n]=o,e.modified())},e.getData=()=>t.values,e.getTuple=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const n=t.numberOfComponents||1;r.length&&(r.length=n);const o=e*n;for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:1)*t.numberOfComponents},e.getNumberOfComponents=()=>t.numberOfComponents,e.getNumberOfValues=()=>t.values.length,e.getNumberOfTuples=()=>t.values.length/t.numberOfComponents,e.getDataType=()=>t.dataType,e.newClone=()=>Qb({name:t.name,numberOfComponents:t.numberOfComponents,empty:!0}),e.getName=()=>(t.name||e.setName(`vtkStringArray${e.getMTime()}`),t.name),e.setData=(r,n)=>{t.values=r,t.size=r.length,n&&(t.numberOfComponents=n),t.size%t.numberOfComponents!==0&&(t.numberOfComponents=1),e.modified()}}(e,t)}const Qb=zt.newInstance(Jb,"vtkStringArray");var Zb={newInstance:Qb,extend:Jb};function ex(e,t){return function(e,t){return[...e.getElementsByTagName(t)]}(e,t)[0]}const tx={Int8:Int8Array,UInt8:Uint8Array,Int16:Int16Array,UInt16:Uint16Array,Int32:Int32Array,UInt32:Uint32Array,Int64:Int32Array,UInt64:Uint32Array,Float32:Float32Array,Float64:Float64Array},rx={Int8:1,UInt8:1,Int16:2,UInt16:2,Int32:4,UInt32:4,Int64:8,UInt64:8,Float32:4,Float64:8};function nx(e){const t=e.length-1;return e.filter((e,r)=>r>4>7||(e[0]<<8|e[1])%31?function(e,t){return Vb(e,t)}(e,t):jb(e,t)}(e);t.uint8.set(r,t.offset),t.offset+=r.length}function ax(e,t){const r=function(e,t){if("UInt64"===t){const t=8;let r=new Uint32Array(e.buffer,0,6);const n=r[0],o=[t,n,r[2],r[4]];r=new Uint32Array(e.buffer,24,2*n);for(let e=0;e0&&(a=0===i?n*o:(n-1)*o+i);const s=new ArrayBuffer(a),l={offset:0,uint8:new Uint8Array(s)};let u=function(e){const[t]=e;return(e.length-1)*t}(r);for(;u{e.trim().length&&(c[r++]=Number(e))})}else if("binary"===l){const e=new Uint8Array(qb(t.firstChild.nodeValue.trim()));if("vtkZLibDataCompressor"===r){const t=ax(e,o);c=new tx[a](t.buffer),/^U?Int64$/.test(a)&&(c=nx(c))}else c=new tx[a](e.buffer,rx[o]),-1!==a.indexOf("Int64")&&(c=nx(c))}else if("appended"===l){const e=Number(t.getAttribute("offset"));c=ox(new Uint8Array(i,e),a,o)}else console.error("Format not supported",l);return{name:s,values:c,numberOfComponents:u}}function lx(e){return(new TextDecoder).decode(e).split("\0").slice(0,-1)}function ux(e,t){t.classHierarchy.push("vtkXMLReader"),t.dataAccessHelper||(t.dataAccessHelper=Iv("http")),e.setUrl=function(r){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.url=r;const o=r.split("/");return o.pop(),t.baseURL=o.join("/"),e.loadData(n)},e.loadData=function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.dataAccessHelper.fetchBinary(e,r)}(t.url,r).then(e.parseAsArrayBuffer)},e.parseAsArrayBuffer=r=>{if(!r)return!1;if(r===t.rawDataBuffer)return!0;e.modified();const{text:n,binaryBuffer:o}=(i=r,Av.extractBinary(i,/^\s*\s*_/m,/\n\s*<\/AppendedData>/m));var i,a;t.rawDataBuffer=r,t.binaryBuffer=o;const s=(a=n,(0,fb.create)(a)).root(),l=s.node,u=l.getAttribute("type"),c=l.getAttribute("compressor"),d=l.getAttribute("byte_order"),p=l.getAttribute("header_type")||"UInt32";if(c&&"vtkZLibDataCompressor"!==c)return console.error("Invalid compressor",c),!1;if(d&&"LittleEndian"!==d)return console.error("Only LittleEndian encoding is supported"),!1;if(u!==t.dataType)return console.error("Invalid data type",u,"expecting",t.dataType),!1;if(ex(l,"AppendedData")){const e=ex(l,"AppendedData"),r=e.getAttribute("encoding"),n=s.filter(e=>{const{node:t}=e;return t.nodeType===Node.ELEMENT_NODE&&"appended"===t.getAttribute("format")&&t.hasAttribute("offset")},!1,!0).map(e=>({node:e.node,offset:Number(e.node.getAttribute("offset"))}));n.sort((e,t)=>e.offset-t.offset);let o=t.binaryBuffer;"base64"===r&&(o=e.textContent.trim().substr(1));const i=[];for(let e=0;ee+t.length,0),u=new ArrayBuffer(a),d=new Uint8Array(u);for(let e=0,t=0;e_s.newInstance(sx(Number(e.getAttribute("NumberOfTuples")),e,t,0,n,o))),a=[...e.getElementsByTagName("Array")].filter(e=>"String"===e.getAttribute("type")).map(e=>{const r=Zb.newInstance(function(e,t,r,n,o){const i=e.getAttribute("Name"),a=e.getAttribute("format"),s=Number(e.getAttribute("NumberOfComponents")||"1"),l=Number(e.getAttribute("NumberOfTuples")||"1")*s,u=[];if("ascii"===a){const t=e.firstChild.nodeValue.trim().split(/\s+/);let r=0;const n=[];for(;u.length{e.parseAsArrayBuffer(t.rawDataBuffer)}}const cx={};var dx={extend:function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,cx,r),zt.obj(e,t),zt.get(e,t,["url","baseURL"]),zt.setGet(e,t,["dataAccessHelper"]),zt.algo(e,t,0,1),ux(e,t)},processDataArray:sx,processFieldData:function(e,t,r,n,o,i,a){if(t){const o={};["Scalars","Vectors","Normals","Tensors","TCoords"].forEach(e=>{const n=t.getAttribute(e);n&&(o[n]=r[`set${e}`])});const s=t.getElementsByTagName("DataArray"),l=s.length;for(let t=0;t{const t=e-f;d[p++]=t;for(let e=0;e0){const l=r.getElementsByTagName(t)[0].getElementsByTagName("DataArray")[0],{values:u,numberOfComponents:c}=dx.processDataArray(s,l,n,o,i,a);e[`get${t}`]().setData(u,c)}return s}function fx(e,t,r,n,o,i,a){const s=Number(r.getAttribute(`NumberOf${t}`));if(s>0){const l=dx.processCells(s,r.getElementsByTagName(t)[0],n,o,i,a);e[`get${t}`]().setData(l)}return s}const hx={dataType:"PolyData"};function mx(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,hx,r),dx.extend(e,t,r),function(e,t){t.classHierarchy.push("vtkXMLPolyDataReader"),e.parseXML=(e,r,n,o,i)=>{const a=e.getElementsByTagName(t.dataType)[0].getElementsByTagName("Piece"),s=a.length;for(let e=0;e{u+=fx(r,e,s,n,o,i,t.binaryBuffer)}),dx.processFieldData(l,s.getElementsByTagName("PointData")[0],r.getPointData(),n,o,i,t.binaryBuffer),dx.processFieldData(u,s.getElementsByTagName("CellData")[0],r.getCellData(),n,o,i,t.binaryBuffer),t.output[e]=r}}}(e,t)}var gx={newInstance:zt.newInstance(mx,"vtkXMLPolyDataReader"),extend:mx};function yx(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,function(e){return{computeCellNormals:!1,computePointNormals:!0,...e}}(r)),zt.obj(e,t),zt.algo(e,t,1,1),zt.setGet(e,t,["computeCellNormals","computePointNormals"]),function(e,t){t.classHierarchy.push("vtkPolyDataNormals"),e.vtkPolyDataNormalsExecute=(e,r,n)=>{if(!n)return null;const o=new Float32Array(n.length),i=new Float32Array(3*e);let a=0,s=0;const l=r.length,u=[0,0,0],c=[0,0,0];for(let e=0;e{if(!e.getNumberOfInputPorts())return;const o=r[0];if(!o)return;const i=n[0]?.initialize()||mc.newInstance();i.setPoints(o.getPoints()),i.setVerts(o.getVerts()),i.setLines(o.getLines()),i.setPolys(o.getPolys()),i.setStrips(o.getStrips()),i.getPointData().passData(o.getPointData()),i.getCellData().passData(o.getCellData()),i.getFieldData().passData(o.getFieldData());const[a,s]=e.vtkPolyDataNormalsExecute(o.getNumberOfPolys(),o.getPolys().getData(),o.getPoints().getData());if(t.computePointNormals){const e=_s.newInstance({numberOfComponents:3,name:"Normals",values:s});i.getPointData().setNormals(e)}if(t.computeCellNormals){const e=_s.newInstance({numberOfComponents:3,name:"Normals",values:a});i.getCellData().setNormals(e)}n[0]=i}}(e,t)}var vx={newInstance:zt.newInstance(yx,"vtkPolyDataNormals"),extend:yx};const{vtkErrorMacro:bx}=zt;let xx=null;function _x(e,t){const r=function(e,t){const r=3*t.num_faces(),n=4*r,o=xx._malloc(n);e.GetTrianglesUInt32Array(t,n,o);const i=new Uint32Array(xx.HEAPF32.buffer,o,r).slice();return xx._free(o),i}(e,t),n=r.length-2,o=Xl.newInstance();o.allocate(4*r.length/3);for(let e=0;e{const n=Float32Array,o=e.GetAttributeId(t,xx[a[r]]);if(-1===o)return;const s=e.GetAttribute(t,o),l=function(e,t,r,n,o){const i=o.num_components(),a=t.num_points()*i,s=a*n.BYTES_PER_ELEMENT,l=function(e){switch(e){case Float32Array:return xx.DT_FLOAT32;case Int8Array:return xx.DT_INT8;case Int16Array:return xx.DT_INT16;case Int32Array:return xx.DT_INT32;case Uint8Array:return xx.DT_UINT8;case Uint16Array:return xx.DT_UINT16;case Uint32Array:return xx.DT_UINT32;default:return xx.DT_FLOAT32}}(n),u=xx._malloc(s);e.GetAttributeDataArrayForAllPoints(t,o,l,s,u);const c=new n(xx.HEAPF32.buffer,u,a).slice();return xx._free(u),{name:r,array:c,itemSize:i}}(e,t,r,n,s),u=i.getPointData();switch(r){case"points":i.getPoints().setData(l.array,l.itemSize);break;case"normals":u.setNormals(_s.newInstance({numberOfComponents:l.itemSize,values:l.array,name:"Normals"}));break;case"scalars":u.setScalars(_s.newInstance({numberOfComponents:l.itemSize,values:l.array,name:"Scalars"}));break;case"tcoords":u.setTCoords(_s.newInstance({numberOfComponents:l.itemSize,values:l.array,name:"TCoords"}))}}),!i.getPointData().getNormals()){const e=vx.newInstance();return e.setInputData(i),e.setComputePointNormals(!0),e.getOutputData()}return i}const Sx={};function Cx(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Sx,r),zt.obj(e,t),zt.get(e,t,["url","baseURL"]),zt.setGet(e,t,["dataAccessHelper"]),zt.algo(e,t,0,1),function(e,t){t.classHierarchy.push("vtkDracoReader"),t.dataAccessHelper||(t.dataAccessHelper=Iv("http")),e.setUrl=function(r){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{binary:!0};t.url=r;const o=r.split("/");return o.pop(),t.baseURL=o.join("/"),t.compression=n.compression,e.loadData({progressCallback:n.progressCallback,binary:!!n.binary})},e.loadData=function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=function(r){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{compression:o,progressCallback:i}=t;return n.binary?t.dataAccessHelper.fetchBinary(r,{compression:o,progressCallback:i}):t.dataAccessHelper.fetchText(e,r,{compression:o,progressCallback:i})}(t.url,r);return n.then(e.parse),n},e.parse=t=>{e.parseAsArrayBuffer(t)},e.parseAsArrayBuffer=r=>{if(!r)return;if(r===t.parseData)return;e.modified(),t.parseData=r;const n=new Int8Array(r),o=new xx.Decoder,i=new xx.DecoderBuffer;let a;if(i.Init(n,n.length),o.GetEncodedGeometryType(i)!==xx.TRIANGULAR_MESH)return void bx("Wrong geometry type, expected mesh, got point cloud.");{a=new xx.Mesh;const e=o.DecodeBufferToMesh(i,a);if(!e.ok())return void bx(`Could not decode Draco file: ${e.error_msg()}`)}const s=_x(o,a);xx.destroy(a),xx.destroy(i),xx.destroy(o),t.output[0]=s},e.requestData=()=>{e.parse(t.parseData)}}(e,t),t.compression||(t.compression=null),t.progressCallback||(t.progressCallback=null)}var Tx={extend:Cx,newInstance:zt.newInstance(Cx,"vtkDracoReader"),setDracoDecoder:async function(e){xx=await e({})},setWasmBinary:function(e,t){const r={};return new Promise((n,o)=>{r.wasmBinaryFile=t;const i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=()=>{200===i.status?(r.wasmBinary=i.response,Promise.resolve(window.DracoDecoderModule(r)).then(e=>{xx=e,n(!0)},o)):o(Error(`WASM binary could not be loaded: ${i.statusText}`))},i.send(null)})},getDracoDecoder:function(){return xx}};const{vtkWarningMacro:wx}=zt;let Ax;const Ex={preMultiplyFlag:!1,matrix:[...io]};function Dx(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ex,r),zt.obj(e,t),zt.setGet(e,t,["preMultiplyFlag"]),zt.setGetArray(e,t,["matrix"],16),function(e,t){t.classHierarchy.push("vtkAbstractTransform","vtkHomogeneousTransform","vtkTransform"),e.transformPoint=(e,r)=>(Sr(r,e,t.matrix),r),e.transformPoints=(e,r)=>{const n=new Float64Array(3),o=new Float64Array(3);for(let i=0;i{e.setPreMultiplyFlag(!0)},e.postMultiply=()=>{e.setPreMultiplyFlag(!1)},e.transformMatrix=(e,r)=>(t.preMultiplyFlag?b(r,t.matrix,e):b(r,e,t.matrix),r),e.transformMatrices=(e,r)=>{const n=new Float64Array(16),o=new Float64Array(16),i=t.preMultiplyFlag?()=>b(o,t.matrix,n):()=>b(o,n,t.matrix);for(let t=0;tAx({matrix:Oi.invertMatrix(Array.from(t.matrix),[],4),preMultiplyFlag:t.preMultiplyFlag}),e.translate=(r,n,o)=>{if(0===r&&0===n&&0===o)return;const i=u();A(i,[r,n,o]),t.preMultiplyFlag?b(t.matrix,t.matrix,i):b(t.matrix,i,t.matrix),e.modified()},e.rotateWXYZ=(r,n,o,i)=>{if(0===n&&0===o&&0===i)return void wx("No rotation applied, axis is zero vector.");if(0===r)return;const a=Oi.radiansFromDegrees(r),s=Mi();Ri(s,[n,o,i],a);const l=new Float64Array(16);U(l,s),t.preMultiplyFlag?b(t.matrix,t.matrix,l):b(t.matrix,l,t.matrix),e.modified()},e.rotateX=t=>{e.rotateWXYZ(t,1,0,0)},e.rotateY=t=>{e.rotateWXYZ(t,0,1,0)},e.rotateZ=t=>{e.rotateWXYZ(t,0,0,1)},e.scale=(r,n,o)=>{if(1===r&&1===n&&1===o)return;const i=u();E(i,[r,n,o]),t.preMultiplyFlag?b(t.matrix,t.matrix,i):b(t.matrix,i,t.matrix),e.modified()},e.transformNormal=function(r){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const o=se(ae(),t.matrix),i=ae();he(i,o);const a=ae();return fe(a,i),e.transformVector(r,n,a),Oi.normalize(n),n},e.transformNormals=(r,n)=>{const o=r.getData(),i=n.getData(),a=[0,0,0],s=se(ae(),t.matrix),l=ae();he(l,s);const u=ae();fe(u,l);for(let t=0;t1&&void 0!==arguments[1]?arguments[1]:[];return function(e,t,r){var n=t[0],o=t[1],i=t[2];e[0]=n*r[0]+o*r[3]+i*r[6],e[1]=n*r[1]+o*r[4]+i*r[7],e[2]=n*r[2]+o*r[5]+i*r[8]}(r,e,(arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)||se(ae(),t.matrix)),r},e.transformVectors=(t,r)=>{const n=t.getData(),o=r.getData(),i=[0,0,0];for(let t=0;t6&&void 0!==arguments[6]?arguments[6]:null,l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null;const u=t.getNumberOfPoints(),c=s?.length??0,d=new Float64Array(3),p=new Float64Array(3),f=new Float64Array(3),h=new Float64Array(3);let m=!1,g=!1,y=!1;const v=[];for(let b=0;bl[e].modified())}}(e,t)}Ax=zt.newInstance(Dx,"vtkTransform");var Px={newInstance:Ax,extend:Dx};const Ix="glTF",Ox={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Nx={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Mx={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Rx=9987,Fx=10497,Bx={magFilter:9728,minFilter:Rx,wrapS:Fx,wrapT:Fx},Lx={NORMAL:"normal",POSITION:"position",TEXCOORD_0:"texcoord0",TEXCOORD_1:"texcoord1",WEIGHTS_0:"weight",JOINTS_0:"joint",COLOR_0:"color",TANGENT:"tangent"},kx="OPAQUE",{vtkWarningMacro:Ux,vtkErrorMacro:Vx}=zt;function Gx(e){return{magFilter:10240,minFilter:10241,wrapS:10242,wrapT:10243}[e]}function zx(e,t){if("string"!=typeof e||""===e)return"";try{if(e.startsWith("data:"))return e;if(e.startsWith("blob:"))return e;const r=new URL(t);return r.pathname.includes(".")||r.pathname.endsWith("/")||(r.pathname+="/"),e.startsWith("http:")||e.startsWith("https:")||e.startsWith("//")||e.startsWith("/"),new URL(e,r).href}catch(e){return Vx("Error resolving URL:",e),""}}async function jx(e){if(e.bufferView){const t=new Blob([e.bufferView.data],{type:e.mimeType});return await createImageBitmap(t,{colorSpaceConversion:"none",imageOrientation:"flipY"})}return e.uri?(Ux("Falling back to image uri",e.uri),new Promise((t,r)=>{const n=new Image;n.crossOrigin="Anonymous",n.onload=()=>{t(n)},n.onerror=r,n.src=e.uri})):null}function Wx(e,t,r){const n=vc.newInstance();if(t)if("wrapS"in t&&"wrapT"in t||"minFilter"in t&&"magFilter"in t){33071===t.wrapS||33071===t.wrapT?(n.setRepeat(!1),n.setEdgeClamp(!0)):t.wrapS===Fx||t.wrapT===Fx?(n.setRepeat(!0),n.setEdgeClamp(!1)):Ux("Mirrored texture wrapping is not supported!");const e=[9729,9985,9986,Rx];(e.includes(t.minFilter)||e.includes(t.magFilter))&&n.setInterpolate(!0)}else n.setMipLevel(8),n.setInterpolate(!0),n.setEdgeClamp(!0);return n.setImageBitmap(e),n}const{vtkDebugMacro:Hx,vtkWarningMacro:Kx}=zt;class Xx{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{json:r,baseUri:n=""}=e;this.glTF=e,this.options=t,this.baseUri=n,this.json=r,this.extensions=r.extensions||{},this.extensionsUsed=r.extensionsUsed||[]}async parse(){const e=this.json.buffers||[];this.buffers=new Array(e.length).fill(null);const t=this.json.images||[];return this.images=new Array(t.length).fill({}),await this.loadBuffers(),await this.loadImages(),this.resolveTree(),this.glTF.json}resolveTree(){this.json.scenes=this.json.scenes?.map((e,t)=>this.resolveScene(e,t)),this.json.cameras=this.json.cameras?.map((e,t)=>this.resolveCamera(e,t)),this.json.bufferViews=this.json.bufferViews?.map((e,t)=>this.resolveBufferView(e,t)),this.json.images=this.json.images?.map((e,t)=>this.resolveImage(e,t)),this.json.samplers=this.json.samplers?.map((e,t)=>this.resolveSampler(e,t)),this.json.textures=this.json.textures?.map((e,t)=>this.resolveTexture(e,t)),this.json.accessors=this.json.accessors?.map((e,t)=>this.resolveAccessor(e,t)),this.json.materials=this.json.materials?.map((e,t)=>this.resolveMaterial(e,t)),this.json.meshes=this.json.meshes?.map((e,t)=>this.resolveMesh(e,t)),this.json.nodes=this.json.nodes?.map((e,t)=>this.resolveNode(e,t)),this.json.skins=this.json.skins?.map((e,t)=>this.resolveSkin(e,t)),this.json.animations=this.json.animations?.map((e,t)=>this.resolveAnimation(e,t))}get(e,t){if("object"==typeof t)return t;const r=this.json[e]&&this.json[e][t];return r||Kx(`glTF file error: Could not find ${e}[${t}]`),r}resolveScene(e,t){return e.id=e.id||`scene-${t}`,e.nodes=(e.nodes||[]).map(e=>this.get("nodes",e)),e}resolveNode(e,t){return e.id=e.id||`node-${t}`,e.children&&(e.children=e.children.map(e=>this.get("nodes",e))),void 0!==e.mesh?e.mesh=this.get("meshes",e.mesh):void 0!==e.meshes&&e.meshes.length&&(e.mesh=e.meshes.reduce((e,t)=>{const r=this.get("meshes",t);return e.id=r.id,e.primitives=e.primitives.concat(r.primitives),e},{primitives:[]})),void 0!==e.camera&&(e.camera=this.get("cameras",e.camera)),void 0!==e.skin&&(e.skin=this.get("skins",e.skin)),e.extensions?.KHR_lights_punctual&&(e.extensions.KHR_lights_punctual.light=this.extensions?.KHR_lights_punctual.lights[e.extensions.KHR_lights_punctual.light]),e}resolveSkin(e,t){return e.id=e.id||`skin-${t}`,e.inverseBindMatrices=this.get("accessors",e.inverseBindMatrices),e}resolveMesh(e,t){return e.id=e.id||`mesh-${t}`,e.primitives&&(e.primitives=e.primitives.map((e,t)=>{const r=e.attributes;e.name=`primitive-${t}`,e.attributes={};for(const t in r){const n=Lx[t];e.attributes[n]=this.get("accessors",r[t])}if(void 0!==e.indices&&(e.indices=this.get("accessors",e.indices)),void 0!==e.material&&(e.material=this.get("materials",e.material)),void 0===e.mode&&(e.mode=4),e.extensions?.KHR_draco_mesh_compression){Hx("Using Draco mesh compression");const t=this.get("bufferViews",e.extensions.KHR_draco_mesh_compression.bufferView);e.extensions.KHR_draco_mesh_compression.bufferView=t.data}return e})),e}resolveMaterial(e,t){if(e.id=e.id||`material-${t}`,void 0===e.alphaMode&&(e.alphaMode=kx),void 0===e.doubleSided&&(e.doubleSided=!1),void 0===e.alphaCutoff&&(e.alphaCutoff=.5),e.normalTexture&&(e.normalTexture={...e.normalTexture},e.normalTexture.texture=this.get("textures",e.normalTexture.index)),e.occlusionTexture&&(e.occlusionTexture={...e.occlusionTexture},e.occlusionTexture.texture=this.get("textures",e.occlusionTexture.index)),e.emissiveTexture&&(e.emissiveTexture={...e.emissiveTexture},e.emissiveTexture.texture=this.get("textures",e.emissiveTexture.index)),e.emissiveFactor?e.emissiveFactor=e.emissiveFactor[0]:e.emissiveFactor=e.emissiveTexture?1:0,e.pbrMetallicRoughness){e.pbrMetallicRoughness={...e.pbrMetallicRoughness};const t=e.pbrMetallicRoughness;t.baseColorTexture&&(t.baseColorTexture={...t.baseColorTexture},t.baseColorTexture.texture=this.get("textures",t.baseColorTexture.index)),t.metallicRoughnessTexture&&(t.metallicRoughnessTexture={...t.metallicRoughnessTexture},t.metallicRoughnessTexture.texture=this.get("textures",t.metallicRoughnessTexture.index))}else e.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};return e}getValueFromInterleavedBuffer(e,t,r,n,o){const i=new Uint8Array(o*n);for(let a=0;a{const r=e.extensions[t];switch(t){case"KHR_texture_basisu":case"EXT_texture_webp":case"EXT_texture_avif":e.source=this.get("images",r.source);break;default:Kx(`Unhandled extension: ${t}`)}}),e}resolveSampler(e,t){e.id=e.id||`sampler-${t}`,Object.hasOwn(e,"wrapS")||(e.wrapS=Fx),Object.hasOwn(e,"wrapT")||(e.wrapT=Fx),Object.hasOwn(e,"minFilter")||(e.minFilter=Rx),Object.hasOwn(e,"magFilter")||(e.magFilter=9728),e.parameters={};for(const t in e){const r=Gx(t);void 0!==r&&(e.parameters[r]=e[t])}return e}resolveImage(e,t){return e.id=e.id||`image-${t}`,void 0!==e.bufferView&&(e.bufferView=this.get("bufferViews",e.bufferView)),e}resolveBufferView(e,t){e.id=e.id||`bufferView-${t}`;const r=e.buffer;e.buffer=this.buffers[r];const n=this.buffers[r].arrayBuffer;let o=this.buffers[r].byteOffset||0;return"byteOffset"in e&&(o+=e.byteOffset),e.data=new Uint8Array(n,o,e.byteLength),e}resolveCamera(e,t){return e.id=e.id||`camera-${t}`,e}resolveAnimation(e,t){return e.id=e.id||`animation-${t}`,e.samplers.map(e=>(e.input=this.get("accessors",e.input).value,e.output=this.get("accessors",e.output).value,e)),e}loadBuffers(){const e=this.json.buffers.map((e,t)=>this.loadBuffer(e,t).then(()=>{delete e.uri}));return Promise.all(e)}async loadBuffer(e,t){let r=e;if(e.uri){Hx("Loading uri",e.uri);const t=zx(e.uri,this.options.baseUri),n=await fetch(t);r=await n.arrayBuffer()}else this.glTF.glbBuffers&&(r=this.glTF.glbBuffers[t]);this.buffers[t]={arrayBuffer:r,byteOffset:0,byteLength:r.byteLength}}loadImages(){const e=this.json.images||[],t=[];return new Promise((r,n)=>{for(let r=0;r{Hx("Texture loaded ",e[r])})));Promise.all(t).then(()=>r(this.images))})}async loadImage(e,t){let r,n;if(e.uri){Hx("Loading texture",e.uri);const t=zx(e.uri,this.options.baseUri),n=await fetch(t);r=await n.arrayBuffer(),e.uri=t,e.bufferView={data:r}}else if(e.bufferView){const t=this.get("bufferViews",e.bufferView);n=this.get("buffers",t.buffer),this.glTF.glbBuffers&&(n=this.glTF.glbBuffers[t.buffer],r=n.slice(t.byteOffset,t.byteOffset+t.byteLength)),e.bufferView={data:r}}}}const{vtkWarningMacro:$x}=zt,{vtkWarningMacro:qx,vtkDebugMacro:Yx}=zt;async function Jx(e,t,r){let n=1,o=1;const i=t.emissiveFactor,a=r.getProperty(),s=t.pbrMetallicRoughness;if(null!=s){!s?.metallicFactor||s?.metallicFactor<=0||s?.metallicFactor>=1?Yx("Invalid material.pbrMetallicRoughness.metallicFactor value. Using default value instead."):n=s.metallicFactor,!s?.roughnessFactor||s?.roughnessFactor<=0||s?.roughnessFactor>=1?Yx("Invalid material.pbrMetallicRoughness.roughnessFactor value. Using default value instead."):o=s.roughnessFactor;const e=s.baseColorFactor;if(null!=e&&(a.setDiffuseColor(e[0],e[1],e[2]),a.setOpacity(e[3])),a.setMetallic(n),a.setRoughness(o),a.setEmission(i),s.baseColorTexture){s.baseColorTexture.extensions;const e=s.baseColorTexture.texture;null!=e.extensions&&Object.keys(e.extensions).forEach(e=>{qx(`Unhandled extension: ${e}`)});const t=e.sampler,r=Wx(await jx(e.source),t);a.setDiffuseTexture(r)}if(s.metallicRoughnessTexture){s.metallicRoughnessTexture.extensions;const e=s.metallicRoughnessTexture.texture,t=e.sampler,r=Wx(await jx(e.source),t);a.setRMTexture(r)}if(t.occlusionTexture){t.occlusionTexture.extensions;const e=t.occlusionTexture.texture,r=e.sampler,n=Wx(await jx(e.source),r);a.setAmbientOcclusionTexture(n)}if(t.emissiveTexture){t.emissiveTexture.extensions;const e=t.emissiveTexture.texture,n=e.sampler,o=Wx(await jx(e.source),n);a.setEmissionTexture(o),null!=t.emissiveTexture.texCoord&&r.getMapper().getInputData().getPointData().setActiveTCoords(`TEXCOORD_${t.emissiveTexture.texCoord}`)}if(t.normalTexture){t.normalTexture.extensions;const e=t.normalTexture.texture,r=e.sampler,n=Wx(await jx(e.source),r);a.setNormalTexture(n),null!=t.normalTexture.scale&&a.setNormalStrength(t.normalTexture.scale)}}null!=t.extensions&&Object.keys(t.extensions).forEach(e=>{const r=t.extensions[e];switch(e){case"KHR_materials_unlit":!function(e,t){t.setLighting(!0)}(0,a);break;case"KHR_materials_ior":!function(e,t){t.setBaseIOR(e.ior)}(r,a);break;case"KHR_materials_specular":!function(e,t){t.setSpecular(e.specularFactor),t.setSpecularColor(e.specularColorFactor)}(r,a);break;default:qx(`Unhandled extension: ${e}`)}}),t.alphaMode!==kx&&r.setForceTranslucent(!0),a.setBackfaceCulling(!t.doubleSided)}async function Qx(e,t,r){const n=ss.newInstance(),o=Gl.newInstance();o.setColorModeToDirectScalars(),o.setInterpolateScalarsBeforeMapping(!0),n.setMapper(o),n.setUserMatrix(r);const i=await async function(e){if(!e||!e.attributes)return qx("Primitive has no position data, skipping"),null;if(e.extensions?.KHR_draco_mesh_compression)return function(e){const t=Tx.newInstance();return t.parse(e.bufferView),t.getOutputData()}(e.extensions.KHR_draco_mesh_compression);const t=mc.newInstance(),r=Xl.newInstance(),n=t.getPointData();if(Object.entries(e.attributes).forEach(async r=>{let[o,i]=r;switch(o){case Lx.POSITION:{const r=e.attributes.position.value;t.getPoints().setData(r,e.attributes.position.component);break}case Lx.NORMAL:{const t=e.attributes.normal.value;n.setNormals(_s.newInstance({name:"Normals",values:t,numberOfComponents:e.attributes.normal.components}));break}case Lx.COLOR_0:{const t=e.attributes.color.value;n.setScalars(_s.newInstance({name:"Scalars",values:t,numberOfComponents:e.attributes.color.components}));break}case Lx.TEXCOORD_0:{const t=e.attributes.texcoord0.value,r=_s.newInstance({name:"TEXCOORD_0",values:t,numberOfComponents:e.attributes.texcoord0.components});n.addArray(r),n.setActiveTCoords(r.getName());break}case Lx.TEXCOORD_1:{const t=e.attributes.texcoord1.value,r=_s.newInstance({name:"TEXCOORD_1",values:t,numberOfComponents:e.attributes.texcoord1.components});n.addArray(r);break}case Lx.TANGENT:{const t=e.attributes.tangent.value,r=_s.newInstance({name:"Tangents",values:t,numberOfComponents:e.attributes.tangent.components});n.addArray(r);break}default:qx(`Unhandled attribute: ${o}`)}}),null!=e.indices){const t=e.indices.value,n=t.length-2;switch(e.mode){case 3:case 5:case 2:qx("GL_LINE_LOOP not implemented");break;default:r.allocate(4*t.length/3);for(let e=0;e{const o=t[n];switch(n){case"KHR_materials_variants":r.variantMappings.set(e,o.mappings);break;case"KHR_draco_mesh_compression":break;default:qx(`Unhandled extension: ${n}`)}})}(`${t.name}`,t.extensions,e),n}function Zx(e){return Yx("Creating animation:",e),{name:e.name,channels:e.channels,samplers:e.samplers,getChannelByTargetNode(e){return this.channels.filter(t=>t.target.node===e)}}}async function e_(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:u();e.transform=function(e){const t=e.translation??dr(),r=e.rotation??Mi(),n=e.scale??fr(1,1,1);return null!=e.matrix?c(e.matrix):L(u(),r,t,n)}(e);const o=b(u(),n,e.transform);if(null!=e.mesh){const n=await async function(e){const t=ss.newInstance(),r=Gl.newInstance();r.setColorModeToDirectScalars(),r.setInterpolateScalarsBeforeMapping(!0),t.setMapper(r),t.setUserMatrix(e);const n=mc.newInstance();return r.setInputData(n),t}(o);r&&n.setParentProp(r),t.actors.set(`${e.id}`,n),await Promise.all(e.mesh.primitives.map(async(r,i)=>{const a=await Qx(t,r,o);a.setParentProp(n),t.actors.set(`${e.id}_${r.name}`,a)}))}e.extensions?.KHR_lights_punctual&&function(e,t,r){const{light:n}=e,{color:o,intensity:i,range:a,spot:s,type:l}=n,u=Vh.newInstance({color:o||[1,1,1],intensity:i||1});switch(u.setTransformMatrix(t),a>0&&u.setAttenuationValues(1,0,1/(a*a*.01)),l){case"directional":u.setPositional(!1);break;case"point":u.setPositional(!0),u.setConeAngle(90);break;case"spot":u.setPositional(!0),u.setConeAngle(yo(s.outerConeAngle));break;default:$x(`Unsupported light type: ${l}`)}r.lights.set(n.name,u)}(e.extensions.KHR_lights_punctual,e.transform,t),e.children&&Array.isArray(e.children)&&e.children.length>0&&await Promise.all(e.children.map(async r=>{const n=t.actors.get(e.id);await e_(r,t,n,o)}))}function t_(e,t){const r=new Uint32Array(t,e,2);return{start:e+8,length:r[0],type:r[1]}}function r_(e,t){const r=new Uint8Array(t,20,e.length),n=new TextDecoder("utf-8").decode(r);return JSON.parse(n)}function n_(e,t){return t.slice(e.start,e.start+e.length)}const{vtkDebugMacro:o_,vtkWarningMacro:i_}=zt;function a_(e,t){const r=e.target.path,n=e.target.node;return{...e,animate:function(o){!function(e){let t,o,i;switch(r){case"translation":n.setPosition(e[0],e[1],e[2]);break;case"rotation":i=function(e,t){var r=t[0],n=t[1],o=t[2],i=t[3],a=r*r+n*n+o*o+i*i;return a>0&&(a=1/Math.sqrt(a)),e[0]=r*a,e[1]=n*a,e[2]=o*a,e[3]=i*a,e}(Mi(),e),t=new Float64Array(3),o=Fi(t,i),n.rotateWXYZ(vo(o),t[0],t[1],t[2]);break;case"scale":n.setScale(e[0],e[1],e[2]);break;default:i_(`Unsupported animation path: ${r}`)}}(t[e.sampler].evaluate(o,r))}}}function s_(e,t){const r=new Map,n=new Map;return{addAnimation:function(t){const n=function(e,t){return e.samplers=e.samplers.map(e=>function(e){let t=0;return{...e,evaluate:function(r,n){const[o,i,a,s]=function(r){let n=t;for(;n{const r=c-u;return(2*c-3*u+1)*e+(c-2*u+l)*p[t]+(-2*c+3*u)*f[t]+r*h[t]}):(2*c-3*u+1)*d+(c-2*u+l)*p+(-2*c+3*u)*f+(c-u)*h}(0,o,i,a,s,r);break;default:i_(`Unknown interpolation method: ${e.interpolation}`)}return l}}}(e)),e.channels=e.channels.map(r=>(r.target.node=t.get(`node-${r.target.node}`),a_(r,e.samplers))),{...e,update:function(t){e.channels.forEach(e=>e.animate(t))}}}(t,e);r.set(t.id,n),o_(`Animation "${t.id}" added to mixer`)},play:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;r.has(e)?(n.set(e,{animation:r.get(e),weight:t,time:0}),o_(`Playing animation "${e}" with weight ${t}`)):i_(`Animation "${e}" not found in mixer`)},stop:function(e){n.delete(e)?i_(`Stopped animation "${e}"`):i_(`Animation "${e}" was not playing`)},stopAll:function(){n.clear(),i_("Stopped all animations")},update:function(e){const t=Array.from(n.values()).reduce((e,t)=>{let{weight:r}=t;return e+r},0);n.forEach((r,o)=>{let{animation:i,weight:a,time:s}=r;const l=t>0?a/t:0,u=s+e;n.set(o,{animation:i,weight:a,time:u}),o_(`Updating animation "${o}" at time ${u.toFixed(3)} with normalized weight ${l.toFixed(3)}`),i.update(u,l)})}}}const{vtkDebugMacro:l_,vtkErrorMacro:u_}=zt;function c_(e,t){t.classHierarchy.push("vtkGLTFImporter"),t.dataAccessHelper||(t.dataAccessHelper=Iv("http")),e.setUrl=function(r){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{binary:!0};t.url=r;const o=r.split("/");return o.pop(),t.baseURL=o.join("/"),t.compression=n.compression,t.sceneId=n.sceneId?n.sceneId:0,e.loadData({progressCallback:n.progressCallback,binary:!!n.binary})},e.loadData=function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=function(r){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{compression:o,progressCallback:i}=t;return n.binary?t.dataAccessHelper.fetchBinary(r,{compression:o,progressCallback:i}):t.dataAccessHelper.fetchText(e,r,{compression:o,progressCallback:i})}(t.url,r);return n.then(e.parse),n},e.parse=t=>{"string"==typeof t?e.parseAsText(t):e.parseAsBinary(t)},e.parseAsBinary=async r=>{if(!r)return;if(r===t.parseData)return;e.modified();const n={},o={baseUri:t.baseURL};if(Av.arrayBufferToString(new Uint8Array(r,0,4))===Ix){const{json:e,buffers:t}=function(e){if(e.byteLength<12)throw new Error("Invalid GLB: File too small");const t=new DataView(e,0,12),r=new Uint8Array(e,0,4),n=Av.arrayBufferToString(r),o=t.getUint32(4,!0),i=t.getUint32(8,!0);if(n!==Ix)throw new Error("Unsupported glTF-Binary header.");if(o<2)throw new Error("Unsupported legacy binary file detected.");if(i>e.byteLength)throw new Error("Invalid GLB: Declared length exceeds file size");const a=function(e){const t=Math.floor((e.byteLength-12)/8),r=new Array(t);let n=12,o=0;for(;n=2.0 are supported."):(t.glTFTree=await async function(e,t){const r=new Xx(e,t);return await r.parse()}(n,o),t.actors=new Map,t.cameras=new Map,t.lights=new Map,t.animations=[],t.variants=[],t.variantMappings=new Map,await async function(e){e.animations=e.glTFTree.animations?.map(Zx),Object.keys(e.glTFTree?.extensions||[]).forEach(t=>{const r=e.glTFTree.extensions[t];switch(t){case"KHR_materials_variants":!function(e,t){t.variants=e.variants.map(e=>e.name)}(r,e);break;case"KHR_draco_mesh_compression":break;default:qx(`Unhandled extension: ${t}`)}});const t=e.sceneId??e.glTFTree.scene;e.glTFTree.scenes?.length&&e.glTFTree.scenes[t]?.nodes?await Promise.all(e.glTFTree.scenes[t].nodes.map(async t=>{t?await e_(t,e):qx("Node not found in glTF.nodes")})):qx("No valid scenes found in the glTF data")}(t),t.scenes=t.glTFTree.scenes,e.invokeReady())},e.parseAsText=r=>{r&&r!==t.parseData&&(e.modified(),t.parseData=r)},e.requestData=(r,n)=>{e.parse(t.parseData)},e.setDracoDecoder=async e=>{await Tx.setDracoDecoder(e)},e.importActors=()=>{t.actors.forEach(e=>t.renderer.addActor(e))},e.importCameras=()=>{t.glTFTree.cameras?.forEach(e=>{const r=function(e){const t=Lh.newInstance();if("perspective"===e.type){const{yfov:r,znear:n,zfar:o}=e.perspective;t.setClippingRange(n,o),t.setParallelProjection(!1),t.setViewAngle(vo(r))}else{if("orthographic"!==e.type)throw new Error("Unsupported camera type");{const{ymag:r,znear:n,zfar:o}=e.orthographic;t.setClippingRange(n,o),t.setParallelProjection(!0),t.setParallelScale(r)}}return t}(e);t.cameras.set(e.id,r)}),t.scenes.forEach(e=>{e.nodes.forEach(e=>{const r=t.cameras.get(e.camera?.id);r&&function(e,t){if(!e||!t)return;const r=[0,0,0],n=[0,1,0],o=[0,0,-1],i=Px.newInstance();i.setMatrix(t),i.transformPoint(r,r),i.transformPoints(n,n),i.transformPoints(o,o),o[0]+=r[0],o[1]+=r[1],o[2]+=r[2],e.setPosition(r),e.setFocalPoint(o),e.setViewUp(n)}(r,e.transform)})})},e.importAnimations=()=>{t.glTFTree.animations?.length>0&&(t.animationMixer=s_(t.actors,t.glTFTree.accessors),t.glTFTree.animations.forEach(e=>{t.animationMixer.addAnimation(e)})),t.animations=t.glTFTree.animations||[]},e.importLights=()=>{t.lights?.forEach(e=>{l_("Adding light",e),t.renderer.addLight(e)})},e.setCamera=e=>{const r=t.cameras.get(e);r?(l_("Setting camera",r),t.renderer.setActiveCamera(r)):u_(`Camera ${e} not found`)},e.switchToVariant=async e=>{const r=Array.from(t.actors).map(async r=>{let[n,o]=r;l_("Switching to variant",e,"for node",n);const i=t.variantMappings.get(n);if(i){const r=i.find(t=>t.variants.includes(e));if(r){const e=t.glTFTree.materials[r.material];await Jx(0,e,o)}}});await Promise.all(r)}}const d_={};function p_(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,d_,r),zt.obj(e,t),zt.get(e,t,["url","baseURL","actors","scenes","cameras","animations","animationMixer","variants","variantMappings"]),zt.set(e,t,["renderer","dracoDecoder"]),zt.event(e,t,"ready"),c_(e,t),t.compression||(t.compression=null),t.progressCallback||(t.progressCallback=null)}var f_={extend:p_,newInstance:zt.newInstance(p_,"vtkGLTFImporter")};const{vtkErrorMacro:h_}=jt;function m_(e,t){t.classHierarchy.push("vtkCutter");const r={...e};e.getMTime=()=>{let e=r.getMTime();return t.cutFunction?(e=Math.max(e,t.cutFunction.getMTime()),e):e},e.requestData=(e,r)=>{const n=e[0];if(!n)return void h_("Invalid or missing input");if(!t.cutFunction)return void h_("Missing cut function");const o=r[0]?.initialize()||mc.newInstance();(function(e,r){const n=e.getPoints(),o=n.getData(),i=e.getPointData(),a=n.getNumberOfPoints(),s=[],l=[],u=[],c={},d=i.getNumberOfArrays();for(let e=0;e0;let n=!0;for(let t=1;t0!==e){n=!1;break}if(n)continue;const a=[];for(let e=0;e0;if(y[n]>0===s)continue;let l=e,u=n,c=y[u]-y[l];c<=0&&(l=n,u=e,c*=-1);let p=0;0!==c&&(p=(t.cutValue-y[l])/c);const f=r.cell[l],h=r.cell[u];m[0]=o[3*f],m[1]=o[3*f+1],m[2]=o[3*f+2],g[0]=o[3*h],g[1]=o[3*h+1],g[2]=o[3*h+2];const v=[m[0]+p*(g[0]-m[0]),m[1]+p*(g[1]-m[1]),m[2]+p*(g[2]-m[2])],b={};for(let e=0;e{c[e].push(...t.intersectedArrays[e])}),a[e].newPointID=s.length/3-1,h.push(a[e]))}const p=a.length;2===p?l.push(p,a[0].newPointID,a[1].newPointID):p>2&&(u.push(p),a.forEach(e=>{u.push(e.newPointID)}))}r.getPoints().setData(it(n.getDataType(),s),3);const v=r.getPointData();for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,g_,r),mt(e,t),At(e,t,1,1),_t(e,t,["cutFunction","cutValue"]),m_(e,t)}var v_={newInstance:Pt(y_,"vtkCutter"),extend:y_};const b_={numberOfIterations:20,passBand:.1,featureAngle:45,edgeAngle:15,featureEdgeSmoothing:0,boundarySmoothing:1,nonManifoldSmoothing:0,generateErrorScalars:0,generateErrorVectors:0,normalizeCoordinates:0};function x_(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,b_,r),zt.obj(e,t),zt.algo(e,t,1,1),zt.setGet(e,t,["numberOfIterations","passBand","featureAngle","edgeAngle","featureEdgeSmoothing","boundarySmoothing","nonManifoldSmoothing","generateErrorScalars","generateErrorVectors","normalizeCoordinates"]),function(e,t){t.classHierarchy.push("vtkWindowedSincPolyDataFilter"),e.vtkWindowedSincPolyDataFilterExecute=(e,r,n)=>{if(!e||t.numberOfIterations<=0)return e;const o=e.getData(),i=r.getVerts().getData(),a=r.getLines().getData(),s=r.getPolys().getData(),l=r.getStrips().getData(),u=Math.cos(Oi.radiansFromDegrees(t.featureAngle)),c=Math.cos(Oi.radiansFromDegrees(t.edgeAngle)),d=e.getNumberOfPoints(),p=new Array(d);for(let e=0;e3;for(let e=0;e0||m>0){const n=mc.newInstance();n.setPoints(r.getPoints()),n.setPolys(r.getPolys());const o=n;let i=[],a=0;const s=[],l=[];o.buildLinks();const c=o.getPolys().getData();let d=0;for(let r=0;r=2){if(!t.nonManifoldSmoothing){let e=0;for(;e=m&&(g=2)}}else{if(!(1===m&&(a=i[0])>d))continue;if(t.featureEdgeSmoothing){ec.computeNormal(e.getPoint(n[0]),e.getPoint(n[1]),e.getPoint(n[2]),s);const{cellPointIds:t}=o.getCellPoints(a);ec.computeNormal(e.getPoint(t[0]),e.getPoint(t[1]),e.getPoint(t[2]),l),Oi.dot(s,l)<=u&&(g=2)}}g&&0===p[c].type?(p[c].edges=[h],p[c].type=g):(g&&3===p[c].type||g&&2===p[c].type||!g&&0===p[c].type)&&(p[c].edges.push(h),p[c].type&&3===g&&(p[c].type=3)),g&&0===p[h].type?(p[h].edges=[c],p[h].type=g):(g&&3===p[h].type||g&&2===p[h].type||!g&&0===p[h].type)&&(p[h].edges.push(c),p[h].type&&3===g&&(p[h].type=3))}}}for(let r=0;r=0&&Oi.normalize(a)>=0&&Oi.dot(i,a)1&&(A[t.numberOfIterations-2]=2*(t.numberOfIterations-1)*w[t.numberOfIterations-1]);for(let e=t.numberOfIterations-3;e>=0;--e)A[e]=A[e+2]+2*(e+1)*w[e+1];D=0,P=0,D+=w[0],P+=A[0];for(let e=1;e<=t.numberOfIterations;++e)1===e?(D+=w[e]*(1-.5*S),P+=A[e]*(1-.5*S)):(D+=w[e]*Math.cos(e*Math.acos(1-.5*S)),P+=A[e]*Math.cos(e*Math.acos(1-.5*S)));t.numberOfIterations>1?Math.abs(D-1)>=.001?O-=(D-1)/P:I=!0:(I=!0,O=0)}Math.abs(D-1)>=.001&&console.log("An optimal offset for the smoothing filter could not be found. Unpredictable smoothing/shrinkage may result.");const N=[0,0,0],M=[0,0,0],R=[0,0,0],F=[0,0,0],B=[0,0,0],L=[0,0,0];for(let e=0;e0){b[g].getPoint(e,N),R[0]=0,R[1]=0,R[2]=0;for(let t=0;t0){b[g].getPoint(e,k),b[y].getPoint(e,U),R[0]=0,R[1]=0,R[2]=0;for(let t=0;t{if(!e.getNumberOfInputPorts())return;const n=t[0];if(!n)return;const o=r[0]?.initialize()||mc.newInstance(),i=e.vtkWindowedSincPolyDataFilterExecute(n.getPoints(),n,o);o.setPointData(n.getPointData()),o.setCellData(n.getCellData()),o.setFieldData(n.getFieldData()),o.setPoints(i),o.setVerts(n.getVerts()),o.setLines(n.getLines()),o.setPolys(n.getPolys()),o.setStrips(n.getStrips()),r[0]=o}}(e,t)}var __={newInstance:zt.newInstance(x_,"vtkWindowedSincPolyDataFilter"),extend:x_};const{vtkErrorMacro:S_}=zt,C_=[0,2,4,1,2,4,0,3,4,1,3,4,0,2,5,1,2,5,0,3,5,1,3,5],T_=[2,0,1,2,2,3,2,4,5,2,6,7,2,0,2,2,1,3,2,4,6,2,5,7,2,0,4,2,1,5,2,2,6,2,3,7],w_={};function A_(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,w_,r),zt.obj(e,t),zt.algo(e,t,1,1),function(e,t){t.classHierarchy.push("vtkOutlineFilter"),e.requestData=(e,t)=>{const r=e[0];if(!r)return void S_("Invalid or missing input");const n=r.getBounds(),o=t[0]?.initialize()||mc.newInstance();o.getPoints().setData(Float32Array.from(C_.map(e=>n[e])),3),o.getLines().setData(Uint16Array.from(T_)),t[0]=o}}(e,t)}var E_={newInstance:zt.newInstance(A_,"vtkOutlineFilter"),extend:A_,BOUNDS_MAP:C_,LINE_ARRAY:T_};const D_={height:1,radius:.5,resolution:6,center:[0,0,0],direction:[1,0,0],capping:!0,pointType:"Float64Array"};function P_(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,D_,r),zt.obj(e,t),zt.setGet(e,t,["height","radius","resolution","capping"]),zt.setGetArray(e,t,["center","direction"],3),zt.algo(e,t,0,1),function(e,t){t.classHierarchy.push("vtkConeSource"),e.requestData=(e,r)=>{const n=2*Math.PI/t.resolution,o=-t.height/2,i=t.resolution+1,a=4*t.resolution+1+t.resolution;let s=0;const l=zt.newTypedArray(t.pointType,3*i);let u=0;const c=new Uint32Array(a);l[0]=t.height/2,l[1]=0,l[2]=0,t.capping&&(c[u++]=t.resolution);for(let e=0;et.resolution?1:e+2;ov().translate(...t.center).rotateFromDirections([1,0,0],t.direction).apply(l);const d=r[0]?.initialize()||mc.newInstance();d.getPoints().setData(l,3),d.getPolys().setData(c,1),r[0]=d}}(e,t)}var I_={newInstance:zt.newInstance(P_,"vtkConeSource"),extend:P_};const O_={radius:.5,latLongTessellation:!1,thetaResolution:8,startTheta:0,endTheta:360,phiResolution:8,startPhi:0,endPhi:180,center:[0,0,0],pointType:"Float64Array"};function N_(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,O_,r),zt.obj(e,t),zt.setGet(e,t,["radius","latLongTessellation","thetaResolution","startTheta","endTheta","phiResolution","startPhi","endPhi"]),zt.setGetArray(e,t,["center"],3),zt.algo(e,t,0,1),function(e,t){t.classHierarchy.push("vtkSphereSource"),e.requestData=(e,r)=>{let n=r[0];const o=n?n.getPoints().getDataType():t.pointType;n=n?.initialize()||mc.newInstance();let i=0,{thetaResolution:a}=t,s=t.startThetat.startTheta?t.endTheta:t.startTheta;l*=Math.PI/180;let u=t.startPhit.startPhi?t.endPhi:t.startPhi;c*=Math.PI/180,Math.abs(s-l)<2*Math.PI&&++a;const d=(l-s)/t.thetaResolution,p=t.startPhi<=0?1:0,f=t.phiResolution+(t.endPhi>=180?-1:0),h=t.phiResolution*a+2,m=2*t.phiResolution*t.thetaResolution;let g=0,y=zt.newTypedArray(o,3*h),v=new Float32Array(3*h),b=0,x=new Uint32Array(5*m);t.startPhi<=0&&(y[3*g+0]=t.center[0],y[3*g+1]=t.center[1],y[3*g+2]=t.center[2]+t.radius,v[3*g+0]=0,v[3*g+1]=0,v[3*g+2]=1,g++,i++),t.endPhi>=180&&(y[3*g+0]=t.center[0],y[3*g+1]=t.center[1],y[3*g+2]=t.center[2]-t.radius,v[3*g+0]=0,v[3*g+1]=0,v[3*g+2]=-1,g++,i++);const _=t.phiResolution-i,S=(c-u)/(t.phiResolution-1);for(let e=0;e=180){const e=_-1+i;for(let t=0;t.001?Math.acos(r/i):0,s=a>.001?Math.atan2(o,n):0;t[0]=i,t[1]=a,t[2]=s}function z_(e,t){if(e[0]>=t-.1)return e[2];const r=e[1]*Math.sqrt(t*t-e[0]*e[0])/(e[0]*Math.sin(e[1]));return e[2]>-.3*Math.PI?e[2]+r:e[2]-r}function j_(e,t,r,n){const o=[],i=[];mi(t,o),mi(r,i);const a=[],s=[];G_(o,a),G_(i,s);let l=e;if(a[1]>.05&&s[1]>.05&&function(e,t){let r=e-t;for(r<0&&(r=-r);r>=2*Math.PI;)r-=2*Math.PI;return r>Math.PI&&(r=2*Math.PI-r),r}(a[2],s[2])>.33*Math.PI){let t=Math.max(a[0],s[0]);t=Math.max(88,t),e<.5?(s[0]=t,s[1]=0,s[2]=0,l*=2):(a[0]=t,a[1]=0,a[2]=0,l=2*l-1)}a[1]<.05&&s[1]>.05?a[2]=z_(s,a[0]):s[1]<.05&&a[1]>.05&&(s[2]=z_(a,s[0]));const u=[];u[0]=(1-l)*a[0]+l*s[0],u[1]=(1-l)*a[1]+l*s[1],u[2]=(1-l)*a[2]+l*s[2];const c=[];!function(e,t){const r=e[0],n=e[1],o=e[2];t[0]=r*Math.cos(n),t[1]=r*Math.sin(n)*Math.cos(o),t[2]=r*Math.sin(n)*Math.sin(o)}(u,c),gi(c,n)}const W_={clamping:!0,colorSpace:F_.RGB,hSVWrap:!0,scale:B_.LINEAR,nanColor:null,belowRangeColor:null,aboveRangeColor:null,useAboveRangeColor:!1,useBelowRangeColor:!1,allowDuplicateScalars:!1,table:null,tableSize:0,buildTime:null,nodes:null,discretize:!1,numberOfValues:256};function H_(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,W_,r),ul.extend(e,t,r),t.table=[],t.nodes=[],t.nanColor=[.5,0,0,1],t.belowRangeColor=[0,0,0,1],t.aboveRangeColor=[1,1,1,1],t.buildTime={},zt.obj(t.buildTime),zt.get(e,t,["buildTime","mappingRange"]),zt.setGet(e,t,["useAboveRangeColor","useBelowRangeColor","discretize","numberOfValues",{type:"enum",name:"colorSpace",enum:F_},{type:"enum",name:"scale",enum:B_}]),zt.setArray(e,t,["nanColor","belowRangeColor","aboveRangeColor"],4),zt.getArray(e,t,["nanColor","belowRangeColor","aboveRangeColor"]),function(e,t){t.classHierarchy.push("vtkColorTransferFunction"),e.getSize=()=>t.nodes.length,e.addRGBPoint=(t,r,n,o)=>e.addRGBPointLong(t,r,n,o,.5,0),e.addRGBPointLong=function(r,n,o,i){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.5,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(a<0||a>1)return U_("Midpoint outside range [0.0, 1.0]"),-1;if(s<0||s>1)return U_("Sharpness outside range [0.0, 1.0]"),-1;t.allowDuplicateScalars||e.removePoint(r);const l={x:r,r:n,g:o,b:i,midpoint:a,sharpness:s};t.nodes.push(l),e.sortAndUpdateRange();let u=0;for(;ue.addHSVPointLong(t,r,n,o,.5,0),e.addHSVPointLong=function(t,r,n,o){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.5,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;const s=[];return ci([r,n,o],s),e.addRGBPoint(t,s[0],s[1],s[2],i,a)},e.setNodes=r=>{if(t.nodes!==r){const n=JSON.stringify(t.nodes);t.nodes=r;const o=JSON.stringify(t.nodes);if(e.sortAndUpdateRange()||n!==o)return e.modified(),!0}return!1},e.sortAndUpdateRange=()=>{const r=JSON.stringify(t.nodes);t.nodes.sort((e,t)=>e.x-t.x);const n=JSON.stringify(t.nodes),o=e.updateRange();return o||r===n?o:(e.modified(),!0)},e.updateRange=()=>{const r=[2];r[0]=t.mappingRange[0],r[1]=t.mappingRange[1];const n=t.nodes.length;return n?(t.mappingRange[0]=t.nodes[0].x,t.mappingRange[1]=t.nodes[n-1].x):(t.mappingRange[0]=0,t.mappingRange[1]=0),(r[0]!==t.mappingRange[0]||r[1]!==t.mappingRange[1])&&(e.modified(),!0)},e.removePoint=r=>{let n=0;for(;n=t.nodes.length)return-1;let i=!1;return t.nodes.splice(n,1),0!==n&&n!==t.nodes.length||(i=e.updateRange()),i||e.modified(),o},e.movePoint=(r,n)=>{if(r!==n){e.removePoint(n);for(let o=0;o{t.nodes=[],e.sortAndUpdateRange()},e.addRGBSegment=(r,n,o,i,a,s,l,u)=>{e.sortAndUpdateRange();for(let e=0;e=r&&t.nodes[e].x<=a?t.nodes.splice(e,1):e++;e.addRGBPointLong(r,n,o,i,.5,0),e.addRGBPointLong(a,s,l,u,.5,0),e.modified()},e.addHSVSegment=(t,r,n,o,i,a,s,l)=>{const u=[a,s,l],c=[],d=[];ci([r,n,o],c),ci(u,d),e.addRGBSegment(t,c[0],c[1],c[2],i,d[0],d[1],d[2])},e.mapValue=t=>{const r=[];return e.getColor(t,r),[Math.floor(255*r[0]+.5),Math.floor(255*r[1]+.5),Math.floor(255*r[2]+.5),255]},e.getColor=(r,n)=>{if(t.indexedLookup){const t=e.getSize(),o=e.getAnnotatedValueIndexInternal(r);if(o<0||0===t){const t=e.getNanColorByReference();n[0]=t[0],n[1]=t[1],n[2]=t[2]}else{const r=[];e.getNodeValue(o%t,r),n[0]=r[1],n[1]=r[2],n[2]=r[3]}return}e.getTable(r,r,1,n)},e.getRedValue=t=>{const r=[];return e.getColor(t,r),r[0]},e.getGreenValue=t=>{const r=[];return e.getColor(t,r),r[1]},e.getBlueValue=t=>{const r=[];return e.getColor(t,r),r[2]},e.logScaleEnabled=()=>t.scale===B_.LOG10,e.usingLogScale=()=>e.logScaleEnabled()&&t.mappingRange[0]>0,e.getTable=(r,n,o,i)=>{const a=e.usingLogScale(),s=a?Math.log10(Number(r)):Number(r),l=a?Math.log10(Number(n)):Number(n);if(Ai(s)||Ai(l)){for(let e=0;e1?s+r/(o-1)*(l-s):.5*(s+l),t.discretize){const e=S;if(h>=e[0]&&h<=e[1]){const r=t.numberOfValues,n=e[1]-e[0];if(r<=1)h=e[0]+n/2;else{const t=(h-e[0])/n,o=xo(r*t);h=e[0]+o/(r-1)*n}}}for(;ut.nodes[u].x;)u++,u.99999&&(b=.99999));if(h>S[1])i[n]=0,i[n+1]=0,i[n+2]=0,t.clamping&&(e.getUseAboveRangeColor()?(i[n]=t.aboveRangeColor[0],i[n+1]=t.aboveRangeColor[1],i[n+2]=t.aboveRangeColor[2]):(i[n]=d,i[n+1]=p,i[n+2]=f));else if(h0&&(i[n]=t.nodes[0].r,i[n+1]=t.nodes[0].g,i[n+2]=t.nodes[0].b));else if(0===u&&(Math.abs(h-s)<1e-6||t.discretize))c>0?(i[n]=t.nodes[0].r,i[n+1]=t.nodes[0].g,i[n+2]=t.nodes[0].b):(i[n]=0,i[n+1]=0,i[n+2]=0);else{let e=0;if(e=(h-m)/(g-m),e=e.99){if(e<.5){i[n]=y[0],i[n+1]=y[1],i[n+2]=y[2];continue}i[n]=v[0],i[n+1]=v[1],i[n+2]=v[2];continue}if(x<.01){if(t.colorSpace===F_.RGB)i[n]=(1-e)*y[0]+e*v[0],i[n+1]=(1-e)*y[1]+e*v[1],i[n+2]=(1-e)*y[2]+e*v[2];else if(t.colorSpace===F_.HSV){const r=[],o=[];ui(y,r),ui(v,o),t.hSVWrap&&(r[0]-o[0]>.5||o[0]-r[0]>.5)&&(r[0]>o[0]?r[0]-=1:o[0]-=1);const a=[];a[0]=(1-e)*r[0]+e*o[0],a[0]<0&&(a[0]+=1),a[1]=(1-e)*r[1]+e*o[1],a[2]=(1-e)*r[2]+e*o[2],ci(a,_),i[n]=_[0],i[n+1]=_[1],i[n+2]=_[2]}else if(t.colorSpace===F_.LAB){const t=[],r=[];mi(y,t),mi(v,r);const o=[];o[0]=(1-e)*t[0]+e*r[0],o[1]=(1-e)*t[1]+e*r[1],o[2]=(1-e)*t[2]+e*r[2],gi(o,_),i[n]=_[0],i[n+1]=_[1],i[n+2]=_[2]}else t.colorSpace===F_.DIVERGING?(j_(e,y,v,_),i[n]=_[0],i[n+1]=_[1],i[n+2]=_[2]):U_("ColorSpace set to invalid value.",t.colorSpace);continue}e<.5?e=.5*(2*e)**(1+10*x):e>.5&&(e=1-.5*(2*(1-e))**(1+10*x));const r=e*e,o=r*e,a=2*o-3*r+1,s=-2*o+3*r,l=o-2*r+e,u=o-r;let c,d;if(t.colorSpace===F_.RGB)for(let e=0;e<3;e++)c=v[e]-y[e],d=(1-x)*c,i[n+e]=a*y[e]+s*v[e]+l*d+u*d;else if(t.colorSpace===F_.HSV){const e=[],r=[];ui(y,e),ui(v,r),t.hSVWrap&&(e[0]-r[0]>.5||r[0]-e[0]>.5)&&(e[0]>r[0]?e[0]-=1:r[0]-=1);const o=[];for(let t=0;t<3;t++)c=r[t]-e[t],d=(1-x)*c,o[t]=a*e[t]+s*r[t]+l*d+u*d,0===t&&o[t]<0&&(o[t]+=1);ci(o,_),i[n]=_[0],i[n+1]=_[1],i[n+2]=_[2]}else if(t.colorSpace===F_.LAB){const e=[],t=[];mi(y,e),mi(v,t);const r=[];for(let n=0;n<3;n++)c=t[n]-e[n],d=(1-x)*c,r[n]=a*e[n]+s*t[n]+l*d+u*d;gi(r,_),i[n]=_[0],i[n+1]=_[1],i[n+2]=_[2]}else t.colorSpace===F_.DIVERGING?(j_(e,y,v,_),i[n]=_[0],i[n+1]=_[1],i[n+2]=_[2]):U_("ColorSpace set to invalid value.");for(let e=0;e<3;e++)i[n+e]=i[n+e]<0?0:i[n+e],i[n+e]=i[n+e]>1?1:i[n+e]}}},e.getUint8Table=function(r,n,o){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e.getMTime()<=t.buildTime&&t.tableSize===o&&t.tableWithAlpha!==i)return t.table;if(0===t.nodes.length)return U_("Attempting to lookup a value with no points in the function"),t.table;const a=i?4:3;t.tableSize===o&&t.tableWithAlpha===i||(t.table=new Uint8Array(o*a),t.tableSize=o,t.tableWithAlpha=i);const s=[];e.getTable(r,n,o,s);for(let e=0;e{e.removeAllPoints();const n=r.getNumberOfComponents();for(let e=0;e{let a=0;e.removeAllPoints(),o>1&&(a=(n-r)/(o-1));for(let e=0;ee<0||e>=t.nodes.length?(U_("Index out of range!"),-1):(r[0]=t.nodes[e].x,r[1]=t.nodes[e].r,r[2]=t.nodes[e].g,r[3]=t.nodes[e].b,r[4]=t.nodes[e].midpoint,r[5]=t.nodes[e].sharpness,1),e.setNodeValue=(r,n)=>{if(r<0||r>=t.nodes.length)return U_("Index out of range!"),-1;const o=t.nodes[r].x;return t.nodes[r].x=n[0],t.nodes[r].r=n[1],t.nodes[r].g=n[2],t.nodes[r].b=n[3],t.nodes[r].midpoint=n[4],t.nodes[r].sharpness=n[5],o!==n[0]?e.sortAndUpdateRange():e.modified(),1},e.getNumberOfAvailableColors=()=>{if(t.indexedLookup&&e.getSize())return e.getSize();if(t.tableSize)return t.tableSize;const r=t.nodes?.length??0;return Math.max(4094,r)},e.getIndexedColor=(t,r)=>{const n=e.getSize();if(n>0&&t>=0){const o=[];e.getNodeValue(t%n,o);for(let e=0;e<3;++e)r[e]=o[e+1];return void(r[3]=1)}const o=e.getNanColorByReference();r[0]=o[0],r[1]=o[1],r[2]=o[2],r[3]=1},e.fillFromDataPointer=(t,r)=>{if(!(t<=0)&&r){e.removeAllPoints();for(let n=0;n{const o=[r,n],i=[r,n],a=e.getRange(),s=e.logScaleEnabled();if(a[1]===o[1]&&a[0]===o[0])return;if(o[1]===o[0])return void U_("attempt to set zero width color range");s&&(o[0]<=0?console.warn("attempt to set log scale color range with non-positive minimum"):(i[0]=Math.log10(o[0]),i[1]=Math.log10(o[1])));const l=(i[1]-i[0])/(a[1]-a[0]),u=i[0]-a[0]*l;for(let e=0;e{const n=e.getRange(),o=[];n[0]r[1]?(e.getColor(r[1],o),e.addRGBPoint(r[1],o[0],o[1],o[2])):(e.getColor(n[1],o),e.addRGBPoint(r[1],o[0],o[1],o[2])),e.sortAndUpdateRange();for(let e=0;e=r[0]&&t.nodes[e].x<=r[1]?t.nodes.splice(e,1):++e;return 1},e.estimateMinNumberOfSamples=(t,r)=>{const n=e.findMinimumXDistance();return Math.ceil((r-t)/n)},e.findMinimumXDistance=()=>{if(t.nodes.length<2)return-1;let e=Number.MAX_VALUE;for(let r=0;r{0!==e.getSize()?t.indexedLookup?e.mapDataIndexed(r,n,o,i):e.mapData(r,n,o,i):k_("Transfer Function Has No Points!")},e.mapData=(t,r,n,o)=>{if(0===e.getSize())return void V_("Transfer Function Has No Points!");const i=Math.floor(255*e.getAlpha()+.5),a=t.getNumberOfTuples(),s=t.getNumberOfComponents(),l=r.getData(),u=t.getData(),c=[];if(n===L_.RGBA)for(let t=0;t{const n=JSON.stringify(t.colorSpace);r.ColorSpace&&(t.colorSpace=F_[r.ColorSpace.toUpperCase()],void 0===t.colorSpace&&(U_(`ColorSpace ${r.ColorSpace} not supported, using RGB instead`),t.colorSpace=F_.RGB));let o=n!==JSON.stringify(t.colorSpace);const i=o||JSON.stringify(t.nanColor);if(r.NanColor)for(t.nanColor=[].concat(r.NanColor);t.nanColor.length<4;)t.nanColor.push(1);o=o||i!==JSON.stringify(t.nanColor);const a=o||JSON.stringify(t.nodes);if(r.RGBPoints){const e=r.RGBPoints.length;t.nodes=[];const n=.5,o=0;for(let i=0;ie.RGBPoints).filter(e=>"CIELAB"!==e.ColorSpace).forEach(e=>{X_[e.Name]=e});const $_=Object.keys(X_);$_.sort();var q_={addPreset:function(e){e.RGBPoints&&"CIELAB"!==e.ColorSpace&&(X_[e.Name]||($_.push(e.Name),$_.sort()),X_[e.Name]=e)},removePresetByName:function(e){const t=$_.indexOf(e);t>-1&&$_.splice(t,1),delete X_[e]},getPresetByName:function(e){return X_[e]},rgbPresetNames:$_};e=r.hmd(e),console.log("[VTK Bundle] GLTFImporter included in bundle");var Y_={Rendering:{Core:{vtkActor:ss,vtkMapper:Gl,vtkTexture:vc,vtkProperty:os,vtkAnnotatedCubeActor:vv,vtkCamera:Lh,vtkRenderWindow:nm,vtkRenderWindowInteractor:xm,vtkRenderer:Jh,vtkColorTransferFunction:K_},Misc:{vtkFullScreenRenderWindow:Zy},OpenGL:{vtkRenderWindow:Hg}},Interaction:{Style:{vtkInteractorStyleTrackballCamera:Fm},Widgets:{vtkOrientationMarkerWidget:Tv}},IO:{Geometry:{vtkSTLReader:Hv,vtkPLYReader:ob,vtkGLTFImporter:f_},Misc:{vtkOBJReader:pb},XML:{vtkXMLPolyDataReader:gx}},Filters:{Core:{vtkPolyDataNormals:vx,vtkCutter:v_},General:{vtkWindowedSincPolyDataFilter:__,vtkOutlineFilter:E_},Sources:{vtkConeSource:I_,vtkSphereSource:M_,vtkCubeSource:uv}},Common:{Core:{vtkDataArray:_s},DataModel:{vtkPlane:ea}},_gltfAvailable:!0};K_.vtkColorMaps=q_,e.exports&&(e.exports=Y_),"undefined"!=typeof window&&(window.vtk=Y_),void 0!==r.g&&(r.g.vtk=Y_);const J_=Y_},41(e,t,r){"use strict";var n=r(655),o=r(68),i=r(675),a=r(795);e.exports=function(e,t,r){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new i("`obj` must be an object or a function`");if("string"!=typeof t&&"symbol"!=typeof t)throw new i("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new i("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new i("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new i("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new i("`loose`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,l=arguments.length>4?arguments[4]:null,u=arguments.length>5?arguments[5]:null,c=arguments.length>6&&arguments[6],d=!!a&&a(e,t);if(n)n(e,t,{configurable:null===u&&d?d.configurable:!u,enumerable:null===s&&d?d.enumerable:!s,value:r,writable:null===l&&d?d.writable:!l});else{if(!c&&(s||l||u))throw new o("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");e[t]=r}}},452(e,t,r){"use strict";var n=r(189),o="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),i=Object.prototype.toString,a=Array.prototype.concat,s=r(41),l=r(592)(),u=function(e,t,r,n){if(t in e)if(!0===n){if(e[t]===r)return}else if("function"!=typeof(o=n)||"[object Function]"!==i.call(o)||!n())return;var o;l?s(e,t,r,!0):s(e,t,r)},c=function(e,t){var r=arguments.length>2?arguments[2]:{},i=n(t);o&&(i=a.call(i,Object.getOwnPropertySymbols(t)));for(var s=0;s0&&!o.call(e,0))for(var m=0;m0)for(var g=0;g=0&&"[object Function]"===t.call(e.callee)),n}},391(e,t,r){var n=r(180),o=r(181),i=r(31),a=r(67),s=r(833),l=r(717),u=r(801);u.alea=n,u.xor128=o,u.xorwow=i,u.xorshift7=a,u.xor4096=s,u.tychei=l,e.exports=u},180(e,t,r){var n;!function(e,o){function i(e){var t,r=this,n=(t=4022871197,function(e){e=String(e);for(var r=0;r>>0,t=(n*=t)>>>0,t+=4294967296*(n-=t)}return 2.3283064365386963e-10*(t>>>0)});r.next=function(){var e=2091639*r.s0+2.3283064365386963e-10*r.c;return r.s0=r.s1,r.s1=r.s2,r.s2=e-(r.c=0|e)},r.c=1,r.s0=n(" "),r.s1=n(" "),r.s2=n(" "),r.s0-=n(e),r.s0<0&&(r.s0+=1),r.s1-=n(e),r.s1<0&&(r.s1+=1),r.s2-=n(e),r.s2<0&&(r.s2+=1),n=null}function a(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function s(e,t){var r=new i(e),n=t&&t.state,o=r.next;return o.int32=function(){return 4294967296*r.next()|0},o.double=function(){return o()+11102230246251565e-32*(2097152*o()|0)},o.quick=o,n&&("object"==typeof n&&a(n,r),o.state=function(){return a(r,{})}),o}o&&o.exports?o.exports=s:r.amdD&&r.amdO?void 0===(n=function(){return s}.call(t,r,t,o))||(o.exports=n):this.alea=s}(0,e=r.nmd(e),r.amdD)},717(e,t,r){var n;!function(e,o){function i(e){var t=this,r="";t.next=function(){var e=t.b,r=t.c,n=t.d,o=t.a;return e=e<<25^e>>>7^r,r=r-n|0,n=n<<24^n>>>8^o,o=o-e|0,t.b=e=e<<20^e>>>12^r,t.c=r=r-n|0,t.d=n<<16^r>>>16^o,t.a=o-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):r+=e;for(var n=0;n>>0)/4294967296};return o.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=r.next,o.quick=o,n&&("object"==typeof n&&a(n,r),o.state=function(){return a(r,{})}),o}o&&o.exports?o.exports=s:r.amdD&&r.amdO?void 0===(n=function(){return s}.call(t,r,t,o))||(o.exports=n):this.tychei=s}(0,e=r.nmd(e),r.amdD)},181(e,t,r){var n;!function(e,o){function i(e){var t=this,r="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:r+=e;for(var n=0;n>>0)/4294967296};return o.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=r.next,o.quick=o,n&&("object"==typeof n&&a(n,r),o.state=function(){return a(r,{})}),o}o&&o.exports?o.exports=s:r.amdD&&r.amdO?void 0===(n=function(){return s}.call(t,r,t,o))||(o.exports=n):this.xor128=s}(0,e=r.nmd(e),r.amdD)},833(e,t,r){var n;!function(e,o){function i(e){var t=this;t.next=function(){var e,r,n=t.w,o=t.X,i=t.i;return t.w=n=n+1640531527|0,r=o[i+34&127],e=o[i=i+1&127],r^=r<<13,e^=e<<17,r^=r>>>15,e^=e>>>12,r=o[i]=r^e,t.i=i,r+(n^n>>>16)|0},function(e,t){var r,n,o,i,a,s=[],l=128;for(t===(0|t)?(n=t,t=null):(t+="\0",n=0,l=Math.max(l,t.length)),o=0,i=-32;i>>15,n^=n<<4,n^=n>>>13,i>=0&&(a=a+1640531527|0,o=0==(r=s[127&i]^=n+a)?o+1:0);for(o>=128&&(s[127&(t&&t.length||0)]=-1),o=127,i=512;i>0;--i)n=s[o+34&127],r=s[o=o+1&127],n^=n<<13,r^=r<<17,n^=n>>>15,r^=r>>>12,s[o]=n^r;e.w=a,e.X=s,e.i=o}(t,e)}function a(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function s(e,t){null==e&&(e=+new Date);var r=new i(e),n=t&&t.state,o=function(){return(r.next()>>>0)/4294967296};return o.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=r.next,o.quick=o,n&&(n.X&&a(n,r),o.state=function(){return a(r,{})}),o}o&&o.exports?o.exports=s:r.amdD&&r.amdO?void 0===(n=function(){return s}.call(t,r,t,o))||(o.exports=n):this.xor4096=s}(0,e=r.nmd(e),r.amdD)},67(e,t,r){var n;!function(e,o){function i(e){var t=this;t.next=function(){var e,r,n=t.x,o=t.i;return e=n[o],r=(e^=e>>>7)^e<<24,r^=(e=n[o+1&7])^e>>>10,r^=(e=n[o+3&7])^e>>>3,r^=(e=n[o+4&7])^e<<7,e=n[o+7&7],r^=(e^=e<<13)^e<<9,n[o]=r,t.i=o+1&7,r},function(e,t){var r,n=[];if(t===(0|t))n[0]=t;else for(t=""+t,r=0;r0;--r)e.next()}(t,e)}function a(e,t){return t.x=e.x.slice(),t.i=e.i,t}function s(e,t){null==e&&(e=+new Date);var r=new i(e),n=t&&t.state,o=function(){return(r.next()>>>0)/4294967296};return o.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=r.next,o.quick=o,n&&(n.x&&a(n,r),o.state=function(){return a(r,{})}),o}o&&o.exports?o.exports=s:r.amdD&&r.amdO?void 0===(n=function(){return s}.call(t,r,t,o))||(o.exports=n):this.xorshift7=s}(0,e=r.nmd(e),r.amdD)},31(e,t,r){var n;!function(e,o){function i(e){var t=this,r="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:r+=e;for(var n=0;n>>4),t.next()}function a(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function s(e,t){var r=new i(e),n=t&&t.state,o=function(){return(r.next()>>>0)/4294967296};return o.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=r.next,o.quick=o,n&&("object"==typeof n&&a(n,r),o.state=function(){return a(r,{})}),o}o&&o.exports?o.exports=s:r.amdD&&r.amdO?void 0===(n=function(){return s}.call(t,r,t,o))||(o.exports=n):this.xorwow=s}(0,e=r.nmd(e),r.amdD)},801(e,t,r){var n;!function(o,i,a){var s,l=256,u=a.pow(l,6),c=a.pow(2,52),d=2*c,p=255;function f(e,t,r){var n=[],p=y(g((t=1==t?{entropy:!0}:t||{}).entropy?[e,v(i)]:null==e?function(){try{var e;return s&&(e=s.randomBytes)?e=e(l):(e=new Uint8Array(l),(o.crypto||o.msCrypto).getRandomValues(e)),v(e)}catch(e){var t=o.navigator,r=t&&t.plugins;return[+new Date,o,r,o.screen,v(i)]}}():e,3),n),f=new h(n),b=function(){for(var e=f.g(6),t=u,r=0;e=d;)e/=2,t/=2,r>>>=1;return(e+r)/t};return b.int32=function(){return 0|f.g(4)},b.quick=function(){return f.g(4)/4294967296},b.double=b,y(v(f.S),i),(t.pass||r||function(e,t,r,n){return n&&(n.S&&m(n,f),e.state=function(){return m(f,{})}),r?(a.random=e,t):e})(b,p,"global"in t?t.global:this==a,t.state)}function h(e){var t,r=e.length,n=this,o=0,i=n.i=n.j=0,a=n.S=[];for(r||(e=[r++]);o>>25)+n|0)&n|~r&o)+t[1]-389564586|0)<<12|i>>>20)+r|0)&r|~i&n)+t[2]+606105819|0)<<17|o>>>15)+i|0)&i|~o&r)+t[3]-1044525330|0)<<22|n>>>10)+o|0,n=((n+=((o=((o+=((i=((i+=((r=((r+=(n&o|~n&i)+t[4]-176418897|0)<<7|r>>>25)+n|0)&n|~r&o)+t[5]+1200080426|0)<<12|i>>>20)+r|0)&r|~i&n)+t[6]-1473231341|0)<<17|o>>>15)+i|0)&i|~o&r)+t[7]-45705983|0)<<22|n>>>10)+o|0,n=((n+=((o=((o+=((i=((i+=((r=((r+=(n&o|~n&i)+t[8]+1770035416|0)<<7|r>>>25)+n|0)&n|~r&o)+t[9]-1958414417|0)<<12|i>>>20)+r|0)&r|~i&n)+t[10]-42063|0)<<17|o>>>15)+i|0)&i|~o&r)+t[11]-1990404162|0)<<22|n>>>10)+o|0,n=((n+=((o=((o+=((i=((i+=((r=((r+=(n&o|~n&i)+t[12]+1804603682|0)<<7|r>>>25)+n|0)&n|~r&o)+t[13]-40341101|0)<<12|i>>>20)+r|0)&r|~i&n)+t[14]-1502002290|0)<<17|o>>>15)+i|0)&i|~o&r)+t[15]+1236535329|0)<<22|n>>>10)+o|0,n=((n+=((o=((o+=((i=((i+=((r=((r+=(n&i|o&~i)+t[1]-165796510|0)<<5|r>>>27)+n|0)&o|n&~o)+t[6]-1069501632|0)<<9|i>>>23)+r|0)&n|r&~n)+t[11]+643717713|0)<<14|o>>>18)+i|0)&r|i&~r)+t[0]-373897302|0)<<20|n>>>12)+o|0,n=((n+=((o=((o+=((i=((i+=((r=((r+=(n&i|o&~i)+t[5]-701558691|0)<<5|r>>>27)+n|0)&o|n&~o)+t[10]+38016083|0)<<9|i>>>23)+r|0)&n|r&~n)+t[15]-660478335|0)<<14|o>>>18)+i|0)&r|i&~r)+t[4]-405537848|0)<<20|n>>>12)+o|0,n=((n+=((o=((o+=((i=((i+=((r=((r+=(n&i|o&~i)+t[9]+568446438|0)<<5|r>>>27)+n|0)&o|n&~o)+t[14]-1019803690|0)<<9|i>>>23)+r|0)&n|r&~n)+t[3]-187363961|0)<<14|o>>>18)+i|0)&r|i&~r)+t[8]+1163531501|0)<<20|n>>>12)+o|0,n=((n+=((o=((o+=((i=((i+=((r=((r+=(n&i|o&~i)+t[13]-1444681467|0)<<5|r>>>27)+n|0)&o|n&~o)+t[2]-51403784|0)<<9|i>>>23)+r|0)&n|r&~n)+t[7]+1735328473|0)<<14|o>>>18)+i|0)&r|i&~r)+t[12]-1926607734|0)<<20|n>>>12)+o|0,n=((n+=((o=((o+=((i=((i+=((r=((r+=(n^o^i)+t[5]-378558|0)<<4|r>>>28)+n|0)^n^o)+t[8]-2022574463|0)<<11|i>>>21)+r|0)^r^n)+t[11]+1839030562|0)<<16|o>>>16)+i|0)^i^r)+t[14]-35309556|0)<<23|n>>>9)+o|0,n=((n+=((o=((o+=((i=((i+=((r=((r+=(n^o^i)+t[1]-1530992060|0)<<4|r>>>28)+n|0)^n^o)+t[4]+1272893353|0)<<11|i>>>21)+r|0)^r^n)+t[7]-155497632|0)<<16|o>>>16)+i|0)^i^r)+t[10]-1094730640|0)<<23|n>>>9)+o|0,n=((n+=((o=((o+=((i=((i+=((r=((r+=(n^o^i)+t[13]+681279174|0)<<4|r>>>28)+n|0)^n^o)+t[0]-358537222|0)<<11|i>>>21)+r|0)^r^n)+t[3]-722521979|0)<<16|o>>>16)+i|0)^i^r)+t[6]+76029189|0)<<23|n>>>9)+o|0,n=((n+=((o=((o+=((i=((i+=((r=((r+=(n^o^i)+t[9]-640364487|0)<<4|r>>>28)+n|0)^n^o)+t[12]-421815835|0)<<11|i>>>21)+r|0)^r^n)+t[15]+530742520|0)<<16|o>>>16)+i|0)^i^r)+t[2]-995338651|0)<<23|n>>>9)+o|0,n=((n+=((i=((i+=(n^((r=((r+=(o^(n|~i))+t[0]-198630844|0)<<6|r>>>26)+n|0)|~o))+t[7]+1126891415|0)<<10|i>>>22)+r|0)^((o=((o+=(r^(i|~n))+t[14]-1416354905|0)<<15|o>>>17)+i|0)|~r))+t[5]-57434055|0)<<21|n>>>11)+o|0,n=((n+=((i=((i+=(n^((r=((r+=(o^(n|~i))+t[12]+1700485571|0)<<6|r>>>26)+n|0)|~o))+t[3]-1894986606|0)<<10|i>>>22)+r|0)^((o=((o+=(r^(i|~n))+t[10]-1051523|0)<<15|o>>>17)+i|0)|~r))+t[1]-2054922799|0)<<21|n>>>11)+o|0,n=((n+=((i=((i+=(n^((r=((r+=(o^(n|~i))+t[8]+1873313359|0)<<6|r>>>26)+n|0)|~o))+t[15]-30611744|0)<<10|i>>>22)+r|0)^((o=((o+=(r^(i|~n))+t[6]-1560198380|0)<<15|o>>>17)+i|0)|~r))+t[13]+1309151649|0)<<21|n>>>11)+o|0,n=((n+=((i=((i+=(n^((r=((r+=(o^(n|~i))+t[4]-145523070|0)<<6|r>>>26)+n|0)|~o))+t[11]-1120210379|0)<<10|i>>>22)+r|0)^((o=((o+=(r^(i|~n))+t[2]+718787259|0)<<15|o>>>17)+i|0)|~r))+t[9]-343485551|0)<<21|n>>>11)+o|0,e[0]=r+e[0]|0,e[1]=n+e[1]|0,e[2]=o+e[2]|0,e[3]=i+e[3]|0}function r(e){var t,r=[];for(t=0;t<64;t+=4)r[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return r}function n(e){var t,r=[];for(t=0;t<64;t+=4)r[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return r}function o(e){var n,o,i,a,s,l,u=e.length,c=[1732584193,-271733879,-1732584194,271733878];for(n=64;n<=u;n+=64)t(c,r(e.substring(n-64,n)));for(o=(e=e.substring(n-64)).length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],n=0;n>2]|=e.charCodeAt(n)<<(n%4<<3);if(i[n>>2]|=128<<(n%4<<3),n>55)for(t(c,i),n=0;n<16;n+=1)i[n]=0;return a=(a=8*u).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(a[2],16),l=parseInt(a[1],16)||0,i[14]=s,i[15]=l,t(c,i),c}function i(t){var r,n="";for(r=0;r<4;r+=1)n+=e[t>>8*r+4&15]+e[t>>8*r&15];return n}function a(e){var t;for(t=0;tu?new ArrayBuffer(0):(n=u-l,o=new ArrayBuffer(n),i=new Uint8Array(o),a=new Uint8Array(this,l,n),i.set(a),o)}}(),u.prototype.append=function(e){return this.appendBinary(s(e)),this},u.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var n,o=this._buff.length;for(n=64;n<=o;n+=64)t(this._hash,r(this._buff.substring(n-64,n)));return this._buff=this._buff.substring(n-64),this},u.prototype.end=function(e){var t,r,n=this._buff,o=n.length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t>2]|=n.charCodeAt(t)<<(t%4<<3);return this._finish(i,o),r=a(this._hash),e&&(r=l(r)),this.reset(),r},u.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},u.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},u.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},u.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},u.prototype._finish=function(e,r){var n,o,i,a=r;if(e[a>>2]|=128<<(a%4<<3),a>55)for(t(this._hash,e),a=0;a<16;a+=1)e[a]=0;n=(n=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(n[2],16),i=parseInt(n[1],16)||0,e[14]=o,e[15]=i,t(this._hash,e)},u.hash=function(e,t){return u.hashBinary(s(e),t)},u.hashBinary=function(e,t){var r=a(o(e));return t?l(r):r},u.ArrayBuffer=function(){this.reset()},u.ArrayBuffer.prototype.append=function(e){var r,o,i,a,s,l=(o=this._buff.buffer,i=e,a=!0,(s=new Uint8Array(o.byteLength+i.byteLength)).set(new Uint8Array(o)),s.set(new Uint8Array(i),o.byteLength),a?s:s.buffer),u=l.length;for(this._length+=e.byteLength,r=64;r<=u;r+=64)t(this._hash,n(l.subarray(r-64,r)));return this._buff=r-64>2]|=n[t]<<(t%4<<3);return this._finish(i,o),r=a(this._hash),e&&(r=l(r)),this.reset(),r},u.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},u.ArrayBuffer.prototype.getState=function(){var e,t=u.prototype.getState.call(this);return t.buff=(e=t.buff,String.fromCharCode.apply(null,new Uint8Array(e))),t},u.ArrayBuffer.prototype.setState=function(e){return e.buff=function(e,t){var r,n=e.length,o=new ArrayBuffer(n),i=new Uint8Array(o);for(r=0;r>2]|=e[r]<<(r%4<<3);if(i[r>>2]|=128<<(r%4<<3),r>55)for(t(c,i),r=0;r<16;r+=1)i[r]=0;return a=(a=8*u).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(a[2],16),l=parseInt(a[1],16)||0,i[14]=s,i[15]=l,t(c,i),c}(new Uint8Array(e)));return r?l(o):o},u}()},570(e){e.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=184)}([function(e,t,r){"use strict";function n(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0}),n(r(240)),n(r(251)),n(r(175)),n(r(107)),n(r(29)),n(r(73)),n(r(106)),n(r(30)),n(r(252)),n(r(52)),n(r(97)),n(r(253)),n(r(37)),n(r(51)),n(r(173)),n(r(176)),n(r(172)),n(r(108)),n(r(254)),n(r(255)),n(r(256)),n(r(72)),n(r(177)),n(r(105)),n(r(17)),n(r(257)),n(r(12)),n(r(174))},function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=r(212);t.FixedSizeSet=o.FixedSizeSet;var i=r(213);t.ObjectCache=i.ObjectCache;var a=r(214);t.CompareCache=a.CompareCache;var s=r(215);t.Lazy=s.Lazy;var l=r(216);function u(e,t,r){if(m(e))e.forEach(function(e,n){return t.call(r,n,e)});else for(var n in e)e.hasOwnProperty(n)&&t.call(r,n,e[n])}function c(e){var t,r;if(d(e))return e;if(f(e)){var o=[];try{for(var i=n(e),a=i.next();!a.done;a=i.next()){var s=a.value;o.push(c(s))}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return o}if(p(e)){for(var l in o={},e)if(e.hasOwnProperty(l)){var u=e[l];o[l]=c(u)}return o}return e}function d(e){return!!e&&"[object Function]"===Object.prototype.toString.call(e)}function p(e){var t=typeof e;return!!e&&("function"===t||"object"===t)}function f(e){return Array.isArray(e)}function h(e){return e instanceof Set}function m(e){return e instanceof Map}function g(e){if(p(e)){var t=Object.getPrototypeOf(e),r=t.constructor;return t&&r&&"function"==typeof r&&r instanceof r&&Function.prototype.toString.call(r)===Function.prototype.toString.call(Object)}return!1}t.StringWalker=l.StringWalker,t.applyMixin=function(e,t){for(var r=[],n=2;n>6|192;else{if(o>55295&&o<56320){if(++n>=e.length)throw new Error("Incomplete surrogate pair.");var i=e.charCodeAt(n);if(i<56320||i>57343)throw new Error("Invalid surrogate character.");o=65536+((1023&o)<<10)+(1023&i),t[r++]=o>>18|240,t[r++]=o>>12&63|128}else t[r++]=o>>12|224;t[r++]=o>>6&63|128}t[r++]=63&o|128}}return t.subarray(0,r)},t.utf8Decode=function(e){for(var t="",r=0;r127)if(n>191&&n<224){if(r>=e.length)throw new Error("Incomplete 2-byte sequence.");n=(31&n)<<6|63&e[r++]}else if(n>223&&n<240){if(r+1>=e.length)throw new Error("Incomplete 3-byte sequence.");n=(15&n)<<12|(63&e[r++])<<6|63&e[r++]}else{if(!(n>239&&n<248))throw new Error("Unknown multi-byte start.");if(r+2>=e.length)throw new Error("Incomplete 4-byte sequence.");n=(7&n)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++]}if(n<=65535)t+=String.fromCharCode(n);else{if(!(n<=1114111))throw new Error("Code point exceeds UTF-16 limit.");n-=65536,t+=String.fromCharCode(n>>10|55296),t+=String.fromCharCode(1023&n|56320)}}return t}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.Before=0]="Before",e[e.Equal=1]="Equal",e[e.After=2]="After"}(t.BoundaryPosition||(t.BoundaryPosition={})),function(e){e[e.None=0]="None",e[e.Capturing=1]="Capturing",e[e.AtTarget=2]="AtTarget",e[e.Bubbling=3]="Bubbling"}(t.EventPhase||(t.EventPhase={})),function(e){e[e.Element=1]="Element",e[e.Attribute=2]="Attribute",e[e.Text=3]="Text",e[e.CData=4]="CData",e[e.EntityReference=5]="EntityReference",e[e.Entity=6]="Entity",e[e.ProcessingInstruction=7]="ProcessingInstruction",e[e.Comment=8]="Comment",e[e.Document=9]="Document",e[e.DocumentType=10]="DocumentType",e[e.DocumentFragment=11]="DocumentFragment",e[e.Notation=12]="Notation"}(t.NodeType||(t.NodeType={})),function(e){e[e.Disconnected=1]="Disconnected",e[e.Preceding=2]="Preceding",e[e.Following=4]="Following",e[e.Contains=8]="Contains",e[e.ContainedBy=16]="ContainedBy",e[e.ImplementationSpecific=32]="ImplementationSpecific"}(t.Position||(t.Position={})),function(e){e[e.Accept=1]="Accept",e[e.Reject=2]="Reject",e[e.Skip=3]="Skip"}(t.FilterResult||(t.FilterResult={})),function(e){e[e.All=4294967295]="All",e[e.Element=1]="Element",e[e.Attribute=2]="Attribute",e[e.Text=4]="Text",e[e.CDataSection=8]="CDataSection",e[e.EntityReference=16]="EntityReference",e[e.Entity=32]="Entity",e[e.ProcessingInstruction=64]="ProcessingInstruction",e[e.Comment=128]="Comment",e[e.Document=256]="Document",e[e.DocumentType=512]="DocumentType",e[e.DocumentFragment=1024]="DocumentFragment",e[e.Notation=2048]="Notation"}(t.WhatToShow||(t.WhatToShow={})),function(e){e[e.StartToStart=0]="StartToStart",e[e.StartToEnd=1]="StartToEnd",e[e.EndToEnd=2]="EndToEnd",e[e.EndToStart=3]="EndToStart"}(t.HowToCompare||(t.HowToCompare={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(241);t.Cast=n.Cast;var o=r(150);t.Guard=o.Guard;var i=r(242);t.EmptySet=i.EmptySet},function(e,t,r){var n=r(11),o=r(55).f,i=r(21),a=r(25),s=r(80),l=r(119),u=r(123);e.exports=function(e,t){var r,c,d,p,f,h=e.target,m=e.global,g=e.stat;if(r=m?n:g?n[h]||s(h,{}):(n[h]||{}).prototype)for(c in t){if(p=t[c],d=e.noTargetGet?(f=o(r,c))&&f.value:r[c],!u(m?c:h+(g?".":"#")+c,e.forced)&&void 0!==d){if(typeof p==typeof d)continue;l(p,d)}(e.sham||d&&d.sham)&&i(p,"sham",!0),a(r,c,p,e)}}},function(e,t,r){var n=r(11),o=r(81),i=r(14),a=r(58),s=r(86),l=r(124),u=o("wks"),c=n.Symbol,d=l?c:c&&c.withoutSetter||a;e.exports=function(e){return i(u,e)||(s&&i(c,e)?u[e]=c[e]:u[e]=d("Symbol."+e)),u[e]}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),o=r(29),i=function(){function e(){this._features={mutationObservers:!0,customElements:!0,slots:!0,steps:!0},this._window=null,this._compareCache=new n.CompareCache,this._rangeList=new n.FixedSizeSet}return e.prototype.setFeatures=function(e){if(void 0===e&&(e=!0),n.isObject(e))for(var t in e)this._features[t]=e[t]||!1;else for(var t in this._features)this._features[t]=e},Object.defineProperty(e.prototype,"features",{get:function(){return this._features},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"window",{get:function(){return null===this._window&&(this._window=o.create_window()),this._window},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"compareCache",{get:function(){return this._compareCache},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rangeList",{get:function(){return this._rangeList},enumerable:!0,configurable:!0}),Object.defineProperty(e,"instance",{get:function(){return e._instance||(e._instance=new e),e._instance},enumerable:!0,configurable:!0}),e}();t.dom=i.instance},function(e,t,r){"use strict";var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var o=n(r(228));t.base64=o;var i=n(r(146));t.byte=i;var a=n(r(147));t.byteSequence=a;var s=n(r(96));t.codePoint=s;var l=n(r(232));t.json=l;var u=n(r(233));t.list=u;var c=n(r(234));t.map=c;var d=n(r(235));t.namespace=d;var p=n(r(236));t.queue=p;var f=n(r(237));t.set=f;var h=n(r(238));t.stack=h;var m=n(r(239));t.string=m},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(t,r){void 0===r&&(r="");var n=e.call(this,r)||this;return n.name=t,n}return o(t,e),t}(Error);t.DOMException=i;var a=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"DOMStringSizeError",t)||this}return o(t,e),t}(i);t.DOMStringSizeError=a;var s=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"WrongDocumentError","The object is in the wrong document. "+t)||this}return o(t,e),t}(i);t.WrongDocumentError=s;var l=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NoDataAllowedError",t)||this}return o(t,e),t}(i);t.NoDataAllowedError=l;var u=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NoModificationAllowedError","The object can not be modified. "+t)||this}return o(t,e),t}(i);t.NoModificationAllowedError=u;var c=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NotSupportedError","The operation is not supported. "+t)||this}return o(t,e),t}(i);t.NotSupportedError=c;var d=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InUseAttributeError",t)||this}return o(t,e),t}(i);t.InUseAttributeError=d;var p=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidStateError","The object is in an invalid state. "+t)||this}return o(t,e),t}(i);t.InvalidStateError=p;var f=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidModificationError","The object can not be modified in this way. "+t)||this}return o(t,e),t}(i);t.InvalidModificationError=f;var h=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NamespaceError","The operation is not allowed by Namespaces in XML. [XMLNS] "+t)||this}return o(t,e),t}(i);t.NamespaceError=h;var m=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidAccessError","The object does not support the operation or argument. "+t)||this}return o(t,e),t}(i);t.InvalidAccessError=m;var g=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"ValidationError",t)||this}return o(t,e),t}(i);t.ValidationError=g;var y=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"TypeMismatchError",t)||this}return o(t,e),t}(i);t.TypeMismatchError=y;var v=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"SecurityError","The operation is insecure. "+t)||this}return o(t,e),t}(i);t.SecurityError=v;var b=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NetworkError","A network error occurred. "+t)||this}return o(t,e),t}(i);t.NetworkError=b;var x=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"AbortError","The operation was aborted. "+t)||this}return o(t,e),t}(i);t.AbortError=x;var _=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"URLMismatchError","The given URL does not match another URL. "+t)||this}return o(t,e),t}(i);t.URLMismatchError=_;var S=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"QuotaExceededError","The quota has been exceeded. "+t)||this}return o(t,e),t}(i);t.QuotaExceededError=S;var C=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"TimeoutError","The operation timed out. "+t)||this}return o(t,e),t}(i);t.TimeoutError=C;var T=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidNodeTypeError","The supplied node is incorrect or has an incorrect ancestor for this operation. "+t)||this}return o(t,e),t}(i);t.InvalidNodeTypeError=T;var w=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"DataCloneError","The object can not be cloned. "+t)||this}return o(t,e),t}(i);t.DataCloneError=w;var A=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NotImplementedError","The DOM method is not implemented by this module. "+t)||this}return o(t,e),t}(i);t.NotImplementedError=A;var E=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"HierarchyRequestError","The operation would yield an incorrect node tree. "+t)||this}return o(t,e),t}(i);t.HierarchyRequestError=E;var D=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"NotFoundError","The object can not be found here. "+t)||this}return o(t,e),t}(i);t.NotFoundError=D;var P=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"IndexSizeError","The index is not in the allowed range. "+t)||this}return o(t,e),t}(i);t.IndexSizeError=P;var I=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"SyntaxError","The string did not match the expected pattern. "+t)||this}return o(t,e),t}(i);t.SyntaxError=I;var O=function(e){function t(t){return void 0===t&&(t=""),e.call(this,"InvalidCharacterError","The string contains invalid characters. "+t)||this}return o(t,e),t}(i);t.InvalidCharacterError=O},function(e,t,r){"use strict";var n=r(53),o=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],i=["scalar","sequence","mapping"];e.exports=function(e,t){var r,a;if(t=t||{},Object.keys(t).forEach(function(t){if(-1===o.indexOf(t))throw new n('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')}),this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.defaultStyle=t.defaultStyle||null,this.styleAliases=(r=t.styleAliases||null,a={},null!==r&&Object.keys(r).forEach(function(e){r[e].forEach(function(t){a[String(t)]=e})}),a),-1===i.indexOf(this.kind))throw new n('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}},function(e,t,r){(function(t){var r=function(e){return e&&e.Math==Math&&e};e.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof t&&t)||Function("return this")()}).call(this,r(78))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.idl_defineConst=function(e,t,r){Object.defineProperty(e,t,{writable:!1,enumerable:!0,configurable:!1,value:r})}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t){var r={}.hasOwnProperty;e.exports=function(e,t){return r.call(e,t)}},function(e,t,r){var n=r(16),o=r(115),i=r(18),a=r(56),s=Object.defineProperty;t.f=n?s:function(e,t,r){if(i(e),t=a(t,!0),i(r),o)try{return s(e,t,r)}catch(e){}if("get"in r||"set"in r)throw TypeError("Accessors not supported");return"value"in r&&(e[t]=r.value),e}},function(e,t,r){var n=r(8);e.exports=!n(function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})},function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=r(3),i=r(2);function a(e,t,r){if(void 0===r&&(r=!1),r&&o.Guard.isElementNode(t)&&o.Guard.isShadowRoot(t.shadowRoot)&&t.shadowRoot._firstChild)return t.shadowRoot._firstChild;if(t._firstChild)return t._firstChild;if(t===e)return null;if(t._nextSibling)return t._nextSibling;for(var n=t._parent;n&&n!==e;){if(n._nextSibling)return n._nextSibling;n=n._parent}return null}function s(){var e;return(e={})[Symbol.iterator]=function(){return{next:function(){return{done:!0,value:null}}}},e}function l(e,t,r,n){void 0===t&&(t=!1),void 0===r&&(r=!1);for(var o=t?e:a(e,e,r);o&&n&&!n(o);)o=a(e,o,r);return o}function u(e,t,r,n,o){void 0===r&&(r=!1),void 0===n&&(n=!1);for(var i=a(e,t,n);i&&o&&!o(i);)i=a(e,i,n);return i}function c(e,t,r,n){var o;return void 0===t&&(t=!1),void 0===r&&(r=!1),t||0!==e._children.size?((o={})[Symbol.iterator]=function(){var o=t?e:a(e,e,r);return{next:function(){for(;o&&n&&!n(o);)o=a(e,o,r);if(null===o)return{done:!0,value:null};var t={done:!1,value:o};return o=a(e,o,r),t}}},o):s()}function d(e,t,r){void 0===t&&(t=!1);for(var n=t?e:e._parent;n&&r&&!r(n);)n=n._parent;return n}function p(e,t,r,n){void 0===r&&(r=!1);for(var o=t._parent;o&&n&&!n(o);)o=o._parent;return o}function f(e){return o.Guard.isDocumentTypeNode(e)?0:o.Guard.isCharacterDataNode(e)?e._data.length:e._children.size}function h(e,t){if(void 0===t&&(t=!1),t){var r=h(e,!1);return o.Guard.isShadowRoot(r)?h(r._host,!0):r}return e._parent?h(e._parent):e}function m(e,t,r,n){void 0===r&&(r=!1),void 0===n&&(n=!1);for(var i=r?e:n&&o.Guard.isShadowRoot(e)?e._host:e._parent;null!==i;){if(i===t)return!0;i=n&&o.Guard.isShadowRoot(i)?i._host:i._parent}return!1}function g(e){for(var t=h(e),r=0,n=l(t);null!==n;){if(r++,n===e)return r;n=u(t,n)}return-1}t.tree_getFirstDescendantNode=l,t.tree_getNextDescendantNode=u,t.tree_getDescendantNodes=c,t.tree_getDescendantElements=function(e,t,r,n){var i;return void 0===t&&(t=!1),void 0===r&&(r=!1),t||0!==e._children.size?((i={})[Symbol.iterator]=function(){var i=c(e,t,r,function(e){return o.Guard.isElementNode(e)})[Symbol.iterator](),a=i.next().value;return{next:function(){for(;a&&n&&!n(a);)a=i.next().value;if(null===a)return{done:!0,value:null};var e={done:!1,value:a};return a=i.next().value,e}}},i):s()},t.tree_getSiblingNodes=function(e,t,r){var n;return void 0===t&&(t=!1),e._parent&&0!==e._parent._children.size?((n={})[Symbol.iterator]=function(){var n=e._parent?e._parent._firstChild:null;return{next:function(){for(;n&&(r&&!r(n)||!t&&n===e);)n=n._nextSibling;if(null===n)return{done:!0,value:null};var o={done:!1,value:n};return n=n._nextSibling,o}}},n):s()},t.tree_getFirstAncestorNode=d,t.tree_getNextAncestorNode=p,t.tree_getAncestorNodes=function(e,t,r){var n;return void 0===t&&(t=!1),t||e._parent?((n={})[Symbol.iterator]=function(){var n=d(e,t,r);return{next:function(){if(null===n)return{done:!0,value:null};var e={done:!1,value:n};return n=p(0,n,t,r),e}}},n):s()},t.tree_getCommonAncestor=function(e,t){if(e===t)return e._parent;for(var r=[],n=[],o=d(e,!0);null!==o;)r.push(o),o=p(0,o,!0);for(var i=d(t,!0);null!==i;)n.push(i),i=p(0,i,!0);for(var a=r.length,s=n.length,l=null,u=Math.min(a,s);u>0;u--){var c=r[--a];if(c!==n[--s])break;l=c}return l},t.tree_getFollowingNode=function(e,t){if(t._firstChild)return t._firstChild;if(t._nextSibling)return t._nextSibling;for(;;){var r=t._parent;if(null===r||r===e)return null;if(r._nextSibling)return r._nextSibling;t=r}},t.tree_getPrecedingNode=function(e,t){return t===e?null:t._previousSibling?(t=t._previousSibling)._lastChild?t._lastChild:t:t._parent},t.tree_isConstrained=function e(t){var r,o,a,s,l,u;switch(t._nodeType){case i.NodeType.Document:var c=!1,d=!1;try{for(var p=n(t._children),f=p.next();!f.done;f=p.next())switch(f.value._nodeType){case i.NodeType.ProcessingInstruction:case i.NodeType.Comment:break;case i.NodeType.DocumentType:if(c||d)return!1;c=!0;break;case i.NodeType.Element:if(d)return!1;d=!0;break;default:return!1}}catch(e){r={error:e}}finally{try{f&&!f.done&&(o=p.return)&&o.call(p)}finally{if(r)throw r.error}}break;case i.NodeType.DocumentFragment:case i.NodeType.Element:try{for(var h=n(t._children),m=h.next();!m.done;m=h.next())switch(m.value._nodeType){case i.NodeType.Element:case i.NodeType.Text:case i.NodeType.ProcessingInstruction:case i.NodeType.CData:case i.NodeType.Comment:break;default:return!1}}catch(e){a={error:e}}finally{try{m&&!m.done&&(s=h.return)&&s.call(h)}finally{if(a)throw a.error}}break;case i.NodeType.DocumentType:case i.NodeType.Text:case i.NodeType.ProcessingInstruction:case i.NodeType.CData:case i.NodeType.Comment:return!t.hasChildNodes()}try{for(var g=n(t._children),y=g.next();!y.done;y=g.next())if(!e(y.value))return!1}catch(e){l={error:e}}finally{try{y&&!y.done&&(u=g.return)&&u.call(g)}finally{if(l)throw l.error}}return!0},t.tree_nodeLength=f,t.tree_isEmpty=function(e){return 0===f(e)},t.tree_rootNode=h,t.tree_isDescendantOf=function(e,t,r,n){void 0===r&&(r=!1),void 0===n&&(n=!1);for(var o=l(e,r,n);null!==o;){if(o===t)return!0;o=u(e,o,r,n)}return!1},t.tree_isAncestorOf=m,t.tree_isHostIncludingAncestorOf=function e(t,r,n){if(void 0===n&&(n=!1),m(t,r,n))return!0;var i=h(t);return!(!o.Guard.isDocumentFragmentNode(i)||null===i._host||!e(i._host,r,n))},t.tree_isSiblingOf=function(e,t,r){return void 0===r&&(r=!1),e!==t?null!==e._parent&&e._parent===t._parent:!!r},t.tree_isPreceding=function(e,t){var r=g(e),n=g(t);return-1!==r&&-1!==n&&h(e)===h(t)&&nr},t.tree_isParentOf=function(e,t){return e._parent===t},t.tree_isChildOf=function(e,t){return t._parent===e},t.tree_previousSibling=function(e){return e._previousSibling},t.tree_nextSibling=function(e){return e._nextSibling},t.tree_firstChild=function(e){return e._firstChild},t.tree_lastChild=function(e){return e._lastChild},t.tree_treePosition=g,t.tree_index=function(e){for(var t=0;null!==e._previousSibling;)t++,e=e._previousSibling;return t},t.tree_retarget=function(e,t){for(;;){if(!e||!o.Guard.isNode(e))return e;var r=h(e);if(!o.Guard.isShadowRoot(r))return e;if(t&&o.Guard.isNode(t)&&m(r,t,!0,!0))return e;e=r.host}}},function(e,t,r){var n=r(13);e.exports=function(e){if(!n(e))throw TypeError(String(e)+" is not an object");return e}},function(e,t,r){"use strict";var n=r(24),o=r(130),i=r(49),a=r(43),s=r(88),l=a.set,u=a.getterFor("Array Iterator");e.exports=s(Array,"Array",function(e,t){l(this,{type:"Array Iterator",target:n(e),index:0,kind:t})},function(){var e=u(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==r?{value:n,done:!1}:"values"==r?{value:t[n],done:!1}:{value:[n,t[n]],done:!1}},"values"),i.Arguments=i.Array,o("keys"),o("values"),o("entries")},function(e,t,r){var n=r(90),o=r(25),i=r(202);n||o(Object.prototype,"toString",i,{unsafe:!0})},function(e,t,r){var n=r(16),o=r(15),i=r(40);e.exports=n?function(e,t,r){return o.f(e,t,i(1,r))}:function(e,t,r){return e[t]=r,e}},function(e,t,r){"use strict";var n=r(137).charAt,o=r(43),i=r(88),a=o.set,s=o.getterFor("String Iterator");i(String,"String",function(e){a(this,{type:"String Iterator",string:String(e),index:0})},function(){var e,t=s(this),r=t.string,o=t.index;return o>=r.length?{value:void 0,done:!0}:(e=n(r,o),t.index+=e.length,{value:e,done:!1})})},function(e,t,r){var n=r(11),o=r(203),i=r(19),a=r(21),s=r(5),l=s("iterator"),u=s("toStringTag"),c=i.values;for(var d in o){var p=n[d],f=p&&p.prototype;if(f){if(f[l]!==c)try{a(f,l,c)}catch(e){f[l]=c}if(f[u]||a(f,u,d),o[d])for(var h in i)if(f[h]!==i[h])try{a(f,h,i[h])}catch(e){f[h]=i[h]}}}},function(e,t,r){var n=r(41),o=r(35);e.exports=function(e){return n(o(e))}},function(e,t,r){var n=r(11),o=r(21),i=r(14),a=r(80),s=r(117),l=r(43),u=l.get,c=l.enforce,d=String(String).split("String");(e.exports=function(e,t,r,s){var l=!!s&&!!s.unsafe,u=!!s&&!!s.enumerable,p=!!s&&!!s.noTargetGet;"function"==typeof r&&("string"!=typeof t||i(r,"name")||o(r,"name",t),c(r).source=d.join("string"==typeof t?t:"")),e!==n?(l?!p&&e[t]&&(u=!0):delete e[t],u?e[t]=r:o(e,t,r)):u?e[t]=r:a(t,r)})(Function.prototype,"toString",function(){return"function"==typeof this&&u(this).source||s(this)})},function(e,t,r){var n=r(47),o=Math.min;e.exports=function(e){return e>0?o(n(e),9007199254740991):0}},function(e,t,r){var n=r(35);e.exports=function(e){return Object(n(e))}},function(e,t,r){var n=r(16),o=r(8),i=r(14),a=Object.defineProperty,s={},l=function(e){throw e};e.exports=function(e,t){if(i(s,e))return s[e];t||(t={});var r=[][e],u=!!i(t,"ACCESSORS")&&t.ACCESSORS,c=i(t,0)?t[0]:l,d=i(t,1)?t[1]:void 0;return s[e]=!!r&&!o(function(){if(u&&!n)return!0;var e={length:-1};u?a(e,1,{enumerable:!0,get:l}):e[1]=1,r.call(e,c,d)})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(148),o=r(149),i=r(151),a=r(98),s=r(153),l=r(154),u=r(155),c=r(99),d=r(100),p=r(156),f=r(157),h=r(101),m=r(158),g=r(159),y=r(160),v=r(161),b=r(162),x=r(163),_=r(164),S=r(165),C=r(166),T=r(167),w=r(168),A=r(169),E=r(170);t.create_domImplementation=function(e){return n.DOMImplementationImpl._create(e)},t.create_window=function(){return o.WindowImpl._create()},t.create_xmlDocument=function(){return new i.XMLDocumentImpl},t.create_document=function(){return new a.DocumentImpl},t.create_abortController=function(){return new s.AbortControllerImpl},t.create_abortSignal=function(){return l.AbortSignalImpl._create()},t.create_documentType=function(e,t,r,n){return u.DocumentTypeImpl._create(e,t,r,n)},t.create_element=function(e,t,r,n){return c.ElementImpl._create(e,t,r,n)},t.create_htmlElement=function(e,t,r,n){return c.ElementImpl._create(e,t,r,n)},t.create_htmlUnknownElement=function(e,t,r,n){return c.ElementImpl._create(e,t,r,n)},t.create_documentFragment=function(e){return d.DocumentFragmentImpl._create(e)},t.create_shadowRoot=function(e,t){return p.ShadowRootImpl._create(e,t)},t.create_attr=function(e,t){return f.AttrImpl._create(e,t)},t.create_text=function(e,t){return h.TextImpl._create(e,t)},t.create_cdataSection=function(e,t){return m.CDATASectionImpl._create(e,t)},t.create_comment=function(e,t){return g.CommentImpl._create(e,t)},t.create_processingInstruction=function(e,t,r){return y.ProcessingInstructionImpl._create(e,t,r)},t.create_htmlCollection=function(e,t){return void 0===t&&(t=function(){return!0}),v.HTMLCollectionImpl._create(e,t)},t.create_nodeList=function(e){return b.NodeListImpl._create(e)},t.create_nodeListStatic=function(e,t){return x.NodeListStaticImpl._create(e,t)},t.create_namedNodeMap=function(e){return _.NamedNodeMapImpl._create(e)},t.create_range=function(e,t){return S.RangeImpl._create(e,t)},t.create_nodeIterator=function(e,t,r){return C.NodeIteratorImpl._create(e,t,r)},t.create_treeWalker=function(e,t){return T.TreeWalkerImpl._create(e,t)},t.create_nodeFilter=function(){return w.NodeFilterImpl._create()},t.create_mutationRecord=function(e,t,r,n,o,i,a,s,l){return A.MutationRecordImpl._create(e,t,r,n,o,i,a,s,l)},t.create_domTokenList=function(e,t){return E.DOMTokenListImpl._create(e,t)}},function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=r(6),i=r(17),a=r(3),s=r(72),l=new Map;function u(e,t){if(t!==e._root&&i.tree_isAncestorOf(e._reference,t,!0)){if(e._pointerBeforeReference)for(;;){var r=i.tree_getFollowingNode(e._root,t);if(null!==r&&i.tree_isDescendantOf(e._root,r,!0)&&!i.tree_isDescendantOf(t,r,!0))return void(e._reference=r);if(null===r)return void(e._pointerBeforeReference=!1)}if(null===t._previousSibling)null!==t._parent&&(e._reference=t._parent);else{for(var n=t._previousSibling,o=i.tree_getFirstDescendantNode(t._previousSibling,!0,!1);null!==o;)null!==o&&(n=o),o=i.tree_getNextDescendantNode(t._previousSibling,o,!0,!1);e._reference=n}}}function c(e,t,r,n,o){if(a.Guard.isSlot(e)&&"name"===t&&null===o){if(n===r)return;if(null===n&&""===r)return;if(""===n&&null===r)return;e._name=null===n||""===n?"":n,s.shadowTree_assignSlotablesForATree(i.tree_rootNode(e))}}function d(e,t,r,n,o){if(a.Guard.isSlotable(e)&&"slot"===t&&null===o){if(n===r)return;if(null===n&&""===r)return;if(""===n&&null===r)return;e._name=null===n||""===n?"":n,s.shadowTree_isAssigned(e)&&s.shadowTree_assignSlotables(e._assignedSlot),s.shadowTree_assignASlot(e)}}function p(e,t,r,n){"id"===t&&null===n&&(e._uniqueIdentifier=r||void 0)}t.dom_runRemovingSteps=function(e,t){},t.dom_runCloningSteps=function(e,t,r,n){},t.dom_runAdoptingSteps=function(e,t){},t.dom_runAttributeChangeSteps=function(e,t,r,i,a){var s,l;o.dom.features.slots&&(d.call(e,e,t,r,i,a),c.call(e,e,t,r,i,a)),p.call(e,e,t,i,a);try{for(var u=n(e._attributeChangeSteps),f=u.next();!f.done;f=u.next())f.value.call(e,e,t,r,i,a)}catch(e){s={error:e}}finally{try{f&&!f.done&&(l=u.return)&&l.call(u)}finally{if(s)throw s.error}}},t.dom_runInsertionSteps=function(e){},t.dom_runNodeIteratorPreRemovingSteps=function(e,t){u.call(e,e,t)},t.dom_hasSupportedTokens=function(e){return l.has(e)},t.dom_getSupportedTokens=function(e){return l.get(e)||new Set},t.dom_runEventConstructingSteps=function(e){},t.dom_runChildTextContentChangeSteps=function(e){}},function(e,t,r){"use strict";var n=r(4),o=r(11),i=r(46),a=r(44),s=r(16),l=r(86),u=r(124),c=r(8),d=r(14),p=r(59),f=r(13),h=r(18),m=r(27),g=r(24),y=r(56),v=r(40),b=r(60),x=r(61),_=r(82),S=r(190),C=r(85),T=r(55),w=r(15),A=r(79),E=r(21),D=r(25),P=r(81),I=r(57),O=r(45),N=r(58),M=r(5),R=r(125),F=r(126),B=r(62),L=r(43),k=r(36).forEach,U=I("hidden"),V=M("toPrimitive"),G=L.set,z=L.getterFor("Symbol"),j=Object.prototype,W=o.Symbol,H=i("JSON","stringify"),K=T.f,X=w.f,$=S.f,q=A.f,Y=P("symbols"),J=P("op-symbols"),Q=P("string-to-symbol-registry"),Z=P("symbol-to-string-registry"),ee=P("wks"),te=o.QObject,re=!te||!te.prototype||!te.prototype.findChild,ne=s&&c(function(){return 7!=b(X({},"a",{get:function(){return X(this,"a",{value:7}).a}})).a})?function(e,t,r){var n=K(j,t);n&&delete j[t],X(e,t,r),n&&e!==j&&X(j,t,n)}:X,oe=function(e,t){var r=Y[e]=b(W.prototype);return G(r,{type:"Symbol",tag:e,description:t}),s||(r.description=t),r},ie=u?function(e){return"symbol"==typeof e}:function(e){return Object(e)instanceof W},ae=function(e,t,r){e===j&&ae(J,t,r),h(e);var n=y(t,!0);return h(r),d(Y,n)?(r.enumerable?(d(e,U)&&e[U][n]&&(e[U][n]=!1),r=b(r,{enumerable:v(0,!1)})):(d(e,U)||X(e,U,v(1,{})),e[U][n]=!0),ne(e,n,r)):X(e,n,r)},se=function(e,t){h(e);var r=g(t),n=x(r).concat(de(r));return k(n,function(t){s&&!le.call(r,t)||ae(e,t,r[t])}),e},le=function(e){var t=y(e,!0),r=q.call(this,t);return!(this===j&&d(Y,t)&&!d(J,t))&&(!(r||!d(this,t)||!d(Y,t)||d(this,U)&&this[U][t])||r)},ue=function(e,t){var r=g(e),n=y(t,!0);if(r!==j||!d(Y,n)||d(J,n)){var o=K(r,n);return!o||!d(Y,n)||d(r,U)&&r[U][n]||(o.enumerable=!0),o}},ce=function(e){var t=$(g(e)),r=[];return k(t,function(e){d(Y,e)||d(O,e)||r.push(e)}),r},de=function(e){var t=e===j,r=$(t?J:g(e)),n=[];return k(r,function(e){!d(Y,e)||t&&!d(j,e)||n.push(Y[e])}),n};l||(D((W=function(){if(this instanceof W)throw TypeError("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?String(arguments[0]):void 0,t=N(e),r=function(e){this===j&&r.call(J,e),d(this,U)&&d(this[U],t)&&(this[U][t]=!1),ne(this,t,v(1,e))};return s&&re&&ne(j,t,{configurable:!0,set:r}),oe(t,e)}).prototype,"toString",function(){return z(this).tag}),D(W,"withoutSetter",function(e){return oe(N(e),e)}),A.f=le,w.f=ae,T.f=ue,_.f=S.f=ce,C.f=de,R.f=function(e){return oe(M(e),e)},s&&(X(W.prototype,"description",{configurable:!0,get:function(){return z(this).description}}),a||D(j,"propertyIsEnumerable",le,{unsafe:!0}))),n({global:!0,wrap:!0,forced:!l,sham:!l},{Symbol:W}),k(x(ee),function(e){F(e)}),n({target:"Symbol",stat:!0,forced:!l},{for:function(e){var t=String(e);if(d(Q,t))return Q[t];var r=W(t);return Q[t]=r,Z[r]=t,r},keyFor:function(e){if(!ie(e))throw TypeError(e+" is not a symbol");if(d(Z,e))return Z[e]},useSetter:function(){re=!0},useSimple:function(){re=!1}}),n({target:"Object",stat:!0,forced:!l,sham:!s},{create:function(e,t){return void 0===t?b(e):se(b(e),t)},defineProperty:ae,defineProperties:se,getOwnPropertyDescriptor:ue}),n({target:"Object",stat:!0,forced:!l},{getOwnPropertyNames:ce,getOwnPropertySymbols:de}),n({target:"Object",stat:!0,forced:c(function(){C.f(1)})},{getOwnPropertySymbols:function(e){return C.f(m(e))}}),H&&n({target:"JSON",stat:!0,forced:!l||c(function(){var e=W();return"[null]"!=H([e])||"{}"!=H({a:e})||"{}"!=H(Object(e))})},{stringify:function(e,t,r){for(var n,o=[e],i=1;arguments.length>i;)o.push(arguments[i++]);if(n=t,(f(t)||void 0!==e)&&!ie(e))return p(t)||(t=function(e,t){if("function"==typeof n&&(t=n.call(this,e,t)),!ie(t))return t}),o[1]=t,H.apply(null,o)}}),W.prototype[V]||E(W.prototype,V,W.prototype.valueOf),B(W,"Symbol"),O[U]=!0},function(e,t,r){"use strict";var n=r(4),o=r(16),i=r(11),a=r(14),s=r(13),l=r(15).f,u=r(119),c=i.Symbol;if(o&&"function"==typeof c&&(!("description"in c.prototype)||void 0!==c().description)){var d={},p=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:String(arguments[0]),t=this instanceof p?new c(e):void 0===e?c():c(e);return""===e&&(d[t]=!0),t};u(p,c);var f=p.prototype=c.prototype;f.constructor=p;var h=f.toString,m="Symbol(test)"==String(c("test")),g=/^Symbol\((.*)\)[^)]+$/;l(f,"description",{configurable:!0,get:function(){var e=s(this)?this.valueOf():this,t=h.call(e);if(a(d,e))return"";var r=m?t.slice(7,-1):t.replace(g,"$1");return""===r?void 0:r}}),n({global:!0,forced:!0},{Symbol:p})}},function(e,t,r){r(126)("iterator")},function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=r(6),s=r(2),l=r(70),u=r(3),c=r(9),d=r(0),p=r(152),f=r(12),h=function(e){function t(){var t=e.call(this)||this;return t._parent=null,t._firstChild=null,t._lastChild=null,t._previousSibling=null,t._nextSibling=null,t}return o(t,e),Object.defineProperty(t.prototype,"_childNodes",{get:function(){return this.__childNodes||(this.__childNodes=d.create_nodeList(this))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_nodeDocument",{get:function(){return this._nodeDocumentOverride||a.dom.window._associatedDocument},set:function(e){this._nodeDocumentOverride=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_registeredObserverList",{get:function(){return this.__registeredObserverList||(this.__registeredObserverList=[])},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nodeType",{get:function(){return this._nodeType},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nodeName",{get:function(){return u.Guard.isElementNode(this)?this._htmlUppercasedQualifiedName:u.Guard.isAttrNode(this)?this._qualifiedName:u.Guard.isExclusiveTextNode(this)?"#text":u.Guard.isCDATASectionNode(this)?"#cdata-section":u.Guard.isProcessingInstructionNode(this)?this._target:u.Guard.isCommentNode(this)?"#comment":u.Guard.isDocumentNode(this)?"#document":u.Guard.isDocumentTypeNode(this)?this._name:u.Guard.isDocumentFragmentNode(this)?"#document-fragment":""},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"baseURI",{get:function(){return p.urlSerializer(this._nodeDocument._URL)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isConnected",{get:function(){return u.Guard.isElementNode(this)&&d.shadowTree_isConnected(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"ownerDocument",{get:function(){return this._nodeType===s.NodeType.Document?null:this._nodeDocument},enumerable:!0,configurable:!0}),t.prototype.getRootNode=function(e){return d.tree_rootNode(this,!!e&&e.composed)},Object.defineProperty(t.prototype,"parentNode",{get:function(){return this._nodeType===s.NodeType.Attribute?null:this._parent},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"parentElement",{get:function(){return this._parent&&u.Guard.isElementNode(this._parent)?this._parent:null},enumerable:!0,configurable:!0}),t.prototype.hasChildNodes=function(){return null!==this._firstChild},Object.defineProperty(t.prototype,"childNodes",{get:function(){return this._childNodes},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"firstChild",{get:function(){return this._firstChild},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lastChild",{get:function(){return this._lastChild},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"previousSibling",{get:function(){return this._previousSibling},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nextSibling",{get:function(){return this._nextSibling},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nodeValue",{get:function(){return u.Guard.isAttrNode(this)?this._value:u.Guard.isCharacterDataNode(this)?this._data:null},set:function(e){null===e&&(e=""),u.Guard.isAttrNode(this)?d.attr_setAnExistingAttributeValue(this,e):u.Guard.isCharacterDataNode(this)&&d.characterData_replaceData(this,0,this._data.length,e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"textContent",{get:function(){return u.Guard.isDocumentFragmentNode(this)||u.Guard.isElementNode(this)?d.text_descendantTextContent(this):u.Guard.isAttrNode(this)?this._value:u.Guard.isCharacterDataNode(this)?this._data:null},set:function(e){null===e&&(e=""),u.Guard.isDocumentFragmentNode(this)||u.Guard.isElementNode(this)?d.node_stringReplaceAll(e,this):u.Guard.isAttrNode(this)?d.attr_setAnExistingAttributeValue(this,e):u.Guard.isCharacterDataNode(this)&&d.characterData_replaceData(this,0,d.tree_nodeLength(this),e)},enumerable:!0,configurable:!0}),t.prototype.normalize=function(){for(var e,t,r,n,o=[],s=d.tree_getFirstDescendantNode(this,!1,!1,function(e){return u.Guard.isExclusiveTextNode(e)});null!==s;)o.push(s),s=d.tree_getNextDescendantNode(this,s,!1,!1,function(e){return u.Guard.isExclusiveTextNode(e)});for(var l=0;lC;C++)if((p||C in x)&&(v=_(y=x[C],C,b),e))if(t)w[C]=v;else if(v)switch(e){case 3:return!0;case 5:return y;case 6:return C;case 2:l.call(w,y)}else if(c)return!1;return d?-1:u||c?c:w}};e.exports={forEach:u(0),map:u(1),filter:u(2),some:u(3),every:u(4),find:u(5),findIndex:u(6)}},function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t1)throw new s.HierarchyRequestError("A document node can only have one document element node. Document fragment to be inserted has "+v+" element nodes.");if(1===v){try{for(var S=n(t._children),C=S.next();!C.done;C=S.next())if(C.value._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("The document node already has a document element node.")}catch(e){a={error:e}}finally{try{C&&!C.done&&(u=S.return)&&u.call(S)}finally{if(a)throw a.error}}if(r){if(y===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node.");for(var T=r._nextSibling;T;){if(T._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node.");T=T._nextSibling}}}}else if(g===l.NodeType.Element){try{for(var w=n(t._children),A=w.next();!A.done;A=w.next())if(A.value._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("Document already has a document element node. Node is "+e.nodeName+".")}catch(e){c={error:e}}finally{try{A&&!A.done&&(d=w.return)&&d.call(w)}finally{if(c)throw c.error}}if(r){if(y===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node. Node is "+e.nodeName+".");for(T=r._nextSibling;T;){if(T._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node. Node is "+e.nodeName+".");T=T._nextSibling}}}else if(g===l.NodeType.DocumentType){try{for(var E=n(t._children),D=E.next();!D.done;D=E.next())if(D.value._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Document already has a document type node. Node is "+e.nodeName+".")}catch(e){p={error:e}}finally{try{D&&!D.done&&(h=E.return)&&h.call(E)}finally{if(p)throw p.error}}if(r)for(var P=r._previousSibling;P;){if(P._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("Cannot insert a document type node before an element node. Node is "+e.nodeName+".");P=P._previousSibling}else for(P=t._firstChild;P;){if(P._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("Cannot insert a document type node before an element node. Node is "+e.nodeName+".");P=P._nextSibling}}}function x(e,t,r){b(e,t,r);var n=r;return n===e&&(n=e._nextSibling),v.document_adopt(e,t._nodeDocument),_(e,t,n),e}function _(e,t,r,o){var s,h;if(null!==r||e._nodeType===l.NodeType.DocumentFragment){var v=e._nodeType===l.NodeType.DocumentFragment?e._children.size:1;if(null!==r&&0!==a.dom.rangeList.size){var b=f.tree_index(r);try{for(var x=n(a.dom.rangeList),_=x.next();!_.done;_=x.next()){var C=_.value;C._start[0]===t&&C._start[1]>b&&(C._start[1]+=v),C._end[0]===t&&C._end[1]>b&&(C._end[1]+=v)}}catch(e){s={error:e}}finally{try{_&&!_.done&&(h=x.return)&&h.call(x)}finally{if(s)throw s.error}}}var T=e._nodeType===l.NodeType.DocumentFragment?new(Array.bind.apply(Array,i([void 0],e._children))):[e];if(e._nodeType===l.NodeType.DocumentFragment)for(;e._firstChild;)S(e._firstChild,e,!0);a.dom.features.mutationObservers&&e._nodeType===l.NodeType.DocumentFragment&&g.observer_queueTreeMutationRecord(e,[],T,null,null);for(var w=r?r._previousSibling:t._lastChild,A=null===r?-1:f.tree_index(r),E=0;E_&&T._start[1]--,T._end[0]===t&&T._end[1]>_&&T._end[1]--}}catch(e){o={error:e}}finally{try{C&&!C.done&&(i=S.return)&&i.call(S)}finally{if(o)throw o.error}}try{for(var w=n(a.dom.rangeList),A=w.next();!A.done;A=w.next())(T=A.value)._start[0]===t&&T._start[1]>_&&(T._start[1]-=1),T._end[0]===t&&T._end[1]>_&&(T._end[1]-=1)}catch(e){s={error:e}}finally{try{A&&!A.done&&(l=w.return)&&l.call(w)}finally{if(s)throw s.error}}}if(a.dom.features.steps)try{for(var E=n(h.nodeIterator_iteratorList()),D=E.next();!D.done;D=E.next()){var P=D.value;P._root._nodeDocument===e._nodeDocument&&y.dom_runNodeIteratorPreRemovingSteps(P,e)}}catch(e){d={error:e}}finally{try{D&&!D.done&&(v=E.return)&&v.call(E)}finally{if(d)throw d.error}}var I=e._previousSibling,O=e._nextSibling;u.Guard.isDocumentNode(t)&&u.Guard.isElementNode(e)&&(t._documentElement=null),e._parent=null,t._children.delete(e);var N=e._previousSibling,M=e._nextSibling;e._previousSibling=null,e._nextSibling=null,N&&(N._nextSibling=M),M&&(M._previousSibling=N),N||(t._firstChild=M),M||(t._lastChild=N),a.dom.features.slots&&u.Guard.isSlotable(e)&&null!==e._assignedSlot&&m.shadowTree_isAssigned(e)&&m.shadowTree_assignSlotables(e._assignedSlot),a.dom.features.slots&&u.Guard.isShadowRoot(f.tree_rootNode(t))&&u.Guard.isSlot(t)&&c.isEmpty(t._assignedNodes)&&m.shadowTree_signalASlotChange(t),a.dom.features.slots&&null!==f.tree_getFirstDescendantNode(e,!0,!1,function(e){return u.Guard.isSlot(e)})&&(m.shadowTree_assignSlotablesForATree(f.tree_rootNode(t)),m.shadowTree_assignSlotablesForATree(e)),a.dom.features.steps&&y.dom_runRemovingSteps(e,t),a.dom.features.customElements&&u.Guard.isCustomElementNode(e)&&p.customElement_enqueueACustomElementCallbackReaction(e,"disconnectedCallback",[]);for(var R=f.tree_getFirstDescendantNode(e,!1,!0);null!==R;)a.dom.features.steps&&y.dom_runRemovingSteps(R,e),a.dom.features.customElements&&u.Guard.isCustomElementNode(R)&&p.customElement_enqueueACustomElementCallbackReaction(R,"disconnectedCallback",[]),R=f.tree_getNextDescendantNode(e,R,!1,!0);if(a.dom.features.mutationObservers)for(var F=f.tree_getFirstAncestorNode(t,!0);null!==F;){try{for(var B=(b=void 0,n(F._registeredObserverList)),L=B.next();!L.done;L=B.next()){var k=L.value;k.options.subtree&&e._registeredObserverList.push({observer:k.observer,options:k.options,source:k})}}catch(e){b={error:e}}finally{try{L&&!L.done&&(x=B.return)&&x.call(B)}finally{if(b)throw b.error}}F=f.tree_getNextAncestorNode(t,F,!0)}a.dom.features.mutationObservers&&(r||g.observer_queueTreeMutationRecord(t,[],[e],I,O)),a.dom.features.steps&&u.Guard.isTextNode(e)&&y.dom_runChildTextContentChangeSteps(t)}t.mutation_ensurePreInsertionValidity=b,t.mutation_preInsert=x,t.mutation_insert=_,t.mutation_append=function(e,t){return x(e,t,null)},t.mutation_replace=function(e,t,r){var o,i,u,c,d,p,h,m;if(r._nodeType!==l.NodeType.Document&&r._nodeType!==l.NodeType.DocumentFragment&&r._nodeType!==l.NodeType.Element)throw new s.HierarchyRequestError("Only document, document fragment and element nodes can contain child nodes. Parent node is "+r.nodeName+".");if(f.tree_isHostIncludingAncestorOf(r,t,!0))throw new s.HierarchyRequestError("The node to be inserted cannot be an ancestor of parent node. Node is "+t.nodeName+", parent node is "+r.nodeName+".");if(e._parent!==r)throw new s.NotFoundError("The reference child node cannot be found under parent node. Child node is "+e.nodeName+", parent node is "+r.nodeName+".");if(t._nodeType!==l.NodeType.DocumentFragment&&t._nodeType!==l.NodeType.DocumentType&&t._nodeType!==l.NodeType.Element&&t._nodeType!==l.NodeType.Text&&t._nodeType!==l.NodeType.ProcessingInstruction&&t._nodeType!==l.NodeType.CData&&t._nodeType!==l.NodeType.Comment)throw new s.HierarchyRequestError("Only document fragment, document type, element, text, processing instruction, cdata section or comment nodes can be inserted. Node is "+t.nodeName+".");if(t._nodeType===l.NodeType.Text&&r._nodeType===l.NodeType.Document)throw new s.HierarchyRequestError("Cannot insert a text node as a child of a document node. Node is "+t.nodeName+".");if(t._nodeType===l.NodeType.DocumentType&&r._nodeType!==l.NodeType.Document)throw new s.HierarchyRequestError("A document type node can only be inserted under a document node. Parent node is "+r.nodeName+".");if(r._nodeType===l.NodeType.Document)if(t._nodeType===l.NodeType.DocumentFragment){var y=0;try{for(var b=n(t._children),x=b.next();!x.done;x=b.next()){var C=x.value;if(C._nodeType===l.NodeType.Element)y++;else if(C._nodeType===l.NodeType.Text)throw new s.HierarchyRequestError("Cannot insert text a node as a child of a document node. Node is "+C.nodeName+".")}}catch(e){o={error:e}}finally{try{x&&!x.done&&(i=b.return)&&i.call(b)}finally{if(o)throw o.error}}if(y>1)throw new s.HierarchyRequestError("A document node can only have one document element node. Document fragment to be inserted has "+y+" element nodes.");if(1===y){try{for(var T=n(r._children),w=T.next();!w.done;w=T.next())if((O=w.value)._nodeType===l.NodeType.Element&&O!==e)throw new s.HierarchyRequestError("The document node already has a document element node.")}catch(e){u={error:e}}finally{try{w&&!w.done&&(c=T.return)&&c.call(T)}finally{if(u)throw u.error}}for(var A=e._nextSibling;A;){if(A._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node.");A=A._nextSibling}}}else if(t._nodeType===l.NodeType.Element){try{for(var E=n(r._children),D=E.next();!D.done;D=E.next())if((O=D.value)._nodeType===l.NodeType.Element&&O!==e)throw new s.HierarchyRequestError("Document already has a document element node. Node is "+t.nodeName+".")}catch(e){d={error:e}}finally{try{D&&!D.done&&(p=E.return)&&p.call(E)}finally{if(d)throw d.error}}for(A=e._nextSibling;A;){if(A._nodeType===l.NodeType.DocumentType)throw new s.HierarchyRequestError("Cannot insert an element node before a document type node. Node is "+t.nodeName+".");A=A._nextSibling}}else if(t._nodeType===l.NodeType.DocumentType){try{for(var P=n(r._children),I=P.next();!I.done;I=P.next()){var O;if((O=I.value)._nodeType===l.NodeType.DocumentType&&O!==e)throw new s.HierarchyRequestError("Document already has a document type node. Node is "+t.nodeName+".")}}catch(e){h={error:e}}finally{try{I&&!I.done&&(m=P.return)&&m.call(P)}finally{if(h)throw h.error}}for(var N=e._previousSibling;N;){if(N._nodeType===l.NodeType.Element)throw new s.HierarchyRequestError("Cannot insert a document type node before an element node. Node is "+t.nodeName+".");N=N._previousSibling}}var M=e._nextSibling;M===t&&(M=t._nextSibling);var R=e._previousSibling;v.document_adopt(t,r._nodeDocument);var F=[];null!==e._parent&&(F.push(e),S(e,e._parent,!0));var B=[];return t._nodeType===l.NodeType.DocumentFragment?B=Array.from(t._children):B.push(t),_(t,r,M,!0),a.dom.features.mutationObservers&&g.observer_queueTreeMutationRecord(r,B,F,R,M),e},t.mutation_replaceAll=function(e,t){var r,o;null!==e&&v.document_adopt(e,t._nodeDocument);var i=Array.from(t._children),s=[];e&&e._nodeType===l.NodeType.DocumentFragment?s=Array.from(e._children):null!==e&&s.push(e);try{for(var u=n(i),c=u.next();!c.done;c=u.next())S(c.value,t,!0)}catch(e){r={error:e}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(r)throw r.error}}null!==e&&_(e,t,null,!0),a.dom.features.mutationObservers&&g.observer_queueTreeMutationRecord(t,s,i,null,null)},t.mutation_preRemove=function(e,t){if(e._parent!==t)throw new s.NotFoundError("The child node cannot be found under parent node. Child node is "+e.nodeName+", parent node is "+t.nodeName+".");return S(e,t),e},t.mutation_remove=S},function(e,t,r){"use strict";function n(e){return null==e}e.exports.isNothing=n,e.exports.isObject=function(e){return"object"==typeof e&&null!==e},e.exports.toArray=function(e){return Array.isArray(e)?e:n(e)?[]:[e]},e.exports.repeat=function(e,t){var r,n="";for(r=0;r0?n:r)(e)}},function(e,t,r){"use strict";var n=r(8);e.exports=function(e,t){var r=[][e];return!!r&&n(function(){r.call(null,t||function(){throw 1},1)})}},function(e,t){e.exports={}},function(e,t,r){"use strict";r(31),r(32),r(33),r(220),r(64),r(19),r(65),r(20),r(68),r(66),r(92),r(144),r(22),r(94),r(23);var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t/g,">");this.text(r)},e.prototype._serializeDocumentFragmentNS=function(e,t,r,o,i){var a,s;try{for(var l=n(e.childNodes),u=l.next();!u.done;u=l.next()){var c=u.value;this._serializeNodeNS(c,t,r,o,i)}}catch(e){a={error:e}}finally{try{u&&!u.done&&(s=l.return)&&s.call(l)}finally{if(a)throw a.error}}},e.prototype._serializeDocumentFragment=function(e,t){var r,o;try{for(var i=n(e._children),a=i.next();!a.done;a=i.next()){var s=a.value;this._serializeNode(s,t)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(r)throw r.error}}},e.prototype._serializeDocumentType=function(e,t){if(t&&!c.xml_isPubidChar(e.publicId))throw new Error("DocType public identifier does not match PubidChar construct (well-formed required).");if(t&&(!c.xml_isLegalChar(e.systemId)||-1!==e.systemId.indexOf('"')&&-1!==e.systemId.indexOf("'")))throw new Error("DocType system identifier contains invalid characters (well-formed required).");this.docType(e.name,e.publicId,e.systemId)},e.prototype._serializeProcessingInstruction=function(e,t){if(t&&(-1!==e.target.indexOf(":")||/^xml$/i.test(e.target)))throw new Error("Processing instruction target contains invalid characters (well-formed required).");if(t&&(!c.xml_isLegalChar(e.data)||-1!==e.data.indexOf("?>")))throw new Error("Processing instruction data contains invalid characters (well-formed required).");this.instruction(e.target,e.data)},e.prototype._serializeCData=function(e,t){if(t&&-1!==e.data.indexOf("]]>"))throw new Error("CDATA contains invalid characters (well-formed required).");this.cdata(e.data)},e.prototype._serializeAttributesNS=function(e,t,r,o,i,a){var l,d,p=[],f=a?new s.LocalNameSet:void 0;try{for(var h=n(e.attributes),m=h.next();!m.done;m=h.next()){var g=m.value;if(a||i||null!==g.namespaceURI){if(a&&f&&f.has(g.namespaceURI,g.localName))throw new Error("Element contains duplicate attributes (well-formed required).");a&&f&&f.set(g.namespaceURI,g.localName);var y=g.namespaceURI,v=null;if(null!==y)if(v=t.get(g.prefix,y),y===u.namespace.XMLNS){if(g.value===u.namespace.XML||null===g.prefix&&i||null!==g.prefix&&(!(g.localName in o)||o[g.localName]!==g.value)&&t.has(g.localName,g.value))continue;if(a&&g.value===u.namespace.XMLNS)throw new Error("XMLNS namespace is reserved (well-formed required).");if(a&&""===g.value)throw new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required).");"xmlns"===g.prefix&&(v="xmlns")}else null===v&&(v=null===g.prefix||t.hasPrefix(g.prefix)&&!t.has(g.prefix,y)?this._generatePrefix(y,t,r):g.prefix,p.push([null,"xmlns",v,this._serializeAttributeValue(y,a)]));if(a&&(-1!==g.localName.indexOf(":")||!c.xml_isName(g.localName)||"xmlns"===g.localName&&null===y))throw new Error("Attribute local name contains invalid characters (well-formed required).");p.push([y,v,g.localName,this._serializeAttributeValue(g.value,a)])}else p.push([null,null,g.localName,this._serializeAttributeValue(g.value,a)])}}catch(e){l={error:e}}finally{try{m&&!m.done&&(d=h.return)&&d.call(h)}finally{if(l)throw l.error}}return p},e.prototype._serializeAttributes=function(e,t){var r,o,i=[],a=t?{}:void 0;try{for(var s=n(e.attributes),l=s.next();!l.done;l=s.next()){var u=l.value;if(t){if(t&&a&&u.localName in a)throw new Error("Element contains duplicate attributes (well-formed required).");if(t&&a&&(a[u.localName]=!0),t&&(-1!==u.localName.indexOf(":")||!c.xml_isName(u.localName)))throw new Error("Attribute local name contains invalid characters (well-formed required).");i.push([null,null,u.localName,this._serializeAttributeValue(u.value,t)])}else i.push([null,null,u.localName,this._serializeAttributeValue(u.value,t)])}}catch(e){r={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}return i},e.prototype._recordNamespaceInformation=function(e,t,r){var o,i,a=null;try{for(var s=n(e.attributes),l=s.next();!l.done;l=s.next()){var c=l.value,d=c.namespaceURI,p=c.prefix;if(d===u.namespace.XMLNS){if(null===p){a=c.value;continue}var f=c.localName,h=c.value;if(h===u.namespace.XML)continue;if(""===h&&(h=null),t.has(f,h))continue;t.set(f,h),r[f]=h||""}}}catch(e){o={error:e}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}return a},e.prototype._generatePrefix=function(e,t,r){var n="ns"+r.value.toString();return r.value++,t.set(n,e),n},e.prototype._serializeAttributeValue=function(e,t){if(t&&null!==e&&!c.xml_isLegalChar(e))throw new Error("Invalid characters in attribute value.");return null===e?"":e.replace(/(?!&([^&;]*);)&/g,"&").replace(//g,">").replace(/"/g,""")},e._VoidElementNames=new Set(["area","base","basefont","bgsound","br","col","embed","frame","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"]),e}();t.BaseWriter=d},function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var i=r(6),a=r(3),s=r(7),l=r(29),u=r(17),c=r(97);function d(){var e=i.dom.window;e._mutationObserverMicrotaskQueued||(e._mutationObserverMicrotaskQueued=!0,Promise.resolve().then(function(){p()}))}function p(){var e,t,r,o,l=i.dom.window;l._mutationObserverMicrotaskQueued=!1;var u=s.set.clone(l._mutationObservers),d=s.set.clone(l._signalSlots);s.set.empty(l._signalSlots);var p=function(e){var t=s.list.clone(e._recordQueue);s.list.empty(e._recordQueue);for(var r=0;r"+e+"<\/script>"},f=function(){try{n=document.domain&&new ActiveXObject("htmlfile")}catch(e){}var e,t;f=n?function(e){e.write(p("")),e.close();var t=e.parentWindow.Object;return e=null,t}(n):((t=u("iframe")).style.display="none",l.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(p("document.F=Object")),e.close(),e.F);for(var r=a.length;r--;)delete f.prototype[a[r]];return f()};s[c]=!0,e.exports=Object.create||function(e,t){var r;return null!==e?(d.prototype=o(e),r=new d,d.prototype=null,r[c]=e):r=f(),void 0===t?r:i(r,t)}},function(e,t,r){var n=r(121),o=r(84);e.exports=Object.keys||function(e){return n(e,o)}},function(e,t,r){var n=r(15).f,o=r(14),i=r(5)("toStringTag");e.exports=function(e,t,r){e&&!o(e=r?e:e.prototype,i)&&n(e,i,{configurable:!0,value:t})}},function(e,t,r){var n=r(8),o=r(5),i=r(129),a=o("species");e.exports=function(e){return i>=51||!n(function(){var t=[];return(t.constructor={})[a]=function(){return{foo:1}},1!==t[e](Boolean).foo})}},function(e,t,r){"use strict";var n=r(4),o=r(122).indexOf,i=r(48),a=r(28),s=[].indexOf,l=!!s&&1/[1].indexOf(1,-0)<0,u=i("indexOf"),c=a("indexOf",{ACCESSORS:!0,1:0});n({target:"Array",proto:!0,forced:l||!u||!c},{indexOf:function(e){return l?s.apply(this,arguments)||0:o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,r){var n=r(16),o=r(15).f,i=Function.prototype,a=i.toString,s=/^\s*function ([^ (]*)/;n&&!("name"in i)&&o(i,"name",{configurable:!0,get:function(){try{return a.call(this).match(s)[1]}catch(e){return""}}})},function(e,t,r){"use strict";var n=r(25),o=r(18),i=r(8),a=r(136),s=RegExp.prototype,l=s.toString,u=i(function(){return"/a/b"!=l.call({source:"a",flags:"b"})}),c="toString"!=l.name;(u||c)&&n(RegExp.prototype,"toString",function(){var e=o(this),t=String(e.source),r=e.flags;return"/"+t+"/"+String(void 0===r&&e instanceof RegExp&&!("flags"in s)?a.call(e):r)},{unsafe:!0})},function(e,t,r){"use strict";r(31),r(32),r(33),r(19),r(138),r(20),r(66),r(22),r(23);var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=r(1),s=r(2),l=function(e){function t(t,r){var n=e.call(this,t)||this;return n._writerOptions=a.applyDefaults(r,{format:"object",wellFormed:!1,group:!1,verbose:!1}),n}return o(t,e),t.prototype.serialize=function(e){return this._currentList=[],this._currentIndex=0,this._listRegister=[this._currentList],this.serializeNode(e,this._writerOptions.wellFormed),this._process(this._currentList,this._writerOptions)},t.prototype._process=function(e,t){var r,n,o,i,l,u,c;if(0===e.length)return{};for(var d={},p=!1,f=0,h=0,m=0,g=0,y=0;y2)try{for(var c=i(e),d=c.next();!d.done;d=c.next()){var p=d.value;t[n+(s++).toString()]=p}}catch(e){l={error:e}}finally{try{d&&!d.done&&(u=c.return)&&u.call(c)}finally{if(l)throw l.error}}else t[o>1?n+(s++).toString():n]=e;return s},t.prototype.beginElement=function(e){var t,r,n=[];if(0===this._currentList.length)this._currentList.push(((t={})[e]=n,t));else{var o=this._currentList[this._currentList.length-1];this._isElementNode(o,e)?0!==o[e].length&&a.isArray(o[e][0])?o[e].push(n):o[e]=[o[e],n]:this._currentList.push(((r={})[e]=n,r))}this._currentIndex++,this._listRegister.length>this._currentIndex?this._listRegister[this._currentIndex]=n:this._listRegister.push(n),this._currentList=n},t.prototype.endElement=function(){this._currentList=this._listRegister[--this._currentIndex]},t.prototype.attribute=function(e,t){var r,n;if(0===this._currentList.length)this._currentList.push({"@":(r={},r[e]=t,r)});else{var o=this._currentList[this._currentList.length-1];this._isAttrNode(o)?o["@"][e]=t:this._currentList.push({"@":(n={},n[e]=t,n)})}},t.prototype.comment=function(e){if(0===this._currentList.length)this._currentList.push({"!":e});else{var t=this._currentList[this._currentList.length-1];this._isCommentNode(t)?a.isArray(t["!"])?t["!"].push(e):t["!"]=[t["!"],e]:this._currentList.push({"!":e})}},t.prototype.text=function(e){if(0===this._currentList.length)this._currentList.push({"#":e});else{var t=this._currentList[this._currentList.length-1];this._isTextNode(t)?a.isArray(t["#"])?t["#"].push(e):t["#"]=[t["#"],e]:this._currentList.push({"#":e})}},t.prototype.instruction=function(e,t){var r=""===t?e:e+" "+t;if(0===this._currentList.length)this._currentList.push({"?":r});else{var n=this._currentList[this._currentList.length-1];this._isInstructionNode(n)?a.isArray(n["?"])?n["?"].push(r):n["?"]=[n["?"],r]:this._currentList.push({"?":r})}},t.prototype.cdata=function(e){if(0===this._currentList.length)this._currentList.push({$:e});else{var t=this._currentList[this._currentList.length-1];this._isCDATANode(t)?a.isArray(t.$)?t.$.push(e):t.$=[t.$,e]:this._currentList.push({$:e})}},t.prototype._isAttrNode=function(e){return"@"in e},t.prototype._isTextNode=function(e){return"#"in e},t.prototype._isCommentNode=function(e){return"!"in e},t.prototype._isInstructionNode=function(e){return"?"in e},t.prototype._isCDATANode=function(e){return"$"in e},t.prototype._isElementNode=function(e,t){return t in e},t.prototype._getAttrKey=function(){return this._builderOptions.convert.att},t.prototype._getNodeKey=function(e){switch(e){case s.NodeType.Comment:return this._builderOptions.convert.comment;case s.NodeType.Text:return this._builderOptions.convert.text;case s.NodeType.ProcessingInstruction:return this._builderOptions.convert.ins;case s.NodeType.CData:return this._builderOptions.convert.cdata;default:throw new Error("Invalid node type.")}},t}(r(50).BaseWriter);t.ObjectWriter=l},function(e,t,r){"use strict";var n=r(4),o=r(93);n({target:"RegExp",proto:!0,forced:/./.exec!==o},{exec:o})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){this._items={},this._nullItems={}}return e.prototype.set=function(e,t){null===e?this._nullItems[t]=!0:(this._items[e]||(this._items[e]={}),this._items[e][t]=!0)},e.prototype.has=function(e,t){return null===e?!0===this._nullItems[t]:!!this._items[e]&&!0===this._items[e][t]},e}();t.LocalNameSet=n},function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var o=r(9),i=r(3),a=r(0),s=function(){function e(){}return Object.defineProperty(e.prototype,"_eventListenerList",{get:function(){return this.__eventListenerList||(this.__eventListenerList=[])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_eventHandlerMap",{get:function(){return this.__eventHandlerMap||(this.__eventHandlerMap={})},enumerable:!0,configurable:!0}),e.prototype.addEventListener=function(e,t,r){void 0===r&&(r={passive:!1,once:!1,capture:!1});var o,s=n(a.eventTarget_flattenMore(r),3),l=s[0],u=s[1],c=s[2];t&&(o=i.Guard.isEventListener(t)?t:{handleEvent:t},a.eventTarget_addEventListener(this,{type:e,callback:o,capture:l,passive:u,once:c,removed:!1}))},e.prototype.removeEventListener=function(e,t,r){void 0===r&&(r={capture:!1});var n=a.eventTarget_flatten(r);if(t)for(var o=0;o=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t",amp:"&",quot:'"',apos:"'"},e}();t.BaseReader=o},function(e,t,r){"use strict";var n=r(39);e.exports=n.DEFAULT=new n({include:[r(54)],explicit:[r(299),r(300),r(301)]})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(185);t.XMLBuilderImpl=n.XMLBuilderImpl;var o=r(304);t.XMLBuilderCBImpl=o.XMLBuilderCBImpl;var i=r(183);t.builder=i.builder,t.create=i.create,t.fragment=i.fragment,t.convert=i.convert;var a=r(309);t.createCB=a.createCB,t.fragmentCB=a.fragmentCB},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";var n={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,i=o&&!n.call({1:2},1);t.f=i?function(e){var t=o(this,e);return!!t&&t.enumerable}:n},function(e,t,r){var n=r(11),o=r(21);e.exports=function(e,t){try{o(n,e,t)}catch(r){n[e]=t}return t}},function(e,t,r){var n=r(44),o=r(118);(e.exports=function(e,t){return o[e]||(o[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.6.5",mode:n?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},function(e,t,r){var n=r(121),o=r(84).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return n(e,o)}},function(e,t,r){var n=r(47),o=Math.max,i=Math.min;e.exports=function(e,t){var r=n(e);return r<0?o(r+t,0):i(r,t)}},function(e,t){e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t,r){var n=r(8);e.exports=!!Object.getOwnPropertySymbols&&!n(function(){return!String(Symbol())})},function(e,t,r){var n=r(127);e.exports=function(e,t,r){if(n(e),void 0===t)return e;switch(r){case 0:return function(){return e.call(t)};case 1:return function(r){return e.call(t,r)};case 2:return function(r,n){return e.call(t,r,n)};case 3:return function(r,n,o){return e.call(t,r,n,o)}}return function(){return e.apply(t,arguments)}}},function(e,t,r){"use strict";var n=r(4),o=r(195),i=r(132),a=r(133),s=r(62),l=r(21),u=r(25),c=r(5),d=r(44),p=r(49),f=r(131),h=f.IteratorPrototype,m=f.BUGGY_SAFARI_ITERATORS,g=c("iterator"),y=function(){return this};e.exports=function(e,t,r,c,f,v,b){o(r,t,c);var x,_,S,C=function(e){if(e===f&&D)return D;if(!m&&e in A)return A[e];switch(e){case"keys":case"values":case"entries":return function(){return new r(this,e)}}return function(){return new r(this)}},T=t+" Iterator",w=!1,A=e.prototype,E=A[g]||A["@@iterator"]||f&&A[f],D=!m&&E||C(f),P="Array"==t&&A.entries||E;if(P&&(x=i(P.call(new e)),h!==Object.prototype&&x.next&&(d||i(x)===h||(a?a(x,h):"function"!=typeof x[g]&&l(x,g,y)),s(x,T,!0,!0),d&&(p[T]=y))),"values"==f&&E&&"values"!==E.name&&(w=!0,D=function(){return E.call(this)}),d&&!b||A[g]===D||l(A,g,D),p[t]=D,f)if(_={values:C("values"),keys:v?D:C("keys"),entries:C("entries")},b)for(S in _)(m||w||!(S in A))&&u(A,S,_[S]);else n({target:t,proto:!0,forced:m||w},_);return _}},function(e,t,r){"use strict";var n=r(4),o=r(13),i=r(59),a=r(83),s=r(26),l=r(24),u=r(134),c=r(5),d=r(63),p=r(28),f=d("slice"),h=p("slice",{ACCESSORS:!0,0:0,1:2}),m=c("species"),g=[].slice,y=Math.max;n({target:"Array",proto:!0,forced:!f||!h},{slice:function(e,t){var r,n,c,d=l(this),p=s(d.length),f=a(e,p),h=a(void 0===t?p:t,p);if(i(d)&&("function"!=typeof(r=d.constructor)||r!==Array&&!i(r.prototype)?o(r)&&null===(r=r[m])&&(r=void 0):r=void 0,r===Array||void 0===r))return g.call(d,f,h);for(n=new(void 0===r?Array:r)(y(h-f,0)),c=0;f0&&(!a.multiline||a.multiline&&"\n"!==e[a.lastIndex-1])&&(h="(?: "+h+")",g=" "+g,m++),r=new RegExp("^(?:"+h+")",f)),p&&(r=new RegExp("^"+h+"$(?!\\s)",f)),c&&(t=a.lastIndex),n=s.call(u?r:a,g),u?n?(n.input=n.input.slice(m),n[0]=n[0].slice(m),n.index=a.lastIndex,a.lastIndex+=n[0].length):a.lastIndex=0:c&&n&&(a.lastIndex=a.global?n.index+n[0].length:t),p&&n&&n.length>1&&l.call(n[0],r,function(){for(o=1;o]*>)/g,m=/\$([$&'`]|\d\d?)/g;n("replace",2,function(e,t,r,n){var g=n.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE,y=n.REPLACE_KEEPS_$0,v=g?"$":"$0";return[function(r,n){var o=l(this),i=null==r?void 0:r[e];return void 0!==i?i.call(r,o,n):t.call(String(o),r,n)},function(e,n){if(!g&&y||"string"==typeof n&&-1===n.indexOf(v)){var i=r(t,e,this,n);if(i.done)return i.value}var l=o(e),f=String(this),h="function"==typeof n;h||(n=String(n));var m=l.global;if(m){var x=l.unicode;l.lastIndex=0}for(var _=[];;){var S=c(l,f);if(null===S)break;if(_.push(S),!m)break;""===String(S[0])&&(l.lastIndex=u(f,a(l.lastIndex),x))}for(var C,T="",w=0,A=0;A<_.length;A++){S=_[A];for(var E=String(S[0]),D=d(p(s(S.index),f.length),0),P=[],I=1;I=w&&(T+=f.slice(w,D)+M,w=D+E.length)}return T+f.slice(w)}];function b(e,r,n,o,a,s){var l=n+e.length,u=o.length,c=m;return void 0!==a&&(a=i(a),c=h),t.call(s,c,function(t,i){var s;switch(i.charAt(0)){case"$":return"$";case"&":return e;case"`":return r.slice(0,n);case"'":return r.slice(l);case"<":s=a[i.slice(1,-1)];break;default:var c=+i;if(0===c)return t;if(c>u){var d=f(c/10);return 0===d?t:d<=u?void 0===o[d-1]?i.charAt(1):o[d-1]+i.charAt(1):t}s=o[c-1]}return void 0===s?"":s})}})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){this._items={},this._nullItems=[]}return e.prototype.copy=function(){var t=new e;for(var r in this._items)t._items[r]=this._items[r].slice(0);return t._nullItems=this._nullItems.slice(0),t},e.prototype.get=function(e,t){var r=null===t?this._nullItems:this._items[t]||null;if(null===r)return null;for(var n=null,o=0;o=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t=0;M--)if(null!==(F=N[M]).shadowAdjustedTarget){O=F;break}if(null!==O)if(l.Guard.isNode(O.shadowAdjustedTarget)&&l.Guard.isShadowRoot(p.tree_rootNode(O.shadowAdjustedTarget,!0)))d=!0;else if(l.Guard.isNode(O.relatedTarget)&&l.Guard.isShadowRoot(p.tree_rootNode(O.relatedTarget,!0)))d=!0;else for(var R=0;R=0;M--)null!==(F=N[M]).shadowAdjustedTarget?e._eventPhase=s.EventPhase.AtTarget:e._eventPhase=s.EventPhase.Capturing,b(F,e,"capturing",o);for(M=0;M0&&null!==(l=o[a-1]).shadowAdjustedTarget)&&(t._target=l.shadowAdjustedTarget)}if(t._relatedTarget=e.relatedTarget,t._touchTargetList=e.touchTargetList,!t._stopPropagationFlag){t._currentTarget=e.invocationTarget;var u=t._currentTarget._eventListenerList,c=new(Array.bind.apply(Array,i([void 0],u)));if(!x(t,c,r,e,n)&&t._isTrusted){var d=t._type;"animationend"===d?t._type="webkitAnimationEnd":"animationiteration"===d?t._type="webkitAnimationIteration":"animationstart"===d?t._type="webkitAnimationStart":"transitionend"===d&&(t._type="webkitTransitionEnd"),x(t,c,r,e,n),t._type=d}}}function x(e,t,r,n,o){void 0===o&&(o={value:!1});for(var i=!1,a=0;a=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var s=r(6),l=r(2),u=r(9),c=r(34),d=r(3),p=r(1),f=r(7),h=r(152),m=r(0),g=r(12),y=function(e){function t(){var t=e.call(this)||this;return t._children=new Set,t._encoding={name:"UTF-8",labels:["unicode-1-1-utf-8","utf-8","utf8"]},t._contentType="application/xml",t._URL={scheme:"about",username:"",password:"",host:null,port:null,path:["blank"],query:null,fragment:null,_cannotBeABaseURLFlag:!0,_blobURLEntry:null},t._origin=null,t._type="xml",t._mode="no-quirks",t._documentElement=null,t._hasNamespaces=!1,t._nodeDocumentOverwrite=null,t}return o(t,e),Object.defineProperty(t.prototype,"_nodeDocument",{get:function(){return this._nodeDocumentOverwrite||this},set:function(e){this._nodeDocumentOverwrite=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"implementation",{get:function(){return this._implementation||(this._implementation=m.create_domImplementation(this))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"URL",{get:function(){return h.urlSerializer(this._URL)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"documentURI",{get:function(){return this.URL},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"origin",{get:function(){return"null"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"compatMode",{get:function(){return"quirks"===this._mode?"BackCompat":"CSS1Compat"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"characterSet",{get:function(){return this._encoding.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"charset",{get:function(){return this._encoding.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"inputEncoding",{get:function(){return this._encoding.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"contentType",{get:function(){return this._contentType},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"doctype",{get:function(){var e,t;try{for(var r=i(this._children),n=r.next();!n.done;n=r.next()){var o=n.value;if(d.Guard.isDocumentTypeNode(o))return o}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"documentElement",{get:function(){return this._documentElement},enumerable:!0,configurable:!0}),t.prototype.getElementsByTagName=function(e){return m.node_listOfElementsWithQualifiedName(e,this)},t.prototype.getElementsByTagNameNS=function(e,t){return m.node_listOfElementsWithNamespace(e,t,this)},t.prototype.getElementsByClassName=function(e){return m.node_listOfElementsWithClassNames(e,this)},t.prototype.createElement=function(e,t){if(!m.xml_isName(e))throw new u.InvalidCharacterError;"html"===this._type&&(e=e.toLowerCase());var r=null;void 0!==t&&(r=p.isString(t)?t:t.is);var n="html"===this._type||"application/xhtml+xml"===this._contentType?f.namespace.HTML:null;return m.element_createAnElement(this,e,n,null,r,!0)},t.prototype.createElementNS=function(e,t,r){return m.document_internalCreateElementNS(this,e,t,r)},t.prototype.createDocumentFragment=function(){return m.create_documentFragment(this)},t.prototype.createTextNode=function(e){return m.create_text(this,e)},t.prototype.createCDATASection=function(e){if("html"===this._type)throw new u.NotSupportedError;if(-1!==e.indexOf("]]>"))throw new u.InvalidCharacterError;return m.create_cdataSection(this,e)},t.prototype.createComment=function(e){return m.create_comment(this,e)},t.prototype.createProcessingInstruction=function(e,t){if(!m.xml_isName(e))throw new u.InvalidCharacterError;if(-1!==t.indexOf("?>"))throw new u.InvalidCharacterError;return m.create_processingInstruction(this,e,t)},t.prototype.importNode=function(e,t){if(void 0===t&&(t=!1),d.Guard.isDocumentNode(e)||d.Guard.isShadowRoot(e))throw new u.NotSupportedError;return m.node_clone(e,this,t)},t.prototype.adoptNode=function(e){if(d.Guard.isDocumentNode(e))throw new u.NotSupportedError;if(d.Guard.isShadowRoot(e))throw new u.HierarchyRequestError;return m.document_adopt(e,this),e},t.prototype.createAttribute=function(e){if(!m.xml_isName(e))throw new u.InvalidCharacterError;return"html"===this._type&&(e=e.toLowerCase()),m.create_attr(this,e)},t.prototype.createAttributeNS=function(e,t){var r=a(m.namespace_validateAndExtract(e,t),3),n=r[0],o=r[1],i=r[2],s=m.create_attr(this,i);return s._namespace=n,s._namespacePrefix=o,s},t.prototype.createEvent=function(e){return m.event_createLegacyEvent(e)},t.prototype.createRange=function(){var e=m.create_range();return e._start=[this,0],e._end=[this,0],e},t.prototype.createNodeIterator=function(e,t,r){void 0===t&&(t=l.WhatToShow.All),void 0===r&&(r=null);var n=m.create_nodeIterator(e,e,!0);return n._whatToShow=t,n._iteratorCollection=m.create_nodeList(e),p.isFunction(r)?(n._filter=m.create_nodeFilter(),n._filter.acceptNode=r):n._filter=r,n},t.prototype.createTreeWalker=function(e,t,r){void 0===t&&(t=l.WhatToShow.All),void 0===r&&(r=null);var n=m.create_treeWalker(e,e);return n._whatToShow=t,p.isFunction(r)?(n._filter=m.create_nodeFilter(),n._filter.acceptNode=r):n._filter=r,n},t.prototype._getTheParent=function(e){return"load"===e._type?null:s.dom.window},t.prototype.getElementById=function(e){throw new Error("Mixin: NonElementParentNode not implemented.")},Object.defineProperty(t.prototype,"children",{get:function(){throw new Error("Mixin: ParentNode not implemented.")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"firstElementChild",{get:function(){throw new Error("Mixin: ParentNode not implemented.")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lastElementChild",{get:function(){throw new Error("Mixin: ParentNode not implemented.")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"childElementCount",{get:function(){throw new Error("Mixin: ParentNode not implemented.")},enumerable:!0,configurable:!0}),t.prototype.prepend=function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var s=r(2),l=r(34),u=r(9),c=r(7),d=r(0),p=r(12),f=function(e){function t(){var t=e.call(this)||this;return t._children=new Set,t._namespace=null,t._namespacePrefix=null,t._localName="",t._customElementState="undefined",t._customElementDefinition=null,t._is=null,t._shadowRoot=null,t._attributeList=d.create_namedNodeMap(t),t._attributeChangeSteps=[],t._name="",t._assignedSlot=null,t}return o(t,e),Object.defineProperty(t.prototype,"namespaceURI",{get:function(){return this._namespace},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"prefix",{get:function(){return this._namespacePrefix},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"localName",{get:function(){return this._localName},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"tagName",{get:function(){return this._htmlUppercasedQualifiedName},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"id",{get:function(){return d.element_getAnAttributeValue(this,"id")},set:function(e){d.element_setAnAttributeValue(this,"id",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"className",{get:function(){return d.element_getAnAttributeValue(this,"class")},set:function(e){d.element_setAnAttributeValue(this,"class",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"classList",{get:function(){var e=d.element_getAnAttributeByName("class",this);return null===e&&(e=d.create_attr(this._nodeDocument,"class")),d.create_domTokenList(this,e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"slot",{get:function(){return d.element_getAnAttributeValue(this,"slot")},set:function(e){d.element_setAnAttributeValue(this,"slot",e)},enumerable:!0,configurable:!0}),t.prototype.hasAttributes=function(){return 0!==this._attributeList.length},Object.defineProperty(t.prototype,"attributes",{get:function(){return this._attributeList},enumerable:!0,configurable:!0}),t.prototype.getAttributeNames=function(){var e,t,r=[];try{for(var n=i(this._attributeList),o=n.next();!o.done;o=n.next()){var a=o.value;r.push(a._qualifiedName)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return r},t.prototype.getAttribute=function(e){var t=d.element_getAnAttributeByName(e,this);return t?t._value:null},t.prototype.getAttributeNS=function(e,t){var r=d.element_getAnAttributeByNamespaceAndLocalName(e,t,this);return r?r._value:null},t.prototype.setAttribute=function(e,t){if(!d.xml_isName(e))throw new u.InvalidCharacterError;this._namespace===c.namespace.HTML&&"html"===this._nodeDocument._type&&(e=e.toLowerCase());for(var r=null,n=0;n=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=r(2),s=r(71),l=r(0),u=r(12),c=function(e){function t(t){void 0===t&&(t="");var r=e.call(this,t)||this;return r._name="",r._assignedSlot=null,r}return o(t,e),Object.defineProperty(t.prototype,"wholeText",{get:function(){var e,t,r="";try{for(var n=i(l.text_contiguousTextNodes(this,!0)),o=n.next();!o.done;o=n.next())r+=o.value._data}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return r},enumerable:!0,configurable:!0}),t.prototype.splitText=function(e){return l.text_split(this,e)},Object.defineProperty(t.prototype,"assignedSlot",{get:function(){throw new Error("Mixin: Slotable not implemented.")},enumerable:!0,configurable:!0}),t._create=function(e,r){void 0===r&&(r="");var n=new t(r);return n._nodeDocument=e,n},t}(s.CharacterDataImpl);t.TextImpl=c,u.idl_defineConst(c.prototype,"_nodeType",a.NodeType.Text)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){}return Object.defineProperty(e.prototype,"_startNode",{get:function(){return this._start[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_startOffset",{get:function(){return this._start[1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_endNode",{get:function(){return this._end[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_endOffset",{get:function(){return this._end[1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_collapsed",{get:function(){return this._start[0]===this._end[0]&&this._start[1]===this._end[1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"startContainer",{get:function(){return this._startNode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"startOffset",{get:function(){return this._startOffset},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"endContainer",{get:function(){return this._endNode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"endOffset",{get:function(){return this._endOffset},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"collapsed",{get:function(){return this._collapsed},enumerable:!0,configurable:!0}),e}();t.AbstractRangeImpl=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(2),o=function(){function e(e){this._activeFlag=!1,this._root=e,this._whatToShow=n.WhatToShow.All,this._filter=null}return Object.defineProperty(e.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"whatToShow",{get:function(){return this._whatToShow},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"filter",{get:function(){return this._filter},enumerable:!0,configurable:!0}),e}();t.TraverserImpl=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(2),o=r(0),i=r(12),a=function(){function e(e,t){this._target=null,this._relatedTarget=null,this._touchTargetList=[],this._path=[],this._currentTarget=null,this._eventPhase=n.EventPhase.None,this._stopPropagationFlag=!1,this._stopImmediatePropagationFlag=!1,this._canceledFlag=!1,this._inPassiveListenerFlag=!1,this._composedFlag=!1,this._initializedFlag=!1,this._dispatchFlag=!1,this._isTrusted=!1,this._bubbles=!1,this._cancelable=!1,this._type=e,t&&(this._bubbles=t.bubbles||!1,this._cancelable=t.cancelable||!1,this._composedFlag=t.composed||!1),this._initializedFlag=!0,this._timeStamp=(new Date).getTime()}return Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this._target},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"srcElement",{get:function(){return this._target},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentTarget",{get:function(){return this._currentTarget},enumerable:!0,configurable:!0}),e.prototype.composedPath=function(){var e=[],t=this._path;if(0===t.length)return e;var r=this._currentTarget;if(null===r)throw new Error("Event currentTarget is null.");e.push(r);for(var n=0,o=0,i=t.length-1;i>=0;){if(t[i].rootOfClosedTree&&o++,t[i].invocationTarget===r){n=i;break}t[i].slotInClosedTree&&o--,i--}var a=o,s=o;for(i=n-1;i>=0;)t[i].rootOfClosedTree&&a++,a<=s&&e.unshift(t[i].invocationTarget),t[i].slotInClosedTree&&--a0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=r(6),a=r(3),s=r(1),l=r(99),u=r(73),c=r(17),d=r(173),p=r(30),f=r(52),h=r(37);t.document_elementInterface=function(e,t){return l.ElementImpl},t.document_internalCreateElementNS=function(e,t,r,o){var i=n(d.namespace_validateAndExtract(t,r),3),a=i[0],l=i[1],u=i[2],c=null;return void 0!==o&&(c=s.isString(o)?o:o.is),f.element_createAnElement(e,u,a,l,c,!0)},t.document_adopt=function(e,t){var r,n;if(e._nodeDocument!==t||null!==e._parent){var s=e._nodeDocument;if(e._parent&&h.mutation_remove(e,e._parent),t!==s)for(var l=c.tree_getFirstDescendantNode(e,!0,!0);null!==l;){if(l._nodeDocument=t,a.Guard.isElementNode(l))try{for(var d=(r=void 0,o(l._attributeList._asArray())),f=d.next();!f.done;f=d.next())f.value._nodeDocument=t}catch(e){r={error:e}}finally{try{f&&!f.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}i.dom.features.customElements&&a.Guard.isElementNode(l)&&"custom"===l._customElementState&&u.customElement_enqueueACustomElementCallbackReaction(l,"adoptedCallback",[s,t]),i.dom.features.steps&&p.dom_runAdoptingSteps(l,s),l=c.tree_getNextDescendantNode(e,l,!0,!0)}}}},function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=r(6),i=r(3),a=r(9),s=r(17),l=r(51),u=r(30);t.characterData_replaceData=function(e,t,r,c){var d,p,f=s.tree_nodeLength(e);if(t>f)throw new a.IndexSizeError("Offset exceeds character data length. Offset: "+t+", Length: "+f+", Node is "+e.nodeName+".");t+r>f&&(r=f-t),o.dom.features.mutationObservers&&l.observer_queueMutationRecord("characterData",e,null,null,e._data,[],[],null,null);var h=e._data.substring(0,t)+c+e._data.substring(t+r);e._data=h;try{for(var m=n(o.dom.rangeList),g=m.next();!g.done;g=m.next()){var y=g.value;y._start[0]===e&&y._start[1]>t&&y._start[1]<=t+r&&(y._start[1]=t),y._end[0]===e&&y._end[1]>t&&y._end[1]<=t+r&&(y._end[1]=t),y._start[0]===e&&y._start[1]>t+r&&(y._start[1]+=c.length-r),y._end[0]===e&&y._end[1]>t+r&&(y._end[1]+=c.length-r)}}catch(e){d={error:e}}finally{try{g&&!g.done&&(p=m.return)&&p.call(m)}finally{if(d)throw d.error}}o.dom.features.steps&&i.Guard.isTextNode(e)&&null!==e._parent&&u.dom_runChildTextContentChangeSteps(e._parent)},t.characterData_substringData=function(e,t,r){var n=s.tree_nodeLength(e);if(t>n)throw new a.IndexSizeError("Offset exceeds character data length. Offset: "+t+", Length: "+n+", Node is "+e.nodeName+".");return t+r>n?e._data.substr(t):e._data.substr(t,r)}},function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spread||function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=r(7);function s(e){var t=a.string.splitAStringOnASCIIWhitespace(e);return new Set(t)}function l(e){return o(e).join(" ")}t.orderedSet_parse=s,t.orderedSet_serialize=l,t.orderedSet_sanitize=function(e){return l(s(e))},t.orderedSet_contains=function(e,t,r){var n,o,a,s;try{for(var l=i(t),u=l.next();!u.done;u=l.next()){var c=u.value,d=!1;try{for(var p=(a=void 0,i(e)),f=p.next();!f.done;f=p.next()){var h=f.value;if(r){if(h===c){d=!0;break}}else if(h.toUpperCase()===c.toUpperCase()){d=!0;break}}}catch(e){a={error:e}}finally{try{f&&!f.done&&(s=p.return)&&s.call(p)}finally{if(a)throw a.error}}if(!d)return!1}}catch(e){n={error:e}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(n)throw n.error}}return!0}},function(e,t,r){"use strict";r(179),Object.defineProperty(t,"__esModule",{value:!0});var n=r(262),o=r(110),i=r(1);o.dom.setFeatures(!1),t.createDocument=function(){var e=(new n.DOMImplementation).createDocument(null,"root",null);return e.documentElement&&e.removeChild(e.documentElement),e},t.sanitizeInput=function(e,t){if(null==e)return e;if(void 0===t)return e+"";var r="";e+="";for(var n=0;n=32&&o<=55295||o>=57344&&o<=65533)r+=e.charAt(n);else if(o>=55296&&o<=56319&&n=56320&&a<=57343?(o=1024*(o-55296)+a-56320+65536,r+=String.fromCodePoint(o),n++):r+=i.isString(t)?t:t(e.charAt(n),n,e)}else r+=i.isString(t)?t:t(e.charAt(n),n,e)}return r}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),o=r(153);t.AbortController=o.AbortControllerImpl;var i=r(154);t.AbortSignal=i.AbortSignalImpl;var a=r(102);t.AbstractRange=a.AbstractRangeImpl;var s=r(157);t.Attr=s.AttrImpl;var l=r(158);t.CDATASection=l.CDATASectionImpl;var u=r(71);t.CharacterData=u.CharacterDataImpl;var c=r(263),d=r(159);t.Comment=d.CommentImpl;var p=r(171);t.CustomEvent=p.CustomEventImpl;var f=r(100);t.DocumentFragment=f.DocumentFragmentImpl;var h=r(98);t.Document=h.DocumentImpl;var m=r(264),g=r(155);t.DocumentType=g.DocumentTypeImpl;var y=r(6);t.dom=y.dom;var v=r(148);t.DOMImplementation=v.DOMImplementationImpl;var b=r(170);t.DOMTokenList=b.DOMTokenListImpl;var x=r(99);t.Element=x.ElementImpl;var _=r(104);t.Event=_.EventImpl;var S=r(70);t.EventTarget=S.EventTargetImpl;var C=r(161);t.HTMLCollection=C.HTMLCollectionImpl;var T=r(265);t.MutationObserver=T.MutationObserverImpl;var w=r(169);t.MutationRecord=w.MutationRecordImpl;var A=r(164);t.NamedNodeMap=A.NamedNodeMapImpl;var E=r(168);t.NodeFilter=E.NodeFilterImpl;var D=r(34);t.Node=D.NodeImpl;var P=r(166);t.NodeIterator=P.NodeIteratorImpl;var I=r(162);t.NodeList=I.NodeListImpl;var O=r(163);t.NodeListStatic=O.NodeListStaticImpl;var N=r(266),M=r(267),R=r(268),F=r(160);t.ProcessingInstruction=F.ProcessingInstructionImpl;var B=r(165);t.Range=B.RangeImpl;var L=r(156);t.ShadowRoot=L.ShadowRootImpl;var k=r(269),U=r(270);t.StaticRange=U.StaticRangeImpl;var V=r(101);t.Text=V.TextImpl;var G=r(103);t.Traverser=G.TraverserImpl;var z=r(167);t.TreeWalker=z.TreeWalkerImpl;var j=r(149);t.Window=j.WindowImpl;var W=r(151);t.XMLDocument=W.XMLDocumentImpl,n.applyMixin(x.ElementImpl,c.ChildNodeImpl),n.applyMixin(u.CharacterDataImpl,c.ChildNodeImpl),n.applyMixin(g.DocumentTypeImpl,c.ChildNodeImpl),n.applyMixin(h.DocumentImpl,m.DocumentOrShadowRootImpl),n.applyMixin(L.ShadowRootImpl,m.DocumentOrShadowRootImpl),n.applyMixin(x.ElementImpl,N.NonDocumentTypeChildNodeImpl),n.applyMixin(u.CharacterDataImpl,N.NonDocumentTypeChildNodeImpl),n.applyMixin(h.DocumentImpl,M.NonElementParentNodeImpl),n.applyMixin(f.DocumentFragmentImpl,M.NonElementParentNodeImpl),n.applyMixin(h.DocumentImpl,R.ParentNodeImpl),n.applyMixin(f.DocumentFragmentImpl,R.ParentNodeImpl),n.applyMixin(x.ElementImpl,R.ParentNodeImpl),n.applyMixin(V.TextImpl,k.SlotableImpl),n.applyMixin(x.ElementImpl,k.SlotableImpl)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.EOF=0]="EOF",e[e.Declaration=1]="Declaration",e[e.DocType=2]="DocType",e[e.Element=3]="Element",e[e.Text=4]="Text",e[e.CDATA=5]="CDATA",e[e.PI=6]="PI",e[e.Comment=7]="Comment",e[e.ClosingTag=8]="ClosingTag"}(t.TokenType||(t.TokenType={}))},function(e,t,r){"use strict";r(64),r(20),r(66);var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var i=r(1),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype._parse=function(e,t){var r=this,n=this._builderOptions,o=null;return i.isFunction(t)?o=this.parse(e,t.apply(this)):i.isArray(t)||i.isSet(t)?i.forEachArray(t,function(t){return o=r.parse(e,t)},this):i.isMap(t)||i.isObject(t)?i.forEachObject(t,function(t,a){if(i.isFunction(a)&&(a=a.apply(r)),n.ignoreConverters||0!==t.indexOf(n.convert.att))if(n.ignoreConverters||0!==t.indexOf(n.convert.text))if(n.ignoreConverters||0!==t.indexOf(n.convert.cdata))if(n.ignoreConverters||0!==t.indexOf(n.convert.comment))if(n.ignoreConverters||0!==t.indexOf(n.convert.ins)){if((i.isArray(a)||i.isSet(a))&&i.isEmpty(a));else if((i.isMap(a)||i.isObject(a))&&i.isEmpty(a))o=r.element(e,void 0,r.sanitize(t))||o;else if(n.keepNullNodes||null!=a)if(i.isArray(a)||i.isSet(a))i.forEachArray(a,function(n){var i={};i[t]=n,o=r.parse(e,i)},r);else if(i.isMap(a)||i.isObject(a))(s=r.element(e,void 0,r.sanitize(t)))&&(o=s,r.parse(s,a));else if(null!=a&&""!==a){var s;(s=r.element(e,void 0,r.sanitize(t)))&&(o=s,r.text(s,r._decodeText(r.sanitize(a))))}else o=r.element(e,void 0,r.sanitize(t))||o}else if(i.isString(a)){var l=a.indexOf(" "),u=-1===l?a:a.substr(0,l),c=-1===l?"":a.substr(l+1);o=r.instruction(e,r.sanitize(u),r.sanitize(c))||o}else i.isArray(a)||i.isSet(a)?i.forEachArray(a,function(t){var n=t.indexOf(" "),i=-1===n?t:t.substr(0,n),a=-1===n?"":t.substr(n+1);o=r.instruction(e,r.sanitize(i),r.sanitize(a))||o},r):i.forEachObject(a,function(t,n){return o=r.instruction(e,r.sanitize(t),r.sanitize(n))||o},r);else i.isArray(a)||i.isSet(a)?i.forEachArray(a,function(t){return o=r.comment(e,r.sanitize(t))||o},r):o=r.comment(e,r.sanitize(a))||o;else i.isArray(a)||i.isSet(a)?i.forEachArray(a,function(t){return o=r.cdata(e,r.sanitize(t))||o},r):o=r.cdata(e,r.sanitize(a))||o;else o=i.isMap(a)||i.isObject(a)?r.parse(e,a):r.text(e,r._decodeText(r.sanitize(a)))||o;else if(t===n.convert.att){if(i.isArray(a)||i.isSet(a))throw new Error("Invalid attribute: "+a.toString()+". "+e._debugInfo());i.forEachObject(a,function(t,n){o=r.attribute(e,void 0,r.sanitize(t),r._decodeAttributeValue(r.sanitize(n)))||o})}else o=r.attribute(e,void 0,r.sanitize(t.substr(n.convert.att.length)),r._decodeAttributeValue(r.sanitize(a)))||o},this):(n.keepNullNodes||null!=t)&&(o=this.text(e,this._decodeText(this.sanitize(t)))||o),o||e},t}(r(75).BaseReader);t.ObjectReader=a},function(e,t,r){"use strict";var n=r(39);e.exports=new n({explicit:[r(286),r(287),r(288)]})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.BaseCBWriter=function(e){this.level=0,this._builderOptions=e,this._writerOptions=e}},function(e,t,r){var n=r(16),o=r(8),i=r(116);e.exports=!n&&!o(function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a})},function(e,t,r){var n=r(11),o=r(13),i=n.document,a=o(i)&&o(i.createElement);e.exports=function(e){return a?i.createElement(e):{}}},function(e,t,r){var n=r(118),o=Function.toString;"function"!=typeof n.inspectSource&&(n.inspectSource=function(e){return o.call(e)}),e.exports=n.inspectSource},function(e,t,r){var n=r(11),o=r(80),i=n["__core-js_shared__"]||o("__core-js_shared__",{});e.exports=i},function(e,t,r){var n=r(14),o=r(187),i=r(55),a=r(15);e.exports=function(e,t){for(var r=o(t),s=a.f,l=i.f,u=0;ul;)n(s,r=t[l++])&&(~i(u,r)||u.push(r));return u}},function(e,t,r){var n=r(24),o=r(26),i=r(83),a=function(e){return function(t,r,a){var s,l=n(t),u=o(l.length),c=i(a,u);if(e&&r!=r){for(;u>c;)if((s=l[c++])!=s)return!0}else for(;u>c;c++)if((e||c in l)&&l[c]===r)return e||c||0;return!e&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}},function(e,t,r){var n=r(8),o=/#|\.prototype\./,i=function(e,t){var r=s[a(e)];return r==u||r!=l&&("function"==typeof t?n(t):!!t)},a=i.normalize=function(e){return String(e).replace(o,".").toLowerCase()},s=i.data={},l=i.NATIVE="N",u=i.POLYFILL="P";e.exports=i},function(e,t,r){var n=r(86);e.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},function(e,t,r){var n=r(5);t.f=n},function(e,t,r){var n=r(120),o=r(14),i=r(125),a=r(15).f;e.exports=function(e){var t=n.Symbol||(n.Symbol={});o(t,e)||a(t,e,{value:i.f(e)})}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e}},function(e,t,r){var n=r(13),o=r(59),i=r(5)("species");e.exports=function(e,t){var r;return o(e)&&("function"!=typeof(r=e.constructor)||r!==Array&&!o(r.prototype)?n(r)&&null===(r=r[i])&&(r=void 0):r=void 0),new(void 0===r?Array:r)(0===t?0:t)}},function(e,t,r){var n,o,i=r(11),a=r(193),s=i.process,l=s&&s.versions,u=l&&l.v8;u?o=(n=u.split("."))[0]+n[1]:a&&(!(n=a.match(/Edge\/(\d+)/))||n[1]>=74)&&(n=a.match(/Chrome\/(\d+)/))&&(o=n[1]),e.exports=o&&+o},function(e,t,r){var n=r(5),o=r(60),i=r(15),a=n("unscopables"),s=Array.prototype;null==s[a]&&i.f(s,a,{configurable:!0,value:o(null)}),e.exports=function(e){s[a][e]=!0}},function(e,t,r){"use strict";var n,o,i,a=r(132),s=r(21),l=r(14),u=r(5),c=r(44),d=u("iterator"),p=!1;[].keys&&("next"in(i=[].keys())?(o=a(a(i)))!==Object.prototype&&(n=o):p=!0),null==n&&(n={}),c||l(n,d)||s(n,d,function(){return this}),e.exports={IteratorPrototype:n,BUGGY_SAFARI_ITERATORS:p}},function(e,t,r){var n=r(14),o=r(27),i=r(57),a=r(196),s=i("IE_PROTO"),l=Object.prototype;e.exports=a?Object.getPrototypeOf:function(e){return e=o(e),n(e,s)?e[s]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?l:null}},function(e,t,r){var n=r(18),o=r(197);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(r,[]),t=r instanceof Array}catch(e){}return function(r,i){return n(r),o(i),t?e.call(r,i):r.__proto__=i,r}}():void 0)},function(e,t,r){"use strict";var n=r(56),o=r(15),i=r(40);e.exports=function(e,t,r){var a=n(t);a in e?o.f(e,a,i(0,r)):e[a]=r}},function(e,t,r){var n=r(90),o=r(42),i=r(5)("toStringTag"),a="Arguments"==o(function(){return arguments}());e.exports=n?o:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),i))?r:a?o(t):"Object"==(n=o(t))&&"function"==typeof t.callee?"Arguments":n}},function(e,t,r){"use strict";var n=r(18);e.exports=function(){var e=n(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t}},function(e,t,r){var n=r(47),o=r(35),i=function(e){return function(t,r){var i,a,s=String(o(t)),l=n(r),u=s.length;return l<0||l>=u?e?"":void 0:(i=s.charCodeAt(l))<55296||i>56319||l+1===u||(a=s.charCodeAt(l+1))<56320||a>57343?e?s.charAt(l):i:e?s.slice(l,l+2):a-56320+(i-55296<<10)+65536}};e.exports={codeAt:i(!1),charAt:i(!0)}},function(e,t,r){var n=r(4),o=r(27),i=r(61);n({target:"Object",stat:!0,forced:r(8)(function(){i(1)})},{keys:function(e){return i(o(e))}})},function(e,t,r){"use strict";var n=r(4),o=r(11),i=r(123),a=r(25),s=r(140),l=r(141),u=r(142),c=r(13),d=r(8),p=r(208),f=r(62),h=r(209);e.exports=function(e,t,r){var m=-1!==e.indexOf("Map"),g=-1!==e.indexOf("Weak"),y=m?"set":"add",v=o[e],b=v&&v.prototype,x=v,_={},S=function(e){var t=b[e];a(b,e,"add"==e?function(e){return t.call(this,0===e?0:e),this}:"delete"==e?function(e){return!(g&&!c(e))&&t.call(this,0===e?0:e)}:"get"==e?function(e){return g&&!c(e)?void 0:t.call(this,0===e?0:e)}:"has"==e?function(e){return!(g&&!c(e))&&t.call(this,0===e?0:e)}:function(e,r){return t.call(this,0===e?0:e,r),this})};if(i(e,"function"!=typeof v||!(g||b.forEach&&!d(function(){(new v).entries().next()}))))x=r.getConstructor(t,e,m,y),s.REQUIRED=!0;else if(i(e,!0)){var C=new x,T=C[y](g?{}:-0,1)!=C,w=d(function(){C.has(1)}),A=p(function(e){new v(e)}),E=!g&&d(function(){for(var e=new v,t=5;t--;)e[y](t,t);return!e.has(-0)});A||((x=t(function(t,r){u(t,x,e);var n=h(new v,t,x);return null!=r&&l(r,n[y],n,m),n})).prototype=b,b.constructor=x),(w||E)&&(S("delete"),S("has"),m&&S("get")),(E||T)&&S(y),g&&b.clear&&delete b.clear}return _[e]=x,n({global:!0,forced:x!=v},_),f(x,e),g||r.setStrong(x,e,m),x}},function(e,t,r){var n=r(45),o=r(13),i=r(14),a=r(15).f,s=r(58),l=r(204),u=s("meta"),c=0,d=Object.isExtensible||function(){return!0},p=function(e){a(e,u,{value:{objectID:"O"+ ++c,weakData:{}}})},f=e.exports={REQUIRED:!1,fastKey:function(e,t){if(!o(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!i(e,u)){if(!d(e))return"F";if(!t)return"E";p(e)}return e[u].objectID},getWeakData:function(e,t){if(!i(e,u)){if(!d(e))return!0;if(!t)return!1;p(e)}return e[u].weakData},onFreeze:function(e){return l&&f.REQUIRED&&d(e)&&!i(e,u)&&p(e),e}};n[u]=!0},function(e,t,r){var n=r(18),o=r(205),i=r(26),a=r(87),s=r(206),l=r(207),u=function(e,t){this.stopped=e,this.result=t};(e.exports=function(e,t,r,c,d){var p,f,h,m,g,y,v,b=a(t,r,c?2:1);if(d)p=e;else{if("function"!=typeof(f=s(e)))throw TypeError("Target is not iterable");if(o(f)){for(h=0,m=i(e.length);m>h;h++)if((g=c?b(n(v=e[h])[0],v[1]):b(e[h]))&&g instanceof u)return g;return new u(!1)}p=f.call(e)}for(y=p.next;!(v=y.call(p)).done;)if("object"==typeof(g=l(p,b,v.value,c))&&g&&g instanceof u)return g;return new u(!1)}).stop=function(e){return new u(!0,e)}},function(e,t){e.exports=function(e,t,r){if(!(e instanceof t))throw TypeError("Incorrect "+(r?r+" ":"")+"invocation");return e}},function(e,t,r){"use strict";var n=r(15).f,o=r(60),i=r(210),a=r(87),s=r(142),l=r(141),u=r(88),c=r(211),d=r(16),p=r(140).fastKey,f=r(43),h=f.set,m=f.getterFor;e.exports={getConstructor:function(e,t,r,u){var c=e(function(e,n){s(e,c,t),h(e,{type:t,index:o(null),first:void 0,last:void 0,size:0}),d||(e.size=0),null!=n&&l(n,e[u],e,r)}),f=m(t),g=function(e,t,r){var n,o,i=f(e),a=y(e,t);return a?a.value=r:(i.last=a={index:o=p(t,!0),key:t,value:r,previous:n=i.last,next:void 0,removed:!1},i.first||(i.first=a),n&&(n.next=a),d?i.size++:e.size++,"F"!==o&&(i.index[o]=a)),e},y=function(e,t){var r,n=f(e),o=p(t);if("F"!==o)return n.index[o];for(r=n.first;r;r=r.next)if(r.key==t)return r};return i(c.prototype,{clear:function(){for(var e=f(this),t=e.index,r=e.first;r;)r.removed=!0,r.previous&&(r.previous=r.previous.next=void 0),delete t[r.index],r=r.next;e.first=e.last=void 0,d?e.size=0:this.size=0},delete:function(e){var t=f(this),r=y(this,e);if(r){var n=r.next,o=r.previous;delete t.index[r.index],r.removed=!0,o&&(o.next=n),n&&(n.previous=o),t.first==r&&(t.first=n),t.last==r&&(t.last=o),d?t.size--:this.size--}return!!r},forEach:function(e){for(var t,r=f(this),n=a(e,arguments.length>1?arguments[1]:void 0,3);t=t?t.next:r.first;)for(n(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!y(this,e)}}),i(c.prototype,r?{get:function(e){var t=y(this,e);return t&&t.value},set:function(e,t){return g(this,0===e?0:e,t)}}:{add:function(e){return g(this,e=0===e?0:e,e)}}),d&&n(c.prototype,"size",{get:function(){return f(this).size}}),c},setStrong:function(e,t,r){var n=t+" Iterator",o=m(t),i=m(n);u(e,t,function(e,t){h(this,{type:n,target:e,state:o(e),kind:t,last:void 0})},function(){for(var e=i(this),t=e.kind,r=e.last;r&&r.removed;)r=r.previous;return e.target&&(e.last=r=r?r.next:e.state.first)?"keys"==t?{value:r.key,done:!1}:"values"==t?{value:r.value,done:!1}:{value:[r.key,r.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})},r?"entries":"values",!r,!0),c(t)}}},function(e,t,r){"use strict";var n,o=r(4),i=r(55).f,a=r(26),s=r(222),l=r(35),u=r(224),c=r(44),d="".endsWith,p=Math.min,f=u("endsWith");o({target:"String",proto:!0,forced:!(!c&&!f&&(n=i(String.prototype,"endsWith"),n&&!n.writable)||f)},{endsWith:function(e){var t=String(l(this));s(e);var r=arguments.length>1?arguments[1]:void 0,n=a(t.length),o=void 0===r?n:p(a(r),n),i=String(e);return d?d.call(t,i,o):t.slice(o-i.length,o)===i}})},function(e,t,r){"use strict";(function(e){var n=r(229),o=r(230),i=r(231);function a(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(a()=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function h(e,t){if(l.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return V(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return G(e).length;default:if(n)return V(e).length;t=(""+t).toLowerCase(),n=!0}}function m(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return P(this,t,r);case"utf8":case"utf-8":return A(this,t,r);case"ascii":return E(this,t,r);case"latin1":case"binary":return D(this,t,r);case"base64":return w(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function g(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function y(e,t,r,n,o){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof t&&(t=l.from(t,n)),l.isBuffer(t))return 0===t.length?-1:v(e,t,r,n,o);if("number"==typeof t)return t&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):v(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function v(e,t,r,n,o){var i,a=1,s=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,s/=2,l/=2,r/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){var c=-1;for(i=r;is&&(r=s-l),i=r;i>=0;i--){for(var d=!0,p=0;po&&(n=o):n=o;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var a=0;a>8,o=r%256,i.push(o),i.push(n);return i}(t,e.length-r),e,r,n)}function w(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function A(e,t,r){r=Math.min(e.length,r);for(var n=[],o=t;o239?4:u>223?3:u>191?2:1;if(o+d<=r)switch(d){case 1:u<128&&(c=u);break;case 2:128==(192&(i=e[o+1]))&&(l=(31&u)<<6|63&i)>127&&(c=l);break;case 3:i=e[o+1],a=e[o+2],128==(192&i)&&128==(192&a)&&(l=(15&u)<<12|(63&i)<<6|63&a)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:i=e[o+1],a=e[o+2],s=e[o+3],128==(192&i)&&128==(192&a)&&128==(192&s)&&(l=(15&u)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&l<1114112&&(c=l)}null===c?(c=65533,d=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),o+=d}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);for(var r="",n=0;nn)&&(r=n);for(var o="",i=t;ir)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,r,n,o,i){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function M(e,t,r,n){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-r,2);o>>8*(n?o:1-o)}function R(e,t,r,n){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-r,4);o>>8*(n?o:3-o)&255}function F(e,t,r,n,o,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function B(e,t,r,n,i){return i||F(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function L(e,t,r,n,i){return i||F(e,0,r,8),o.write(e,t,r,n,52,8),r+8}t.Buffer=l,t.SlowBuffer=function(e){return+e!=e&&(e=0),l.alloc(+e)},t.INSPECT_MAX_BYTES=50,l.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=a(),l.poolSize=8192,l._augment=function(e){return e.__proto__=l.prototype,e},l.from=function(e,t,r){return u(null,e,t,r)},l.TYPED_ARRAY_SUPPORT&&(l.prototype.__proto__=Uint8Array.prototype,l.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&l[Symbol.species]===l&&Object.defineProperty(l,Symbol.species,{value:null,configurable:!0})),l.alloc=function(e,t,r){return function(e,t,r,n){return c(t),t<=0?s(e,t):void 0!==r?"string"==typeof n?s(e,t).fill(r,n):s(e,t).fill(r):s(e,t)}(null,e,t,r)},l.allocUnsafe=function(e){return d(null,e)},l.allocUnsafeSlow=function(e){return d(null,e)},l.isBuffer=function(e){return!(null==e||!e._isBuffer)},l.compare=function(e,t){if(!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,o=0,i=Math.min(r,n);o0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},l.prototype.compare=function(e,t,r,n,o){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),t<0||r>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=r)return 0;if(n>=o)return-1;if(t>=r)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0),s=Math.min(i,a),u=this.slice(n,o),c=e.slice(t,r),d=0;do)&&(r=o),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return x(this,e,t,r);case"ascii":return _(this,e,t,r);case"latin1":case"binary":return S(this,e,t,r);case"base64":return C(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},l.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t0&&(o*=256);)n+=this[e+--t]*o;return n},l.prototype.readUInt8=function(e,t){return t||O(e,1,this.length),this[e]},l.prototype.readUInt16LE=function(e,t){return t||O(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUInt16BE=function(e,t){return t||O(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUInt32LE=function(e,t){return t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUInt32BE=function(e,t){return t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||O(e,t,this.length);for(var n=this[e],o=1,i=0;++i=(o*=128)&&(n-=Math.pow(2,8*t)),n},l.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||O(e,t,this.length);for(var n=t,o=1,i=this[e+--n];n>0&&(o*=256);)i+=this[e+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},l.prototype.readInt8=function(e,t){return t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){t||O(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt16BE=function(e,t){t||O(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt32LE=function(e,t){return t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return t||O(e,4,this.length),o.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return t||O(e,4,this.length),o.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return t||O(e,8,this.length),o.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return t||O(e,8,this.length),o.read(this,e,!1,52,8)},l.prototype.writeUIntLE=function(e,t,r,n){e=+e,t|=0,r|=0,n||N(this,e,t,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+o]=e/i&255;return t+r},l.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,1,255,0),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},l.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},l.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},l.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):R(this,e,t,!0),t+4},l.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):R(this,e,t,!1),t+4},l.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var o=Math.pow(2,8*r-1);N(this,e,t,r,o-1,-o)}var i=0,a=1,s=0;for(this[t]=255&e;++i=0&&(a*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/a|0)-s&255;return t+r},l.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,1,127,-128),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},l.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},l.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):R(this,e,t,!0),t+4},l.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):R(this,e,t,!1),t+4},l.prototype.writeFloatLE=function(e,t,r){return B(this,e,t,!0,r)},l.prototype.writeFloatBE=function(e,t,r){return B(this,e,t,!1,r)},l.prototype.writeDoubleLE=function(e,t,r){return L(this,e,t,!0,r)},l.prototype.writeDoubleBE=function(e,t,r){return L(this,e,t,!1,r)},l.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--o)e[o+t]=this[o+r];else if(i<1e3||!l.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function G(e){return n.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(k,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function z(e,t,r,n){for(var o=0;o=t.length||o>=e.length);++o)t[o+r]=e[o];return o}}).call(this,r(78))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isASCIIByte=function(e){return e>=0&&e<=127}},function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spread||function(){for(var e=[],t=0;t=65&&r<=90&&(e[t]=r+32)}},t.byteUppercase=function(e){for(var t=0;t=97&&r<=122&&(e[t]=r-32)}},t.byteCaseInsensitiveMatch=function(e,t){if(e.length!==t.length)return!1;for(var r=0;r=65&&n<=90&&(n+=32),o>=65&&o<=90&&(o+=32),n!==o)return!1}return!0},t.startsWith=function(e,t){for(var r=0;;){if(r>=e.length)return!1;if(r>=t.length)return!0;if(e[r]!==t[r])return!1;r++}},t.byteLessThan=function(e,t){for(var r=0;;){if(r>=e.length)return!1;if(r>=t.length)return!0;var n=e[r],o=t[r];if(no)return!1;r++}},t.isomorphicDecode=function(e){return String.fromCodePoint.apply(String,o(e))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(6),o=r(7),i=r(0),a=r(12),s=function(){function e(e){this._associatedDocument=e||n.dom.window.document}return e.prototype.createDocumentType=function(e,t,r){return i.namespace_validate(e),i.create_documentType(this._associatedDocument,e,t,r)},e.prototype.createDocument=function(e,t,r){void 0===r&&(r=null);var n=i.create_xmlDocument(),a=null;return t&&(a=i.document_internalCreateElementNS(n,e,t)),r&&n.appendChild(r),a&&n.appendChild(a),n._origin=this._associatedDocument._origin,e===o.namespace.HTML?n._contentType="application/xhtml+xml":e===o.namespace.SVG?n._contentType="image/svg+xml":n._contentType="application/xml",n},e.prototype.createHTMLDocument=function(e){var t=i.create_document();t._type="html",t._contentType="text/html",t.appendChild(i.create_documentType(t,"html","",""));var r=i.element_createAnElement(t,"html",o.namespace.HTML);t.appendChild(r);var n=i.element_createAnElement(t,"head",o.namespace.HTML);if(r.appendChild(n),void 0!==e){var a=i.element_createAnElement(t,"title",o.namespace.HTML);n.appendChild(a);var s=i.create_text(t,e);a.appendChild(s)}var l=i.element_createAnElement(t,"body",o.namespace.HTML);return r.appendChild(l),t._origin=this._associatedDocument._origin,t},e.prototype.hasFeature=function(){return!0},e._create=function(t){return new e(t)},e}();t.DOMImplementationImpl=s,a.idl_defineConst(s.prototype,"_ID","@oozcitak/dom")},function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var i=r(70),a=r(1),s=r(0),l=function(e){function t(){var t=e.call(this)||this;return t._signalSlots=new Set,t._mutationObserverMicrotaskQueued=!1,t._mutationObservers=new Set,t._iteratorList=new a.FixedSizeSet,t._associatedDocument=s.create_document(),t}return o(t,e),Object.defineProperty(t.prototype,"document",{get:function(){return this._associatedDocument},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"event",{get:function(){return this._currentEvent},enumerable:!0,configurable:!0}),t._create=function(){return new t},t}(i.EventTargetImpl);t.WindowImpl=l},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(2),o=function(){function e(){}return e.isNode=function(e){return!!e&&void 0!==e._nodeType},e.isDocumentNode=function(t){return e.isNode(t)&&t._nodeType===n.NodeType.Document},e.isDocumentTypeNode=function(t){return e.isNode(t)&&t._nodeType===n.NodeType.DocumentType},e.isDocumentFragmentNode=function(t){return e.isNode(t)&&t._nodeType===n.NodeType.DocumentFragment},e.isAttrNode=function(t){return e.isNode(t)&&t._nodeType===n.NodeType.Attribute},e.isCharacterDataNode=function(t){if(!e.isNode(t))return!1;var r=t._nodeType;return r===n.NodeType.Text||r===n.NodeType.ProcessingInstruction||r===n.NodeType.Comment||r===n.NodeType.CData},e.isTextNode=function(t){return e.isNode(t)&&(t._nodeType===n.NodeType.Text||t._nodeType===n.NodeType.CData)},e.isExclusiveTextNode=function(t){return e.isNode(t)&&t._nodeType===n.NodeType.Text},e.isCDATASectionNode=function(t){return e.isNode(t)&&t._nodeType===n.NodeType.CData},e.isCommentNode=function(t){return e.isNode(t)&&t._nodeType===n.NodeType.Comment},e.isProcessingInstructionNode=function(t){return e.isNode(t)&&t._nodeType===n.NodeType.ProcessingInstruction},e.isElementNode=function(t){return e.isNode(t)&&t._nodeType===n.NodeType.Element},e.isCustomElementNode=function(t){return e.isElementNode(t)&&"custom"===t._customElementState},e.isShadowRoot=function(e){return!!e&&void 0!==e.host},e.isMouseEvent=function(e){return!!e&&void 0!==e.screenX&&null!=e.screenY},e.isSlotable=function(t){return!!t&&void 0!==t._name&&void 0!==t._assignedSlot&&(e.isTextNode(t)||e.isElementNode(t))},e.isSlot=function(t){return!!t&&void 0!==t._name&&void 0!==t._assignedNodes&&e.isElementNode(t)},e.isWindow=function(e){return!!e&&void 0!==e.navigator},e.isEventListener=function(e){return!!e&&void 0!==e.handleEvent},e.isRegisteredObserver=function(e){return!!e&&void 0!==e.observer&&void 0!==e.options},e.isTransientRegisteredObserver=function(t){return!!t&&void 0!==t.source&&e.isRegisteredObserver(t)},e}();t.Guard=o},function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(){return e.call(this)||this}return o(t,e),t}(r(98).DocumentImpl);t.XMLDocumentImpl=i},function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var i,a=r(1),s=r(243),l=r(7),u=r(244),c={ftp:21,file:null,http:80,https:443,ws:80,wss:443},d=/[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,p=/[ "<>`]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,f=/[ "<>`#?{}]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,h=/[ "<>`#?{}/:;=@\[\]\\\^\|]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,m=/[0-9A-Za-z!\$&-\/:;=\?@_~\xA0-\uD7FF\uE000-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uD83E\uD840-\uD87E\uD880-\uD8BE\uD8C0-\uD8FE\uD900-\uD93E\uD940-\uD97E\uD980-\uD9BE\uD9C0-\uD9FE\uDA00-\uDA3E\uDA40-\uDA7E\uDA80-\uDABE\uDAC0-\uDAFE\uDB00-\uDB3E\uDB40-\uDB7E\uDB80-\uDBBE\uDBC0-\uDBFE][\uDC00-\uDFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F\uDBBF\uDBFF][\uDC00-\uDFFD]/,g=/[\0\t\f\r #%/:?@\[\\\]]/;function y(e){void 0!==i&&i.call(null,"Validation Error: "+e)}function v(e){return e in c}function b(e){return v(e.scheme)}function x(e){return c[e]||null}function _(e){return""!==e.username||""!==e.password}function S(e,t){var r,o;void 0===t&&(t=!1);var i=e.scheme+":";if(null!==e.host?(i+="//",_(e)&&(i+=e.username,""!==e.password&&(i+=":"+e.password),i+="@"),i+=C(e.host),null!==e.port&&(i+=":"+e.port)):null===e.host&&"file"===e.scheme&&(i+="//"),e._cannotBeABaseURLFlag)i+=e.path[0];else try{for(var a=n(e.path),s=a.next();!s.done;s=a.next())i+="/"+s.value}catch(e){r={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}return null!==e.query&&(i+="?"+e.query),t||null===e.fragment||(i+="#"+e.fragment),i}function C(e){return a.isNumber(e)?T(e):a.isArray(e)?"["+w(e)+"]":e}function T(e){for(var t="",r=e,n=1;n<=4;n++)t=(r%256).toString()+t,4!==n&&(t="."+t),r=Math.floor(r/256);return t}function w(e){for(var t="",r=null,n=-1,o=0,i=0,a=0;a<8;a++)if(0===e[a]){o=1;for(var s=a+1;s<8&&0===e[s];s++)o++;o>i&&(i=o,n=a)}i>1&&(r=n);for(var l=!1,u=0;u<8;u++)l&&0===e[u]||(l&&(l=!1),r!==u?(t+=e[u].toString(16),7!==u&&(t+=":")):(t+=0===u?"::":":",l=!0));return t}function A(e,t,r,o,i){var u,c,g,S;if(void 0===o){o={scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null,_cannotBeABaseURLFlag:!1,_blobURLEntry:null};var C=/^[\u0000-\u001F\u0020]+/,T=/[\u0000-\u001F\u0020]+$/;(C.test(e)||T.test(e))&&y("Input string contains leading or trailing control characters or space."),e=(e=e.replace(C,"")).replace(T,"")}var w=/[\u0009\u000A\u000D]/g;w.test(e)&&y("Input string contains tab or newline characters."),e=e.replace(w,"");var A=void 0===i?s.ParserState.SchemeStart:i;void 0===t&&(t=null);for(var R=void 0===r||"replacement"===r||"UTF-16BE"===r||"UTF-16LE"===r?"UTF-8":r,F="",B=!1,L=!1,U=!1,V=new a.StringWalker(e);;){switch(A){case s.ParserState.SchemeStart:if(l.codePoint.ASCIIAlpha.test(V.c()))F+=V.c().toLowerCase(),A=s.ParserState.Scheme;else{if(void 0!==i)return y("Invalid scheme start character."),null;A=s.ParserState.NoScheme,V.pointer--}break;case s.ParserState.Scheme:if(l.codePoint.ASCIIAlphanumeric.test(V.c())||"+"===V.c()||"-"===V.c()||"."===V.c())F+=V.c().toLowerCase();else{if(":"!==V.c()){if(void 0===i){F="",A=s.ParserState.NoScheme,V.pointer=0;continue}return y("Invalid input string."),null}if(void 0!==i){if(v(o.scheme)&&!v(F))return o;if(!v(o.scheme)&&v(F))return o;if((_(o)||null!==o.port)&&"file"===F)return o;if("file"===o.scheme&&(""===o.host||null===o.host))return o}if(o.scheme=F,void 0!==i)return o.port===x(o.scheme)&&(o.port=null),o;F="","file"===o.scheme?(V.remaining().startsWith("//")||y("Invalid file URL scheme, '//' expected."),A=s.ParserState.File):b(o)&&null!==t&&t.scheme===o.scheme?A=s.ParserState.SpecialRelativeOrAuthority:b(o)?A=s.ParserState.SpecialAuthoritySlashes:V.remaining().startsWith("/")?(A=s.ParserState.PathOrAuthority,V.pointer++):(o._cannotBeABaseURLFlag=!0,o.path.push(""),A=s.ParserState.CannotBeABaseURLPath)}break;case s.ParserState.NoScheme:if(null===t||t._cannotBeABaseURLFlag&&"#"!==V.c())return y("Invalid input string."),null;t._cannotBeABaseURLFlag&&"#"===V.c()?(o.scheme=t.scheme,o.path=l.list.clone(t.path),o.query=t.query,o.fragment="",o._cannotBeABaseURLFlag=!0,A=s.ParserState.Fragment):"file"!==t.scheme?(A=s.ParserState.Relative,V.pointer--):(A=s.ParserState.File,V.pointer--);break;case s.ParserState.SpecialRelativeOrAuthority:"/"===V.c()&&V.remaining().startsWith("/")?(A=s.ParserState.SpecialAuthorityIgnoreSlashes,V.pointer++):(y("Invalid input string."),A=s.ParserState.Relative,V.pointer--);break;case s.ParserState.PathOrAuthority:"/"===V.c()?A=s.ParserState.Authority:(A=s.ParserState.Path,V.pointer--);break;case s.ParserState.Relative:if(null===t)throw new Error("Invalid parser state. Base URL is null.");switch(o.scheme=t.scheme,V.c()){case"":o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,o.path=l.list.clone(t.path),o.query=t.query;break;case"/":A=s.ParserState.RelativeSlash;break;case"?":o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,o.path=l.list.clone(t.path),o.query="",A=s.ParserState.Query;break;case"#":o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,o.path=l.list.clone(t.path),o.query=t.query,o.fragment="",A=s.ParserState.Fragment;break;default:b(o)&&"\\"===V.c()?(y("Invalid input string."),A=s.ParserState.RelativeSlash):(o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,o.path=l.list.clone(t.path),0!==o.path.length&&o.path.splice(o.path.length-1,1),A=s.ParserState.Path,V.pointer--)}break;case s.ParserState.RelativeSlash:if(!b(o)||"/"!==V.c()&&"\\"!==V.c())if("/"===V.c())A=s.ParserState.Authority;else{if(null===t)throw new Error("Invalid parser state. Base URL is null.");o.username=t.username,o.password=t.password,o.host=t.host,o.port=t.port,A=s.ParserState.Path,V.pointer--}else"\\"===V.c()&&y("Invalid input string."),A=s.ParserState.SpecialAuthorityIgnoreSlashes;break;case s.ParserState.SpecialAuthoritySlashes:"/"===V.c()&&V.remaining().startsWith("/")?(A=s.ParserState.SpecialAuthorityIgnoreSlashes,V.pointer++):(y("Expected '//'."),A=s.ParserState.SpecialAuthorityIgnoreSlashes,V.pointer--);break;case s.ParserState.SpecialAuthorityIgnoreSlashes:"/"!==V.c()&&"\\"!==V.c()?(A=s.ParserState.Authority,V.pointer--):y("Unexpected '/' or '\\'.");break;case s.ParserState.Authority:if("@"===V.c()){y("Unexpected '@'."),B&&(F="%40"+F),B=!0;try{for(var z=(u=void 0,n(F)),j=z.next();!j.done;j=z.next()){var W=j.value;if(":"!==W||U){var H=G(W,h);U?o.password+=H:o.username+=H}else U=!0}}catch(e){u={error:e}}finally{try{j&&!j.done&&(c=z.return)&&c.call(z)}finally{if(u)throw u.error}}F=""}else if(""===V.c()||"/"===V.c()||"?"===V.c()||"#"===V.c()||b(o)&&"\\"===V.c()){if(B&&""===F)return y("Invalid input string."),null;V.pointer-=F.length+1,F="",A=s.ParserState.Host}else F+=V.c();break;case s.ParserState.Host:case s.ParserState.Hostname:if(void 0!==i&&"file"===o.scheme)V.pointer--,A=s.ParserState.FileHost;else if(":"!==V.c()||L)if(""===V.c()||"/"===V.c()||"?"===V.c()||"#"===V.c()||b(o)&&"\\"===V.c()){if(V.pointer--,b(o)&&""===F)return y("Invalid input string."),null;if(void 0!==i&&""===F&&(_(o)||null!==o.port))return y("Invalid input string."),o;if(null===(X=M(F,!b(o))))return null;if(o.host=X,F="",A=s.ParserState.PathStart,void 0!==i)return o}else"["===V.c()&&(L=!0),"]"===V.c()&&(L=!1),F+=V.c();else{if(""===F)return y("Invalid input string."),null;if(null===(X=M(F,!b(o))))return null;if(o.host=X,F="",A=s.ParserState.Port,i===s.ParserState.Hostname)return o}break;case s.ParserState.Port:if(l.codePoint.ASCIIDigit.test(V.c()))F+=V.c();else{if(!(""===V.c()||"/"===V.c()||"?"===V.c()||"#"===V.c()||b(o)&&"\\"===V.c()||i))return y("Invalid input string."),null;if(""!==F&&""!==F){var K=parseInt(F,10);if(K>Math.pow(2,16)-1)return y("Invalid port number."),null;o.port=K===x(o.scheme)?null:K,F=""}if(void 0!==i)return o;A=s.ParserState.PathStart,V.pointer--}break;case s.ParserState.File:if(o.scheme="file","/"===V.c()||"\\"===V.c())"\\"===V.c()&&y("Invalid input string."),A=s.ParserState.FileSlash;else if(null!==t&&"file"===t.scheme)switch(V.c()){case"":o.host=t.host,o.path=l.list.clone(t.path),o.query=t.query;break;case"?":o.host=t.host,o.path=l.list.clone(t.path),o.query="",A=s.ParserState.Query;break;case"#":o.host=t.host,o.path=l.list.clone(t.path),o.query=t.query,o.fragment="",A=s.ParserState.Fragment;break;default:N(V.substring())?y("Unexpected windows drive letter in input string."):(o.host=t.host,o.path=l.list.clone(t.path),P(o)),A=s.ParserState.Path,V.pointer--}else A=s.ParserState.Path,V.pointer--;break;case s.ParserState.FileSlash:"/"===V.c()||"\\"===V.c()?("\\"===V.c()&&y("Invalid input string."),A=s.ParserState.FileHost):(null===t||"file"!==t.scheme||N(V.substring())||(I(t.path[0])?o.path.push(t.path[0]):o.host=t.host),A=s.ParserState.Path,V.pointer--);break;case s.ParserState.FileHost:if(""===V.c()||"/"===V.c()||"\\"===V.c()||"?"===V.c()||"#"===V.c())if(V.pointer--,void 0===i&&O(F))y("Unexpected windows drive letter in input string."),A=s.ParserState.Path;else if(""===F){if(o.host="",void 0!==i)return o;A=s.ParserState.PathStart}else{var X;if(null===(X=M(F,!b(o))))return null;if("localhost"===X&&(X=""),o.host=X,void 0!==i)return o;F="",A=s.ParserState.PathStart}else F+=V.c();break;case s.ParserState.PathStart:b(o)?("\\"===V.c()&&y("Invalid input string."),A=s.ParserState.Path,"/"!==V.c()&&"\\"!==V.c()&&V.pointer--):void 0===i&&"?"===V.c()?(o.query="",A=s.ParserState.Query):void 0===i&&"#"===V.c()?(o.fragment="",A=s.ParserState.Fragment):""!==V.c()&&(A=s.ParserState.Path,"/"!==V.c()&&V.pointer--);break;case s.ParserState.Path:if(""===V.c()||"/"===V.c()||b(o)&&"\\"===V.c()||void 0===i&&("?"===V.c()||"#"===V.c())){if(b(o)&&"\\"===V.c()&&y("Invalid input string."),D(F))P(o),"/"===V.c()||b(o)&&"\\"===V.c()||o.path.push("");else if(!E(F)||"/"===V.c()||b(o)&&"\\"===V.c()){if(!E(F)){if("file"===o.scheme&&0===o.path.length&&O(F)){null!==o.host&&""!==o.host&&(y("Invalid input string."),o.host="");var $=Array.from(F);F=$.slice(0,1)+":"+$.slice(2)}o.path.push(F)}}else o.path.push("");if(F="","file"===o.scheme&&(""===V.c()||"?"===V.c()||"#"===V.c()))for(;o.path.length>1&&""===o.path[0];)y("Invalid input string."),o.path.splice(0,1);"?"===V.c()&&(o.query="",A=s.ParserState.Query),"#"===V.c()&&(o.fragment="",A=s.ParserState.Fragment)}else m.test(V.c())||"%"===V.c()||y("Character is not a URL code point or a percent encoded character."),"%"!==V.c()||/^[0-9a-fA-F][0-9a-fA-F]/.test(V.remaining())||y("Percent encoded character must be followed by two hex digits."),F+=G(V.c(),f);break;case s.ParserState.CannotBeABaseURLPath:"?"===V.c()?(o.query="",A=s.ParserState.Query):"#"===V.c()?(o.fragment="",A=s.ParserState.Fragment):(""===V.c()||m.test(V.c())||"%"===V.c()||y("Character is not a URL code point or a percent encoded character."),"%"!==V.c()||/^[0-9a-fA-F][0-9a-fA-F]/.test(V.remaining())||y("Percent encoded character must be followed by two hex digits."),""!==V.c()&&(o.path[0]+=G(V.c(),d)));break;case s.ParserState.Query:if("UTF-8"===R||b(o)&&"ws"!==o.scheme&&"wss"!==o.scheme||(R="UTF-8"),void 0===i&&"#"===V.c())o.fragment="",A=s.ParserState.Fragment;else if(""!==V.c()){if(m.test(V.c())||"%"===V.c()||y("Character is not a URL code point or a percent encoded character."),"%"!==V.c()||/^[0-9a-fA-F][0-9a-fA-F]/.test(V.remaining())||y("Percent encoded character must be followed by two hex digits."),"UTF-8"!==R.toUpperCase())throw new Error("Only UTF-8 encoding is supported.");var q=a.utf8Encode(V.c());if(q.length>=3&&38===q[0]&&35===q[1]&&59===q[q.length-1])q=q.subarray(2,q.length-1),o.query+="%26%23"+l.byteSequence.isomorphicDecode(q)+"%3B";else try{for(var Y=(g=void 0,n(q)),J=Y.next();!J.done;J=Y.next()){var Q=J.value;Q<33||Q>126||34===Q||35===Q||60===Q||62===Q||39===Q&&b(o)?o.query+=k(Q):o.query+=String.fromCharCode(Q)}}catch(e){g={error:e}}finally{try{J&&!J.done&&(S=Y.return)&&S.call(Y)}finally{if(g)throw g.error}}}break;case s.ParserState.Fragment:""===V.c()||("\0"===V.c()?y("NULL character in input string."):(m.test(V.c())||"%"===V.c()||y("Unexpected character in fragment string."),"%"!==V.c()||/^[A-Za-z0-9][A-Za-z0-9]/.test(V.remaining())||y("Unexpected character in fragment string."),o.fragment+=G(V.c(),p)))}if(V.eof)break;V.pointer++}return o}function E(e){return"."===e||"%2e"===e.toLowerCase()}function D(e){var t=e.toLowerCase();return".."===t||".%2e"===t||"%2e."===t||"%2e%2e"===t}function P(e){var t=e.path;0!==t.length&&("file"===e.scheme&&1===t.length&&I(t[0])||e.path.splice(e.path.length-1,1))}function I(e){return e.length>=2&&l.codePoint.ASCIIAlpha.test(e[0])&&":"===e[1]}function O(e){return e.length>=2&&l.codePoint.ASCIIAlpha.test(e[0])&&(":"===e[1]||"|"===e[1])}function N(e){return e.length>=2&&O(e)&&(2===e.length||"/"===e[2]||"\\"===e[2]||"?"===e[2]||"#"===e[2])}function M(e,t){if(void 0===t&&(t=!1),e.startsWith("["))return e.endsWith("]")?B(e.substring(1,e.length-1)):(y("Expected ']' after '['."),null);if(t)return L(e);var r=W(a.utf8Decode(V(e)));if(null===r)return y("Invalid domain."),null;if(g.test(r))return y("Invalid domain."),null;var n=F(r);return null===n||a.isNumber(n)?n:r}function R(e,t){void 0===t&&(t={value:!1});var r=10;return e.startsWith("0x")||e.startsWith("0X")?(t.value=!0,e=e.substr(2),r=16):e.length>=2&&"0"===e[0]&&(t.value=!0,e=e.substr(1),r=8),""===e?0:(10===r?/^[0-9]+$/:16===r?/^[0-9A-Fa-f]+$/:/^[0-7]+$/).test(e)?parseInt(e,r):null}function F(e){var t,r,o,i,a={value:!1},s=e.split(".");if(""===s[s.length-1]&&(a.value=!0,s.length>1&&s.pop()),s.length>4)return e;var l=[];try{for(var u=n(s),c=u.next();!c.done;c=u.next()){var d=c.value;if(""===d)return e;if(null===(v=R(d,a)))return e;l.push(v)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}a.value&&y("Invalid IP v4 address.");for(var p=0;p255&&(y("Invalid IP v4 address."),p=Math.pow(256,5-l.length))return y("Invalid IP v4 address."),null;var f=l[l.length-1];l.pop();var h=0;try{for(var m=n(l),g=m.next();!g.done;g=m.next()){var v;f+=(v=g.value)*Math.pow(256,3-h),h++}}catch(e){o={error:e}}finally{try{g&&!g.done&&(i=m.return)&&i.call(m)}finally{if(o)throw o.error}}return f}function B(e){var t,r=[0,0,0,0,0,0,0,0],n=0,i=null,s=new a.StringWalker(e);if(":"===s.c()){if(!s.remaining().startsWith(":"))return y("Invalid IP v6 address."),null;s.pointer+=2,i=n+=1}for(;""!==s.c();){if(8===n)return y("Invalid IP v6 address."),null;if(":"!==s.c()){for(var u=0,c=0;c<4&&l.codePoint.ASCIIHexDigit.test(s.c());)u=16*u+parseInt(s.c(),16),s.pointer++,c++;if("."===s.c()){if(0===c)return y("Invalid IP v6 address."),null;if(s.pointer-=c,n>6)return y("Invalid IP v6 address."),null;for(var d=0;""!==s.c();){var p=null;if(d>0){if(!("."===s.c()&&d<4))return y("Invalid IP v6 address."),null;s.pointer++}if(!l.codePoint.ASCIIDigit.test(s.c()))return y("Invalid IP v6 address."),null;for(;l.codePoint.ASCIIDigit.test(s.c());){var f=parseInt(s.c(),10);if(null===p)p=f;else{if(0===p)return y("Invalid IP v6 address."),null;p=10*p+f}if(p>255)return y("Invalid IP v6 address."),null;s.pointer++}if(null===p)return y("Invalid IP v6 address."),null;r[n]=256*r[n]+p,2!==++d&&4!==d||n++}if(4!==d)return y("Invalid IP v6 address."),null;break}if(":"===s.c()){if(s.pointer++,""===s.c())return y("Invalid IP v6 address."),null}else if(""!==s.c())return y("Invalid IP v6 address."),null;r[n]=u,n++}else{if(null!==i)return y("Invalid IP v6 address."),null;s.pointer++,i=++n}}if(null!==i){var h=n-i;for(n=7;0!==n&&h>0;)t=o([r[i+h-1],r[n]],2),r[n]=t[0],r[i+h-1]=t[1],n--,h--}else if(null===i&&8!==n)return y("Invalid IP v6 address."),null;return r}function L(e){var t,r;if(/[\x00\t\f\r #/:?@\[\\\]]/.test(e))return y("Invalid host string."),null;var o="";try{for(var i=n(e),a=i.next();!a.done;a=i.next())o+=G(a.value,d)}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return o}function k(e){return"%"+("00"+e.toString(16).toUpperCase()).slice(-2)}function U(e){for(var t=function(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102},r=new Uint8Array(e.length),n=0,o=0;o=e.length-2)r[n]=i,n++;else if(37!==i||t(e[o+1])&&t(e[o+2])){var s=parseInt(a.utf8Decode(Uint8Array.of(e[o+1],e[o+2])),16);r[n]=s,n++,o+=2}else r[n]=i,n++}return r.subarray(0,n)}function V(e){return U(a.utf8Encode(e))}function G(e,t){var r,o;if(!t.test(e))return e;var i=a.utf8Encode(e),s="";try{for(var l=n(i),u=l.next();!u.done;u=l.next())s+=k(u.value)}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(r)throw r.error}}return s}function z(e){var t,r,o,i,s=[],l=[];try{for(var u=n(e),c=u.next();!c.done;c=u.next()){var d=c.value;38===d?(s.push(Uint8Array.from(l)),l=[]):l.push(d)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}0!==l.length&&s.push(Uint8Array.from(l));var p=[];try{for(var f=n(s),h=f.next();!h.done;h=f.next()){var m=h.value;if(0!==m.length){for(var g=m.indexOf(61),y=-1!==g?m.slice(0,g):m,v=-1!==g?m.slice(g+1):new Uint8Array,b=0;b=48&&s<=57||s>=65&&s<=90||95===s||s>=97&&s<=122?String.fromCodePoint(s):k(s)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return o}function W(e,t){void 0===t&&(t=!1);var r=u.domainToASCII(e);return""===r?(y("Invalid domain name."),null):r}t.setValidationErrorCallback=function(e){i=e},t.newURL=function(){return{scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null,_cannotBeABaseURLFlag:!1,_blobURLEntry:null}},t.isSpecialScheme=v,t.isSpecial=b,t.defaultPort=x,t.includesCredentials=_,t.cannotHaveAUsernamePasswordPort=function(e){return null===e.host||""===e.host||e._cannotBeABaseURLFlag||"file"===e.scheme},t.urlSerializer=S,t.hostSerializer=C,t.iPv4Serializer=T,t.iPv6Serializer=w,t.urlParser=function(e,t,r){var n=A(e,t,r);return null===n?null:("blob"!==n.scheme||(n._blobURLEntry=null),n)},t.basicURLParser=A,t.setTheUsername=function(e,t){var r,o,i="";try{for(var a=n(t),s=a.next();!s.done;s=a.next())i+=G(s.value,h)}catch(e){r={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}e.username=i},t.setThePassword=function(e,t){var r,o,i="";try{for(var a=n(t),s=a.next();!s.done;s=a.next())i+=G(s.value,h)}catch(e){r={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}e.password=i},t.isSingleDotPathSegment=E,t.isDoubleDotPathSegment=D,t.shorten=P,t.isNormalizedWindowsDriveLetter=I,t.isWindowsDriveLetter=O,t.startsWithAWindowsDriveLetter=N,t.hostParser=M,t.iPv4NumberParser=R,t.iPv4Parser=F,t.iPv6Parser=B,t.opaqueHostParser=L,t.resolveABlobURL=function(e){return null},t.percentEncode=k,t.percentDecode=U,t.stringPercentDecode=V,t.utf8PercentEncode=G,t.hostEquals=function(e,t){return e===t},t.urlEquals=function(e,t,r){return void 0===r&&(r=!1),S(e,r)===S(t,r)},t.urlEncodedStringParser=function(e){return z(a.utf8Encode(e))},t.urlEncodedParser=z,t.urlEncodedByteSerializer=j,t.urlEncodedSerializer=function(e,t){var r,o;if("UTF-8"!==(void 0===t||"replacement"===t||"UTF-16BE"===t||"UTF-16LE"===t?"UTF-8":t).toUpperCase())throw new Error("Only UTF-8 encoding is supported.");var i="";try{for(var s=n(e),l=s.next();!l.done;l=s.next()){var u=l.value,c=j(a.utf8Encode(u[0])),d=u[1];d=j(a.utf8Encode(d)),""!==i&&(i+="&"),i+=c+"="+d}}catch(e){r={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}return i},t.origin=function e(t){switch(t.scheme){case"blob":t._blobURLEntry;var r=A(t.path[0]);return null===r?s.OpaqueOrigin:e(r);case"ftp":case"http":case"https":case"ws":case"wss":return[t.scheme,null===t.host?"":t.host,t.port,null];default:return s.OpaqueOrigin}},t.domainToASCII=W,t.domainToUnicode=function(e,t){void 0===t&&(t=!1);var r=u.domainToUnicode(e);return""===r&&y("Invalid domain name."),r},t.asciiSerializationOfAnOrigin=function(e){if(""===e[0]&&""===e[1]&&null===e[2]&&null===e[3])return"null";var t=e[0]+"://"+C(e[1]);return null!==e[2]&&(t+=":"+e[2].toString()),t}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=function(){function e(){this._signal=n.create_abortSignal()}return Object.defineProperty(e.prototype,"signal",{get:function(){return this._signal},enumerable:!0,configurable:!0}),e.prototype.abort=function(){n.abort_signalAbort(this._signal)},e}();t.AbortControllerImpl=o},function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var i=r(70),a=r(0),s=function(e){function t(){var t=e.call(this)||this;return t._abortedFlag=!1,t._abortAlgorithms=new Set,t}return o(t,e),Object.defineProperty(t.prototype,"aborted",{get:function(){return this._abortedFlag},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"onabort",{get:function(){return a.event_getterEventHandlerIDLAttribute(this,"onabort")},set:function(e){a.event_setterEventHandlerIDLAttribute(this,"onabort",e)},enumerable:!0,configurable:!0}),t._create=function(){return new t},t}(i.EventTargetImpl);t.AbortSignalImpl=s},function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var i=r(2),a=r(34),s=r(12),l=function(e){function t(t,r,n){var o=e.call(this)||this;return o._name="",o._publicId="",o._systemId="",o._name=t,o._publicId=r,o._systemId=n,o}return o(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"publicId",{get:function(){return this._publicId},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"systemId",{get:function(){return this._systemId},enumerable:!0,configurable:!0}),t.prototype.before=function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=r(6),i=r(1),a=r(0),s=function(){function e(e){return this._live=!0,this._filter=null,this._length=0,this._root=e,new Proxy(this,this)}return Object.defineProperty(e.prototype,"length",{get:function(){return this._root._children.size},enumerable:!0,configurable:!0}),e.prototype.item=function(e){if(e<0||e>this.length-1)return null;if(e=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=r(6),i=r(1),a=function(){function e(e){return this._live=!1,this._items=[],this._length=0,this._root=e,this._items=[],this._filter=function(e){return!0},new Proxy(this,this)}return Object.defineProperty(e.prototype,"length",{get:function(){return this._items.length},enumerable:!0,configurable:!0}),e.prototype.item=function(e){return e<0||e>this.length-1?null:this._items[e]},e.prototype.keys=function(){var e;return(e={})[Symbol.iterator]=function(){var e=0;return{next:function(){return e===this.length?{done:!0,value:null}:{done:!1,value:e++}}.bind(this)}}.bind(this),e},e.prototype.values=function(){var e;return(e={})[Symbol.iterator]=function(){var e=this[Symbol.iterator]();return{next:function(){return e.next()}}}.bind(this),e},e.prototype.entries=function(){var e;return(e={})[Symbol.iterator]=function(){var e=this[Symbol.iterator](),t=0;return{next:function(){var r=e.next();return r.done?{done:!0,value:null}:{done:!1,value:[t++,r.value]}}}}.bind(this),e},e.prototype[Symbol.iterator]=function(){var e=this._items[Symbol.iterator]();return{next:function(){return e.next()}}},e.prototype.forEach=function(e,t){var r,i;void 0===t&&(t=o.dom.window);var a=0;try{for(var s=n(this._items),l=s.next();!l.done;l=s.next()){var u=l.value;e.call(t,u,a++,this)}}catch(e){r={error:e}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}},e.prototype.get=function(e,t,r){if(!i.isString(t))return Reflect.get(e,t,r);var n=Number(t);return isNaN(n)?Reflect.get(e,t,r):e._items[n]||void 0},e.prototype.set=function(e,t,r,n){if(!i.isString(t))return Reflect.set(e,t,r,n);var o=Number(t);return isNaN(o)?Reflect.set(e,t,r,n):o>=0&&o=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=r(6),s=r(2),l=r(102),u=r(9),c=r(0),d=r(12),p=r(3),f=function(e){function t(){var t=e.call(this)||this,r=a.dom.window._associatedDocument;return t._start=[r,0],t._end=[r,0],a.dom.rangeList.add(t),t}return o(t,e),Object.defineProperty(t.prototype,"commonAncestorContainer",{get:function(){for(var e=this._start[0];!c.tree_isAncestorOf(this._end[0],e,!0);){if(null===e._parent)throw new Error("Parent node is null.");e=e._parent}return e},enumerable:!0,configurable:!0}),t.prototype.setStart=function(e,t){c.range_setTheStart(this,e,t)},t.prototype.setEnd=function(e,t){c.range_setTheEnd(this,e,t)},t.prototype.setStartBefore=function(e){var t=e._parent;if(null===t)throw new u.InvalidNodeTypeError;c.range_setTheStart(this,t,c.tree_index(e))},t.prototype.setStartAfter=function(e){var t=e._parent;if(null===t)throw new u.InvalidNodeTypeError;c.range_setTheStart(this,t,c.tree_index(e)+1)},t.prototype.setEndBefore=function(e){var t=e._parent;if(null===t)throw new u.InvalidNodeTypeError;c.range_setTheEnd(this,t,c.tree_index(e))},t.prototype.setEndAfter=function(e){var t=e._parent;if(null===t)throw new u.InvalidNodeTypeError;c.range_setTheEnd(this,t,c.tree_index(e)+1)},t.prototype.collapse=function(e){e?this._end=this._start:this._start=this._end},t.prototype.selectNode=function(e){c.range_select(e,this)},t.prototype.selectNodeContents=function(e){if(p.Guard.isDocumentTypeNode(e))throw new u.InvalidNodeTypeError;var t=c.tree_nodeLength(e);this._start=[e,0],this._end=[e,t]},t.prototype.compareBoundaryPoints=function(e,t){if(e!==s.HowToCompare.StartToStart&&e!==s.HowToCompare.StartToEnd&&e!==s.HowToCompare.EndToEnd&&e!==s.HowToCompare.EndToStart)throw new u.NotSupportedError;if(c.range_root(this)!==c.range_root(t))throw new u.WrongDocumentError;var r,n;switch(e){case s.HowToCompare.StartToStart:r=this._start,n=t._start;break;case s.HowToCompare.StartToEnd:r=this._end,n=t._start;break;case s.HowToCompare.EndToEnd:r=this._end,n=t._end;break;case s.HowToCompare.EndToStart:r=this._start,n=t._end;break;default:throw new u.NotSupportedError}var o=c.boundaryPoint_position(r,n);return o===s.BoundaryPosition.Before?-1:o===s.BoundaryPosition.After?1:0},t.prototype.deleteContents=function(){var e,t,r,n;if(!c.range_collapsed(this)){var o=this._startNode,a=this._startOffset,s=this._endNode,l=this._endOffset;if(o===s&&p.Guard.isCharacterDataNode(o))c.characterData_replaceData(o,a,l-a,"");else{var u,d,f=[];try{for(var h=i(c.range_getContainedNodes(this)),m=h.next();!m.done;m=h.next()){var g=(x=m.value)._parent;null!==g&&c.range_isContained(g,this)||f.push(x)}}catch(t){e={error:t}}finally{try{m&&!m.done&&(t=h.return)&&t.call(h)}finally{if(e)throw e.error}}if(c.tree_isAncestorOf(s,o,!0))u=o,d=a;else{for(var y=o;null!==y._parent&&!c.tree_isAncestorOf(s,y._parent,!0);)y=y._parent;if(null===y._parent)throw new Error("Parent node is null.");u=y._parent,d=c.tree_index(y)+1}p.Guard.isCharacterDataNode(o)&&c.characterData_replaceData(o,a,c.tree_nodeLength(o)-a,"");try{for(var v=i(f),b=v.next();!b.done;b=v.next()){var x;(x=b.value)._parent&&c.mutation_remove(x,x._parent)}}catch(e){r={error:e}}finally{try{b&&!b.done&&(n=v.return)&&n.call(v)}finally{if(r)throw r.error}}p.Guard.isCharacterDataNode(s)&&c.characterData_replaceData(s,0,l,""),this._start=[u,d],this._end=[u,d]}}},t.prototype.extractContents=function(){return c.range_extract(this)},t.prototype.cloneContents=function(){return c.range_cloneTheContents(this)},t.prototype.insertNode=function(e){return c.range_insert(e,this)},t.prototype.surroundContents=function(e){var t,r;try{for(var n=i(c.range_getPartiallyContainedNodes(this)),o=n.next();!o.done;o=n.next()){var a=o.value;if(!p.Guard.isTextNode(a))throw new u.InvalidStateError}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}if(p.Guard.isDocumentNode(e)||p.Guard.isDocumentTypeNode(e)||p.Guard.isDocumentFragmentNode(e))throw new u.InvalidNodeTypeError;var s=c.range_extract(this);0!==e._children.size&&c.mutation_replaceAll(null,e),c.range_insert(e,this),c.mutation_append(s,e),c.range_select(e,this)},t.prototype.cloneRange=function(){return c.create_range(this._start,this._end)},t.prototype.detach=function(){a.dom.rangeList.delete(this)},t.prototype.isPointInRange=function(e,t){if(c.tree_rootNode(e)!==c.range_root(this))return!1;if(p.Guard.isDocumentTypeNode(e))throw new u.InvalidNodeTypeError;if(t>c.tree_nodeLength(e))throw new u.IndexSizeError;var r=[e,t];return c.boundaryPoint_position(r,this._start)!==s.BoundaryPosition.Before&&c.boundaryPoint_position(r,this._end)!==s.BoundaryPosition.After},t.prototype.comparePoint=function(e,t){if(c.tree_rootNode(e)!==c.range_root(this))throw new u.WrongDocumentError;if(p.Guard.isDocumentTypeNode(e))throw new u.InvalidNodeTypeError;if(t>c.tree_nodeLength(e))throw new u.IndexSizeError;var r=[e,t];return c.boundaryPoint_position(r,this._start)===s.BoundaryPosition.Before?-1:c.boundaryPoint_position(r,this._end)===s.BoundaryPosition.After?1:0},t.prototype.intersectsNode=function(e){if(c.tree_rootNode(e)!==c.range_root(this))return!1;var t=e._parent;if(null===t)return!0;var r=c.tree_index(e);return c.boundaryPoint_position([t,r],this._end)===s.BoundaryPosition.Before&&c.boundaryPoint_position([t,r+1],this._start)===s.BoundaryPosition.After},t.prototype.toString=function(){var e,t,r="";if(this._startNode===this._endNode&&p.Guard.isTextNode(this._startNode))return this._startNode._data.substring(this._startOffset,this._endOffset);p.Guard.isTextNode(this._startNode)&&(r+=this._startNode._data.substring(this._startOffset));try{for(var n=i(c.range_getContainedNodes(this)),o=n.next();!o.done;o=n.next()){var a=o.value;p.Guard.isTextNode(a)&&(r+=a._data)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return p.Guard.isTextNode(this._endNode)&&(r+=this._endNode._data.substring(0,this._endOffset)),r},t._create=function(e,r){var n=new t;return e&&(n._start=e),r&&(n._end=r),n},t.START_TO_START=0,t.START_TO_END=1,t.END_TO_END=2,t.END_TO_START=3,t}(l.AbstractRangeImpl);t.RangeImpl=f,d.idl_defineConst(f.prototype,"START_TO_START",0),d.idl_defineConst(f.prototype,"START_TO_END",1),d.idl_defineConst(f.prototype,"END_TO_END",2),d.idl_defineConst(f.prototype,"END_TO_START",3)},function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var i=r(103),a=r(0),s=function(e){function t(t,r,n){var o=e.call(this,t)||this;return o._iteratorCollection=void 0,o._reference=r,o._pointerBeforeReference=n,a.nodeIterator_iteratorList().add(o),o}return o(t,e),Object.defineProperty(t.prototype,"referenceNode",{get:function(){return this._reference},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pointerBeforeReferenceNode",{get:function(){return this._pointerBeforeReference},enumerable:!0,configurable:!0}),t.prototype.nextNode=function(){return a.nodeIterator_traverse(this,!0)},t.prototype.previousNode=function(){return a.nodeIterator_traverse(this,!1)},t.prototype.detach=function(){a.nodeIterator_iteratorList().delete(this)},t._create=function(e,r,n){return new t(e,r,n)},t}(i.TraverserImpl);t.NodeIteratorImpl=s},function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var i=r(2),a=r(103),s=r(0),l=function(e){function t(t,r){var n=e.call(this,t)||this;return n._current=r,n}return o(t,e),Object.defineProperty(t.prototype,"currentNode",{get:function(){return this._current},set:function(e){this._current=e},enumerable:!0,configurable:!0}),t.prototype.parentNode=function(){for(var e=this._current;null!==e&&e!==this._root;)if(null!==(e=e._parent)&&s.traversal_filter(this,e)===i.FilterResult.Accept)return this._current=e,e;return null},t.prototype.firstChild=function(){return s.treeWalker_traverseChildren(this,!0)},t.prototype.lastChild=function(){return s.treeWalker_traverseChildren(this,!1)},t.prototype.nextSibling=function(){return s.treeWalker_traverseSiblings(this,!0)},t.prototype.previousNode=function(){for(var e=this._current;e!==this._root;){for(var t=e._previousSibling;t;){e=t;for(var r=s.traversal_filter(this,e);r!==i.FilterResult.Reject&&e._lastChild;)e=e._lastChild,r=s.traversal_filter(this,e);if(r===i.FilterResult.Accept)return this._current=e,e;t=e._previousSibling}if(e===this._root||null===e._parent)return null;if(e=e._parent,s.traversal_filter(this,e)===i.FilterResult.Accept)return this._current=e,e}return null},t.prototype.previousSibling=function(){return s.treeWalker_traverseSiblings(this,!1)},t.prototype.nextNode=function(){for(var e=this._current,t=i.FilterResult.Accept;;){for(;t!==i.FilterResult.Reject&&e._firstChild;)if(e=e._firstChild,(t=s.traversal_filter(this,e))===i.FilterResult.Accept)return this._current=e,e;for(var r=null,n=e;null!==n;){if(n===this._root)return null;if(null!==(r=n._nextSibling)){e=r;break}n=n._parent}if((t=s.traversal_filter(this,e))===i.FilterResult.Accept)return this._current=e,e}},t._create=function(e,r){return new t(e,r)},t}(a.TraverserImpl);t.TreeWalkerImpl=l},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(2),o=r(12),i=function(){function e(){}return e.prototype.acceptNode=function(e){return n.FilterResult.Accept},e._create=function(){return new e},e.FILTER_ACCEPT=1,e.FILTER_REJECT=2,e.FILTER_SKIP=3,e.SHOW_ALL=4294967295,e.SHOW_ELEMENT=1,e.SHOW_ATTRIBUTE=2,e.SHOW_TEXT=4,e.SHOW_CDATA_SECTION=8,e.SHOW_ENTITY_REFERENCE=16,e.SHOW_ENTITY=32,e.SHOW_PROCESSING_INSTRUCTION=64,e.SHOW_COMMENT=128,e.SHOW_DOCUMENT=256,e.SHOW_DOCUMENT_TYPE=512,e.SHOW_DOCUMENT_FRAGMENT=1024,e.SHOW_NOTATION=2048,e}();t.NodeFilterImpl=i,o.idl_defineConst(i.prototype,"FILTER_ACCEPT",1),o.idl_defineConst(i.prototype,"FILTER_REJECT",2),o.idl_defineConst(i.prototype,"FILTER_SKIP",3),o.idl_defineConst(i.prototype,"SHOW_ALL",4294967295),o.idl_defineConst(i.prototype,"SHOW_ELEMENT",1),o.idl_defineConst(i.prototype,"SHOW_ATTRIBUTE",2),o.idl_defineConst(i.prototype,"SHOW_TEXT",4),o.idl_defineConst(i.prototype,"SHOW_CDATA_SECTION",8),o.idl_defineConst(i.prototype,"SHOW_ENTITY_REFERENCE",16),o.idl_defineConst(i.prototype,"SHOW_ENTITY",32),o.idl_defineConst(i.prototype,"SHOW_PROCESSING_INSTRUCTION",64),o.idl_defineConst(i.prototype,"SHOW_COMMENT",128),o.idl_defineConst(i.prototype,"SHOW_DOCUMENT",256),o.idl_defineConst(i.prototype,"SHOW_DOCUMENT_TYPE",512),o.idl_defineConst(i.prototype,"SHOW_DOCUMENT_FRAGMENT",1024),o.idl_defineConst(i.prototype,"SHOW_NOTATION",2048)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t,r,n,o,i,a,s,l){this._type=e,this._target=t,this._addedNodes=r,this._removedNodes=n,this._previousSibling=o,this._nextSibling=i,this._attributeName=a,this._attributeNamespace=s,this._oldValue=l}return Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this._target},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"addedNodes",{get:function(){return this._addedNodes},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"removedNodes",{get:function(){return this._removedNodes},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"previousSibling",{get:function(){return this._previousSibling},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nextSibling",{get:function(){return this._nextSibling},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"attributeName",{get:function(){return this._attributeName},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"attributeNamespace",{get:function(){return this._attributeNamespace},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"oldValue",{get:function(){return this._oldValue},enumerable:!0,configurable:!0}),e._create=function(t,r,n,o,i,a,s,l,u){return new e(t,r,n,o,i,a,s,l,u)},e}();t.MutationRecordImpl=n},function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=r(6),i=r(9),a=r(7),s=r(0),l=function(){function e(e,t){this._element=e,this._attribute=t,this._tokenSet=new Set;var r=t._localName,n=s.element_getAnAttributeValue(e,r),i=this;this._element._attributeChangeSteps.push(function(e,t,r,n,o){t===i._attribute._localName&&null===o&&(n?i._tokenSet=s.orderedSet_parse(n):i._tokenSet.clear())}),o.dom.features.steps&&s.dom_runAttributeChangeSteps(e,r,n,n,null)}return Object.defineProperty(e.prototype,"length",{get:function(){return this._tokenSet.size},enumerable:!0,configurable:!0}),e.prototype.item=function(e){var t,r,o=0;try{for(var i=n(this._tokenSet),a=i.next();!a.done;a=i.next()){var s=a.value;if(o===e)return s;o++}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return null},e.prototype.contains=function(e){return this._tokenSet.has(e)},e.prototype.add=function(){for(var e,t,r=[],o=0;o=97&&r<=122||r>=65&&r<=90||58===r||95===r||r>=192&&r<=214||r>=216&&r<=246||r>=248&&r<=767||r>=880&&r<=893||r>=895&&r<=8191||r>=8204&&r<=8205||r>=8304&&r<=8591||r>=11264&&r<=12271||r>=12289&&r<=55295||r>=63744&&r<=64975||r>=65008&&r<=65533||0!==t&&(45===r||46===r||r>=48&&r<=57||183===r||r>=768&&r<=879||r>=8255&&r<=8256))){if(r>=55296&&r<=56319&&t=56320&&n<=57343&&(t++,(r=1024*(r-55296)+n-56320+65536)>=65536&&r<=983039))continue}return!1}}return!0},t.xml_isQName=function(e){for(var t=!1,r=0;r=97&&n<=122||n>=65&&n<=90||95===n||n>=192&&n<=214||n>=216&&n<=246||n>=248&&n<=767||n>=880&&n<=893||n>=895&&n<=8191||n>=8204&&n<=8205||n>=8304&&n<=8591||n>=11264&&n<=12271||n>=12289&&n<=55295||n>=63744&&n<=64975||n>=65008&&n<=65533||0!==r&&(45===n||46===n||n>=48&&n<=57||183===n||n>=768&&n<=879||n>=8255&&n<=8256))){if(0===r||58!==n){if(n>=55296&&n<=56319&&r=56320&&o<=57343&&(r++,(n=1024*(n-55296)+o-56320+65536)>=65536&&n<=983039))continue}return!1}if(t)return!1;if(r===e.length-1)return!1;t=!0}}return!0},t.xml_isLegalChar=function(e){for(var t=0;t=32&&r<=55295||r>=57344&&r<=65533)){if(r>=55296&&r<=56319&&t=56320&&n<=57343&&(t++,(r=1024*(r-55296)+n-56320+65536)>=65536&&r<=1114111))continue}return!1}}return!0},t.xml_isPubidChar=function(e){for(var t=0;t=97&&r<=122||r>=65&&r<=90||r>=39&&r<=59||32===r||13===r||10===r||r>=35&&r<=37||33===r||61===r||63===r||64===r||95===r))return!1}return!0}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(2),o=r(17);t.boundaryPoint_position=function e(t,r){var i=t[0],a=t[1],s=r[0],l=r[1];if(console.assert(o.tree_rootNode(i)===o.tree_rootNode(s),"Boundary points must share the same root node."),i===s)return a===l?n.BoundaryPosition.Equal:a=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=r(6),i=r(3),a=r(7),s=r(29),l=r(108),u=r(30),c=r(37),d=r(52);t.node_stringReplaceAll=function(e,t){var r=null;""!==e&&(r=s.create_text(t._nodeDocument,e)),c.mutation_replaceAll(r,t)},t.node_clone=function e(t,r,a){var l,p,f,h,m;if(void 0===r&&(r=null),void 0===a&&(a=!1),null===r&&(r=t._nodeDocument),i.Guard.isElementNode(t)){m=d.element_createAnElement(r,t._localName,t._namespace,t._namespacePrefix,t._is,!1);try{for(var g=n(t._attributeList),y=g.next();!y.done;y=g.next()){var v=e(y.value,r);d.element_append(v,m)}}catch(e){l={error:e}}finally{try{y&&!y.done&&(p=g.return)&&p.call(g)}finally{if(l)throw l.error}}}else if(i.Guard.isDocumentNode(t)){var b=s.create_document();b._encoding=t._encoding,b._contentType=t._contentType,b._URL=t._URL,b._origin=t._origin,b._type=t._type,b._mode=t._mode,m=b}else if(i.Guard.isDocumentTypeNode(t))m=s.create_documentType(r,t._name,t._publicId,t._systemId);else if(i.Guard.isAttrNode(t)){var x=s.create_attr(r,t.localName);x._namespace=t._namespace,x._namespacePrefix=t._namespacePrefix,x._value=t._value,m=x}else m=i.Guard.isExclusiveTextNode(t)?s.create_text(r,t._data):i.Guard.isCDATASectionNode(t)?s.create_cdataSection(r,t._data):i.Guard.isCommentNode(t)?s.create_comment(r,t._data):i.Guard.isProcessingInstructionNode(t)?s.create_processingInstruction(r,t._target,t._data):i.Guard.isDocumentFragmentNode(t)?s.create_documentFragment(r):Object.create(t);if(i.Guard.isDocumentNode(m)?(m._nodeDocument=m,r=m):m._nodeDocument=r,o.dom.features.steps&&u.dom_runCloningSteps(m,t,r,a),a)try{for(var _=n(t._children),S=_.next();!S.done;S=_.next()){var C=e(S.value,r,!0);c.mutation_append(C,m)}}catch(e){f={error:e}}finally{try{S&&!S.done&&(h=_.return)&&h.call(_)}finally{if(f)throw f.error}}return m},t.node_equals=function e(t,r){var o,a,s,l;if(t._nodeType!==r._nodeType)return!1;if(i.Guard.isDocumentTypeNode(t)&&i.Guard.isDocumentTypeNode(r)){if(t._name!==r._name||t._publicId!==r._publicId||t._systemId!==r._systemId)return!1}else if(i.Guard.isElementNode(t)&&i.Guard.isElementNode(r)){if(t._namespace!==r._namespace||t._namespacePrefix!==r._namespacePrefix||t._localName!==r._localName||t._attributeList.length!==r._attributeList.length)return!1}else if(i.Guard.isAttrNode(t)&&i.Guard.isAttrNode(r)){if(t._namespace!==r._namespace||t._localName!==r._localName||t._value!==r._value)return!1}else if(i.Guard.isProcessingInstructionNode(t)&&i.Guard.isProcessingInstructionNode(r)){if(t._target!==r._target||t._data!==r._data)return!1}else if(i.Guard.isCharacterDataNode(t)&&i.Guard.isCharacterDataNode(r)&&t._data!==r._data)return!1;if(i.Guard.isElementNode(t)&&i.Guard.isElementNode(r)){var u={};try{for(var c=n(t._attributeList),d=c.next();!d.done;d=c.next())u[(h=d.value)._localName]=h}catch(e){o={error:e}}finally{try{d&&!d.done&&(a=c.return)&&a.call(c)}finally{if(o)throw o.error}}try{for(var p=n(r._attributeList),f=p.next();!f.done;f=p.next()){var h,m=f.value;if(!(h=u[m._localName]))return!1;if(!e(h,m))return!1}}catch(e){s={error:e}}finally{try{f&&!f.done&&(l=p.return)&&l.call(p)}finally{if(s)throw s.error}}}if(t._children.size!==r._children.size)return!1;for(var g=t._children[Symbol.iterator](),y=r._children[Symbol.iterator](),v=g.next(),b=y.next();!v.done&&!b.done;){if(!e(v.value,b.value))return!1;v=g.next(),b=y.next()}return!0},t.node_listOfElementsWithQualifiedName=function(e,t){return"*"===e?s.create_htmlCollection(t):"html"===t._nodeDocument._type?s.create_htmlCollection(t,function(t){return t._namespace===a.namespace.HTML&&t._qualifiedName===e.toLowerCase()||t._namespace!==a.namespace.HTML&&t._qualifiedName===e}):s.create_htmlCollection(t,function(t){return t._qualifiedName===e})},t.node_listOfElementsWithNamespace=function(e,t,r){return""===e&&(e=null),"*"===e&&"*"===t?s.create_htmlCollection(r):"*"===e?s.create_htmlCollection(r,function(e){return e._localName===t}):"*"===t?s.create_htmlCollection(r,function(t){return t._namespace===e}):s.create_htmlCollection(r,function(r){return r._localName===t&&r._namespace===e})},t.node_listOfElementsWithClassNames=function(e,t){var r=l.orderedSet_parse(e);if(0===r.size)return s.create_htmlCollection(t,function(){return!1});var n="quirks"!==t._nodeDocument._mode;return s.create_htmlCollection(t,function(e){var t=e.classList;return l.orderedSet_contains(t._tokenSet,r,n)})},t.node_locateANamespacePrefix=function e(t,r){if(t._namespace===r&&null!==t._namespacePrefix)return t._namespacePrefix;for(var n=0;n=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=r(6),i=r(3),a=r(9),s=r(29),l=r(17),u=r(107),c=r(37);t.text_contiguousTextNodes=function(e,t){var r;return void 0===t&&(t=!1),(r={})[Symbol.iterator]=function(){for(var r=e;r&&i.Guard.isTextNode(r._previousSibling);)r=r._previousSibling;return{next:function(){if(r&&!t&&r===e&&(r=i.Guard.isTextNode(r._nextSibling)?r._nextSibling:null),null===r)return{done:!0,value:null};var n={done:!1,value:r};return r=i.Guard.isTextNode(r._nextSibling)?r._nextSibling:null,n}}},r},t.text_contiguousExclusiveTextNodes=function(e,t){var r;return void 0===t&&(t=!1),(r={})[Symbol.iterator]=function(){for(var r=e;r&&i.Guard.isExclusiveTextNode(r._previousSibling);)r=r._previousSibling;return{next:function(){if(r&&!t&&r===e&&(r=i.Guard.isExclusiveTextNode(r._nextSibling)?r._nextSibling:null),null===r)return{done:!0,value:null};var n={done:!1,value:r};return r=i.Guard.isExclusiveTextNode(r._nextSibling)?r._nextSibling:null,n}}},r},t.text_descendantTextContent=function(e){for(var t="",r=l.tree_getFirstDescendantNode(e,!1,!1,function(e){return i.Guard.isTextNode(e)});null!==r;)t+=r._data,r=l.tree_getNextDescendantNode(e,r,!1,!1,function(e){return i.Guard.isTextNode(e)});return t},t.text_split=function(e,t){var r,i,d=e._data.length;if(t>d)throw new a.IndexSizeError;var p=d-t,f=u.characterData_substringData(e,t,p),h=s.create_text(e._nodeDocument,f),m=e._parent;if(null!==m){c.mutation_insert(h,m,e._nextSibling);try{for(var g=n(o.dom.rangeList),y=g.next();!y.done;y=g.next()){var v=y.value;v._start[0]===e&&v._start[1]>t&&(v._start[0]=h,v._start[1]-=t),v._end[0]===e&&v._end[1]>t&&(v._end[0]=h,v._end[1]-=t);var b=l.tree_index(e);v._start[0]===m&&v._start[1]===b+1&&v._start[1]++,v._end[0]===m&&v._end[1]===b+1&&v._end[1]++}}catch(e){r={error:e}}finally{try{y&&!y.done&&(i=g.return)&&i.call(g)}finally{if(r)throw r.error}}}return u.characterData_replaceData(e,t,p,""),h}},function(e,t,r){"use strict";var n=r(4),o=r(41),i=r(24),a=r(48),s=[].join,l=o!=Object,u=a("join",",");n({target:"Array",proto:!0,forced:l||!u},{join:function(e){return s.call(i(this),void 0===e?",":e)}})},function(e,t,r){var n=r(4),o=r(83),i=String.fromCharCode,a=String.fromCodePoint;n({target:"String",stat:!0,forced:!!a&&1!=a.length},{fromCodePoint:function(e){for(var t,r=[],n=arguments.length,a=0;n>a;){if(t=+arguments[a++],o(t,1114111)!==t)throw RangeError(t+" is not a valid code point");r.push(t<65536?i(t):i(55296+((t-=65536)>>10),t%1024+56320))}return r.join("")}})},function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var o=r(111),i=function(){function e(e,t){this._options={skipWhitespaceOnlyText:!1},this.err={line:-1,col:-1,index:-1,str:""},this._str=e,this._index=0,this._length=e.length,t&&(this._options.skipWhitespaceOnlyText=t.skipWhitespaceOnlyText||!1)}return e.prototype.nextToken=function(){if(this.eof())return{type:o.TokenType.EOF};var t=this.skipIfStartsWith("<")?this.openBracket():this.text();return this._options.skipWhitespaceOnlyText&&t.type===o.TokenType.Text&&e.isWhiteSpaceToken(t)&&(t=this.nextToken()),t},e.prototype.openBracket=function(){return this.skipIfStartsWith("?")?this.skipIfStartsWith("xml")?e.isSpace(this._str[this._index])?this.declaration():(this.seek(-3),this.pi()):this.pi():this.skipIfStartsWith("!")?this.skipIfStartsWith("--")?this.comment():this.skipIfStartsWith("[CDATA[")?this.cdata():this.skipIfStartsWith("DOCTYPE")?this.doctype():void this.throwError("Invalid '!' in opening tag."):this.skipIfStartsWith("/")?this.closeTag():this.openTag()},e.prototype.declaration=function(){for(var e="",t="",r="";!this.eof();){if(this.skipSpace(),this.skipIfStartsWith("?>"))return{type:o.TokenType.Declaration,version:e,encoding:t,standalone:r};var i=n(this.attribute(),2),a=i[0],s=i[1];"version"===a?e=s:"encoding"===a?t=s:"standalone"===a?r=s:this.throwError("Invalid attribute name: "+a)}this.throwError("Missing declaration end symbol `?>`")},e.prototype.doctype=function(){var e="",t="";this.skipSpace();var r=this.takeUntil2("[",">",!0);return this.skipSpace(),this.skipIfStartsWith("PUBLIC")?(e=this.quotedString(),t=this.quotedString()):this.skipIfStartsWith("SYSTEM")&&(t=this.quotedString()),this.skipSpace(),this.skipIfStartsWith("[")&&(this.skipUntil("]"),this.skipIfStartsWith("]")||this.throwError("Missing end bracket of DTD internal subset")),this.skipSpace(),this.skipIfStartsWith(">")||this.throwError("Missing doctype end symbol `>`"),{type:o.TokenType.DocType,name:r,pubId:e,sysId:t}},e.prototype.pi=function(){var e=this.takeUntilStartsWith("?>",!0);if(this.eof()&&this.throwError("Missing processing instruction end symbol `?>`"),this.skipSpace(),this.skipIfStartsWith("?>"))return{type:o.TokenType.PI,target:e,data:""};var t=this.takeUntilStartsWith("?>");return this.eof()&&this.throwError("Missing processing instruction end symbol `?>`"),this.seek(2),{type:o.TokenType.PI,target:e,data:t}},e.prototype.text=function(){var e=this.takeUntil("<");return{type:o.TokenType.Text,data:e}},e.prototype.comment=function(){var e=this.takeUntilStartsWith("--\x3e");return this.eof()&&this.throwError("Missing comment end symbol `--\x3e`"),this.seek(3),{type:o.TokenType.Comment,data:e}},e.prototype.cdata=function(){var e=this.takeUntilStartsWith("]]>");return this.eof()&&this.throwError("Missing CDATA end symbol `]>`"),this.seek(3),{type:o.TokenType.CDATA,data:e}},e.prototype.openTag=function(){this.skipSpace();var e=this.takeUntil2(">","/",!0);if(this.skipSpace(),this.skipIfStartsWith(">"))return{type:o.TokenType.Element,name:e,attributes:[],selfClosing:!1};if(this.skipIfStartsWith("/>"))return{type:o.TokenType.Element,name:e,attributes:[],selfClosing:!0};for(var t=[];!this.eof();){if(this.skipSpace(),this.skipIfStartsWith(">"))return{type:o.TokenType.Element,name:e,attributes:t,selfClosing:!1};if(this.skipIfStartsWith("/>"))return{type:o.TokenType.Element,name:e,attributes:t,selfClosing:!0};var r=this.attribute();t.push(r)}this.throwError("Missing opening element tag end symbol `>`")},e.prototype.closeTag=function(){this.skipSpace();var e=this.takeUntil(">",!0);return this.skipSpace(),this.skipIfStartsWith(">")||this.throwError("Missing closing element tag end symbol `>`"),{type:o.TokenType.ClosingTag,name:e}},e.prototype.attribute=function(){this.skipSpace();var e=this.takeUntil("=",!0);return this.skipSpace(),this.skipIfStartsWith("=")||this.throwError("Missing equals sign before attribute value"),[e,this.quotedString()]},e.prototype.quotedString=function(){this.skipSpace();var t=this.take(1);e.isQuote(t)||this.throwError("Missing start quote character before quoted value");var r=this.takeUntil(t);return this.skipIfStartsWith(t)||this.throwError("Missing end quote character after quoted value"),r},e.prototype.eof=function(){return this._index>=this._length},e.prototype.skipIfStartsWith=function(e){var t=e.length;if(1===t)return this._str[this._index]===e&&(this._index++,!0);for(var r=0;rthis._length&&(this._index=this._length)},e.prototype.skipSpace=function(){for(;!this.eof()&&e.isSpace(this._str[this._index]);)this._index++},e.prototype.take=function(e){if(1===e)return this._str[this._index++];var t=this._index;return this.seek(e),this._str.slice(t,this._index)},e.prototype.takeUntil=function(t,r){void 0===r&&(r=!1);for(var n=this._index;this._indexthis._index){i=r.index;break}throw this.err={line:n,col:this._index-o,index:this._index,str:this._str.substring(o,i)},new Error(e+"\nIndex: "+this.err.index+"\nLn: "+this.err.line+", Col: "+this.err.col+"\nInput: "+this.err.str)},e.prototype[Symbol.iterator]=function(){return this._index=0,{next:function(){var e=this.nextToken();return e.type===o.TokenType.EOF?{done:!0,value:null}:{done:!1,value:e}}.bind(this)}},e}();t.XMLStringLexer=i},function(e,t,r){"use strict";var n=r(39);e.exports=new n({include:[r(182)]})},function(e,t,r){"use strict";var n=r(39);e.exports=new n({include:[r(113)],implicit:[r(289),r(290),r(291),r(292)]})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(91),o=r(1),i=r(3),a=r(77),s=r(109);function l(e,t){var r=c(void 0===e||u(e)?e:n.DefaultBuilderOptions),o=u(e)?t:e,i=s.createDocument();d(i,r);var l=new a.XMLBuilderImpl(i);return void 0!==o&&l.ele(o),l}function u(e){if(!o.isPlainObject(e))return!1;for(var t in e)if(e.hasOwnProperty(t)&&!n.XMLBuilderOptionKeys.has(t))return!1;return!0}function c(e){void 0===e&&(e={});var t=o.applyDefaults(e,n.DefaultBuilderOptions);if(0===t.convert.att.length||0===t.convert.ins.length||0===t.convert.text.length||0===t.convert.cdata.length||0===t.convert.comment.length)throw new Error("JS object converter strings cannot be zero length.");return t}function d(e,t,r){var n=e;n._xmlBuilderOptions=t,n._isFragment=r}t.builder=function(e,t){var r=c(u(e)?e:n.DefaultBuilderOptions),s=i.Guard.isNode(e)||o.isArray(e)?e:t;if(void 0===s)throw new Error("Invalid arguments.");if(o.isArray(s)){for(var l=[],d=0;d0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=r(91),a=r(1),s=r(217),l=r(2),u=r(3),c=r(0),d=r(109),p=r(7),f=r(276),h=function(){function e(e){this._domNode=e}return Object.defineProperty(e.prototype,"node",{get:function(){return this._domNode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"options",{get:function(){return this._options},enumerable:!0,configurable:!0}),e.prototype.set=function(e){return this._options=a.applyDefaults(a.applyDefaults(this._options,e,!0),i.DefaultBuilderOptions),this},e.prototype.ele=function(t,r,o){var i,s,l,u,p,h;if(a.isObject(t))return new f.ObjectReader(this._options).parse(this,t);if(null!==t&&/^\s*0&&(void 0===e&&(e=t.slice(n+1)),t=t.slice(0,n)),void 0===e)e=r?this._options.defaultNamespace.ele:this._options.defaultNamespace.att;else if(null!==e&&"@"===e[0]){var o=e.slice(1);if(void 0===(e=this._options.namespaceAlias[o]))throw new Error("Namespace alias `"+o+"` is not defined. "+this._debugInfo())}return[e,t]},e.prototype._updateNamespace=function(t){var r,i,a,s,l=this._domNode;if(u.Guard.isElementNode(l)&&null!==t&&l.namespaceURI!==t){var d=n(c.namespace_extractQName(l.prefix?l.prefix+":"+l.localName:l.localName),2),p=d[0],f=d[1],h=c.create_element(this._doc,f,t,p);try{for(var m=o(l.attributes),g=m.next();!g.done;g=m.next()){var y=g.value,v=y.prefix?y.prefix+":"+y.localName:y.localName,b=n(c.namespace_extractQName(v),1)[0],x=y.namespaceURI;null===x&&null!==b&&(x=l.lookupNamespaceURI(b)),null===x?h.setAttribute(v,y.value):h.setAttributeNS(x,v,y.value)}}catch(e){r={error:e}}finally{try{g&&!g.done&&(i=m.return)&&i.call(m)}finally{if(r)throw r.error}}var _=l.parentNode;if(null===_)throw new Error("Parent node is null."+this._debugInfo());_.replaceChild(h,l),this._domNode=h;try{for(var S=o(l.childNodes),C=S.next();!C.done;C=S.next()){var T=C.value.cloneNode(!0);if(h.appendChild(T),u.Guard.isElementNode(T)){var w=n(c.namespace_extractQName(T.prefix?T.prefix+":"+T.localName:T.localName),1)[0],A=h.lookupNamespaceURI(w);new e(T)._updateNamespace(A)}}}catch(e){a={error:e}}finally{try{C&&!C.done&&(s=S.return)&&s.call(S)}finally{if(a)throw a.error}}}},Object.defineProperty(e.prototype,"_doc",{get:function(){var e=this.node;if(u.Guard.isDocumentNode(e))return e;var t=e.ownerDocument;if(!t)throw new Error("Owner document is null. "+this._debugInfo());return t},enumerable:!0,configurable:!0}),e.prototype._debugInfo=function(e){var t=this.node,r=t.parentNode;e=e||t.nodeName;var n=r?r.nodeName:"";return n?"node: <"+e+">, parent: <"+n+">":"node: <"+e+">"},Object.defineProperty(e.prototype,"_options",{get:function(){var e=this._doc;if(void 0===e._xmlBuilderOptions)throw new Error("Builder options is not set.");return e._xmlBuilderOptions},set:function(e){this._doc._xmlBuilderOptions=e},enumerable:!0,configurable:!0}),e}();t.XMLBuilderImpl=h},function(e,t,r){var n=r(11),o=r(117),i=n.WeakMap;e.exports="function"==typeof i&&/native code/.test(o(i))},function(e,t,r){var n=r(46),o=r(82),i=r(85),a=r(18);e.exports=n("Reflect","ownKeys")||function(e){var t=o.f(a(e)),r=i.f;return r?t.concat(r(e)):t}},function(e,t,r){var n=r(16),o=r(15),i=r(18),a=r(61);e.exports=n?Object.defineProperties:function(e,t){i(e);for(var r,n=a(t),s=n.length,l=0;s>l;)o.f(e,r=n[l++],t[r]);return e}},function(e,t,r){var n=r(46);e.exports=n("document","documentElement")},function(e,t,r){var n=r(24),o=r(82).f,i={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return a&&"[object Window]"==i.call(e)?function(e){try{return o(e)}catch(e){return a.slice()}}(e):o(n(e))}},function(e,t,r){"use strict";var n=r(4),o=r(36).every,i=r(48),a=r(28),s=i("every"),l=a("every");n({target:"Array",proto:!0,forced:!s||!l},{every:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,r){"use strict";var n=r(4),o=r(36).filter,i=r(63),a=r(28),s=i("filter"),l=a("filter");n({target:"Array",proto:!0,forced:!s||!l},{filter:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,r){var n=r(46);e.exports=n("navigator","userAgent")||""},function(e,t,r){"use strict";var n=r(4),o=r(36).find,i=r(130),a=r(28),s=!0,l=a("find");"find"in[]&&Array(1).find(function(){s=!1}),n({target:"Array",proto:!0,forced:s||!l},{find:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}}),i("find")},function(e,t,r){"use strict";var n=r(131).IteratorPrototype,o=r(60),i=r(40),a=r(62),s=r(49),l=function(){return this};e.exports=function(e,t,r){var u=t+" Iterator";return e.prototype=o(n,{next:i(1,r)}),a(e,u,!1,!0),s[u]=l,e}},function(e,t,r){var n=r(8);e.exports=!n(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})},function(e,t,r){var n=r(13);e.exports=function(e){if(!n(e)&&null!==e)throw TypeError("Can't set "+String(e)+" as a prototype");return e}},function(e,t,r){"use strict";var n=r(4),o=r(36).map,i=r(63),a=r(28),s=i("map"),l=a("map");n({target:"Array",proto:!0,forced:!s||!l},{map:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,r){"use strict";var n=r(4),o=r(200).left,i=r(48),a=r(28),s=i("reduce"),l=a("reduce",{1:0});n({target:"Array",proto:!0,forced:!s||!l},{reduce:function(e){return o(this,e,arguments.length,arguments.length>1?arguments[1]:void 0)}})},function(e,t,r){var n=r(127),o=r(27),i=r(41),a=r(26),s=function(e){return function(t,r,s,l){n(r);var u=o(t),c=i(u),d=a(u.length),p=e?d-1:0,f=e?-1:1;if(s<2)for(;;){if(p in c){l=c[p],p+=f;break}if(p+=f,e?p<0:d<=p)throw TypeError("Reduce of empty array with no initial value")}for(;e?p>=0:d>p;p+=f)p in c&&(l=r(l,c[p],p,u));return l}};e.exports={left:s(!1),right:s(!0)}},function(e,t,r){"use strict";var n=r(4),o=r(36).some,i=r(48),a=r(28),s=i("some"),l=a("some");n({target:"Array",proto:!0,forced:!s||!l},{some:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,r){"use strict";var n=r(90),o=r(135);e.exports=n?{}.toString:function(){return"[object "+o(this)+"]"}},function(e,t){e.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},function(e,t,r){var n=r(8);e.exports=!n(function(){return Object.isExtensible(Object.preventExtensions({}))})},function(e,t,r){var n=r(5),o=r(49),i=n("iterator"),a=Array.prototype;e.exports=function(e){return void 0!==e&&(o.Array===e||a[i]===e)}},function(e,t,r){var n=r(135),o=r(49),i=r(5)("iterator");e.exports=function(e){if(null!=e)return e[i]||e["@@iterator"]||o[n(e)]}},function(e,t,r){var n=r(18);e.exports=function(e,t,r,o){try{return o?t(n(r)[0],r[1]):t(r)}catch(t){var i=e.return;throw void 0!==i&&n(i.call(e)),t}}},function(e,t,r){var n=r(5)("iterator"),o=!1;try{var i=0,a={next:function(){return{done:!!i++}},return:function(){o=!0}};a[n]=function(){return this},Array.from(a,function(){throw 2})}catch(e){}e.exports=function(e,t){if(!t&&!o)return!1;var r=!1;try{var i={};i[n]=function(){return{next:function(){return{done:r=!0}}}},e(i)}catch(e){}return r}},function(e,t,r){var n=r(13),o=r(133);e.exports=function(e,t,r){var i,a;return o&&"function"==typeof(i=t.constructor)&&i!==r&&n(a=i.prototype)&&a!==r.prototype&&o(e,a),e}},function(e,t,r){var n=r(25);e.exports=function(e,t,r){for(var o in t)n(e,o,t[o],r);return e}},function(e,t,r){"use strict";var n=r(46),o=r(15),i=r(5),a=r(16),s=i("species");e.exports=function(e){var t=n(e),r=o.f;a&&t&&!t[s]&&r(t,s,{configurable:!0,get:function(){return this}})}},function(e,t,r){"use strict";var n=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e){void 0===e&&(e=1e3),this._items=new Set,this._limit=e}return e.prototype.add=function(e){if(this._items.add(e),this._items.size>this._limit){var t=this._items.values().next();t.done||this._items.delete(t.value)}return this},e.prototype.delete=function(e){return this._items.delete(e)},e.prototype.has=function(e){return this._items.has(e)},e.prototype.clear=function(){this._items.clear()},Object.defineProperty(e.prototype,"size",{get:function(){return this._items.size},enumerable:!0,configurable:!0}),e.prototype.forEach=function(e,t){var r=this;this._items.forEach(function(n){return e.call(t,n,n,r)})},e.prototype.keys=function(){return n(this,function(e){switch(e.label){case 0:return[5,o(this._items.keys())];case 1:return e.sent(),[2]}})},e.prototype.values=function(){return n(this,function(e){switch(e.label){case 0:return[5,o(this._items.values())];case 1:return e.sent(),[2]}})},e.prototype.entries=function(){return n(this,function(e){switch(e.label){case 0:return[5,o(this._items.entries())];case 1:return e.sent(),[2]}})},e.prototype[Symbol.iterator]=function(){return n(this,function(e){switch(e.label){case 0:return[5,o(this._items)];case 1:return e.sent(),[2]}})},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"FixedSizeSet"},enumerable:!0,configurable:!0}),e}();t.FixedSizeSet=i},function(e,t,r){"use strict";var n=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e){void 0===e&&(e=1e3),this._items=new Map,this._limit=e}return e.prototype.get=function(e){return this._items.get(e)},e.prototype.set=function(e,t){if(this._items.set(e,t),this._items.size>this._limit){var r=this._items.keys().next();r.done||this._items.delete(r.value)}},e.prototype.delete=function(e){return this._items.delete(e)},e.prototype.has=function(e){return this._items.has(e)},e.prototype.clear=function(){this._items.clear()},Object.defineProperty(e.prototype,"size",{get:function(){return this._items.size},enumerable:!0,configurable:!0}),e.prototype.forEach=function(e,t){this._items.forEach(function(r,n){return e.call(t,n,r)})},e.prototype.keys=function(){return n(this,function(e){switch(e.label){case 0:return[5,o(this._items.keys())];case 1:return e.sent(),[2]}})},e.prototype.values=function(){return n(this,function(e){switch(e.label){case 0:return[5,o(this._items.values())];case 1:return e.sent(),[2]}})},e.prototype.entries=function(){return n(this,function(e){switch(e.label){case 0:return[5,o(this._items.entries())];case 1:return e.sent(),[2]}})},e.prototype[Symbol.iterator]=function(){return n(this,function(e){switch(e.label){case 0:return[5,o(this._items)];case 1:return e.sent(),[2]}})},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"ObjectCache"},enumerable:!0,configurable:!0}),e}();t.ObjectCache=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e){void 0===e&&(e=1e3),this._items=new Map,this._limit=e}return e.prototype.check=function(e,t){if(this._items.get(e)===t)return!0;if(this._items.get(t)===e)return!1;var r=Math.random()<.5;if(r?this._items.set(e,t):this._items.set(t,e),this._items.size>this._limit){var n=this._items.keys().next();n.done||this._items.delete(n.value)}return r},e}();t.CompareCache=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e){this._initialized=!1,this._value=void 0,this._initFunc=e}return Object.defineProperty(e.prototype,"value",{get:function(){return this._initialized||(this._value=this._initFunc(),this._initialized=!0),this._value},enumerable:!0,configurable:!0}),e}();t.Lazy=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e){this._pointer=0,this._chars=Array.from(e),this._length=this._chars.length}return Object.defineProperty(e.prototype,"eof",{get:function(){return this._pointer>=this._length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this._length},enumerable:!0,configurable:!0}),e.prototype.codePoint=function(){if(void 0===this._codePoint)if(this.eof)this._codePoint=-1;else{var e=this._chars[this._pointer].codePointAt(0);this._codePoint=void 0!==e?e:-1}return this._codePoint},e.prototype.c=function(){return void 0===this._c&&(this._c=this.eof?"":this._chars[this._pointer]),this._c},e.prototype.remaining=function(){return void 0===this._remaining&&(this._remaining=this.eof?"":this._chars.slice(this._pointer+1).join("")),this._remaining},e.prototype.substring=function(){return void 0===this._substring&&(this._substring=this.eof?"":this._chars.slice(this._pointer).join("")),this._substring},Object.defineProperty(e.prototype,"pointer",{get:function(){return this._pointer},set:function(e){e!==this._pointer&&(this._pointer=e,this._codePoint=void 0,this._c=void 0,this._remaining=void 0,this._substring=void 0)},enumerable:!0,configurable:!0}),e}();t.StringWalker=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(218);t.MapWriter=n.MapWriter;var o=r(258);t.XMLWriter=o.XMLWriter;var i=r(67);t.ObjectWriter=i.ObjectWriter;var a=r(260);t.JSONWriter=a.JSONWriter;var s=r(261);t.YAMLWriter=s.YAMLWriter},function(e,t,r){"use strict";r(19),r(219),r(20),r(22),r(23);var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var i=r(1),a=r(67),s=function(e){function t(t,r){var n=e.call(this,t)||this;return n._writerOptions=i.applyDefaults(r,{format:"map",wellFormed:!1,group:!1,verbose:!1}),n}return o(t,e),t.prototype.serialize=function(e){var t=i.applyDefaults(this._writerOptions,{format:"object",wellFormed:!1,verbose:!1}),r=new a.ObjectWriter(this._builderOptions,t).serialize(e);return this._convertObject(r)},t.prototype._convertObject=function(e){if(i.isArray(e)){for(var t=0;t=51||!o(function(){var e=[];return e[h]=!1,e.concat()[0]!==e}),g=d("concat"),y=function(e){if(!a(e))return!1;var t=e[h];return void 0!==t?!!t:i(e)};n({target:"Array",proto:!0,forced:!m||!g},{concat:function(e){var t,r,n,o,i,a=s(this),d=c(a,0),p=0;for(t=-1,n=arguments.length;t9007199254740991)throw TypeError("Maximum allowed index exceeded");for(r=0;r=9007199254740991)throw TypeError("Maximum allowed index exceeded");u(d,p++,i)}return d.length=p,d}})},function(e,t,r){"use strict";var n=r(8);function o(e,t){return RegExp(e,t)}t.UNSUPPORTED_Y=n(function(){var e=o("a","y");return e.lastIndex=2,null!=e.exec("abcd")}),t.BROKEN_CARET=n(function(){var e=o("^r","gy");return e.lastIndex=2,null!=e.exec("str")})},function(e,t,r){var n=r(223);e.exports=function(e){if(n(e))throw TypeError("The method doesn't accept regular expressions");return e}},function(e,t,r){var n=r(13),o=r(42),i=r(5)("match");e.exports=function(e){var t;return n(e)&&(void 0!==(t=e[i])?!!t:"RegExp"==o(e))}},function(e,t,r){var n=r(5)("match");e.exports=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[n]=!1,"/./"[e](t)}catch(e){}}return!1}},function(e,t,r){"use strict";r(68);var n=r(25),o=r(8),i=r(5),a=r(93),s=r(21),l=i("species"),u=!o(function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$")}),c="$0"==="a".replace(/./,"$0"),d=i("replace"),p=!!/./[d]&&""===/./[d]("a","$0"),f=!o(function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var r="ab".split(e);return 2!==r.length||"a"!==r[0]||"b"!==r[1]});e.exports=function(e,t,r,d){var h=i(e),m=!o(function(){var t={};return t[h]=function(){return 7},7!=""[e](t)}),g=m&&!o(function(){var t=!1,r=/a/;return"split"===e&&((r={}).constructor={},r.constructor[l]=function(){return r},r.flags="",r[h]=/./[h]),r.exec=function(){return t=!0,null},r[h](""),!t});if(!m||!g||"replace"===e&&(!u||!c||p)||"split"===e&&!f){var y=/./[h],v=r(h,""[e],function(e,t,r,n,o){return t.exec===a?m&&!o?{done:!0,value:y.call(t,r,n)}:{done:!0,value:e.call(r,t,n)}:{done:!1}},{REPLACE_KEEPS_$0:c,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:p}),b=v[0],x=v[1];n(String.prototype,e,b),n(RegExp.prototype,h,2==t?function(e,t){return x.call(e,this,t)}:function(e){return x.call(e,this)})}d&&s(RegExp.prototype[h],"sham",!0)}},function(e,t,r){"use strict";var n=r(137).charAt;e.exports=function(e,t,r){return t+(r?n(e,t).length:1)}},function(e,t,r){var n=r(42),o=r(93);e.exports=function(e,t){var r=e.exec;if("function"==typeof r){var i=r.call(e,t);if("object"!=typeof i)throw TypeError("RegExp exec method returned something other than an Object or null");return i}if("RegExp"!==n(e))throw TypeError("RegExp#exec called on incompatible receiver");return o.call(e,t)}},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var n=r(96);t.forgivingBase64Encode=function(t){return e.from(t).toString("base64")},t.forgivingBase64Decode=function(t){return""===t?"":((t=t.replace(n.ASCIIWhiteSpace,"")).length%4==0&&(t.endsWith("==")?t=t.substr(0,t.length-2):t.endsWith("=")&&(t=t.substr(0,t.length-1))),t.length%4==1?null:/[0-9A-Za-z+/]/.test(t)?e.from(t,"base64").toString("utf8"):null)}}).call(this,r(145).Buffer)},function(e,t,r){"use strict";t.byteLength=function(e){var t=l(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,n=l(e),a=n[0],s=n[1],u=new i(function(e,t,r){return 3*(t+r)/4-r}(0,a,s)),c=0,d=s>0?a-4:a;for(r=0;r>16&255,u[c++]=t>>8&255,u[c++]=255&t;return 2===s&&(t=o[e.charCodeAt(r)]<<2|o[e.charCodeAt(r+1)]>>4,u[c++]=255&t),1===s&&(t=o[e.charCodeAt(r)]<<10|o[e.charCodeAt(r+1)]<<4|o[e.charCodeAt(r+2)]>>2,u[c++]=t>>8&255,u[c++]=255&t),u},t.fromByteArray=function(e){for(var t,r=e.length,o=r%3,i=[],a=0,s=r-o;as?s:a+16383));return 1===o?(t=e[r-1],i.push(n[t>>2]+n[t<<4&63]+"==")):2===o&&(t=(e[r-2]<<8)+e[r-1],i.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"=")),i.join("")};for(var n=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)n[s]=a[s],o[a.charCodeAt(s)]=s;function l(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function u(e,t,r){for(var o,i,a=[],s=t;s>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return a.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,r,n,o){var i,a,s=8*o-n-1,l=(1<>1,c=-7,d=r?o-1:0,p=r?-1:1,f=e[t+d];for(d+=p,i=f&(1<<-c)-1,f>>=-c,c+=s;c>0;i=256*i+e[t+d],d+=p,c-=8);for(a=i&(1<<-c)-1,i>>=-c,c+=n;c>0;a=256*a+e[t+d],d+=p,c-=8);if(0===i)i=1-u;else{if(i===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,n),i-=u}return(f?-1:1)*a*Math.pow(2,i-n)},t.write=function(e,t,r,n,o,i){var a,s,l,u=8*i-o-1,c=(1<>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:i-1,h=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),(t+=a+d>=1?p/l:p*Math.pow(2,1-d))*l>=2&&(a++,l/=2),a+d>=c?(s=0,a=c):a+d>=1?(s=(t*l-1)*Math.pow(2,o),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;e[r+f]=255&s,f+=h,s/=256,o-=8);for(a=a<0;e[r+f]=255&a,f+=h,a/=256,u-=8);e[r+f-h]|=128*m}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=r(1);function i(e){var t,r;if(null===e||o.isString(e)||o.isNumber(e))return e;if(o.isArray(e)){var a=new Array;try{for(var s=n(e),l=s.next();!l.done;l=s.next()){var u=l.value;a.push(i(u))}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return a}if(o.isObject(e)){for(var c in a=new Map,e)if(e.hasOwnProperty(c)){var d=e[c];a.set(c,i(d))}return a}return e}t.parseJSONFromBytes=function(e){var t=o.utf8Decode(e);return JSON.parse.call(void 0,t)},t.serializeJSONToBytes=function(e){var t=JSON.stringify.call(void 0,e);return o.utf8Encode(t)},t.parseJSONIntoInfraValues=function(e){return i(JSON.parse.call(void 0,e))},t.convertAJSONDerivedJavaScriptValueToAnInfraValue=i},function(e,t,r){"use strict";var n=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var s=r(1);t.append=function(e,t){e.push(t)},t.extend=function(e,t){e.push.apply(e,i(t))},t.prepend=function(e,t){e.unshift(t)},t.replace=function(e,t,r){var n,o,i=0;try{for(var l=a(e),u=l.next();!u.done;u=l.next()){var c=u.value;if(s.isFunction(t))t.call(null,c)&&(e[i]=r);else if(c===t)return void(e[i]=r);i++}}catch(e){n={error:e}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(n)throw n.error}}},t.insert=function(e,t,r){e.splice(r,0,t)},t.remove=function(e,t){for(var r=e.length;r--;){var n=e[r];if(s.isFunction(t))t.call(null,n)&&e.splice(r,1);else if(n===t)return void e.splice(r,1)}},t.empty=function(e){e.length=0},t.contains=function(e,t){var r,n;try{for(var o=a(e),i=o.next();!i.done;i=o.next()){var l=i.value;if(s.isFunction(t)){if(t.call(null,l))return!0}else if(l===t)return!0}}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return!1},t.size=function(e,t){var r,n;if(void 0===t)return e.length;var o=0;try{for(var i=a(e),s=i.next();!s.done;s=i.next()){var l=s.value;t.call(null,l)&&o++}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return o},t.isEmpty=function(e){return 0===e.length},t.forEach=function(e,t){var r,o,i,s,l,u;return n(this,function(n){switch(n.label){case 0:return void 0!==t?[3,2]:[5,a(e)];case 1:return n.sent(),[3,9];case 2:n.trys.push([2,7,8,9]),r=a(e),o=r.next(),n.label=3;case 3:return o.done?[3,6]:(i=o.value,t.call(null,i)?[4,i]:[3,5]);case 4:n.sent(),n.label=5;case 5:return o=r.next(),[3,3];case 6:return[3,9];case 7:return s=n.sent(),l={error:s},[3,9];case 8:try{o&&!o.done&&(u=r.return)&&u.call(r)}finally{if(l)throw l.error}return[7];case 9:return[2]}})},t.clone=function(e){return new(Array.bind.apply(Array,i([void 0],e)))},t.sortInAscendingOrder=function(e,t){return e.sort(function(e,r){return t.call(null,e,r)?-1:1})},t.sortInDescendingOrder=function(e,t){return e.sort(function(e,r){return t.call(null,e,r)?1:-1})}},function(e,t,r){"use strict";var n=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__spread||function(){for(var e=[],t=0;t0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__spread||function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=r(96),i=r(147),a=r(146),s=r(1);function l(e,t){for(var r=0;;){var n=r=65&&l<=90?String.fromCodePoint(l+32):s}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return o}function p(e){return e.replace(/^[\t\n\f\r ]+/,"").replace(/[\t\n\f\r ]+$/,"")}function f(e,t,r){if(!s.isArray(t))return f(e,Array.from(t),r);for(var n="";r.position=97&&l<=122?String.fromCodePoint(l-32):s}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return o},t.asciiCaseInsensitiveMatch=function(e,t){return d(e)===d(t)},t.asciiEncode=function(e){return console.assert(c(e),"asciiEncode requires an ASCII string."),u(e)},t.asciiDecode=function(e){var t,r;try{for(var o=n(e),s=o.next();!s.done;s=o.next()){var l=s.value;console.assert(a.isASCIIByte(l),"asciiDecode requires an ASCII byte sequence.")}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return i.isomorphicDecode(e)},t.stripNewlines=function(e){return e.replace(/[\n\r]/g,"")},t.normalizeNewlines=function(e){return e.replace(/\r\n/g,"\n").replace(/\r/g,"\n")},t.stripLeadingAndTrailingASCIIWhitespace=p,t.stripAndCollapseASCIIWhitespace=function(e){return p(e.replace(/[\t\n\f\r ]{2,}/g," "))},t.collectASequenceOfCodePoints=f,t.skipASCIIWhitespace=h,t.strictlySplit=function e(t,r){if(!s.isArray(t))return e(Array.from(t),r);var n={position:0},o=[],i=f(function(e){return r!==e},t,n);for(o.push(i);n.position=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=r(97);t.abort_add=function(e,t){t._abortedFlag||t._abortAlgorithms.add(e)},t.abort_remove=function(e,t){t._abortAlgorithms.delete(e)},t.abort_signalAbort=function(e){var t,r;if(!e._abortedFlag){e._abortedFlag=!0;try{for(var i=n(e._abortAlgorithms),a=i.next();!a.done;a=i.next())a.value.call(e)}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}e._abortAlgorithms.clear(),o.event_fireAnEvent("abort",e)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(150),o=function(){function e(){}return e.asNode=function(e){if(n.Guard.isNode(e))return e;throw new Error("Invalid object. Node expected.")},e}();t.Cast=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){}return Object.defineProperty(e.prototype,"size",{get:function(){return 0},enumerable:!0,configurable:!0}),e.prototype.add=function(e){throw new Error("Cannot add to an empty set.")},e.prototype.clear=function(){},e.prototype.delete=function(e){return!1},e.prototype.forEach=function(e,t){},e.prototype.has=function(e){return!1},e.prototype[Symbol.iterator]=function(){return new o},e.prototype.entries=function(){return new o},e.prototype.keys=function(){return new o},e.prototype.values=function(){return new o},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"EmptySet"},enumerable:!0,configurable:!0}),e}();t.EmptySet=n;var o=function(){function e(){}return e.prototype[Symbol.iterator]=function(){return this},e.prototype.next=function(){return{done:!0,value:null}},e}()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.SchemeStart=0]="SchemeStart",e[e.Scheme=1]="Scheme",e[e.NoScheme=2]="NoScheme",e[e.SpecialRelativeOrAuthority=3]="SpecialRelativeOrAuthority",e[e.PathOrAuthority=4]="PathOrAuthority",e[e.Relative=5]="Relative",e[e.RelativeSlash=6]="RelativeSlash",e[e.SpecialAuthoritySlashes=7]="SpecialAuthoritySlashes",e[e.SpecialAuthorityIgnoreSlashes=8]="SpecialAuthorityIgnoreSlashes",e[e.Authority=9]="Authority",e[e.Host=10]="Host",e[e.Hostname=11]="Hostname",e[e.Port=12]="Port",e[e.File=13]="File",e[e.FileSlash=14]="FileSlash",e[e.FileHost=15]="FileHost",e[e.PathStart=16]="PathStart",e[e.Path=17]="Path",e[e.CannotBeABaseURLPath=18]="CannotBeABaseURLPath",e[e.Query=19]="Query",e[e.Fragment=20]="Fragment"}(t.ParserState||(t.ParserState={})),t.OpaqueOrigin=["","",null,null]},function(e,t,r){"use strict";var n=r(245),o=r(247);function i(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=b,t.resolve=function(e,t){return b(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?b(e,!1,!0).resolveObject(t):t},t.format=function(e){return o.isString(e)&&(e=b(e)),e instanceof i?e.format():i.prototype.format.call(e)},t.Url=i;var a=/^([a-z0-9.+-]+:)/i,s=/:[0-9]*$/,l=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,u=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),c=["'"].concat(u),d=["%","/","?",";","#"].concat(c),p=["/","?","#"],f=/^[+a-z0-9A-Z_-]{0,63}$/,h=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},g={javascript:!0,"javascript:":!0},y={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},v=r(248);function b(e,t,r){if(e&&o.isObject(e)&&e instanceof i)return e;var n=new i;return n.parse(e,t,r),n}i.prototype.parse=function(e,t,r){if(!o.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var i=e.indexOf("?"),s=-1!==i&&i127?M+="x":M+=N[R];if(!M.match(f)){var B=I.slice(0,E),L=I.slice(E+1),k=N.match(h);k&&(B.push(k[1]),L.unshift(k[2])),L.length&&(b="/"+L.join(".")+b),this.hostname=B.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),P||(this.hostname=n.toASCII(this.hostname));var U=this.port?":"+this.port:"",V=this.hostname||"";this.host=V+U,this.href+=this.host,P&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!m[S])for(E=0,O=c.length;E0)&&r.host.split("@"))&&(r.auth=P.shift(),r.host=r.hostname=P.shift())),r.search=e.search,r.query=e.query,o.isNull(r.pathname)&&o.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r;if(!C.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var w=C.slice(-1)[0],A=(r.host||e.host||C.length>1)&&("."===w||".."===w)||""===w,E=0,D=C.length;D>=0;D--)"."===(w=C[D])?C.splice(D,1):".."===w?(C.splice(D,1),E++):E&&(C.splice(D,1),E--);if(!_&&!S)for(;E--;E)C.unshift("..");!_||""===C[0]||C[0]&&"/"===C[0].charAt(0)||C.unshift(""),A&&"/"!==C.join("/").substr(-1)&&C.push("");var P,I=""===C[0]||C[0]&&"/"===C[0].charAt(0);return T&&(r.hostname=r.host=I?"":C.length?C.shift():"",(P=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=P.shift(),r.host=r.hostname=P.shift())),(_=_||r.host&&C.length)&&!I&&C.unshift(""),C.length?r.pathname=C.join("/"):(r.pathname=null,r.path=null),o.isNull(r.pathname)&&o.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},i.prototype.parseHost=function(){var e=this.host,t=s.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,r){(function(e,n){var o;!function(){t&&t.nodeType,e&&e.nodeType;var i="object"==typeof n&&n;i.global!==i&&i.window!==i&&i.self;var a,s=2147483647,l=/^xn--/,u=/[^\x20-\x7E]/,c=/[\x2E\u3002\uFF0E\uFF61]/g,d={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},p=Math.floor,f=String.fromCharCode;function h(e){throw new RangeError(d[e])}function m(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function g(e,t){var r=e.split("@"),n="";return r.length>1&&(n=r[0]+"@",e=r[1]),n+m((e=e.replace(c,".")).split("."),t).join(".")}function y(e){for(var t,r,n=[],o=0,i=e.length;o=55296&&t<=56319&&o65535&&(t+=f((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+f(e)}).join("")}function b(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function x(e,t,r){var n=0;for(e=r?p(e/700):e>>1,e+=p(e/t);e>455;n+=36)e=p(e/35);return p(n+36*e/(e+38))}function _(e){var t,r,n,o,i,a,l,u,c,d,f,m=[],g=e.length,y=0,b=128,_=72;for((r=e.lastIndexOf("-"))<0&&(r=0),n=0;n=128&&h("not-basic"),m.push(e.charCodeAt(n));for(o=r>0?r+1:0;o=g&&h("invalid-input"),((u=(f=e.charCodeAt(o++))-48<10?f-22:f-65<26?f-65:f-97<26?f-97:36)>=36||u>p((s-y)/a))&&h("overflow"),y+=u*a,!(u<(c=l<=_?1:l>=_+26?26:l-_));l+=36)a>p(s/(d=36-c))&&h("overflow"),a*=d;_=x(y-i,t=m.length+1,0==i),p(y/t)>s-b&&h("overflow"),b+=p(y/t),y%=t,m.splice(y++,0,b)}return v(m)}function S(e){var t,r,n,o,i,a,l,u,c,d,m,g,v,_,S,C=[];for(g=(e=y(e)).length,t=128,r=0,i=72,a=0;a=t&&mp((s-r)/(v=n+1))&&h("overflow"),r+=(l-t)*v,t=l,a=0;as&&h("overflow"),m==t){for(u=r,c=36;!(u<(d=c<=i?1:c>=i+26?26:c-i));c+=36)S=u-d,_=36-d,C.push(f(b(d+S%_,0))),u=p(S/_);C.push(f(b(u,0))),i=x(r,v,n==o),r=0,++n}++r,++t}return C.join("")}a={version:"1.4.1",ucs2:{decode:y,encode:v},decode:_,encode:S,toASCII:function(e){return g(e,function(e){return u.test(e)?"xn--"+S(e):e})},toUnicode:function(e){return g(e,function(e){return l.test(e)?_(e.slice(4).toLowerCase()):e})}},void 0===(o=function(){return a}.call(t,r,t,e))||(e.exports=o)}()}).call(this,r(246)(e),r(78))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,r){"use strict";t.decode=t.parse=r(249),t.encode=t.stringify=r(250)},function(e,t,r){"use strict";function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,r,i){t=t||"&",r=r||"=";var a={};if("string"!=typeof e||0===e.length)return a;var s=/\+/g;e=e.split(t);var l=1e3;i&&"number"==typeof i.maxKeys&&(l=i.maxKeys);var u=e.length;l>0&&u>l&&(u=l);for(var c=0;c=0?(d=m.substr(0,g),p=m.substr(g+1)):(d=m,p=""),f=decodeURIComponent(d),h=decodeURIComponent(p),n(a,f)?o(a[f])?a[f].push(h):a[f]=[a[f],h]:a[f]=h}return a};var o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,r){"use strict";var n=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,r,s){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?i(a(e),function(a){var s=encodeURIComponent(n(a))+r;return o(e[a])?i(e[a],function(e){return s+encodeURIComponent(n(e))}).join(t):s+encodeURIComponent(n(e[a]))}).join(t):s?encodeURIComponent(n(s))+r+encodeURIComponent(n(e)):""};var o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function i(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=r(1);function i(e){return o.isBoolean(e)?e:e.capture||!1}t.eventTarget_flatten=i,t.eventTarget_flattenMore=function(e){var t=i(e),r=!1,n=!1;return o.isBoolean(e)||(r=e.once||!1,n=e.passive||!1),[t,n,r]},t.eventTarget_addEventListener=function(e,t){if(null!==t.callback){for(var r=0;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=r(1),i=r(29);t.parentNode_convertNodesIntoANode=function(e,t){for(var r,a,s=null,l=0;l=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spread||function(){for(var e=[],t=0;t0;O--){var N;if(b(N=I[O],e)){P=N;break}}var M,R,F=[];try{for(var B=n(w._children),L=B.next();!L.done;L=B.next())if(v(j=L.value,e)){if(l.Guard.isDocumentTypeNode(j))throw new s.HierarchyRequestError;F.push(j)}}catch(e){o={error:e}}finally{try{L&&!L.done&&(a=B.return)&&a.call(B)}finally{if(o)throw o.error}}if(c.tree_isAncestorOf(C,_,!0))M=_,R=S;else{for(var k=_;null!==k._parent&&!c.tree_isAncestorOf(C,k._parent);)k=k._parent;if(null===k._parent)throw new Error("Parent node is null.");M=k._parent,R=1+c.tree_index(k)}if(l.Guard.isCharacterDataNode(A))(U=f.node_clone(_))._data=p.characterData_substringData(_,S,c.tree_nodeLength(_)-S),h.mutation_append(U,y),p.characterData_replaceData(_,S,c.tree_nodeLength(_)-S,"");else if(null!==A){var U=f.node_clone(A);h.mutation_append(U,y);var V=x(u.create_range([_,S],[A,c.tree_nodeLength(A)]));h.mutation_append(V,U)}try{for(var G=n(F),z=G.next();!z.done;z=G.next()){var j=z.value;h.mutation_append(j,y)}}catch(e){d={error:e}}finally{try{z&&!z.done&&(m=G.return)&&m.call(G)}finally{if(d)throw d.error}}return l.Guard.isCharacterDataNode(P)?((U=f.node_clone(C))._data=p.characterData_substringData(C,0,T),h.mutation_append(U,y),p.characterData_replaceData(C,0,T,"")):null!==P&&(U=f.node_clone(P),h.mutation_append(U,y),V=x(u.create_range([P,0],[C,T])),h.mutation_append(V,U)),e._start=[M,R],e._end=[M,R],y}t.range_collapsed=g,t.range_root=y,t.range_isContained=v,t.range_isPartiallyContained=b,t.range_setTheStart=function(e,t,r){if(l.Guard.isDocumentTypeNode(t))throw new s.InvalidNodeTypeError;if(r>c.tree_nodeLength(t))throw new s.IndexSizeError;var n=[t,r];y(e)===c.tree_rootNode(t)&&d.boundaryPoint_position(n,e._end)!==a.BoundaryPosition.After||(e._end=n),e._start=n},t.range_setTheEnd=function(e,t,r){if(l.Guard.isDocumentTypeNode(t))throw new s.InvalidNodeTypeError;if(r>c.tree_nodeLength(t))throw new s.IndexSizeError;var n=[t,r];y(e)===c.tree_rootNode(t)&&d.boundaryPoint_position(n,e._start)!==a.BoundaryPosition.Before||(e._start=n),e._end=n},t.range_select=function(e,t){var r=e._parent;if(null===r)throw new s.InvalidNodeTypeError;var n=c.tree_index(e);t._start=[r,n],t._end=[r,n+1]},t.range_extract=x,t.range_cloneTheContents=function e(t){var r,o,a,d,m,y,_=u.create_documentFragment(t._startNode._nodeDocument);if(g(t))return _;var S=t._startNode,C=t._startOffset,T=t._endNode,w=t._endOffset;S===T&&l.Guard.isCharacterDataNode(S)&&((L=f.node_clone(S))._data=p.characterData_substringData(S,C,w-C),h.mutation_append(L,_));for(var A=S;!c.tree_isAncestorOf(T,A,!0);){if(null===A._parent)throw new Error("Parent node is null.");A=A._parent}var E=null;if(!c.tree_isAncestorOf(T,S,!0))try{for(var D=n(A._children),P=D.next();!P.done;P=D.next())if(b(M=P.value,t)){E=M;break}}catch(e){r={error:e}}finally{try{P&&!P.done&&(o=D.return)&&o.call(D)}finally{if(r)throw r.error}}var I=null;if(!c.tree_isAncestorOf(S,T,!0))for(var O=i(A._children),N=O.length-1;N>0;N--){var M;if(b(M=O[N],t)){I=M;break}}var R=[];try{for(var F=n(A._children),B=F.next();!B.done;B=F.next())if(v(G=B.value,t)){if(l.Guard.isDocumentTypeNode(G))throw new s.HierarchyRequestError;R.push(G)}}catch(e){a={error:e}}finally{try{B&&!B.done&&(d=F.return)&&d.call(F)}finally{if(a)throw a.error}}if(l.Guard.isCharacterDataNode(E))(L=f.node_clone(S))._data=p.characterData_substringData(S,C,c.tree_nodeLength(S)-C),h.mutation_append(L,_);else if(null!==E){var L=f.node_clone(E);h.mutation_append(L,_);var k=e(u.create_range([S,C],[E,c.tree_nodeLength(E)]));h.mutation_append(k,L)}try{for(var U=n(R),V=U.next();!V.done;V=U.next()){var G=V.value;L=f.node_clone(G),h.mutation_append(L,_)}}catch(e){m={error:e}}finally{try{V&&!V.done&&(y=U.return)&&y.call(U)}finally{if(m)throw m.error}}return l.Guard.isCharacterDataNode(I)?((L=f.node_clone(T))._data=p.characterData_substringData(T,0,w),h.mutation_append(L,_)):null!==I&&(L=f.node_clone(I),_.append(L),k=x(u.create_range([I,0],[T,w])),h.mutation_append(k,L)),_},t.range_insert=function(e,t){var r,o;if(l.Guard.isProcessingInstructionNode(t._startNode)||l.Guard.isCommentNode(t._startNode)||l.Guard.isTextNode(t._startNode)&&null===t._startNode._parent||t._startNode===e)throw new s.HierarchyRequestError;var i,a=null;if(l.Guard.isTextNode(t._startNode))a=t._startNode;else{var u=0;try{for(var d=n(t._startNode._children),p=d.next();!p.done;p=d.next()){var f=p.value;if(u===t._startOffset){a=f;break}u++}}catch(e){r={error:e}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(r)throw r.error}}}if(null===a)i=t._startNode;else{if(null===a._parent)throw new Error("Parent node is null.");i=a._parent}h.mutation_ensurePreInsertionValidity(e,i,a),l.Guard.isTextNode(t._startNode)&&(a=m.text_split(t._startNode,t._startOffset)),e===a&&(a=e._nextSibling),null!==e._parent&&h.mutation_remove(e,e._parent);var y=null===a?c.tree_nodeLength(i):c.tree_index(a);l.Guard.isDocumentFragmentNode(e)?y+=c.tree_nodeLength(e):y++,h.mutation_preInsert(e,i,a),g(t)&&(t._end=[i,y])},t.range_getContainedNodes=function(e){var t;return(t={})[Symbol.iterator]=function(){var t=e.commonAncestorContainer,r=c.tree_getFirstDescendantNode(t);return{next:function(){for(;r&&!v(r,e);)r=c.tree_getNextDescendantNode(t,r);if(null===r)return{done:!0,value:null};var n={done:!1,value:r};return r=c.tree_getNextDescendantNode(t,r),n}}},t},t.range_getPartiallyContainedNodes=function(e){var t;return(t={})[Symbol.iterator]=function(){var t=e.commonAncestorContainer,r=c.tree_getFirstDescendantNode(t);return{next:function(){for(;r&&!b(r,e);)r=c.tree_getNextDescendantNode(t,r);if(null===r)return{done:!0,value:null};var n={done:!1,value:r};return r=c.tree_getNextDescendantNode(t,r),n}}},t}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(9);t.selectors_scopeMatchASelectorsString=function(e,t){throw new n.NotSupportedError}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(2),o=r(105);t.treeWalker_traverseChildren=function(e,t){for(var r=t?e._current._firstChild:e._current._lastChild;null!==r;){var i=o.traversal_filter(e,r);if(i===n.FilterResult.Accept)return e._current=r,r;if(i===n.FilterResult.Skip){var a=t?r._firstChild:r._lastChild;if(null!==a){r=a;continue}}for(;null!==r;){var s=t?r._nextSibling:r._previousSibling;if(null!==s){r=s;break}var l=r._parent;if(null===l||l===e._root||l===e._current)return null;r=l}}return null},t.treeWalker_traverseSiblings=function(e,t){var r=e._current;if(r===e._root)return null;for(;;){for(var i=t?r._nextSibling:r._previousSibling;null!==i;){r=i;var a=o.traversal_filter(e,r);if(a===n.FilterResult.Accept)return e._current=r,r;i=t?r._firstChild:r._lastChild,a!==n.FilterResult.Reject&&null!==i||(i=t?r._nextSibling:r._previousSibling)}if(null===(r=r._parent)||r===e._root)return null;if(o.traversal_filter(e,r)===n.FilterResult.Accept)return null}}},function(e,t,r){"use strict";r(89),r(74);var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var i=r(1),a=r(2),s=r(50),l=r(3),u=function(e){function t(t,r){var n=e.call(this,t)||this;return n._indentation={},n._lengthToLastNewline=0,n._writerOptions=i.applyDefaults(r,{wellFormed:!1,headless:!1,prettyPrint:!1,indent:" ",newline:"\n",offset:0,width:0,allowEmptyTags:!1,indentTextOnlyNodes:!1,spaceBeforeSlash:!1}),n}return o(t,e),t.prototype.serialize=function(e){return this._refs={suppressPretty:!1,emptyNode:!1,markup:""},e.nodeType!==a.NodeType.Document||this._writerOptions.headless||this.declaration(this._builderOptions.version,this._builderOptions.encoding,this._builderOptions.standalone),this.serializeNode(e,this._writerOptions.wellFormed),this._writerOptions.prettyPrint&&this._refs.markup.slice(-this._writerOptions.newline.length)===this._writerOptions.newline&&(this._refs.markup=this._refs.markup.slice(0,-this._writerOptions.newline.length)),this._refs.markup},t.prototype.declaration=function(e,t,r){this._beginLine(),this._refs.markup+='",this._endLine()},t.prototype.docType=function(e,t,r){this._beginLine(),this._refs.markup+=t&&r?"':t?"':r?"':"",this._endLine()},t.prototype.openTagBegin=function(e){this._beginLine(),this._refs.markup+="<"+e},t.prototype.openTagEnd=function(e,t,r){if(this._refs.suppressPretty=!1,this._refs.emptyNode=!1,this._writerOptions.prettyPrint&&!t&&!r){for(var n=!0,o=!0,i=this.currentNode.firstChild,a=0,s=0;i;){if(l.Guard.isExclusiveTextNode(i))s++;else{if(!l.Guard.isCDATASectionNode(i)){n=!1,o=!1;break}a++}""!==i.data&&(o=!1),i=i.nextSibling}this._refs.suppressPretty=!this._writerOptions.indentTextOnlyNodes&&n&&(a<=1&&0===s||0===a),this._refs.emptyNode=o}(r||t||this._refs.emptyNode)&&this._writerOptions.allowEmptyTags?this._refs.markup+=">":this._refs.markup+=r?" />":t||this._refs.emptyNode?this._writerOptions.spaceBeforeSlash?" />":"/>":">",this._endLine()},t.prototype.closeTag=function(e){this._refs.emptyNode||(this._beginLine(),this._refs.markup+=""),this._refs.suppressPretty=!1,this._refs.emptyNode=!1,this._endLine()},t.prototype.attribute=function(e,t){var r=e+'="'+t+'"';this._writerOptions.prettyPrint&&this._writerOptions.width>0&&this._refs.markup.length-this._lengthToLastNewline+1+r.length>this._writerOptions.width?(this._endLine(),this._beginLine(),this._refs.markup+=this._indent(1)+r):this._refs.markup+=" "+r},t.prototype.text=function(e){""!==e&&(this._beginLine(),this._refs.markup+=e,this._endLine())},t.prototype.cdata=function(e){""!==e&&(this._beginLine(),this._refs.markup+="",this._endLine())},t.prototype.comment=function(e){this._beginLine(),this._refs.markup+="\x3c!--"+e+"--\x3e",this._endLine()},t.prototype.instruction=function(e,t){this._beginLine(),this._refs.markup+="",this._endLine()},t.prototype._beginLine=function(){this._writerOptions.prettyPrint&&!this._refs.suppressPretty&&(this._refs.markup+=this._indent(this._writerOptions.offset+this.level))},t.prototype._endLine=function(){this._writerOptions.prettyPrint&&!this._refs.suppressPretty&&(this._refs.markup+=this._writerOptions.newline,this._lengthToLastNewline=this._refs.markup.length)},t.prototype._indent=function(e){if(e<=0)return"";if(void 0!==this._indentation[e])return this._indentation[e];var t=this._writerOptions.indent.repeat(e);return this._indentation[e]=t,t},t}(s.BaseWriter);t.XMLWriter=u},function(e,t,r){"use strict";var n=r(47),o=r(35);e.exports="".repeat||function(e){var t=String(o(this)),r="",i=n(e);if(i<0||i==1/0)throw RangeError("Wrong number of repetitions");for(;i>0;(i>>>=1)&&(t+=t))1&i&&(r+=t);return r}},function(e,t,r){"use strict";r(31),r(32),r(33),r(19),r(178),r(20),r(22),r(23);var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=r(67),s=r(1),l=function(e){function t(t,r){var n=e.call(this,t)||this;return n._writerOptions=s.applyDefaults(r,{wellFormed:!1,prettyPrint:!1,indent:" ",newline:"\n",offset:0,group:!1,verbose:!1}),n}return o(t,e),t.prototype.serialize=function(e){var t=s.applyDefaults(this._writerOptions,{format:"object",wellFormed:!1}),r=new a.ObjectWriter(this._builderOptions,t).serialize(e);return this._beginLine(this._writerOptions,0)+this._convertObject(r,this._writerOptions)},t.prototype._convertObject=function(e,t,r){var n,o,a=this;void 0===r&&(r=0);var l="",u=this._isLeafNode(e);if(s.isArray(e)){l+="[";var c=e.length,d=0;try{for(var p=i(e),f=p.next();!f.done;f=p.next()){var h=f.value;l+=this._endLine(t,r+1)+this._beginLine(t,r+1)+this._convertObject(h,t,r+1),d0?new Array(r).join(e.indent):""},t.prototype._endLine=function(e,t){return e.prettyPrint?e.newline:""},t.prototype._key=function(e){return'"'+e+'":'},t.prototype._val=function(e){return JSON.stringify(e)},t.prototype._isLeafNode=function(e){return this._descendantCount(e)<=1},t.prototype._descendantCount=function(e,t){var r=this;return void 0===t&&(t=0),s.isArray(e)?s.forEachArray(e,function(e){return t+=r._descendantCount(e,t)},this):s.isObject(e)?s.forEachObject(e,function(e,n){return t+=r._descendantCount(n,t)},this):t++,t},t}(r(50).BaseWriter);t.JSONWriter=l},function(e,t,r){"use strict";r(31),r(32),r(33),r(19),r(178),r(89),r(20),r(22),r(23);var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var a=r(67),s=r(1),l=function(e){function t(t,r){var n=e.call(this,t)||this;if(n._writerOptions=s.applyDefaults(r,{wellFormed:!1,indent:" ",newline:"\n",offset:0,group:!1,verbose:!1}),n._writerOptions.indent.length<2)throw new Error("YAML indententation string must be at least two characters long.");if(n._writerOptions.offset<0)throw new Error("YAML offset should be zero or a positive number.");return n}return o(t,e),t.prototype.serialize=function(e){var t=s.applyDefaults(this._writerOptions,{format:"object",wellFormed:!1}),r=new a.ObjectWriter(this._builderOptions,t).serialize(e),n=this._beginLine(this._writerOptions,0)+"---"+this._endLine(this._writerOptions)+this._convertObject(r,this._writerOptions,0);return n.slice(-this._writerOptions.newline.length)===this._writerOptions.newline&&(n=n.slice(0,-this._writerOptions.newline.length)),n},t.prototype._convertObject=function(e,t,r,n){var o,a,l=this;void 0===n&&(n=!1);var u="";if(s.isArray(e))try{for(var c=i(e),d=c.next();!d.done;d=c.next()){var p=d.value;u+=this._beginLine(t,r,!0),s.isObject(p)?s.isEmpty(p)?u+='""'+this._endLine(t):u+=this._convertObject(p,t,r,!0):u+=this._val(p)+this._endLine(t)}}catch(e){o={error:e}}finally{try{d&&!d.done&&(a=c.return)&&a.call(c)}finally{if(o)throw o.error}}else s.forEachObject(e,function(e,o){n?(u+=l._key(e),n=!1):u+=l._beginLine(t,r)+l._key(e),s.isObject(o)?s.isEmpty(o)?u+=' ""'+l._endLine(t):u+=l._endLine(t)+l._convertObject(o,t,r+1):u+=" "+l._val(o)+l._endLine(t)},this);return u},t.prototype._beginLine=function(e,t,r){void 0===r&&(r=!1);var n=e.offset+t+1,o=new Array(n).join(e.indent);return r?o.substr(0,o.length-2)+"-"+o.substr(-1,1):o},t.prototype._endLine=function(e){return e.newline},t.prototype._key=function(e){return'"'+e+'":'},t.prototype._val=function(e){return JSON.stringify(e)},t}(r(50).BaseWriter);t.YAMLWriter=l},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(110).dom.setFeatures(!0);var n=r(110);t.DOMImplementation=n.DOMImplementation;var o=r(271);t.DOMParser=o.DOMParser;var i=r(274);t.XMLSerializer=i.XMLSerializer},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(3),o=r(0),i=function(){function e(){}return e.prototype.before=function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=r(6),i=r(3),a=r(7),s=function(){function e(e){this._nodeList=[],this._recordQueue=[],this._callback=e;var t=o.dom.window;a.set.append(t._mutationObservers,this)}return e.prototype.observe=function(e,t){var r,o;if(void 0===(t=t||{childList:!1,subtree:!1}).attributeOldValue&&void 0===t.attributeFilter||void 0!==t.attributes||(t.attributes=!0),void 0!==t.characterDataOldValue&&void 0===t.characterData&&(t.characterData=!0),!t.childList&&!t.attributes&&!t.characterData)throw new TypeError;if(t.attributeOldValue&&!t.attributes)throw new TypeError;if(void 0!==t.attributeFilter&&!t.attributes)throw new TypeError;if(t.characterDataOldValue&&!t.characterData)throw new TypeError;var s=!1,l=t,u=function(e){var t,r;if(e.observer===c){s=!0;try{for(var o=(t=void 0,n(c._nodeList)),u=o.next();!u.done;u=o.next()){var d=u.value;a.list.remove(d._registeredObserverList,function(t){return i.Guard.isTransientRegisteredObserver(t)&&t.source===e})}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}e.options=l}},c=this;try{for(var d=n(e._registeredObserverList),p=d.next();!p.done;p=d.next())u(p.value)}catch(e){r={error:e}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(r)throw r.error}}s||(e._registeredObserverList.push({observer:this,options:t}),this._nodeList.push(e))},e.prototype.disconnect=function(){var e,t,r=this;try{for(var o=n(this._nodeList),i=o.next();!i.done;i=o.next()){var s=i.value;a.list.remove(s._registeredObserverList,function(e){return e.observer===r})}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}this._recordQueue=[]},e.prototype.takeRecords=function(){var e=this._recordQueue;return this._recordQueue=[],e},e}();t.MutationObserverImpl=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(3),o=function(){function e(){}return Object.defineProperty(e.prototype,"previousElementSibling",{get:function(){for(var e=n.Cast.asNode(this)._previousSibling;e;){if(n.Guard.isElementNode(e))return e;e=e._previousSibling}return null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nextElementSibling",{get:function(){for(var e=n.Cast.asNode(this)._nextSibling;e;){if(n.Guard.isElementNode(e))return e;e=e._nextSibling}return null},enumerable:!0,configurable:!0}),e}();t.NonDocumentTypeChildNodeImpl=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(3),o=r(0),i=function(){function e(){}return e.prototype.getElementById=function(e){for(var t=o.tree_getFirstDescendantNode(n.Cast.asNode(this),!1,!1,function(e){return n.Guard.isElementNode(e)});null!==t;){if(t._uniqueIdentifier===e)return t;t=o.tree_getNextDescendantNode(n.Cast.asNode(this),t,!1,!1,function(e){return n.Guard.isElementNode(e)})}return null},e}();t.NonElementParentNodeImpl=i},function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=r(3),i=r(0),a=function(){function e(){}return Object.defineProperty(e.prototype,"children",{get:function(){return i.create_htmlCollection(o.Cast.asNode(this))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"firstElementChild",{get:function(){for(var e=o.Cast.asNode(this)._firstChild;e;){if(o.Guard.isElementNode(e))return e;e=e._nextSibling}return null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lastElementChild",{get:function(){for(var e=o.Cast.asNode(this)._lastChild;e;){if(o.Guard.isElementNode(e))return e;e=e._previousSibling}return null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"childElementCount",{get:function(){var e,t,r=0;try{for(var i=n(o.Cast.asNode(this)._children),a=i.next();!a.done;a=i.next()){var s=a.value;o.Guard.isElementNode(s)&&r++}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return r},enumerable:!0,configurable:!0}),e.prototype.prepend=function(){for(var e=[],t=0;t0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var i=r(180),a=r(111),s=r(7),l=r(0),u=r(69),c=function(){function e(){}return e.prototype.parse=function(e){for(var t,r,c,d,p=new i.XMLStringLexer(e,{skipWhitespaceOnlyText:!0}),f=l.create_document(),h=f,m=p.nextToken();m.type!==a.TokenType.EOF;){switch(m.type){case a.TokenType.Declaration:var g=m;if("1.0"!==g.version)throw new Error("Invalid xml version: "+g.version);break;case a.TokenType.DocType:var y=m;if(!l.xml_isPubidChar(y.pubId))throw new Error("DocType public identifier does not match PubidChar construct.");if(!l.xml_isLegalChar(y.sysId)||-1!==y.sysId.indexOf('"')&&-1!==y.sysId.indexOf("'"))throw new Error("DocType system identifier contains invalid characters.");h.appendChild(f.implementation.createDocumentType(y.name,y.pubId,y.sysId));break;case a.TokenType.CDATA:var v=m;if(!l.xml_isLegalChar(v.data)||-1!==v.data.indexOf("]]>"))throw new Error("CDATA contains invalid characters.");h.appendChild(f.createCDATASection(v.data));break;case a.TokenType.Comment:var b=m;if(!l.xml_isLegalChar(b.data)||-1!==b.data.indexOf("--")||b.data.endsWith("-"))throw new Error("Comment data contains invalid characters.");h.appendChild(f.createComment(b.data));break;case a.TokenType.PI:var x=m;if(-1!==x.target.indexOf(":")||/^xml$/i.test(x.target))throw new Error("Processing instruction target contains invalid characters.");if(!l.xml_isLegalChar(x.data)||-1!==x.data.indexOf("?>"))throw new Error("Processing instruction data contains invalid characters.");h.appendChild(f.createProcessingInstruction(x.target,x.data));break;case a.TokenType.Text:var _=m;if(!l.xml_isLegalChar(_.data))throw new Error("Text data contains invalid characters.");h.appendChild(f.createTextNode(this._decodeText(_.data)));break;case a.TokenType.Element:var S=m,C=n(l.namespace_extractQName(S.name),2),T=C[0],w=C[1];if(-1!==w.indexOf(":")||!l.xml_isName(w))throw new Error("Node local name contains invalid characters.");if("xmlns"===T)throw new Error("An element cannot have the 'xmlns' prefix.");var A=h.lookupNamespaceURI(T),E={};try{for(var D=(t=void 0,o(S.attributes)),P=D.next();!P.done;P=D.next()){var I=n(P.value,2),O=I[0],N=I[1];if("xmlns"===O)A=N;else{var M=n(l.namespace_extractQName(O),2),R=M[0],F=M[1];"xmlns"===R&&(F===T&&(A=N),E[F]=N)}}}catch(e){t={error:e}}finally{try{P&&!P.done&&(r=D.return)&&r.call(D)}finally{if(t)throw t.error}}var B=null!==A?f.createElementNS(A,S.name):f.createElement(S.name);h.appendChild(B);var L=new u.LocalNameSet;try{for(var k=(c=void 0,o(S.attributes)),U=k.next();!U.done;U=k.next()){var V=n(U.value,2),G=(O=V[0],N=V[1],n(l.namespace_extractQName(O),2)),z=(R=G[0],F=G[1],null);if("xmlns"===R||null===R&&"xmlns"===F?z=s.namespace.XMLNS:null!==(z=B.lookupNamespaceURI(R))&&B.isDefaultNamespace(z)?z=null:null===z&&null!==R&&(z=E[R]||null),L.has(z,F))throw new Error("Element contains duplicate attributes.");if(L.set(z,F),z===s.namespace.XMLNS&&N===s.namespace.XMLNS)throw new Error("XMLNS namespace is reserved.");if(-1!==F.indexOf(":")||!l.xml_isName(F))throw new Error("Attribute local name contains invalid characters.");if("xmlns"===R&&""===N)throw new Error("Empty XML namespace is not allowed.");null!==z?B.setAttributeNS(z,O,this._decodeAttributeValue(N)):B.setAttribute(O,this._decodeAttributeValue(N))}}catch(e){c={error:e}}finally{try{U&&!U.done&&(d=k.return)&&d.call(k)}finally{if(c)throw c.error}}S.selfClosing||(h=B);break;case a.TokenType.ClosingTag:if(m.name!==h.nodeName)throw new Error("Closing tag name does not match opening tag name.");h._parent&&(h=h._parent)}m=p.nextToken()}return f},e.prototype._decodeText=function(e){return null==e?e:e.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")},e.prototype._decodeAttributeValue=function(e){return null==e?e:e.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")},e}();t.XMLParserImpl=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(275);t.XMLSerializer=n.XMLSerializerImpl},function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=r(2),i=r(69),a=r(95),s=r(9),l=r(7),u=r(0),c=function(){function e(){}return e.prototype.serializeToString=function(e){return this._xmlSerialization(e,!1)},e.prototype._xmlSerialization=function(e,t){if(void 0===e._nodeDocument||e._nodeDocument._hasNamespaces){var r=new a.NamespacePrefixMap;r.set("xml",l.namespace.XML);try{return this._serializeNodeNS(e,null,r,{value:1},t)}catch(e){throw new s.InvalidStateError}}else try{return this._serializeNode(e,t)}catch(e){throw new s.InvalidStateError}},e.prototype._serializeNodeNS=function(e,t,r,n,i){switch(e.nodeType){case o.NodeType.Element:return this._serializeElementNS(e,t,r,n,i);case o.NodeType.Document:return this._serializeDocumentNS(e,t,r,n,i);case o.NodeType.Comment:return this._serializeComment(e,i);case o.NodeType.Text:return this._serializeText(e,i);case o.NodeType.DocumentFragment:return this._serializeDocumentFragmentNS(e,t,r,n,i);case o.NodeType.DocumentType:return this._serializeDocumentType(e,i);case o.NodeType.ProcessingInstruction:return this._serializeProcessingInstruction(e,i);case o.NodeType.CData:return this._serializeCData(e,i);default:throw new Error("Unknown node type: "+e.nodeType)}},e.prototype._serializeNode=function(e,t){switch(e.nodeType){case o.NodeType.Element:return this._serializeElement(e,t);case o.NodeType.Document:return this._serializeDocument(e,t);case o.NodeType.Comment:return this._serializeComment(e,t);case o.NodeType.Text:return this._serializeText(e,t);case o.NodeType.DocumentFragment:return this._serializeDocumentFragment(e,t);case o.NodeType.DocumentType:return this._serializeDocumentType(e,t);case o.NodeType.ProcessingInstruction:return this._serializeProcessingInstruction(e,t);case o.NodeType.CData:return this._serializeCData(e,t);default:throw new Error("Unknown node type: "+e.nodeType)}},e.prototype._serializeElementNS=function(t,r,o,i,a){var s,c;if(a&&(-1!==t.localName.indexOf(":")||!u.xml_isName(t.localName)))throw new Error("Node local name contains invalid characters (well-formed required).");var d="<",p="",f=!1,h=!1,m=o.copy(),g={},y=this._recordNamespaceInformation(t,m,g),v=r,b=t.namespaceURI;if(v===b)null!==y&&(h=!0),d+=p=b===l.namespace.XML?"xml:"+t.localName:t.localName;else{var x=t.prefix,_=null;if(null===x&&b===y||(_=m.get(x,b)),"xmlns"===x){if(a)throw new Error("An element cannot have the 'xmlns' prefix (well-formed required).");_=x}null!==_?(p=_+":"+t.localName,null!==y&&y!==l.namespace.XML&&(v=y||null),d+=p):null!==x?(x in g&&(x=this._generatePrefix(b,m,i)),m.set(x,b),d+=p+=x+":"+t.localName,d+=" xmlns:"+x+'="'+this._serializeAttributeValue(b,a)+'"',null!==y&&(v=y||null)):null===y||null!==y&&y!==b?(h=!0,v=b,d+=p+=t.localName,d+=' xmlns="'+this._serializeAttributeValue(b,a)+'"'):(v=b,d+=p+=t.localName)}d+=this._serializeAttributesNS(t,m,i,g,h,a);var S=b===l.namespace.HTML;if(S&&0===t.childNodes.length&&e._VoidElementNames.has(t.localName)?(d+=" /",f=!0):S||0!==t.childNodes.length||(d+="/",f=!0),d+=">",f)return d;if(S&&"template"===t.localName);else try{for(var C=n(t._children||t.childNodes),T=C.next();!T.done;T=C.next()){var w=T.value;d+=this._serializeNodeNS(w,v,m,i,a)}}catch(e){s={error:e}}finally{try{T&&!T.done&&(c=C.return)&&c.call(C)}finally{if(s)throw s.error}}return d+""},e.prototype._serializeDocumentNS=function(e,t,r,o,i){var a,s;if(i&&null===e.documentElement)throw new Error("Missing document element (well-formed required).");var l="";try{for(var u=n(e._children||e.childNodes),c=u.next();!c.done;c=u.next()){var d=c.value;l+=this._serializeNodeNS(d,t,r,o,i)}}catch(e){a={error:e}}finally{try{c&&!c.done&&(s=u.return)&&s.call(u)}finally{if(a)throw a.error}}return l},e.prototype._serializeComment=function(e,t){if(t&&(!u.xml_isLegalChar(e.data)||-1!==e.data.indexOf("--")||e.data.endsWith("-")))throw new Error("Comment data contains invalid characters (well-formed required).");return"\x3c!--"+e.data+"--\x3e"},e.prototype._serializeText=function(e,t){if(t&&!u.xml_isLegalChar(e.data))throw new Error("Text data contains invalid characters (well-formed required).");for(var r="",n=0;n"===o?">":o}return r},e.prototype._serializeDocumentFragmentNS=function(e,t,r,o,i){var a,s,l="";try{for(var u=n(e._children||e.childNodes),c=u.next();!c.done;c=u.next()){var d=c.value;l+=this._serializeNodeNS(d,t,r,o,i)}}catch(e){a={error:e}}finally{try{c&&!c.done&&(s=u.return)&&s.call(u)}finally{if(a)throw a.error}}return l},e.prototype._serializeDocumentType=function(e,t){if(t&&!u.xml_isPubidChar(e.publicId))throw new Error("DocType public identifier does not match PubidChar construct (well-formed required).");if(t&&(!u.xml_isLegalChar(e.systemId)||-1!==e.systemId.indexOf('"')&&-1!==e.systemId.indexOf("'")))throw new Error("DocType system identifier contains invalid characters (well-formed required).");return e.publicId&&e.systemId?"':e.publicId?"':e.systemId?"':""},e.prototype._serializeProcessingInstruction=function(e,t){if(t&&(-1!==e.target.indexOf(":")||/^xml$/i.test(e.target)))throw new Error("Processing instruction target contains invalid characters (well-formed required).");if(t&&(!u.xml_isLegalChar(e.data)||-1!==e.data.indexOf("?>")))throw new Error("Processing instruction data contains invalid characters (well-formed required).");return""},e.prototype._serializeCData=function(e,t){if(t&&-1!==e.data.indexOf("]]>"))throw new Error("CDATA contains invalid characters (well-formed required).");return""},e.prototype._serializeAttributesNS=function(e,t,r,o,a,s){var c,d,p="",f=s?new i.LocalNameSet:void 0;try{for(var h=n(e.attributes),m=h.next();!m.done;m=h.next()){var g=m.value;if(a||s||null!==g.namespaceURI){if(s&&f&&f.has(g.namespaceURI,g.localName))throw new Error("Element contains duplicate attributes (well-formed required).");s&&f&&f.set(g.namespaceURI,g.localName);var y=g.namespaceURI,v=null;if(null!==y)if(v=t.get(g.prefix,y),y===l.namespace.XMLNS){if(g.value===l.namespace.XML||null===g.prefix&&a||null!==g.prefix&&(!(g.localName in o)||o[g.localName]!==g.value)&&t.has(g.localName,g.value))continue;if(s&&g.value===l.namespace.XMLNS)throw new Error("XMLNS namespace is reserved (well-formed required).");if(s&&""===g.value)throw new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required).");"xmlns"===g.prefix&&(v="xmlns")}else null===v&&(p+=" xmlns:"+(v=null===g.prefix||t.hasPrefix(g.prefix)&&!t.has(g.prefix,y)?this._generatePrefix(y,t,r):g.prefix)+'="'+this._serializeAttributeValue(y,s)+'"');if(p+=" ",null!==v&&(p+=v+":"),s&&(-1!==g.localName.indexOf(":")||!u.xml_isName(g.localName)||"xmlns"===g.localName&&null===y))throw new Error("Attribute local name contains invalid characters (well-formed required).");p+=g.localName+'="'+this._serializeAttributeValue(g.value,s)+'"'}else p+=" "+g.localName+'="'+this._serializeAttributeValue(g.value,s)+'"'}}catch(e){c={error:e}}finally{try{m&&!m.done&&(d=h.return)&&d.call(h)}finally{if(c)throw c.error}}return p},e.prototype._recordNamespaceInformation=function(e,t,r){var o,i,a=null;try{for(var s=n(e.attributes),u=s.next();!u.done;u=s.next()){var c=u.value,d=c.namespaceURI,p=c.prefix;if(d===l.namespace.XMLNS){if(null===p){a=c.value;continue}var f=c.localName,h=c.value;if(h===l.namespace.XML)continue;if(""===h&&(h=null),t.has(f,h))continue;t.set(f,h),r[f]=h||""}}}catch(e){o={error:e}}finally{try{u&&!u.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}return a},e.prototype._generatePrefix=function(e,t,r){var n="ns"+r.value;return r.value++,t.set(n,e),n},e.prototype._serializeAttributeValue=function(e,t){if(t&&null!==e&&!u.xml_isLegalChar(e))throw new Error("Invalid characters in attribute value.");if(null===e)return"";for(var r="",n=0;n"===o?">":o}return r},e.prototype._serializeElement=function(e,t){var r,o;if(t&&(-1!==e.localName.indexOf(":")||!u.xml_isName(e.localName)))throw new Error("Node local name contains invalid characters (well-formed required).");var i=!1,a=e.localName,s="<"+a;if(s+=this._serializeAttributes(e,t),0===e._children.size&&(s+="/",i=!0),s+=">",i)return s;try{for(var l=n(e._children),c=l.next();!c.done;c=l.next()){var d=c.value;s+=this._serializeNode(d,t)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(o=l.return)&&o.call(l)}finally{if(r)throw r.error}}return s+""},e.prototype._serializeDocument=function(e,t){var r,o;if(t&&null===e.documentElement)throw new Error("Missing document element (well-formed required).");var i="";try{for(var a=n(e._children),s=a.next();!s.done;s=a.next()){var l=s.value;i+=this._serializeNode(l,t)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}return i},e.prototype._serializeDocumentFragment=function(e,t){var r,o,i="";try{for(var a=n(e._children),s=a.next();!s.done;s=a.next()){var l=s.value;i+=this._serializeNode(l,t)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}return i},e.prototype._serializeAttributes=function(e,t){var r,o,i="",a=t?{}:void 0;try{for(var s=n(e.attributes),l=s.next();!l.done;l=s.next()){var c=l.value;if(t&&a&&c.localName in a)throw new Error("Element contains duplicate attributes (well-formed required).");if(t&&a&&(a[c.localName]=!0),t&&(-1!==c.localName.indexOf(":")||!u.xml_isName(c.localName)))throw new Error("Attribute local name contains invalid characters (well-formed required).");i+=" "+c.localName+'="'+this._serializeAttributeValue(c.value,t)+'"'}}catch(e){r={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}return i},e._VoidElementNames=new Set(["area","base","basefont","bgsound","br","col","embed","frame","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"]),e}();t.XMLSerializerImpl=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(277);t.XMLReader=n.XMLReader;var o=r(112);t.ObjectReader=o.ObjectReader;var i=r(280);t.JSONReader=i.JSONReader;var a=r(281);t.YAMLReader=a.YAMLReader},function(e,t,r){"use strict";r(31),r(32),r(33),r(19),r(65),r(20),r(22),r(23);var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),i=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var s=r(180),l=r(111),u=r(7),c=r(0),d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype._parse=function(e,t){for(var r,n,o,d,p=new s.XMLStringLexer(t,{skipWhitespaceOnlyText:!0}),f=e,h=e,m=p.nextToken();m.type!==l.TokenType.EOF;){switch(m.type){case l.TokenType.Declaration:var g=m,y=this.sanitize(g.version);if("1.0"!==y)throw new Error("Invalid xml version: "+y);var v={version:y};g.encoding&&(v.encoding=this.sanitize(g.encoding)),g.standalone&&(v.standalone="yes"===this.sanitize(g.standalone)),h.set(v);break;case l.TokenType.DocType:var b=m;h=this.docType(h,this.sanitize(b.name),this.sanitize(b.pubId),this.sanitize(b.sysId))||h;break;case l.TokenType.CDATA:var x=m;h=this.cdata(h,this.sanitize(x.data))||h;break;case l.TokenType.Comment:var _=m;h=this.comment(h,this.sanitize(_.data))||h;break;case l.TokenType.PI:var S=m;h=this.instruction(h,this.sanitize(S.target),this.sanitize(S.data))||h;break;case l.TokenType.Text:var C=m;h=this.text(h,this._decodeText(this.sanitize(C.data)))||h;break;case l.TokenType.Element:var T=m,w=this.sanitize(T.name),A=i(c.namespace_extractQName(w),1)[0],E=h.node.lookupNamespaceURI(A),D={};try{for(var P=(r=void 0,a(T.attributes)),I=P.next();!I.done;I=P.next()){var O=i(I.value,2),N=O[0],M=O[1];if(N=this.sanitize(N),M=this.sanitize(M),"xmlns"===N)E=M;else{var R=i(c.namespace_extractQName(N),2),F=R[0],B=R[1];"xmlns"===F&&(B===A&&(E=M),D[B]=M)}}}catch(e){r={error:e}}finally{try{I&&!I.done&&(n=P.return)&&n.call(P)}finally{if(r)throw r.error}}var L=null!==E?this.element(h,E,w):this.element(h,void 0,w);if(void 0===L)break;h.node===e.node&&(f=L);try{for(var k=(o=void 0,a(T.attributes)),U=k.next();!U.done;U=k.next()){var V=i(U.value,2);N=V[0],M=V[1],N=this.sanitize(N),M=this.sanitize(M);var G=i(c.namespace_extractQName(N),2),z=(F=G[0],B=G[1],null);"xmlns"===F||null===F&&"xmlns"===B?z=u.namespace.XMLNS:null!==(z=L.node.lookupNamespaceURI(F))&&L.node.isDefaultNamespace(z)?z=null:null===z&&null!==F&&(z=D[F]||null),null!==z?this.attribute(L,z,N,this._decodeAttributeValue(M)):this.attribute(L,void 0,N,this._decodeAttributeValue(M))}}catch(e){o={error:e}}finally{try{U&&!U.done&&(d=k.return)&&d.call(k)}finally{if(o)throw o.error}}T.selfClosing||(h=L);break;case l.TokenType.ClosingTag:h.node.parentNode&&(h=h.up())}m=p.nextToken()}return f},t}(r(75).BaseReader);t.XMLReader=d},function(e,t,r){var n=r(4),o=r(279);n({target:"Object",stat:!0,forced:Object.assign!==o},{assign:o})},function(e,t,r){"use strict";var n=r(16),o=r(8),i=r(61),a=r(85),s=r(79),l=r(27),u=r(41),c=Object.assign,d=Object.defineProperty;e.exports=!c||o(function(){if(n&&1!==c({b:1},c(d({},"a",{enumerable:!0,get:function(){d(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol();return e[r]=7,"abcdefghijklmnopqrst".split("").forEach(function(e){t[e]=e}),7!=c({},e)[r]||"abcdefghijklmnopqrst"!=i(c({},t)).join("")})?function(e,t){for(var r=l(e),o=arguments.length,c=1,d=a.f,p=s.f;o>c;)for(var f,h=u(arguments[c++]),m=d?i(h).concat(d(h)):i(h),g=m.length,y=0;g>y;)f=m[y++],n&&!p.call(h,f)||(r[f]=h[f]);return r}:c},function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var i=r(112),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype._parse=function(e,t){return new i.ObjectReader(this._builderOptions).parse(e,JSON.parse(t))},t}(r(75).BaseReader);t.JSONReader=a},function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var i=r(112),a=r(75),s=r(282),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype._parse=function(e,t){var r=s.safeLoad(t);if(void 0===r)throw new Error("Unable to parse YAML document.");return new i.ObjectReader(this._builderOptions).parse(e,r)},t}(a.BaseReader);t.YAMLReader=l},function(e,t,r){"use strict";var n=r(283);e.exports=n},function(e,t,r){"use strict";var n=r(284),o=r(303);function i(e){return function(){throw new Error("Function "+e+" is deprecated and cannot be used.")}}e.exports.Type=r(10),e.exports.Schema=r(39),e.exports.FAILSAFE_SCHEMA=r(113),e.exports.JSON_SCHEMA=r(182),e.exports.CORE_SCHEMA=r(181),e.exports.DEFAULT_SAFE_SCHEMA=r(54),e.exports.DEFAULT_FULL_SCHEMA=r(76),e.exports.load=n.load,e.exports.loadAll=n.loadAll,e.exports.safeLoad=n.safeLoad,e.exports.safeLoadAll=n.safeLoadAll,e.exports.dump=o.dump,e.exports.safeDump=o.safeDump,e.exports.YAMLException=r(53),e.exports.MINIMAL_SCHEMA=r(113),e.exports.SAFE_SCHEMA=r(54),e.exports.DEFAULT_SCHEMA=r(76),e.exports.scan=i("scan"),e.exports.parse=i("parse"),e.exports.compose=i("compose"),e.exports.addConstructor=i("addConstructor")},function(e,t,r){"use strict";var n=r(38),o=r(53),i=r(285),a=r(54),s=r(76),l=Object.prototype.hasOwnProperty,u=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,c=/[\x85\u2028\u2029]/,d=/[,\[\]\{\}]/,p=/^(?:!|!!|![a-z\-]+!)$/i,f=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function h(e){return Object.prototype.toString.call(e)}function m(e){return 10===e||13===e}function g(e){return 9===e||32===e}function y(e){return 9===e||32===e||10===e||13===e}function v(e){return 44===e||91===e||93===e||123===e||125===e}function b(e){var t;return 48<=e&&e<=57?e-48:97<=(t=32|e)&&t<=102?t-97+10:-1}function x(e){return 48===e?"\0":97===e?"":98===e?"\b":116===e||9===e?"\t":110===e?"\n":118===e?"\v":102===e?"\f":114===e?"\r":101===e?"":32===e?" ":34===e?'"':47===e?"/":92===e?"\\":78===e?"…":95===e?" ":76===e?"\u2028":80===e?"\u2029":""}function _(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023))}for(var S=new Array(256),C=new Array(256),T=0;T<256;T++)S[T]=x(T)?1:0,C[T]=x(T);function w(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||s,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function A(e,t){return new o(t,new i(e.filename,e.input,e.position,e.line,e.position-e.lineStart))}function E(e,t){throw A(e,t)}function D(e,t){e.onWarning&&e.onWarning.call(null,A(e,t))}var P={YAML:function(e,t,r){var n,o,i;null!==e.version&&E(e,"duplication of %YAML directive"),1!==r.length&&E(e,"YAML directive accepts exactly one argument"),null===(n=/^([0-9]+)\.([0-9]+)$/.exec(r[0]))&&E(e,"ill-formed argument of the YAML directive"),o=parseInt(n[1],10),i=parseInt(n[2],10),1!==o&&E(e,"unacceptable YAML version of the document"),e.version=r[0],e.checkLineBreaks=i<2,1!==i&&2!==i&&D(e,"unsupported YAML version of the document")},TAG:function(e,t,r){var n,o;2!==r.length&&E(e,"TAG directive accepts exactly two arguments"),n=r[0],o=r[1],p.test(n)||E(e,"ill-formed tag handle (first argument) of the TAG directive"),l.call(e.tagMap,n)&&E(e,'there is a previously declared suffix for "'+n+'" tag handle'),f.test(o)||E(e,"ill-formed tag prefix (second argument) of the TAG directive"),e.tagMap[n]=o}};function I(e,t,r,n){var o,i,a,s;if(t1&&(e.result+=n.repeat("\n",t-1))}function L(e,t){var r,n,o=e.tag,i=e.anchor,a=[],s=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=a),n=e.input.charCodeAt(e.position);0!==n&&45===n&&y(e.input.charCodeAt(e.position+1));)if(s=!0,e.position++,R(e,!0,-1)&&e.lineIndent<=t)a.push(null),n=e.input.charCodeAt(e.position);else if(r=e.line,V(e,t,3,!1,!0),a.push(e.result),R(e,!0,-1),n=e.input.charCodeAt(e.position),(e.line===r||e.lineIndent>t)&&0!==n)E(e,"bad indentation of a sequence entry");else if(e.lineIndentt?x=1:e.lineIndent===t?x=0:e.lineIndentt?x=1:e.lineIndent===t?x=0:e.lineIndentt)&&(V(e,t,4,!0,o)&&(m?f=e.result:h=e.result),m||(N(e,c,d,p,f,h,i,a),p=f=h=null),R(e,!0,-1),s=e.input.charCodeAt(e.position)),e.lineIndent>t&&0!==s)E(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===i?E(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?E(e,"repeat of an indentation width identifier"):(d=t+i-1,c=!0)}if(g(a)){do{a=e.input.charCodeAt(++e.position)}while(g(a));if(35===a)do{a=e.input.charCodeAt(++e.position)}while(!m(a)&&0!==a)}for(;0!==a;){for(M(e),e.lineIndent=0,a=e.input.charCodeAt(e.position);(!c||e.lineIndentd&&(d=e.lineIndent),m(a))p++;else{if(e.lineIndent0){for(o=a,i=0;o>0;o--)(a=b(s=e.input.charCodeAt(++e.position)))>=0?i=(i<<4)+a:E(e,"expected hexadecimal character");e.result+=_(i),e.position++}else E(e,"unknown escape sequence");r=n=e.position}else m(s)?(I(e,r,n,!0),B(e,R(e,!1,t)),r=n=e.position):e.position===e.lineStart&&F(e)?E(e,"unexpected end of the document within a double quoted scalar"):(e.position++,n=e.position)}E(e,"unexpected end of the stream within a double quoted scalar")}(e,f)?w=!0:function(e){var t,r,n;if(42!==(n=e.input.charCodeAt(e.position)))return!1;for(n=e.input.charCodeAt(++e.position),t=e.position;0!==n&&!y(n)&&!v(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&E(e,"name of an alias node must contain at least one character"),r=e.input.slice(t,e.position),e.anchorMap.hasOwnProperty(r)||E(e,'unidentified alias "'+r+'"'),e.result=e.anchorMap[r],R(e,!0,-1),!0}(e)?(w=!0,null===e.tag&&null===e.anchor||E(e,"alias node should not have any properties")):function(e,t,r){var n,o,i,a,s,l,u,c,d=e.kind,p=e.result;if(y(c=e.input.charCodeAt(e.position))||v(c)||35===c||38===c||42===c||33===c||124===c||62===c||39===c||34===c||37===c||64===c||96===c)return!1;if((63===c||45===c)&&(y(n=e.input.charCodeAt(e.position+1))||r&&v(n)))return!1;for(e.kind="scalar",e.result="",o=i=e.position,a=!1;0!==c;){if(58===c){if(y(n=e.input.charCodeAt(e.position+1))||r&&v(n))break}else if(35===c){if(y(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&F(e)||r&&v(c))break;if(m(c)){if(s=e.line,l=e.lineStart,u=e.lineIndent,R(e,!1,-1),e.lineIndent>=t){a=!0,c=e.input.charCodeAt(e.position);continue}e.position=i,e.line=s,e.lineStart=l,e.lineIndent=u;break}}a&&(I(e,o,i,!1),B(e,e.line-s),o=i=e.position,a=!1),g(c)||(i=e.position+1),c=e.input.charCodeAt(++e.position)}return I(e,o,i,!1),!!e.result||(e.kind=d,e.result=p,!1)}(e,f,1===r)&&(w=!0,null===e.tag&&(e.tag="?")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===x&&(w=u&&L(e,h))),null!==e.tag&&"!"!==e.tag)if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&E(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),c=0,d=e.implicitTypes.length;c tag; it should be "'+p.kind+'", not "'+e.kind+'"'),p.resolve(e.result)?(e.result=p.construct(e.result),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):E(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")):E(e,"unknown tag !<"+e.tag+">");return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||w}function G(e){var t,r,n,o,i=e.position,a=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap={},e.anchorMap={};0!==(o=e.input.charCodeAt(e.position))&&(R(e,!0,-1),o=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==o));){for(a=!0,o=e.input.charCodeAt(++e.position),t=e.position;0!==o&&!y(o);)o=e.input.charCodeAt(++e.position);for(n=[],(r=e.input.slice(t,e.position)).length<1&&E(e,"directive name must not be less than one character in length");0!==o;){for(;g(o);)o=e.input.charCodeAt(++e.position);if(35===o){do{o=e.input.charCodeAt(++e.position)}while(0!==o&&!m(o));break}if(m(o))break;for(t=e.position;0!==o&&!y(o);)o=e.input.charCodeAt(++e.position);n.push(e.input.slice(t,e.position))}0!==o&&M(e),l.call(P,r)?P[r](e,r,n):D(e,'unknown document directive "'+r+'"')}R(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,R(e,!0,-1)):a&&E(e,"directives end mark is expected"),V(e,e.lineIndent-1,4,!1,!0),R(e,!0,-1),e.checkLineBreaks&&c.test(e.input.slice(i,e.position))&&D(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&F(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,R(e,!0,-1)):e.position0&&-1==="\0\r\n…\u2028\u2029".indexOf(this.buffer.charAt(o-1));)if(o-=1,this.position-o>t/2-1){r=" ... ",o+=5;break}for(i="",a=this.position;at/2-1){i=" ... ",a-=5;break}return s=this.buffer.slice(o,a),n.repeat(" ",e)+r+s+i+"\n"+n.repeat(" ",e+this.position-o+r.length)+"^"},o.prototype.toString=function(e){var t,r="";return this.name&&(r+='in "'+this.name+'" '),r+="at line "+(this.line+1)+", column "+(this.column+1),e||(t=this.getSnippet())&&(r+=":\n"+t),r},e.exports=o},function(e,t,r){"use strict";var n=r(10);e.exports=new n("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}})},function(e,t,r){"use strict";var n=r(10);e.exports=new n("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}})},function(e,t,r){"use strict";var n=r(10);e.exports=new n("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}})},function(e,t,r){"use strict";var n=r(10);e.exports=new n("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})},function(e,t,r){"use strict";var n=r(10);e.exports=new n("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"})},function(e,t,r){"use strict";var n=r(38),o=r(10);function i(e){return 48<=e&&e<=55}function a(e){return 48<=e&&e<=57}e.exports=new o("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,r,n=e.length,o=0,s=!1;if(!n)return!1;if("-"!==(t=e[o])&&"+"!==t||(t=e[++o]),"0"===t){if(o+1===n)return!0;if("b"===(t=e[++o])){for(o++;o=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0"+e.toString(8):"-0"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})},function(e,t,r){"use strict";var n=r(38),o=r(10),i=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),a=/^[-+]?[0-9]+e/;e.exports=new o("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!i.test(e)||"_"===e[e.length-1])},construct:function(e){var t,r,n,o;return r="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,o=[],"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===r?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:t.indexOf(":")>=0?(t.split(":").forEach(function(e){o.unshift(parseFloat(e,10))}),t=0,n=1,o.forEach(function(e){t+=e*n,n*=60}),r*t):r*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||n.isNegativeZero(e))},represent:function(e,t){var r;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(n.isNegativeZero(e))return"-0.0";return r=e.toString(10),a.test(r)?r.replace("e",".e"):r},defaultStyle:"lowercase"})},function(e,t,r){"use strict";var n=r(10),o=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),i=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");e.exports=new n("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==o.exec(e)||null!==i.exec(e))},construct:function(e){var t,r,n,a,s,l,u,c,d=0,p=null;if(null===(t=o.exec(e))&&(t=i.exec(e)),null===t)throw new Error("Date resolve error");if(r=+t[1],n=+t[2]-1,a=+t[3],!t[4])return new Date(Date.UTC(r,n,a));if(s=+t[4],l=+t[5],u=+t[6],t[7]){for(d=t[7].slice(0,3);d.length<3;)d+="0";d=+d}return t[9]&&(p=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(p=-p)),c=new Date(Date.UTC(r,n,a,s,l,u,d)),p&&c.setTime(c.getTime()-p),c},instanceOf:Date,represent:function(e){return e.toISOString()}})},function(e,t,r){"use strict";var n=r(10);e.exports=new n("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}})},function(e,t,r){"use strict";var n;try{n=r(145).Buffer}catch(e){}var o=r(10),i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";e.exports=new o("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,r,n=0,o=e.length,a=i;for(r=0;r64)){if(t<0)return!1;n+=6}return n%8==0},construct:function(e){var t,r,o=e.replace(/[\r\n=]/g,""),a=o.length,s=i,l=0,u=[];for(t=0;t>16&255),u.push(l>>8&255),u.push(255&l)),l=l<<6|s.indexOf(o.charAt(t));return 0==(r=a%4*6)?(u.push(l>>16&255),u.push(l>>8&255),u.push(255&l)):18===r?(u.push(l>>10&255),u.push(l>>2&255)):12===r&&u.push(l>>4&255),n?n.from?n.from(u):new n(u):u},predicate:function(e){return n&&n.isBuffer(e)},represent:function(e){var t,r,n="",o=0,a=e.length,s=i;for(t=0;t>18&63],n+=s[o>>12&63],n+=s[o>>6&63],n+=s[63&o]),o=(o<<8)+e[t];return 0==(r=a%3)?(n+=s[o>>18&63],n+=s[o>>12&63],n+=s[o>>6&63],n+=s[63&o]):2===r?(n+=s[o>>10&63],n+=s[o>>4&63],n+=s[o<<2&63],n+=s[64]):1===r&&(n+=s[o>>2&63],n+=s[o<<4&63],n+=s[64],n+=s[64]),n}})},function(e,t,r){"use strict";var n=r(10),o=Object.prototype.hasOwnProperty,i=Object.prototype.toString;e.exports=new n("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,r,n,a,s,l=[],u=e;for(t=0,r=u.length;t3)return!1;if("/"!==t[t.length-n.length-1])return!1}return!0},construct:function(e){var t=e,r=/\/([gim]*)$/.exec(e),n="";return"/"===t[0]&&(r&&(n=r[1]),t=t.slice(1,t.length-n.length-1)),new RegExp(t,n)},predicate:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},represent:function(e){var t="/"+e.source+"/";return e.global&&(t+="g"),e.multiline&&(t+="m"),e.ignoreCase&&(t+="i"),t}})},function(e,t,r){"use strict";var n;try{n=r(302)}catch(e){"undefined"!=typeof window&&(n=window.esprima)}var o=r(10);e.exports=new o("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:function(e){if(null===e)return!1;try{var t="("+e+")",r=n.parse(t,{range:!0});return"Program"===r.type&&1===r.body.length&&"ExpressionStatement"===r.body[0].type&&("ArrowFunctionExpression"===r.body[0].expression.type||"FunctionExpression"===r.body[0].expression.type)}catch(e){return!1}},construct:function(e){var t,r="("+e+")",o=n.parse(r,{range:!0}),i=[];if("Program"!==o.type||1!==o.body.length||"ExpressionStatement"!==o.body[0].type||"ArrowFunctionExpression"!==o.body[0].expression.type&&"FunctionExpression"!==o.body[0].expression.type)throw new Error("Failed to resolve function");return o.body[0].expression.params.forEach(function(e){i.push(e.name)}),t=o.body[0].expression.body.range,"BlockStatement"===o.body[0].expression.body.type?new Function(i,r.slice(t[0]+1,t[1]-1)):new Function(i,"return "+r.slice(t[0],t[1]))},predicate:function(e){return"[object Function]"===Object.prototype.toString.call(e)},represent:function(e){return e.toString()}})},function(e,t,r){var n;n=function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}return r.m=e,r.c=t,r.p="",r(0)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),o=r(3),i=r(8),a=r(15);function s(e,t,r){var a=null,s=function(e,t){r&&r(e,t),a&&a.visit(e,t)},l="function"==typeof r?s:null,u=!1;if(t){u="boolean"==typeof t.comment&&t.comment;var c="boolean"==typeof t.attachComment&&t.attachComment;(u||c)&&((a=new n.CommentHandler).attach=c,t.comment=!0,l=s)}var d,p=!1;t&&"string"==typeof t.sourceType&&(p="module"===t.sourceType),d=t&&"boolean"==typeof t.jsx&&t.jsx?new o.JSXParser(e,t,l):new i.Parser(e,t,l);var f=p?d.parseModule():d.parseScript();return u&&a&&(f.comments=a.comments),d.config.tokens&&(f.tokens=d.tokens),d.config.tolerant&&(f.errors=d.errorHandler.errors),f}t.parse=s,t.parseModule=function(e,t,r){var n=t||{};return n.sourceType="module",s(e,n,r)},t.parseScript=function(e,t,r){var n=t||{};return n.sourceType="script",s(e,n,r)},t.tokenize=function(e,t,r){var n,o=new a.Tokenizer(e,t);n=[];try{for(;;){var i=o.getNextToken();if(!i)break;r&&(i=r(i)),n.push(i)}}catch(e){o.errorHandler.tolerate(e)}return o.errorHandler.tolerant&&(n.errors=o.errors()),n};var l=r(2);t.Syntax=l.Syntax,t.version="4.0.1"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(2),o=function(){function e(){this.attach=!1,this.comments=[],this.stack=[],this.leading=[],this.trailing=[]}return e.prototype.insertInnerComments=function(e,t){if(e.type===n.Syntax.BlockStatement&&0===e.body.length){for(var r=[],o=this.leading.length-1;o>=0;--o){var i=this.leading[o];t.end.offset>=i.start&&(r.unshift(i.comment),this.leading.splice(o,1),this.trailing.splice(o,1))}r.length&&(e.innerComments=r)}},e.prototype.findTrailingComments=function(e){var t=[];if(this.trailing.length>0){for(var r=this.trailing.length-1;r>=0;--r){var n=this.trailing[r];n.start>=e.end.offset&&t.unshift(n.comment)}return this.trailing.length=0,t}var o=this.stack[this.stack.length-1];if(o&&o.node.trailingComments){var i=o.node.trailingComments[0];i&&i.range[0]>=e.end.offset&&(t=o.node.trailingComments,delete o.node.trailingComments)}return t},e.prototype.findLeadingComments=function(e){for(var t,r=[];this.stack.length>0&&(i=this.stack[this.stack.length-1])&&i.start>=e.start.offset;)t=i.node,this.stack.pop();if(t){for(var n=(t.leadingComments?t.leadingComments.length:0)-1;n>=0;--n){var o=t.leadingComments[n];o.range[1]<=e.start.offset&&(r.unshift(o),t.leadingComments.splice(n,1))}return t.leadingComments&&0===t.leadingComments.length&&delete t.leadingComments,r}for(n=this.leading.length-1;n>=0;--n){var i;(i=this.leading[n]).start<=e.start.offset&&(r.unshift(i.comment),this.leading.splice(n,1))}return r},e.prototype.visitNode=function(e,t){if(!(e.type===n.Syntax.Program&&e.body.length>0)){this.insertInnerComments(e,t);var r=this.findTrailingComments(t),o=this.findLeadingComments(t);o.length>0&&(e.leadingComments=o),r.length>0&&(e.trailingComments=r),this.stack.push({node:e,start:t.start.offset})}},e.prototype.visitComment=function(e,t){var r="L"===e.type[0]?"Line":"Block",n={type:r,value:e.value};if(e.range&&(n.range=e.range),e.loc&&(n.loc=e.loc),this.comments.push(n),this.attach){var o={comment:{type:r,value:e.value,range:[t.start.offset,t.end.offset]},start:t.start.offset};e.loc&&(o.comment.loc=e.loc),e.type=r,this.leading.push(o),this.trailing.push(o)}},e.prototype.visit=function(e,t){"LineComment"===e.type||"BlockComment"===e.type?this.visitComment(e,t):this.attach&&this.visitNode(e,t)},e}();t.CommentHandler=o},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Syntax={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DoWhileStatement:"DoWhileStatement",DebuggerStatement:"DebuggerStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForOfStatement:"ForOfStatement",ForInStatement:"ForInStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchCase:"SwitchCase",SwitchStatement:"SwitchStatement",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"}},function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var i=r(4),a=r(5),s=r(6),l=r(7),u=r(8),c=r(13),d=r(14);function p(e){var t;switch(e.type){case s.JSXSyntax.JSXIdentifier:t=e.name;break;case s.JSXSyntax.JSXNamespacedName:var r=e;t=p(r.namespace)+":"+p(r.name);break;case s.JSXSyntax.JSXMemberExpression:var n=e;t=p(n.object)+"."+p(n.property)}return t}c.TokenName[100]="JSXIdentifier",c.TokenName[101]="JSXText";var f=function(e){function t(t,r,n){return e.call(this,t,r,n)||this}return o(t,e),t.prototype.parsePrimaryExpression=function(){return this.match("<")?this.parseJSXRoot():e.prototype.parsePrimaryExpression.call(this)},t.prototype.startJSX=function(){this.scanner.index=this.startMarker.index,this.scanner.lineNumber=this.startMarker.line,this.scanner.lineStart=this.startMarker.index-this.startMarker.column},t.prototype.finishJSX=function(){this.nextToken()},t.prototype.reenterJSX=function(){this.startJSX(),this.expectJSX("}"),this.config.tokens&&this.tokens.pop()},t.prototype.createJSXNode=function(){return this.collectComments(),{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}},t.prototype.createJSXChildNode=function(){return{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}},t.prototype.scanXHTMLEntity=function(e){for(var t="&",r=!0,n=!1,o=!1,a=!1;!this.scanner.eof()&&r&&!n;){var s=this.scanner.source[this.scanner.index];if(s===e)break;if(n=";"===s,t+=s,++this.scanner.index,!n)switch(t.length){case 2:o="#"===s;break;case 3:o&&(r=(a="x"===s)||i.Character.isDecimalDigit(s.charCodeAt(0)),o=o&&!a);break;default:r=(r=r&&!(o&&!i.Character.isDecimalDigit(s.charCodeAt(0))))&&!(a&&!i.Character.isHexDigit(s.charCodeAt(0)))}}if(r&&n&&t.length>2){var l=t.substr(1,t.length-2);o&&l.length>1?t=String.fromCharCode(parseInt(l.substr(1),10)):a&&l.length>2?t=String.fromCharCode(parseInt("0"+l.substr(1),16)):o||a||!d.XHTMLEntities[l]||(t=d.XHTMLEntities[l])}return t},t.prototype.lexJSX=function(){var e=this.scanner.source.charCodeAt(this.scanner.index);if(60===e||62===e||47===e||58===e||61===e||123===e||125===e)return{type:7,value:s=this.scanner.source[this.scanner.index++],lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index-1,end:this.scanner.index};if(34===e||39===e){for(var t=this.scanner.index,r=this.scanner.source[this.scanner.index++],n="";!this.scanner.eof()&&(l=this.scanner.source[this.scanner.index++])!==r;)n+="&"===l?this.scanXHTMLEntity(r):l;return{type:8,value:n,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:t,end:this.scanner.index}}if(46===e){var o=this.scanner.source.charCodeAt(this.scanner.index+1),a=this.scanner.source.charCodeAt(this.scanner.index+2),s=46===o&&46===a?"...":".";return t=this.scanner.index,this.scanner.index+=s.length,{type:7,value:s,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:t,end:this.scanner.index}}if(96===e)return{type:10,value:"",lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index,end:this.scanner.index};if(i.Character.isIdentifierStart(e)&&92!==e){for(t=this.scanner.index,++this.scanner.index;!this.scanner.eof();){var l=this.scanner.source.charCodeAt(this.scanner.index);if(i.Character.isIdentifierPart(l)&&92!==l)++this.scanner.index;else{if(45!==l)break;++this.scanner.index}}return{type:100,value:this.scanner.source.slice(t,this.scanner.index),lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:t,end:this.scanner.index}}return this.scanner.lex()},t.prototype.nextJSXToken=function(){this.collectComments(),this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart;var e=this.lexJSX();return this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.config.tokens&&this.tokens.push(this.convertToken(e)),e},t.prototype.nextJSXText=function(){this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart;for(var e=this.scanner.index,t="";!this.scanner.eof();){var r=this.scanner.source[this.scanner.index];if("{"===r||"<"===r)break;++this.scanner.index,t+=r,i.Character.isLineTerminator(r.charCodeAt(0))&&(++this.scanner.lineNumber,"\r"===r&&"\n"===this.scanner.source[this.scanner.index]&&++this.scanner.index,this.scanner.lineStart=this.scanner.index)}this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart;var n={type:101,value:t,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:e,end:this.scanner.index};return t.length>0&&this.config.tokens&&this.tokens.push(this.convertToken(n)),n},t.prototype.peekJSXToken=function(){var e=this.scanner.saveState();this.scanner.scanComments();var t=this.lexJSX();return this.scanner.restoreState(e),t},t.prototype.expectJSX=function(e){var t=this.nextJSXToken();7===t.type&&t.value===e||this.throwUnexpectedToken(t)},t.prototype.matchJSX=function(e){var t=this.peekJSXToken();return 7===t.type&&t.value===e},t.prototype.parseJSXIdentifier=function(){var e=this.createJSXNode(),t=this.nextJSXToken();return 100!==t.type&&this.throwUnexpectedToken(t),this.finalize(e,new a.JSXIdentifier(t.value))},t.prototype.parseJSXElementName=function(){var e=this.createJSXNode(),t=this.parseJSXIdentifier();if(this.matchJSX(":")){var r=t;this.expectJSX(":");var n=this.parseJSXIdentifier();t=this.finalize(e,new a.JSXNamespacedName(r,n))}else if(this.matchJSX("."))for(;this.matchJSX(".");){var o=t;this.expectJSX(".");var i=this.parseJSXIdentifier();t=this.finalize(e,new a.JSXMemberExpression(o,i))}return t},t.prototype.parseJSXAttributeName=function(){var e,t=this.createJSXNode(),r=this.parseJSXIdentifier();if(this.matchJSX(":")){var n=r;this.expectJSX(":");var o=this.parseJSXIdentifier();e=this.finalize(t,new a.JSXNamespacedName(n,o))}else e=r;return e},t.prototype.parseJSXStringLiteralAttribute=function(){var e=this.createJSXNode(),t=this.nextJSXToken();8!==t.type&&this.throwUnexpectedToken(t);var r=this.getTokenRaw(t);return this.finalize(e,new l.Literal(t.value,r))},t.prototype.parseJSXExpressionAttribute=function(){var e=this.createJSXNode();this.expectJSX("{"),this.finishJSX(),this.match("}")&&this.tolerateError("JSX attributes must only be assigned a non-empty expression");var t=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(e,new a.JSXExpressionContainer(t))},t.prototype.parseJSXAttributeValue=function(){return this.matchJSX("{")?this.parseJSXExpressionAttribute():this.matchJSX("<")?this.parseJSXElement():this.parseJSXStringLiteralAttribute()},t.prototype.parseJSXNameValueAttribute=function(){var e=this.createJSXNode(),t=this.parseJSXAttributeName(),r=null;return this.matchJSX("=")&&(this.expectJSX("="),r=this.parseJSXAttributeValue()),this.finalize(e,new a.JSXAttribute(t,r))},t.prototype.parseJSXSpreadAttribute=function(){var e=this.createJSXNode();this.expectJSX("{"),this.expectJSX("..."),this.finishJSX();var t=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(e,new a.JSXSpreadAttribute(t))},t.prototype.parseJSXAttributes=function(){for(var e=[];!this.matchJSX("/")&&!this.matchJSX(">");){var t=this.matchJSX("{")?this.parseJSXSpreadAttribute():this.parseJSXNameValueAttribute();e.push(t)}return e},t.prototype.parseJSXOpeningElement=function(){var e=this.createJSXNode();this.expectJSX("<");var t=this.parseJSXElementName(),r=this.parseJSXAttributes(),n=this.matchJSX("/");return n&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(e,new a.JSXOpeningElement(t,n,r))},t.prototype.parseJSXBoundaryElement=function(){var e=this.createJSXNode();if(this.expectJSX("<"),this.matchJSX("/")){this.expectJSX("/");var t=this.parseJSXElementName();return this.expectJSX(">"),this.finalize(e,new a.JSXClosingElement(t))}var r=this.parseJSXElementName(),n=this.parseJSXAttributes(),o=this.matchJSX("/");return o&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(e,new a.JSXOpeningElement(r,o,n))},t.prototype.parseJSXEmptyExpression=function(){var e=this.createJSXChildNode();return this.collectComments(),this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.finalize(e,new a.JSXEmptyExpression)},t.prototype.parseJSXExpressionContainer=function(){var e,t=this.createJSXNode();return this.expectJSX("{"),this.matchJSX("}")?(e=this.parseJSXEmptyExpression(),this.expectJSX("}")):(this.finishJSX(),e=this.parseAssignmentExpression(),this.reenterJSX()),this.finalize(t,new a.JSXExpressionContainer(e))},t.prototype.parseJSXChildren=function(){for(var e=[];!this.scanner.eof();){var t=this.createJSXChildNode(),r=this.nextJSXText();if(r.start0))break;i=this.finalize(e.node,new a.JSXElement(e.opening,e.children,e.closing)),(e=t[t.length-1]).children.push(i),t.pop()}}return e},t.prototype.parseJSXElement=function(){var e=this.createJSXNode(),t=this.parseJSXOpeningElement(),r=[],n=null;if(!t.selfClosing){var o=this.parseComplexJSXElement({node:e,opening:t,closing:n,children:r});r=o.children,n=o.closing}return this.finalize(e,new a.JSXElement(t,r,n))},t.prototype.parseJSXRoot=function(){this.config.tokens&&this.tokens.pop(),this.startJSX();var e=this.parseJSXElement();return this.finishJSX(),e},t.prototype.isStartOfExpression=function(){return e.prototype.isStartOfExpression.call(this)||this.match("<")},t}(u.Parser);t.JSXParser=f},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,NonAsciiIdentifierPart:/[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/};t.Character={fromCodePoint:function(e){return e<65536?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10))+String.fromCharCode(56320+(e-65536&1023))},isWhiteSpace:function(e){return 32===e||9===e||11===e||12===e||160===e||e>=5760&&[5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)>=0},isLineTerminator:function(e){return 10===e||13===e||8232===e||8233===e},isIdentifierStart:function(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||92===e||e>=128&&r.NonAsciiIdentifierStart.test(t.Character.fromCodePoint(e))},isIdentifierPart:function(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||92===e||e>=128&&r.NonAsciiIdentifierPart.test(t.Character.fromCodePoint(e))},isDecimalDigit:function(e){return e>=48&&e<=57},isHexDigit:function(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102},isOctalDigit:function(e){return e>=48&&e<=55}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(6);t.JSXClosingElement=function(e){this.type=n.JSXSyntax.JSXClosingElement,this.name=e};t.JSXElement=function(e,t,r){this.type=n.JSXSyntax.JSXElement,this.openingElement=e,this.children=t,this.closingElement=r};t.JSXEmptyExpression=function(){this.type=n.JSXSyntax.JSXEmptyExpression};t.JSXExpressionContainer=function(e){this.type=n.JSXSyntax.JSXExpressionContainer,this.expression=e};t.JSXIdentifier=function(e){this.type=n.JSXSyntax.JSXIdentifier,this.name=e};t.JSXMemberExpression=function(e,t){this.type=n.JSXSyntax.JSXMemberExpression,this.object=e,this.property=t};t.JSXAttribute=function(e,t){this.type=n.JSXSyntax.JSXAttribute,this.name=e,this.value=t};t.JSXNamespacedName=function(e,t){this.type=n.JSXSyntax.JSXNamespacedName,this.namespace=e,this.name=t};t.JSXOpeningElement=function(e,t,r){this.type=n.JSXSyntax.JSXOpeningElement,this.name=e,this.selfClosing=t,this.attributes=r};t.JSXSpreadAttribute=function(e){this.type=n.JSXSyntax.JSXSpreadAttribute,this.argument=e};t.JSXText=function(e,t){this.type=n.JSXSyntax.JSXText,this.value=e,this.raw=t}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JSXSyntax={JSXAttribute:"JSXAttribute",JSXClosingElement:"JSXClosingElement",JSXElement:"JSXElement",JSXEmptyExpression:"JSXEmptyExpression",JSXExpressionContainer:"JSXExpressionContainer",JSXIdentifier:"JSXIdentifier",JSXMemberExpression:"JSXMemberExpression",JSXNamespacedName:"JSXNamespacedName",JSXOpeningElement:"JSXOpeningElement",JSXSpreadAttribute:"JSXSpreadAttribute",JSXText:"JSXText"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(2);t.ArrayExpression=function(e){this.type=n.Syntax.ArrayExpression,this.elements=e};t.ArrayPattern=function(e){this.type=n.Syntax.ArrayPattern,this.elements=e};t.ArrowFunctionExpression=function(e,t,r){this.type=n.Syntax.ArrowFunctionExpression,this.id=null,this.params=e,this.body=t,this.generator=!1,this.expression=r,this.async=!1};t.AssignmentExpression=function(e,t,r){this.type=n.Syntax.AssignmentExpression,this.operator=e,this.left=t,this.right=r};t.AssignmentPattern=function(e,t){this.type=n.Syntax.AssignmentPattern,this.left=e,this.right=t};t.AsyncArrowFunctionExpression=function(e,t,r){this.type=n.Syntax.ArrowFunctionExpression,this.id=null,this.params=e,this.body=t,this.generator=!1,this.expression=r,this.async=!0};t.AsyncFunctionDeclaration=function(e,t,r){this.type=n.Syntax.FunctionDeclaration,this.id=e,this.params=t,this.body=r,this.generator=!1,this.expression=!1,this.async=!0};t.AsyncFunctionExpression=function(e,t,r){this.type=n.Syntax.FunctionExpression,this.id=e,this.params=t,this.body=r,this.generator=!1,this.expression=!1,this.async=!0};t.AwaitExpression=function(e){this.type=n.Syntax.AwaitExpression,this.argument=e};t.BinaryExpression=function(e,t,r){var o="||"===e||"&&"===e;this.type=o?n.Syntax.LogicalExpression:n.Syntax.BinaryExpression,this.operator=e,this.left=t,this.right=r};t.BlockStatement=function(e){this.type=n.Syntax.BlockStatement,this.body=e};t.BreakStatement=function(e){this.type=n.Syntax.BreakStatement,this.label=e};t.CallExpression=function(e,t){this.type=n.Syntax.CallExpression,this.callee=e,this.arguments=t};t.CatchClause=function(e,t){this.type=n.Syntax.CatchClause,this.param=e,this.body=t};t.ClassBody=function(e){this.type=n.Syntax.ClassBody,this.body=e};t.ClassDeclaration=function(e,t,r){this.type=n.Syntax.ClassDeclaration,this.id=e,this.superClass=t,this.body=r};t.ClassExpression=function(e,t,r){this.type=n.Syntax.ClassExpression,this.id=e,this.superClass=t,this.body=r};t.ComputedMemberExpression=function(e,t){this.type=n.Syntax.MemberExpression,this.computed=!0,this.object=e,this.property=t};t.ConditionalExpression=function(e,t,r){this.type=n.Syntax.ConditionalExpression,this.test=e,this.consequent=t,this.alternate=r};t.ContinueStatement=function(e){this.type=n.Syntax.ContinueStatement,this.label=e};t.DebuggerStatement=function(){this.type=n.Syntax.DebuggerStatement};t.Directive=function(e,t){this.type=n.Syntax.ExpressionStatement,this.expression=e,this.directive=t};t.DoWhileStatement=function(e,t){this.type=n.Syntax.DoWhileStatement,this.body=e,this.test=t};t.EmptyStatement=function(){this.type=n.Syntax.EmptyStatement};t.ExportAllDeclaration=function(e){this.type=n.Syntax.ExportAllDeclaration,this.source=e};t.ExportDefaultDeclaration=function(e){this.type=n.Syntax.ExportDefaultDeclaration,this.declaration=e};t.ExportNamedDeclaration=function(e,t,r){this.type=n.Syntax.ExportNamedDeclaration,this.declaration=e,this.specifiers=t,this.source=r};t.ExportSpecifier=function(e,t){this.type=n.Syntax.ExportSpecifier,this.exported=t,this.local=e};t.ExpressionStatement=function(e){this.type=n.Syntax.ExpressionStatement,this.expression=e};t.ForInStatement=function(e,t,r){this.type=n.Syntax.ForInStatement,this.left=e,this.right=t,this.body=r,this.each=!1};t.ForOfStatement=function(e,t,r){this.type=n.Syntax.ForOfStatement,this.left=e,this.right=t,this.body=r};t.ForStatement=function(e,t,r,o){this.type=n.Syntax.ForStatement,this.init=e,this.test=t,this.update=r,this.body=o};t.FunctionDeclaration=function(e,t,r,o){this.type=n.Syntax.FunctionDeclaration,this.id=e,this.params=t,this.body=r,this.generator=o,this.expression=!1,this.async=!1};t.FunctionExpression=function(e,t,r,o){this.type=n.Syntax.FunctionExpression,this.id=e,this.params=t,this.body=r,this.generator=o,this.expression=!1,this.async=!1};t.Identifier=function(e){this.type=n.Syntax.Identifier,this.name=e};t.IfStatement=function(e,t,r){this.type=n.Syntax.IfStatement,this.test=e,this.consequent=t,this.alternate=r};t.ImportDeclaration=function(e,t){this.type=n.Syntax.ImportDeclaration,this.specifiers=e,this.source=t};t.ImportDefaultSpecifier=function(e){this.type=n.Syntax.ImportDefaultSpecifier,this.local=e};t.ImportNamespaceSpecifier=function(e){this.type=n.Syntax.ImportNamespaceSpecifier,this.local=e};t.ImportSpecifier=function(e,t){this.type=n.Syntax.ImportSpecifier,this.local=e,this.imported=t};t.LabeledStatement=function(e,t){this.type=n.Syntax.LabeledStatement,this.label=e,this.body=t};t.Literal=function(e,t){this.type=n.Syntax.Literal,this.value=e,this.raw=t};t.MetaProperty=function(e,t){this.type=n.Syntax.MetaProperty,this.meta=e,this.property=t};t.MethodDefinition=function(e,t,r,o,i){this.type=n.Syntax.MethodDefinition,this.key=e,this.computed=t,this.value=r,this.kind=o,this.static=i};t.Module=function(e){this.type=n.Syntax.Program,this.body=e,this.sourceType="module"};t.NewExpression=function(e,t){this.type=n.Syntax.NewExpression,this.callee=e,this.arguments=t};t.ObjectExpression=function(e){this.type=n.Syntax.ObjectExpression,this.properties=e};t.ObjectPattern=function(e){this.type=n.Syntax.ObjectPattern,this.properties=e};t.Property=function(e,t,r,o,i,a){this.type=n.Syntax.Property,this.key=t,this.computed=r,this.value=o,this.kind=e,this.method=i,this.shorthand=a};t.RegexLiteral=function(e,t,r,o){this.type=n.Syntax.Literal,this.value=e,this.raw=t,this.regex={pattern:r,flags:o}};t.RestElement=function(e){this.type=n.Syntax.RestElement,this.argument=e};t.ReturnStatement=function(e){this.type=n.Syntax.ReturnStatement,this.argument=e};t.Script=function(e){this.type=n.Syntax.Program,this.body=e,this.sourceType="script"};t.SequenceExpression=function(e){this.type=n.Syntax.SequenceExpression,this.expressions=e};t.SpreadElement=function(e){this.type=n.Syntax.SpreadElement,this.argument=e};t.StaticMemberExpression=function(e,t){this.type=n.Syntax.MemberExpression,this.computed=!1,this.object=e,this.property=t};t.Super=function(){this.type=n.Syntax.Super};t.SwitchCase=function(e,t){this.type=n.Syntax.SwitchCase,this.test=e,this.consequent=t};t.SwitchStatement=function(e,t){this.type=n.Syntax.SwitchStatement,this.discriminant=e,this.cases=t};t.TaggedTemplateExpression=function(e,t){this.type=n.Syntax.TaggedTemplateExpression,this.tag=e,this.quasi=t};t.TemplateElement=function(e,t){this.type=n.Syntax.TemplateElement,this.value=e,this.tail=t};t.TemplateLiteral=function(e,t){this.type=n.Syntax.TemplateLiteral,this.quasis=e,this.expressions=t};t.ThisExpression=function(){this.type=n.Syntax.ThisExpression};t.ThrowStatement=function(e){this.type=n.Syntax.ThrowStatement,this.argument=e};t.TryStatement=function(e,t,r){this.type=n.Syntax.TryStatement,this.block=e,this.handler=t,this.finalizer=r};t.UnaryExpression=function(e,t){this.type=n.Syntax.UnaryExpression,this.operator=e,this.argument=t,this.prefix=!0};t.UpdateExpression=function(e,t,r){this.type=n.Syntax.UpdateExpression,this.operator=e,this.argument=t,this.prefix=r};t.VariableDeclaration=function(e,t){this.type=n.Syntax.VariableDeclaration,this.declarations=e,this.kind=t};t.VariableDeclarator=function(e,t){this.type=n.Syntax.VariableDeclarator,this.id=e,this.init=t};t.WhileStatement=function(e,t){this.type=n.Syntax.WhileStatement,this.test=e,this.body=t};t.WithStatement=function(e,t){this.type=n.Syntax.WithStatement,this.object=e,this.body=t};t.YieldExpression=function(e,t){this.type=n.Syntax.YieldExpression,this.argument=e,this.delegate=t}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(9),o=r(10),i=r(11),a=r(7),s=r(12),l=r(2),u=r(13),c=function(){function e(e,t,r){void 0===t&&(t={}),this.config={range:"boolean"==typeof t.range&&t.range,loc:"boolean"==typeof t.loc&&t.loc,source:null,tokens:"boolean"==typeof t.tokens&&t.tokens,comment:"boolean"==typeof t.comment&&t.comment,tolerant:"boolean"==typeof t.tolerant&&t.tolerant},this.config.loc&&t.source&&null!==t.source&&(this.config.source=String(t.source)),this.delegate=r,this.errorHandler=new o.ErrorHandler,this.errorHandler.tolerant=this.config.tolerant,this.scanner=new s.Scanner(e,this.errorHandler),this.scanner.trackComment=this.config.comment,this.operatorPrecedence={")":0,";":0,",":0,"=":0,"]":0,"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":11,"/":11,"%":11},this.lookahead={type:2,value:"",lineNumber:this.scanner.lineNumber,lineStart:0,start:0,end:0},this.hasLineTerminator=!1,this.context={isModule:!1,await:!1,allowIn:!0,allowStrictDirective:!0,allowYield:!0,firstCoverInitializedNameError:null,isAssignmentTarget:!1,isBindingElement:!1,inFunctionBody:!1,inIteration:!1,inSwitch:!1,labelSet:{},strict:!1},this.tokens=[],this.startMarker={index:0,line:this.scanner.lineNumber,column:0},this.lastMarker={index:0,line:this.scanner.lineNumber,column:0},this.nextToken(),this.lastMarker={index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}}return e.prototype.throwError=function(e){for(var t=[],r=1;r0&&this.delegate)for(var t=0;t>="===e||">>>="===e||"&="===e||"^="===e||"|="===e},e.prototype.isolateCoverGrammar=function(e){var t=this.context.isBindingElement,r=this.context.isAssignmentTarget,n=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;var o=e.call(this);return null!==this.context.firstCoverInitializedNameError&&this.throwUnexpectedToken(this.context.firstCoverInitializedNameError),this.context.isBindingElement=t,this.context.isAssignmentTarget=r,this.context.firstCoverInitializedNameError=n,o},e.prototype.inheritCoverGrammar=function(e){var t=this.context.isBindingElement,r=this.context.isAssignmentTarget,n=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;var o=e.call(this);return this.context.isBindingElement=this.context.isBindingElement&&t,this.context.isAssignmentTarget=this.context.isAssignmentTarget&&r,this.context.firstCoverInitializedNameError=n||this.context.firstCoverInitializedNameError,o},e.prototype.consumeSemicolon=function(){this.match(";")?this.nextToken():this.hasLineTerminator||(2===this.lookahead.type||this.match("}")||this.throwUnexpectedToken(this.lookahead),this.lastMarker.index=this.startMarker.index,this.lastMarker.line=this.startMarker.line,this.lastMarker.column=this.startMarker.column)},e.prototype.parsePrimaryExpression=function(){var e,t,r,n=this.createNode();switch(this.lookahead.type){case 3:(this.context.isModule||this.context.await)&&"await"===this.lookahead.value&&this.tolerateUnexpectedToken(this.lookahead),e=this.matchAsyncFunction()?this.parseFunctionExpression():this.finalize(n,new a.Identifier(this.nextToken().value));break;case 6:case 8:this.context.strict&&this.lookahead.octal&&this.tolerateUnexpectedToken(this.lookahead,i.Messages.StrictOctalLiteral),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,t=this.nextToken(),r=this.getTokenRaw(t),e=this.finalize(n,new a.Literal(t.value,r));break;case 1:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,t=this.nextToken(),r=this.getTokenRaw(t),e=this.finalize(n,new a.Literal("true"===t.value,r));break;case 5:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,t=this.nextToken(),r=this.getTokenRaw(t),e=this.finalize(n,new a.Literal(null,r));break;case 10:e=this.parseTemplateLiteral();break;case 7:switch(this.lookahead.value){case"(":this.context.isBindingElement=!1,e=this.inheritCoverGrammar(this.parseGroupExpression);break;case"[":e=this.inheritCoverGrammar(this.parseArrayInitializer);break;case"{":e=this.inheritCoverGrammar(this.parseObjectInitializer);break;case"/":case"/=":this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.scanner.index=this.startMarker.index,t=this.nextRegexToken(),r=this.getTokenRaw(t),e=this.finalize(n,new a.RegexLiteral(t.regex,r,t.pattern,t.flags));break;default:e=this.throwUnexpectedToken(this.nextToken())}break;case 4:!this.context.strict&&this.context.allowYield&&this.matchKeyword("yield")?e=this.parseIdentifierName():!this.context.strict&&this.matchKeyword("let")?e=this.finalize(n,new a.Identifier(this.nextToken().value)):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.matchKeyword("function")?e=this.parseFunctionExpression():this.matchKeyword("this")?(this.nextToken(),e=this.finalize(n,new a.ThisExpression)):e=this.matchKeyword("class")?this.parseClassExpression():this.throwUnexpectedToken(this.nextToken()));break;default:e=this.throwUnexpectedToken(this.nextToken())}return e},e.prototype.parseSpreadElement=function(){var e=this.createNode();this.expect("...");var t=this.inheritCoverGrammar(this.parseAssignmentExpression);return this.finalize(e,new a.SpreadElement(t))},e.prototype.parseArrayInitializer=function(){var e=this.createNode(),t=[];for(this.expect("[");!this.match("]");)if(this.match(","))this.nextToken(),t.push(null);else if(this.match("...")){var r=this.parseSpreadElement();this.match("]")||(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.expect(",")),t.push(r)}else t.push(this.inheritCoverGrammar(this.parseAssignmentExpression)),this.match("]")||this.expect(",");return this.expect("]"),this.finalize(e,new a.ArrayExpression(t))},e.prototype.parsePropertyMethod=function(e){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var t=this.context.strict,r=this.context.allowStrictDirective;this.context.allowStrictDirective=e.simple;var n=this.isolateCoverGrammar(this.parseFunctionSourceElements);return this.context.strict&&e.firstRestricted&&this.tolerateUnexpectedToken(e.firstRestricted,e.message),this.context.strict&&e.stricted&&this.tolerateUnexpectedToken(e.stricted,e.message),this.context.strict=t,this.context.allowStrictDirective=r,n},e.prototype.parsePropertyMethodFunction=function(){var e=this.createNode(),t=this.context.allowYield;this.context.allowYield=!0;var r=this.parseFormalParameters(),n=this.parsePropertyMethod(r);return this.context.allowYield=t,this.finalize(e,new a.FunctionExpression(null,r.params,n,!1))},e.prototype.parsePropertyMethodAsyncFunction=function(){var e=this.createNode(),t=this.context.allowYield,r=this.context.await;this.context.allowYield=!1,this.context.await=!0;var n=this.parseFormalParameters(),o=this.parsePropertyMethod(n);return this.context.allowYield=t,this.context.await=r,this.finalize(e,new a.AsyncFunctionExpression(null,n.params,o))},e.prototype.parseObjectPropertyKey=function(){var e,t=this.createNode(),r=this.nextToken();switch(r.type){case 8:case 6:this.context.strict&&r.octal&&this.tolerateUnexpectedToken(r,i.Messages.StrictOctalLiteral);var n=this.getTokenRaw(r);e=this.finalize(t,new a.Literal(r.value,n));break;case 3:case 1:case 5:case 4:e=this.finalize(t,new a.Identifier(r.value));break;case 7:"["===r.value?(e=this.isolateCoverGrammar(this.parseAssignmentExpression),this.expect("]")):e=this.throwUnexpectedToken(r);break;default:e=this.throwUnexpectedToken(r)}return e},e.prototype.isPropertyKey=function(e,t){return e.type===l.Syntax.Identifier&&e.name===t||e.type===l.Syntax.Literal&&e.value===t},e.prototype.parseObjectProperty=function(e){var t,r=this.createNode(),n=this.lookahead,o=null,s=null,l=!1,u=!1,c=!1,d=!1;if(3===n.type){var p=n.value;this.nextToken(),l=this.match("["),o=(d=!(this.hasLineTerminator||"async"!==p||this.match(":")||this.match("(")||this.match("*")||this.match(",")))?this.parseObjectPropertyKey():this.finalize(r,new a.Identifier(p))}else this.match("*")?this.nextToken():(l=this.match("["),o=this.parseObjectPropertyKey());var f=this.qualifiedPropertyName(this.lookahead);if(3===n.type&&!d&&"get"===n.value&&f)t="get",l=this.match("["),o=this.parseObjectPropertyKey(),this.context.allowYield=!1,s=this.parseGetterMethod();else if(3===n.type&&!d&&"set"===n.value&&f)t="set",l=this.match("["),o=this.parseObjectPropertyKey(),s=this.parseSetterMethod();else if(7===n.type&&"*"===n.value&&f)t="init",l=this.match("["),o=this.parseObjectPropertyKey(),s=this.parseGeneratorMethod(),u=!0;else if(o||this.throwUnexpectedToken(this.lookahead),t="init",this.match(":")&&!d)!l&&this.isPropertyKey(o,"__proto__")&&(e.value&&this.tolerateError(i.Messages.DuplicateProtoProperty),e.value=!0),this.nextToken(),s=this.inheritCoverGrammar(this.parseAssignmentExpression);else if(this.match("("))s=d?this.parsePropertyMethodAsyncFunction():this.parsePropertyMethodFunction(),u=!0;else if(3===n.type)if(p=this.finalize(r,new a.Identifier(n.value)),this.match("=")){this.context.firstCoverInitializedNameError=this.lookahead,this.nextToken(),c=!0;var h=this.isolateCoverGrammar(this.parseAssignmentExpression);s=this.finalize(r,new a.AssignmentPattern(p,h))}else c=!0,s=p;else this.throwUnexpectedToken(this.nextToken());return this.finalize(r,new a.Property(t,o,l,s,u,c))},e.prototype.parseObjectInitializer=function(){var e=this.createNode();this.expect("{");for(var t=[],r={value:!1};!this.match("}");)t.push(this.parseObjectProperty(r)),this.match("}")||this.expectCommaSeparator();return this.expect("}"),this.finalize(e,new a.ObjectExpression(t))},e.prototype.parseTemplateHead=function(){n.assert(this.lookahead.head,"Template literal must start with a template head");var e=this.createNode(),t=this.nextToken(),r=t.value,o=t.cooked;return this.finalize(e,new a.TemplateElement({raw:r,cooked:o},t.tail))},e.prototype.parseTemplateElement=function(){10!==this.lookahead.type&&this.throwUnexpectedToken();var e=this.createNode(),t=this.nextToken(),r=t.value,n=t.cooked;return this.finalize(e,new a.TemplateElement({raw:r,cooked:n},t.tail))},e.prototype.parseTemplateLiteral=function(){var e=this.createNode(),t=[],r=[],n=this.parseTemplateHead();for(r.push(n);!n.tail;)t.push(this.parseExpression()),n=this.parseTemplateElement(),r.push(n);return this.finalize(e,new a.TemplateLiteral(r,t))},e.prototype.reinterpretExpressionAsPattern=function(e){switch(e.type){case l.Syntax.Identifier:case l.Syntax.MemberExpression:case l.Syntax.RestElement:case l.Syntax.AssignmentPattern:break;case l.Syntax.SpreadElement:e.type=l.Syntax.RestElement,this.reinterpretExpressionAsPattern(e.argument);break;case l.Syntax.ArrayExpression:e.type=l.Syntax.ArrayPattern;for(var t=0;t")||this.expect("=>"),e={type:"ArrowParameterPlaceHolder",params:[],async:!1};else{var t=this.lookahead,r=[];if(this.match("..."))e=this.parseRestElement(r),this.expect(")"),this.match("=>")||this.expect("=>"),e={type:"ArrowParameterPlaceHolder",params:[e],async:!1};else{var n=!1;if(this.context.isBindingElement=!0,e=this.inheritCoverGrammar(this.parseAssignmentExpression),this.match(",")){var o=[];for(this.context.isAssignmentTarget=!1,o.push(e);2!==this.lookahead.type&&this.match(",");){if(this.nextToken(),this.match(")")){this.nextToken();for(var i=0;i")||this.expect("=>"),this.context.isBindingElement=!1,i=0;i")&&(e.type===l.Syntax.Identifier&&"yield"===e.name&&(n=!0,e={type:"ArrowParameterPlaceHolder",params:[e],async:!1}),!n)){if(this.context.isBindingElement||this.throwUnexpectedToken(this.lookahead),e.type===l.Syntax.SequenceExpression)for(i=0;i")){for(var l=0;l0){this.nextToken(),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;for(var o=[e,this.lookahead],i=t,s=this.isolateCoverGrammar(this.parseExponentiationExpression),l=[i,r.value,s],u=[n];!((n=this.binaryPrecedence(this.lookahead))<=0);){for(;l.length>2&&n<=u[u.length-1];){s=l.pop();var c=l.pop();u.pop(),i=l.pop(),o.pop();var d=this.startNode(o[o.length-1]);l.push(this.finalize(d,new a.BinaryExpression(c,i,s)))}l.push(this.nextToken().value),u.push(n),o.push(this.lookahead),l.push(this.isolateCoverGrammar(this.parseExponentiationExpression))}var p=l.length-1;t=l[p];for(var f=o.pop();p>1;){var h=o.pop(),m=f&&f.lineStart;d=this.startNode(h,m),c=l[p-1],t=this.finalize(d,new a.BinaryExpression(c,l[p-2],t)),p-=2,f=h}}return t},e.prototype.parseConditionalExpression=function(){var e=this.lookahead,t=this.inheritCoverGrammar(this.parseBinaryExpression);if(this.match("?")){this.nextToken();var r=this.context.allowIn;this.context.allowIn=!0;var n=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowIn=r,this.expect(":");var o=this.isolateCoverGrammar(this.parseAssignmentExpression);t=this.finalize(this.startNode(e),new a.ConditionalExpression(t,n,o)),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}return t},e.prototype.checkPatternParam=function(e,t){switch(t.type){case l.Syntax.Identifier:this.validateParam(e,t,t.name);break;case l.Syntax.RestElement:this.checkPatternParam(e,t.argument);break;case l.Syntax.AssignmentPattern:this.checkPatternParam(e,t.left);break;case l.Syntax.ArrayPattern:for(var r=0;r")){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var o=e.async,s=this.reinterpretAsCoverFormalsList(e);if(s){this.hasLineTerminator&&this.tolerateUnexpectedToken(this.lookahead),this.context.firstCoverInitializedNameError=null;var u=this.context.strict,c=this.context.allowStrictDirective;this.context.allowStrictDirective=s.simple;var d=this.context.allowYield,p=this.context.await;this.context.allowYield=!0,this.context.await=o;var f=this.startNode(t);this.expect("=>");var h=void 0;if(this.match("{")){var m=this.context.allowIn;this.context.allowIn=!0,h=this.parseFunctionSourceElements(),this.context.allowIn=m}else h=this.isolateCoverGrammar(this.parseAssignmentExpression);var g=h.type!==l.Syntax.BlockStatement;this.context.strict&&s.firstRestricted&&this.throwUnexpectedToken(s.firstRestricted,s.message),this.context.strict&&s.stricted&&this.tolerateUnexpectedToken(s.stricted,s.message),e=o?this.finalize(f,new a.AsyncArrowFunctionExpression(s.params,h,g)):this.finalize(f,new a.ArrowFunctionExpression(s.params,h,g)),this.context.strict=u,this.context.allowStrictDirective=c,this.context.allowYield=d,this.context.await=p}}else if(this.matchAssign()){if(this.context.isAssignmentTarget||this.tolerateError(i.Messages.InvalidLHSInAssignment),this.context.strict&&e.type===l.Syntax.Identifier){var y=e;this.scanner.isRestrictedWord(y.name)&&this.tolerateUnexpectedToken(r,i.Messages.StrictLHSAssignment),this.scanner.isStrictModeReservedWord(y.name)&&this.tolerateUnexpectedToken(r,i.Messages.StrictReservedWord)}this.match("=")?this.reinterpretExpressionAsPattern(e):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1);var v=(r=this.nextToken()).value,b=this.isolateCoverGrammar(this.parseAssignmentExpression);e=this.finalize(this.startNode(t),new a.AssignmentExpression(v,e,b)),this.context.firstCoverInitializedNameError=null}}return e},e.prototype.parseExpression=function(){var e=this.lookahead,t=this.isolateCoverGrammar(this.parseAssignmentExpression);if(this.match(",")){var r=[];for(r.push(t);2!==this.lookahead.type&&this.match(",");)this.nextToken(),r.push(this.isolateCoverGrammar(this.parseAssignmentExpression));t=this.finalize(this.startNode(e),new a.SequenceExpression(r))}return t},e.prototype.parseStatementListItem=function(){var e;if(this.context.isAssignmentTarget=!0,this.context.isBindingElement=!0,4===this.lookahead.type)switch(this.lookahead.value){case"export":this.context.isModule||this.tolerateUnexpectedToken(this.lookahead,i.Messages.IllegalExportDeclaration),e=this.parseExportDeclaration();break;case"import":this.context.isModule||this.tolerateUnexpectedToken(this.lookahead,i.Messages.IllegalImportDeclaration),e=this.parseImportDeclaration();break;case"const":e=this.parseLexicalDeclaration({inFor:!1});break;case"function":e=this.parseFunctionDeclaration();break;case"class":e=this.parseClassDeclaration();break;case"let":e=this.isLexicalDeclaration()?this.parseLexicalDeclaration({inFor:!1}):this.parseStatement();break;default:e=this.parseStatement()}else e=this.parseStatement();return e},e.prototype.parseBlock=function(){var e=this.createNode();this.expect("{");for(var t=[];!this.match("}");)t.push(this.parseStatementListItem());return this.expect("}"),this.finalize(e,new a.BlockStatement(t))},e.prototype.parseLexicalBinding=function(e,t){var r=this.createNode(),n=this.parsePattern([],e);this.context.strict&&n.type===l.Syntax.Identifier&&this.scanner.isRestrictedWord(n.name)&&this.tolerateError(i.Messages.StrictVarName);var o=null;return"const"===e?this.matchKeyword("in")||this.matchContextualKeyword("of")||(this.match("=")?(this.nextToken(),o=this.isolateCoverGrammar(this.parseAssignmentExpression)):this.throwError(i.Messages.DeclarationMissingInitializer,"const")):(!t.inFor&&n.type!==l.Syntax.Identifier||this.match("="))&&(this.expect("="),o=this.isolateCoverGrammar(this.parseAssignmentExpression)),this.finalize(r,new a.VariableDeclarator(n,o))},e.prototype.parseBindingList=function(e,t){for(var r=[this.parseLexicalBinding(e,t)];this.match(",");)this.nextToken(),r.push(this.parseLexicalBinding(e,t));return r},e.prototype.isLexicalDeclaration=function(){var e=this.scanner.saveState();this.scanner.scanComments();var t=this.scanner.lex();return this.scanner.restoreState(e),3===t.type||7===t.type&&"["===t.value||7===t.type&&"{"===t.value||4===t.type&&"let"===t.value||4===t.type&&"yield"===t.value},e.prototype.parseLexicalDeclaration=function(e){var t=this.createNode(),r=this.nextToken().value;n.assert("let"===r||"const"===r,"Lexical declaration must be either let or const");var o=this.parseBindingList(r,e);return this.consumeSemicolon(),this.finalize(t,new a.VariableDeclaration(o,r))},e.prototype.parseBindingRestElement=function(e,t){var r=this.createNode();this.expect("...");var n=this.parsePattern(e,t);return this.finalize(r,new a.RestElement(n))},e.prototype.parseArrayPattern=function(e,t){var r=this.createNode();this.expect("[");for(var n=[];!this.match("]");)if(this.match(","))this.nextToken(),n.push(null);else{if(this.match("...")){n.push(this.parseBindingRestElement(e,t));break}n.push(this.parsePatternWithDefault(e,t)),this.match("]")||this.expect(",")}return this.expect("]"),this.finalize(r,new a.ArrayPattern(n))},e.prototype.parsePropertyPattern=function(e,t){var r,n,o=this.createNode(),i=!1,s=!1;if(3===this.lookahead.type){var l=this.lookahead;r=this.parseVariableIdentifier();var u=this.finalize(o,new a.Identifier(l.value));if(this.match("=")){e.push(l),s=!0,this.nextToken();var c=this.parseAssignmentExpression();n=this.finalize(this.startNode(l),new a.AssignmentPattern(u,c))}else this.match(":")?(this.expect(":"),n=this.parsePatternWithDefault(e,t)):(e.push(l),s=!0,n=u)}else i=this.match("["),r=this.parseObjectPropertyKey(),this.expect(":"),n=this.parsePatternWithDefault(e,t);return this.finalize(o,new a.Property("init",r,i,n,!1,s))},e.prototype.parseObjectPattern=function(e,t){var r=this.createNode(),n=[];for(this.expect("{");!this.match("}");)n.push(this.parsePropertyPattern(e,t)),this.match("}")||this.expect(",");return this.expect("}"),this.finalize(r,new a.ObjectPattern(n))},e.prototype.parsePattern=function(e,t){var r;return this.match("[")?r=this.parseArrayPattern(e,t):this.match("{")?r=this.parseObjectPattern(e,t):(!this.matchKeyword("let")||"const"!==t&&"let"!==t||this.tolerateUnexpectedToken(this.lookahead,i.Messages.LetInLexicalBinding),e.push(this.lookahead),r=this.parseVariableIdentifier(t)),r},e.prototype.parsePatternWithDefault=function(e,t){var r=this.lookahead,n=this.parsePattern(e,t);if(this.match("=")){this.nextToken();var o=this.context.allowYield;this.context.allowYield=!0;var i=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowYield=o,n=this.finalize(this.startNode(r),new a.AssignmentPattern(n,i))}return n},e.prototype.parseVariableIdentifier=function(e){var t=this.createNode(),r=this.nextToken();return 4===r.type&&"yield"===r.value?this.context.strict?this.tolerateUnexpectedToken(r,i.Messages.StrictReservedWord):this.context.allowYield||this.throwUnexpectedToken(r):3!==r.type?this.context.strict&&4===r.type&&this.scanner.isStrictModeReservedWord(r.value)?this.tolerateUnexpectedToken(r,i.Messages.StrictReservedWord):(this.context.strict||"let"!==r.value||"var"!==e)&&this.throwUnexpectedToken(r):(this.context.isModule||this.context.await)&&3===r.type&&"await"===r.value&&this.tolerateUnexpectedToken(r),this.finalize(t,new a.Identifier(r.value))},e.prototype.parseVariableDeclaration=function(e){var t=this.createNode(),r=this.parsePattern([],"var");this.context.strict&&r.type===l.Syntax.Identifier&&this.scanner.isRestrictedWord(r.name)&&this.tolerateError(i.Messages.StrictVarName);var n=null;return this.match("=")?(this.nextToken(),n=this.isolateCoverGrammar(this.parseAssignmentExpression)):r.type===l.Syntax.Identifier||e.inFor||this.expect("="),this.finalize(t,new a.VariableDeclarator(r,n))},e.prototype.parseVariableDeclarationList=function(e){var t={inFor:e.inFor},r=[];for(r.push(this.parseVariableDeclaration(t));this.match(",");)this.nextToken(),r.push(this.parseVariableDeclaration(t));return r},e.prototype.parseVariableStatement=function(){var e=this.createNode();this.expectKeyword("var");var t=this.parseVariableDeclarationList({inFor:!1});return this.consumeSemicolon(),this.finalize(e,new a.VariableDeclaration(t,"var"))},e.prototype.parseEmptyStatement=function(){var e=this.createNode();return this.expect(";"),this.finalize(e,new a.EmptyStatement)},e.prototype.parseExpressionStatement=function(){var e=this.createNode(),t=this.parseExpression();return this.consumeSemicolon(),this.finalize(e,new a.ExpressionStatement(t))},e.prototype.parseIfClause=function(){return this.context.strict&&this.matchKeyword("function")&&this.tolerateError(i.Messages.StrictFunction),this.parseStatement()},e.prototype.parseIfStatement=function(){var e,t=this.createNode(),r=null;this.expectKeyword("if"),this.expect("(");var n=this.parseExpression();return!this.match(")")&&this.config.tolerant?(this.tolerateUnexpectedToken(this.nextToken()),e=this.finalize(this.createNode(),new a.EmptyStatement)):(this.expect(")"),e=this.parseIfClause(),this.matchKeyword("else")&&(this.nextToken(),r=this.parseIfClause())),this.finalize(t,new a.IfStatement(n,e,r))},e.prototype.parseDoWhileStatement=function(){var e=this.createNode();this.expectKeyword("do");var t=this.context.inIteration;this.context.inIteration=!0;var r=this.parseStatement();this.context.inIteration=t,this.expectKeyword("while"),this.expect("(");var n=this.parseExpression();return!this.match(")")&&this.config.tolerant?this.tolerateUnexpectedToken(this.nextToken()):(this.expect(")"),this.match(";")&&this.nextToken()),this.finalize(e,new a.DoWhileStatement(r,n))},e.prototype.parseWhileStatement=function(){var e,t=this.createNode();this.expectKeyword("while"),this.expect("(");var r=this.parseExpression();if(!this.match(")")&&this.config.tolerant)this.tolerateUnexpectedToken(this.nextToken()),e=this.finalize(this.createNode(),new a.EmptyStatement);else{this.expect(")");var n=this.context.inIteration;this.context.inIteration=!0,e=this.parseStatement(),this.context.inIteration=n}return this.finalize(t,new a.WhileStatement(r,e))},e.prototype.parseForStatement=function(){var e,t,r,n=null,o=null,s=null,u=!0,c=this.createNode();if(this.expectKeyword("for"),this.expect("("),this.match(";"))this.nextToken();else if(this.matchKeyword("var")){n=this.createNode(),this.nextToken();var d=this.context.allowIn;this.context.allowIn=!1;var p=this.parseVariableDeclarationList({inFor:!0});if(this.context.allowIn=d,1===p.length&&this.matchKeyword("in")){var f=p[0];f.init&&(f.id.type===l.Syntax.ArrayPattern||f.id.type===l.Syntax.ObjectPattern||this.context.strict)&&this.tolerateError(i.Messages.ForInOfLoopInitializer,"for-in"),n=this.finalize(n,new a.VariableDeclaration(p,"var")),this.nextToken(),e=n,t=this.parseExpression(),n=null}else 1===p.length&&null===p[0].init&&this.matchContextualKeyword("of")?(n=this.finalize(n,new a.VariableDeclaration(p,"var")),this.nextToken(),e=n,t=this.parseAssignmentExpression(),n=null,u=!1):(n=this.finalize(n,new a.VariableDeclaration(p,"var")),this.expect(";"))}else if(this.matchKeyword("const")||this.matchKeyword("let")){n=this.createNode();var h=this.nextToken().value;this.context.strict||"in"!==this.lookahead.value?(d=this.context.allowIn,this.context.allowIn=!1,p=this.parseBindingList(h,{inFor:!0}),this.context.allowIn=d,1===p.length&&null===p[0].init&&this.matchKeyword("in")?(n=this.finalize(n,new a.VariableDeclaration(p,h)),this.nextToken(),e=n,t=this.parseExpression(),n=null):1===p.length&&null===p[0].init&&this.matchContextualKeyword("of")?(n=this.finalize(n,new a.VariableDeclaration(p,h)),this.nextToken(),e=n,t=this.parseAssignmentExpression(),n=null,u=!1):(this.consumeSemicolon(),n=this.finalize(n,new a.VariableDeclaration(p,h)))):(n=this.finalize(n,new a.Identifier(h)),this.nextToken(),e=n,t=this.parseExpression(),n=null)}else{var m=this.lookahead;if(d=this.context.allowIn,this.context.allowIn=!1,n=this.inheritCoverGrammar(this.parseAssignmentExpression),this.context.allowIn=d,this.matchKeyword("in"))this.context.isAssignmentTarget&&n.type!==l.Syntax.AssignmentExpression||this.tolerateError(i.Messages.InvalidLHSInForIn),this.nextToken(),this.reinterpretExpressionAsPattern(n),e=n,t=this.parseExpression(),n=null;else if(this.matchContextualKeyword("of"))this.context.isAssignmentTarget&&n.type!==l.Syntax.AssignmentExpression||this.tolerateError(i.Messages.InvalidLHSInForLoop),this.nextToken(),this.reinterpretExpressionAsPattern(n),e=n,t=this.parseAssignmentExpression(),n=null,u=!1;else{if(this.match(",")){for(var g=[n];this.match(",");)this.nextToken(),g.push(this.isolateCoverGrammar(this.parseAssignmentExpression));n=this.finalize(this.startNode(m),new a.SequenceExpression(g))}this.expect(";")}}if(void 0===e&&(this.match(";")||(o=this.parseExpression()),this.expect(";"),this.match(")")||(s=this.parseExpression())),!this.match(")")&&this.config.tolerant)this.tolerateUnexpectedToken(this.nextToken()),r=this.finalize(this.createNode(),new a.EmptyStatement);else{this.expect(")");var y=this.context.inIteration;this.context.inIteration=!0,r=this.isolateCoverGrammar(this.parseStatement),this.context.inIteration=y}return void 0===e?this.finalize(c,new a.ForStatement(n,o,s,r)):u?this.finalize(c,new a.ForInStatement(e,t,r)):this.finalize(c,new a.ForOfStatement(e,t,r))},e.prototype.parseContinueStatement=function(){var e=this.createNode();this.expectKeyword("continue");var t=null;if(3===this.lookahead.type&&!this.hasLineTerminator){var r=this.parseVariableIdentifier();t=r;var n="$"+r.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,n)||this.throwError(i.Messages.UnknownLabel,r.name)}return this.consumeSemicolon(),null!==t||this.context.inIteration||this.throwError(i.Messages.IllegalContinue),this.finalize(e,new a.ContinueStatement(t))},e.prototype.parseBreakStatement=function(){var e=this.createNode();this.expectKeyword("break");var t=null;if(3===this.lookahead.type&&!this.hasLineTerminator){var r=this.parseVariableIdentifier(),n="$"+r.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,n)||this.throwError(i.Messages.UnknownLabel,r.name),t=r}return this.consumeSemicolon(),null!==t||this.context.inIteration||this.context.inSwitch||this.throwError(i.Messages.IllegalBreak),this.finalize(e,new a.BreakStatement(t))},e.prototype.parseReturnStatement=function(){this.context.inFunctionBody||this.tolerateError(i.Messages.IllegalReturn);var e=this.createNode();this.expectKeyword("return");var t=(this.match(";")||this.match("}")||this.hasLineTerminator||2===this.lookahead.type)&&8!==this.lookahead.type&&10!==this.lookahead.type?null:this.parseExpression();return this.consumeSemicolon(),this.finalize(e,new a.ReturnStatement(t))},e.prototype.parseWithStatement=function(){this.context.strict&&this.tolerateError(i.Messages.StrictModeWith);var e,t=this.createNode();this.expectKeyword("with"),this.expect("(");var r=this.parseExpression();return!this.match(")")&&this.config.tolerant?(this.tolerateUnexpectedToken(this.nextToken()),e=this.finalize(this.createNode(),new a.EmptyStatement)):(this.expect(")"),e=this.parseStatement()),this.finalize(t,new a.WithStatement(r,e))},e.prototype.parseSwitchCase=function(){var e,t=this.createNode();this.matchKeyword("default")?(this.nextToken(),e=null):(this.expectKeyword("case"),e=this.parseExpression()),this.expect(":");for(var r=[];!(this.match("}")||this.matchKeyword("default")||this.matchKeyword("case"));)r.push(this.parseStatementListItem());return this.finalize(t,new a.SwitchCase(e,r))},e.prototype.parseSwitchStatement=function(){var e=this.createNode();this.expectKeyword("switch"),this.expect("(");var t=this.parseExpression();this.expect(")");var r=this.context.inSwitch;this.context.inSwitch=!0;var n=[],o=!1;for(this.expect("{");!this.match("}");){var s=this.parseSwitchCase();null===s.test&&(o&&this.throwError(i.Messages.MultipleDefaultsInSwitch),o=!0),n.push(s)}return this.expect("}"),this.context.inSwitch=r,this.finalize(e,new a.SwitchStatement(t,n))},e.prototype.parseLabelledStatement=function(){var e,t=this.createNode(),r=this.parseExpression();if(r.type===l.Syntax.Identifier&&this.match(":")){this.nextToken();var n=r,o="$"+n.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,o)&&this.throwError(i.Messages.Redeclaration,"Label",n.name),this.context.labelSet[o]=!0;var s=void 0;if(this.matchKeyword("class"))this.tolerateUnexpectedToken(this.lookahead),s=this.parseClassDeclaration();else if(this.matchKeyword("function")){var u=this.lookahead,c=this.parseFunctionDeclaration();this.context.strict?this.tolerateUnexpectedToken(u,i.Messages.StrictFunction):c.generator&&this.tolerateUnexpectedToken(u,i.Messages.GeneratorInLegacyContext),s=c}else s=this.parseStatement();delete this.context.labelSet[o],e=new a.LabeledStatement(n,s)}else this.consumeSemicolon(),e=new a.ExpressionStatement(r);return this.finalize(t,e)},e.prototype.parseThrowStatement=function(){var e=this.createNode();this.expectKeyword("throw"),this.hasLineTerminator&&this.throwError(i.Messages.NewlineAfterThrow);var t=this.parseExpression();return this.consumeSemicolon(),this.finalize(e,new a.ThrowStatement(t))},e.prototype.parseCatchClause=function(){var e=this.createNode();this.expectKeyword("catch"),this.expect("("),this.match(")")&&this.throwUnexpectedToken(this.lookahead);for(var t=[],r=this.parsePattern(t),n={},o=0;o0&&this.tolerateError(i.Messages.BadGetterArity);var n=this.parsePropertyMethod(r);return this.context.allowYield=t,this.finalize(e,new a.FunctionExpression(null,r.params,n,!1))},e.prototype.parseSetterMethod=function(){var e=this.createNode(),t=this.context.allowYield;this.context.allowYield=!0;var r=this.parseFormalParameters();1!==r.params.length?this.tolerateError(i.Messages.BadSetterArity):r.params[0]instanceof a.RestElement&&this.tolerateError(i.Messages.BadSetterRestParameter);var n=this.parsePropertyMethod(r);return this.context.allowYield=t,this.finalize(e,new a.FunctionExpression(null,r.params,n,!1))},e.prototype.parseGeneratorMethod=function(){var e=this.createNode(),t=this.context.allowYield;this.context.allowYield=!0;var r=this.parseFormalParameters();this.context.allowYield=!1;var n=this.parsePropertyMethod(r);return this.context.allowYield=t,this.finalize(e,new a.FunctionExpression(null,r.params,n,!0))},e.prototype.isStartOfExpression=function(){var e=!0,t=this.lookahead.value;switch(this.lookahead.type){case 7:e="["===t||"("===t||"{"===t||"+"===t||"-"===t||"!"===t||"~"===t||"++"===t||"--"===t||"/"===t||"/="===t;break;case 4:e="class"===t||"delete"===t||"function"===t||"let"===t||"new"===t||"super"===t||"this"===t||"typeof"===t||"void"===t||"yield"===t}return e},e.prototype.parseYieldExpression=function(){var e=this.createNode();this.expectKeyword("yield");var t=null,r=!1;if(!this.hasLineTerminator){var n=this.context.allowYield;this.context.allowYield=!1,(r=this.match("*"))?(this.nextToken(),t=this.parseAssignmentExpression()):this.isStartOfExpression()&&(t=this.parseAssignmentExpression()),this.context.allowYield=n}return this.finalize(e,new a.YieldExpression(t,r))},e.prototype.parseClassElement=function(e){var t=this.lookahead,r=this.createNode(),n="",o=null,s=null,l=!1,u=!1,c=!1,d=!1;if(this.match("*"))this.nextToken();else if(l=this.match("["),"static"===(o=this.parseObjectPropertyKey()).name&&(this.qualifiedPropertyName(this.lookahead)||this.match("*"))&&(t=this.lookahead,c=!0,l=this.match("["),this.match("*")?this.nextToken():o=this.parseObjectPropertyKey()),3===t.type&&!this.hasLineTerminator&&"async"===t.value){var p=this.lookahead.value;":"!==p&&"("!==p&&"*"!==p&&(d=!0,t=this.lookahead,o=this.parseObjectPropertyKey(),3===t.type&&"constructor"===t.value&&this.tolerateUnexpectedToken(t,i.Messages.ConstructorIsAsync))}var f=this.qualifiedPropertyName(this.lookahead);return 3===t.type?"get"===t.value&&f?(n="get",l=this.match("["),o=this.parseObjectPropertyKey(),this.context.allowYield=!1,s=this.parseGetterMethod()):"set"===t.value&&f&&(n="set",l=this.match("["),o=this.parseObjectPropertyKey(),s=this.parseSetterMethod()):7===t.type&&"*"===t.value&&f&&(n="init",l=this.match("["),o=this.parseObjectPropertyKey(),s=this.parseGeneratorMethod(),u=!0),!n&&o&&this.match("(")&&(n="init",s=d?this.parsePropertyMethodAsyncFunction():this.parsePropertyMethodFunction(),u=!0),n||this.throwUnexpectedToken(this.lookahead),"init"===n&&(n="method"),l||(c&&this.isPropertyKey(o,"prototype")&&this.throwUnexpectedToken(t,i.Messages.StaticPrototype),!c&&this.isPropertyKey(o,"constructor")&&(("method"!==n||!u||s&&s.generator)&&this.throwUnexpectedToken(t,i.Messages.ConstructorSpecialMethod),e.value?this.throwUnexpectedToken(t,i.Messages.DuplicateConstructor):e.value=!0,n="constructor")),this.finalize(r,new a.MethodDefinition(o,l,s,n,c))},e.prototype.parseClassElementList=function(){var e=[],t={value:!1};for(this.expect("{");!this.match("}");)this.match(";")?this.nextToken():e.push(this.parseClassElement(t));return this.expect("}"),e},e.prototype.parseClassBody=function(){var e=this.createNode(),t=this.parseClassElementList();return this.finalize(e,new a.ClassBody(t))},e.prototype.parseClassDeclaration=function(e){var t=this.createNode(),r=this.context.strict;this.context.strict=!0,this.expectKeyword("class");var n=e&&3!==this.lookahead.type?null:this.parseVariableIdentifier(),o=null;this.matchKeyword("extends")&&(this.nextToken(),o=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall));var i=this.parseClassBody();return this.context.strict=r,this.finalize(t,new a.ClassDeclaration(n,o,i))},e.prototype.parseClassExpression=function(){var e=this.createNode(),t=this.context.strict;this.context.strict=!0,this.expectKeyword("class");var r=3===this.lookahead.type?this.parseVariableIdentifier():null,n=null;this.matchKeyword("extends")&&(this.nextToken(),n=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall));var o=this.parseClassBody();return this.context.strict=t,this.finalize(e,new a.ClassExpression(r,n,o))},e.prototype.parseModule=function(){this.context.strict=!0,this.context.isModule=!0,this.scanner.isModule=!0;for(var e=this.createNode(),t=this.parseDirectivePrologues();2!==this.lookahead.type;)t.push(this.parseStatementListItem());return this.finalize(e,new a.Module(t))},e.prototype.parseScript=function(){for(var e=this.createNode(),t=this.parseDirectivePrologues();2!==this.lookahead.type;)t.push(this.parseStatementListItem());return this.finalize(e,new a.Script(t))},e.prototype.parseModuleSpecifier=function(){var e=this.createNode();8!==this.lookahead.type&&this.throwError(i.Messages.InvalidModuleSpecifier);var t=this.nextToken(),r=this.getTokenRaw(t);return this.finalize(e,new a.Literal(t.value,r))},e.prototype.parseImportSpecifier=function(){var e,t,r=this.createNode();return 3===this.lookahead.type?(t=e=this.parseVariableIdentifier(),this.matchContextualKeyword("as")&&(this.nextToken(),t=this.parseVariableIdentifier())):(t=e=this.parseIdentifierName(),this.matchContextualKeyword("as")?(this.nextToken(),t=this.parseVariableIdentifier()):this.throwUnexpectedToken(this.nextToken())),this.finalize(r,new a.ImportSpecifier(t,e))},e.prototype.parseNamedImports=function(){this.expect("{");for(var e=[];!this.match("}");)e.push(this.parseImportSpecifier()),this.match("}")||this.expect(",");return this.expect("}"),e},e.prototype.parseImportDefaultSpecifier=function(){var e=this.createNode(),t=this.parseIdentifierName();return this.finalize(e,new a.ImportDefaultSpecifier(t))},e.prototype.parseImportNamespaceSpecifier=function(){var e=this.createNode();this.expect("*"),this.matchContextualKeyword("as")||this.throwError(i.Messages.NoAsAfterImportNamespace),this.nextToken();var t=this.parseIdentifierName();return this.finalize(e,new a.ImportNamespaceSpecifier(t))},e.prototype.parseImportDeclaration=function(){this.context.inFunctionBody&&this.throwError(i.Messages.IllegalImportDeclaration);var e,t=this.createNode();this.expectKeyword("import");var r=[];if(8===this.lookahead.type)e=this.parseModuleSpecifier();else{if(this.match("{")?r=r.concat(this.parseNamedImports()):this.match("*")?r.push(this.parseImportNamespaceSpecifier()):this.isIdentifierName(this.lookahead)&&!this.matchKeyword("default")?(r.push(this.parseImportDefaultSpecifier()),this.match(",")&&(this.nextToken(),this.match("*")?r.push(this.parseImportNamespaceSpecifier()):this.match("{")?r=r.concat(this.parseNamedImports()):this.throwUnexpectedToken(this.lookahead))):this.throwUnexpectedToken(this.nextToken()),!this.matchContextualKeyword("from")){var n=this.lookahead.value?i.Messages.UnexpectedToken:i.Messages.MissingFromClause;this.throwError(n,this.lookahead.value)}this.nextToken(),e=this.parseModuleSpecifier()}return this.consumeSemicolon(),this.finalize(t,new a.ImportDeclaration(r,e))},e.prototype.parseExportSpecifier=function(){var e=this.createNode(),t=this.parseIdentifierName(),r=t;return this.matchContextualKeyword("as")&&(this.nextToken(),r=this.parseIdentifierName()),this.finalize(e,new a.ExportSpecifier(t,r))},e.prototype.parseExportDeclaration=function(){this.context.inFunctionBody&&this.throwError(i.Messages.IllegalExportDeclaration);var e,t=this.createNode();if(this.expectKeyword("export"),this.matchKeyword("default"))if(this.nextToken(),this.matchKeyword("function")){var r=this.parseFunctionDeclaration(!0);e=this.finalize(t,new a.ExportDefaultDeclaration(r))}else this.matchKeyword("class")?(r=this.parseClassDeclaration(!0),e=this.finalize(t,new a.ExportDefaultDeclaration(r))):this.matchContextualKeyword("async")?(r=this.matchAsyncFunction()?this.parseFunctionDeclaration(!0):this.parseAssignmentExpression(),e=this.finalize(t,new a.ExportDefaultDeclaration(r))):(this.matchContextualKeyword("from")&&this.throwError(i.Messages.UnexpectedToken,this.lookahead.value),r=this.match("{")?this.parseObjectInitializer():this.match("[")?this.parseArrayInitializer():this.parseAssignmentExpression(),this.consumeSemicolon(),e=this.finalize(t,new a.ExportDefaultDeclaration(r)));else if(this.match("*")){if(this.nextToken(),!this.matchContextualKeyword("from")){var n=this.lookahead.value?i.Messages.UnexpectedToken:i.Messages.MissingFromClause;this.throwError(n,this.lookahead.value)}this.nextToken();var o=this.parseModuleSpecifier();this.consumeSemicolon(),e=this.finalize(t,new a.ExportAllDeclaration(o))}else if(4===this.lookahead.type){switch(r=void 0,this.lookahead.value){case"let":case"const":r=this.parseLexicalDeclaration({inFor:!1});break;case"var":case"class":case"function":r=this.parseStatementListItem();break;default:this.throwUnexpectedToken(this.lookahead)}e=this.finalize(t,new a.ExportNamedDeclaration(r,[],null))}else if(this.matchAsyncFunction())r=this.parseFunctionDeclaration(),e=this.finalize(t,new a.ExportNamedDeclaration(r,[],null));else{var s=[],l=null,u=!1;for(this.expect("{");!this.match("}");)u=u||this.matchKeyword("default"),s.push(this.parseExportSpecifier()),this.match("}")||this.expect(",");this.expect("}"),this.matchContextualKeyword("from")?(this.nextToken(),l=this.parseModuleSpecifier(),this.consumeSemicolon()):u?(n=this.lookahead.value?i.Messages.UnexpectedToken:i.Messages.MissingFromClause,this.throwError(n,this.lookahead.value)):this.consumeSemicolon(),e=this.finalize(t,new a.ExportNamedDeclaration(null,s,l))}return e},e}();t.Parser=c},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assert=function(e,t){if(!e)throw new Error("ASSERT: "+t)}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){this.errors=[],this.tolerant=!1}return e.prototype.recordError=function(e){this.errors.push(e)},e.prototype.tolerate=function(e){if(!this.tolerant)throw e;this.recordError(e)},e.prototype.constructError=function(e,t){var r=new Error(e);try{throw r}catch(e){Object.create&&Object.defineProperty&&(r=Object.create(e),Object.defineProperty(r,"column",{value:t}))}return r},e.prototype.createError=function(e,t,r,n){var o="Line "+t+": "+n,i=this.constructError(o,r);return i.index=e,i.lineNumber=t,i.description=n,i},e.prototype.throwError=function(e,t,r,n){throw this.createError(e,t,r,n)},e.prototype.tolerateError=function(e,t,r,n){var o=this.createError(e,t,r,n);if(!this.tolerant)throw o;this.recordError(o)},e}();t.ErrorHandler=r},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Messages={BadGetterArity:"Getter must not have any formal parameters",BadSetterArity:"Setter must have exactly one formal parameter",BadSetterRestParameter:"Setter function argument must not be a rest parameter",ConstructorIsAsync:"Class constructor may not be an async method",ConstructorSpecialMethod:"Class constructor may not be an accessor",DeclarationMissingInitializer:"Missing initializer in %0 declaration",DefaultRestParameter:"Unexpected token =",DuplicateBinding:"Duplicate binding %0",DuplicateConstructor:"A class may only have one constructor",DuplicateProtoProperty:"Duplicate __proto__ fields are not allowed in object literals",ForInOfLoopInitializer:"%0 loop variable declaration may not have an initializer",GeneratorInLegacyContext:"Generator declarations are not allowed in legacy contexts",IllegalBreak:"Illegal break statement",IllegalContinue:"Illegal continue statement",IllegalExportDeclaration:"Unexpected token",IllegalImportDeclaration:"Unexpected token",IllegalLanguageModeDirective:"Illegal 'use strict' directive in function with non-simple parameter list",IllegalReturn:"Illegal return statement",InvalidEscapedReservedWord:"Keyword must not contain escaped characters",InvalidHexEscapeSequence:"Invalid hexadecimal escape sequence",InvalidLHSInAssignment:"Invalid left-hand side in assignment",InvalidLHSInForIn:"Invalid left-hand side in for-in",InvalidLHSInForLoop:"Invalid left-hand side in for-loop",InvalidModuleSpecifier:"Unexpected token",InvalidRegExp:"Invalid regular expression",LetInLexicalBinding:"let is disallowed as a lexically bound name",MissingFromClause:"Unexpected token",MultipleDefaultsInSwitch:"More than one default clause in switch statement",NewlineAfterThrow:"Illegal newline after throw",NoAsAfterImportNamespace:"Unexpected token",NoCatchOrFinally:"Missing catch or finally after try",ParameterAfterRestParameter:"Rest parameter must be last formal parameter",Redeclaration:"%0 '%1' has already been declared",StaticPrototype:"Classes may not have static property named prototype",StrictCatchVariable:"Catch variable may not be eval or arguments in strict mode",StrictDelete:"Delete of an unqualified identifier in strict mode.",StrictFunction:"In strict mode code, functions can only be declared at top level or inside a block",StrictFunctionName:"Function name may not be eval or arguments in strict mode",StrictLHSAssignment:"Assignment to eval or arguments is not allowed in strict mode",StrictLHSPostfix:"Postfix increment/decrement may not have eval or arguments operand in strict mode",StrictLHSPrefix:"Prefix increment/decrement may not have eval or arguments operand in strict mode",StrictModeWith:"Strict mode code may not include a with statement",StrictOctalLiteral:"Octal literals are not allowed in strict mode.",StrictParamDupe:"Strict mode function may not have duplicate parameter names",StrictParamName:"Parameter name eval or arguments is not allowed in strict mode",StrictReservedWord:"Use of future reserved word in strict mode",StrictVarName:"Variable name may not be eval or arguments in strict mode",TemplateOctalLiteral:"Octal literals are not allowed in template strings.",UnexpectedEOS:"Unexpected end of input",UnexpectedIdentifier:"Unexpected identifier",UnexpectedNumber:"Unexpected number",UnexpectedReserved:"Unexpected reserved word",UnexpectedString:"Unexpected string",UnexpectedTemplate:"Unexpected quasi %0",UnexpectedToken:"Unexpected token %0",UnexpectedTokenIllegal:"Unexpected token ILLEGAL",UnknownLabel:"Undefined label '%0'",UnterminatedRegExp:"Invalid regular expression: missing /"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(9),o=r(4),i=r(11);function a(e){return"0123456789abcdef".indexOf(e.toLowerCase())}function s(e){return"01234567".indexOf(e)}var l=function(){function e(e,t){this.source=e,this.errorHandler=t,this.trackComment=!1,this.isModule=!1,this.length=e.length,this.index=0,this.lineNumber=e.length>0?1:0,this.lineStart=0,this.curlyStack=[]}return e.prototype.saveState=function(){return{index:this.index,lineNumber:this.lineNumber,lineStart:this.lineStart}},e.prototype.restoreState=function(e){this.index=e.index,this.lineNumber=e.lineNumber,this.lineStart=e.lineStart},e.prototype.eof=function(){return this.index>=this.length},e.prototype.throwUnexpectedToken=function(e){return void 0===e&&(e=i.Messages.UnexpectedTokenIllegal),this.errorHandler.throwError(this.index,this.lineNumber,this.index-this.lineStart+1,e)},e.prototype.tolerateUnexpectedToken=function(e){void 0===e&&(e=i.Messages.UnexpectedTokenIllegal),this.errorHandler.tolerateError(this.index,this.lineNumber,this.index-this.lineStart+1,e)},e.prototype.skipSingleLineComment=function(e){var t,r,n=[];for(this.trackComment&&(n=[],t=this.index-e,r={start:{line:this.lineNumber,column:this.index-this.lineStart-e},end:{}});!this.eof();){var i=this.source.charCodeAt(this.index);if(++this.index,o.Character.isLineTerminator(i)){if(this.trackComment){r.end={line:this.lineNumber,column:this.index-this.lineStart-1};var a={multiLine:!1,slice:[t+e,this.index-1],range:[t,this.index-1],loc:r};n.push(a)}return 13===i&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,n}}return this.trackComment&&(r.end={line:this.lineNumber,column:this.index-this.lineStart},a={multiLine:!1,slice:[t+e,this.index],range:[t,this.index],loc:r},n.push(a)),n},e.prototype.skipMultiLineComment=function(){var e,t,r=[];for(this.trackComment&&(r=[],e=this.index-2,t={start:{line:this.lineNumber,column:this.index-this.lineStart-2},end:{}});!this.eof();){var n=this.source.charCodeAt(this.index);if(o.Character.isLineTerminator(n))13===n&&10===this.source.charCodeAt(this.index+1)&&++this.index,++this.lineNumber,++this.index,this.lineStart=this.index;else if(42===n){if(47===this.source.charCodeAt(this.index+1)){if(this.index+=2,this.trackComment){t.end={line:this.lineNumber,column:this.index-this.lineStart};var i={multiLine:!0,slice:[e+2,this.index-2],range:[e,this.index],loc:t};r.push(i)}return r}++this.index}else++this.index}return this.trackComment&&(t.end={line:this.lineNumber,column:this.index-this.lineStart},i={multiLine:!0,slice:[e+2,this.index],range:[e,this.index],loc:t},r.push(i)),this.tolerateUnexpectedToken(),r},e.prototype.scanComments=function(){var e;this.trackComment&&(e=[]);for(var t=0===this.index;!this.eof();){var r=this.source.charCodeAt(this.index);if(o.Character.isWhiteSpace(r))++this.index;else if(o.Character.isLineTerminator(r))++this.index,13===r&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,t=!0;else if(47===r)if(47===(r=this.source.charCodeAt(this.index+1))){this.index+=2;var n=this.skipSingleLineComment(2);this.trackComment&&(e=e.concat(n)),t=!0}else{if(42!==r)break;this.index+=2,n=this.skipMultiLineComment(),this.trackComment&&(e=e.concat(n))}else if(t&&45===r){if(45!==this.source.charCodeAt(this.index+1)||62!==this.source.charCodeAt(this.index+2))break;this.index+=3,n=this.skipSingleLineComment(3),this.trackComment&&(e=e.concat(n))}else{if(60!==r||this.isModule)break;if("!--"!==this.source.slice(this.index+1,this.index+4))break;this.index+=4,n=this.skipSingleLineComment(4),this.trackComment&&(e=e.concat(n))}}return e},e.prototype.isFutureReservedWord=function(e){switch(e){case"enum":case"export":case"import":case"super":return!0;default:return!1}},e.prototype.isStrictModeReservedWord=function(e){switch(e){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"yield":case"let":return!0;default:return!1}},e.prototype.isRestrictedWord=function(e){return"eval"===e||"arguments"===e},e.prototype.isKeyword=function(e){switch(e.length){case 2:return"if"===e||"in"===e||"do"===e;case 3:return"var"===e||"for"===e||"new"===e||"try"===e||"let"===e;case 4:return"this"===e||"else"===e||"case"===e||"void"===e||"with"===e||"enum"===e;case 5:return"while"===e||"break"===e||"catch"===e||"throw"===e||"const"===e||"yield"===e||"class"===e||"super"===e;case 6:return"return"===e||"typeof"===e||"delete"===e||"switch"===e||"export"===e||"import"===e;case 7:return"default"===e||"finally"===e||"extends"===e;case 8:return"function"===e||"continue"===e||"debugger"===e;case 10:return"instanceof"===e;default:return!1}},e.prototype.codePointAt=function(e){var t=this.source.charCodeAt(e);if(t>=55296&&t<=56319){var r=this.source.charCodeAt(e+1);r>=56320&&r<=57343&&(t=1024*(t-55296)+r-56320+65536)}return t},e.prototype.scanHexEscape=function(e){for(var t="u"===e?4:2,r=0,n=0;n1114111||"}"!==e)&&this.throwUnexpectedToken(),o.Character.fromCodePoint(t)},e.prototype.getIdentifier=function(){for(var e=this.index++;!this.eof();){var t=this.source.charCodeAt(this.index);if(92===t)return this.index=e,this.getComplexIdentifier();if(t>=55296&&t<57343)return this.index=e,this.getComplexIdentifier();if(!o.Character.isIdentifierPart(t))break;++this.index}return this.source.slice(e,this.index)},e.prototype.getComplexIdentifier=function(){var e,t=this.codePointAt(this.index),r=o.Character.fromCodePoint(t);for(this.index+=r.length,92===t&&(117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,"{"===this.source[this.index]?(++this.index,e=this.scanUnicodeCodePointEscape()):null!==(e=this.scanHexEscape("u"))&&"\\"!==e&&o.Character.isIdentifierStart(e.charCodeAt(0))||this.throwUnexpectedToken(),r=e);!this.eof()&&(t=this.codePointAt(this.index),o.Character.isIdentifierPart(t));)r+=e=o.Character.fromCodePoint(t),this.index+=e.length,92===t&&(r=r.substr(0,r.length-1),117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,"{"===this.source[this.index]?(++this.index,e=this.scanUnicodeCodePointEscape()):null!==(e=this.scanHexEscape("u"))&&"\\"!==e&&o.Character.isIdentifierPart(e.charCodeAt(0))||this.throwUnexpectedToken(),r+=e);return r},e.prototype.octalToDecimal=function(e){var t="0"!==e,r=s(e);return!this.eof()&&o.Character.isOctalDigit(this.source.charCodeAt(this.index))&&(t=!0,r=8*r+s(this.source[this.index++]),"0123".indexOf(e)>=0&&!this.eof()&&o.Character.isOctalDigit(this.source.charCodeAt(this.index))&&(r=8*r+s(this.source[this.index++]))),{code:r,octal:t}},e.prototype.scanIdentifier=function(){var e,t=this.index,r=92===this.source.charCodeAt(t)?this.getComplexIdentifier():this.getIdentifier();if(3!=(e=1===r.length?3:this.isKeyword(r)?4:"null"===r?5:"true"===r||"false"===r?1:3)&&t+r.length!==this.index){var n=this.index;this.index=t,this.tolerateUnexpectedToken(i.Messages.InvalidEscapedReservedWord),this.index=n}return{type:e,value:r,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}},e.prototype.scanPunctuator=function(){var e=this.index,t=this.source[this.index];switch(t){case"(":case"{":"{"===t&&this.curlyStack.push("{"),++this.index;break;case".":++this.index,"."===this.source[this.index]&&"."===this.source[this.index+1]&&(this.index+=2,t="...");break;case"}":++this.index,this.curlyStack.pop();break;case")":case";":case",":case"[":case"]":case":":case"?":case"~":++this.index;break;default:">>>="===(t=this.source.substr(this.index,4))?this.index+=4:"==="===(t=t.substr(0,3))||"!=="===t||">>>"===t||"<<="===t||">>="===t||"**="===t?this.index+=3:"&&"===(t=t.substr(0,2))||"||"===t||"=="===t||"!="===t||"+="===t||"-="===t||"*="===t||"/="===t||"++"===t||"--"===t||"<<"===t||">>"===t||"&="===t||"|="===t||"^="===t||"%="===t||"<="===t||">="===t||"=>"===t||"**"===t?this.index+=2:(t=this.source[this.index],"<>=!+-*%&|^/".indexOf(t)>=0&&++this.index)}return this.index===e&&this.throwUnexpectedToken(),{type:7,value:t,lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},e.prototype.scanHexLiteral=function(e){for(var t="";!this.eof()&&o.Character.isHexDigit(this.source.charCodeAt(this.index));)t+=this.source[this.index++];return 0===t.length&&this.throwUnexpectedToken(),o.Character.isIdentifierStart(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(),{type:6,value:parseInt("0x"+t,16),lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},e.prototype.scanBinaryLiteral=function(e){for(var t,r="";!this.eof()&&("0"===(t=this.source[this.index])||"1"===t);)r+=this.source[this.index++];return 0===r.length&&this.throwUnexpectedToken(),this.eof()||(t=this.source.charCodeAt(this.index),(o.Character.isIdentifierStart(t)||o.Character.isDecimalDigit(t))&&this.throwUnexpectedToken()),{type:6,value:parseInt(r,2),lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},e.prototype.scanOctalLiteral=function(e,t){var r="",n=!1;for(o.Character.isOctalDigit(e.charCodeAt(0))?(n=!0,r="0"+this.source[this.index++]):++this.index;!this.eof()&&o.Character.isOctalDigit(this.source.charCodeAt(this.index));)r+=this.source[this.index++];return n||0!==r.length||this.throwUnexpectedToken(),(o.Character.isIdentifierStart(this.source.charCodeAt(this.index))||o.Character.isDecimalDigit(this.source.charCodeAt(this.index)))&&this.throwUnexpectedToken(),{type:6,value:parseInt(r,8),octal:n,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}},e.prototype.isImplicitOctalLiteral=function(){for(var e=this.index+1;e=0&&(r=r.replace(/\\u\{([0-9a-fA-F]+)\}|\\u([a-fA-F0-9]{4})/g,function(e,t,r){var o=parseInt(t||r,16);return o>1114111&&n.throwUnexpectedToken(i.Messages.InvalidRegExp),o<=65535?String.fromCharCode(o):"￿"}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"￿"));try{RegExp(r)}catch(e){this.throwUnexpectedToken(i.Messages.InvalidRegExp)}try{return new RegExp(e,t)}catch(e){return null}},e.prototype.scanRegExpBody=function(){var e=this.source[this.index];n.assert("/"===e,"Regular expression literal must start with a slash");for(var t=this.source[this.index++],r=!1,a=!1;!this.eof();)if(t+=e=this.source[this.index++],"\\"===e)e=this.source[this.index++],o.Character.isLineTerminator(e.charCodeAt(0))&&this.throwUnexpectedToken(i.Messages.UnterminatedRegExp),t+=e;else if(o.Character.isLineTerminator(e.charCodeAt(0)))this.throwUnexpectedToken(i.Messages.UnterminatedRegExp);else if(r)"]"===e&&(r=!1);else{if("/"===e){a=!0;break}"["===e&&(r=!0)}return a||this.throwUnexpectedToken(i.Messages.UnterminatedRegExp),t.substr(1,t.length-2)},e.prototype.scanRegExpFlags=function(){for(var e="";!this.eof();){var t=this.source[this.index];if(!o.Character.isIdentifierPart(t.charCodeAt(0)))break;if(++this.index,"\\"!==t||this.eof())e+=t;else if("u"===(t=this.source[this.index])){++this.index;var r=this.index,n=this.scanHexEscape("u");if(null!==n)for(e+=n;r=55296&&e<57343&&o.Character.isIdentifierStart(this.codePointAt(this.index))?this.scanIdentifier():this.scanPunctuator()},e}();t.Scanner=l},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TokenName={},t.TokenName[1]="Boolean",t.TokenName[2]="",t.TokenName[3]="Identifier",t.TokenName[4]="Keyword",t.TokenName[5]="Null",t.TokenName[6]="Numeric",t.TokenName[7]="Punctuator",t.TokenName[8]="String",t.TokenName[9]="RegularExpression",t.TokenName[10]="Template"},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XHTMLEntities={quot:'"',amp:"&",apos:"'",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",lang:"⟨",rang:"⟩"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(10),o=r(12),i=r(13),a=function(){function e(){this.values=[],this.curly=this.paren=-1}return e.prototype.beforeFunctionExpression=function(e){return["(","{","[","in","typeof","instanceof","new","return","case","delete","throw","void","=","+=","-=","*=","**=","/=","%=","<<=",">>=",">>>=","&=","|=","^=",",","+","-","*","**","/","%","++","--","<<",">>",">>>","&","|","^","!","~","&&","||","?",":","===","==",">=","<=","<",">","!=","!=="].indexOf(e)>=0},e.prototype.isRegexStart=function(){var e=this.values[this.values.length-1],t=null!==e;switch(e){case"this":case"]":t=!1;break;case")":var r=this.values[this.paren-1];t="if"===r||"while"===r||"for"===r||"with"===r;break;case"}":if(t=!1,"function"===this.values[this.curly-3])t=!!(n=this.values[this.curly-4])&&!this.beforeFunctionExpression(n);else if("function"===this.values[this.curly-4]){var n;t=!(n=this.values[this.curly-5])||!this.beforeFunctionExpression(n)}}return t},e.prototype.push=function(e){7===e.type||4===e.type?("{"===e.value?this.curly=this.values.length:"("===e.value&&(this.paren=this.values.length),this.values.push(e.value)):this.values.push(null)},e}(),s=function(){function e(e,t){this.errorHandler=new n.ErrorHandler,this.errorHandler.tolerant=!!t&&"boolean"==typeof t.tolerant&&t.tolerant,this.scanner=new o.Scanner(e,this.errorHandler),this.scanner.trackComment=!!t&&"boolean"==typeof t.comment&&t.comment,this.trackRange=!!t&&"boolean"==typeof t.range&&t.range,this.trackLoc=!!t&&"boolean"==typeof t.loc&&t.loc,this.buffer=[],this.reader=new a}return e.prototype.errors=function(){return this.errorHandler.errors},e.prototype.getNextToken=function(){if(0===this.buffer.length){var e=this.scanner.scanComments();if(this.scanner.trackComment)for(var t=0;t-1&&r>=e.flowLevel;switch(function(e,t,r,n,o){var i,a,s,l,u=!1,c=!1,d=-1!==n,p=-1,f=g(l=e.charCodeAt(0))&&65279!==l&&!m(l)&&45!==l&&63!==l&&58!==l&&44!==l&&91!==l&&93!==l&&123!==l&&125!==l&&35!==l&&38!==l&&42!==l&&33!==l&&124!==l&&61!==l&&62!==l&&39!==l&&34!==l&&37!==l&&64!==l&&96!==l&&!m(e.charCodeAt(e.length-1));if(t)for(i=0;i0?e.charCodeAt(i-1):null,f=f&&y(a,s)}else{for(i=0;in&&" "!==e[p+1],p=i);else if(!g(a))return 5;s=i>0?e.charCodeAt(i-1):null,f=f&&y(a,s)}c=c||d&&i-p-1>n&&" "!==e[p+1]}return u||c?r>9&&v(e)?5:c?4:3:f&&!o(e)?1:2}(t,s,e.indent,a,function(t){return function(e,t){var r,n;for(r=0,n=e.implicitTypes.length;r"+x(t,e.indent)+_(f(function(e,t){for(var r,n,o,i=/(\n+)([^\n]*)/g,a=(o=-1!==(o=e.indexOf("\n"))?o:e.length,i.lastIndex=o,S(e.slice(0,o),t)),s="\n"===e[0]||" "===e[0];n=i.exec(e);){var l=n[1],u=n[2];r=" "===u[0],a+=l+(s||r||""===u?"":"\n")+S(u,t),s=r}return a}(t,a),i));case 5:return'"'+function(e){for(var t,r,n,o="",i=0;i=55296&&t<=56319&&(r=e.charCodeAt(i+1))>=56320&&r<=57343?(o+=d(1024*(t-55296)+r-56320+65536),i++):o+=!(n=u[t])&&g(t)?e[i]:n||d(t);return o}(t)+'"';default:throw new o("impossible error: invalid scalar style")}}()}function x(e,t){var r=v(e)?String(t):"",n="\n"===e[e.length-1];return r+(!n||"\n"!==e[e.length-2]&&"\n"!==e?n?"":"-":"+")+"\n"}function _(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function S(e,t){if(""===e||" "===e[0])return e;for(var r,n,o=/ [^ ]/g,i=0,a=0,s=0,l="";r=o.exec(e);)(s=r.index)-i>t&&(n=a>i?a:s,l+="\n"+e.slice(i,n),i=n+1),a=s;return l+="\n",e.length-i>t&&a>i?l+=e.slice(i,a)+"\n"+e.slice(a+1):l+=e.slice(i),l.slice(1)}function C(e,t,r){var n,i,a,u,c,d;for(a=0,u=(i=r?e.explicitTypes:e.implicitTypes).length;a tag resolver accepts not "'+d+'" style');n=c.represent[d](t,d)}e.dump=n}return!0}return!1}function T(e,t,r,n,i,a){e.tag=null,e.dump=r,C(e,r,!1)||C(e,r,!0);var l=s.call(e.dump);n&&(n=e.flowLevel<0||e.flowLevel>t);var u,c,d="[object Object]"===l||"[object Array]"===l;if(d&&(c=-1!==(u=e.duplicates.indexOf(r))),(null!==e.tag&&"?"!==e.tag||c||2!==e.indent&&t>0)&&(i=!1),c&&e.usedDuplicates[u])e.dump="*ref_"+u;else{if(d&&c&&!e.usedDuplicates[u]&&(e.usedDuplicates[u]=!0),"[object Object]"===l)n&&0!==Object.keys(e.dump).length?(function(e,t,r,n){var i,a,s,l,u,c,d="",p=e.tag,f=Object.keys(r);if(!0===e.sortKeys)f.sort();else if("function"==typeof e.sortKeys)f.sort(e.sortKeys);else if(e.sortKeys)throw new o("sortKeys must be a boolean or a function");for(i=0,a=f.length;i1024)&&(e.dump&&10===e.dump.charCodeAt(0)?c+="?":c+="? "),c+=e.dump,u&&(c+=h(e,t)),T(e,t+1,l,!0,u)&&(e.dump&&10===e.dump.charCodeAt(0)?c+=":":c+=": ",d+=c+=e.dump));e.tag=p,e.dump=d||"{}"}(e,t,e.dump,i),c&&(e.dump="&ref_"+u+e.dump)):(function(e,t,r){var n,o,i,a,s,l="",u=e.tag,c=Object.keys(r);for(n=0,o=c.length;n1024&&(s+="? "),s+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),T(e,t,a,!1,!1)&&(l+=s+=e.dump));e.tag=u,e.dump="{"+l+"}"}(e,t,e.dump),c&&(e.dump="&ref_"+u+" "+e.dump));else if("[object Array]"===l){var p=e.noArrayIndent&&t>0?t-1:t;n&&0!==e.dump.length?(function(e,t,r,n){var o,i,a="",s=e.tag;for(o=0,i=r.length;o "+e.dump)}return!0}function w(e,t){var r=new p(t=t||{});return r.noRefs||function(e,t){var r,n,o=[],i=[];for(function e(t,r,n){var o,i,a;if(null!==t&&"object"==typeof t)if(-1!==(i=r.indexOf(t)))-1===n.indexOf(i)&&n.push(i);else if(r.push(t),Array.isArray(t))for(i=0,a=t.length;i=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var s=r(91),l=r(1),u=r(183),c=r(0),d=r(7),p=r(95),f=r(69),h=r(3),m=r(305),g=r(306),y=r(307),v=function(e){function t(t,r){void 0===r&&(r=!1);var n=e.call(this)||this;return n._hasDeclaration=!1,n._docTypeName="",n._hasDocumentElement=!1,n._currentElementSerialized=!1,n._openTags=[],n._ended=!1,n._fragment=r,n._options=l.applyDefaults(t||{},s.DefaultXMLBuilderCBOptions),n._builderOptions={defaultNamespace:n._options.defaultNamespace,namespaceAlias:n._options.namespaceAlias},"json"===n._options.format?n._writer=new g.JSONCBWriter(n._options):"yaml"===n._options.format?n._writer=new y.YAMLCBWriter(n._options):n._writer=new m.XMLCBWriter(n._options),void 0!==n._options.data&&n.on("data",n._options.data),void 0!==n._options.end&&n.on("end",n._options.end),void 0!==n._options.error&&n.on("error",n._options.error),n._prefixMap=new p.NamespacePrefixMap,n._prefixMap.set("xml",d.namespace.XML),n._prefixIndex={value:1},n._push(n._writer.frontMatter()),n}return o(t,e),t.prototype.ele=function(e,t,r){var n,o;if(l.isObject(e)||l.isString(e)&&(/^\s*/g,">");return this._push(this._writer.text(r)),this},t.prototype.ins=function(e,t){var r;void 0===t&&(t=""),this._serializeOpenTag(!0);try{r=u.fragment(this._builderOptions).ins(e,t).first().node}catch(e){return this.emit("error",e),this}return this._options.wellFormed&&(-1!==r.target.indexOf(":")||/^xml$/i.test(r.target))?(this.emit("error",new Error("Processing instruction target contains invalid characters (well-formed required).")),this):this._options.wellFormed&&!c.xml_isLegalChar(r.data)?(this.emit("error",Error("Processing instruction data contains invalid characters (well-formed required).")),this):(this._push(this._writer.instruction(r.target,r.data)),this)},t.prototype.dat=function(e){var t;this._serializeOpenTag(!0);try{t=u.fragment(this._builderOptions).dat(e).first().node}catch(e){return this.emit("error",e),this}return this._push(this._writer.cdata(t.data)),this},t.prototype.dec=function(e){return void 0===e&&(e={version:"1.0"}),this._fragment?(this.emit("error",Error("Cannot insert an XML declaration into a document fragment.")),this):this._hasDeclaration?(this.emit("error",Error("XML declaration is already inserted.")),this):(this._push(this._writer.declaration(e.version||"1.0",e.encoding,e.standalone)),this._hasDeclaration=!0,this)},t.prototype.dtd=function(e){if(this._fragment)return this.emit("error",Error("Cannot insert a DocType declaration into a document fragment.")),this;if(""!==this._docTypeName)return this.emit("error",new Error("DocType declaration is already inserted.")),this;if(this._hasDocumentElement)return this.emit("error",new Error("Cannot insert DocType declaration after document element.")),this;var t;try{t=u.create().dtd(e).first().node}catch(e){return this.emit("error",e),this}return this._options.wellFormed&&!c.xml_isPubidChar(t.publicId)?(this.emit("error",new Error("DocType public identifier does not match PubidChar construct (well-formed required).")),this):this._options.wellFormed&&(!c.xml_isLegalChar(t.systemId)||-1!==t.systemId.indexOf('"')&&-1!==t.systemId.indexOf("'"))?(this.emit("error",new Error("DocType system identifier contains invalid characters (well-formed required).")),this):(this._docTypeName=e.name,this._push(this._writer.docType(e.name,t.publicId,t.systemId)),this)},t.prototype.import=function(e){var t,r,n=u.fragment().set(this._options);try{n.import(e)}catch(e){return this.emit("error",e),this}try{for(var o=i(n.node.childNodes),a=o.next();!a.done;a=o.next()){var s=a.value;this._fromNode(s)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return this},t.prototype.up=function(){return this._serializeOpenTag(!1),this._serializeCloseTag(),this},t.prototype.end=function(){for(this._serializeOpenTag(!1);this._openTags.length>0;)this._serializeCloseTag();return this._push(null),this},t.prototype._serializeOpenTag=function(e){if(!this._currentElementSerialized&&void 0!==this._currentElement){var r=this._currentElement.node;if(!this._options.wellFormed||-1===r.localName.indexOf(":")&&c.xml_isName(r.localName)){var n="",o=!1,i=this._prefixMap.copy(),a={},s=this._recordNamespaceInformation(r,i,a),l=0===this._openTags.length?null:this._openTags[this._openTags.length-1][1],u=r.namespaceURI;if(null===u&&(u=l),l===u)null!==s&&(o=!0),n=u===d.namespace.XML?"xml:"+r.localName:r.localName,this._writer.beginElement(n),this._push(this._writer.openTagBegin(n));else{var p=r.prefix,f=null;if(null===p&&u===s||(f=i.get(p,u)),"xmlns"===p){if(this._options.wellFormed)return void this.emit("error",new Error("An element cannot have the 'xmlns' prefix (well-formed required)."));f=p}null!==f?(n=f+":"+r.localName,null!==s&&s!==d.namespace.XML&&(l=s||null),this._writer.beginElement(n),this._push(this._writer.openTagBegin(n))):null!==p?(p in a&&(p=this._generatePrefix(u,i,this._prefixIndex)),i.set(p,u),n+=p+":"+r.localName,this._writer.beginElement(n),this._push(this._writer.openTagBegin(n)),this._push(this._writer.attribute("xmlns:"+p,this._serializeAttributeValue(u,this._options.wellFormed))),null!==s&&(l=s||null)):null===s||null!==s&&s!==u?(o=!0,n+=r.localName,l=u,this._writer.beginElement(n),this._push(this._writer.openTagBegin(n)),this._push(this._writer.attribute("xmlns",this._serializeAttributeValue(u,this._options.wellFormed)))):(n+=r.localName,l=u,this._writer.beginElement(n),this._push(this._writer.openTagBegin(n)))}this._serializeAttributes(r,i,this._prefixIndex,a,o,this._options.wellFormed);var h=u===d.namespace.HTML;h&&!e&&t._VoidElementNames.has(r.localName)?(this._push(this._writer.openTagEnd(n,!0,!0)),this._writer.endElement(n)):h||e?this._push(this._writer.openTagEnd(n,!1,!1)):(this._push(this._writer.openTagEnd(n,!0,!1)),this._writer.endElement(n)),this._currentElementSerialized=!0,this._openTags.push([n,l,this._prefixMap,e]),this._isPrefixMapModified(this._prefixMap,i)&&(this._prefixMap=i),this._writer.level++}else this.emit("error",new Error("Node local name contains invalid characters (well-formed required)."))}},t.prototype._serializeCloseTag=function(){this._writer.level--;var e=this._openTags.pop();if(void 0!==e){var t=a(e,4),r=t[0],n=(t[1],t[2]),o=t[3];this._prefixMap=n,o&&(this._push(this._writer.closeTag(r)),this._writer.endElement(r))}else this.emit("error",new Error("Last element is undefined."))},t.prototype._push=function(e){null===e?(this._ended=!0,this.emit("end")):this._ended?this.emit("error",new Error("Cannot push to ended stream.")):0!==e.length&&(this._writer.hasData=!0,this.emit("data",e,this._writer.level))},t.prototype._fromNode=function(e){var t,r,n,o;if(h.Guard.isElementNode(e)){var a=e.prefix?e.prefix+":"+e.localName:e.localName;null!==e.namespaceURI?this.ele(e.namespaceURI,a):this.ele(a);try{for(var s=i(e.attributes),l=s.next();!l.done;l=s.next()){var u=l.value,c=u.prefix?u.prefix+":"+u.localName:u.localName;null!==u.namespaceURI?this.att(u.namespaceURI,c,u.value):this.att(c,u.value)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}try{for(var d=i(e.childNodes),p=d.next();!p.done;p=d.next()){var f=p.value;this._fromNode(f)}}catch(e){n={error:e}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(n)throw n.error}}this.up()}else h.Guard.isExclusiveTextNode(e)&&e.data?this.txt(e.data):h.Guard.isCommentNode(e)?this.com(e.data):h.Guard.isCDATASectionNode(e)?this.dat(e.data):h.Guard.isProcessingInstructionNode(e)&&this.ins(e.target,e.data)},t.prototype._serializeAttributes=function(e,t,r,n,o,a){var s,l,u=a?new f.LocalNameSet:void 0;try{for(var p=i(e.attributes),h=p.next();!h.done;h=p.next()){var m=h.value;if(a||o||null!==m.namespaceURI){if(a&&u&&u.has(m.namespaceURI,m.localName))return void this.emit("error",new Error("Element contains duplicate attributes (well-formed required)."));a&&u&&u.set(m.namespaceURI,m.localName);var g=m.namespaceURI,y=null;if(null!==g)if(y=t.get(m.prefix,g),g===d.namespace.XMLNS){if(m.value===d.namespace.XML||null===m.prefix&&o||null!==m.prefix&&(!(m.localName in n)||n[m.localName]!==m.value)&&t.has(m.localName,m.value))continue;if(a&&m.value===d.namespace.XMLNS)return void this.emit("error",new Error("XMLNS namespace is reserved (well-formed required)."));if(a&&""===m.value)return void this.emit("error",new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required)."));"xmlns"===m.prefix&&(y="xmlns")}else null===y&&(y=null===m.prefix||t.hasPrefix(m.prefix)&&!t.has(m.prefix,g)?this._generatePrefix(g,t,r):m.prefix,this._push(this._writer.attribute("xmlns:"+y,this._serializeAttributeValue(g,this._options.wellFormed))));if(a&&(-1!==m.localName.indexOf(":")||!c.xml_isName(m.localName)||"xmlns"===m.localName&&null===g))return void this.emit("error",new Error("Attribute local name contains invalid characters (well-formed required)."));this._push(this._writer.attribute((null!==y?y+":":"")+m.localName,this._serializeAttributeValue(m.value,this._options.wellFormed)))}else this._push(this._writer.attribute(m.localName,this._serializeAttributeValue(m.value,this._options.wellFormed)))}}catch(e){s={error:e}}finally{try{h&&!h.done&&(l=p.return)&&l.call(p)}finally{if(s)throw s.error}}},t.prototype._serializeAttributeValue=function(e,t){return t&&null!==e&&!c.xml_isLegalChar(e)?(this.emit("error",new Error("Invalid characters in attribute value.")),""):null===e?"":e.replace(/(?!&(lt|gt|amp|apos|quot);)&/g,"&").replace(//g,">").replace(/"/g,""")},t.prototype._recordNamespaceInformation=function(e,t,r){var n,o,a=null;try{for(var s=i(e.attributes),l=s.next();!l.done;l=s.next()){var u=l.value,c=u.namespaceURI,p=u.prefix;if(c===d.namespace.XMLNS){if(null===p){a=u.value;continue}var f=u.localName,h=u.value;if(h===d.namespace.XML)continue;if(""===h&&(h=null),t.has(f,h))continue;t.set(f,h),r[f]=h||""}}}catch(e){n={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}return a},t.prototype._generatePrefix=function(e,t,r){var n="ns"+r.value;return r.value++,t.set(n,e),n},t.prototype._isPrefixMapModified=function(e,t){var r=e._items,n=t._items,o=e._nullItems,i=t._nullItems;for(var a in n){var s=r[a];if(void 0===s)return!0;var l=n[a];if(s.length!==l.length)return!0;for(var u=0;u"},t.prototype.docType=function(e,t,r){return this._beginLine()+(t&&r?"':t?"':r?"':"")},t.prototype.comment=function(e){return this._beginLine()+"\x3c!--"+e+"--\x3e"},t.prototype.text=function(e){return this._beginLine()+e},t.prototype.instruction=function(e,t){return t?this._beginLine()+"":this._beginLine()+""},t.prototype.cdata=function(e){return this._beginLine()+""},t.prototype.openTagBegin=function(e){return this._lineLength+=1+e.length,this._beginLine()+"<"+e},t.prototype.openTagEnd=function(e,t,r){return r?" />":t?this._writerOptions.allowEmptyTags?">":this._writerOptions.spaceBeforeSlash?" />":"/>":">"},t.prototype.closeTag=function(e){return this._beginLine()+""},t.prototype.attribute=function(e,t){var r=e+'="'+t+'"';return this._writerOptions.prettyPrint&&this._writerOptions.width>0&&this._lineLength+1+r.length>this._writerOptions.width?(r=this._beginLine()+this._indent(1)+r,this._lineLength=r.length,r):(this._lineLength+=1+r.length," "+r)},t.prototype.beginElement=function(e){},t.prototype.endElement=function(e){},t.prototype._beginLine=function(){if(this._writerOptions.prettyPrint){var e=(this.hasData?this._writerOptions.newline:"")+this._indent(this._writerOptions.offset+this.level);return this._lineLength=e.length,e}return""},t.prototype._indent=function(e){return e<=0?"":this._writerOptions.indent.repeat(e)},t}(r(114).BaseCBWriter);t.XMLCBWriter=i},function(e,t,r){"use strict";r(74);var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(t){var r=e.call(this,t)||this;return r._hasChildren=[],r._additionalLevel=0,r}return o(t,e),t.prototype.frontMatter=function(){return""},t.prototype.declaration=function(e,t,r){return""},t.prototype.docType=function(e,t,r){return""},t.prototype.comment=function(e){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.comment)+this._sep()+this._val(e)+this._sep()+"}"},t.prototype.text=function(e){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.text)+this._sep()+this._val(e)+this._sep()+"}"},t.prototype.instruction=function(e,t){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.ins)+this._sep()+this._val(t?e+" "+t:e)+this._sep()+"}"},t.prototype.cdata=function(e){return this._comma()+this._beginLine()+"{"+this._sep()+this._key(this._builderOptions.convert.cdata)+this._sep()+this._val(e)+this._sep()+"}"},t.prototype.attribute=function(e,t){return this._comma()+this._beginLine(1)+"{"+this._sep()+this._key(this._builderOptions.convert.att+e)+this._sep()+this._val(t)+this._sep()+"}"},t.prototype.openTagBegin=function(e){var t=this._comma()+this._beginLine()+"{"+this._sep()+this._key(e)+this._sep()+"{";return this._additionalLevel++,this.hasData=!0,t+=this._beginLine()+this._key(this._builderOptions.convert.text)+this._sep()+"[",this._hasChildren.push(!1),t},t.prototype.openTagEnd=function(e,t,r){if(t){var n=this._sep()+"]";return this._additionalLevel--,n+(this._beginLine()+"}")+this._sep()+"}"}return""},t.prototype.closeTag=function(e){var t=this._beginLine()+"]";return this._additionalLevel--,t+(this._beginLine()+"}")+this._sep()+"}"},t.prototype.beginElement=function(e){},t.prototype.endElement=function(e){this._hasChildren.pop()},t.prototype._beginLine=function(e){return void 0===e&&(e=0),this._writerOptions.prettyPrint?(this.hasData?this._writerOptions.newline:"")+this._indent(this._writerOptions.offset+this.level+e):""},t.prototype._indent=function(e){return e+this._additionalLevel<=0?"":this._writerOptions.indent.repeat(e+this._additionalLevel)},t.prototype._comma=function(){var e=this._hasChildren[this._hasChildren.length-1]?",":"";return this._hasChildren.length>0&&(this._hasChildren[this._hasChildren.length-1]=!0),e},t.prototype._sep=function(){return this._writerOptions.prettyPrint?" ":""},t.prototype._key=function(e){return'"'+e+'":'},t.prototype._val=function(e){return JSON.stringify(e)},t}(r(114).BaseCBWriter);t.JSONCBWriter=i},function(e,t,r){"use strict";r(74);var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(t){var r=e.call(this,t)||this;if(r._rootWritten=!1,r._additionalLevel=0,t.indent.length<2)throw new Error("YAML indententation string must be at least two characters long.");if(t.offset<0)throw new Error("YAML offset should be zero or a positive number.");return r}return o(t,e),t.prototype.frontMatter=function(){return this._beginLine()+"---"},t.prototype.declaration=function(e,t,r){return""},t.prototype.docType=function(e,t,r){return""},t.prototype.comment=function(e){return this._beginLine()+this._key(this._builderOptions.convert.comment)+" "+this._val(e)},t.prototype.text=function(e){return this._beginLine()+this._key(this._builderOptions.convert.text)+" "+this._val(e)},t.prototype.instruction=function(e,t){return this._beginLine()+this._key(this._builderOptions.convert.ins)+" "+this._val(t?e+" "+t:e)},t.prototype.cdata=function(e){return this._beginLine()+this._key(this._builderOptions.convert.cdata)+" "+this._val(e)},t.prototype.attribute=function(e,t){this._additionalLevel++;var r=this._beginLine()+this._key(this._builderOptions.convert.att+e)+" "+this._val(t);return this._additionalLevel--,r},t.prototype.openTagBegin=function(e){var t=this._beginLine()+this._key(e);return this._rootWritten||(this._rootWritten=!0),this.hasData=!0,this._additionalLevel++,t+(this._beginLine(!0)+this._key(this._builderOptions.convert.text))},t.prototype.openTagEnd=function(e,t,r){return t?" "+this._val(""):""},t.prototype.closeTag=function(e){return this._additionalLevel--,""},t.prototype.beginElement=function(e){},t.prototype.endElement=function(e){},t.prototype._beginLine=function(e){return void 0===e&&(e=!1),(this.hasData?this._writerOptions.newline:"")+this._indent(this._writerOptions.offset+this.level,e)},t.prototype._indent=function(e,t){if(e+this._additionalLevel<=0)return"";var r=this._writerOptions.indent.repeat(e+this._additionalLevel);return!t&&this._rootWritten?r.substr(0,r.length-2)+"-"+r.substr(-1,1):r},t.prototype._key=function(e){return'"'+e+'":'},t.prototype._val=function(e){return JSON.stringify(e)},t}(r(114).BaseCBWriter);t.YAMLCBWriter=i},function(e,t,r){"use strict";var n,o="object"==typeof Reflect?Reflect:null,i=o&&"function"==typeof o.apply?o.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};n=o&&"function"==typeof o.ownKeys?o.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var a=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var l=10;function u(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function d(e,t,r,n){var o,i,a,s;if(u(r),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),i=e._events),a=i[t]),void 0===a)a=i[t]=r,++e._eventsCount;else if("function"==typeof a?a=i[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(o=c(e))>0&&a.length>o&&!a.warned){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=a.length,s=l,console&&console.warn&&console.warn(s)}return e}function p(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},o=p.bind(n);return o.listener=r,n.wrapFn=o,o}function h(e,t,r){var n=e._events;if(void 0===n)return[];var o=n[t];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(e){for(var t=new Array(e.length),r=0;r0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var l=o[e];if(void 0===l)return!1;if("function"==typeof l)i(l,this,t);else{var u=l.length,c=g(l,u);for(r=0;r=0;i--)if(r[i]===t||r[i].listener===t){a=r[i].listener,o=i;break}if(o<0)return this;0===o?r.shift():function(e,t){for(;t+1=0;n--)this.removeListener(e,t[n]);return this},s.prototype.listeners=function(e){return h(this,e,!0)},s.prototype.rawListeners=function(e){return h(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},s.prototype.listenerCount=m,s.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(77);t.createCB=function(e){return new n.XMLBuilderCBImpl(e)},t.fragmentCB=function(e){return new n.XMLBuilderCBImpl(e,!0)}}])},234(){}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={id:n,loaded:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.loaded=!0,i.exports}r.amdD=function(){throw new Error("define cannot be used indirect")},r.amdO={},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.hmd=e=>((e=Object.create(e)).children||(e.children=[]),Object.defineProperty(e,"exports",{enumerable:!0,set:()=>{throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+e.id)}}),e),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var n=r(581);return n.default})());