":(typeof e=="number"||typeof n=="number")&&(s=e>n);break;case">=":(typeof e=="number"||typeof n=="number")&&(s=e>=n);break;case"/":s=String(e).startsWith(String(n));break}return s};var afe=Object.defineProperty,ofe=Object.getOwnPropertyDescriptor,jle=(e,t,n,s)=>{for(var l=ofe(t,n),r=e.length-1,i;r>=0;r--)(i=e[r])&&(l=i(t,n,l)||l);return l&&afe(t,n,l),l},qh;const AJ=(qh=class extends fr{constructor(){super(...arguments),this._previousContainer=null,this._visible=!1}get placement(){return this._placement}set placement(e){this._placement=e,this.updatePosition()}static removeMenus(){for(const e of qh.menus)e instanceof qh&&(e.visible=!1);setTimeout(()=>{qh.dialog.close(),qh.dialog.remove()},310)}get visible(){return this._visible}set visible(e){this._visible=e,e?(qh.dialog.parentElement||document.body.append(qh.dialog),this._previousContainer=this.parentElement,qh.dialog.style.top=`${window.scrollY||document.documentElement.scrollTop}px`,this.style.setProperty("display","flex"),qh.dialog.append(this),qh.dialog.showModal(),this.updatePosition(),this.dispatchEvent(new Event("visible"))):setTimeout(()=>{var t;(t=this._previousContainer)==null||t.append(this),this._previousContainer=null,this.style.setProperty("display","none"),this.dispatchEvent(new Event("hidden"))},310)}async updatePosition(){if(!(this.visible&&this._previousContainer))return;const e=this.placement??"right",t=await cle(this._previousContainer,this,{placement:e,middleware:[$se(10),ule(),ole(),ale({padding:5})]}),{x:n,y:s}=t;this.style.left=`${n}px`,this.style.top=`${s}px`}connectedCallback(){super.connectedCallback(),qh.menus.push(this),this.visible?(this.style.setProperty("width","auto"),this.style.setProperty("height","auto")):(this.style.setProperty("width","0"),this.style.setProperty("height","0"))}render(){return ls` `}},qh.styles=[gO.scrollbar,Lr`
+ :host {
+ pointer-events: auto;
+ position: absolute;
+ top: 0;
+ left: 0;
+ z-index: 999;
+ overflow: auto;
+ max-height: 20rem;
+ min-width: 3rem;
+ flex-direction: column;
+ box-shadow: 1px 2px 8px 2px rgba(0, 0, 0, 0.15);
+ padding: 0.5rem;
+ border-radius: var(--bim-ui_size-4xs);
+ display: flex;
+ transform-origin: top left;
+ transform: scale(1);
+ clip-path: circle(150% at top left);
+ background-color: var(
+ --bim-context-menu--bgc,
+ var(--bim-ui_bg-contrast-20)
+ );
+ transition:
+ clip-path 0.2s cubic-bezier(0.72, 0.1, 0.43, 0.93),
+ transform 0.3s cubic-bezier(0.72, 0.1, 0.45, 2.35);
+ }
+
+ :host(:not([visible])) {
+ transform: scale(0.8);
+ clip-path: circle(0 at top left);
+ }
+ `],qh.dialog=Ej.create(()=>ls` {e.target===qh.dialog&&qh.removeMenus()}}
+ @cancel=${()=>qh.removeMenus()}
+ data-context-dialog
+ style="
+ width: 0;
+ height: 0;
+ position: relative;
+ padding: 0;
+ border: none;
+ outline: none;
+ margin: none;
+ overflow: visible;
+ background-color: transparent;
+ "
+ > `),qh.menus=[],qh);jle([un({type:String,reflect:!0})],AJ.prototype,"placement");jle([un({type:Boolean,reflect:!0})],AJ.prototype,"visible");let mQ=AJ;var ufe=Object.defineProperty,cfe=Object.getOwnPropertyDescriptor,t5=(e,t,n,s)=>{for(var l=s>1?void 0:s?cfe(t,n):t,r=e.length-1,i;r>=0;r--)(i=e[r])&&(l=(s?i(t,n,l):i(l))||l);return s&&l&&ufe(t,n,l),l},dG;const _w=(dG=class extends fr{constructor(){super(),this.labelHidden=!1,this.active=!1,this.disabled=!1,this.vertical=!1,this.tooltipVisible=!1,this._stateBeforeLoading={disabled:!1,icon:""},this._loading=!1,this._parent=PF(),this._tooltip=PF(),this._mouseLeave=!1,this.onClick=e=>{e.stopPropagation(),this.disabled||this.dispatchEvent(new Event("click"))},this.showContextMenu=()=>{const e=this._contextMenu;if(e){const t=this.getAttribute("data-context-group");t&&e.setAttribute("data-context-group",t),this.closeNestedContexts();const n=Wle.newRandomId();for(const s of e.children)s instanceof dG&&s.setAttribute("data-context-group",n);e.visible=!0}},this.mouseLeave=!0}set loading(e){if(this._loading=e,e)this._stateBeforeLoading={disabled:this.disabled,icon:this.icon},this.disabled=e,this.icon="eos-icons:loading";else{const{disabled:t,icon:n}=this._stateBeforeLoading;this.disabled=t,this.icon=n}}get loading(){return this._loading}set mouseLeave(e){this._mouseLeave=e,e&&(this.tooltipVisible=!1,clearTimeout(this.timeoutID))}get mouseLeave(){return this._mouseLeave}computeTooltipPosition(){const{value:e}=this._parent,{value:t}=this._tooltip;e&&t&&cle(e,t,{placement:"bottom",middleware:[$se(10),ule(),ole(),ale({padding:5})]}).then(n=>{const{x:s,y:l}=n;Object.assign(t.style,{left:`${s}px`,top:`${l}px`})})}onMouseEnter(){if(!(this.tooltipTitle||this.tooltipText))return;this.mouseLeave=!1;const e=this.tooltipTime??700;this.timeoutID=setTimeout(()=>{this.mouseLeave||(this.computeTooltipPosition(),this.tooltipVisible=!0)},e)}closeNestedContexts(){const e=this.getAttribute("data-context-group");if(e)for(const t of mQ.dialog.children){const n=t.getAttribute("data-context-group");if(t instanceof mQ&&n===e){t.visible=!1,t.removeAttribute("data-context-group");for(const s of t.children)s instanceof dG&&(s.closeNestedContexts(),s.removeAttribute("data-context-group"))}}}click(){this.disabled||super.click()}get _contextMenu(){return this.querySelector("bim-context-menu")}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.showContextMenu)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this.showContextMenu)}render(){const e=ls`
+
+ `,t=ls`
+
+
+ `;return ls`
+
+ ${this.label||this.icon?ls`
+
this.mouseLeave=!0}
+ >
+ ${this.label}${this.label&&this._contextMenu?t:null}
+
+ `:null}
+ ${this.tooltipTitle||this.tooltipText?e:null}
+
+
+ `}},dG.styles=Lr`
+ :host {
+ --bim-label--c: var(--bim-ui_bg-contrast-100, white);
+ position: relative;
+ display: block;
+ flex: 1;
+ pointer-events: none;
+ background-color: var(--bim-button--bgc, var(--bim-ui_bg-contrast-20));
+ border-radius: var(--bim-ui_size-4xs);
+ transition: all 0.15s;
+ }
+
+ :host(:not([disabled]))::before {
+ content: "";
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ border-radius: inherit;
+ background-color: var(--bim-ui_main-base);
+ clip-path: circle(0 at center center);
+ box-sizing: border-box;
+ transition:
+ clip-path 0.3s cubic-bezier(0.65, 0.05, 0.36, 1),
+ transform 0.15s;
+ }
+
+ :host(:not([disabled]):hover) {
+ cursor: pointer;
+ }
+
+ bim-label {
+ pointer-events: none;
+ }
+
+ .parent {
+ --bim-icon--c: var(--bim-label--c);
+ position: relative;
+ display: flex;
+ height: 100%;
+ user-select: none;
+ row-gap: 0.125rem;
+ min-height: var(--bim-ui_size-5xl);
+ min-width: var(--bim-ui_size-5xl);
+ }
+
+ .button,
+ .children {
+ box-sizing: border-box;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ pointer-events: auto;
+ }
+
+ .children {
+ padding: 0 0.375rem;
+ position: absolute;
+ height: 100%;
+ right: 0;
+ }
+
+ :host(:not([label-hidden])[icon][vertical]) .parent {
+ min-height: 2.5rem;
+ }
+
+ .button {
+ flex-grow: 1;
+ transition: transform 0.15s;
+ }
+
+ :host(:not([label-hidden])[label]) .button {
+ justify-content: var(--bim-button--jc, center);
+ }
+
+ :host(:hover)::before {
+ clip-path: circle(120% at center center);
+ }
+
+ :host(:hover) {
+ --bim-label--c: var(--bim-ui_main-contrast);
+ z-index: 2;
+ }
+
+ :host([active]) {
+ background-color: var(--bim-ui_main-base);
+ }
+
+ :host(:not([disabled]):active) {
+ background: transparent;
+ }
+
+ :host(:not([disabled]):active) .button,
+ :host(:not([disabled]):active)::before {
+ transform: scale(0.98);
+ }
+
+ :host(:not([label]):not([icon])) .children {
+ flex: 1;
+ }
+
+ :host([vertical]) .parent {
+ justify-content: center;
+ }
+
+ :host(:not([label-hidden])[label]) .button {
+ padding: 0 0.5rem;
+ }
+
+ :host([disabled]) {
+ --bim-label--c: var(--bim-ui_bg-contrast-80) !important;
+ background-color: gray !important;
+ }
+
+ ::slotted(bim-button) {
+ --bim-icon--fz: var(--bim-ui_size-base);
+ --bim-button--bdrs: var(--bim-ui_size-4xs);
+ --bim-button--olw: 0;
+ --bim-button--olc: transparent;
+ }
+
+ .tooltip {
+ position: absolute;
+ padding: 0.75rem;
+ z-index: 99;
+ display: flex;
+ flex-flow: column;
+ row-gap: 0.375rem;
+ box-shadow: 0 0 10px 3px rgba(0 0 0 / 20%);
+ outline: 1px solid var(--bim-ui_bg-contrast-40);
+ font-size: var(--bim-ui_size-xs);
+ border-radius: var(--bim-ui_size-4xs);
+ background-color: var(--bim-ui_bg-contrast-20);
+ color: var(--bim-ui_bg-contrast-100);
+ animation: openTooltips 0.15s ease-out forwards;
+ transition: visibility 0.2s;
+ }
+
+ .tooltip p {
+ margin: 0;
+ padding: 0;
+ }
+
+ :host(:not([tooltip-visible])) .tooltip {
+ animation: closeTooltips 0.15s ease-in forwards;
+ visibility: hidden;
+ display: none;
+ }
+
+ @keyframes closeTooltips {
+ 0% {
+ display: flex;
+ padding: 0.75rem;
+ transform: translateY(0);
+ opacity: 1;
+ }
+ 90% {
+ padding: 0.75rem;
+ }
+ 100% {
+ display: none;
+ padding: 0;
+ transform: translateY(-10px);
+ opacity: 0;
+ }
+ }
+
+ @keyframes openTooltips {
+ 0% {
+ display: flex;
+ transform: translateY(-10px);
+ opacity: 0;
+ }
+ 100% {
+ transform: translateY(0);
+ opacity: 1;
+ }
+ }
+ `,dG);t5([un({type:String,reflect:!0})],_w.prototype,"label",2);t5([un({type:Boolean,attribute:"label-hidden",reflect:!0})],_w.prototype,"labelHidden",2);t5([un({type:Boolean,reflect:!0})],_w.prototype,"active",2);t5([un({type:Boolean,reflect:!0,attribute:"disabled"})],_w.prototype,"disabled",2);t5([un({type:String,reflect:!0})],_w.prototype,"icon",2);t5([un({type:Boolean,reflect:!0})],_w.prototype,"vertical",2);t5([un({type:Number,attribute:"tooltip-time",reflect:!0})],_w.prototype,"tooltipTime",2);t5([un({type:Boolean,attribute:"tooltip-visible",reflect:!0})],_w.prototype,"tooltipVisible",2);t5([un({type:String,attribute:"tooltip-title",reflect:!0})],_w.prototype,"tooltipTitle",2);t5([un({type:String,attribute:"tooltip-text",reflect:!0})],_w.prototype,"tooltipText",2);t5([un({type:Boolean,reflect:!0})],_w.prototype,"loading",1);let hfe=_w;var ffe=Object.defineProperty,kz=(e,t,n,s)=>{for(var l=void 0,r=e.length-1,i;r>=0;r--)(i=e[r])&&(l=i(t,n,l)||l);return l&&ffe(t,n,l),l};const qle=class extends fr{constructor(){super(...arguments),this.checked=!1,this.inverted=!1,this.onValueChange=new Event("change")}get value(){return this.checked}onChange(t){t.stopPropagation(),this.checked=t.target.checked,this.dispatchEvent(this.onValueChange)}render(){const t=ls`
+
+
+
+ `;return ls`
+
+
+ ${this.label?ls`${this.label} `:null}
+
+
+ ${t}
+
+
+
+ `}};qle.styles=Lr`
+ :host {
+ display: block;
+ }
+
+ .parent-label {
+ --background: #fff;
+ --border: #dfdfe6;
+ --stroke: #fff;
+ --border-hover: var(--bim-ui_main-base);
+ --border-active: var(--bim-ui_main-base);
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ cursor: pointer;
+ width: 100%;
+ height: 1.75rem;
+ column-gap: 0.25rem;
+ position: relative;
+ cursor: pointer;
+ user-select: none;
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ }
+
+ :host([inverted]) .parent-label {
+ flex-direction: row-reverse;
+ justify-content: start;
+ }
+
+ input,
+ svg {
+ width: 1rem;
+ height: 1rem;
+ display: block;
+ }
+
+ input {
+ -webkit-appearance: none;
+ -moz-appearance: none;
+ position: relative;
+ outline: none;
+ background: var(--background);
+ border: none;
+ margin: 0;
+ padding: 0;
+ cursor: pointer;
+ border-radius: 4px;
+ transition: box-shadow 0.3s;
+ box-shadow: inset 0 0 0 var(--s, 1px) var(--b, var(--border));
+ }
+
+ svg {
+ pointer-events: none;
+ fill: none;
+ stroke-width: 2.2px;
+ stroke-linecap: round;
+ stroke-linejoin: round;
+ stroke: var(--stroke, var(--border-active));
+ transform: translateY(-100%) scale(0);
+ position: absolute;
+ width: 1rem;
+ height: 1rem;
+ }
+
+ input:hover {
+ --s: 2px;
+ --b: var(--border-hover);
+ }
+
+ input:checked {
+ --b: var(--border-active);
+ --s: 11px;
+ }
+
+ input:checked + svg {
+ -webkit-animation: bounce 0.4s linear forwards 0.2s;
+ animation: bounce 0.4s linear forwards 0.2s;
+ }
+
+ @keyframes bounce {
+ 0% {
+ transform: translateY(-100%) scale(0);
+ }
+ 50% {
+ transform: translateY(-100%) scale(1.2);
+ }
+ 75% {
+ transform: translateY(-100%) scale(0.9);
+ }
+ 100% {
+ transform: translateY(-100%) scale(1);
+ }
+ }
+ `;let JF=qle;kz([un({type:String,reflect:!0})],JF.prototype,"icon");kz([un({type:String,reflect:!0})],JF.prototype,"name");kz([un({type:String,reflect:!0})],JF.prototype,"label");kz([un({type:Boolean,reflect:!0})],JF.prototype,"checked");kz([un({type:Boolean,reflect:!0})],JF.prototype,"inverted");var dfe=Object.defineProperty,XF=(e,t,n,s)=>{for(var l=void 0,r=e.length-1,i;r>=0;r--)(i=e[r])&&(l=i(t,n,l)||l);return l&&dfe(t,n,l),l};const Zle=class extends fr{constructor(){super(...arguments),this.vertical=!1,this.color="#bcf124",this._colorInput=PF(),this._textInput=PF(),this.onValueChange=new Event("input"),this.onOpacityInput=t=>{const n=t.target;this.opacity=n.value,this.dispatchEvent(this.onValueChange)}}set value(t){const{color:n,opacity:s}=t;this.color=n,s&&(this.opacity=s)}get value(){const t={color:this.color};return this.opacity&&(t.opacity=this.opacity),t}onColorInput(t){t.stopPropagation();const{value:n}=this._colorInput;n&&(this.color=n.value,this.dispatchEvent(this.onValueChange))}onTextInput(t){t.stopPropagation();const{value:n}=this._textInput;if(!n)return;const{value:s}=n;let l=s.replace(/[^a-fA-F0-9]/g,"");l.startsWith("#")||(l=`#${l}`),n.value=l.slice(0,7),n.value.length===7&&(this.color=n.value,this.dispatchEvent(this.onValueChange))}focus(){const{value:t}=this._colorInput;t&&t.click()}render(){return ls`
+
+
+
+
+ ${this.opacity!==void 0?ls`
`:null}
+
+
+
+ `}};Zle.styles=Lr`
+ :host {
+ --bim-input--bgc: var(--bim-ui_bg-contrast-20);
+ flex: 1;
+ display: block;
+ }
+
+ :host(:focus) {
+ --bim-input--olw: var(--bim-number-input--olw, 2px);
+ --bim-input--olc: var(--bim-ui_accent-base);
+ }
+
+ .parent {
+ display: flex;
+ gap: 0.375rem;
+ }
+
+ .color-container {
+ position: relative;
+ outline: none;
+ display: flex;
+ height: 100%;
+ gap: 0.5rem;
+ justify-content: flex-start;
+ align-items: center;
+ flex: 1;
+ border-radius: var(--bim-color-input--bdrs, var(--bim-ui_size-4xs));
+ }
+
+ .color-container input[type="color"] {
+ position: absolute;
+ bottom: -0.25rem;
+ visibility: hidden;
+ width: 0;
+ height: 0;
+ }
+
+ .color-container .sample {
+ width: 1rem;
+ height: 1rem;
+ border-radius: 0.125rem;
+ background-color: #fff;
+ }
+
+ .color-container input[type="text"] {
+ height: 100%;
+ flex: 1;
+ width: 3.25rem;
+ text-transform: uppercase;
+ font-size: 0.75rem;
+ background-color: transparent;
+ padding: 0%;
+ outline: none;
+ border: none;
+ color: var(--bim-color-input--c, var(--bim-ui_bg-contrast-100));
+ }
+
+ bim-number-input {
+ flex-grow: 0;
+ }
+ `;let S8=Zle;XF([un({type:String,reflect:!0})],S8.prototype,"name");XF([un({type:String,reflect:!0})],S8.prototype,"label");XF([un({type:String,reflect:!0})],S8.prototype,"icon");XF([un({type:Boolean,reflect:!0})],S8.prototype,"vertical");XF([un({type:Number,reflect:!0})],S8.prototype,"opacity");XF([un({type:String,reflect:!0})],S8.prototype,"color");var Ife=Object.defineProperty,pfe=Object.getOwnPropertyDescriptor,AO=(e,t,n,s)=>{for(var l=s>1?void 0:s?pfe(t,n):t,r=e.length-1,i;r>=0;r--)(i=e[r])&&(l=(s?i(t,n,l):i(l))||l);return s&&l&&Ife(t,n,l),l};const Kle=class extends fr{constructor(){super(...arguments),this.checked=!1,this.checkbox=!1,this.noMark=!1,this.vertical=!1}get value(){return this._value!==void 0?this._value:this.label?Vj(this.label):this.label}set value(t){this._value=t}render(){return ls`
+
+ ${this.img||this.icon||this.label?ls`
+ ${this.checkbox&&!this.noMark?ls` `:null}
+ ${this.label}
+
`:null}
+ ${!this.checkbox&&!this.noMark&&this.checked?ls`
+
+
+ `:null}
+
+
+ `}};Kle.styles=Lr`
+ :host {
+ --bim-label--c: var(--bim-ui_bg-contrast-100);
+ display: block;
+ box-sizing: border-box;
+ flex: 1;
+ padding: 0rem 0.5rem;
+ border-radius: var(--bim-ui_size-4xs);
+ transition: all 0.15s;
+ }
+
+ :host(:hover) {
+ cursor: pointer;
+ }
+
+ :host([checked]) {
+ --bim-label--c: color-mix(in lab, var(--bim-ui_main-base), white 30%);
+ }
+
+ :host([checked]) svg {
+ fill: color-mix(in lab, var(--bim-ui_main-base), white 30%);
+ }
+
+ .parent {
+ box-sizing: border-box;
+ display: flex;
+ justify-content: var(--bim-option--jc, space-between);
+ column-gap: 0.5rem;
+ align-items: center;
+ min-height: 1.75rem;
+ height: 100%;
+ }
+
+ input {
+ height: 1rem;
+ width: 1rem;
+ cursor: pointer;
+ border: none;
+ outline: none;
+ accent-color: var(--bim-checkbox--c, var(--bim-ui_main-base));
+ }
+
+ input:focus {
+ outline: var(--bim-checkbox--olw, 2px) solid
+ var(--bim-checkbox--olc, var(--bim-ui_accent-base));
+ }
+
+ bim-label {
+ pointer-events: none;
+ z-index: 1;
+ }
+ `;let $h=Kle;AO([un({type:String,reflect:!0})],$h.prototype,"img",2);AO([un({type:String,reflect:!0})],$h.prototype,"label",2);AO([un({type:String,reflect:!0})],$h.prototype,"icon",2);AO([un({type:Boolean,reflect:!0})],$h.prototype,"checked",2);AO([un({type:Boolean,reflect:!0})],$h.prototype,"checkbox",2);AO([un({type:Boolean,attribute:"no-mark",reflect:!0})],$h.prototype,"noMark",2);AO([un({converter:{fromAttribute(e){return e&&Vj(e)}}})],$h.prototype,"value",1);AO([un({type:Boolean,reflect:!0})],$h.prototype,"vertical",2);var Efe=Object.defineProperty,yfe=Object.getOwnPropertyDescriptor,SO=(e,t,n,s)=>{for(var l=s>1?void 0:s?yfe(t,n):t,r=e.length-1,i;r>=0;r--)(i=e[r])&&(l=(s?i(t,n,l):i(l))||l);return s&&l&&Efe(t,n,l),l};const Qle=class extends Ej{constructor(){super(),this.multiple=!1,this.required=!1,this.vertical=!1,this._visible=!1,this._value=new Set,this.onValueChange=new Event("change"),this._contextMenu=PF(),this.onOptionClick=t=>{const n=t.target,s=this._value.has(n);if(!this.multiple&&!this.required&&!s)this._value=new Set([n]);else if(!this.multiple&&!this.required&&s)this._value=new Set([]);else if(!this.multiple&&this.required&&!s)this._value=new Set([n]);else if(this.multiple&&!this.required&&!s)this._value=new Set([...this._value,n]);else if(this.multiple&&!this.required&&s){const l=[...this._value].filter(r=>r!==n);this._value=new Set(l)}else if(this.multiple&&this.required&&!s)this._value=new Set([...this._value,n]);else if(this.multiple&&this.required&&s){const l=[...this._value].filter(i=>i!==n),r=new Set(l);r.size!==0&&(this._value=r)}this.updateOptionsState(),this.dispatchEvent(this.onValueChange)},this.useObserver=!0}set visible(t){if(t){const{value:n}=this._contextMenu;if(!n)return;for(const s of this.elements)n.append(s);this._visible=!0}else{for(const n of this.elements)this.append(n);this._visible=!1,this.resetVisibleElements()}}get visible(){return this._visible}set value(t){if(this.required&&Object.keys(t).length===0)return;const n=new Set;for(const s of t){const l=this.findOption(s);if(l&&(n.add(l),!this.multiple&&Object.keys(t).length===1))break}this._value=n,this.updateOptionsState(),this.dispatchEvent(this.onValueChange)}get value(){return[...this._value].filter(t=>t instanceof $h&&t.checked).map(t=>t.value)}get _options(){const t=new Set([...this.elements]);for(const n of this.children)n instanceof $h&&t.add(n);return[...t]}onSlotChange(t){const n=t.target.assignedElements();this.observe(n);const s=new Set;for(const l of this.elements){if(!(l instanceof $h)){l.remove();continue}l.checked&&s.add(l),l.removeEventListener("click",this.onOptionClick),l.addEventListener("click",this.onOptionClick)}this._value=s}updateOptionsState(){for(const t of this._options)t instanceof $h&&(t.checked=this._value.has(t))}findOption(t){return this._options.find(n=>n instanceof $h?n.label===t||n.value===t:!1)}render(){let t,n,s;if(this._value.size===0)t="Select an option...";else if(this._value.size===1){const l=[...this._value][0];t=(l==null?void 0:l.label)||(l==null?void 0:l.value),n=l==null?void 0:l.img,s=l==null?void 0:l.icon}else t=`Multiple (${this._value.size})`;return ls`
+
+
+
+ `}};Qle.styles=[gO.scrollbar,Lr`
+ :host {
+ --bim-input--bgc: var(
+ --bim-dropdown--bgc,
+ var(--bim-ui_bg-contrast-20)
+ );
+ --bim-input--olw: 2px;
+ --bim-input--olc: transparent;
+ --bim-input--bdrs: var(--bim-ui_size-4xs);
+ flex: 1;
+ display: block;
+ }
+
+ :host([visible]) {
+ --bim-input--olc: var(--bim-ui_accent-base);
+ }
+
+ .input {
+ --bim-label--fz: var(--bim-drodown--fz, var(--bim-ui_size-xs));
+ --bim-label--c: var(--bim-dropdown--c, var(--bim-ui_bg-contrast-100));
+ height: 100%;
+ display: flex;
+ flex: 1;
+ overflow: hidden;
+ column-gap: 0.25rem;
+ outline: none;
+ cursor: pointer;
+ align-items: center;
+ justify-content: space-between;
+ padding: 0 0.5rem;
+ }
+
+ bim-label {
+ pointer-events: none;
+ }
+ `];let fN=Qle;SO([un({type:String,reflect:!0})],fN.prototype,"name",2);SO([un({type:String,reflect:!0})],fN.prototype,"icon",2);SO([un({type:String,reflect:!0})],fN.prototype,"label",2);SO([un({type:Boolean,reflect:!0})],fN.prototype,"multiple",2);SO([un({type:Boolean,reflect:!0})],fN.prototype,"required",2);SO([un({type:Boolean,reflect:!0})],fN.prototype,"vertical",2);SO([un({type:Boolean,reflect:!0})],fN.prototype,"visible",1);SO([$F()],fN.prototype,"_value",2);var mfe=Object.defineProperty,$le=(e,t,n,s)=>{for(var l=void 0,r=e.length-1,i;r>=0;r--)(i=e[r])&&(l=i(t,n,l)||l);return l&&mfe(t,n,l),l};const Jle=class extends fr{constructor(){super(...arguments),this.floating=!1,this._layouts={},this._updateFunctions={}}set layouts(t){this._layouts=t;const n={};for(const[s,l]of Object.entries(t))for(const r in l.elements)n[s]||(n[s]={}),n[s][r]=i=>{const u=this._updateFunctions[s];if(!u)return;const h=u[r];h&&h(i)};this.updateComponent=n}get layouts(){return this._layouts}getLayoutAreas(t){const{template:n}=t,s=n.split(`
+`).map(l=>l.trim()).map(l=>l.split('"')[1]).filter(l=>l!==void 0).flatMap(l=>l.split(/\s+/));return[...new Set(s)].filter(l=>l!=="")}firstUpdated(){this._onLayoutChange=new Event("layoutchange")}render(){if(this.layout){if(this._updateFunctions={},this.layouts[this.layout]){this.innerHTML="",this._updateFunctions[this.layout]={};const t=this._updateFunctions[this.layout],n=this.layouts[this.layout],s=this.getLayoutAreas(n).map(l=>{const r=n.elements[l];if(!r)return null;if(r instanceof HTMLElement)return r.style.gridArea=l,r;if("template"in r){const{template:i,initialState:u}=r,[h,d]=Ej.create(i,u);return h.style.gridArea=l,t[l]=d,h}return Ej.create(r)}).filter(l=>!!l);this.style.gridTemplate=n.template,this.append(...s),this._onLayoutChange&&this.dispatchEvent(this._onLayoutChange)}}else this._updateFunctions={},this.innerHTML="",this.style.gridTemplate="",this._onLayoutChange&&this.dispatchEvent(this._onLayoutChange);return ls` `}};Jle.styles=Lr`
+ :host {
+ display: grid;
+ height: 100%;
+ width: 100%;
+ overflow: hidden;
+ box-sizing: border-box;
+ }
+
+ /* :host(:not([layout])) {
+ display: none;
+ } */
+
+ :host([floating]) {
+ --bim-panel--bdrs: var(--bim-ui_size-4xs);
+ background-color: transparent;
+ padding: 1rem;
+ gap: 1rem;
+ position: absolute;
+ pointer-events: none;
+ top: 0px;
+ left: 0px;
+ }
+
+ :host(:not([floating])) {
+ --bim-panel--bdrs: 0;
+ background-color: var(--bim-ui_bg-contrast-20);
+ gap: 1px;
+ }
+ `;let SJ=Jle;$le([un({type:Boolean,reflect:!0})],SJ.prototype,"floating");$le([un({type:String,reflect:!0})],SJ.prototype,"layout");const TQ=class extends fr{render(){return ls`
+
+ `}};TQ.styles=Lr`
+ :host {
+ height: var(--bim-icon--fz, var(--bim-ui_size-sm));
+ width: var(--bim-icon--fz, var(--bim-ui_size-sm));
+ }
+
+ iconify-icon {
+ height: var(--bim-icon--fz, var(--bim-ui_size-sm));
+ width: var(--bim-icon--fz, var(--bim-ui_size-sm));
+ color: var(--bim-icon--c);
+ transition: all 0.15s;
+ }
+ `,TQ.properties={icon:{type:String}};let Tfe=TQ;var wfe=Object.defineProperty,zj=(e,t,n,s)=>{for(var l=void 0,r=e.length-1,i;r>=0;r--)(i=e[r])&&(l=i(t,n,l)||l);return l&&wfe(t,n,l),l};const Xle=class extends fr{constructor(){super(...arguments),this.vertical=!1,this.onValueChange=new Event("change")}get value(){const t={};for(const n of this.children){const s=n;"value"in s?t[s.name||s.label]=s.value:"checked"in s&&(t[s.name||s.label]=s.checked)}return t}set value(t){const n=[...this.children];for(const s in t){const l=n.find(u=>{const h=u;return h.name===s||h.label===s});if(!l)continue;const r=l,i=t[s];typeof i=="boolean"?r.checked=i:r.value=i}}render(){return ls`
+
+ ${this.label||this.icon?ls`
${this.label} `:null}
+
+
+
+
+ `}};Xle.styles=Lr`
+ :host {
+ flex: 1;
+ display: block;
+ }
+
+ .parent {
+ display: flex;
+ flex-wrap: wrap;
+ column-gap: 1rem;
+ row-gap: 0.375rem;
+ user-select: none;
+ flex: 1;
+ }
+
+ :host(:not([vertical])) .parent {
+ justify-content: space-between;
+ }
+
+ :host([vertical]) .parent {
+ flex-direction: column;
+ }
+
+ .input {
+ position: relative;
+ overflow: hidden;
+ box-sizing: border-box;
+ display: flex;
+ align-items: center;
+ flex-wrap: wrap;
+ min-height: 1.75rem;
+ min-width: 3rem;
+ gap: var(--bim-input--g, var(--bim-ui_size-4xs));
+ padding: var(--bim-input--p, 0);
+ background-color: var(--bim-input--bgc, transparent);
+ outline: var(--bim-input--olw, 2px) solid
+ var(--bim-input--olc, transparent);
+ border-radius: var(--bim-input--bdrs, var(--bim-ui_size-4xs));
+ transition: all 0.15s;
+ }
+
+ :host(:not([vertical])) .input {
+ flex: 1;
+ justify-content: flex-end;
+ }
+
+ :host(:not([vertical])[label]) .input {
+ max-width: fit-content;
+ }
+ `;let Yz=Xle;zj([un({type:String,reflect:!0})],Yz.prototype,"name");zj([un({type:String,reflect:!0})],Yz.prototype,"label");zj([un({type:String,reflect:!0})],Yz.prototype,"icon");zj([un({type:Boolean,reflect:!0})],Yz.prototype,"vertical");var Rfe=Object.defineProperty,Wz=(e,t,n,s)=>{for(var l=void 0,r=e.length-1,i;r>=0;r--)(i=e[r])&&(l=i(t,n,l)||l);return l&&Rfe(t,n,l),l};const vle=class extends fr{constructor(){super(...arguments),this.labelHidden=!1,this.iconHidden=!1,this.vertical=!1}get value(){return this.textContent?Vj(this.textContent):this.textContent}render(){return ls`
+
+ ${this.img?ls`
`:null}
+ ${!this.iconHidden&&this.icon?ls`
`:null}
+
+
+ `}};vle.styles=Lr`
+ :host {
+ --bim-icon--c: var(--bim-label--c);
+ color: var(--bim-label--c, var(--bim-ui_bg-contrast-60));
+ font-size: var(--bim-label--fz, var(--bim-ui_size-xs));
+ display: block;
+ white-space: nowrap;
+ transition: all 0.15s;
+ }
+
+ :host([icon]) {
+ line-height: 1.1rem;
+ }
+
+ .parent {
+ display: flex;
+ align-items: center;
+ column-gap: 0.25rem;
+ row-gap: 0.125rem;
+ user-select: text;
+ height: 100%;
+ }
+
+ :host([vertical]) .parent {
+ flex-direction: column;
+ }
+
+ .parent p {
+ margin: 0;
+ text-overflow: ellipsis;
+ overflow: hidden;
+ display: flex;
+ align-items: center;
+ gap: 0.125rem;
+ }
+
+ :host([label-hidden]) .parent p,
+ :host(:empty) .parent p {
+ display: none;
+ }
+
+ img {
+ height: 100%;
+ aspect-ratio: 1;
+ border-radius: 100%;
+ margin-right: 0.125rem;
+ }
+
+ :host(:not([vertical])) img {
+ max-height: var(
+ --bim-label_icon--sz,
+ calc(var(--bim-label--fz, var(--bim-ui_size-xs)) * 1.8)
+ );
+ }
+
+ :host([vertical]) img {
+ max-height: var(
+ --bim-label_icon--sz,
+ calc(var(--bim-label--fz, var(--bim-ui_size-xs)) * 4)
+ );
+ }
+ `;let vF=vle;Wz([un({type:String,reflect:!0})],vF.prototype,"img");Wz([un({type:Boolean,attribute:"label-hidden",reflect:!0})],vF.prototype,"labelHidden");Wz([un({type:String,reflect:!0})],vF.prototype,"icon");Wz([un({type:Boolean,attribute:"icon-hidden",reflect:!0})],vF.prototype,"iconHidden");Wz([un({type:Boolean,reflect:!0})],vF.prototype,"vertical");var gfe=Object.defineProperty,Afe=Object.getOwnPropertyDescriptor,Gw=(e,t,n,s)=>{for(var l=s>1?void 0:s?Afe(t,n):t,r=e.length-1,i;r>=0;r--)(i=e[r])&&(l=(s?i(t,n,l):i(l))||l);return s&&l&&gfe(t,n,l),l};const ere=class extends fr{constructor(){super(...arguments),this._value=0,this.vertical=!1,this.slider=!1,this._input=PF(),this.onValueChange=new Event("change")}set value(t){this.setValue(t.toString())}get value(){return this._value}onChange(t){t.stopPropagation();const{value:n}=this._input;n&&this.setValue(n.value)}setValue(t){const{value:n}=this._input;let s=t;if(s=s.replace(/[^0-9.-]/g,""),s=s.replace(/(\..*)\./g,"$1"),s.endsWith(".")||(s.lastIndexOf("-")>0&&(s=s[0]+s.substring(1).replace(/-/g,"")),s==="-"||s==="-0"))return;let l=Number(s);Number.isNaN(l)||(l=this.min!==void 0?Math.max(l,this.min):l,l=this.max!==void 0?Math.min(l,this.max):l,this.value!==l&&(this._value=l,n&&(n.value=this.value.toString()),this.requestUpdate(),this.dispatchEvent(this.onValueChange)))}onBlur(){const{value:t}=this._input;t&&Number.isNaN(Number(t.value))&&(t.value=this.value.toString())}onSliderMouseDown(t){document.body.style.cursor="w-resize";const{clientX:n}=t,s=this.value;let l=!1;const r=h=>{var d;l=!0;const{clientX:I}=h,E=this.step??1,y=((d=E.toString().split(".")[1])==null?void 0:d.length)||0,T=1/(this.sensitivity??1),S=(I-n)/T;if(Math.floor(Math.abs(S))!==Math.abs(S))return;const D=s+S*E;this.setValue(D.toFixed(y))},i=()=>{this.slider=!0,this.removeEventListener("blur",i)},u=()=>{document.removeEventListener("mousemove",r),document.body.style.cursor="default",l?l=!1:(this.addEventListener("blur",i),this.slider=!1,requestAnimationFrame(()=>this.focus())),document.removeEventListener("mouseup",u)};document.addEventListener("mousemove",r),document.addEventListener("mouseup",u)}onFocus(t){t.stopPropagation();const n=s=>{s.key==="Escape"&&(this.blur(),window.removeEventListener("keydown",n))};window.addEventListener("keydown",n)}connectedCallback(){super.connectedCallback(),this.min&&this.min>this.value&&(this._value=this.min),this.max&&this.max${this.pref}`:null}
+ u.stopPropagation()}
+ @change=${this.onChange}
+ @blur=${this.onBlur}
+ @focus=${this.onFocus}
+ .value=${this.value.toString()}
+ />
+ ${this.suffix?ls`${this.suffix} `:null}
+ `,n=this.min??-1/0,s=this.max??1/0,l=100*(this.value-n)/(s-n),r=ls`
+
+
+
+ ${this.pref||this.icon?ls`
${`${this.pref}: `} `:null}
+
${this.value}
+ ${this.suffix?ls`
${this.suffix} `:null}
+
+ `,i=`${this.label||this.name||this.pref?`${this.label||this.name||this.pref}: `:""}${this.value}${this.suffix??""}`;return ls`
+
+ ${this.slider?r:t}
+
+ `}};ere.styles=Lr`
+ :host {
+ --bim-input--bgc: var(
+ --bim-number-input--bgc,
+ var(--bim-ui_bg-contrast-20)
+ );
+ --bim-input--olw: var(--bim-number-input--olw, 2px);
+ --bim-input--olc: var(--bim-number-input--olc, transparent);
+ --bim-input--bdrs: var(--bim-number-input--bdrs, var(--bim-ui_size-4xs));
+ --bim-input--p: 0 0.375rem;
+ flex: 1;
+ display: block;
+ }
+
+ :host(:focus) {
+ --bim-input--olw: var(--bim-number-input--olw, 2px);
+ --bim-input--olc: var(
+ --bim-number-input¡focus--c,
+ var(--bim-ui_accent-base)
+ );
+ }
+
+ :host(:not([slider])) bim-label {
+ --bim-label--c: var(
+ --bim-number-input_affixes--c,
+ var(--bim-ui_bg-contrast-60)
+ );
+ --bim-label--fz: var(
+ --bim-number-input_affixes--fz,
+ var(--bim-ui_size-xs)
+ );
+ }
+
+ p {
+ margin: 0;
+ padding: 0;
+ }
+
+ input {
+ background-color: transparent;
+ outline: none;
+ border: none;
+ padding: 0;
+ flex-grow: 1;
+ text-align: right;
+ font-family: inherit;
+ font-feature-settings: inherit;
+ font-variation-settings: inherit;
+ font-size: var(--bim-number-input--fz, var(--bim-ui_size-xs));
+ color: var(--bim-number-input--c, var(--bim-ui_bg-contrast-100));
+ }
+
+ :host([suffix]:not([pref])) input {
+ text-align: left;
+ }
+
+ :host([slider]) {
+ --bim-input--p: 0;
+ }
+
+ :host([slider]) .slider {
+ --bim-label--c: var(--bim-ui_bg-contrast-100);
+ }
+
+ .slider {
+ position: relative;
+ display: flex;
+ justify-content: center;
+ width: 100%;
+ height: 100%;
+ padding: 0 0.5rem;
+ }
+
+ .slider-indicator {
+ height: 100%;
+ background-color: var(--bim-ui_main-base);
+ position: absolute;
+ top: 0;
+ left: 0;
+ border-radius: var(--bim-input--bdrs, var(--bim-ui_size-4xs));
+ }
+
+ bim-input {
+ display: flex;
+ }
+
+ bim-label {
+ pointer-events: none;
+ }
+ `;let zm=ere;Gw([un({type:String,reflect:!0})],zm.prototype,"name",2);Gw([un({type:String,reflect:!0})],zm.prototype,"icon",2);Gw([un({type:String,reflect:!0})],zm.prototype,"label",2);Gw([un({type:String,reflect:!0})],zm.prototype,"pref",2);Gw([un({type:Number,reflect:!0})],zm.prototype,"min",2);Gw([un({type:Number,reflect:!0})],zm.prototype,"value",1);Gw([un({type:Number,reflect:!0})],zm.prototype,"step",2);Gw([un({type:Number,reflect:!0})],zm.prototype,"sensitivity",2);Gw([un({type:Number,reflect:!0})],zm.prototype,"max",2);Gw([un({type:String,reflect:!0})],zm.prototype,"suffix",2);Gw([un({type:Boolean,reflect:!0})],zm.prototype,"vertical",2);Gw([un({type:Boolean,reflect:!0})],zm.prototype,"slider",2);var Sfe=Object.defineProperty,Cfe=Object.getOwnPropertyDescriptor,jz=(e,t,n,s)=>{for(var l=s>1?void 0:s?Cfe(t,n):t,r=e.length-1,i;r>=0;r--)(i=e[r])&&(l=(s?i(t,n,l):i(l))||l);return s&&l&&Sfe(t,n,l),l};const tre=class extends fr{constructor(){super(...arguments),this.onValueChange=new Event("change"),this._hidden=!1,this.headerHidden=!1,this.valueTransform={},this.activationButton=document.createElement("bim-button")}set hidden(t){this._hidden=t,this.activationButton.active=!t,this.dispatchEvent(new Event("hiddenchange"))}get hidden(){return this._hidden}get value(){return yj(this,this.valueTransform)}set value(t){const n=[...this.children];for(const s in t){const l=n.find(i=>{const u=i;return u.name===s||u.label===s});if(!l)continue;const r=l;r.value=t[s]}}animatePanles(){const t=[{maxHeight:"100vh",maxWidth:"100vw",opacity:1},{maxHeight:"100vh",maxWidth:"100vw",opacity:0},{maxHeight:0,maxWidth:0,opacity:0}];this.animate(t,{duration:300,easing:"cubic-bezier(0.65, 0.05, 0.36, 1)",direction:this.hidden?"normal":"reverse",fill:"forwards"})}connectedCallback(){super.connectedCallback(),this.activationButton.active=!this.hidden,this.activationButton.onclick=()=>{this.hidden=!this.hidden,this.animatePanles()}}disconnectedCallback(){super.disconnectedCallback(),this.activationButton.remove()}collapseSections(){const t=this.querySelectorAll("bim-panel-section");for(const n of t)n.collapsed=!0}expandSections(){const t=this.querySelectorAll("bim-panel-section");for(const n of t)n.collapsed=!1}render(){return this.activationButton.icon=this.icon,this.activationButton.label=this.label||this.name,this.activationButton.tooltipTitle=this.label||this.name,ls`
+
+ ${this.label||this.name||this.icon?ls`
${this.label} `:null}
+
+
+
+
+ `}};tre.styles=[gO.scrollbar,Lr`
+ :host {
+ display: flex;
+ border-radius: var(--bim-ui_size-base);
+ background-color: var(--bim-ui_bg-base);
+ overflow: auto;
+ }
+
+ :host([hidden]) {
+ max-height: 0;
+ max-width: 0;
+ opacity: 0;
+ }
+
+ .parent {
+ display: flex;
+ flex: 1;
+ flex-direction: column;
+ pointer-events: auto;
+ overflow: auto;
+ }
+
+ .parent bim-label {
+ --bim-label--c: var(--bim-panel--c, var(--bim-ui_bg-contrast-80));
+ --bim-label--fz: var(--bim-panel--fz, var(--bim-ui_size-sm));
+ font-weight: 600;
+ padding: 1rem;
+ flex-shrink: 0;
+ border-bottom: 1px solid var(--bim-ui_bg-contrast-20);
+ }
+
+ :host([header-hidden]) .parent bim-label {
+ display: none;
+ }
+
+ .sections {
+ display: flex;
+ flex-direction: column;
+ overflow: auto;
+ }
+
+ ::slotted(bim-panel-section:not(:last-child)) {
+ border-bottom: 1px solid var(--bim-ui_bg-contrast-20);
+ }
+ `];let C8=tre;jz([un({type:String,reflect:!0})],C8.prototype,"icon",2);jz([un({type:String,reflect:!0})],C8.prototype,"name",2);jz([un({type:String,reflect:!0})],C8.prototype,"label",2);jz([un({type:Boolean,reflect:!0})],C8.prototype,"hidden",1);jz([un({type:Boolean,attribute:"header-hidden",reflect:!0})],C8.prototype,"headerHidden",2);var Nfe=Object.defineProperty,qz=(e,t,n,s)=>{for(var l=void 0,r=e.length-1,i;r>=0;r--)(i=e[r])&&(l=i(t,n,l)||l);return l&&Nfe(t,n,l),l};const nre=class extends fr{constructor(){super(...arguments),this.onValueChange=new Event("change"),this.valueTransform={},this.componentHeight=-1}get value(){const t=this.parentElement;let n;return t instanceof C8&&(n=t.valueTransform),Object.values(this.valueTransform).length!==0&&(n=this.valueTransform),yj(this,n)}set value(t){const n=[...this.children];for(const s in t){const l=n.find(i=>{const u=i;return u.name===s||u.label===s});if(!l)continue;const r=l;r.value=t[s]}}animateHeader(){var t;const n=(t=this.shadowRoot)==null?void 0:t.querySelector(".components");this.componentHeight<0&&(this.collapsed?this.componentHeight=n.clientHeight:(n.style.setProperty("transition","none"),n.style.setProperty("height","auto"),n.style.setProperty("padding","0.125rem 1rem 1rem"),this.componentHeight=n.clientHeight,requestAnimationFrame(()=>{n.style.setProperty("height","0px"),n.style.setProperty("padding","0 1rem 0"),n.style.setProperty("transition","height 0.25s cubic-bezier(0.65, 0.05, 0.36, 1), padding 0.25s cubic-bezier(0.65, 0.05, 0.36, 1)")}))),this.collapsed?(n.style.setProperty("height",`${this.componentHeight}px`),requestAnimationFrame(()=>{n.style.setProperty("height","0px"),n.style.setProperty("padding","0 1rem 0")})):(n.style.setProperty("height","0px"),n.style.setProperty("padding","0 1rem 0"),requestAnimationFrame(()=>{n.style.setProperty("height",`${this.componentHeight}px`),n.style.setProperty("padding","0.125rem 1rem 1rem")}))}onHeaderClick(){this.fixed||(this.collapsed=!this.collapsed,this.animateHeader())}handelSlotChange(t){t.target.assignedElements({flatten:!0}).forEach((n,s)=>{const l=s*.05;n.style.setProperty("transition-delay",`${l}s`)})}handlePointerEnter(){const t=this.renderRoot.querySelector(".expand-icon");this.collapsed?t==null||t.style.setProperty("animation","collapseAnim 0.5s"):t==null||t.style.setProperty("animation","expandAnim 0.5s")}handlePointerLeave(){const t=this.renderRoot.querySelector(".expand-icon");t==null||t.style.setProperty("animation","none")}render(){const t=this.label||this.icon||this.name||this.fixed,n=ls`
+
+
+ `,s=ls`
+
+ `;return ls`
+
+ `}};nre.styles=[gO.scrollbar,Lr`
+ :host {
+ display: block;
+ pointer-events: auto;
+ }
+
+ :host(:not([fixed])) .header:hover {
+ --bim-label--c: var(--bim-ui_accent-base);
+ color: var(--bim-ui_accent-base);
+ cursor: pointer;
+ }
+
+ :host(:not([fixed])) .header:hover .expand-icon {
+ fill: var(--bim-ui_accent-base);
+ }
+
+ .header {
+ --bim-label--fz: var(--bim-ui_size-sm);
+ --bim-label--c: var(--bim-ui_bg-contrast-80);
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ font-weight: 600;
+ height: 1.5rem;
+ padding: 0.75rem 1rem;
+ }
+
+ .expand-icon {
+ fill: var(--bim-ui_bg-contrast-80);
+ transition: transform 0.2s;
+ }
+
+ :host([collapsed]) .expand-icon {
+ transform: rotateZ(-180deg);
+ }
+
+ .title {
+ display: flex;
+ align-items: center;
+ column-gap: 0.5rem;
+ }
+
+ .title p {
+ font-size: var(--bim-ui_size-sm);
+ }
+
+ .components {
+ display: flex;
+ flex-direction: column;
+ overflow: hidden;
+ row-gap: 0.75rem;
+ padding: 0.125rem 1rem 1rem;
+ box-sizing: border-box;
+ transition:
+ height 0.25s cubic-bezier(0.65, 0.05, 0.36, 1),
+ padding 0.25s cubic-bezier(0.65, 0.05, 0.36, 1);
+ }
+
+ :host(:not([fixed])[collapsed]) .components {
+ padding: 0 1rem 0;
+ height: 0px;
+ }
+
+ bim-label {
+ pointer-events: none;
+ }
+
+ ::slotted(*) {
+ transition:
+ transform 0.25s cubic-bezier(0.65, 0.05, 0.36, 1),
+ opacity 0.25s cubic-bezier(0.65, 0.05, 0.36, 1);
+ }
+
+ :host(:not([fixed])[collapsed]) ::slotted(*) {
+ transform: translateX(-20%);
+ opacity: 0;
+ }
+
+ @keyframes expandAnim {
+ 0%,
+ 100% {
+ transform: translateY(0%);
+ }
+ 25% {
+ transform: translateY(-30%);
+ }
+ 50% {
+ transform: translateY(10%);
+ }
+ 75% {
+ transform: translateY(-30%);
+ }
+ }
+
+ @keyframes collapseAnim {
+ 0%,
+ 100% {
+ transform: translateY(0%) rotateZ(-180deg);
+ }
+ 25% {
+ transform: translateY(30%) rotateZ(-180deg);
+ }
+ 50% {
+ transform: translateY(-10%) rotateZ(-180deg);
+ }
+ 75% {
+ transform: translateY(30%) rotateZ(-180deg);
+ }
+ }
+ `];let eU=nre;qz([un({type:String,reflect:!0})],eU.prototype,"icon");qz([un({type:String,reflect:!0})],eU.prototype,"label");qz([un({type:String,reflect:!0})],eU.prototype,"name");qz([un({type:Boolean,reflect:!0})],eU.prototype,"fixed");qz([un({type:Boolean,reflect:!0})],eU.prototype,"collapsed");var Dfe=Object.defineProperty,Zz=(e,t,n,s)=>{for(var l=void 0,r=e.length-1,i;r>=0;r--)(i=e[r])&&(l=i(t,n,l)||l);return l&&Dfe(t,n,l),l};const sre=class extends fr{constructor(){super(...arguments),this.vertical=!1,this.onValueChange=new Event("change"),this._canEmitEvents=!1,this._value=document.createElement("bim-option"),this.onOptionClick=t=>{this._value=t.target,this.dispatchEvent(this.onValueChange);for(const n of this.children)n instanceof $h&&(n.checked=n===t.target)}}get _options(){return[...this.querySelectorAll("bim-option")]}set value(t){const n=this.findOption(t);if(n){for(const s of this._options)s.checked=s===n;this._value=n,this._canEmitEvents&&this.dispatchEvent(this.onValueChange)}}get value(){return this._value.value}onSlotChange(t){const n=t.target.assignedElements();for(const s of n)s instanceof $h&&(s.noMark=!0,s.removeEventListener("click",this.onOptionClick),s.addEventListener("click",this.onOptionClick))}findOption(t){return this._options.find(n=>n instanceof $h?n.label===t||n.value===t:!1)}doubleRequestAnimationFrames(t){requestAnimationFrame(()=>requestAnimationFrame(t))}setAnimatedBackgound(t=!1){var n,s;const l=this.renderRoot.querySelector(".animated-background"),r=(s=(n=this.shadowRoot)==null?void 0:n.querySelector("slot"))==null?void 0:s.assignedElements({flatten:!0}).filter(i=>i.hasAttribute("checked"))[0];requestAnimationFrame(()=>{var i,u,h,d;const I=(d=(h=(u=(i=r==null?void 0:r.parentElement)==null?void 0:i.shadowRoot)==null?void 0:u.querySelector("bim-input"))==null?void 0:h.shadowRoot)==null?void 0:d.querySelector(".input"),E={width:r==null?void 0:r.clientWidth,height:r==null?void 0:r.clientHeight,top:((r==null?void 0:r.offsetTop)??0)-((I==null?void 0:I.offsetTop)??0),left:((r==null?void 0:r.offsetLeft)??0)-((I==null?void 0:I.offsetLeft)??0)};l==null||l.style.setProperty("width",`${E.width}px`),l==null||l.style.setProperty("height",`${E.height}px`),l==null||l.style.setProperty("top",`${E.top}px`),l==null||l.style.setProperty("left",`${E.left}px`)}),t&&this.doubleRequestAnimationFrames(()=>{const i="ease";l==null||l.style.setProperty("transition",`width ${.3}s ${i}, height ${.3}s ${i}, top ${.3}s ${i}, left ${.3}s ${i}`)})}firstUpdated(){const t=[...this.children].find(n=>n instanceof $h&&n.checked);t&&(this._value=t),window.addEventListener("load",()=>{this.setAnimatedBackgound(!0)}),new ResizeObserver(()=>{this.setAnimatedBackgound()}).observe(this)}render(){return ls`
+
+
+
+
+ `}};sre.styles=Lr`
+ :host {
+ --bim-input--bgc: var(--bim-ui_bg-contrast-20);
+ --bim-input--g: 0;
+ --bim-option--jc: center;
+ flex: 1;
+ display: block;
+ }
+
+ ::slotted(bim-option) {
+ position: relative;
+ border-radius: 0;
+ overflow: hidden;
+ min-width: min-content;
+ min-height: min-content;
+ transition: background-color 0.2s;
+ }
+
+ .animated-background {
+ position: absolute;
+ background: var(--bim-ui_main-base);
+ width: 0;
+ height: 0;
+ top: 0;
+ left: 0;
+ }
+
+ ::slotted(bim-option[checked]) {
+ --bim-label--c: var(--bim-ui_main-contrast);
+ }
+
+ ::slotted(bim-option:not([checked]):hover) {
+ background-color: #0003;
+ }
+ `;let tU=sre;Zz([un({type:String,reflect:!0})],tU.prototype,"name");Zz([un({type:String,reflect:!0})],tU.prototype,"icon");Zz([un({type:String,reflect:!0})],tU.prototype,"label");Zz([un({type:Boolean,reflect:!0})],tU.prototype,"vertical");Zz([$F()],tU.prototype,"_value");const Ofe=()=>ls`
+
+
+ `,Lfe=()=>ls`
+
+
+ `;var bfe=Object.defineProperty,Pfe=(e,t,n,s)=>{for(var l=void 0,r=e.length-1,i;r>=0;r--)(i=e[r])&&(l=i(t,n,l)||l);return l&&bfe(t,n,l),l};const lre=class extends fr{constructor(){super(...arguments),this.column="",this.columnIndex=0,this.rowData={}}get data(){return this.column?this.rowData[this.column]:null}render(){return ls`
+
+
+ `}};lre.styles=Lr`
+ :host {
+ padding: 0.375rem;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ }
+
+ :host([data-column-index="0"]) {
+ justify-content: normal;
+ }
+
+ :host([data-column-index="0"]:not([data-cell-header]))
+ ::slotted(bim-label) {
+ text-align: left;
+ }
+
+ ::slotted(*) {
+ --bim-input--bgc: transparent;
+ --bim-input--olc: var(--bim-ui_bg-contrast-20);
+ --bim-input--olw: 1px;
+ }
+
+ ::slotted(bim-input) {
+ --bim-input--olw: 0;
+ }
+
+ ::slotted(bim-label) {
+ white-space: normal;
+ text-align: center;
+ }
+ `;let rre=lre;Pfe([un({type:String,reflect:!0})],rre.prototype,"column");var Mfe=Object.defineProperty,xfe=(e,t,n,s)=>{for(var l=void 0,r=e.length-1,i;r>=0;r--)(i=e[r])&&(l=i(t,n,l)||l);return l&&Mfe(t,n,l),l};const ire=class extends fr{constructor(){super(...arguments),this._groups=[],this.data=[],this.table=this.closest("bim-table")}toggleGroups(t,n=!1){for(const s of this._groups)s.childrenHidden=typeof t>"u"?!s.childrenHidden:!t,n&&s.toggleChildren(t,n)}render(){return this._groups=[],ls`
+
+ ${this.data.map(t=>{const n=document.createElement("bim-table-group");return this._groups.push(n),n.table=this.table,n.data=t,n})}
+ `}};ire.styles=Lr`
+ :host {
+ --bim-button--bgc: transparent;
+ position: relative;
+ display: block;
+ overflow: hidden;
+ grid-area: Children;
+ }
+
+ :host([hidden]) {
+ height: 0;
+ opacity: 0;
+ }
+
+ ::slotted(.branch.branch-vertical) {
+ top: 0;
+ bottom: 1.125rem;
+ }
+ `;let are=ire;xfe([un({type:Array,attribute:!1})],are.prototype,"data");var Ffe=Object.defineProperty,Ufe=(e,t,n,s)=>{for(var l=void 0,r=e.length-1,i;r>=0;r--)(i=e[r])&&(l=i(t,n,l)||l);return l&&Ffe(t,n,l),l};const ore=class extends fr{constructor(){super(...arguments),this.data={data:{}},this.childrenHidden=!0,this.table=this.closest("bim-table")}connectedCallback(){super.connectedCallback(),this.table&&this.table.expanded?this.childrenHidden=!1:this.childrenHidden=!0}toggleChildren(t,n=!1){this._children&&(this.childrenHidden=typeof t>"u"?!this.childrenHidden:!t,n&&this._children.toggleGroups(t,n),this.animateTableChildren(!0))}animateTableChildren(t=!0){if(!t){requestAnimationFrame(()=>{var i;const u=this.renderRoot.querySelector(".caret"),h=this.renderRoot.querySelector(".branch-vertical"),d=(i=this.renderRoot.querySelector("bim-table-children"))==null?void 0:i.querySelector(".branch-vertical");u.style.setProperty("transform",`translateY(-50%) rotate(${this.childrenHidden?"0":"90"}deg)`),h.style.setProperty("transform",`scaleY(${this.childrenHidden?"0":"1"})`),d==null||d.style.setProperty("transform",`scaleY(${this.childrenHidden?"0":"1"})`)});return}const n=900,s=50,l=350,r=350;requestAnimationFrame(()=>{var i;const u=this.renderRoot.querySelector("bim-table-children"),h=this.renderRoot.querySelector(".caret"),d=this.renderRoot.querySelector(".branch-vertical"),I=(i=this.renderRoot.querySelector("bim-table-children"))==null?void 0:i.querySelector(".branch-vertical"),E=()=>{const O=u==null?void 0:u.renderRoot.querySelectorAll("bim-table-group");O==null||O.forEach((N,H)=>{N.style.setProperty("opacity","0"),N.style.setProperty("left","-30px");const _=[{opacity:"0",left:"-30px"},{opacity:"1",left:"0"}];N.animate(_,{duration:n/2,delay:50+H*s,easing:"cubic-bezier(0.65, 0.05, 0.36, 1)",fill:"forwards"})})},y=()=>{const O=[{transform:"translateY(-50%) rotate(90deg)"},{transform:"translateY(-50%) rotate(0deg)"}];h==null||h.animate(O,{duration:r,easing:"cubic-bezier(0.68, -0.55, 0.27, 1.55)",fill:"forwards",direction:this.childrenHidden?"normal":"reverse"})},T=()=>{const O=[{transform:"scaleY(1)"},{transform:"scaleY(0)"}];d==null||d.animate(O,{duration:l,easing:"cubic-bezier(0.4, 0, 0.2, 1)",delay:s,fill:"forwards",direction:this.childrenHidden?"normal":"reverse"})},S=()=>{var O;const N=(O=this.renderRoot.querySelector("bim-table-row"))==null?void 0:O.querySelector(".branch-horizontal");if(N){N.style.setProperty("transform-origin","center right");const H=[{transform:"scaleX(0)"},{transform:"scaleX(1)"}];N.animate(H,{duration:l,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards",direction:this.childrenHidden?"normal":"reverse"})}},D=()=>{const O=[{transform:"scaleY(0)"},{transform:"scaleY(1)"}];I==null||I.animate(O,{duration:l*1.2,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards",delay:(s+l)*.7})};E(),y(),T(),S(),D()})}firstUpdated(){this.renderRoot.querySelectorAll(".caret").forEach(t=>{var n,s,l;if(!this.childrenHidden){t.style.setProperty("transform","translateY(-50%) rotate(90deg)");const r=(n=t.parentElement)==null?void 0:n.querySelector(".branch-horizontal");r&&r.style.setProperty("transform","scaleX(0)");const i=(l=(s=t.parentElement)==null?void 0:s.parentElement)==null?void 0:l.querySelectorAll(".branch-vertical");i==null||i.forEach(u=>{u.style.setProperty("transform","scaleY(1)")})}})}render(){if(!this.table)throw new Error("TableGroup: parent table wasn't found!");const t=this.table.getGroupIndentation(this.data)??0,n=ls`
+ ${this.table.noIndentation?null:ls`
+
+
+ `}
+ `,s=document.createDocumentFragment();bF(n,s);let l=null;this.table.noIndentation||(l=document.createElement("div"),l.classList.add("branch","branch-horizontal"),l.style.left=`${t-1+(this.table.selectableRows?2.05:.5625)}rem`);let r=null;if(!this.table.noIndentation){const h=document.createElementNS("http://www.w3.org/2000/svg","svg");h.setAttribute("height","9.9"),h.setAttribute("width","7.5"),h.setAttribute("viewBox","0 0 4.6666672 7.7");const d=document.createElementNS("http://www.w3.org/2000/svg","path");d.setAttribute("d","m 1.7470835,6.9583848 2.5899999,-2.59 c 0.39,-0.39 0.39,-1.02 0,-1.41 L 1.7470835,0.36838483 c -0.63,-0.62000003 -1.71000005,-0.18 -1.71000005,0.70999997 v 5.17 c 0,0.9 1.08000005,1.34 1.71000005,0.71 z"),h.append(d),r=document.createElement("div"),r.addEventListener("click",I=>{I.stopPropagation(),this.toggleChildren()}),r.classList.add("caret"),r.style.left=`${(this.table.selectableRows?1.5:.125)+t}rem`,r.append(h)}const i=document.createElement("bim-table-row");this.data.children&&i.append(s),i.table=this.table,i.data=this.data.data,this.table.dispatchEvent(new CustomEvent("rowcreated",{detail:{row:i}})),r&&this.data.children&&i.append(r),t!==0&&l&&i.append(l);let u;if(this.data.children){u=document.createElement("bim-table-children"),this._children=u,u.table=this.table,u.data=this.data.children;const h=document.createDocumentFragment();bF(n,h),u.append(h),this.childrenHidden&&u.setAttribute("hidden","")}return ls`
+ ${i} ${this.childrenHidden?null:u}
+ `}};ore.styles=Lr`
+ :host {
+ position: relative;
+ }
+
+ .parent {
+ display: grid;
+ grid-template-areas: "Data" "Children";
+ }
+
+ .branch {
+ position: absolute;
+ z-index: 1;
+ }
+
+ .branch-vertical {
+ border-left: 1px dotted var(--bim-ui_bg-contrast-40);
+ transform-origin: top center;
+ transform: scaleY(0);
+ }
+
+ .branch-horizontal {
+ top: 50%;
+ width: 1rem;
+ border-bottom: 1px dotted var(--bim-ui_bg-contrast-40);
+ }
+
+ .branch-horizontal {
+ transform-origin: center left;
+ }
+
+ .caret {
+ position: absolute;
+ z-index: 2;
+ transform: translateY(-50%) rotate(0deg);
+ top: 50%;
+ display: flex;
+ width: 0.95rem;
+ height: 0.95rem;
+ justify-content: center;
+ align-items: center;
+ cursor: pointer;
+ }
+
+ .caret svg {
+ fill: var(--bim-ui_bg-contrast-60);
+ }
+ `;let ure=ore;Ufe([un({type:Boolean,attribute:"children-hidden",reflect:!0})],ure.prototype,"childrenHidden");var Bfe=Object.defineProperty,nU=(e,t,n,s)=>{for(var l=void 0,r=e.length-1,i;r>=0;r--)(i=e[r])&&(l=i(t,n,l)||l);return l&&Bfe(t,n,l),l};const cre=class extends fr{constructor(){super(...arguments),this.selected=!1,this.columns=[],this.hiddenColumns=[],this.data={},this.isHeader=!1,this.table=this.closest("bim-table"),this.onTableColumnsChange=()=>{this.table&&(this.columns=this.table.columns)},this.onTableColumnsHidden=()=>{this.table&&(this.hiddenColumns=this.table.hiddenColumns)},this._observer=new IntersectionObserver(t=>{this._intersecting=t[0].isIntersecting},{rootMargin:"36px"})}get _columnNames(){return this.columns.filter(t=>!this.hiddenColumns.includes(t.name)).map(t=>t.name)}get _columnWidths(){return this.columns.filter(t=>!this.hiddenColumns.includes(t.name)).map(t=>t.width)}get _isSelected(){var t;return(t=this.table)==null?void 0:t.selection.has(this.data)}onSelectionChange(t){if(!this.table)return;const n=t.target;this.selected=n.value,n.value?(this.table.selection.add(this.data),this.table.dispatchEvent(new CustomEvent("rowselected",{detail:{data:this.data}}))):(this.table.selection.delete(this.data),this.table.dispatchEvent(new CustomEvent("rowdeselected",{detail:{data:this.data}})))}connectedCallback(){super.connectedCallback(),this._observer.observe(this),this.table&&(this.columns=this.table.columns,this.hiddenColumns=this.table.hiddenColumns,this.table.addEventListener("columnschange",this.onTableColumnsChange),this.table.addEventListener("columnshidden",this.onTableColumnsHidden),this.toggleAttribute("selected",this._isSelected))}disconnectedCallback(){super.disconnectedCallback(),this._observer.unobserve(this),this.table&&(this.columns=[],this.hiddenColumns=[],this.table.removeEventListener("columnschange",this.onTableColumnsChange),this.table.removeEventListener("columnshidden",this.onTableColumnsHidden),this.toggleAttribute("selected",!1))}compute(){if(!this.table)throw new Error("TableRow: parent table wasn't found!");const t=this.table.getRowIndentation(this.data)??0,n=this.isHeader?this.data:this.table.applyDataTransform(this.data)??this.data,s=[];for(const l in n){if(this.hiddenColumns.includes(l))continue;const r=n[l];let i;if(typeof r=="string"||typeof r=="boolean"||typeof r=="number"?(i=document.createElement("bim-label"),i.textContent=String(r)):r instanceof HTMLElement?i=r:(i=document.createDocumentFragment(),bF(r,i)),!i)continue;const u=document.createElement("bim-table-cell");u.append(i),u.column=l,this._columnNames.indexOf(l)===0&&(u.style.marginLeft=`${this.table.noIndentation?0:t+.75}rem`);const h=this._columnNames.indexOf(l);u.setAttribute("data-column-index",String(h)),u.toggleAttribute("data-no-indentation",h===0&&this.table.noIndentation),u.toggleAttribute("data-cell-header",this.isHeader),u.rowData=this.data,this.table.dispatchEvent(new CustomEvent("cellcreated",{detail:{cell:u}})),s.push(u)}return this.style.gridTemplateAreas=`"${this.table.selectableRows?"Selection":""} ${this._columnNames.join(" ")}"`,this.style.gridTemplateColumns=`${this.table.selectableRows?"1.6rem":""} ${this._columnWidths.join(" ")}`,ls`
+ ${!this.isHeader&&this.table.selectableRows?ls` `:null}
+ ${s}
+
+ `}render(){return ls`${this._intersecting?this.compute():ls``}`}};cre.styles=Lr`
+ :host {
+ position: relative;
+ grid-area: Data;
+ display: grid;
+ min-height: 2.25rem;
+ transition: all 0.15s;
+ }
+
+ ::slotted(.branch.branch-vertical) {
+ top: 50%;
+ bottom: 0;
+ }
+
+ :host([selected]) {
+ background-color: color-mix(
+ in lab,
+ var(--bim-ui_bg-contrast-20) 30%,
+ var(--bim-ui_main-base) 10%
+ );
+ }
+ `;let N8=cre;nU([un({type:Boolean,reflect:!0})],N8.prototype,"selected");nU([un({attribute:!1})],N8.prototype,"columns");nU([un({attribute:!1})],N8.prototype,"hiddenColumns");nU([un({attribute:!1})],N8.prototype,"data");nU([un({type:Boolean,attribute:"is-header",reflect:!0})],N8.prototype,"isHeader");nU([$F()],N8.prototype,"_intersecting");var Hfe=Object.defineProperty,_fe=Object.getOwnPropertyDescriptor,n5=(e,t,n,s)=>{for(var l=s>1?void 0:s?_fe(t,n):t,r=e.length-1,i;r>=0;r--)(i=e[r])&&(l=(s?i(t,n,l):i(l))||l);return s&&l&&Hfe(t,n,l),l};const hre=class extends fr{constructor(){super(...arguments),this._filteredData=[],this.headersHidden=!1,this.minColWidth="4rem",this._columns=[],this._textDelimiters={comma:",",tab:" "},this._queryString=null,this._data=[],this.expanded=!1,this.preserveStructureOnFilter=!1,this.indentationInText=!1,this.dataTransform={},this.selectableRows=!1,this.selection=new Set,this.noIndentation=!1,this.loading=!1,this._errorLoading=!1,this._onColumnsHidden=new Event("columnshidden"),this._hiddenColumns=[],this._stringFilterFunction=(t,n)=>Object.values(n.data).some(s=>String(s).toLowerCase().includes(t.toLowerCase())),this._queryFilterFunction=(t,n)=>{let s=!1;const l=yQ(t)??[];for(const r of l){if("queries"in r){s=!1;break}const{condition:i,value:u}=r;let{key:h}=r;if(h.startsWith("[")&&h.endsWith("]")){const d=h.replace("[","").replace("]","");h=d,s=Object.keys(n.data).filter(I=>I.includes(d)).map(I=>Uv(n.data[I],i,u)).some(I=>I)}else s=Uv(n.data[h],i,u);if(!s)break}return s}}set columns(t){const n=[];for(const s of t){const l=typeof s=="string"?{name:s,width:`minmax(${this.minColWidth}, 1fr)`}:s;n.push(l)}this._columns=n,this.computeMissingColumns(this.data),this.dispatchEvent(new Event("columnschange"))}get columns(){return this._columns}get _headerRowData(){const t={};for(const n of this.columns){const{name:s}=n;t[s]=String(s)}return t}get value(){return this._filteredData}set queryString(t){this.toggleAttribute("data-processing",!0),this._queryString=t&&t.trim()!==""?t.trim():null,this.updateFilteredData(),this.toggleAttribute("data-processing",!1)}get queryString(){return this._queryString}set data(t){this._data=t,this.updateFilteredData(),this.computeMissingColumns(t)&&(this.columns=this._columns)}get data(){return this._data}get dataAsync(){return new Promise(t=>{setTimeout(()=>{t(this.data)})})}set hiddenColumns(t){this._hiddenColumns=t,setTimeout(()=>{this.dispatchEvent(this._onColumnsHidden)})}get hiddenColumns(){return this._hiddenColumns}updateFilteredData(){this.queryString?(yQ(this.queryString)?(this.filterFunction=this._queryFilterFunction,this._filteredData=this.filter(this.queryString)):(this.filterFunction=this._stringFilterFunction,this._filteredData=this.filter(this.queryString)),this.preserveStructureOnFilter&&(this._expandedBeforeFilter===void 0&&(this._expandedBeforeFilter=this.expanded),this.expanded=!0)):(this.preserveStructureOnFilter&&this._expandedBeforeFilter!==void 0&&(this.expanded=this._expandedBeforeFilter,this._expandedBeforeFilter=void 0),this._filteredData=this.data)}computeMissingColumns(t){let n=!1;for(const s of t){const{children:l,data:r}=s;for(const i in r)this._columns.map(u=>typeof u=="string"?u:u.name).includes(i)||(this._columns.push({name:i,width:`minmax(${this.minColWidth}, 1fr)`}),n=!0);if(l){const i=this.computeMissingColumns(l);i&&!n&&(n=i)}}return n}generateText(t="comma",n=this.value,s="",l=!0){const r=this._textDelimiters[t];let i="";const u=this.columns.map(h=>h.name);if(l){this.indentationInText&&(i+=`Indentation${r}`);const h=`${u.join(r)}
+`;i+=h}for(const[h,d]of n.entries()){const{data:I,children:E}=d,y=this.indentationInText?`${s}${h+1}${r}`:"",T=u.map(D=>I[D]??""),S=`${y}${T.join(r)}
+`;i+=S,E&&(i+=this.generateText(t,d.children,`${s}${h+1}.`,!1))}return i}get csv(){return this.generateText("comma")}get tsv(){return this.generateText("tab")}applyDataTransform(t){const n={};for(const l of Object.keys(this.dataTransform)){const r=this.columns.find(i=>i.name===l);r&&r.forceDataTransform&&(l in t||(t[l]=""))}const s=t;for(const l in s){const r=this.dataTransform[l];r?n[l]=r(s[l],t):n[l]=t[l]}return n}downloadData(t="BIM Table Data",n="json"){let s=null;if(n==="json"&&(s=new File([JSON.stringify(this.value,void 0,2)],`${t}.json`)),n==="csv"&&(s=new File([this.csv],`${t}.csv`)),n==="tsv"&&(s=new File([this.tsv],`${t}.tsv`)),!s)return;const l=document.createElement("a");l.href=URL.createObjectURL(s),l.download=s.name,l.click(),URL.revokeObjectURL(l.href)}getRowIndentation(t,n=this.value,s=0){for(const l of n){if(l.data===t)return s;if(l.children){const r=this.getRowIndentation(t,l.children,s+1);if(r!==null)return r}}return null}getGroupIndentation(t,n=this.value,s=0){for(const l of n){if(l===t)return s;if(l.children){const r=this.getGroupIndentation(t,l.children,s+1);if(r!==null)return r}}return null}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new Event("connected"))}disconnectedCallback(){super.disconnectedCallback(),this.dispatchEvent(new Event("disconnected"))}async loadData(t=!1){if(this._filteredData.length!==0&&!t||!this.loadFunction)return!1;this.loading=!0;try{const n=await this.loadFunction();return this.data=n,this.loading=!1,this._errorLoading=!1,!0}catch(n){if(this.loading=!1,this._filteredData.length!==0)return!1;const s=this.querySelector("[slot='error-loading']"),l=s==null?void 0:s.querySelector("[data-table-element='error-message']");return n instanceof Error&&l&&n.message.trim()!==""&&(l.textContent=n.message),this._errorLoading=!0,!1}}filter(t,n=this.filterFunction??this._stringFilterFunction,s=this.data){const l=[];for(const r of s)if(n(t,r)){if(this.preserveStructureOnFilter){const i={data:r.data};if(r.children){const u=this.filter(t,n,r.children);u.length&&(i.children=u)}l.push(i)}else if(l.push({data:r.data}),r.children){const i=this.filter(t,n,r.children);l.push(...i)}}else if(r.children){const i=this.filter(t,n,r.children);this.preserveStructureOnFilter&&i.length?l.push({data:r.data,children:i}):l.push(...i)}return l}get _missingDataElement(){return this.querySelector("[slot='missing-data']")}render(){if(this.loading)return Ofe();if(this._errorLoading)return ls` `;if(this._filteredData.length===0&&this._missingDataElement)return ls` `;const t=document.createElement("bim-table-row");t.table=this,t.isHeader=!0,t.data=this._headerRowData,t.style.gridArea="Header",t.style.position="sticky",t.style.top="0",t.style.zIndex="5";const n=document.createElement("bim-table-children");return n.table=this,n.data=this.value,n.style.gridArea="Body",n.style.backgroundColor="transparent",ls`
+
+ ${this.headersHidden?null:t} ${Lfe()}
+
${n}
+
+ `}};hre.styles=[gO.scrollbar,Lr`
+ :host {
+ position: relative;
+ overflow: auto;
+ display: block;
+ pointer-events: auto;
+ }
+
+ :host(:not([data-processing])) .loader {
+ display: none;
+ }
+
+ .parent {
+ display: grid;
+ grid-template:
+ "Header" auto
+ "Processing" auto
+ "Body" 1fr
+ "Footer" auto;
+ overflow: auto;
+ height: 100%;
+ }
+
+ .parent > bim-table-row[is-header] {
+ color: var(--bim-table_header--c, var(--bim-ui_bg-contrast-100));
+ background-color: var(
+ --bim-table_header--bgc,
+ var(--bim-ui_bg-contrast-20)
+ );
+ }
+
+ .controls {
+ display: flex;
+ gap: 0.375rem;
+ flex-wrap: wrap;
+ margin-bottom: 0.5rem;
+ }
+ `];let Vw=hre;n5([$F()],Vw.prototype,"_filteredData",2);n5([un({type:Boolean,attribute:"headers-hidden",reflect:!0})],Vw.prototype,"headersHidden",2);n5([un({type:String,attribute:"min-col-width",reflect:!0})],Vw.prototype,"minColWidth",2);n5([un({type:Array,attribute:!1})],Vw.prototype,"columns",1);n5([un({type:Array,attribute:!1})],Vw.prototype,"data",1);n5([un({type:Boolean,reflect:!0})],Vw.prototype,"expanded",2);n5([un({type:Boolean,reflect:!0,attribute:"selectable-rows"})],Vw.prototype,"selectableRows",2);n5([un({attribute:!1})],Vw.prototype,"selection",2);n5([un({type:Boolean,attribute:"no-indentation",reflect:!0})],Vw.prototype,"noIndentation",2);n5([un({type:Boolean,reflect:!0})],Vw.prototype,"loading",2);n5([$F()],Vw.prototype,"_errorLoading",2);var Gfe=Object.defineProperty,Vfe=Object.getOwnPropertyDescriptor,sU=(e,t,n,s)=>{for(var l=s>1?void 0:s?Vfe(t,n):t,r=e.length-1,i;r>=0;r--)(i=e[r])&&(l=(s?i(t,n,l):i(l))||l);return s&&l&&Gfe(t,n,l),l};const fre=class extends fr{constructor(){super(...arguments),this._switchers=[],this.bottom=!1,this.switchersHidden=!1,this.floating=!1,this.switchersFull=!1,this.onTabHiddenChange=t=>{const n=t.target;n instanceof fy&&!n.hidden&&(n.removeEventListener("hiddenchange",this.onTabHiddenChange),this.tab=n.name,n.addEventListener("hiddenchange",this.onTabHiddenChange))}}set tab(t){this._tab=t;const n=[...this.children],s=n.find(l=>l instanceof fy&&l.name===t);for(const l of n){if(!(l instanceof fy))continue;l.hidden=s!==l;const r=this.getTabSwitcher(l.name);r&&r.toggleAttribute("data-active",!l.hidden)}s||(this._tab="hidden",this.setAttribute("tab","hidden"))}get tab(){return this._tab}getTabSwitcher(t){return this._switchers.find(n=>n.getAttribute("data-name")===t)}createSwitchers(){this._switchers=[];for(const t of this.children){if(!(t instanceof fy))continue;const n=document.createElement("div");n.addEventListener("click",()=>{this.tab===t.name?this.toggleAttribute("tab",!1):this.tab=t.name,this.setAnimatedBackgound()}),n.setAttribute("data-name",t.name),n.className="switcher";const s=document.createElement("bim-label");s.textContent=t.label??null,s.icon=t.icon,n.append(s),this._switchers.push(n)}}updateSwitchers(){for(const t of this.children){if(!(t instanceof fy))continue;const n=this._switchers.find(l=>l.getAttribute("data-name")===t.name);if(!n)continue;const s=n.querySelector("bim-label");s&&(s.textContent=t.label??null,s.icon=t.icon)}}onSlotChange(t){this.createSwitchers();const n=t.target.assignedElements(),s=n.find(l=>l instanceof fy?this.tab?l.name===this.tab:!l.hidden:!1);s&&s instanceof fy&&(this.tab=s.name);for(const l of n){if(!(l instanceof fy)){l.remove();continue}l.removeEventListener("hiddenchange",this.onTabHiddenChange),s!==l&&(l.hidden=!0),l.addEventListener("hiddenchange",this.onTabHiddenChange)}}doubleRequestAnimationFrames(t){requestAnimationFrame(()=>requestAnimationFrame(t))}setAnimatedBackgound(t=!1){var n;const s=this.renderRoot.querySelector(".animated-background"),l=[...((n=this.renderRoot.querySelector(".switchers"))==null?void 0:n.querySelectorAll(".switcher"))||[]].filter(r=>r.hasAttribute("data-active"))[0];requestAnimationFrame(()=>{var r,i,u,h;const d=(h=(u=(i=(r=l==null?void 0:l.parentElement)==null?void 0:r.shadowRoot)==null?void 0:i.querySelector("bim-input"))==null?void 0:u.shadowRoot)==null?void 0:h.querySelector(".input"),I={width:l==null?void 0:l.clientWidth,height:l==null?void 0:l.clientHeight,top:((l==null?void 0:l.offsetTop)??0)-((d==null?void 0:d.offsetTop)??0),left:((l==null?void 0:l.offsetLeft)??0)-((d==null?void 0:d.offsetLeft)??0)};l?(s==null||s.style.setProperty("width",`${I.width}px`),s==null||s.style.setProperty("height",`${I.height}px`),s==null||s.style.setProperty("left",`${I.left}px`)):s==null||s.style.setProperty("width","0"),this.bottom?(s==null||s.style.setProperty("top","100%"),s==null||s.style.setProperty("transform","translateY(-100%)")):s==null||s.style.setProperty("top",`${I.top}px`)}),t&&this.doubleRequestAnimationFrames(()=>{const r="ease";s==null||s.style.setProperty("transition",`width ${.3}s ${r}, height ${.3}s ${r}, top ${.3}s ${r}, left ${.3}s ${r}`)})}firstUpdated(){requestAnimationFrame(()=>{this.setAnimatedBackgound(!0)}),new ResizeObserver(()=>{this.setAnimatedBackgound()}).observe(this)}render(){return ls`
+
+ `}};fre.styles=[gO.scrollbar,Lr`
+ * {
+ box-sizing: border-box;
+ }
+
+ :host {
+ background-color: var(--bim-ui_bg-base);
+ display: block;
+ overflow: auto;
+ }
+
+ .parent {
+ display: grid;
+ overflow: hidden;
+ position: relative;
+ grid-template: "switchers" auto "content" 1fr;
+ height: 100%;
+ }
+
+ :host([bottom]) .parent {
+ grid-template: "content" 1fr "switchers" auto;
+ }
+
+ .switchers {
+ position: relative;
+ display: flex;
+ height: 2.25rem;
+ font-weight: 600;
+ grid-area: switchers;
+ }
+
+ .switcher {
+ --bim-label--c: var(--bim-ui_bg-contrast-80);
+ background-color: transparent;
+ position: relative;
+ cursor: pointer;
+ pointer-events: auto;
+ padding: 0rem 0.75rem;
+ display: flex;
+ justify-content: center;
+ z-index: 2;
+ transition: all 0.15s;
+ }
+
+ .switcher:not([data-active]):hover {
+ filter: brightness(150%);
+ }
+
+ :host([switchers-full]) .switcher {
+ flex: 1;
+ }
+
+ .switcher[data-active] {
+ --bim-label--c: var(--bim-ui_main-contrast);
+ }
+
+ .switchers bim-label {
+ pointer-events: none;
+ }
+
+ :host([switchers-hidden]) .switchers {
+ display: none;
+ }
+
+ .content {
+ position: relative;
+ display: grid;
+ grid-template-columns: 1fr;
+ grid-area: content;
+ max-height: 100vh;
+ overflow: auto;
+ transition: max-height 0.2s;
+ }
+
+ :host([tab="hidden"]) .content {
+ max-height: 0;
+ }
+
+ .animated-background {
+ position: absolute;
+ background: var(--bim-ui_main-base);
+ width: 0;
+ height: 0;
+ top: 0;
+ left: 0;
+ }
+
+ :host(:not([bottom])) .content {
+ border-top: 1px solid var(--bim-ui_bg-contrast-20);
+ }
+
+ :host([bottom]) .content {
+ border-bottom: 1px solid var(--bim-ui_bg-contrast-20);
+ }
+
+ :host(:not([tab])) .content {
+ display: none;
+ }
+
+ :host([floating]) {
+ background-color: transparent;
+ }
+
+ :host([floating]) .switchers {
+ justify-self: center;
+ overflow: auto;
+ background-color: var(--bim-ui_bg-base);
+ }
+
+ :host([floating]:not([bottom])) .switchers {
+ border-radius: var(--bim-ui_size-2xs) var(--bim-ui_size-2xs) 0 0;
+ border-top: 1px solid var(--bim-ui_bg-contrast-20);
+ border-left: 1px solid var(--bim-ui_bg-contrast-20);
+ border-right: 1px solid var(--bim-ui_bg-contrast-20);
+ }
+
+ :host([floating][bottom]) .switchers {
+ border-radius: 0 0 var(--bim-ui_size-2xs) var(--bim-ui_size-2xs);
+ border-bottom: 1px solid var(--bim-ui_bg-contrast-20);
+ border-left: 1px solid var(--bim-ui_bg-contrast-20);
+ border-right: 1px solid var(--bim-ui_bg-contrast-20);
+ }
+
+ :host([floating]:not([tab])) .switchers {
+ border-radius: var(--bim-ui_size-2xs);
+ border-bottom: 1px solid var(--bim-ui_bg-contrast-20);
+ }
+
+ :host([floating][bottom]:not([tab])) .switchers {
+ border-top: 1px solid var(--bim-ui_bg-contrast-20);
+ }
+
+ :host([floating]) .content {
+ border: 1px solid var(--bim-ui_bg-contrast-20);
+ border-radius: var(--bim-ui_size-2xs);
+ background-color: var(--bim-ui_bg-base);
+ }
+ `];let CO=fre;sU([$F()],CO.prototype,"_switchers",2);sU([un({type:Boolean,reflect:!0})],CO.prototype,"bottom",2);sU([un({type:Boolean,attribute:"switchers-hidden",reflect:!0})],CO.prototype,"switchersHidden",2);sU([un({type:Boolean,reflect:!0})],CO.prototype,"floating",2);sU([un({type:String,reflect:!0})],CO.prototype,"tab",1);sU([un({type:Boolean,attribute:"switchers-full",reflect:!0})],CO.prototype,"switchersFull",2);var zfe=Object.defineProperty,kfe=Object.getOwnPropertyDescriptor,kj=(e,t,n,s)=>{for(var l=s>1?void 0:s?kfe(t,n):t,r=e.length-1,i;r>=0;r--)(i=e[r])&&(l=(s?i(t,n,l):i(l))||l);return s&&l&&zfe(t,n,l),l};const dre=class extends fr{constructor(){super(...arguments),this._defaultName="__unnamed__",this.name=this._defaultName,this._hidden=!1}set label(t){this._label=t;const n=this.parentElement;n instanceof CO&&n.updateSwitchers()}get label(){return this._label}set hidden(t){this._hidden=t,this.dispatchEvent(new Event("hiddenchange"))}get hidden(){return this._hidden}connectedCallback(){super.connectedCallback();const{parentElement:t}=this;if(t&&this.name===this._defaultName){const n=[...t.children].indexOf(this);this.name=`${this._defaultName}${n}`}}render(){return ls` `}};dre.styles=Lr`
+ :host {
+ display: block;
+ height: 100%;
+ grid-row-start: 1;
+ grid-column-start: 1;
+ animation: openAnim 3s forwards;
+ transform: translateY(0);
+ max-height: 100vh;
+ transition:
+ opacity 0.3s ease,
+ max-height 0.6s ease,
+ transform 0.3s ease;
+ }
+
+ :host([hidden]) {
+ transform: translateY(-20px);
+ max-height: 0;
+ opacity: 0;
+ overflow: hidden;
+ visibility: hidden;
+ }
+ `;let fy=dre;kj([un({type:String,reflect:!0})],fy.prototype,"name",2);kj([un({type:String,reflect:!0})],fy.prototype,"label",1);kj([un({type:String,reflect:!0})],fy.prototype,"icon",2);kj([un({type:Boolean,reflect:!0})],fy.prototype,"hidden",1);/**
+ * @license
+ * Copyright 2018 Google LLC
+ * SPDX-License-Identifier: BSD-3-Clause
+ */const Bv=e=>e??Iu;var Yfe=Object.defineProperty,Wfe=Object.getOwnPropertyDescriptor,dN=(e,t,n,s)=>{for(var l=s>1?void 0:s?Wfe(t,n):t,r=e.length-1,i;r>=0;r--)(i=e[r])&&(l=(s?i(t,n,l):i(l))||l);return s&&l&&Yfe(t,n,l),l};const Ire=class extends fr{constructor(){super(...arguments),this._inputTypes=["date","datetime-local","email","month","password","search","tel","text","time","url","week","area"],this.value="",this.vertical=!1,this._type="text",this.onValueChange=new Event("input")}set type(t){this._inputTypes.includes(t)&&(this._type=t)}get type(){return this._type}get query(){return yQ(this.value)}onInputChange(t){t.stopPropagation();const n=t.target;clearTimeout(this._debounceTimeoutID),this._debounceTimeoutID=setTimeout(()=>{this.value=n.value,this.dispatchEvent(this.onValueChange)},this.debounce)}focus(){setTimeout(()=>{var t;const n=(t=this.shadowRoot)==null?void 0:t.querySelector("input");n==null||n.focus()})}render(){return ls`
+
+ ${this.type==="area"?ls` `:ls` `}
+
+ `}};Ire.styles=[gO.scrollbar,Lr`
+ :host {
+ --bim-input--bgc: var(--bim-ui_bg-contrast-20);
+ flex: 1;
+ display: block;
+ }
+
+ input,
+ textarea {
+ font-family: inherit;
+ background-color: transparent;
+ border: none;
+ width: 100%;
+ padding: var(--bim-ui_size-3xs);
+ color: var(--bim-text-input--c, var(--bim-ui_bg-contrast-100));
+ }
+
+ input {
+ outline: none;
+ height: 100%;
+ padding: 0 var(--bim-ui_size-3xs); /* Override padding */
+ border-radius: var(--bim-text-input--bdrs, var(--bim-ui_size-4xs));
+ }
+
+ textarea {
+ line-height: 1.1rem;
+ resize: vertical;
+ }
+
+ :host(:focus) {
+ --bim-input--olc: var(--bim-ui_accent-base);
+ }
+
+ /* :host([disabled]) {
+ --bim-input--bgc: var(--bim-ui_bg-contrast-20);
+ } */
+ `];let jg=Ire;dN([un({type:String,reflect:!0})],jg.prototype,"icon",2);dN([un({type:String,reflect:!0})],jg.prototype,"label",2);dN([un({type:String,reflect:!0})],jg.prototype,"name",2);dN([un({type:String,reflect:!0})],jg.prototype,"placeholder",2);dN([un({type:String,reflect:!0})],jg.prototype,"value",2);dN([un({type:Boolean,reflect:!0})],jg.prototype,"vertical",2);dN([un({type:Number,reflect:!0})],jg.prototype,"debounce",2);dN([un({type:Number,reflect:!0})],jg.prototype,"rows",2);dN([un({type:String,reflect:!0})],jg.prototype,"type",1);var jfe=Object.defineProperty,qfe=Object.getOwnPropertyDescriptor,pre=(e,t,n,s)=>{for(var l=s>1?void 0:s?qfe(t,n):t,r=e.length-1,i;r>=0;r--)(i=e[r])&&(l=(s?i(t,n,l):i(l))||l);return s&&l&&jfe(t,n,l),l};const Ere=class extends fr{constructor(){super(...arguments),this.rows=2,this._vertical=!1}set vertical(t){this._vertical=t,this.updateChildren()}get vertical(){return this._vertical}updateChildren(){const t=this.children;for(const n of t)this.vertical?n.setAttribute("label-hidden",""):n.removeAttribute("label-hidden")}render(){return ls`
+
+
+
+
+ `}};Ere.styles=Lr`
+ .parent {
+ display: grid;
+ gap: 0.25rem;
+ }
+
+ ::slotted(bim-button[label]:not([vertical])) {
+ --bim-button--jc: flex-start;
+ }
+
+ ::slotted(bim-button) {
+ --bim-label--c: var(--bim-ui_bg-contrast-80);
+ }
+ `;let Yj=Ere;pre([un({type:Number,reflect:!0})],Yj.prototype,"rows",2);pre([un({type:Boolean,reflect:!0})],Yj.prototype,"vertical",1);var Zfe=Object.defineProperty,Kfe=Object.getOwnPropertyDescriptor,Wj=(e,t,n,s)=>{for(var l=s>1?void 0:s?Kfe(t,n):t,r=e.length-1,i;r>=0;r--)(i=e[r])&&(l=(s?i(t,n,l):i(l))||l);return s&&l&&Zfe(t,n,l),l};const yre=class extends fr{constructor(){super(...arguments),this._vertical=!1,this._labelHidden=!1}set vertical(t){this._vertical=t,this.updateChildren()}get vertical(){return this._vertical}set labelHidden(t){this._labelHidden=t,this.updateChildren()}get labelHidden(){return this._labelHidden}updateChildren(){const t=this.children;for(const n of t)n instanceof Yj&&(n.vertical=this.vertical),n.toggleAttribute("label-hidden",this.vertical)}render(){return ls`
+
+
+
+
+ ${!this.labelHidden&&(this.label||this.icon)?ls`
${this.label} `:null}
+
+ `}};yre.styles=Lr`
+ :host {
+ --bim-label--fz: var(--bim-ui_size-xs);
+ --bim-label--c: var(--bim-ui_bg-contrast-60);
+ display: block;
+ flex: 1;
+ }
+
+ :host(:not([vertical])) ::slotted(bim-button[vertical]) {
+ --bim-icon--fz: var(--bim-ui_size-5xl);
+ min-height: 3.75rem;
+ }
+
+ ::slotted(bim-button) {
+ --bim-label--c: var(--bim-ui_bg-contrast-80);
+ }
+
+ .parent {
+ display: flex;
+ flex-direction: column;
+ gap: 0.5rem;
+ align-items: center;
+ padding: 0.5rem;
+ height: 100%;
+ box-sizing: border-box;
+ justify-content: space-between;
+ }
+
+ :host([vertical]) .parent {
+ flex-direction: row-reverse;
+ }
+
+ :host([vertical]) .parent > bim-label {
+ writing-mode: tb;
+ }
+
+ .children {
+ display: flex;
+ gap: 0.25rem;
+ }
+
+ :host([vertical]) .children {
+ flex-direction: column;
+ }
+ `;let lU=yre;Wj([un({type:String,reflect:!0})],lU.prototype,"label",2);Wj([un({type:String,reflect:!0})],lU.prototype,"icon",2);Wj([un({type:Boolean,reflect:!0})],lU.prototype,"vertical",1);Wj([un({type:Boolean,attribute:"label-hidden",reflect:!0})],lU.prototype,"labelHidden",1);var Qfe=Object.defineProperty,$fe=Object.getOwnPropertyDescriptor,CJ=(e,t,n,s)=>{for(var l=s>1?void 0:s?$fe(t,n):t,r=e.length-1,i;r>=0;r--)(i=e[r])&&(l=(s?i(t,n,l):i(l))||l);return s&&l&&Qfe(t,n,l),l};const mre=class extends fr{constructor(){super(...arguments),this.labelsHidden=!1,this._vertical=!1,this._hidden=!1}set vertical(t){this._vertical=t,this.updateSections()}get vertical(){return this._vertical}set hidden(t){this._hidden=t,this.dispatchEvent(new Event("hiddenchange"))}get hidden(){return this._hidden}updateSections(){const t=this.children;for(const n of t)n instanceof lU&&(n.labelHidden=this.vertical&&!Wle.config.sectionLabelOnVerticalToolbar,n.vertical=this.vertical)}render(){return ls`
+
+
+
+ `}};mre.styles=Lr`
+ :host {
+ --bim-button--bgc: transparent;
+ background-color: var(--bim-ui_bg-base);
+ border-radius: var(--bim-ui_size-2xs);
+ display: block;
+ }
+
+ :host([hidden]) {
+ display: none;
+ }
+
+ .parent {
+ display: flex;
+ width: max-content;
+ pointer-events: auto;
+ }
+
+ :host([vertical]) .parent {
+ flex-direction: column;
+ }
+
+ :host([vertical]) {
+ width: min-content;
+ border-radius: var(--bim-ui_size-2xs);
+ border: 1px solid var(--bim-ui_bg-contrast-20);
+ }
+
+ ::slotted(bim-toolbar-section:not(:last-child)) {
+ border-right: 1px solid var(--bim-ui_bg-contrast-20);
+ border-bottom: none;
+ }
+
+ :host([vertical]) ::slotted(bim-toolbar-section:not(:last-child)) {
+ border-bottom: 1px solid var(--bim-ui_bg-contrast-20);
+ border-right: none;
+ }
+ `;let jj=mre;CJ([un({type:String,reflect:!0})],jj.prototype,"icon",2);CJ([un({type:Boolean,attribute:"labels-hidden",reflect:!0})],jj.prototype,"labelsHidden",2);CJ([un({type:Boolean,reflect:!0})],jj.prototype,"vertical",1);var Jfe=Object.defineProperty,Xfe=(e,t,n,s)=>{for(var l=void 0,r=e.length-1,i;r>=0;r--)(i=e[r])&&(l=i(t,n,l)||l);return l&&Jfe(t,n,l),l};const Tre=class extends fr{constructor(){super(),this._onResize=new Event("resize"),new ResizeObserver(()=>{setTimeout(()=>{this.dispatchEvent(this._onResize)})}).observe(this)}render(){return ls`
+
+
+
+ `}};Tre.styles=Lr`
+ :host {
+ display: grid;
+ min-width: 0;
+ min-height: 0;
+ height: 100%;
+ }
+
+ .parent {
+ overflow: hidden;
+ position: relative;
+ }
+ `;let wre=Tre;Xfe([un({type:String,reflect:!0})],wre.prototype,"name");/**
+ * @license
+ * Copyright 2018 Google LLC
+ * SPDX-License-Identifier: BSD-3-Clause
+ */const Rre="important",vfe=" !"+Rre,VDe=mle(class extends Tle{constructor(e){var t;if(super(e),e.type!==yle.ATTRIBUTE||e.name!=="style"||((t=e.strings)==null?void 0:t.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce((t,n)=>{const s=e[n];return s==null?t:t+`${n=n.includes("-")?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`},"")}update(e,[t]){const{style:n}=e.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(const s of this.ft)t[s]==null&&(this.ft.delete(s),s.includes("-")?n.removeProperty(s):n[s]=null);for(const s in t){const l=t[s];if(l!=null){this.ft.add(s);const r=typeof l=="string"&&l.endsWith(vfe);s.includes("-")||r?n.setProperty(s,r?l.slice(0,-11):l,r?Rre:""):n[s]=l}}return fP}});/**
+ * @license
+ * Copyright 2010-2023 Three.js Authors
+ * SPDX-License-Identifier: MIT
+ */const NJ="160",gre={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},ede=0,Hv=1,tde=2,Are=1,nde=2,gS=3,n3=0,EI=1,Vu=2,FC=0,mF=1,_v=2,Gv=3,Vv=4,sde=5,Gb=100,lde=101,rde=102,zv=103,kv=104,ide=200,ade=201,ode=202,ude=203,wQ=204,RQ=205,cde=206,hde=207,fde=208,dde=209,Ide=210,pde=211,Ede=212,yde=213,mde=214,Tde=0,wde=1,Rde=2,mj=3,gde=4,Ade=5,Sde=6,Cde=7,DJ=0,Nde=1,Dde=2,UC=0,Ode=1,Lde=2,bde=3,Pde=4,Mde=5,xde=6,Sre=300,xF=301,FF=302,gQ=303,AQ=304,qj=306,rz=1e3,T2=1001,SQ=1002,Zr=1003,Yv=1004,gZ=1005,fI=1006,Fde=1007,iz=1008,rO=1009,Ude=1010,Bde=1011,OJ=1012,Cre=1013,vS=1014,eC=1015,IO=1016,Nre=1017,Dre=1018,jb=1020,Hde=1021,_y=1023,_de=1024,Gde=1025,iO=1026,UF=1027,Ore=1028,Lre=1029,Vde=1030,bre=1031,Pre=1033,AZ=33776,SZ=33777,CZ=33778,NZ=33779,Wv=35840,jv=35841,qv=35842,Zv=35843,Mre=36196,Kv=37492,Qv=37496,$v=37808,Jv=37809,Xv=37810,vv=37811,eee=37812,tee=37813,nee=37814,see=37815,lee=37816,ree=37817,iee=37818,aee=37819,oee=37820,uee=37821,DZ=36492,cee=36494,hee=36495,zde=36283,fee=36284,dee=36285,Iee=36286,xre=3e3,qb=3001,kde=3200,Yde=3201,Fre=0,Wde=1,Gy="",hI="srgb",nN="srgb-linear",LJ="display-p3",Zj="display-p3-linear",Tj="linear",ii="srgb",wj="rec709",Rj="p3",Mx=7680,pee=519,jde=512,qde=513,Zde=514,Ure=515,Kde=516,Qde=517,$de=518,Jde=519,CQ=35044,Xde=35048,Eee="300 es",NQ=1035,tC=2e3,gj=2001;let rU=class{addEventListener(t,n){this._listeners===void 0&&(this._listeners={});const s=this._listeners;s[t]===void 0&&(s[t]=[]),s[t].indexOf(n)===-1&&s[t].push(n)}hasEventListener(t,n){if(this._listeners===void 0)return!1;const s=this._listeners;return s[t]!==void 0&&s[t].indexOf(n)!==-1}removeEventListener(t,n){if(this._listeners===void 0)return;const l=this._listeners[t];if(l!==void 0){const r=l.indexOf(n);r!==-1&&l.splice(r,1)}}dispatchEvent(t){if(this._listeners===void 0)return;const s=this._listeners[t.type];if(s!==void 0){t.target=this;const l=s.slice(0);for(let r=0,i=l.length;r>8&255]+i1[e>>16&255]+i1[e>>24&255]+"-"+i1[t&255]+i1[t>>8&255]+"-"+i1[t>>16&15|64]+i1[t>>24&255]+"-"+i1[n&63|128]+i1[n>>8&255]+"-"+i1[n>>16&255]+i1[n>>24&255]+i1[s&255]+i1[s>>8&255]+i1[s>>16&255]+i1[s>>24&255]).toLowerCase()}function dI(e,t,n){return Math.max(t,Math.min(n,e))}function bJ(e,t){return(e%t+t)%t}function vde(e,t,n,s,l){return s+(e-t)*(l-s)/(n-t)}function eIe(e,t,n){return e!==t?(n-e)/(t-e):0}function qV(e,t,n){return(1-n)*e+n*t}function tIe(e,t,n,s){return qV(e,t,1-Math.exp(-n*s))}function nIe(e,t=1){return t-Math.abs(bJ(e,t*2)-t)}function sIe(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))}function lIe(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*e*(e*(e*6-15)+10))}function rIe(e,t){return e+Math.floor(Math.random()*(t-e+1))}function iIe(e,t){return e+Math.random()*(t-e)}function aIe(e){return e*(.5-Math.random())}function oIe(e){e!==void 0&&(yee=e);let t=yee+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function uIe(e){return e*TF}function cIe(e){return e*az}function DQ(e){return(e&e-1)===0&&e!==0}function hIe(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function Aj(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function fIe(e,t,n,s,l){const r=Math.cos,i=Math.sin,u=r(n/2),h=i(n/2),d=r((t+s)/2),I=i((t+s)/2),E=r((t-s)/2),y=i((t-s)/2),T=r((s-t)/2),S=i((s-t)/2);switch(l){case"XYX":e.set(u*I,h*E,h*y,u*d);break;case"YZY":e.set(h*y,u*I,h*E,u*d);break;case"ZXZ":e.set(h*E,h*y,u*I,u*d);break;case"XZX":e.set(u*I,h*S,h*T,u*d);break;case"YXY":e.set(h*T,u*I,h*S,u*d);break;case"ZYZ":e.set(h*S,h*T,u*I,u*d);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+l)}}function MR(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}function Nr(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(e*4294967295);case Uint16Array:return Math.round(e*65535);case Uint8Array:return Math.round(e*255);case Int32Array:return Math.round(e*2147483647);case Int16Array:return Math.round(e*32767);case Int8Array:return Math.round(e*127);default:throw new Error("Invalid component type.")}}const Q2={DEG2RAD:TF,RAD2DEG:az,generateUUID:BC,clamp:dI,euclideanModulo:bJ,mapLinear:vde,inverseLerp:eIe,lerp:qV,damp:tIe,pingpong:nIe,smoothstep:sIe,smootherstep:lIe,randInt:rIe,randFloat:iIe,randFloatSpread:aIe,seededRandom:oIe,degToRad:uIe,radToDeg:cIe,isPowerOfTwo:DQ,ceilPowerOfTwo:hIe,floorPowerOfTwo:Aj,setQuaternionFromProperEuler:fIe,normalize:Nr,denormalize:MR};class Vn{constructor(t=0,n=0){Vn.prototype.isVector2=!0,this.x=t,this.y=n}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,n){return this.x=t,this.y=n,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,n){switch(t){case 0:this.x=n;break;case 1:this.y=n;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,n){return this.x=t.x+n.x,this.y=t.y+n.y,this}addScaledVector(t,n){return this.x+=t.x*n,this.y+=t.y*n,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,n){return this.x=t.x-n.x,this.y=t.y-n.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const n=this.x,s=this.y,l=t.elements;return this.x=l[0]*n+l[3]*s+l[6],this.y=l[1]*n+l[4]*s+l[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,n){return this.x=Math.max(t.x,Math.min(n.x,this.x)),this.y=Math.max(t.y,Math.min(n.y,this.y)),this}clampScalar(t,n){return this.x=Math.max(t,Math.min(n,this.x)),this.y=Math.max(t,Math.min(n,this.y)),this}clampLength(t,n){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Math.max(t,Math.min(n,s)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const n=Math.sqrt(this.lengthSq()*t.lengthSq());if(n===0)return Math.PI/2;const s=this.dot(t)/n;return Math.acos(dI(s,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const n=this.x-t.x,s=this.y-t.y;return n*n+s*s}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,n){return this.x+=(t.x-this.x)*n,this.y+=(t.y-this.y)*n,this}lerpVectors(t,n,s){return this.x=t.x+(n.x-t.x)*s,this.y=t.y+(n.y-t.y)*s,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,n=0){return this.x=t[n],this.y=t[n+1],this}toArray(t=[],n=0){return t[n]=this.x,t[n+1]=this.y,t}fromBufferAttribute(t,n){return this.x=t.getX(n),this.y=t.getY(n),this}rotateAround(t,n){const s=Math.cos(n),l=Math.sin(n),r=this.x-t.x,i=this.y-t.y;return this.x=r*s-i*l+t.x,this.y=r*l+i*s+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Rs{constructor(t,n,s,l,r,i,u,h,d){Rs.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,n,s,l,r,i,u,h,d)}set(t,n,s,l,r,i,u,h,d){const I=this.elements;return I[0]=t,I[1]=l,I[2]=u,I[3]=n,I[4]=r,I[5]=h,I[6]=s,I[7]=i,I[8]=d,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const n=this.elements,s=t.elements;return n[0]=s[0],n[1]=s[1],n[2]=s[2],n[3]=s[3],n[4]=s[4],n[5]=s[5],n[6]=s[6],n[7]=s[7],n[8]=s[8],this}extractBasis(t,n,s){return t.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),s.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const n=t.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,n){const s=t.elements,l=n.elements,r=this.elements,i=s[0],u=s[3],h=s[6],d=s[1],I=s[4],E=s[7],y=s[2],T=s[5],S=s[8],D=l[0],O=l[3],N=l[6],H=l[1],_=l[4],U=l[7],Z=l[2],se=l[5],ae=l[8];return r[0]=i*D+u*H+h*Z,r[3]=i*O+u*_+h*se,r[6]=i*N+u*U+h*ae,r[1]=d*D+I*H+E*Z,r[4]=d*O+I*_+E*se,r[7]=d*N+I*U+E*ae,r[2]=y*D+T*H+S*Z,r[5]=y*O+T*_+S*se,r[8]=y*N+T*U+S*ae,this}multiplyScalar(t){const n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=t,n[4]*=t,n[7]*=t,n[2]*=t,n[5]*=t,n[8]*=t,this}determinant(){const t=this.elements,n=t[0],s=t[1],l=t[2],r=t[3],i=t[4],u=t[5],h=t[6],d=t[7],I=t[8];return n*i*I-n*u*d-s*r*I+s*u*h+l*r*d-l*i*h}invert(){const t=this.elements,n=t[0],s=t[1],l=t[2],r=t[3],i=t[4],u=t[5],h=t[6],d=t[7],I=t[8],E=I*i-u*d,y=u*h-I*r,T=d*r-i*h,S=n*E+s*y+l*T;if(S===0)return this.set(0,0,0,0,0,0,0,0,0);const D=1/S;return t[0]=E*D,t[1]=(l*d-I*s)*D,t[2]=(u*s-l*i)*D,t[3]=y*D,t[4]=(I*n-l*h)*D,t[5]=(l*r-u*n)*D,t[6]=T*D,t[7]=(s*h-d*n)*D,t[8]=(i*n-s*r)*D,this}transpose(){let t;const n=this.elements;return t=n[1],n[1]=n[3],n[3]=t,t=n[2],n[2]=n[6],n[6]=t,t=n[5],n[5]=n[7],n[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const n=this.elements;return t[0]=n[0],t[1]=n[3],t[2]=n[6],t[3]=n[1],t[4]=n[4],t[5]=n[7],t[6]=n[2],t[7]=n[5],t[8]=n[8],this}setUvTransform(t,n,s,l,r,i,u){const h=Math.cos(r),d=Math.sin(r);return this.set(s*h,s*d,-s*(h*i+d*u)+i+t,-l*d,l*h,-l*(-d*i+h*u)+u+n,0,0,1),this}scale(t,n){return this.premultiply(OZ.makeScale(t,n)),this}rotate(t){return this.premultiply(OZ.makeRotation(-t)),this}translate(t,n){return this.premultiply(OZ.makeTranslation(t,n)),this}makeTranslation(t,n){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,n,0,0,1),this}makeRotation(t){const n=Math.cos(t),s=Math.sin(t);return this.set(n,-s,0,s,n,0,0,0,1),this}makeScale(t,n){return this.set(t,0,0,0,n,0,0,0,1),this}equals(t){const n=this.elements,s=t.elements;for(let l=0;l<9;l++)if(n[l]!==s[l])return!1;return!0}fromArray(t,n=0){for(let s=0;s<9;s++)this.elements[s]=t[s+n];return this}toArray(t=[],n=0){const s=this.elements;return t[n]=s[0],t[n+1]=s[1],t[n+2]=s[2],t[n+3]=s[3],t[n+4]=s[4],t[n+5]=s[5],t[n+6]=s[6],t[n+7]=s[7],t[n+8]=s[8],t}clone(){return new this.constructor().fromArray(this.elements)}}const OZ=new Rs;function Bre(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function Sj(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function dIe(){const e=Sj("canvas");return e.style.display="block",e}const mee={};function ZV(e){e in mee||(mee[e]=!0,console.warn(e))}const Tee=new Rs().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),wee=new Rs().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),dk={[nN]:{transfer:Tj,primaries:wj,toReference:e=>e,fromReference:e=>e},[hI]:{transfer:ii,primaries:wj,toReference:e=>e.convertSRGBToLinear(),fromReference:e=>e.convertLinearToSRGB()},[Zj]:{transfer:Tj,primaries:Rj,toReference:e=>e.applyMatrix3(wee),fromReference:e=>e.applyMatrix3(Tee)},[LJ]:{transfer:ii,primaries:Rj,toReference:e=>e.convertSRGBToLinear().applyMatrix3(wee),fromReference:e=>e.applyMatrix3(Tee).convertLinearToSRGB()}},IIe=new Set([nN,Zj]),vs={enabled:!0,_workingColorSpace:nN,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(e){if(!IIe.has(e))throw new Error(`Unsupported working color space, "${e}".`);this._workingColorSpace=e},convert:function(e,t,n){if(this.enabled===!1||t===n||!t||!n)return e;const s=dk[t].toReference,l=dk[n].fromReference;return l(s(e))},fromWorkingColorSpace:function(e,t){return this.convert(e,this._workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this._workingColorSpace)},getPrimaries:function(e){return dk[e].primaries},getTransfer:function(e){return e===Gy?Tj:dk[e].transfer}};function wF(e){return e<.04045?e*.0773993808:Math.pow(e*.9478672986+.0521327014,2.4)}function LZ(e){return e<.0031308?e*12.92:1.055*Math.pow(e,.41666)-.055}let xx;class Hre{static getDataURL(t){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let n;if(t instanceof HTMLCanvasElement)n=t;else{xx===void 0&&(xx=Sj("canvas")),xx.width=t.width,xx.height=t.height;const s=xx.getContext("2d");t instanceof ImageData?s.putImageData(t,0,0):s.drawImage(t,0,0,t.width,t.height),n=xx}return n.width>2048||n.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),n.toDataURL("image/jpeg",.6)):n.toDataURL("image/png")}static sRGBToLinear(t){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){const n=Sj("canvas");n.width=t.width,n.height=t.height;const s=n.getContext("2d");s.drawImage(t,0,0,t.width,t.height);const l=s.getImageData(0,0,t.width,t.height),r=l.data;for(let i=0;i0&&(s.userData=this.userData),n||(t.textures[this.uuid]=s),s}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==Sre)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case rz:t.x=t.x-Math.floor(t.x);break;case T2:t.x=t.x<0?0:1;break;case SQ:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case rz:t.y=t.y-Math.floor(t.y);break;case T2:t.y=t.y<0?0:1;break;case SQ:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return ZV("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===hI?qb:xre}set encoding(t){ZV("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=t===qb?hI:Gy}}vE.DEFAULT_IMAGE=null;vE.DEFAULT_MAPPING=Sre;vE.DEFAULT_ANISOTROPY=1;class ia{constructor(t=0,n=0,s=0,l=1){ia.prototype.isVector4=!0,this.x=t,this.y=n,this.z=s,this.w=l}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,n,s,l){return this.x=t,this.y=n,this.z=s,this.w=l,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,n){switch(t){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;case 3:this.w=n;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,n){return this.x=t.x+n.x,this.y=t.y+n.y,this.z=t.z+n.z,this.w=t.w+n.w,this}addScaledVector(t,n){return this.x+=t.x*n,this.y+=t.y*n,this.z+=t.z*n,this.w+=t.w*n,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,n){return this.x=t.x-n.x,this.y=t.y-n.y,this.z=t.z-n.z,this.w=t.w-n.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const n=this.x,s=this.y,l=this.z,r=this.w,i=t.elements;return this.x=i[0]*n+i[4]*s+i[8]*l+i[12]*r,this.y=i[1]*n+i[5]*s+i[9]*l+i[13]*r,this.z=i[2]*n+i[6]*s+i[10]*l+i[14]*r,this.w=i[3]*n+i[7]*s+i[11]*l+i[15]*r,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const n=Math.sqrt(1-t.w*t.w);return n<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/n,this.y=t.y/n,this.z=t.z/n),this}setAxisAngleFromRotationMatrix(t){let n,s,l,r;const h=t.elements,d=h[0],I=h[4],E=h[8],y=h[1],T=h[5],S=h[9],D=h[2],O=h[6],N=h[10];if(Math.abs(I-y)<.01&&Math.abs(E-D)<.01&&Math.abs(S-O)<.01){if(Math.abs(I+y)<.1&&Math.abs(E+D)<.1&&Math.abs(S+O)<.1&&Math.abs(d+T+N-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const _=(d+1)/2,U=(T+1)/2,Z=(N+1)/2,se=(I+y)/4,ae=(E+D)/4,ye=(S+O)/4;return _>U&&_>Z?_<.01?(s=0,l=.707106781,r=.707106781):(s=Math.sqrt(_),l=se/s,r=ae/s):U>Z?U<.01?(s=.707106781,l=0,r=.707106781):(l=Math.sqrt(U),s=se/l,r=ye/l):Z<.01?(s=.707106781,l=.707106781,r=0):(r=Math.sqrt(Z),s=ae/r,l=ye/r),this.set(s,l,r,n),this}let H=Math.sqrt((O-S)*(O-S)+(E-D)*(E-D)+(y-I)*(y-I));return Math.abs(H)<.001&&(H=1),this.x=(O-S)/H,this.y=(E-D)/H,this.z=(y-I)/H,this.w=Math.acos((d+T+N-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,n){return this.x=Math.max(t.x,Math.min(n.x,this.x)),this.y=Math.max(t.y,Math.min(n.y,this.y)),this.z=Math.max(t.z,Math.min(n.z,this.z)),this.w=Math.max(t.w,Math.min(n.w,this.w)),this}clampScalar(t,n){return this.x=Math.max(t,Math.min(n,this.x)),this.y=Math.max(t,Math.min(n,this.y)),this.z=Math.max(t,Math.min(n,this.z)),this.w=Math.max(t,Math.min(n,this.w)),this}clampLength(t,n){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Math.max(t,Math.min(n,s)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,n){return this.x+=(t.x-this.x)*n,this.y+=(t.y-this.y)*n,this.z+=(t.z-this.z)*n,this.w+=(t.w-this.w)*n,this}lerpVectors(t,n,s){return this.x=t.x+(n.x-t.x)*s,this.y=t.y+(n.y-t.y)*s,this.z=t.z+(n.z-t.z)*s,this.w=t.w+(n.w-t.w)*s,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,n=0){return this.x=t[n],this.y=t[n+1],this.z=t[n+2],this.w=t[n+3],this}toArray(t=[],n=0){return t[n]=this.x,t[n+1]=this.y,t[n+2]=this.z,t[n+3]=this.w,t}fromBufferAttribute(t,n){return this.x=t.getX(n),this.y=t.getY(n),this.z=t.getZ(n),this.w=t.getW(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class yIe extends rU{constructor(t=1,n=1,s={}){super(),this.isRenderTarget=!0,this.width=t,this.height=n,this.depth=1,this.scissor=new ia(0,0,t,n),this.scissorTest=!1,this.viewport=new ia(0,0,t,n);const l={width:t,height:n,depth:1};s.encoding!==void 0&&(ZV("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),s.colorSpace=s.encoding===qb?hI:Gy),s=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:fI,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},s),this.texture=new vE(l,s.mapping,s.wrapS,s.wrapT,s.magFilter,s.minFilter,s.format,s.type,s.anisotropy,s.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=s.generateMipmaps,this.texture.internalFormat=s.internalFormat,this.depthBuffer=s.depthBuffer,this.stencilBuffer=s.stencilBuffer,this.depthTexture=s.depthTexture,this.samples=s.samples}setSize(t,n,s=1){(this.width!==t||this.height!==n||this.depth!==s)&&(this.width=t,this.height=n,this.depth=s,this.texture.image.width=t,this.texture.image.height=n,this.texture.image.depth=s,this.dispose()),this.viewport.set(0,0,t,n),this.scissor.set(0,0,t,n)}clone(){return new this.constructor().copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.texture.isRenderTargetTexture=!0;const n=Object.assign({},t.texture.image);return this.texture.source=new _re(n),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,t.depthTexture!==null&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class qu extends yIe{constructor(t=1,n=1,s={}){super(t,n,s),this.isWebGLRenderTarget=!0}}class Gre extends vE{constructor(t=null,n=1,s=1,l=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:n,height:s,depth:l},this.magFilter=Zr,this.minFilter=Zr,this.wrapR=T2,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class mIe extends vE{constructor(t=null,n=1,s=1,l=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:n,height:s,depth:l},this.magFilter=Zr,this.minFilter=Zr,this.wrapR=T2,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class TIe extends qu{constructor(t=1,n=1,s=1,l={}){super(t,n,l),this.isWebGLMultipleRenderTargets=!0;const r=this.texture;this.texture=[];for(let i=0;i=0?1:-1,_=1-N*N;if(_>Number.EPSILON){const Z=Math.sqrt(_),se=Math.atan2(Z,N*H);O=Math.sin(O*se)/Z,u=Math.sin(u*se)/Z}const U=u*H;if(h=h*O+y*U,d=d*O+T*U,I=I*O+S*U,E=E*O+D*U,O===1-u){const Z=1/Math.sqrt(h*h+d*d+I*I+E*E);h*=Z,d*=Z,I*=Z,E*=Z}}t[n]=h,t[n+1]=d,t[n+2]=I,t[n+3]=E}static multiplyQuaternionsFlat(t,n,s,l,r,i){const u=s[l],h=s[l+1],d=s[l+2],I=s[l+3],E=r[i],y=r[i+1],T=r[i+2],S=r[i+3];return t[n]=u*S+I*E+h*T-d*y,t[n+1]=h*S+I*y+d*E-u*T,t[n+2]=d*S+I*T+u*y-h*E,t[n+3]=I*S-u*E-h*y-d*T,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,n,s,l){return this._x=t,this._y=n,this._z=s,this._w=l,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,n=!0){const s=t._x,l=t._y,r=t._z,i=t._order,u=Math.cos,h=Math.sin,d=u(s/2),I=u(l/2),E=u(r/2),y=h(s/2),T=h(l/2),S=h(r/2);switch(i){case"XYZ":this._x=y*I*E+d*T*S,this._y=d*T*E-y*I*S,this._z=d*I*S+y*T*E,this._w=d*I*E-y*T*S;break;case"YXZ":this._x=y*I*E+d*T*S,this._y=d*T*E-y*I*S,this._z=d*I*S-y*T*E,this._w=d*I*E+y*T*S;break;case"ZXY":this._x=y*I*E-d*T*S,this._y=d*T*E+y*I*S,this._z=d*I*S+y*T*E,this._w=d*I*E-y*T*S;break;case"ZYX":this._x=y*I*E-d*T*S,this._y=d*T*E+y*I*S,this._z=d*I*S-y*T*E,this._w=d*I*E+y*T*S;break;case"YZX":this._x=y*I*E+d*T*S,this._y=d*T*E+y*I*S,this._z=d*I*S-y*T*E,this._w=d*I*E-y*T*S;break;case"XZY":this._x=y*I*E-d*T*S,this._y=d*T*E-y*I*S,this._z=d*I*S+y*T*E,this._w=d*I*E+y*T*S;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+i)}return n===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,n){const s=n/2,l=Math.sin(s);return this._x=t.x*l,this._y=t.y*l,this._z=t.z*l,this._w=Math.cos(s),this._onChangeCallback(),this}setFromRotationMatrix(t){const n=t.elements,s=n[0],l=n[4],r=n[8],i=n[1],u=n[5],h=n[9],d=n[2],I=n[6],E=n[10],y=s+u+E;if(y>0){const T=.5/Math.sqrt(y+1);this._w=.25/T,this._x=(I-h)*T,this._y=(r-d)*T,this._z=(i-l)*T}else if(s>u&&s>E){const T=2*Math.sqrt(1+s-u-E);this._w=(I-h)/T,this._x=.25*T,this._y=(l+i)/T,this._z=(r+d)/T}else if(u>E){const T=2*Math.sqrt(1+u-s-E);this._w=(r-d)/T,this._x=(l+i)/T,this._y=.25*T,this._z=(h+I)/T}else{const T=2*Math.sqrt(1+E-s-u);this._w=(i-l)/T,this._x=(r+d)/T,this._y=(h+I)/T,this._z=.25*T}return this._onChangeCallback(),this}setFromUnitVectors(t,n){let s=t.dot(n)+1;return sMath.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=s):(this._x=0,this._y=-t.z,this._z=t.y,this._w=s)):(this._x=t.y*n.z-t.z*n.y,this._y=t.z*n.x-t.x*n.z,this._z=t.x*n.y-t.y*n.x,this._w=s),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(dI(this.dot(t),-1,1)))}rotateTowards(t,n){const s=this.angleTo(t);if(s===0)return this;const l=Math.min(1,n/s);return this.slerp(t,l),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,n){const s=t._x,l=t._y,r=t._z,i=t._w,u=n._x,h=n._y,d=n._z,I=n._w;return this._x=s*I+i*u+l*d-r*h,this._y=l*I+i*h+r*u-s*d,this._z=r*I+i*d+s*h-l*u,this._w=i*I-s*u-l*h-r*d,this._onChangeCallback(),this}slerp(t,n){if(n===0)return this;if(n===1)return this.copy(t);const s=this._x,l=this._y,r=this._z,i=this._w;let u=i*t._w+s*t._x+l*t._y+r*t._z;if(u<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,u=-u):this.copy(t),u>=1)return this._w=i,this._x=s,this._y=l,this._z=r,this;const h=1-u*u;if(h<=Number.EPSILON){const T=1-n;return this._w=T*i+n*this._w,this._x=T*s+n*this._x,this._y=T*l+n*this._y,this._z=T*r+n*this._z,this.normalize(),this}const d=Math.sqrt(h),I=Math.atan2(d,u),E=Math.sin((1-n)*I)/d,y=Math.sin(n*I)/d;return this._w=i*E+this._w*y,this._x=s*E+this._x*y,this._y=l*E+this._y*y,this._z=r*E+this._z*y,this._onChangeCallback(),this}slerpQuaternions(t,n,s){return this.copy(t).slerp(n,s)}random(){const t=Math.random(),n=Math.sqrt(1-t),s=Math.sqrt(t),l=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(n*Math.cos(l),s*Math.sin(r),s*Math.cos(r),n*Math.sin(l))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,n=0){return this._x=t[n],this._y=t[n+1],this._z=t[n+2],this._w=t[n+3],this._onChangeCallback(),this}toArray(t=[],n=0){return t[n]=this._x,t[n+1]=this._y,t[n+2]=this._z,t[n+3]=this._w,t}fromBufferAttribute(t,n){return this._x=t.getX(n),this._y=t.getY(n),this._z=t.getZ(n),this._w=t.getW(n),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class De{constructor(t=0,n=0,s=0){De.prototype.isVector3=!0,this.x=t,this.y=n,this.z=s}set(t,n,s){return s===void 0&&(s=this.z),this.x=t,this.y=n,this.z=s,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,n){switch(t){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,n){return this.x=t.x+n.x,this.y=t.y+n.y,this.z=t.z+n.z,this}addScaledVector(t,n){return this.x+=t.x*n,this.y+=t.y*n,this.z+=t.z*n,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,n){return this.x=t.x-n.x,this.y=t.y-n.y,this.z=t.z-n.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,n){return this.x=t.x*n.x,this.y=t.y*n.y,this.z=t.z*n.z,this}applyEuler(t){return this.applyQuaternion(Ree.setFromEuler(t))}applyAxisAngle(t,n){return this.applyQuaternion(Ree.setFromAxisAngle(t,n))}applyMatrix3(t){const n=this.x,s=this.y,l=this.z,r=t.elements;return this.x=r[0]*n+r[3]*s+r[6]*l,this.y=r[1]*n+r[4]*s+r[7]*l,this.z=r[2]*n+r[5]*s+r[8]*l,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const n=this.x,s=this.y,l=this.z,r=t.elements,i=1/(r[3]*n+r[7]*s+r[11]*l+r[15]);return this.x=(r[0]*n+r[4]*s+r[8]*l+r[12])*i,this.y=(r[1]*n+r[5]*s+r[9]*l+r[13])*i,this.z=(r[2]*n+r[6]*s+r[10]*l+r[14])*i,this}applyQuaternion(t){const n=this.x,s=this.y,l=this.z,r=t.x,i=t.y,u=t.z,h=t.w,d=2*(i*l-u*s),I=2*(u*n-r*l),E=2*(r*s-i*n);return this.x=n+h*d+i*E-u*I,this.y=s+h*I+u*d-r*E,this.z=l+h*E+r*I-i*d,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const n=this.x,s=this.y,l=this.z,r=t.elements;return this.x=r[0]*n+r[4]*s+r[8]*l,this.y=r[1]*n+r[5]*s+r[9]*l,this.z=r[2]*n+r[6]*s+r[10]*l,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,n){return this.x=Math.max(t.x,Math.min(n.x,this.x)),this.y=Math.max(t.y,Math.min(n.y,this.y)),this.z=Math.max(t.z,Math.min(n.z,this.z)),this}clampScalar(t,n){return this.x=Math.max(t,Math.min(n,this.x)),this.y=Math.max(t,Math.min(n,this.y)),this.z=Math.max(t,Math.min(n,this.z)),this}clampLength(t,n){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Math.max(t,Math.min(n,s)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,n){return this.x+=(t.x-this.x)*n,this.y+=(t.y-this.y)*n,this.z+=(t.z-this.z)*n,this}lerpVectors(t,n,s){return this.x=t.x+(n.x-t.x)*s,this.y=t.y+(n.y-t.y)*s,this.z=t.z+(n.z-t.z)*s,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,n){const s=t.x,l=t.y,r=t.z,i=n.x,u=n.y,h=n.z;return this.x=l*h-r*u,this.y=r*i-s*h,this.z=s*u-l*i,this}projectOnVector(t){const n=t.lengthSq();if(n===0)return this.set(0,0,0);const s=t.dot(this)/n;return this.copy(t).multiplyScalar(s)}projectOnPlane(t){return PZ.copy(this).projectOnVector(t),this.sub(PZ)}reflect(t){return this.sub(PZ.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const n=Math.sqrt(this.lengthSq()*t.lengthSq());if(n===0)return Math.PI/2;const s=this.dot(t)/n;return Math.acos(dI(s,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const n=this.x-t.x,s=this.y-t.y,l=this.z-t.z;return n*n+s*s+l*l}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,n,s){const l=Math.sin(n)*t;return this.x=l*Math.sin(s),this.y=Math.cos(n)*t,this.z=l*Math.cos(s),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,n,s){return this.x=t*Math.sin(n),this.y=s,this.z=t*Math.cos(n),this}setFromMatrixPosition(t){const n=t.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this}setFromMatrixScale(t){const n=this.setFromMatrixColumn(t,0).length(),s=this.setFromMatrixColumn(t,1).length(),l=this.setFromMatrixColumn(t,2).length();return this.x=n,this.y=s,this.z=l,this}setFromMatrixColumn(t,n){return this.fromArray(t.elements,n*4)}setFromMatrix3Column(t,n){return this.fromArray(t.elements,n*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,n=0){return this.x=t[n],this.y=t[n+1],this.z=t[n+2],this}toArray(t=[],n=0){return t[n]=this.x,t[n+1]=this.y,t[n+2]=this.z,t}fromBufferAttribute(t,n){return this.x=t.getX(n),this.y=t.getY(n),this.z=t.getZ(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=(Math.random()-.5)*2,n=Math.random()*Math.PI*2,s=Math.sqrt(1-t**2);return this.x=s*Math.cos(n),this.y=s*Math.sin(n),this.z=t,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const PZ=new De,Ree=new Dr;class rs{constructor(t=new De(1/0,1/0,1/0),n=new De(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=n}set(t,n){return this.min.copy(t),this.max.copy(n),this}setFromArray(t){this.makeEmpty();for(let n=0,s=t.length;nthis.max.x||t.ythis.max.y||t.zthis.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,n){return n.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)}intersectsSphere(t){return this.clampPoint(t.center,a2),a2.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let n,s;return t.normal.x>0?(n=t.normal.x*this.min.x,s=t.normal.x*this.max.x):(n=t.normal.x*this.max.x,s=t.normal.x*this.min.x),t.normal.y>0?(n+=t.normal.y*this.min.y,s+=t.normal.y*this.max.y):(n+=t.normal.y*this.max.y,s+=t.normal.y*this.min.y),t.normal.z>0?(n+=t.normal.z*this.min.z,s+=t.normal.z*this.max.z):(n+=t.normal.z*this.max.z,s+=t.normal.z*this.min.z),n<=-t.constant&&s>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(IG),pk.subVectors(this.max,IG),Fx.subVectors(t.a,IG),Ux.subVectors(t.b,IG),Bx.subVectors(t.c,IG),nD.subVectors(Ux,Fx),sD.subVectors(Bx,Ux),_7.subVectors(Fx,Bx);let n=[0,-nD.z,nD.y,0,-sD.z,sD.y,0,-_7.z,_7.y,nD.z,0,-nD.x,sD.z,0,-sD.x,_7.z,0,-_7.x,-nD.y,nD.x,0,-sD.y,sD.x,0,-_7.y,_7.x,0];return!MZ(n,Fx,Ux,Bx,pk)||(n=[1,0,0,0,1,0,0,0,1],!MZ(n,Fx,Ux,Bx,pk))?!1:(Ek.crossVectors(nD,sD),n=[Ek.x,Ek.y,Ek.z],MZ(n,Fx,Ux,Bx,pk))}clampPoint(t,n){return n.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,a2).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(a2).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(yS[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),yS[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),yS[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),yS[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),yS[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),yS[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),yS[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),yS[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(yS),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const yS=[new De,new De,new De,new De,new De,new De,new De,new De],a2=new De,Ik=new rs,Fx=new De,Ux=new De,Bx=new De,nD=new De,sD=new De,_7=new De,IG=new De,pk=new De,Ek=new De,G7=new De;function MZ(e,t,n,s,l){for(let r=0,i=e.length-3;r<=i;r+=3){G7.fromArray(e,r);const u=l.x*Math.abs(G7.x)+l.y*Math.abs(G7.y)+l.z*Math.abs(G7.z),h=t.dot(G7),d=n.dot(G7),I=s.dot(G7);if(Math.max(-Math.max(h,d,I),Math.min(h,d,I))>u)return!1}return!0}const wIe=new rs,pG=new De,xZ=new De;class wh{constructor(t=new De,n=-1){this.isSphere=!0,this.center=t,this.radius=n}set(t,n){return this.center.copy(t),this.radius=n,this}setFromPoints(t,n){const s=this.center;n!==void 0?s.copy(n):wIe.setFromPoints(t).getCenter(s);let l=0;for(let r=0,i=t.length;rthis.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;pG.subVectors(t,this.center);const n=pG.lengthSq();if(n>this.radius*this.radius){const s=Math.sqrt(n),l=(s-this.radius)*.5;this.center.addScaledVector(pG,l/s),this.radius+=l}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(xZ.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(pG.copy(t.center).add(xZ)),this.expandByPoint(pG.copy(t.center).sub(xZ))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}}const mS=new De,FZ=new De,yk=new De,lD=new De,UZ=new De,mk=new De,BZ=new De;class D8{constructor(t=new De,n=new De(0,0,-1)){this.origin=t,this.direction=n}set(t,n){return this.origin.copy(t),this.direction.copy(n),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,n){return n.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,mS)),this}closestPointToPoint(t,n){n.subVectors(t,this.origin);const s=n.dot(this.direction);return s<0?n.copy(this.origin):n.copy(this.origin).addScaledVector(this.direction,s)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const n=mS.subVectors(t,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(t):(mS.copy(this.origin).addScaledVector(this.direction,n),mS.distanceToSquared(t))}distanceSqToSegment(t,n,s,l){FZ.copy(t).add(n).multiplyScalar(.5),yk.copy(n).sub(t).normalize(),lD.copy(this.origin).sub(FZ);const r=t.distanceTo(n)*.5,i=-this.direction.dot(yk),u=lD.dot(this.direction),h=-lD.dot(yk),d=lD.lengthSq(),I=Math.abs(1-i*i);let E,y,T,S;if(I>0)if(E=i*h-u,y=i*u-h,S=r*I,E>=0)if(y>=-S)if(y<=S){const D=1/I;E*=D,y*=D,T=E*(E+i*y+2*u)+y*(i*E+y+2*h)+d}else y=r,E=Math.max(0,-(i*y+u)),T=-E*E+y*(y+2*h)+d;else y=-r,E=Math.max(0,-(i*y+u)),T=-E*E+y*(y+2*h)+d;else y<=-S?(E=Math.max(0,-(-i*r+u)),y=E>0?-r:Math.min(Math.max(-r,-h),r),T=-E*E+y*(y+2*h)+d):y<=S?(E=0,y=Math.min(Math.max(-r,-h),r),T=y*(y+2*h)+d):(E=Math.max(0,-(i*r+u)),y=E>0?r:Math.min(Math.max(-r,-h),r),T=-E*E+y*(y+2*h)+d);else y=i>0?-r:r,E=Math.max(0,-(i*y+u)),T=-E*E+y*(y+2*h)+d;return s&&s.copy(this.origin).addScaledVector(this.direction,E),l&&l.copy(FZ).addScaledVector(yk,y),T}intersectSphere(t,n){mS.subVectors(t.center,this.origin);const s=mS.dot(this.direction),l=mS.dot(mS)-s*s,r=t.radius*t.radius;if(l>r)return null;const i=Math.sqrt(r-l),u=s-i,h=s+i;return h<0?null:u<0?this.at(h,n):this.at(u,n)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const n=t.normal.dot(this.direction);if(n===0)return t.distanceToPoint(this.origin)===0?0:null;const s=-(this.origin.dot(t.normal)+t.constant)/n;return s>=0?s:null}intersectPlane(t,n){const s=this.distanceToPlane(t);return s===null?null:this.at(s,n)}intersectsPlane(t){const n=t.distanceToPoint(this.origin);return n===0||t.normal.dot(this.direction)*n<0}intersectBox(t,n){let s,l,r,i,u,h;const d=1/this.direction.x,I=1/this.direction.y,E=1/this.direction.z,y=this.origin;return d>=0?(s=(t.min.x-y.x)*d,l=(t.max.x-y.x)*d):(s=(t.max.x-y.x)*d,l=(t.min.x-y.x)*d),I>=0?(r=(t.min.y-y.y)*I,i=(t.max.y-y.y)*I):(r=(t.max.y-y.y)*I,i=(t.min.y-y.y)*I),s>i||r>l||((r>s||isNaN(s))&&(s=r),(i=0?(u=(t.min.z-y.z)*E,h=(t.max.z-y.z)*E):(u=(t.max.z-y.z)*E,h=(t.min.z-y.z)*E),s>h||u>l)||((u>s||s!==s)&&(s=u),(h=0?s:l,n)}intersectsBox(t){return this.intersectBox(t,mS)!==null}intersectTriangle(t,n,s,l,r){UZ.subVectors(n,t),mk.subVectors(s,t),BZ.crossVectors(UZ,mk);let i=this.direction.dot(BZ),u;if(i>0){if(l)return null;u=1}else if(i<0)u=-1,i=-i;else return null;lD.subVectors(this.origin,t);const h=u*this.direction.dot(mk.crossVectors(lD,mk));if(h<0)return null;const d=u*this.direction.dot(UZ.cross(lD));if(d<0||h+d>i)return null;const I=-u*lD.dot(BZ);return I<0?null:this.at(I/i,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Jt{constructor(t,n,s,l,r,i,u,h,d,I,E,y,T,S,D,O){Jt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,n,s,l,r,i,u,h,d,I,E,y,T,S,D,O)}set(t,n,s,l,r,i,u,h,d,I,E,y,T,S,D,O){const N=this.elements;return N[0]=t,N[4]=n,N[8]=s,N[12]=l,N[1]=r,N[5]=i,N[9]=u,N[13]=h,N[2]=d,N[6]=I,N[10]=E,N[14]=y,N[3]=T,N[7]=S,N[11]=D,N[15]=O,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Jt().fromArray(this.elements)}copy(t){const n=this.elements,s=t.elements;return n[0]=s[0],n[1]=s[1],n[2]=s[2],n[3]=s[3],n[4]=s[4],n[5]=s[5],n[6]=s[6],n[7]=s[7],n[8]=s[8],n[9]=s[9],n[10]=s[10],n[11]=s[11],n[12]=s[12],n[13]=s[13],n[14]=s[14],n[15]=s[15],this}copyPosition(t){const n=this.elements,s=t.elements;return n[12]=s[12],n[13]=s[13],n[14]=s[14],this}setFromMatrix3(t){const n=t.elements;return this.set(n[0],n[3],n[6],0,n[1],n[4],n[7],0,n[2],n[5],n[8],0,0,0,0,1),this}extractBasis(t,n,s){return t.setFromMatrixColumn(this,0),n.setFromMatrixColumn(this,1),s.setFromMatrixColumn(this,2),this}makeBasis(t,n,s){return this.set(t.x,n.x,s.x,0,t.y,n.y,s.y,0,t.z,n.z,s.z,0,0,0,0,1),this}extractRotation(t){const n=this.elements,s=t.elements,l=1/Hx.setFromMatrixColumn(t,0).length(),r=1/Hx.setFromMatrixColumn(t,1).length(),i=1/Hx.setFromMatrixColumn(t,2).length();return n[0]=s[0]*l,n[1]=s[1]*l,n[2]=s[2]*l,n[3]=0,n[4]=s[4]*r,n[5]=s[5]*r,n[6]=s[6]*r,n[7]=0,n[8]=s[8]*i,n[9]=s[9]*i,n[10]=s[10]*i,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromEuler(t){const n=this.elements,s=t.x,l=t.y,r=t.z,i=Math.cos(s),u=Math.sin(s),h=Math.cos(l),d=Math.sin(l),I=Math.cos(r),E=Math.sin(r);if(t.order==="XYZ"){const y=i*I,T=i*E,S=u*I,D=u*E;n[0]=h*I,n[4]=-h*E,n[8]=d,n[1]=T+S*d,n[5]=y-D*d,n[9]=-u*h,n[2]=D-y*d,n[6]=S+T*d,n[10]=i*h}else if(t.order==="YXZ"){const y=h*I,T=h*E,S=d*I,D=d*E;n[0]=y+D*u,n[4]=S*u-T,n[8]=i*d,n[1]=i*E,n[5]=i*I,n[9]=-u,n[2]=T*u-S,n[6]=D+y*u,n[10]=i*h}else if(t.order==="ZXY"){const y=h*I,T=h*E,S=d*I,D=d*E;n[0]=y-D*u,n[4]=-i*E,n[8]=S+T*u,n[1]=T+S*u,n[5]=i*I,n[9]=D-y*u,n[2]=-i*d,n[6]=u,n[10]=i*h}else if(t.order==="ZYX"){const y=i*I,T=i*E,S=u*I,D=u*E;n[0]=h*I,n[4]=S*d-T,n[8]=y*d+D,n[1]=h*E,n[5]=D*d+y,n[9]=T*d-S,n[2]=-d,n[6]=u*h,n[10]=i*h}else if(t.order==="YZX"){const y=i*h,T=i*d,S=u*h,D=u*d;n[0]=h*I,n[4]=D-y*E,n[8]=S*E+T,n[1]=E,n[5]=i*I,n[9]=-u*I,n[2]=-d*I,n[6]=T*E+S,n[10]=y-D*E}else if(t.order==="XZY"){const y=i*h,T=i*d,S=u*h,D=u*d;n[0]=h*I,n[4]=-E,n[8]=d*I,n[1]=y*E+D,n[5]=i*I,n[9]=T*E-S,n[2]=S*E-T,n[6]=u*I,n[10]=D*E+y}return n[3]=0,n[7]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromQuaternion(t){return this.compose(RIe,t,gIe)}lookAt(t,n,s){const l=this.elements;return cy.subVectors(t,n),cy.lengthSq()===0&&(cy.z=1),cy.normalize(),rD.crossVectors(s,cy),rD.lengthSq()===0&&(Math.abs(s.z)===1?cy.x+=1e-4:cy.z+=1e-4,cy.normalize(),rD.crossVectors(s,cy)),rD.normalize(),Tk.crossVectors(cy,rD),l[0]=rD.x,l[4]=Tk.x,l[8]=cy.x,l[1]=rD.y,l[5]=Tk.y,l[9]=cy.y,l[2]=rD.z,l[6]=Tk.z,l[10]=cy.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,n){const s=t.elements,l=n.elements,r=this.elements,i=s[0],u=s[4],h=s[8],d=s[12],I=s[1],E=s[5],y=s[9],T=s[13],S=s[2],D=s[6],O=s[10],N=s[14],H=s[3],_=s[7],U=s[11],Z=s[15],se=l[0],ae=l[4],ye=l[8],re=l[12],ue=l[1],Ne=l[5],le=l[9],Ce=l[13],K=l[2],Le=l[6],Ye=l[10],_e=l[14],ct=l[3],je=l[7],Ct=l[11],Je=l[15];return r[0]=i*se+u*ue+h*K+d*ct,r[4]=i*ae+u*Ne+h*Le+d*je,r[8]=i*ye+u*le+h*Ye+d*Ct,r[12]=i*re+u*Ce+h*_e+d*Je,r[1]=I*se+E*ue+y*K+T*ct,r[5]=I*ae+E*Ne+y*Le+T*je,r[9]=I*ye+E*le+y*Ye+T*Ct,r[13]=I*re+E*Ce+y*_e+T*Je,r[2]=S*se+D*ue+O*K+N*ct,r[6]=S*ae+D*Ne+O*Le+N*je,r[10]=S*ye+D*le+O*Ye+N*Ct,r[14]=S*re+D*Ce+O*_e+N*Je,r[3]=H*se+_*ue+U*K+Z*ct,r[7]=H*ae+_*Ne+U*Le+Z*je,r[11]=H*ye+_*le+U*Ye+Z*Ct,r[15]=H*re+_*Ce+U*_e+Z*Je,this}multiplyScalar(t){const n=this.elements;return n[0]*=t,n[4]*=t,n[8]*=t,n[12]*=t,n[1]*=t,n[5]*=t,n[9]*=t,n[13]*=t,n[2]*=t,n[6]*=t,n[10]*=t,n[14]*=t,n[3]*=t,n[7]*=t,n[11]*=t,n[15]*=t,this}determinant(){const t=this.elements,n=t[0],s=t[4],l=t[8],r=t[12],i=t[1],u=t[5],h=t[9],d=t[13],I=t[2],E=t[6],y=t[10],T=t[14],S=t[3],D=t[7],O=t[11],N=t[15];return S*(+r*h*E-l*d*E-r*u*y+s*d*y+l*u*T-s*h*T)+D*(+n*h*T-n*d*y+r*i*y-l*i*T+l*d*I-r*h*I)+O*(+n*d*E-n*u*T-r*i*E+s*i*T+r*u*I-s*d*I)+N*(-l*u*I-n*h*E+n*u*y+l*i*E-s*i*y+s*h*I)}transpose(){const t=this.elements;let n;return n=t[1],t[1]=t[4],t[4]=n,n=t[2],t[2]=t[8],t[8]=n,n=t[6],t[6]=t[9],t[9]=n,n=t[3],t[3]=t[12],t[12]=n,n=t[7],t[7]=t[13],t[13]=n,n=t[11],t[11]=t[14],t[14]=n,this}setPosition(t,n,s){const l=this.elements;return t.isVector3?(l[12]=t.x,l[13]=t.y,l[14]=t.z):(l[12]=t,l[13]=n,l[14]=s),this}invert(){const t=this.elements,n=t[0],s=t[1],l=t[2],r=t[3],i=t[4],u=t[5],h=t[6],d=t[7],I=t[8],E=t[9],y=t[10],T=t[11],S=t[12],D=t[13],O=t[14],N=t[15],H=E*O*d-D*y*d+D*h*T-u*O*T-E*h*N+u*y*N,_=S*y*d-I*O*d-S*h*T+i*O*T+I*h*N-i*y*N,U=I*D*d-S*E*d+S*u*T-i*D*T-I*u*N+i*E*N,Z=S*E*h-I*D*h-S*u*y+i*D*y+I*u*O-i*E*O,se=n*H+s*_+l*U+r*Z;if(se===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const ae=1/se;return t[0]=H*ae,t[1]=(D*y*r-E*O*r-D*l*T+s*O*T+E*l*N-s*y*N)*ae,t[2]=(u*O*r-D*h*r+D*l*d-s*O*d-u*l*N+s*h*N)*ae,t[3]=(E*h*r-u*y*r-E*l*d+s*y*d+u*l*T-s*h*T)*ae,t[4]=_*ae,t[5]=(I*O*r-S*y*r+S*l*T-n*O*T-I*l*N+n*y*N)*ae,t[6]=(S*h*r-i*O*r-S*l*d+n*O*d+i*l*N-n*h*N)*ae,t[7]=(i*y*r-I*h*r+I*l*d-n*y*d-i*l*T+n*h*T)*ae,t[8]=U*ae,t[9]=(S*E*r-I*D*r-S*s*T+n*D*T+I*s*N-n*E*N)*ae,t[10]=(i*D*r-S*u*r+S*s*d-n*D*d-i*s*N+n*u*N)*ae,t[11]=(I*u*r-i*E*r-I*s*d+n*E*d+i*s*T-n*u*T)*ae,t[12]=Z*ae,t[13]=(I*D*l-S*E*l+S*s*y-n*D*y-I*s*O+n*E*O)*ae,t[14]=(S*u*l-i*D*l-S*s*h+n*D*h+i*s*O-n*u*O)*ae,t[15]=(i*E*l-I*u*l+I*s*h-n*E*h-i*s*y+n*u*y)*ae,this}scale(t){const n=this.elements,s=t.x,l=t.y,r=t.z;return n[0]*=s,n[4]*=l,n[8]*=r,n[1]*=s,n[5]*=l,n[9]*=r,n[2]*=s,n[6]*=l,n[10]*=r,n[3]*=s,n[7]*=l,n[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,n=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],s=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],l=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(n,s,l))}makeTranslation(t,n,s){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,n,0,0,1,s,0,0,0,1),this}makeRotationX(t){const n=Math.cos(t),s=Math.sin(t);return this.set(1,0,0,0,0,n,-s,0,0,s,n,0,0,0,0,1),this}makeRotationY(t){const n=Math.cos(t),s=Math.sin(t);return this.set(n,0,s,0,0,1,0,0,-s,0,n,0,0,0,0,1),this}makeRotationZ(t){const n=Math.cos(t),s=Math.sin(t);return this.set(n,-s,0,0,s,n,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,n){const s=Math.cos(n),l=Math.sin(n),r=1-s,i=t.x,u=t.y,h=t.z,d=r*i,I=r*u;return this.set(d*i+s,d*u-l*h,d*h+l*u,0,d*u+l*h,I*u+s,I*h-l*i,0,d*h-l*u,I*h+l*i,r*h*h+s,0,0,0,0,1),this}makeScale(t,n,s){return this.set(t,0,0,0,0,n,0,0,0,0,s,0,0,0,0,1),this}makeShear(t,n,s,l,r,i){return this.set(1,s,r,0,t,1,i,0,n,l,1,0,0,0,0,1),this}compose(t,n,s){const l=this.elements,r=n._x,i=n._y,u=n._z,h=n._w,d=r+r,I=i+i,E=u+u,y=r*d,T=r*I,S=r*E,D=i*I,O=i*E,N=u*E,H=h*d,_=h*I,U=h*E,Z=s.x,se=s.y,ae=s.z;return l[0]=(1-(D+N))*Z,l[1]=(T+U)*Z,l[2]=(S-_)*Z,l[3]=0,l[4]=(T-U)*se,l[5]=(1-(y+N))*se,l[6]=(O+H)*se,l[7]=0,l[8]=(S+_)*ae,l[9]=(O-H)*ae,l[10]=(1-(y+D))*ae,l[11]=0,l[12]=t.x,l[13]=t.y,l[14]=t.z,l[15]=1,this}decompose(t,n,s){const l=this.elements;let r=Hx.set(l[0],l[1],l[2]).length();const i=Hx.set(l[4],l[5],l[6]).length(),u=Hx.set(l[8],l[9],l[10]).length();this.determinant()<0&&(r=-r),t.x=l[12],t.y=l[13],t.z=l[14],o2.copy(this);const d=1/r,I=1/i,E=1/u;return o2.elements[0]*=d,o2.elements[1]*=d,o2.elements[2]*=d,o2.elements[4]*=I,o2.elements[5]*=I,o2.elements[6]*=I,o2.elements[8]*=E,o2.elements[9]*=E,o2.elements[10]*=E,n.setFromRotationMatrix(o2),s.x=r,s.y=i,s.z=u,this}makePerspective(t,n,s,l,r,i,u=tC){const h=this.elements,d=2*r/(n-t),I=2*r/(s-l),E=(n+t)/(n-t),y=(s+l)/(s-l);let T,S;if(u===tC)T=-(i+r)/(i-r),S=-2*i*r/(i-r);else if(u===gj)T=-i/(i-r),S=-i*r/(i-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+u);return h[0]=d,h[4]=0,h[8]=E,h[12]=0,h[1]=0,h[5]=I,h[9]=y,h[13]=0,h[2]=0,h[6]=0,h[10]=T,h[14]=S,h[3]=0,h[7]=0,h[11]=-1,h[15]=0,this}makeOrthographic(t,n,s,l,r,i,u=tC){const h=this.elements,d=1/(n-t),I=1/(s-l),E=1/(i-r),y=(n+t)*d,T=(s+l)*I;let S,D;if(u===tC)S=(i+r)*E,D=-2*E;else if(u===gj)S=r*E,D=-1*E;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+u);return h[0]=2*d,h[4]=0,h[8]=0,h[12]=-y,h[1]=0,h[5]=2*I,h[9]=0,h[13]=-T,h[2]=0,h[6]=0,h[10]=D,h[14]=-S,h[3]=0,h[7]=0,h[11]=0,h[15]=1,this}equals(t){const n=this.elements,s=t.elements;for(let l=0;l<16;l++)if(n[l]!==s[l])return!1;return!0}fromArray(t,n=0){for(let s=0;s<16;s++)this.elements[s]=t[s+n];return this}toArray(t=[],n=0){const s=this.elements;return t[n]=s[0],t[n+1]=s[1],t[n+2]=s[2],t[n+3]=s[3],t[n+4]=s[4],t[n+5]=s[5],t[n+6]=s[6],t[n+7]=s[7],t[n+8]=s[8],t[n+9]=s[9],t[n+10]=s[10],t[n+11]=s[11],t[n+12]=s[12],t[n+13]=s[13],t[n+14]=s[14],t[n+15]=s[15],t}}const Hx=new De,o2=new Jt,RIe=new De(0,0,0),gIe=new De(1,1,1),rD=new De,Tk=new De,cy=new De,gee=new Jt,Aee=new Dr;class O8{constructor(t=0,n=0,s=0,l=O8.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=n,this._z=s,this._order=l}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,n,s,l=this._order){return this._x=t,this._y=n,this._z=s,this._order=l,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,n=this._order,s=!0){const l=t.elements,r=l[0],i=l[4],u=l[8],h=l[1],d=l[5],I=l[9],E=l[2],y=l[6],T=l[10];switch(n){case"XYZ":this._y=Math.asin(dI(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(-I,T),this._z=Math.atan2(-i,r)):(this._x=Math.atan2(y,d),this._z=0);break;case"YXZ":this._x=Math.asin(-dI(I,-1,1)),Math.abs(I)<.9999999?(this._y=Math.atan2(u,T),this._z=Math.atan2(h,d)):(this._y=Math.atan2(-E,r),this._z=0);break;case"ZXY":this._x=Math.asin(dI(y,-1,1)),Math.abs(y)<.9999999?(this._y=Math.atan2(-E,T),this._z=Math.atan2(-i,d)):(this._y=0,this._z=Math.atan2(h,r));break;case"ZYX":this._y=Math.asin(-dI(E,-1,1)),Math.abs(E)<.9999999?(this._x=Math.atan2(y,T),this._z=Math.atan2(h,r)):(this._x=0,this._z=Math.atan2(-i,d));break;case"YZX":this._z=Math.asin(dI(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(-I,d),this._y=Math.atan2(-E,r)):(this._x=0,this._y=Math.atan2(u,T));break;case"XZY":this._z=Math.asin(-dI(i,-1,1)),Math.abs(i)<.9999999?(this._x=Math.atan2(y,d),this._y=Math.atan2(u,r)):(this._x=Math.atan2(-I,T),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,s===!0&&this._onChangeCallback(),this}setFromQuaternion(t,n,s){return gee.makeRotationFromQuaternion(t),this.setFromRotationMatrix(gee,n,s)}setFromVector3(t,n=this._order){return this.set(t.x,t.y,t.z,n)}reorder(t){return Aee.setFromEuler(this),this.setFromQuaternion(Aee,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],n=0){return t[n]=this._x,t[n+1]=this._y,t[n+2]=this._z,t[n+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}O8.DEFAULT_ORDER="XYZ";class PJ{constructor(){this.mask=1}set(t){this.mask=(1<>>0}enable(t){this.mask|=1<1){for(let n=0;n1){for(let s=0;s0&&(l.userData=this.userData),l.layers=this.layers.mask,l.matrix=this.matrix.toArray(),l.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(l.matrixAutoUpdate=!1),this.isInstancedMesh&&(l.type="InstancedMesh",l.count=this.count,l.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(l.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(l.type="BatchedMesh",l.perObjectFrustumCulled=this.perObjectFrustumCulled,l.sortObjects=this.sortObjects,l.drawRanges=this._drawRanges,l.reservedRanges=this._reservedRanges,l.visibility=this._visibility,l.active=this._active,l.bounds=this._bounds.map(u=>({boxInitialized:u.boxInitialized,boxMin:u.box.min.toArray(),boxMax:u.box.max.toArray(),sphereInitialized:u.sphereInitialized,sphereRadius:u.sphere.radius,sphereCenter:u.sphere.center.toArray()})),l.maxGeometryCount=this._maxGeometryCount,l.maxVertexCount=this._maxVertexCount,l.maxIndexCount=this._maxIndexCount,l.geometryInitialized=this._geometryInitialized,l.geometryCount=this._geometryCount,l.matricesTexture=this._matricesTexture.toJSON(t),this.boundingSphere!==null&&(l.boundingSphere={center:l.boundingSphere.center.toArray(),radius:l.boundingSphere.radius}),this.boundingBox!==null&&(l.boundingBox={min:l.boundingBox.min.toArray(),max:l.boundingBox.max.toArray()}));function r(u,h){return u[h.uuid]===void 0&&(u[h.uuid]=h.toJSON(t)),h.uuid}if(this.isScene)this.background&&(this.background.isColor?l.background=this.background.toJSON():this.background.isTexture&&(l.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(l.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){l.geometry=r(t.geometries,this.geometry);const u=this.geometry.parameters;if(u!==void 0&&u.shapes!==void 0){const h=u.shapes;if(Array.isArray(h))for(let d=0,I=h.length;d0){l.children=[];for(let u=0;u0){l.animations=[];for(let u=0;u0&&(s.geometries=u),h.length>0&&(s.materials=h),d.length>0&&(s.textures=d),I.length>0&&(s.images=I),E.length>0&&(s.shapes=E),y.length>0&&(s.skeletons=y),T.length>0&&(s.animations=T),S.length>0&&(s.nodes=S)}return s.object=l,s;function i(u){const h=[];for(const d in u){const I=u[d];delete I.metadata,h.push(I)}return h}}clone(t){return new this.constructor().copy(this,t)}copy(t,n=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),n===!0)for(let s=0;s0?l.multiplyScalar(1/Math.sqrt(r)):l.set(0,0,0)}static getBarycoord(t,n,s,l,r){u2.subVectors(l,n),wS.subVectors(s,n),HZ.subVectors(t,n);const i=u2.dot(u2),u=u2.dot(wS),h=u2.dot(HZ),d=wS.dot(wS),I=wS.dot(HZ),E=i*d-u*u;if(E===0)return r.set(0,0,0),null;const y=1/E,T=(d*h-u*I)*y,S=(i*I-u*h)*y;return r.set(1-T-S,S,T)}static containsPoint(t,n,s,l){return this.getBarycoord(t,n,s,l,RS)===null?!1:RS.x>=0&&RS.y>=0&&RS.x+RS.y<=1}static getUV(t,n,s,l,r,i,u,h){return Rk===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Rk=!0),this.getInterpolation(t,n,s,l,r,i,u,h)}static getInterpolation(t,n,s,l,r,i,u,h){return this.getBarycoord(t,n,s,l,RS)===null?(h.x=0,h.y=0,"z"in h&&(h.z=0),"w"in h&&(h.w=0),null):(h.setScalar(0),h.addScaledVector(r,RS.x),h.addScaledVector(i,RS.y),h.addScaledVector(u,RS.z),h)}static isFrontFacing(t,n,s,l){return u2.subVectors(s,n),wS.subVectors(t,n),u2.cross(wS).dot(l)<0}set(t,n,s){return this.a.copy(t),this.b.copy(n),this.c.copy(s),this}setFromPointsAndIndices(t,n,s,l){return this.a.copy(t[n]),this.b.copy(t[s]),this.c.copy(t[l]),this}setFromAttributeAndIndices(t,n,s,l){return this.a.fromBufferAttribute(t,n),this.b.fromBufferAttribute(t,s),this.c.fromBufferAttribute(t,l),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return u2.subVectors(this.c,this.b),wS.subVectors(this.a,this.b),u2.cross(wS).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return hr.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,n){return hr.getBarycoord(t,this.a,this.b,this.c,n)}getUV(t,n,s,l,r){return Rk===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Rk=!0),hr.getInterpolation(t,this.a,this.b,this.c,n,s,l,r)}getInterpolation(t,n,s,l,r){return hr.getInterpolation(t,this.a,this.b,this.c,n,s,l,r)}containsPoint(t){return hr.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return hr.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,n){const s=this.a,l=this.b,r=this.c;let i,u;Gx.subVectors(l,s),Vx.subVectors(r,s),_Z.subVectors(t,s);const h=Gx.dot(_Z),d=Vx.dot(_Z);if(h<=0&&d<=0)return n.copy(s);GZ.subVectors(t,l);const I=Gx.dot(GZ),E=Vx.dot(GZ);if(I>=0&&E<=I)return n.copy(l);const y=h*E-I*d;if(y<=0&&h>=0&&I<=0)return i=h/(h-I),n.copy(s).addScaledVector(Gx,i);VZ.subVectors(t,r);const T=Gx.dot(VZ),S=Vx.dot(VZ);if(S>=0&&T<=S)return n.copy(r);const D=T*d-h*S;if(D<=0&&d>=0&&S<=0)return u=d/(d-S),n.copy(s).addScaledVector(Vx,u);const O=I*S-T*E;if(O<=0&&E-I>=0&&T-S>=0)return Oee.subVectors(r,l),u=(E-I)/(E-I+(T-S)),n.copy(l).addScaledVector(Oee,u);const N=1/(O+D+y);return i=D*N,u=y*N,n.copy(s).addScaledVector(Gx,i).addScaledVector(Vx,u)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const Vre={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},iD={h:0,s:0,l:0},gk={h:0,s:0,l:0};function zZ(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*6*(2/3-n):e}class Gn{constructor(t,n,s){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,n,s)}set(t,n,s){if(n===void 0&&s===void 0){const l=t;l&&l.isColor?this.copy(l):typeof l=="number"?this.setHex(l):typeof l=="string"&&this.setStyle(l)}else this.setRGB(t,n,s);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,n=hI){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,vs.toWorkingColorSpace(this,n),this}setRGB(t,n,s,l=vs.workingColorSpace){return this.r=t,this.g=n,this.b=s,vs.toWorkingColorSpace(this,l),this}setHSL(t,n,s,l=vs.workingColorSpace){if(t=bJ(t,1),n=dI(n,0,1),s=dI(s,0,1),n===0)this.r=this.g=this.b=s;else{const r=s<=.5?s*(1+n):s+n-s*n,i=2*s-r;this.r=zZ(i,r,t+1/3),this.g=zZ(i,r,t),this.b=zZ(i,r,t-1/3)}return vs.toWorkingColorSpace(this,l),this}setStyle(t,n=hI){function s(r){r!==void 0&&parseFloat(r)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let l;if(l=/^(\w+)\(([^\)]*)\)/.exec(t)){let r;const i=l[1],u=l[2];switch(i){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(u))return s(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,n);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(u))return s(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,n);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(u))return s(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,n);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(l=/^\#([A-Fa-f\d]+)$/.exec(t)){const r=l[1],i=r.length;if(i===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,n);if(i===6)return this.setHex(parseInt(r,16),n);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,n);return this}setColorName(t,n=hI){const s=Vre[t.toLowerCase()];return s!==void 0?this.setHex(s,n):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=wF(t.r),this.g=wF(t.g),this.b=wF(t.b),this}copyLinearToSRGB(t){return this.r=LZ(t.r),this.g=LZ(t.g),this.b=LZ(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=hI){return vs.fromWorkingColorSpace(a1.copy(this),t),Math.round(dI(a1.r*255,0,255))*65536+Math.round(dI(a1.g*255,0,255))*256+Math.round(dI(a1.b*255,0,255))}getHexString(t=hI){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,n=vs.workingColorSpace){vs.fromWorkingColorSpace(a1.copy(this),n);const s=a1.r,l=a1.g,r=a1.b,i=Math.max(s,l,r),u=Math.min(s,l,r);let h,d;const I=(u+i)/2;if(u===i)h=0,d=0;else{const E=i-u;switch(d=I<=.5?E/(i+u):E/(2-i-u),i){case s:h=(l-r)/E+(l0!=t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(t!==void 0)for(const n in t){const s=t[n];if(s===void 0){console.warn(`THREE.Material: parameter '${n}' has value of undefined.`);continue}const l=this[n];if(l===void 0){console.warn(`THREE.Material: '${n}' is not a property of THREE.${this.type}.`);continue}l&&l.isColor?l.set(s):l&&l.isVector3&&s&&s.isVector3?l.copy(s):this[n]=s}}toJSON(t){const n=t===void 0||typeof t=="string";n&&(t={textures:{},images:{}});const s={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};s.uuid=this.uuid,s.type=this.type,this.name!==""&&(s.name=this.name),this.color&&this.color.isColor&&(s.color=this.color.getHex()),this.roughness!==void 0&&(s.roughness=this.roughness),this.metalness!==void 0&&(s.metalness=this.metalness),this.sheen!==void 0&&(s.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(s.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(s.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(s.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(s.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(s.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(s.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(s.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(s.shininess=this.shininess),this.clearcoat!==void 0&&(s.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(s.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(s.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(s.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(s.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,s.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(s.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(s.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(s.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(s.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(s.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.anisotropy!==void 0&&(s.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(s.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(s.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(s.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(s.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(s.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(s.lightMap=this.lightMap.toJSON(t).uuid,s.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(s.aoMap=this.aoMap.toJSON(t).uuid,s.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(s.bumpMap=this.bumpMap.toJSON(t).uuid,s.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(s.normalMap=this.normalMap.toJSON(t).uuid,s.normalMapType=this.normalMapType,s.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(s.displacementMap=this.displacementMap.toJSON(t).uuid,s.displacementScale=this.displacementScale,s.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(s.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(s.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(s.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(s.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(s.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(s.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(s.envMap=this.envMap.toJSON(t).uuid,this.combine!==void 0&&(s.combine=this.combine)),this.envMapIntensity!==void 0&&(s.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(s.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(s.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(s.gradientMap=this.gradientMap.toJSON(t).uuid),this.transmission!==void 0&&(s.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(s.transmissionMap=this.transmissionMap.toJSON(t).uuid),this.thickness!==void 0&&(s.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(s.thicknessMap=this.thicknessMap.toJSON(t).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(s.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(s.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(s.size=this.size),this.shadowSide!==null&&(s.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(s.sizeAttenuation=this.sizeAttenuation),this.blending!==mF&&(s.blending=this.blending),this.side!==n3&&(s.side=this.side),this.vertexColors===!0&&(s.vertexColors=!0),this.opacity<1&&(s.opacity=this.opacity),this.transparent===!0&&(s.transparent=!0),this.blendSrc!==wQ&&(s.blendSrc=this.blendSrc),this.blendDst!==RQ&&(s.blendDst=this.blendDst),this.blendEquation!==Gb&&(s.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(s.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(s.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(s.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(s.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(s.blendAlpha=this.blendAlpha),this.depthFunc!==mj&&(s.depthFunc=this.depthFunc),this.depthTest===!1&&(s.depthTest=this.depthTest),this.depthWrite===!1&&(s.depthWrite=this.depthWrite),this.colorWrite===!1&&(s.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(s.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==pee&&(s.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(s.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(s.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Mx&&(s.stencilFail=this.stencilFail),this.stencilZFail!==Mx&&(s.stencilZFail=this.stencilZFail),this.stencilZPass!==Mx&&(s.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(s.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(s.rotation=this.rotation),this.polygonOffset===!0&&(s.polygonOffset=!0),this.polygonOffsetFactor!==0&&(s.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(s.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(s.linewidth=this.linewidth),this.dashSize!==void 0&&(s.dashSize=this.dashSize),this.gapSize!==void 0&&(s.gapSize=this.gapSize),this.scale!==void 0&&(s.scale=this.scale),this.dithering===!0&&(s.dithering=!0),this.alphaTest>0&&(s.alphaTest=this.alphaTest),this.alphaHash===!0&&(s.alphaHash=!0),this.alphaToCoverage===!0&&(s.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(s.premultipliedAlpha=!0),this.forceSinglePass===!0&&(s.forceSinglePass=!0),this.wireframe===!0&&(s.wireframe=!0),this.wireframeLinewidth>1&&(s.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(s.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(s.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(s.flatShading=!0),this.visible===!1&&(s.visible=!1),this.toneMapped===!1&&(s.toneMapped=!1),this.fog===!1&&(s.fog=!1),Object.keys(this.userData).length>0&&(s.userData=this.userData);function l(r){const i=[];for(const u in r){const h=r[u];delete h.metadata,i.push(h)}return i}if(n){const r=l(t.textures),i=l(t.images);r.length>0&&(s.textures=r),i.length>0&&(s.images=i)}return s}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const n=t.clippingPlanes;let s=null;if(n!==null){const l=n.length;s=new Array(l);for(let r=0;r!==l;++r)s[r]=n[r].clone()}return this.clippingPlanes=s,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){t===!0&&this.version++}}class Eu extends L8{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Gn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=DJ,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}const Pu=new De,Ak=new Vn;class il{constructor(t,n,s=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=n,this.count=t!==void 0?t.length/n:0,this.normalized=s,this.usage=CQ,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=eC,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}get updateRange(){return console.warn("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,n){this.updateRanges.push({start:t,count:n})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,n,s){t*=this.itemSize,s*=n.itemSize;for(let l=0,r=this.itemSize;l0&&(t.userData=this.userData),this.parameters!==void 0){const h=this.parameters;for(const d in h)h[d]!==void 0&&(t[d]=h[d]);return t}t.data={attributes:{}};const n=this.index;n!==null&&(t.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});const s=this.attributes;for(const h in s){const d=s[h];t.data.attributes[h]=d.toJSON(t.data)}const l={};let r=!1;for(const h in this.morphAttributes){const d=this.morphAttributes[h],I=[];for(let E=0,y=d.length;E0&&(l[h]=I,r=!0)}r&&(t.data.morphAttributes=l,t.data.morphTargetsRelative=this.morphTargetsRelative);const i=this.groups;i.length>0&&(t.data.groups=JSON.parse(JSON.stringify(i)));const u=this.boundingSphere;return u!==null&&(t.data.boundingSphere={center:u.center.toArray(),radius:u.radius}),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const n={};this.name=t.name;const s=t.index;s!==null&&this.setIndex(s.clone(n));const l=t.attributes;for(const d in l){const I=l[d];this.setAttribute(d,I.clone(n))}const r=t.morphAttributes;for(const d in r){const I=[],E=r[d];for(let y=0,T=E.length;y0){const l=n[s[0]];if(l!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,i=l.length;r(t.far-t.near)**2))&&(Lee.copy(r).invert(),V7.copy(t.ray).applyMatrix4(Lee),!(s.boundingBox!==null&&V7.intersectsBox(s.boundingBox)===!1)&&this._computeIntersections(t,n,V7)))}_computeIntersections(t,n,s){let l;const r=this.geometry,i=this.material,u=r.index,h=r.attributes.position,d=r.attributes.uv,I=r.attributes.uv1,E=r.attributes.normal,y=r.groups,T=r.drawRange;if(u!==null)if(Array.isArray(i))for(let S=0,D=y.length;Sn.far?null:{distance:d,point:bk.clone(),object:e}}function Pk(e,t,n,s,l,r,i,u,h,d){e.getVertexPosition(u,kx),e.getVertexPosition(h,Yx),e.getVertexPosition(d,Wx);const I=bIe(e,t,n,s,kx,Yx,Wx,Lk);if(I){l&&(Nk.fromBufferAttribute(l,u),Dk.fromBufferAttribute(l,h),Ok.fromBufferAttribute(l,d),I.uv=hr.getInterpolation(Lk,kx,Yx,Wx,Nk,Dk,Ok,new Vn)),r&&(Nk.fromBufferAttribute(r,u),Dk.fromBufferAttribute(r,h),Ok.fromBufferAttribute(r,d),I.uv1=hr.getInterpolation(Lk,kx,Yx,Wx,Nk,Dk,Ok,new Vn),I.uv2=I.uv1),i&&(Pee.fromBufferAttribute(i,u),Mee.fromBufferAttribute(i,h),xee.fromBufferAttribute(i,d),I.normal=hr.getInterpolation(Lk,kx,Yx,Wx,Pee,Mee,xee,new De),I.normal.dot(s.direction)>0&&I.normal.multiplyScalar(-1));const E={a:u,b:h,c:d,normal:new De,materialIndex:0};hr.getNormal(kx,Yx,Wx,E.normal),I.face=E}return I}class rl extends ms{constructor(t=1,n=1,s=1,l=1,r=1,i=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:n,depth:s,widthSegments:l,heightSegments:r,depthSegments:i};const u=this;l=Math.floor(l),r=Math.floor(r),i=Math.floor(i);const h=[],d=[],I=[],E=[];let y=0,T=0;S("z","y","x",-1,-1,s,n,t,i,r,0),S("z","y","x",1,-1,s,n,-t,i,r,1),S("x","z","y",1,1,t,s,n,l,i,2),S("x","z","y",1,-1,t,s,-n,l,i,3),S("x","y","z",1,-1,t,n,s,l,r,4),S("x","y","z",-1,-1,t,n,-s,l,r,5),this.setIndex(h),this.setAttribute("position",new ir(d,3)),this.setAttribute("normal",new ir(I,3)),this.setAttribute("uv",new ir(E,2));function S(D,O,N,H,_,U,Z,se,ae,ye,re){const ue=U/ae,Ne=Z/ye,le=U/2,Ce=Z/2,K=se/2,Le=ae+1,Ye=ye+1;let _e=0,ct=0;const je=new De;for(let Ct=0;Ct0?1:-1,I.push(je.x,je.y,je.z),E.push(Ke/ae),E.push(1-Ct/ye),_e+=1}}for(let Ct=0;Ct0&&(n.defines=this.defines),n.vertexShader=this.vertexShader,n.fragmentShader=this.fragmentShader,n.lights=this.lights,n.clipping=this.clipping;const s={};for(const l in this.extensions)this.extensions[l]===!0&&(s[l]=!0);return Object.keys(s).length>0&&(n.extensions=s),n}}class Wre extends Or{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Jt,this.projectionMatrix=new Jt,this.projectionMatrixInverse=new Jt,this.coordinateSystem=tC}copy(t,n){return super.copy(t,n),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,n){super.updateWorldMatrix(t,n),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class j0 extends Wre{constructor(t=50,n=1,s=.1,l=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=s,this.far=l,this.focus=10,this.aspect=n,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,n){return super.copy(t,n),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=t.view===null?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const n=.5*this.getFilmHeight()/t;this.fov=az*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(TF*.5*this.fov);return .5*this.getFilmHeight()/t}getEffectiveFOV(){return az*2*Math.atan(Math.tan(TF*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(t,n,s,l,r,i){this.aspect=t/n,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=n,this.view.offsetX=s,this.view.offsetY=l,this.view.width=r,this.view.height=i,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let n=t*Math.tan(TF*.5*this.fov)/this.zoom,s=2*n,l=this.aspect*s,r=-.5*l;const i=this.view;if(this.view!==null&&this.view.enabled){const h=i.fullWidth,d=i.fullHeight;r+=i.offsetX*l/h,n-=i.offsetY*s/d,l*=i.width/h,s*=i.height/d}const u=this.filmOffset;u!==0&&(r+=t*u/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+l,n,n-s,t,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const n=super.toJSON(t);return n.object.fov=this.fov,n.object.zoom=this.zoom,n.object.near=this.near,n.object.far=this.far,n.object.focus=this.focus,n.object.aspect=this.aspect,this.view!==null&&(n.object.view=Object.assign({},this.view)),n.object.filmGauge=this.filmGauge,n.object.filmOffset=this.filmOffset,n}}const jx=-90,qx=1;class FIe extends Or{constructor(t,n,s){super(),this.type="CubeCamera",this.renderTarget=s,this.coordinateSystem=null,this.activeMipmapLevel=0;const l=new j0(jx,qx,t,n);l.layers=this.layers,this.add(l);const r=new j0(jx,qx,t,n);r.layers=this.layers,this.add(r);const i=new j0(jx,qx,t,n);i.layers=this.layers,this.add(i);const u=new j0(jx,qx,t,n);u.layers=this.layers,this.add(u);const h=new j0(jx,qx,t,n);h.layers=this.layers,this.add(h);const d=new j0(jx,qx,t,n);d.layers=this.layers,this.add(d)}updateCoordinateSystem(){const t=this.coordinateSystem,n=this.children.concat(),[s,l,r,i,u,h]=n;for(const d of n)this.remove(d);if(t===tC)s.up.set(0,1,0),s.lookAt(1,0,0),l.up.set(0,1,0),l.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),i.up.set(0,0,1),i.lookAt(0,-1,0),u.up.set(0,1,0),u.lookAt(0,0,1),h.up.set(0,1,0),h.lookAt(0,0,-1);else if(t===gj)s.up.set(0,-1,0),s.lookAt(-1,0,0),l.up.set(0,-1,0),l.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),i.up.set(0,0,-1),i.lookAt(0,-1,0),u.up.set(0,-1,0),u.lookAt(0,0,1),h.up.set(0,-1,0),h.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);for(const d of n)this.add(d),d.updateMatrixWorld()}update(t,n){this.parent===null&&this.updateMatrixWorld();const{renderTarget:s,activeMipmapLevel:l}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());const[r,i,u,h,d,I]=this.children,E=t.getRenderTarget(),y=t.getActiveCubeFace(),T=t.getActiveMipmapLevel(),S=t.xr.enabled;t.xr.enabled=!1;const D=s.texture.generateMipmaps;s.texture.generateMipmaps=!1,t.setRenderTarget(s,0,l),t.render(n,r),t.setRenderTarget(s,1,l),t.render(n,i),t.setRenderTarget(s,2,l),t.render(n,u),t.setRenderTarget(s,3,l),t.render(n,h),t.setRenderTarget(s,4,l),t.render(n,d),s.texture.generateMipmaps=D,t.setRenderTarget(s,5,l),t.render(n,I),t.setRenderTarget(E,y,T),t.xr.enabled=S,s.texture.needsPMREMUpdate=!0}}class jre extends vE{constructor(t,n,s,l,r,i,u,h,d,I){t=t!==void 0?t:[],n=n!==void 0?n:xF,super(t,n,s,l,r,i,u,h,d,I),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class UIe extends qu{constructor(t=1,n={}){super(t,t,n),this.isWebGLCubeRenderTarget=!0;const s={width:t,height:t,depth:1},l=[s,s,s,s,s,s];n.encoding!==void 0&&(ZV("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),n.colorSpace=n.encoding===qb?hI:Gy),this.texture=new jre(l,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:fI}fromEquirectangularTexture(t,n){this.texture.type=n.type,this.texture.colorSpace=n.colorSpace,this.texture.generateMipmaps=n.generateMipmaps,this.texture.minFilter=n.minFilter,this.texture.magFilter=n.magFilter;const s={uniforms:{tEquirect:{value:null}},vertexShader:`
+
+ varying vec3 vWorldDirection;
+
+ vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
+
+ return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
+
+ }
+
+ void main() {
+
+ vWorldDirection = transformDirection( position, modelMatrix );
+
+ #include
+ #include
+
+ }
+ `,fragmentShader:`
+
+ uniform sampler2D tEquirect;
+
+ varying vec3 vWorldDirection;
+
+ #include
+
+ void main() {
+
+ vec3 direction = normalize( vWorldDirection );
+
+ vec2 sampleUV = equirectUv( direction );
+
+ gl_FragColor = texture2D( tEquirect, sampleUV );
+
+ }
+ `},l=new rl(5,5,5),r=new Aa({name:"CubemapFromEquirect",uniforms:BF(s.uniforms),vertexShader:s.vertexShader,fragmentShader:s.fragmentShader,side:EI,blending:FC});r.uniforms.tEquirect.value=n;const i=new kt(l,r),u=n.minFilter;return n.minFilter===iz&&(n.minFilter=fI),new FIe(1,10,this).update(t,i),n.minFilter=u,i.geometry.dispose(),i.material.dispose(),this}clear(t,n,s,l){const r=t.getRenderTarget();for(let i=0;i<6;i++)t.setRenderTarget(this,i),t.clear(n,s,l);t.setRenderTarget(r)}}const WZ=new De,BIe=new De,HIe=new Rs;class la{constructor(t=new De(1,0,0),n=0){this.isPlane=!0,this.normal=t,this.constant=n}set(t,n){return this.normal.copy(t),this.constant=n,this}setComponents(t,n,s,l){return this.normal.set(t,n,s),this.constant=l,this}setFromNormalAndCoplanarPoint(t,n){return this.normal.copy(t),this.constant=-n.dot(this.normal),this}setFromCoplanarPoints(t,n,s){const l=WZ.subVectors(s,n).cross(BIe.subVectors(t,n)).normalize();return this.setFromNormalAndCoplanarPoint(l,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,n){return n.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,n){const s=t.delta(WZ),l=this.normal.dot(s);if(l===0)return this.distanceToPoint(t.start)===0?n.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/l;return r<0||r>1?null:n.copy(t.start).addScaledVector(s,r)}intersectsLine(t){const n=this.distanceToPoint(t.start),s=this.distanceToPoint(t.end);return n<0&&s>0||s<0&&n>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,n){const s=n||HIe.getNormalMatrix(t),l=this.coplanarPoint(WZ).applyMatrix4(t),r=this.normal.applyMatrix3(s).normalize();return this.constant=-l.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}}const z7=new wh,Mk=new De;class MJ{constructor(t=new la,n=new la,s=new la,l=new la,r=new la,i=new la){this.planes=[t,n,s,l,r,i]}set(t,n,s,l,r,i){const u=this.planes;return u[0].copy(t),u[1].copy(n),u[2].copy(s),u[3].copy(l),u[4].copy(r),u[5].copy(i),this}copy(t){const n=this.planes;for(let s=0;s<6;s++)n[s].copy(t.planes[s]);return this}setFromProjectionMatrix(t,n=tC){const s=this.planes,l=t.elements,r=l[0],i=l[1],u=l[2],h=l[3],d=l[4],I=l[5],E=l[6],y=l[7],T=l[8],S=l[9],D=l[10],O=l[11],N=l[12],H=l[13],_=l[14],U=l[15];if(s[0].setComponents(h-r,y-d,O-T,U-N).normalize(),s[1].setComponents(h+r,y+d,O+T,U+N).normalize(),s[2].setComponents(h+i,y+I,O+S,U+H).normalize(),s[3].setComponents(h-i,y-I,O-S,U-H).normalize(),s[4].setComponents(h-u,y-E,O-D,U-_).normalize(),n===tC)s[5].setComponents(h+u,y+E,O+D,U+_).normalize();else if(n===gj)s[5].setComponents(u,E,D,_).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+n);return this}intersectsObject(t){if(t.boundingSphere!==void 0)t.boundingSphere===null&&t.computeBoundingSphere(),z7.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const n=t.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),z7.copy(n.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(z7)}intersectsSprite(t){return z7.center.set(0,0,0),z7.radius=.7071067811865476,z7.applyMatrix4(t.matrixWorld),this.intersectsSphere(z7)}intersectsSphere(t){const n=this.planes,s=t.center,l=-t.radius;for(let r=0;r<6;r++)if(n[r].distanceToPoint(s)0?t.max.x:t.min.x,Mk.y=l.normal.y>0?t.max.y:t.min.y,Mk.z=l.normal.z>0?t.max.z:t.min.z,l.distanceToPoint(Mk)<0)return!1}return!0}containsPoint(t){const n=this.planes;for(let s=0;s<6;s++)if(n[s].distanceToPoint(t)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function qre(){let e=null,t=!1,n=null,s=null;function l(r,i){n(r,i),s=e.requestAnimationFrame(l)}return{start:function(){t!==!0&&n!==null&&(s=e.requestAnimationFrame(l),t=!0)},stop:function(){e.cancelAnimationFrame(s),t=!1},setAnimationLoop:function(r){n=r},setContext:function(r){e=r}}}function _Ie(e,t){const n=t.isWebGL2,s=new WeakMap;function l(d,I){const E=d.array,y=d.usage,T=E.byteLength,S=e.createBuffer();e.bindBuffer(I,S),e.bufferData(I,E,y),d.onUploadCallback();let D;if(E instanceof Float32Array)D=e.FLOAT;else if(E instanceof Uint16Array)if(d.isFloat16BufferAttribute)if(n)D=e.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else D=e.UNSIGNED_SHORT;else if(E instanceof Int16Array)D=e.SHORT;else if(E instanceof Uint32Array)D=e.UNSIGNED_INT;else if(E instanceof Int32Array)D=e.INT;else if(E instanceof Int8Array)D=e.BYTE;else if(E instanceof Uint8Array)D=e.UNSIGNED_BYTE;else if(E instanceof Uint8ClampedArray)D=e.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+E);return{buffer:S,type:D,bytesPerElement:E.BYTES_PER_ELEMENT,version:d.version,size:T}}function r(d,I,E){const y=I.array,T=I._updateRange,S=I.updateRanges;if(e.bindBuffer(E,d),T.count===-1&&S.length===0&&e.bufferSubData(E,0,y),S.length!==0){for(let D=0,O=S.length;D 0
+ vec4 plane;
+ #pragma unroll_loop_start
+ for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
+ plane = clippingPlanes[ i ];
+ if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
+ }
+ #pragma unroll_loop_end
+ #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
+ bool clipped = true;
+ #pragma unroll_loop_start
+ for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
+ plane = clippingPlanes[ i ];
+ clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
+ }
+ #pragma unroll_loop_end
+ if ( clipped ) discard;
+ #endif
+#endif`,t1e=`#if NUM_CLIPPING_PLANES > 0
+ varying vec3 vClipPosition;
+ uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
+#endif`,n1e=`#if NUM_CLIPPING_PLANES > 0
+ varying vec3 vClipPosition;
+#endif`,s1e=`#if NUM_CLIPPING_PLANES > 0
+ vClipPosition = - mvPosition.xyz;
+#endif`,l1e=`#if defined( USE_COLOR_ALPHA )
+ diffuseColor *= vColor;
+#elif defined( USE_COLOR )
+ diffuseColor.rgb *= vColor;
+#endif`,r1e=`#if defined( USE_COLOR_ALPHA )
+ varying vec4 vColor;
+#elif defined( USE_COLOR )
+ varying vec3 vColor;
+#endif`,i1e=`#if defined( USE_COLOR_ALPHA )
+ varying vec4 vColor;
+#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
+ varying vec3 vColor;
+#endif`,a1e=`#if defined( USE_COLOR_ALPHA )
+ vColor = vec4( 1.0 );
+#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
+ vColor = vec3( 1.0 );
+#endif
+#ifdef USE_COLOR
+ vColor *= color;
+#endif
+#ifdef USE_INSTANCING_COLOR
+ vColor.xyz *= instanceColor.xyz;
+#endif`,o1e=`#define PI 3.141592653589793
+#define PI2 6.283185307179586
+#define PI_HALF 1.5707963267948966
+#define RECIPROCAL_PI 0.3183098861837907
+#define RECIPROCAL_PI2 0.15915494309189535
+#define EPSILON 1e-6
+#ifndef saturate
+#define saturate( a ) clamp( a, 0.0, 1.0 )
+#endif
+#define whiteComplement( a ) ( 1.0 - saturate( a ) )
+float pow2( const in float x ) { return x*x; }
+vec3 pow2( const in vec3 x ) { return x*x; }
+float pow3( const in float x ) { return x*x*x; }
+float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
+float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
+float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
+highp float rand( const in vec2 uv ) {
+ const highp float a = 12.9898, b = 78.233, c = 43758.5453;
+ highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
+ return fract( sin( sn ) * c );
+}
+#ifdef HIGH_PRECISION
+ float precisionSafeLength( vec3 v ) { return length( v ); }
+#else
+ float precisionSafeLength( vec3 v ) {
+ float maxComponent = max3( abs( v ) );
+ return length( v / maxComponent ) * maxComponent;
+ }
+#endif
+struct IncidentLight {
+ vec3 color;
+ vec3 direction;
+ bool visible;
+};
+struct ReflectedLight {
+ vec3 directDiffuse;
+ vec3 directSpecular;
+ vec3 indirectDiffuse;
+ vec3 indirectSpecular;
+};
+#ifdef USE_ALPHAHASH
+ varying vec3 vPosition;
+#endif
+vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
+ return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
+}
+vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
+ return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
+}
+mat3 transposeMat3( const in mat3 m ) {
+ mat3 tmp;
+ tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
+ tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
+ tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
+ return tmp;
+}
+float luminance( const in vec3 rgb ) {
+ const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );
+ return dot( weights, rgb );
+}
+bool isPerspectiveMatrix( mat4 m ) {
+ return m[ 2 ][ 3 ] == - 1.0;
+}
+vec2 equirectUv( in vec3 dir ) {
+ float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
+ float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
+ return vec2( u, v );
+}
+vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
+ return RECIPROCAL_PI * diffuseColor;
+}
+vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
+ float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
+ return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
+}
+float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
+ float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
+ return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
+} // validated`,u1e=`#ifdef ENVMAP_TYPE_CUBE_UV
+ #define cubeUV_minMipLevel 4.0
+ #define cubeUV_minTileSize 16.0
+ float getFace( vec3 direction ) {
+ vec3 absDirection = abs( direction );
+ float face = - 1.0;
+ if ( absDirection.x > absDirection.z ) {
+ if ( absDirection.x > absDirection.y )
+ face = direction.x > 0.0 ? 0.0 : 3.0;
+ else
+ face = direction.y > 0.0 ? 1.0 : 4.0;
+ } else {
+ if ( absDirection.z > absDirection.y )
+ face = direction.z > 0.0 ? 2.0 : 5.0;
+ else
+ face = direction.y > 0.0 ? 1.0 : 4.0;
+ }
+ return face;
+ }
+ vec2 getUV( vec3 direction, float face ) {
+ vec2 uv;
+ if ( face == 0.0 ) {
+ uv = vec2( direction.z, direction.y ) / abs( direction.x );
+ } else if ( face == 1.0 ) {
+ uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
+ } else if ( face == 2.0 ) {
+ uv = vec2( - direction.x, direction.y ) / abs( direction.z );
+ } else if ( face == 3.0 ) {
+ uv = vec2( - direction.z, direction.y ) / abs( direction.x );
+ } else if ( face == 4.0 ) {
+ uv = vec2( - direction.x, direction.z ) / abs( direction.y );
+ } else {
+ uv = vec2( direction.x, direction.y ) / abs( direction.z );
+ }
+ return 0.5 * ( uv + 1.0 );
+ }
+ vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
+ float face = getFace( direction );
+ float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
+ mipInt = max( mipInt, cubeUV_minMipLevel );
+ float faceSize = exp2( mipInt );
+ highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
+ if ( face > 2.0 ) {
+ uv.y += faceSize;
+ face -= 3.0;
+ }
+ uv.x += face * faceSize;
+ uv.x += filterInt * 3.0 * cubeUV_minTileSize;
+ uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
+ uv.x *= CUBEUV_TEXEL_WIDTH;
+ uv.y *= CUBEUV_TEXEL_HEIGHT;
+ #ifdef texture2DGradEXT
+ return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
+ #else
+ return texture2D( envMap, uv ).rgb;
+ #endif
+ }
+ #define cubeUV_r0 1.0
+ #define cubeUV_m0 - 2.0
+ #define cubeUV_r1 0.8
+ #define cubeUV_m1 - 1.0
+ #define cubeUV_r4 0.4
+ #define cubeUV_m4 2.0
+ #define cubeUV_r5 0.305
+ #define cubeUV_m5 3.0
+ #define cubeUV_r6 0.21
+ #define cubeUV_m6 4.0
+ float roughnessToMip( float roughness ) {
+ float mip = 0.0;
+ if ( roughness >= cubeUV_r1 ) {
+ mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
+ } else if ( roughness >= cubeUV_r4 ) {
+ mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
+ } else if ( roughness >= cubeUV_r5 ) {
+ mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
+ } else if ( roughness >= cubeUV_r6 ) {
+ mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
+ } else {
+ mip = - 2.0 * log2( 1.16 * roughness ); }
+ return mip;
+ }
+ vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
+ float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
+ float mipF = fract( mip );
+ float mipInt = floor( mip );
+ vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
+ if ( mipF == 0.0 ) {
+ return vec4( color0, 1.0 );
+ } else {
+ vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
+ return vec4( mix( color0, color1, mipF ), 1.0 );
+ }
+ }
+#endif`,c1e=`vec3 transformedNormal = objectNormal;
+#ifdef USE_TANGENT
+ vec3 transformedTangent = objectTangent;
+#endif
+#ifdef USE_BATCHING
+ mat3 bm = mat3( batchingMatrix );
+ transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
+ transformedNormal = bm * transformedNormal;
+ #ifdef USE_TANGENT
+ transformedTangent = bm * transformedTangent;
+ #endif
+#endif
+#ifdef USE_INSTANCING
+ mat3 im = mat3( instanceMatrix );
+ transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
+ transformedNormal = im * transformedNormal;
+ #ifdef USE_TANGENT
+ transformedTangent = im * transformedTangent;
+ #endif
+#endif
+transformedNormal = normalMatrix * transformedNormal;
+#ifdef FLIP_SIDED
+ transformedNormal = - transformedNormal;
+#endif
+#ifdef USE_TANGENT
+ transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
+ #ifdef FLIP_SIDED
+ transformedTangent = - transformedTangent;
+ #endif
+#endif`,h1e=`#ifdef USE_DISPLACEMENTMAP
+ uniform sampler2D displacementMap;
+ uniform float displacementScale;
+ uniform float displacementBias;
+#endif`,f1e=`#ifdef USE_DISPLACEMENTMAP
+ transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
+#endif`,d1e=`#ifdef USE_EMISSIVEMAP
+ vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
+ totalEmissiveRadiance *= emissiveColor.rgb;
+#endif`,I1e=`#ifdef USE_EMISSIVEMAP
+ uniform sampler2D emissiveMap;
+#endif`,p1e="gl_FragColor = linearToOutputTexel( gl_FragColor );",E1e=`
+const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(
+ vec3( 0.8224621, 0.177538, 0.0 ),
+ vec3( 0.0331941, 0.9668058, 0.0 ),
+ vec3( 0.0170827, 0.0723974, 0.9105199 )
+);
+const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(
+ vec3( 1.2249401, - 0.2249404, 0.0 ),
+ vec3( - 0.0420569, 1.0420571, 0.0 ),
+ vec3( - 0.0196376, - 0.0786361, 1.0982735 )
+);
+vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {
+ return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );
+}
+vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {
+ return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );
+}
+vec4 LinearTransferOETF( in vec4 value ) {
+ return value;
+}
+vec4 sRGBTransferOETF( in vec4 value ) {
+ return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
+}
+vec4 LinearToLinear( in vec4 value ) {
+ return value;
+}
+vec4 LinearTosRGB( in vec4 value ) {
+ return sRGBTransferOETF( value );
+}`,y1e=`#ifdef USE_ENVMAP
+ #ifdef ENV_WORLDPOS
+ vec3 cameraToFrag;
+ if ( isOrthographic ) {
+ cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
+ } else {
+ cameraToFrag = normalize( vWorldPosition - cameraPosition );
+ }
+ vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
+ #ifdef ENVMAP_MODE_REFLECTION
+ vec3 reflectVec = reflect( cameraToFrag, worldNormal );
+ #else
+ vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
+ #endif
+ #else
+ vec3 reflectVec = vReflect;
+ #endif
+ #ifdef ENVMAP_TYPE_CUBE
+ vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
+ #else
+ vec4 envColor = vec4( 0.0 );
+ #endif
+ #ifdef ENVMAP_BLENDING_MULTIPLY
+ outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
+ #elif defined( ENVMAP_BLENDING_MIX )
+ outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
+ #elif defined( ENVMAP_BLENDING_ADD )
+ outgoingLight += envColor.xyz * specularStrength * reflectivity;
+ #endif
+#endif`,m1e=`#ifdef USE_ENVMAP
+ uniform float envMapIntensity;
+ uniform float flipEnvMap;
+ #ifdef ENVMAP_TYPE_CUBE
+ uniform samplerCube envMap;
+ #else
+ uniform sampler2D envMap;
+ #endif
+
+#endif`,T1e=`#ifdef USE_ENVMAP
+ uniform float reflectivity;
+ #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
+ #define ENV_WORLDPOS
+ #endif
+ #ifdef ENV_WORLDPOS
+ varying vec3 vWorldPosition;
+ uniform float refractionRatio;
+ #else
+ varying vec3 vReflect;
+ #endif
+#endif`,w1e=`#ifdef USE_ENVMAP
+ #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
+ #define ENV_WORLDPOS
+ #endif
+ #ifdef ENV_WORLDPOS
+
+ varying vec3 vWorldPosition;
+ #else
+ varying vec3 vReflect;
+ uniform float refractionRatio;
+ #endif
+#endif`,R1e=`#ifdef USE_ENVMAP
+ #ifdef ENV_WORLDPOS
+ vWorldPosition = worldPosition.xyz;
+ #else
+ vec3 cameraToVertex;
+ if ( isOrthographic ) {
+ cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
+ } else {
+ cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
+ }
+ vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
+ #ifdef ENVMAP_MODE_REFLECTION
+ vReflect = reflect( cameraToVertex, worldNormal );
+ #else
+ vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
+ #endif
+ #endif
+#endif`,g1e=`#ifdef USE_FOG
+ vFogDepth = - mvPosition.z;
+#endif`,A1e=`#ifdef USE_FOG
+ varying float vFogDepth;
+#endif`,S1e=`#ifdef USE_FOG
+ #ifdef FOG_EXP2
+ float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
+ #else
+ float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
+ #endif
+ gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
+#endif`,C1e=`#ifdef USE_FOG
+ uniform vec3 fogColor;
+ varying float vFogDepth;
+ #ifdef FOG_EXP2
+ uniform float fogDensity;
+ #else
+ uniform float fogNear;
+ uniform float fogFar;
+ #endif
+#endif`,N1e=`#ifdef USE_GRADIENTMAP
+ uniform sampler2D gradientMap;
+#endif
+vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
+ float dotNL = dot( normal, lightDirection );
+ vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
+ #ifdef USE_GRADIENTMAP
+ return vec3( texture2D( gradientMap, coord ).r );
+ #else
+ vec2 fw = fwidth( coord ) * 0.5;
+ return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
+ #endif
+}`,D1e=`#ifdef USE_LIGHTMAP
+ vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
+ vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
+ reflectedLight.indirectDiffuse += lightMapIrradiance;
+#endif`,O1e=`#ifdef USE_LIGHTMAP
+ uniform sampler2D lightMap;
+ uniform float lightMapIntensity;
+#endif`,L1e=`LambertMaterial material;
+material.diffuseColor = diffuseColor.rgb;
+material.specularStrength = specularStrength;`,b1e=`varying vec3 vViewPosition;
+struct LambertMaterial {
+ vec3 diffuseColor;
+ float specularStrength;
+};
+void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
+ float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
+ vec3 irradiance = dotNL * directLight.color;
+ reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
+}
+void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
+ reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
+}
+#define RE_Direct RE_Direct_Lambert
+#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,P1e=`uniform bool receiveShadow;
+uniform vec3 ambientLightColor;
+#if defined( USE_LIGHT_PROBES )
+ uniform vec3 lightProbe[ 9 ];
+#endif
+vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
+ float x = normal.x, y = normal.y, z = normal.z;
+ vec3 result = shCoefficients[ 0 ] * 0.886227;
+ result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
+ result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
+ result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
+ result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
+ result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
+ result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
+ result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
+ result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
+ return result;
+}
+vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
+ vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
+ vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
+ return irradiance;
+}
+vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
+ vec3 irradiance = ambientLightColor;
+ return irradiance;
+}
+float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
+ #if defined ( LEGACY_LIGHTS )
+ if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
+ return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );
+ }
+ return 1.0;
+ #else
+ float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
+ if ( cutoffDistance > 0.0 ) {
+ distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
+ }
+ return distanceFalloff;
+ #endif
+}
+float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
+ return smoothstep( coneCosine, penumbraCosine, angleCosine );
+}
+#if NUM_DIR_LIGHTS > 0
+ struct DirectionalLight {
+ vec3 direction;
+ vec3 color;
+ };
+ uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
+ void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
+ light.color = directionalLight.color;
+ light.direction = directionalLight.direction;
+ light.visible = true;
+ }
+#endif
+#if NUM_POINT_LIGHTS > 0
+ struct PointLight {
+ vec3 position;
+ vec3 color;
+ float distance;
+ float decay;
+ };
+ uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
+ void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
+ vec3 lVector = pointLight.position - geometryPosition;
+ light.direction = normalize( lVector );
+ float lightDistance = length( lVector );
+ light.color = pointLight.color;
+ light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
+ light.visible = ( light.color != vec3( 0.0 ) );
+ }
+#endif
+#if NUM_SPOT_LIGHTS > 0
+ struct SpotLight {
+ vec3 position;
+ vec3 direction;
+ vec3 color;
+ float distance;
+ float decay;
+ float coneCos;
+ float penumbraCos;
+ };
+ uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
+ void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
+ vec3 lVector = spotLight.position - geometryPosition;
+ light.direction = normalize( lVector );
+ float angleCos = dot( light.direction, spotLight.direction );
+ float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
+ if ( spotAttenuation > 0.0 ) {
+ float lightDistance = length( lVector );
+ light.color = spotLight.color * spotAttenuation;
+ light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
+ light.visible = ( light.color != vec3( 0.0 ) );
+ } else {
+ light.color = vec3( 0.0 );
+ light.visible = false;
+ }
+ }
+#endif
+#if NUM_RECT_AREA_LIGHTS > 0
+ struct RectAreaLight {
+ vec3 color;
+ vec3 position;
+ vec3 halfWidth;
+ vec3 halfHeight;
+ };
+ uniform sampler2D ltc_1; uniform sampler2D ltc_2;
+ uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
+#endif
+#if NUM_HEMI_LIGHTS > 0
+ struct HemisphereLight {
+ vec3 direction;
+ vec3 skyColor;
+ vec3 groundColor;
+ };
+ uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
+ vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
+ float dotNL = dot( normal, hemiLight.direction );
+ float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
+ vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
+ return irradiance;
+ }
+#endif`,M1e=`#ifdef USE_ENVMAP
+ vec3 getIBLIrradiance( const in vec3 normal ) {
+ #ifdef ENVMAP_TYPE_CUBE_UV
+ vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
+ vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );
+ return PI * envMapColor.rgb * envMapIntensity;
+ #else
+ return vec3( 0.0 );
+ #endif
+ }
+ vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
+ #ifdef ENVMAP_TYPE_CUBE_UV
+ vec3 reflectVec = reflect( - viewDir, normal );
+ reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
+ reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
+ vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );
+ return envMapColor.rgb * envMapIntensity;
+ #else
+ return vec3( 0.0 );
+ #endif
+ }
+ #ifdef USE_ANISOTROPY
+ vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
+ #ifdef ENVMAP_TYPE_CUBE_UV
+ vec3 bentNormal = cross( bitangent, viewDir );
+ bentNormal = normalize( cross( bentNormal, bitangent ) );
+ bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
+ return getIBLRadiance( viewDir, bentNormal, roughness );
+ #else
+ return vec3( 0.0 );
+ #endif
+ }
+ #endif
+#endif`,x1e=`ToonMaterial material;
+material.diffuseColor = diffuseColor.rgb;`,F1e=`varying vec3 vViewPosition;
+struct ToonMaterial {
+ vec3 diffuseColor;
+};
+void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
+ vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
+ reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
+}
+void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
+ reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
+}
+#define RE_Direct RE_Direct_Toon
+#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,U1e=`BlinnPhongMaterial material;
+material.diffuseColor = diffuseColor.rgb;
+material.specularColor = specular;
+material.specularShininess = shininess;
+material.specularStrength = specularStrength;`,B1e=`varying vec3 vViewPosition;
+struct BlinnPhongMaterial {
+ vec3 diffuseColor;
+ vec3 specularColor;
+ float specularShininess;
+ float specularStrength;
+};
+void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
+ float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
+ vec3 irradiance = dotNL * directLight.color;
+ reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
+ reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
+}
+void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
+ reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
+}
+#define RE_Direct RE_Direct_BlinnPhong
+#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,H1e=`PhysicalMaterial material;
+material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
+vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
+float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
+material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
+material.roughness = min( material.roughness, 1.0 );
+#ifdef IOR
+ material.ior = ior;
+ #ifdef USE_SPECULAR
+ float specularIntensityFactor = specularIntensity;
+ vec3 specularColorFactor = specularColor;
+ #ifdef USE_SPECULAR_COLORMAP
+ specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
+ #endif
+ #ifdef USE_SPECULAR_INTENSITYMAP
+ specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
+ #endif
+ material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
+ #else
+ float specularIntensityFactor = 1.0;
+ vec3 specularColorFactor = vec3( 1.0 );
+ material.specularF90 = 1.0;
+ #endif
+ material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
+#else
+ material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
+ material.specularF90 = 1.0;
+#endif
+#ifdef USE_CLEARCOAT
+ material.clearcoat = clearcoat;
+ material.clearcoatRoughness = clearcoatRoughness;
+ material.clearcoatF0 = vec3( 0.04 );
+ material.clearcoatF90 = 1.0;
+ #ifdef USE_CLEARCOATMAP
+ material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
+ #endif
+ #ifdef USE_CLEARCOAT_ROUGHNESSMAP
+ material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
+ #endif
+ material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
+ material.clearcoatRoughness += geometryRoughness;
+ material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
+#endif
+#ifdef USE_IRIDESCENCE
+ material.iridescence = iridescence;
+ material.iridescenceIOR = iridescenceIOR;
+ #ifdef USE_IRIDESCENCEMAP
+ material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
+ #endif
+ #ifdef USE_IRIDESCENCE_THICKNESSMAP
+ material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
+ #else
+ material.iridescenceThickness = iridescenceThicknessMaximum;
+ #endif
+#endif
+#ifdef USE_SHEEN
+ material.sheenColor = sheenColor;
+ #ifdef USE_SHEEN_COLORMAP
+ material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
+ #endif
+ material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
+ #ifdef USE_SHEEN_ROUGHNESSMAP
+ material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
+ #endif
+#endif
+#ifdef USE_ANISOTROPY
+ #ifdef USE_ANISOTROPYMAP
+ mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
+ vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
+ vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
+ #else
+ vec2 anisotropyV = anisotropyVector;
+ #endif
+ material.anisotropy = length( anisotropyV );
+ if( material.anisotropy == 0.0 ) {
+ anisotropyV = vec2( 1.0, 0.0 );
+ } else {
+ anisotropyV /= material.anisotropy;
+ material.anisotropy = saturate( material.anisotropy );
+ }
+ material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
+ material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
+ material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
+#endif`,_1e=`struct PhysicalMaterial {
+ vec3 diffuseColor;
+ float roughness;
+ vec3 specularColor;
+ float specularF90;
+ #ifdef USE_CLEARCOAT
+ float clearcoat;
+ float clearcoatRoughness;
+ vec3 clearcoatF0;
+ float clearcoatF90;
+ #endif
+ #ifdef USE_IRIDESCENCE
+ float iridescence;
+ float iridescenceIOR;
+ float iridescenceThickness;
+ vec3 iridescenceFresnel;
+ vec3 iridescenceF0;
+ #endif
+ #ifdef USE_SHEEN
+ vec3 sheenColor;
+ float sheenRoughness;
+ #endif
+ #ifdef IOR
+ float ior;
+ #endif
+ #ifdef USE_TRANSMISSION
+ float transmission;
+ float transmissionAlpha;
+ float thickness;
+ float attenuationDistance;
+ vec3 attenuationColor;
+ #endif
+ #ifdef USE_ANISOTROPY
+ float anisotropy;
+ float alphaT;
+ vec3 anisotropyT;
+ vec3 anisotropyB;
+ #endif
+};
+vec3 clearcoatSpecularDirect = vec3( 0.0 );
+vec3 clearcoatSpecularIndirect = vec3( 0.0 );
+vec3 sheenSpecularDirect = vec3( 0.0 );
+vec3 sheenSpecularIndirect = vec3(0.0 );
+vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
+ float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
+ float x2 = x * x;
+ float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
+ return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
+}
+float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
+ float a2 = pow2( alpha );
+ float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
+ float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
+ return 0.5 / max( gv + gl, EPSILON );
+}
+float D_GGX( const in float alpha, const in float dotNH ) {
+ float a2 = pow2( alpha );
+ float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
+ return RECIPROCAL_PI * a2 / pow2( denom );
+}
+#ifdef USE_ANISOTROPY
+ float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
+ float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
+ float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
+ float v = 0.5 / ( gv + gl );
+ return saturate(v);
+ }
+ float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
+ float a2 = alphaT * alphaB;
+ highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
+ highp float v2 = dot( v, v );
+ float w2 = a2 / v2;
+ return RECIPROCAL_PI * a2 * pow2 ( w2 );
+ }
+#endif
+#ifdef USE_CLEARCOAT
+ vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
+ vec3 f0 = material.clearcoatF0;
+ float f90 = material.clearcoatF90;
+ float roughness = material.clearcoatRoughness;
+ float alpha = pow2( roughness );
+ vec3 halfDir = normalize( lightDir + viewDir );
+ float dotNL = saturate( dot( normal, lightDir ) );
+ float dotNV = saturate( dot( normal, viewDir ) );
+ float dotNH = saturate( dot( normal, halfDir ) );
+ float dotVH = saturate( dot( viewDir, halfDir ) );
+ vec3 F = F_Schlick( f0, f90, dotVH );
+ float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
+ float D = D_GGX( alpha, dotNH );
+ return F * ( V * D );
+ }
+#endif
+vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
+ vec3 f0 = material.specularColor;
+ float f90 = material.specularF90;
+ float roughness = material.roughness;
+ float alpha = pow2( roughness );
+ vec3 halfDir = normalize( lightDir + viewDir );
+ float dotNL = saturate( dot( normal, lightDir ) );
+ float dotNV = saturate( dot( normal, viewDir ) );
+ float dotNH = saturate( dot( normal, halfDir ) );
+ float dotVH = saturate( dot( viewDir, halfDir ) );
+ vec3 F = F_Schlick( f0, f90, dotVH );
+ #ifdef USE_IRIDESCENCE
+ F = mix( F, material.iridescenceFresnel, material.iridescence );
+ #endif
+ #ifdef USE_ANISOTROPY
+ float dotTL = dot( material.anisotropyT, lightDir );
+ float dotTV = dot( material.anisotropyT, viewDir );
+ float dotTH = dot( material.anisotropyT, halfDir );
+ float dotBL = dot( material.anisotropyB, lightDir );
+ float dotBV = dot( material.anisotropyB, viewDir );
+ float dotBH = dot( material.anisotropyB, halfDir );
+ float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
+ float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
+ #else
+ float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
+ float D = D_GGX( alpha, dotNH );
+ #endif
+ return F * ( V * D );
+}
+vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
+ const float LUT_SIZE = 64.0;
+ const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
+ const float LUT_BIAS = 0.5 / LUT_SIZE;
+ float dotNV = saturate( dot( N, V ) );
+ vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
+ uv = uv * LUT_SCALE + LUT_BIAS;
+ return uv;
+}
+float LTC_ClippedSphereFormFactor( const in vec3 f ) {
+ float l = length( f );
+ return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
+}
+vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
+ float x = dot( v1, v2 );
+ float y = abs( x );
+ float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
+ float b = 3.4175940 + ( 4.1616724 + y ) * y;
+ float v = a / b;
+ float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
+ return cross( v1, v2 ) * theta_sintheta;
+}
+vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
+ vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
+ vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
+ vec3 lightNormal = cross( v1, v2 );
+ if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
+ vec3 T1, T2;
+ T1 = normalize( V - N * dot( V, N ) );
+ T2 = - cross( N, T1 );
+ mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
+ vec3 coords[ 4 ];
+ coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
+ coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
+ coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
+ coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
+ coords[ 0 ] = normalize( coords[ 0 ] );
+ coords[ 1 ] = normalize( coords[ 1 ] );
+ coords[ 2 ] = normalize( coords[ 2 ] );
+ coords[ 3 ] = normalize( coords[ 3 ] );
+ vec3 vectorFormFactor = vec3( 0.0 );
+ vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
+ vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
+ vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
+ vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
+ float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
+ return vec3( result );
+}
+#if defined( USE_SHEEN )
+float D_Charlie( float roughness, float dotNH ) {
+ float alpha = pow2( roughness );
+ float invAlpha = 1.0 / alpha;
+ float cos2h = dotNH * dotNH;
+ float sin2h = max( 1.0 - cos2h, 0.0078125 );
+ return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
+}
+float V_Neubelt( float dotNV, float dotNL ) {
+ return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
+}
+vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
+ vec3 halfDir = normalize( lightDir + viewDir );
+ float dotNL = saturate( dot( normal, lightDir ) );
+ float dotNV = saturate( dot( normal, viewDir ) );
+ float dotNH = saturate( dot( normal, halfDir ) );
+ float D = D_Charlie( sheenRoughness, dotNH );
+ float V = V_Neubelt( dotNV, dotNL );
+ return sheenColor * ( D * V );
+}
+#endif
+float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
+ float dotNV = saturate( dot( normal, viewDir ) );
+ float r2 = roughness * roughness;
+ float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
+ float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
+ float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
+ return saturate( DG * RECIPROCAL_PI );
+}
+vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
+ float dotNV = saturate( dot( normal, viewDir ) );
+ const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
+ const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
+ vec4 r = roughness * c0 + c1;
+ float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
+ vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
+ return fab;
+}
+vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
+ vec2 fab = DFGApprox( normal, viewDir, roughness );
+ return specularColor * fab.x + specularF90 * fab.y;
+}
+#ifdef USE_IRIDESCENCE
+void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
+#else
+void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
+#endif
+ vec2 fab = DFGApprox( normal, viewDir, roughness );
+ #ifdef USE_IRIDESCENCE
+ vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
+ #else
+ vec3 Fr = specularColor;
+ #endif
+ vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
+ float Ess = fab.x + fab.y;
+ float Ems = 1.0 - Ess;
+ vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
+ singleScatter += FssEss;
+ multiScatter += Fms * Ems;
+}
+#if NUM_RECT_AREA_LIGHTS > 0
+ void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
+ vec3 normal = geometryNormal;
+ vec3 viewDir = geometryViewDir;
+ vec3 position = geometryPosition;
+ vec3 lightPos = rectAreaLight.position;
+ vec3 halfWidth = rectAreaLight.halfWidth;
+ vec3 halfHeight = rectAreaLight.halfHeight;
+ vec3 lightColor = rectAreaLight.color;
+ float roughness = material.roughness;
+ vec3 rectCoords[ 4 ];
+ rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
+ rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
+ rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
+ vec2 uv = LTC_Uv( normal, viewDir, roughness );
+ vec4 t1 = texture2D( ltc_1, uv );
+ vec4 t2 = texture2D( ltc_2, uv );
+ mat3 mInv = mat3(
+ vec3( t1.x, 0, t1.y ),
+ vec3( 0, 1, 0 ),
+ vec3( t1.z, 0, t1.w )
+ );
+ vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
+ reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
+ reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
+ }
+#endif
+void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
+ float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
+ vec3 irradiance = dotNL * directLight.color;
+ #ifdef USE_CLEARCOAT
+ float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
+ vec3 ccIrradiance = dotNLcc * directLight.color;
+ clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
+ #endif
+ #ifdef USE_SHEEN
+ sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
+ #endif
+ reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
+ reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
+}
+void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
+ reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
+}
+void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
+ #ifdef USE_CLEARCOAT
+ clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
+ #endif
+ #ifdef USE_SHEEN
+ sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
+ #endif
+ vec3 singleScattering = vec3( 0.0 );
+ vec3 multiScattering = vec3( 0.0 );
+ vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
+ #ifdef USE_IRIDESCENCE
+ computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
+ #else
+ computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
+ #endif
+ vec3 totalScattering = singleScattering + multiScattering;
+ vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
+ reflectedLight.indirectSpecular += radiance * singleScattering;
+ reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
+ reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
+}
+#define RE_Direct RE_Direct_Physical
+#define RE_Direct_RectArea RE_Direct_RectArea_Physical
+#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
+#define RE_IndirectSpecular RE_IndirectSpecular_Physical
+float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
+ return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
+}`,G1e=`
+vec3 geometryPosition = - vViewPosition;
+vec3 geometryNormal = normal;
+vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
+vec3 geometryClearcoatNormal = vec3( 0.0 );
+#ifdef USE_CLEARCOAT
+ geometryClearcoatNormal = clearcoatNormal;
+#endif
+#ifdef USE_IRIDESCENCE
+ float dotNVi = saturate( dot( normal, geometryViewDir ) );
+ if ( material.iridescenceThickness == 0.0 ) {
+ material.iridescence = 0.0;
+ } else {
+ material.iridescence = saturate( material.iridescence );
+ }
+ if ( material.iridescence > 0.0 ) {
+ material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
+ material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
+ }
+#endif
+IncidentLight directLight;
+#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
+ PointLight pointLight;
+ #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
+ PointLightShadow pointLightShadow;
+ #endif
+ #pragma unroll_loop_start
+ for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
+ pointLight = pointLights[ i ];
+ getPointLightInfo( pointLight, geometryPosition, directLight );
+ #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
+ pointLightShadow = pointLightShadows[ i ];
+ directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
+ #endif
+ RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
+ }
+ #pragma unroll_loop_end
+#endif
+#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
+ SpotLight spotLight;
+ vec4 spotColor;
+ vec3 spotLightCoord;
+ bool inSpotLightMap;
+ #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
+ SpotLightShadow spotLightShadow;
+ #endif
+ #pragma unroll_loop_start
+ for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
+ spotLight = spotLights[ i ];
+ getSpotLightInfo( spotLight, geometryPosition, directLight );
+ #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
+ #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
+ #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
+ #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
+ #else
+ #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
+ #endif
+ #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
+ spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
+ inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
+ spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
+ directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
+ #endif
+ #undef SPOT_LIGHT_MAP_INDEX
+ #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
+ spotLightShadow = spotLightShadows[ i ];
+ directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
+ #endif
+ RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
+ }
+ #pragma unroll_loop_end
+#endif
+#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
+ DirectionalLight directionalLight;
+ #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
+ DirectionalLightShadow directionalLightShadow;
+ #endif
+ #pragma unroll_loop_start
+ for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
+ directionalLight = directionalLights[ i ];
+ getDirectionalLightInfo( directionalLight, directLight );
+ #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
+ directionalLightShadow = directionalLightShadows[ i ];
+ directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
+ #endif
+ RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
+ }
+ #pragma unroll_loop_end
+#endif
+#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
+ RectAreaLight rectAreaLight;
+ #pragma unroll_loop_start
+ for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
+ rectAreaLight = rectAreaLights[ i ];
+ RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
+ }
+ #pragma unroll_loop_end
+#endif
+#if defined( RE_IndirectDiffuse )
+ vec3 iblIrradiance = vec3( 0.0 );
+ vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
+ #if defined( USE_LIGHT_PROBES )
+ irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
+ #endif
+ #if ( NUM_HEMI_LIGHTS > 0 )
+ #pragma unroll_loop_start
+ for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
+ irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
+ }
+ #pragma unroll_loop_end
+ #endif
+#endif
+#if defined( RE_IndirectSpecular )
+ vec3 radiance = vec3( 0.0 );
+ vec3 clearcoatRadiance = vec3( 0.0 );
+#endif`,V1e=`#if defined( RE_IndirectDiffuse )
+ #ifdef USE_LIGHTMAP
+ vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
+ vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
+ irradiance += lightMapIrradiance;
+ #endif
+ #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
+ iblIrradiance += getIBLIrradiance( geometryNormal );
+ #endif
+#endif
+#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
+ #ifdef USE_ANISOTROPY
+ radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
+ #else
+ radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
+ #endif
+ #ifdef USE_CLEARCOAT
+ clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
+ #endif
+#endif`,z1e=`#if defined( RE_IndirectDiffuse )
+ RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
+#endif
+#if defined( RE_IndirectSpecular )
+ RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
+#endif`,k1e=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
+ gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
+#endif`,Y1e=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
+ uniform float logDepthBufFC;
+ varying float vFragDepth;
+ varying float vIsPerspective;
+#endif`,W1e=`#ifdef USE_LOGDEPTHBUF
+ #ifdef USE_LOGDEPTHBUF_EXT
+ varying float vFragDepth;
+ varying float vIsPerspective;
+ #else
+ uniform float logDepthBufFC;
+ #endif
+#endif`,j1e=`#ifdef USE_LOGDEPTHBUF
+ #ifdef USE_LOGDEPTHBUF_EXT
+ vFragDepth = 1.0 + gl_Position.w;
+ vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
+ #else
+ if ( isPerspectiveMatrix( projectionMatrix ) ) {
+ gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
+ gl_Position.z *= gl_Position.w;
+ }
+ #endif
+#endif`,q1e=`#ifdef USE_MAP
+ vec4 sampledDiffuseColor = texture2D( map, vMapUv );
+ #ifdef DECODE_VIDEO_TEXTURE
+ sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );
+
+ #endif
+ diffuseColor *= sampledDiffuseColor;
+#endif`,Z1e=`#ifdef USE_MAP
+ uniform sampler2D map;
+#endif`,K1e=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
+ #if defined( USE_POINTS_UV )
+ vec2 uv = vUv;
+ #else
+ vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
+ #endif
+#endif
+#ifdef USE_MAP
+ diffuseColor *= texture2D( map, uv );
+#endif
+#ifdef USE_ALPHAMAP
+ diffuseColor.a *= texture2D( alphaMap, uv ).g;
+#endif`,Q1e=`#if defined( USE_POINTS_UV )
+ varying vec2 vUv;
+#else
+ #if defined( USE_MAP ) || defined( USE_ALPHAMAP )
+ uniform mat3 uvTransform;
+ #endif
+#endif
+#ifdef USE_MAP
+ uniform sampler2D map;
+#endif
+#ifdef USE_ALPHAMAP
+ uniform sampler2D alphaMap;
+#endif`,$1e=`float metalnessFactor = metalness;
+#ifdef USE_METALNESSMAP
+ vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
+ metalnessFactor *= texelMetalness.b;
+#endif`,J1e=`#ifdef USE_METALNESSMAP
+ uniform sampler2D metalnessMap;
+#endif`,X1e=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )
+ vColor *= morphTargetBaseInfluence;
+ for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
+ #if defined( USE_COLOR_ALPHA )
+ if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
+ #elif defined( USE_COLOR )
+ if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
+ #endif
+ }
+#endif`,v1e=`#ifdef USE_MORPHNORMALS
+ objectNormal *= morphTargetBaseInfluence;
+ #ifdef MORPHTARGETS_TEXTURE
+ for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
+ if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
+ }
+ #else
+ objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
+ objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
+ objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
+ objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
+ #endif
+#endif`,epe=`#ifdef USE_MORPHTARGETS
+ uniform float morphTargetBaseInfluence;
+ #ifdef MORPHTARGETS_TEXTURE
+ uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
+ uniform sampler2DArray morphTargetsTexture;
+ uniform ivec2 morphTargetsTextureSize;
+ vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
+ int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
+ int y = texelIndex / morphTargetsTextureSize.x;
+ int x = texelIndex - y * morphTargetsTextureSize.x;
+ ivec3 morphUV = ivec3( x, y, morphTargetIndex );
+ return texelFetch( morphTargetsTexture, morphUV, 0 );
+ }
+ #else
+ #ifndef USE_MORPHNORMALS
+ uniform float morphTargetInfluences[ 8 ];
+ #else
+ uniform float morphTargetInfluences[ 4 ];
+ #endif
+ #endif
+#endif`,tpe=`#ifdef USE_MORPHTARGETS
+ transformed *= morphTargetBaseInfluence;
+ #ifdef MORPHTARGETS_TEXTURE
+ for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
+ if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
+ }
+ #else
+ transformed += morphTarget0 * morphTargetInfluences[ 0 ];
+ transformed += morphTarget1 * morphTargetInfluences[ 1 ];
+ transformed += morphTarget2 * morphTargetInfluences[ 2 ];
+ transformed += morphTarget3 * morphTargetInfluences[ 3 ];
+ #ifndef USE_MORPHNORMALS
+ transformed += morphTarget4 * morphTargetInfluences[ 4 ];
+ transformed += morphTarget5 * morphTargetInfluences[ 5 ];
+ transformed += morphTarget6 * morphTargetInfluences[ 6 ];
+ transformed += morphTarget7 * morphTargetInfluences[ 7 ];
+ #endif
+ #endif
+#endif`,npe=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
+#ifdef FLAT_SHADED
+ vec3 fdx = dFdx( vViewPosition );
+ vec3 fdy = dFdy( vViewPosition );
+ vec3 normal = normalize( cross( fdx, fdy ) );
+#else
+ vec3 normal = normalize( vNormal );
+ #ifdef DOUBLE_SIDED
+ normal *= faceDirection;
+ #endif
+#endif
+#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
+ #ifdef USE_TANGENT
+ mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
+ #else
+ mat3 tbn = getTangentFrame( - vViewPosition, normal,
+ #if defined( USE_NORMALMAP )
+ vNormalMapUv
+ #elif defined( USE_CLEARCOAT_NORMALMAP )
+ vClearcoatNormalMapUv
+ #else
+ vUv
+ #endif
+ );
+ #endif
+ #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
+ tbn[0] *= faceDirection;
+ tbn[1] *= faceDirection;
+ #endif
+#endif
+#ifdef USE_CLEARCOAT_NORMALMAP
+ #ifdef USE_TANGENT
+ mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
+ #else
+ mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
+ #endif
+ #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
+ tbn2[0] *= faceDirection;
+ tbn2[1] *= faceDirection;
+ #endif
+#endif
+vec3 nonPerturbedNormal = normal;`,spe=`#ifdef USE_NORMALMAP_OBJECTSPACE
+ normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
+ #ifdef FLIP_SIDED
+ normal = - normal;
+ #endif
+ #ifdef DOUBLE_SIDED
+ normal = normal * faceDirection;
+ #endif
+ normal = normalize( normalMatrix * normal );
+#elif defined( USE_NORMALMAP_TANGENTSPACE )
+ vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
+ mapN.xy *= normalScale;
+ normal = normalize( tbn * mapN );
+#elif defined( USE_BUMPMAP )
+ normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
+#endif`,lpe=`#ifndef FLAT_SHADED
+ varying vec3 vNormal;
+ #ifdef USE_TANGENT
+ varying vec3 vTangent;
+ varying vec3 vBitangent;
+ #endif
+#endif`,rpe=`#ifndef FLAT_SHADED
+ varying vec3 vNormal;
+ #ifdef USE_TANGENT
+ varying vec3 vTangent;
+ varying vec3 vBitangent;
+ #endif
+#endif`,ipe=`#ifndef FLAT_SHADED
+ vNormal = normalize( transformedNormal );
+ #ifdef USE_TANGENT
+ vTangent = normalize( transformedTangent );
+ vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
+ #endif
+#endif`,ape=`#ifdef USE_NORMALMAP
+ uniform sampler2D normalMap;
+ uniform vec2 normalScale;
+#endif
+#ifdef USE_NORMALMAP_OBJECTSPACE
+ uniform mat3 normalMatrix;
+#endif
+#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
+ mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
+ vec3 q0 = dFdx( eye_pos.xyz );
+ vec3 q1 = dFdy( eye_pos.xyz );
+ vec2 st0 = dFdx( uv.st );
+ vec2 st1 = dFdy( uv.st );
+ vec3 N = surf_norm;
+ vec3 q1perp = cross( q1, N );
+ vec3 q0perp = cross( N, q0 );
+ vec3 T = q1perp * st0.x + q0perp * st1.x;
+ vec3 B = q1perp * st0.y + q0perp * st1.y;
+ float det = max( dot( T, T ), dot( B, B ) );
+ float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
+ return mat3( T * scale, B * scale, N );
+ }
+#endif`,ope=`#ifdef USE_CLEARCOAT
+ vec3 clearcoatNormal = nonPerturbedNormal;
+#endif`,upe=`#ifdef USE_CLEARCOAT_NORMALMAP
+ vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
+ clearcoatMapN.xy *= clearcoatNormalScale;
+ clearcoatNormal = normalize( tbn2 * clearcoatMapN );
+#endif`,cpe=`#ifdef USE_CLEARCOATMAP
+ uniform sampler2D clearcoatMap;
+#endif
+#ifdef USE_CLEARCOAT_NORMALMAP
+ uniform sampler2D clearcoatNormalMap;
+ uniform vec2 clearcoatNormalScale;
+#endif
+#ifdef USE_CLEARCOAT_ROUGHNESSMAP
+ uniform sampler2D clearcoatRoughnessMap;
+#endif`,hpe=`#ifdef USE_IRIDESCENCEMAP
+ uniform sampler2D iridescenceMap;
+#endif
+#ifdef USE_IRIDESCENCE_THICKNESSMAP
+ uniform sampler2D iridescenceThicknessMap;
+#endif`,fpe=`#ifdef OPAQUE
+diffuseColor.a = 1.0;
+#endif
+#ifdef USE_TRANSMISSION
+diffuseColor.a *= material.transmissionAlpha;
+#endif
+gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,dpe=`vec3 packNormalToRGB( const in vec3 normal ) {
+ return normalize( normal ) * 0.5 + 0.5;
+}
+vec3 unpackRGBToNormal( const in vec3 rgb ) {
+ return 2.0 * rgb.xyz - 1.0;
+}
+const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
+const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
+const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
+const float ShiftRight8 = 1. / 256.;
+vec4 packDepthToRGBA( const in float v ) {
+ vec4 r = vec4( fract( v * PackFactors ), v );
+ r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;
+}
+float unpackRGBAToDepth( const in vec4 v ) {
+ return dot( v, UnpackFactors );
+}
+vec2 packDepthToRG( in highp float v ) {
+ return packDepthToRGBA( v ).yx;
+}
+float unpackRGToDepth( const in highp vec2 v ) {
+ return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );
+}
+vec4 pack2HalfToRGBA( vec2 v ) {
+ vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
+ return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
+}
+vec2 unpackRGBATo2Half( vec4 v ) {
+ return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
+}
+float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
+ return ( viewZ + near ) / ( near - far );
+}
+float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
+ return depth * ( near - far ) - near;
+}
+float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
+ return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
+}
+float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
+ return ( near * far ) / ( ( far - near ) * depth - far );
+}`,Ipe=`#ifdef PREMULTIPLIED_ALPHA
+ gl_FragColor.rgb *= gl_FragColor.a;
+#endif`,ppe=`vec4 mvPosition = vec4( transformed, 1.0 );
+#ifdef USE_BATCHING
+ mvPosition = batchingMatrix * mvPosition;
+#endif
+#ifdef USE_INSTANCING
+ mvPosition = instanceMatrix * mvPosition;
+#endif
+mvPosition = modelViewMatrix * mvPosition;
+gl_Position = projectionMatrix * mvPosition;`,Epe=`#ifdef DITHERING
+ gl_FragColor.rgb = dithering( gl_FragColor.rgb );
+#endif`,ype=`#ifdef DITHERING
+ vec3 dithering( vec3 color ) {
+ float grid_position = rand( gl_FragCoord.xy );
+ vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
+ dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
+ return color + dither_shift_RGB;
+ }
+#endif`,mpe=`float roughnessFactor = roughness;
+#ifdef USE_ROUGHNESSMAP
+ vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
+ roughnessFactor *= texelRoughness.g;
+#endif`,Tpe=`#ifdef USE_ROUGHNESSMAP
+ uniform sampler2D roughnessMap;
+#endif`,wpe=`#if NUM_SPOT_LIGHT_COORDS > 0
+ varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
+#endif
+#if NUM_SPOT_LIGHT_MAPS > 0
+ uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
+#endif
+#ifdef USE_SHADOWMAP
+ #if NUM_DIR_LIGHT_SHADOWS > 0
+ uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
+ varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
+ struct DirectionalLightShadow {
+ float shadowBias;
+ float shadowNormalBias;
+ float shadowRadius;
+ vec2 shadowMapSize;
+ };
+ uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
+ #endif
+ #if NUM_SPOT_LIGHT_SHADOWS > 0
+ uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
+ struct SpotLightShadow {
+ float shadowBias;
+ float shadowNormalBias;
+ float shadowRadius;
+ vec2 shadowMapSize;
+ };
+ uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
+ #endif
+ #if NUM_POINT_LIGHT_SHADOWS > 0
+ uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
+ varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
+ struct PointLightShadow {
+ float shadowBias;
+ float shadowNormalBias;
+ float shadowRadius;
+ vec2 shadowMapSize;
+ float shadowCameraNear;
+ float shadowCameraFar;
+ };
+ uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
+ #endif
+ float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
+ return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
+ }
+ vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
+ return unpackRGBATo2Half( texture2D( shadow, uv ) );
+ }
+ float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
+ float occlusion = 1.0;
+ vec2 distribution = texture2DDistribution( shadow, uv );
+ float hard_shadow = step( compare , distribution.x );
+ if (hard_shadow != 1.0 ) {
+ float distance = compare - distribution.x ;
+ float variance = max( 0.00000, distribution.y * distribution.y );
+ float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
+ }
+ return occlusion;
+ }
+ float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
+ float shadow = 1.0;
+ shadowCoord.xyz /= shadowCoord.w;
+ shadowCoord.z += shadowBias;
+ bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
+ bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
+ if ( frustumTest ) {
+ #if defined( SHADOWMAP_TYPE_PCF )
+ vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
+ float dx0 = - texelSize.x * shadowRadius;
+ float dy0 = - texelSize.y * shadowRadius;
+ float dx1 = + texelSize.x * shadowRadius;
+ float dy1 = + texelSize.y * shadowRadius;
+ float dx2 = dx0 / 2.0;
+ float dy2 = dy0 / 2.0;
+ float dx3 = dx1 / 2.0;
+ float dy3 = dy1 / 2.0;
+ shadow = (
+ texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
+ texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
+ texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
+ texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
+ texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
+ texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
+ texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
+ texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
+ texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
+ texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
+ texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
+ texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
+ texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
+ texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
+ texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
+ texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
+ texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
+ ) * ( 1.0 / 17.0 );
+ #elif defined( SHADOWMAP_TYPE_PCF_SOFT )
+ vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
+ float dx = texelSize.x;
+ float dy = texelSize.y;
+ vec2 uv = shadowCoord.xy;
+ vec2 f = fract( uv * shadowMapSize + 0.5 );
+ uv -= f * texelSize;
+ shadow = (
+ texture2DCompare( shadowMap, uv, shadowCoord.z ) +
+ texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
+ texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
+ texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
+ mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
+ texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
+ f.x ) +
+ mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
+ texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
+ f.x ) +
+ mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
+ texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
+ f.y ) +
+ mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
+ texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
+ f.y ) +
+ mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
+ texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
+ f.x ),
+ mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
+ texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
+ f.x ),
+ f.y )
+ ) * ( 1.0 / 9.0 );
+ #elif defined( SHADOWMAP_TYPE_VSM )
+ shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
+ #else
+ shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
+ #endif
+ }
+ return shadow;
+ }
+ vec2 cubeToUV( vec3 v, float texelSizeY ) {
+ vec3 absV = abs( v );
+ float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
+ absV *= scaleToCube;
+ v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
+ vec2 planar = v.xy;
+ float almostATexel = 1.5 * texelSizeY;
+ float almostOne = 1.0 - almostATexel;
+ if ( absV.z >= almostOne ) {
+ if ( v.z > 0.0 )
+ planar.x = 4.0 - v.x;
+ } else if ( absV.x >= almostOne ) {
+ float signX = sign( v.x );
+ planar.x = v.z * signX + 2.0 * signX;
+ } else if ( absV.y >= almostOne ) {
+ float signY = sign( v.y );
+ planar.x = v.x + 2.0 * signY + 2.0;
+ planar.y = v.z * signY - 2.0;
+ }
+ return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
+ }
+ float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
+ vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
+ vec3 lightToPosition = shadowCoord.xyz;
+ float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;
+ vec3 bd3D = normalize( lightToPosition );
+ #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
+ vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
+ return (
+ texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
+ texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
+ texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
+ texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
+ texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
+ texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
+ texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
+ texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
+ texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
+ ) * ( 1.0 / 9.0 );
+ #else
+ return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
+ #endif
+ }
+#endif`,Rpe=`#if NUM_SPOT_LIGHT_COORDS > 0
+ uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
+ varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
+#endif
+#ifdef USE_SHADOWMAP
+ #if NUM_DIR_LIGHT_SHADOWS > 0
+ uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
+ varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
+ struct DirectionalLightShadow {
+ float shadowBias;
+ float shadowNormalBias;
+ float shadowRadius;
+ vec2 shadowMapSize;
+ };
+ uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
+ #endif
+ #if NUM_SPOT_LIGHT_SHADOWS > 0
+ struct SpotLightShadow {
+ float shadowBias;
+ float shadowNormalBias;
+ float shadowRadius;
+ vec2 shadowMapSize;
+ };
+ uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
+ #endif
+ #if NUM_POINT_LIGHT_SHADOWS > 0
+ uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
+ varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
+ struct PointLightShadow {
+ float shadowBias;
+ float shadowNormalBias;
+ float shadowRadius;
+ vec2 shadowMapSize;
+ float shadowCameraNear;
+ float shadowCameraFar;
+ };
+ uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
+ #endif
+#endif`,gpe=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
+ vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
+ vec4 shadowWorldPosition;
+#endif
+#if defined( USE_SHADOWMAP )
+ #if NUM_DIR_LIGHT_SHADOWS > 0
+ #pragma unroll_loop_start
+ for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
+ shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
+ vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
+ }
+ #pragma unroll_loop_end
+ #endif
+ #if NUM_POINT_LIGHT_SHADOWS > 0
+ #pragma unroll_loop_start
+ for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
+ shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
+ vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
+ }
+ #pragma unroll_loop_end
+ #endif
+#endif
+#if NUM_SPOT_LIGHT_COORDS > 0
+ #pragma unroll_loop_start
+ for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
+ shadowWorldPosition = worldPosition;
+ #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
+ shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
+ #endif
+ vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
+ }
+ #pragma unroll_loop_end
+#endif`,Ape=`float getShadowMask() {
+ float shadow = 1.0;
+ #ifdef USE_SHADOWMAP
+ #if NUM_DIR_LIGHT_SHADOWS > 0
+ DirectionalLightShadow directionalLight;
+ #pragma unroll_loop_start
+ for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
+ directionalLight = directionalLightShadows[ i ];
+ shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
+ }
+ #pragma unroll_loop_end
+ #endif
+ #if NUM_SPOT_LIGHT_SHADOWS > 0
+ SpotLightShadow spotLight;
+ #pragma unroll_loop_start
+ for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
+ spotLight = spotLightShadows[ i ];
+ shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
+ }
+ #pragma unroll_loop_end
+ #endif
+ #if NUM_POINT_LIGHT_SHADOWS > 0
+ PointLightShadow pointLight;
+ #pragma unroll_loop_start
+ for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
+ pointLight = pointLightShadows[ i ];
+ shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
+ }
+ #pragma unroll_loop_end
+ #endif
+ #endif
+ return shadow;
+}`,Spe=`#ifdef USE_SKINNING
+ mat4 boneMatX = getBoneMatrix( skinIndex.x );
+ mat4 boneMatY = getBoneMatrix( skinIndex.y );
+ mat4 boneMatZ = getBoneMatrix( skinIndex.z );
+ mat4 boneMatW = getBoneMatrix( skinIndex.w );
+#endif`,Cpe=`#ifdef USE_SKINNING
+ uniform mat4 bindMatrix;
+ uniform mat4 bindMatrixInverse;
+ uniform highp sampler2D boneTexture;
+ mat4 getBoneMatrix( const in float i ) {
+ int size = textureSize( boneTexture, 0 ).x;
+ int j = int( i ) * 4;
+ int x = j % size;
+ int y = j / size;
+ vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
+ vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
+ vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
+ vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
+ return mat4( v1, v2, v3, v4 );
+ }
+#endif`,Npe=`#ifdef USE_SKINNING
+ vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
+ vec4 skinned = vec4( 0.0 );
+ skinned += boneMatX * skinVertex * skinWeight.x;
+ skinned += boneMatY * skinVertex * skinWeight.y;
+ skinned += boneMatZ * skinVertex * skinWeight.z;
+ skinned += boneMatW * skinVertex * skinWeight.w;
+ transformed = ( bindMatrixInverse * skinned ).xyz;
+#endif`,Dpe=`#ifdef USE_SKINNING
+ mat4 skinMatrix = mat4( 0.0 );
+ skinMatrix += skinWeight.x * boneMatX;
+ skinMatrix += skinWeight.y * boneMatY;
+ skinMatrix += skinWeight.z * boneMatZ;
+ skinMatrix += skinWeight.w * boneMatW;
+ skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
+ objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
+ #ifdef USE_TANGENT
+ objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
+ #endif
+#endif`,Ope=`float specularStrength;
+#ifdef USE_SPECULARMAP
+ vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
+ specularStrength = texelSpecular.r;
+#else
+ specularStrength = 1.0;
+#endif`,Lpe=`#ifdef USE_SPECULARMAP
+ uniform sampler2D specularMap;
+#endif`,bpe=`#if defined( TONE_MAPPING )
+ gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
+#endif`,Ppe=`#ifndef saturate
+#define saturate( a ) clamp( a, 0.0, 1.0 )
+#endif
+uniform float toneMappingExposure;
+vec3 LinearToneMapping( vec3 color ) {
+ return saturate( toneMappingExposure * color );
+}
+vec3 ReinhardToneMapping( vec3 color ) {
+ color *= toneMappingExposure;
+ return saturate( color / ( vec3( 1.0 ) + color ) );
+}
+vec3 OptimizedCineonToneMapping( vec3 color ) {
+ color *= toneMappingExposure;
+ color = max( vec3( 0.0 ), color - 0.004 );
+ return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
+}
+vec3 RRTAndODTFit( vec3 v ) {
+ vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
+ vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
+ return a / b;
+}
+vec3 ACESFilmicToneMapping( vec3 color ) {
+ const mat3 ACESInputMat = mat3(
+ vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),
+ vec3( 0.04823, 0.01566, 0.83777 )
+ );
+ const mat3 ACESOutputMat = mat3(
+ vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),
+ vec3( -0.07367, -0.00605, 1.07602 )
+ );
+ color *= toneMappingExposure / 0.6;
+ color = ACESInputMat * color;
+ color = RRTAndODTFit( color );
+ color = ACESOutputMat * color;
+ return saturate( color );
+}
+const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
+ vec3( 1.6605, - 0.1246, - 0.0182 ),
+ vec3( - 0.5876, 1.1329, - 0.1006 ),
+ vec3( - 0.0728, - 0.0083, 1.1187 )
+);
+const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
+ vec3( 0.6274, 0.0691, 0.0164 ),
+ vec3( 0.3293, 0.9195, 0.0880 ),
+ vec3( 0.0433, 0.0113, 0.8956 )
+);
+vec3 agxDefaultContrastApprox( vec3 x ) {
+ vec3 x2 = x * x;
+ vec3 x4 = x2 * x2;
+ return + 15.5 * x4 * x2
+ - 40.14 * x4 * x
+ + 31.96 * x4
+ - 6.868 * x2 * x
+ + 0.4298 * x2
+ + 0.1191 * x
+ - 0.00232;
+}
+vec3 AgXToneMapping( vec3 color ) {
+ const mat3 AgXInsetMatrix = mat3(
+ vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
+ vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
+ vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
+ );
+ const mat3 AgXOutsetMatrix = mat3(
+ vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
+ vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
+ vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
+ );
+ const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;
+ color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
+ color *= toneMappingExposure;
+ color = AgXInsetMatrix * color;
+ color = max( color, 1e-10 ); color = log2( color );
+ color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
+ color = clamp( color, 0.0, 1.0 );
+ color = agxDefaultContrastApprox( color );
+ color = AgXOutsetMatrix * color;
+ color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
+ color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
+ return color;
+}
+vec3 CustomToneMapping( vec3 color ) { return color; }`,Mpe=`#ifdef USE_TRANSMISSION
+ material.transmission = transmission;
+ material.transmissionAlpha = 1.0;
+ material.thickness = thickness;
+ material.attenuationDistance = attenuationDistance;
+ material.attenuationColor = attenuationColor;
+ #ifdef USE_TRANSMISSIONMAP
+ material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
+ #endif
+ #ifdef USE_THICKNESSMAP
+ material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
+ #endif
+ vec3 pos = vWorldPosition;
+ vec3 v = normalize( cameraPosition - pos );
+ vec3 n = inverseTransformDirection( normal, viewMatrix );
+ vec4 transmitted = getIBLVolumeRefraction(
+ n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
+ pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,
+ material.attenuationColor, material.attenuationDistance );
+ material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
+ totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
+#endif`,xpe=`#ifdef USE_TRANSMISSION
+ uniform float transmission;
+ uniform float thickness;
+ uniform float attenuationDistance;
+ uniform vec3 attenuationColor;
+ #ifdef USE_TRANSMISSIONMAP
+ uniform sampler2D transmissionMap;
+ #endif
+ #ifdef USE_THICKNESSMAP
+ uniform sampler2D thicknessMap;
+ #endif
+ uniform vec2 transmissionSamplerSize;
+ uniform sampler2D transmissionSamplerMap;
+ uniform mat4 modelMatrix;
+ uniform mat4 projectionMatrix;
+ varying vec3 vWorldPosition;
+ float w0( float a ) {
+ return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
+ }
+ float w1( float a ) {
+ return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );
+ }
+ float w2( float a ){
+ return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
+ }
+ float w3( float a ) {
+ return ( 1.0 / 6.0 ) * ( a * a * a );
+ }
+ float g0( float a ) {
+ return w0( a ) + w1( a );
+ }
+ float g1( float a ) {
+ return w2( a ) + w3( a );
+ }
+ float h0( float a ) {
+ return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
+ }
+ float h1( float a ) {
+ return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
+ }
+ vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
+ uv = uv * texelSize.zw + 0.5;
+ vec2 iuv = floor( uv );
+ vec2 fuv = fract( uv );
+ float g0x = g0( fuv.x );
+ float g1x = g1( fuv.x );
+ float h0x = h0( fuv.x );
+ float h1x = h1( fuv.x );
+ float h0y = h0( fuv.y );
+ float h1y = h1( fuv.y );
+ vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
+ vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
+ vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
+ vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
+ return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
+ g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
+ }
+ vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
+ vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
+ vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
+ vec2 fLodSizeInv = 1.0 / fLodSize;
+ vec2 cLodSizeInv = 1.0 / cLodSize;
+ vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
+ vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
+ return mix( fSample, cSample, fract( lod ) );
+ }
+ vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
+ vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
+ vec3 modelScale;
+ modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
+ modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
+ modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
+ return normalize( refractionVector ) * thickness * modelScale;
+ }
+ float applyIorToRoughness( const in float roughness, const in float ior ) {
+ return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
+ }
+ vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
+ float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
+ return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
+ }
+ vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
+ if ( isinf( attenuationDistance ) ) {
+ return vec3( 1.0 );
+ } else {
+ vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
+ vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;
+ }
+ }
+ vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
+ const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
+ const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,
+ const in vec3 attenuationColor, const in float attenuationDistance ) {
+ vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
+ vec3 refractedRayExit = position + transmissionRay;
+ vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
+ vec2 refractionCoords = ndcPos.xy / ndcPos.w;
+ refractionCoords += 1.0;
+ refractionCoords /= 2.0;
+ vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
+ vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
+ vec3 attenuatedColor = transmittance * transmittedLight.rgb;
+ vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
+ float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
+ return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
+ }
+#endif`,Fpe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
+ varying vec2 vUv;
+#endif
+#ifdef USE_MAP
+ varying vec2 vMapUv;
+#endif
+#ifdef USE_ALPHAMAP
+ varying vec2 vAlphaMapUv;
+#endif
+#ifdef USE_LIGHTMAP
+ varying vec2 vLightMapUv;
+#endif
+#ifdef USE_AOMAP
+ varying vec2 vAoMapUv;
+#endif
+#ifdef USE_BUMPMAP
+ varying vec2 vBumpMapUv;
+#endif
+#ifdef USE_NORMALMAP
+ varying vec2 vNormalMapUv;
+#endif
+#ifdef USE_EMISSIVEMAP
+ varying vec2 vEmissiveMapUv;
+#endif
+#ifdef USE_METALNESSMAP
+ varying vec2 vMetalnessMapUv;
+#endif
+#ifdef USE_ROUGHNESSMAP
+ varying vec2 vRoughnessMapUv;
+#endif
+#ifdef USE_ANISOTROPYMAP
+ varying vec2 vAnisotropyMapUv;
+#endif
+#ifdef USE_CLEARCOATMAP
+ varying vec2 vClearcoatMapUv;
+#endif
+#ifdef USE_CLEARCOAT_NORMALMAP
+ varying vec2 vClearcoatNormalMapUv;
+#endif
+#ifdef USE_CLEARCOAT_ROUGHNESSMAP
+ varying vec2 vClearcoatRoughnessMapUv;
+#endif
+#ifdef USE_IRIDESCENCEMAP
+ varying vec2 vIridescenceMapUv;
+#endif
+#ifdef USE_IRIDESCENCE_THICKNESSMAP
+ varying vec2 vIridescenceThicknessMapUv;
+#endif
+#ifdef USE_SHEEN_COLORMAP
+ varying vec2 vSheenColorMapUv;
+#endif
+#ifdef USE_SHEEN_ROUGHNESSMAP
+ varying vec2 vSheenRoughnessMapUv;
+#endif
+#ifdef USE_SPECULARMAP
+ varying vec2 vSpecularMapUv;
+#endif
+#ifdef USE_SPECULAR_COLORMAP
+ varying vec2 vSpecularColorMapUv;
+#endif
+#ifdef USE_SPECULAR_INTENSITYMAP
+ varying vec2 vSpecularIntensityMapUv;
+#endif
+#ifdef USE_TRANSMISSIONMAP
+ uniform mat3 transmissionMapTransform;
+ varying vec2 vTransmissionMapUv;
+#endif
+#ifdef USE_THICKNESSMAP
+ uniform mat3 thicknessMapTransform;
+ varying vec2 vThicknessMapUv;
+#endif`,Upe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
+ varying vec2 vUv;
+#endif
+#ifdef USE_MAP
+ uniform mat3 mapTransform;
+ varying vec2 vMapUv;
+#endif
+#ifdef USE_ALPHAMAP
+ uniform mat3 alphaMapTransform;
+ varying vec2 vAlphaMapUv;
+#endif
+#ifdef USE_LIGHTMAP
+ uniform mat3 lightMapTransform;
+ varying vec2 vLightMapUv;
+#endif
+#ifdef USE_AOMAP
+ uniform mat3 aoMapTransform;
+ varying vec2 vAoMapUv;
+#endif
+#ifdef USE_BUMPMAP
+ uniform mat3 bumpMapTransform;
+ varying vec2 vBumpMapUv;
+#endif
+#ifdef USE_NORMALMAP
+ uniform mat3 normalMapTransform;
+ varying vec2 vNormalMapUv;
+#endif
+#ifdef USE_DISPLACEMENTMAP
+ uniform mat3 displacementMapTransform;
+ varying vec2 vDisplacementMapUv;
+#endif
+#ifdef USE_EMISSIVEMAP
+ uniform mat3 emissiveMapTransform;
+ varying vec2 vEmissiveMapUv;
+#endif
+#ifdef USE_METALNESSMAP
+ uniform mat3 metalnessMapTransform;
+ varying vec2 vMetalnessMapUv;
+#endif
+#ifdef USE_ROUGHNESSMAP
+ uniform mat3 roughnessMapTransform;
+ varying vec2 vRoughnessMapUv;
+#endif
+#ifdef USE_ANISOTROPYMAP
+ uniform mat3 anisotropyMapTransform;
+ varying vec2 vAnisotropyMapUv;
+#endif
+#ifdef USE_CLEARCOATMAP
+ uniform mat3 clearcoatMapTransform;
+ varying vec2 vClearcoatMapUv;
+#endif
+#ifdef USE_CLEARCOAT_NORMALMAP
+ uniform mat3 clearcoatNormalMapTransform;
+ varying vec2 vClearcoatNormalMapUv;
+#endif
+#ifdef USE_CLEARCOAT_ROUGHNESSMAP
+ uniform mat3 clearcoatRoughnessMapTransform;
+ varying vec2 vClearcoatRoughnessMapUv;
+#endif
+#ifdef USE_SHEEN_COLORMAP
+ uniform mat3 sheenColorMapTransform;
+ varying vec2 vSheenColorMapUv;
+#endif
+#ifdef USE_SHEEN_ROUGHNESSMAP
+ uniform mat3 sheenRoughnessMapTransform;
+ varying vec2 vSheenRoughnessMapUv;
+#endif
+#ifdef USE_IRIDESCENCEMAP
+ uniform mat3 iridescenceMapTransform;
+ varying vec2 vIridescenceMapUv;
+#endif
+#ifdef USE_IRIDESCENCE_THICKNESSMAP
+ uniform mat3 iridescenceThicknessMapTransform;
+ varying vec2 vIridescenceThicknessMapUv;
+#endif
+#ifdef USE_SPECULARMAP
+ uniform mat3 specularMapTransform;
+ varying vec2 vSpecularMapUv;
+#endif
+#ifdef USE_SPECULAR_COLORMAP
+ uniform mat3 specularColorMapTransform;
+ varying vec2 vSpecularColorMapUv;
+#endif
+#ifdef USE_SPECULAR_INTENSITYMAP
+ uniform mat3 specularIntensityMapTransform;
+ varying vec2 vSpecularIntensityMapUv;
+#endif
+#ifdef USE_TRANSMISSIONMAP
+ uniform mat3 transmissionMapTransform;
+ varying vec2 vTransmissionMapUv;
+#endif
+#ifdef USE_THICKNESSMAP
+ uniform mat3 thicknessMapTransform;
+ varying vec2 vThicknessMapUv;
+#endif`,Bpe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
+ vUv = vec3( uv, 1 ).xy;
+#endif
+#ifdef USE_MAP
+ vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_ALPHAMAP
+ vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_LIGHTMAP
+ vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_AOMAP
+ vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_BUMPMAP
+ vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_NORMALMAP
+ vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_DISPLACEMENTMAP
+ vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_EMISSIVEMAP
+ vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_METALNESSMAP
+ vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_ROUGHNESSMAP
+ vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_ANISOTROPYMAP
+ vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_CLEARCOATMAP
+ vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_CLEARCOAT_NORMALMAP
+ vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_CLEARCOAT_ROUGHNESSMAP
+ vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_IRIDESCENCEMAP
+ vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_IRIDESCENCE_THICKNESSMAP
+ vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_SHEEN_COLORMAP
+ vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_SHEEN_ROUGHNESSMAP
+ vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_SPECULARMAP
+ vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_SPECULAR_COLORMAP
+ vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_SPECULAR_INTENSITYMAP
+ vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_TRANSMISSIONMAP
+ vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
+#endif
+#ifdef USE_THICKNESSMAP
+ vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
+#endif`,Hpe=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
+ vec4 worldPosition = vec4( transformed, 1.0 );
+ #ifdef USE_BATCHING
+ worldPosition = batchingMatrix * worldPosition;
+ #endif
+ #ifdef USE_INSTANCING
+ worldPosition = instanceMatrix * worldPosition;
+ #endif
+ worldPosition = modelMatrix * worldPosition;
+#endif`;const _pe=`varying vec2 vUv;
+uniform mat3 uvTransform;
+void main() {
+ vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
+ gl_Position = vec4( position.xy, 1.0, 1.0 );
+}`,Gpe=`uniform sampler2D t2D;
+uniform float backgroundIntensity;
+varying vec2 vUv;
+void main() {
+ vec4 texColor = texture2D( t2D, vUv );
+ #ifdef DECODE_VIDEO_TEXTURE
+ texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
+ #endif
+ texColor.rgb *= backgroundIntensity;
+ gl_FragColor = texColor;
+ #include
+ #include
+}`,Vpe=`varying vec3 vWorldDirection;
+#include
+void main() {
+ vWorldDirection = transformDirection( position, modelMatrix );
+ #include
+ #include
+ gl_Position.z = gl_Position.w;
+}`,zpe=`#ifdef ENVMAP_TYPE_CUBE
+ uniform samplerCube envMap;
+#elif defined( ENVMAP_TYPE_CUBE_UV )
+ uniform sampler2D envMap;
+#endif
+uniform float flipEnvMap;
+uniform float backgroundBlurriness;
+uniform float backgroundIntensity;
+varying vec3 vWorldDirection;
+#include
+void main() {
+ #ifdef ENVMAP_TYPE_CUBE
+ vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
+ #elif defined( ENVMAP_TYPE_CUBE_UV )
+ vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );
+ #else
+ vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
+ #endif
+ texColor.rgb *= backgroundIntensity;
+ gl_FragColor = texColor;
+ #include
+ #include
+}`,kpe=`varying vec3 vWorldDirection;
+#include
+void main() {
+ vWorldDirection = transformDirection( position, modelMatrix );
+ #include
+ #include
+ gl_Position.z = gl_Position.w;
+}`,Ype=`uniform samplerCube tCube;
+uniform float tFlip;
+uniform float opacity;
+varying vec3 vWorldDirection;
+void main() {
+ vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
+ gl_FragColor = texColor;
+ gl_FragColor.a *= opacity;
+ #include
+ #include
+}`,Wpe=`#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+varying vec2 vHighPrecisionZW;
+void main() {
+ #include
+ #include
+ #include
+ #ifdef USE_DISPLACEMENTMAP
+ #include
+ #include
+ #include
+ #endif
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ vHighPrecisionZW = gl_Position.zw;
+}`,jpe=`#if DEPTH_PACKING == 3200
+ uniform float opacity;
+#endif
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+varying vec2 vHighPrecisionZW;
+void main() {
+ #include
+ vec4 diffuseColor = vec4( 1.0 );
+ #if DEPTH_PACKING == 3200
+ diffuseColor.a = opacity;
+ #endif
+ #include
+ #include
+ #include
+ #include
+ #include
+ float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
+ #if DEPTH_PACKING == 3200
+ gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
+ #elif DEPTH_PACKING == 3201
+ gl_FragColor = packDepthToRGBA( fragCoordZ );
+ #endif
+}`,qpe=`#define DISTANCE
+varying vec3 vWorldPosition;
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+void main() {
+ #include
+ #include
+ #include
+ #ifdef USE_DISPLACEMENTMAP
+ #include
+ #include
+ #include
+ #endif
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ vWorldPosition = worldPosition.xyz;
+}`,Zpe=`#define DISTANCE
+uniform vec3 referencePosition;
+uniform float nearDistance;
+uniform float farDistance;
+varying vec3 vWorldPosition;
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+void main () {
+ #include
+ vec4 diffuseColor = vec4( 1.0 );
+ #include
+ #include
+ #include
+ #include
+ float dist = length( vWorldPosition - referencePosition );
+ dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
+ dist = saturate( dist );
+ gl_FragColor = packDepthToRGBA( dist );
+}`,Kpe=`varying vec3 vWorldDirection;
+#include
+void main() {
+ vWorldDirection = transformDirection( position, modelMatrix );
+ #include
+ #include
+}`,Qpe=`uniform sampler2D tEquirect;
+varying vec3 vWorldDirection;
+#include
+void main() {
+ vec3 direction = normalize( vWorldDirection );
+ vec2 sampleUV = equirectUv( direction );
+ gl_FragColor = texture2D( tEquirect, sampleUV );
+ #include
+ #include
+}`,$pe=`uniform float scale;
+attribute float lineDistance;
+varying float vLineDistance;
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+void main() {
+ vLineDistance = scale * lineDistance;
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+}`,Jpe=`uniform vec3 diffuse;
+uniform float opacity;
+uniform float dashSize;
+uniform float totalSize;
+varying float vLineDistance;
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+void main() {
+ #include
+ if ( mod( vLineDistance, totalSize ) > dashSize ) {
+ discard;
+ }
+ vec3 outgoingLight = vec3( 0.0 );
+ vec4 diffuseColor = vec4( diffuse, opacity );
+ #include
+ #include
+ #include
+ outgoingLight = diffuseColor.rgb;
+ #include
+ #include
+ #include
+ #include
+ #include
+}`,Xpe=`#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+void main() {
+ #include
+ #include
+ #include
+ #include
+ #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
+ #include
+ #include
+ #include
+ #include
+ #include
+ #endif
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+}`,vpe=`uniform vec3 diffuse;
+uniform float opacity;
+#ifndef FLAT_SHADED
+ varying vec3 vNormal;
+#endif
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+void main() {
+ #include
+ vec4 diffuseColor = vec4( diffuse, opacity );
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
+ #ifdef USE_LIGHTMAP
+ vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
+ reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
+ #else
+ reflectedLight.indirectDiffuse += vec3( 1.0 );
+ #endif
+ #include
+ reflectedLight.indirectDiffuse *= diffuseColor.rgb;
+ vec3 outgoingLight = reflectedLight.indirectDiffuse;
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+}`,e0e=`#define LAMBERT
+varying vec3 vViewPosition;
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+void main() {
+ #include
+ #include
+ #include
+ #include
+ #include