ohzi-core 10.8.0 → 10.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three"),t=require("three/examples/jsm/utils/BufferGeometryUtils.js"),r=require("three/examples/jsm/loaders/ColladaLoader.js"),s=require("three/examples/jsm/loaders/FontLoader.js"),i=require("three/examples/jsm/loaders/GLTFLoader.js"),n=require("three/examples/jsm/loaders/HDRCubeTextureLoader.js"),o=require("three/examples/jsm/loaders/OBJLoader.js"),a=require("three/examples/jsm/loaders/RGBELoader.js");function _(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var l=_(t);const h=new class{async init(){switch(this.browser_name="",this.agent=window.navigator.userAgent.toLowerCase(),this.has_web_xr_support="xr"in navigator,this.is_vr=this.has_web_xr_support&&await navigator.xr.isSessionSupported("immersive-vr"),!0){case this.agent.indexOf("edge")>-1:this.browser_name="edge_ie";break;case this.agent.indexOf("edg")>-1:this.browser_name="edge_chromium";break;case this.agent.indexOf("opr")>-1&&!!window.opr:this.browser_name="opera";break;case this.agent.indexOf("chrome")>-1&&!!window.chrome:this.browser_name="chrome";break;case this.agent.indexOf("trident")>-1:this.browser_name="iexplorer";break;case this.agent.indexOf("firefox")>-1:this.browser_name="firefox";break;case this.agent.indexOf("safari")>-1:this.browser_name="safari";break;default:this.browser_name="other"}this.version=this.get_version()}get name(){return this.browser_name}get is_safari(){return"safari"===this.browser_name}get is_chrome(){return"chrome"===this.browser_name}get is_edge(){return"edge_ie"===this.browser_name}get is_edge_chromium(){return"edge_chromium"===this.browser_name}get has_webm(){return!!(this.is_chrome||this.is_firefox||this.is_edge_chromium)}get has_hvec(){return this.is_safari}get preferred_video_extension(){return this.has_webm?"webm":this.has_hvec?"hvec.mp4":"mp4"}get_version(){const e=navigator.userAgent;let t="",r=0,s=e.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[];return/trident/i.test(s[1])&&(t=/\brv[ :]+(\d+)/g.exec(e)||[],r="IE "+(t[1]||"")),"Chrome"===s[1]&&(t=e.match(/\b(OPR|Edge)\/(\d+)/),null!=t&&(r=t.slice(1).join(" ").replace("OPR","Opera"))),s=s[2]?[s[1],s[2]]:[navigator.appName,navigator.appVersion,"-?"],null!=(t=e.match(/version\/(\d+(\.\d+)?)/i))&&s.splice(1,1,t[1]),r=s.join(" "),Number(r.split(" ")[1])}};class c{constructor(){}static is_int(e){return Number(e)===e&&e%1==0}static is_float(e){return Number(e)===e&&e%1!=0}static is_number(e){return this.is_int(e)||this.is_float(e)}static is_json(e){try{JSON.parse(e)}catch(e){return!1}return!0}}class u{constructor(e,t,r=1){this.resource_id=e,this.url=t,this.loaded_bytes=0,this.total_bytes=r,this.has_finished=!1,this.has_error=!1,this.error_message="none"}__update_downloaded_bytes(e,t){e=c.is_number(e)?e:1,t=c.is_number(t)?t:1,this.loaded_bytes=e,t>0&&(this.total_bytes=t),this.loaded_bytes>this.total_bytes&&console.warn("Total bytes is smaller than loaded ones. Please set total bytes by hand to:",this.url)}__loading_ended(){this.has_finished=!0}__set_error(e){this.has_error=!0,this.error_message=e}print_error(){console.error("Error while loading "+this.resource_id+"\n\t path: "+this.url+"\n\t\t"+this.error_message)}load(e){if(void 0===e.resources_by_url[this.url]){const t=h.is_safari?"no-cache":"default";fetch(this.url,{method:"GET",mode:"cors",cache:t,credentials:"same-origin",redirect:"follow"}).then(this.on_progress.bind(this,e)).catch(this.__on_error.bind(this))}else e.set_resource(this.resource_id,this.url,e.resources_by_url[this.url]),this.__update_downloaded_bytes(1,1),this.__loading_ended()}async on_progress(e,t){const r=t.clone(),s=t.body.getReader(),i=+t.headers.get("Content-Length");let n=0;for(;;){const{done:e,value:t}=await s.read();if(e)break;n+=t.length,this.__update_downloaded_bytes(n,i)}this.on_preloaded_finished(e,r)}on_preloaded_finished(e,t){}__on_error(e){console.error(e)}}class d{constructor(){}static linear_map(e,t,r,s,i){return(e-t)/(r-t)*(i-s)+s}static between(e,t,r){return e>=t&&e<=r}static mod(e,t){return(e%t+t)%t}static rgb_to_hex(e){return e.r=Math.round(255*e.r).toString(16),e.g=Math.round(255*e.g).toString(16),e.b=Math.round(255*e.b).toString(16),1===e.r.length&&(e.r="0"+e.r),1===e.g.length&&(e.g="0"+e.g),1===e.b.length&&(e.b="0"+e.b),"#"+e.r+e.g+e.b}static project_points_on_plane(t,r){const s=new e.Vector3,i=[];for(let e=0;e<t.length;e++)r.projectPoint(t[e],s),i.push(s.clone());return i}static matrix4_lerp(e,t,r,s){for(let i=0;i<16;i++)r.elements[i]=this.lerp(e.elements[i],t.elements[i],s)}static equals(e,t){return Math.abs(e-t)<1e-6}static lerp(e,t,r){return(1-r)*e+r*t}static clamp(e,t,r){return Math.max(t,Math.min(r,e))}static euclideanModulo(e,t){return(e%t+t)%t}static pingpong(e,t=1){return t-Math.abs(d.euclideanModulo(e,2*t)-t)}static degToRad(e){return e*(Math.PI/180)}static radToDeg(e){return e*(180/Math.PI)}static deg_to_rad(e){return e*(Math.PI/180)}static rad_to_deg(e){return e*(180/Math.PI)}static perspective_divide(e){return e.x/=e.w,e.y/=e.w,e.z/=e.w,e}static points_average(e){const t=e[0].clone();for(let r=1;r<e.length;r++)t.add(e[r]);return t.multiplyScalar(1/e.length),t}static get_random_color(){const e=[0,1,2,3,4,5,6,7,8,9,"a","b","c","d","e","f"];let t="#";return t+=e[Math.floor(16*Math.random())],t+=e[Math.floor(16*Math.random())],t+=e[Math.floor(16*Math.random())],t+=e[Math.floor(16*Math.random())],t+=e[Math.floor(16*Math.random())],t+=e[Math.floor(16*Math.random())],t}static saturate(e){return d.clamp(e,0,1)}}class p{constructor(e={}){this.previous_elapsed_time=-1e-5,this.elapsed_time=-1e-5,this.playback_speed=this.__get_playback_speed(),this.playing=!0,this.action_events=[],this.context=e,this.initial_context=JSON.parse(JSON.stringify(e)),this.tmp_t=0,this.channels={};const t=Object.keys(e);for(let e=0;e<t.length;e++)this.channels[t[e]]=[];this.duration=0}play(){this.playing=!0}stop(){this.playing=!1}reset(){this.elapsed_time=-1e-5}skip(){const e=this.get_duration();this.__play_clips(this.elapsed_time,e+1e-4),this.elapsed_time=e}update(e){this.playing&&(this.previous_elapsed_time=this.elapsed_time,this.elapsed_time+=e*this.playback_speed,this.__play_clips(this.previous_elapsed_time,this.elapsed_time))}set_progress(e){this.previous_elapsed_time=this.elapsed_time,this.elapsed_time=d.clamp(e,0,this.duration),this.__play_clips(this.elapsed_time,this.elapsed_time)}set_normalized_progress(e){this.previous_elapsed_time=this.elapsed_time,this.elapsed_time=d.clamp(e,0,1)*this.duration,this.__play_clips(this.elapsed_time,this.elapsed_time)}get_progress(){return d.clamp(this.elapsed_time/this.get_duration(),0,1)}is_finished(){return this.elapsed_time>this.get_duration()}add_action_event(e,t){this.action_events.push({trigger_time:e,action:t}),this.duration=Math.max(this.duration,e)}add_action_interpolator(e,t,r,s=!1){if(s){const e=this.channels[r.attribute_name];void 0===e&&console.error(`${r.attribute_name} missing in initial state data.`),0===e.length?r.from=this.initial_context[r.attribute_name]:r.from=e[e.length-1].interpolator.to}const i={from:e,to:t,interpolator:r};this.duration=Math.max(this.duration,t),this.channels[r.attribute_name].push(i)}get_current_target_value(e){const t=this.__get_current_keyframe(e,this.elapsed_time);return this.elapsed_time<t.from?t.interpolator.evaluate(0):t.interpolator.evaluate(1)}get_current_starting_value(e){return this.__get_current_keyframe(e,this.elapsed_time).interpolator.evaluate(0)}get_current_progress(e){const t=this.__get_current_keyframe(e,this.elapsed_time),r=this.__linear_map_01(this.elapsed_time,t.from,t.to);return t.interpolator.easing_function(r)}get_duration(){return this.duration}__play_clips(e,t){this.elapsed_time>this.previous_elapsed_time&&this.__play_events(this.previous_elapsed_time,this.elapsed_time);const r=Object.keys(this.initial_context);for(let t=0;t<r.length;t++){const s=r[t],i=this.__get_current_keyframe(s,e);this.context[s]=this.evaluate_keyframe(i,e)}}__play_events(e,t){for(let r=0;r<this.action_events.length;r++){const s=this.action_events[r].trigger_time;d.between(s,e,t)&&(console.log("Play event: "+this.action_events[r].action.constructor.name+" at "+this.action_events[r].trigger_time),this.action_events[r].action.trigger())}}evaluate_keyframe(e,t){return this.tmp_t=this.__linear_map_01(t,e.from,e.to),e.interpolator.evaluate(d.clamp(this.tmp_t,0,1))}get_keyframes(e){return this.channels[e]}is_channel_redefined(e){for(let t=0;t<this.channels[e].length;t++){if(this.channels[e][t].interpolator.initial)return!1}return!0}__linear_map_01(e,t,r){return d.saturate((e-t)/(r-t)*1+0)}__get_current_keyframe(e,t){let r;const s=this.channels[e];for(let e=0;e<s.length;e++){const i=s[e];if(t>=i.from&&t<=i.to)return r=i,r}let i=1/0;for(let e=0;e<s.length;e++){const n=s[e],o=Math.abs(n.to-t);o<i&&(r=n,i=o)}return r}__get_playback_speed(){const e=new URLSearchParams(window.location.search).get("transitions_velocity");return e?Number(e):1}}class m{constructor(){}static linear(e){return e}static triangular(e){return 1-Math.abs(2*e%2-1)}static ease_in_sine(e){return 1-Math.cos(3.1415926*e/2)}static ease_out_sine(e){return Math.sin(3.1415926*e/2)}static ease_in_out_sine(e){return-(Math.cos(3.1415926*e)-1)/2}static ease_in_cubic(e){return e*e*e}static ease_out_cubic(e){return 1-Math.pow(1-e,3)}static ease_in_out_cubic(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}static ease_in_quad(e){return e*e}static ease_out_quad(e){return 1-(1-e)*(1-e)}static ease_in_out_quad(e){return e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2}static ease_in_quart(e){return e*e*e*e}static ease_out_quart(e){return 1-Math.pow(1-e,4)}static ease_in_out_quart(e){return e<.5?8*e*e*e*e:1-Math.pow(-2*e+2,4)/2}static ease_in_quint(e){return e*e*e*e*e}static ease_out_quint(e){return 1-Math.pow(1-e,5)}static ease_in_out_quint(e){return e<.5?16*e*e*e*e*e:1-Math.pow(-2*e+2,5)/2}static ease_in_expo(e){return 0===e?0:Math.pow(2,10*e-10)}static ease_out_expo(e){return 1===e?1:1-Math.pow(2,-10*e)}static ease_in_out_expo(e){return 0===e?0:1===e?1:e<.5?Math.pow(2,20*e-10)/2:(2-Math.pow(2,-20*e+10))/2}static ease_in_circ(e){return 1-Math.sqrt(1-Math.pow(e,2))}static ease_out_circ(e){return Math.sqrt(1-Math.pow(e-1,2))}static ease_in_out_circ(e){return e<.5?(1-Math.sqrt(1-Math.pow(2*e,2)))/2:(Math.sqrt(1-Math.pow(-2*e+2,2))+1)/2}static ease_in_back(e){return 2.7015*e*e*e-1.7015*e*e}static ease_out_back(e){return 1+2.7015*Math.pow(e-1,3)+1.7015*Math.pow(e-1,2)}static ease_in_out_back(e){return e<.5?Math.pow(2*e,2)*(7.189819*e-2.5949095)/2:(Math.pow(2*e-2,2)*(3.5949095*(2*e-2)+2.5949095)+2)/2}static ease_in_elastic(e){const t=2*Math.PI/3;return 0===e?0:1===e?1:-Math.pow(2,10*e-10)*Math.sin((10*e-10.75)*t)}static ease_out_elastic(e){return 0===e?0:1===e?1:Math.pow(2,-10*e)*Math.sin(2.094395*(10*e-.75))+1}static ease_in_out_elastic(e){return 0===e?0:1===e?1:e<.5?-Math.pow(2,20*e-10)*Math.sin(1.3962633*(20*e-11.125))/2:Math.pow(2,-20*e+10)*Math.sin(1.3962633*(20*e-11.125))/2+1}static ease_in_bounce(e){return 1-this.ease_out_bounce(1-e)}static ease_out_bounce(e){const t=7.5625,r=2.75;return e<1/r?t*e*e:e<2/r?t*(e-=1.5/r)*e+.75:e<2.5/r?t*(e-=2.25/r)*e+.9375:t*(e-=2.625/r)*e+.984375}static ease_in_out_bounce(e){return e<.5?(1-this.ease_out_bounce(1-2*e))/2:(1+this.ease_out_bounce(2*e-1))/2}static heartbeat(e){return 1-Math.pow(Math.abs(Math.sin(e+1)),63)*Math.sign(Math.sin(e))*Math.sin(e+1.5+1)*.8}}class g{constructor(e="linear"){this.easing_function=void 0,this.easing_function="string"==typeof e?m[e]:e}update(e,t){}}class f extends g{constructor(e,t=0,r=1,s=!1,i="linear"){super(i),this.attribute_name=e,this.from=t,this.to=r,this.initial=s}update(e,t){e[this.attribute_name]=d.lerp(this.from,this.to,this.easing_function(t))}evaluate(e){return d.lerp(this.from,this.to,this.easing_function(e))}}const v=new class{constructor(){this.app=void 0}set_app(e){this.app=e}};class x{constructor(e,t,r){this.name=e,this.method=t,this.args=r}trigger(){v.app[this.name][this.method](...this.args.split(","))}}class b{constructor(){}parse(e){const t=(new DOMParser).parseFromString(e,"text/xml").querySelectorAll("mxGeometry"),r=[],s=[];for(let e=0;e<t.length;e++){const i=t[e],n=i.parentElement,o=n.getAttribute("value"),a=this.get_node_x_position(i)/100,_=parseFloat(i.getAttribute("width"))/100;if(n.getAttribute("style").includes("rhombus;")){const e=o.split("."),t=e[0],r=e[1];s.push({name:t,method:r,at_time:a+.5*_})}if(n.getAttribute("style").includes("rounded=0;")&&!n.getAttribute("style").includes("text;")&&""!==o&&!o.includes(" ")){const e=o.split("="),t=e[0],s=e[1].split("--"),i=parseFloat(s[0]),n=s[1];2!==e.length&&console.error("DrawIO data is malformed:",o),2!==s.length&&console.error("DrawIO data is malformed:",o),r.push({attribute_name:t,from_time:a,to_time:a+_,to_value:i,easing_function:n})}}return r.sort(((e,t)=>e.from_time-t.from_time)),{animation_tracks:r,triggers:s}}get_node_x_position(e){const t=e.getAttribute("x");return null===t?0:parseFloat(t)}}class w{constructor(e){this.default_state_data=e}from_animation_sheet(e,t,r){r=r||this.default_state_data;const s=e.animation_tracks,i=e.triggers,n=this.state_to_tracks(this.default_state_data,this.get_longest_time(e.animation_tracks));for(let e=0;e<n.length;e++)void 0===s.find((t=>t.attribute_name===n[e].attribute_name))&&s.push(n[e]);const o=new p(t);for(let e=0;e<s.length;e++){const r=s[e],i=new f(r.attribute_name,t[r.attribute_name],r.to_value,r.initial,r.easing_function);o.add_action_interpolator(r.from_time,r.to_time,i,!0)}for(let e=0;e<i.length;e++){const t=i[e],r=new x(t.name,t.method,t.args);o.add_action_event(t.at_time,r)}return o}state_to_tracks(e,t){const r=[],s=Object.keys(e);for(let i=0;i<s.length;i++)r.push({attribute_name:s[i],from_time:0,to_time:t<1?t:1,to_value:e[s[i]],initial:!0,easing_function:"ease_in_out_cubic"});return r}from_draw_io(e,t){const r=(new b).parse(e),s=r.animation_tracks,i=r.triggers,n=new p(t);for(let e=0;e<s.length;e++){const r=s[e],i=new f(r.attribute_name,t[r.attribute_name],r.to_value,r.initial,r.easing_function);n.add_action_interpolator(r.from_time,r.to_time,i,!0)}for(let e=0;e<i.length;e++){const t=i[e],r=new x(t.name,t.method);n.add_action_event(t.at_time,r)}return n}get_longest_time(e){let t=-1;for(let r=0;r<e.length;r++){const s=e[r].to_time;t=s>t?s:t}return t}}const y=new class{init(){this.queue={},this.zoom_changed_evt="zoom_changed",this.store_clickd_evt="store_clicked",this.point_selected_evt="point_selected",this.config_changed="config_changed",this.path_substep_completed="path_substep_completed",this.path_completed="path_completed",this.go_to_store_requested_evt="go_to_store_requested",this.resource_loaded_evt="resource_loaded",this.service_clicked_evt="service_clicked",this.unit_pos_updated_evt="unit_position_updated",this.floor_changed_evt="floor_changed",this.on_enter_floor_navigation="on_enter_floor_navigation",this.on_exit_floor_navigation="on_exit_floor_navigation",this.on_enter_floor_selection="on_enter_floor_selection",this.on_exit_floor_selection="on_exit_floor_selection",this.on_enter_outside_navigation="on_enter_outside_navigation",this.on_exit_outside_navigation="on_exit_outside_navigation",this.step_selected_evt="step_selected"}fire(e,t){const r=this.queue[e];if(void 0===r)return;let s=r.length;for(;s--;)r[s](t)}on(e,t){void 0===this.queue[e]&&(this.queue[e]=[]),this.queue[e].push(t)}fire_zoom_changed(e){this.fire(this.zoom_changed_evt,e)}fire_store_selected(e){this.fire(this.store_clickd_evt,e)}fire_point_selected(e){this.fire(this.point_selected_evt,e)}fire_config_changed(){this.fire(this.config_changed)}fire_path_substep_completed(e){this.fire(this.path_substep_completed,e)}fire_path_completed(){this.fire(this.path_completed)}fire_step_selected(e){this.fire(this.step_selected_evt,e)}fire_go_to_store_requested(e){this.fire(this.go_to_store_requested_evt,e)}fire_resource_loaded(e){this.fire(this.resource_loaded_evt,e)}fire_service_clicked(e){this.fire(this.service_clicked_evt,e)}fire_unit_position_updated(e){this.fire(this.unit_pos_updated_evt,e)}fire_floor_switched(e){this.fire(this.floor_changed_evt,e)}fire_on_enter_floor_navigation(e){this.fire(this.on_enter_floor_navigation,e)}fire_on_exit_floor_navigation(e){this.fire(this.on_exit_floor_navigation,e)}fire_on_enter_floor_selection(e){this.fire(this.on_enter_floor_selection,e)}fire_on_exit_floor_selection(e){this.fire(this.on_exit_floor_selection,e)}fire_on_enter_outside_navigation(e){this.fire(this.on_enter_outside_navigation,e)}fire_on_exit_outside_navigation(e){this.fire(this.on_exit_outside_navigation,e)}};const T=new class{init(){this.resources={},this.resources_by_url={}}set_resource(e,t,r){Object.keys(this.resources_by_url).includes(t)?this.resources[e]=this.resources_by_url[t]:(this.resources[e]=r,this.resources_by_url[t]=r),y.fire_resource_loaded({name:e,value:r})}get_resource(e){return this.resources[e]}get(e){return this.resources[e]}};class M{static load_images(e){const t=e.querySelectorAll("img");for(let e=0;e<t.length;e++){const r=t[e];r.dataset.src&&(r.src=r.dataset.src)}const r=e.querySelectorAll("object");for(let e=0;e<r.length;e++){const t=r[e];t.dataset.src&&(t.data=t.dataset.src)}}static load_videos(e){const t=e.querySelectorAll("video");for(let e=0;e<t.length;e++){const r=t[e];r.dataset.src&&(r.src=r.dataset.src)}}static load_iframes(e){const t=e.querySelectorAll("iframe");for(let e=0;e<t.length;e++){const r=t[e];r.dataset.src&&(r.src=r.dataset.src)}}static load_elements(e,t){const r=e.querySelectorAll(t);for(let e=0;e<r.length;e++){const t=r[e];t.dataset.src&&(t.src=t.dataset.src)}}}class S{constructor(){this.transitions=[],this.default_state_data={}}get(e,t,r){for(let s=0;s<this.transitions.length;s++)if(this.transitions[s].from===e&&this.transitions[s].to===t){return new w(this.default_state_data).from_animation_sheet(this.transitions[s].data,r)}for(let e=0;e<this.transitions.length;e++)if(this.transitions[e].to===t&&void 0===this.transitions[e].from){return new w(this.default_state_data).from_animation_sheet(this.transitions[e].data,r)}console.error("TransitionTable.get no data found for: ",e,t)}add_transitions(e){for(let t=0;t<e.length;t++)this.transitions.push(e[t])}set_transitions(e){this.transitions=e}set_default_state_data(e){this.default_state_data=e}}const F=new class{constructor(){this.__delta_buffer=[.016,.016,.016,.016,.016,.016,.016,.016,.016,.016]}init(){this.___time=new e.Clock,this.__delta_time=0,this.__smooth_delta_time=0,this.__elapsed_time=0,this.__allocated_time=new e.Vector2(0,0),this.__frame_interpolation_t=0,this.fixed_delta_time=1/30}get elapsed_time(){return this.__elapsed_time}get delta_time(){return this.__delta_time}get smooth_delta_time(){return this.__smooth_delta_time}get shader_time(){return this.__allocated_time.x=this.delta_time,this.__allocated_time.y=this.elapsed_time,this.__allocated_time}get frame_interpolation(){return this.__frame_interpolation_t}get fdt(){return this.fixed_delta_time}get dt(){return this.delta_time}get sdt(){return this.smooth_delta_time}__set_frame_interpolation(e){this.__frame_interpolation_t=e}__update(){this.__delta_time=this.___time.getDelta(),this.__elapsed_time=this.___time.getElapsedTime(),this.__delta_buffer.shift(),this.__delta_buffer.push(this.delta_time<.32?this.delta_time:.032),this.__calculate_smooth_delta_time()}__calculate_smooth_delta_time(){this.__smooth_delta_time=0;for(let e=0;e<this.__delta_buffer.length;e++)this.__smooth_delta_time+=this.__delta_buffer[e];this.__smooth_delta_time=this.__smooth_delta_time/this.__delta_buffer.length}};class z{constructor(e){this.name=e}start(){}show(){}hide(){}before_enter(){}on_enter(){}before_update(){}update(){}fixed_update(){}update_enter_transition(e,t,r){this.update_transition(e,t,r)}update_exit_transition(e,t,r){}update_transition(e,t,r){}before_exit(){}on_exit(){}}class A{constructor(e){this.last_state=new z,this.current_state=new z,this.default_state_data={},this.current_state_data={},this.transition_table=e,this.transitioning=!1}go_to_state(e,t=!1){this.transitioning&&this.__exit_last_state(),this.last_state=this.current_state,this.current_state=e,this.last_state.before_exit(),this.current_state.show(),this.action_sequencer=this.transition_table.get(this.last_state.name,this.current_state.name,this.current_state_data),this.current_state.before_enter(),this.action_sequencer.play(),this.transitioning=!0,t&&(this.action_sequencer.skip(),this.update())}update(){this.transitioning?(this.__update_transitions(),this.action_sequencer.is_finished()&&(this.transitioning=!1,this.__update_transitions(),this.__exit_last_state(),this.current_state.on_enter())):this.current_state.update()}before_update(){this.current_state.before_update()}fixed_update(){this.current_state.fixed_update()}set_state(e){this.current_state=e}set_default_state_data(e){Object.assign(this.default_state_data,e),Object.assign(this.current_state_data,e)}__update_transitions(){this.action_sequencer.update(F.delta_time),this.last_state.update_exit_transition(this.current_state_data,this.action_sequencer.get_progress(),this.action_sequencer),this.current_state.update_enter_transition(this.current_state_data,this.action_sequencer.get_progress(),this.action_sequencer)}__exit_last_state(){this.last_state.name!==this.current_state.name&&this.last_state.hide(),this.last_state.on_exit()}}const R=new class{constructor(){this.views=[],this.transition_table=new S,this.transition_handler=new A(this.transition_table),this.view_change_subscribers=[],this.browser_title_suffix=""}before_update(){this.transition_handler.before_update()}update(){this.transition_handler.update(),this.__set_views_opacities()}fixed_update(){this.transition_handler.fixed_update()}go_to_view(e,t=!0,r=!1){const s=this.get(e);this.transition_handler.go_to_state(s,r),t&&(this.__change_browser_url(s.url),this.__change_browser_title(s.url)),this.notify_view_change(e)}go_to_scene(e,t=!1,r=!1){const s=this.get(e),i=this.get("transition");i.set_next_view(s),this.go_to_view(i.name,t,r)}subscribe_to_view_change(e){this.view_change_subscribers.push(e)}notify_view_change(e){for(let t=0;t<this.view_change_subscribers.length;t++){this.view_change_subscribers[t].on_view_change(e)}}register_view(e){this.views.push(e)}has_view(e){for(let t=0;t<this.views.length;t++)if(this.views[t].name===e)return!0;return!1}add_transitions(e){this.transition_table.add_transitions(e)}set_transitions(e){this.transition_table.set_transitions(e)}set_view(e){const t=this.get(e);this.transition_handler.set_state(t)}set_browser_title_suffix(e){this.browser_title_suffix=e}get_current_view(){return this.transition_handler.current_state}get_view_by_name(e){console.warn("DEPRECATED. Use ViewManager.get instead"),this.get(e)}get(e){for(let t=0;t<this.views.length;t++)if(this.views[t].name===e)return this.views[t];console.error("[ViewManager.get] no view found for: ",e)}get_view_by_url(e){console.warn("DEPRECATED. Use ViewManager.get_by_url instead"),this.get_by_url(e)}get_by_url(e){for(let t=0;t<this.views.length;t++)if(this.views[t].url===e)return this.views[t];console.error("[ViewManager.get_by_url] no view found for: ",e)}set_default_state_data(e){this.transition_table.set_default_state_data(e),this.transition_handler.set_default_state_data(e)}__change_browser_url(e){window.history.pushState("","",e)}__change_browser_title(e){const t=this.__capitalize(e);document.title=t?`${t} | ${this.browser_title_suffix}`:this.browser_title_suffix}__set_views_opacities(){for(let e=0;e<this.views.length;e++)this.views[e].set_opacity(this.transition_handler.current_state_data)}__capitalize(e){let t=e.toUpperCase().replace("/","");return t=this.__snake_to_whitespace(t),t}__snake_to_whitespace(e){return e.replace(/([-_][A-Z])/g,(e=>e.replace("-"," ").replace("_"," ")))}};class C{on_post_start(){}on_enter(){}on_exit(){}before_update(){}update(){}fixed_update(){}on_post_render(){}on_pre_render(){}on_frame_end(){}}class V{constructor(){}render(){}on_enter(e,t){}on_exit(e,t){}resize(){}dispose(){}}var P="#define GLSLIFY 1\nvarying vec2 vUv;void main(){vec3 pos=position;mat4 MVP=projectionMatrix*modelViewMatrix;gl_Position=MVP*vec4(pos,1.0);vUv=uv;}",L="#define GLSLIFY 1\nuniform vec3 _Color;void main(){gl_FragColor=vec4(_Color,1.0);}";class D extends e.ShaderMaterial{constructor(t,r,s){super({vertexShader:t||P,fragmentShader:r||L,uniforms:s||{_Color:{value:new e.Color("#FF0000")}}})}}class k extends e.ShaderMaterial{constructor(t,r,s){super({uniforms:{_MainTex:{value:null},_Resolution:{value:new e.Vector2(0,0)},_TargetResolution:{value:new e.Vector2(0,0)}},defines:s||{},vertexShader:r||"#define GLSLIFY 1\nvarying vec2 vUv;void main(){gl_Position=vec4(uv*2.0-1.0,1.0,1.0);vUv=uv;}",fragmentShader:t||"#define GLSLIFY 1\nuniform sampler2D _MainTex;varying vec2 vUv;void main(){gl_FragColor=texture2D(_MainTex,vUv);}",depthWrite:!1,blending:e.NoBlending,depthTest:!1,depthFunc:e.AlwaysDepth})}}class B extends k{constructor(e){super("#define GLSLIFY 1\nuniform sampler2D _MainTex;uniform sampler2D _SecondTex;varying vec2 vUv;void main(){gl_FragColor=texture2D(_MainTex,vUv);gl_FragColor+=texture2D(_SecondTex,vUv);}"),this.uniforms._SecondTex={value:void 0}}set_add_texture(e){this.uniforms._SecondTex.value=e}}class U extends k{constructor(t){super("#define GLSLIFY 1\nvarying vec2 vUv;uniform sampler2D blurTexture1;uniform sampler2D blurTexture2;uniform sampler2D blurTexture3;uniform sampler2D blurTexture4;uniform sampler2D blurTexture5;uniform float bloomStrength;uniform float bloomRadius;uniform float bloomFactors[NUM_MIPS];uniform vec3 bloomTintColors[NUM_MIPS];float lerpBloomFactor(const in float factor){float mirrorFactor=1.2-factor;return mix(factor,mirrorFactor,bloomRadius);}void main(){gl_FragColor=bloomStrength*(lerpBloomFactor(bloomFactors[0])*vec4(bloomTintColors[0],1.0)*texture2D(blurTexture1,vUv)+lerpBloomFactor(bloomFactors[1])*vec4(bloomTintColors[1],1.0)*texture2D(blurTexture2,vUv)+lerpBloomFactor(bloomFactors[2])*vec4(bloomTintColors[2],1.0)*texture2D(blurTexture3,vUv)+lerpBloomFactor(bloomFactors[3])*vec4(bloomTintColors[3],1.0)*texture2D(blurTexture4,vUv)+lerpBloomFactor(bloomFactors[4])*vec4(bloomTintColors[4],1.0)*texture2D(blurTexture5,vUv));}",void 0,{NUM_MIPS:t}),this.uniforms._MainTex={value:void 0},this.uniforms._BlurredTex={value:void 0},this.uniforms._BloomStrength={value:1},this.uniforms.blurTexture1={value:null},this.uniforms.blurTexture2={value:null},this.uniforms.blurTexture3={value:null},this.uniforms.blurTexture4={value:null},this.uniforms.blurTexture5={value:null},this.uniforms.bloomStrength={value:1},this.uniforms.bloomFactors={value:[1,.8,.6,.4,.2]},this.uniforms.bloomRadius={value:0};const r=[new e.Color("#FFFFFF"),new e.Color("#FFFFFF"),new e.Color("#FFFFFF"),new e.Color("#FFFFFF"),new e.Color("#FFFFFF")];this.uniforms.bloomTintColors={value:r}}set_RT_0(e){this.uniforms.blurTexture1.value=e}set_RT_1(e){this.uniforms.blurTexture2.value=e}set_RT_2(e){this.uniforms.blurTexture3.value=e}set_RT_3(e){this.uniforms.blurTexture4.value=e}set_RT_4(e){this.uniforms.blurTexture5.value=e}set_bloom_strength(e){this.uniforms.bloomStrength.value=e}set_bloom_radius(e){this.uniforms.bloomRadius.value=e}set_tint_color_0(e){this.uniforms.bloomTintColors.value[0].set(e)}set_tint_color_1(e){this.uniforms.bloomTintColors.value[1].set(e)}set_tint_color_2(e){this.uniforms.bloomTintColors.value[2].set(e)}set_tint_color_3(e){this.uniforms.bloomTintColors.value[3].set(e)}set_tint_color_4(e){this.uniforms.bloomTintColors.value[4].set(e)}}const O=new class{init(){this._current=void 0,this._spectator=void 0}set current(e){this._current=e}get current(){return this._current}set spectator(e){this._spectator=e}get spectator(){return this._spectator}};const G=new class{init(){this.max_anisotropy=0,this.vertex_texture_sampler_available=!1,this.fp_textures_available=!1}};class j{constructor(e){this.uses_dynamic_font=e,this.__textHeight=null,this.canvas=document.createElement("canvas"),this.ctx=this.canvas.getContext("2d")}getFontHeight(e="Arial"){if(null==this.__textHeight||this.uses_dynamic_font){const t=document.getElementsByTagName("body")[0],r=document.createElement("div"),s=document.createTextNode("MÉqgOLAKTAL");r.appendChild(s),r.setAttribute("style",`font:${e};position:absolute;top:0;left:0`),t.appendChild(r),this.__textHeight=r.offsetHeight,t.removeChild(r)}return this.__textHeight}get_text_size(t,r="24px Arial"){const s=new e.Vector2;return this.ctx.font=r,s.x=Math.ceil(this.ctx.measureText(t).width),s.y=Math.ceil(this.getFontHeight(r)),s}draw_canvas(e,t={}){return t.font=t.font||"24px Arial",t.font_color=t.font_color||"#000000",this.__draw(e,t,this.canvas,this.ctx),this.canvas}draw_on_texture(t,r){const s=this.draw_canvas(t,r),i=new e.CanvasTexture(s,e.UVMapping,e.ClampToEdgeWrapping,e.ClampToEdgeWrapping,e.NearestFilter,e.NearestFilter);return i.generateMipMaps=!1,i.needsUpdate=!0,i}__draw(e,t){}roundRect(e,t,r,s,i,n,o,a){if(void 0===a&&(a=!0),void 0===n&&(n=5),"number"==typeof n)n={tl:n,tr:n,br:n,bl:n};else{const e={tl:0,tr:0,br:0,bl:0};for(const t in e)n[t]=n[t]||e[t]}e.beginPath(),e.moveTo(t+n.tl,r),e.lineTo(t+s-n.tr,r),e.quadraticCurveTo(t+s,r,t+s,r+n.tr),e.lineTo(t+s,r+i-n.br),e.quadraticCurveTo(t+s,r+i,t+s-n.br,r+i),e.lineTo(t+n.bl,r+i),e.quadraticCurveTo(t,r+i,t,r+i-n.bl),e.lineTo(t,r+n.tl),e.quadraticCurveTo(t,r,t+n.tl,r),e.closePath(),o&&e.fill(),a&&e.stroke()}}const I=new class{init(e={}){this.dpr=1,this.app={}}from_json(e){}};class N{constructor(){}get is_animating(){return!1}on_enter(e){}update(e){}on_exit(e){}}class q{constructor(){this.t=0,this.easing_function_t=0}get is_animating(){return!0}on_enter(e){}update(e){this.t+=F.delta_time/e.duration,this.easing_function_t=e.easing_function(this.t),this.easing_function_t=d.clamp(this.easing_function_t,0,1),e.set_property_value(d.lerp(e.from,e.to,this.easing_function_t)),this.easing_function_t>=.9999&&(e.set_property_value(e.to),e.set_current_state(new N),e.finished_callback(e))}on_exit(e){}}class W extends e.Object3D{constructor(t=1){super();const r=[];r.push(new e.Vector3(0,0,0)),r.push(new e.Vector3(0,0,1e3));const s=new e.LineBasicMaterial({color:4474111,depthFunc:e.AlwaysDepth}),i=(new e.BufferGeometry).setFromPoints(r),n=new e.Line(i,s);n.renderOrder=5e4;const o=[];o.push(new e.Vector3(0,0,0)),o.push(new e.Vector3(0,1e3,0));const a=new e.LineBasicMaterial({color:4521796,depthFunc:e.AlwaysDepth}),_=(new e.BufferGeometry).setFromPoints(o),l=new e.Line(_,a);l.renderOrder=5e4;const h=[];h.push(new e.Vector3(0,0,0)),h.push(new e.Vector3(1e3,0,0));const c=new e.LineBasicMaterial({color:16729156,depthFunc:e.AlwaysDepth}),u=(new e.BufferGeometry).setFromPoints(h),d=new e.Line(u,c);d.renderOrder=5e4,this.renderOrder=1e5,this.add(n),this.add(l),this.add(d),this.scale.set(t,t,t)}update(){}dispose(){}}const Y=new class{init(){this._current=new e.Scene,this._current.name="default_scene"}add_scene(e){}get current(){return this._current}set current(e){this._current=e}dispose(){for(this.current.traverse((e=>{e.geometry&&(e.geometry.dispose(),e.material.dispose())}));this.current.children.length>0;)this.current.remove(this.current.children[0])}};class E extends e.Mesh{constructor(t,r,s){t=t||new e.Vector3(1,1,1),r=r||new e.Vector3(1,1,1),s=s||16711680;super(new e.BoxGeometry(t.x,t.y,t.z,r.x,r.y,r.z),new e.MeshBasicMaterial({color:s}))}}class Q extends e.Mesh{constructor(t,r){r=r||"#FF0000",t=t||1;super(new e.SphereGeometry(t,64,64),new e.MeshBasicMaterial({color:r}))}}class X extends e.Mesh{constructor(t,r,s){t=t||"#FF0000";const i=(r=r||1)-.4,n=new e.CylinderGeometry(.01,.01,i,32);n.translate(0,i/2,0);const o=new e.ConeGeometry(.1,.4,32);o.translate(0,i+.2,0);const a=l.mergeGeometries([n,o]);a.rotateX(1.57);super(a,new e.MeshBasicMaterial({color:t})),s&&this.quaternion.setFromUnitVectors(new e.Vector3(0,0,1),s),this._dir=s}set dir(t){this.quaternion.setFromUnitVectors(new e.Vector3(0,0,1),t),this._dir=t}get dir(){return this._dir}set length(e){this.scale.z=e}get length(){return this.scale.z}}const H=new class{init(){this.width=1,this.height=1,this.position=new e.Vector2,this.render_width=1,this.render_height=1,this.width_height=new e.Vector2(this.width,this.height),this.dpr=1,this.pixel_size=new e.Vector2(1/this.width,1/this.height)}update_position(e,t){this.position.set(e,t)}update(){this.size_changed=!1}update_size(t,r){this.width=t,this.height=r,this.pixel_size=new e.Vector2(1/this.width,1/this.height),this.width_height.x=t,this.width_height.y=r,this.render_width=t*this.dpr,this.render_height=r*this.dpr,this.size_changed=!0}apply_pixel_density_v2(e){return e.multiplyScalar(1/this.dpr),e}apply_pixel_density(e){return e*(1/this.dpr)}get_pixel_size(){return this.pixel_size}get aspect_ratio(){return this.width/this.height}get portrait(){return this.width<this.height}};class $ extends D{constructor(t,r,s,i){super("\n uniform vec2 _ScreenSpacePosition;\n uniform vec2 _ScreenSize;\n uniform vec2 _TextureSize;\n varying vec2 vUv;\n void main()\n {\n vec2 pos = uv * vec2(_TextureSize.x / _ScreenSize.x, _TextureSize.y / _ScreenSize.y);\n pos += vec2(_ScreenSpacePosition.x / _ScreenSize.x, _ScreenSpacePosition.y / _ScreenSize.y);\n\n pos.x = pos.x * 2.0 - 1.0;\n pos.y = pos.y * 2.0 - 1.0;\n\n gl_Position = vec4(pos, 0.0, 1.0);\n vUv = uv;\n }\n ","\n uniform sampler2D _MainTex;\n varying vec2 vUv;\n\n void main()\n {\n gl_FragColor = texture2D(_MainTex, vUv);\n }\n ",{_MainTex:{value:void 0},_ScreenSpacePosition:{value:new e.Vector2},_ScreenSize:{value:new e.Vector2},_TextureSize:{value:new e.Vector2}})}set_position(e,t){this.uniforms._ScreenSpacePosition.value.set(e,t)}set_texture(e,t,r){this.uniforms._MainTex.value=e,this.uniforms._TextureSize.value.set(e.image.width,e.image.height),void 0!==t&&(this.uniforms._TextureSize.value.x=t),void 0!==r&&(this.uniforms._TextureSize.value.y=r)}set_screen_size(e,t){this.uniforms._ScreenSize.value.set(e,t)}}class Z extends e.PerspectiveCamera{constructor(t,r,s,i){super(t,r,s,i),this.clear_color=new e.Color("#000000"),this.clear_alpha=1}copy(e){return super.copy(e),this.clear_color.copy(e.clear_color),this.clear_alpha=e.clear_alpha,this}}const J=new class{init(){this.Vector3_one=new e.Vector3(1,1,1),this.Vector3_zero=new e.Vector3(0,0,0),this.canvas_renderer=void 0,this.display_texture_meshes=[],this.ctx=void 0,this.scene=new e.Scene,this.camera=new Z(60,H.aspect_ratio,.1,1e3),this.camera.clear_alpha=0}draw_arrow(e,t,r=16711680){const s=new X(r,t.length(),t.clone().normalize());return s.position.copy(e),this.scene.add(s),s}draw_axis(){const e=new W;return this.scene.add(e),e}set_debug_RT(e){this.rt_debug=e}draw_rectangle(e,t,r,s){t=t||100,r=r||100,this.ctx.fillStyle=s||"rgba(255, 0, 0, 1)",this.ctx.fillRect(e.x-t/2,this.ctx.canvas.height-e.y-r/2,t,r)}clear(){this.ctx&&this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height)}draw_line_2D(e,t,r){this.ctx.strokeStyle=r||"rgba(255, 0, 0, 1)",this.ctx.beginPath(),this.ctx.moveTo(e.x,e.y),this.ctx.lineTo(t.x,t.y),this.ctx.closePath(),this.ctx.stroke()}draw_line(t,r=16711680){const s=new e.LineBasicMaterial({color:r}),i=(new e.BufferGeometry).setFromPoints(t),n=new e.Line(i,s);return n.frustumCulled=!1,this.scene.add(n),n}draw_cube(t,r,s){r=r||1,s=s||16711680,t=t||new e.Vector3;const i=new E(new e.Vector3(r,r,r),void 0,s);return i.position.copy(t),this.scene.add(i),i}draw_oriented_cube(t,r,s=1,i="#FF0000",n=.1){const o=t.distanceTo(r),a=new E(new e.Vector3(n,s,o),void 0,i),_=r.clone().sub(t).multiplyScalar(.5),l=_.clone().normalize();return _.add(t),a.position.copy(_),a.quaternion.setFromUnitVectors(new e.Vector3(0,0,-1),l),this.scene.add(a),a}draw_plane(t,r,s){const i=new e.PlaneGeometry(t,r),n=new e.ShaderMaterial({uniforms:{_Color:{value:new e.Vector4(0,1,0,.2)}},vertexShader:P,fragmentShader:L,transparent:!0,depthWrite:!1}),o=new e.Mesh(i,n);return o.renderOrder=-1e4,this.scene.add(o),o}draw_empty_cube(t,r,s){r=r||1,s=s||16711680;const i=(new e.Box3).setFromCenterAndSize(new e.Vector3,new e.Vector3(r,r,r)),n=new e.Box3Helper(i,s);return n.position.copy(t||new e.Vector3),n}draw_sphere(t,r,s){r=r||1,s=s||16711680,t=t||new e.Vector3;const i=new Q(r,s);return i.position.copy(t),this.scene.add(i),i}draw_point_array(t,r=!1,s=16711680){const i=new e.CatmullRomCurve3(t,r);i.updateArcLengths();const n=i.getSpacedPoints(200);return this.draw_line(n,65280)}draw_sphere_helper(t,r){r=r||16711680;const s=new e.SphereGeometry(t.radius,32,32),i=new e.MeshBasicMaterial({color:r}),n=new e.Mesh(s,i);return n.position.copy(t.center),Y.current.add(n),n}draw_math_sphere(t){const r=new e.SphereGeometry(t.radius,32,32),s=new e.ShaderMaterial({uniforms:{_Color:{value:new e.Vector4(1,0,0,.2)}},vertexShader:P,fragmentShader:L,transparent:!0}),i=new e.Mesh(r,s);i.position.copy(t.center),Y.current.add(i)}draw_bounding_box(t){const r=new e.Box3Helper(t,16776960);Y.current.add(r)}draw_curve(t,r){const s=new e.Vector3(0,0,0);r&&(s.y=r.offset||0);for(let e=0;e<t.length-1;e++)this.draw_line(t[e].clone().add(s),t[e+1].clone().add(s))}draw_texture(t,r,s){const i=new e.Mesh(new e.PlaneGeometry(1,1),new $);return this.display_texture_meshes.push(i),this.scene.add(i),i.material.set_texture(t,r,s),i}render(e){for(let e=0;e<this.display_texture_meshes.length;e++)this.display_texture_meshes[e].material.set_screen_size(H.width,H.height);this.scene.children.length>0&&e.render(this.scene,O.current)}};class K{constructor(t){this.renderer=t,this._blit_scene=new e.Scene,this._blit_material=new k,this._blit_quad=new e.Mesh(new e.PlaneGeometry(1,1),this._blit_material),this._blit_scene.add(this._blit_quad),this._blit_camera=new e.OrthographicCamera(-1,1,1,-1,-1e4,1e4)}blit(e,t){this._blit_quad.material=this._blit_material;const r=!0===e.isWebGLRenderTarget?e.texture:e,s=!0===e.isWebGLRenderTarget?e.width:e.image.width,i=!0===e.isWebGLRenderTarget?e.height:e.image.height;this._blit_quad.material.uniforms._MainTex.value=r,this._blit_quad.material.uniforms._Resolution.value.set(s,i),t?this._blit_quad.material.uniforms._TargetResolution.value.set(t.width,t.height):this.renderer.getSize(this._blit_quad.material.uniforms._TargetResolution.value),this.__render(t)}material_pass(e,t){this._blit_quad.material=e,this.__render(t)}blit_with_material(e,t,r){const s=!0===e.isWebGLRenderTarget?e.texture:e,i=!0===e.isWebGLRenderTarget?e.width:e.image.width,n=!0===e.isWebGLRenderTarget?e.height:e.image.height;this._blit_quad.material=r,this._blit_quad.material.uniforms._MainTex.value=s,this._blit_quad.material.uniforms._Resolution.value.set(i,n),t?this._blit_quad.material.uniforms._TargetResolution.value.set(t.width,t.height):this.renderer.getSize(this._blit_quad.material.uniforms._TargetResolution.value),this.__render(t)}blit_clear_with_material(e,t){this._blit_quad.material=t,this.__render(e)}dispose(){this._blit_quad.geometry.dispose(),this._blit_quad.material.dispose()}__render(e){e=void 0===e?null:e;const t=this.renderer.getRenderTarget();this.renderer.setRenderTarget(void 0===e?null:e),this.renderer.render(this._blit_scene,this._blit_camera),this.renderer.setRenderTarget(t)}}class ee extends k{constructor(t,r){super("#define GLSLIFY 1\nuniform vec4 _DepthNormal;vec2 EncodeFloatRG(float v){vec2 kEncodeMul=vec2(1.0,255.0);float kEncodeBit=1.0/255.0;vec2 enc=kEncodeMul*v;enc=fract(enc);enc.x-=enc.y*kEncodeBit;return enc;}vec2 EncodeNormal(vec3 n){float scale=1.7777;vec2 enc=n.xy/(n.z+1.0);enc/=scale;enc=enc*0.5+0.5;return enc;}void main(){gl_FragColor=vec4(EncodeFloatRG(_DepthNormal.x),EncodeNormal(normalize(_DepthNormal.yzw)));}"),this.uniforms._DepthNormal={value:new e.Vector4(t,r.x,r.y,r.z)}}}class te extends e.ShaderMaterial{constructor(){super({uniforms:{_FarPlane:{value:1}},vertexShader:"#define GLSLIFY 1\nvarying vec3 v_normal;varying vec3 v_pos;void main(){vec3 pos=position;mat4 MVP=projectionMatrix*modelViewMatrix;v_normal=(modelViewMatrix*vec4(normal,0.0)).xyz;v_pos=(modelViewMatrix*vec4(pos,1.0)).xyz;gl_Position=MVP*vec4(pos,1.0);}",fragmentShader:"#define GLSLIFY 1\nvarying vec3 v_normal;varying vec3 v_pos;uniform float _FarPlane;vec2 EncodeFloatRG(float v){vec2 kEncodeMul=vec2(1.0,255.0);float kEncodeBit=1.0/255.0;vec2 enc=kEncodeMul*v;enc=fract(enc);enc.x-=enc.y*kEncodeBit;return enc;}vec2 EncodeNormal(vec3 n){float scale=1.7777;vec2 enc=n.xy/(n.z+1.0);enc/=scale;enc=enc*0.5+0.5;return enc;}void main(){gl_FragColor=vec4(EncodeFloatRG(length(v_pos.z)/_FarPlane),EncodeNormal(normalize(v_normal)));}"})}set far_plane(e){this.uniforms._FarPlane.value=e}get far_plane(){return this.uniforms._FarPlane.value}}class re{constructor(){this.RT=new e.WebGLRenderTarget(H.width,H.height),this.clear_depth_normal_mat=new ee(1,new e.Vector3(0,0,1)),this.depth_normal_material=new te}render(e){this.__resize_RT_if_necessary(),e.clear(this.RT,void 0,!0,!0),e.blit_clear_with_material(this.RT,this.clear_depth_normal_mat),this.depth_normal_material.far_plane=O.current.far,e.render(void 0,void 0,this.RT,this.depth_normal_material)}__resize_RT_if_necessary(){this.RT.width===H.width&&this.RT.height===H.height||this.RT.setSize(H.width,H.height)}get render_target(){return this.RT}}const se=new class{init(t,r,s,i){this._renderer=void 0,this.blitter=void 0,this.canvas=void 0,this.no_render=void 0,this.current_render_mode=void 0,this.generateDepthNormalTexture=!1,this.depth_and_normals_renderer=void 0,this.is_webgl2=!1,this.canvas_context=void 0,this.context_attributes=void 0,this.core_attributes={force_webgl2:!0,xr_enabled:!1},this.context_attributes={alpha:!0,antialias:!1,depth:!0,desynchronized:!1,failIfMajorPerformanceCaveat:!1,powerPreference:"high-performance",premultipliedAlpha:!0,preserveDrawingBuffer:!0,stencil:!1},this.threejs_attributes={logarithmicDepthBuffer:!1},Object.assign(this.core_attributes,r),Object.assign(this.context_attributes,s),Object.assign(this.threejs_attributes,this.context_attributes),Object.assign(this.threejs_attributes,i),this.core_attributes.force_webgl2?this.canvas_context=t.getContext("webgl2",this.context_attributes)||t.getContext("webgl",this.context_attributes)||t.getContext("experimental-webgl",this.context_attributes):this.canvas_context=t.getContext("webgl",this.context_attributes)||t.getContext("experimental-webgl",this.context_attributes),this.is_webgl2="WebGL2RenderingContext"===this.canvas_context.constructor.name,this.threejs_attributes.canvas=t,this.threejs_attributes.context=this.canvas_context,this._renderer=new e.WebGLRenderer(this.threejs_attributes),this.core_attributes.xr_enabled?this._renderer.xr.enabled=!0:this._renderer.autoClear=!1,this._renderer.setPixelRatio(1),H.dpr=I.dpr,this.is_webgl2||this._renderer.extensions.get("ANGLE_instanced_arrays"),this.blitter=new K(this._renderer),this.canvas=this._renderer.domElement,this.no_render=new V,this.current_render_mode=this.no_render,G.max_anisotropy=this._renderer.capabilities.getMaxAnisotropy(),G.vertex_texture_sampler_available=this._renderer.capabilities.maxVertexTextures>0,G.fp_textures_available=this.is_floating_point_texture_available(),this.generateDepthNormalTexture=!1,this.depth_and_normals_renderer=new re,this.resize_observer=new ResizeObserver(this.on_resize.bind(this)),this.resize_observer.observe(this.canvas)}get dom_element(){return this._renderer.domElement}get depth_normals_RT(){return this.depth_and_normals_renderer.render_target}set_state(e){this.current_render_mode.on_exit(this,this._renderer),this.current_render_mode=e,this.current_render_mode.on_enter(this,this._renderer)}update(){this.generateDepthNormalTexture&&this.depth_and_normals_renderer.render(this),this.__update_current_camera(),O.current&&this.current_render_mode.render(),H.update()}__update_current_camera(){O.current&&(O.current.aspect=H.aspect_ratio,O.current.updateProjectionMatrix(),O.current.updateMatrix(),O.current.updateMatrixWorld(!0))}render(e,t,r,s){this.__apply_override_material(e,s),this._renderer.setRenderTarget(void 0===r?null:r),this._renderer.render(e||Y.current,t||O.current),this.__apply_override_material(e,void 0)}compile(e,t,r,s){this.__apply_override_material(e,s),this._renderer.setRenderTarget(void 0===r?null:r),this._renderer.compile(e||Y.current,t||O.current),this.__apply_override_material(e,void 0)}async compile_async(e,t,r,s,i){this.__apply_override_material(e,s),this._renderer.setRenderTarget(void 0===r?null:r);const n=this._renderer.compileAsync(e||Y.current,t||O.current,i);return this.__apply_override_material(e,void 0),n}render_scene(e){e.on_pre_render&&e.on_pre_render(),e.render?e.render():this.render(e,void 0),e.on_post_render&&e.on_post_render()}__apply_override_material(e,t){t=void 0===t?null:t,e?e.overrideMaterial=t:Y.current.overrideMaterial=t}readback_RT(e,t){this._renderer.readRenderTargetPixels(e,0,0,e.width,e.height,t)}clear(e,t,r,s){this._renderer.setRenderTarget(void 0===e?null:e),t&&this._renderer.setClearColor(t.clear_color,t.clear_alpha),this._renderer.clear(!!t,!!r,!!s)}on_resize(e){for(const t of e)H.dpr=I.dpr,H.update_position(t.contentRect.x,t.contentRect.y),H.update_size(t.contentRect.width,t.contentRect.height),this.canvas.width=H.render_width,this.canvas.height=H.render_height,this._renderer.setViewport(0,0,H.render_width,H.render_height),this.__update_current_camera()}material_pass(e,t){this.blitter.material_pass(e,t)}blit(e,t,r){r?this.blitter.blit_with_material(e,t,r):this.blitter.blit(e,t)}blit_clear_with_material(e,t){this.blitter.blit_clear_with_material(e,t)}take_screenshot(e,t=H.width,r=H.height){const s=H.width,i=H.height,n=t,o=r,a=1024,_=1024,l=parseInt(Math.ceil(n/a)),h=parseInt(Math.ceil(o/_));H.update_size(a,_);const c=this._renderer.getPixelRatio();this._renderer.setPixelRatio(1),this._renderer.setSize(a,_,!1);const u=document.createElement("canvas").getContext("2d");u.canvas.width=n,u.canvas.height=o,O.current.aspect=H.aspect_ratio,O.current.updateMatrix(),O.current.updateMatrixWorld(!0);for(let e=0;e<l;e++)for(let t=0;t<h;t++)O.current.setViewOffset(n,o,H.width*e,H.height*t,H.width,H.height),this.current_render_mode.render(),u.drawImage(this._renderer.domElement,H.width*e,H.height*t);u.canvas.toBlob(e,"image/png;base64;"),O.current.clearViewOffset(),H.update_size(s,i),this._renderer.setPixelRatio(c),this._renderer.setSize(s,i,!1),O.current.aspect=H.aspect_ratio,O.current.updateMatrix(),O.current.updateMatrixWorld(!0)}download_screenshot(e){const t=document.createElement("a");t.download="Snapshot.png",t.href=URL.createObjectURL(e),t.click(),t.onclick=function(){requestAnimationFrame((function(){URL.revokeObjectURL(t.href)})),t.removeAttribute("href")}}dispose(){this._renderer.dispose(),this.current_render_mode.dispose(),this.blitter.dispose()}is_floating_point_texture_available(){const t=new e.WebGLRenderTarget(1,1,{minFilter:e.NearestFilter,magFilter:e.NearestFilter,format:e.RGBAFormat,colorSpace:e.NoColorSpace,type:e.FloatType,stencilBuffer:!1,depthBuffer:!1}),r=new e.ShaderMaterial({vertexShader:"\n void main()\n {\n gl_Position = vec4(uv * 2.0 - 1.0, 1.0, 1.0);\n }\n ",fragmentShader:"\n void main()\n {\n gl_FragColor = vec4(0.0, 4865.35, 0.0, 1.0);\n }\n ",depthWrite:!1,blending:e.NoBlending,depthTest:!1,depthFunc:e.AlwaysDepth});this.material_pass(r,t);const s=new Float32Array(4);return this._renderer.readRenderTargetPixels(t,0,0,1,1,s),Math.abs(s[1]-4865.35)<.001}};class ie extends e.ShaderMaterial{constructor(){super({uniforms:{},vertexShader:"#define GLSLIFY 1\nvarying vec3 v_normal;void main(){gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.0);v_normal=(modelMatrix*vec4(normal,0.0)).xyz;}",fragmentShader:"#define GLSLIFY 1\nvarying vec3 v_normal;void main(){gl_FragColor=vec4(v_normal*0.5+vec3(0.5),1.0);}"})}}const ne=new class{init(){this.operating_systems={ANDROID:"android",IOS:"ios",LINUX:"linux",MAC:"mac",WINDOWS:"windows"},this.is_mobile=!!navigator.userAgent.match(/(iPhone|iPod|iPad|Android|playbook|silk|BlackBerry|BB10|Windows Phone|Tizen|Bada|webOS|IEMobile|Opera Mini)/),this.is_ipad=!!(navigator.userAgent.match(/Mac/)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>2),this.is_ios=!!navigator.userAgent.match(/(iPhone|iPod|iPad)/)||this.is_ipad,this.is_android=this.get_os()===this.operating_systems.ANDROID,this.is_linux=this.get_os()===this.operating_systems.LINUX,this.is_mac=this.get_os()===this.operating_systems.MAC,this.is_windows=this.get_os()===this.operating_systems.WINDOWS}get_os(){const e=window.navigator.userAgent,t=window.navigator.platform;let r=null;return-1!==["Macintosh","MacIntel","MacPPC","Mac68K"].indexOf(t)?r=this.operating_systems.MAC:-1!==["iPhone","iPad","iPod"].indexOf(t)?r=this.operating_systems.IOS:-1!==["Win32","Win64","Windows","WinCE"].indexOf(t)?r=this.operating_systems.WINDOWS:/Android/.test(e)?r=this.operating_systems.ANDROID:!r&&/Linux/.test(t)&&(r=this.operating_systems.LINUX),r}};const oe=new class{init(){this.target_geometry=void 0,this.target_position=new e.Vector3}set_target_geometry(e){this.target_geometry=e}};class ae{constructor(t,r){this.geometry=t,this.material=void 0,this.uniforms={},this.batch_width=r,this.data_textures=[],this.object_names=void 0,this.zero_offset=new e.Vector2,this.write_offset=new e.Vector2,this.uniform_dirty_count=0,this.tmp_uploaded_data_count=0}init(t,r,s){this.material=new e.ShaderMaterial({uniforms:this.uniforms,vertexShader:r,fragmentShader:s}),this.object_names=t}add_global_uniform(e,t){this.uniforms[e]={value:t},this.material.needsUpdate=!0}set_global_uniform(e,t){this.uniforms[e].value=t}add_object_uniform_v3(e,t){const r=this.__create_rgb_texture(this.batch_width),s=this.__create_rgb_texture(this.batch_width),i=this.__create_rgb_texture(1),n=this.__add_data_texture(e,r,s,i);t&&this.__flood_data_texture_rgb(n,t)}add_object_uniform_v4(e,t){const r=this.__create_rgba_texture(this.batch_width),s=this.__create_rgba_texture(this.batch_width),i=this.__create_rgba_texture(1),n=this.__add_data_texture(e,r,s,i);t&&this.__flood_data_texture_rgba(n,t)}add_object_uniform_v4_float(e,t){const r=this.__create_rgba_float_texture(this.batch_width),s=this.__create_rgba_float_texture(this.batch_width),i=this.__create_rgba_float_texture(1),n=this.__add_data_texture(e,r,s,i);t&&this.__flood_data_texture_rgba(n,t)}set_object_uniform_v3(e,t,r,s,i,n){const o=this.__get_object_index(e),a=this.__get_data_texture(t);this.__set_pixel_rgb(a.src,o,r,s,i,n),this.__set_pixel_rgb(a.one_pixel,0,r,s,i,n),a.last_accessed_index=o,a.dirty_count++}set_object_uniform_v4(e,t,r,s,i,n,o){const a=this.__get_object_index(e),_=this.__get_data_texture(t);this.__set_pixel_rgba(_.src,a,r,s,i,n,o),this.__set_pixel_rgba(_.one_pixel,0,r,s,i,n,o),_.last_accessed_index=a,_.dirty_count++}upload_texture_data(e,t){for(let r=0;r<this.data_textures.length;r++)t>0&&this.data_textures[r].dirty_count>0&&(1===this.data_textures[r].dirty_count&&this.__partial_texture_data_upload(e,this.data_textures[r]),this.data_textures[r].dirty_count>1&&this.__full_texture_data_upload(e,this.data_textures[r]),this.data_textures[r].dirty_count=0,t--)}get_uniform_dirty_count(){this.uniform_dirty_count=0;for(let e=0;e<this.data_textures.length;e++)this.data_textures[e].dirty_count>0&&this.uniform_dirty_count++;return this.uniform_dirty_count}__full_texture_data_upload(e,t){t.dst.needsUpdate=!0,e.copyTextureToTexture(this.zero_offset,t.src,t.dst)}__partial_texture_data_upload(e,t){const r=t.last_accessed_index;-1!==r&&(this.write_offset.y=Math.floor(r/this.batch_width),this.write_offset.x=r-this.batch_width*this.write_offset.y,e.copyTextureToTexture(this.write_offset,t.one_pixel,t.dst))}get_mesh(){return new e.Mesh(this.geometry,this.material)}__set_pixel_rgb(e,t,r,s,i,n){s&&(e.image.data[3*t+0]=r.x),i&&(e.image.data[3*t+1]=r.y),n&&(e.image.data[3*t+2]=r.z)}__set_pixel_rgba(e,t,r,s,i,n,o){s&&(e.image.data[4*t+0]=r.x),i&&(e.image.data[4*t+1]=r.y),n&&(e.image.data[4*t+2]=r.z),o&&(e.image.data[4*t+3]=r.w)}__flood_data_texture_rgb(e,t){for(let r=0;r<this.batch_width*this.batch_width;r++)this.__set_pixel_rgb(e.src,r,t,!0,!0,!0),e.dirty_count++}__flood_data_texture_rgba(e,t){for(let r=0;r<this.batch_width*this.batch_width;r++)this.__set_pixel_rgba(e.src,r,t,!0,!0,!0,!0),e.dirty_count++}__create_rgb_texture(t){const r=new Uint8Array(3*t*t);return new e.DataTexture(r,t,t,e.RGBAFormat)}__create_rgba_texture(t){const r=new Uint8Array(4*t*t);return new e.DataTexture(r,t,t,e.RGBAFormat)}__create_rgba_float_texture(t){const r=new Float32Array(4*t*t);return new e.DataTexture(r,t,t,e.RGBAFormat,e.FloatType)}__get_data_texture(e){for(let t=0;t<this.data_textures.length;t++)if(this.data_textures[t].name===e)return this.data_textures[t];console.error("Data texture "+e+" does not exist")}__get_object_index(e){for(let t=0;t<this.object_names.length;t++)if(this.object_names[t]===e)return t;console.error("the name "+e+" is not contained in this batch")}__add_data_texture(e,t,r,s){return r.needsUpdate=!0,this.data_textures.push({name:e,src:t,dst:r,one_pixel:s,last_accessed_index:-1,dirty_count:0}),this.uniforms[e]={value:r},this.data_textures[this.data_textures.length-1]}dispose(){for(let e=0;e<this.data_textures.length;e++)this.data_textures[e].src.dispose(),this.data_textures[e].dst.dispose(),this.data_textures[e].one_pixel.dispose()}}const _e=new class{init(){this.batches=[]}batch(t){const r=[],s=d.ceilPowerOfTwo(Math.sqrt(t.length));this.__init_uv_array(r,s);let i=0;for(let e=0;e<t.length;e++){const n=t[e].getAttribute("position").count,o=Math.floor(e/s),a=e-s*o;for(let e=0;e<n;e++)r[i]=a/s+.5/s,r[i+1]=o/s+.5/s,i+=2}const n=new e.BufferAttribute(new Float32Array(r),2),o=l.mergeGeometries(t);return o.setAttribute("attr_accessor_uv",n),this.batches.push(new ae(o,s)),this.batches[this.batches.length-1]}upload_texture_data(e){for(let t=0;t<this.batches.length;t++)this.batches[t].upload_texture_data(e,1)}__init_uv_array(e,t){for(let r=0;r<t*t*2;r++)e.push(0)}};const le=new class{init(t){this.input=t,this.ui_elements=[],this._tmp_normalized_pos=new e.Vector2,this.ss_scene=new e.Scene,this.ss_scene.matrixWorldAutoUpdate=!1,this.ss_scene.frustumCulled=!1,this.ws_scene=new e.Scene,this.ws_scene.matrixWorldAutoUpdate=!1,this.ws_scene.frustumCulled=!1,this.ss_camera=new e.OrthographicCamera(-1,1,1,-1,-100,100)}delete_element(e){const t=this.ui_elements.indexOf(e);t>-1&&this.ui_elements.splice(t,1),this.ss_scene.remove(e),this.ws_scene.remove(e),e.dispose()}add_screen_space_element(e){this.ui_elements.push(e),this.ss_scene.add(e),e.set_screen_space_coordinate_system()}add_world_space_element(e){this.ui_elements.push(e),this.ws_scene.add(e),e.set_world_space_coordinate_system()}update(){this.ss_camera.updateProjectionMatrix(),this._tmp_normalized_pos.copy(this.input.NDC);for(let e=0;e<this.ui_elements.length;e++)this.ui_elements[e].update_state(this._tmp_normalized_pos)}render(e){this.ss_scene.children.length>0&&se.render(this.ss_scene,this.ss_camera),this.ws_scene.children.length>0&&se.render(this.ws_scene,O.current)}clear(){this.current_clicked_element=void 0}};class he{constructor(){this.sphere=new e.Sphere}fit_points(t,r,s,i){this.sphere.setFromPoints(t);const n=d.degToRad(s/2),o=2*Math.atan(Math.tan(n)*i)/2,a=this.get_up_plane_normal(r,n),_=this.get_down_plane_normal(r,n),l=this.get_left_plane_normal(r,o),h=this.get_right_plane_normal(r,o),c=new e.Vector3(0,0,-1).applyQuaternion(r),u=this.sphere.center.clone(),p=this.get_distance_to_fit_rect(2*this.sphere.radius,2*this.sphere.radius,s,i),m=u.clone().add(c.clone().multiplyScalar(-1*p)),g=(new e.Plane).setFromNormalAndCoplanarPoint(a,m),f=(new e.Plane).setFromNormalAndCoplanarPoint(_,m),v=(new e.Plane).setFromNormalAndCoplanarPoint(l,m),x=(new e.Plane).setFromNormalAndCoplanarPoint(h,m);this.apply_center_correction_to_pos(m,t,r,g,f,v,x),g.setFromNormalAndCoplanarPoint(a,m),f.setFromNormalAndCoplanarPoint(_,m),v.setFromNormalAndCoplanarPoint(l,m),x.setFromNormalAndCoplanarPoint(h,m);let b=1/0;const w=c.clone().multiplyScalar(-2*p);for(let r=0;r<t.length;r++){const s=new e.Line3(t[r].clone(),t[r].clone().add(w)),i=new e.Vector3,n=new e.Vector3,o=new e.Vector3,a=new e.Vector3;g.intersectLine(s,i),f.intersectLine(s,n),v.intersectLine(s,o),x.intersectLine(s,a),i.length()<1e-4&&console.log("up intersection not found",r),n.length()<1e-4&&console.log("down intersection not found",r),o.length()<1e-4&&console.log("left intersection not found",r),a.length()<1e-4&&console.log("right intersection not found",r);const _=t[r].clone().sub(i).length(),l=t[r].clone().sub(n).length(),h=t[r].clone().sub(o).length(),c=t[r].clone().sub(a).length(),u=Math.min(_,l),d=Math.min(h,c),p=Math.min(u,d);p<b&&(b=p)}const y=c.clone().multiplyScalar(b);return m.clone().add(y)}apply_center_correction_to_pos(e,t,r,s,i,n,o){const a=this.get_vertical_correction(t,i,s,r),_=this.get_horizontal_correction(t,n,o,r);e.add(a),e.add(_)}get_vertical_correction(t,r,s,i){let n=1/0,o=1/0;const a=new e.Vector3(0,1,0).applyQuaternion(i);for(let i=0;i<t.length;i++){const _=new e.Line3(t[i].clone(),t[i].clone().add(a.clone().multiplyScalar(-5e6))),l=new e.Line3(t[i].clone(),t[i].clone().add(a.clone().multiplyScalar(5e6))),h=new e.Vector3,c=new e.Vector3;r.intersectLine(_,h),s.intersectLine(l,c);const u=h.distanceTo(t[i]),d=c.distanceTo(t[i]);c.length()<1e-4&&console.log("vertical up intersection not found",i),h.length()<1e-4&&console.log("vertical down intersection not found",i),u<o&&(o=u),d<n&&(n=d)}const _=(n-o)/2;return a.clone().multiplyScalar(-_)}get_horizontal_correction(t,r,s,i){let n=1/0,o=1/0;const a=new e.Vector3(1,0,0).applyQuaternion(i);for(let i=0;i<t.length;i++){const _=new e.Line3(t[i].clone(),t[i].clone().add(a.clone().multiplyScalar(-5e6))),l=new e.Line3(t[i].clone(),t[i].clone().add(a.clone().multiplyScalar(5e6))),h=new e.Vector3,c=new e.Vector3;r.intersectLine(_,h),s.intersectLine(l,c);const u=h.distanceTo(t[i]),d=c.distanceTo(t[i]);h.length()<1e-4&&console.log("left intersection not found",i),c.length()<1e-4&&console.log("right intersection not found",i),u<o&&(o=u),d<n&&(n=d)}const _=(n-o)/2;return a.clone().multiplyScalar(-_)}get_up_plane_normal(t,r){const s=new e.Vector3(0,-1,0);return s.applyQuaternion((new e.Quaternion).setFromAxisAngle(new e.Vector3(1,0,0),r)),s.applyQuaternion(t),s}get_down_plane_normal(t,r){const s=new e.Vector3(0,1,0);return s.applyQuaternion((new e.Quaternion).setFromAxisAngle(new e.Vector3(1,0,0),-r)),s.applyQuaternion(t),s}get_left_plane_normal(t,r){const s=new e.Vector3(1,0,0);return s.applyQuaternion((new e.Quaternion).setFromAxisAngle(new e.Vector3(0,1,0),r)),s.applyQuaternion(t),s}get_right_plane_normal(t,r){const s=new e.Vector3(-1,0,0);return s.applyQuaternion((new e.Quaternion).setFromAxisAngle(new e.Vector3(0,1,0),-r)),s.applyQuaternion(t),s}get_distance_to_fit_rect(e,t,r,s){const i=r/2*Math.PI/180,n=2*Math.atan(Math.tan(i)*s)/2,o=t/Math.tan(i),a=e/Math.tan(n);return Math.max(Math.abs(a),Math.abs(o))}}class ce{constructor(){}fit_points(t,r,s,i){const n=r.clone().inverse(),o=[];for(let e=0;e<t.length;e++)o.push(t[e].clone().applyQuaternion(n));const a=(new e.Box3).setFromPoints(o),_=new e.Vector3;a.getSize(_);const l=this.get_distance_to_fit_rect(_.x/2,_.y/2,s,i),h=new e.Vector3;return a.getCenter(h),h.applyQuaternion(r),{center:h,distance_to_center:l}}get_distance_to_fit_rect(e,t,r,s){const i=r/2*Math.PI/180,n=2*Math.atan(Math.tan(i)*s)/2,o=t/Math.tan(i),a=e/Math.tan(n);return Math.max(Math.abs(a),Math.abs(o))}}const ue=new class{init(t){this.tmp_mat=new e.Matrix4,this.plane=new e.Plane,this.ray=new e.Ray,this.tmp_size=new e.Vector3,this.tmp_unproj=new e.Vector3,this.input=t}get_up_dir(t){t=t||O.current;const r=new e.Vector3;return r.set(0,1,0),r.applyQuaternion(t.quaternion),r}get_forward_dir(t){t=t||O.current;const r=new e.Vector3;return r.set(0,0,-1),r.applyQuaternion(t.quaternion),r}get_right_dir(t){t=t||O.current;const r=new e.Vector3;return r.set(1,0,0),r.applyQuaternion(t.quaternion),r}unproject_mouse_position(t,r){r=r||O.current;const s=new e.Vector3,i=r.fov/2*Math.PI/180,n=2*Math.atan(Math.tan(i)*r.aspect)/2,o=Math.tan(i)*r.far,a=Math.tan(n)*r.far;return s.set(a*t.x,o*t.y,-r.far).normalize(),s.applyQuaternion(r.quaternion)}get_plane_intersection(t,r,s,i){i=i||O.current,s=s||this.input.NDC;const n=new e.Vector3;return this.plane.setFromNormalAndCoplanarPoint(r||this.get_forward_dir(i),t),i.isPerspectiveCamera?this.ray.set(i.position,this.unproject_mouse_position(s,i)):(this.tmp_unproj.set(s.x,s.y,1).unproject(i),this.ray.set(i.position,this.tmp_unproj)),this.ray.intersectPlane(this.plane,n),n}fit_points_on_camera(t,r=1){const s=(new e.Sphere).setFromPoints(t).center,i=this.get_forward_dir(O.current).clone(),n=(new e.Plane).setFromNormalAndCoplanarPoint(i,s),o=d.project_points_on_plane(t,n),a=new e.Vector3;let _=(new e.Box3).setFromPoints(o);_.getCenter(a);const l=new e.Vector3(0,1,0).applyQuaternion(O.current.quaternion),h=l.clone().cross(i).normalize(),c=(new e.Matrix4).set(h.x,l.x,i.x,s.x,h.y,l.y,i.y,s.y,h.z,l.z,i.z,s.z,0,0,0,1),u=(new e.Matrix4).getInverse(c);for(let e=0;e<o.length;e++)o[e].applyMatrix4(u);const p=new e.Vector3;_=(new e.Box3).setFromPoints(o),_.getSize(p),p.multiplyScalar(r);const m=new e.Vector3;return _.getCenter(m),{position:a,zoom:this.get_zoom_to_fit_rect(p.x/2,p.y/2)}}get_zoom_to_fit_rect(e,t){const r=O.current.fov/2*Math.PI/180,s=2*Math.atan(Math.tan(r)*O.current.aspect)/2,i=t/Math.tan(r),n=e/Math.tan(s);return Math.max(Math.abs(n),Math.abs(i))}get_zoom_to_fit_box(t,r){if(r.isOrthographicCamera){t.getSize(this.tmp_size);const e=this.tmp_size.x,r=this.tmp_size.y,s=e/r;return H.aspect_ratio/s>1?H.height/r:H.width/e}{const r=new e.Vector3;return t.getSize(r),this.get_zoom_to_fit_rect(r.x,r.y)}}get_html_screen_pos(t,r){r=r||O.current;const s=new e.Vector3;return t.getWorldPosition(s),s.project(r),s.x=(.5*s.x+.5)*H.width,s.y=(1-(.5*s.y+.5))*H.height,s}world_pos_to_screen(t,r){r=r||O.current;const s=new e.Vector3;return s.copy(t),s.project(r),s.x=(.5*s.x+.5)*H.width,s.y=(1-(.5*s.y+.5))*H.height,s}update_projection(e){e.left=-H.width/2,e.right=H.width/2,e.top=H.height/2,e.bottom=-H.height/2,e.aspect=H.aspect_ratio,e.updateProjectionMatrix(!0)}fit_bounding_box_points(t,r,s=1){const i=new e.Vector3;i.copy(r.max).sub(r.min);const n=r.min.clone(),o=n.clone().add(new e.Vector3(i.x,0,0)),a=n.clone().add(new e.Vector3(0,i.y,0)),_=n.clone().add(new e.Vector3(0,0,i.z)),l=n.clone().add(new e.Vector3(i.x,0,i.z)),h=n.clone().add(new e.Vector3(0,i.y,i.z)),c=r.max.clone(),u=n.clone().add(new e.Vector3(i.x,i.y,0));return this.fit_points(t,[n,o,a,_,l,h,c,u],s)}fit_points(t,r,s=1){if(t.isPerspectiveCamera){const i=new e.Vector3(0,0,-1).applyQuaternion(t.quaternion),n=i.clone().multiplyScalar(-1),o=new he,a=H.aspect_ratio,_=o.fit_points(r,t.quaternion,t.fov*s,a),l=(new e.Box3).setFromPoints(r),h=new e.Vector3;l.getCenter(h);const c=(new e.Plane).setFromNormalAndCoplanarPoint(n,h),u=new e.Ray(_,i),d=new e.Vector3;u.intersectPlane(c,d);return{zoom:_.distanceTo(d),reference_position:d,camera_position:_}}{const i=(new ce).fit_points(r,this.reference_rotation,t.fov*s,H.aspect_ratio);this.reference_position.copy(i.center),this.reference_zoom=i.distance_to_center;const n=new e.Vector3(0,0,1).applyQuaternion(t.quaternion);return{zoom:i.distance_to_center,reference_position:i.center,camera_position:n.multiplyScalar(i.distance_to_center)}}}};const de=new class{constructor(){}init(e){O.init(),ue.init(e),G.init(),I.init(),y.init(),_e.init(),ne.init(),h.init(),oe.init(),T.init(),Y.init(),H.init(),F.init(),le.init(e),J.init()}dispose(e){se.dispose(),Y.dispose(),e.dispose()}};var pe="#define GLSLIFY 1\nvarying vec2 vUv;varying vec4 vRay;uniform mat4 _InverseProjMatrix;void main(){gl_Position=vec4(uv*2.0-1.0,1.0,1.0);vRay=_InverseProjMatrix*vec4(uv*2.0-1.0,1.0,1.0);vUv=uv;}";class me extends k{constructor(){super("#define GLSLIFY 1\nuniform sampler2D _MainTex;uniform mat4 _InverseProjMatrix;uniform float _Bias;uniform float _Radius;uniform vec2 _Resolution;uniform float _FarPlane;varying vec2 vUv;varying vec4 vRay;uniform vec3 _SampleKernel[64];uniform sampler2D _RandomRotation;uniform mat4 _ProjectionMatrix;vec3 decode_normal(vec4 enc){float scale=1.7777;vec3 nn=enc.xyz*vec3(2.0*scale,2.0*scale,0.0)+vec3(-scale,-scale,1.0);float g=2.0/dot(nn.xyz,nn.xyz);vec3 n;n.xy=g*nn.xy;n.z=g-1.0;return n;}float DecodeFloatRG(vec2 enc){vec2 kDecodeDot=vec2(1.0,1.0/255.0);return dot(enc,kDecodeDot);}vec3 DecodeNormal(vec2 uv){vec2 encoded_normal=texture2D(_MainTex,uv).zw;vec3 normalValue=normalize(decode_normal(vec4(encoded_normal,0.,0.)));return normalize(normalValue);}vec3 DecodeViewPos(vec2 uv){vec2 depth=texture2D(_MainTex,uv).xy;vec4 inv_proj=_InverseProjMatrix*vec4(vUv*2.0-1.0,1.0,1.0);return DecodeFloatRG(depth)*(vRay.xyz/vRay.w);}void main(){vec2 noiseScale=vec2(_Resolution.x/4.0,_Resolution.y/4.0);vec3 fragPos=DecodeViewPos(vUv);vec3 normal=DecodeNormal(vUv);vec3 randomVec=texture2D(_RandomRotation,vUv*noiseScale).xyz;randomVec=vec3(randomVec.xy*2.0-1.0,0);randomVec=normalize(randomVec);vec3 tangent=normalize(randomVec-normal*dot(randomVec,normal));vec3 bitangent=normalize(cross(normal,tangent));mat3 TBN=mat3(tangent,bitangent,normal);float occlusion=0.0;const int kernelSize=64;for(int i=0;i<kernelSize;++i){vec3 sample=TBN*_SampleKernel[i];sample=fragPos+sample*_Radius;vec4 projPos=_ProjectionMatrix*vec4(sample,1.0);vec2 screenPos=projPos.xy/projPos.w;screenPos=screenPos*0.5+0.5;float sampled_depth=DecodeViewPos(screenPos).z;float rangeCheck=smoothstep(0.0,1.0,_Radius/abs(fragPos.z-sampled_depth));occlusion+=step(sample.z+_Bias,sampled_depth)*rangeCheck;}occlusion=(occlusion/float(kernelSize));gl_FragColor.rgb=vec3(occlusion,occlusion,occlusion);gl_FragColor.a=1.0;}",pe),this.uniforms._InverseProjMatrix={value:new e.Matrix4},this.uniforms._ProjectionMatrix={value:new e.Matrix4},this.uniforms._Bias={value:.0125},this.uniforms._Radius={value:.3},this.uniforms._FarPlane={value:100},this.uniforms._SampleKernel={value:this.__get_sample_kernel()},this.uniforms._RandomRotation={value:this.__get_rotation_kernel()}}__get_sample_kernel(){const t=[];for(let r=0;r<64;r++){const s=new e.Vector3(2*Math.random()-1,2*Math.random()-1,Math.random());s.normalize();let i=r/64;i=d.lerp(.1,1,i*i),s.multiplyScalar(i),t.push(s)}return t}__get_rotation_kernel(){const t=new Uint8Array(48);for(let e=0;e<16;e++)t[3*e+1]=Math.floor(255*Math.random()),t[3*e+2]=Math.floor(255*Math.random()),t[3*e+3]=0;const r=new e.DataTexture(t,4,4,e.RGBAFormat);return r.wrapS=e.RepeatWrapping,r.wrapT=e.RepeatWrapping,r.needsUpdate=!0,r}}class ge extends k{constructor(){super("#define GLSLIFY 1\nuniform sampler2D _MainTex;uniform sampler2D _AO;uniform vec2 _Resolution;uniform vec2 _SampleDir;varying vec2 vUv;void main(){gl_FragColor.rgb=texture2D(_MainTex,vUv).rgb*(1.0-texture2D(_AO,vUv).r);gl_FragColor.a=1.0;}"),this.uniforms._AO={value:void 0}}}class fe extends k{constructor(){super("#define GLSLIFY 1\nuniform sampler2D _MainTex;uniform vec2 _Resolution;uniform float _FarPlane;varying vec2 vUv;varying vec4 vRay;vec3 decode_normal(vec4 enc){float scale=1.7777;vec3 nn=enc.xyz*vec3(2.0*scale,2.0*scale,0.0)+vec3(-scale,-scale,1.0);float g=2.0/dot(nn.xyz,nn.xyz);vec3 n;n.xy=g*nn.xy;n.z=g-1.0;return n;}float DecodeFloatRG(vec2 enc){vec2 kDecodeDot=vec2(1.0,1.0/255.0);return dot(enc,kDecodeDot);}vec3 DecodeNormal(vec2 uv){vec4 depthNormal=texture2D(_MainTex,uv);vec3 normalValue=normalize(decode_normal(vec4(depthNormal.zw,0.,0.)));return normalize(normalValue);}vec3 DecodeViewPos(vec2 uv){vec2 depth=texture2D(_MainTex,uv).xy;return DecodeFloatRG(depth)*(vRay.xyz/vRay.w);}void main(){vec3 viewPos=DecodeViewPos(vUv);vec3 normalValue=DecodeNormal(vUv);float vDepth=clamp(0.0,1.0,length(viewPos)/_FarPlane);vDepth=length(viewPos)/_FarPlane;gl_FragColor=vec4(vDepth,vDepth,vDepth,1.0);}",pe),this.uniforms._FarPlane={value:1},this.uniforms._InverseProjMatrix={value:new e.Matrix4}}}class ve extends k{constructor(){super("#define GLSLIFY 1\nuniform sampler2D _MainTex;uniform vec2 _Resolution;uniform vec2 _SampleDir;varying vec2 vUv;void main(){vec4 sum=vec4(0.,0.,0.,0.);vec2 dir=(0.5/_Resolution)*_SampleDir;float _Distance=2.0;sum+=texture2D(_MainTex,vUv+dir*-4.*_Distance)*0.0525;sum+=texture2D(_MainTex,vUv+dir*-3.*_Distance)*0.075;sum+=texture2D(_MainTex,vUv+dir*-2.*_Distance)*0.110;sum+=texture2D(_MainTex,vUv+dir*-1.*_Distance)*0.150;sum+=texture2D(_MainTex,vUv+dir*0.*_Distance)*0.225;sum+=texture2D(_MainTex,vUv+dir*1.*_Distance)*0.150;sum+=texture2D(_MainTex,vUv+dir*2.*_Distance)*0.110;sum+=texture2D(_MainTex,vUv+dir*3.*_Distance)*0.075;sum+=texture2D(_MainTex,vUv+dir*4.*_Distance)*0.0525;gl_FragColor=vec4(sum);}"),this.uniforms._SampleDir={value:new e.Vector2}}}class xe{constructor(t){this.RT1=new e.WebGLRenderTarget(1,1),this.RT2=new e.WebGLRenderTarget(1,1),this.box_blur_mat=new ve}blur(e){e.width===this.RT1.width&&e.height===this.RT1.height||(this.RT1.setSize(e.width,e.height),this.RT2.setSize(e.width,e.height)),this.box_blur_mat.uniforms._SampleDir.value.set(1,0),se.blit(e,this.RT1,this.box_blur_mat),this.box_blur_mat.uniforms._SampleDir.value.set(0,1),se.blit(this.RT1,e,this.box_blur_mat)}}class be extends k{constructor(t){super("#define GLSLIFY 1\n#include <common>\nvarying vec2 vUv;uniform sampler2D _MainTex;uniform vec2 texSize;uniform vec2 direction;float gaussianPdf(in float x,in float sigma){return 0.39894*exp(-0.5*x*x/(sigma*sigma))/sigma;}void main(){vec2 invSize=1.0/texSize;float fSigma=float(SIGMA);float weightSum=gaussianPdf(0.0,fSigma);vec4 diffuseSum=texture2D(_MainTex,vUv)*weightSum;for(int i=1;i<KERNEL_RADIUS;i++){float x=float(i);float w=gaussianPdf(x,fSigma);vec2 uvOffset=direction*invSize*x;vec4 sample1=texture2D(_MainTex,vUv+uvOffset);vec4 sample2=texture2D(_MainTex,vUv-uvOffset);diffuseSum+=(sample1+sample2)*w;weightSum+=2.0*w;}gl_FragColor=vec4(diffuseSum/weightSum);}",void 0,{KERNEL_RADIUS:t,SIGMA:t}),this.uniforms.texSize={value:new e.Vector2(.5,.5)},this.uniforms.direction={value:new e.Vector2(.5,.5)}}set_size(e,t){this.uniforms.texSize.value.x=e,this.uniforms.texSize.value.y=t}set_direction(e,t){this.uniforms.direction.value.set(e,t)}}class we extends k{constructor(t){super("#define GLSLIFY 1\nuniform sampler2D _MainTex;uniform vec3 defaultColor;uniform float defaultOpacity;uniform float luminosityThreshold;uniform float smoothWidth;varying vec2 vUv;void main(){vec4 texel=texture2D(_MainTex,vUv);vec3 luma=vec3(0.299,0.587,0.114);float v=dot(texel.xyz,luma);vec4 outputColor=vec4(defaultColor.rgb,defaultOpacity);float alpha=smoothstep(luminosityThreshold,luminosityThreshold+smoothWidth,v);gl_FragColor=mix(outputColor,texel,alpha);}"),this.uniforms.luminosityThreshold={value:.23},this.uniforms.smoothWidth={value:.01},this.uniforms.defaultColor={value:new e.Color("#000000")},this.uniforms.defaultOpacity={value:0}}}class ye{constructor(t=5){this.current_width=1,this.current_height=1,this.separableBlurMaterials=[],this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=t,this.kernelSizeArray=[3,5,7,9,11],this.rt_pars={minFilter:e.LinearFilter,magFilter:e.LinearFilter,format:e.RGBAFormat},this.renderTargetBright=new e.WebGLRenderTarget(1,1,this.rt_pars),this.renderTargetBright.texture.generateMipmaps=!1,this.init_materials(),this.init_RT(),this.luminosity_high_pass_mat=new we}blur(e,t){this.resize_RT(e.width,e.height),t?se.blit(e,this.renderTargetBright,this.luminosity_high_pass_mat):se.blit(e,this.renderTargetBright);let r=this.renderTargetBright;for(let e=0;e<this.nMips;e++){const t=this.separableBlurMaterials[e];t.set_direction(1,0),se.blit(r,this.renderTargetsHorizontal[e],t),t.set_direction(0,1),se.blit(this.renderTargetsHorizontal[e],this.renderTargetsVertical[e],t),r=this.renderTargetsVertical[e]}}get_blurred_texture(){return this.renderTargetsHorizontal[0].texture}get_blurred_RT(){return this.renderTargetsHorizontal[0]}init_RT(){this.dispose_RT(),this.renderTargetBright.setSize(1,1);for(let t=0;t<this.nMips;t++){const t=new e.WebGLRenderTarget(1,1,this.rt_pars),r=new e.WebGLRenderTarget(1,1,this.rt_pars);t.texture.generateMipmaps=!1,r.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(t),this.renderTargetsVertical.push(r)}}resize_RT(e,t){if(this.current_width===e&&this.current_height===t)return;this.current_width=e,this.current_height=t;let r=Math.round(e/2),s=Math.round(t/2);this.renderTargetBright.setSize(r,s);for(let e=0;e<this.nMips;e++)this.renderTargetsVertical[e].setSize(r,s),this.renderTargetsHorizontal[e].setSize(r,s),this.separableBlurMaterials[e].set_size(r,s),r=Math.round(r/2),s=Math.round(s/2)}init_materials(e,t){this.dispose_materials();for(let e=0;e<this.nMips;e++)this.separableBlurMaterials.push(new be(this.kernelSizeArray[e]))}dispose_materials(){for(let e=0;e<this.separableBlurMaterials.length;e++)this.separableBlurMaterials[e].dispose();this.separableBlurMaterials.length=0}dispose_RT(){for(let e=0;e<this.renderTargetsVertical.length;e++)this.renderTargetsHorizontal[e].dispose(),this.renderTargetsVertical[e].dispose();this.renderTargetBright.dispose(),this.renderTargetsHorizontal.length=0,this.renderTargetsVertical.length=0}}class Te extends e.OrthographicCamera{constructor(t,r,s,i,n,o){super(t,r,s,i,n,o),this.clear_color=new e.Color("#000000"),this.clear_alpha=1}copy(e){return super.copy(e),this.clear_color.copy(e.clear_color),this.clear_alpha=e.clear_alpha,this}}const Me=new class{constructor(){this.components=[],this.enabled_components=new Set}update(){this.__set_components_opacities();for(const e of this.enabled_components)e.update(R.transition_handler.current_state_data)}register_component(e){this.components.push(e)}enable_component(e){this.enabled_components.add(e)}disable_component(e){this.enabled_components.delete(e)}get_component_by_name(e){console.warn("DEPRECATED. Use ViewComponentManager.get instead"),this.get(e)}get(e){for(let t=0;t<this.components.length;t++)if(this.components[t].name===e)return this.components[t];console.error("[ViewComponentManager.get] no component found for: ",e)}__set_components_opacities(){for(let e=0;e<this.components.length;e++)this.components[e].set_opacity(R.transition_handler.current_state_data)}};const Se=new class{init(){console.warn("Screen Singleton is deprecated. Please use OScreen."),H.init()}update_position(e,t){console.warn("Screen Singleton is deprecated. Please use OScreen."),H.update_position(e,t)}update(){console.warn("Screen Singleton is deprecated. Please use OScreen."),H.update()}update_size(e,t){console.warn("Screen Singleton is deprecated. Please use OScreen."),H.update_size(e,t)}apply_pixel_density_v2(e){return console.warn("Screen Singleton is deprecated. Please use OScreen."),H.apply_pixel_density_v2(e)}apply_pixel_density(e){return console.warn("Screen Singleton is deprecated. Please use OScreen."),H.apply_pixel_density(e)}get_pixel_size(){return console.warn("Screen Singleton is deprecated. Please use OScreen."),H.get_pixel_size()}get aspect_ratio(){return console.warn("Screen Singleton is deprecated. Please use OScreen."),H.aspect_ratio}};class Fe extends j{constructor(){super(),this.text_margin=new e.Vector2(2,0)}__draw(e,t,r,s){s.font=t.font;const i=this.get_text_size(e,t.font);r.width=Math.ceil(i.x+2*this.text_margin.x),r.height=Math.ceil(i.y+2*this.text_margin.y),s.clearRect(0,0,r.width,r.height),s.globalAlpha=0,s.fillStyle=t.font_color||"#000000",s.fillRect(0,0,r.width,r.height),s.globalAlpha=1,s.globalAlpha=1,s.font=t.font,s.fillStyle=t.font_color||"#000000",s.textBaseline="middle",s.textAlign=t.textAlign||"center","center"===s.textAlign?s.fillText(e,r.width/2,r.height/2):s.fillText(e,0,r.height/2)}}class ze extends e.Mesh{constructor(t,r,s,i){t=t||1,r=r||1,s=s||"#FF0000",i=i||new e.MeshBasicMaterial({color:s});const n=new e.PlaneGeometry(t,r);n.rotateX(-1.57),super(n,i)}}class Ae extends e.Mesh{constructor(t,r,s,i){t=t||1,r=r||1,s=s||"#FF0000",i=i||new e.MeshBasicMaterial({color:s});super(new e.PlaneGeometry(t,r),i)}}class Re{constructor(){}static merge_from_to(e,t){t.push.apply(t,e)}static expand_vec3_array(e,t){const r=t-e.length;for(let t=0;t<r;t++)e.push(e[t].clone())}static remove_elem(e,t){const r=e.indexOf(t);r>-1&&e.splice(r,1)}static get_closest_point(e,t){let r=e[0],s=r.distanceTo(t);for(let i=1;i<e.length;i++)e[i].distanceTo(t)<s&&(r=e[i],s=e[i].distanceTo(t));return r}static object_values_to_array(e){const t=Object.keys(e),r=[];for(let s=0;s<t.length;s++)r.push(e[t[s]]);return r}}class Ce{static convert_to_non_indexed_geometry(t){const r=t.index,s=t.getAttribute("position"),i=[];for(let e=0;e<r.count;e+=3)i.push(s.getX(r.array[e+0])),i.push(s.getY(r.array[e+0])),i.push(s.getZ(r.array[e+0])),i.push(s.getX(r.array[e+1])),i.push(s.getY(r.array[e+1])),i.push(s.getZ(r.array[e+1])),i.push(s.getX(r.array[e+2])),i.push(s.getY(r.array[e+2])),i.push(s.getZ(r.array[e+2]));const n=new e.BufferGeometry;return n.setAttribute("position",new e.BufferAttribute(new Float32Array(i),3)),Ce.add_barycentric_attribute(n),n}static add_barycentric_attribute(t){const r=[],s=t.getAttribute("position");for(let e=0;e<s.count;e+=3)r.push(1),r.push(0),r.push(0),r.push(0),r.push(1),r.push(0),r.push(0),r.push(0),r.push(1);t.setAttribute("barycentric",new e.BufferAttribute(new Float32Array(r),3))}}const Ve=new class{constructor(){}sample(t,r){const s=[];let i=99999999;const n=t.getAttribute("position"),o=t.getAttribute("normal"),a=t.getAttribute("tangent"),_=t.getAttribute("uv"),l=t.index,h=[];for(let t=0;t<l.count;t+=3){const r=l.array[t+0],c=l.array[t+1],u=l.array[t+2],d=new e.Vector3;d.x=n.getX(r),d.y=n.getY(r),d.z=n.getZ(r);const p=new e.Vector3;p.x=n.getX(c),p.y=n.getY(c),p.z=n.getZ(c);const m=new e.Vector3;m.x=n.getX(u),m.y=n.getY(u),m.z=n.getZ(u);const g={a:d,b:p,c:m};if(o){const t=new e.Vector3;t.x=o.getX(r),t.y=o.getY(r),t.z=o.getZ(r);const s=new e.Vector3;s.x=o.getX(c),s.y=o.getY(c),s.z=o.getZ(c);const i=new e.Vector3;i.x=o.getX(u),i.y=o.getY(u),i.z=o.getZ(u);const n=t.clone().add(s).add(i).normalize();g.normal=n}if(a){const t=new e.Vector3;t.x=a.getX(r),t.y=a.getY(r),t.z=a.getZ(r);const s=new e.Vector3;s.x=a.getX(c),s.y=a.getY(c),s.z=a.getZ(c);const i=new e.Vector3;i.x=a.getX(u),i.y=a.getY(u),i.z=a.getZ(u);const n=t.clone().add(s).add(i).normalize();g.tangent=n}if(_){const t=new e.Vector2;t.x=_.getX(r),t.y=_.getY(r);const s=new e.Vector2;s.x=_.getX(c),s.y=_.getY(c);const i=new e.Vector2;i.x=_.getX(u),i.y=_.getY(u),g.uv_a=t,g.uv_b=s,g.uv_c=i}h.push(g);const f=this.get_face_area(g);i=Math.min(f,i),s.push(f)}const c=this.get_uniform_face_distribution(s,i,h),u=this.select_random_faces(c,r);return this.sample_data_from_faces(u)}sample_data_from_faces(e){const t=[],r=[],s=[],i=[];for(let n=0;n<e.length;n++){const o=e[n],a=Math.random(),_=Math.random();t.push(this.sample_point_in_face(a,_,o.a,o.b,o.c).clone()),o.normal&&r.push(o.normal.clone()),o.tangent&&s.push(o.tangent.clone()),o.uv_a&&i.push(this.sample_point_in_face(a,_,o.uv_a,o.uv_b,o.uv_c).clone())}return{points:t,normals:r,tangents:s,uvs:i}}select_random_faces(e,t){const r=[];for(let s=0;s<t;s++){const t=e[Math.floor(Math.random()*e.length)];r.push(t)}return r}get_uniform_face_distribution(e,t,r){const s=[];for(let i=0;i<e.length;i++){e[i]/=t;const n=Math.floor(Math.round(e[i]));for(let e=0;e<n;e++)s.push(r[i])}return s}get_face_area(e){const t=e.b.clone().sub(e.a),r=e.c.clone().sub(e.a);return t.cross(r).length()/2}sample_point_in_face(e,t,r,s,i){e+t>1&&(e=1-e,t=1-t);const n=1-(e+t);return r.clone().multiplyScalar(e).add(s.clone().multiplyScalar(t)).add(i.clone().multiplyScalar(n))}};const Pe=new class{get_mesh(t,r){t.traverse((t=>{t instanceof e.Mesh&&(t.geometry&&(t.geometry=(new e.BufferGeometry).fromGeometry(t.geometry)),r(t))}))}get_geometries(e){const t=[];return this.get_mesh(e,(e=>{t.push(e.geometry)})),t}assign_material(t,r,s){t.traverse((t=>{t instanceof e.Mesh&&(void 0===s||t.name===s)&&(t.material=r)}))}clone_animated_gltf(t){const r={animations:t.animations,scene:t.scene.clone(!0)},s={};t.scene.traverse((e=>{e.isSkinnedMesh&&(s[e.name]=e)}));const i={},n={};r.scene.traverse((e=>{e.isBone&&(i[e.name]=e),e.isSkinnedMesh&&(n[e.name]=e)}));for(const t in s){const r=s[t].skeleton,o=n[t],a=[];for(let e=0;e<r.bones.length;++e){const t=i[r.bones[e].name];a.push(t)}o.bind(new e.Skeleton(a,r.boneInverses),o.matrixWorld)}return r}set_shadow_config(t,r,s){t.traverse((t=>{t instanceof e.Mesh&&(t.castShadow=r,t.receiveShadow=s)}))}__find_object(e,t,r){e.traverse((e=>{e.name===t&&r(e)}))}get_object(e,t){let r;return e.traverse((e=>{e.name===t&&(r=e)})),r}get_object_by_type(e,t){let r;return e.traverse((e=>{e.constructor.name===t&&(r=e)})),r}};class Le{static is_object(e){return e&&"object"==typeof e&&!Array.isArray(e)}static merge_deep(e,...t){if(!t.length)return e;const r=t.shift();if(Le.is_object(e)&&Le.is_object(r))for(const t in r)Le.is_object(r[t])?(e[t]||Object.assign(e,{[t]:{}}),Le.merge_deep(e[t],r[t])):Object.assign(e,{[t]:r[t]});return Le.merge_deep(e,...t)}static xml_to_json(e){let t={};if(1===e.nodeType){if(e.attributes.length>0){t["@attributes"]={};for(let r=0;r<e.attributes.length;r++){const s=e.attributes.item(r);t["@attributes"][s.nodeName]=s.nodeValue}}}else 3===e.nodeType&&(t=e.nodeValue);if(e.hasChildNodes())for(let r=0;r<e.childNodes.length;r++){const s=e.childNodes.item(r),i=s.nodeName;if(void 0===t[i])t[i]=this.xml_to_json(s);else{if(void 0===t[i].push){const e=t[i];t[i]=[],t[i].push(e)}t[i].push(this.xml_to_json(s))}}return t}}class De extends e.Mesh{constructor(){const t=new e.ShaderMaterial({uniforms:{_Color:{value:new e.Color("#919191")}},vertexShader:"#define GLSLIFY 1\nattribute vec3 barycentric;varying vec3 vBarycentric;void main(){mat4 VP=projectionMatrix*viewMatrix;vec3 pos=(modelMatrix*vec4(position,1.0)).xyz;gl_Position=VP*vec4(pos,1.0);vBarycentric=barycentric;}",fragmentShader:"#define GLSLIFY 1\nuniform vec3 _Color;varying vec3 vBarycentric;float edgeFactor(vec3 baryc){vec3 d=fwidth(baryc);vec3 a3=smoothstep(vec3(0.0),d*1.5,baryc);return min(min(a3.x,a3.y),a3.z);}void main(){float alpha=edgeFactor(vBarycentric+vec3(1.,1.,0.));gl_FragColor.rgb=mix(_Color,vec3(0.),alpha);gl_FragColor.a=1.0-alpha;gl_FragColor.a*=0.2;}",extensions:{derivatives:!0},transparent:!0,depthWrite:!1}),r=new e.PlaneGeometry(100,100,100,100);super(Ce.convert_to_non_indexed_geometry(r),t),this.rotation.x=-1.57}}class ke extends e.Mesh{constructor(t){const r=new e.BufferGeometry;r.setAttribute("position",new e.BufferAttribute(new Float32Array([]),3)),r.setAttribute("next_position",new e.BufferAttribute(new Float32Array([]),3)),r.setAttribute("previous_position",new e.BufferAttribute(new Float32Array([]),3)),r.setAttribute("orientation",new e.BufferAttribute(new Float32Array([]),1)),r.setAttribute("coverage",new e.BufferAttribute(new Float32Array([]),1));super(r,new e.ShaderMaterial({uniforms:{_Thickness:{value:.2},_Length:{value:0},_ElapsedTime:{value:0},_Color:{value:new e.Color("#FF0000")}},vertexShader:"#define GLSLIFY 1\nuniform float _Thickness;attribute vec3 next_position;attribute vec3 previous_position;attribute float orientation;attribute float coverage;varying float line_coverage;varying float uv_u;vec3 w_space_normal(vec3 from,vec3 to){vec3 w_from=(modelMatrix*vec4(from,1.0)).xyz;vec3 w_to=(modelMatrix*vec4(to,1.0)).xyz;vec3 z=normalize(w_to-w_from);return normalize(cross(z,normalize(cameraPosition-w_from)));}void main(){mat4 VP=projectionMatrix*viewMatrix;vec3 pos=position;vec3 normal=w_space_normal(next_position,previous_position);pos=(modelMatrix*vec4(pos,1.0)).xyz;pos+=normal*(_Thickness*0.5)*orientation;gl_Position=VP*vec4(pos,1.0);line_coverage=coverage;uv_u=orientation*0.5+0.5;}",fragmentShader:"#define GLSLIFY 1\nuniform float _Length;uniform float _ElapsedTime;uniform float _Thickness;uniform vec3 _Color;varying float line_coverage;varying float uv_u;float aastep(float threshold,float value){\n#ifdef GL_OES_standard_derivatives\nfloat afwidth=length(vec2(dFdx(value),dFdy(value)))*0.70710678118654757;return smoothstep(threshold-afwidth,threshold+afwidth,value);\n#else\nreturn step(threshold,value);\n#endif\n}void main(){float u=(1.0-abs(uv_u*2.0-1.0));float diffuse=dot(vec2(u,u),vec2(0.0,1.0))*0.5+0.5;gl_FragColor=vec4(_Color*diffuse,1.0);}",transparent:!0,depthWrite:!1,extensions:{derivatives:!0}})),t&&this.setup(t)}setup(t){const r=[],s=[],i=[],n=[],o=[];let a=0;for(let e=0;e<t.length;e++){r.push(t[e].x),r.push(t[e].y),r.push(t[e].z),n.push(1),r.push(t[e].x),r.push(t[e].y),r.push(t[e].z),n.push(-1);const _=this.__get_next_position(t,e);s.push(_.x),s.push(_.y),s.push(_.z),s.push(_.x),s.push(_.y),s.push(_.z);const l=this.__get_previous_position(t,e);i.push(l.x),i.push(l.y),i.push(l.z),i.push(l.x),i.push(l.y),i.push(l.z),o.push(a),o.push(a),e<t.length-1&&(a+=t[e].distanceTo(_))}const _=new Float32Array(r),l=new Float32Array(s),h=new Float32Array(i),c=new Float32Array(n),u=new Float32Array(o),d=[];for(let e=0;e<(_.length/3-2)/2;e++){const t=2*e+1;d.push(t),d.push(t+1),d.push(t-1),d.push(t),d.push(t+2),d.push(t+1)}this.geometry.setIndex(d),this.geometry.getAttribute("position").copy(new e.BufferAttribute(_,3)),this.geometry.getAttribute("next_position").copy(new e.BufferAttribute(l,3)),this.geometry.getAttribute("previous_position").copy(new e.BufferAttribute(h,3)),this.geometry.getAttribute("orientation").copy(new e.BufferAttribute(c,1)),this.geometry.getAttribute("coverage").copy(new e.BufferAttribute(u,1)),this.geometry.getAttribute("position").needsUpdate=!0,this.geometry.getAttribute("next_position").needsUpdate=!0,this.geometry.getAttribute("previous_position").needsUpdate=!0,this.geometry.getAttribute("orientation").needsUpdate=!0,this.geometry.getAttribute("coverage").needsUpdate=!0,this.material.uniforms._Length.value=a,this._length=a}set thickness(e){this.material.uniforms._Thickness.value=e}get thickness(){return this.material.uniforms._Thickness.value}__get_previous_position(e,t){return 0===t?e[1].clone().sub(e[0]).multiplyScalar(-1).add(e[0]):e[t-1]}__get_next_position(e,t){return t===e.length-1?e[e.length-2].clone().sub(e[e.length-1]).multiplyScalar(-1).add(e[e.length-1]):e[t+1]}update(){}distance(){return this.accumulated_length}total_length(){return this.accumulated_length}dispose(){this.geometry.dispose(),this.material.dispose(),this.parent&&this.parent.remove(this)}set color(e){this.material.uniforms._Color.value.set(e)}get color(){return this.material.uniforms._Color.value}copy_color(e){this.material.uniforms._Color.value.copy(e)}}class Be extends e.Mesh{constructor(t,r){r=r||new e.Vector2(0,0);const s=new e.ShaderMaterial({uniforms:{_MainTex:{value:t},_ScreenAligned:{value:0},_Scale:{value:1},_Opacity:{value:1}},vertexShader:"#define GLSLIFY 1\nvarying vec2 vUv;uniform float _ScreenAligned;uniform float _Scale;void main(){vec3 pos=position;mat4 local_to_camera=modelViewMatrix;float scale=_Scale;local_to_camera[0]=mix(modelViewMatrix[0],vec4(1.0*scale,0.0,0.0,0.0),_ScreenAligned);local_to_camera[1]=mix(modelViewMatrix[1],vec4(0.0,1.0*scale,0.0,0.0),_ScreenAligned);local_to_camera[2]=mix(modelViewMatrix[2],vec4(0.0,0.0,1.0*scale,0.0),_ScreenAligned);gl_Position=projectionMatrix*local_to_camera*vec4(pos,1.0);vUv=uv;}",fragmentShader:"#define GLSLIFY 1\nuniform sampler2D _MainTex;varying vec2 vUv;uniform float _Opacity;void main(){gl_FragColor=texture2D(_MainTex,vUv);gl_FragColor.a*=_Opacity;}",transparent:!0,depthWrite:!1,side:e.DoubleSide}),i=new e.PlaneGeometry(1,1,1);i.translate(-r.x/2,-r.y/2,0);const n=t.image.width/t.image.height;i.scale(n,1,1),super(i,s),this.current_scale=n,this.geometry.computeBoundingBox(),this.tmp_bb_size=new e.Vector3,this.geometry.boundingBox.getSize(this.tmp_bb_size)}update_texture(){this.material.uniforms._MainTex.value.needsUpdate=!0;const e=this.material.uniforms._MainTex.value.image;this.geometry.scale(1/this.current_scale,1,1),this.current_scale=e.width/e.height,this.geometry.scale(this.current_scale,1,1),this.geometry.computeBoundingBox(),this.geometry.boundingBox.getSize(this.tmp_bb_size)}get size(){return this.tmp_bb_size.clone().multiplyScalar(this.scale.x)}set size(e){this.scale.set(e,e,e),this.material.uniforms._Scale.value=e}set screen_aligned(e){this.material.uniforms._ScreenAligned.value=!0===e?1:0}get screen_aligned(){return 1===this.material.uniforms._ScreenAligned.value}set opacity(e){this.material.uniforms._Opacity.value=e}get opacity(){return this.material.uniforms._Opacity.value}dispose(){this.geometry.dispose(),this.parent.remove(this),this.material.uniforms._MainTex.value.dispose(),this.material.dispose()}}class Ue extends D{constructor(t=1){super("#define GLSLIFY 1\nuniform vec2 _ScreenSize;uniform vec2 _TextureSize;uniform vec2 _PixelOffset;uniform vec3 _NDC;uniform vec2 _PivotPoint;uniform float _DepthOffset;varying vec2 vUv;vec2 add_pixel_offset(vec2 pos){pos=pos*0.5+0.5;pos*=_ScreenSize;pos=ceil(pos+_PixelOffset)+0.5;pos/=_ScreenSize;return pos*2.0-1.0;}void main(){vec4 projected_pos=projectionMatrix*viewMatrix*vec4(_NDC,1.0);projected_pos.zw+=_DepthOffset;projected_pos.xyz/=projected_pos.w;vec2 normalized_size=_TextureSize/_ScreenSize;vec2 dir=uv*2.0-1.0;dir-=_PivotPoint;vec2 pos=projected_pos.xy+dir*normalized_size;gl_Position=vec4(add_pixel_offset(pos),projected_pos.z,1.0);vUv=uv;}","#define GLSLIFY 1\nuniform sampler2D _MainTex;uniform vec2 _ScreenSize;uniform vec2 _TextureSize;varying vec2 vUv;void main(){gl_FragColor=texture2D(_MainTex,vUv+vec2(0.5,0.5)/_TextureSize);}",{_MainTex:{value:void 0},_ScreenSize:{value:new e.Vector2(H.width,H.height)},_TextureSize:{value:new e.Vector2},_PixelOffset:{value:new e.Vector2(0,0)},_NDC:{value:new e.Vector3},_PivotPoint:{value:new e.Vector2},_DepthOffset:{value:0}}),this.transparent=!0,this.depthWrite=!1,this.depthTest=!1}}class Oe{constructor(){this.tmp_vec=new e.Vector2}get_pos_NDC(e){return this.tmp_vec.set(e.x,e.y)}}class Ge{constructor(){this.tmp_vec3=new e.Vector3,this.tmp_vec2=new e.Vector2}get_pos_NDC(e){return this.tmp_vec3.copy(e),this.tmp_vec3.project(O.current),this.tmp_vec2.set(this.tmp_vec3.x,this.tmp_vec3.y)}}class je{constructor(){}update(e,t){}on_enter(e){}on_exit(e){}}class Ie extends je{constructor(){super()}update(e,t){e.is_mouse_over(t)&&e.set_state(e._on_enter_state)}}class Ne extends je{constructor(){super()}on_enter(e){e.on_mouse_enter()}update(e,t){e.is_mouse_over(t)?e.set_state(e._on_hover_state):e.set_state(e._on_exit_state)}}class qe extends je{constructor(){super()}on_enter(e){e.on_mouse_exit(),e.set_state(e._on_idle_state)}}class We extends je{constructor(){super()}on_enter(e){this.__trigger_on_hover(e)}update(e,t){e.is_mouse_over(t)?this.__trigger_on_hover(e):e.set_state(e._on_exit_state)}__trigger_on_hover(e){e.on_mouse_hover()}}class Ye extends e.Mesh{constructor(t,r){super(new e.PlaneGeometry(1,1),new Ue),this.is_clickable=!1,this.position_strategy=new Ge,this.current_state=new Ie,this._position=new e.Vector3,this._on_idle_state=new Ie,this._on_enter_state=new Ne,this._on_exit_state=new qe,this._on_hover_state=new We,this.on_enter=void 0,this.on_exit=void 0,this.on_hover=void 0,this.mouse_pos_tmp=new e.Vector2,this.cached_NDC_position=new e.Vector2,this.screen_pos_tmp=new e.Vector2,this.texture_size=new e.Vector2(1,1),this.frustumCulled=!1,this.matrixAutoUpdate=!1,this.renderOrder=0,this.size=1,this.pixel_offset=new e.Vector2}set_render_order(e){this.renderOrder=e}get pivot_point(){return this.material.uniforms._PivotPoint.value}set_pixel_offset(e){this.pixel_offset.copy(e),this.material.uniforms._PixelOffset.value.copy(e)}set_state(e){this.current_state.on_exit(this),this.current_state=e,this.current_state.on_enter(this)}get position(){return this._position}set use_depth(e){this.material.depthTest=e}get use_depth(){return this.material.depthTest}set depth_offset(e){this.material.uniforms._DepthOffset.value=e}get depth_offset(){return this.material.uniforms._DepthOffset.value}clear_state(){this.visible=!1}set_world_space_coordinate_system(){this.position_strategy=new Ge}set_screen_space_coordinate_system(){this.position_strategy=new Oe}set_texture(t){t.minFilter=e.NearestFilter,t.magFilter=e.NearestFilter,t.needsUpdate=!0,this.texture_size.set(t.image.width,t.image.height),this.material.uniforms._MainTex.value=t,this.get_size(this.material.uniforms._TextureSize.value),this.visible=!0}update_state(e){this.material.uniforms._ScreenSize.value.set(H.width,H.height),this.get_size(this.material.uniforms._TextureSize.value),this.cached_NDC_position.copy(this.position_strategy.get_pos_NDC(this.position)),this.material.uniforms._NDC.value.copy(this.position),this.current_state.update(this,e)}is_mouse_over(t){this.screen_pos_tmp.copy(this.cached_NDC_position),this.to_screen_position(this.screen_pos_tmp),this.screen_pos_tmp.x+=this.pixel_offset.x,this.screen_pos_tmp.y+=this.pixel_offset.y;const r=(new e.Box2).setFromCenterAndSize(this.screen_pos_tmp,this.get_size());return this.mouse_pos_tmp.copy(t),this.to_screen_position(this.mouse_pos_tmp),r.containsPoint(this.mouse_pos_tmp)}to_screen_position(e){e.x=(.5*e.x+.5)*H.width+this.pixel_offset.x,e.y=(.5*e.y+.5)*H.height+this.pixel_offset.y}get_screen_space_position(){const e=this.cached_NDC_position.clone();return this.to_screen_position(e),e}set_screen_space_position(e){this.position.x=e.x/H.width*2-1,this.position.y=e.y/H.height*2-1}dispose(){this.material.uniforms._MainTex.value&&this.material.uniforms._MainTex.value.dispose(),this.geometry.dispose(),this.material.dispose()}get_size(t){return t?t.copy(this.texture_size).multiplyScalar(this.size/H.dpr):(new e.Vector2).copy(this.texture_size).multiplyScalar(this.size/H.dpr)}on_mouse_enter(){}on_mouse_exit(){}on_mouse_hover(){}}class Ee extends e.Mesh{constructor(e,t){super(e,t);const r=this;this.onBeforeRender=()=>{r.material.update()}}}class Qe{constructor(t,r,s){const i=r.right-r.left,n=r.top-r.bottom;this.scale=new e.Vector2(i,n),this.position=new e.Vector2(t+r.left,r.bottom),this.atlas_bounds=new e.Vector4(s.left,s.right,s.top,s.bottom)}}class Xe{constructor(t,r=""){this.glyph_layout=t,this.glyphs=[],this.glyph_is_dirty=!0,this.matrix_is_dirty=!0,this.color_is_dirty=!0,this.position=new e.Vector3,this.quaternion=new e.Quaternion,this.scale=new e.Vector3(1,1,1),this.matrix=new e.Matrix4,this.color=new e.Color("#FFFFFF"),this.pivot_point=new e.Vector2,this.__opacity=1,this.__text=r,this.__generate_glyphs(r)}set text(e){this.__text=e,this.__generate_glyphs(e),this.matrix_is_dirty=!0}get text(){return this.__text}update_matrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrix_is_dirty=!1,this.glyph_is_dirty=!0}clear_glyph_dirty(){this.glyph_is_dirty=!1}clear_color_dirty(){this.color_is_dirty=!1}set_rotation(t=0,r=0){const s=(new e.Quaternion).setFromAxisAngle(new e.Vector3(0,1,0),t/360*Math.PI*2),i=(new e.Quaternion).setFromAxisAngle(new e.Vector3(1,0,0),-r/360*Math.PI*2);this.quaternion.copy(s.multiply(i)),this.matrix_is_dirty=!0}set_position(e){this.position.copy(e),this.matrix_is_dirty=!0}set_size(e){this.scale.set(e,e,e),this.matrix_is_dirty=!0}set_color(e){this.color.set(e),this.color_is_dirty=!0}set_pivot(e){this.pivot_point.copy(e),this.update_glyphs()}set opacity(e){this.__opacity=e,this.color_is_dirty=!0}get opacity(){return this.__opacity}update_glyphs(){this.__generate_glyphs(this.text)}__generate_glyphs(t){let r=0;this.glyphs.length=0;for(let e=0;e<t.length;e++){const s=t.charCodeAt(e),i=this.glyph_layout.find((e=>e.unicode===s));if(i){if(i.planeBounds){const e=new Qe(r,i.planeBounds,i.atlasBounds);this.glyphs.push(e)}r+=i.advance}}const s=new e.Box2,i=this.glyphs[0];s.setFromCenterAndSize(i.position.clone().add(new e.Vector2(i.scale.x/2,i.scale.y/2)),i.scale);for(let t=1;t<this.glyphs.length;t++){const r=this.glyphs[t],i=(new e.Box2).setFromCenterAndSize(r.position.clone().add(new e.Vector2(r.scale.x/2,r.scale.y/2)),r.scale);s.union(i)}const n=new e.Vector2;s.getSize(n);for(let e=0;e<this.glyphs.length;e++)this.glyphs[e].position.x-=n.x/2,this.glyphs[e].position.y-=n.y/2,this.glyphs[e].position.x+=n.x/2*this.pivot_point.x,this.glyphs[e].position.y+=n.y/2*this.pivot_point.y;this.glyph_is_dirty=!0}}class He extends D{constructor(t){super("#define GLSLIFY 1\nattribute vec4 transformsCol0;attribute vec4 transformsCol1;attribute vec4 transformsCol2;attribute vec4 transformsCol3;attribute vec4 glyph_bounds;attribute vec4 plane_bounds;attribute vec4 color;varying vec2 vUv;varying vec4 v_glyph_bounds;varying vec4 v_color;void main(){vec4 pos=vec4(position,1.0);pos.x*=plane_bounds.z;pos.y*=plane_bounds.w;pos.x+=plane_bounds.x;pos.y+=plane_bounds.y;mat4 offset_matrix=mat4(transformsCol0,transformsCol1,transformsCol2,transformsCol3);gl_Position=projectionMatrix*viewMatrix*offset_matrix*pos;vUv=uv;v_glyph_bounds=glyph_bounds;v_color=color;}","#define GLSLIFY 1\nuniform sampler2D _Texture;uniform float _Boldness;varying vec2 vUv;uniform vec2 _AtlasSize;varying vec4 v_glyph_bounds;varying vec4 v_color;float median(float r,float g,float b){return max(min(r,g),min(max(r,g),b));}void main(){float left=v_glyph_bounds.x/_AtlasSize.x;float right=v_glyph_bounds.y/_AtlasSize.x;float top=v_glyph_bounds.z/_AtlasSize.y;float bottom=v_glyph_bounds.w/_AtlasSize.y;float width=abs(right-left);float height=abs(top-bottom);vec2 coord=vec2(vUv.x*width+left,vUv.y*height+top-height);vec4 col=texture2D(_Texture,coord);float sig_dist=median(col.r,col.g,col.b);float _Cutoff=_Boldness;float dist=(_Cutoff-sig_dist);vec2 ddist=vec2(dFdx(dist),dFdy(dist));float pixelDist=dist/length(ddist);float opacity=clamp(0.5-pixelDist,0.0,1.0);gl_FragColor=vec4(v_color.rgb,opacity*v_color.a);}",{_Texture:{value:t},_Boldness:{value:.5},_AtlasSize:{value:new e.Vector2(1,1)}}),this.transparent=!0,this.extensions={derivatives:!0},this.depthWrite=!1,this.side=e.DoubleSide,t.minFilter=e.LinearFilter,t.magFilter=e.LinearFilter,t.generateMipMaps=!1}set_atlas_size(e){this.uniforms._AtlasSize.value.copy(e)}set_boldness(e){this.uniforms._Boldness.value=d.lerp(.5,.2,e)}}class $e extends e.Mesh{constructor(t,r){const s=new e.InstancedBufferGeometry;s.instanceCount=0;const i=new e.PlaneGeometry(1,1);i.translate(.5,.5,0),s.setAttribute("position",new e.Float32BufferAttribute(i.getAttribute("position").array,3)),s.setAttribute("uv",new e.Float32BufferAttribute(i.getAttribute("uv").array,2)),s.index=i.index;const n=new e.InstancedBufferAttribute(new Float32Array(8e3),4,!1),o=new e.InstancedBufferAttribute(new Float32Array(8e3),4,!1),a=new e.InstancedBufferAttribute(new Float32Array(8e3),4,!1),_=new e.InstancedBufferAttribute(new Float32Array(8e3),4,!1),l=new e.InstancedBufferAttribute(new Float32Array(8e3),4,!1),h=new e.InstancedBufferAttribute(new Float32Array(8e3),4,!1),c=new e.InstancedBufferAttribute(new Float32Array(8e3),4,!1);n.usage=e.DynamicDrawUsage,o.usage=e.DynamicDrawUsage,a.usage=e.DynamicDrawUsage,_.usage=e.DynamicDrawUsage,l.usage=e.DynamicDrawUsage,h.usage=e.DynamicDrawUsage,c.usage=e.DynamicDrawUsage,s.setAttribute("transformsCol0",n),s.setAttribute("transformsCol1",o),s.setAttribute("transformsCol2",a),s.setAttribute("transformsCol3",_),s.setAttribute("glyph_bounds",l),s.setAttribute("plane_bounds",h),s.setAttribute("color",c),super(s,new He(r)),this.text_elements=[],this.font_layout=t,this.material.set_atlas_size(new e.Vector2(t.atlas.width,t.atlas.height)),this.frustumCulled=!1}set_boldness(e){this.material.set_boldness(e)}add_text(e){const t=new Xe(this.font_layout.glyphs,e);return this.text_elements.push(t),t}remove_text(e){Re.remove_elem(this.text_elements,e),this.update(!0)}update(e){const t=this.geometry.getAttribute("glyph_bounds"),r=this.geometry.getAttribute("plane_bounds"),s=this.geometry.getAttribute("transformsCol0"),i=this.geometry.getAttribute("transformsCol1"),n=this.geometry.getAttribute("transformsCol2"),o=this.geometry.getAttribute("transformsCol3"),a=this.geometry.getAttribute("color");let _=!0===e,l=!0===e,h=!0===e,c=0;for(let e=0;e<this.text_elements.length;e++){const u=this.text_elements[e];u.matrix_is_dirty&&(_=!0,u.update_matrix()),u.glyph_is_dirty&&(l=!0,u.clear_glyph_dirty()),u.color_is_dirty&&(h=!0,u.clear_color_dirty());const d=u.matrix,p=u.color,m=u.opacity;for(let e=0;e<u.glyphs.length;e++){const _=u.glyphs[e],l=c;t.setXYZW(l,_.atlas_bounds.x,_.atlas_bounds.y,_.atlas_bounds.z,_.atlas_bounds.w),r.setXYZW(l,_.position.x,_.position.y,_.scale.x,_.scale.y),s.setXYZW(l,d.elements[0],d.elements[1],d.elements[2],d.elements[3]),i.setXYZW(l,d.elements[4],d.elements[5],d.elements[6],d.elements[7]),n.setXYZW(l,d.elements[8],d.elements[9],d.elements[10],d.elements[11]),o.setXYZW(l,d.elements[12],d.elements[13],d.elements[14],d.elements[15]),a.setXYZW(l,p.r,p.g,p.b,m),c++}}this.geometry.instanceCount=c,c>this.max_allocations&&console.error("SDFTextBatch exceeded maximum glyph allocations(max/current): ",this.max_allocations,c,this),_&&(s.needsUpdate=!0,i.needsUpdate=!0,n.needsUpdate=!0,o.needsUpdate=!0),l&&(t.needsUpdate=!0,r.needsUpdate=!0),h&&(a.needsUpdate=!0)}dispose(){this.geometry.dispose(),this.material.dispose()}}class Ze extends k{constructor(){super("#define GLSLIFY 1\nuniform sampler2D _SourceTex;uniform vec2 _SourceTexSize;varying vec2 vUv;\n#define vec vec4\n#define toVec(x) x.rgba\n#define s2(a, b) temp = a; a = min(a, b); b = max(temp, b);\n#define t2(a, b) s2(v[a], v[b]);\n#define t24(a, b, c, d, e, f, g, h) t2(a, b); t2(c, d); t2(e, f); t2(g, h);\n#define t25(a, b, c, d, e, f, g, h, i, j) t24(a, b, c, d, e, f, g, h); t2(i, j);\n#define s2(a, b) temp = a; a = min(a, b); b = max(temp, b);\n#define mn3(a, b, c) s2(a, b); s2(a, c);\n#define mx3(a, b, c) s2(b, c); s2(a, c);\n#define mnmx3(a, b, c) mx3(a, b, c); s2(a, b);\n#define mnmx4(a, b, c, d) s2(a, b); s2(c, d); s2(a, c); s2(b, d);\n#define mnmx5(a, b, c, d, e) s2(a, b); s2(c, d); mn3(a, c, e); mx3(b, d, e);\n#define mnmx6(a, b, c, d, e, f) s2(a, d); s2(b, e); s2(c, f); mn3(a, b, c); mx3(d, e, f);\nvoid main(){vec2 inv_size=vec2(1.0/_SourceTexSize.x,1.0/_SourceTexSize.y);\n#ifdef kernel5x5\nvec v[25];for(int dX=-2;dX<=2;++dX){for(int dY=-2;dY<=2;++dY){vec2 offset=vec2(float(dX),float(dY));v[(dX+2)*5+(dY+2)]=toVec(texture2D(_SourceTex,vUv+offset*inv_size));}}vec temp;t25(0,1,3,4,2,4,2,3,6,7);t25(5,7,5,6,9,7,1,7,1,4);t25(12,13,11,13,11,12,15,16,14,16);t25(14,15,18,19,17,19,17,18,21,22);t25(20,22,20,21,23,24,2,5,3,6);t25(0,6,0,3,4,7,1,7,1,4);t25(11,14,8,14,8,11,12,15,9,15);t25(9,12,13,16,10,16,10,13,20,23);t25(17,23,17,20,21,24,18,24,18,21);t25(19,22,8,17,9,18,0,18,0,9);t25(10,19,1,19,1,10,11,20,2,20);t25(2,11,12,21,3,21,3,12,13,22);t25(4,22,4,13,14,23,5,23,5,14);t25(15,24,6,24,6,15,7,16,7,19);t25(3,11,5,17,11,17,9,17,4,10);t25(6,12,7,14,4,6,4,7,12,14);t25(10,14,6,7,10,12,6,10,6,17);t25(12,17,7,17,7,10,12,18,7,12);t24(10,18,12,20,10,20,10,12);gl_FragColor=v[12];\n#endif\n#ifdef kernel3x3\nvec v[9];for(int dX=-1;dX<=1;++dX){for(int dY=-1;dY<=1;++dY){vec2 offset=vec2(float(dX),float(dY));v[(dX+1)*3+(dY+1)]=toVec(texture2D(_SourceTex,vUv+offset*inv_size));}}vec temp;mnmx6(v[0],v[1],v[2],v[3],v[4],v[5]);mnmx5(v[1],v[2],v[3],v[4],v[6]);mnmx4(v[2],v[3],v[4],v[7]);mnmx3(v[3],v[4],v[8]);toVec(gl_FragColor)=v[4];\n#endif\n}",void 0,{kernel3x3:!0}),this.uniforms._SourceTex={value:void 0},this.uniforms._SourceTexSize={value:new e.Vector2(1,1)}}set_texture(e){this.uniforms._SourceTex.value=e;const t=this.get_size(e);this.uniforms._SourceTexSize.value.copy(t)}get_size(t){return t.isVideoTexture?new e.Vector2(Math.max(1,t.image.videoWidth),Math.max(1,t.image.videoHeight)):t.isWebGLRenderTarget?new e.Vector2(t.width,t.height):t.isTexture?new e.Vector2(t.image.width,t.image.height):new e.Vector2(1,1)}}class Je extends k{constructor(e){super(e?"#define GLSLIFY 1\nuniform sampler2D _MainTex;uniform vec2 _Resolution;varying vec2 vUv;vec4 upsample(vec2 uv,vec2 halfpixel){vec4 sum=texture2D(_MainTex,uv+vec2(-halfpixel.x*2.0,0.0));sum+=texture2D(_MainTex,uv+vec2(-halfpixel.x,halfpixel.y))*2.0;sum+=texture2D(_MainTex,uv+vec2(0.0,halfpixel.y*2.0));sum+=texture2D(_MainTex,uv+vec2(halfpixel.x,halfpixel.y))*2.0;sum+=texture2D(_MainTex,uv+vec2(halfpixel.x*2.0,0.0));sum+=texture2D(_MainTex,uv+vec2(halfpixel.x,-halfpixel.y))*2.0;sum+=texture2D(_MainTex,uv+vec2(0.0,-halfpixel.y*2.0));sum+=texture2D(_MainTex,uv+vec2(-halfpixel.x,-halfpixel.y))*2.0;return sum/12.0;}void main(){vec2 half_pixel;half_pixel.x=0.5/_Resolution.x;half_pixel.y=0.5/_Resolution.y;gl_FragColor=upsample(vUv,half_pixel);}":"#define GLSLIFY 1\nuniform sampler2D _MainTex;uniform vec2 _Resolution;varying vec2 vUv;vec4 downsample(vec2 uv,vec2 halfpixel){vec4 sum=texture2D(_MainTex,uv)*4.0;sum+=texture2D(_MainTex,uv-halfpixel);sum+=texture2D(_MainTex,uv+halfpixel);sum+=texture2D(_MainTex,uv+vec2(halfpixel.x,-halfpixel.y));sum+=texture2D(_MainTex,uv-vec2(halfpixel.x,-halfpixel.y));return sum/8.0;}void main(){vec2 half_pixel=vec2(0.5/_Resolution.x,0.5/_Resolution.y);gl_FragColor=downsample(vUv,half_pixel);}")}}class Ke extends k{constructor(e,t){super("#define GLSLIFY 1\nuniform sampler2D _MainTex;uniform vec2 _Resolution;varying vec2 vUv;void main(){vec4 col=texture2D(_MainTex,vUv);gl_FragColor=col;gl_FragColor.a=col.a;}")}set offset(e){this.uniforms._Offset.value=e}get offset(){return this.uniforms._Offset.value}}class et{constructor(e,t){this.read=void 0,this.write=void 0,this.name=e,this.update_material=t}init_from_geometry(e){}init_from_attribute(e){}build_RT(t){const r=et.calculate_resolution(t),s={minFilter:e.NearestFilter,magFilter:e.NearestFilter,format:e.RGBAFormat,colorScape:e.NoColorSpace,type:G.fp_textures_available?e.FloatType:e.HalfFloatType,stencilBuffer:!1,depthBuffer:!1};return new e.WebGLRenderTarget(r.width,r.height,s)}static calculate_resolution(e){const t=Math.min(e,512);return{width:t,height:Math.max(1,Math.ceil(e/t))}}swap_RT(){const e=this.read;this.read=this.write,this.write=e}update(e){this.update_material&&(this.update_material.update(),e.children[0].material=this.update_material,this.update_material.uniforms._MainTex.value=this.read.texture,se.render(e,void 0,this.write),e.children[0].material=void 0,this.swap_RT())}store_geometry_attribute_in_RT(e,t,r,s){s.children[0].geometry.setAttribute("data",e),s.children[0].material=r,se.render(s,void 0,t),s.children[0].geometry.deleteAttribute("data"),s.children[0].material=void 0}get_texture(){return this.read.texture}}class tt extends e.Object3D{constructor(t,r){super(),this.attributes=[],this.mesh=this.build_point_mesh(t,r),this.add(this.mesh),this.attribute_writter_mesh=this.build_attribute_writter_mesh(t),this.attribute_writter_scene=new e.Scene,this.attribute_writter_scene.add(this.attribute_writter_mesh)}add_texture_attribute(e){this.attributes.push(e)}add_update_attribute_array(t,r,s){this.attribute_writter_mesh.geometry.setAttribute(t,new e.BufferAttribute(r,s,!1))}add_attribute_array(t,r,s){this.mesh.geometry.setAttribute(t,new e.InstancedBufferAttribute(r,s,!1))}update(){this.mesh.material.update();for(let e=0;e<this.attributes.length;e++)this.attributes[e].update(this.attribute_writter_scene)}dispose(){this.mesh.geometry.dispose(),this.mesh.material.dispose()}build_point_mesh(t=1,r){const s=new e.PlaneGeometry,i=new e.InstancedBufferGeometry;i.setAttribute("position",s.getAttribute("position")),i.index=s.index,i.setAttribute("storage_uv",this.build_uv_storage_attribute(t)),i.instanceCount=t;const n=new e.Mesh(i,r);return n.frustumCulled=!1,n}build_attribute_writter_mesh(t){const{width:r,height:s}=et.calculate_resolution(t),i=new Float32Array(3*t);for(let e=0;e<t;e++){const t=e%r,n=Math.floor(e/r);i[3*e+0]=(t+.5)/r,i[3*e+1]=(n+.5)/s,i[3*e+2]=e}const n=new e.BufferGeometry;n.setAttribute("position",new e.BufferAttribute(i,3,!1));const o=new e.Points(n);return o.frustumCulled=!1,o}build_uv_storage_attribute(t){const{width:r,height:s}=et.calculate_resolution(t),i=new Float32Array(2*t);for(let e=0;e<t;e++){const t=e%r,n=Math.floor(e/r);i[2*e+0]=(t+.5)/r,i[2*e+1]=(n+.5)/s}return new e.InstancedBufferAttribute(i,2,!1)}}class rt extends e.ShaderMaterial{constructor(){super({uniforms:{},vertexShader:"\n varying vec4 value;\n attribute vec4 data;\n\n void main()\n {\n gl_Position = vec4(position.xy * 2.0 - 1.0, 1.0,1.0);\n gl_PointSize = 1.0;\n\n value = data;\n }\n ",fragmentShader:"#define GLSLIFY 1\nvarying vec4 value;void main(){gl_FragColor=value;}",depthWrite:!1,blending:e.NoBlending,depthTest:!1,depthFunc:e.AlwaysDepth})}}class st extends e.DataTexture{constructor(e,t,r,s,i){super(e,t,r,s,i),this.multiplier=1}set_rgba(e,t,r,s,i){this.data[3*e+0]=t*this.multiplier,this.data[3*e+1]=r*this.multiplier,this.data[3*e+2]=s*this.multiplier,this.data[3*e+3]=i*this.multiplier,this.needsUpdate=!0}set_rgb(e,t,r,s){this.data[3*e+0]=t*this.multiplier,this.data[3*e+1]=r*this.multiplier,this.data[3*e+2]=s*this.multiplier,this.needsUpdate=!0}set_r(e,t){this.data[3*e+0]=t*this.multiplier,this.needsUpdate=!0}set_g(e,t){this.data[3*e+1]=t*this.multiplier,this.needsUpdate=!0}set_b(e,t){this.data[3*e+2]=t*this.multiplier,this.needsUpdate=!0}set_a(e,t){this.data[3*e+2]=t*this.multiplier,this.needsUpdate=!0}}class it extends st{constructor(t,r){super(new Uint8Array(t*r*3),t,r,e.RGBAFormat),this.multiplier=255}}class nt extends st{constructor(t,r){super(new Uint8Array(t*r*4),t,r,e.RGBAFormat),this.multiplier=255}}class ot extends st{constructor(t,r){super(new Float32Array(t*r*3),t,r,e.RGBAFormat,e.FloatType)}}class at extends st{constructor(t,r){super(new Float32Array(t*r*4),t,r,e.RGBAFormat,e.FloatType)}}class _t extends e.Mesh{constructor(e,t,r,s){super(t,r),this.id_table=e,this.batched_count=Object.keys(e).length,this.max_texture_width=s,this.batch_width=this.batched_count%s,this.batch_height=Math.ceil(this.batched_count/s)}attach_rgb_texture(e){this.material.uniforms[e].value=new it(this.batch_width,this.batch_height)}attach_rgba_texture(e){this.material.uniforms[e].value=new nt(this.batch_width,this.batch_height)}attach_rgb_float_texture(e){this.material.uniforms[e].value=new ot(this.batch_width,this.batch_height)}attach_rgba_float_texture(e){this.material.uniforms[e].value=new at(this.batch_width,this.batch_height)}get_mesh_index(e){return this.id_table[e]}set_rgb_value(e,t,r,s,i){this.material.uniforms[e].set_rgb(this.get_mesh_index(t),r,s,i)}set_rgba_value(e,t,r,s,i,n){this.material.uniforms[e].set_rgba(this.get_mesh_index(t),r,s,i,n)}}class lt{constructor(e,t=!0,r=1,s=!1){this.buffer=e,this.loop=t,this.volume=r,this.positional=s,this.audio=void 0}init(t){this.positional?this.audio=new e.PositionalAudio(t):this.audio=new e.Audio(t),this.audio.setBuffer(this.buffer),this.audio.setLoop(this.loop),this.audio.gain.gain.value=0,this.audio.setVolume(this.loop?0:this.volume)}play(){this.audio.play()}pause(){this.audio.pause()}stop(){this.audio.stop()}get is_playing(){return this.audio.isPlaying}}exports.BufferGeometryUtils=l,exports.AbstractLoader=u,exports.ActionEvent=x,exports.ActionInterpolator=g,exports.ActionSequencer=p,exports.ActionSequencerBuilder=w,exports.AddMaterial=B,exports.ApplicationView=class extends z{constructor({name:e,url:t,container:r}){super(e),this.container=r,this.url=t;let s=T.get(`${e}_data`);s=s||{animation_tracks:[],triggers:[]};const i=[{to:e,data:s}];R.register_view(this),R.add_transitions(i)}show(){this.container.classList.add("before_enter"),this.container.classList.remove("before_exit"),this.container.classList.remove("hidden")}on_enter(){this.container.classList.remove("before_enter"),this.container.classList.remove("before_exit"),this.container.classList.remove("hidden")}before_exit(){this.container.classList.add("before_exit"),this.container.classList.remove("before_enter"),this.container.classList.remove("hidden")}hide(){this.container.classList.add("hidden"),this.container.classList.remove("before_enter"),this.container.classList.remove("before_exit")}load_html_images(){M.load_images(this.container)}load_html_videos(){M.load_videos(this.container)}set_opacity(e){this.container.style.opacity=e[`${this.name}_opacity`]}},exports.ArrayUtilities=Re,exports.Arrow=X,exports.AsyncTextureLoader=class extends u{constructor(e,t,r,s=!0,i=!1,n=!0){super(e,t,r),this.colorSpaceConversion=n,this.premultiplyAlpha=i,this.flipY=s}on_preloaded_finished(e){h.is_safari?this.load_with_old_method(e):this.load_with_new_method(e)}load_with_old_method(t){if(void 0===t.resources_by_url[this.url]){const r=new e.Texture,s=new Image;s.src=this.url,s.onload=()=>{r.image=s,r.flipY=this.flipY,r.premultiplyAlpha=this.premultiplyAlpha,r.colorSpace=this.colorSpaceConversion?e.SRGBColorSpace:e.NoColorSpace,r.needsUpdate=!0,t.set_resource(this.resource_id,this.url,r),this.__update_downloaded_bytes(1,1),this.__loading_ended()},s.onerror=()=>{console.error("Error loading texture. Maybe the resource is not an image?",this.url,this.original_url)}}else t.set_resource(this.resource_id,this.url,t.resources_by_url[this.url]),this.__update_downloaded_bytes(1,1),this.__loading_ended()}load_with_new_method(t){if(void 0===t.resources_by_url[this.url]){const r={credentials:"same-origin"};fetch(this.url,r).then((e=>e.blob())).then((e=>createImageBitmap(e,{colorSpaceConversion:this.colorSpaceConversion?"default":"none",imageOrientation:this.flipY?"flipY":"none",premultiplyAlpha:this.premultiplyAlpha?"premultiply":"none"}))).then((r=>{const s=new e.Texture(r);s.flipY=this.flipY,s.premultiplyAlpha=this.premultiplyAlpha,s.colorSpace=this.colorSpaceConversion?e.SRGBColorSpace:e.NoColorSpace,s.needsUpdate=!0,t.set_resource(this.resource_id,this.url,s),this.__update_downloaded_bytes(1,1),this.__loading_ended()})).catch((function(e){console.error(e)}))}else t.set_resource(this.resource_id,this.url,t.resources_by_url[this.url]),this.__update_downloaded_bytes(1,1),this.__loading_ended()}},exports.AudioLoader=class extends u{constructor(e,t,r=!0,s=0,i,n=!1){super(e,t,i),this.loop=r,this.volume=s,this.positional=n}on_preloaded_finished(e){void 0===e.resources_by_url[this.url]?this.instantiate_audio(e):(e.set_resource(this.resource_id,this.url,e.resources_by_url[this.url]),this.__update_downloaded_bytes(1,1),this.__loading_ended())}instantiate_audio(t){const r=e.AudioContext.getContext(),s=r.createBuffer(2,22050,44100);fetch(this.url).then((e=>e.blob())).then((e=>{e.arrayBuffer?e.arrayBuffer().then((e=>{r.decodeAudioData(e,(e=>{t.set_resource(this.resource_id,this.url,new lt(e,this.loop,this.volume,this.positional)),this.__update_downloaded_bytes(1,1),this.__loading_ended()}))})):(t.set_resource(this.resource_id,this.url,new lt(s,this.loop,this.volume,this.positional)),this.__update_downloaded_bytes(1,1),this.__loading_ended())}))}},exports.BaseApplication=C,exports.BaseRender=V,exports.BaseShaderMaterial=D,exports.BasisLoader=class extends u{constructor(e,t,r,s){super(e,t,s),this.loader=r}on_preloaded_finished(e){void 0===e.resources_by_url[this.url]?this.loader.load(this.url,(t=>{e.set_resource(this.resource_id,this.url,t),this.__update_downloaded_bytes(1,1),this.__loading_ended()}),(e=>{}),(e=>{this.__set_error(e+"\n\n\t If the error says something about unexpected token < in JSON then the probably the problem is related to the file not being found. Check the name and path of the resource"),this.__loading_ended()})):(e.set_resource(this.resource_id,this.url,e.resources_by_url[this.url]),this.__update_downloaded_bytes(1,1),this.__loading_ended())}},exports.BlitMaterial=k,exports.Blurrer=xe,exports.Browser=h,exports.CSSAnimator=class{constructor({element:e,css_property:t,from:r=0,to:s=1,duration:i=1,value_prefix:n="",value_suffix:o="",easing_function:a=m.ease_in_out_cubic,finished_callback:_=()=>{}}){this.element=e,this.css_property=t,this.from=r,this.to=s,this.value_prefix=n,this.value_suffix=o,this.duration=i,this.easing_function=a,this.finished_callback=_,this.current_state=new N}animate(){this.set_current_state(new q)}stop(){this.set_current_state(new N)}set_property_value(e){this.element.style[this.css_property]=`${this.value_prefix}${e}${this.value_suffix}`}update(){this.current_state.update(this)}get is_animating(){return this.current_state.is_animating}set_current_state(e){this.current_state.on_exit(this),this.current_state=e,this.current_state.on_enter(this)}},exports.CameraManager=O,exports.CameraUtilities=ue,exports.CanvasDrawer=j,exports.Capabilities=G,exports.Configuration=I,exports.Cube=E,exports.CubemapLoader=class extends u{constructor(t,r,s,i){super(t,r,i),this.loader=new e.CubeTextureLoader,this.loader.setPath(r+"/"),this.urls=[`px.${s}`,`nx.${s}`,`py.${s}`,`ny.${s}`,`pz.${s}`,`nz.${s}`]}on_preloaded_finished(e){void 0===e.resources_by_url[this.url]?this.loader.load(this.urls,(t=>{e.set_resource(this.resource_id,this.url,t),this.__update_downloaded_bytes(1,1),this.__loading_ended()}),(e=>{}),(e=>{this.__set_error("Image could not be loaded. Maybe wrong name or path, I don't know¯\\_(ツ)_/¯",e),this.__loading_ended()})):(e.set_resource(this.resource_id,this.url,e.resources_by_url[this.url]),this.__update_downloaded_bytes(1,1),this.__loading_ended())}},exports.DAELoader=class extends u{constructor(e,t,s){super(e,t,s),this.loader=new r.ColladaLoader}on_preloaded_finished(e){void 0===e.resources_by_url[this.url]?this.loader.load(this.url,(t=>{e.set_resource(this.resource_id,this.url,t),this.__update_downloaded_bytes(1,1),this.__loading_ended()}),(e=>{}),(e=>{this.__set_error(e+"\n\n\t If the error says something about unexpected token < in JSON then the probably the problem is related to the file not being found. Check the name and path of the resource"),this.__loading_ended()})):(e.set_resource(this.resource_id,this.url,e.resources_by_url[this.url]),this.__update_downloaded_bytes(1,1),this.__loading_ended())}},exports.Debug=J,exports.DebugNormalsRender=class extends V{constructor(){super()}render(){se.clear(void 0,O.current,!0,!0),se.render(Y.current,O.current,void 0,new ie)}},exports.DrawIOAnimationSheet=b,exports.DualFilteringBlurMaterial=Je,exports.DualFilteringBlurrer=class{constructor(t){this.current_width=1,this.current_height=1,this.RT0=new e.WebGLRenderTarget(1,1),this.RT1=new e.WebGLRenderTarget(1,1),this.RT2=new e.WebGLRenderTarget(1,1),this.RT3=new e.WebGLRenderTarget(1,1),this.RT4=new e.WebGLRenderTarget(1,1),this.upscale_blur_mat=new Je(!0),this.downscale_blur_mat=new Je(!1),this.alpha_filter_mat=new Ke}blur(e){this.check_RT_resize(e.width,e.height),se.blit(e,this.RT1,this.alpha_filter_mat),se.blit(this.RT1,this.RT2,this.downscale_blur_mat),se.blit(this.RT2,this.RT3,this.downscale_blur_mat),se.blit(this.RT3,this.RT4,this.downscale_blur_mat),se.blit(this.RT4,this.RT3,this.upscale_blur_mat),se.blit(this.RT3,this.RT2,this.upscale_blur_mat),se.blit(this.RT2,e,this.upscale_blur_mat)}check_RT_resize(e,t){this.current_width===e&&this.current_height===t||(this.current_width=e,this.current_height=t,this.RT0.setSize(this.current_width/2,this.current_height/2),this.RT1.setSize(this.current_width/2,this.current_height/2),this.RT2.setSize(this.current_width/4,this.current_height/4),this.RT3.setSize(this.current_width/8,this.current_height/8),this.RT4.setSize(this.current_width/16,this.current_height/16))}},exports.EasingFunctions=m,exports.EventManager=y,exports.FileLoader=class extends u{constructor(t,r,s){super(t,r,s),this.loader=new e.FileLoader}on_preloaded_finished(e){void 0===e.resources_by_url[this.url]?this.loader.load(this.url,(t=>{e.set_resource(this.resource_id,this.url,t),this.__update_downloaded_bytes(1,1),this.__loading_ended()}),(e=>{}),(e=>{this.__set_error(e),this.__loading_ended()})):(e.set_resource(this.resource_id,this.url,e.resources_by_url[this.url]),this.__update_downloaded_bytes(1,1),this.__loading_ended())}},exports.FontLoader=class extends u{constructor(e,t,r){super(e,t,r),this.loader=new s.FontLoader}on_preloaded_finished(e){void 0===e.resources_by_url[this.url]?this.loader.load(this.url,(t=>{e.set_resource(this.resource_id,this.url,t),this.__update_downloaded_bytes(1,1),this.__loading_ended()}),(e=>{}),(e=>{this.__set_error(e+"\n\n\t If the error says something about unexpected token < in JSON then probably the problem is related to the file not being found. Check the name and path of the resource"),this.__loading_ended()})):(e.set_resource(this.resource_id,this.url,e.resources_by_url[this.url]),this.__update_downloaded_bytes(1,1),this.__loading_ended())}},exports.FrustumPointFitter=class{constructor(){this.sphere=new e.Sphere}fit_points(t,r,s,i){this.sphere.setFromPoints(t);const n=Math.degToRad(s/2),o=2*Math.atan(Math.tan(n)*i)/2,a=this.get_up_plane_normal(r,n),_=this.get_down_plane_normal(r,n),l=this.get_left_plane_normal(r,o),h=this.get_right_plane_normal(r,o),c=new e.Vector3(0,0,-1).applyQuaternion(r),u=this.sphere.center.clone(),d=this.get_distance_to_fit_rect(2*this.sphere.radius,2*this.sphere.radius,s,i),p=u.clone().add(c.clone().multiplyScalar(-1*d)),m=(new e.Plane).setFromNormalAndCoplanarPoint(a,p),g=(new e.Plane).setFromNormalAndCoplanarPoint(_,p),f=(new e.Plane).setFromNormalAndCoplanarPoint(l,p),v=(new e.Plane).setFromNormalAndCoplanarPoint(h,p);this.apply_center_correction_to_pos(p,t,r,m,g,f,v),m.setFromNormalAndCoplanarPoint(a,p),g.setFromNormalAndCoplanarPoint(_,p),f.setFromNormalAndCoplanarPoint(l,p),v.setFromNormalAndCoplanarPoint(h,p);let x=1/0;const b=c.clone().multiplyScalar(-2*d);for(let r=0;r<t.length;r++){const s=new e.Line3(t[r].clone(),t[r].clone().add(b)),i=new e.Vector3,n=new e.Vector3,o=new e.Vector3,a=new e.Vector3;m.intersectLine(s,i),g.intersectLine(s,n),f.intersectLine(s,o),v.intersectLine(s,a),i.length()<1e-4&&console.log("up intersection not found",r),n.length()<1e-4&&console.log("down intersection not found",r),o.length()<1e-4&&console.log("left intersection not found",r),a.length()<1e-4&&console.log("right intersection not found",r);const _=t[r].clone().sub(i).length(),l=t[r].clone().sub(n).length(),h=t[r].clone().sub(o).length(),c=t[r].clone().sub(a).length(),u=Math.min(_,l),d=Math.min(h,c),p=Math.min(u,d);p<x&&(x=p)}const w=c.clone().multiplyScalar(x);return p.clone().add(w)}apply_center_correction_to_pos(e,t,r,s,i,n,o){const a=this.get_vertical_correction(t,i,s,r),_=this.get_hozirontal_correction(t,n,o,r);e.add(a),e.add(_)}get_vertical_correction(t,r,s,i){let n,o,a=1/0,_=1/0;const l=new e.Vector3(0,1,0).applyQuaternion(i);for(let i=0;i<t.length;i++){const h=new e.Line3(t[i].clone(),t[i].clone().add(l.clone().multiplyScalar(-5e6))),c=new e.Line3(t[i].clone(),t[i].clone().add(l.clone().multiplyScalar(5e6))),u=new e.Vector3,d=new e.Vector3;r.intersectLine(h,u),s.intersectLine(c,d);const p=u.distanceTo(t[i]),m=d.distanceTo(t[i]);d.length()<1e-4&&console.log("vertical up intersection not found",i),u.length()<1e-4&&console.log("vertical down intersection not found",i),p<_&&(_=p,o=t[i]),m<a&&(a=m,n=t[i])}console.log(n,o);const h=(a-_)/2;return l.clone().multiplyScalar(-h)}get_hozirontal_correction(t,r,s,i){let n,o,a=1/0,_=1/0;const l=new e.Vector3(1,0,0).applyQuaternion(i);for(let i=0;i<t.length;i++){const h=new e.Line3(t[i].clone(),t[i].clone().add(l.clone().multiplyScalar(-5e6))),c=new e.Line3(t[i].clone(),t[i].clone().add(l.clone().multiplyScalar(5e6))),u=new e.Vector3,d=new e.Vector3;r.intersectLine(h,u),s.intersectLine(c,d);const p=u.distanceTo(t[i]),m=d.distanceTo(t[i]);u.length()<1e-4&&console.log("left intersection not found",i),d.length()<1e-4&&console.log("right intersection not found",i),p<_&&(_=p,o=t[i]),m<a&&(a=m,n=t[i])}const h=(a-_)/2;return console.log(n,o),l.clone().multiplyScalar(-h)}get_up_plane_normal(t,r){const s=new e.Vector3(0,-1,0);return s.applyQuaternion((new e.Quaternion).setFromAxisAngle(new e.Vector3(1,0,0),r)),s.applyQuaternion(t),s}get_down_plane_normal(t,r){const s=new e.Vector3(0,1,0);return s.applyQuaternion((new e.Quaternion).setFromAxisAngle(new e.Vector3(1,0,0),-r)),s.applyQuaternion(t),s}get_left_plane_normal(t,r){const s=new e.Vector3(1,0,0);return s.applyQuaternion((new e.Quaternion).setFromAxisAngle(new e.Vector3(0,1,0),r)),s.applyQuaternion(t),s}get_right_plane_normal(t,r){const s=new e.Vector3(-1,0,0);return s.applyQuaternion((new e.Quaternion).setFromAxisAngle(new e.Vector3(0,1,0),-r)),s.applyQuaternion(t),s}get_distance_to_fit_rect(e,t,r,s){const i=r/2*Math.PI/180,n=2*Math.atan(Math.tan(i)*s)/2,o=t/Math.tan(i),a=e/Math.tan(n);return Math.max(Math.abs(a),Math.abs(o))}},exports.GLTFDRACOLoader=class extends u{constructor(e,t,r,s){super(e,t,s),this.loader=new i.GLTFLoader,this.loader.setDRACOLoader(r)}on_preloaded_finished(e){void 0===e.resources_by_url[this.url]?this.loader.load(this.url,(t=>{e.set_resource(this.resource_id,this.url,t),this.__update_downloaded_bytes(1,1),this.__loading_ended()}),(e=>{}),(e=>{this.__set_error(e+"\n\n\t If the error says something about unexpected token < in JSON then the probably the problem is related to the file not being found. Check the name and path of the resource"),this.__loading_ended()})):(e.set_resource(this.resource_id,this.url,e.resources_by_url[this.url]),this.__update_downloaded_bytes(1,1),this.__loading_ended())}},exports.GLTFLoader=class extends u{constructor(e,t,r){super(e,t,r),this.loader=new i.GLTFLoader}on_preloaded_finished(e){void 0===e.resources_by_url[this.url]?this.loader.load(this.url,(t=>{e.set_resource(this.resource_id,this.url,t),this.__update_downloaded_bytes(1,1),this.__loading_ended()}),(e=>{}),(e=>{this.__set_error(e+"\n\n\t If the error says something about unexpected token < in JSON then the probably the problem is related to the file not being found. Check the name and path of the resource"),this.__loading_ended()})):(e.set_resource(this.resource_id,this.url,e.resources_by_url[this.url]),this.__update_downloaded_bytes(1,1),this.__loading_ended())}},exports.GPUParticleSystem=tt,exports.GaussianBlurrer=ye,exports.GeometryUtilities=Ce,exports.Graphics=se,exports.Grid=De,exports.HDRCubeTextureLoader=class extends u{constructor(e,t,r,s){super(e,t,s),this.loader=new n.HDRCubeTextureLoader,this.loader.setPath(t+"/"),this.urls=[`px.${r}`,`nx.${r}`,`py.${r}`,`ny.${r}`,`pz.${r}`,`nz.${r}`]}on_preloaded_finished(e){void 0===e.resources_by_url[this.url]?this.loader.load(this.urls,(t=>{e.set_resource(this.resource_id,this.url,t),this.__update_downloaded_bytes(1,1),this.__loading_ended()}),(e=>{}),(e=>{this.__set_error(e+"\n\n\t If the error says something about unexpected token < in JSON then the probably the problem is related to the file not being found. Check the name and path of the resource"),this.__loading_ended()})):(e.set_resource(this.resource_id,this.url,e.resources_by_url[this.url]),this.__update_downloaded_bytes(1,1),this.__loading_ended())}},exports.HTMLUtilities=M,exports.HorizontalPlane=ze,exports.ImageUtilities=class{constructor(){}static get_image_data(e){const t=document.createElement("canvas");t.width=e.width,t.height=e.height;const r=t.getContext("2d");return r.drawImage(e,0,0),r.getImageData(0,0,e.width,e.height)}static get_pixel(t,r,s){const i=4*(r+t.width*s),n=t.data;return new e.Vector4(n[i+0],n[i+1],n[i+2],n[i+3])}},exports.Initializer=de,exports.JSONLoader=class extends u{constructor(e,t,r){super(e,t,r)}on_preloaded_finished(e,t){void 0===e.resources_by_url[this.url]?t.json().then((t=>{e.set_resource(this.resource_id,this.url,t),this.__update_downloaded_bytes(1,1),this.__loading_ended()})):(e.set_resource(this.resource_id,this.url,e.resources_by_url[this.url]),this.__update_downloaded_bytes(1,1),this.__loading_ended())}},exports.KeyboardInput=class{init(e){this.ctrlz_pressed=!1,this.ctrlz_fired=!1,this.keys={},this.keys_keys=[],this.container=e,this.container.addEventListener("keydown",this.on_key_down.bind(this),!1),this.container.addEventListener("keyup",this.on_key_up.bind(this),!1)}on_key_down(e){90===e.keyCode&&e.ctrlKey&&!this.ctrlz_fired&&(this.ctrlz_pressed=!0,this.ctrlz_fired=!0),e.code&&this.press_key(e.code)}on_key_up(e){this.release_key(e.code)}clear(){this.ctrlz_pressed=!1;for(let e=0;e<this.keys_keys.length;e++)this.keys[this.keys_keys[e]].pressed=!1,this.keys[this.keys_keys[e]].released=!1}release_key(e){const t=this.keys[e];t&&(t.fired=!1,t.down=!1,t.released=!0)}release_keys(){this.ctrlz_fired=!1;for(let e=0;e<this.keys_keys.length;e++)this.keys[this.keys_keys[e]].fired=!1,this.keys[this.keys_keys[e]].down=!1}press_key(e){const t=this.keys[e];t&&(!1===t.down&&(t.pressed=!0),t.down=!0,t.fired=!0)}is_key_pressed(e){const t=this.keys[e];return!!t&&t.pressed}is_key_down(e){const t=this.keys[e];return!!t&&t.down}is_key_released(e){const t=this.keys[e];return!!t&&t.released}register_key(e){this.keys[e]={key_name:e,pressed:!1,down:!1,fired:!1},this.keys_keys=Object.keys(this.keys)}unregister_key(e){delete this.keys[e]}dispose(){this.container.removeEventListener("keydown",this.on_key_down.bind(this),!1),this.container.removeEventListener("keyup",this.on_key_up.bind(this),!1)}},exports.Line=ke,exports.MedianFilter=class{constructor(t){this.RT=new e.WebGLRenderTarget(1,1,{type:e.FloatType,format:e.RGBAFormat,minFilter:e.NearestFilter,magFilter:e.NearestFilter}),this.RT1=new e.WebGLRenderTarget(1,1,{type:e.FloatType,format:e.RGBAFormat,minFilter:e.NearestFilter,magFilter:e.NearestFilter}),this.median_filter_mat=new Ze}filter(e){const t=this.get_size(e);t.x===this.RT.width&&t.y===this.RT.height||(this.RT.setSize(t.x,t.y),this.RT1.setSize(t.x,t.y)),this.median_filter_mat.set_texture(e),se.material_pass(this.median_filter_mat,this.RT);for(let e=0;e<0;e++)this.median_filter_mat.set_texture(this.RT.texture),se.material_pass(this.median_filter_mat,this.RT1),this.median_filter_mat.set_texture(this.RT1.texture),se.material_pass(this.median_filter_mat,this.RT);return this.RT}get_size(t){return t.isVideoTexture?new e.Vector2(Math.max(1,t.image.videoWidth),Math.max(1,t.image.videoHeight)):t.isWebGLRenderTarget?new e.Vector2(t.width,t.height):t.isTexture?new e.Vector2(t.image.width,t.image.height):new e.Vector2(1,1)}},exports.MeshBatcher=class{batch(t,r){const s=[],i={},n=[];for(let e=0;e<t.length;e++){const r=t[e],o=r.geometry.getAttribute("position").count;for(let t=0;t<o;t++)n.push(e);s.push(r.geometry),void 0===i[r.name]?i[r.name]=e:console.error("Mesh name is duplicated when trying to merge meshes. Non-unique id error.",r.name,i)}const o=l.mergeGeometries(s),a=new e.BufferAttribute(new Float32Array(n),1);return o.setAttribute("mesh_id",a),this.create_batched_mesh(i,o,r,2048)}create_batched_mesh(e,t,r,s){return new _t(e,t,r,s)}},exports.MeshSampler=Ve,exports.ModelUtilities=Pe,exports.NormalAORender=class extends V{constructor(){super(),this.ssao_mat=new me,this.ssao_compose_mat=new ge,this.debug_normals=new fe,this.ssaa=I.use_ssaa?2:1,this.main_RT=new e.WebGLRenderTarget(H.width*this.ssaa,H.height*this.ssaa),this.SSAO_RT=new e.WebGLRenderTarget(H.width,H.height),this.blurrer=new xe,se.generateDepthNormalTexture=!0}render(){this.__check_RT_size(),se.clear(this.main_RT,O.current,!0,!1),se.render(Y.current,O.current,this.main_RT),this.__update_uniforms(),se.blit(se.depth_normals_RT,this.SSAO_RT,this.ssao_mat),this.blurrer.blur(this.SSAO_RT),se.blit(this.SSAO_RT,void 0),this.ssao_compose_mat.uniforms._AO.value=this.SSAO_RT.texture,se.blit(this.main_RT,void 0,this.ssao_compose_mat)}__update_uniforms(){this.ssao_mat.uniforms._InverseProjMatrix.value.getInverse(O.current.projectionMatrix),this.ssao_mat.uniforms._ProjectionMatrix.value.copy(O.current.projectionMatrix),this.ssao_mat.uniforms._FarPlane.value=O.current.far}__check_RT_size(){this.main_RT.width===H.width*this.ssaa&&this.main_RT.height===H.height*this.ssaa||(this.main_RT.setSize(H.width*this.ssaa,H.height*this.ssaa),this.SSAO_RT.setSize(H.width,H.height))}},exports.NormalRender=class extends V{constructor(){super()}render(){se.clear(void 0,O.current,!0,!0),Y.current.on_pre_render&&Y.current.on_pre_render(),Y.current.render?Y.current.render():se.render(Y.current,O.current),Y.current.on_post_render&&Y.current.on_post_render()}},exports.NumberInterpolator=f,exports.OBJLoader=class extends u{constructor(e,t,r){super(e,t,r),this.loader=new o.OBJLoader}on_preloaded_finished(e){void 0===e.resources_by_url[this.url]?this.loader.load(this.url,(t=>{e.set_resource(this.resource_id,this.url,t),this.__update_downloaded_bytes(1,1),this.__loading_ended()}),(e=>{}),(e=>{this.__set_error(e+"\n\n\t If the error says something about unexpected token < in JSON then probably the problem is related to the file not being found. Check the name and path of the resource"),this.__loading_ended()})):(e.set_resource(this.resource_id,this.url,e.resources_by_url[this.url]),this.__update_downloaded_bytes(1,1),this.__loading_ended())}},exports.OMath=d,exports.OS=ne,exports.OScreen=H,exports.ObjectUtilities=Le,exports.OrthographicCamera=Te,exports.OrthographicFrustumPointFitter=ce,exports.ParticleAttribute=et,exports.ParticlePositionAttribute=class extends et{constructor(e){super("_Position",e)}store_geometry(e,t){const r=e.getAttribute("position");this.read=this.build_RT(r.count),this.write=this.build_RT(r.count);const s=new rt;this.store_geometry_attribute_in_RT(e.getAttribute("position"),this.read,s,t)}store_positions(t,r){this.read=this.build_RT(t.length),this.write=this.build_RT(t.length);const s=new Float32Array(4*t.length);for(let e=0;e<t.length;e++)s[4*e+0]=t[e].x,s[4*e+1]=t[e].y,s[4*e+2]=t[e].z,s[4*e+3]=10*(2*Math.random()-1);const i=new rt;this.store_geometry_attribute_in_RT(new e.BufferAttribute(s,4),this.read,i,r)}},exports.PerspectiveCamera=Z,exports.PerspectiveFrustumPointFitter=he,exports.PointArrayLoader=class extends u{constructor(t,r,s){super(t,r,s),this.loader=new e.FileLoader}on_preloaded_finished(e){void 0===e.resources_by_url[this.url]?this.loader.load(this.url,(t=>{e.set_resource(this.resource_id,this.url,this.parse_path(t)),this.__update_downloaded_bytes(1,1),this.__loading_ended()}),(e=>{}),(e=>{this.__set_error(e),this.__loading_ended()})):(e.set_resource(this.resource_id,this.url,e.resources_by_url[this.url]),this.__update_downloaded_bytes(1,1),this.__loading_ended())}parse_path(t){const r=t.split("\n");""===r[r.length-1]&&r.pop();const s=[];for(let t=0;t<r.length;t+=3){const i=parseFloat(r[t+0]),n=parseFloat(r[t+1]),o=parseFloat(r[t+2]);s.push(new e.Vector3(i,n,o))}return s}},exports.RGBETextureLoader=class extends u{constructor(e,t,r){super(e,t,r),this.loader=new a.RGBELoader}on_preloaded_finished(e){void 0===e.resources_by_url[this.url]?this.loader.load(this.url,(t=>{e.set_resource(this.resource_id,this.url,t),this.__update_downloaded_bytes(1,1),this.__loading_ended()}),(e=>{}),(e=>{this.__set_error(e+"\n\n\t If the error says something about unexpected token < in JSON then the probably the problem is related to the file not being found. Check the name and path of the resource"),this.__loading_ended()})):(e.set_resource(this.resource_id,this.url,e.resources_by_url[this.url]),this.__update_downloaded_bytes(1,1),this.__loading_ended())}},exports.RenderLoop=class{constructor(e,t,r){e=e||new C,this.target_application=e,this.graphics=t,this.input=r,this.is_running=!1,this.frames_passed=0,this.time_accumulator=0}update(){if(this.is_running){for(F.__update(),1===this.frames_passed&&this.target_application.on_post_start(),this.input.update(),this.time_accumulator+=F.delta_time,this.target_application.before_update(),R.before_update();this.time_accumulator>F.fixed_delta_time;)this.target_application.fixed_update(),R.fixed_update(),this.time_accumulator-=F.fixed_delta_time;F.__set_frame_interpolation(this.time_accumulator/F.fixed_delta_time),this.target_application.update(),R.update(),Me.update(),this.target_application.on_pre_render(),this.graphics.update(),le.update(),le.render(this.graphics),this.target_application.on_post_render(),J.render(this.graphics),this.target_application.on_frame_end(),this.frames_passed++,this.input.clear(),le.clear(),J.clear()}}start(){this.is_running||(0===this.frames_passed&&this.target_application.on_enter(),this.is_running=!0,this.graphics._renderer.setAnimationLoop(this.update.bind(this)))}stop(){!1!==this.is_running&&(this.is_running=!1,this.target_application.on_exit(),this.graphics._renderer.setAnimationLoop(null))}set_state(e){this.target_application.on_exit(this),this.target_application=e,this.target_application.on_enter(this)}dispose(){this.stop(),this.frames_passed=0}},exports.ResourceBatch=class{constructor(e){this.resource_loaders=[],this.batch_name=e||"unnamed batch"}add_loader(e){this.resource_loaders.push(e)}load(e){for(let t=0;t<this.resource_loaders.length;t++)this.resource_loaders[t].load(e||T)}get loading_finished(){let e=!0;for(let t=0;t<this.resource_loaders.length;t++)e=e&&this.resource_loaders[t].has_finished;return e}get has_errors(){let e=!1;for(let t=0;t<this.resource_loaders.length;t++)e=e||this.resource_loaders[t].has_error;return e}print_errors(){console.error("Batch <"+this.batch_name+"> could not load successfully");for(let e=0;e<this.resource_loaders.length;e++)this.resource_loaders[e].has_error&&this.resource_loaders[e].print_error()}get_progress(){return this.get_loaded_bytes()/this.get_total_bytes()}get_loaded_bytes(){let e=1;for(let t=0;t<this.resource_loaders.length;t++)e+=this.resource_loaders[t].loaded_bytes;return e}get_total_bytes(){let e=1;for(let t=0;t<this.resource_loaders.length;t++)e+=this.resource_loaders[t].total_bytes;return e}},exports.ResourceContainer=T,exports.SDFTextBatch=$e,exports.SceneManager=Y,exports.Screen=Se,exports.SimpleTextDrawer=Fe,exports.Sphere=Q,exports.StringUtilities=class{constructor(){}static get_random_color(){const e=[0,1,2,3,4,5,6,7,8,9,"A","B","C","D","E","F"];let t="#";for(let r=0;r<6;r++){t+=e[Math.floor(Math.random()*e.length)]}return t}static capitalize(e){const t=e.split(" ");for(let e=0;e<t.length;e++)t[e]=t[e][0].toUpperCase()+t[e].substr(1);return t.join(" ")}static capitalize_first_letter(e){return e.charAt(0).toUpperCase()+e.slice(1)}static snake_to_camelcase(e){return e.toLowerCase().replace(/[-_][a-z0-9]/g,(e=>e.slice(-1).toUpperCase()))}},exports.Text2D=class extends Be{constructor(t,r,s,i,n){const o=new Fe(n),a={font:r,font_color:s||"#000000"},_=o.draw_on_texture(t,a);_.minFilter=e.LinearMipMapLinearFilter,_.minFilter=e.LinearFilter,_.needsUpdate=!0,super(_,i),this.simple_text_drawer=o,this.canvas_texture=_,this.draw_settings=a}set text(e){this.simple_text_drawer.draw_canvas(e,this.draw_settings),this.update_texture()}get text(){return"not implemented"}},exports.TextLoader=class extends u{constructor(t,r,s){super(t,r,s),this.loader=new e.FileLoader}on_preloaded_finished(e){void 0===e.resources_by_url[this.url]?this.loader.load(this.url,(t=>{e.set_resource(this.resource_id,this.url,t),this.__update_downloaded_bytes(1,1),this.__loading_ended()}),(e=>{}),(e=>{this.__set_error(e),this.__loading_ended()})):(e.set_resource(this.resource_id,this.url,e.resources_by_url[this.url]),this.__update_downloaded_bytes(1,1),this.__loading_ended())}},exports.TextureLoader=class extends u{constructor(e,t,r){super(e,t,r)}on_preloaded_finished(t,r){void 0===t.resources_by_url[this.url]?r.blob().then((r=>{const s=new e.Texture,i=URL.createObjectURL(r),n=new Image;n.src=i,n.onload=()=>{s.image=n,s.needsUpdate=!0,t.set_resource(this.resource_id,this.url,s),this.__update_downloaded_bytes(1,1),this.__loading_ended()},n.onerror=()=>{console.error("Error loading texture. Maybe the resource is not an image?",this.url)}})):(t.set_resource(this.resource_id,this.url,t.resources_by_url[this.url]),this.__update_downloaded_bytes(1,1),this.__loading_ended())}},exports.Time=F,exports.TimeUtilities=class{constructor(){}time_str_to_ms(e){e=e.split(":");let t=Number(e[0]);t=60*t*60*1e3;let r=Number(e[1]);r=60*r*1e3;let s=Number(e[2]);return s*=1e3,t+r+s}},exports.TransitionTable=S,exports.UI=le,exports.UIElement=Ye,exports.UnrealBloomComposeMaterial=U,exports.UnrealBloomRender=class extends V{constructor(){super(),this.bloom_compose_mat=void 0,this.main_RT=void 0,this.blur_RT=void 0,this.blurrer=void 0,this.add_mat=new B}on_enter(){this.blurrer=new ye,this.main_RT=new e.WebGLRenderTarget(H.width,H.height),this.blur_RT=new e.WebGLRenderTarget(H.width,H.height),this.bloom_compose_mat=new U(5),this.blurrer=new ye(5),this.bloom_compose_mat.set_RT_0(this.blurrer.renderTargetsVertical[0].texture),this.bloom_compose_mat.set_RT_1(this.blurrer.renderTargetsVertical[1].texture),this.bloom_compose_mat.set_RT_2(this.blurrer.renderTargetsVertical[2].texture),this.bloom_compose_mat.set_RT_3(this.blurrer.renderTargetsVertical[3].texture),this.bloom_compose_mat.set_RT_4(this.blurrer.renderTargetsVertical[4].texture),this.bloom_compose_mat.set_bloom_strength(1),this.bloom_compose_mat.set_bloom_radius(1),this.add_mat.set_add_texture(this.blurrer.renderTargetsHorizontal[0].texture)}set_bloom_strength(e){this.bloom_compose_mat.set_bloom_strength(e)}set_bloom_radius(e){this.bloom_compose_mat.set_bloom_radius(e)}set_tint_color_0(e){this.bloom_compose_mat.set_tint_color_0(e)}set_tint_color_1(e){this.bloom_compose_mat.set_tint_color_1(e)}set_tint_color_2(e){this.bloom_compose_mat.set_tint_color_2(e)}set_tint_color_3(e){this.bloom_compose_mat.set_tint_color_3(e)}set_tint_color_4(e){this.bloom_compose_mat.set_tint_color_4(e)}render(){this.__check_RT_size(),se.clear(this.main_RT,O.current,!0,!1),se.render(Y.current,O.current,this.main_RT),this.blurrer.blur(this.main_RT,!0),se.material_pass(this.bloom_compose_mat,this.blurrer.renderTargetsHorizontal[0]),se.blit(this.main_RT,void 0,this.add_mat)}__check_RT_size(){this.main_RT.width===H.width&&this.main_RT.height===H.height||(this.main_RT.setSize(H.width,H.height),this.blur_RT.setSize(H.width,H.height))}},exports.UpdatableMaterialMesh=Ee,exports.VRRender=class extends V{constructor(){super()}render(){Y.current.on_pre_render&&Y.current.on_pre_render(),Y.current.render?Y.current.render():se.render(Y.current,O.current,se._renderer.getRenderTarget()),this.render_spectator_camera(),Y.current.on_post_render&&Y.current.on_post_render()}render_spectator_camera(){const e=O.spectator;if(e&&se._renderer.xr.isPresenting){const t=se._renderer.xr.getCamera(O.current);e.projectionMatrix.copy(O.current.projectionMatrix),e.position.copy(t.position),e.quaternion.copy(t.quaternion);const r=se._renderer.getRenderTarget();se._renderer.xr.isPresenting=!1,se._renderer.setRenderTarget(null),se._renderer.render(Y.current,e),se._renderer.setRenderTarget(r),se._renderer.xr.isPresenting=!0}}},exports.Validation=c,exports.VectorInterpolator=class extends g{constructor(e,t=0,r=1,s="linear"){super(s),this.attribute_name=e,this.from=t,this.to=r}update(e,t){const r=this.from.clone();r.lerp(this.to,this.easing_function(t)),e[this.attribute_name].copy(r)}},exports.VerticalPlane=Ae,exports.VideoLoader=class extends u{constructor(e,t,r){super(e,t,r)}on_preloaded_finished(e,t){void 0===e.resources_by_url[this.url]?t.blob().then((t=>{e.set_resource(this.resource_id,this.url,URL.createObjectURL(t)),this.__update_downloaded_bytes(1,1),this.__loading_ended()})):(e.set_resource(this.resource_id,this.url,e.resources_by_url[this.url]),this.__update_downloaded_bytes(1,1),this.__loading_ended())}},exports.ViewComponent=class{constructor({name:e,container:t}){this.name=e,this.container=t,this.hidden=!0,Me.register_component(this)}start(){}on_enter(){this.container.classList.remove("hidden"),Me.enable_component(this),this.hidden=!1}update(){}on_exit(){this.container.classList.add("hidden"),Me.disable_component(this),this.hidden=!0}set_opacity(e){this.container.style.opacity=e[`${this.name}_opacity`],this.toggle_hidden()}toggle_hidden(){this.container.style.opacity>.001?this.hidden&&this.on_enter():this.hidden||this.on_exit()}load_html_images(){M.load_images(this.container)}load_html_videos(){M.load_videos(this.container)}},exports.ViewComponentManager=Me,exports.ViewContext=v,exports.ViewManager=R,exports.WorldImage=Be;
|
|
2
|
+
//# sourceMappingURL=index.js.map
|