(function(Z,ie){typeof exports=="object"&&typeof module<"u"?ie(exports):typeof define=="function"&&define.amd?define(["exports"],ie):(Z=typeof globalThis<"u"?globalThis:Z||self,ie(Z.trame_rca={}))})(this,function(Z){"use strict";class ie{constructor(t){this.vueComponent=t,this.img=new Image,this.url="",this.blob=null,this.img.addEventListener("load",()=>{this.vueComponent.displayURL=this.url,this.vueComponent.hasContent=!0})}update(t,r){window.URL.revokeObjectURL(this.url),this.blob=new Blob([r],{type:t}),this.url=URL.createObjectURL(this.blob),this.img.src=this.url}}const tt={props:{name:{type:String,default:"default"},origin:{type:String,default:"anonymous"},poolSize:{type:Number,default:4}},watch:{poolSize(){this.updatePoolSize()}},data(){return{hasContent:!1,displayURL:""}},methods:{resetContent(){this.hasContent=!1},updatePoolSize(){for(;this.frames.length<this.poolSize;)this.frames.push(new ie(this));for(;this.frames.length>this.poolSize;)this.frames.pop()}},created(){this.frames=[],this.nextFrameIndex=0,this.updatePoolSize(),this.wslinkSubscription=null,this.onImage=([{name:e,meta:t,content:r}])=>{this.name===e&&(t.type==="image/jpeg"?(this.nextFrameIndex=(this.nextFrameIndex+1)%this.frames.length,this.frames[this.nextFrameIndex].update(t.type,r)):this.hasContent=!1)},this.trame&&(this.wslinkSubscription=this.trame.client.getConnection().getSession().subscribe("trame.rca.topic.stream",this.onImage))},beforeUnmount(){this.wslinkSubscription&&this.trame&&(this.trame.client.getConnection().getSession().unsubscribe(this.wslinkSubscription),this.wslinkSubscription=null)},inject:["trame"],template:'<img :src="displayURL" v-show="hasContent" />'};class vn{constructor(t,r="video/webm; codecs=vp09.00.10.08"){this.videoElement=t,this.mime=r,this.sourceBuffer=null,this.mediaSource=null,this.initSegment=null,this.mediaSegments=[],this.loaded=0,"MediaSource"in window?(this.mediaSource=new MediaSource,this.videoElement.src=URL.createObjectURL(this.mediaSource),this.mediaSource.addEventListener("sourceopen",()=>{MediaSource.isTypeSupported(this.mime)?this.initSourceBuffer():console.error(`Unsupported MIME type or codec: ${this.mime}`)})):console.error("The Media Source Extensions API is not supported.")}initSourceBuffer(){this.sourceBuffer=this.mediaSource.addSourceBuffer(this.mime),this.sourceBuffer.mode="sequence",this.initSegment?this.sourceBuffer.appendBuffer(this.initSegment):console.error("Need initialization segment"),this.sourceBuffer.onupdateend=()=>{if(this.mediaSegments.length)this.sourceBuffer.updating===!1&&(this.sourceBuffer.appendBuffer(this.mediaSegments.shift()),this.loaded+=1);else return}}queueChunk(t){this.mediaSource.readyState==="open"&&this.sourceBuffer&&this.sourceBuffer.updating===!1?(this.sourceBuffer.appendBuffer(t),this.loaded+=1):this.mediaSegments.push(t)}exit(){this.sourceBuffer.abort(),this.mediaSource.endOfStream(),this.videoElement.play(),URL.revokeObjectURL(this.videoElement.src)}}const nt={props:{name:{type:String,default:"default"},origin:{type:String,default:"anonymous"}},data(){return{hasContent:!1,loaded:0,received:0}},methods:{requestInitializationSegment(){this.rcaPushSize&&this.rcaPushSize({videoHeader:1})}},created(){this.pushChunk=(e,t)=>{Array.from(new Uint8Array(e).slice(0,4)).map(n=>n.toString(16)).join("")=="1a45dfa3"&&t.includes("webm")?(console.log("detected ebml fourcc"),this.decoder&&this.decoder.exit(),this.decoder=new vn(this.$el),this.decoder.initSegment=new Uint8Array(e)):this.decoder.mime!==t?(console.log("detected mime change"),this.requestInitializationSegment()):(this.decoder.queueChunk(e),this.loaded=this.decoder.loaded,this.hasContent=!0)}},mounted(){this.onChunkAvailable=([{name:e,meta:t,content:r}])=>{if(!t.type.includes("video/")){this.hasContent=!1;return}this.name===e&&(this.received+=1,r.arrayBuffer().then(n=>this.pushChunk(n,t.type)),this.hasContent=!0)},this.trame&&(this.wslinkSubscription=this.trame.client.getConnection().getSession().subscribe("trame.rca.topic.stream",this.onChunkAvailable),this.requestInitializationSegment())},beforeUnmount(){this.wslinkSubscription&&this.trame&&(this.trame.client.getConnection().getSession().unsubscribe(this.wslinkSubscription),this.wslinkSubscription=null,this.decoder.exit())},inject:["trame","rcaPushSize"],template:`
    <video autoplay="autoplay" muted="muted" v-show="hasContent">
      Your browser does not support the video tag.
    </video>
  `},yn=1,dn=2,gn=3,mn=4,wn=5,Sn=6,En=`

function reportError(e) {
  console.log(e.message);
  postMessage(e.message);
}

function createDecoder(canvas) {
  const ctx = canvas.getContext('2d');
  const ready_frames = [];
  let underflow = true;

  function renderFrame() {
    if (ready_frames.length === 0) {
      underflow = true;
      return;
    }
    const frame = ready_frames.shift();
    underflow = false;
    ctx.drawImage(frame, 0, 0);
    frame.close();
    setTimeout(renderFrame, 0);
  }

  function handleFrame(frame) {
    ready_frames.push(frame);
    if (underflow) {
      underflow = false;
      setTimeout(renderFrame, 0);
    }
  }

  const init = {
    output: handleFrame,
    error: reportError,
  };

  return new VideoDecoder(init);
}

onmessage = async function({ data: msg }) {
  switch(msg.action) {
    case 1: // init
      this.canvas = msg.canvas;
      this.decoder = createDecoder(this.canvas);
      break;
    case 2: // config
      this.canvas.width = msg.config.codedWidth;
      this.canvas.height = msg.config.codedHeight;
      this.decoder.configure(msg.config);
      break;
    case 3: // chunk
      this.decoder.decode(new EncodedVideoChunk({
        timestamp: msg.timestamp,
        type: msg.type,
        data: msg.data,
      }));
      break;
    case 4: // flush
      this.decoder.flush();
      break;
    case 5: // reset
      this.decoder.reset();
      break;
    case 6: // close
      this.decoder.close();
      break;
  }
}
`,On=URL.createObjectURL(new Blob([En]));function bn(){const e=new Worker(On);return e.addEventListener("error",()=>console.error("worker failed"),!1),e.onmessage=t=>{console.log(`Worker message: ${t.data}`),console.log(">>> FIXME .....")},e}class xn{constructor(){this.worker=bn(),this.codec="",this.width=0,this.height=0}bindCanvas(t){const r=yn,n=t.transferControlToOffscreen();this.worker.postMessage({action:r,canvas:n},[n])}setContentType(t,r,n){if(this.codec!==t||this.width!==r||this.height!==n){const i=dn;this.codec=t,this.width=r,this.height=n,this.worker.postMessage({action:i,config:{codec:t,codedWidth:r,codedHeight:n}})}}pushChunk(t,r,n){const i=gn;this.worker.postMessage({action:i,timestamp:t,type:r,data:n},[n])}flush(){this.worker.postMessage({action:mn})}reset(){this.worker.postMessage({action:wn})}terminate(){this.worker.postMessage({action:Sn}),this.worker.terminate(),this.worker=null}}const rt={props:{name:{type:String,default:"default"},origin:{type:String,default:"anonymous"}},data(){return{isSupported:"VideoFrame"in window}},created(){this.worker=new xn},mounted(){if(this.isSupported){const e=this.$el.querySelector(".js-canvas");this.worker.bindCanvas(e),this.onChunkAvailable=([{name:t,meta:r,content:n}])=>{!r.type.includes("application/octet-stream")||!r.codec.length||r.codec.includes("unknown")||this.name===t&&r.codec.length&&(this.worker.setContentType(r.codec,r.w,r.h),n.arrayBuffer().then(i=>{this.worker.pushChunk(r.st,r.key,i)}))},this.trame&&(this.wslinkSubscription=this.trame.client.getConnection().getSession().subscribe("trame.rca.topic.stream",this.onChunkAvailable))}},beforeUnmount(){this.worker&&(this.worker.terminate(),this.worker=null),this.wslinkSubscription&&(this.trame&&(this.trame.client.getConnection().getSession().unsubscribe(this.wslinkSubscription),this.wslinkSubscription=null),this.destroyDecoder())},inject:["trame","rcaPushSize"],template:`
    <div>
      <h1 v-if="!isSupported">WebCodecs API is not supported.</h1>
      <canvas class="js-canvas"></canvas>
    </div>
  `},ot={props:{name:{type:String,default:"default"},origin:{type:String,default:"anonymous"}},data(){return{hasContent:!1}},mounted(){this.wslinkSubscription=null;const e=this.$el,t=e.getContext("2d");this.onImage=([{name:r,meta:n,content:i}])=>{this.name===r&&(n.type.includes("image/rgb24")?i.arrayBuffer().then(h=>{const v=new Uint8Array(h);e.width=n.w,e.height=n.h;const u=t.createImageData(n.w,n.h),a=u.data;let s=0,c=0;for(;c<a.length;)a[c++]=v[s++],a[c++]=v[s++],a[c++]=v[s++],a[c++]=255;t.putImageData(u,0,0),this.hasContent=!0}):n.type.includes("image/rgba32")?i.arrayBuffer().then(h=>{const v=new Uint8ClampedArray(h);e.width=n.w,e.height=n.h;const u=new ImageData(v,n.w,n.h);t.putImageData(u,0,0),this.hasContent=!0}):this.hasContent=!1)},this.trame&&(this.wslinkSubscription=this.trame.client.getConnection().getSession().subscribe("trame.rca.topic.stream",this.onImage))},beforeUnmount(){this.wslinkSubscription&&this.trame&&(this.trame.client.getConnection().getSession().unsubscribe(this.wslinkSubscription),this.wslinkSubscription=null)},inject:["trame"],template:'<canvas class="js-canvas" v-show="hasContent"></canvas>'},Tn={components:{ImageDisplayArea:tt,MediaSourceDisplayArea:nt,VideoDecoderDisplayArea:rt,RawImageDisplayArea:ot},props:{name:{type:String,default:"default"},origin:{type:String,default:"anonymous"},display:{type:String,default:"image"}},template:`
    <div style="width: 100%; height: 100%;">
      <image-display-area v-if="display === 'image'" :name="name" :origin="origin" :poolSize="4" />
      <media-source-display-area v-if="display === 'media-source'" :name="name" :origin="origin" />
      <video-decoder-display-area v-if="display === 'video-decoder'" :name="name" :origin="origin" />
      <raw-image-display-area v-if="display === 'raw-image'" :name="name" :origin="origin" />
    </div>
  `},kn=["B/s","KB/s","MB/s"];class Rn{constructor(t=255,r=10,n=1e3){this.windowSize=t,this.windowStatSize=r,this.newInteractionThreshold=n,this.lastTS=0,this.serverTime=[],this.clientTimes=[],this.packetSizes=[],this.statWindow=[]}trim(){for(;this.serverTime.length>this.windowSize;)this.serverTime.shift(),this.clientTimes.shift(),this.packetSizes.shift();for(;this.statWindow.length>this.windowStatSize;)this.statWindow.shift()}compute(){if(this.statWindow.length<2)return null;const t=this.statWindow[0],n=(this.statWindow[this.statWindow.length-1]-t)/(this.statWindow.length-1),i=1e3/n,h=[],v=[],u=[0,0];let a=this.clientTimes[0],s=this.serverTime[0],c=0;for(let l=0;l<this.clientTimes.length;l++){const p=this.clientTimes[l]-a,o=this.serverTime[l]-s;c+=this.packetSizes[l],h.push(p),v.push(o),a+=n,s+=n;const f=p<o?p:o,y=p>o?p:o;u[0]>f&&(u[0]=f),u[1]<y&&(u[1]=y)}return c*=i/this.packetSizes.length,{avgFps:i,client:h,server:v,minMax:u,totalSize:c}}addEntry(t,r){const n=Date.now();return this.packetSizes.push(r),this.serverTime.push(t),this.clientTimes.push(n),n-this.lastTS<this.newInteractionThreshold?this.statWindow.push(n):this.statWindow.length=0,this.lastTS=n,this.trim(),this.compute()}}const Mn={props:{name:{type:String,default:"default"},fpsDelta:{type:Number,default:4},statWindowSize:{type:Number,default:10},historyWindowSize:{type:Number,default:255},resetMsThreshold:{type:Number,default:255},wsLinkTopic:{type:String,default:"trame.rca.topic.stream"},packetDecorator:{type:Function,default:({name:e,meta:t,content:r})=>({name:e,serverTime:t.st,contentSize:r.size})}},data(){return{cw:200,ch:200,avg:30,delta:2,totalSize:0}},watch:{statWindowSize(e){this.monitor.windowStatSize=e},historyWindowSize(e){this.monitor.windowSize=e},resetMsThreshold(e){this.monitor.newInteractionThreshold=e}},methods:{sizeUnit(e){let t=e;for(let r=0;r<3;r++){if(t<1e3)return`${t.toFixed(1)} ${kn[r]}`;t/=1e3}},draw(e,t,r="#1DE9B688",n="#EF9A9A"){if(!this.$el)return;const{cw:i,ch:h}=this,u=this.$el.querySelector(".js-canvas").getContext("2d"),a=Math.floor(h*.5+.5),s=a/(1001*this.fpsDelta),c=i/(e.length-2);u.clearRect(0,0,i,h),u.strokeStyle="black",u.beginPath(),u.moveTo(0,a),u.lineTo(i,a),u.stroke(),u.strokeStyle="#eee";for(let l=0;l<this.fpsDelta;l++)u.beginPath(),u.moveTo(0,a+1e3*(l+1)*s),u.lineTo(i,a+1e3*(l+1)*s),u.stroke(),u.beginPath(),u.moveTo(0,a-1e3*(l+1)*s),u.lineTo(i,a-1e3*(l+1)*s),u.stroke();u.strokeStyle=r,u.lineWidth=8,u.beginPath(),u.moveTo(0,a-s*e[1]);for(let l=2;l<e.length;l++)u.lineTo((l-1)*c,a-s*e[l]);u.stroke(),u.strokeStyle=n,u.lineWidth=2,u.beginPath(),u.moveTo(0,a-s*t[1]);for(let l=2;l<t.length;l++)u.lineTo((l-1)*c,a-s*t[l]);u.stroke()}},created(){this.monitor=new Rn(this.historyWindowSize,this.statWindowSize),this.wslinkSubscription=null,this.onStreamPacket=([e])=>{const{name:t,serverTime:r,contentSize:n}=this.packetDecorator(e);if(this.name===t){const i=this.monitor.addEntry(r,n);i&&(this.avg=i.avgFps,this.totalSize=i.totalSize,this.delta=1e3/(i.minMax[1]-i.minMax[0]),this.draw(i.client,i.server))}},this.trame&&(this.wslinkSubscription=this.trame.client.getConnection().getSession().subscribe(this.wsLinkTopic,this.onStreamPacket)),this.observer=new ResizeObserver(()=>{if(!this.$el)return;const{width:e,height:t}=this.$el.getBoundingClientRect();this.cw=e,this.ch=t})},mounted(){this.observer.observe(this.$el)},beforeUnmount(){this.observer.unobserve(this.$el),this.wslinkSubscription&&this.trame&&(this.trame.client.getConnection().getSession().unsubscribe(this.wslinkSubscription),this.wslinkSubscription=null)},inject:["trame"],template:`
    <v-col style="width: 100%; height: 100%; position: relative;">
      <v-row class="text-subtitle-2" style="position: absolute; top: 0; left: 0; width: 100%; z-index: 1;">
        <v-icon>mdi-gauge</v-icon>
        <v-spacer />
        <div>
          {{ avg.toFixed(1) }} fps
        </div>
        <v-spacer />
        <v-icon>mdi-database-import</v-icon>
        <v-spacer />
        <div>
          {{ sizeUnit(totalSize) }}
        </div>
      </v-row>
      <canvas style="position: absolute; left: 0; top: 0;" class="js-canvas" :width="cw" :height="ch">
      </canvas>
    </v-col>
  `};function Me(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Dn(e){if(Array.isArray(e))return Me(e)}function jn(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function at(e,t){if(e){if(typeof e=="string")return Me(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Me(e,t)}}function Cn(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function se(e){return Dn(e)||jn(e)||at(e)||Cn()}function V(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _n(e){if(Array.isArray(e))return e}function Ln(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],i=!0,h=!1,v,u;try{for(r=r.call(e);!(i=(v=r.next()).done)&&(n.push(v.value),!(t&&n.length===t));i=!0);}catch(a){h=!0,u=a}finally{try{!i&&r.return!=null&&r.return()}finally{if(h)throw u}}return n}}function Fn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function De(e,t){return _n(e)||Ln(e,t)||at(e,t)||Fn()}function K(e){"@babel/helpers - typeof";return K=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},K(e)}function ue(e,t){return ue=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},ue(e,t)}function Un(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ce(e,t,r){return Un()?ce=Reflect.construct:ce=function(i,h,v){var u=[null];u.push.apply(u,h);var a=Function.bind.apply(i,u),s=new a;return v&&ue(s,v.prototype),s},ce.apply(null,arguments)}var B=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function it(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Bn(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}),r}var Wn=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,i,h;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(i=n;i--!==0;)if(!e(t[i],r[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(h=Object.keys(t),n=h.length,n!==Object.keys(r).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(r,h[i]))return!1;for(i=n;i--!==0;){var v=h[i];if(!e(t[v],r[v]))return!1}return!0}return t!==t&&r!==r};const zn=it(Wn);var st=Object.prototype.toString,ut=function(t){var r=st.call(t),n=r==="[object Arguments]";return n||(n=r!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&st.call(t.callee)==="[object Function]"),n},je,ct;function $n(){if(ct)return je;ct=1;var e;if(!Object.keys){var t=Object.prototype.hasOwnProperty,r=Object.prototype.toString,n=ut,i=Object.prototype.propertyIsEnumerable,h=!i.call({toString:null},"toString"),v=i.call(function(){},"prototype"),u=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],a=function(p){var o=p.constructor;return o&&o.prototype===p},s={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},c=function(){if(typeof window>"u")return!1;for(var p in window)try{if(!s["$"+p]&&t.call(window,p)&&window[p]!==null&&typeof window[p]=="object")try{a(window[p])}catch{return!0}}catch{return!0}return!1}(),l=function(p){if(typeof window>"u"||!c)return a(p);try{return a(p)}catch{return!1}};e=function(o){var f=o!==null&&typeof o=="object",y=r.call(o)==="[object Function]",g=n(o),m=f&&r.call(o)==="[object String]",w=[];if(!f&&!y&&!g)throw new TypeError("Object.keys called on a non-object");var T=v&&y;if(m&&o.length>0&&!t.call(o,0))for(var d=0;d<o.length;++d)w.push(String(d));if(g&&o.length>0)for(var S=0;S<o.length;++S)w.push(String(S));else for(var E in o)!(T&&E==="prototype")&&t.call(o,E)&&w.push(String(E));if(h)for(var O=l(o),b=0;b<u.length;++b)!(O&&u[b]==="constructor")&&t.call(o,u[b])&&w.push(u[b]);return w}}return je=e,je}var Gn=Array.prototype.slice,Nn=ut,ft=Object.keys,de=ft?function(t){return ft(t)}:$n(),lt=Object.keys;de.shim=function(){if(Object.keys){var t=function(){var r=Object.keys(arguments);return r&&r.length===arguments.length}(1,2);t||(Object.keys=function(n){return Nn(n)?lt(Gn.call(n)):lt(n)})}else Object.keys=de;return Object.keys||de};var Vn=de,Kn=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;t[r]=i;for(r in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var h=Object.getOwnPropertySymbols(t);if(h.length!==1||h[0]!==r||!Object.prototype.propertyIsEnumerable.call(t,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var v=Object.getOwnPropertyDescriptor(t,r);if(v.value!==i||v.enumerable!==!0)return!1}return!0},ht=typeof Symbol<"u"&&Symbol,qn=Kn,Pn=function(){return typeof ht!="function"||typeof Symbol!="function"||typeof ht("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:qn()},pt={foo:{}},Xn=Object,Hn=function(){return{__proto__:pt}.foo===pt.foo&&!({__proto__:null}instanceof Xn)},Yn="Function.prototype.bind called on incompatible ",An=Object.prototype.toString,Jn=Math.max,Zn="[object Function]",vt=function(t,r){for(var n=[],i=0;i<t.length;i+=1)n[i]=t[i];for(var h=0;h<r.length;h+=1)n[h+t.length]=r[h];return n},Qn=function(t,r){for(var n=[],i=r||0,h=0;i<t.length;i+=1,h+=1)n[h]=t[i];return n},In=function(e,t){for(var r="",n=0;n<e.length;n+=1)r+=e[n],n+1<e.length&&(r+=t);return r},er=function(t){var r=this;if(typeof r!="function"||An.apply(r)!==Zn)throw new TypeError(Yn+r);for(var n=Qn(arguments,1),i,h=function(){if(this instanceof i){var c=r.apply(this,vt(n,arguments));return Object(c)===c?c:this}return r.apply(t,vt(n,arguments))},v=Jn(0,r.length-n.length),u=[],a=0;a<v;a++)u[a]="$"+a;if(i=Function("binder","return function ("+In(u,",")+"){ return binder.apply(this,arguments); }")(h),r.prototype){var s=function(){};s.prototype=r.prototype,i.prototype=new s,s.prototype=null}return i},tr=er,nr=Function.prototype.bind||tr,yt={}.hasOwnProperty,Ce=Function.prototype.call,rr=Ce.bind?Ce.bind(yt):function(e,t){return Ce.call(yt,e,t)},x,Q=SyntaxError,dt=Function,I=TypeError,_e=function(e){try{return dt('"use strict"; return ('+e+").constructor;")()}catch{}},q=Object.getOwnPropertyDescriptor;if(q)try{q({},"")}catch{q=null}var Le=function(){throw new I},or=q?function(){try{return arguments.callee,Le}catch{try{return q(arguments,"callee").get}catch{return Le}}}():Le,ee=Pn(),ar=Hn(),j=Object.getPrototypeOf||(ar?function(e){return e.__proto__}:null),te={},ir=typeof Uint8Array>"u"||!j?x:j(Uint8Array),P={"%AggregateError%":typeof AggregateError>"u"?x:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?x:ArrayBuffer,"%ArrayIteratorPrototype%":ee&&j?j([][Symbol.iterator]()):x,"%AsyncFromSyncIteratorPrototype%":x,"%AsyncFunction%":te,"%AsyncGenerator%":te,"%AsyncGeneratorFunction%":te,"%AsyncIteratorPrototype%":te,"%Atomics%":typeof Atomics>"u"?x:Atomics,"%BigInt%":typeof BigInt>"u"?x:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?x:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?x:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?x:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?x:Float32Array,"%Float64Array%":typeof Float64Array>"u"?x:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?x:FinalizationRegistry,"%Function%":dt,"%GeneratorFunction%":te,"%Int8Array%":typeof Int8Array>"u"?x:Int8Array,"%Int16Array%":typeof Int16Array>"u"?x:Int16Array,"%Int32Array%":typeof Int32Array>"u"?x:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":ee&&j?j(j([][Symbol.iterator]())):x,"%JSON%":typeof JSON=="object"?JSON:x,"%Map%":typeof Map>"u"?x:Map,"%MapIteratorPrototype%":typeof Map>"u"||!ee||!j?x:j(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?x:Promise,"%Proxy%":typeof Proxy>"u"?x:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?x:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?x:Set,"%SetIteratorPrototype%":typeof Set>"u"||!ee||!j?x:j(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?x:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":ee&&j?j(""[Symbol.iterator]()):x,"%Symbol%":ee?Symbol:x,"%SyntaxError%":Q,"%ThrowTypeError%":or,"%TypedArray%":ir,"%TypeError%":I,"%Uint8Array%":typeof Uint8Array>"u"?x:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?x:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?x:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?x:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?x:WeakMap,"%WeakRef%":typeof WeakRef>"u"?x:WeakRef,"%WeakSet%":typeof WeakSet>"u"?x:WeakSet};if(j)try{null.error}catch(e){var sr=j(j(e));P["%Error.prototype%"]=sr}var ur=function e(t){var r;if(t==="%AsyncFunction%")r=_e("async function () {}");else if(t==="%GeneratorFunction%")r=_e("function* () {}");else if(t==="%AsyncGeneratorFunction%")r=_e("async function* () {}");else if(t==="%AsyncGenerator%"){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=e("%AsyncGenerator%");i&&j&&(r=j(i.prototype))}return P[t]=r,r},gt={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},fe=nr,ge=rr,cr=fe.call(Function.call,Array.prototype.concat),fr=fe.call(Function.apply,Array.prototype.splice),mt=fe.call(Function.call,String.prototype.replace),me=fe.call(Function.call,String.prototype.slice),lr=fe.call(Function.call,RegExp.prototype.exec),hr=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,pr=/\\(\\)?/g,vr=function(t){var r=me(t,0,1),n=me(t,-1);if(r==="%"&&n!=="%")throw new Q("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new Q("invalid intrinsic syntax, expected opening `%`");var i=[];return mt(t,hr,function(h,v,u,a){i[i.length]=u?mt(a,pr,"$1"):v||h}),i},yr=function(t,r){var n=t,i;if(ge(gt,n)&&(i=gt[n],n="%"+i[0]+"%"),ge(P,n)){var h=P[n];if(h===te&&(h=ur(n)),typeof h>"u"&&!r)throw new I("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:h}}throw new Q("intrinsic "+t+" does not exist!")},Fe=function(t,r){if(typeof t!="string"||t.length===0)throw new I("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new I('"allowMissing" argument must be a boolean');if(lr(/^%?[^%]*%?$/,t)===null)throw new Q("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=vr(t),i=n.length>0?n[0]:"",h=yr("%"+i+"%",r),v=h.name,u=h.value,a=!1,s=h.alias;s&&(i=s[0],fr(n,cr([0,1],s)));for(var c=1,l=!0;c<n.length;c+=1){var p=n[c],o=me(p,0,1),f=me(p,-1);if((o==='"'||o==="'"||o==="`"||f==='"'||f==="'"||f==="`")&&o!==f)throw new Q("property names with quotes must have matching quotes");if((p==="constructor"||!l)&&(a=!0),i+="."+p,v="%"+i+"%",ge(P,v))u=P[v];else if(u!=null){if(!(p in u)){if(!r)throw new I("base intrinsic for "+t+" exists, but the property is not available.");return}if(q&&c+1>=n.length){var y=q(u,p);l=!!y,l&&"get"in y&&!("originalValue"in y.get)?u=y.get:u=u[p]}else l=ge(u,p),u=u[p];l&&!a&&(P[v]=u)}}return u},dr=Fe,Ue=dr("%Object.defineProperty%",!0),Be=function(){if(Ue)try{return Ue({},"a",{value:1}),!0}catch{return!1}return!1};Be.hasArrayLengthDefineBug=function(){if(!Be())return null;try{return Ue([],"length",{value:1}).length!==1}catch{return!0}};var wt=Be,We,St;function gr(){if(St)return We;St=1;var e=Fe,t=e("%Object.getOwnPropertyDescriptor%",!0);if(t)try{t([],"length")}catch{t=null}return We=t,We}var mr=wt(),ze=Fe,le=mr&&ze("%Object.defineProperty%",!0);if(le)try{le({},"a",{value:1})}catch{le=!1}var wr=ze("%SyntaxError%"),ne=ze("%TypeError%"),Et=gr(),Sr=function(t,r,n){if(!t||typeof t!="object"&&typeof t!="function")throw new ne("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new ne("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new ne("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new ne("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new ne("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new ne("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,h=arguments.length>4?arguments[4]:null,v=arguments.length>5?arguments[5]:null,u=arguments.length>6?arguments[6]:!1,a=!!Et&&Et(t,r);if(le)le(t,r,{configurable:v===null&&a?a.configurable:!v,enumerable:i===null&&a?a.enumerable:!i,value:n,writable:h===null&&a?a.writable:!h});else if(u||!i&&!h&&!v)t[r]=n;else throw new wr("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Er=Vn,Or=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",br=Object.prototype.toString,xr=Array.prototype.concat,Ot=Sr,Tr=function(e){return typeof e=="function"&&br.call(e)==="[object Function]"},bt=wt(),kr=function(e,t,r,n){if(t in e){if(n===!0){if(e[t]===r)return}else if(!Tr(n)||!n())return}bt?Ot(e,t,r,!0):Ot(e,t,r)},xt=function(e,t){var r=arguments.length>2?arguments[2]:{},n=Er(t);Or&&(n=xr.call(n,Object.getOwnPropertySymbols(t)));for(var i=0;i<n.length;i+=1)kr(e,n[i],t[n[i]],r[n[i]])};xt.supportsDescriptors=!!bt;var Tt=xt,we={exports:{}};typeof self<"u"?we.exports=self:typeof window<"u"?we.exports=window:we.exports=Function("return this")();var kt=we.exports,Rr=kt,Rt=function(){return typeof B!="object"||!B||B.Math!==Math||B.Array!==Array?Rr:B},Mr=Tt,Dr=Rt,jr=function(){var t=Dr();if(Mr.supportsDescriptors){var r=Object.getOwnPropertyDescriptor(t,"globalThis");(!r||r.configurable&&(r.enumerable||!r.writable||globalThis!==t))&&Object.defineProperty(t,"globalThis",{configurable:!0,enumerable:!1,value:t,writable:!0})}else(typeof globalThis!="object"||globalThis!==t)&&(t.globalThis=t);return t},Cr=Tt,_r=kt,Mt=Rt,Lr=jr,Fr=Mt(),Dt=function(){return Fr};Cr(Dt,{getPolyfill:Mt,implementation:_r,shim:Lr});var Ur=Dt;const Br=it(Ur);function jt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Wr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?jt(Object(r),!0).forEach(function(n){V(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):jt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var z=Br(),Ct={vtkObject:function(){return null}};function X(e){if(e==null||e.isA)return e;if(!e.vtkClass)return z.console&&z.console.error&&z.console.error("Invalid VTK object"),null;var t=Ct[e.vtkClass];if(!t)return z.console&&z.console.error&&z.console.error("No vtk class found for Object of type ".concat(e.vtkClass)),null;var r=Wr({},e);Object.keys(r).forEach(function(i){r[i]&&K(r[i])==="object"&&r[i].vtkClass&&(r[i]=X(r[i]))});var n=t(r);return n&&n.modified&&n.modified(),n}function zr(e,t){Ct[e]=t}X.register=zr;function $r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _t(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Gr(e,t,r){return t&&_t(e.prototype,t),r&&_t(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function H(e){return H=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},H(e)}function Nr(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=H(e),e!==null););return e}function Se(){return typeof Reflect<"u"&&Reflect.get?Se=Reflect.get:Se=function(t,r,n){var i=Nr(t,r);if(i){var h=Object.getOwnPropertyDescriptor(i,r);return h.get?h.get.call(arguments.length<3?t:n):h.value}},Se.apply(this,arguments)}function Vr(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ue(e,t)}function Kr(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function qr(e,t){if(t&&(K(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Kr(e)}function Pr(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function $e(e){var t=typeof Map=="function"?new Map:void 0;return $e=function(n){if(n===null||!Pr(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof t<"u"){if(t.has(n))return t.get(n);t.set(n,i)}function i(){return ce(n,arguments,H(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),ue(i,n)},$e(e)}function Xr(e){var t=Hr();return function(){var n=H(e),i;if(t){var h=H(this).constructor;i=Reflect.construct(n,arguments,h)}else i=n.apply(this,arguments);return qr(this,i)}}function Hr(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Ge=function(e){Vr(r,e);var t=Xr(r);function r(){return $r(this,r),t.apply(this,arguments)}return Gr(r,[{key:"push",value:function(){for(var i=0;i<arguments.length;i++)this.includes(arguments[i])||Se(H(r.prototype),"push",this).call(this,arguments[i]);return this.length}}]),r}($e(Array));function Lt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ee(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Lt(Object(r),!0).forEach(function(n){V(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Lt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var Ne=0,Yr=Symbol("void");function Ar(){return Ne}var Ft={};function Y(){}var Jr=["log","debug","info","warn","error","time","timeEnd","group","groupEnd"];Jr.forEach(function(e){Ft[e]=Y}),z.console=console.hasOwnProperty("log")?console:Ft;var U={debug:Y,error:z.console.error||Y,info:z.console.info||Y,log:z.console.log||Y,warn:z.console.warn||Y};function Zr(e,t){U[e]&&(U[e]=t||Y)}function Qr(){U.log.apply(U,arguments)}function Ir(){U.info.apply(U,arguments)}function Ve(){U.debug.apply(U,arguments)}function C(){U.error.apply(U,arguments)}function Ut(){U.warn.apply(U,arguments)}var Bt={};function eo(e){Bt[e]||(U.error(e),Bt[e]=!0)}var F=Object.create(null);F.Float32Array=Float32Array,F.Float64Array=Float64Array,F.Uint8Array=Uint8Array,F.Int8Array=Int8Array,F.Uint16Array=Uint16Array,F.Int16Array=Int16Array,F.Uint32Array=Uint32Array,F.Int32Array=Int32Array,F.Uint8ClampedArray=Uint8ClampedArray;try{F.BigInt64Array=BigInt64Array,F.BigUint64Array=BigUint64Array}catch{}function to(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return ce(F[e]||Float64Array,r)}function no(e){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return(t=F[e]||Float64Array).from.apply(t,n)}function Ke(e){return e.charAt(0).toUpperCase()+e.slice(1)}function D(e){return Ke(e[0]==="_"?e.slice(1):e)}function ro(e){return e.charAt(0).toLowerCase()+e.slice(1)}function oo(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1e3,n=["TB","GB","MB","KB"],i=Number(e),h="B";i>r;)i/=r,h=n.pop();return"".concat(i.toFixed(t)," ").concat(h)}function ao(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:" ",r=[],n=e;n>1e3;)r.push("000".concat(n%1e3).slice(-3)),n=Math.floor(n/1e3);return n>0&&r.push(n),r.reverse(),r.join(t)}function Wt(e){Object.keys(e).forEach(function(t){Array.isArray(e[t])&&(e[t]=[].concat(e[t]))})}function io(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}return!1}function so(e,t){return Object.keys(e).find(function(r){return e[r]===t})}function zt(e){return e&&e.isA?e.getState():e}function $t(e){setTimeout(e,0)}function uo(e,t){var r=performance.now();e.finally(function(){var n=performance.now()-r;t(n)})}function co(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Wt(t);var r=[];if(Number.isInteger(t.mtime)||(t.mtime=++Ne),!("classHierarchy"in t))t.classHierarchy=new Ge("vtkObject");else if(!(t.classHierarchy instanceof Ge)){for(var n=new Ge,i=0;i<t.classHierarchy.length;i++)n.push(t.classHierarchy[i]);t.classHierarchy=n}function h(u){r[u]=null}function v(u){function a(){h(u)}return Object.freeze({unsubscribe:a})}return e.isDeleted=function(){return!!t.deleted},e.modified=function(u){if(t.deleted){C("instance deleted - cannot call any method");return}u&&u<e.getMTime()||(t.mtime=++Ne,r.forEach(function(a){return a&&a(e)}))},e.onModified=function(u){if(t.deleted)return C("instance deleted - cannot call any method"),null;var a=r.length;return r.push(u),v(a)},e.getMTime=function(){return t.mtime},e.isA=function(u){for(var a=t.classHierarchy.length;a--;)if(t.classHierarchy[a]===u)return!0;return!1},e.getClassName=function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return t.classHierarchy[t.classHierarchy.length-1-u]},e.set=function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,c=!1;return Object.keys(u).forEach(function(l){var p=s?null:e["set".concat(Ke(l))];p&&Array.isArray(u[l])&&p.length>1?c=p.apply(void 0,se(u[l]))||c:p?c=p(u[l])||c:(["mtime"].indexOf(l)===-1&&!a&&Ut("Warning: Set value to model directly ".concat(l,", ").concat(u[l])),c=t[l]!==u[l]||c,t[l]=u[l])}),c},e.get=function(){for(var u=arguments.length,a=new Array(u),s=0;s<u;s++)a[s]=arguments[s];if(!a.length)return t;var c={};return a.forEach(function(l){c[l]=t[l]}),c},e.getReferenceByName=function(u){return t[u]},e.delete=function(){Object.keys(t).forEach(function(u){return delete t[u]}),r.forEach(function(u,a){return h(a)}),t.deleted=!0},e.getState=function(){if(t.deleted)return null;var u=Ee(Ee({},t),{},{vtkClass:e.getClassName()});Object.keys(u).forEach(function(s){u[s]===null||u[s]===void 0||s[0]==="_"?delete u[s]:u[s].isA?u[s]=u[s].getState():Array.isArray(u[s])&&(u[s]=u[s].map(zt))});var a={};return Object.keys(u).sort().forEach(function(s){a[s]=u[s]}),a.mtime&&delete a.mtime,a},e.shallowCopy=function(u){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(u.getClassName()!==e.getClassName())throw new Error("Cannot ShallowCopy ".concat(u.getClassName()," into ").concat(e.getClassName()));var s=u.get(),c=Object.keys(t).sort(),l=Object.keys(s).sort();l.forEach(function(p){var o=c.indexOf(p);o===-1?a&&Ve("add ".concat(p," in shallowCopy")):c.splice(o,1),t[p]=s[p]}),c.length&&a&&Ve("Untouched keys: ".concat(c.join(", "))),e.modified()},e.toJSON=function(){return e.getState()},e}var fo={object:function(t,r,n){return function(){return Ee({},r[n.name])}}};function Oe(e,t,r){r.forEach(function(n){if(K(n)==="object"){var i=fo[n.type];i?e["get".concat(D(n.name))]=i(e,t,n):e["get".concat(D(n.name))]=function(){return t[n.name]}}else e["get".concat(D(n))]=function(){return t[n]}})}var lo={enum:function(t,r,n){var i="_on".concat(D(n.name),"Changed");return function(h){if(typeof h=="string"){if(n.enum[h]!==void 0)return r[n.name]!==n.enum[h]?(r[n.name]=n.enum[h],t.modified(),!0):!1;throw C("Set Enum with invalid argument ".concat(n,", ").concat(h)),new RangeError("Set Enum with invalid string argument")}if(typeof h=="number"){if(r[n.name]!==h){if(Object.keys(n.enum).map(function(a){return n.enum[a]}).indexOf(h)!==-1){var v,u=r[n.name];return r[n.name]=h,(v=r[i])===null||v===void 0||v.call(r,t,r,h,u),t.modified(),!0}throw C("Set Enum outside numeric range ".concat(n,", ").concat(h)),new RangeError("Set Enum outside numeric range")}return!1}throw C("Set Enum with invalid argument (String/Number) ".concat(n,", ").concat(h)),new TypeError("Set Enum with invalid argument (String/Number)")}},object:function(t,r,n){var i="_on".concat(D(n.name),"Changed");return function(h){if(!zn(r[n.name],h)){var v,u=r[n.name];return r[n.name]=h,(v=r[i])===null||v===void 0||v.call(r,t,r,h,u),t.modified(),!0}return!1}}};function Gt(e){if(K(e)==="object"){var t=lo[e.type];if(t)return function(r,n){return t(r,n,e)};throw C("No setter for field ".concat(e)),new TypeError("No setter for field")}return function(n,i){var h="_on".concat(D(e),"Changed");return function(u){if(i.deleted)return C("instance deleted - cannot call any method"),!1;if(i[e]!==u){var a,s=i[e.name];return i[e]=u,(a=i[h])===null||a===void 0||a.call(i,n,i,u,s),n.modified(),!0}return!1}}}function Nt(e,t,r){r.forEach(function(n){K(n)==="object"?e["set".concat(D(n.name))]=Gt(n)(e,t):e["set".concat(D(n))]=Gt(n)(e,t)})}function Vt(e,t,r){Oe(e,t,r),Nt(e,t,r)}function Kt(e,t,r){r.forEach(function(n){e["get".concat(D(n))]=function(){return t[n]?Array.from(t[n]):t[n]},e["get".concat(D(n),"ByReference")]=function(){return t[n]}})}function qt(e,t,r,n){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:void 0;r.forEach(function(h){if(t[h]&&n&&t[h].length!==n)throw new RangeError("Invalid initial number of values for array (".concat(h,")"));var v="_on".concat(D(h),"Changed");e["set".concat(D(h))]=function(){if(t.deleted)return C("instance deleted - cannot call any method"),!1;for(var u=arguments.length,a=new Array(u),s=0;s<u;s++)a[s]=arguments[s];var c=a,l,p=!1;if(c.length===1&&(c[0]==null||c[0].length>=0)&&(c=c[0],p=!0),c==null)l=t[h]!==c;else{if(n&&c.length!==n)if(c.length<n&&i!==void 0)for(c=Array.from(c),p=!1;c.length<n;)c.push(i);else throw new RangeError("Invalid number of values for array setter (".concat(h,")"));l=t[h]==null||t[h].length!==c.length;for(var o=0;!l&&o<c.length;++o)l=t[h][o]!==c[o];l&&p&&(c=Array.from(c))}if(l){var f,y=t[h.name];t[h]=c,(f=t[v])===null||f===void 0||f.call(t,e,t,c,y),e.modified()}return l},e["set".concat(D(h),"From")]=function(u){var a=t[h];u.forEach(function(s,c){a[c]=s})}})}function ho(e,t,r,n){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:void 0;Kt(e,t,r),qt(e,t,r,n,i)}function po(e,t,r){for(var n=0;n<r.length;n++){var i=r[n];t[i]!==void 0&&(t["_".concat(i)]=t[i],delete t[i])}}function vo(e,t,r,n){t.inputData?t.inputData=t.inputData.map(X):t.inputData=[],t.inputConnection?t.inputConnection=t.inputConnection.map(X):t.inputConnection=[],t.output?t.output=t.output.map(X):t.output=[],t.inputArrayToProcess?t.inputArrayToProcess=t.inputArrayToProcess.map(X):t.inputArrayToProcess=[],t.numberOfInputs=r;function i(f){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(t.deleted){C("instance deleted - cannot call any method");return}if(y>=t.numberOfInputs){C("algorithm ".concat(e.getClassName()," only has ").concat(t.numberOfInputs," input ports. To add more input ports, use addInputData()"));return}(t.inputData[y]!==f||t.inputConnection[y])&&(t.inputData[y]=f,t.inputConnection[y]=null,e.modified&&e.modified())}function h(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return t.inputConnection[f]&&(t.inputData[f]=t.inputConnection[f]()),t.inputData[f]}function v(f){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(t.deleted){C("instance deleted - cannot call any method");return}if(y>=t.numberOfInputs){var g="algorithm ".concat(e.getClassName()," only has ");g+="".concat(t.numberOfInputs),g+=" input ports. To add more input ports, use addInputConnection()",C(g);return}t.inputData[y]=null,t.inputConnection[y]=f}function u(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return t.inputConnection[f]}function a(){for(var f=t.numberOfInputs;f&&!t.inputData[f-1]&&!t.inputConnection[f-1];)f--;return f===t.numberOfInputs&&t.numberOfInputs++,f}function s(f){if(t.deleted){C("instance deleted - cannot call any method");return}v(f,a())}function c(f){if(t.deleted){C("instance deleted - cannot call any method");return}i(f,a())}function l(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return t.deleted?(C("instance deleted - cannot call any method"),null):(e.shouldUpdate()&&e.update(),t.output[f])}e.shouldUpdate=function(){for(var f=e.getMTime(),y=1/0,g=n;g--;){if(!t.output[g]||t.output[g].isDeleted())return!0;var m=t.output[g].getMTime();if(m<f)return!0;m<y&&(y=m)}for(g=t.numberOfInputs;g--;){var w,T;if((w=t.inputConnection[g])!==null&&w!==void 0&&w.filter.shouldUpdate()||((T=e.getInputData(g))===null||T===void 0?void 0:T.getMTime())>y)return!0}return!1};function p(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,y=function(){return l(f)};return y.filter=e,y}if(t.numberOfInputs){for(var o=t.numberOfInputs;o--;)t.inputData.push(null),t.inputConnection.push(null);e.setInputData=i,e.setInputConnection=v,e.addInputData=c,e.addInputConnection=s,e.getInputData=h,e.getInputConnection=u}n&&(e.getOutputData=l,e.getOutputPort=p),e.update=function(){var f=[];if(t.numberOfInputs)for(var y=0;y<t.numberOfInputs;)f[y]=e.getInputData(y),y++;e.shouldUpdate()&&e.requestData&&e.requestData(f,t.output)},e.getNumberOfInputPorts=function(){return t.numberOfInputs},e.getNumberOfOutputPorts=function(){return n||t.output.length},e.getInputArrayToProcess=function(f){var y=t.inputArrayToProcess[f],g=t.inputData[f];return y&&g?g["get".concat(y.fieldAssociation)]().getArray(y.arrayName):null},e.setInputArrayToProcess=function(f,y,g){for(var m=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"Scalars";t.inputArrayToProcess.length<f;)t.inputArrayToProcess.push(null);t.inputArrayToProcess[f]={arrayName:y,fieldAssociation:g,attributeType:m}}}var Pt=Symbol("Event abort");function yo(e,t,r){var n=[],i=e.delete,h=1;function v(s){for(var c=0;c<n.length;++c){var l=De(n[c],1),p=l[0];if(p===s){n.splice(c,1);return}}}function u(s){function c(){v(s)}return Object.freeze({unsubscribe:c})}function a(){var s=arguments;if(t.deleted){C("instance deleted - cannot call any method");return}for(var c=n.slice(),l=function(y){var g=De(c[y],3),m=g[1],w=g[2];if(!m)return"continue";if(w<0)setTimeout(function(){return m.apply(e,s)},1-w);else{var T=m.apply(e,s);if(T===Pt)return"break"}},p=0;p<c.length;++p){var o=l(p);if(o!=="continue"&&o==="break")break}}e["invoke".concat(D(r))]=a,e["on".concat(D(r))]=function(s){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(!s.apply)return console.error("Invalid callback for event ".concat(r)),null;if(t.deleted)return C("instance deleted - cannot call any method"),null;var l=h++;return n.push([l,s,c]),n.sort(function(p,o){return o[2]-p[2]}),u(l)},e.delete=function(){i(),n.forEach(function(s){var c=De(s,1),l=c[0];return v(l)})}}function go(e,t){var r=function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},h={},v={};return e(v,h,i),Object.freeze(v)};return t&&X.register(t,r),r}function mo(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(){for(var n=arguments.length,i=new Array(n),h=0;h<n;h++)i[h]=arguments[h];return t.filter(function(v){return!!v}).map(function(v){return v.apply(void 0,i)})}}function Xt(e){return e&&e.isA&&e.isA("vtkObject")}function qe(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:[];if(Xt(e)){if(n.indexOf(e)>=0)return r;n.push(e);var i=t(e);i!==void 0&&r.push(i);var h=e.get();Object.keys(h).forEach(function(v){var u=h[v];Array.isArray(u)?u.forEach(function(a){qe(a,t,r,n)}):qe(u,t,r,n)})}return r}function wo(e,t,r){var n=this,i,h=function(){for(var u=arguments.length,a=new Array(u),s=0;s<u;s++)a[s]=arguments[s];var c=n,l=function(){i=null,r||e.apply(c,a)},p=r&&!i;clearTimeout(i),i=setTimeout(l,t),p&&e.apply(c,a)};return h.cancel=function(){return clearTimeout(i)},h}function So(e,t){var r=!1,n=null;function i(){r=!1,n!==null&&(h.apply(void 0,se(n)),n=null)}function h(){for(var v=arguments.length,u=new Array(v),a=0;a<v;a++)u[a]=arguments[a];if(r){n=u;return}r=!0,e.apply(void 0,u),setTimeout(i,t)}return h}function Ht(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};t.keystore=Object.assign(t.keystore||{},r),e.setKey=function(n,i){t.keystore[n]=i},e.getKey=function(n){return t.keystore[n]},e.getAllKeys=function(){return Object.keys(t.keystore)},e.deleteKey=function(n){return delete t.keystore[n]},e.clearKeystore=function(){return e.getAllKeys().forEach(function(n){return delete t.keystore[n]})}}var Eo=1,be="__root__";function Oo(e,t){Ht(e,t);var r=e.delete;t.proxyId="".concat(Eo++),t.ui=JSON.parse(JSON.stringify(t.ui||[])),Oe(e,t,["proxyId","proxyGroup","proxyName"]),Vt(e,t,["proxyManager"]);var n={},i={};function h(s,c){i[c]||(i[c]=[]);for(var l=i[c],p=0;p<s.length;p++)l.push(s[p].name),n[s[p].name]=s[p],s[p].children&&s[p].children.length&&h(s[p].children,s[p].name)}h(t.ui,be),e.updateUI=function(s){t.ui=JSON.parse(JSON.stringify(s||[])),Object.keys(n).forEach(function(c){return delete n[c]}),Object.keys(i).forEach(function(c){return delete i[c]}),h(t.ui,be),e.modified()};function v(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:be;return i[s]}e.updateProxyProperty=function(s,c){var l=n[s];l?Object.assign(l,c):n[s]=Ee({},c)},e.activate=function(){if(t.proxyManager){var s="setActive".concat(D(e.getProxyGroup().slice(0,-1)));t.proxyManager[s]&&t.proxyManager[s](e)}},t.propertyLinkSubscribers={},e.registerPropertyLinkForGC=function(s,c){c in t.propertyLinkSubscribers||(t.propertyLinkSubscribers[c]=[]),t.propertyLinkSubscribers[c].push(s)},e.gcPropertyLinks=function(s){for(var c=t.propertyLinkSubscribers[s]||[];c.length;)c.pop().unbind(e)},t.propertyLinkMap={},e.getPropertyLink=function(s){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(t.propertyLinkMap[s])return t.propertyLinkMap[s];var l=null,p=[],o=0,f=!1;function y(d){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(f)return null;var E=[],O=null;for(o=p.length;o--;){var b=p[o];b.instance===d?O=b:E.push(b)}if(!O)return null;var M=O.instance["get".concat(D(O.propertyName))]();if(!io(M,l)||S){for(l=M,f=!0;E.length;){var _=E.pop();_.instance.set(V({},_.propertyName,l))}f=!1}return t.propertyLinkMap[s].persistent&&(t.propertyLinkMap[s].value=M),M}function g(d,S){var E=[];for(o=p.length;o--;){var O=p[o];O.instance===d&&(O.propertyName===S||S===void 0)&&(O.subscription.unsubscribe(),E.push(o))}for(;E.length;)p.splice(E.pop(),1)}function m(d,S){var E=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,O=d.onModified(y),b=p[0];return p.push({instance:d,propertyName:S,subscription:O}),E&&(t.propertyLinkMap[s].persistent&&t.propertyLinkMap[s].value!==void 0?d.set(V({},S,t.propertyLinkMap[s].value)):b&&y(b.instance,!0)),{unsubscribe:function(){return g(d,S)}}}function w(){for(;p.length;)p.pop().subscription.unsubscribe()}var T={bind:m,unbind:g,unsubscribe:w,persistent:c};return t.propertyLinkMap[s]=T,T};function u(){for(var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:be,c=[],l=t.proxyId,p=v(s)||[],o=0;o<p.length;o++){var f=p[o],y=e["get".concat(D(f))],g=y?y():void 0,m={id:l,name:f,value:g},w=u(f);w.length&&(m.children=w),c.push(m)}return c}e.listPropertyNames=function(){return u().map(function(s){return s.name})},e.getPropertyByName=function(s){return u().find(function(c){return c.name===s})},e.getPropertyDomainByName=function(s){return(n[s]||{}).domain},e.getProxySection=function(){return{id:t.proxyId,name:t.proxyGroup,ui:t.ui,properties:u()}},e.delete=function(){for(var s=Object.keys(t.propertyLinkMap),c=s.length;c--;)t.propertyLinkMap[s[c]].unsubscribe();Object.keys(t.propertyLinkSubscribers).forEach(e.gcPropertyLinks),r()},e.getState=function(){return null};function a(){if(t.links)for(var s=0;s<t.links.length;s++){var c=t.links[s],l=c.link,p=c.property,o=c.persistent,f=c.updateOnBind,y=c.type;if(y==="application"){var g=t.proxyManager.getPropertyLink(l,o);e.registerPropertyLinkForGC(g,"application"),g.bind(e,p,f)}}}$t(a)}function bo(e,t,r){for(var n=e.delete,i=[],h=Object.keys(r),v=h.length;v--;){var u=h[v],a=r[u],s=a.modelKey,c=a.property,l=a.modified,p=l===void 0?!0:l,o=D(c),f=D(u);e["get".concat(f)]=t[s]["get".concat(o)],e["set".concat(f)]=t[s]["set".concat(o)],p&&i.push(t[s].onModified(e.modified))}e.delete=function(){for(;i.length;)i.pop().unsubscribe();n()}}function xo(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};t.this=e;function i(a){for(var s=Object.keys(a),c=s.length;c--;){var l=s[c];t[l].set(a[l])}}for(var h=Object.keys(n),v=h.length,u=function(){var s=h[v];t[s]=n[s];var c=r[s];e["set".concat(D(s))]=function(l){if(l!==t[s]){t[s]=l;var p=c[l];i(p),e.modified()}}};v--;)u();h.length&&Oe(e,t,h)}var Yt=10,At=40,Jt=800;function To(e){var t=0,r=0,n=0,i=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=t*Yt,i=r*Yt,"deltaY"in e&&(i=e.deltaY),"deltaX"in e&&(n=e.deltaX),(n||i)&&e.deltaMode&&(e.deltaMode===1?(n*=At,i*=At):(n*=Jt,i*=Jt)),n&&!t&&(t=n<1?-1:1),i&&!r&&(r=i<1?-1:1),{spinX:t,spinY:r,pixelX:n,pixelY:i}}var k={algo:vo,capitalize:Ke,chain:mo,debounce:wo,enumToString:so,event:yo,EVENT_ABORT:Pt,formatBytesToProperUnit:oo,formatNumbersWithThousandSeparator:ao,get:Oe,getArray:Kt,getCurrentGlobalMTime:Ar,getStateArrayMapFunc:zt,isVtkObject:Xt,keystore:Ht,measurePromiseExecution:uo,moveToProtected:po,newInstance:go,newTypedArray:to,newTypedArrayFrom:no,normalizeWheel:To,obj:co,proxy:Oo,proxyPropertyMapping:bo,proxyPropertyState:xo,safeArrays:Wt,set:Nt,setArray:qt,setGet:Vt,setGetArray:ho,setImmediate:$t,setLoggerFunction:Zr,throttle:So,traverseInstanceTree:qe,TYPED_ARRAYS:F,uncapitalize:ro,VOID:Yr,vtkDebugMacro:Ve,vtkErrorMacro:C,vtkInfoMacro:Ir,vtkLogMacro:Qr,vtkOnceErrorMacro:eo,vtkWarningMacro:Ut},Pe={exports:{}};Pe.exports,function(e){(function(t,r,n){function i(a){var s=this,c=u();s.next=function(){var l=2091639*s.s0+s.c*23283064365386963e-26;return s.s0=s.s1,s.s1=s.s2,s.s2=l-(s.c=l|0)},s.c=1,s.s0=c(" "),s.s1=c(" "),s.s2=c(" "),s.s0-=c(a),s.s0<0&&(s.s0+=1),s.s1-=c(a),s.s1<0&&(s.s1+=1),s.s2-=c(a),s.s2<0&&(s.s2+=1),c=null}function h(a,s){return s.c=a.c,s.s0=a.s0,s.s1=a.s1,s.s2=a.s2,s}function v(a,s){var c=new i(a),l=s&&s.state,p=c.next;return p.int32=function(){return c.next()*4294967296|0},p.double=function(){return p()+(p()*2097152|0)*11102230246251565e-32},p.quick=p,l&&(typeof l=="object"&&h(l,c),p.state=function(){return h(c,{})}),p}function u(){var a=4022871197,s=function(c){c=String(c);for(var l=0;l<c.length;l++){a+=c.charCodeAt(l);var p=.02519603282416938*a;a=p>>>0,p-=a,p*=a,a=p>>>0,p-=a,a+=p*4294967296}return(a>>>0)*23283064365386963e-26};return s}r&&r.exports?r.exports=v:n&&n.amd?n(function(){return v}):this.alea=v})(B,e,!1)}(Pe);var ko=Pe.exports,Xe={exports:{}};Xe.exports,function(e){(function(t,r,n){function i(u){var a=this,s="";a.x=0,a.y=0,a.z=0,a.w=0,a.next=function(){var l=a.x^a.x<<11;return a.x=a.y,a.y=a.z,a.z=a.w,a.w^=a.w>>>19^l^l>>>8},u===(u|0)?a.x=u:s+=u;for(var c=0;c<s.length+64;c++)a.x^=s.charCodeAt(c)|0,a.next()}function h(u,a){return a.x=u.x,a.y=u.y,a.z=u.z,a.w=u.w,a}function v(u,a){var s=new i(u),c=a&&a.state,l=function(){return(s.next()>>>0)/4294967296};return l.double=function(){do var p=s.next()>>>11,o=(s.next()>>>0)/4294967296,f=(p+o)/(1<<21);while(f===0);return f},l.int32=s.next,l.quick=l,c&&(typeof c=="object"&&h(c,s),l.state=function(){return h(s,{})}),l}r&&r.exports?r.exports=v:n&&n.amd?n(function(){return v}):this.xor128=v})(B,e,!1)}(Xe);var Ro=Xe.exports,He={exports:{}};He.exports,function(e){(function(t,r,n){function i(u){var a=this,s="";a.next=function(){var l=a.x^a.x>>>2;return a.x=a.y,a.y=a.z,a.z=a.w,a.w=a.v,(a.d=a.d+362437|0)+(a.v=a.v^a.v<<4^(l^l<<1))|0},a.x=0,a.y=0,a.z=0,a.w=0,a.v=0,u===(u|0)?a.x=u:s+=u;for(var c=0;c<s.length+64;c++)a.x^=s.charCodeAt(c)|0,c==s.length&&(a.d=a.x<<10^a.x>>>4),a.next()}function h(u,a){return a.x=u.x,a.y=u.y,a.z=u.z,a.w=u.w,a.v=u.v,a.d=u.d,a}function v(u,a){var s=new i(u),c=a&&a.state,l=function(){return(s.next()>>>0)/4294967296};return l.double=function(){do var p=s.next()>>>11,o=(s.next()>>>0)/4294967296,f=(p+o)/(1<<21);while(f===0);return f},l.int32=s.next,l.quick=l,c&&(typeof c=="object"&&h(c,s),l.state=function(){return h(s,{})}),l}r&&r.exports?r.exports=v:n&&n.amd?n(function(){return v}):this.xorwow=v})(B,e,!1)}(He);var Mo=He.exports,Ye={exports:{}};Ye.exports,function(e){(function(t,r,n){function i(u){var a=this;a.next=function(){var c=a.x,l=a.i,p,o;return p=c[l],p^=p>>>7,o=p^p<<24,p=c[l+1&7],o^=p^p>>>10,p=c[l+3&7],o^=p^p>>>3,p=c[l+4&7],o^=p^p<<7,p=c[l+7&7],p=p^p<<13,o^=p^p<<9,c[l]=o,a.i=l+1&7,o};function s(c,l){var p,o=[];if(l===(l|0))o[0]=l;else for(l=""+l,p=0;p<l.length;++p)o[p&7]=o[p&7]<<15^l.charCodeAt(p)+o[p+1&7]<<13;for(;o.length<8;)o.push(0);for(p=0;p<8&&o[p]===0;++p);for(p==8?o[7]=-1:o[p],c.x=o,c.i=0,p=256;p>0;--p)c.next()}s(a,u)}function h(u,a){return a.x=u.x.slice(),a.i=u.i,a}function v(u,a){u==null&&(u=+new Date);var s=new i(u),c=a&&a.state,l=function(){return(s.next()>>>0)/4294967296};return l.double=function(){do var p=s.next()>>>11,o=(s.next()>>>0)/4294967296,f=(p+o)/(1<<21);while(f===0);return f},l.int32=s.next,l.quick=l,c&&(c.x&&h(c,s),l.state=function(){return h(s,{})}),l}r&&r.exports?r.exports=v:n&&n.amd?n(function(){return v}):this.xorshift7=v})(B,e,!1)}(Ye);var Do=Ye.exports,Ae={exports:{}};Ae.exports,function(e){(function(t,r,n){function i(u){var a=this;a.next=function(){var c=a.w,l=a.X,p=a.i,o,f;return a.w=c=c+1640531527|0,f=l[p+34&127],o=l[p=p+1&127],f^=f<<13,o^=o<<17,f^=f>>>15,o^=o>>>12,f=l[p]=f^o,a.i=p,f+(c^c>>>16)|0};function s(c,l){var p,o,f,y,g,m=[],w=128;for(l===(l|0)?(o=l,l=null):(l=l+"\0",o=0,w=Math.max(w,l.length)),f=0,y=-32;y<w;++y)l&&(o^=l.charCodeAt((y+32)%l.length)),y===0&&(g=o),o^=o<<10,o^=o>>>15,o^=o<<4,o^=o>>>13,y>=0&&(g=g+1640531527|0,p=m[y&127]^=o+g,f=p==0?f+1:0);for(f>=128&&(m[(l&&l.length||0)&127]=-1),f=127,y=4*128;y>0;--y)o=m[f+34&127],p=m[f=f+1&127],o^=o<<13,p^=p<<17,o^=o>>>15,p^=p>>>12,m[f]=o^p;c.w=g,c.X=m,c.i=f}s(a,u)}function h(u,a){return a.i=u.i,a.w=u.w,a.X=u.X.slice(),a}function v(u,a){u==null&&(u=+new Date);var s=new i(u),c=a&&a.state,l=function(){return(s.next()>>>0)/4294967296};return l.double=function(){do var p=s.next()>>>11,o=(s.next()>>>0)/4294967296,f=(p+o)/(1<<21);while(f===0);return f},l.int32=s.next,l.quick=l,c&&(c.X&&h(c,s),l.state=function(){return h(s,{})}),l}r&&r.exports?r.exports=v:n&&n.amd?n(function(){return v}):this.xor4096=v})(B,e,!1)}(Ae);var jo=Ae.exports,Je={exports:{}};Je.exports,function(e){(function(t,r,n){function i(u){var a=this,s="";a.next=function(){var l=a.b,p=a.c,o=a.d,f=a.a;return l=l<<25^l>>>7^p,p=p-o|0,o=o<<24^o>>>8^f,f=f-l|0,a.b=l=l<<20^l>>>12^p,a.c=p=p-o|0,a.d=o<<16^p>>>16^f,a.a=f-l|0},a.a=0,a.b=0,a.c=-1640531527,a.d=1367130551,u===Math.floor(u)?(a.a=u/4294967296|0,a.b=u|0):s+=u;for(var c=0;c<s.length+20;c++)a.b^=s.charCodeAt(c)|0,a.next()}function h(u,a){return a.a=u.a,a.b=u.b,a.c=u.c,a.d=u.d,a}function v(u,a){var s=new i(u),c=a&&a.state,l=function(){return(s.next()>>>0)/4294967296};return l.double=function(){do var p=s.next()>>>11,o=(s.next()>>>0)/4294967296,f=(p+o)/(1<<21);while(f===0);return f},l.int32=s.next,l.quick=l,c&&(typeof c=="object"&&h(c,s),l.state=function(){return h(s,{})}),l}r&&r.exports?r.exports=v:n&&n.amd?n(function(){return v}):this.tychei=v})(B,e,!1)}(Je);var Co=Je.exports,Zt={exports:{}};const _o=Bn(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));(function(e){(function(t,r,n){var i=256,h=6,v=52,u="random",a=n.pow(i,h),s=n.pow(2,v),c=s*2,l=i-1,p;function o(d,S,E){var O=[];S=S==!0?{entropy:!0}:S||{};var b=m(g(S.entropy?[d,T(r)]:d??w(),3),O),M=new f(O),_=function(){for(var L=M.g(h),$=a,W=0;L<s;)L=(L+W)*i,$*=i,W=M.g(1);for(;L>=c;)L/=2,$/=2,W>>>=1;return(L+W)/$};return _.int32=function(){return M.g(4)|0},_.quick=function(){return M.g(4)/4294967296},_.double=_,m(T(M.S),r),(S.pass||E||function(L,$,W,N){return N&&(N.S&&y(N,M),L.state=function(){return y(M,{})}),W?(n[u]=L,$):L})(_,b,"global"in S?S.global:this==n,S.state)}function f(d){var S,E=d.length,O=this,b=0,M=O.i=O.j=0,_=O.S=[];for(E||(d=[E++]);b<i;)_[b]=b++;for(b=0;b<i;b++)_[b]=_[M=l&M+d[b%E]+(S=_[b])],_[M]=S;(O.g=function(L){for(var $,W=0,N=O.i,ae=O.j,J=O.S;L--;)$=J[N=l&N+1],W=W*i+J[l&(J[N]=J[ae=l&ae+$])+(J[ae]=$)];return O.i=N,O.j=ae,W})(i)}function y(d,S){return S.i=d.i,S.j=d.j,S.S=d.S.slice(),S}function g(d,S){var E=[],O=typeof d,b;if(S&&O=="object")for(b in d)try{E.push(g(d[b],S-1))}catch{}return E.length?E:O=="string"?d:d+"\0"}function m(d,S){for(var E=d+"",O,b=0;b<E.length;)S[l&b]=l&(O^=S[l&b]*19)+E.charCodeAt(b++);return T(S)}function w(){try{var d;return p&&(d=p.randomBytes)?d=d(i):(d=new Uint8Array(i),(t.crypto||t.msCrypto).getRandomValues(d)),T(d)}catch{var S=t.navigator,E=S&&S.plugins;return[+new Date,t,E,t.screen,T(r)]}}function T(d){return String.fromCharCode.apply(0,d)}if(m(n.random(),r),e.exports){e.exports=o;try{p=_o}catch{}}else n["seed"+u]=o})(typeof self<"u"?self:B,[],Math)})(Zt);var Lo=Zt.exports,Fo=ko,Uo=Ro,Bo=Mo,Wo=Do,zo=jo,$o=Co,re=Lo;re.alea=Fo,re.xor128=Uo,re.xorwow=Bo,re.xorshift7=Wo,re.xor4096=zo,re.tychei=$o;function Qt(e){return e*180/Math.PI}var Go={Unknown:0,LeftController:1,RightController:2},No={Unknown:0,Trigger:1,TrackPad:2,Grip:3,Thumbstick:4,A:5,B:6,ApplicationMenu:7},Vo={Unknown:0,TouchpadX:1,TouchpadY:2,ThumbstickX:3,ThumbstickY:4},Ze={Device:Go,Input:No,Axis:Vo};function It(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function R(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?It(Object(r),!0).forEach(function(n){V(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):It(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var xe=Ze.Device,A=Ze.Input,Te=k.vtkWarningMacro,ke=k.vtkErrorMacro,Ko=k.normalizeWheel,qo=k.vtkOnceErrorMacro,oe=new MouseEvent(""),Qe={"xr-standard":[A.Trigger,A.Grip,A.TrackPad,A.Thumbstick,A.A,A.B]},Ie=["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 he(e){e.cancelable&&e.preventDefault()}function Re(e){var t=Object.create(null);return e.forEach(function(r){var n=r.pointerId,i=r.position;t[n]=i}),t}function Po(e,t){t.classHierarchy.push("vtkRenderWindowInteractor");var r=new Set,n=new Map,i=1;e.start=function(){!t.initialized&&(e.initialize(),!t.initialized)||e.startEventLoop()},e.setRenderWindow=function(o){ke("you want to call setView(view) instead of setRenderWindow on a vtk.js interactor")},e.setInteractorStyle=function(o){t.interactorStyle!==o&&(t.interactorStyle!=null&&t.interactorStyle.setInteractor(null),t.interactorStyle=o,t.interactorStyle!=null&&t.interactorStyle.getInteractor()!==e&&t.interactorStyle.setInteractor(e))},e.initialize=function(){t.initialized=!0,e.enable(),e.render()},e.enable=function(){return e.setEnabled(!0)},e.disable=function(){return e.setEnabled(!1)},e.startEventLoop=function(){return Te("empty event loop")};function h(o,f){t._forcedRenderer||(t.currentRenderer=e.findPokedRenderer(o,f))}e.getCurrentRenderer=function(){return t.currentRenderer||h(0,0),t.currentRenderer};function v(o){var f=t._view.getCanvas(),y=f.getBoundingClientRect(),g=f.width/y.width,m=f.height/y.height,w={x:g*(o.clientX-y.left),y:m*(y.height-o.clientY+y.top),z:0};return(n.size<=1||!t.currentRenderer)&&h(w.x,w.y),w}var u=t._getScreenEventPositionFor||v;function a(o){return{controlKey:o.ctrlKey,altKey:o.altKey,shiftKey:o.shiftKey}}function s(o){var f=a(o),y=R({key:o.key,keyCode:o.charCode},f);return y}function c(o){return o.pointerType||""}e.bindEvents=function(o){t.container=o,o.addEventListener("contextmenu",he),o.addEventListener("wheel",e.handleWheel),o.addEventListener("DOMMouseScroll",e.handleWheel),o.addEventListener("pointerenter",e.handlePointerEnter),o.addEventListener("pointerleave",e.handlePointerLeave),o.addEventListener("pointermove",e.handlePointerMove,{passive:!1}),o.addEventListener("pointerdown",e.handlePointerDown,{passive:!1}),o.addEventListener("pointerup",e.handlePointerUp),o.addEventListener("pointercancel",e.handlePointerCancel),document.addEventListener("keypress",e.handleKeyPress),document.addEventListener("keydown",e.handleKeyDown),document.addEventListener("keyup",e.handleKeyUp),document.addEventListener("pointerlockchange",e.handlePointerLockChange),o.style.touchAction="none",o.style.userSelect="none",o.style.webkitTapHighlightColor="rgba(0,0,0,0)"},e.unbindEvents=function(){var o=t.container;o.removeEventListener("contextmenu",he),o.removeEventListener("wheel",e.handleWheel),o.removeEventListener("DOMMouseScroll",e.handleWheel),o.removeEventListener("pointerenter",e.handlePointerEnter),o.removeEventListener("pointerleave",e.handlePointerLeave),o.removeEventListener("pointermove",e.handlePointerMove,{passive:!1}),o.removeEventListener("pointerdown",e.handlePointerDown,{passive:!1}),o.removeEventListener("pointerup",e.handlePointerUp),o.removeEventListener("pointercancel",e.handlePointerCancel),document.removeEventListener("keypress",e.handleKeyPress),document.removeEventListener("keydown",e.handleKeyDown),document.removeEventListener("keyup",e.handleKeyUp),document.removeEventListener("pointerlockchange",e.handlePointerLockChange),t.container=null,n.clear()},e.handleKeyPress=function(o){var f=s(o);e.keyPressEvent(f)},e.handleKeyDown=function(o){var f=s(o);e.keyDownEvent(f)},e.handleKeyUp=function(o){var f=s(o);e.keyUpEvent(f)},e.handlePointerEnter=function(o){var f=R(R({},a(o)),{},{position:u(o),deviceType:c(o)});e.pointerEnterEvent(f),f.deviceType==="mouse"&&e.mouseEnterEvent(f)},e.handlePointerLeave=function(o){var f=R(R({},a(o)),{},{position:u(o),deviceType:c(o)});e.pointerLeaveEvent(f),f.deviceType==="mouse"&&e.mouseLeaveEvent(f)},e.handlePointerDown=function(o){if(!(o.button>2||e.isPointerLocked()))switch(t.preventDefaultOnPointerDown&&he(o),o.target.hasPointerCapture(o.pointerId)&&o.target.releasePointerCapture(o.pointerId),t.container.setPointerCapture(o.pointerId),n.has(o.pointerId)&&Te("[RenderWindowInteractor] duplicate pointerId detected"),n.set(o.pointerId,{pointerId:o.pointerId,position:u(o)}),o.pointerType){case"pen":case"touch":e.handleTouchStart(o);break;case"mouse":default:e.handleMouseDown(o);break}},e.handlePointerUp=function(o){if(n.has(o.pointerId))switch(t.preventDefaultOnPointerUp&&he(o),n.delete(o.pointerId),t.container.releasePointerCapture(o.pointerId),o.pointerType){case"pen":case"touch":e.handleTouchEnd(o);break;case"mouse":default:e.handleMouseUp(o);break}},e.handlePointerCancel=function(o){if(n.has(o.pointerId))switch(n.delete(o.pointerId),o.pointerType){case"pen":case"touch":e.handleTouchEnd(o);break;case"mouse":default:e.handleMouseUp(o);break}},e.handlePointerMove=function(o){if(n.has(o.pointerId)){var f=n.get(o.pointerId);f.position=u(o)}switch(o.pointerType){case"pen":case"touch":e.handleTouchMove(o);break;case"mouse":default:e.handleMouseMove(o);break}},e.handleMouseDown=function(o){var f=R(R({},a(o)),{},{position:u(o),deviceType:c(o)});switch(o.button){case 0:e.leftButtonPressEvent(f);break;case 1:e.middleButtonPressEvent(f);break;case 2:e.rightButtonPressEvent(f);break;default:ke("Unknown mouse button pressed: ".concat(o.button));break}},e.requestPointerLock=function(){t.container&&t.container.requestPointerLock()},e.exitPointerLock=function(){var o,f;return(o=(f=document).exitPointerLock)===null||o===void 0?void 0:o.call(f)},e.isPointerLocked=function(){return!!t.container&&document.pointerLockElement===t.container},e.handlePointerLockChange=function(){e.isPointerLocked()?e.startPointerLockEvent():e.endPointerLockEvent()};function l(){t._view&&t.enabled&&t.enableRender&&(t.inRender=!0,t._view.traverseAllPasses(),t.inRender=!1),e.invokeRenderEvent()}e.requestAnimation=function(o){if(o===void 0){ke("undefined requester, can not start animating");return}if(r.has(o)){Te("requester is already registered for animating");return}r.add(o),!t.animationRequest&&r.size===1&&!t.xrAnimation&&(t._animationStartTime=Date.now(),t._animationFrameCount=0,t.animationRequest=requestAnimationFrame(e.handleAnimation),e.startAnimationEvent())},e.extendAnimation=function(o){var f=Date.now()+o;t._animationExtendedEnd=Math.max(t._animationExtendedEnd,f),!t.animationRequest&&r.size===0&&!t.xrAnimation&&(t._animationStartTime=Date.now(),t._animationFrameCount=0,t.animationRequest=requestAnimationFrame(e.handleAnimation),e.startAnimationEvent())},e.isAnimating=function(){return t.xrAnimation||t.animationRequest!==null},e.cancelAnimation=function(o){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(!r.has(o)){if(!f){var y=o&&o.getClassName?o.getClassName():o;Te("".concat(y," did not request an animation"))}return}r.delete(o),t.animationRequest&&r.size===0&&Date.now()>t._animationExtendedEnd&&(cancelAnimationFrame(t.animationRequest),t.animationRequest=null,e.endAnimationEvent(),e.render())},e.switchToXRAnimation=function(){t.animationRequest&&(cancelAnimationFrame(t.animationRequest),t.animationRequest=null),t.xrAnimation=!0},e.returnFromXRAnimation=function(){t.xrAnimation=!1,r.size!==0&&(t.recentAnimationFrameRate=10,t.animationRequest=requestAnimationFrame(e.handleAnimation))},e.updateXRGamepads=function(o,f,y){o.inputSources.forEach(function(g){var m=g.gripSpace==null?null:f.getPose(g.gripSpace,y),w=g.gamepad,T=g.handedness;if(w){w.index in t.lastGamepadValues||(t.lastGamepadValues[w.index]={left:{buttons:{}},right:{buttons:{}},none:{buttons:{}}});for(var d=0;d<w.buttons.length;++d)d in t.lastGamepadValues[w.index][T].buttons||(t.lastGamepadValues[w.index][T].buttons[d]=!1),t.lastGamepadValues[w.index][T].buttons[d]!==w.buttons[d].pressed&&m!=null&&(e.button3DEvent({gamepad:w,position:m.transform.position,orientation:m.transform.orientation,pressed:w.buttons[d].pressed,device:g.handedness==="left"?xe.LeftController:xe.RightController,input:Qe[w.mapping]&&Qe[w.mapping][d]?Qe[w.mapping][d]:A.Trigger}),t.lastGamepadValues[w.index][T].buttons[d]=w.buttons[d].pressed),t.lastGamepadValues[w.index][T].buttons[d]&&m!=null&&e.move3DEvent({gamepad:w,position:m.transform.position,orientation:m.transform.orientation,device:g.handedness==="left"?xe.LeftController:xe.RightController})}})},e.handleMouseMove=function(o){var f=R(R({},a(o)),{},{position:u(o),deviceType:c(o)});t.moveTimeoutID===0?e.startMouseMoveEvent(f):(e.mouseMoveEvent(f),clearTimeout(t.moveTimeoutID)),t.moveTimeoutID=setTimeout(function(){e.endMouseMoveEvent(),t.moveTimeoutID=0},200)},e.handleAnimation=function(){var o=Date.now();t._animationFrameCount++,o-t._animationStartTime>1e3&&t._animationFrameCount>1&&(t.recentAnimationFrameRate=1e3*(t._animationFrameCount-1)/(o-t._animationStartTime),t.lastFrameTime=1/t.recentAnimationFrameRate,e.animationFrameRateUpdateEvent(),t._animationStartTime=o,t._animationFrameCount=1),e.animationEvent(),l(),r.size>0||Date.now()<t._animationExtendedEnd?t.animationRequest=requestAnimationFrame(e.handleAnimation):(cancelAnimationFrame(t.animationRequest),t.animationRequest=null,e.endAnimationEvent(),e.render())},e.handleWheel=function(o){he(o);var f=R(R(R({},Ko(o)),a(o)),{},{position:u(o),deviceType:c(o)});t.wheelTimeoutID===0&&(Math.abs(f.spinY)>=.3?i=Math.abs(f.spinY):i=1),f.spinY/=i,t.wheelTimeoutID===0?(e.startMouseWheelEvent(f),e.mouseWheelEvent(f)):(e.mouseWheelEvent(f),clearTimeout(t.wheelTimeoutID)),t.mouseScrollDebounceByPass?(e.extendAnimation(600),e.endMouseWheelEvent(),t.wheelTimeoutID=0):t.wheelTimeoutID=setTimeout(function(){e.extendAnimation(600),e.endMouseWheelEvent(),t.wheelTimeoutID=0},200)},e.handleMouseUp=function(o){var f=R(R({},a(o)),{},{position:u(o),deviceType:c(o)});switch(o.button){case 0:e.leftButtonReleaseEvent(f);break;case 1:e.middleButtonReleaseEvent(f);break;case 2:e.rightButtonReleaseEvent(f);break;default:ke("Unknown mouse button released: ".concat(o.button));break}},e.handleTouchStart=function(o){var f=se(n.values());if(t.recognizeGestures&&f.length>1){var y=Re(n);if(f.length===2){var g=R(R({},a(oe)),{},{position:f[0].position,deviceType:c(o)});e.leftButtonReleaseEvent(g)}e.recognizeGesture("TouchStart",y)}else if(f.length===1){var m=R(R({},a(oe)),{},{position:u(o),deviceType:c(o)});e.leftButtonPressEvent(m)}},e.handleTouchMove=function(o){var f=se(n.values());if(t.recognizeGestures&&f.length>1){var y=Re(n);e.recognizeGesture("TouchMove",y)}else if(f.length===1){var g=R(R({},a(oe)),{},{position:f[0].position,deviceType:c(o)});e.mouseMoveEvent(g)}},e.handleTouchEnd=function(o){var f=se(n.values());if(t.recognizeGestures)if(f.length===0){var y=R(R({},a(oe)),{},{position:u(o),deviceType:c(o)});e.leftButtonReleaseEvent(y)}else if(f.length===1){var g=Re(n);e.recognizeGesture("TouchEnd",g);var m=R(R({},a(oe)),{},{position:f[0].position,deviceType:c(o)});e.leftButtonPressEvent(m)}else{var w=Re(n);e.recognizeGesture("TouchMove",w)}else if(f.length===1){var T=R(R({},a(oe)),{},{position:f[0].position,deviceType:c(o)});e.leftButtonReleaseEvent(T)}},e.setView=function(o){t._view!==o&&(t._view=o,t._view.getRenderable().setInteractor(e),e.modified())},e.getFirstRenderer=function(){var o,f,y;return(o=t._view)===null||o===void 0||(f=o.getRenderable())===null||f===void 0||(y=f.getRenderersByReference())===null||y===void 0?void 0:y[0]},e.findPokedRenderer=function(){var o,f,y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(!t._view)return null;var m=(o=t._view)===null||o===void 0||(f=o.getRenderable())===null||f===void 0?void 0:f.getRenderers();if(!m||m.length===0)return null;m.sort(function(O,b){return O.getLayer()-b.getLayer()});for(var w=null,T=null,d=null,S=m.length;S--;){var E=m[S];if(t._view.isInViewport(y,g,E)&&E.getInteractive()){d=E;break}w===null&&E.getInteractive()&&(w=E),T===null&&t._view.isInViewport(y,g,E)&&(T=E)}return d===null&&(d=w),d===null&&(d=T),d==null&&(d=m[0]),d},e.render=function(){!e.isAnimating()&&!t.inRender&&l()},Ie.forEach(function(o){var f=o.charAt(0).toLowerCase()+o.slice(1);e["".concat(f,"Event")]=function(y){if(t.enabled){var g=e.getCurrentRenderer();if(!g){qo(`
          Can not forward events without a current renderer on the interactor.
        `);return}var m=R({type:o,pokedRenderer:t.currentRenderer,firstRenderer:e.getFirstRenderer()},y);e["invoke".concat(o)](m)}}}),e.recognizeGesture=function(o,f){if(!(Object.keys(f).length>2)){if(t.startingEventPositions||(t.startingEventPositions={}),o==="TouchStart"){Object.keys(f).forEach(function(ye){t.startingEventPositions[ye]=f[ye]}),t.currentGesture="Start";return}if(o==="TouchEnd"){t.currentGesture==="Pinch"&&(e.render(),e.endPinchEvent()),t.currentGesture==="Rotate"&&(e.render(),e.endRotateEvent()),t.currentGesture==="Pan"&&(e.render(),e.endPanEvent()),t.currentGesture="Start",t.startingEventPositions={};return}var y=0,g=[],m=[];Object.keys(f).forEach(function(ye){g[y]=f[ye],m[y]=t.startingEventPositions[ye],y++});var w=Math.sqrt((m[0].x-m[1].x)*(m[0].x-m[1].x)+(m[0].y-m[1].y)*(m[0].y-m[1].y)),T=Math.sqrt((g[0].x-g[1].x)*(g[0].x-g[1].x)+(g[0].y-g[1].y)*(g[0].y-g[1].y)),d=Qt(Math.atan2(m[1].y-m[0].y,m[1].x-m[0].x)),S=Qt(Math.atan2(g[1].y-g[0].y,g[1].x-g[0].x)),E=S-d;S=S+180>=360?S-180:S+180,d=d+180>=360?d-180:d+180,Math.abs(S-d)<Math.abs(E)&&(E=S-d);var O=[];if(O[0]=(g[0].x-m[0].x+g[1].x-m[1].x)/2,O[1]=(g[0].y-m[0].y+g[1].y-m[1].y)/2,o==="TouchMove")if(t.currentGesture==="Start"){var b=.01*Math.sqrt(t.container.clientWidth*t.container.clientWidth+t.container.clientHeight*t.container.clientHeight);b<15&&(b=15);var M=Math.abs(T-w),_=T*3.1415926*Math.abs(E)/360,L=Math.sqrt(O[0]*O[0]+O[1]*O[1]);if(M>b&&M>_&&M>L){t.currentGesture="Pinch";var $={scale:1,touches:f};e.startPinchEvent($)}else if(_>b&&_>L){t.currentGesture="Rotate";var W={rotation:0,touches:f};e.startRotateEvent(W)}else if(L>b){t.currentGesture="Pan";var N={translation:[0,0],touches:f};e.startPanEvent(N)}}else{if(t.currentGesture==="Rotate"){var ae={rotation:E,touches:f};e.rotateEvent(ae)}if(t.currentGesture==="Pinch"){var J={scale:T/w,touches:f};e.pinchEvent(J)}if(t.currentGesture==="Pan"){var ma={translation:O,touches:f};e.panEvent(ma)}}}},e.handleVisibilityChange=function(){t._animationStartTime=Date.now(),t._animationFrameCount=0},e.setCurrentRenderer=function(o){t._forcedRenderer=!!o,t.currentRenderer=o};var p=e.delete;e.delete=function(){for(;r.size;)e.cancelAnimation(r.values().next().value);typeof document.hidden<"u"&&document.removeEventListener("visibilitychange",e.handleVisibilityChange),t.container&&e.unbindEvents(),p()},typeof document.hidden<"u"&&document.addEventListener("visibilitychange",e.handleVisibilityChange,!1)}var Xo={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 en(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(t,Xo,r),k.obj(e,t),t._animationExtendedEnd=0,k.event(e,t,"RenderEvent"),Ie.forEach(function(n){return k.event(e,t,n)}),k.get(e,t,["initialized","container","interactorStyle","lastFrameTime","recentAnimationFrameRate","_view"]),k.setGet(e,t,["lightFollowCamera","enabled","enableRender","recognizeGestures","desiredUpdateRate","stillUpdateRate","picker","preventDefaultOnPointerDown","preventDefaultOnPointerUp","mouseScrollDebounceByPass"]),k.moveToProtected(e,t,["view"]),Po(e,t)}var Ho=k.newInstance(en,"vtkRenderWindowInteractor"),tn=R({newInstance:Ho,extend:en,handledEvents:Ie},Ze);function nn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function rn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?nn(Object(r),!0).forEach(function(n){V(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):nn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var Yo=k.vtkErrorMacro,Ao=k.VOID;function Jo(e,t,r,n){var i=e.getRenderWindow().getViews()[0];return i.worldToDisplay(t,r,n,e)}function Zo(e,t,r,n){var i=e.getRenderWindow().getViews()[0];return i.displayToWorld(t,r,n,e)}var Qo={computeWorldToDisplay:Jo,computeDisplayToWorld:Zo};function Io(e,t){t.classHierarchy.push("vtkInteractorObserver");var r=rn({},e);function n(){for(;t.subscribedEvents.length;)t.subscribedEvents.pop().unsubscribe()}function i(){tn.handledEvents.forEach(function(h){e["handle".concat(h)]&&t.subscribedEvents.push(t._interactor["on".concat(h)](function(v){return t.processEvents?e["handle".concat(h)](v):Ao},t.priority))})}e.setInteractor=function(h){h!==t._interactor&&(n(),t._interactor=h,h&&t.enabled&&i(),e.modified())},e.setEnabled=function(h){h!==t.enabled&&(n(),h&&(t._interactor?i():Yo(`
          The interactor must be set before subscribing to events
        `)),t.enabled=h,e.modified())},e.computeDisplayToWorld=function(h,v,u,a){return h?t._interactor.getView().displayToWorld(v,u,a,h):null},e.computeWorldToDisplay=function(h,v,u,a){return h?t._interactor.getView().worldToDisplay(v,u,a,h):null},e.setPriority=function(h){var v=r.setPriority(h);v&&t._interactor&&(n(),i())}}var ea={enabled:!0,priority:0,processEvents:!0,subscribedEvents:[]};function on(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(t,ea,r),k.obj(e,t),k.event(e,t,"InteractionEvent"),k.event(e,t,"StartInteractionEvent"),k.event(e,t,"EndInteractionEvent"),k.get(e,t,["_interactor","enabled"]),k.setGet(e,t,["priority","processEvents"]),k.moveToProtected(e,t,["interactor"]),Io(e,t)}var ta=k.newInstance(on,"vtkInteractorObserver"),na=rn({newInstance:ta,extend:on},Qo),ra={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},an={States:ra};function sn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function oa(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?sn(Object(r),!0).forEach(function(n){V(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):sn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var G=an.States,et={Rotate:G.IS_ROTATE,Pan:G.IS_PAN,Spin:G.IS_SPIN,Dolly:G.IS_DOLLY,CameraPose:G.IS_CAMERA_POSE,WindowLevel:G.IS_WINDOW_LEVEL,Slice:G.IS_SLICE};function aa(e,t){t.classHierarchy.push("vtkInteractorStyle"),Object.keys(et).forEach(function(r){k.event(e,t,"Start".concat(r,"Event")),e["start".concat(r)]=function(){t.state===G.IS_NONE&&(t.state=et[r],t._interactor.requestAnimation(e),e.invokeStartInteractionEvent({type:"StartInteractionEvent"}),e["invokeStart".concat(r,"Event")]({type:"Start".concat(r,"Event")}))},k.event(e,t,"End".concat(r,"Event")),e["end".concat(r)]=function(){t.state===et[r]&&(t.state=G.IS_NONE,t._interactor.cancelAnimation(e),e.invokeEndInteractionEvent({type:"EndInteractionEvent"}),e["invokeEnd".concat(r,"Event")]({type:"End".concat(r,"Event")}),t._interactor.render())}}),e.handleKeyPress=function(r){var n=t._interactor,i=null;switch(r.key){case"r":case"R":r.pokedRenderer.resetCamera(),n.render();break;case"w":case"W":i=r.pokedRenderer.getActors(),i.forEach(function(h){var v=h.getProperty();v.setRepresentationToWireframe&&v.setRepresentationToWireframe()}),n.render();break;case"s":case"S":i=r.pokedRenderer.getActors(),i.forEach(function(h){var v=h.getProperty();v.setRepresentationToSurface&&v.setRepresentationToSurface()}),n.render();break;case"v":case"V":i=r.pokedRenderer.getActors(),i.forEach(function(h){var v=h.getProperty();v.setRepresentationToPoints&&v.setRepresentationToPoints()}),n.render();break}}}var ia={state:G.IS_NONE,handleObservers:1,autoAdjustCameraClippingRange:1};function un(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(t,ia,r),na.extend(e,t,r),aa(e,t)}var sa=k.newInstance(un,"vtkInteractorStyle"),ua=oa({newInstance:sa,extend:un},an);const pe={type:"StartInteractionEvent"},cn={type:"InteractionEvent"},ve={type:"EndInteractionEvent"};function ca(e,t){t.classHierarchy.push("vtkInteractorStyleRemoteMouse");function r(n){const{buttonLeft:i,buttonMiddle:h,buttonRight:v}=t,u=n.shiftKey?1:0,a=n.controlKey?1:0,s=n.altKey?1:0,c=n.metaKey?1:0,l=i||h||v?"down":"up";let{x:p,y:o}=n.position;return{action:l,x:p,y:o,buttonLeft:i,buttonMiddle:h,buttonRight:v,shiftKey:u,altKey:s,ctrlKey:a,metaKey:c,...t.remoteEventAddOn}}e.handleLeftButtonPress=n=>{t.previousPosition=n.position,t.buttonLeft=1,e.onButtonDown(1,n)},e.handleMiddleButtonPress=n=>{t.previousPosition=n.position,t.buttonMiddle=1,e.onButtonDown(2,n)},e.handleRightButtonPress=n=>{t.previousPosition=n.position,t.buttonRight=1,e.onButtonDown(3,n)},e.handleLeftButtonRelease=n=>{t.buttonLeft=0,e.onButtonUp(1,n)},e.handleMiddleButtonRelease=n=>{t.buttonMiddle=0,e.onButtonUp(2,n)},e.handleRightButtonRelease=n=>{t.buttonRight=0,e.onButtonUp(3,n)},e.onButtonDown=(n,i)=>{e.invokeStartInteractionEvent(pe);let h="";n==1?h="LeftButtonPress":n==2?h="MiddleButtonPress":n==3&&(h="RightButtonPress"),e.invokeRemoteMouseEvent({type:h,...r(i)})},e.onButtonUp=(n,i)=>{let h="";n==1?h="LeftButtonRelease":n==2?h="MiddleButtonRelease":n==3&&(h="RightButtonRelease"),e.invokeRemoteMouseEvent({type:h,...r(i)}),e.invokeEndInteractionEvent(ve)},e.handleStartMouseWheel=n=>{e.invokeStartInteractionEvent(pe),e.invokeRemoteWheelEvent({type:"StartMouseWheel",...r(n),spinY:n.spinY})},e.handleMouseWheel=n=>{let i=!0;if(t.wheelThrottleDelay){const h=Date.now();i=t.wheelThrottleDelay<h-t.wheelLastThrottleTime,i&&(t.wheelLastThrottleTime=h)}i&&(e.invokeRemoteWheelEvent({type:"MouseWheel",...r(n),spinY:n.spinY}),e.invokeInteractionEvent(cn))},e.handleEndMouseWheel=()=>{e.invokeRemoteWheelEvent({type:"EndMouseWheel",...t.remoteEventAddOn}),e.invokeEndInteractionEvent(ve)},e.handleMouseMove=n=>{const i=Date.now();t.throttleDelay<i-t.lastThrottleTime&&(t.sendMouseMove||t.buttonLeft||t.buttonMiddle||t.buttonRight)&&(t.lastThrottleTime=i,e.invokeRemoteMouseEvent({type:"MouseMove",...r(n)})),e.invokeInteractionEvent(cn)},e.handleKeyPress=()=>{},e.handleStartPinch=n=>{e.startDolly();const{scale:i}=n;e.invokeStartInteractionEvent(pe),e.invokeRemoteGestureEvent({type:"StartPinch",scale:i,...t.remoteEventAddOn})},e.handlePinch=n=>{const{scale:i}=n;e.invokeRemoteGestureEvent({type:"Pinch",scale:i,...t.remoteEventAddOn})},e.handleEndPinch=()=>{e.endDolly(),e.invokeRemoteGestureEvent({type:"EndPinch",...t.remoteEventAddOn}),e.invokeEndInteractionEvent(ve)},e.handleStartRotate=n=>{e.startRotate();const{rotation:i}=n;e.invokeStartInteractionEvent(pe),e.invokeRemoteGestureEvent({type:"StartRotate",rotation:i,...t.remoteEventAddOn})},e.handleRotate=n=>{const{rotation:i}=n;e.invokeRemoteGestureEvent({type:"Rotate",rotation:i,...t.remoteEventAddOn})},e.handleEndRotate=()=>{e.endRotate(),e.invokeRemoteGestureEvent({type:"EndRotate",...t.remoteEventAddOn}),e.invokeEndInteractionEvent(ve)},e.handleStartPan=n=>{e.startPan();const{translation:i}=n;e.invokeStartInteractionEvent(pe),e.invokeRemoteGestureEvent({type:"StartPan",translation:i,...t.remoteEventAddOn})},e.handlePan=n=>{const{translation:i}=n;e.invokeRemoteGestureEvent({type:"Pan",translation:i,...t.remoteEventAddOn})},e.handleEndPan=()=>{e.endPan(),e.invokeRemoteGestureEvent({type:"EndPan",...t.remoteEventAddOn}),e.invokeEndInteractionEvent(ve)},e.handleKeyPress=n=>{e.invokeRemoteKeyEvent({type:"keyPress",...n})},e.handleKeyDown=n=>{e.invokeRemoteKeyEvent({type:"keyDown",...n})},e.handleKeyUp=n=>{e.invokeRemoteKeyEvent({type:"keyUp",...n})}}const fa={buttonLeft:0,buttonMiddle:0,buttonRight:0,sendMouseMove:!1,throttleDelay:33.3,lastThrottleTime:0,wheelThrottleDelay:0,wheelLastThrottleTime:0};function fn(e,t,r={}){Object.assign(t,fa,r),ua.extend(e,t,r),k.setGet(e,t,["sendMouseMove","remoteEventAddOn","throttleDelay","wheelThrottleDelay"]),k.event(e,t,"RemoteMouseEvent"),k.event(e,t,"RemoteWheelEvent"),k.event(e,t,"RemoteGestureEvent"),k.event(e,t,"RemoteKeyEvent"),ca(e,t)}const la={newInstance:k.newInstance(fn,"vtkInteractorStyleRemoteMouse"),extend:fn},{inject:ha,provide:pa,ref:ln,toRefs:va,onMounted:ya,onBeforeUnmount:da}=window.Vue,hn=Promise.resolve(!0),pn={DisplayArea:Tn,StatisticsDisplay:Mn,ImageDisplayArea:tt,RemoteControlledArea:{props:{name:{type:String,default:"default"},origin:{type:String,default:"anonymous"},display:{type:String,default:"image"}},setup(e){const t=ln(null),r=ln(hn),n=ha("trame");let i=!0,h=null,v=0,u=[0,0],a={w:10,h:10,p:window.devicePixelRatio},s=!0,c=hn,l=0;function p(d){return d.preventDefault(),{x:d.clientX-u[0],y:a.h-d.clientY+u[1],z:0}}const o=tn.newInstance({_getScreenEventPositionFor:p,currentRenderer:1}),f=la.newInstance();o.setInteractorStyle(f),f.onRemoteMouseEvent(d=>{y(Object.assign({w:a.w,h:a.h},d))}),f.onRemoteWheelEvent(d=>{y(Object.assign({w:a.w,h:a.h},d))}),f.onRemoteGestureEvent(d=>{y(Object.assign({w:a.w,h:a.h},d))}),f.onRemoteKeyEvent(d=>{y(Object.assign({w:a.w,h:a.h},d))}),f.onStartInteractionEvent(d=>{y(d)}),f.onEndInteractionEvent(d=>{y(d)});function y(d){n&&(i?(i=!1,h=d,r.value=n.client.getConnection().getSession().call("trame.rca.event",[e.name,e.origin,h]),c.finally(g)):h.type!==d.type&&(v=0,n.client.getConnection().getSession().call("trame.rca.event",[e.name,e.origin,h]),n.client.getConnection().getSession().call("trame.rca.event",[e.name,e.origin,d]),h=d))}function g(){i=!0,v&&(v=0,y(h))}function m(){s=!0,l&&(l=0,T())}const w=new ResizeObserver(()=>{if(!t.value)return;const d=t.value.getBoundingClientRect(),{top:S,left:E}=d;a.w=d.width,a.h=d.height,a.p=window.devicePixelRatio,u=[E,S],T()});function T(d){n&&(s?(s=!1,d?c=n.client.getConnection().getSession().call("trame.rca.size",[e.name,e.origin,{...a,...d}]):c=n.client.getConnection().getSession().call("trame.rca.size",[e.name,e.origin,a]),c.finally(m)):l++)}return pa("rcaPushSize",T),ya(()=>{w.observe(t.value),o.initialize(),o.bindEvents(t.value)}),da(()=>{w.unobserve(t.value),o.unbindEvents(t.value)}),{rootElem:t,...va(e)}},template:`
    <div ref="rootElem" style="margin: 0; padding: 0; position: relative; width: 100%; height: 100%;">
      <div style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;">
        <display-area :display="display" :name="name" :origin="origin" />
        <slot></slot>
      </div>
    </div>
  `},MediaSourceDisplayArea:nt,VideoDecoderDisplayArea:rt,RawImageDisplayArea:ot};function ga(e){Object.keys(pn).forEach(t=>{e.component(t,pn[t])})}Z.install=ga,Object.defineProperty(Z,Symbol.toStringTag,{value:"Module"})});
