hanc-webrtc-widgets 2.9.2 → 2.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,7 +12,7 @@
12
12
  * SPDX-License-Identifier: BSD-3-Clause
13
13
  */const PI=globalThis,zC=PI.trustedTypes,Rr=zC?zC.createPolicy("lit-html",{createHTML:i=>i}):void 0,Gr="$lit$",zi=`lit$${Math.random().toFixed(9).slice(2)}$`,Mr="?"+zi,Lh=`<${Mr}>`,_g=document,OI=()=>_g.createComment(""),VI=i=>i===null||typeof i!="object"&&typeof i!="function",qn=Array.isArray,vh=i=>qn(i)||typeof(i==null?void 0:i[Symbol.iterator])=="function",Hn=`[
14
14
  \f\r]`,jI=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Fr=/-->/g,Ur=/>/g,pg=RegExp(`>|${Hn}(?:([^\\s"'>=/]+)(${Hn}*=${Hn}*(?:[^
15
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Lr=/'/g,vr=/"/g,Kr=/^(?:script|style|textarea|title)$/i,Kh=i=>(A,...e)=>({_$litType$:i,strings:A,values:e}),pA=Kh(1),AI=Symbol.for("lit-noChange"),Ce=Symbol.for("lit-nothing"),Jr=new WeakMap,wg=_g.createTreeWalker(_g,129);function Yr(i,A){if(!qn(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Rr!==void 0?Rr.createHTML(A):A}const Jh=(i,A)=>{const e=i.length-1,t=[];let g,I=A===2?"<svg>":A===3?"<math>":"",C=jI;for(let o=0;o<e;o++){const n=i[o];let a,s,Q=-1,r=0;for(;r<n.length&&(C.lastIndex=r,s=C.exec(n),s!==null);)r=C.lastIndex,C===jI?s[1]==="!--"?C=Fr:s[1]!==void 0?C=Ur:s[2]!==void 0?(Kr.test(s[2])&&(g=RegExp("</"+s[2],"g")),C=pg):s[3]!==void 0&&(C=pg):C===pg?s[0]===">"?(C=g??jI,Q=-1):s[1]===void 0?Q=-2:(Q=C.lastIndex-s[2].length,a=s[1],C=s[3]===void 0?pg:s[3]==='"'?vr:Lr):C===vr||C===Lr?C=pg:C===Fr||C===Ur?C=jI:(C=pg,g=void 0);const B=C===pg&&i[o+1].startsWith("/>")?" ":"";I+=C===jI?n+Lh:Q>=0?(t.push(a),n.slice(0,Q)+Gr+n.slice(Q)+zi+B):n+zi+(Q===-2?o:B)}return[Yr(i,I+(i[e]||"<?>")+(A===2?"</svg>":A===3?"</math>":"")),t]};class WI{constructor({strings:A,_$litType$:e},t){let g;this.parts=[];let I=0,C=0;const o=A.length-1,n=this.parts,[a,s]=Jh(A,e);if(this.el=WI.createElement(a,t),wg.currentNode=this.el.content,e===2||e===3){const Q=this.el.content.firstChild;Q.replaceWith(...Q.childNodes)}for(;(g=wg.nextNode())!==null&&n.length<o;){if(g.nodeType===1){if(g.hasAttributes())for(const Q of g.getAttributeNames())if(Q.endsWith(Gr)){const r=s[C++],B=g.getAttribute(Q).split(zi),h=/([.?@])?(.*)/.exec(r);n.push({type:1,index:I,name:h[2],strings:B,ctor:h[1]==="."?Th:h[1]==="?"?qh:h[1]==="@"?Hh:$C}),g.removeAttribute(Q)}else Q.startsWith(zi)&&(n.push({type:6,index:I}),g.removeAttribute(Q));if(Kr.test(g.tagName)){const Q=g.textContent.split(zi),r=Q.length-1;if(r>0){g.textContent=zC?zC.emptyScript:"";for(let B=0;B<r;B++)g.append(Q[B],OI()),wg.nextNode(),n.push({type:2,index:++I});g.append(Q[r],OI())}}}else if(g.nodeType===8)if(g.data===Mr)n.push({type:2,index:I});else{let Q=-1;for(;(Q=g.data.indexOf(zi,Q+1))!==-1;)n.push({type:7,index:I}),Q+=zi.length-1}I++}}static createElement(A,e){const t=_g.createElement("template");return t.innerHTML=A,t}}function eI(i,A,e=i,t){var C,o;if(A===AI)return A;let g=t!==void 0?(C=e._$Co)==null?void 0:C[t]:e._$Cl;const I=VI(A)?void 0:A._$litDirective$;return(g==null?void 0:g.constructor)!==I&&((o=g==null?void 0:g._$AO)==null||o.call(g,!1),I===void 0?g=void 0:(g=new I(i),g._$AT(i,e,t)),t!==void 0?(e._$Co??(e._$Co=[]))[t]=g:e._$Cl=g),g!==void 0&&(A=eI(i,g._$AS(i,A.values),g,t)),A}let Yh=class{constructor(A,e){this._$AV=[],this._$AN=void 0,this._$AD=A,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(A){const{el:{content:e},parts:t}=this._$AD,g=((A==null?void 0:A.creationScope)??_g).importNode(e,!0);wg.currentNode=g;let I=wg.nextNode(),C=0,o=0,n=t[0];for(;n!==void 0;){if(C===n.index){let a;n.type===2?a=new XI(I,I.nextSibling,this,A):n.type===1?a=new n.ctor(I,n.name,n.strings,this,A):n.type===6&&(a=new Ph(I,this,A)),this._$AV.push(a),n=t[++o]}C!==(n==null?void 0:n.index)&&(I=wg.nextNode(),C++)}return wg.currentNode=_g,g}p(A){let e=0;for(const t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(A,t,e),e+=t.strings.length-2):t._$AI(A[e])),e++}};class XI{get _$AU(){var A;return((A=this._$AM)==null?void 0:A._$AU)??this._$Cv}constructor(A,e,t,g){this.type=2,this._$AH=Ce,this._$AN=void 0,this._$AA=A,this._$AB=e,this._$AM=t,this.options=g,this._$Cv=(g==null?void 0:g.isConnected)??!0}get parentNode(){let A=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&(A==null?void 0:A.nodeType)===11&&(A=e.parentNode),A}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(A,e=this){A=eI(this,A,e),VI(A)?A===Ce||A==null||A===""?(this._$AH!==Ce&&this._$AR(),this._$AH=Ce):A!==this._$AH&&A!==AI&&this._(A):A._$litType$!==void 0?this.$(A):A.nodeType!==void 0?this.T(A):vh(A)?this.k(A):this._(A)}O(A){return this._$AA.parentNode.insertBefore(A,this._$AB)}T(A){this._$AH!==A&&(this._$AR(),this._$AH=this.O(A))}_(A){this._$AH!==Ce&&VI(this._$AH)?this._$AA.nextSibling.data=A:this.T(_g.createTextNode(A)),this._$AH=A}$(A){var I;const{values:e,_$litType$:t}=A,g=typeof t=="number"?this._$AC(A):(t.el===void 0&&(t.el=WI.createElement(Yr(t.h,t.h[0]),this.options)),t);if(((I=this._$AH)==null?void 0:I._$AD)===g)this._$AH.p(e);else{const C=new Yh(g,this),o=C.u(this.options);C.p(e),this.T(o),this._$AH=C}}_$AC(A){let e=Jr.get(A.strings);return e===void 0&&Jr.set(A.strings,e=new WI(A)),e}k(A){qn(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let t,g=0;for(const I of A)g===e.length?e.push(t=new XI(this.O(OI()),this.O(OI()),this,this.options)):t=e[g],t._$AI(I),g++;g<e.length&&(this._$AR(t&&t._$AB.nextSibling,g),e.length=g)}_$AR(A=this._$AA.nextSibling,e){var t;for((t=this._$AP)==null?void 0:t.call(this,!1,!0,e);A&&A!==this._$AB;){const g=A.nextSibling;A.remove(),A=g}}setConnected(A){var e;this._$AM===void 0&&(this._$Cv=A,(e=this._$AP)==null||e.call(this,A))}}let $C=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(A,e,t,g,I){this.type=1,this._$AH=Ce,this._$AN=void 0,this.element=A,this.name=e,this._$AM=g,this.options=I,t.length>2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=Ce}_$AI(A,e=this,t,g){const I=this.strings;let C=!1;if(I===void 0)A=eI(this,A,e,0),C=!VI(A)||A!==this._$AH&&A!==AI,C&&(this._$AH=A);else{const o=A;let n,a;for(A=I[0],n=0;n<I.length-1;n++)a=eI(this,o[t+n],e,n),a===AI&&(a=this._$AH[n]),C||(C=!VI(a)||a!==this._$AH[n]),a===Ce?A=Ce:A!==Ce&&(A+=(a??"")+I[n+1]),this._$AH[n]=a}C&&!g&&this.j(A)}j(A){A===Ce?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,A??"")}},Th=class extends $C{constructor(){super(...arguments),this.type=3}j(A){this.element[this.name]=A===Ce?void 0:A}};class qh extends $C{constructor(){super(...arguments),this.type=4}j(A){this.element.toggleAttribute(this.name,!!A&&A!==Ce)}}class Hh extends $C{constructor(A,e,t,g,I){super(A,e,t,g,I),this.type=5}_$AI(A,e=this){if((A=eI(this,A,e,0)??Ce)===AI)return;const t=this._$AH,g=A===Ce&&t!==Ce||A.capture!==t.capture||A.once!==t.once||A.passive!==t.passive,I=A!==Ce&&(t===Ce||g);g&&this.element.removeEventListener(this.name,this,t),I&&this.element.addEventListener(this.name,this,A),this._$AH=A}handleEvent(A){var e;typeof this._$AH=="function"?this._$AH.call(((e=this.options)==null?void 0:e.host)??this.element,A):this._$AH.handleEvent(A)}}class Ph{constructor(A,e,t){this.element=A,this.type=6,this._$AN=void 0,this._$AM=e,this.options=t}get _$AU(){return this._$AM._$AU}_$AI(A){eI(this,A)}}const Pn=PI.litHtmlPolyfillSupport;Pn==null||Pn(WI,XI),(PI.litHtmlVersions??(PI.litHtmlVersions=[])).push("3.2.1");const Oh=(i,A,e)=>{const t=(e==null?void 0:e.renderBefore)??A;let g=t._$litPart$;if(g===void 0){const I=(e==null?void 0:e.renderBefore)??null;t._$litPart$=g=new XI(A.insertBefore(OI(),I),I,void 0,e??{})}return g._$AI(i),g};/**
15
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Lr=/'/g,vr=/"/g,Kr=/^(?:script|style|textarea|title)$/i,Kh=i=>(A,...e)=>({_$litType$:i,strings:A,values:e}),_A=Kh(1),AI=Symbol.for("lit-noChange"),Ce=Symbol.for("lit-nothing"),Jr=new WeakMap,wg=_g.createTreeWalker(_g,129);function Yr(i,A){if(!qn(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Rr!==void 0?Rr.createHTML(A):A}const Jh=(i,A)=>{const e=i.length-1,t=[];let g,I=A===2?"<svg>":A===3?"<math>":"",C=jI;for(let o=0;o<e;o++){const n=i[o];let a,s,Q=-1,r=0;for(;r<n.length&&(C.lastIndex=r,s=C.exec(n),s!==null);)r=C.lastIndex,C===jI?s[1]==="!--"?C=Fr:s[1]!==void 0?C=Ur:s[2]!==void 0?(Kr.test(s[2])&&(g=RegExp("</"+s[2],"g")),C=pg):s[3]!==void 0&&(C=pg):C===pg?s[0]===">"?(C=g??jI,Q=-1):s[1]===void 0?Q=-2:(Q=C.lastIndex-s[2].length,a=s[1],C=s[3]===void 0?pg:s[3]==='"'?vr:Lr):C===vr||C===Lr?C=pg:C===Fr||C===Ur?C=jI:(C=pg,g=void 0);const B=C===pg&&i[o+1].startsWith("/>")?" ":"";I+=C===jI?n+Lh:Q>=0?(t.push(a),n.slice(0,Q)+Gr+n.slice(Q)+zi+B):n+zi+(Q===-2?o:B)}return[Yr(i,I+(i[e]||"<?>")+(A===2?"</svg>":A===3?"</math>":"")),t]};class WI{constructor({strings:A,_$litType$:e},t){let g;this.parts=[];let I=0,C=0;const o=A.length-1,n=this.parts,[a,s]=Jh(A,e);if(this.el=WI.createElement(a,t),wg.currentNode=this.el.content,e===2||e===3){const Q=this.el.content.firstChild;Q.replaceWith(...Q.childNodes)}for(;(g=wg.nextNode())!==null&&n.length<o;){if(g.nodeType===1){if(g.hasAttributes())for(const Q of g.getAttributeNames())if(Q.endsWith(Gr)){const r=s[C++],B=g.getAttribute(Q).split(zi),h=/([.?@])?(.*)/.exec(r);n.push({type:1,index:I,name:h[2],strings:B,ctor:h[1]==="."?Th:h[1]==="?"?qh:h[1]==="@"?Hh:$C}),g.removeAttribute(Q)}else Q.startsWith(zi)&&(n.push({type:6,index:I}),g.removeAttribute(Q));if(Kr.test(g.tagName)){const Q=g.textContent.split(zi),r=Q.length-1;if(r>0){g.textContent=zC?zC.emptyScript:"";for(let B=0;B<r;B++)g.append(Q[B],OI()),wg.nextNode(),n.push({type:2,index:++I});g.append(Q[r],OI())}}}else if(g.nodeType===8)if(g.data===Mr)n.push({type:2,index:I});else{let Q=-1;for(;(Q=g.data.indexOf(zi,Q+1))!==-1;)n.push({type:7,index:I}),Q+=zi.length-1}I++}}static createElement(A,e){const t=_g.createElement("template");return t.innerHTML=A,t}}function eI(i,A,e=i,t){var C,o;if(A===AI)return A;let g=t!==void 0?(C=e._$Co)==null?void 0:C[t]:e._$Cl;const I=VI(A)?void 0:A._$litDirective$;return(g==null?void 0:g.constructor)!==I&&((o=g==null?void 0:g._$AO)==null||o.call(g,!1),I===void 0?g=void 0:(g=new I(i),g._$AT(i,e,t)),t!==void 0?(e._$Co??(e._$Co=[]))[t]=g:e._$Cl=g),g!==void 0&&(A=eI(i,g._$AS(i,A.values),g,t)),A}let Yh=class{constructor(A,e){this._$AV=[],this._$AN=void 0,this._$AD=A,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(A){const{el:{content:e},parts:t}=this._$AD,g=((A==null?void 0:A.creationScope)??_g).importNode(e,!0);wg.currentNode=g;let I=wg.nextNode(),C=0,o=0,n=t[0];for(;n!==void 0;){if(C===n.index){let a;n.type===2?a=new XI(I,I.nextSibling,this,A):n.type===1?a=new n.ctor(I,n.name,n.strings,this,A):n.type===6&&(a=new Ph(I,this,A)),this._$AV.push(a),n=t[++o]}C!==(n==null?void 0:n.index)&&(I=wg.nextNode(),C++)}return wg.currentNode=_g,g}p(A){let e=0;for(const t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(A,t,e),e+=t.strings.length-2):t._$AI(A[e])),e++}};class XI{get _$AU(){var A;return((A=this._$AM)==null?void 0:A._$AU)??this._$Cv}constructor(A,e,t,g){this.type=2,this._$AH=Ce,this._$AN=void 0,this._$AA=A,this._$AB=e,this._$AM=t,this.options=g,this._$Cv=(g==null?void 0:g.isConnected)??!0}get parentNode(){let A=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&(A==null?void 0:A.nodeType)===11&&(A=e.parentNode),A}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(A,e=this){A=eI(this,A,e),VI(A)?A===Ce||A==null||A===""?(this._$AH!==Ce&&this._$AR(),this._$AH=Ce):A!==this._$AH&&A!==AI&&this._(A):A._$litType$!==void 0?this.$(A):A.nodeType!==void 0?this.T(A):vh(A)?this.k(A):this._(A)}O(A){return this._$AA.parentNode.insertBefore(A,this._$AB)}T(A){this._$AH!==A&&(this._$AR(),this._$AH=this.O(A))}_(A){this._$AH!==Ce&&VI(this._$AH)?this._$AA.nextSibling.data=A:this.T(_g.createTextNode(A)),this._$AH=A}$(A){var I;const{values:e,_$litType$:t}=A,g=typeof t=="number"?this._$AC(A):(t.el===void 0&&(t.el=WI.createElement(Yr(t.h,t.h[0]),this.options)),t);if(((I=this._$AH)==null?void 0:I._$AD)===g)this._$AH.p(e);else{const C=new Yh(g,this),o=C.u(this.options);C.p(e),this.T(o),this._$AH=C}}_$AC(A){let e=Jr.get(A.strings);return e===void 0&&Jr.set(A.strings,e=new WI(A)),e}k(A){qn(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let t,g=0;for(const I of A)g===e.length?e.push(t=new XI(this.O(OI()),this.O(OI()),this,this.options)):t=e[g],t._$AI(I),g++;g<e.length&&(this._$AR(t&&t._$AB.nextSibling,g),e.length=g)}_$AR(A=this._$AA.nextSibling,e){var t;for((t=this._$AP)==null?void 0:t.call(this,!1,!0,e);A&&A!==this._$AB;){const g=A.nextSibling;A.remove(),A=g}}setConnected(A){var e;this._$AM===void 0&&(this._$Cv=A,(e=this._$AP)==null||e.call(this,A))}}let $C=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(A,e,t,g,I){this.type=1,this._$AH=Ce,this._$AN=void 0,this.element=A,this.name=e,this._$AM=g,this.options=I,t.length>2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=Ce}_$AI(A,e=this,t,g){const I=this.strings;let C=!1;if(I===void 0)A=eI(this,A,e,0),C=!VI(A)||A!==this._$AH&&A!==AI,C&&(this._$AH=A);else{const o=A;let n,a;for(A=I[0],n=0;n<I.length-1;n++)a=eI(this,o[t+n],e,n),a===AI&&(a=this._$AH[n]),C||(C=!VI(a)||a!==this._$AH[n]),a===Ce?A=Ce:A!==Ce&&(A+=(a??"")+I[n+1]),this._$AH[n]=a}C&&!g&&this.j(A)}j(A){A===Ce?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,A??"")}},Th=class extends $C{constructor(){super(...arguments),this.type=3}j(A){this.element[this.name]=A===Ce?void 0:A}};class qh extends $C{constructor(){super(...arguments),this.type=4}j(A){this.element.toggleAttribute(this.name,!!A&&A!==Ce)}}class Hh extends $C{constructor(A,e,t,g,I){super(A,e,t,g,I),this.type=5}_$AI(A,e=this){if((A=eI(this,A,e,0)??Ce)===AI)return;const t=this._$AH,g=A===Ce&&t!==Ce||A.capture!==t.capture||A.once!==t.once||A.passive!==t.passive,I=A!==Ce&&(t===Ce||g);g&&this.element.removeEventListener(this.name,this,t),I&&this.element.addEventListener(this.name,this,A),this._$AH=A}handleEvent(A){var e;typeof this._$AH=="function"?this._$AH.call(((e=this.options)==null?void 0:e.host)??this.element,A):this._$AH.handleEvent(A)}}class Ph{constructor(A,e,t){this.element=A,this.type=6,this._$AN=void 0,this._$AM=e,this.options=t}get _$AU(){return this._$AM._$AU}_$AI(A){eI(this,A)}}const Pn=PI.litHtmlPolyfillSupport;Pn==null||Pn(WI,XI),(PI.litHtmlVersions??(PI.litHtmlVersions=[])).push("3.2.1");const Oh=(i,A,e)=>{const t=(e==null?void 0:e.renderBefore)??A;let g=t._$litPart$;if(g===void 0){const I=(e==null?void 0:e.renderBefore)??null;t._$litPart$=g=new XI(A.insertBefore(OI(),I),I,void 0,e??{})}return g._$AI(i),g};/**
16
16
  * @license
17
17
  * Copyright 2017 Google LLC
18
18
  * SPDX-License-Identifier: BSD-3-Clause
@@ -144,15 +144,15 @@ a=extmap-allow-mixed`)!==-1){const I=g.sdp.split(`
144
144
  </div>
145
145
  </div>
146
146
  `,this[o(512)]({mode:o(726)}),(C=this[o(453)])==null||C[o(364)](n[o(737)][o(885)](!0))}[t(778)](){var C,o;const n=t;let a=0,s=0,Q=0,r=0;this[n(861)][n(649)]=n(550),this[n(861)].top=n(582),this[n(861)].right=n(582),this[n(715)]=B=>{const h=n;Q=B[h(602)],r=B[h(530)],document[h(581)]=()=>{const c=h;document[c(581)]=null,document[c(880)]=null},document[h(880)]=c=>{const d=h;c.preventDefault(),a=Q-c[d(602)],s=r-c.clientY,Q=c[d(602)],r=c.clientY,this.style[d(609)]=this.offsetTop-s+"px",this.style[d(626)]=this.offsetLeft-a+"px"}},(o=(C=this[n(453)])==null?void 0:C[n(636)](n(566)))==null||o[n(643)](n(948),()=>g[n(571)][n(718)]())}}):g[t(571)][t(675)](t(840))},967:(i,A,e)=>{const t=Se;Object[t(815)](A,t(529),{value:!0}),A[t(571)]=void 0;const g=e(687),I=e(67);A.Logger=new class{constructor(){const C=t;this.logs="",this.threadName=C(714),this[C(374)]=[],this[C(661)]=!1;let o=C(714);C(441)!=typeof WorkerGlobalScope?o=C(791):typeof AudioWorkletProcessor<"u"&&(o=C(775)),this[C(347)]=o}setOptions(C=!1){this.debugLogs=C}[t(877)](C){const o=t;this[o(516)]=C}[t(557)](...C){const o=t;this.debugLogs&&(this[o(786)]("I",C[o(558)](" ")),console[o(557)](o(376),...C))}[t(675)](...C){const o=t;this[o(661)]&&this[o(786)]("W",C.join(" ")),console[o(557)](o(376),...C)}[t(565)](...C){const o=t;this[o(661)]&&this[o(786)]("E",C.join(" ")),console.error(o(376),...C)}[t(695)](...C){const o=t;this[o(661)]&&(this[o(786)]("I",C[o(558)](" ")),console[o(695)]("KrispSDK -",...C))}[t(346)](C){const o=t;this.logAudio(o(473),C)}logAudioOutputSamples(C){const o=t;this[o(592)](o(600),C)}[t(489)](C,o){const n=t,a={channel:new MessageChannel,recorder:void 0,startedAt:new Date,options:o};C instanceof MessagePort&&(a[n(385)]=new I.DebugRecorder(o.sampleRate)),C instanceof Window?this[n(516)]=a.channel[n(468)]:C[n(732)]({event:n(846),data:void 0},[a[n(902)][n(468)]]),a[n(902)].port1.addEventListener(n(755),s=>{var Q,r;const B=n;B(420)==typeof s[B(648)]?this.logs+=s[B(648)]:a[B(385)]&&((Q=s[B(648)])==null?void 0:Q.event)==="LOG_INPUT_AUDIO"?a[B(385)][B(340)](s[B(648)][B(648)]):a[B(385)]&&B(600)===((r=s[B(648)])==null?void 0:r[B(711)])&&a.recorder[B(579)](s[B(648)][B(648)])}),this[n(374)][n(784)](a),a[n(902)][n(819)][n(438)]()}async[t(718)](){const C=t;try{const o=[];for(let a in this[C(374)]){const s=this[C(374)][a];if(s[C(385)]){const{input:Q,output:r}=s[C(385)][C(663)]();o.push(C(665)+s[C(493)]+C(625)+a+'"><source src="'+await(0,g[C(360)])(Q)+C(449)+a+C(506)+await(0,g[C(360)])(r)+C(833))}}const n=C(472)+o+C(578)+this[C(417)]+C(350);return(0,g.downloadBlob)(C(713)+new Date()[C(538)]()+".html",new Blob([n],{type:C(741)})),!0}catch{return console[C(565)](C(660)),!1}}[t(592)](C,o){const n=t;if(this.debugLogs&&this[n(516)]){const a=new Float32Array(o.length);a[n(676)](o,0),this[n(516)].postMessage({event:C,data:a},[a[n(721)]])}}postLog(C,o){const n=t,a="["+new Date().toLocaleString()+"]["+this[n(347)]+"]["+C+n(886)+o+`
147
- `;if(!this.logPort)return console[n(565)]("KrispSDK -",n(635),a);this.logPort[n(732)](a)}}},851:(i,A)=>{const e=Se;Object.defineProperty(A,"__esModule",{value:!0}),A[e(567)]=void 0,A[e(567)]=class{constructor(t={}){const g=e;this[g(554)]=t,this.dataCache={}}static async preload(t){const g=e,I=typeof t=="string"?t:t.url;return fetch(I,{cache:g(603)})}addPath(t,g){const I=e;this[I(554)][t]=g}removePath(t){const g=e;this[g(554)][t]&&(this.unloadModel(t),delete this[g(554)][t])}[e(831)](t){const g=e;if(!this[g(554)][t])throw new Error("Krisp SDK - Please add model path before loading");return this[g(517)][t]?this[g(517)][t]:new Promise((I,C)=>{const o=g;this[o(368)](this[o(554)][t],n=>{const a=o;this[a(517)][t]=n,I(n)},C)})}async[e(875)](t,g){const I=e;try{const C=await this.loadModel(g),o=new Uint8Array(C),n=t[I(688)](o[I(422)]);return t[I(865)][I(742)](n,n+o[I(422)])[I(676)](o),{bufferAddress:n,bufferLength:o[I(422)]}}catch(C){throw new Error(I(430)+C)}}[e(628)](t,g){t[e(480)](g)}[e(426)](t){this[e(517)][t]&&delete this.dataCache[t]}[e(368)](t,g,I){const C=e;var o=new XMLHttpRequest;o[C(726)]("GET",t,!0),o[C(817)]=C(858),o[C(633)]=function(){I("Network error during model loading")},o[C(731)]=function(){const n=C;o[n(434)]==200||o[n(434)]==304||o[n(434)]==206||o[n(434)]==0&&o[n(679)]?g(o[n(679)]):I(o.statusText+" : "+o[n(502)])},o[C(357)](null)}[e(799)](){const t=e;this.dataCache={},this[t(554)]={}}}},785:(i,A,e)=>{const t=Se;Object[t(815)](A,"__esModule",{value:!0}),A.SharedRingBuffer=void 0;const g=e(967),I={READ_INDEX:0,WRITE_INDEX:1};class C{constructor(n,a=1){const s=t;this._channelData=[],this[s(457)]=a,this[s(751)]=new Uint32Array(new SharedArrayBuffer(Object[s(881)](I)[s(915)]*Uint32Array[s(486)])),this._bufferLength=n+1;for(let Q=0;Q<a;Q++)this[s(690)].push(new Float32Array(new SharedArrayBuffer(this[s(896)]*Float32Array[s(486)])))}static[t(548)](n){return Object[t(634)](n,C.prototype)}push(n,a){const s=t,Q=Atomics[s(829)](this[s(751)],I[s(641)]),r=Atomics[s(829)](this._state,I[s(373)]);if(this._getAvailableWrite(Q,r)<a)return!1;let B=r+a;if(this[s(896)]<B){B-=this[s(896)];for(let h=0;h<this[s(457)];h++){const c=this._channelData[h][s(742)](r),d=this[s(690)][h][s(742)](0,B);c[s(676)](n[h][s(742)](0,c[s(915)])),d[s(676)](n[h][s(742)](c[s(915)]))}}else{for(let h=0;h<this[s(457)];h++)this[s(690)][h].subarray(r,B)[s(676)](n[h].subarray(0,a));B===this[s(896)]&&(B=0)}return Atomics.store(this[s(751)],I.WRITE_INDEX,B),!0}pull(n,a){const s=t,Q=Atomics[s(829)](this._state,I[s(641)]),r=Atomics[s(829)](this[s(751)],I[s(373)]);if(this._getAvailableRead(Q,r)<a)return!1;let B=Q+a;if(this[s(896)]<B){B-=this._bufferLength;for(let h=0;h<this[s(457)];h++){const c=this[s(690)][h][s(742)](Q),d=this[s(690)][h][s(742)](0,B);n[h].set(c),n[h].set(d,c[s(915)])}}else{for(let h=0;h<this._channelCount;++h)n[h][s(676)](this[s(690)][h][s(742)](Q,B));B===this._bufferLength&&(B=0)}return Atomics[s(431)](this[s(751)],I[s(641)],B),!0}[t(708)](){const n=t,a=Atomics[n(829)](this[n(751)],I[n(641)]),s=Atomics.load(this[n(751)],I[n(373)]);g[n(571)][n(695)](this,{availableRead:this[n(678)](a,s),availableWrite:this[n(380)](a,s)})}[t(724)](){const n=t,a=Atomics.load(this._state,I.READ_INDEX),s=Atomics[n(829)](this[n(751)],I[n(373)]);return this[n(678)](a,s)}[t(389)](n){return this[t(724)]()>=n}getBufferLength(){return this[t(896)]-1}[t(380)](n,a){const s=t;return a>=n?this[s(896)]-a+n-1:n-a-1}[t(678)](n,a){return a>=n?a-n:a+this._bufferLength-n}}A[t(673)]=C},333:(i,A)=>{const e=Se;Object.defineProperty(A,e(529),{value:!0}),A.sampleModelMap=void 0,A[e(750)]={8e3:e(854),16e3:e(348),24e3:e(452),32e3:e(452),44100:e(452),48e3:e(452),88200:e(452),96e3:"model32"}},862:(i,A,e)=>{const t=Se;Object[t(815)](A,t(529),{value:!0}),A[t(572)]=A[t(891)]=void 0;const g=e(3),I=e(656);function C(o){const n=t;return window[n(919)][n(427)](new Blob([o],{type:n(696)}))}A.WORKLET_URL=C(g),A[t(572)]=C(I)},687:(i,A)=>{const e=Se;Object[e(815)](A,"__esModule",{value:!0}),A[e(729)]=A[e(653)]=A.blobToBase64=void 0,A[e(360)]=async function(t){return new Promise((g,I)=>{const C=Se,o=new FileReader;o[C(849)]=()=>g(o.result),o[C(409)](t)})},A[e(653)]=function(t,g){const I=e,C=window[I(919)][I(427)](g),o=document[I(709)]("a");o[I(460)]=C,o[I(892)]=t||I(684),o[I(948)]()},A[e(729)]=function(t,g){const I=e;if(!t[I(915)])return new Blob([],{type:I(914)});const C=t[0][I(915)],o=new Float32Array(C*t[I(915)]);t[I(909)]((a,s)=>{o[I(676)](a,s*C)});const n=function(a,s){const Q=I,r=s[Q(556)]?Float32Array:Uint16Array,B=a[Q(422)]/r[Q(486)],h=function(d){const E=Q,u=d[E(682)],_=d[E(809)]||2,x=d[E(556)]?4:2,D=d[E(556)]?3:1,w=d.sampleRate,y=_*x,S=w*y,l=u*y,p=new ArrayBuffer(44),N=new DataView(p);let U=0;function v(H){const O=E;for(let z=0;z<H.length;z++)N.setUint8(U+z,H[O(555)](z));U+=H.length}function P(H){N[E(545)](U,H,!0),U+=4}function W(H){N[E(450)](U,H,!0),U+=2}return v(E(418)),P(l+36),v(E(399)),v(E(488)),P(16),W(D),W(_),P(w),P(S),W(y),W(8*x),v("data"),P(l),new Uint8Array(p)}(Object[Q(879)]({},s,{numFrames:B})),c=new Uint8Array(h[Q(915)]+a[Q(422)]);return c[Q(676)](h,0),c[Q(676)](new Uint8Array(a),h.length),c}(o.buffer,{isFloat:!0,numChannels:1,sampleRate:g});return new Blob([n],{type:I(702)})}},479:(i,A)=>{const e=Se;Object.defineProperty(A,e(529),{value:!0}),A.isMobile=A.isSafari=void 0,A[e(958)]=function(){const t=e;return navigator[t(352)]&&navigator[t(352)][t(630)](t(656))>-1&&navigator[t(887)]&&navigator[t(887)][t(630)](t(820))==-1&&navigator[t(887)].indexOf("FxiOS")==-1},A[e(792)]=function(){const t=e,g=navigator[t(887)]||navigator[t(352)]||window.opera;return/iPhone|iPad|iPod|Android|IEMobile|Windows Phone|BlackBerry|webOS|Opera Mini|Nexus 7|Nexus 10|KFAPWI/i[t(845)](g)||/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(g)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i[t(845)](g[t(761)](0,4))}},406:(i,A,e)=>{const t=Se;Object[t(815)](A,t(529),{value:!0}),A[t(806)]=A[t(504)]=void 0;const g=e(785),I=e(761);A[t(504)]={REQUEST_NOISE_CANCELLATION:0},A[t(806)]=function(C){const o=t,n=2*I.SDK_FRAME_DURATION_10MS*C.sampleRate/1e3*I[o(768)];return{inputRingBuffer:new g[o(673)](n,C[o(912)]||1),outputRingBuffer:new g[o(673)](n,C.channelCount||1),atomicState:new Int32Array(new SharedArrayBuffer(Object[o(881)](A[o(504)])[o(915)]*Int32Array.BYTES_PER_ELEMENT))}}},761:(i,A)=>{const e=Se;Object[e(815)](A,e(529),{value:!0}),A.BVC_BLOCKED_DEVICES=A[e(850)]=A.MIN_BVC_SUPPORT_SAMPLE_RATE=A[e(513)]=A[e(610)]=A[e(927)]=A[e(569)]=A[e(765)]=A[e(873)]=A[e(401)]=A[e(768)]=void 0,A.WEB_AUDIO_CHUNK_SIZE=128,A[e(401)]=e(800),A.BUFFER_DROP_SIZE_MS=500,A.BUFFER_DROP_KEEP_MS=40,A[e(569)]=200,A[e(927)]=10,A[e(610)]=[8e3,16e3,24e3,32e3,44100,48e3,88200,96e3],A.SUPPORTED_INBOUND_SAMPLE_RATES=[8e3],A[e(394)]=16e3,A[e(850)]=[],A[e(631)]=["macbook pro",e(704),e(918),e(405),e(882),e(705),e(629),e(497),e(464),e(847),e(515),e(632),"razer kiyo","streamcam",e(365),e(670),e(841),e(774),e(562),e(802),e(356),"hyperx quadcast",e(701),e(403),e(698),"gamedac",e(410),"axcs speaker","mateview",e(780),e(351),"pebble v3","jabra speak",e(727),"samson gomic",e(414),e(462),e(526),"amazonbasics desktop mini mic",e(931),e(428),e(712),e(546),"stf coloso",e(706),e(874),e(947),e(640),e(748),e(808),e(760),e(539),"edifier luna eclipse",e(804),e(397),e(439),e(657),e(782),e(785),e(798),"trio8800","edifier s3000 pro","eneby20",e(926),e(398),e(913),e(707),"thronmax mdrill","thronmax pulse",e(691),e(920),e(901),e(491),e(939),e(594),e(781),e(889),e(402),e(549),"razer base station v2 chroma",e(904),e(921),"audioengine",e(739),e(910),e(383),"anker soundcore",e(899),e(388),e(868),"pc-lm1e audio",e(485),e(433),"jabra panacast",e(801),"samsung slimfit cam",e(685),"usb mic",e(908),"teufel cinebar one",e(745),"soundtech",e(411),"speechmike iii",e(956),e(754),e(730),"simmons sd600",e(772),e(514),e(807),e(570),e(599),"inc2000",e(770),e(943),e(563),"lg-pk3","lgtg-210",e(694),"office node bt","iconf","ready elite",e(612),e(543),e(884),e(518),e(536),e(647),"bose sliii","soundlink","powerconf s3",e(907),e(949),e(811),"bss 4803",e(440),e(595),e(492),"bose solo","bugani m83","cambridge audio one","soundcore mini",e(890),e(929),e(639),"by-pm500",e(392),e(759),"edifier s880db",e(495),"fantech luminous c30","anker soundcore boost",e(527),e(911),"jbl pulse 4",e(436),e(790),"mi portable bluetooth speaker","sb-50",e(361),e(593),"soundcore 2","soundcore motion b",e(816),e(818),"ziisound d5",e(928),"presence",e(934),e(519),e(903),e(876),"ln01a",e(505),e(957),"monster s310","pyleusa","phonak compilot ii",e(481),e(390),e(756),e(393),e(606),"wireless controller","epson projector mpp audio",e(445),e(813),e(474),"at2020 usb",e(620),e(338),e(824),"hk onyx studio 4",e(601),e(406),e(689),e(345),"zv-1",e(758),e(870),"creative t60",e(687),e(386),e(498),e(421),e(953),"tonor tc-2030 audio device","wireless go ii rx","kandao meeting","klim talk",e(863),e(523),e(783),"verbatim 1080p mic",e(475),e(669),e(950),e(443),e(753),e(466),e(560),e(869),e(697),e(746),e(618),"infinity fuze 100",e(591),e(834),e(952),e(838),e(823),e(607),e(900),"m799b",e(573),"kz-dc4k audio","shure mv5",e(776),"room1 bluetooth",e(859),"creative live! mic m3",e(437),e(905),"edifier mp380",e(496),"bedroom speaker",e(507),"hk_allure_portable","megablast",e(762),"oppo wireless speaker",e(830),e(359),"oontz angle 3 plus",e(461),e(366),"redmi tv soundbar",e(465),e(456),"audiohub speaker",e(810),"ian layugan’s double chill speaker",e(520),e(672),e(871),e(855),e(805),"ndz-03-ga",e(644),e(454),e(935),e(925),"razer leviathan","s2025",e(852),"sdh-201",e(621),e(583),e(349),"spa4040b",e(866),e(779),e(597),"stone 1400 mini","at-csp5",e(827),e(835),e(419),e(893),e(844),e(382),e(585),e(703),e(652),"tcl ts5000",e(354),"[samsung] airtrack",e(668),e(743),e(611),e(339),e(757),e(577),e(734),"yu6 by kanto","yvc-330 yamaha",e(627),e(710),e(363),e(666),e(400),e(832),e(559),e(476),e(584),e(598),e(379),e(483),"crestron mercury",e(654),e(736),e(642),e(650),e(490),e(358),e(574),"razer seiren",e(344),e(509),e(812),e(624),e(674),e(343),e(733),"fifine k669 microphone",e(533),e(749),e(551),"aoni microphone",e(777),e(822),"fifine k690 microphone",e(951),e(836),e(894),e(658),e(897),e(655),e(501),"trust gxt 242 microphone",e(857),e(878),e(384),e(416),e(942),e(843),e(447),"polycom voxbox",e(469),"wireless microphone rx","poly sync",e(619),e(638),e(407),e(719),e(700),"fifine k670 microphone","obsbot meet 4k microphone","obsbot tiny 4k microphone",e(528),"gxt 244 microphone",e(872),e(547),e(412),e(525),e(423),e(906),e(645),e(933),"sony:srs-x2",e(534),e(576),e(362),e(728),e(763),e(500),"c2422he","emeet m2",e(494),e(613),e(851),"ht-s100f",e(937),e(766),e(617),e(683),"bw02-bt","hw01","soundcore mini 3 pro",e(381),"taotronics tt-sk023","tribit maxsound plus","anker powerconf s3(大会議室)",e(720),e(458),"wonderboom",e(699)]},608:(i,A,e)=>{const t=Se;Object[t(815)](A,t(529),{value:!0}),A[t(723)]=A.validateModels=A[t(664)]=A[t(895)]=A[t(589)]=void 0;const g=e(967),I=e(333),C=e(761);function o(a){return I[t(750)][a]}function n(a){const s=t;return/^https?\:\/\//i[s(845)](a)||/^file\:\/\//i[s(845)](a)||/^chrome-extension\:\/\//i.test(a)||/^moz-extension\:\/\//i[s(845)](a)?new URL(a)[s(371)]():((a==null?void 0:a[0])!="/"&&(a="/"+a),new URL(window[s(941)].origin+a)[s(371)]())}A[t(589)]=o,A[t(895)]=function(a){const s=t;try{return Object.values(a)[s(909)](Q=>n(Q)),!1}catch{return!0}},A[t(664)]=n,A.validateModels=function(a){const s=t,Q={},r={};try{for(let B in a){const h=a[B];if(s(420)==typeof h)Q[B]=n(h);else{if(typeof h!="object")throw new Error(s(614));{const c=n(h.url);Q[B]=c,h.preload&&(r[B]=c)}}}}catch(B){throw g.Logger.error(s(463),B),B}return[Q,r]},A[t(723)]=function(a,s){const Q=t;let r=C.SUPPORTED_SAMPLE_RATES[Q(630)](s);for(;r>=0;){const B=o(C[Q(610)][r]);if(a[B])return[B,n(a[B])];r--}throw new Error("MODEL_NOT_FOUND")}}},ME={};function FE(i){const A=Se;var e=ME[i];if(e!==void 0)return e[A(793)];var t=ME[i]={exports:{}};return Xf[i](t,t[A(793)],FE),t.exports}var rs={};(()=>{const i=Se;var A=rs;Object[i(815)](A,"X",{value:!0});const e=FE(62);A.Z=e[i(615)]})(),rs.X;var UE=rs.Z;const Je=Fo;(function(i,A){const e=Fo,t=i();for(;;)try{if(parseInt(e(298))/1*(parseInt(e(297))/2)+parseInt(e(247))/3+parseInt(e(269))/4+parseInt(e(233))/5*(parseInt(e(242))/6)+parseInt(e(288))/7*(parseInt(e(313))/8)+-parseInt(e(302))/9+parseInt(e(239))/10*(-parseInt(e(273))/11)===A)break;t.push(t.shift())}catch{t.push(t.shift())}})(Uo,562139);function Fo(i,A){const e=Uo();return Fo=function(t,g){return t=t-225,e[t]},Fo(i,A)}function Uo(){const i=["token","zed","vekit.io/i","settings","s/enc/v1","disconnect","lled after","dispose","Bearer ","iseCancell","startsWith","aStreamDes","restart","4496876BAOwLO","replace","http","model8","11tEJMMC","filter ena","connect","gin. setEn","eFilter","ation","authentica","abled can ","Authentica","Models are","ut connect","te. Server","enable plu","status","Could not ","4705316zCaWEW","model16","cannot res","livekit.cl","model32","only be ca",". Code 256"," enable an","oud","4656CdtJjY","233WCpNDI","isReady","https://li","json","989316uDaCiu","aStreamSou","ing first","ise filter","ntegration","host"," responded","tion Error","cate filte","rce","enable","8gCHxQG","statusText","bled"," missing","Server res","itialized","url","g the trac","Set noise ","disable","d authenti","audioConte","engine","tart witho","debug","endsWith","5MeNWcs","createNois"," enable no"," with stat","isInitiali","isEnabled","33077050iBqzFG","enhancedNo","attempt to","4834338fMChcj","isSupporte","stream","modelPaths","setEnabled","2505642eqXrbi","ponded wit","tination","h status "," publishin","createMedi","us ","init","SDK not in"];return Uo=function(){return i},Uo()}var Gi,wt,EC,Mg,sg,Qg,LE,vE,Bs,KE,Es,JE;class cs{constructor(){Ri(this,Bs),Ri(this,Es),Ri(this,Gi,void 0),Ri(this,wt,void 0),Ri(this,EC,!1),Ri(this,Mg,void 0),Ri(this,sg,void 0),Ri(this,Qg,void 0),Si(this,LE,!1),Si(this,vE)}static[Je(243)+"d"](){return UE[Je(243)+"d"]()}get[(LE=Je(299),vE=Je(228)+"xt",Je(237)+Je(257))](){return zA(this,EC)}async[Je(254)](){const A=Je,{model8:e,model16:t,model32:g}=await GE(this,Es,JE).call(this);if(!zA(this,Gi)){if(!e||!t||!t)throw new Error(A(282)+A(316));Rt(this,Gi,new UE({params:{debugLogs:!1,logProcessStats:!1,useSharedArrayBuffer:!1,bufferOverflowMS:50,models:{model8:e,model16:t,model32:g}}}))}await zA(this,Gi)[A(254)](),Rt(this,EC,!0)}[Je(263)](){var A,e,t;const g=Je;Rt(this,Qg,void 0),(A=zA(this,wt))==null||A[g(226)](),(e=zA(this,wt))==null||e[g(263)](),(t=zA(this,Gi))==null||t[g(263)](),Rt(this,Gi,void 0),Rt(this,EC,!1),this[g(299)]=!1}async[Je(275)](A,e,t=!0){const g=Je;if(!zA(this,Gi))throw new TypeError(g(255)+g(318));return Rt(this,wt,await zA(this,Gi)[g(234)+g(277)]({audioContext:A,stream:e},async()=>{const I=g;this[I(299)]=!0,zA(this,Qg)&&t&&this[I(312)](zA(this,Qg))},()=>{const I=g;this[I(299)]=!1})),this[g(228)+"xt"]=A,Rt(this,Mg,this[g(228)+"xt"][g(252)+g(303)+g(311)](e)),zA(this,sg)??Rt(this,sg,this[g(228)+"xt"][g(252)+g(267)+g(249)]()),zA(this,Mg)[g(275)](zA(this,wt))[g(275)](zA(this,sg)),zA(this,sg)[g(244)]}async[Je(312)](A){var e,t;const g=Je;Rt(this,Qg,A);let I=A[g(229)][g(319)];I[g(266)]("ws")&&(I=I[g(270)](/^(ws)/,g(271)));const C=A[g(229)][g(256)],o=await GE(this,Bs,KE).call(this,I,C);this[g(299)]&&o?((e=zA(this,wt))==null||e[g(312)](),console[g(231)](g(225)+g(274)+g(315),!0)):this[g(299)]&&!o&&(console[g(231)](g(225)+g(274)+g(315),!1),(t=zA(this,wt))==null||t[g(226)]())}[Je(246)](A){var e;const t=Je;if(console[t(231)](t(241)+t(235)+t(305),A),A&&zA(this,Qg))console[t(231)](t(241)+t(295)+t(227)+t(310)+"r"),this[t(312)](zA(this,Qg));else if(!A)(e=zA(this,wt))==null||e[t(226)]();else throw new Error(t(287)+t(285)+t(276)+t(280)+t(293)+t(262)+t(251)+t(320)+"k")}async[Je(268)](A){var e,t;const g=Je;if(!zA(this,wt)||!zA(this,sg)||!zA(this,Mg)||!this[g(228)+"xt"])throw Error(g(290)+g(230)+g(283)+g(304));const I=zA(this,wt)[g(238)]();return zA(this,Mg)[g(261)](),(e=zA(this,wt))==null||e[g(261)](zA(this,sg)),(t=zA(this,wt))==null||t[g(263)](),Rt(this,Mg,void 0),this[g(275)](this[g(228)+"xt"],A,I)}}Gi=new WeakMap,wt=new WeakMap,EC=new WeakMap,Mg=new WeakMap,sg=new WeakMap,Qg=new WeakMap,Bs=new WeakSet,KE=async function(i,A){const e=Je;if(!new URL(i)[e(307)][e(232)](e(291)+e(296)))throw new Error(e(281)+e(309)+e(294)+"83");const t=new URL(e(259),i),g=await fetch(t,{headers:{authorization:e(264)+A}});if(g.ok)return(await g[e(301)]())[e(240)+e(265)+e(278)]===!0;throw new Error(e(287)+e(279)+e(284)+e(308)+e(236)+e(253)+g[e(286)]+": "+g[e(314)])},Es=new WeakSet,JE=async function(){const i=Je,A=await fetch(i(300)+i(258)+i(306)+i(260));if(A.ok){const e=await A[i(301)]();return{model8:e[i(245)][i(272)],model16:e[i(245)][i(289)],model32:e[i(245)][i(292)]}}else throw new Error(i(317)+i(248)+i(250)+A[i(286)]+": "+A[i(314)])};var mt;class YE{constructor(A){Si(this,"name","livekit-noise-filter"),Si(this,"processedTrack"),Si(this,"trackSettings"),Si(this,"originalTrack"),Ri(this,mt,void 0),Si(this,"init",async e=>{console.debug("initializing noise processor"),this.originalTrack=e.track,this.trackSettings=e.track.getSettings(),e.audioContext.sampleRate!==this.trackSettings.sampleRate&&console.debug("sample rate mismatch, reapplying"),await e.track.applyConstraints({...this.trackSettings,echoCancellation:!1,autoGainControl:!1,noiseSuppression:!1,sampleRate:e.audioContext.sampleRate}),zA(this,mt)||Rt(this,mt,new cs),await zA(this,mt).init(),this.processedTrack=(await zA(this,mt).connect(e.audioContext,new MediaStream([e.track]))).getAudioTracks()[0]}),Si(this,"restart",async e=>{if(!zA(this,mt))throw Error("cannot restart without having initialized first");console.debug("restarting noise cancellation"),this.processedTrack=(await zA(this,mt).restart(new MediaStream([e.track]))).getAudioTracks()[0]}),Si(this,"destroy",async()=>{var e,t;(e=zA(this,mt))==null||e.dispose(),await((t=this.originalTrack)==null?void 0:t.applyConstraints(this.trackSettings))}),Rt(this,mt,new cs)}static isSupported(){return cs.isSupported()}async onPublish(A){await zA(this,mt).enable(A),await zA(this,mt).setEnabled(!0)}async setEnabled(A){await zA(this,mt).setEnabled(A)}}mt=new WeakMap;const Zf=YE.isSupported,zf=()=>new YE;class cI{constructor(){this.audioContext=null,this.refCount=0,this.resumePromise=null}static getInstance(){return cI.instance||(cI.instance=new cI),cI.instance}async acquire(){if(this.refCount++,!this.audioContext)try{const A=window.AudioContext||window.webkitAudioContext;if(!A)return console.warn("[SharedAudioContext] Web Audio API not supported"),null;this.audioContext=new A,console.log("[SharedAudioContext] Created shared AudioContext")}catch(A){return console.warn("[SharedAudioContext] Failed to create AudioContext:",A),null}return await this.ensureResumed(),this.audioContext}release(){this.refCount=Math.max(0,this.refCount-1),this.refCount===0&&console.log("[SharedAudioContext] All references released, context kept alive for reuse")}forceClose(){if(this.audioContext){try{this.audioContext.close()}catch{}this.audioContext=null,this.refCount=0,console.log("[SharedAudioContext] Force closed")}}getContext(){return this.audioContext}async ensureResumed(){if(!this.audioContext)return!1;if(this.audioContext.state==="suspended"){this.resumePromise||(this.resumePromise=this.audioContext.resume().finally(()=>{this.resumePromise=null}));try{await this.resumePromise}catch{return!1}}return this.audioContext.state==="running"}isRunning(){return this.audioContext!==null&&this.audioContext.state==="running"}getState(){var A;return((A=this.audioContext)==null?void 0:A.state)??null}getSampleRate(){var A;return((A=this.audioContext)==null?void 0:A.sampleRate)??44100}getCurrentTime(){var A;return((A=this.audioContext)==null?void 0:A.currentTime)??0}getDestination(){var A;return((A=this.audioContext)==null?void 0:A.destination)??null}}const Qi=cI.getInstance();typeof window<"u"&&window.addEventListener("pagehide",()=>{Qi.forceClose()});const $f=Zf();let cC=null,Lo=!1;function AD(){if(!$f||Lo)return null;if(!cC)try{cC=zf()}catch(i){return Lo=!0,console.warn("[NoiseFilter] init failed, keeping native NS:",i),null}return cC}function eD(){const i=cC;cC=null,Lo=!1,i&&typeof i.destroy=="function"&&i.destroy().catch(A=>{console.debug("[NoiseFilter] destroy error on reset (non-fatal):",A)})}const rt=class rt extends EventTarget{constructor(){super(...arguments),this.room=null,this.callStatus="idle",this.isReady=!1,this.error=null,this.microphoneEnabled=!1,this.connectedParticipants=[],this.userIdentity="",this.roomName="",this.audioPlaybackPrompt=!1,this.isAppleDevice=/iPhone|iPad|iPod|Macintosh|Mac OS/i.test(navigator.userAgent),this.agentAudioElements=[],this.unmuteTimer=null,this.speakingHandler=null,this.fadeContext=null,this.fadeContextAcquired=!1,this.fadeGains=new Map,this.fadeSetupPromise=null,this.noiseFilterAttached=!1}static isAgentIdentity(A){return A.includes("agent")||A.includes("voice-assistant")||A.includes("AJ_")}set serviceUrl(A){this._serviceUrl=A}get serviceUrl(){return this._serviceUrl??"https://voice.hanc.ai"}get status(){return this.callStatus}get ready(){return this.isReady}get currentError(){return this.error}get currentRoom(){return this.room}get isMicrophoneEnabled(){return this.microphoneEnabled}get participants(){return this.connectedParticipants}get identity(){return this.userIdentity}get roomNameValue(){return this.roomName}get showAudioPrompt(){return this.audioPlaybackPrompt}updateStatus(A){this.callStatus=A,this.dispatchEvent(new CustomEvent("status-changed",{detail:A}))}async makeCall({agentId:A,user_identity:e}){var t;if(!(this.room&&this.room.state==="connected")){this.updateStatus("connecting"),this.error=null,this.isReady=!1,this.room&&(await this.room.disconnect(),this.room=null);try{const g=new EI({webAudioMix:!1,dynacast:!0,adaptiveStream:!0});this.room=g,this.setupRoomEventListeners(g);const I=await fetch(`${this.serviceUrl}/create-room-token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({metadata:{user_identity:e,agent_id:A,timestamp:Date.now(),is_apple_device:this.isAppleDevice}})});if(!I.ok){const Q=await I.text(),r=new Error(`Failed to get room token: ${I.status} ${Q}`);throw r.status=I.status,r}const{token:C,url:o,room_name:n,user_identity:a}=await I.json();this.roomName=n,this.userIdentity=a;const s={echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0};await Promise.all([g.localParticipant.setMicrophoneEnabled(!0,s).then(()=>{this.microphoneEnabled=!0,this.dispatchEvent(new CustomEvent("microphone-enabled")),this.attachNoiseFilter(g)}).catch(Q=>{console.warn("Could not enable microphone:",Q),this.microphoneEnabled=!1,this.dispatchEvent(new CustomEvent("microphone-disabled"))}),g.connect(o,C)]),await new Promise(Q=>{const r=setTimeout(()=>{g.off(iA.ParticipantConnected,B),Q()},2e3),B=h=>{rt.isAgentIdentity(h.identity)&&(clearTimeout(r),g.off(iA.ParticipantConnected,B),Q())};for(const h of g.remoteParticipants.values())if(rt.isAgentIdentity(h.identity)){clearTimeout(r),Q();return}g.on(iA.ParticipantConnected,B)}),this.updateStatus("connected"),this.isReady=!0;for(const Q of g.localParticipant.audioTrackPublications.values())(t=Q.track)!=null&&t.mediaStreamTrack&&this.dispatchEvent(new CustomEvent("local-audio-track",{detail:Q.track.mediaStreamTrack}));this.dispatchEvent(new CustomEvent("room-connected",{detail:{roomName:n,identity:a}}))}catch(g){this.error=`Connection failed: ${g instanceof Error?g.message:String(g)}`,this.updateStatus("error"),this.isReady=!1,this.room=null;const I=typeof(g==null?void 0:g.status)=="number"?g.status:null;this.dispatchEvent(new CustomEvent("error",{detail:{error:this.error,status:I}}))}}}setupRoomEventListeners(A){A.on(iA.Disconnected,()=>{this.callStatus!=="disconnected"&&this.updateStatus("disconnected"),this.connectedParticipants=[],this.microphoneEnabled=!1,this.audioPlaybackPrompt=!1,this.isReady=!1,this.noiseFilterAttached=!1,eD(),this.cleanupFadeContext(),this.unmuteTimer&&(clearTimeout(this.unmuteTimer),this.unmuteTimer=null),this.speakingHandler&&(A.localParticipant.off("isSpeakingChanged",this.speakingHandler),this.speakingHandler=null),this.room=null,this.dispatchEvent(new CustomEvent("disconnected"))}),A.on(iA.ParticipantConnected,e=>{this.connectedParticipants=[...this.connectedParticipants,e.identity];const t=rt.isAgentIdentity(e.identity);t&&(this.updateStatus("agent-connected"),this.audioPlaybackPrompt=!0,this.dispatchEvent(new CustomEvent("agent-connected",{detail:{participant:e.identity}}))),this.dispatchEvent(new CustomEvent("participant-connected",{detail:{participant:e.identity,isAgent:t}}))}),A.on(iA.ParticipantDisconnected,e=>{this.connectedParticipants=this.connectedParticipants.filter(g=>g!==e.identity);const t=rt.isAgentIdentity(e.identity);t&&(this.audioPlaybackPrompt=!1,this.updateStatus("connected"),this.dispatchEvent(new CustomEvent("agent-disconnected",{detail:{participant:e.identity}}))),this.dispatchEvent(new CustomEvent("participant-disconnected",{detail:{participant:e.identity,isAgent:t}}))}),A.on(iA.TrackSubscribed,(e,t,g)=>{if(e.kind==="audio"){const I=e.attach();document.body.appendChild(I),rt.isAgentIdentity(g.identity)&&(this.agentAudioElements.push(I),this.setupAgentAudioFade(I)),this.dispatchEvent(new CustomEvent("audio-track-added",{detail:{participant:g.identity,element:I}}));const C=e.mediaStreamTrack;C&&this.dispatchEvent(new CustomEvent("audio-track",{detail:C}))}}),A.on(iA.TrackUnsubscribed,(e,t,g)=>{const I=e.detach();for(const C of I){const o=this.fadeGains.get(C);if(o){try{o.source.disconnect()}catch{}try{o.gain.disconnect()}catch{}this.fadeGains.delete(C)}}this.agentAudioElements=this.agentAudioElements.filter(C=>!I.includes(C)),this.dispatchEvent(new CustomEvent("audio-track-removed",{detail:{participant:g.identity}}))}),A.on(iA.MediaDevicesError,e=>{this.error=`Media device error: ${e.message}`,this.updateStatus("error"),this.dispatchEvent(new CustomEvent("error",{detail:{error:this.error}}))}),A.on(iA.AudioPlaybackStatusChanged,async()=>{A.canPlaybackAudio||this.connectedParticipants.some(t=>rt.isAgentIdentity(t))&&!this.audioPlaybackPrompt&&(this.updateStatus("agent-connected"),this.audioPlaybackPrompt=!0),this.dispatchEvent(new CustomEvent("audio-playback-status-changed",{detail:{canPlayback:A.canPlaybackAudio}}))}),A.on(iA.DataReceived,(e,t)=>{try{const g=JSON.parse(new TextDecoder().decode(e));g.type==="transcript"?this.dispatchEvent(new CustomEvent("transcription",{detail:{speaker:g.speaker,text:g.text,timestamp:g.timestamp},bubbles:!0,composed:!0})):(!t||rt.isAgentIdentity(t.identity))&&this.dispatchEvent(new CustomEvent("agent-command",{detail:g}))}catch{}}),this.speakingHandler=e=>{e?(this.unmuteTimer&&(clearTimeout(this.unmuteTimer),this.unmuteTimer=null),this.rampAgentGain(0,rt.FADEOUT_TC)):this.unmuteTimer=setTimeout(()=>{this.unmuteTimer=null,this.rampAgentGain(1,rt.FADEIN_TC)},rt.UNMUTE_HOLDOVER_MS)},A.localParticipant.on("isSpeakingChanged",this.speakingHandler)}async toggleMicrophone(){if(this.room)try{this.microphoneEnabled?(await this.room.localParticipant.setMicrophoneEnabled(!1),this.microphoneEnabled=!1,this.noiseFilterAttached=!1,this.dispatchEvent(new CustomEvent("microphone-disabled"))):(await this.room.localParticipant.setMicrophoneEnabled(!0,{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}),this.microphoneEnabled=!0,this.dispatchEvent(new CustomEvent("microphone-enabled")),this.attachNoiseFilter(this.room))}catch(A){this.error=`Failed to toggle microphone: ${A instanceof Error?A.message:String(A)}`,this.dispatchEvent(new CustomEvent("error",{detail:{error:this.error}}))}}attachNoiseFilter(A){if(this.noiseFilterAttached)return;const e=AD();if(!e)return;const t=Array.from(A.localParticipant.audioTrackPublications.values()).find(I=>I.kind==="audio"),g=t==null?void 0:t.track;g&&g.setProcessor(e).then(()=>{this.noiseFilterAttached=!0,console.log("[NoiseFilter] ai-coustics Voice Focus attached")}).catch(I=>{Lo=!0,console.warn("[NoiseFilter] Failed to attach, keeping native NS:",I)})}setupAgentAudioFade(A){const e=(async()=>{try{if(this.fadeContext)await Qi.ensureResumed();else{const I=await Qi.acquire();if(!I){console.warn("[CallManager] Could not acquire shared AudioContext for fade");return}this.fadeContext=I,this.fadeContextAcquired=!0}const t=this.fadeContext.createMediaElementSource(A),g=this.fadeContext.createGain();t.connect(g),g.connect(this.fadeContext.destination),this.fadeGains.set(A,{source:t,gain:g})}catch(t){console.warn("[CallManager] Audio fade setup failed:",t)}})();this.fadeSetupPromise=e,e.then(()=>{this.fadeSetupPromise=null})}rampAgentGain(A,e,t=!1){const g=this.fadeContext;if(g&&g.state==="running"&&this.fadeGains.size>0)for(const{gain:I}of this.fadeGains.values())I.gain.cancelScheduledValues(g.currentTime),I.gain.setValueAtTime(I.gain.value,g.currentTime),I.gain.setTargetAtTime(A,g.currentTime,e);else if(this.fadeSetupPromise)this.fadeSetupPromise.then(()=>this.rampAgentGain(A,e));else if(!t&&g&&g.state==="suspended"&&this.fadeGains.size>0)Qi.ensureResumed().then(I=>{if(I)this.rampAgentGain(A,e,!0);else for(const C of this.agentAudioElements)C.volume=A});else for(const I of this.agentAudioElements)I.volume=A}cleanupFadeContext(){this.agentAudioElements=[];for(const{source:A,gain:e}of this.fadeGains.values()){try{A.disconnect()}catch{}try{e.disconnect()}catch{}}this.fadeGains.clear(),this.fadeSetupPromise=null,this.fadeContextAcquired&&(Qi.release(),this.fadeContextAcquired=!1),this.fadeContext=null}async enableAudio(){if(this.room)try{await this.room.startAudio(),this.audioPlaybackPrompt=!1;const A=JSON.stringify({type:"audio_enabled"}),t=new TextEncoder().encode(A);await this.room.localParticipant.publishData(t,{reliable:!0}),this.dispatchEvent(new CustomEvent("audio-enabled"))}catch(A){this.error=`Failed to enable audio: ${A instanceof Error?A.message:String(A)}`,this.dispatchEvent(new CustomEvent("error",{detail:{error:this.error}}))}}async sendDataToAgent(A){if(!this.room){console.warn("[LiveKitCallManager] Cannot send data: no room");return}const t=new TextEncoder().encode(JSON.stringify(A));await this.room.localParticipant.publishData(t,{reliable:!0})}async hangUp(){if(!this.room){this.error="No active connection to end.";return}this.updateStatus("disconnecting");const A=this.room;this.room=null,this.connectedParticipants=[],this.microphoneEnabled=!1,this.audioPlaybackPrompt=!1,this.isReady=!1,this.cleanupFadeContext(),this.unmuteTimer&&(clearTimeout(this.unmuteTimer),this.unmuteTimer=null),this.speakingHandler&&(A.localParticipant.off("isSpeakingChanged",this.speakingHandler),this.speakingHandler=null),this.updateStatus("disconnected"),this.dispatchEvent(new CustomEvent("call-ended")),A.removeAllListeners(),this.noiseFilterAttached=!1,requestAnimationFrame(()=>{setTimeout(async()=>{try{await A.disconnect()}catch(e){console.warn("Error during room disconnect:",e)}},0)})}};rt.UNMUTE_HOLDOVER_MS=350,rt.FADEOUT_TC=.045,rt.FADEIN_TC=.03;let Fg=rt;/**
147
+ `;if(!this.logPort)return console[n(565)]("KrispSDK -",n(635),a);this.logPort[n(732)](a)}}},851:(i,A)=>{const e=Se;Object.defineProperty(A,"__esModule",{value:!0}),A[e(567)]=void 0,A[e(567)]=class{constructor(t={}){const g=e;this[g(554)]=t,this.dataCache={}}static async preload(t){const g=e,I=typeof t=="string"?t:t.url;return fetch(I,{cache:g(603)})}addPath(t,g){const I=e;this[I(554)][t]=g}removePath(t){const g=e;this[g(554)][t]&&(this.unloadModel(t),delete this[g(554)][t])}[e(831)](t){const g=e;if(!this[g(554)][t])throw new Error("Krisp SDK - Please add model path before loading");return this[g(517)][t]?this[g(517)][t]:new Promise((I,C)=>{const o=g;this[o(368)](this[o(554)][t],n=>{const a=o;this[a(517)][t]=n,I(n)},C)})}async[e(875)](t,g){const I=e;try{const C=await this.loadModel(g),o=new Uint8Array(C),n=t[I(688)](o[I(422)]);return t[I(865)][I(742)](n,n+o[I(422)])[I(676)](o),{bufferAddress:n,bufferLength:o[I(422)]}}catch(C){throw new Error(I(430)+C)}}[e(628)](t,g){t[e(480)](g)}[e(426)](t){this[e(517)][t]&&delete this.dataCache[t]}[e(368)](t,g,I){const C=e;var o=new XMLHttpRequest;o[C(726)]("GET",t,!0),o[C(817)]=C(858),o[C(633)]=function(){I("Network error during model loading")},o[C(731)]=function(){const n=C;o[n(434)]==200||o[n(434)]==304||o[n(434)]==206||o[n(434)]==0&&o[n(679)]?g(o[n(679)]):I(o.statusText+" : "+o[n(502)])},o[C(357)](null)}[e(799)](){const t=e;this.dataCache={},this[t(554)]={}}}},785:(i,A,e)=>{const t=Se;Object[t(815)](A,"__esModule",{value:!0}),A.SharedRingBuffer=void 0;const g=e(967),I={READ_INDEX:0,WRITE_INDEX:1};class C{constructor(n,a=1){const s=t;this._channelData=[],this[s(457)]=a,this[s(751)]=new Uint32Array(new SharedArrayBuffer(Object[s(881)](I)[s(915)]*Uint32Array[s(486)])),this._bufferLength=n+1;for(let Q=0;Q<a;Q++)this[s(690)].push(new Float32Array(new SharedArrayBuffer(this[s(896)]*Float32Array[s(486)])))}static[t(548)](n){return Object[t(634)](n,C.prototype)}push(n,a){const s=t,Q=Atomics[s(829)](this[s(751)],I[s(641)]),r=Atomics[s(829)](this._state,I[s(373)]);if(this._getAvailableWrite(Q,r)<a)return!1;let B=r+a;if(this[s(896)]<B){B-=this[s(896)];for(let h=0;h<this[s(457)];h++){const c=this._channelData[h][s(742)](r),d=this[s(690)][h][s(742)](0,B);c[s(676)](n[h][s(742)](0,c[s(915)])),d[s(676)](n[h][s(742)](c[s(915)]))}}else{for(let h=0;h<this[s(457)];h++)this[s(690)][h].subarray(r,B)[s(676)](n[h].subarray(0,a));B===this[s(896)]&&(B=0)}return Atomics.store(this[s(751)],I.WRITE_INDEX,B),!0}pull(n,a){const s=t,Q=Atomics[s(829)](this._state,I[s(641)]),r=Atomics[s(829)](this[s(751)],I[s(373)]);if(this._getAvailableRead(Q,r)<a)return!1;let B=Q+a;if(this[s(896)]<B){B-=this._bufferLength;for(let h=0;h<this[s(457)];h++){const c=this[s(690)][h][s(742)](Q),d=this[s(690)][h][s(742)](0,B);n[h].set(c),n[h].set(d,c[s(915)])}}else{for(let h=0;h<this._channelCount;++h)n[h][s(676)](this[s(690)][h][s(742)](Q,B));B===this._bufferLength&&(B=0)}return Atomics[s(431)](this[s(751)],I[s(641)],B),!0}[t(708)](){const n=t,a=Atomics[n(829)](this[n(751)],I[n(641)]),s=Atomics.load(this[n(751)],I[n(373)]);g[n(571)][n(695)](this,{availableRead:this[n(678)](a,s),availableWrite:this[n(380)](a,s)})}[t(724)](){const n=t,a=Atomics.load(this._state,I.READ_INDEX),s=Atomics[n(829)](this[n(751)],I[n(373)]);return this[n(678)](a,s)}[t(389)](n){return this[t(724)]()>=n}getBufferLength(){return this[t(896)]-1}[t(380)](n,a){const s=t;return a>=n?this[s(896)]-a+n-1:n-a-1}[t(678)](n,a){return a>=n?a-n:a+this._bufferLength-n}}A[t(673)]=C},333:(i,A)=>{const e=Se;Object.defineProperty(A,e(529),{value:!0}),A.sampleModelMap=void 0,A[e(750)]={8e3:e(854),16e3:e(348),24e3:e(452),32e3:e(452),44100:e(452),48e3:e(452),88200:e(452),96e3:"model32"}},862:(i,A,e)=>{const t=Se;Object[t(815)](A,t(529),{value:!0}),A[t(572)]=A[t(891)]=void 0;const g=e(3),I=e(656);function C(o){const n=t;return window[n(919)][n(427)](new Blob([o],{type:n(696)}))}A.WORKLET_URL=C(g),A[t(572)]=C(I)},687:(i,A)=>{const e=Se;Object[e(815)](A,"__esModule",{value:!0}),A[e(729)]=A[e(653)]=A.blobToBase64=void 0,A[e(360)]=async function(t){return new Promise((g,I)=>{const C=Se,o=new FileReader;o[C(849)]=()=>g(o.result),o[C(409)](t)})},A[e(653)]=function(t,g){const I=e,C=window[I(919)][I(427)](g),o=document[I(709)]("a");o[I(460)]=C,o[I(892)]=t||I(684),o[I(948)]()},A[e(729)]=function(t,g){const I=e;if(!t[I(915)])return new Blob([],{type:I(914)});const C=t[0][I(915)],o=new Float32Array(C*t[I(915)]);t[I(909)]((a,s)=>{o[I(676)](a,s*C)});const n=function(a,s){const Q=I,r=s[Q(556)]?Float32Array:Uint16Array,B=a[Q(422)]/r[Q(486)],h=function(d){const E=Q,u=d[E(682)],_=d[E(809)]||2,x=d[E(556)]?4:2,D=d[E(556)]?3:1,w=d.sampleRate,y=_*x,S=w*y,l=u*y,p=new ArrayBuffer(44),N=new DataView(p);let U=0;function v(H){const O=E;for(let z=0;z<H.length;z++)N.setUint8(U+z,H[O(555)](z));U+=H.length}function P(H){N[E(545)](U,H,!0),U+=4}function W(H){N[E(450)](U,H,!0),U+=2}return v(E(418)),P(l+36),v(E(399)),v(E(488)),P(16),W(D),W(_),P(w),P(S),W(y),W(8*x),v("data"),P(l),new Uint8Array(p)}(Object[Q(879)]({},s,{numFrames:B})),c=new Uint8Array(h[Q(915)]+a[Q(422)]);return c[Q(676)](h,0),c[Q(676)](new Uint8Array(a),h.length),c}(o.buffer,{isFloat:!0,numChannels:1,sampleRate:g});return new Blob([n],{type:I(702)})}},479:(i,A)=>{const e=Se;Object.defineProperty(A,e(529),{value:!0}),A.isMobile=A.isSafari=void 0,A[e(958)]=function(){const t=e;return navigator[t(352)]&&navigator[t(352)][t(630)](t(656))>-1&&navigator[t(887)]&&navigator[t(887)][t(630)](t(820))==-1&&navigator[t(887)].indexOf("FxiOS")==-1},A[e(792)]=function(){const t=e,g=navigator[t(887)]||navigator[t(352)]||window.opera;return/iPhone|iPad|iPod|Android|IEMobile|Windows Phone|BlackBerry|webOS|Opera Mini|Nexus 7|Nexus 10|KFAPWI/i[t(845)](g)||/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(g)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i[t(845)](g[t(761)](0,4))}},406:(i,A,e)=>{const t=Se;Object[t(815)](A,t(529),{value:!0}),A[t(806)]=A[t(504)]=void 0;const g=e(785),I=e(761);A[t(504)]={REQUEST_NOISE_CANCELLATION:0},A[t(806)]=function(C){const o=t,n=2*I.SDK_FRAME_DURATION_10MS*C.sampleRate/1e3*I[o(768)];return{inputRingBuffer:new g[o(673)](n,C[o(912)]||1),outputRingBuffer:new g[o(673)](n,C.channelCount||1),atomicState:new Int32Array(new SharedArrayBuffer(Object[o(881)](A[o(504)])[o(915)]*Int32Array.BYTES_PER_ELEMENT))}}},761:(i,A)=>{const e=Se;Object[e(815)](A,e(529),{value:!0}),A.BVC_BLOCKED_DEVICES=A[e(850)]=A.MIN_BVC_SUPPORT_SAMPLE_RATE=A[e(513)]=A[e(610)]=A[e(927)]=A[e(569)]=A[e(765)]=A[e(873)]=A[e(401)]=A[e(768)]=void 0,A.WEB_AUDIO_CHUNK_SIZE=128,A[e(401)]=e(800),A.BUFFER_DROP_SIZE_MS=500,A.BUFFER_DROP_KEEP_MS=40,A[e(569)]=200,A[e(927)]=10,A[e(610)]=[8e3,16e3,24e3,32e3,44100,48e3,88200,96e3],A.SUPPORTED_INBOUND_SAMPLE_RATES=[8e3],A[e(394)]=16e3,A[e(850)]=[],A[e(631)]=["macbook pro",e(704),e(918),e(405),e(882),e(705),e(629),e(497),e(464),e(847),e(515),e(632),"razer kiyo","streamcam",e(365),e(670),e(841),e(774),e(562),e(802),e(356),"hyperx quadcast",e(701),e(403),e(698),"gamedac",e(410),"axcs speaker","mateview",e(780),e(351),"pebble v3","jabra speak",e(727),"samson gomic",e(414),e(462),e(526),"amazonbasics desktop mini mic",e(931),e(428),e(712),e(546),"stf coloso",e(706),e(874),e(947),e(640),e(748),e(808),e(760),e(539),"edifier luna eclipse",e(804),e(397),e(439),e(657),e(782),e(785),e(798),"trio8800","edifier s3000 pro","eneby20",e(926),e(398),e(913),e(707),"thronmax mdrill","thronmax pulse",e(691),e(920),e(901),e(491),e(939),e(594),e(781),e(889),e(402),e(549),"razer base station v2 chroma",e(904),e(921),"audioengine",e(739),e(910),e(383),"anker soundcore",e(899),e(388),e(868),"pc-lm1e audio",e(485),e(433),"jabra panacast",e(801),"samsung slimfit cam",e(685),"usb mic",e(908),"teufel cinebar one",e(745),"soundtech",e(411),"speechmike iii",e(956),e(754),e(730),"simmons sd600",e(772),e(514),e(807),e(570),e(599),"inc2000",e(770),e(943),e(563),"lg-pk3","lgtg-210",e(694),"office node bt","iconf","ready elite",e(612),e(543),e(884),e(518),e(536),e(647),"bose sliii","soundlink","powerconf s3",e(907),e(949),e(811),"bss 4803",e(440),e(595),e(492),"bose solo","bugani m83","cambridge audio one","soundcore mini",e(890),e(929),e(639),"by-pm500",e(392),e(759),"edifier s880db",e(495),"fantech luminous c30","anker soundcore boost",e(527),e(911),"jbl pulse 4",e(436),e(790),"mi portable bluetooth speaker","sb-50",e(361),e(593),"soundcore 2","soundcore motion b",e(816),e(818),"ziisound d5",e(928),"presence",e(934),e(519),e(903),e(876),"ln01a",e(505),e(957),"monster s310","pyleusa","phonak compilot ii",e(481),e(390),e(756),e(393),e(606),"wireless controller","epson projector mpp audio",e(445),e(813),e(474),"at2020 usb",e(620),e(338),e(824),"hk onyx studio 4",e(601),e(406),e(689),e(345),"zv-1",e(758),e(870),"creative t60",e(687),e(386),e(498),e(421),e(953),"tonor tc-2030 audio device","wireless go ii rx","kandao meeting","klim talk",e(863),e(523),e(783),"verbatim 1080p mic",e(475),e(669),e(950),e(443),e(753),e(466),e(560),e(869),e(697),e(746),e(618),"infinity fuze 100",e(591),e(834),e(952),e(838),e(823),e(607),e(900),"m799b",e(573),"kz-dc4k audio","shure mv5",e(776),"room1 bluetooth",e(859),"creative live! mic m3",e(437),e(905),"edifier mp380",e(496),"bedroom speaker",e(507),"hk_allure_portable","megablast",e(762),"oppo wireless speaker",e(830),e(359),"oontz angle 3 plus",e(461),e(366),"redmi tv soundbar",e(465),e(456),"audiohub speaker",e(810),"ian layugan’s double chill speaker",e(520),e(672),e(871),e(855),e(805),"ndz-03-ga",e(644),e(454),e(935),e(925),"razer leviathan","s2025",e(852),"sdh-201",e(621),e(583),e(349),"spa4040b",e(866),e(779),e(597),"stone 1400 mini","at-csp5",e(827),e(835),e(419),e(893),e(844),e(382),e(585),e(703),e(652),"tcl ts5000",e(354),"[samsung] airtrack",e(668),e(743),e(611),e(339),e(757),e(577),e(734),"yu6 by kanto","yvc-330 yamaha",e(627),e(710),e(363),e(666),e(400),e(832),e(559),e(476),e(584),e(598),e(379),e(483),"crestron mercury",e(654),e(736),e(642),e(650),e(490),e(358),e(574),"razer seiren",e(344),e(509),e(812),e(624),e(674),e(343),e(733),"fifine k669 microphone",e(533),e(749),e(551),"aoni microphone",e(777),e(822),"fifine k690 microphone",e(951),e(836),e(894),e(658),e(897),e(655),e(501),"trust gxt 242 microphone",e(857),e(878),e(384),e(416),e(942),e(843),e(447),"polycom voxbox",e(469),"wireless microphone rx","poly sync",e(619),e(638),e(407),e(719),e(700),"fifine k670 microphone","obsbot meet 4k microphone","obsbot tiny 4k microphone",e(528),"gxt 244 microphone",e(872),e(547),e(412),e(525),e(423),e(906),e(645),e(933),"sony:srs-x2",e(534),e(576),e(362),e(728),e(763),e(500),"c2422he","emeet m2",e(494),e(613),e(851),"ht-s100f",e(937),e(766),e(617),e(683),"bw02-bt","hw01","soundcore mini 3 pro",e(381),"taotronics tt-sk023","tribit maxsound plus","anker powerconf s3(大会議室)",e(720),e(458),"wonderboom",e(699)]},608:(i,A,e)=>{const t=Se;Object[t(815)](A,t(529),{value:!0}),A[t(723)]=A.validateModels=A[t(664)]=A[t(895)]=A[t(589)]=void 0;const g=e(967),I=e(333),C=e(761);function o(a){return I[t(750)][a]}function n(a){const s=t;return/^https?\:\/\//i[s(845)](a)||/^file\:\/\//i[s(845)](a)||/^chrome-extension\:\/\//i.test(a)||/^moz-extension\:\/\//i[s(845)](a)?new URL(a)[s(371)]():((a==null?void 0:a[0])!="/"&&(a="/"+a),new URL(window[s(941)].origin+a)[s(371)]())}A[t(589)]=o,A[t(895)]=function(a){const s=t;try{return Object.values(a)[s(909)](Q=>n(Q)),!1}catch{return!0}},A[t(664)]=n,A.validateModels=function(a){const s=t,Q={},r={};try{for(let B in a){const h=a[B];if(s(420)==typeof h)Q[B]=n(h);else{if(typeof h!="object")throw new Error(s(614));{const c=n(h.url);Q[B]=c,h.preload&&(r[B]=c)}}}}catch(B){throw g.Logger.error(s(463),B),B}return[Q,r]},A[t(723)]=function(a,s){const Q=t;let r=C.SUPPORTED_SAMPLE_RATES[Q(630)](s);for(;r>=0;){const B=o(C[Q(610)][r]);if(a[B])return[B,n(a[B])];r--}throw new Error("MODEL_NOT_FOUND")}}},ME={};function FE(i){const A=Se;var e=ME[i];if(e!==void 0)return e[A(793)];var t=ME[i]={exports:{}};return Xf[i](t,t[A(793)],FE),t.exports}var rs={};(()=>{const i=Se;var A=rs;Object[i(815)](A,"X",{value:!0});const e=FE(62);A.Z=e[i(615)]})(),rs.X;var UE=rs.Z;const Je=Fo;(function(i,A){const e=Fo,t=i();for(;;)try{if(parseInt(e(298))/1*(parseInt(e(297))/2)+parseInt(e(247))/3+parseInt(e(269))/4+parseInt(e(233))/5*(parseInt(e(242))/6)+parseInt(e(288))/7*(parseInt(e(313))/8)+-parseInt(e(302))/9+parseInt(e(239))/10*(-parseInt(e(273))/11)===A)break;t.push(t.shift())}catch{t.push(t.shift())}})(Uo,562139);function Fo(i,A){const e=Uo();return Fo=function(t,g){return t=t-225,e[t]},Fo(i,A)}function Uo(){const i=["token","zed","vekit.io/i","settings","s/enc/v1","disconnect","lled after","dispose","Bearer ","iseCancell","startsWith","aStreamDes","restart","4496876BAOwLO","replace","http","model8","11tEJMMC","filter ena","connect","gin. setEn","eFilter","ation","authentica","abled can ","Authentica","Models are","ut connect","te. Server","enable plu","status","Could not ","4705316zCaWEW","model16","cannot res","livekit.cl","model32","only be ca",". Code 256"," enable an","oud","4656CdtJjY","233WCpNDI","isReady","https://li","json","989316uDaCiu","aStreamSou","ing first","ise filter","ntegration","host"," responded","tion Error","cate filte","rce","enable","8gCHxQG","statusText","bled"," missing","Server res","itialized","url","g the trac","Set noise ","disable","d authenti","audioConte","engine","tart witho","debug","endsWith","5MeNWcs","createNois"," enable no"," with stat","isInitiali","isEnabled","33077050iBqzFG","enhancedNo","attempt to","4834338fMChcj","isSupporte","stream","modelPaths","setEnabled","2505642eqXrbi","ponded wit","tination","h status "," publishin","createMedi","us ","init","SDK not in"];return Uo=function(){return i},Uo()}var Gi,wt,EC,Mg,sg,Qg,LE,vE,Bs,KE,Es,JE;class cs{constructor(){Ri(this,Bs),Ri(this,Es),Ri(this,Gi,void 0),Ri(this,wt,void 0),Ri(this,EC,!1),Ri(this,Mg,void 0),Ri(this,sg,void 0),Ri(this,Qg,void 0),Si(this,LE,!1),Si(this,vE)}static[Je(243)+"d"](){return UE[Je(243)+"d"]()}get[(LE=Je(299),vE=Je(228)+"xt",Je(237)+Je(257))](){return zA(this,EC)}async[Je(254)](){const A=Je,{model8:e,model16:t,model32:g}=await GE(this,Es,JE).call(this);if(!zA(this,Gi)){if(!e||!t||!t)throw new Error(A(282)+A(316));Rt(this,Gi,new UE({params:{debugLogs:!1,logProcessStats:!1,useSharedArrayBuffer:!1,bufferOverflowMS:50,models:{model8:e,model16:t,model32:g}}}))}await zA(this,Gi)[A(254)](),Rt(this,EC,!0)}[Je(263)](){var A,e,t;const g=Je;Rt(this,Qg,void 0),(A=zA(this,wt))==null||A[g(226)](),(e=zA(this,wt))==null||e[g(263)](),(t=zA(this,Gi))==null||t[g(263)](),Rt(this,Gi,void 0),Rt(this,EC,!1),this[g(299)]=!1}async[Je(275)](A,e,t=!0){const g=Je;if(!zA(this,Gi))throw new TypeError(g(255)+g(318));return Rt(this,wt,await zA(this,Gi)[g(234)+g(277)]({audioContext:A,stream:e},async()=>{const I=g;this[I(299)]=!0,zA(this,Qg)&&t&&this[I(312)](zA(this,Qg))},()=>{const I=g;this[I(299)]=!1})),this[g(228)+"xt"]=A,Rt(this,Mg,this[g(228)+"xt"][g(252)+g(303)+g(311)](e)),zA(this,sg)??Rt(this,sg,this[g(228)+"xt"][g(252)+g(267)+g(249)]()),zA(this,Mg)[g(275)](zA(this,wt))[g(275)](zA(this,sg)),zA(this,sg)[g(244)]}async[Je(312)](A){var e,t;const g=Je;Rt(this,Qg,A);let I=A[g(229)][g(319)];I[g(266)]("ws")&&(I=I[g(270)](/^(ws)/,g(271)));const C=A[g(229)][g(256)],o=await GE(this,Bs,KE).call(this,I,C);this[g(299)]&&o?((e=zA(this,wt))==null||e[g(312)](),console[g(231)](g(225)+g(274)+g(315),!0)):this[g(299)]&&!o&&(console[g(231)](g(225)+g(274)+g(315),!1),(t=zA(this,wt))==null||t[g(226)]())}[Je(246)](A){var e;const t=Je;if(console[t(231)](t(241)+t(235)+t(305),A),A&&zA(this,Qg))console[t(231)](t(241)+t(295)+t(227)+t(310)+"r"),this[t(312)](zA(this,Qg));else if(!A)(e=zA(this,wt))==null||e[t(226)]();else throw new Error(t(287)+t(285)+t(276)+t(280)+t(293)+t(262)+t(251)+t(320)+"k")}async[Je(268)](A){var e,t;const g=Je;if(!zA(this,wt)||!zA(this,sg)||!zA(this,Mg)||!this[g(228)+"xt"])throw Error(g(290)+g(230)+g(283)+g(304));const I=zA(this,wt)[g(238)]();return zA(this,Mg)[g(261)](),(e=zA(this,wt))==null||e[g(261)](zA(this,sg)),(t=zA(this,wt))==null||t[g(263)](),Rt(this,Mg,void 0),this[g(275)](this[g(228)+"xt"],A,I)}}Gi=new WeakMap,wt=new WeakMap,EC=new WeakMap,Mg=new WeakMap,sg=new WeakMap,Qg=new WeakMap,Bs=new WeakSet,KE=async function(i,A){const e=Je;if(!new URL(i)[e(307)][e(232)](e(291)+e(296)))throw new Error(e(281)+e(309)+e(294)+"83");const t=new URL(e(259),i),g=await fetch(t,{headers:{authorization:e(264)+A}});if(g.ok)return(await g[e(301)]())[e(240)+e(265)+e(278)]===!0;throw new Error(e(287)+e(279)+e(284)+e(308)+e(236)+e(253)+g[e(286)]+": "+g[e(314)])},Es=new WeakSet,JE=async function(){const i=Je,A=await fetch(i(300)+i(258)+i(306)+i(260));if(A.ok){const e=await A[i(301)]();return{model8:e[i(245)][i(272)],model16:e[i(245)][i(289)],model32:e[i(245)][i(292)]}}else throw new Error(i(317)+i(248)+i(250)+A[i(286)]+": "+A[i(314)])};var mt;class YE{constructor(A){Si(this,"name","livekit-noise-filter"),Si(this,"processedTrack"),Si(this,"trackSettings"),Si(this,"originalTrack"),Ri(this,mt,void 0),Si(this,"init",async e=>{console.debug("initializing noise processor"),this.originalTrack=e.track,this.trackSettings=e.track.getSettings(),e.audioContext.sampleRate!==this.trackSettings.sampleRate&&console.debug("sample rate mismatch, reapplying"),await e.track.applyConstraints({...this.trackSettings,echoCancellation:!1,autoGainControl:!1,noiseSuppression:!1,sampleRate:e.audioContext.sampleRate}),zA(this,mt)||Rt(this,mt,new cs),await zA(this,mt).init(),this.processedTrack=(await zA(this,mt).connect(e.audioContext,new MediaStream([e.track]))).getAudioTracks()[0]}),Si(this,"restart",async e=>{if(!zA(this,mt))throw Error("cannot restart without having initialized first");console.debug("restarting noise cancellation"),this.processedTrack=(await zA(this,mt).restart(new MediaStream([e.track]))).getAudioTracks()[0]}),Si(this,"destroy",async()=>{var e,t;(e=zA(this,mt))==null||e.dispose(),await((t=this.originalTrack)==null?void 0:t.applyConstraints(this.trackSettings))}),Rt(this,mt,new cs)}static isSupported(){return cs.isSupported()}async onPublish(A){await zA(this,mt).enable(A),await zA(this,mt).setEnabled(!0)}async setEnabled(A){await zA(this,mt).setEnabled(A)}}mt=new WeakMap;const Zf=YE.isSupported,zf=()=>new YE;class cI{constructor(){this.audioContext=null,this.refCount=0,this.resumePromise=null}static getInstance(){return cI.instance||(cI.instance=new cI),cI.instance}async acquire(){if(this.refCount++,!this.audioContext)try{const A=window.AudioContext||window.webkitAudioContext;if(!A)return console.warn("[SharedAudioContext] Web Audio API not supported"),null;this.audioContext=new A,console.log("[SharedAudioContext] Created shared AudioContext")}catch(A){return console.warn("[SharedAudioContext] Failed to create AudioContext:",A),null}return await this.ensureResumed(),this.audioContext}release(){this.refCount=Math.max(0,this.refCount-1),this.refCount===0&&console.log("[SharedAudioContext] All references released, context kept alive for reuse")}forceClose(){if(this.audioContext){try{this.audioContext.close()}catch{}this.audioContext=null,this.refCount=0,console.log("[SharedAudioContext] Force closed")}}getContext(){return this.audioContext}async ensureResumed(){if(!this.audioContext)return!1;if(this.audioContext.state==="suspended"){this.resumePromise||(this.resumePromise=this.audioContext.resume().finally(()=>{this.resumePromise=null}));try{await this.resumePromise}catch{return!1}}return this.audioContext.state==="running"}isRunning(){return this.audioContext!==null&&this.audioContext.state==="running"}getState(){var A;return((A=this.audioContext)==null?void 0:A.state)??null}getSampleRate(){var A;return((A=this.audioContext)==null?void 0:A.sampleRate)??44100}getCurrentTime(){var A;return((A=this.audioContext)==null?void 0:A.currentTime)??0}getDestination(){var A;return((A=this.audioContext)==null?void 0:A.destination)??null}}const Qi=cI.getInstance();typeof window<"u"&&window.addEventListener("pagehide",()=>{Qi.forceClose()});const $f=Zf();let cC=null,Lo=!1;function AD(){if(!$f||Lo)return null;if(!cC)try{cC=zf()}catch(i){return Lo=!0,console.warn("[NoiseFilter] init failed, keeping native NS:",i),null}return cC}function eD(){const i=cC;cC=null,Lo=!1,i&&typeof i.destroy=="function"&&i.destroy().catch(A=>{console.debug("[NoiseFilter] destroy error on reset (non-fatal):",A)})}const et=class et extends EventTarget{constructor(){super(...arguments),this.room=null,this.callStatus="idle",this.isReady=!1,this.error=null,this.microphoneEnabled=!1,this.connectedParticipants=[],this.userIdentity="",this.roomName="",this.audioPlaybackPrompt=!1,this.isAppleDevice=/iPhone|iPad|iPod|Macintosh|Mac OS/i.test(navigator.userAgent),this.agentAudioElements=[],this.unmuteTimer=null,this.speakingHandler=null,this.fadeContext=null,this.fadeContextAcquired=!1,this.fadeGains=new Map,this.fadeSetupPromise=null,this.noiseFilterAttached=!1}static isAgentIdentity(A){return A.includes("agent")||A.includes("voice-assistant")||A.includes("AJ_")}set serviceUrl(A){this._serviceUrl=A}get serviceUrl(){return this._serviceUrl??"https://voice.hanc.ai"}get status(){return this.callStatus}get ready(){return this.isReady}get currentError(){return this.error}get currentRoom(){return this.room}get isMicrophoneEnabled(){return this.microphoneEnabled}get participants(){return this.connectedParticipants}get identity(){return this.userIdentity}get roomNameValue(){return this.roomName}get showAudioPrompt(){return this.audioPlaybackPrompt}updateStatus(A){this.callStatus=A,this.dispatchEvent(new CustomEvent("status-changed",{detail:A}))}async makeCall({agentId:A,user_identity:e}){var t;if(!(this.room&&this.room.state==="connected")){this.updateStatus("connecting"),this.error=null,this.isReady=!1,this.room&&(await this.room.disconnect(),this.room=null);try{const g=new EI({webAudioMix:!1,dynacast:!0,adaptiveStream:!0});this.room=g,this.setupRoomEventListeners(g);const I=await fetch(`${this.serviceUrl}/create-room-token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({metadata:{user_identity:e,agent_id:A,timestamp:Date.now(),is_apple_device:this.isAppleDevice}})});if(!I.ok){const Q=await I.text(),r=new Error(`Failed to get room token: ${I.status} ${Q}`);throw r.status=I.status,r}const{token:C,url:o,room_name:n,user_identity:a}=await I.json();this.roomName=n,this.userIdentity=a;const s={echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0};await Promise.all([g.localParticipant.setMicrophoneEnabled(!0,s).then(()=>{this.microphoneEnabled=!0,this.dispatchEvent(new CustomEvent("microphone-enabled")),this.attachNoiseFilter(g)}).catch(Q=>{console.warn("Could not enable microphone:",Q),this.microphoneEnabled=!1,this.dispatchEvent(new CustomEvent("microphone-disabled"))}),g.connect(o,C)]),await new Promise(Q=>{const r=setTimeout(()=>{g.off(iA.ParticipantConnected,B),Q()},2e3),B=h=>{et.isAgentIdentity(h.identity)&&(clearTimeout(r),g.off(iA.ParticipantConnected,B),Q())};for(const h of g.remoteParticipants.values())if(et.isAgentIdentity(h.identity)){clearTimeout(r),Q();return}g.on(iA.ParticipantConnected,B)}),this.updateStatus("connected"),this.isReady=!0;for(const Q of g.localParticipant.audioTrackPublications.values())(t=Q.track)!=null&&t.mediaStreamTrack&&this.dispatchEvent(new CustomEvent("local-audio-track",{detail:Q.track.mediaStreamTrack}));this.dispatchEvent(new CustomEvent("room-connected",{detail:{roomName:n,identity:a}}))}catch(g){this.error=`Connection failed: ${g instanceof Error?g.message:String(g)}`,this.updateStatus("error"),this.isReady=!1,this.room=null;const I=typeof(g==null?void 0:g.status)=="number"?g.status:null;this.dispatchEvent(new CustomEvent("error",{detail:{error:this.error,status:I}}))}}}setupRoomEventListeners(A){A.on(iA.Disconnected,()=>{this.callStatus!=="disconnected"&&this.updateStatus("disconnected"),this.connectedParticipants=[],this.microphoneEnabled=!1,this.audioPlaybackPrompt=!1,this.isReady=!1,this.noiseFilterAttached=!1,eD(),this.cleanupFadeContext(),this.unmuteTimer&&(clearTimeout(this.unmuteTimer),this.unmuteTimer=null),this.speakingHandler&&(A.localParticipant.off("isSpeakingChanged",this.speakingHandler),this.speakingHandler=null),this.room=null,this.dispatchEvent(new CustomEvent("disconnected"))}),A.on(iA.ParticipantConnected,e=>{this.connectedParticipants=[...this.connectedParticipants,e.identity];const t=et.isAgentIdentity(e.identity);t&&(this.updateStatus("agent-connected"),this.audioPlaybackPrompt=!0,this.dispatchEvent(new CustomEvent("agent-connected",{detail:{participant:e.identity}}))),this.dispatchEvent(new CustomEvent("participant-connected",{detail:{participant:e.identity,isAgent:t}}))}),A.on(iA.ParticipantDisconnected,e=>{this.connectedParticipants=this.connectedParticipants.filter(g=>g!==e.identity);const t=et.isAgentIdentity(e.identity);t&&(this.audioPlaybackPrompt=!1,this.updateStatus("connected"),this.dispatchEvent(new CustomEvent("agent-disconnected",{detail:{participant:e.identity}}))),this.dispatchEvent(new CustomEvent("participant-disconnected",{detail:{participant:e.identity,isAgent:t}}))}),A.on(iA.TrackSubscribed,(e,t,g)=>{if(e.kind==="audio"){const I=e.attach();document.body.appendChild(I);const C=t.trackName===et.BACKGROUND_AUDIO_TRACK_NAME;et.isAgentIdentity(g.identity)&&!C&&(this.agentAudioElements.push(I),this.setupAgentAudioFade(I)),this.dispatchEvent(new CustomEvent("audio-track-added",{detail:{participant:g.identity,element:I}}));const o=e.mediaStreamTrack;o&&!C&&this.dispatchEvent(new CustomEvent("audio-track",{detail:o}))}}),A.on(iA.TrackUnsubscribed,(e,t,g)=>{const I=e.detach();for(const C of I){const o=this.fadeGains.get(C);if(o){try{o.source.disconnect()}catch{}try{o.gain.disconnect()}catch{}this.fadeGains.delete(C)}}this.agentAudioElements=this.agentAudioElements.filter(C=>!I.includes(C)),this.dispatchEvent(new CustomEvent("audio-track-removed",{detail:{participant:g.identity}}))}),A.on(iA.MediaDevicesError,e=>{this.error=`Media device error: ${e.message}`,this.updateStatus("error"),this.dispatchEvent(new CustomEvent("error",{detail:{error:this.error}}))}),A.on(iA.AudioPlaybackStatusChanged,async()=>{A.canPlaybackAudio||this.connectedParticipants.some(t=>et.isAgentIdentity(t))&&!this.audioPlaybackPrompt&&(this.updateStatus("agent-connected"),this.audioPlaybackPrompt=!0),this.dispatchEvent(new CustomEvent("audio-playback-status-changed",{detail:{canPlayback:A.canPlaybackAudio}}))}),A.on(iA.DataReceived,(e,t)=>{try{const g=JSON.parse(new TextDecoder().decode(e));g.type==="transcript"?this.dispatchEvent(new CustomEvent("transcription",{detail:{speaker:g.speaker,text:g.text,timestamp:g.timestamp},bubbles:!0,composed:!0})):(!t||et.isAgentIdentity(t.identity))&&this.dispatchEvent(new CustomEvent("agent-command",{detail:g}))}catch{}}),this.speakingHandler=e=>{e?(this.unmuteTimer&&(clearTimeout(this.unmuteTimer),this.unmuteTimer=null),this.rampAgentGain(0,et.FADEOUT_TC)):this.unmuteTimer=setTimeout(()=>{this.unmuteTimer=null,this.rampAgentGain(1,et.FADEIN_TC)},et.UNMUTE_HOLDOVER_MS)},A.localParticipant.on("isSpeakingChanged",this.speakingHandler)}async toggleMicrophone(){if(this.room)try{this.microphoneEnabled?(await this.room.localParticipant.setMicrophoneEnabled(!1),this.microphoneEnabled=!1,this.noiseFilterAttached=!1,this.dispatchEvent(new CustomEvent("microphone-disabled"))):(await this.room.localParticipant.setMicrophoneEnabled(!0,{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}),this.microphoneEnabled=!0,this.dispatchEvent(new CustomEvent("microphone-enabled")),this.attachNoiseFilter(this.room))}catch(A){this.error=`Failed to toggle microphone: ${A instanceof Error?A.message:String(A)}`,this.dispatchEvent(new CustomEvent("error",{detail:{error:this.error}}))}}attachNoiseFilter(A){if(this.noiseFilterAttached)return;const e=AD();if(!e)return;const t=Array.from(A.localParticipant.audioTrackPublications.values()).find(I=>I.kind==="audio"),g=t==null?void 0:t.track;g&&g.setProcessor(e).then(()=>{this.noiseFilterAttached=!0,console.log("[NoiseFilter] ai-coustics Voice Focus attached")}).catch(I=>{Lo=!0,console.warn("[NoiseFilter] Failed to attach, keeping native NS:",I)})}setupAgentAudioFade(A){const e=(async()=>{try{if(this.fadeContext)await Qi.ensureResumed();else{const I=await Qi.acquire();if(!I){console.warn("[CallManager] Could not acquire shared AudioContext for fade");return}this.fadeContext=I,this.fadeContextAcquired=!0}const t=this.fadeContext.createMediaElementSource(A),g=this.fadeContext.createGain();t.connect(g),g.connect(this.fadeContext.destination),this.fadeGains.set(A,{source:t,gain:g})}catch(t){console.warn("[CallManager] Audio fade setup failed:",t)}})();this.fadeSetupPromise=e,e.then(()=>{this.fadeSetupPromise=null})}rampAgentGain(A,e,t=!1){const g=this.fadeContext;if(g&&g.state==="running"&&this.fadeGains.size>0)for(const{gain:I}of this.fadeGains.values())I.gain.cancelScheduledValues(g.currentTime),I.gain.setValueAtTime(I.gain.value,g.currentTime),I.gain.setTargetAtTime(A,g.currentTime,e);else if(this.fadeSetupPromise)this.fadeSetupPromise.then(()=>this.rampAgentGain(A,e));else if(!t&&g&&g.state==="suspended"&&this.fadeGains.size>0)Qi.ensureResumed().then(I=>{if(I)this.rampAgentGain(A,e,!0);else for(const C of this.agentAudioElements)C.volume=A});else for(const I of this.agentAudioElements)I.volume=A}cleanupFadeContext(){this.agentAudioElements=[];for(const{source:A,gain:e}of this.fadeGains.values()){try{A.disconnect()}catch{}try{e.disconnect()}catch{}}this.fadeGains.clear(),this.fadeSetupPromise=null,this.fadeContextAcquired&&(Qi.release(),this.fadeContextAcquired=!1),this.fadeContext=null}async enableAudio(){if(this.room)try{await this.room.startAudio(),this.audioPlaybackPrompt=!1;const A=JSON.stringify({type:"audio_enabled"}),t=new TextEncoder().encode(A);await this.room.localParticipant.publishData(t,{reliable:!0}),this.dispatchEvent(new CustomEvent("audio-enabled"))}catch(A){this.error=`Failed to enable audio: ${A instanceof Error?A.message:String(A)}`,this.dispatchEvent(new CustomEvent("error",{detail:{error:this.error}}))}}async sendDataToAgent(A){if(!this.room){console.warn("[LiveKitCallManager] Cannot send data: no room");return}const t=new TextEncoder().encode(JSON.stringify(A));await this.room.localParticipant.publishData(t,{reliable:!0})}async hangUp(){if(!this.room){this.error="No active connection to end.";return}this.updateStatus("disconnecting");const A=this.room;this.room=null,this.connectedParticipants=[],this.microphoneEnabled=!1,this.audioPlaybackPrompt=!1,this.isReady=!1,this.cleanupFadeContext(),this.unmuteTimer&&(clearTimeout(this.unmuteTimer),this.unmuteTimer=null),this.speakingHandler&&(A.localParticipant.off("isSpeakingChanged",this.speakingHandler),this.speakingHandler=null),this.updateStatus("disconnected"),this.dispatchEvent(new CustomEvent("call-ended")),A.removeAllListeners(),this.noiseFilterAttached=!1,requestAnimationFrame(()=>{setTimeout(async()=>{try{await A.disconnect()}catch(e){console.warn("Error during room disconnect:",e)}},0)})}};et.UNMUTE_HOLDOVER_MS=350,et.FADEOUT_TC=.045,et.FADEIN_TC=.03,et.BACKGROUND_AUDIO_TRACK_NAME="background_audio";let Fg=et;/**
148
148
  * @license
149
149
  * Copyright 2010-2025 Three.js Authors
150
150
  * SPDX-License-Identifier: MIT
151
- */const ds="182",tD=0,TE=1,iD=2,vo=1,gD=2,dC=3,Mi=0,It=1,Fi=2,Ui=0,dI=1,hs=2,qE=3,HE=4,ID=5,Ug=100,CD=101,oD=102,nD=103,aD=104,sD=200,QD=201,rD=202,BD=203,ls=204,xs=205,ED=206,cD=207,dD=208,hD=209,lD=210,xD=211,uD=212,fD=213,DD=214,us=0,fs=1,Ds=2,hI=3,_s=4,ps=5,ws=6,ms=7,PE=0,_D=1,pD=2,ri=0,OE=1,VE=2,jE=3,WE=4,XE=5,ZE=6,zE=7,$E=300,Lg=301,lI=302,ys=303,bs=304,Ko=306,Ns=1e3,Li=1001,ks=1002,At=1003,wD=1004,Jo=1005,et=1006,Ss=1007,vg=1008,Gt=1009,Ac=1010,ec=1011,hC=1012,Rs=1013,Bi=1014,Ei=1015,vi=1016,Gs=1017,Ms=1018,lC=1020,tc=35902,ic=35899,gc=1021,Ic=1022,jt=1023,Ki=1026,Kg=1027,Cc=1028,Fs=1029,xI=1030,Us=1031,Ls=1033,Yo=33776,To=33777,qo=33778,Ho=33779,vs=35840,Ks=35841,Js=35842,Ys=35843,Ts=36196,qs=37492,Hs=37496,Ps=37488,Os=37489,Vs=37490,js=37491,Ws=37808,Xs=37809,Zs=37810,zs=37811,$s=37812,AQ=37813,eQ=37814,tQ=37815,iQ=37816,gQ=37817,IQ=37818,CQ=37819,oQ=37820,nQ=37821,aQ=36492,sQ=36494,QQ=36495,rQ=36283,BQ=36284,EQ=36285,cQ=36286,mD=3200,yD=0,bD=1,rg="",Mt="srgb",uI="srgb-linear",Po="linear",ce="srgb",fI=7680,oc=519,ND=512,kD=513,SD=514,dQ=515,RD=516,GD=517,hQ=518,MD=519,nc=35044,ac="300 es",ci=2e3,Oo=2001;function sc(i){for(let A=i.length-1;A>=0;--A)if(i[A]>=65535)return!0;return!1}function Vo(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function FD(){const i=Vo("canvas");return i.style.display="block",i}const Qc={};function rc(...i){const A="THREE."+i.shift();console.log(A,...i)}function KA(...i){const A="THREE."+i.shift();console.warn(A,...i)}function ae(...i){const A="THREE."+i.shift();console.error(A,...i)}function xC(...i){const A=i.join(" ");A in Qc||(Qc[A]=!0,KA(...i))}function UD(i,A,e){return new Promise(function(t,g){function I(){switch(i.clientWaitSync(A,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:g();break;case i.TIMEOUT_EXPIRED:setTimeout(I,e);break;default:t()}}setTimeout(I,e)})}class DI{addEventListener(A,e){this._listeners===void 0&&(this._listeners={});const t=this._listeners;t[A]===void 0&&(t[A]=[]),t[A].indexOf(e)===-1&&t[A].push(e)}hasEventListener(A,e){const t=this._listeners;return t===void 0?!1:t[A]!==void 0&&t[A].indexOf(e)!==-1}removeEventListener(A,e){const t=this._listeners;if(t===void 0)return;const g=t[A];if(g!==void 0){const I=g.indexOf(e);I!==-1&&g.splice(I,1)}}dispatchEvent(A){const e=this._listeners;if(e===void 0)return;const t=e[A.type];if(t!==void 0){A.target=this;const g=t.slice(0);for(let I=0,C=g.length;I<C;I++)g[I].call(this,A);A.target=null}}}const tt=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],lQ=Math.PI/180,xQ=180/Math.PI;function uC(){const i=Math.random()*4294967295|0,A=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0;return(tt[i&255]+tt[i>>8&255]+tt[i>>16&255]+tt[i>>24&255]+"-"+tt[A&255]+tt[A>>8&255]+"-"+tt[A>>16&15|64]+tt[A>>24&255]+"-"+tt[e&63|128]+tt[e>>8&255]+"-"+tt[e>>16&255]+tt[e>>24&255]+tt[t&255]+tt[t>>8&255]+tt[t>>16&255]+tt[t>>24&255]).toLowerCase()}function ie(i,A,e){return Math.max(A,Math.min(e,i))}function LD(i,A){return(i%A+A)%A}function uQ(i,A,e){return(1-e)*i+e*A}function fC(i,A){switch(A.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function xt(i,A){switch(A.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}class Be{constructor(A=0,e=0){Be.prototype.isVector2=!0,this.x=A,this.y=e}get width(){return this.x}set width(A){this.x=A}get height(){return this.y}set height(A){this.y=A}set(A,e){return this.x=A,this.y=e,this}setScalar(A){return this.x=A,this.y=A,this}setX(A){return this.x=A,this}setY(A){return this.y=A,this}setComponent(A,e){switch(A){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+A)}return this}getComponent(A){switch(A){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+A)}}clone(){return new this.constructor(this.x,this.y)}copy(A){return this.x=A.x,this.y=A.y,this}add(A){return this.x+=A.x,this.y+=A.y,this}addScalar(A){return this.x+=A,this.y+=A,this}addVectors(A,e){return this.x=A.x+e.x,this.y=A.y+e.y,this}addScaledVector(A,e){return this.x+=A.x*e,this.y+=A.y*e,this}sub(A){return this.x-=A.x,this.y-=A.y,this}subScalar(A){return this.x-=A,this.y-=A,this}subVectors(A,e){return this.x=A.x-e.x,this.y=A.y-e.y,this}multiply(A){return this.x*=A.x,this.y*=A.y,this}multiplyScalar(A){return this.x*=A,this.y*=A,this}divide(A){return this.x/=A.x,this.y/=A.y,this}divideScalar(A){return this.multiplyScalar(1/A)}applyMatrix3(A){const e=this.x,t=this.y,g=A.elements;return this.x=g[0]*e+g[3]*t+g[6],this.y=g[1]*e+g[4]*t+g[7],this}min(A){return this.x=Math.min(this.x,A.x),this.y=Math.min(this.y,A.y),this}max(A){return this.x=Math.max(this.x,A.x),this.y=Math.max(this.y,A.y),this}clamp(A,e){return this.x=ie(this.x,A.x,e.x),this.y=ie(this.y,A.y,e.y),this}clampScalar(A,e){return this.x=ie(this.x,A,e),this.y=ie(this.y,A,e),this}clampLength(A,e){const t=this.length();return this.divideScalar(t||1).multiplyScalar(ie(t,A,e))}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(A){return this.x*A.x+this.y*A.y}cross(A){return this.x*A.y-this.y*A.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(A){const e=Math.sqrt(this.lengthSq()*A.lengthSq());if(e===0)return Math.PI/2;const t=this.dot(A)/e;return Math.acos(ie(t,-1,1))}distanceTo(A){return Math.sqrt(this.distanceToSquared(A))}distanceToSquared(A){const e=this.x-A.x,t=this.y-A.y;return e*e+t*t}manhattanDistanceTo(A){return Math.abs(this.x-A.x)+Math.abs(this.y-A.y)}setLength(A){return this.normalize().multiplyScalar(A)}lerp(A,e){return this.x+=(A.x-this.x)*e,this.y+=(A.y-this.y)*e,this}lerpVectors(A,e,t){return this.x=A.x+(e.x-A.x)*t,this.y=A.y+(e.y-A.y)*t,this}equals(A){return A.x===this.x&&A.y===this.y}fromArray(A,e=0){return this.x=A[e],this.y=A[e+1],this}toArray(A=[],e=0){return A[e]=this.x,A[e+1]=this.y,A}fromBufferAttribute(A,e){return this.x=A.getX(e),this.y=A.getY(e),this}rotateAround(A,e){const t=Math.cos(e),g=Math.sin(e),I=this.x-A.x,C=this.y-A.y;return this.x=I*t-C*g+A.x,this.y=I*g+C*t+A.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class DC{constructor(A=0,e=0,t=0,g=1){this.isQuaternion=!0,this._x=A,this._y=e,this._z=t,this._w=g}static slerpFlat(A,e,t,g,I,C,o){let n=t[g+0],a=t[g+1],s=t[g+2],Q=t[g+3],r=I[C+0],B=I[C+1],h=I[C+2],c=I[C+3];if(o<=0){A[e+0]=n,A[e+1]=a,A[e+2]=s,A[e+3]=Q;return}if(o>=1){A[e+0]=r,A[e+1]=B,A[e+2]=h,A[e+3]=c;return}if(Q!==c||n!==r||a!==B||s!==h){let d=n*r+a*B+s*h+Q*c;d<0&&(r=-r,B=-B,h=-h,c=-c,d=-d);let E=1-o;if(d<.9995){const u=Math.acos(d),_=Math.sin(u);E=Math.sin(E*u)/_,o=Math.sin(o*u)/_,n=n*E+r*o,a=a*E+B*o,s=s*E+h*o,Q=Q*E+c*o}else{n=n*E+r*o,a=a*E+B*o,s=s*E+h*o,Q=Q*E+c*o;const u=1/Math.sqrt(n*n+a*a+s*s+Q*Q);n*=u,a*=u,s*=u,Q*=u}}A[e]=n,A[e+1]=a,A[e+2]=s,A[e+3]=Q}static multiplyQuaternionsFlat(A,e,t,g,I,C){const o=t[g],n=t[g+1],a=t[g+2],s=t[g+3],Q=I[C],r=I[C+1],B=I[C+2],h=I[C+3];return A[e]=o*h+s*Q+n*B-a*r,A[e+1]=n*h+s*r+a*Q-o*B,A[e+2]=a*h+s*B+o*r-n*Q,A[e+3]=s*h-o*Q-n*r-a*B,A}get x(){return this._x}set x(A){this._x=A,this._onChangeCallback()}get y(){return this._y}set y(A){this._y=A,this._onChangeCallback()}get z(){return this._z}set z(A){this._z=A,this._onChangeCallback()}get w(){return this._w}set w(A){this._w=A,this._onChangeCallback()}set(A,e,t,g){return this._x=A,this._y=e,this._z=t,this._w=g,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(A){return this._x=A.x,this._y=A.y,this._z=A.z,this._w=A.w,this._onChangeCallback(),this}setFromEuler(A,e=!0){const t=A._x,g=A._y,I=A._z,C=A._order,o=Math.cos,n=Math.sin,a=o(t/2),s=o(g/2),Q=o(I/2),r=n(t/2),B=n(g/2),h=n(I/2);switch(C){case"XYZ":this._x=r*s*Q+a*B*h,this._y=a*B*Q-r*s*h,this._z=a*s*h+r*B*Q,this._w=a*s*Q-r*B*h;break;case"YXZ":this._x=r*s*Q+a*B*h,this._y=a*B*Q-r*s*h,this._z=a*s*h-r*B*Q,this._w=a*s*Q+r*B*h;break;case"ZXY":this._x=r*s*Q-a*B*h,this._y=a*B*Q+r*s*h,this._z=a*s*h+r*B*Q,this._w=a*s*Q-r*B*h;break;case"ZYX":this._x=r*s*Q-a*B*h,this._y=a*B*Q+r*s*h,this._z=a*s*h-r*B*Q,this._w=a*s*Q+r*B*h;break;case"YZX":this._x=r*s*Q+a*B*h,this._y=a*B*Q+r*s*h,this._z=a*s*h-r*B*Q,this._w=a*s*Q-r*B*h;break;case"XZY":this._x=r*s*Q-a*B*h,this._y=a*B*Q-r*s*h,this._z=a*s*h+r*B*Q,this._w=a*s*Q+r*B*h;break;default:KA("Quaternion: .setFromEuler() encountered an unknown order: "+C)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(A,e){const t=e/2,g=Math.sin(t);return this._x=A.x*g,this._y=A.y*g,this._z=A.z*g,this._w=Math.cos(t),this._onChangeCallback(),this}setFromRotationMatrix(A){const e=A.elements,t=e[0],g=e[4],I=e[8],C=e[1],o=e[5],n=e[9],a=e[2],s=e[6],Q=e[10],r=t+o+Q;if(r>0){const B=.5/Math.sqrt(r+1);this._w=.25/B,this._x=(s-n)*B,this._y=(I-a)*B,this._z=(C-g)*B}else if(t>o&&t>Q){const B=2*Math.sqrt(1+t-o-Q);this._w=(s-n)/B,this._x=.25*B,this._y=(g+C)/B,this._z=(I+a)/B}else if(o>Q){const B=2*Math.sqrt(1+o-t-Q);this._w=(I-a)/B,this._x=(g+C)/B,this._y=.25*B,this._z=(n+s)/B}else{const B=2*Math.sqrt(1+Q-t-o);this._w=(C-g)/B,this._x=(I+a)/B,this._y=(n+s)/B,this._z=.25*B}return this._onChangeCallback(),this}setFromUnitVectors(A,e){let t=A.dot(e)+1;return t<1e-8?(t=0,Math.abs(A.x)>Math.abs(A.z)?(this._x=-A.y,this._y=A.x,this._z=0,this._w=t):(this._x=0,this._y=-A.z,this._z=A.y,this._w=t)):(this._x=A.y*e.z-A.z*e.y,this._y=A.z*e.x-A.x*e.z,this._z=A.x*e.y-A.y*e.x,this._w=t),this.normalize()}angleTo(A){return 2*Math.acos(Math.abs(ie(this.dot(A),-1,1)))}rotateTowards(A,e){const t=this.angleTo(A);if(t===0)return this;const g=Math.min(1,e/t);return this.slerp(A,g),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(A){return this._x*A._x+this._y*A._y+this._z*A._z+this._w*A._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 A=this.length();return A===0?(this._x=0,this._y=0,this._z=0,this._w=1):(A=1/A,this._x=this._x*A,this._y=this._y*A,this._z=this._z*A,this._w=this._w*A),this._onChangeCallback(),this}multiply(A){return this.multiplyQuaternions(this,A)}premultiply(A){return this.multiplyQuaternions(A,this)}multiplyQuaternions(A,e){const t=A._x,g=A._y,I=A._z,C=A._w,o=e._x,n=e._y,a=e._z,s=e._w;return this._x=t*s+C*o+g*a-I*n,this._y=g*s+C*n+I*o-t*a,this._z=I*s+C*a+t*n-g*o,this._w=C*s-t*o-g*n-I*a,this._onChangeCallback(),this}slerp(A,e){if(e<=0)return this;if(e>=1)return this.copy(A);let t=A._x,g=A._y,I=A._z,C=A._w,o=this.dot(A);o<0&&(t=-t,g=-g,I=-I,C=-C,o=-o);let n=1-e;if(o<.9995){const a=Math.acos(o),s=Math.sin(a);n=Math.sin(n*a)/s,e=Math.sin(e*a)/s,this._x=this._x*n+t*e,this._y=this._y*n+g*e,this._z=this._z*n+I*e,this._w=this._w*n+C*e,this._onChangeCallback()}else this._x=this._x*n+t*e,this._y=this._y*n+g*e,this._z=this._z*n+I*e,this._w=this._w*n+C*e,this.normalize();return this}slerpQuaternions(A,e,t){return this.copy(A).slerp(e,t)}random(){const A=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),t=Math.random(),g=Math.sqrt(1-t),I=Math.sqrt(t);return this.set(g*Math.sin(A),g*Math.cos(A),I*Math.sin(e),I*Math.cos(e))}equals(A){return A._x===this._x&&A._y===this._y&&A._z===this._z&&A._w===this._w}fromArray(A,e=0){return this._x=A[e],this._y=A[e+1],this._z=A[e+2],this._w=A[e+3],this._onChangeCallback(),this}toArray(A=[],e=0){return A[e]=this._x,A[e+1]=this._y,A[e+2]=this._z,A[e+3]=this._w,A}fromBufferAttribute(A,e){return this._x=A.getX(e),this._y=A.getY(e),this._z=A.getZ(e),this._w=A.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(A){return this._onChangeCallback=A,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class J{constructor(A=0,e=0,t=0){J.prototype.isVector3=!0,this.x=A,this.y=e,this.z=t}set(A,e,t){return t===void 0&&(t=this.z),this.x=A,this.y=e,this.z=t,this}setScalar(A){return this.x=A,this.y=A,this.z=A,this}setX(A){return this.x=A,this}setY(A){return this.y=A,this}setZ(A){return this.z=A,this}setComponent(A,e){switch(A){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+A)}return this}getComponent(A){switch(A){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+A)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(A){return this.x=A.x,this.y=A.y,this.z=A.z,this}add(A){return this.x+=A.x,this.y+=A.y,this.z+=A.z,this}addScalar(A){return this.x+=A,this.y+=A,this.z+=A,this}addVectors(A,e){return this.x=A.x+e.x,this.y=A.y+e.y,this.z=A.z+e.z,this}addScaledVector(A,e){return this.x+=A.x*e,this.y+=A.y*e,this.z+=A.z*e,this}sub(A){return this.x-=A.x,this.y-=A.y,this.z-=A.z,this}subScalar(A){return this.x-=A,this.y-=A,this.z-=A,this}subVectors(A,e){return this.x=A.x-e.x,this.y=A.y-e.y,this.z=A.z-e.z,this}multiply(A){return this.x*=A.x,this.y*=A.y,this.z*=A.z,this}multiplyScalar(A){return this.x*=A,this.y*=A,this.z*=A,this}multiplyVectors(A,e){return this.x=A.x*e.x,this.y=A.y*e.y,this.z=A.z*e.z,this}applyEuler(A){return this.applyQuaternion(Bc.setFromEuler(A))}applyAxisAngle(A,e){return this.applyQuaternion(Bc.setFromAxisAngle(A,e))}applyMatrix3(A){const e=this.x,t=this.y,g=this.z,I=A.elements;return this.x=I[0]*e+I[3]*t+I[6]*g,this.y=I[1]*e+I[4]*t+I[7]*g,this.z=I[2]*e+I[5]*t+I[8]*g,this}applyNormalMatrix(A){return this.applyMatrix3(A).normalize()}applyMatrix4(A){const e=this.x,t=this.y,g=this.z,I=A.elements,C=1/(I[3]*e+I[7]*t+I[11]*g+I[15]);return this.x=(I[0]*e+I[4]*t+I[8]*g+I[12])*C,this.y=(I[1]*e+I[5]*t+I[9]*g+I[13])*C,this.z=(I[2]*e+I[6]*t+I[10]*g+I[14])*C,this}applyQuaternion(A){const e=this.x,t=this.y,g=this.z,I=A.x,C=A.y,o=A.z,n=A.w,a=2*(C*g-o*t),s=2*(o*e-I*g),Q=2*(I*t-C*e);return this.x=e+n*a+C*Q-o*s,this.y=t+n*s+o*a-I*Q,this.z=g+n*Q+I*s-C*a,this}project(A){return this.applyMatrix4(A.matrixWorldInverse).applyMatrix4(A.projectionMatrix)}unproject(A){return this.applyMatrix4(A.projectionMatrixInverse).applyMatrix4(A.matrixWorld)}transformDirection(A){const e=this.x,t=this.y,g=this.z,I=A.elements;return this.x=I[0]*e+I[4]*t+I[8]*g,this.y=I[1]*e+I[5]*t+I[9]*g,this.z=I[2]*e+I[6]*t+I[10]*g,this.normalize()}divide(A){return this.x/=A.x,this.y/=A.y,this.z/=A.z,this}divideScalar(A){return this.multiplyScalar(1/A)}min(A){return this.x=Math.min(this.x,A.x),this.y=Math.min(this.y,A.y),this.z=Math.min(this.z,A.z),this}max(A){return this.x=Math.max(this.x,A.x),this.y=Math.max(this.y,A.y),this.z=Math.max(this.z,A.z),this}clamp(A,e){return this.x=ie(this.x,A.x,e.x),this.y=ie(this.y,A.y,e.y),this.z=ie(this.z,A.z,e.z),this}clampScalar(A,e){return this.x=ie(this.x,A,e),this.y=ie(this.y,A,e),this.z=ie(this.z,A,e),this}clampLength(A,e){const t=this.length();return this.divideScalar(t||1).multiplyScalar(ie(t,A,e))}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(A){return this.x*A.x+this.y*A.y+this.z*A.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(A){return this.normalize().multiplyScalar(A)}lerp(A,e){return this.x+=(A.x-this.x)*e,this.y+=(A.y-this.y)*e,this.z+=(A.z-this.z)*e,this}lerpVectors(A,e,t){return this.x=A.x+(e.x-A.x)*t,this.y=A.y+(e.y-A.y)*t,this.z=A.z+(e.z-A.z)*t,this}cross(A){return this.crossVectors(this,A)}crossVectors(A,e){const t=A.x,g=A.y,I=A.z,C=e.x,o=e.y,n=e.z;return this.x=g*n-I*o,this.y=I*C-t*n,this.z=t*o-g*C,this}projectOnVector(A){const e=A.lengthSq();if(e===0)return this.set(0,0,0);const t=A.dot(this)/e;return this.copy(A).multiplyScalar(t)}projectOnPlane(A){return fQ.copy(this).projectOnVector(A),this.sub(fQ)}reflect(A){return this.sub(fQ.copy(A).multiplyScalar(2*this.dot(A)))}angleTo(A){const e=Math.sqrt(this.lengthSq()*A.lengthSq());if(e===0)return Math.PI/2;const t=this.dot(A)/e;return Math.acos(ie(t,-1,1))}distanceTo(A){return Math.sqrt(this.distanceToSquared(A))}distanceToSquared(A){const e=this.x-A.x,t=this.y-A.y,g=this.z-A.z;return e*e+t*t+g*g}manhattanDistanceTo(A){return Math.abs(this.x-A.x)+Math.abs(this.y-A.y)+Math.abs(this.z-A.z)}setFromSpherical(A){return this.setFromSphericalCoords(A.radius,A.phi,A.theta)}setFromSphericalCoords(A,e,t){const g=Math.sin(e)*A;return this.x=g*Math.sin(t),this.y=Math.cos(e)*A,this.z=g*Math.cos(t),this}setFromCylindrical(A){return this.setFromCylindricalCoords(A.radius,A.theta,A.y)}setFromCylindricalCoords(A,e,t){return this.x=A*Math.sin(e),this.y=t,this.z=A*Math.cos(e),this}setFromMatrixPosition(A){const e=A.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(A){const e=this.setFromMatrixColumn(A,0).length(),t=this.setFromMatrixColumn(A,1).length(),g=this.setFromMatrixColumn(A,2).length();return this.x=e,this.y=t,this.z=g,this}setFromMatrixColumn(A,e){return this.fromArray(A.elements,e*4)}setFromMatrix3Column(A,e){return this.fromArray(A.elements,e*3)}setFromEuler(A){return this.x=A._x,this.y=A._y,this.z=A._z,this}setFromColor(A){return this.x=A.r,this.y=A.g,this.z=A.b,this}equals(A){return A.x===this.x&&A.y===this.y&&A.z===this.z}fromArray(A,e=0){return this.x=A[e],this.y=A[e+1],this.z=A[e+2],this}toArray(A=[],e=0){return A[e]=this.x,A[e+1]=this.y,A[e+2]=this.z,A}fromBufferAttribute(A,e){return this.x=A.getX(e),this.y=A.getY(e),this.z=A.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const A=Math.random()*Math.PI*2,e=Math.random()*2-1,t=Math.sqrt(1-e*e);return this.x=t*Math.cos(A),this.y=e,this.z=t*Math.sin(A),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const fQ=new J,Bc=new DC;class qA{constructor(A,e,t,g,I,C,o,n,a){qA.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],A!==void 0&&this.set(A,e,t,g,I,C,o,n,a)}set(A,e,t,g,I,C,o,n,a){const s=this.elements;return s[0]=A,s[1]=g,s[2]=o,s[3]=e,s[4]=I,s[5]=n,s[6]=t,s[7]=C,s[8]=a,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(A){const e=this.elements,t=A.elements;return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],this}extractBasis(A,e,t){return A.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),t.setFromMatrix3Column(this,2),this}setFromMatrix4(A){const e=A.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(A){return this.multiplyMatrices(this,A)}premultiply(A){return this.multiplyMatrices(A,this)}multiplyMatrices(A,e){const t=A.elements,g=e.elements,I=this.elements,C=t[0],o=t[3],n=t[6],a=t[1],s=t[4],Q=t[7],r=t[2],B=t[5],h=t[8],c=g[0],d=g[3],E=g[6],u=g[1],_=g[4],x=g[7],D=g[2],w=g[5],y=g[8];return I[0]=C*c+o*u+n*D,I[3]=C*d+o*_+n*w,I[6]=C*E+o*x+n*y,I[1]=a*c+s*u+Q*D,I[4]=a*d+s*_+Q*w,I[7]=a*E+s*x+Q*y,I[2]=r*c+B*u+h*D,I[5]=r*d+B*_+h*w,I[8]=r*E+B*x+h*y,this}multiplyScalar(A){const e=this.elements;return e[0]*=A,e[3]*=A,e[6]*=A,e[1]*=A,e[4]*=A,e[7]*=A,e[2]*=A,e[5]*=A,e[8]*=A,this}determinant(){const A=this.elements,e=A[0],t=A[1],g=A[2],I=A[3],C=A[4],o=A[5],n=A[6],a=A[7],s=A[8];return e*C*s-e*o*a-t*I*s+t*o*n+g*I*a-g*C*n}invert(){const A=this.elements,e=A[0],t=A[1],g=A[2],I=A[3],C=A[4],o=A[5],n=A[6],a=A[7],s=A[8],Q=s*C-o*a,r=o*n-s*I,B=a*I-C*n,h=e*Q+t*r+g*B;if(h===0)return this.set(0,0,0,0,0,0,0,0,0);const c=1/h;return A[0]=Q*c,A[1]=(g*a-s*t)*c,A[2]=(o*t-g*C)*c,A[3]=r*c,A[4]=(s*e-g*n)*c,A[5]=(g*I-o*e)*c,A[6]=B*c,A[7]=(t*n-a*e)*c,A[8]=(C*e-t*I)*c,this}transpose(){let A;const e=this.elements;return A=e[1],e[1]=e[3],e[3]=A,A=e[2],e[2]=e[6],e[6]=A,A=e[5],e[5]=e[7],e[7]=A,this}getNormalMatrix(A){return this.setFromMatrix4(A).invert().transpose()}transposeIntoArray(A){const e=this.elements;return A[0]=e[0],A[1]=e[3],A[2]=e[6],A[3]=e[1],A[4]=e[4],A[5]=e[7],A[6]=e[2],A[7]=e[5],A[8]=e[8],this}setUvTransform(A,e,t,g,I,C,o){const n=Math.cos(I),a=Math.sin(I);return this.set(t*n,t*a,-t*(n*C+a*o)+C+A,-g*a,g*n,-g*(-a*C+n*o)+o+e,0,0,1),this}scale(A,e){return this.premultiply(DQ.makeScale(A,e)),this}rotate(A){return this.premultiply(DQ.makeRotation(-A)),this}translate(A,e){return this.premultiply(DQ.makeTranslation(A,e)),this}makeTranslation(A,e){return A.isVector2?this.set(1,0,A.x,0,1,A.y,0,0,1):this.set(1,0,A,0,1,e,0,0,1),this}makeRotation(A){const e=Math.cos(A),t=Math.sin(A);return this.set(e,-t,0,t,e,0,0,0,1),this}makeScale(A,e){return this.set(A,0,0,0,e,0,0,0,1),this}equals(A){const e=this.elements,t=A.elements;for(let g=0;g<9;g++)if(e[g]!==t[g])return!1;return!0}fromArray(A,e=0){for(let t=0;t<9;t++)this.elements[t]=A[t+e];return this}toArray(A=[],e=0){const t=this.elements;return A[e]=t[0],A[e+1]=t[1],A[e+2]=t[2],A[e+3]=t[3],A[e+4]=t[4],A[e+5]=t[5],A[e+6]=t[6],A[e+7]=t[7],A[e+8]=t[8],A}clone(){return new this.constructor().fromArray(this.elements)}}const DQ=new qA,Ec=new qA().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),cc=new qA().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function vD(){const i={enabled:!0,workingColorSpace:uI,spaces:{},convert:function(g,I,C){return this.enabled===!1||I===C||!I||!C||(this.spaces[I].transfer===ce&&(g.r=Ji(g.r),g.g=Ji(g.g),g.b=Ji(g.b)),this.spaces[I].primaries!==this.spaces[C].primaries&&(g.applyMatrix3(this.spaces[I].toXYZ),g.applyMatrix3(this.spaces[C].fromXYZ)),this.spaces[C].transfer===ce&&(g.r=_I(g.r),g.g=_I(g.g),g.b=_I(g.b))),g},workingToColorSpace:function(g,I){return this.convert(g,this.workingColorSpace,I)},colorSpaceToWorking:function(g,I){return this.convert(g,I,this.workingColorSpace)},getPrimaries:function(g){return this.spaces[g].primaries},getTransfer:function(g){return g===rg?Po:this.spaces[g].transfer},getToneMappingMode:function(g){return this.spaces[g].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(g,I=this.workingColorSpace){return g.fromArray(this.spaces[I].luminanceCoefficients)},define:function(g){Object.assign(this.spaces,g)},_getMatrix:function(g,I,C){return g.copy(this.spaces[I].toXYZ).multiply(this.spaces[C].fromXYZ)},_getDrawingBufferColorSpace:function(g){return this.spaces[g].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(g=this.workingColorSpace){return this.spaces[g].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(g,I){return xC("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(g,I)},toWorkingColorSpace:function(g,I){return xC("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),i.colorSpaceToWorking(g,I)}},A=[.64,.33,.3,.6,.15,.06],e=[.2126,.7152,.0722],t=[.3127,.329];return i.define({[uI]:{primaries:A,whitePoint:t,transfer:Po,toXYZ:Ec,fromXYZ:cc,luminanceCoefficients:e,workingColorSpaceConfig:{unpackColorSpace:Mt},outputColorSpaceConfig:{drawingBufferColorSpace:Mt}},[Mt]:{primaries:A,whitePoint:t,transfer:ce,toXYZ:Ec,fromXYZ:cc,luminanceCoefficients:e,outputColorSpaceConfig:{drawingBufferColorSpace:Mt}}}),i}const oe=vD();function Ji(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function _I(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let pI;class KD{static getDataURL(A,e="image/png"){if(/^data:/i.test(A.src)||typeof HTMLCanvasElement>"u")return A.src;let t;if(A instanceof HTMLCanvasElement)t=A;else{pI===void 0&&(pI=Vo("canvas")),pI.width=A.width,pI.height=A.height;const g=pI.getContext("2d");A instanceof ImageData?g.putImageData(A,0,0):g.drawImage(A,0,0,A.width,A.height),t=pI}return t.toDataURL(e)}static sRGBToLinear(A){if(typeof HTMLImageElement<"u"&&A instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&A instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&A instanceof ImageBitmap){const e=Vo("canvas");e.width=A.width,e.height=A.height;const t=e.getContext("2d");t.drawImage(A,0,0,A.width,A.height);const g=t.getImageData(0,0,A.width,A.height),I=g.data;for(let C=0;C<I.length;C++)I[C]=Ji(I[C]/255)*255;return t.putImageData(g,0,0),e}else if(A.data){const e=A.data.slice(0);for(let t=0;t<e.length;t++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[t]=Math.floor(Ji(e[t]/255)*255):e[t]=Ji(e[t]);return{data:e,width:A.width,height:A.height}}else return KA("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),A}}let JD=0;class _Q{constructor(A=null){this.isSource=!0,Object.defineProperty(this,"id",{value:JD++}),this.uuid=uC(),this.data=A,this.dataReady=!0,this.version=0}getSize(A){const e=this.data;return typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement?A.set(e.videoWidth,e.videoHeight,0):typeof VideoFrame<"u"&&e instanceof VideoFrame?A.set(e.displayHeight,e.displayWidth,0):e!==null?A.set(e.width,e.height,e.depth||0):A.set(0,0,0),A}set needsUpdate(A){A===!0&&this.version++}toJSON(A){const e=A===void 0||typeof A=="string";if(!e&&A.images[this.uuid]!==void 0)return A.images[this.uuid];const t={uuid:this.uuid,url:""},g=this.data;if(g!==null){let I;if(Array.isArray(g)){I=[];for(let C=0,o=g.length;C<o;C++)g[C].isDataTexture?I.push(pQ(g[C].image)):I.push(pQ(g[C]))}else I=pQ(g);t.url=I}return e||(A.images[this.uuid]=t),t}}function pQ(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?KD.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(KA("Texture: Unable to serialize Texture."),{})}let YD=0;const wQ=new J;class Ct extends DI{constructor(A=Ct.DEFAULT_IMAGE,e=Ct.DEFAULT_MAPPING,t=Li,g=Li,I=et,C=vg,o=jt,n=Gt,a=Ct.DEFAULT_ANISOTROPY,s=rg){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:YD++}),this.uuid=uC(),this.name="",this.source=new _Q(A),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=t,this.wrapT=g,this.magFilter=I,this.minFilter=C,this.anisotropy=a,this.format=o,this.internalFormat=null,this.type=n,this.offset=new Be(0,0),this.repeat=new Be(1,1),this.center=new Be(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new qA,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=s,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(A&&A.depth&&A.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(wQ).x}get height(){return this.source.getSize(wQ).y}get depth(){return this.source.getSize(wQ).z}get image(){return this.source.data}set image(A=null){this.source.data=A}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(A,e){this.updateRanges.push({start:A,count:e})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(A){return this.name=A.name,this.source=A.source,this.mipmaps=A.mipmaps.slice(0),this.mapping=A.mapping,this.channel=A.channel,this.wrapS=A.wrapS,this.wrapT=A.wrapT,this.magFilter=A.magFilter,this.minFilter=A.minFilter,this.anisotropy=A.anisotropy,this.format=A.format,this.internalFormat=A.internalFormat,this.type=A.type,this.offset.copy(A.offset),this.repeat.copy(A.repeat),this.center.copy(A.center),this.rotation=A.rotation,this.matrixAutoUpdate=A.matrixAutoUpdate,this.matrix.copy(A.matrix),this.generateMipmaps=A.generateMipmaps,this.premultiplyAlpha=A.premultiplyAlpha,this.flipY=A.flipY,this.unpackAlignment=A.unpackAlignment,this.colorSpace=A.colorSpace,this.renderTarget=A.renderTarget,this.isRenderTargetTexture=A.isRenderTargetTexture,this.isArrayTexture=A.isArrayTexture,this.userData=JSON.parse(JSON.stringify(A.userData)),this.needsUpdate=!0,this}setValues(A){for(const e in A){const t=A[e];if(t===void 0){KA(`Texture.setValues(): parameter '${e}' has value of undefined.`);continue}const g=this[e];if(g===void 0){KA(`Texture.setValues(): property '${e}' does not exist.`);continue}g&&t&&g.isVector2&&t.isVector2||g&&t&&g.isVector3&&t.isVector3||g&&t&&g.isMatrix3&&t.isMatrix3?g.copy(t):this[e]=t}}toJSON(A){const e=A===void 0||typeof A=="string";if(!e&&A.textures[this.uuid]!==void 0)return A.textures[this.uuid];const t={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(A).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(t.userData=this.userData),e||(A.textures[this.uuid]=t),t}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(A){if(this.mapping!==$E)return A;if(A.applyMatrix3(this.matrix),A.x<0||A.x>1)switch(this.wrapS){case Ns:A.x=A.x-Math.floor(A.x);break;case Li:A.x=A.x<0?0:1;break;case ks:Math.abs(Math.floor(A.x)%2)===1?A.x=Math.ceil(A.x)-A.x:A.x=A.x-Math.floor(A.x);break}if(A.y<0||A.y>1)switch(this.wrapT){case Ns:A.y=A.y-Math.floor(A.y);break;case Li:A.y=A.y<0?0:1;break;case ks:Math.abs(Math.floor(A.y)%2)===1?A.y=Math.ceil(A.y)-A.y:A.y=A.y-Math.floor(A.y);break}return this.flipY&&(A.y=1-A.y),A}set needsUpdate(A){A===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(A){A===!0&&this.pmremVersion++}}Ct.DEFAULT_IMAGE=null,Ct.DEFAULT_MAPPING=$E,Ct.DEFAULT_ANISOTROPY=1;class ve{constructor(A=0,e=0,t=0,g=1){ve.prototype.isVector4=!0,this.x=A,this.y=e,this.z=t,this.w=g}get width(){return this.z}set width(A){this.z=A}get height(){return this.w}set height(A){this.w=A}set(A,e,t,g){return this.x=A,this.y=e,this.z=t,this.w=g,this}setScalar(A){return this.x=A,this.y=A,this.z=A,this.w=A,this}setX(A){return this.x=A,this}setY(A){return this.y=A,this}setZ(A){return this.z=A,this}setW(A){return this.w=A,this}setComponent(A,e){switch(A){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+A)}return this}getComponent(A){switch(A){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: "+A)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(A){return this.x=A.x,this.y=A.y,this.z=A.z,this.w=A.w!==void 0?A.w:1,this}add(A){return this.x+=A.x,this.y+=A.y,this.z+=A.z,this.w+=A.w,this}addScalar(A){return this.x+=A,this.y+=A,this.z+=A,this.w+=A,this}addVectors(A,e){return this.x=A.x+e.x,this.y=A.y+e.y,this.z=A.z+e.z,this.w=A.w+e.w,this}addScaledVector(A,e){return this.x+=A.x*e,this.y+=A.y*e,this.z+=A.z*e,this.w+=A.w*e,this}sub(A){return this.x-=A.x,this.y-=A.y,this.z-=A.z,this.w-=A.w,this}subScalar(A){return this.x-=A,this.y-=A,this.z-=A,this.w-=A,this}subVectors(A,e){return this.x=A.x-e.x,this.y=A.y-e.y,this.z=A.z-e.z,this.w=A.w-e.w,this}multiply(A){return this.x*=A.x,this.y*=A.y,this.z*=A.z,this.w*=A.w,this}multiplyScalar(A){return this.x*=A,this.y*=A,this.z*=A,this.w*=A,this}applyMatrix4(A){const e=this.x,t=this.y,g=this.z,I=this.w,C=A.elements;return this.x=C[0]*e+C[4]*t+C[8]*g+C[12]*I,this.y=C[1]*e+C[5]*t+C[9]*g+C[13]*I,this.z=C[2]*e+C[6]*t+C[10]*g+C[14]*I,this.w=C[3]*e+C[7]*t+C[11]*g+C[15]*I,this}divide(A){return this.x/=A.x,this.y/=A.y,this.z/=A.z,this.w/=A.w,this}divideScalar(A){return this.multiplyScalar(1/A)}setAxisAngleFromQuaternion(A){this.w=2*Math.acos(A.w);const e=Math.sqrt(1-A.w*A.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=A.x/e,this.y=A.y/e,this.z=A.z/e),this}setAxisAngleFromRotationMatrix(A){let e,t,g,I;const n=A.elements,a=n[0],s=n[4],Q=n[8],r=n[1],B=n[5],h=n[9],c=n[2],d=n[6],E=n[10];if(Math.abs(s-r)<.01&&Math.abs(Q-c)<.01&&Math.abs(h-d)<.01){if(Math.abs(s+r)<.1&&Math.abs(Q+c)<.1&&Math.abs(h+d)<.1&&Math.abs(a+B+E-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const _=(a+1)/2,x=(B+1)/2,D=(E+1)/2,w=(s+r)/4,y=(Q+c)/4,S=(h+d)/4;return _>x&&_>D?_<.01?(t=0,g=.707106781,I=.707106781):(t=Math.sqrt(_),g=w/t,I=y/t):x>D?x<.01?(t=.707106781,g=0,I=.707106781):(g=Math.sqrt(x),t=w/g,I=S/g):D<.01?(t=.707106781,g=.707106781,I=0):(I=Math.sqrt(D),t=y/I,g=S/I),this.set(t,g,I,e),this}let u=Math.sqrt((d-h)*(d-h)+(Q-c)*(Q-c)+(r-s)*(r-s));return Math.abs(u)<.001&&(u=1),this.x=(d-h)/u,this.y=(Q-c)/u,this.z=(r-s)/u,this.w=Math.acos((a+B+E-1)/2),this}setFromMatrixPosition(A){const e=A.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(A){return this.x=Math.min(this.x,A.x),this.y=Math.min(this.y,A.y),this.z=Math.min(this.z,A.z),this.w=Math.min(this.w,A.w),this}max(A){return this.x=Math.max(this.x,A.x),this.y=Math.max(this.y,A.y),this.z=Math.max(this.z,A.z),this.w=Math.max(this.w,A.w),this}clamp(A,e){return this.x=ie(this.x,A.x,e.x),this.y=ie(this.y,A.y,e.y),this.z=ie(this.z,A.z,e.z),this.w=ie(this.w,A.w,e.w),this}clampScalar(A,e){return this.x=ie(this.x,A,e),this.y=ie(this.y,A,e),this.z=ie(this.z,A,e),this.w=ie(this.w,A,e),this}clampLength(A,e){const t=this.length();return this.divideScalar(t||1).multiplyScalar(ie(t,A,e))}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(A){return this.x*A.x+this.y*A.y+this.z*A.z+this.w*A.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(A){return this.normalize().multiplyScalar(A)}lerp(A,e){return this.x+=(A.x-this.x)*e,this.y+=(A.y-this.y)*e,this.z+=(A.z-this.z)*e,this.w+=(A.w-this.w)*e,this}lerpVectors(A,e,t){return this.x=A.x+(e.x-A.x)*t,this.y=A.y+(e.y-A.y)*t,this.z=A.z+(e.z-A.z)*t,this.w=A.w+(e.w-A.w)*t,this}equals(A){return A.x===this.x&&A.y===this.y&&A.z===this.z&&A.w===this.w}fromArray(A,e=0){return this.x=A[e],this.y=A[e+1],this.z=A[e+2],this.w=A[e+3],this}toArray(A=[],e=0){return A[e]=this.x,A[e+1]=this.y,A[e+2]=this.z,A[e+3]=this.w,A}fromBufferAttribute(A,e){return this.x=A.getX(e),this.y=A.getY(e),this.z=A.getZ(e),this.w=A.getW(e),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 TD extends DI{constructor(A=1,e=1,t={}){super(),t=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:et,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},t),this.isRenderTarget=!0,this.width=A,this.height=e,this.depth=t.depth,this.scissor=new ve(0,0,A,e),this.scissorTest=!1,this.viewport=new ve(0,0,A,e);const g={width:A,height:e,depth:t.depth},I=new Ct(g);this.textures=[];const C=t.count;for(let o=0;o<C;o++)this.textures[o]=I.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(t),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.resolveDepthBuffer=t.resolveDepthBuffer,this.resolveStencilBuffer=t.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=t.depthTexture,this.samples=t.samples,this.multiview=t.multiview}_setTextureOptions(A={}){const e={minFilter:et,generateMipmaps:!1,flipY:!1,internalFormat:null};A.mapping!==void 0&&(e.mapping=A.mapping),A.wrapS!==void 0&&(e.wrapS=A.wrapS),A.wrapT!==void 0&&(e.wrapT=A.wrapT),A.wrapR!==void 0&&(e.wrapR=A.wrapR),A.magFilter!==void 0&&(e.magFilter=A.magFilter),A.minFilter!==void 0&&(e.minFilter=A.minFilter),A.format!==void 0&&(e.format=A.format),A.type!==void 0&&(e.type=A.type),A.anisotropy!==void 0&&(e.anisotropy=A.anisotropy),A.colorSpace!==void 0&&(e.colorSpace=A.colorSpace),A.flipY!==void 0&&(e.flipY=A.flipY),A.generateMipmaps!==void 0&&(e.generateMipmaps=A.generateMipmaps),A.internalFormat!==void 0&&(e.internalFormat=A.internalFormat);for(let t=0;t<this.textures.length;t++)this.textures[t].setValues(e)}get texture(){return this.textures[0]}set texture(A){this.textures[0]=A}set depthTexture(A){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),A!==null&&(A.renderTarget=this),this._depthTexture=A}get depthTexture(){return this._depthTexture}setSize(A,e,t=1){if(this.width!==A||this.height!==e||this.depth!==t){this.width=A,this.height=e,this.depth=t;for(let g=0,I=this.textures.length;g<I;g++)this.textures[g].image.width=A,this.textures[g].image.height=e,this.textures[g].image.depth=t,this.textures[g].isData3DTexture!==!0&&(this.textures[g].isArrayTexture=this.textures[g].image.depth>1);this.dispose()}this.viewport.set(0,0,A,e),this.scissor.set(0,0,A,e)}clone(){return new this.constructor().copy(this)}copy(A){this.width=A.width,this.height=A.height,this.depth=A.depth,this.scissor.copy(A.scissor),this.scissorTest=A.scissorTest,this.viewport.copy(A.viewport),this.textures.length=0;for(let e=0,t=A.textures.length;e<t;e++){this.textures[e]=A.textures[e].clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;const g=Object.assign({},A.textures[e].image);this.textures[e].source=new _Q(g)}return this.depthBuffer=A.depthBuffer,this.stencilBuffer=A.stencilBuffer,this.resolveDepthBuffer=A.resolveDepthBuffer,this.resolveStencilBuffer=A.resolveStencilBuffer,A.depthTexture!==null&&(this.depthTexture=A.depthTexture.clone()),this.samples=A.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class di extends TD{constructor(A=1,e=1,t={}){super(A,e,t),this.isWebGLRenderTarget=!0}}class dc extends Ct{constructor(A=null,e=1,t=1,g=1){super(null),this.isDataArrayTexture=!0,this.image={data:A,width:e,height:t,depth:g},this.magFilter=At,this.minFilter=At,this.wrapR=Li,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(A){this.layerUpdates.add(A)}clearLayerUpdates(){this.layerUpdates.clear()}}class qD extends Ct{constructor(A=null,e=1,t=1,g=1){super(null),this.isData3DTexture=!0,this.image={data:A,width:e,height:t,depth:g},this.magFilter=At,this.minFilter=At,this.wrapR=Li,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class _C{constructor(A=new J(1/0,1/0,1/0),e=new J(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=A,this.max=e}set(A,e){return this.min.copy(A),this.max.copy(e),this}setFromArray(A){this.makeEmpty();for(let e=0,t=A.length;e<t;e+=3)this.expandByPoint(Wt.fromArray(A,e));return this}setFromBufferAttribute(A){this.makeEmpty();for(let e=0,t=A.count;e<t;e++)this.expandByPoint(Wt.fromBufferAttribute(A,e));return this}setFromPoints(A){this.makeEmpty();for(let e=0,t=A.length;e<t;e++)this.expandByPoint(A[e]);return this}setFromCenterAndSize(A,e){const t=Wt.copy(e).multiplyScalar(.5);return this.min.copy(A).sub(t),this.max.copy(A).add(t),this}setFromObject(A,e=!1){return this.makeEmpty(),this.expandByObject(A,e)}clone(){return new this.constructor().copy(this)}copy(A){return this.min.copy(A.min),this.max.copy(A.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(A){return this.isEmpty()?A.set(0,0,0):A.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(A){return this.isEmpty()?A.set(0,0,0):A.subVectors(this.max,this.min)}expandByPoint(A){return this.min.min(A),this.max.max(A),this}expandByVector(A){return this.min.sub(A),this.max.add(A),this}expandByScalar(A){return this.min.addScalar(-A),this.max.addScalar(A),this}expandByObject(A,e=!1){A.updateWorldMatrix(!1,!1);const t=A.geometry;if(t!==void 0){const I=t.getAttribute("position");if(e===!0&&I!==void 0&&A.isInstancedMesh!==!0)for(let C=0,o=I.count;C<o;C++)A.isMesh===!0?A.getVertexPosition(C,Wt):Wt.fromBufferAttribute(I,C),Wt.applyMatrix4(A.matrixWorld),this.expandByPoint(Wt);else A.boundingBox!==void 0?(A.boundingBox===null&&A.computeBoundingBox(),jo.copy(A.boundingBox)):(t.boundingBox===null&&t.computeBoundingBox(),jo.copy(t.boundingBox)),jo.applyMatrix4(A.matrixWorld),this.union(jo)}const g=A.children;for(let I=0,C=g.length;I<C;I++)this.expandByObject(g[I],e);return this}containsPoint(A){return A.x>=this.min.x&&A.x<=this.max.x&&A.y>=this.min.y&&A.y<=this.max.y&&A.z>=this.min.z&&A.z<=this.max.z}containsBox(A){return this.min.x<=A.min.x&&A.max.x<=this.max.x&&this.min.y<=A.min.y&&A.max.y<=this.max.y&&this.min.z<=A.min.z&&A.max.z<=this.max.z}getParameter(A,e){return e.set((A.x-this.min.x)/(this.max.x-this.min.x),(A.y-this.min.y)/(this.max.y-this.min.y),(A.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(A){return A.max.x>=this.min.x&&A.min.x<=this.max.x&&A.max.y>=this.min.y&&A.min.y<=this.max.y&&A.max.z>=this.min.z&&A.min.z<=this.max.z}intersectsSphere(A){return this.clampPoint(A.center,Wt),Wt.distanceToSquared(A.center)<=A.radius*A.radius}intersectsPlane(A){let e,t;return A.normal.x>0?(e=A.normal.x*this.min.x,t=A.normal.x*this.max.x):(e=A.normal.x*this.max.x,t=A.normal.x*this.min.x),A.normal.y>0?(e+=A.normal.y*this.min.y,t+=A.normal.y*this.max.y):(e+=A.normal.y*this.max.y,t+=A.normal.y*this.min.y),A.normal.z>0?(e+=A.normal.z*this.min.z,t+=A.normal.z*this.max.z):(e+=A.normal.z*this.max.z,t+=A.normal.z*this.min.z),e<=-A.constant&&t>=-A.constant}intersectsTriangle(A){if(this.isEmpty())return!1;this.getCenter(pC),Wo.subVectors(this.max,pC),wI.subVectors(A.a,pC),mI.subVectors(A.b,pC),yI.subVectors(A.c,pC),Bg.subVectors(mI,wI),Eg.subVectors(yI,mI),Jg.subVectors(wI,yI);let e=[0,-Bg.z,Bg.y,0,-Eg.z,Eg.y,0,-Jg.z,Jg.y,Bg.z,0,-Bg.x,Eg.z,0,-Eg.x,Jg.z,0,-Jg.x,-Bg.y,Bg.x,0,-Eg.y,Eg.x,0,-Jg.y,Jg.x,0];return!mQ(e,wI,mI,yI,Wo)||(e=[1,0,0,0,1,0,0,0,1],!mQ(e,wI,mI,yI,Wo))?!1:(Xo.crossVectors(Bg,Eg),e=[Xo.x,Xo.y,Xo.z],mQ(e,wI,mI,yI,Wo))}clampPoint(A,e){return e.copy(A).clamp(this.min,this.max)}distanceToPoint(A){return this.clampPoint(A,Wt).distanceTo(A)}getBoundingSphere(A){return this.isEmpty()?A.makeEmpty():(this.getCenter(A.center),A.radius=this.getSize(Wt).length()*.5),A}intersect(A){return this.min.max(A.min),this.max.min(A.max),this.isEmpty()&&this.makeEmpty(),this}union(A){return this.min.min(A.min),this.max.max(A.max),this}applyMatrix4(A){return this.isEmpty()?this:(Yi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(A),Yi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(A),Yi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(A),Yi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(A),Yi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(A),Yi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(A),Yi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(A),Yi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(A),this.setFromPoints(Yi),this)}translate(A){return this.min.add(A),this.max.add(A),this}equals(A){return A.min.equals(this.min)&&A.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(A){return this.min.fromArray(A.min),this.max.fromArray(A.max),this}}const Yi=[new J,new J,new J,new J,new J,new J,new J,new J],Wt=new J,jo=new _C,wI=new J,mI=new J,yI=new J,Bg=new J,Eg=new J,Jg=new J,pC=new J,Wo=new J,Xo=new J,Yg=new J;function mQ(i,A,e,t,g){for(let I=0,C=i.length-3;I<=C;I+=3){Yg.fromArray(i,I);const o=g.x*Math.abs(Yg.x)+g.y*Math.abs(Yg.y)+g.z*Math.abs(Yg.z),n=A.dot(Yg),a=e.dot(Yg),s=t.dot(Yg);if(Math.max(-Math.max(n,a,s),Math.min(n,a,s))>o)return!1}return!0}const HD=new _C,wC=new J,yQ=new J;class bQ{constructor(A=new J,e=-1){this.isSphere=!0,this.center=A,this.radius=e}set(A,e){return this.center.copy(A),this.radius=e,this}setFromPoints(A,e){const t=this.center;e!==void 0?t.copy(e):HD.setFromPoints(A).getCenter(t);let g=0;for(let I=0,C=A.length;I<C;I++)g=Math.max(g,t.distanceToSquared(A[I]));return this.radius=Math.sqrt(g),this}copy(A){return this.center.copy(A.center),this.radius=A.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(A){return A.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(A){return A.distanceTo(this.center)-this.radius}intersectsSphere(A){const e=this.radius+A.radius;return A.center.distanceToSquared(this.center)<=e*e}intersectsBox(A){return A.intersectsSphere(this)}intersectsPlane(A){return Math.abs(A.distanceToPoint(this.center))<=this.radius}clampPoint(A,e){const t=this.center.distanceToSquared(A);return e.copy(A),t>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(A){return this.isEmpty()?(A.makeEmpty(),A):(A.set(this.center,this.center),A.expandByScalar(this.radius),A)}applyMatrix4(A){return this.center.applyMatrix4(A),this.radius=this.radius*A.getMaxScaleOnAxis(),this}translate(A){return this.center.add(A),this}expandByPoint(A){if(this.isEmpty())return this.center.copy(A),this.radius=0,this;wC.subVectors(A,this.center);const e=wC.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),g=(t-this.radius)*.5;this.center.addScaledVector(wC,g/t),this.radius+=g}return this}union(A){return A.isEmpty()?this:this.isEmpty()?(this.copy(A),this):(this.center.equals(A.center)===!0?this.radius=Math.max(this.radius,A.radius):(yQ.subVectors(A.center,this.center).setLength(A.radius),this.expandByPoint(wC.copy(A.center).add(yQ)),this.expandByPoint(wC.copy(A.center).sub(yQ))),this)}equals(A){return A.center.equals(this.center)&&A.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(A){return this.radius=A.radius,this.center.fromArray(A.center),this}}const Ti=new J,NQ=new J,Zo=new J,cg=new J,kQ=new J,zo=new J,SQ=new J;class PD{constructor(A=new J,e=new J(0,0,-1)){this.origin=A,this.direction=e}set(A,e){return this.origin.copy(A),this.direction.copy(e),this}copy(A){return this.origin.copy(A.origin),this.direction.copy(A.direction),this}at(A,e){return e.copy(this.origin).addScaledVector(this.direction,A)}lookAt(A){return this.direction.copy(A).sub(this.origin).normalize(),this}recast(A){return this.origin.copy(this.at(A,Ti)),this}closestPointToPoint(A,e){e.subVectors(A,this.origin);const t=e.dot(this.direction);return t<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,t)}distanceToPoint(A){return Math.sqrt(this.distanceSqToPoint(A))}distanceSqToPoint(A){const e=Ti.subVectors(A,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(A):(Ti.copy(this.origin).addScaledVector(this.direction,e),Ti.distanceToSquared(A))}distanceSqToSegment(A,e,t,g){NQ.copy(A).add(e).multiplyScalar(.5),Zo.copy(e).sub(A).normalize(),cg.copy(this.origin).sub(NQ);const I=A.distanceTo(e)*.5,C=-this.direction.dot(Zo),o=cg.dot(this.direction),n=-cg.dot(Zo),a=cg.lengthSq(),s=Math.abs(1-C*C);let Q,r,B,h;if(s>0)if(Q=C*n-o,r=C*o-n,h=I*s,Q>=0)if(r>=-h)if(r<=h){const c=1/s;Q*=c,r*=c,B=Q*(Q+C*r+2*o)+r*(C*Q+r+2*n)+a}else r=I,Q=Math.max(0,-(C*r+o)),B=-Q*Q+r*(r+2*n)+a;else r=-I,Q=Math.max(0,-(C*r+o)),B=-Q*Q+r*(r+2*n)+a;else r<=-h?(Q=Math.max(0,-(-C*I+o)),r=Q>0?-I:Math.min(Math.max(-I,-n),I),B=-Q*Q+r*(r+2*n)+a):r<=h?(Q=0,r=Math.min(Math.max(-I,-n),I),B=r*(r+2*n)+a):(Q=Math.max(0,-(C*I+o)),r=Q>0?I:Math.min(Math.max(-I,-n),I),B=-Q*Q+r*(r+2*n)+a);else r=C>0?-I:I,Q=Math.max(0,-(C*r+o)),B=-Q*Q+r*(r+2*n)+a;return t&&t.copy(this.origin).addScaledVector(this.direction,Q),g&&g.copy(NQ).addScaledVector(Zo,r),B}intersectSphere(A,e){Ti.subVectors(A.center,this.origin);const t=Ti.dot(this.direction),g=Ti.dot(Ti)-t*t,I=A.radius*A.radius;if(g>I)return null;const C=Math.sqrt(I-g),o=t-C,n=t+C;return n<0?null:o<0?this.at(n,e):this.at(o,e)}intersectsSphere(A){return A.radius<0?!1:this.distanceSqToPoint(A.center)<=A.radius*A.radius}distanceToPlane(A){const e=A.normal.dot(this.direction);if(e===0)return A.distanceToPoint(this.origin)===0?0:null;const t=-(this.origin.dot(A.normal)+A.constant)/e;return t>=0?t:null}intersectPlane(A,e){const t=this.distanceToPlane(A);return t===null?null:this.at(t,e)}intersectsPlane(A){const e=A.distanceToPoint(this.origin);return e===0||A.normal.dot(this.direction)*e<0}intersectBox(A,e){let t,g,I,C,o,n;const a=1/this.direction.x,s=1/this.direction.y,Q=1/this.direction.z,r=this.origin;return a>=0?(t=(A.min.x-r.x)*a,g=(A.max.x-r.x)*a):(t=(A.max.x-r.x)*a,g=(A.min.x-r.x)*a),s>=0?(I=(A.min.y-r.y)*s,C=(A.max.y-r.y)*s):(I=(A.max.y-r.y)*s,C=(A.min.y-r.y)*s),t>C||I>g||((I>t||isNaN(t))&&(t=I),(C<g||isNaN(g))&&(g=C),Q>=0?(o=(A.min.z-r.z)*Q,n=(A.max.z-r.z)*Q):(o=(A.max.z-r.z)*Q,n=(A.min.z-r.z)*Q),t>n||o>g)||((o>t||t!==t)&&(t=o),(n<g||g!==g)&&(g=n),g<0)?null:this.at(t>=0?t:g,e)}intersectsBox(A){return this.intersectBox(A,Ti)!==null}intersectTriangle(A,e,t,g,I){kQ.subVectors(e,A),zo.subVectors(t,A),SQ.crossVectors(kQ,zo);let C=this.direction.dot(SQ),o;if(C>0){if(g)return null;o=1}else if(C<0)o=-1,C=-C;else return null;cg.subVectors(this.origin,A);const n=o*this.direction.dot(zo.crossVectors(cg,zo));if(n<0)return null;const a=o*this.direction.dot(kQ.cross(cg));if(a<0||n+a>C)return null;const s=-o*cg.dot(SQ);return s<0?null:this.at(s/C,I)}applyMatrix4(A){return this.origin.applyMatrix4(A),this.direction.transformDirection(A),this}equals(A){return A.origin.equals(this.origin)&&A.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Ye{constructor(A,e,t,g,I,C,o,n,a,s,Q,r,B,h,c,d){Ye.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],A!==void 0&&this.set(A,e,t,g,I,C,o,n,a,s,Q,r,B,h,c,d)}set(A,e,t,g,I,C,o,n,a,s,Q,r,B,h,c,d){const E=this.elements;return E[0]=A,E[4]=e,E[8]=t,E[12]=g,E[1]=I,E[5]=C,E[9]=o,E[13]=n,E[2]=a,E[6]=s,E[10]=Q,E[14]=r,E[3]=B,E[7]=h,E[11]=c,E[15]=d,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 Ye().fromArray(this.elements)}copy(A){const e=this.elements,t=A.elements;return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],this}copyPosition(A){const e=this.elements,t=A.elements;return e[12]=t[12],e[13]=t[13],e[14]=t[14],this}setFromMatrix3(A){const e=A.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(A,e,t){return this.determinant()===0?(A.set(1,0,0),e.set(0,1,0),t.set(0,0,1),this):(A.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),t.setFromMatrixColumn(this,2),this)}makeBasis(A,e,t){return this.set(A.x,e.x,t.x,0,A.y,e.y,t.y,0,A.z,e.z,t.z,0,0,0,0,1),this}extractRotation(A){if(A.determinant()===0)return this.identity();const e=this.elements,t=A.elements,g=1/bI.setFromMatrixColumn(A,0).length(),I=1/bI.setFromMatrixColumn(A,1).length(),C=1/bI.setFromMatrixColumn(A,2).length();return e[0]=t[0]*g,e[1]=t[1]*g,e[2]=t[2]*g,e[3]=0,e[4]=t[4]*I,e[5]=t[5]*I,e[6]=t[6]*I,e[7]=0,e[8]=t[8]*C,e[9]=t[9]*C,e[10]=t[10]*C,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(A){const e=this.elements,t=A.x,g=A.y,I=A.z,C=Math.cos(t),o=Math.sin(t),n=Math.cos(g),a=Math.sin(g),s=Math.cos(I),Q=Math.sin(I);if(A.order==="XYZ"){const r=C*s,B=C*Q,h=o*s,c=o*Q;e[0]=n*s,e[4]=-n*Q,e[8]=a,e[1]=B+h*a,e[5]=r-c*a,e[9]=-o*n,e[2]=c-r*a,e[6]=h+B*a,e[10]=C*n}else if(A.order==="YXZ"){const r=n*s,B=n*Q,h=a*s,c=a*Q;e[0]=r+c*o,e[4]=h*o-B,e[8]=C*a,e[1]=C*Q,e[5]=C*s,e[9]=-o,e[2]=B*o-h,e[6]=c+r*o,e[10]=C*n}else if(A.order==="ZXY"){const r=n*s,B=n*Q,h=a*s,c=a*Q;e[0]=r-c*o,e[4]=-C*Q,e[8]=h+B*o,e[1]=B+h*o,e[5]=C*s,e[9]=c-r*o,e[2]=-C*a,e[6]=o,e[10]=C*n}else if(A.order==="ZYX"){const r=C*s,B=C*Q,h=o*s,c=o*Q;e[0]=n*s,e[4]=h*a-B,e[8]=r*a+c,e[1]=n*Q,e[5]=c*a+r,e[9]=B*a-h,e[2]=-a,e[6]=o*n,e[10]=C*n}else if(A.order==="YZX"){const r=C*n,B=C*a,h=o*n,c=o*a;e[0]=n*s,e[4]=c-r*Q,e[8]=h*Q+B,e[1]=Q,e[5]=C*s,e[9]=-o*s,e[2]=-a*s,e[6]=B*Q+h,e[10]=r-c*Q}else if(A.order==="XZY"){const r=C*n,B=C*a,h=o*n,c=o*a;e[0]=n*s,e[4]=-Q,e[8]=a*s,e[1]=r*Q+c,e[5]=C*s,e[9]=B*Q-h,e[2]=h*Q-B,e[6]=o*s,e[10]=c*Q+r}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(A){return this.compose(OD,A,VD)}lookAt(A,e,t){const g=this.elements;return yt.subVectors(A,e),yt.lengthSq()===0&&(yt.z=1),yt.normalize(),dg.crossVectors(t,yt),dg.lengthSq()===0&&(Math.abs(t.z)===1?yt.x+=1e-4:yt.z+=1e-4,yt.normalize(),dg.crossVectors(t,yt)),dg.normalize(),$o.crossVectors(yt,dg),g[0]=dg.x,g[4]=$o.x,g[8]=yt.x,g[1]=dg.y,g[5]=$o.y,g[9]=yt.y,g[2]=dg.z,g[6]=$o.z,g[10]=yt.z,this}multiply(A){return this.multiplyMatrices(this,A)}premultiply(A){return this.multiplyMatrices(A,this)}multiplyMatrices(A,e){const t=A.elements,g=e.elements,I=this.elements,C=t[0],o=t[4],n=t[8],a=t[12],s=t[1],Q=t[5],r=t[9],B=t[13],h=t[2],c=t[6],d=t[10],E=t[14],u=t[3],_=t[7],x=t[11],D=t[15],w=g[0],y=g[4],S=g[8],l=g[12],p=g[1],N=g[5],U=g[9],v=g[13],P=g[2],W=g[6],H=g[10],O=g[14],z=g[3],lA=g[7],QA=g[11],uA=g[15];return I[0]=C*w+o*p+n*P+a*z,I[4]=C*y+o*N+n*W+a*lA,I[8]=C*S+o*U+n*H+a*QA,I[12]=C*l+o*v+n*O+a*uA,I[1]=s*w+Q*p+r*P+B*z,I[5]=s*y+Q*N+r*W+B*lA,I[9]=s*S+Q*U+r*H+B*QA,I[13]=s*l+Q*v+r*O+B*uA,I[2]=h*w+c*p+d*P+E*z,I[6]=h*y+c*N+d*W+E*lA,I[10]=h*S+c*U+d*H+E*QA,I[14]=h*l+c*v+d*O+E*uA,I[3]=u*w+_*p+x*P+D*z,I[7]=u*y+_*N+x*W+D*lA,I[11]=u*S+_*U+x*H+D*QA,I[15]=u*l+_*v+x*O+D*uA,this}multiplyScalar(A){const e=this.elements;return e[0]*=A,e[4]*=A,e[8]*=A,e[12]*=A,e[1]*=A,e[5]*=A,e[9]*=A,e[13]*=A,e[2]*=A,e[6]*=A,e[10]*=A,e[14]*=A,e[3]*=A,e[7]*=A,e[11]*=A,e[15]*=A,this}determinant(){const A=this.elements,e=A[0],t=A[4],g=A[8],I=A[12],C=A[1],o=A[5],n=A[9],a=A[13],s=A[2],Q=A[6],r=A[10],B=A[14],h=A[3],c=A[7],d=A[11],E=A[15],u=n*B-a*r,_=o*B-a*Q,x=o*r-n*Q,D=C*B-a*s,w=C*r-n*s,y=C*Q-o*s;return e*(c*u-d*_+E*x)-t*(h*u-d*D+E*w)+g*(h*_-c*D+E*y)-I*(h*x-c*w+d*y)}transpose(){const A=this.elements;let e;return e=A[1],A[1]=A[4],A[4]=e,e=A[2],A[2]=A[8],A[8]=e,e=A[6],A[6]=A[9],A[9]=e,e=A[3],A[3]=A[12],A[12]=e,e=A[7],A[7]=A[13],A[13]=e,e=A[11],A[11]=A[14],A[14]=e,this}setPosition(A,e,t){const g=this.elements;return A.isVector3?(g[12]=A.x,g[13]=A.y,g[14]=A.z):(g[12]=A,g[13]=e,g[14]=t),this}invert(){const A=this.elements,e=A[0],t=A[1],g=A[2],I=A[3],C=A[4],o=A[5],n=A[6],a=A[7],s=A[8],Q=A[9],r=A[10],B=A[11],h=A[12],c=A[13],d=A[14],E=A[15],u=Q*d*a-c*r*a+c*n*B-o*d*B-Q*n*E+o*r*E,_=h*r*a-s*d*a-h*n*B+C*d*B+s*n*E-C*r*E,x=s*c*a-h*Q*a+h*o*B-C*c*B-s*o*E+C*Q*E,D=h*Q*n-s*c*n-h*o*r+C*c*r+s*o*d-C*Q*d,w=e*u+t*_+g*x+I*D;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const y=1/w;return A[0]=u*y,A[1]=(c*r*I-Q*d*I-c*g*B+t*d*B+Q*g*E-t*r*E)*y,A[2]=(o*d*I-c*n*I+c*g*a-t*d*a-o*g*E+t*n*E)*y,A[3]=(Q*n*I-o*r*I-Q*g*a+t*r*a+o*g*B-t*n*B)*y,A[4]=_*y,A[5]=(s*d*I-h*r*I+h*g*B-e*d*B-s*g*E+e*r*E)*y,A[6]=(h*n*I-C*d*I-h*g*a+e*d*a+C*g*E-e*n*E)*y,A[7]=(C*r*I-s*n*I+s*g*a-e*r*a-C*g*B+e*n*B)*y,A[8]=x*y,A[9]=(h*Q*I-s*c*I-h*t*B+e*c*B+s*t*E-e*Q*E)*y,A[10]=(C*c*I-h*o*I+h*t*a-e*c*a-C*t*E+e*o*E)*y,A[11]=(s*o*I-C*Q*I-s*t*a+e*Q*a+C*t*B-e*o*B)*y,A[12]=D*y,A[13]=(s*c*g-h*Q*g+h*t*r-e*c*r-s*t*d+e*Q*d)*y,A[14]=(h*o*g-C*c*g-h*t*n+e*c*n+C*t*d-e*o*d)*y,A[15]=(C*Q*g-s*o*g+s*t*n-e*Q*n-C*t*r+e*o*r)*y,this}scale(A){const e=this.elements,t=A.x,g=A.y,I=A.z;return e[0]*=t,e[4]*=g,e[8]*=I,e[1]*=t,e[5]*=g,e[9]*=I,e[2]*=t,e[6]*=g,e[10]*=I,e[3]*=t,e[7]*=g,e[11]*=I,this}getMaxScaleOnAxis(){const A=this.elements,e=A[0]*A[0]+A[1]*A[1]+A[2]*A[2],t=A[4]*A[4]+A[5]*A[5]+A[6]*A[6],g=A[8]*A[8]+A[9]*A[9]+A[10]*A[10];return Math.sqrt(Math.max(e,t,g))}makeTranslation(A,e,t){return A.isVector3?this.set(1,0,0,A.x,0,1,0,A.y,0,0,1,A.z,0,0,0,1):this.set(1,0,0,A,0,1,0,e,0,0,1,t,0,0,0,1),this}makeRotationX(A){const e=Math.cos(A),t=Math.sin(A);return this.set(1,0,0,0,0,e,-t,0,0,t,e,0,0,0,0,1),this}makeRotationY(A){const e=Math.cos(A),t=Math.sin(A);return this.set(e,0,t,0,0,1,0,0,-t,0,e,0,0,0,0,1),this}makeRotationZ(A){const e=Math.cos(A),t=Math.sin(A);return this.set(e,-t,0,0,t,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(A,e){const t=Math.cos(e),g=Math.sin(e),I=1-t,C=A.x,o=A.y,n=A.z,a=I*C,s=I*o;return this.set(a*C+t,a*o-g*n,a*n+g*o,0,a*o+g*n,s*o+t,s*n-g*C,0,a*n-g*o,s*n+g*C,I*n*n+t,0,0,0,0,1),this}makeScale(A,e,t){return this.set(A,0,0,0,0,e,0,0,0,0,t,0,0,0,0,1),this}makeShear(A,e,t,g,I,C){return this.set(1,t,I,0,A,1,C,0,e,g,1,0,0,0,0,1),this}compose(A,e,t){const g=this.elements,I=e._x,C=e._y,o=e._z,n=e._w,a=I+I,s=C+C,Q=o+o,r=I*a,B=I*s,h=I*Q,c=C*s,d=C*Q,E=o*Q,u=n*a,_=n*s,x=n*Q,D=t.x,w=t.y,y=t.z;return g[0]=(1-(c+E))*D,g[1]=(B+x)*D,g[2]=(h-_)*D,g[3]=0,g[4]=(B-x)*w,g[5]=(1-(r+E))*w,g[6]=(d+u)*w,g[7]=0,g[8]=(h+_)*y,g[9]=(d-u)*y,g[10]=(1-(r+c))*y,g[11]=0,g[12]=A.x,g[13]=A.y,g[14]=A.z,g[15]=1,this}decompose(A,e,t){const g=this.elements;if(A.x=g[12],A.y=g[13],A.z=g[14],this.determinant()===0)return t.set(1,1,1),e.identity(),this;let I=bI.set(g[0],g[1],g[2]).length();const C=bI.set(g[4],g[5],g[6]).length(),o=bI.set(g[8],g[9],g[10]).length();this.determinant()<0&&(I=-I),Xt.copy(this);const a=1/I,s=1/C,Q=1/o;return Xt.elements[0]*=a,Xt.elements[1]*=a,Xt.elements[2]*=a,Xt.elements[4]*=s,Xt.elements[5]*=s,Xt.elements[6]*=s,Xt.elements[8]*=Q,Xt.elements[9]*=Q,Xt.elements[10]*=Q,e.setFromRotationMatrix(Xt),t.x=I,t.y=C,t.z=o,this}makePerspective(A,e,t,g,I,C,o=ci,n=!1){const a=this.elements,s=2*I/(e-A),Q=2*I/(t-g),r=(e+A)/(e-A),B=(t+g)/(t-g);let h,c;if(n)h=I/(C-I),c=C*I/(C-I);else if(o===ci)h=-(C+I)/(C-I),c=-2*C*I/(C-I);else if(o===Oo)h=-C/(C-I),c=-C*I/(C-I);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return a[0]=s,a[4]=0,a[8]=r,a[12]=0,a[1]=0,a[5]=Q,a[9]=B,a[13]=0,a[2]=0,a[6]=0,a[10]=h,a[14]=c,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(A,e,t,g,I,C,o=ci,n=!1){const a=this.elements,s=2/(e-A),Q=2/(t-g),r=-(e+A)/(e-A),B=-(t+g)/(t-g);let h,c;if(n)h=1/(C-I),c=C/(C-I);else if(o===ci)h=-2/(C-I),c=-(C+I)/(C-I);else if(o===Oo)h=-1/(C-I),c=-I/(C-I);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return a[0]=s,a[4]=0,a[8]=0,a[12]=r,a[1]=0,a[5]=Q,a[9]=0,a[13]=B,a[2]=0,a[6]=0,a[10]=h,a[14]=c,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(A){const e=this.elements,t=A.elements;for(let g=0;g<16;g++)if(e[g]!==t[g])return!1;return!0}fromArray(A,e=0){for(let t=0;t<16;t++)this.elements[t]=A[t+e];return this}toArray(A=[],e=0){const t=this.elements;return A[e]=t[0],A[e+1]=t[1],A[e+2]=t[2],A[e+3]=t[3],A[e+4]=t[4],A[e+5]=t[5],A[e+6]=t[6],A[e+7]=t[7],A[e+8]=t[8],A[e+9]=t[9],A[e+10]=t[10],A[e+11]=t[11],A[e+12]=t[12],A[e+13]=t[13],A[e+14]=t[14],A[e+15]=t[15],A}}const bI=new J,Xt=new Ye,OD=new J(0,0,0),VD=new J(1,1,1),dg=new J,$o=new J,yt=new J,hc=new Ye,lc=new DC;class qi{constructor(A=0,e=0,t=0,g=qi.DEFAULT_ORDER){this.isEuler=!0,this._x=A,this._y=e,this._z=t,this._order=g}get x(){return this._x}set x(A){this._x=A,this._onChangeCallback()}get y(){return this._y}set y(A){this._y=A,this._onChangeCallback()}get z(){return this._z}set z(A){this._z=A,this._onChangeCallback()}get order(){return this._order}set order(A){this._order=A,this._onChangeCallback()}set(A,e,t,g=this._order){return this._x=A,this._y=e,this._z=t,this._order=g,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(A){return this._x=A._x,this._y=A._y,this._z=A._z,this._order=A._order,this._onChangeCallback(),this}setFromRotationMatrix(A,e=this._order,t=!0){const g=A.elements,I=g[0],C=g[4],o=g[8],n=g[1],a=g[5],s=g[9],Q=g[2],r=g[6],B=g[10];switch(e){case"XYZ":this._y=Math.asin(ie(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-s,B),this._z=Math.atan2(-C,I)):(this._x=Math.atan2(r,a),this._z=0);break;case"YXZ":this._x=Math.asin(-ie(s,-1,1)),Math.abs(s)<.9999999?(this._y=Math.atan2(o,B),this._z=Math.atan2(n,a)):(this._y=Math.atan2(-Q,I),this._z=0);break;case"ZXY":this._x=Math.asin(ie(r,-1,1)),Math.abs(r)<.9999999?(this._y=Math.atan2(-Q,B),this._z=Math.atan2(-C,a)):(this._y=0,this._z=Math.atan2(n,I));break;case"ZYX":this._y=Math.asin(-ie(Q,-1,1)),Math.abs(Q)<.9999999?(this._x=Math.atan2(r,B),this._z=Math.atan2(n,I)):(this._x=0,this._z=Math.atan2(-C,a));break;case"YZX":this._z=Math.asin(ie(n,-1,1)),Math.abs(n)<.9999999?(this._x=Math.atan2(-s,a),this._y=Math.atan2(-Q,I)):(this._x=0,this._y=Math.atan2(o,B));break;case"XZY":this._z=Math.asin(-ie(C,-1,1)),Math.abs(C)<.9999999?(this._x=Math.atan2(r,a),this._y=Math.atan2(o,I)):(this._x=Math.atan2(-s,B),this._y=0);break;default:KA("Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,t===!0&&this._onChangeCallback(),this}setFromQuaternion(A,e,t){return hc.makeRotationFromQuaternion(A),this.setFromRotationMatrix(hc,e,t)}setFromVector3(A,e=this._order){return this.set(A.x,A.y,A.z,e)}reorder(A){return lc.setFromEuler(this),this.setFromQuaternion(lc,A)}equals(A){return A._x===this._x&&A._y===this._y&&A._z===this._z&&A._order===this._order}fromArray(A){return this._x=A[0],this._y=A[1],this._z=A[2],A[3]!==void 0&&(this._order=A[3]),this._onChangeCallback(),this}toArray(A=[],e=0){return A[e]=this._x,A[e+1]=this._y,A[e+2]=this._z,A[e+3]=this._order,A}_onChange(A){return this._onChangeCallback=A,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}qi.DEFAULT_ORDER="XYZ";class xc{constructor(){this.mask=1}set(A){this.mask=(1<<A|0)>>>0}enable(A){this.mask|=1<<A|0}enableAll(){this.mask=-1}toggle(A){this.mask^=1<<A|0}disable(A){this.mask&=~(1<<A|0)}disableAll(){this.mask=0}test(A){return(this.mask&A.mask)!==0}isEnabled(A){return(this.mask&(1<<A|0))!==0}}let jD=0;const uc=new J,NI=new DC,Hi=new Ye,An=new J,mC=new J,WD=new J,XD=new DC,fc=new J(1,0,0),Dc=new J(0,1,0),_c=new J(0,0,1),pc={type:"added"},ZD={type:"removed"},kI={type:"childadded",child:null},RQ={type:"childremoved",child:null};class bt extends DI{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:jD++}),this.uuid=uC(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=bt.DEFAULT_UP.clone();const A=new J,e=new qi,t=new DC,g=new J(1,1,1);function I(){t.setFromEuler(e,!1)}function C(){e.setFromQuaternion(t,void 0,!1)}e._onChange(I),t._onChange(C),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:A},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:t},scale:{configurable:!0,enumerable:!0,value:g},modelViewMatrix:{value:new Ye},normalMatrix:{value:new qA}}),this.matrix=new Ye,this.matrixWorld=new Ye,this.matrixAutoUpdate=bt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=bt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new xc,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(A){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(A),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(A){return this.quaternion.premultiply(A),this}setRotationFromAxisAngle(A,e){this.quaternion.setFromAxisAngle(A,e)}setRotationFromEuler(A){this.quaternion.setFromEuler(A,!0)}setRotationFromMatrix(A){this.quaternion.setFromRotationMatrix(A)}setRotationFromQuaternion(A){this.quaternion.copy(A)}rotateOnAxis(A,e){return NI.setFromAxisAngle(A,e),this.quaternion.multiply(NI),this}rotateOnWorldAxis(A,e){return NI.setFromAxisAngle(A,e),this.quaternion.premultiply(NI),this}rotateX(A){return this.rotateOnAxis(fc,A)}rotateY(A){return this.rotateOnAxis(Dc,A)}rotateZ(A){return this.rotateOnAxis(_c,A)}translateOnAxis(A,e){return uc.copy(A).applyQuaternion(this.quaternion),this.position.add(uc.multiplyScalar(e)),this}translateX(A){return this.translateOnAxis(fc,A)}translateY(A){return this.translateOnAxis(Dc,A)}translateZ(A){return this.translateOnAxis(_c,A)}localToWorld(A){return this.updateWorldMatrix(!0,!1),A.applyMatrix4(this.matrixWorld)}worldToLocal(A){return this.updateWorldMatrix(!0,!1),A.applyMatrix4(Hi.copy(this.matrixWorld).invert())}lookAt(A,e,t){A.isVector3?An.copy(A):An.set(A,e,t);const g=this.parent;this.updateWorldMatrix(!0,!1),mC.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Hi.lookAt(mC,An,this.up):Hi.lookAt(An,mC,this.up),this.quaternion.setFromRotationMatrix(Hi),g&&(Hi.extractRotation(g.matrixWorld),NI.setFromRotationMatrix(Hi),this.quaternion.premultiply(NI.invert()))}add(A){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return A===this?(ae("Object3D.add: object can't be added as a child of itself.",A),this):(A&&A.isObject3D?(A.removeFromParent(),A.parent=this,this.children.push(A),A.dispatchEvent(pc),kI.child=A,this.dispatchEvent(kI),kI.child=null):ae("Object3D.add: object not an instance of THREE.Object3D.",A),this)}remove(A){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(A);return e!==-1&&(A.parent=null,this.children.splice(e,1),A.dispatchEvent(ZD),RQ.child=A,this.dispatchEvent(RQ),RQ.child=null),this}removeFromParent(){const A=this.parent;return A!==null&&A.remove(this),this}clear(){return this.remove(...this.children)}attach(A){return this.updateWorldMatrix(!0,!1),Hi.copy(this.matrixWorld).invert(),A.parent!==null&&(A.parent.updateWorldMatrix(!0,!1),Hi.multiply(A.parent.matrixWorld)),A.applyMatrix4(Hi),A.removeFromParent(),A.parent=this,this.children.push(A),A.updateWorldMatrix(!1,!0),A.dispatchEvent(pc),kI.child=A,this.dispatchEvent(kI),kI.child=null,this}getObjectById(A){return this.getObjectByProperty("id",A)}getObjectByName(A){return this.getObjectByProperty("name",A)}getObjectByProperty(A,e){if(this[A]===e)return this;for(let t=0,g=this.children.length;t<g;t++){const C=this.children[t].getObjectByProperty(A,e);if(C!==void 0)return C}}getObjectsByProperty(A,e,t=[]){this[A]===e&&t.push(this);const g=this.children;for(let I=0,C=g.length;I<C;I++)g[I].getObjectsByProperty(A,e,t);return t}getWorldPosition(A){return this.updateWorldMatrix(!0,!1),A.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(A){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(mC,A,WD),A}getWorldScale(A){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(mC,XD,A),A}getWorldDirection(A){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return A.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(A){A(this);const e=this.children;for(let t=0,g=e.length;t<g;t++)e[t].traverse(A)}traverseVisible(A){if(this.visible===!1)return;A(this);const e=this.children;for(let t=0,g=e.length;t<g;t++)e[t].traverseVisible(A)}traverseAncestors(A){const e=this.parent;e!==null&&(A(e),e.traverseAncestors(A))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(A){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||A)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,A=!0);const e=this.children;for(let t=0,g=e.length;t<g;t++)e[t].updateMatrixWorld(A)}updateWorldMatrix(A,e){const t=this.parent;if(A===!0&&t!==null&&t.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),e===!0){const g=this.children;for(let I=0,C=g.length;I<C;I++)g[I].updateWorldMatrix(!1,!0)}}toJSON(A){const e=A===void 0||typeof A=="string",t={};e&&(A={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},t.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const g={};g.uuid=this.uuid,g.type=this.type,this.name!==""&&(g.name=this.name),this.castShadow===!0&&(g.castShadow=!0),this.receiveShadow===!0&&(g.receiveShadow=!0),this.visible===!1&&(g.visible=!1),this.frustumCulled===!1&&(g.frustumCulled=!1),this.renderOrder!==0&&(g.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(g.userData=this.userData),g.layers=this.layers.mask,g.matrix=this.matrix.toArray(),g.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(g.matrixAutoUpdate=!1),this.isInstancedMesh&&(g.type="InstancedMesh",g.count=this.count,g.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(g.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(g.type="BatchedMesh",g.perObjectFrustumCulled=this.perObjectFrustumCulled,g.sortObjects=this.sortObjects,g.drawRanges=this._drawRanges,g.reservedRanges=this._reservedRanges,g.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),g.instanceInfo=this._instanceInfo.map(o=>({...o})),g.availableInstanceIds=this._availableInstanceIds.slice(),g.availableGeometryIds=this._availableGeometryIds.slice(),g.nextIndexStart=this._nextIndexStart,g.nextVertexStart=this._nextVertexStart,g.geometryCount=this._geometryCount,g.maxInstanceCount=this._maxInstanceCount,g.maxVertexCount=this._maxVertexCount,g.maxIndexCount=this._maxIndexCount,g.geometryInitialized=this._geometryInitialized,g.matricesTexture=this._matricesTexture.toJSON(A),g.indirectTexture=this._indirectTexture.toJSON(A),this._colorsTexture!==null&&(g.colorsTexture=this._colorsTexture.toJSON(A)),this.boundingSphere!==null&&(g.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(g.boundingBox=this.boundingBox.toJSON()));function I(o,n){return o[n.uuid]===void 0&&(o[n.uuid]=n.toJSON(A)),n.uuid}if(this.isScene)this.background&&(this.background.isColor?g.background=this.background.toJSON():this.background.isTexture&&(g.background=this.background.toJSON(A).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(g.environment=this.environment.toJSON(A).uuid);else if(this.isMesh||this.isLine||this.isPoints){g.geometry=I(A.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const n=o.shapes;if(Array.isArray(n))for(let a=0,s=n.length;a<s;a++){const Q=n[a];I(A.shapes,Q)}else I(A.shapes,n)}}if(this.isSkinnedMesh&&(g.bindMode=this.bindMode,g.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(I(A.skeletons,this.skeleton),g.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let n=0,a=this.material.length;n<a;n++)o.push(I(A.materials,this.material[n]));g.material=o}else g.material=I(A.materials,this.material);if(this.children.length>0){g.children=[];for(let o=0;o<this.children.length;o++)g.children.push(this.children[o].toJSON(A).object)}if(this.animations.length>0){g.animations=[];for(let o=0;o<this.animations.length;o++){const n=this.animations[o];g.animations.push(I(A.animations,n))}}if(e){const o=C(A.geometries),n=C(A.materials),a=C(A.textures),s=C(A.images),Q=C(A.shapes),r=C(A.skeletons),B=C(A.animations),h=C(A.nodes);o.length>0&&(t.geometries=o),n.length>0&&(t.materials=n),a.length>0&&(t.textures=a),s.length>0&&(t.images=s),Q.length>0&&(t.shapes=Q),r.length>0&&(t.skeletons=r),B.length>0&&(t.animations=B),h.length>0&&(t.nodes=h)}return t.object=g,t;function C(o){const n=[];for(const a in o){const s=o[a];delete s.metadata,n.push(s)}return n}}clone(A){return new this.constructor().copy(this,A)}copy(A,e=!0){if(this.name=A.name,this.up.copy(A.up),this.position.copy(A.position),this.rotation.order=A.rotation.order,this.quaternion.copy(A.quaternion),this.scale.copy(A.scale),this.matrix.copy(A.matrix),this.matrixWorld.copy(A.matrixWorld),this.matrixAutoUpdate=A.matrixAutoUpdate,this.matrixWorldAutoUpdate=A.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=A.matrixWorldNeedsUpdate,this.layers.mask=A.layers.mask,this.visible=A.visible,this.castShadow=A.castShadow,this.receiveShadow=A.receiveShadow,this.frustumCulled=A.frustumCulled,this.renderOrder=A.renderOrder,this.animations=A.animations.slice(),this.userData=JSON.parse(JSON.stringify(A.userData)),e===!0)for(let t=0;t<A.children.length;t++){const g=A.children[t];this.add(g.clone())}return this}}bt.DEFAULT_UP=new J(0,1,0),bt.DEFAULT_MATRIX_AUTO_UPDATE=!0,bt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Zt=new J,Pi=new J,GQ=new J,Oi=new J,SI=new J,RI=new J,wc=new J,MQ=new J,FQ=new J,UQ=new J,LQ=new ve,vQ=new ve,KQ=new ve;class zt{constructor(A=new J,e=new J,t=new J){this.a=A,this.b=e,this.c=t}static getNormal(A,e,t,g){g.subVectors(t,e),Zt.subVectors(A,e),g.cross(Zt);const I=g.lengthSq();return I>0?g.multiplyScalar(1/Math.sqrt(I)):g.set(0,0,0)}static getBarycoord(A,e,t,g,I){Zt.subVectors(g,e),Pi.subVectors(t,e),GQ.subVectors(A,e);const C=Zt.dot(Zt),o=Zt.dot(Pi),n=Zt.dot(GQ),a=Pi.dot(Pi),s=Pi.dot(GQ),Q=C*a-o*o;if(Q===0)return I.set(0,0,0),null;const r=1/Q,B=(a*n-o*s)*r,h=(C*s-o*n)*r;return I.set(1-B-h,h,B)}static containsPoint(A,e,t,g){return this.getBarycoord(A,e,t,g,Oi)===null?!1:Oi.x>=0&&Oi.y>=0&&Oi.x+Oi.y<=1}static getInterpolation(A,e,t,g,I,C,o,n){return this.getBarycoord(A,e,t,g,Oi)===null?(n.x=0,n.y=0,"z"in n&&(n.z=0),"w"in n&&(n.w=0),null):(n.setScalar(0),n.addScaledVector(I,Oi.x),n.addScaledVector(C,Oi.y),n.addScaledVector(o,Oi.z),n)}static getInterpolatedAttribute(A,e,t,g,I,C){return LQ.setScalar(0),vQ.setScalar(0),KQ.setScalar(0),LQ.fromBufferAttribute(A,e),vQ.fromBufferAttribute(A,t),KQ.fromBufferAttribute(A,g),C.setScalar(0),C.addScaledVector(LQ,I.x),C.addScaledVector(vQ,I.y),C.addScaledVector(KQ,I.z),C}static isFrontFacing(A,e,t,g){return Zt.subVectors(t,e),Pi.subVectors(A,e),Zt.cross(Pi).dot(g)<0}set(A,e,t){return this.a.copy(A),this.b.copy(e),this.c.copy(t),this}setFromPointsAndIndices(A,e,t,g){return this.a.copy(A[e]),this.b.copy(A[t]),this.c.copy(A[g]),this}setFromAttributeAndIndices(A,e,t,g){return this.a.fromBufferAttribute(A,e),this.b.fromBufferAttribute(A,t),this.c.fromBufferAttribute(A,g),this}clone(){return new this.constructor().copy(this)}copy(A){return this.a.copy(A.a),this.b.copy(A.b),this.c.copy(A.c),this}getArea(){return Zt.subVectors(this.c,this.b),Pi.subVectors(this.a,this.b),Zt.cross(Pi).length()*.5}getMidpoint(A){return A.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(A){return zt.getNormal(this.a,this.b,this.c,A)}getPlane(A){return A.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(A,e){return zt.getBarycoord(A,this.a,this.b,this.c,e)}getInterpolation(A,e,t,g,I){return zt.getInterpolation(A,this.a,this.b,this.c,e,t,g,I)}containsPoint(A){return zt.containsPoint(A,this.a,this.b,this.c)}isFrontFacing(A){return zt.isFrontFacing(this.a,this.b,this.c,A)}intersectsBox(A){return A.intersectsTriangle(this)}closestPointToPoint(A,e){const t=this.a,g=this.b,I=this.c;let C,o;SI.subVectors(g,t),RI.subVectors(I,t),MQ.subVectors(A,t);const n=SI.dot(MQ),a=RI.dot(MQ);if(n<=0&&a<=0)return e.copy(t);FQ.subVectors(A,g);const s=SI.dot(FQ),Q=RI.dot(FQ);if(s>=0&&Q<=s)return e.copy(g);const r=n*Q-s*a;if(r<=0&&n>=0&&s<=0)return C=n/(n-s),e.copy(t).addScaledVector(SI,C);UQ.subVectors(A,I);const B=SI.dot(UQ),h=RI.dot(UQ);if(h>=0&&B<=h)return e.copy(I);const c=B*a-n*h;if(c<=0&&a>=0&&h<=0)return o=a/(a-h),e.copy(t).addScaledVector(RI,o);const d=s*h-B*Q;if(d<=0&&Q-s>=0&&B-h>=0)return wc.subVectors(I,g),o=(Q-s)/(Q-s+(B-h)),e.copy(g).addScaledVector(wc,o);const E=1/(d+c+r);return C=c*E,o=r*E,e.copy(t).addScaledVector(SI,C).addScaledVector(RI,o)}equals(A){return A.a.equals(this.a)&&A.b.equals(this.b)&&A.c.equals(this.c)}}const mc={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},hg={h:0,s:0,l:0},en={h:0,s:0,l:0};function JQ(i,A,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?i+(A-i)*6*e:e<1/2?A:e<2/3?i+(A-i)*6*(2/3-e):i}class Ie{constructor(A,e,t){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(A,e,t)}set(A,e,t){if(e===void 0&&t===void 0){const g=A;g&&g.isColor?this.copy(g):typeof g=="number"?this.setHex(g):typeof g=="string"&&this.setStyle(g)}else this.setRGB(A,e,t);return this}setScalar(A){return this.r=A,this.g=A,this.b=A,this}setHex(A,e=Mt){return A=Math.floor(A),this.r=(A>>16&255)/255,this.g=(A>>8&255)/255,this.b=(A&255)/255,oe.colorSpaceToWorking(this,e),this}setRGB(A,e,t,g=oe.workingColorSpace){return this.r=A,this.g=e,this.b=t,oe.colorSpaceToWorking(this,g),this}setHSL(A,e,t,g=oe.workingColorSpace){if(A=LD(A,1),e=ie(e,0,1),t=ie(t,0,1),e===0)this.r=this.g=this.b=t;else{const I=t<=.5?t*(1+e):t+e-t*e,C=2*t-I;this.r=JQ(C,I,A+1/3),this.g=JQ(C,I,A),this.b=JQ(C,I,A-1/3)}return oe.colorSpaceToWorking(this,g),this}setStyle(A,e=Mt){function t(I){I!==void 0&&parseFloat(I)<1&&KA("Color: Alpha component of "+A+" will be ignored.")}let g;if(g=/^(\w+)\(([^\)]*)\)/.exec(A)){let I;const C=g[1],o=g[2];switch(C){case"rgb":case"rgba":if(I=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return t(I[4]),this.setRGB(Math.min(255,parseInt(I[1],10))/255,Math.min(255,parseInt(I[2],10))/255,Math.min(255,parseInt(I[3],10))/255,e);if(I=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return t(I[4]),this.setRGB(Math.min(100,parseInt(I[1],10))/100,Math.min(100,parseInt(I[2],10))/100,Math.min(100,parseInt(I[3],10))/100,e);break;case"hsl":case"hsla":if(I=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return t(I[4]),this.setHSL(parseFloat(I[1])/360,parseFloat(I[2])/100,parseFloat(I[3])/100,e);break;default:KA("Color: Unknown color model "+A)}}else if(g=/^\#([A-Fa-f\d]+)$/.exec(A)){const I=g[1],C=I.length;if(C===3)return this.setRGB(parseInt(I.charAt(0),16)/15,parseInt(I.charAt(1),16)/15,parseInt(I.charAt(2),16)/15,e);if(C===6)return this.setHex(parseInt(I,16),e);KA("Color: Invalid hex color "+A)}else if(A&&A.length>0)return this.setColorName(A,e);return this}setColorName(A,e=Mt){const t=mc[A.toLowerCase()];return t!==void 0?this.setHex(t,e):KA("Color: Unknown color "+A),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(A){return this.r=A.r,this.g=A.g,this.b=A.b,this}copySRGBToLinear(A){return this.r=Ji(A.r),this.g=Ji(A.g),this.b=Ji(A.b),this}copyLinearToSRGB(A){return this.r=_I(A.r),this.g=_I(A.g),this.b=_I(A.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(A=Mt){return oe.workingToColorSpace(it.copy(this),A),Math.round(ie(it.r*255,0,255))*65536+Math.round(ie(it.g*255,0,255))*256+Math.round(ie(it.b*255,0,255))}getHexString(A=Mt){return("000000"+this.getHex(A).toString(16)).slice(-6)}getHSL(A,e=oe.workingColorSpace){oe.workingToColorSpace(it.copy(this),e);const t=it.r,g=it.g,I=it.b,C=Math.max(t,g,I),o=Math.min(t,g,I);let n,a;const s=(o+C)/2;if(o===C)n=0,a=0;else{const Q=C-o;switch(a=s<=.5?Q/(C+o):Q/(2-C-o),C){case t:n=(g-I)/Q+(g<I?6:0);break;case g:n=(I-t)/Q+2;break;case I:n=(t-g)/Q+4;break}n/=6}return A.h=n,A.s=a,A.l=s,A}getRGB(A,e=oe.workingColorSpace){return oe.workingToColorSpace(it.copy(this),e),A.r=it.r,A.g=it.g,A.b=it.b,A}getStyle(A=Mt){oe.workingToColorSpace(it.copy(this),A);const e=it.r,t=it.g,g=it.b;return A!==Mt?`color(${A} ${e.toFixed(3)} ${t.toFixed(3)} ${g.toFixed(3)})`:`rgb(${Math.round(e*255)},${Math.round(t*255)},${Math.round(g*255)})`}offsetHSL(A,e,t){return this.getHSL(hg),this.setHSL(hg.h+A,hg.s+e,hg.l+t)}add(A){return this.r+=A.r,this.g+=A.g,this.b+=A.b,this}addColors(A,e){return this.r=A.r+e.r,this.g=A.g+e.g,this.b=A.b+e.b,this}addScalar(A){return this.r+=A,this.g+=A,this.b+=A,this}sub(A){return this.r=Math.max(0,this.r-A.r),this.g=Math.max(0,this.g-A.g),this.b=Math.max(0,this.b-A.b),this}multiply(A){return this.r*=A.r,this.g*=A.g,this.b*=A.b,this}multiplyScalar(A){return this.r*=A,this.g*=A,this.b*=A,this}lerp(A,e){return this.r+=(A.r-this.r)*e,this.g+=(A.g-this.g)*e,this.b+=(A.b-this.b)*e,this}lerpColors(A,e,t){return this.r=A.r+(e.r-A.r)*t,this.g=A.g+(e.g-A.g)*t,this.b=A.b+(e.b-A.b)*t,this}lerpHSL(A,e){this.getHSL(hg),A.getHSL(en);const t=uQ(hg.h,en.h,e),g=uQ(hg.s,en.s,e),I=uQ(hg.l,en.l,e);return this.setHSL(t,g,I),this}setFromVector3(A){return this.r=A.x,this.g=A.y,this.b=A.z,this}applyMatrix3(A){const e=this.r,t=this.g,g=this.b,I=A.elements;return this.r=I[0]*e+I[3]*t+I[6]*g,this.g=I[1]*e+I[4]*t+I[7]*g,this.b=I[2]*e+I[5]*t+I[8]*g,this}equals(A){return A.r===this.r&&A.g===this.g&&A.b===this.b}fromArray(A,e=0){return this.r=A[e],this.g=A[e+1],this.b=A[e+2],this}toArray(A=[],e=0){return A[e]=this.r,A[e+1]=this.g,A[e+2]=this.b,A}fromBufferAttribute(A,e){return this.r=A.getX(e),this.g=A.getY(e),this.b=A.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const it=new Ie;Ie.NAMES=mc;let zD=0;class tn extends DI{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:zD++}),this.uuid=uC(),this.name="",this.type="Material",this.blending=dI,this.side=Mi,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=ls,this.blendDst=xs,this.blendEquation=Ug,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ie(0,0,0),this.blendAlpha=0,this.depthFunc=hI,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=oc,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=fI,this.stencilZFail=fI,this.stencilZPass=fI,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(A){this._alphaTest>0!=A>0&&this.version++,this._alphaTest=A}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(A){if(A!==void 0)for(const e in A){const t=A[e];if(t===void 0){KA(`Material: parameter '${e}' has value of undefined.`);continue}const g=this[e];if(g===void 0){KA(`Material: '${e}' is not a property of THREE.${this.type}.`);continue}g&&g.isColor?g.set(t):g&&g.isVector3&&t&&t.isVector3?g.copy(t):this[e]=t}}toJSON(A){const e=A===void 0||typeof A=="string";e&&(A={textures:{},images:{}});const t={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),this.color&&this.color.isColor&&(t.color=this.color.getHex()),this.roughness!==void 0&&(t.roughness=this.roughness),this.metalness!==void 0&&(t.metalness=this.metalness),this.sheen!==void 0&&(t.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(t.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(t.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(t.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(t.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(t.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(t.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(t.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(t.shininess=this.shininess),this.clearcoat!==void 0&&(t.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(t.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(t.clearcoatMap=this.clearcoatMap.toJSON(A).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(t.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(A).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(t.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(A).uuid,t.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(t.sheenColorMap=this.sheenColorMap.toJSON(A).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(t.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(A).uuid),this.dispersion!==void 0&&(t.dispersion=this.dispersion),this.iridescence!==void 0&&(t.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(t.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(t.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(t.iridescenceMap=this.iridescenceMap.toJSON(A).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(t.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(A).uuid),this.anisotropy!==void 0&&(t.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(t.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(t.anisotropyMap=this.anisotropyMap.toJSON(A).uuid),this.map&&this.map.isTexture&&(t.map=this.map.toJSON(A).uuid),this.matcap&&this.matcap.isTexture&&(t.matcap=this.matcap.toJSON(A).uuid),this.alphaMap&&this.alphaMap.isTexture&&(t.alphaMap=this.alphaMap.toJSON(A).uuid),this.lightMap&&this.lightMap.isTexture&&(t.lightMap=this.lightMap.toJSON(A).uuid,t.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(t.aoMap=this.aoMap.toJSON(A).uuid,t.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(t.bumpMap=this.bumpMap.toJSON(A).uuid,t.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(t.normalMap=this.normalMap.toJSON(A).uuid,t.normalMapType=this.normalMapType,t.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(t.displacementMap=this.displacementMap.toJSON(A).uuid,t.displacementScale=this.displacementScale,t.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(t.roughnessMap=this.roughnessMap.toJSON(A).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(t.metalnessMap=this.metalnessMap.toJSON(A).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(t.emissiveMap=this.emissiveMap.toJSON(A).uuid),this.specularMap&&this.specularMap.isTexture&&(t.specularMap=this.specularMap.toJSON(A).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(t.specularIntensityMap=this.specularIntensityMap.toJSON(A).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(t.specularColorMap=this.specularColorMap.toJSON(A).uuid),this.envMap&&this.envMap.isTexture&&(t.envMap=this.envMap.toJSON(A).uuid,this.combine!==void 0&&(t.combine=this.combine)),this.envMapRotation!==void 0&&(t.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(t.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(t.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(t.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(t.gradientMap=this.gradientMap.toJSON(A).uuid),this.transmission!==void 0&&(t.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(t.transmissionMap=this.transmissionMap.toJSON(A).uuid),this.thickness!==void 0&&(t.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(t.thicknessMap=this.thicknessMap.toJSON(A).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(t.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(t.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(t.size=this.size),this.shadowSide!==null&&(t.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(t.sizeAttenuation=this.sizeAttenuation),this.blending!==dI&&(t.blending=this.blending),this.side!==Mi&&(t.side=this.side),this.vertexColors===!0&&(t.vertexColors=!0),this.opacity<1&&(t.opacity=this.opacity),this.transparent===!0&&(t.transparent=!0),this.blendSrc!==ls&&(t.blendSrc=this.blendSrc),this.blendDst!==xs&&(t.blendDst=this.blendDst),this.blendEquation!==Ug&&(t.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(t.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(t.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(t.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(t.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(t.blendAlpha=this.blendAlpha),this.depthFunc!==hI&&(t.depthFunc=this.depthFunc),this.depthTest===!1&&(t.depthTest=this.depthTest),this.depthWrite===!1&&(t.depthWrite=this.depthWrite),this.colorWrite===!1&&(t.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(t.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==oc&&(t.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(t.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(t.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==fI&&(t.stencilFail=this.stencilFail),this.stencilZFail!==fI&&(t.stencilZFail=this.stencilZFail),this.stencilZPass!==fI&&(t.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(t.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(t.rotation=this.rotation),this.polygonOffset===!0&&(t.polygonOffset=!0),this.polygonOffsetFactor!==0&&(t.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(t.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(t.linewidth=this.linewidth),this.dashSize!==void 0&&(t.dashSize=this.dashSize),this.gapSize!==void 0&&(t.gapSize=this.gapSize),this.scale!==void 0&&(t.scale=this.scale),this.dithering===!0&&(t.dithering=!0),this.alphaTest>0&&(t.alphaTest=this.alphaTest),this.alphaHash===!0&&(t.alphaHash=!0),this.alphaToCoverage===!0&&(t.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(t.premultipliedAlpha=!0),this.forceSinglePass===!0&&(t.forceSinglePass=!0),this.allowOverride===!1&&(t.allowOverride=!1),this.wireframe===!0&&(t.wireframe=!0),this.wireframeLinewidth>1&&(t.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(t.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(t.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(t.flatShading=!0),this.visible===!1&&(t.visible=!1),this.toneMapped===!1&&(t.toneMapped=!1),this.fog===!1&&(t.fog=!1),Object.keys(this.userData).length>0&&(t.userData=this.userData);function g(I){const C=[];for(const o in I){const n=I[o];delete n.metadata,C.push(n)}return C}if(e){const I=g(A.textures),C=g(A.images);I.length>0&&(t.textures=I),C.length>0&&(t.images=C)}return t}clone(){return new this.constructor().copy(this)}copy(A){this.name=A.name,this.blending=A.blending,this.side=A.side,this.vertexColors=A.vertexColors,this.opacity=A.opacity,this.transparent=A.transparent,this.blendSrc=A.blendSrc,this.blendDst=A.blendDst,this.blendEquation=A.blendEquation,this.blendSrcAlpha=A.blendSrcAlpha,this.blendDstAlpha=A.blendDstAlpha,this.blendEquationAlpha=A.blendEquationAlpha,this.blendColor.copy(A.blendColor),this.blendAlpha=A.blendAlpha,this.depthFunc=A.depthFunc,this.depthTest=A.depthTest,this.depthWrite=A.depthWrite,this.stencilWriteMask=A.stencilWriteMask,this.stencilFunc=A.stencilFunc,this.stencilRef=A.stencilRef,this.stencilFuncMask=A.stencilFuncMask,this.stencilFail=A.stencilFail,this.stencilZFail=A.stencilZFail,this.stencilZPass=A.stencilZPass,this.stencilWrite=A.stencilWrite;const e=A.clippingPlanes;let t=null;if(e!==null){const g=e.length;t=new Array(g);for(let I=0;I!==g;++I)t[I]=e[I].clone()}return this.clippingPlanes=t,this.clipIntersection=A.clipIntersection,this.clipShadows=A.clipShadows,this.shadowSide=A.shadowSide,this.colorWrite=A.colorWrite,this.precision=A.precision,this.polygonOffset=A.polygonOffset,this.polygonOffsetFactor=A.polygonOffsetFactor,this.polygonOffsetUnits=A.polygonOffsetUnits,this.dithering=A.dithering,this.alphaTest=A.alphaTest,this.alphaHash=A.alphaHash,this.alphaToCoverage=A.alphaToCoverage,this.premultipliedAlpha=A.premultipliedAlpha,this.forceSinglePass=A.forceSinglePass,this.allowOverride=A.allowOverride,this.visible=A.visible,this.toneMapped=A.toneMapped,this.userData=JSON.parse(JSON.stringify(A.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(A){A===!0&&this.version++}}class yc extends tn{constructor(A){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ie(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.envMapRotation=new qi,this.combine=PE,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(A)}copy(A){return super.copy(A),this.color.copy(A.color),this.map=A.map,this.lightMap=A.lightMap,this.lightMapIntensity=A.lightMapIntensity,this.aoMap=A.aoMap,this.aoMapIntensity=A.aoMapIntensity,this.specularMap=A.specularMap,this.alphaMap=A.alphaMap,this.envMap=A.envMap,this.envMapRotation.copy(A.envMapRotation),this.combine=A.combine,this.reflectivity=A.reflectivity,this.refractionRatio=A.refractionRatio,this.wireframe=A.wireframe,this.wireframeLinewidth=A.wireframeLinewidth,this.wireframeLinecap=A.wireframeLinecap,this.wireframeLinejoin=A.wireframeLinejoin,this.fog=A.fog,this}}const Te=new J,gn=new Be;let $D=0;class hi{constructor(A,e,t=!1){if(Array.isArray(A))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:$D++}),this.name="",this.array=A,this.itemSize=e,this.count=A!==void 0?A.length/e:0,this.normalized=t,this.usage=nc,this.updateRanges=[],this.gpuType=Ei,this.version=0}onUploadCallback(){}set needsUpdate(A){A===!0&&this.version++}setUsage(A){return this.usage=A,this}addUpdateRange(A,e){this.updateRanges.push({start:A,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(A){return this.name=A.name,this.array=new A.array.constructor(A.array),this.itemSize=A.itemSize,this.count=A.count,this.normalized=A.normalized,this.usage=A.usage,this.gpuType=A.gpuType,this}copyAt(A,e,t){A*=this.itemSize,t*=e.itemSize;for(let g=0,I=this.itemSize;g<I;g++)this.array[A+g]=e.array[t+g];return this}copyArray(A){return this.array.set(A),this}applyMatrix3(A){if(this.itemSize===2)for(let e=0,t=this.count;e<t;e++)gn.fromBufferAttribute(this,e),gn.applyMatrix3(A),this.setXY(e,gn.x,gn.y);else if(this.itemSize===3)for(let e=0,t=this.count;e<t;e++)Te.fromBufferAttribute(this,e),Te.applyMatrix3(A),this.setXYZ(e,Te.x,Te.y,Te.z);return this}applyMatrix4(A){for(let e=0,t=this.count;e<t;e++)Te.fromBufferAttribute(this,e),Te.applyMatrix4(A),this.setXYZ(e,Te.x,Te.y,Te.z);return this}applyNormalMatrix(A){for(let e=0,t=this.count;e<t;e++)Te.fromBufferAttribute(this,e),Te.applyNormalMatrix(A),this.setXYZ(e,Te.x,Te.y,Te.z);return this}transformDirection(A){for(let e=0,t=this.count;e<t;e++)Te.fromBufferAttribute(this,e),Te.transformDirection(A),this.setXYZ(e,Te.x,Te.y,Te.z);return this}set(A,e=0){return this.array.set(A,e),this}getComponent(A,e){let t=this.array[A*this.itemSize+e];return this.normalized&&(t=fC(t,this.array)),t}setComponent(A,e,t){return this.normalized&&(t=xt(t,this.array)),this.array[A*this.itemSize+e]=t,this}getX(A){let e=this.array[A*this.itemSize];return this.normalized&&(e=fC(e,this.array)),e}setX(A,e){return this.normalized&&(e=xt(e,this.array)),this.array[A*this.itemSize]=e,this}getY(A){let e=this.array[A*this.itemSize+1];return this.normalized&&(e=fC(e,this.array)),e}setY(A,e){return this.normalized&&(e=xt(e,this.array)),this.array[A*this.itemSize+1]=e,this}getZ(A){let e=this.array[A*this.itemSize+2];return this.normalized&&(e=fC(e,this.array)),e}setZ(A,e){return this.normalized&&(e=xt(e,this.array)),this.array[A*this.itemSize+2]=e,this}getW(A){let e=this.array[A*this.itemSize+3];return this.normalized&&(e=fC(e,this.array)),e}setW(A,e){return this.normalized&&(e=xt(e,this.array)),this.array[A*this.itemSize+3]=e,this}setXY(A,e,t){return A*=this.itemSize,this.normalized&&(e=xt(e,this.array),t=xt(t,this.array)),this.array[A+0]=e,this.array[A+1]=t,this}setXYZ(A,e,t,g){return A*=this.itemSize,this.normalized&&(e=xt(e,this.array),t=xt(t,this.array),g=xt(g,this.array)),this.array[A+0]=e,this.array[A+1]=t,this.array[A+2]=g,this}setXYZW(A,e,t,g,I){return A*=this.itemSize,this.normalized&&(e=xt(e,this.array),t=xt(t,this.array),g=xt(g,this.array),I=xt(I,this.array)),this.array[A+0]=e,this.array[A+1]=t,this.array[A+2]=g,this.array[A+3]=I,this}onUpload(A){return this.onUploadCallback=A,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const A={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(A.name=this.name),this.usage!==nc&&(A.usage=this.usage),A}}class bc extends hi{constructor(A,e,t){super(new Uint16Array(A),e,t)}}class Nc extends hi{constructor(A,e,t){super(new Uint32Array(A),e,t)}}class ot extends hi{constructor(A,e,t){super(new Float32Array(A),e,t)}}let A2=0;const Ft=new Ye,YQ=new bt,GI=new J,Nt=new _C,yC=new _C,Xe=new J;class $t extends DI{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:A2++}),this.uuid=uC(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(A){return Array.isArray(A)?this.index=new(sc(A)?Nc:bc)(A,1):this.index=A,this}setIndirect(A,e=0){return this.indirect=A,this.indirectOffset=e,this}getIndirect(){return this.indirect}getAttribute(A){return this.attributes[A]}setAttribute(A,e){return this.attributes[A]=e,this}deleteAttribute(A){return delete this.attributes[A],this}hasAttribute(A){return this.attributes[A]!==void 0}addGroup(A,e,t=0){this.groups.push({start:A,count:e,materialIndex:t})}clearGroups(){this.groups=[]}setDrawRange(A,e){this.drawRange.start=A,this.drawRange.count=e}applyMatrix4(A){const e=this.attributes.position;e!==void 0&&(e.applyMatrix4(A),e.needsUpdate=!0);const t=this.attributes.normal;if(t!==void 0){const I=new qA().getNormalMatrix(A);t.applyNormalMatrix(I),t.needsUpdate=!0}const g=this.attributes.tangent;return g!==void 0&&(g.transformDirection(A),g.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(A){return Ft.makeRotationFromQuaternion(A),this.applyMatrix4(Ft),this}rotateX(A){return Ft.makeRotationX(A),this.applyMatrix4(Ft),this}rotateY(A){return Ft.makeRotationY(A),this.applyMatrix4(Ft),this}rotateZ(A){return Ft.makeRotationZ(A),this.applyMatrix4(Ft),this}translate(A,e,t){return Ft.makeTranslation(A,e,t),this.applyMatrix4(Ft),this}scale(A,e,t){return Ft.makeScale(A,e,t),this.applyMatrix4(Ft),this}lookAt(A){return YQ.lookAt(A),YQ.updateMatrix(),this.applyMatrix4(YQ.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(GI).negate(),this.translate(GI.x,GI.y,GI.z),this}setFromPoints(A){const e=this.getAttribute("position");if(e===void 0){const t=[];for(let g=0,I=A.length;g<I;g++){const C=A[g];t.push(C.x,C.y,C.z||0)}this.setAttribute("position",new ot(t,3))}else{const t=Math.min(A.length,e.count);for(let g=0;g<t;g++){const I=A[g];e.setXYZ(g,I.x,I.y,I.z||0)}A.length>e.count&&KA("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new _C);const A=this.attributes.position,e=this.morphAttributes.position;if(A&&A.isGLBufferAttribute){ae("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new J(-1/0,-1/0,-1/0),new J(1/0,1/0,1/0));return}if(A!==void 0){if(this.boundingBox.setFromBufferAttribute(A),e)for(let t=0,g=e.length;t<g;t++){const I=e[t];Nt.setFromBufferAttribute(I),this.morphTargetsRelative?(Xe.addVectors(this.boundingBox.min,Nt.min),this.boundingBox.expandByPoint(Xe),Xe.addVectors(this.boundingBox.max,Nt.max),this.boundingBox.expandByPoint(Xe)):(this.boundingBox.expandByPoint(Nt.min),this.boundingBox.expandByPoint(Nt.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&ae('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new bQ);const A=this.attributes.position,e=this.morphAttributes.position;if(A&&A.isGLBufferAttribute){ae("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new J,1/0);return}if(A){const t=this.boundingSphere.center;if(Nt.setFromBufferAttribute(A),e)for(let I=0,C=e.length;I<C;I++){const o=e[I];yC.setFromBufferAttribute(o),this.morphTargetsRelative?(Xe.addVectors(Nt.min,yC.min),Nt.expandByPoint(Xe),Xe.addVectors(Nt.max,yC.max),Nt.expandByPoint(Xe)):(Nt.expandByPoint(yC.min),Nt.expandByPoint(yC.max))}Nt.getCenter(t);let g=0;for(let I=0,C=A.count;I<C;I++)Xe.fromBufferAttribute(A,I),g=Math.max(g,t.distanceToSquared(Xe));if(e)for(let I=0,C=e.length;I<C;I++){const o=e[I],n=this.morphTargetsRelative;for(let a=0,s=o.count;a<s;a++)Xe.fromBufferAttribute(o,a),n&&(GI.fromBufferAttribute(A,a),Xe.add(GI)),g=Math.max(g,t.distanceToSquared(Xe))}this.boundingSphere.radius=Math.sqrt(g),isNaN(this.boundingSphere.radius)&&ae('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const A=this.index,e=this.attributes;if(A===null||e.position===void 0||e.normal===void 0||e.uv===void 0){ae("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const t=e.position,g=e.normal,I=e.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new hi(new Float32Array(4*t.count),4));const C=this.getAttribute("tangent"),o=[],n=[];for(let S=0;S<t.count;S++)o[S]=new J,n[S]=new J;const a=new J,s=new J,Q=new J,r=new Be,B=new Be,h=new Be,c=new J,d=new J;function E(S,l,p){a.fromBufferAttribute(t,S),s.fromBufferAttribute(t,l),Q.fromBufferAttribute(t,p),r.fromBufferAttribute(I,S),B.fromBufferAttribute(I,l),h.fromBufferAttribute(I,p),s.sub(a),Q.sub(a),B.sub(r),h.sub(r);const N=1/(B.x*h.y-h.x*B.y);isFinite(N)&&(c.copy(s).multiplyScalar(h.y).addScaledVector(Q,-B.y).multiplyScalar(N),d.copy(Q).multiplyScalar(B.x).addScaledVector(s,-h.x).multiplyScalar(N),o[S].add(c),o[l].add(c),o[p].add(c),n[S].add(d),n[l].add(d),n[p].add(d))}let u=this.groups;u.length===0&&(u=[{start:0,count:A.count}]);for(let S=0,l=u.length;S<l;++S){const p=u[S],N=p.start,U=p.count;for(let v=N,P=N+U;v<P;v+=3)E(A.getX(v+0),A.getX(v+1),A.getX(v+2))}const _=new J,x=new J,D=new J,w=new J;function y(S){D.fromBufferAttribute(g,S),w.copy(D);const l=o[S];_.copy(l),_.sub(D.multiplyScalar(D.dot(l))).normalize(),x.crossVectors(w,l);const N=x.dot(n[S])<0?-1:1;C.setXYZW(S,_.x,_.y,_.z,N)}for(let S=0,l=u.length;S<l;++S){const p=u[S],N=p.start,U=p.count;for(let v=N,P=N+U;v<P;v+=3)y(A.getX(v+0)),y(A.getX(v+1)),y(A.getX(v+2))}}computeVertexNormals(){const A=this.index,e=this.getAttribute("position");if(e!==void 0){let t=this.getAttribute("normal");if(t===void 0)t=new hi(new Float32Array(e.count*3),3),this.setAttribute("normal",t);else for(let r=0,B=t.count;r<B;r++)t.setXYZ(r,0,0,0);const g=new J,I=new J,C=new J,o=new J,n=new J,a=new J,s=new J,Q=new J;if(A)for(let r=0,B=A.count;r<B;r+=3){const h=A.getX(r+0),c=A.getX(r+1),d=A.getX(r+2);g.fromBufferAttribute(e,h),I.fromBufferAttribute(e,c),C.fromBufferAttribute(e,d),s.subVectors(C,I),Q.subVectors(g,I),s.cross(Q),o.fromBufferAttribute(t,h),n.fromBufferAttribute(t,c),a.fromBufferAttribute(t,d),o.add(s),n.add(s),a.add(s),t.setXYZ(h,o.x,o.y,o.z),t.setXYZ(c,n.x,n.y,n.z),t.setXYZ(d,a.x,a.y,a.z)}else for(let r=0,B=e.count;r<B;r+=3)g.fromBufferAttribute(e,r+0),I.fromBufferAttribute(e,r+1),C.fromBufferAttribute(e,r+2),s.subVectors(C,I),Q.subVectors(g,I),s.cross(Q),t.setXYZ(r+0,s.x,s.y,s.z),t.setXYZ(r+1,s.x,s.y,s.z),t.setXYZ(r+2,s.x,s.y,s.z);this.normalizeNormals(),t.needsUpdate=!0}}normalizeNormals(){const A=this.attributes.normal;for(let e=0,t=A.count;e<t;e++)Xe.fromBufferAttribute(A,e),Xe.normalize(),A.setXYZ(e,Xe.x,Xe.y,Xe.z)}toNonIndexed(){function A(o,n){const a=o.array,s=o.itemSize,Q=o.normalized,r=new a.constructor(n.length*s);let B=0,h=0;for(let c=0,d=n.length;c<d;c++){o.isInterleavedBufferAttribute?B=n[c]*o.data.stride+o.offset:B=n[c]*s;for(let E=0;E<s;E++)r[h++]=a[B++]}return new hi(r,s,Q)}if(this.index===null)return KA("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new $t,t=this.index.array,g=this.attributes;for(const o in g){const n=g[o],a=A(n,t);e.setAttribute(o,a)}const I=this.morphAttributes;for(const o in I){const n=[],a=I[o];for(let s=0,Q=a.length;s<Q;s++){const r=a[s],B=A(r,t);n.push(B)}e.morphAttributes[o]=n}e.morphTargetsRelative=this.morphTargetsRelative;const C=this.groups;for(let o=0,n=C.length;o<n;o++){const a=C[o];e.addGroup(a.start,a.count,a.materialIndex)}return e}toJSON(){const A={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(A.uuid=this.uuid,A.type=this.type,this.name!==""&&(A.name=this.name),Object.keys(this.userData).length>0&&(A.userData=this.userData),this.parameters!==void 0){const n=this.parameters;for(const a in n)n[a]!==void 0&&(A[a]=n[a]);return A}A.data={attributes:{}};const e=this.index;e!==null&&(A.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const t=this.attributes;for(const n in t){const a=t[n];A.data.attributes[n]=a.toJSON(A.data)}const g={};let I=!1;for(const n in this.morphAttributes){const a=this.morphAttributes[n],s=[];for(let Q=0,r=a.length;Q<r;Q++){const B=a[Q];s.push(B.toJSON(A.data))}s.length>0&&(g[n]=s,I=!0)}I&&(A.data.morphAttributes=g,A.data.morphTargetsRelative=this.morphTargetsRelative);const C=this.groups;C.length>0&&(A.data.groups=JSON.parse(JSON.stringify(C)));const o=this.boundingSphere;return o!==null&&(A.data.boundingSphere=o.toJSON()),A}clone(){return new this.constructor().copy(this)}copy(A){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=A.name;const t=A.index;t!==null&&this.setIndex(t.clone());const g=A.attributes;for(const a in g){const s=g[a];this.setAttribute(a,s.clone(e))}const I=A.morphAttributes;for(const a in I){const s=[],Q=I[a];for(let r=0,B=Q.length;r<B;r++)s.push(Q[r].clone(e));this.morphAttributes[a]=s}this.morphTargetsRelative=A.morphTargetsRelative;const C=A.groups;for(let a=0,s=C.length;a<s;a++){const Q=C[a];this.addGroup(Q.start,Q.count,Q.materialIndex)}const o=A.boundingBox;o!==null&&(this.boundingBox=o.clone());const n=A.boundingSphere;return n!==null&&(this.boundingSphere=n.clone()),this.drawRange.start=A.drawRange.start,this.drawRange.count=A.drawRange.count,this.userData=A.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const kc=new Ye,Tg=new PD,In=new bQ,Sc=new J,Cn=new J,on=new J,nn=new J,TQ=new J,an=new J,Rc=new J,sn=new J;class Ai extends bt{constructor(A=new $t,e=new yc){super(),this.isMesh=!0,this.type="Mesh",this.geometry=A,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(A,e){return super.copy(A,e),A.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=A.morphTargetInfluences.slice()),A.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},A.morphTargetDictionary)),this.material=Array.isArray(A.material)?A.material.slice():A.material,this.geometry=A.geometry,this}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const g=e[t[0]];if(g!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let I=0,C=g.length;I<C;I++){const o=g[I].name||String(I);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=I}}}}getVertexPosition(A,e){const t=this.geometry,g=t.attributes.position,I=t.morphAttributes.position,C=t.morphTargetsRelative;e.fromBufferAttribute(g,A);const o=this.morphTargetInfluences;if(I&&o){an.set(0,0,0);for(let n=0,a=I.length;n<a;n++){const s=o[n],Q=I[n];s!==0&&(TQ.fromBufferAttribute(Q,A),C?an.addScaledVector(TQ,s):an.addScaledVector(TQ.sub(e),s))}e.add(an)}return e}raycast(A,e){const t=this.geometry,g=this.material,I=this.matrixWorld;g!==void 0&&(t.boundingSphere===null&&t.computeBoundingSphere(),In.copy(t.boundingSphere),In.applyMatrix4(I),Tg.copy(A.ray).recast(A.near),!(In.containsPoint(Tg.origin)===!1&&(Tg.intersectSphere(In,Sc)===null||Tg.origin.distanceToSquared(Sc)>(A.far-A.near)**2))&&(kc.copy(I).invert(),Tg.copy(A.ray).applyMatrix4(kc),!(t.boundingBox!==null&&Tg.intersectsBox(t.boundingBox)===!1)&&this._computeIntersections(A,e,Tg)))}_computeIntersections(A,e,t){let g;const I=this.geometry,C=this.material,o=I.index,n=I.attributes.position,a=I.attributes.uv,s=I.attributes.uv1,Q=I.attributes.normal,r=I.groups,B=I.drawRange;if(o!==null)if(Array.isArray(C))for(let h=0,c=r.length;h<c;h++){const d=r[h],E=C[d.materialIndex],u=Math.max(d.start,B.start),_=Math.min(o.count,Math.min(d.start+d.count,B.start+B.count));for(let x=u,D=_;x<D;x+=3){const w=o.getX(x),y=o.getX(x+1),S=o.getX(x+2);g=Qn(this,E,A,t,a,s,Q,w,y,S),g&&(g.faceIndex=Math.floor(x/3),g.face.materialIndex=d.materialIndex,e.push(g))}}else{const h=Math.max(0,B.start),c=Math.min(o.count,B.start+B.count);for(let d=h,E=c;d<E;d+=3){const u=o.getX(d),_=o.getX(d+1),x=o.getX(d+2);g=Qn(this,C,A,t,a,s,Q,u,_,x),g&&(g.faceIndex=Math.floor(d/3),e.push(g))}}else if(n!==void 0)if(Array.isArray(C))for(let h=0,c=r.length;h<c;h++){const d=r[h],E=C[d.materialIndex],u=Math.max(d.start,B.start),_=Math.min(n.count,Math.min(d.start+d.count,B.start+B.count));for(let x=u,D=_;x<D;x+=3){const w=x,y=x+1,S=x+2;g=Qn(this,E,A,t,a,s,Q,w,y,S),g&&(g.faceIndex=Math.floor(x/3),g.face.materialIndex=d.materialIndex,e.push(g))}}else{const h=Math.max(0,B.start),c=Math.min(n.count,B.start+B.count);for(let d=h,E=c;d<E;d+=3){const u=d,_=d+1,x=d+2;g=Qn(this,C,A,t,a,s,Q,u,_,x),g&&(g.faceIndex=Math.floor(d/3),e.push(g))}}}}function e2(i,A,e,t,g,I,C,o){let n;if(A.side===It?n=t.intersectTriangle(C,I,g,!0,o):n=t.intersectTriangle(g,I,C,A.side===Mi,o),n===null)return null;sn.copy(o),sn.applyMatrix4(i.matrixWorld);const a=e.ray.origin.distanceTo(sn);return a<e.near||a>e.far?null:{distance:a,point:sn.clone(),object:i}}function Qn(i,A,e,t,g,I,C,o,n,a){i.getVertexPosition(o,Cn),i.getVertexPosition(n,on),i.getVertexPosition(a,nn);const s=e2(i,A,e,t,Cn,on,nn,Rc);if(s){const Q=new J;zt.getBarycoord(Rc,Cn,on,nn,Q),g&&(s.uv=zt.getInterpolatedAttribute(g,o,n,a,Q,new Be)),I&&(s.uv1=zt.getInterpolatedAttribute(I,o,n,a,Q,new Be)),C&&(s.normal=zt.getInterpolatedAttribute(C,o,n,a,Q,new J),s.normal.dot(t.direction)>0&&s.normal.multiplyScalar(-1));const r={a:o,b:n,c:a,normal:new J,materialIndex:0};zt.getNormal(Cn,on,nn,r.normal),s.face=r,s.barycoord=Q}return s}class bC extends $t{constructor(A=1,e=1,t=1,g=1,I=1,C=1){super(),this.type="BoxGeometry",this.parameters={width:A,height:e,depth:t,widthSegments:g,heightSegments:I,depthSegments:C};const o=this;g=Math.floor(g),I=Math.floor(I),C=Math.floor(C);const n=[],a=[],s=[],Q=[];let r=0,B=0;h("z","y","x",-1,-1,t,e,A,C,I,0),h("z","y","x",1,-1,t,e,-A,C,I,1),h("x","z","y",1,1,A,t,e,g,C,2),h("x","z","y",1,-1,A,t,-e,g,C,3),h("x","y","z",1,-1,A,e,t,g,I,4),h("x","y","z",-1,-1,A,e,-t,g,I,5),this.setIndex(n),this.setAttribute("position",new ot(a,3)),this.setAttribute("normal",new ot(s,3)),this.setAttribute("uv",new ot(Q,2));function h(c,d,E,u,_,x,D,w,y,S,l){const p=x/y,N=D/S,U=x/2,v=D/2,P=w/2,W=y+1,H=S+1;let O=0,z=0;const lA=new J;for(let QA=0;QA<H;QA++){const uA=QA*N-v;for(let TA=0;TA<W;TA++){const YA=TA*p-U;lA[c]=YA*u,lA[d]=uA*_,lA[E]=P,a.push(lA.x,lA.y,lA.z),lA[c]=0,lA[d]=0,lA[E]=w>0?1:-1,s.push(lA.x,lA.y,lA.z),Q.push(TA/y),Q.push(1-QA/S),O+=1}}for(let QA=0;QA<S;QA++)for(let uA=0;uA<y;uA++){const TA=r+uA+W*QA,YA=r+uA+W*(QA+1),Ne=r+(uA+1)+W*(QA+1),ue=r+(uA+1)+W*QA;n.push(TA,YA,ue),n.push(YA,Ne,ue),z+=6}o.addGroup(B,z,l),B+=z,r+=O}}copy(A){return super.copy(A),this.parameters=Object.assign({},A.parameters),this}static fromJSON(A){return new bC(A.width,A.height,A.depth,A.widthSegments,A.heightSegments,A.depthSegments)}}function MI(i){const A={};for(const e in i){A[e]={};for(const t in i[e]){const g=i[e][t];g&&(g.isColor||g.isMatrix3||g.isMatrix4||g.isVector2||g.isVector3||g.isVector4||g.isTexture||g.isQuaternion)?g.isRenderTargetTexture?(KA("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),A[e][t]=null):A[e][t]=g.clone():Array.isArray(g)?A[e][t]=g.slice():A[e][t]=g}}return A}function nt(i){const A={};for(let e=0;e<i.length;e++){const t=MI(i[e]);for(const g in t)A[g]=t[g]}return A}function t2(i){const A=[];for(let e=0;e<i.length;e++)A.push(i[e].clone());return A}function Gc(i){const A=i.getRenderTarget();return A===null?i.outputColorSpace:A.isXRRenderTarget===!0?A.texture.colorSpace:oe.workingColorSpace}const i2={clone:MI,merge:nt};var g2=`void main() {
151
+ */const ds="182",tD=0,TE=1,iD=2,vo=1,gD=2,dC=3,Mi=0,Ct=1,Fi=2,Ui=0,dI=1,hs=2,qE=3,HE=4,ID=5,Ug=100,CD=101,oD=102,nD=103,aD=104,sD=200,QD=201,rD=202,BD=203,ls=204,xs=205,ED=206,cD=207,dD=208,hD=209,lD=210,xD=211,uD=212,fD=213,DD=214,us=0,fs=1,Ds=2,hI=3,_s=4,ps=5,ws=6,ms=7,PE=0,_D=1,pD=2,ri=0,OE=1,VE=2,jE=3,WE=4,XE=5,ZE=6,zE=7,$E=300,Lg=301,lI=302,ys=303,bs=304,Ko=306,Ns=1e3,Li=1001,ks=1002,At=1003,wD=1004,Jo=1005,tt=1006,Ss=1007,vg=1008,Gt=1009,Ac=1010,ec=1011,hC=1012,Rs=1013,Bi=1014,Ei=1015,vi=1016,Gs=1017,Ms=1018,lC=1020,tc=35902,ic=35899,gc=1021,Ic=1022,jt=1023,Ki=1026,Kg=1027,Cc=1028,Fs=1029,xI=1030,Us=1031,Ls=1033,Yo=33776,To=33777,qo=33778,Ho=33779,vs=35840,Ks=35841,Js=35842,Ys=35843,Ts=36196,qs=37492,Hs=37496,Ps=37488,Os=37489,Vs=37490,js=37491,Ws=37808,Xs=37809,Zs=37810,zs=37811,$s=37812,AQ=37813,eQ=37814,tQ=37815,iQ=37816,gQ=37817,IQ=37818,CQ=37819,oQ=37820,nQ=37821,aQ=36492,sQ=36494,QQ=36495,rQ=36283,BQ=36284,EQ=36285,cQ=36286,mD=3200,yD=0,bD=1,rg="",Mt="srgb",uI="srgb-linear",Po="linear",ce="srgb",fI=7680,oc=519,ND=512,kD=513,SD=514,dQ=515,RD=516,GD=517,hQ=518,MD=519,nc=35044,ac="300 es",ci=2e3,Oo=2001;function sc(i){for(let A=i.length-1;A>=0;--A)if(i[A]>=65535)return!0;return!1}function Vo(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function FD(){const i=Vo("canvas");return i.style.display="block",i}const Qc={};function rc(...i){const A="THREE."+i.shift();console.log(A,...i)}function KA(...i){const A="THREE."+i.shift();console.warn(A,...i)}function ae(...i){const A="THREE."+i.shift();console.error(A,...i)}function xC(...i){const A=i.join(" ");A in Qc||(Qc[A]=!0,KA(...i))}function UD(i,A,e){return new Promise(function(t,g){function I(){switch(i.clientWaitSync(A,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:g();break;case i.TIMEOUT_EXPIRED:setTimeout(I,e);break;default:t()}}setTimeout(I,e)})}class DI{addEventListener(A,e){this._listeners===void 0&&(this._listeners={});const t=this._listeners;t[A]===void 0&&(t[A]=[]),t[A].indexOf(e)===-1&&t[A].push(e)}hasEventListener(A,e){const t=this._listeners;return t===void 0?!1:t[A]!==void 0&&t[A].indexOf(e)!==-1}removeEventListener(A,e){const t=this._listeners;if(t===void 0)return;const g=t[A];if(g!==void 0){const I=g.indexOf(e);I!==-1&&g.splice(I,1)}}dispatchEvent(A){const e=this._listeners;if(e===void 0)return;const t=e[A.type];if(t!==void 0){A.target=this;const g=t.slice(0);for(let I=0,C=g.length;I<C;I++)g[I].call(this,A);A.target=null}}}const it=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],lQ=Math.PI/180,xQ=180/Math.PI;function uC(){const i=Math.random()*4294967295|0,A=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0;return(it[i&255]+it[i>>8&255]+it[i>>16&255]+it[i>>24&255]+"-"+it[A&255]+it[A>>8&255]+"-"+it[A>>16&15|64]+it[A>>24&255]+"-"+it[e&63|128]+it[e>>8&255]+"-"+it[e>>16&255]+it[e>>24&255]+it[t&255]+it[t>>8&255]+it[t>>16&255]+it[t>>24&255]).toLowerCase()}function ie(i,A,e){return Math.max(A,Math.min(e,i))}function LD(i,A){return(i%A+A)%A}function uQ(i,A,e){return(1-e)*i+e*A}function fC(i,A){switch(A.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function xt(i,A){switch(A.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}class Be{constructor(A=0,e=0){Be.prototype.isVector2=!0,this.x=A,this.y=e}get width(){return this.x}set width(A){this.x=A}get height(){return this.y}set height(A){this.y=A}set(A,e){return this.x=A,this.y=e,this}setScalar(A){return this.x=A,this.y=A,this}setX(A){return this.x=A,this}setY(A){return this.y=A,this}setComponent(A,e){switch(A){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+A)}return this}getComponent(A){switch(A){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+A)}}clone(){return new this.constructor(this.x,this.y)}copy(A){return this.x=A.x,this.y=A.y,this}add(A){return this.x+=A.x,this.y+=A.y,this}addScalar(A){return this.x+=A,this.y+=A,this}addVectors(A,e){return this.x=A.x+e.x,this.y=A.y+e.y,this}addScaledVector(A,e){return this.x+=A.x*e,this.y+=A.y*e,this}sub(A){return this.x-=A.x,this.y-=A.y,this}subScalar(A){return this.x-=A,this.y-=A,this}subVectors(A,e){return this.x=A.x-e.x,this.y=A.y-e.y,this}multiply(A){return this.x*=A.x,this.y*=A.y,this}multiplyScalar(A){return this.x*=A,this.y*=A,this}divide(A){return this.x/=A.x,this.y/=A.y,this}divideScalar(A){return this.multiplyScalar(1/A)}applyMatrix3(A){const e=this.x,t=this.y,g=A.elements;return this.x=g[0]*e+g[3]*t+g[6],this.y=g[1]*e+g[4]*t+g[7],this}min(A){return this.x=Math.min(this.x,A.x),this.y=Math.min(this.y,A.y),this}max(A){return this.x=Math.max(this.x,A.x),this.y=Math.max(this.y,A.y),this}clamp(A,e){return this.x=ie(this.x,A.x,e.x),this.y=ie(this.y,A.y,e.y),this}clampScalar(A,e){return this.x=ie(this.x,A,e),this.y=ie(this.y,A,e),this}clampLength(A,e){const t=this.length();return this.divideScalar(t||1).multiplyScalar(ie(t,A,e))}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(A){return this.x*A.x+this.y*A.y}cross(A){return this.x*A.y-this.y*A.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(A){const e=Math.sqrt(this.lengthSq()*A.lengthSq());if(e===0)return Math.PI/2;const t=this.dot(A)/e;return Math.acos(ie(t,-1,1))}distanceTo(A){return Math.sqrt(this.distanceToSquared(A))}distanceToSquared(A){const e=this.x-A.x,t=this.y-A.y;return e*e+t*t}manhattanDistanceTo(A){return Math.abs(this.x-A.x)+Math.abs(this.y-A.y)}setLength(A){return this.normalize().multiplyScalar(A)}lerp(A,e){return this.x+=(A.x-this.x)*e,this.y+=(A.y-this.y)*e,this}lerpVectors(A,e,t){return this.x=A.x+(e.x-A.x)*t,this.y=A.y+(e.y-A.y)*t,this}equals(A){return A.x===this.x&&A.y===this.y}fromArray(A,e=0){return this.x=A[e],this.y=A[e+1],this}toArray(A=[],e=0){return A[e]=this.x,A[e+1]=this.y,A}fromBufferAttribute(A,e){return this.x=A.getX(e),this.y=A.getY(e),this}rotateAround(A,e){const t=Math.cos(e),g=Math.sin(e),I=this.x-A.x,C=this.y-A.y;return this.x=I*t-C*g+A.x,this.y=I*g+C*t+A.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class DC{constructor(A=0,e=0,t=0,g=1){this.isQuaternion=!0,this._x=A,this._y=e,this._z=t,this._w=g}static slerpFlat(A,e,t,g,I,C,o){let n=t[g+0],a=t[g+1],s=t[g+2],Q=t[g+3],r=I[C+0],B=I[C+1],h=I[C+2],c=I[C+3];if(o<=0){A[e+0]=n,A[e+1]=a,A[e+2]=s,A[e+3]=Q;return}if(o>=1){A[e+0]=r,A[e+1]=B,A[e+2]=h,A[e+3]=c;return}if(Q!==c||n!==r||a!==B||s!==h){let d=n*r+a*B+s*h+Q*c;d<0&&(r=-r,B=-B,h=-h,c=-c,d=-d);let E=1-o;if(d<.9995){const u=Math.acos(d),_=Math.sin(u);E=Math.sin(E*u)/_,o=Math.sin(o*u)/_,n=n*E+r*o,a=a*E+B*o,s=s*E+h*o,Q=Q*E+c*o}else{n=n*E+r*o,a=a*E+B*o,s=s*E+h*o,Q=Q*E+c*o;const u=1/Math.sqrt(n*n+a*a+s*s+Q*Q);n*=u,a*=u,s*=u,Q*=u}}A[e]=n,A[e+1]=a,A[e+2]=s,A[e+3]=Q}static multiplyQuaternionsFlat(A,e,t,g,I,C){const o=t[g],n=t[g+1],a=t[g+2],s=t[g+3],Q=I[C],r=I[C+1],B=I[C+2],h=I[C+3];return A[e]=o*h+s*Q+n*B-a*r,A[e+1]=n*h+s*r+a*Q-o*B,A[e+2]=a*h+s*B+o*r-n*Q,A[e+3]=s*h-o*Q-n*r-a*B,A}get x(){return this._x}set x(A){this._x=A,this._onChangeCallback()}get y(){return this._y}set y(A){this._y=A,this._onChangeCallback()}get z(){return this._z}set z(A){this._z=A,this._onChangeCallback()}get w(){return this._w}set w(A){this._w=A,this._onChangeCallback()}set(A,e,t,g){return this._x=A,this._y=e,this._z=t,this._w=g,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(A){return this._x=A.x,this._y=A.y,this._z=A.z,this._w=A.w,this._onChangeCallback(),this}setFromEuler(A,e=!0){const t=A._x,g=A._y,I=A._z,C=A._order,o=Math.cos,n=Math.sin,a=o(t/2),s=o(g/2),Q=o(I/2),r=n(t/2),B=n(g/2),h=n(I/2);switch(C){case"XYZ":this._x=r*s*Q+a*B*h,this._y=a*B*Q-r*s*h,this._z=a*s*h+r*B*Q,this._w=a*s*Q-r*B*h;break;case"YXZ":this._x=r*s*Q+a*B*h,this._y=a*B*Q-r*s*h,this._z=a*s*h-r*B*Q,this._w=a*s*Q+r*B*h;break;case"ZXY":this._x=r*s*Q-a*B*h,this._y=a*B*Q+r*s*h,this._z=a*s*h+r*B*Q,this._w=a*s*Q-r*B*h;break;case"ZYX":this._x=r*s*Q-a*B*h,this._y=a*B*Q+r*s*h,this._z=a*s*h-r*B*Q,this._w=a*s*Q+r*B*h;break;case"YZX":this._x=r*s*Q+a*B*h,this._y=a*B*Q+r*s*h,this._z=a*s*h-r*B*Q,this._w=a*s*Q-r*B*h;break;case"XZY":this._x=r*s*Q-a*B*h,this._y=a*B*Q-r*s*h,this._z=a*s*h+r*B*Q,this._w=a*s*Q+r*B*h;break;default:KA("Quaternion: .setFromEuler() encountered an unknown order: "+C)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(A,e){const t=e/2,g=Math.sin(t);return this._x=A.x*g,this._y=A.y*g,this._z=A.z*g,this._w=Math.cos(t),this._onChangeCallback(),this}setFromRotationMatrix(A){const e=A.elements,t=e[0],g=e[4],I=e[8],C=e[1],o=e[5],n=e[9],a=e[2],s=e[6],Q=e[10],r=t+o+Q;if(r>0){const B=.5/Math.sqrt(r+1);this._w=.25/B,this._x=(s-n)*B,this._y=(I-a)*B,this._z=(C-g)*B}else if(t>o&&t>Q){const B=2*Math.sqrt(1+t-o-Q);this._w=(s-n)/B,this._x=.25*B,this._y=(g+C)/B,this._z=(I+a)/B}else if(o>Q){const B=2*Math.sqrt(1+o-t-Q);this._w=(I-a)/B,this._x=(g+C)/B,this._y=.25*B,this._z=(n+s)/B}else{const B=2*Math.sqrt(1+Q-t-o);this._w=(C-g)/B,this._x=(I+a)/B,this._y=(n+s)/B,this._z=.25*B}return this._onChangeCallback(),this}setFromUnitVectors(A,e){let t=A.dot(e)+1;return t<1e-8?(t=0,Math.abs(A.x)>Math.abs(A.z)?(this._x=-A.y,this._y=A.x,this._z=0,this._w=t):(this._x=0,this._y=-A.z,this._z=A.y,this._w=t)):(this._x=A.y*e.z-A.z*e.y,this._y=A.z*e.x-A.x*e.z,this._z=A.x*e.y-A.y*e.x,this._w=t),this.normalize()}angleTo(A){return 2*Math.acos(Math.abs(ie(this.dot(A),-1,1)))}rotateTowards(A,e){const t=this.angleTo(A);if(t===0)return this;const g=Math.min(1,e/t);return this.slerp(A,g),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(A){return this._x*A._x+this._y*A._y+this._z*A._z+this._w*A._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 A=this.length();return A===0?(this._x=0,this._y=0,this._z=0,this._w=1):(A=1/A,this._x=this._x*A,this._y=this._y*A,this._z=this._z*A,this._w=this._w*A),this._onChangeCallback(),this}multiply(A){return this.multiplyQuaternions(this,A)}premultiply(A){return this.multiplyQuaternions(A,this)}multiplyQuaternions(A,e){const t=A._x,g=A._y,I=A._z,C=A._w,o=e._x,n=e._y,a=e._z,s=e._w;return this._x=t*s+C*o+g*a-I*n,this._y=g*s+C*n+I*o-t*a,this._z=I*s+C*a+t*n-g*o,this._w=C*s-t*o-g*n-I*a,this._onChangeCallback(),this}slerp(A,e){if(e<=0)return this;if(e>=1)return this.copy(A);let t=A._x,g=A._y,I=A._z,C=A._w,o=this.dot(A);o<0&&(t=-t,g=-g,I=-I,C=-C,o=-o);let n=1-e;if(o<.9995){const a=Math.acos(o),s=Math.sin(a);n=Math.sin(n*a)/s,e=Math.sin(e*a)/s,this._x=this._x*n+t*e,this._y=this._y*n+g*e,this._z=this._z*n+I*e,this._w=this._w*n+C*e,this._onChangeCallback()}else this._x=this._x*n+t*e,this._y=this._y*n+g*e,this._z=this._z*n+I*e,this._w=this._w*n+C*e,this.normalize();return this}slerpQuaternions(A,e,t){return this.copy(A).slerp(e,t)}random(){const A=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),t=Math.random(),g=Math.sqrt(1-t),I=Math.sqrt(t);return this.set(g*Math.sin(A),g*Math.cos(A),I*Math.sin(e),I*Math.cos(e))}equals(A){return A._x===this._x&&A._y===this._y&&A._z===this._z&&A._w===this._w}fromArray(A,e=0){return this._x=A[e],this._y=A[e+1],this._z=A[e+2],this._w=A[e+3],this._onChangeCallback(),this}toArray(A=[],e=0){return A[e]=this._x,A[e+1]=this._y,A[e+2]=this._z,A[e+3]=this._w,A}fromBufferAttribute(A,e){return this._x=A.getX(e),this._y=A.getY(e),this._z=A.getZ(e),this._w=A.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(A){return this._onChangeCallback=A,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class J{constructor(A=0,e=0,t=0){J.prototype.isVector3=!0,this.x=A,this.y=e,this.z=t}set(A,e,t){return t===void 0&&(t=this.z),this.x=A,this.y=e,this.z=t,this}setScalar(A){return this.x=A,this.y=A,this.z=A,this}setX(A){return this.x=A,this}setY(A){return this.y=A,this}setZ(A){return this.z=A,this}setComponent(A,e){switch(A){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+A)}return this}getComponent(A){switch(A){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+A)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(A){return this.x=A.x,this.y=A.y,this.z=A.z,this}add(A){return this.x+=A.x,this.y+=A.y,this.z+=A.z,this}addScalar(A){return this.x+=A,this.y+=A,this.z+=A,this}addVectors(A,e){return this.x=A.x+e.x,this.y=A.y+e.y,this.z=A.z+e.z,this}addScaledVector(A,e){return this.x+=A.x*e,this.y+=A.y*e,this.z+=A.z*e,this}sub(A){return this.x-=A.x,this.y-=A.y,this.z-=A.z,this}subScalar(A){return this.x-=A,this.y-=A,this.z-=A,this}subVectors(A,e){return this.x=A.x-e.x,this.y=A.y-e.y,this.z=A.z-e.z,this}multiply(A){return this.x*=A.x,this.y*=A.y,this.z*=A.z,this}multiplyScalar(A){return this.x*=A,this.y*=A,this.z*=A,this}multiplyVectors(A,e){return this.x=A.x*e.x,this.y=A.y*e.y,this.z=A.z*e.z,this}applyEuler(A){return this.applyQuaternion(Bc.setFromEuler(A))}applyAxisAngle(A,e){return this.applyQuaternion(Bc.setFromAxisAngle(A,e))}applyMatrix3(A){const e=this.x,t=this.y,g=this.z,I=A.elements;return this.x=I[0]*e+I[3]*t+I[6]*g,this.y=I[1]*e+I[4]*t+I[7]*g,this.z=I[2]*e+I[5]*t+I[8]*g,this}applyNormalMatrix(A){return this.applyMatrix3(A).normalize()}applyMatrix4(A){const e=this.x,t=this.y,g=this.z,I=A.elements,C=1/(I[3]*e+I[7]*t+I[11]*g+I[15]);return this.x=(I[0]*e+I[4]*t+I[8]*g+I[12])*C,this.y=(I[1]*e+I[5]*t+I[9]*g+I[13])*C,this.z=(I[2]*e+I[6]*t+I[10]*g+I[14])*C,this}applyQuaternion(A){const e=this.x,t=this.y,g=this.z,I=A.x,C=A.y,o=A.z,n=A.w,a=2*(C*g-o*t),s=2*(o*e-I*g),Q=2*(I*t-C*e);return this.x=e+n*a+C*Q-o*s,this.y=t+n*s+o*a-I*Q,this.z=g+n*Q+I*s-C*a,this}project(A){return this.applyMatrix4(A.matrixWorldInverse).applyMatrix4(A.projectionMatrix)}unproject(A){return this.applyMatrix4(A.projectionMatrixInverse).applyMatrix4(A.matrixWorld)}transformDirection(A){const e=this.x,t=this.y,g=this.z,I=A.elements;return this.x=I[0]*e+I[4]*t+I[8]*g,this.y=I[1]*e+I[5]*t+I[9]*g,this.z=I[2]*e+I[6]*t+I[10]*g,this.normalize()}divide(A){return this.x/=A.x,this.y/=A.y,this.z/=A.z,this}divideScalar(A){return this.multiplyScalar(1/A)}min(A){return this.x=Math.min(this.x,A.x),this.y=Math.min(this.y,A.y),this.z=Math.min(this.z,A.z),this}max(A){return this.x=Math.max(this.x,A.x),this.y=Math.max(this.y,A.y),this.z=Math.max(this.z,A.z),this}clamp(A,e){return this.x=ie(this.x,A.x,e.x),this.y=ie(this.y,A.y,e.y),this.z=ie(this.z,A.z,e.z),this}clampScalar(A,e){return this.x=ie(this.x,A,e),this.y=ie(this.y,A,e),this.z=ie(this.z,A,e),this}clampLength(A,e){const t=this.length();return this.divideScalar(t||1).multiplyScalar(ie(t,A,e))}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(A){return this.x*A.x+this.y*A.y+this.z*A.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(A){return this.normalize().multiplyScalar(A)}lerp(A,e){return this.x+=(A.x-this.x)*e,this.y+=(A.y-this.y)*e,this.z+=(A.z-this.z)*e,this}lerpVectors(A,e,t){return this.x=A.x+(e.x-A.x)*t,this.y=A.y+(e.y-A.y)*t,this.z=A.z+(e.z-A.z)*t,this}cross(A){return this.crossVectors(this,A)}crossVectors(A,e){const t=A.x,g=A.y,I=A.z,C=e.x,o=e.y,n=e.z;return this.x=g*n-I*o,this.y=I*C-t*n,this.z=t*o-g*C,this}projectOnVector(A){const e=A.lengthSq();if(e===0)return this.set(0,0,0);const t=A.dot(this)/e;return this.copy(A).multiplyScalar(t)}projectOnPlane(A){return fQ.copy(this).projectOnVector(A),this.sub(fQ)}reflect(A){return this.sub(fQ.copy(A).multiplyScalar(2*this.dot(A)))}angleTo(A){const e=Math.sqrt(this.lengthSq()*A.lengthSq());if(e===0)return Math.PI/2;const t=this.dot(A)/e;return Math.acos(ie(t,-1,1))}distanceTo(A){return Math.sqrt(this.distanceToSquared(A))}distanceToSquared(A){const e=this.x-A.x,t=this.y-A.y,g=this.z-A.z;return e*e+t*t+g*g}manhattanDistanceTo(A){return Math.abs(this.x-A.x)+Math.abs(this.y-A.y)+Math.abs(this.z-A.z)}setFromSpherical(A){return this.setFromSphericalCoords(A.radius,A.phi,A.theta)}setFromSphericalCoords(A,e,t){const g=Math.sin(e)*A;return this.x=g*Math.sin(t),this.y=Math.cos(e)*A,this.z=g*Math.cos(t),this}setFromCylindrical(A){return this.setFromCylindricalCoords(A.radius,A.theta,A.y)}setFromCylindricalCoords(A,e,t){return this.x=A*Math.sin(e),this.y=t,this.z=A*Math.cos(e),this}setFromMatrixPosition(A){const e=A.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(A){const e=this.setFromMatrixColumn(A,0).length(),t=this.setFromMatrixColumn(A,1).length(),g=this.setFromMatrixColumn(A,2).length();return this.x=e,this.y=t,this.z=g,this}setFromMatrixColumn(A,e){return this.fromArray(A.elements,e*4)}setFromMatrix3Column(A,e){return this.fromArray(A.elements,e*3)}setFromEuler(A){return this.x=A._x,this.y=A._y,this.z=A._z,this}setFromColor(A){return this.x=A.r,this.y=A.g,this.z=A.b,this}equals(A){return A.x===this.x&&A.y===this.y&&A.z===this.z}fromArray(A,e=0){return this.x=A[e],this.y=A[e+1],this.z=A[e+2],this}toArray(A=[],e=0){return A[e]=this.x,A[e+1]=this.y,A[e+2]=this.z,A}fromBufferAttribute(A,e){return this.x=A.getX(e),this.y=A.getY(e),this.z=A.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const A=Math.random()*Math.PI*2,e=Math.random()*2-1,t=Math.sqrt(1-e*e);return this.x=t*Math.cos(A),this.y=e,this.z=t*Math.sin(A),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const fQ=new J,Bc=new DC;class qA{constructor(A,e,t,g,I,C,o,n,a){qA.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],A!==void 0&&this.set(A,e,t,g,I,C,o,n,a)}set(A,e,t,g,I,C,o,n,a){const s=this.elements;return s[0]=A,s[1]=g,s[2]=o,s[3]=e,s[4]=I,s[5]=n,s[6]=t,s[7]=C,s[8]=a,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(A){const e=this.elements,t=A.elements;return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],this}extractBasis(A,e,t){return A.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),t.setFromMatrix3Column(this,2),this}setFromMatrix4(A){const e=A.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(A){return this.multiplyMatrices(this,A)}premultiply(A){return this.multiplyMatrices(A,this)}multiplyMatrices(A,e){const t=A.elements,g=e.elements,I=this.elements,C=t[0],o=t[3],n=t[6],a=t[1],s=t[4],Q=t[7],r=t[2],B=t[5],h=t[8],c=g[0],d=g[3],E=g[6],u=g[1],_=g[4],x=g[7],D=g[2],w=g[5],y=g[8];return I[0]=C*c+o*u+n*D,I[3]=C*d+o*_+n*w,I[6]=C*E+o*x+n*y,I[1]=a*c+s*u+Q*D,I[4]=a*d+s*_+Q*w,I[7]=a*E+s*x+Q*y,I[2]=r*c+B*u+h*D,I[5]=r*d+B*_+h*w,I[8]=r*E+B*x+h*y,this}multiplyScalar(A){const e=this.elements;return e[0]*=A,e[3]*=A,e[6]*=A,e[1]*=A,e[4]*=A,e[7]*=A,e[2]*=A,e[5]*=A,e[8]*=A,this}determinant(){const A=this.elements,e=A[0],t=A[1],g=A[2],I=A[3],C=A[4],o=A[5],n=A[6],a=A[7],s=A[8];return e*C*s-e*o*a-t*I*s+t*o*n+g*I*a-g*C*n}invert(){const A=this.elements,e=A[0],t=A[1],g=A[2],I=A[3],C=A[4],o=A[5],n=A[6],a=A[7],s=A[8],Q=s*C-o*a,r=o*n-s*I,B=a*I-C*n,h=e*Q+t*r+g*B;if(h===0)return this.set(0,0,0,0,0,0,0,0,0);const c=1/h;return A[0]=Q*c,A[1]=(g*a-s*t)*c,A[2]=(o*t-g*C)*c,A[3]=r*c,A[4]=(s*e-g*n)*c,A[5]=(g*I-o*e)*c,A[6]=B*c,A[7]=(t*n-a*e)*c,A[8]=(C*e-t*I)*c,this}transpose(){let A;const e=this.elements;return A=e[1],e[1]=e[3],e[3]=A,A=e[2],e[2]=e[6],e[6]=A,A=e[5],e[5]=e[7],e[7]=A,this}getNormalMatrix(A){return this.setFromMatrix4(A).invert().transpose()}transposeIntoArray(A){const e=this.elements;return A[0]=e[0],A[1]=e[3],A[2]=e[6],A[3]=e[1],A[4]=e[4],A[5]=e[7],A[6]=e[2],A[7]=e[5],A[8]=e[8],this}setUvTransform(A,e,t,g,I,C,o){const n=Math.cos(I),a=Math.sin(I);return this.set(t*n,t*a,-t*(n*C+a*o)+C+A,-g*a,g*n,-g*(-a*C+n*o)+o+e,0,0,1),this}scale(A,e){return this.premultiply(DQ.makeScale(A,e)),this}rotate(A){return this.premultiply(DQ.makeRotation(-A)),this}translate(A,e){return this.premultiply(DQ.makeTranslation(A,e)),this}makeTranslation(A,e){return A.isVector2?this.set(1,0,A.x,0,1,A.y,0,0,1):this.set(1,0,A,0,1,e,0,0,1),this}makeRotation(A){const e=Math.cos(A),t=Math.sin(A);return this.set(e,-t,0,t,e,0,0,0,1),this}makeScale(A,e){return this.set(A,0,0,0,e,0,0,0,1),this}equals(A){const e=this.elements,t=A.elements;for(let g=0;g<9;g++)if(e[g]!==t[g])return!1;return!0}fromArray(A,e=0){for(let t=0;t<9;t++)this.elements[t]=A[t+e];return this}toArray(A=[],e=0){const t=this.elements;return A[e]=t[0],A[e+1]=t[1],A[e+2]=t[2],A[e+3]=t[3],A[e+4]=t[4],A[e+5]=t[5],A[e+6]=t[6],A[e+7]=t[7],A[e+8]=t[8],A}clone(){return new this.constructor().fromArray(this.elements)}}const DQ=new qA,Ec=new qA().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),cc=new qA().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function vD(){const i={enabled:!0,workingColorSpace:uI,spaces:{},convert:function(g,I,C){return this.enabled===!1||I===C||!I||!C||(this.spaces[I].transfer===ce&&(g.r=Ji(g.r),g.g=Ji(g.g),g.b=Ji(g.b)),this.spaces[I].primaries!==this.spaces[C].primaries&&(g.applyMatrix3(this.spaces[I].toXYZ),g.applyMatrix3(this.spaces[C].fromXYZ)),this.spaces[C].transfer===ce&&(g.r=_I(g.r),g.g=_I(g.g),g.b=_I(g.b))),g},workingToColorSpace:function(g,I){return this.convert(g,this.workingColorSpace,I)},colorSpaceToWorking:function(g,I){return this.convert(g,I,this.workingColorSpace)},getPrimaries:function(g){return this.spaces[g].primaries},getTransfer:function(g){return g===rg?Po:this.spaces[g].transfer},getToneMappingMode:function(g){return this.spaces[g].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(g,I=this.workingColorSpace){return g.fromArray(this.spaces[I].luminanceCoefficients)},define:function(g){Object.assign(this.spaces,g)},_getMatrix:function(g,I,C){return g.copy(this.spaces[I].toXYZ).multiply(this.spaces[C].fromXYZ)},_getDrawingBufferColorSpace:function(g){return this.spaces[g].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(g=this.workingColorSpace){return this.spaces[g].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(g,I){return xC("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(g,I)},toWorkingColorSpace:function(g,I){return xC("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),i.colorSpaceToWorking(g,I)}},A=[.64,.33,.3,.6,.15,.06],e=[.2126,.7152,.0722],t=[.3127,.329];return i.define({[uI]:{primaries:A,whitePoint:t,transfer:Po,toXYZ:Ec,fromXYZ:cc,luminanceCoefficients:e,workingColorSpaceConfig:{unpackColorSpace:Mt},outputColorSpaceConfig:{drawingBufferColorSpace:Mt}},[Mt]:{primaries:A,whitePoint:t,transfer:ce,toXYZ:Ec,fromXYZ:cc,luminanceCoefficients:e,outputColorSpaceConfig:{drawingBufferColorSpace:Mt}}}),i}const oe=vD();function Ji(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function _I(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let pI;class KD{static getDataURL(A,e="image/png"){if(/^data:/i.test(A.src)||typeof HTMLCanvasElement>"u")return A.src;let t;if(A instanceof HTMLCanvasElement)t=A;else{pI===void 0&&(pI=Vo("canvas")),pI.width=A.width,pI.height=A.height;const g=pI.getContext("2d");A instanceof ImageData?g.putImageData(A,0,0):g.drawImage(A,0,0,A.width,A.height),t=pI}return t.toDataURL(e)}static sRGBToLinear(A){if(typeof HTMLImageElement<"u"&&A instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&A instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&A instanceof ImageBitmap){const e=Vo("canvas");e.width=A.width,e.height=A.height;const t=e.getContext("2d");t.drawImage(A,0,0,A.width,A.height);const g=t.getImageData(0,0,A.width,A.height),I=g.data;for(let C=0;C<I.length;C++)I[C]=Ji(I[C]/255)*255;return t.putImageData(g,0,0),e}else if(A.data){const e=A.data.slice(0);for(let t=0;t<e.length;t++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[t]=Math.floor(Ji(e[t]/255)*255):e[t]=Ji(e[t]);return{data:e,width:A.width,height:A.height}}else return KA("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),A}}let JD=0;class _Q{constructor(A=null){this.isSource=!0,Object.defineProperty(this,"id",{value:JD++}),this.uuid=uC(),this.data=A,this.dataReady=!0,this.version=0}getSize(A){const e=this.data;return typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement?A.set(e.videoWidth,e.videoHeight,0):typeof VideoFrame<"u"&&e instanceof VideoFrame?A.set(e.displayHeight,e.displayWidth,0):e!==null?A.set(e.width,e.height,e.depth||0):A.set(0,0,0),A}set needsUpdate(A){A===!0&&this.version++}toJSON(A){const e=A===void 0||typeof A=="string";if(!e&&A.images[this.uuid]!==void 0)return A.images[this.uuid];const t={uuid:this.uuid,url:""},g=this.data;if(g!==null){let I;if(Array.isArray(g)){I=[];for(let C=0,o=g.length;C<o;C++)g[C].isDataTexture?I.push(pQ(g[C].image)):I.push(pQ(g[C]))}else I=pQ(g);t.url=I}return e||(A.images[this.uuid]=t),t}}function pQ(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?KD.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(KA("Texture: Unable to serialize Texture."),{})}let YD=0;const wQ=new J;class ot extends DI{constructor(A=ot.DEFAULT_IMAGE,e=ot.DEFAULT_MAPPING,t=Li,g=Li,I=tt,C=vg,o=jt,n=Gt,a=ot.DEFAULT_ANISOTROPY,s=rg){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:YD++}),this.uuid=uC(),this.name="",this.source=new _Q(A),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=t,this.wrapT=g,this.magFilter=I,this.minFilter=C,this.anisotropy=a,this.format=o,this.internalFormat=null,this.type=n,this.offset=new Be(0,0),this.repeat=new Be(1,1),this.center=new Be(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new qA,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=s,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(A&&A.depth&&A.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(wQ).x}get height(){return this.source.getSize(wQ).y}get depth(){return this.source.getSize(wQ).z}get image(){return this.source.data}set image(A=null){this.source.data=A}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(A,e){this.updateRanges.push({start:A,count:e})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(A){return this.name=A.name,this.source=A.source,this.mipmaps=A.mipmaps.slice(0),this.mapping=A.mapping,this.channel=A.channel,this.wrapS=A.wrapS,this.wrapT=A.wrapT,this.magFilter=A.magFilter,this.minFilter=A.minFilter,this.anisotropy=A.anisotropy,this.format=A.format,this.internalFormat=A.internalFormat,this.type=A.type,this.offset.copy(A.offset),this.repeat.copy(A.repeat),this.center.copy(A.center),this.rotation=A.rotation,this.matrixAutoUpdate=A.matrixAutoUpdate,this.matrix.copy(A.matrix),this.generateMipmaps=A.generateMipmaps,this.premultiplyAlpha=A.premultiplyAlpha,this.flipY=A.flipY,this.unpackAlignment=A.unpackAlignment,this.colorSpace=A.colorSpace,this.renderTarget=A.renderTarget,this.isRenderTargetTexture=A.isRenderTargetTexture,this.isArrayTexture=A.isArrayTexture,this.userData=JSON.parse(JSON.stringify(A.userData)),this.needsUpdate=!0,this}setValues(A){for(const e in A){const t=A[e];if(t===void 0){KA(`Texture.setValues(): parameter '${e}' has value of undefined.`);continue}const g=this[e];if(g===void 0){KA(`Texture.setValues(): property '${e}' does not exist.`);continue}g&&t&&g.isVector2&&t.isVector2||g&&t&&g.isVector3&&t.isVector3||g&&t&&g.isMatrix3&&t.isMatrix3?g.copy(t):this[e]=t}}toJSON(A){const e=A===void 0||typeof A=="string";if(!e&&A.textures[this.uuid]!==void 0)return A.textures[this.uuid];const t={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(A).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(t.userData=this.userData),e||(A.textures[this.uuid]=t),t}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(A){if(this.mapping!==$E)return A;if(A.applyMatrix3(this.matrix),A.x<0||A.x>1)switch(this.wrapS){case Ns:A.x=A.x-Math.floor(A.x);break;case Li:A.x=A.x<0?0:1;break;case ks:Math.abs(Math.floor(A.x)%2)===1?A.x=Math.ceil(A.x)-A.x:A.x=A.x-Math.floor(A.x);break}if(A.y<0||A.y>1)switch(this.wrapT){case Ns:A.y=A.y-Math.floor(A.y);break;case Li:A.y=A.y<0?0:1;break;case ks:Math.abs(Math.floor(A.y)%2)===1?A.y=Math.ceil(A.y)-A.y:A.y=A.y-Math.floor(A.y);break}return this.flipY&&(A.y=1-A.y),A}set needsUpdate(A){A===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(A){A===!0&&this.pmremVersion++}}ot.DEFAULT_IMAGE=null,ot.DEFAULT_MAPPING=$E,ot.DEFAULT_ANISOTROPY=1;class ve{constructor(A=0,e=0,t=0,g=1){ve.prototype.isVector4=!0,this.x=A,this.y=e,this.z=t,this.w=g}get width(){return this.z}set width(A){this.z=A}get height(){return this.w}set height(A){this.w=A}set(A,e,t,g){return this.x=A,this.y=e,this.z=t,this.w=g,this}setScalar(A){return this.x=A,this.y=A,this.z=A,this.w=A,this}setX(A){return this.x=A,this}setY(A){return this.y=A,this}setZ(A){return this.z=A,this}setW(A){return this.w=A,this}setComponent(A,e){switch(A){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+A)}return this}getComponent(A){switch(A){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: "+A)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(A){return this.x=A.x,this.y=A.y,this.z=A.z,this.w=A.w!==void 0?A.w:1,this}add(A){return this.x+=A.x,this.y+=A.y,this.z+=A.z,this.w+=A.w,this}addScalar(A){return this.x+=A,this.y+=A,this.z+=A,this.w+=A,this}addVectors(A,e){return this.x=A.x+e.x,this.y=A.y+e.y,this.z=A.z+e.z,this.w=A.w+e.w,this}addScaledVector(A,e){return this.x+=A.x*e,this.y+=A.y*e,this.z+=A.z*e,this.w+=A.w*e,this}sub(A){return this.x-=A.x,this.y-=A.y,this.z-=A.z,this.w-=A.w,this}subScalar(A){return this.x-=A,this.y-=A,this.z-=A,this.w-=A,this}subVectors(A,e){return this.x=A.x-e.x,this.y=A.y-e.y,this.z=A.z-e.z,this.w=A.w-e.w,this}multiply(A){return this.x*=A.x,this.y*=A.y,this.z*=A.z,this.w*=A.w,this}multiplyScalar(A){return this.x*=A,this.y*=A,this.z*=A,this.w*=A,this}applyMatrix4(A){const e=this.x,t=this.y,g=this.z,I=this.w,C=A.elements;return this.x=C[0]*e+C[4]*t+C[8]*g+C[12]*I,this.y=C[1]*e+C[5]*t+C[9]*g+C[13]*I,this.z=C[2]*e+C[6]*t+C[10]*g+C[14]*I,this.w=C[3]*e+C[7]*t+C[11]*g+C[15]*I,this}divide(A){return this.x/=A.x,this.y/=A.y,this.z/=A.z,this.w/=A.w,this}divideScalar(A){return this.multiplyScalar(1/A)}setAxisAngleFromQuaternion(A){this.w=2*Math.acos(A.w);const e=Math.sqrt(1-A.w*A.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=A.x/e,this.y=A.y/e,this.z=A.z/e),this}setAxisAngleFromRotationMatrix(A){let e,t,g,I;const n=A.elements,a=n[0],s=n[4],Q=n[8],r=n[1],B=n[5],h=n[9],c=n[2],d=n[6],E=n[10];if(Math.abs(s-r)<.01&&Math.abs(Q-c)<.01&&Math.abs(h-d)<.01){if(Math.abs(s+r)<.1&&Math.abs(Q+c)<.1&&Math.abs(h+d)<.1&&Math.abs(a+B+E-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const _=(a+1)/2,x=(B+1)/2,D=(E+1)/2,w=(s+r)/4,y=(Q+c)/4,S=(h+d)/4;return _>x&&_>D?_<.01?(t=0,g=.707106781,I=.707106781):(t=Math.sqrt(_),g=w/t,I=y/t):x>D?x<.01?(t=.707106781,g=0,I=.707106781):(g=Math.sqrt(x),t=w/g,I=S/g):D<.01?(t=.707106781,g=.707106781,I=0):(I=Math.sqrt(D),t=y/I,g=S/I),this.set(t,g,I,e),this}let u=Math.sqrt((d-h)*(d-h)+(Q-c)*(Q-c)+(r-s)*(r-s));return Math.abs(u)<.001&&(u=1),this.x=(d-h)/u,this.y=(Q-c)/u,this.z=(r-s)/u,this.w=Math.acos((a+B+E-1)/2),this}setFromMatrixPosition(A){const e=A.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(A){return this.x=Math.min(this.x,A.x),this.y=Math.min(this.y,A.y),this.z=Math.min(this.z,A.z),this.w=Math.min(this.w,A.w),this}max(A){return this.x=Math.max(this.x,A.x),this.y=Math.max(this.y,A.y),this.z=Math.max(this.z,A.z),this.w=Math.max(this.w,A.w),this}clamp(A,e){return this.x=ie(this.x,A.x,e.x),this.y=ie(this.y,A.y,e.y),this.z=ie(this.z,A.z,e.z),this.w=ie(this.w,A.w,e.w),this}clampScalar(A,e){return this.x=ie(this.x,A,e),this.y=ie(this.y,A,e),this.z=ie(this.z,A,e),this.w=ie(this.w,A,e),this}clampLength(A,e){const t=this.length();return this.divideScalar(t||1).multiplyScalar(ie(t,A,e))}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(A){return this.x*A.x+this.y*A.y+this.z*A.z+this.w*A.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(A){return this.normalize().multiplyScalar(A)}lerp(A,e){return this.x+=(A.x-this.x)*e,this.y+=(A.y-this.y)*e,this.z+=(A.z-this.z)*e,this.w+=(A.w-this.w)*e,this}lerpVectors(A,e,t){return this.x=A.x+(e.x-A.x)*t,this.y=A.y+(e.y-A.y)*t,this.z=A.z+(e.z-A.z)*t,this.w=A.w+(e.w-A.w)*t,this}equals(A){return A.x===this.x&&A.y===this.y&&A.z===this.z&&A.w===this.w}fromArray(A,e=0){return this.x=A[e],this.y=A[e+1],this.z=A[e+2],this.w=A[e+3],this}toArray(A=[],e=0){return A[e]=this.x,A[e+1]=this.y,A[e+2]=this.z,A[e+3]=this.w,A}fromBufferAttribute(A,e){return this.x=A.getX(e),this.y=A.getY(e),this.z=A.getZ(e),this.w=A.getW(e),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 TD extends DI{constructor(A=1,e=1,t={}){super(),t=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:tt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},t),this.isRenderTarget=!0,this.width=A,this.height=e,this.depth=t.depth,this.scissor=new ve(0,0,A,e),this.scissorTest=!1,this.viewport=new ve(0,0,A,e);const g={width:A,height:e,depth:t.depth},I=new ot(g);this.textures=[];const C=t.count;for(let o=0;o<C;o++)this.textures[o]=I.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(t),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.resolveDepthBuffer=t.resolveDepthBuffer,this.resolveStencilBuffer=t.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=t.depthTexture,this.samples=t.samples,this.multiview=t.multiview}_setTextureOptions(A={}){const e={minFilter:tt,generateMipmaps:!1,flipY:!1,internalFormat:null};A.mapping!==void 0&&(e.mapping=A.mapping),A.wrapS!==void 0&&(e.wrapS=A.wrapS),A.wrapT!==void 0&&(e.wrapT=A.wrapT),A.wrapR!==void 0&&(e.wrapR=A.wrapR),A.magFilter!==void 0&&(e.magFilter=A.magFilter),A.minFilter!==void 0&&(e.minFilter=A.minFilter),A.format!==void 0&&(e.format=A.format),A.type!==void 0&&(e.type=A.type),A.anisotropy!==void 0&&(e.anisotropy=A.anisotropy),A.colorSpace!==void 0&&(e.colorSpace=A.colorSpace),A.flipY!==void 0&&(e.flipY=A.flipY),A.generateMipmaps!==void 0&&(e.generateMipmaps=A.generateMipmaps),A.internalFormat!==void 0&&(e.internalFormat=A.internalFormat);for(let t=0;t<this.textures.length;t++)this.textures[t].setValues(e)}get texture(){return this.textures[0]}set texture(A){this.textures[0]=A}set depthTexture(A){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),A!==null&&(A.renderTarget=this),this._depthTexture=A}get depthTexture(){return this._depthTexture}setSize(A,e,t=1){if(this.width!==A||this.height!==e||this.depth!==t){this.width=A,this.height=e,this.depth=t;for(let g=0,I=this.textures.length;g<I;g++)this.textures[g].image.width=A,this.textures[g].image.height=e,this.textures[g].image.depth=t,this.textures[g].isData3DTexture!==!0&&(this.textures[g].isArrayTexture=this.textures[g].image.depth>1);this.dispose()}this.viewport.set(0,0,A,e),this.scissor.set(0,0,A,e)}clone(){return new this.constructor().copy(this)}copy(A){this.width=A.width,this.height=A.height,this.depth=A.depth,this.scissor.copy(A.scissor),this.scissorTest=A.scissorTest,this.viewport.copy(A.viewport),this.textures.length=0;for(let e=0,t=A.textures.length;e<t;e++){this.textures[e]=A.textures[e].clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;const g=Object.assign({},A.textures[e].image);this.textures[e].source=new _Q(g)}return this.depthBuffer=A.depthBuffer,this.stencilBuffer=A.stencilBuffer,this.resolveDepthBuffer=A.resolveDepthBuffer,this.resolveStencilBuffer=A.resolveStencilBuffer,A.depthTexture!==null&&(this.depthTexture=A.depthTexture.clone()),this.samples=A.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class di extends TD{constructor(A=1,e=1,t={}){super(A,e,t),this.isWebGLRenderTarget=!0}}class dc extends ot{constructor(A=null,e=1,t=1,g=1){super(null),this.isDataArrayTexture=!0,this.image={data:A,width:e,height:t,depth:g},this.magFilter=At,this.minFilter=At,this.wrapR=Li,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(A){this.layerUpdates.add(A)}clearLayerUpdates(){this.layerUpdates.clear()}}class qD extends ot{constructor(A=null,e=1,t=1,g=1){super(null),this.isData3DTexture=!0,this.image={data:A,width:e,height:t,depth:g},this.magFilter=At,this.minFilter=At,this.wrapR=Li,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class _C{constructor(A=new J(1/0,1/0,1/0),e=new J(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=A,this.max=e}set(A,e){return this.min.copy(A),this.max.copy(e),this}setFromArray(A){this.makeEmpty();for(let e=0,t=A.length;e<t;e+=3)this.expandByPoint(Wt.fromArray(A,e));return this}setFromBufferAttribute(A){this.makeEmpty();for(let e=0,t=A.count;e<t;e++)this.expandByPoint(Wt.fromBufferAttribute(A,e));return this}setFromPoints(A){this.makeEmpty();for(let e=0,t=A.length;e<t;e++)this.expandByPoint(A[e]);return this}setFromCenterAndSize(A,e){const t=Wt.copy(e).multiplyScalar(.5);return this.min.copy(A).sub(t),this.max.copy(A).add(t),this}setFromObject(A,e=!1){return this.makeEmpty(),this.expandByObject(A,e)}clone(){return new this.constructor().copy(this)}copy(A){return this.min.copy(A.min),this.max.copy(A.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(A){return this.isEmpty()?A.set(0,0,0):A.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(A){return this.isEmpty()?A.set(0,0,0):A.subVectors(this.max,this.min)}expandByPoint(A){return this.min.min(A),this.max.max(A),this}expandByVector(A){return this.min.sub(A),this.max.add(A),this}expandByScalar(A){return this.min.addScalar(-A),this.max.addScalar(A),this}expandByObject(A,e=!1){A.updateWorldMatrix(!1,!1);const t=A.geometry;if(t!==void 0){const I=t.getAttribute("position");if(e===!0&&I!==void 0&&A.isInstancedMesh!==!0)for(let C=0,o=I.count;C<o;C++)A.isMesh===!0?A.getVertexPosition(C,Wt):Wt.fromBufferAttribute(I,C),Wt.applyMatrix4(A.matrixWorld),this.expandByPoint(Wt);else A.boundingBox!==void 0?(A.boundingBox===null&&A.computeBoundingBox(),jo.copy(A.boundingBox)):(t.boundingBox===null&&t.computeBoundingBox(),jo.copy(t.boundingBox)),jo.applyMatrix4(A.matrixWorld),this.union(jo)}const g=A.children;for(let I=0,C=g.length;I<C;I++)this.expandByObject(g[I],e);return this}containsPoint(A){return A.x>=this.min.x&&A.x<=this.max.x&&A.y>=this.min.y&&A.y<=this.max.y&&A.z>=this.min.z&&A.z<=this.max.z}containsBox(A){return this.min.x<=A.min.x&&A.max.x<=this.max.x&&this.min.y<=A.min.y&&A.max.y<=this.max.y&&this.min.z<=A.min.z&&A.max.z<=this.max.z}getParameter(A,e){return e.set((A.x-this.min.x)/(this.max.x-this.min.x),(A.y-this.min.y)/(this.max.y-this.min.y),(A.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(A){return A.max.x>=this.min.x&&A.min.x<=this.max.x&&A.max.y>=this.min.y&&A.min.y<=this.max.y&&A.max.z>=this.min.z&&A.min.z<=this.max.z}intersectsSphere(A){return this.clampPoint(A.center,Wt),Wt.distanceToSquared(A.center)<=A.radius*A.radius}intersectsPlane(A){let e,t;return A.normal.x>0?(e=A.normal.x*this.min.x,t=A.normal.x*this.max.x):(e=A.normal.x*this.max.x,t=A.normal.x*this.min.x),A.normal.y>0?(e+=A.normal.y*this.min.y,t+=A.normal.y*this.max.y):(e+=A.normal.y*this.max.y,t+=A.normal.y*this.min.y),A.normal.z>0?(e+=A.normal.z*this.min.z,t+=A.normal.z*this.max.z):(e+=A.normal.z*this.max.z,t+=A.normal.z*this.min.z),e<=-A.constant&&t>=-A.constant}intersectsTriangle(A){if(this.isEmpty())return!1;this.getCenter(pC),Wo.subVectors(this.max,pC),wI.subVectors(A.a,pC),mI.subVectors(A.b,pC),yI.subVectors(A.c,pC),Bg.subVectors(mI,wI),Eg.subVectors(yI,mI),Jg.subVectors(wI,yI);let e=[0,-Bg.z,Bg.y,0,-Eg.z,Eg.y,0,-Jg.z,Jg.y,Bg.z,0,-Bg.x,Eg.z,0,-Eg.x,Jg.z,0,-Jg.x,-Bg.y,Bg.x,0,-Eg.y,Eg.x,0,-Jg.y,Jg.x,0];return!mQ(e,wI,mI,yI,Wo)||(e=[1,0,0,0,1,0,0,0,1],!mQ(e,wI,mI,yI,Wo))?!1:(Xo.crossVectors(Bg,Eg),e=[Xo.x,Xo.y,Xo.z],mQ(e,wI,mI,yI,Wo))}clampPoint(A,e){return e.copy(A).clamp(this.min,this.max)}distanceToPoint(A){return this.clampPoint(A,Wt).distanceTo(A)}getBoundingSphere(A){return this.isEmpty()?A.makeEmpty():(this.getCenter(A.center),A.radius=this.getSize(Wt).length()*.5),A}intersect(A){return this.min.max(A.min),this.max.min(A.max),this.isEmpty()&&this.makeEmpty(),this}union(A){return this.min.min(A.min),this.max.max(A.max),this}applyMatrix4(A){return this.isEmpty()?this:(Yi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(A),Yi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(A),Yi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(A),Yi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(A),Yi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(A),Yi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(A),Yi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(A),Yi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(A),this.setFromPoints(Yi),this)}translate(A){return this.min.add(A),this.max.add(A),this}equals(A){return A.min.equals(this.min)&&A.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(A){return this.min.fromArray(A.min),this.max.fromArray(A.max),this}}const Yi=[new J,new J,new J,new J,new J,new J,new J,new J],Wt=new J,jo=new _C,wI=new J,mI=new J,yI=new J,Bg=new J,Eg=new J,Jg=new J,pC=new J,Wo=new J,Xo=new J,Yg=new J;function mQ(i,A,e,t,g){for(let I=0,C=i.length-3;I<=C;I+=3){Yg.fromArray(i,I);const o=g.x*Math.abs(Yg.x)+g.y*Math.abs(Yg.y)+g.z*Math.abs(Yg.z),n=A.dot(Yg),a=e.dot(Yg),s=t.dot(Yg);if(Math.max(-Math.max(n,a,s),Math.min(n,a,s))>o)return!1}return!0}const HD=new _C,wC=new J,yQ=new J;class bQ{constructor(A=new J,e=-1){this.isSphere=!0,this.center=A,this.radius=e}set(A,e){return this.center.copy(A),this.radius=e,this}setFromPoints(A,e){const t=this.center;e!==void 0?t.copy(e):HD.setFromPoints(A).getCenter(t);let g=0;for(let I=0,C=A.length;I<C;I++)g=Math.max(g,t.distanceToSquared(A[I]));return this.radius=Math.sqrt(g),this}copy(A){return this.center.copy(A.center),this.radius=A.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(A){return A.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(A){return A.distanceTo(this.center)-this.radius}intersectsSphere(A){const e=this.radius+A.radius;return A.center.distanceToSquared(this.center)<=e*e}intersectsBox(A){return A.intersectsSphere(this)}intersectsPlane(A){return Math.abs(A.distanceToPoint(this.center))<=this.radius}clampPoint(A,e){const t=this.center.distanceToSquared(A);return e.copy(A),t>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(A){return this.isEmpty()?(A.makeEmpty(),A):(A.set(this.center,this.center),A.expandByScalar(this.radius),A)}applyMatrix4(A){return this.center.applyMatrix4(A),this.radius=this.radius*A.getMaxScaleOnAxis(),this}translate(A){return this.center.add(A),this}expandByPoint(A){if(this.isEmpty())return this.center.copy(A),this.radius=0,this;wC.subVectors(A,this.center);const e=wC.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),g=(t-this.radius)*.5;this.center.addScaledVector(wC,g/t),this.radius+=g}return this}union(A){return A.isEmpty()?this:this.isEmpty()?(this.copy(A),this):(this.center.equals(A.center)===!0?this.radius=Math.max(this.radius,A.radius):(yQ.subVectors(A.center,this.center).setLength(A.radius),this.expandByPoint(wC.copy(A.center).add(yQ)),this.expandByPoint(wC.copy(A.center).sub(yQ))),this)}equals(A){return A.center.equals(this.center)&&A.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(A){return this.radius=A.radius,this.center.fromArray(A.center),this}}const Ti=new J,NQ=new J,Zo=new J,cg=new J,kQ=new J,zo=new J,SQ=new J;class PD{constructor(A=new J,e=new J(0,0,-1)){this.origin=A,this.direction=e}set(A,e){return this.origin.copy(A),this.direction.copy(e),this}copy(A){return this.origin.copy(A.origin),this.direction.copy(A.direction),this}at(A,e){return e.copy(this.origin).addScaledVector(this.direction,A)}lookAt(A){return this.direction.copy(A).sub(this.origin).normalize(),this}recast(A){return this.origin.copy(this.at(A,Ti)),this}closestPointToPoint(A,e){e.subVectors(A,this.origin);const t=e.dot(this.direction);return t<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,t)}distanceToPoint(A){return Math.sqrt(this.distanceSqToPoint(A))}distanceSqToPoint(A){const e=Ti.subVectors(A,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(A):(Ti.copy(this.origin).addScaledVector(this.direction,e),Ti.distanceToSquared(A))}distanceSqToSegment(A,e,t,g){NQ.copy(A).add(e).multiplyScalar(.5),Zo.copy(e).sub(A).normalize(),cg.copy(this.origin).sub(NQ);const I=A.distanceTo(e)*.5,C=-this.direction.dot(Zo),o=cg.dot(this.direction),n=-cg.dot(Zo),a=cg.lengthSq(),s=Math.abs(1-C*C);let Q,r,B,h;if(s>0)if(Q=C*n-o,r=C*o-n,h=I*s,Q>=0)if(r>=-h)if(r<=h){const c=1/s;Q*=c,r*=c,B=Q*(Q+C*r+2*o)+r*(C*Q+r+2*n)+a}else r=I,Q=Math.max(0,-(C*r+o)),B=-Q*Q+r*(r+2*n)+a;else r=-I,Q=Math.max(0,-(C*r+o)),B=-Q*Q+r*(r+2*n)+a;else r<=-h?(Q=Math.max(0,-(-C*I+o)),r=Q>0?-I:Math.min(Math.max(-I,-n),I),B=-Q*Q+r*(r+2*n)+a):r<=h?(Q=0,r=Math.min(Math.max(-I,-n),I),B=r*(r+2*n)+a):(Q=Math.max(0,-(C*I+o)),r=Q>0?I:Math.min(Math.max(-I,-n),I),B=-Q*Q+r*(r+2*n)+a);else r=C>0?-I:I,Q=Math.max(0,-(C*r+o)),B=-Q*Q+r*(r+2*n)+a;return t&&t.copy(this.origin).addScaledVector(this.direction,Q),g&&g.copy(NQ).addScaledVector(Zo,r),B}intersectSphere(A,e){Ti.subVectors(A.center,this.origin);const t=Ti.dot(this.direction),g=Ti.dot(Ti)-t*t,I=A.radius*A.radius;if(g>I)return null;const C=Math.sqrt(I-g),o=t-C,n=t+C;return n<0?null:o<0?this.at(n,e):this.at(o,e)}intersectsSphere(A){return A.radius<0?!1:this.distanceSqToPoint(A.center)<=A.radius*A.radius}distanceToPlane(A){const e=A.normal.dot(this.direction);if(e===0)return A.distanceToPoint(this.origin)===0?0:null;const t=-(this.origin.dot(A.normal)+A.constant)/e;return t>=0?t:null}intersectPlane(A,e){const t=this.distanceToPlane(A);return t===null?null:this.at(t,e)}intersectsPlane(A){const e=A.distanceToPoint(this.origin);return e===0||A.normal.dot(this.direction)*e<0}intersectBox(A,e){let t,g,I,C,o,n;const a=1/this.direction.x,s=1/this.direction.y,Q=1/this.direction.z,r=this.origin;return a>=0?(t=(A.min.x-r.x)*a,g=(A.max.x-r.x)*a):(t=(A.max.x-r.x)*a,g=(A.min.x-r.x)*a),s>=0?(I=(A.min.y-r.y)*s,C=(A.max.y-r.y)*s):(I=(A.max.y-r.y)*s,C=(A.min.y-r.y)*s),t>C||I>g||((I>t||isNaN(t))&&(t=I),(C<g||isNaN(g))&&(g=C),Q>=0?(o=(A.min.z-r.z)*Q,n=(A.max.z-r.z)*Q):(o=(A.max.z-r.z)*Q,n=(A.min.z-r.z)*Q),t>n||o>g)||((o>t||t!==t)&&(t=o),(n<g||g!==g)&&(g=n),g<0)?null:this.at(t>=0?t:g,e)}intersectsBox(A){return this.intersectBox(A,Ti)!==null}intersectTriangle(A,e,t,g,I){kQ.subVectors(e,A),zo.subVectors(t,A),SQ.crossVectors(kQ,zo);let C=this.direction.dot(SQ),o;if(C>0){if(g)return null;o=1}else if(C<0)o=-1,C=-C;else return null;cg.subVectors(this.origin,A);const n=o*this.direction.dot(zo.crossVectors(cg,zo));if(n<0)return null;const a=o*this.direction.dot(kQ.cross(cg));if(a<0||n+a>C)return null;const s=-o*cg.dot(SQ);return s<0?null:this.at(s/C,I)}applyMatrix4(A){return this.origin.applyMatrix4(A),this.direction.transformDirection(A),this}equals(A){return A.origin.equals(this.origin)&&A.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Ye{constructor(A,e,t,g,I,C,o,n,a,s,Q,r,B,h,c,d){Ye.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],A!==void 0&&this.set(A,e,t,g,I,C,o,n,a,s,Q,r,B,h,c,d)}set(A,e,t,g,I,C,o,n,a,s,Q,r,B,h,c,d){const E=this.elements;return E[0]=A,E[4]=e,E[8]=t,E[12]=g,E[1]=I,E[5]=C,E[9]=o,E[13]=n,E[2]=a,E[6]=s,E[10]=Q,E[14]=r,E[3]=B,E[7]=h,E[11]=c,E[15]=d,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 Ye().fromArray(this.elements)}copy(A){const e=this.elements,t=A.elements;return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],this}copyPosition(A){const e=this.elements,t=A.elements;return e[12]=t[12],e[13]=t[13],e[14]=t[14],this}setFromMatrix3(A){const e=A.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(A,e,t){return this.determinant()===0?(A.set(1,0,0),e.set(0,1,0),t.set(0,0,1),this):(A.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),t.setFromMatrixColumn(this,2),this)}makeBasis(A,e,t){return this.set(A.x,e.x,t.x,0,A.y,e.y,t.y,0,A.z,e.z,t.z,0,0,0,0,1),this}extractRotation(A){if(A.determinant()===0)return this.identity();const e=this.elements,t=A.elements,g=1/bI.setFromMatrixColumn(A,0).length(),I=1/bI.setFromMatrixColumn(A,1).length(),C=1/bI.setFromMatrixColumn(A,2).length();return e[0]=t[0]*g,e[1]=t[1]*g,e[2]=t[2]*g,e[3]=0,e[4]=t[4]*I,e[5]=t[5]*I,e[6]=t[6]*I,e[7]=0,e[8]=t[8]*C,e[9]=t[9]*C,e[10]=t[10]*C,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(A){const e=this.elements,t=A.x,g=A.y,I=A.z,C=Math.cos(t),o=Math.sin(t),n=Math.cos(g),a=Math.sin(g),s=Math.cos(I),Q=Math.sin(I);if(A.order==="XYZ"){const r=C*s,B=C*Q,h=o*s,c=o*Q;e[0]=n*s,e[4]=-n*Q,e[8]=a,e[1]=B+h*a,e[5]=r-c*a,e[9]=-o*n,e[2]=c-r*a,e[6]=h+B*a,e[10]=C*n}else if(A.order==="YXZ"){const r=n*s,B=n*Q,h=a*s,c=a*Q;e[0]=r+c*o,e[4]=h*o-B,e[8]=C*a,e[1]=C*Q,e[5]=C*s,e[9]=-o,e[2]=B*o-h,e[6]=c+r*o,e[10]=C*n}else if(A.order==="ZXY"){const r=n*s,B=n*Q,h=a*s,c=a*Q;e[0]=r-c*o,e[4]=-C*Q,e[8]=h+B*o,e[1]=B+h*o,e[5]=C*s,e[9]=c-r*o,e[2]=-C*a,e[6]=o,e[10]=C*n}else if(A.order==="ZYX"){const r=C*s,B=C*Q,h=o*s,c=o*Q;e[0]=n*s,e[4]=h*a-B,e[8]=r*a+c,e[1]=n*Q,e[5]=c*a+r,e[9]=B*a-h,e[2]=-a,e[6]=o*n,e[10]=C*n}else if(A.order==="YZX"){const r=C*n,B=C*a,h=o*n,c=o*a;e[0]=n*s,e[4]=c-r*Q,e[8]=h*Q+B,e[1]=Q,e[5]=C*s,e[9]=-o*s,e[2]=-a*s,e[6]=B*Q+h,e[10]=r-c*Q}else if(A.order==="XZY"){const r=C*n,B=C*a,h=o*n,c=o*a;e[0]=n*s,e[4]=-Q,e[8]=a*s,e[1]=r*Q+c,e[5]=C*s,e[9]=B*Q-h,e[2]=h*Q-B,e[6]=o*s,e[10]=c*Q+r}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(A){return this.compose(OD,A,VD)}lookAt(A,e,t){const g=this.elements;return yt.subVectors(A,e),yt.lengthSq()===0&&(yt.z=1),yt.normalize(),dg.crossVectors(t,yt),dg.lengthSq()===0&&(Math.abs(t.z)===1?yt.x+=1e-4:yt.z+=1e-4,yt.normalize(),dg.crossVectors(t,yt)),dg.normalize(),$o.crossVectors(yt,dg),g[0]=dg.x,g[4]=$o.x,g[8]=yt.x,g[1]=dg.y,g[5]=$o.y,g[9]=yt.y,g[2]=dg.z,g[6]=$o.z,g[10]=yt.z,this}multiply(A){return this.multiplyMatrices(this,A)}premultiply(A){return this.multiplyMatrices(A,this)}multiplyMatrices(A,e){const t=A.elements,g=e.elements,I=this.elements,C=t[0],o=t[4],n=t[8],a=t[12],s=t[1],Q=t[5],r=t[9],B=t[13],h=t[2],c=t[6],d=t[10],E=t[14],u=t[3],_=t[7],x=t[11],D=t[15],w=g[0],y=g[4],S=g[8],l=g[12],p=g[1],N=g[5],U=g[9],v=g[13],P=g[2],W=g[6],H=g[10],O=g[14],z=g[3],lA=g[7],QA=g[11],uA=g[15];return I[0]=C*w+o*p+n*P+a*z,I[4]=C*y+o*N+n*W+a*lA,I[8]=C*S+o*U+n*H+a*QA,I[12]=C*l+o*v+n*O+a*uA,I[1]=s*w+Q*p+r*P+B*z,I[5]=s*y+Q*N+r*W+B*lA,I[9]=s*S+Q*U+r*H+B*QA,I[13]=s*l+Q*v+r*O+B*uA,I[2]=h*w+c*p+d*P+E*z,I[6]=h*y+c*N+d*W+E*lA,I[10]=h*S+c*U+d*H+E*QA,I[14]=h*l+c*v+d*O+E*uA,I[3]=u*w+_*p+x*P+D*z,I[7]=u*y+_*N+x*W+D*lA,I[11]=u*S+_*U+x*H+D*QA,I[15]=u*l+_*v+x*O+D*uA,this}multiplyScalar(A){const e=this.elements;return e[0]*=A,e[4]*=A,e[8]*=A,e[12]*=A,e[1]*=A,e[5]*=A,e[9]*=A,e[13]*=A,e[2]*=A,e[6]*=A,e[10]*=A,e[14]*=A,e[3]*=A,e[7]*=A,e[11]*=A,e[15]*=A,this}determinant(){const A=this.elements,e=A[0],t=A[4],g=A[8],I=A[12],C=A[1],o=A[5],n=A[9],a=A[13],s=A[2],Q=A[6],r=A[10],B=A[14],h=A[3],c=A[7],d=A[11],E=A[15],u=n*B-a*r,_=o*B-a*Q,x=o*r-n*Q,D=C*B-a*s,w=C*r-n*s,y=C*Q-o*s;return e*(c*u-d*_+E*x)-t*(h*u-d*D+E*w)+g*(h*_-c*D+E*y)-I*(h*x-c*w+d*y)}transpose(){const A=this.elements;let e;return e=A[1],A[1]=A[4],A[4]=e,e=A[2],A[2]=A[8],A[8]=e,e=A[6],A[6]=A[9],A[9]=e,e=A[3],A[3]=A[12],A[12]=e,e=A[7],A[7]=A[13],A[13]=e,e=A[11],A[11]=A[14],A[14]=e,this}setPosition(A,e,t){const g=this.elements;return A.isVector3?(g[12]=A.x,g[13]=A.y,g[14]=A.z):(g[12]=A,g[13]=e,g[14]=t),this}invert(){const A=this.elements,e=A[0],t=A[1],g=A[2],I=A[3],C=A[4],o=A[5],n=A[6],a=A[7],s=A[8],Q=A[9],r=A[10],B=A[11],h=A[12],c=A[13],d=A[14],E=A[15],u=Q*d*a-c*r*a+c*n*B-o*d*B-Q*n*E+o*r*E,_=h*r*a-s*d*a-h*n*B+C*d*B+s*n*E-C*r*E,x=s*c*a-h*Q*a+h*o*B-C*c*B-s*o*E+C*Q*E,D=h*Q*n-s*c*n-h*o*r+C*c*r+s*o*d-C*Q*d,w=e*u+t*_+g*x+I*D;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const y=1/w;return A[0]=u*y,A[1]=(c*r*I-Q*d*I-c*g*B+t*d*B+Q*g*E-t*r*E)*y,A[2]=(o*d*I-c*n*I+c*g*a-t*d*a-o*g*E+t*n*E)*y,A[3]=(Q*n*I-o*r*I-Q*g*a+t*r*a+o*g*B-t*n*B)*y,A[4]=_*y,A[5]=(s*d*I-h*r*I+h*g*B-e*d*B-s*g*E+e*r*E)*y,A[6]=(h*n*I-C*d*I-h*g*a+e*d*a+C*g*E-e*n*E)*y,A[7]=(C*r*I-s*n*I+s*g*a-e*r*a-C*g*B+e*n*B)*y,A[8]=x*y,A[9]=(h*Q*I-s*c*I-h*t*B+e*c*B+s*t*E-e*Q*E)*y,A[10]=(C*c*I-h*o*I+h*t*a-e*c*a-C*t*E+e*o*E)*y,A[11]=(s*o*I-C*Q*I-s*t*a+e*Q*a+C*t*B-e*o*B)*y,A[12]=D*y,A[13]=(s*c*g-h*Q*g+h*t*r-e*c*r-s*t*d+e*Q*d)*y,A[14]=(h*o*g-C*c*g-h*t*n+e*c*n+C*t*d-e*o*d)*y,A[15]=(C*Q*g-s*o*g+s*t*n-e*Q*n-C*t*r+e*o*r)*y,this}scale(A){const e=this.elements,t=A.x,g=A.y,I=A.z;return e[0]*=t,e[4]*=g,e[8]*=I,e[1]*=t,e[5]*=g,e[9]*=I,e[2]*=t,e[6]*=g,e[10]*=I,e[3]*=t,e[7]*=g,e[11]*=I,this}getMaxScaleOnAxis(){const A=this.elements,e=A[0]*A[0]+A[1]*A[1]+A[2]*A[2],t=A[4]*A[4]+A[5]*A[5]+A[6]*A[6],g=A[8]*A[8]+A[9]*A[9]+A[10]*A[10];return Math.sqrt(Math.max(e,t,g))}makeTranslation(A,e,t){return A.isVector3?this.set(1,0,0,A.x,0,1,0,A.y,0,0,1,A.z,0,0,0,1):this.set(1,0,0,A,0,1,0,e,0,0,1,t,0,0,0,1),this}makeRotationX(A){const e=Math.cos(A),t=Math.sin(A);return this.set(1,0,0,0,0,e,-t,0,0,t,e,0,0,0,0,1),this}makeRotationY(A){const e=Math.cos(A),t=Math.sin(A);return this.set(e,0,t,0,0,1,0,0,-t,0,e,0,0,0,0,1),this}makeRotationZ(A){const e=Math.cos(A),t=Math.sin(A);return this.set(e,-t,0,0,t,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(A,e){const t=Math.cos(e),g=Math.sin(e),I=1-t,C=A.x,o=A.y,n=A.z,a=I*C,s=I*o;return this.set(a*C+t,a*o-g*n,a*n+g*o,0,a*o+g*n,s*o+t,s*n-g*C,0,a*n-g*o,s*n+g*C,I*n*n+t,0,0,0,0,1),this}makeScale(A,e,t){return this.set(A,0,0,0,0,e,0,0,0,0,t,0,0,0,0,1),this}makeShear(A,e,t,g,I,C){return this.set(1,t,I,0,A,1,C,0,e,g,1,0,0,0,0,1),this}compose(A,e,t){const g=this.elements,I=e._x,C=e._y,o=e._z,n=e._w,a=I+I,s=C+C,Q=o+o,r=I*a,B=I*s,h=I*Q,c=C*s,d=C*Q,E=o*Q,u=n*a,_=n*s,x=n*Q,D=t.x,w=t.y,y=t.z;return g[0]=(1-(c+E))*D,g[1]=(B+x)*D,g[2]=(h-_)*D,g[3]=0,g[4]=(B-x)*w,g[5]=(1-(r+E))*w,g[6]=(d+u)*w,g[7]=0,g[8]=(h+_)*y,g[9]=(d-u)*y,g[10]=(1-(r+c))*y,g[11]=0,g[12]=A.x,g[13]=A.y,g[14]=A.z,g[15]=1,this}decompose(A,e,t){const g=this.elements;if(A.x=g[12],A.y=g[13],A.z=g[14],this.determinant()===0)return t.set(1,1,1),e.identity(),this;let I=bI.set(g[0],g[1],g[2]).length();const C=bI.set(g[4],g[5],g[6]).length(),o=bI.set(g[8],g[9],g[10]).length();this.determinant()<0&&(I=-I),Xt.copy(this);const a=1/I,s=1/C,Q=1/o;return Xt.elements[0]*=a,Xt.elements[1]*=a,Xt.elements[2]*=a,Xt.elements[4]*=s,Xt.elements[5]*=s,Xt.elements[6]*=s,Xt.elements[8]*=Q,Xt.elements[9]*=Q,Xt.elements[10]*=Q,e.setFromRotationMatrix(Xt),t.x=I,t.y=C,t.z=o,this}makePerspective(A,e,t,g,I,C,o=ci,n=!1){const a=this.elements,s=2*I/(e-A),Q=2*I/(t-g),r=(e+A)/(e-A),B=(t+g)/(t-g);let h,c;if(n)h=I/(C-I),c=C*I/(C-I);else if(o===ci)h=-(C+I)/(C-I),c=-2*C*I/(C-I);else if(o===Oo)h=-C/(C-I),c=-C*I/(C-I);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return a[0]=s,a[4]=0,a[8]=r,a[12]=0,a[1]=0,a[5]=Q,a[9]=B,a[13]=0,a[2]=0,a[6]=0,a[10]=h,a[14]=c,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(A,e,t,g,I,C,o=ci,n=!1){const a=this.elements,s=2/(e-A),Q=2/(t-g),r=-(e+A)/(e-A),B=-(t+g)/(t-g);let h,c;if(n)h=1/(C-I),c=C/(C-I);else if(o===ci)h=-2/(C-I),c=-(C+I)/(C-I);else if(o===Oo)h=-1/(C-I),c=-I/(C-I);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return a[0]=s,a[4]=0,a[8]=0,a[12]=r,a[1]=0,a[5]=Q,a[9]=0,a[13]=B,a[2]=0,a[6]=0,a[10]=h,a[14]=c,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(A){const e=this.elements,t=A.elements;for(let g=0;g<16;g++)if(e[g]!==t[g])return!1;return!0}fromArray(A,e=0){for(let t=0;t<16;t++)this.elements[t]=A[t+e];return this}toArray(A=[],e=0){const t=this.elements;return A[e]=t[0],A[e+1]=t[1],A[e+2]=t[2],A[e+3]=t[3],A[e+4]=t[4],A[e+5]=t[5],A[e+6]=t[6],A[e+7]=t[7],A[e+8]=t[8],A[e+9]=t[9],A[e+10]=t[10],A[e+11]=t[11],A[e+12]=t[12],A[e+13]=t[13],A[e+14]=t[14],A[e+15]=t[15],A}}const bI=new J,Xt=new Ye,OD=new J(0,0,0),VD=new J(1,1,1),dg=new J,$o=new J,yt=new J,hc=new Ye,lc=new DC;class qi{constructor(A=0,e=0,t=0,g=qi.DEFAULT_ORDER){this.isEuler=!0,this._x=A,this._y=e,this._z=t,this._order=g}get x(){return this._x}set x(A){this._x=A,this._onChangeCallback()}get y(){return this._y}set y(A){this._y=A,this._onChangeCallback()}get z(){return this._z}set z(A){this._z=A,this._onChangeCallback()}get order(){return this._order}set order(A){this._order=A,this._onChangeCallback()}set(A,e,t,g=this._order){return this._x=A,this._y=e,this._z=t,this._order=g,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(A){return this._x=A._x,this._y=A._y,this._z=A._z,this._order=A._order,this._onChangeCallback(),this}setFromRotationMatrix(A,e=this._order,t=!0){const g=A.elements,I=g[0],C=g[4],o=g[8],n=g[1],a=g[5],s=g[9],Q=g[2],r=g[6],B=g[10];switch(e){case"XYZ":this._y=Math.asin(ie(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-s,B),this._z=Math.atan2(-C,I)):(this._x=Math.atan2(r,a),this._z=0);break;case"YXZ":this._x=Math.asin(-ie(s,-1,1)),Math.abs(s)<.9999999?(this._y=Math.atan2(o,B),this._z=Math.atan2(n,a)):(this._y=Math.atan2(-Q,I),this._z=0);break;case"ZXY":this._x=Math.asin(ie(r,-1,1)),Math.abs(r)<.9999999?(this._y=Math.atan2(-Q,B),this._z=Math.atan2(-C,a)):(this._y=0,this._z=Math.atan2(n,I));break;case"ZYX":this._y=Math.asin(-ie(Q,-1,1)),Math.abs(Q)<.9999999?(this._x=Math.atan2(r,B),this._z=Math.atan2(n,I)):(this._x=0,this._z=Math.atan2(-C,a));break;case"YZX":this._z=Math.asin(ie(n,-1,1)),Math.abs(n)<.9999999?(this._x=Math.atan2(-s,a),this._y=Math.atan2(-Q,I)):(this._x=0,this._y=Math.atan2(o,B));break;case"XZY":this._z=Math.asin(-ie(C,-1,1)),Math.abs(C)<.9999999?(this._x=Math.atan2(r,a),this._y=Math.atan2(o,I)):(this._x=Math.atan2(-s,B),this._y=0);break;default:KA("Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,t===!0&&this._onChangeCallback(),this}setFromQuaternion(A,e,t){return hc.makeRotationFromQuaternion(A),this.setFromRotationMatrix(hc,e,t)}setFromVector3(A,e=this._order){return this.set(A.x,A.y,A.z,e)}reorder(A){return lc.setFromEuler(this),this.setFromQuaternion(lc,A)}equals(A){return A._x===this._x&&A._y===this._y&&A._z===this._z&&A._order===this._order}fromArray(A){return this._x=A[0],this._y=A[1],this._z=A[2],A[3]!==void 0&&(this._order=A[3]),this._onChangeCallback(),this}toArray(A=[],e=0){return A[e]=this._x,A[e+1]=this._y,A[e+2]=this._z,A[e+3]=this._order,A}_onChange(A){return this._onChangeCallback=A,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}qi.DEFAULT_ORDER="XYZ";class xc{constructor(){this.mask=1}set(A){this.mask=(1<<A|0)>>>0}enable(A){this.mask|=1<<A|0}enableAll(){this.mask=-1}toggle(A){this.mask^=1<<A|0}disable(A){this.mask&=~(1<<A|0)}disableAll(){this.mask=0}test(A){return(this.mask&A.mask)!==0}isEnabled(A){return(this.mask&(1<<A|0))!==0}}let jD=0;const uc=new J,NI=new DC,Hi=new Ye,An=new J,mC=new J,WD=new J,XD=new DC,fc=new J(1,0,0),Dc=new J(0,1,0),_c=new J(0,0,1),pc={type:"added"},ZD={type:"removed"},kI={type:"childadded",child:null},RQ={type:"childremoved",child:null};class bt extends DI{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:jD++}),this.uuid=uC(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=bt.DEFAULT_UP.clone();const A=new J,e=new qi,t=new DC,g=new J(1,1,1);function I(){t.setFromEuler(e,!1)}function C(){e.setFromQuaternion(t,void 0,!1)}e._onChange(I),t._onChange(C),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:A},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:t},scale:{configurable:!0,enumerable:!0,value:g},modelViewMatrix:{value:new Ye},normalMatrix:{value:new qA}}),this.matrix=new Ye,this.matrixWorld=new Ye,this.matrixAutoUpdate=bt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=bt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new xc,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(A){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(A),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(A){return this.quaternion.premultiply(A),this}setRotationFromAxisAngle(A,e){this.quaternion.setFromAxisAngle(A,e)}setRotationFromEuler(A){this.quaternion.setFromEuler(A,!0)}setRotationFromMatrix(A){this.quaternion.setFromRotationMatrix(A)}setRotationFromQuaternion(A){this.quaternion.copy(A)}rotateOnAxis(A,e){return NI.setFromAxisAngle(A,e),this.quaternion.multiply(NI),this}rotateOnWorldAxis(A,e){return NI.setFromAxisAngle(A,e),this.quaternion.premultiply(NI),this}rotateX(A){return this.rotateOnAxis(fc,A)}rotateY(A){return this.rotateOnAxis(Dc,A)}rotateZ(A){return this.rotateOnAxis(_c,A)}translateOnAxis(A,e){return uc.copy(A).applyQuaternion(this.quaternion),this.position.add(uc.multiplyScalar(e)),this}translateX(A){return this.translateOnAxis(fc,A)}translateY(A){return this.translateOnAxis(Dc,A)}translateZ(A){return this.translateOnAxis(_c,A)}localToWorld(A){return this.updateWorldMatrix(!0,!1),A.applyMatrix4(this.matrixWorld)}worldToLocal(A){return this.updateWorldMatrix(!0,!1),A.applyMatrix4(Hi.copy(this.matrixWorld).invert())}lookAt(A,e,t){A.isVector3?An.copy(A):An.set(A,e,t);const g=this.parent;this.updateWorldMatrix(!0,!1),mC.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Hi.lookAt(mC,An,this.up):Hi.lookAt(An,mC,this.up),this.quaternion.setFromRotationMatrix(Hi),g&&(Hi.extractRotation(g.matrixWorld),NI.setFromRotationMatrix(Hi),this.quaternion.premultiply(NI.invert()))}add(A){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return A===this?(ae("Object3D.add: object can't be added as a child of itself.",A),this):(A&&A.isObject3D?(A.removeFromParent(),A.parent=this,this.children.push(A),A.dispatchEvent(pc),kI.child=A,this.dispatchEvent(kI),kI.child=null):ae("Object3D.add: object not an instance of THREE.Object3D.",A),this)}remove(A){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(A);return e!==-1&&(A.parent=null,this.children.splice(e,1),A.dispatchEvent(ZD),RQ.child=A,this.dispatchEvent(RQ),RQ.child=null),this}removeFromParent(){const A=this.parent;return A!==null&&A.remove(this),this}clear(){return this.remove(...this.children)}attach(A){return this.updateWorldMatrix(!0,!1),Hi.copy(this.matrixWorld).invert(),A.parent!==null&&(A.parent.updateWorldMatrix(!0,!1),Hi.multiply(A.parent.matrixWorld)),A.applyMatrix4(Hi),A.removeFromParent(),A.parent=this,this.children.push(A),A.updateWorldMatrix(!1,!0),A.dispatchEvent(pc),kI.child=A,this.dispatchEvent(kI),kI.child=null,this}getObjectById(A){return this.getObjectByProperty("id",A)}getObjectByName(A){return this.getObjectByProperty("name",A)}getObjectByProperty(A,e){if(this[A]===e)return this;for(let t=0,g=this.children.length;t<g;t++){const C=this.children[t].getObjectByProperty(A,e);if(C!==void 0)return C}}getObjectsByProperty(A,e,t=[]){this[A]===e&&t.push(this);const g=this.children;for(let I=0,C=g.length;I<C;I++)g[I].getObjectsByProperty(A,e,t);return t}getWorldPosition(A){return this.updateWorldMatrix(!0,!1),A.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(A){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(mC,A,WD),A}getWorldScale(A){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(mC,XD,A),A}getWorldDirection(A){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return A.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(A){A(this);const e=this.children;for(let t=0,g=e.length;t<g;t++)e[t].traverse(A)}traverseVisible(A){if(this.visible===!1)return;A(this);const e=this.children;for(let t=0,g=e.length;t<g;t++)e[t].traverseVisible(A)}traverseAncestors(A){const e=this.parent;e!==null&&(A(e),e.traverseAncestors(A))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(A){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||A)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,A=!0);const e=this.children;for(let t=0,g=e.length;t<g;t++)e[t].updateMatrixWorld(A)}updateWorldMatrix(A,e){const t=this.parent;if(A===!0&&t!==null&&t.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),e===!0){const g=this.children;for(let I=0,C=g.length;I<C;I++)g[I].updateWorldMatrix(!1,!0)}}toJSON(A){const e=A===void 0||typeof A=="string",t={};e&&(A={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},t.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const g={};g.uuid=this.uuid,g.type=this.type,this.name!==""&&(g.name=this.name),this.castShadow===!0&&(g.castShadow=!0),this.receiveShadow===!0&&(g.receiveShadow=!0),this.visible===!1&&(g.visible=!1),this.frustumCulled===!1&&(g.frustumCulled=!1),this.renderOrder!==0&&(g.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(g.userData=this.userData),g.layers=this.layers.mask,g.matrix=this.matrix.toArray(),g.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(g.matrixAutoUpdate=!1),this.isInstancedMesh&&(g.type="InstancedMesh",g.count=this.count,g.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(g.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(g.type="BatchedMesh",g.perObjectFrustumCulled=this.perObjectFrustumCulled,g.sortObjects=this.sortObjects,g.drawRanges=this._drawRanges,g.reservedRanges=this._reservedRanges,g.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),g.instanceInfo=this._instanceInfo.map(o=>({...o})),g.availableInstanceIds=this._availableInstanceIds.slice(),g.availableGeometryIds=this._availableGeometryIds.slice(),g.nextIndexStart=this._nextIndexStart,g.nextVertexStart=this._nextVertexStart,g.geometryCount=this._geometryCount,g.maxInstanceCount=this._maxInstanceCount,g.maxVertexCount=this._maxVertexCount,g.maxIndexCount=this._maxIndexCount,g.geometryInitialized=this._geometryInitialized,g.matricesTexture=this._matricesTexture.toJSON(A),g.indirectTexture=this._indirectTexture.toJSON(A),this._colorsTexture!==null&&(g.colorsTexture=this._colorsTexture.toJSON(A)),this.boundingSphere!==null&&(g.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(g.boundingBox=this.boundingBox.toJSON()));function I(o,n){return o[n.uuid]===void 0&&(o[n.uuid]=n.toJSON(A)),n.uuid}if(this.isScene)this.background&&(this.background.isColor?g.background=this.background.toJSON():this.background.isTexture&&(g.background=this.background.toJSON(A).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(g.environment=this.environment.toJSON(A).uuid);else if(this.isMesh||this.isLine||this.isPoints){g.geometry=I(A.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const n=o.shapes;if(Array.isArray(n))for(let a=0,s=n.length;a<s;a++){const Q=n[a];I(A.shapes,Q)}else I(A.shapes,n)}}if(this.isSkinnedMesh&&(g.bindMode=this.bindMode,g.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(I(A.skeletons,this.skeleton),g.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let n=0,a=this.material.length;n<a;n++)o.push(I(A.materials,this.material[n]));g.material=o}else g.material=I(A.materials,this.material);if(this.children.length>0){g.children=[];for(let o=0;o<this.children.length;o++)g.children.push(this.children[o].toJSON(A).object)}if(this.animations.length>0){g.animations=[];for(let o=0;o<this.animations.length;o++){const n=this.animations[o];g.animations.push(I(A.animations,n))}}if(e){const o=C(A.geometries),n=C(A.materials),a=C(A.textures),s=C(A.images),Q=C(A.shapes),r=C(A.skeletons),B=C(A.animations),h=C(A.nodes);o.length>0&&(t.geometries=o),n.length>0&&(t.materials=n),a.length>0&&(t.textures=a),s.length>0&&(t.images=s),Q.length>0&&(t.shapes=Q),r.length>0&&(t.skeletons=r),B.length>0&&(t.animations=B),h.length>0&&(t.nodes=h)}return t.object=g,t;function C(o){const n=[];for(const a in o){const s=o[a];delete s.metadata,n.push(s)}return n}}clone(A){return new this.constructor().copy(this,A)}copy(A,e=!0){if(this.name=A.name,this.up.copy(A.up),this.position.copy(A.position),this.rotation.order=A.rotation.order,this.quaternion.copy(A.quaternion),this.scale.copy(A.scale),this.matrix.copy(A.matrix),this.matrixWorld.copy(A.matrixWorld),this.matrixAutoUpdate=A.matrixAutoUpdate,this.matrixWorldAutoUpdate=A.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=A.matrixWorldNeedsUpdate,this.layers.mask=A.layers.mask,this.visible=A.visible,this.castShadow=A.castShadow,this.receiveShadow=A.receiveShadow,this.frustumCulled=A.frustumCulled,this.renderOrder=A.renderOrder,this.animations=A.animations.slice(),this.userData=JSON.parse(JSON.stringify(A.userData)),e===!0)for(let t=0;t<A.children.length;t++){const g=A.children[t];this.add(g.clone())}return this}}bt.DEFAULT_UP=new J(0,1,0),bt.DEFAULT_MATRIX_AUTO_UPDATE=!0,bt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Zt=new J,Pi=new J,GQ=new J,Oi=new J,SI=new J,RI=new J,wc=new J,MQ=new J,FQ=new J,UQ=new J,LQ=new ve,vQ=new ve,KQ=new ve;class zt{constructor(A=new J,e=new J,t=new J){this.a=A,this.b=e,this.c=t}static getNormal(A,e,t,g){g.subVectors(t,e),Zt.subVectors(A,e),g.cross(Zt);const I=g.lengthSq();return I>0?g.multiplyScalar(1/Math.sqrt(I)):g.set(0,0,0)}static getBarycoord(A,e,t,g,I){Zt.subVectors(g,e),Pi.subVectors(t,e),GQ.subVectors(A,e);const C=Zt.dot(Zt),o=Zt.dot(Pi),n=Zt.dot(GQ),a=Pi.dot(Pi),s=Pi.dot(GQ),Q=C*a-o*o;if(Q===0)return I.set(0,0,0),null;const r=1/Q,B=(a*n-o*s)*r,h=(C*s-o*n)*r;return I.set(1-B-h,h,B)}static containsPoint(A,e,t,g){return this.getBarycoord(A,e,t,g,Oi)===null?!1:Oi.x>=0&&Oi.y>=0&&Oi.x+Oi.y<=1}static getInterpolation(A,e,t,g,I,C,o,n){return this.getBarycoord(A,e,t,g,Oi)===null?(n.x=0,n.y=0,"z"in n&&(n.z=0),"w"in n&&(n.w=0),null):(n.setScalar(0),n.addScaledVector(I,Oi.x),n.addScaledVector(C,Oi.y),n.addScaledVector(o,Oi.z),n)}static getInterpolatedAttribute(A,e,t,g,I,C){return LQ.setScalar(0),vQ.setScalar(0),KQ.setScalar(0),LQ.fromBufferAttribute(A,e),vQ.fromBufferAttribute(A,t),KQ.fromBufferAttribute(A,g),C.setScalar(0),C.addScaledVector(LQ,I.x),C.addScaledVector(vQ,I.y),C.addScaledVector(KQ,I.z),C}static isFrontFacing(A,e,t,g){return Zt.subVectors(t,e),Pi.subVectors(A,e),Zt.cross(Pi).dot(g)<0}set(A,e,t){return this.a.copy(A),this.b.copy(e),this.c.copy(t),this}setFromPointsAndIndices(A,e,t,g){return this.a.copy(A[e]),this.b.copy(A[t]),this.c.copy(A[g]),this}setFromAttributeAndIndices(A,e,t,g){return this.a.fromBufferAttribute(A,e),this.b.fromBufferAttribute(A,t),this.c.fromBufferAttribute(A,g),this}clone(){return new this.constructor().copy(this)}copy(A){return this.a.copy(A.a),this.b.copy(A.b),this.c.copy(A.c),this}getArea(){return Zt.subVectors(this.c,this.b),Pi.subVectors(this.a,this.b),Zt.cross(Pi).length()*.5}getMidpoint(A){return A.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(A){return zt.getNormal(this.a,this.b,this.c,A)}getPlane(A){return A.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(A,e){return zt.getBarycoord(A,this.a,this.b,this.c,e)}getInterpolation(A,e,t,g,I){return zt.getInterpolation(A,this.a,this.b,this.c,e,t,g,I)}containsPoint(A){return zt.containsPoint(A,this.a,this.b,this.c)}isFrontFacing(A){return zt.isFrontFacing(this.a,this.b,this.c,A)}intersectsBox(A){return A.intersectsTriangle(this)}closestPointToPoint(A,e){const t=this.a,g=this.b,I=this.c;let C,o;SI.subVectors(g,t),RI.subVectors(I,t),MQ.subVectors(A,t);const n=SI.dot(MQ),a=RI.dot(MQ);if(n<=0&&a<=0)return e.copy(t);FQ.subVectors(A,g);const s=SI.dot(FQ),Q=RI.dot(FQ);if(s>=0&&Q<=s)return e.copy(g);const r=n*Q-s*a;if(r<=0&&n>=0&&s<=0)return C=n/(n-s),e.copy(t).addScaledVector(SI,C);UQ.subVectors(A,I);const B=SI.dot(UQ),h=RI.dot(UQ);if(h>=0&&B<=h)return e.copy(I);const c=B*a-n*h;if(c<=0&&a>=0&&h<=0)return o=a/(a-h),e.copy(t).addScaledVector(RI,o);const d=s*h-B*Q;if(d<=0&&Q-s>=0&&B-h>=0)return wc.subVectors(I,g),o=(Q-s)/(Q-s+(B-h)),e.copy(g).addScaledVector(wc,o);const E=1/(d+c+r);return C=c*E,o=r*E,e.copy(t).addScaledVector(SI,C).addScaledVector(RI,o)}equals(A){return A.a.equals(this.a)&&A.b.equals(this.b)&&A.c.equals(this.c)}}const mc={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},hg={h:0,s:0,l:0},en={h:0,s:0,l:0};function JQ(i,A,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?i+(A-i)*6*e:e<1/2?A:e<2/3?i+(A-i)*6*(2/3-e):i}class Ie{constructor(A,e,t){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(A,e,t)}set(A,e,t){if(e===void 0&&t===void 0){const g=A;g&&g.isColor?this.copy(g):typeof g=="number"?this.setHex(g):typeof g=="string"&&this.setStyle(g)}else this.setRGB(A,e,t);return this}setScalar(A){return this.r=A,this.g=A,this.b=A,this}setHex(A,e=Mt){return A=Math.floor(A),this.r=(A>>16&255)/255,this.g=(A>>8&255)/255,this.b=(A&255)/255,oe.colorSpaceToWorking(this,e),this}setRGB(A,e,t,g=oe.workingColorSpace){return this.r=A,this.g=e,this.b=t,oe.colorSpaceToWorking(this,g),this}setHSL(A,e,t,g=oe.workingColorSpace){if(A=LD(A,1),e=ie(e,0,1),t=ie(t,0,1),e===0)this.r=this.g=this.b=t;else{const I=t<=.5?t*(1+e):t+e-t*e,C=2*t-I;this.r=JQ(C,I,A+1/3),this.g=JQ(C,I,A),this.b=JQ(C,I,A-1/3)}return oe.colorSpaceToWorking(this,g),this}setStyle(A,e=Mt){function t(I){I!==void 0&&parseFloat(I)<1&&KA("Color: Alpha component of "+A+" will be ignored.")}let g;if(g=/^(\w+)\(([^\)]*)\)/.exec(A)){let I;const C=g[1],o=g[2];switch(C){case"rgb":case"rgba":if(I=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return t(I[4]),this.setRGB(Math.min(255,parseInt(I[1],10))/255,Math.min(255,parseInt(I[2],10))/255,Math.min(255,parseInt(I[3],10))/255,e);if(I=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return t(I[4]),this.setRGB(Math.min(100,parseInt(I[1],10))/100,Math.min(100,parseInt(I[2],10))/100,Math.min(100,parseInt(I[3],10))/100,e);break;case"hsl":case"hsla":if(I=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return t(I[4]),this.setHSL(parseFloat(I[1])/360,parseFloat(I[2])/100,parseFloat(I[3])/100,e);break;default:KA("Color: Unknown color model "+A)}}else if(g=/^\#([A-Fa-f\d]+)$/.exec(A)){const I=g[1],C=I.length;if(C===3)return this.setRGB(parseInt(I.charAt(0),16)/15,parseInt(I.charAt(1),16)/15,parseInt(I.charAt(2),16)/15,e);if(C===6)return this.setHex(parseInt(I,16),e);KA("Color: Invalid hex color "+A)}else if(A&&A.length>0)return this.setColorName(A,e);return this}setColorName(A,e=Mt){const t=mc[A.toLowerCase()];return t!==void 0?this.setHex(t,e):KA("Color: Unknown color "+A),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(A){return this.r=A.r,this.g=A.g,this.b=A.b,this}copySRGBToLinear(A){return this.r=Ji(A.r),this.g=Ji(A.g),this.b=Ji(A.b),this}copyLinearToSRGB(A){return this.r=_I(A.r),this.g=_I(A.g),this.b=_I(A.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(A=Mt){return oe.workingToColorSpace(gt.copy(this),A),Math.round(ie(gt.r*255,0,255))*65536+Math.round(ie(gt.g*255,0,255))*256+Math.round(ie(gt.b*255,0,255))}getHexString(A=Mt){return("000000"+this.getHex(A).toString(16)).slice(-6)}getHSL(A,e=oe.workingColorSpace){oe.workingToColorSpace(gt.copy(this),e);const t=gt.r,g=gt.g,I=gt.b,C=Math.max(t,g,I),o=Math.min(t,g,I);let n,a;const s=(o+C)/2;if(o===C)n=0,a=0;else{const Q=C-o;switch(a=s<=.5?Q/(C+o):Q/(2-C-o),C){case t:n=(g-I)/Q+(g<I?6:0);break;case g:n=(I-t)/Q+2;break;case I:n=(t-g)/Q+4;break}n/=6}return A.h=n,A.s=a,A.l=s,A}getRGB(A,e=oe.workingColorSpace){return oe.workingToColorSpace(gt.copy(this),e),A.r=gt.r,A.g=gt.g,A.b=gt.b,A}getStyle(A=Mt){oe.workingToColorSpace(gt.copy(this),A);const e=gt.r,t=gt.g,g=gt.b;return A!==Mt?`color(${A} ${e.toFixed(3)} ${t.toFixed(3)} ${g.toFixed(3)})`:`rgb(${Math.round(e*255)},${Math.round(t*255)},${Math.round(g*255)})`}offsetHSL(A,e,t){return this.getHSL(hg),this.setHSL(hg.h+A,hg.s+e,hg.l+t)}add(A){return this.r+=A.r,this.g+=A.g,this.b+=A.b,this}addColors(A,e){return this.r=A.r+e.r,this.g=A.g+e.g,this.b=A.b+e.b,this}addScalar(A){return this.r+=A,this.g+=A,this.b+=A,this}sub(A){return this.r=Math.max(0,this.r-A.r),this.g=Math.max(0,this.g-A.g),this.b=Math.max(0,this.b-A.b),this}multiply(A){return this.r*=A.r,this.g*=A.g,this.b*=A.b,this}multiplyScalar(A){return this.r*=A,this.g*=A,this.b*=A,this}lerp(A,e){return this.r+=(A.r-this.r)*e,this.g+=(A.g-this.g)*e,this.b+=(A.b-this.b)*e,this}lerpColors(A,e,t){return this.r=A.r+(e.r-A.r)*t,this.g=A.g+(e.g-A.g)*t,this.b=A.b+(e.b-A.b)*t,this}lerpHSL(A,e){this.getHSL(hg),A.getHSL(en);const t=uQ(hg.h,en.h,e),g=uQ(hg.s,en.s,e),I=uQ(hg.l,en.l,e);return this.setHSL(t,g,I),this}setFromVector3(A){return this.r=A.x,this.g=A.y,this.b=A.z,this}applyMatrix3(A){const e=this.r,t=this.g,g=this.b,I=A.elements;return this.r=I[0]*e+I[3]*t+I[6]*g,this.g=I[1]*e+I[4]*t+I[7]*g,this.b=I[2]*e+I[5]*t+I[8]*g,this}equals(A){return A.r===this.r&&A.g===this.g&&A.b===this.b}fromArray(A,e=0){return this.r=A[e],this.g=A[e+1],this.b=A[e+2],this}toArray(A=[],e=0){return A[e]=this.r,A[e+1]=this.g,A[e+2]=this.b,A}fromBufferAttribute(A,e){return this.r=A.getX(e),this.g=A.getY(e),this.b=A.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const gt=new Ie;Ie.NAMES=mc;let zD=0;class tn extends DI{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:zD++}),this.uuid=uC(),this.name="",this.type="Material",this.blending=dI,this.side=Mi,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=ls,this.blendDst=xs,this.blendEquation=Ug,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ie(0,0,0),this.blendAlpha=0,this.depthFunc=hI,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=oc,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=fI,this.stencilZFail=fI,this.stencilZPass=fI,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(A){this._alphaTest>0!=A>0&&this.version++,this._alphaTest=A}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(A){if(A!==void 0)for(const e in A){const t=A[e];if(t===void 0){KA(`Material: parameter '${e}' has value of undefined.`);continue}const g=this[e];if(g===void 0){KA(`Material: '${e}' is not a property of THREE.${this.type}.`);continue}g&&g.isColor?g.set(t):g&&g.isVector3&&t&&t.isVector3?g.copy(t):this[e]=t}}toJSON(A){const e=A===void 0||typeof A=="string";e&&(A={textures:{},images:{}});const t={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),this.color&&this.color.isColor&&(t.color=this.color.getHex()),this.roughness!==void 0&&(t.roughness=this.roughness),this.metalness!==void 0&&(t.metalness=this.metalness),this.sheen!==void 0&&(t.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(t.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(t.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(t.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(t.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(t.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(t.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(t.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(t.shininess=this.shininess),this.clearcoat!==void 0&&(t.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(t.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(t.clearcoatMap=this.clearcoatMap.toJSON(A).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(t.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(A).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(t.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(A).uuid,t.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(t.sheenColorMap=this.sheenColorMap.toJSON(A).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(t.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(A).uuid),this.dispersion!==void 0&&(t.dispersion=this.dispersion),this.iridescence!==void 0&&(t.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(t.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(t.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(t.iridescenceMap=this.iridescenceMap.toJSON(A).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(t.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(A).uuid),this.anisotropy!==void 0&&(t.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(t.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(t.anisotropyMap=this.anisotropyMap.toJSON(A).uuid),this.map&&this.map.isTexture&&(t.map=this.map.toJSON(A).uuid),this.matcap&&this.matcap.isTexture&&(t.matcap=this.matcap.toJSON(A).uuid),this.alphaMap&&this.alphaMap.isTexture&&(t.alphaMap=this.alphaMap.toJSON(A).uuid),this.lightMap&&this.lightMap.isTexture&&(t.lightMap=this.lightMap.toJSON(A).uuid,t.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(t.aoMap=this.aoMap.toJSON(A).uuid,t.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(t.bumpMap=this.bumpMap.toJSON(A).uuid,t.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(t.normalMap=this.normalMap.toJSON(A).uuid,t.normalMapType=this.normalMapType,t.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(t.displacementMap=this.displacementMap.toJSON(A).uuid,t.displacementScale=this.displacementScale,t.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(t.roughnessMap=this.roughnessMap.toJSON(A).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(t.metalnessMap=this.metalnessMap.toJSON(A).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(t.emissiveMap=this.emissiveMap.toJSON(A).uuid),this.specularMap&&this.specularMap.isTexture&&(t.specularMap=this.specularMap.toJSON(A).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(t.specularIntensityMap=this.specularIntensityMap.toJSON(A).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(t.specularColorMap=this.specularColorMap.toJSON(A).uuid),this.envMap&&this.envMap.isTexture&&(t.envMap=this.envMap.toJSON(A).uuid,this.combine!==void 0&&(t.combine=this.combine)),this.envMapRotation!==void 0&&(t.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(t.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(t.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(t.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(t.gradientMap=this.gradientMap.toJSON(A).uuid),this.transmission!==void 0&&(t.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(t.transmissionMap=this.transmissionMap.toJSON(A).uuid),this.thickness!==void 0&&(t.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(t.thicknessMap=this.thicknessMap.toJSON(A).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(t.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(t.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(t.size=this.size),this.shadowSide!==null&&(t.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(t.sizeAttenuation=this.sizeAttenuation),this.blending!==dI&&(t.blending=this.blending),this.side!==Mi&&(t.side=this.side),this.vertexColors===!0&&(t.vertexColors=!0),this.opacity<1&&(t.opacity=this.opacity),this.transparent===!0&&(t.transparent=!0),this.blendSrc!==ls&&(t.blendSrc=this.blendSrc),this.blendDst!==xs&&(t.blendDst=this.blendDst),this.blendEquation!==Ug&&(t.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(t.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(t.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(t.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(t.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(t.blendAlpha=this.blendAlpha),this.depthFunc!==hI&&(t.depthFunc=this.depthFunc),this.depthTest===!1&&(t.depthTest=this.depthTest),this.depthWrite===!1&&(t.depthWrite=this.depthWrite),this.colorWrite===!1&&(t.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(t.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==oc&&(t.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(t.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(t.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==fI&&(t.stencilFail=this.stencilFail),this.stencilZFail!==fI&&(t.stencilZFail=this.stencilZFail),this.stencilZPass!==fI&&(t.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(t.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(t.rotation=this.rotation),this.polygonOffset===!0&&(t.polygonOffset=!0),this.polygonOffsetFactor!==0&&(t.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(t.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(t.linewidth=this.linewidth),this.dashSize!==void 0&&(t.dashSize=this.dashSize),this.gapSize!==void 0&&(t.gapSize=this.gapSize),this.scale!==void 0&&(t.scale=this.scale),this.dithering===!0&&(t.dithering=!0),this.alphaTest>0&&(t.alphaTest=this.alphaTest),this.alphaHash===!0&&(t.alphaHash=!0),this.alphaToCoverage===!0&&(t.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(t.premultipliedAlpha=!0),this.forceSinglePass===!0&&(t.forceSinglePass=!0),this.allowOverride===!1&&(t.allowOverride=!1),this.wireframe===!0&&(t.wireframe=!0),this.wireframeLinewidth>1&&(t.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(t.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(t.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(t.flatShading=!0),this.visible===!1&&(t.visible=!1),this.toneMapped===!1&&(t.toneMapped=!1),this.fog===!1&&(t.fog=!1),Object.keys(this.userData).length>0&&(t.userData=this.userData);function g(I){const C=[];for(const o in I){const n=I[o];delete n.metadata,C.push(n)}return C}if(e){const I=g(A.textures),C=g(A.images);I.length>0&&(t.textures=I),C.length>0&&(t.images=C)}return t}clone(){return new this.constructor().copy(this)}copy(A){this.name=A.name,this.blending=A.blending,this.side=A.side,this.vertexColors=A.vertexColors,this.opacity=A.opacity,this.transparent=A.transparent,this.blendSrc=A.blendSrc,this.blendDst=A.blendDst,this.blendEquation=A.blendEquation,this.blendSrcAlpha=A.blendSrcAlpha,this.blendDstAlpha=A.blendDstAlpha,this.blendEquationAlpha=A.blendEquationAlpha,this.blendColor.copy(A.blendColor),this.blendAlpha=A.blendAlpha,this.depthFunc=A.depthFunc,this.depthTest=A.depthTest,this.depthWrite=A.depthWrite,this.stencilWriteMask=A.stencilWriteMask,this.stencilFunc=A.stencilFunc,this.stencilRef=A.stencilRef,this.stencilFuncMask=A.stencilFuncMask,this.stencilFail=A.stencilFail,this.stencilZFail=A.stencilZFail,this.stencilZPass=A.stencilZPass,this.stencilWrite=A.stencilWrite;const e=A.clippingPlanes;let t=null;if(e!==null){const g=e.length;t=new Array(g);for(let I=0;I!==g;++I)t[I]=e[I].clone()}return this.clippingPlanes=t,this.clipIntersection=A.clipIntersection,this.clipShadows=A.clipShadows,this.shadowSide=A.shadowSide,this.colorWrite=A.colorWrite,this.precision=A.precision,this.polygonOffset=A.polygonOffset,this.polygonOffsetFactor=A.polygonOffsetFactor,this.polygonOffsetUnits=A.polygonOffsetUnits,this.dithering=A.dithering,this.alphaTest=A.alphaTest,this.alphaHash=A.alphaHash,this.alphaToCoverage=A.alphaToCoverage,this.premultipliedAlpha=A.premultipliedAlpha,this.forceSinglePass=A.forceSinglePass,this.allowOverride=A.allowOverride,this.visible=A.visible,this.toneMapped=A.toneMapped,this.userData=JSON.parse(JSON.stringify(A.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(A){A===!0&&this.version++}}class yc extends tn{constructor(A){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ie(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.envMapRotation=new qi,this.combine=PE,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(A)}copy(A){return super.copy(A),this.color.copy(A.color),this.map=A.map,this.lightMap=A.lightMap,this.lightMapIntensity=A.lightMapIntensity,this.aoMap=A.aoMap,this.aoMapIntensity=A.aoMapIntensity,this.specularMap=A.specularMap,this.alphaMap=A.alphaMap,this.envMap=A.envMap,this.envMapRotation.copy(A.envMapRotation),this.combine=A.combine,this.reflectivity=A.reflectivity,this.refractionRatio=A.refractionRatio,this.wireframe=A.wireframe,this.wireframeLinewidth=A.wireframeLinewidth,this.wireframeLinecap=A.wireframeLinecap,this.wireframeLinejoin=A.wireframeLinejoin,this.fog=A.fog,this}}const Te=new J,gn=new Be;let $D=0;class hi{constructor(A,e,t=!1){if(Array.isArray(A))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:$D++}),this.name="",this.array=A,this.itemSize=e,this.count=A!==void 0?A.length/e:0,this.normalized=t,this.usage=nc,this.updateRanges=[],this.gpuType=Ei,this.version=0}onUploadCallback(){}set needsUpdate(A){A===!0&&this.version++}setUsage(A){return this.usage=A,this}addUpdateRange(A,e){this.updateRanges.push({start:A,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(A){return this.name=A.name,this.array=new A.array.constructor(A.array),this.itemSize=A.itemSize,this.count=A.count,this.normalized=A.normalized,this.usage=A.usage,this.gpuType=A.gpuType,this}copyAt(A,e,t){A*=this.itemSize,t*=e.itemSize;for(let g=0,I=this.itemSize;g<I;g++)this.array[A+g]=e.array[t+g];return this}copyArray(A){return this.array.set(A),this}applyMatrix3(A){if(this.itemSize===2)for(let e=0,t=this.count;e<t;e++)gn.fromBufferAttribute(this,e),gn.applyMatrix3(A),this.setXY(e,gn.x,gn.y);else if(this.itemSize===3)for(let e=0,t=this.count;e<t;e++)Te.fromBufferAttribute(this,e),Te.applyMatrix3(A),this.setXYZ(e,Te.x,Te.y,Te.z);return this}applyMatrix4(A){for(let e=0,t=this.count;e<t;e++)Te.fromBufferAttribute(this,e),Te.applyMatrix4(A),this.setXYZ(e,Te.x,Te.y,Te.z);return this}applyNormalMatrix(A){for(let e=0,t=this.count;e<t;e++)Te.fromBufferAttribute(this,e),Te.applyNormalMatrix(A),this.setXYZ(e,Te.x,Te.y,Te.z);return this}transformDirection(A){for(let e=0,t=this.count;e<t;e++)Te.fromBufferAttribute(this,e),Te.transformDirection(A),this.setXYZ(e,Te.x,Te.y,Te.z);return this}set(A,e=0){return this.array.set(A,e),this}getComponent(A,e){let t=this.array[A*this.itemSize+e];return this.normalized&&(t=fC(t,this.array)),t}setComponent(A,e,t){return this.normalized&&(t=xt(t,this.array)),this.array[A*this.itemSize+e]=t,this}getX(A){let e=this.array[A*this.itemSize];return this.normalized&&(e=fC(e,this.array)),e}setX(A,e){return this.normalized&&(e=xt(e,this.array)),this.array[A*this.itemSize]=e,this}getY(A){let e=this.array[A*this.itemSize+1];return this.normalized&&(e=fC(e,this.array)),e}setY(A,e){return this.normalized&&(e=xt(e,this.array)),this.array[A*this.itemSize+1]=e,this}getZ(A){let e=this.array[A*this.itemSize+2];return this.normalized&&(e=fC(e,this.array)),e}setZ(A,e){return this.normalized&&(e=xt(e,this.array)),this.array[A*this.itemSize+2]=e,this}getW(A){let e=this.array[A*this.itemSize+3];return this.normalized&&(e=fC(e,this.array)),e}setW(A,e){return this.normalized&&(e=xt(e,this.array)),this.array[A*this.itemSize+3]=e,this}setXY(A,e,t){return A*=this.itemSize,this.normalized&&(e=xt(e,this.array),t=xt(t,this.array)),this.array[A+0]=e,this.array[A+1]=t,this}setXYZ(A,e,t,g){return A*=this.itemSize,this.normalized&&(e=xt(e,this.array),t=xt(t,this.array),g=xt(g,this.array)),this.array[A+0]=e,this.array[A+1]=t,this.array[A+2]=g,this}setXYZW(A,e,t,g,I){return A*=this.itemSize,this.normalized&&(e=xt(e,this.array),t=xt(t,this.array),g=xt(g,this.array),I=xt(I,this.array)),this.array[A+0]=e,this.array[A+1]=t,this.array[A+2]=g,this.array[A+3]=I,this}onUpload(A){return this.onUploadCallback=A,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const A={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(A.name=this.name),this.usage!==nc&&(A.usage=this.usage),A}}class bc extends hi{constructor(A,e,t){super(new Uint16Array(A),e,t)}}class Nc extends hi{constructor(A,e,t){super(new Uint32Array(A),e,t)}}class nt extends hi{constructor(A,e,t){super(new Float32Array(A),e,t)}}let A2=0;const Ft=new Ye,YQ=new bt,GI=new J,Nt=new _C,yC=new _C,Xe=new J;class $t extends DI{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:A2++}),this.uuid=uC(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(A){return Array.isArray(A)?this.index=new(sc(A)?Nc:bc)(A,1):this.index=A,this}setIndirect(A,e=0){return this.indirect=A,this.indirectOffset=e,this}getIndirect(){return this.indirect}getAttribute(A){return this.attributes[A]}setAttribute(A,e){return this.attributes[A]=e,this}deleteAttribute(A){return delete this.attributes[A],this}hasAttribute(A){return this.attributes[A]!==void 0}addGroup(A,e,t=0){this.groups.push({start:A,count:e,materialIndex:t})}clearGroups(){this.groups=[]}setDrawRange(A,e){this.drawRange.start=A,this.drawRange.count=e}applyMatrix4(A){const e=this.attributes.position;e!==void 0&&(e.applyMatrix4(A),e.needsUpdate=!0);const t=this.attributes.normal;if(t!==void 0){const I=new qA().getNormalMatrix(A);t.applyNormalMatrix(I),t.needsUpdate=!0}const g=this.attributes.tangent;return g!==void 0&&(g.transformDirection(A),g.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(A){return Ft.makeRotationFromQuaternion(A),this.applyMatrix4(Ft),this}rotateX(A){return Ft.makeRotationX(A),this.applyMatrix4(Ft),this}rotateY(A){return Ft.makeRotationY(A),this.applyMatrix4(Ft),this}rotateZ(A){return Ft.makeRotationZ(A),this.applyMatrix4(Ft),this}translate(A,e,t){return Ft.makeTranslation(A,e,t),this.applyMatrix4(Ft),this}scale(A,e,t){return Ft.makeScale(A,e,t),this.applyMatrix4(Ft),this}lookAt(A){return YQ.lookAt(A),YQ.updateMatrix(),this.applyMatrix4(YQ.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(GI).negate(),this.translate(GI.x,GI.y,GI.z),this}setFromPoints(A){const e=this.getAttribute("position");if(e===void 0){const t=[];for(let g=0,I=A.length;g<I;g++){const C=A[g];t.push(C.x,C.y,C.z||0)}this.setAttribute("position",new nt(t,3))}else{const t=Math.min(A.length,e.count);for(let g=0;g<t;g++){const I=A[g];e.setXYZ(g,I.x,I.y,I.z||0)}A.length>e.count&&KA("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new _C);const A=this.attributes.position,e=this.morphAttributes.position;if(A&&A.isGLBufferAttribute){ae("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new J(-1/0,-1/0,-1/0),new J(1/0,1/0,1/0));return}if(A!==void 0){if(this.boundingBox.setFromBufferAttribute(A),e)for(let t=0,g=e.length;t<g;t++){const I=e[t];Nt.setFromBufferAttribute(I),this.morphTargetsRelative?(Xe.addVectors(this.boundingBox.min,Nt.min),this.boundingBox.expandByPoint(Xe),Xe.addVectors(this.boundingBox.max,Nt.max),this.boundingBox.expandByPoint(Xe)):(this.boundingBox.expandByPoint(Nt.min),this.boundingBox.expandByPoint(Nt.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&ae('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new bQ);const A=this.attributes.position,e=this.morphAttributes.position;if(A&&A.isGLBufferAttribute){ae("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new J,1/0);return}if(A){const t=this.boundingSphere.center;if(Nt.setFromBufferAttribute(A),e)for(let I=0,C=e.length;I<C;I++){const o=e[I];yC.setFromBufferAttribute(o),this.morphTargetsRelative?(Xe.addVectors(Nt.min,yC.min),Nt.expandByPoint(Xe),Xe.addVectors(Nt.max,yC.max),Nt.expandByPoint(Xe)):(Nt.expandByPoint(yC.min),Nt.expandByPoint(yC.max))}Nt.getCenter(t);let g=0;for(let I=0,C=A.count;I<C;I++)Xe.fromBufferAttribute(A,I),g=Math.max(g,t.distanceToSquared(Xe));if(e)for(let I=0,C=e.length;I<C;I++){const o=e[I],n=this.morphTargetsRelative;for(let a=0,s=o.count;a<s;a++)Xe.fromBufferAttribute(o,a),n&&(GI.fromBufferAttribute(A,a),Xe.add(GI)),g=Math.max(g,t.distanceToSquared(Xe))}this.boundingSphere.radius=Math.sqrt(g),isNaN(this.boundingSphere.radius)&&ae('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const A=this.index,e=this.attributes;if(A===null||e.position===void 0||e.normal===void 0||e.uv===void 0){ae("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const t=e.position,g=e.normal,I=e.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new hi(new Float32Array(4*t.count),4));const C=this.getAttribute("tangent"),o=[],n=[];for(let S=0;S<t.count;S++)o[S]=new J,n[S]=new J;const a=new J,s=new J,Q=new J,r=new Be,B=new Be,h=new Be,c=new J,d=new J;function E(S,l,p){a.fromBufferAttribute(t,S),s.fromBufferAttribute(t,l),Q.fromBufferAttribute(t,p),r.fromBufferAttribute(I,S),B.fromBufferAttribute(I,l),h.fromBufferAttribute(I,p),s.sub(a),Q.sub(a),B.sub(r),h.sub(r);const N=1/(B.x*h.y-h.x*B.y);isFinite(N)&&(c.copy(s).multiplyScalar(h.y).addScaledVector(Q,-B.y).multiplyScalar(N),d.copy(Q).multiplyScalar(B.x).addScaledVector(s,-h.x).multiplyScalar(N),o[S].add(c),o[l].add(c),o[p].add(c),n[S].add(d),n[l].add(d),n[p].add(d))}let u=this.groups;u.length===0&&(u=[{start:0,count:A.count}]);for(let S=0,l=u.length;S<l;++S){const p=u[S],N=p.start,U=p.count;for(let v=N,P=N+U;v<P;v+=3)E(A.getX(v+0),A.getX(v+1),A.getX(v+2))}const _=new J,x=new J,D=new J,w=new J;function y(S){D.fromBufferAttribute(g,S),w.copy(D);const l=o[S];_.copy(l),_.sub(D.multiplyScalar(D.dot(l))).normalize(),x.crossVectors(w,l);const N=x.dot(n[S])<0?-1:1;C.setXYZW(S,_.x,_.y,_.z,N)}for(let S=0,l=u.length;S<l;++S){const p=u[S],N=p.start,U=p.count;for(let v=N,P=N+U;v<P;v+=3)y(A.getX(v+0)),y(A.getX(v+1)),y(A.getX(v+2))}}computeVertexNormals(){const A=this.index,e=this.getAttribute("position");if(e!==void 0){let t=this.getAttribute("normal");if(t===void 0)t=new hi(new Float32Array(e.count*3),3),this.setAttribute("normal",t);else for(let r=0,B=t.count;r<B;r++)t.setXYZ(r,0,0,0);const g=new J,I=new J,C=new J,o=new J,n=new J,a=new J,s=new J,Q=new J;if(A)for(let r=0,B=A.count;r<B;r+=3){const h=A.getX(r+0),c=A.getX(r+1),d=A.getX(r+2);g.fromBufferAttribute(e,h),I.fromBufferAttribute(e,c),C.fromBufferAttribute(e,d),s.subVectors(C,I),Q.subVectors(g,I),s.cross(Q),o.fromBufferAttribute(t,h),n.fromBufferAttribute(t,c),a.fromBufferAttribute(t,d),o.add(s),n.add(s),a.add(s),t.setXYZ(h,o.x,o.y,o.z),t.setXYZ(c,n.x,n.y,n.z),t.setXYZ(d,a.x,a.y,a.z)}else for(let r=0,B=e.count;r<B;r+=3)g.fromBufferAttribute(e,r+0),I.fromBufferAttribute(e,r+1),C.fromBufferAttribute(e,r+2),s.subVectors(C,I),Q.subVectors(g,I),s.cross(Q),t.setXYZ(r+0,s.x,s.y,s.z),t.setXYZ(r+1,s.x,s.y,s.z),t.setXYZ(r+2,s.x,s.y,s.z);this.normalizeNormals(),t.needsUpdate=!0}}normalizeNormals(){const A=this.attributes.normal;for(let e=0,t=A.count;e<t;e++)Xe.fromBufferAttribute(A,e),Xe.normalize(),A.setXYZ(e,Xe.x,Xe.y,Xe.z)}toNonIndexed(){function A(o,n){const a=o.array,s=o.itemSize,Q=o.normalized,r=new a.constructor(n.length*s);let B=0,h=0;for(let c=0,d=n.length;c<d;c++){o.isInterleavedBufferAttribute?B=n[c]*o.data.stride+o.offset:B=n[c]*s;for(let E=0;E<s;E++)r[h++]=a[B++]}return new hi(r,s,Q)}if(this.index===null)return KA("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new $t,t=this.index.array,g=this.attributes;for(const o in g){const n=g[o],a=A(n,t);e.setAttribute(o,a)}const I=this.morphAttributes;for(const o in I){const n=[],a=I[o];for(let s=0,Q=a.length;s<Q;s++){const r=a[s],B=A(r,t);n.push(B)}e.morphAttributes[o]=n}e.morphTargetsRelative=this.morphTargetsRelative;const C=this.groups;for(let o=0,n=C.length;o<n;o++){const a=C[o];e.addGroup(a.start,a.count,a.materialIndex)}return e}toJSON(){const A={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(A.uuid=this.uuid,A.type=this.type,this.name!==""&&(A.name=this.name),Object.keys(this.userData).length>0&&(A.userData=this.userData),this.parameters!==void 0){const n=this.parameters;for(const a in n)n[a]!==void 0&&(A[a]=n[a]);return A}A.data={attributes:{}};const e=this.index;e!==null&&(A.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const t=this.attributes;for(const n in t){const a=t[n];A.data.attributes[n]=a.toJSON(A.data)}const g={};let I=!1;for(const n in this.morphAttributes){const a=this.morphAttributes[n],s=[];for(let Q=0,r=a.length;Q<r;Q++){const B=a[Q];s.push(B.toJSON(A.data))}s.length>0&&(g[n]=s,I=!0)}I&&(A.data.morphAttributes=g,A.data.morphTargetsRelative=this.morphTargetsRelative);const C=this.groups;C.length>0&&(A.data.groups=JSON.parse(JSON.stringify(C)));const o=this.boundingSphere;return o!==null&&(A.data.boundingSphere=o.toJSON()),A}clone(){return new this.constructor().copy(this)}copy(A){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=A.name;const t=A.index;t!==null&&this.setIndex(t.clone());const g=A.attributes;for(const a in g){const s=g[a];this.setAttribute(a,s.clone(e))}const I=A.morphAttributes;for(const a in I){const s=[],Q=I[a];for(let r=0,B=Q.length;r<B;r++)s.push(Q[r].clone(e));this.morphAttributes[a]=s}this.morphTargetsRelative=A.morphTargetsRelative;const C=A.groups;for(let a=0,s=C.length;a<s;a++){const Q=C[a];this.addGroup(Q.start,Q.count,Q.materialIndex)}const o=A.boundingBox;o!==null&&(this.boundingBox=o.clone());const n=A.boundingSphere;return n!==null&&(this.boundingSphere=n.clone()),this.drawRange.start=A.drawRange.start,this.drawRange.count=A.drawRange.count,this.userData=A.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const kc=new Ye,Tg=new PD,In=new bQ,Sc=new J,Cn=new J,on=new J,nn=new J,TQ=new J,an=new J,Rc=new J,sn=new J;class Ai extends bt{constructor(A=new $t,e=new yc){super(),this.isMesh=!0,this.type="Mesh",this.geometry=A,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(A,e){return super.copy(A,e),A.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=A.morphTargetInfluences.slice()),A.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},A.morphTargetDictionary)),this.material=Array.isArray(A.material)?A.material.slice():A.material,this.geometry=A.geometry,this}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const g=e[t[0]];if(g!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let I=0,C=g.length;I<C;I++){const o=g[I].name||String(I);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=I}}}}getVertexPosition(A,e){const t=this.geometry,g=t.attributes.position,I=t.morphAttributes.position,C=t.morphTargetsRelative;e.fromBufferAttribute(g,A);const o=this.morphTargetInfluences;if(I&&o){an.set(0,0,0);for(let n=0,a=I.length;n<a;n++){const s=o[n],Q=I[n];s!==0&&(TQ.fromBufferAttribute(Q,A),C?an.addScaledVector(TQ,s):an.addScaledVector(TQ.sub(e),s))}e.add(an)}return e}raycast(A,e){const t=this.geometry,g=this.material,I=this.matrixWorld;g!==void 0&&(t.boundingSphere===null&&t.computeBoundingSphere(),In.copy(t.boundingSphere),In.applyMatrix4(I),Tg.copy(A.ray).recast(A.near),!(In.containsPoint(Tg.origin)===!1&&(Tg.intersectSphere(In,Sc)===null||Tg.origin.distanceToSquared(Sc)>(A.far-A.near)**2))&&(kc.copy(I).invert(),Tg.copy(A.ray).applyMatrix4(kc),!(t.boundingBox!==null&&Tg.intersectsBox(t.boundingBox)===!1)&&this._computeIntersections(A,e,Tg)))}_computeIntersections(A,e,t){let g;const I=this.geometry,C=this.material,o=I.index,n=I.attributes.position,a=I.attributes.uv,s=I.attributes.uv1,Q=I.attributes.normal,r=I.groups,B=I.drawRange;if(o!==null)if(Array.isArray(C))for(let h=0,c=r.length;h<c;h++){const d=r[h],E=C[d.materialIndex],u=Math.max(d.start,B.start),_=Math.min(o.count,Math.min(d.start+d.count,B.start+B.count));for(let x=u,D=_;x<D;x+=3){const w=o.getX(x),y=o.getX(x+1),S=o.getX(x+2);g=Qn(this,E,A,t,a,s,Q,w,y,S),g&&(g.faceIndex=Math.floor(x/3),g.face.materialIndex=d.materialIndex,e.push(g))}}else{const h=Math.max(0,B.start),c=Math.min(o.count,B.start+B.count);for(let d=h,E=c;d<E;d+=3){const u=o.getX(d),_=o.getX(d+1),x=o.getX(d+2);g=Qn(this,C,A,t,a,s,Q,u,_,x),g&&(g.faceIndex=Math.floor(d/3),e.push(g))}}else if(n!==void 0)if(Array.isArray(C))for(let h=0,c=r.length;h<c;h++){const d=r[h],E=C[d.materialIndex],u=Math.max(d.start,B.start),_=Math.min(n.count,Math.min(d.start+d.count,B.start+B.count));for(let x=u,D=_;x<D;x+=3){const w=x,y=x+1,S=x+2;g=Qn(this,E,A,t,a,s,Q,w,y,S),g&&(g.faceIndex=Math.floor(x/3),g.face.materialIndex=d.materialIndex,e.push(g))}}else{const h=Math.max(0,B.start),c=Math.min(n.count,B.start+B.count);for(let d=h,E=c;d<E;d+=3){const u=d,_=d+1,x=d+2;g=Qn(this,C,A,t,a,s,Q,u,_,x),g&&(g.faceIndex=Math.floor(d/3),e.push(g))}}}}function e2(i,A,e,t,g,I,C,o){let n;if(A.side===Ct?n=t.intersectTriangle(C,I,g,!0,o):n=t.intersectTriangle(g,I,C,A.side===Mi,o),n===null)return null;sn.copy(o),sn.applyMatrix4(i.matrixWorld);const a=e.ray.origin.distanceTo(sn);return a<e.near||a>e.far?null:{distance:a,point:sn.clone(),object:i}}function Qn(i,A,e,t,g,I,C,o,n,a){i.getVertexPosition(o,Cn),i.getVertexPosition(n,on),i.getVertexPosition(a,nn);const s=e2(i,A,e,t,Cn,on,nn,Rc);if(s){const Q=new J;zt.getBarycoord(Rc,Cn,on,nn,Q),g&&(s.uv=zt.getInterpolatedAttribute(g,o,n,a,Q,new Be)),I&&(s.uv1=zt.getInterpolatedAttribute(I,o,n,a,Q,new Be)),C&&(s.normal=zt.getInterpolatedAttribute(C,o,n,a,Q,new J),s.normal.dot(t.direction)>0&&s.normal.multiplyScalar(-1));const r={a:o,b:n,c:a,normal:new J,materialIndex:0};zt.getNormal(Cn,on,nn,r.normal),s.face=r,s.barycoord=Q}return s}class bC extends $t{constructor(A=1,e=1,t=1,g=1,I=1,C=1){super(),this.type="BoxGeometry",this.parameters={width:A,height:e,depth:t,widthSegments:g,heightSegments:I,depthSegments:C};const o=this;g=Math.floor(g),I=Math.floor(I),C=Math.floor(C);const n=[],a=[],s=[],Q=[];let r=0,B=0;h("z","y","x",-1,-1,t,e,A,C,I,0),h("z","y","x",1,-1,t,e,-A,C,I,1),h("x","z","y",1,1,A,t,e,g,C,2),h("x","z","y",1,-1,A,t,-e,g,C,3),h("x","y","z",1,-1,A,e,t,g,I,4),h("x","y","z",-1,-1,A,e,-t,g,I,5),this.setIndex(n),this.setAttribute("position",new nt(a,3)),this.setAttribute("normal",new nt(s,3)),this.setAttribute("uv",new nt(Q,2));function h(c,d,E,u,_,x,D,w,y,S,l){const p=x/y,N=D/S,U=x/2,v=D/2,P=w/2,W=y+1,H=S+1;let O=0,z=0;const lA=new J;for(let QA=0;QA<H;QA++){const uA=QA*N-v;for(let TA=0;TA<W;TA++){const YA=TA*p-U;lA[c]=YA*u,lA[d]=uA*_,lA[E]=P,a.push(lA.x,lA.y,lA.z),lA[c]=0,lA[d]=0,lA[E]=w>0?1:-1,s.push(lA.x,lA.y,lA.z),Q.push(TA/y),Q.push(1-QA/S),O+=1}}for(let QA=0;QA<S;QA++)for(let uA=0;uA<y;uA++){const TA=r+uA+W*QA,YA=r+uA+W*(QA+1),Ne=r+(uA+1)+W*(QA+1),ue=r+(uA+1)+W*QA;n.push(TA,YA,ue),n.push(YA,Ne,ue),z+=6}o.addGroup(B,z,l),B+=z,r+=O}}copy(A){return super.copy(A),this.parameters=Object.assign({},A.parameters),this}static fromJSON(A){return new bC(A.width,A.height,A.depth,A.widthSegments,A.heightSegments,A.depthSegments)}}function MI(i){const A={};for(const e in i){A[e]={};for(const t in i[e]){const g=i[e][t];g&&(g.isColor||g.isMatrix3||g.isMatrix4||g.isVector2||g.isVector3||g.isVector4||g.isTexture||g.isQuaternion)?g.isRenderTargetTexture?(KA("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),A[e][t]=null):A[e][t]=g.clone():Array.isArray(g)?A[e][t]=g.slice():A[e][t]=g}}return A}function at(i){const A={};for(let e=0;e<i.length;e++){const t=MI(i[e]);for(const g in t)A[g]=t[g]}return A}function t2(i){const A=[];for(let e=0;e<i.length;e++)A.push(i[e].clone());return A}function Gc(i){const A=i.getRenderTarget();return A===null?i.outputColorSpace:A.isXRRenderTarget===!0?A.texture.colorSpace:oe.workingColorSpace}const i2={clone:MI,merge:at};var g2=`void main() {
152
152
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
153
153
  }`,I2=`void main() {
154
154
  gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
155
- }`;class Ut extends tn{constructor(A){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=g2,this.fragmentShader=I2,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,A!==void 0&&this.setValues(A)}copy(A){return super.copy(A),this.fragmentShader=A.fragmentShader,this.vertexShader=A.vertexShader,this.uniforms=MI(A.uniforms),this.uniformsGroups=t2(A.uniformsGroups),this.defines=Object.assign({},A.defines),this.wireframe=A.wireframe,this.wireframeLinewidth=A.wireframeLinewidth,this.fog=A.fog,this.lights=A.lights,this.clipping=A.clipping,this.extensions=Object.assign({},A.extensions),this.glslVersion=A.glslVersion,this.defaultAttributeValues=Object.assign({},A.defaultAttributeValues),this.index0AttributeName=A.index0AttributeName,this.uniformsNeedUpdate=A.uniformsNeedUpdate,this}toJSON(A){const e=super.toJSON(A);e.glslVersion=this.glslVersion,e.uniforms={};for(const g in this.uniforms){const C=this.uniforms[g].value;C&&C.isTexture?e.uniforms[g]={type:"t",value:C.toJSON(A).uuid}:C&&C.isColor?e.uniforms[g]={type:"c",value:C.getHex()}:C&&C.isVector2?e.uniforms[g]={type:"v2",value:C.toArray()}:C&&C.isVector3?e.uniforms[g]={type:"v3",value:C.toArray()}:C&&C.isVector4?e.uniforms[g]={type:"v4",value:C.toArray()}:C&&C.isMatrix3?e.uniforms[g]={type:"m3",value:C.toArray()}:C&&C.isMatrix4?e.uniforms[g]={type:"m4",value:C.toArray()}:e.uniforms[g]={value:C}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;const t={};for(const g in this.extensions)this.extensions[g]===!0&&(t[g]=!0);return Object.keys(t).length>0&&(e.extensions=t),e}}class Mc extends bt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ye,this.projectionMatrix=new Ye,this.projectionMatrixInverse=new Ye,this.coordinateSystem=ci,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(A,e){return super.copy(A,e),this.matrixWorldInverse.copy(A.matrixWorldInverse),this.projectionMatrix.copy(A.projectionMatrix),this.projectionMatrixInverse.copy(A.projectionMatrixInverse),this.coordinateSystem=A.coordinateSystem,this}getWorldDirection(A){return super.getWorldDirection(A).negate()}updateMatrixWorld(A){super.updateMatrixWorld(A),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(A,e){super.updateWorldMatrix(A,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const lg=new J,Fc=new Be,Uc=new Be;class Lt extends Mc{constructor(A=50,e=1,t=.1,g=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=A,this.zoom=1,this.near=t,this.far=g,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(A,e){return super.copy(A,e),this.fov=A.fov,this.zoom=A.zoom,this.near=A.near,this.far=A.far,this.focus=A.focus,this.aspect=A.aspect,this.view=A.view===null?null:Object.assign({},A.view),this.filmGauge=A.filmGauge,this.filmOffset=A.filmOffset,this}setFocalLength(A){const e=.5*this.getFilmHeight()/A;this.fov=xQ*2*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const A=Math.tan(lQ*.5*this.fov);return .5*this.getFilmHeight()/A}getEffectiveFOV(){return xQ*2*Math.atan(Math.tan(lQ*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(A,e,t){lg.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(lg.x,lg.y).multiplyScalar(-A/lg.z),lg.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(lg.x,lg.y).multiplyScalar(-A/lg.z)}getViewSize(A,e){return this.getViewBounds(A,Fc,Uc),e.subVectors(Uc,Fc)}setViewOffset(A,e,t,g,I,C){this.aspect=A/e,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=A,this.view.fullHeight=e,this.view.offsetX=t,this.view.offsetY=g,this.view.width=I,this.view.height=C,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const A=this.near;let e=A*Math.tan(lQ*.5*this.fov)/this.zoom,t=2*e,g=this.aspect*t,I=-.5*g;const C=this.view;if(this.view!==null&&this.view.enabled){const n=C.fullWidth,a=C.fullHeight;I+=C.offsetX*g/n,e-=C.offsetY*t/a,g*=C.width/n,t*=C.height/a}const o=this.filmOffset;o!==0&&(I+=A*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(I,I+g,e,e-t,A,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(A){const e=super.toJSON(A);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,this.view!==null&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}const FI=-90,UI=1;class C2 extends bt{constructor(A,e,t){super(),this.type="CubeCamera",this.renderTarget=t,this.coordinateSystem=null,this.activeMipmapLevel=0;const g=new Lt(FI,UI,A,e);g.layers=this.layers,this.add(g);const I=new Lt(FI,UI,A,e);I.layers=this.layers,this.add(I);const C=new Lt(FI,UI,A,e);C.layers=this.layers,this.add(C);const o=new Lt(FI,UI,A,e);o.layers=this.layers,this.add(o);const n=new Lt(FI,UI,A,e);n.layers=this.layers,this.add(n);const a=new Lt(FI,UI,A,e);a.layers=this.layers,this.add(a)}updateCoordinateSystem(){const A=this.coordinateSystem,e=this.children.concat(),[t,g,I,C,o,n]=e;for(const a of e)this.remove(a);if(A===ci)t.up.set(0,1,0),t.lookAt(1,0,0),g.up.set(0,1,0),g.lookAt(-1,0,0),I.up.set(0,0,-1),I.lookAt(0,1,0),C.up.set(0,0,1),C.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),n.up.set(0,1,0),n.lookAt(0,0,-1);else if(A===Oo)t.up.set(0,-1,0),t.lookAt(-1,0,0),g.up.set(0,-1,0),g.lookAt(1,0,0),I.up.set(0,0,1),I.lookAt(0,1,0),C.up.set(0,0,-1),C.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),n.up.set(0,-1,0),n.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+A);for(const a of e)this.add(a),a.updateMatrixWorld()}update(A,e){this.parent===null&&this.updateMatrixWorld();const{renderTarget:t,activeMipmapLevel:g}=this;this.coordinateSystem!==A.coordinateSystem&&(this.coordinateSystem=A.coordinateSystem,this.updateCoordinateSystem());const[I,C,o,n,a,s]=this.children,Q=A.getRenderTarget(),r=A.getActiveCubeFace(),B=A.getActiveMipmapLevel(),h=A.xr.enabled;A.xr.enabled=!1;const c=t.texture.generateMipmaps;t.texture.generateMipmaps=!1,A.setRenderTarget(t,0,g),A.render(e,I),A.setRenderTarget(t,1,g),A.render(e,C),A.setRenderTarget(t,2,g),A.render(e,o),A.setRenderTarget(t,3,g),A.render(e,n),A.setRenderTarget(t,4,g),A.render(e,a),t.texture.generateMipmaps=c,A.setRenderTarget(t,5,g),A.render(e,s),A.setRenderTarget(Q,r,B),A.xr.enabled=h,t.texture.needsPMREMUpdate=!0}}class Lc extends Ct{constructor(A=[],e=Lg,t,g,I,C,o,n,a,s){super(A,e,t,g,I,C,o,n,a,s),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(A){this.image=A}}class vc extends di{constructor(A=1,e={}){super(A,A,e),this.isWebGLCubeRenderTarget=!0;const t={width:A,height:A,depth:1},g=[t,t,t,t,t,t];this.texture=new Lc(g),this._setTextureOptions(e),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(A,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const t={uniforms:{tEquirect:{value:null}},vertexShader:`
155
+ }`;class Ut extends tn{constructor(A){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=g2,this.fragmentShader=I2,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,A!==void 0&&this.setValues(A)}copy(A){return super.copy(A),this.fragmentShader=A.fragmentShader,this.vertexShader=A.vertexShader,this.uniforms=MI(A.uniforms),this.uniformsGroups=t2(A.uniformsGroups),this.defines=Object.assign({},A.defines),this.wireframe=A.wireframe,this.wireframeLinewidth=A.wireframeLinewidth,this.fog=A.fog,this.lights=A.lights,this.clipping=A.clipping,this.extensions=Object.assign({},A.extensions),this.glslVersion=A.glslVersion,this.defaultAttributeValues=Object.assign({},A.defaultAttributeValues),this.index0AttributeName=A.index0AttributeName,this.uniformsNeedUpdate=A.uniformsNeedUpdate,this}toJSON(A){const e=super.toJSON(A);e.glslVersion=this.glslVersion,e.uniforms={};for(const g in this.uniforms){const C=this.uniforms[g].value;C&&C.isTexture?e.uniforms[g]={type:"t",value:C.toJSON(A).uuid}:C&&C.isColor?e.uniforms[g]={type:"c",value:C.getHex()}:C&&C.isVector2?e.uniforms[g]={type:"v2",value:C.toArray()}:C&&C.isVector3?e.uniforms[g]={type:"v3",value:C.toArray()}:C&&C.isVector4?e.uniforms[g]={type:"v4",value:C.toArray()}:C&&C.isMatrix3?e.uniforms[g]={type:"m3",value:C.toArray()}:C&&C.isMatrix4?e.uniforms[g]={type:"m4",value:C.toArray()}:e.uniforms[g]={value:C}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;const t={};for(const g in this.extensions)this.extensions[g]===!0&&(t[g]=!0);return Object.keys(t).length>0&&(e.extensions=t),e}}class Mc extends bt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ye,this.projectionMatrix=new Ye,this.projectionMatrixInverse=new Ye,this.coordinateSystem=ci,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(A,e){return super.copy(A,e),this.matrixWorldInverse.copy(A.matrixWorldInverse),this.projectionMatrix.copy(A.projectionMatrix),this.projectionMatrixInverse.copy(A.projectionMatrixInverse),this.coordinateSystem=A.coordinateSystem,this}getWorldDirection(A){return super.getWorldDirection(A).negate()}updateMatrixWorld(A){super.updateMatrixWorld(A),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(A,e){super.updateWorldMatrix(A,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const lg=new J,Fc=new Be,Uc=new Be;class Lt extends Mc{constructor(A=50,e=1,t=.1,g=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=A,this.zoom=1,this.near=t,this.far=g,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(A,e){return super.copy(A,e),this.fov=A.fov,this.zoom=A.zoom,this.near=A.near,this.far=A.far,this.focus=A.focus,this.aspect=A.aspect,this.view=A.view===null?null:Object.assign({},A.view),this.filmGauge=A.filmGauge,this.filmOffset=A.filmOffset,this}setFocalLength(A){const e=.5*this.getFilmHeight()/A;this.fov=xQ*2*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const A=Math.tan(lQ*.5*this.fov);return .5*this.getFilmHeight()/A}getEffectiveFOV(){return xQ*2*Math.atan(Math.tan(lQ*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(A,e,t){lg.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(lg.x,lg.y).multiplyScalar(-A/lg.z),lg.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(lg.x,lg.y).multiplyScalar(-A/lg.z)}getViewSize(A,e){return this.getViewBounds(A,Fc,Uc),e.subVectors(Uc,Fc)}setViewOffset(A,e,t,g,I,C){this.aspect=A/e,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=A,this.view.fullHeight=e,this.view.offsetX=t,this.view.offsetY=g,this.view.width=I,this.view.height=C,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const A=this.near;let e=A*Math.tan(lQ*.5*this.fov)/this.zoom,t=2*e,g=this.aspect*t,I=-.5*g;const C=this.view;if(this.view!==null&&this.view.enabled){const n=C.fullWidth,a=C.fullHeight;I+=C.offsetX*g/n,e-=C.offsetY*t/a,g*=C.width/n,t*=C.height/a}const o=this.filmOffset;o!==0&&(I+=A*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(I,I+g,e,e-t,A,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(A){const e=super.toJSON(A);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,this.view!==null&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}const FI=-90,UI=1;class C2 extends bt{constructor(A,e,t){super(),this.type="CubeCamera",this.renderTarget=t,this.coordinateSystem=null,this.activeMipmapLevel=0;const g=new Lt(FI,UI,A,e);g.layers=this.layers,this.add(g);const I=new Lt(FI,UI,A,e);I.layers=this.layers,this.add(I);const C=new Lt(FI,UI,A,e);C.layers=this.layers,this.add(C);const o=new Lt(FI,UI,A,e);o.layers=this.layers,this.add(o);const n=new Lt(FI,UI,A,e);n.layers=this.layers,this.add(n);const a=new Lt(FI,UI,A,e);a.layers=this.layers,this.add(a)}updateCoordinateSystem(){const A=this.coordinateSystem,e=this.children.concat(),[t,g,I,C,o,n]=e;for(const a of e)this.remove(a);if(A===ci)t.up.set(0,1,0),t.lookAt(1,0,0),g.up.set(0,1,0),g.lookAt(-1,0,0),I.up.set(0,0,-1),I.lookAt(0,1,0),C.up.set(0,0,1),C.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),n.up.set(0,1,0),n.lookAt(0,0,-1);else if(A===Oo)t.up.set(0,-1,0),t.lookAt(-1,0,0),g.up.set(0,-1,0),g.lookAt(1,0,0),I.up.set(0,0,1),I.lookAt(0,1,0),C.up.set(0,0,-1),C.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),n.up.set(0,-1,0),n.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+A);for(const a of e)this.add(a),a.updateMatrixWorld()}update(A,e){this.parent===null&&this.updateMatrixWorld();const{renderTarget:t,activeMipmapLevel:g}=this;this.coordinateSystem!==A.coordinateSystem&&(this.coordinateSystem=A.coordinateSystem,this.updateCoordinateSystem());const[I,C,o,n,a,s]=this.children,Q=A.getRenderTarget(),r=A.getActiveCubeFace(),B=A.getActiveMipmapLevel(),h=A.xr.enabled;A.xr.enabled=!1;const c=t.texture.generateMipmaps;t.texture.generateMipmaps=!1,A.setRenderTarget(t,0,g),A.render(e,I),A.setRenderTarget(t,1,g),A.render(e,C),A.setRenderTarget(t,2,g),A.render(e,o),A.setRenderTarget(t,3,g),A.render(e,n),A.setRenderTarget(t,4,g),A.render(e,a),t.texture.generateMipmaps=c,A.setRenderTarget(t,5,g),A.render(e,s),A.setRenderTarget(Q,r,B),A.xr.enabled=h,t.texture.needsPMREMUpdate=!0}}class Lc extends ot{constructor(A=[],e=Lg,t,g,I,C,o,n,a,s){super(A,e,t,g,I,C,o,n,a,s),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(A){this.image=A}}class vc extends di{constructor(A=1,e={}){super(A,A,e),this.isWebGLCubeRenderTarget=!0;const t={width:A,height:A,depth:1},g=[t,t,t,t,t,t];this.texture=new Lc(g),this._setTextureOptions(e),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(A,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const t={uniforms:{tEquirect:{value:null}},vertexShader:`
156
156
 
157
157
  varying vec3 vWorldDirection;
158
158
 
@@ -187,7 +187,7 @@ a=extmap-allow-mixed`)!==-1){const I=g.sdp.split(`
187
187
  gl_FragColor = texture2D( tEquirect, sampleUV );
188
188
 
189
189
  }
190
- `},g=new bC(5,5,5),I=new Ut({name:"CubemapFromEquirect",uniforms:MI(t.uniforms),vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,side:It,blending:Ui});I.uniforms.tEquirect.value=e;const C=new Ai(g,I),o=e.minFilter;return e.minFilter===vg&&(e.minFilter=et),new C2(1,10,this).update(A,C),e.minFilter=o,C.geometry.dispose(),C.material.dispose(),this}clear(A,e=!0,t=!0,g=!0){const I=A.getRenderTarget();for(let C=0;C<6;C++)A.setRenderTarget(this,C),A.clear(e,t,g);A.setRenderTarget(I)}}class rn extends bt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const o2={type:"move"};class qQ{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new rn,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new rn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new J,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new J),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new rn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new J,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new J),this._grip}dispatchEvent(A){return this._targetRay!==null&&this._targetRay.dispatchEvent(A),this._grip!==null&&this._grip.dispatchEvent(A),this._hand!==null&&this._hand.dispatchEvent(A),this}connect(A){if(A&&A.hand){const e=this._hand;if(e)for(const t of A.hand.values())this._getHandJoint(e,t)}return this.dispatchEvent({type:"connected",data:A}),this}disconnect(A){return this.dispatchEvent({type:"disconnected",data:A}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(A,e,t){let g=null,I=null,C=null;const o=this._targetRay,n=this._grip,a=this._hand;if(A&&e.session.visibilityState!=="visible-blurred"){if(a&&A.hand){C=!0;for(const c of A.hand.values()){const d=e.getJointPose(c,t),E=this._getHandJoint(a,c);d!==null&&(E.matrix.fromArray(d.transform.matrix),E.matrix.decompose(E.position,E.rotation,E.scale),E.matrixWorldNeedsUpdate=!0,E.jointRadius=d.radius),E.visible=d!==null}const s=a.joints["index-finger-tip"],Q=a.joints["thumb-tip"],r=s.position.distanceTo(Q.position),B=.02,h=.005;a.inputState.pinching&&r>B+h?(a.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:A.handedness,target:this})):!a.inputState.pinching&&r<=B-h&&(a.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:A.handedness,target:this}))}else n!==null&&A.gripSpace&&(I=e.getPose(A.gripSpace,t),I!==null&&(n.matrix.fromArray(I.transform.matrix),n.matrix.decompose(n.position,n.rotation,n.scale),n.matrixWorldNeedsUpdate=!0,I.linearVelocity?(n.hasLinearVelocity=!0,n.linearVelocity.copy(I.linearVelocity)):n.hasLinearVelocity=!1,I.angularVelocity?(n.hasAngularVelocity=!0,n.angularVelocity.copy(I.angularVelocity)):n.hasAngularVelocity=!1));o!==null&&(g=e.getPose(A.targetRaySpace,t),g===null&&I!==null&&(g=I),g!==null&&(o.matrix.fromArray(g.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,g.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(g.linearVelocity)):o.hasLinearVelocity=!1,g.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(g.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(o2)))}return o!==null&&(o.visible=g!==null),n!==null&&(n.visible=I!==null),a!==null&&(a.visible=C!==null),this}_getHandJoint(A,e){if(A.joints[e.jointName]===void 0){const t=new rn;t.matrixAutoUpdate=!1,t.visible=!1,A.joints[e.jointName]=t,A.add(t)}return A.joints[e.jointName]}}class n2 extends bt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new qi,this.environmentIntensity=1,this.environmentRotation=new qi,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(A,e){return super.copy(A,e),A.background!==null&&(this.background=A.background.clone()),A.environment!==null&&(this.environment=A.environment.clone()),A.fog!==null&&(this.fog=A.fog.clone()),this.backgroundBlurriness=A.backgroundBlurriness,this.backgroundIntensity=A.backgroundIntensity,this.backgroundRotation.copy(A.backgroundRotation),this.environmentIntensity=A.environmentIntensity,this.environmentRotation.copy(A.environmentRotation),A.overrideMaterial!==null&&(this.overrideMaterial=A.overrideMaterial.clone()),this.matrixAutoUpdate=A.matrixAutoUpdate,this}toJSON(A){const e=super.toJSON(A);return this.fog!==null&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}class a2 extends Ct{constructor(A=null,e=1,t=1,g,I,C,o,n,a=At,s=At,Q,r){super(null,C,o,n,a,s,g,I,Q,r),this.isDataTexture=!0,this.image={data:A,width:e,height:t},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const HQ=new J,s2=new J,Q2=new qA;class qg{constructor(A=new J(1,0,0),e=0){this.isPlane=!0,this.normal=A,this.constant=e}set(A,e){return this.normal.copy(A),this.constant=e,this}setComponents(A,e,t,g){return this.normal.set(A,e,t),this.constant=g,this}setFromNormalAndCoplanarPoint(A,e){return this.normal.copy(A),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(A,e,t){const g=HQ.subVectors(t,e).cross(s2.subVectors(A,e)).normalize();return this.setFromNormalAndCoplanarPoint(g,A),this}copy(A){return this.normal.copy(A.normal),this.constant=A.constant,this}normalize(){const A=1/this.normal.length();return this.normal.multiplyScalar(A),this.constant*=A,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(A){return this.normal.dot(A)+this.constant}distanceToSphere(A){return this.distanceToPoint(A.center)-A.radius}projectPoint(A,e){return e.copy(A).addScaledVector(this.normal,-this.distanceToPoint(A))}intersectLine(A,e){const t=A.delta(HQ),g=this.normal.dot(t);if(g===0)return this.distanceToPoint(A.start)===0?e.copy(A.start):null;const I=-(A.start.dot(this.normal)+this.constant)/g;return I<0||I>1?null:e.copy(A.start).addScaledVector(t,I)}intersectsLine(A){const e=this.distanceToPoint(A.start),t=this.distanceToPoint(A.end);return e<0&&t>0||t<0&&e>0}intersectsBox(A){return A.intersectsPlane(this)}intersectsSphere(A){return A.intersectsPlane(this)}coplanarPoint(A){return A.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(A,e){const t=e||Q2.getNormalMatrix(A),g=this.coplanarPoint(HQ).applyMatrix4(A),I=this.normal.applyMatrix3(t).normalize();return this.constant=-g.dot(I),this}translate(A){return this.constant-=A.dot(this.normal),this}equals(A){return A.normal.equals(this.normal)&&A.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Hg=new bQ,r2=new Be(.5,.5),Bn=new J;class Kc{constructor(A=new qg,e=new qg,t=new qg,g=new qg,I=new qg,C=new qg){this.planes=[A,e,t,g,I,C]}set(A,e,t,g,I,C){const o=this.planes;return o[0].copy(A),o[1].copy(e),o[2].copy(t),o[3].copy(g),o[4].copy(I),o[5].copy(C),this}copy(A){const e=this.planes;for(let t=0;t<6;t++)e[t].copy(A.planes[t]);return this}setFromProjectionMatrix(A,e=ci,t=!1){const g=this.planes,I=A.elements,C=I[0],o=I[1],n=I[2],a=I[3],s=I[4],Q=I[5],r=I[6],B=I[7],h=I[8],c=I[9],d=I[10],E=I[11],u=I[12],_=I[13],x=I[14],D=I[15];if(g[0].setComponents(a-C,B-s,E-h,D-u).normalize(),g[1].setComponents(a+C,B+s,E+h,D+u).normalize(),g[2].setComponents(a+o,B+Q,E+c,D+_).normalize(),g[3].setComponents(a-o,B-Q,E-c,D-_).normalize(),t)g[4].setComponents(n,r,d,x).normalize(),g[5].setComponents(a-n,B-r,E-d,D-x).normalize();else if(g[4].setComponents(a-n,B-r,E-d,D-x).normalize(),e===ci)g[5].setComponents(a+n,B+r,E+d,D+x).normalize();else if(e===Oo)g[5].setComponents(n,r,d,x).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);return this}intersectsObject(A){if(A.boundingSphere!==void 0)A.boundingSphere===null&&A.computeBoundingSphere(),Hg.copy(A.boundingSphere).applyMatrix4(A.matrixWorld);else{const e=A.geometry;e.boundingSphere===null&&e.computeBoundingSphere(),Hg.copy(e.boundingSphere).applyMatrix4(A.matrixWorld)}return this.intersectsSphere(Hg)}intersectsSprite(A){Hg.center.set(0,0,0);const e=r2.distanceTo(A.center);return Hg.radius=.7071067811865476+e,Hg.applyMatrix4(A.matrixWorld),this.intersectsSphere(Hg)}intersectsSphere(A){const e=this.planes,t=A.center,g=-A.radius;for(let I=0;I<6;I++)if(e[I].distanceToPoint(t)<g)return!1;return!0}intersectsBox(A){const e=this.planes;for(let t=0;t<6;t++){const g=e[t];if(Bn.x=g.normal.x>0?A.max.x:A.min.x,Bn.y=g.normal.y>0?A.max.y:A.min.y,Bn.z=g.normal.z>0?A.max.z:A.min.z,g.distanceToPoint(Bn)<0)return!1}return!0}containsPoint(A){const e=this.planes;for(let t=0;t<6;t++)if(e[t].distanceToPoint(A)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class NC extends Ct{constructor(A,e,t=Bi,g,I,C,o=At,n=At,a,s=Ki,Q=1){if(s!==Ki&&s!==Kg)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const r={width:A,height:e,depth:Q};super(r,g,I,C,o,n,s,t,a),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(A){return super.copy(A),this.source=new _Q(Object.assign({},A.image)),this.compareFunction=A.compareFunction,this}toJSON(A){const e=super.toJSON(A);return this.compareFunction!==null&&(e.compareFunction=this.compareFunction),e}}class B2 extends NC{constructor(A,e=Bi,t=Lg,g,I,C=At,o=At,n,a=Ki){const s={width:A,height:A,depth:1},Q=[s,s,s,s,s,s];super(A,A,e,t,g,I,C,o,n,a),this.image=Q,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(A){this.image=A}}class Jc extends Ct{constructor(A=null){super(),this.sourceTexture=A,this.isExternalTexture=!0}copy(A){return super.copy(A),this.sourceTexture=A.sourceTexture,this}}class PQ extends $t{constructor(A=[],e=[],t=1,g=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:A,indices:e,radius:t,detail:g};const I=[],C=[];o(g),a(t),s(),this.setAttribute("position",new ot(I,3)),this.setAttribute("normal",new ot(I.slice(),3)),this.setAttribute("uv",new ot(C,2)),g===0?this.computeVertexNormals():this.normalizeNormals();function o(u){const _=new J,x=new J,D=new J;for(let w=0;w<e.length;w+=3)B(e[w+0],_),B(e[w+1],x),B(e[w+2],D),n(_,x,D,u)}function n(u,_,x,D){const w=D+1,y=[];for(let S=0;S<=w;S++){y[S]=[];const l=u.clone().lerp(x,S/w),p=_.clone().lerp(x,S/w),N=w-S;for(let U=0;U<=N;U++)U===0&&S===w?y[S][U]=l:y[S][U]=l.clone().lerp(p,U/N)}for(let S=0;S<w;S++)for(let l=0;l<2*(w-S)-1;l++){const p=Math.floor(l/2);l%2===0?(r(y[S][p+1]),r(y[S+1][p]),r(y[S][p])):(r(y[S][p+1]),r(y[S+1][p+1]),r(y[S+1][p]))}}function a(u){const _=new J;for(let x=0;x<I.length;x+=3)_.x=I[x+0],_.y=I[x+1],_.z=I[x+2],_.normalize().multiplyScalar(u),I[x+0]=_.x,I[x+1]=_.y,I[x+2]=_.z}function s(){const u=new J;for(let _=0;_<I.length;_+=3){u.x=I[_+0],u.y=I[_+1],u.z=I[_+2];const x=d(u)/2/Math.PI+.5,D=E(u)/Math.PI+.5;C.push(x,1-D)}h(),Q()}function Q(){for(let u=0;u<C.length;u+=6){const _=C[u+0],x=C[u+2],D=C[u+4],w=Math.max(_,x,D),y=Math.min(_,x,D);w>.9&&y<.1&&(_<.2&&(C[u+0]+=1),x<.2&&(C[u+2]+=1),D<.2&&(C[u+4]+=1))}}function r(u){I.push(u.x,u.y,u.z)}function B(u,_){const x=u*3;_.x=A[x+0],_.y=A[x+1],_.z=A[x+2]}function h(){const u=new J,_=new J,x=new J,D=new J,w=new Be,y=new Be,S=new Be;for(let l=0,p=0;l<I.length;l+=9,p+=6){u.set(I[l+0],I[l+1],I[l+2]),_.set(I[l+3],I[l+4],I[l+5]),x.set(I[l+6],I[l+7],I[l+8]),w.set(C[p+0],C[p+1]),y.set(C[p+2],C[p+3]),S.set(C[p+4],C[p+5]),D.copy(u).add(_).add(x).divideScalar(3);const N=d(D);c(w,p+0,u,N),c(y,p+2,_,N),c(S,p+4,x,N)}}function c(u,_,x,D){D<0&&u.x===1&&(C[_]=u.x-1),x.x===0&&x.z===0&&(C[_]=D/2/Math.PI+.5)}function d(u){return Math.atan2(u.z,-u.x)}function E(u){return Math.atan2(-u.y,Math.sqrt(u.x*u.x+u.z*u.z))}}copy(A){return super.copy(A),this.parameters=Object.assign({},A.parameters),this}static fromJSON(A){return new PQ(A.vertices,A.indices,A.radius,A.detail)}}class OQ extends PQ{constructor(A=1,e=0){const t=(1+Math.sqrt(5))/2,g=[-1,t,0,1,t,0,-1,-t,0,1,-t,0,0,-1,t,0,1,t,0,-1,-t,0,1,-t,t,0,-1,t,0,1,-t,0,-1,-t,0,1],I=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(g,I,A,e),this.type="IcosahedronGeometry",this.parameters={radius:A,detail:e}}static fromJSON(A){return new OQ(A.radius,A.detail)}}class En extends $t{constructor(A=1,e=1,t=1,g=1){super(),this.type="PlaneGeometry",this.parameters={width:A,height:e,widthSegments:t,heightSegments:g};const I=A/2,C=e/2,o=Math.floor(t),n=Math.floor(g),a=o+1,s=n+1,Q=A/o,r=e/n,B=[],h=[],c=[],d=[];for(let E=0;E<s;E++){const u=E*r-C;for(let _=0;_<a;_++){const x=_*Q-I;h.push(x,-u,0),c.push(0,0,1),d.push(_/o),d.push(1-E/n)}}for(let E=0;E<n;E++)for(let u=0;u<o;u++){const _=u+a*E,x=u+a*(E+1),D=u+1+a*(E+1),w=u+1+a*E;B.push(_,x,w),B.push(x,D,w)}this.setIndex(B),this.setAttribute("position",new ot(h,3)),this.setAttribute("normal",new ot(c,3)),this.setAttribute("uv",new ot(d,2))}copy(A){return super.copy(A),this.parameters=Object.assign({},A.parameters),this}static fromJSON(A){return new En(A.width,A.height,A.widthSegments,A.heightSegments)}}class VQ extends $t{constructor(A=1,e=32,t=16,g=0,I=Math.PI*2,C=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:A,widthSegments:e,heightSegments:t,phiStart:g,phiLength:I,thetaStart:C,thetaLength:o},e=Math.max(3,Math.floor(e)),t=Math.max(2,Math.floor(t));const n=Math.min(C+o,Math.PI);let a=0;const s=[],Q=new J,r=new J,B=[],h=[],c=[],d=[];for(let E=0;E<=t;E++){const u=[],_=E/t;let x=0;E===0&&C===0?x=.5/e:E===t&&n===Math.PI&&(x=-.5/e);for(let D=0;D<=e;D++){const w=D/e;Q.x=-A*Math.cos(g+w*I)*Math.sin(C+_*o),Q.y=A*Math.cos(C+_*o),Q.z=A*Math.sin(g+w*I)*Math.sin(C+_*o),h.push(Q.x,Q.y,Q.z),r.copy(Q).normalize(),c.push(r.x,r.y,r.z),d.push(w+x,1-_),u.push(a++)}s.push(u)}for(let E=0;E<t;E++)for(let u=0;u<e;u++){const _=s[E][u+1],x=s[E][u],D=s[E+1][u],w=s[E+1][u+1];(E!==0||C>0)&&B.push(_,x,w),(E!==t-1||n<Math.PI)&&B.push(x,D,w)}this.setIndex(B),this.setAttribute("position",new ot(h,3)),this.setAttribute("normal",new ot(c,3)),this.setAttribute("uv",new ot(d,2))}copy(A){return super.copy(A),this.parameters=Object.assign({},A.parameters),this}static fromJSON(A){return new VQ(A.radius,A.widthSegments,A.heightSegments,A.phiStart,A.phiLength,A.thetaStart,A.thetaLength)}}class E2 extends Ut{constructor(A){super(A),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class c2 extends tn{constructor(A){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=mD,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(A)}copy(A){return super.copy(A),this.depthPacking=A.depthPacking,this.map=A.map,this.alphaMap=A.alphaMap,this.displacementMap=A.displacementMap,this.displacementScale=A.displacementScale,this.displacementBias=A.displacementBias,this.wireframe=A.wireframe,this.wireframeLinewidth=A.wireframeLinewidth,this}}class d2 extends tn{constructor(A){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(A)}copy(A){return super.copy(A),this.map=A.map,this.alphaMap=A.alphaMap,this.displacementMap=A.displacementMap,this.displacementScale=A.displacementScale,this.displacementBias=A.displacementBias,this}}class Yc extends Mc{constructor(A=-1,e=1,t=1,g=-1,I=.1,C=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=A,this.right=e,this.top=t,this.bottom=g,this.near=I,this.far=C,this.updateProjectionMatrix()}copy(A,e){return super.copy(A,e),this.left=A.left,this.right=A.right,this.top=A.top,this.bottom=A.bottom,this.near=A.near,this.far=A.far,this.zoom=A.zoom,this.view=A.view===null?null:Object.assign({},A.view),this}setViewOffset(A,e,t,g,I,C){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=A,this.view.fullHeight=e,this.view.offsetX=t,this.view.offsetY=g,this.view.width=I,this.view.height=C,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const A=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),t=(this.right+this.left)/2,g=(this.top+this.bottom)/2;let I=t-A,C=t+A,o=g+e,n=g-e;if(this.view!==null&&this.view.enabled){const a=(this.right-this.left)/this.view.fullWidth/this.zoom,s=(this.top-this.bottom)/this.view.fullHeight/this.zoom;I+=a*this.view.offsetX,C=I+a*this.view.width,o-=s*this.view.offsetY,n=o-s*this.view.height}this.projectionMatrix.makeOrthographic(I,C,o,n,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(A){const e=super.toJSON(A);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,this.view!==null&&(e.object.view=Object.assign({},this.view)),e}}class h2 extends Lt{constructor(A=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=A}}class l2{constructor(A=!0){this.autoStart=A,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let A=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const e=performance.now();A=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=A}return A}}function Tc(i,A,e,t){const g=x2(t);switch(e){case gc:return i*A;case Cc:return i*A/g.components*g.byteLength;case Fs:return i*A/g.components*g.byteLength;case xI:return i*A*2/g.components*g.byteLength;case Us:return i*A*2/g.components*g.byteLength;case Ic:return i*A*3/g.components*g.byteLength;case jt:return i*A*4/g.components*g.byteLength;case Ls:return i*A*4/g.components*g.byteLength;case Yo:case To:return Math.floor((i+3)/4)*Math.floor((A+3)/4)*8;case qo:case Ho:return Math.floor((i+3)/4)*Math.floor((A+3)/4)*16;case Ks:case Ys:return Math.max(i,16)*Math.max(A,8)/4;case vs:case Js:return Math.max(i,8)*Math.max(A,8)/2;case Ts:case qs:case Ps:case Os:return Math.floor((i+3)/4)*Math.floor((A+3)/4)*8;case Hs:case Vs:case js:return Math.floor((i+3)/4)*Math.floor((A+3)/4)*16;case Ws:return Math.floor((i+3)/4)*Math.floor((A+3)/4)*16;case Xs:return Math.floor((i+4)/5)*Math.floor((A+3)/4)*16;case Zs:return Math.floor((i+4)/5)*Math.floor((A+4)/5)*16;case zs:return Math.floor((i+5)/6)*Math.floor((A+4)/5)*16;case $s:return Math.floor((i+5)/6)*Math.floor((A+5)/6)*16;case AQ:return Math.floor((i+7)/8)*Math.floor((A+4)/5)*16;case eQ:return Math.floor((i+7)/8)*Math.floor((A+5)/6)*16;case tQ:return Math.floor((i+7)/8)*Math.floor((A+7)/8)*16;case iQ:return Math.floor((i+9)/10)*Math.floor((A+4)/5)*16;case gQ:return Math.floor((i+9)/10)*Math.floor((A+5)/6)*16;case IQ:return Math.floor((i+9)/10)*Math.floor((A+7)/8)*16;case CQ:return Math.floor((i+9)/10)*Math.floor((A+9)/10)*16;case oQ:return Math.floor((i+11)/12)*Math.floor((A+9)/10)*16;case nQ:return Math.floor((i+11)/12)*Math.floor((A+11)/12)*16;case aQ:case sQ:case QQ:return Math.ceil(i/4)*Math.ceil(A/4)*16;case rQ:case BQ:return Math.ceil(i/4)*Math.ceil(A/4)*8;case EQ:case cQ:return Math.ceil(i/4)*Math.ceil(A/4)*16}throw new Error(`Unable to determine texture byte length for ${e} format.`)}function x2(i){switch(i){case Gt:case Ac:return{byteLength:1,components:1};case hC:case ec:case vi:return{byteLength:2,components:1};case Gs:case Ms:return{byteLength:2,components:4};case Bi:case Rs:case Ei:return{byteLength:4,components:1};case tc:case ic:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${i}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:ds}})),typeof window<"u"&&(window.__THREE__?KA("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=ds);/**
190
+ `},g=new bC(5,5,5),I=new Ut({name:"CubemapFromEquirect",uniforms:MI(t.uniforms),vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,side:Ct,blending:Ui});I.uniforms.tEquirect.value=e;const C=new Ai(g,I),o=e.minFilter;return e.minFilter===vg&&(e.minFilter=tt),new C2(1,10,this).update(A,C),e.minFilter=o,C.geometry.dispose(),C.material.dispose(),this}clear(A,e=!0,t=!0,g=!0){const I=A.getRenderTarget();for(let C=0;C<6;C++)A.setRenderTarget(this,C),A.clear(e,t,g);A.setRenderTarget(I)}}class rn extends bt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const o2={type:"move"};class qQ{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new rn,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new rn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new J,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new J),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new rn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new J,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new J),this._grip}dispatchEvent(A){return this._targetRay!==null&&this._targetRay.dispatchEvent(A),this._grip!==null&&this._grip.dispatchEvent(A),this._hand!==null&&this._hand.dispatchEvent(A),this}connect(A){if(A&&A.hand){const e=this._hand;if(e)for(const t of A.hand.values())this._getHandJoint(e,t)}return this.dispatchEvent({type:"connected",data:A}),this}disconnect(A){return this.dispatchEvent({type:"disconnected",data:A}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(A,e,t){let g=null,I=null,C=null;const o=this._targetRay,n=this._grip,a=this._hand;if(A&&e.session.visibilityState!=="visible-blurred"){if(a&&A.hand){C=!0;for(const c of A.hand.values()){const d=e.getJointPose(c,t),E=this._getHandJoint(a,c);d!==null&&(E.matrix.fromArray(d.transform.matrix),E.matrix.decompose(E.position,E.rotation,E.scale),E.matrixWorldNeedsUpdate=!0,E.jointRadius=d.radius),E.visible=d!==null}const s=a.joints["index-finger-tip"],Q=a.joints["thumb-tip"],r=s.position.distanceTo(Q.position),B=.02,h=.005;a.inputState.pinching&&r>B+h?(a.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:A.handedness,target:this})):!a.inputState.pinching&&r<=B-h&&(a.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:A.handedness,target:this}))}else n!==null&&A.gripSpace&&(I=e.getPose(A.gripSpace,t),I!==null&&(n.matrix.fromArray(I.transform.matrix),n.matrix.decompose(n.position,n.rotation,n.scale),n.matrixWorldNeedsUpdate=!0,I.linearVelocity?(n.hasLinearVelocity=!0,n.linearVelocity.copy(I.linearVelocity)):n.hasLinearVelocity=!1,I.angularVelocity?(n.hasAngularVelocity=!0,n.angularVelocity.copy(I.angularVelocity)):n.hasAngularVelocity=!1));o!==null&&(g=e.getPose(A.targetRaySpace,t),g===null&&I!==null&&(g=I),g!==null&&(o.matrix.fromArray(g.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,g.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(g.linearVelocity)):o.hasLinearVelocity=!1,g.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(g.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(o2)))}return o!==null&&(o.visible=g!==null),n!==null&&(n.visible=I!==null),a!==null&&(a.visible=C!==null),this}_getHandJoint(A,e){if(A.joints[e.jointName]===void 0){const t=new rn;t.matrixAutoUpdate=!1,t.visible=!1,A.joints[e.jointName]=t,A.add(t)}return A.joints[e.jointName]}}class n2 extends bt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new qi,this.environmentIntensity=1,this.environmentRotation=new qi,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(A,e){return super.copy(A,e),A.background!==null&&(this.background=A.background.clone()),A.environment!==null&&(this.environment=A.environment.clone()),A.fog!==null&&(this.fog=A.fog.clone()),this.backgroundBlurriness=A.backgroundBlurriness,this.backgroundIntensity=A.backgroundIntensity,this.backgroundRotation.copy(A.backgroundRotation),this.environmentIntensity=A.environmentIntensity,this.environmentRotation.copy(A.environmentRotation),A.overrideMaterial!==null&&(this.overrideMaterial=A.overrideMaterial.clone()),this.matrixAutoUpdate=A.matrixAutoUpdate,this}toJSON(A){const e=super.toJSON(A);return this.fog!==null&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}class a2 extends ot{constructor(A=null,e=1,t=1,g,I,C,o,n,a=At,s=At,Q,r){super(null,C,o,n,a,s,g,I,Q,r),this.isDataTexture=!0,this.image={data:A,width:e,height:t},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const HQ=new J,s2=new J,Q2=new qA;class qg{constructor(A=new J(1,0,0),e=0){this.isPlane=!0,this.normal=A,this.constant=e}set(A,e){return this.normal.copy(A),this.constant=e,this}setComponents(A,e,t,g){return this.normal.set(A,e,t),this.constant=g,this}setFromNormalAndCoplanarPoint(A,e){return this.normal.copy(A),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(A,e,t){const g=HQ.subVectors(t,e).cross(s2.subVectors(A,e)).normalize();return this.setFromNormalAndCoplanarPoint(g,A),this}copy(A){return this.normal.copy(A.normal),this.constant=A.constant,this}normalize(){const A=1/this.normal.length();return this.normal.multiplyScalar(A),this.constant*=A,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(A){return this.normal.dot(A)+this.constant}distanceToSphere(A){return this.distanceToPoint(A.center)-A.radius}projectPoint(A,e){return e.copy(A).addScaledVector(this.normal,-this.distanceToPoint(A))}intersectLine(A,e){const t=A.delta(HQ),g=this.normal.dot(t);if(g===0)return this.distanceToPoint(A.start)===0?e.copy(A.start):null;const I=-(A.start.dot(this.normal)+this.constant)/g;return I<0||I>1?null:e.copy(A.start).addScaledVector(t,I)}intersectsLine(A){const e=this.distanceToPoint(A.start),t=this.distanceToPoint(A.end);return e<0&&t>0||t<0&&e>0}intersectsBox(A){return A.intersectsPlane(this)}intersectsSphere(A){return A.intersectsPlane(this)}coplanarPoint(A){return A.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(A,e){const t=e||Q2.getNormalMatrix(A),g=this.coplanarPoint(HQ).applyMatrix4(A),I=this.normal.applyMatrix3(t).normalize();return this.constant=-g.dot(I),this}translate(A){return this.constant-=A.dot(this.normal),this}equals(A){return A.normal.equals(this.normal)&&A.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Hg=new bQ,r2=new Be(.5,.5),Bn=new J;class Kc{constructor(A=new qg,e=new qg,t=new qg,g=new qg,I=new qg,C=new qg){this.planes=[A,e,t,g,I,C]}set(A,e,t,g,I,C){const o=this.planes;return o[0].copy(A),o[1].copy(e),o[2].copy(t),o[3].copy(g),o[4].copy(I),o[5].copy(C),this}copy(A){const e=this.planes;for(let t=0;t<6;t++)e[t].copy(A.planes[t]);return this}setFromProjectionMatrix(A,e=ci,t=!1){const g=this.planes,I=A.elements,C=I[0],o=I[1],n=I[2],a=I[3],s=I[4],Q=I[5],r=I[6],B=I[7],h=I[8],c=I[9],d=I[10],E=I[11],u=I[12],_=I[13],x=I[14],D=I[15];if(g[0].setComponents(a-C,B-s,E-h,D-u).normalize(),g[1].setComponents(a+C,B+s,E+h,D+u).normalize(),g[2].setComponents(a+o,B+Q,E+c,D+_).normalize(),g[3].setComponents(a-o,B-Q,E-c,D-_).normalize(),t)g[4].setComponents(n,r,d,x).normalize(),g[5].setComponents(a-n,B-r,E-d,D-x).normalize();else if(g[4].setComponents(a-n,B-r,E-d,D-x).normalize(),e===ci)g[5].setComponents(a+n,B+r,E+d,D+x).normalize();else if(e===Oo)g[5].setComponents(n,r,d,x).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);return this}intersectsObject(A){if(A.boundingSphere!==void 0)A.boundingSphere===null&&A.computeBoundingSphere(),Hg.copy(A.boundingSphere).applyMatrix4(A.matrixWorld);else{const e=A.geometry;e.boundingSphere===null&&e.computeBoundingSphere(),Hg.copy(e.boundingSphere).applyMatrix4(A.matrixWorld)}return this.intersectsSphere(Hg)}intersectsSprite(A){Hg.center.set(0,0,0);const e=r2.distanceTo(A.center);return Hg.radius=.7071067811865476+e,Hg.applyMatrix4(A.matrixWorld),this.intersectsSphere(Hg)}intersectsSphere(A){const e=this.planes,t=A.center,g=-A.radius;for(let I=0;I<6;I++)if(e[I].distanceToPoint(t)<g)return!1;return!0}intersectsBox(A){const e=this.planes;for(let t=0;t<6;t++){const g=e[t];if(Bn.x=g.normal.x>0?A.max.x:A.min.x,Bn.y=g.normal.y>0?A.max.y:A.min.y,Bn.z=g.normal.z>0?A.max.z:A.min.z,g.distanceToPoint(Bn)<0)return!1}return!0}containsPoint(A){const e=this.planes;for(let t=0;t<6;t++)if(e[t].distanceToPoint(A)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class NC extends ot{constructor(A,e,t=Bi,g,I,C,o=At,n=At,a,s=Ki,Q=1){if(s!==Ki&&s!==Kg)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const r={width:A,height:e,depth:Q};super(r,g,I,C,o,n,s,t,a),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(A){return super.copy(A),this.source=new _Q(Object.assign({},A.image)),this.compareFunction=A.compareFunction,this}toJSON(A){const e=super.toJSON(A);return this.compareFunction!==null&&(e.compareFunction=this.compareFunction),e}}class B2 extends NC{constructor(A,e=Bi,t=Lg,g,I,C=At,o=At,n,a=Ki){const s={width:A,height:A,depth:1},Q=[s,s,s,s,s,s];super(A,A,e,t,g,I,C,o,n,a),this.image=Q,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(A){this.image=A}}class Jc extends ot{constructor(A=null){super(),this.sourceTexture=A,this.isExternalTexture=!0}copy(A){return super.copy(A),this.sourceTexture=A.sourceTexture,this}}class PQ extends $t{constructor(A=[],e=[],t=1,g=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:A,indices:e,radius:t,detail:g};const I=[],C=[];o(g),a(t),s(),this.setAttribute("position",new nt(I,3)),this.setAttribute("normal",new nt(I.slice(),3)),this.setAttribute("uv",new nt(C,2)),g===0?this.computeVertexNormals():this.normalizeNormals();function o(u){const _=new J,x=new J,D=new J;for(let w=0;w<e.length;w+=3)B(e[w+0],_),B(e[w+1],x),B(e[w+2],D),n(_,x,D,u)}function n(u,_,x,D){const w=D+1,y=[];for(let S=0;S<=w;S++){y[S]=[];const l=u.clone().lerp(x,S/w),p=_.clone().lerp(x,S/w),N=w-S;for(let U=0;U<=N;U++)U===0&&S===w?y[S][U]=l:y[S][U]=l.clone().lerp(p,U/N)}for(let S=0;S<w;S++)for(let l=0;l<2*(w-S)-1;l++){const p=Math.floor(l/2);l%2===0?(r(y[S][p+1]),r(y[S+1][p]),r(y[S][p])):(r(y[S][p+1]),r(y[S+1][p+1]),r(y[S+1][p]))}}function a(u){const _=new J;for(let x=0;x<I.length;x+=3)_.x=I[x+0],_.y=I[x+1],_.z=I[x+2],_.normalize().multiplyScalar(u),I[x+0]=_.x,I[x+1]=_.y,I[x+2]=_.z}function s(){const u=new J;for(let _=0;_<I.length;_+=3){u.x=I[_+0],u.y=I[_+1],u.z=I[_+2];const x=d(u)/2/Math.PI+.5,D=E(u)/Math.PI+.5;C.push(x,1-D)}h(),Q()}function Q(){for(let u=0;u<C.length;u+=6){const _=C[u+0],x=C[u+2],D=C[u+4],w=Math.max(_,x,D),y=Math.min(_,x,D);w>.9&&y<.1&&(_<.2&&(C[u+0]+=1),x<.2&&(C[u+2]+=1),D<.2&&(C[u+4]+=1))}}function r(u){I.push(u.x,u.y,u.z)}function B(u,_){const x=u*3;_.x=A[x+0],_.y=A[x+1],_.z=A[x+2]}function h(){const u=new J,_=new J,x=new J,D=new J,w=new Be,y=new Be,S=new Be;for(let l=0,p=0;l<I.length;l+=9,p+=6){u.set(I[l+0],I[l+1],I[l+2]),_.set(I[l+3],I[l+4],I[l+5]),x.set(I[l+6],I[l+7],I[l+8]),w.set(C[p+0],C[p+1]),y.set(C[p+2],C[p+3]),S.set(C[p+4],C[p+5]),D.copy(u).add(_).add(x).divideScalar(3);const N=d(D);c(w,p+0,u,N),c(y,p+2,_,N),c(S,p+4,x,N)}}function c(u,_,x,D){D<0&&u.x===1&&(C[_]=u.x-1),x.x===0&&x.z===0&&(C[_]=D/2/Math.PI+.5)}function d(u){return Math.atan2(u.z,-u.x)}function E(u){return Math.atan2(-u.y,Math.sqrt(u.x*u.x+u.z*u.z))}}copy(A){return super.copy(A),this.parameters=Object.assign({},A.parameters),this}static fromJSON(A){return new PQ(A.vertices,A.indices,A.radius,A.detail)}}class OQ extends PQ{constructor(A=1,e=0){const t=(1+Math.sqrt(5))/2,g=[-1,t,0,1,t,0,-1,-t,0,1,-t,0,0,-1,t,0,1,t,0,-1,-t,0,1,-t,t,0,-1,t,0,1,-t,0,-1,-t,0,1],I=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(g,I,A,e),this.type="IcosahedronGeometry",this.parameters={radius:A,detail:e}}static fromJSON(A){return new OQ(A.radius,A.detail)}}class En extends $t{constructor(A=1,e=1,t=1,g=1){super(),this.type="PlaneGeometry",this.parameters={width:A,height:e,widthSegments:t,heightSegments:g};const I=A/2,C=e/2,o=Math.floor(t),n=Math.floor(g),a=o+1,s=n+1,Q=A/o,r=e/n,B=[],h=[],c=[],d=[];for(let E=0;E<s;E++){const u=E*r-C;for(let _=0;_<a;_++){const x=_*Q-I;h.push(x,-u,0),c.push(0,0,1),d.push(_/o),d.push(1-E/n)}}for(let E=0;E<n;E++)for(let u=0;u<o;u++){const _=u+a*E,x=u+a*(E+1),D=u+1+a*(E+1),w=u+1+a*E;B.push(_,x,w),B.push(x,D,w)}this.setIndex(B),this.setAttribute("position",new nt(h,3)),this.setAttribute("normal",new nt(c,3)),this.setAttribute("uv",new nt(d,2))}copy(A){return super.copy(A),this.parameters=Object.assign({},A.parameters),this}static fromJSON(A){return new En(A.width,A.height,A.widthSegments,A.heightSegments)}}class VQ extends $t{constructor(A=1,e=32,t=16,g=0,I=Math.PI*2,C=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:A,widthSegments:e,heightSegments:t,phiStart:g,phiLength:I,thetaStart:C,thetaLength:o},e=Math.max(3,Math.floor(e)),t=Math.max(2,Math.floor(t));const n=Math.min(C+o,Math.PI);let a=0;const s=[],Q=new J,r=new J,B=[],h=[],c=[],d=[];for(let E=0;E<=t;E++){const u=[],_=E/t;let x=0;E===0&&C===0?x=.5/e:E===t&&n===Math.PI&&(x=-.5/e);for(let D=0;D<=e;D++){const w=D/e;Q.x=-A*Math.cos(g+w*I)*Math.sin(C+_*o),Q.y=A*Math.cos(C+_*o),Q.z=A*Math.sin(g+w*I)*Math.sin(C+_*o),h.push(Q.x,Q.y,Q.z),r.copy(Q).normalize(),c.push(r.x,r.y,r.z),d.push(w+x,1-_),u.push(a++)}s.push(u)}for(let E=0;E<t;E++)for(let u=0;u<e;u++){const _=s[E][u+1],x=s[E][u],D=s[E+1][u],w=s[E+1][u+1];(E!==0||C>0)&&B.push(_,x,w),(E!==t-1||n<Math.PI)&&B.push(x,D,w)}this.setIndex(B),this.setAttribute("position",new nt(h,3)),this.setAttribute("normal",new nt(c,3)),this.setAttribute("uv",new nt(d,2))}copy(A){return super.copy(A),this.parameters=Object.assign({},A.parameters),this}static fromJSON(A){return new VQ(A.radius,A.widthSegments,A.heightSegments,A.phiStart,A.phiLength,A.thetaStart,A.thetaLength)}}class E2 extends Ut{constructor(A){super(A),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class c2 extends tn{constructor(A){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=mD,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(A)}copy(A){return super.copy(A),this.depthPacking=A.depthPacking,this.map=A.map,this.alphaMap=A.alphaMap,this.displacementMap=A.displacementMap,this.displacementScale=A.displacementScale,this.displacementBias=A.displacementBias,this.wireframe=A.wireframe,this.wireframeLinewidth=A.wireframeLinewidth,this}}class d2 extends tn{constructor(A){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(A)}copy(A){return super.copy(A),this.map=A.map,this.alphaMap=A.alphaMap,this.displacementMap=A.displacementMap,this.displacementScale=A.displacementScale,this.displacementBias=A.displacementBias,this}}class Yc extends Mc{constructor(A=-1,e=1,t=1,g=-1,I=.1,C=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=A,this.right=e,this.top=t,this.bottom=g,this.near=I,this.far=C,this.updateProjectionMatrix()}copy(A,e){return super.copy(A,e),this.left=A.left,this.right=A.right,this.top=A.top,this.bottom=A.bottom,this.near=A.near,this.far=A.far,this.zoom=A.zoom,this.view=A.view===null?null:Object.assign({},A.view),this}setViewOffset(A,e,t,g,I,C){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=A,this.view.fullHeight=e,this.view.offsetX=t,this.view.offsetY=g,this.view.width=I,this.view.height=C,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const A=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),t=(this.right+this.left)/2,g=(this.top+this.bottom)/2;let I=t-A,C=t+A,o=g+e,n=g-e;if(this.view!==null&&this.view.enabled){const a=(this.right-this.left)/this.view.fullWidth/this.zoom,s=(this.top-this.bottom)/this.view.fullHeight/this.zoom;I+=a*this.view.offsetX,C=I+a*this.view.width,o-=s*this.view.offsetY,n=o-s*this.view.height}this.projectionMatrix.makeOrthographic(I,C,o,n,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(A){const e=super.toJSON(A);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,this.view!==null&&(e.object.view=Object.assign({},this.view)),e}}class h2 extends Lt{constructor(A=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=A}}class l2{constructor(A=!0){this.autoStart=A,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let A=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const e=performance.now();A=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=A}return A}}function Tc(i,A,e,t){const g=x2(t);switch(e){case gc:return i*A;case Cc:return i*A/g.components*g.byteLength;case Fs:return i*A/g.components*g.byteLength;case xI:return i*A*2/g.components*g.byteLength;case Us:return i*A*2/g.components*g.byteLength;case Ic:return i*A*3/g.components*g.byteLength;case jt:return i*A*4/g.components*g.byteLength;case Ls:return i*A*4/g.components*g.byteLength;case Yo:case To:return Math.floor((i+3)/4)*Math.floor((A+3)/4)*8;case qo:case Ho:return Math.floor((i+3)/4)*Math.floor((A+3)/4)*16;case Ks:case Ys:return Math.max(i,16)*Math.max(A,8)/4;case vs:case Js:return Math.max(i,8)*Math.max(A,8)/2;case Ts:case qs:case Ps:case Os:return Math.floor((i+3)/4)*Math.floor((A+3)/4)*8;case Hs:case Vs:case js:return Math.floor((i+3)/4)*Math.floor((A+3)/4)*16;case Ws:return Math.floor((i+3)/4)*Math.floor((A+3)/4)*16;case Xs:return Math.floor((i+4)/5)*Math.floor((A+3)/4)*16;case Zs:return Math.floor((i+4)/5)*Math.floor((A+4)/5)*16;case zs:return Math.floor((i+5)/6)*Math.floor((A+4)/5)*16;case $s:return Math.floor((i+5)/6)*Math.floor((A+5)/6)*16;case AQ:return Math.floor((i+7)/8)*Math.floor((A+4)/5)*16;case eQ:return Math.floor((i+7)/8)*Math.floor((A+5)/6)*16;case tQ:return Math.floor((i+7)/8)*Math.floor((A+7)/8)*16;case iQ:return Math.floor((i+9)/10)*Math.floor((A+4)/5)*16;case gQ:return Math.floor((i+9)/10)*Math.floor((A+5)/6)*16;case IQ:return Math.floor((i+9)/10)*Math.floor((A+7)/8)*16;case CQ:return Math.floor((i+9)/10)*Math.floor((A+9)/10)*16;case oQ:return Math.floor((i+11)/12)*Math.floor((A+9)/10)*16;case nQ:return Math.floor((i+11)/12)*Math.floor((A+11)/12)*16;case aQ:case sQ:case QQ:return Math.ceil(i/4)*Math.ceil(A/4)*16;case rQ:case BQ:return Math.ceil(i/4)*Math.ceil(A/4)*8;case EQ:case cQ:return Math.ceil(i/4)*Math.ceil(A/4)*16}throw new Error(`Unable to determine texture byte length for ${e} format.`)}function x2(i){switch(i){case Gt:case Ac:return{byteLength:1,components:1};case hC:case ec:case vi:return{byteLength:2,components:1};case Gs:case Ms:return{byteLength:2,components:4};case Bi:case Rs:case Ei:return{byteLength:4,components:1};case tc:case ic:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${i}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:ds}})),typeof window<"u"&&(window.__THREE__?KA("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=ds);/**
191
191
  * @license
192
192
  * Copyright 2010-2025 Three.js Authors
193
193
  * SPDX-License-Identifier: MIT
@@ -2706,7 +2706,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Ep=`#ifdef USE_TRANSMISS
2706
2706
  worldPosition = instanceMatrix * worldPosition;
2707
2707
  #endif
2708
2708
  worldPosition = modelMatrix * worldPosition;
2709
- #endif`;const PA={alphahash_fragment:f2,alphahash_pars_fragment:D2,alphamap_fragment:_2,alphamap_pars_fragment:p2,alphatest_fragment:w2,alphatest_pars_fragment:m2,aomap_fragment:y2,aomap_pars_fragment:b2,batching_pars_vertex:N2,batching_vertex:k2,begin_vertex:S2,beginnormal_vertex:R2,bsdfs:G2,iridescence_fragment:M2,bumpmap_pars_fragment:F2,clipping_planes_fragment:U2,clipping_planes_pars_fragment:L2,clipping_planes_pars_vertex:v2,clipping_planes_vertex:K2,color_fragment:J2,color_pars_fragment:Y2,color_pars_vertex:T2,color_vertex:q2,common:H2,cube_uv_reflection_fragment:P2,defaultnormal_vertex:O2,displacementmap_pars_vertex:V2,displacementmap_vertex:j2,emissivemap_fragment:W2,emissivemap_pars_fragment:X2,colorspace_fragment:Z2,colorspace_pars_fragment:z2,envmap_fragment:$2,envmap_common_pars_fragment:A_,envmap_pars_fragment:e_,envmap_pars_vertex:t_,envmap_physical_pars_fragment:B_,envmap_vertex:i_,fog_vertex:g_,fog_pars_vertex:I_,fog_fragment:C_,fog_pars_fragment:o_,gradientmap_pars_fragment:n_,lightmap_pars_fragment:a_,lights_lambert_fragment:s_,lights_lambert_pars_fragment:Q_,lights_pars_begin:r_,lights_toon_fragment:E_,lights_toon_pars_fragment:c_,lights_phong_fragment:d_,lights_phong_pars_fragment:h_,lights_physical_fragment:l_,lights_physical_pars_fragment:x_,lights_fragment_begin:u_,lights_fragment_maps:f_,lights_fragment_end:D_,logdepthbuf_fragment:__,logdepthbuf_pars_fragment:p_,logdepthbuf_pars_vertex:w_,logdepthbuf_vertex:m_,map_fragment:y_,map_pars_fragment:b_,map_particle_fragment:N_,map_particle_pars_fragment:k_,metalnessmap_fragment:S_,metalnessmap_pars_fragment:R_,morphinstance_vertex:G_,morphcolor_vertex:M_,morphnormal_vertex:F_,morphtarget_pars_vertex:U_,morphtarget_vertex:L_,normal_fragment_begin:v_,normal_fragment_maps:K_,normal_pars_fragment:J_,normal_pars_vertex:Y_,normal_vertex:T_,normalmap_pars_fragment:q_,clearcoat_normal_fragment_begin:H_,clearcoat_normal_fragment_maps:P_,clearcoat_pars_fragment:O_,iridescence_pars_fragment:V_,opaque_fragment:j_,packing:W_,premultiplied_alpha_fragment:X_,project_vertex:Z_,dithering_fragment:z_,dithering_pars_fragment:$_,roughnessmap_fragment:Ap,roughnessmap_pars_fragment:ep,shadowmap_pars_fragment:tp,shadowmap_pars_vertex:ip,shadowmap_vertex:gp,shadowmask_pars_fragment:Ip,skinbase_vertex:Cp,skinning_pars_vertex:op,skinning_vertex:np,skinnormal_vertex:ap,specularmap_fragment:sp,specularmap_pars_fragment:Qp,tonemapping_fragment:rp,tonemapping_pars_fragment:Bp,transmission_fragment:Ep,transmission_pars_fragment:cp,uv_pars_fragment:dp,uv_pars_vertex:hp,uv_vertex:lp,worldpos_vertex:xp,background_vert:`varying vec2 vUv;
2709
+ #endif`;const OA={alphahash_fragment:f2,alphahash_pars_fragment:D2,alphamap_fragment:_2,alphamap_pars_fragment:p2,alphatest_fragment:w2,alphatest_pars_fragment:m2,aomap_fragment:y2,aomap_pars_fragment:b2,batching_pars_vertex:N2,batching_vertex:k2,begin_vertex:S2,beginnormal_vertex:R2,bsdfs:G2,iridescence_fragment:M2,bumpmap_pars_fragment:F2,clipping_planes_fragment:U2,clipping_planes_pars_fragment:L2,clipping_planes_pars_vertex:v2,clipping_planes_vertex:K2,color_fragment:J2,color_pars_fragment:Y2,color_pars_vertex:T2,color_vertex:q2,common:H2,cube_uv_reflection_fragment:P2,defaultnormal_vertex:O2,displacementmap_pars_vertex:V2,displacementmap_vertex:j2,emissivemap_fragment:W2,emissivemap_pars_fragment:X2,colorspace_fragment:Z2,colorspace_pars_fragment:z2,envmap_fragment:$2,envmap_common_pars_fragment:A_,envmap_pars_fragment:e_,envmap_pars_vertex:t_,envmap_physical_pars_fragment:B_,envmap_vertex:i_,fog_vertex:g_,fog_pars_vertex:I_,fog_fragment:C_,fog_pars_fragment:o_,gradientmap_pars_fragment:n_,lightmap_pars_fragment:a_,lights_lambert_fragment:s_,lights_lambert_pars_fragment:Q_,lights_pars_begin:r_,lights_toon_fragment:E_,lights_toon_pars_fragment:c_,lights_phong_fragment:d_,lights_phong_pars_fragment:h_,lights_physical_fragment:l_,lights_physical_pars_fragment:x_,lights_fragment_begin:u_,lights_fragment_maps:f_,lights_fragment_end:D_,logdepthbuf_fragment:__,logdepthbuf_pars_fragment:p_,logdepthbuf_pars_vertex:w_,logdepthbuf_vertex:m_,map_fragment:y_,map_pars_fragment:b_,map_particle_fragment:N_,map_particle_pars_fragment:k_,metalnessmap_fragment:S_,metalnessmap_pars_fragment:R_,morphinstance_vertex:G_,morphcolor_vertex:M_,morphnormal_vertex:F_,morphtarget_pars_vertex:U_,morphtarget_vertex:L_,normal_fragment_begin:v_,normal_fragment_maps:K_,normal_pars_fragment:J_,normal_pars_vertex:Y_,normal_vertex:T_,normalmap_pars_fragment:q_,clearcoat_normal_fragment_begin:H_,clearcoat_normal_fragment_maps:P_,clearcoat_pars_fragment:O_,iridescence_pars_fragment:V_,opaque_fragment:j_,packing:W_,premultiplied_alpha_fragment:X_,project_vertex:Z_,dithering_fragment:z_,dithering_pars_fragment:$_,roughnessmap_fragment:Ap,roughnessmap_pars_fragment:ep,shadowmap_pars_fragment:tp,shadowmap_pars_vertex:ip,shadowmap_vertex:gp,shadowmask_pars_fragment:Ip,skinbase_vertex:Cp,skinning_pars_vertex:op,skinning_vertex:np,skinnormal_vertex:ap,specularmap_fragment:sp,specularmap_pars_fragment:Qp,tonemapping_fragment:rp,tonemapping_pars_fragment:Bp,transmission_fragment:Ep,transmission_pars_fragment:cp,uv_pars_fragment:dp,uv_pars_vertex:hp,uv_vertex:lp,worldpos_vertex:xp,background_vert:`varying vec2 vUv;
2710
2710
  uniform mat3 uvTransform;
2711
2711
  void main() {
2712
2712
  vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
@@ -3756,7 +3756,7 @@ void main() {
3756
3756
  #include <tonemapping_fragment>
3757
3757
  #include <colorspace_fragment>
3758
3758
  #include <fog_fragment>
3759
- }`},hA={common:{diffuse:{value:new Ie(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new qA},alphaMap:{value:null},alphaMapTransform:{value:new qA},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new qA}},envmap:{envMap:{value:null},envMapRotation:{value:new qA},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new qA}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new qA}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new qA},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new qA},normalScale:{value:new Be(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new qA},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new qA}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new qA}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new qA}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ie(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Ie(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new qA},alphaTest:{value:0},uvTransform:{value:new qA}},sprite:{diffuse:{value:new Ie(16777215)},opacity:{value:1},center:{value:new Be(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new qA},alphaMap:{value:null},alphaMapTransform:{value:new qA},alphaTest:{value:0}}},li={basic:{uniforms:nt([hA.common,hA.specularmap,hA.envmap,hA.aomap,hA.lightmap,hA.fog]),vertexShader:PA.meshbasic_vert,fragmentShader:PA.meshbasic_frag},lambert:{uniforms:nt([hA.common,hA.specularmap,hA.envmap,hA.aomap,hA.lightmap,hA.emissivemap,hA.bumpmap,hA.normalmap,hA.displacementmap,hA.fog,hA.lights,{emissive:{value:new Ie(0)}}]),vertexShader:PA.meshlambert_vert,fragmentShader:PA.meshlambert_frag},phong:{uniforms:nt([hA.common,hA.specularmap,hA.envmap,hA.aomap,hA.lightmap,hA.emissivemap,hA.bumpmap,hA.normalmap,hA.displacementmap,hA.fog,hA.lights,{emissive:{value:new Ie(0)},specular:{value:new Ie(1118481)},shininess:{value:30}}]),vertexShader:PA.meshphong_vert,fragmentShader:PA.meshphong_frag},standard:{uniforms:nt([hA.common,hA.envmap,hA.aomap,hA.lightmap,hA.emissivemap,hA.bumpmap,hA.normalmap,hA.displacementmap,hA.roughnessmap,hA.metalnessmap,hA.fog,hA.lights,{emissive:{value:new Ie(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:PA.meshphysical_vert,fragmentShader:PA.meshphysical_frag},toon:{uniforms:nt([hA.common,hA.aomap,hA.lightmap,hA.emissivemap,hA.bumpmap,hA.normalmap,hA.displacementmap,hA.gradientmap,hA.fog,hA.lights,{emissive:{value:new Ie(0)}}]),vertexShader:PA.meshtoon_vert,fragmentShader:PA.meshtoon_frag},matcap:{uniforms:nt([hA.common,hA.bumpmap,hA.normalmap,hA.displacementmap,hA.fog,{matcap:{value:null}}]),vertexShader:PA.meshmatcap_vert,fragmentShader:PA.meshmatcap_frag},points:{uniforms:nt([hA.points,hA.fog]),vertexShader:PA.points_vert,fragmentShader:PA.points_frag},dashed:{uniforms:nt([hA.common,hA.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:PA.linedashed_vert,fragmentShader:PA.linedashed_frag},depth:{uniforms:nt([hA.common,hA.displacementmap]),vertexShader:PA.depth_vert,fragmentShader:PA.depth_frag},normal:{uniforms:nt([hA.common,hA.bumpmap,hA.normalmap,hA.displacementmap,{opacity:{value:1}}]),vertexShader:PA.meshnormal_vert,fragmentShader:PA.meshnormal_frag},sprite:{uniforms:nt([hA.sprite,hA.fog]),vertexShader:PA.sprite_vert,fragmentShader:PA.sprite_frag},background:{uniforms:{uvTransform:{value:new qA},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:PA.background_vert,fragmentShader:PA.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new qA}},vertexShader:PA.backgroundCube_vert,fragmentShader:PA.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:PA.cube_vert,fragmentShader:PA.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:PA.equirect_vert,fragmentShader:PA.equirect_frag},distance:{uniforms:nt([hA.common,hA.displacementmap,{referencePosition:{value:new J},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:PA.distance_vert,fragmentShader:PA.distance_frag},shadow:{uniforms:nt([hA.lights,hA.fog,{color:{value:new Ie(0)},opacity:{value:1}}]),vertexShader:PA.shadow_vert,fragmentShader:PA.shadow_frag}};li.physical={uniforms:nt([li.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new qA},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new qA},clearcoatNormalScale:{value:new Be(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new qA},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new qA},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new qA},sheen:{value:0},sheenColor:{value:new Ie(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new qA},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new qA},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new qA},transmissionSamplerSize:{value:new Be},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new qA},attenuationDistance:{value:0},attenuationColor:{value:new Ie(0)},specularColor:{value:new Ie(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new qA},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new qA},anisotropyVector:{value:new Be},anisotropyMap:{value:null},anisotropyMapTransform:{value:new qA}}]),vertexShader:PA.meshphysical_vert,fragmentShader:PA.meshphysical_frag};const cn={r:0,b:0,g:0},Pg=new qi,up=new Ye;function fp(i,A,e,t,g,I,C){const o=new Ie(0);let n=I===!0?0:1,a,s,Q=null,r=0,B=null;function h(_){let x=_.isScene===!0?_.background:null;return x&&x.isTexture&&(x=(_.backgroundBlurriness>0?e:A).get(x)),x}function c(_){let x=!1;const D=h(_);D===null?E(o,n):D&&D.isColor&&(E(D,1),x=!0);const w=i.xr.getEnvironmentBlendMode();w==="additive"?t.buffers.color.setClear(0,0,0,1,C):w==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,C),(i.autoClear||x)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function d(_,x){const D=h(x);D&&(D.isCubeTexture||D.mapping===Ko)?(s===void 0&&(s=new Ai(new bC(1,1,1),new Ut({name:"BackgroundCubeMaterial",uniforms:MI(li.backgroundCube.uniforms),vertexShader:li.backgroundCube.vertexShader,fragmentShader:li.backgroundCube.fragmentShader,side:It,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),s.geometry.deleteAttribute("normal"),s.geometry.deleteAttribute("uv"),s.onBeforeRender=function(w,y,S){this.matrixWorld.copyPosition(S.matrixWorld)},Object.defineProperty(s.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),g.update(s)),Pg.copy(x.backgroundRotation),Pg.x*=-1,Pg.y*=-1,Pg.z*=-1,D.isCubeTexture&&D.isRenderTargetTexture===!1&&(Pg.y*=-1,Pg.z*=-1),s.material.uniforms.envMap.value=D,s.material.uniforms.flipEnvMap.value=D.isCubeTexture&&D.isRenderTargetTexture===!1?-1:1,s.material.uniforms.backgroundBlurriness.value=x.backgroundBlurriness,s.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,s.material.uniforms.backgroundRotation.value.setFromMatrix4(up.makeRotationFromEuler(Pg)),s.material.toneMapped=oe.getTransfer(D.colorSpace)!==ce,(Q!==D||r!==D.version||B!==i.toneMapping)&&(s.material.needsUpdate=!0,Q=D,r=D.version,B=i.toneMapping),s.layers.enableAll(),_.unshift(s,s.geometry,s.material,0,0,null)):D&&D.isTexture&&(a===void 0&&(a=new Ai(new En(2,2),new Ut({name:"BackgroundMaterial",uniforms:MI(li.background.uniforms),vertexShader:li.background.vertexShader,fragmentShader:li.background.fragmentShader,side:Mi,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),a.geometry.deleteAttribute("normal"),Object.defineProperty(a.material,"map",{get:function(){return this.uniforms.t2D.value}}),g.update(a)),a.material.uniforms.t2D.value=D,a.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,a.material.toneMapped=oe.getTransfer(D.colorSpace)!==ce,D.matrixAutoUpdate===!0&&D.updateMatrix(),a.material.uniforms.uvTransform.value.copy(D.matrix),(Q!==D||r!==D.version||B!==i.toneMapping)&&(a.material.needsUpdate=!0,Q=D,r=D.version,B=i.toneMapping),a.layers.enableAll(),_.unshift(a,a.geometry,a.material,0,0,null))}function E(_,x){_.getRGB(cn,Gc(i)),t.buffers.color.setClear(cn.r,cn.g,cn.b,x,C)}function u(){s!==void 0&&(s.geometry.dispose(),s.material.dispose(),s=void 0),a!==void 0&&(a.geometry.dispose(),a.material.dispose(),a=void 0)}return{getClearColor:function(){return o},setClearColor:function(_,x=1){o.set(_),n=x,E(o,n)},getClearAlpha:function(){return n},setClearAlpha:function(_){n=_,E(o,n)},render:c,addToRenderList:d,dispose:u}}function Dp(i,A){const e=i.getParameter(i.MAX_VERTEX_ATTRIBS),t={},g=r(null);let I=g,C=!1;function o(p,N,U,v,P){let W=!1;const H=Q(v,U,N);I!==H&&(I=H,a(I.object)),W=B(p,v,U,P),W&&h(p,v,U,P),P!==null&&A.update(P,i.ELEMENT_ARRAY_BUFFER),(W||C)&&(C=!1,x(p,N,U,v),P!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,A.get(P).buffer))}function n(){return i.createVertexArray()}function a(p){return i.bindVertexArray(p)}function s(p){return i.deleteVertexArray(p)}function Q(p,N,U){const v=U.wireframe===!0;let P=t[p.id];P===void 0&&(P={},t[p.id]=P);let W=P[N.id];W===void 0&&(W={},P[N.id]=W);let H=W[v];return H===void 0&&(H=r(n()),W[v]=H),H}function r(p){const N=[],U=[],v=[];for(let P=0;P<e;P++)N[P]=0,U[P]=0,v[P]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:N,enabledAttributes:U,attributeDivisors:v,object:p,attributes:{},index:null}}function B(p,N,U,v){const P=I.attributes,W=N.attributes;let H=0;const O=U.getAttributes();for(const z in O)if(O[z].location>=0){const QA=P[z];let uA=W[z];if(uA===void 0&&(z==="instanceMatrix"&&p.instanceMatrix&&(uA=p.instanceMatrix),z==="instanceColor"&&p.instanceColor&&(uA=p.instanceColor)),QA===void 0||QA.attribute!==uA||uA&&QA.data!==uA.data)return!0;H++}return I.attributesNum!==H||I.index!==v}function h(p,N,U,v){const P={},W=N.attributes;let H=0;const O=U.getAttributes();for(const z in O)if(O[z].location>=0){let QA=W[z];QA===void 0&&(z==="instanceMatrix"&&p.instanceMatrix&&(QA=p.instanceMatrix),z==="instanceColor"&&p.instanceColor&&(QA=p.instanceColor));const uA={};uA.attribute=QA,QA&&QA.data&&(uA.data=QA.data),P[z]=uA,H++}I.attributes=P,I.attributesNum=H,I.index=v}function c(){const p=I.newAttributes;for(let N=0,U=p.length;N<U;N++)p[N]=0}function d(p){E(p,0)}function E(p,N){const U=I.newAttributes,v=I.enabledAttributes,P=I.attributeDivisors;U[p]=1,v[p]===0&&(i.enableVertexAttribArray(p),v[p]=1),P[p]!==N&&(i.vertexAttribDivisor(p,N),P[p]=N)}function u(){const p=I.newAttributes,N=I.enabledAttributes;for(let U=0,v=N.length;U<v;U++)N[U]!==p[U]&&(i.disableVertexAttribArray(U),N[U]=0)}function _(p,N,U,v,P,W,H){H===!0?i.vertexAttribIPointer(p,N,U,P,W):i.vertexAttribPointer(p,N,U,v,P,W)}function x(p,N,U,v){c();const P=v.attributes,W=U.getAttributes(),H=N.defaultAttributeValues;for(const O in W){const z=W[O];if(z.location>=0){let lA=P[O];if(lA===void 0&&(O==="instanceMatrix"&&p.instanceMatrix&&(lA=p.instanceMatrix),O==="instanceColor"&&p.instanceColor&&(lA=p.instanceColor)),lA!==void 0){const QA=lA.normalized,uA=lA.itemSize,TA=A.get(lA);if(TA===void 0)continue;const YA=TA.buffer,Ne=TA.type,ue=TA.bytesPerElement,Z=Ne===i.INT||Ne===i.UNSIGNED_INT||lA.gpuType===Rs;if(lA.isInterleavedBufferAttribute){const gA=lA.data,wA=gA.stride,HA=lA.offset;if(gA.isInstancedInterleavedBuffer){for(let bA=0;bA<z.locationSize;bA++)E(z.location+bA,gA.meshPerAttribute);p.isInstancedMesh!==!0&&v._maxInstanceCount===void 0&&(v._maxInstanceCount=gA.meshPerAttribute*gA.count)}else for(let bA=0;bA<z.locationSize;bA++)d(z.location+bA);i.bindBuffer(i.ARRAY_BUFFER,YA);for(let bA=0;bA<z.locationSize;bA++)_(z.location+bA,uA/z.locationSize,Ne,QA,wA*ue,(HA+uA/z.locationSize*bA)*ue,Z)}else{if(lA.isInstancedBufferAttribute){for(let gA=0;gA<z.locationSize;gA++)E(z.location+gA,lA.meshPerAttribute);p.isInstancedMesh!==!0&&v._maxInstanceCount===void 0&&(v._maxInstanceCount=lA.meshPerAttribute*lA.count)}else for(let gA=0;gA<z.locationSize;gA++)d(z.location+gA);i.bindBuffer(i.ARRAY_BUFFER,YA);for(let gA=0;gA<z.locationSize;gA++)_(z.location+gA,uA/z.locationSize,Ne,QA,uA*ue,uA/z.locationSize*gA*ue,Z)}}else if(H!==void 0){const QA=H[O];if(QA!==void 0)switch(QA.length){case 2:i.vertexAttrib2fv(z.location,QA);break;case 3:i.vertexAttrib3fv(z.location,QA);break;case 4:i.vertexAttrib4fv(z.location,QA);break;default:i.vertexAttrib1fv(z.location,QA)}}}}u()}function D(){S();for(const p in t){const N=t[p];for(const U in N){const v=N[U];for(const P in v)s(v[P].object),delete v[P];delete N[U]}delete t[p]}}function w(p){if(t[p.id]===void 0)return;const N=t[p.id];for(const U in N){const v=N[U];for(const P in v)s(v[P].object),delete v[P];delete N[U]}delete t[p.id]}function y(p){for(const N in t){const U=t[N];if(U[p.id]===void 0)continue;const v=U[p.id];for(const P in v)s(v[P].object),delete v[P];delete U[p.id]}}function S(){l(),C=!0,I!==g&&(I=g,a(I.object))}function l(){g.geometry=null,g.program=null,g.wireframe=!1}return{setup:o,reset:S,resetDefaultState:l,dispose:D,releaseStatesOfGeometry:w,releaseStatesOfProgram:y,initAttributes:c,enableAttribute:d,disableUnusedAttributes:u}}function _p(i,A,e){let t;function g(a){t=a}function I(a,s){i.drawArrays(t,a,s),e.update(s,t,1)}function C(a,s,Q){Q!==0&&(i.drawArraysInstanced(t,a,s,Q),e.update(s,t,Q))}function o(a,s,Q){if(Q===0)return;A.get("WEBGL_multi_draw").multiDrawArraysWEBGL(t,a,0,s,0,Q);let B=0;for(let h=0;h<Q;h++)B+=s[h];e.update(B,t,1)}function n(a,s,Q,r){if(Q===0)return;const B=A.get("WEBGL_multi_draw");if(B===null)for(let h=0;h<a.length;h++)C(a[h],s[h],r[h]);else{B.multiDrawArraysInstancedWEBGL(t,a,0,s,0,r,0,Q);let h=0;for(let c=0;c<Q;c++)h+=s[c]*r[c];e.update(h,t,1)}}this.setMode=g,this.render=I,this.renderInstances=C,this.renderMultiDraw=o,this.renderMultiDrawInstances=n}function pp(i,A,e,t){let g;function I(){if(g!==void 0)return g;if(A.has("EXT_texture_filter_anisotropic")===!0){const y=A.get("EXT_texture_filter_anisotropic");g=i.getParameter(y.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else g=0;return g}function C(y){return!(y!==jt&&t.convert(y)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(y){const S=y===vi&&(A.has("EXT_color_buffer_half_float")||A.has("EXT_color_buffer_float"));return!(y!==Gt&&t.convert(y)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&y!==Ei&&!S)}function n(y){if(y==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";y="mediump"}return y==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let a=e.precision!==void 0?e.precision:"highp";const s=n(a);s!==a&&(KA("WebGLRenderer:",a,"not supported, using",s,"instead."),a=s);const Q=e.logarithmicDepthBuffer===!0,r=e.reversedDepthBuffer===!0&&A.has("EXT_clip_control"),B=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),h=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),c=i.getParameter(i.MAX_TEXTURE_SIZE),d=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),E=i.getParameter(i.MAX_VERTEX_ATTRIBS),u=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),_=i.getParameter(i.MAX_VARYING_VECTORS),x=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),D=i.getParameter(i.MAX_SAMPLES),w=i.getParameter(i.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:I,getMaxPrecision:n,textureFormatReadable:C,textureTypeReadable:o,precision:a,logarithmicDepthBuffer:Q,reversedDepthBuffer:r,maxTextures:B,maxVertexTextures:h,maxTextureSize:c,maxCubemapSize:d,maxAttributes:E,maxVertexUniforms:u,maxVaryings:_,maxFragmentUniforms:x,maxSamples:D,samples:w}}function wp(i){const A=this;let e=null,t=0,g=!1,I=!1;const C=new qg,o=new qA,n={value:null,needsUpdate:!1};this.uniform=n,this.numPlanes=0,this.numIntersection=0,this.init=function(Q,r){const B=Q.length!==0||r||t!==0||g;return g=r,t=Q.length,B},this.beginShadows=function(){I=!0,s(null)},this.endShadows=function(){I=!1},this.setGlobalState=function(Q,r){e=s(Q,r,0)},this.setState=function(Q,r,B){const h=Q.clippingPlanes,c=Q.clipIntersection,d=Q.clipShadows,E=i.get(Q);if(!g||h===null||h.length===0||I&&!d)I?s(null):a();else{const u=I?0:t,_=u*4;let x=E.clippingState||null;n.value=x,x=s(h,r,_,B);for(let D=0;D!==_;++D)x[D]=e[D];E.clippingState=x,this.numIntersection=c?this.numPlanes:0,this.numPlanes+=u}};function a(){n.value!==e&&(n.value=e,n.needsUpdate=t>0),A.numPlanes=t,A.numIntersection=0}function s(Q,r,B,h){const c=Q!==null?Q.length:0;let d=null;if(c!==0){if(d=n.value,h!==!0||d===null){const E=B+c*4,u=r.matrixWorldInverse;o.getNormalMatrix(u),(d===null||d.length<E)&&(d=new Float32Array(E));for(let _=0,x=B;_!==c;++_,x+=4)C.copy(Q[_]).applyMatrix4(u,o),C.normal.toArray(d,x),d[x+3]=C.constant}n.value=d,n.needsUpdate=!0}return A.numPlanes=c,A.numIntersection=0,d}}function mp(i){let A=new WeakMap;function e(C,o){return o===ys?C.mapping=Lg:o===bs&&(C.mapping=lI),C}function t(C){if(C&&C.isTexture){const o=C.mapping;if(o===ys||o===bs)if(A.has(C)){const n=A.get(C).texture;return e(n,C.mapping)}else{const n=C.image;if(n&&n.height>0){const a=new vc(n.height);return a.fromEquirectangularTexture(i,C),A.set(C,a),C.addEventListener("dispose",g),e(a.texture,C.mapping)}else return null}}return C}function g(C){const o=C.target;o.removeEventListener("dispose",g);const n=A.get(o);n!==void 0&&(A.delete(o),n.dispose())}function I(){A=new WeakMap}return{get:t,dispose:I}}const xg=4,Hc=[.125,.215,.35,.446,.526,.582],Og=20,yp=256,kC=new Yc,Pc=new Ie;let jQ=null,WQ=0,XQ=0,ZQ=!1;const bp=new J;class Oc{constructor(A){this._renderer=A,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(A,e=0,t=.1,g=100,I={}){const{size:C=256,position:o=bp}=I;jQ=this._renderer.getRenderTarget(),WQ=this._renderer.getActiveCubeFace(),XQ=this._renderer.getActiveMipmapLevel(),ZQ=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(C);const n=this._allocateTargets();return n.depthBuffer=!0,this._sceneToCubeUV(A,t,g,n,o),e>0&&this._blur(n,0,0,e),this._applyPMREM(n),this._cleanup(n),n}fromEquirectangular(A,e=null){return this._fromTexture(A,e)}fromCubemap(A,e=null){return this._fromTexture(A,e)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Wc(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=jc(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(A){this._lodMax=Math.floor(Math.log2(A)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let A=0;A<this._lodMeshes.length;A++)this._lodMeshes[A].geometry.dispose()}_cleanup(A){this._renderer.setRenderTarget(jQ,WQ,XQ),this._renderer.xr.enabled=ZQ,A.scissorTest=!1,LI(A,0,0,A.width,A.height)}_fromTexture(A,e){A.mapping===Lg||A.mapping===lI?this._setSize(A.image.length===0?16:A.image[0].width||A.image[0].image.width):this._setSize(A.image.width/4),jQ=this._renderer.getRenderTarget(),WQ=this._renderer.getActiveCubeFace(),XQ=this._renderer.getActiveMipmapLevel(),ZQ=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const t=e||this._allocateTargets();return this._textureToCubeUV(A,t),this._applyPMREM(t),this._cleanup(t),t}_allocateTargets(){const A=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,t={magFilter:et,minFilter:et,generateMipmaps:!1,type:vi,format:jt,colorSpace:uI,depthBuffer:!1},g=Vc(A,e,t);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==A||this._pingPongRenderTarget.height!==e){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Vc(A,e,t);const{_lodMax:I}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=Np(I)),this._blurMaterial=Sp(I,A,e),this._ggxMaterial=kp(I,A,e)}return g}_compileMaterial(A){const e=new Ai(new $t,A);this._renderer.compile(e,kC)}_sceneToCubeUV(A,e,t,g,I){const n=new Lt(90,1,e,t),a=[1,-1,1,1,1,1],s=[1,1,1,-1,-1,-1],Q=this._renderer,r=Q.autoClear,B=Q.toneMapping;Q.getClearColor(Pc),Q.toneMapping=ri,Q.autoClear=!1,Q.state.buffers.depth.getReversed()&&(Q.setRenderTarget(g),Q.clearDepth(),Q.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Ai(new bC,new yc({name:"PMREM.Background",side:It,depthWrite:!1,depthTest:!1})));const c=this._backgroundBox,d=c.material;let E=!1;const u=A.background;u?u.isColor&&(d.color.copy(u),A.background=null,E=!0):(d.color.copy(Pc),E=!0);for(let _=0;_<6;_++){const x=_%3;x===0?(n.up.set(0,a[_],0),n.position.set(I.x,I.y,I.z),n.lookAt(I.x+s[_],I.y,I.z)):x===1?(n.up.set(0,0,a[_]),n.position.set(I.x,I.y,I.z),n.lookAt(I.x,I.y+s[_],I.z)):(n.up.set(0,a[_],0),n.position.set(I.x,I.y,I.z),n.lookAt(I.x,I.y,I.z+s[_]));const D=this._cubeSize;LI(g,x*D,_>2?D:0,D,D),Q.setRenderTarget(g),E&&Q.render(c,n),Q.render(A,n)}Q.toneMapping=B,Q.autoClear=r,A.background=u}_textureToCubeUV(A,e){const t=this._renderer,g=A.mapping===Lg||A.mapping===lI;g?(this._cubemapMaterial===null&&(this._cubemapMaterial=Wc()),this._cubemapMaterial.uniforms.flipEnvMap.value=A.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=jc());const I=g?this._cubemapMaterial:this._equirectMaterial,C=this._lodMeshes[0];C.material=I;const o=I.uniforms;o.envMap.value=A;const n=this._cubeSize;LI(e,0,0,3*n,2*n),t.setRenderTarget(e),t.render(C,kC)}_applyPMREM(A){const e=this._renderer,t=e.autoClear;e.autoClear=!1;const g=this._lodMeshes.length;for(let I=1;I<g;I++)this._applyGGXFilter(A,I-1,I);e.autoClear=t}_applyGGXFilter(A,e,t){const g=this._renderer,I=this._pingPongRenderTarget,C=this._ggxMaterial,o=this._lodMeshes[t];o.material=C;const n=C.uniforms,a=t/(this._lodMeshes.length-1),s=e/(this._lodMeshes.length-1),Q=Math.sqrt(a*a-s*s),r=0+a*1.25,B=Q*r,{_lodMax:h}=this,c=this._sizeLods[t],d=3*c*(t>h-xg?t-h+xg:0),E=4*(this._cubeSize-c);n.envMap.value=A.texture,n.roughness.value=B,n.mipInt.value=h-e,LI(I,d,E,3*c,2*c),g.setRenderTarget(I),g.render(o,kC),n.envMap.value=I.texture,n.roughness.value=0,n.mipInt.value=h-t,LI(A,d,E,3*c,2*c),g.setRenderTarget(A),g.render(o,kC)}_blur(A,e,t,g,I){const C=this._pingPongRenderTarget;this._halfBlur(A,C,e,t,g,"latitudinal",I),this._halfBlur(C,A,t,t,g,"longitudinal",I)}_halfBlur(A,e,t,g,I,C,o){const n=this._renderer,a=this._blurMaterial;C!=="latitudinal"&&C!=="longitudinal"&&ae("blur direction must be either latitudinal or longitudinal!");const s=3,Q=this._lodMeshes[g];Q.material=a;const r=a.uniforms,B=this._sizeLods[t]-1,h=isFinite(I)?Math.PI/(2*B):2*Math.PI/(2*Og-1),c=I/h,d=isFinite(I)?1+Math.floor(s*c):Og;d>Og&&KA(`sigmaRadians, ${I}, is too large and will clip, as it requested ${d} samples when the maximum is set to ${Og}`);const E=[];let u=0;for(let y=0;y<Og;++y){const S=y/c,l=Math.exp(-S*S/2);E.push(l),y===0?u+=l:y<d&&(u+=2*l)}for(let y=0;y<E.length;y++)E[y]=E[y]/u;r.envMap.value=A.texture,r.samples.value=d,r.weights.value=E,r.latitudinal.value=C==="latitudinal",o&&(r.poleAxis.value=o);const{_lodMax:_}=this;r.dTheta.value=h,r.mipInt.value=_-t;const x=this._sizeLods[g],D=3*x*(g>_-xg?g-_+xg:0),w=4*(this._cubeSize-x);LI(e,D,w,3*x,2*x),n.setRenderTarget(e),n.render(Q,kC)}}function Np(i){const A=[],e=[],t=[];let g=i;const I=i-xg+1+Hc.length;for(let C=0;C<I;C++){const o=Math.pow(2,g);A.push(o);let n=1/o;C>i-xg?n=Hc[C-i+xg-1]:C===0&&(n=0),e.push(n);const a=1/(o-2),s=-a,Q=1+a,r=[s,s,Q,s,Q,Q,s,s,Q,Q,s,Q],B=6,h=6,c=3,d=2,E=1,u=new Float32Array(c*h*B),_=new Float32Array(d*h*B),x=new Float32Array(E*h*B);for(let w=0;w<B;w++){const y=w%3*2/3-1,S=w>2?0:-1,l=[y,S,0,y+2/3,S,0,y+2/3,S+1,0,y,S,0,y+2/3,S+1,0,y,S+1,0];u.set(l,c*h*w),_.set(r,d*h*w);const p=[w,w,w,w,w,w];x.set(p,E*h*w)}const D=new $t;D.setAttribute("position",new hi(u,c)),D.setAttribute("uv",new hi(_,d)),D.setAttribute("faceIndex",new hi(x,E)),t.push(new Ai(D,null)),g>xg&&g--}return{lodMeshes:t,sizeLods:A,sigmas:e}}function Vc(i,A,e){const t=new di(i,A,e);return t.texture.mapping=Ko,t.texture.name="PMREM.cubeUv",t.scissorTest=!0,t}function LI(i,A,e,t,g){i.viewport.set(A,e,t,g),i.scissor.set(A,e,t,g)}function kp(i,A,e){return new Ut({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:yp,CUBEUV_TEXEL_WIDTH:1/A,CUBEUV_TEXEL_HEIGHT:1/e,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:dn(),fragmentShader:`
3759
+ }`},hA={common:{diffuse:{value:new Ie(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new qA},alphaMap:{value:null},alphaMapTransform:{value:new qA},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new qA}},envmap:{envMap:{value:null},envMapRotation:{value:new qA},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new qA}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new qA}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new qA},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new qA},normalScale:{value:new Be(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new qA},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new qA}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new qA}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new qA}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ie(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Ie(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new qA},alphaTest:{value:0},uvTransform:{value:new qA}},sprite:{diffuse:{value:new Ie(16777215)},opacity:{value:1},center:{value:new Be(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new qA},alphaMap:{value:null},alphaMapTransform:{value:new qA},alphaTest:{value:0}}},li={basic:{uniforms:at([hA.common,hA.specularmap,hA.envmap,hA.aomap,hA.lightmap,hA.fog]),vertexShader:OA.meshbasic_vert,fragmentShader:OA.meshbasic_frag},lambert:{uniforms:at([hA.common,hA.specularmap,hA.envmap,hA.aomap,hA.lightmap,hA.emissivemap,hA.bumpmap,hA.normalmap,hA.displacementmap,hA.fog,hA.lights,{emissive:{value:new Ie(0)}}]),vertexShader:OA.meshlambert_vert,fragmentShader:OA.meshlambert_frag},phong:{uniforms:at([hA.common,hA.specularmap,hA.envmap,hA.aomap,hA.lightmap,hA.emissivemap,hA.bumpmap,hA.normalmap,hA.displacementmap,hA.fog,hA.lights,{emissive:{value:new Ie(0)},specular:{value:new Ie(1118481)},shininess:{value:30}}]),vertexShader:OA.meshphong_vert,fragmentShader:OA.meshphong_frag},standard:{uniforms:at([hA.common,hA.envmap,hA.aomap,hA.lightmap,hA.emissivemap,hA.bumpmap,hA.normalmap,hA.displacementmap,hA.roughnessmap,hA.metalnessmap,hA.fog,hA.lights,{emissive:{value:new Ie(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:OA.meshphysical_vert,fragmentShader:OA.meshphysical_frag},toon:{uniforms:at([hA.common,hA.aomap,hA.lightmap,hA.emissivemap,hA.bumpmap,hA.normalmap,hA.displacementmap,hA.gradientmap,hA.fog,hA.lights,{emissive:{value:new Ie(0)}}]),vertexShader:OA.meshtoon_vert,fragmentShader:OA.meshtoon_frag},matcap:{uniforms:at([hA.common,hA.bumpmap,hA.normalmap,hA.displacementmap,hA.fog,{matcap:{value:null}}]),vertexShader:OA.meshmatcap_vert,fragmentShader:OA.meshmatcap_frag},points:{uniforms:at([hA.points,hA.fog]),vertexShader:OA.points_vert,fragmentShader:OA.points_frag},dashed:{uniforms:at([hA.common,hA.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:OA.linedashed_vert,fragmentShader:OA.linedashed_frag},depth:{uniforms:at([hA.common,hA.displacementmap]),vertexShader:OA.depth_vert,fragmentShader:OA.depth_frag},normal:{uniforms:at([hA.common,hA.bumpmap,hA.normalmap,hA.displacementmap,{opacity:{value:1}}]),vertexShader:OA.meshnormal_vert,fragmentShader:OA.meshnormal_frag},sprite:{uniforms:at([hA.sprite,hA.fog]),vertexShader:OA.sprite_vert,fragmentShader:OA.sprite_frag},background:{uniforms:{uvTransform:{value:new qA},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:OA.background_vert,fragmentShader:OA.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new qA}},vertexShader:OA.backgroundCube_vert,fragmentShader:OA.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:OA.cube_vert,fragmentShader:OA.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:OA.equirect_vert,fragmentShader:OA.equirect_frag},distance:{uniforms:at([hA.common,hA.displacementmap,{referencePosition:{value:new J},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:OA.distance_vert,fragmentShader:OA.distance_frag},shadow:{uniforms:at([hA.lights,hA.fog,{color:{value:new Ie(0)},opacity:{value:1}}]),vertexShader:OA.shadow_vert,fragmentShader:OA.shadow_frag}};li.physical={uniforms:at([li.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new qA},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new qA},clearcoatNormalScale:{value:new Be(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new qA},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new qA},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new qA},sheen:{value:0},sheenColor:{value:new Ie(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new qA},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new qA},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new qA},transmissionSamplerSize:{value:new Be},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new qA},attenuationDistance:{value:0},attenuationColor:{value:new Ie(0)},specularColor:{value:new Ie(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new qA},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new qA},anisotropyVector:{value:new Be},anisotropyMap:{value:null},anisotropyMapTransform:{value:new qA}}]),vertexShader:OA.meshphysical_vert,fragmentShader:OA.meshphysical_frag};const cn={r:0,b:0,g:0},Pg=new qi,up=new Ye;function fp(i,A,e,t,g,I,C){const o=new Ie(0);let n=I===!0?0:1,a,s,Q=null,r=0,B=null;function h(_){let x=_.isScene===!0?_.background:null;return x&&x.isTexture&&(x=(_.backgroundBlurriness>0?e:A).get(x)),x}function c(_){let x=!1;const D=h(_);D===null?E(o,n):D&&D.isColor&&(E(D,1),x=!0);const w=i.xr.getEnvironmentBlendMode();w==="additive"?t.buffers.color.setClear(0,0,0,1,C):w==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,C),(i.autoClear||x)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function d(_,x){const D=h(x);D&&(D.isCubeTexture||D.mapping===Ko)?(s===void 0&&(s=new Ai(new bC(1,1,1),new Ut({name:"BackgroundCubeMaterial",uniforms:MI(li.backgroundCube.uniforms),vertexShader:li.backgroundCube.vertexShader,fragmentShader:li.backgroundCube.fragmentShader,side:Ct,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),s.geometry.deleteAttribute("normal"),s.geometry.deleteAttribute("uv"),s.onBeforeRender=function(w,y,S){this.matrixWorld.copyPosition(S.matrixWorld)},Object.defineProperty(s.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),g.update(s)),Pg.copy(x.backgroundRotation),Pg.x*=-1,Pg.y*=-1,Pg.z*=-1,D.isCubeTexture&&D.isRenderTargetTexture===!1&&(Pg.y*=-1,Pg.z*=-1),s.material.uniforms.envMap.value=D,s.material.uniforms.flipEnvMap.value=D.isCubeTexture&&D.isRenderTargetTexture===!1?-1:1,s.material.uniforms.backgroundBlurriness.value=x.backgroundBlurriness,s.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,s.material.uniforms.backgroundRotation.value.setFromMatrix4(up.makeRotationFromEuler(Pg)),s.material.toneMapped=oe.getTransfer(D.colorSpace)!==ce,(Q!==D||r!==D.version||B!==i.toneMapping)&&(s.material.needsUpdate=!0,Q=D,r=D.version,B=i.toneMapping),s.layers.enableAll(),_.unshift(s,s.geometry,s.material,0,0,null)):D&&D.isTexture&&(a===void 0&&(a=new Ai(new En(2,2),new Ut({name:"BackgroundMaterial",uniforms:MI(li.background.uniforms),vertexShader:li.background.vertexShader,fragmentShader:li.background.fragmentShader,side:Mi,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),a.geometry.deleteAttribute("normal"),Object.defineProperty(a.material,"map",{get:function(){return this.uniforms.t2D.value}}),g.update(a)),a.material.uniforms.t2D.value=D,a.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,a.material.toneMapped=oe.getTransfer(D.colorSpace)!==ce,D.matrixAutoUpdate===!0&&D.updateMatrix(),a.material.uniforms.uvTransform.value.copy(D.matrix),(Q!==D||r!==D.version||B!==i.toneMapping)&&(a.material.needsUpdate=!0,Q=D,r=D.version,B=i.toneMapping),a.layers.enableAll(),_.unshift(a,a.geometry,a.material,0,0,null))}function E(_,x){_.getRGB(cn,Gc(i)),t.buffers.color.setClear(cn.r,cn.g,cn.b,x,C)}function u(){s!==void 0&&(s.geometry.dispose(),s.material.dispose(),s=void 0),a!==void 0&&(a.geometry.dispose(),a.material.dispose(),a=void 0)}return{getClearColor:function(){return o},setClearColor:function(_,x=1){o.set(_),n=x,E(o,n)},getClearAlpha:function(){return n},setClearAlpha:function(_){n=_,E(o,n)},render:c,addToRenderList:d,dispose:u}}function Dp(i,A){const e=i.getParameter(i.MAX_VERTEX_ATTRIBS),t={},g=r(null);let I=g,C=!1;function o(p,N,U,v,P){let W=!1;const H=Q(v,U,N);I!==H&&(I=H,a(I.object)),W=B(p,v,U,P),W&&h(p,v,U,P),P!==null&&A.update(P,i.ELEMENT_ARRAY_BUFFER),(W||C)&&(C=!1,x(p,N,U,v),P!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,A.get(P).buffer))}function n(){return i.createVertexArray()}function a(p){return i.bindVertexArray(p)}function s(p){return i.deleteVertexArray(p)}function Q(p,N,U){const v=U.wireframe===!0;let P=t[p.id];P===void 0&&(P={},t[p.id]=P);let W=P[N.id];W===void 0&&(W={},P[N.id]=W);let H=W[v];return H===void 0&&(H=r(n()),W[v]=H),H}function r(p){const N=[],U=[],v=[];for(let P=0;P<e;P++)N[P]=0,U[P]=0,v[P]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:N,enabledAttributes:U,attributeDivisors:v,object:p,attributes:{},index:null}}function B(p,N,U,v){const P=I.attributes,W=N.attributes;let H=0;const O=U.getAttributes();for(const z in O)if(O[z].location>=0){const QA=P[z];let uA=W[z];if(uA===void 0&&(z==="instanceMatrix"&&p.instanceMatrix&&(uA=p.instanceMatrix),z==="instanceColor"&&p.instanceColor&&(uA=p.instanceColor)),QA===void 0||QA.attribute!==uA||uA&&QA.data!==uA.data)return!0;H++}return I.attributesNum!==H||I.index!==v}function h(p,N,U,v){const P={},W=N.attributes;let H=0;const O=U.getAttributes();for(const z in O)if(O[z].location>=0){let QA=W[z];QA===void 0&&(z==="instanceMatrix"&&p.instanceMatrix&&(QA=p.instanceMatrix),z==="instanceColor"&&p.instanceColor&&(QA=p.instanceColor));const uA={};uA.attribute=QA,QA&&QA.data&&(uA.data=QA.data),P[z]=uA,H++}I.attributes=P,I.attributesNum=H,I.index=v}function c(){const p=I.newAttributes;for(let N=0,U=p.length;N<U;N++)p[N]=0}function d(p){E(p,0)}function E(p,N){const U=I.newAttributes,v=I.enabledAttributes,P=I.attributeDivisors;U[p]=1,v[p]===0&&(i.enableVertexAttribArray(p),v[p]=1),P[p]!==N&&(i.vertexAttribDivisor(p,N),P[p]=N)}function u(){const p=I.newAttributes,N=I.enabledAttributes;for(let U=0,v=N.length;U<v;U++)N[U]!==p[U]&&(i.disableVertexAttribArray(U),N[U]=0)}function _(p,N,U,v,P,W,H){H===!0?i.vertexAttribIPointer(p,N,U,P,W):i.vertexAttribPointer(p,N,U,v,P,W)}function x(p,N,U,v){c();const P=v.attributes,W=U.getAttributes(),H=N.defaultAttributeValues;for(const O in W){const z=W[O];if(z.location>=0){let lA=P[O];if(lA===void 0&&(O==="instanceMatrix"&&p.instanceMatrix&&(lA=p.instanceMatrix),O==="instanceColor"&&p.instanceColor&&(lA=p.instanceColor)),lA!==void 0){const QA=lA.normalized,uA=lA.itemSize,TA=A.get(lA);if(TA===void 0)continue;const YA=TA.buffer,Ne=TA.type,ue=TA.bytesPerElement,Z=Ne===i.INT||Ne===i.UNSIGNED_INT||lA.gpuType===Rs;if(lA.isInterleavedBufferAttribute){const gA=lA.data,wA=gA.stride,PA=lA.offset;if(gA.isInstancedInterleavedBuffer){for(let bA=0;bA<z.locationSize;bA++)E(z.location+bA,gA.meshPerAttribute);p.isInstancedMesh!==!0&&v._maxInstanceCount===void 0&&(v._maxInstanceCount=gA.meshPerAttribute*gA.count)}else for(let bA=0;bA<z.locationSize;bA++)d(z.location+bA);i.bindBuffer(i.ARRAY_BUFFER,YA);for(let bA=0;bA<z.locationSize;bA++)_(z.location+bA,uA/z.locationSize,Ne,QA,wA*ue,(PA+uA/z.locationSize*bA)*ue,Z)}else{if(lA.isInstancedBufferAttribute){for(let gA=0;gA<z.locationSize;gA++)E(z.location+gA,lA.meshPerAttribute);p.isInstancedMesh!==!0&&v._maxInstanceCount===void 0&&(v._maxInstanceCount=lA.meshPerAttribute*lA.count)}else for(let gA=0;gA<z.locationSize;gA++)d(z.location+gA);i.bindBuffer(i.ARRAY_BUFFER,YA);for(let gA=0;gA<z.locationSize;gA++)_(z.location+gA,uA/z.locationSize,Ne,QA,uA*ue,uA/z.locationSize*gA*ue,Z)}}else if(H!==void 0){const QA=H[O];if(QA!==void 0)switch(QA.length){case 2:i.vertexAttrib2fv(z.location,QA);break;case 3:i.vertexAttrib3fv(z.location,QA);break;case 4:i.vertexAttrib4fv(z.location,QA);break;default:i.vertexAttrib1fv(z.location,QA)}}}}u()}function D(){S();for(const p in t){const N=t[p];for(const U in N){const v=N[U];for(const P in v)s(v[P].object),delete v[P];delete N[U]}delete t[p]}}function w(p){if(t[p.id]===void 0)return;const N=t[p.id];for(const U in N){const v=N[U];for(const P in v)s(v[P].object),delete v[P];delete N[U]}delete t[p.id]}function y(p){for(const N in t){const U=t[N];if(U[p.id]===void 0)continue;const v=U[p.id];for(const P in v)s(v[P].object),delete v[P];delete U[p.id]}}function S(){l(),C=!0,I!==g&&(I=g,a(I.object))}function l(){g.geometry=null,g.program=null,g.wireframe=!1}return{setup:o,reset:S,resetDefaultState:l,dispose:D,releaseStatesOfGeometry:w,releaseStatesOfProgram:y,initAttributes:c,enableAttribute:d,disableUnusedAttributes:u}}function _p(i,A,e){let t;function g(a){t=a}function I(a,s){i.drawArrays(t,a,s),e.update(s,t,1)}function C(a,s,Q){Q!==0&&(i.drawArraysInstanced(t,a,s,Q),e.update(s,t,Q))}function o(a,s,Q){if(Q===0)return;A.get("WEBGL_multi_draw").multiDrawArraysWEBGL(t,a,0,s,0,Q);let B=0;for(let h=0;h<Q;h++)B+=s[h];e.update(B,t,1)}function n(a,s,Q,r){if(Q===0)return;const B=A.get("WEBGL_multi_draw");if(B===null)for(let h=0;h<a.length;h++)C(a[h],s[h],r[h]);else{B.multiDrawArraysInstancedWEBGL(t,a,0,s,0,r,0,Q);let h=0;for(let c=0;c<Q;c++)h+=s[c]*r[c];e.update(h,t,1)}}this.setMode=g,this.render=I,this.renderInstances=C,this.renderMultiDraw=o,this.renderMultiDrawInstances=n}function pp(i,A,e,t){let g;function I(){if(g!==void 0)return g;if(A.has("EXT_texture_filter_anisotropic")===!0){const y=A.get("EXT_texture_filter_anisotropic");g=i.getParameter(y.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else g=0;return g}function C(y){return!(y!==jt&&t.convert(y)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(y){const S=y===vi&&(A.has("EXT_color_buffer_half_float")||A.has("EXT_color_buffer_float"));return!(y!==Gt&&t.convert(y)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&y!==Ei&&!S)}function n(y){if(y==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";y="mediump"}return y==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let a=e.precision!==void 0?e.precision:"highp";const s=n(a);s!==a&&(KA("WebGLRenderer:",a,"not supported, using",s,"instead."),a=s);const Q=e.logarithmicDepthBuffer===!0,r=e.reversedDepthBuffer===!0&&A.has("EXT_clip_control"),B=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),h=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),c=i.getParameter(i.MAX_TEXTURE_SIZE),d=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),E=i.getParameter(i.MAX_VERTEX_ATTRIBS),u=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),_=i.getParameter(i.MAX_VARYING_VECTORS),x=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),D=i.getParameter(i.MAX_SAMPLES),w=i.getParameter(i.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:I,getMaxPrecision:n,textureFormatReadable:C,textureTypeReadable:o,precision:a,logarithmicDepthBuffer:Q,reversedDepthBuffer:r,maxTextures:B,maxVertexTextures:h,maxTextureSize:c,maxCubemapSize:d,maxAttributes:E,maxVertexUniforms:u,maxVaryings:_,maxFragmentUniforms:x,maxSamples:D,samples:w}}function wp(i){const A=this;let e=null,t=0,g=!1,I=!1;const C=new qg,o=new qA,n={value:null,needsUpdate:!1};this.uniform=n,this.numPlanes=0,this.numIntersection=0,this.init=function(Q,r){const B=Q.length!==0||r||t!==0||g;return g=r,t=Q.length,B},this.beginShadows=function(){I=!0,s(null)},this.endShadows=function(){I=!1},this.setGlobalState=function(Q,r){e=s(Q,r,0)},this.setState=function(Q,r,B){const h=Q.clippingPlanes,c=Q.clipIntersection,d=Q.clipShadows,E=i.get(Q);if(!g||h===null||h.length===0||I&&!d)I?s(null):a();else{const u=I?0:t,_=u*4;let x=E.clippingState||null;n.value=x,x=s(h,r,_,B);for(let D=0;D!==_;++D)x[D]=e[D];E.clippingState=x,this.numIntersection=c?this.numPlanes:0,this.numPlanes+=u}};function a(){n.value!==e&&(n.value=e,n.needsUpdate=t>0),A.numPlanes=t,A.numIntersection=0}function s(Q,r,B,h){const c=Q!==null?Q.length:0;let d=null;if(c!==0){if(d=n.value,h!==!0||d===null){const E=B+c*4,u=r.matrixWorldInverse;o.getNormalMatrix(u),(d===null||d.length<E)&&(d=new Float32Array(E));for(let _=0,x=B;_!==c;++_,x+=4)C.copy(Q[_]).applyMatrix4(u,o),C.normal.toArray(d,x),d[x+3]=C.constant}n.value=d,n.needsUpdate=!0}return A.numPlanes=c,A.numIntersection=0,d}}function mp(i){let A=new WeakMap;function e(C,o){return o===ys?C.mapping=Lg:o===bs&&(C.mapping=lI),C}function t(C){if(C&&C.isTexture){const o=C.mapping;if(o===ys||o===bs)if(A.has(C)){const n=A.get(C).texture;return e(n,C.mapping)}else{const n=C.image;if(n&&n.height>0){const a=new vc(n.height);return a.fromEquirectangularTexture(i,C),A.set(C,a),C.addEventListener("dispose",g),e(a.texture,C.mapping)}else return null}}return C}function g(C){const o=C.target;o.removeEventListener("dispose",g);const n=A.get(o);n!==void 0&&(A.delete(o),n.dispose())}function I(){A=new WeakMap}return{get:t,dispose:I}}const xg=4,Hc=[.125,.215,.35,.446,.526,.582],Og=20,yp=256,kC=new Yc,Pc=new Ie;let jQ=null,WQ=0,XQ=0,ZQ=!1;const bp=new J;class Oc{constructor(A){this._renderer=A,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(A,e=0,t=.1,g=100,I={}){const{size:C=256,position:o=bp}=I;jQ=this._renderer.getRenderTarget(),WQ=this._renderer.getActiveCubeFace(),XQ=this._renderer.getActiveMipmapLevel(),ZQ=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(C);const n=this._allocateTargets();return n.depthBuffer=!0,this._sceneToCubeUV(A,t,g,n,o),e>0&&this._blur(n,0,0,e),this._applyPMREM(n),this._cleanup(n),n}fromEquirectangular(A,e=null){return this._fromTexture(A,e)}fromCubemap(A,e=null){return this._fromTexture(A,e)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Wc(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=jc(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(A){this._lodMax=Math.floor(Math.log2(A)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let A=0;A<this._lodMeshes.length;A++)this._lodMeshes[A].geometry.dispose()}_cleanup(A){this._renderer.setRenderTarget(jQ,WQ,XQ),this._renderer.xr.enabled=ZQ,A.scissorTest=!1,LI(A,0,0,A.width,A.height)}_fromTexture(A,e){A.mapping===Lg||A.mapping===lI?this._setSize(A.image.length===0?16:A.image[0].width||A.image[0].image.width):this._setSize(A.image.width/4),jQ=this._renderer.getRenderTarget(),WQ=this._renderer.getActiveCubeFace(),XQ=this._renderer.getActiveMipmapLevel(),ZQ=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const t=e||this._allocateTargets();return this._textureToCubeUV(A,t),this._applyPMREM(t),this._cleanup(t),t}_allocateTargets(){const A=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,t={magFilter:tt,minFilter:tt,generateMipmaps:!1,type:vi,format:jt,colorSpace:uI,depthBuffer:!1},g=Vc(A,e,t);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==A||this._pingPongRenderTarget.height!==e){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Vc(A,e,t);const{_lodMax:I}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=Np(I)),this._blurMaterial=Sp(I,A,e),this._ggxMaterial=kp(I,A,e)}return g}_compileMaterial(A){const e=new Ai(new $t,A);this._renderer.compile(e,kC)}_sceneToCubeUV(A,e,t,g,I){const n=new Lt(90,1,e,t),a=[1,-1,1,1,1,1],s=[1,1,1,-1,-1,-1],Q=this._renderer,r=Q.autoClear,B=Q.toneMapping;Q.getClearColor(Pc),Q.toneMapping=ri,Q.autoClear=!1,Q.state.buffers.depth.getReversed()&&(Q.setRenderTarget(g),Q.clearDepth(),Q.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Ai(new bC,new yc({name:"PMREM.Background",side:Ct,depthWrite:!1,depthTest:!1})));const c=this._backgroundBox,d=c.material;let E=!1;const u=A.background;u?u.isColor&&(d.color.copy(u),A.background=null,E=!0):(d.color.copy(Pc),E=!0);for(let _=0;_<6;_++){const x=_%3;x===0?(n.up.set(0,a[_],0),n.position.set(I.x,I.y,I.z),n.lookAt(I.x+s[_],I.y,I.z)):x===1?(n.up.set(0,0,a[_]),n.position.set(I.x,I.y,I.z),n.lookAt(I.x,I.y+s[_],I.z)):(n.up.set(0,a[_],0),n.position.set(I.x,I.y,I.z),n.lookAt(I.x,I.y,I.z+s[_]));const D=this._cubeSize;LI(g,x*D,_>2?D:0,D,D),Q.setRenderTarget(g),E&&Q.render(c,n),Q.render(A,n)}Q.toneMapping=B,Q.autoClear=r,A.background=u}_textureToCubeUV(A,e){const t=this._renderer,g=A.mapping===Lg||A.mapping===lI;g?(this._cubemapMaterial===null&&(this._cubemapMaterial=Wc()),this._cubemapMaterial.uniforms.flipEnvMap.value=A.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=jc());const I=g?this._cubemapMaterial:this._equirectMaterial,C=this._lodMeshes[0];C.material=I;const o=I.uniforms;o.envMap.value=A;const n=this._cubeSize;LI(e,0,0,3*n,2*n),t.setRenderTarget(e),t.render(C,kC)}_applyPMREM(A){const e=this._renderer,t=e.autoClear;e.autoClear=!1;const g=this._lodMeshes.length;for(let I=1;I<g;I++)this._applyGGXFilter(A,I-1,I);e.autoClear=t}_applyGGXFilter(A,e,t){const g=this._renderer,I=this._pingPongRenderTarget,C=this._ggxMaterial,o=this._lodMeshes[t];o.material=C;const n=C.uniforms,a=t/(this._lodMeshes.length-1),s=e/(this._lodMeshes.length-1),Q=Math.sqrt(a*a-s*s),r=0+a*1.25,B=Q*r,{_lodMax:h}=this,c=this._sizeLods[t],d=3*c*(t>h-xg?t-h+xg:0),E=4*(this._cubeSize-c);n.envMap.value=A.texture,n.roughness.value=B,n.mipInt.value=h-e,LI(I,d,E,3*c,2*c),g.setRenderTarget(I),g.render(o,kC),n.envMap.value=I.texture,n.roughness.value=0,n.mipInt.value=h-t,LI(A,d,E,3*c,2*c),g.setRenderTarget(A),g.render(o,kC)}_blur(A,e,t,g,I){const C=this._pingPongRenderTarget;this._halfBlur(A,C,e,t,g,"latitudinal",I),this._halfBlur(C,A,t,t,g,"longitudinal",I)}_halfBlur(A,e,t,g,I,C,o){const n=this._renderer,a=this._blurMaterial;C!=="latitudinal"&&C!=="longitudinal"&&ae("blur direction must be either latitudinal or longitudinal!");const s=3,Q=this._lodMeshes[g];Q.material=a;const r=a.uniforms,B=this._sizeLods[t]-1,h=isFinite(I)?Math.PI/(2*B):2*Math.PI/(2*Og-1),c=I/h,d=isFinite(I)?1+Math.floor(s*c):Og;d>Og&&KA(`sigmaRadians, ${I}, is too large and will clip, as it requested ${d} samples when the maximum is set to ${Og}`);const E=[];let u=0;for(let y=0;y<Og;++y){const S=y/c,l=Math.exp(-S*S/2);E.push(l),y===0?u+=l:y<d&&(u+=2*l)}for(let y=0;y<E.length;y++)E[y]=E[y]/u;r.envMap.value=A.texture,r.samples.value=d,r.weights.value=E,r.latitudinal.value=C==="latitudinal",o&&(r.poleAxis.value=o);const{_lodMax:_}=this;r.dTheta.value=h,r.mipInt.value=_-t;const x=this._sizeLods[g],D=3*x*(g>_-xg?g-_+xg:0),w=4*(this._cubeSize-x);LI(e,D,w,3*x,2*x),n.setRenderTarget(e),n.render(Q,kC)}}function Np(i){const A=[],e=[],t=[];let g=i;const I=i-xg+1+Hc.length;for(let C=0;C<I;C++){const o=Math.pow(2,g);A.push(o);let n=1/o;C>i-xg?n=Hc[C-i+xg-1]:C===0&&(n=0),e.push(n);const a=1/(o-2),s=-a,Q=1+a,r=[s,s,Q,s,Q,Q,s,s,Q,Q,s,Q],B=6,h=6,c=3,d=2,E=1,u=new Float32Array(c*h*B),_=new Float32Array(d*h*B),x=new Float32Array(E*h*B);for(let w=0;w<B;w++){const y=w%3*2/3-1,S=w>2?0:-1,l=[y,S,0,y+2/3,S,0,y+2/3,S+1,0,y,S,0,y+2/3,S+1,0,y,S+1,0];u.set(l,c*h*w),_.set(r,d*h*w);const p=[w,w,w,w,w,w];x.set(p,E*h*w)}const D=new $t;D.setAttribute("position",new hi(u,c)),D.setAttribute("uv",new hi(_,d)),D.setAttribute("faceIndex",new hi(x,E)),t.push(new Ai(D,null)),g>xg&&g--}return{lodMeshes:t,sizeLods:A,sigmas:e}}function Vc(i,A,e){const t=new di(i,A,e);return t.texture.mapping=Ko,t.texture.name="PMREM.cubeUv",t.scissorTest=!0,t}function LI(i,A,e,t,g){i.viewport.set(A,e,t,g),i.scissor.set(A,e,t,g)}function kp(i,A,e){return new Ut({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:yp,CUBEUV_TEXEL_WIDTH:1/A,CUBEUV_TEXEL_HEIGHT:1/e,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:dn(),fragmentShader:`
3760
3760
 
3761
3761
  precision highp float;
3762
3762
  precision highp int;
@@ -4014,7 +4014,7 @@ void main() {
4014
4014
  gl_Position = vec4( position, 1.0 );
4015
4015
 
4016
4016
  }
4017
- `}function Rp(i){let A=new WeakMap,e=null;function t(o){if(o&&o.isTexture){const n=o.mapping,a=n===ys||n===bs,s=n===Lg||n===lI;if(a||s){let Q=A.get(o);const r=Q!==void 0?Q.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==r)return e===null&&(e=new Oc(i)),Q=a?e.fromEquirectangular(o,Q):e.fromCubemap(o,Q),Q.texture.pmremVersion=o.pmremVersion,A.set(o,Q),Q.texture;if(Q!==void 0)return Q.texture;{const B=o.image;return a&&B&&B.height>0||s&&B&&g(B)?(e===null&&(e=new Oc(i)),Q=a?e.fromEquirectangular(o):e.fromCubemap(o),Q.texture.pmremVersion=o.pmremVersion,A.set(o,Q),o.addEventListener("dispose",I),Q.texture):null}}}return o}function g(o){let n=0;const a=6;for(let s=0;s<a;s++)o[s]!==void 0&&n++;return n===a}function I(o){const n=o.target;n.removeEventListener("dispose",I);const a=A.get(n);a!==void 0&&(A.delete(n),a.dispose())}function C(){A=new WeakMap,e!==null&&(e.dispose(),e=null)}return{get:t,dispose:C}}function Gp(i){const A={};function e(t){if(A[t]!==void 0)return A[t];const g=i.getExtension(t);return A[t]=g,g}return{has:function(t){return e(t)!==null},init:function(){e("EXT_color_buffer_float"),e("WEBGL_clip_cull_distance"),e("OES_texture_float_linear"),e("EXT_color_buffer_half_float"),e("WEBGL_multisampled_render_to_texture"),e("WEBGL_render_shared_exponent")},get:function(t){const g=e(t);return g===null&&xC("WebGLRenderer: "+t+" extension not supported."),g}}}function Mp(i,A,e,t){const g={},I=new WeakMap;function C(Q){const r=Q.target;r.index!==null&&A.remove(r.index);for(const h in r.attributes)A.remove(r.attributes[h]);r.removeEventListener("dispose",C),delete g[r.id];const B=I.get(r);B&&(A.remove(B),I.delete(r)),t.releaseStatesOfGeometry(r),r.isInstancedBufferGeometry===!0&&delete r._maxInstanceCount,e.memory.geometries--}function o(Q,r){return g[r.id]===!0||(r.addEventListener("dispose",C),g[r.id]=!0,e.memory.geometries++),r}function n(Q){const r=Q.attributes;for(const B in r)A.update(r[B],i.ARRAY_BUFFER)}function a(Q){const r=[],B=Q.index,h=Q.attributes.position;let c=0;if(B!==null){const u=B.array;c=B.version;for(let _=0,x=u.length;_<x;_+=3){const D=u[_+0],w=u[_+1],y=u[_+2];r.push(D,w,w,y,y,D)}}else if(h!==void 0){const u=h.array;c=h.version;for(let _=0,x=u.length/3-1;_<x;_+=3){const D=_+0,w=_+1,y=_+2;r.push(D,w,w,y,y,D)}}else return;const d=new(sc(r)?Nc:bc)(r,1);d.version=c;const E=I.get(Q);E&&A.remove(E),I.set(Q,d)}function s(Q){const r=I.get(Q);if(r){const B=Q.index;B!==null&&r.version<B.version&&a(Q)}else a(Q);return I.get(Q)}return{get:o,update:n,getWireframeAttribute:s}}function Fp(i,A,e){let t;function g(r){t=r}let I,C;function o(r){I=r.type,C=r.bytesPerElement}function n(r,B){i.drawElements(t,B,I,r*C),e.update(B,t,1)}function a(r,B,h){h!==0&&(i.drawElementsInstanced(t,B,I,r*C,h),e.update(B,t,h))}function s(r,B,h){if(h===0)return;A.get("WEBGL_multi_draw").multiDrawElementsWEBGL(t,B,0,I,r,0,h);let d=0;for(let E=0;E<h;E++)d+=B[E];e.update(d,t,1)}function Q(r,B,h,c){if(h===0)return;const d=A.get("WEBGL_multi_draw");if(d===null)for(let E=0;E<r.length;E++)a(r[E]/C,B[E],c[E]);else{d.multiDrawElementsInstancedWEBGL(t,B,0,I,r,0,c,0,h);let E=0;for(let u=0;u<h;u++)E+=B[u]*c[u];e.update(E,t,1)}}this.setMode=g,this.setIndex=o,this.render=n,this.renderInstances=a,this.renderMultiDraw=s,this.renderMultiDrawInstances=Q}function Up(i){const A={geometries:0,textures:0},e={frame:0,calls:0,triangles:0,points:0,lines:0};function t(I,C,o){switch(e.calls++,C){case i.TRIANGLES:e.triangles+=o*(I/3);break;case i.LINES:e.lines+=o*(I/2);break;case i.LINE_STRIP:e.lines+=o*(I-1);break;case i.LINE_LOOP:e.lines+=o*I;break;case i.POINTS:e.points+=o*I;break;default:ae("WebGLInfo: Unknown draw mode:",C);break}}function g(){e.calls=0,e.triangles=0,e.points=0,e.lines=0}return{memory:A,render:e,programs:null,autoReset:!0,reset:g,update:t}}function Lp(i,A,e){const t=new WeakMap,g=new ve;function I(C,o,n){const a=C.morphTargetInfluences,s=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,Q=s!==void 0?s.length:0;let r=t.get(o);if(r===void 0||r.count!==Q){let l=function(){y.dispose(),t.delete(o),o.removeEventListener("dispose",l)};r!==void 0&&r.texture.dispose();const B=o.morphAttributes.position!==void 0,h=o.morphAttributes.normal!==void 0,c=o.morphAttributes.color!==void 0,d=o.morphAttributes.position||[],E=o.morphAttributes.normal||[],u=o.morphAttributes.color||[];let _=0;B===!0&&(_=1),h===!0&&(_=2),c===!0&&(_=3);let x=o.attributes.position.count*_,D=1;x>A.maxTextureSize&&(D=Math.ceil(x/A.maxTextureSize),x=A.maxTextureSize);const w=new Float32Array(x*D*4*Q),y=new dc(w,x,D,Q);y.type=Ei,y.needsUpdate=!0;const S=_*4;for(let p=0;p<Q;p++){const N=d[p],U=E[p],v=u[p],P=x*D*4*p;for(let W=0;W<N.count;W++){const H=W*S;B===!0&&(g.fromBufferAttribute(N,W),w[P+H+0]=g.x,w[P+H+1]=g.y,w[P+H+2]=g.z,w[P+H+3]=0),h===!0&&(g.fromBufferAttribute(U,W),w[P+H+4]=g.x,w[P+H+5]=g.y,w[P+H+6]=g.z,w[P+H+7]=0),c===!0&&(g.fromBufferAttribute(v,W),w[P+H+8]=g.x,w[P+H+9]=g.y,w[P+H+10]=g.z,w[P+H+11]=v.itemSize===4?g.w:1)}}r={count:Q,texture:y,size:new Be(x,D)},t.set(o,r),o.addEventListener("dispose",l)}if(C.isInstancedMesh===!0&&C.morphTexture!==null)n.getUniforms().setValue(i,"morphTexture",C.morphTexture,e);else{let B=0;for(let c=0;c<a.length;c++)B+=a[c];const h=o.morphTargetsRelative?1:1-B;n.getUniforms().setValue(i,"morphTargetBaseInfluence",h),n.getUniforms().setValue(i,"morphTargetInfluences",a)}n.getUniforms().setValue(i,"morphTargetsTexture",r.texture,e),n.getUniforms().setValue(i,"morphTargetsTextureSize",r.size)}return{update:I}}function vp(i,A,e,t){let g=new WeakMap;function I(n){const a=t.render.frame,s=n.geometry,Q=A.get(n,s);if(g.get(Q)!==a&&(A.update(Q),g.set(Q,a)),n.isInstancedMesh&&(n.hasEventListener("dispose",o)===!1&&n.addEventListener("dispose",o),g.get(n)!==a&&(e.update(n.instanceMatrix,i.ARRAY_BUFFER),n.instanceColor!==null&&e.update(n.instanceColor,i.ARRAY_BUFFER),g.set(n,a))),n.isSkinnedMesh){const r=n.skeleton;g.get(r)!==a&&(r.update(),g.set(r,a))}return Q}function C(){g=new WeakMap}function o(n){const a=n.target;a.removeEventListener("dispose",o),e.remove(a.instanceMatrix),a.instanceColor!==null&&e.remove(a.instanceColor)}return{update:I,dispose:C}}const Kp={[OE]:"LINEAR_TONE_MAPPING",[VE]:"REINHARD_TONE_MAPPING",[jE]:"CINEON_TONE_MAPPING",[WE]:"ACES_FILMIC_TONE_MAPPING",[ZE]:"AGX_TONE_MAPPING",[zE]:"NEUTRAL_TONE_MAPPING",[XE]:"CUSTOM_TONE_MAPPING"};function Jp(i,A,e,t,g){const I=new di(A,e,{type:i,depthBuffer:t,stencilBuffer:g}),C=new di(A,e,{type:vi,depthBuffer:!1,stencilBuffer:!1}),o=new $t;o.setAttribute("position",new ot([-1,3,0,-1,-1,0,3,-1,0],3)),o.setAttribute("uv",new ot([0,2,0,0,2,0],2));const n=new E2({uniforms:{tDiffuse:{value:null}},vertexShader:`
4017
+ `}function Rp(i){let A=new WeakMap,e=null;function t(o){if(o&&o.isTexture){const n=o.mapping,a=n===ys||n===bs,s=n===Lg||n===lI;if(a||s){let Q=A.get(o);const r=Q!==void 0?Q.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==r)return e===null&&(e=new Oc(i)),Q=a?e.fromEquirectangular(o,Q):e.fromCubemap(o,Q),Q.texture.pmremVersion=o.pmremVersion,A.set(o,Q),Q.texture;if(Q!==void 0)return Q.texture;{const B=o.image;return a&&B&&B.height>0||s&&B&&g(B)?(e===null&&(e=new Oc(i)),Q=a?e.fromEquirectangular(o):e.fromCubemap(o),Q.texture.pmremVersion=o.pmremVersion,A.set(o,Q),o.addEventListener("dispose",I),Q.texture):null}}}return o}function g(o){let n=0;const a=6;for(let s=0;s<a;s++)o[s]!==void 0&&n++;return n===a}function I(o){const n=o.target;n.removeEventListener("dispose",I);const a=A.get(n);a!==void 0&&(A.delete(n),a.dispose())}function C(){A=new WeakMap,e!==null&&(e.dispose(),e=null)}return{get:t,dispose:C}}function Gp(i){const A={};function e(t){if(A[t]!==void 0)return A[t];const g=i.getExtension(t);return A[t]=g,g}return{has:function(t){return e(t)!==null},init:function(){e("EXT_color_buffer_float"),e("WEBGL_clip_cull_distance"),e("OES_texture_float_linear"),e("EXT_color_buffer_half_float"),e("WEBGL_multisampled_render_to_texture"),e("WEBGL_render_shared_exponent")},get:function(t){const g=e(t);return g===null&&xC("WebGLRenderer: "+t+" extension not supported."),g}}}function Mp(i,A,e,t){const g={},I=new WeakMap;function C(Q){const r=Q.target;r.index!==null&&A.remove(r.index);for(const h in r.attributes)A.remove(r.attributes[h]);r.removeEventListener("dispose",C),delete g[r.id];const B=I.get(r);B&&(A.remove(B),I.delete(r)),t.releaseStatesOfGeometry(r),r.isInstancedBufferGeometry===!0&&delete r._maxInstanceCount,e.memory.geometries--}function o(Q,r){return g[r.id]===!0||(r.addEventListener("dispose",C),g[r.id]=!0,e.memory.geometries++),r}function n(Q){const r=Q.attributes;for(const B in r)A.update(r[B],i.ARRAY_BUFFER)}function a(Q){const r=[],B=Q.index,h=Q.attributes.position;let c=0;if(B!==null){const u=B.array;c=B.version;for(let _=0,x=u.length;_<x;_+=3){const D=u[_+0],w=u[_+1],y=u[_+2];r.push(D,w,w,y,y,D)}}else if(h!==void 0){const u=h.array;c=h.version;for(let _=0,x=u.length/3-1;_<x;_+=3){const D=_+0,w=_+1,y=_+2;r.push(D,w,w,y,y,D)}}else return;const d=new(sc(r)?Nc:bc)(r,1);d.version=c;const E=I.get(Q);E&&A.remove(E),I.set(Q,d)}function s(Q){const r=I.get(Q);if(r){const B=Q.index;B!==null&&r.version<B.version&&a(Q)}else a(Q);return I.get(Q)}return{get:o,update:n,getWireframeAttribute:s}}function Fp(i,A,e){let t;function g(r){t=r}let I,C;function o(r){I=r.type,C=r.bytesPerElement}function n(r,B){i.drawElements(t,B,I,r*C),e.update(B,t,1)}function a(r,B,h){h!==0&&(i.drawElementsInstanced(t,B,I,r*C,h),e.update(B,t,h))}function s(r,B,h){if(h===0)return;A.get("WEBGL_multi_draw").multiDrawElementsWEBGL(t,B,0,I,r,0,h);let d=0;for(let E=0;E<h;E++)d+=B[E];e.update(d,t,1)}function Q(r,B,h,c){if(h===0)return;const d=A.get("WEBGL_multi_draw");if(d===null)for(let E=0;E<r.length;E++)a(r[E]/C,B[E],c[E]);else{d.multiDrawElementsInstancedWEBGL(t,B,0,I,r,0,c,0,h);let E=0;for(let u=0;u<h;u++)E+=B[u]*c[u];e.update(E,t,1)}}this.setMode=g,this.setIndex=o,this.render=n,this.renderInstances=a,this.renderMultiDraw=s,this.renderMultiDrawInstances=Q}function Up(i){const A={geometries:0,textures:0},e={frame:0,calls:0,triangles:0,points:0,lines:0};function t(I,C,o){switch(e.calls++,C){case i.TRIANGLES:e.triangles+=o*(I/3);break;case i.LINES:e.lines+=o*(I/2);break;case i.LINE_STRIP:e.lines+=o*(I-1);break;case i.LINE_LOOP:e.lines+=o*I;break;case i.POINTS:e.points+=o*I;break;default:ae("WebGLInfo: Unknown draw mode:",C);break}}function g(){e.calls=0,e.triangles=0,e.points=0,e.lines=0}return{memory:A,render:e,programs:null,autoReset:!0,reset:g,update:t}}function Lp(i,A,e){const t=new WeakMap,g=new ve;function I(C,o,n){const a=C.morphTargetInfluences,s=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,Q=s!==void 0?s.length:0;let r=t.get(o);if(r===void 0||r.count!==Q){let l=function(){y.dispose(),t.delete(o),o.removeEventListener("dispose",l)};r!==void 0&&r.texture.dispose();const B=o.morphAttributes.position!==void 0,h=o.morphAttributes.normal!==void 0,c=o.morphAttributes.color!==void 0,d=o.morphAttributes.position||[],E=o.morphAttributes.normal||[],u=o.morphAttributes.color||[];let _=0;B===!0&&(_=1),h===!0&&(_=2),c===!0&&(_=3);let x=o.attributes.position.count*_,D=1;x>A.maxTextureSize&&(D=Math.ceil(x/A.maxTextureSize),x=A.maxTextureSize);const w=new Float32Array(x*D*4*Q),y=new dc(w,x,D,Q);y.type=Ei,y.needsUpdate=!0;const S=_*4;for(let p=0;p<Q;p++){const N=d[p],U=E[p],v=u[p],P=x*D*4*p;for(let W=0;W<N.count;W++){const H=W*S;B===!0&&(g.fromBufferAttribute(N,W),w[P+H+0]=g.x,w[P+H+1]=g.y,w[P+H+2]=g.z,w[P+H+3]=0),h===!0&&(g.fromBufferAttribute(U,W),w[P+H+4]=g.x,w[P+H+5]=g.y,w[P+H+6]=g.z,w[P+H+7]=0),c===!0&&(g.fromBufferAttribute(v,W),w[P+H+8]=g.x,w[P+H+9]=g.y,w[P+H+10]=g.z,w[P+H+11]=v.itemSize===4?g.w:1)}}r={count:Q,texture:y,size:new Be(x,D)},t.set(o,r),o.addEventListener("dispose",l)}if(C.isInstancedMesh===!0&&C.morphTexture!==null)n.getUniforms().setValue(i,"morphTexture",C.morphTexture,e);else{let B=0;for(let c=0;c<a.length;c++)B+=a[c];const h=o.morphTargetsRelative?1:1-B;n.getUniforms().setValue(i,"morphTargetBaseInfluence",h),n.getUniforms().setValue(i,"morphTargetInfluences",a)}n.getUniforms().setValue(i,"morphTargetsTexture",r.texture,e),n.getUniforms().setValue(i,"morphTargetsTextureSize",r.size)}return{update:I}}function vp(i,A,e,t){let g=new WeakMap;function I(n){const a=t.render.frame,s=n.geometry,Q=A.get(n,s);if(g.get(Q)!==a&&(A.update(Q),g.set(Q,a)),n.isInstancedMesh&&(n.hasEventListener("dispose",o)===!1&&n.addEventListener("dispose",o),g.get(n)!==a&&(e.update(n.instanceMatrix,i.ARRAY_BUFFER),n.instanceColor!==null&&e.update(n.instanceColor,i.ARRAY_BUFFER),g.set(n,a))),n.isSkinnedMesh){const r=n.skeleton;g.get(r)!==a&&(r.update(),g.set(r,a))}return Q}function C(){g=new WeakMap}function o(n){const a=n.target;a.removeEventListener("dispose",o),e.remove(a.instanceMatrix),a.instanceColor!==null&&e.remove(a.instanceColor)}return{update:I,dispose:C}}const Kp={[OE]:"LINEAR_TONE_MAPPING",[VE]:"REINHARD_TONE_MAPPING",[jE]:"CINEON_TONE_MAPPING",[WE]:"ACES_FILMIC_TONE_MAPPING",[ZE]:"AGX_TONE_MAPPING",[zE]:"NEUTRAL_TONE_MAPPING",[XE]:"CUSTOM_TONE_MAPPING"};function Jp(i,A,e,t,g){const I=new di(A,e,{type:i,depthBuffer:t,stencilBuffer:g}),C=new di(A,e,{type:vi,depthBuffer:!1,stencilBuffer:!1}),o=new $t;o.setAttribute("position",new nt([-1,3,0,-1,-1,0,3,-1,0],3)),o.setAttribute("uv",new nt([0,2,0,0,2,0],2));const n=new E2({uniforms:{tDiffuse:{value:null}},vertexShader:`
4018
4018
  precision highp float;
4019
4019
 
4020
4020
  uniform mat4 modelViewMatrix;
@@ -4060,7 +4060,7 @@ void main() {
4060
4060
  #ifdef SRGB_TRANSFER
4061
4061
  gl_FragColor = sRGBTransferOETF( gl_FragColor );
4062
4062
  #endif
4063
- }`,depthTest:!1,depthWrite:!1}),a=new Ai(o,n),s=new Yc(-1,1,1,-1,0,1);let Q=null,r=null,B=!1,h,c=null,d=[],E=!1;this.setSize=function(u,_){I.setSize(u,_),C.setSize(u,_);for(let x=0;x<d.length;x++){const D=d[x];D.setSize&&D.setSize(u,_)}},this.setEffects=function(u){d=u,E=d.length>0&&d[0].isRenderPass===!0;const _=I.width,x=I.height;for(let D=0;D<d.length;D++){const w=d[D];w.setSize&&w.setSize(_,x)}},this.begin=function(u,_){if(B||u.toneMapping===ri&&d.length===0)return!1;if(c=_,_!==null){const x=_.width,D=_.height;(I.width!==x||I.height!==D)&&this.setSize(x,D)}return E===!1&&u.setRenderTarget(I),h=u.toneMapping,u.toneMapping=ri,!0},this.hasRenderPass=function(){return E},this.end=function(u,_){u.toneMapping=h,B=!0;let x=I,D=C;for(let w=0;w<d.length;w++){const y=d[w];if(y.enabled!==!1&&(y.render(u,D,x,_),y.needsSwap!==!1)){const S=x;x=D,D=S}}if(Q!==u.outputColorSpace||r!==u.toneMapping){Q=u.outputColorSpace,r=u.toneMapping,n.defines={},oe.getTransfer(Q)===ce&&(n.defines.SRGB_TRANSFER="");const w=Kp[r];w&&(n.defines[w]=""),n.needsUpdate=!0}n.uniforms.tDiffuse.value=x.texture,u.setRenderTarget(c),u.render(a,s),c=null,B=!1},this.isCompositing=function(){return B},this.dispose=function(){I.dispose(),C.dispose(),o.dispose(),n.dispose()}}const Xc=new Ct,zQ=new NC(1,1),Zc=new dc,zc=new qD,$c=new Lc,Ad=[],ed=[],td=new Float32Array(16),id=new Float32Array(9),gd=new Float32Array(4);function vI(i,A,e){const t=i[0];if(t<=0||t>0)return i;const g=A*e;let I=Ad[g];if(I===void 0&&(I=new Float32Array(g),Ad[g]=I),A!==0){t.toArray(I,0);for(let C=1,o=0;C!==A;++C)o+=e,i[C].toArray(I,o)}return I}function Oe(i,A){if(i.length!==A.length)return!1;for(let e=0,t=i.length;e<t;e++)if(i[e]!==A[e])return!1;return!0}function Ve(i,A){for(let e=0,t=A.length;e<t;e++)i[e]=A[e]}function hn(i,A){let e=ed[A];e===void 0&&(e=new Int32Array(A),ed[A]=e);for(let t=0;t!==A;++t)e[t]=i.allocateTextureUnit();return e}function Yp(i,A){const e=this.cache;e[0]!==A&&(i.uniform1f(this.addr,A),e[0]=A)}function Tp(i,A){const e=this.cache;if(A.x!==void 0)(e[0]!==A.x||e[1]!==A.y)&&(i.uniform2f(this.addr,A.x,A.y),e[0]=A.x,e[1]=A.y);else{if(Oe(e,A))return;i.uniform2fv(this.addr,A),Ve(e,A)}}function qp(i,A){const e=this.cache;if(A.x!==void 0)(e[0]!==A.x||e[1]!==A.y||e[2]!==A.z)&&(i.uniform3f(this.addr,A.x,A.y,A.z),e[0]=A.x,e[1]=A.y,e[2]=A.z);else if(A.r!==void 0)(e[0]!==A.r||e[1]!==A.g||e[2]!==A.b)&&(i.uniform3f(this.addr,A.r,A.g,A.b),e[0]=A.r,e[1]=A.g,e[2]=A.b);else{if(Oe(e,A))return;i.uniform3fv(this.addr,A),Ve(e,A)}}function Hp(i,A){const e=this.cache;if(A.x!==void 0)(e[0]!==A.x||e[1]!==A.y||e[2]!==A.z||e[3]!==A.w)&&(i.uniform4f(this.addr,A.x,A.y,A.z,A.w),e[0]=A.x,e[1]=A.y,e[2]=A.z,e[3]=A.w);else{if(Oe(e,A))return;i.uniform4fv(this.addr,A),Ve(e,A)}}function Pp(i,A){const e=this.cache,t=A.elements;if(t===void 0){if(Oe(e,A))return;i.uniformMatrix2fv(this.addr,!1,A),Ve(e,A)}else{if(Oe(e,t))return;gd.set(t),i.uniformMatrix2fv(this.addr,!1,gd),Ve(e,t)}}function Op(i,A){const e=this.cache,t=A.elements;if(t===void 0){if(Oe(e,A))return;i.uniformMatrix3fv(this.addr,!1,A),Ve(e,A)}else{if(Oe(e,t))return;id.set(t),i.uniformMatrix3fv(this.addr,!1,id),Ve(e,t)}}function Vp(i,A){const e=this.cache,t=A.elements;if(t===void 0){if(Oe(e,A))return;i.uniformMatrix4fv(this.addr,!1,A),Ve(e,A)}else{if(Oe(e,t))return;td.set(t),i.uniformMatrix4fv(this.addr,!1,td),Ve(e,t)}}function jp(i,A){const e=this.cache;e[0]!==A&&(i.uniform1i(this.addr,A),e[0]=A)}function Wp(i,A){const e=this.cache;if(A.x!==void 0)(e[0]!==A.x||e[1]!==A.y)&&(i.uniform2i(this.addr,A.x,A.y),e[0]=A.x,e[1]=A.y);else{if(Oe(e,A))return;i.uniform2iv(this.addr,A),Ve(e,A)}}function Xp(i,A){const e=this.cache;if(A.x!==void 0)(e[0]!==A.x||e[1]!==A.y||e[2]!==A.z)&&(i.uniform3i(this.addr,A.x,A.y,A.z),e[0]=A.x,e[1]=A.y,e[2]=A.z);else{if(Oe(e,A))return;i.uniform3iv(this.addr,A),Ve(e,A)}}function Zp(i,A){const e=this.cache;if(A.x!==void 0)(e[0]!==A.x||e[1]!==A.y||e[2]!==A.z||e[3]!==A.w)&&(i.uniform4i(this.addr,A.x,A.y,A.z,A.w),e[0]=A.x,e[1]=A.y,e[2]=A.z,e[3]=A.w);else{if(Oe(e,A))return;i.uniform4iv(this.addr,A),Ve(e,A)}}function zp(i,A){const e=this.cache;e[0]!==A&&(i.uniform1ui(this.addr,A),e[0]=A)}function $p(i,A){const e=this.cache;if(A.x!==void 0)(e[0]!==A.x||e[1]!==A.y)&&(i.uniform2ui(this.addr,A.x,A.y),e[0]=A.x,e[1]=A.y);else{if(Oe(e,A))return;i.uniform2uiv(this.addr,A),Ve(e,A)}}function Aw(i,A){const e=this.cache;if(A.x!==void 0)(e[0]!==A.x||e[1]!==A.y||e[2]!==A.z)&&(i.uniform3ui(this.addr,A.x,A.y,A.z),e[0]=A.x,e[1]=A.y,e[2]=A.z);else{if(Oe(e,A))return;i.uniform3uiv(this.addr,A),Ve(e,A)}}function ew(i,A){const e=this.cache;if(A.x!==void 0)(e[0]!==A.x||e[1]!==A.y||e[2]!==A.z||e[3]!==A.w)&&(i.uniform4ui(this.addr,A.x,A.y,A.z,A.w),e[0]=A.x,e[1]=A.y,e[2]=A.z,e[3]=A.w);else{if(Oe(e,A))return;i.uniform4uiv(this.addr,A),Ve(e,A)}}function tw(i,A,e){const t=this.cache,g=e.allocateTextureUnit();t[0]!==g&&(i.uniform1i(this.addr,g),t[0]=g);let I;this.type===i.SAMPLER_2D_SHADOW?(zQ.compareFunction=e.isReversedDepthBuffer()?hQ:dQ,I=zQ):I=Xc,e.setTexture2D(A||I,g)}function iw(i,A,e){const t=this.cache,g=e.allocateTextureUnit();t[0]!==g&&(i.uniform1i(this.addr,g),t[0]=g),e.setTexture3D(A||zc,g)}function gw(i,A,e){const t=this.cache,g=e.allocateTextureUnit();t[0]!==g&&(i.uniform1i(this.addr,g),t[0]=g),e.setTextureCube(A||$c,g)}function Iw(i,A,e){const t=this.cache,g=e.allocateTextureUnit();t[0]!==g&&(i.uniform1i(this.addr,g),t[0]=g),e.setTexture2DArray(A||Zc,g)}function Cw(i){switch(i){case 5126:return Yp;case 35664:return Tp;case 35665:return qp;case 35666:return Hp;case 35674:return Pp;case 35675:return Op;case 35676:return Vp;case 5124:case 35670:return jp;case 35667:case 35671:return Wp;case 35668:case 35672:return Xp;case 35669:case 35673:return Zp;case 5125:return zp;case 36294:return $p;case 36295:return Aw;case 36296:return ew;case 35678:case 36198:case 36298:case 36306:case 35682:return tw;case 35679:case 36299:case 36307:return iw;case 35680:case 36300:case 36308:case 36293:return gw;case 36289:case 36303:case 36311:case 36292:return Iw}}function ow(i,A){i.uniform1fv(this.addr,A)}function nw(i,A){const e=vI(A,this.size,2);i.uniform2fv(this.addr,e)}function aw(i,A){const e=vI(A,this.size,3);i.uniform3fv(this.addr,e)}function sw(i,A){const e=vI(A,this.size,4);i.uniform4fv(this.addr,e)}function Qw(i,A){const e=vI(A,this.size,4);i.uniformMatrix2fv(this.addr,!1,e)}function rw(i,A){const e=vI(A,this.size,9);i.uniformMatrix3fv(this.addr,!1,e)}function Bw(i,A){const e=vI(A,this.size,16);i.uniformMatrix4fv(this.addr,!1,e)}function Ew(i,A){i.uniform1iv(this.addr,A)}function cw(i,A){i.uniform2iv(this.addr,A)}function dw(i,A){i.uniform3iv(this.addr,A)}function hw(i,A){i.uniform4iv(this.addr,A)}function lw(i,A){i.uniform1uiv(this.addr,A)}function xw(i,A){i.uniform2uiv(this.addr,A)}function uw(i,A){i.uniform3uiv(this.addr,A)}function fw(i,A){i.uniform4uiv(this.addr,A)}function Dw(i,A,e){const t=this.cache,g=A.length,I=hn(e,g);Oe(t,I)||(i.uniform1iv(this.addr,I),Ve(t,I));let C;this.type===i.SAMPLER_2D_SHADOW?C=zQ:C=Xc;for(let o=0;o!==g;++o)e.setTexture2D(A[o]||C,I[o])}function _w(i,A,e){const t=this.cache,g=A.length,I=hn(e,g);Oe(t,I)||(i.uniform1iv(this.addr,I),Ve(t,I));for(let C=0;C!==g;++C)e.setTexture3D(A[C]||zc,I[C])}function pw(i,A,e){const t=this.cache,g=A.length,I=hn(e,g);Oe(t,I)||(i.uniform1iv(this.addr,I),Ve(t,I));for(let C=0;C!==g;++C)e.setTextureCube(A[C]||$c,I[C])}function ww(i,A,e){const t=this.cache,g=A.length,I=hn(e,g);Oe(t,I)||(i.uniform1iv(this.addr,I),Ve(t,I));for(let C=0;C!==g;++C)e.setTexture2DArray(A[C]||Zc,I[C])}function mw(i){switch(i){case 5126:return ow;case 35664:return nw;case 35665:return aw;case 35666:return sw;case 35674:return Qw;case 35675:return rw;case 35676:return Bw;case 5124:case 35670:return Ew;case 35667:case 35671:return cw;case 35668:case 35672:return dw;case 35669:case 35673:return hw;case 5125:return lw;case 36294:return xw;case 36295:return uw;case 36296:return fw;case 35678:case 36198:case 36298:case 36306:case 35682:return Dw;case 35679:case 36299:case 36307:return _w;case 35680:case 36300:case 36308:case 36293:return pw;case 36289:case 36303:case 36311:case 36292:return ww}}class yw{constructor(A,e,t){this.id=A,this.addr=t,this.cache=[],this.type=e.type,this.setValue=Cw(e.type)}}class bw{constructor(A,e,t){this.id=A,this.addr=t,this.cache=[],this.type=e.type,this.size=e.size,this.setValue=mw(e.type)}}class Nw{constructor(A){this.id=A,this.seq=[],this.map={}}setValue(A,e,t){const g=this.seq;for(let I=0,C=g.length;I!==C;++I){const o=g[I];o.setValue(A,e[o.id],t)}}}const $Q=/(\w+)(\])?(\[|\.)?/g;function Id(i,A){i.seq.push(A),i.map[A.id]=A}function kw(i,A,e){const t=i.name,g=t.length;for($Q.lastIndex=0;;){const I=$Q.exec(t),C=$Q.lastIndex;let o=I[1];const n=I[2]==="]",a=I[3];if(n&&(o=o|0),a===void 0||a==="["&&C+2===g){Id(e,a===void 0?new yw(o,i,A):new bw(o,i,A));break}else{let Q=e.map[o];Q===void 0&&(Q=new Nw(o),Id(e,Q)),e=Q}}}class ln{constructor(A,e){this.seq=[],this.map={};const t=A.getProgramParameter(e,A.ACTIVE_UNIFORMS);for(let C=0;C<t;++C){const o=A.getActiveUniform(e,C),n=A.getUniformLocation(e,o.name);kw(o,n,this)}const g=[],I=[];for(const C of this.seq)C.type===A.SAMPLER_2D_SHADOW||C.type===A.SAMPLER_CUBE_SHADOW||C.type===A.SAMPLER_2D_ARRAY_SHADOW?g.push(C):I.push(C);g.length>0&&(this.seq=g.concat(I))}setValue(A,e,t,g){const I=this.map[e];I!==void 0&&I.setValue(A,t,g)}setOptional(A,e,t){const g=e[t];g!==void 0&&this.setValue(A,t,g)}static upload(A,e,t,g){for(let I=0,C=e.length;I!==C;++I){const o=e[I],n=t[o.id];n.needsUpdate!==!1&&o.setValue(A,n.value,g)}}static seqWithValue(A,e){const t=[];for(let g=0,I=A.length;g!==I;++g){const C=A[g];C.id in e&&t.push(C)}return t}}function Cd(i,A,e){const t=i.createShader(A);return i.shaderSource(t,e),i.compileShader(t),t}const Sw=37297;let Rw=0;function Gw(i,A){const e=i.split(`
4063
+ }`,depthTest:!1,depthWrite:!1}),a=new Ai(o,n),s=new Yc(-1,1,1,-1,0,1);let Q=null,r=null,B=!1,h,c=null,d=[],E=!1;this.setSize=function(u,_){I.setSize(u,_),C.setSize(u,_);for(let x=0;x<d.length;x++){const D=d[x];D.setSize&&D.setSize(u,_)}},this.setEffects=function(u){d=u,E=d.length>0&&d[0].isRenderPass===!0;const _=I.width,x=I.height;for(let D=0;D<d.length;D++){const w=d[D];w.setSize&&w.setSize(_,x)}},this.begin=function(u,_){if(B||u.toneMapping===ri&&d.length===0)return!1;if(c=_,_!==null){const x=_.width,D=_.height;(I.width!==x||I.height!==D)&&this.setSize(x,D)}return E===!1&&u.setRenderTarget(I),h=u.toneMapping,u.toneMapping=ri,!0},this.hasRenderPass=function(){return E},this.end=function(u,_){u.toneMapping=h,B=!0;let x=I,D=C;for(let w=0;w<d.length;w++){const y=d[w];if(y.enabled!==!1&&(y.render(u,D,x,_),y.needsSwap!==!1)){const S=x;x=D,D=S}}if(Q!==u.outputColorSpace||r!==u.toneMapping){Q=u.outputColorSpace,r=u.toneMapping,n.defines={},oe.getTransfer(Q)===ce&&(n.defines.SRGB_TRANSFER="");const w=Kp[r];w&&(n.defines[w]=""),n.needsUpdate=!0}n.uniforms.tDiffuse.value=x.texture,u.setRenderTarget(c),u.render(a,s),c=null,B=!1},this.isCompositing=function(){return B},this.dispose=function(){I.dispose(),C.dispose(),o.dispose(),n.dispose()}}const Xc=new ot,zQ=new NC(1,1),Zc=new dc,zc=new qD,$c=new Lc,Ad=[],ed=[],td=new Float32Array(16),id=new Float32Array(9),gd=new Float32Array(4);function vI(i,A,e){const t=i[0];if(t<=0||t>0)return i;const g=A*e;let I=Ad[g];if(I===void 0&&(I=new Float32Array(g),Ad[g]=I),A!==0){t.toArray(I,0);for(let C=1,o=0;C!==A;++C)o+=e,i[C].toArray(I,o)}return I}function Oe(i,A){if(i.length!==A.length)return!1;for(let e=0,t=i.length;e<t;e++)if(i[e]!==A[e])return!1;return!0}function Ve(i,A){for(let e=0,t=A.length;e<t;e++)i[e]=A[e]}function hn(i,A){let e=ed[A];e===void 0&&(e=new Int32Array(A),ed[A]=e);for(let t=0;t!==A;++t)e[t]=i.allocateTextureUnit();return e}function Yp(i,A){const e=this.cache;e[0]!==A&&(i.uniform1f(this.addr,A),e[0]=A)}function Tp(i,A){const e=this.cache;if(A.x!==void 0)(e[0]!==A.x||e[1]!==A.y)&&(i.uniform2f(this.addr,A.x,A.y),e[0]=A.x,e[1]=A.y);else{if(Oe(e,A))return;i.uniform2fv(this.addr,A),Ve(e,A)}}function qp(i,A){const e=this.cache;if(A.x!==void 0)(e[0]!==A.x||e[1]!==A.y||e[2]!==A.z)&&(i.uniform3f(this.addr,A.x,A.y,A.z),e[0]=A.x,e[1]=A.y,e[2]=A.z);else if(A.r!==void 0)(e[0]!==A.r||e[1]!==A.g||e[2]!==A.b)&&(i.uniform3f(this.addr,A.r,A.g,A.b),e[0]=A.r,e[1]=A.g,e[2]=A.b);else{if(Oe(e,A))return;i.uniform3fv(this.addr,A),Ve(e,A)}}function Hp(i,A){const e=this.cache;if(A.x!==void 0)(e[0]!==A.x||e[1]!==A.y||e[2]!==A.z||e[3]!==A.w)&&(i.uniform4f(this.addr,A.x,A.y,A.z,A.w),e[0]=A.x,e[1]=A.y,e[2]=A.z,e[3]=A.w);else{if(Oe(e,A))return;i.uniform4fv(this.addr,A),Ve(e,A)}}function Pp(i,A){const e=this.cache,t=A.elements;if(t===void 0){if(Oe(e,A))return;i.uniformMatrix2fv(this.addr,!1,A),Ve(e,A)}else{if(Oe(e,t))return;gd.set(t),i.uniformMatrix2fv(this.addr,!1,gd),Ve(e,t)}}function Op(i,A){const e=this.cache,t=A.elements;if(t===void 0){if(Oe(e,A))return;i.uniformMatrix3fv(this.addr,!1,A),Ve(e,A)}else{if(Oe(e,t))return;id.set(t),i.uniformMatrix3fv(this.addr,!1,id),Ve(e,t)}}function Vp(i,A){const e=this.cache,t=A.elements;if(t===void 0){if(Oe(e,A))return;i.uniformMatrix4fv(this.addr,!1,A),Ve(e,A)}else{if(Oe(e,t))return;td.set(t),i.uniformMatrix4fv(this.addr,!1,td),Ve(e,t)}}function jp(i,A){const e=this.cache;e[0]!==A&&(i.uniform1i(this.addr,A),e[0]=A)}function Wp(i,A){const e=this.cache;if(A.x!==void 0)(e[0]!==A.x||e[1]!==A.y)&&(i.uniform2i(this.addr,A.x,A.y),e[0]=A.x,e[1]=A.y);else{if(Oe(e,A))return;i.uniform2iv(this.addr,A),Ve(e,A)}}function Xp(i,A){const e=this.cache;if(A.x!==void 0)(e[0]!==A.x||e[1]!==A.y||e[2]!==A.z)&&(i.uniform3i(this.addr,A.x,A.y,A.z),e[0]=A.x,e[1]=A.y,e[2]=A.z);else{if(Oe(e,A))return;i.uniform3iv(this.addr,A),Ve(e,A)}}function Zp(i,A){const e=this.cache;if(A.x!==void 0)(e[0]!==A.x||e[1]!==A.y||e[2]!==A.z||e[3]!==A.w)&&(i.uniform4i(this.addr,A.x,A.y,A.z,A.w),e[0]=A.x,e[1]=A.y,e[2]=A.z,e[3]=A.w);else{if(Oe(e,A))return;i.uniform4iv(this.addr,A),Ve(e,A)}}function zp(i,A){const e=this.cache;e[0]!==A&&(i.uniform1ui(this.addr,A),e[0]=A)}function $p(i,A){const e=this.cache;if(A.x!==void 0)(e[0]!==A.x||e[1]!==A.y)&&(i.uniform2ui(this.addr,A.x,A.y),e[0]=A.x,e[1]=A.y);else{if(Oe(e,A))return;i.uniform2uiv(this.addr,A),Ve(e,A)}}function Aw(i,A){const e=this.cache;if(A.x!==void 0)(e[0]!==A.x||e[1]!==A.y||e[2]!==A.z)&&(i.uniform3ui(this.addr,A.x,A.y,A.z),e[0]=A.x,e[1]=A.y,e[2]=A.z);else{if(Oe(e,A))return;i.uniform3uiv(this.addr,A),Ve(e,A)}}function ew(i,A){const e=this.cache;if(A.x!==void 0)(e[0]!==A.x||e[1]!==A.y||e[2]!==A.z||e[3]!==A.w)&&(i.uniform4ui(this.addr,A.x,A.y,A.z,A.w),e[0]=A.x,e[1]=A.y,e[2]=A.z,e[3]=A.w);else{if(Oe(e,A))return;i.uniform4uiv(this.addr,A),Ve(e,A)}}function tw(i,A,e){const t=this.cache,g=e.allocateTextureUnit();t[0]!==g&&(i.uniform1i(this.addr,g),t[0]=g);let I;this.type===i.SAMPLER_2D_SHADOW?(zQ.compareFunction=e.isReversedDepthBuffer()?hQ:dQ,I=zQ):I=Xc,e.setTexture2D(A||I,g)}function iw(i,A,e){const t=this.cache,g=e.allocateTextureUnit();t[0]!==g&&(i.uniform1i(this.addr,g),t[0]=g),e.setTexture3D(A||zc,g)}function gw(i,A,e){const t=this.cache,g=e.allocateTextureUnit();t[0]!==g&&(i.uniform1i(this.addr,g),t[0]=g),e.setTextureCube(A||$c,g)}function Iw(i,A,e){const t=this.cache,g=e.allocateTextureUnit();t[0]!==g&&(i.uniform1i(this.addr,g),t[0]=g),e.setTexture2DArray(A||Zc,g)}function Cw(i){switch(i){case 5126:return Yp;case 35664:return Tp;case 35665:return qp;case 35666:return Hp;case 35674:return Pp;case 35675:return Op;case 35676:return Vp;case 5124:case 35670:return jp;case 35667:case 35671:return Wp;case 35668:case 35672:return Xp;case 35669:case 35673:return Zp;case 5125:return zp;case 36294:return $p;case 36295:return Aw;case 36296:return ew;case 35678:case 36198:case 36298:case 36306:case 35682:return tw;case 35679:case 36299:case 36307:return iw;case 35680:case 36300:case 36308:case 36293:return gw;case 36289:case 36303:case 36311:case 36292:return Iw}}function ow(i,A){i.uniform1fv(this.addr,A)}function nw(i,A){const e=vI(A,this.size,2);i.uniform2fv(this.addr,e)}function aw(i,A){const e=vI(A,this.size,3);i.uniform3fv(this.addr,e)}function sw(i,A){const e=vI(A,this.size,4);i.uniform4fv(this.addr,e)}function Qw(i,A){const e=vI(A,this.size,4);i.uniformMatrix2fv(this.addr,!1,e)}function rw(i,A){const e=vI(A,this.size,9);i.uniformMatrix3fv(this.addr,!1,e)}function Bw(i,A){const e=vI(A,this.size,16);i.uniformMatrix4fv(this.addr,!1,e)}function Ew(i,A){i.uniform1iv(this.addr,A)}function cw(i,A){i.uniform2iv(this.addr,A)}function dw(i,A){i.uniform3iv(this.addr,A)}function hw(i,A){i.uniform4iv(this.addr,A)}function lw(i,A){i.uniform1uiv(this.addr,A)}function xw(i,A){i.uniform2uiv(this.addr,A)}function uw(i,A){i.uniform3uiv(this.addr,A)}function fw(i,A){i.uniform4uiv(this.addr,A)}function Dw(i,A,e){const t=this.cache,g=A.length,I=hn(e,g);Oe(t,I)||(i.uniform1iv(this.addr,I),Ve(t,I));let C;this.type===i.SAMPLER_2D_SHADOW?C=zQ:C=Xc;for(let o=0;o!==g;++o)e.setTexture2D(A[o]||C,I[o])}function _w(i,A,e){const t=this.cache,g=A.length,I=hn(e,g);Oe(t,I)||(i.uniform1iv(this.addr,I),Ve(t,I));for(let C=0;C!==g;++C)e.setTexture3D(A[C]||zc,I[C])}function pw(i,A,e){const t=this.cache,g=A.length,I=hn(e,g);Oe(t,I)||(i.uniform1iv(this.addr,I),Ve(t,I));for(let C=0;C!==g;++C)e.setTextureCube(A[C]||$c,I[C])}function ww(i,A,e){const t=this.cache,g=A.length,I=hn(e,g);Oe(t,I)||(i.uniform1iv(this.addr,I),Ve(t,I));for(let C=0;C!==g;++C)e.setTexture2DArray(A[C]||Zc,I[C])}function mw(i){switch(i){case 5126:return ow;case 35664:return nw;case 35665:return aw;case 35666:return sw;case 35674:return Qw;case 35675:return rw;case 35676:return Bw;case 5124:case 35670:return Ew;case 35667:case 35671:return cw;case 35668:case 35672:return dw;case 35669:case 35673:return hw;case 5125:return lw;case 36294:return xw;case 36295:return uw;case 36296:return fw;case 35678:case 36198:case 36298:case 36306:case 35682:return Dw;case 35679:case 36299:case 36307:return _w;case 35680:case 36300:case 36308:case 36293:return pw;case 36289:case 36303:case 36311:case 36292:return ww}}class yw{constructor(A,e,t){this.id=A,this.addr=t,this.cache=[],this.type=e.type,this.setValue=Cw(e.type)}}class bw{constructor(A,e,t){this.id=A,this.addr=t,this.cache=[],this.type=e.type,this.size=e.size,this.setValue=mw(e.type)}}class Nw{constructor(A){this.id=A,this.seq=[],this.map={}}setValue(A,e,t){const g=this.seq;for(let I=0,C=g.length;I!==C;++I){const o=g[I];o.setValue(A,e[o.id],t)}}}const $Q=/(\w+)(\])?(\[|\.)?/g;function Id(i,A){i.seq.push(A),i.map[A.id]=A}function kw(i,A,e){const t=i.name,g=t.length;for($Q.lastIndex=0;;){const I=$Q.exec(t),C=$Q.lastIndex;let o=I[1];const n=I[2]==="]",a=I[3];if(n&&(o=o|0),a===void 0||a==="["&&C+2===g){Id(e,a===void 0?new yw(o,i,A):new bw(o,i,A));break}else{let Q=e.map[o];Q===void 0&&(Q=new Nw(o),Id(e,Q)),e=Q}}}class ln{constructor(A,e){this.seq=[],this.map={};const t=A.getProgramParameter(e,A.ACTIVE_UNIFORMS);for(let C=0;C<t;++C){const o=A.getActiveUniform(e,C),n=A.getUniformLocation(e,o.name);kw(o,n,this)}const g=[],I=[];for(const C of this.seq)C.type===A.SAMPLER_2D_SHADOW||C.type===A.SAMPLER_CUBE_SHADOW||C.type===A.SAMPLER_2D_ARRAY_SHADOW?g.push(C):I.push(C);g.length>0&&(this.seq=g.concat(I))}setValue(A,e,t,g){const I=this.map[e];I!==void 0&&I.setValue(A,t,g)}setOptional(A,e,t){const g=e[t];g!==void 0&&this.setValue(A,t,g)}static upload(A,e,t,g){for(let I=0,C=e.length;I!==C;++I){const o=e[I],n=t[o.id];n.needsUpdate!==!1&&o.setValue(A,n.value,g)}}static seqWithValue(A,e){const t=[];for(let g=0,I=A.length;g!==I;++g){const C=A[g];C.id in e&&t.push(C)}return t}}function Cd(i,A,e){const t=i.createShader(A);return i.shaderSource(t,e),i.compileShader(t),t}const Sw=37297;let Rw=0;function Gw(i,A){const e=i.split(`
4064
4064
  `),t=[],g=Math.max(A-6,0),I=Math.min(A+6,e.length);for(let C=g;C<I;C++){const o=C+1;t.push(`${o===A?">":" "} ${o}: ${e[C]}`)}return t.join(`
4065
4065
  `)}const od=new qA;function Mw(i){oe._getMatrix(od,oe.workingColorSpace,i);const A=`mat3( ${od.elements.map(e=>e.toFixed(4))} )`;switch(oe.getTransfer(i)){case Po:return[A,"LinearTransferOETF"];case ce:return[A,"sRGBTransferOETF"];default:return KA("WebGLProgram: Unsupported color space: ",i),[A,"LinearTransferOETF"]}}function nd(i,A,e){const t=i.getShaderParameter(A,i.COMPILE_STATUS),I=(i.getShaderInfoLog(A)||"").trim();if(t&&I==="")return"";const C=/ERROR: 0:(\d+)/.exec(I);if(C){const o=parseInt(C[1]);return e.toUpperCase()+`
4066
4066
 
@@ -4070,7 +4070,7 @@ void main() {
4070
4070
  `)}const Uw={[OE]:"Linear",[VE]:"Reinhard",[jE]:"Cineon",[WE]:"ACESFilmic",[ZE]:"AgX",[zE]:"Neutral",[XE]:"Custom"};function Lw(i,A){const e=Uw[A];return e===void 0?(KA("WebGLProgram: Unsupported toneMapping:",A),"vec3 "+i+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+i+"( vec3 color ) { return "+e+"ToneMapping( color ); }"}const xn=new J;function vw(){oe.getLuminanceCoefficients(xn);const i=xn.x.toFixed(4),A=xn.y.toFixed(4),e=xn.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${A}, ${e} );`," return dot( weights, rgb );","}"].join(`
4071
4071
  `)}function Kw(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(SC).join(`
4072
4072
  `)}function Jw(i){const A=[];for(const e in i){const t=i[e];t!==!1&&A.push("#define "+e+" "+t)}return A.join(`
4073
- `)}function Yw(i,A){const e={},t=i.getProgramParameter(A,i.ACTIVE_ATTRIBUTES);for(let g=0;g<t;g++){const I=i.getActiveAttrib(A,g),C=I.name;let o=1;I.type===i.FLOAT_MAT2&&(o=2),I.type===i.FLOAT_MAT3&&(o=3),I.type===i.FLOAT_MAT4&&(o=4),e[C]={type:I.type,location:i.getAttribLocation(A,C),locationSize:o}}return e}function SC(i){return i!==""}function ad(i,A){const e=A.numSpotLightShadows+A.numSpotLightMaps-A.numSpotLightShadowsWithMaps;return i.replace(/NUM_DIR_LIGHTS/g,A.numDirLights).replace(/NUM_SPOT_LIGHTS/g,A.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,A.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,e).replace(/NUM_RECT_AREA_LIGHTS/g,A.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,A.numPointLights).replace(/NUM_HEMI_LIGHTS/g,A.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,A.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,A.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,A.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,A.numPointLightShadows)}function sd(i,A){return i.replace(/NUM_CLIPPING_PLANES/g,A.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,A.numClippingPlanes-A.numClipIntersection)}const Tw=/^[ \t]*#include +<([\w\d./]+)>/gm;function Ar(i){return i.replace(Tw,Hw)}const qw=new Map;function Hw(i,A){let e=PA[A];if(e===void 0){const t=qw.get(A);if(t!==void 0)e=PA[t],KA('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',A,t);else throw new Error("Can not resolve #include <"+A+">")}return Ar(e)}const Pw=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Qd(i){return i.replace(Pw,Ow)}function Ow(i,A,e,t){let g="";for(let I=parseInt(A);I<parseInt(e);I++)g+=t.replace(/\[\s*i\s*\]/g,"[ "+I+" ]").replace(/UNROLLED_LOOP_INDEX/g,I);return g}function rd(i){let A=`precision ${i.precision} float;
4073
+ `)}function Yw(i,A){const e={},t=i.getProgramParameter(A,i.ACTIVE_ATTRIBUTES);for(let g=0;g<t;g++){const I=i.getActiveAttrib(A,g),C=I.name;let o=1;I.type===i.FLOAT_MAT2&&(o=2),I.type===i.FLOAT_MAT3&&(o=3),I.type===i.FLOAT_MAT4&&(o=4),e[C]={type:I.type,location:i.getAttribLocation(A,C),locationSize:o}}return e}function SC(i){return i!==""}function ad(i,A){const e=A.numSpotLightShadows+A.numSpotLightMaps-A.numSpotLightShadowsWithMaps;return i.replace(/NUM_DIR_LIGHTS/g,A.numDirLights).replace(/NUM_SPOT_LIGHTS/g,A.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,A.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,e).replace(/NUM_RECT_AREA_LIGHTS/g,A.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,A.numPointLights).replace(/NUM_HEMI_LIGHTS/g,A.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,A.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,A.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,A.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,A.numPointLightShadows)}function sd(i,A){return i.replace(/NUM_CLIPPING_PLANES/g,A.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,A.numClippingPlanes-A.numClipIntersection)}const Tw=/^[ \t]*#include +<([\w\d./]+)>/gm;function Ar(i){return i.replace(Tw,Hw)}const qw=new Map;function Hw(i,A){let e=OA[A];if(e===void 0){const t=qw.get(A);if(t!==void 0)e=OA[t],KA('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',A,t);else throw new Error("Can not resolve #include <"+A+">")}return Ar(e)}const Pw=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Qd(i){return i.replace(Pw,Ow)}function Ow(i,A,e,t){let g="";for(let I=parseInt(A);I<parseInt(e);I++)g+=t.replace(/\[\s*i\s*\]/g,"[ "+I+" ]").replace(/UNROLLED_LOOP_INDEX/g,I);return g}function rd(i){let A=`precision ${i.precision} float;
4074
4074
  precision ${i.precision} int;
4075
4075
  precision ${i.precision} sampler2D;
4076
4076
  precision ${i.precision} samplerCube;
@@ -4097,7 +4097,7 @@ void main() {
4097
4097
  `),E.length>0&&(E+=`
4098
4098
  `)):(d=[rd(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,h,e.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",e.batching?"#define USE_BATCHING":"",e.batchingColor?"#define USE_BATCHING_COLOR":"",e.instancing?"#define USE_INSTANCING":"",e.instancingColor?"#define USE_INSTANCING_COLOR":"",e.instancingMorph?"#define USE_INSTANCING_MORPH":"",e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+s:"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.displacementMap?"#define USE_DISPLACEMENTMAP":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.mapUv?"#define MAP_UV "+e.mapUv:"",e.alphaMapUv?"#define ALPHAMAP_UV "+e.alphaMapUv:"",e.lightMapUv?"#define LIGHTMAP_UV "+e.lightMapUv:"",e.aoMapUv?"#define AOMAP_UV "+e.aoMapUv:"",e.emissiveMapUv?"#define EMISSIVEMAP_UV "+e.emissiveMapUv:"",e.bumpMapUv?"#define BUMPMAP_UV "+e.bumpMapUv:"",e.normalMapUv?"#define NORMALMAP_UV "+e.normalMapUv:"",e.displacementMapUv?"#define DISPLACEMENTMAP_UV "+e.displacementMapUv:"",e.metalnessMapUv?"#define METALNESSMAP_UV "+e.metalnessMapUv:"",e.roughnessMapUv?"#define ROUGHNESSMAP_UV "+e.roughnessMapUv:"",e.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+e.anisotropyMapUv:"",e.clearcoatMapUv?"#define CLEARCOATMAP_UV "+e.clearcoatMapUv:"",e.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+e.clearcoatNormalMapUv:"",e.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+e.clearcoatRoughnessMapUv:"",e.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+e.iridescenceMapUv:"",e.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+e.iridescenceThicknessMapUv:"",e.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+e.sheenColorMapUv:"",e.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+e.sheenRoughnessMapUv:"",e.specularMapUv?"#define SPECULARMAP_UV "+e.specularMapUv:"",e.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+e.specularColorMapUv:"",e.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+e.specularIntensityMapUv:"",e.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+e.transmissionMapUv:"",e.thicknessMapUv?"#define THICKNESSMAP_UV "+e.thicknessMapUv:"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.flatShading?"#define FLAT_SHADED":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.morphNormals&&e.flatShading===!1?"#define USE_MORPHNORMALS":"",e.morphColors?"#define USE_MORPHCOLORS":"",e.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+e.morphTextureStride:"",e.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+e.morphTargetsCount:"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+n:"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",e.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
4099
4099
  `].filter(SC).join(`
4100
- `),E=[rd(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,h,e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",e.map?"#define USE_MAP":"",e.matcap?"#define USE_MATCAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+a:"",e.envMap?"#define "+s:"",e.envMap?"#define "+Q:"",r?"#define CUBEUV_TEXEL_WIDTH "+r.texelWidth:"",r?"#define CUBEUV_TEXEL_HEIGHT "+r.texelHeight:"",r?"#define CUBEUV_MAX_MIP "+r.maxMip+".0":"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoat?"#define USE_CLEARCOAT":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.dispersion?"#define USE_DISPERSION":"",e.iridescence?"#define USE_IRIDESCENCE":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaTest?"#define USE_ALPHATEST":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.sheen?"#define USE_SHEEN":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors||e.instancingColor||e.batchingColor?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.gradientMap?"#define USE_GRADIENTMAP":"",e.flatShading?"#define FLAT_SHADED":"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+n:"",e.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",e.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",e.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",e.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",e.toneMapping!==ri?"#define TONE_MAPPING":"",e.toneMapping!==ri?PA.tonemapping_pars_fragment:"",e.toneMapping!==ri?Lw("toneMapping",e.toneMapping):"",e.dithering?"#define DITHERING":"",e.opaque?"#define OPAQUE":"",PA.colorspace_pars_fragment,Fw("linearToOutputTexel",e.outputColorSpace),vw(),e.useDepthPacking?"#define DEPTH_PACKING "+e.depthPacking:"",`
4100
+ `),E=[rd(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,h,e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",e.map?"#define USE_MAP":"",e.matcap?"#define USE_MATCAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+a:"",e.envMap?"#define "+s:"",e.envMap?"#define "+Q:"",r?"#define CUBEUV_TEXEL_WIDTH "+r.texelWidth:"",r?"#define CUBEUV_TEXEL_HEIGHT "+r.texelHeight:"",r?"#define CUBEUV_MAX_MIP "+r.maxMip+".0":"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoat?"#define USE_CLEARCOAT":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.dispersion?"#define USE_DISPERSION":"",e.iridescence?"#define USE_IRIDESCENCE":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaTest?"#define USE_ALPHATEST":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.sheen?"#define USE_SHEEN":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors||e.instancingColor||e.batchingColor?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.gradientMap?"#define USE_GRADIENTMAP":"",e.flatShading?"#define FLAT_SHADED":"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+n:"",e.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",e.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",e.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",e.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",e.toneMapping!==ri?"#define TONE_MAPPING":"",e.toneMapping!==ri?OA.tonemapping_pars_fragment:"",e.toneMapping!==ri?Lw("toneMapping",e.toneMapping):"",e.dithering?"#define DITHERING":"",e.opaque?"#define OPAQUE":"",OA.colorspace_pars_fragment,Fw("linearToOutputTexel",e.outputColorSpace),vw(),e.useDepthPacking?"#define DEPTH_PACKING "+e.depthPacking:"",`
4101
4101
  `].filter(SC).join(`
4102
4102
  `)),C=Ar(C),C=ad(C,e),C=sd(C,e),o=Ar(o),o=ad(o,e),o=sd(o,e),C=Qd(C),o=Qd(o),e.isRawShaderMaterial!==!0&&(u=`#version 300 es
4103
4103
  `,d=[B,"#define attribute in","#define varying out","#define texture2D texture"].join(`
@@ -4111,7 +4111,7 @@ Material Type: `+N.type+`
4111
4111
 
4112
4112
  Program Info Log: `+W+`
4113
4113
  `+QA+`
4114
- `+uA)}else W!==""?KA("WebGLProgram: Program Info Log:",W):(H===""||O==="")&&(lA=!1);lA&&(N.diagnostics={runnable:z,programLog:W,vertexShader:{log:H,prefix:d},fragmentShader:{log:O,prefix:E}})}g.deleteShader(D),g.deleteShader(w),S=new ln(g,c),l=Yw(g,c)}let S;this.getUniforms=function(){return S===void 0&&y(this),S};let l;this.getAttributes=function(){return l===void 0&&y(this),l};let p=e.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return p===!1&&(p=g.getProgramParameter(c,Sw)),p},this.destroy=function(){t.releaseStatesOfProgram(this),g.deleteProgram(c),this.program=void 0},this.type=e.shaderType,this.name=e.shaderName,this.id=Rw++,this.cacheKey=A,this.usedTimes=1,this.program=c,this.vertexShader=D,this.fragmentShader=w,this}let im=0;class gm{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(A){const e=A.vertexShader,t=A.fragmentShader,g=this._getShaderStage(e),I=this._getShaderStage(t),C=this._getShaderCacheForMaterial(A);return C.has(g)===!1&&(C.add(g),g.usedTimes++),C.has(I)===!1&&(C.add(I),I.usedTimes++),this}remove(A){const e=this.materialCache.get(A);for(const t of e)t.usedTimes--,t.usedTimes===0&&this.shaderCache.delete(t.code);return this.materialCache.delete(A),this}getVertexShaderID(A){return this._getShaderStage(A.vertexShader).id}getFragmentShaderID(A){return this._getShaderStage(A.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(A){const e=this.materialCache;let t=e.get(A);return t===void 0&&(t=new Set,e.set(A,t)),t}_getShaderStage(A){const e=this.shaderCache;let t=e.get(A);return t===void 0&&(t=new Im(A),e.set(A,t)),t}}class Im{constructor(A){this.id=im++,this.code=A,this.usedTimes=0}}function Cm(i,A,e,t,g,I,C){const o=new xc,n=new gm,a=new Set,s=[],Q=new Map,r=g.logarithmicDepthBuffer;let B=g.precision;const h={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function c(l){return a.add(l),l===0?"uv":`uv${l}`}function d(l,p,N,U,v){const P=U.fog,W=v.geometry,H=l.isMeshStandardMaterial?U.environment:null,O=(l.isMeshStandardMaterial?e:A).get(l.envMap||H),z=O&&O.mapping===Ko?O.image.height:null,lA=h[l.type];l.precision!==null&&(B=g.getMaxPrecision(l.precision),B!==l.precision&&KA("WebGLProgram.getParameters:",l.precision,"not supported, using",B,"instead."));const QA=W.morphAttributes.position||W.morphAttributes.normal||W.morphAttributes.color,uA=QA!==void 0?QA.length:0;let TA=0;W.morphAttributes.position!==void 0&&(TA=1),W.morphAttributes.normal!==void 0&&(TA=2),W.morphAttributes.color!==void 0&&(TA=3);let YA,Ne,ue,Z;if(lA){const he=li[lA];YA=he.vertexShader,Ne=he.fragmentShader}else YA=l.vertexShader,Ne=l.fragmentShader,n.update(l),ue=n.getVertexShaderID(l),Z=n.getFragmentShaderID(l);const gA=i.getRenderTarget(),wA=i.state.buffers.depth.getReversed(),HA=v.isInstancedMesh===!0,bA=v.isBatchedMesh===!0,se=!!l.map,ze=!!l.matcap,ne=!!O,de=!!l.aoMap,_e=!!l.lightMap,jA=!!l.bumpMap,qe=!!l.normalMap,R=!!l.displacementMap,He=!!l.emissiveMap,Ee=!!l.metalnessMap,we=!!l.roughnessMap,kA=l.anisotropy>0,b=l.clearcoat>0,f=l.dispersion>0,F=l.iridescence>0,X=l.sheen>0,tA=l.transmission>0,j=kA&&!!l.anisotropyMap,RA=b&&!!l.clearcoatMap,BA=b&&!!l.clearcoatNormalMap,NA=b&&!!l.clearcoatRoughnessMap,LA=F&&!!l.iridescenceMap,CA=F&&!!l.iridescenceThicknessMap,cA=X&&!!l.sheenColorMap,yA=X&&!!l.sheenRoughnessMap,SA=!!l.specularMap,EA=!!l.specularColorMap,WA=!!l.specularIntensityMap,M=tA&&!!l.transmissionMap,fA=tA&&!!l.thicknessMap,nA=!!l.gradientMap,DA=!!l.alphaMap,IA=l.alphaTest>0,eA=!!l.alphaHash,rA=!!l.extensions;let JA=ri;l.toneMapped&&(gA===null||gA.isXRRenderTarget===!0)&&(JA=i.toneMapping);const me={shaderID:lA,shaderType:l.type,shaderName:l.name,vertexShader:YA,fragmentShader:Ne,defines:l.defines,customVertexShaderID:ue,customFragmentShaderID:Z,isRawShaderMaterial:l.isRawShaderMaterial===!0,glslVersion:l.glslVersion,precision:B,batching:bA,batchingColor:bA&&v._colorsTexture!==null,instancing:HA,instancingColor:HA&&v.instanceColor!==null,instancingMorph:HA&&v.morphTexture!==null,outputColorSpace:gA===null?i.outputColorSpace:gA.isXRRenderTarget===!0?gA.texture.colorSpace:uI,alphaToCoverage:!!l.alphaToCoverage,map:se,matcap:ze,envMap:ne,envMapMode:ne&&O.mapping,envMapCubeUVHeight:z,aoMap:de,lightMap:_e,bumpMap:jA,normalMap:qe,displacementMap:R,emissiveMap:He,normalMapObjectSpace:qe&&l.normalMapType===bD,normalMapTangentSpace:qe&&l.normalMapType===yD,metalnessMap:Ee,roughnessMap:we,anisotropy:kA,anisotropyMap:j,clearcoat:b,clearcoatMap:RA,clearcoatNormalMap:BA,clearcoatRoughnessMap:NA,dispersion:f,iridescence:F,iridescenceMap:LA,iridescenceThicknessMap:CA,sheen:X,sheenColorMap:cA,sheenRoughnessMap:yA,specularMap:SA,specularColorMap:EA,specularIntensityMap:WA,transmission:tA,transmissionMap:M,thicknessMap:fA,gradientMap:nA,opaque:l.transparent===!1&&l.blending===dI&&l.alphaToCoverage===!1,alphaMap:DA,alphaTest:IA,alphaHash:eA,combine:l.combine,mapUv:se&&c(l.map.channel),aoMapUv:de&&c(l.aoMap.channel),lightMapUv:_e&&c(l.lightMap.channel),bumpMapUv:jA&&c(l.bumpMap.channel),normalMapUv:qe&&c(l.normalMap.channel),displacementMapUv:R&&c(l.displacementMap.channel),emissiveMapUv:He&&c(l.emissiveMap.channel),metalnessMapUv:Ee&&c(l.metalnessMap.channel),roughnessMapUv:we&&c(l.roughnessMap.channel),anisotropyMapUv:j&&c(l.anisotropyMap.channel),clearcoatMapUv:RA&&c(l.clearcoatMap.channel),clearcoatNormalMapUv:BA&&c(l.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:NA&&c(l.clearcoatRoughnessMap.channel),iridescenceMapUv:LA&&c(l.iridescenceMap.channel),iridescenceThicknessMapUv:CA&&c(l.iridescenceThicknessMap.channel),sheenColorMapUv:cA&&c(l.sheenColorMap.channel),sheenRoughnessMapUv:yA&&c(l.sheenRoughnessMap.channel),specularMapUv:SA&&c(l.specularMap.channel),specularColorMapUv:EA&&c(l.specularColorMap.channel),specularIntensityMapUv:WA&&c(l.specularIntensityMap.channel),transmissionMapUv:M&&c(l.transmissionMap.channel),thicknessMapUv:fA&&c(l.thicknessMap.channel),alphaMapUv:DA&&c(l.alphaMap.channel),vertexTangents:!!W.attributes.tangent&&(qe||kA),vertexColors:l.vertexColors,vertexAlphas:l.vertexColors===!0&&!!W.attributes.color&&W.attributes.color.itemSize===4,pointsUvs:v.isPoints===!0&&!!W.attributes.uv&&(se||DA),fog:!!P,useFog:l.fog===!0,fogExp2:!!P&&P.isFogExp2,flatShading:l.flatShading===!0&&l.wireframe===!1,sizeAttenuation:l.sizeAttenuation===!0,logarithmicDepthBuffer:r,reversedDepthBuffer:wA,skinning:v.isSkinnedMesh===!0,morphTargets:W.morphAttributes.position!==void 0,morphNormals:W.morphAttributes.normal!==void 0,morphColors:W.morphAttributes.color!==void 0,morphTargetsCount:uA,morphTextureStride:TA,numDirLights:p.directional.length,numPointLights:p.point.length,numSpotLights:p.spot.length,numSpotLightMaps:p.spotLightMap.length,numRectAreaLights:p.rectArea.length,numHemiLights:p.hemi.length,numDirLightShadows:p.directionalShadowMap.length,numPointLightShadows:p.pointShadowMap.length,numSpotLightShadows:p.spotShadowMap.length,numSpotLightShadowsWithMaps:p.numSpotLightShadowsWithMaps,numLightProbes:p.numLightProbes,numClippingPlanes:C.numPlanes,numClipIntersection:C.numIntersection,dithering:l.dithering,shadowMapEnabled:i.shadowMap.enabled&&N.length>0,shadowMapType:i.shadowMap.type,toneMapping:JA,decodeVideoTexture:se&&l.map.isVideoTexture===!0&&oe.getTransfer(l.map.colorSpace)===ce,decodeVideoTextureEmissive:He&&l.emissiveMap.isVideoTexture===!0&&oe.getTransfer(l.emissiveMap.colorSpace)===ce,premultipliedAlpha:l.premultipliedAlpha,doubleSided:l.side===Fi,flipSided:l.side===It,useDepthPacking:l.depthPacking>=0,depthPacking:l.depthPacking||0,index0AttributeName:l.index0AttributeName,extensionClipCullDistance:rA&&l.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(rA&&l.extensions.multiDraw===!0||bA)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:l.customProgramCacheKey()};return me.vertexUv1s=a.has(1),me.vertexUv2s=a.has(2),me.vertexUv3s=a.has(3),a.clear(),me}function E(l){const p=[];if(l.shaderID?p.push(l.shaderID):(p.push(l.customVertexShaderID),p.push(l.customFragmentShaderID)),l.defines!==void 0)for(const N in l.defines)p.push(N),p.push(l.defines[N]);return l.isRawShaderMaterial===!1&&(u(p,l),_(p,l),p.push(i.outputColorSpace)),p.push(l.customProgramCacheKey),p.join()}function u(l,p){l.push(p.precision),l.push(p.outputColorSpace),l.push(p.envMapMode),l.push(p.envMapCubeUVHeight),l.push(p.mapUv),l.push(p.alphaMapUv),l.push(p.lightMapUv),l.push(p.aoMapUv),l.push(p.bumpMapUv),l.push(p.normalMapUv),l.push(p.displacementMapUv),l.push(p.emissiveMapUv),l.push(p.metalnessMapUv),l.push(p.roughnessMapUv),l.push(p.anisotropyMapUv),l.push(p.clearcoatMapUv),l.push(p.clearcoatNormalMapUv),l.push(p.clearcoatRoughnessMapUv),l.push(p.iridescenceMapUv),l.push(p.iridescenceThicknessMapUv),l.push(p.sheenColorMapUv),l.push(p.sheenRoughnessMapUv),l.push(p.specularMapUv),l.push(p.specularColorMapUv),l.push(p.specularIntensityMapUv),l.push(p.transmissionMapUv),l.push(p.thicknessMapUv),l.push(p.combine),l.push(p.fogExp2),l.push(p.sizeAttenuation),l.push(p.morphTargetsCount),l.push(p.morphAttributeCount),l.push(p.numDirLights),l.push(p.numPointLights),l.push(p.numSpotLights),l.push(p.numSpotLightMaps),l.push(p.numHemiLights),l.push(p.numRectAreaLights),l.push(p.numDirLightShadows),l.push(p.numPointLightShadows),l.push(p.numSpotLightShadows),l.push(p.numSpotLightShadowsWithMaps),l.push(p.numLightProbes),l.push(p.shadowMapType),l.push(p.toneMapping),l.push(p.numClippingPlanes),l.push(p.numClipIntersection),l.push(p.depthPacking)}function _(l,p){o.disableAll(),p.instancing&&o.enable(0),p.instancingColor&&o.enable(1),p.instancingMorph&&o.enable(2),p.matcap&&o.enable(3),p.envMap&&o.enable(4),p.normalMapObjectSpace&&o.enable(5),p.normalMapTangentSpace&&o.enable(6),p.clearcoat&&o.enable(7),p.iridescence&&o.enable(8),p.alphaTest&&o.enable(9),p.vertexColors&&o.enable(10),p.vertexAlphas&&o.enable(11),p.vertexUv1s&&o.enable(12),p.vertexUv2s&&o.enable(13),p.vertexUv3s&&o.enable(14),p.vertexTangents&&o.enable(15),p.anisotropy&&o.enable(16),p.alphaHash&&o.enable(17),p.batching&&o.enable(18),p.dispersion&&o.enable(19),p.batchingColor&&o.enable(20),p.gradientMap&&o.enable(21),l.push(o.mask),o.disableAll(),p.fog&&o.enable(0),p.useFog&&o.enable(1),p.flatShading&&o.enable(2),p.logarithmicDepthBuffer&&o.enable(3),p.reversedDepthBuffer&&o.enable(4),p.skinning&&o.enable(5),p.morphTargets&&o.enable(6),p.morphNormals&&o.enable(7),p.morphColors&&o.enable(8),p.premultipliedAlpha&&o.enable(9),p.shadowMapEnabled&&o.enable(10),p.doubleSided&&o.enable(11),p.flipSided&&o.enable(12),p.useDepthPacking&&o.enable(13),p.dithering&&o.enable(14),p.transmission&&o.enable(15),p.sheen&&o.enable(16),p.opaque&&o.enable(17),p.pointsUvs&&o.enable(18),p.decodeVideoTexture&&o.enable(19),p.decodeVideoTextureEmissive&&o.enable(20),p.alphaToCoverage&&o.enable(21),l.push(o.mask)}function x(l){const p=h[l.type];let N;if(p){const U=li[p];N=i2.clone(U.uniforms)}else N=l.uniforms;return N}function D(l,p){let N=Q.get(p);return N!==void 0?++N.usedTimes:(N=new tm(i,p,l,I),s.push(N),Q.set(p,N)),N}function w(l){if(--l.usedTimes===0){const p=s.indexOf(l);s[p]=s[s.length-1],s.pop(),Q.delete(l.cacheKey),l.destroy()}}function y(l){n.remove(l)}function S(){n.dispose()}return{getParameters:d,getProgramCacheKey:E,getUniforms:x,acquireProgram:D,releaseProgram:w,releaseShaderCache:y,programs:s,dispose:S}}function om(){let i=new WeakMap;function A(C){return i.has(C)}function e(C){let o=i.get(C);return o===void 0&&(o={},i.set(C,o)),o}function t(C){i.delete(C)}function g(C,o,n){i.get(C)[o]=n}function I(){i=new WeakMap}return{has:A,get:e,remove:t,update:g,dispose:I}}function nm(i,A){return i.groupOrder!==A.groupOrder?i.groupOrder-A.groupOrder:i.renderOrder!==A.renderOrder?i.renderOrder-A.renderOrder:i.material.id!==A.material.id?i.material.id-A.material.id:i.z!==A.z?i.z-A.z:i.id-A.id}function Bd(i,A){return i.groupOrder!==A.groupOrder?i.groupOrder-A.groupOrder:i.renderOrder!==A.renderOrder?i.renderOrder-A.renderOrder:i.z!==A.z?A.z-i.z:i.id-A.id}function Ed(){const i=[];let A=0;const e=[],t=[],g=[];function I(){A=0,e.length=0,t.length=0,g.length=0}function C(Q,r,B,h,c,d){let E=i[A];return E===void 0?(E={id:Q.id,object:Q,geometry:r,material:B,groupOrder:h,renderOrder:Q.renderOrder,z:c,group:d},i[A]=E):(E.id=Q.id,E.object=Q,E.geometry=r,E.material=B,E.groupOrder=h,E.renderOrder=Q.renderOrder,E.z=c,E.group=d),A++,E}function o(Q,r,B,h,c,d){const E=C(Q,r,B,h,c,d);B.transmission>0?t.push(E):B.transparent===!0?g.push(E):e.push(E)}function n(Q,r,B,h,c,d){const E=C(Q,r,B,h,c,d);B.transmission>0?t.unshift(E):B.transparent===!0?g.unshift(E):e.unshift(E)}function a(Q,r){e.length>1&&e.sort(Q||nm),t.length>1&&t.sort(r||Bd),g.length>1&&g.sort(r||Bd)}function s(){for(let Q=A,r=i.length;Q<r;Q++){const B=i[Q];if(B.id===null)break;B.id=null,B.object=null,B.geometry=null,B.material=null,B.group=null}}return{opaque:e,transmissive:t,transparent:g,init:I,push:o,unshift:n,finish:s,sort:a}}function am(){let i=new WeakMap;function A(t,g){const I=i.get(t);let C;return I===void 0?(C=new Ed,i.set(t,[C])):g>=I.length?(C=new Ed,I.push(C)):C=I[g],C}function e(){i=new WeakMap}return{get:A,dispose:e}}function sm(){const i={};return{get:function(A){if(i[A.id]!==void 0)return i[A.id];let e;switch(A.type){case"DirectionalLight":e={direction:new J,color:new Ie};break;case"SpotLight":e={position:new J,direction:new J,color:new Ie,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":e={position:new J,color:new Ie,distance:0,decay:0};break;case"HemisphereLight":e={direction:new J,skyColor:new Ie,groundColor:new Ie};break;case"RectAreaLight":e={color:new Ie,position:new J,halfWidth:new J,halfHeight:new J};break}return i[A.id]=e,e}}}function Qm(){const i={};return{get:function(A){if(i[A.id]!==void 0)return i[A.id];let e;switch(A.type){case"DirectionalLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Be};break;case"SpotLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Be};break;case"PointLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Be,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[A.id]=e,e}}}let rm=0;function Bm(i,A){return(A.castShadow?2:0)-(i.castShadow?2:0)+(A.map?1:0)-(i.map?1:0)}function Em(i){const A=new sm,e=Qm(),t={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let a=0;a<9;a++)t.probe.push(new J);const g=new J,I=new Ye,C=new Ye;function o(a){let s=0,Q=0,r=0;for(let l=0;l<9;l++)t.probe[l].set(0,0,0);let B=0,h=0,c=0,d=0,E=0,u=0,_=0,x=0,D=0,w=0,y=0;a.sort(Bm);for(let l=0,p=a.length;l<p;l++){const N=a[l],U=N.color,v=N.intensity,P=N.distance;let W=null;if(N.shadow&&N.shadow.map&&(N.shadow.map.texture.format===xI?W=N.shadow.map.texture:W=N.shadow.map.depthTexture||N.shadow.map.texture),N.isAmbientLight)s+=U.r*v,Q+=U.g*v,r+=U.b*v;else if(N.isLightProbe){for(let H=0;H<9;H++)t.probe[H].addScaledVector(N.sh.coefficients[H],v);y++}else if(N.isDirectionalLight){const H=A.get(N);if(H.color.copy(N.color).multiplyScalar(N.intensity),N.castShadow){const O=N.shadow,z=e.get(N);z.shadowIntensity=O.intensity,z.shadowBias=O.bias,z.shadowNormalBias=O.normalBias,z.shadowRadius=O.radius,z.shadowMapSize=O.mapSize,t.directionalShadow[B]=z,t.directionalShadowMap[B]=W,t.directionalShadowMatrix[B]=N.shadow.matrix,u++}t.directional[B]=H,B++}else if(N.isSpotLight){const H=A.get(N);H.position.setFromMatrixPosition(N.matrixWorld),H.color.copy(U).multiplyScalar(v),H.distance=P,H.coneCos=Math.cos(N.angle),H.penumbraCos=Math.cos(N.angle*(1-N.penumbra)),H.decay=N.decay,t.spot[c]=H;const O=N.shadow;if(N.map&&(t.spotLightMap[D]=N.map,D++,O.updateMatrices(N),N.castShadow&&w++),t.spotLightMatrix[c]=O.matrix,N.castShadow){const z=e.get(N);z.shadowIntensity=O.intensity,z.shadowBias=O.bias,z.shadowNormalBias=O.normalBias,z.shadowRadius=O.radius,z.shadowMapSize=O.mapSize,t.spotShadow[c]=z,t.spotShadowMap[c]=W,x++}c++}else if(N.isRectAreaLight){const H=A.get(N);H.color.copy(U).multiplyScalar(v),H.halfWidth.set(N.width*.5,0,0),H.halfHeight.set(0,N.height*.5,0),t.rectArea[d]=H,d++}else if(N.isPointLight){const H=A.get(N);if(H.color.copy(N.color).multiplyScalar(N.intensity),H.distance=N.distance,H.decay=N.decay,N.castShadow){const O=N.shadow,z=e.get(N);z.shadowIntensity=O.intensity,z.shadowBias=O.bias,z.shadowNormalBias=O.normalBias,z.shadowRadius=O.radius,z.shadowMapSize=O.mapSize,z.shadowCameraNear=O.camera.near,z.shadowCameraFar=O.camera.far,t.pointShadow[h]=z,t.pointShadowMap[h]=W,t.pointShadowMatrix[h]=N.shadow.matrix,_++}t.point[h]=H,h++}else if(N.isHemisphereLight){const H=A.get(N);H.skyColor.copy(N.color).multiplyScalar(v),H.groundColor.copy(N.groundColor).multiplyScalar(v),t.hemi[E]=H,E++}}d>0&&(i.has("OES_texture_float_linear")===!0?(t.rectAreaLTC1=hA.LTC_FLOAT_1,t.rectAreaLTC2=hA.LTC_FLOAT_2):(t.rectAreaLTC1=hA.LTC_HALF_1,t.rectAreaLTC2=hA.LTC_HALF_2)),t.ambient[0]=s,t.ambient[1]=Q,t.ambient[2]=r;const S=t.hash;(S.directionalLength!==B||S.pointLength!==h||S.spotLength!==c||S.rectAreaLength!==d||S.hemiLength!==E||S.numDirectionalShadows!==u||S.numPointShadows!==_||S.numSpotShadows!==x||S.numSpotMaps!==D||S.numLightProbes!==y)&&(t.directional.length=B,t.spot.length=c,t.rectArea.length=d,t.point.length=h,t.hemi.length=E,t.directionalShadow.length=u,t.directionalShadowMap.length=u,t.pointShadow.length=_,t.pointShadowMap.length=_,t.spotShadow.length=x,t.spotShadowMap.length=x,t.directionalShadowMatrix.length=u,t.pointShadowMatrix.length=_,t.spotLightMatrix.length=x+D-w,t.spotLightMap.length=D,t.numSpotLightShadowsWithMaps=w,t.numLightProbes=y,S.directionalLength=B,S.pointLength=h,S.spotLength=c,S.rectAreaLength=d,S.hemiLength=E,S.numDirectionalShadows=u,S.numPointShadows=_,S.numSpotShadows=x,S.numSpotMaps=D,S.numLightProbes=y,t.version=rm++)}function n(a,s){let Q=0,r=0,B=0,h=0,c=0;const d=s.matrixWorldInverse;for(let E=0,u=a.length;E<u;E++){const _=a[E];if(_.isDirectionalLight){const x=t.directional[Q];x.direction.setFromMatrixPosition(_.matrixWorld),g.setFromMatrixPosition(_.target.matrixWorld),x.direction.sub(g),x.direction.transformDirection(d),Q++}else if(_.isSpotLight){const x=t.spot[B];x.position.setFromMatrixPosition(_.matrixWorld),x.position.applyMatrix4(d),x.direction.setFromMatrixPosition(_.matrixWorld),g.setFromMatrixPosition(_.target.matrixWorld),x.direction.sub(g),x.direction.transformDirection(d),B++}else if(_.isRectAreaLight){const x=t.rectArea[h];x.position.setFromMatrixPosition(_.matrixWorld),x.position.applyMatrix4(d),C.identity(),I.copy(_.matrixWorld),I.premultiply(d),C.extractRotation(I),x.halfWidth.set(_.width*.5,0,0),x.halfHeight.set(0,_.height*.5,0),x.halfWidth.applyMatrix4(C),x.halfHeight.applyMatrix4(C),h++}else if(_.isPointLight){const x=t.point[r];x.position.setFromMatrixPosition(_.matrixWorld),x.position.applyMatrix4(d),r++}else if(_.isHemisphereLight){const x=t.hemi[c];x.direction.setFromMatrixPosition(_.matrixWorld),x.direction.transformDirection(d),c++}}}return{setup:o,setupView:n,state:t}}function cd(i){const A=new Em(i),e=[],t=[];function g(s){a.camera=s,e.length=0,t.length=0}function I(s){e.push(s)}function C(s){t.push(s)}function o(){A.setup(e)}function n(s){A.setupView(e,s)}const a={lightsArray:e,shadowsArray:t,camera:null,lights:A,transmissionRenderTarget:{}};return{init:g,state:a,setupLights:o,setupLightsView:n,pushLight:I,pushShadow:C}}function cm(i){let A=new WeakMap;function e(g,I=0){const C=A.get(g);let o;return C===void 0?(o=new cd(i),A.set(g,[o])):I>=C.length?(o=new cd(i),C.push(o)):o=C[I],o}function t(){A=new WeakMap}return{get:e,dispose:t}}const dm=`void main() {
4114
+ `+uA)}else W!==""?KA("WebGLProgram: Program Info Log:",W):(H===""||O==="")&&(lA=!1);lA&&(N.diagnostics={runnable:z,programLog:W,vertexShader:{log:H,prefix:d},fragmentShader:{log:O,prefix:E}})}g.deleteShader(D),g.deleteShader(w),S=new ln(g,c),l=Yw(g,c)}let S;this.getUniforms=function(){return S===void 0&&y(this),S};let l;this.getAttributes=function(){return l===void 0&&y(this),l};let p=e.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return p===!1&&(p=g.getProgramParameter(c,Sw)),p},this.destroy=function(){t.releaseStatesOfProgram(this),g.deleteProgram(c),this.program=void 0},this.type=e.shaderType,this.name=e.shaderName,this.id=Rw++,this.cacheKey=A,this.usedTimes=1,this.program=c,this.vertexShader=D,this.fragmentShader=w,this}let im=0;class gm{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(A){const e=A.vertexShader,t=A.fragmentShader,g=this._getShaderStage(e),I=this._getShaderStage(t),C=this._getShaderCacheForMaterial(A);return C.has(g)===!1&&(C.add(g),g.usedTimes++),C.has(I)===!1&&(C.add(I),I.usedTimes++),this}remove(A){const e=this.materialCache.get(A);for(const t of e)t.usedTimes--,t.usedTimes===0&&this.shaderCache.delete(t.code);return this.materialCache.delete(A),this}getVertexShaderID(A){return this._getShaderStage(A.vertexShader).id}getFragmentShaderID(A){return this._getShaderStage(A.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(A){const e=this.materialCache;let t=e.get(A);return t===void 0&&(t=new Set,e.set(A,t)),t}_getShaderStage(A){const e=this.shaderCache;let t=e.get(A);return t===void 0&&(t=new Im(A),e.set(A,t)),t}}class Im{constructor(A){this.id=im++,this.code=A,this.usedTimes=0}}function Cm(i,A,e,t,g,I,C){const o=new xc,n=new gm,a=new Set,s=[],Q=new Map,r=g.logarithmicDepthBuffer;let B=g.precision;const h={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function c(l){return a.add(l),l===0?"uv":`uv${l}`}function d(l,p,N,U,v){const P=U.fog,W=v.geometry,H=l.isMeshStandardMaterial?U.environment:null,O=(l.isMeshStandardMaterial?e:A).get(l.envMap||H),z=O&&O.mapping===Ko?O.image.height:null,lA=h[l.type];l.precision!==null&&(B=g.getMaxPrecision(l.precision),B!==l.precision&&KA("WebGLProgram.getParameters:",l.precision,"not supported, using",B,"instead."));const QA=W.morphAttributes.position||W.morphAttributes.normal||W.morphAttributes.color,uA=QA!==void 0?QA.length:0;let TA=0;W.morphAttributes.position!==void 0&&(TA=1),W.morphAttributes.normal!==void 0&&(TA=2),W.morphAttributes.color!==void 0&&(TA=3);let YA,Ne,ue,Z;if(lA){const he=li[lA];YA=he.vertexShader,Ne=he.fragmentShader}else YA=l.vertexShader,Ne=l.fragmentShader,n.update(l),ue=n.getVertexShaderID(l),Z=n.getFragmentShaderID(l);const gA=i.getRenderTarget(),wA=i.state.buffers.depth.getReversed(),PA=v.isInstancedMesh===!0,bA=v.isBatchedMesh===!0,se=!!l.map,ze=!!l.matcap,ne=!!O,de=!!l.aoMap,_e=!!l.lightMap,jA=!!l.bumpMap,qe=!!l.normalMap,R=!!l.displacementMap,He=!!l.emissiveMap,Ee=!!l.metalnessMap,we=!!l.roughnessMap,kA=l.anisotropy>0,b=l.clearcoat>0,f=l.dispersion>0,F=l.iridescence>0,X=l.sheen>0,tA=l.transmission>0,j=kA&&!!l.anisotropyMap,RA=b&&!!l.clearcoatMap,BA=b&&!!l.clearcoatNormalMap,NA=b&&!!l.clearcoatRoughnessMap,LA=F&&!!l.iridescenceMap,CA=F&&!!l.iridescenceThicknessMap,cA=X&&!!l.sheenColorMap,yA=X&&!!l.sheenRoughnessMap,SA=!!l.specularMap,EA=!!l.specularColorMap,WA=!!l.specularIntensityMap,M=tA&&!!l.transmissionMap,fA=tA&&!!l.thicknessMap,nA=!!l.gradientMap,DA=!!l.alphaMap,IA=l.alphaTest>0,eA=!!l.alphaHash,rA=!!l.extensions;let JA=ri;l.toneMapped&&(gA===null||gA.isXRRenderTarget===!0)&&(JA=i.toneMapping);const me={shaderID:lA,shaderType:l.type,shaderName:l.name,vertexShader:YA,fragmentShader:Ne,defines:l.defines,customVertexShaderID:ue,customFragmentShaderID:Z,isRawShaderMaterial:l.isRawShaderMaterial===!0,glslVersion:l.glslVersion,precision:B,batching:bA,batchingColor:bA&&v._colorsTexture!==null,instancing:PA,instancingColor:PA&&v.instanceColor!==null,instancingMorph:PA&&v.morphTexture!==null,outputColorSpace:gA===null?i.outputColorSpace:gA.isXRRenderTarget===!0?gA.texture.colorSpace:uI,alphaToCoverage:!!l.alphaToCoverage,map:se,matcap:ze,envMap:ne,envMapMode:ne&&O.mapping,envMapCubeUVHeight:z,aoMap:de,lightMap:_e,bumpMap:jA,normalMap:qe,displacementMap:R,emissiveMap:He,normalMapObjectSpace:qe&&l.normalMapType===bD,normalMapTangentSpace:qe&&l.normalMapType===yD,metalnessMap:Ee,roughnessMap:we,anisotropy:kA,anisotropyMap:j,clearcoat:b,clearcoatMap:RA,clearcoatNormalMap:BA,clearcoatRoughnessMap:NA,dispersion:f,iridescence:F,iridescenceMap:LA,iridescenceThicknessMap:CA,sheen:X,sheenColorMap:cA,sheenRoughnessMap:yA,specularMap:SA,specularColorMap:EA,specularIntensityMap:WA,transmission:tA,transmissionMap:M,thicknessMap:fA,gradientMap:nA,opaque:l.transparent===!1&&l.blending===dI&&l.alphaToCoverage===!1,alphaMap:DA,alphaTest:IA,alphaHash:eA,combine:l.combine,mapUv:se&&c(l.map.channel),aoMapUv:de&&c(l.aoMap.channel),lightMapUv:_e&&c(l.lightMap.channel),bumpMapUv:jA&&c(l.bumpMap.channel),normalMapUv:qe&&c(l.normalMap.channel),displacementMapUv:R&&c(l.displacementMap.channel),emissiveMapUv:He&&c(l.emissiveMap.channel),metalnessMapUv:Ee&&c(l.metalnessMap.channel),roughnessMapUv:we&&c(l.roughnessMap.channel),anisotropyMapUv:j&&c(l.anisotropyMap.channel),clearcoatMapUv:RA&&c(l.clearcoatMap.channel),clearcoatNormalMapUv:BA&&c(l.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:NA&&c(l.clearcoatRoughnessMap.channel),iridescenceMapUv:LA&&c(l.iridescenceMap.channel),iridescenceThicknessMapUv:CA&&c(l.iridescenceThicknessMap.channel),sheenColorMapUv:cA&&c(l.sheenColorMap.channel),sheenRoughnessMapUv:yA&&c(l.sheenRoughnessMap.channel),specularMapUv:SA&&c(l.specularMap.channel),specularColorMapUv:EA&&c(l.specularColorMap.channel),specularIntensityMapUv:WA&&c(l.specularIntensityMap.channel),transmissionMapUv:M&&c(l.transmissionMap.channel),thicknessMapUv:fA&&c(l.thicknessMap.channel),alphaMapUv:DA&&c(l.alphaMap.channel),vertexTangents:!!W.attributes.tangent&&(qe||kA),vertexColors:l.vertexColors,vertexAlphas:l.vertexColors===!0&&!!W.attributes.color&&W.attributes.color.itemSize===4,pointsUvs:v.isPoints===!0&&!!W.attributes.uv&&(se||DA),fog:!!P,useFog:l.fog===!0,fogExp2:!!P&&P.isFogExp2,flatShading:l.flatShading===!0&&l.wireframe===!1,sizeAttenuation:l.sizeAttenuation===!0,logarithmicDepthBuffer:r,reversedDepthBuffer:wA,skinning:v.isSkinnedMesh===!0,morphTargets:W.morphAttributes.position!==void 0,morphNormals:W.morphAttributes.normal!==void 0,morphColors:W.morphAttributes.color!==void 0,morphTargetsCount:uA,morphTextureStride:TA,numDirLights:p.directional.length,numPointLights:p.point.length,numSpotLights:p.spot.length,numSpotLightMaps:p.spotLightMap.length,numRectAreaLights:p.rectArea.length,numHemiLights:p.hemi.length,numDirLightShadows:p.directionalShadowMap.length,numPointLightShadows:p.pointShadowMap.length,numSpotLightShadows:p.spotShadowMap.length,numSpotLightShadowsWithMaps:p.numSpotLightShadowsWithMaps,numLightProbes:p.numLightProbes,numClippingPlanes:C.numPlanes,numClipIntersection:C.numIntersection,dithering:l.dithering,shadowMapEnabled:i.shadowMap.enabled&&N.length>0,shadowMapType:i.shadowMap.type,toneMapping:JA,decodeVideoTexture:se&&l.map.isVideoTexture===!0&&oe.getTransfer(l.map.colorSpace)===ce,decodeVideoTextureEmissive:He&&l.emissiveMap.isVideoTexture===!0&&oe.getTransfer(l.emissiveMap.colorSpace)===ce,premultipliedAlpha:l.premultipliedAlpha,doubleSided:l.side===Fi,flipSided:l.side===Ct,useDepthPacking:l.depthPacking>=0,depthPacking:l.depthPacking||0,index0AttributeName:l.index0AttributeName,extensionClipCullDistance:rA&&l.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(rA&&l.extensions.multiDraw===!0||bA)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:l.customProgramCacheKey()};return me.vertexUv1s=a.has(1),me.vertexUv2s=a.has(2),me.vertexUv3s=a.has(3),a.clear(),me}function E(l){const p=[];if(l.shaderID?p.push(l.shaderID):(p.push(l.customVertexShaderID),p.push(l.customFragmentShaderID)),l.defines!==void 0)for(const N in l.defines)p.push(N),p.push(l.defines[N]);return l.isRawShaderMaterial===!1&&(u(p,l),_(p,l),p.push(i.outputColorSpace)),p.push(l.customProgramCacheKey),p.join()}function u(l,p){l.push(p.precision),l.push(p.outputColorSpace),l.push(p.envMapMode),l.push(p.envMapCubeUVHeight),l.push(p.mapUv),l.push(p.alphaMapUv),l.push(p.lightMapUv),l.push(p.aoMapUv),l.push(p.bumpMapUv),l.push(p.normalMapUv),l.push(p.displacementMapUv),l.push(p.emissiveMapUv),l.push(p.metalnessMapUv),l.push(p.roughnessMapUv),l.push(p.anisotropyMapUv),l.push(p.clearcoatMapUv),l.push(p.clearcoatNormalMapUv),l.push(p.clearcoatRoughnessMapUv),l.push(p.iridescenceMapUv),l.push(p.iridescenceThicknessMapUv),l.push(p.sheenColorMapUv),l.push(p.sheenRoughnessMapUv),l.push(p.specularMapUv),l.push(p.specularColorMapUv),l.push(p.specularIntensityMapUv),l.push(p.transmissionMapUv),l.push(p.thicknessMapUv),l.push(p.combine),l.push(p.fogExp2),l.push(p.sizeAttenuation),l.push(p.morphTargetsCount),l.push(p.morphAttributeCount),l.push(p.numDirLights),l.push(p.numPointLights),l.push(p.numSpotLights),l.push(p.numSpotLightMaps),l.push(p.numHemiLights),l.push(p.numRectAreaLights),l.push(p.numDirLightShadows),l.push(p.numPointLightShadows),l.push(p.numSpotLightShadows),l.push(p.numSpotLightShadowsWithMaps),l.push(p.numLightProbes),l.push(p.shadowMapType),l.push(p.toneMapping),l.push(p.numClippingPlanes),l.push(p.numClipIntersection),l.push(p.depthPacking)}function _(l,p){o.disableAll(),p.instancing&&o.enable(0),p.instancingColor&&o.enable(1),p.instancingMorph&&o.enable(2),p.matcap&&o.enable(3),p.envMap&&o.enable(4),p.normalMapObjectSpace&&o.enable(5),p.normalMapTangentSpace&&o.enable(6),p.clearcoat&&o.enable(7),p.iridescence&&o.enable(8),p.alphaTest&&o.enable(9),p.vertexColors&&o.enable(10),p.vertexAlphas&&o.enable(11),p.vertexUv1s&&o.enable(12),p.vertexUv2s&&o.enable(13),p.vertexUv3s&&o.enable(14),p.vertexTangents&&o.enable(15),p.anisotropy&&o.enable(16),p.alphaHash&&o.enable(17),p.batching&&o.enable(18),p.dispersion&&o.enable(19),p.batchingColor&&o.enable(20),p.gradientMap&&o.enable(21),l.push(o.mask),o.disableAll(),p.fog&&o.enable(0),p.useFog&&o.enable(1),p.flatShading&&o.enable(2),p.logarithmicDepthBuffer&&o.enable(3),p.reversedDepthBuffer&&o.enable(4),p.skinning&&o.enable(5),p.morphTargets&&o.enable(6),p.morphNormals&&o.enable(7),p.morphColors&&o.enable(8),p.premultipliedAlpha&&o.enable(9),p.shadowMapEnabled&&o.enable(10),p.doubleSided&&o.enable(11),p.flipSided&&o.enable(12),p.useDepthPacking&&o.enable(13),p.dithering&&o.enable(14),p.transmission&&o.enable(15),p.sheen&&o.enable(16),p.opaque&&o.enable(17),p.pointsUvs&&o.enable(18),p.decodeVideoTexture&&o.enable(19),p.decodeVideoTextureEmissive&&o.enable(20),p.alphaToCoverage&&o.enable(21),l.push(o.mask)}function x(l){const p=h[l.type];let N;if(p){const U=li[p];N=i2.clone(U.uniforms)}else N=l.uniforms;return N}function D(l,p){let N=Q.get(p);return N!==void 0?++N.usedTimes:(N=new tm(i,p,l,I),s.push(N),Q.set(p,N)),N}function w(l){if(--l.usedTimes===0){const p=s.indexOf(l);s[p]=s[s.length-1],s.pop(),Q.delete(l.cacheKey),l.destroy()}}function y(l){n.remove(l)}function S(){n.dispose()}return{getParameters:d,getProgramCacheKey:E,getUniforms:x,acquireProgram:D,releaseProgram:w,releaseShaderCache:y,programs:s,dispose:S}}function om(){let i=new WeakMap;function A(C){return i.has(C)}function e(C){let o=i.get(C);return o===void 0&&(o={},i.set(C,o)),o}function t(C){i.delete(C)}function g(C,o,n){i.get(C)[o]=n}function I(){i=new WeakMap}return{has:A,get:e,remove:t,update:g,dispose:I}}function nm(i,A){return i.groupOrder!==A.groupOrder?i.groupOrder-A.groupOrder:i.renderOrder!==A.renderOrder?i.renderOrder-A.renderOrder:i.material.id!==A.material.id?i.material.id-A.material.id:i.z!==A.z?i.z-A.z:i.id-A.id}function Bd(i,A){return i.groupOrder!==A.groupOrder?i.groupOrder-A.groupOrder:i.renderOrder!==A.renderOrder?i.renderOrder-A.renderOrder:i.z!==A.z?A.z-i.z:i.id-A.id}function Ed(){const i=[];let A=0;const e=[],t=[],g=[];function I(){A=0,e.length=0,t.length=0,g.length=0}function C(Q,r,B,h,c,d){let E=i[A];return E===void 0?(E={id:Q.id,object:Q,geometry:r,material:B,groupOrder:h,renderOrder:Q.renderOrder,z:c,group:d},i[A]=E):(E.id=Q.id,E.object=Q,E.geometry=r,E.material=B,E.groupOrder=h,E.renderOrder=Q.renderOrder,E.z=c,E.group=d),A++,E}function o(Q,r,B,h,c,d){const E=C(Q,r,B,h,c,d);B.transmission>0?t.push(E):B.transparent===!0?g.push(E):e.push(E)}function n(Q,r,B,h,c,d){const E=C(Q,r,B,h,c,d);B.transmission>0?t.unshift(E):B.transparent===!0?g.unshift(E):e.unshift(E)}function a(Q,r){e.length>1&&e.sort(Q||nm),t.length>1&&t.sort(r||Bd),g.length>1&&g.sort(r||Bd)}function s(){for(let Q=A,r=i.length;Q<r;Q++){const B=i[Q];if(B.id===null)break;B.id=null,B.object=null,B.geometry=null,B.material=null,B.group=null}}return{opaque:e,transmissive:t,transparent:g,init:I,push:o,unshift:n,finish:s,sort:a}}function am(){let i=new WeakMap;function A(t,g){const I=i.get(t);let C;return I===void 0?(C=new Ed,i.set(t,[C])):g>=I.length?(C=new Ed,I.push(C)):C=I[g],C}function e(){i=new WeakMap}return{get:A,dispose:e}}function sm(){const i={};return{get:function(A){if(i[A.id]!==void 0)return i[A.id];let e;switch(A.type){case"DirectionalLight":e={direction:new J,color:new Ie};break;case"SpotLight":e={position:new J,direction:new J,color:new Ie,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":e={position:new J,color:new Ie,distance:0,decay:0};break;case"HemisphereLight":e={direction:new J,skyColor:new Ie,groundColor:new Ie};break;case"RectAreaLight":e={color:new Ie,position:new J,halfWidth:new J,halfHeight:new J};break}return i[A.id]=e,e}}}function Qm(){const i={};return{get:function(A){if(i[A.id]!==void 0)return i[A.id];let e;switch(A.type){case"DirectionalLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Be};break;case"SpotLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Be};break;case"PointLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Be,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[A.id]=e,e}}}let rm=0;function Bm(i,A){return(A.castShadow?2:0)-(i.castShadow?2:0)+(A.map?1:0)-(i.map?1:0)}function Em(i){const A=new sm,e=Qm(),t={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let a=0;a<9;a++)t.probe.push(new J);const g=new J,I=new Ye,C=new Ye;function o(a){let s=0,Q=0,r=0;for(let l=0;l<9;l++)t.probe[l].set(0,0,0);let B=0,h=0,c=0,d=0,E=0,u=0,_=0,x=0,D=0,w=0,y=0;a.sort(Bm);for(let l=0,p=a.length;l<p;l++){const N=a[l],U=N.color,v=N.intensity,P=N.distance;let W=null;if(N.shadow&&N.shadow.map&&(N.shadow.map.texture.format===xI?W=N.shadow.map.texture:W=N.shadow.map.depthTexture||N.shadow.map.texture),N.isAmbientLight)s+=U.r*v,Q+=U.g*v,r+=U.b*v;else if(N.isLightProbe){for(let H=0;H<9;H++)t.probe[H].addScaledVector(N.sh.coefficients[H],v);y++}else if(N.isDirectionalLight){const H=A.get(N);if(H.color.copy(N.color).multiplyScalar(N.intensity),N.castShadow){const O=N.shadow,z=e.get(N);z.shadowIntensity=O.intensity,z.shadowBias=O.bias,z.shadowNormalBias=O.normalBias,z.shadowRadius=O.radius,z.shadowMapSize=O.mapSize,t.directionalShadow[B]=z,t.directionalShadowMap[B]=W,t.directionalShadowMatrix[B]=N.shadow.matrix,u++}t.directional[B]=H,B++}else if(N.isSpotLight){const H=A.get(N);H.position.setFromMatrixPosition(N.matrixWorld),H.color.copy(U).multiplyScalar(v),H.distance=P,H.coneCos=Math.cos(N.angle),H.penumbraCos=Math.cos(N.angle*(1-N.penumbra)),H.decay=N.decay,t.spot[c]=H;const O=N.shadow;if(N.map&&(t.spotLightMap[D]=N.map,D++,O.updateMatrices(N),N.castShadow&&w++),t.spotLightMatrix[c]=O.matrix,N.castShadow){const z=e.get(N);z.shadowIntensity=O.intensity,z.shadowBias=O.bias,z.shadowNormalBias=O.normalBias,z.shadowRadius=O.radius,z.shadowMapSize=O.mapSize,t.spotShadow[c]=z,t.spotShadowMap[c]=W,x++}c++}else if(N.isRectAreaLight){const H=A.get(N);H.color.copy(U).multiplyScalar(v),H.halfWidth.set(N.width*.5,0,0),H.halfHeight.set(0,N.height*.5,0),t.rectArea[d]=H,d++}else if(N.isPointLight){const H=A.get(N);if(H.color.copy(N.color).multiplyScalar(N.intensity),H.distance=N.distance,H.decay=N.decay,N.castShadow){const O=N.shadow,z=e.get(N);z.shadowIntensity=O.intensity,z.shadowBias=O.bias,z.shadowNormalBias=O.normalBias,z.shadowRadius=O.radius,z.shadowMapSize=O.mapSize,z.shadowCameraNear=O.camera.near,z.shadowCameraFar=O.camera.far,t.pointShadow[h]=z,t.pointShadowMap[h]=W,t.pointShadowMatrix[h]=N.shadow.matrix,_++}t.point[h]=H,h++}else if(N.isHemisphereLight){const H=A.get(N);H.skyColor.copy(N.color).multiplyScalar(v),H.groundColor.copy(N.groundColor).multiplyScalar(v),t.hemi[E]=H,E++}}d>0&&(i.has("OES_texture_float_linear")===!0?(t.rectAreaLTC1=hA.LTC_FLOAT_1,t.rectAreaLTC2=hA.LTC_FLOAT_2):(t.rectAreaLTC1=hA.LTC_HALF_1,t.rectAreaLTC2=hA.LTC_HALF_2)),t.ambient[0]=s,t.ambient[1]=Q,t.ambient[2]=r;const S=t.hash;(S.directionalLength!==B||S.pointLength!==h||S.spotLength!==c||S.rectAreaLength!==d||S.hemiLength!==E||S.numDirectionalShadows!==u||S.numPointShadows!==_||S.numSpotShadows!==x||S.numSpotMaps!==D||S.numLightProbes!==y)&&(t.directional.length=B,t.spot.length=c,t.rectArea.length=d,t.point.length=h,t.hemi.length=E,t.directionalShadow.length=u,t.directionalShadowMap.length=u,t.pointShadow.length=_,t.pointShadowMap.length=_,t.spotShadow.length=x,t.spotShadowMap.length=x,t.directionalShadowMatrix.length=u,t.pointShadowMatrix.length=_,t.spotLightMatrix.length=x+D-w,t.spotLightMap.length=D,t.numSpotLightShadowsWithMaps=w,t.numLightProbes=y,S.directionalLength=B,S.pointLength=h,S.spotLength=c,S.rectAreaLength=d,S.hemiLength=E,S.numDirectionalShadows=u,S.numPointShadows=_,S.numSpotShadows=x,S.numSpotMaps=D,S.numLightProbes=y,t.version=rm++)}function n(a,s){let Q=0,r=0,B=0,h=0,c=0;const d=s.matrixWorldInverse;for(let E=0,u=a.length;E<u;E++){const _=a[E];if(_.isDirectionalLight){const x=t.directional[Q];x.direction.setFromMatrixPosition(_.matrixWorld),g.setFromMatrixPosition(_.target.matrixWorld),x.direction.sub(g),x.direction.transformDirection(d),Q++}else if(_.isSpotLight){const x=t.spot[B];x.position.setFromMatrixPosition(_.matrixWorld),x.position.applyMatrix4(d),x.direction.setFromMatrixPosition(_.matrixWorld),g.setFromMatrixPosition(_.target.matrixWorld),x.direction.sub(g),x.direction.transformDirection(d),B++}else if(_.isRectAreaLight){const x=t.rectArea[h];x.position.setFromMatrixPosition(_.matrixWorld),x.position.applyMatrix4(d),C.identity(),I.copy(_.matrixWorld),I.premultiply(d),C.extractRotation(I),x.halfWidth.set(_.width*.5,0,0),x.halfHeight.set(0,_.height*.5,0),x.halfWidth.applyMatrix4(C),x.halfHeight.applyMatrix4(C),h++}else if(_.isPointLight){const x=t.point[r];x.position.setFromMatrixPosition(_.matrixWorld),x.position.applyMatrix4(d),r++}else if(_.isHemisphereLight){const x=t.hemi[c];x.direction.setFromMatrixPosition(_.matrixWorld),x.direction.transformDirection(d),c++}}}return{setup:o,setupView:n,state:t}}function cd(i){const A=new Em(i),e=[],t=[];function g(s){a.camera=s,e.length=0,t.length=0}function I(s){e.push(s)}function C(s){t.push(s)}function o(){A.setup(e)}function n(s){A.setupView(e,s)}const a={lightsArray:e,shadowsArray:t,camera:null,lights:A,transmissionRenderTarget:{}};return{init:g,state:a,setupLights:o,setupLightsView:n,pushLight:I,pushShadow:C}}function cm(i){let A=new WeakMap;function e(g,I=0){const C=A.get(g);let o;return C===void 0?(o=new cd(i),A.set(g,[o])):I>=C.length?(o=new cd(i),C.push(o)):o=C[I],o}function t(){A=new WeakMap}return{get:e,dispose:t}}const dm=`void main() {
4115
4115
  gl_Position = vec4( position, 1.0 );
4116
4116
  }`,hm=`uniform sampler2D shadow_pass;
4117
4117
  uniform vec2 resolution;
@@ -4138,7 +4138,7 @@ void main() {
4138
4138
  squared_mean = squared_mean / samples;
4139
4139
  float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
4140
4140
  gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
4141
- }`,lm=[new J(1,0,0),new J(-1,0,0),new J(0,1,0),new J(0,-1,0),new J(0,0,1),new J(0,0,-1)],xm=[new J(0,-1,0),new J(0,-1,0),new J(0,0,1),new J(0,0,-1),new J(0,-1,0),new J(0,-1,0)],dd=new Ye,RC=new J,er=new J;function um(i,A,e){let t=new Kc;const g=new Be,I=new Be,C=new ve,o=new c2,n=new d2,a={},s=e.maxTextureSize,Q={[Mi]:It,[It]:Mi,[Fi]:Fi},r=new Ut({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Be},radius:{value:4}},vertexShader:dm,fragmentShader:hm}),B=r.clone();B.defines.HORIZONTAL_PASS=1;const h=new $t;h.setAttribute("position",new hi(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const c=new Ai(h,r),d=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=vo;let E=this.type;this.render=function(w,y,S){if(d.enabled===!1||d.autoUpdate===!1&&d.needsUpdate===!1||w.length===0)return;w.type===gD&&(KA("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),w.type=vo);const l=i.getRenderTarget(),p=i.getActiveCubeFace(),N=i.getActiveMipmapLevel(),U=i.state;U.setBlending(Ui),U.buffers.depth.getReversed()===!0?U.buffers.color.setClear(0,0,0,0):U.buffers.color.setClear(1,1,1,1),U.buffers.depth.setTest(!0),U.setScissorTest(!1);const v=E!==this.type;v&&y.traverse(function(P){P.material&&(Array.isArray(P.material)?P.material.forEach(W=>W.needsUpdate=!0):P.material.needsUpdate=!0)});for(let P=0,W=w.length;P<W;P++){const H=w[P],O=H.shadow;if(O===void 0){KA("WebGLShadowMap:",H,"has no shadow.");continue}if(O.autoUpdate===!1&&O.needsUpdate===!1)continue;g.copy(O.mapSize);const z=O.getFrameExtents();if(g.multiply(z),I.copy(O.mapSize),(g.x>s||g.y>s)&&(g.x>s&&(I.x=Math.floor(s/z.x),g.x=I.x*z.x,O.mapSize.x=I.x),g.y>s&&(I.y=Math.floor(s/z.y),g.y=I.y*z.y,O.mapSize.y=I.y)),O.map===null||v===!0){if(O.map!==null&&(O.map.depthTexture!==null&&(O.map.depthTexture.dispose(),O.map.depthTexture=null),O.map.dispose()),this.type===dC){if(H.isPointLight){KA("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}O.map=new di(g.x,g.y,{format:xI,type:vi,minFilter:et,magFilter:et,generateMipmaps:!1}),O.map.texture.name=H.name+".shadowMap",O.map.depthTexture=new NC(g.x,g.y,Ei),O.map.depthTexture.name=H.name+".shadowMapDepth",O.map.depthTexture.format=Ki,O.map.depthTexture.compareFunction=null,O.map.depthTexture.minFilter=At,O.map.depthTexture.magFilter=At}else{H.isPointLight?(O.map=new vc(g.x),O.map.depthTexture=new B2(g.x,Bi)):(O.map=new di(g.x,g.y),O.map.depthTexture=new NC(g.x,g.y,Bi)),O.map.depthTexture.name=H.name+".shadowMap",O.map.depthTexture.format=Ki;const QA=i.state.buffers.depth.getReversed();this.type===vo?(O.map.depthTexture.compareFunction=QA?hQ:dQ,O.map.depthTexture.minFilter=et,O.map.depthTexture.magFilter=et):(O.map.depthTexture.compareFunction=null,O.map.depthTexture.minFilter=At,O.map.depthTexture.magFilter=At)}O.camera.updateProjectionMatrix()}const lA=O.map.isWebGLCubeRenderTarget?6:1;for(let QA=0;QA<lA;QA++){if(O.map.isWebGLCubeRenderTarget)i.setRenderTarget(O.map,QA),i.clear();else{QA===0&&(i.setRenderTarget(O.map),i.clear());const uA=O.getViewport(QA);C.set(I.x*uA.x,I.y*uA.y,I.x*uA.z,I.y*uA.w),U.viewport(C)}if(H.isPointLight){const uA=O.camera,TA=O.matrix,YA=H.distance||uA.far;YA!==uA.far&&(uA.far=YA,uA.updateProjectionMatrix()),RC.setFromMatrixPosition(H.matrixWorld),uA.position.copy(RC),er.copy(uA.position),er.add(lm[QA]),uA.up.copy(xm[QA]),uA.lookAt(er),uA.updateMatrixWorld(),TA.makeTranslation(-RC.x,-RC.y,-RC.z),dd.multiplyMatrices(uA.projectionMatrix,uA.matrixWorldInverse),O._frustum.setFromProjectionMatrix(dd,uA.coordinateSystem,uA.reversedDepth)}else O.updateMatrices(H);t=O.getFrustum(),x(y,S,O.camera,H,this.type)}O.isPointLightShadow!==!0&&this.type===dC&&u(O,S),O.needsUpdate=!1}E=this.type,d.needsUpdate=!1,i.setRenderTarget(l,p,N)};function u(w,y){const S=A.update(c);r.defines.VSM_SAMPLES!==w.blurSamples&&(r.defines.VSM_SAMPLES=w.blurSamples,B.defines.VSM_SAMPLES=w.blurSamples,r.needsUpdate=!0,B.needsUpdate=!0),w.mapPass===null&&(w.mapPass=new di(g.x,g.y,{format:xI,type:vi})),r.uniforms.shadow_pass.value=w.map.depthTexture,r.uniforms.resolution.value=w.mapSize,r.uniforms.radius.value=w.radius,i.setRenderTarget(w.mapPass),i.clear(),i.renderBufferDirect(y,null,S,r,c,null),B.uniforms.shadow_pass.value=w.mapPass.texture,B.uniforms.resolution.value=w.mapSize,B.uniforms.radius.value=w.radius,i.setRenderTarget(w.map),i.clear(),i.renderBufferDirect(y,null,S,B,c,null)}function _(w,y,S,l){let p=null;const N=S.isPointLight===!0?w.customDistanceMaterial:w.customDepthMaterial;if(N!==void 0)p=N;else if(p=S.isPointLight===!0?n:o,i.localClippingEnabled&&y.clipShadows===!0&&Array.isArray(y.clippingPlanes)&&y.clippingPlanes.length!==0||y.displacementMap&&y.displacementScale!==0||y.alphaMap&&y.alphaTest>0||y.map&&y.alphaTest>0||y.alphaToCoverage===!0){const U=p.uuid,v=y.uuid;let P=a[U];P===void 0&&(P={},a[U]=P);let W=P[v];W===void 0&&(W=p.clone(),P[v]=W,y.addEventListener("dispose",D)),p=W}if(p.visible=y.visible,p.wireframe=y.wireframe,l===dC?p.side=y.shadowSide!==null?y.shadowSide:y.side:p.side=y.shadowSide!==null?y.shadowSide:Q[y.side],p.alphaMap=y.alphaMap,p.alphaTest=y.alphaToCoverage===!0?.5:y.alphaTest,p.map=y.map,p.clipShadows=y.clipShadows,p.clippingPlanes=y.clippingPlanes,p.clipIntersection=y.clipIntersection,p.displacementMap=y.displacementMap,p.displacementScale=y.displacementScale,p.displacementBias=y.displacementBias,p.wireframeLinewidth=y.wireframeLinewidth,p.linewidth=y.linewidth,S.isPointLight===!0&&p.isMeshDistanceMaterial===!0){const U=i.properties.get(p);U.light=S}return p}function x(w,y,S,l,p){if(w.visible===!1)return;if(w.layers.test(y.layers)&&(w.isMesh||w.isLine||w.isPoints)&&(w.castShadow||w.receiveShadow&&p===dC)&&(!w.frustumCulled||t.intersectsObject(w))){w.modelViewMatrix.multiplyMatrices(S.matrixWorldInverse,w.matrixWorld);const v=A.update(w),P=w.material;if(Array.isArray(P)){const W=v.groups;for(let H=0,O=W.length;H<O;H++){const z=W[H],lA=P[z.materialIndex];if(lA&&lA.visible){const QA=_(w,lA,l,p);w.onBeforeShadow(i,w,y,S,v,QA,z),i.renderBufferDirect(S,null,v,QA,w,z),w.onAfterShadow(i,w,y,S,v,QA,z)}}}else if(P.visible){const W=_(w,P,l,p);w.onBeforeShadow(i,w,y,S,v,W,null),i.renderBufferDirect(S,null,v,W,w,null),w.onAfterShadow(i,w,y,S,v,W,null)}}const U=w.children;for(let v=0,P=U.length;v<P;v++)x(U[v],y,S,l,p)}function D(w){w.target.removeEventListener("dispose",D);for(const S in a){const l=a[S],p=w.target.uuid;p in l&&(l[p].dispose(),delete l[p])}}}const fm={[us]:fs,[Ds]:ws,[_s]:ms,[hI]:ps,[fs]:us,[ws]:Ds,[ms]:_s,[ps]:hI};function Dm(i,A){function e(){let M=!1;const fA=new ve;let nA=null;const DA=new ve(0,0,0,0);return{setMask:function(IA){nA!==IA&&!M&&(i.colorMask(IA,IA,IA,IA),nA=IA)},setLocked:function(IA){M=IA},setClear:function(IA,eA,rA,JA,me){me===!0&&(IA*=JA,eA*=JA,rA*=JA),fA.set(IA,eA,rA,JA),DA.equals(fA)===!1&&(i.clearColor(IA,eA,rA,JA),DA.copy(fA))},reset:function(){M=!1,nA=null,DA.set(-1,0,0,0)}}}function t(){let M=!1,fA=!1,nA=null,DA=null,IA=null;return{setReversed:function(eA){if(fA!==eA){const rA=A.get("EXT_clip_control");eA?rA.clipControlEXT(rA.LOWER_LEFT_EXT,rA.ZERO_TO_ONE_EXT):rA.clipControlEXT(rA.LOWER_LEFT_EXT,rA.NEGATIVE_ONE_TO_ONE_EXT),fA=eA;const JA=IA;IA=null,this.setClear(JA)}},getReversed:function(){return fA},setTest:function(eA){eA?gA(i.DEPTH_TEST):wA(i.DEPTH_TEST)},setMask:function(eA){nA!==eA&&!M&&(i.depthMask(eA),nA=eA)},setFunc:function(eA){if(fA&&(eA=fm[eA]),DA!==eA){switch(eA){case us:i.depthFunc(i.NEVER);break;case fs:i.depthFunc(i.ALWAYS);break;case Ds:i.depthFunc(i.LESS);break;case hI:i.depthFunc(i.LEQUAL);break;case _s:i.depthFunc(i.EQUAL);break;case ps:i.depthFunc(i.GEQUAL);break;case ws:i.depthFunc(i.GREATER);break;case ms:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}DA=eA}},setLocked:function(eA){M=eA},setClear:function(eA){IA!==eA&&(fA&&(eA=1-eA),i.clearDepth(eA),IA=eA)},reset:function(){M=!1,nA=null,DA=null,IA=null,fA=!1}}}function g(){let M=!1,fA=null,nA=null,DA=null,IA=null,eA=null,rA=null,JA=null,me=null;return{setTest:function(he){M||(he?gA(i.STENCIL_TEST):wA(i.STENCIL_TEST))},setMask:function(he){fA!==he&&!M&&(i.stencilMask(he),fA=he)},setFunc:function(he,Di,Wi){(nA!==he||DA!==Di||IA!==Wi)&&(i.stencilFunc(he,Di,Wi),nA=he,DA=Di,IA=Wi)},setOp:function(he,Di,Wi){(eA!==he||rA!==Di||JA!==Wi)&&(i.stencilOp(he,Di,Wi),eA=he,rA=Di,JA=Wi)},setLocked:function(he){M=he},setClear:function(he){me!==he&&(i.clearStencil(he),me=he)},reset:function(){M=!1,fA=null,nA=null,DA=null,IA=null,eA=null,rA=null,JA=null,me=null}}}const I=new e,C=new t,o=new g,n=new WeakMap,a=new WeakMap;let s={},Q={},r=new WeakMap,B=[],h=null,c=!1,d=null,E=null,u=null,_=null,x=null,D=null,w=null,y=new Ie(0,0,0),S=0,l=!1,p=null,N=null,U=null,v=null,P=null;const W=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let H=!1,O=0;const z=i.getParameter(i.VERSION);z.indexOf("WebGL")!==-1?(O=parseFloat(/^WebGL (\d)/.exec(z)[1]),H=O>=1):z.indexOf("OpenGL ES")!==-1&&(O=parseFloat(/^OpenGL ES (\d)/.exec(z)[1]),H=O>=2);let lA=null,QA={};const uA=i.getParameter(i.SCISSOR_BOX),TA=i.getParameter(i.VIEWPORT),YA=new ve().fromArray(uA),Ne=new ve().fromArray(TA);function ue(M,fA,nA,DA){const IA=new Uint8Array(4),eA=i.createTexture();i.bindTexture(M,eA),i.texParameteri(M,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(M,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let rA=0;rA<nA;rA++)M===i.TEXTURE_3D||M===i.TEXTURE_2D_ARRAY?i.texImage3D(fA,0,i.RGBA,1,1,DA,0,i.RGBA,i.UNSIGNED_BYTE,IA):i.texImage2D(fA+rA,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,IA);return eA}const Z={};Z[i.TEXTURE_2D]=ue(i.TEXTURE_2D,i.TEXTURE_2D,1),Z[i.TEXTURE_CUBE_MAP]=ue(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),Z[i.TEXTURE_2D_ARRAY]=ue(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),Z[i.TEXTURE_3D]=ue(i.TEXTURE_3D,i.TEXTURE_3D,1,1),I.setClear(0,0,0,1),C.setClear(1),o.setClear(0),gA(i.DEPTH_TEST),C.setFunc(hI),jA(!1),qe(TE),gA(i.CULL_FACE),de(Ui);function gA(M){s[M]!==!0&&(i.enable(M),s[M]=!0)}function wA(M){s[M]!==!1&&(i.disable(M),s[M]=!1)}function HA(M,fA){return Q[M]!==fA?(i.bindFramebuffer(M,fA),Q[M]=fA,M===i.DRAW_FRAMEBUFFER&&(Q[i.FRAMEBUFFER]=fA),M===i.FRAMEBUFFER&&(Q[i.DRAW_FRAMEBUFFER]=fA),!0):!1}function bA(M,fA){let nA=B,DA=!1;if(M){nA=r.get(fA),nA===void 0&&(nA=[],r.set(fA,nA));const IA=M.textures;if(nA.length!==IA.length||nA[0]!==i.COLOR_ATTACHMENT0){for(let eA=0,rA=IA.length;eA<rA;eA++)nA[eA]=i.COLOR_ATTACHMENT0+eA;nA.length=IA.length,DA=!0}}else nA[0]!==i.BACK&&(nA[0]=i.BACK,DA=!0);DA&&i.drawBuffers(nA)}function se(M){return h!==M?(i.useProgram(M),h=M,!0):!1}const ze={[Ug]:i.FUNC_ADD,[CD]:i.FUNC_SUBTRACT,[oD]:i.FUNC_REVERSE_SUBTRACT};ze[nD]=i.MIN,ze[aD]=i.MAX;const ne={[sD]:i.ZERO,[QD]:i.ONE,[rD]:i.SRC_COLOR,[ls]:i.SRC_ALPHA,[lD]:i.SRC_ALPHA_SATURATE,[dD]:i.DST_COLOR,[ED]:i.DST_ALPHA,[BD]:i.ONE_MINUS_SRC_COLOR,[xs]:i.ONE_MINUS_SRC_ALPHA,[hD]:i.ONE_MINUS_DST_COLOR,[cD]:i.ONE_MINUS_DST_ALPHA,[xD]:i.CONSTANT_COLOR,[uD]:i.ONE_MINUS_CONSTANT_COLOR,[fD]:i.CONSTANT_ALPHA,[DD]:i.ONE_MINUS_CONSTANT_ALPHA};function de(M,fA,nA,DA,IA,eA,rA,JA,me,he){if(M===Ui){c===!0&&(wA(i.BLEND),c=!1);return}if(c===!1&&(gA(i.BLEND),c=!0),M!==ID){if(M!==d||he!==l){if((E!==Ug||x!==Ug)&&(i.blendEquation(i.FUNC_ADD),E=Ug,x=Ug),he)switch(M){case dI:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case hs:i.blendFunc(i.ONE,i.ONE);break;case qE:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case HE:i.blendFuncSeparate(i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ZERO,i.ONE);break;default:ae("WebGLState: Invalid blending: ",M);break}else switch(M){case dI:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case hs:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE,i.ONE,i.ONE);break;case qE:ae("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case HE:ae("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:ae("WebGLState: Invalid blending: ",M);break}u=null,_=null,D=null,w=null,y.set(0,0,0),S=0,d=M,l=he}return}IA=IA||fA,eA=eA||nA,rA=rA||DA,(fA!==E||IA!==x)&&(i.blendEquationSeparate(ze[fA],ze[IA]),E=fA,x=IA),(nA!==u||DA!==_||eA!==D||rA!==w)&&(i.blendFuncSeparate(ne[nA],ne[DA],ne[eA],ne[rA]),u=nA,_=DA,D=eA,w=rA),(JA.equals(y)===!1||me!==S)&&(i.blendColor(JA.r,JA.g,JA.b,me),y.copy(JA),S=me),d=M,l=!1}function _e(M,fA){M.side===Fi?wA(i.CULL_FACE):gA(i.CULL_FACE);let nA=M.side===It;fA&&(nA=!nA),jA(nA),M.blending===dI&&M.transparent===!1?de(Ui):de(M.blending,M.blendEquation,M.blendSrc,M.blendDst,M.blendEquationAlpha,M.blendSrcAlpha,M.blendDstAlpha,M.blendColor,M.blendAlpha,M.premultipliedAlpha),C.setFunc(M.depthFunc),C.setTest(M.depthTest),C.setMask(M.depthWrite),I.setMask(M.colorWrite);const DA=M.stencilWrite;o.setTest(DA),DA&&(o.setMask(M.stencilWriteMask),o.setFunc(M.stencilFunc,M.stencilRef,M.stencilFuncMask),o.setOp(M.stencilFail,M.stencilZFail,M.stencilZPass)),He(M.polygonOffset,M.polygonOffsetFactor,M.polygonOffsetUnits),M.alphaToCoverage===!0?gA(i.SAMPLE_ALPHA_TO_COVERAGE):wA(i.SAMPLE_ALPHA_TO_COVERAGE)}function jA(M){p!==M&&(M?i.frontFace(i.CW):i.frontFace(i.CCW),p=M)}function qe(M){M!==tD?(gA(i.CULL_FACE),M!==N&&(M===TE?i.cullFace(i.BACK):M===iD?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):wA(i.CULL_FACE),N=M}function R(M){M!==U&&(H&&i.lineWidth(M),U=M)}function He(M,fA,nA){M?(gA(i.POLYGON_OFFSET_FILL),(v!==fA||P!==nA)&&(i.polygonOffset(fA,nA),v=fA,P=nA)):wA(i.POLYGON_OFFSET_FILL)}function Ee(M){M?gA(i.SCISSOR_TEST):wA(i.SCISSOR_TEST)}function we(M){M===void 0&&(M=i.TEXTURE0+W-1),lA!==M&&(i.activeTexture(M),lA=M)}function kA(M,fA,nA){nA===void 0&&(lA===null?nA=i.TEXTURE0+W-1:nA=lA);let DA=QA[nA];DA===void 0&&(DA={type:void 0,texture:void 0},QA[nA]=DA),(DA.type!==M||DA.texture!==fA)&&(lA!==nA&&(i.activeTexture(nA),lA=nA),i.bindTexture(M,fA||Z[M]),DA.type=M,DA.texture=fA)}function b(){const M=QA[lA];M!==void 0&&M.type!==void 0&&(i.bindTexture(M.type,null),M.type=void 0,M.texture=void 0)}function f(){try{i.compressedTexImage2D(...arguments)}catch(M){ae("WebGLState:",M)}}function F(){try{i.compressedTexImage3D(...arguments)}catch(M){ae("WebGLState:",M)}}function X(){try{i.texSubImage2D(...arguments)}catch(M){ae("WebGLState:",M)}}function tA(){try{i.texSubImage3D(...arguments)}catch(M){ae("WebGLState:",M)}}function j(){try{i.compressedTexSubImage2D(...arguments)}catch(M){ae("WebGLState:",M)}}function RA(){try{i.compressedTexSubImage3D(...arguments)}catch(M){ae("WebGLState:",M)}}function BA(){try{i.texStorage2D(...arguments)}catch(M){ae("WebGLState:",M)}}function NA(){try{i.texStorage3D(...arguments)}catch(M){ae("WebGLState:",M)}}function LA(){try{i.texImage2D(...arguments)}catch(M){ae("WebGLState:",M)}}function CA(){try{i.texImage3D(...arguments)}catch(M){ae("WebGLState:",M)}}function cA(M){YA.equals(M)===!1&&(i.scissor(M.x,M.y,M.z,M.w),YA.copy(M))}function yA(M){Ne.equals(M)===!1&&(i.viewport(M.x,M.y,M.z,M.w),Ne.copy(M))}function SA(M,fA){let nA=a.get(fA);nA===void 0&&(nA=new WeakMap,a.set(fA,nA));let DA=nA.get(M);DA===void 0&&(DA=i.getUniformBlockIndex(fA,M.name),nA.set(M,DA))}function EA(M,fA){const DA=a.get(fA).get(M);n.get(fA)!==DA&&(i.uniformBlockBinding(fA,DA,M.__bindingPointIndex),n.set(fA,DA))}function WA(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),C.setReversed(!1),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),s={},lA=null,QA={},Q={},r=new WeakMap,B=[],h=null,c=!1,d=null,E=null,u=null,_=null,x=null,D=null,w=null,y=new Ie(0,0,0),S=0,l=!1,p=null,N=null,U=null,v=null,P=null,YA.set(0,0,i.canvas.width,i.canvas.height),Ne.set(0,0,i.canvas.width,i.canvas.height),I.reset(),C.reset(),o.reset()}return{buffers:{color:I,depth:C,stencil:o},enable:gA,disable:wA,bindFramebuffer:HA,drawBuffers:bA,useProgram:se,setBlending:de,setMaterial:_e,setFlipSided:jA,setCullFace:qe,setLineWidth:R,setPolygonOffset:He,setScissorTest:Ee,activeTexture:we,bindTexture:kA,unbindTexture:b,compressedTexImage2D:f,compressedTexImage3D:F,texImage2D:LA,texImage3D:CA,updateUBOMapping:SA,uniformBlockBinding:EA,texStorage2D:BA,texStorage3D:NA,texSubImage2D:X,texSubImage3D:tA,compressedTexSubImage2D:j,compressedTexSubImage3D:RA,scissor:cA,viewport:yA,reset:WA}}function _m(i,A,e,t,g,I,C){const o=A.has("WEBGL_multisampled_render_to_texture")?A.get("WEBGL_multisampled_render_to_texture"):null,n=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),a=new Be,s=new WeakMap;let Q;const r=new WeakMap;let B=!1;try{B=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function h(b,f){return B?new OffscreenCanvas(b,f):Vo("canvas")}function c(b,f,F){let X=1;const tA=kA(b);if((tA.width>F||tA.height>F)&&(X=F/Math.max(tA.width,tA.height)),X<1)if(typeof HTMLImageElement<"u"&&b instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&b instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&b instanceof ImageBitmap||typeof VideoFrame<"u"&&b instanceof VideoFrame){const j=Math.floor(X*tA.width),RA=Math.floor(X*tA.height);Q===void 0&&(Q=h(j,RA));const BA=f?h(j,RA):Q;return BA.width=j,BA.height=RA,BA.getContext("2d").drawImage(b,0,0,j,RA),KA("WebGLRenderer: Texture has been resized from ("+tA.width+"x"+tA.height+") to ("+j+"x"+RA+")."),BA}else return"data"in b&&KA("WebGLRenderer: Image in DataTexture is too big ("+tA.width+"x"+tA.height+")."),b;return b}function d(b){return b.generateMipmaps}function E(b){i.generateMipmap(b)}function u(b){return b.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:b.isWebGL3DRenderTarget?i.TEXTURE_3D:b.isWebGLArrayRenderTarget||b.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function _(b,f,F,X,tA=!1){if(b!==null){if(i[b]!==void 0)return i[b];KA("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+b+"'")}let j=f;if(f===i.RED&&(F===i.FLOAT&&(j=i.R32F),F===i.HALF_FLOAT&&(j=i.R16F),F===i.UNSIGNED_BYTE&&(j=i.R8)),f===i.RED_INTEGER&&(F===i.UNSIGNED_BYTE&&(j=i.R8UI),F===i.UNSIGNED_SHORT&&(j=i.R16UI),F===i.UNSIGNED_INT&&(j=i.R32UI),F===i.BYTE&&(j=i.R8I),F===i.SHORT&&(j=i.R16I),F===i.INT&&(j=i.R32I)),f===i.RG&&(F===i.FLOAT&&(j=i.RG32F),F===i.HALF_FLOAT&&(j=i.RG16F),F===i.UNSIGNED_BYTE&&(j=i.RG8)),f===i.RG_INTEGER&&(F===i.UNSIGNED_BYTE&&(j=i.RG8UI),F===i.UNSIGNED_SHORT&&(j=i.RG16UI),F===i.UNSIGNED_INT&&(j=i.RG32UI),F===i.BYTE&&(j=i.RG8I),F===i.SHORT&&(j=i.RG16I),F===i.INT&&(j=i.RG32I)),f===i.RGB_INTEGER&&(F===i.UNSIGNED_BYTE&&(j=i.RGB8UI),F===i.UNSIGNED_SHORT&&(j=i.RGB16UI),F===i.UNSIGNED_INT&&(j=i.RGB32UI),F===i.BYTE&&(j=i.RGB8I),F===i.SHORT&&(j=i.RGB16I),F===i.INT&&(j=i.RGB32I)),f===i.RGBA_INTEGER&&(F===i.UNSIGNED_BYTE&&(j=i.RGBA8UI),F===i.UNSIGNED_SHORT&&(j=i.RGBA16UI),F===i.UNSIGNED_INT&&(j=i.RGBA32UI),F===i.BYTE&&(j=i.RGBA8I),F===i.SHORT&&(j=i.RGBA16I),F===i.INT&&(j=i.RGBA32I)),f===i.RGB&&(F===i.UNSIGNED_INT_5_9_9_9_REV&&(j=i.RGB9_E5),F===i.UNSIGNED_INT_10F_11F_11F_REV&&(j=i.R11F_G11F_B10F)),f===i.RGBA){const RA=tA?Po:oe.getTransfer(X);F===i.FLOAT&&(j=i.RGBA32F),F===i.HALF_FLOAT&&(j=i.RGBA16F),F===i.UNSIGNED_BYTE&&(j=RA===ce?i.SRGB8_ALPHA8:i.RGBA8),F===i.UNSIGNED_SHORT_4_4_4_4&&(j=i.RGBA4),F===i.UNSIGNED_SHORT_5_5_5_1&&(j=i.RGB5_A1)}return(j===i.R16F||j===i.R32F||j===i.RG16F||j===i.RG32F||j===i.RGBA16F||j===i.RGBA32F)&&A.get("EXT_color_buffer_float"),j}function x(b,f){let F;return b?f===null||f===Bi||f===lC?F=i.DEPTH24_STENCIL8:f===Ei?F=i.DEPTH32F_STENCIL8:f===hC&&(F=i.DEPTH24_STENCIL8,KA("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):f===null||f===Bi||f===lC?F=i.DEPTH_COMPONENT24:f===Ei?F=i.DEPTH_COMPONENT32F:f===hC&&(F=i.DEPTH_COMPONENT16),F}function D(b,f){return d(b)===!0||b.isFramebufferTexture&&b.minFilter!==At&&b.minFilter!==et?Math.log2(Math.max(f.width,f.height))+1:b.mipmaps!==void 0&&b.mipmaps.length>0?b.mipmaps.length:b.isCompressedTexture&&Array.isArray(b.image)?f.mipmaps.length:1}function w(b){const f=b.target;f.removeEventListener("dispose",w),S(f),f.isVideoTexture&&s.delete(f)}function y(b){const f=b.target;f.removeEventListener("dispose",y),p(f)}function S(b){const f=t.get(b);if(f.__webglInit===void 0)return;const F=b.source,X=r.get(F);if(X){const tA=X[f.__cacheKey];tA.usedTimes--,tA.usedTimes===0&&l(b),Object.keys(X).length===0&&r.delete(F)}t.remove(b)}function l(b){const f=t.get(b);i.deleteTexture(f.__webglTexture);const F=b.source,X=r.get(F);delete X[f.__cacheKey],C.memory.textures--}function p(b){const f=t.get(b);if(b.depthTexture&&(b.depthTexture.dispose(),t.remove(b.depthTexture)),b.isWebGLCubeRenderTarget)for(let X=0;X<6;X++){if(Array.isArray(f.__webglFramebuffer[X]))for(let tA=0;tA<f.__webglFramebuffer[X].length;tA++)i.deleteFramebuffer(f.__webglFramebuffer[X][tA]);else i.deleteFramebuffer(f.__webglFramebuffer[X]);f.__webglDepthbuffer&&i.deleteRenderbuffer(f.__webglDepthbuffer[X])}else{if(Array.isArray(f.__webglFramebuffer))for(let X=0;X<f.__webglFramebuffer.length;X++)i.deleteFramebuffer(f.__webglFramebuffer[X]);else i.deleteFramebuffer(f.__webglFramebuffer);if(f.__webglDepthbuffer&&i.deleteRenderbuffer(f.__webglDepthbuffer),f.__webglMultisampledFramebuffer&&i.deleteFramebuffer(f.__webglMultisampledFramebuffer),f.__webglColorRenderbuffer)for(let X=0;X<f.__webglColorRenderbuffer.length;X++)f.__webglColorRenderbuffer[X]&&i.deleteRenderbuffer(f.__webglColorRenderbuffer[X]);f.__webglDepthRenderbuffer&&i.deleteRenderbuffer(f.__webglDepthRenderbuffer)}const F=b.textures;for(let X=0,tA=F.length;X<tA;X++){const j=t.get(F[X]);j.__webglTexture&&(i.deleteTexture(j.__webglTexture),C.memory.textures--),t.remove(F[X])}t.remove(b)}let N=0;function U(){N=0}function v(){const b=N;return b>=g.maxTextures&&KA("WebGLTextures: Trying to use "+b+" texture units while this GPU supports only "+g.maxTextures),N+=1,b}function P(b){const f=[];return f.push(b.wrapS),f.push(b.wrapT),f.push(b.wrapR||0),f.push(b.magFilter),f.push(b.minFilter),f.push(b.anisotropy),f.push(b.internalFormat),f.push(b.format),f.push(b.type),f.push(b.generateMipmaps),f.push(b.premultiplyAlpha),f.push(b.flipY),f.push(b.unpackAlignment),f.push(b.colorSpace),f.join()}function W(b,f){const F=t.get(b);if(b.isVideoTexture&&Ee(b),b.isRenderTargetTexture===!1&&b.isExternalTexture!==!0&&b.version>0&&F.__version!==b.version){const X=b.image;if(X===null)KA("WebGLRenderer: Texture marked for update but no image data found.");else if(X.complete===!1)KA("WebGLRenderer: Texture marked for update but image is incomplete");else{Z(F,b,f);return}}else b.isExternalTexture&&(F.__webglTexture=b.sourceTexture?b.sourceTexture:null);e.bindTexture(i.TEXTURE_2D,F.__webglTexture,i.TEXTURE0+f)}function H(b,f){const F=t.get(b);if(b.isRenderTargetTexture===!1&&b.version>0&&F.__version!==b.version){Z(F,b,f);return}else b.isExternalTexture&&(F.__webglTexture=b.sourceTexture?b.sourceTexture:null);e.bindTexture(i.TEXTURE_2D_ARRAY,F.__webglTexture,i.TEXTURE0+f)}function O(b,f){const F=t.get(b);if(b.isRenderTargetTexture===!1&&b.version>0&&F.__version!==b.version){Z(F,b,f);return}e.bindTexture(i.TEXTURE_3D,F.__webglTexture,i.TEXTURE0+f)}function z(b,f){const F=t.get(b);if(b.isCubeDepthTexture!==!0&&b.version>0&&F.__version!==b.version){gA(F,b,f);return}e.bindTexture(i.TEXTURE_CUBE_MAP,F.__webglTexture,i.TEXTURE0+f)}const lA={[Ns]:i.REPEAT,[Li]:i.CLAMP_TO_EDGE,[ks]:i.MIRRORED_REPEAT},QA={[At]:i.NEAREST,[wD]:i.NEAREST_MIPMAP_NEAREST,[Jo]:i.NEAREST_MIPMAP_LINEAR,[et]:i.LINEAR,[Ss]:i.LINEAR_MIPMAP_NEAREST,[vg]:i.LINEAR_MIPMAP_LINEAR},uA={[ND]:i.NEVER,[MD]:i.ALWAYS,[kD]:i.LESS,[dQ]:i.LEQUAL,[SD]:i.EQUAL,[hQ]:i.GEQUAL,[RD]:i.GREATER,[GD]:i.NOTEQUAL};function TA(b,f){if(f.type===Ei&&A.has("OES_texture_float_linear")===!1&&(f.magFilter===et||f.magFilter===Ss||f.magFilter===Jo||f.magFilter===vg||f.minFilter===et||f.minFilter===Ss||f.minFilter===Jo||f.minFilter===vg)&&KA("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(b,i.TEXTURE_WRAP_S,lA[f.wrapS]),i.texParameteri(b,i.TEXTURE_WRAP_T,lA[f.wrapT]),(b===i.TEXTURE_3D||b===i.TEXTURE_2D_ARRAY)&&i.texParameteri(b,i.TEXTURE_WRAP_R,lA[f.wrapR]),i.texParameteri(b,i.TEXTURE_MAG_FILTER,QA[f.magFilter]),i.texParameteri(b,i.TEXTURE_MIN_FILTER,QA[f.minFilter]),f.compareFunction&&(i.texParameteri(b,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(b,i.TEXTURE_COMPARE_FUNC,uA[f.compareFunction])),A.has("EXT_texture_filter_anisotropic")===!0){if(f.magFilter===At||f.minFilter!==Jo&&f.minFilter!==vg||f.type===Ei&&A.has("OES_texture_float_linear")===!1)return;if(f.anisotropy>1||t.get(f).__currentAnisotropy){const F=A.get("EXT_texture_filter_anisotropic");i.texParameterf(b,F.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(f.anisotropy,g.getMaxAnisotropy())),t.get(f).__currentAnisotropy=f.anisotropy}}}function YA(b,f){let F=!1;b.__webglInit===void 0&&(b.__webglInit=!0,f.addEventListener("dispose",w));const X=f.source;let tA=r.get(X);tA===void 0&&(tA={},r.set(X,tA));const j=P(f);if(j!==b.__cacheKey){tA[j]===void 0&&(tA[j]={texture:i.createTexture(),usedTimes:0},C.memory.textures++,F=!0),tA[j].usedTimes++;const RA=tA[b.__cacheKey];RA!==void 0&&(tA[b.__cacheKey].usedTimes--,RA.usedTimes===0&&l(f)),b.__cacheKey=j,b.__webglTexture=tA[j].texture}return F}function Ne(b,f,F){return Math.floor(Math.floor(b/F)/f)}function ue(b,f,F,X){const j=b.updateRanges;if(j.length===0)e.texSubImage2D(i.TEXTURE_2D,0,0,0,f.width,f.height,F,X,f.data);else{j.sort((CA,cA)=>CA.start-cA.start);let RA=0;for(let CA=1;CA<j.length;CA++){const cA=j[RA],yA=j[CA],SA=cA.start+cA.count,EA=Ne(yA.start,f.width,4),WA=Ne(cA.start,f.width,4);yA.start<=SA+1&&EA===WA&&Ne(yA.start+yA.count-1,f.width,4)===EA?cA.count=Math.max(cA.count,yA.start+yA.count-cA.start):(++RA,j[RA]=yA)}j.length=RA+1;const BA=i.getParameter(i.UNPACK_ROW_LENGTH),NA=i.getParameter(i.UNPACK_SKIP_PIXELS),LA=i.getParameter(i.UNPACK_SKIP_ROWS);i.pixelStorei(i.UNPACK_ROW_LENGTH,f.width);for(let CA=0,cA=j.length;CA<cA;CA++){const yA=j[CA],SA=Math.floor(yA.start/4),EA=Math.ceil(yA.count/4),WA=SA%f.width,M=Math.floor(SA/f.width),fA=EA,nA=1;i.pixelStorei(i.UNPACK_SKIP_PIXELS,WA),i.pixelStorei(i.UNPACK_SKIP_ROWS,M),e.texSubImage2D(i.TEXTURE_2D,0,WA,M,fA,nA,F,X,f.data)}b.clearUpdateRanges(),i.pixelStorei(i.UNPACK_ROW_LENGTH,BA),i.pixelStorei(i.UNPACK_SKIP_PIXELS,NA),i.pixelStorei(i.UNPACK_SKIP_ROWS,LA)}}function Z(b,f,F){let X=i.TEXTURE_2D;(f.isDataArrayTexture||f.isCompressedArrayTexture)&&(X=i.TEXTURE_2D_ARRAY),f.isData3DTexture&&(X=i.TEXTURE_3D);const tA=YA(b,f),j=f.source;e.bindTexture(X,b.__webglTexture,i.TEXTURE0+F);const RA=t.get(j);if(j.version!==RA.__version||tA===!0){e.activeTexture(i.TEXTURE0+F);const BA=oe.getPrimaries(oe.workingColorSpace),NA=f.colorSpace===rg?null:oe.getPrimaries(f.colorSpace),LA=f.colorSpace===rg||BA===NA?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,f.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,f.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,f.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,LA);let CA=c(f.image,!1,g.maxTextureSize);CA=we(f,CA);const cA=I.convert(f.format,f.colorSpace),yA=I.convert(f.type);let SA=_(f.internalFormat,cA,yA,f.colorSpace,f.isVideoTexture);TA(X,f);let EA;const WA=f.mipmaps,M=f.isVideoTexture!==!0,fA=RA.__version===void 0||tA===!0,nA=j.dataReady,DA=D(f,CA);if(f.isDepthTexture)SA=x(f.format===Kg,f.type),fA&&(M?e.texStorage2D(i.TEXTURE_2D,1,SA,CA.width,CA.height):e.texImage2D(i.TEXTURE_2D,0,SA,CA.width,CA.height,0,cA,yA,null));else if(f.isDataTexture)if(WA.length>0){M&&fA&&e.texStorage2D(i.TEXTURE_2D,DA,SA,WA[0].width,WA[0].height);for(let IA=0,eA=WA.length;IA<eA;IA++)EA=WA[IA],M?nA&&e.texSubImage2D(i.TEXTURE_2D,IA,0,0,EA.width,EA.height,cA,yA,EA.data):e.texImage2D(i.TEXTURE_2D,IA,SA,EA.width,EA.height,0,cA,yA,EA.data);f.generateMipmaps=!1}else M?(fA&&e.texStorage2D(i.TEXTURE_2D,DA,SA,CA.width,CA.height),nA&&ue(f,CA,cA,yA)):e.texImage2D(i.TEXTURE_2D,0,SA,CA.width,CA.height,0,cA,yA,CA.data);else if(f.isCompressedTexture)if(f.isCompressedArrayTexture){M&&fA&&e.texStorage3D(i.TEXTURE_2D_ARRAY,DA,SA,WA[0].width,WA[0].height,CA.depth);for(let IA=0,eA=WA.length;IA<eA;IA++)if(EA=WA[IA],f.format!==jt)if(cA!==null)if(M){if(nA)if(f.layerUpdates.size>0){const rA=Tc(EA.width,EA.height,f.format,f.type);for(const JA of f.layerUpdates){const me=EA.data.subarray(JA*rA/EA.data.BYTES_PER_ELEMENT,(JA+1)*rA/EA.data.BYTES_PER_ELEMENT);e.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,IA,0,0,JA,EA.width,EA.height,1,cA,me)}f.clearLayerUpdates()}else e.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,IA,0,0,0,EA.width,EA.height,CA.depth,cA,EA.data)}else e.compressedTexImage3D(i.TEXTURE_2D_ARRAY,IA,SA,EA.width,EA.height,CA.depth,0,EA.data,0,0);else KA("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else M?nA&&e.texSubImage3D(i.TEXTURE_2D_ARRAY,IA,0,0,0,EA.width,EA.height,CA.depth,cA,yA,EA.data):e.texImage3D(i.TEXTURE_2D_ARRAY,IA,SA,EA.width,EA.height,CA.depth,0,cA,yA,EA.data)}else{M&&fA&&e.texStorage2D(i.TEXTURE_2D,DA,SA,WA[0].width,WA[0].height);for(let IA=0,eA=WA.length;IA<eA;IA++)EA=WA[IA],f.format!==jt?cA!==null?M?nA&&e.compressedTexSubImage2D(i.TEXTURE_2D,IA,0,0,EA.width,EA.height,cA,EA.data):e.compressedTexImage2D(i.TEXTURE_2D,IA,SA,EA.width,EA.height,0,EA.data):KA("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):M?nA&&e.texSubImage2D(i.TEXTURE_2D,IA,0,0,EA.width,EA.height,cA,yA,EA.data):e.texImage2D(i.TEXTURE_2D,IA,SA,EA.width,EA.height,0,cA,yA,EA.data)}else if(f.isDataArrayTexture)if(M){if(fA&&e.texStorage3D(i.TEXTURE_2D_ARRAY,DA,SA,CA.width,CA.height,CA.depth),nA)if(f.layerUpdates.size>0){const IA=Tc(CA.width,CA.height,f.format,f.type);for(const eA of f.layerUpdates){const rA=CA.data.subarray(eA*IA/CA.data.BYTES_PER_ELEMENT,(eA+1)*IA/CA.data.BYTES_PER_ELEMENT);e.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,eA,CA.width,CA.height,1,cA,yA,rA)}f.clearLayerUpdates()}else e.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,CA.width,CA.height,CA.depth,cA,yA,CA.data)}else e.texImage3D(i.TEXTURE_2D_ARRAY,0,SA,CA.width,CA.height,CA.depth,0,cA,yA,CA.data);else if(f.isData3DTexture)M?(fA&&e.texStorage3D(i.TEXTURE_3D,DA,SA,CA.width,CA.height,CA.depth),nA&&e.texSubImage3D(i.TEXTURE_3D,0,0,0,0,CA.width,CA.height,CA.depth,cA,yA,CA.data)):e.texImage3D(i.TEXTURE_3D,0,SA,CA.width,CA.height,CA.depth,0,cA,yA,CA.data);else if(f.isFramebufferTexture){if(fA)if(M)e.texStorage2D(i.TEXTURE_2D,DA,SA,CA.width,CA.height);else{let IA=CA.width,eA=CA.height;for(let rA=0;rA<DA;rA++)e.texImage2D(i.TEXTURE_2D,rA,SA,IA,eA,0,cA,yA,null),IA>>=1,eA>>=1}}else if(WA.length>0){if(M&&fA){const IA=kA(WA[0]);e.texStorage2D(i.TEXTURE_2D,DA,SA,IA.width,IA.height)}for(let IA=0,eA=WA.length;IA<eA;IA++)EA=WA[IA],M?nA&&e.texSubImage2D(i.TEXTURE_2D,IA,0,0,cA,yA,EA):e.texImage2D(i.TEXTURE_2D,IA,SA,cA,yA,EA);f.generateMipmaps=!1}else if(M){if(fA){const IA=kA(CA);e.texStorage2D(i.TEXTURE_2D,DA,SA,IA.width,IA.height)}nA&&e.texSubImage2D(i.TEXTURE_2D,0,0,0,cA,yA,CA)}else e.texImage2D(i.TEXTURE_2D,0,SA,cA,yA,CA);d(f)&&E(X),RA.__version=j.version,f.onUpdate&&f.onUpdate(f)}b.__version=f.version}function gA(b,f,F){if(f.image.length!==6)return;const X=YA(b,f),tA=f.source;e.bindTexture(i.TEXTURE_CUBE_MAP,b.__webglTexture,i.TEXTURE0+F);const j=t.get(tA);if(tA.version!==j.__version||X===!0){e.activeTexture(i.TEXTURE0+F);const RA=oe.getPrimaries(oe.workingColorSpace),BA=f.colorSpace===rg?null:oe.getPrimaries(f.colorSpace),NA=f.colorSpace===rg||RA===BA?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,f.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,f.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,f.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,NA);const LA=f.isCompressedTexture||f.image[0].isCompressedTexture,CA=f.image[0]&&f.image[0].isDataTexture,cA=[];for(let eA=0;eA<6;eA++)!LA&&!CA?cA[eA]=c(f.image[eA],!0,g.maxCubemapSize):cA[eA]=CA?f.image[eA].image:f.image[eA],cA[eA]=we(f,cA[eA]);const yA=cA[0],SA=I.convert(f.format,f.colorSpace),EA=I.convert(f.type),WA=_(f.internalFormat,SA,EA,f.colorSpace),M=f.isVideoTexture!==!0,fA=j.__version===void 0||X===!0,nA=tA.dataReady;let DA=D(f,yA);TA(i.TEXTURE_CUBE_MAP,f);let IA;if(LA){M&&fA&&e.texStorage2D(i.TEXTURE_CUBE_MAP,DA,WA,yA.width,yA.height);for(let eA=0;eA<6;eA++){IA=cA[eA].mipmaps;for(let rA=0;rA<IA.length;rA++){const JA=IA[rA];f.format!==jt?SA!==null?M?nA&&e.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+eA,rA,0,0,JA.width,JA.height,SA,JA.data):e.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+eA,rA,WA,JA.width,JA.height,0,JA.data):KA("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):M?nA&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+eA,rA,0,0,JA.width,JA.height,SA,EA,JA.data):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+eA,rA,WA,JA.width,JA.height,0,SA,EA,JA.data)}}}else{if(IA=f.mipmaps,M&&fA){IA.length>0&&DA++;const eA=kA(cA[0]);e.texStorage2D(i.TEXTURE_CUBE_MAP,DA,WA,eA.width,eA.height)}for(let eA=0;eA<6;eA++)if(CA){M?nA&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+eA,0,0,0,cA[eA].width,cA[eA].height,SA,EA,cA[eA].data):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+eA,0,WA,cA[eA].width,cA[eA].height,0,SA,EA,cA[eA].data);for(let rA=0;rA<IA.length;rA++){const me=IA[rA].image[eA].image;M?nA&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+eA,rA+1,0,0,me.width,me.height,SA,EA,me.data):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+eA,rA+1,WA,me.width,me.height,0,SA,EA,me.data)}}else{M?nA&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+eA,0,0,0,SA,EA,cA[eA]):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+eA,0,WA,SA,EA,cA[eA]);for(let rA=0;rA<IA.length;rA++){const JA=IA[rA];M?nA&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+eA,rA+1,0,0,SA,EA,JA.image[eA]):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+eA,rA+1,WA,SA,EA,JA.image[eA])}}}d(f)&&E(i.TEXTURE_CUBE_MAP),j.__version=tA.version,f.onUpdate&&f.onUpdate(f)}b.__version=f.version}function wA(b,f,F,X,tA,j){const RA=I.convert(F.format,F.colorSpace),BA=I.convert(F.type),NA=_(F.internalFormat,RA,BA,F.colorSpace),LA=t.get(f),CA=t.get(F);if(CA.__renderTarget=f,!LA.__hasExternalTextures){const cA=Math.max(1,f.width>>j),yA=Math.max(1,f.height>>j);tA===i.TEXTURE_3D||tA===i.TEXTURE_2D_ARRAY?e.texImage3D(tA,j,NA,cA,yA,f.depth,0,RA,BA,null):e.texImage2D(tA,j,NA,cA,yA,0,RA,BA,null)}e.bindFramebuffer(i.FRAMEBUFFER,b),He(f)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,X,tA,CA.__webglTexture,0,R(f)):(tA===i.TEXTURE_2D||tA>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&tA<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,X,tA,CA.__webglTexture,j),e.bindFramebuffer(i.FRAMEBUFFER,null)}function HA(b,f,F){if(i.bindRenderbuffer(i.RENDERBUFFER,b),f.depthBuffer){const X=f.depthTexture,tA=X&&X.isDepthTexture?X.type:null,j=x(f.stencilBuffer,tA),RA=f.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;He(f)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,R(f),j,f.width,f.height):F?i.renderbufferStorageMultisample(i.RENDERBUFFER,R(f),j,f.width,f.height):i.renderbufferStorage(i.RENDERBUFFER,j,f.width,f.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,RA,i.RENDERBUFFER,b)}else{const X=f.textures;for(let tA=0;tA<X.length;tA++){const j=X[tA],RA=I.convert(j.format,j.colorSpace),BA=I.convert(j.type),NA=_(j.internalFormat,RA,BA,j.colorSpace);He(f)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,R(f),NA,f.width,f.height):F?i.renderbufferStorageMultisample(i.RENDERBUFFER,R(f),NA,f.width,f.height):i.renderbufferStorage(i.RENDERBUFFER,NA,f.width,f.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function bA(b,f,F){const X=f.isWebGLCubeRenderTarget===!0;if(e.bindFramebuffer(i.FRAMEBUFFER,b),!(f.depthTexture&&f.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const tA=t.get(f.depthTexture);if(tA.__renderTarget=f,(!tA.__webglTexture||f.depthTexture.image.width!==f.width||f.depthTexture.image.height!==f.height)&&(f.depthTexture.image.width=f.width,f.depthTexture.image.height=f.height,f.depthTexture.needsUpdate=!0),X){if(tA.__webglInit===void 0&&(tA.__webglInit=!0,f.depthTexture.addEventListener("dispose",w)),tA.__webglTexture===void 0){tA.__webglTexture=i.createTexture(),e.bindTexture(i.TEXTURE_CUBE_MAP,tA.__webglTexture),TA(i.TEXTURE_CUBE_MAP,f.depthTexture);const LA=I.convert(f.depthTexture.format),CA=I.convert(f.depthTexture.type);let cA;f.depthTexture.format===Ki?cA=i.DEPTH_COMPONENT24:f.depthTexture.format===Kg&&(cA=i.DEPTH24_STENCIL8);for(let yA=0;yA<6;yA++)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+yA,0,cA,f.width,f.height,0,LA,CA,null)}}else W(f.depthTexture,0);const j=tA.__webglTexture,RA=R(f),BA=X?i.TEXTURE_CUBE_MAP_POSITIVE_X+F:i.TEXTURE_2D,NA=f.depthTexture.format===Kg?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;if(f.depthTexture.format===Ki)He(f)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,NA,BA,j,0,RA):i.framebufferTexture2D(i.FRAMEBUFFER,NA,BA,j,0);else if(f.depthTexture.format===Kg)He(f)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,NA,BA,j,0,RA):i.framebufferTexture2D(i.FRAMEBUFFER,NA,BA,j,0);else throw new Error("Unknown depthTexture format")}function se(b){const f=t.get(b),F=b.isWebGLCubeRenderTarget===!0;if(f.__boundDepthTexture!==b.depthTexture){const X=b.depthTexture;if(f.__depthDisposeCallback&&f.__depthDisposeCallback(),X){const tA=()=>{delete f.__boundDepthTexture,delete f.__depthDisposeCallback,X.removeEventListener("dispose",tA)};X.addEventListener("dispose",tA),f.__depthDisposeCallback=tA}f.__boundDepthTexture=X}if(b.depthTexture&&!f.__autoAllocateDepthBuffer)if(F)for(let X=0;X<6;X++)bA(f.__webglFramebuffer[X],b,X);else{const X=b.texture.mipmaps;X&&X.length>0?bA(f.__webglFramebuffer[0],b,0):bA(f.__webglFramebuffer,b,0)}else if(F){f.__webglDepthbuffer=[];for(let X=0;X<6;X++)if(e.bindFramebuffer(i.FRAMEBUFFER,f.__webglFramebuffer[X]),f.__webglDepthbuffer[X]===void 0)f.__webglDepthbuffer[X]=i.createRenderbuffer(),HA(f.__webglDepthbuffer[X],b,!1);else{const tA=b.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,j=f.__webglDepthbuffer[X];i.bindRenderbuffer(i.RENDERBUFFER,j),i.framebufferRenderbuffer(i.FRAMEBUFFER,tA,i.RENDERBUFFER,j)}}else{const X=b.texture.mipmaps;if(X&&X.length>0?e.bindFramebuffer(i.FRAMEBUFFER,f.__webglFramebuffer[0]):e.bindFramebuffer(i.FRAMEBUFFER,f.__webglFramebuffer),f.__webglDepthbuffer===void 0)f.__webglDepthbuffer=i.createRenderbuffer(),HA(f.__webglDepthbuffer,b,!1);else{const tA=b.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,j=f.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,j),i.framebufferRenderbuffer(i.FRAMEBUFFER,tA,i.RENDERBUFFER,j)}}e.bindFramebuffer(i.FRAMEBUFFER,null)}function ze(b,f,F){const X=t.get(b);f!==void 0&&wA(X.__webglFramebuffer,b,b.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),F!==void 0&&se(b)}function ne(b){const f=b.texture,F=t.get(b),X=t.get(f);b.addEventListener("dispose",y);const tA=b.textures,j=b.isWebGLCubeRenderTarget===!0,RA=tA.length>1;if(RA||(X.__webglTexture===void 0&&(X.__webglTexture=i.createTexture()),X.__version=f.version,C.memory.textures++),j){F.__webglFramebuffer=[];for(let BA=0;BA<6;BA++)if(f.mipmaps&&f.mipmaps.length>0){F.__webglFramebuffer[BA]=[];for(let NA=0;NA<f.mipmaps.length;NA++)F.__webglFramebuffer[BA][NA]=i.createFramebuffer()}else F.__webglFramebuffer[BA]=i.createFramebuffer()}else{if(f.mipmaps&&f.mipmaps.length>0){F.__webglFramebuffer=[];for(let BA=0;BA<f.mipmaps.length;BA++)F.__webglFramebuffer[BA]=i.createFramebuffer()}else F.__webglFramebuffer=i.createFramebuffer();if(RA)for(let BA=0,NA=tA.length;BA<NA;BA++){const LA=t.get(tA[BA]);LA.__webglTexture===void 0&&(LA.__webglTexture=i.createTexture(),C.memory.textures++)}if(b.samples>0&&He(b)===!1){F.__webglMultisampledFramebuffer=i.createFramebuffer(),F.__webglColorRenderbuffer=[],e.bindFramebuffer(i.FRAMEBUFFER,F.__webglMultisampledFramebuffer);for(let BA=0;BA<tA.length;BA++){const NA=tA[BA];F.__webglColorRenderbuffer[BA]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,F.__webglColorRenderbuffer[BA]);const LA=I.convert(NA.format,NA.colorSpace),CA=I.convert(NA.type),cA=_(NA.internalFormat,LA,CA,NA.colorSpace,b.isXRRenderTarget===!0),yA=R(b);i.renderbufferStorageMultisample(i.RENDERBUFFER,yA,cA,b.width,b.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+BA,i.RENDERBUFFER,F.__webglColorRenderbuffer[BA])}i.bindRenderbuffer(i.RENDERBUFFER,null),b.depthBuffer&&(F.__webglDepthRenderbuffer=i.createRenderbuffer(),HA(F.__webglDepthRenderbuffer,b,!0)),e.bindFramebuffer(i.FRAMEBUFFER,null)}}if(j){e.bindTexture(i.TEXTURE_CUBE_MAP,X.__webglTexture),TA(i.TEXTURE_CUBE_MAP,f);for(let BA=0;BA<6;BA++)if(f.mipmaps&&f.mipmaps.length>0)for(let NA=0;NA<f.mipmaps.length;NA++)wA(F.__webglFramebuffer[BA][NA],b,f,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+BA,NA);else wA(F.__webglFramebuffer[BA],b,f,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+BA,0);d(f)&&E(i.TEXTURE_CUBE_MAP),e.unbindTexture()}else if(RA){for(let BA=0,NA=tA.length;BA<NA;BA++){const LA=tA[BA],CA=t.get(LA);let cA=i.TEXTURE_2D;(b.isWebGL3DRenderTarget||b.isWebGLArrayRenderTarget)&&(cA=b.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),e.bindTexture(cA,CA.__webglTexture),TA(cA,LA),wA(F.__webglFramebuffer,b,LA,i.COLOR_ATTACHMENT0+BA,cA,0),d(LA)&&E(cA)}e.unbindTexture()}else{let BA=i.TEXTURE_2D;if((b.isWebGL3DRenderTarget||b.isWebGLArrayRenderTarget)&&(BA=b.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),e.bindTexture(BA,X.__webglTexture),TA(BA,f),f.mipmaps&&f.mipmaps.length>0)for(let NA=0;NA<f.mipmaps.length;NA++)wA(F.__webglFramebuffer[NA],b,f,i.COLOR_ATTACHMENT0,BA,NA);else wA(F.__webglFramebuffer,b,f,i.COLOR_ATTACHMENT0,BA,0);d(f)&&E(BA),e.unbindTexture()}b.depthBuffer&&se(b)}function de(b){const f=b.textures;for(let F=0,X=f.length;F<X;F++){const tA=f[F];if(d(tA)){const j=u(b),RA=t.get(tA).__webglTexture;e.bindTexture(j,RA),E(j),e.unbindTexture()}}}const _e=[],jA=[];function qe(b){if(b.samples>0){if(He(b)===!1){const f=b.textures,F=b.width,X=b.height;let tA=i.COLOR_BUFFER_BIT;const j=b.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,RA=t.get(b),BA=f.length>1;if(BA)for(let LA=0;LA<f.length;LA++)e.bindFramebuffer(i.FRAMEBUFFER,RA.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+LA,i.RENDERBUFFER,null),e.bindFramebuffer(i.FRAMEBUFFER,RA.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+LA,i.TEXTURE_2D,null,0);e.bindFramebuffer(i.READ_FRAMEBUFFER,RA.__webglMultisampledFramebuffer);const NA=b.texture.mipmaps;NA&&NA.length>0?e.bindFramebuffer(i.DRAW_FRAMEBUFFER,RA.__webglFramebuffer[0]):e.bindFramebuffer(i.DRAW_FRAMEBUFFER,RA.__webglFramebuffer);for(let LA=0;LA<f.length;LA++){if(b.resolveDepthBuffer&&(b.depthBuffer&&(tA|=i.DEPTH_BUFFER_BIT),b.stencilBuffer&&b.resolveStencilBuffer&&(tA|=i.STENCIL_BUFFER_BIT)),BA){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,RA.__webglColorRenderbuffer[LA]);const CA=t.get(f[LA]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,CA,0)}i.blitFramebuffer(0,0,F,X,0,0,F,X,tA,i.NEAREST),n===!0&&(_e.length=0,jA.length=0,_e.push(i.COLOR_ATTACHMENT0+LA),b.depthBuffer&&b.resolveDepthBuffer===!1&&(_e.push(j),jA.push(j),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,jA)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,_e))}if(e.bindFramebuffer(i.READ_FRAMEBUFFER,null),e.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),BA)for(let LA=0;LA<f.length;LA++){e.bindFramebuffer(i.FRAMEBUFFER,RA.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+LA,i.RENDERBUFFER,RA.__webglColorRenderbuffer[LA]);const CA=t.get(f[LA]).__webglTexture;e.bindFramebuffer(i.FRAMEBUFFER,RA.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+LA,i.TEXTURE_2D,CA,0)}e.bindFramebuffer(i.DRAW_FRAMEBUFFER,RA.__webglMultisampledFramebuffer)}else if(b.depthBuffer&&b.resolveDepthBuffer===!1&&n){const f=b.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[f])}}}function R(b){return Math.min(g.maxSamples,b.samples)}function He(b){const f=t.get(b);return b.samples>0&&A.has("WEBGL_multisampled_render_to_texture")===!0&&f.__useRenderToTexture!==!1}function Ee(b){const f=C.render.frame;s.get(b)!==f&&(s.set(b,f),b.update())}function we(b,f){const F=b.colorSpace,X=b.format,tA=b.type;return b.isCompressedTexture===!0||b.isVideoTexture===!0||F!==uI&&F!==rg&&(oe.getTransfer(F)===ce?(X!==jt||tA!==Gt)&&KA("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):ae("WebGLTextures: Unsupported texture color space:",F)),f}function kA(b){return typeof HTMLImageElement<"u"&&b instanceof HTMLImageElement?(a.width=b.naturalWidth||b.width,a.height=b.naturalHeight||b.height):typeof VideoFrame<"u"&&b instanceof VideoFrame?(a.width=b.displayWidth,a.height=b.displayHeight):(a.width=b.width,a.height=b.height),a}this.allocateTextureUnit=v,this.resetTextureUnits=U,this.setTexture2D=W,this.setTexture2DArray=H,this.setTexture3D=O,this.setTextureCube=z,this.rebindTextures=ze,this.setupRenderTarget=ne,this.updateRenderTargetMipmap=de,this.updateMultisampleRenderTarget=qe,this.setupDepthRenderbuffer=se,this.setupFrameBufferTexture=wA,this.useMultisampledRTT=He,this.isReversedDepthBuffer=function(){return e.buffers.depth.getReversed()}}function pm(i,A){function e(t,g=rg){let I;const C=oe.getTransfer(g);if(t===Gt)return i.UNSIGNED_BYTE;if(t===Gs)return i.UNSIGNED_SHORT_4_4_4_4;if(t===Ms)return i.UNSIGNED_SHORT_5_5_5_1;if(t===tc)return i.UNSIGNED_INT_5_9_9_9_REV;if(t===ic)return i.UNSIGNED_INT_10F_11F_11F_REV;if(t===Ac)return i.BYTE;if(t===ec)return i.SHORT;if(t===hC)return i.UNSIGNED_SHORT;if(t===Rs)return i.INT;if(t===Bi)return i.UNSIGNED_INT;if(t===Ei)return i.FLOAT;if(t===vi)return i.HALF_FLOAT;if(t===gc)return i.ALPHA;if(t===Ic)return i.RGB;if(t===jt)return i.RGBA;if(t===Ki)return i.DEPTH_COMPONENT;if(t===Kg)return i.DEPTH_STENCIL;if(t===Cc)return i.RED;if(t===Fs)return i.RED_INTEGER;if(t===xI)return i.RG;if(t===Us)return i.RG_INTEGER;if(t===Ls)return i.RGBA_INTEGER;if(t===Yo||t===To||t===qo||t===Ho)if(C===ce)if(I=A.get("WEBGL_compressed_texture_s3tc_srgb"),I!==null){if(t===Yo)return I.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(t===To)return I.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(t===qo)return I.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(t===Ho)return I.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(I=A.get("WEBGL_compressed_texture_s3tc"),I!==null){if(t===Yo)return I.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===To)return I.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===qo)return I.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===Ho)return I.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(t===vs||t===Ks||t===Js||t===Ys)if(I=A.get("WEBGL_compressed_texture_pvrtc"),I!==null){if(t===vs)return I.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===Ks)return I.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===Js)return I.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===Ys)return I.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(t===Ts||t===qs||t===Hs||t===Ps||t===Os||t===Vs||t===js)if(I=A.get("WEBGL_compressed_texture_etc"),I!==null){if(t===Ts||t===qs)return C===ce?I.COMPRESSED_SRGB8_ETC2:I.COMPRESSED_RGB8_ETC2;if(t===Hs)return C===ce?I.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:I.COMPRESSED_RGBA8_ETC2_EAC;if(t===Ps)return I.COMPRESSED_R11_EAC;if(t===Os)return I.COMPRESSED_SIGNED_R11_EAC;if(t===Vs)return I.COMPRESSED_RG11_EAC;if(t===js)return I.COMPRESSED_SIGNED_RG11_EAC}else return null;if(t===Ws||t===Xs||t===Zs||t===zs||t===$s||t===AQ||t===eQ||t===tQ||t===iQ||t===gQ||t===IQ||t===CQ||t===oQ||t===nQ)if(I=A.get("WEBGL_compressed_texture_astc"),I!==null){if(t===Ws)return C===ce?I.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:I.COMPRESSED_RGBA_ASTC_4x4_KHR;if(t===Xs)return C===ce?I.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:I.COMPRESSED_RGBA_ASTC_5x4_KHR;if(t===Zs)return C===ce?I.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:I.COMPRESSED_RGBA_ASTC_5x5_KHR;if(t===zs)return C===ce?I.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:I.COMPRESSED_RGBA_ASTC_6x5_KHR;if(t===$s)return C===ce?I.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:I.COMPRESSED_RGBA_ASTC_6x6_KHR;if(t===AQ)return C===ce?I.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:I.COMPRESSED_RGBA_ASTC_8x5_KHR;if(t===eQ)return C===ce?I.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:I.COMPRESSED_RGBA_ASTC_8x6_KHR;if(t===tQ)return C===ce?I.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:I.COMPRESSED_RGBA_ASTC_8x8_KHR;if(t===iQ)return C===ce?I.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:I.COMPRESSED_RGBA_ASTC_10x5_KHR;if(t===gQ)return C===ce?I.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:I.COMPRESSED_RGBA_ASTC_10x6_KHR;if(t===IQ)return C===ce?I.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:I.COMPRESSED_RGBA_ASTC_10x8_KHR;if(t===CQ)return C===ce?I.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:I.COMPRESSED_RGBA_ASTC_10x10_KHR;if(t===oQ)return C===ce?I.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:I.COMPRESSED_RGBA_ASTC_12x10_KHR;if(t===nQ)return C===ce?I.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:I.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(t===aQ||t===sQ||t===QQ)if(I=A.get("EXT_texture_compression_bptc"),I!==null){if(t===aQ)return C===ce?I.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:I.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(t===sQ)return I.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(t===QQ)return I.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(t===rQ||t===BQ||t===EQ||t===cQ)if(I=A.get("EXT_texture_compression_rgtc"),I!==null){if(t===rQ)return I.COMPRESSED_RED_RGTC1_EXT;if(t===BQ)return I.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(t===EQ)return I.COMPRESSED_RED_GREEN_RGTC2_EXT;if(t===cQ)return I.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return t===lC?i.UNSIGNED_INT_24_8:i[t]!==void 0?i[t]:null}return{convert:e}}const wm=`
4141
+ }`,lm=[new J(1,0,0),new J(-1,0,0),new J(0,1,0),new J(0,-1,0),new J(0,0,1),new J(0,0,-1)],xm=[new J(0,-1,0),new J(0,-1,0),new J(0,0,1),new J(0,0,-1),new J(0,-1,0),new J(0,-1,0)],dd=new Ye,RC=new J,er=new J;function um(i,A,e){let t=new Kc;const g=new Be,I=new Be,C=new ve,o=new c2,n=new d2,a={},s=e.maxTextureSize,Q={[Mi]:Ct,[Ct]:Mi,[Fi]:Fi},r=new Ut({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Be},radius:{value:4}},vertexShader:dm,fragmentShader:hm}),B=r.clone();B.defines.HORIZONTAL_PASS=1;const h=new $t;h.setAttribute("position",new hi(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const c=new Ai(h,r),d=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=vo;let E=this.type;this.render=function(w,y,S){if(d.enabled===!1||d.autoUpdate===!1&&d.needsUpdate===!1||w.length===0)return;w.type===gD&&(KA("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),w.type=vo);const l=i.getRenderTarget(),p=i.getActiveCubeFace(),N=i.getActiveMipmapLevel(),U=i.state;U.setBlending(Ui),U.buffers.depth.getReversed()===!0?U.buffers.color.setClear(0,0,0,0):U.buffers.color.setClear(1,1,1,1),U.buffers.depth.setTest(!0),U.setScissorTest(!1);const v=E!==this.type;v&&y.traverse(function(P){P.material&&(Array.isArray(P.material)?P.material.forEach(W=>W.needsUpdate=!0):P.material.needsUpdate=!0)});for(let P=0,W=w.length;P<W;P++){const H=w[P],O=H.shadow;if(O===void 0){KA("WebGLShadowMap:",H,"has no shadow.");continue}if(O.autoUpdate===!1&&O.needsUpdate===!1)continue;g.copy(O.mapSize);const z=O.getFrameExtents();if(g.multiply(z),I.copy(O.mapSize),(g.x>s||g.y>s)&&(g.x>s&&(I.x=Math.floor(s/z.x),g.x=I.x*z.x,O.mapSize.x=I.x),g.y>s&&(I.y=Math.floor(s/z.y),g.y=I.y*z.y,O.mapSize.y=I.y)),O.map===null||v===!0){if(O.map!==null&&(O.map.depthTexture!==null&&(O.map.depthTexture.dispose(),O.map.depthTexture=null),O.map.dispose()),this.type===dC){if(H.isPointLight){KA("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}O.map=new di(g.x,g.y,{format:xI,type:vi,minFilter:tt,magFilter:tt,generateMipmaps:!1}),O.map.texture.name=H.name+".shadowMap",O.map.depthTexture=new NC(g.x,g.y,Ei),O.map.depthTexture.name=H.name+".shadowMapDepth",O.map.depthTexture.format=Ki,O.map.depthTexture.compareFunction=null,O.map.depthTexture.minFilter=At,O.map.depthTexture.magFilter=At}else{H.isPointLight?(O.map=new vc(g.x),O.map.depthTexture=new B2(g.x,Bi)):(O.map=new di(g.x,g.y),O.map.depthTexture=new NC(g.x,g.y,Bi)),O.map.depthTexture.name=H.name+".shadowMap",O.map.depthTexture.format=Ki;const QA=i.state.buffers.depth.getReversed();this.type===vo?(O.map.depthTexture.compareFunction=QA?hQ:dQ,O.map.depthTexture.minFilter=tt,O.map.depthTexture.magFilter=tt):(O.map.depthTexture.compareFunction=null,O.map.depthTexture.minFilter=At,O.map.depthTexture.magFilter=At)}O.camera.updateProjectionMatrix()}const lA=O.map.isWebGLCubeRenderTarget?6:1;for(let QA=0;QA<lA;QA++){if(O.map.isWebGLCubeRenderTarget)i.setRenderTarget(O.map,QA),i.clear();else{QA===0&&(i.setRenderTarget(O.map),i.clear());const uA=O.getViewport(QA);C.set(I.x*uA.x,I.y*uA.y,I.x*uA.z,I.y*uA.w),U.viewport(C)}if(H.isPointLight){const uA=O.camera,TA=O.matrix,YA=H.distance||uA.far;YA!==uA.far&&(uA.far=YA,uA.updateProjectionMatrix()),RC.setFromMatrixPosition(H.matrixWorld),uA.position.copy(RC),er.copy(uA.position),er.add(lm[QA]),uA.up.copy(xm[QA]),uA.lookAt(er),uA.updateMatrixWorld(),TA.makeTranslation(-RC.x,-RC.y,-RC.z),dd.multiplyMatrices(uA.projectionMatrix,uA.matrixWorldInverse),O._frustum.setFromProjectionMatrix(dd,uA.coordinateSystem,uA.reversedDepth)}else O.updateMatrices(H);t=O.getFrustum(),x(y,S,O.camera,H,this.type)}O.isPointLightShadow!==!0&&this.type===dC&&u(O,S),O.needsUpdate=!1}E=this.type,d.needsUpdate=!1,i.setRenderTarget(l,p,N)};function u(w,y){const S=A.update(c);r.defines.VSM_SAMPLES!==w.blurSamples&&(r.defines.VSM_SAMPLES=w.blurSamples,B.defines.VSM_SAMPLES=w.blurSamples,r.needsUpdate=!0,B.needsUpdate=!0),w.mapPass===null&&(w.mapPass=new di(g.x,g.y,{format:xI,type:vi})),r.uniforms.shadow_pass.value=w.map.depthTexture,r.uniforms.resolution.value=w.mapSize,r.uniforms.radius.value=w.radius,i.setRenderTarget(w.mapPass),i.clear(),i.renderBufferDirect(y,null,S,r,c,null),B.uniforms.shadow_pass.value=w.mapPass.texture,B.uniforms.resolution.value=w.mapSize,B.uniforms.radius.value=w.radius,i.setRenderTarget(w.map),i.clear(),i.renderBufferDirect(y,null,S,B,c,null)}function _(w,y,S,l){let p=null;const N=S.isPointLight===!0?w.customDistanceMaterial:w.customDepthMaterial;if(N!==void 0)p=N;else if(p=S.isPointLight===!0?n:o,i.localClippingEnabled&&y.clipShadows===!0&&Array.isArray(y.clippingPlanes)&&y.clippingPlanes.length!==0||y.displacementMap&&y.displacementScale!==0||y.alphaMap&&y.alphaTest>0||y.map&&y.alphaTest>0||y.alphaToCoverage===!0){const U=p.uuid,v=y.uuid;let P=a[U];P===void 0&&(P={},a[U]=P);let W=P[v];W===void 0&&(W=p.clone(),P[v]=W,y.addEventListener("dispose",D)),p=W}if(p.visible=y.visible,p.wireframe=y.wireframe,l===dC?p.side=y.shadowSide!==null?y.shadowSide:y.side:p.side=y.shadowSide!==null?y.shadowSide:Q[y.side],p.alphaMap=y.alphaMap,p.alphaTest=y.alphaToCoverage===!0?.5:y.alphaTest,p.map=y.map,p.clipShadows=y.clipShadows,p.clippingPlanes=y.clippingPlanes,p.clipIntersection=y.clipIntersection,p.displacementMap=y.displacementMap,p.displacementScale=y.displacementScale,p.displacementBias=y.displacementBias,p.wireframeLinewidth=y.wireframeLinewidth,p.linewidth=y.linewidth,S.isPointLight===!0&&p.isMeshDistanceMaterial===!0){const U=i.properties.get(p);U.light=S}return p}function x(w,y,S,l,p){if(w.visible===!1)return;if(w.layers.test(y.layers)&&(w.isMesh||w.isLine||w.isPoints)&&(w.castShadow||w.receiveShadow&&p===dC)&&(!w.frustumCulled||t.intersectsObject(w))){w.modelViewMatrix.multiplyMatrices(S.matrixWorldInverse,w.matrixWorld);const v=A.update(w),P=w.material;if(Array.isArray(P)){const W=v.groups;for(let H=0,O=W.length;H<O;H++){const z=W[H],lA=P[z.materialIndex];if(lA&&lA.visible){const QA=_(w,lA,l,p);w.onBeforeShadow(i,w,y,S,v,QA,z),i.renderBufferDirect(S,null,v,QA,w,z),w.onAfterShadow(i,w,y,S,v,QA,z)}}}else if(P.visible){const W=_(w,P,l,p);w.onBeforeShadow(i,w,y,S,v,W,null),i.renderBufferDirect(S,null,v,W,w,null),w.onAfterShadow(i,w,y,S,v,W,null)}}const U=w.children;for(let v=0,P=U.length;v<P;v++)x(U[v],y,S,l,p)}function D(w){w.target.removeEventListener("dispose",D);for(const S in a){const l=a[S],p=w.target.uuid;p in l&&(l[p].dispose(),delete l[p])}}}const fm={[us]:fs,[Ds]:ws,[_s]:ms,[hI]:ps,[fs]:us,[ws]:Ds,[ms]:_s,[ps]:hI};function Dm(i,A){function e(){let M=!1;const fA=new ve;let nA=null;const DA=new ve(0,0,0,0);return{setMask:function(IA){nA!==IA&&!M&&(i.colorMask(IA,IA,IA,IA),nA=IA)},setLocked:function(IA){M=IA},setClear:function(IA,eA,rA,JA,me){me===!0&&(IA*=JA,eA*=JA,rA*=JA),fA.set(IA,eA,rA,JA),DA.equals(fA)===!1&&(i.clearColor(IA,eA,rA,JA),DA.copy(fA))},reset:function(){M=!1,nA=null,DA.set(-1,0,0,0)}}}function t(){let M=!1,fA=!1,nA=null,DA=null,IA=null;return{setReversed:function(eA){if(fA!==eA){const rA=A.get("EXT_clip_control");eA?rA.clipControlEXT(rA.LOWER_LEFT_EXT,rA.ZERO_TO_ONE_EXT):rA.clipControlEXT(rA.LOWER_LEFT_EXT,rA.NEGATIVE_ONE_TO_ONE_EXT),fA=eA;const JA=IA;IA=null,this.setClear(JA)}},getReversed:function(){return fA},setTest:function(eA){eA?gA(i.DEPTH_TEST):wA(i.DEPTH_TEST)},setMask:function(eA){nA!==eA&&!M&&(i.depthMask(eA),nA=eA)},setFunc:function(eA){if(fA&&(eA=fm[eA]),DA!==eA){switch(eA){case us:i.depthFunc(i.NEVER);break;case fs:i.depthFunc(i.ALWAYS);break;case Ds:i.depthFunc(i.LESS);break;case hI:i.depthFunc(i.LEQUAL);break;case _s:i.depthFunc(i.EQUAL);break;case ps:i.depthFunc(i.GEQUAL);break;case ws:i.depthFunc(i.GREATER);break;case ms:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}DA=eA}},setLocked:function(eA){M=eA},setClear:function(eA){IA!==eA&&(fA&&(eA=1-eA),i.clearDepth(eA),IA=eA)},reset:function(){M=!1,nA=null,DA=null,IA=null,fA=!1}}}function g(){let M=!1,fA=null,nA=null,DA=null,IA=null,eA=null,rA=null,JA=null,me=null;return{setTest:function(he){M||(he?gA(i.STENCIL_TEST):wA(i.STENCIL_TEST))},setMask:function(he){fA!==he&&!M&&(i.stencilMask(he),fA=he)},setFunc:function(he,Di,Wi){(nA!==he||DA!==Di||IA!==Wi)&&(i.stencilFunc(he,Di,Wi),nA=he,DA=Di,IA=Wi)},setOp:function(he,Di,Wi){(eA!==he||rA!==Di||JA!==Wi)&&(i.stencilOp(he,Di,Wi),eA=he,rA=Di,JA=Wi)},setLocked:function(he){M=he},setClear:function(he){me!==he&&(i.clearStencil(he),me=he)},reset:function(){M=!1,fA=null,nA=null,DA=null,IA=null,eA=null,rA=null,JA=null,me=null}}}const I=new e,C=new t,o=new g,n=new WeakMap,a=new WeakMap;let s={},Q={},r=new WeakMap,B=[],h=null,c=!1,d=null,E=null,u=null,_=null,x=null,D=null,w=null,y=new Ie(0,0,0),S=0,l=!1,p=null,N=null,U=null,v=null,P=null;const W=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let H=!1,O=0;const z=i.getParameter(i.VERSION);z.indexOf("WebGL")!==-1?(O=parseFloat(/^WebGL (\d)/.exec(z)[1]),H=O>=1):z.indexOf("OpenGL ES")!==-1&&(O=parseFloat(/^OpenGL ES (\d)/.exec(z)[1]),H=O>=2);let lA=null,QA={};const uA=i.getParameter(i.SCISSOR_BOX),TA=i.getParameter(i.VIEWPORT),YA=new ve().fromArray(uA),Ne=new ve().fromArray(TA);function ue(M,fA,nA,DA){const IA=new Uint8Array(4),eA=i.createTexture();i.bindTexture(M,eA),i.texParameteri(M,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(M,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let rA=0;rA<nA;rA++)M===i.TEXTURE_3D||M===i.TEXTURE_2D_ARRAY?i.texImage3D(fA,0,i.RGBA,1,1,DA,0,i.RGBA,i.UNSIGNED_BYTE,IA):i.texImage2D(fA+rA,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,IA);return eA}const Z={};Z[i.TEXTURE_2D]=ue(i.TEXTURE_2D,i.TEXTURE_2D,1),Z[i.TEXTURE_CUBE_MAP]=ue(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),Z[i.TEXTURE_2D_ARRAY]=ue(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),Z[i.TEXTURE_3D]=ue(i.TEXTURE_3D,i.TEXTURE_3D,1,1),I.setClear(0,0,0,1),C.setClear(1),o.setClear(0),gA(i.DEPTH_TEST),C.setFunc(hI),jA(!1),qe(TE),gA(i.CULL_FACE),de(Ui);function gA(M){s[M]!==!0&&(i.enable(M),s[M]=!0)}function wA(M){s[M]!==!1&&(i.disable(M),s[M]=!1)}function PA(M,fA){return Q[M]!==fA?(i.bindFramebuffer(M,fA),Q[M]=fA,M===i.DRAW_FRAMEBUFFER&&(Q[i.FRAMEBUFFER]=fA),M===i.FRAMEBUFFER&&(Q[i.DRAW_FRAMEBUFFER]=fA),!0):!1}function bA(M,fA){let nA=B,DA=!1;if(M){nA=r.get(fA),nA===void 0&&(nA=[],r.set(fA,nA));const IA=M.textures;if(nA.length!==IA.length||nA[0]!==i.COLOR_ATTACHMENT0){for(let eA=0,rA=IA.length;eA<rA;eA++)nA[eA]=i.COLOR_ATTACHMENT0+eA;nA.length=IA.length,DA=!0}}else nA[0]!==i.BACK&&(nA[0]=i.BACK,DA=!0);DA&&i.drawBuffers(nA)}function se(M){return h!==M?(i.useProgram(M),h=M,!0):!1}const ze={[Ug]:i.FUNC_ADD,[CD]:i.FUNC_SUBTRACT,[oD]:i.FUNC_REVERSE_SUBTRACT};ze[nD]=i.MIN,ze[aD]=i.MAX;const ne={[sD]:i.ZERO,[QD]:i.ONE,[rD]:i.SRC_COLOR,[ls]:i.SRC_ALPHA,[lD]:i.SRC_ALPHA_SATURATE,[dD]:i.DST_COLOR,[ED]:i.DST_ALPHA,[BD]:i.ONE_MINUS_SRC_COLOR,[xs]:i.ONE_MINUS_SRC_ALPHA,[hD]:i.ONE_MINUS_DST_COLOR,[cD]:i.ONE_MINUS_DST_ALPHA,[xD]:i.CONSTANT_COLOR,[uD]:i.ONE_MINUS_CONSTANT_COLOR,[fD]:i.CONSTANT_ALPHA,[DD]:i.ONE_MINUS_CONSTANT_ALPHA};function de(M,fA,nA,DA,IA,eA,rA,JA,me,he){if(M===Ui){c===!0&&(wA(i.BLEND),c=!1);return}if(c===!1&&(gA(i.BLEND),c=!0),M!==ID){if(M!==d||he!==l){if((E!==Ug||x!==Ug)&&(i.blendEquation(i.FUNC_ADD),E=Ug,x=Ug),he)switch(M){case dI:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case hs:i.blendFunc(i.ONE,i.ONE);break;case qE:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case HE:i.blendFuncSeparate(i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ZERO,i.ONE);break;default:ae("WebGLState: Invalid blending: ",M);break}else switch(M){case dI:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case hs:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE,i.ONE,i.ONE);break;case qE:ae("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case HE:ae("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:ae("WebGLState: Invalid blending: ",M);break}u=null,_=null,D=null,w=null,y.set(0,0,0),S=0,d=M,l=he}return}IA=IA||fA,eA=eA||nA,rA=rA||DA,(fA!==E||IA!==x)&&(i.blendEquationSeparate(ze[fA],ze[IA]),E=fA,x=IA),(nA!==u||DA!==_||eA!==D||rA!==w)&&(i.blendFuncSeparate(ne[nA],ne[DA],ne[eA],ne[rA]),u=nA,_=DA,D=eA,w=rA),(JA.equals(y)===!1||me!==S)&&(i.blendColor(JA.r,JA.g,JA.b,me),y.copy(JA),S=me),d=M,l=!1}function _e(M,fA){M.side===Fi?wA(i.CULL_FACE):gA(i.CULL_FACE);let nA=M.side===Ct;fA&&(nA=!nA),jA(nA),M.blending===dI&&M.transparent===!1?de(Ui):de(M.blending,M.blendEquation,M.blendSrc,M.blendDst,M.blendEquationAlpha,M.blendSrcAlpha,M.blendDstAlpha,M.blendColor,M.blendAlpha,M.premultipliedAlpha),C.setFunc(M.depthFunc),C.setTest(M.depthTest),C.setMask(M.depthWrite),I.setMask(M.colorWrite);const DA=M.stencilWrite;o.setTest(DA),DA&&(o.setMask(M.stencilWriteMask),o.setFunc(M.stencilFunc,M.stencilRef,M.stencilFuncMask),o.setOp(M.stencilFail,M.stencilZFail,M.stencilZPass)),He(M.polygonOffset,M.polygonOffsetFactor,M.polygonOffsetUnits),M.alphaToCoverage===!0?gA(i.SAMPLE_ALPHA_TO_COVERAGE):wA(i.SAMPLE_ALPHA_TO_COVERAGE)}function jA(M){p!==M&&(M?i.frontFace(i.CW):i.frontFace(i.CCW),p=M)}function qe(M){M!==tD?(gA(i.CULL_FACE),M!==N&&(M===TE?i.cullFace(i.BACK):M===iD?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):wA(i.CULL_FACE),N=M}function R(M){M!==U&&(H&&i.lineWidth(M),U=M)}function He(M,fA,nA){M?(gA(i.POLYGON_OFFSET_FILL),(v!==fA||P!==nA)&&(i.polygonOffset(fA,nA),v=fA,P=nA)):wA(i.POLYGON_OFFSET_FILL)}function Ee(M){M?gA(i.SCISSOR_TEST):wA(i.SCISSOR_TEST)}function we(M){M===void 0&&(M=i.TEXTURE0+W-1),lA!==M&&(i.activeTexture(M),lA=M)}function kA(M,fA,nA){nA===void 0&&(lA===null?nA=i.TEXTURE0+W-1:nA=lA);let DA=QA[nA];DA===void 0&&(DA={type:void 0,texture:void 0},QA[nA]=DA),(DA.type!==M||DA.texture!==fA)&&(lA!==nA&&(i.activeTexture(nA),lA=nA),i.bindTexture(M,fA||Z[M]),DA.type=M,DA.texture=fA)}function b(){const M=QA[lA];M!==void 0&&M.type!==void 0&&(i.bindTexture(M.type,null),M.type=void 0,M.texture=void 0)}function f(){try{i.compressedTexImage2D(...arguments)}catch(M){ae("WebGLState:",M)}}function F(){try{i.compressedTexImage3D(...arguments)}catch(M){ae("WebGLState:",M)}}function X(){try{i.texSubImage2D(...arguments)}catch(M){ae("WebGLState:",M)}}function tA(){try{i.texSubImage3D(...arguments)}catch(M){ae("WebGLState:",M)}}function j(){try{i.compressedTexSubImage2D(...arguments)}catch(M){ae("WebGLState:",M)}}function RA(){try{i.compressedTexSubImage3D(...arguments)}catch(M){ae("WebGLState:",M)}}function BA(){try{i.texStorage2D(...arguments)}catch(M){ae("WebGLState:",M)}}function NA(){try{i.texStorage3D(...arguments)}catch(M){ae("WebGLState:",M)}}function LA(){try{i.texImage2D(...arguments)}catch(M){ae("WebGLState:",M)}}function CA(){try{i.texImage3D(...arguments)}catch(M){ae("WebGLState:",M)}}function cA(M){YA.equals(M)===!1&&(i.scissor(M.x,M.y,M.z,M.w),YA.copy(M))}function yA(M){Ne.equals(M)===!1&&(i.viewport(M.x,M.y,M.z,M.w),Ne.copy(M))}function SA(M,fA){let nA=a.get(fA);nA===void 0&&(nA=new WeakMap,a.set(fA,nA));let DA=nA.get(M);DA===void 0&&(DA=i.getUniformBlockIndex(fA,M.name),nA.set(M,DA))}function EA(M,fA){const DA=a.get(fA).get(M);n.get(fA)!==DA&&(i.uniformBlockBinding(fA,DA,M.__bindingPointIndex),n.set(fA,DA))}function WA(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),C.setReversed(!1),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),s={},lA=null,QA={},Q={},r=new WeakMap,B=[],h=null,c=!1,d=null,E=null,u=null,_=null,x=null,D=null,w=null,y=new Ie(0,0,0),S=0,l=!1,p=null,N=null,U=null,v=null,P=null,YA.set(0,0,i.canvas.width,i.canvas.height),Ne.set(0,0,i.canvas.width,i.canvas.height),I.reset(),C.reset(),o.reset()}return{buffers:{color:I,depth:C,stencil:o},enable:gA,disable:wA,bindFramebuffer:PA,drawBuffers:bA,useProgram:se,setBlending:de,setMaterial:_e,setFlipSided:jA,setCullFace:qe,setLineWidth:R,setPolygonOffset:He,setScissorTest:Ee,activeTexture:we,bindTexture:kA,unbindTexture:b,compressedTexImage2D:f,compressedTexImage3D:F,texImage2D:LA,texImage3D:CA,updateUBOMapping:SA,uniformBlockBinding:EA,texStorage2D:BA,texStorage3D:NA,texSubImage2D:X,texSubImage3D:tA,compressedTexSubImage2D:j,compressedTexSubImage3D:RA,scissor:cA,viewport:yA,reset:WA}}function _m(i,A,e,t,g,I,C){const o=A.has("WEBGL_multisampled_render_to_texture")?A.get("WEBGL_multisampled_render_to_texture"):null,n=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),a=new Be,s=new WeakMap;let Q;const r=new WeakMap;let B=!1;try{B=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function h(b,f){return B?new OffscreenCanvas(b,f):Vo("canvas")}function c(b,f,F){let X=1;const tA=kA(b);if((tA.width>F||tA.height>F)&&(X=F/Math.max(tA.width,tA.height)),X<1)if(typeof HTMLImageElement<"u"&&b instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&b instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&b instanceof ImageBitmap||typeof VideoFrame<"u"&&b instanceof VideoFrame){const j=Math.floor(X*tA.width),RA=Math.floor(X*tA.height);Q===void 0&&(Q=h(j,RA));const BA=f?h(j,RA):Q;return BA.width=j,BA.height=RA,BA.getContext("2d").drawImage(b,0,0,j,RA),KA("WebGLRenderer: Texture has been resized from ("+tA.width+"x"+tA.height+") to ("+j+"x"+RA+")."),BA}else return"data"in b&&KA("WebGLRenderer: Image in DataTexture is too big ("+tA.width+"x"+tA.height+")."),b;return b}function d(b){return b.generateMipmaps}function E(b){i.generateMipmap(b)}function u(b){return b.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:b.isWebGL3DRenderTarget?i.TEXTURE_3D:b.isWebGLArrayRenderTarget||b.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function _(b,f,F,X,tA=!1){if(b!==null){if(i[b]!==void 0)return i[b];KA("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+b+"'")}let j=f;if(f===i.RED&&(F===i.FLOAT&&(j=i.R32F),F===i.HALF_FLOAT&&(j=i.R16F),F===i.UNSIGNED_BYTE&&(j=i.R8)),f===i.RED_INTEGER&&(F===i.UNSIGNED_BYTE&&(j=i.R8UI),F===i.UNSIGNED_SHORT&&(j=i.R16UI),F===i.UNSIGNED_INT&&(j=i.R32UI),F===i.BYTE&&(j=i.R8I),F===i.SHORT&&(j=i.R16I),F===i.INT&&(j=i.R32I)),f===i.RG&&(F===i.FLOAT&&(j=i.RG32F),F===i.HALF_FLOAT&&(j=i.RG16F),F===i.UNSIGNED_BYTE&&(j=i.RG8)),f===i.RG_INTEGER&&(F===i.UNSIGNED_BYTE&&(j=i.RG8UI),F===i.UNSIGNED_SHORT&&(j=i.RG16UI),F===i.UNSIGNED_INT&&(j=i.RG32UI),F===i.BYTE&&(j=i.RG8I),F===i.SHORT&&(j=i.RG16I),F===i.INT&&(j=i.RG32I)),f===i.RGB_INTEGER&&(F===i.UNSIGNED_BYTE&&(j=i.RGB8UI),F===i.UNSIGNED_SHORT&&(j=i.RGB16UI),F===i.UNSIGNED_INT&&(j=i.RGB32UI),F===i.BYTE&&(j=i.RGB8I),F===i.SHORT&&(j=i.RGB16I),F===i.INT&&(j=i.RGB32I)),f===i.RGBA_INTEGER&&(F===i.UNSIGNED_BYTE&&(j=i.RGBA8UI),F===i.UNSIGNED_SHORT&&(j=i.RGBA16UI),F===i.UNSIGNED_INT&&(j=i.RGBA32UI),F===i.BYTE&&(j=i.RGBA8I),F===i.SHORT&&(j=i.RGBA16I),F===i.INT&&(j=i.RGBA32I)),f===i.RGB&&(F===i.UNSIGNED_INT_5_9_9_9_REV&&(j=i.RGB9_E5),F===i.UNSIGNED_INT_10F_11F_11F_REV&&(j=i.R11F_G11F_B10F)),f===i.RGBA){const RA=tA?Po:oe.getTransfer(X);F===i.FLOAT&&(j=i.RGBA32F),F===i.HALF_FLOAT&&(j=i.RGBA16F),F===i.UNSIGNED_BYTE&&(j=RA===ce?i.SRGB8_ALPHA8:i.RGBA8),F===i.UNSIGNED_SHORT_4_4_4_4&&(j=i.RGBA4),F===i.UNSIGNED_SHORT_5_5_5_1&&(j=i.RGB5_A1)}return(j===i.R16F||j===i.R32F||j===i.RG16F||j===i.RG32F||j===i.RGBA16F||j===i.RGBA32F)&&A.get("EXT_color_buffer_float"),j}function x(b,f){let F;return b?f===null||f===Bi||f===lC?F=i.DEPTH24_STENCIL8:f===Ei?F=i.DEPTH32F_STENCIL8:f===hC&&(F=i.DEPTH24_STENCIL8,KA("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):f===null||f===Bi||f===lC?F=i.DEPTH_COMPONENT24:f===Ei?F=i.DEPTH_COMPONENT32F:f===hC&&(F=i.DEPTH_COMPONENT16),F}function D(b,f){return d(b)===!0||b.isFramebufferTexture&&b.minFilter!==At&&b.minFilter!==tt?Math.log2(Math.max(f.width,f.height))+1:b.mipmaps!==void 0&&b.mipmaps.length>0?b.mipmaps.length:b.isCompressedTexture&&Array.isArray(b.image)?f.mipmaps.length:1}function w(b){const f=b.target;f.removeEventListener("dispose",w),S(f),f.isVideoTexture&&s.delete(f)}function y(b){const f=b.target;f.removeEventListener("dispose",y),p(f)}function S(b){const f=t.get(b);if(f.__webglInit===void 0)return;const F=b.source,X=r.get(F);if(X){const tA=X[f.__cacheKey];tA.usedTimes--,tA.usedTimes===0&&l(b),Object.keys(X).length===0&&r.delete(F)}t.remove(b)}function l(b){const f=t.get(b);i.deleteTexture(f.__webglTexture);const F=b.source,X=r.get(F);delete X[f.__cacheKey],C.memory.textures--}function p(b){const f=t.get(b);if(b.depthTexture&&(b.depthTexture.dispose(),t.remove(b.depthTexture)),b.isWebGLCubeRenderTarget)for(let X=0;X<6;X++){if(Array.isArray(f.__webglFramebuffer[X]))for(let tA=0;tA<f.__webglFramebuffer[X].length;tA++)i.deleteFramebuffer(f.__webglFramebuffer[X][tA]);else i.deleteFramebuffer(f.__webglFramebuffer[X]);f.__webglDepthbuffer&&i.deleteRenderbuffer(f.__webglDepthbuffer[X])}else{if(Array.isArray(f.__webglFramebuffer))for(let X=0;X<f.__webglFramebuffer.length;X++)i.deleteFramebuffer(f.__webglFramebuffer[X]);else i.deleteFramebuffer(f.__webglFramebuffer);if(f.__webglDepthbuffer&&i.deleteRenderbuffer(f.__webglDepthbuffer),f.__webglMultisampledFramebuffer&&i.deleteFramebuffer(f.__webglMultisampledFramebuffer),f.__webglColorRenderbuffer)for(let X=0;X<f.__webglColorRenderbuffer.length;X++)f.__webglColorRenderbuffer[X]&&i.deleteRenderbuffer(f.__webglColorRenderbuffer[X]);f.__webglDepthRenderbuffer&&i.deleteRenderbuffer(f.__webglDepthRenderbuffer)}const F=b.textures;for(let X=0,tA=F.length;X<tA;X++){const j=t.get(F[X]);j.__webglTexture&&(i.deleteTexture(j.__webglTexture),C.memory.textures--),t.remove(F[X])}t.remove(b)}let N=0;function U(){N=0}function v(){const b=N;return b>=g.maxTextures&&KA("WebGLTextures: Trying to use "+b+" texture units while this GPU supports only "+g.maxTextures),N+=1,b}function P(b){const f=[];return f.push(b.wrapS),f.push(b.wrapT),f.push(b.wrapR||0),f.push(b.magFilter),f.push(b.minFilter),f.push(b.anisotropy),f.push(b.internalFormat),f.push(b.format),f.push(b.type),f.push(b.generateMipmaps),f.push(b.premultiplyAlpha),f.push(b.flipY),f.push(b.unpackAlignment),f.push(b.colorSpace),f.join()}function W(b,f){const F=t.get(b);if(b.isVideoTexture&&Ee(b),b.isRenderTargetTexture===!1&&b.isExternalTexture!==!0&&b.version>0&&F.__version!==b.version){const X=b.image;if(X===null)KA("WebGLRenderer: Texture marked for update but no image data found.");else if(X.complete===!1)KA("WebGLRenderer: Texture marked for update but image is incomplete");else{Z(F,b,f);return}}else b.isExternalTexture&&(F.__webglTexture=b.sourceTexture?b.sourceTexture:null);e.bindTexture(i.TEXTURE_2D,F.__webglTexture,i.TEXTURE0+f)}function H(b,f){const F=t.get(b);if(b.isRenderTargetTexture===!1&&b.version>0&&F.__version!==b.version){Z(F,b,f);return}else b.isExternalTexture&&(F.__webglTexture=b.sourceTexture?b.sourceTexture:null);e.bindTexture(i.TEXTURE_2D_ARRAY,F.__webglTexture,i.TEXTURE0+f)}function O(b,f){const F=t.get(b);if(b.isRenderTargetTexture===!1&&b.version>0&&F.__version!==b.version){Z(F,b,f);return}e.bindTexture(i.TEXTURE_3D,F.__webglTexture,i.TEXTURE0+f)}function z(b,f){const F=t.get(b);if(b.isCubeDepthTexture!==!0&&b.version>0&&F.__version!==b.version){gA(F,b,f);return}e.bindTexture(i.TEXTURE_CUBE_MAP,F.__webglTexture,i.TEXTURE0+f)}const lA={[Ns]:i.REPEAT,[Li]:i.CLAMP_TO_EDGE,[ks]:i.MIRRORED_REPEAT},QA={[At]:i.NEAREST,[wD]:i.NEAREST_MIPMAP_NEAREST,[Jo]:i.NEAREST_MIPMAP_LINEAR,[tt]:i.LINEAR,[Ss]:i.LINEAR_MIPMAP_NEAREST,[vg]:i.LINEAR_MIPMAP_LINEAR},uA={[ND]:i.NEVER,[MD]:i.ALWAYS,[kD]:i.LESS,[dQ]:i.LEQUAL,[SD]:i.EQUAL,[hQ]:i.GEQUAL,[RD]:i.GREATER,[GD]:i.NOTEQUAL};function TA(b,f){if(f.type===Ei&&A.has("OES_texture_float_linear")===!1&&(f.magFilter===tt||f.magFilter===Ss||f.magFilter===Jo||f.magFilter===vg||f.minFilter===tt||f.minFilter===Ss||f.minFilter===Jo||f.minFilter===vg)&&KA("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(b,i.TEXTURE_WRAP_S,lA[f.wrapS]),i.texParameteri(b,i.TEXTURE_WRAP_T,lA[f.wrapT]),(b===i.TEXTURE_3D||b===i.TEXTURE_2D_ARRAY)&&i.texParameteri(b,i.TEXTURE_WRAP_R,lA[f.wrapR]),i.texParameteri(b,i.TEXTURE_MAG_FILTER,QA[f.magFilter]),i.texParameteri(b,i.TEXTURE_MIN_FILTER,QA[f.minFilter]),f.compareFunction&&(i.texParameteri(b,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(b,i.TEXTURE_COMPARE_FUNC,uA[f.compareFunction])),A.has("EXT_texture_filter_anisotropic")===!0){if(f.magFilter===At||f.minFilter!==Jo&&f.minFilter!==vg||f.type===Ei&&A.has("OES_texture_float_linear")===!1)return;if(f.anisotropy>1||t.get(f).__currentAnisotropy){const F=A.get("EXT_texture_filter_anisotropic");i.texParameterf(b,F.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(f.anisotropy,g.getMaxAnisotropy())),t.get(f).__currentAnisotropy=f.anisotropy}}}function YA(b,f){let F=!1;b.__webglInit===void 0&&(b.__webglInit=!0,f.addEventListener("dispose",w));const X=f.source;let tA=r.get(X);tA===void 0&&(tA={},r.set(X,tA));const j=P(f);if(j!==b.__cacheKey){tA[j]===void 0&&(tA[j]={texture:i.createTexture(),usedTimes:0},C.memory.textures++,F=!0),tA[j].usedTimes++;const RA=tA[b.__cacheKey];RA!==void 0&&(tA[b.__cacheKey].usedTimes--,RA.usedTimes===0&&l(f)),b.__cacheKey=j,b.__webglTexture=tA[j].texture}return F}function Ne(b,f,F){return Math.floor(Math.floor(b/F)/f)}function ue(b,f,F,X){const j=b.updateRanges;if(j.length===0)e.texSubImage2D(i.TEXTURE_2D,0,0,0,f.width,f.height,F,X,f.data);else{j.sort((CA,cA)=>CA.start-cA.start);let RA=0;for(let CA=1;CA<j.length;CA++){const cA=j[RA],yA=j[CA],SA=cA.start+cA.count,EA=Ne(yA.start,f.width,4),WA=Ne(cA.start,f.width,4);yA.start<=SA+1&&EA===WA&&Ne(yA.start+yA.count-1,f.width,4)===EA?cA.count=Math.max(cA.count,yA.start+yA.count-cA.start):(++RA,j[RA]=yA)}j.length=RA+1;const BA=i.getParameter(i.UNPACK_ROW_LENGTH),NA=i.getParameter(i.UNPACK_SKIP_PIXELS),LA=i.getParameter(i.UNPACK_SKIP_ROWS);i.pixelStorei(i.UNPACK_ROW_LENGTH,f.width);for(let CA=0,cA=j.length;CA<cA;CA++){const yA=j[CA],SA=Math.floor(yA.start/4),EA=Math.ceil(yA.count/4),WA=SA%f.width,M=Math.floor(SA/f.width),fA=EA,nA=1;i.pixelStorei(i.UNPACK_SKIP_PIXELS,WA),i.pixelStorei(i.UNPACK_SKIP_ROWS,M),e.texSubImage2D(i.TEXTURE_2D,0,WA,M,fA,nA,F,X,f.data)}b.clearUpdateRanges(),i.pixelStorei(i.UNPACK_ROW_LENGTH,BA),i.pixelStorei(i.UNPACK_SKIP_PIXELS,NA),i.pixelStorei(i.UNPACK_SKIP_ROWS,LA)}}function Z(b,f,F){let X=i.TEXTURE_2D;(f.isDataArrayTexture||f.isCompressedArrayTexture)&&(X=i.TEXTURE_2D_ARRAY),f.isData3DTexture&&(X=i.TEXTURE_3D);const tA=YA(b,f),j=f.source;e.bindTexture(X,b.__webglTexture,i.TEXTURE0+F);const RA=t.get(j);if(j.version!==RA.__version||tA===!0){e.activeTexture(i.TEXTURE0+F);const BA=oe.getPrimaries(oe.workingColorSpace),NA=f.colorSpace===rg?null:oe.getPrimaries(f.colorSpace),LA=f.colorSpace===rg||BA===NA?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,f.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,f.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,f.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,LA);let CA=c(f.image,!1,g.maxTextureSize);CA=we(f,CA);const cA=I.convert(f.format,f.colorSpace),yA=I.convert(f.type);let SA=_(f.internalFormat,cA,yA,f.colorSpace,f.isVideoTexture);TA(X,f);let EA;const WA=f.mipmaps,M=f.isVideoTexture!==!0,fA=RA.__version===void 0||tA===!0,nA=j.dataReady,DA=D(f,CA);if(f.isDepthTexture)SA=x(f.format===Kg,f.type),fA&&(M?e.texStorage2D(i.TEXTURE_2D,1,SA,CA.width,CA.height):e.texImage2D(i.TEXTURE_2D,0,SA,CA.width,CA.height,0,cA,yA,null));else if(f.isDataTexture)if(WA.length>0){M&&fA&&e.texStorage2D(i.TEXTURE_2D,DA,SA,WA[0].width,WA[0].height);for(let IA=0,eA=WA.length;IA<eA;IA++)EA=WA[IA],M?nA&&e.texSubImage2D(i.TEXTURE_2D,IA,0,0,EA.width,EA.height,cA,yA,EA.data):e.texImage2D(i.TEXTURE_2D,IA,SA,EA.width,EA.height,0,cA,yA,EA.data);f.generateMipmaps=!1}else M?(fA&&e.texStorage2D(i.TEXTURE_2D,DA,SA,CA.width,CA.height),nA&&ue(f,CA,cA,yA)):e.texImage2D(i.TEXTURE_2D,0,SA,CA.width,CA.height,0,cA,yA,CA.data);else if(f.isCompressedTexture)if(f.isCompressedArrayTexture){M&&fA&&e.texStorage3D(i.TEXTURE_2D_ARRAY,DA,SA,WA[0].width,WA[0].height,CA.depth);for(let IA=0,eA=WA.length;IA<eA;IA++)if(EA=WA[IA],f.format!==jt)if(cA!==null)if(M){if(nA)if(f.layerUpdates.size>0){const rA=Tc(EA.width,EA.height,f.format,f.type);for(const JA of f.layerUpdates){const me=EA.data.subarray(JA*rA/EA.data.BYTES_PER_ELEMENT,(JA+1)*rA/EA.data.BYTES_PER_ELEMENT);e.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,IA,0,0,JA,EA.width,EA.height,1,cA,me)}f.clearLayerUpdates()}else e.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,IA,0,0,0,EA.width,EA.height,CA.depth,cA,EA.data)}else e.compressedTexImage3D(i.TEXTURE_2D_ARRAY,IA,SA,EA.width,EA.height,CA.depth,0,EA.data,0,0);else KA("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else M?nA&&e.texSubImage3D(i.TEXTURE_2D_ARRAY,IA,0,0,0,EA.width,EA.height,CA.depth,cA,yA,EA.data):e.texImage3D(i.TEXTURE_2D_ARRAY,IA,SA,EA.width,EA.height,CA.depth,0,cA,yA,EA.data)}else{M&&fA&&e.texStorage2D(i.TEXTURE_2D,DA,SA,WA[0].width,WA[0].height);for(let IA=0,eA=WA.length;IA<eA;IA++)EA=WA[IA],f.format!==jt?cA!==null?M?nA&&e.compressedTexSubImage2D(i.TEXTURE_2D,IA,0,0,EA.width,EA.height,cA,EA.data):e.compressedTexImage2D(i.TEXTURE_2D,IA,SA,EA.width,EA.height,0,EA.data):KA("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):M?nA&&e.texSubImage2D(i.TEXTURE_2D,IA,0,0,EA.width,EA.height,cA,yA,EA.data):e.texImage2D(i.TEXTURE_2D,IA,SA,EA.width,EA.height,0,cA,yA,EA.data)}else if(f.isDataArrayTexture)if(M){if(fA&&e.texStorage3D(i.TEXTURE_2D_ARRAY,DA,SA,CA.width,CA.height,CA.depth),nA)if(f.layerUpdates.size>0){const IA=Tc(CA.width,CA.height,f.format,f.type);for(const eA of f.layerUpdates){const rA=CA.data.subarray(eA*IA/CA.data.BYTES_PER_ELEMENT,(eA+1)*IA/CA.data.BYTES_PER_ELEMENT);e.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,eA,CA.width,CA.height,1,cA,yA,rA)}f.clearLayerUpdates()}else e.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,CA.width,CA.height,CA.depth,cA,yA,CA.data)}else e.texImage3D(i.TEXTURE_2D_ARRAY,0,SA,CA.width,CA.height,CA.depth,0,cA,yA,CA.data);else if(f.isData3DTexture)M?(fA&&e.texStorage3D(i.TEXTURE_3D,DA,SA,CA.width,CA.height,CA.depth),nA&&e.texSubImage3D(i.TEXTURE_3D,0,0,0,0,CA.width,CA.height,CA.depth,cA,yA,CA.data)):e.texImage3D(i.TEXTURE_3D,0,SA,CA.width,CA.height,CA.depth,0,cA,yA,CA.data);else if(f.isFramebufferTexture){if(fA)if(M)e.texStorage2D(i.TEXTURE_2D,DA,SA,CA.width,CA.height);else{let IA=CA.width,eA=CA.height;for(let rA=0;rA<DA;rA++)e.texImage2D(i.TEXTURE_2D,rA,SA,IA,eA,0,cA,yA,null),IA>>=1,eA>>=1}}else if(WA.length>0){if(M&&fA){const IA=kA(WA[0]);e.texStorage2D(i.TEXTURE_2D,DA,SA,IA.width,IA.height)}for(let IA=0,eA=WA.length;IA<eA;IA++)EA=WA[IA],M?nA&&e.texSubImage2D(i.TEXTURE_2D,IA,0,0,cA,yA,EA):e.texImage2D(i.TEXTURE_2D,IA,SA,cA,yA,EA);f.generateMipmaps=!1}else if(M){if(fA){const IA=kA(CA);e.texStorage2D(i.TEXTURE_2D,DA,SA,IA.width,IA.height)}nA&&e.texSubImage2D(i.TEXTURE_2D,0,0,0,cA,yA,CA)}else e.texImage2D(i.TEXTURE_2D,0,SA,cA,yA,CA);d(f)&&E(X),RA.__version=j.version,f.onUpdate&&f.onUpdate(f)}b.__version=f.version}function gA(b,f,F){if(f.image.length!==6)return;const X=YA(b,f),tA=f.source;e.bindTexture(i.TEXTURE_CUBE_MAP,b.__webglTexture,i.TEXTURE0+F);const j=t.get(tA);if(tA.version!==j.__version||X===!0){e.activeTexture(i.TEXTURE0+F);const RA=oe.getPrimaries(oe.workingColorSpace),BA=f.colorSpace===rg?null:oe.getPrimaries(f.colorSpace),NA=f.colorSpace===rg||RA===BA?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,f.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,f.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,f.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,NA);const LA=f.isCompressedTexture||f.image[0].isCompressedTexture,CA=f.image[0]&&f.image[0].isDataTexture,cA=[];for(let eA=0;eA<6;eA++)!LA&&!CA?cA[eA]=c(f.image[eA],!0,g.maxCubemapSize):cA[eA]=CA?f.image[eA].image:f.image[eA],cA[eA]=we(f,cA[eA]);const yA=cA[0],SA=I.convert(f.format,f.colorSpace),EA=I.convert(f.type),WA=_(f.internalFormat,SA,EA,f.colorSpace),M=f.isVideoTexture!==!0,fA=j.__version===void 0||X===!0,nA=tA.dataReady;let DA=D(f,yA);TA(i.TEXTURE_CUBE_MAP,f);let IA;if(LA){M&&fA&&e.texStorage2D(i.TEXTURE_CUBE_MAP,DA,WA,yA.width,yA.height);for(let eA=0;eA<6;eA++){IA=cA[eA].mipmaps;for(let rA=0;rA<IA.length;rA++){const JA=IA[rA];f.format!==jt?SA!==null?M?nA&&e.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+eA,rA,0,0,JA.width,JA.height,SA,JA.data):e.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+eA,rA,WA,JA.width,JA.height,0,JA.data):KA("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):M?nA&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+eA,rA,0,0,JA.width,JA.height,SA,EA,JA.data):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+eA,rA,WA,JA.width,JA.height,0,SA,EA,JA.data)}}}else{if(IA=f.mipmaps,M&&fA){IA.length>0&&DA++;const eA=kA(cA[0]);e.texStorage2D(i.TEXTURE_CUBE_MAP,DA,WA,eA.width,eA.height)}for(let eA=0;eA<6;eA++)if(CA){M?nA&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+eA,0,0,0,cA[eA].width,cA[eA].height,SA,EA,cA[eA].data):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+eA,0,WA,cA[eA].width,cA[eA].height,0,SA,EA,cA[eA].data);for(let rA=0;rA<IA.length;rA++){const me=IA[rA].image[eA].image;M?nA&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+eA,rA+1,0,0,me.width,me.height,SA,EA,me.data):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+eA,rA+1,WA,me.width,me.height,0,SA,EA,me.data)}}else{M?nA&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+eA,0,0,0,SA,EA,cA[eA]):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+eA,0,WA,SA,EA,cA[eA]);for(let rA=0;rA<IA.length;rA++){const JA=IA[rA];M?nA&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+eA,rA+1,0,0,SA,EA,JA.image[eA]):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+eA,rA+1,WA,SA,EA,JA.image[eA])}}}d(f)&&E(i.TEXTURE_CUBE_MAP),j.__version=tA.version,f.onUpdate&&f.onUpdate(f)}b.__version=f.version}function wA(b,f,F,X,tA,j){const RA=I.convert(F.format,F.colorSpace),BA=I.convert(F.type),NA=_(F.internalFormat,RA,BA,F.colorSpace),LA=t.get(f),CA=t.get(F);if(CA.__renderTarget=f,!LA.__hasExternalTextures){const cA=Math.max(1,f.width>>j),yA=Math.max(1,f.height>>j);tA===i.TEXTURE_3D||tA===i.TEXTURE_2D_ARRAY?e.texImage3D(tA,j,NA,cA,yA,f.depth,0,RA,BA,null):e.texImage2D(tA,j,NA,cA,yA,0,RA,BA,null)}e.bindFramebuffer(i.FRAMEBUFFER,b),He(f)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,X,tA,CA.__webglTexture,0,R(f)):(tA===i.TEXTURE_2D||tA>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&tA<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,X,tA,CA.__webglTexture,j),e.bindFramebuffer(i.FRAMEBUFFER,null)}function PA(b,f,F){if(i.bindRenderbuffer(i.RENDERBUFFER,b),f.depthBuffer){const X=f.depthTexture,tA=X&&X.isDepthTexture?X.type:null,j=x(f.stencilBuffer,tA),RA=f.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;He(f)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,R(f),j,f.width,f.height):F?i.renderbufferStorageMultisample(i.RENDERBUFFER,R(f),j,f.width,f.height):i.renderbufferStorage(i.RENDERBUFFER,j,f.width,f.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,RA,i.RENDERBUFFER,b)}else{const X=f.textures;for(let tA=0;tA<X.length;tA++){const j=X[tA],RA=I.convert(j.format,j.colorSpace),BA=I.convert(j.type),NA=_(j.internalFormat,RA,BA,j.colorSpace);He(f)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,R(f),NA,f.width,f.height):F?i.renderbufferStorageMultisample(i.RENDERBUFFER,R(f),NA,f.width,f.height):i.renderbufferStorage(i.RENDERBUFFER,NA,f.width,f.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function bA(b,f,F){const X=f.isWebGLCubeRenderTarget===!0;if(e.bindFramebuffer(i.FRAMEBUFFER,b),!(f.depthTexture&&f.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const tA=t.get(f.depthTexture);if(tA.__renderTarget=f,(!tA.__webglTexture||f.depthTexture.image.width!==f.width||f.depthTexture.image.height!==f.height)&&(f.depthTexture.image.width=f.width,f.depthTexture.image.height=f.height,f.depthTexture.needsUpdate=!0),X){if(tA.__webglInit===void 0&&(tA.__webglInit=!0,f.depthTexture.addEventListener("dispose",w)),tA.__webglTexture===void 0){tA.__webglTexture=i.createTexture(),e.bindTexture(i.TEXTURE_CUBE_MAP,tA.__webglTexture),TA(i.TEXTURE_CUBE_MAP,f.depthTexture);const LA=I.convert(f.depthTexture.format),CA=I.convert(f.depthTexture.type);let cA;f.depthTexture.format===Ki?cA=i.DEPTH_COMPONENT24:f.depthTexture.format===Kg&&(cA=i.DEPTH24_STENCIL8);for(let yA=0;yA<6;yA++)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+yA,0,cA,f.width,f.height,0,LA,CA,null)}}else W(f.depthTexture,0);const j=tA.__webglTexture,RA=R(f),BA=X?i.TEXTURE_CUBE_MAP_POSITIVE_X+F:i.TEXTURE_2D,NA=f.depthTexture.format===Kg?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;if(f.depthTexture.format===Ki)He(f)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,NA,BA,j,0,RA):i.framebufferTexture2D(i.FRAMEBUFFER,NA,BA,j,0);else if(f.depthTexture.format===Kg)He(f)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,NA,BA,j,0,RA):i.framebufferTexture2D(i.FRAMEBUFFER,NA,BA,j,0);else throw new Error("Unknown depthTexture format")}function se(b){const f=t.get(b),F=b.isWebGLCubeRenderTarget===!0;if(f.__boundDepthTexture!==b.depthTexture){const X=b.depthTexture;if(f.__depthDisposeCallback&&f.__depthDisposeCallback(),X){const tA=()=>{delete f.__boundDepthTexture,delete f.__depthDisposeCallback,X.removeEventListener("dispose",tA)};X.addEventListener("dispose",tA),f.__depthDisposeCallback=tA}f.__boundDepthTexture=X}if(b.depthTexture&&!f.__autoAllocateDepthBuffer)if(F)for(let X=0;X<6;X++)bA(f.__webglFramebuffer[X],b,X);else{const X=b.texture.mipmaps;X&&X.length>0?bA(f.__webglFramebuffer[0],b,0):bA(f.__webglFramebuffer,b,0)}else if(F){f.__webglDepthbuffer=[];for(let X=0;X<6;X++)if(e.bindFramebuffer(i.FRAMEBUFFER,f.__webglFramebuffer[X]),f.__webglDepthbuffer[X]===void 0)f.__webglDepthbuffer[X]=i.createRenderbuffer(),PA(f.__webglDepthbuffer[X],b,!1);else{const tA=b.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,j=f.__webglDepthbuffer[X];i.bindRenderbuffer(i.RENDERBUFFER,j),i.framebufferRenderbuffer(i.FRAMEBUFFER,tA,i.RENDERBUFFER,j)}}else{const X=b.texture.mipmaps;if(X&&X.length>0?e.bindFramebuffer(i.FRAMEBUFFER,f.__webglFramebuffer[0]):e.bindFramebuffer(i.FRAMEBUFFER,f.__webglFramebuffer),f.__webglDepthbuffer===void 0)f.__webglDepthbuffer=i.createRenderbuffer(),PA(f.__webglDepthbuffer,b,!1);else{const tA=b.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,j=f.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,j),i.framebufferRenderbuffer(i.FRAMEBUFFER,tA,i.RENDERBUFFER,j)}}e.bindFramebuffer(i.FRAMEBUFFER,null)}function ze(b,f,F){const X=t.get(b);f!==void 0&&wA(X.__webglFramebuffer,b,b.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),F!==void 0&&se(b)}function ne(b){const f=b.texture,F=t.get(b),X=t.get(f);b.addEventListener("dispose",y);const tA=b.textures,j=b.isWebGLCubeRenderTarget===!0,RA=tA.length>1;if(RA||(X.__webglTexture===void 0&&(X.__webglTexture=i.createTexture()),X.__version=f.version,C.memory.textures++),j){F.__webglFramebuffer=[];for(let BA=0;BA<6;BA++)if(f.mipmaps&&f.mipmaps.length>0){F.__webglFramebuffer[BA]=[];for(let NA=0;NA<f.mipmaps.length;NA++)F.__webglFramebuffer[BA][NA]=i.createFramebuffer()}else F.__webglFramebuffer[BA]=i.createFramebuffer()}else{if(f.mipmaps&&f.mipmaps.length>0){F.__webglFramebuffer=[];for(let BA=0;BA<f.mipmaps.length;BA++)F.__webglFramebuffer[BA]=i.createFramebuffer()}else F.__webglFramebuffer=i.createFramebuffer();if(RA)for(let BA=0,NA=tA.length;BA<NA;BA++){const LA=t.get(tA[BA]);LA.__webglTexture===void 0&&(LA.__webglTexture=i.createTexture(),C.memory.textures++)}if(b.samples>0&&He(b)===!1){F.__webglMultisampledFramebuffer=i.createFramebuffer(),F.__webglColorRenderbuffer=[],e.bindFramebuffer(i.FRAMEBUFFER,F.__webglMultisampledFramebuffer);for(let BA=0;BA<tA.length;BA++){const NA=tA[BA];F.__webglColorRenderbuffer[BA]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,F.__webglColorRenderbuffer[BA]);const LA=I.convert(NA.format,NA.colorSpace),CA=I.convert(NA.type),cA=_(NA.internalFormat,LA,CA,NA.colorSpace,b.isXRRenderTarget===!0),yA=R(b);i.renderbufferStorageMultisample(i.RENDERBUFFER,yA,cA,b.width,b.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+BA,i.RENDERBUFFER,F.__webglColorRenderbuffer[BA])}i.bindRenderbuffer(i.RENDERBUFFER,null),b.depthBuffer&&(F.__webglDepthRenderbuffer=i.createRenderbuffer(),PA(F.__webglDepthRenderbuffer,b,!0)),e.bindFramebuffer(i.FRAMEBUFFER,null)}}if(j){e.bindTexture(i.TEXTURE_CUBE_MAP,X.__webglTexture),TA(i.TEXTURE_CUBE_MAP,f);for(let BA=0;BA<6;BA++)if(f.mipmaps&&f.mipmaps.length>0)for(let NA=0;NA<f.mipmaps.length;NA++)wA(F.__webglFramebuffer[BA][NA],b,f,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+BA,NA);else wA(F.__webglFramebuffer[BA],b,f,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+BA,0);d(f)&&E(i.TEXTURE_CUBE_MAP),e.unbindTexture()}else if(RA){for(let BA=0,NA=tA.length;BA<NA;BA++){const LA=tA[BA],CA=t.get(LA);let cA=i.TEXTURE_2D;(b.isWebGL3DRenderTarget||b.isWebGLArrayRenderTarget)&&(cA=b.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),e.bindTexture(cA,CA.__webglTexture),TA(cA,LA),wA(F.__webglFramebuffer,b,LA,i.COLOR_ATTACHMENT0+BA,cA,0),d(LA)&&E(cA)}e.unbindTexture()}else{let BA=i.TEXTURE_2D;if((b.isWebGL3DRenderTarget||b.isWebGLArrayRenderTarget)&&(BA=b.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),e.bindTexture(BA,X.__webglTexture),TA(BA,f),f.mipmaps&&f.mipmaps.length>0)for(let NA=0;NA<f.mipmaps.length;NA++)wA(F.__webglFramebuffer[NA],b,f,i.COLOR_ATTACHMENT0,BA,NA);else wA(F.__webglFramebuffer,b,f,i.COLOR_ATTACHMENT0,BA,0);d(f)&&E(BA),e.unbindTexture()}b.depthBuffer&&se(b)}function de(b){const f=b.textures;for(let F=0,X=f.length;F<X;F++){const tA=f[F];if(d(tA)){const j=u(b),RA=t.get(tA).__webglTexture;e.bindTexture(j,RA),E(j),e.unbindTexture()}}}const _e=[],jA=[];function qe(b){if(b.samples>0){if(He(b)===!1){const f=b.textures,F=b.width,X=b.height;let tA=i.COLOR_BUFFER_BIT;const j=b.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,RA=t.get(b),BA=f.length>1;if(BA)for(let LA=0;LA<f.length;LA++)e.bindFramebuffer(i.FRAMEBUFFER,RA.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+LA,i.RENDERBUFFER,null),e.bindFramebuffer(i.FRAMEBUFFER,RA.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+LA,i.TEXTURE_2D,null,0);e.bindFramebuffer(i.READ_FRAMEBUFFER,RA.__webglMultisampledFramebuffer);const NA=b.texture.mipmaps;NA&&NA.length>0?e.bindFramebuffer(i.DRAW_FRAMEBUFFER,RA.__webglFramebuffer[0]):e.bindFramebuffer(i.DRAW_FRAMEBUFFER,RA.__webglFramebuffer);for(let LA=0;LA<f.length;LA++){if(b.resolveDepthBuffer&&(b.depthBuffer&&(tA|=i.DEPTH_BUFFER_BIT),b.stencilBuffer&&b.resolveStencilBuffer&&(tA|=i.STENCIL_BUFFER_BIT)),BA){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,RA.__webglColorRenderbuffer[LA]);const CA=t.get(f[LA]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,CA,0)}i.blitFramebuffer(0,0,F,X,0,0,F,X,tA,i.NEAREST),n===!0&&(_e.length=0,jA.length=0,_e.push(i.COLOR_ATTACHMENT0+LA),b.depthBuffer&&b.resolveDepthBuffer===!1&&(_e.push(j),jA.push(j),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,jA)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,_e))}if(e.bindFramebuffer(i.READ_FRAMEBUFFER,null),e.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),BA)for(let LA=0;LA<f.length;LA++){e.bindFramebuffer(i.FRAMEBUFFER,RA.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+LA,i.RENDERBUFFER,RA.__webglColorRenderbuffer[LA]);const CA=t.get(f[LA]).__webglTexture;e.bindFramebuffer(i.FRAMEBUFFER,RA.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+LA,i.TEXTURE_2D,CA,0)}e.bindFramebuffer(i.DRAW_FRAMEBUFFER,RA.__webglMultisampledFramebuffer)}else if(b.depthBuffer&&b.resolveDepthBuffer===!1&&n){const f=b.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[f])}}}function R(b){return Math.min(g.maxSamples,b.samples)}function He(b){const f=t.get(b);return b.samples>0&&A.has("WEBGL_multisampled_render_to_texture")===!0&&f.__useRenderToTexture!==!1}function Ee(b){const f=C.render.frame;s.get(b)!==f&&(s.set(b,f),b.update())}function we(b,f){const F=b.colorSpace,X=b.format,tA=b.type;return b.isCompressedTexture===!0||b.isVideoTexture===!0||F!==uI&&F!==rg&&(oe.getTransfer(F)===ce?(X!==jt||tA!==Gt)&&KA("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):ae("WebGLTextures: Unsupported texture color space:",F)),f}function kA(b){return typeof HTMLImageElement<"u"&&b instanceof HTMLImageElement?(a.width=b.naturalWidth||b.width,a.height=b.naturalHeight||b.height):typeof VideoFrame<"u"&&b instanceof VideoFrame?(a.width=b.displayWidth,a.height=b.displayHeight):(a.width=b.width,a.height=b.height),a}this.allocateTextureUnit=v,this.resetTextureUnits=U,this.setTexture2D=W,this.setTexture2DArray=H,this.setTexture3D=O,this.setTextureCube=z,this.rebindTextures=ze,this.setupRenderTarget=ne,this.updateRenderTargetMipmap=de,this.updateMultisampleRenderTarget=qe,this.setupDepthRenderbuffer=se,this.setupFrameBufferTexture=wA,this.useMultisampledRTT=He,this.isReversedDepthBuffer=function(){return e.buffers.depth.getReversed()}}function pm(i,A){function e(t,g=rg){let I;const C=oe.getTransfer(g);if(t===Gt)return i.UNSIGNED_BYTE;if(t===Gs)return i.UNSIGNED_SHORT_4_4_4_4;if(t===Ms)return i.UNSIGNED_SHORT_5_5_5_1;if(t===tc)return i.UNSIGNED_INT_5_9_9_9_REV;if(t===ic)return i.UNSIGNED_INT_10F_11F_11F_REV;if(t===Ac)return i.BYTE;if(t===ec)return i.SHORT;if(t===hC)return i.UNSIGNED_SHORT;if(t===Rs)return i.INT;if(t===Bi)return i.UNSIGNED_INT;if(t===Ei)return i.FLOAT;if(t===vi)return i.HALF_FLOAT;if(t===gc)return i.ALPHA;if(t===Ic)return i.RGB;if(t===jt)return i.RGBA;if(t===Ki)return i.DEPTH_COMPONENT;if(t===Kg)return i.DEPTH_STENCIL;if(t===Cc)return i.RED;if(t===Fs)return i.RED_INTEGER;if(t===xI)return i.RG;if(t===Us)return i.RG_INTEGER;if(t===Ls)return i.RGBA_INTEGER;if(t===Yo||t===To||t===qo||t===Ho)if(C===ce)if(I=A.get("WEBGL_compressed_texture_s3tc_srgb"),I!==null){if(t===Yo)return I.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(t===To)return I.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(t===qo)return I.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(t===Ho)return I.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(I=A.get("WEBGL_compressed_texture_s3tc"),I!==null){if(t===Yo)return I.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===To)return I.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===qo)return I.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===Ho)return I.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(t===vs||t===Ks||t===Js||t===Ys)if(I=A.get("WEBGL_compressed_texture_pvrtc"),I!==null){if(t===vs)return I.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===Ks)return I.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===Js)return I.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===Ys)return I.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(t===Ts||t===qs||t===Hs||t===Ps||t===Os||t===Vs||t===js)if(I=A.get("WEBGL_compressed_texture_etc"),I!==null){if(t===Ts||t===qs)return C===ce?I.COMPRESSED_SRGB8_ETC2:I.COMPRESSED_RGB8_ETC2;if(t===Hs)return C===ce?I.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:I.COMPRESSED_RGBA8_ETC2_EAC;if(t===Ps)return I.COMPRESSED_R11_EAC;if(t===Os)return I.COMPRESSED_SIGNED_R11_EAC;if(t===Vs)return I.COMPRESSED_RG11_EAC;if(t===js)return I.COMPRESSED_SIGNED_RG11_EAC}else return null;if(t===Ws||t===Xs||t===Zs||t===zs||t===$s||t===AQ||t===eQ||t===tQ||t===iQ||t===gQ||t===IQ||t===CQ||t===oQ||t===nQ)if(I=A.get("WEBGL_compressed_texture_astc"),I!==null){if(t===Ws)return C===ce?I.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:I.COMPRESSED_RGBA_ASTC_4x4_KHR;if(t===Xs)return C===ce?I.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:I.COMPRESSED_RGBA_ASTC_5x4_KHR;if(t===Zs)return C===ce?I.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:I.COMPRESSED_RGBA_ASTC_5x5_KHR;if(t===zs)return C===ce?I.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:I.COMPRESSED_RGBA_ASTC_6x5_KHR;if(t===$s)return C===ce?I.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:I.COMPRESSED_RGBA_ASTC_6x6_KHR;if(t===AQ)return C===ce?I.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:I.COMPRESSED_RGBA_ASTC_8x5_KHR;if(t===eQ)return C===ce?I.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:I.COMPRESSED_RGBA_ASTC_8x6_KHR;if(t===tQ)return C===ce?I.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:I.COMPRESSED_RGBA_ASTC_8x8_KHR;if(t===iQ)return C===ce?I.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:I.COMPRESSED_RGBA_ASTC_10x5_KHR;if(t===gQ)return C===ce?I.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:I.COMPRESSED_RGBA_ASTC_10x6_KHR;if(t===IQ)return C===ce?I.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:I.COMPRESSED_RGBA_ASTC_10x8_KHR;if(t===CQ)return C===ce?I.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:I.COMPRESSED_RGBA_ASTC_10x10_KHR;if(t===oQ)return C===ce?I.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:I.COMPRESSED_RGBA_ASTC_12x10_KHR;if(t===nQ)return C===ce?I.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:I.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(t===aQ||t===sQ||t===QQ)if(I=A.get("EXT_texture_compression_bptc"),I!==null){if(t===aQ)return C===ce?I.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:I.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(t===sQ)return I.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(t===QQ)return I.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(t===rQ||t===BQ||t===EQ||t===cQ)if(I=A.get("EXT_texture_compression_rgtc"),I!==null){if(t===rQ)return I.COMPRESSED_RED_RGTC1_EXT;if(t===BQ)return I.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(t===EQ)return I.COMPRESSED_RED_GREEN_RGTC2_EXT;if(t===cQ)return I.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return t===lC?i.UNSIGNED_INT_24_8:i[t]!==void 0?i[t]:null}return{convert:e}}const wm=`
4142
4142
  void main() {
4143
4143
 
4144
4144
  gl_Position = vec4( position, 1.0 );
@@ -4162,7 +4162,7 @@ void main() {
4162
4162
 
4163
4163
  }
4164
4164
 
4165
- }`;class ym{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(A,e){if(this.texture===null){const t=new Jc(A.texture);(A.depthNear!==e.depthNear||A.depthFar!==e.depthFar)&&(this.depthNear=A.depthNear,this.depthFar=A.depthFar),this.texture=t}}getMesh(A){if(this.texture!==null&&this.mesh===null){const e=A.cameras[0].viewport,t=new Ut({vertexShader:wm,fragmentShader:mm,uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new Ai(new En(20,20),t)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class bm extends DI{constructor(A,e){super();const t=this;let g=null,I=1,C=null,o="local-floor",n=1,a=null,s=null,Q=null,r=null,B=null,h=null;const c=typeof XRWebGLBinding<"u",d=new ym,E={},u=e.getContextAttributes();let _=null,x=null;const D=[],w=[],y=new Be;let S=null;const l=new Lt;l.viewport=new ve;const p=new Lt;p.viewport=new ve;const N=[l,p],U=new h2;let v=null,P=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Z){let gA=D[Z];return gA===void 0&&(gA=new qQ,D[Z]=gA),gA.getTargetRaySpace()},this.getControllerGrip=function(Z){let gA=D[Z];return gA===void 0&&(gA=new qQ,D[Z]=gA),gA.getGripSpace()},this.getHand=function(Z){let gA=D[Z];return gA===void 0&&(gA=new qQ,D[Z]=gA),gA.getHandSpace()};function W(Z){const gA=w.indexOf(Z.inputSource);if(gA===-1)return;const wA=D[gA];wA!==void 0&&(wA.update(Z.inputSource,Z.frame,a||C),wA.dispatchEvent({type:Z.type,data:Z.inputSource}))}function H(){g.removeEventListener("select",W),g.removeEventListener("selectstart",W),g.removeEventListener("selectend",W),g.removeEventListener("squeeze",W),g.removeEventListener("squeezestart",W),g.removeEventListener("squeezeend",W),g.removeEventListener("end",H),g.removeEventListener("inputsourceschange",O);for(let Z=0;Z<D.length;Z++){const gA=w[Z];gA!==null&&(w[Z]=null,D[Z].disconnect(gA))}v=null,P=null,d.reset();for(const Z in E)delete E[Z];A.setRenderTarget(_),B=null,r=null,Q=null,g=null,x=null,ue.stop(),t.isPresenting=!1,A.setPixelRatio(S),A.setSize(y.width,y.height,!1),t.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Z){I=Z,t.isPresenting===!0&&KA("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Z){o=Z,t.isPresenting===!0&&KA("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return a||C},this.setReferenceSpace=function(Z){a=Z},this.getBaseLayer=function(){return r!==null?r:B},this.getBinding=function(){return Q===null&&c&&(Q=new XRWebGLBinding(g,e)),Q},this.getFrame=function(){return h},this.getSession=function(){return g},this.setSession=async function(Z){if(g=Z,g!==null){if(_=A.getRenderTarget(),g.addEventListener("select",W),g.addEventListener("selectstart",W),g.addEventListener("selectend",W),g.addEventListener("squeeze",W),g.addEventListener("squeezestart",W),g.addEventListener("squeezeend",W),g.addEventListener("end",H),g.addEventListener("inputsourceschange",O),u.xrCompatible!==!0&&await e.makeXRCompatible(),S=A.getPixelRatio(),A.getSize(y),c&&"createProjectionLayer"in XRWebGLBinding.prototype){let wA=null,HA=null,bA=null;u.depth&&(bA=u.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,wA=u.stencil?Kg:Ki,HA=u.stencil?lC:Bi);const se={colorFormat:e.RGBA8,depthFormat:bA,scaleFactor:I};Q=this.getBinding(),r=Q.createProjectionLayer(se),g.updateRenderState({layers:[r]}),A.setPixelRatio(1),A.setSize(r.textureWidth,r.textureHeight,!1),x=new di(r.textureWidth,r.textureHeight,{format:jt,type:Gt,depthTexture:new NC(r.textureWidth,r.textureHeight,HA,void 0,void 0,void 0,void 0,void 0,void 0,wA),stencilBuffer:u.stencil,colorSpace:A.outputColorSpace,samples:u.antialias?4:0,resolveDepthBuffer:r.ignoreDepthValues===!1,resolveStencilBuffer:r.ignoreDepthValues===!1})}else{const wA={antialias:u.antialias,alpha:!0,depth:u.depth,stencil:u.stencil,framebufferScaleFactor:I};B=new XRWebGLLayer(g,e,wA),g.updateRenderState({baseLayer:B}),A.setPixelRatio(1),A.setSize(B.framebufferWidth,B.framebufferHeight,!1),x=new di(B.framebufferWidth,B.framebufferHeight,{format:jt,type:Gt,colorSpace:A.outputColorSpace,stencilBuffer:u.stencil,resolveDepthBuffer:B.ignoreDepthValues===!1,resolveStencilBuffer:B.ignoreDepthValues===!1})}x.isXRRenderTarget=!0,this.setFoveation(n),a=null,C=await g.requestReferenceSpace(o),ue.setContext(g),ue.start(),t.isPresenting=!0,t.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(g!==null)return g.environmentBlendMode},this.getDepthTexture=function(){return d.getDepthTexture()};function O(Z){for(let gA=0;gA<Z.removed.length;gA++){const wA=Z.removed[gA],HA=w.indexOf(wA);HA>=0&&(w[HA]=null,D[HA].disconnect(wA))}for(let gA=0;gA<Z.added.length;gA++){const wA=Z.added[gA];let HA=w.indexOf(wA);if(HA===-1){for(let se=0;se<D.length;se++)if(se>=w.length){w.push(wA),HA=se;break}else if(w[se]===null){w[se]=wA,HA=se;break}if(HA===-1)break}const bA=D[HA];bA&&bA.connect(wA)}}const z=new J,lA=new J;function QA(Z,gA,wA){z.setFromMatrixPosition(gA.matrixWorld),lA.setFromMatrixPosition(wA.matrixWorld);const HA=z.distanceTo(lA),bA=gA.projectionMatrix.elements,se=wA.projectionMatrix.elements,ze=bA[14]/(bA[10]-1),ne=bA[14]/(bA[10]+1),de=(bA[9]+1)/bA[5],_e=(bA[9]-1)/bA[5],jA=(bA[8]-1)/bA[0],qe=(se[8]+1)/se[0],R=ze*jA,He=ze*qe,Ee=HA/(-jA+qe),we=Ee*-jA;if(gA.matrixWorld.decompose(Z.position,Z.quaternion,Z.scale),Z.translateX(we),Z.translateZ(Ee),Z.matrixWorld.compose(Z.position,Z.quaternion,Z.scale),Z.matrixWorldInverse.copy(Z.matrixWorld).invert(),bA[10]===-1)Z.projectionMatrix.copy(gA.projectionMatrix),Z.projectionMatrixInverse.copy(gA.projectionMatrixInverse);else{const kA=ze+Ee,b=ne+Ee,f=R-we,F=He+(HA-we),X=de*ne/b*kA,tA=_e*ne/b*kA;Z.projectionMatrix.makePerspective(f,F,X,tA,kA,b),Z.projectionMatrixInverse.copy(Z.projectionMatrix).invert()}}function uA(Z,gA){gA===null?Z.matrixWorld.copy(Z.matrix):Z.matrixWorld.multiplyMatrices(gA.matrixWorld,Z.matrix),Z.matrixWorldInverse.copy(Z.matrixWorld).invert()}this.updateCamera=function(Z){if(g===null)return;let gA=Z.near,wA=Z.far;d.texture!==null&&(d.depthNear>0&&(gA=d.depthNear),d.depthFar>0&&(wA=d.depthFar)),U.near=p.near=l.near=gA,U.far=p.far=l.far=wA,(v!==U.near||P!==U.far)&&(g.updateRenderState({depthNear:U.near,depthFar:U.far}),v=U.near,P=U.far),U.layers.mask=Z.layers.mask|6,l.layers.mask=U.layers.mask&3,p.layers.mask=U.layers.mask&5;const HA=Z.parent,bA=U.cameras;uA(U,HA);for(let se=0;se<bA.length;se++)uA(bA[se],HA);bA.length===2?QA(U,l,p):U.projectionMatrix.copy(l.projectionMatrix),TA(Z,U,HA)};function TA(Z,gA,wA){wA===null?Z.matrix.copy(gA.matrixWorld):(Z.matrix.copy(wA.matrixWorld),Z.matrix.invert(),Z.matrix.multiply(gA.matrixWorld)),Z.matrix.decompose(Z.position,Z.quaternion,Z.scale),Z.updateMatrixWorld(!0),Z.projectionMatrix.copy(gA.projectionMatrix),Z.projectionMatrixInverse.copy(gA.projectionMatrixInverse),Z.isPerspectiveCamera&&(Z.fov=xQ*2*Math.atan(1/Z.projectionMatrix.elements[5]),Z.zoom=1)}this.getCamera=function(){return U},this.getFoveation=function(){if(!(r===null&&B===null))return n},this.setFoveation=function(Z){n=Z,r!==null&&(r.fixedFoveation=Z),B!==null&&B.fixedFoveation!==void 0&&(B.fixedFoveation=Z)},this.hasDepthSensing=function(){return d.texture!==null},this.getDepthSensingMesh=function(){return d.getMesh(U)},this.getCameraTexture=function(Z){return E[Z]};let YA=null;function Ne(Z,gA){if(s=gA.getViewerPose(a||C),h=gA,s!==null){const wA=s.views;B!==null&&(A.setRenderTargetFramebuffer(x,B.framebuffer),A.setRenderTarget(x));let HA=!1;wA.length!==U.cameras.length&&(U.cameras.length=0,HA=!0);for(let ne=0;ne<wA.length;ne++){const de=wA[ne];let _e=null;if(B!==null)_e=B.getViewport(de);else{const qe=Q.getViewSubImage(r,de);_e=qe.viewport,ne===0&&(A.setRenderTargetTextures(x,qe.colorTexture,qe.depthStencilTexture),A.setRenderTarget(x))}let jA=N[ne];jA===void 0&&(jA=new Lt,jA.layers.enable(ne),jA.viewport=new ve,N[ne]=jA),jA.matrix.fromArray(de.transform.matrix),jA.matrix.decompose(jA.position,jA.quaternion,jA.scale),jA.projectionMatrix.fromArray(de.projectionMatrix),jA.projectionMatrixInverse.copy(jA.projectionMatrix).invert(),jA.viewport.set(_e.x,_e.y,_e.width,_e.height),ne===0&&(U.matrix.copy(jA.matrix),U.matrix.decompose(U.position,U.quaternion,U.scale)),HA===!0&&U.cameras.push(jA)}const bA=g.enabledFeatures;if(bA&&bA.includes("depth-sensing")&&g.depthUsage=="gpu-optimized"&&c){Q=t.getBinding();const ne=Q.getDepthInformation(wA[0]);ne&&ne.isValid&&ne.texture&&d.init(ne,g.renderState)}if(bA&&bA.includes("camera-access")&&c){A.state.unbindTexture(),Q=t.getBinding();for(let ne=0;ne<wA.length;ne++){const de=wA[ne].camera;if(de){let _e=E[de];_e||(_e=new Jc,E[de]=_e);const jA=Q.getCameraImage(de);_e.sourceTexture=jA}}}}for(let wA=0;wA<D.length;wA++){const HA=w[wA],bA=D[wA];HA!==null&&bA!==void 0&&bA.update(HA,gA,a||C)}YA&&YA(Z,gA),gA.detectedPlanes&&t.dispatchEvent({type:"planesdetected",data:gA}),h=null}const ue=new qc;ue.setAnimationLoop(Ne),this.setAnimationLoop=function(Z){YA=Z},this.dispose=function(){}}}const Vg=new qi,Nm=new Ye;function km(i,A){function e(d,E){d.matrixAutoUpdate===!0&&d.updateMatrix(),E.value.copy(d.matrix)}function t(d,E){E.color.getRGB(d.fogColor.value,Gc(i)),E.isFog?(d.fogNear.value=E.near,d.fogFar.value=E.far):E.isFogExp2&&(d.fogDensity.value=E.density)}function g(d,E,u,_,x){E.isMeshBasicMaterial||E.isMeshLambertMaterial?I(d,E):E.isMeshToonMaterial?(I(d,E),Q(d,E)):E.isMeshPhongMaterial?(I(d,E),s(d,E)):E.isMeshStandardMaterial?(I(d,E),r(d,E),E.isMeshPhysicalMaterial&&B(d,E,x)):E.isMeshMatcapMaterial?(I(d,E),h(d,E)):E.isMeshDepthMaterial?I(d,E):E.isMeshDistanceMaterial?(I(d,E),c(d,E)):E.isMeshNormalMaterial?I(d,E):E.isLineBasicMaterial?(C(d,E),E.isLineDashedMaterial&&o(d,E)):E.isPointsMaterial?n(d,E,u,_):E.isSpriteMaterial?a(d,E):E.isShadowMaterial?(d.color.value.copy(E.color),d.opacity.value=E.opacity):E.isShaderMaterial&&(E.uniformsNeedUpdate=!1)}function I(d,E){d.opacity.value=E.opacity,E.color&&d.diffuse.value.copy(E.color),E.emissive&&d.emissive.value.copy(E.emissive).multiplyScalar(E.emissiveIntensity),E.map&&(d.map.value=E.map,e(E.map,d.mapTransform)),E.alphaMap&&(d.alphaMap.value=E.alphaMap,e(E.alphaMap,d.alphaMapTransform)),E.bumpMap&&(d.bumpMap.value=E.bumpMap,e(E.bumpMap,d.bumpMapTransform),d.bumpScale.value=E.bumpScale,E.side===It&&(d.bumpScale.value*=-1)),E.normalMap&&(d.normalMap.value=E.normalMap,e(E.normalMap,d.normalMapTransform),d.normalScale.value.copy(E.normalScale),E.side===It&&d.normalScale.value.negate()),E.displacementMap&&(d.displacementMap.value=E.displacementMap,e(E.displacementMap,d.displacementMapTransform),d.displacementScale.value=E.displacementScale,d.displacementBias.value=E.displacementBias),E.emissiveMap&&(d.emissiveMap.value=E.emissiveMap,e(E.emissiveMap,d.emissiveMapTransform)),E.specularMap&&(d.specularMap.value=E.specularMap,e(E.specularMap,d.specularMapTransform)),E.alphaTest>0&&(d.alphaTest.value=E.alphaTest);const u=A.get(E),_=u.envMap,x=u.envMapRotation;_&&(d.envMap.value=_,Vg.copy(x),Vg.x*=-1,Vg.y*=-1,Vg.z*=-1,_.isCubeTexture&&_.isRenderTargetTexture===!1&&(Vg.y*=-1,Vg.z*=-1),d.envMapRotation.value.setFromMatrix4(Nm.makeRotationFromEuler(Vg)),d.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,d.reflectivity.value=E.reflectivity,d.ior.value=E.ior,d.refractionRatio.value=E.refractionRatio),E.lightMap&&(d.lightMap.value=E.lightMap,d.lightMapIntensity.value=E.lightMapIntensity,e(E.lightMap,d.lightMapTransform)),E.aoMap&&(d.aoMap.value=E.aoMap,d.aoMapIntensity.value=E.aoMapIntensity,e(E.aoMap,d.aoMapTransform))}function C(d,E){d.diffuse.value.copy(E.color),d.opacity.value=E.opacity,E.map&&(d.map.value=E.map,e(E.map,d.mapTransform))}function o(d,E){d.dashSize.value=E.dashSize,d.totalSize.value=E.dashSize+E.gapSize,d.scale.value=E.scale}function n(d,E,u,_){d.diffuse.value.copy(E.color),d.opacity.value=E.opacity,d.size.value=E.size*u,d.scale.value=_*.5,E.map&&(d.map.value=E.map,e(E.map,d.uvTransform)),E.alphaMap&&(d.alphaMap.value=E.alphaMap,e(E.alphaMap,d.alphaMapTransform)),E.alphaTest>0&&(d.alphaTest.value=E.alphaTest)}function a(d,E){d.diffuse.value.copy(E.color),d.opacity.value=E.opacity,d.rotation.value=E.rotation,E.map&&(d.map.value=E.map,e(E.map,d.mapTransform)),E.alphaMap&&(d.alphaMap.value=E.alphaMap,e(E.alphaMap,d.alphaMapTransform)),E.alphaTest>0&&(d.alphaTest.value=E.alphaTest)}function s(d,E){d.specular.value.copy(E.specular),d.shininess.value=Math.max(E.shininess,1e-4)}function Q(d,E){E.gradientMap&&(d.gradientMap.value=E.gradientMap)}function r(d,E){d.metalness.value=E.metalness,E.metalnessMap&&(d.metalnessMap.value=E.metalnessMap,e(E.metalnessMap,d.metalnessMapTransform)),d.roughness.value=E.roughness,E.roughnessMap&&(d.roughnessMap.value=E.roughnessMap,e(E.roughnessMap,d.roughnessMapTransform)),E.envMap&&(d.envMapIntensity.value=E.envMapIntensity)}function B(d,E,u){d.ior.value=E.ior,E.sheen>0&&(d.sheenColor.value.copy(E.sheenColor).multiplyScalar(E.sheen),d.sheenRoughness.value=E.sheenRoughness,E.sheenColorMap&&(d.sheenColorMap.value=E.sheenColorMap,e(E.sheenColorMap,d.sheenColorMapTransform)),E.sheenRoughnessMap&&(d.sheenRoughnessMap.value=E.sheenRoughnessMap,e(E.sheenRoughnessMap,d.sheenRoughnessMapTransform))),E.clearcoat>0&&(d.clearcoat.value=E.clearcoat,d.clearcoatRoughness.value=E.clearcoatRoughness,E.clearcoatMap&&(d.clearcoatMap.value=E.clearcoatMap,e(E.clearcoatMap,d.clearcoatMapTransform)),E.clearcoatRoughnessMap&&(d.clearcoatRoughnessMap.value=E.clearcoatRoughnessMap,e(E.clearcoatRoughnessMap,d.clearcoatRoughnessMapTransform)),E.clearcoatNormalMap&&(d.clearcoatNormalMap.value=E.clearcoatNormalMap,e(E.clearcoatNormalMap,d.clearcoatNormalMapTransform),d.clearcoatNormalScale.value.copy(E.clearcoatNormalScale),E.side===It&&d.clearcoatNormalScale.value.negate())),E.dispersion>0&&(d.dispersion.value=E.dispersion),E.iridescence>0&&(d.iridescence.value=E.iridescence,d.iridescenceIOR.value=E.iridescenceIOR,d.iridescenceThicknessMinimum.value=E.iridescenceThicknessRange[0],d.iridescenceThicknessMaximum.value=E.iridescenceThicknessRange[1],E.iridescenceMap&&(d.iridescenceMap.value=E.iridescenceMap,e(E.iridescenceMap,d.iridescenceMapTransform)),E.iridescenceThicknessMap&&(d.iridescenceThicknessMap.value=E.iridescenceThicknessMap,e(E.iridescenceThicknessMap,d.iridescenceThicknessMapTransform))),E.transmission>0&&(d.transmission.value=E.transmission,d.transmissionSamplerMap.value=u.texture,d.transmissionSamplerSize.value.set(u.width,u.height),E.transmissionMap&&(d.transmissionMap.value=E.transmissionMap,e(E.transmissionMap,d.transmissionMapTransform)),d.thickness.value=E.thickness,E.thicknessMap&&(d.thicknessMap.value=E.thicknessMap,e(E.thicknessMap,d.thicknessMapTransform)),d.attenuationDistance.value=E.attenuationDistance,d.attenuationColor.value.copy(E.attenuationColor)),E.anisotropy>0&&(d.anisotropyVector.value.set(E.anisotropy*Math.cos(E.anisotropyRotation),E.anisotropy*Math.sin(E.anisotropyRotation)),E.anisotropyMap&&(d.anisotropyMap.value=E.anisotropyMap,e(E.anisotropyMap,d.anisotropyMapTransform))),d.specularIntensity.value=E.specularIntensity,d.specularColor.value.copy(E.specularColor),E.specularColorMap&&(d.specularColorMap.value=E.specularColorMap,e(E.specularColorMap,d.specularColorMapTransform)),E.specularIntensityMap&&(d.specularIntensityMap.value=E.specularIntensityMap,e(E.specularIntensityMap,d.specularIntensityMapTransform))}function h(d,E){E.matcap&&(d.matcap.value=E.matcap)}function c(d,E){const u=A.get(E).light;d.referencePosition.value.setFromMatrixPosition(u.matrixWorld),d.nearDistance.value=u.shadow.camera.near,d.farDistance.value=u.shadow.camera.far}return{refreshFogUniforms:t,refreshMaterialUniforms:g}}function Sm(i,A,e,t){let g={},I={},C=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function n(u,_){const x=_.program;t.uniformBlockBinding(u,x)}function a(u,_){let x=g[u.id];x===void 0&&(h(u),x=s(u),g[u.id]=x,u.addEventListener("dispose",d));const D=_.program;t.updateUBOMapping(u,D);const w=A.render.frame;I[u.id]!==w&&(r(u),I[u.id]=w)}function s(u){const _=Q();u.__bindingPointIndex=_;const x=i.createBuffer(),D=u.__size,w=u.usage;return i.bindBuffer(i.UNIFORM_BUFFER,x),i.bufferData(i.UNIFORM_BUFFER,D,w),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,_,x),x}function Q(){for(let u=0;u<o;u++)if(C.indexOf(u)===-1)return C.push(u),u;return ae("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function r(u){const _=g[u.id],x=u.uniforms,D=u.__cache;i.bindBuffer(i.UNIFORM_BUFFER,_);for(let w=0,y=x.length;w<y;w++){const S=Array.isArray(x[w])?x[w]:[x[w]];for(let l=0,p=S.length;l<p;l++){const N=S[l];if(B(N,w,l,D)===!0){const U=N.__offset,v=Array.isArray(N.value)?N.value:[N.value];let P=0;for(let W=0;W<v.length;W++){const H=v[W],O=c(H);typeof H=="number"||typeof H=="boolean"?(N.__data[0]=H,i.bufferSubData(i.UNIFORM_BUFFER,U+P,N.__data)):H.isMatrix3?(N.__data[0]=H.elements[0],N.__data[1]=H.elements[1],N.__data[2]=H.elements[2],N.__data[3]=0,N.__data[4]=H.elements[3],N.__data[5]=H.elements[4],N.__data[6]=H.elements[5],N.__data[7]=0,N.__data[8]=H.elements[6],N.__data[9]=H.elements[7],N.__data[10]=H.elements[8],N.__data[11]=0):(H.toArray(N.__data,P),P+=O.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,U,N.__data)}}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function B(u,_,x,D){const w=u.value,y=_+"_"+x;if(D[y]===void 0)return typeof w=="number"||typeof w=="boolean"?D[y]=w:D[y]=w.clone(),!0;{const S=D[y];if(typeof w=="number"||typeof w=="boolean"){if(S!==w)return D[y]=w,!0}else if(S.equals(w)===!1)return S.copy(w),!0}return!1}function h(u){const _=u.uniforms;let x=0;const D=16;for(let y=0,S=_.length;y<S;y++){const l=Array.isArray(_[y])?_[y]:[_[y]];for(let p=0,N=l.length;p<N;p++){const U=l[p],v=Array.isArray(U.value)?U.value:[U.value];for(let P=0,W=v.length;P<W;P++){const H=v[P],O=c(H),z=x%D,lA=z%O.boundary,QA=z+lA;x+=lA,QA!==0&&D-QA<O.storage&&(x+=D-QA),U.__data=new Float32Array(O.storage/Float32Array.BYTES_PER_ELEMENT),U.__offset=x,x+=O.storage}}}const w=x%D;return w>0&&(x+=D-w),u.__size=x,u.__cache={},this}function c(u){const _={boundary:0,storage:0};return typeof u=="number"||typeof u=="boolean"?(_.boundary=4,_.storage=4):u.isVector2?(_.boundary=8,_.storage=8):u.isVector3||u.isColor?(_.boundary=16,_.storage=12):u.isVector4?(_.boundary=16,_.storage=16):u.isMatrix3?(_.boundary=48,_.storage=48):u.isMatrix4?(_.boundary=64,_.storage=64):u.isTexture?KA("WebGLRenderer: Texture samplers can not be part of an uniforms group."):KA("WebGLRenderer: Unsupported uniform value type.",u),_}function d(u){const _=u.target;_.removeEventListener("dispose",d);const x=C.indexOf(_.__bindingPointIndex);C.splice(x,1),i.deleteBuffer(g[_.id]),delete g[_.id],delete I[_.id]}function E(){for(const u in g)i.deleteBuffer(g[u]);C=[],g={},I={}}return{bind:n,update:a,dispose:E}}const Rm=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let xi=null;function Gm(){return xi===null&&(xi=new a2(Rm,16,16,xI,vi),xi.name="DFG_LUT",xi.minFilter=et,xi.magFilter=et,xi.wrapS=Li,xi.wrapT=Li,xi.generateMipmaps=!1,xi.needsUpdate=!0),xi}class Mm{constructor(A={}){const{canvas:e=FD(),context:t=null,depth:g=!0,stencil:I=!1,alpha:C=!1,antialias:o=!1,premultipliedAlpha:n=!0,preserveDrawingBuffer:a=!1,powerPreference:s="default",failIfMajorPerformanceCaveat:Q=!1,reversedDepthBuffer:r=!1,outputBufferType:B=Gt}=A;this.isWebGLRenderer=!0;let h;if(t!==null){if(typeof WebGLRenderingContext<"u"&&t instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");h=t.getContextAttributes().alpha}else h=C;const c=B,d=new Set([Ls,Us,Fs]),E=new Set([Gt,Bi,hC,lC,Gs,Ms]),u=new Uint32Array(4),_=new Int32Array(4);let x=null,D=null;const w=[],y=[];let S=null;this.domElement=e,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=ri,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const l=this;let p=!1;this._outputColorSpace=Mt;let N=0,U=0,v=null,P=-1,W=null;const H=new ve,O=new ve;let z=null;const lA=new Ie(0);let QA=0,uA=e.width,TA=e.height,YA=1,Ne=null,ue=null;const Z=new ve(0,0,uA,TA),gA=new ve(0,0,uA,TA);let wA=!1;const HA=new Kc;let bA=!1,se=!1;const ze=new Ye,ne=new J,de=new ve,_e={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let jA=!1;function qe(){return v===null?YA:1}let R=t;function He(m,L){return e.getContext(m,L)}try{const m={alpha:!0,depth:g,stencil:I,antialias:o,premultipliedAlpha:n,preserveDrawingBuffer:a,powerPreference:s,failIfMajorPerformanceCaveat:Q};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${ds}`),e.addEventListener("webglcontextlost",JA,!1),e.addEventListener("webglcontextrestored",me,!1),e.addEventListener("webglcontextcreationerror",he,!1),R===null){const L="webgl2";if(R=He(L,m),R===null)throw He(L)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(m){throw ae("WebGLRenderer: "+m.message),m}let Ee,we,kA,b,f,F,X,tA,j,RA,BA,NA,LA,CA,cA,yA,SA,EA,WA,M,fA,nA,DA,IA;function eA(){Ee=new Gp(R),Ee.init(),nA=new pm(R,Ee),we=new pp(R,Ee,A,nA),kA=new Dm(R,Ee),we.reversedDepthBuffer&&r&&kA.buffers.depth.setReversed(!0),b=new Up(R),f=new om,F=new _m(R,Ee,kA,f,we,nA,b),X=new mp(l),tA=new Rp(l),j=new u2(R),DA=new Dp(R,j),RA=new Mp(R,j,b,DA),BA=new vp(R,RA,j,b),WA=new Lp(R,we,F),yA=new wp(f),NA=new Cm(l,X,tA,Ee,we,DA,yA),LA=new km(l,f),CA=new am,cA=new cm(Ee),EA=new fp(l,X,tA,kA,BA,h,n),SA=new um(l,BA,we),IA=new Sm(R,b,we,kA),M=new _p(R,Ee,b),fA=new Fp(R,Ee,b),b.programs=NA.programs,l.capabilities=we,l.extensions=Ee,l.properties=f,l.renderLists=CA,l.shadowMap=SA,l.state=kA,l.info=b}eA(),c!==Gt&&(S=new Jp(c,e.width,e.height,g,I));const rA=new bm(l,R);this.xr=rA,this.getContext=function(){return R},this.getContextAttributes=function(){return R.getContextAttributes()},this.forceContextLoss=function(){const m=Ee.get("WEBGL_lose_context");m&&m.loseContext()},this.forceContextRestore=function(){const m=Ee.get("WEBGL_lose_context");m&&m.restoreContext()},this.getPixelRatio=function(){return YA},this.setPixelRatio=function(m){m!==void 0&&(YA=m,this.setSize(uA,TA,!1))},this.getSize=function(m){return m.set(uA,TA)},this.setSize=function(m,L,q=!0){if(rA.isPresenting){KA("WebGLRenderer: Can't change size while VR device is presenting.");return}uA=m,TA=L,e.width=Math.floor(m*YA),e.height=Math.floor(L*YA),q===!0&&(e.style.width=m+"px",e.style.height=L+"px"),S!==null&&S.setSize(e.width,e.height),this.setViewport(0,0,m,L)},this.getDrawingBufferSize=function(m){return m.set(uA*YA,TA*YA).floor()},this.setDrawingBufferSize=function(m,L,q){uA=m,TA=L,YA=q,e.width=Math.floor(m*q),e.height=Math.floor(L*q),this.setViewport(0,0,m,L)},this.setEffects=function(m){if(c===Gt){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(m){for(let L=0;L<m.length;L++)if(m[L].isOutputPass===!0){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}S.setEffects(m||[])},this.getCurrentViewport=function(m){return m.copy(H)},this.getViewport=function(m){return m.copy(Z)},this.setViewport=function(m,L,q,Y){m.isVector4?Z.set(m.x,m.y,m.z,m.w):Z.set(m,L,q,Y),kA.viewport(H.copy(Z).multiplyScalar(YA).round())},this.getScissor=function(m){return m.copy(gA)},this.setScissor=function(m,L,q,Y){m.isVector4?gA.set(m.x,m.y,m.z,m.w):gA.set(m,L,q,Y),kA.scissor(O.copy(gA).multiplyScalar(YA).round())},this.getScissorTest=function(){return wA},this.setScissorTest=function(m){kA.setScissorTest(wA=m)},this.setOpaqueSort=function(m){Ne=m},this.setTransparentSort=function(m){ue=m},this.getClearColor=function(m){return m.copy(EA.getClearColor())},this.setClearColor=function(){EA.setClearColor(...arguments)},this.getClearAlpha=function(){return EA.getClearAlpha()},this.setClearAlpha=function(){EA.setClearAlpha(...arguments)},this.clear=function(m=!0,L=!0,q=!0){let Y=0;if(m){let K=!1;if(v!==null){const dA=v.texture.format;K=d.has(dA)}if(K){const dA=v.texture.type,_A=E.has(dA),xA=EA.getClearColor(),mA=EA.getClearAlpha(),GA=xA.r,UA=xA.g,MA=xA.b;_A?(u[0]=GA,u[1]=UA,u[2]=MA,u[3]=mA,R.clearBufferuiv(R.COLOR,0,u)):(_[0]=GA,_[1]=UA,_[2]=MA,_[3]=mA,R.clearBufferiv(R.COLOR,0,_))}else Y|=R.COLOR_BUFFER_BIT}L&&(Y|=R.DEPTH_BUFFER_BIT),q&&(Y|=R.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),R.clear(Y)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",JA,!1),e.removeEventListener("webglcontextrestored",me,!1),e.removeEventListener("webglcontextcreationerror",he,!1),EA.dispose(),CA.dispose(),cA.dispose(),f.dispose(),X.dispose(),tA.dispose(),BA.dispose(),DA.dispose(),IA.dispose(),NA.dispose(),rA.dispose(),rA.removeEventListener("sessionstart",fh),rA.removeEventListener("sessionend",Dh),Zg.stop()};function JA(m){m.preventDefault(),rc("WebGLRenderer: Context Lost."),p=!0}function me(){rc("WebGLRenderer: Context Restored."),p=!1;const m=b.autoReset,L=SA.enabled,q=SA.autoUpdate,Y=SA.needsUpdate,K=SA.type;eA(),b.autoReset=m,SA.enabled=L,SA.autoUpdate=q,SA.needsUpdate=Y,SA.type=K}function he(m){ae("WebGLRenderer: A WebGL context could not be created. Reason: ",m.statusMessage)}function Di(m){const L=m.target;L.removeEventListener("dispose",Di),Wi(L)}function Wi(m){Pk(m),f.remove(m)}function Pk(m){const L=f.get(m).programs;L!==void 0&&(L.forEach(function(q){NA.releaseProgram(q)}),m.isShaderMaterial&&NA.releaseShaderCache(m))}this.renderBufferDirect=function(m,L,q,Y,K,dA){L===null&&(L=_e);const _A=K.isMesh&&K.matrixWorld.determinant()<0,xA=Vk(m,L,q,Y,K);kA.setMaterial(Y,_A);let mA=q.index,GA=1;if(Y.wireframe===!0){if(mA=RA.getWireframeAttribute(q),mA===void 0)return;GA=2}const UA=q.drawRange,MA=q.attributes.position;let XA=UA.start*GA,fe=(UA.start+UA.count)*GA;dA!==null&&(XA=Math.max(XA,dA.start*GA),fe=Math.min(fe,(dA.start+dA.count)*GA)),mA!==null?(XA=Math.max(XA,0),fe=Math.min(fe,mA.count)):MA!=null&&(XA=Math.max(XA,0),fe=Math.min(fe,MA.count));const Fe=fe-XA;if(Fe<0||Fe===1/0)return;DA.setup(K,Y,xA,q,mA);let Ue,pe=M;if(mA!==null&&(Ue=j.get(mA),pe=fA,pe.setIndex(Ue)),K.isMesh)Y.wireframe===!0?(kA.setLineWidth(Y.wireframeLinewidth*qe()),pe.setMode(R.LINES)):pe.setMode(R.TRIANGLES);else if(K.isLine){let FA=Y.linewidth;FA===void 0&&(FA=1),kA.setLineWidth(FA*qe()),K.isLineSegments?pe.setMode(R.LINES):K.isLineLoop?pe.setMode(R.LINE_LOOP):pe.setMode(R.LINE_STRIP)}else K.isPoints?pe.setMode(R.POINTS):K.isSprite&&pe.setMode(R.TRIANGLES);if(K.isBatchedMesh)if(K._multiDrawInstances!==null)xC("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),pe.renderMultiDrawInstances(K._multiDrawStarts,K._multiDrawCounts,K._multiDrawCount,K._multiDrawInstances);else if(Ee.get("WEBGL_multi_draw"))pe.renderMultiDraw(K._multiDrawStarts,K._multiDrawCounts,K._multiDrawCount);else{const FA=K._multiDrawStarts,le=K._multiDrawCounts,Qe=K._multiDrawCount,kt=mA?j.get(mA).bytesPerElement:1,qI=f.get(Y).currentProgram.getUniforms();for(let St=0;St<Qe;St++)qI.setValue(R,"_gl_DrawID",St),pe.render(FA[St]/kt,le[St])}else if(K.isInstancedMesh)pe.renderInstances(XA,Fe,K.count);else if(q.isInstancedBufferGeometry){const FA=q._maxInstanceCount!==void 0?q._maxInstanceCount:1/0,le=Math.min(q.instanceCount,FA);pe.renderInstances(XA,Fe,le)}else pe.render(XA,Fe)};function uh(m,L,q){m.transparent===!0&&m.side===Fi&&m.forceSinglePass===!1?(m.side=It,m.needsUpdate=!0,vn(m,L,q),m.side=Mi,m.needsUpdate=!0,vn(m,L,q),m.side=Fi):vn(m,L,q)}this.compile=function(m,L,q=null){q===null&&(q=m),D=cA.get(q),D.init(L),y.push(D),q.traverseVisible(function(K){K.isLight&&K.layers.test(L.layers)&&(D.pushLight(K),K.castShadow&&D.pushShadow(K))}),m!==q&&m.traverseVisible(function(K){K.isLight&&K.layers.test(L.layers)&&(D.pushLight(K),K.castShadow&&D.pushShadow(K))}),D.setupLights();const Y=new Set;return m.traverse(function(K){if(!(K.isMesh||K.isPoints||K.isLine||K.isSprite))return;const dA=K.material;if(dA)if(Array.isArray(dA))for(let _A=0;_A<dA.length;_A++){const xA=dA[_A];uh(xA,q,K),Y.add(xA)}else uh(dA,q,K),Y.add(dA)}),D=y.pop(),Y},this.compileAsync=function(m,L,q=null){const Y=this.compile(m,L,q);return new Promise(K=>{function dA(){if(Y.forEach(function(_A){f.get(_A).currentProgram.isReady()&&Y.delete(_A)}),Y.size===0){K(m);return}setTimeout(dA,10)}Ee.get("KHR_parallel_shader_compile")!==null?dA():setTimeout(dA,10)})};let pr=null;function Ok(m){pr&&pr(m)}function fh(){Zg.stop()}function Dh(){Zg.start()}const Zg=new qc;Zg.setAnimationLoop(Ok),typeof self<"u"&&Zg.setContext(self),this.setAnimationLoop=function(m){pr=m,rA.setAnimationLoop(m),m===null?Zg.stop():Zg.start()},rA.addEventListener("sessionstart",fh),rA.addEventListener("sessionend",Dh),this.render=function(m,L){if(L!==void 0&&L.isCamera!==!0){ae("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(p===!0)return;const q=rA.enabled===!0&&rA.isPresenting===!0,Y=S!==null&&(v===null||q)&&S.begin(l,v);if(m.matrixWorldAutoUpdate===!0&&m.updateMatrixWorld(),L.parent===null&&L.matrixWorldAutoUpdate===!0&&L.updateMatrixWorld(),rA.enabled===!0&&rA.isPresenting===!0&&(S===null||S.isCompositing()===!1)&&(rA.cameraAutoUpdate===!0&&rA.updateCamera(L),L=rA.getCamera()),m.isScene===!0&&m.onBeforeRender(l,m,L,v),D=cA.get(m,y.length),D.init(L),y.push(D),ze.multiplyMatrices(L.projectionMatrix,L.matrixWorldInverse),HA.setFromProjectionMatrix(ze,ci,L.reversedDepth),se=this.localClippingEnabled,bA=yA.init(this.clippingPlanes,se),x=CA.get(m,w.length),x.init(),w.push(x),rA.enabled===!0&&rA.isPresenting===!0){const _A=l.xr.getDepthSensingMesh();_A!==null&&wr(_A,L,-1/0,l.sortObjects)}wr(m,L,0,l.sortObjects),x.finish(),l.sortObjects===!0&&x.sort(Ne,ue),jA=rA.enabled===!1||rA.isPresenting===!1||rA.hasDepthSensing()===!1,jA&&EA.addToRenderList(x,m),this.info.render.frame++,bA===!0&&yA.beginShadows();const K=D.state.shadowsArray;if(SA.render(K,m,L),bA===!0&&yA.endShadows(),this.info.autoReset===!0&&this.info.reset(),(Y&&S.hasRenderPass())===!1){const _A=x.opaque,xA=x.transmissive;if(D.setupLights(),L.isArrayCamera){const mA=L.cameras;if(xA.length>0)for(let GA=0,UA=mA.length;GA<UA;GA++){const MA=mA[GA];ph(_A,xA,m,MA)}jA&&EA.render(m);for(let GA=0,UA=mA.length;GA<UA;GA++){const MA=mA[GA];_h(x,m,MA,MA.viewport)}}else xA.length>0&&ph(_A,xA,m,L),jA&&EA.render(m),_h(x,m,L)}v!==null&&U===0&&(F.updateMultisampleRenderTarget(v),F.updateRenderTargetMipmap(v)),Y&&S.end(l),m.isScene===!0&&m.onAfterRender(l,m,L),DA.resetDefaultState(),P=-1,W=null,y.pop(),y.length>0?(D=y[y.length-1],bA===!0&&yA.setGlobalState(l.clippingPlanes,D.state.camera)):D=null,w.pop(),w.length>0?x=w[w.length-1]:x=null};function wr(m,L,q,Y){if(m.visible===!1)return;if(m.layers.test(L.layers)){if(m.isGroup)q=m.renderOrder;else if(m.isLOD)m.autoUpdate===!0&&m.update(L);else if(m.isLight)D.pushLight(m),m.castShadow&&D.pushShadow(m);else if(m.isSprite){if(!m.frustumCulled||HA.intersectsSprite(m)){Y&&de.setFromMatrixPosition(m.matrixWorld).applyMatrix4(ze);const _A=BA.update(m),xA=m.material;xA.visible&&x.push(m,_A,xA,q,de.z,null)}}else if((m.isMesh||m.isLine||m.isPoints)&&(!m.frustumCulled||HA.intersectsObject(m))){const _A=BA.update(m),xA=m.material;if(Y&&(m.boundingSphere!==void 0?(m.boundingSphere===null&&m.computeBoundingSphere(),de.copy(m.boundingSphere.center)):(_A.boundingSphere===null&&_A.computeBoundingSphere(),de.copy(_A.boundingSphere.center)),de.applyMatrix4(m.matrixWorld).applyMatrix4(ze)),Array.isArray(xA)){const mA=_A.groups;for(let GA=0,UA=mA.length;GA<UA;GA++){const MA=mA[GA],XA=xA[MA.materialIndex];XA&&XA.visible&&x.push(m,_A,XA,q,de.z,MA)}}else xA.visible&&x.push(m,_A,xA,q,de.z,null)}}const dA=m.children;for(let _A=0,xA=dA.length;_A<xA;_A++)wr(dA[_A],L,q,Y)}function _h(m,L,q,Y){const{opaque:K,transmissive:dA,transparent:_A}=m;D.setupLightsView(q),bA===!0&&yA.setGlobalState(l.clippingPlanes,q),Y&&kA.viewport(H.copy(Y)),K.length>0&&Ln(K,L,q),dA.length>0&&Ln(dA,L,q),_A.length>0&&Ln(_A,L,q),kA.buffers.depth.setTest(!0),kA.buffers.depth.setMask(!0),kA.buffers.color.setMask(!0),kA.setPolygonOffset(!1)}function ph(m,L,q,Y){if((q.isScene===!0?q.overrideMaterial:null)!==null)return;if(D.state.transmissionRenderTarget[Y.id]===void 0){const XA=Ee.has("EXT_color_buffer_half_float")||Ee.has("EXT_color_buffer_float");D.state.transmissionRenderTarget[Y.id]=new di(1,1,{generateMipmaps:!0,type:XA?vi:Gt,minFilter:vg,samples:we.samples,stencilBuffer:I,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:oe.workingColorSpace})}const dA=D.state.transmissionRenderTarget[Y.id],_A=Y.viewport||H;dA.setSize(_A.z*l.transmissionResolutionScale,_A.w*l.transmissionResolutionScale);const xA=l.getRenderTarget(),mA=l.getActiveCubeFace(),GA=l.getActiveMipmapLevel();l.setRenderTarget(dA),l.getClearColor(lA),QA=l.getClearAlpha(),QA<1&&l.setClearColor(16777215,.5),l.clear(),jA&&EA.render(q);const UA=l.toneMapping;l.toneMapping=ri;const MA=Y.viewport;if(Y.viewport!==void 0&&(Y.viewport=void 0),D.setupLightsView(Y),bA===!0&&yA.setGlobalState(l.clippingPlanes,Y),Ln(m,q,Y),F.updateMultisampleRenderTarget(dA),F.updateRenderTargetMipmap(dA),Ee.has("WEBGL_multisampled_render_to_texture")===!1){let XA=!1;for(let fe=0,Fe=L.length;fe<Fe;fe++){const Ue=L[fe],{object:pe,geometry:FA,material:le,group:Qe}=Ue;if(le.side===Fi&&pe.layers.test(Y.layers)){const kt=le.side;le.side=It,le.needsUpdate=!0,wh(pe,q,Y,FA,le,Qe),le.side=kt,le.needsUpdate=!0,XA=!0}}XA===!0&&(F.updateMultisampleRenderTarget(dA),F.updateRenderTargetMipmap(dA))}l.setRenderTarget(xA,mA,GA),l.setClearColor(lA,QA),MA!==void 0&&(Y.viewport=MA),l.toneMapping=UA}function Ln(m,L,q){const Y=L.isScene===!0?L.overrideMaterial:null;for(let K=0,dA=m.length;K<dA;K++){const _A=m[K],{object:xA,geometry:mA,group:GA}=_A;let UA=_A.material;UA.allowOverride===!0&&Y!==null&&(UA=Y),xA.layers.test(q.layers)&&wh(xA,L,q,mA,UA,GA)}}function wh(m,L,q,Y,K,dA){m.onBeforeRender(l,L,q,Y,K,dA),m.modelViewMatrix.multiplyMatrices(q.matrixWorldInverse,m.matrixWorld),m.normalMatrix.getNormalMatrix(m.modelViewMatrix),K.onBeforeRender(l,L,q,Y,m,dA),K.transparent===!0&&K.side===Fi&&K.forceSinglePass===!1?(K.side=It,K.needsUpdate=!0,l.renderBufferDirect(q,L,Y,K,m,dA),K.side=Mi,K.needsUpdate=!0,l.renderBufferDirect(q,L,Y,K,m,dA),K.side=Fi):l.renderBufferDirect(q,L,Y,K,m,dA),m.onAfterRender(l,L,q,Y,K,dA)}function vn(m,L,q){L.isScene!==!0&&(L=_e);const Y=f.get(m),K=D.state.lights,dA=D.state.shadowsArray,_A=K.state.version,xA=NA.getParameters(m,K.state,dA,L,q),mA=NA.getProgramCacheKey(xA);let GA=Y.programs;Y.environment=m.isMeshStandardMaterial?L.environment:null,Y.fog=L.fog,Y.envMap=(m.isMeshStandardMaterial?tA:X).get(m.envMap||Y.environment),Y.envMapRotation=Y.environment!==null&&m.envMap===null?L.environmentRotation:m.envMapRotation,GA===void 0&&(m.addEventListener("dispose",Di),GA=new Map,Y.programs=GA);let UA=GA.get(mA);if(UA!==void 0){if(Y.currentProgram===UA&&Y.lightsStateVersion===_A)return yh(m,xA),UA}else xA.uniforms=NA.getUniforms(m),m.onBeforeCompile(xA,l),UA=NA.acquireProgram(xA,mA),GA.set(mA,UA),Y.uniforms=xA.uniforms;const MA=Y.uniforms;return(!m.isShaderMaterial&&!m.isRawShaderMaterial||m.clipping===!0)&&(MA.clippingPlanes=yA.uniform),yh(m,xA),Y.needsLights=Wk(m),Y.lightsStateVersion=_A,Y.needsLights&&(MA.ambientLightColor.value=K.state.ambient,MA.lightProbe.value=K.state.probe,MA.directionalLights.value=K.state.directional,MA.directionalLightShadows.value=K.state.directionalShadow,MA.spotLights.value=K.state.spot,MA.spotLightShadows.value=K.state.spotShadow,MA.rectAreaLights.value=K.state.rectArea,MA.ltc_1.value=K.state.rectAreaLTC1,MA.ltc_2.value=K.state.rectAreaLTC2,MA.pointLights.value=K.state.point,MA.pointLightShadows.value=K.state.pointShadow,MA.hemisphereLights.value=K.state.hemi,MA.directionalShadowMap.value=K.state.directionalShadowMap,MA.directionalShadowMatrix.value=K.state.directionalShadowMatrix,MA.spotShadowMap.value=K.state.spotShadowMap,MA.spotLightMatrix.value=K.state.spotLightMatrix,MA.spotLightMap.value=K.state.spotLightMap,MA.pointShadowMap.value=K.state.pointShadowMap,MA.pointShadowMatrix.value=K.state.pointShadowMatrix),Y.currentProgram=UA,Y.uniformsList=null,UA}function mh(m){if(m.uniformsList===null){const L=m.currentProgram.getUniforms();m.uniformsList=ln.seqWithValue(L.seq,m.uniforms)}return m.uniformsList}function yh(m,L){const q=f.get(m);q.outputColorSpace=L.outputColorSpace,q.batching=L.batching,q.batchingColor=L.batchingColor,q.instancing=L.instancing,q.instancingColor=L.instancingColor,q.instancingMorph=L.instancingMorph,q.skinning=L.skinning,q.morphTargets=L.morphTargets,q.morphNormals=L.morphNormals,q.morphColors=L.morphColors,q.morphTargetsCount=L.morphTargetsCount,q.numClippingPlanes=L.numClippingPlanes,q.numIntersection=L.numClipIntersection,q.vertexAlphas=L.vertexAlphas,q.vertexTangents=L.vertexTangents,q.toneMapping=L.toneMapping}function Vk(m,L,q,Y,K){L.isScene!==!0&&(L=_e),F.resetTextureUnits();const dA=L.fog,_A=Y.isMeshStandardMaterial?L.environment:null,xA=v===null?l.outputColorSpace:v.isXRRenderTarget===!0?v.texture.colorSpace:uI,mA=(Y.isMeshStandardMaterial?tA:X).get(Y.envMap||_A),GA=Y.vertexColors===!0&&!!q.attributes.color&&q.attributes.color.itemSize===4,UA=!!q.attributes.tangent&&(!!Y.normalMap||Y.anisotropy>0),MA=!!q.morphAttributes.position,XA=!!q.morphAttributes.normal,fe=!!q.morphAttributes.color;let Fe=ri;Y.toneMapped&&(v===null||v.isXRRenderTarget===!0)&&(Fe=l.toneMapping);const Ue=q.morphAttributes.position||q.morphAttributes.normal||q.morphAttributes.color,pe=Ue!==void 0?Ue.length:0,FA=f.get(Y),le=D.state.lights;if(bA===!0&&(se===!0||m!==W)){const Bt=m===W&&Y.id===P;yA.setState(Y,m,Bt)}let Qe=!1;Y.version===FA.__version?(FA.needsLights&&FA.lightsStateVersion!==le.state.version||FA.outputColorSpace!==xA||K.isBatchedMesh&&FA.batching===!1||!K.isBatchedMesh&&FA.batching===!0||K.isBatchedMesh&&FA.batchingColor===!0&&K.colorTexture===null||K.isBatchedMesh&&FA.batchingColor===!1&&K.colorTexture!==null||K.isInstancedMesh&&FA.instancing===!1||!K.isInstancedMesh&&FA.instancing===!0||K.isSkinnedMesh&&FA.skinning===!1||!K.isSkinnedMesh&&FA.skinning===!0||K.isInstancedMesh&&FA.instancingColor===!0&&K.instanceColor===null||K.isInstancedMesh&&FA.instancingColor===!1&&K.instanceColor!==null||K.isInstancedMesh&&FA.instancingMorph===!0&&K.morphTexture===null||K.isInstancedMesh&&FA.instancingMorph===!1&&K.morphTexture!==null||FA.envMap!==mA||Y.fog===!0&&FA.fog!==dA||FA.numClippingPlanes!==void 0&&(FA.numClippingPlanes!==yA.numPlanes||FA.numIntersection!==yA.numIntersection)||FA.vertexAlphas!==GA||FA.vertexTangents!==UA||FA.morphTargets!==MA||FA.morphNormals!==XA||FA.morphColors!==fe||FA.toneMapping!==Fe||FA.morphTargetsCount!==pe)&&(Qe=!0):(Qe=!0,FA.__version=Y.version);let kt=FA.currentProgram;Qe===!0&&(kt=vn(Y,L,K));let qI=!1,St=!1,XC=!1;const ye=kt.getUniforms(),ut=FA.uniforms;if(kA.useProgram(kt.program)&&(qI=!0,St=!0,XC=!0),Y.id!==P&&(P=Y.id,St=!0),qI||W!==m){kA.buffers.depth.getReversed()&&m.reversedDepth!==!0&&(m._reversedDepth=!0,m.updateProjectionMatrix()),ye.setValue(R,"projectionMatrix",m.projectionMatrix),ye.setValue(R,"viewMatrix",m.matrixWorldInverse);const ft=ye.map.cameraPosition;ft!==void 0&&ft.setValue(R,ne.setFromMatrixPosition(m.matrixWorld)),we.logarithmicDepthBuffer&&ye.setValue(R,"logDepthBufFC",2/(Math.log(m.far+1)/Math.LN2)),(Y.isMeshPhongMaterial||Y.isMeshToonMaterial||Y.isMeshLambertMaterial||Y.isMeshBasicMaterial||Y.isMeshStandardMaterial||Y.isShaderMaterial)&&ye.setValue(R,"isOrthographic",m.isOrthographicCamera===!0),W!==m&&(W=m,St=!0,XC=!0)}if(FA.needsLights&&(le.state.directionalShadowMap.length>0&&ye.setValue(R,"directionalShadowMap",le.state.directionalShadowMap,F),le.state.spotShadowMap.length>0&&ye.setValue(R,"spotShadowMap",le.state.spotShadowMap,F),le.state.pointShadowMap.length>0&&ye.setValue(R,"pointShadowMap",le.state.pointShadowMap,F)),K.isSkinnedMesh){ye.setOptional(R,K,"bindMatrix"),ye.setOptional(R,K,"bindMatrixInverse");const Bt=K.skeleton;Bt&&(Bt.boneTexture===null&&Bt.computeBoneTexture(),ye.setValue(R,"boneTexture",Bt.boneTexture,F))}K.isBatchedMesh&&(ye.setOptional(R,K,"batchingTexture"),ye.setValue(R,"batchingTexture",K._matricesTexture,F),ye.setOptional(R,K,"batchingIdTexture"),ye.setValue(R,"batchingIdTexture",K._indirectTexture,F),ye.setOptional(R,K,"batchingColorTexture"),K._colorsTexture!==null&&ye.setValue(R,"batchingColorTexture",K._colorsTexture,F));const vt=q.morphAttributes;if((vt.position!==void 0||vt.normal!==void 0||vt.color!==void 0)&&WA.update(K,q,kt),(St||FA.receiveShadow!==K.receiveShadow)&&(FA.receiveShadow=K.receiveShadow,ye.setValue(R,"receiveShadow",K.receiveShadow)),Y.isMeshGouraudMaterial&&Y.envMap!==null&&(ut.envMap.value=mA,ut.flipEnvMap.value=mA.isCubeTexture&&mA.isRenderTargetTexture===!1?-1:1),Y.isMeshStandardMaterial&&Y.envMap===null&&L.environment!==null&&(ut.envMapIntensity.value=L.environmentIntensity),ut.dfgLUT!==void 0&&(ut.dfgLUT.value=Gm()),St&&(ye.setValue(R,"toneMappingExposure",l.toneMappingExposure),FA.needsLights&&jk(ut,XC),dA&&Y.fog===!0&&LA.refreshFogUniforms(ut,dA),LA.refreshMaterialUniforms(ut,Y,YA,TA,D.state.transmissionRenderTarget[m.id]),ln.upload(R,mh(FA),ut,F)),Y.isShaderMaterial&&Y.uniformsNeedUpdate===!0&&(ln.upload(R,mh(FA),ut,F),Y.uniformsNeedUpdate=!1),Y.isSpriteMaterial&&ye.setValue(R,"center",K.center),ye.setValue(R,"modelViewMatrix",K.modelViewMatrix),ye.setValue(R,"normalMatrix",K.normalMatrix),ye.setValue(R,"modelMatrix",K.matrixWorld),Y.isShaderMaterial||Y.isRawShaderMaterial){const Bt=Y.uniformsGroups;for(let ft=0,mr=Bt.length;ft<mr;ft++){const zg=Bt[ft];IA.update(zg,kt),IA.bind(zg,kt)}}return kt}function jk(m,L){m.ambientLightColor.needsUpdate=L,m.lightProbe.needsUpdate=L,m.directionalLights.needsUpdate=L,m.directionalLightShadows.needsUpdate=L,m.pointLights.needsUpdate=L,m.pointLightShadows.needsUpdate=L,m.spotLights.needsUpdate=L,m.spotLightShadows.needsUpdate=L,m.rectAreaLights.needsUpdate=L,m.hemisphereLights.needsUpdate=L}function Wk(m){return m.isMeshLambertMaterial||m.isMeshToonMaterial||m.isMeshPhongMaterial||m.isMeshStandardMaterial||m.isShadowMaterial||m.isShaderMaterial&&m.lights===!0}this.getActiveCubeFace=function(){return N},this.getActiveMipmapLevel=function(){return U},this.getRenderTarget=function(){return v},this.setRenderTargetTextures=function(m,L,q){const Y=f.get(m);Y.__autoAllocateDepthBuffer=m.resolveDepthBuffer===!1,Y.__autoAllocateDepthBuffer===!1&&(Y.__useRenderToTexture=!1),f.get(m.texture).__webglTexture=L,f.get(m.depthTexture).__webglTexture=Y.__autoAllocateDepthBuffer?void 0:q,Y.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(m,L){const q=f.get(m);q.__webglFramebuffer=L,q.__useDefaultFramebuffer=L===void 0};const Xk=R.createFramebuffer();this.setRenderTarget=function(m,L=0,q=0){v=m,N=L,U=q;let Y=null,K=!1,dA=!1;if(m){const xA=f.get(m);if(xA.__useDefaultFramebuffer!==void 0){kA.bindFramebuffer(R.FRAMEBUFFER,xA.__webglFramebuffer),H.copy(m.viewport),O.copy(m.scissor),z=m.scissorTest,kA.viewport(H),kA.scissor(O),kA.setScissorTest(z),P=-1;return}else if(xA.__webglFramebuffer===void 0)F.setupRenderTarget(m);else if(xA.__hasExternalTextures)F.rebindTextures(m,f.get(m.texture).__webglTexture,f.get(m.depthTexture).__webglTexture);else if(m.depthBuffer){const UA=m.depthTexture;if(xA.__boundDepthTexture!==UA){if(UA!==null&&f.has(UA)&&(m.width!==UA.image.width||m.height!==UA.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");F.setupDepthRenderbuffer(m)}}const mA=m.texture;(mA.isData3DTexture||mA.isDataArrayTexture||mA.isCompressedArrayTexture)&&(dA=!0);const GA=f.get(m).__webglFramebuffer;m.isWebGLCubeRenderTarget?(Array.isArray(GA[L])?Y=GA[L][q]:Y=GA[L],K=!0):m.samples>0&&F.useMultisampledRTT(m)===!1?Y=f.get(m).__webglMultisampledFramebuffer:Array.isArray(GA)?Y=GA[q]:Y=GA,H.copy(m.viewport),O.copy(m.scissor),z=m.scissorTest}else H.copy(Z).multiplyScalar(YA).floor(),O.copy(gA).multiplyScalar(YA).floor(),z=wA;if(q!==0&&(Y=Xk),kA.bindFramebuffer(R.FRAMEBUFFER,Y)&&kA.drawBuffers(m,Y),kA.viewport(H),kA.scissor(O),kA.setScissorTest(z),K){const xA=f.get(m.texture);R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_CUBE_MAP_POSITIVE_X+L,xA.__webglTexture,q)}else if(dA){const xA=L;for(let mA=0;mA<m.textures.length;mA++){const GA=f.get(m.textures[mA]);R.framebufferTextureLayer(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0+mA,GA.__webglTexture,q,xA)}}else if(m!==null&&q!==0){const xA=f.get(m.texture);R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_2D,xA.__webglTexture,q)}P=-1},this.readRenderTargetPixels=function(m,L,q,Y,K,dA,_A,xA=0){if(!(m&&m.isWebGLRenderTarget)){ae("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let mA=f.get(m).__webglFramebuffer;if(m.isWebGLCubeRenderTarget&&_A!==void 0&&(mA=mA[_A]),mA){kA.bindFramebuffer(R.FRAMEBUFFER,mA);try{const GA=m.textures[xA],UA=GA.format,MA=GA.type;if(!we.textureFormatReadable(UA)){ae("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!we.textureTypeReadable(MA)){ae("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}L>=0&&L<=m.width-Y&&q>=0&&q<=m.height-K&&(m.textures.length>1&&R.readBuffer(R.COLOR_ATTACHMENT0+xA),R.readPixels(L,q,Y,K,nA.convert(UA),nA.convert(MA),dA))}finally{const GA=v!==null?f.get(v).__webglFramebuffer:null;kA.bindFramebuffer(R.FRAMEBUFFER,GA)}}},this.readRenderTargetPixelsAsync=async function(m,L,q,Y,K,dA,_A,xA=0){if(!(m&&m.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let mA=f.get(m).__webglFramebuffer;if(m.isWebGLCubeRenderTarget&&_A!==void 0&&(mA=mA[_A]),mA)if(L>=0&&L<=m.width-Y&&q>=0&&q<=m.height-K){kA.bindFramebuffer(R.FRAMEBUFFER,mA);const GA=m.textures[xA],UA=GA.format,MA=GA.type;if(!we.textureFormatReadable(UA))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!we.textureTypeReadable(MA))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const XA=R.createBuffer();R.bindBuffer(R.PIXEL_PACK_BUFFER,XA),R.bufferData(R.PIXEL_PACK_BUFFER,dA.byteLength,R.STREAM_READ),m.textures.length>1&&R.readBuffer(R.COLOR_ATTACHMENT0+xA),R.readPixels(L,q,Y,K,nA.convert(UA),nA.convert(MA),0);const fe=v!==null?f.get(v).__webglFramebuffer:null;kA.bindFramebuffer(R.FRAMEBUFFER,fe);const Fe=R.fenceSync(R.SYNC_GPU_COMMANDS_COMPLETE,0);return R.flush(),await UD(R,Fe,4),R.bindBuffer(R.PIXEL_PACK_BUFFER,XA),R.getBufferSubData(R.PIXEL_PACK_BUFFER,0,dA),R.deleteBuffer(XA),R.deleteSync(Fe),dA}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(m,L=null,q=0){const Y=Math.pow(2,-q),K=Math.floor(m.image.width*Y),dA=Math.floor(m.image.height*Y),_A=L!==null?L.x:0,xA=L!==null?L.y:0;F.setTexture2D(m,0),R.copyTexSubImage2D(R.TEXTURE_2D,q,0,0,_A,xA,K,dA),kA.unbindTexture()};const Zk=R.createFramebuffer(),zk=R.createFramebuffer();this.copyTextureToTexture=function(m,L,q=null,Y=null,K=0,dA=null){dA===null&&(K!==0?(xC("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),dA=K,K=0):dA=0);let _A,xA,mA,GA,UA,MA,XA,fe,Fe;const Ue=m.isCompressedTexture?m.mipmaps[dA]:m.image;if(q!==null)_A=q.max.x-q.min.x,xA=q.max.y-q.min.y,mA=q.isBox3?q.max.z-q.min.z:1,GA=q.min.x,UA=q.min.y,MA=q.isBox3?q.min.z:0;else{const vt=Math.pow(2,-K);_A=Math.floor(Ue.width*vt),xA=Math.floor(Ue.height*vt),m.isDataArrayTexture?mA=Ue.depth:m.isData3DTexture?mA=Math.floor(Ue.depth*vt):mA=1,GA=0,UA=0,MA=0}Y!==null?(XA=Y.x,fe=Y.y,Fe=Y.z):(XA=0,fe=0,Fe=0);const pe=nA.convert(L.format),FA=nA.convert(L.type);let le;L.isData3DTexture?(F.setTexture3D(L,0),le=R.TEXTURE_3D):L.isDataArrayTexture||L.isCompressedArrayTexture?(F.setTexture2DArray(L,0),le=R.TEXTURE_2D_ARRAY):(F.setTexture2D(L,0),le=R.TEXTURE_2D),R.pixelStorei(R.UNPACK_FLIP_Y_WEBGL,L.flipY),R.pixelStorei(R.UNPACK_PREMULTIPLY_ALPHA_WEBGL,L.premultiplyAlpha),R.pixelStorei(R.UNPACK_ALIGNMENT,L.unpackAlignment);const Qe=R.getParameter(R.UNPACK_ROW_LENGTH),kt=R.getParameter(R.UNPACK_IMAGE_HEIGHT),qI=R.getParameter(R.UNPACK_SKIP_PIXELS),St=R.getParameter(R.UNPACK_SKIP_ROWS),XC=R.getParameter(R.UNPACK_SKIP_IMAGES);R.pixelStorei(R.UNPACK_ROW_LENGTH,Ue.width),R.pixelStorei(R.UNPACK_IMAGE_HEIGHT,Ue.height),R.pixelStorei(R.UNPACK_SKIP_PIXELS,GA),R.pixelStorei(R.UNPACK_SKIP_ROWS,UA),R.pixelStorei(R.UNPACK_SKIP_IMAGES,MA);const ye=m.isDataArrayTexture||m.isData3DTexture,ut=L.isDataArrayTexture||L.isData3DTexture;if(m.isDepthTexture){const vt=f.get(m),Bt=f.get(L),ft=f.get(vt.__renderTarget),mr=f.get(Bt.__renderTarget);kA.bindFramebuffer(R.READ_FRAMEBUFFER,ft.__webglFramebuffer),kA.bindFramebuffer(R.DRAW_FRAMEBUFFER,mr.__webglFramebuffer);for(let zg=0;zg<mA;zg++)ye&&(R.framebufferTextureLayer(R.READ_FRAMEBUFFER,R.COLOR_ATTACHMENT0,f.get(m).__webglTexture,K,MA+zg),R.framebufferTextureLayer(R.DRAW_FRAMEBUFFER,R.COLOR_ATTACHMENT0,f.get(L).__webglTexture,dA,Fe+zg)),R.blitFramebuffer(GA,UA,_A,xA,XA,fe,_A,xA,R.DEPTH_BUFFER_BIT,R.NEAREST);kA.bindFramebuffer(R.READ_FRAMEBUFFER,null),kA.bindFramebuffer(R.DRAW_FRAMEBUFFER,null)}else if(K!==0||m.isRenderTargetTexture||f.has(m)){const vt=f.get(m),Bt=f.get(L);kA.bindFramebuffer(R.READ_FRAMEBUFFER,Zk),kA.bindFramebuffer(R.DRAW_FRAMEBUFFER,zk);for(let ft=0;ft<mA;ft++)ye?R.framebufferTextureLayer(R.READ_FRAMEBUFFER,R.COLOR_ATTACHMENT0,vt.__webglTexture,K,MA+ft):R.framebufferTexture2D(R.READ_FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_2D,vt.__webglTexture,K),ut?R.framebufferTextureLayer(R.DRAW_FRAMEBUFFER,R.COLOR_ATTACHMENT0,Bt.__webglTexture,dA,Fe+ft):R.framebufferTexture2D(R.DRAW_FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_2D,Bt.__webglTexture,dA),K!==0?R.blitFramebuffer(GA,UA,_A,xA,XA,fe,_A,xA,R.COLOR_BUFFER_BIT,R.NEAREST):ut?R.copyTexSubImage3D(le,dA,XA,fe,Fe+ft,GA,UA,_A,xA):R.copyTexSubImage2D(le,dA,XA,fe,GA,UA,_A,xA);kA.bindFramebuffer(R.READ_FRAMEBUFFER,null),kA.bindFramebuffer(R.DRAW_FRAMEBUFFER,null)}else ut?m.isDataTexture||m.isData3DTexture?R.texSubImage3D(le,dA,XA,fe,Fe,_A,xA,mA,pe,FA,Ue.data):L.isCompressedArrayTexture?R.compressedTexSubImage3D(le,dA,XA,fe,Fe,_A,xA,mA,pe,Ue.data):R.texSubImage3D(le,dA,XA,fe,Fe,_A,xA,mA,pe,FA,Ue):m.isDataTexture?R.texSubImage2D(R.TEXTURE_2D,dA,XA,fe,_A,xA,pe,FA,Ue.data):m.isCompressedTexture?R.compressedTexSubImage2D(R.TEXTURE_2D,dA,XA,fe,Ue.width,Ue.height,pe,Ue.data):R.texSubImage2D(R.TEXTURE_2D,dA,XA,fe,_A,xA,pe,FA,Ue);R.pixelStorei(R.UNPACK_ROW_LENGTH,Qe),R.pixelStorei(R.UNPACK_IMAGE_HEIGHT,kt),R.pixelStorei(R.UNPACK_SKIP_PIXELS,qI),R.pixelStorei(R.UNPACK_SKIP_ROWS,St),R.pixelStorei(R.UNPACK_SKIP_IMAGES,XC),dA===0&&L.generateMipmaps&&R.generateMipmap(le),kA.unbindTexture()},this.initRenderTarget=function(m){f.get(m).__webglFramebuffer===void 0&&F.setupRenderTarget(m)},this.initTexture=function(m){m.isCubeTexture?F.setTextureCube(m,0):m.isData3DTexture?F.setTexture3D(m,0):m.isDataArrayTexture||m.isCompressedArrayTexture?F.setTexture2DArray(m,0):F.setTexture2D(m,0),kA.unbindTexture()},this.resetState=function(){N=0,U=0,v=null,kA.reset(),DA.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return ci}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(A){this._outputColorSpace=A;const e=this.getContext();e.drawingBufferColorSpace=oe._getDrawingBufferColorSpace(A),e.unpackColorSpace=oe._getUnpackColorSpace()}}const Fm=`
4165
+ }`;class ym{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(A,e){if(this.texture===null){const t=new Jc(A.texture);(A.depthNear!==e.depthNear||A.depthFar!==e.depthFar)&&(this.depthNear=A.depthNear,this.depthFar=A.depthFar),this.texture=t}}getMesh(A){if(this.texture!==null&&this.mesh===null){const e=A.cameras[0].viewport,t=new Ut({vertexShader:wm,fragmentShader:mm,uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new Ai(new En(20,20),t)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class bm extends DI{constructor(A,e){super();const t=this;let g=null,I=1,C=null,o="local-floor",n=1,a=null,s=null,Q=null,r=null,B=null,h=null;const c=typeof XRWebGLBinding<"u",d=new ym,E={},u=e.getContextAttributes();let _=null,x=null;const D=[],w=[],y=new Be;let S=null;const l=new Lt;l.viewport=new ve;const p=new Lt;p.viewport=new ve;const N=[l,p],U=new h2;let v=null,P=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Z){let gA=D[Z];return gA===void 0&&(gA=new qQ,D[Z]=gA),gA.getTargetRaySpace()},this.getControllerGrip=function(Z){let gA=D[Z];return gA===void 0&&(gA=new qQ,D[Z]=gA),gA.getGripSpace()},this.getHand=function(Z){let gA=D[Z];return gA===void 0&&(gA=new qQ,D[Z]=gA),gA.getHandSpace()};function W(Z){const gA=w.indexOf(Z.inputSource);if(gA===-1)return;const wA=D[gA];wA!==void 0&&(wA.update(Z.inputSource,Z.frame,a||C),wA.dispatchEvent({type:Z.type,data:Z.inputSource}))}function H(){g.removeEventListener("select",W),g.removeEventListener("selectstart",W),g.removeEventListener("selectend",W),g.removeEventListener("squeeze",W),g.removeEventListener("squeezestart",W),g.removeEventListener("squeezeend",W),g.removeEventListener("end",H),g.removeEventListener("inputsourceschange",O);for(let Z=0;Z<D.length;Z++){const gA=w[Z];gA!==null&&(w[Z]=null,D[Z].disconnect(gA))}v=null,P=null,d.reset();for(const Z in E)delete E[Z];A.setRenderTarget(_),B=null,r=null,Q=null,g=null,x=null,ue.stop(),t.isPresenting=!1,A.setPixelRatio(S),A.setSize(y.width,y.height,!1),t.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Z){I=Z,t.isPresenting===!0&&KA("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Z){o=Z,t.isPresenting===!0&&KA("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return a||C},this.setReferenceSpace=function(Z){a=Z},this.getBaseLayer=function(){return r!==null?r:B},this.getBinding=function(){return Q===null&&c&&(Q=new XRWebGLBinding(g,e)),Q},this.getFrame=function(){return h},this.getSession=function(){return g},this.setSession=async function(Z){if(g=Z,g!==null){if(_=A.getRenderTarget(),g.addEventListener("select",W),g.addEventListener("selectstart",W),g.addEventListener("selectend",W),g.addEventListener("squeeze",W),g.addEventListener("squeezestart",W),g.addEventListener("squeezeend",W),g.addEventListener("end",H),g.addEventListener("inputsourceschange",O),u.xrCompatible!==!0&&await e.makeXRCompatible(),S=A.getPixelRatio(),A.getSize(y),c&&"createProjectionLayer"in XRWebGLBinding.prototype){let wA=null,PA=null,bA=null;u.depth&&(bA=u.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,wA=u.stencil?Kg:Ki,PA=u.stencil?lC:Bi);const se={colorFormat:e.RGBA8,depthFormat:bA,scaleFactor:I};Q=this.getBinding(),r=Q.createProjectionLayer(se),g.updateRenderState({layers:[r]}),A.setPixelRatio(1),A.setSize(r.textureWidth,r.textureHeight,!1),x=new di(r.textureWidth,r.textureHeight,{format:jt,type:Gt,depthTexture:new NC(r.textureWidth,r.textureHeight,PA,void 0,void 0,void 0,void 0,void 0,void 0,wA),stencilBuffer:u.stencil,colorSpace:A.outputColorSpace,samples:u.antialias?4:0,resolveDepthBuffer:r.ignoreDepthValues===!1,resolveStencilBuffer:r.ignoreDepthValues===!1})}else{const wA={antialias:u.antialias,alpha:!0,depth:u.depth,stencil:u.stencil,framebufferScaleFactor:I};B=new XRWebGLLayer(g,e,wA),g.updateRenderState({baseLayer:B}),A.setPixelRatio(1),A.setSize(B.framebufferWidth,B.framebufferHeight,!1),x=new di(B.framebufferWidth,B.framebufferHeight,{format:jt,type:Gt,colorSpace:A.outputColorSpace,stencilBuffer:u.stencil,resolveDepthBuffer:B.ignoreDepthValues===!1,resolveStencilBuffer:B.ignoreDepthValues===!1})}x.isXRRenderTarget=!0,this.setFoveation(n),a=null,C=await g.requestReferenceSpace(o),ue.setContext(g),ue.start(),t.isPresenting=!0,t.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(g!==null)return g.environmentBlendMode},this.getDepthTexture=function(){return d.getDepthTexture()};function O(Z){for(let gA=0;gA<Z.removed.length;gA++){const wA=Z.removed[gA],PA=w.indexOf(wA);PA>=0&&(w[PA]=null,D[PA].disconnect(wA))}for(let gA=0;gA<Z.added.length;gA++){const wA=Z.added[gA];let PA=w.indexOf(wA);if(PA===-1){for(let se=0;se<D.length;se++)if(se>=w.length){w.push(wA),PA=se;break}else if(w[se]===null){w[se]=wA,PA=se;break}if(PA===-1)break}const bA=D[PA];bA&&bA.connect(wA)}}const z=new J,lA=new J;function QA(Z,gA,wA){z.setFromMatrixPosition(gA.matrixWorld),lA.setFromMatrixPosition(wA.matrixWorld);const PA=z.distanceTo(lA),bA=gA.projectionMatrix.elements,se=wA.projectionMatrix.elements,ze=bA[14]/(bA[10]-1),ne=bA[14]/(bA[10]+1),de=(bA[9]+1)/bA[5],_e=(bA[9]-1)/bA[5],jA=(bA[8]-1)/bA[0],qe=(se[8]+1)/se[0],R=ze*jA,He=ze*qe,Ee=PA/(-jA+qe),we=Ee*-jA;if(gA.matrixWorld.decompose(Z.position,Z.quaternion,Z.scale),Z.translateX(we),Z.translateZ(Ee),Z.matrixWorld.compose(Z.position,Z.quaternion,Z.scale),Z.matrixWorldInverse.copy(Z.matrixWorld).invert(),bA[10]===-1)Z.projectionMatrix.copy(gA.projectionMatrix),Z.projectionMatrixInverse.copy(gA.projectionMatrixInverse);else{const kA=ze+Ee,b=ne+Ee,f=R-we,F=He+(PA-we),X=de*ne/b*kA,tA=_e*ne/b*kA;Z.projectionMatrix.makePerspective(f,F,X,tA,kA,b),Z.projectionMatrixInverse.copy(Z.projectionMatrix).invert()}}function uA(Z,gA){gA===null?Z.matrixWorld.copy(Z.matrix):Z.matrixWorld.multiplyMatrices(gA.matrixWorld,Z.matrix),Z.matrixWorldInverse.copy(Z.matrixWorld).invert()}this.updateCamera=function(Z){if(g===null)return;let gA=Z.near,wA=Z.far;d.texture!==null&&(d.depthNear>0&&(gA=d.depthNear),d.depthFar>0&&(wA=d.depthFar)),U.near=p.near=l.near=gA,U.far=p.far=l.far=wA,(v!==U.near||P!==U.far)&&(g.updateRenderState({depthNear:U.near,depthFar:U.far}),v=U.near,P=U.far),U.layers.mask=Z.layers.mask|6,l.layers.mask=U.layers.mask&3,p.layers.mask=U.layers.mask&5;const PA=Z.parent,bA=U.cameras;uA(U,PA);for(let se=0;se<bA.length;se++)uA(bA[se],PA);bA.length===2?QA(U,l,p):U.projectionMatrix.copy(l.projectionMatrix),TA(Z,U,PA)};function TA(Z,gA,wA){wA===null?Z.matrix.copy(gA.matrixWorld):(Z.matrix.copy(wA.matrixWorld),Z.matrix.invert(),Z.matrix.multiply(gA.matrixWorld)),Z.matrix.decompose(Z.position,Z.quaternion,Z.scale),Z.updateMatrixWorld(!0),Z.projectionMatrix.copy(gA.projectionMatrix),Z.projectionMatrixInverse.copy(gA.projectionMatrixInverse),Z.isPerspectiveCamera&&(Z.fov=xQ*2*Math.atan(1/Z.projectionMatrix.elements[5]),Z.zoom=1)}this.getCamera=function(){return U},this.getFoveation=function(){if(!(r===null&&B===null))return n},this.setFoveation=function(Z){n=Z,r!==null&&(r.fixedFoveation=Z),B!==null&&B.fixedFoveation!==void 0&&(B.fixedFoveation=Z)},this.hasDepthSensing=function(){return d.texture!==null},this.getDepthSensingMesh=function(){return d.getMesh(U)},this.getCameraTexture=function(Z){return E[Z]};let YA=null;function Ne(Z,gA){if(s=gA.getViewerPose(a||C),h=gA,s!==null){const wA=s.views;B!==null&&(A.setRenderTargetFramebuffer(x,B.framebuffer),A.setRenderTarget(x));let PA=!1;wA.length!==U.cameras.length&&(U.cameras.length=0,PA=!0);for(let ne=0;ne<wA.length;ne++){const de=wA[ne];let _e=null;if(B!==null)_e=B.getViewport(de);else{const qe=Q.getViewSubImage(r,de);_e=qe.viewport,ne===0&&(A.setRenderTargetTextures(x,qe.colorTexture,qe.depthStencilTexture),A.setRenderTarget(x))}let jA=N[ne];jA===void 0&&(jA=new Lt,jA.layers.enable(ne),jA.viewport=new ve,N[ne]=jA),jA.matrix.fromArray(de.transform.matrix),jA.matrix.decompose(jA.position,jA.quaternion,jA.scale),jA.projectionMatrix.fromArray(de.projectionMatrix),jA.projectionMatrixInverse.copy(jA.projectionMatrix).invert(),jA.viewport.set(_e.x,_e.y,_e.width,_e.height),ne===0&&(U.matrix.copy(jA.matrix),U.matrix.decompose(U.position,U.quaternion,U.scale)),PA===!0&&U.cameras.push(jA)}const bA=g.enabledFeatures;if(bA&&bA.includes("depth-sensing")&&g.depthUsage=="gpu-optimized"&&c){Q=t.getBinding();const ne=Q.getDepthInformation(wA[0]);ne&&ne.isValid&&ne.texture&&d.init(ne,g.renderState)}if(bA&&bA.includes("camera-access")&&c){A.state.unbindTexture(),Q=t.getBinding();for(let ne=0;ne<wA.length;ne++){const de=wA[ne].camera;if(de){let _e=E[de];_e||(_e=new Jc,E[de]=_e);const jA=Q.getCameraImage(de);_e.sourceTexture=jA}}}}for(let wA=0;wA<D.length;wA++){const PA=w[wA],bA=D[wA];PA!==null&&bA!==void 0&&bA.update(PA,gA,a||C)}YA&&YA(Z,gA),gA.detectedPlanes&&t.dispatchEvent({type:"planesdetected",data:gA}),h=null}const ue=new qc;ue.setAnimationLoop(Ne),this.setAnimationLoop=function(Z){YA=Z},this.dispose=function(){}}}const Vg=new qi,Nm=new Ye;function km(i,A){function e(d,E){d.matrixAutoUpdate===!0&&d.updateMatrix(),E.value.copy(d.matrix)}function t(d,E){E.color.getRGB(d.fogColor.value,Gc(i)),E.isFog?(d.fogNear.value=E.near,d.fogFar.value=E.far):E.isFogExp2&&(d.fogDensity.value=E.density)}function g(d,E,u,_,x){E.isMeshBasicMaterial||E.isMeshLambertMaterial?I(d,E):E.isMeshToonMaterial?(I(d,E),Q(d,E)):E.isMeshPhongMaterial?(I(d,E),s(d,E)):E.isMeshStandardMaterial?(I(d,E),r(d,E),E.isMeshPhysicalMaterial&&B(d,E,x)):E.isMeshMatcapMaterial?(I(d,E),h(d,E)):E.isMeshDepthMaterial?I(d,E):E.isMeshDistanceMaterial?(I(d,E),c(d,E)):E.isMeshNormalMaterial?I(d,E):E.isLineBasicMaterial?(C(d,E),E.isLineDashedMaterial&&o(d,E)):E.isPointsMaterial?n(d,E,u,_):E.isSpriteMaterial?a(d,E):E.isShadowMaterial?(d.color.value.copy(E.color),d.opacity.value=E.opacity):E.isShaderMaterial&&(E.uniformsNeedUpdate=!1)}function I(d,E){d.opacity.value=E.opacity,E.color&&d.diffuse.value.copy(E.color),E.emissive&&d.emissive.value.copy(E.emissive).multiplyScalar(E.emissiveIntensity),E.map&&(d.map.value=E.map,e(E.map,d.mapTransform)),E.alphaMap&&(d.alphaMap.value=E.alphaMap,e(E.alphaMap,d.alphaMapTransform)),E.bumpMap&&(d.bumpMap.value=E.bumpMap,e(E.bumpMap,d.bumpMapTransform),d.bumpScale.value=E.bumpScale,E.side===Ct&&(d.bumpScale.value*=-1)),E.normalMap&&(d.normalMap.value=E.normalMap,e(E.normalMap,d.normalMapTransform),d.normalScale.value.copy(E.normalScale),E.side===Ct&&d.normalScale.value.negate()),E.displacementMap&&(d.displacementMap.value=E.displacementMap,e(E.displacementMap,d.displacementMapTransform),d.displacementScale.value=E.displacementScale,d.displacementBias.value=E.displacementBias),E.emissiveMap&&(d.emissiveMap.value=E.emissiveMap,e(E.emissiveMap,d.emissiveMapTransform)),E.specularMap&&(d.specularMap.value=E.specularMap,e(E.specularMap,d.specularMapTransform)),E.alphaTest>0&&(d.alphaTest.value=E.alphaTest);const u=A.get(E),_=u.envMap,x=u.envMapRotation;_&&(d.envMap.value=_,Vg.copy(x),Vg.x*=-1,Vg.y*=-1,Vg.z*=-1,_.isCubeTexture&&_.isRenderTargetTexture===!1&&(Vg.y*=-1,Vg.z*=-1),d.envMapRotation.value.setFromMatrix4(Nm.makeRotationFromEuler(Vg)),d.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,d.reflectivity.value=E.reflectivity,d.ior.value=E.ior,d.refractionRatio.value=E.refractionRatio),E.lightMap&&(d.lightMap.value=E.lightMap,d.lightMapIntensity.value=E.lightMapIntensity,e(E.lightMap,d.lightMapTransform)),E.aoMap&&(d.aoMap.value=E.aoMap,d.aoMapIntensity.value=E.aoMapIntensity,e(E.aoMap,d.aoMapTransform))}function C(d,E){d.diffuse.value.copy(E.color),d.opacity.value=E.opacity,E.map&&(d.map.value=E.map,e(E.map,d.mapTransform))}function o(d,E){d.dashSize.value=E.dashSize,d.totalSize.value=E.dashSize+E.gapSize,d.scale.value=E.scale}function n(d,E,u,_){d.diffuse.value.copy(E.color),d.opacity.value=E.opacity,d.size.value=E.size*u,d.scale.value=_*.5,E.map&&(d.map.value=E.map,e(E.map,d.uvTransform)),E.alphaMap&&(d.alphaMap.value=E.alphaMap,e(E.alphaMap,d.alphaMapTransform)),E.alphaTest>0&&(d.alphaTest.value=E.alphaTest)}function a(d,E){d.diffuse.value.copy(E.color),d.opacity.value=E.opacity,d.rotation.value=E.rotation,E.map&&(d.map.value=E.map,e(E.map,d.mapTransform)),E.alphaMap&&(d.alphaMap.value=E.alphaMap,e(E.alphaMap,d.alphaMapTransform)),E.alphaTest>0&&(d.alphaTest.value=E.alphaTest)}function s(d,E){d.specular.value.copy(E.specular),d.shininess.value=Math.max(E.shininess,1e-4)}function Q(d,E){E.gradientMap&&(d.gradientMap.value=E.gradientMap)}function r(d,E){d.metalness.value=E.metalness,E.metalnessMap&&(d.metalnessMap.value=E.metalnessMap,e(E.metalnessMap,d.metalnessMapTransform)),d.roughness.value=E.roughness,E.roughnessMap&&(d.roughnessMap.value=E.roughnessMap,e(E.roughnessMap,d.roughnessMapTransform)),E.envMap&&(d.envMapIntensity.value=E.envMapIntensity)}function B(d,E,u){d.ior.value=E.ior,E.sheen>0&&(d.sheenColor.value.copy(E.sheenColor).multiplyScalar(E.sheen),d.sheenRoughness.value=E.sheenRoughness,E.sheenColorMap&&(d.sheenColorMap.value=E.sheenColorMap,e(E.sheenColorMap,d.sheenColorMapTransform)),E.sheenRoughnessMap&&(d.sheenRoughnessMap.value=E.sheenRoughnessMap,e(E.sheenRoughnessMap,d.sheenRoughnessMapTransform))),E.clearcoat>0&&(d.clearcoat.value=E.clearcoat,d.clearcoatRoughness.value=E.clearcoatRoughness,E.clearcoatMap&&(d.clearcoatMap.value=E.clearcoatMap,e(E.clearcoatMap,d.clearcoatMapTransform)),E.clearcoatRoughnessMap&&(d.clearcoatRoughnessMap.value=E.clearcoatRoughnessMap,e(E.clearcoatRoughnessMap,d.clearcoatRoughnessMapTransform)),E.clearcoatNormalMap&&(d.clearcoatNormalMap.value=E.clearcoatNormalMap,e(E.clearcoatNormalMap,d.clearcoatNormalMapTransform),d.clearcoatNormalScale.value.copy(E.clearcoatNormalScale),E.side===Ct&&d.clearcoatNormalScale.value.negate())),E.dispersion>0&&(d.dispersion.value=E.dispersion),E.iridescence>0&&(d.iridescence.value=E.iridescence,d.iridescenceIOR.value=E.iridescenceIOR,d.iridescenceThicknessMinimum.value=E.iridescenceThicknessRange[0],d.iridescenceThicknessMaximum.value=E.iridescenceThicknessRange[1],E.iridescenceMap&&(d.iridescenceMap.value=E.iridescenceMap,e(E.iridescenceMap,d.iridescenceMapTransform)),E.iridescenceThicknessMap&&(d.iridescenceThicknessMap.value=E.iridescenceThicknessMap,e(E.iridescenceThicknessMap,d.iridescenceThicknessMapTransform))),E.transmission>0&&(d.transmission.value=E.transmission,d.transmissionSamplerMap.value=u.texture,d.transmissionSamplerSize.value.set(u.width,u.height),E.transmissionMap&&(d.transmissionMap.value=E.transmissionMap,e(E.transmissionMap,d.transmissionMapTransform)),d.thickness.value=E.thickness,E.thicknessMap&&(d.thicknessMap.value=E.thicknessMap,e(E.thicknessMap,d.thicknessMapTransform)),d.attenuationDistance.value=E.attenuationDistance,d.attenuationColor.value.copy(E.attenuationColor)),E.anisotropy>0&&(d.anisotropyVector.value.set(E.anisotropy*Math.cos(E.anisotropyRotation),E.anisotropy*Math.sin(E.anisotropyRotation)),E.anisotropyMap&&(d.anisotropyMap.value=E.anisotropyMap,e(E.anisotropyMap,d.anisotropyMapTransform))),d.specularIntensity.value=E.specularIntensity,d.specularColor.value.copy(E.specularColor),E.specularColorMap&&(d.specularColorMap.value=E.specularColorMap,e(E.specularColorMap,d.specularColorMapTransform)),E.specularIntensityMap&&(d.specularIntensityMap.value=E.specularIntensityMap,e(E.specularIntensityMap,d.specularIntensityMapTransform))}function h(d,E){E.matcap&&(d.matcap.value=E.matcap)}function c(d,E){const u=A.get(E).light;d.referencePosition.value.setFromMatrixPosition(u.matrixWorld),d.nearDistance.value=u.shadow.camera.near,d.farDistance.value=u.shadow.camera.far}return{refreshFogUniforms:t,refreshMaterialUniforms:g}}function Sm(i,A,e,t){let g={},I={},C=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function n(u,_){const x=_.program;t.uniformBlockBinding(u,x)}function a(u,_){let x=g[u.id];x===void 0&&(h(u),x=s(u),g[u.id]=x,u.addEventListener("dispose",d));const D=_.program;t.updateUBOMapping(u,D);const w=A.render.frame;I[u.id]!==w&&(r(u),I[u.id]=w)}function s(u){const _=Q();u.__bindingPointIndex=_;const x=i.createBuffer(),D=u.__size,w=u.usage;return i.bindBuffer(i.UNIFORM_BUFFER,x),i.bufferData(i.UNIFORM_BUFFER,D,w),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,_,x),x}function Q(){for(let u=0;u<o;u++)if(C.indexOf(u)===-1)return C.push(u),u;return ae("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function r(u){const _=g[u.id],x=u.uniforms,D=u.__cache;i.bindBuffer(i.UNIFORM_BUFFER,_);for(let w=0,y=x.length;w<y;w++){const S=Array.isArray(x[w])?x[w]:[x[w]];for(let l=0,p=S.length;l<p;l++){const N=S[l];if(B(N,w,l,D)===!0){const U=N.__offset,v=Array.isArray(N.value)?N.value:[N.value];let P=0;for(let W=0;W<v.length;W++){const H=v[W],O=c(H);typeof H=="number"||typeof H=="boolean"?(N.__data[0]=H,i.bufferSubData(i.UNIFORM_BUFFER,U+P,N.__data)):H.isMatrix3?(N.__data[0]=H.elements[0],N.__data[1]=H.elements[1],N.__data[2]=H.elements[2],N.__data[3]=0,N.__data[4]=H.elements[3],N.__data[5]=H.elements[4],N.__data[6]=H.elements[5],N.__data[7]=0,N.__data[8]=H.elements[6],N.__data[9]=H.elements[7],N.__data[10]=H.elements[8],N.__data[11]=0):(H.toArray(N.__data,P),P+=O.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,U,N.__data)}}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function B(u,_,x,D){const w=u.value,y=_+"_"+x;if(D[y]===void 0)return typeof w=="number"||typeof w=="boolean"?D[y]=w:D[y]=w.clone(),!0;{const S=D[y];if(typeof w=="number"||typeof w=="boolean"){if(S!==w)return D[y]=w,!0}else if(S.equals(w)===!1)return S.copy(w),!0}return!1}function h(u){const _=u.uniforms;let x=0;const D=16;for(let y=0,S=_.length;y<S;y++){const l=Array.isArray(_[y])?_[y]:[_[y]];for(let p=0,N=l.length;p<N;p++){const U=l[p],v=Array.isArray(U.value)?U.value:[U.value];for(let P=0,W=v.length;P<W;P++){const H=v[P],O=c(H),z=x%D,lA=z%O.boundary,QA=z+lA;x+=lA,QA!==0&&D-QA<O.storage&&(x+=D-QA),U.__data=new Float32Array(O.storage/Float32Array.BYTES_PER_ELEMENT),U.__offset=x,x+=O.storage}}}const w=x%D;return w>0&&(x+=D-w),u.__size=x,u.__cache={},this}function c(u){const _={boundary:0,storage:0};return typeof u=="number"||typeof u=="boolean"?(_.boundary=4,_.storage=4):u.isVector2?(_.boundary=8,_.storage=8):u.isVector3||u.isColor?(_.boundary=16,_.storage=12):u.isVector4?(_.boundary=16,_.storage=16):u.isMatrix3?(_.boundary=48,_.storage=48):u.isMatrix4?(_.boundary=64,_.storage=64):u.isTexture?KA("WebGLRenderer: Texture samplers can not be part of an uniforms group."):KA("WebGLRenderer: Unsupported uniform value type.",u),_}function d(u){const _=u.target;_.removeEventListener("dispose",d);const x=C.indexOf(_.__bindingPointIndex);C.splice(x,1),i.deleteBuffer(g[_.id]),delete g[_.id],delete I[_.id]}function E(){for(const u in g)i.deleteBuffer(g[u]);C=[],g={},I={}}return{bind:n,update:a,dispose:E}}const Rm=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let xi=null;function Gm(){return xi===null&&(xi=new a2(Rm,16,16,xI,vi),xi.name="DFG_LUT",xi.minFilter=tt,xi.magFilter=tt,xi.wrapS=Li,xi.wrapT=Li,xi.generateMipmaps=!1,xi.needsUpdate=!0),xi}class Mm{constructor(A={}){const{canvas:e=FD(),context:t=null,depth:g=!0,stencil:I=!1,alpha:C=!1,antialias:o=!1,premultipliedAlpha:n=!0,preserveDrawingBuffer:a=!1,powerPreference:s="default",failIfMajorPerformanceCaveat:Q=!1,reversedDepthBuffer:r=!1,outputBufferType:B=Gt}=A;this.isWebGLRenderer=!0;let h;if(t!==null){if(typeof WebGLRenderingContext<"u"&&t instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");h=t.getContextAttributes().alpha}else h=C;const c=B,d=new Set([Ls,Us,Fs]),E=new Set([Gt,Bi,hC,lC,Gs,Ms]),u=new Uint32Array(4),_=new Int32Array(4);let x=null,D=null;const w=[],y=[];let S=null;this.domElement=e,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=ri,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const l=this;let p=!1;this._outputColorSpace=Mt;let N=0,U=0,v=null,P=-1,W=null;const H=new ve,O=new ve;let z=null;const lA=new Ie(0);let QA=0,uA=e.width,TA=e.height,YA=1,Ne=null,ue=null;const Z=new ve(0,0,uA,TA),gA=new ve(0,0,uA,TA);let wA=!1;const PA=new Kc;let bA=!1,se=!1;const ze=new Ye,ne=new J,de=new ve,_e={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let jA=!1;function qe(){return v===null?YA:1}let R=t;function He(m,L){return e.getContext(m,L)}try{const m={alpha:!0,depth:g,stencil:I,antialias:o,premultipliedAlpha:n,preserveDrawingBuffer:a,powerPreference:s,failIfMajorPerformanceCaveat:Q};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${ds}`),e.addEventListener("webglcontextlost",JA,!1),e.addEventListener("webglcontextrestored",me,!1),e.addEventListener("webglcontextcreationerror",he,!1),R===null){const L="webgl2";if(R=He(L,m),R===null)throw He(L)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(m){throw ae("WebGLRenderer: "+m.message),m}let Ee,we,kA,b,f,F,X,tA,j,RA,BA,NA,LA,CA,cA,yA,SA,EA,WA,M,fA,nA,DA,IA;function eA(){Ee=new Gp(R),Ee.init(),nA=new pm(R,Ee),we=new pp(R,Ee,A,nA),kA=new Dm(R,Ee),we.reversedDepthBuffer&&r&&kA.buffers.depth.setReversed(!0),b=new Up(R),f=new om,F=new _m(R,Ee,kA,f,we,nA,b),X=new mp(l),tA=new Rp(l),j=new u2(R),DA=new Dp(R,j),RA=new Mp(R,j,b,DA),BA=new vp(R,RA,j,b),WA=new Lp(R,we,F),yA=new wp(f),NA=new Cm(l,X,tA,Ee,we,DA,yA),LA=new km(l,f),CA=new am,cA=new cm(Ee),EA=new fp(l,X,tA,kA,BA,h,n),SA=new um(l,BA,we),IA=new Sm(R,b,we,kA),M=new _p(R,Ee,b),fA=new Fp(R,Ee,b),b.programs=NA.programs,l.capabilities=we,l.extensions=Ee,l.properties=f,l.renderLists=CA,l.shadowMap=SA,l.state=kA,l.info=b}eA(),c!==Gt&&(S=new Jp(c,e.width,e.height,g,I));const rA=new bm(l,R);this.xr=rA,this.getContext=function(){return R},this.getContextAttributes=function(){return R.getContextAttributes()},this.forceContextLoss=function(){const m=Ee.get("WEBGL_lose_context");m&&m.loseContext()},this.forceContextRestore=function(){const m=Ee.get("WEBGL_lose_context");m&&m.restoreContext()},this.getPixelRatio=function(){return YA},this.setPixelRatio=function(m){m!==void 0&&(YA=m,this.setSize(uA,TA,!1))},this.getSize=function(m){return m.set(uA,TA)},this.setSize=function(m,L,q=!0){if(rA.isPresenting){KA("WebGLRenderer: Can't change size while VR device is presenting.");return}uA=m,TA=L,e.width=Math.floor(m*YA),e.height=Math.floor(L*YA),q===!0&&(e.style.width=m+"px",e.style.height=L+"px"),S!==null&&S.setSize(e.width,e.height),this.setViewport(0,0,m,L)},this.getDrawingBufferSize=function(m){return m.set(uA*YA,TA*YA).floor()},this.setDrawingBufferSize=function(m,L,q){uA=m,TA=L,YA=q,e.width=Math.floor(m*q),e.height=Math.floor(L*q),this.setViewport(0,0,m,L)},this.setEffects=function(m){if(c===Gt){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(m){for(let L=0;L<m.length;L++)if(m[L].isOutputPass===!0){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}S.setEffects(m||[])},this.getCurrentViewport=function(m){return m.copy(H)},this.getViewport=function(m){return m.copy(Z)},this.setViewport=function(m,L,q,Y){m.isVector4?Z.set(m.x,m.y,m.z,m.w):Z.set(m,L,q,Y),kA.viewport(H.copy(Z).multiplyScalar(YA).round())},this.getScissor=function(m){return m.copy(gA)},this.setScissor=function(m,L,q,Y){m.isVector4?gA.set(m.x,m.y,m.z,m.w):gA.set(m,L,q,Y),kA.scissor(O.copy(gA).multiplyScalar(YA).round())},this.getScissorTest=function(){return wA},this.setScissorTest=function(m){kA.setScissorTest(wA=m)},this.setOpaqueSort=function(m){Ne=m},this.setTransparentSort=function(m){ue=m},this.getClearColor=function(m){return m.copy(EA.getClearColor())},this.setClearColor=function(){EA.setClearColor(...arguments)},this.getClearAlpha=function(){return EA.getClearAlpha()},this.setClearAlpha=function(){EA.setClearAlpha(...arguments)},this.clear=function(m=!0,L=!0,q=!0){let Y=0;if(m){let K=!1;if(v!==null){const dA=v.texture.format;K=d.has(dA)}if(K){const dA=v.texture.type,pA=E.has(dA),xA=EA.getClearColor(),mA=EA.getClearAlpha(),GA=xA.r,UA=xA.g,MA=xA.b;pA?(u[0]=GA,u[1]=UA,u[2]=MA,u[3]=mA,R.clearBufferuiv(R.COLOR,0,u)):(_[0]=GA,_[1]=UA,_[2]=MA,_[3]=mA,R.clearBufferiv(R.COLOR,0,_))}else Y|=R.COLOR_BUFFER_BIT}L&&(Y|=R.DEPTH_BUFFER_BIT),q&&(Y|=R.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),R.clear(Y)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",JA,!1),e.removeEventListener("webglcontextrestored",me,!1),e.removeEventListener("webglcontextcreationerror",he,!1),EA.dispose(),CA.dispose(),cA.dispose(),f.dispose(),X.dispose(),tA.dispose(),BA.dispose(),DA.dispose(),IA.dispose(),NA.dispose(),rA.dispose(),rA.removeEventListener("sessionstart",fh),rA.removeEventListener("sessionend",Dh),Zg.stop()};function JA(m){m.preventDefault(),rc("WebGLRenderer: Context Lost."),p=!0}function me(){rc("WebGLRenderer: Context Restored."),p=!1;const m=b.autoReset,L=SA.enabled,q=SA.autoUpdate,Y=SA.needsUpdate,K=SA.type;eA(),b.autoReset=m,SA.enabled=L,SA.autoUpdate=q,SA.needsUpdate=Y,SA.type=K}function he(m){ae("WebGLRenderer: A WebGL context could not be created. Reason: ",m.statusMessage)}function Di(m){const L=m.target;L.removeEventListener("dispose",Di),Wi(L)}function Wi(m){Pk(m),f.remove(m)}function Pk(m){const L=f.get(m).programs;L!==void 0&&(L.forEach(function(q){NA.releaseProgram(q)}),m.isShaderMaterial&&NA.releaseShaderCache(m))}this.renderBufferDirect=function(m,L,q,Y,K,dA){L===null&&(L=_e);const pA=K.isMesh&&K.matrixWorld.determinant()<0,xA=Vk(m,L,q,Y,K);kA.setMaterial(Y,pA);let mA=q.index,GA=1;if(Y.wireframe===!0){if(mA=RA.getWireframeAttribute(q),mA===void 0)return;GA=2}const UA=q.drawRange,MA=q.attributes.position;let XA=UA.start*GA,fe=(UA.start+UA.count)*GA;dA!==null&&(XA=Math.max(XA,dA.start*GA),fe=Math.min(fe,(dA.start+dA.count)*GA)),mA!==null?(XA=Math.max(XA,0),fe=Math.min(fe,mA.count)):MA!=null&&(XA=Math.max(XA,0),fe=Math.min(fe,MA.count));const Fe=fe-XA;if(Fe<0||Fe===1/0)return;DA.setup(K,Y,xA,q,mA);let Ue,pe=M;if(mA!==null&&(Ue=j.get(mA),pe=fA,pe.setIndex(Ue)),K.isMesh)Y.wireframe===!0?(kA.setLineWidth(Y.wireframeLinewidth*qe()),pe.setMode(R.LINES)):pe.setMode(R.TRIANGLES);else if(K.isLine){let FA=Y.linewidth;FA===void 0&&(FA=1),kA.setLineWidth(FA*qe()),K.isLineSegments?pe.setMode(R.LINES):K.isLineLoop?pe.setMode(R.LINE_LOOP):pe.setMode(R.LINE_STRIP)}else K.isPoints?pe.setMode(R.POINTS):K.isSprite&&pe.setMode(R.TRIANGLES);if(K.isBatchedMesh)if(K._multiDrawInstances!==null)xC("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),pe.renderMultiDrawInstances(K._multiDrawStarts,K._multiDrawCounts,K._multiDrawCount,K._multiDrawInstances);else if(Ee.get("WEBGL_multi_draw"))pe.renderMultiDraw(K._multiDrawStarts,K._multiDrawCounts,K._multiDrawCount);else{const FA=K._multiDrawStarts,le=K._multiDrawCounts,Qe=K._multiDrawCount,kt=mA?j.get(mA).bytesPerElement:1,qI=f.get(Y).currentProgram.getUniforms();for(let St=0;St<Qe;St++)qI.setValue(R,"_gl_DrawID",St),pe.render(FA[St]/kt,le[St])}else if(K.isInstancedMesh)pe.renderInstances(XA,Fe,K.count);else if(q.isInstancedBufferGeometry){const FA=q._maxInstanceCount!==void 0?q._maxInstanceCount:1/0,le=Math.min(q.instanceCount,FA);pe.renderInstances(XA,Fe,le)}else pe.render(XA,Fe)};function uh(m,L,q){m.transparent===!0&&m.side===Fi&&m.forceSinglePass===!1?(m.side=Ct,m.needsUpdate=!0,vn(m,L,q),m.side=Mi,m.needsUpdate=!0,vn(m,L,q),m.side=Fi):vn(m,L,q)}this.compile=function(m,L,q=null){q===null&&(q=m),D=cA.get(q),D.init(L),y.push(D),q.traverseVisible(function(K){K.isLight&&K.layers.test(L.layers)&&(D.pushLight(K),K.castShadow&&D.pushShadow(K))}),m!==q&&m.traverseVisible(function(K){K.isLight&&K.layers.test(L.layers)&&(D.pushLight(K),K.castShadow&&D.pushShadow(K))}),D.setupLights();const Y=new Set;return m.traverse(function(K){if(!(K.isMesh||K.isPoints||K.isLine||K.isSprite))return;const dA=K.material;if(dA)if(Array.isArray(dA))for(let pA=0;pA<dA.length;pA++){const xA=dA[pA];uh(xA,q,K),Y.add(xA)}else uh(dA,q,K),Y.add(dA)}),D=y.pop(),Y},this.compileAsync=function(m,L,q=null){const Y=this.compile(m,L,q);return new Promise(K=>{function dA(){if(Y.forEach(function(pA){f.get(pA).currentProgram.isReady()&&Y.delete(pA)}),Y.size===0){K(m);return}setTimeout(dA,10)}Ee.get("KHR_parallel_shader_compile")!==null?dA():setTimeout(dA,10)})};let pr=null;function Ok(m){pr&&pr(m)}function fh(){Zg.stop()}function Dh(){Zg.start()}const Zg=new qc;Zg.setAnimationLoop(Ok),typeof self<"u"&&Zg.setContext(self),this.setAnimationLoop=function(m){pr=m,rA.setAnimationLoop(m),m===null?Zg.stop():Zg.start()},rA.addEventListener("sessionstart",fh),rA.addEventListener("sessionend",Dh),this.render=function(m,L){if(L!==void 0&&L.isCamera!==!0){ae("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(p===!0)return;const q=rA.enabled===!0&&rA.isPresenting===!0,Y=S!==null&&(v===null||q)&&S.begin(l,v);if(m.matrixWorldAutoUpdate===!0&&m.updateMatrixWorld(),L.parent===null&&L.matrixWorldAutoUpdate===!0&&L.updateMatrixWorld(),rA.enabled===!0&&rA.isPresenting===!0&&(S===null||S.isCompositing()===!1)&&(rA.cameraAutoUpdate===!0&&rA.updateCamera(L),L=rA.getCamera()),m.isScene===!0&&m.onBeforeRender(l,m,L,v),D=cA.get(m,y.length),D.init(L),y.push(D),ze.multiplyMatrices(L.projectionMatrix,L.matrixWorldInverse),PA.setFromProjectionMatrix(ze,ci,L.reversedDepth),se=this.localClippingEnabled,bA=yA.init(this.clippingPlanes,se),x=CA.get(m,w.length),x.init(),w.push(x),rA.enabled===!0&&rA.isPresenting===!0){const pA=l.xr.getDepthSensingMesh();pA!==null&&wr(pA,L,-1/0,l.sortObjects)}wr(m,L,0,l.sortObjects),x.finish(),l.sortObjects===!0&&x.sort(Ne,ue),jA=rA.enabled===!1||rA.isPresenting===!1||rA.hasDepthSensing()===!1,jA&&EA.addToRenderList(x,m),this.info.render.frame++,bA===!0&&yA.beginShadows();const K=D.state.shadowsArray;if(SA.render(K,m,L),bA===!0&&yA.endShadows(),this.info.autoReset===!0&&this.info.reset(),(Y&&S.hasRenderPass())===!1){const pA=x.opaque,xA=x.transmissive;if(D.setupLights(),L.isArrayCamera){const mA=L.cameras;if(xA.length>0)for(let GA=0,UA=mA.length;GA<UA;GA++){const MA=mA[GA];ph(pA,xA,m,MA)}jA&&EA.render(m);for(let GA=0,UA=mA.length;GA<UA;GA++){const MA=mA[GA];_h(x,m,MA,MA.viewport)}}else xA.length>0&&ph(pA,xA,m,L),jA&&EA.render(m),_h(x,m,L)}v!==null&&U===0&&(F.updateMultisampleRenderTarget(v),F.updateRenderTargetMipmap(v)),Y&&S.end(l),m.isScene===!0&&m.onAfterRender(l,m,L),DA.resetDefaultState(),P=-1,W=null,y.pop(),y.length>0?(D=y[y.length-1],bA===!0&&yA.setGlobalState(l.clippingPlanes,D.state.camera)):D=null,w.pop(),w.length>0?x=w[w.length-1]:x=null};function wr(m,L,q,Y){if(m.visible===!1)return;if(m.layers.test(L.layers)){if(m.isGroup)q=m.renderOrder;else if(m.isLOD)m.autoUpdate===!0&&m.update(L);else if(m.isLight)D.pushLight(m),m.castShadow&&D.pushShadow(m);else if(m.isSprite){if(!m.frustumCulled||PA.intersectsSprite(m)){Y&&de.setFromMatrixPosition(m.matrixWorld).applyMatrix4(ze);const pA=BA.update(m),xA=m.material;xA.visible&&x.push(m,pA,xA,q,de.z,null)}}else if((m.isMesh||m.isLine||m.isPoints)&&(!m.frustumCulled||PA.intersectsObject(m))){const pA=BA.update(m),xA=m.material;if(Y&&(m.boundingSphere!==void 0?(m.boundingSphere===null&&m.computeBoundingSphere(),de.copy(m.boundingSphere.center)):(pA.boundingSphere===null&&pA.computeBoundingSphere(),de.copy(pA.boundingSphere.center)),de.applyMatrix4(m.matrixWorld).applyMatrix4(ze)),Array.isArray(xA)){const mA=pA.groups;for(let GA=0,UA=mA.length;GA<UA;GA++){const MA=mA[GA],XA=xA[MA.materialIndex];XA&&XA.visible&&x.push(m,pA,XA,q,de.z,MA)}}else xA.visible&&x.push(m,pA,xA,q,de.z,null)}}const dA=m.children;for(let pA=0,xA=dA.length;pA<xA;pA++)wr(dA[pA],L,q,Y)}function _h(m,L,q,Y){const{opaque:K,transmissive:dA,transparent:pA}=m;D.setupLightsView(q),bA===!0&&yA.setGlobalState(l.clippingPlanes,q),Y&&kA.viewport(H.copy(Y)),K.length>0&&Ln(K,L,q),dA.length>0&&Ln(dA,L,q),pA.length>0&&Ln(pA,L,q),kA.buffers.depth.setTest(!0),kA.buffers.depth.setMask(!0),kA.buffers.color.setMask(!0),kA.setPolygonOffset(!1)}function ph(m,L,q,Y){if((q.isScene===!0?q.overrideMaterial:null)!==null)return;if(D.state.transmissionRenderTarget[Y.id]===void 0){const XA=Ee.has("EXT_color_buffer_half_float")||Ee.has("EXT_color_buffer_float");D.state.transmissionRenderTarget[Y.id]=new di(1,1,{generateMipmaps:!0,type:XA?vi:Gt,minFilter:vg,samples:we.samples,stencilBuffer:I,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:oe.workingColorSpace})}const dA=D.state.transmissionRenderTarget[Y.id],pA=Y.viewport||H;dA.setSize(pA.z*l.transmissionResolutionScale,pA.w*l.transmissionResolutionScale);const xA=l.getRenderTarget(),mA=l.getActiveCubeFace(),GA=l.getActiveMipmapLevel();l.setRenderTarget(dA),l.getClearColor(lA),QA=l.getClearAlpha(),QA<1&&l.setClearColor(16777215,.5),l.clear(),jA&&EA.render(q);const UA=l.toneMapping;l.toneMapping=ri;const MA=Y.viewport;if(Y.viewport!==void 0&&(Y.viewport=void 0),D.setupLightsView(Y),bA===!0&&yA.setGlobalState(l.clippingPlanes,Y),Ln(m,q,Y),F.updateMultisampleRenderTarget(dA),F.updateRenderTargetMipmap(dA),Ee.has("WEBGL_multisampled_render_to_texture")===!1){let XA=!1;for(let fe=0,Fe=L.length;fe<Fe;fe++){const Ue=L[fe],{object:pe,geometry:FA,material:le,group:Qe}=Ue;if(le.side===Fi&&pe.layers.test(Y.layers)){const kt=le.side;le.side=Ct,le.needsUpdate=!0,wh(pe,q,Y,FA,le,Qe),le.side=kt,le.needsUpdate=!0,XA=!0}}XA===!0&&(F.updateMultisampleRenderTarget(dA),F.updateRenderTargetMipmap(dA))}l.setRenderTarget(xA,mA,GA),l.setClearColor(lA,QA),MA!==void 0&&(Y.viewport=MA),l.toneMapping=UA}function Ln(m,L,q){const Y=L.isScene===!0?L.overrideMaterial:null;for(let K=0,dA=m.length;K<dA;K++){const pA=m[K],{object:xA,geometry:mA,group:GA}=pA;let UA=pA.material;UA.allowOverride===!0&&Y!==null&&(UA=Y),xA.layers.test(q.layers)&&wh(xA,L,q,mA,UA,GA)}}function wh(m,L,q,Y,K,dA){m.onBeforeRender(l,L,q,Y,K,dA),m.modelViewMatrix.multiplyMatrices(q.matrixWorldInverse,m.matrixWorld),m.normalMatrix.getNormalMatrix(m.modelViewMatrix),K.onBeforeRender(l,L,q,Y,m,dA),K.transparent===!0&&K.side===Fi&&K.forceSinglePass===!1?(K.side=Ct,K.needsUpdate=!0,l.renderBufferDirect(q,L,Y,K,m,dA),K.side=Mi,K.needsUpdate=!0,l.renderBufferDirect(q,L,Y,K,m,dA),K.side=Fi):l.renderBufferDirect(q,L,Y,K,m,dA),m.onAfterRender(l,L,q,Y,K,dA)}function vn(m,L,q){L.isScene!==!0&&(L=_e);const Y=f.get(m),K=D.state.lights,dA=D.state.shadowsArray,pA=K.state.version,xA=NA.getParameters(m,K.state,dA,L,q),mA=NA.getProgramCacheKey(xA);let GA=Y.programs;Y.environment=m.isMeshStandardMaterial?L.environment:null,Y.fog=L.fog,Y.envMap=(m.isMeshStandardMaterial?tA:X).get(m.envMap||Y.environment),Y.envMapRotation=Y.environment!==null&&m.envMap===null?L.environmentRotation:m.envMapRotation,GA===void 0&&(m.addEventListener("dispose",Di),GA=new Map,Y.programs=GA);let UA=GA.get(mA);if(UA!==void 0){if(Y.currentProgram===UA&&Y.lightsStateVersion===pA)return yh(m,xA),UA}else xA.uniforms=NA.getUniforms(m),m.onBeforeCompile(xA,l),UA=NA.acquireProgram(xA,mA),GA.set(mA,UA),Y.uniforms=xA.uniforms;const MA=Y.uniforms;return(!m.isShaderMaterial&&!m.isRawShaderMaterial||m.clipping===!0)&&(MA.clippingPlanes=yA.uniform),yh(m,xA),Y.needsLights=Wk(m),Y.lightsStateVersion=pA,Y.needsLights&&(MA.ambientLightColor.value=K.state.ambient,MA.lightProbe.value=K.state.probe,MA.directionalLights.value=K.state.directional,MA.directionalLightShadows.value=K.state.directionalShadow,MA.spotLights.value=K.state.spot,MA.spotLightShadows.value=K.state.spotShadow,MA.rectAreaLights.value=K.state.rectArea,MA.ltc_1.value=K.state.rectAreaLTC1,MA.ltc_2.value=K.state.rectAreaLTC2,MA.pointLights.value=K.state.point,MA.pointLightShadows.value=K.state.pointShadow,MA.hemisphereLights.value=K.state.hemi,MA.directionalShadowMap.value=K.state.directionalShadowMap,MA.directionalShadowMatrix.value=K.state.directionalShadowMatrix,MA.spotShadowMap.value=K.state.spotShadowMap,MA.spotLightMatrix.value=K.state.spotLightMatrix,MA.spotLightMap.value=K.state.spotLightMap,MA.pointShadowMap.value=K.state.pointShadowMap,MA.pointShadowMatrix.value=K.state.pointShadowMatrix),Y.currentProgram=UA,Y.uniformsList=null,UA}function mh(m){if(m.uniformsList===null){const L=m.currentProgram.getUniforms();m.uniformsList=ln.seqWithValue(L.seq,m.uniforms)}return m.uniformsList}function yh(m,L){const q=f.get(m);q.outputColorSpace=L.outputColorSpace,q.batching=L.batching,q.batchingColor=L.batchingColor,q.instancing=L.instancing,q.instancingColor=L.instancingColor,q.instancingMorph=L.instancingMorph,q.skinning=L.skinning,q.morphTargets=L.morphTargets,q.morphNormals=L.morphNormals,q.morphColors=L.morphColors,q.morphTargetsCount=L.morphTargetsCount,q.numClippingPlanes=L.numClippingPlanes,q.numIntersection=L.numClipIntersection,q.vertexAlphas=L.vertexAlphas,q.vertexTangents=L.vertexTangents,q.toneMapping=L.toneMapping}function Vk(m,L,q,Y,K){L.isScene!==!0&&(L=_e),F.resetTextureUnits();const dA=L.fog,pA=Y.isMeshStandardMaterial?L.environment:null,xA=v===null?l.outputColorSpace:v.isXRRenderTarget===!0?v.texture.colorSpace:uI,mA=(Y.isMeshStandardMaterial?tA:X).get(Y.envMap||pA),GA=Y.vertexColors===!0&&!!q.attributes.color&&q.attributes.color.itemSize===4,UA=!!q.attributes.tangent&&(!!Y.normalMap||Y.anisotropy>0),MA=!!q.morphAttributes.position,XA=!!q.morphAttributes.normal,fe=!!q.morphAttributes.color;let Fe=ri;Y.toneMapped&&(v===null||v.isXRRenderTarget===!0)&&(Fe=l.toneMapping);const Ue=q.morphAttributes.position||q.morphAttributes.normal||q.morphAttributes.color,pe=Ue!==void 0?Ue.length:0,FA=f.get(Y),le=D.state.lights;if(bA===!0&&(se===!0||m!==W)){const Bt=m===W&&Y.id===P;yA.setState(Y,m,Bt)}let Qe=!1;Y.version===FA.__version?(FA.needsLights&&FA.lightsStateVersion!==le.state.version||FA.outputColorSpace!==xA||K.isBatchedMesh&&FA.batching===!1||!K.isBatchedMesh&&FA.batching===!0||K.isBatchedMesh&&FA.batchingColor===!0&&K.colorTexture===null||K.isBatchedMesh&&FA.batchingColor===!1&&K.colorTexture!==null||K.isInstancedMesh&&FA.instancing===!1||!K.isInstancedMesh&&FA.instancing===!0||K.isSkinnedMesh&&FA.skinning===!1||!K.isSkinnedMesh&&FA.skinning===!0||K.isInstancedMesh&&FA.instancingColor===!0&&K.instanceColor===null||K.isInstancedMesh&&FA.instancingColor===!1&&K.instanceColor!==null||K.isInstancedMesh&&FA.instancingMorph===!0&&K.morphTexture===null||K.isInstancedMesh&&FA.instancingMorph===!1&&K.morphTexture!==null||FA.envMap!==mA||Y.fog===!0&&FA.fog!==dA||FA.numClippingPlanes!==void 0&&(FA.numClippingPlanes!==yA.numPlanes||FA.numIntersection!==yA.numIntersection)||FA.vertexAlphas!==GA||FA.vertexTangents!==UA||FA.morphTargets!==MA||FA.morphNormals!==XA||FA.morphColors!==fe||FA.toneMapping!==Fe||FA.morphTargetsCount!==pe)&&(Qe=!0):(Qe=!0,FA.__version=Y.version);let kt=FA.currentProgram;Qe===!0&&(kt=vn(Y,L,K));let qI=!1,St=!1,XC=!1;const ye=kt.getUniforms(),ut=FA.uniforms;if(kA.useProgram(kt.program)&&(qI=!0,St=!0,XC=!0),Y.id!==P&&(P=Y.id,St=!0),qI||W!==m){kA.buffers.depth.getReversed()&&m.reversedDepth!==!0&&(m._reversedDepth=!0,m.updateProjectionMatrix()),ye.setValue(R,"projectionMatrix",m.projectionMatrix),ye.setValue(R,"viewMatrix",m.matrixWorldInverse);const ft=ye.map.cameraPosition;ft!==void 0&&ft.setValue(R,ne.setFromMatrixPosition(m.matrixWorld)),we.logarithmicDepthBuffer&&ye.setValue(R,"logDepthBufFC",2/(Math.log(m.far+1)/Math.LN2)),(Y.isMeshPhongMaterial||Y.isMeshToonMaterial||Y.isMeshLambertMaterial||Y.isMeshBasicMaterial||Y.isMeshStandardMaterial||Y.isShaderMaterial)&&ye.setValue(R,"isOrthographic",m.isOrthographicCamera===!0),W!==m&&(W=m,St=!0,XC=!0)}if(FA.needsLights&&(le.state.directionalShadowMap.length>0&&ye.setValue(R,"directionalShadowMap",le.state.directionalShadowMap,F),le.state.spotShadowMap.length>0&&ye.setValue(R,"spotShadowMap",le.state.spotShadowMap,F),le.state.pointShadowMap.length>0&&ye.setValue(R,"pointShadowMap",le.state.pointShadowMap,F)),K.isSkinnedMesh){ye.setOptional(R,K,"bindMatrix"),ye.setOptional(R,K,"bindMatrixInverse");const Bt=K.skeleton;Bt&&(Bt.boneTexture===null&&Bt.computeBoneTexture(),ye.setValue(R,"boneTexture",Bt.boneTexture,F))}K.isBatchedMesh&&(ye.setOptional(R,K,"batchingTexture"),ye.setValue(R,"batchingTexture",K._matricesTexture,F),ye.setOptional(R,K,"batchingIdTexture"),ye.setValue(R,"batchingIdTexture",K._indirectTexture,F),ye.setOptional(R,K,"batchingColorTexture"),K._colorsTexture!==null&&ye.setValue(R,"batchingColorTexture",K._colorsTexture,F));const vt=q.morphAttributes;if((vt.position!==void 0||vt.normal!==void 0||vt.color!==void 0)&&WA.update(K,q,kt),(St||FA.receiveShadow!==K.receiveShadow)&&(FA.receiveShadow=K.receiveShadow,ye.setValue(R,"receiveShadow",K.receiveShadow)),Y.isMeshGouraudMaterial&&Y.envMap!==null&&(ut.envMap.value=mA,ut.flipEnvMap.value=mA.isCubeTexture&&mA.isRenderTargetTexture===!1?-1:1),Y.isMeshStandardMaterial&&Y.envMap===null&&L.environment!==null&&(ut.envMapIntensity.value=L.environmentIntensity),ut.dfgLUT!==void 0&&(ut.dfgLUT.value=Gm()),St&&(ye.setValue(R,"toneMappingExposure",l.toneMappingExposure),FA.needsLights&&jk(ut,XC),dA&&Y.fog===!0&&LA.refreshFogUniforms(ut,dA),LA.refreshMaterialUniforms(ut,Y,YA,TA,D.state.transmissionRenderTarget[m.id]),ln.upload(R,mh(FA),ut,F)),Y.isShaderMaterial&&Y.uniformsNeedUpdate===!0&&(ln.upload(R,mh(FA),ut,F),Y.uniformsNeedUpdate=!1),Y.isSpriteMaterial&&ye.setValue(R,"center",K.center),ye.setValue(R,"modelViewMatrix",K.modelViewMatrix),ye.setValue(R,"normalMatrix",K.normalMatrix),ye.setValue(R,"modelMatrix",K.matrixWorld),Y.isShaderMaterial||Y.isRawShaderMaterial){const Bt=Y.uniformsGroups;for(let ft=0,mr=Bt.length;ft<mr;ft++){const zg=Bt[ft];IA.update(zg,kt),IA.bind(zg,kt)}}return kt}function jk(m,L){m.ambientLightColor.needsUpdate=L,m.lightProbe.needsUpdate=L,m.directionalLights.needsUpdate=L,m.directionalLightShadows.needsUpdate=L,m.pointLights.needsUpdate=L,m.pointLightShadows.needsUpdate=L,m.spotLights.needsUpdate=L,m.spotLightShadows.needsUpdate=L,m.rectAreaLights.needsUpdate=L,m.hemisphereLights.needsUpdate=L}function Wk(m){return m.isMeshLambertMaterial||m.isMeshToonMaterial||m.isMeshPhongMaterial||m.isMeshStandardMaterial||m.isShadowMaterial||m.isShaderMaterial&&m.lights===!0}this.getActiveCubeFace=function(){return N},this.getActiveMipmapLevel=function(){return U},this.getRenderTarget=function(){return v},this.setRenderTargetTextures=function(m,L,q){const Y=f.get(m);Y.__autoAllocateDepthBuffer=m.resolveDepthBuffer===!1,Y.__autoAllocateDepthBuffer===!1&&(Y.__useRenderToTexture=!1),f.get(m.texture).__webglTexture=L,f.get(m.depthTexture).__webglTexture=Y.__autoAllocateDepthBuffer?void 0:q,Y.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(m,L){const q=f.get(m);q.__webglFramebuffer=L,q.__useDefaultFramebuffer=L===void 0};const Xk=R.createFramebuffer();this.setRenderTarget=function(m,L=0,q=0){v=m,N=L,U=q;let Y=null,K=!1,dA=!1;if(m){const xA=f.get(m);if(xA.__useDefaultFramebuffer!==void 0){kA.bindFramebuffer(R.FRAMEBUFFER,xA.__webglFramebuffer),H.copy(m.viewport),O.copy(m.scissor),z=m.scissorTest,kA.viewport(H),kA.scissor(O),kA.setScissorTest(z),P=-1;return}else if(xA.__webglFramebuffer===void 0)F.setupRenderTarget(m);else if(xA.__hasExternalTextures)F.rebindTextures(m,f.get(m.texture).__webglTexture,f.get(m.depthTexture).__webglTexture);else if(m.depthBuffer){const UA=m.depthTexture;if(xA.__boundDepthTexture!==UA){if(UA!==null&&f.has(UA)&&(m.width!==UA.image.width||m.height!==UA.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");F.setupDepthRenderbuffer(m)}}const mA=m.texture;(mA.isData3DTexture||mA.isDataArrayTexture||mA.isCompressedArrayTexture)&&(dA=!0);const GA=f.get(m).__webglFramebuffer;m.isWebGLCubeRenderTarget?(Array.isArray(GA[L])?Y=GA[L][q]:Y=GA[L],K=!0):m.samples>0&&F.useMultisampledRTT(m)===!1?Y=f.get(m).__webglMultisampledFramebuffer:Array.isArray(GA)?Y=GA[q]:Y=GA,H.copy(m.viewport),O.copy(m.scissor),z=m.scissorTest}else H.copy(Z).multiplyScalar(YA).floor(),O.copy(gA).multiplyScalar(YA).floor(),z=wA;if(q!==0&&(Y=Xk),kA.bindFramebuffer(R.FRAMEBUFFER,Y)&&kA.drawBuffers(m,Y),kA.viewport(H),kA.scissor(O),kA.setScissorTest(z),K){const xA=f.get(m.texture);R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_CUBE_MAP_POSITIVE_X+L,xA.__webglTexture,q)}else if(dA){const xA=L;for(let mA=0;mA<m.textures.length;mA++){const GA=f.get(m.textures[mA]);R.framebufferTextureLayer(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0+mA,GA.__webglTexture,q,xA)}}else if(m!==null&&q!==0){const xA=f.get(m.texture);R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_2D,xA.__webglTexture,q)}P=-1},this.readRenderTargetPixels=function(m,L,q,Y,K,dA,pA,xA=0){if(!(m&&m.isWebGLRenderTarget)){ae("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let mA=f.get(m).__webglFramebuffer;if(m.isWebGLCubeRenderTarget&&pA!==void 0&&(mA=mA[pA]),mA){kA.bindFramebuffer(R.FRAMEBUFFER,mA);try{const GA=m.textures[xA],UA=GA.format,MA=GA.type;if(!we.textureFormatReadable(UA)){ae("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!we.textureTypeReadable(MA)){ae("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}L>=0&&L<=m.width-Y&&q>=0&&q<=m.height-K&&(m.textures.length>1&&R.readBuffer(R.COLOR_ATTACHMENT0+xA),R.readPixels(L,q,Y,K,nA.convert(UA),nA.convert(MA),dA))}finally{const GA=v!==null?f.get(v).__webglFramebuffer:null;kA.bindFramebuffer(R.FRAMEBUFFER,GA)}}},this.readRenderTargetPixelsAsync=async function(m,L,q,Y,K,dA,pA,xA=0){if(!(m&&m.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let mA=f.get(m).__webglFramebuffer;if(m.isWebGLCubeRenderTarget&&pA!==void 0&&(mA=mA[pA]),mA)if(L>=0&&L<=m.width-Y&&q>=0&&q<=m.height-K){kA.bindFramebuffer(R.FRAMEBUFFER,mA);const GA=m.textures[xA],UA=GA.format,MA=GA.type;if(!we.textureFormatReadable(UA))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!we.textureTypeReadable(MA))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const XA=R.createBuffer();R.bindBuffer(R.PIXEL_PACK_BUFFER,XA),R.bufferData(R.PIXEL_PACK_BUFFER,dA.byteLength,R.STREAM_READ),m.textures.length>1&&R.readBuffer(R.COLOR_ATTACHMENT0+xA),R.readPixels(L,q,Y,K,nA.convert(UA),nA.convert(MA),0);const fe=v!==null?f.get(v).__webglFramebuffer:null;kA.bindFramebuffer(R.FRAMEBUFFER,fe);const Fe=R.fenceSync(R.SYNC_GPU_COMMANDS_COMPLETE,0);return R.flush(),await UD(R,Fe,4),R.bindBuffer(R.PIXEL_PACK_BUFFER,XA),R.getBufferSubData(R.PIXEL_PACK_BUFFER,0,dA),R.deleteBuffer(XA),R.deleteSync(Fe),dA}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(m,L=null,q=0){const Y=Math.pow(2,-q),K=Math.floor(m.image.width*Y),dA=Math.floor(m.image.height*Y),pA=L!==null?L.x:0,xA=L!==null?L.y:0;F.setTexture2D(m,0),R.copyTexSubImage2D(R.TEXTURE_2D,q,0,0,pA,xA,K,dA),kA.unbindTexture()};const Zk=R.createFramebuffer(),zk=R.createFramebuffer();this.copyTextureToTexture=function(m,L,q=null,Y=null,K=0,dA=null){dA===null&&(K!==0?(xC("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),dA=K,K=0):dA=0);let pA,xA,mA,GA,UA,MA,XA,fe,Fe;const Ue=m.isCompressedTexture?m.mipmaps[dA]:m.image;if(q!==null)pA=q.max.x-q.min.x,xA=q.max.y-q.min.y,mA=q.isBox3?q.max.z-q.min.z:1,GA=q.min.x,UA=q.min.y,MA=q.isBox3?q.min.z:0;else{const vt=Math.pow(2,-K);pA=Math.floor(Ue.width*vt),xA=Math.floor(Ue.height*vt),m.isDataArrayTexture?mA=Ue.depth:m.isData3DTexture?mA=Math.floor(Ue.depth*vt):mA=1,GA=0,UA=0,MA=0}Y!==null?(XA=Y.x,fe=Y.y,Fe=Y.z):(XA=0,fe=0,Fe=0);const pe=nA.convert(L.format),FA=nA.convert(L.type);let le;L.isData3DTexture?(F.setTexture3D(L,0),le=R.TEXTURE_3D):L.isDataArrayTexture||L.isCompressedArrayTexture?(F.setTexture2DArray(L,0),le=R.TEXTURE_2D_ARRAY):(F.setTexture2D(L,0),le=R.TEXTURE_2D),R.pixelStorei(R.UNPACK_FLIP_Y_WEBGL,L.flipY),R.pixelStorei(R.UNPACK_PREMULTIPLY_ALPHA_WEBGL,L.premultiplyAlpha),R.pixelStorei(R.UNPACK_ALIGNMENT,L.unpackAlignment);const Qe=R.getParameter(R.UNPACK_ROW_LENGTH),kt=R.getParameter(R.UNPACK_IMAGE_HEIGHT),qI=R.getParameter(R.UNPACK_SKIP_PIXELS),St=R.getParameter(R.UNPACK_SKIP_ROWS),XC=R.getParameter(R.UNPACK_SKIP_IMAGES);R.pixelStorei(R.UNPACK_ROW_LENGTH,Ue.width),R.pixelStorei(R.UNPACK_IMAGE_HEIGHT,Ue.height),R.pixelStorei(R.UNPACK_SKIP_PIXELS,GA),R.pixelStorei(R.UNPACK_SKIP_ROWS,UA),R.pixelStorei(R.UNPACK_SKIP_IMAGES,MA);const ye=m.isDataArrayTexture||m.isData3DTexture,ut=L.isDataArrayTexture||L.isData3DTexture;if(m.isDepthTexture){const vt=f.get(m),Bt=f.get(L),ft=f.get(vt.__renderTarget),mr=f.get(Bt.__renderTarget);kA.bindFramebuffer(R.READ_FRAMEBUFFER,ft.__webglFramebuffer),kA.bindFramebuffer(R.DRAW_FRAMEBUFFER,mr.__webglFramebuffer);for(let zg=0;zg<mA;zg++)ye&&(R.framebufferTextureLayer(R.READ_FRAMEBUFFER,R.COLOR_ATTACHMENT0,f.get(m).__webglTexture,K,MA+zg),R.framebufferTextureLayer(R.DRAW_FRAMEBUFFER,R.COLOR_ATTACHMENT0,f.get(L).__webglTexture,dA,Fe+zg)),R.blitFramebuffer(GA,UA,pA,xA,XA,fe,pA,xA,R.DEPTH_BUFFER_BIT,R.NEAREST);kA.bindFramebuffer(R.READ_FRAMEBUFFER,null),kA.bindFramebuffer(R.DRAW_FRAMEBUFFER,null)}else if(K!==0||m.isRenderTargetTexture||f.has(m)){const vt=f.get(m),Bt=f.get(L);kA.bindFramebuffer(R.READ_FRAMEBUFFER,Zk),kA.bindFramebuffer(R.DRAW_FRAMEBUFFER,zk);for(let ft=0;ft<mA;ft++)ye?R.framebufferTextureLayer(R.READ_FRAMEBUFFER,R.COLOR_ATTACHMENT0,vt.__webglTexture,K,MA+ft):R.framebufferTexture2D(R.READ_FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_2D,vt.__webglTexture,K),ut?R.framebufferTextureLayer(R.DRAW_FRAMEBUFFER,R.COLOR_ATTACHMENT0,Bt.__webglTexture,dA,Fe+ft):R.framebufferTexture2D(R.DRAW_FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_2D,Bt.__webglTexture,dA),K!==0?R.blitFramebuffer(GA,UA,pA,xA,XA,fe,pA,xA,R.COLOR_BUFFER_BIT,R.NEAREST):ut?R.copyTexSubImage3D(le,dA,XA,fe,Fe+ft,GA,UA,pA,xA):R.copyTexSubImage2D(le,dA,XA,fe,GA,UA,pA,xA);kA.bindFramebuffer(R.READ_FRAMEBUFFER,null),kA.bindFramebuffer(R.DRAW_FRAMEBUFFER,null)}else ut?m.isDataTexture||m.isData3DTexture?R.texSubImage3D(le,dA,XA,fe,Fe,pA,xA,mA,pe,FA,Ue.data):L.isCompressedArrayTexture?R.compressedTexSubImage3D(le,dA,XA,fe,Fe,pA,xA,mA,pe,Ue.data):R.texSubImage3D(le,dA,XA,fe,Fe,pA,xA,mA,pe,FA,Ue):m.isDataTexture?R.texSubImage2D(R.TEXTURE_2D,dA,XA,fe,pA,xA,pe,FA,Ue.data):m.isCompressedTexture?R.compressedTexSubImage2D(R.TEXTURE_2D,dA,XA,fe,Ue.width,Ue.height,pe,Ue.data):R.texSubImage2D(R.TEXTURE_2D,dA,XA,fe,pA,xA,pe,FA,Ue);R.pixelStorei(R.UNPACK_ROW_LENGTH,Qe),R.pixelStorei(R.UNPACK_IMAGE_HEIGHT,kt),R.pixelStorei(R.UNPACK_SKIP_PIXELS,qI),R.pixelStorei(R.UNPACK_SKIP_ROWS,St),R.pixelStorei(R.UNPACK_SKIP_IMAGES,XC),dA===0&&L.generateMipmaps&&R.generateMipmap(le),kA.unbindTexture()},this.initRenderTarget=function(m){f.get(m).__webglFramebuffer===void 0&&F.setupRenderTarget(m)},this.initTexture=function(m){m.isCubeTexture?F.setTextureCube(m,0):m.isData3DTexture?F.setTexture3D(m,0):m.isDataArrayTexture||m.isCompressedArrayTexture?F.setTexture2DArray(m,0):F.setTexture2D(m,0),kA.unbindTexture()},this.resetState=function(){N=0,U=0,v=null,kA.reset(),DA.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return ci}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(A){this._outputColorSpace=A;const e=this.getContext();e.drawingBufferColorSpace=oe._getDrawingBufferColorSpace(A),e.unpackColorSpace=oe._getUnpackColorSpace()}}const Fm=`
4166
4166
  uniform float uTime;
4167
4167
  uniform float uAudioBass;
4168
4168
  uniform float uAudioMid;
@@ -4545,7 +4545,7 @@ void main() {
4545
4545
  // Softer alpha for more diffuse appearance
4546
4546
  gl_FragColor = vec4(glowColor, glow * 0.4);
4547
4547
  }
4548
- `,jg={primary:"#6366f1",secondary:"#8b5cf6",accent:"#06b6d4",glow:"#818cf8",atmosphere:"#c4b5fd",depth:"#312e81",highlight:"#e0e7ff"},Km={size:1,segments:128,colors:jg,morphStrength:1,noiseScale:1.5,noiseSpeed:.3,glowIntensity:.8,idleGlowMultiplier:.4,fresnelPower:2.5,rotationSpeed:.1,audioReactivity:3,audioSmoothing:.9,idleMorphMultiplier:.25,colorContrast:1.5};class un{constructor(A,e={}){this.orb=null,this.glowMesh=null,this.orbMaterial=null,this.glowMaterial=null,this.animationId=null,this.isActive=!1,this.targetRotation={x:0,y:0},this.currentRotation={x:0,y:0},this.audioValues={bass:0,mid:0,treble:0,level:0},this.resizeObserver=null,this.resizeTimeoutId=null,this.isContextLost=!1,this.animate=()=>{if(this.isContextLost)return;this.animationId=requestAnimationFrame(this.animate);const Q=this.clock.getElapsedTime();if(this.clock.getDelta(),this.orbMaterial){this.orbMaterial.uniforms.uTime.value=Q,this.orbMaterial.uniforms.uAudioBass.value=this.audioValues.bass,this.orbMaterial.uniforms.uAudioMid.value=this.audioValues.mid,this.orbMaterial.uniforms.uAudioTreble.value=this.audioValues.treble,this.orbMaterial.uniforms.uAudioLevel.value=this.audioValues.level;const r=this.isActive?this.config.morphStrength*1.5:this.config.morphStrength*this.config.idleMorphMultiplier,B=this.orbMaterial.uniforms.uMorphStrength.value;this.orbMaterial.uniforms.uMorphStrength.value+=(r-B)*.05}if(this.glowMaterial){this.glowMaterial.uniforms.uTime.value=Q,this.glowMaterial.uniforms.uAudioLevel.value=this.audioValues.level;const r=this.isActive?this.config.glowIntensity*1.5:this.config.glowIntensity*this.config.idleGlowMultiplier,B=this.glowMaterial.uniforms.uGlowIntensity.value;this.glowMaterial.uniforms.uGlowIntensity.value+=(r-B)*.05}this.currentRotation.x+=(this.targetRotation.x-this.currentRotation.x)*.05,this.currentRotation.y+=(this.targetRotation.y-this.currentRotation.y)*.05,this.orb&&(this.orb.rotation.x=this.currentRotation.x+Q*this.config.rotationSpeed*.3,this.orb.rotation.y=this.currentRotation.y+Q*this.config.rotationSpeed),this.glowMesh&&(this.glowMesh.rotation.x=this.currentRotation.x+Q*this.config.rotationSpeed*.3,this.glowMesh.rotation.y=this.currentRotation.y+Q*this.config.rotationSpeed),this.renderer.render(this.scene,this.camera)},this.handleResize=()=>{this.resizeTimeoutId!==null&&clearTimeout(this.resizeTimeoutId),this.resizeTimeoutId=setTimeout(()=>{this.resizeTimeoutId=null;const Q=this.container.clientWidth,r=this.container.clientHeight;if(Q===0||r===0)return;const B=Q*this.canvasPadding,h=r*this.canvasPadding;this.camera.aspect=B/h,this.camera.updateProjectionMatrix(),this.renderer.setSize(B,h)},100)},this.handleMouseMove=Q=>{const r=this.container.getBoundingClientRect(),B=(Q.clientX-r.left)/r.width*2-1,h=-((Q.clientY-r.top)/r.height)*2+1;this.targetRotation.x=h*.3,this.targetRotation.y=B*.3},this.handleMouseLeave=()=>{this.targetRotation.x=0,this.targetRotation.y=0},this.container=A,this.config={...Km,...e},this.clock=new l2;const t=/iPhone|iPad|iPod/i.test(navigator.userAgent),g=/Android/i.test(navigator.userAgent);this.canvasPadding=t?1.5:g?2:3,this.boundHandleContextLost=this.handleContextLost.bind(this),this.boundHandleContextRestored=this.handleContextRestored.bind(this),this.scene=new n2;const I=A.clientWidth*this.canvasPadding,C=A.clientHeight*this.canvasPadding,o=I/C;this.camera=new Lt(45,o,.1,100);const n=3,a=9;this.camera.position.z=a*(this.canvasPadding/n),this.renderer=new Mm({antialias:!0,alpha:!0,powerPreference:"high-performance"}),this.renderer.setPixelRatio(Math.min(window.devicePixelRatio,2)),this.renderer.setSize(I,C),this.renderer.setClearColor(0,0);const s=this.renderer.domElement;s.style.position="absolute",s.style.left="50%",s.style.top="50%",s.style.transform="translate(-50%, -50%)",s.style.pointerEvents="none",A.appendChild(s),s.addEventListener("webglcontextlost",this.boundHandleContextLost),s.addEventListener("webglcontextrestored",this.boundHandleContextRestored),this.createOrb(),window.addEventListener("resize",this.handleResize),this.resizeObserver=new ResizeObserver(this.handleResize),this.resizeObserver.observe(A),A.addEventListener("mousemove",this.handleMouseMove),A.addEventListener("mouseleave",this.handleMouseLeave)}handleContextLost(A){A.preventDefault(),this.isContextLost=!0,this.stop()}handleContextRestored(A){this.isContextLost=!1,this.recreateAfterContextLoss(),this.start()}recreateAfterContextLoss(){this.orb&&(this.orb.geometry.dispose(),this.scene.remove(this.orb),this.orb=null),this.glowMesh&&(this.glowMesh.geometry.dispose(),this.scene.remove(this.glowMesh),this.glowMesh=null),this.orbMaterial&&(this.orbMaterial.dispose(),this.orbMaterial=null),this.glowMaterial&&(this.glowMaterial.dispose(),this.glowMaterial=null),this.createOrb()}createOrb(){const A={...jg,...this.config.colors},e=new OQ(this.config.size,this.config.segments/4);this.orbMaterial=new Ut({vertexShader:Fm,fragmentShader:Um,uniforms:{uTime:{value:0},uAudioBass:{value:0},uAudioMid:{value:0},uAudioTreble:{value:0},uAudioLevel:{value:0},uMorphStrength:{value:this.config.morphStrength},uNoiseScale:{value:this.config.noiseScale},uNoiseSpeed:{value:this.config.noiseSpeed},uAudioReactivity:{value:this.config.audioReactivity},uColorPrimary:{value:new Ie(A.primary)},uColorSecondary:{value:new Ie(A.secondary)},uColorAccent:{value:new Ie(A.accent)},uColorDepth:{value:new Ie(A.depth||jg.depth)},uColorHighlight:{value:new Ie(A.highlight||jg.highlight)},uFresnelPower:{value:this.config.fresnelPower},uGlowIntensity:{value:this.config.glowIntensity},uColorContrast:{value:this.config.colorContrast}},transparent:!0,side:Mi}),this.orb=new Ai(e,this.orbMaterial),this.scene.add(this.orb);const t=new VQ(this.config.size,64,64);this.glowMaterial=new Ut({vertexShader:Lm,fragmentShader:vm,uniforms:{uTime:{value:0},uAudioLevel:{value:0},uGlowColor:{value:new Ie(A.glow)},uGlowIntensity:{value:this.config.glowIntensity*.6},uPulseSpeed:{value:2}},transparent:!0,side:It,blending:hs,depthWrite:!1}),this.glowMesh=new Ai(t,this.glowMaterial),this.scene.add(this.glowMesh)}updateAudio(A){const e=this.config.audioSmoothing;this.audioValues.bass+=(A.bass-this.audioValues.bass)*e,this.audioValues.mid+=(A.mid-this.audioValues.mid)*e,this.audioValues.treble+=(A.treble-this.audioValues.treble)*e,this.audioValues.level+=(A.level-this.audioValues.level)*e}setSimulatedAudio(A,e,t,g){const I=this.config.audioSmoothing;this.audioValues.bass+=(A-this.audioValues.bass)*I,this.audioValues.mid+=(e-this.audioValues.mid)*I,this.audioValues.treble+=(t-this.audioValues.treble)*I,this.audioValues.level+=(g-this.audioValues.level)*I}setActive(A){this.isActive=A}setColors(A){const e={...jg,...this.config.colors,...A};this.orbMaterial&&(this.orbMaterial.uniforms.uColorPrimary.value.set(e.primary),this.orbMaterial.uniforms.uColorSecondary.value.set(e.secondary),this.orbMaterial.uniforms.uColorAccent.value.set(e.accent),this.orbMaterial.uniforms.uColorDepth.value.set(e.depth||jg.depth),this.orbMaterial.uniforms.uColorHighlight.value.set(e.highlight||jg.highlight)),this.glowMaterial&&this.glowMaterial.uniforms.uGlowColor.value.set(e.glow)}setGlowSettings(A,e){this.config.glowIntensity=A,this.config.idleGlowMultiplier=e}start(){this.animationId===null&&(this.clock.start(),this.animate())}stop(){this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null)}getCanvas(){return this.renderer.domElement}destroy(){this.stop(),this.resizeTimeoutId!==null&&(clearTimeout(this.resizeTimeoutId),this.resizeTimeoutId=null),window.removeEventListener("resize",this.handleResize),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.container.removeEventListener("mousemove",this.handleMouseMove),this.container.removeEventListener("mouseleave",this.handleMouseLeave);const A=this.renderer.domElement;A.removeEventListener("webglcontextlost",this.boundHandleContextLost),A.removeEventListener("webglcontextrestored",this.boundHandleContextRestored),this.orb&&(this.orb.geometry.dispose(),this.scene.remove(this.orb),this.orb=null),this.glowMesh&&(this.glowMesh.geometry.dispose(),this.scene.remove(this.glowMesh),this.glowMesh=null),this.orbMaterial&&(this.orbMaterial.dispose(),this.orbMaterial=null),this.glowMaterial&&(this.glowMaterial.dispose(),this.glowMaterial=null),this.renderer.dispose(),A.parentNode&&A.parentNode.removeChild(A)}}class fn{constructor(A={}){this.audioContext=null,this.analyser=null,this.source=null,this.localSource=null,this.mixer=null,this.frequencyData=new Uint8Array(0),this.waveformData=new Float32Array(0),this.hasAcquiredContext=!1,this.smoothedBass=0,this.smoothedMid=0,this.smoothedTreble=0,this.smoothedLevel=0,this.smoothingFactor=.3,this.options={fftSize:A.fftSize??2048,smoothingTimeConstant:A.smoothingTimeConstant??.8,minDecibels:A.minDecibels??-90,maxDecibels:A.maxDecibels??-10}}async ensureAudioContext(){if(!this.audioContext)this.audioContext=await Qi.acquire(),this.audioContext&&(this.hasAcquiredContext=!0);else if(!await Qi.ensureResumed())return null;return this.audioContext}async connectStream(A){const e=await this.ensureAudioContext();if(!e){console.warn("[AudioAnalyzer] Could not acquire AudioContext");return}if(this.source)try{this.source.disconnect()}catch{}this.source=e.createMediaStreamSource(A),this.setupMixerAndAnalyser(),this.mixer&&this.source.connect(this.mixer)}async connectLocalStream(A){const e=await this.ensureAudioContext();if(!e){console.warn("[AudioAnalyzer] Could not acquire AudioContext");return}if(this.localSource)try{this.localSource.disconnect()}catch{}this.localSource=e.createMediaStreamSource(A),this.setupMixerAndAnalyser(),this.mixer&&this.localSource.connect(this.mixer)}setupMixerAndAnalyser(){this.audioContext&&(this.mixer||(this.mixer=this.audioContext.createGain(),this.mixer.gain.value=1),this.analyser||(this.analyser=this.audioContext.createAnalyser()),this.analyser.fftSize=this.options.fftSize,this.analyser.smoothingTimeConstant=this.options.smoothingTimeConstant,this.analyser.minDecibels=this.options.minDecibels,this.analyser.maxDecibels=this.options.maxDecibels,this.mixer.disconnect(),this.mixer.connect(this.analyser),this.frequencyData=new Uint8Array(this.analyser.frequencyBinCount),this.waveformData=new Float32Array(this.analyser.fftSize))}async connectAudioElement(A){const e=await this.ensureAudioContext();if(!e){console.warn("[AudioAnalyzer] Could not acquire AudioContext");return}if(this.source)try{this.source.disconnect()}catch{}const t=e.createMediaElementSource(A);this.analyser||(this.analyser=e.createAnalyser()),this.analyser.fftSize=this.options.fftSize,this.analyser.smoothingTimeConstant=this.options.smoothingTimeConstant,this.analyser.minDecibels=this.options.minDecibels,this.analyser.maxDecibels=this.options.maxDecibels,t.connect(this.analyser),this.analyser.connect(e.destination),this.frequencyData=new Uint8Array(this.analyser.frequencyBinCount),this.waveformData=new Float32Array(this.analyser.fftSize)}getAudioData(){if(!this.analyser)return{bass:0,mid:0,treble:0,level:0,waveform:new Float32Array(0),frequency:new Uint8Array(0)};this.analyser.getByteFrequencyData(this.frequencyData),this.analyser.getFloatTimeDomainData(this.waveformData);const{bass:A,mid:e,treble:t}=this.calculateFrequencyBands(),g=this.calculateOverallLevel();return this.smoothedBass+=(A-this.smoothedBass)*this.smoothingFactor,this.smoothedMid+=(e-this.smoothedMid)*this.smoothingFactor,this.smoothedTreble+=(t-this.smoothedTreble)*this.smoothingFactor,this.smoothedLevel+=(g-this.smoothedLevel)*this.smoothingFactor,{bass:this.smoothedBass,mid:this.smoothedMid,treble:this.smoothedTreble,level:this.smoothedLevel,waveform:this.waveformData,frequency:this.frequencyData}}calculateFrequencyBands(){if(!this.audioContext||this.frequencyData.length===0)return{bass:0,mid:0,treble:0};const A=this.audioContext.sampleRate,e=this.frequencyData.length,t=A/(e*2),g=Math.floor(250/t),I=Math.floor(2e3/t);let C=0,o=0,n=0;for(let r=0;r<e;r++){const B=this.frequencyData[r]/255;r<g?C+=B:r<I?o+=B:n+=B}const a=g>0?C/g:0,s=I-g>0?o/(I-g):0,Q=e-I>0?n/(e-I):0;return{bass:Math.pow(a,.8),mid:Math.pow(s,.9),treble:Math.pow(Q,1.1)}}calculateOverallLevel(){if(this.frequencyData.length===0)return 0;let A=0;for(let t=0;t<this.frequencyData.length;t++)A+=this.frequencyData[t];const e=A/this.frequencyData.length/255;return Math.pow(e,.8)}getPeakLevel(){if(this.frequencyData.length===0)return 0;let A=0;for(let e=0;e<this.frequencyData.length;e++)this.frequencyData[e]>A&&(A=this.frequencyData[e]);return A/255}isActive(){return this.audioContext!==null&&this.audioContext.state==="running"}disconnect(){if(this.source){try{this.source.disconnect()}catch{}this.source=null}if(this.localSource){try{this.localSource.disconnect()}catch{}this.localSource=null}if(this.mixer){try{this.mixer.disconnect()}catch{}this.mixer=null}if(this.analyser){try{this.analyser.disconnect()}catch{}this.analyser=null}this.hasAcquiredContext&&(Qi.release(),this.hasAcquiredContext=!1),this.audioContext=null,this.smoothedBass=0,this.smoothedMid=0,this.smoothedTreble=0,this.smoothedLevel=0}getAudioContext(){return this.audioContext}getAnalyser(){return this.analyser}}class GC{constructor(A={}){this.hasAcquired=!1,this.config={enabled:!0,volume:.3,preset:"1",...A}}async ensureContext(){if(!this.config.enabled||this.config.preset==="none")return null;const A=await Qi.acquire();return A&&(this.hasAcquired=!0),A}async prewarm(){await this.ensureContext()}async playDrop(A){const e=await this.ensureContext();if(!e)return;const t=e.currentTime,g=this.config.volume,I=A?900:700,C=A?500:400,o=e.createOscillator(),n=e.createGain();o.type="sine",o.frequency.setValueAtTime(I,t),o.frequency.exponentialRampToValueAtTime(C,t+.15),n.gain.setValueAtTime(0,t),n.gain.linearRampToValueAtTime(g*.3,t+.015),n.gain.linearRampToValueAtTime(g*.2,t+.1),n.gain.exponentialRampToValueAtTime(.001,t+.35),o.connect(n).connect(e.destination),o.start(t),o.stop(t+.4)}async playGlassTap(A){const e=await this.ensureContext();if(!e)return;const t=e.currentTime,g=this.config.volume,I=A?2200:1760,C=e.createOscillator(),o=e.createGain();C.type="sine",C.frequency.setValueAtTime(I,t),o.gain.setValueAtTime(0,t),o.gain.linearRampToValueAtTime(g*.25,t+.002),o.gain.exponentialRampToValueAtTime(g*.1,t+.08),o.gain.exponentialRampToValueAtTime(.001,t+.3),C.connect(o).connect(e.destination),C.start(t),C.stop(t+.35);const n=e.createOscillator(),a=e.createGain();n.type="sine",n.frequency.setValueAtTime(I*2.5,t),a.gain.setValueAtTime(0,t),a.gain.linearRampToValueAtTime(g*.08,t+.001),a.gain.exponentialRampToValueAtTime(.001,t+.12),n.connect(a).connect(e.destination),n.start(t),n.stop(t+.15)}async playWhoosh(A){const e=await this.ensureContext();if(!e)return;const t=e.currentTime,g=this.config.volume,I=e.sampleRate*.5,C=e.createBuffer(1,I,e.sampleRate),o=C.getChannelData(0);for(let B=0;B<I;B++)o[B]=Math.random()*2-1;const n=e.createBufferSource();n.buffer=C;const a=e.createBiquadFilter();a.type="bandpass",a.Q.setValueAtTime(2,t);const s=e.createGain();A?(a.frequency.setValueAtTime(300,t),a.frequency.exponentialRampToValueAtTime(2e3,t+.15),a.frequency.exponentialRampToValueAtTime(800,t+.35),s.gain.setValueAtTime(0,t),s.gain.linearRampToValueAtTime(g*.3,t+.05),s.gain.linearRampToValueAtTime(g*.4,t+.15),s.gain.exponentialRampToValueAtTime(.001,t+.4)):(a.frequency.setValueAtTime(1500,t),a.frequency.exponentialRampToValueAtTime(200,t+.3),s.gain.setValueAtTime(0,t),s.gain.linearRampToValueAtTime(g*.35,t+.05),s.gain.exponentialRampToValueAtTime(.001,t+.35));const Q=e.createOscillator(),r=e.createGain();Q.type="sine",A?(Q.frequency.setValueAtTime(300,t),Q.frequency.linearRampToValueAtTime(500,t+.2)):(Q.frequency.setValueAtTime(400,t),Q.frequency.linearRampToValueAtTime(200,t+.25)),r.gain.setValueAtTime(0,t),r.gain.linearRampToValueAtTime(g*.15,t+.05),r.gain.exponentialRampToValueAtTime(.001,t+.35),n.connect(a).connect(s).connect(e.destination),Q.connect(r).connect(e.destination),n.start(t),n.stop(t+.5),Q.start(t),Q.stop(t+.4)}async playGentleNote(A){const e=await this.ensureContext();if(!e)return;const t=e.currentTime,g=this.config.volume,I=A?659.25:523.25,C=e.createOscillator(),o=e.createGain();C.type="sine",C.frequency.setValueAtTime(I,t),o.gain.setValueAtTime(0,t),o.gain.linearRampToValueAtTime(g*.3,t+.02),o.gain.linearRampToValueAtTime(g*.25,t+.1),o.gain.exponentialRampToValueAtTime(g*.08,t+.3),o.gain.exponentialRampToValueAtTime(.001,t+.5),C.connect(o).connect(e.destination),C.start(t),C.stop(t+.55);const n=e.createOscillator(),a=e.createGain();n.type="sine",n.frequency.setValueAtTime(I*2,t),a.gain.setValueAtTime(0,t),a.gain.linearRampToValueAtTime(g*.06,t+.02),a.gain.exponentialRampToValueAtTime(.001,t+.2),n.connect(a).connect(e.destination),n.start(t),n.stop(t+.25)}async playCallStartSound(){if(!(!this.config.enabled||this.config.preset==="none"))switch(this.config.preset){case"1":await this.playDrop(!0);break;case"2":await this.playGlassTap(!0);break;case"3":await this.playWhoosh(!0);break;case"4":await this.playGentleNote(!0);break}}async playCallEndSound(){if(!(!this.config.enabled||this.config.preset==="none"))switch(this.config.preset){case"1":await this.playDrop(!1);break;case"2":await this.playGlassTap(!1);break;case"3":await this.playWhoosh(!1);break;case"4":await this.playGentleNote(!1);break}}setConfig(A){this.config={...this.config,...A}}setEnabled(A){this.config.enabled=A}setVolume(A){this.config.volume=Math.max(0,Math.min(1,A))}setPreset(A){this.config.preset=A}getConfig(){return{...this.config}}isEnabled(){return this.config.enabled&&this.config.preset!=="none"}destroy(){this.hasAcquired&&(Qi.release(),this.hasAcquired=!1)}}const at={default:{primary:"#6366f1",secondary:"#8b5cf6",accent:"#06b6d4",glow:"#818cf8",atmosphere:"#c4b5fd",depth:"#312e81",highlight:"#e0e7ff"},emerald:{primary:"#10b981",secondary:"#34d399",accent:"#6ee7b7",glow:"#34d399",atmosphere:"#a7f3d0",depth:"#064e3b",highlight:"#d1fae5"},rose:{primary:"#f43f5e",secondary:"#fb7185",accent:"#fda4af",glow:"#fb7185",atmosphere:"#fecdd3",depth:"#881337",highlight:"#ffe4e6"},amber:{primary:"#f59e0b",secondary:"#fbbf24",accent:"#fcd34d",glow:"#fbbf24",atmosphere:"#fde68a",depth:"#78350f",highlight:"#fef3c7"},cyan:{primary:"#06b6d4",secondary:"#22d3ee",accent:"#67e8f9",glow:"#22d3ee",atmosphere:"#a5f3fc",depth:"#164e63",highlight:"#cffafe"},purple:{primary:"#9333ea",secondary:"#a855f7",accent:"#c084fc",glow:"#a855f7",atmosphere:"#d8b4fe",depth:"#581c87",highlight:"#f3e8ff"},blue:{primary:"#2563eb",secondary:"#3b82f6",accent:"#60a5fa",glow:"#3b82f6",atmosphere:"#93c5fd",depth:"#1e3a8a",highlight:"#dbeafe"},white:{primary:"#d1d5db",secondary:"#e5e7eb",accent:"#f3f4f6",glow:"#e5e7eb",atmosphere:"#f9fafb",depth:"#4b5563",highlight:"#ffffff"},black:{primary:"#18182b",secondary:"#242440",accent:"#35355a",glow:"#242440",atmosphere:"#4a4a70",depth:"#08080f",highlight:"#7070a0"},tangerine:{primary:"#ff2d00",secondary:"#ff4500",accent:"#ff6600",glow:"#ff4500",atmosphere:"#ff8533",depth:"#cc1100",highlight:"#ff9955"},ember:{primary:"#ff0000",secondary:"#ff0010",accent:"#ff0018",glow:"#ff0008",atmosphere:"#ff1020",depth:"#aa0008",highlight:"#ff2030"},"tangerine-neon":{primary:"#F97316",secondary:"#EF4444",accent:"#EC4899",glow:"#F97316",atmosphere:"#FB923C",depth:"#C2410C",highlight:"#FDBA74"}},st={indigo:{primary:"#3730a3",secondary:"#4338ca",accent:"#4f46e5",glow:"#3730a3",atmosphere:"#4338ca",depth:"#1e1b4b",highlight:"#a5b4fc"},violet:{primary:"#5b21b6",secondary:"#6d28d9",accent:"#7c3aed",glow:"#5b21b6",atmosphere:"#6d28d9",depth:"#2e1065",highlight:"#c4b5fd"},teal:{primary:"#0f766e",secondary:"#0d9488",accent:"#14b8a6",glow:"#0f766e",atmosphere:"#0d9488",depth:"#042f2e",highlight:"#5eead4"},orange:{primary:"#c2410c",secondary:"#ea580c",accent:"#f97316",glow:"#c2410c",atmosphere:"#ea580c",depth:"#431407",highlight:"#fed7aa"},blue:{primary:"#1d4ed8",secondary:"#2563eb",accent:"#3b82f6",glow:"#1d4ed8",atmosphere:"#2563eb",depth:"#1e3a8a",highlight:"#93c5fd"},pink:{primary:"#be185d",secondary:"#db2777",accent:"#ec4899",glow:"#be185d",atmosphere:"#db2777",depth:"#500724",highlight:"#f9a8d4"},silver:{primary:"#6b7280",secondary:"#9ca3af",accent:"#d1d5db",glow:"#e5e7eb",atmosphere:"#f3f4f6",depth:"#374151",highlight:"#f9fafb"},charcoal:{primary:"#0f0f1a",secondary:"#1a1a2e",accent:"#2a2a45",glow:"#0f0f1a",atmosphere:"#1a1a2e",depth:"#050509",highlight:"#50507a"},tangerine:{primary:"#d4960a",secondary:"#e6a000",accent:"#fdb813",glow:"#d4960a",atmosphere:"#e6a000",depth:"#a06800",highlight:"#ffe082"},ember:{primary:"#b80000",secondary:"#d50000",accent:"#ff1744",glow:"#d50000",atmosphere:"#ff5252",depth:"#8b0000",highlight:"#ff8a80"},"tangerine-neon":{primary:"#EA580C",secondary:"#F97316",accent:"#FB923C",glow:"#EA580C",atmosphere:"#F97316",depth:"#9A3412",highlight:"#FDBA74"}};function Jm(i,A="dark"){const e=A==="dark"?at:st;return e[i]||e[Object.keys(e)[0]]}function Ym(i="dark"){return Object.keys(i==="dark"?at:st)}const KI={default:{dark:{colors:at.default,glowIntensity:1.2,idleGlowMultiplier:.6},light:{colors:st.indigo,glowIntensity:1.8,idleGlowMultiplier:1.2}},emerald:{dark:{colors:at.emerald,glowIntensity:1.2,idleGlowMultiplier:.6},light:{colors:st.teal,glowIntensity:1.8,idleGlowMultiplier:1.2}},rose:{dark:{colors:at.rose,glowIntensity:1.2,idleGlowMultiplier:.6},light:{colors:st.pink,glowIntensity:1.8,idleGlowMultiplier:1.2}},amber:{dark:{colors:at.amber,glowIntensity:1.2,idleGlowMultiplier:.6},light:{colors:st.orange,glowIntensity:1.8,idleGlowMultiplier:1.2}},cyan:{dark:{colors:at.cyan,glowIntensity:1.2,idleGlowMultiplier:.6},light:{colors:st.blue,glowIntensity:1.8,idleGlowMultiplier:1.2}},purple:{dark:{colors:at.purple,glowIntensity:1.2,idleGlowMultiplier:.6},light:{colors:st.violet,glowIntensity:1.8,idleGlowMultiplier:1.2}},blue:{dark:{colors:at.blue,glowIntensity:1.2,idleGlowMultiplier:.6},light:{colors:st.blue,glowIntensity:1.8,idleGlowMultiplier:1.2}},white:{dark:{colors:at.white,glowIntensity:1.2,idleGlowMultiplier:.6},light:{colors:st.silver,glowIntensity:1.8,idleGlowMultiplier:1.2}},black:{dark:{colors:at.black,glowIntensity:1.2,idleGlowMultiplier:.6},light:{colors:st.charcoal,glowIntensity:1.8,idleGlowMultiplier:1.2}},tangerine:{dark:{colors:at.tangerine,glowIntensity:1.2,idleGlowMultiplier:.6},light:{colors:st.tangerine,glowIntensity:1.8,idleGlowMultiplier:1.2}},ember:{dark:{colors:at.ember,glowIntensity:1.2,idleGlowMultiplier:.6},light:{colors:st.ember,glowIntensity:1.8,idleGlowMultiplier:1.2}},"tangerine-neon":{dark:{colors:at["tangerine-neon"],glowIntensity:1.4,idleGlowMultiplier:.7},light:{colors:st["tangerine-neon"],glowIntensity:2,idleGlowMultiplier:1.3}}},Tm=Object.fromEntries(Object.entries(KI).map(([i,A])=>[i,A.dark])),qm=Object.fromEntries(Object.entries(KI).map(([i,A])=>[i,A.light]));function JI(i){return(KI[i]||KI.default).dark}function Hm(){return Object.keys(KI)}function Pm(i,A){const e=JI(A);i.orbColors=e.colors,i.glowIntensity=e.glowIntensity,i.idleGlowMultiplier=e.idleGlowMultiplier}const hd="privacy_accepted",Dn="user_identity";function _n(){try{return localStorage.getItem(hd)==="true"}catch{return!1}}function pn(){try{localStorage.setItem(hd,"true")}catch{}}function ug(){try{let i=localStorage.getItem(Dn);return i||(i=crypto.randomUUID(),localStorage.setItem(Dn,i)),i}catch{const i=crypto.randomUUID();try{localStorage.setItem(Dn,i)}catch{console.warn("[hanc-widget] localStorage unavailable, user_identity will not persist across calls")}return i}}function wn(){try{return localStorage.getItem(Dn)}catch{return null}}function Om(){if(typeof window>"u")return"https://api.hanc.ai";const i=window.location.hostname;return i.endsWith(".hanc.me")||i==="hanc.me"||i==="localhost"?"https://api.hanc.me":"https://api.hanc.ai"}const ui=Om(),tr={terms_enabled:!1,terms_content:"",terms_url:"https://hanc.ai/terms",privacy_url:"https://hanc.ai/privacy",theme:"default",allow_all_domains:!0,allowed_domains:[]},mn=new Map,Vm=1e3;async function MC(i,A=ui){if(!i)return console.warn("[hanc-widget] No agentId provided, using default config"),tr;const e=mn.get(i);if(e&&Date.now()-e.timestamp<Vm)return e.config;try{const t=await fetch(`${A}/v1/site/widget-config/${i}`,{method:"GET",headers:{"Content-Type":"application/json"}});if(!t.ok){if(t.status===404)return console.warn(`[hanc-widget] Agent ${i} not found, using default config`),tr;throw new Error(`HTTP ${t.status}: ${t.statusText}`)}const g=await t.json();return mn.set(i,{config:g,timestamp:Date.now()}),g}catch(t){return console.error("[hanc-widget] Failed to fetch widget config:",t),tr}}const jm=["hanc.ai","hanc.me","localhost"];function FC(i){const A=window.location.hostname;return jm.some(t=>A===t||A.endsWith(`.${t}`))||i.allow_all_domains||!i.allowed_domains||i.allowed_domains.length===0?!0:i.allowed_domains.some(t=>A===t||A.endsWith(`.${t}`))}function Wm(i){i?mn.delete(i):mn.clear()}var Xm=Object.defineProperty,Zm=Object.getOwnPropertyDescriptor,UC=(i,A,e,t)=>{for(var g=t>1?void 0:t?Zm(A,e):A,I=i.length-1,C;I>=0;I--)(C=i[I])&&(g=(t?C(A,e,g):C(g))||g);return t&&g&&Xm(A,e,g),g};let Wg=class extends Kt{constructor(){super(...arguments),this.privacyUrl="https://hanc.ai/privacy",this.termsUrl="https://hanc.ai/terms",this.termsContent="",this.modalTitle="Before we start",this.modalContainer=null}connectedCallback(){super.connectedCallback(),this.createModal()}disconnectedCallback(){super.disconnectedCallback(),this.removeModal()}createModal(){this.modalContainer=document.createElement("div"),this.modalContainer.innerHTML=this.getModalHTML(),document.body.appendChild(this.modalContainer);const i=this.modalContainer.querySelector(".hanc-privacy-overlay"),A=this.modalContainer.querySelector(".hanc-btn-accept"),e=this.modalContainer.querySelector(".hanc-btn-decline");i==null||i.addEventListener("click",t=>{t.target===i&&this.handleDecline()}),A==null||A.addEventListener("click",()=>this.handleAccept()),e==null||e.addEventListener("click",()=>this.handleDecline())}removeModal(){this.modalContainer&&(this.modalContainer.remove(),this.modalContainer=null)}renderMarkdown(i){if(!i)return"";let e=(t=>t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;"))(i);return e=e.replace(/^#### (.+)$/gm,"<h4>$1</h4>"),e=e.replace(/^### (.+)$/gm,"<h3>$1</h3>"),e=e.replace(/^## (.+)$/gm,"<h2>$1</h2>"),e=e.replace(/^# (.+)$/gm,"<h1>$1</h1>"),e=e.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),e=e.replace(/__(.+?)__/g,"<strong>$1</strong>"),e=e.replace(/\*(.+?)\*/g,"<em>$1</em>"),e=e.replace(/_(.+?)_/g,"<em>$1</em>"),e=e.replace(/\[([^\]]+)\]\((https?:\/\/[^)]+)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>'),e=e.replace(/^\- (.+)$/gm,"<li>$1</li>"),e=e.replace(/(<li>.*<\/li>\n?)+/g,"<ul>$&</ul>"),e=e.replace(/\n\n/g,"</p><p>"),e="<p>"+e+"</p>",e=e.replace(/<p><\/p>/g,""),e=e.replace(/<p>(<h[1-4]>)/g,"$1"),e=e.replace(/(<\/h[1-4]>)<\/p>/g,"$1"),e=e.replace(/<p>(<ul>)/g,"$1"),e=e.replace(/(<\/ul>)<\/p>/g,"$1"),e=e.replace(/\n/g,"<br>"),e}getModalHTML(){const i=this.termsContent&&this.termsContent.trim().length>0,A=i?this.renderMarkdown(this.termsContent):"By starting this call, you agree to our Terms of Service and Privacy Policy.";return`
4548
+ `,jg={primary:"#6366f1",secondary:"#8b5cf6",accent:"#06b6d4",glow:"#818cf8",atmosphere:"#c4b5fd",depth:"#312e81",highlight:"#e0e7ff"},Km={size:1,segments:128,colors:jg,morphStrength:1,noiseScale:1.5,noiseSpeed:.3,glowIntensity:.8,idleGlowMultiplier:.4,fresnelPower:2.5,rotationSpeed:.1,audioReactivity:3,audioSmoothing:.9,idleMorphMultiplier:.25,colorContrast:1.5};class un{constructor(A,e={}){this.orb=null,this.glowMesh=null,this.orbMaterial=null,this.glowMaterial=null,this.animationId=null,this.isActive=!1,this.targetRotation={x:0,y:0},this.currentRotation={x:0,y:0},this.audioValues={bass:0,mid:0,treble:0,level:0},this.resizeObserver=null,this.resizeTimeoutId=null,this.isContextLost=!1,this.animate=()=>{if(this.isContextLost)return;this.animationId=requestAnimationFrame(this.animate);const Q=this.clock.getElapsedTime();if(this.clock.getDelta(),this.orbMaterial){this.orbMaterial.uniforms.uTime.value=Q,this.orbMaterial.uniforms.uAudioBass.value=this.audioValues.bass,this.orbMaterial.uniforms.uAudioMid.value=this.audioValues.mid,this.orbMaterial.uniforms.uAudioTreble.value=this.audioValues.treble,this.orbMaterial.uniforms.uAudioLevel.value=this.audioValues.level;const r=this.isActive?this.config.morphStrength*1.5:this.config.morphStrength*this.config.idleMorphMultiplier,B=this.orbMaterial.uniforms.uMorphStrength.value;this.orbMaterial.uniforms.uMorphStrength.value+=(r-B)*.05}if(this.glowMaterial){this.glowMaterial.uniforms.uTime.value=Q,this.glowMaterial.uniforms.uAudioLevel.value=this.audioValues.level;const r=this.isActive?this.config.glowIntensity*1.5:this.config.glowIntensity*this.config.idleGlowMultiplier,B=this.glowMaterial.uniforms.uGlowIntensity.value;this.glowMaterial.uniforms.uGlowIntensity.value+=(r-B)*.05}this.currentRotation.x+=(this.targetRotation.x-this.currentRotation.x)*.05,this.currentRotation.y+=(this.targetRotation.y-this.currentRotation.y)*.05,this.orb&&(this.orb.rotation.x=this.currentRotation.x+Q*this.config.rotationSpeed*.3,this.orb.rotation.y=this.currentRotation.y+Q*this.config.rotationSpeed),this.glowMesh&&(this.glowMesh.rotation.x=this.currentRotation.x+Q*this.config.rotationSpeed*.3,this.glowMesh.rotation.y=this.currentRotation.y+Q*this.config.rotationSpeed),this.renderer.render(this.scene,this.camera)},this.handleResize=()=>{this.resizeTimeoutId!==null&&clearTimeout(this.resizeTimeoutId),this.resizeTimeoutId=setTimeout(()=>{this.resizeTimeoutId=null;const Q=this.container.clientWidth,r=this.container.clientHeight;if(Q===0||r===0)return;const B=Q*this.canvasPadding,h=r*this.canvasPadding;this.camera.aspect=B/h,this.camera.updateProjectionMatrix(),this.renderer.setSize(B,h)},100)},this.handleMouseMove=Q=>{const r=this.container.getBoundingClientRect(),B=(Q.clientX-r.left)/r.width*2-1,h=-((Q.clientY-r.top)/r.height)*2+1;this.targetRotation.x=h*.3,this.targetRotation.y=B*.3},this.handleMouseLeave=()=>{this.targetRotation.x=0,this.targetRotation.y=0},this.container=A,this.config={...Km,...e},this.clock=new l2;const t=/iPhone|iPad|iPod/i.test(navigator.userAgent),g=/Android/i.test(navigator.userAgent);this.canvasPadding=t?1.5:g?2:3,this.boundHandleContextLost=this.handleContextLost.bind(this),this.boundHandleContextRestored=this.handleContextRestored.bind(this),this.scene=new n2;const I=A.clientWidth*this.canvasPadding,C=A.clientHeight*this.canvasPadding,o=I/C;this.camera=new Lt(45,o,.1,100);const n=3,a=9;this.camera.position.z=a*(this.canvasPadding/n),this.renderer=new Mm({antialias:!0,alpha:!0,powerPreference:"high-performance"}),this.renderer.setPixelRatio(Math.min(window.devicePixelRatio,2)),this.renderer.setSize(I,C),this.renderer.setClearColor(0,0);const s=this.renderer.domElement;s.style.position="absolute",s.style.left="50%",s.style.top="50%",s.style.transform="translate(-50%, -50%)",s.style.pointerEvents="none",A.appendChild(s),s.addEventListener("webglcontextlost",this.boundHandleContextLost),s.addEventListener("webglcontextrestored",this.boundHandleContextRestored),this.createOrb(),window.addEventListener("resize",this.handleResize),this.resizeObserver=new ResizeObserver(this.handleResize),this.resizeObserver.observe(A),A.addEventListener("mousemove",this.handleMouseMove),A.addEventListener("mouseleave",this.handleMouseLeave)}handleContextLost(A){A.preventDefault(),this.isContextLost=!0,this.stop()}handleContextRestored(A){this.isContextLost=!1,this.recreateAfterContextLoss(),this.start()}recreateAfterContextLoss(){this.orb&&(this.orb.geometry.dispose(),this.scene.remove(this.orb),this.orb=null),this.glowMesh&&(this.glowMesh.geometry.dispose(),this.scene.remove(this.glowMesh),this.glowMesh=null),this.orbMaterial&&(this.orbMaterial.dispose(),this.orbMaterial=null),this.glowMaterial&&(this.glowMaterial.dispose(),this.glowMaterial=null),this.createOrb()}createOrb(){const A={...jg,...this.config.colors},e=new OQ(this.config.size,this.config.segments/4);this.orbMaterial=new Ut({vertexShader:Fm,fragmentShader:Um,uniforms:{uTime:{value:0},uAudioBass:{value:0},uAudioMid:{value:0},uAudioTreble:{value:0},uAudioLevel:{value:0},uMorphStrength:{value:this.config.morphStrength},uNoiseScale:{value:this.config.noiseScale},uNoiseSpeed:{value:this.config.noiseSpeed},uAudioReactivity:{value:this.config.audioReactivity},uColorPrimary:{value:new Ie(A.primary)},uColorSecondary:{value:new Ie(A.secondary)},uColorAccent:{value:new Ie(A.accent)},uColorDepth:{value:new Ie(A.depth||jg.depth)},uColorHighlight:{value:new Ie(A.highlight||jg.highlight)},uFresnelPower:{value:this.config.fresnelPower},uGlowIntensity:{value:this.config.glowIntensity},uColorContrast:{value:this.config.colorContrast}},transparent:!0,side:Mi}),this.orb=new Ai(e,this.orbMaterial),this.scene.add(this.orb);const t=new VQ(this.config.size,64,64);this.glowMaterial=new Ut({vertexShader:Lm,fragmentShader:vm,uniforms:{uTime:{value:0},uAudioLevel:{value:0},uGlowColor:{value:new Ie(A.glow)},uGlowIntensity:{value:this.config.glowIntensity*.6},uPulseSpeed:{value:2}},transparent:!0,side:Ct,blending:hs,depthWrite:!1}),this.glowMesh=new Ai(t,this.glowMaterial),this.scene.add(this.glowMesh)}updateAudio(A){const e=this.config.audioSmoothing;this.audioValues.bass+=(A.bass-this.audioValues.bass)*e,this.audioValues.mid+=(A.mid-this.audioValues.mid)*e,this.audioValues.treble+=(A.treble-this.audioValues.treble)*e,this.audioValues.level+=(A.level-this.audioValues.level)*e}setSimulatedAudio(A,e,t,g){const I=this.config.audioSmoothing;this.audioValues.bass+=(A-this.audioValues.bass)*I,this.audioValues.mid+=(e-this.audioValues.mid)*I,this.audioValues.treble+=(t-this.audioValues.treble)*I,this.audioValues.level+=(g-this.audioValues.level)*I}setActive(A){this.isActive=A}setColors(A){const e={...jg,...this.config.colors,...A};this.orbMaterial&&(this.orbMaterial.uniforms.uColorPrimary.value.set(e.primary),this.orbMaterial.uniforms.uColorSecondary.value.set(e.secondary),this.orbMaterial.uniforms.uColorAccent.value.set(e.accent),this.orbMaterial.uniforms.uColorDepth.value.set(e.depth||jg.depth),this.orbMaterial.uniforms.uColorHighlight.value.set(e.highlight||jg.highlight)),this.glowMaterial&&this.glowMaterial.uniforms.uGlowColor.value.set(e.glow)}setGlowSettings(A,e){this.config.glowIntensity=A,this.config.idleGlowMultiplier=e}start(){this.animationId===null&&(this.clock.start(),this.animate())}stop(){this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null)}getCanvas(){return this.renderer.domElement}destroy(){this.stop(),this.resizeTimeoutId!==null&&(clearTimeout(this.resizeTimeoutId),this.resizeTimeoutId=null),window.removeEventListener("resize",this.handleResize),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.container.removeEventListener("mousemove",this.handleMouseMove),this.container.removeEventListener("mouseleave",this.handleMouseLeave);const A=this.renderer.domElement;A.removeEventListener("webglcontextlost",this.boundHandleContextLost),A.removeEventListener("webglcontextrestored",this.boundHandleContextRestored),this.orb&&(this.orb.geometry.dispose(),this.scene.remove(this.orb),this.orb=null),this.glowMesh&&(this.glowMesh.geometry.dispose(),this.scene.remove(this.glowMesh),this.glowMesh=null),this.orbMaterial&&(this.orbMaterial.dispose(),this.orbMaterial=null),this.glowMaterial&&(this.glowMaterial.dispose(),this.glowMaterial=null),this.renderer.dispose(),A.parentNode&&A.parentNode.removeChild(A)}}class fn{constructor(A={}){this.audioContext=null,this.analyser=null,this.source=null,this.localSource=null,this.mixer=null,this.frequencyData=new Uint8Array(0),this.waveformData=new Float32Array(0),this.hasAcquiredContext=!1,this.smoothedBass=0,this.smoothedMid=0,this.smoothedTreble=0,this.smoothedLevel=0,this.smoothingFactor=.3,this.options={fftSize:A.fftSize??2048,smoothingTimeConstant:A.smoothingTimeConstant??.8,minDecibels:A.minDecibels??-90,maxDecibels:A.maxDecibels??-10}}async ensureAudioContext(){if(!this.audioContext)this.audioContext=await Qi.acquire(),this.audioContext&&(this.hasAcquiredContext=!0);else if(!await Qi.ensureResumed())return null;return this.audioContext}async connectStream(A){const e=await this.ensureAudioContext();if(!e){console.warn("[AudioAnalyzer] Could not acquire AudioContext");return}if(this.source)try{this.source.disconnect()}catch{}this.source=e.createMediaStreamSource(A),this.setupMixerAndAnalyser(),this.mixer&&this.source.connect(this.mixer)}async connectLocalStream(A){const e=await this.ensureAudioContext();if(!e){console.warn("[AudioAnalyzer] Could not acquire AudioContext");return}if(this.localSource)try{this.localSource.disconnect()}catch{}this.localSource=e.createMediaStreamSource(A),this.setupMixerAndAnalyser(),this.mixer&&this.localSource.connect(this.mixer)}setupMixerAndAnalyser(){this.audioContext&&(this.mixer||(this.mixer=this.audioContext.createGain(),this.mixer.gain.value=1),this.analyser||(this.analyser=this.audioContext.createAnalyser()),this.analyser.fftSize=this.options.fftSize,this.analyser.smoothingTimeConstant=this.options.smoothingTimeConstant,this.analyser.minDecibels=this.options.minDecibels,this.analyser.maxDecibels=this.options.maxDecibels,this.mixer.disconnect(),this.mixer.connect(this.analyser),this.frequencyData=new Uint8Array(this.analyser.frequencyBinCount),this.waveformData=new Float32Array(this.analyser.fftSize))}async connectAudioElement(A){const e=await this.ensureAudioContext();if(!e){console.warn("[AudioAnalyzer] Could not acquire AudioContext");return}if(this.source)try{this.source.disconnect()}catch{}const t=e.createMediaElementSource(A);this.analyser||(this.analyser=e.createAnalyser()),this.analyser.fftSize=this.options.fftSize,this.analyser.smoothingTimeConstant=this.options.smoothingTimeConstant,this.analyser.minDecibels=this.options.minDecibels,this.analyser.maxDecibels=this.options.maxDecibels,t.connect(this.analyser),this.analyser.connect(e.destination),this.frequencyData=new Uint8Array(this.analyser.frequencyBinCount),this.waveformData=new Float32Array(this.analyser.fftSize)}getAudioData(){if(!this.analyser)return{bass:0,mid:0,treble:0,level:0,waveform:new Float32Array(0),frequency:new Uint8Array(0)};this.analyser.getByteFrequencyData(this.frequencyData),this.analyser.getFloatTimeDomainData(this.waveformData);const{bass:A,mid:e,treble:t}=this.calculateFrequencyBands(),g=this.calculateOverallLevel();return this.smoothedBass+=(A-this.smoothedBass)*this.smoothingFactor,this.smoothedMid+=(e-this.smoothedMid)*this.smoothingFactor,this.smoothedTreble+=(t-this.smoothedTreble)*this.smoothingFactor,this.smoothedLevel+=(g-this.smoothedLevel)*this.smoothingFactor,{bass:this.smoothedBass,mid:this.smoothedMid,treble:this.smoothedTreble,level:this.smoothedLevel,waveform:this.waveformData,frequency:this.frequencyData}}calculateFrequencyBands(){if(!this.audioContext||this.frequencyData.length===0)return{bass:0,mid:0,treble:0};const A=this.audioContext.sampleRate,e=this.frequencyData.length,t=A/(e*2),g=Math.floor(250/t),I=Math.floor(2e3/t);let C=0,o=0,n=0;for(let r=0;r<e;r++){const B=this.frequencyData[r]/255;r<g?C+=B:r<I?o+=B:n+=B}const a=g>0?C/g:0,s=I-g>0?o/(I-g):0,Q=e-I>0?n/(e-I):0;return{bass:Math.pow(a,.8),mid:Math.pow(s,.9),treble:Math.pow(Q,1.1)}}calculateOverallLevel(){if(this.frequencyData.length===0)return 0;let A=0;for(let t=0;t<this.frequencyData.length;t++)A+=this.frequencyData[t];const e=A/this.frequencyData.length/255;return Math.pow(e,.8)}getPeakLevel(){if(this.frequencyData.length===0)return 0;let A=0;for(let e=0;e<this.frequencyData.length;e++)this.frequencyData[e]>A&&(A=this.frequencyData[e]);return A/255}isActive(){return this.audioContext!==null&&this.audioContext.state==="running"}disconnect(){if(this.source){try{this.source.disconnect()}catch{}this.source=null}if(this.localSource){try{this.localSource.disconnect()}catch{}this.localSource=null}if(this.mixer){try{this.mixer.disconnect()}catch{}this.mixer=null}if(this.analyser){try{this.analyser.disconnect()}catch{}this.analyser=null}this.hasAcquiredContext&&(Qi.release(),this.hasAcquiredContext=!1),this.audioContext=null,this.smoothedBass=0,this.smoothedMid=0,this.smoothedTreble=0,this.smoothedLevel=0}getAudioContext(){return this.audioContext}getAnalyser(){return this.analyser}}class GC{constructor(A={}){this.hasAcquired=!1,this.config={enabled:!0,volume:.3,preset:"1",...A}}async ensureContext(){if(!this.config.enabled||this.config.preset==="none")return null;const A=await Qi.acquire();return A&&(this.hasAcquired=!0),A}async prewarm(){await this.ensureContext()}async playDrop(A){const e=await this.ensureContext();if(!e)return;const t=e.currentTime,g=this.config.volume,I=A?900:700,C=A?500:400,o=e.createOscillator(),n=e.createGain();o.type="sine",o.frequency.setValueAtTime(I,t),o.frequency.exponentialRampToValueAtTime(C,t+.15),n.gain.setValueAtTime(0,t),n.gain.linearRampToValueAtTime(g*.3,t+.015),n.gain.linearRampToValueAtTime(g*.2,t+.1),n.gain.exponentialRampToValueAtTime(.001,t+.35),o.connect(n).connect(e.destination),o.start(t),o.stop(t+.4)}async playGlassTap(A){const e=await this.ensureContext();if(!e)return;const t=e.currentTime,g=this.config.volume,I=A?2200:1760,C=e.createOscillator(),o=e.createGain();C.type="sine",C.frequency.setValueAtTime(I,t),o.gain.setValueAtTime(0,t),o.gain.linearRampToValueAtTime(g*.25,t+.002),o.gain.exponentialRampToValueAtTime(g*.1,t+.08),o.gain.exponentialRampToValueAtTime(.001,t+.3),C.connect(o).connect(e.destination),C.start(t),C.stop(t+.35);const n=e.createOscillator(),a=e.createGain();n.type="sine",n.frequency.setValueAtTime(I*2.5,t),a.gain.setValueAtTime(0,t),a.gain.linearRampToValueAtTime(g*.08,t+.001),a.gain.exponentialRampToValueAtTime(.001,t+.12),n.connect(a).connect(e.destination),n.start(t),n.stop(t+.15)}async playWhoosh(A){const e=await this.ensureContext();if(!e)return;const t=e.currentTime,g=this.config.volume,I=e.sampleRate*.5,C=e.createBuffer(1,I,e.sampleRate),o=C.getChannelData(0);for(let B=0;B<I;B++)o[B]=Math.random()*2-1;const n=e.createBufferSource();n.buffer=C;const a=e.createBiquadFilter();a.type="bandpass",a.Q.setValueAtTime(2,t);const s=e.createGain();A?(a.frequency.setValueAtTime(300,t),a.frequency.exponentialRampToValueAtTime(2e3,t+.15),a.frequency.exponentialRampToValueAtTime(800,t+.35),s.gain.setValueAtTime(0,t),s.gain.linearRampToValueAtTime(g*.3,t+.05),s.gain.linearRampToValueAtTime(g*.4,t+.15),s.gain.exponentialRampToValueAtTime(.001,t+.4)):(a.frequency.setValueAtTime(1500,t),a.frequency.exponentialRampToValueAtTime(200,t+.3),s.gain.setValueAtTime(0,t),s.gain.linearRampToValueAtTime(g*.35,t+.05),s.gain.exponentialRampToValueAtTime(.001,t+.35));const Q=e.createOscillator(),r=e.createGain();Q.type="sine",A?(Q.frequency.setValueAtTime(300,t),Q.frequency.linearRampToValueAtTime(500,t+.2)):(Q.frequency.setValueAtTime(400,t),Q.frequency.linearRampToValueAtTime(200,t+.25)),r.gain.setValueAtTime(0,t),r.gain.linearRampToValueAtTime(g*.15,t+.05),r.gain.exponentialRampToValueAtTime(.001,t+.35),n.connect(a).connect(s).connect(e.destination),Q.connect(r).connect(e.destination),n.start(t),n.stop(t+.5),Q.start(t),Q.stop(t+.4)}async playGentleNote(A){const e=await this.ensureContext();if(!e)return;const t=e.currentTime,g=this.config.volume,I=A?659.25:523.25,C=e.createOscillator(),o=e.createGain();C.type="sine",C.frequency.setValueAtTime(I,t),o.gain.setValueAtTime(0,t),o.gain.linearRampToValueAtTime(g*.3,t+.02),o.gain.linearRampToValueAtTime(g*.25,t+.1),o.gain.exponentialRampToValueAtTime(g*.08,t+.3),o.gain.exponentialRampToValueAtTime(.001,t+.5),C.connect(o).connect(e.destination),C.start(t),C.stop(t+.55);const n=e.createOscillator(),a=e.createGain();n.type="sine",n.frequency.setValueAtTime(I*2,t),a.gain.setValueAtTime(0,t),a.gain.linearRampToValueAtTime(g*.06,t+.02),a.gain.exponentialRampToValueAtTime(.001,t+.2),n.connect(a).connect(e.destination),n.start(t),n.stop(t+.25)}async playCallStartSound(){if(!(!this.config.enabled||this.config.preset==="none"))switch(this.config.preset){case"1":await this.playDrop(!0);break;case"2":await this.playGlassTap(!0);break;case"3":await this.playWhoosh(!0);break;case"4":await this.playGentleNote(!0);break}}async playCallEndSound(){if(!(!this.config.enabled||this.config.preset==="none"))switch(this.config.preset){case"1":await this.playDrop(!1);break;case"2":await this.playGlassTap(!1);break;case"3":await this.playWhoosh(!1);break;case"4":await this.playGentleNote(!1);break}}setConfig(A){this.config={...this.config,...A}}setEnabled(A){this.config.enabled=A}setVolume(A){this.config.volume=Math.max(0,Math.min(1,A))}setPreset(A){this.config.preset=A}getConfig(){return{...this.config}}isEnabled(){return this.config.enabled&&this.config.preset!=="none"}destroy(){this.hasAcquired&&(Qi.release(),this.hasAcquired=!1)}}const st={default:{primary:"#6366f1",secondary:"#8b5cf6",accent:"#06b6d4",glow:"#818cf8",atmosphere:"#c4b5fd",depth:"#312e81",highlight:"#e0e7ff"},emerald:{primary:"#10b981",secondary:"#34d399",accent:"#6ee7b7",glow:"#34d399",atmosphere:"#a7f3d0",depth:"#064e3b",highlight:"#d1fae5"},rose:{primary:"#f43f5e",secondary:"#fb7185",accent:"#fda4af",glow:"#fb7185",atmosphere:"#fecdd3",depth:"#881337",highlight:"#ffe4e6"},amber:{primary:"#f59e0b",secondary:"#fbbf24",accent:"#fcd34d",glow:"#fbbf24",atmosphere:"#fde68a",depth:"#78350f",highlight:"#fef3c7"},cyan:{primary:"#06b6d4",secondary:"#22d3ee",accent:"#67e8f9",glow:"#22d3ee",atmosphere:"#a5f3fc",depth:"#164e63",highlight:"#cffafe"},purple:{primary:"#9333ea",secondary:"#a855f7",accent:"#c084fc",glow:"#a855f7",atmosphere:"#d8b4fe",depth:"#581c87",highlight:"#f3e8ff"},blue:{primary:"#2563eb",secondary:"#3b82f6",accent:"#60a5fa",glow:"#3b82f6",atmosphere:"#93c5fd",depth:"#1e3a8a",highlight:"#dbeafe"},white:{primary:"#d1d5db",secondary:"#e5e7eb",accent:"#f3f4f6",glow:"#e5e7eb",atmosphere:"#f9fafb",depth:"#4b5563",highlight:"#ffffff"},black:{primary:"#18182b",secondary:"#242440",accent:"#35355a",glow:"#242440",atmosphere:"#4a4a70",depth:"#08080f",highlight:"#7070a0"},tangerine:{primary:"#ff2d00",secondary:"#ff4500",accent:"#ff6600",glow:"#ff4500",atmosphere:"#ff8533",depth:"#cc1100",highlight:"#ff9955"},ember:{primary:"#ff0000",secondary:"#ff0010",accent:"#ff0018",glow:"#ff0008",atmosphere:"#ff1020",depth:"#aa0008",highlight:"#ff2030"},"tangerine-neon":{primary:"#F97316",secondary:"#EF4444",accent:"#EC4899",glow:"#F97316",atmosphere:"#FB923C",depth:"#C2410C",highlight:"#FDBA74"}},Qt={indigo:{primary:"#3730a3",secondary:"#4338ca",accent:"#4f46e5",glow:"#3730a3",atmosphere:"#4338ca",depth:"#1e1b4b",highlight:"#a5b4fc"},violet:{primary:"#5b21b6",secondary:"#6d28d9",accent:"#7c3aed",glow:"#5b21b6",atmosphere:"#6d28d9",depth:"#2e1065",highlight:"#c4b5fd"},teal:{primary:"#0f766e",secondary:"#0d9488",accent:"#14b8a6",glow:"#0f766e",atmosphere:"#0d9488",depth:"#042f2e",highlight:"#5eead4"},orange:{primary:"#c2410c",secondary:"#ea580c",accent:"#f97316",glow:"#c2410c",atmosphere:"#ea580c",depth:"#431407",highlight:"#fed7aa"},blue:{primary:"#1d4ed8",secondary:"#2563eb",accent:"#3b82f6",glow:"#1d4ed8",atmosphere:"#2563eb",depth:"#1e3a8a",highlight:"#93c5fd"},pink:{primary:"#be185d",secondary:"#db2777",accent:"#ec4899",glow:"#be185d",atmosphere:"#db2777",depth:"#500724",highlight:"#f9a8d4"},silver:{primary:"#6b7280",secondary:"#9ca3af",accent:"#d1d5db",glow:"#e5e7eb",atmosphere:"#f3f4f6",depth:"#374151",highlight:"#f9fafb"},charcoal:{primary:"#0f0f1a",secondary:"#1a1a2e",accent:"#2a2a45",glow:"#0f0f1a",atmosphere:"#1a1a2e",depth:"#050509",highlight:"#50507a"},tangerine:{primary:"#d4960a",secondary:"#e6a000",accent:"#fdb813",glow:"#d4960a",atmosphere:"#e6a000",depth:"#a06800",highlight:"#ffe082"},ember:{primary:"#b80000",secondary:"#d50000",accent:"#ff1744",glow:"#d50000",atmosphere:"#ff5252",depth:"#8b0000",highlight:"#ff8a80"},"tangerine-neon":{primary:"#EA580C",secondary:"#F97316",accent:"#FB923C",glow:"#EA580C",atmosphere:"#F97316",depth:"#9A3412",highlight:"#FDBA74"}};function Jm(i,A="dark"){const e=A==="dark"?st:Qt;return e[i]||e[Object.keys(e)[0]]}function Ym(i="dark"){return Object.keys(i==="dark"?st:Qt)}const KI={default:{dark:{colors:st.default,glowIntensity:1.2,idleGlowMultiplier:.6},light:{colors:Qt.indigo,glowIntensity:1.8,idleGlowMultiplier:1.2}},emerald:{dark:{colors:st.emerald,glowIntensity:1.2,idleGlowMultiplier:.6},light:{colors:Qt.teal,glowIntensity:1.8,idleGlowMultiplier:1.2}},rose:{dark:{colors:st.rose,glowIntensity:1.2,idleGlowMultiplier:.6},light:{colors:Qt.pink,glowIntensity:1.8,idleGlowMultiplier:1.2}},amber:{dark:{colors:st.amber,glowIntensity:1.2,idleGlowMultiplier:.6},light:{colors:Qt.orange,glowIntensity:1.8,idleGlowMultiplier:1.2}},cyan:{dark:{colors:st.cyan,glowIntensity:1.2,idleGlowMultiplier:.6},light:{colors:Qt.blue,glowIntensity:1.8,idleGlowMultiplier:1.2}},purple:{dark:{colors:st.purple,glowIntensity:1.2,idleGlowMultiplier:.6},light:{colors:Qt.violet,glowIntensity:1.8,idleGlowMultiplier:1.2}},blue:{dark:{colors:st.blue,glowIntensity:1.2,idleGlowMultiplier:.6},light:{colors:Qt.blue,glowIntensity:1.8,idleGlowMultiplier:1.2}},white:{dark:{colors:st.white,glowIntensity:1.2,idleGlowMultiplier:.6},light:{colors:Qt.silver,glowIntensity:1.8,idleGlowMultiplier:1.2}},black:{dark:{colors:st.black,glowIntensity:1.2,idleGlowMultiplier:.6},light:{colors:Qt.charcoal,glowIntensity:1.8,idleGlowMultiplier:1.2}},tangerine:{dark:{colors:st.tangerine,glowIntensity:1.2,idleGlowMultiplier:.6},light:{colors:Qt.tangerine,glowIntensity:1.8,idleGlowMultiplier:1.2}},ember:{dark:{colors:st.ember,glowIntensity:1.2,idleGlowMultiplier:.6},light:{colors:Qt.ember,glowIntensity:1.8,idleGlowMultiplier:1.2}},"tangerine-neon":{dark:{colors:st["tangerine-neon"],glowIntensity:1.4,idleGlowMultiplier:.7},light:{colors:Qt["tangerine-neon"],glowIntensity:2,idleGlowMultiplier:1.3}}},Tm=Object.fromEntries(Object.entries(KI).map(([i,A])=>[i,A.dark])),qm=Object.fromEntries(Object.entries(KI).map(([i,A])=>[i,A.light]));function JI(i){return(KI[i]||KI.default).dark}function Hm(){return Object.keys(KI)}function Pm(i,A){const e=JI(A);i.orbColors=e.colors,i.glowIntensity=e.glowIntensity,i.idleGlowMultiplier=e.idleGlowMultiplier}const hd="privacy_accepted",Dn="user_identity";function _n(){try{return localStorage.getItem(hd)==="true"}catch{return!1}}function pn(){try{localStorage.setItem(hd,"true")}catch{}}function ug(){try{let i=localStorage.getItem(Dn);return i||(i=crypto.randomUUID(),localStorage.setItem(Dn,i)),i}catch{const i=crypto.randomUUID();try{localStorage.setItem(Dn,i)}catch{console.warn("[hanc-widget] localStorage unavailable, user_identity will not persist across calls")}return i}}function wn(){try{return localStorage.getItem(Dn)}catch{return null}}function Om(){if(typeof window>"u")return"https://api.hanc.ai";const i=window.location.hostname;return i.endsWith(".hanc.me")||i==="hanc.me"||i==="localhost"?"https://api.hanc.me":"https://api.hanc.ai"}const ui=Om(),tr={terms_enabled:!1,terms_content:"",terms_url:"https://hanc.ai/terms",privacy_url:"https://hanc.ai/privacy",theme:"default",allow_all_domains:!0,allowed_domains:[]},mn=new Map,Vm=1e3;async function MC(i,A=ui){if(!i)return console.warn("[hanc-widget] No agentId provided, using default config"),tr;const e=mn.get(i);if(e&&Date.now()-e.timestamp<Vm)return e.config;try{const t=await fetch(`${A}/v1/site/widget-config/${i}`,{method:"GET",headers:{"Content-Type":"application/json"}});if(!t.ok){if(t.status===404)return console.warn(`[hanc-widget] Agent ${i} not found, using default config`),tr;throw new Error(`HTTP ${t.status}: ${t.statusText}`)}const g=await t.json();return mn.set(i,{config:g,timestamp:Date.now()}),g}catch(t){return console.error("[hanc-widget] Failed to fetch widget config:",t),tr}}const jm=["hanc.ai","hanc.me","localhost"];function FC(i){const A=window.location.hostname;return jm.some(t=>A===t||A.endsWith(`.${t}`))||i.allow_all_domains||!i.allowed_domains||i.allowed_domains.length===0?!0:i.allowed_domains.some(t=>A===t||A.endsWith(`.${t}`))}function Wm(i){i?mn.delete(i):mn.clear()}var Xm=Object.defineProperty,Zm=Object.getOwnPropertyDescriptor,UC=(i,A,e,t)=>{for(var g=t>1?void 0:t?Zm(A,e):A,I=i.length-1,C;I>=0;I--)(C=i[I])&&(g=(t?C(A,e,g):C(g))||g);return t&&g&&Xm(A,e,g),g};let Wg=class extends Kt{constructor(){super(...arguments),this.privacyUrl="https://hanc.ai/privacy",this.termsUrl="https://hanc.ai/terms",this.termsContent="",this.modalTitle="Before we start",this.modalContainer=null}connectedCallback(){super.connectedCallback(),this.createModal()}disconnectedCallback(){super.disconnectedCallback(),this.removeModal()}createModal(){this.modalContainer=document.createElement("div"),this.modalContainer.innerHTML=this.getModalHTML(),document.body.appendChild(this.modalContainer);const i=this.modalContainer.querySelector(".hanc-privacy-overlay"),A=this.modalContainer.querySelector(".hanc-btn-accept"),e=this.modalContainer.querySelector(".hanc-btn-decline");i==null||i.addEventListener("click",t=>{t.target===i&&this.handleDecline()}),A==null||A.addEventListener("click",()=>this.handleAccept()),e==null||e.addEventListener("click",()=>this.handleDecline())}removeModal(){this.modalContainer&&(this.modalContainer.remove(),this.modalContainer=null)}renderMarkdown(i){if(!i)return"";let e=(t=>t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;"))(i);return e=e.replace(/^#### (.+)$/gm,"<h4>$1</h4>"),e=e.replace(/^### (.+)$/gm,"<h3>$1</h3>"),e=e.replace(/^## (.+)$/gm,"<h2>$1</h2>"),e=e.replace(/^# (.+)$/gm,"<h1>$1</h1>"),e=e.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),e=e.replace(/__(.+?)__/g,"<strong>$1</strong>"),e=e.replace(/\*(.+?)\*/g,"<em>$1</em>"),e=e.replace(/_(.+?)_/g,"<em>$1</em>"),e=e.replace(/\[([^\]]+)\]\((https?:\/\/[^)]+)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>'),e=e.replace(/^\- (.+)$/gm,"<li>$1</li>"),e=e.replace(/(<li>.*<\/li>\n?)+/g,"<ul>$&</ul>"),e=e.replace(/\n\n/g,"</p><p>"),e="<p>"+e+"</p>",e=e.replace(/<p><\/p>/g,""),e=e.replace(/<p>(<h[1-4]>)/g,"$1"),e=e.replace(/(<\/h[1-4]>)<\/p>/g,"$1"),e=e.replace(/<p>(<ul>)/g,"$1"),e=e.replace(/(<\/ul>)<\/p>/g,"$1"),e=e.replace(/\n/g,"<br>"),e}getModalHTML(){const i=this.termsContent&&this.termsContent.trim().length>0,A=i?this.renderMarkdown(this.termsContent):"By starting this call, you agree to our Terms of Service and Privacy Policy.";return`
4549
4549
  <style>
4550
4550
  .hanc-privacy-overlay {
4551
4551
  position: fixed;
@@ -4754,7 +4754,7 @@ void main() {
4754
4754
  </div>
4755
4755
  </div>
4756
4756
  </div>
4757
- `}escapeHtml(i){return i.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}handleAccept(){this.dispatchEvent(new CustomEvent("accept",{bubbles:!0,composed:!0}))}handleDecline(){this.dispatchEvent(new CustomEvent("decline",{bubbles:!0,composed:!0}))}render(){return pA``}};Wg.styles=Dg`
4757
+ `}escapeHtml(i){return i.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}handleAccept(){this.dispatchEvent(new CustomEvent("accept",{bubbles:!0,composed:!0}))}handleDecline(){this.dispatchEvent(new CustomEvent("decline",{bubbles:!0,composed:!0}))}render(){return _A``}};Wg.styles=Dg`
4758
4758
  :host {
4759
4759
  display: contents;
4760
4760
  }
@@ -4949,18 +4949,18 @@ void main() {
4949
4949
  background: rgba(255, 255, 255, 0.15);
4950
4950
  border-radius: 4px;
4951
4951
  }
4952
- `;var $m=Object.defineProperty,Ay=Object.getOwnPropertyDescriptor,fg=(i,A,e,t)=>{for(var g=t>1?void 0:t?Ay(A,e):A,I=i.length-1,C;I>=0;I--)(C=i[I])&&(g=(t?C(A,e,g):C(g))||g);return t&&g&&$m(A,e,g),g};let fi=class extends Kt{constructor(){super(...arguments),this.requestId="",this.fields=[],this.visible=!1,this._values={},this._errors={},this._submitted=!1,this._animateIn=!1}updated(i){i.has("visible")&&this.visible&&(this._values={},this._errors={},this._submitted=!1,requestAnimationFrame(()=>{this._animateIn=!0})),i.has("visible")&&!this.visible&&(this._animateIn=!1)}_onInput(i,A){const e=A.target;if(this._values={...this._values,[i]:e.value},this._errors[i]){const{[i]:t,...g}=this._errors;this._errors=g}}_validate(){const i={};for(const A of this.fields){const e=(this._values[A.name]||"").trim();if(A.required&&!e){i[A.name]="Required";continue}e&&A.type==="email"&&(/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)||(i[A.name]="Invalid email")),e&&A.type==="phone"&&(/^\+?[\d\s\-()]{7,}$/.test(e)||(i[A.name]="Invalid phone number")),e&&A.type==="number"&&isNaN(Number(e))&&(i[A.name]="Must be a number")}return this._errors=i,Object.keys(i).length===0}_onSubmit(i){i.preventDefault(),this._validate()&&(this._submitted=!0,this.dispatchEvent(new CustomEvent("form-submit",{detail:{requestId:this.requestId,data:{...this._values}},bubbles:!0,composed:!0})),setTimeout(()=>{this.dispatchEvent(new CustomEvent("form-done",{bubbles:!0,composed:!0}))},1500))}_renderField(i){const A=this._errors[i.name],e=this._values[i.name]||"";if(i.type==="selector"&&i.options)return pA`
4952
+ `;var $m=Object.defineProperty,Ay=Object.getOwnPropertyDescriptor,fg=(i,A,e,t)=>{for(var g=t>1?void 0:t?Ay(A,e):A,I=i.length-1,C;I>=0;I--)(C=i[I])&&(g=(t?C(A,e,g):C(g))||g);return t&&g&&$m(A,e,g),g};let fi=class extends Kt{constructor(){super(...arguments),this.requestId="",this.fields=[],this.visible=!1,this._values={},this._errors={},this._submitted=!1,this._animateIn=!1}updated(i){i.has("visible")&&this.visible&&(this._values={},this._errors={},this._submitted=!1,requestAnimationFrame(()=>{this._animateIn=!0})),i.has("visible")&&!this.visible&&(this._animateIn=!1)}_onInput(i,A){const e=A.target;if(this._values={...this._values,[i]:e.value},this._errors[i]){const{[i]:t,...g}=this._errors;this._errors=g}}_validate(){const i={};for(const A of this.fields){const e=(this._values[A.name]||"").trim();if(A.required&&!e){i[A.name]="Required";continue}e&&A.type==="email"&&(/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)||(i[A.name]="Invalid email")),e&&A.type==="phone"&&(/^\+?[\d\s\-()]{7,}$/.test(e)||(i[A.name]="Invalid phone number")),e&&A.type==="number"&&isNaN(Number(e))&&(i[A.name]="Must be a number")}return this._errors=i,Object.keys(i).length===0}_onSubmit(i){i.preventDefault(),this._validate()&&(this._submitted=!0,this.dispatchEvent(new CustomEvent("form-submit",{detail:{requestId:this.requestId,data:{...this._values}},bubbles:!0,composed:!0})),setTimeout(()=>{this.dispatchEvent(new CustomEvent("form-done",{bubbles:!0,composed:!0}))},1500))}_renderField(i){const A=this._errors[i.name],e=this._values[i.name]||"";if(i.type==="selector"&&i.options)return _A`
4953
4953
  <div class="field">
4954
4954
  <label>${i.label}${i.required?" *":""}</label>
4955
4955
  <select @change=${g=>this._onInput(i.name,g)}>
4956
4956
  <option value="" ?selected=${!e}>Select...</option>
4957
- ${i.options.map(g=>pA`
4957
+ ${i.options.map(g=>_A`
4958
4958
  <option value=${g} ?selected=${e===g}>${g}</option>
4959
4959
  `)}
4960
4960
  </select>
4961
- ${A?pA`<div class="error-text">${A}</div>`:Ce}
4961
+ ${A?_A`<div class="error-text">${A}</div>`:Ce}
4962
4962
  </div>
4963
- `;if(i.type==="boolean")return pA`
4963
+ `;if(i.type==="boolean")return _A`
4964
4964
  <div class="field">
4965
4965
  <label>
4966
4966
  <input
@@ -4971,7 +4971,7 @@ void main() {
4971
4971
  ${i.label}
4972
4972
  </label>
4973
4973
  </div>
4974
- `;const t=i.type==="email"?"email":i.type==="phone"?"tel":i.type==="number"?"number":"text";return pA`
4974
+ `;const t=i.type==="email"?"email":i.type==="phone"?"tel":i.type==="number"?"number":"text";return _A`
4975
4975
  <div class="field">
4976
4976
  <label>${i.label}${i.required?" *":""}</label>
4977
4977
  <input
@@ -4981,12 +4981,12 @@ void main() {
4981
4981
  class=${A?"invalid":""}
4982
4982
  @input=${g=>this._onInput(i.name,g)}
4983
4983
  />
4984
- ${A?pA`<div class="error-text">${A}</div>`:Ce}
4984
+ ${A?_A`<div class="error-text">${A}</div>`:Ce}
4985
4985
  </div>
4986
- `}render(){return this.visible?pA`
4986
+ `}render(){return this.visible?_A`
4987
4987
  <div class="overlay ${this._animateIn?"visible":""}">
4988
4988
  <div class="form-card">
4989
- ${this._submitted?pA`<div class="success-msg">Submitted!</div>`:pA`
4989
+ ${this._submitted?_A`<div class="success-msg">Submitted!</div>`:_A`
4990
4990
  <form @submit=${this._onSubmit}>
4991
4991
  ${this.fields.map(i=>this._renderField(i))}
4992
4992
  <button type="submit" class="submit-btn">Submit</button>
@@ -4994,7 +4994,7 @@ void main() {
4994
4994
  `}
4995
4995
  </div>
4996
4996
  </div>
4997
- `:Ce}};fi.styles=zm,fg([V({type:String})],fi.prototype,"requestId",2),fg([V({type:Array})],fi.prototype,"fields",2),fg([V({type:Boolean})],fi.prototype,"visible",2),fg([vA()],fi.prototype,"_values",2),fg([vA()],fi.prototype,"_errors",2),fg([vA()],fi.prototype,"_submitted",2),fg([vA()],fi.prototype,"_animateIn",2),fi=fg([mg("form-overlay")],fi);var ey=Object.defineProperty,ty=Object.getOwnPropertyDescriptor,OA=(i,A,e,t)=>{for(var g=t>1?void 0:t?ty(A,e):A,I=i.length-1,C;I>=0;I--)(C=i[I])&&(g=(t?C(A,e,g):C(g))||g);return t&&g&&ey(A,e,g),g};G.InlineCall=class extends Kt{constructor(){super(...arguments),this.callManager=new Fg,this.orbRenderer=null,this.audioAnalyzer=null,this.soundManager=null,this.orbContainerRef=eo(),this.animationId=null,this.user_identity=wn(),this.callStatus="idle",this.microphoneEnabled=!1,this.microphoneInitialized=!1,this.showPrivacyModal=!1,this.widgetConfig=null,this.configLoading=!1,this.formVisible=!1,this.formRequestId="",this.formFields=[],this.domainBlocked=!1,this.errorKind=null,this.privacyUrl="https://hanc.ai/privacy",this.termsUrl="https://hanc.ai/terms",this.termsEnabled=!1,this.termsContent="",this.skipFetch=!1,this.apiBaseUrl=ui,this.buttonStartText="Try to call",this.buttonConnectingText="Connecting...",this.size=370,this.containerPadding=45,this.theme="default",this.orbColors={},this.glowIntensity=.8,this.idleGlowMultiplier=.4,this.morphStrength=1,this.noiseScale=1.5,this.noiseSpeed=.3,this.fresnelPower=2.5,this.rotationSpeed=.1,this.audioReactivity=3,this.audioSmoothing=.9,this.idleMorphMultiplier=.25,this.colorContrast=1.5,this.soundEnabled=!0,this.soundVolume=.25,this.soundPreset="1",this.handleAudioTrack=async A=>{const t=A.detail;if(!(!t||!this.audioAnalyzer))try{const g=new MediaStream([t]);await this.audioAnalyzer.connectStream(g)}catch(g){console.error("Failed to connect audio stream:",g)}},this.handleLocalAudioTrack=async A=>{const t=A.detail;if(!(!t||!this.audioAnalyzer))try{const g=new MediaStream([t]);await this.audioAnalyzer.connectLocalStream(g)}catch(g){console.error("Failed to connect local audio stream:",g)}},this.handleMicrophoneEnabled=()=>{this.microphoneEnabled=!0,this.microphoneInitialized=!0},this.handleMicrophoneDisabled=()=>{this.microphoneEnabled=!1,this.microphoneInitialized=!0},this.handleError=A=>{const e=A.detail;this.errorKind=(e==null?void 0:e.status)===429?"rate-limit":"generic"},this.handleStatusChange=A=>{var t,g,I,C,o;switch(A.detail){case"connecting":this.callStatus="connecting";break;case"connected":this.callStatus="connected",(t=this.orbRenderer)==null||t.setActive(!0),this.startRealAudioLoop(),setTimeout(()=>{var n;(n=this.soundManager)==null||n.playCallStartSound()},300),this.dispatchEvent(new Event("call-start",{bubbles:!0,composed:!0}));break;case"disconnected":this.callStatus="idle",this.microphoneInitialized=!1,(g=this.orbRenderer)==null||g.setActive(!1),(I=this.audioAnalyzer)==null||I.disconnect(),this.startIdleAnimation(),setTimeout(()=>{var n;(n=this.soundManager)==null||n.playCallEndSound()},150),this.dispatchEvent(new Event("call-end",{bubbles:!0,composed:!0}));break;case"error":this.callStatus="error",(C=this.orbRenderer)==null||C.setActive(!1),(o=this.audioAnalyzer)==null||o.disconnect(),setTimeout(()=>{this.callStatus==="error"&&(this.callStatus="idle",this.errorKind=null,this.startIdleAnimation())},3e3);break}},this.toggleCall=async()=>{var A,e;if(this.agentId){if(this.domainBlocked){console.warn("[hanc-widget] Call blocked: widget not allowed on this domain");return}if(await((A=this.soundManager)==null?void 0:A.prewarm()),this.callStatus==="idle"){if((((e=this.widgetConfig)==null?void 0:e.terms_enabled)??!1)&&!_n()){this.showPrivacyModal=!0;return}this.user_identity=ug(),this.callStatus="connecting",this.resetCallManager(),await this.callManager.makeCall({agentId:this.agentId,user_identity:this.user_identity})}else this.callStatus==="connected"&&this.callManager.hangUp()}},this.handleAgentCommand=A=>{var t;const e=A.detail;if(e.type==="show_form"&&((t=e.payload)!=null&&t.fields)){const I=e.payload.fields.filter(C=>C.show_in_form!==!1);if(I.length===0)return;this.formRequestId=e.payload.request_id??"",this.formFields=I,this.formVisible=!0}else e.type==="hide_form"&&(this.formVisible=!1)},this.handleFormSubmit=A=>{const{requestId:e,data:t}=A.detail;this.callManager.sendDataToAgent({type:"form_response",payload:{request_id:e,data:t}})},this.handleFormDone=()=>{this.formVisible=!1},this.handlePrivacyAccept=async()=>{pn(),this.user_identity=ug(),this.showPrivacyModal=!1,this.callStatus="connecting",this.resetCallManager(),await this.callManager.makeCall({agentId:this.agentId,user_identity:this.user_identity})},this.handlePrivacyDecline=()=>{this.showPrivacyModal=!1}}connectedCallback(){super.connectedCallback(),this.voiceServiceUrl&&(this.callManager.serviceUrl=this.voiceServiceUrl),this.soundManager=new GC({enabled:this.soundEnabled,volume:this.soundVolume,preset:this.soundPreset}),this.attachCallManagerListeners(this.callManager),this.loadWidgetConfig()}async loadWidgetConfig(){if(this.skipFetch){this.widgetConfig={terms_enabled:this.termsEnabled,terms_content:this.termsContent,terms_url:this.termsUrl,privacy_url:this.privacyUrl,theme:this.theme,allow_all_domains:!0,allowed_domains:[]};return}if(!(!this.agentId||this.configLoading)){this.configLoading=!0;try{const A=await MC(this.agentId,this.apiBaseUrl);this.widgetConfig=A,FC(A)||(this.domainBlocked=!0,console.warn("[hanc-widget] Widget is not allowed on this domain")),A.theme&&A.theme!=="default"&&!this.hasAttribute("theme")&&(this.theme=A.theme,this.applyTheme())}catch(A){console.error("[hanc-widget] Failed to load widget config:",A)}finally{this.configLoading=!1}}}disconnectedCallback(){var A;super.disconnectedCallback(),this.detachCallManagerListeners(this.callManager),this.callManager.hangUp(),this.cleanupOrb(),(A=this.soundManager)==null||A.destroy(),this.soundManager=null}firstUpdated(){this.applyTheme(),this.initializeOrb()}updated(A){var e,t,g;super.updated(A),A.has("agentId")&&(this.callManager.hangUp(),this.callStatus="idle",this.widgetConfig=null,this.domainBlocked=!1,this.loadWidgetConfig()),A.has("apiBaseUrl")&&this.agentId&&this.loadWidgetConfig(),this.skipFetch&&(A.has("termsEnabled")||A.has("termsContent")||A.has("termsUrl")||A.has("privacyUrl")||A.has("theme"))&&this.loadWidgetConfig(),A.has("voiceServiceUrl")&&this.voiceServiceUrl&&(this.callManager.serviceUrl=this.voiceServiceUrl),A.has("theme")&&this.applyTheme(),A.has("soundEnabled")&&((e=this.soundManager)==null||e.setEnabled(this.soundEnabled)),A.has("soundVolume")&&((t=this.soundManager)==null||t.setVolume(this.soundVolume)),A.has("soundPreset")&&((g=this.soundManager)==null||g.setPreset(this.soundPreset))}applyTheme(){if(this.theme){const A=JI(this.theme);this.orbColors=A.colors,this.glowIntensity=A.glowIntensity,this.idleGlowMultiplier=A.idleGlowMultiplier,this.orbRenderer&&(this.orbRenderer.setColors(this.orbColors),this.orbRenderer.setGlowSettings(this.glowIntensity,this.idleGlowMultiplier))}}initializeOrb(){const A=this.orbContainerRef.value;A&&(this.orbRenderer=new un(A,{size:1,colors:this.orbColors,glowIntensity:this.glowIntensity,idleGlowMultiplier:this.idleGlowMultiplier,morphStrength:this.morphStrength,noiseScale:this.noiseScale,noiseSpeed:this.noiseSpeed,fresnelPower:this.fresnelPower,rotationSpeed:this.rotationSpeed,audioReactivity:this.audioReactivity,audioSmoothing:this.audioSmoothing,idleMorphMultiplier:this.idleMorphMultiplier,colorContrast:this.colorContrast}),this.audioAnalyzer=new fn,this.orbRenderer.start(),this.startIdleAnimation())}cleanupOrb(){var A,e;this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null),(A=this.audioAnalyzer)==null||A.disconnect(),(e=this.orbRenderer)==null||e.destroy(),this.audioAnalyzer=null,this.orbRenderer=null}startIdleAnimation(){this.animationId!==null&&cancelAnimationFrame(this.animationId);const A=()=>{if(this.callStatus!=="idle"||!this.orbRenderer)return;const e=performance.now()/1e3,t=Math.sin(e*.5)*.15+.15,g=Math.sin(e*.7+1)*.12+.12,I=Math.sin(e*.9+2)*.08+.08,C=(t+g+I)/3;this.orbRenderer.setSimulatedAudio(t,g,I,C),this.animationId=requestAnimationFrame(A)};this.animationId=requestAnimationFrame(A)}startRealAudioLoop(){this.animationId!==null&&cancelAnimationFrame(this.animationId);const A=()=>{var t;if(this.callStatus!=="connected"||!this.orbRenderer)return;const e=(t=this.audioAnalyzer)==null?void 0:t.getAudioData();e&&this.orbRenderer.updateAudio(e),this.animationId=requestAnimationFrame(A)};this.animationId=requestAnimationFrame(A)}attachCallManagerListeners(A){A.addEventListener("status-changed",this.handleStatusChange),A.addEventListener("audio-track",this.handleAudioTrack),A.addEventListener("local-audio-track",this.handleLocalAudioTrack),A.addEventListener("microphone-enabled",this.handleMicrophoneEnabled),A.addEventListener("microphone-disabled",this.handleMicrophoneDisabled),A.addEventListener("agent-command",this.handleAgentCommand),A.addEventListener("error",this.handleError)}detachCallManagerListeners(A){A.removeEventListener("status-changed",this.handleStatusChange),A.removeEventListener("audio-track",this.handleAudioTrack),A.removeEventListener("local-audio-track",this.handleLocalAudioTrack),A.removeEventListener("microphone-enabled",this.handleMicrophoneEnabled),A.removeEventListener("microphone-disabled",this.handleMicrophoneDisabled),A.removeEventListener("agent-command",this.handleAgentCommand),A.removeEventListener("error",this.handleError)}resetCallManager(){this.detachCallManagerListeners(this.callManager),this.callManager.hangUp(),this.callManager=new Fg,this.voiceServiceUrl&&(this.callManager.serviceUrl=this.voiceServiceUrl),this.attachCallManagerListeners(this.callManager)}getButtonIcon(){return this.callStatus==="connecting"?pA`
4997
+ `:Ce}};fi.styles=zm,fg([V({type:String})],fi.prototype,"requestId",2),fg([V({type:Array})],fi.prototype,"fields",2),fg([V({type:Boolean})],fi.prototype,"visible",2),fg([vA()],fi.prototype,"_values",2),fg([vA()],fi.prototype,"_errors",2),fg([vA()],fi.prototype,"_submitted",2),fg([vA()],fi.prototype,"_animateIn",2),fi=fg([mg("form-overlay")],fi);var ey=Object.defineProperty,ty=Object.getOwnPropertyDescriptor,HA=(i,A,e,t)=>{for(var g=t>1?void 0:t?ty(A,e):A,I=i.length-1,C;I>=0;I--)(C=i[I])&&(g=(t?C(A,e,g):C(g))||g);return t&&g&&ey(A,e,g),g};G.InlineCall=class extends Kt{constructor(){super(...arguments),this.callManager=new Fg,this.orbRenderer=null,this.audioAnalyzer=null,this.soundManager=null,this.orbContainerRef=eo(),this.animationId=null,this.user_identity=wn(),this.callStatus="idle",this.microphoneEnabled=!1,this.microphoneInitialized=!1,this.showPrivacyModal=!1,this.widgetConfig=null,this.configLoading=!1,this.formVisible=!1,this.formRequestId="",this.formFields=[],this.domainBlocked=!1,this.errorKind=null,this.privacyUrl="https://hanc.ai/privacy",this.termsUrl="https://hanc.ai/terms",this.termsEnabled=!1,this.termsContent="",this.skipFetch=!1,this.hideBranding=!1,this.apiBaseUrl=ui,this.buttonStartText="Try to call",this.buttonConnectingText="Connecting...",this.size=370,this.containerPadding=45,this.theme="default",this.orbColors={},this.glowIntensity=.8,this.idleGlowMultiplier=.4,this.morphStrength=1,this.noiseScale=1.5,this.noiseSpeed=.3,this.fresnelPower=2.5,this.rotationSpeed=.1,this.audioReactivity=3,this.audioSmoothing=.9,this.idleMorphMultiplier=.25,this.colorContrast=1.5,this.soundEnabled=!0,this.soundVolume=.25,this.soundPreset="1",this.handleAudioTrack=async A=>{const t=A.detail;if(!(!t||!this.audioAnalyzer))try{const g=new MediaStream([t]);await this.audioAnalyzer.connectStream(g)}catch(g){console.error("Failed to connect audio stream:",g)}},this.handleLocalAudioTrack=async A=>{const t=A.detail;if(!(!t||!this.audioAnalyzer))try{const g=new MediaStream([t]);await this.audioAnalyzer.connectLocalStream(g)}catch(g){console.error("Failed to connect local audio stream:",g)}},this.handleMicrophoneEnabled=()=>{this.microphoneEnabled=!0,this.microphoneInitialized=!0},this.handleMicrophoneDisabled=()=>{this.microphoneEnabled=!1,this.microphoneInitialized=!0},this.handleError=A=>{const e=A.detail;this.errorKind=(e==null?void 0:e.status)===429?"rate-limit":"generic"},this.handleStatusChange=A=>{var t,g,I,C,o;switch(A.detail){case"connecting":this.callStatus="connecting";break;case"connected":this.callStatus="connected",(t=this.orbRenderer)==null||t.setActive(!0),this.startRealAudioLoop(),setTimeout(()=>{var n;(n=this.soundManager)==null||n.playCallStartSound()},300),this.dispatchEvent(new Event("call-start",{bubbles:!0,composed:!0}));break;case"disconnected":this.callStatus="idle",this.microphoneInitialized=!1,(g=this.orbRenderer)==null||g.setActive(!1),(I=this.audioAnalyzer)==null||I.disconnect(),this.startIdleAnimation(),setTimeout(()=>{var n;(n=this.soundManager)==null||n.playCallEndSound()},150),this.dispatchEvent(new Event("call-end",{bubbles:!0,composed:!0}));break;case"error":this.callStatus="error",(C=this.orbRenderer)==null||C.setActive(!1),(o=this.audioAnalyzer)==null||o.disconnect(),setTimeout(()=>{this.callStatus==="error"&&(this.callStatus="idle",this.errorKind=null,this.startIdleAnimation())},3e3);break}},this.toggleCall=async()=>{var A,e;if(this.agentId){if(this.domainBlocked){console.warn("[hanc-widget] Call blocked: widget not allowed on this domain");return}if(await((A=this.soundManager)==null?void 0:A.prewarm()),this.callStatus==="idle"){if((((e=this.widgetConfig)==null?void 0:e.terms_enabled)??!1)&&!_n()){this.showPrivacyModal=!0;return}this.user_identity=ug(),this.callStatus="connecting",this.resetCallManager(),await this.callManager.makeCall({agentId:this.agentId,user_identity:this.user_identity})}else this.callStatus==="connected"&&this.callManager.hangUp()}},this.handleAgentCommand=A=>{var t;const e=A.detail;if(e.type==="show_form"&&((t=e.payload)!=null&&t.fields)){const I=e.payload.fields.filter(C=>C.show_in_form!==!1);if(I.length===0)return;this.formRequestId=e.payload.request_id??"",this.formFields=I,this.formVisible=!0}else e.type==="hide_form"&&(this.formVisible=!1)},this.handleFormSubmit=A=>{const{requestId:e,data:t}=A.detail;this.callManager.sendDataToAgent({type:"form_response",payload:{request_id:e,data:t}})},this.handleFormDone=()=>{this.formVisible=!1},this.handlePrivacyAccept=async()=>{pn(),this.user_identity=ug(),this.showPrivacyModal=!1,this.callStatus="connecting",this.resetCallManager(),await this.callManager.makeCall({agentId:this.agentId,user_identity:this.user_identity})},this.handlePrivacyDecline=()=>{this.showPrivacyModal=!1}}connectedCallback(){super.connectedCallback(),this.voiceServiceUrl&&(this.callManager.serviceUrl=this.voiceServiceUrl),this.soundManager=new GC({enabled:this.soundEnabled,volume:this.soundVolume,preset:this.soundPreset}),this.attachCallManagerListeners(this.callManager),this.loadWidgetConfig()}async loadWidgetConfig(){if(this.skipFetch){this.widgetConfig={terms_enabled:this.termsEnabled,terms_content:this.termsContent,terms_url:this.termsUrl,privacy_url:this.privacyUrl,theme:this.theme,allow_all_domains:!0,allowed_domains:[]};return}if(!(!this.agentId||this.configLoading)){this.configLoading=!0;try{const A=await MC(this.agentId,this.apiBaseUrl);this.widgetConfig=A,FC(A)||(this.domainBlocked=!0,console.warn("[hanc-widget] Widget is not allowed on this domain")),A.theme&&A.theme!=="default"&&!this.hasAttribute("theme")&&(this.theme=A.theme,this.applyTheme())}catch(A){console.error("[hanc-widget] Failed to load widget config:",A)}finally{this.configLoading=!1}}}disconnectedCallback(){var A;super.disconnectedCallback(),this.detachCallManagerListeners(this.callManager),this.callManager.hangUp(),this.cleanupOrb(),(A=this.soundManager)==null||A.destroy(),this.soundManager=null}firstUpdated(){this.applyTheme(),this.initializeOrb()}updated(A){var e,t,g;super.updated(A),A.has("agentId")&&(this.callManager.hangUp(),this.callStatus="idle",this.widgetConfig=null,this.domainBlocked=!1,this.loadWidgetConfig()),A.has("apiBaseUrl")&&this.agentId&&this.loadWidgetConfig(),this.skipFetch&&(A.has("termsEnabled")||A.has("termsContent")||A.has("termsUrl")||A.has("privacyUrl")||A.has("theme"))&&this.loadWidgetConfig(),A.has("voiceServiceUrl")&&this.voiceServiceUrl&&(this.callManager.serviceUrl=this.voiceServiceUrl),A.has("theme")&&this.applyTheme(),A.has("soundEnabled")&&((e=this.soundManager)==null||e.setEnabled(this.soundEnabled)),A.has("soundVolume")&&((t=this.soundManager)==null||t.setVolume(this.soundVolume)),A.has("soundPreset")&&((g=this.soundManager)==null||g.setPreset(this.soundPreset))}applyTheme(){if(this.theme){const A=JI(this.theme);this.orbColors=A.colors,this.glowIntensity=A.glowIntensity,this.idleGlowMultiplier=A.idleGlowMultiplier,this.orbRenderer&&(this.orbRenderer.setColors(this.orbColors),this.orbRenderer.setGlowSettings(this.glowIntensity,this.idleGlowMultiplier))}}initializeOrb(){const A=this.orbContainerRef.value;A&&(this.orbRenderer=new un(A,{size:1,colors:this.orbColors,glowIntensity:this.glowIntensity,idleGlowMultiplier:this.idleGlowMultiplier,morphStrength:this.morphStrength,noiseScale:this.noiseScale,noiseSpeed:this.noiseSpeed,fresnelPower:this.fresnelPower,rotationSpeed:this.rotationSpeed,audioReactivity:this.audioReactivity,audioSmoothing:this.audioSmoothing,idleMorphMultiplier:this.idleMorphMultiplier,colorContrast:this.colorContrast}),this.audioAnalyzer=new fn,this.orbRenderer.start(),this.startIdleAnimation())}cleanupOrb(){var A,e;this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null),(A=this.audioAnalyzer)==null||A.disconnect(),(e=this.orbRenderer)==null||e.destroy(),this.audioAnalyzer=null,this.orbRenderer=null}startIdleAnimation(){this.animationId!==null&&cancelAnimationFrame(this.animationId);const A=()=>{if(this.callStatus!=="idle"||!this.orbRenderer)return;const e=performance.now()/1e3,t=Math.sin(e*.5)*.15+.15,g=Math.sin(e*.7+1)*.12+.12,I=Math.sin(e*.9+2)*.08+.08,C=(t+g+I)/3;this.orbRenderer.setSimulatedAudio(t,g,I,C),this.animationId=requestAnimationFrame(A)};this.animationId=requestAnimationFrame(A)}startRealAudioLoop(){this.animationId!==null&&cancelAnimationFrame(this.animationId);const A=()=>{var t;if(this.callStatus!=="connected"||!this.orbRenderer)return;const e=(t=this.audioAnalyzer)==null?void 0:t.getAudioData();e&&this.orbRenderer.updateAudio(e),this.animationId=requestAnimationFrame(A)};this.animationId=requestAnimationFrame(A)}attachCallManagerListeners(A){A.addEventListener("status-changed",this.handleStatusChange),A.addEventListener("audio-track",this.handleAudioTrack),A.addEventListener("local-audio-track",this.handleLocalAudioTrack),A.addEventListener("microphone-enabled",this.handleMicrophoneEnabled),A.addEventListener("microphone-disabled",this.handleMicrophoneDisabled),A.addEventListener("agent-command",this.handleAgentCommand),A.addEventListener("error",this.handleError)}detachCallManagerListeners(A){A.removeEventListener("status-changed",this.handleStatusChange),A.removeEventListener("audio-track",this.handleAudioTrack),A.removeEventListener("local-audio-track",this.handleLocalAudioTrack),A.removeEventListener("microphone-enabled",this.handleMicrophoneEnabled),A.removeEventListener("microphone-disabled",this.handleMicrophoneDisabled),A.removeEventListener("agent-command",this.handleAgentCommand),A.removeEventListener("error",this.handleError)}resetCallManager(){this.detachCallManagerListeners(this.callManager),this.callManager.hangUp(),this.callManager=new Fg,this.voiceServiceUrl&&(this.callManager.serviceUrl=this.voiceServiceUrl),this.attachCallManagerListeners(this.callManager)}getButtonIcon(){return this.callStatus==="connecting"?_A`
4998
4998
  <svg width="16" height="16" viewBox="0 0 16 16" fill="none" class="hanc-spinner">
4999
4999
  <circle
5000
5000
  cx="8"
@@ -5006,7 +5006,7 @@ void main() {
5006
5006
  stroke-linecap="round"
5007
5007
  />
5008
5008
  </svg>
5009
- `:this.callStatus==="connected"?pA`
5009
+ `:this.callStatus==="connected"?_A`
5010
5010
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none">
5011
5011
  <path
5012
5012
  d="M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91"
@@ -5025,7 +5025,7 @@ void main() {
5025
5025
  stroke-linecap="round"
5026
5026
  />
5027
5027
  </svg>
5028
- `:pA`
5028
+ `:_A`
5029
5029
  <svg width="16" height="18" viewBox="0 0 328 369" fill="none">
5030
5030
  <rect
5031
5031
  x="110.323"
@@ -5058,7 +5058,7 @@ void main() {
5058
5058
  fill="white"
5059
5059
  />
5060
5060
  </svg>
5061
- `}get buttonText(){switch(this.callStatus){case"connecting":return this.buttonConnectingText;case"error":return this.errorKind==="rate-limit"?"Too many attempts, try again soon":"Error";default:return this.buttonStartText}}render(){var t,g,I;const A=this.size,e=A-this.containerPadding*2;return pA`
5061
+ `}get buttonText(){switch(this.callStatus){case"connecting":return this.buttonConnectingText;case"error":return this.errorKind==="rate-limit"?"Too many attempts, try again soon":"Error";default:return this.buttonStartText}}render(){var t,g,I;const A=this.size,e=A-this.containerPadding*2;return _A`
5062
5062
  <style>
5063
5063
  .container {
5064
5064
  position: relative;
@@ -5238,16 +5238,18 @@ void main() {
5238
5238
  </style>
5239
5239
 
5240
5240
  <div class="container" part="container">
5241
- <div class="brand">
5242
- Powered by <a class="brand_link" href="https://hanc.ai" target="_blank">HANC.ai</a>
5243
- </div>
5241
+ ${this.hideBranding?"":_A`
5242
+ <div class="brand">
5243
+ Powered by <a class="brand_link" href="https://hanc.ai" target="_blank">HANC.ai</a>
5244
+ </div>
5245
+ `}
5244
5246
  <div
5245
5247
  class="orb-container"
5246
5248
  part="orb-container"
5247
5249
  @click=${this.toggleCall}
5248
5250
  ${to(this.orbContainerRef)}
5249
5251
  >
5250
- ${this.callStatus==="connected"&&this.microphoneInitialized&&!this.microphoneEnabled?pA`
5252
+ ${this.callStatus==="connected"&&this.microphoneInitialized&&!this.microphoneEnabled?_A`
5251
5253
  <div class="microphone-indicator visible">
5252
5254
  <svg viewBox="0 0 24 24" fill="none">
5253
5255
  <path
@@ -5287,7 +5289,7 @@ void main() {
5287
5289
  </div>
5288
5290
  </.div>
5289
5291
 
5290
- ${this.showPrivacyModal?pA`
5292
+ ${this.showPrivacyModal?_A`
5291
5293
  <hanc-privacy-modal
5292
5294
  privacy-url=${((t=this.widgetConfig)==null?void 0:t.privacy_url)||this.privacyUrl}
5293
5295
  terms-url=${((g=this.widgetConfig)==null?void 0:g.terms_url)||this.termsUrl}
@@ -5309,7 +5311,7 @@ void main() {
5309
5311
  display: inline-block;
5310
5312
  contain: layout style;
5311
5313
  }
5312
- `,OA([V({type:String,attribute:"agent-id"})],G.InlineCall.prototype,"agentId",2),OA([V({type:String,attribute:"voice-service-url"})],G.InlineCall.prototype,"voiceServiceUrl",2),OA([vA()],G.InlineCall.prototype,"callStatus",2),OA([vA()],G.InlineCall.prototype,"microphoneEnabled",2),OA([vA()],G.InlineCall.prototype,"microphoneInitialized",2),OA([vA()],G.InlineCall.prototype,"showPrivacyModal",2),OA([vA()],G.InlineCall.prototype,"widgetConfig",2),OA([vA()],G.InlineCall.prototype,"configLoading",2),OA([vA()],G.InlineCall.prototype,"formVisible",2),OA([vA()],G.InlineCall.prototype,"formRequestId",2),OA([vA()],G.InlineCall.prototype,"formFields",2),OA([vA()],G.InlineCall.prototype,"domainBlocked",2),OA([vA()],G.InlineCall.prototype,"errorKind",2),OA([V({type:String,attribute:"privacy-url"})],G.InlineCall.prototype,"privacyUrl",2),OA([V({type:String,attribute:"terms-url"})],G.InlineCall.prototype,"termsUrl",2),OA([V({type:Boolean,attribute:"terms-enabled"})],G.InlineCall.prototype,"termsEnabled",2),OA([V({type:String,attribute:"terms-content"})],G.InlineCall.prototype,"termsContent",2),OA([V({type:Boolean,attribute:"skip-fetch"})],G.InlineCall.prototype,"skipFetch",2),OA([V({type:String,attribute:"api-base-url"})],G.InlineCall.prototype,"apiBaseUrl",2),OA([V({type:String,attribute:"button-start-text"})],G.InlineCall.prototype,"buttonStartText",2),OA([V({type:String,attribute:"button-connecting-text"})],G.InlineCall.prototype,"buttonConnectingText",2),OA([V({type:Number,attribute:"size"})],G.InlineCall.prototype,"size",2),OA([V({type:Number,attribute:"container-padding"})],G.InlineCall.prototype,"containerPadding",2),OA([V({type:String,attribute:"theme",reflect:!0})],G.InlineCall.prototype,"theme",2),OA([V({type:Object,attribute:"orb-colors"})],G.InlineCall.prototype,"orbColors",2),OA([V({type:Number,attribute:"glow-intensity"})],G.InlineCall.prototype,"glowIntensity",2),OA([V({type:Number,attribute:"idle-glow-multiplier"})],G.InlineCall.prototype,"idleGlowMultiplier",2),OA([V({type:Number,attribute:"morph-strength"})],G.InlineCall.prototype,"morphStrength",2),OA([V({type:Number,attribute:"noise-scale"})],G.InlineCall.prototype,"noiseScale",2),OA([V({type:Number,attribute:"noise-speed"})],G.InlineCall.prototype,"noiseSpeed",2),OA([V({type:Number,attribute:"fresnel-power"})],G.InlineCall.prototype,"fresnelPower",2),OA([V({type:Number,attribute:"rotation-speed"})],G.InlineCall.prototype,"rotationSpeed",2),OA([V({type:Number,attribute:"audio-reactivity"})],G.InlineCall.prototype,"audioReactivity",2),OA([V({type:Number,attribute:"audio-smoothing"})],G.InlineCall.prototype,"audioSmoothing",2),OA([V({type:Number,attribute:"idle-morph-multiplier"})],G.InlineCall.prototype,"idleMorphMultiplier",2),OA([V({type:Number,attribute:"color-contrast"})],G.InlineCall.prototype,"colorContrast",2),OA([V({type:Boolean,attribute:"sound-enabled"})],G.InlineCall.prototype,"soundEnabled",2),OA([V({type:Number,attribute:"sound-volume"})],G.InlineCall.prototype,"soundVolume",2),OA([V({type:String,attribute:"sound-preset"})],G.InlineCall.prototype,"soundPreset",2),G.InlineCall=OA([mg("hanc-ai-inline-call")],G.InlineCall);var iy=Object.defineProperty,gy=Object.getOwnPropertyDescriptor,ee=(i,A,e,t)=>{for(var g=t>1?void 0:t?gy(A,e):A,I=i.length-1,C;I>=0;I--)(C=i[I])&&(g=(t?C(A,e,g):C(g))||g);return t&&g&&iy(A,e,g),g};G.FloatingCall=class extends Kt{constructor(){super(...arguments),this.callManager=new Fg,this.orbRenderer=null,this.audioAnalyzer=null,this.soundManager=null,this.orbContainerRef=eo(),this.animationId=null,this.user_identity=wn(),this._disconnectTimer=null,this.callStatus="idle",this.microphoneEnabled=!1,this.microphoneInitialized=!1,this.showPrivacyModal=!1,this.widgetConfig=null,this.configLoading=!1,this.domainBlocked=!1,this.privacyUrl="https://hanc.ai/privacy",this.termsUrl="https://hanc.ai/terms",this.termsEnabled=!1,this.termsContent="",this.skipFetch=!1,this.apiBaseUrl=ui,this.buttonStartText="Call",this.buttonConnectingText="Connecting...",this.position="bottom-right",this.size=120,this.theme="default",this.orbColors={},this.glowIntensity=.8,this.idleGlowMultiplier=.4,this.morphStrength=1,this.noiseScale=1.5,this.noiseSpeed=.3,this.fresnelPower=2.5,this.rotationSpeed=.1,this.audioReactivity=3,this.audioSmoothing=.9,this.idleMorphMultiplier=.25,this.colorContrast=1.5,this.soundEnabled=!0,this.soundVolume=.25,this.soundPreset="1",this.handleAudioTrack=async A=>{const t=A.detail;if(!(!t||!this.audioAnalyzer))try{const g=new MediaStream([t]);await this.audioAnalyzer.connectStream(g)}catch(g){console.error("Failed to connect audio stream:",g)}},this.handleLocalAudioTrack=async A=>{const t=A.detail;if(!(!t||!this.audioAnalyzer))try{const g=new MediaStream([t]);await this.audioAnalyzer.connectLocalStream(g)}catch(g){console.error("Failed to connect local audio stream:",g)}},this.handleMicrophoneEnabled=()=>{this.microphoneEnabled=!0,this.microphoneInitialized=!0},this.handleMicrophoneDisabled=()=>{this.microphoneEnabled=!1,this.microphoneInitialized=!0},this.handleStatusChange=A=>{var t,g,I,C,o;switch(A.detail){case"connecting":this.callStatus="connecting";break;case"connected":this.callStatus="connected",(t=this.orbRenderer)==null||t.setActive(!0),this.startRealAudioLoop(),setTimeout(()=>{var n;(n=this.soundManager)==null||n.playCallStartSound()},300),this.dispatchEvent(new Event("call-start",{bubbles:!0,composed:!0}));break;case"disconnected":this.callStatus="idle",this.microphoneInitialized=!1,(g=this.orbRenderer)==null||g.setActive(!1),(I=this.audioAnalyzer)==null||I.disconnect(),this.startIdleAnimation(),setTimeout(()=>{var n;(n=this.soundManager)==null||n.playCallEndSound()},150),this.dispatchEvent(new Event("call-end",{bubbles:!0,composed:!0}));break;case"error":this.callStatus="error",(C=this.orbRenderer)==null||C.setActive(!1),(o=this.audioAnalyzer)==null||o.disconnect(),setTimeout(()=>{this.callStatus==="error"&&(this.callStatus="idle",this.startIdleAnimation())},3e3);break}},this.toggleCall=async()=>{var A,e;if(this.agentId){if(this.domainBlocked){console.warn("[hanc-widget] Call blocked: widget not allowed on this domain");return}if(await((A=this.soundManager)==null?void 0:A.prewarm()),this.callStatus==="idle"){if((((e=this.widgetConfig)==null?void 0:e.terms_enabled)??!1)&&!_n()){this.showPrivacyModal=!0;return}this.user_identity=ug(),this.callStatus="connecting",await this.callManager.makeCall({agentId:this.agentId,user_identity:this.user_identity})}else this.callStatus==="connected"&&this.callManager.hangUp()}},this.handlePrivacyAccept=async()=>{pn(),this.user_identity=ug(),this.showPrivacyModal=!1,this.callStatus="connecting",await this.callManager.makeCall({agentId:this.agentId,user_identity:this.user_identity})},this.handlePrivacyDecline=()=>{this.showPrivacyModal=!1}}connectedCallback(){if(super.connectedCallback(),this._disconnectTimer!==null){clearTimeout(this._disconnectTimer),this._disconnectTimer=null,this.callManager.addEventListener("status-changed",this.handleStatusChange),this.callManager.addEventListener("audio-track",this.handleAudioTrack),this.callManager.addEventListener("local-audio-track",this.handleLocalAudioTrack),this.callManager.addEventListener("microphone-enabled",this.handleMicrophoneEnabled),this.callManager.addEventListener("microphone-disabled",this.handleMicrophoneDisabled),this.orbRenderer||this.updateComplete.then(()=>this.initializeOrb());return}this.voiceServiceUrl&&(this.callManager.serviceUrl=this.voiceServiceUrl),this.soundManager=new GC({enabled:this.soundEnabled,volume:this.soundVolume,preset:this.soundPreset}),this.callManager.addEventListener("status-changed",this.handleStatusChange),this.callManager.addEventListener("audio-track",this.handleAudioTrack),this.callManager.addEventListener("local-audio-track",this.handleLocalAudioTrack),this.callManager.addEventListener("microphone-enabled",this.handleMicrophoneEnabled),this.callManager.addEventListener("microphone-disabled",this.handleMicrophoneDisabled),this.loadWidgetConfig()}async loadWidgetConfig(){if(this.skipFetch){this.widgetConfig={terms_enabled:this.termsEnabled,terms_content:this.termsContent,terms_url:this.termsUrl,privacy_url:this.privacyUrl,theme:this.theme,allow_all_domains:!0,allowed_domains:[]};return}if(!(!this.agentId||this.configLoading)){this.configLoading=!0;try{const A=await MC(this.agentId,this.apiBaseUrl);this.widgetConfig=A,FC(A)||(this.domainBlocked=!0,console.warn("[hanc-widget] Widget is not allowed on this domain")),A.theme&&A.theme!=="default"&&!this.hasAttribute("theme")&&(this.theme=A.theme,this.applyTheme())}catch(A){console.error("[hanc-widget] Failed to load widget config:",A)}finally{this.configLoading=!1}}}disconnectedCallback(){super.disconnectedCallback(),this.callManager.removeEventListener("status-changed",this.handleStatusChange),this.callManager.removeEventListener("audio-track",this.handleAudioTrack),this.callManager.removeEventListener("local-audio-track",this.handleLocalAudioTrack),this.callManager.removeEventListener("microphone-enabled",this.handleMicrophoneEnabled),this.callManager.removeEventListener("microphone-disabled",this.handleMicrophoneDisabled),this._disconnectTimer=setTimeout(()=>{var A;this._disconnectTimer=null,this.isConnected||(this.callManager.hangUp(),this.cleanupOrb(),(A=this.soundManager)==null||A.destroy(),this.soundManager=null)},0)}firstUpdated(){this.applyTheme(),this.initializeOrb()}updated(A){var e,t,g;super.updated(A),A.has("agentId")&&(this.callManager.hangUp(),this.callStatus="idle",this.widgetConfig=null,this.domainBlocked=!1,this.loadWidgetConfig()),A.has("apiBaseUrl")&&this.agentId&&this.loadWidgetConfig(),this.skipFetch&&(A.has("termsEnabled")||A.has("termsContent")||A.has("termsUrl")||A.has("privacyUrl")||A.has("theme"))&&this.loadWidgetConfig(),A.has("voiceServiceUrl")&&this.voiceServiceUrl&&(this.callManager.serviceUrl=this.voiceServiceUrl),A.has("theme")&&this.applyTheme(),A.has("soundEnabled")&&((e=this.soundManager)==null||e.setEnabled(this.soundEnabled)),A.has("soundVolume")&&((t=this.soundManager)==null||t.setVolume(this.soundVolume)),A.has("soundPreset")&&((g=this.soundManager)==null||g.setPreset(this.soundPreset))}applyTheme(){if(this.theme){const A=JI(this.theme);this.orbColors=A.colors,this.glowIntensity=A.glowIntensity,this.idleGlowMultiplier=A.idleGlowMultiplier,this.orbRenderer&&(this.orbRenderer.setColors(this.orbColors),this.orbRenderer.setGlowSettings(this.glowIntensity,this.idleGlowMultiplier))}}initializeOrb(){const A=this.orbContainerRef.value;A&&(this.orbRenderer=new un(A,{size:1,colors:this.orbColors,glowIntensity:this.glowIntensity,idleGlowMultiplier:this.idleGlowMultiplier,morphStrength:this.morphStrength,noiseScale:this.noiseScale,noiseSpeed:this.noiseSpeed,fresnelPower:this.fresnelPower,rotationSpeed:this.rotationSpeed,audioReactivity:this.audioReactivity,audioSmoothing:this.audioSmoothing,idleMorphMultiplier:this.idleMorphMultiplier,colorContrast:this.colorContrast}),this.audioAnalyzer=new fn,this.orbRenderer.start(),this.startIdleAnimation())}cleanupOrb(){var A,e;this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null),(A=this.audioAnalyzer)==null||A.disconnect(),(e=this.orbRenderer)==null||e.destroy(),this.audioAnalyzer=null,this.orbRenderer=null}startIdleAnimation(){this.animationId!==null&&cancelAnimationFrame(this.animationId);const A=()=>{if(this.callStatus!=="idle"||!this.orbRenderer)return;const e=performance.now()/1e3,t=Math.sin(e*.5)*.15+.15,g=Math.sin(e*.7+1)*.12+.12,I=Math.sin(e*.9+2)*.08+.08,C=(t+g+I)/3;this.orbRenderer.setSimulatedAudio(t,g,I,C),this.animationId=requestAnimationFrame(A)};this.animationId=requestAnimationFrame(A)}startRealAudioLoop(){this.animationId!==null&&cancelAnimationFrame(this.animationId);const A=()=>{var t;if(this.callStatus!=="connected"||!this.orbRenderer)return;const e=(t=this.audioAnalyzer)==null?void 0:t.getAudioData();e&&this.orbRenderer.updateAudio(e),this.animationId=requestAnimationFrame(A)};this.animationId=requestAnimationFrame(A)}getButtonIcon(){return this.callStatus==="connecting"?pA`
5314
+ `,HA([V({type:String,attribute:"agent-id"})],G.InlineCall.prototype,"agentId",2),HA([V({type:String,attribute:"voice-service-url"})],G.InlineCall.prototype,"voiceServiceUrl",2),HA([vA()],G.InlineCall.prototype,"callStatus",2),HA([vA()],G.InlineCall.prototype,"microphoneEnabled",2),HA([vA()],G.InlineCall.prototype,"microphoneInitialized",2),HA([vA()],G.InlineCall.prototype,"showPrivacyModal",2),HA([vA()],G.InlineCall.prototype,"widgetConfig",2),HA([vA()],G.InlineCall.prototype,"configLoading",2),HA([vA()],G.InlineCall.prototype,"formVisible",2),HA([vA()],G.InlineCall.prototype,"formRequestId",2),HA([vA()],G.InlineCall.prototype,"formFields",2),HA([vA()],G.InlineCall.prototype,"domainBlocked",2),HA([vA()],G.InlineCall.prototype,"errorKind",2),HA([V({type:String,attribute:"privacy-url"})],G.InlineCall.prototype,"privacyUrl",2),HA([V({type:String,attribute:"terms-url"})],G.InlineCall.prototype,"termsUrl",2),HA([V({type:Boolean,attribute:"terms-enabled"})],G.InlineCall.prototype,"termsEnabled",2),HA([V({type:String,attribute:"terms-content"})],G.InlineCall.prototype,"termsContent",2),HA([V({type:Boolean,attribute:"skip-fetch"})],G.InlineCall.prototype,"skipFetch",2),HA([V({type:Boolean,attribute:"hide-branding"})],G.InlineCall.prototype,"hideBranding",2),HA([V({type:String,attribute:"api-base-url"})],G.InlineCall.prototype,"apiBaseUrl",2),HA([V({type:String,attribute:"button-start-text"})],G.InlineCall.prototype,"buttonStartText",2),HA([V({type:String,attribute:"button-connecting-text"})],G.InlineCall.prototype,"buttonConnectingText",2),HA([V({type:Number,attribute:"size"})],G.InlineCall.prototype,"size",2),HA([V({type:Number,attribute:"container-padding"})],G.InlineCall.prototype,"containerPadding",2),HA([V({type:String,attribute:"theme",reflect:!0})],G.InlineCall.prototype,"theme",2),HA([V({type:Object,attribute:"orb-colors"})],G.InlineCall.prototype,"orbColors",2),HA([V({type:Number,attribute:"glow-intensity"})],G.InlineCall.prototype,"glowIntensity",2),HA([V({type:Number,attribute:"idle-glow-multiplier"})],G.InlineCall.prototype,"idleGlowMultiplier",2),HA([V({type:Number,attribute:"morph-strength"})],G.InlineCall.prototype,"morphStrength",2),HA([V({type:Number,attribute:"noise-scale"})],G.InlineCall.prototype,"noiseScale",2),HA([V({type:Number,attribute:"noise-speed"})],G.InlineCall.prototype,"noiseSpeed",2),HA([V({type:Number,attribute:"fresnel-power"})],G.InlineCall.prototype,"fresnelPower",2),HA([V({type:Number,attribute:"rotation-speed"})],G.InlineCall.prototype,"rotationSpeed",2),HA([V({type:Number,attribute:"audio-reactivity"})],G.InlineCall.prototype,"audioReactivity",2),HA([V({type:Number,attribute:"audio-smoothing"})],G.InlineCall.prototype,"audioSmoothing",2),HA([V({type:Number,attribute:"idle-morph-multiplier"})],G.InlineCall.prototype,"idleMorphMultiplier",2),HA([V({type:Number,attribute:"color-contrast"})],G.InlineCall.prototype,"colorContrast",2),HA([V({type:Boolean,attribute:"sound-enabled"})],G.InlineCall.prototype,"soundEnabled",2),HA([V({type:Number,attribute:"sound-volume"})],G.InlineCall.prototype,"soundVolume",2),HA([V({type:String,attribute:"sound-preset"})],G.InlineCall.prototype,"soundPreset",2),G.InlineCall=HA([mg("hanc-ai-inline-call")],G.InlineCall);var iy=Object.defineProperty,gy=Object.getOwnPropertyDescriptor,ee=(i,A,e,t)=>{for(var g=t>1?void 0:t?gy(A,e):A,I=i.length-1,C;I>=0;I--)(C=i[I])&&(g=(t?C(A,e,g):C(g))||g);return t&&g&&iy(A,e,g),g};G.FloatingCall=class extends Kt{constructor(){super(...arguments),this.callManager=new Fg,this.orbRenderer=null,this.audioAnalyzer=null,this.soundManager=null,this.orbContainerRef=eo(),this.animationId=null,this.user_identity=wn(),this._disconnectTimer=null,this.callStatus="idle",this.microphoneEnabled=!1,this.microphoneInitialized=!1,this.showPrivacyModal=!1,this.widgetConfig=null,this.configLoading=!1,this.domainBlocked=!1,this.privacyUrl="https://hanc.ai/privacy",this.termsUrl="https://hanc.ai/terms",this.termsEnabled=!1,this.termsContent="",this.skipFetch=!1,this.apiBaseUrl=ui,this.buttonStartText="Call",this.buttonConnectingText="Connecting...",this.position="bottom-right",this.size=120,this.theme="default",this.orbColors={},this.glowIntensity=.8,this.idleGlowMultiplier=.4,this.morphStrength=1,this.noiseScale=1.5,this.noiseSpeed=.3,this.fresnelPower=2.5,this.rotationSpeed=.1,this.audioReactivity=3,this.audioSmoothing=.9,this.idleMorphMultiplier=.25,this.colorContrast=1.5,this.soundEnabled=!0,this.soundVolume=.25,this.soundPreset="1",this.handleAudioTrack=async A=>{const t=A.detail;if(!(!t||!this.audioAnalyzer))try{const g=new MediaStream([t]);await this.audioAnalyzer.connectStream(g)}catch(g){console.error("Failed to connect audio stream:",g)}},this.handleLocalAudioTrack=async A=>{const t=A.detail;if(!(!t||!this.audioAnalyzer))try{const g=new MediaStream([t]);await this.audioAnalyzer.connectLocalStream(g)}catch(g){console.error("Failed to connect local audio stream:",g)}},this.handleMicrophoneEnabled=()=>{this.microphoneEnabled=!0,this.microphoneInitialized=!0},this.handleMicrophoneDisabled=()=>{this.microphoneEnabled=!1,this.microphoneInitialized=!0},this.handleStatusChange=A=>{var t,g,I,C,o;switch(A.detail){case"connecting":this.callStatus="connecting";break;case"connected":this.callStatus="connected",(t=this.orbRenderer)==null||t.setActive(!0),this.startRealAudioLoop(),setTimeout(()=>{var n;(n=this.soundManager)==null||n.playCallStartSound()},300),this.dispatchEvent(new Event("call-start",{bubbles:!0,composed:!0}));break;case"disconnected":this.callStatus="idle",this.microphoneInitialized=!1,(g=this.orbRenderer)==null||g.setActive(!1),(I=this.audioAnalyzer)==null||I.disconnect(),this.startIdleAnimation(),setTimeout(()=>{var n;(n=this.soundManager)==null||n.playCallEndSound()},150),this.dispatchEvent(new Event("call-end",{bubbles:!0,composed:!0}));break;case"error":this.callStatus="error",(C=this.orbRenderer)==null||C.setActive(!1),(o=this.audioAnalyzer)==null||o.disconnect(),setTimeout(()=>{this.callStatus==="error"&&(this.callStatus="idle",this.startIdleAnimation())},3e3);break}},this.toggleCall=async()=>{var A,e;if(this.agentId){if(this.domainBlocked){console.warn("[hanc-widget] Call blocked: widget not allowed on this domain");return}if(await((A=this.soundManager)==null?void 0:A.prewarm()),this.callStatus==="idle"){if((((e=this.widgetConfig)==null?void 0:e.terms_enabled)??!1)&&!_n()){this.showPrivacyModal=!0;return}this.user_identity=ug(),this.callStatus="connecting",await this.callManager.makeCall({agentId:this.agentId,user_identity:this.user_identity})}else this.callStatus==="connected"&&this.callManager.hangUp()}},this.handlePrivacyAccept=async()=>{pn(),this.user_identity=ug(),this.showPrivacyModal=!1,this.callStatus="connecting",await this.callManager.makeCall({agentId:this.agentId,user_identity:this.user_identity})},this.handlePrivacyDecline=()=>{this.showPrivacyModal=!1}}connectedCallback(){if(super.connectedCallback(),this._disconnectTimer!==null){clearTimeout(this._disconnectTimer),this._disconnectTimer=null,this.callManager.addEventListener("status-changed",this.handleStatusChange),this.callManager.addEventListener("audio-track",this.handleAudioTrack),this.callManager.addEventListener("local-audio-track",this.handleLocalAudioTrack),this.callManager.addEventListener("microphone-enabled",this.handleMicrophoneEnabled),this.callManager.addEventListener("microphone-disabled",this.handleMicrophoneDisabled),this.orbRenderer||this.updateComplete.then(()=>this.initializeOrb());return}this.voiceServiceUrl&&(this.callManager.serviceUrl=this.voiceServiceUrl),this.soundManager=new GC({enabled:this.soundEnabled,volume:this.soundVolume,preset:this.soundPreset}),this.callManager.addEventListener("status-changed",this.handleStatusChange),this.callManager.addEventListener("audio-track",this.handleAudioTrack),this.callManager.addEventListener("local-audio-track",this.handleLocalAudioTrack),this.callManager.addEventListener("microphone-enabled",this.handleMicrophoneEnabled),this.callManager.addEventListener("microphone-disabled",this.handleMicrophoneDisabled),this.loadWidgetConfig()}async loadWidgetConfig(){if(this.skipFetch){this.widgetConfig={terms_enabled:this.termsEnabled,terms_content:this.termsContent,terms_url:this.termsUrl,privacy_url:this.privacyUrl,theme:this.theme,allow_all_domains:!0,allowed_domains:[]};return}if(!(!this.agentId||this.configLoading)){this.configLoading=!0;try{const A=await MC(this.agentId,this.apiBaseUrl);this.widgetConfig=A,FC(A)||(this.domainBlocked=!0,console.warn("[hanc-widget] Widget is not allowed on this domain")),A.theme&&A.theme!=="default"&&!this.hasAttribute("theme")&&(this.theme=A.theme,this.applyTheme())}catch(A){console.error("[hanc-widget] Failed to load widget config:",A)}finally{this.configLoading=!1}}}disconnectedCallback(){super.disconnectedCallback(),this.callManager.removeEventListener("status-changed",this.handleStatusChange),this.callManager.removeEventListener("audio-track",this.handleAudioTrack),this.callManager.removeEventListener("local-audio-track",this.handleLocalAudioTrack),this.callManager.removeEventListener("microphone-enabled",this.handleMicrophoneEnabled),this.callManager.removeEventListener("microphone-disabled",this.handleMicrophoneDisabled),this._disconnectTimer=setTimeout(()=>{var A;this._disconnectTimer=null,this.isConnected||(this.callManager.hangUp(),this.cleanupOrb(),(A=this.soundManager)==null||A.destroy(),this.soundManager=null)},0)}firstUpdated(){this.applyTheme(),this.initializeOrb()}updated(A){var e,t,g;super.updated(A),A.has("agentId")&&(this.callManager.hangUp(),this.callStatus="idle",this.widgetConfig=null,this.domainBlocked=!1,this.loadWidgetConfig()),A.has("apiBaseUrl")&&this.agentId&&this.loadWidgetConfig(),this.skipFetch&&(A.has("termsEnabled")||A.has("termsContent")||A.has("termsUrl")||A.has("privacyUrl")||A.has("theme"))&&this.loadWidgetConfig(),A.has("voiceServiceUrl")&&this.voiceServiceUrl&&(this.callManager.serviceUrl=this.voiceServiceUrl),A.has("theme")&&this.applyTheme(),A.has("soundEnabled")&&((e=this.soundManager)==null||e.setEnabled(this.soundEnabled)),A.has("soundVolume")&&((t=this.soundManager)==null||t.setVolume(this.soundVolume)),A.has("soundPreset")&&((g=this.soundManager)==null||g.setPreset(this.soundPreset))}applyTheme(){if(this.theme){const A=JI(this.theme);this.orbColors=A.colors,this.glowIntensity=A.glowIntensity,this.idleGlowMultiplier=A.idleGlowMultiplier,this.orbRenderer&&(this.orbRenderer.setColors(this.orbColors),this.orbRenderer.setGlowSettings(this.glowIntensity,this.idleGlowMultiplier))}}initializeOrb(){const A=this.orbContainerRef.value;A&&(this.orbRenderer=new un(A,{size:1,colors:this.orbColors,glowIntensity:this.glowIntensity,idleGlowMultiplier:this.idleGlowMultiplier,morphStrength:this.morphStrength,noiseScale:this.noiseScale,noiseSpeed:this.noiseSpeed,fresnelPower:this.fresnelPower,rotationSpeed:this.rotationSpeed,audioReactivity:this.audioReactivity,audioSmoothing:this.audioSmoothing,idleMorphMultiplier:this.idleMorphMultiplier,colorContrast:this.colorContrast}),this.audioAnalyzer=new fn,this.orbRenderer.start(),this.startIdleAnimation())}cleanupOrb(){var A,e;this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null),(A=this.audioAnalyzer)==null||A.disconnect(),(e=this.orbRenderer)==null||e.destroy(),this.audioAnalyzer=null,this.orbRenderer=null}startIdleAnimation(){this.animationId!==null&&cancelAnimationFrame(this.animationId);const A=()=>{if(this.callStatus!=="idle"||!this.orbRenderer)return;const e=performance.now()/1e3,t=Math.sin(e*.5)*.15+.15,g=Math.sin(e*.7+1)*.12+.12,I=Math.sin(e*.9+2)*.08+.08,C=(t+g+I)/3;this.orbRenderer.setSimulatedAudio(t,g,I,C),this.animationId=requestAnimationFrame(A)};this.animationId=requestAnimationFrame(A)}startRealAudioLoop(){this.animationId!==null&&cancelAnimationFrame(this.animationId);const A=()=>{var t;if(this.callStatus!=="connected"||!this.orbRenderer)return;const e=(t=this.audioAnalyzer)==null?void 0:t.getAudioData();e&&this.orbRenderer.updateAudio(e),this.animationId=requestAnimationFrame(A)};this.animationId=requestAnimationFrame(A)}getButtonIcon(){return this.callStatus==="connecting"?_A`
5313
5315
  <svg width="16" height="16" viewBox="0 0 16 16" fill="none" class="hanc-spinner">
5314
5316
  <circle
5315
5317
  cx="8"
@@ -5321,7 +5323,7 @@ void main() {
5321
5323
  stroke-linecap="round"
5322
5324
  />
5323
5325
  </svg>
5324
- `:this.callStatus==="connected"?pA`
5326
+ `:this.callStatus==="connected"?_A`
5325
5327
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none">
5326
5328
  <path
5327
5329
  d="M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91"
@@ -5340,7 +5342,7 @@ void main() {
5340
5342
  stroke-linecap="round"
5341
5343
  />
5342
5344
  </svg>
5343
- `:pA`
5345
+ `:_A`
5344
5346
  <svg width="16" height="18" viewBox="0 0 328 369" fill="none">
5345
5347
  <rect
5346
5348
  x="110.323"
@@ -5373,7 +5375,7 @@ void main() {
5373
5375
  fill="white"
5374
5376
  />
5375
5377
  </svg>
5376
- `}get buttonText(){switch(this.callStatus){case"connecting":return this.buttonConnectingText;case"error":return"Error";default:return this.buttonStartText}}render(){var A,e,t;return pA`
5378
+ `}get buttonText(){switch(this.callStatus){case"connecting":return this.buttonConnectingText;case"error":return"Error";default:return this.buttonStartText}}render(){var A,e,t;return _A`
5377
5379
  <style>
5378
5380
  .container {
5379
5381
  position: ${this.position==="static"?"relative":"fixed"};
@@ -5553,7 +5555,7 @@ void main() {
5553
5555
  @click=${this.toggleCall}
5554
5556
  ${to(this.orbContainerRef)}
5555
5557
  >
5556
- ${this.callStatus==="connected"&&this.microphoneInitialized&&!this.microphoneEnabled?pA`
5558
+ ${this.callStatus==="connected"&&this.microphoneInitialized&&!this.microphoneEnabled?_A`
5557
5559
  <div class="microphone-indicator visible">
5558
5560
  <svg viewBox="0 0 24 24" fill="none">
5559
5561
  <path
@@ -5592,7 +5594,7 @@ void main() {
5592
5594
  </div>
5593
5595
  </div>
5594
5596
 
5595
- ${this.showPrivacyModal?pA`
5597
+ ${this.showPrivacyModal?_A`
5596
5598
  <hanc-privacy-modal
5597
5599
  privacy-url=${((A=this.widgetConfig)==null?void 0:A.privacy_url)||this.privacyUrl}
5598
5600
  terms-url=${((e=this.widgetConfig)==null?void 0:e.terms_url)||this.termsUrl}
@@ -5605,7 +5607,7 @@ void main() {
5605
5607
  :host {
5606
5608
  display: block;
5607
5609
  }
5608
- `,ee([V({type:String,attribute:"agent-id"})],G.FloatingCall.prototype,"agentId",2),ee([V({type:String,attribute:"voice-service-url"})],G.FloatingCall.prototype,"voiceServiceUrl",2),ee([vA()],G.FloatingCall.prototype,"callStatus",2),ee([vA()],G.FloatingCall.prototype,"microphoneEnabled",2),ee([vA()],G.FloatingCall.prototype,"microphoneInitialized",2),ee([vA()],G.FloatingCall.prototype,"showPrivacyModal",2),ee([vA()],G.FloatingCall.prototype,"widgetConfig",2),ee([vA()],G.FloatingCall.prototype,"configLoading",2),ee([vA()],G.FloatingCall.prototype,"domainBlocked",2),ee([V({type:String,attribute:"privacy-url"})],G.FloatingCall.prototype,"privacyUrl",2),ee([V({type:String,attribute:"terms-url"})],G.FloatingCall.prototype,"termsUrl",2),ee([V({type:Boolean,attribute:"terms-enabled"})],G.FloatingCall.prototype,"termsEnabled",2),ee([V({type:String,attribute:"terms-content"})],G.FloatingCall.prototype,"termsContent",2),ee([V({type:Boolean,attribute:"skip-fetch"})],G.FloatingCall.prototype,"skipFetch",2),ee([V({type:String,attribute:"api-base-url"})],G.FloatingCall.prototype,"apiBaseUrl",2),ee([V({type:String,attribute:"button-start-text"})],G.FloatingCall.prototype,"buttonStartText",2),ee([V({type:String,attribute:"button-connecting-text"})],G.FloatingCall.prototype,"buttonConnectingText",2),ee([V({type:String,attribute:"position"})],G.FloatingCall.prototype,"position",2),ee([V({type:Number,attribute:"size"})],G.FloatingCall.prototype,"size",2),ee([V({type:String,attribute:"theme"})],G.FloatingCall.prototype,"theme",2),ee([V({type:Object,attribute:"orb-colors"})],G.FloatingCall.prototype,"orbColors",2),ee([V({type:Number,attribute:"glow-intensity"})],G.FloatingCall.prototype,"glowIntensity",2),ee([V({type:Number,attribute:"idle-glow-multiplier"})],G.FloatingCall.prototype,"idleGlowMultiplier",2),ee([V({type:Number,attribute:"morph-strength"})],G.FloatingCall.prototype,"morphStrength",2),ee([V({type:Number,attribute:"noise-scale"})],G.FloatingCall.prototype,"noiseScale",2),ee([V({type:Number,attribute:"noise-speed"})],G.FloatingCall.prototype,"noiseSpeed",2),ee([V({type:Number,attribute:"fresnel-power"})],G.FloatingCall.prototype,"fresnelPower",2),ee([V({type:Number,attribute:"rotation-speed"})],G.FloatingCall.prototype,"rotationSpeed",2),ee([V({type:Number,attribute:"audio-reactivity"})],G.FloatingCall.prototype,"audioReactivity",2),ee([V({type:Number,attribute:"audio-smoothing"})],G.FloatingCall.prototype,"audioSmoothing",2),ee([V({type:Number,attribute:"idle-morph-multiplier"})],G.FloatingCall.prototype,"idleMorphMultiplier",2),ee([V({type:Number,attribute:"color-contrast"})],G.FloatingCall.prototype,"colorContrast",2),ee([V({type:Boolean,attribute:"sound-enabled"})],G.FloatingCall.prototype,"soundEnabled",2),ee([V({type:Number,attribute:"sound-volume"})],G.FloatingCall.prototype,"soundVolume",2),ee([V({type:String,attribute:"sound-preset"})],G.FloatingCall.prototype,"soundPreset",2),G.FloatingCall=ee([mg("hanc-ai-floating-call")],G.FloatingCall);var Iy=Object.defineProperty,Cy=Object.getOwnPropertyDescriptor,te=(i,A,e,t)=>{for(var g=t>1?void 0:t?Cy(A,e):A,I=i.length-1,C;I>=0;I--)(C=i[I])&&(g=(t?C(A,e,g):C(g))||g);return t&&g&&Iy(A,e,g),g};G.PillCall=class extends Kt{constructor(){super(...arguments),this.callManager=new Fg,this.orbRenderer=null,this.audioAnalyzer=null,this.soundManager=null,this.orbContainerRef=eo(),this.animationId=null,this.user_identity=wn(),this.callStatus="idle",this.microphoneEnabled=!1,this.microphoneInitialized=!1,this.showPrivacyModal=!1,this.widgetConfig=null,this.configLoading=!1,this.domainBlocked=!1,this.privacyUrl="https://hanc.ai/privacy",this.termsUrl="https://hanc.ai/terms",this.termsEnabled=!1,this.termsContent="",this.skipFetch=!1,this.apiBaseUrl=ui,this.buttonStartText="Talk to AI Agent",this.buttonConnectingText="Connecting...",this.buttonEndText="End call",this.orbSize=48,this.theme="default",this.orbColors={},this.glowIntensity=.8,this.idleGlowMultiplier=.4,this.morphStrength=1,this.noiseScale=1.5,this.noiseSpeed=.3,this.fresnelPower=2.5,this.rotationSpeed=.1,this.audioReactivity=3,this.audioSmoothing=.9,this.idleMorphMultiplier=.25,this.colorContrast=1.5,this.soundEnabled=!0,this.soundVolume=.25,this.soundPreset="1",this.handleAudioTrack=async A=>{const t=A.detail;if(!(!t||!this.audioAnalyzer))try{const g=new MediaStream([t]);await this.audioAnalyzer.connectStream(g)}catch(g){console.error("Failed to connect audio stream:",g)}},this.handleLocalAudioTrack=async A=>{const t=A.detail;if(!(!t||!this.audioAnalyzer))try{const g=new MediaStream([t]);await this.audioAnalyzer.connectLocalStream(g)}catch(g){console.error("Failed to connect local audio stream:",g)}},this.handleMicrophoneEnabled=()=>{this.microphoneEnabled=!0,this.microphoneInitialized=!0},this.handleMicrophoneDisabled=()=>{this.microphoneEnabled=!1,this.microphoneInitialized=!0},this.handleStatusChange=A=>{var t,g,I,C,o;switch(A.detail){case"connecting":this.callStatus="connecting";break;case"connected":this.callStatus="connected",(t=this.orbRenderer)==null||t.setActive(!0),this.startRealAudioLoop(),setTimeout(()=>{var n;(n=this.soundManager)==null||n.playCallStartSound()},300),this.dispatchEvent(new Event("call-start",{bubbles:!0,composed:!0}));break;case"disconnected":this.callStatus="idle",this.microphoneInitialized=!1,(g=this.orbRenderer)==null||g.setActive(!1),(I=this.audioAnalyzer)==null||I.disconnect(),this.startIdleAnimation(),setTimeout(()=>{var n;(n=this.soundManager)==null||n.playCallEndSound()},150),this.dispatchEvent(new Event("call-end",{bubbles:!0,composed:!0}));break;case"error":this.callStatus="error",(C=this.orbRenderer)==null||C.setActive(!1),(o=this.audioAnalyzer)==null||o.disconnect(),setTimeout(()=>{this.callStatus==="error"&&(this.callStatus="idle",this.startIdleAnimation())},3e3);break}},this.toggleCall=async()=>{var A,e;if(this.agentId){if(this.domainBlocked){console.warn("[hanc-widget] Call blocked: widget not allowed on this domain");return}if(await((A=this.soundManager)==null?void 0:A.prewarm()),this.callStatus==="idle"){if((((e=this.widgetConfig)==null?void 0:e.terms_enabled)??!1)&&!_n()){this.showPrivacyModal=!0;return}this.user_identity=ug(),this.callStatus="connecting",await this.callManager.makeCall({agentId:this.agentId,user_identity:this.user_identity})}else this.callStatus==="connected"&&this.callManager.hangUp()}},this.handlePrivacyAccept=async()=>{pn(),this.user_identity=ug(),this.showPrivacyModal=!1,this.callStatus="connecting",await this.callManager.makeCall({agentId:this.agentId,user_identity:this.user_identity})},this.handlePrivacyDecline=()=>{this.showPrivacyModal=!1}}connectedCallback(){super.connectedCallback(),this.voiceServiceUrl&&(this.callManager.serviceUrl=this.voiceServiceUrl),this.soundManager=new GC({enabled:this.soundEnabled,volume:this.soundVolume,preset:this.soundPreset}),this.callManager.addEventListener("status-changed",this.handleStatusChange),this.callManager.addEventListener("audio-track",this.handleAudioTrack),this.callManager.addEventListener("local-audio-track",this.handleLocalAudioTrack),this.callManager.addEventListener("microphone-enabled",this.handleMicrophoneEnabled),this.callManager.addEventListener("microphone-disabled",this.handleMicrophoneDisabled),this.loadWidgetConfig()}async loadWidgetConfig(){if(this.skipFetch){this.widgetConfig={terms_enabled:this.termsEnabled,terms_content:this.termsContent,terms_url:this.termsUrl,privacy_url:this.privacyUrl,theme:this.theme,allow_all_domains:!0,allowed_domains:[]};return}if(!(!this.agentId||this.configLoading)){this.configLoading=!0;try{const A=await MC(this.agentId,this.apiBaseUrl);this.widgetConfig=A,FC(A)||(this.domainBlocked=!0,console.warn("[hanc-widget] Widget is not allowed on this domain")),A.theme&&A.theme!=="default"&&!this.hasAttribute("theme")&&(this.theme=A.theme,this.applyTheme())}catch(A){console.error("[hanc-widget] Failed to load widget config:",A)}finally{this.configLoading=!1}}}disconnectedCallback(){var A;super.disconnectedCallback(),this.callManager.removeEventListener("status-changed",this.handleStatusChange),this.callManager.removeEventListener("audio-track",this.handleAudioTrack),this.callManager.removeEventListener("local-audio-track",this.handleLocalAudioTrack),this.callManager.removeEventListener("microphone-enabled",this.handleMicrophoneEnabled),this.callManager.removeEventListener("microphone-disabled",this.handleMicrophoneDisabled),this.callManager.hangUp(),this.cleanupOrb(),(A=this.soundManager)==null||A.destroy(),this.soundManager=null}firstUpdated(){this.applyTheme(),this.initializeOrb()}updated(A){var e,t,g;super.updated(A),A.has("agentId")&&(this.callManager.hangUp(),this.callStatus="idle",this.widgetConfig=null,this.domainBlocked=!1,this.loadWidgetConfig()),A.has("apiBaseUrl")&&this.agentId&&this.loadWidgetConfig(),this.skipFetch&&(A.has("termsEnabled")||A.has("termsContent")||A.has("termsUrl")||A.has("privacyUrl")||A.has("theme"))&&this.loadWidgetConfig(),A.has("voiceServiceUrl")&&this.voiceServiceUrl&&(this.callManager.serviceUrl=this.voiceServiceUrl),A.has("theme")&&this.applyTheme(),A.has("soundEnabled")&&((e=this.soundManager)==null||e.setEnabled(this.soundEnabled)),A.has("soundVolume")&&((t=this.soundManager)==null||t.setVolume(this.soundVolume)),A.has("soundPreset")&&((g=this.soundManager)==null||g.setPreset(this.soundPreset))}applyTheme(){if(this.theme){const A=JI(this.theme);this.orbColors=A.colors,this.glowIntensity=A.glowIntensity,this.idleGlowMultiplier=A.idleGlowMultiplier,this.orbRenderer&&(this.orbRenderer.setColors(this.orbColors),this.orbRenderer.setGlowSettings(this.glowIntensity,this.idleGlowMultiplier))}}initializeOrb(){const A=this.orbContainerRef.value;A&&(this.orbRenderer=new un(A,{size:1,colors:this.orbColors,glowIntensity:this.glowIntensity,idleGlowMultiplier:this.idleGlowMultiplier,morphStrength:this.morphStrength,noiseScale:this.noiseScale,noiseSpeed:this.noiseSpeed,fresnelPower:this.fresnelPower,rotationSpeed:this.rotationSpeed,audioReactivity:this.audioReactivity,audioSmoothing:this.audioSmoothing,idleMorphMultiplier:this.idleMorphMultiplier,colorContrast:this.colorContrast}),this.audioAnalyzer=new fn,this.orbRenderer.start(),this.startIdleAnimation())}cleanupOrb(){var A,e;this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null),(A=this.audioAnalyzer)==null||A.disconnect(),(e=this.orbRenderer)==null||e.destroy(),this.audioAnalyzer=null,this.orbRenderer=null}startIdleAnimation(){this.animationId!==null&&cancelAnimationFrame(this.animationId);const A=()=>{if(this.callStatus!=="idle"||!this.orbRenderer)return;const e=performance.now()/1e3,t=Math.sin(e*.5)*.15+.15,g=Math.sin(e*.7+1)*.12+.12,I=Math.sin(e*.9+2)*.08+.08,C=(t+g+I)/3;this.orbRenderer.setSimulatedAudio(t,g,I,C),this.animationId=requestAnimationFrame(A)};this.animationId=requestAnimationFrame(A)}startRealAudioLoop(){this.animationId!==null&&cancelAnimationFrame(this.animationId);const A=()=>{var t;if(this.callStatus!=="connected"||!this.orbRenderer)return;const e=(t=this.audioAnalyzer)==null?void 0:t.getAudioData();e&&this.orbRenderer.updateAudio(e),this.animationId=requestAnimationFrame(A)};this.animationId=requestAnimationFrame(A)}getButtonIcon(){return this.callStatus==="connecting"?pA`
5610
+ `,ee([V({type:String,attribute:"agent-id"})],G.FloatingCall.prototype,"agentId",2),ee([V({type:String,attribute:"voice-service-url"})],G.FloatingCall.prototype,"voiceServiceUrl",2),ee([vA()],G.FloatingCall.prototype,"callStatus",2),ee([vA()],G.FloatingCall.prototype,"microphoneEnabled",2),ee([vA()],G.FloatingCall.prototype,"microphoneInitialized",2),ee([vA()],G.FloatingCall.prototype,"showPrivacyModal",2),ee([vA()],G.FloatingCall.prototype,"widgetConfig",2),ee([vA()],G.FloatingCall.prototype,"configLoading",2),ee([vA()],G.FloatingCall.prototype,"domainBlocked",2),ee([V({type:String,attribute:"privacy-url"})],G.FloatingCall.prototype,"privacyUrl",2),ee([V({type:String,attribute:"terms-url"})],G.FloatingCall.prototype,"termsUrl",2),ee([V({type:Boolean,attribute:"terms-enabled"})],G.FloatingCall.prototype,"termsEnabled",2),ee([V({type:String,attribute:"terms-content"})],G.FloatingCall.prototype,"termsContent",2),ee([V({type:Boolean,attribute:"skip-fetch"})],G.FloatingCall.prototype,"skipFetch",2),ee([V({type:String,attribute:"api-base-url"})],G.FloatingCall.prototype,"apiBaseUrl",2),ee([V({type:String,attribute:"button-start-text"})],G.FloatingCall.prototype,"buttonStartText",2),ee([V({type:String,attribute:"button-connecting-text"})],G.FloatingCall.prototype,"buttonConnectingText",2),ee([V({type:String,attribute:"position"})],G.FloatingCall.prototype,"position",2),ee([V({type:Number,attribute:"size"})],G.FloatingCall.prototype,"size",2),ee([V({type:String,attribute:"theme"})],G.FloatingCall.prototype,"theme",2),ee([V({type:Object,attribute:"orb-colors"})],G.FloatingCall.prototype,"orbColors",2),ee([V({type:Number,attribute:"glow-intensity"})],G.FloatingCall.prototype,"glowIntensity",2),ee([V({type:Number,attribute:"idle-glow-multiplier"})],G.FloatingCall.prototype,"idleGlowMultiplier",2),ee([V({type:Number,attribute:"morph-strength"})],G.FloatingCall.prototype,"morphStrength",2),ee([V({type:Number,attribute:"noise-scale"})],G.FloatingCall.prototype,"noiseScale",2),ee([V({type:Number,attribute:"noise-speed"})],G.FloatingCall.prototype,"noiseSpeed",2),ee([V({type:Number,attribute:"fresnel-power"})],G.FloatingCall.prototype,"fresnelPower",2),ee([V({type:Number,attribute:"rotation-speed"})],G.FloatingCall.prototype,"rotationSpeed",2),ee([V({type:Number,attribute:"audio-reactivity"})],G.FloatingCall.prototype,"audioReactivity",2),ee([V({type:Number,attribute:"audio-smoothing"})],G.FloatingCall.prototype,"audioSmoothing",2),ee([V({type:Number,attribute:"idle-morph-multiplier"})],G.FloatingCall.prototype,"idleMorphMultiplier",2),ee([V({type:Number,attribute:"color-contrast"})],G.FloatingCall.prototype,"colorContrast",2),ee([V({type:Boolean,attribute:"sound-enabled"})],G.FloatingCall.prototype,"soundEnabled",2),ee([V({type:Number,attribute:"sound-volume"})],G.FloatingCall.prototype,"soundVolume",2),ee([V({type:String,attribute:"sound-preset"})],G.FloatingCall.prototype,"soundPreset",2),G.FloatingCall=ee([mg("hanc-ai-floating-call")],G.FloatingCall);var Iy=Object.defineProperty,Cy=Object.getOwnPropertyDescriptor,te=(i,A,e,t)=>{for(var g=t>1?void 0:t?Cy(A,e):A,I=i.length-1,C;I>=0;I--)(C=i[I])&&(g=(t?C(A,e,g):C(g))||g);return t&&g&&Iy(A,e,g),g};G.PillCall=class extends Kt{constructor(){super(...arguments),this.callManager=new Fg,this.orbRenderer=null,this.audioAnalyzer=null,this.soundManager=null,this.orbContainerRef=eo(),this.animationId=null,this.user_identity=wn(),this.callStatus="idle",this.microphoneEnabled=!1,this.microphoneInitialized=!1,this.showPrivacyModal=!1,this.widgetConfig=null,this.configLoading=!1,this.domainBlocked=!1,this.privacyUrl="https://hanc.ai/privacy",this.termsUrl="https://hanc.ai/terms",this.termsEnabled=!1,this.termsContent="",this.skipFetch=!1,this.apiBaseUrl=ui,this.buttonStartText="Talk to AI Agent",this.buttonConnectingText="Connecting...",this.buttonEndText="End call",this.orbSize=48,this.theme="default",this.orbColors={},this.glowIntensity=.8,this.idleGlowMultiplier=.4,this.morphStrength=1,this.noiseScale=1.5,this.noiseSpeed=.3,this.fresnelPower=2.5,this.rotationSpeed=.1,this.audioReactivity=3,this.audioSmoothing=.9,this.idleMorphMultiplier=.25,this.colorContrast=1.5,this.soundEnabled=!0,this.soundVolume=.25,this.soundPreset="1",this.handleAudioTrack=async A=>{const t=A.detail;if(!(!t||!this.audioAnalyzer))try{const g=new MediaStream([t]);await this.audioAnalyzer.connectStream(g)}catch(g){console.error("Failed to connect audio stream:",g)}},this.handleLocalAudioTrack=async A=>{const t=A.detail;if(!(!t||!this.audioAnalyzer))try{const g=new MediaStream([t]);await this.audioAnalyzer.connectLocalStream(g)}catch(g){console.error("Failed to connect local audio stream:",g)}},this.handleMicrophoneEnabled=()=>{this.microphoneEnabled=!0,this.microphoneInitialized=!0},this.handleMicrophoneDisabled=()=>{this.microphoneEnabled=!1,this.microphoneInitialized=!0},this.handleStatusChange=A=>{var t,g,I,C,o;switch(A.detail){case"connecting":this.callStatus="connecting";break;case"connected":this.callStatus="connected",(t=this.orbRenderer)==null||t.setActive(!0),this.startRealAudioLoop(),setTimeout(()=>{var n;(n=this.soundManager)==null||n.playCallStartSound()},300),this.dispatchEvent(new Event("call-start",{bubbles:!0,composed:!0}));break;case"disconnected":this.callStatus="idle",this.microphoneInitialized=!1,(g=this.orbRenderer)==null||g.setActive(!1),(I=this.audioAnalyzer)==null||I.disconnect(),this.startIdleAnimation(),setTimeout(()=>{var n;(n=this.soundManager)==null||n.playCallEndSound()},150),this.dispatchEvent(new Event("call-end",{bubbles:!0,composed:!0}));break;case"error":this.callStatus="error",(C=this.orbRenderer)==null||C.setActive(!1),(o=this.audioAnalyzer)==null||o.disconnect(),setTimeout(()=>{this.callStatus==="error"&&(this.callStatus="idle",this.startIdleAnimation())},3e3);break}},this.toggleCall=async()=>{var A,e;if(this.agentId){if(this.domainBlocked){console.warn("[hanc-widget] Call blocked: widget not allowed on this domain");return}if(await((A=this.soundManager)==null?void 0:A.prewarm()),this.callStatus==="idle"){if((((e=this.widgetConfig)==null?void 0:e.terms_enabled)??!1)&&!_n()){this.showPrivacyModal=!0;return}this.user_identity=ug(),this.callStatus="connecting",await this.callManager.makeCall({agentId:this.agentId,user_identity:this.user_identity})}else this.callStatus==="connected"&&this.callManager.hangUp()}},this.handlePrivacyAccept=async()=>{pn(),this.user_identity=ug(),this.showPrivacyModal=!1,this.callStatus="connecting",await this.callManager.makeCall({agentId:this.agentId,user_identity:this.user_identity})},this.handlePrivacyDecline=()=>{this.showPrivacyModal=!1}}connectedCallback(){super.connectedCallback(),this.voiceServiceUrl&&(this.callManager.serviceUrl=this.voiceServiceUrl),this.soundManager=new GC({enabled:this.soundEnabled,volume:this.soundVolume,preset:this.soundPreset}),this.callManager.addEventListener("status-changed",this.handleStatusChange),this.callManager.addEventListener("audio-track",this.handleAudioTrack),this.callManager.addEventListener("local-audio-track",this.handleLocalAudioTrack),this.callManager.addEventListener("microphone-enabled",this.handleMicrophoneEnabled),this.callManager.addEventListener("microphone-disabled",this.handleMicrophoneDisabled),this.loadWidgetConfig()}async loadWidgetConfig(){if(this.skipFetch){this.widgetConfig={terms_enabled:this.termsEnabled,terms_content:this.termsContent,terms_url:this.termsUrl,privacy_url:this.privacyUrl,theme:this.theme,allow_all_domains:!0,allowed_domains:[]};return}if(!(!this.agentId||this.configLoading)){this.configLoading=!0;try{const A=await MC(this.agentId,this.apiBaseUrl);this.widgetConfig=A,FC(A)||(this.domainBlocked=!0,console.warn("[hanc-widget] Widget is not allowed on this domain")),A.theme&&A.theme!=="default"&&!this.hasAttribute("theme")&&(this.theme=A.theme,this.applyTheme())}catch(A){console.error("[hanc-widget] Failed to load widget config:",A)}finally{this.configLoading=!1}}}disconnectedCallback(){var A;super.disconnectedCallback(),this.callManager.removeEventListener("status-changed",this.handleStatusChange),this.callManager.removeEventListener("audio-track",this.handleAudioTrack),this.callManager.removeEventListener("local-audio-track",this.handleLocalAudioTrack),this.callManager.removeEventListener("microphone-enabled",this.handleMicrophoneEnabled),this.callManager.removeEventListener("microphone-disabled",this.handleMicrophoneDisabled),this.callManager.hangUp(),this.cleanupOrb(),(A=this.soundManager)==null||A.destroy(),this.soundManager=null}firstUpdated(){this.applyTheme(),this.initializeOrb()}updated(A){var e,t,g;super.updated(A),A.has("agentId")&&(this.callManager.hangUp(),this.callStatus="idle",this.widgetConfig=null,this.domainBlocked=!1,this.loadWidgetConfig()),A.has("apiBaseUrl")&&this.agentId&&this.loadWidgetConfig(),this.skipFetch&&(A.has("termsEnabled")||A.has("termsContent")||A.has("termsUrl")||A.has("privacyUrl")||A.has("theme"))&&this.loadWidgetConfig(),A.has("voiceServiceUrl")&&this.voiceServiceUrl&&(this.callManager.serviceUrl=this.voiceServiceUrl),A.has("theme")&&this.applyTheme(),A.has("soundEnabled")&&((e=this.soundManager)==null||e.setEnabled(this.soundEnabled)),A.has("soundVolume")&&((t=this.soundManager)==null||t.setVolume(this.soundVolume)),A.has("soundPreset")&&((g=this.soundManager)==null||g.setPreset(this.soundPreset))}applyTheme(){if(this.theme){const A=JI(this.theme);this.orbColors=A.colors,this.glowIntensity=A.glowIntensity,this.idleGlowMultiplier=A.idleGlowMultiplier,this.orbRenderer&&(this.orbRenderer.setColors(this.orbColors),this.orbRenderer.setGlowSettings(this.glowIntensity,this.idleGlowMultiplier))}}initializeOrb(){const A=this.orbContainerRef.value;A&&(this.orbRenderer=new un(A,{size:1,colors:this.orbColors,glowIntensity:this.glowIntensity,idleGlowMultiplier:this.idleGlowMultiplier,morphStrength:this.morphStrength,noiseScale:this.noiseScale,noiseSpeed:this.noiseSpeed,fresnelPower:this.fresnelPower,rotationSpeed:this.rotationSpeed,audioReactivity:this.audioReactivity,audioSmoothing:this.audioSmoothing,idleMorphMultiplier:this.idleMorphMultiplier,colorContrast:this.colorContrast}),this.audioAnalyzer=new fn,this.orbRenderer.start(),this.startIdleAnimation())}cleanupOrb(){var A,e;this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null),(A=this.audioAnalyzer)==null||A.disconnect(),(e=this.orbRenderer)==null||e.destroy(),this.audioAnalyzer=null,this.orbRenderer=null}startIdleAnimation(){this.animationId!==null&&cancelAnimationFrame(this.animationId);const A=()=>{if(this.callStatus!=="idle"||!this.orbRenderer)return;const e=performance.now()/1e3,t=Math.sin(e*.5)*.15+.15,g=Math.sin(e*.7+1)*.12+.12,I=Math.sin(e*.9+2)*.08+.08,C=(t+g+I)/3;this.orbRenderer.setSimulatedAudio(t,g,I,C),this.animationId=requestAnimationFrame(A)};this.animationId=requestAnimationFrame(A)}startRealAudioLoop(){this.animationId!==null&&cancelAnimationFrame(this.animationId);const A=()=>{var t;if(this.callStatus!=="connected"||!this.orbRenderer)return;const e=(t=this.audioAnalyzer)==null?void 0:t.getAudioData();e&&this.orbRenderer.updateAudio(e),this.animationId=requestAnimationFrame(A)};this.animationId=requestAnimationFrame(A)}getButtonIcon(){return this.callStatus==="connecting"?_A`
5609
5611
  <svg
5610
5612
  width="16"
5611
5613
  height="16"
@@ -5623,7 +5625,7 @@ void main() {
5623
5625
  stroke-linecap="round"
5624
5626
  />
5625
5627
  </svg>
5626
- `:this.callStatus==="connected"?pA`
5628
+ `:this.callStatus==="connected"?_A`
5627
5629
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none">
5628
5630
  <path
5629
5631
  d="M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91"
@@ -5642,7 +5644,7 @@ void main() {
5642
5644
  stroke-linecap="round"
5643
5645
  />
5644
5646
  </svg>
5645
- `:pA``}get buttonText(){switch(this.callStatus){case"connecting":return this.buttonConnectingText;case"connected":return this.buttonEndText;case"error":return"Error";default:return this.buttonStartText}}render(){var A,e,t;return pA`
5647
+ `:_A``}get buttonText(){switch(this.callStatus){case"connecting":return this.buttonConnectingText;case"connected":return this.buttonEndText;case"error":return"Error";default:return this.buttonStartText}}render(){var A,e,t;return _A`
5646
5648
  <style>
5647
5649
  .pill-container {
5648
5650
  display: inline-flex;
@@ -5788,7 +5790,7 @@ void main() {
5788
5790
  part="orb-container"
5789
5791
  ${to(this.orbContainerRef)}
5790
5792
  ></div>
5791
- ${this.callStatus==="connected"&&this.microphoneInitialized&&!this.microphoneEnabled?pA`
5793
+ ${this.callStatus==="connected"&&this.microphoneInitialized&&!this.microphoneEnabled?_A`
5792
5794
  <div class="microphone-indicator visible">
5793
5795
  <svg viewBox="0 0 24 24" fill="none">
5794
5796
  <path
@@ -5815,10 +5817,10 @@ void main() {
5815
5817
  </div>
5816
5818
  `:""}
5817
5819
  <span class="pill-text">${this.buttonText}</span>
5818
- ${this.callStatus!=="idle"?pA`<span class="icon-wrapper">${this.getButtonIcon()}</span>`:""}
5820
+ ${this.callStatus!=="idle"?_A`<span class="icon-wrapper">${this.getButtonIcon()}</span>`:""}
5819
5821
  </button>
5820
5822
 
5821
- ${this.showPrivacyModal?pA`
5823
+ ${this.showPrivacyModal?_A`
5822
5824
  <hanc-privacy-modal
5823
5825
  privacy-url=${((A=this.widgetConfig)==null?void 0:A.privacy_url)||this.privacyUrl}
5824
5826
  terms-url=${((e=this.widgetConfig)==null?void 0:e.terms_url)||this.termsUrl}
@@ -5832,7 +5834,7 @@ void main() {
5832
5834
  display: inline-block;
5833
5835
  contain: layout style;
5834
5836
  }
5835
- `,te([V({type:String,attribute:"agent-id"})],G.PillCall.prototype,"agentId",2),te([V({type:String,attribute:"voice-service-url"})],G.PillCall.prototype,"voiceServiceUrl",2),te([vA()],G.PillCall.prototype,"callStatus",2),te([vA()],G.PillCall.prototype,"microphoneEnabled",2),te([vA()],G.PillCall.prototype,"microphoneInitialized",2),te([vA()],G.PillCall.prototype,"showPrivacyModal",2),te([vA()],G.PillCall.prototype,"widgetConfig",2),te([vA()],G.PillCall.prototype,"configLoading",2),te([vA()],G.PillCall.prototype,"domainBlocked",2),te([V({type:String,attribute:"privacy-url"})],G.PillCall.prototype,"privacyUrl",2),te([V({type:String,attribute:"terms-url"})],G.PillCall.prototype,"termsUrl",2),te([V({type:Boolean,attribute:"terms-enabled"})],G.PillCall.prototype,"termsEnabled",2),te([V({type:String,attribute:"terms-content"})],G.PillCall.prototype,"termsContent",2),te([V({type:Boolean,attribute:"skip-fetch"})],G.PillCall.prototype,"skipFetch",2),te([V({type:String,attribute:"api-base-url"})],G.PillCall.prototype,"apiBaseUrl",2),te([V({type:String,attribute:"button-start-text"})],G.PillCall.prototype,"buttonStartText",2),te([V({type:String,attribute:"button-connecting-text"})],G.PillCall.prototype,"buttonConnectingText",2),te([V({type:String,attribute:"button-end-text"})],G.PillCall.prototype,"buttonEndText",2),te([V({type:Number,attribute:"orb-size"})],G.PillCall.prototype,"orbSize",2),te([V({type:String,attribute:"theme"})],G.PillCall.prototype,"theme",2),te([V({type:Object,attribute:"orb-colors"})],G.PillCall.prototype,"orbColors",2),te([V({type:Number,attribute:"glow-intensity"})],G.PillCall.prototype,"glowIntensity",2),te([V({type:Number,attribute:"idle-glow-multiplier"})],G.PillCall.prototype,"idleGlowMultiplier",2),te([V({type:Number,attribute:"morph-strength"})],G.PillCall.prototype,"morphStrength",2),te([V({type:Number,attribute:"noise-scale"})],G.PillCall.prototype,"noiseScale",2),te([V({type:Number,attribute:"noise-speed"})],G.PillCall.prototype,"noiseSpeed",2),te([V({type:Number,attribute:"fresnel-power"})],G.PillCall.prototype,"fresnelPower",2),te([V({type:Number,attribute:"rotation-speed"})],G.PillCall.prototype,"rotationSpeed",2),te([V({type:Number,attribute:"audio-reactivity"})],G.PillCall.prototype,"audioReactivity",2),te([V({type:Number,attribute:"audio-smoothing"})],G.PillCall.prototype,"audioSmoothing",2),te([V({type:Number,attribute:"idle-morph-multiplier"})],G.PillCall.prototype,"idleMorphMultiplier",2),te([V({type:Number,attribute:"color-contrast"})],G.PillCall.prototype,"colorContrast",2),te([V({type:Boolean,attribute:"sound-enabled"})],G.PillCall.prototype,"soundEnabled",2),te([V({type:Number,attribute:"sound-volume"})],G.PillCall.prototype,"soundVolume",2),te([V({type:String,attribute:"sound-preset"})],G.PillCall.prototype,"soundPreset",2),G.PillCall=te([mg("hanc-ai-pill-call")],G.PillCall);var oy=Object.defineProperty,ny=Object.getOwnPropertyDescriptor,$A=(i,A,e,t)=>{for(var g=t>1?void 0:t?ny(A,e):A,I=i.length-1,C;I>=0;I--)(C=i[I])&&(g=(t?C(A,e,g):C(g))||g);return t&&g&&oy(A,e,g),g};G.PillFloatingCall=class extends Kt{constructor(){super(...arguments),this.callManager=new Fg,this.orbRenderer=null,this.audioAnalyzer=null,this.soundManager=null,this.orbContainerRef=eo(),this.animationId=null,this.user_identity=wn(),this.callStatus="idle",this.microphoneEnabled=!1,this.microphoneInitialized=!1,this.showPrivacyModal=!1,this.widgetConfig=null,this.configLoading=!1,this.domainBlocked=!1,this.privacyUrl="https://hanc.ai/privacy",this.termsUrl="https://hanc.ai/terms",this.termsEnabled=!1,this.termsContent="",this.skipFetch=!1,this.apiBaseUrl=ui,this.buttonStartText="Talk to AI Agent",this.buttonConnectingText="Connecting...",this.buttonEndText="End call",this.position="bottom-right",this.orbSize=48,this.theme="default",this.orbColors={},this.glowIntensity=.8,this.idleGlowMultiplier=.4,this.morphStrength=1,this.noiseScale=1.5,this.noiseSpeed=.3,this.fresnelPower=2.5,this.rotationSpeed=.1,this.audioReactivity=3,this.audioSmoothing=.9,this.idleMorphMultiplier=.25,this.colorContrast=1.5,this.soundEnabled=!0,this.soundVolume=.25,this.soundPreset="1",this.handleAudioTrack=async A=>{const t=A.detail;if(!(!t||!this.audioAnalyzer))try{const g=new MediaStream([t]);await this.audioAnalyzer.connectStream(g)}catch(g){console.error("Failed to connect audio stream:",g)}},this.handleLocalAudioTrack=async A=>{const t=A.detail;if(!(!t||!this.audioAnalyzer))try{const g=new MediaStream([t]);await this.audioAnalyzer.connectLocalStream(g)}catch(g){console.error("Failed to connect local audio stream:",g)}},this.handleMicrophoneEnabled=()=>{this.microphoneEnabled=!0,this.microphoneInitialized=!0},this.handleMicrophoneDisabled=()=>{this.microphoneEnabled=!1,this.microphoneInitialized=!0},this.handleStatusChange=A=>{var t,g,I,C,o;switch(A.detail){case"connecting":this.callStatus="connecting";break;case"connected":this.callStatus="connected",(t=this.orbRenderer)==null||t.setActive(!0),this.startRealAudioLoop(),setTimeout(()=>{var n;(n=this.soundManager)==null||n.playCallStartSound()},300),this.dispatchEvent(new Event("call-start",{bubbles:!0,composed:!0}));break;case"disconnected":this.callStatus="idle",this.microphoneInitialized=!1,(g=this.orbRenderer)==null||g.setActive(!1),(I=this.audioAnalyzer)==null||I.disconnect(),this.startIdleAnimation(),setTimeout(()=>{var n;(n=this.soundManager)==null||n.playCallEndSound()},150),this.dispatchEvent(new Event("call-end",{bubbles:!0,composed:!0}));break;case"error":this.callStatus="error",(C=this.orbRenderer)==null||C.setActive(!1),(o=this.audioAnalyzer)==null||o.disconnect(),setTimeout(()=>{this.callStatus==="error"&&(this.callStatus="idle",this.startIdleAnimation())},3e3);break}},this.toggleCall=async()=>{var A,e;if(this.agentId){if(this.domainBlocked){console.warn("[hanc-widget] Call blocked: widget not allowed on this domain");return}if(await((A=this.soundManager)==null?void 0:A.prewarm()),this.callStatus==="idle"){if((((e=this.widgetConfig)==null?void 0:e.terms_enabled)??!1)&&!_n()){this.showPrivacyModal=!0;return}this.user_identity=ug(),this.callStatus="connecting",await this.callManager.makeCall({agentId:this.agentId,user_identity:this.user_identity})}else this.callStatus==="connected"&&this.callManager.hangUp()}},this.handlePrivacyAccept=async()=>{pn(),this.user_identity=ug(),this.showPrivacyModal=!1,this.callStatus="connecting",await this.callManager.makeCall({agentId:this.agentId,user_identity:this.user_identity})},this.handlePrivacyDecline=()=>{this.showPrivacyModal=!1}}connectedCallback(){super.connectedCallback(),this.voiceServiceUrl&&(this.callManager.serviceUrl=this.voiceServiceUrl),this.soundManager=new GC({enabled:this.soundEnabled,volume:this.soundVolume,preset:this.soundPreset}),this.callManager.addEventListener("status-changed",this.handleStatusChange),this.callManager.addEventListener("audio-track",this.handleAudioTrack),this.callManager.addEventListener("local-audio-track",this.handleLocalAudioTrack),this.callManager.addEventListener("microphone-enabled",this.handleMicrophoneEnabled),this.callManager.addEventListener("microphone-disabled",this.handleMicrophoneDisabled),this.loadWidgetConfig()}async loadWidgetConfig(){if(this.skipFetch){this.widgetConfig={terms_enabled:this.termsEnabled,terms_content:this.termsContent,terms_url:this.termsUrl,privacy_url:this.privacyUrl,theme:this.theme,allow_all_domains:!0,allowed_domains:[]};return}if(!(!this.agentId||this.configLoading)){this.configLoading=!0;try{const A=await MC(this.agentId,this.apiBaseUrl);this.widgetConfig=A,FC(A)||(this.domainBlocked=!0,console.warn("[hanc-widget] Widget is not allowed on this domain")),A.theme&&A.theme!=="default"&&!this.hasAttribute("theme")&&(this.theme=A.theme,this.applyTheme())}catch(A){console.error("[hanc-widget] Failed to load widget config:",A)}finally{this.configLoading=!1}}}disconnectedCallback(){var A;super.disconnectedCallback(),this.callManager.removeEventListener("status-changed",this.handleStatusChange),this.callManager.removeEventListener("audio-track",this.handleAudioTrack),this.callManager.removeEventListener("local-audio-track",this.handleLocalAudioTrack),this.callManager.removeEventListener("microphone-enabled",this.handleMicrophoneEnabled),this.callManager.removeEventListener("microphone-disabled",this.handleMicrophoneDisabled),this.callManager.hangUp(),this.cleanupOrb(),(A=this.soundManager)==null||A.destroy(),this.soundManager=null}firstUpdated(){this.applyTheme(),this.initializeOrb()}updated(A){var e,t,g;super.updated(A),A.has("agentId")&&(this.callManager.hangUp(),this.callStatus="idle",this.widgetConfig=null,this.domainBlocked=!1,this.loadWidgetConfig()),A.has("apiBaseUrl")&&this.agentId&&this.loadWidgetConfig(),this.skipFetch&&(A.has("termsEnabled")||A.has("termsContent")||A.has("termsUrl")||A.has("privacyUrl")||A.has("theme"))&&this.loadWidgetConfig(),A.has("voiceServiceUrl")&&this.voiceServiceUrl&&(this.callManager.serviceUrl=this.voiceServiceUrl),A.has("theme")&&this.applyTheme(),A.has("soundEnabled")&&((e=this.soundManager)==null||e.setEnabled(this.soundEnabled)),A.has("soundVolume")&&((t=this.soundManager)==null||t.setVolume(this.soundVolume)),A.has("soundPreset")&&((g=this.soundManager)==null||g.setPreset(this.soundPreset))}applyTheme(){if(this.theme){const A=JI(this.theme);this.orbColors=A.colors,this.glowIntensity=A.glowIntensity,this.idleGlowMultiplier=A.idleGlowMultiplier,this.orbRenderer&&(this.orbRenderer.setColors(this.orbColors),this.orbRenderer.setGlowSettings(this.glowIntensity,this.idleGlowMultiplier))}}initializeOrb(){const A=this.orbContainerRef.value;A&&(this.orbRenderer=new un(A,{size:1,colors:this.orbColors,glowIntensity:this.glowIntensity,idleGlowMultiplier:this.idleGlowMultiplier,morphStrength:this.morphStrength,noiseScale:this.noiseScale,noiseSpeed:this.noiseSpeed,fresnelPower:this.fresnelPower,rotationSpeed:this.rotationSpeed,audioReactivity:this.audioReactivity,audioSmoothing:this.audioSmoothing,idleMorphMultiplier:this.idleMorphMultiplier,colorContrast:this.colorContrast}),this.audioAnalyzer=new fn,this.orbRenderer.start(),this.startIdleAnimation())}cleanupOrb(){var A,e;this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null),(A=this.audioAnalyzer)==null||A.disconnect(),(e=this.orbRenderer)==null||e.destroy(),this.audioAnalyzer=null,this.orbRenderer=null}startIdleAnimation(){this.animationId!==null&&cancelAnimationFrame(this.animationId);const A=()=>{if(this.callStatus!=="idle"||!this.orbRenderer)return;const e=performance.now()/1e3,t=Math.sin(e*.5)*.15+.15,g=Math.sin(e*.7+1)*.12+.12,I=Math.sin(e*.9+2)*.08+.08,C=(t+g+I)/3;this.orbRenderer.setSimulatedAudio(t,g,I,C),this.animationId=requestAnimationFrame(A)};this.animationId=requestAnimationFrame(A)}startRealAudioLoop(){this.animationId!==null&&cancelAnimationFrame(this.animationId);const A=()=>{var t;if(this.callStatus!=="connected"||!this.orbRenderer)return;const e=(t=this.audioAnalyzer)==null?void 0:t.getAudioData();e&&this.orbRenderer.updateAudio(e),this.animationId=requestAnimationFrame(A)};this.animationId=requestAnimationFrame(A)}getButtonIcon(){const A=16*this.scale;return this.callStatus==="connecting"?pA`
5837
+ `,te([V({type:String,attribute:"agent-id"})],G.PillCall.prototype,"agentId",2),te([V({type:String,attribute:"voice-service-url"})],G.PillCall.prototype,"voiceServiceUrl",2),te([vA()],G.PillCall.prototype,"callStatus",2),te([vA()],G.PillCall.prototype,"microphoneEnabled",2),te([vA()],G.PillCall.prototype,"microphoneInitialized",2),te([vA()],G.PillCall.prototype,"showPrivacyModal",2),te([vA()],G.PillCall.prototype,"widgetConfig",2),te([vA()],G.PillCall.prototype,"configLoading",2),te([vA()],G.PillCall.prototype,"domainBlocked",2),te([V({type:String,attribute:"privacy-url"})],G.PillCall.prototype,"privacyUrl",2),te([V({type:String,attribute:"terms-url"})],G.PillCall.prototype,"termsUrl",2),te([V({type:Boolean,attribute:"terms-enabled"})],G.PillCall.prototype,"termsEnabled",2),te([V({type:String,attribute:"terms-content"})],G.PillCall.prototype,"termsContent",2),te([V({type:Boolean,attribute:"skip-fetch"})],G.PillCall.prototype,"skipFetch",2),te([V({type:String,attribute:"api-base-url"})],G.PillCall.prototype,"apiBaseUrl",2),te([V({type:String,attribute:"button-start-text"})],G.PillCall.prototype,"buttonStartText",2),te([V({type:String,attribute:"button-connecting-text"})],G.PillCall.prototype,"buttonConnectingText",2),te([V({type:String,attribute:"button-end-text"})],G.PillCall.prototype,"buttonEndText",2),te([V({type:Number,attribute:"orb-size"})],G.PillCall.prototype,"orbSize",2),te([V({type:String,attribute:"theme"})],G.PillCall.prototype,"theme",2),te([V({type:Object,attribute:"orb-colors"})],G.PillCall.prototype,"orbColors",2),te([V({type:Number,attribute:"glow-intensity"})],G.PillCall.prototype,"glowIntensity",2),te([V({type:Number,attribute:"idle-glow-multiplier"})],G.PillCall.prototype,"idleGlowMultiplier",2),te([V({type:Number,attribute:"morph-strength"})],G.PillCall.prototype,"morphStrength",2),te([V({type:Number,attribute:"noise-scale"})],G.PillCall.prototype,"noiseScale",2),te([V({type:Number,attribute:"noise-speed"})],G.PillCall.prototype,"noiseSpeed",2),te([V({type:Number,attribute:"fresnel-power"})],G.PillCall.prototype,"fresnelPower",2),te([V({type:Number,attribute:"rotation-speed"})],G.PillCall.prototype,"rotationSpeed",2),te([V({type:Number,attribute:"audio-reactivity"})],G.PillCall.prototype,"audioReactivity",2),te([V({type:Number,attribute:"audio-smoothing"})],G.PillCall.prototype,"audioSmoothing",2),te([V({type:Number,attribute:"idle-morph-multiplier"})],G.PillCall.prototype,"idleMorphMultiplier",2),te([V({type:Number,attribute:"color-contrast"})],G.PillCall.prototype,"colorContrast",2),te([V({type:Boolean,attribute:"sound-enabled"})],G.PillCall.prototype,"soundEnabled",2),te([V({type:Number,attribute:"sound-volume"})],G.PillCall.prototype,"soundVolume",2),te([V({type:String,attribute:"sound-preset"})],G.PillCall.prototype,"soundPreset",2),G.PillCall=te([mg("hanc-ai-pill-call")],G.PillCall);var oy=Object.defineProperty,ny=Object.getOwnPropertyDescriptor,$A=(i,A,e,t)=>{for(var g=t>1?void 0:t?ny(A,e):A,I=i.length-1,C;I>=0;I--)(C=i[I])&&(g=(t?C(A,e,g):C(g))||g);return t&&g&&oy(A,e,g),g};G.PillFloatingCall=class extends Kt{constructor(){super(...arguments),this.callManager=new Fg,this.orbRenderer=null,this.audioAnalyzer=null,this.soundManager=null,this.orbContainerRef=eo(),this.animationId=null,this.user_identity=wn(),this.callStatus="idle",this.microphoneEnabled=!1,this.microphoneInitialized=!1,this.showPrivacyModal=!1,this.widgetConfig=null,this.configLoading=!1,this.domainBlocked=!1,this.privacyUrl="https://hanc.ai/privacy",this.termsUrl="https://hanc.ai/terms",this.termsEnabled=!1,this.termsContent="",this.skipFetch=!1,this.apiBaseUrl=ui,this.buttonStartText="Talk to AI Agent",this.buttonConnectingText="Connecting...",this.buttonEndText="End call",this.position="bottom-right",this.orbSize=48,this.theme="default",this.orbColors={},this.glowIntensity=.8,this.idleGlowMultiplier=.4,this.morphStrength=1,this.noiseScale=1.5,this.noiseSpeed=.3,this.fresnelPower=2.5,this.rotationSpeed=.1,this.audioReactivity=3,this.audioSmoothing=.9,this.idleMorphMultiplier=.25,this.colorContrast=1.5,this.soundEnabled=!0,this.soundVolume=.25,this.soundPreset="1",this.handleAudioTrack=async A=>{const t=A.detail;if(!(!t||!this.audioAnalyzer))try{const g=new MediaStream([t]);await this.audioAnalyzer.connectStream(g)}catch(g){console.error("Failed to connect audio stream:",g)}},this.handleLocalAudioTrack=async A=>{const t=A.detail;if(!(!t||!this.audioAnalyzer))try{const g=new MediaStream([t]);await this.audioAnalyzer.connectLocalStream(g)}catch(g){console.error("Failed to connect local audio stream:",g)}},this.handleMicrophoneEnabled=()=>{this.microphoneEnabled=!0,this.microphoneInitialized=!0},this.handleMicrophoneDisabled=()=>{this.microphoneEnabled=!1,this.microphoneInitialized=!0},this.handleStatusChange=A=>{var t,g,I,C,o;switch(A.detail){case"connecting":this.callStatus="connecting";break;case"connected":this.callStatus="connected",(t=this.orbRenderer)==null||t.setActive(!0),this.startRealAudioLoop(),setTimeout(()=>{var n;(n=this.soundManager)==null||n.playCallStartSound()},300),this.dispatchEvent(new Event("call-start",{bubbles:!0,composed:!0}));break;case"disconnected":this.callStatus="idle",this.microphoneInitialized=!1,(g=this.orbRenderer)==null||g.setActive(!1),(I=this.audioAnalyzer)==null||I.disconnect(),this.startIdleAnimation(),setTimeout(()=>{var n;(n=this.soundManager)==null||n.playCallEndSound()},150),this.dispatchEvent(new Event("call-end",{bubbles:!0,composed:!0}));break;case"error":this.callStatus="error",(C=this.orbRenderer)==null||C.setActive(!1),(o=this.audioAnalyzer)==null||o.disconnect(),setTimeout(()=>{this.callStatus==="error"&&(this.callStatus="idle",this.startIdleAnimation())},3e3);break}},this.toggleCall=async()=>{var A,e;if(this.agentId){if(this.domainBlocked){console.warn("[hanc-widget] Call blocked: widget not allowed on this domain");return}if(await((A=this.soundManager)==null?void 0:A.prewarm()),this.callStatus==="idle"){if((((e=this.widgetConfig)==null?void 0:e.terms_enabled)??!1)&&!_n()){this.showPrivacyModal=!0;return}this.user_identity=ug(),this.callStatus="connecting",await this.callManager.makeCall({agentId:this.agentId,user_identity:this.user_identity})}else this.callStatus==="connected"&&this.callManager.hangUp()}},this.handlePrivacyAccept=async()=>{pn(),this.user_identity=ug(),this.showPrivacyModal=!1,this.callStatus="connecting",await this.callManager.makeCall({agentId:this.agentId,user_identity:this.user_identity})},this.handlePrivacyDecline=()=>{this.showPrivacyModal=!1}}connectedCallback(){super.connectedCallback(),this.voiceServiceUrl&&(this.callManager.serviceUrl=this.voiceServiceUrl),this.soundManager=new GC({enabled:this.soundEnabled,volume:this.soundVolume,preset:this.soundPreset}),this.callManager.addEventListener("status-changed",this.handleStatusChange),this.callManager.addEventListener("audio-track",this.handleAudioTrack),this.callManager.addEventListener("local-audio-track",this.handleLocalAudioTrack),this.callManager.addEventListener("microphone-enabled",this.handleMicrophoneEnabled),this.callManager.addEventListener("microphone-disabled",this.handleMicrophoneDisabled),this.loadWidgetConfig()}async loadWidgetConfig(){if(this.skipFetch){this.widgetConfig={terms_enabled:this.termsEnabled,terms_content:this.termsContent,terms_url:this.termsUrl,privacy_url:this.privacyUrl,theme:this.theme,allow_all_domains:!0,allowed_domains:[]};return}if(!(!this.agentId||this.configLoading)){this.configLoading=!0;try{const A=await MC(this.agentId,this.apiBaseUrl);this.widgetConfig=A,FC(A)||(this.domainBlocked=!0,console.warn("[hanc-widget] Widget is not allowed on this domain")),A.theme&&A.theme!=="default"&&!this.hasAttribute("theme")&&(this.theme=A.theme,this.applyTheme())}catch(A){console.error("[hanc-widget] Failed to load widget config:",A)}finally{this.configLoading=!1}}}disconnectedCallback(){var A;super.disconnectedCallback(),this.callManager.removeEventListener("status-changed",this.handleStatusChange),this.callManager.removeEventListener("audio-track",this.handleAudioTrack),this.callManager.removeEventListener("local-audio-track",this.handleLocalAudioTrack),this.callManager.removeEventListener("microphone-enabled",this.handleMicrophoneEnabled),this.callManager.removeEventListener("microphone-disabled",this.handleMicrophoneDisabled),this.callManager.hangUp(),this.cleanupOrb(),(A=this.soundManager)==null||A.destroy(),this.soundManager=null}firstUpdated(){this.applyTheme(),this.initializeOrb()}updated(A){var e,t,g;super.updated(A),A.has("agentId")&&(this.callManager.hangUp(),this.callStatus="idle",this.widgetConfig=null,this.domainBlocked=!1,this.loadWidgetConfig()),A.has("apiBaseUrl")&&this.agentId&&this.loadWidgetConfig(),this.skipFetch&&(A.has("termsEnabled")||A.has("termsContent")||A.has("termsUrl")||A.has("privacyUrl")||A.has("theme"))&&this.loadWidgetConfig(),A.has("voiceServiceUrl")&&this.voiceServiceUrl&&(this.callManager.serviceUrl=this.voiceServiceUrl),A.has("theme")&&this.applyTheme(),A.has("soundEnabled")&&((e=this.soundManager)==null||e.setEnabled(this.soundEnabled)),A.has("soundVolume")&&((t=this.soundManager)==null||t.setVolume(this.soundVolume)),A.has("soundPreset")&&((g=this.soundManager)==null||g.setPreset(this.soundPreset))}applyTheme(){if(this.theme){const A=JI(this.theme);this.orbColors=A.colors,this.glowIntensity=A.glowIntensity,this.idleGlowMultiplier=A.idleGlowMultiplier,this.orbRenderer&&(this.orbRenderer.setColors(this.orbColors),this.orbRenderer.setGlowSettings(this.glowIntensity,this.idleGlowMultiplier))}}initializeOrb(){const A=this.orbContainerRef.value;A&&(this.orbRenderer=new un(A,{size:1,colors:this.orbColors,glowIntensity:this.glowIntensity,idleGlowMultiplier:this.idleGlowMultiplier,morphStrength:this.morphStrength,noiseScale:this.noiseScale,noiseSpeed:this.noiseSpeed,fresnelPower:this.fresnelPower,rotationSpeed:this.rotationSpeed,audioReactivity:this.audioReactivity,audioSmoothing:this.audioSmoothing,idleMorphMultiplier:this.idleMorphMultiplier,colorContrast:this.colorContrast}),this.audioAnalyzer=new fn,this.orbRenderer.start(),this.startIdleAnimation())}cleanupOrb(){var A,e;this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null),(A=this.audioAnalyzer)==null||A.disconnect(),(e=this.orbRenderer)==null||e.destroy(),this.audioAnalyzer=null,this.orbRenderer=null}startIdleAnimation(){this.animationId!==null&&cancelAnimationFrame(this.animationId);const A=()=>{if(this.callStatus!=="idle"||!this.orbRenderer)return;const e=performance.now()/1e3,t=Math.sin(e*.5)*.15+.15,g=Math.sin(e*.7+1)*.12+.12,I=Math.sin(e*.9+2)*.08+.08,C=(t+g+I)/3;this.orbRenderer.setSimulatedAudio(t,g,I,C),this.animationId=requestAnimationFrame(A)};this.animationId=requestAnimationFrame(A)}startRealAudioLoop(){this.animationId!==null&&cancelAnimationFrame(this.animationId);const A=()=>{var t;if(this.callStatus!=="connected"||!this.orbRenderer)return;const e=(t=this.audioAnalyzer)==null?void 0:t.getAudioData();e&&this.orbRenderer.updateAudio(e),this.animationId=requestAnimationFrame(A)};this.animationId=requestAnimationFrame(A)}getButtonIcon(){const A=16*this.scale;return this.callStatus==="connecting"?_A`
5836
5838
  <svg width="${A}" height="${A}" viewBox="0 0 16 16" fill="none" class="hanc-spinner">
5837
5839
  <circle
5838
5840
  cx="8"
@@ -5844,7 +5846,7 @@ void main() {
5844
5846
  stroke-linecap="round"
5845
5847
  />
5846
5848
  </svg>
5847
- `:this.callStatus==="connected"?pA`
5849
+ `:this.callStatus==="connected"?_A`
5848
5850
  <svg width="${A}" height="${A}" viewBox="0 0 24 24" fill="none">
5849
5851
  <path
5850
5852
  d="M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91"
@@ -5863,7 +5865,7 @@ void main() {
5863
5865
  stroke-linecap="round"
5864
5866
  />
5865
5867
  </svg>
5866
- `:pA``}get buttonText(){switch(this.callStatus){case"connecting":return this.buttonConnectingText;case"connected":return this.buttonEndText;case"error":return"Error";default:return this.buttonStartText}}get scale(){return this.orbSize/48}render(){var e,t,g;const A=this.scale;return pA`
5868
+ `:_A``}get buttonText(){switch(this.callStatus){case"connecting":return this.buttonConnectingText;case"connected":return this.buttonEndText;case"error":return"Error";default:return this.buttonStartText}}get scale(){return this.orbSize/48}render(){var e,t,g;const A=this.scale;return _A`
5867
5869
  <style>
5868
5870
  .floating-container {
5869
5871
  position: ${this.position==="static"?"relative":"fixed"};
@@ -6016,7 +6018,7 @@ void main() {
6016
6018
  part="orb-container"
6017
6019
  ${to(this.orbContainerRef)}
6018
6020
  ></div>
6019
- ${this.callStatus==="connected"&&this.microphoneInitialized&&!this.microphoneEnabled?pA`
6021
+ ${this.callStatus==="connected"&&this.microphoneInitialized&&!this.microphoneEnabled?_A`
6020
6022
  <div class="microphone-indicator visible">
6021
6023
  <svg viewBox="0 0 24 24" fill="none">
6022
6024
  <path
@@ -6043,11 +6045,11 @@ void main() {
6043
6045
  </div>
6044
6046
  `:""}
6045
6047
  <span class="pill-text">${this.buttonText}</span>
6046
- ${this.callStatus!=="idle"?pA`<span class="icon-wrapper">${this.getButtonIcon()}</span>`:""}
6048
+ ${this.callStatus!=="idle"?_A`<span class="icon-wrapper">${this.getButtonIcon()}</span>`:""}
6047
6049
  </button>
6048
6050
  </div>
6049
6051
 
6050
- ${this.showPrivacyModal?pA`
6052
+ ${this.showPrivacyModal?_A`
6051
6053
  <hanc-privacy-modal
6052
6054
  privacy-url=${((e=this.widgetConfig)==null?void 0:e.privacy_url)||this.privacyUrl}
6053
6055
  terms-url=${((t=this.widgetConfig)==null?void 0:t.terms_url)||this.termsUrl}
@@ -6061,26 +6063,26 @@ void main() {
6061
6063
  display: block;
6062
6064
  }
6063
6065
  `,$A([V({type:String,attribute:"agent-id"})],G.PillFloatingCall.prototype,"agentId",2),$A([V({type:String,attribute:"voice-service-url"})],G.PillFloatingCall.prototype,"voiceServiceUrl",2),$A([vA()],G.PillFloatingCall.prototype,"callStatus",2),$A([vA()],G.PillFloatingCall.prototype,"microphoneEnabled",2),$A([vA()],G.PillFloatingCall.prototype,"microphoneInitialized",2),$A([vA()],G.PillFloatingCall.prototype,"showPrivacyModal",2),$A([vA()],G.PillFloatingCall.prototype,"widgetConfig",2),$A([vA()],G.PillFloatingCall.prototype,"configLoading",2),$A([vA()],G.PillFloatingCall.prototype,"domainBlocked",2),$A([V({type:String,attribute:"privacy-url"})],G.PillFloatingCall.prototype,"privacyUrl",2),$A([V({type:String,attribute:"terms-url"})],G.PillFloatingCall.prototype,"termsUrl",2),$A([V({type:Boolean,attribute:"terms-enabled"})],G.PillFloatingCall.prototype,"termsEnabled",2),$A([V({type:String,attribute:"terms-content"})],G.PillFloatingCall.prototype,"termsContent",2),$A([V({type:Boolean,attribute:"skip-fetch"})],G.PillFloatingCall.prototype,"skipFetch",2),$A([V({type:String,attribute:"api-base-url"})],G.PillFloatingCall.prototype,"apiBaseUrl",2),$A([V({type:String,attribute:"button-start-text"})],G.PillFloatingCall.prototype,"buttonStartText",2),$A([V({type:String,attribute:"button-connecting-text"})],G.PillFloatingCall.prototype,"buttonConnectingText",2),$A([V({type:String,attribute:"button-end-text"})],G.PillFloatingCall.prototype,"buttonEndText",2),$A([V({type:String,attribute:"position"})],G.PillFloatingCall.prototype,"position",2),$A([V({type:Number,attribute:"orb-size"})],G.PillFloatingCall.prototype,"orbSize",2),$A([V({type:String,attribute:"theme"})],G.PillFloatingCall.prototype,"theme",2),$A([V({type:Object,attribute:"orb-colors"})],G.PillFloatingCall.prototype,"orbColors",2),$A([V({type:Number,attribute:"glow-intensity"})],G.PillFloatingCall.prototype,"glowIntensity",2),$A([V({type:Number,attribute:"idle-glow-multiplier"})],G.PillFloatingCall.prototype,"idleGlowMultiplier",2),$A([V({type:Number,attribute:"morph-strength"})],G.PillFloatingCall.prototype,"morphStrength",2),$A([V({type:Number,attribute:"noise-scale"})],G.PillFloatingCall.prototype,"noiseScale",2),$A([V({type:Number,attribute:"noise-speed"})],G.PillFloatingCall.prototype,"noiseSpeed",2),$A([V({type:Number,attribute:"fresnel-power"})],G.PillFloatingCall.prototype,"fresnelPower",2),$A([V({type:Number,attribute:"rotation-speed"})],G.PillFloatingCall.prototype,"rotationSpeed",2),$A([V({type:Number,attribute:"audio-reactivity"})],G.PillFloatingCall.prototype,"audioReactivity",2),$A([V({type:Number,attribute:"audio-smoothing"})],G.PillFloatingCall.prototype,"audioSmoothing",2),$A([V({type:Number,attribute:"idle-morph-multiplier"})],G.PillFloatingCall.prototype,"idleMorphMultiplier",2),$A([V({type:Number,attribute:"color-contrast"})],G.PillFloatingCall.prototype,"colorContrast",2),$A([V({type:Boolean,attribute:"sound-enabled"})],G.PillFloatingCall.prototype,"soundEnabled",2),$A([V({type:Number,attribute:"sound-volume"})],G.PillFloatingCall.prototype,"soundVolume",2),$A([V({type:String,attribute:"sound-preset"})],G.PillFloatingCall.prototype,"soundPreset",2),G.PillFloatingCall=$A([mg("hanc-ai-pill-floating-call")],G.PillFloatingCall);const ld={version:4,country_calling_codes:{1:["US","AG","AI","AS","BB","BM","BS","CA","DM","DO","GD","GU","JM","KN","KY","LC","MP","MS","PR","SX","TC","TT","VC","VG","VI"],7:["RU","KZ"],20:["EG"],27:["ZA"],30:["GR"],31:["NL"],32:["BE"],33:["FR"],34:["ES"],36:["HU"],39:["IT","VA"],40:["RO"],41:["CH"],43:["AT"],44:["GB","GG","IM","JE"],45:["DK"],46:["SE"],47:["NO","SJ"],48:["PL"],49:["DE"],51:["PE"],52:["MX"],53:["CU"],54:["AR"],55:["BR"],56:["CL"],57:["CO"],58:["VE"],60:["MY"],61:["AU","CC","CX"],62:["ID"],63:["PH"],64:["NZ"],65:["SG"],66:["TH"],81:["JP"],82:["KR"],84:["VN"],86:["CN"],90:["TR"],91:["IN"],92:["PK"],93:["AF"],94:["LK"],95:["MM"],98:["IR"],211:["SS"],212:["MA","EH"],213:["DZ"],216:["TN"],218:["LY"],220:["GM"],221:["SN"],222:["MR"],223:["ML"],224:["GN"],225:["CI"],226:["BF"],227:["NE"],228:["TG"],229:["BJ"],230:["MU"],231:["LR"],232:["SL"],233:["GH"],234:["NG"],235:["TD"],236:["CF"],237:["CM"],238:["CV"],239:["ST"],240:["GQ"],241:["GA"],242:["CG"],243:["CD"],244:["AO"],245:["GW"],246:["IO"],247:["AC"],248:["SC"],249:["SD"],250:["RW"],251:["ET"],252:["SO"],253:["DJ"],254:["KE"],255:["TZ"],256:["UG"],257:["BI"],258:["MZ"],260:["ZM"],261:["MG"],262:["RE","YT"],263:["ZW"],264:["NA"],265:["MW"],266:["LS"],267:["BW"],268:["SZ"],269:["KM"],290:["SH","TA"],291:["ER"],297:["AW"],298:["FO"],299:["GL"],350:["GI"],351:["PT"],352:["LU"],353:["IE"],354:["IS"],355:["AL"],356:["MT"],357:["CY"],358:["FI","AX"],359:["BG"],370:["LT"],371:["LV"],372:["EE"],373:["MD"],374:["AM"],375:["BY"],376:["AD"],377:["MC"],378:["SM"],380:["UA"],381:["RS"],382:["ME"],383:["XK"],385:["HR"],386:["SI"],387:["BA"],389:["MK"],420:["CZ"],421:["SK"],423:["LI"],500:["FK"],501:["BZ"],502:["GT"],503:["SV"],504:["HN"],505:["NI"],506:["CR"],507:["PA"],508:["PM"],509:["HT"],590:["GP","BL","MF"],591:["BO"],592:["GY"],593:["EC"],594:["GF"],595:["PY"],596:["MQ"],597:["SR"],598:["UY"],599:["CW","BQ"],670:["TL"],672:["NF"],673:["BN"],674:["NR"],675:["PG"],676:["TO"],677:["SB"],678:["VU"],679:["FJ"],680:["PW"],681:["WF"],682:["CK"],683:["NU"],685:["WS"],686:["KI"],687:["NC"],688:["TV"],689:["PF"],690:["TK"],691:["FM"],692:["MH"],850:["KP"],852:["HK"],853:["MO"],855:["KH"],856:["LA"],880:["BD"],886:["TW"],960:["MV"],961:["LB"],962:["JO"],963:["SY"],964:["IQ"],965:["KW"],966:["SA"],967:["YE"],968:["OM"],970:["PS"],971:["AE"],972:["IL"],973:["BH"],974:["QA"],975:["BT"],976:["MN"],977:["NP"],992:["TJ"],993:["TM"],994:["AZ"],995:["GE"],996:["KG"],998:["UZ"]},countries:{AC:["247","00","(?:[01589]\\d|[46])\\d{4}",[5,6]],AD:["376","00","(?:1|6\\d)\\d{7}|[135-9]\\d{5}",[6,8,9],[["(\\d{3})(\\d{3})","$1 $2",["[135-9]"]],["(\\d{4})(\\d{4})","$1 $2",["1"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]]],AE:["971","00","(?:[4-7]\\d|9[0-689])\\d{7}|800\\d{2,9}|[2-4679]\\d{7}",[5,6,7,8,9,10,11,12],[["(\\d{3})(\\d{2,9})","$1 $2",["60|8"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[236]|[479][2-8]"],"0$1"],["(\\d{3})(\\d)(\\d{5})","$1 $2 $3",["[479]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"]],"0"],AF:["93","00","[2-7]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"]],"0"],AG:["1","011","(?:268|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([457]\\d{6})$|1","268$1",0,"268"],AI:["1","011","(?:264|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2457]\\d{6})$|1","264$1",0,"264"],AL:["355","00","(?:700\\d\\d|900)\\d{3}|8\\d{5,7}|(?:[2-5]|6\\d)\\d{7}",[6,7,8,9],[["(\\d{3})(\\d{3,4})","$1 $2",["80|9"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["4[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2358][2-5]|4"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["[23578]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["6"],"0$1"]],"0"],AM:["374","00","(?:[1-489]\\d|55|60|77)\\d{6}",[8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[89]0"],"0 $1"],["(\\d{3})(\\d{5})","$1 $2",["2|3[12]"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["1|47"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[3-9]"],"0$1"]],"0"],AO:["244","00","[29]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[29]"]]]],AR:["54","00","(?:11|[89]\\d\\d)\\d{8}|[2368]\\d{9}",[10,11],[["(\\d{4})(\\d{2})(\\d{4})","$1 $2-$3",["2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9])","2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8]))|2(?:2[24-9]|3[1-59]|47)","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5[56][46]|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|58|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|54(?:4|5[13-7]|6[89])|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:454|85[56])[46]|3(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["1"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[68]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2-$3",["[23]"],"0$1",1],["(\\d)(\\d{4})(\\d{2})(\\d{4})","$2 15-$3-$4",["9(?:2[2-469]|3[3-578])","9(?:2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9]))","9(?:2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8])))|92(?:2[24-9]|3[1-59]|47)","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5(?:[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|5(?:4(?:4|5[13-7]|6[89])|[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",0,"$1 $2 $3-$4"],["(\\d)(\\d{2})(\\d{4})(\\d{4})","$2 15-$3-$4",["91"],"0$1",0,"$1 $2 $3-$4"],["(\\d{3})(\\d{3})(\\d{5})","$1-$2-$3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{4})","$2 15-$3-$4",["9"],"0$1",0,"$1 $2 $3-$4"]],"0",0,"0?(?:(11|2(?:2(?:02?|[13]|2[13-79]|4[1-6]|5[2457]|6[124-8]|7[1-4]|8[13-6]|9[1267])|3(?:02?|1[467]|2[03-6]|3[13-8]|[49][2-6]|5[2-8]|[67])|4(?:7[3-578]|9)|6(?:[0136]|2[24-6]|4[6-8]?|5[15-8])|80|9(?:0[1-3]|[19]|2\\d|3[1-6]|4[02568]?|5[2-4]|6[2-46]|72?|8[23]?))|3(?:3(?:2[79]|6|8[2578])|4(?:0[0-24-9]|[12]|3[5-8]?|4[24-7]|5[4-68]?|6[02-9]|7[126]|8[2379]?|9[1-36-8])|5(?:1|2[1245]|3[237]?|4[1-46-9]|6[2-4]|7[1-6]|8[2-5]?)|6[24]|7(?:[069]|1[1568]|2[15]|3[145]|4[13]|5[14-8]|7[2-57]|8[126])|8(?:[01]|2[15-7]|3[2578]?|4[13-6]|5[4-8]?|6[1-357-9]|7[36-8]?|8[5-8]?|9[124])))15)?","9$1"],AS:["1","011","(?:[58]\\d\\d|684|900)\\d{7}",[10],0,"1",0,"([267]\\d{6})$|1","684$1",0,"684"],AT:["43","00","1\\d{3,12}|2\\d{6,12}|43(?:(?:0\\d|5[02-9])\\d{3,9}|2\\d{4,5}|[3467]\\d{4}|8\\d{4,6}|9\\d{4,7})|5\\d{4,12}|8\\d{7,12}|9\\d{8,12}|(?:[367]\\d|4[0-24-9])\\d{4,11}",[4,5,6,7,8,9,10,11,12,13],[["(\\d)(\\d{3,12})","$1 $2",["1(?:11|[2-9])"],"0$1"],["(\\d{3})(\\d{2})","$1 $2",["517"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["5[079]"],"0$1"],["(\\d{3})(\\d{3,10})","$1 $2",["(?:31|4)6|51|6(?:48|5[0-3579]|[6-9])|7(?:20|32|8)|[89]","(?:31|4)6|51|6(?:485|5[0-3579]|[6-9])|7(?:20|32|8)|[89]"],"0$1"],["(\\d{4})(\\d{3,9})","$1 $2",["[2-467]|5[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["5"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,7})","$1 $2 $3",["5"],"0$1"]],"0"],AU:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{7}(?:\\d(?:\\d{2})?)?|8[0-24-9]\\d{7})|[2-478]\\d{8}|1\\d{4,7}",[5,6,7,8,9,10,12],[["(\\d{2})(\\d{3,4})","$1 $2",["16"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,4})","$1 $2 $3",["16"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["14|4"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[2378]"],"(0$1)"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:30|[89])"]]],"0",0,"(183[12])|0",0,0,0,[["(?:(?:241|349)0\\d\\d|8(?:51(?:0(?:0[03-9]|[12479]\\d|3[2-9]|5[0-8]|6[1-9]|8[0-7])|1(?:[0235689]\\d|1[0-69]|4[0-589]|7[0-47-9])|2(?:0[0-79]|[18][13579]|2[14-9]|3[0-46-9]|[4-6]\\d|7[89]|9[0-4])|[34]\\d\\d)|91(?:(?:[0-58]\\d|6[0135-9])\\d|7(?:0[0-24-9]|[1-9]\\d)|9(?:[0-46-9]\\d|5[0-79]))))\\d{3}|(?:2(?:[0-26-9]\\d|3[0-8]|4[02-9]|5[0135-9])|3(?:[0-3589]\\d|4[0-578]|6[1-9]|7[0-35-9])|7(?:[013-57-9]\\d|2[0-8])|8(?:55|6[0-8]|[78]\\d|9[02-9]))\\d{6}",[9]],["4(?:79[01]|83[0-36-9]|95[0-3])\\d{5}|4(?:[0-36]\\d|4[047-9]|[58][0-24-9]|7[02-8]|9[0-47-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,["163\\d{2,6}",[5,6,7,8,9]],["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],AW:["297","00","(?:[25-79]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[25-9]"]]]],AX:["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","2\\d{4,9}|35\\d{4,5}|(?:60\\d\\d|800)\\d{4,6}|7\\d{5,11}|(?:[14]\\d|3[0-46-9]|50)\\d{4,8}",[5,6,7,8,9,10,11,12],0,"0",0,0,0,0,"18",0,"00"],AZ:["994","00","365\\d{6}|(?:[124579]\\d|60|88)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[28]|2|365|46","1[28]|2|365[45]|46","1[28]|2|365(?:4|5[02])|46"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[13-9]"],"0$1"]],"0"],BA:["387","00","6\\d{8}|(?:[35689]\\d|49|70)\\d{6}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["6[1-3]|[7-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2-$3",["[3-5]|6[56]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["6"],"0$1"]],"0"],BB:["1","011","(?:246|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","246$1",0,"246"],BD:["880","00","[1-469]\\d{9}|8[0-79]\\d{7,8}|[2-79]\\d{8}|[2-9]\\d{7}|[3-9]\\d{6}|[57-9]\\d{5}",[6,7,8,9,10],[["(\\d{2})(\\d{4,6})","$1-$2",["31[5-8]|[459]1"],"0$1"],["(\\d{3})(\\d{3,7})","$1-$2",["3(?:[67]|8[013-9])|4(?:6[168]|7|[89][18])|5(?:6[128]|9)|6(?:[15]|28|4[14])|7[2-589]|8(?:0[014-9]|[12])|9[358]|(?:3[2-5]|4[235]|5[2-578]|6[0389]|76|8[3-7]|9[24])1|(?:44|66)[01346-9]"],"0$1"],["(\\d{4})(\\d{3,6})","$1-$2",["[13-9]|2[23]"],"0$1"],["(\\d)(\\d{7,8})","$1-$2",["2"],"0$1"]],"0"],BE:["32","00","4\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:80|9)0"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[239]|4[23]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[15-8]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4"],"0$1"]],"0"],BF:["226","00","[024-7]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[024-7]"]]]],BG:["359","00","00800\\d{7}|[2-7]\\d{6,7}|[89]\\d{6,8}|2\\d{5}",[6,7,8,9,12],[["(\\d)(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["43[1-6]|70[1-9]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["[356]|4[124-7]|7[1-9]|8[1-6]|9[1-7]"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:70|8)0"],"0$1"],["(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3",["43[1-7]|7"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[48]|9[08]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"]],"0"],BH:["973","00","[136-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[13679]|8[02-4679]"]]]],BI:["257","00","(?:[267]\\d|31)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2367]"]]]],BJ:["229","00","(?:01\\d|8)\\d{7}",[8,10],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["0"]]]],BL:["590","00","7090\\d{5}|(?:[56]9|[89]\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["(?:59(?:0(?:2[7-9]|3[3-7]|5[12]|87)|87\\d)|80[6-9]\\d\\d)\\d{4}"],["(?:69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))|7090[0-4])\\d{4}"],["80[0-5]\\d{6}"],["8[129]\\d{7}"],0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-6])\\d{4}"]]],BM:["1","011","(?:441|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","441$1",0,"441"],BN:["673","00","[2-578]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-578]"]]]],BO:["591","00(?:1\\d)?","8001\\d{5}|(?:[2-467]\\d|50)\\d{6}",[8,9],[["(\\d)(\\d{7})","$1 $2",["[235]|4[46]"]],["(\\d{8})","$1",["[67]"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["8"]]],"0",0,"0(1\\d)?"],BQ:["599","00","(?:[34]1|7\\d)\\d{5}",[7],0,0,0,0,0,0,"[347]"],BR:["55","00(?:1[245]|2[1-35]|31|4[13]|[56]5|99)","[1-467]\\d{9,10}|55[0-46-9]\\d{8}|[34]\\d{7}|55\\d{7,8}|(?:5[0-46-9]|[89]\\d)\\d{7,9}",[8,9,10,11],[["(\\d{4})(\\d{4})","$1-$2",["300|4(?:0[02]|37|86)","300|4(?:0(?:0|20)|370|864)"]],["(\\d{3})(\\d{2,3})(\\d{4})","$1 $2 $3",["(?:[358]|90)0"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])[2-57]"],"($1)"],["(\\d{2})(\\d{5})(\\d{4})","$1 $2-$3",["[16][1-9]|[2-57-9]"],"($1)"]],"0",0,"(?:0|90)(?:(1[245]|2[1-35]|31|4[13]|[56]5|99)(\\d{10,11}))?","$2"],BS:["1","011","(?:242|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([3-8]\\d{6})$|1","242$1",0,"242"],BT:["975","00","[178]\\d{7}|[2-8]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[2-6]|7[246]|8[2-4]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[67]|[78]"]]]],BW:["267","00","(?:0800|(?:[37]|800)\\d)\\d{6}|(?:[2-6]\\d|90)\\d{5}",[7,8,10],[["(\\d{2})(\\d{5})","$1 $2",["90"]],["(\\d{3})(\\d{4})","$1 $2",["[24-6]|3[15-9]"]],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37]"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["8"]]]],BY:["375","810","(?:[12]\\d|33|44|902)\\d{7}|8(?:0[0-79]\\d{5,7}|[1-7]\\d{9})|8(?:1[0-489]|[5-79]\\d)\\d{7}|8[1-79]\\d{6,7}|8[0-79]\\d{5}|8\\d{5}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3})","$1 $2",["800"],"8 $1"],["(\\d{3})(\\d{2})(\\d{2,4})","$1 $2 $3",["800"],"8 $1"],["(\\d{4})(\\d{2})(\\d{3})","$1 $2-$3",["1(?:5[169]|6[3-5]|7[179])|2(?:1[35]|2[34]|3[3-5])","1(?:5[169]|6(?:3[1-3]|4|5[125])|7(?:1[3-9]|7[0-24-6]|9[2-7]))|2(?:1[35]|2[34]|3[3-5])"],"8 0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["1(?:[56]|7[467])|2[1-3]"],"8 0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-4]"],"8 0$1"],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["[89]"],"8 $1"]],"8",0,"0|80?",0,0,0,0,"8~10"],BZ:["501","00","(?:0800\\d|[2-8])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1-$2",["[2-8]"]],["(\\d)(\\d{3})(\\d{4})(\\d{3})","$1-$2-$3-$4",["0"]]]],CA:["1","011","[2-9]\\d{9}|3\\d{6}",[7,10],0,"1",0,0,0,0,0,[["(?:2(?:04|[23]6|[48]9|5[07]|63)|3(?:06|43|54|6[578]|82)|4(?:03|1[68]|[26]8|3[178]|50|74)|5(?:06|1[49]|48|79|8[147])|6(?:04|[18]3|39|47|72)|7(?:0[59]|42|53|78|8[02])|8(?:[06]7|19|25|7[39])|9(?:0[25]|42))[2-9]\\d{6}",[10]],["",[10]],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}",[10]],["900[2-9]\\d{6}",[10]],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|(?:5(?:2[125-9]|3[23]|44|66|77|88)|6(?:22|33))[2-9]\\d{6}",[10]],0,["310\\d{4}",[7]],0,["600[2-9]\\d{6}",[10]]]],CC:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"([59]\\d{7})$|0","8$1",0,0,[["8(?:51(?:0(?:02|31|60|89)|1(?:18|76)|223)|91(?:0(?:1[0-2]|29)|1(?:[28]2|50|79)|2(?:10|64)|3(?:[06]8|22)|4[29]8|62\\d|70[23]|959))\\d{3}",[9]],["4(?:79[01]|83[0-36-9]|95[0-3])\\d{5}|4(?:[0-36]\\d|4[047-9]|[58][0-24-9]|7[02-8]|9[0-47-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],CD:["243","00","(?:(?:[189]|5\\d)\\d|2)\\d{7}|[1-68]\\d{6}",[7,8,9,10],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["[1-6]"],"0$1"],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["5"],"0$1"]],"0"],CF:["236","00","8776\\d{4}|(?:[27]\\d|61)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[26-8]"]]]],CG:["242","00","222\\d{6}|(?:0\\d|80)\\d{7}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[02]"]]]],CH:["41","00","8\\d{11}|[2-9]\\d{8}",[9,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8[047]|90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-79]|81"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["8"],"0$1"]],"0"],CI:["225","00","[02]\\d{9}",[10],[["(\\d{2})(\\d{2})(\\d)(\\d{5})","$1 $2 $3 $4",["2"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3 $4",["0"]]]],CK:["682","00","[2-578]\\d{4}",[5],[["(\\d{2})(\\d{3})","$1 $2",["[2-578]"]]]],CL:["56","(?:0|1(?:1[0-69]|2[02-5]|5[13-58]|69|7[0167]|8[018]))0","12300\\d{6}|6\\d{9,10}|[2-9]\\d{8}",[9,10,11],[["(\\d{5})(\\d{4})","$1 $2",["219","2196"],"($1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["60|809"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["44"]],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2[1-36]"],"($1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["9(?:10|[2-9])"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["3[2-5]|[47]|5[1-3578]|6[13-57]|8(?:0[1-8]|[1-9])"],"($1)"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["60|8"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{3})(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3 $4",["60"]]]],CM:["237","00","[26]\\d{8}|88\\d{6,7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["88"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[26]|88"]]]],CN:["86","00|1(?:[12]\\d|79)\\d\\d00","(?:(?:1[03-689]|2\\d)\\d\\d|6)\\d{8}|1\\d{10}|[126]\\d{6}(?:\\d(?:\\d{2})?)?|86\\d{5,6}|(?:[3-579]\\d|8[0-57-9])\\d{5,9}",[7,8,9,10,11,12],[["(\\d{2})(\\d{5,6})","$1 $2",["(?:10|2[0-57-9])[19]|3(?:[157]|35|49|9[1-68])|4(?:1[124-9]|2[179]|6[47-9]|7|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:07|1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3|4[13]|5[1-5]|7[0-79]|9[0-35-9])|(?:4[35]|59|85)[1-9]","(?:10|2[0-57-9])(?:1[02]|9[56])|8078|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))1","10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|80781|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))12","10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|807812|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))123","10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:078|1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))123"],"0$1"],["(\\d{3})(\\d{5,6})","$1 $2",["3(?:[157]|35|49|9[1-68])|4(?:[17]|2[179]|6[47-9]|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]|4[13]|5[1-5])|(?:4[35]|59|85)[1-9]","(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))[19]","85[23](?:10|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:10|9[56])","85[23](?:100|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:100|9[56])"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["(?:4|80)0"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["10|2(?:[02-57-9]|1[1-9])","10|2(?:[02-57-9]|1[1-9])","10[0-79]|2(?:[02-57-9]|1[1-79])|(?:10|21)8(?:0[1-9]|[1-9])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["3(?:[3-59]|7[02-68])|4(?:[26-8]|3[3-9]|5[2-9])|5(?:3[03-9]|[468]|7[028]|9[2-46-9])|6|7(?:[0-247]|3[04-9]|5[0-4689]|6[2368])|8(?:[1-358]|9[1-7])|9(?:[013479]|5[1-5])|(?:[34]1|55|79|87)[02-9]"],"0$1",1],["(\\d{3})(\\d{7,8})","$1 $2",["9"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["80"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[3-578]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["1[3-9]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3 $4",["[12]"],"0$1",1]],"0",0,"(1(?:[12]\\d|79)\\d\\d)|0",0,0,0,0,"00"],CO:["57","00(?:4(?:[14]4|56)|[579])","(?:46|60\\d\\d)\\d{6}|(?:1\\d|[39])\\d{9}",[8,10,11],[["(\\d{4})(\\d{4})","$1 $2",["46"]],["(\\d{3})(\\d{7})","$1 $2",["6|90"],"($1)"],["(\\d{3})(\\d{7})","$1 $2",["3[0-357]|9[14]"]],["(\\d)(\\d{3})(\\d{7})","$1-$2-$3",["1"],"0$1",0,"$1 $2 $3"]],"0",0,"0([3579]|4(?:[14]4|56))?"],CR:["506","00","(?:8\\d|90)\\d{8}|(?:[24-8]\\d{3}|3005)\\d{4}",[8,10],[["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[3-9]"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[89]"]]],0,0,"(19(?:0[0-2468]|1[09]|20|66|77|99))"],CU:["53","119","(?:[2-7]|8\\d\\d)\\d{7}|[2-47]\\d{6}|[34]\\d{5}",[6,7,8,10],[["(\\d{2})(\\d{4,6})","$1 $2",["2[1-4]|[34]"],"(0$1)"],["(\\d)(\\d{6,7})","$1 $2",["7"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["[56]"],"0$1"],["(\\d{3})(\\d{7})","$1 $2",["8"],"0$1"]],"0"],CV:["238","0","(?:[2-59]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2-589]"]]]],CW:["599","00","(?:[34]1|60|(?:7|9\\d)\\d)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[3467]"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["9[4-8]"]]],0,0,0,0,0,"[69]"],CX:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"([59]\\d{7})$|0","8$1",0,0,[["8(?:51(?:0(?:01|30|59|88)|1(?:17|46|75)|2(?:22|35))|91(?:00[6-9]|1(?:[28]1|49|78)|2(?:09|63)|3(?:12|26|75)|4(?:56|97)|64\\d|7(?:0[01]|1[0-2])|958))\\d{3}",[9]],["4(?:79[01]|83[0-36-9]|95[0-3])\\d{5}|4(?:[0-36]\\d|4[047-9]|[58][0-24-9]|7[02-8]|9[0-47-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],CY:["357","00","(?:[279]\\d|[58]0)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[257-9]"]]]],CZ:["420","00","(?:[2-578]\\d|60)\\d{7}|9\\d{8,11}",[9,10,11,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]|9[015-7]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3 $4",["96"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]]],DE:["49","00","[2579]\\d{5,14}|49(?:[34]0|69|8\\d)\\d\\d?|49(?:37|49|60|7[089]|9\\d)\\d{1,3}|49(?:2[024-9]|3[2-689]|7[1-7])\\d{1,8}|(?:1|[368]\\d|4[0-8])\\d{3,13}|49(?:[015]\\d|2[13]|31|[46][1-8])\\d{1,9}",[4,5,6,7,8,9,10,11,12,13,14,15],[["(\\d{2})(\\d{3,13})","$1 $2",["3[02]|40|[68]9"],"0$1"],["(\\d{3})(\\d{3,12})","$1 $2",["2(?:0[1-389]|1[124]|2[18]|3[14])|3(?:[35-9][15]|4[015])|906|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1","2(?:0[1-389]|12[0-8])|3(?:[35-9][15]|4[015])|906|2(?:[13][14]|2[18])|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1"],"0$1"],["(\\d{4})(\\d{2,11})","$1 $2",["[24-6]|3(?:[3569][02-46-9]|4[2-4679]|7[2-467]|8[2-46-8])|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]","[24-6]|3(?:3(?:0[1-467]|2[127-9]|3[124578]|7[1257-9]|8[1256]|9[145])|4(?:2[135]|4[13578]|9[1346])|5(?:0[14]|2[1-3589]|6[1-4]|7[13468]|8[13568])|6(?:2[1-489]|3[124-6]|6[13]|7[12579]|8[1-356]|9[135])|7(?:2[1-7]|4[145]|6[1-5]|7[1-4])|8(?:21|3[1468]|6|7[1467]|8[136])|9(?:0[12479]|2[1358]|4[134679]|6[1-9]|7[136]|8[147]|9[1468]))|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]|3[68]4[1347]|3(?:47|60)[1356]|3(?:3[46]|46|5[49])[1246]|3[4579]3[1357]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["138"],"0$1"],["(\\d{5})(\\d{2,10})","$1 $2",["3"],"0$1"],["(\\d{3})(\\d{5,11})","$1 $2",["181"],"0$1"],["(\\d{3})(\\d)(\\d{4,10})","$1 $2 $3",["1(?:3|80)|9"],"0$1"],["(\\d{3})(\\d{7,8})","$1 $2",["1[67]"],"0$1"],["(\\d{3})(\\d{7,12})","$1 $2",["8"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["185","1850","18500"],"0$1"],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["18[68]"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["15[1279]"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["15[03568]","15(?:[0568]|3[13])"],"0$1"],["(\\d{3})(\\d{8})","$1 $2",["18"],"0$1"],["(\\d{3})(\\d{2})(\\d{7,8})","$1 $2 $3",["1(?:6[023]|7)"],"0$1"],["(\\d{4})(\\d{2})(\\d{7})","$1 $2 $3",["15[279]"],"0$1"],["(\\d{3})(\\d{2})(\\d{8})","$1 $2 $3",["15"],"0$1"]],"0"],DJ:["253","00","(?:2\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[27]"]]]],DK:["45","00","[2-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-9]"]]]],DM:["1","011","(?:[58]\\d\\d|767|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","767$1",0,"767"],DO:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,0,0,0,"8001|8[024]9"],DZ:["213","00","(?:[1-4]|[5-79]\\d|80)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["9"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-8]"],"0$1"]],"0"],EC:["593","00","1\\d{9,10}|(?:[2-7]|9\\d)\\d{7}",[8,9,10,11],[["(\\d)(\\d{3})(\\d{4})","$1 $2-$3",["[2-7]"],"(0$1)",0,"$1-$2-$3"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{3})(\\d{3,4})","$1 $2 $3",["1"]]],"0"],EE:["372","00","8\\d{9}|[4578]\\d{7}|(?:[3-8]\\d|90)\\d{5}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[369]|4[3-8]|5(?:[0-2]|5[0-478]|6[45])|7[1-9]|88","[369]|4[3-8]|5(?:[02]|1(?:[0-8]|95)|5[0-478]|6(?:4[0-4]|5[1-589]))|7[1-9]|88"]],["(\\d{4})(\\d{3,4})","$1 $2",["[45]|8(?:00|[1-49])","[45]|8(?:00[1-9]|[1-49])"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]]],EG:["20","00","[189]\\d{8,9}|[24-6]\\d{8}|[135]\\d{7}",[8,9,10],[["(\\d)(\\d{7,8})","$1 $2",["[23]"],"0$1"],["(\\d{2})(\\d{6,7})","$1 $2",["1[35]|[4-6]|8[2468]|9[235-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{8})","$1 $2",["1"],"0$1"]],"0"],EH:["212","00","[5-8]\\d{8}",[9],0,"0",0,0,0,0,0,[["528[89]\\d{5}"],["(?:6(?:[0-79]\\d|8[0-247-9])|7(?:[016-8]\\d|2[0-8]|5[0-5]))\\d{6}"],["80[0-7]\\d{6}"],["89\\d{7}"],0,0,0,0,["(?:592(?:4[0-2]|93)|80[89]\\d\\d)\\d{4}"]]],ER:["291","00","[178]\\d{6}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[178]"],"0$1"]],"0"],ES:["34","00","[5-9]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]00"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-9]"]]]],ET:["251","00","(?:11|[2-579]\\d)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-579]"],"0$1"]],"0"],FI:["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","[1-35689]\\d{4}|7\\d{10,11}|(?:[124-7]\\d|3[0-46-9])\\d{8}|[1-9]\\d{5,8}",[5,6,7,8,9,10,11,12],[["(\\d{5})","$1",["20[2-59]"],"0$1"],["(\\d{3})(\\d{3,7})","$1 $2",["(?:[1-3]0|[68])0|70[07-9]"],"0$1"],["(\\d{2})(\\d{4,8})","$1 $2",["[14]|2[09]|50|7[135]"],"0$1"],["(\\d{2})(\\d{6,10})","$1 $2",["7"],"0$1"],["(\\d)(\\d{4,9})","$1 $2",["(?:19|[2568])[1-8]|3(?:0[1-9]|[1-9])|9"],"0$1"]],"0",0,0,0,0,"1[03-79]|[2-9]",0,"00"],FJ:["679","0(?:0|52)","45\\d{5}|(?:0800\\d|[235-9])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1 $2",["[235-9]|45"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]]],0,0,0,0,0,0,0,"00"],FK:["500","00","[2-7]\\d{4}",[5]],FM:["691","00","(?:[39]\\d\\d|820)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[389]"]]]],FO:["298","00","[2-9]\\d{5}",[6],[["(\\d{6})","$1",["[2-9]"]]],0,0,"(10(?:01|[12]0|88))"],FR:["33","00","[1-9]\\d{8}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0 $1"],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[1-79]"],"0$1"]],"0"],GA:["241","00","(?:[067]\\d|11)\\d{6}|[2-7]\\d{6}",[7,8],[["(\\d)(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-7]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["11|[67]"],"0$1"]],0,0,"0(11\\d{6}|60\\d{6}|61\\d{6}|6[256]\\d{6}|7[467]\\d{6})","$1"],GB:["44","00","[1-357-9]\\d{9}|[18]\\d{8}|8\\d{6}",[7,9,10],[["(\\d{3})(\\d{4})","$1 $2",["800","8001","80011","800111","8001111"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["845","8454","84546","845464"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["800"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["1(?:38|5[23]|69|76|94)","1(?:(?:38|69)7|5(?:24|39)|768|946)","1(?:3873|5(?:242|39[4-6])|(?:697|768)[347]|9467)"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["1(?:[2-69][02-9]|[78])"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[25]|7(?:0|6[02-9])","[25]|7(?:0|6(?:[03-9]|2[356]))"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[1389]"],"0$1"]],"0",0,"0|180020",0,0,0,[["(?:1(?:1(?:3(?:[0-58]\\d\\d|73[0-5])|4(?:(?:[0-5]\\d|70)\\d|69[7-9])|(?:(?:5[0-26-9]|[78][0-49])\\d|6(?:[0-4]\\d|5[01]))\\d)|(?:2(?:(?:0[024-9]|2[3-9]|3[3-79]|4[1-689]|[58][02-9]|6[0-47-9]|7[013-9]|9\\d)\\d|1(?:[0-7]\\d|8[0-3]))|(?:3(?:0\\d|1[0-8]|[25][02-9]|3[02-579]|[468][0-46-9]|7[1-35-79]|9[2-578])|4(?:0[03-9]|[137]\\d|[28][02-57-9]|4[02-69]|5[0-8]|[69][0-79])|5(?:0[1-35-9]|[16]\\d|2[024-9]|3[015689]|4[02-9]|5[03-9]|7[0-35-9]|8[0-468]|9[0-57-9])|6(?:0[034689]|1\\d|2[0-35689]|[38][013-9]|4[1-467]|5[0-69]|6[13-9]|7[0-8]|9[0-24578])|7(?:0[0246-9]|2\\d|3[0236-8]|4[03-9]|5[0-46-9]|6[013-9]|7[0-35-9]|8[024-9]|9[02-9])|8(?:0[35-9]|2[1-57-9]|3[02-578]|4[0-578]|5[124-9]|6[2-69]|7\\d|8[02-9]|9[02569])|9(?:0[02-589]|[18]\\d|2[02-689]|3[1-57-9]|4[2-9]|5[0-579]|6[2-47-9]|7[0-24578]|9[2-57]))\\d)\\d)|2(?:0[013478]|3[0189]|4[017]|8[0-46-9]|9[0-2])\\d{3})\\d{4}|1(?:2(?:0(?:46[1-4]|87[2-9])|545[1-79]|76(?:2\\d|3[1-8]|6[1-6])|9(?:7(?:2[0-4]|3[2-5])|8(?:2[2-8]|7[0-47-9]|8[3-5])))|3(?:6(?:38[2-5]|47[23])|8(?:47[04-9]|64[0157-9]))|4(?:044[1-7]|20(?:2[23]|8\\d)|6(?:0(?:30|5[2-57]|6[1-8]|7[2-8])|140)|8(?:052|87[1-3]))|5(?:2(?:4(?:3[2-79]|6\\d)|76\\d)|6(?:26[06-9]|686))|6(?:06(?:4\\d|7[4-79])|295[5-7]|35[34]\\d|47(?:24|61)|59(?:5[08]|6[67]|74)|9(?:55[0-4]|77[23]))|7(?:26(?:6[13-9]|7[0-7])|(?:442|688)\\d|50(?:2[0-3]|[3-68]2|76))|8(?:27[56]\\d|37(?:5[2-5]|8[239])|843[2-58])|9(?:0(?:0(?:6[1-8]|85)|52\\d)|3583|4(?:66[1-8]|9(?:2[01]|81))|63(?:23|3[1-4])|9561))\\d{3}",[9,10]],["7(?:457[0-57-9]|700[01]|911[028])\\d{5}|7(?:[1-3]\\d\\d|4(?:[0-46-9]\\d|5[0-689])|5(?:0[0-8]|[13-9]\\d|2[0-35-9])|7(?:0[1-9]|[1-7]\\d|8[02-9]|9[0-689])|8(?:[014-9]\\d|[23][0-8])|9(?:[024-9]\\d|1[02-9]|3[0-689]))\\d{6}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[2-49]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}",[10]],["56\\d{8}",[10]]],0," x"],GD:["1","011","(?:473|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","473$1",0,"473"],GE:["995","00","(?:[3-57]\\d\\d|800)\\d{6}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["32"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[57]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[348]"],"0$1"]],"0"],GF:["594","00","(?:694\\d|7093)\\d{5}|(?:59|[89]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-7]|80[6-9]|9[47]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[89]"],"0$1"]],"0"],GG:["44","00","(?:1481|[357-9]\\d{3})\\d{6}|8\\d{6}(?:\\d{2})?",[7,9,10],0,"0",0,"([25-9]\\d{5})$|0|180020","1481$1",0,0,[["1481[25-9]\\d{5}",[10]],["7(?:(?:781|839)\\d|911[17])\\d{5}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[0-3]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}",[10]],["56\\d{8}",[10]]]],GH:["233","00","[235]\\d{8}|800\\d{5,6}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[2358]"],"0$1"]],"0"],GI:["350","00","(?:[25]\\d|60)\\d{6}",[8],[["(\\d{3})(\\d{5})","$1 $2",["2"]]]],GL:["299","00","(?:19|[2-689]\\d|70)\\d{4}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["19|[2-9]"]]]],GM:["220","00","[2-9]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],GN:["224","00","722\\d{6}|(?:3|6\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["3"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[67]"]]]],GP:["590","00","7090\\d{5}|(?:[56]9|[89]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-79]|80[6-9]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0",0,0,0,0,0,[["(?:59(?:0(?:0[1-68]|[14][0-24-9]|2[0-68]|3[1-9]|5[3-579]|[68][0-689]|7[08]|9\\d)|87\\d)|80[6-9]\\d\\d)\\d{4}"],["(?:69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))|7090[0-4])\\d{4}"],["80[0-5]\\d{6}"],["8[129]\\d{7}"],0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-6])\\d{4}"]]],GQ:["240","00","222\\d{6}|(?:3\\d|55|[89]0)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235]"]],["(\\d{3})(\\d{6})","$1 $2",["[89]"]]]],GR:["30","00","5005000\\d{3}|8\\d{9,11}|(?:[269]\\d|70)\\d{8}",[10,11,12],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["21|7"]],["(\\d{4})(\\d{6})","$1 $2",["2(?:2|3[2-57-9]|4[2-469]|5[2-59]|6[2-9]|7[2-69]|8[2-49])|5"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2689]"]],["(\\d{3})(\\d{3,4})(\\d{5})","$1 $2 $3",["8"]]]],GT:["502","00","80\\d{6}|(?:1\\d{3}|[2-7])\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1 $2",["[2-8]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]]],GU:["1","011","(?:[58]\\d\\d|671|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","671$1",0,"671"],GW:["245","00","[49]\\d{8}|4\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["40"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"]]]],GY:["592","001","(?:[2-8]\\d{3}|9008)\\d{3}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],HK:["852","00(?:30|5[09]|[126-9]?)","8[0-46-9]\\d{6,7}|9\\d{4,7}|(?:[2-7]|9\\d{3})\\d{7}",[5,6,7,8,9,11],[["(\\d{3})(\\d{2,5})","$1 $2",["900","9003"]],["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[1-4]|9(?:0[1-9]|[1-8])"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{3})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]],0,0,0,0,0,0,0,"00"],HN:["504","00","8\\d{10}|[237-9]\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1-$2",["[237-9]"]]]],HR:["385","00","[2-69]\\d{8}|80\\d{5,7}|[1-79]\\d{7}|6\\d{6}",[7,8,9],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["6[01]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{4})(\\d{3})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["6|7[245]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-57]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"]],"0"],HT:["509","00","[2-589]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[2-589]"]]]],HU:["36","00","[235-7]\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27][2-9]|3[2-7]|4[24-9]|5[2-79]|6|8[2-57-9]|9[2-69]"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"06 $1"]],"06"],ID:["62","00[89]","00[1-9]\\d{9,14}|(?:[1-36]|8\\d{5})\\d{6}|00\\d{9}|[1-9]\\d{8,10}|[2-9]\\d{7}",[7,8,9,10,11,12,13,14,15,16,17],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["15"]],["(\\d{2})(\\d{5,9})","$1 $2",["2[124]|[36]1"],"(0$1)"],["(\\d{3})(\\d{5,7})","$1 $2",["800"],"0$1"],["(\\d{3})(\\d{5,8})","$1 $2",["[2-79]"],"(0$1)"],["(\\d{3})(\\d{3,4})(\\d{3})","$1-$2-$3",["8[1-35-9]"],"0$1"],["(\\d{3})(\\d{6,8})","$1 $2",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["804"],"0$1"],["(\\d{3})(\\d)(\\d{3})(\\d{3})","$1 $2 $3 $4",["80"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1-$2-$3",["8"],"0$1"]],"0"],IE:["353","00","(?:1\\d|[2569])\\d{6,8}|4\\d{6,9}|7\\d{8}|8\\d{8,9}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["2[24-9]|47|58|6[237-9]|9[35-9]"],"(0$1)"],["(\\d{3})(\\d{5})","$1 $2",["[45]0"],"(0$1)"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["1"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2569]|4[1-69]|7[14]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["81"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[78]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["4"],"(0$1)"],["(\\d{2})(\\d)(\\d{3})(\\d{4})","$1 $2 $3 $4",["8"],"0$1"]],"0"],IL:["972","0(?:0|1[2-9])","1\\d{6}(?:\\d{3,5})?|[57]\\d{8}|[1-489]\\d{7}",[7,8,9,10,11,12],[["(\\d{4})(\\d{3})","$1-$2",["125"]],["(\\d{4})(\\d{2})(\\d{2})","$1-$2-$3",["121"]],["(\\d)(\\d{3})(\\d{4})","$1-$2-$3",["[2-489]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1-$2-$3",["12"]],["(\\d{4})(\\d{6})","$1-$2",["159"]],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3-$4",["1[7-9]"]],["(\\d{3})(\\d{1,2})(\\d{3})(\\d{4})","$1-$2 $3-$4",["15"]]],"0"],IM:["44","00","1624\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"([25-8]\\d{5})$|0|180020","1624$1",0,"74576|(?:16|7[56])24"],IN:["91","00","(?:000800|[2-9]\\d\\d)\\d{7}|1\\d{7,12}",[8,9,10,11,12,13],[["(\\d{8})","$1",["5(?:0|2[23]|3[03]|[67]1|88)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|888)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|8888)"],0,1],["(\\d{4})(\\d{4,5})","$1 $2",["180","1800"],0,1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["140"],0,1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["11|2[02]|33|4[04]|79[1-7]|80[2-46]","11|2[02]|33|4[04]|79(?:[1-6]|7[19])|80(?:[2-4]|6[0-589])","11|2[02]|33|4[04]|79(?:[124-6]|3(?:[02-9]|1[0-24-9])|7(?:1|9[1-6]))|80(?:[2-4]|6[0-589])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1(?:2[0-249]|3[0-25]|4[145]|[68]|7[1257])|2(?:1[257]|3[013]|4[01]|5[0137]|6[0158]|78|8[1568])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|5[12]|[78]1)|6(?:12|[2-4]1|5[17]|6[13]|80)|7(?:12|3[134]|61|88)|8(?:16|2[014]|3[126]|6[136]|7[078]|8[34]|91)|(?:43|59|75)[15]|(?:1[59]|29|67)[14]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|674|7(?:(?:3[34]|5[15])[2-6]|61[346]|88[0-8])|8(?:70[2-6]|84[235-7]|91[3-7])|(?:1(?:29|60|8[06])|261|552|6(?:12|[2-47]1|5[17]|6[13]|80)|7(?:12|31)|8(?:16|2[014]|3[126]|6[136]|7[78]|83))[2-7]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|6(?:12(?:[2-6]|7[0-8])|74[2-7])|7(?:3171|5[15][2-6]|61[346]|88(?:[2-7]|82))|8(?:70[2-6]|84(?:[2356]|7[19])|91(?:[3-6]|7[19]))|73[134][2-6]|8(?:16|2[014]|3[126]|6[136]|7[78]|83)(?:[2-6]|7[19])|(?:1(?:29|60|8[06])|261|552|6(?:[2-4]1|5[17]|6[13]|7(?:1|4[0189])|80)|7(?:12|88[01]))[2-7]"],"0$1",1],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2[2457-9]|3[2-5]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1[013-9]|3[129]|5[29]|6[02-5]|70)|807","1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2(?:[2457]|84|95)|3(?:[2-4]|55)|4[235-7]|5[2-689]|6[24578]|7(?:[23569]|8[0-57-9])|8[1-6])|7(?:1(?:[013-8]|9[6-9])|3(?:17|2[0-49]|9[2-57])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4|5[0-367])|70[13-7])|807[19]","1(?:[2-479]|5(?:[0236-9]|5[013-9]))|[2-5]|6(?:2(?:84|95)|355|8(?:28[235-7]|3))|73179|807(?:1|9[1-3])|(?:1552|6(?:(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578])\\d|7(?:[23569]\\d|8[0-57-9])|8(?:[14-6]\\d|2[0-79]))|7(?:1(?:[013-8]\\d|9[6-9])|3(?:2[0-49]|9[2-57])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4\\d|5[0-367])|70[13-7]))[2-7]"],"0$1",1],["(\\d{5})(\\d{5})","$1 $2",["16|[6-9]"],"0$1",1],["(\\d{4})(\\d{2,4})(\\d{4})","$1 $2 $3",["18[06]","18[06]0"],0,1],["(\\d{4})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["18"],0,1]],"0"],IO:["246","00","3\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["3"]]]],IQ:["964","00","(?:1|7\\d\\d)\\d{7}|[2-6]\\d{7,8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-6]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"]],"0"],IR:["98","00","[1-9]\\d{9}|(?:[1-8]\\d\\d|9)\\d{3,4}",[4,5,6,7,10],[["(\\d{4,5})","$1",["96"],"0$1"],["(\\d{2})(\\d{4,5})","$1 $2",["(?:1[137]|2[13-68]|3[1458]|4[145]|5[1468]|6[16]|7[1467]|8[13467])[12689]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[1-8]"],"0$1"]],"0"],IS:["354","00|1(?:0(?:01|[12]0)|100)","(?:38\\d|[4-9])\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["[4-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["3"]]],0,0,0,0,0,0,0,"00"],IT:["39","00","0\\d{5,11}|1\\d{8,10}|3(?:[0-8]\\d{7,10}|9\\d{7,8})|(?:43|55|70)\\d{8}|8\\d{5}(?:\\d{2,4})?",[6,7,8,9,10,11,12],[["(\\d{2})(\\d{4,6})","$1 $2",["0[26]"]],["(\\d{3})(\\d{3,6})","$1 $2",["0[13-57-9][0159]|8(?:03|4[17]|9[2-5])","0[13-57-9][0159]|8(?:03|4[17]|9(?:2|3[04]|[45][0-4]))"]],["(\\d{4})(\\d{2,6})","$1 $2",["0(?:[13-579][2-46-8]|8[236-8])"]],["(\\d{4})(\\d{4})","$1 $2",["894"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[26]|5"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["1(?:44|[679])|[378]|43"]],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[13-57-9][0159]|14"]],["(\\d{2})(\\d{4})(\\d{5})","$1 $2 $3",["0[26]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["[03]"]]],0,0,0,0,0,0,[["0(?:669[0-79]\\d{1,6}|831\\d{2,8})|0(?:1(?:[0159]\\d|[27][1-5]|31|4[1-4]|6[1356]|8[2-57])|2\\d\\d|3(?:[0159]\\d|2[1-4]|3[12]|[48][1-6]|6[2-59]|7[1-7])|4(?:[0159]\\d|[23][1-9]|4[245]|6[1-5]|7[1-4]|81)|5(?:[0159]\\d|2[1-5]|3[2-6]|4[1-79]|6[4-6]|7[1-578]|8[3-8])|6(?:[0-57-9]\\d|6[0-8])|7(?:[0159]\\d|2[12]|3[1-7]|4[2-46]|6[13569]|7[13-6]|8[1-59])|8(?:[0159]\\d|2[3-578]|3[2356]|[6-8][1-5])|9(?:[0159]\\d|[238][1-5]|4[12]|6[1-8]|7[1-6]))\\d{2,7}"],["3[2-9]\\d{7,8}|(?:31|43)\\d{8}",[9,10]],["80(?:0\\d{3}|3)\\d{3}",[6,9]],["(?:0878\\d{3}|89(?:2\\d|3[04]|4(?:[0-4]|[5-9]\\d\\d)|5[0-4]))\\d\\d|(?:1(?:44|6[346])|89(?:38|5[5-9]|9))\\d{6}",[6,8,9,10]],["1(?:78\\d|99)\\d{6}",[9,10]],["3[2-8]\\d{9,10}",[11,12]],0,0,["55\\d{8}",[10]],["84(?:[08]\\d{3}|[17])\\d{3}",[6,9]]]],JE:["44","00","1534\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"([0-24-8]\\d{5})$|0|180020","1534$1",0,0,[["1534[0-24-8]\\d{5}"],["7(?:(?:(?:50|82)9|937)\\d|7(?:00[378]|97\\d))\\d{5}"],["80(?:07(?:35|81)|8901)\\d{4}"],["(?:8(?:4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|90(?:066[59]|1810|71(?:07|55)))\\d{4}"],["701511\\d{4}"],0,["(?:3(?:0(?:07(?:35|81)|8901)|3\\d{4}|4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|55\\d{4})\\d{4}"],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}"],["56\\d{8}"]]],JM:["1","011","(?:[58]\\d\\d|658|900)\\d{7}",[10],0,"1",0,0,0,0,"658|876"],JO:["962","00","(?:(?:[2689]|7\\d)\\d|32|427|53)\\d{6}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2356]|87"],"(0$1)"],["(\\d{3})(\\d{5,6})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["70"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[47]"],"0$1"]],"0"],JP:["81","010","00[1-9]\\d{6,14}|[25-9]\\d{9}|(?:00|[1-9]\\d\\d)\\d{6}",[8,9,10,11,12,13,14,15,16,17],[["(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3",["(?:12|57|99)0"],"0$1"],["(\\d{4})(\\d)(\\d{4})","$1-$2-$3",["1(?:26|3[79]|4[56]|5[4-68]|6[3-5])|499|5(?:76|97)|746|8(?:3[89]|47|51)|9(?:80|9[16])","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:76|97)9|7468|8(?:3(?:8[7-9]|96)|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:769|979[2-69])|7468|8(?:3(?:8[7-9]|96[2457-9])|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["60"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2-$3",["3|4(?:2[09]|7[01])|6[1-9]","3|4(?:2(?:0|9[02-69])|7(?:0[019]|1))|6[1-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["1(?:1|5[45]|77|88|9[69])|2(?:2[1-37]|3[0-269]|4[59]|5|6[24]|7[1-358]|8[1369]|9[0-38])|4(?:[28][1-9]|3[0-57]|[45]|6[248]|7[2-579]|9[29])|5(?:2|3[0459]|4[0-369]|5[29]|8[02389]|9[0-389])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9[2-6])|8(?:2[124589]|3[26-9]|49|51|6|7[0-468]|8[68]|9[019])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9[1-489])","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2(?:[127]|3[014-9])|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9[19])|62|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|8[1-9]|9[29])|5(?:2|3(?:[045]|9[0-8])|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0-2469])|3(?:[29]|60)|49|51|6(?:[0-24]|36|5[0-3589]|7[23]|9[01459])|7[0-468]|8[68])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9(?:[1289]|3[34]|4[0178]))|(?:264|837)[016-9]|2(?:57|93)[015-9]|(?:25[0468]|422|838)[01]|(?:47[59]|59[89]|8(?:6[68]|9))[019]","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2[127]|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9(?:17|99))|6(?:2|4[016-9])|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|9[29])|5(?:2|3(?:[045]|9(?:[0-58]|6[4-9]|7[0-35689]))|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0169])|3(?:[29]|60|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[2-57-9]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|7(?:2[2-468]|3[78])|9[0145])|7[0-468]|8[68])|9(?:4[15]|5[138]|7[156]|8[189]|9(?:[1289]|3(?:31|4[357])|4[0178]))|(?:8294|96)[1-3]|2(?:57|93)[015-9]|(?:223|8699)[014-9]|(?:25[0468]|422|838)[01]|(?:48|8292|9[23])[1-9]|(?:47[59]|59[89]|8(?:68|9))[019]"],"0$1"],["(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3",["[14]|[289][2-9]|5[3-9]|7[2-4679]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["800"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[25-9]"],"0$1"]],"0",0,"(000[2569]\\d{4,6})$|(?:(?:003768)0?)|0","$1"],KE:["254","000","(?:[17]\\d\\d|900)\\d{6}|(?:2|80)0\\d{6,7}|[4-6]\\d{6,8}",[7,8,9,10],[["(\\d{2})(\\d{5,7})","$1 $2",["[24-6]"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[17]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0"],KG:["996","00","8\\d{9}|[235-9]\\d{8}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["3(?:1[346]|[24-79])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235-79]|88"],"0$1"],["(\\d{3})(\\d{3})(\\d)(\\d{2,3})","$1 $2 $3 $4",["8"],"0$1"]],"0"],KH:["855","00[14-9]","1\\d{9}|[1-9]\\d{7,8}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],KI:["686","00","(?:[37]\\d|6[0-79])\\d{6}|(?:[2-48]\\d|50)\\d{3}",[5,8],0,"0"],KM:["269","00","[3478]\\d{6}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[3478]"]]]],KN:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","869$1",0,"869"],KP:["850","00|99","85\\d{6}|(?:19\\d|[2-7])\\d{7}",[8,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"]],"0"],KR:["82","00(?:[125689]|3(?:[46]5|91)|7(?:00|27|3|55|6[126]))","00[1-9]\\d{8,11}|(?:[12]|5\\d{3})\\d{7}|[13-6]\\d{9}|(?:[1-6]\\d|80)\\d{7}|[3-6]\\d{4,5}|(?:00|7)0\\d{8}",[5,6,8,9,10,11,12,13,14],[["(\\d{2})(\\d{3,4})","$1-$2",["(?:3[1-3]|[46][1-4]|5[1-5])1"],"0$1"],["(\\d{4})(\\d{4})","$1-$2",["1"]],["(\\d)(\\d{3,4})(\\d{4})","$1-$2-$3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["[36]0|8"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1-$2-$3",["[1346]|5[1-5]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{2})(\\d{5})(\\d{4})","$1-$2-$3",["5"],"0$1"]],"0",0,"0(8(?:[1-46-8]|5\\d\\d))?"],KW:["965","00","18\\d{5}|(?:[2569]\\d|41)\\d{6}",[7,8],[["(\\d{4})(\\d{3,4})","$1 $2",["[169]|2(?:[235]|4[1-35-9])|52"]],["(\\d{3})(\\d{5})","$1 $2",["[245]"]]]],KY:["1","011","(?:345|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","345$1",0,"345"],KZ:["7","810","8\\d{13}|[78]\\d{9}",[10,14],0,"8",0,0,0,0,"7",0,"8~10"],LA:["856","00","[23]\\d{9}|3\\d{8}|(?:[235-8]\\d|41)\\d{6}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2[13]|3[14]|[4-8]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["3"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[23]"],"0$1"]],"0"],LB:["961","00","[27-9]\\d{7}|[13-9]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[13-69]|7(?:[2-57]|62|8[0-6]|9[04-9])|8[02-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27-9]"]]],"0"],LC:["1","011","(?:[58]\\d\\d|758|900)\\d{7}",[10],0,"1",0,"([2-8]\\d{6})$|1","758$1",0,"758"],LI:["423","00","[68]\\d{8}|(?:[2378]\\d|90)\\d{5}",[7,9],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2379]|8(?:0[09]|7)","[2379]|8(?:0(?:02|9)|7)"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["69"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]],"0",0,"(1001)|0"],LK:["94","00","[1-9]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[1-689]"],"0$1"]],"0"],LR:["231","00","(?:[2457]\\d|33|88)\\d{7}|(?:2\\d|[4-6])\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["4[67]|[56]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[2-578]"],"0$1"]],"0"],LS:["266","00","(?:[256]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2568]"]]]],LT:["370","00","(?:[3469]\\d|52|[78]0)\\d{6}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["52[0-7]"],"(0-$1)",1],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[7-9]"],"0 $1",1],["(\\d{2})(\\d{6})","$1 $2",["37|4(?:[15]|6[1-8])"],"(0-$1)",1],["(\\d{3})(\\d{5})","$1 $2",["[3-6]"],"(0-$1)",1]],"0",0,"[08]"],LU:["352","00","35[013-9]\\d{4,8}|6\\d{8}|35\\d{2,4}|(?:[2457-9]\\d|3[0-46-9])\\d{2,9}",[4,5,6,7,8,9,10,11],[["(\\d{2})(\\d{3})","$1 $2",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["20[2-689]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4",["20"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,5})","$1 $2 $3 $4",["[3-57]|8[13-9]|9(?:0[89]|[2-579])|(?:2|80)[2-9]"]],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["80[01]|90[015]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["20"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4 $5",["20"]]],0,0,"(15(?:0[06]|1[12]|[35]5|4[04]|6[26]|77|88|99)\\d)"],LV:["371","00","(?:[268]\\d|78|90)\\d{6}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2679]|8[01]"]]]],LY:["218","00","[2-9]\\d{8}",[9],[["(\\d{2})(\\d{7})","$1-$2",["[2-9]"],"0$1"]],"0"],MA:["212","00","[5-8]\\d{8}",[9],[["(\\d{4})(\\d{5})","$1-$2",["892"],"0$1"],["(\\d{2})(\\d{7})","$1-$2",["8(?:0[0-7]|9)"],"0$1"],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[5-8]"],"0$1"]],"0",0,0,0,0,"[5-8]"],MC:["377","00","(?:[3489]|[67]\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["4"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[389]"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[67]"],"0$1"]],"0"],MD:["373","00","(?:[235-7]\\d|[89]0)\\d{6}",[8],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["22|3"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[25-7]"],"0$1"]],"0"],ME:["382","00","(?:20|[3-79]\\d)\\d{6}|80\\d{6,7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"0$1"]],"0"],MF:["590","00","7090\\d{5}|(?:[56]9|[89]\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["(?:59(?:0(?:0[079]|[14]3|[27][79]|3[03-7]|5[0-268]|87)|87\\d)|80[6-9]\\d\\d)\\d{4}"],["(?:69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))|7090[0-4])\\d{4}"],["80[0-5]\\d{6}"],["8[129]\\d{7}"],0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-6])\\d{4}"]]],MG:["261","00","[23]\\d{8}",[9],[["(\\d{2})(\\d{2})(\\d{3})(\\d{2})","$1 $2 $3 $4",["[23]"],"0$1"]],"0",0,"([24-9]\\d{6})$|0","20$1"],MH:["692","011","329\\d{4}|(?:[256]\\d|45)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1-$2",["[2-6]"]]],"1"],MK:["389","00","[2-578]\\d{7}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2|34[47]|4(?:[37]7|5[47]|64)"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[347]"],"0$1"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["[58]"],"0$1"]],"0"],ML:["223","00","[24-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-9]"]]]],MM:["95","00","1\\d{5,7}|95\\d{6}|(?:[4-7]|9[0-46-9])\\d{6,8}|(?:2|8\\d)\\d{5,8}",[6,7,8,9,10],[["(\\d)(\\d{2})(\\d{3})","$1 $2 $3",["16|2"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["4(?:[2-46]|5[3-5])|5|6(?:[1-689]|7[235-7])|7(?:[0-4]|5[2-7])|8[1-5]|(?:60|86)[23]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]|452|678|86","[12]|452|6788|86"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[4-7]|8[1-35]"],"0$1"],["(\\d)(\\d{3})(\\d{4,6})","$1 $2 $3",["9(?:2[0-4]|[35-9]|4[137-9])"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["92"],"0$1"],["(\\d)(\\d{5})(\\d{4})","$1 $2 $3",["9"],"0$1"]],"0"],MN:["976","001","[12]\\d{7,9}|[5-9]\\d{7}",[8,9,10],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["11|2[16]"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[5-9]"]],["(\\d{3})(\\d{5,6})","$1 $2",["[12]2[1-3]"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["[12](?:27|3[2-8]|4[2-68]|5[1-4689])","[12](?:27|3[2-8]|4[2-68]|5[1-4689])[0-3]"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["[12]"],"0$1"]],"0"],MO:["853","00","0800\\d{3}|(?:28|[68]\\d)\\d{6}",[7,8],[["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{4})(\\d{4})","$1 $2",["[268]"]]]],MP:["1","011","[58]\\d{9}|(?:67|90)0\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","670$1",0,"670"],MQ:["596","00","7091\\d{5}|(?:[56]9|[89]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-79]|8(?:0[6-9]|[36])"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],MR:["222","00","(?:[2-4]\\d\\d|800)\\d{5}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-48]"]]]],MS:["1","011","(?:[58]\\d\\d|664|900)\\d{7}",[10],0,"1",0,"([34]\\d{6})$|1","664$1",0,"664"],MT:["356","00","3550\\d{4}|(?:[2579]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2357-9]"]]]],MU:["230","0(?:0|[24-7]0|3[03])","(?:[57]|8\\d\\d)\\d{7}|[2-468]\\d{6}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[2-46]|8[013]"]],["(\\d{4})(\\d{4})","$1 $2",["[57]"]],["(\\d{5})(\\d{5})","$1 $2",["8"]]],0,0,0,0,0,0,0,"020"],MV:["960","0(?:0|19)","(?:800|9[0-57-9]\\d)\\d{7}|[34679]\\d{6}",[7,10],[["(\\d{3})(\\d{4})","$1-$2",["[34679]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"]]],0,0,0,0,0,0,0,"00"],MW:["265","00","(?:[1289]\\d|31|77)\\d{7}|1\\d{6}",[7,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["1[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[137-9]"],"0$1"]],"0"],MX:["52","0[09]","[2-9]\\d{9}",[10],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["33|5[56]|81"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2-9]"]]],0,0,0,0,0,0,0,"00"],MY:["60","00","1\\d{8,9}|(?:3\\d|[4-9])\\d{7}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1-$2 $3",["[4-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1-$2 $3",["1(?:[02469]|[378][1-9]|53)|8","1(?:[02469]|[37][1-9]|53|8(?:[1-46-9]|5[7-9]))|8"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2 $3",["3"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3-$4",["1(?:[367]|80)"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2 $3",["15"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2 $3",["1"],"0$1"]],"0"],MZ:["258","00","(?:2|8\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2|8[2-79]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]]],NA:["264","00","[68]\\d{7,8}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["87"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0"],NC:["687","00","(?:050|[2-57-9]\\d\\d)\\d{3}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1.$2.$3",["[02-57-9]"]]]],NE:["227","00","[027-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["08"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[089]|2[013]|7[0467]"]]]],NF:["672","00","[13]\\d{5}",[6],[["(\\d{2})(\\d{4})","$1 $2",["1[0-3]"]],["(\\d)(\\d{5})","$1 $2",["[13]"]]],0,0,"([0-258]\\d{4})$","3$1"],NG:["234","009","(?:20|9\\d)\\d{8}|[78]\\d{9,13}",[10,11,12,13,14],[["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[7-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["20[129]"],"0$1"],["(\\d{4})(\\d{2})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["[78]"],"0$1"],["(\\d{3})(\\d{5})(\\d{5,6})","$1 $2 $3",["[78]"],"0$1"]],"0"],NI:["505","00","(?:1800|[25-8]\\d{3})\\d{4}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[125-8]"]]]],NL:["31","00","(?:[124-7]\\d\\d|3(?:[02-9]\\d|1[0-8]))\\d{6}|8\\d{6,9}|9\\d{6,10}|1\\d{4,5}",[5,6,7,8,9,10,11],[["(\\d{3})(\\d{4,7})","$1 $2",["[89]0"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["66"],"0$1"],["(\\d)(\\d{8})","$1 $2",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["1[16-8]|2[259]|3[124]|4[17-9]|5[124679]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-578]|91"],"0$1"],["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3",["9"],"0$1"]],"0"],NO:["47","00","(?:0|[2-9]\\d{3})\\d{4}",[5,8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["8"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-79]"]]],0,0,0,0,0,"[02-689]|7[0-8]"],NP:["977","00","(?:1\\d|9)\\d{9}|[1-9]\\d{7}",[8,10,11],[["(\\d)(\\d{7})","$1-$2",["1[2-6]"],"0$1"],["(\\d{2})(\\d{6})","$1-$2",["1[01]|[2-8]|9(?:[1-59]|[67][2-6])"],"0$1"],["(\\d{3})(\\d{7})","$1-$2",["9"]]],"0"],NR:["674","00","(?:222|444|(?:55|8\\d)\\d|666|777|999)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[24-9]"]]]],NU:["683","00","(?:[4-7]|888\\d)\\d{3}",[4,7],[["(\\d{3})(\\d{4})","$1 $2",["8"]]]],NZ:["64","0(?:0|161)","[1289]\\d{9}|50\\d{5}(?:\\d{2,3})?|[27-9]\\d{7,8}|(?:[34]\\d|6[0-35-9])\\d{6}|8\\d{4,6}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,8})","$1 $2",["8[1-79]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["50[036-8]|8|90","50(?:[0367]|88)|8|90"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["24|[346]|7[2-57-9]|9[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:10|74)|[589]"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["1|2[028]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,5})","$1 $2 $3",["2(?:[169]|7[0-35-9])|7"],"0$1"]],"0",0,0,0,0,0,0,"00"],OM:["968","00","(?:1505|[279]\\d{3}|500)\\d{4}|800\\d{5,6}",[7,8,9],[["(\\d{3})(\\d{4,6})","$1 $2",["[58]"]],["(\\d{2})(\\d{6})","$1 $2",["2"]],["(\\d{4})(\\d{4})","$1 $2",["[179]"]]]],PA:["507","00","(?:00800|8\\d{3})\\d{6}|[68]\\d{7}|[1-57-9]\\d{6}",[7,8,10,11],[["(\\d{3})(\\d{4})","$1-$2",["[1-57-9]"]],["(\\d{4})(\\d{4})","$1-$2",["[68]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]]],PE:["51","00|19(?:1[124]|77|90)00","(?:[14-8]|9\\d)\\d{7}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["80"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["1"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[4-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"]]],"0",0,0,0,0,0,0,"00"," Anexo "],PF:["689","00","4\\d{5}(?:\\d{2})?|8\\d{7,8}",[6,8,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["44"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4|8[7-9]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]]],PG:["675","00|140[1-3]","(?:180|[78]\\d{3})\\d{4}|(?:[2-589]\\d|64)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["18|[2-69]|85"]],["(\\d{4})(\\d{4})","$1 $2",["[78]"]]],0,0,0,0,0,0,0,"00"],PH:["63","00","(?:[2-7]|9\\d)\\d{8}|2\\d{5}|(?:1800|8)\\d{7,9}",[6,8,9,10,11,12,13],[["(\\d)(\\d{5})","$1 $2",["2"],"(0$1)"],["(\\d{4})(\\d{4,6})","$1 $2",["3(?:23|39|46)|4(?:2[3-6]|[35]9|4[26]|76)|544|88[245]|(?:52|64|86)2","3(?:230|397|461)|4(?:2(?:35|[46]4|51)|396|4(?:22|63)|59[347]|76[15])|5(?:221|446)|642[23]|8(?:622|8(?:[24]2|5[13]))"],"(0$1)"],["(\\d{5})(\\d{4})","$1 $2",["346|4(?:27|9[35])|883","3469|4(?:279|9(?:30|56))|8834"],"(0$1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|8[2-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{4})(\\d{1,2})(\\d{3})(\\d{4})","$1 $2 $3 $4",["1"]]],"0"],PK:["92","00","122\\d{6}|[24-8]\\d{10,11}|9(?:[013-9]\\d{8,10}|2(?:[01]\\d\\d|2(?:[06-8]\\d|1[01]))\\d{7})|(?:[2-8]\\d{3}|92(?:[0-7]\\d|8[1-9]))\\d{6}|[24-9]\\d{8}|[89]\\d{7}",[8,9,10,11,12],[["(\\d{3})(\\d{3})(\\d{2,7})","$1 $2 $3",["[89]0"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["1"]],["(\\d{3})(\\d{6,7})","$1 $2",["2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:2[2-8]|3[27-9]|4[2-6]|6[3569]|9[25-8])","9(?:2[3-8]|98)|(?:2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:22|3[27-9]|4[2-6]|6[3569]|9[25-7]))[2-9]"],"(0$1)"],["(\\d{2})(\\d{7,8})","$1 $2",["(?:2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91)[2-9]"],"(0$1)"],["(\\d{5})(\\d{5})","$1 $2",["58"],"(0$1)"],["(\\d{3})(\\d{7})","$1 $2",["3"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[24-9]"],"(0$1)"]],"0"],PL:["48","00","(?:6|8\\d\\d)\\d{7}|[1-9]\\d{6}(?:\\d{2})?|[26]\\d{5}",[6,7,8,9,10],[["(\\d{5})","$1",["19"]],["(\\d{3})(\\d{3})","$1 $2",["11|20|64"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["30|(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])1","30|(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])19"]],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["64"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["21|39|45|5[0137]|6[0469]|7[02389]|8(?:0[14]|8)"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[2-8]|[2-7]|8[1-79]|9[145]"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["8"]]]],PM:["508","00","[78]\\d{8}|[2-9]\\d{5}",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],PR:["1","011","(?:[589]\\d\\d|787)\\d{7}",[10],0,"1",0,0,0,0,"787|939"],PS:["970","00","[2489]2\\d{6}|(?:1\\d|5)\\d{8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2489]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["5"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],PT:["351","00","1693\\d{5}|(?:[26-9]\\d|30)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["2[12]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["16|[236-9]"]]]],PW:["680","01[12]","(?:[24-8]\\d\\d|345|900)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],PY:["595","00","[36-8]\\d{5,8}|4\\d{6,8}|59\\d{6}|9\\d{5,10}|(?:2\\d|5[0-8])\\d{6,7}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3,6})","$1 $2",["[2-9]0"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["3[289]|4[246-8]|61|7[1-3]|8[1-36]"],"(0$1)"],["(\\d{3})(\\d{4,5})","$1 $2",["2[279]|3[13-5]|4[359]|5|6(?:[34]|7[1-46-8])|7[46-8]|85"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2[14-68]|3[26-9]|4[1246-8]|6(?:1|75)|7[1-35]|8[1-36]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["87"]],["(\\d{3})(\\d{6})","$1 $2",["9(?:[5-79]|8[1-7])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["9"]]],"0"],QA:["974","00","800\\d{4}|(?:2|800)\\d{6}|(?:0080|[3-7])\\d{7}",[7,8,9,11],[["(\\d{3})(\\d{4})","$1 $2",["2[136]|8"]],["(\\d{4})(\\d{4})","$1 $2",["[3-7]"]]]],RE:["262","00","709\\d{6}|(?:26|[689]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[26-9]"],"0$1"]],"0",0,0,0,0,0,[["2631[0-6]\\d{4}|26(?:2\\d|30|88)\\d{5}"],["(?:69(?:2\\d\\d|3(?:[06][0-6]|1[0-3]|2[0-2]|3[0-39]|4\\d|5[0-5]|7[0-37]|8[0-8]|9[0-479]))|7092[0-3])\\d{4}"],["80\\d{7}"],["89[1-37-9]\\d{6}"],0,0,0,0,["9(?:399[0-3]|479[0-6]|76(?:2[278]|3[0-37]))\\d{4}"],["8(?:1[019]|2[0156]|84|90)\\d{6}"]]],RO:["40","00","(?:[236-8]\\d|90)\\d{7}|[23]\\d{5}",[6,9],[["(\\d{3})(\\d{3})","$1 $2",["2[3-6]","2[3-6]\\d9"],"0$1"],["(\\d{2})(\\d{4})","$1 $2",["219|31"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[23]1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[236-9]"],"0$1"]],"0",0,0,0,0,0,0,0," int "],RS:["381","00","38[02-9]\\d{6,9}|6\\d{7,9}|90\\d{4,8}|38\\d{5,6}|(?:7\\d\\d|800)\\d{3,9}|(?:[12]\\d|3[0-79])\\d{5,10}",[6,7,8,9,10,11,12],[["(\\d{3})(\\d{3,9})","$1 $2",["(?:2[389]|39)0|[7-9]"],"0$1"],["(\\d{2})(\\d{5,10})","$1 $2",["[1-36]"],"0$1"]],"0"],RU:["7","810","8\\d{13}|[347-9]\\d{9}",[10,14],[["(\\d{4})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-8]|2[1-9])","7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:1[23]|[2-9]2))","7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:13[03-69]|62[013-9]))|72[1-57-9]2"],"8 ($1)",1],["(\\d{5})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-68]|2[1-9])","7(?:1(?:[06][3-6]|[18]|2[35]|[3-5][3-5])|2(?:[13][3-5]|[24-689]|7[457]))","7(?:1(?:0(?:[356]|4[023])|[18]|2(?:3[013-9]|5)|3[45]|43[013-79]|5(?:3[1-8]|4[1-7]|5)|6(?:3[0-35-9]|[4-6]))|2(?:1(?:3[178]|[45])|[24-689]|3[35]|7[457]))|7(?:14|23)4[0-8]|71(?:33|45)[1-79]"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[349]|8(?:[02-7]|1[1-8])"],"8 ($1)",1],["(\\d{4})(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3 $4",["8"],"8 ($1)"]],"8",0,0,0,0,"[3489]",0,"8~10"],RW:["250","00","(?:06|[27]\\d\\d|[89]00)\\d{6}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[7-9]"],"0$1"]],"0"],SA:["966","00","(?:[15]\\d|800|92)\\d{7}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["9"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]],"0"],SB:["677","0[01]","[6-9]\\d{6}|[1-6]\\d{4}",[5,7],[["(\\d{2})(\\d{5})","$1 $2",["6[89]|7|8[4-9]|9(?:[1-8]|9[0-8])"]]]],SC:["248","010|0[0-2]","(?:[2489]\\d|64)\\d{5}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[246]|9[57]"]]],0,0,0,0,0,0,0,"00"],SD:["249","00","[19]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[19]"],"0$1"]],"0"],SE:["46","00","(?:[26]\\d\\d|9)\\d{9}|[1-9]\\d{8}|[1-689]\\d{7}|[1-4689]\\d{6}|2\\d{5}",[6,7,8,9,10,12],[["(\\d{2})(\\d{2,3})(\\d{2})","$1-$2 $3",["20"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{4})","$1-$2",["9(?:00|39|44|9)"],"0$1",0,"$1 $2"],["(\\d{2})(\\d{3})(\\d{2})","$1-$2 $3",["[12][136]|3[356]|4[0246]|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3"],["(\\d)(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2,3})(\\d{2})","$1-$2 $3",["1[2457]|2(?:[247-9]|5[0138])|3[0247-9]|4[1357-9]|5[0-35-9]|6(?:[125689]|4[02-57]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{2,3})(\\d{3})","$1-$2 $3",["9(?:00|39|44)"],"0$1",0,"$1 $2 $3"],["(\\d{2})(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["1[13689]|2[0136]|3[1356]|4[0246]|54|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3 $4"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["10|7"],"0$1",0,"$1 $2 $3 $4"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1-$2 $3 $4",["[13-5]|2(?:[247-9]|5[0138])|6(?:[124-689]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{3})","$1-$2 $3 $4",["9"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4 $5",["[26]"],"0$1",0,"$1 $2 $3 $4 $5"]],"0"],SG:["65","0[0-3]\\d","(?:(?:1\\d|8)\\d\\d|7000)\\d{7}|[3689]\\d{7}",[8,10,11],[["(\\d{4})(\\d{4})","$1 $2",["[369]|8(?:0[1-9]|[1-9])"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]],["(\\d{4})(\\d{4})(\\d{3})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]]],SH:["290","00","(?:[256]\\d|8)\\d{3}",[4,5],0,0,0,0,0,0,"[256]"],SI:["386","00|10(?:22|66|88|99)","[1-7]\\d{7}|8\\d{4,7}|90\\d{4,6}",[5,6,7,8],[["(\\d{2})(\\d{3,6})","$1 $2",["8[09]|9"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["59|8"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37][01]|4[0139]|51|6"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-57]"],"(0$1)"]],"0",0,0,0,0,0,0,"00"],SJ:["47","00","0\\d{4}|(?:[489]\\d|79)\\d{6}",[5,8],0,0,0,0,0,0,"79"],SK:["421","00","[2-689]\\d{8}|[2-59]\\d{6}|[2-5]\\d{5}",[6,7,9],[["(\\d)(\\d{2})(\\d{3,4})","$1 $2 $3",["21"],"0$1"],["(\\d{2})(\\d{2})(\\d{2,3})","$1 $2 $3",["[3-5][1-8]1","[3-5][1-8]1[67]"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[689]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[3-5]"],"0$1"]],"0"],SL:["232","00","(?:[237-9]\\d|66)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[236-9]"],"(0$1)"]],"0"],SM:["378","00","(?:0549|[5-7]\\d)\\d{6}",[8,10],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-7]"]],["(\\d{4})(\\d{6})","$1 $2",["0"]]],0,0,"([89]\\d{5})$","0549$1"],SN:["221","00","(?:[378]\\d|93)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[379]"]]]],SO:["252","00","[346-9]\\d{8}|[12679]\\d{7}|[1-5]\\d{6}|[1348]\\d{5}",[6,7,8,9],[["(\\d{2})(\\d{4})","$1 $2",["8[125]"]],["(\\d{6})","$1",["[134]"]],["(\\d)(\\d{6})","$1 $2",["[15]|2[0-79]|3[0-46-8]|4[0-7]"]],["(\\d)(\\d{7})","$1 $2",["(?:2|90)4|[67]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[348]|64|79|90"]],["(\\d{2})(\\d{5,7})","$1 $2",["1|28|6[0-35-9]|7[67]|9[2-9]"]]],"0"],SR:["597","00","(?:[2-5]|[6-9]\\d)\\d{5}",[6,7],[["(\\d{2})(\\d{2})(\\d{2})","$1-$2-$3",["56"]],["(\\d{3})(\\d{3})","$1-$2",["[2-5]"]],["(\\d{3})(\\d{4})","$1-$2",["[6-9]"]]]],SS:["211","00","[19]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[19]"],"0$1"]],"0"],ST:["239","00","(?:22|9\\d)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[29]"]]]],SV:["503","00","[25-7]\\d{7}|(?:80\\d|900)\\d{4}(?:\\d{4})?",[7,8,11],[["(\\d{3})(\\d{4})","$1 $2",["[89]"]],["(\\d{4})(\\d{4})","$1 $2",["[25-7]"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[89]"]]]],SX:["1","011","7215\\d{6}|(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"(5\\d{6})$|1","721$1",0,"721"],SY:["963","00","[1-359]\\d{8}|[1-5]\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-4]|5[1-3]"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[59]"],"0$1",1]],"0"],SZ:["268","00","0800\\d{4}|(?:[237]\\d|900)\\d{6}",[8,9],[["(\\d{4})(\\d{4})","$1 $2",["[0237]"]],["(\\d{5})(\\d{4})","$1 $2",["9"]]]],TA:["290","00","8\\d{3}",[4],0,0,0,0,0,0,"8"],TC:["1","011","(?:[58]\\d\\d|649|900)\\d{7}",[10],0,"1",0,"([2-479]\\d{6})$|1","649$1",0,"649"],TD:["235","00|16","(?:22|[3689]\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[236-9]"]]],0,0,0,0,0,0,0,"00"],TG:["228","00","[279]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[279]"]]]],TH:["66","00[1-9]","(?:001800|[2-57]|[689]\\d)\\d{7}|1\\d{7,9}",[8,9,10,13],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[13-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],TJ:["992","810","(?:[0-57-9]\\d|66)\\d{7}",[9],[["(\\d{6})(\\d)(\\d{2})","$1 $2 $3",["331","3317"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["44[02-479]|[34]7"]],["(\\d{4})(\\d)(\\d{4})","$1 $2 $3",["3(?:[1245]|3[12])"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["\\d"]]],0,0,0,0,0,0,0,"8~10"],TK:["690","00","[2-47]\\d{3,6}",[4,5,6,7]],TL:["670","00","7\\d{7}|(?:[2-47]\\d|[89]0)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[2-489]|70"]],["(\\d{4})(\\d{4})","$1 $2",["7"]]]],TM:["993","810","(?:[1-6]\\d|71)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["12"],"(8 $1)"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-5]"],"(8 $1)"],["(\\d{2})(\\d{6})","$1 $2",["[67]"],"8 $1"]],"8",0,0,0,0,0,0,"8~10"],TN:["216","00","[2-57-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-57-9]"]]]],TO:["676","00","(?:0800|(?:[5-8]\\d\\d|999)\\d)\\d{3}|[2-8]\\d{4}",[5,7],[["(\\d{2})(\\d{3})","$1-$2",["[2-4]|50|6[09]|7[0-24-69]|8[05]"]],["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{3})(\\d{4})","$1 $2",["[5-9]"]]]],TR:["90","00","4\\d{6}|8\\d{11,12}|(?:[2-58]\\d\\d|900)\\d{7}",[7,10,12,13],[["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["512|8[01589]|90"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["5(?:[0-579]|61)","5(?:[0-579]|61[06])","5(?:[0-579]|61[06]1)"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24][1-8]|3[1-9]"],"(0$1)",1],["(\\d{3})(\\d{3})(\\d{6,7})","$1 $2 $3",["80"],"0$1",1]],"0"],TT:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-46-8]\\d{6})$|1","868$1",0,"868"],TV:["688","00","(?:2|7\\d\\d|90)\\d{4}",[5,6,7],[["(\\d{2})(\\d{3})","$1 $2",["2"]],["(\\d{2})(\\d{4})","$1 $2",["90"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]]],TW:["886","0(?:0[25-79]|19)","[2-689]\\d{8}|7\\d{9,10}|[2-8]\\d{7}|2\\d{6}",[7,8,9,10,11],[["(\\d{2})(\\d)(\\d{4})","$1 $2 $3",["202"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["826"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["83"],"0$1"],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["82"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[25]0|37|49|8[09]"],"0$1"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["[23568]|4(?:0[02-48]|[1-478])|7[1-9]","[23568]|4(?:0[2-48]|[1-478])|(?:400|7)[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,5})","$1 $2 $3",["7"],"0$1"]],"0",0,0,0,0,0,0,0,"#"],TZ:["255","00[056]","(?:[25-8]\\d|41|90)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[24]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["5"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[67]"],"0$1"]],"0"],UA:["380","00","[89]\\d{9}|[3-9]\\d{8}",[9,10],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6[12][29]|(?:3[1-8]|4[136-8]|5[12457]|6[49])2|(?:56|65)[24]","6[12][29]|(?:35|4[1378]|5[12457]|6[49])2|(?:56|65)[24]|(?:3[1-46-8]|46)2[013-9]"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6[0135689]|7[4-6])|6(?:[12][3-7]|[459])","3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6(?:[015689]|3[02389])|7[4-6])|6(?:[12][3-7]|[459])"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|89|9[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0",0,0,0,0,0,0,"0~0"],UG:["256","00[057]","800\\d{6}|(?:[29]0|[347]\\d)\\d{7}",[9],[["(\\d{4})(\\d{5})","$1 $2",["202","2024"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[27-9]|4(?:6[45]|[7-9])"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[34]"],"0$1"]],"0"],US:["1","011","[2-9]\\d{9}|3\\d{6}",[10],[["(\\d{3})(\\d{4})","$1-$2",["310"],0,1],["(\\d{3})(\\d{3})(\\d{4})","($1) $2-$3",["[2-9]"],0,1,"$1-$2-$3"]],"1",0,0,0,0,0,[["(?:274[27]|(?:472|983)[2-47-9])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[1459]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-57-9]|1[02-9]|2[013-79]|3[0-24679]|4[167]|5[0-3]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-57-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-269])|7(?:0[1-46-8]|1[2-9]|2[04-8]|3[0-2478]|4[0378]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[0168]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-3589]|8[04-69]))[2-9]\\d{6}"],[""],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|3[23]|44|66|77|88)[2-9]\\d{6}"]]],UY:["598","0(?:0|1[3-9]\\d)","0004\\d{2,9}|[1249]\\d{7}|2\\d{3,4}|(?:[49]\\d|80)\\d{5}",[4,5,6,7,8,9,10,11,12,13],[["(\\d{4,5})","$1",["21"]],["(\\d{3})(\\d{3,4})","$1 $2",["0"]],["(\\d{3})(\\d{4})","$1 $2",["[49]0|8"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[124]"]],["(\\d{3})(\\d{3})(\\d{2,4})","$1 $2 $3",["0"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{2,4})","$1 $2 $3 $4",["0"]]],"0",0,0,0,0,0,0,"00"," int. "],UZ:["998","00","(?:20|33|[5-9]\\d)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[235-9]"]]]],VA:["39","00","0\\d{5,10}|3[0-8]\\d{7,10}|55\\d{8}|8\\d{5}(?:\\d{2,4})?|(?:1\\d|39)\\d{7,8}",[6,7,8,9,10,11,12],0,0,0,0,0,0,"06698"],VC:["1","011","(?:[58]\\d\\d|784|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","784$1",0,"784"],VE:["58","00","[68]00\\d{7}|(?:[24]\\d|[59]0)\\d{8}",[10],[["(\\d{3})(\\d{7})","$1-$2",["[24-689]"],"0$1"]],"0"],VG:["1","011","(?:284|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-578]\\d{6})$|1","284$1",0,"284"],VI:["1","011","[58]\\d{9}|(?:34|90)0\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","340$1",0,"340"],VN:["84","00","[12]\\d{9}|[135-9]\\d{8}|[16]\\d{7}|[16-8]\\d{6}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["80"],"0$1",1],["(\\d{4})(\\d{4,6})","$1 $2",["1"],0,1],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["6"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[357-9]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["2[48]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["2"],"0$1",1]],"0"],VU:["678","00","[57-9]\\d{6}|(?:[238]\\d|48)\\d{3}",[5,7],[["(\\d{3})(\\d{4})","$1 $2",["[57-9]"]]]],WF:["681","00","(?:40|72|8\\d{4})\\d{4}|[89]\\d{5}",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[47-9]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]]],WS:["685","0","(?:[2-6]|8\\d{5})\\d{4}|[78]\\d{6}|[68]\\d{5}",[5,6,7,10],[["(\\d{5})","$1",["[2-5]|6[1-9]"]],["(\\d{3})(\\d{3,7})","$1 $2",["[68]"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]]],XK:["383","00","2\\d{7,8}|3\\d{7,11}|(?:4\\d\\d|[89]00)\\d{5}",[8,9,10,11,12],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2|39"],"0$1"],["(\\d{2})(\\d{7,10})","$1 $2",["3"],"0$1"]],"0"],YE:["967","00","(?:1|7\\d)\\d{7}|[1-7]\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-6]|7(?:[24-6]|8[0-7])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"],"0$1"]],"0"],YT:["262","00","(?:639\\d|7093)\\d{5}|(?:26|80|9\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["26(?:89\\d|9(?:0[0-467]|15|5[0-4]|6\\d|[78]0))\\d{4}"],["(?:639(?:0[0-79]|1[019]|[267]\\d|3[09]|40|5[05-9]|9[04-79])|7093[5-7])\\d{4}"],["80\\d{7}"],0,0,0,0,0,["9(?:(?:39|47)8[01]|769\\d)\\d{4}"]]],ZA:["27","00","[1-79]\\d{8}|8\\d{4,9}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,4})","$1 $2",["8[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["8[1-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["860"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0"],ZM:["260","00","800\\d{6}|(?:21|[579]\\d|63)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[28]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[579]"],"0$1"]],"0"],ZW:["263","00","2(?:[0-57-9]\\d{6,8}|6[0-24-9]\\d{6,7})|[38]\\d{9}|[35-8]\\d{8}|[3-6]\\d{7}|[1-689]\\d{6}|[1-3569]\\d{5}|[1356]\\d{4}",[5,6,7,8,9,10],[["(\\d{3})(\\d{3,5})","$1 $2",["2(?:0[45]|2[278]|[49]8)|3(?:[09]8|17)|6(?:[29]8|37|75)|[23][78]|(?:33|5[15]|6[68])[78]"],"0$1"],["(\\d)(\\d{3})(\\d{2,4})","$1 $2 $3",["[49]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["80"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["24|8[13-59]|(?:2[05-79]|39|5[45]|6[15-8])2","2(?:02[014]|4|[56]20|[79]2)|392|5(?:42|525)|6(?:[16-8]21|52[013])|8[13-59]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:1[39]|2[0157]|[378]|[56][14])|3(?:12|29)","2(?:1[39]|2[0157]|[378]|[56][14])|3(?:123|29)"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["1|2(?:0[0-36-9]|12|29|[56])|3(?:1[0-689]|[24-6])|5(?:[0236-9]|1[2-4])|6(?:[013-59]|7[0-46-9])|(?:33|55|6[68])[0-69]|(?:29|3[09]|62)[0-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["29[013-9]|39|54"],"0$1"],["(\\d{4})(\\d{3,5})","$1 $2",["(?:25|54)8","258|5483"],"0$1"]],"0"]},nonGeographic:{800:["800",0,"(?:00|[1-9]\\d)\\d{6}",[8],[["(\\d{4})(\\d{4})","$1 $2",["\\d"]]],0,0,0,0,0,0,[0,0,["(?:00|[1-9]\\d)\\d{6}"]]],808:["808",0,"[1-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[1-9]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,0,["[1-9]\\d{7}"]]],870:["870",0,"7\\d{11}|[235-7]\\d{8}",[9,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235-7]"]]],0,0,0,0,0,0,[0,["(?:[356]|774[45])\\d{8}|7[6-8]\\d{7}"],0,0,0,0,0,0,["2\\d{8}",[9]]]],878:["878",0,"10\\d{10}",[12],[["(\\d{2})(\\d{5})(\\d{5})","$1 $2 $3",["1"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["10\\d{10}"]]],881:["881",0,"6\\d{9}|[0-36-9]\\d{8}",[9,10],[["(\\d)(\\d{3})(\\d{5})","$1 $2 $3",["[0-37-9]"]],["(\\d)(\\d{3})(\\d{5,6})","$1 $2 $3",["6"]]],0,0,0,0,0,0,[0,["6\\d{9}|[0-36-9]\\d{8}"]]],882:["882",0,"[13]\\d{6}(?:\\d{2,5})?|[19]\\d{7}|(?:[25]\\d\\d|4)\\d{7}(?:\\d{2})?",[7,8,9,10,11,12],[["(\\d{2})(\\d{5})","$1 $2",["16|342"]],["(\\d{2})(\\d{6})","$1 $2",["49"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["1[36]|9"]],["(\\d{2})(\\d{4})(\\d{3})","$1 $2 $3",["3[23]"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["16"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["10|23|3(?:[15]|4[57])|4|5[12]"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["34"]],["(\\d{2})(\\d{4,5})(\\d{5})","$1 $2 $3",["[1-35]"]]],0,0,0,0,0,0,[0,["342\\d{4}|(?:337|49)\\d{6}|(?:3(?:2|47|7\\d{3})|5(?:0\\d{3}|2[0-2]))\\d{7}",[7,8,9,10,12]],0,0,0,["348[57]\\d{7}",[11]],0,0,["1(?:3(?:0[0347]|[13][0139]|2[035]|4[013568]|6[0459]|7[06]|8[15-8]|9[0689])\\d{4}|6\\d{5,10})|(?:345\\d|9[89])\\d{6}|(?:10|2(?:3|85\\d)|3(?:[15]|[69]\\d\\d)|4[15-8]|51)\\d{8}"]]],883:["883",0,"(?:[1-4]\\d|51)\\d{6,10}",[8,9,10,11,12],[["(\\d{3})(\\d{3})(\\d{2,8})","$1 $2 $3",["[14]|2[24-689]|3[02-689]|51[24-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["510"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["21"]],["(\\d{4})(\\d{4})(\\d{4})","$1 $2 $3",["51[13]"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[235]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["(?:2(?:00\\d\\d|10)|(?:370[1-9]|51\\d0)\\d)\\d{7}|51(?:00\\d{5}|[24-9]0\\d{4,7})|(?:1[0-79]|2[24-689]|3[02-689]|4[0-4])0\\d{5,9}"]]],888:["888",0,"\\d{11}",[11],[["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3"]],0,0,0,0,0,0,[0,0,0,0,0,0,["\\d{11}"]]],979:["979",0,"[1359]\\d{8}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[1359]"]]],0,0,0,0,0,0,[0,0,0,["[1359]\\d{8}"]]]}};function ay(i,A){var e=Array.prototype.slice.call(A);return e.push(ld),i.apply(this,e)}function xd(i,A){i=i.split("-"),A=A.split("-");for(var e=i[0].split("."),t=A[0].split("."),g=0;g<3;g++){var I=Number(e[g]),C=Number(t[g]);if(I>C)return 1;if(C>I)return-1;if(!isNaN(I)&&isNaN(C))return 1;if(isNaN(I)&&!isNaN(C))return-1}return i[1]&&A[1]?i[1]>A[1]?1:i[1]<A[1]?-1:0:!i[1]&&A[1]?1:i[1]&&!A[1]?-1:0}var sy={}.constructor;function Xg(i){return i!=null&&i.constructor===sy}function YI(i){"@babel/helpers - typeof";return YI=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(A){return typeof A}:function(A){return A&&typeof Symbol=="function"&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},YI(i)}function yn(i,A){if(!(i instanceof A))throw new TypeError("Cannot call a class as a function")}function Qy(i,A){for(var e=0;e<A.length;e++){var t=A[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(i,ry(t.key),t)}}function bn(i,A,e){return A&&Qy(i.prototype,A),Object.defineProperty(i,"prototype",{writable:!1}),i}function ry(i){var A=By(i,"string");return YI(A)=="symbol"?A:A+""}function By(i,A){if(YI(i)!="object"||!i)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var t=e.call(i,A);if(YI(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}var Ey="1.2.0",cy="1.7.35",ud=" ext. ",dy=/^\d+$/,Ze=function(){function i(A){yn(this,i),_d(A),this.metadata=A,pd.call(this,A)}return bn(i,[{key:"getCountries",value:function(){return Object.keys(this.metadata.countries).filter(function(e){return e!=="001"})}},{key:"getCountryMetadata",value:function(e){return this.metadata.countries[e]}},{key:"nonGeographic",value:function(){if(!(this.v1||this.v2||this.v3))return this.metadata.nonGeographic||this.metadata.nonGeographical}},{key:"hasCountry",value:function(e){return this.getCountryMetadata(e)!==void 0}},{key:"hasCallingCode",value:function(e){if(this.getCountryCodesForCallingCode(e))return!0;if(this.nonGeographic()){if(this.nonGeographic()[e])return!0}else{var t=this.countryCallingCodes()[e];if(t&&t.length===1&&t[0]==="001")return!0}}},{key:"isNonGeographicCallingCode",value:function(e){return this.nonGeographic()?!!this.nonGeographic()[e]:!this.getCountryCodesForCallingCode(e)}},{key:"country",value:function(e){return this.selectNumberingPlan(e)}},{key:"selectNumberingPlan",value:function(e,t){if(e&&dy.test(e)&&(t=e,e=null),e&&e!=="001"){if(!this.hasCountry(e))throw new Error("Unknown country: ".concat(e));this.numberingPlan=new fd(this.getCountryMetadata(e),this)}else if(t){if(!this.hasCallingCode(t))throw new Error("Unknown calling code: ".concat(t));this.numberingPlan=new fd(this.getNumberingPlanMetadata(t),this)}else this.numberingPlan=void 0;return this}},{key:"getCountryCodesForCallingCode",value:function(e){var t=this.countryCallingCodes()[e];if(t)return t.length===1&&t[0].length===3?void 0:t}},{key:"getCountryCodeForCallingCode",value:function(e){var t=this.getCountryCodesForCallingCode(e);if(t)return t[0]}},{key:"getNumberingPlanMetadata",value:function(e){var t=this.getCountryCodeForCallingCode(e);if(t)return this.getCountryMetadata(t);if(this.nonGeographic()){var g=this.nonGeographic()[e];if(g)return g}else{var I=this.countryCallingCodes()[e];if(I&&I.length===1&&I[0]==="001")return this.metadata.countries["001"]}}},{key:"countryCallingCode",value:function(){return this.numberingPlan.callingCode()}},{key:"IDDPrefix",value:function(){return this.numberingPlan.IDDPrefix()}},{key:"defaultIDDPrefix",value:function(){return this.numberingPlan.defaultIDDPrefix()}},{key:"nationalNumberPattern",value:function(){return this.numberingPlan.nationalNumberPattern()}},{key:"possibleLengths",value:function(){return this.numberingPlan.possibleLengths()}},{key:"formats",value:function(){return this.numberingPlan.formats()}},{key:"nationalPrefixForParsing",value:function(){return this.numberingPlan.nationalPrefixForParsing()}},{key:"nationalPrefixTransformRule",value:function(){return this.numberingPlan.nationalPrefixTransformRule()}},{key:"leadingDigits",value:function(){return this.numberingPlan.leadingDigits()}},{key:"hasTypes",value:function(){return this.numberingPlan.hasTypes()}},{key:"type",value:function(e){return this.numberingPlan.type(e)}},{key:"ext",value:function(){return this.numberingPlan.ext()}},{key:"countryCallingCodes",value:function(){return this.v1?this.metadata.country_phone_code_to_countries:this.metadata.country_calling_codes}},{key:"chooseCountryByCountryCallingCode",value:function(e){return this.selectNumberingPlan(e)}},{key:"hasSelectedNumberingPlan",value:function(){return this.numberingPlan!==void 0}}])}(),fd=function(){function i(A,e){yn(this,i),this.globalMetadataObject=e,this.metadata=A,pd.call(this,e.metadata)}return bn(i,[{key:"callingCode",value:function(){return this.metadata[0]}},{key:"getDefaultCountryMetadataForRegion",value:function(){return this.globalMetadataObject.getNumberingPlanMetadata(this.callingCode())}},{key:"IDDPrefix",value:function(){if(!(this.v1||this.v2))return this.metadata[1]}},{key:"defaultIDDPrefix",value:function(){if(!(this.v1||this.v2))return this.metadata[12]}},{key:"nationalNumberPattern",value:function(){return this.v1||this.v2?this.metadata[1]:this.metadata[2]}},{key:"possibleLengths",value:function(){if(!this.v1)return this.metadata[this.v2?2:3]}},{key:"_getFormats",value:function(e){return e[this.v1?2:this.v2?3:4]}},{key:"formats",value:function(){var e=this,t=this._getFormats(this.metadata)||this._getFormats(this.getDefaultCountryMetadataForRegion())||[];return t.map(function(g){return new hy(g,e)})}},{key:"nationalPrefix",value:function(){return this.metadata[this.v1?3:this.v2?4:5]}},{key:"_getNationalPrefixFormattingRule",value:function(e){return e[this.v1?4:this.v2?5:6]}},{key:"nationalPrefixFormattingRule",value:function(){return this._getNationalPrefixFormattingRule(this.metadata)||this._getNationalPrefixFormattingRule(this.getDefaultCountryMetadataForRegion())}},{key:"_nationalPrefixForParsing",value:function(){return this.metadata[this.v1?5:this.v2?6:7]}},{key:"nationalPrefixForParsing",value:function(){return this._nationalPrefixForParsing()||this.nationalPrefix()}},{key:"nationalPrefixTransformRule",value:function(){return this.metadata[this.v1?6:this.v2?7:8]}},{key:"_getNationalPrefixIsOptionalWhenFormatting",value:function(){return!!this.metadata[this.v1?7:this.v2?8:9]}},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function(){return this._getNationalPrefixIsOptionalWhenFormatting(this.metadata)||this._getNationalPrefixIsOptionalWhenFormatting(this.getDefaultCountryMetadataForRegion())}},{key:"leadingDigits",value:function(){return this.metadata[this.v1?8:this.v2?9:10]}},{key:"types",value:function(){return this.metadata[this.v1?9:this.v2?10:11]}},{key:"hasTypes",value:function(){return this.types()&&this.types().length===0?!1:!!this.types()}},{key:"type",value:function(e){if(this.hasTypes()&&Dd(this.types(),e))return new xy(Dd(this.types(),e),this)}},{key:"ext",value:function(){return this.v1||this.v2?ud:this.metadata[13]||ud}}])}(),hy=function(){function i(A,e){yn(this,i),this._format=A,this.metadata=e}return bn(i,[{key:"pattern",value:function(){return this._format[0]}},{key:"format",value:function(){return this._format[1]}},{key:"leadingDigitsPatterns",value:function(){return this._format[2]||[]}},{key:"nationalPrefixFormattingRule",value:function(){return this._format[3]||this.metadata.nationalPrefixFormattingRule()}},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function(){return!!this._format[4]||this.metadata.nationalPrefixIsOptionalWhenFormattingInNationalFormat()}},{key:"nationalPrefixIsMandatoryWhenFormattingInNationalFormat",value:function(){return this.usesNationalPrefix()&&!this.nationalPrefixIsOptionalWhenFormattingInNationalFormat()}},{key:"usesNationalPrefix",value:function(){return!!(this.nationalPrefixFormattingRule()&&!ly.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}])}(),ly=/^\(?\$1\)?$/,xy=function(){function i(A,e){yn(this,i),this.type=A,this.metadata=e}return bn(i,[{key:"pattern",value:function(){return this.metadata.v1?this.type:this.type[0]}},{key:"possibleLengths",value:function(){if(!this.metadata.v1)return this.type[1]||this.metadata.possibleLengths()}}])}();function Dd(i,A){switch(A){case"FIXED_LINE":return i[0];case"MOBILE":return i[1];case"TOLL_FREE":return i[2];case"PREMIUM_RATE":return i[3];case"PERSONAL_NUMBER":return i[4];case"VOICEMAIL":return i[5];case"UAN":return i[6];case"PAGER":return i[7];case"VOIP":return i[8];case"SHARED_COST":return i[9]}}function _d(i){if(!i)throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!Xg(i)||!Xg(i.countries))throw new Error("[libphonenumber-js] `metadata` argument was passed but it's not a valid metadata. Must be an object having `.countries` child object property. Got ".concat(Xg(i)?"an object of shape: { "+Object.keys(i).join(", ")+" }":"a "+uy(i)+": "+i,"."))}var uy=function(A){return YI(A)};function ir(i,A){if(A=new Ze(A),A.hasCountry(i))return A.selectNumberingPlan(i).countryCallingCode();throw new Error("Unknown country: ".concat(i))}function fy(i,A){return A.countries.hasOwnProperty(i)}function pd(i){var A=i.version;typeof A=="number"?(this.v1=A===1,this.v2=A===2,this.v3=A===3,this.v4=A===4):A?xd(A,Ey)===-1?this.v2=!0:xd(A,cy)===-1?this.v3=!0:this.v4=!0:this.v1=!0}function Nn(i,A,e){return Dy(i,A,void 0,e)}function Dy(i,A,e,t){A&&(t=new Ze(t.metadata),t.selectNumberingPlan(A));var g=t.type(e),I=g&&g.possibleLengths()||t.possibleLengths();if(!I)return"IS_POSSIBLE";var C=i.length,o=I[0];return o===C?"IS_POSSIBLE":o>C?"TOO_SHORT":I[I.length-1]<C?"TOO_LONG":I.indexOf(C,1)>=0?"IS_POSSIBLE":"INVALID_LENGTH"}function _y(i,A,e){if(A===void 0&&(A={}),e=new Ze(e),A.v2){if(!i.countryCallingCode)throw new Error("Invalid phone number object passed");e.selectNumberingPlan(i.countryCallingCode)}else{if(!i.phone)return!1;if(i.country){if(!e.hasCountry(i.country))throw new Error("Unknown country: ".concat(i.country));e.selectNumberingPlan(i.country)}else{if(!i.countryCallingCode)throw new Error("Invalid phone number object passed");e.selectNumberingPlan(i.countryCallingCode)}}if(e.possibleLengths())return wd(i.phone||i.nationalNumber,i.country,e);if(i.countryCallingCode&&e.isNonGeographicCallingCode(i.countryCallingCode))return!0;throw new Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.')}function wd(i,A,e){switch(Nn(i,A,e)){case"IS_POSSIBLE":return!0;default:return!1}}function Vi(i,A){return i=i||"",new RegExp("^(?:"+A+")$").test(i)}function py(i,A){var e=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(e)return(e=e.call(i)).next.bind(e);if(Array.isArray(i)||(e=wy(i))||A){e&&(i=e);var t=0;return function(){return t>=i.length?{done:!0}:{done:!1,value:i[t++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
6064
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function wy(i,A){if(i){if(typeof i=="string")return md(i,A);var e={}.toString.call(i).slice(8,-1);return e==="Object"&&i.constructor&&(e=i.constructor.name),e==="Map"||e==="Set"?Array.from(i):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?md(i,A):void 0}}function md(i,A){(A==null||A>i.length)&&(A=i.length);for(var e=0,t=Array(A);e<A;e++)t[e]=i[e];return t}var my=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function gr(i,A,e){if(A=A||{},!(!i.country&&!i.countryCallingCode)){e=new Ze(e),e.selectNumberingPlan(i.country,i.countryCallingCode);var t=A.v2?i.nationalNumber:i.phone;if(Vi(t,e.nationalNumberPattern())){if(Ir(t,"FIXED_LINE",e))return e.type("MOBILE")&&e.type("MOBILE").pattern()===""||!e.type("MOBILE")||Ir(t,"MOBILE",e)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE";for(var g=py(my),I;!(I=g()).done;){var C=I.value;if(Ir(t,C,e))return C}}}}function Ir(i,A,e){var t=e.type(A);return!t||!t.pattern()||t.possibleLengths()&&t.possibleLengths().indexOf(i.length)<0?!1:Vi(i,t.pattern())}function yy(i,A,e){if(A=A||{},e=new Ze(e),e.selectNumberingPlan(i.country,i.countryCallingCode),e.hasTypes())return gr(i,A,e.metadata)!==void 0;var t=A.v2?i.nationalNumber:i.phone;return Vi(t,e.nationalNumberPattern())}function by(i,A,e){var t=new Ze(e),g=t.getCountryCodesForCallingCode(i);return g?g.filter(function(I){return Ny(A,I,e)}):[]}function Ny(i,A,e){var t=new Ze(e);return t.selectNumberingPlan(A),t.numberingPlan.possibleLengths().indexOf(i.length)>=0}var Cr=2,ky=17,Sy=3,Qt="0-90-9٠-٩۰-۹",Ry="-‐-―−ー-",Gy="//",My="..",Fy="  ­​⁠ ",Uy="()()[]\\[\\]",Ly="~⁓∼~",ei="".concat(Ry).concat(Gy).concat(My).concat(Fy).concat(Uy).concat(Ly),kn="++",vy=new RegExp("(["+Qt+"])");function yd(i,A,e,t){if(A){var g=new Ze(t);g.selectNumberingPlan(A,e);var I=new RegExp(g.IDDPrefix());if(i.search(I)===0){i=i.slice(i.match(I)[0].length);var C=i.match(vy);if(!(C&&C[1]!=null&&C[1].length>0&&C[1]==="0"))return i}}}function or(i,A){if(i&&A.numberingPlan.nationalPrefixForParsing()){var e=new RegExp("^(?:"+A.numberingPlan.nationalPrefixForParsing()+")"),t=e.exec(i);if(t){var g,I,C=t.length-1,o=C>0&&t[C];if(A.nationalPrefixTransformRule()&&o)g=i.replace(e,A.nationalPrefixTransformRule()),C>1&&(I=t[1]);else{var n=t[0];g=i.slice(n.length),o&&(I=t[1])}var a;if(o){var s=i.indexOf(t[1]),Q=i.slice(0,s);Q===A.numberingPlan.nationalPrefix()&&(a=A.numberingPlan.nationalPrefix())}else a=t[0];return{nationalNumber:g,nationalPrefix:a,carrierCode:I}}}return{nationalNumber:i}}function Ky(i,A){var e=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(e)return(e=e.call(i)).next.bind(e);if(Array.isArray(i)||(e=Jy(i))||A){e&&(i=e);var t=0;return function(){return t>=i.length?{done:!0}:{done:!1,value:i[t++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
6065
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Jy(i,A){if(i){if(typeof i=="string")return bd(i,A);var e={}.toString.call(i).slice(8,-1);return e==="Object"&&i.constructor&&(e=i.constructor.name),e==="Map"||e==="Set"?Array.from(i):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?bd(i,A):void 0}}function bd(i,A){(A==null||A>i.length)&&(A=i.length);for(var e=0,t=Array(A);e<A;e++)t[e]=i[e];return t}function Nd(i,A){var e=A.countries,t=A.metadata;t=new Ze(t);for(var g=Ky(e),I;!(I=g()).done;){var C=I.value;if(t.selectNumberingPlan(C),t.leadingDigits()){if(i&&i.search(t.leadingDigits())===0)return C}else if(gr({phone:i,country:C},void 0,t.metadata))return C}}function nr(i,A){var e=A.nationalNumber,t=A.metadata,g=t.getCountryCodesForCallingCode(i);if(g)return g.length===1?g[0]:Nd(e,{countries:g,metadata:t.metadata})}function ar(i,A,e){var t=or(i,e),g=t.carrierCode,I=t.nationalNumber;if(I!==i){if(!Yy(i,I,e))return{nationalNumber:i};if(e.numberingPlan.possibleLengths()&&(A||(A=nr(e.numberingPlan.callingCode(),{nationalNumber:I,metadata:e})),!Ty(I,A,e)))return{nationalNumber:i}}return{nationalNumber:I,carrierCode:g}}function Yy(i,A,e){return!(Vi(i,e.nationalNumberPattern())&&!Vi(A,e.nationalNumberPattern()))}function Ty(i,A,e){switch(Nn(i,A,e)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}function kd(i,A,e,t,g){var I=A||e?ir(A||e,g):t;if(i.indexOf(I)===0){g=new Ze(g),g.selectNumberingPlan(A||e,I);var C=i.slice(I.length),o=ar(C,A,g),n=o.nationalNumber,a=ar(i,A,g),s=a.nationalNumber;if(!Vi(s,g.nationalNumberPattern())&&Vi(n,g.nationalNumberPattern())||Nn(s,A,g)==="TOO_LONG")return{countryCallingCode:I,number:C}}return{number:i}}function sr(i,A,e,t,g){if(!i)return{};var I;if(i[0]!=="+"){var C=yd(i,A||e,t,g);if(C&&C!==i)I=!0,i="+"+C;else{if(A||e||t){var o=kd(i,A,e,t,g),n=o.countryCallingCode,a=o.number;if(n)return{countryCallingCodeSource:"FROM_NUMBER_WITHOUT_PLUS_SIGN",countryCallingCode:n,number:a}}return{number:i}}}if(i[1]==="0")return{};g=new Ze(g);for(var s=2;s-1<=Sy&&s<=i.length;){var Q=i.slice(1,s);if(g.hasCallingCode(Q))return g.selectNumberingPlan(Q),{countryCallingCodeSource:I?"FROM_NUMBER_WITH_IDD":"FROM_NUMBER_WITH_PLUS_SIGN",countryCallingCode:Q,number:i.slice(s)};s++}return{}}function Sd(i){return i.replace(new RegExp("[".concat(ei,"]+"),"g")," ").trim()}var Rd=/(\$\d)/;function Gd(i,A,e){var t=e.useInternationalFormat,g=e.withNationalPrefix;e.carrierCode,e.metadata;var I=i.replace(new RegExp(A.pattern()),t?A.internationalFormat():g&&A.nationalPrefixFormattingRule()?A.format().replace(Rd,A.nationalPrefixFormattingRule()):A.format());return t?Sd(I):I}var qy=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function Hy(i,A,e){var t=new Ze(e);if(t.selectNumberingPlan(i,A),t.defaultIDDPrefix())return t.defaultIDDPrefix();if(qy.test(t.IDDPrefix()))return t.IDDPrefix()}var Py=";ext=",TI=function(A){return"([".concat(Qt,"]{1,").concat(A,"})")};function Md(i){var A="20",e="15",t="9",g="6",I="[  \\t,]*",C="[:\\..]?[  \\t,-]*",o="#?",n="(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)",a="(?:[xx##~~]|int|int)",s="[- ]+",Q="[  \\t]*",r="(?:,{2}|;)",B=Py+TI(A),h=I+n+C+TI(A)+o,c=I+a+C+TI(t)+o,d=s+TI(g)+"#",E=Q+r+C+TI(e)+o,u=Q+"(?:,)+"+C+TI(t)+o;return B+"|"+h+"|"+c+"|"+d+"|"+E+"|"+u}var Oy="["+Qt+"]{"+Cr+"}",Vy="["+kn+"]{0,1}(?:["+ei+"]*["+Qt+"]){3,}["+ei+Qt+"]*",jy=new RegExp("^["+kn+"]{0,1}(?:["+ei+"]*["+Qt+"]){1,2}$","i"),Wy=Vy+"(?:"+Md()+")?",Xy=new RegExp("^"+Oy+"$|^"+Wy+"$","i");function Zy(i){return i.length>=Cr&&Xy.test(i)}function zy(i){return jy.test(i)}function $y(i){var A=i.number,e=i.ext;if(!A)return"";if(A[0]!=="+")throw new Error('"formatRFC3966()" expects "number" to be in E.164 format.');return"tel:".concat(A).concat(e?";ext="+e:"")}var Fd={formatExtension:function(A,e,t){return"".concat(A).concat(t.ext()).concat(e)}};function Ab(i,A,e,t){if(e?e=ib({},Fd,e):e=Fd,t=new Ze(t),i.country&&i.country!=="001"){if(!t.hasCountry(i.country))throw new Error("Unknown country: ".concat(i.country));t.selectNumberingPlan(i.country)}else if(i.countryCallingCode)t.selectNumberingPlan(i.countryCallingCode);else return i.phone||"";var g=t.countryCallingCode(),I=e.v2?i.nationalNumber:i.phone,C;switch(A){case"NATIONAL":return I?(C=Sn(I,i.carrierCode,"NATIONAL",t,e),Qr(C,i.ext,t,e.formatExtension)):"";case"INTERNATIONAL":return I?(C=Sn(I,null,"INTERNATIONAL",t,e),C="+".concat(g," ").concat(C),Qr(C,i.ext,t,e.formatExtension)):"+".concat(g);case"E.164":return"+".concat(g).concat(I);case"RFC3966":return $y({number:"+".concat(g).concat(I),ext:i.ext});case"IDD":if(!e.fromCountry)return;var o=tb(I,i.carrierCode,g,e.fromCountry,t);return o?Qr(o,i.ext,t,e.formatExtension):void 0;default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(A,'"'))}}function Sn(i,A,e,t,g){var I=eb(t.formats(),i);return I?Gd(i,I,{useInternationalFormat:e==="INTERNATIONAL",withNationalPrefix:!(I.nationalPrefixIsOptionalWhenFormattingInNationalFormat()&&g&&g.nationalPrefix===!1),carrierCode:A,metadata:t}):i}function eb(i,A){return gb(i,function(e){if(e.leadingDigitsPatterns().length>0){var t=e.leadingDigitsPatterns()[e.leadingDigitsPatterns().length-1];if(A.search(t)!==0)return!1}return Vi(A,e.pattern())})}function Qr(i,A,e,t){return A?t(i,A,e):i}function tb(i,A,e,t,g){var I=ir(t,g.metadata);if(I===e){var C=Sn(i,A,"NATIONAL",g);return e==="1"?e+" "+C:C}var o=Hy(t,void 0,g.metadata);if(o)return"".concat(o," ").concat(e," ").concat(Sn(i,null,"INTERNATIONAL",g))}function ib(){for(var i=1,A=arguments.length,e=new Array(A),t=0;t<A;t++)e[t]=arguments[t];for(;i<e.length;){if(e[i])for(var g in e[i])e[0][g]=e[i][g];i++}return e[0]}function gb(i,A){for(var e=0;e<i.length;){if(A(i[e]))return i[e];e++}}function LC(i){"@babel/helpers - typeof";return LC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(A){return typeof A}:function(A){return A&&typeof Symbol=="function"&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},LC(i)}function Ud(i,A){var e=Object.keys(i);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(i);A&&(t=t.filter(function(g){return Object.getOwnPropertyDescriptor(i,g).enumerable})),e.push.apply(e,t)}return e}function Ld(i){for(var A=1;A<arguments.length;A++){var e=arguments[A]!=null?arguments[A]:{};A%2?Ud(Object(e),!0).forEach(function(t){Ib(i,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):Ud(Object(e)).forEach(function(t){Object.defineProperty(i,t,Object.getOwnPropertyDescriptor(e,t))})}return i}function Ib(i,A,e){return(A=vd(A))in i?Object.defineProperty(i,A,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[A]=e,i}function Cb(i,A){if(!(i instanceof A))throw new TypeError("Cannot call a class as a function")}function ob(i,A){for(var e=0;e<A.length;e++){var t=A[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(i,vd(t.key),t)}}function nb(i,A,e){return A&&ob(i.prototype,A),Object.defineProperty(i,"prototype",{writable:!1}),i}function vd(i){var A=ab(i,"string");return LC(A)=="symbol"?A:A+""}function ab(i,A){if(LC(i)!="object"||!i)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var t=e.call(i,A);if(LC(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}var Kd=function(){function i(A,e,t){if(Cb(this,i),!A)throw new TypeError("First argument is required");if(typeof A!="string")throw new TypeError("First argument must be a string");if(A[0]==="+"&&!e)throw new TypeError("`metadata` argument not passed");if(Xg(e)&&Xg(e.countries)){t=e;var g=A;if(!rb.test(g))throw new Error('Invalid `number` argument passed: must consist of a "+" followed by digits');var I=sr(g,void 0,void 0,void 0,t),C=I.countryCallingCode,o=I.number;if(e=o,A=C,!e)throw new Error("Invalid `number` argument passed: too short")}if(!e)throw new TypeError("`nationalNumber` argument is required");if(typeof e!="string")throw new TypeError("`nationalNumber` argument must be a string");_d(t);var n=Qb(A,t),a=n.country,s=n.countryCallingCode;this.country=a,this.countryCallingCode=s,this.nationalNumber=e,this.number="+"+this.countryCallingCode+this.nationalNumber,this.getMetadata=function(){return t}}return nb(i,[{key:"setExt",value:function(e){this.ext=e}},{key:"getPossibleCountries",value:function(){return this.country?[this.country]:by(this.countryCallingCode,this.nationalNumber,this.getMetadata())}},{key:"isPossible",value:function(){return _y(this,{v2:!0},this.getMetadata())}},{key:"isValid",value:function(){return yy(this,{v2:!0},this.getMetadata())}},{key:"isNonGeographic",value:function(){var e=new Ze(this.getMetadata());return e.isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function(e){return this.number===e.number&&this.ext===e.ext}},{key:"getType",value:function(){return gr(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(e,t){return Ab(this,e,t?Ld(Ld({},t),{},{v2:!0}):{v2:!0},this.getMetadata())}},{key:"formatNational",value:function(e){return this.format("NATIONAL",e)}},{key:"formatInternational",value:function(e){return this.format("INTERNATIONAL",e)}},{key:"getURI",value:function(e){return this.format("RFC3966",e)}}])}(),sb=function(A){return/^[A-Z]{2}$/.test(A)};function Qb(i,A){var e,t,g=new Ze(A);return sb(i)?(e=i,g.selectNumberingPlan(e),t=g.countryCallingCode()):t=i,{country:e,countryCallingCode:t}}var rb=/^\+\d+$/;function rr(i){"@babel/helpers - typeof";return rr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(A){return typeof A}:function(A){return A&&typeof Symbol=="function"&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},rr(i)}function Bb(i,A,e){return Object.defineProperty(i,"prototype",{writable:!1}),i}function Eb(i,A){if(!(i instanceof A))throw new TypeError("Cannot call a class as a function")}function cb(i,A,e){return A=KC(A),db(i,Er()?Reflect.construct(A,e||[],KC(i).constructor):A.apply(i,e))}function db(i,A){if(A&&(rr(A)=="object"||typeof A=="function"))return A;if(A!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return hb(i)}function hb(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function lb(i,A){if(typeof A!="function"&&A!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(A&&A.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),A&&vC(i,A)}function Br(i){var A=typeof Map=="function"?new Map:void 0;return Br=function(t){if(t===null||!ub(t))return t;if(typeof t!="function")throw new TypeError("Super expression must either be null or a function");if(A!==void 0){if(A.has(t))return A.get(t);A.set(t,g)}function g(){return xb(t,arguments,KC(this).constructor)}return g.prototype=Object.create(t.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),vC(g,t)},Br(i)}function xb(i,A,e){if(Er())return Reflect.construct.apply(null,arguments);var t=[null];t.push.apply(t,A);var g=new(i.bind.apply(i,t));return e&&vC(g,e.prototype),g}function Er(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Er=function(){return!!i})()}function ub(i){try{return Function.toString.call(i).indexOf("[native code]")!==-1}catch{return typeof i=="function"}}function vC(i,A){return vC=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},vC(i,A)}function KC(i){return KC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(A){return A.__proto__||Object.getPrototypeOf(A)},KC(i)}var ji=function(i){function A(e){var t;return Eb(this,A),t=cb(this,A,[e]),Object.setPrototypeOf(t,A.prototype),t.name=t.constructor.name,t}return lb(A,i),Bb(A)}(Br(Error)),Jd=new RegExp("(?:"+Md()+")$","i");function fb(i){var A=i.search(Jd);if(A<0)return{};for(var e=i.slice(0,A),t=i.match(Jd),g=1;g<t.length;){if(t[g])return{number:e,ext:t[g]};g++}}function Db(i,A){var e=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(e)return(e=e.call(i)).next.bind(e);if(Array.isArray(i)||(e=_b(i))||A){e&&(i=e);var t=0;return function(){return t>=i.length?{done:!0}:{done:!1,value:i[t++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
6066
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function wy(i,A){if(i){if(typeof i=="string")return md(i,A);var e={}.toString.call(i).slice(8,-1);return e==="Object"&&i.constructor&&(e=i.constructor.name),e==="Map"||e==="Set"?Array.from(i):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?md(i,A):void 0}}function md(i,A){(A==null||A>i.length)&&(A=i.length);for(var e=0,t=Array(A);e<A;e++)t[e]=i[e];return t}var my=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function gr(i,A,e){if(A=A||{},!(!i.country&&!i.countryCallingCode)){e=new Ze(e),e.selectNumberingPlan(i.country,i.countryCallingCode);var t=A.v2?i.nationalNumber:i.phone;if(Vi(t,e.nationalNumberPattern())){if(Ir(t,"FIXED_LINE",e))return e.type("MOBILE")&&e.type("MOBILE").pattern()===""||!e.type("MOBILE")||Ir(t,"MOBILE",e)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE";for(var g=py(my),I;!(I=g()).done;){var C=I.value;if(Ir(t,C,e))return C}}}}function Ir(i,A,e){var t=e.type(A);return!t||!t.pattern()||t.possibleLengths()&&t.possibleLengths().indexOf(i.length)<0?!1:Vi(i,t.pattern())}function yy(i,A,e){if(A=A||{},e=new Ze(e),e.selectNumberingPlan(i.country,i.countryCallingCode),e.hasTypes())return gr(i,A,e.metadata)!==void 0;var t=A.v2?i.nationalNumber:i.phone;return Vi(t,e.nationalNumberPattern())}function by(i,A,e){var t=new Ze(e),g=t.getCountryCodesForCallingCode(i);return g?g.filter(function(I){return Ny(A,I,e)}):[]}function Ny(i,A,e){var t=new Ze(e);return t.selectNumberingPlan(A),t.numberingPlan.possibleLengths().indexOf(i.length)>=0}var Cr=2,ky=17,Sy=3,rt="0-90-9٠-٩۰-۹",Ry="-‐-―−ー-",Gy="//",My="..",Fy="  ­​⁠ ",Uy="()()[]\\[\\]",Ly="~⁓∼~",ei="".concat(Ry).concat(Gy).concat(My).concat(Fy).concat(Uy).concat(Ly),kn="++",vy=new RegExp("(["+rt+"])");function yd(i,A,e,t){if(A){var g=new Ze(t);g.selectNumberingPlan(A,e);var I=new RegExp(g.IDDPrefix());if(i.search(I)===0){i=i.slice(i.match(I)[0].length);var C=i.match(vy);if(!(C&&C[1]!=null&&C[1].length>0&&C[1]==="0"))return i}}}function or(i,A){if(i&&A.numberingPlan.nationalPrefixForParsing()){var e=new RegExp("^(?:"+A.numberingPlan.nationalPrefixForParsing()+")"),t=e.exec(i);if(t){var g,I,C=t.length-1,o=C>0&&t[C];if(A.nationalPrefixTransformRule()&&o)g=i.replace(e,A.nationalPrefixTransformRule()),C>1&&(I=t[1]);else{var n=t[0];g=i.slice(n.length),o&&(I=t[1])}var a;if(o){var s=i.indexOf(t[1]),Q=i.slice(0,s);Q===A.numberingPlan.nationalPrefix()&&(a=A.numberingPlan.nationalPrefix())}else a=t[0];return{nationalNumber:g,nationalPrefix:a,carrierCode:I}}}return{nationalNumber:i}}function Ky(i,A){var e=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(e)return(e=e.call(i)).next.bind(e);if(Array.isArray(i)||(e=Jy(i))||A){e&&(i=e);var t=0;return function(){return t>=i.length?{done:!0}:{done:!1,value:i[t++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
6067
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Jy(i,A){if(i){if(typeof i=="string")return bd(i,A);var e={}.toString.call(i).slice(8,-1);return e==="Object"&&i.constructor&&(e=i.constructor.name),e==="Map"||e==="Set"?Array.from(i):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?bd(i,A):void 0}}function bd(i,A){(A==null||A>i.length)&&(A=i.length);for(var e=0,t=Array(A);e<A;e++)t[e]=i[e];return t}function Nd(i,A){var e=A.countries,t=A.metadata;t=new Ze(t);for(var g=Ky(e),I;!(I=g()).done;){var C=I.value;if(t.selectNumberingPlan(C),t.leadingDigits()){if(i&&i.search(t.leadingDigits())===0)return C}else if(gr({phone:i,country:C},void 0,t.metadata))return C}}function nr(i,A){var e=A.nationalNumber,t=A.metadata,g=t.getCountryCodesForCallingCode(i);if(g)return g.length===1?g[0]:Nd(e,{countries:g,metadata:t.metadata})}function ar(i,A,e){var t=or(i,e),g=t.carrierCode,I=t.nationalNumber;if(I!==i){if(!Yy(i,I,e))return{nationalNumber:i};if(e.numberingPlan.possibleLengths()&&(A||(A=nr(e.numberingPlan.callingCode(),{nationalNumber:I,metadata:e})),!Ty(I,A,e)))return{nationalNumber:i}}return{nationalNumber:I,carrierCode:g}}function Yy(i,A,e){return!(Vi(i,e.nationalNumberPattern())&&!Vi(A,e.nationalNumberPattern()))}function Ty(i,A,e){switch(Nn(i,A,e)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}function kd(i,A,e,t,g){var I=A||e?ir(A||e,g):t;if(i.indexOf(I)===0){g=new Ze(g),g.selectNumberingPlan(A||e,I);var C=i.slice(I.length),o=ar(C,A,g),n=o.nationalNumber,a=ar(i,A,g),s=a.nationalNumber;if(!Vi(s,g.nationalNumberPattern())&&Vi(n,g.nationalNumberPattern())||Nn(s,A,g)==="TOO_LONG")return{countryCallingCode:I,number:C}}return{number:i}}function sr(i,A,e,t,g){if(!i)return{};var I;if(i[0]!=="+"){var C=yd(i,A||e,t,g);if(C&&C!==i)I=!0,i="+"+C;else{if(A||e||t){var o=kd(i,A,e,t,g),n=o.countryCallingCode,a=o.number;if(n)return{countryCallingCodeSource:"FROM_NUMBER_WITHOUT_PLUS_SIGN",countryCallingCode:n,number:a}}return{number:i}}}if(i[1]==="0")return{};g=new Ze(g);for(var s=2;s-1<=Sy&&s<=i.length;){var Q=i.slice(1,s);if(g.hasCallingCode(Q))return g.selectNumberingPlan(Q),{countryCallingCodeSource:I?"FROM_NUMBER_WITH_IDD":"FROM_NUMBER_WITH_PLUS_SIGN",countryCallingCode:Q,number:i.slice(s)};s++}return{}}function Sd(i){return i.replace(new RegExp("[".concat(ei,"]+"),"g")," ").trim()}var Rd=/(\$\d)/;function Gd(i,A,e){var t=e.useInternationalFormat,g=e.withNationalPrefix;e.carrierCode,e.metadata;var I=i.replace(new RegExp(A.pattern()),t?A.internationalFormat():g&&A.nationalPrefixFormattingRule()?A.format().replace(Rd,A.nationalPrefixFormattingRule()):A.format());return t?Sd(I):I}var qy=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function Hy(i,A,e){var t=new Ze(e);if(t.selectNumberingPlan(i,A),t.defaultIDDPrefix())return t.defaultIDDPrefix();if(qy.test(t.IDDPrefix()))return t.IDDPrefix()}var Py=";ext=",TI=function(A){return"([".concat(rt,"]{1,").concat(A,"})")};function Md(i){var A="20",e="15",t="9",g="6",I="[  \\t,]*",C="[:\\..]?[  \\t,-]*",o="#?",n="(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)",a="(?:[xx##~~]|int|int)",s="[- ]+",Q="[  \\t]*",r="(?:,{2}|;)",B=Py+TI(A),h=I+n+C+TI(A)+o,c=I+a+C+TI(t)+o,d=s+TI(g)+"#",E=Q+r+C+TI(e)+o,u=Q+"(?:,)+"+C+TI(t)+o;return B+"|"+h+"|"+c+"|"+d+"|"+E+"|"+u}var Oy="["+rt+"]{"+Cr+"}",Vy="["+kn+"]{0,1}(?:["+ei+"]*["+rt+"]){3,}["+ei+rt+"]*",jy=new RegExp("^["+kn+"]{0,1}(?:["+ei+"]*["+rt+"]){1,2}$","i"),Wy=Vy+"(?:"+Md()+")?",Xy=new RegExp("^"+Oy+"$|^"+Wy+"$","i");function Zy(i){return i.length>=Cr&&Xy.test(i)}function zy(i){return jy.test(i)}function $y(i){var A=i.number,e=i.ext;if(!A)return"";if(A[0]!=="+")throw new Error('"formatRFC3966()" expects "number" to be in E.164 format.');return"tel:".concat(A).concat(e?";ext="+e:"")}var Fd={formatExtension:function(A,e,t){return"".concat(A).concat(t.ext()).concat(e)}};function Ab(i,A,e,t){if(e?e=ib({},Fd,e):e=Fd,t=new Ze(t),i.country&&i.country!=="001"){if(!t.hasCountry(i.country))throw new Error("Unknown country: ".concat(i.country));t.selectNumberingPlan(i.country)}else if(i.countryCallingCode)t.selectNumberingPlan(i.countryCallingCode);else return i.phone||"";var g=t.countryCallingCode(),I=e.v2?i.nationalNumber:i.phone,C;switch(A){case"NATIONAL":return I?(C=Sn(I,i.carrierCode,"NATIONAL",t,e),Qr(C,i.ext,t,e.formatExtension)):"";case"INTERNATIONAL":return I?(C=Sn(I,null,"INTERNATIONAL",t,e),C="+".concat(g," ").concat(C),Qr(C,i.ext,t,e.formatExtension)):"+".concat(g);case"E.164":return"+".concat(g).concat(I);case"RFC3966":return $y({number:"+".concat(g).concat(I),ext:i.ext});case"IDD":if(!e.fromCountry)return;var o=tb(I,i.carrierCode,g,e.fromCountry,t);return o?Qr(o,i.ext,t,e.formatExtension):void 0;default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(A,'"'))}}function Sn(i,A,e,t,g){var I=eb(t.formats(),i);return I?Gd(i,I,{useInternationalFormat:e==="INTERNATIONAL",withNationalPrefix:!(I.nationalPrefixIsOptionalWhenFormattingInNationalFormat()&&g&&g.nationalPrefix===!1),carrierCode:A,metadata:t}):i}function eb(i,A){return gb(i,function(e){if(e.leadingDigitsPatterns().length>0){var t=e.leadingDigitsPatterns()[e.leadingDigitsPatterns().length-1];if(A.search(t)!==0)return!1}return Vi(A,e.pattern())})}function Qr(i,A,e,t){return A?t(i,A,e):i}function tb(i,A,e,t,g){var I=ir(t,g.metadata);if(I===e){var C=Sn(i,A,"NATIONAL",g);return e==="1"?e+" "+C:C}var o=Hy(t,void 0,g.metadata);if(o)return"".concat(o," ").concat(e," ").concat(Sn(i,null,"INTERNATIONAL",g))}function ib(){for(var i=1,A=arguments.length,e=new Array(A),t=0;t<A;t++)e[t]=arguments[t];for(;i<e.length;){if(e[i])for(var g in e[i])e[0][g]=e[i][g];i++}return e[0]}function gb(i,A){for(var e=0;e<i.length;){if(A(i[e]))return i[e];e++}}function LC(i){"@babel/helpers - typeof";return LC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(A){return typeof A}:function(A){return A&&typeof Symbol=="function"&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},LC(i)}function Ud(i,A){var e=Object.keys(i);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(i);A&&(t=t.filter(function(g){return Object.getOwnPropertyDescriptor(i,g).enumerable})),e.push.apply(e,t)}return e}function Ld(i){for(var A=1;A<arguments.length;A++){var e=arguments[A]!=null?arguments[A]:{};A%2?Ud(Object(e),!0).forEach(function(t){Ib(i,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):Ud(Object(e)).forEach(function(t){Object.defineProperty(i,t,Object.getOwnPropertyDescriptor(e,t))})}return i}function Ib(i,A,e){return(A=vd(A))in i?Object.defineProperty(i,A,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[A]=e,i}function Cb(i,A){if(!(i instanceof A))throw new TypeError("Cannot call a class as a function")}function ob(i,A){for(var e=0;e<A.length;e++){var t=A[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(i,vd(t.key),t)}}function nb(i,A,e){return A&&ob(i.prototype,A),Object.defineProperty(i,"prototype",{writable:!1}),i}function vd(i){var A=ab(i,"string");return LC(A)=="symbol"?A:A+""}function ab(i,A){if(LC(i)!="object"||!i)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var t=e.call(i,A);if(LC(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}var Kd=function(){function i(A,e,t){if(Cb(this,i),!A)throw new TypeError("First argument is required");if(typeof A!="string")throw new TypeError("First argument must be a string");if(A[0]==="+"&&!e)throw new TypeError("`metadata` argument not passed");if(Xg(e)&&Xg(e.countries)){t=e;var g=A;if(!rb.test(g))throw new Error('Invalid `number` argument passed: must consist of a "+" followed by digits');var I=sr(g,void 0,void 0,void 0,t),C=I.countryCallingCode,o=I.number;if(e=o,A=C,!e)throw new Error("Invalid `number` argument passed: too short")}if(!e)throw new TypeError("`nationalNumber` argument is required");if(typeof e!="string")throw new TypeError("`nationalNumber` argument must be a string");_d(t);var n=Qb(A,t),a=n.country,s=n.countryCallingCode;this.country=a,this.countryCallingCode=s,this.nationalNumber=e,this.number="+"+this.countryCallingCode+this.nationalNumber,this.getMetadata=function(){return t}}return nb(i,[{key:"setExt",value:function(e){this.ext=e}},{key:"getPossibleCountries",value:function(){return this.country?[this.country]:by(this.countryCallingCode,this.nationalNumber,this.getMetadata())}},{key:"isPossible",value:function(){return _y(this,{v2:!0},this.getMetadata())}},{key:"isValid",value:function(){return yy(this,{v2:!0},this.getMetadata())}},{key:"isNonGeographic",value:function(){var e=new Ze(this.getMetadata());return e.isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function(e){return this.number===e.number&&this.ext===e.ext}},{key:"getType",value:function(){return gr(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(e,t){return Ab(this,e,t?Ld(Ld({},t),{},{v2:!0}):{v2:!0},this.getMetadata())}},{key:"formatNational",value:function(e){return this.format("NATIONAL",e)}},{key:"formatInternational",value:function(e){return this.format("INTERNATIONAL",e)}},{key:"getURI",value:function(e){return this.format("RFC3966",e)}}])}(),sb=function(A){return/^[A-Z]{2}$/.test(A)};function Qb(i,A){var e,t,g=new Ze(A);return sb(i)?(e=i,g.selectNumberingPlan(e),t=g.countryCallingCode()):t=i,{country:e,countryCallingCode:t}}var rb=/^\+\d+$/;function rr(i){"@babel/helpers - typeof";return rr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(A){return typeof A}:function(A){return A&&typeof Symbol=="function"&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},rr(i)}function Bb(i,A,e){return Object.defineProperty(i,"prototype",{writable:!1}),i}function Eb(i,A){if(!(i instanceof A))throw new TypeError("Cannot call a class as a function")}function cb(i,A,e){return A=KC(A),db(i,Er()?Reflect.construct(A,e||[],KC(i).constructor):A.apply(i,e))}function db(i,A){if(A&&(rr(A)=="object"||typeof A=="function"))return A;if(A!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return hb(i)}function hb(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function lb(i,A){if(typeof A!="function"&&A!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(A&&A.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),A&&vC(i,A)}function Br(i){var A=typeof Map=="function"?new Map:void 0;return Br=function(t){if(t===null||!ub(t))return t;if(typeof t!="function")throw new TypeError("Super expression must either be null or a function");if(A!==void 0){if(A.has(t))return A.get(t);A.set(t,g)}function g(){return xb(t,arguments,KC(this).constructor)}return g.prototype=Object.create(t.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),vC(g,t)},Br(i)}function xb(i,A,e){if(Er())return Reflect.construct.apply(null,arguments);var t=[null];t.push.apply(t,A);var g=new(i.bind.apply(i,t));return e&&vC(g,e.prototype),g}function Er(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Er=function(){return!!i})()}function ub(i){try{return Function.toString.call(i).indexOf("[native code]")!==-1}catch{return typeof i=="function"}}function vC(i,A){return vC=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},vC(i,A)}function KC(i){return KC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(A){return A.__proto__||Object.getPrototypeOf(A)},KC(i)}var ji=function(i){function A(e){var t;return Eb(this,A),t=cb(this,A,[e]),Object.setPrototypeOf(t,A.prototype),t.name=t.constructor.name,t}return lb(A,i),Bb(A)}(Br(Error)),Jd=new RegExp("(?:"+Md()+")$","i");function fb(i){var A=i.search(Jd);if(A<0)return{};for(var e=i.slice(0,A),t=i.match(Jd),g=1;g<t.length;){if(t[g])return{number:e,ext:t[g]};g++}}function Db(i,A){var e=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(e)return(e=e.call(i)).next.bind(e);if(Array.isArray(i)||(e=_b(i))||A){e&&(i=e);var t=0;return function(){return t>=i.length?{done:!0}:{done:!1,value:i[t++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
6066
6068
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _b(i,A){if(i){if(typeof i=="string")return Yd(i,A);var e={}.toString.call(i).slice(8,-1);return e==="Object"&&i.constructor&&(e=i.constructor.name),e==="Map"||e==="Set"?Array.from(i):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Yd(i,A):void 0}}function Yd(i,A){(A==null||A>i.length)&&(A=i.length);for(var e=0,t=Array(A);e<A;e++)t[e]=i[e];return t}var pb={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9","0":"0","1":"1","2":"2","3":"3","4":"4","5":"5","6":"6","7":"7","8":"8","9":"9","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","۰":"0","۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9"};function Td(i){return pb[i]}function Rn(i){for(var A="",e=Db(i.split("")),t;!(t=e()).done;){var g=t.value,I=Td(g);I&&(A+=I)}return A}function wb(i,A){var e=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(e)return(e=e.call(i)).next.bind(e);if(Array.isArray(i)||(e=mb(i))||A){e&&(i=e);var t=0;return function(){return t>=i.length?{done:!0}:{done:!1,value:i[t++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
6067
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mb(i,A){if(i){if(typeof i=="string")return qd(i,A);var e={}.toString.call(i).slice(8,-1);return e==="Object"&&i.constructor&&(e=i.constructor.name),e==="Map"||e==="Set"?Array.from(i):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?qd(i,A):void 0}}function qd(i,A){(A==null||A>i.length)&&(A=i.length);for(var e=0,t=Array(A);e<A;e++)t[e]=i[e];return t}function Hd(i){for(var A="",e=wb(i.split("")),t;!(t=e()).done;){var g=t.value;A+=yb(g,A)||""}return A}function yb(i,A,e){return i==="+"?A?void 0:"+":Td(i)}var Pd="+",bb="[\\-\\.\\(\\)]?",Od="(["+Qt+"]|"+bb+")",Nb="^\\"+Pd+Od+"*["+Qt+"]"+Od+"*$",kb=new RegExp(Nb,"g"),cr=Qt,Sb="["+cr+"]+((\\-)*["+cr+"])*",Rb="a-zA-Z",Gb="["+Rb+"]+((\\-)*["+cr+"])*",Mb="^("+Sb+"\\.)*"+Gb+"\\.?$",Fb=new RegExp(Mb,"g"),Vd="tel:",dr=";phone-context=",Ub=";isub=";function Lb(i){var A=i.indexOf(dr);if(A<0)return null;var e=A+dr.length;if(e>=i.length)return"";var t=i.indexOf(";",e);return t>=0?i.substring(e,t):i.substring(e)}function vb(i){return i===null?!0:i.length===0?!1:kb.test(i)||Fb.test(i)}function Kb(i,A){var e=A.extractFormattedPhoneNumber,t=Lb(i);if(!vb(t))throw new ji("NOT_A_NUMBER");var g;if(t===null)g=e(i)||"";else{g="",t.charAt(0)===Pd&&(g+=t);var I=i.indexOf(Vd),C;I>=0?C=I+Vd.length:C=0;var o=i.indexOf(dr);g+=i.substring(C,o)}var n=g.indexOf(Ub);if(n>0&&(g=g.substring(0,n)),g!=="")return g}var Jb=250,Yb=new RegExp("["+kn+Qt+"]"),Tb=new RegExp("[^"+Qt+"#]+$");function qb(i,A,e){if(A=A||{},e=new Ze(e),A.defaultCountry&&!e.hasCountry(A.defaultCountry))throw A.v2?new ji("INVALID_COUNTRY"):new Error("Unknown country: ".concat(A.defaultCountry));var t=Pb(i,A.v2,A.extract),g=t.number,I=t.ext,C=t.error;if(!g){if(A.v2)throw C==="TOO_SHORT"?new ji("TOO_SHORT"):new ji("NOT_A_NUMBER");return{}}var o=Vb(g,A.defaultCountry,A.defaultCallingCode,e),n=o.country,a=o.nationalNumber,s=o.countryCallingCode,Q=o.countryCallingCodeSource,r=o.carrierCode;if(!e.hasSelectedNumberingPlan()){if(A.v2)throw new ji("INVALID_COUNTRY");return{}}if(!a||a.length<Cr){if(A.v2)throw new ji("TOO_SHORT");return{}}if(a.length>ky){if(A.v2)throw new ji("TOO_LONG");return{}}if(A.v2){var B=new Kd(s,a,e.metadata);return n&&(B.country=n),r&&(B.carrierCode=r),I&&(B.ext=I),B.__countryCallingCodeSource=Q,B}var h=(A.extended?e.hasSelectedNumberingPlan():n)?Vi(a,e.nationalNumberPattern()):!1;return A.extended?{country:n,countryCallingCode:s,carrierCode:r,valid:h,possible:h?!0:!!(A.extended===!0&&e.possibleLengths()&&wd(a,n,e)),phone:a,ext:I}:h?Ob(n,a,I):{}}function Hb(i,A,e){if(i){if(i.length>Jb){if(e)throw new ji("TOO_LONG");return}if(A===!1)return i;var t=i.search(Yb);if(!(t<0))return i.slice(t).replace(Tb,"")}}function Pb(i,A,e){var t=Kb(i,{extractFormattedPhoneNumber:function(C){return Hb(C,e,A)}});if(!t)return{};if(!Zy(t))return zy(t)?{error:"TOO_SHORT"}:{};var g=fb(t);return g.ext?g:{number:t}}function Ob(i,A,e){var t={country:i,phone:A};return e&&(t.ext=e),t}function Vb(i,A,e,t){var g=sr(Hd(i),void 0,A,e,t.metadata),I=g.countryCallingCodeSource,C=g.countryCallingCode,o=g.number,n;if(C)t.selectNumberingPlan(C);else if(o&&(A||e))t.selectNumberingPlan(A,e),A&&(n=A),C=e||ir(A,t.metadata);else return{};if(!o)return{countryCallingCodeSource:I,countryCallingCode:C};var a=ar(Hd(o),n,t),s=a.nationalNumber,Q=a.carrierCode,r=nr(C,{nationalNumber:s,metadata:t});return r&&(n=r,r==="001"||t.selectNumberingPlan(n)),{country:n,countryCallingCode:C,countryCallingCodeSource:I,nationalNumber:s,carrierCode:Q}}function JC(i){"@babel/helpers - typeof";return JC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(A){return typeof A}:function(A){return A&&typeof Symbol=="function"&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},JC(i)}function jd(i,A){var e=Object.keys(i);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(i);A&&(t=t.filter(function(g){return Object.getOwnPropertyDescriptor(i,g).enumerable})),e.push.apply(e,t)}return e}function Wd(i){for(var A=1;A<arguments.length;A++){var e=arguments[A]!=null?arguments[A]:{};A%2?jd(Object(e),!0).forEach(function(t){jb(i,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):jd(Object(e)).forEach(function(t){Object.defineProperty(i,t,Object.getOwnPropertyDescriptor(e,t))})}return i}function jb(i,A,e){return(A=Wb(A))in i?Object.defineProperty(i,A,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[A]=e,i}function Wb(i){var A=Xb(i,"string");return JC(A)=="symbol"?A:A+""}function Xb(i,A){if(JC(i)!="object"||!i)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var t=e.call(i,A);if(JC(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(A==="string"?String:Number)(i)}function Zb(i,A,e){return qb(i,Wd(Wd({},A),{},{v2:!0}),e)}function YC(i){"@babel/helpers - typeof";return YC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(A){return typeof A}:function(A){return A&&typeof Symbol=="function"&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},YC(i)}function Xd(i,A){var e=Object.keys(i);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(i);A&&(t=t.filter(function(g){return Object.getOwnPropertyDescriptor(i,g).enumerable})),e.push.apply(e,t)}return e}function zb(i){for(var A=1;A<arguments.length;A++){var e=arguments[A]!=null?arguments[A]:{};A%2?Xd(Object(e),!0).forEach(function(t){$b(i,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):Xd(Object(e)).forEach(function(t){Object.defineProperty(i,t,Object.getOwnPropertyDescriptor(e,t))})}return i}function $b(i,A,e){return(A=AN(A))in i?Object.defineProperty(i,A,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[A]=e,i}function AN(i){var A=eN(i,"string");return YC(A)=="symbol"?A:A+""}function eN(i,A){if(YC(i)!="object"||!i)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var t=e.call(i,A);if(YC(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(A==="string"?String:Number)(i)}function tN(i,A){return CN(i)||IN(i,A)||gN(i,A)||iN()}function iN(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
6069
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mb(i,A){if(i){if(typeof i=="string")return qd(i,A);var e={}.toString.call(i).slice(8,-1);return e==="Object"&&i.constructor&&(e=i.constructor.name),e==="Map"||e==="Set"?Array.from(i):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?qd(i,A):void 0}}function qd(i,A){(A==null||A>i.length)&&(A=i.length);for(var e=0,t=Array(A);e<A;e++)t[e]=i[e];return t}function Hd(i){for(var A="",e=wb(i.split("")),t;!(t=e()).done;){var g=t.value;A+=yb(g,A)||""}return A}function yb(i,A,e){return i==="+"?A?void 0:"+":Td(i)}var Pd="+",bb="[\\-\\.\\(\\)]?",Od="(["+rt+"]|"+bb+")",Nb="^\\"+Pd+Od+"*["+rt+"]"+Od+"*$",kb=new RegExp(Nb,"g"),cr=rt,Sb="["+cr+"]+((\\-)*["+cr+"])*",Rb="a-zA-Z",Gb="["+Rb+"]+((\\-)*["+cr+"])*",Mb="^("+Sb+"\\.)*"+Gb+"\\.?$",Fb=new RegExp(Mb,"g"),Vd="tel:",dr=";phone-context=",Ub=";isub=";function Lb(i){var A=i.indexOf(dr);if(A<0)return null;var e=A+dr.length;if(e>=i.length)return"";var t=i.indexOf(";",e);return t>=0?i.substring(e,t):i.substring(e)}function vb(i){return i===null?!0:i.length===0?!1:kb.test(i)||Fb.test(i)}function Kb(i,A){var e=A.extractFormattedPhoneNumber,t=Lb(i);if(!vb(t))throw new ji("NOT_A_NUMBER");var g;if(t===null)g=e(i)||"";else{g="",t.charAt(0)===Pd&&(g+=t);var I=i.indexOf(Vd),C;I>=0?C=I+Vd.length:C=0;var o=i.indexOf(dr);g+=i.substring(C,o)}var n=g.indexOf(Ub);if(n>0&&(g=g.substring(0,n)),g!=="")return g}var Jb=250,Yb=new RegExp("["+kn+rt+"]"),Tb=new RegExp("[^"+rt+"#]+$");function qb(i,A,e){if(A=A||{},e=new Ze(e),A.defaultCountry&&!e.hasCountry(A.defaultCountry))throw A.v2?new ji("INVALID_COUNTRY"):new Error("Unknown country: ".concat(A.defaultCountry));var t=Pb(i,A.v2,A.extract),g=t.number,I=t.ext,C=t.error;if(!g){if(A.v2)throw C==="TOO_SHORT"?new ji("TOO_SHORT"):new ji("NOT_A_NUMBER");return{}}var o=Vb(g,A.defaultCountry,A.defaultCallingCode,e),n=o.country,a=o.nationalNumber,s=o.countryCallingCode,Q=o.countryCallingCodeSource,r=o.carrierCode;if(!e.hasSelectedNumberingPlan()){if(A.v2)throw new ji("INVALID_COUNTRY");return{}}if(!a||a.length<Cr){if(A.v2)throw new ji("TOO_SHORT");return{}}if(a.length>ky){if(A.v2)throw new ji("TOO_LONG");return{}}if(A.v2){var B=new Kd(s,a,e.metadata);return n&&(B.country=n),r&&(B.carrierCode=r),I&&(B.ext=I),B.__countryCallingCodeSource=Q,B}var h=(A.extended?e.hasSelectedNumberingPlan():n)?Vi(a,e.nationalNumberPattern()):!1;return A.extended?{country:n,countryCallingCode:s,carrierCode:r,valid:h,possible:h?!0:!!(A.extended===!0&&e.possibleLengths()&&wd(a,n,e)),phone:a,ext:I}:h?Ob(n,a,I):{}}function Hb(i,A,e){if(i){if(i.length>Jb){if(e)throw new ji("TOO_LONG");return}if(A===!1)return i;var t=i.search(Yb);if(!(t<0))return i.slice(t).replace(Tb,"")}}function Pb(i,A,e){var t=Kb(i,{extractFormattedPhoneNumber:function(C){return Hb(C,e,A)}});if(!t)return{};if(!Zy(t))return zy(t)?{error:"TOO_SHORT"}:{};var g=fb(t);return g.ext?g:{number:t}}function Ob(i,A,e){var t={country:i,phone:A};return e&&(t.ext=e),t}function Vb(i,A,e,t){var g=sr(Hd(i),void 0,A,e,t.metadata),I=g.countryCallingCodeSource,C=g.countryCallingCode,o=g.number,n;if(C)t.selectNumberingPlan(C);else if(o&&(A||e))t.selectNumberingPlan(A,e),A&&(n=A),C=e||ir(A,t.metadata);else return{};if(!o)return{countryCallingCodeSource:I,countryCallingCode:C};var a=ar(Hd(o),n,t),s=a.nationalNumber,Q=a.carrierCode,r=nr(C,{nationalNumber:s,metadata:t});return r&&(n=r,r==="001"||t.selectNumberingPlan(n)),{country:n,countryCallingCode:C,countryCallingCodeSource:I,nationalNumber:s,carrierCode:Q}}function JC(i){"@babel/helpers - typeof";return JC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(A){return typeof A}:function(A){return A&&typeof Symbol=="function"&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},JC(i)}function jd(i,A){var e=Object.keys(i);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(i);A&&(t=t.filter(function(g){return Object.getOwnPropertyDescriptor(i,g).enumerable})),e.push.apply(e,t)}return e}function Wd(i){for(var A=1;A<arguments.length;A++){var e=arguments[A]!=null?arguments[A]:{};A%2?jd(Object(e),!0).forEach(function(t){jb(i,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):jd(Object(e)).forEach(function(t){Object.defineProperty(i,t,Object.getOwnPropertyDescriptor(e,t))})}return i}function jb(i,A,e){return(A=Wb(A))in i?Object.defineProperty(i,A,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[A]=e,i}function Wb(i){var A=Xb(i,"string");return JC(A)=="symbol"?A:A+""}function Xb(i,A){if(JC(i)!="object"||!i)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var t=e.call(i,A);if(JC(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(A==="string"?String:Number)(i)}function Zb(i,A,e){return qb(i,Wd(Wd({},A),{},{v2:!0}),e)}function YC(i){"@babel/helpers - typeof";return YC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(A){return typeof A}:function(A){return A&&typeof Symbol=="function"&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},YC(i)}function Xd(i,A){var e=Object.keys(i);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(i);A&&(t=t.filter(function(g){return Object.getOwnPropertyDescriptor(i,g).enumerable})),e.push.apply(e,t)}return e}function zb(i){for(var A=1;A<arguments.length;A++){var e=arguments[A]!=null?arguments[A]:{};A%2?Xd(Object(e),!0).forEach(function(t){$b(i,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):Xd(Object(e)).forEach(function(t){Object.defineProperty(i,t,Object.getOwnPropertyDescriptor(e,t))})}return i}function $b(i,A,e){return(A=AN(A))in i?Object.defineProperty(i,A,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[A]=e,i}function AN(i){var A=eN(i,"string");return YC(A)=="symbol"?A:A+""}function eN(i,A){if(YC(i)!="object"||!i)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var t=e.call(i,A);if(YC(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(A==="string"?String:Number)(i)}function tN(i,A){return CN(i)||IN(i,A)||gN(i,A)||iN()}function iN(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
6068
6070
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gN(i,A){if(i){if(typeof i=="string")return Zd(i,A);var e={}.toString.call(i).slice(8,-1);return e==="Object"&&i.constructor&&(e=i.constructor.name),e==="Map"||e==="Set"?Array.from(i):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Zd(i,A):void 0}}function Zd(i,A){(A==null||A>i.length)&&(A=i.length);for(var e=0,t=Array(A);e<A;e++)t[e]=i[e];return t}function IN(i,A){var e=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(e!=null){var t,g,I,C,o=[],n=!0,a=!1;try{if(I=(e=e.call(i)).next,A!==0)for(;!(n=(t=I.call(e)).done)&&(o.push(t.value),o.length!==A);n=!0);}catch(s){a=!0,g=s}finally{try{if(!n&&e.return!=null&&(C=e.return(),Object(C)!==C))return}finally{if(a)throw g}}return o}}function CN(i){if(Array.isArray(i))return i}function oN(i){var A=Array.prototype.slice.call(i),e=tN(A,4),t=e[0],g=e[1],I=e[2],C=e[3],o,n,a;if(typeof t=="string")o=t;else throw new TypeError("A text for parsing must be a string.");if(!g||typeof g=="string")C?(n=I,a=C):(n=void 0,a=I),g&&(n=zb({defaultCountry:g},n));else if(Xg(g))I?(n=g,a=I):a=g;else throw new Error("Invalid second argument: ".concat(g));return{text:o,options:n,metadata:a}}function TC(i){"@babel/helpers - typeof";return TC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(A){return typeof A}:function(A){return A&&typeof Symbol=="function"&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},TC(i)}function zd(i,A){var e=Object.keys(i);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(i);A&&(t=t.filter(function(g){return Object.getOwnPropertyDescriptor(i,g).enumerable})),e.push.apply(e,t)}return e}function $d(i){for(var A=1;A<arguments.length;A++){var e=arguments[A]!=null?arguments[A]:{};A%2?zd(Object(e),!0).forEach(function(t){nN(i,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):zd(Object(e)).forEach(function(t){Object.defineProperty(i,t,Object.getOwnPropertyDescriptor(e,t))})}return i}function nN(i,A,e){return(A=aN(A))in i?Object.defineProperty(i,A,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[A]=e,i}function aN(i){var A=sN(i,"string");return TC(A)=="symbol"?A:A+""}function sN(i,A){if(TC(i)!="object"||!i)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var t=e.call(i,A);if(TC(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(A==="string"?String:Number)(i)}function QN(i,A,e){A&&A.defaultCountry&&!fy(A.defaultCountry,e)&&(A=$d($d({},A),{},{defaultCountry:void 0}));try{return Zb(i,A,e)}catch(t){if(!(t instanceof ji))throw t}}function rN(){var i=oN(arguments),A=i.text,e=i.options,t=i.metadata;return QN(A,e,t)}function qC(i){"@babel/helpers - typeof";return qC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(A){return typeof A}:function(A){return A&&typeof Symbol=="function"&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},qC(i)}function BN(i,A){if(!(i instanceof A))throw new TypeError("Cannot call a class as a function")}function EN(i,A){for(var e=0;e<A.length;e++){var t=A[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(i,dN(t.key),t)}}function cN(i,A,e){return A&&EN(i.prototype,A),Object.defineProperty(i,"prototype",{writable:!1}),i}function dN(i){var A=hN(i,"string");return qC(A)=="symbol"?A:A+""}function hN(i,A){if(qC(i)!="object"||!i)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var t=e.call(i,A);if(qC(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}var lN=function(){function i(A){var e=A.onCountryChange,t=A.onCallingCodeChange;BN(this,i),this.onCountryChange=e,this.onCallingCodeChange=t}return cN(i,[{key:"reset",value:function(e){var t=e.country,g=e.callingCode;this.international=!1,this.missingPlus=!1,this.IDDPrefix=void 0,this.callingCode=void 0,this.digits="",this.resetNationalSignificantNumber(),this.initCountryAndCallingCode(t,g)}},{key:"resetNationalSignificantNumber",value:function(){this.nationalSignificantNumber=this.getNationalDigits(),this.nationalSignificantNumberIsModified=!1,this.nationalPrefix=void 0,this.carrierCode=void 0,this.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix=void 0}},{key:"update",value:function(e){for(var t=0,g=Object.keys(e);t<g.length;t++){var I=g[t];this[I]=e[I]}}},{key:"initCountryAndCallingCode",value:function(e,t){this.setCountry(e),this.setCallingCode(t)}},{key:"setCountry",value:function(e){this.country=e,this.onCountryChange(e)}},{key:"setCallingCode",value:function(e){this.callingCode=e,this.onCallingCodeChange(e,this.country)}},{key:"startInternationalNumber",value:function(e,t){this.international=!0,this.initCountryAndCallingCode(e,t)}},{key:"appendDigits",value:function(e){this.digits+=e}},{key:"appendNationalSignificantNumberDigits",value:function(e){this.nationalSignificantNumber+=e}},{key:"getNationalDigits",value:function(){return this.international?this.digits.slice((this.IDDPrefix?this.IDDPrefix.length:0)+(this.callingCode?this.callingCode.length:0)):this.digits}},{key:"getDigitsWithoutInternationalPrefix",value:function(){return this.international&&this.IDDPrefix?this.digits.slice(this.IDDPrefix.length):this.digits}}])}();function xN(i,A){var e=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(e)return(e=e.call(i)).next.bind(e);if(Array.isArray(i)||(e=uN(i))||A){e&&(i=e);var t=0;return function(){return t>=i.length?{done:!0}:{done:!1,value:i[t++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
6069
6071
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function uN(i,A){if(i){if(typeof i=="string")return Ah(i,A);var e={}.toString.call(i).slice(8,-1);return e==="Object"&&i.constructor&&(e=i.constructor.name),e==="Map"||e==="Set"?Array.from(i):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Ah(i,A):void 0}}function Ah(i,A){(A==null||A>i.length)&&(A=i.length);for(var e=0,t=Array(A);e<A;e++)t[e]=i[e];return t}var ti="x",hr=new RegExp(ti);function Gn(i,A){if(A<1)return"";for(var e="";A>1;)A&1&&(e+=i),A>>=1,i+=i;return e+i}function eh(i,A){return i[A]===")"&&A++,fN(i.slice(0,A))}function fN(i){for(var A=[],e=0;e<i.length;)i[e]==="("?A.push(e):i[e]===")"&&A.pop(),e++;var t=0,g="";A.push(i.length);for(var I=0,C=A;I<C.length;I++){var o=C[I];g+=i.slice(t,o),t=o+1}return g}function DN(i,A,e){for(var t=xN(e.split("")),g;!(g=t()).done;){var I=g.value;if(i.slice(A+1).search(hr)<0)return;A=i.search(hr),i=i.replace(hr,I)}return[i,A]}function _N(i,A,e){var t=e.metadata,g=e.shouldTryNationalPrefixFormattingRule,I=e.getSeparatorAfterNationalPrefix,C=new RegExp("^(?:".concat(A.pattern(),")$"));if(C.test(i.nationalSignificantNumber))return wN(i,A,{metadata:t,shouldTryNationalPrefixFormattingRule:g,getSeparatorAfterNationalPrefix:I})}function pN(i,A,e){return Nn(i,A,e)==="IS_POSSIBLE"}function wN(i,A,e){var t=e.metadata,g=e.shouldTryNationalPrefixFormattingRule,I=e.getSeparatorAfterNationalPrefix;if(i.nationalSignificantNumber,i.international,i.nationalPrefix,i.carrierCode,g(A)){var C=th(i,A,{useNationalPrefixFormattingRule:!0,getSeparatorAfterNationalPrefix:I,metadata:t});if(C)return C}return th(i,A,{useNationalPrefixFormattingRule:!1,getSeparatorAfterNationalPrefix:I,metadata:t})}function th(i,A,e){var t=e.metadata,g=e.useNationalPrefixFormattingRule,I=e.getSeparatorAfterNationalPrefix,C=Gd(i.nationalSignificantNumber,A,{carrierCode:i.carrierCode,useInternationalFormat:i.international,withNationalPrefix:g,metadata:t});if(g||(i.nationalPrefix?C=i.nationalPrefix+I(A)+C:i.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix&&(C=i.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix+" "+C)),mN(C,i))return C}function mN(i,A){return Rn(i)===A.getNationalDigits()}function HC(i){"@babel/helpers - typeof";return HC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(A){return typeof A}:function(A){return A&&typeof Symbol=="function"&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},HC(i)}function yN(i,A){if(!(i instanceof A))throw new TypeError("Cannot call a class as a function")}function bN(i,A){for(var e=0;e<A.length;e++){var t=A[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(i,kN(t.key),t)}}function NN(i,A,e){return A&&bN(i.prototype,A),Object.defineProperty(i,"prototype",{writable:!1}),i}function kN(i){var A=SN(i,"string");return HC(A)=="symbol"?A:A+""}function SN(i,A){if(HC(i)!="object"||!i)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var t=e.call(i,A);if(HC(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}var RN=function(){function i(){yN(this,i)}return NN(i,[{key:"parse",value:function(e){if(this.context=[{or:!0,instructions:[]}],this.parsePattern(e),this.context.length!==1)throw new Error("Non-finalized contexts left when pattern parse ended");var t=this.context[0],g=t.branches,I=t.instructions;if(g)return{op:"|",args:g.concat([lr(I)])};if(I.length===0)throw new Error("Pattern is required");return I.length===1?I[0]:I}},{key:"startContext",value:function(e){this.context.push(e)}},{key:"endContext",value:function(){this.context.pop()}},{key:"getContext",value:function(){return this.context[this.context.length-1]}},{key:"parsePattern",value:function(e){if(!e)throw new Error("Pattern is required");var t=e.match(FN);if(!t){if(MN.test(e))throw new Error("Illegal characters found in a pattern: ".concat(e));this.getContext().instructions=this.getContext().instructions.concat(e.split(""));return}var g=t[1],I=e.slice(0,t.index),C=e.slice(t.index+g.length);switch(g){case"(?:":I&&this.parsePattern(I),this.startContext({or:!0,instructions:[],branches:[]});break;case")":if(!this.getContext().or)throw new Error('")" operator must be preceded by "(?:" operator');if(I&&this.parsePattern(I),this.getContext().instructions.length===0)throw new Error('No instructions found after "|" operator in an "or" group');var o=this.getContext(),n=o.branches;n.push(lr(this.getContext().instructions)),this.endContext(),this.getContext().instructions.push({op:"|",args:n});break;case"|":if(!this.getContext().or)throw new Error('"|" operator can only be used inside "or" groups');if(I&&this.parsePattern(I),!this.getContext().branches)if(this.context.length===1)this.getContext().branches=[];else throw new Error('"branches" not found in an "or" group context');this.getContext().branches.push(lr(this.getContext().instructions)),this.getContext().instructions=[];break;case"[":I&&this.parsePattern(I),this.startContext({oneOfSet:!0});break;case"]":if(!this.getContext().oneOfSet)throw new Error('"]" operator must be preceded by "[" operator');this.endContext(),this.getContext().instructions.push({op:"[]",args:GN(I)});break;default:throw new Error("Unknown operator: ".concat(g))}C&&this.parsePattern(C)}}])}();function GN(i){for(var A=[],e=0;e<i.length;){if(i[e]==="-"){if(e===0||e===i.length-1)throw new Error("Couldn't parse a one-of set pattern: ".concat(i));for(var t=i[e-1].charCodeAt(0)+1,g=i[e+1].charCodeAt(0)-1,I=t;I<=g;)A.push(String.fromCharCode(I)),I++}else A.push(i[e]);e++}return A}var MN=/[\(\)\[\]\?\:\|]/,FN=new RegExp("(\\||\\(\\?\\:|\\)|\\[|\\])");function lr(i){return i.length===1?i[0]:i}function ih(i,A){var e=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(e)return(e=e.call(i)).next.bind(e);if(Array.isArray(i)||(e=UN(i))||A){e&&(i=e);var t=0;return function(){return t>=i.length?{done:!0}:{done:!1,value:i[t++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
6070
6072
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function UN(i,A){if(i){if(typeof i=="string")return gh(i,A);var e={}.toString.call(i).slice(8,-1);return e==="Object"&&i.constructor&&(e=i.constructor.name),e==="Map"||e==="Set"?Array.from(i):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?gh(i,A):void 0}}function gh(i,A){(A==null||A>i.length)&&(A=i.length);for(var e=0,t=Array(A);e<A;e++)t[e]=i[e];return t}function PC(i){"@babel/helpers - typeof";return PC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(A){return typeof A}:function(A){return A&&typeof Symbol=="function"&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},PC(i)}function LN(i,A){if(!(i instanceof A))throw new TypeError("Cannot call a class as a function")}function vN(i,A){for(var e=0;e<A.length;e++){var t=A[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(i,JN(t.key),t)}}function KN(i,A,e){return A&&vN(i.prototype,A),Object.defineProperty(i,"prototype",{writable:!1}),i}function JN(i){var A=YN(i,"string");return PC(A)=="symbol"?A:A+""}function YN(i,A){if(PC(i)!="object"||!i)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var t=e.call(i,A);if(PC(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}var TN=function(){function i(A){LN(this,i),this.matchTree=new RN().parse(A)}return KN(i,[{key:"match",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},g=t.allowOverflow;if(!e)throw new Error("String is required");var I=xr(e.split(""),this.matchTree,!0);if(I&&I.match&&delete I.matchedChars,!(I&&I.overflow&&!g))return I}}])}();function xr(i,A,e){if(typeof A=="string"){var t=i.join("");return A.indexOf(t)===0?i.length===A.length?{match:!0,matchedChars:i}:{partialMatch:!0}:t.indexOf(A)===0?e&&i.length>A.length?{overflow:!0}:{match:!0,matchedChars:i.slice(0,A.length)}:void 0}if(Array.isArray(A)){for(var g=i.slice(),I=0;I<A.length;){var C=A[I],o=xr(g,C,e&&I===A.length-1);if(o){if(o.overflow)return o;if(o.match){if(g=g.slice(o.matchedChars.length),g.length===0)return I===A.length-1?{match:!0,matchedChars:i}:{partialMatch:!0}}else{if(o.partialMatch)return{partialMatch:!0};throw new Error(`Unsupported match result:
6071
6073
  `.concat(JSON.stringify(o,null,2)))}}else return;I++}return e?{overflow:!0}:{match:!0,matchedChars:i.slice(0,i.length-g.length)}}switch(A.op){case"|":for(var n,a=ih(A.args),s;!(s=a()).done;){var Q=s.value,r=xr(i,Q,e);if(r){if(r.overflow)return r;if(r.match)return{match:!0,matchedChars:r.matchedChars};if(r.partialMatch)n=!0;else throw new Error(`Unsupported match result:
6072
6074
  `.concat(JSON.stringify(r,null,2)))}}return n?{partialMatch:!0}:void 0;case"[]":for(var B=ih(A.args),h;!(h=B()).done;){var c=h.value;if(i[0]===c)return i.length===1?{match:!0,matchedChars:i}:e?{overflow:!0}:{match:!0,matchedChars:[c]}}return;default:throw new Error("Unsupported instruction tree: ".concat(A))}}function OC(i){"@babel/helpers - typeof";return OC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(A){return typeof A}:function(A){return A&&typeof Symbol=="function"&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},OC(i)}function Ih(i,A){var e=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(e)return(e=e.call(i)).next.bind(e);if(Array.isArray(i)||(e=qN(i))||A){e&&(i=e);var t=0;return function(){return t>=i.length?{done:!0}:{done:!1,value:i[t++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
6073
6075
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qN(i,A){if(i){if(typeof i=="string")return Ch(i,A);var e={}.toString.call(i).slice(8,-1);return e==="Object"&&i.constructor&&(e=i.constructor.name),e==="Map"||e==="Set"?Array.from(i):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Ch(i,A):void 0}}function Ch(i,A){(A==null||A>i.length)&&(A=i.length);for(var e=0,t=Array(A);e<A;e++)t[e]=i[e];return t}function HN(i,A){if(!(i instanceof A))throw new TypeError("Cannot call a class as a function")}function PN(i,A){for(var e=0;e<A.length;e++){var t=A[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(i,VN(t.key),t)}}function ON(i,A,e){return A&&PN(i.prototype,A),Object.defineProperty(i,"prototype",{writable:!1}),i}function VN(i){var A=jN(i,"string");return OC(A)=="symbol"?A:A+""}function jN(i,A){if(OC(i)!="object"||!i)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var t=e.call(i,A);if(OC(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}var ur="9",WN=15,XN=Gn(ur,WN),ZN=/[- ]/,zN=function(){return/\[([^\[\]])*\]/g},$N=function(){return/\d(?=[^,}][^,}])/g},Ak=new RegExp("["+ei+"]*\\$1["+ei+"]*(\\$\\d["+ei+"]*)*$"),oh=3,ek=function(){function i(A){A.state;var e=A.metadata;HN(this,i),this.metadata=e,this.resetFormat()}return ON(i,[{key:"resetFormat",value:function(){this.chosenFormat=void 0,this.template=void 0,this.nationalNumberTemplate=void 0,this.populatedNationalNumberTemplate=void 0,this.populatedNationalNumberTemplatePosition=-1}},{key:"reset",value:function(e,t){this.resetFormat(),e?(this.isNANP=e.callingCode()==="1",this.matchingFormats=e.formats(),t.nationalSignificantNumber&&this.narrowDownMatchingFormats(t)):(this.isNANP=void 0,this.matchingFormats=[])}},{key:"format",value:function(e,t){var g=this;if(pN(t.nationalSignificantNumber,t.country,this.metadata))for(var I=Ih(this.matchingFormats),C;!(C=I()).done;){var o=C.value,n=_N(t,o,{metadata:this.metadata,shouldTryNationalPrefixFormattingRule:function(s){return g.shouldTryNationalPrefixFormattingRule(s,{international:t.international,nationalPrefix:t.nationalPrefix})},getSeparatorAfterNationalPrefix:function(s){return g.getSeparatorAfterNationalPrefix(s)}});if(n)return this.resetFormat(),this.chosenFormat=o,this.setNationalNumberTemplate(n.replace(/\d/g,ti),t),this.populatedNationalNumberTemplate=n,this.populatedNationalNumberTemplatePosition=this.template.lastIndexOf(ti),n}return this.formatNationalNumberWithNextDigits(e,t)}},{key:"formatNationalNumberWithNextDigits",value:function(e,t){var g=this.chosenFormat,I=this.chooseFormat(t);if(I)return I===g?this.formatNextNationalNumberDigits(e):this.formatNextNationalNumberDigits(t.getNationalDigits())}},{key:"narrowDownMatchingFormats",value:function(e){var t=this,g=e.nationalSignificantNumber,I=e.nationalPrefix,C=e.international,o=g,n=o.length-oh;n<0&&(n=0),this.matchingFormats=this.matchingFormats.filter(function(a){return t.formatSuits(a,C,I)&&t.formatMatches(a,o,n)}),this.chosenFormat&&this.matchingFormats.indexOf(this.chosenFormat)===-1&&this.resetFormat()}},{key:"formatSuits",value:function(e,t,g){return!(g&&!e.usesNationalPrefix()&&!e.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!t&&!g&&e.nationalPrefixIsMandatoryWhenFormattingInNationalFormat())}},{key:"formatMatches",value:function(e,t,g){var I=e.leadingDigitsPatterns().length;if(I===0)return!0;g=Math.min(g,I-1);var C=e.leadingDigitsPatterns()[g];if(t.length<oh)try{return new TN(C).match(t,{allowOverflow:!0})!==void 0}catch(o){return console.error(o),!0}return new RegExp("^(".concat(C,")")).test(t)}},{key:"getFormatFormat",value:function(e,t){return t?e.internationalFormat():e.format()}},{key:"chooseFormat",value:function(e){for(var t=this,g=function(){var a=o.value;return t.chosenFormat===a?0:Ak.test(t.getFormatFormat(a,e.international))?t.createTemplateForFormat(a,e)?(t.chosenFormat=a,0):(t.matchingFormats=t.matchingFormats.filter(function(s){return s!==a}),1):1},I,C=Ih(this.matchingFormats.slice()),o;!(o=C()).done&&(I=g(),I!==0););return this.chosenFormat||this.resetFormat(),this.chosenFormat}},{key:"createTemplateForFormat",value:function(e,t){if(!(e.pattern().indexOf("|")>=0)){var g=this.getTemplateForFormat(e,t);if(g)return this.setNationalNumberTemplate(g,t),!0}}},{key:"getSeparatorAfterNationalPrefix",value:function(e){return this.isNANP||e&&e.nationalPrefixFormattingRule()&&ZN.test(e.nationalPrefixFormattingRule())?" ":""}},{key:"getInternationalPrefixBeforeCountryCallingCode",value:function(e,t){var g=e.IDDPrefix,I=e.missingPlus;return g?t&&t.spacing===!1?g:g+" ":I?"":"+"}},{key:"getTemplate",value:function(e){if(this.template){for(var t=-1,g=0,I=e.international?this.getInternationalPrefixBeforeCountryCallingCode(e,{spacing:!1}):"";g<I.length+e.getDigitsWithoutInternationalPrefix().length;)t=this.template.indexOf(ti,t+1),g++;return eh(this.template,t+1)}}},{key:"setNationalNumberTemplate",value:function(e,t){this.nationalNumberTemplate=e,this.populatedNationalNumberTemplate=e,this.populatedNationalNumberTemplatePosition=-1,t.international?this.template=this.getInternationalPrefixBeforeCountryCallingCode(t).replace(/[\d\+]/g,ti)+Gn(ti,t.callingCode.length)+" "+e:this.template=e}},{key:"getTemplateForFormat",value:function(e,t){var g=t.nationalSignificantNumber,I=t.international,C=t.nationalPrefix,o=t.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix,n=e.pattern();n=n.replace(zN(),"\\d").replace($N(),"\\d");var a=XN.match(n)[0];if(!(g.length>a.length)){var s=new RegExp("^"+n+"$"),Q=g.replace(/\d/g,ur);s.test(Q)&&(a=Q);var r=this.getFormatFormat(e,I),B;if(this.shouldTryNationalPrefixFormattingRule(e,{international:I,nationalPrefix:C})){var h=r.replace(Rd,e.nationalPrefixFormattingRule());if(Rn(e.nationalPrefixFormattingRule())===(C||"")+Rn("$1")&&(r=h,B=!0,C))for(var c=C.length;c>0;)r=r.replace(/\d/,ti),c--}var d=a.replace(new RegExp(n),r).replace(new RegExp(ur,"g"),ti);return B||(o?d=Gn(ti,o.length)+" "+d:C&&(d=Gn(ti,C.length)+this.getSeparatorAfterNationalPrefix(e)+d)),I&&(d=Sd(d)),d}}},{key:"formatNextNationalNumberDigits",value:function(e){var t=DN(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition,e);if(!t){this.resetFormat();return}return this.populatedNationalNumberTemplate=t[0],this.populatedNationalNumberTemplatePosition=t[1],eh(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition+1)}},{key:"shouldTryNationalPrefixFormattingRule",value:function(e,t){var g=t.international,I=t.nationalPrefix;if(e.nationalPrefixFormattingRule()){var C=e.usesNationalPrefix();if(C&&I||!C&&!g)return!0}}}])}();function VC(i){"@babel/helpers - typeof";return VC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(A){return typeof A}:function(A){return A&&typeof Symbol=="function"&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},VC(i)}function nh(i,A){return Ik(i)||gk(i,A)||ik(i,A)||tk()}function tk(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
6074
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ik(i,A){if(i){if(typeof i=="string")return ah(i,A);var e={}.toString.call(i).slice(8,-1);return e==="Object"&&i.constructor&&(e=i.constructor.name),e==="Map"||e==="Set"?Array.from(i):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?ah(i,A):void 0}}function ah(i,A){(A==null||A>i.length)&&(A=i.length);for(var e=0,t=Array(A);e<A;e++)t[e]=i[e];return t}function gk(i,A){var e=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(e!=null){var t,g,I,C,o=[],n=!0,a=!1;try{if(I=(e=e.call(i)).next,A!==0)for(;!(n=(t=I.call(e)).done)&&(o.push(t.value),o.length!==A);n=!0);}catch(s){a=!0,g=s}finally{try{if(!n&&e.return!=null&&(C=e.return(),Object(C)!==C))return}finally{if(a)throw g}}return o}}function Ik(i){if(Array.isArray(i))return i}function Ck(i,A){if(!(i instanceof A))throw new TypeError("Cannot call a class as a function")}function ok(i,A){for(var e=0;e<A.length;e++){var t=A[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(i,ak(t.key),t)}}function nk(i,A,e){return A&&ok(i.prototype,A),Object.defineProperty(i,"prototype",{writable:!1}),i}function ak(i){var A=sk(i,"string");return VC(A)=="symbol"?A:A+""}function sk(i,A){if(VC(i)!="object"||!i)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var t=e.call(i,A);if(VC(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}var Qk="["+ei+Qt+"]+",rk=new RegExp("^"+Qk+"$","i"),Bk="(?:["+kn+"]["+ei+Qt+"]*|["+ei+Qt+"]+)",Ek=new RegExp("[^"+ei+Qt+"]+.*$"),ck=/[^\d\[\]]/,dk=function(){function i(A){var e=A.defaultCountry,t=A.defaultCallingCode,g=A.metadata,I=A.onNationalSignificantNumberChange;Ck(this,i),this.defaultCountry=e,this.defaultCallingCode=t,this.metadata=g,this.onNationalSignificantNumberChange=I}return nk(i,[{key:"input",value:function(e,t){var g=xk(e),I=nh(g,2),C=I[0],o=I[1],n=Rn(C),a;return o&&(t.digits||(t.startInternationalNumber(void 0,void 0),n||(a=!0))),n&&this.inputDigits(n,t),{digits:n,justLeadingPlus:a}}},{key:"inputDigits",value:function(e,t){var g=t.digits,I=g.length<3&&g.length+e.length>=3;if(t.appendDigits(e),I&&this.extractIddPrefix(t),this.isWaitingForCountryCallingCode(t)){if(!this.extractCountryCallingCode(t))return}else t.appendNationalSignificantNumberDigits(e);t.international||this.hasExtractedNationalSignificantNumber||this.extractNationalSignificantNumber(t.getNationalDigits(),function(C){return t.update(C)})}},{key:"isWaitingForCountryCallingCode",value:function(e){var t=e.international,g=e.callingCode;return t&&!g}},{key:"extractCountryCallingCode",value:function(e){var t=sr("+"+e.getDigitsWithoutInternationalPrefix(),e.country,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),g=t.countryCallingCode,I=t.number;if(g)return e.setCallingCode(g),e.update({nationalSignificantNumber:I}),!0}},{key:"reset",value:function(e){if(e){this.hasSelectedNumberingPlan=!0;var t=e._nationalPrefixForParsing();this.couldPossiblyExtractAnotherNationalSignificantNumber=t&&ck.test(t)}else this.hasSelectedNumberingPlan=void 0,this.couldPossiblyExtractAnotherNationalSignificantNumber=void 0}},{key:"extractNationalSignificantNumber",value:function(e,t){if(this.hasSelectedNumberingPlan){var g=or(e,this.metadata),I=g.nationalPrefix,C=g.nationalNumber,o=g.carrierCode;if(C!==e)return this.onExtractedNationalNumber(I,o,C,e,t),!0}}},{key:"extractAnotherNationalSignificantNumber",value:function(e,t,g){if(!this.hasExtractedNationalSignificantNumber)return this.extractNationalSignificantNumber(e,g);if(this.couldPossiblyExtractAnotherNationalSignificantNumber){var I=or(e,this.metadata),C=I.nationalPrefix,o=I.nationalNumber,n=I.carrierCode;if(o!==t)return this.onExtractedNationalNumber(C,n,o,e,g),!0}}},{key:"onExtractedNationalNumber",value:function(e,t,g,I,C){var o=!1,n,a=I.lastIndexOf(g);if(a<0||a!==I.length-g.length)o=!0;else{var s=I.slice(0,a);s&&s!==e&&(n=s)}C({nationalPrefix:e,carrierCode:t,nationalSignificantNumber:g,nationalSignificantNumberIsModified:o,prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix:n}),this.hasExtractedNationalSignificantNumber=!0,this.onNationalSignificantNumberChange()}},{key:"reExtractNationalSignificantNumber",value:function(e){if(this.extractAnotherNationalSignificantNumber(e.getNationalDigits(),e.nationalSignificantNumber,function(t){return e.update(t)}))return!0;if(this.extractIddPrefix(e))return this.extractCallingCodeAndNationalSignificantNumber(e),!0;if(this.fixMissingPlus(e))return this.extractCallingCodeAndNationalSignificantNumber(e),!0}},{key:"extractIddPrefix",value:function(e){var t=e.international,g=e.IDDPrefix,I=e.digits;if(e.nationalSignificantNumber,!(t||g)){var C=yd(I,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata);if(C!==void 0&&C!==I)return e.update({IDDPrefix:I.slice(0,I.length-C.length)}),this.startInternationalNumber(e,{country:void 0,callingCode:void 0}),!0}}},{key:"fixMissingPlus",value:function(e){if(!e.international){var t=kd(e.digits,e.country,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),g=t.countryCallingCode;if(g)return e.update({missingPlus:!0}),this.startInternationalNumber(e,{country:e.country,callingCode:g}),!0}}},{key:"startInternationalNumber",value:function(e,t){var g=t.country,I=t.callingCode;e.startInternationalNumber(g,I),e.nationalSignificantNumber&&(e.resetNationalSignificantNumber(),this.onNationalSignificantNumberChange(),this.hasExtractedNationalSignificantNumber=void 0)}},{key:"extractCallingCodeAndNationalSignificantNumber",value:function(e){this.extractCountryCallingCode(e)&&this.extractNationalSignificantNumber(e.getNationalDigits(),function(t){return e.update(t)})}}])}();function hk(i){var A=i.search(Bk);if(!(A<0)){i=i.slice(A);var e;return i[0]==="+"&&(e=!0,i=i.slice(1)),i=i.replace(Ek,""),e&&(i="+"+i),i}}function lk(i){var A=hk(i)||"";return A[0]==="+"?[A.slice(1),!0]:[A]}function xk(i){var A=lk(i),e=nh(A,2),t=e[0],g=e[1];return rk.test(t)||(t=""),[t,g]}function jC(i){"@babel/helpers - typeof";return jC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(A){return typeof A}:function(A){return A&&typeof Symbol=="function"&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},jC(i)}function uk(i,A){return pk(i)||_k(i,A)||Dk(i,A)||fk()}function fk(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
6075
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Dk(i,A){if(i){if(typeof i=="string")return sh(i,A);var e={}.toString.call(i).slice(8,-1);return e==="Object"&&i.constructor&&(e=i.constructor.name),e==="Map"||e==="Set"?Array.from(i):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?sh(i,A):void 0}}function sh(i,A){(A==null||A>i.length)&&(A=i.length);for(var e=0,t=Array(A);e<A;e++)t[e]=i[e];return t}function _k(i,A){var e=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(e!=null){var t,g,I,C,o=[],n=!0,a=!1;try{if(I=(e=e.call(i)).next,A!==0)for(;!(n=(t=I.call(e)).done)&&(o.push(t.value),o.length!==A);n=!0);}catch(s){a=!0,g=s}finally{try{if(!n&&e.return!=null&&(C=e.return(),Object(C)!==C))return}finally{if(a)throw g}}return o}}function pk(i){if(Array.isArray(i))return i}function wk(i,A){if(!(i instanceof A))throw new TypeError("Cannot call a class as a function")}function mk(i,A){for(var e=0;e<A.length;e++){var t=A[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(i,bk(t.key),t)}}function yk(i,A,e){return A&&mk(i.prototype,A),Object.defineProperty(i,"prototype",{writable:!1}),i}function bk(i){var A=Nk(i,"string");return jC(A)=="symbol"?A:A+""}function Nk(i,A){if(jC(i)!="object"||!i)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var t=e.call(i,A);if(jC(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}var Qh=function(){function i(A,e){wk(this,i),this.metadata=new Ze(e);var t=this.getCountryAndCallingCode(A),g=uk(t,2),I=g[0],C=g[1];this.defaultCountry=I,this.defaultCallingCode=C,this.reset()}return yk(i,[{key:"getCountryAndCallingCode",value:function(e){var t,g;return e&&(Xg(e)?(t=e.defaultCountry,g=e.defaultCallingCode):t=e),t&&!this.metadata.hasCountry(t)&&(t=void 0),[t,g]}},{key:"input",value:function(e){var t=this.parser.input(e,this.state),g=t.digits,I=t.justLeadingPlus;if(I)this.formattedOutput="+";else if(g){this.determineTheCountryIfNeeded(),this.state.nationalSignificantNumber&&this.formatter.narrowDownMatchingFormats(this.state);var C;if(this.metadata.hasSelectedNumberingPlan()&&(C=this.formatter.format(g,this.state)),C===void 0&&this.parser.reExtractNationalSignificantNumber(this.state)){this.determineTheCountryIfNeeded();var o=this.state.getNationalDigits();o&&(C=this.formatter.format(o,this.state))}this.formattedOutput=C?this.getFullNumber(C):this.getNonFormattedNumber()}return this.formattedOutput}},{key:"reset",value:function(){var e=this;return this.state=new lN({onCountryChange:function(g){e.country=g},onCallingCodeChange:function(g,I){e.metadata.selectNumberingPlan(I,g),e.formatter.reset(e.metadata.numberingPlan,e.state),e.parser.reset(e.metadata.numberingPlan)}}),this.formatter=new ek({state:this.state,metadata:this.metadata}),this.parser=new dk({defaultCountry:this.defaultCountry,defaultCallingCode:this.defaultCallingCode,metadata:this.metadata,state:this.state,onNationalSignificantNumberChange:function(){e.determineTheCountryIfNeeded(),e.formatter.reset(e.metadata.numberingPlan,e.state)}}),this.state.reset({country:this.defaultCountry,callingCode:this.defaultCallingCode}),this.formattedOutput="",this}},{key:"isInternational",value:function(){return this.state.international}},{key:"getCallingCode",value:function(){if(this.isInternational())return this.state.callingCode}},{key:"getCountryCallingCode",value:function(){return this.getCallingCode()}},{key:"getCountry",value:function(){var e=this.state.digits;if(e)return this._getCountry()}},{key:"_getCountry",value:function(){var e=this.state.country;return e}},{key:"determineTheCountryIfNeeded",value:function(){(!this.state.country||this.isCountryCallingCodeAmbiguous())&&this.determineTheCountry()}},{key:"getFullNumber",value:function(e){var t=this;if(this.isInternational()){var g=function(o){return t.formatter.getInternationalPrefixBeforeCountryCallingCode(t.state,{spacing:!!o})+o},I=this.state.callingCode;return g(I?e?"".concat(I," ").concat(e):I:"".concat(this.state.getDigitsWithoutInternationalPrefix()))}return e}},{key:"getNonFormattedNationalNumberWithPrefix",value:function(){var e=this.state,t=e.nationalSignificantNumber,g=e.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix,I=e.nationalPrefix,C=t,o=g||I;return o&&(C=o+C),C}},{key:"getNonFormattedNumber",value:function(){var e=this.state.nationalSignificantNumberIsModified;return this.getFullNumber(e?this.state.getNationalDigits():this.getNonFormattedNationalNumberWithPrefix())}},{key:"getNonFormattedTemplate",value:function(){var e=this.getNonFormattedNumber();if(e)return e.replace(/[\+\d]/g,ti)}},{key:"isCountryCallingCodeAmbiguous",value:function(){var e=this.state.callingCode,t=this.metadata.getCountryCodesForCallingCode(e);return t&&t.length>1}},{key:"determineTheCountry",value:function(){this.state.setCountry(nr(this.isInternational()?this.state.callingCode:this.defaultCallingCode,{nationalNumber:this.state.nationalSignificantNumber,metadata:this.metadata}))}},{key:"getNumberValue",value:function(){var e=this.state,t=e.digits,g=e.callingCode,I=e.country,C=e.nationalSignificantNumber;if(t){if(this.isInternational())return g?"+"+g+C:"+"+t;if(I||g){var o=I?this.metadata.countryCallingCode():g;return"+"+o+C}}}},{key:"getNumber",value:function(){var e=this.state,t=e.nationalSignificantNumber,g=e.carrierCode,I=e.callingCode,C=this._getCountry();if(t&&!(!C&&!I)){if(C&&C===this.defaultCountry){var o=new Ze(this.metadata.metadata);o.selectNumberingPlan(C);var n=o.numberingPlan.callingCode(),a=this.metadata.getCountryCodesForCallingCode(n);if(a.length>1){var s=Nd(t,{countries:a,metadata:this.metadata.metadata});s&&(C=s)}}var Q=new Kd(C||I,t,this.metadata.metadata);return g&&(Q.carrierCode=g),Q}}},{key:"isPossible",value:function(){var e=this.getNumber();return e?e.isPossible():!1}},{key:"isValid",value:function(){var e=this.getNumber();return e?e.isValid():!1}},{key:"getNationalNumber",value:function(){return this.state.nationalSignificantNumber}},{key:"getChars",value:function(){return(this.state.international?"+":"")+this.state.digits}},{key:"getTemplate",value:function(){return this.formatter.getTemplate(this.state)||this.getNonFormattedTemplate()||""}}])}();function rh(){return ay(rN,arguments)}function Mn(i){return Qh.call(this,i,ld)}Mn.prototype=Object.create(Qh.prototype,{}),Mn.prototype.constructor=Mn;class Bh extends Error{constructor(A,e){super(e.message??`HTTP ${A}`),this.status=A,this.body=e}}async function Fn(i,A){const e=await fetch(i,{...A,headers:{"Content-Type":"application/json",...(A==null?void 0:A.headers)??{}}});if(!e.ok){let t;try{const g=await e.json();t={error_code:g.error_code??"unknown",message:typeof g.message=="string"?g.message:"Request failed",retry_after_seconds:g.retry_after_seconds}}catch{t={error_code:"unknown",message:`HTTP ${e.status}`}}throw new Bh(e.status,t)}if(e.status!==204)return await e.json()}async function kk(i,A=ui){return Fn(`${A}/v1/widget/callback/${i}/manifest`)}async function Sk(i,A,e,t=ui,g,I){return Fn(`${t}/v1/widget/callback/${i}/submit`,{method:"POST",body:JSON.stringify({phone:A,country:e,source_metadata:{page_url:window.location.href},...I?{recaptcha_token:I}:{}})})}async function Rk(i,A=ui,e){return Fn(`${A}/v1/widget/callback/request/${i}/status`,{signal:e})}async function Gk(i,A=ui){await Fn(`${A}/v1/widget/callback/request/${i}`,{method:"DELETE"})}const fr={en:{pill_label:"Call me back",dialog_aria_label:"Callback request",form_title:"Request a callback",form_lead:"Leave your number — we'll call you back in a moment.",search_placeholder:"Search country or +code",coming_soon_badge:"coming soon",submit_btn:"Call me back",submitting_btn:"Submitting…",terms_prefix:"By submitting you agree to our",terms_and:"and",terms_label:"terms",privacy_label:"privacy policy",queue_title:"In queue",queue_next:"You're next — we'll dial as soon as the agent is free.",queue_position:"You're #{n} in line.",queue_wait:"Approx. wait: {n} {unit}",queue_minute:"minute",queue_minutes:"minutes",queue_cancel:"Cancel request",dialing_title:"Calling you now",dialing_body:"Your phone should ring in a moment.",completed_title:"Done",completed_body:"Thanks for talking with us!",close_btn:"Close",failed_title:"We couldn't reach you",retry_btn:"Try again",reload_to_retry:"Reload the page to make another callback.",rate_limited_title:"Too many requests",rate_limited_body:"You've already submitted a few callbacks recently. Try again in {n} {unit}.",error_rate_limit_phone:"Too many callback requests for this number. Try again later.",error_queue_full:"Callback queue is full. Try again in a few minutes.",error_callback_disabled:"Callback is not available for this agent.",error_invalid_phone:"That phone number is not valid.",error_country_not_supported:"This country is not supported.",error_blocked_prefix:"This destination is not allowed.",error_no_outbound_number:"This agent has no phone number configured.",error_plan_required:"A paid subscription is required.",error_domain_not_allowed:"The widget is not authorised on this domain.",error_agent_not_found:"Agent not found.",error_token_invalid:"Invalid request.",error_config_disabled:"Callback is currently disabled.",error_insufficient_credits:"Not enough credits to place this call.",error_unknown:"Something went wrong. Please try again."},de:{pill_label:"Rückruf anfordern",dialog_aria_label:"Rückrufanfrage",form_title:"Rückruf anfordern",form_lead:"Hinterlassen Sie Ihre Nummer — wir rufen Sie gleich zurück.",search_placeholder:"Land oder +Code suchen",coming_soon_badge:"demnächst",submit_btn:"Zurückrufen",submitting_btn:"Wird gesendet…",terms_prefix:"Mit dem Absenden stimmen Sie unseren",terms_and:"und der",terms_label:"AGB",privacy_label:"Datenschutzerklärung zu",queue_title:"In der Warteschlange",queue_next:"Sie sind als Nächstes dran — wir wählen, sobald der Agent frei ist.",queue_position:"Sie sind Nummer {n} in der Warteschlange.",queue_wait:"Voraussichtliche Wartezeit: {n} {unit}",queue_minute:"Minute",queue_minutes:"Minuten",queue_cancel:"Anfrage abbrechen",dialing_title:"Wir rufen Sie jetzt an",dialing_body:"Ihr Telefon sollte gleich klingeln.",completed_title:"Fertig",completed_body:"Vielen Dank für das Gespräch!",close_btn:"Schließen",failed_title:"Wir konnten Sie nicht erreichen",retry_btn:"Erneut versuchen",reload_to_retry:"Laden Sie die Seite neu, um einen weiteren Rückruf anzufordern.",rate_limited_title:"Zu viele Anfragen",rate_limited_body:"Sie haben kürzlich bereits mehrere Rückrufe angefordert. Versuchen Sie es in {n} {unit} erneut.",error_rate_limit_phone:"Zu viele Rückrufanfragen für diese Nummer. Versuchen Sie es später erneut.",error_queue_full:"Die Warteschlange ist voll. Versuchen Sie es in wenigen Minuten erneut.",error_callback_disabled:"Rückruf für diesen Agenten nicht verfügbar.",error_invalid_phone:"Diese Telefonnummer ist ungültig.",error_country_not_supported:"Dieses Land wird nicht unterstützt.",error_blocked_prefix:"Dieses Ziel ist nicht erlaubt.",error_no_outbound_number:"Für diesen Agenten ist keine Nummer konfiguriert.",error_plan_required:"Ein kostenpflichtiges Abonnement ist erforderlich.",error_domain_not_allowed:"Das Widget ist auf dieser Domain nicht zugelassen.",error_agent_not_found:"Agent nicht gefunden.",error_token_invalid:"Ungültige Anfrage.",error_config_disabled:"Rückruf ist derzeit deaktiviert.",error_insufficient_credits:"Nicht genügend Guthaben, um diesen Anruf zu tätigen.",error_unknown:"Etwas ist schiefgelaufen. Bitte versuchen Sie es erneut."},fr:{pill_label:"Être rappelé",dialog_aria_label:"Demande de rappel",form_title:"Demander un rappel",form_lead:"Laissez votre numéro — nous vous rappelons dans un instant.",search_placeholder:"Rechercher un pays ou un +code",coming_soon_badge:"bientôt",submit_btn:"Me rappeler",submitting_btn:"Envoi…",terms_prefix:"En envoyant, vous acceptez nos",terms_and:"et notre",terms_label:"conditions",privacy_label:"politique de confidentialité",queue_title:"Dans la file",queue_next:"Vous êtes le prochain — nous composons dès que l'agent est libre.",queue_position:"Vous êtes en position {n} dans la file.",queue_wait:"Attente estimée : {n} {unit}",queue_minute:"minute",queue_minutes:"minutes",queue_cancel:"Annuler la demande",dialing_title:"Nous vous appelons",dialing_body:"Votre téléphone devrait sonner dans un instant.",completed_title:"Terminé",completed_body:"Merci pour cet échange !",close_btn:"Fermer",failed_title:"Nous n'avons pas pu vous joindre",retry_btn:"Réessayer",reload_to_retry:"Rechargez la page pour demander un nouveau rappel.",rate_limited_title:"Trop de demandes",rate_limited_body:"Vous avez déjà soumis plusieurs rappels récemment. Réessayez dans {n} {unit}.",error_rate_limit_phone:"Trop de demandes de rappel pour ce numéro. Réessayez plus tard.",error_queue_full:"La file de rappels est pleine. Réessayez dans quelques minutes.",error_callback_disabled:"Le rappel n'est pas disponible pour cet agent.",error_invalid_phone:"Ce numéro de téléphone n'est pas valide.",error_country_not_supported:"Ce pays n'est pas pris en charge.",error_blocked_prefix:"Cette destination n'est pas autorisée.",error_no_outbound_number:"Aucun numéro n'est configuré pour cet agent.",error_plan_required:"Un abonnement payant est requis.",error_domain_not_allowed:"Le widget n'est pas autorisé sur ce domaine.",error_agent_not_found:"Agent introuvable.",error_token_invalid:"Requête invalide.",error_config_disabled:"Le rappel est actuellement désactivé.",error_insufficient_credits:"Crédits insuffisants pour passer cet appel.",error_unknown:"Une erreur est survenue. Veuillez réessayer."},es:{pill_label:"Que me llamen",dialog_aria_label:"Solicitud de devolución de llamada",form_title:"Solicitar una llamada",form_lead:"Deja tu número — te llamamos enseguida.",search_placeholder:"Buscar país o +código",coming_soon_badge:"próximamente",submit_btn:"Que me llamen",submitting_btn:"Enviando…",terms_prefix:"Al enviar aceptas nuestros",terms_and:"y la",terms_label:"términos",privacy_label:"política de privacidad",queue_title:"En cola",queue_next:"Eres el siguiente — llamaremos en cuanto el agente esté libre.",queue_position:"Estás en la posición {n} de la cola.",queue_wait:"Espera aprox.: {n} {unit}",queue_minute:"minuto",queue_minutes:"minutos",queue_cancel:"Cancelar solicitud",dialing_title:"Te estamos llamando",dialing_body:"Tu teléfono debería sonar en un momento.",completed_title:"Listo",completed_body:"¡Gracias por hablar con nosotros!",close_btn:"Cerrar",failed_title:"No pudimos contactarte",retry_btn:"Reintentar",reload_to_retry:"Recarga la página para solicitar otra llamada.",rate_limited_title:"Demasiadas solicitudes",rate_limited_body:"Has enviado varias solicitudes recientemente. Inténtalo de nuevo en {n} {unit}.",error_rate_limit_phone:"Demasiadas solicitudes para este número. Inténtalo más tarde.",error_queue_full:"La cola está llena. Inténtalo en unos minutos.",error_callback_disabled:"La llamada no está disponible para este agente.",error_invalid_phone:"Ese número de teléfono no es válido.",error_country_not_supported:"Este país no está soportado.",error_blocked_prefix:"Este destino no está permitido.",error_no_outbound_number:"Este agente no tiene número configurado.",error_plan_required:"Se requiere una suscripción de pago.",error_domain_not_allowed:"El widget no está autorizado en este dominio.",error_agent_not_found:"Agente no encontrado.",error_token_invalid:"Solicitud no válida.",error_config_disabled:"La llamada está deshabilitada actualmente.",error_insufficient_credits:"No hay créditos suficientes para esta llamada.",error_unknown:"Algo salió mal. Inténtalo de nuevo."},it:{pill_label:"Richiamami",dialog_aria_label:"Richiesta di richiamata",form_title:"Richiedi una chiamata",form_lead:"Lascia il tuo numero — ti chiamiamo subito.",search_placeholder:"Cerca paese o +prefisso",coming_soon_badge:"in arrivo",submit_btn:"Richiamami",submitting_btn:"Invio…",terms_prefix:"Inviando accetti i nostri",terms_and:"e l'",terms_label:"termini",privacy_label:"informativa sulla privacy",queue_title:"In coda",queue_next:"Sei il prossimo — chiameremo non appena l'agente sarà libero.",queue_position:"Sei in posizione {n} in coda.",queue_wait:"Attesa stimata: {n} {unit}",queue_minute:"minuto",queue_minutes:"minuti",queue_cancel:"Annulla richiesta",dialing_title:"Ti stiamo chiamando",dialing_body:"Il telefono dovrebbe squillare a momenti.",completed_title:"Fatto",completed_body:"Grazie per averci parlato!",close_btn:"Chiudi",failed_title:"Non siamo riusciti a raggiungerti",retry_btn:"Riprova",reload_to_retry:"Ricarica la pagina per richiedere un'altra chiamata.",rate_limited_title:"Troppe richieste",rate_limited_body:"Hai già inviato diverse richieste di recente. Riprova fra {n} {unit}.",error_rate_limit_phone:"Troppe richieste per questo numero. Riprova più tardi.",error_queue_full:"La coda è piena. Riprova fra qualche minuto.",error_callback_disabled:"La richiamata non è disponibile per questo agente.",error_invalid_phone:"Questo numero non è valido.",error_country_not_supported:"Questo paese non è supportato.",error_blocked_prefix:"Questa destinazione non è consentita.",error_no_outbound_number:"Questo agente non ha un numero configurato.",error_plan_required:"È richiesto un abbonamento a pagamento.",error_domain_not_allowed:"Il widget non è autorizzato su questo dominio.",error_agent_not_found:"Agente non trovato.",error_token_invalid:"Richiesta non valida.",error_config_disabled:"La richiamata è attualmente disattivata.",error_insufficient_credits:"Crediti insufficienti per effettuare questa chiamata.",error_unknown:"Qualcosa è andato storto. Riprova."},pt:{pill_label:"Ligue-me de volta",dialog_aria_label:"Pedido de retorno de chamada",form_title:"Pedir uma chamada de retorno",form_lead:"Deixe o seu número — ligamos de volta em instantes.",search_placeholder:"Procurar país ou +código",coming_soon_badge:"em breve",submit_btn:"Ligue-me de volta",submitting_btn:"A enviar…",terms_prefix:"Ao enviar concorda com os nossos",terms_and:"e a",terms_label:"termos",privacy_label:"política de privacidade",queue_title:"Na fila",queue_next:"É o próximo — ligaremos assim que o agente estiver disponível.",queue_position:"Está em #{n} na fila.",queue_wait:"Espera aprox.: {n} {unit}",queue_minute:"minuto",queue_minutes:"minutos",queue_cancel:"Cancelar pedido",dialing_title:"A ligar para si",dialing_body:"O seu telefone deve tocar dentro de momentos.",completed_title:"Concluído",completed_body:"Obrigado pela conversa!",close_btn:"Fechar",failed_title:"Não conseguimos contactá-lo",retry_btn:"Tentar de novo",reload_to_retry:"Recarregue a página para pedir outra chamada.",rate_limited_title:"Demasiados pedidos",rate_limited_body:"Já submeteu vários pedidos recentemente. Tente novamente em {n} {unit}.",error_rate_limit_phone:"Demasiados pedidos para este número. Tente mais tarde.",error_queue_full:"A fila está cheia. Tente novamente em alguns minutos.",error_callback_disabled:"A chamada de retorno não está disponível para este agente.",error_invalid_phone:"Este número não é válido.",error_country_not_supported:"Este país não é suportado.",error_blocked_prefix:"Este destino não é permitido.",error_no_outbound_number:"Este agente não tem número configurado.",error_plan_required:"É necessária uma subscrição paga.",error_domain_not_allowed:"O widget não está autorizado neste domínio.",error_agent_not_found:"Agente não encontrado.",error_token_invalid:"Pedido inválido.",error_config_disabled:"A chamada de retorno está atualmente desativada.",error_insufficient_credits:"Créditos insuficientes para esta chamada.",error_unknown:"Algo correu mal. Tente novamente."},pl:{pill_label:"Oddzwoń do mnie",dialog_aria_label:"Prośba o oddzwonienie",form_title:"Poproś o oddzwonienie",form_lead:"Zostaw swój numer — oddzwonimy za chwilę.",search_placeholder:"Szukaj kraju lub +kodu",coming_soon_badge:"wkrótce",submit_btn:"Oddzwoń do mnie",submitting_btn:"Wysyłanie…",terms_prefix:"Wysyłając zgadzasz się z naszymi",terms_and:"oraz",terms_label:"regulaminem",privacy_label:"polityką prywatności",queue_title:"W kolejce",queue_next:"Jesteś następny — zadzwonimy, gdy agent będzie wolny.",queue_position:"Jesteś na pozycji {n} w kolejce.",queue_wait:"Szacowany czas oczekiwania: {n} {unit}",queue_minute:"minuta",queue_minutes:"minut",queue_cancel:"Anuluj prośbę",dialing_title:"Dzwonimy do Ciebie",dialing_body:"Telefon powinien zadzwonić za moment.",completed_title:"Gotowe",completed_body:"Dziękujemy za rozmowę!",close_btn:"Zamknij",failed_title:"Nie udało nam się do Ciebie dodzwonić",retry_btn:"Spróbuj ponownie",reload_to_retry:"Odśwież stronę, aby zamówić kolejne oddzwonienie.",rate_limited_title:"Zbyt wiele żądań",rate_limited_body:"Wysłałeś już ostatnio kilka próśb. Spróbuj ponownie za {n} {unit}.",error_rate_limit_phone:"Zbyt wiele próśb dla tego numeru. Spróbuj później.",error_queue_full:"Kolejka jest pełna. Spróbuj za kilka minut.",error_callback_disabled:"Oddzwanianie jest niedostępne dla tego agenta.",error_invalid_phone:"Ten numer telefonu jest nieprawidłowy.",error_country_not_supported:"Ten kraj nie jest obsługiwany.",error_blocked_prefix:"Ten cel nie jest dozwolony.",error_no_outbound_number:"Ten agent nie ma skonfigurowanego numeru.",error_plan_required:"Wymagana jest płatna subskrypcja.",error_domain_not_allowed:"Widget nie jest autoryzowany w tej domenie.",error_agent_not_found:"Nie znaleziono agenta.",error_token_invalid:"Nieprawidłowe żądanie.",error_config_disabled:"Oddzwanianie jest obecnie wyłączone.",error_insufficient_credits:"Niewystarczające środki na to połączenie.",error_unknown:"Coś poszło nie tak. Spróbuj ponownie."},cs:{pill_label:"Zavolejte mi zpět",dialog_aria_label:"Žádost o zpětné volání",form_title:"Zažádat o zpětné volání",form_lead:"Zanechte své číslo — zavoláme za chvíli.",search_placeholder:"Hledat zemi nebo +kód",coming_soon_badge:"brzy",submit_btn:"Zavolejte mi zpět",submitting_btn:"Odesílání…",terms_prefix:"Odesláním souhlasíte s našimi",terms_and:"a",terms_label:"podmínkami",privacy_label:"zásadami ochrany osobních údajů",queue_title:"Ve frontě",queue_next:"Jste na řadě — zavoláme, jakmile bude agent volný.",queue_position:"Jste na pozici {n} ve frontě.",queue_wait:"Přibližná doba čekání: {n} {unit}",queue_minute:"minuta",queue_minutes:"minut",queue_cancel:"Zrušit žádost",dialing_title:"Voláme vám",dialing_body:"Telefon by měl za chvíli zvonit.",completed_title:"Hotovo",completed_body:"Děkujeme za rozhovor!",close_btn:"Zavřít",failed_title:"Nepodařilo se nám se s vámi spojit",retry_btn:"Zkusit znovu",reload_to_retry:"Obnovte stránku, abyste si vyžádali další zavolání.",rate_limited_title:"Příliš mnoho požadavků",rate_limited_body:"Nedávno jste již odeslal několik požadavků. Zkuste to za {n} {unit}.",error_rate_limit_phone:"Příliš mnoho požadavků pro toto číslo. Zkuste to později.",error_queue_full:"Fronta je plná. Zkuste to za pár minut.",error_callback_disabled:"Zpětné volání není pro tohoto agenta k dispozici.",error_invalid_phone:"Toto telefonní číslo není platné.",error_country_not_supported:"Tato země není podporována.",error_blocked_prefix:"Tato destinace není povolena.",error_no_outbound_number:"Tento agent nemá nakonfigurované číslo.",error_plan_required:"Vyžaduje se placené předplatné.",error_domain_not_allowed:"Widget není na této doméně autorizován.",error_agent_not_found:"Agent nenalezen.",error_token_invalid:"Neplatný požadavek.",error_config_disabled:"Zpětné volání je momentálně vypnuto.",error_insufficient_credits:"Nedostatek kreditů pro toto volání.",error_unknown:"Něco se pokazilo. Zkuste to prosím znovu."},hu:{pill_label:"Visszahívást kérek",dialog_aria_label:"Visszahívási kérelem",form_title:"Visszahívás kérése",form_lead:"Hagyja meg a számát — egy pillanat múlva visszahívjuk.",search_placeholder:"Ország vagy +kód keresése",coming_soon_badge:"hamarosan",submit_btn:"Visszahívást kérek",submitting_btn:"Küldés…",terms_prefix:"A küldéssel elfogadja",terms_and:"és az",terms_label:"feltételeink",privacy_label:"adatvédelmi szabályzatunk",queue_title:"Sorban",queue_next:"Ön a következő — tárcsázunk, amint az ügynök elérhető.",queue_position:"Ön a(z) {n}. helyen áll a sorban.",queue_wait:"Becsült várakozás: {n} {unit}",queue_minute:"perc",queue_minutes:"perc",queue_cancel:"Kérés visszavonása",dialing_title:"Most hívjuk Önt",dialing_body:"A telefonja egy pillanat múlva csörögni fog.",completed_title:"Kész",completed_body:"Köszönjük a beszélgetést!",close_btn:"Bezárás",failed_title:"Nem tudtuk elérni Önt",retry_btn:"Újra",reload_to_retry:"Frissítse az oldalt egy újabb visszahívás kéréséhez.",rate_limited_title:"Túl sok kérés",rate_limited_body:"Nemrég már több visszahívást küldött. Próbálja újra {n} {unit} múlva.",error_rate_limit_phone:"Túl sok kérés erre a számra. Próbálja később.",error_queue_full:"A sor megtelt. Próbálja meg pár perc múlva.",error_callback_disabled:"A visszahívás nem érhető el ennél az ügynöknél.",error_invalid_phone:"Ez a telefonszám érvénytelen.",error_country_not_supported:"Ez az ország nem támogatott.",error_blocked_prefix:"Ez a célállomás nem engedélyezett.",error_no_outbound_number:"Ennek az ügynöknek nincs beállított száma.",error_plan_required:"Fizetős előfizetés szükséges.",error_domain_not_allowed:"A widget nem engedélyezett ezen a domainen.",error_agent_not_found:"Az ügynök nem található.",error_token_invalid:"Érvénytelen kérés.",error_config_disabled:"A visszahívás jelenleg ki van kapcsolva.",error_insufficient_credits:"Nincs elég kredit a híváshoz.",error_unknown:"Hiba történt. Próbálja újra."},tr:{pill_label:"Beni geri arayın",dialog_aria_label:"Geri arama isteği",form_title:"Geri arama talep edin",form_lead:"Numaranızı bırakın — birazdan sizi arayacağız.",search_placeholder:"Ülke veya +kod ara",coming_soon_badge:"yakında",submit_btn:"Beni geri arayın",submitting_btn:"Gönderiliyor…",terms_prefix:"Göndererek",terms_and:"ve",terms_label:"şartları",privacy_label:"gizlilik politikamızı kabul edersiniz",queue_title:"Sırada",queue_next:"Sıradakisiniz — agent boşalır boşalmaz arayacağız.",queue_position:"Sırada {n}. konumdasınız.",queue_wait:"Tahmini bekleme: {n} {unit}",queue_minute:"dakika",queue_minutes:"dakika",queue_cancel:"İsteği iptal et",dialing_title:"Şimdi sizi arıyoruz",dialing_body:"Telefonunuz birazdan çalmalı.",completed_title:"Tamamlandı",completed_body:"Konuştuğunuz için teşekkürler!",close_btn:"Kapat",failed_title:"Size ulaşamadık",retry_btn:"Tekrar dene",reload_to_retry:"Yeni bir geri arama talep etmek için sayfayı yenileyin.",rate_limited_title:"Çok fazla istek",rate_limited_body:"Yakın zamanda birkaç istek gönderdiniz. {n} {unit} sonra tekrar deneyin.",error_rate_limit_phone:"Bu numara için çok fazla istek. Daha sonra deneyin.",error_queue_full:"Kuyruk dolu. Birkaç dakika sonra tekrar deneyin.",error_callback_disabled:"Bu agent için geri arama mevcut değil.",error_invalid_phone:"Bu telefon numarası geçersiz.",error_country_not_supported:"Bu ülke desteklenmiyor.",error_blocked_prefix:"Bu hedefe izin verilmiyor.",error_no_outbound_number:"Bu agent için yapılandırılmış numara yok.",error_plan_required:"Ücretli abonelik gerekli.",error_domain_not_allowed:"Widget bu alan adında yetkili değil.",error_agent_not_found:"Agent bulunamadı.",error_token_invalid:"Geçersiz istek.",error_config_disabled:"Geri arama şu an devre dışı.",error_insufficient_credits:"Bu arama için yeterli kredi yok.",error_unknown:"Bir şeyler ters gitti. Tekrar deneyin."},kk:{pill_label:"Маған кері қоңырау шалыңыз",dialog_aria_label:"Кері қоңырау сұранысы",form_title:"Кері қоңырау сұрау",form_lead:"Нөміріңізді қалдырыңыз — біз сізге сәл кейін қоңырау шаламыз.",search_placeholder:"Ел немесе +код іздеу",coming_soon_badge:"жақында",submit_btn:"Маған кері қоңырау",submitting_btn:"Жіберілуде…",terms_prefix:"Жіберу арқылы біздің",terms_and:"және",terms_label:"шарттарымыз",privacy_label:"құпиялылық саясатымызға келісесіз",queue_title:"Кезекте",queue_next:"Сіз келесісіз — агент бос болғаннан кейін бірден қоңырау шаламыз.",queue_position:"Сіз кезекте {n}-ші орындасыз.",queue_wait:"Шамамен күту: {n} {unit}",queue_minute:"минут",queue_minutes:"минут",queue_cancel:"Сұранысты болдырмау",dialing_title:"Сізге қоңырау шалудамыз",dialing_body:"Телефоныңыз сәл кейін шылдырлайды.",completed_title:"Дайын",completed_body:"Әңгімелескеніңізге рахмет!",close_btn:"Жабу",failed_title:"Сізге қол жеткізе алмадық",retry_btn:"Қайталау",reload_to_retry:"Жаңа кері қоңырау сұрату үшін бетті қайта жүктеңіз.",rate_limited_title:"Тым көп сұраныс",rate_limited_body:"Сіз жуырда бірнеше сұраныс жібердіңіз. {n} {unit} кейін қайталаңыз.",error_rate_limit_phone:"Бұл нөмірге сұраныс тым көп. Кейін қайталаңыз.",error_queue_full:"Кезек толы. Бірнеше минут кейін қайталаңыз.",error_callback_disabled:"Бұл агент үшін кері қоңырау қолжетімді емес.",error_invalid_phone:"Бұл телефон нөмірі жарамсыз.",error_country_not_supported:"Бұл ел қолдау көрсетілмейді.",error_blocked_prefix:"Бұл бағытқа рұқсат жоқ.",error_no_outbound_number:"Бұл агентте нөмір конфигурацияланбаған.",error_plan_required:"Ақылы жазылым қажет.",error_domain_not_allowed:"Виджет бұл доменде рұқсат етілмеген.",error_agent_not_found:"Агент табылмады.",error_token_invalid:"Жарамсыз сұраныс.",error_config_disabled:"Кері қоңырау қазір өшірілген.",error_insufficient_credits:"Қоңырауға кредит жетпейді.",error_unknown:"Бірдеңе дұрыс болмады. Қайталап көріңіз."},zh:{pill_label:"请回电",dialog_aria_label:"回电请求",form_title:"申请回电",form_lead:"留下您的号码 — 我们稍后会回电给您。",search_placeholder:"搜索国家或 +代码",coming_soon_badge:"即将推出",submit_btn:"请回电",submitting_btn:"提交中…",terms_prefix:"提交即表示您同意我们的",terms_and:"和",terms_label:"条款",privacy_label:"隐私政策",queue_title:"排队中",queue_next:"您是下一位 — 客服空闲后我们将立即拨号。",queue_position:"您在队列中第 {n} 位。",queue_wait:"预计等待: {n} {unit}",queue_minute:"分钟",queue_minutes:"分钟",queue_cancel:"取消请求",dialing_title:"正在呼叫您",dialing_body:"您的电话很快就会响起。",completed_title:"完成",completed_body:"感谢您的来电!",close_btn:"关闭",failed_title:"我们无法联系到您",retry_btn:"重试",reload_to_retry:"刷新页面以再次申请回拨。",rate_limited_title:"请求过多",rate_limited_body:"您最近已经提交了几次回电请求。请在 {n} {unit} 后重试。",error_rate_limit_phone:"此号码请求过多。请稍后再试。",error_queue_full:"队列已满。请几分钟后再试。",error_callback_disabled:"此客服不支持回电。",error_invalid_phone:"该电话号码无效。",error_country_not_supported:"不支持此国家/地区。",error_blocked_prefix:"不允许此目的地。",error_no_outbound_number:"此客服未配置电话号码。",error_plan_required:"需要付费订阅。",error_domain_not_allowed:"此域名未授权使用该小部件。",error_agent_not_found:"未找到客服。",error_token_invalid:"无效请求。",error_config_disabled:"回电功能目前已禁用。",error_insufficient_credits:"余额不足以拨打此电话。",error_unknown:"出现错误。请重试。"},ru:{pill_label:"Перезвоните мне",dialog_aria_label:"Запрос обратного звонка",form_title:"Заказать обратный звонок",form_lead:"Оставьте номер — мы перезвоним через мгновение.",search_placeholder:"Поиск страны или +кода",coming_soon_badge:"скоро",submit_btn:"Перезвоните мне",submitting_btn:"Отправка…",terms_prefix:"Отправляя, вы соглашаетесь с нашими",terms_and:"и",terms_label:"условиями",privacy_label:"политикой конфиденциальности",queue_title:"В очереди",queue_next:"Вы следующий — наберём, как только агент освободится.",queue_position:"Вы #{n} в очереди.",queue_wait:"Примерное ожидание: {n} {unit}",queue_minute:"минута",queue_minutes:"минут",queue_cancel:"Отменить запрос",dialing_title:"Звоним вам",dialing_body:"Телефон должен зазвонить через мгновение.",completed_title:"Готово",completed_body:"Спасибо за разговор!",close_btn:"Закрыть",failed_title:"Не удалось до вас дозвониться",retry_btn:"Повторить",reload_to_retry:"Перезагрузите страницу, чтобы запросить ещё один звонок.",rate_limited_title:"Слишком много запросов",rate_limited_body:"Вы недавно уже отправляли несколько запросов. Повторите через {n} {unit}.",error_rate_limit_phone:"Слишком много запросов для этого номера. Попробуйте позже.",error_queue_full:"Очередь заполнена. Попробуйте через несколько минут.",error_callback_disabled:"Обратный звонок недоступен для этого агента.",error_invalid_phone:"Этот номер телефона недействителен.",error_country_not_supported:"Эта страна не поддерживается.",error_blocked_prefix:"Это направление не разрешено.",error_no_outbound_number:"У этого агента не настроен номер.",error_plan_required:"Требуется платная подписка.",error_domain_not_allowed:"Виджет не авторизован на этом домене.",error_agent_not_found:"Агент не найден.",error_token_invalid:"Недействительный запрос.",error_config_disabled:"Обратный звонок сейчас отключён.",error_insufficient_credits:"Недостаточно кредитов для этого звонка.",error_unknown:"Что-то пошло не так. Повторите попытку."},uk:{pill_label:"Передзвоніть мені",dialog_aria_label:"Запит зворотного дзвінка",form_title:"Замовити зворотний дзвінок",form_lead:"Залиште номер — ми передзвонимо за мить.",search_placeholder:"Пошук країни або +коду",coming_soon_badge:"скоро",submit_btn:"Передзвоніть мені",submitting_btn:"Надсилання…",terms_prefix:"Надсилаючи, ви погоджуєтесь з нашими",terms_and:"та",terms_label:"умовами",privacy_label:"політикою конфіденційності",queue_title:"У черзі",queue_next:"Ви наступний — наберемо, щойно агент звільниться.",queue_position:"Ви #{n} у черзі.",queue_wait:"Приблизне очікування: {n} {unit}",queue_minute:"хвилина",queue_minutes:"хвилин",queue_cancel:"Скасувати запит",dialing_title:"Дзвонимо вам",dialing_body:"Телефон має задзвонити за мить.",completed_title:"Готово",completed_body:"Дякуємо за розмову!",close_btn:"Закрити",failed_title:"Не вдалося до вас додзвонитися",retry_btn:"Повторити",reload_to_retry:"Перезавантажте сторінку, щоб замовити ще один дзвінок.",rate_limited_title:"Забагато запитів",rate_limited_body:"Ви нещодавно вже надіслали кілька запитів. Спробуйте за {n} {unit}.",error_rate_limit_phone:"Забагато запитів для цього номера. Спробуйте пізніше.",error_queue_full:"Черга заповнена. Спробуйте за кілька хвилин.",error_callback_disabled:"Зворотний дзвінок недоступний для цього агента.",error_invalid_phone:"Цей номер телефону недійсний.",error_country_not_supported:"Ця країна не підтримується.",error_blocked_prefix:"Цей напрямок не дозволено.",error_no_outbound_number:"У цього агента не налаштовано номер.",error_plan_required:"Потрібна платна підписка.",error_domain_not_allowed:"Віджет не авторизований на цьому домені.",error_agent_not_found:"Агента не знайдено.",error_token_invalid:"Недійсний запит.",error_config_disabled:"Зворотний дзвінок зараз вимкнено.",error_insufficient_credits:"Недостатньо кредитів для цього дзвінка.",error_unknown:"Сталася помилка. Спробуйте ще раз."}},Eh="en";function Mk(i){if(!i)return fr[Eh];const A=i.toLowerCase().split(/[-_]/)[0];return fr[A]??fr[Eh]}function Dr(i,A){return i.replace(/\{(\w+)\}/g,(e,t)=>A[t]!==void 0?String(A[t]):`{${t}}`)}const ch="hanc_callback_timestamps",dh=3,Un=10*60*1e3;function _r(){try{const i=localStorage.getItem(ch);if(!i)return[];const A=JSON.parse(i);return Array.isArray(A)?A.filter(e=>typeof e=="number"):[]}catch{return[]}}function Fk(i){try{localStorage.setItem(ch,JSON.stringify(i))}catch{}}function Uk(){const i=Date.now();return _r().filter(e=>i-e<Un).length<dh}function Lk(){const i=Date.now(),A=_r().filter(e=>i-e<Un);A.push(i),Fk(A)}function vk(){const i=Date.now(),A=_r().filter(e=>i-e<Un).sort();return A.length<dh?0:Math.max(0,Math.ceil((A[0]+Un-i)/1e3))}const hh={default:"#f97316",purple:"#8b5cf6",blue:"#3b82f6",cyan:"#06b6d4",emerald:"#10b981",amber:"#f59e0b",tangerine:"#f97316",rose:"#f43f5e",ember:"#ff0000",black:"#171717",white:"#ffffff"};function Kk(i){return hh[i]??hh.default}function Jk(i){const A=/^#?([0-9a-f]{6})$/i.exec(i);if(!A)return"#ffffff";const e=parseInt(A[1],16),t=e>>16&255,g=e>>8&255,I=e&255;return .2126*t+.7152*g+.0722*I>165?"#171717":"#ffffff"}var Yk=Object.defineProperty,Tk=Object.getOwnPropertyDescriptor,gt=(i,A,e,t)=>{for(var g=t>1?void 0:t?Tk(A,e):A,I=i.length-1,C;I>=0;I--)(C=i[I])&&(g=(t?C(A,e,g):C(g))||g);return t&&g&&Yk(A,e,g),g};const lh=5e3;let WC=null;function qk(){var i;return typeof window>"u"||typeof document>"u"?Promise.reject(new Error("no DOM")):(i=window.grecaptcha)!=null&&i.render?Promise.resolve():WC||(WC=new Promise((A,e)=>{const t=document.createElement("script");t.src="https://www.google.com/recaptcha/api.js?render=explicit",t.async=!0,t.defer=!0,t.onerror=()=>{WC=null,e(new Error("reCAPTCHA script failed to load"))},t.onload=()=>{const g=Date.now(),I=()=>{var C;(C=window.grecaptcha)!=null&&C.render?A():Date.now()-g>1e4?e(new Error("reCAPTCHA not ready")):window.setTimeout(I,50)};I()},document.head.appendChild(t)}),WC)}const Hk={AT:"664 123 4567",DE:"151 2345 6789",CH:"78 123 45 67",FR:"6 12 34 56 78",IT:"312 345 6789",ES:"612 34 56 78",PT:"912 345 678",NL:"6 12345678",BE:"470 12 34 56",PL:"512 345 678",CZ:"601 123 456",RO:"712 345 678",BG:"88 123 4567",GR:"691 234 5678",HR:"91 234 5678",SE:"70 123 45 67",DK:"20 12 34 56",FI:"41 234 5678",EE:"5123 4567",LV:"21 234 567",LT:"612 34567",IE:"85 012 3456",LU:"628 123 456",SK:"912 345 678",MT:"9696 1234",CY:"96 123456",HU:"20 123 4567",GB:"7400 123456",US:"212 555 0123",CA:"416 555 0123"};G.HancAiCallback=class extends Kt{constructor(){super(...arguments),this.agentId="",this.apiBaseUrl=ui,this.skipFetch=!1,this.manifestOverride=null,this.theme="",this.locale="",this.view={kind:"loading"},this.manifest=null,this.selectedCountry=null,this.phoneRaw="",this.phoneError="",this.apiError=null,this.pickerOpen=!1,this.pickerSearch="",this.recaptchaToken=null,this.recaptchaWidgetId=null,this.recaptchaRendering=!1,this.postSubmitView=null,this.pollAbort=null,this.pollTimer=null,this.lastFocusedBeforeOpen=null,this.onDocumentKey=A=>{A.key==="Escape"&&this.view.kind!=="closed"&&this.view.kind!=="loading"&&this.close()},this.open=()=>{if(this.manifest){if(this.lastFocusedBeforeOpen=document.activeElement,this.postSubmitView){this.view=this.postSubmitView,(this.postSubmitView.kind==="queued"||this.postSubmitView.kind==="dialing")&&this.startPolling(this.postSubmitView.request_id);return}this.view={kind:"form"},setTimeout(()=>{const A=this.renderRoot.querySelector(".phone-input");A==null||A.focus()},50)}},this.close=()=>{var A,e;this.stopPolling(),this.view={kind:"closed"},this.apiError=null,(e=(A=this.lastFocusedBeforeOpen)==null?void 0:A.focus)==null||e.call(A),this.lastFocusedBeforeOpen=null}}get t(){var A;return Mk(this.locale||((A=this.manifest)==null?void 0:A.widget_locale))}localizeError(A){const t=`error_${A.error_code}`;return this.t[t]??this.t.error_unknown}async connectedCallback(){super.connectedCallback(),await this.loadManifest(),document.addEventListener("keydown",this.onDocumentKey)}disconnectedCallback(){super.disconnectedCallback(),this.stopPolling(),document.removeEventListener("keydown",this.onDocumentKey)}updated(A){A.has("manifestOverride")&&this.skipFetch&&this.manifestOverride&&this.adoptManifest(this.manifestOverride),this.syncRecaptcha()}syncRecaptcha(){var g;const A=(g=this.manifest)==null?void 0:g.recaptcha_site_key;if(!A)return;if(!(this.view.kind==="form"||this.view.kind==="submitting")){this.recaptchaWidgetId=null,this.recaptchaToken=null;return}if(this.recaptchaWidgetId!==null||this.recaptchaRendering)return;const t=this.renderRoot.querySelector(".recaptcha-box");t&&(this.recaptchaRendering=!0,qk().then(()=>{this.recaptchaWidgetId===null&&t.isConnected&&(this.recaptchaWidgetId=window.grecaptcha.render(t,{sitekey:A,callback:I=>{this.recaptchaToken=I},"expired-callback":()=>{this.recaptchaToken=null},"error-callback":()=>{this.recaptchaToken=null}}))}).catch(I=>{console.warn("[hanc-callback] reCAPTCHA load failed:",I)}).finally(()=>{this.recaptchaRendering=!1}))}async loadManifest(){if(this.skipFetch){this.manifestOverride?this.adoptManifest(this.manifestOverride):this.view={kind:"closed"};return}if(!this.agentId){this.view={kind:"manifest_error"};return}try{const A=await kk(this.agentId,this.apiBaseUrl);this.adoptManifest(A)}catch(A){console.warn("[hanc-callback] manifest fetch failed:",A),this.view={kind:"manifest_error"}}}adoptManifest(A){const e={...A,allowed_countries:A.allowed_countries.map(C=>({...C,example:C.example||Hk[C.code]||""}))};this.manifest=e;const t=e.allowed_countries.filter(C=>C.enabled),I=this.detectCountryFromLocale(t)??t.find(C=>C.code==="AT")??t[0];this.selectedCountry=(I==null?void 0:I.code)??null,this.view={kind:"closed"}}detectCountryFromLocale(A){var I;if(typeof navigator>"u")return null;const e=navigator.language||"",t=/[-_]([A-Z]{2})$/i.exec(e),g=(I=t==null?void 0:t[1])==null?void 0:I.toUpperCase();return g?A.find(C=>C.code===g)??null:null}selectCountry(A){this.selectedCountry=A,this.pickerOpen=!1,this.pickerSearch="",this.phoneError="",this.phoneRaw&&this.validatePhoneSoft()}onPhoneInput(A){if(!this.selectedCountry){this.phoneRaw=A;return}const e=new Mn(this.selectedCountry);this.phoneRaw=e.input(A),this.phoneError="",this.apiError=null}validatePhoneSoft(){if(!this.selectedCountry)return!1;const A=rh(this.phoneRaw,this.selectedCountry);return!(A!=null&&A.isValid())||A.country!==this.selectedCountry?(this.phoneError="Enter a valid phone number for this country.",!1):(this.phoneError="",!0)}resetRecaptcha(){var A;if(this.recaptchaWidgetId!==null)try{(A=window.grecaptcha)==null||A.reset(this.recaptchaWidgetId)}catch{}this.recaptchaToken=null}async onSubmit(A){if(A==null||A.preventDefault(),!this.manifest||!this.selectedCountry||!this.validatePhoneSoft()||this.manifest.recaptcha_site_key&&!this.recaptchaToken)return;if(!Uk()){this.view={kind:"rate_limited"};return}const e=rh(this.phoneRaw,this.selectedCountry);if(!(e!=null&&e.isValid()))return;const t=e.format("E.164");this.view={kind:"submitting"},this.apiError=null;try{const g=await Sk(this.manifest.agent_id,t,this.selectedCountry,this.apiBaseUrl,void 0,this.recaptchaToken??void 0);Lk(),this.view={kind:"queued",request_id:g.request_id,position:g.position,eta_seconds:g.estimated_wait_seconds},this.postSubmitView=this.view,this.startPolling(g.request_id)}catch(g){this.handleSubmitError(g)}}handleSubmitError(A){this.resetRecaptcha(),A instanceof Bh?(this.apiError=A.body,["callback_disabled","no_outbound_number","insufficient_credits","plan_required","domain_not_allowed","agent_not_found"].includes(A.body.error_code)?this.setPostSubmitView({kind:"failed",reason:A.body.message??"Something went wrong.",can_retry:!1}):this.view={kind:"form"}):(console.error("[hanc-callback] submit error:",A),this.apiError={error_code:"unknown",message:"Network error. Please try again."},this.view={kind:"form"})}async onCancel(){if(this.view.kind!=="queued")return;const A=this.view.request_id;this.stopPolling();try{await Gk(A,this.apiBaseUrl)}catch{}this.postSubmitView=null,this.close()}startPolling(A){this.stopPolling(),this.pollAbort=new AbortController;const e=async()=>{var t,g,I;if(!((t=this.pollAbort)!=null&&t.signal.aborted)){try{const C=await Rk(A,this.apiBaseUrl,(g=this.pollAbort)==null?void 0:g.signal);if((I=this.pollAbort)!=null&&I.signal.aborted)return;this.onPollUpdate(A,C)}catch(C){if((C==null?void 0:C.name)==="AbortError")return;console.warn("[hanc-callback] poll error:",C)}this.pollTimer=window.setTimeout(e,lh)}};this.pollTimer=window.setTimeout(e,lh)}stopPolling(){var A;this.pollTimer&&clearTimeout(this.pollTimer),this.pollTimer=null,(A=this.pollAbort)==null||A.abort(),this.pollAbort=null}onPollUpdate(A,e){switch(e.status){case"queued":this.setPostSubmitView({kind:"queued",request_id:A,position:e.position??0,eta_seconds:e.estimated_wait_seconds??0});return;case"dialing":this.setPostSubmitView({kind:"dialing",request_id:A});return;case"completed":this.stopPolling(),this.setPostSubmitView({kind:"completed"});return;case"failed":case"expired":this.stopPolling(),this.setPostSubmitView({kind:"failed",reason:e.failure_reason??"unknown",can_retry:!1});return;case"cancelled":this.stopPolling(),this.view={kind:"closed"};return}}setPostSubmitView(A){this.view=A,this.postSubmitView=A}render(){var I;if(this.view.kind==="loading"||this.view.kind==="manifest_error")return Ce;const A=this.theme||((I=this.manifest)==null?void 0:I.theme)||"default",e=Kk(A),t=Jk(e),g=`--cb-primary: ${e}; --cb-on-primary: ${t};`;return this.view.kind==="closed"?pA`
6076
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ik(i,A){if(i){if(typeof i=="string")return ah(i,A);var e={}.toString.call(i).slice(8,-1);return e==="Object"&&i.constructor&&(e=i.constructor.name),e==="Map"||e==="Set"?Array.from(i):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?ah(i,A):void 0}}function ah(i,A){(A==null||A>i.length)&&(A=i.length);for(var e=0,t=Array(A);e<A;e++)t[e]=i[e];return t}function gk(i,A){var e=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(e!=null){var t,g,I,C,o=[],n=!0,a=!1;try{if(I=(e=e.call(i)).next,A!==0)for(;!(n=(t=I.call(e)).done)&&(o.push(t.value),o.length!==A);n=!0);}catch(s){a=!0,g=s}finally{try{if(!n&&e.return!=null&&(C=e.return(),Object(C)!==C))return}finally{if(a)throw g}}return o}}function Ik(i){if(Array.isArray(i))return i}function Ck(i,A){if(!(i instanceof A))throw new TypeError("Cannot call a class as a function")}function ok(i,A){for(var e=0;e<A.length;e++){var t=A[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(i,ak(t.key),t)}}function nk(i,A,e){return A&&ok(i.prototype,A),Object.defineProperty(i,"prototype",{writable:!1}),i}function ak(i){var A=sk(i,"string");return VC(A)=="symbol"?A:A+""}function sk(i,A){if(VC(i)!="object"||!i)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var t=e.call(i,A);if(VC(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}var Qk="["+ei+rt+"]+",rk=new RegExp("^"+Qk+"$","i"),Bk="(?:["+kn+"]["+ei+rt+"]*|["+ei+rt+"]+)",Ek=new RegExp("[^"+ei+rt+"]+.*$"),ck=/[^\d\[\]]/,dk=function(){function i(A){var e=A.defaultCountry,t=A.defaultCallingCode,g=A.metadata,I=A.onNationalSignificantNumberChange;Ck(this,i),this.defaultCountry=e,this.defaultCallingCode=t,this.metadata=g,this.onNationalSignificantNumberChange=I}return nk(i,[{key:"input",value:function(e,t){var g=xk(e),I=nh(g,2),C=I[0],o=I[1],n=Rn(C),a;return o&&(t.digits||(t.startInternationalNumber(void 0,void 0),n||(a=!0))),n&&this.inputDigits(n,t),{digits:n,justLeadingPlus:a}}},{key:"inputDigits",value:function(e,t){var g=t.digits,I=g.length<3&&g.length+e.length>=3;if(t.appendDigits(e),I&&this.extractIddPrefix(t),this.isWaitingForCountryCallingCode(t)){if(!this.extractCountryCallingCode(t))return}else t.appendNationalSignificantNumberDigits(e);t.international||this.hasExtractedNationalSignificantNumber||this.extractNationalSignificantNumber(t.getNationalDigits(),function(C){return t.update(C)})}},{key:"isWaitingForCountryCallingCode",value:function(e){var t=e.international,g=e.callingCode;return t&&!g}},{key:"extractCountryCallingCode",value:function(e){var t=sr("+"+e.getDigitsWithoutInternationalPrefix(),e.country,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),g=t.countryCallingCode,I=t.number;if(g)return e.setCallingCode(g),e.update({nationalSignificantNumber:I}),!0}},{key:"reset",value:function(e){if(e){this.hasSelectedNumberingPlan=!0;var t=e._nationalPrefixForParsing();this.couldPossiblyExtractAnotherNationalSignificantNumber=t&&ck.test(t)}else this.hasSelectedNumberingPlan=void 0,this.couldPossiblyExtractAnotherNationalSignificantNumber=void 0}},{key:"extractNationalSignificantNumber",value:function(e,t){if(this.hasSelectedNumberingPlan){var g=or(e,this.metadata),I=g.nationalPrefix,C=g.nationalNumber,o=g.carrierCode;if(C!==e)return this.onExtractedNationalNumber(I,o,C,e,t),!0}}},{key:"extractAnotherNationalSignificantNumber",value:function(e,t,g){if(!this.hasExtractedNationalSignificantNumber)return this.extractNationalSignificantNumber(e,g);if(this.couldPossiblyExtractAnotherNationalSignificantNumber){var I=or(e,this.metadata),C=I.nationalPrefix,o=I.nationalNumber,n=I.carrierCode;if(o!==t)return this.onExtractedNationalNumber(C,n,o,e,g),!0}}},{key:"onExtractedNationalNumber",value:function(e,t,g,I,C){var o=!1,n,a=I.lastIndexOf(g);if(a<0||a!==I.length-g.length)o=!0;else{var s=I.slice(0,a);s&&s!==e&&(n=s)}C({nationalPrefix:e,carrierCode:t,nationalSignificantNumber:g,nationalSignificantNumberIsModified:o,prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix:n}),this.hasExtractedNationalSignificantNumber=!0,this.onNationalSignificantNumberChange()}},{key:"reExtractNationalSignificantNumber",value:function(e){if(this.extractAnotherNationalSignificantNumber(e.getNationalDigits(),e.nationalSignificantNumber,function(t){return e.update(t)}))return!0;if(this.extractIddPrefix(e))return this.extractCallingCodeAndNationalSignificantNumber(e),!0;if(this.fixMissingPlus(e))return this.extractCallingCodeAndNationalSignificantNumber(e),!0}},{key:"extractIddPrefix",value:function(e){var t=e.international,g=e.IDDPrefix,I=e.digits;if(e.nationalSignificantNumber,!(t||g)){var C=yd(I,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata);if(C!==void 0&&C!==I)return e.update({IDDPrefix:I.slice(0,I.length-C.length)}),this.startInternationalNumber(e,{country:void 0,callingCode:void 0}),!0}}},{key:"fixMissingPlus",value:function(e){if(!e.international){var t=kd(e.digits,e.country,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),g=t.countryCallingCode;if(g)return e.update({missingPlus:!0}),this.startInternationalNumber(e,{country:e.country,callingCode:g}),!0}}},{key:"startInternationalNumber",value:function(e,t){var g=t.country,I=t.callingCode;e.startInternationalNumber(g,I),e.nationalSignificantNumber&&(e.resetNationalSignificantNumber(),this.onNationalSignificantNumberChange(),this.hasExtractedNationalSignificantNumber=void 0)}},{key:"extractCallingCodeAndNationalSignificantNumber",value:function(e){this.extractCountryCallingCode(e)&&this.extractNationalSignificantNumber(e.getNationalDigits(),function(t){return e.update(t)})}}])}();function hk(i){var A=i.search(Bk);if(!(A<0)){i=i.slice(A);var e;return i[0]==="+"&&(e=!0,i=i.slice(1)),i=i.replace(Ek,""),e&&(i="+"+i),i}}function lk(i){var A=hk(i)||"";return A[0]==="+"?[A.slice(1),!0]:[A]}function xk(i){var A=lk(i),e=nh(A,2),t=e[0],g=e[1];return rk.test(t)||(t=""),[t,g]}function jC(i){"@babel/helpers - typeof";return jC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(A){return typeof A}:function(A){return A&&typeof Symbol=="function"&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},jC(i)}function uk(i,A){return pk(i)||_k(i,A)||Dk(i,A)||fk()}function fk(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
6077
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Dk(i,A){if(i){if(typeof i=="string")return sh(i,A);var e={}.toString.call(i).slice(8,-1);return e==="Object"&&i.constructor&&(e=i.constructor.name),e==="Map"||e==="Set"?Array.from(i):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?sh(i,A):void 0}}function sh(i,A){(A==null||A>i.length)&&(A=i.length);for(var e=0,t=Array(A);e<A;e++)t[e]=i[e];return t}function _k(i,A){var e=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(e!=null){var t,g,I,C,o=[],n=!0,a=!1;try{if(I=(e=e.call(i)).next,A!==0)for(;!(n=(t=I.call(e)).done)&&(o.push(t.value),o.length!==A);n=!0);}catch(s){a=!0,g=s}finally{try{if(!n&&e.return!=null&&(C=e.return(),Object(C)!==C))return}finally{if(a)throw g}}return o}}function pk(i){if(Array.isArray(i))return i}function wk(i,A){if(!(i instanceof A))throw new TypeError("Cannot call a class as a function")}function mk(i,A){for(var e=0;e<A.length;e++){var t=A[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(i,bk(t.key),t)}}function yk(i,A,e){return A&&mk(i.prototype,A),Object.defineProperty(i,"prototype",{writable:!1}),i}function bk(i){var A=Nk(i,"string");return jC(A)=="symbol"?A:A+""}function Nk(i,A){if(jC(i)!="object"||!i)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var t=e.call(i,A);if(jC(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}var Qh=function(){function i(A,e){wk(this,i),this.metadata=new Ze(e);var t=this.getCountryAndCallingCode(A),g=uk(t,2),I=g[0],C=g[1];this.defaultCountry=I,this.defaultCallingCode=C,this.reset()}return yk(i,[{key:"getCountryAndCallingCode",value:function(e){var t,g;return e&&(Xg(e)?(t=e.defaultCountry,g=e.defaultCallingCode):t=e),t&&!this.metadata.hasCountry(t)&&(t=void 0),[t,g]}},{key:"input",value:function(e){var t=this.parser.input(e,this.state),g=t.digits,I=t.justLeadingPlus;if(I)this.formattedOutput="+";else if(g){this.determineTheCountryIfNeeded(),this.state.nationalSignificantNumber&&this.formatter.narrowDownMatchingFormats(this.state);var C;if(this.metadata.hasSelectedNumberingPlan()&&(C=this.formatter.format(g,this.state)),C===void 0&&this.parser.reExtractNationalSignificantNumber(this.state)){this.determineTheCountryIfNeeded();var o=this.state.getNationalDigits();o&&(C=this.formatter.format(o,this.state))}this.formattedOutput=C?this.getFullNumber(C):this.getNonFormattedNumber()}return this.formattedOutput}},{key:"reset",value:function(){var e=this;return this.state=new lN({onCountryChange:function(g){e.country=g},onCallingCodeChange:function(g,I){e.metadata.selectNumberingPlan(I,g),e.formatter.reset(e.metadata.numberingPlan,e.state),e.parser.reset(e.metadata.numberingPlan)}}),this.formatter=new ek({state:this.state,metadata:this.metadata}),this.parser=new dk({defaultCountry:this.defaultCountry,defaultCallingCode:this.defaultCallingCode,metadata:this.metadata,state:this.state,onNationalSignificantNumberChange:function(){e.determineTheCountryIfNeeded(),e.formatter.reset(e.metadata.numberingPlan,e.state)}}),this.state.reset({country:this.defaultCountry,callingCode:this.defaultCallingCode}),this.formattedOutput="",this}},{key:"isInternational",value:function(){return this.state.international}},{key:"getCallingCode",value:function(){if(this.isInternational())return this.state.callingCode}},{key:"getCountryCallingCode",value:function(){return this.getCallingCode()}},{key:"getCountry",value:function(){var e=this.state.digits;if(e)return this._getCountry()}},{key:"_getCountry",value:function(){var e=this.state.country;return e}},{key:"determineTheCountryIfNeeded",value:function(){(!this.state.country||this.isCountryCallingCodeAmbiguous())&&this.determineTheCountry()}},{key:"getFullNumber",value:function(e){var t=this;if(this.isInternational()){var g=function(o){return t.formatter.getInternationalPrefixBeforeCountryCallingCode(t.state,{spacing:!!o})+o},I=this.state.callingCode;return g(I?e?"".concat(I," ").concat(e):I:"".concat(this.state.getDigitsWithoutInternationalPrefix()))}return e}},{key:"getNonFormattedNationalNumberWithPrefix",value:function(){var e=this.state,t=e.nationalSignificantNumber,g=e.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix,I=e.nationalPrefix,C=t,o=g||I;return o&&(C=o+C),C}},{key:"getNonFormattedNumber",value:function(){var e=this.state.nationalSignificantNumberIsModified;return this.getFullNumber(e?this.state.getNationalDigits():this.getNonFormattedNationalNumberWithPrefix())}},{key:"getNonFormattedTemplate",value:function(){var e=this.getNonFormattedNumber();if(e)return e.replace(/[\+\d]/g,ti)}},{key:"isCountryCallingCodeAmbiguous",value:function(){var e=this.state.callingCode,t=this.metadata.getCountryCodesForCallingCode(e);return t&&t.length>1}},{key:"determineTheCountry",value:function(){this.state.setCountry(nr(this.isInternational()?this.state.callingCode:this.defaultCallingCode,{nationalNumber:this.state.nationalSignificantNumber,metadata:this.metadata}))}},{key:"getNumberValue",value:function(){var e=this.state,t=e.digits,g=e.callingCode,I=e.country,C=e.nationalSignificantNumber;if(t){if(this.isInternational())return g?"+"+g+C:"+"+t;if(I||g){var o=I?this.metadata.countryCallingCode():g;return"+"+o+C}}}},{key:"getNumber",value:function(){var e=this.state,t=e.nationalSignificantNumber,g=e.carrierCode,I=e.callingCode,C=this._getCountry();if(t&&!(!C&&!I)){if(C&&C===this.defaultCountry){var o=new Ze(this.metadata.metadata);o.selectNumberingPlan(C);var n=o.numberingPlan.callingCode(),a=this.metadata.getCountryCodesForCallingCode(n);if(a.length>1){var s=Nd(t,{countries:a,metadata:this.metadata.metadata});s&&(C=s)}}var Q=new Kd(C||I,t,this.metadata.metadata);return g&&(Q.carrierCode=g),Q}}},{key:"isPossible",value:function(){var e=this.getNumber();return e?e.isPossible():!1}},{key:"isValid",value:function(){var e=this.getNumber();return e?e.isValid():!1}},{key:"getNationalNumber",value:function(){return this.state.nationalSignificantNumber}},{key:"getChars",value:function(){return(this.state.international?"+":"")+this.state.digits}},{key:"getTemplate",value:function(){return this.formatter.getTemplate(this.state)||this.getNonFormattedTemplate()||""}}])}();function rh(){return ay(rN,arguments)}function Mn(i){return Qh.call(this,i,ld)}Mn.prototype=Object.create(Qh.prototype,{}),Mn.prototype.constructor=Mn;class Bh extends Error{constructor(A,e){super(e.message??`HTTP ${A}`),this.status=A,this.body=e}}async function Fn(i,A){const e=await fetch(i,{...A,headers:{"Content-Type":"application/json",...(A==null?void 0:A.headers)??{}}});if(!e.ok){let t;try{const g=await e.json();t={error_code:g.error_code??"unknown",message:typeof g.message=="string"?g.message:"Request failed",retry_after_seconds:g.retry_after_seconds}}catch{t={error_code:"unknown",message:`HTTP ${e.status}`}}throw new Bh(e.status,t)}if(e.status!==204)return await e.json()}async function kk(i,A=ui){return Fn(`${A}/v1/widget/callback/${i}/manifest`)}async function Sk(i,A,e,t=ui,g,I){return Fn(`${t}/v1/widget/callback/${i}/submit`,{method:"POST",body:JSON.stringify({phone:A,country:e,source_metadata:{page_url:window.location.href},...I?{recaptcha_token:I}:{}})})}async function Rk(i,A=ui,e){return Fn(`${A}/v1/widget/callback/request/${i}/status`,{signal:e})}async function Gk(i,A=ui){await Fn(`${A}/v1/widget/callback/request/${i}`,{method:"DELETE"})}const fr={en:{pill_label:"Call me back",dialog_aria_label:"Callback request",form_title:"Request a callback",form_lead:"Leave your number — we'll call you back in a moment.",search_placeholder:"Search country or +code",coming_soon_badge:"coming soon",submit_btn:"Call me back",submitting_btn:"Submitting…",terms_prefix:"By submitting you agree to our",terms_and:"and",terms_label:"terms",privacy_label:"privacy policy",queue_title:"In queue",queue_next:"You're next — we'll dial as soon as the agent is free.",queue_position:"You're #{n} in line.",queue_wait:"Approx. wait: {n} {unit}",queue_minute:"minute",queue_minutes:"minutes",queue_cancel:"Cancel request",dialing_title:"Calling you now",dialing_body:"Your phone should ring in a moment.",completed_title:"Done",completed_body:"Thanks for talking with us!",close_btn:"Close",failed_title:"We couldn't reach you",retry_btn:"Try again",reload_to_retry:"Reload the page to make another callback.",rate_limited_title:"Too many requests",rate_limited_body:"You've already submitted a few callbacks recently. Try again in {n} {unit}.",error_rate_limit_phone:"Too many callback requests for this number. Try again later.",error_queue_full:"Callback queue is full. Try again in a few minutes.",error_callback_disabled:"Callback is not available for this agent.",error_invalid_phone:"That phone number is not valid.",error_country_not_supported:"This country is not supported.",error_blocked_prefix:"This destination is not allowed.",error_no_outbound_number:"This agent has no phone number configured.",error_plan_required:"A paid subscription is required.",error_domain_not_allowed:"The widget is not authorised on this domain.",error_agent_not_found:"Agent not found.",error_token_invalid:"Invalid request.",error_config_disabled:"Callback is currently disabled.",error_insufficient_credits:"Not enough credits to place this call.",error_unknown:"Something went wrong. Please try again."},de:{pill_label:"Rückruf anfordern",dialog_aria_label:"Rückrufanfrage",form_title:"Rückruf anfordern",form_lead:"Hinterlassen Sie Ihre Nummer — wir rufen Sie gleich zurück.",search_placeholder:"Land oder +Code suchen",coming_soon_badge:"demnächst",submit_btn:"Zurückrufen",submitting_btn:"Wird gesendet…",terms_prefix:"Mit dem Absenden stimmen Sie unseren",terms_and:"und der",terms_label:"AGB",privacy_label:"Datenschutzerklärung zu",queue_title:"In der Warteschlange",queue_next:"Sie sind als Nächstes dran — wir wählen, sobald der Agent frei ist.",queue_position:"Sie sind Nummer {n} in der Warteschlange.",queue_wait:"Voraussichtliche Wartezeit: {n} {unit}",queue_minute:"Minute",queue_minutes:"Minuten",queue_cancel:"Anfrage abbrechen",dialing_title:"Wir rufen Sie jetzt an",dialing_body:"Ihr Telefon sollte gleich klingeln.",completed_title:"Fertig",completed_body:"Vielen Dank für das Gespräch!",close_btn:"Schließen",failed_title:"Wir konnten Sie nicht erreichen",retry_btn:"Erneut versuchen",reload_to_retry:"Laden Sie die Seite neu, um einen weiteren Rückruf anzufordern.",rate_limited_title:"Zu viele Anfragen",rate_limited_body:"Sie haben kürzlich bereits mehrere Rückrufe angefordert. Versuchen Sie es in {n} {unit} erneut.",error_rate_limit_phone:"Zu viele Rückrufanfragen für diese Nummer. Versuchen Sie es später erneut.",error_queue_full:"Die Warteschlange ist voll. Versuchen Sie es in wenigen Minuten erneut.",error_callback_disabled:"Rückruf für diesen Agenten nicht verfügbar.",error_invalid_phone:"Diese Telefonnummer ist ungültig.",error_country_not_supported:"Dieses Land wird nicht unterstützt.",error_blocked_prefix:"Dieses Ziel ist nicht erlaubt.",error_no_outbound_number:"Für diesen Agenten ist keine Nummer konfiguriert.",error_plan_required:"Ein kostenpflichtiges Abonnement ist erforderlich.",error_domain_not_allowed:"Das Widget ist auf dieser Domain nicht zugelassen.",error_agent_not_found:"Agent nicht gefunden.",error_token_invalid:"Ungültige Anfrage.",error_config_disabled:"Rückruf ist derzeit deaktiviert.",error_insufficient_credits:"Nicht genügend Guthaben, um diesen Anruf zu tätigen.",error_unknown:"Etwas ist schiefgelaufen. Bitte versuchen Sie es erneut."},fr:{pill_label:"Être rappelé",dialog_aria_label:"Demande de rappel",form_title:"Demander un rappel",form_lead:"Laissez votre numéro — nous vous rappelons dans un instant.",search_placeholder:"Rechercher un pays ou un +code",coming_soon_badge:"bientôt",submit_btn:"Me rappeler",submitting_btn:"Envoi…",terms_prefix:"En envoyant, vous acceptez nos",terms_and:"et notre",terms_label:"conditions",privacy_label:"politique de confidentialité",queue_title:"Dans la file",queue_next:"Vous êtes le prochain — nous composons dès que l'agent est libre.",queue_position:"Vous êtes en position {n} dans la file.",queue_wait:"Attente estimée : {n} {unit}",queue_minute:"minute",queue_minutes:"minutes",queue_cancel:"Annuler la demande",dialing_title:"Nous vous appelons",dialing_body:"Votre téléphone devrait sonner dans un instant.",completed_title:"Terminé",completed_body:"Merci pour cet échange !",close_btn:"Fermer",failed_title:"Nous n'avons pas pu vous joindre",retry_btn:"Réessayer",reload_to_retry:"Rechargez la page pour demander un nouveau rappel.",rate_limited_title:"Trop de demandes",rate_limited_body:"Vous avez déjà soumis plusieurs rappels récemment. Réessayez dans {n} {unit}.",error_rate_limit_phone:"Trop de demandes de rappel pour ce numéro. Réessayez plus tard.",error_queue_full:"La file de rappels est pleine. Réessayez dans quelques minutes.",error_callback_disabled:"Le rappel n'est pas disponible pour cet agent.",error_invalid_phone:"Ce numéro de téléphone n'est pas valide.",error_country_not_supported:"Ce pays n'est pas pris en charge.",error_blocked_prefix:"Cette destination n'est pas autorisée.",error_no_outbound_number:"Aucun numéro n'est configuré pour cet agent.",error_plan_required:"Un abonnement payant est requis.",error_domain_not_allowed:"Le widget n'est pas autorisé sur ce domaine.",error_agent_not_found:"Agent introuvable.",error_token_invalid:"Requête invalide.",error_config_disabled:"Le rappel est actuellement désactivé.",error_insufficient_credits:"Crédits insuffisants pour passer cet appel.",error_unknown:"Une erreur est survenue. Veuillez réessayer."},es:{pill_label:"Que me llamen",dialog_aria_label:"Solicitud de devolución de llamada",form_title:"Solicitar una llamada",form_lead:"Deja tu número — te llamamos enseguida.",search_placeholder:"Buscar país o +código",coming_soon_badge:"próximamente",submit_btn:"Que me llamen",submitting_btn:"Enviando…",terms_prefix:"Al enviar aceptas nuestros",terms_and:"y la",terms_label:"términos",privacy_label:"política de privacidad",queue_title:"En cola",queue_next:"Eres el siguiente — llamaremos en cuanto el agente esté libre.",queue_position:"Estás en la posición {n} de la cola.",queue_wait:"Espera aprox.: {n} {unit}",queue_minute:"minuto",queue_minutes:"minutos",queue_cancel:"Cancelar solicitud",dialing_title:"Te estamos llamando",dialing_body:"Tu teléfono debería sonar en un momento.",completed_title:"Listo",completed_body:"¡Gracias por hablar con nosotros!",close_btn:"Cerrar",failed_title:"No pudimos contactarte",retry_btn:"Reintentar",reload_to_retry:"Recarga la página para solicitar otra llamada.",rate_limited_title:"Demasiadas solicitudes",rate_limited_body:"Has enviado varias solicitudes recientemente. Inténtalo de nuevo en {n} {unit}.",error_rate_limit_phone:"Demasiadas solicitudes para este número. Inténtalo más tarde.",error_queue_full:"La cola está llena. Inténtalo en unos minutos.",error_callback_disabled:"La llamada no está disponible para este agente.",error_invalid_phone:"Ese número de teléfono no es válido.",error_country_not_supported:"Este país no está soportado.",error_blocked_prefix:"Este destino no está permitido.",error_no_outbound_number:"Este agente no tiene número configurado.",error_plan_required:"Se requiere una suscripción de pago.",error_domain_not_allowed:"El widget no está autorizado en este dominio.",error_agent_not_found:"Agente no encontrado.",error_token_invalid:"Solicitud no válida.",error_config_disabled:"La llamada está deshabilitada actualmente.",error_insufficient_credits:"No hay créditos suficientes para esta llamada.",error_unknown:"Algo salió mal. Inténtalo de nuevo."},it:{pill_label:"Richiamami",dialog_aria_label:"Richiesta di richiamata",form_title:"Richiedi una chiamata",form_lead:"Lascia il tuo numero — ti chiamiamo subito.",search_placeholder:"Cerca paese o +prefisso",coming_soon_badge:"in arrivo",submit_btn:"Richiamami",submitting_btn:"Invio…",terms_prefix:"Inviando accetti i nostri",terms_and:"e l'",terms_label:"termini",privacy_label:"informativa sulla privacy",queue_title:"In coda",queue_next:"Sei il prossimo — chiameremo non appena l'agente sarà libero.",queue_position:"Sei in posizione {n} in coda.",queue_wait:"Attesa stimata: {n} {unit}",queue_minute:"minuto",queue_minutes:"minuti",queue_cancel:"Annulla richiesta",dialing_title:"Ti stiamo chiamando",dialing_body:"Il telefono dovrebbe squillare a momenti.",completed_title:"Fatto",completed_body:"Grazie per averci parlato!",close_btn:"Chiudi",failed_title:"Non siamo riusciti a raggiungerti",retry_btn:"Riprova",reload_to_retry:"Ricarica la pagina per richiedere un'altra chiamata.",rate_limited_title:"Troppe richieste",rate_limited_body:"Hai già inviato diverse richieste di recente. Riprova fra {n} {unit}.",error_rate_limit_phone:"Troppe richieste per questo numero. Riprova più tardi.",error_queue_full:"La coda è piena. Riprova fra qualche minuto.",error_callback_disabled:"La richiamata non è disponibile per questo agente.",error_invalid_phone:"Questo numero non è valido.",error_country_not_supported:"Questo paese non è supportato.",error_blocked_prefix:"Questa destinazione non è consentita.",error_no_outbound_number:"Questo agente non ha un numero configurato.",error_plan_required:"È richiesto un abbonamento a pagamento.",error_domain_not_allowed:"Il widget non è autorizzato su questo dominio.",error_agent_not_found:"Agente non trovato.",error_token_invalid:"Richiesta non valida.",error_config_disabled:"La richiamata è attualmente disattivata.",error_insufficient_credits:"Crediti insufficienti per effettuare questa chiamata.",error_unknown:"Qualcosa è andato storto. Riprova."},pt:{pill_label:"Ligue-me de volta",dialog_aria_label:"Pedido de retorno de chamada",form_title:"Pedir uma chamada de retorno",form_lead:"Deixe o seu número — ligamos de volta em instantes.",search_placeholder:"Procurar país ou +código",coming_soon_badge:"em breve",submit_btn:"Ligue-me de volta",submitting_btn:"A enviar…",terms_prefix:"Ao enviar concorda com os nossos",terms_and:"e a",terms_label:"termos",privacy_label:"política de privacidade",queue_title:"Na fila",queue_next:"É o próximo — ligaremos assim que o agente estiver disponível.",queue_position:"Está em #{n} na fila.",queue_wait:"Espera aprox.: {n} {unit}",queue_minute:"minuto",queue_minutes:"minutos",queue_cancel:"Cancelar pedido",dialing_title:"A ligar para si",dialing_body:"O seu telefone deve tocar dentro de momentos.",completed_title:"Concluído",completed_body:"Obrigado pela conversa!",close_btn:"Fechar",failed_title:"Não conseguimos contactá-lo",retry_btn:"Tentar de novo",reload_to_retry:"Recarregue a página para pedir outra chamada.",rate_limited_title:"Demasiados pedidos",rate_limited_body:"Já submeteu vários pedidos recentemente. Tente novamente em {n} {unit}.",error_rate_limit_phone:"Demasiados pedidos para este número. Tente mais tarde.",error_queue_full:"A fila está cheia. Tente novamente em alguns minutos.",error_callback_disabled:"A chamada de retorno não está disponível para este agente.",error_invalid_phone:"Este número não é válido.",error_country_not_supported:"Este país não é suportado.",error_blocked_prefix:"Este destino não é permitido.",error_no_outbound_number:"Este agente não tem número configurado.",error_plan_required:"É necessária uma subscrição paga.",error_domain_not_allowed:"O widget não está autorizado neste domínio.",error_agent_not_found:"Agente não encontrado.",error_token_invalid:"Pedido inválido.",error_config_disabled:"A chamada de retorno está atualmente desativada.",error_insufficient_credits:"Créditos insuficientes para esta chamada.",error_unknown:"Algo correu mal. Tente novamente."},pl:{pill_label:"Oddzwoń do mnie",dialog_aria_label:"Prośba o oddzwonienie",form_title:"Poproś o oddzwonienie",form_lead:"Zostaw swój numer — oddzwonimy za chwilę.",search_placeholder:"Szukaj kraju lub +kodu",coming_soon_badge:"wkrótce",submit_btn:"Oddzwoń do mnie",submitting_btn:"Wysyłanie…",terms_prefix:"Wysyłając zgadzasz się z naszymi",terms_and:"oraz",terms_label:"regulaminem",privacy_label:"polityką prywatności",queue_title:"W kolejce",queue_next:"Jesteś następny — zadzwonimy, gdy agent będzie wolny.",queue_position:"Jesteś na pozycji {n} w kolejce.",queue_wait:"Szacowany czas oczekiwania: {n} {unit}",queue_minute:"minuta",queue_minutes:"minut",queue_cancel:"Anuluj prośbę",dialing_title:"Dzwonimy do Ciebie",dialing_body:"Telefon powinien zadzwonić za moment.",completed_title:"Gotowe",completed_body:"Dziękujemy za rozmowę!",close_btn:"Zamknij",failed_title:"Nie udało nam się do Ciebie dodzwonić",retry_btn:"Spróbuj ponownie",reload_to_retry:"Odśwież stronę, aby zamówić kolejne oddzwonienie.",rate_limited_title:"Zbyt wiele żądań",rate_limited_body:"Wysłałeś już ostatnio kilka próśb. Spróbuj ponownie za {n} {unit}.",error_rate_limit_phone:"Zbyt wiele próśb dla tego numeru. Spróbuj później.",error_queue_full:"Kolejka jest pełna. Spróbuj za kilka minut.",error_callback_disabled:"Oddzwanianie jest niedostępne dla tego agenta.",error_invalid_phone:"Ten numer telefonu jest nieprawidłowy.",error_country_not_supported:"Ten kraj nie jest obsługiwany.",error_blocked_prefix:"Ten cel nie jest dozwolony.",error_no_outbound_number:"Ten agent nie ma skonfigurowanego numeru.",error_plan_required:"Wymagana jest płatna subskrypcja.",error_domain_not_allowed:"Widget nie jest autoryzowany w tej domenie.",error_agent_not_found:"Nie znaleziono agenta.",error_token_invalid:"Nieprawidłowe żądanie.",error_config_disabled:"Oddzwanianie jest obecnie wyłączone.",error_insufficient_credits:"Niewystarczające środki na to połączenie.",error_unknown:"Coś poszło nie tak. Spróbuj ponownie."},cs:{pill_label:"Zavolejte mi zpět",dialog_aria_label:"Žádost o zpětné volání",form_title:"Zažádat o zpětné volání",form_lead:"Zanechte své číslo — zavoláme za chvíli.",search_placeholder:"Hledat zemi nebo +kód",coming_soon_badge:"brzy",submit_btn:"Zavolejte mi zpět",submitting_btn:"Odesílání…",terms_prefix:"Odesláním souhlasíte s našimi",terms_and:"a",terms_label:"podmínkami",privacy_label:"zásadami ochrany osobních údajů",queue_title:"Ve frontě",queue_next:"Jste na řadě — zavoláme, jakmile bude agent volný.",queue_position:"Jste na pozici {n} ve frontě.",queue_wait:"Přibližná doba čekání: {n} {unit}",queue_minute:"minuta",queue_minutes:"minut",queue_cancel:"Zrušit žádost",dialing_title:"Voláme vám",dialing_body:"Telefon by měl za chvíli zvonit.",completed_title:"Hotovo",completed_body:"Děkujeme za rozhovor!",close_btn:"Zavřít",failed_title:"Nepodařilo se nám se s vámi spojit",retry_btn:"Zkusit znovu",reload_to_retry:"Obnovte stránku, abyste si vyžádali další zavolání.",rate_limited_title:"Příliš mnoho požadavků",rate_limited_body:"Nedávno jste již odeslal několik požadavků. Zkuste to za {n} {unit}.",error_rate_limit_phone:"Příliš mnoho požadavků pro toto číslo. Zkuste to později.",error_queue_full:"Fronta je plná. Zkuste to za pár minut.",error_callback_disabled:"Zpětné volání není pro tohoto agenta k dispozici.",error_invalid_phone:"Toto telefonní číslo není platné.",error_country_not_supported:"Tato země není podporována.",error_blocked_prefix:"Tato destinace není povolena.",error_no_outbound_number:"Tento agent nemá nakonfigurované číslo.",error_plan_required:"Vyžaduje se placené předplatné.",error_domain_not_allowed:"Widget není na této doméně autorizován.",error_agent_not_found:"Agent nenalezen.",error_token_invalid:"Neplatný požadavek.",error_config_disabled:"Zpětné volání je momentálně vypnuto.",error_insufficient_credits:"Nedostatek kreditů pro toto volání.",error_unknown:"Něco se pokazilo. Zkuste to prosím znovu."},hu:{pill_label:"Visszahívást kérek",dialog_aria_label:"Visszahívási kérelem",form_title:"Visszahívás kérése",form_lead:"Hagyja meg a számát — egy pillanat múlva visszahívjuk.",search_placeholder:"Ország vagy +kód keresése",coming_soon_badge:"hamarosan",submit_btn:"Visszahívást kérek",submitting_btn:"Küldés…",terms_prefix:"A küldéssel elfogadja",terms_and:"és az",terms_label:"feltételeink",privacy_label:"adatvédelmi szabályzatunk",queue_title:"Sorban",queue_next:"Ön a következő — tárcsázunk, amint az ügynök elérhető.",queue_position:"Ön a(z) {n}. helyen áll a sorban.",queue_wait:"Becsült várakozás: {n} {unit}",queue_minute:"perc",queue_minutes:"perc",queue_cancel:"Kérés visszavonása",dialing_title:"Most hívjuk Önt",dialing_body:"A telefonja egy pillanat múlva csörögni fog.",completed_title:"Kész",completed_body:"Köszönjük a beszélgetést!",close_btn:"Bezárás",failed_title:"Nem tudtuk elérni Önt",retry_btn:"Újra",reload_to_retry:"Frissítse az oldalt egy újabb visszahívás kéréséhez.",rate_limited_title:"Túl sok kérés",rate_limited_body:"Nemrég már több visszahívást küldött. Próbálja újra {n} {unit} múlva.",error_rate_limit_phone:"Túl sok kérés erre a számra. Próbálja később.",error_queue_full:"A sor megtelt. Próbálja meg pár perc múlva.",error_callback_disabled:"A visszahívás nem érhető el ennél az ügynöknél.",error_invalid_phone:"Ez a telefonszám érvénytelen.",error_country_not_supported:"Ez az ország nem támogatott.",error_blocked_prefix:"Ez a célállomás nem engedélyezett.",error_no_outbound_number:"Ennek az ügynöknek nincs beállított száma.",error_plan_required:"Fizetős előfizetés szükséges.",error_domain_not_allowed:"A widget nem engedélyezett ezen a domainen.",error_agent_not_found:"Az ügynök nem található.",error_token_invalid:"Érvénytelen kérés.",error_config_disabled:"A visszahívás jelenleg ki van kapcsolva.",error_insufficient_credits:"Nincs elég kredit a híváshoz.",error_unknown:"Hiba történt. Próbálja újra."},tr:{pill_label:"Beni geri arayın",dialog_aria_label:"Geri arama isteği",form_title:"Geri arama talep edin",form_lead:"Numaranızı bırakın — birazdan sizi arayacağız.",search_placeholder:"Ülke veya +kod ara",coming_soon_badge:"yakında",submit_btn:"Beni geri arayın",submitting_btn:"Gönderiliyor…",terms_prefix:"Göndererek",terms_and:"ve",terms_label:"şartları",privacy_label:"gizlilik politikamızı kabul edersiniz",queue_title:"Sırada",queue_next:"Sıradakisiniz — agent boşalır boşalmaz arayacağız.",queue_position:"Sırada {n}. konumdasınız.",queue_wait:"Tahmini bekleme: {n} {unit}",queue_minute:"dakika",queue_minutes:"dakika",queue_cancel:"İsteği iptal et",dialing_title:"Şimdi sizi arıyoruz",dialing_body:"Telefonunuz birazdan çalmalı.",completed_title:"Tamamlandı",completed_body:"Konuştuğunuz için teşekkürler!",close_btn:"Kapat",failed_title:"Size ulaşamadık",retry_btn:"Tekrar dene",reload_to_retry:"Yeni bir geri arama talep etmek için sayfayı yenileyin.",rate_limited_title:"Çok fazla istek",rate_limited_body:"Yakın zamanda birkaç istek gönderdiniz. {n} {unit} sonra tekrar deneyin.",error_rate_limit_phone:"Bu numara için çok fazla istek. Daha sonra deneyin.",error_queue_full:"Kuyruk dolu. Birkaç dakika sonra tekrar deneyin.",error_callback_disabled:"Bu agent için geri arama mevcut değil.",error_invalid_phone:"Bu telefon numarası geçersiz.",error_country_not_supported:"Bu ülke desteklenmiyor.",error_blocked_prefix:"Bu hedefe izin verilmiyor.",error_no_outbound_number:"Bu agent için yapılandırılmış numara yok.",error_plan_required:"Ücretli abonelik gerekli.",error_domain_not_allowed:"Widget bu alan adında yetkili değil.",error_agent_not_found:"Agent bulunamadı.",error_token_invalid:"Geçersiz istek.",error_config_disabled:"Geri arama şu an devre dışı.",error_insufficient_credits:"Bu arama için yeterli kredi yok.",error_unknown:"Bir şeyler ters gitti. Tekrar deneyin."},kk:{pill_label:"Маған кері қоңырау шалыңыз",dialog_aria_label:"Кері қоңырау сұранысы",form_title:"Кері қоңырау сұрау",form_lead:"Нөміріңізді қалдырыңыз — біз сізге сәл кейін қоңырау шаламыз.",search_placeholder:"Ел немесе +код іздеу",coming_soon_badge:"жақында",submit_btn:"Маған кері қоңырау",submitting_btn:"Жіберілуде…",terms_prefix:"Жіберу арқылы біздің",terms_and:"және",terms_label:"шарттарымыз",privacy_label:"құпиялылық саясатымызға келісесіз",queue_title:"Кезекте",queue_next:"Сіз келесісіз — агент бос болғаннан кейін бірден қоңырау шаламыз.",queue_position:"Сіз кезекте {n}-ші орындасыз.",queue_wait:"Шамамен күту: {n} {unit}",queue_minute:"минут",queue_minutes:"минут",queue_cancel:"Сұранысты болдырмау",dialing_title:"Сізге қоңырау шалудамыз",dialing_body:"Телефоныңыз сәл кейін шылдырлайды.",completed_title:"Дайын",completed_body:"Әңгімелескеніңізге рахмет!",close_btn:"Жабу",failed_title:"Сізге қол жеткізе алмадық",retry_btn:"Қайталау",reload_to_retry:"Жаңа кері қоңырау сұрату үшін бетті қайта жүктеңіз.",rate_limited_title:"Тым көп сұраныс",rate_limited_body:"Сіз жуырда бірнеше сұраныс жібердіңіз. {n} {unit} кейін қайталаңыз.",error_rate_limit_phone:"Бұл нөмірге сұраныс тым көп. Кейін қайталаңыз.",error_queue_full:"Кезек толы. Бірнеше минут кейін қайталаңыз.",error_callback_disabled:"Бұл агент үшін кері қоңырау қолжетімді емес.",error_invalid_phone:"Бұл телефон нөмірі жарамсыз.",error_country_not_supported:"Бұл ел қолдау көрсетілмейді.",error_blocked_prefix:"Бұл бағытқа рұқсат жоқ.",error_no_outbound_number:"Бұл агентте нөмір конфигурацияланбаған.",error_plan_required:"Ақылы жазылым қажет.",error_domain_not_allowed:"Виджет бұл доменде рұқсат етілмеген.",error_agent_not_found:"Агент табылмады.",error_token_invalid:"Жарамсыз сұраныс.",error_config_disabled:"Кері қоңырау қазір өшірілген.",error_insufficient_credits:"Қоңырауға кредит жетпейді.",error_unknown:"Бірдеңе дұрыс болмады. Қайталап көріңіз."},zh:{pill_label:"请回电",dialog_aria_label:"回电请求",form_title:"申请回电",form_lead:"留下您的号码 — 我们稍后会回电给您。",search_placeholder:"搜索国家或 +代码",coming_soon_badge:"即将推出",submit_btn:"请回电",submitting_btn:"提交中…",terms_prefix:"提交即表示您同意我们的",terms_and:"和",terms_label:"条款",privacy_label:"隐私政策",queue_title:"排队中",queue_next:"您是下一位 — 客服空闲后我们将立即拨号。",queue_position:"您在队列中第 {n} 位。",queue_wait:"预计等待: {n} {unit}",queue_minute:"分钟",queue_minutes:"分钟",queue_cancel:"取消请求",dialing_title:"正在呼叫您",dialing_body:"您的电话很快就会响起。",completed_title:"完成",completed_body:"感谢您的来电!",close_btn:"关闭",failed_title:"我们无法联系到您",retry_btn:"重试",reload_to_retry:"刷新页面以再次申请回拨。",rate_limited_title:"请求过多",rate_limited_body:"您最近已经提交了几次回电请求。请在 {n} {unit} 后重试。",error_rate_limit_phone:"此号码请求过多。请稍后再试。",error_queue_full:"队列已满。请几分钟后再试。",error_callback_disabled:"此客服不支持回电。",error_invalid_phone:"该电话号码无效。",error_country_not_supported:"不支持此国家/地区。",error_blocked_prefix:"不允许此目的地。",error_no_outbound_number:"此客服未配置电话号码。",error_plan_required:"需要付费订阅。",error_domain_not_allowed:"此域名未授权使用该小部件。",error_agent_not_found:"未找到客服。",error_token_invalid:"无效请求。",error_config_disabled:"回电功能目前已禁用。",error_insufficient_credits:"余额不足以拨打此电话。",error_unknown:"出现错误。请重试。"},ru:{pill_label:"Перезвоните мне",dialog_aria_label:"Запрос обратного звонка",form_title:"Заказать обратный звонок",form_lead:"Оставьте номер — мы перезвоним через мгновение.",search_placeholder:"Поиск страны или +кода",coming_soon_badge:"скоро",submit_btn:"Перезвоните мне",submitting_btn:"Отправка…",terms_prefix:"Отправляя, вы соглашаетесь с нашими",terms_and:"и",terms_label:"условиями",privacy_label:"политикой конфиденциальности",queue_title:"В очереди",queue_next:"Вы следующий — наберём, как только агент освободится.",queue_position:"Вы #{n} в очереди.",queue_wait:"Примерное ожидание: {n} {unit}",queue_minute:"минута",queue_minutes:"минут",queue_cancel:"Отменить запрос",dialing_title:"Звоним вам",dialing_body:"Телефон должен зазвонить через мгновение.",completed_title:"Готово",completed_body:"Спасибо за разговор!",close_btn:"Закрыть",failed_title:"Не удалось до вас дозвониться",retry_btn:"Повторить",reload_to_retry:"Перезагрузите страницу, чтобы запросить ещё один звонок.",rate_limited_title:"Слишком много запросов",rate_limited_body:"Вы недавно уже отправляли несколько запросов. Повторите через {n} {unit}.",error_rate_limit_phone:"Слишком много запросов для этого номера. Попробуйте позже.",error_queue_full:"Очередь заполнена. Попробуйте через несколько минут.",error_callback_disabled:"Обратный звонок недоступен для этого агента.",error_invalid_phone:"Этот номер телефона недействителен.",error_country_not_supported:"Эта страна не поддерживается.",error_blocked_prefix:"Это направление не разрешено.",error_no_outbound_number:"У этого агента не настроен номер.",error_plan_required:"Требуется платная подписка.",error_domain_not_allowed:"Виджет не авторизован на этом домене.",error_agent_not_found:"Агент не найден.",error_token_invalid:"Недействительный запрос.",error_config_disabled:"Обратный звонок сейчас отключён.",error_insufficient_credits:"Недостаточно кредитов для этого звонка.",error_unknown:"Что-то пошло не так. Повторите попытку."},uk:{pill_label:"Передзвоніть мені",dialog_aria_label:"Запит зворотного дзвінка",form_title:"Замовити зворотний дзвінок",form_lead:"Залиште номер — ми передзвонимо за мить.",search_placeholder:"Пошук країни або +коду",coming_soon_badge:"скоро",submit_btn:"Передзвоніть мені",submitting_btn:"Надсилання…",terms_prefix:"Надсилаючи, ви погоджуєтесь з нашими",terms_and:"та",terms_label:"умовами",privacy_label:"політикою конфіденційності",queue_title:"У черзі",queue_next:"Ви наступний — наберемо, щойно агент звільниться.",queue_position:"Ви #{n} у черзі.",queue_wait:"Приблизне очікування: {n} {unit}",queue_minute:"хвилина",queue_minutes:"хвилин",queue_cancel:"Скасувати запит",dialing_title:"Дзвонимо вам",dialing_body:"Телефон має задзвонити за мить.",completed_title:"Готово",completed_body:"Дякуємо за розмову!",close_btn:"Закрити",failed_title:"Не вдалося до вас додзвонитися",retry_btn:"Повторити",reload_to_retry:"Перезавантажте сторінку, щоб замовити ще один дзвінок.",rate_limited_title:"Забагато запитів",rate_limited_body:"Ви нещодавно вже надіслали кілька запитів. Спробуйте за {n} {unit}.",error_rate_limit_phone:"Забагато запитів для цього номера. Спробуйте пізніше.",error_queue_full:"Черга заповнена. Спробуйте за кілька хвилин.",error_callback_disabled:"Зворотний дзвінок недоступний для цього агента.",error_invalid_phone:"Цей номер телефону недійсний.",error_country_not_supported:"Ця країна не підтримується.",error_blocked_prefix:"Цей напрямок не дозволено.",error_no_outbound_number:"У цього агента не налаштовано номер.",error_plan_required:"Потрібна платна підписка.",error_domain_not_allowed:"Віджет не авторизований на цьому домені.",error_agent_not_found:"Агента не знайдено.",error_token_invalid:"Недійсний запит.",error_config_disabled:"Зворотний дзвінок зараз вимкнено.",error_insufficient_credits:"Недостатньо кредитів для цього дзвінка.",error_unknown:"Сталася помилка. Спробуйте ще раз."}},Eh="en";function Mk(i){if(!i)return fr[Eh];const A=i.toLowerCase().split(/[-_]/)[0];return fr[A]??fr[Eh]}function Dr(i,A){return i.replace(/\{(\w+)\}/g,(e,t)=>A[t]!==void 0?String(A[t]):`{${t}}`)}const ch="hanc_callback_timestamps",dh=3,Un=10*60*1e3;function _r(){try{const i=localStorage.getItem(ch);if(!i)return[];const A=JSON.parse(i);return Array.isArray(A)?A.filter(e=>typeof e=="number"):[]}catch{return[]}}function Fk(i){try{localStorage.setItem(ch,JSON.stringify(i))}catch{}}function Uk(){const i=Date.now();return _r().filter(e=>i-e<Un).length<dh}function Lk(){const i=Date.now(),A=_r().filter(e=>i-e<Un);A.push(i),Fk(A)}function vk(){const i=Date.now(),A=_r().filter(e=>i-e<Un).sort();return A.length<dh?0:Math.max(0,Math.ceil((A[0]+Un-i)/1e3))}const hh={default:"#f97316",purple:"#8b5cf6",blue:"#3b82f6",cyan:"#06b6d4",emerald:"#10b981",amber:"#f59e0b",tangerine:"#f97316",rose:"#f43f5e",ember:"#ff0000",black:"#171717",white:"#ffffff"};function Kk(i){return hh[i]??hh.default}function Jk(i){const A=/^#?([0-9a-f]{6})$/i.exec(i);if(!A)return"#ffffff";const e=parseInt(A[1],16),t=e>>16&255,g=e>>8&255,I=e&255;return .2126*t+.7152*g+.0722*I>165?"#171717":"#ffffff"}var Yk=Object.defineProperty,Tk=Object.getOwnPropertyDescriptor,It=(i,A,e,t)=>{for(var g=t>1?void 0:t?Tk(A,e):A,I=i.length-1,C;I>=0;I--)(C=i[I])&&(g=(t?C(A,e,g):C(g))||g);return t&&g&&Yk(A,e,g),g};const lh=5e3;let WC=null;function qk(){var i;return typeof window>"u"||typeof document>"u"?Promise.reject(new Error("no DOM")):(i=window.grecaptcha)!=null&&i.render?Promise.resolve():WC||(WC=new Promise((A,e)=>{const t=document.createElement("script");t.src="https://www.google.com/recaptcha/api.js?render=explicit",t.async=!0,t.defer=!0,t.onerror=()=>{WC=null,e(new Error("reCAPTCHA script failed to load"))},t.onload=()=>{const g=Date.now(),I=()=>{var C;(C=window.grecaptcha)!=null&&C.render?A():Date.now()-g>1e4?e(new Error("reCAPTCHA not ready")):window.setTimeout(I,50)};I()},document.head.appendChild(t)}),WC)}const Hk={AT:"664 123 4567",DE:"151 2345 6789",CH:"78 123 45 67",FR:"6 12 34 56 78",IT:"312 345 6789",ES:"612 34 56 78",PT:"912 345 678",NL:"6 12345678",BE:"470 12 34 56",PL:"512 345 678",CZ:"601 123 456",RO:"712 345 678",BG:"88 123 4567",GR:"691 234 5678",HR:"91 234 5678",SE:"70 123 45 67",DK:"20 12 34 56",FI:"41 234 5678",EE:"5123 4567",LV:"21 234 567",LT:"612 34567",IE:"85 012 3456",LU:"628 123 456",SK:"912 345 678",MT:"9696 1234",CY:"96 123456",HU:"20 123 4567",GB:"7400 123456",US:"212 555 0123",CA:"416 555 0123"};G.HancAiCallback=class extends Kt{constructor(){super(...arguments),this.agentId="",this.apiBaseUrl=ui,this.skipFetch=!1,this.manifestOverride=null,this.theme="",this.locale="",this.view={kind:"loading"},this.manifest=null,this.selectedCountry=null,this.phoneRaw="",this.phoneError="",this.apiError=null,this.pickerOpen=!1,this.pickerSearch="",this.recaptchaToken=null,this.recaptchaWidgetId=null,this.recaptchaRendering=!1,this.recaptchaHost=null,this.postSubmitView=null,this.pollAbort=null,this.pollTimer=null,this.lastFocusedBeforeOpen=null,this.onDocumentKey=A=>{A.key==="Escape"&&this.view.kind!=="closed"&&this.view.kind!=="loading"&&this.close()},this.open=()=>{if(this.manifest){if(this.lastFocusedBeforeOpen=document.activeElement,this.postSubmitView){this.view=this.postSubmitView,(this.postSubmitView.kind==="queued"||this.postSubmitView.kind==="dialing")&&this.startPolling(this.postSubmitView.request_id);return}this.view={kind:"form"},setTimeout(()=>{const A=this.renderRoot.querySelector(".phone-input");A==null||A.focus()},50)}},this.close=()=>{var A,e;this.stopPolling(),this.view={kind:"closed"},this.apiError=null,(e=(A=this.lastFocusedBeforeOpen)==null?void 0:A.focus)==null||e.call(A),this.lastFocusedBeforeOpen=null}}get t(){var A;return Mk(this.locale||((A=this.manifest)==null?void 0:A.widget_locale))}localizeError(A){const t=`error_${A.error_code}`;return this.t[t]??this.t.error_unknown}async connectedCallback(){super.connectedCallback(),await this.loadManifest(),document.addEventListener("keydown",this.onDocumentKey)}disconnectedCallback(){super.disconnectedCallback(),this.stopPolling(),this.teardownRecaptcha(),document.removeEventListener("keydown",this.onDocumentKey)}updated(A){A.has("manifestOverride")&&this.skipFetch&&this.manifestOverride&&this.adoptManifest(this.manifestOverride),this.syncRecaptcha()}syncRecaptcha(){var g;const A=(g=this.manifest)==null?void 0:g.recaptcha_site_key;if(!A)return;if(!(this.view.kind==="form"||this.view.kind==="submitting")){this.teardownRecaptcha();return}this.recaptchaWidgetId!==null||this.recaptchaRendering||!this.renderRoot.querySelector('slot[name="recaptcha"]')||(this.recaptchaRendering=!0,qk().then(()=>{if(this.recaptchaWidgetId!==null||this.view.kind!=="form"&&this.view.kind!=="submitting")return;const I=document.createElement("div");I.setAttribute("slot","recaptcha"),this.appendChild(I),this.recaptchaHost=I,this.recaptchaWidgetId=window.grecaptcha.render(I,{sitekey:A,callback:C=>{this.recaptchaToken=C},"expired-callback":()=>{this.recaptchaToken=null},"error-callback":()=>{this.recaptchaToken=null}})}).catch(I=>{console.warn("[hanc-callback] reCAPTCHA load failed:",I)}).finally(()=>{this.recaptchaRendering=!1}))}teardownRecaptcha(){this.recaptchaHost&&(this.recaptchaHost.remove(),this.recaptchaHost=null),this.recaptchaWidgetId=null,this.recaptchaToken=null}async loadManifest(){if(this.skipFetch){this.manifestOverride?this.adoptManifest(this.manifestOverride):this.view={kind:"closed"};return}if(!this.agentId){this.view={kind:"manifest_error"};return}try{const A=await kk(this.agentId,this.apiBaseUrl);this.adoptManifest(A)}catch(A){console.warn("[hanc-callback] manifest fetch failed:",A),this.view={kind:"manifest_error"}}}adoptManifest(A){const e={...A,allowed_countries:A.allowed_countries.map(C=>({...C,example:C.example||Hk[C.code]||""}))};this.manifest=e;const t=e.allowed_countries.filter(C=>C.enabled),I=this.detectCountryFromLocale(t)??t.find(C=>C.code==="AT")??t[0];this.selectedCountry=(I==null?void 0:I.code)??null,this.view={kind:"closed"}}detectCountryFromLocale(A){var I;if(typeof navigator>"u")return null;const e=navigator.language||"",t=/[-_]([A-Z]{2})$/i.exec(e),g=(I=t==null?void 0:t[1])==null?void 0:I.toUpperCase();return g?A.find(C=>C.code===g)??null:null}selectCountry(A){this.selectedCountry=A,this.pickerOpen=!1,this.pickerSearch="",this.phoneError="",this.phoneRaw&&this.validatePhoneSoft()}onPhoneInput(A){if(!this.selectedCountry){this.phoneRaw=A;return}const e=new Mn(this.selectedCountry);this.phoneRaw=e.input(A),this.phoneError="",this.apiError=null}validatePhoneSoft(){if(!this.selectedCountry)return!1;const A=rh(this.phoneRaw,this.selectedCountry);return!(A!=null&&A.isValid())||A.country!==this.selectedCountry?(this.phoneError="Enter a valid phone number for this country.",!1):(this.phoneError="",!0)}resetRecaptcha(){var A;if(this.recaptchaWidgetId!==null)try{(A=window.grecaptcha)==null||A.reset(this.recaptchaWidgetId)}catch{}this.recaptchaToken=null}async onSubmit(A){if(A==null||A.preventDefault(),!this.manifest||!this.selectedCountry||!this.validatePhoneSoft()||this.manifest.recaptcha_site_key&&!this.recaptchaToken)return;if(!Uk()){this.view={kind:"rate_limited"};return}const e=rh(this.phoneRaw,this.selectedCountry);if(!(e!=null&&e.isValid()))return;const t=e.format("E.164");this.view={kind:"submitting"},this.apiError=null;try{const g=await Sk(this.manifest.agent_id,t,this.selectedCountry,this.apiBaseUrl,void 0,this.recaptchaToken??void 0);Lk(),this.view={kind:"queued",request_id:g.request_id,position:g.position,eta_seconds:g.estimated_wait_seconds},this.postSubmitView=this.view,this.startPolling(g.request_id)}catch(g){this.handleSubmitError(g)}}handleSubmitError(A){this.resetRecaptcha(),A instanceof Bh?(this.apiError=A.body,["callback_disabled","no_outbound_number","insufficient_credits","plan_required","domain_not_allowed","agent_not_found"].includes(A.body.error_code)?this.setPostSubmitView({kind:"failed",reason:A.body.message??"Something went wrong.",can_retry:!1}):this.view={kind:"form"}):(console.error("[hanc-callback] submit error:",A),this.apiError={error_code:"unknown",message:"Network error. Please try again."},this.view={kind:"form"})}async onCancel(){if(this.view.kind!=="queued")return;const A=this.view.request_id;this.stopPolling();try{await Gk(A,this.apiBaseUrl)}catch{}this.postSubmitView=null,this.close()}startPolling(A){this.stopPolling(),this.pollAbort=new AbortController;const e=async()=>{var t,g,I;if(!((t=this.pollAbort)!=null&&t.signal.aborted)){try{const C=await Rk(A,this.apiBaseUrl,(g=this.pollAbort)==null?void 0:g.signal);if((I=this.pollAbort)!=null&&I.signal.aborted)return;this.onPollUpdate(A,C)}catch(C){if((C==null?void 0:C.name)==="AbortError")return;console.warn("[hanc-callback] poll error:",C)}this.pollTimer=window.setTimeout(e,lh)}};this.pollTimer=window.setTimeout(e,lh)}stopPolling(){var A;this.pollTimer&&clearTimeout(this.pollTimer),this.pollTimer=null,(A=this.pollAbort)==null||A.abort(),this.pollAbort=null}onPollUpdate(A,e){switch(e.status){case"queued":this.setPostSubmitView({kind:"queued",request_id:A,position:e.position??0,eta_seconds:e.estimated_wait_seconds??0});return;case"dialing":this.setPostSubmitView({kind:"dialing",request_id:A});return;case"completed":this.stopPolling(),this.setPostSubmitView({kind:"completed"});return;case"failed":case"expired":this.stopPolling(),this.setPostSubmitView({kind:"failed",reason:e.failure_reason??"unknown",can_retry:!1});return;case"cancelled":this.stopPolling(),this.view={kind:"closed"};return}}setPostSubmitView(A){this.view=A,this.postSubmitView=A}render(){var I;if(this.view.kind==="loading"||this.view.kind==="manifest_error")return Ce;const A=this.theme||((I=this.manifest)==null?void 0:I.theme)||"default",e=Kk(A),t=Jk(e),g=`--cb-primary: ${e}; --cb-on-primary: ${t};`;return this.view.kind==="closed"?_A`
6076
6078
  <div class="root" style=${g}>
6077
6079
  ${this.renderFab()}
6078
6080
  </div>
6079
- `:pA`
6081
+ `:_A`
6080
6082
  <div class="root" style=${g}>
6081
6083
  ${this.renderCard()}
6082
6084
  </div>
6083
- `}renderFab(){return pA`
6085
+ `}renderFab(){return _A`
6084
6086
  <button
6085
6087
  class="pill"
6086
6088
  type="button"
@@ -6097,9 +6099,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
6097
6099
  Powered by
6098
6100
  <a target="_blank" rel="noopener" href="https://hanc.ai">HANC.ai</a>
6099
6101
  </div>
6100
- `}handsetIcon(){return pA`<svg width="28" height="28" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
6102
+ `}handsetIcon(){return _A`<svg width="28" height="28" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
6101
6103
  <path d="M19.23 15.26l-2.54-.29a1.5 1.5 0 0 0-1.32.42l-1.84 1.84A14.45 14.45 0 0 1 7.34 11l1.84-1.84a1.5 1.5 0 0 0 .42-1.32l-.29-2.54A1.5 1.5 0 0 0 7.82 4H4.27A1.51 1.51 0 0 0 3 5.5C3 13 9 19 16.5 19a1.51 1.51 0 0 0 1.5-1.27v-3.55a1.5 1.5 0 0 0-1.27-.92z"/>
6102
- </svg>`}renderCard(){return pA`
6104
+ </svg>`}renderCard(){return _A`
6103
6105
  <div class="card" role="dialog" aria-modal="true" aria-label=${this.t.dialog_aria_label}>
6104
6106
  <div class="card-header">
6105
6107
  <button
@@ -6113,7 +6115,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
6113
6115
  </div>
6114
6116
  <div class="card-body">${this.renderBody()}</div>
6115
6117
  </div>
6116
- `}renderBody(){switch(this.view.kind){case"form":case"submitting":return this.renderForm();case"queued":return this.renderQueued();case"dialing":return this.renderDialing();case"completed":return this.renderCompleted();case"failed":return this.renderFailed();case"rate_limited":return this.renderRateLimited();default:return Ce}}renderForm(){var C;const A=this.manifest,e=A.allowed_countries.filter(o=>o.enabled),t=A.allowed_countries.find(o=>o.code===this.selectedCountry)??e[0],g=this.view.kind==="submitting",I=!!A.recaptcha_site_key;return pA`
6118
+ `}renderBody(){switch(this.view.kind){case"form":case"submitting":return this.renderForm();case"queued":return this.renderQueued();case"dialing":return this.renderDialing();case"completed":return this.renderCompleted();case"failed":return this.renderFailed();case"rate_limited":return this.renderRateLimited();default:return Ce}}renderForm(){var C;const A=this.manifest,e=A.allowed_countries.filter(o=>o.enabled),t=A.allowed_countries.find(o=>o.code===this.selectedCountry)??e[0],g=this.view.kind==="submitting",I=!!A.recaptcha_site_key;return _A`
6117
6119
  <div class="form">
6118
6120
  <h3 class="form-title">${this.t.form_title}</h3>
6119
6121
  <p class="form-lead">${this.t.form_lead}</p>
@@ -6134,10 +6136,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
6134
6136
  />
6135
6137
  </div>
6136
6138
 
6137
- ${this.phoneError?pA`<div class="error">${this.phoneError}</div>`:Ce}
6138
- ${this.apiError?pA`<div class="error">${this.localizeError(this.apiError)}</div>`:Ce}
6139
+ ${this.phoneError?_A`<div class="error">${this.phoneError}</div>`:Ce}
6140
+ ${this.apiError?_A`<div class="error">${this.localizeError(this.apiError)}</div>`:Ce}
6139
6141
 
6140
- ${I?pA`<div class="recaptcha-box"></div>`:Ce}
6142
+ ${I?_A`<div class="recaptcha-box">
6143
+ <slot name="recaptcha"></slot>
6144
+ </div>`:Ce}
6141
6145
 
6142
6146
  <button
6143
6147
  class="submit-btn"
@@ -6147,15 +6151,15 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
6147
6151
  ${g?this.t.submitting_btn:this.t.submit_btn}
6148
6152
  </button>
6149
6153
 
6150
- ${(C=A.terms)!=null&&C.enabled?pA`<p class="terms">
6154
+ ${(C=A.terms)!=null&&C.enabled?_A`<p class="terms">
6151
6155
  ${this.t.terms_prefix}
6152
- ${A.terms.terms_url?pA`<a href=${A.terms.terms_url} target="_blank" rel="noopener">${this.t.terms_label}</a>`:pA`<span>${this.t.terms_label}</span>`}
6156
+ ${A.terms.terms_url?_A`<a href=${A.terms.terms_url} target="_blank" rel="noopener">${this.t.terms_label}</a>`:_A`<span>${this.t.terms_label}</span>`}
6153
6157
  ${this.t.terms_and}
6154
- ${A.terms.privacy_url?pA`<a href=${A.terms.privacy_url} target="_blank" rel="noopener">${this.t.privacy_label}</a>`:pA`<span>${this.t.privacy_label}</span>`}.
6158
+ ${A.terms.privacy_url?_A`<a href=${A.terms.privacy_url} target="_blank" rel="noopener">${this.t.privacy_label}</a>`:_A`<span>${this.t.privacy_label}</span>`}.
6155
6159
  </p>`:Ce}
6156
6160
  </form>
6157
6161
  </div>
6158
- `}renderCountryPicker(A,e){const t=this.manifest.allowed_countries,g=this.pickerSearch.trim().toLowerCase(),I=g.replace(/\D/g,""),C=g?t.filter(n=>!!(n.name.toLowerCase().includes(g)||n.code.toLowerCase().includes(g)||I&&n.dial_code.replace(/\D/g,"").startsWith(I))):t,o=[...C.filter(n=>n.enabled),...C.filter(n=>!n.enabled)];return pA`
6162
+ `}renderCountryPicker(A,e){const t=this.manifest.allowed_countries,g=this.pickerSearch.trim().toLowerCase(),I=g.replace(/\D/g,""),C=g?t.filter(n=>!!(n.name.toLowerCase().includes(g)||n.code.toLowerCase().includes(g)||I&&n.dial_code.replace(/\D/g,"").startsWith(I))):t,o=[...C.filter(n=>n.enabled),...C.filter(n=>!n.enabled)];return _A`
6159
6163
  <div class="picker">
6160
6164
  <button
6161
6165
  class="picker-trigger"
@@ -6169,7 +6173,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
6169
6173
  ${this.chevronIcon()}
6170
6174
  </button>
6171
6175
 
6172
- ${this.pickerOpen?pA`
6176
+ ${this.pickerOpen?_A`
6173
6177
  <div class="picker-panel" role="listbox">
6174
6178
  <input
6175
6179
  class="picker-search"
@@ -6179,7 +6183,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
6179
6183
  @input=${n=>this.pickerSearch=n.target.value}
6180
6184
  />
6181
6185
  <div class="picker-list">
6182
- ${o.map(n=>pA`
6186
+ ${o.map(n=>_A`
6183
6187
  <button
6184
6188
  type="button"
6185
6189
  role="option"
@@ -6191,14 +6195,14 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
6191
6195
  <span class="flag">${n.flag}</span>
6192
6196
  <span class="name">${n.name}</span>
6193
6197
  <span class="dial">${n.dial_code}</span>
6194
- ${n.enabled?Ce:pA`<span class="badge">${this.t.coming_soon_badge}</span>`}
6198
+ ${n.enabled?Ce:_A`<span class="badge">${this.t.coming_soon_badge}</span>`}
6195
6199
  </button>
6196
6200
  `)}
6197
6201
  </div>
6198
6202
  </div>
6199
6203
  `:Ce}
6200
6204
  </div>
6201
- `}renderQueued(){if(this.view.kind!=="queued")return Ce;const A=this.t,e=Math.max(1,Math.round(this.view.eta_seconds/60)),t=this.view.position===0?A.queue_next:Dr(A.queue_position,{n:this.view.position+1}),g=e===1?A.queue_minute:A.queue_minutes;return pA`
6205
+ `}renderQueued(){if(this.view.kind!=="queued")return Ce;const A=this.t,e=Math.max(1,Math.round(this.view.eta_seconds/60)),t=this.view.position===0?A.queue_next:Dr(A.queue_position,{n:this.view.position+1}),g=e===1?A.queue_minute:A.queue_minutes;return _A`
6202
6206
  <div class="status">
6203
6207
  ${this.queueIcon()}
6204
6208
  <h3>${A.queue_title}</h3>
@@ -6208,13 +6212,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
6208
6212
  ${A.queue_cancel}
6209
6213
  </button>
6210
6214
  </div>
6211
- `}renderDialing(){const A=this.t;return pA`
6215
+ `}renderDialing(){const A=this.t;return _A`
6212
6216
  <div class="status">
6213
6217
  ${this.ringingIcon()}
6214
6218
  <h3>${A.dialing_title}</h3>
6215
6219
  <p>${A.dialing_body}</p>
6216
6220
  </div>
6217
- `}renderCompleted(){const A=this.t;return pA`
6221
+ `}renderCompleted(){const A=this.t;return _A`
6218
6222
  <div class="status">
6219
6223
  ${this.checkIcon()}
6220
6224
  <h3>${A.completed_title}</h3>
@@ -6224,7 +6228,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
6224
6228
  ${A.close_btn}
6225
6229
  </button>
6226
6230
  </div>
6227
- `}renderFailed(){if(this.view.kind!=="failed")return Ce;const A=this.t,e=this.localizeError({error_code:this.view.reason||"unknown",message:this.view.reason});return pA`
6231
+ `}renderFailed(){if(this.view.kind!=="failed")return Ce;const A=this.t,e=this.localizeError({error_code:this.view.reason||"unknown",message:this.view.reason});return _A`
6228
6232
  <div class="status">
6229
6233
  ${this.alertIcon()}
6230
6234
  <h3>${A.failed_title}</h3>
@@ -6234,7 +6238,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
6234
6238
  ${A.close_btn}
6235
6239
  </button>
6236
6240
  </div>
6237
- `}renderRateLimited(){const A=this.t,e=vk(),t=Math.max(1,Math.ceil(e/60)),g=t===1?A.queue_minute:A.queue_minutes;return pA`
6241
+ `}renderRateLimited(){const A=this.t,e=vk(),t=Math.max(1,Math.ceil(e/60)),g=t===1?A.queue_minute:A.queue_minutes;return _A`
6238
6242
  <div class="status">
6239
6243
  ${this.alertIcon()}
6240
6244
  <h3>${A.rate_limited_title}</h3>
@@ -6243,17 +6247,17 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
6243
6247
  ${A.close_btn}
6244
6248
  </button>
6245
6249
  </div>
6246
- `}closeIcon(){return pA`<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
6250
+ `}closeIcon(){return _A`<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
6247
6251
  <line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/>
6248
- </svg>`}chevronIcon(){return pA`<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
6252
+ </svg>`}chevronIcon(){return _A`<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
6249
6253
  <polyline points="6 9 12 15 18 9"/>
6250
- </svg>`}queueIcon(){return pA`<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
6254
+ </svg>`}queueIcon(){return _A`<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
6251
6255
  <circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/>
6252
- </svg>`}ringingIcon(){return pA`<svg class="ringing" width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
6256
+ </svg>`}ringingIcon(){return _A`<svg class="ringing" width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
6253
6257
  <path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.13.96.37 1.9.72 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.91.35 1.85.59 2.81.72a2 2 0 0 1 1.72 2.05z"/>
6254
- </svg>`}checkIcon(){return pA`<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
6258
+ </svg>`}checkIcon(){return _A`<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
6255
6259
  <polyline points="20 6 9 17 4 12"/>
6256
- </svg>`}alertIcon(){return pA`<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
6260
+ </svg>`}alertIcon(){return _A`<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
6257
6261
  <circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/>
6258
6262
  </svg>`}},G.HancAiCallback.styles=Dg`
6259
6263
  :host {
@@ -6659,4 +6663,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
6659
6663
  25% { transform: rotate(-12deg); }
6660
6664
  75% { transform: rotate(12deg); }
6661
6665
  }
6662
- `,gt([V({type:String,attribute:"agent-id"})],G.HancAiCallback.prototype,"agentId",2),gt([V({type:String,attribute:"api-base-url"})],G.HancAiCallback.prototype,"apiBaseUrl",2),gt([V({type:Boolean,attribute:"skip-fetch"})],G.HancAiCallback.prototype,"skipFetch",2),gt([V({type:Object,attribute:!1})],G.HancAiCallback.prototype,"manifestOverride",2),gt([V({type:String})],G.HancAiCallback.prototype,"theme",2),gt([V({type:String})],G.HancAiCallback.prototype,"locale",2),gt([vA()],G.HancAiCallback.prototype,"view",2),gt([vA()],G.HancAiCallback.prototype,"manifest",2),gt([vA()],G.HancAiCallback.prototype,"selectedCountry",2),gt([vA()],G.HancAiCallback.prototype,"phoneRaw",2),gt([vA()],G.HancAiCallback.prototype,"phoneError",2),gt([vA()],G.HancAiCallback.prototype,"apiError",2),gt([vA()],G.HancAiCallback.prototype,"pickerOpen",2),gt([vA()],G.HancAiCallback.prototype,"pickerSearch",2),gt([vA()],G.HancAiCallback.prototype,"recaptchaToken",2),G.HancAiCallback=gt([mg("hanc-ai-callback")],G.HancAiCallback),G.SoundManager=GC,G.applyTheme=Pm,G.clearConfigCache=Wm,G.darkPresets=at,G.darkThemes=Tm,G.fetchWidgetConfig=MC,G.getColorPreset=Jm,G.getPresetNames=Ym,G.getTheme=JI,G.getThemeNames=Hm,G.isDomainAllowed=FC,G.lightPresets=st,G.lightThemes=qm,G.themes=KI,Object.defineProperty(G,Symbol.toStringTag,{value:"Module"})});
6666
+ `,It([V({type:String,attribute:"agent-id"})],G.HancAiCallback.prototype,"agentId",2),It([V({type:String,attribute:"api-base-url"})],G.HancAiCallback.prototype,"apiBaseUrl",2),It([V({type:Boolean,attribute:"skip-fetch"})],G.HancAiCallback.prototype,"skipFetch",2),It([V({type:Object,attribute:!1})],G.HancAiCallback.prototype,"manifestOverride",2),It([V({type:String})],G.HancAiCallback.prototype,"theme",2),It([V({type:String})],G.HancAiCallback.prototype,"locale",2),It([vA()],G.HancAiCallback.prototype,"view",2),It([vA()],G.HancAiCallback.prototype,"manifest",2),It([vA()],G.HancAiCallback.prototype,"selectedCountry",2),It([vA()],G.HancAiCallback.prototype,"phoneRaw",2),It([vA()],G.HancAiCallback.prototype,"phoneError",2),It([vA()],G.HancAiCallback.prototype,"apiError",2),It([vA()],G.HancAiCallback.prototype,"pickerOpen",2),It([vA()],G.HancAiCallback.prototype,"pickerSearch",2),It([vA()],G.HancAiCallback.prototype,"recaptchaToken",2),G.HancAiCallback=It([mg("hanc-ai-callback")],G.HancAiCallback),G.SoundManager=GC,G.applyTheme=Pm,G.clearConfigCache=Wm,G.darkPresets=st,G.darkThemes=Tm,G.fetchWidgetConfig=MC,G.getColorPreset=Jm,G.getPresetNames=Ym,G.getTheme=JI,G.getThemeNames=Hm,G.isDomainAllowed=FC,G.lightPresets=Qt,G.lightThemes=qm,G.themes=KI,Object.defineProperty(G,Symbol.toStringTag,{value:"Module"})});