@cocalc/static
Version:
CoCalc's static frontend Webpack-based build system and framework
1 lines • 29.3 kB
JavaScript
"use strict";(self.webpackChunk_cocalc_static=self.webpackChunk_cocalc_static||[]).push([[5199],{5199:(e,t,n)=>{n.r(t),n.d(t,{ChunkModel:()=>M,ObjectModel:()=>C,ObjectView:()=>z,PlotModel:()=>X,PlotView:()=>se});var r={};n.r(r),n.d(r,{deserialize:()=>u,serialize:()=>f});var o=n(40847),i=n(18351),s=n(39219),a=n(20812),c={int8:Int8Array,int16:Int16Array,int32:Int32Array,uint8:Uint8Array,uint16:Uint16Array,uint32:Uint32Array,float16:i.Float16Array,float32:Float32Array,float64:Float64Array},l=(0,a.invert)(c);function u(e,t){if(null==e)return null;if("string"==typeof e||"boolean"==typeof e)return e;if((0,a.isNumber)(e))return e;if(null!=e.shape)return function(e){var t=e.dtype;if(null!=e.data)return{dtype:t,data:new c[t](e.data.buffer),shape:e.shape};if(null!=e.compressed_data){var n=new c[t]((0,s.HT)(new Uint8Array(e.compressed_data.buffer)).buffer);return console.log("K3D: Receive: ".concat(n.byteLength," bytes compressed to ").concat(e.compressed_data.byteLength," bytes")),{dtype:t,data:n,shape:e.shape}}return e}(e);if(Array.isArray(e))return e.map((function(e){return u(e,t)}));var n,r=!0,o={};for(var i in e)"data"!=i&&"timeSeries"!=i&&(n=i,(Number.isNaN(parseFloat(n))||!Number.isFinite(parseFloat(n)))&&(r=!1),o[i]=u(e[i],t));return r&&(o.timeSeries=!0),o}function f(e){if((0,a.isNumber)(e))return e;if("string"==typeof e||"boolean"==typeof e)return e;if(null!=e){if(null!=e.data&&null!=e.shape&&null!=e.dtype)return function(e){return null==e.dtype&&(e.dtype=l[e.data.constructor]),e.compression_level&&e.compression_level>0?{dtype:e.dtype,compressed_data:(0,s.iZ)(e.data.buffer,{level:e.compression_level}),shape:e.shape}:{dtype:e.dtype,shape:e.shape,data:e.data}}(e);if(Array.isArray(e))return e.map(f);var t={};for(var n in e)t[n]=f(e[n]);return t}return null}var h={},p={},d=[];function m(e,t){var n=!0,r=!1,o=void 0;try{for(var i,s=d[Symbol.iterator]();!(n=(i=s.next()).done);n=!0){var a=i.value;-1!==a.model.get("object_ids").indexOf(e)&&t(a,a.K3DInstance.getObjectById(e))}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}}function _(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function g(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y(e,t,n){return y="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=b(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(n):o.value}},y(e,t,n||e)}function b(e){return b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},b(e)}function v(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){g(e,t,n[t])}))}return e}function O(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function w(e,t){return!t||"object"!==D(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function j(e,t){return j=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},j(e,t)}var D=function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};var C=function(e){!function(e,t){if("function"!=typeof t&&null!==t)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}}),t&&j(e,t)}(o,e);var t,n,r=(t=o,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=b(t);if(n){var o=b(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return w(this,e)});function o(){return _(this,o),r.apply(this,arguments)}var s=o.prototype;return s.defaults=function(){return O(v({},y(b(o.prototype),"defaults",this).call(this)),{_model_name:"ObjectModel",_view_name:"ObjectView",_model_module:"k3d",_view_module:"k3d",_model_module_version:i.version,_view_module_version:i.version})},s.initialize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=this;y(b(o.prototype),"initialize",this).apply(this,t),this.on("change",this._change,this),this.on("msg:custom",(function(e){if("fetch"===e.msg_type){var t=r.get(e.field);t.data&&t.shape&&(t.compression_level=r.attributes.compression_level),r.save(e.field,t)}"shadow_map_update"===e.msg_type&&"Volume"===r.get("type")&&m(r.get("id"),(function(t,n){(null==n?void 0:n.refreshLightMap)&&(n.refreshLightMap(e.direction),t.K3DInstance.render())}))}),this),null!=t[0].id&&(h[t[0].id]=this)},s.set=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];null!=t[0].id&&(h[t[0].id]=this),y(b(o.prototype),"set",this).apply(this,t)},s._change=function(e){var t=!0,n=!1,r=void 0;try{for(var o,i=d[Symbol.iterator]();!(t=(o=i.next()).done);t=!0)o.value.refreshObject(this,e.changed)}catch(e){n=!0,r=e}finally{try{t||null==i.return||i.return()}finally{if(n)throw r}}},o}(o.WidgetModel);function P(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function I(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function K(e,t,n){return K="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=S(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(n):o.value}},K(e,t,n||e)}function S(e){return S=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},S(e)}function R(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){I(e,t,n[t])}))}return e}function A(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function x(e,t){return!t||"object"!==k(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function E(e,t){return E=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},E(e,t)}C.serializers=O(v({},o.WidgetModel.serializers),{model_matrix:r,positions:r,scalar_field:r,alpha_coef:r,shadow:r,shadow_res:r,shadow_delay:r,ray_samples_count:r,focal_plane:r,focal_length:r,gradient_step:r,color_map:r,samples:r,color_range:r,attribute:r,triangles_attribute:r,vertices:r,indices:r,colors:r,origins:r,vectors:r,opacity:r,opacities:r,point_sizes:r,point_size:r,width:r,shader:r,wireframe:r,radial_segments:r,color:r,flat_shading:r,heights:r,mesh_detail:r,voxels:r,voxels_group:r,sparse_voxels:r,space_size:r,volume:r,opacity_function:r,text:r,texture:r,binary:r,size:r,position:r,puv:r,visible:r,uvs:r,volume_bounds:r,spacings_x:r,spacings_y:r,spacings_z:r});var k=function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};var M=function(e){!function(e,t){if("function"!=typeof t&&null!==t)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}}),t&&E(e,t)}(o,e);var t,n,r=(t=o,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=S(t);if(n){var o=S(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return x(this,e)});function o(){return P(this,o),r.apply(this,arguments)}var s=o.prototype;return s.defaults=function(){return A(R({},K(S(o.prototype),"defaults",this).call(this)),{_model_name:"ChunkModel",_model_module:"k3d",_model_module_version:i.version})},s.initialize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];K(S(o.prototype),"initialize",this).apply(this,t),this.on("change",this._change,this),null!=t[0].id&&(p[t[0].id]=this)},s.set=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];null!=t[0].id&&(p[t[0].id]=this),K(S(o.prototype),"set",this).apply(this,t)},s._change=function(){var e=this.attributes;for(var t in h)"VoxelsGroup"===h[t].attributes.type&&m(h[t].attributes.id,(function(t,n){n.updateChunk(e)}))},o}(o.WidgetModel);function T(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function L(e){return L=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},L(e)}function V(e,t){return!t||"object"!==G(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function F(e,t){return F=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},F(e,t)}M.serializers=A(R({},o.WidgetModel.serializers),{voxels:r,coord:r});var G=function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};var z=function(e){!function(e,t){if("function"!=typeof t&&null!==t)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}}),t&&F(e,t)}(o,e);var t,n,r=(t=o,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=L(t);if(n){var o=L(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return V(this,e)});function o(){return T(this,o),r.apply(this,arguments)}return o}(o.WidgetView);function B(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function N(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function H(e,t,n){return H="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=U(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(n):o.value}},H(e,t,n||e)}function U(e){return U=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},U(e)}function W(e,t){return!t||"object"!==Z(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function J(e,t){return J=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},J(e,t)}var Z=function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};var X=function(e){!function(e,t){if("function"!=typeof t&&null!==t)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}}),t&&J(e,t)}(o,e);var t,n,r=(t=o,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=U(t);if(n){var o=U(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return W(this,e)});function o(){return B(this,o),r.apply(this,arguments)}return o.prototype.defaults=function(){return e=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){N(e,t,n[t])}))}return e}({},H(U(o.prototype),"defaults",this).call(this)),t=null!=(t={_model_name:"PlotModel",_view_name:"PlotView",_model_module:"k3d",_view_module:"k3d",_model_module_version:i.version,_view_module_version:i.version})?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e;var e,t},o}(o.DOMWidgetModel),Y=n(95788);function q(e,t,n,r,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,o)}function Q(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ee(e,t,n){return ee="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=te(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(n):o.value}},ee(e,t,n||e)}function te(e){return te=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},te(e)}function ne(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){$(e,t,n[t])}))}return e}function re(e,t){return!t||"object"!==ie(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function oe(e,t){return oe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},oe(e,t)}var ie=function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};var se=function(e){!function(e,t){if("function"!=typeof t&&null!==t)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}}),t&&oe(e,t)}(o,e);var t,n,r=(t=o,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=te(t);if(n){var o=te(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return re(this,e)});function o(){var e;return Q(this,o),(e=r.apply(this,arguments)).listeners={},e.lastCameraSync=0,e}var s=o.prototype;return s.render=function(){var e=window.document.createElement("div"),t=window.document.createElement("div");e.style.cssText=["height:".concat(this.model.get("height"),"px"),"position: relative"].join(";"),t.style.cssText=["width: 100%","height: 100%","position: relative"].join(";"),e.appendChild(t),this.el.appendChild(e),this.container=t,this.on("displayed",this._init,this)},s.remove=function(){for(var e in(0,a.pull)(d,this),this.K3DInstance.off(this.K3DInstance.events.CAMERA_CHANGE,this.cameraChangeId),this.K3DInstance.off(this.K3DInstance.events.OBJECT_CHANGE,this.GUIObjectChanges),this.K3DInstance.off(this.K3DInstance.events.PARAMETERS_CHANGE,this.GUIParametersChanges),this.K3DInstance.off(this.K3DInstance.events.VOXELS_CALLBACK,this.voxelsCallback),this.K3DInstance.off(this.K3DInstance.events.OBJECT_HOVERED,this.objectHoverCallback),this.K3DInstance.off(this.K3DInstance.events.OBJECT_CLICKED,this.objectClickCallback),this.listeners)this.model.off(e,this.listeners[e],this)},s.modifyMenuForCoCalc=function(){this.K3DInstance.gui.children[0].children[0].domElement.className+=" hidden",this.K3DInstance.gui.children[0].children[1].domElement.className+=" hidden"},s._init=function(){var e=this,t=this;this.renderPromises=[],d.push(this),this.model.on("msg:custom",(function(n){var r=e.model;"fetch_screenshot"===n.msg_type&&e.K3DInstance.getScreenshot(e.K3DInstance.parameters.screenshotScale,n.only_canvas).then((function(e){var t=e.toDataURL().split(",")[1];r.save("screenshot",t,{patch:!0})})),"fetch_snapshot"===n.msg_type&&r.save("snapshot",e.K3DInstance.getHTMLSnapshot(n.compression_level),{patch:!0}),"start_auto_play"===n.msg_type&&e.K3DInstance.startAutoPlay(),"stop_auto_play"===n.msg_type&&e.K3DInstance.stopAutoPlay(),"reset_camera"===n.msg_type&&e.K3DInstance.resetCamera(n.factor),"render"===n.msg_type&&(0===t.renderPromises.length?t.K3DInstance.refreshAfterObjectsChange(!1,!0):Promise.all(t.renderPromises).then((function(e){t.K3DInstance.refreshAfterObjectsChange(!1,!0),e.length===t.renderPromises.length&&(t.renderPromises=[])})))}),this);try{var n,r;this.K3DInstance=new i.K3D(i.ThreeJsProvider,this.container,{antialias:this.model.get("antialias"),logarithmicDepthBuffer:this.model.get("logarithmic_depth_buffer"),lighting:this.model.get("lighting"),cameraMode:this.model.get("camera_mode"),snapshotType:this.model.get("snapshot_type"),backendVersion:this.model.get("_backend_version"),screenshotScale:this.model.get("screenshot_scale"),menuVisibility:this.model.get("menu_visibility"),cameraNoRotate:this.model.get("camera_no_rotate"),cameraNoZoom:this.model.get("camera_no_zoom"),cameraNoPan:this.model.get("camera_no_pan"),cameraRotateSpeed:this.model.get("camera_rotate_speed"),cameraZoomSpeed:this.model.get("camera_zoom_speed"),cameraPanSpeed:this.model.get("camera_pan_speed"),cameraDampingFactor:this.model.get("camera_damping_factor"),cameraFov:this.model.get("camera_fov"),colorbarObjectId:this.model.get("colorbar_object_id"),cameraAnimation:this.model.get("camera_animation"),name:this.model.get("name"),axes:this.model.get("axes"),axesHelper:this.model.get("axes_helper"),grid:this.model.get("grid"),fps:this.model.get("fps"),autoRendering:this.model.get("auto_rendering")&&0==(null!==(r=null===(n=this.model.get("camera"))||void 0===n?void 0:n.length)&&void 0!==r?r:0),gridVisible:this.model.get("grid_visible"),gridColor:this.model.get("grid_color"),clippingPlanes:this.model.get("clipping_planes"),labelColor:this.model.get("label_color")}),this._setCamera(),this._setFpsMeter(),this.model.get("auto_rendering")&&setTimeout((function(){return e._setAutoRendering()}),0),this.modifyMenuForCoCalc()}catch(e){return void console.log("WARNING: Issue creating K3DInstance -- ".concat(e))}for(var o in this.listeners={"change:lighting":this._setDirectionalLightingIntensity,"change:time":this._setTime,"change:grid_auto_fit":this._setGridAutoFit,"change:grid_visible":this._setGridVisible,"change:grid_color":this._setGridColor,"change:label_color":this._setLabelColor,"change:fps_meter":this._setFpsMeter,"change:fps":this._setFps,"change:screenshot_scale":this._setScreenshotScale,"change:voxel_paint_color":this._setVoxelPaintColor,"change:background_color":this._setBackgroundColor,"change:grid":this._setGrid,"change:auto_rendering":this._setAutoRendering,"change:camera":this._setCamera,"change:camera_animation":this._setCameraAnimation,"change:clipping_planes":this._setClippingPlanes,"change:object_ids":this._onObjectsListChange,"change:menu_visibility":this._setMenuVisibility,"change:colorbar_object_id":this._setColorMapLegend,"change:colorbar_scientific":this._setColorbarScientific,"change:rendering_steps":this._setRenderingSteps,"change:axes":this._setAxes,"change:camera_no_rotate":this._setCameraLock,"change:camera_no_zoom":this._setCameraLock,"change:camera_no_pan":this._setCameraLock,"change:camera_rotate_speed":this._setCameraSpeeds,"change:camera_zoom_speed":this._setCameraSpeeds,"change:camera_pan_speed":this._setCameraSpeeds,"change:camera_fov":this._setCameraFOV,"change:camera_damping_factor":this._setCameraDampingFactor,"change:axes_helper":this._setAxesHelper,"change:snapshot_type":this._setSnapshotType,"change:name":this._setName,"change:mode":this._setViewMode,"change:camera_mode":this._setCameraMode,"change:manipulate_mode":this._setManipulateMode},this.listeners)this.model.on(o,this.listeners[o],this);this.K3DInstance.setClearColor(this.model.get("background_color")),this.K3DInstance.setChunkList(p),this._setGridAutoFit(),this._setMenuVisibility(),this._setVoxelPaintColor();var s,a,c=this;this.model.get("object_ids").forEach((s=function(e){var t,n;return function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}(this,(function(r){switch(r.label){case 0:return null!=h[e]?[3,2]:[4,(0,Y.delay)(100)];case 1:return r.sent(),[3,0];case 2:return null==h[e]?(console.log("plot-view: init - ".concat(e," missing object")),[2]):(n=[ne({group:null},null===(t=h[e])||void 0===t?void 0:t.attributes)])[0].type?(c.renderPromises.push(c.K3DInstance.load({objects:n})),[2]):(console.log("plot-view: init - ".concat(e," missing TYPE")),[2])}}))},a=function(){var e=this,t=arguments;return new Promise((function(n,r){var o=s.apply(e,t);function i(e){q(o,n,r,i,a,"next",e)}function a(e){q(o,n,r,i,a,"throw",e)}i(void 0)}))},function(e){return a.apply(this,arguments)}),this),this.cameraChangeId=this.K3DInstance.on(this.K3DInstance.events.CAMERA_CHANGE,(function(e){(new Date).getTime()-t.lastCameraSync>200&&(t.lastCameraSync=(new Date).getTime(),t.model.save("camera",e,{patch:!0}))})),this.GUIObjectChanges=this.K3DInstance.on(this.K3DInstance.events.OBJECT_CHANGE,(function(e){e.value.data&&e.value.shape&&(e.value.compression_level=h[e.id].attributes.compression_level),h[e.id]&&h[e.id].save(e.key,e.value,{patch:!0})})),this.GUIParametersChanges=this.K3DInstance.on(this.K3DInstance.events.PARAMETERS_CHANGE,(function(e){t.model.save(e.key,e.value,{patch:!0})})),this.voxelsCallback=this.K3DInstance.on(this.K3DInstance.events.VOXELS_CALLBACK,(function(e){h[e.object.K3DIdentifier]&&h[e.object.K3DIdentifier].send({msg_type:"click_callback",coord:e.coord})})),this.objectHoverCallback=this.K3DInstance.on(this.K3DInstance.events.OBJECT_HOVERED,(function(e){h[e.object.K3DIdentifier]&&h[e.object.K3DIdentifier].send({msg_type:"hover_callback",position:e.point.toArray(),normal:e.face.normal.toArray(),distance:e.distance,face_index:e.faceIndex,face:[e.face.a,e.face.b,e.face.c],uv:e.uv})})),this.objectClickCallback=this.K3DInstance.on(this.K3DInstance.events.OBJECT_CLICKED,(function(e){h[e.object.K3DIdentifier]&&h[e.object.K3DIdentifier].send({msg_type:"click_callback",position:e.point.toArray(),normal:e.face.normal.toArray(),distance:e.distance,face_index:e.faceIndex,face:[e.face.a,e.face.b,e.face.c],uv:e.uv})}))},s._setDirectionalLightingIntensity=function(){this.K3DInstance.setDirectionalLightingIntensity(this.model.get("lighting"))},s._setTime=function(){this.K3DInstance.parameters.time!==this.model.get("time")&&this.renderPromises.push(this.K3DInstance.setTime(this.model.get("time")))},s._setGridAutoFit=function(){this.K3DInstance.setGridAutoFit(this.model.get("grid_auto_fit"))},s._setGridVisible=function(){this.K3DInstance.setGridVisible(this.model.get("grid_visible"))},s._setGridColor=function(){this.K3DInstance.setGridColor(this.model.get("grid_color"))},s._setLabelColor=function(){this.K3DInstance.setLabelColor(this.model.get("label_color"))},s._setFps=function(){this.K3DInstance.setFps(this.model.get("fps"))},s._setFpsMeter=function(){this.K3DInstance.setFpsMeter(this.model.get("fps_meter"))},s._setScreenshotScale=function(){this.K3DInstance.setScreenshotScale(this.model.get("screenshot_scale"))},s._setVoxelPaintColor=function(){this.K3DInstance.setVoxelPaint(this.model.get("voxel_paint_color"))},s._setBackgroundColor=function(){this.K3DInstance.setClearColor(this.model.get("background_color"))},s._setGrid=function(){this.K3DInstance.setGrid(this.model.get("grid"))},s._setAutoRendering=function(){this.K3DInstance.setAutoRendering(this.model.get("auto_rendering"))},s._setMenuVisibility=function(){this.K3DInstance.setMenuVisibility(this.model.get("menu_visibility"))},s._setColorMapLegend=function(){this.K3DInstance.setColorMapLegend(this.model.get("colorbar_object_id"))},s._setColorbarScientific=function(){this.K3DInstance.setColorbarScientific(this.model.get("colorbar_scientific"))},s._setCamera=function(){this.K3DInstance.setCamera(this.model.get("camera"))},s._setCameraAnimation=function(){this.K3DInstance.setCameraAnimation(this.model.get("camera_animation"))},s._setRenderingSteps=function(){this.K3DInstance.setRenderingSteps(this.model.get("rendering_steps"))},s._setAxes=function(){this.K3DInstance.setAxes(this.model.get("axes"))},s._setName=function(){this.K3DInstance.setName(this.model.get("name"))},s._setViewMode=function(){this.K3DInstance.setViewMode(this.model.get("mode"))},s._setCameraMode=function(){this.K3DInstance.setCameraMode(this.model.get("camera_mode"))},s._setManipulateMode=function(){this.K3DInstance.setManipulateMode(this.model.get("manipulate_mode"))},s._setAxesHelper=function(){this.K3DInstance.setAxesHelper(this.model.get("axes_helper"))},s._setSnapshotType=function(){this.K3DInstance.setSnapshotType(this.model.get("snapshot_type"))},s._setCameraLock=function(){this.K3DInstance.setCameraLock(this.model.get("camera_no_rotate"),this.model.get("camera_no_zoom"),this.model.get("camera_no_pan"))},s._setCameraSpeeds=function(){this.K3DInstance.setCameraSpeeds(this.model.get("camera_rotate_speed"),this.model.get("camera_zoom_speed"),this.model.get("camera_pan_speed"))},s._setCameraFOV=function(){this.K3DInstance.setCameraFOV(this.model.get("camera_fov"))},s._setCameraDampingFactor=function(){this.K3DInstance.setCameraDampingFactor(this.model.get("camera_damping_factor"))},s._setClippingPlanes=function(){this.K3DInstance.setClippingPlanes(this.model.get("clipping_planes"))},s._onObjectsListChange=function(){var e=this,t=this.model.previous("object_ids"),n=this.model.get("object_ids");(0,a.difference)(t,n).forEach((function(t){e.renderPromises.push(e.K3DInstance.removeObject(t))}),this),(0,a.difference)(n,t).forEach((function(t){null!=h[t]?e.renderPromises.push(e.K3DInstance.load({objects:[ne({group:null},h[t].attributes)]})):console.log("plot-view: difference - ".concat(t," missing"))}),this)},s.refreshObject=function(e,t){if(-1!==this.model.get("object_ids").indexOf(e.get("id"))){var n=e.get("id");if(null==h[n])return void console.log("plot-view: refreshObject - ".concat(n," missing"));this.renderPromises.push(this.K3DInstance.reload(ne({group:null},h[n].attributes),t))}},s.processPhosphorMessage=function(e){switch(ee(te(o.prototype),"processPhosphorMessage",this).call(this,e),e.type){case"after-attach":this.el.addEventListener("contextmenu",this,!0);break;case"before-detach":this.el.removeEventListener("contextmenu",this,!0);break;case"resize":this.handleResize()}},s.handleEvent=function(e){"contextmenu"===e.type&&this.handleContextMenu(e)},s.handleContextMenu=function(e){this.container.contains(e.target)&&(e.preventDefault(),e.stopPropagation())},s.handleResize=function(){this.K3DInstance&&this.K3DInstance.resizeHelper()},o}(o.DOMWidgetView)}}]);