(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 et={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 pn{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 tt={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 pn(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>
  `},vn=1,yn=2,dn=3,gn=4,mn=5,wn=6,Sn=`

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;
  }
}
`,En=URL.createObjectURL(new Blob([Sn]));function On(){const e=new Worker(En);return e.addEventListener("error",()=>console.error("worker failed"),!1),e.onmessage=t=>{console.log(`Worker message: ${t.data}`),console.log(">>> FIXME .....")},e}class bn{constructor(){this.worker=On(),this.codec="",this.width=0,this.height=0}bindCanvas(t){const r=vn,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=yn;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=dn;this.worker.postMessage({action:i,timestamp:t,type:r,data:n},[n])}flush(){this.worker.postMessage({action:gn})}reset(){this.worker.postMessage({action:mn})}terminate(){this.worker.postMessage({action:wn}),this.worker.terminate(),this.worker=null}}const nt={props:{name:{type:String,default:"default"},origin:{type:String,default:"anonymous"}},data(){return{isSupported:"VideoFrame"in window}},created(){this.worker=new bn},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>
  `},rt={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,f=0;for(;f<a.length;)a[f++]=v[s++],a[f++]=v[s++],a[f++]=v[s++],a[f++]=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>'},xn={components:{ImageDisplayArea:et,MediaSourceDisplayArea:tt,VideoDecoderDisplayArea:nt,RawImageDisplayArea:rt},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 Tn{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],f=0;for(let l=0;l<this.clientTimes.length;l++){const o=this.clientTimes[l]-a,c=this.serverTime[l]-s;f+=this.packetSizes[l],h.push(o),v.push(c),a+=n,s+=n;const p=o<c?o:c,y=o>c?o:c;u[0]>p&&(u[0]=p),u[1]<y&&(u[1]=y)}return f*=i/this.packetSizes.length,{avgFps:i,client:h,server:v,minMax:u,totalSize:f}}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 Rn={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),f=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)*f,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)*f,a-s*t[l]);u.stroke()}},created(){this.monitor=new Tn(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 Re(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 Mn(e){if(Array.isArray(e))return Re(e)}function Dn(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function ot(e,t){if(e){if(typeof e=="string")return Re(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 Re(e,t)}}function jn(){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 Mn(e)||Dn(e)||ot(e)||jn()}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 Cn(e){if(Array.isArray(e))return e}function _n(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 Ln(){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 Me(e,t){return Cn(e)||_n(e,t)||ot(e,t)||Ln()}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 at(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Fn(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 Bn=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 Wn=at(Bn);var it=Object.prototype.toString,st=function(t){var r=it.call(t),n=r==="[object Arguments]";return n||(n=r!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&it.call(t.callee)==="[object Function]"),n},De,ut;function zn(){if(ut)return De;ut=1;var e;if(!Object.keys){var t=Object.prototype.hasOwnProperty,r=Object.prototype.toString,n=st,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(o){var c=o.constructor;return c&&c.prototype===o},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},f=function(){if(typeof window>"u")return!1;for(var o in window)try{if(!s["$"+o]&&t.call(window,o)&&window[o]!==null&&typeof window[o]=="object")try{a(window[o])}catch{return!0}}catch{return!0}return!1}(),l=function(o){if(typeof window>"u"||!f)return a(o);try{return a(o)}catch{return!1}};e=function(c){var p=c!==null&&typeof c=="object",y=r.call(c)==="[object Function]",d=n(c),m=p&&r.call(c)==="[object String]",E=[];if(!p&&!y&&!d)throw new TypeError("Object.keys called on a non-object");var S=v&&y;if(m&&c.length>0&&!t.call(c,0))for(var g=0;g<c.length;++g)E.push(String(g));if(d&&c.length>0)for(var w=0;w<c.length;++w)E.push(String(w));else for(var O in c)!(S&&O==="prototype")&&t.call(c,O)&&E.push(String(O));if(h)for(var b=l(c),k=0;k<u.length;++k)!(b&&u[k]==="constructor")&&t.call(c,u[k])&&E.push(u[k]);return E}}return De=e,De}var $n=Array.prototype.slice,Gn=st,ct=Object.keys,ye=ct?function(t){return ct(t)}:zn(),ft=Object.keys;ye.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 Gn(n)?ft($n.call(n)):ft(n)})}else Object.keys=ye;return Object.keys||ye};var Nn=ye,Vn=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},lt=typeof Symbol<"u"&&Symbol,Kn=Vn,qn=function(){return typeof lt!="function"||typeof Symbol!="function"||typeof lt("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Kn()},ht={foo:{}},Pn=Object,Xn=function(){return{__proto__:ht}.foo===ht.foo&&!({__proto__:null}instanceof Pn)},Hn="Function.prototype.bind called on incompatible ",je=Array.prototype.slice,Yn=Object.prototype.toString,An="[object Function]",Jn=function(t){var r=this;if(typeof r!="function"||Yn.call(r)!==An)throw new TypeError(Hn+r);for(var n=je.call(arguments,1),i,h=function(){if(this instanceof i){var f=r.apply(this,n.concat(je.call(arguments)));return Object(f)===f?f:this}else return r.apply(t,n.concat(je.call(arguments)))},v=Math.max(0,r.length-n.length),u=[],a=0;a<v;a++)u.push("$"+a);if(i=Function("binder","return function ("+u.join(",")+"){ return binder.apply(this,arguments); }")(h),r.prototype){var s=function(){};s.prototype=r.prototype,i.prototype=new s,s.prototype=null}return i},Zn=Jn,pt=Function.prototype.bind||Zn,Qn=pt,In=Qn.call(Function.call,Object.prototype.hasOwnProperty),x,Q=SyntaxError,vt=Function,I=TypeError,Ce=function(e){try{return vt('"use strict"; return ('+e+").constructor;")()}catch{}},q=Object.getOwnPropertyDescriptor;if(q)try{q({},"")}catch{q=null}var _e=function(){throw new I},er=q?function(){try{return arguments.callee,_e}catch{try{return q(arguments,"callee").get}catch{return _e}}}():_e,ee=qn(),tr=Xn(),j=Object.getPrototypeOf||(tr?function(e){return e.__proto__}:null),te={},nr=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%":vt,"%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%":er,"%TypedArray%":nr,"%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 rr=j(j(e));P["%Error.prototype%"]=rr}var or=function e(t){var r;if(t==="%AsyncFunction%")r=Ce("async function () {}");else if(t==="%GeneratorFunction%")r=Ce("function* () {}");else if(t==="%AsyncGeneratorFunction%")r=Ce("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},yt={"%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=pt,de=In,ar=fe.call(Function.call,Array.prototype.concat),ir=fe.call(Function.apply,Array.prototype.splice),dt=fe.call(Function.call,String.prototype.replace),ge=fe.call(Function.call,String.prototype.slice),sr=fe.call(Function.call,RegExp.prototype.exec),ur=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,cr=/\\(\\)?/g,fr=function(t){var r=ge(t,0,1),n=ge(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 dt(t,ur,function(h,v,u,a){i[i.length]=u?dt(a,cr,"$1"):v||h}),i},lr=function(t,r){var n=t,i;if(de(yt,n)&&(i=yt[n],n="%"+i[0]+"%"),de(P,n)){var h=P[n];if(h===te&&(h=or(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!")},Le=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(sr(/^%?[^%]*%?$/,t)===null)throw new Q("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=fr(t),i=n.length>0?n[0]:"",h=lr("%"+i+"%",r),v=h.name,u=h.value,a=!1,s=h.alias;s&&(i=s[0],ir(n,ar([0,1],s)));for(var f=1,l=!0;f<n.length;f+=1){var o=n[f],c=ge(o,0,1),p=ge(o,-1);if((c==='"'||c==="'"||c==="`"||p==='"'||p==="'"||p==="`")&&c!==p)throw new Q("property names with quotes must have matching quotes");if((o==="constructor"||!l)&&(a=!0),i+="."+o,v="%"+i+"%",de(P,v))u=P[v];else if(u!=null){if(!(o in u)){if(!r)throw new I("base intrinsic for "+t+" exists, but the property is not available.");return}if(q&&f+1>=n.length){var y=q(u,o);l=!!y,l&&"get"in y&&!("originalValue"in y.get)?u=y.get:u=u[o]}else l=de(u,o),u=u[o];l&&!a&&(P[v]=u)}}return u},hr=Le,Ue=hr("%Object.defineProperty%",!0),Fe=function(){if(Ue)try{return Ue({},"a",{value:1}),!0}catch{return!1}return!1};Fe.hasArrayLengthDefineBug=function(){if(!Fe())return null;try{return Ue([],"length",{value:1}).length!==1}catch{return!0}};var gt=Fe,Be,mt;function pr(){if(mt)return Be;mt=1;var e=Le,t=e("%Object.getOwnPropertyDescriptor%",!0);if(t)try{t([],"length")}catch{t=null}return Be=t,Be}var vr=gt(),We=Le,wt=vr&&We("%Object.defineProperty%",!0),yr=We("%SyntaxError%"),ne=We("%TypeError%"),St=pr(),dr=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=!!St&&St(t,r);if(wt)wt(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 yr("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},gr=Nn,mr=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",wr=Object.prototype.toString,Sr=Array.prototype.concat,Et=dr,Er=function(e){return typeof e=="function"&&wr.call(e)==="[object Function]"},Ot=gt(),Or=function(e,t,r,n){if(t in e){if(n===!0){if(e[t]===r)return}else if(!Er(n)||!n())return}Ot?Et(e,t,r,!0):Et(e,t,r)},bt=function(e,t){var r=arguments.length>2?arguments[2]:{},n=gr(t);mr&&(n=Sr.call(n,Object.getOwnPropertySymbols(t)));for(var i=0;i<n.length;i+=1)Or(e,n[i],t[n[i]],r[n[i]])};bt.supportsDescriptors=!!Ot;var xt=bt,me={exports:{}};typeof self<"u"?me.exports=self:typeof window<"u"?me.exports=window:me.exports=Function("return this")();var kt=me.exports,br=kt,Tt=function(){return typeof B!="object"||!B||B.Math!==Math||B.Array!==Array?br:B},xr=xt,kr=Tt,Tr=function(){var t=kr();if(xr.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},Rr=xt,Mr=kt,Rt=Tt,Dr=Tr,jr=Rt(),Mt=function(){return jr};Rr(Mt,{getPolyfill:Rt,implementation:Mr,shim:Dr});var Cr=Mt;const _r=at(Cr);function Dt(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 Lr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Dt(Object(r),!0).forEach(function(n){V(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Dt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var z=_r(),jt={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=jt[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=Lr({},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 Ur(e,t){jt[e]=t}X.register=Ur;function Fr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ct(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 Br(e,t,r){return t&&Ct(e.prototype,t),r&&Ct(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 Wr(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=H(e),e!==null););return e}function we(){return typeof Reflect<"u"&&Reflect.get?we=Reflect.get:we=function(t,r,n){var i=Wr(t,r);if(i){var h=Object.getOwnPropertyDescriptor(i,r);return h.get?h.get.call(arguments.length<3?t:n):h.value}},we.apply(this,arguments)}function zr(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 $r(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Gr(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 $r(e)}function Nr(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function ze(e){var t=typeof Map=="function"?new Map:void 0;return ze=function(n){if(n===null||!Nr(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)},ze(e)}function Vr(e){var t=Kr();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 Gr(this,i)}}function Kr(){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 $e=function(e){zr(r,e);var t=Vr(r);function r(){return Fr(this,r),t.apply(this,arguments)}return Br(r,[{key:"push",value:function(){for(var i=0;i<arguments.length;i++)this.includes(arguments[i])||we(H(r.prototype),"push",this).call(this,arguments[i]);return this.length}}]),r}(ze(Array));function _t(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 Se(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?_t(Object(r),!0).forEach(function(n){V(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_t(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var Ge=0,qr=Symbol("void");function Pr(){return Ge}var Lt={};function Y(){}var Xr=["log","debug","info","warn","error","time","timeEnd","group","groupEnd"];Xr.forEach(function(e){Lt[e]=Y}),z.console=console.hasOwnProperty("log")?console:Lt;var F={debug:Y,error:z.console.error||Y,info:z.console.info||Y,log:z.console.log||Y,warn:z.console.warn||Y};function Hr(e,t){F[e]&&(F[e]=t||Y)}function Yr(){F.log.apply(F,arguments)}function Ar(){F.info.apply(F,arguments)}function Ne(){F.debug.apply(F,arguments)}function C(){F.error.apply(F,arguments)}function Ut(){F.warn.apply(F,arguments)}var Ft={};function Jr(e){Ft[e]||(F.error(e),Ft[e]=!0)}var L=Object.create(null);L.Float32Array=Float32Array,L.Float64Array=Float64Array,L.Uint8Array=Uint8Array,L.Int8Array=Int8Array,L.Uint16Array=Uint16Array,L.Int16Array=Int16Array,L.Uint32Array=Uint32Array,L.Int32Array=Int32Array,L.Uint8ClampedArray=Uint8ClampedArray;try{L.BigInt64Array=BigInt64Array,L.BigUint64Array=BigUint64Array}catch{}function Zr(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(L[e]||Float64Array,r)}function Qr(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=L[e]||Float64Array).from.apply(t,n)}function Ve(e){return e.charAt(0).toUpperCase()+e.slice(1)}function D(e){return Ve(e[0]==="_"?e.slice(1):e)}function Ir(e){return e.charAt(0).toLowerCase()+e.slice(1)}function eo(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 to(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 Bt(e){Object.keys(e).forEach(function(t){Array.isArray(e[t])&&(e[t]=[].concat(e[t]))})}function no(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 ro(e,t){return Object.keys(e).find(function(r){return e[r]===t})}function Wt(e){return e&&e.isA?e.getState():e}function zt(e){setTimeout(e,0)}function oo(e,t){var r=performance.now();e.finally(function(){var n=performance.now()-r;t(n)})}function ao(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Bt(t);var r=[];if(Number.isInteger(t.mtime)||(t.mtime=++Ge),!("classHierarchy"in t))t.classHierarchy=new $e("vtkObject");else if(!(t.classHierarchy instanceof $e)){for(var n=new $e,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=++Ge,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,f=!1;return Object.keys(u).forEach(function(l){var o=s?null:e["set".concat(Ve(l))];o&&Array.isArray(u[l])&&o.length>1?f=o.apply(void 0,se(u[l]))||f:o?f=o(u[l])||f:(["mtime"].indexOf(l)===-1&&!a&&Ut("Warning: Set value to model directly ".concat(l,", ").concat(u[l])),f=t[l]!==u[l]||f,t[l]=u[l])}),f},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 f={};return a.forEach(function(l){f[l]=t[l]}),f},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=Se(Se({},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(Wt))});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(),f=Object.keys(t).sort(),l=Object.keys(s).sort();l.forEach(function(o){var c=f.indexOf(o);c===-1?a&&Ne("add ".concat(o," in shallowCopy")):f.splice(c,1),t[o]=s[o]}),f.length&&a&&Ne("Untouched keys: ".concat(f.join(", "))),e.modified()},e.toJSON=function(){return e.getState()},e}var io={object:function(t,r,n){return function(){return Se({},r[n.name])}}};function Ee(e,t,r){r.forEach(function(n){if(K(n)==="object"){var i=io[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 so={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(!Wn(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 $t(e){if(K(e)==="object"){var t=so[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 Gt(e,t,r){r.forEach(function(n){K(n)==="object"?e["set".concat(D(n.name))]=$t(n)(e,t):e["set".concat(D(n))]=$t(n)(e,t)})}function Nt(e,t,r){Ee(e,t,r),Gt(e,t,r)}function Vt(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 Kt(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 f=a,l,o=!1;if(f.length===1&&(f[0]==null||f[0].length>=0)&&(f=f[0],o=!0),f==null)l=t[h]!==f;else{if(n&&f.length!==n)if(f.length<n&&i!==void 0)for(f=Array.from(f),o=!1;f.length<n;)f.push(i);else throw new RangeError("Invalid number of values for array setter (".concat(h,")"));l=t[h]==null||t[h].length!==f.length;for(var c=0;!l&&c<f.length;++c)l=t[h][c]!==f[c];l&&o&&(f=Array.from(f))}if(l){var p,y=t[h.name];t[h]=f,(p=t[v])===null||p===void 0||p.call(t,e,t,f,y),e.modified()}return l},e["set".concat(D(h),"From")]=function(u){var a=t[h];u.forEach(function(s,f){a[f]=s})}})}function uo(e,t,r,n){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:void 0;Vt(e,t,r),Kt(e,t,r,n,i)}function co(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 fo(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(p){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]!==p||t.inputConnection[y])&&(t.inputData[y]=p,t.inputConnection[y]=null,e.modified&&e.modified())}function h(){var p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return t.inputConnection[p]&&(t.inputData[p]=t.inputConnection[p]()),t.inputData[p]}function v(p){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 d="algorithm ".concat(e.getClassName()," only has ");d+="".concat(t.numberOfInputs),d+=" input ports. To add more input ports, use addInputConnection()",C(d);return}t.inputData[y]=null,t.inputConnection[y]=p}function u(){var p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return t.inputConnection[p]}function a(){for(var p=t.numberOfInputs;p&&!t.inputData[p-1]&&!t.inputConnection[p-1];)p--;return p===t.numberOfInputs&&t.numberOfInputs++,p}function s(p){if(t.deleted){C("instance deleted - cannot call any method");return}v(p,a())}function f(p){if(t.deleted){C("instance deleted - cannot call any method");return}i(p,a())}function l(){var p=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[p])}e.shouldUpdate=function(){for(var p=e.getMTime(),y=1/0,d=n;d--;){if(!t.output[d]||t.output[d].isDeleted())return!0;var m=t.output[d].getMTime();if(m<p)return!0;m<y&&(y=m)}for(d=t.numberOfInputs;d--;){var E,S;if((E=t.inputConnection[d])!==null&&E!==void 0&&E.filter.shouldUpdate()||((S=e.getInputData(d))===null||S===void 0?void 0:S.getMTime())>y)return!0}return!1};function o(){var p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,y=function(){return l(p)};return y.filter=e,y}if(t.numberOfInputs){for(var c=t.numberOfInputs;c--;)t.inputData.push(null),t.inputConnection.push(null);e.setInputData=i,e.setInputConnection=v,e.addInputData=f,e.addInputConnection=s,e.getInputData=h,e.getInputConnection=u}n&&(e.getOutputData=l,e.getOutputPort=o),e.update=function(){var p=[];if(t.numberOfInputs)for(var y=0;y<t.numberOfInputs;)p[y]=e.getInputData(y),y++;e.shouldUpdate()&&e.requestData&&e.requestData(p,t.output)},e.getNumberOfInputPorts=function(){return t.numberOfInputs},e.getNumberOfOutputPorts=function(){return n||t.output.length},e.getInputArrayToProcess=function(p){var y=t.inputArrayToProcess[p],d=t.inputData[p];return y&&d?d["get".concat(y.fieldAssociation)]().getArray(y.arrayName):null},e.setInputArrayToProcess=function(p,y,d){for(var m=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"Scalars";t.inputArrayToProcess.length<p;)t.inputArrayToProcess.push(null);t.inputArrayToProcess[p]={arrayName:y,fieldAssociation:d,attributeType:m}}}var qt=Symbol("Event abort");function lo(e,t,r){var n=[],i=e.delete,h=1;function v(s){for(var f=0;f<n.length;++f){var l=Me(n[f],1),o=l[0];if(o===s){n.splice(f,1);return}}}function u(s){function f(){v(s)}return Object.freeze({unsubscribe:f})}function a(){var s=arguments;if(t.deleted){C("instance deleted - cannot call any method");return}for(var f=n.slice(),l=function(y){var d=Me(f[y],3),m=d[1],E=d[2];if(!m)return"continue";if(E<0)setTimeout(function(){return m.apply(e,s)},1-E);else{var S=m.apply(e,s);if(S===qt)return"break"}},o=0;o<f.length;++o){var c=l(o);if(c!=="continue"&&c==="break")break}}e["invoke".concat(D(r))]=a,e["on".concat(D(r))]=function(s){var f=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,f]),n.sort(function(o,c){return c[2]-o[2]}),u(l)},e.delete=function(){i(),n.forEach(function(s){var f=Me(s,1),l=f[0];return v(l)})}}function ho(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 po(){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 Pt(e){return e&&e.isA&&e.isA("vtkObject")}function Ke(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:[];if(Pt(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){Ke(a,t,r,n)}):Ke(u,t,r,n)})}return r}function vo(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 f=n,l=function(){i=null,r||e.apply(f,a)},o=r&&!i;clearTimeout(i),i=setTimeout(l,t),o&&e.apply(f,a)};return h.cancel=function(){return clearTimeout(i)},h}function yo(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 Xt(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 go=1,Oe="__root__";function mo(e,t){Xt(e,t);var r=e.delete;t.proxyId="".concat(go++),t.ui=JSON.parse(JSON.stringify(t.ui||[])),Ee(e,t,["proxyId","proxyGroup","proxyName"]),Nt(e,t,["proxyManager"]);var n={},i={};function h(s,f){i[f]||(i[f]=[]);for(var l=i[f],o=0;o<s.length;o++)l.push(s[o].name),n[s[o].name]=s[o],s[o].children&&s[o].children.length&&h(s[o].children,s[o].name)}h(t.ui,Oe),e.updateUI=function(s){t.ui=JSON.parse(JSON.stringify(s||[])),Object.keys(n).forEach(function(f){return delete n[f]}),Object.keys(i).forEach(function(f){return delete i[f]}),h(t.ui,Oe),e.modified()};function v(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Oe;return i[s]}e.updateProxyProperty=function(s,f){var l=n[s];l?Object.assign(l,f):n[s]=Se({},f)},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,f){f in t.propertyLinkSubscribers||(t.propertyLinkSubscribers[f]=[]),t.propertyLinkSubscribers[f].push(s)},e.gcPropertyLinks=function(s){for(var f=t.propertyLinkSubscribers[s]||[];f.length;)f.pop().unbind(e)},t.propertyLinkMap={},e.getPropertyLink=function(s){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(t.propertyLinkMap[s])return t.propertyLinkMap[s];var l=null,o=[],c=0,p=!1;function y(g){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(p)return null;var O=[],b=null;for(c=o.length;c--;){var k=o[c];k.instance===g?b=k:O.push(k)}if(!b)return null;var M=b.instance["get".concat(D(b.propertyName))]();if(!no(M,l)||w){for(l=M,p=!0;O.length;){var _=O.pop();_.instance.set(V({},_.propertyName,l))}p=!1}return t.propertyLinkMap[s].persistent&&(t.propertyLinkMap[s].value=M),M}function d(g,w){var O=[];for(c=o.length;c--;){var b=o[c];b.instance===g&&(b.propertyName===w||w===void 0)&&(b.subscription.unsubscribe(),O.push(c))}for(;O.length;)o.splice(O.pop(),1)}function m(g,w){var O=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,b=g.onModified(y),k=o[0];return o.push({instance:g,propertyName:w,subscription:b}),O&&(t.propertyLinkMap[s].persistent&&t.propertyLinkMap[s].value!==void 0?g.set(V({},w,t.propertyLinkMap[s].value)):k&&y(k.instance,!0)),{unsubscribe:function(){return d(g,w)}}}function E(){for(;o.length;)o.pop().subscription.unsubscribe()}var S={bind:m,unbind:d,unsubscribe:E,persistent:f};return t.propertyLinkMap[s]=S,S};function u(){for(var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Oe,f=[],l=t.proxyId,o=v(s)||[],c=0;c<o.length;c++){var p=o[c],y=e["get".concat(D(p))],d=y?y():void 0,m={id:l,name:p,value:d},E=u(p);E.length&&(m.children=E),f.push(m)}return f}e.listPropertyNames=function(){return u().map(function(s){return s.name})},e.getPropertyByName=function(s){return u().find(function(f){return f.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),f=s.length;f--;)t.propertyLinkMap[s[f]].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 f=t.links[s],l=f.link,o=f.property,c=f.persistent,p=f.updateOnBind,y=f.type;if(y==="application"){var d=t.proxyManager.getPropertyLink(l,c);e.registerPropertyLinkForGC(d,"application"),d.bind(e,o,p)}}}zt(a)}function wo(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,f=a.property,l=a.modified,o=l===void 0?!0:l,c=D(f),p=D(u);e["get".concat(p)]=t[s]["get".concat(c)],e["set".concat(p)]=t[s]["set".concat(c)],o&&i.push(t[s].onModified(e.modified))}e.delete=function(){for(;i.length;)i.pop().unsubscribe();n()}}function So(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),f=s.length;f--;){var l=s[f];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 f=r[s];e["set".concat(D(s))]=function(l){if(l!==t[s]){t[s]=l;var o=f[l];i(o),e.modified()}}};v--;)u();h.length&&Ee(e,t,h)}var Ht=10,Yt=40,At=800;function Eo(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*Ht,i=r*Ht,"deltaY"in e&&(i=e.deltaY),"deltaX"in e&&(n=e.deltaX),(n||i)&&e.deltaMode&&(e.deltaMode===1?(n*=Yt,i*=Yt):(n*=At,i*=At)),n&&!t&&(t=n<1?-1:1),i&&!r&&(r=i<1?-1:1),{spinX:t,spinY:r,pixelX:n,pixelY:i}}var T={algo:fo,capitalize:Ve,chain:po,debounce:vo,enumToString:ro,event:lo,EVENT_ABORT:qt,formatBytesToProperUnit:eo,formatNumbersWithThousandSeparator:to,get:Ee,getArray:Vt,getCurrentGlobalMTime:Pr,getStateArrayMapFunc:Wt,isVtkObject:Pt,keystore:Xt,measurePromiseExecution:oo,moveToProtected:co,newInstance:ho,newTypedArray:Zr,newTypedArrayFrom:Qr,normalizeWheel:Eo,obj:ao,proxy:mo,proxyPropertyMapping:wo,proxyPropertyState:So,safeArrays:Bt,set:Gt,setArray:Kt,setGet:Nt,setGetArray:uo,setImmediate:zt,setLoggerFunction:Hr,throttle:yo,traverseInstanceTree:Ke,TYPED_ARRAYS:L,uncapitalize:Ir,VOID:qr,vtkDebugMacro:Ne,vtkErrorMacro:C,vtkInfoMacro:Ar,vtkLogMacro:Yr,vtkOnceErrorMacro:Jr,vtkWarningMacro:Ut},qe={exports:{}};qe.exports,function(e){(function(t,r,n){function i(a){var s=this,f=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=f(" "),s.s1=f(" "),s.s2=f(" "),s.s0-=f(a),s.s0<0&&(s.s0+=1),s.s1-=f(a),s.s1<0&&(s.s1+=1),s.s2-=f(a),s.s2<0&&(s.s2+=1),f=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 f=new i(a),l=s&&s.state,o=f.next;return o.int32=function(){return f.next()*4294967296|0},o.double=function(){return o()+(o()*2097152|0)*11102230246251565e-32},o.quick=o,l&&(typeof l=="object"&&h(l,f),o.state=function(){return h(f,{})}),o}function u(){var a=4022871197,s=function(f){f=String(f);for(var l=0;l<f.length;l++){a+=f.charCodeAt(l);var o=.02519603282416938*a;a=o>>>0,o-=a,o*=a,a=o>>>0,o-=a,a+=o*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)}(qe);var Oo=qe.exports,Pe={exports:{}};Pe.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 f=0;f<s.length+64;f++)a.x^=s.charCodeAt(f)|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),f=a&&a.state,l=function(){return(s.next()>>>0)/4294967296};return l.double=function(){do var o=s.next()>>>11,c=(s.next()>>>0)/4294967296,p=(o+c)/(1<<21);while(p===0);return p},l.int32=s.next,l.quick=l,f&&(typeof f=="object"&&h(f,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)}(Pe);var bo=Pe.exports,Xe={exports:{}};Xe.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 f=0;f<s.length+64;f++)a.x^=s.charCodeAt(f)|0,f==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),f=a&&a.state,l=function(){return(s.next()>>>0)/4294967296};return l.double=function(){do var o=s.next()>>>11,c=(s.next()>>>0)/4294967296,p=(o+c)/(1<<21);while(p===0);return p},l.int32=s.next,l.quick=l,f&&(typeof f=="object"&&h(f,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)}(Xe);var xo=Xe.exports,He={exports:{}};He.exports,function(e){(function(t,r,n){function i(u){var a=this;a.next=function(){var f=a.x,l=a.i,o,c;return o=f[l],o^=o>>>7,c=o^o<<24,o=f[l+1&7],c^=o^o>>>10,o=f[l+3&7],c^=o^o>>>3,o=f[l+4&7],c^=o^o<<7,o=f[l+7&7],o=o^o<<13,c^=o^o<<9,f[l]=c,a.i=l+1&7,c};function s(f,l){var o,c=[];if(l===(l|0))c[0]=l;else for(l=""+l,o=0;o<l.length;++o)c[o&7]=c[o&7]<<15^l.charCodeAt(o)+c[o+1&7]<<13;for(;c.length<8;)c.push(0);for(o=0;o<8&&c[o]===0;++o);for(o==8?c[7]=-1:c[o],f.x=c,f.i=0,o=256;o>0;--o)f.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),f=a&&a.state,l=function(){return(s.next()>>>0)/4294967296};return l.double=function(){do var o=s.next()>>>11,c=(s.next()>>>0)/4294967296,p=(o+c)/(1<<21);while(p===0);return p},l.int32=s.next,l.quick=l,f&&(f.x&&h(f,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)}(He);var ko=He.exports,Ye={exports:{}};Ye.exports,function(e){(function(t,r,n){function i(u){var a=this;a.next=function(){var f=a.w,l=a.X,o=a.i,c,p;return a.w=f=f+1640531527|0,p=l[o+34&127],c=l[o=o+1&127],p^=p<<13,c^=c<<17,p^=p>>>15,c^=c>>>12,p=l[o]=p^c,a.i=o,p+(f^f>>>16)|0};function s(f,l){var o,c,p,y,d,m=[],E=128;for(l===(l|0)?(c=l,l=null):(l=l+"\0",c=0,E=Math.max(E,l.length)),p=0,y=-32;y<E;++y)l&&(c^=l.charCodeAt((y+32)%l.length)),y===0&&(d=c),c^=c<<10,c^=c>>>15,c^=c<<4,c^=c>>>13,y>=0&&(d=d+1640531527|0,o=m[y&127]^=c+d,p=o==0?p+1:0);for(p>=128&&(m[(l&&l.length||0)&127]=-1),p=127,y=4*128;y>0;--y)c=m[p+34&127],o=m[p=p+1&127],c^=c<<13,o^=o<<17,c^=c>>>15,o^=o>>>12,m[p]=c^o;f.w=d,f.X=m,f.i=p}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),f=a&&a.state,l=function(){return(s.next()>>>0)/4294967296};return l.double=function(){do var o=s.next()>>>11,c=(s.next()>>>0)/4294967296,p=(o+c)/(1<<21);while(p===0);return p},l.int32=s.next,l.quick=l,f&&(f.X&&h(f,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)}(Ye);var To=Ye.exports,Ae={exports:{}};Ae.exports,function(e){(function(t,r,n){function i(u){var a=this,s="";a.next=function(){var l=a.b,o=a.c,c=a.d,p=a.a;return l=l<<25^l>>>7^o,o=o-c|0,c=c<<24^c>>>8^p,p=p-l|0,a.b=l=l<<20^l>>>12^o,a.c=o=o-c|0,a.d=c<<16^o>>>16^p,a.a=p-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 f=0;f<s.length+20;f++)a.b^=s.charCodeAt(f)|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),f=a&&a.state,l=function(){return(s.next()>>>0)/4294967296};return l.double=function(){do var o=s.next()>>>11,c=(s.next()>>>0)/4294967296,p=(o+c)/(1<<21);while(p===0);return p},l.int32=s.next,l.quick=l,f&&(typeof f=="object"&&h(f,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)}(Ae);var Ro=Ae.exports,Jt={exports:{}};const Mo=Fn(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),f=s*2,l=i-1,o;function c(g,w,O){var b=[];w=w==!0?{entropy:!0}:w||{};var k=m(d(w.entropy?[g,S(r)]:g??E(),3),b),M=new p(b),_=function(){for(var U=M.g(h),$=a,W=0;U<s;)U=(U+W)*i,$*=i,W=M.g(1);for(;U>=f;)U/=2,$/=2,W>>>=1;return(U+W)/$};return _.int32=function(){return M.g(4)|0},_.quick=function(){return M.g(4)/4294967296},_.double=_,m(S(M.S),r),(w.pass||O||function(U,$,W,N){return N&&(N.S&&y(N,M),U.state=function(){return y(M,{})}),W?(n[u]=U,$):U})(_,k,"global"in w?w.global:this==n,w.state)}function p(g){var w,O=g.length,b=this,k=0,M=b.i=b.j=0,_=b.S=[];for(O||(g=[O++]);k<i;)_[k]=k++;for(k=0;k<i;k++)_[k]=_[M=l&M+g[k%O]+(w=_[k])],_[M]=w;(b.g=function(U){for(var $,W=0,N=b.i,ae=b.j,J=b.S;U--;)$=J[N=l&N+1],W=W*i+J[l&(J[N]=J[ae=l&ae+$])+(J[ae]=$)];return b.i=N,b.j=ae,W})(i)}function y(g,w){return w.i=g.i,w.j=g.j,w.S=g.S.slice(),w}function d(g,w){var O=[],b=typeof g,k;if(w&&b=="object")for(k in g)try{O.push(d(g[k],w-1))}catch{}return O.length?O:b=="string"?g:g+"\0"}function m(g,w){for(var O=g+"",b,k=0;k<O.length;)w[l&k]=l&(b^=w[l&k]*19)+O.charCodeAt(k++);return S(w)}function E(){try{var g;return o&&(g=o.randomBytes)?g=g(i):(g=new Uint8Array(i),(t.crypto||t.msCrypto).getRandomValues(g)),S(g)}catch{var w=t.navigator,O=w&&w.plugins;return[+new Date,t,O,t.screen,S(r)]}}function S(g){return String.fromCharCode.apply(0,g)}if(m(n.random(),r),e.exports){e.exports=c;try{o=Mo}catch{}}else n["seed"+u]=c})(typeof self<"u"?self:B,[],Math)})(Jt);var Do=Jt.exports,jo=Oo,Co=bo,_o=xo,Lo=ko,Uo=To,Fo=Ro,re=Do;re.alea=jo,re.xor128=Co,re.xorwow=_o,re.xorshift7=Lo,re.xor4096=Uo,re.tychei=Fo;function Zt(e){return e*180/Math.PI}var Bo={Unknown:0,LeftController:1,RightController:2},Wo={Unknown:0,Trigger:1,TrackPad:2,Grip:3,Thumbstick:4,A:5,B:6,ApplicationMenu:7},zo={Unknown:0,TouchpadX:1,TouchpadY:2,ThumbstickX:3,ThumbstickY:4},Je={Device:Bo,Input:Wo,Axis:zo};function Qt(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?Qt(Object(r),!0).forEach(function(n){V(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var be=Je.Device,A=Je.Input,xe=T.vtkWarningMacro,ke=T.vtkErrorMacro,$o=T.normalizeWheel,Go=T.vtkOnceErrorMacro,oe=new MouseEvent(""),Ze={"xr-standard":[A.Trigger,A.Grip,A.TrackPad,A.Thumbstick,A.A,A.B]},Qe=["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 le(e){e.cancelable&&e.preventDefault()}function Te(e){var t=Object.create(null);return e.forEach(function(r){var n=r.pointerId,i=r.position;t[n]=i}),t}function No(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 xe("empty event loop")};function h(o,c){t._forcedRenderer||(t.currentRenderer=e.findPokedRenderer(o,c))}e.getCurrentRenderer=function(){return t.currentRenderer||h(0,0),t.currentRenderer};function v(o){var c=t._view.getCanvas(),p=c.getBoundingClientRect(),y=c.width/p.width,d=c.height/p.height,m={x:y*(o.clientX-p.left),y:d*(p.height-o.clientY+p.top),z:0};return(n.size<=1||!t.currentRenderer)&&h(m.x,m.y),m}function u(o){return{controlKey:o.ctrlKey,altKey:o.altKey,shiftKey:o.shiftKey}}function a(o){var c=u(o),p=R({key:o.key,keyCode:o.charCode},c);return p}function s(o){return o.pointerType||""}e.bindEvents=function(o){t.container=o,o.addEventListener("contextmenu",le),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",le),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 c=a(o);e.keyPressEvent(c)},e.handleKeyDown=function(o){var c=a(o);e.keyDownEvent(c)},e.handleKeyUp=function(o){var c=a(o);e.keyUpEvent(c)},e.handlePointerEnter=function(o){var c=R(R({},u(o)),{},{position:v(o),deviceType:s(o)});e.pointerEnterEvent(c),c.deviceType==="mouse"&&e.mouseEnterEvent(c)},e.handlePointerLeave=function(o){var c=R(R({},u(o)),{},{position:v(o),deviceType:s(o)});e.pointerLeaveEvent(c),c.deviceType==="mouse"&&e.mouseLeaveEvent(c)},e.handlePointerDown=function(o){if(!(o.button>2||e.isPointerLocked()))switch(t.preventDefaultOnPointerDown&&le(o),o.target.hasPointerCapture(o.pointerId)&&o.target.releasePointerCapture(o.pointerId),t.container.setPointerCapture(o.pointerId),n.has(o.pointerId)&&xe("[RenderWindowInteractor] duplicate pointerId detected"),n.set(o.pointerId,{pointerId:o.pointerId,position:v(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&&le(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 c=n.get(o.pointerId);c.position=v(o)}switch(o.pointerType){case"pen":case"touch":e.handleTouchMove(o);break;case"mouse":default:e.handleMouseMove(o);break}},e.handleMouseDown=function(o){var c=R(R({},u(o)),{},{position:v(o),deviceType:s(o)});switch(o.button){case 0:e.leftButtonPressEvent(c);break;case 1:e.middleButtonPressEvent(c);break;case 2:e.rightButtonPressEvent(c);break;default:ke("Unknown mouse button pressed: ".concat(o.button));break}},e.requestPointerLock=function(){t.container&&t.container.requestPointerLock()},e.exitPointerLock=function(){var o,c;return(o=(c=document).exitPointerLock)===null||o===void 0?void 0:o.call(c)},e.isPointerLocked=function(){return!!t.container&&document.pointerLockElement===t.container},e.handlePointerLockChange=function(){e.isPointerLocked()?e.startPointerLockEvent():e.endPointerLockEvent()};function f(){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)){xe("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 c=Date.now()+o;t._animationExtendedEnd=Math.max(t._animationExtendedEnd,c),!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 c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(!r.has(o)){if(!c){var p=o&&o.getClassName?o.getClassName():o;xe("".concat(p," 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,c,p){o.inputSources.forEach(function(y){var d=y.gripSpace==null?null:c.getPose(y.gripSpace,p),m=y.gamepad,E=y.handedness;if(m){m.index in t.lastGamepadValues||(t.lastGamepadValues[m.index]={left:{buttons:{}},right:{buttons:{}},none:{buttons:{}}});for(var S=0;S<m.buttons.length;++S)S in t.lastGamepadValues[m.index][E].buttons||(t.lastGamepadValues[m.index][E].buttons[S]=!1),t.lastGamepadValues[m.index][E].buttons[S]!==m.buttons[S].pressed&&d!=null&&(e.button3DEvent({gamepad:m,position:d.transform.position,orientation:d.transform.orientation,pressed:m.buttons[S].pressed,device:y.handedness==="left"?be.LeftController:be.RightController,input:Ze[m.mapping]&&Ze[m.mapping][S]?Ze[m.mapping][S]:A.Trigger}),t.lastGamepadValues[m.index][E].buttons[S]=m.buttons[S].pressed),t.lastGamepadValues[m.index][E].buttons[S]&&d!=null&&e.move3DEvent({gamepad:m,position:d.transform.position,orientation:d.transform.orientation,device:y.handedness==="left"?be.LeftController:be.RightController})}})},e.handleMouseMove=function(o){var c=R(R({},u(o)),{},{position:v(o),deviceType:s(o)});t.moveTimeoutID===0?e.startMouseMoveEvent(c):(e.mouseMoveEvent(c),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(),f(),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){le(o);var c=R(R(R({},$o(o)),u(o)),{},{position:v(o),deviceType:s(o)});t.wheelTimeoutID===0&&(Math.abs(c.spinY)>=.3?i=Math.abs(c.spinY):i=1),c.spinY/=i,t.wheelTimeoutID===0?(e.startMouseWheelEvent(c),e.mouseWheelEvent(c)):(e.mouseWheelEvent(c),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 c=R(R({},u(o)),{},{position:v(o),deviceType:s(o)});switch(o.button){case 0:e.leftButtonReleaseEvent(c);break;case 1:e.middleButtonReleaseEvent(c);break;case 2:e.rightButtonReleaseEvent(c);break;default:ke("Unknown mouse button released: ".concat(o.button));break}},e.handleTouchStart=function(o){var c=se(n.values());if(t.recognizeGestures&&c.length>1){var p=Te(n);if(c.length===2){var y=R(R({},u(oe)),{},{position:c[0].position,deviceType:s(o)});e.leftButtonReleaseEvent(y)}e.recognizeGesture("TouchStart",p)}else if(c.length===1){var d=R(R({},u(oe)),{},{position:v(o),deviceType:s(o)});e.leftButtonPressEvent(d)}},e.handleTouchMove=function(o){var c=se(n.values());if(t.recognizeGestures&&c.length>1){var p=Te(n);e.recognizeGesture("TouchMove",p)}else if(c.length===1){var y=R(R({},u(oe)),{},{position:c[0].position,deviceType:s(o)});e.mouseMoveEvent(y)}},e.handleTouchEnd=function(o){var c=se(n.values());if(t.recognizeGestures)if(c.length===0){var p=R(R({},u(oe)),{},{position:v(o),deviceType:s(o)});e.leftButtonReleaseEvent(p)}else if(c.length===1){var y=Te(n);e.recognizeGesture("TouchEnd",y);var d=R(R({},u(oe)),{},{position:c[0].position,deviceType:s(o)});e.leftButtonPressEvent(d)}else{var m=Te(n);e.recognizeGesture("TouchMove",m)}else if(c.length===1){var E=R(R({},u(oe)),{},{position:c[0].position,deviceType:s(o)});e.leftButtonReleaseEvent(E)}},e.setView=function(o){t._view!==o&&(t._view=o,t._view.getRenderable().setInteractor(e),e.modified())},e.getFirstRenderer=function(){var o,c,p;return(o=t._view)===null||o===void 0||(c=o.getRenderable())===null||c===void 0||(p=c.getRenderersByReference())===null||p===void 0?void 0:p[0]},e.findPokedRenderer=function(){var o,c,p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(!t._view)return null;var d=(o=t._view)===null||o===void 0||(c=o.getRenderable())===null||c===void 0?void 0:c.getRenderers();if(!d||d.length===0)return null;d.sort(function(O,b){return O.getLayer()-b.getLayer()});for(var m=null,E=null,S=null,g=d.length;g--;){var w=d[g];if(t._view.isInViewport(p,y,w)&&w.getInteractive()){S=w;break}m===null&&w.getInteractive()&&(m=w),E===null&&t._view.isInViewport(p,y,w)&&(E=w)}return S===null&&(S=m),S===null&&(S=E),S==null&&(S=d[0]),S},e.render=function(){!e.isAnimating()&&!t.inRender&&f()},Qe.forEach(function(o){var c=o.charAt(0).toLowerCase()+o.slice(1);e["".concat(c,"Event")]=function(p){if(t.enabled){var y=e.getCurrentRenderer();if(!y){Go(`
          Can not forward events without a current renderer on the interactor.
        `);return}var d=R({type:o,pokedRenderer:t.currentRenderer,firstRenderer:e.getFirstRenderer()},p);e["invoke".concat(o)](d)}}}),e.recognizeGesture=function(o,c){if(!(Object.keys(c).length>2)){if(t.startingEventPositions||(t.startingEventPositions={}),o==="TouchStart"){Object.keys(c).forEach(function(ve){t.startingEventPositions[ve]=c[ve]}),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 p=0,y=[],d=[];Object.keys(c).forEach(function(ve){y[p]=c[ve],d[p]=t.startingEventPositions[ve],p++});var m=Math.sqrt((d[0].x-d[1].x)*(d[0].x-d[1].x)+(d[0].y-d[1].y)*(d[0].y-d[1].y)),E=Math.sqrt((y[0].x-y[1].x)*(y[0].x-y[1].x)+(y[0].y-y[1].y)*(y[0].y-y[1].y)),S=Zt(Math.atan2(d[1].y-d[0].y,d[1].x-d[0].x)),g=Zt(Math.atan2(y[1].y-y[0].y,y[1].x-y[0].x)),w=g-S;g=g+180>=360?g-180:g+180,S=S+180>=360?S-180:S+180,Math.abs(g-S)<Math.abs(w)&&(w=g-S);var O=[];if(O[0]=(y[0].x-d[0].x+y[1].x-d[1].x)/2,O[1]=(y[0].y-d[0].y+y[1].y-d[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 k=Math.abs(E-m),M=E*3.1415926*Math.abs(w)/360,_=Math.sqrt(O[0]*O[0]+O[1]*O[1]);if(k>b&&k>M&&k>_){t.currentGesture="Pinch";var U={scale:1,touches:c};e.startPinchEvent(U)}else if(M>b&&M>_){t.currentGesture="Rotate";var $={rotation:0,touches:c};e.startRotateEvent($)}else if(_>b){t.currentGesture="Pan";var W={translation:[0,0],touches:c};e.startPanEvent(W)}}else{if(t.currentGesture==="Rotate"){var N={rotation:w,touches:c};e.rotateEvent(N)}if(t.currentGesture==="Pinch"){var ae={scale:E/m,touches:c};e.pinchEvent(ae)}if(t.currentGesture==="Pan"){var J={translation:O,touches:c};e.panEvent(J)}}}},e.handleVisibilityChange=function(){t._animationStartTime=Date.now(),t._animationFrameCount=0},e.setCurrentRenderer=function(o){t._forcedRenderer=!!o,t.currentRenderer=o};var l=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(),l()},typeof document.hidden<"u"&&document.addEventListener("visibilitychange",e.handleVisibilityChange,!1)}var Vo={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 It(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(t,Vo,r),T.obj(e,t),t._animationExtendedEnd=0,T.event(e,t,"RenderEvent"),Qe.forEach(function(n){return T.event(e,t,n)}),T.get(e,t,["initialized","container","interactorStyle","lastFrameTime","recentAnimationFrameRate","_view"]),T.setGet(e,t,["lightFollowCamera","enabled","enableRender","recognizeGestures","desiredUpdateRate","stillUpdateRate","picker","preventDefaultOnPointerDown","preventDefaultOnPointerUp","mouseScrollDebounceByPass"]),T.moveToProtected(e,t,["view"]),No(e,t)}var Ko=T.newInstance(It,"vtkRenderWindowInteractor"),en=R({newInstance:Ko,extend:It,handledEvents:Qe},Je);function tn(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 nn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?tn(Object(r),!0).forEach(function(n){V(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):tn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var qo=T.vtkErrorMacro,Po=T.VOID;function Xo(e,t,r,n){var i=e.getRenderWindow().getViews()[0];return i.worldToDisplay(t,r,n,e)}function Ho(e,t,r,n){var i=e.getRenderWindow().getViews()[0];return i.displayToWorld(t,r,n,e)}var Yo={computeWorldToDisplay:Xo,computeDisplayToWorld:Ho};function Ao(e,t){t.classHierarchy.push("vtkInteractorObserver");var r=nn({},e);function n(){for(;t.subscribedEvents.length;)t.subscribedEvents.pop().unsubscribe()}function i(){en.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):Po},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():qo(`
          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 Jo={enabled:!0,priority:0,processEvents:!0,subscribedEvents:[]};function rn(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(t,Jo,r),T.obj(e,t),T.event(e,t,"InteractionEvent"),T.event(e,t,"StartInteractionEvent"),T.event(e,t,"EndInteractionEvent"),T.get(e,t,["_interactor","enabled"]),T.setGet(e,t,["priority","processEvents"]),T.moveToProtected(e,t,["interactor"]),Ao(e,t)}var Zo=T.newInstance(rn,"vtkInteractorObserver"),Qo=nn({newInstance:Zo,extend:rn},Yo),Io={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},on={States:Io};function an(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 ea(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?an(Object(r),!0).forEach(function(n){V(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):an(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var G=on.States,Ie={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 ta(e,t){t.classHierarchy.push("vtkInteractorStyle"),Object.keys(Ie).forEach(function(r){T.event(e,t,"Start".concat(r,"Event")),e["start".concat(r)]=function(){t.state===G.IS_NONE&&(t.state=Ie[r],t._interactor.requestAnimation(e),e.invokeStartInteractionEvent({type:"StartInteractionEvent"}),e["invokeStart".concat(r,"Event")]({type:"Start".concat(r,"Event")}))},T.event(e,t,"End".concat(r,"Event")),e["end".concat(r)]=function(){t.state===Ie[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 na={state:G.IS_NONE,handleObservers:1,autoAdjustCameraClippingRange:1};function sn(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(t,na,r),Qo.extend(e,t,r),ta(e,t)}var ra=T.newInstance(sn,"vtkInteractorStyle"),oa=ea({newInstance:ra,extend:sn},on);const he={type:"StartInteractionEvent"},un={type:"InteractionEvent"},pe={type:"EndInteractionEvent"};function aa(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,f=n.metaKey?1:0,l=i||h||v?"down":"up";let{x:o,y:c}=n.position;return{action:l,x:o,y:c,buttonLeft:i,buttonMiddle:h,buttonRight:v,shiftKey:u,altKey:s,ctrlKey:a,metaKey:f,...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(he);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(pe)},e.handleStartMouseWheel=n=>{e.invokeStartInteractionEvent(he),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(un))},e.handleEndMouseWheel=()=>{e.invokeRemoteWheelEvent({type:"EndMouseWheel",...t.remoteEventAddOn}),e.invokeEndInteractionEvent(pe)},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(un)},e.handleKeyPress=()=>{},e.handleStartPinch=n=>{e.startDolly();const{scale:i}=n;e.invokeStartInteractionEvent(he),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(pe)},e.handleStartRotate=n=>{e.startRotate();const{rotation:i}=n;e.invokeStartInteractionEvent(he),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(pe)},e.handleStartPan=n=>{e.startPan();const{translation:i}=n;e.invokeStartInteractionEvent(he),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(pe)},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 ia={buttonLeft:0,buttonMiddle:0,buttonRight:0,sendMouseMove:!1,throttleDelay:33.3,lastThrottleTime:0,wheelThrottleDelay:0,wheelLastThrottleTime:0};function cn(e,t,r={}){Object.assign(t,ia,r),oa.extend(e,t,r),T.setGet(e,t,["sendMouseMove","remoteEventAddOn","throttleDelay","wheelThrottleDelay"]),T.event(e,t,"RemoteMouseEvent"),T.event(e,t,"RemoteWheelEvent"),T.event(e,t,"RemoteGestureEvent"),T.event(e,t,"RemoteKeyEvent"),aa(e,t)}const sa={newInstance:T.newInstance(cn,"vtkInteractorStyleRemoteMouse"),extend:cn},{inject:ua,provide:ca,ref:fn,toRefs:fa,onMounted:la,onBeforeUnmount:ha}=window.Vue,ln=Promise.resolve(!0),hn={DisplayArea:xn,StatisticsDisplay:Rn,ImageDisplayArea:et,RemoteControlledArea:{props:{name:{type:String,default:"default"},origin:{type:String,default:"anonymous"},display:{type:String,default:"image"}},setup(e){const t=fn(null),r=fn(ln),n=ua("trame");let i=!0,h=null,v=0,u=[0,0],a={w:10,h:10,p:window.devicePixelRatio},s=!0,f=ln,l=0;function o(g){return g.preventDefault(),{x:g.clientX-u[0],y:a.h-g.clientY+u[1],z:0}}const c=en.newInstance({_getScreenEventPositionFor:o,currentRenderer:1}),p=sa.newInstance();c.setInteractorStyle(p),p.onRemoteMouseEvent(g=>{y(Object.assign({w:a.w,h:a.h},g))}),p.onRemoteWheelEvent(g=>{y(Object.assign({w:a.w,h:a.h},g))}),p.onRemoteGestureEvent(g=>{y(Object.assign({w:a.w,h:a.h},g))}),p.onRemoteKeyEvent(g=>{y(Object.assign({w:a.w,h:a.h},g))}),p.onStartInteractionEvent(g=>{y(g)}),p.onEndInteractionEvent(g=>{y(g)});function y(g){n&&(i?(i=!1,h=g,r.value=n.client.getConnection().getSession().call("trame.rca.event",[e.name,e.origin,h]),f.finally(d)):h.type!==g.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,g]),h=g))}function d(){i=!0,v&&(v=0,y(h))}function m(){s=!0,l&&(l=0,S())}const E=new ResizeObserver(()=>{if(!t.value)return;const g=t.value.getBoundingClientRect(),{top:w,left:O}=g;a.w=g.width,a.h=g.height,a.p=window.devicePixelRatio,u=[O,w],S()});function S(g){n&&(s?(s=!1,g?f=n.client.getConnection().getSession().call("trame.rca.size",[e.name,e.origin,{...a,...g}]):f=n.client.getConnection().getSession().call("trame.rca.size",[e.name,e.origin,a]),f.finally(m)):l++)}return ca("rcaPushSize",S),la(()=>{E.observe(t.value),c.initialize(),c.bindEvents(t.value)}),ha(()=>{E.unobserve(t.value),c.unbindEvents(t.value)}),{rootElem:t,...fa(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:tt,VideoDecoderDisplayArea:nt,RawImageDisplayArea:rt};function pa(e){Object.keys(hn).forEach(t=>{e.component(t,hn[t])})}Z.install=pa,Object.defineProperty(Z,Symbol.toStringTag,{value:"Module"})});
