gl-draw 0.3.8 → 0.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core/Pencil.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ interface Options {
|
|
|
24
24
|
control?: boolean;
|
|
25
25
|
mapControl?: boolean;
|
|
26
26
|
controlParams?: Partial<ControlParams>;
|
|
27
|
-
resizeObserver
|
|
27
|
+
resizeObserver?: boolean;
|
|
28
28
|
renderer?: {
|
|
29
29
|
antialias?: false | 'fxaa' | 'smaa' | 'ssaa' | 'msaa';
|
|
30
30
|
} & Omit<Partial<RendererParams>, 'antialias'>;
|
package/dist/objects/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(){var Ye={666:function(C){var T=function(x){"use strict";var P=Object.prototype,S=P.hasOwnProperty,z,O=typeof Symbol=="function"?Symbol:{},D=O.iterator||"@@iterator",W=O.asyncIterator||"@@asyncIterator",E=O.toStringTag||"@@toStringTag";function _(l,u,p){return Object.defineProperty(l,u,{value:p,enumerable:!0,configurable:!0,writable:!0}),l[u]}try{_({},"")}catch(l){_=function(u,p,A){return u[p]=A}}function F(l,u,p,A){var w=u&&u.prototype instanceof X?u:X,I=Object.create(w.prototype),te=new $(A||[]);return I._invoke=ue(l,p,te),I}x.wrap=F;function Z(l,u,p){try{return{type:"normal",arg:l.call(u,p)}}catch(A){return{type:"throw",arg:A}}}var B="suspendedStart",s="suspendedYield",se="executing",Q="completed",G={};function X(){}function L(){}function R(){}var N={};_(N,D,function(){return this});var ne=Object.getPrototypeOf,J=ne&&ne(ne(me([])));J&&J!==P&&S.call(J,D)&&(N=J);var H=R.prototype=X.prototype=Object.create(N);L.prototype=R,_(H,"constructor",R),_(R,"constructor",L),L.displayName=_(R,E,"GeneratorFunction");function U(l){["next","throw","return"].forEach(function(u){_(l,u,function(p){return this._invoke(u,p)})})}x.isGeneratorFunction=function(l){var u=typeof l=="function"&&l.constructor;return u?u===L||(u.displayName||u.name)==="GeneratorFunction":!1},x.mark=function(l){return Object.setPrototypeOf?Object.setPrototypeOf(l,R):(l.__proto__=R,_(l,E,"GeneratorFunction")),l.prototype=Object.create(H),l},x.awrap=function(l){return{__await:l}};function ie(l,u){function p(I,te,ae,ce){var oe=Z(l[I],l,te);if(oe.type==="throw")ce(oe.arg);else{var Oe=oe.arg,Pe=Oe.value;return Pe&&typeof Pe=="object"&&S.call(Pe,"__await")?u.resolve(Pe.__await).then(function(re){p("next",re,ae,ce)},function(re){p("throw",re,ae,ce)}):u.resolve(Pe).then(function(re){Oe.value=re,ae(Oe)},function(re){return p("throw",re,ae,ce)})}}var A;function w(I,te){function ae(){return new u(function(ce,oe){p(I,te,ce,oe)})}return A=A?A.then(ae,ae):ae()}this._invoke=w}U(ie.prototype),_(ie.prototype,W,function(){return this}),x.AsyncIterator=ie,x.async=function(l,u,p,A,w){w===void 0&&(w=Promise);var I=new ie(F(l,u,p,A),w);return x.isGeneratorFunction(u)?I:I.next().then(function(te){return te.done?te.value:I.next()})};function ue(l,u,p){var A=B;return function(I,te){if(A===se)throw new Error("Generator is already running");if(A===Q){if(I==="throw")throw te;return ke()}for(p.method=I,p.arg=te;;){var ae=p.delegate;if(ae){var ce=ee(ae,p);if(ce){if(ce===G)continue;return ce}}if(p.method==="next")p.sent=p._sent=p.arg;else if(p.method==="throw"){if(A===B)throw A=Q,p.arg;p.dispatchException(p.arg)}else p.method==="return"&&p.abrupt("return",p.arg);A=se;var oe=Z(l,u,p);if(oe.type==="normal"){if(A=p.done?Q:s,oe.arg===G)continue;return{value:oe.arg,done:p.done}}else oe.type==="throw"&&(A=Q,p.method="throw",p.arg=oe.arg)}}}function ee(l,u){var p=l.iterator[u.method];if(p===z){if(u.delegate=null,u.method==="throw"){if(l.iterator.return&&(u.method="return",u.arg=z,ee(l,u),u.method==="throw"))return G;u.method="throw",u.arg=new TypeError("The iterator does not provide a 'throw' method")}return G}var A=Z(p,l.iterator,u.arg);if(A.type==="throw")return u.method="throw",u.arg=A.arg,u.delegate=null,G;var w=A.arg;if(!w)return u.method="throw",u.arg=new TypeError("iterator result is not an object"),u.delegate=null,G;if(w.done)u[l.resultName]=w.value,u.next=l.nextLoc,u.method!=="return"&&(u.method="next",u.arg=z);else return w;return u.delegate=null,G}U(H),_(H,E,"Generator"),_(H,D,function(){return this}),_(H,"toString",function(){return"[object Generator]"});function ye(l){var u={tryLoc:l[0]};1 in l&&(u.catchLoc=l[1]),2 in l&&(u.finallyLoc=l[2],u.afterLoc=l[3]),this.tryEntries.push(u)}function K(l){var u=l.completion||{};u.type="normal",delete u.arg,l.completion=u}function $(l){this.tryEntries=[{tryLoc:"root"}],l.forEach(ye,this),this.reset(!0)}x.keys=function(l){var u=[];for(var p in l)u.push(p);return u.reverse(),function A(){for(;u.length;){var w=u.pop();if(w in l)return A.value=w,A.done=!1,A}return A.done=!0,A}};function me(l){if(l){var u=l[D];if(u)return u.call(l);if(typeof l.next=="function")return l;if(!isNaN(l.length)){var p=-1,A=function w(){for(;++p<l.length;)if(S.call(l,p))return w.value=l[p],w.done=!1,w;return w.value=z,w.done=!0,w};return A.next=A}}return{next:ke}}x.values=me;function ke(){return{value:z,done:!0}}return $.prototype={constructor:$,reset:function(l){if(this.prev=0,this.next=0,this.sent=this._sent=z,this.done=!1,this.delegate=null,this.method="next",this.arg=z,this.tryEntries.forEach(K),!l)for(var u in this)u.charAt(0)==="t"&&S.call(this,u)&&!isNaN(+u.slice(1))&&(this[u]=z)},stop:function(){this.done=!0;var l=this.tryEntries[0],u=l.completion;if(u.type==="throw")throw u.arg;return this.rval},dispatchException:function(l){if(this.done)throw l;var u=this;function p(ce,oe){return I.type="throw",I.arg=l,u.next=ce,oe&&(u.method="next",u.arg=z),!!oe}for(var A=this.tryEntries.length-1;A>=0;--A){var w=this.tryEntries[A],I=w.completion;if(w.tryLoc==="root")return p("end");if(w.tryLoc<=this.prev){var te=S.call(w,"catchLoc"),ae=S.call(w,"finallyLoc");if(te&&ae){if(this.prev<w.catchLoc)return p(w.catchLoc,!0);if(this.prev<w.finallyLoc)return p(w.finallyLoc)}else if(te){if(this.prev<w.catchLoc)return p(w.catchLoc,!0)}else if(ae){if(this.prev<w.finallyLoc)return p(w.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(l,u){for(var p=this.tryEntries.length-1;p>=0;--p){var A=this.tryEntries[p];if(A.tryLoc<=this.prev&&S.call(A,"finallyLoc")&&this.prev<A.finallyLoc){var w=A;break}}w&&(l==="break"||l==="continue")&&w.tryLoc<=u&&u<=w.finallyLoc&&(w=null);var I=w?w.completion:{};return I.type=l,I.arg=u,w?(this.method="next",this.next=w.finallyLoc,G):this.complete(I)},complete:function(l,u){if(l.type==="throw")throw l.arg;return l.type==="break"||l.type==="continue"?this.next=l.arg:l.type==="return"?(this.rval=this.arg=l.arg,this.method="return",this.next="end"):l.type==="normal"&&u&&(this.next=u),G},finish:function(l){for(var u=this.tryEntries.length-1;u>=0;--u){var p=this.tryEntries[u];if(p.finallyLoc===l)return this.complete(p.completion,p.afterLoc),K(p),G}},catch:function(l){for(var u=this.tryEntries.length-1;u>=0;--u){var p=this.tryEntries[u];if(p.tryLoc===l){var A=p.completion;if(A.type==="throw"){var w=A.arg;K(p)}return w}}throw new Error("illegal catch attempt")},delegateYield:function(l,u,p){return this.delegate={iterator:me(l),resultName:u,nextLoc:p},this.method==="next"&&(this.arg=z),G}},x}(C.exports);try{regeneratorRuntime=T}catch(x){typeof globalThis=="object"?globalThis.regeneratorRuntime=T:Function("r","regeneratorRuntime = r")(T)}},695:function(C,T,x){"use strict";x.d(T,{Z:function(){return P}});function P(S){if(S.geometry&&S.geometry.dispose(),S.material){var z=Array.isArray(S.material)?S.material:[S.material];z.forEach(function(O){var D,W,E,_,F,Z,B,s,se,Q,G,X,L;(D=O.map)===null||D===void 0||D.dispose(),(W=O.lightMap)===null||W===void 0||W.dispose(),(E=O.bumpMap)===null||E===void 0||E.dispose(),(_=O.normalMap)===null||_===void 0||_.dispose(),(F=O.specularMap)===null||F===void 0||F.dispose(),(Z=O.envMap)===null||Z===void 0||Z.dispose(),(B=O.alphaMap)===null||B===void 0||B.dispose(),(s=O.aoMap)===null||s===void 0||s.dispose(),(se=O.displacementMap)===null||se===void 0||se.dispose(),(Q=O.emissiveMap)===null||Q===void 0||Q.dispose(),(G=O.gradientMap)===null||G===void 0||G.dispose(),(X=O.metalnessMap)===null||X===void 0||X.dispose(),(L=O.roughnessMap)===null||L===void 0||L.dispose(),O.dispose()})}}},519:function(C,T,x){"use strict";x.d(T,{disposeMesh:function(){return O.Z}});var P=x(666),S=x.n(P),z=null,O=x(695),D=x(644);function W(G){if(G.material){var X=Array.isArray(G.material)?G.material:[G.material];X.forEach(function(L){var R,N;(R=L.color)===null||R===void 0||R.convertSRGBToLinear(),(N=L.emissive)===null||N===void 0||N.convertSRGBToLinear(),L.map&&(L.map.encoding=THREE.sRGBEncoding),L.emissiveMap&&(L.emissiveMap.encoding=THREE.sRGBEncoding)})}}var E=x(568),_=x(924),F=require("idb-keyval"),Z=x(484),B=null,s=null,se=function(){var G=(0,E.Z)(S().mark(function X(L,R){var N,ne,J,H,U,ie;return S().wrap(function(ee){for(;;)switch(ee.prev=ee.next){case 0:return N=R.version,ee.next=4,(0,F.get)(L);case 4:if(J=ee.sent,!(J&&J[N])){ee.next=9;break}ne=J[N],ee.next=15;break;case 9:return ee.next=11,(0,Z.Z)(fetch(L).then(function(ye){if(ye.ok)return ye.blob();throw new Error}));case 11:H=ee.sent,U=H.res,ie=H.err,ie||(ne=U,(0,F.set)(L,(0,_.Z)({},N,U)));case 15:return ee.abrupt("return",ne?{url:URL.createObjectURL(ne)}:{url:L});case 16:case"end":return ee.stop()}},X)}));return function(L,R){return G.apply(this,arguments)}}(),Q=x(705)},484:function(C,T,x){"use strict";x.d(T,{Z:function(){return S}});var P=x(42);function S(z){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return z.then(function(D){return(0,P.Z)({err:null,res:D},O)}).catch(function(D){return(0,P.Z)({err:D,res:void 0},O)})}},705:function(C,T,x){"use strict";x.d(T,{C:function(){return D},y:function(){return O}});var P=x(644),S=x.n(P),z=new Map,O=function(){var W=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{generateTopUV:function(E,_,F,Z,B){var s=_[F*3],se=_[F*3+1],Q=_[Z*3],G=_[Z*3+1],X=_[B*3],L=_[B*3+1],R;if(z.has(E))R=z.get(E);else{var N=W.box3||new P.Box3;if(!W.box3){var ne=E.parameters.shapes.getPoints();N.setFromArray(ne.map(function(ue){return[ue.x,ue.y,0]}).flat())}var J=N.getSize(new P.Vector3);W.split&&(J.y/=W.split),R={box:N,size:J},z.set(E,R)}var H=R.box,U=R.size,ie=W.split?1-W.split:0;return[new P.Vector2((s-H.min.x)/U.x,(se-H.min.y)/U.y+ie),new P.Vector2((Q-H.min.x)/U.x,(G-H.min.y)/U.y+ie),new P.Vector2((X-H.min.x)/U.x,(L-H.min.y)/U.y+ie)]},generateSideWallUV:function(E,_,F,Z,B,s){var se=_[F*3],Q=_[F*3+1],G=_[F*3+2],X=_[Z*3],L=_[Z*3+1],R=_[Z*3+2],N=_[B*3],ne=_[B*3+1],J=_[B*3+2],H=_[s*3],U=_[s*3+1],ie=_[s*3+2],ue;if(z.has(_))ue=z.get(_);else{var ee=new P.Box3;ee.setFromArray(_);var ye=ee.getSize(new P.Vector3);W.split&&(ye.z/=1-W.split),ue={box:ee,size:ye},z.set(_,ue)}var K=ue.box,$=ue.size;return Math.abs(Q-L)<Math.abs(se-X)?[new P.Vector2((se-K.min.x)/$.x,(G-K.min.z)/$.z),new P.Vector2((X-K.min.x)/$.x,(R-K.min.z)/$.z),new P.Vector2((N-K.min.x)/$.x,(J-K.min.z)/$.z),new P.Vector2((H-K.min.x)/$.x,(ie-K.min.z)/$.z)]:[new P.Vector2((Q-K.min.y)/$.x,(G-K.min.z)/$.z),new P.Vector2((L-K.min.y)/$.x,(R-K.min.z)/$.z),new P.Vector2((ne-K.min.y)/$.x,(J-K.min.z)/$.z),new P.Vector2((U-K.min.y)/$.x,(ie-K.min.z)/$.z)]}}},D=function(){z.clear()}},644:function(C){"use strict";C.exports=require("three")},568:function(C,T,x){"use strict";x.d(T,{Z:function(){return S}});function P(z,O,D,W,E,_,F){try{var Z=z[_](F),B=Z.value}catch(s){D(s);return}Z.done?O(B):Promise.resolve(B).then(W,E)}function S(z){return function(){var O=this,D=arguments;return new Promise(function(W,E){var _=z.apply(O,D);function F(B){P(_,W,E,F,Z,"next",B)}function Z(B){P(_,W,E,F,Z,"throw",B)}F(void 0)})}}},924:function(C,T,x){"use strict";x.d(T,{Z:function(){return P}});function P(S,z,O){return z in S?Object.defineProperty(S,z,{value:O,enumerable:!0,configurable:!0,writable:!0}):S[z]=O,S}},42:function(C,T,x){"use strict";x.d(T,{Z:function(){return S}});var P=x(924);function S(z){for(var O=1;O<arguments.length;O++){var D=arguments[O]!=null?arguments[O]:{},W=Object.keys(D);typeof Object.getOwnPropertySymbols=="function"&&(W=W.concat(Object.getOwnPropertySymbols(D).filter(function(E){return Object.getOwnPropertyDescriptor(D,E).enumerable}))),W.forEach(function(E){(0,P.Z)(z,E,D[E])})}return z}}},De={};function q(C){var T=De[C];if(T!==void 0)return T.exports;var x=De[C]={exports:{}};return Ye[C](x,x.exports,q),x.exports}(function(){q.n=function(C){var T=C&&C.__esModule?function(){return C.default}:function(){return C};return q.d(T,{a:T}),T}})(),function(){q.d=function(C,T){for(var x in T)q.o(T,x)&&!q.o(C,x)&&Object.defineProperty(C,x,{enumerable:!0,get:T[x]})}}(),function(){q.o=function(C,T){return Object.prototype.hasOwnProperty.call(C,T)}}(),function(){q.r=function(C){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(C,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(C,"__esModule",{value:!0})}}();var ze={};(function(){"use strict";q.r(ze),q.d(ze,{ConicPolygon:function(){return _t},ExtrudePolygon:function(){return wt},Image:function(){return A},Line:function(){return rt},MeshLine:function(){return re},MeshLineMaterial:function(){return Re},MeshLineRaycast:function(){return Ue},Node:function(){return oe},Text:function(){return ke},Video:function(){return ae}});function C(e,i){if(!(e instanceof i))throw new TypeError("Cannot call a class as a function")}function T(e,i){return T=Object.setPrototypeOf||function(n,a){return n.__proto__=a,n},T(e,i)}function x(e,i){return T(e,i)}function P(e,i){if(typeof i!="function"&&i!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),i&&x(e,i)}var S=q(42);function z(e,i){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);i&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function O(e,i){return i=i!=null?i:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):z(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))}),e}function D(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function W(e){return W=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},W(e)}function E(e){return W(e)}function _(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function F(e){return e&&e.constructor===Symbol?"symbol":typeof e}function Z(e,i){return i&&(F(i)==="object"||typeof i=="function")?i:_(e)}function B(e){var i=D();return function(){var n=E(e),a;if(i){var t=E(this).constructor;a=Reflect.construct(n,arguments,t)}else a=n.apply(this,arguments);return Z(this,a)}}var s=q(644);function se(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function Q(e,i,r){return se()?Q=Reflect.construct:Q=function(a,t,o){var c=[null];c.push.apply(c,t);var h=Function.bind.apply(a,c),v=new h;return o&&x(v,o.prototype),v},Q.apply(null,arguments)}function G(e,i,r){return Q.apply(null,arguments)}function X(e,i){for(var r=0;r<i.length;r++){var n=i[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function L(e,i,r){return i&&X(e.prototype,i),r&&X(e,r),e}function R(e,i){(i==null||i>e.length)&&(i=e.length);for(var r=0,n=new Array(i);r<i;r++)n[r]=e[r];return n}function N(e){if(Array.isArray(e))return R(e)}function ne(e){if(typeof Symbol!="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function J(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function H(e,i){if(!!e){if(typeof e=="string")return R(e,i);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return R(e,i)}}function U(e){return N(e)||ne(e)||H(e)||J()}var ie=q(484);function ue(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r={};return r.promise=new Promise(function(n,a){r.resolve=n,r.reject=a}),e&&(r.promise=(0,ie.Z)(r.promise,i)),r}var ee=require("three/examples/jsm/renderers/CSS2DRenderer"),ye=require("three/examples/jsm/renderers/CSS3DRenderer"),K=q(519),$=function(e){e&&((0,K.disposeMesh)(e),e.children.forEach(function(i){i.userData.BaseObject_||$(i)}))},me=function(){"use strict";function e(){C(this,e),this.objecttype__="BaseObject",this.userData={},this.pm=ue(),this.visible=!1}var i=e.prototype;return i.init=function(){},i.create=function(){},i.render=function(){},i.update=function(n,a){},i.resize=function(n,a){},i.show=function(){return this.object3d&&(this.object3d.visible=!0),this.visible=!0,this},i.hide=function(){return this.object3d&&(this.object3d.visible=!1),this.visible=!1,this},i.isVisible=function(){return this.visible},i.createMesh=function(){for(var n=arguments.length,a=new Array(n),t=0;t<n;t++)a[t]=arguments[t];return this.object3d=G(s.Mesh,U(a)),this},i.createGroup=function(){return this.object3d=new s.Group,this},i.createPoints=function(){for(var n=arguments.length,a=new Array(n),t=0;t<n;t++)a[t]=arguments[t];return this.object3d=G(s.Points,U(a)),this},i.createCSS2DObject=function(n){return this.object3d=new ee.CSS2DObject(n),this},i.createCSS3DObject=function(n){return this.object3d=new ye.CSS3DObject(n),this},i.createCSS3DSprite=function(n){return this.object3d=new ye.CSS3DSprite(n),this},i.createSprite=function(n){return this.object3d=new s.Sprite(n),this},i.add=function(){for(var n=arguments.length,a=new Array(n),t=0;t<n;t++)a[t]=arguments[t];var o;return(o=this.object3d).add.apply(o,U(a)),this},i.remove=function(){for(var n=arguments.length,a=new Array(n),t=0;t<n;t++)a[t]=arguments[t];var o;return(o=this.object3d).remove.apply(o,U(a)),this},i.getSize=function(){var n=new s.Box3().setFromObject(this.object3d);return{min:n.min,max:n.max,size:n.getSize(new s.Vector3)}},i.traverse=function(n){n(this),this.children.forEach(function(a){a.traverse(n)})},i.dispose=function(){$(this.object3d)},L(e,[{key:"parent",get:function(){var n=this.object3d.parent;return(n==null?void 0:n.userData.BaseObject_)||this.pencil.scene}},{key:"children",get:function(){return this.object3d.children.map(function(n){return n.userData.BaseObject_}).filter(function(n){return!!n})}}]),e}(),ke=function(e){"use strict";P(r,e);var i=B(r);function r(a){C(this,r);var t;return t=i.call(this),t.width=0,t.canvas=document.createElement("canvas"),t.options=(0,S.Z)({},{scale:.5,fontSize:28,fontFamily:"system-ui,-apple-system,BlinkMacSystemFont,sans-serif",fontWeight:"normal",flipX:!1,sprite:!1,sizeAttenuation:!0},a),t}var n=r.prototype;return n.create=function(){var t=this.options,o=t.position,c=t.lookAt,h=t.sprite,v=t.text,d=t.sizeAttenuation;if(h){var m=new s.Sprite(new s.SpriteMaterial({transparent:!0,sizeAttenuation:d}));this.object3d=m}else{var g=new s.MeshBasicMaterial({side:s.DoubleSide,transparent:!0}),b=new s.PlaneGeometry(1,1,1,1);this.createMesh(b,g)}this.object3d.position.copy(o),c&&this.object3d.lookAt(c),this.setText(v)},n.setText=function(t,o){var c=(0,S.Z)(O((0,S.Z)({},this.options),{text:t}),o||{}),h=c.text,v=c.fontSize,d=c.fontFamily,m=c.fontWeight,g=c.flipX,b=c.scale,y=this.canvas;y.width=v*h.length*2,y.height=v;var M=y.getContext("2d");M.font="".concat(m," ").concat(v,"px/1 ").concat(d);var f=M.measureText(h).width;y.width=f,this.width=f,M=y.getContext("2d"),M.clearRect(0,0,y.width,y.height),g&&M.scale(-1,1),M.font="".concat(m," ").concat(v,"px/1 ").concat(d),M.textBaseline="middle",M.fillStyle="#ffffff",M.fillText(h,g?f*-1:0,y.height/2),M.restore();var j=new s.Texture(y);j.anisotropy=16,j.needsUpdate=!0;var k=this.object3d;k.material.map&&k.material.map.dispose(),k.material.map=j,k.material.needsUpdate=!0,k.scale.set(j.image.width*b,j.image.height*b,1)},r}(me),l=q(568),u=q(666),p=q.n(u),A=function(e){"use strict";P(r,e);var i=B(r);function r(a){C(this,r);var t;return t=i.call(this),t.options=a,t}var n=r.prototype;return n.getMaterial=function(){var t=this;return(0,l.Z)(p().mark(function o(){var c,h,v,d,m,g,b,y,M,f;return p().wrap(function(k){for(;;)switch(k.prev=k.next){case 0:return c=t.options,h=c.transparent,v=c.blending,d=c.src,m=c.depthWrite,g=c.alphaTest,b=c.sprite,y=c.sizeAttenuation,k.next=3,new s.TextureLoader().loadAsync(d);case 3:return M=k.sent,f=b?new s.SpriteMaterial({map:M,transparent:h!=null?h:!1,blending:v!=null?v:s.NormalBlending,depthWrite:m!=null?m:!0,alphaTest:g!=null?g:0,sizeAttenuation:y!=null?y:!0}):new s.MeshBasicMaterial({map:M,transparent:h!=null?h:!1,blending:v!=null?v:s.NormalBlending,depthWrite:m!=null?m:!0,alphaTest:g!=null?g:0}),k.abrupt("return",f);case 6:case"end":return k.stop()}},o)}))()},n.create=function(){var t=this;return(0,l.Z)(p().mark(function o(){var c,h,v,d,m,g,b,y;return p().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:if(c=t.options,h=c.scale,v=c.position,d=c.src,m=c.cache,g=c.sprite,!(m&&!m.get(d))){f.next=7;break}return m.init(d),f.next=5,t.getMaterial();case 5:b=f.sent,m.set(d,b);case 7:if(!m){f.next=13;break}return f.next=10,m.get(d);case 10:f.t0=f.sent,f.next=16;break;case 13:return f.next=15,t.getMaterial();case 15:f.t0=f.sent;case 16:y=f.t0,t.texture=y.map,g?t.createSprite(y):t.createMesh(new s.PlaneBufferGeometry(1,1),y),h&&t.setScale(h),v&&t.object3d.position.copy(v);case 21:case"end":return f.stop()}},o)}))()},n.setScale=function(t){this.object3d.scale.set(this.texture.image.width*t,this.texture.image.height*t,1)},r}(me);function w(e,i){for(;!Object.prototype.hasOwnProperty.call(e,i)&&(e=E(e),e!==null););return e}function I(e,i,r){return typeof Reflect!="undefined"&&Reflect.get?I=Reflect.get:I=function(a,t,o){var c=w(a,t);if(!!c){var h=Object.getOwnPropertyDescriptor(c,t);return h.get?h.get.call(o||a):h.value}},I(e,i,r)}function te(e,i,r){return I(e,i,r)}var ae=function(e){"use strict";P(r,e);var i=B(r);function r(a){C(this,r);var t;return t=i.call(this),t.options=(0,S.Z)({},{autoPlay:!0,loop:!0},a),t}var n=r.prototype;return n.getMaterial=function(){var t=this.options,o=t.src,c=t.transparent,h=t.blending,v=t.depthWrite,d=t.format,m=t.autoPlay,g=t.loop,b=t.alphaTest,y=t.sprite,M=ue(),f=document.createElement("video");return f.addEventListener("loadedmetadata",function(){var j=new s.VideoTexture(f);j.format=d!=null?d:s.RGBAFormat,j.needsUpdate=!0;var k=y?new s.SpriteMaterial({map:j,transparent:c!=null?c:!1,blending:h!=null?h:s.NormalBlending,depthWrite:v!=null?v:!0,alphaTest:b!=null?b:0}):new s.MeshBasicMaterial({map:j,transparent:c!=null?c:!1,blending:h!=null?h:s.NormalBlending,depthWrite:v!=null?v:!0,alphaTest:b!=null?b:0});M.resolve(k)},!1),f.src=o,f.muted=!0,f.autoplay=m,f.loop=g,f.preload="auto",M.promise},n.create=function(){var t=this;return(0,l.Z)(p().mark(function o(){var c,h,v,d,m,g,b,y;return p().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:if(c=t.options,h=c.scale,v=c.position,d=c.src,m=c.cache,g=c.sprite,!(m&&!m.get(d))){f.next=7;break}return m.init(d),f.next=5,t.getMaterial();case 5:b=f.sent,m.set(d,b);case 7:if(!m){f.next=13;break}return f.next=10,m.get(d);case 10:f.t0=f.sent,f.next=16;break;case 13:return f.next=15,t.getMaterial();case 15:f.t0=f.sent;case 16:y=f.t0,t.video=y.map.image,g?t.createSprite(y):t.createMesh(new s.PlaneBufferGeometry(1,1),y),h&&t.setScale(h),v&&t.object3d.position.copy(v);case 21:case"end":return f.stop()}},o)}))()},n.setScale=function(t){this.object3d.scale.set(this.video.videoWidth*t,this.video.videoHeight*t,1)},n.render=function(){var t=this.options.autoPlay;t&&this.video.play()},n.dispose=function(){this.video.pause(),this.video.src="",this.video.load(),te(E(r.prototype),"dispose",this).call(this)},r}(me),ce=function(e){"use strict";P(r,e);var i=B(r);function r(a){C(this,r);var t;return t=i.call(this),t.options=(0,S.Z)({},a),t}var n=r.prototype;return n.create=function(){var t=this.options,o=t.position,c=t.children,h=t.onClick,v=t.zIndexFix,d=document.createElement("div");this.element=d,d.appendChild(c),this.createCSS2DObject(d),o&&this.object3d.position.copy(o),h&&this.clickTarge.forEach(function(m){m.addEventListener("click",h)}),v&&(this.object3d.userData.zIndexFix=v)},n.getMaterial=function(t){return(0,l.Z)(p().mark(function o(){var c,h,v,d;return p().wrap(function(g){for(;;)switch(g.prev=g.next){case 0:return c=document.createElement("canvas"),c.width=256,c.height=256,h=c.getContext("2d"),h.fillStyle="#ff0000",h.fillRect(0,0,256,256),v=new s.CanvasTexture(c),d=new s.SpriteMaterial({map:v,opacity:t?1:0,transparent:!0,alphaTest:.1,sizeAttenuation:!1}),g.abrupt("return",d);case 9:case"end":return g.stop()}},o)}))()},n.createPickObject=function(t){var o=t.show,c=o===void 0?!1:o,h=t.scale,v=h===void 0?new s.Vector3(1,1,1):h,d=t.position,m=d===void 0?new s.Vector3(0,0,0):d,g=t.cache,b=this;return(0,l.Z)(p().mark(function y(){var M,f,j,k;return p().wrap(function(V){for(;;)switch(V.prev=V.next){case 0:if(M="node-create-pick-object",!(g&&!g.get(M))){V.next=7;break}return g.init(M),V.next=5,b.getMaterial(c);case 5:f=V.sent,g.set(M,f);case 7:if(!g){V.next=13;break}return V.next=10,g.get(M);case 10:V.t0=V.sent,V.next=16;break;case 13:return V.next=15,b.getMaterial(c);case 15:V.t0=V.sent;case 16:j=V.t0,k=new s.Sprite(j),k.scale.set(j.map.image.width*v.x,j.map.image.height*v.y,1),k.position.copy(m),b.add(k),b.pickObject=k;case 22:case"end":return V.stop()}},y)}))()},n.dispose=function(){var t=this.options.onClick;t&&this.clickTarge.forEach(function(o){o.removeEventListener("click",t)}),te(E(r.prototype),"dispose",this).call(this)},L(r,[{key:"clickTarge",get:function(){var t=this,o=this.options.clickTarge;if(o){var c=o.map(function(h){return U(t.element.querySelectorAll(h))}).flat();return c}return[this.element]}}]),r}(me),oe=ce,Oe=`
|
|
1
|
+
(function(){var Qe={666:function(C){var T=function(x){"use strict";var P=Object.prototype,S=P.hasOwnProperty,z,O=typeof Symbol=="function"?Symbol:{},D=O.iterator||"@@iterator",W=O.asyncIterator||"@@asyncIterator",E=O.toStringTag||"@@toStringTag";function _(l,u,p){return Object.defineProperty(l,u,{value:p,enumerable:!0,configurable:!0,writable:!0}),l[u]}try{_({},"")}catch(l){_=function(u,p,A){return u[p]=A}}function F(l,u,p,A){var w=u&&u.prototype instanceof X?u:X,I=Object.create(w.prototype),te=new $(A||[]);return I._invoke=ue(l,p,te),I}x.wrap=F;function Z(l,u,p){try{return{type:"normal",arg:l.call(u,p)}}catch(A){return{type:"throw",arg:A}}}var B="suspendedStart",s="suspendedYield",se="executing",Q="completed",G={};function X(){}function L(){}function R(){}var N={};_(N,D,function(){return this});var ne=Object.getPrototypeOf,J=ne&&ne(ne(me([])));J&&J!==P&&S.call(J,D)&&(N=J);var H=R.prototype=X.prototype=Object.create(N);L.prototype=R,_(H,"constructor",R),_(R,"constructor",L),L.displayName=_(R,E,"GeneratorFunction");function U(l){["next","throw","return"].forEach(function(u){_(l,u,function(p){return this._invoke(u,p)})})}x.isGeneratorFunction=function(l){var u=typeof l=="function"&&l.constructor;return u?u===L||(u.displayName||u.name)==="GeneratorFunction":!1},x.mark=function(l){return Object.setPrototypeOf?Object.setPrototypeOf(l,R):(l.__proto__=R,_(l,E,"GeneratorFunction")),l.prototype=Object.create(H),l},x.awrap=function(l){return{__await:l}};function ie(l,u){function p(I,te,ae,ce){var oe=Z(l[I],l,te);if(oe.type==="throw")ce(oe.arg);else{var Oe=oe.arg,Pe=Oe.value;return Pe&&typeof Pe=="object"&&S.call(Pe,"__await")?u.resolve(Pe.__await).then(function(re){p("next",re,ae,ce)},function(re){p("throw",re,ae,ce)}):u.resolve(Pe).then(function(re){Oe.value=re,ae(Oe)},function(re){return p("throw",re,ae,ce)})}}var A;function w(I,te){function ae(){return new u(function(ce,oe){p(I,te,ce,oe)})}return A=A?A.then(ae,ae):ae()}this._invoke=w}U(ie.prototype),_(ie.prototype,W,function(){return this}),x.AsyncIterator=ie,x.async=function(l,u,p,A,w){w===void 0&&(w=Promise);var I=new ie(F(l,u,p,A),w);return x.isGeneratorFunction(u)?I:I.next().then(function(te){return te.done?te.value:I.next()})};function ue(l,u,p){var A=B;return function(I,te){if(A===se)throw new Error("Generator is already running");if(A===Q){if(I==="throw")throw te;return ke()}for(p.method=I,p.arg=te;;){var ae=p.delegate;if(ae){var ce=ee(ae,p);if(ce){if(ce===G)continue;return ce}}if(p.method==="next")p.sent=p._sent=p.arg;else if(p.method==="throw"){if(A===B)throw A=Q,p.arg;p.dispatchException(p.arg)}else p.method==="return"&&p.abrupt("return",p.arg);A=se;var oe=Z(l,u,p);if(oe.type==="normal"){if(A=p.done?Q:s,oe.arg===G)continue;return{value:oe.arg,done:p.done}}else oe.type==="throw"&&(A=Q,p.method="throw",p.arg=oe.arg)}}}function ee(l,u){var p=l.iterator[u.method];if(p===z){if(u.delegate=null,u.method==="throw"){if(l.iterator.return&&(u.method="return",u.arg=z,ee(l,u),u.method==="throw"))return G;u.method="throw",u.arg=new TypeError("The iterator does not provide a 'throw' method")}return G}var A=Z(p,l.iterator,u.arg);if(A.type==="throw")return u.method="throw",u.arg=A.arg,u.delegate=null,G;var w=A.arg;if(!w)return u.method="throw",u.arg=new TypeError("iterator result is not an object"),u.delegate=null,G;if(w.done)u[l.resultName]=w.value,u.next=l.nextLoc,u.method!=="return"&&(u.method="next",u.arg=z);else return w;return u.delegate=null,G}U(H),_(H,E,"Generator"),_(H,D,function(){return this}),_(H,"toString",function(){return"[object Generator]"});function ye(l){var u={tryLoc:l[0]};1 in l&&(u.catchLoc=l[1]),2 in l&&(u.finallyLoc=l[2],u.afterLoc=l[3]),this.tryEntries.push(u)}function K(l){var u=l.completion||{};u.type="normal",delete u.arg,l.completion=u}function $(l){this.tryEntries=[{tryLoc:"root"}],l.forEach(ye,this),this.reset(!0)}x.keys=function(l){var u=[];for(var p in l)u.push(p);return u.reverse(),function A(){for(;u.length;){var w=u.pop();if(w in l)return A.value=w,A.done=!1,A}return A.done=!0,A}};function me(l){if(l){var u=l[D];if(u)return u.call(l);if(typeof l.next=="function")return l;if(!isNaN(l.length)){var p=-1,A=function w(){for(;++p<l.length;)if(S.call(l,p))return w.value=l[p],w.done=!1,w;return w.value=z,w.done=!0,w};return A.next=A}}return{next:ke}}x.values=me;function ke(){return{value:z,done:!0}}return $.prototype={constructor:$,reset:function(l){if(this.prev=0,this.next=0,this.sent=this._sent=z,this.done=!1,this.delegate=null,this.method="next",this.arg=z,this.tryEntries.forEach(K),!l)for(var u in this)u.charAt(0)==="t"&&S.call(this,u)&&!isNaN(+u.slice(1))&&(this[u]=z)},stop:function(){this.done=!0;var l=this.tryEntries[0],u=l.completion;if(u.type==="throw")throw u.arg;return this.rval},dispatchException:function(l){if(this.done)throw l;var u=this;function p(ce,oe){return I.type="throw",I.arg=l,u.next=ce,oe&&(u.method="next",u.arg=z),!!oe}for(var A=this.tryEntries.length-1;A>=0;--A){var w=this.tryEntries[A],I=w.completion;if(w.tryLoc==="root")return p("end");if(w.tryLoc<=this.prev){var te=S.call(w,"catchLoc"),ae=S.call(w,"finallyLoc");if(te&&ae){if(this.prev<w.catchLoc)return p(w.catchLoc,!0);if(this.prev<w.finallyLoc)return p(w.finallyLoc)}else if(te){if(this.prev<w.catchLoc)return p(w.catchLoc,!0)}else if(ae){if(this.prev<w.finallyLoc)return p(w.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(l,u){for(var p=this.tryEntries.length-1;p>=0;--p){var A=this.tryEntries[p];if(A.tryLoc<=this.prev&&S.call(A,"finallyLoc")&&this.prev<A.finallyLoc){var w=A;break}}w&&(l==="break"||l==="continue")&&w.tryLoc<=u&&u<=w.finallyLoc&&(w=null);var I=w?w.completion:{};return I.type=l,I.arg=u,w?(this.method="next",this.next=w.finallyLoc,G):this.complete(I)},complete:function(l,u){if(l.type==="throw")throw l.arg;return l.type==="break"||l.type==="continue"?this.next=l.arg:l.type==="return"?(this.rval=this.arg=l.arg,this.method="return",this.next="end"):l.type==="normal"&&u&&(this.next=u),G},finish:function(l){for(var u=this.tryEntries.length-1;u>=0;--u){var p=this.tryEntries[u];if(p.finallyLoc===l)return this.complete(p.completion,p.afterLoc),K(p),G}},catch:function(l){for(var u=this.tryEntries.length-1;u>=0;--u){var p=this.tryEntries[u];if(p.tryLoc===l){var A=p.completion;if(A.type==="throw"){var w=A.arg;K(p)}return w}}throw new Error("illegal catch attempt")},delegateYield:function(l,u,p){return this.delegate={iterator:me(l),resultName:u,nextLoc:p},this.method==="next"&&(this.arg=z),G}},x}(C.exports);try{regeneratorRuntime=T}catch(x){typeof globalThis=="object"?globalThis.regeneratorRuntime=T:Function("r","regeneratorRuntime = r")(T)}},695:function(C,T,x){"use strict";x.d(T,{Z:function(){return P}});function P(S){if(S.geometry&&S.geometry.dispose(),S.material){var z=Array.isArray(S.material)?S.material:[S.material];z.forEach(function(O){var D,W,E,_,F,Z,B,s,se,Q,G,X,L;(D=O.map)===null||D===void 0||D.dispose(),(W=O.lightMap)===null||W===void 0||W.dispose(),(E=O.bumpMap)===null||E===void 0||E.dispose(),(_=O.normalMap)===null||_===void 0||_.dispose(),(F=O.specularMap)===null||F===void 0||F.dispose(),(Z=O.envMap)===null||Z===void 0||Z.dispose(),(B=O.alphaMap)===null||B===void 0||B.dispose(),(s=O.aoMap)===null||s===void 0||s.dispose(),(se=O.displacementMap)===null||se===void 0||se.dispose(),(Q=O.emissiveMap)===null||Q===void 0||Q.dispose(),(G=O.gradientMap)===null||G===void 0||G.dispose(),(X=O.metalnessMap)===null||X===void 0||X.dispose(),(L=O.roughnessMap)===null||L===void 0||L.dispose(),O.dispose()})}}},519:function(C,T,x){"use strict";x.d(T,{disposeMesh:function(){return O.Z}});var P=x(666),S=x.n(P),z=null,O=x(695),D=x(644);function W(G){if(G.material){var X=Array.isArray(G.material)?G.material:[G.material];X.forEach(function(L){var R,N;(R=L.color)===null||R===void 0||R.convertSRGBToLinear(),(N=L.emissive)===null||N===void 0||N.convertSRGBToLinear(),L.map&&(L.map.encoding=THREE.sRGBEncoding),L.emissiveMap&&(L.emissiveMap.encoding=THREE.sRGBEncoding)})}}var E=x(568),_=x(924),F=require("idb-keyval"),Z=x(484),B=null,s=null,se=function(){var G=(0,E.Z)(S().mark(function X(L,R){var N,ne,J,H,U,ie;return S().wrap(function(ee){for(;;)switch(ee.prev=ee.next){case 0:return N=R.version,ee.next=4,(0,F.get)(L);case 4:if(J=ee.sent,!(J&&J[N])){ee.next=9;break}ne=J[N],ee.next=15;break;case 9:return ee.next=11,(0,Z.Z)(fetch(L).then(function(ye){if(ye.ok)return ye.blob();throw new Error}));case 11:H=ee.sent,U=H.res,ie=H.err,ie||(ne=U,(0,F.set)(L,(0,_.Z)({},N,U)));case 15:return ee.abrupt("return",ne?{url:URL.createObjectURL(ne)}:{url:L});case 16:case"end":return ee.stop()}},X)}));return function(L,R){return G.apply(this,arguments)}}(),Q=x(705)},484:function(C,T,x){"use strict";x.d(T,{Z:function(){return S}});var P=x(42);function S(z){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return z.then(function(D){return(0,P.Z)({err:null,res:D},O)}).catch(function(D){return(0,P.Z)({err:D,res:void 0},O)})}},705:function(C,T,x){"use strict";x.d(T,{C:function(){return D},y:function(){return O}});var P=x(644),S=x.n(P),z=new Map,O=function(){var W=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{generateTopUV:function(E,_,F,Z,B){var s=_[F*3],se=_[F*3+1],Q=_[Z*3],G=_[Z*3+1],X=_[B*3],L=_[B*3+1],R;if(z.has(E))R=z.get(E);else{var N=W.box3||new P.Box3;if(!W.box3){var ne=E.parameters.shapes.getPoints();N.setFromArray(ne.map(function(ue){return[ue.x,ue.y,0]}).flat())}var J=N.getSize(new P.Vector3);W.split&&(J.y/=W.split),R={box:N,size:J},z.set(E,R)}var H=R.box,U=R.size,ie=W.split?1-W.split:0;return[new P.Vector2((s-H.min.x)/U.x,(se-H.min.y)/U.y+ie),new P.Vector2((Q-H.min.x)/U.x,(G-H.min.y)/U.y+ie),new P.Vector2((X-H.min.x)/U.x,(L-H.min.y)/U.y+ie)]},generateSideWallUV:function(E,_,F,Z,B,s){var se=_[F*3],Q=_[F*3+1],G=_[F*3+2],X=_[Z*3],L=_[Z*3+1],R=_[Z*3+2],N=_[B*3],ne=_[B*3+1],J=_[B*3+2],H=_[s*3],U=_[s*3+1],ie=_[s*3+2],ue;if(z.has(_))ue=z.get(_);else{var ee=new P.Box3;ee.setFromArray(_);var ye=ee.getSize(new P.Vector3);W.split&&(ye.z/=1-W.split),ue={box:ee,size:ye},z.set(_,ue)}var K=ue.box,$=ue.size;return Math.abs(Q-L)<Math.abs(se-X)?[new P.Vector2((se-K.min.x)/$.x,(G-K.min.z)/$.z),new P.Vector2((X-K.min.x)/$.x,(R-K.min.z)/$.z),new P.Vector2((N-K.min.x)/$.x,(J-K.min.z)/$.z),new P.Vector2((H-K.min.x)/$.x,(ie-K.min.z)/$.z)]:[new P.Vector2((Q-K.min.y)/$.x,(G-K.min.z)/$.z),new P.Vector2((L-K.min.y)/$.x,(R-K.min.z)/$.z),new P.Vector2((ne-K.min.y)/$.x,(J-K.min.z)/$.z),new P.Vector2((U-K.min.y)/$.x,(ie-K.min.z)/$.z)]}}},D=function(){z.clear()}},644:function(C){"use strict";C.exports=require("three")},568:function(C,T,x){"use strict";x.d(T,{Z:function(){return S}});function P(z,O,D,W,E,_,F){try{var Z=z[_](F),B=Z.value}catch(s){D(s);return}Z.done?O(B):Promise.resolve(B).then(W,E)}function S(z){return function(){var O=this,D=arguments;return new Promise(function(W,E){var _=z.apply(O,D);function F(B){P(_,W,E,F,Z,"next",B)}function Z(B){P(_,W,E,F,Z,"throw",B)}F(void 0)})}}},924:function(C,T,x){"use strict";x.d(T,{Z:function(){return P}});function P(S,z,O){return z in S?Object.defineProperty(S,z,{value:O,enumerable:!0,configurable:!0,writable:!0}):S[z]=O,S}},42:function(C,T,x){"use strict";x.d(T,{Z:function(){return S}});var P=x(924);function S(z){for(var O=1;O<arguments.length;O++){var D=arguments[O]!=null?arguments[O]:{},W=Object.keys(D);typeof Object.getOwnPropertySymbols=="function"&&(W=W.concat(Object.getOwnPropertySymbols(D).filter(function(E){return Object.getOwnPropertyDescriptor(D,E).enumerable}))),W.forEach(function(E){(0,P.Z)(z,E,D[E])})}return z}}},De={};function q(C){var T=De[C];if(T!==void 0)return T.exports;var x=De[C]={exports:{}};return Qe[C](x,x.exports,q),x.exports}(function(){q.n=function(C){var T=C&&C.__esModule?function(){return C.default}:function(){return C};return q.d(T,{a:T}),T}})(),function(){q.d=function(C,T){for(var x in T)q.o(T,x)&&!q.o(C,x)&&Object.defineProperty(C,x,{enumerable:!0,get:T[x]})}}(),function(){q.o=function(C,T){return Object.prototype.hasOwnProperty.call(C,T)}}(),function(){q.r=function(C){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(C,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(C,"__esModule",{value:!0})}}();var ze={};(function(){"use strict";q.r(ze),q.d(ze,{ConicPolygon:function(){return _t},ExtrudePolygon:function(){return wt},Image:function(){return A},Line:function(){return rt},MeshLine:function(){return re},MeshLineMaterial:function(){return Re},MeshLineRaycast:function(){return Ue},Node:function(){return oe},Text:function(){return ke},Video:function(){return ae}});function C(e,i){if(!(e instanceof i))throw new TypeError("Cannot call a class as a function")}function T(e,i){return T=Object.setPrototypeOf||function(n,a){return n.__proto__=a,n},T(e,i)}function x(e,i){return T(e,i)}function P(e,i){if(typeof i!="function"&&i!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),i&&x(e,i)}var S=q(42);function z(e,i){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);i&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function O(e,i){return i=i!=null?i:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):z(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))}),e}function D(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function W(e){return W=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},W(e)}function E(e){return W(e)}function _(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function F(e){return e&&e.constructor===Symbol?"symbol":typeof e}function Z(e,i){return i&&(F(i)==="object"||typeof i=="function")?i:_(e)}function B(e){var i=D();return function(){var n=E(e),a;if(i){var t=E(this).constructor;a=Reflect.construct(n,arguments,t)}else a=n.apply(this,arguments);return Z(this,a)}}var s=q(644);function se(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function Q(e,i,r){return se()?Q=Reflect.construct:Q=function(a,t,o){var c=[null];c.push.apply(c,t);var h=Function.bind.apply(a,c),v=new h;return o&&x(v,o.prototype),v},Q.apply(null,arguments)}function G(e,i,r){return Q.apply(null,arguments)}function X(e,i){for(var r=0;r<i.length;r++){var n=i[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function L(e,i,r){return i&&X(e.prototype,i),r&&X(e,r),e}function R(e,i){(i==null||i>e.length)&&(i=e.length);for(var r=0,n=new Array(i);r<i;r++)n[r]=e[r];return n}function N(e){if(Array.isArray(e))return R(e)}function ne(e){if(typeof Symbol!="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function J(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function H(e,i){if(!!e){if(typeof e=="string")return R(e,i);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return R(e,i)}}function U(e){return N(e)||ne(e)||H(e)||J()}var ie=q(484);function ue(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r={};return r.promise=new Promise(function(n,a){r.resolve=n,r.reject=a}),e&&(r.promise=(0,ie.Z)(r.promise,i)),r}var ee=require("three/examples/jsm/renderers/CSS2DRenderer"),ye=require("three/examples/jsm/renderers/CSS3DRenderer"),K=q(519),$=function(e){e&&((0,K.disposeMesh)(e),e.children.forEach(function(i){i.userData.BaseObject_||$(i)}))},me=function(){"use strict";function e(){C(this,e),this.objecttype__="BaseObject",this.userData={},this.pm=ue(),this.visible=!1}var i=e.prototype;return i.init=function(){},i.create=function(){},i.render=function(){},i.update=function(n,a){},i.resize=function(n,a){},i.show=function(){return this.object3d&&(this.object3d.visible=!0),this.visible=!0,this},i.hide=function(){return this.object3d&&(this.object3d.visible=!1),this.visible=!1,this},i.isVisible=function(){return this.visible},i.createMesh=function(){for(var n=arguments.length,a=new Array(n),t=0;t<n;t++)a[t]=arguments[t];return this.object3d=G(s.Mesh,U(a)),this},i.createGroup=function(){return this.object3d=new s.Group,this},i.createPoints=function(){for(var n=arguments.length,a=new Array(n),t=0;t<n;t++)a[t]=arguments[t];return this.object3d=G(s.Points,U(a)),this},i.createCSS2DObject=function(n){return this.object3d=new ee.CSS2DObject(n),this},i.createCSS3DObject=function(n){return this.object3d=new ye.CSS3DObject(n),this},i.createCSS3DSprite=function(n){return this.object3d=new ye.CSS3DSprite(n),this},i.createSprite=function(n){return this.object3d=new s.Sprite(n),this},i.add=function(){for(var n=arguments.length,a=new Array(n),t=0;t<n;t++)a[t]=arguments[t];var o;return(o=this.object3d).add.apply(o,U(a)),this},i.remove=function(){for(var n=arguments.length,a=new Array(n),t=0;t<n;t++)a[t]=arguments[t];var o;return(o=this.object3d).remove.apply(o,U(a)),this},i.getSize=function(){var n=new s.Box3().setFromObject(this.object3d);return{min:n.min,max:n.max,size:n.getSize(new s.Vector3)}},i.traverse=function(n){n(this),this.children.forEach(function(a){a.traverse(n)})},i.dispose=function(){$(this.object3d)},L(e,[{key:"parent",get:function(){var n=this.object3d.parent;return(n==null?void 0:n.userData.BaseObject_)||this.pencil.scene}},{key:"children",get:function(){return this.object3d.children.map(function(n){return n.userData.BaseObject_}).filter(function(n){return!!n})}}]),e}(),ke=function(e){"use strict";P(r,e);var i=B(r);function r(a){C(this,r);var t;return t=i.call(this),t.width=0,t.canvas=document.createElement("canvas"),t.options=(0,S.Z)({},{scale:.5,fontSize:28,fontFamily:"system-ui,-apple-system,BlinkMacSystemFont,sans-serif",fontWeight:"normal",flipX:!1,sprite:!1,sizeAttenuation:!0},a),t}var n=r.prototype;return n.create=function(){var t=this.options,o=t.position,c=t.lookAt,h=t.sprite,v=t.text,d=t.sizeAttenuation;if(h){var m=new s.Sprite(new s.SpriteMaterial({transparent:!0,sizeAttenuation:d}));this.object3d=m}else{var g=new s.MeshBasicMaterial({side:s.DoubleSide,transparent:!0}),b=new s.PlaneGeometry(1,1,1,1);this.createMesh(b,g)}this.object3d.position.copy(o),c&&this.object3d.lookAt(c),this.setText(v)},n.setText=function(t,o){var c=(0,S.Z)(O((0,S.Z)({},this.options),{text:t}),o||{}),h=c.text,v=c.fontSize,d=c.fontFamily,m=c.fontWeight,g=c.flipX,b=c.scale,y=this.canvas;y.width=v*h.length*2,y.height=v;var M=y.getContext("2d");M.font="".concat(m," ").concat(v,"px/1 ").concat(d);var f=M.measureText(h).width;y.width=f,this.width=f,M=y.getContext("2d"),M.clearRect(0,0,y.width,y.height),g&&M.scale(-1,1),M.font="".concat(m," ").concat(v,"px/1 ").concat(d),M.textBaseline="middle",M.fillStyle="#ffffff",M.fillText(h,g?f*-1:0,y.height/2),M.restore();var j=new s.Texture(y);j.anisotropy=16,j.needsUpdate=!0;var k=this.object3d;k.material.map&&k.material.map.dispose(),k.material.map=j,k.material.needsUpdate=!0,k.scale.set(j.image.width*b,j.image.height*b,1)},r}(me),l=q(568),u=q(666),p=q.n(u),A=function(e){"use strict";P(r,e);var i=B(r);function r(a){C(this,r);var t;return t=i.call(this),t.options=a,t}var n=r.prototype;return n.getMaterial=function(){var t=this;return(0,l.Z)(p().mark(function o(){var c,h,v,d,m,g,b,y,M,f;return p().wrap(function(k){for(;;)switch(k.prev=k.next){case 0:return c=t.options,h=c.transparent,v=c.blending,d=c.src,m=c.depthWrite,g=c.alphaTest,b=c.sprite,y=c.sizeAttenuation,k.next=3,new s.TextureLoader().loadAsync(d);case 3:return M=k.sent,f=b?new s.SpriteMaterial({map:M,transparent:h!=null?h:!1,blending:v!=null?v:s.NormalBlending,depthWrite:m!=null?m:!0,alphaTest:g!=null?g:0,sizeAttenuation:y!=null?y:!0}):new s.MeshBasicMaterial({map:M,transparent:h!=null?h:!1,blending:v!=null?v:s.NormalBlending,depthWrite:m!=null?m:!0,alphaTest:g!=null?g:0}),k.abrupt("return",f);case 6:case"end":return k.stop()}},o)}))()},n.create=function(){var t=this;return(0,l.Z)(p().mark(function o(){var c,h,v,d,m,g,b,y;return p().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:if(c=t.options,h=c.scale,v=c.position,d=c.src,m=c.cache,g=c.sprite,!(m&&!m.get(d))){f.next=7;break}return m.init(d),f.next=5,t.getMaterial();case 5:b=f.sent,m.set(d,b);case 7:if(!m){f.next=13;break}return f.next=10,m.get(d);case 10:f.t0=f.sent,f.next=16;break;case 13:return f.next=15,t.getMaterial();case 15:f.t0=f.sent;case 16:y=f.t0,t.texture=y.map,g?t.createSprite(y):t.createMesh(new s.PlaneBufferGeometry(1,1),y),h&&t.setScale(h),v&&t.object3d.position.copy(v);case 21:case"end":return f.stop()}},o)}))()},n.setScale=function(t){this.object3d.scale.set(this.texture.image.width*t,this.texture.image.height*t,1)},r}(me);function w(e,i){for(;!Object.prototype.hasOwnProperty.call(e,i)&&(e=E(e),e!==null););return e}function I(e,i,r){return typeof Reflect!="undefined"&&Reflect.get?I=Reflect.get:I=function(a,t,o){var c=w(a,t);if(!!c){var h=Object.getOwnPropertyDescriptor(c,t);return h.get?h.get.call(o||a):h.value}},I(e,i,r)}function te(e,i,r){return I(e,i,r)}var ae=function(e){"use strict";P(r,e);var i=B(r);function r(a){C(this,r);var t;return t=i.call(this),t.options=(0,S.Z)({},{autoPlay:!0,loop:!0},a),t}var n=r.prototype;return n.getMaterial=function(){var t=this.options,o=t.src,c=t.transparent,h=t.blending,v=t.depthWrite,d=t.format,m=t.autoPlay,g=t.loop,b=t.alphaTest,y=t.sprite,M=ue(),f=document.createElement("video");return f.addEventListener("loadedmetadata",function(){var j=new s.VideoTexture(f);j.format=d!=null?d:s.RGBAFormat,j.needsUpdate=!0;var k=y?new s.SpriteMaterial({map:j,transparent:c!=null?c:!1,blending:h!=null?h:s.NormalBlending,depthWrite:v!=null?v:!0,alphaTest:b!=null?b:0}):new s.MeshBasicMaterial({map:j,transparent:c!=null?c:!1,blending:h!=null?h:s.NormalBlending,depthWrite:v!=null?v:!0,alphaTest:b!=null?b:0});M.resolve(k)},!1),f.src=o,f.muted=!0,f.autoplay=m,f.loop=g,f.preload="auto",M.promise},n.create=function(){var t=this;return(0,l.Z)(p().mark(function o(){var c,h,v,d,m,g,b,y;return p().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:if(c=t.options,h=c.scale,v=c.position,d=c.src,m=c.cache,g=c.sprite,!(m&&!m.get(d))){f.next=7;break}return m.init(d),f.next=5,t.getMaterial();case 5:b=f.sent,m.set(d,b);case 7:if(!m){f.next=13;break}return f.next=10,m.get(d);case 10:f.t0=f.sent,f.next=16;break;case 13:return f.next=15,t.getMaterial();case 15:f.t0=f.sent;case 16:y=f.t0,t.video=y.map.image,g?t.createSprite(y):t.createMesh(new s.PlaneBufferGeometry(1,1),y),h&&t.setScale(h),v&&t.object3d.position.copy(v);case 21:case"end":return f.stop()}},o)}))()},n.setScale=function(t){this.object3d.scale.set(this.video.videoWidth*t,this.video.videoHeight*t,1)},n.render=function(){var t=this.options.autoPlay;t&&this.video.play()},n.dispose=function(){this.video.pause(),this.video.src="",this.video.load(),te(E(r.prototype),"dispose",this).call(this)},r}(me),ce=function(e){"use strict";P(r,e);var i=B(r);function r(a){C(this,r);var t;return t=i.call(this),t.options=(0,S.Z)({},a),t}var n=r.prototype;return n.create=function(){var t=this.options,o=t.position,c=t.children,h=t.onClick,v=t.zIndexFix,d=document.createElement("div");this.element=d,d.appendChild(c),this.createCSS2DObject(d),o&&this.object3d.position.copy(o),h&&this.clickTarge.forEach(function(m){m.addEventListener("click",h)}),v&&(this.object3d.userData.zIndexFix=v)},n.getMaterial=function(t){return(0,l.Z)(p().mark(function o(){var c,h,v,d;return p().wrap(function(g){for(;;)switch(g.prev=g.next){case 0:return c=document.createElement("canvas"),c.width=256,c.height=256,h=c.getContext("2d"),h.fillStyle="#ff0000",h.fillRect(0,0,256,256),v=new s.CanvasTexture(c),d=new s.SpriteMaterial({map:v,opacity:t?1:0,transparent:!0,alphaTest:.1,sizeAttenuation:!1}),g.abrupt("return",d);case 9:case"end":return g.stop()}},o)}))()},n.createPickObject=function(t){var o=t.show,c=o===void 0?!1:o,h=t.scale,v=h===void 0?new s.Vector3(1,1,1):h,d=t.position,m=d===void 0?new s.Vector3(0,0,0):d,g=t.cache,b=this;return(0,l.Z)(p().mark(function y(){var M,f,j,k;return p().wrap(function(V){for(;;)switch(V.prev=V.next){case 0:if(M="node-create-pick-object",!(g&&!g.get(M))){V.next=7;break}return g.init(M),V.next=5,b.getMaterial(c);case 5:f=V.sent,g.set(M,f);case 7:if(!g){V.next=13;break}return V.next=10,g.get(M);case 10:V.t0=V.sent,V.next=16;break;case 13:return V.next=15,b.getMaterial(c);case 15:V.t0=V.sent;case 16:j=V.t0,k=new s.Sprite(j),k.scale.set(j.map.image.width*v.x,j.map.image.height*v.y,1),k.position.copy(m),b.add(k),b.pickObject=k;case 22:case"end":return V.stop()}},y)}))()},n.dispose=function(){var t=this.options.onClick;t&&this.clickTarge.forEach(function(o){o.removeEventListener("click",t)}),te(E(r.prototype),"dispose",this).call(this)},L(r,[{key:"clickTarge",get:function(){var t=this,o=this.options.clickTarge;if(o){var c=o.map(function(h){return U(t.element.querySelectorAll(h))}).flat();return c}return[this.element]}}]),r}(me),oe=ce,Oe=`
|
|
2
2
|
`.concat(s.ShaderChunk.logdepthbuf_pars_vertex,`
|
|
3
3
|
`).concat(s.ShaderChunk.fog_pars_vertex,`
|
|
4
4
|
attribute vec3 previous;
|
|
@@ -129,4 +129,4 @@ void main() {
|
|
|
129
129
|
gl_FragColor.a *= step(vCounters, visibility);
|
|
130
130
|
`).concat(s.ShaderChunk.fog_fragment,`
|
|
131
131
|
}
|
|
132
|
-
`),re=function(e){"use strict";P(r,e);var i=B(r);function r(){C(this,r);var n;return n=i.call(this),n.isMeshLine=!0,n.type="MeshLine",n.positions=[],n.previous=[],n.next=[],n.side=[],n.width=[],n.indices_array=[],n.uvs=[],n.counters=[],n._points=[],n._geom=null,n.widthCallback=null,n.matrixWorld=new s.Matrix4,Object.defineProperties(_(n),{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(t){this.setGeometry(t,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(t){this.setPoints(t,this.widthCallback)}}}),n}return r}(s.BufferGeometry);re.prototype.setMatrixWorld=function(e){this.matrixWorld=e},re.prototype.setGeometry=function(e,i){this._geometry=e,this.setPoints(e.getAttribute("position").array,i)},re.prototype.setPoints=function(e,i){if(!(e instanceof Float32Array)&&!(e instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=e,this.widthCallback=i,this.positions=[],this.counters=[],e.length&&e[0]instanceof s.Vector3)for(var r=0;r<e.length;r++){var n=e[r],a=r/e.length;this.positions.push(n.x,n.y,n.z),this.positions.push(n.x,n.y,n.z),this.counters.push(a),this.counters.push(a)}else for(var r=0;r<e.length;r+=3){var a=r/e.length;this.positions.push(e[r],e[r+1],e[r+2]),this.positions.push(e[r],e[r+1],e[r+2]),this.counters.push(a),this.counters.push(a)}this.process()};function Ue(e,i){var r=new s.Matrix4,n=new s.Ray,a=new s.Sphere,t=new s.Vector3,o=this.geometry;if(o.boundingSphere||o.computeBoundingSphere(),a.copy(o.boundingSphere),a.applyMatrix4(this.matrixWorld),e.ray.intersectSphere(a,t)!==!1){r.copy(this.matrixWorld).invert(),n.copy(e.ray).applyMatrix4(r);var c=new s.Vector3,h=new s.Vector3,v=new s.Vector3,d=this instanceof s.LineSegments?2:1,m=o.index,g=o.attributes;if(m!==null)for(var b=m.array,y=g.position.array,M=g.width.array,f=0,j=b.length-1;f<j;f+=d){var k=b[f],Y=b[f+1];c.fromArray(y,k*3),h.fromArray(y,Y*3);var V=M[Math.floor(f/3)]!==void 0?M[Math.floor(f/3)]:1,fe=e.params.Line.threshold+this.material.lineWidth*V/2,ge=fe*fe,xe=n.distanceSqToSegment(c,h,t,v);if(!(xe>ge)){t.applyMatrix4(this.matrixWorld);var he=e.ray.origin.distanceTo(t);he<e.near||he>e.far||(i.push({distance:he,point:v.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this}),f=j)}}}}re.prototype.raycast=Ue,re.prototype.compareV3=function(e,i){var r=e*6,n=i*6;return this.positions[r]===this.positions[n]&&this.positions[r+1]===this.positions[n+1]&&this.positions[r+2]===this.positions[n+2]},re.prototype.copyV3=function(e){var i=e*6;return[this.positions[i],this.positions[i+1],this.positions[i+2]]},re.prototype.process=function(){var e=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var i,r;this.compareV3(0,e-1)?r=this.copyV3(e-2):r=this.copyV3(0),this.previous.push(r[0],r[1],r[2]),this.previous.push(r[0],r[1],r[2]);for(var n=0;n<e;n++){if(this.side.push(1),this.side.push(-1),this.widthCallback?i=this.widthCallback(n/(e-1)):i=1,this.width.push(i),this.width.push(i),this.uvs.push(n/(e-1),0),this.uvs.push(n/(e-1),1),n<e-1){r=this.copyV3(n),this.previous.push(r[0],r[1],r[2]),this.previous.push(r[0],r[1],r[2]);var a=n*2;this.indices_array.push(a,a+1,a+2),this.indices_array.push(a+2,a+1,a+3)}n>0&&(r=this.copyV3(n),this.next.push(r[0],r[1],r[2]),this.next.push(r[0],r[1],r[2]))}this.compareV3(e-1,0)?r=this.copyV3(1):r=this.copyV3(e-1),this.next.push(r[0],r[1],r[2]),this.next.push(r[0],r[1],r[2]),!this._attributes||this._attributes.position.count!==this.positions.length?this._attributes={position:new s.BufferAttribute(new Float32Array(this.positions),3),previous:new s.BufferAttribute(new Float32Array(this.previous),3),next:new s.BufferAttribute(new Float32Array(this.next),3),side:new s.BufferAttribute(new Float32Array(this.side),1),width:new s.BufferAttribute(new Float32Array(this.width),1),uv:new s.BufferAttribute(new Float32Array(this.uvs),2),index:new s.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new s.BufferAttribute(new Float32Array(this.counters),1)}:(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()};function Te(e,i,r,n,a){var t;if(e=e.subarray||e.slice?e:e.buffer,r=r.subarray||r.slice?r:r.buffer,e=i?e.subarray?e.subarray(i,a&&i+a):e.slice(i,a&&i+a):e,r.set)r.set(e,n);else for(t=0;t<e.length;t++)r[t+n]=e[t];return r}re.prototype.advance=function(e){var i=this._attributes.position.array,r=this._attributes.previous.array,n=this._attributes.next.array,a=i.length;Te(i,0,r,0,a),Te(i,6,i,0,a-6),i[a-6]=e.x,i[a-5]=e.y,i[a-4]=e.z,i[a-3]=e.x,i[a-2]=e.y,i[a-1]=e.z,Te(i,6,n,0,a-6),n[a-6]=e.x,n[a-5]=e.y,n[a-4]=e.z,n[a-3]=e.x,n[a-2]=e.y,n[a-1]=e.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0},s.ShaderChunk.meshline_vert=Oe,s.ShaderChunk.meshline_frag=Pe;var Re=function(e){"use strict";P(r,e);var i=B(r);function r(n){C(this,r);var a;return a=i.call(this,{uniforms:Object.assign({},s.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new s.Color(16777215)},opacity:{value:1},resolution:{value:new s.Vector2(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new s.Vector2(1,1)},offset:{value:new s.Vector2(1,1)},lineLightAnimation:{value:1},time:{value:0},size:{value:300},speed:{value:.3},lightWidth:{value:.1},uCenter:{value:new s.Vector2(0,0)},lightColor:{value:new s.Color(16777215)}}),vertexShader:s.ShaderChunk.meshline_vert,fragmentShader:s.ShaderChunk.meshline_frag}),a.isMeshLineMaterial=!0,a.type="MeshLineMaterial",Object.defineProperties(_(a),{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(o){this.uniforms.lineWidth.value=o}},lineLightAnimation:{enumerable:!0,get:function(){return this.uniforms.lineLightAnimation.value},set:function(o){this.uniforms.lineLightAnimation.value=o}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(o){this.uniforms.map.value=o}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(o){this.uniforms.useMap.value=o}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(o){this.uniforms.alphaMap.value=o}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(o){this.uniforms.useAlphaMap.value=o}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(o){this.uniforms.color.value=o}},lightColor:{enumerable:!0,get:function(){return this.uniforms.lightColor.value},set:function(o){this.uniforms.lightColor.value=o}},time:{enumerable:!0,get:function(){return this.uniforms.time.value},set:function(o){this.uniforms.time.value=o}},uCenter:{enumerable:!0,get:function(){return this.uniforms.uCenter.value},set:function(o){this.uniforms.uCenter.value=o}},size:{enumerable:!0,get:function(){return this.uniforms.size.value},set:function(o){this.uniforms.size.value=o}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(o){this.uniforms.opacity.value=o}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(o){this.uniforms.resolution.value.copy(o)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(o){this.uniforms.sizeAttenuation.value=o}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(o){this.uniforms.dashArray.value=o,this.useDash=o!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(o){this.uniforms.dashOffset.value=o}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(o){this.uniforms.dashRatio.value=o}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(o){this.uniforms.useDash.value=o}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(o){this.uniforms.visibility.value=o}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(o){this.uniforms.alphaTest.value=o}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(o){this.uniforms.repeat.value.copy(o)}}}),a.setValues(n),a}return r}(s.ShaderMaterial);Re.prototype.copy=function(e){return s.ShaderMaterial.prototype.copy.call(this,e),this.lineWidth=e.lineWidth,this.map=e.map,this.useMap=e.useMap,this.alphaMap=e.alphaMap,this.useAlphaMap=e.useAlphaMap,this.color.copy(e.color),this.opacity=e.opacity,this.resolution.copy(e.resolution),this.sizeAttenuation=e.sizeAttenuation,this.dashArray.copy(e.dashArray),this.dashOffset.copy(e.dashOffset),this.dashRatio.copy(e.dashRatio),this.useDash=e.useDash,this.visibility=e.visibility,this.alphaTest=e.alphaTest,this.repeat.copy(e.repeat),this};function Qe(e,i){if(e==null)return{};var r={},n=Object.keys(e),a,t;for(t=0;t<n.length;t++)a=n[t],!(i.indexOf(a)>=0)&&(r[a]=e[a]);return r}function Je(e,i){if(e==null)return{};var r=Qe(e,i),n,a;if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);for(a=0;a<t.length;a++)n=t[a],!(i.indexOf(n)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,n)||(r[n]=e[n]))}return r}var et=require("popmotion"),Ie=require("three/examples/jsm//utils/BufferGeometryUtils");function Fe(e){var i=e.setPointWidth,r=e.nodes,n=new s.BufferGeometry,a=new re;return n.setFromPoints(r),a.setGeometry(n,i),a}var tt={color:new s.Color("#ffffff"),lineWidth:3,sizeAttenuation:0},rt=function(e){"use strict";P(r,e);var i=B(r);function r(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};C(this,r);var t;return t=i.call(this),t.options=(0,S.Z)({},tt,a),t}var n=r.prototype;return n.create=function(){var t=this,o=this.options,c=o.duration,h=o.delay,v=o.onComplete,d=o.setPointWidth,m=o.key,g=o.nodes,b=o.nodesArr,y=o.coordinatesArr,M=o.projection,f=o.workerController,j=o.useGroups,k=Je(o,["duration","delay","onComplete","setPointWidth","key","nodes","nodesArr","coordinatesArr","projection","workerController","useGroups"]),Y=this.pencil.getSize(),V=Y.width,fe=Y.height,ge=new Re(O((0,S.Z)({},k),{resolution:new s.Vector2(V,fe)}));if(this.material=ge,g)this.createMesh(Fe({nodes:g,setPointWidth:d}),ge);else if(b){var xe=Ie.mergeBufferGeometries(b.map(function(he){return Fe({nodes:he,setPointWidth:d})}),j!=null?j:!1);this.createMesh(xe,ge)}else if(y&&f)return new Promise(function(he){f.postMessage({coordinatesArr:y,projection:M,useGroups:j},function(le){var _e=new s.BufferGeometry;Object.keys(le).forEach(function(pe){pe==="index"?_e.setIndex(new s.BufferAttribute(le[pe].array,le[pe].itemSize)):_e.setAttribute(pe,new s.BufferAttribute(le[pe].array,le[pe].itemSize))}),t.createMesh(_e,ge),he("")})})},n.resize=function(t,o){this.material.uniforms.resolution.value.set(t,o)},n.animate=function(){var t=this.options,o=t.duration,c=t.delay,h=t.onComplete,v=this.material.uniforms.offset,d=c!=null?c:0,m=(0,et.animate)({from:v.value,to:{x:0},duration:o!=null?o:1e3,elapsed:-d,repeat:1/0,onComplete:h,onUpdate:function(g){v.value.x=g.x}});this.tween=m},n.dispose=function(){var t;te(E(r.prototype),"dispose",this).call(this),(t=this.tween)===null||t===void 0||t.stop()},r}(me);function nt(e){if(Array.isArray(e))return e}function it(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function be(e,i){return nt(e)||ne(e,i)||H(e,i)||it()}var Se=require("d3-array"),at=require("earcut"),Ee=q.n(at),ot=require("@turf/boolean-clockwise"),st=q.n(ot);function ut(e,i){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=(90-i)*Math.PI/180,a=(90-e)*Math.PI/180;return[r*Math.sin(n)*Math.cos(a),r*Math.cos(n),r*Math.sin(n)*Math.sin(a)]}var ct=require("delaunator"),lt=q.n(ct),ft=require("@turf/boolean-point-in-polygon"),ht=q.n(ft),je=require("d3-geo"),pt=require("d3-geo-voronoi"),Ze=require("d3-scale");function vt(e,i){return e.map(function(r){var n=[],a;return r.forEach(function(t){if(a){var o=(0,je.geoDistance)(t,a)*180/Math.PI;if(o>i)for(var c=(0,je.geoInterpolate)(a,t),h=1/Math.ceil(o/i),v=h;v<1;)n.push(c(v)),v+=h}n.push(a=t)}),n})}function dt(e){for(var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=i.minLng,n=i.maxLng,a=i.minLat,t=i.maxLat,o=Math.round(Math.pow(360/e,2)/Math.PI),c=(1+Math.sqrt(5))/2,h=function(f){return f/c*360%360-180},v=function(f){return Math.acos(2*f/o-1)/Math.PI*180-90},d=function(f){return o*(Math.cos((f+90)*Math.PI/180)+1)/2},m=[t!==void 0?Math.ceil(d(t)):0,a!==void 0?Math.floor(d(a)):o-1],g=r===void 0&&n===void 0?function(){return!0}:r===void 0?function(f){return f<=n}:n===void 0?function(f){return f>=r}:n>=r?function(f){return f>=r&&f<=n}:function(f){return f>=r||f<=n},b=[],y=m[0];y<=m[1];y++){var M=h(y);g(M)&&b.push([M,v(y)])}return b}function Be(e,i){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return r?(0,je.geoContains)(i,e):ht()(e,i)}function mt(e,i){var r={type:"Polygon",coordinates:e},n=be((0,je.geoBounds)(r),2),a=be(n[0],2),t=a[0],o=a[1],c=be(n[1],2),h=c[0],v=c[1];if(Math.min(Math.abs(h-t),Math.abs(v-o))<i)return[];var d=t>h||v>=89||o<=-89;return dt(i,{minLng:t,maxLng:h,minLat:o,maxLat:v}).filter(function(m){return Be(m,r,d)})}function gt(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=i.resolution,n=r===void 0?1/0:r,a=vt(e,n),t=(0,Se.merge)(a),o=mt(e,n),c=U(t).concat(U(o)),h={type:"Polygon",coordinates:e},v=be((0,je.geoBounds)(h),2),d=be(v[0],2),m=d[0],g=d[1],b=be(v[1],2),y=b[0],M=b[1],f=m>y||M>=89||g<=-89,j=[];if(f){var k=(0,pt.geoVoronoi)(c).triangles(),Y=new Map(c.map(function(ve,Ae){var Me=be(ve,2),de=Me[0],Ce=Me[1];return["".concat(de,"-").concat(Ce),Ae]}));k.features.forEach(function(ve){var Ae,Me=ve.geometry.coordinates[0].slice(0,3).reverse(),de=[];if(Me.forEach(function(Le){var we=be(Le,2),We=we[0],Pt=we[1],Xe="".concat(We,"-").concat(Pt);Y.has(Xe)&&de.push(Y.get(Xe))}),de.length===3){if(de.some(function(Le){return Le<t.length})){var Ce=ve.properties.circumcenter;if(!Be(Ce,h,f))return}(Ae=j).push.apply(Ae,U(de))}})}else if(o.length)for(var he=function(ve,Ae){var Me,de=[2,1,0].map(function(we){return le.triangles[ve+we]}),Ce=de.map(function(we){return c[we]});if(de.some(function(we){return we<t.length})){var Le=[0,1].map(function(we){return(0,Se.mean)(Ce,function(We){return We[we]})});if(!Be(Le,h,f))return"continue"}(Me=j).push.apply(Me,U(de))},le=lt().from(c),_e=0,pe=le.triangles.length;_e<pe;_e+=3)he(_e,pe);else{var V=Ee().flatten(a),fe=V.vertices,ge=V.holes,xe=ge===void 0?[]:ge;j=Ee()(fe,xe,2)}var Ve=(0,Ze.scaleLinear)((0,Se.extent)(c,function(ve){return ve[0]}),[0,1]),xt=(0,Ze.scaleLinear)((0,Se.extent)(c,function(ve){return ve[1]}),[0,1]),Mt=c.map(function(ve){var Ae=be(ve,2),Me=Ae[0],de=Ae[1];return[Ve(Me),xt(de)]}),At={points:c,indices:j,uvs:Mt};return{contour:a,triangles:At}}var yt=gt,Ne=new s.BufferGeometry().setAttribute?"setAttribute":"addAttribute";function Ge(e,i){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,n=e.map(function(a){return a.map(function(t){var o=be(t,2),c=o[0],h=o[1];return r?ut(c,h,i):[c,h,i]})});return Ee().flatten(n)}function He(e,i,r){for(var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=Ge(e,i,n),t=a.vertices,o=a.holes,c=Ge(e,r,n),h=c.vertices,v=(0,Se.merge)([h,t]),d=Math.round(h.length/3),m=new Set(o),g=0,b=[],y=0;y<d;y++){var M=y+1;if(M===d)M=g;else if(m.has(M)){var f=M;M=g,g=f}b.push(y,y+d,M+d),b.push(M+d,M,y)}for(var j=[],k=1;k>=0;k--)for(var Y=0;Y<d;Y+=1)j.push(Y/(d-1),k);return{indices:b,vertices:v,uvs:j,topVerts:h}}function $e(e,i,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return{indices:n?e.indices:e.indices.slice().reverse(),vertices:Ge([e.points],i,a).vertices,uvs:r}}var bt=function(e){"use strict";P(r,e);var i=B(r);function r(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};C(this,r);var t;t=i.call(this),t.type="PolygonBufferGeometry",t.parameters=(0,S.Z)({},{polygonGeoJson:n,startHeight:0,endHeight:1,closedBottom:!0,closedTop:!0,includeSides:!0,curvatureResolution:5,cartesian:!0,userDataRsoOffset:0},a);var o=t.parameters,c=o.startHeight,h=o.endHeight,v=o.closedBottom,d=o.closedTop,m=o.includeSides,g=o.curvatureResolution,b=o.cartesian,y=o.userDataRsoOffset;st()(n[0])||n[0].reverse();var M=yt(n,{resolution:g}),f=M.contour,j=M.triangles,k=(0,Se.merge)(j.uvs),Y=[],V=[],fe=[],ge=0,xe=function(le){var _e=Math.round(Y.length/3),pe=fe.length;Y=Y.concat(le.vertices),V=V.concat(le.uvs),fe=fe.concat(_e?le.indices.map(function(Ve){return Ve+_e}):le.indices),t.addGroup(pe,fe.length-pe,ge++)};if(m){var he=He(f,c,h,b);xe(he),t.userData.rso=y?He(f,c,h+y,b):he}return v&&xe($e(j,c,k,!1,b)),d&&xe($e(j,h,k,!0,b)),t.setIndex(fe),t[Ne]("position",new s.Float32BufferAttribute(Y,3)),t[Ne]("uv",new s.Float32BufferAttribute(V,2)),t.computeVertexNormals(),t}return r}(s.BufferGeometry),_t=function(e){"use strict";P(r,e);var i=B(r);function r(a){C(this,r);var t;return t=i.call(this),t.options=(0,S.Z)({},{geojson:[[[]]],startHeight:0,height:5,closedBottom:!0,closedTop:!0,curvatureResolution:1,cartesian:!0,userDataRsoOffset:0},a),t}var n=r.prototype;return n.create=function(){var t=this.options,o=t.startHeight,c=t.height,h=t.closedBottom,v=t.closedTop,d=t.curvatureResolution,m=t.userDataRsoOffset,g=t.cartesian,b=new bt(this.options.geojson,{startHeight:o,endHeight:o+c,closedBottom:h,closedTop:v,curvatureResolution:d,cartesian:g,userDataRsoOffset:m});this.createMesh(b,this.options.material)},r}(me),qe=q(705);function Ke(e){var i=e.split,r=e.depth,n=e.points,a=new s.ExtrudeGeometry(new s.Shape(n),{depth:r,bevelEnabled:!1,UVGenerator:(0,qe.y)({split:i})});return(0,qe.C)(),a}var wt=function(e){"use strict";P(r,e);var i=B(r);function r(a){C(this,r);var t;return t=i.call(this),t.options=(0,S.Z)({},a),t}var n=r.prototype;return n.create=function(){var t=this,o=this.options,c=o.points,h=o.pointsArr,v=o.coordinatesArr,d=o.material,m=o.useGroups,g=o.depth,b=o.split,y=o.workerController,M=o.projection;if(c)this.createMesh(Ke({points:c,depth:g,split:b}),d);else if(h){var f=Ie.mergeBufferGeometries(h.map(function(j){return Ke({points:j,depth:g,split:b})}),m!=null?m:!1);this.createMesh(f,d)}else if(v&&y)return new Promise(function(j){y.postMessage({coordinatesArr:v,depth:g,split:b,useGroups:m,projection:M},function(k){var Y=new s.BufferGeometry;Object.keys(k).forEach(function(V){Y.setAttribute(V,new s.BufferAttribute(k[V].array,k[V].itemSize))}),t.createMesh(Y,d),j("")})})},r}(me)})(),module.exports=ze})();
|
|
132
|
+
`),re=function(e){"use strict";P(r,e);var i=B(r);function r(){C(this,r);var n;return n=i.call(this),n.isMeshLine=!0,n.type="MeshLine",n.positions=[],n.previous=[],n.next=[],n.side=[],n.width=[],n.indices_array=[],n.uvs=[],n.counters=[],n._points=[],n._geom=null,n.widthCallback=null,n.matrixWorld=new s.Matrix4,Object.defineProperties(_(n),{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(t){this.setGeometry(t,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(t){this.setPoints(t,this.widthCallback)}}}),n}return r}(s.BufferGeometry);re.prototype.setMatrixWorld=function(e){this.matrixWorld=e},re.prototype.setGeometry=function(e,i){this._geometry=e,this.setPoints(e.getAttribute("position").array,i)},re.prototype.setPoints=function(e,i){if(!(e instanceof Float32Array)&&!(e instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=e,this.widthCallback=i,this.positions=[],this.counters=[],e.length&&e[0]instanceof s.Vector3)for(var r=0;r<e.length;r++){var n=e[r],a=r/e.length;this.positions.push(n.x,n.y,n.z),this.positions.push(n.x,n.y,n.z),this.counters.push(a),this.counters.push(a)}else for(var r=0;r<e.length;r+=3){var a=r/e.length;this.positions.push(e[r],e[r+1],e[r+2]),this.positions.push(e[r],e[r+1],e[r+2]),this.counters.push(a),this.counters.push(a)}this.process()};function Ue(e,i){var r=new s.Matrix4,n=new s.Ray,a=new s.Sphere,t=new s.Vector3,o=this.geometry;if(o.boundingSphere||o.computeBoundingSphere(),a.copy(o.boundingSphere),a.applyMatrix4(this.matrixWorld),e.ray.intersectSphere(a,t)!==!1){r.copy(this.matrixWorld).invert(),n.copy(e.ray).applyMatrix4(r);var c=new s.Vector3,h=new s.Vector3,v=new s.Vector3,d=this instanceof s.LineSegments?2:1,m=o.index,g=o.attributes;if(m!==null)for(var b=m.array,y=g.position.array,M=g.width.array,f=0,j=b.length-1;f<j;f+=d){var k=b[f],Y=b[f+1];c.fromArray(y,k*3),h.fromArray(y,Y*3);var V=M[Math.floor(f/3)]!==void 0?M[Math.floor(f/3)]:1,fe=e.params.Line.threshold+this.material.lineWidth*V/2,ge=fe*fe,xe=n.distanceSqToSegment(c,h,t,v);if(!(xe>ge)){t.applyMatrix4(this.matrixWorld);var he=e.ray.origin.distanceTo(t);he<e.near||he>e.far||(i.push({distance:he,point:v.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this}),f=j)}}}}re.prototype.raycast=Ue,re.prototype.compareV3=function(e,i){var r=e*6,n=i*6;return this.positions[r]===this.positions[n]&&this.positions[r+1]===this.positions[n+1]&&this.positions[r+2]===this.positions[n+2]},re.prototype.copyV3=function(e){var i=e*6;return[this.positions[i],this.positions[i+1],this.positions[i+2]]},re.prototype.process=function(){var e=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var i,r;this.compareV3(0,e-1)?r=this.copyV3(e-2):r=this.copyV3(0),this.previous.push(r[0],r[1],r[2]),this.previous.push(r[0],r[1],r[2]);for(var n=0;n<e;n++){if(this.side.push(1),this.side.push(-1),this.widthCallback?i=this.widthCallback(n/(e-1)):i=1,this.width.push(i),this.width.push(i),this.uvs.push(n/(e-1),0),this.uvs.push(n/(e-1),1),n<e-1){r=this.copyV3(n),this.previous.push(r[0],r[1],r[2]),this.previous.push(r[0],r[1],r[2]);var a=n*2;this.indices_array.push(a,a+1,a+2),this.indices_array.push(a+2,a+1,a+3)}n>0&&(r=this.copyV3(n),this.next.push(r[0],r[1],r[2]),this.next.push(r[0],r[1],r[2]))}this.compareV3(e-1,0)?r=this.copyV3(1):r=this.copyV3(e-1),this.next.push(r[0],r[1],r[2]),this.next.push(r[0],r[1],r[2]),!this._attributes||this._attributes.position.count!==this.positions.length?this._attributes={position:new s.BufferAttribute(new Float32Array(this.positions),3),previous:new s.BufferAttribute(new Float32Array(this.previous),3),next:new s.BufferAttribute(new Float32Array(this.next),3),side:new s.BufferAttribute(new Float32Array(this.side),1),width:new s.BufferAttribute(new Float32Array(this.width),1),uv:new s.BufferAttribute(new Float32Array(this.uvs),2),index:new s.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new s.BufferAttribute(new Float32Array(this.counters),1)}:(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()};function Te(e,i,r,n,a){var t;if(e=e.subarray||e.slice?e:e.buffer,r=r.subarray||r.slice?r:r.buffer,e=i?e.subarray?e.subarray(i,a&&i+a):e.slice(i,a&&i+a):e,r.set)r.set(e,n);else for(t=0;t<e.length;t++)r[t+n]=e[t];return r}re.prototype.advance=function(e){var i=this._attributes.position.array,r=this._attributes.previous.array,n=this._attributes.next.array,a=i.length;Te(i,0,r,0,a),Te(i,6,i,0,a-6),i[a-6]=e.x,i[a-5]=e.y,i[a-4]=e.z,i[a-3]=e.x,i[a-2]=e.y,i[a-1]=e.z,Te(i,6,n,0,a-6),n[a-6]=e.x,n[a-5]=e.y,n[a-4]=e.z,n[a-3]=e.x,n[a-2]=e.y,n[a-1]=e.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0},s.ShaderChunk.meshline_vert=Oe,s.ShaderChunk.meshline_frag=Pe;var Re=function(e){"use strict";P(r,e);var i=B(r);function r(n){C(this,r);var a;return a=i.call(this,{uniforms:Object.assign({},s.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new s.Color(16777215)},opacity:{value:1},resolution:{value:new s.Vector2(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new s.Vector2(1,1)},offset:{value:new s.Vector2(1,1)},lineLightAnimation:{value:1},time:{value:0},size:{value:300},speed:{value:.3},lightWidth:{value:.1},uCenter:{value:new s.Vector2(0,0)},lightColor:{value:new s.Color(16777215)}}),vertexShader:s.ShaderChunk.meshline_vert,fragmentShader:s.ShaderChunk.meshline_frag}),a.isMeshLineMaterial=!0,a.type="MeshLineMaterial",Object.defineProperties(_(a),{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(o){this.uniforms.lineWidth.value=o}},lineLightAnimation:{enumerable:!0,get:function(){return this.uniforms.lineLightAnimation.value},set:function(o){this.uniforms.lineLightAnimation.value=o}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(o){this.uniforms.map.value=o}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(o){this.uniforms.useMap.value=o}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(o){this.uniforms.alphaMap.value=o}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(o){this.uniforms.useAlphaMap.value=o}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(o){this.uniforms.color.value=o}},lightColor:{enumerable:!0,get:function(){return this.uniforms.lightColor.value},set:function(o){this.uniforms.lightColor.value=o}},time:{enumerable:!0,get:function(){return this.uniforms.time.value},set:function(o){this.uniforms.time.value=o}},uCenter:{enumerable:!0,get:function(){return this.uniforms.uCenter.value},set:function(o){this.uniforms.uCenter.value=o}},size:{enumerable:!0,get:function(){return this.uniforms.size.value},set:function(o){this.uniforms.size.value=o}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(o){this.uniforms.opacity.value=o}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(o){this.uniforms.resolution.value.copy(o)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(o){this.uniforms.sizeAttenuation.value=o}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(o){this.uniforms.dashArray.value=o,this.useDash=o!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(o){this.uniforms.dashOffset.value=o}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(o){this.uniforms.dashRatio.value=o}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(o){this.uniforms.useDash.value=o}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(o){this.uniforms.visibility.value=o}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(o){this.uniforms.alphaTest.value=o}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(o){this.uniforms.repeat.value.copy(o)}}}),a.setValues(n),a}return r}(s.ShaderMaterial);Re.prototype.copy=function(e){return s.ShaderMaterial.prototype.copy.call(this,e),this.lineWidth=e.lineWidth,this.map=e.map,this.useMap=e.useMap,this.alphaMap=e.alphaMap,this.useAlphaMap=e.useAlphaMap,this.color.copy(e.color),this.opacity=e.opacity,this.resolution.copy(e.resolution),this.sizeAttenuation=e.sizeAttenuation,this.dashArray.copy(e.dashArray),this.dashOffset.copy(e.dashOffset),this.dashRatio.copy(e.dashRatio),this.useDash=e.useDash,this.visibility=e.visibility,this.alphaTest=e.alphaTest,this.repeat.copy(e.repeat),this};function Je(e,i){if(e==null)return{};var r={},n=Object.keys(e),a,t;for(t=0;t<n.length;t++)a=n[t],!(i.indexOf(a)>=0)&&(r[a]=e[a]);return r}function et(e,i){if(e==null)return{};var r=Je(e,i),n,a;if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);for(a=0;a<t.length;a++)n=t[a],!(i.indexOf(n)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,n)||(r[n]=e[n]))}return r}var Ie=require("popmotion"),Fe=require("three/examples/jsm//utils/BufferGeometryUtils");function Ze(e){var i=e.setPointWidth,r=e.nodes,n=new s.BufferGeometry,a=new re;return n.setFromPoints(r),a.setGeometry(n,i),a}var tt={color:new s.Color("#ffffff"),lineWidth:3,sizeAttenuation:0},rt=function(e){"use strict";P(r,e);var i=B(r);function r(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};C(this,r);var t;return t=i.call(this),t.options=(0,S.Z)({},tt,a),t}var n=r.prototype;return n.create=function(){var t=this,o=this.options,c=o.duration,h=o.delay,v=o.onComplete,d=o.setPointWidth,m=o.key,g=o.nodes,b=o.nodesArr,y=o.coordinatesArr,M=o.projection,f=o.workerController,j=o.useGroups,k=et(o,["duration","delay","onComplete","setPointWidth","key","nodes","nodesArr","coordinatesArr","projection","workerController","useGroups"]),Y=this.pencil.getSize(),V=Y.width,fe=Y.height,ge=new Re(O((0,S.Z)({},k),{resolution:new s.Vector2(V,fe)}));if(this.material=ge,g)this.createMesh(Ze({nodes:g,setPointWidth:d}),ge);else if(b){var xe=Fe.mergeBufferGeometries(b.map(function(he){return Ze({nodes:he,setPointWidth:d})}),j!=null?j:!1);this.createMesh(xe,ge)}else if(y&&f)return new Promise(function(he){f.postMessage({coordinatesArr:y,projection:M,useGroups:j},function(le){var _e=new s.BufferGeometry;Object.keys(le).forEach(function(pe){pe==="index"?_e.setIndex(new s.BufferAttribute(le[pe].array,le[pe].itemSize)):_e.setAttribute(pe,new s.BufferAttribute(le[pe].array,le[pe].itemSize))}),t.createMesh(_e,ge),he("")})})},n.resize=function(t,o){this.material.uniforms.resolution.value.set(t,o)},n.animate=function(){var t=this.options,o=t.duration,c=t.delay,h=t.onComplete,v=this.material.uniforms.offset,d=c!=null?c:0,m=(0,Ie.animate)({from:v.value,to:{x:0},duration:o!=null?o:1e3,elapsed:-d,repeat:1/0,onComplete:h,ease:Ie.linear,onUpdate:function(g){v.value.x=g.x}});this.tween=m},n.dispose=function(){var t;te(E(r.prototype),"dispose",this).call(this),(t=this.tween)===null||t===void 0||t.stop()},r}(me);function nt(e){if(Array.isArray(e))return e}function it(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function be(e,i){return nt(e)||ne(e,i)||H(e,i)||it()}var Se=require("d3-array"),at=require("earcut"),Ee=q.n(at),ot=require("@turf/boolean-clockwise"),st=q.n(ot);function ut(e,i){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=(90-i)*Math.PI/180,a=(90-e)*Math.PI/180;return[r*Math.sin(n)*Math.cos(a),r*Math.cos(n),r*Math.sin(n)*Math.sin(a)]}var ct=require("delaunator"),lt=q.n(ct),ft=require("@turf/boolean-point-in-polygon"),ht=q.n(ft),je=require("d3-geo"),pt=require("d3-geo-voronoi"),Ne=require("d3-scale");function vt(e,i){return e.map(function(r){var n=[],a;return r.forEach(function(t){if(a){var o=(0,je.geoDistance)(t,a)*180/Math.PI;if(o>i)for(var c=(0,je.geoInterpolate)(a,t),h=1/Math.ceil(o/i),v=h;v<1;)n.push(c(v)),v+=h}n.push(a=t)}),n})}function dt(e){for(var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=i.minLng,n=i.maxLng,a=i.minLat,t=i.maxLat,o=Math.round(Math.pow(360/e,2)/Math.PI),c=(1+Math.sqrt(5))/2,h=function(f){return f/c*360%360-180},v=function(f){return Math.acos(2*f/o-1)/Math.PI*180-90},d=function(f){return o*(Math.cos((f+90)*Math.PI/180)+1)/2},m=[t!==void 0?Math.ceil(d(t)):0,a!==void 0?Math.floor(d(a)):o-1],g=r===void 0&&n===void 0?function(){return!0}:r===void 0?function(f){return f<=n}:n===void 0?function(f){return f>=r}:n>=r?function(f){return f>=r&&f<=n}:function(f){return f>=r||f<=n},b=[],y=m[0];y<=m[1];y++){var M=h(y);g(M)&&b.push([M,v(y)])}return b}function Be(e,i){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return r?(0,je.geoContains)(i,e):ht()(e,i)}function mt(e,i){var r={type:"Polygon",coordinates:e},n=be((0,je.geoBounds)(r),2),a=be(n[0],2),t=a[0],o=a[1],c=be(n[1],2),h=c[0],v=c[1];if(Math.min(Math.abs(h-t),Math.abs(v-o))<i)return[];var d=t>h||v>=89||o<=-89;return dt(i,{minLng:t,maxLng:h,minLat:o,maxLat:v}).filter(function(m){return Be(m,r,d)})}function gt(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=i.resolution,n=r===void 0?1/0:r,a=vt(e,n),t=(0,Se.merge)(a),o=mt(e,n),c=U(t).concat(U(o)),h={type:"Polygon",coordinates:e},v=be((0,je.geoBounds)(h),2),d=be(v[0],2),m=d[0],g=d[1],b=be(v[1],2),y=b[0],M=b[1],f=m>y||M>=89||g<=-89,j=[];if(f){var k=(0,pt.geoVoronoi)(c).triangles(),Y=new Map(c.map(function(ve,Ae){var Me=be(ve,2),de=Me[0],Ce=Me[1];return["".concat(de,"-").concat(Ce),Ae]}));k.features.forEach(function(ve){var Ae,Me=ve.geometry.coordinates[0].slice(0,3).reverse(),de=[];if(Me.forEach(function(Le){var we=be(Le,2),We=we[0],Pt=we[1],Ye="".concat(We,"-").concat(Pt);Y.has(Ye)&&de.push(Y.get(Ye))}),de.length===3){if(de.some(function(Le){return Le<t.length})){var Ce=ve.properties.circumcenter;if(!Be(Ce,h,f))return}(Ae=j).push.apply(Ae,U(de))}})}else if(o.length)for(var he=function(ve,Ae){var Me,de=[2,1,0].map(function(we){return le.triangles[ve+we]}),Ce=de.map(function(we){return c[we]});if(de.some(function(we){return we<t.length})){var Le=[0,1].map(function(we){return(0,Se.mean)(Ce,function(We){return We[we]})});if(!Be(Le,h,f))return"continue"}(Me=j).push.apply(Me,U(de))},le=lt().from(c),_e=0,pe=le.triangles.length;_e<pe;_e+=3)he(_e,pe);else{var V=Ee().flatten(a),fe=V.vertices,ge=V.holes,xe=ge===void 0?[]:ge;j=Ee()(fe,xe,2)}var Ve=(0,Ne.scaleLinear)((0,Se.extent)(c,function(ve){return ve[0]}),[0,1]),xt=(0,Ne.scaleLinear)((0,Se.extent)(c,function(ve){return ve[1]}),[0,1]),Mt=c.map(function(ve){var Ae=be(ve,2),Me=Ae[0],de=Ae[1];return[Ve(Me),xt(de)]}),At={points:c,indices:j,uvs:Mt};return{contour:a,triangles:At}}var yt=gt,He=new s.BufferGeometry().setAttribute?"setAttribute":"addAttribute";function Ge(e,i){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,n=e.map(function(a){return a.map(function(t){var o=be(t,2),c=o[0],h=o[1];return r?ut(c,h,i):[c,h,i]})});return Ee().flatten(n)}function $e(e,i,r){for(var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=Ge(e,i,n),t=a.vertices,o=a.holes,c=Ge(e,r,n),h=c.vertices,v=(0,Se.merge)([h,t]),d=Math.round(h.length/3),m=new Set(o),g=0,b=[],y=0;y<d;y++){var M=y+1;if(M===d)M=g;else if(m.has(M)){var f=M;M=g,g=f}b.push(y,y+d,M+d),b.push(M+d,M,y)}for(var j=[],k=1;k>=0;k--)for(var Y=0;Y<d;Y+=1)j.push(Y/(d-1),k);return{indices:b,vertices:v,uvs:j,topVerts:h}}function qe(e,i,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return{indices:n?e.indices:e.indices.slice().reverse(),vertices:Ge([e.points],i,a).vertices,uvs:r}}var bt=function(e){"use strict";P(r,e);var i=B(r);function r(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};C(this,r);var t;t=i.call(this),t.type="PolygonBufferGeometry",t.parameters=(0,S.Z)({},{polygonGeoJson:n,startHeight:0,endHeight:1,closedBottom:!0,closedTop:!0,includeSides:!0,curvatureResolution:5,cartesian:!0,userDataRsoOffset:0},a);var o=t.parameters,c=o.startHeight,h=o.endHeight,v=o.closedBottom,d=o.closedTop,m=o.includeSides,g=o.curvatureResolution,b=o.cartesian,y=o.userDataRsoOffset;st()(n[0])||n[0].reverse();var M=yt(n,{resolution:g}),f=M.contour,j=M.triangles,k=(0,Se.merge)(j.uvs),Y=[],V=[],fe=[],ge=0,xe=function(le){var _e=Math.round(Y.length/3),pe=fe.length;Y=Y.concat(le.vertices),V=V.concat(le.uvs),fe=fe.concat(_e?le.indices.map(function(Ve){return Ve+_e}):le.indices),t.addGroup(pe,fe.length-pe,ge++)};if(m){var he=$e(f,c,h,b);xe(he),t.userData.rso=y?$e(f,c,h+y,b):he}return v&&xe(qe(j,c,k,!1,b)),d&&xe(qe(j,h,k,!0,b)),t.setIndex(fe),t[He]("position",new s.Float32BufferAttribute(Y,3)),t[He]("uv",new s.Float32BufferAttribute(V,2)),t.computeVertexNormals(),t}return r}(s.BufferGeometry),_t=function(e){"use strict";P(r,e);var i=B(r);function r(a){C(this,r);var t;return t=i.call(this),t.options=(0,S.Z)({},{geojson:[[[]]],startHeight:0,height:5,closedBottom:!0,closedTop:!0,curvatureResolution:1,cartesian:!0,userDataRsoOffset:0},a),t}var n=r.prototype;return n.create=function(){var t=this.options,o=t.startHeight,c=t.height,h=t.closedBottom,v=t.closedTop,d=t.curvatureResolution,m=t.userDataRsoOffset,g=t.cartesian,b=new bt(this.options.geojson,{startHeight:o,endHeight:o+c,closedBottom:h,closedTop:v,curvatureResolution:d,cartesian:g,userDataRsoOffset:m});this.createMesh(b,this.options.material)},r}(me),Ke=q(705);function Xe(e){var i=e.split,r=e.depth,n=e.points,a=new s.ExtrudeGeometry(new s.Shape(n),{depth:r,bevelEnabled:!1,UVGenerator:(0,Ke.y)({split:i})});return(0,Ke.C)(),a}var wt=function(e){"use strict";P(r,e);var i=B(r);function r(a){C(this,r);var t;return t=i.call(this),t.options=(0,S.Z)({},a),t}var n=r.prototype;return n.create=function(){var t=this,o=this.options,c=o.points,h=o.pointsArr,v=o.coordinatesArr,d=o.material,m=o.useGroups,g=o.depth,b=o.split,y=o.workerController,M=o.projection;if(c)this.createMesh(Xe({points:c,depth:g,split:b}),d);else if(h){var f=Fe.mergeBufferGeometries(h.map(function(j){return Xe({points:j,depth:g,split:b})}),m!=null?m:!1);this.createMesh(f,d)}else if(v&&y)return new Promise(function(j){y.postMessage({coordinatesArr:v,depth:g,split:b,useGroups:m,projection:M},function(k){var Y=new s.BufferGeometry;Object.keys(k).forEach(function(V){Y.setAttribute(V,new s.BufferAttribute(k[V].array,k[V].itemSize))}),t.createMesh(Y,d),j("")})})},r}(me)})(),module.exports=ze})();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import*as et from"idb-keyval";import*as W from"three";import*as Vt from"three/examples/jsm/renderers/CSS2DRenderer";import*as tt from"three/examples/jsm/renderers/CSS3DRenderer";import*as Ut from"popmotion";import*as Nt from"three/examples/jsm//utils/BufferGeometryUtils";import*as Fe from"d3-array";import*as Ft from"earcut";import*as It from"@turf/boolean-clockwise";import*as Zt from"delaunator";import*as Xt from"@turf/boolean-point-in-polygon";import*as Re from"d3-geo";import*as Ht from"d3-geo-voronoi";import*as Kt from"d3-scale";var $t={666:function(L){var j=function(w){"use strict";var P=Object.prototype,M=P.hasOwnProperty,B,O=typeof Symbol=="function"?Symbol:{},T=O.iterator||"@@iterator",Z=O.asyncIterator||"@@asyncIterator",x=O.toStringTag||"@@toStringTag";function k(f,u,p){return Object.defineProperty(f,u,{value:p,enumerable:!0,configurable:!0,writable:!0}),f[u]}try{k({},"")}catch(f){k=function(u,p,S){return u[p]=S}}function Y(f,u,p,S){var g=u&&u.prototype instanceof ie?u:ie,Q=Object.create(g.prototype),K=new Se(S||[]);return Q._invoke=ue(f,p,K),Q}w.wrap=Y;function J(f,u,p){try{return{type:"normal",arg:f.call(u,p)}}catch(S){return{type:"throw",arg:S}}}var R="suspendedStart",s="suspendedYield",oe="executing",re="completed",$={};function ie(){}function G(){}function F(){}var D={};k(D,T,function(){return this});var X=Object.getPrototypeOf,U=X&&X(X(Te([])));U&&U!==P&&M.call(U,T)&&(D=U);var H=F.prototype=ie.prototype=Object.create(D);G.prototype=F,k(H,"constructor",F),k(F,"constructor",G),G.displayName=k(F,x,"GeneratorFunction");function I(f){["next","throw","return"].forEach(function(u){k(f,u,function(p){return this._invoke(u,p)})})}w.isGeneratorFunction=function(f){var u=typeof f=="function"&&f.constructor;return u?u===G||(u.displayName||u.name)==="GeneratorFunction":!1},w.mark=function(f){return Object.setPrototypeOf?Object.setPrototypeOf(f,F):(f.__proto__=F,k(f,x,"GeneratorFunction")),f.prototype=Object.create(H),f},w.awrap=function(f){return{__await:f}};function q(f,u){function p(Q,K,ae,se){var ne=J(f[Q],f,K);if(ne.type==="throw")se(ne.arg);else{var Oe=ne.arg,Ce=Oe.value;return Ce&&typeof Ce=="object"&&M.call(Ce,"__await")?u.resolve(Ce.__await).then(function(xe){p("next",xe,ae,se)},function(xe){p("throw",xe,ae,se)}):u.resolve(Ce).then(function(xe){Oe.value=xe,ae(Oe)},function(xe){return p("throw",xe,ae,se)})}}var S;function g(Q,K){function ae(){return new u(function(se,ne){p(Q,K,se,ne)})}return S=S?S.then(ae,ae):ae()}this._invoke=g}I(q.prototype),k(q.prototype,Z,function(){return this}),w.AsyncIterator=q,w.async=function(f,u,p,S,g){g===void 0&&(g=Promise);var Q=new q(Y(f,u,p,S),g);return w.isGeneratorFunction(u)?Q:Q.next().then(function(K){return K.done?K.value:Q.next()})};function ue(f,u,p){var S=R;return function(Q,K){if(S===oe)throw new Error("Generator is already running");if(S===re){if(Q==="throw")throw K;return Le()}for(p.method=Q,p.arg=K;;){var ae=p.delegate;if(ae){var se=_e(ae,p);if(se){if(se===$)continue;return se}}if(p.method==="next")p.sent=p._sent=p.arg;else if(p.method==="throw"){if(S===R)throw S=re,p.arg;p.dispatchException(p.arg)}else p.method==="return"&&p.abrupt("return",p.arg);S=oe;var ne=J(f,u,p);if(ne.type==="normal"){if(S=p.done?re:s,ne.arg===$)continue;return{value:ne.arg,done:p.done}}else ne.type==="throw"&&(S=re,p.method="throw",p.arg=ne.arg)}}}function _e(f,u){var p=f.iterator[u.method];if(p===B){if(u.delegate=null,u.method==="throw"){if(f.iterator.return&&(u.method="return",u.arg=B,_e(f,u),u.method==="throw"))return $;u.method="throw",u.arg=new TypeError("The iterator does not provide a 'throw' method")}return $}var S=J(p,f.iterator,u.arg);if(S.type==="throw")return u.method="throw",u.arg=S.arg,u.delegate=null,$;var g=S.arg;if(!g)return u.method="throw",u.arg=new TypeError("iterator result is not an object"),u.delegate=null,$;if(g.done)u[f.resultName]=g.value,u.next=f.nextLoc,u.method!=="return"&&(u.method="next",u.arg=B);else return g;return u.delegate=null,$}I(H),k(H,x,"Generator"),k(H,T,function(){return this}),k(H,"toString",function(){return"[object Generator]"});function ee(f){var u={tryLoc:f[0]};1 in f&&(u.catchLoc=f[1]),2 in f&&(u.finallyLoc=f[2],u.afterLoc=f[3]),this.tryEntries.push(u)}function z(f){var u=f.completion||{};u.type="normal",delete u.arg,f.completion=u}function Se(f){this.tryEntries=[{tryLoc:"root"}],f.forEach(ee,this),this.reset(!0)}w.keys=function(f){var u=[];for(var p in f)u.push(p);return u.reverse(),function S(){for(;u.length;){var g=u.pop();if(g in f)return S.value=g,S.done=!1,S}return S.done=!0,S}};function Te(f){if(f){var u=f[T];if(u)return u.call(f);if(typeof f.next=="function")return f;if(!isNaN(f.length)){var p=-1,S=function g(){for(;++p<f.length;)if(M.call(f,p))return g.value=f[p],g.done=!1,g;return g.value=B,g.done=!0,g};return S.next=S}}return{next:Le}}w.values=Te;function Le(){return{value:B,done:!0}}return Se.prototype={constructor:Se,reset:function(f){if(this.prev=0,this.next=0,this.sent=this._sent=B,this.done=!1,this.delegate=null,this.method="next",this.arg=B,this.tryEntries.forEach(z),!f)for(var u in this)u.charAt(0)==="t"&&M.call(this,u)&&!isNaN(+u.slice(1))&&(this[u]=B)},stop:function(){this.done=!0;var f=this.tryEntries[0],u=f.completion;if(u.type==="throw")throw u.arg;return this.rval},dispatchException:function(f){if(this.done)throw f;var u=this;function p(se,ne){return Q.type="throw",Q.arg=f,u.next=se,ne&&(u.method="next",u.arg=B),!!ne}for(var S=this.tryEntries.length-1;S>=0;--S){var g=this.tryEntries[S],Q=g.completion;if(g.tryLoc==="root")return p("end");if(g.tryLoc<=this.prev){var K=M.call(g,"catchLoc"),ae=M.call(g,"finallyLoc");if(K&&ae){if(this.prev<g.catchLoc)return p(g.catchLoc,!0);if(this.prev<g.finallyLoc)return p(g.finallyLoc)}else if(K){if(this.prev<g.catchLoc)return p(g.catchLoc,!0)}else if(ae){if(this.prev<g.finallyLoc)return p(g.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(f,u){for(var p=this.tryEntries.length-1;p>=0;--p){var S=this.tryEntries[p];if(S.tryLoc<=this.prev&&M.call(S,"finallyLoc")&&this.prev<S.finallyLoc){var g=S;break}}g&&(f==="break"||f==="continue")&&g.tryLoc<=u&&u<=g.finallyLoc&&(g=null);var Q=g?g.completion:{};return Q.type=f,Q.arg=u,g?(this.method="next",this.next=g.finallyLoc,$):this.complete(Q)},complete:function(f,u){if(f.type==="throw")throw f.arg;return f.type==="break"||f.type==="continue"?this.next=f.arg:f.type==="return"?(this.rval=this.arg=f.arg,this.method="return",this.next="end"):f.type==="normal"&&u&&(this.next=u),$},finish:function(f){for(var u=this.tryEntries.length-1;u>=0;--u){var p=this.tryEntries[u];if(p.finallyLoc===f)return this.complete(p.completion,p.afterLoc),z(p),$}},catch:function(f){for(var u=this.tryEntries.length-1;u>=0;--u){var p=this.tryEntries[u];if(p.tryLoc===f){var S=p.completion;if(S.type==="throw"){var g=S.arg;z(p)}return g}}throw new Error("illegal catch attempt")},delegateYield:function(f,u,p){return this.delegate={iterator:Te(f),resultName:u,nextLoc:p},this.method==="next"&&(this.arg=B),$}},w}(L.exports);try{regeneratorRuntime=j}catch(w){typeof globalThis=="object"?globalThis.regeneratorRuntime=j:Function("r","regeneratorRuntime = r")(j)}},695:function(L,j,w){w.d(j,{Z:function(){return P}});function P(M){if(M.geometry&&M.geometry.dispose(),M.material){var B=Array.isArray(M.material)?M.material:[M.material];B.forEach(function(O){var T,Z,x,k,Y,J,R,s,oe,re,$,ie,G;(T=O.map)===null||T===void 0||T.dispose(),(Z=O.lightMap)===null||Z===void 0||Z.dispose(),(x=O.bumpMap)===null||x===void 0||x.dispose(),(k=O.normalMap)===null||k===void 0||k.dispose(),(Y=O.specularMap)===null||Y===void 0||Y.dispose(),(J=O.envMap)===null||J===void 0||J.dispose(),(R=O.alphaMap)===null||R===void 0||R.dispose(),(s=O.aoMap)===null||s===void 0||s.dispose(),(oe=O.displacementMap)===null||oe===void 0||oe.dispose(),(re=O.emissiveMap)===null||re===void 0||re.dispose(),($=O.gradientMap)===null||$===void 0||$.dispose(),(ie=O.metalnessMap)===null||ie===void 0||ie.dispose(),(G=O.roughnessMap)===null||G===void 0||G.dispose(),O.dispose()})}}},521:function(L,j,w){w.d(j,{wf:function(){return O.Z}});var P=w(666),M=w.n(P),B=null,O=w(695),T=w(949);function Z(G){if(G.material){var F=Array.isArray(G.material)?G.material:[G.material];F.forEach(function(D){var X,U;(X=D.color)===null||X===void 0||X.convertSRGBToLinear(),(U=D.emissive)===null||U===void 0||U.convertSRGBToLinear(),D.map&&(D.map.encoding=THREE.sRGBEncoding),D.emissiveMap&&(D.emissiveMap.encoding=THREE.sRGBEncoding)})}}var x=w(568),k=w(924),Y=G=>{var F={};return w.d(F,G),F},J=G=>()=>G,R=Y({get:()=>et.get,set:()=>et.set}),s=w(484),oe=null,re=null,$=function(){var G=(0,x.Z)(M().mark(function F(D,X){var U,H,I,q,ue,_e;return M().wrap(function(z){for(;;)switch(z.prev=z.next){case 0:return U=X.version,z.next=4,(0,R.get)(D);case 4:if(I=z.sent,!(I&&I[U])){z.next=9;break}H=I[U],z.next=15;break;case 9:return z.next=11,(0,s.Z)(fetch(D).then(function(Se){if(Se.ok)return Se.blob();throw new Error}));case 11:q=z.sent,ue=q.res,_e=q.err,_e||(H=ue,(0,R.set)(D,(0,k.Z)({},U,ue)));case 15:return z.abrupt("return",H?{url:URL.createObjectURL(H)}:{url:D});case 16:case"end":return z.stop()}},F)}));return function(D,X){return G.apply(this,arguments)}}(),ie=w(705)},484:function(L,j,w){w.d(j,{Z:function(){return M}});var P=w(42);function M(B){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return B.then(function(T){return(0,P.Z)({err:null,res:T},O)}).catch(function(T){return(0,P.Z)({err:T,res:void 0},O)})}},705:function(L,j,w){w.d(j,{C:function(){return O},y:function(){return B}});var P=w(949),M=new Map,B=function(){var T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{generateTopUV:function(Z,x,k,Y,J){var R=x[k*3],s=x[k*3+1],oe=x[Y*3],re=x[Y*3+1],$=x[J*3],ie=x[J*3+1],G;if(M.has(Z))G=M.get(Z);else{var F=T.box3||new P.Box3;if(!T.box3){var D=Z.parameters.shapes.getPoints();F.setFromArray(D.map(function(q){return[q.x,q.y,0]}).flat())}var X=F.getSize(new P.Vector3);T.split&&(X.y/=T.split),G={box:F,size:X},M.set(Z,G)}var U=G.box,H=G.size,I=T.split?1-T.split:0;return[new P.Vector2((R-U.min.x)/H.x,(s-U.min.y)/H.y+I),new P.Vector2((oe-U.min.x)/H.x,(re-U.min.y)/H.y+I),new P.Vector2(($-U.min.x)/H.x,(ie-U.min.y)/H.y+I)]},generateSideWallUV:function(Z,x,k,Y,J,R){var s=x[k*3],oe=x[k*3+1],re=x[k*3+2],$=x[Y*3],ie=x[Y*3+1],G=x[Y*3+2],F=x[J*3],D=x[J*3+1],X=x[J*3+2],U=x[R*3],H=x[R*3+1],I=x[R*3+2],q;if(M.has(x))q=M.get(x);else{var ue=new P.Box3;ue.setFromArray(x);var _e=ue.getSize(new P.Vector3);T.split&&(_e.z/=1-T.split),q={box:ue,size:_e},M.set(x,q)}var ee=q.box,z=q.size;return Math.abs(oe-ie)<Math.abs(s-$)?[new P.Vector2((s-ee.min.x)/z.x,(re-ee.min.z)/z.z),new P.Vector2(($-ee.min.x)/z.x,(G-ee.min.z)/z.z),new P.Vector2((F-ee.min.x)/z.x,(X-ee.min.z)/z.z),new P.Vector2((U-ee.min.x)/z.x,(I-ee.min.z)/z.z)]:[new P.Vector2((oe-ee.min.y)/z.x,(re-ee.min.z)/z.z),new P.Vector2((ie-ee.min.y)/z.x,(G-ee.min.z)/z.z),new P.Vector2((D-ee.min.y)/z.x,(X-ee.min.z)/z.z),new P.Vector2((H-ee.min.y)/z.x,(I-ee.min.z)/z.z)]}}},O=function(){M.clear()}},949:function(L,j,w){var P=B=>{var O={};return w.d(O,B),O},M=B=>()=>B;L.exports=P({Box3:()=>W.Box3,BufferAttribute:()=>W.BufferAttribute,BufferGeometry:()=>W.BufferGeometry,CanvasTexture:()=>W.CanvasTexture,Color:()=>W.Color,DoubleSide:()=>W.DoubleSide,ExtrudeGeometry:()=>W.ExtrudeGeometry,Float32BufferAttribute:()=>W.Float32BufferAttribute,Group:()=>W.Group,LineSegments:()=>W.LineSegments,Matrix4:()=>W.Matrix4,Mesh:()=>W.Mesh,MeshBasicMaterial:()=>W.MeshBasicMaterial,NormalBlending:()=>W.NormalBlending,PlaneBufferGeometry:()=>W.PlaneBufferGeometry,PlaneGeometry:()=>W.PlaneGeometry,Points:()=>W.Points,RGBAFormat:()=>W.RGBAFormat,Ray:()=>W.Ray,ShaderChunk:()=>W.ShaderChunk,ShaderMaterial:()=>W.ShaderMaterial,Shape:()=>W.Shape,Sphere:()=>W.Sphere,Sprite:()=>W.Sprite,SpriteMaterial:()=>W.SpriteMaterial,Texture:()=>W.Texture,TextureLoader:()=>W.TextureLoader,UniformsLib:()=>W.UniformsLib,Vector2:()=>W.Vector2,Vector3:()=>W.Vector3,VideoTexture:()=>W.VideoTexture})},568:function(L,j,w){w.d(j,{Z:function(){return M}});function P(B,O,T,Z,x,k,Y){try{var J=B[k](Y),R=J.value}catch(s){T(s);return}J.done?O(R):Promise.resolve(R).then(Z,x)}function M(B){return function(){var O=this,T=arguments;return new Promise(function(Z,x){var k=B.apply(O,T);function Y(R){P(k,Z,x,Y,J,"next",R)}function J(R){P(k,Z,x,Y,J,"throw",R)}Y(void 0)})}}},924:function(L,j,w){w.d(j,{Z:function(){return P}});function P(M,B,O){return B in M?Object.defineProperty(M,B,{value:O,enumerable:!0,configurable:!0,writable:!0}):M[B]=O,M}},42:function(L,j,w){w.d(j,{Z:function(){return M}});var P=w(924);function M(B){for(var O=1;O<arguments.length;O++){var T=arguments[O]!=null?arguments[O]:{},Z=Object.keys(T);typeof Object.getOwnPropertySymbols=="function"&&(Z=Z.concat(Object.getOwnPropertySymbols(T).filter(function(x){return Object.getOwnPropertyDescriptor(T,x).enumerable}))),Z.forEach(function(x){(0,P.Z)(B,x,T[x])})}return B}}},rt={};function N(L){var j=rt[L];if(j!==void 0)return j.exports;var w=rt[L]={exports:{}};return $t[L](w,w.exports,N),w.exports}(function(){N.n=function(L){var j=L&&L.__esModule?function(){return L.default}:function(){return L};return N.d(j,{a:j}),j}})(),function(){N.d=function(L,j){for(var w in j)N.o(j,w)&&!N.o(L,w)&&Object.defineProperty(L,w,{enumerable:!0,get:j[w]})}}(),function(){N.o=function(L,j){return Object.prototype.hasOwnProperty.call(L,j)}}();var me={};(function(){N.d(me,{Ei:function(){return Tt},Yo:function(){return Rt},Ee:function(){return ae},x1:function(){return ht},VJ:function(){return ge},r7:function(){return Ge},XA:function(){return Ie},NB:function(){return nt},xv:function(){return S},nk:function(){return Ce}});function L(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function j(e,n){return j=Object.setPrototypeOf||function(i,a){return i.__proto__=a,i},j(e,n)}function w(e,n){return j(e,n)}function P(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),n&&w(e,n)}var M=N(42);function B(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,i)}return r}function O(e,n){return n=n!=null?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):B(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}),e}function T(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function Z(e){return Z=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Z(e)}function x(e){return Z(e)}function k(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Y(e){return e&&e.constructor===Symbol?"symbol":typeof e}function J(e,n){return n&&(Y(n)==="object"||typeof n=="function")?n:k(e)}function R(e){var n=T();return function(){var i=x(e),a;if(n){var t=x(this).constructor;a=Reflect.construct(i,arguments,t)}else a=i.apply(this,arguments);return J(this,a)}}var s=N(949);function oe(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function re(e,n,r){return oe()?re=Reflect.construct:re=function(a,t,o){var c=[null];c.push.apply(c,t);var h=Function.bind.apply(a,c),v=new h;return o&&w(v,o.prototype),v},re.apply(null,arguments)}function $(e,n,r){return re.apply(null,arguments)}function ie(e,n){for(var r=0;r<n.length;r++){var i=n[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function G(e,n,r){return n&&ie(e.prototype,n),r&&ie(e,r),e}function F(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=new Array(n);r<n;r++)i[r]=e[r];return i}function D(e){if(Array.isArray(e))return F(e)}function X(e){if(typeof Symbol!="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function U(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function H(e,n){if(!!e){if(typeof e=="string")return F(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return F(e,n)}}function I(e){return D(e)||X(e)||H(e)||U()}var q=N(484);function ue(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r={};return r.promise=new Promise(function(i,a){r.resolve=i,r.reject=a}),e&&(r.promise=(0,q.Z)(r.promise,n)),r}var _e=e=>{var n={};return N.d(n,e),n},ee=e=>()=>e,z=_e({CSS2DObject:()=>Vt.CSS2DObject}),Se=e=>{var n={};return N.d(n,e),n},Te=e=>()=>e,Le=Se({CSS3DObject:()=>tt.CSS3DObject,CSS3DSprite:()=>tt.CSS3DSprite}),f=N(521),u=function(e){e&&((0,f.wf)(e),e.children.forEach(function(n){n.userData.BaseObject_||u(n)}))},p=function(){"use strict";function e(){L(this,e),this.objecttype__="BaseObject",this.userData={},this.pm=ue(),this.visible=!1}var n=e.prototype;return n.init=function(){},n.create=function(){},n.render=function(){},n.update=function(i,a){},n.resize=function(i,a){},n.show=function(){return this.object3d&&(this.object3d.visible=!0),this.visible=!0,this},n.hide=function(){return this.object3d&&(this.object3d.visible=!1),this.visible=!1,this},n.isVisible=function(){return this.visible},n.createMesh=function(){for(var i=arguments.length,a=new Array(i),t=0;t<i;t++)a[t]=arguments[t];return this.object3d=$(s.Mesh,I(a)),this},n.createGroup=function(){return this.object3d=new s.Group,this},n.createPoints=function(){for(var i=arguments.length,a=new Array(i),t=0;t<i;t++)a[t]=arguments[t];return this.object3d=$(s.Points,I(a)),this},n.createCSS2DObject=function(i){return this.object3d=new z.CSS2DObject(i),this},n.createCSS3DObject=function(i){return this.object3d=new Le.CSS3DObject(i),this},n.createCSS3DSprite=function(i){return this.object3d=new Le.CSS3DSprite(i),this},n.createSprite=function(i){return this.object3d=new s.Sprite(i),this},n.add=function(){for(var i=arguments.length,a=new Array(i),t=0;t<i;t++)a[t]=arguments[t];var o;return(o=this.object3d).add.apply(o,I(a)),this},n.remove=function(){for(var i=arguments.length,a=new Array(i),t=0;t<i;t++)a[t]=arguments[t];var o;return(o=this.object3d).remove.apply(o,I(a)),this},n.getSize=function(){var i=new s.Box3().setFromObject(this.object3d);return{min:i.min,max:i.max,size:i.getSize(new s.Vector3)}},n.traverse=function(i){i(this),this.children.forEach(function(a){a.traverse(i)})},n.dispose=function(){u(this.object3d)},G(e,[{key:"parent",get:function(){var i=this.object3d.parent;return(i==null?void 0:i.userData.BaseObject_)||this.pencil.scene}},{key:"children",get:function(){return this.object3d.children.map(function(i){return i.userData.BaseObject_}).filter(function(i){return!!i})}}]),e}(),S=function(e){"use strict";P(r,e);var n=R(r);function r(a){L(this,r);var t;return t=n.call(this),t.width=0,t.canvas=document.createElement("canvas"),t.options=(0,M.Z)({},{scale:.5,fontSize:28,fontFamily:"system-ui,-apple-system,BlinkMacSystemFont,sans-serif",fontWeight:"normal",flipX:!1,sprite:!1,sizeAttenuation:!0},a),t}var i=r.prototype;return i.create=function(){var t=this.options,o=t.position,c=t.lookAt,h=t.sprite,v=t.text,d=t.sizeAttenuation;if(h){var m=new s.Sprite(new s.SpriteMaterial({transparent:!0,sizeAttenuation:d}));this.object3d=m}else{var _=new s.MeshBasicMaterial({side:s.DoubleSide,transparent:!0}),b=new s.PlaneGeometry(1,1,1,1);this.createMesh(b,_)}this.object3d.position.copy(o),c&&this.object3d.lookAt(c),this.setText(v)},i.setText=function(t,o){var c=(0,M.Z)(O((0,M.Z)({},this.options),{text:t}),o||{}),h=c.text,v=c.fontSize,d=c.fontFamily,m=c.fontWeight,_=c.flipX,b=c.scale,y=this.canvas;y.width=v*h.length*2,y.height=v;var A=y.getContext("2d");A.font="".concat(m," ").concat(v,"px/1 ").concat(d);var l=A.measureText(h).width;y.width=l,this.width=l,A=y.getContext("2d"),A.clearRect(0,0,y.width,y.height),_&&A.scale(-1,1),A.font="".concat(m," ").concat(v,"px/1 ").concat(d),A.textBaseline="middle",A.fillStyle="#ffffff",A.fillText(h,_?l*-1:0,y.height/2),A.restore();var C=new s.Texture(y);C.anisotropy=16,C.needsUpdate=!0;var E=this.object3d;E.material.map&&E.material.map.dispose(),E.material.map=C,E.material.needsUpdate=!0,E.scale.set(C.image.width*b,C.image.height*b,1)},r}(p),g=N(568),Q=N(666),K=N.n(Q),ae=function(e){"use strict";P(r,e);var n=R(r);function r(a){L(this,r);var t;return t=n.call(this),t.options=a,t}var i=r.prototype;return i.getMaterial=function(){var t=this;return(0,g.Z)(K().mark(function o(){var c,h,v,d,m,_,b,y,A,l;return K().wrap(function(E){for(;;)switch(E.prev=E.next){case 0:return c=t.options,h=c.transparent,v=c.blending,d=c.src,m=c.depthWrite,_=c.alphaTest,b=c.sprite,y=c.sizeAttenuation,E.next=3,new s.TextureLoader().loadAsync(d);case 3:return A=E.sent,l=b?new s.SpriteMaterial({map:A,transparent:h!=null?h:!1,blending:v!=null?v:s.NormalBlending,depthWrite:m!=null?m:!0,alphaTest:_!=null?_:0,sizeAttenuation:y!=null?y:!0}):new s.MeshBasicMaterial({map:A,transparent:h!=null?h:!1,blending:v!=null?v:s.NormalBlending,depthWrite:m!=null?m:!0,alphaTest:_!=null?_:0}),E.abrupt("return",l);case 6:case"end":return E.stop()}},o)}))()},i.create=function(){var t=this;return(0,g.Z)(K().mark(function o(){var c,h,v,d,m,_,b,y;return K().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if(c=t.options,h=c.scale,v=c.position,d=c.src,m=c.cache,_=c.sprite,!(m&&!m.get(d))){l.next=7;break}return m.init(d),l.next=5,t.getMaterial();case 5:b=l.sent,m.set(d,b);case 7:if(!m){l.next=13;break}return l.next=10,m.get(d);case 10:l.t0=l.sent,l.next=16;break;case 13:return l.next=15,t.getMaterial();case 15:l.t0=l.sent;case 16:y=l.t0,t.texture=y.map,_?t.createSprite(y):t.createMesh(new s.PlaneBufferGeometry(1,1),y),h&&t.setScale(h),v&&t.object3d.position.copy(v);case 21:case"end":return l.stop()}},o)}))()},i.setScale=function(t){this.object3d.scale.set(this.texture.image.width*t,this.texture.image.height*t,1)},r}(p);function se(e,n){for(;!Object.prototype.hasOwnProperty.call(e,n)&&(e=x(e),e!==null););return e}function ne(e,n,r){return typeof Reflect!="undefined"&&Reflect.get?ne=Reflect.get:ne=function(a,t,o){var c=se(a,t);if(!!c){var h=Object.getOwnPropertyDescriptor(c,t);return h.get?h.get.call(o||a):h.value}},ne(e,n,r)}function Oe(e,n,r){return ne(e,n,r)}var Ce=function(e){"use strict";P(r,e);var n=R(r);function r(a){L(this,r);var t;return t=n.call(this),t.options=(0,M.Z)({},{autoPlay:!0,loop:!0},a),t}var i=r.prototype;return i.getMaterial=function(){var t=this.options,o=t.src,c=t.transparent,h=t.blending,v=t.depthWrite,d=t.format,m=t.autoPlay,_=t.loop,b=t.alphaTest,y=t.sprite,A=ue(),l=document.createElement("video");return l.addEventListener("loadedmetadata",function(){var C=new s.VideoTexture(l);C.format=d!=null?d:s.RGBAFormat,C.needsUpdate=!0;var E=y?new s.SpriteMaterial({map:C,transparent:c!=null?c:!1,blending:h!=null?h:s.NormalBlending,depthWrite:v!=null?v:!0,alphaTest:b!=null?b:0}):new s.MeshBasicMaterial({map:C,transparent:c!=null?c:!1,blending:h!=null?h:s.NormalBlending,depthWrite:v!=null?v:!0,alphaTest:b!=null?b:0});A.resolve(E)},!1),l.src=o,l.muted=!0,l.autoplay=m,l.loop=_,l.preload="auto",A.promise},i.create=function(){var t=this;return(0,g.Z)(K().mark(function o(){var c,h,v,d,m,_,b,y;return K().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if(c=t.options,h=c.scale,v=c.position,d=c.src,m=c.cache,_=c.sprite,!(m&&!m.get(d))){l.next=7;break}return m.init(d),l.next=5,t.getMaterial();case 5:b=l.sent,m.set(d,b);case 7:if(!m){l.next=13;break}return l.next=10,m.get(d);case 10:l.t0=l.sent,l.next=16;break;case 13:return l.next=15,t.getMaterial();case 15:l.t0=l.sent;case 16:y=l.t0,t.video=y.map.image,_?t.createSprite(y):t.createMesh(new s.PlaneBufferGeometry(1,1),y),h&&t.setScale(h),v&&t.object3d.position.copy(v);case 21:case"end":return l.stop()}},o)}))()},i.setScale=function(t){this.object3d.scale.set(this.video.videoWidth*t,this.video.videoHeight*t,1)},i.render=function(){var t=this.options.autoPlay;t&&this.video.play()},i.dispose=function(){this.video.pause(),this.video.src="",this.video.load(),Oe(x(r.prototype),"dispose",this).call(this)},r}(p),xe=function(e){"use strict";P(r,e);var n=R(r);function r(a){L(this,r);var t;return t=n.call(this),t.options=(0,M.Z)({},a),t}var i=r.prototype;return i.create=function(){var t=this.options,o=t.position,c=t.children,h=t.onClick,v=t.zIndexFix,d=document.createElement("div");this.element=d,d.appendChild(c),this.createCSS2DObject(d),o&&this.object3d.position.copy(o),h&&this.clickTarge.forEach(function(m){m.addEventListener("click",h)}),v&&(this.object3d.userData.zIndexFix=v)},i.getMaterial=function(t){return(0,g.Z)(K().mark(function o(){var c,h,v,d;return K().wrap(function(_){for(;;)switch(_.prev=_.next){case 0:return c=document.createElement("canvas"),c.width=256,c.height=256,h=c.getContext("2d"),h.fillStyle="#ff0000",h.fillRect(0,0,256,256),v=new s.CanvasTexture(c),d=new s.SpriteMaterial({map:v,opacity:t?1:0,transparent:!0,alphaTest:.1,sizeAttenuation:!1}),_.abrupt("return",d);case 9:case"end":return _.stop()}},o)}))()},i.createPickObject=function(t){var o=t.show,c=o===void 0?!1:o,h=t.scale,v=h===void 0?new s.Vector3(1,1,1):h,d=t.position,m=d===void 0?new s.Vector3(0,0,0):d,_=t.cache,b=this;return(0,g.Z)(K().mark(function y(){var A,l,C,E;return K().wrap(function(V){for(;;)switch(V.prev=V.next){case 0:if(A="node-create-pick-object",!(_&&!_.get(A))){V.next=7;break}return _.init(A),V.next=5,b.getMaterial(c);case 5:l=V.sent,_.set(A,l);case 7:if(!_){V.next=13;break}return V.next=10,_.get(A);case 10:V.t0=V.sent,V.next=16;break;case 13:return V.next=15,b.getMaterial(c);case 15:V.t0=V.sent;case 16:C=V.t0,E=new s.Sprite(C),E.scale.set(C.map.image.width*v.x,C.map.image.height*v.y,1),E.position.copy(m),b.add(E),b.pickObject=E;case 22:case"end":return V.stop()}},y)}))()},i.dispose=function(){var t=this.options.onClick;t&&this.clickTarge.forEach(function(o){o.removeEventListener("click",t)}),Oe(x(r.prototype),"dispose",this).call(this)},G(r,[{key:"clickTarge",get:function(){var t=this,o=this.options.clickTarge;if(o){var c=o.map(function(h){return I(t.element.querySelectorAll(h))}).flat();return c}return[this.element]}}]),r}(p),nt=xe,it=`
|
|
1
|
+
import*as tt from"idb-keyval";import*as W from"three";import*as Ut from"three/examples/jsm/renderers/CSS2DRenderer";import*as rt from"three/examples/jsm/renderers/CSS3DRenderer";import*as nt from"popmotion";import*as Nt from"three/examples/jsm//utils/BufferGeometryUtils";import*as Fe from"d3-array";import*as Ft from"earcut";import*as It from"@turf/boolean-clockwise";import*as Zt from"delaunator";import*as Xt from"@turf/boolean-point-in-polygon";import*as Re from"d3-geo";import*as Ht from"d3-geo-voronoi";import*as Kt from"d3-scale";var $t={666:function(L){var j=function(w){"use strict";var P=Object.prototype,M=P.hasOwnProperty,B,O=typeof Symbol=="function"?Symbol:{},T=O.iterator||"@@iterator",Z=O.asyncIterator||"@@asyncIterator",x=O.toStringTag||"@@toStringTag";function k(f,u,p){return Object.defineProperty(f,u,{value:p,enumerable:!0,configurable:!0,writable:!0}),f[u]}try{k({},"")}catch(f){k=function(u,p,S){return u[p]=S}}function Y(f,u,p,S){var g=u&&u.prototype instanceof ie?u:ie,Q=Object.create(g.prototype),K=new Se(S||[]);return Q._invoke=ue(f,p,K),Q}w.wrap=Y;function J(f,u,p){try{return{type:"normal",arg:f.call(u,p)}}catch(S){return{type:"throw",arg:S}}}var R="suspendedStart",s="suspendedYield",oe="executing",re="completed",$={};function ie(){}function G(){}function F(){}var D={};k(D,T,function(){return this});var X=Object.getPrototypeOf,U=X&&X(X(Te([])));U&&U!==P&&M.call(U,T)&&(D=U);var H=F.prototype=ie.prototype=Object.create(D);G.prototype=F,k(H,"constructor",F),k(F,"constructor",G),G.displayName=k(F,x,"GeneratorFunction");function I(f){["next","throw","return"].forEach(function(u){k(f,u,function(p){return this._invoke(u,p)})})}w.isGeneratorFunction=function(f){var u=typeof f=="function"&&f.constructor;return u?u===G||(u.displayName||u.name)==="GeneratorFunction":!1},w.mark=function(f){return Object.setPrototypeOf?Object.setPrototypeOf(f,F):(f.__proto__=F,k(f,x,"GeneratorFunction")),f.prototype=Object.create(H),f},w.awrap=function(f){return{__await:f}};function q(f,u){function p(Q,K,ae,se){var ne=J(f[Q],f,K);if(ne.type==="throw")se(ne.arg);else{var Oe=ne.arg,Ce=Oe.value;return Ce&&typeof Ce=="object"&&M.call(Ce,"__await")?u.resolve(Ce.__await).then(function(xe){p("next",xe,ae,se)},function(xe){p("throw",xe,ae,se)}):u.resolve(Ce).then(function(xe){Oe.value=xe,ae(Oe)},function(xe){return p("throw",xe,ae,se)})}}var S;function g(Q,K){function ae(){return new u(function(se,ne){p(Q,K,se,ne)})}return S=S?S.then(ae,ae):ae()}this._invoke=g}I(q.prototype),k(q.prototype,Z,function(){return this}),w.AsyncIterator=q,w.async=function(f,u,p,S,g){g===void 0&&(g=Promise);var Q=new q(Y(f,u,p,S),g);return w.isGeneratorFunction(u)?Q:Q.next().then(function(K){return K.done?K.value:Q.next()})};function ue(f,u,p){var S=R;return function(Q,K){if(S===oe)throw new Error("Generator is already running");if(S===re){if(Q==="throw")throw K;return Le()}for(p.method=Q,p.arg=K;;){var ae=p.delegate;if(ae){var se=_e(ae,p);if(se){if(se===$)continue;return se}}if(p.method==="next")p.sent=p._sent=p.arg;else if(p.method==="throw"){if(S===R)throw S=re,p.arg;p.dispatchException(p.arg)}else p.method==="return"&&p.abrupt("return",p.arg);S=oe;var ne=J(f,u,p);if(ne.type==="normal"){if(S=p.done?re:s,ne.arg===$)continue;return{value:ne.arg,done:p.done}}else ne.type==="throw"&&(S=re,p.method="throw",p.arg=ne.arg)}}}function _e(f,u){var p=f.iterator[u.method];if(p===B){if(u.delegate=null,u.method==="throw"){if(f.iterator.return&&(u.method="return",u.arg=B,_e(f,u),u.method==="throw"))return $;u.method="throw",u.arg=new TypeError("The iterator does not provide a 'throw' method")}return $}var S=J(p,f.iterator,u.arg);if(S.type==="throw")return u.method="throw",u.arg=S.arg,u.delegate=null,$;var g=S.arg;if(!g)return u.method="throw",u.arg=new TypeError("iterator result is not an object"),u.delegate=null,$;if(g.done)u[f.resultName]=g.value,u.next=f.nextLoc,u.method!=="return"&&(u.method="next",u.arg=B);else return g;return u.delegate=null,$}I(H),k(H,x,"Generator"),k(H,T,function(){return this}),k(H,"toString",function(){return"[object Generator]"});function ee(f){var u={tryLoc:f[0]};1 in f&&(u.catchLoc=f[1]),2 in f&&(u.finallyLoc=f[2],u.afterLoc=f[3]),this.tryEntries.push(u)}function z(f){var u=f.completion||{};u.type="normal",delete u.arg,f.completion=u}function Se(f){this.tryEntries=[{tryLoc:"root"}],f.forEach(ee,this),this.reset(!0)}w.keys=function(f){var u=[];for(var p in f)u.push(p);return u.reverse(),function S(){for(;u.length;){var g=u.pop();if(g in f)return S.value=g,S.done=!1,S}return S.done=!0,S}};function Te(f){if(f){var u=f[T];if(u)return u.call(f);if(typeof f.next=="function")return f;if(!isNaN(f.length)){var p=-1,S=function g(){for(;++p<f.length;)if(M.call(f,p))return g.value=f[p],g.done=!1,g;return g.value=B,g.done=!0,g};return S.next=S}}return{next:Le}}w.values=Te;function Le(){return{value:B,done:!0}}return Se.prototype={constructor:Se,reset:function(f){if(this.prev=0,this.next=0,this.sent=this._sent=B,this.done=!1,this.delegate=null,this.method="next",this.arg=B,this.tryEntries.forEach(z),!f)for(var u in this)u.charAt(0)==="t"&&M.call(this,u)&&!isNaN(+u.slice(1))&&(this[u]=B)},stop:function(){this.done=!0;var f=this.tryEntries[0],u=f.completion;if(u.type==="throw")throw u.arg;return this.rval},dispatchException:function(f){if(this.done)throw f;var u=this;function p(se,ne){return Q.type="throw",Q.arg=f,u.next=se,ne&&(u.method="next",u.arg=B),!!ne}for(var S=this.tryEntries.length-1;S>=0;--S){var g=this.tryEntries[S],Q=g.completion;if(g.tryLoc==="root")return p("end");if(g.tryLoc<=this.prev){var K=M.call(g,"catchLoc"),ae=M.call(g,"finallyLoc");if(K&&ae){if(this.prev<g.catchLoc)return p(g.catchLoc,!0);if(this.prev<g.finallyLoc)return p(g.finallyLoc)}else if(K){if(this.prev<g.catchLoc)return p(g.catchLoc,!0)}else if(ae){if(this.prev<g.finallyLoc)return p(g.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(f,u){for(var p=this.tryEntries.length-1;p>=0;--p){var S=this.tryEntries[p];if(S.tryLoc<=this.prev&&M.call(S,"finallyLoc")&&this.prev<S.finallyLoc){var g=S;break}}g&&(f==="break"||f==="continue")&&g.tryLoc<=u&&u<=g.finallyLoc&&(g=null);var Q=g?g.completion:{};return Q.type=f,Q.arg=u,g?(this.method="next",this.next=g.finallyLoc,$):this.complete(Q)},complete:function(f,u){if(f.type==="throw")throw f.arg;return f.type==="break"||f.type==="continue"?this.next=f.arg:f.type==="return"?(this.rval=this.arg=f.arg,this.method="return",this.next="end"):f.type==="normal"&&u&&(this.next=u),$},finish:function(f){for(var u=this.tryEntries.length-1;u>=0;--u){var p=this.tryEntries[u];if(p.finallyLoc===f)return this.complete(p.completion,p.afterLoc),z(p),$}},catch:function(f){for(var u=this.tryEntries.length-1;u>=0;--u){var p=this.tryEntries[u];if(p.tryLoc===f){var S=p.completion;if(S.type==="throw"){var g=S.arg;z(p)}return g}}throw new Error("illegal catch attempt")},delegateYield:function(f,u,p){return this.delegate={iterator:Te(f),resultName:u,nextLoc:p},this.method==="next"&&(this.arg=B),$}},w}(L.exports);try{regeneratorRuntime=j}catch(w){typeof globalThis=="object"?globalThis.regeneratorRuntime=j:Function("r","regeneratorRuntime = r")(j)}},695:function(L,j,w){w.d(j,{Z:function(){return P}});function P(M){if(M.geometry&&M.geometry.dispose(),M.material){var B=Array.isArray(M.material)?M.material:[M.material];B.forEach(function(O){var T,Z,x,k,Y,J,R,s,oe,re,$,ie,G;(T=O.map)===null||T===void 0||T.dispose(),(Z=O.lightMap)===null||Z===void 0||Z.dispose(),(x=O.bumpMap)===null||x===void 0||x.dispose(),(k=O.normalMap)===null||k===void 0||k.dispose(),(Y=O.specularMap)===null||Y===void 0||Y.dispose(),(J=O.envMap)===null||J===void 0||J.dispose(),(R=O.alphaMap)===null||R===void 0||R.dispose(),(s=O.aoMap)===null||s===void 0||s.dispose(),(oe=O.displacementMap)===null||oe===void 0||oe.dispose(),(re=O.emissiveMap)===null||re===void 0||re.dispose(),($=O.gradientMap)===null||$===void 0||$.dispose(),(ie=O.metalnessMap)===null||ie===void 0||ie.dispose(),(G=O.roughnessMap)===null||G===void 0||G.dispose(),O.dispose()})}}},521:function(L,j,w){w.d(j,{wf:function(){return O.Z}});var P=w(666),M=w.n(P),B=null,O=w(695),T=w(949);function Z(G){if(G.material){var F=Array.isArray(G.material)?G.material:[G.material];F.forEach(function(D){var X,U;(X=D.color)===null||X===void 0||X.convertSRGBToLinear(),(U=D.emissive)===null||U===void 0||U.convertSRGBToLinear(),D.map&&(D.map.encoding=THREE.sRGBEncoding),D.emissiveMap&&(D.emissiveMap.encoding=THREE.sRGBEncoding)})}}var x=w(568),k=w(924),Y=G=>{var F={};return w.d(F,G),F},J=G=>()=>G,R=Y({get:()=>tt.get,set:()=>tt.set}),s=w(484),oe=null,re=null,$=function(){var G=(0,x.Z)(M().mark(function F(D,X){var U,H,I,q,ue,_e;return M().wrap(function(z){for(;;)switch(z.prev=z.next){case 0:return U=X.version,z.next=4,(0,R.get)(D);case 4:if(I=z.sent,!(I&&I[U])){z.next=9;break}H=I[U],z.next=15;break;case 9:return z.next=11,(0,s.Z)(fetch(D).then(function(Se){if(Se.ok)return Se.blob();throw new Error}));case 11:q=z.sent,ue=q.res,_e=q.err,_e||(H=ue,(0,R.set)(D,(0,k.Z)({},U,ue)));case 15:return z.abrupt("return",H?{url:URL.createObjectURL(H)}:{url:D});case 16:case"end":return z.stop()}},F)}));return function(D,X){return G.apply(this,arguments)}}(),ie=w(705)},484:function(L,j,w){w.d(j,{Z:function(){return M}});var P=w(42);function M(B){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return B.then(function(T){return(0,P.Z)({err:null,res:T},O)}).catch(function(T){return(0,P.Z)({err:T,res:void 0},O)})}},705:function(L,j,w){w.d(j,{C:function(){return O},y:function(){return B}});var P=w(949),M=new Map,B=function(){var T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{generateTopUV:function(Z,x,k,Y,J){var R=x[k*3],s=x[k*3+1],oe=x[Y*3],re=x[Y*3+1],$=x[J*3],ie=x[J*3+1],G;if(M.has(Z))G=M.get(Z);else{var F=T.box3||new P.Box3;if(!T.box3){var D=Z.parameters.shapes.getPoints();F.setFromArray(D.map(function(q){return[q.x,q.y,0]}).flat())}var X=F.getSize(new P.Vector3);T.split&&(X.y/=T.split),G={box:F,size:X},M.set(Z,G)}var U=G.box,H=G.size,I=T.split?1-T.split:0;return[new P.Vector2((R-U.min.x)/H.x,(s-U.min.y)/H.y+I),new P.Vector2((oe-U.min.x)/H.x,(re-U.min.y)/H.y+I),new P.Vector2(($-U.min.x)/H.x,(ie-U.min.y)/H.y+I)]},generateSideWallUV:function(Z,x,k,Y,J,R){var s=x[k*3],oe=x[k*3+1],re=x[k*3+2],$=x[Y*3],ie=x[Y*3+1],G=x[Y*3+2],F=x[J*3],D=x[J*3+1],X=x[J*3+2],U=x[R*3],H=x[R*3+1],I=x[R*3+2],q;if(M.has(x))q=M.get(x);else{var ue=new P.Box3;ue.setFromArray(x);var _e=ue.getSize(new P.Vector3);T.split&&(_e.z/=1-T.split),q={box:ue,size:_e},M.set(x,q)}var ee=q.box,z=q.size;return Math.abs(oe-ie)<Math.abs(s-$)?[new P.Vector2((s-ee.min.x)/z.x,(re-ee.min.z)/z.z),new P.Vector2(($-ee.min.x)/z.x,(G-ee.min.z)/z.z),new P.Vector2((F-ee.min.x)/z.x,(X-ee.min.z)/z.z),new P.Vector2((U-ee.min.x)/z.x,(I-ee.min.z)/z.z)]:[new P.Vector2((oe-ee.min.y)/z.x,(re-ee.min.z)/z.z),new P.Vector2((ie-ee.min.y)/z.x,(G-ee.min.z)/z.z),new P.Vector2((D-ee.min.y)/z.x,(X-ee.min.z)/z.z),new P.Vector2((H-ee.min.y)/z.x,(I-ee.min.z)/z.z)]}}},O=function(){M.clear()}},949:function(L,j,w){var P=B=>{var O={};return w.d(O,B),O},M=B=>()=>B;L.exports=P({Box3:()=>W.Box3,BufferAttribute:()=>W.BufferAttribute,BufferGeometry:()=>W.BufferGeometry,CanvasTexture:()=>W.CanvasTexture,Color:()=>W.Color,DoubleSide:()=>W.DoubleSide,ExtrudeGeometry:()=>W.ExtrudeGeometry,Float32BufferAttribute:()=>W.Float32BufferAttribute,Group:()=>W.Group,LineSegments:()=>W.LineSegments,Matrix4:()=>W.Matrix4,Mesh:()=>W.Mesh,MeshBasicMaterial:()=>W.MeshBasicMaterial,NormalBlending:()=>W.NormalBlending,PlaneBufferGeometry:()=>W.PlaneBufferGeometry,PlaneGeometry:()=>W.PlaneGeometry,Points:()=>W.Points,RGBAFormat:()=>W.RGBAFormat,Ray:()=>W.Ray,ShaderChunk:()=>W.ShaderChunk,ShaderMaterial:()=>W.ShaderMaterial,Shape:()=>W.Shape,Sphere:()=>W.Sphere,Sprite:()=>W.Sprite,SpriteMaterial:()=>W.SpriteMaterial,Texture:()=>W.Texture,TextureLoader:()=>W.TextureLoader,UniformsLib:()=>W.UniformsLib,Vector2:()=>W.Vector2,Vector3:()=>W.Vector3,VideoTexture:()=>W.VideoTexture})},568:function(L,j,w){w.d(j,{Z:function(){return M}});function P(B,O,T,Z,x,k,Y){try{var J=B[k](Y),R=J.value}catch(s){T(s);return}J.done?O(R):Promise.resolve(R).then(Z,x)}function M(B){return function(){var O=this,T=arguments;return new Promise(function(Z,x){var k=B.apply(O,T);function Y(R){P(k,Z,x,Y,J,"next",R)}function J(R){P(k,Z,x,Y,J,"throw",R)}Y(void 0)})}}},924:function(L,j,w){w.d(j,{Z:function(){return P}});function P(M,B,O){return B in M?Object.defineProperty(M,B,{value:O,enumerable:!0,configurable:!0,writable:!0}):M[B]=O,M}},42:function(L,j,w){w.d(j,{Z:function(){return M}});var P=w(924);function M(B){for(var O=1;O<arguments.length;O++){var T=arguments[O]!=null?arguments[O]:{},Z=Object.keys(T);typeof Object.getOwnPropertySymbols=="function"&&(Z=Z.concat(Object.getOwnPropertySymbols(T).filter(function(x){return Object.getOwnPropertyDescriptor(T,x).enumerable}))),Z.forEach(function(x){(0,P.Z)(B,x,T[x])})}return B}}},it={};function N(L){var j=it[L];if(j!==void 0)return j.exports;var w=it[L]={exports:{}};return $t[L](w,w.exports,N),w.exports}(function(){N.n=function(L){var j=L&&L.__esModule?function(){return L.default}:function(){return L};return N.d(j,{a:j}),j}})(),function(){N.d=function(L,j){for(var w in j)N.o(j,w)&&!N.o(L,w)&&Object.defineProperty(L,w,{enumerable:!0,get:j[w]})}}(),function(){N.o=function(L,j){return Object.prototype.hasOwnProperty.call(L,j)}}();var me={};(function(){N.d(me,{Ei:function(){return Rt},Yo:function(){return zt},Ee:function(){return ae},x1:function(){return pt},VJ:function(){return ge},r7:function(){return Ge},XA:function(){return Ie},NB:function(){return at},xv:function(){return S},nk:function(){return Ce}});function L(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function j(e,n){return j=Object.setPrototypeOf||function(i,a){return i.__proto__=a,i},j(e,n)}function w(e,n){return j(e,n)}function P(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),n&&w(e,n)}var M=N(42);function B(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,i)}return r}function O(e,n){return n=n!=null?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):B(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}),e}function T(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function Z(e){return Z=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Z(e)}function x(e){return Z(e)}function k(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Y(e){return e&&e.constructor===Symbol?"symbol":typeof e}function J(e,n){return n&&(Y(n)==="object"||typeof n=="function")?n:k(e)}function R(e){var n=T();return function(){var i=x(e),a;if(n){var t=x(this).constructor;a=Reflect.construct(i,arguments,t)}else a=i.apply(this,arguments);return J(this,a)}}var s=N(949);function oe(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function re(e,n,r){return oe()?re=Reflect.construct:re=function(a,t,o){var c=[null];c.push.apply(c,t);var h=Function.bind.apply(a,c),v=new h;return o&&w(v,o.prototype),v},re.apply(null,arguments)}function $(e,n,r){return re.apply(null,arguments)}function ie(e,n){for(var r=0;r<n.length;r++){var i=n[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function G(e,n,r){return n&&ie(e.prototype,n),r&&ie(e,r),e}function F(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=new Array(n);r<n;r++)i[r]=e[r];return i}function D(e){if(Array.isArray(e))return F(e)}function X(e){if(typeof Symbol!="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function U(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function H(e,n){if(!!e){if(typeof e=="string")return F(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return F(e,n)}}function I(e){return D(e)||X(e)||H(e)||U()}var q=N(484);function ue(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r={};return r.promise=new Promise(function(i,a){r.resolve=i,r.reject=a}),e&&(r.promise=(0,q.Z)(r.promise,n)),r}var _e=e=>{var n={};return N.d(n,e),n},ee=e=>()=>e,z=_e({CSS2DObject:()=>Ut.CSS2DObject}),Se=e=>{var n={};return N.d(n,e),n},Te=e=>()=>e,Le=Se({CSS3DObject:()=>rt.CSS3DObject,CSS3DSprite:()=>rt.CSS3DSprite}),f=N(521),u=function(e){e&&((0,f.wf)(e),e.children.forEach(function(n){n.userData.BaseObject_||u(n)}))},p=function(){"use strict";function e(){L(this,e),this.objecttype__="BaseObject",this.userData={},this.pm=ue(),this.visible=!1}var n=e.prototype;return n.init=function(){},n.create=function(){},n.render=function(){},n.update=function(i,a){},n.resize=function(i,a){},n.show=function(){return this.object3d&&(this.object3d.visible=!0),this.visible=!0,this},n.hide=function(){return this.object3d&&(this.object3d.visible=!1),this.visible=!1,this},n.isVisible=function(){return this.visible},n.createMesh=function(){for(var i=arguments.length,a=new Array(i),t=0;t<i;t++)a[t]=arguments[t];return this.object3d=$(s.Mesh,I(a)),this},n.createGroup=function(){return this.object3d=new s.Group,this},n.createPoints=function(){for(var i=arguments.length,a=new Array(i),t=0;t<i;t++)a[t]=arguments[t];return this.object3d=$(s.Points,I(a)),this},n.createCSS2DObject=function(i){return this.object3d=new z.CSS2DObject(i),this},n.createCSS3DObject=function(i){return this.object3d=new Le.CSS3DObject(i),this},n.createCSS3DSprite=function(i){return this.object3d=new Le.CSS3DSprite(i),this},n.createSprite=function(i){return this.object3d=new s.Sprite(i),this},n.add=function(){for(var i=arguments.length,a=new Array(i),t=0;t<i;t++)a[t]=arguments[t];var o;return(o=this.object3d).add.apply(o,I(a)),this},n.remove=function(){for(var i=arguments.length,a=new Array(i),t=0;t<i;t++)a[t]=arguments[t];var o;return(o=this.object3d).remove.apply(o,I(a)),this},n.getSize=function(){var i=new s.Box3().setFromObject(this.object3d);return{min:i.min,max:i.max,size:i.getSize(new s.Vector3)}},n.traverse=function(i){i(this),this.children.forEach(function(a){a.traverse(i)})},n.dispose=function(){u(this.object3d)},G(e,[{key:"parent",get:function(){var i=this.object3d.parent;return(i==null?void 0:i.userData.BaseObject_)||this.pencil.scene}},{key:"children",get:function(){return this.object3d.children.map(function(i){return i.userData.BaseObject_}).filter(function(i){return!!i})}}]),e}(),S=function(e){"use strict";P(r,e);var n=R(r);function r(a){L(this,r);var t;return t=n.call(this),t.width=0,t.canvas=document.createElement("canvas"),t.options=(0,M.Z)({},{scale:.5,fontSize:28,fontFamily:"system-ui,-apple-system,BlinkMacSystemFont,sans-serif",fontWeight:"normal",flipX:!1,sprite:!1,sizeAttenuation:!0},a),t}var i=r.prototype;return i.create=function(){var t=this.options,o=t.position,c=t.lookAt,h=t.sprite,v=t.text,d=t.sizeAttenuation;if(h){var m=new s.Sprite(new s.SpriteMaterial({transparent:!0,sizeAttenuation:d}));this.object3d=m}else{var _=new s.MeshBasicMaterial({side:s.DoubleSide,transparent:!0}),b=new s.PlaneGeometry(1,1,1,1);this.createMesh(b,_)}this.object3d.position.copy(o),c&&this.object3d.lookAt(c),this.setText(v)},i.setText=function(t,o){var c=(0,M.Z)(O((0,M.Z)({},this.options),{text:t}),o||{}),h=c.text,v=c.fontSize,d=c.fontFamily,m=c.fontWeight,_=c.flipX,b=c.scale,y=this.canvas;y.width=v*h.length*2,y.height=v;var A=y.getContext("2d");A.font="".concat(m," ").concat(v,"px/1 ").concat(d);var l=A.measureText(h).width;y.width=l,this.width=l,A=y.getContext("2d"),A.clearRect(0,0,y.width,y.height),_&&A.scale(-1,1),A.font="".concat(m," ").concat(v,"px/1 ").concat(d),A.textBaseline="middle",A.fillStyle="#ffffff",A.fillText(h,_?l*-1:0,y.height/2),A.restore();var C=new s.Texture(y);C.anisotropy=16,C.needsUpdate=!0;var E=this.object3d;E.material.map&&E.material.map.dispose(),E.material.map=C,E.material.needsUpdate=!0,E.scale.set(C.image.width*b,C.image.height*b,1)},r}(p),g=N(568),Q=N(666),K=N.n(Q),ae=function(e){"use strict";P(r,e);var n=R(r);function r(a){L(this,r);var t;return t=n.call(this),t.options=a,t}var i=r.prototype;return i.getMaterial=function(){var t=this;return(0,g.Z)(K().mark(function o(){var c,h,v,d,m,_,b,y,A,l;return K().wrap(function(E){for(;;)switch(E.prev=E.next){case 0:return c=t.options,h=c.transparent,v=c.blending,d=c.src,m=c.depthWrite,_=c.alphaTest,b=c.sprite,y=c.sizeAttenuation,E.next=3,new s.TextureLoader().loadAsync(d);case 3:return A=E.sent,l=b?new s.SpriteMaterial({map:A,transparent:h!=null?h:!1,blending:v!=null?v:s.NormalBlending,depthWrite:m!=null?m:!0,alphaTest:_!=null?_:0,sizeAttenuation:y!=null?y:!0}):new s.MeshBasicMaterial({map:A,transparent:h!=null?h:!1,blending:v!=null?v:s.NormalBlending,depthWrite:m!=null?m:!0,alphaTest:_!=null?_:0}),E.abrupt("return",l);case 6:case"end":return E.stop()}},o)}))()},i.create=function(){var t=this;return(0,g.Z)(K().mark(function o(){var c,h,v,d,m,_,b,y;return K().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if(c=t.options,h=c.scale,v=c.position,d=c.src,m=c.cache,_=c.sprite,!(m&&!m.get(d))){l.next=7;break}return m.init(d),l.next=5,t.getMaterial();case 5:b=l.sent,m.set(d,b);case 7:if(!m){l.next=13;break}return l.next=10,m.get(d);case 10:l.t0=l.sent,l.next=16;break;case 13:return l.next=15,t.getMaterial();case 15:l.t0=l.sent;case 16:y=l.t0,t.texture=y.map,_?t.createSprite(y):t.createMesh(new s.PlaneBufferGeometry(1,1),y),h&&t.setScale(h),v&&t.object3d.position.copy(v);case 21:case"end":return l.stop()}},o)}))()},i.setScale=function(t){this.object3d.scale.set(this.texture.image.width*t,this.texture.image.height*t,1)},r}(p);function se(e,n){for(;!Object.prototype.hasOwnProperty.call(e,n)&&(e=x(e),e!==null););return e}function ne(e,n,r){return typeof Reflect!="undefined"&&Reflect.get?ne=Reflect.get:ne=function(a,t,o){var c=se(a,t);if(!!c){var h=Object.getOwnPropertyDescriptor(c,t);return h.get?h.get.call(o||a):h.value}},ne(e,n,r)}function Oe(e,n,r){return ne(e,n,r)}var Ce=function(e){"use strict";P(r,e);var n=R(r);function r(a){L(this,r);var t;return t=n.call(this),t.options=(0,M.Z)({},{autoPlay:!0,loop:!0},a),t}var i=r.prototype;return i.getMaterial=function(){var t=this.options,o=t.src,c=t.transparent,h=t.blending,v=t.depthWrite,d=t.format,m=t.autoPlay,_=t.loop,b=t.alphaTest,y=t.sprite,A=ue(),l=document.createElement("video");return l.addEventListener("loadedmetadata",function(){var C=new s.VideoTexture(l);C.format=d!=null?d:s.RGBAFormat,C.needsUpdate=!0;var E=y?new s.SpriteMaterial({map:C,transparent:c!=null?c:!1,blending:h!=null?h:s.NormalBlending,depthWrite:v!=null?v:!0,alphaTest:b!=null?b:0}):new s.MeshBasicMaterial({map:C,transparent:c!=null?c:!1,blending:h!=null?h:s.NormalBlending,depthWrite:v!=null?v:!0,alphaTest:b!=null?b:0});A.resolve(E)},!1),l.src=o,l.muted=!0,l.autoplay=m,l.loop=_,l.preload="auto",A.promise},i.create=function(){var t=this;return(0,g.Z)(K().mark(function o(){var c,h,v,d,m,_,b,y;return K().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if(c=t.options,h=c.scale,v=c.position,d=c.src,m=c.cache,_=c.sprite,!(m&&!m.get(d))){l.next=7;break}return m.init(d),l.next=5,t.getMaterial();case 5:b=l.sent,m.set(d,b);case 7:if(!m){l.next=13;break}return l.next=10,m.get(d);case 10:l.t0=l.sent,l.next=16;break;case 13:return l.next=15,t.getMaterial();case 15:l.t0=l.sent;case 16:y=l.t0,t.video=y.map.image,_?t.createSprite(y):t.createMesh(new s.PlaneBufferGeometry(1,1),y),h&&t.setScale(h),v&&t.object3d.position.copy(v);case 21:case"end":return l.stop()}},o)}))()},i.setScale=function(t){this.object3d.scale.set(this.video.videoWidth*t,this.video.videoHeight*t,1)},i.render=function(){var t=this.options.autoPlay;t&&this.video.play()},i.dispose=function(){this.video.pause(),this.video.src="",this.video.load(),Oe(x(r.prototype),"dispose",this).call(this)},r}(p),xe=function(e){"use strict";P(r,e);var n=R(r);function r(a){L(this,r);var t;return t=n.call(this),t.options=(0,M.Z)({},a),t}var i=r.prototype;return i.create=function(){var t=this.options,o=t.position,c=t.children,h=t.onClick,v=t.zIndexFix,d=document.createElement("div");this.element=d,d.appendChild(c),this.createCSS2DObject(d),o&&this.object3d.position.copy(o),h&&this.clickTarge.forEach(function(m){m.addEventListener("click",h)}),v&&(this.object3d.userData.zIndexFix=v)},i.getMaterial=function(t){return(0,g.Z)(K().mark(function o(){var c,h,v,d;return K().wrap(function(_){for(;;)switch(_.prev=_.next){case 0:return c=document.createElement("canvas"),c.width=256,c.height=256,h=c.getContext("2d"),h.fillStyle="#ff0000",h.fillRect(0,0,256,256),v=new s.CanvasTexture(c),d=new s.SpriteMaterial({map:v,opacity:t?1:0,transparent:!0,alphaTest:.1,sizeAttenuation:!1}),_.abrupt("return",d);case 9:case"end":return _.stop()}},o)}))()},i.createPickObject=function(t){var o=t.show,c=o===void 0?!1:o,h=t.scale,v=h===void 0?new s.Vector3(1,1,1):h,d=t.position,m=d===void 0?new s.Vector3(0,0,0):d,_=t.cache,b=this;return(0,g.Z)(K().mark(function y(){var A,l,C,E;return K().wrap(function(V){for(;;)switch(V.prev=V.next){case 0:if(A="node-create-pick-object",!(_&&!_.get(A))){V.next=7;break}return _.init(A),V.next=5,b.getMaterial(c);case 5:l=V.sent,_.set(A,l);case 7:if(!_){V.next=13;break}return V.next=10,_.get(A);case 10:V.t0=V.sent,V.next=16;break;case 13:return V.next=15,b.getMaterial(c);case 15:V.t0=V.sent;case 16:C=V.t0,E=new s.Sprite(C),E.scale.set(C.map.image.width*v.x,C.map.image.height*v.y,1),E.position.copy(m),b.add(E),b.pickObject=E;case 22:case"end":return V.stop()}},y)}))()},i.dispose=function(){var t=this.options.onClick;t&&this.clickTarge.forEach(function(o){o.removeEventListener("click",t)}),Oe(x(r.prototype),"dispose",this).call(this)},G(r,[{key:"clickTarge",get:function(){var t=this,o=this.options.clickTarge;if(o){var c=o.map(function(h){return I(t.element.querySelectorAll(h))}).flat();return c}return[this.element]}}]),r}(p),at=xe,ot=`
|
|
2
2
|
`.concat(s.ShaderChunk.logdepthbuf_pars_vertex,`
|
|
3
3
|
`).concat(s.ShaderChunk.fog_pars_vertex,`
|
|
4
4
|
attribute vec3 previous;
|
|
@@ -95,7 +95,7 @@ import*as et from"idb-keyval";import*as W from"three";import*as Vt from"three/ex
|
|
|
95
95
|
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
|
|
96
96
|
`).concat(s.ShaderChunk.fog_vertex,`
|
|
97
97
|
}
|
|
98
|
-
`),
|
|
98
|
+
`),st=`
|
|
99
99
|
`.concat(s.ShaderChunk.fog_pars_fragment,`
|
|
100
100
|
`).concat(s.ShaderChunk.logdepthbuf_pars_fragment,`
|
|
101
101
|
|
|
@@ -129,4 +129,4 @@ void main() {
|
|
|
129
129
|
gl_FragColor.a *= step(vCounters, visibility);
|
|
130
130
|
`).concat(s.ShaderChunk.fog_fragment,`
|
|
131
131
|
}
|
|
132
|
-
`),ge=function(e){"use strict";P(r,e);var n=R(r);function r(){L(this,r);var i;return i=n.call(this),i.isMeshLine=!0,i.type="MeshLine",i.positions=[],i.previous=[],i.next=[],i.side=[],i.width=[],i.indices_array=[],i.uvs=[],i.counters=[],i._points=[],i._geom=null,i.widthCallback=null,i.matrixWorld=new s.Matrix4,Object.defineProperties(k(i),{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(t){this.setGeometry(t,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(t){this.setPoints(t,this.widthCallback)}}}),i}return r}(s.BufferGeometry);ge.prototype.setMatrixWorld=function(e){this.matrixWorld=e},ge.prototype.setGeometry=function(e,n){this._geometry=e,this.setPoints(e.getAttribute("position").array,n)},ge.prototype.setPoints=function(e,n){if(!(e instanceof Float32Array)&&!(e instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=e,this.widthCallback=n,this.positions=[],this.counters=[],e.length&&e[0]instanceof s.Vector3)for(var r=0;r<e.length;r++){var i=e[r],a=r/e.length;this.positions.push(i.x,i.y,i.z),this.positions.push(i.x,i.y,i.z),this.counters.push(a),this.counters.push(a)}else for(var r=0;r<e.length;r+=3){var a=r/e.length;this.positions.push(e[r],e[r+1],e[r+2]),this.positions.push(e[r],e[r+1],e[r+2]),this.counters.push(a),this.counters.push(a)}this.process()};function Ie(e,n){var r=new s.Matrix4,i=new s.Ray,a=new s.Sphere,t=new s.Vector3,o=this.geometry;if(o.boundingSphere||o.computeBoundingSphere(),a.copy(o.boundingSphere),a.applyMatrix4(this.matrixWorld),e.ray.intersectSphere(a,t)!==!1){r.copy(this.matrixWorld).invert(),i.copy(e.ray).applyMatrix4(r);var c=new s.Vector3,h=new s.Vector3,v=new s.Vector3,d=this instanceof s.LineSegments?2:1,m=o.index,_=o.attributes;if(m!==null)for(var b=m.array,y=_.position.array,A=_.width.array,l=0,C=b.length-1;l<C;l+=d){var E=b[l],te=b[l+1];c.fromArray(y,E*3),h.fromArray(y,te*3);var V=A[Math.floor(l/3)]!==void 0?A[Math.floor(l/3)]:1,le=e.params.Line.threshold+this.material.lineWidth*V/2,de=le*le,Ae=i.distanceSqToSegment(c,h,t,v);if(!(Ae>de)){t.applyMatrix4(this.matrixWorld);var fe=e.ray.origin.distanceTo(t);fe<e.near||fe>e.far||(n.push({distance:fe,point:v.clone().applyMatrix4(this.matrixWorld),index:l,face:null,faceIndex:null,object:this}),l=C)}}}}ge.prototype.raycast=Ie,ge.prototype.compareV3=function(e,n){var r=e*6,i=n*6;return this.positions[r]===this.positions[i]&&this.positions[r+1]===this.positions[i+1]&&this.positions[r+2]===this.positions[i+2]},ge.prototype.copyV3=function(e){var n=e*6;return[this.positions[n],this.positions[n+1],this.positions[n+2]]},ge.prototype.process=function(){var e=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var n,r;this.compareV3(0,e-1)?r=this.copyV3(e-2):r=this.copyV3(0),this.previous.push(r[0],r[1],r[2]),this.previous.push(r[0],r[1],r[2]);for(var i=0;i<e;i++){if(this.side.push(1),this.side.push(-1),this.widthCallback?n=this.widthCallback(i/(e-1)):n=1,this.width.push(n),this.width.push(n),this.uvs.push(i/(e-1),0),this.uvs.push(i/(e-1),1),i<e-1){r=this.copyV3(i),this.previous.push(r[0],r[1],r[2]),this.previous.push(r[0],r[1],r[2]);var a=i*2;this.indices_array.push(a,a+1,a+2),this.indices_array.push(a+2,a+1,a+3)}i>0&&(r=this.copyV3(i),this.next.push(r[0],r[1],r[2]),this.next.push(r[0],r[1],r[2]))}this.compareV3(e-1,0)?r=this.copyV3(1):r=this.copyV3(e-1),this.next.push(r[0],r[1],r[2]),this.next.push(r[0],r[1],r[2]),!this._attributes||this._attributes.position.count!==this.positions.length?this._attributes={position:new s.BufferAttribute(new Float32Array(this.positions),3),previous:new s.BufferAttribute(new Float32Array(this.previous),3),next:new s.BufferAttribute(new Float32Array(this.next),3),side:new s.BufferAttribute(new Float32Array(this.side),1),width:new s.BufferAttribute(new Float32Array(this.width),1),uv:new s.BufferAttribute(new Float32Array(this.uvs),2),index:new s.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new s.BufferAttribute(new Float32Array(this.counters),1)}:(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()};function ze(e,n,r,i,a){var t;if(e=e.subarray||e.slice?e:e.buffer,r=r.subarray||r.slice?r:r.buffer,e=n?e.subarray?e.subarray(n,a&&n+a):e.slice(n,a&&n+a):e,r.set)r.set(e,i);else for(t=0;t<e.length;t++)r[t+i]=e[t];return r}ge.prototype.advance=function(e){var n=this._attributes.position.array,r=this._attributes.previous.array,i=this._attributes.next.array,a=n.length;ze(n,0,r,0,a),ze(n,6,n,0,a-6),n[a-6]=e.x,n[a-5]=e.y,n[a-4]=e.z,n[a-3]=e.x,n[a-2]=e.y,n[a-1]=e.z,ze(n,6,i,0,a-6),i[a-6]=e.x,i[a-5]=e.y,i[a-4]=e.z,i[a-3]=e.x,i[a-2]=e.y,i[a-1]=e.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0},s.ShaderChunk.meshline_vert=it,s.ShaderChunk.meshline_frag=at;var Ge=function(e){"use strict";P(r,e);var n=R(r);function r(i){L(this,r);var a;return a=n.call(this,{uniforms:Object.assign({},s.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new s.Color(16777215)},opacity:{value:1},resolution:{value:new s.Vector2(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new s.Vector2(1,1)},offset:{value:new s.Vector2(1,1)},lineLightAnimation:{value:1},time:{value:0},size:{value:300},speed:{value:.3},lightWidth:{value:.1},uCenter:{value:new s.Vector2(0,0)},lightColor:{value:new s.Color(16777215)}}),vertexShader:s.ShaderChunk.meshline_vert,fragmentShader:s.ShaderChunk.meshline_frag}),a.isMeshLineMaterial=!0,a.type="MeshLineMaterial",Object.defineProperties(k(a),{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(o){this.uniforms.lineWidth.value=o}},lineLightAnimation:{enumerable:!0,get:function(){return this.uniforms.lineLightAnimation.value},set:function(o){this.uniforms.lineLightAnimation.value=o}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(o){this.uniforms.map.value=o}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(o){this.uniforms.useMap.value=o}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(o){this.uniforms.alphaMap.value=o}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(o){this.uniforms.useAlphaMap.value=o}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(o){this.uniforms.color.value=o}},lightColor:{enumerable:!0,get:function(){return this.uniforms.lightColor.value},set:function(o){this.uniforms.lightColor.value=o}},time:{enumerable:!0,get:function(){return this.uniforms.time.value},set:function(o){this.uniforms.time.value=o}},uCenter:{enumerable:!0,get:function(){return this.uniforms.uCenter.value},set:function(o){this.uniforms.uCenter.value=o}},size:{enumerable:!0,get:function(){return this.uniforms.size.value},set:function(o){this.uniforms.size.value=o}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(o){this.uniforms.opacity.value=o}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(o){this.uniforms.resolution.value.copy(o)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(o){this.uniforms.sizeAttenuation.value=o}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(o){this.uniforms.dashArray.value=o,this.useDash=o!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(o){this.uniforms.dashOffset.value=o}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(o){this.uniforms.dashRatio.value=o}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(o){this.uniforms.useDash.value=o}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(o){this.uniforms.visibility.value=o}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(o){this.uniforms.alphaTest.value=o}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(o){this.uniforms.repeat.value.copy(o)}}}),a.setValues(i),a}return r}(s.ShaderMaterial);Ge.prototype.copy=function(e){return s.ShaderMaterial.prototype.copy.call(this,e),this.lineWidth=e.lineWidth,this.map=e.map,this.useMap=e.useMap,this.alphaMap=e.alphaMap,this.useAlphaMap=e.useAlphaMap,this.color.copy(e.color),this.opacity=e.opacity,this.resolution.copy(e.resolution),this.sizeAttenuation=e.sizeAttenuation,this.dashArray.copy(e.dashArray),this.dashOffset.copy(e.dashOffset),this.dashRatio.copy(e.dashRatio),this.useDash=e.useDash,this.visibility=e.visibility,this.alphaTest=e.alphaTest,this.repeat.copy(e.repeat),this};function ot(e,n){if(e==null)return{};var r={},i=Object.keys(e),a,t;for(t=0;t<i.length;t++)a=i[t],!(n.indexOf(a)>=0)&&(r[a]=e[a]);return r}function st(e,n){if(e==null)return{};var r=ot(e,n),i,a;if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);for(a=0;a<t.length;a++)i=t[a],!(n.indexOf(i)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,i)||(r[i]=e[i]))}return r}var ut=e=>{var n={};return N.d(n,e),n},or=e=>()=>e,ct=ut({animate:()=>Ut.animate}),lt=e=>{var n={};return N.d(n,e),n},sr=e=>()=>e,Ze=lt({mergeBufferGeometries:()=>Nt.mergeBufferGeometries});function Xe(e){var n=e.setPointWidth,r=e.nodes,i=new s.BufferGeometry,a=new ge;return i.setFromPoints(r),a.setGeometry(i,n),a}var ft={color:new s.Color("#ffffff"),lineWidth:3,sizeAttenuation:0},ht=function(e){"use strict";P(r,e);var n=R(r);function r(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};L(this,r);var t;return t=n.call(this),t.options=(0,M.Z)({},ft,a),t}var i=r.prototype;return i.create=function(){var t=this,o=this.options,c=o.duration,h=o.delay,v=o.onComplete,d=o.setPointWidth,m=o.key,_=o.nodes,b=o.nodesArr,y=o.coordinatesArr,A=o.projection,l=o.workerController,C=o.useGroups,E=st(o,["duration","delay","onComplete","setPointWidth","key","nodes","nodesArr","coordinatesArr","projection","workerController","useGroups"]),te=this.pencil.getSize(),V=te.width,le=te.height,de=new Ge(O((0,M.Z)({},E),{resolution:new s.Vector2(V,le)}));if(this.material=de,_)this.createMesh(Xe({nodes:_,setPointWidth:d}),de);else if(b){var Ae=Ze.mergeBufferGeometries(b.map(function(fe){return Xe({nodes:fe,setPointWidth:d})}),C!=null?C:!1);this.createMesh(Ae,de)}else if(y&&l)return new Promise(function(fe){l.postMessage({coordinatesArr:y,projection:A,useGroups:C},function(ce){var be=new s.BufferGeometry;Object.keys(ce).forEach(function(he){he==="index"?be.setIndex(new s.BufferAttribute(ce[he].array,ce[he].itemSize)):be.setAttribute(he,new s.BufferAttribute(ce[he].array,ce[he].itemSize))}),t.createMesh(be,de),fe("")})})},i.resize=function(t,o){this.material.uniforms.resolution.value.set(t,o)},i.animate=function(){var t=this.options,o=t.duration,c=t.delay,h=t.onComplete,v=this.material.uniforms.offset,d=c!=null?c:0,m=(0,ct.animate)({from:v.value,to:{x:0},duration:o!=null?o:1e3,elapsed:-d,repeat:1/0,onComplete:h,onUpdate:function(_){v.value.x=_.x}});this.tween=m},i.dispose=function(){var t;Oe(x(r.prototype),"dispose",this).call(this),(t=this.tween)===null||t===void 0||t.stop()},r}(p);function pt(e){if(Array.isArray(e))return e}function vt(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ye(e,n){return pt(e)||X(e,n)||H(e,n)||vt()}var dt=e=>{var n={};return N.d(n,e),n},ur=e=>()=>e,Ee=dt({extent:()=>Fe.extent,mean:()=>Fe.mean,merge:()=>Fe.merge}),mt=e=>{var n={};return N.d(n,e),n},cr=e=>()=>e,De=mt({default:()=>Ft.default}),_t=e=>{var n={};return N.d(n,e),n},lr=e=>()=>e,gt=_t({default:()=>It.default});function yt(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=(90-n)*Math.PI/180,a=(90-e)*Math.PI/180;return[r*Math.sin(i)*Math.cos(a),r*Math.cos(i),r*Math.sin(i)*Math.sin(a)]}var bt=e=>{var n={};return N.d(n,e),n},fr=e=>()=>e,wt=bt({default:()=>Zt.default}),xt=e=>{var n={};return N.d(n,e),n},hr=e=>()=>e,At=xt({default:()=>Xt.default}),Mt=e=>{var n={};return N.d(n,e),n},pr=e=>()=>e,je=Mt({geoBounds:()=>Re.geoBounds,geoContains:()=>Re.geoContains,geoDistance:()=>Re.geoDistance,geoInterpolate:()=>Re.geoInterpolate}),St=e=>{var n={};return N.d(n,e),n},vr=e=>()=>e,Pt=St({geoVoronoi:()=>Ht.geoVoronoi}),Ot=e=>{var n={};return N.d(n,e),n},dr=e=>()=>e,He=Ot({scaleLinear:()=>Kt.scaleLinear});function Ct(e,n){return e.map(function(r){var i=[],a;return r.forEach(function(t){if(a){var o=(0,je.geoDistance)(t,a)*180/Math.PI;if(o>n)for(var c=(0,je.geoInterpolate)(a,t),h=1/Math.ceil(o/n),v=h;v<1;)i.push(c(v)),v+=h}i.push(a=t)}),i})}function Et(e){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.minLng,i=n.maxLng,a=n.minLat,t=n.maxLat,o=Math.round(Math.pow(360/e,2)/Math.PI),c=(1+Math.sqrt(5))/2,h=function(l){return l/c*360%360-180},v=function(l){return Math.acos(2*l/o-1)/Math.PI*180-90},d=function(l){return o*(Math.cos((l+90)*Math.PI/180)+1)/2},m=[t!==void 0?Math.ceil(d(t)):0,a!==void 0?Math.floor(d(a)):o-1],_=r===void 0&&i===void 0?function(){return!0}:r===void 0?function(l){return l<=i}:i===void 0?function(l){return l>=r}:i>=r?function(l){return l>=r&&l<=i}:function(l){return l>=r||l<=i},b=[],y=m[0];y<=m[1];y++){var A=h(y);_(A)&&b.push([A,v(y)])}return b}function We(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return r?(0,je.geoContains)(n,e):(0,At.default)(e,n)}function Lt(e,n){var r={type:"Polygon",coordinates:e},i=ye((0,je.geoBounds)(r),2),a=ye(i[0],2),t=a[0],o=a[1],c=ye(i[1],2),h=c[0],v=c[1];if(Math.min(Math.abs(h-t),Math.abs(v-o))<n)return[];var d=t>h||v>=89||o<=-89;return Et(n,{minLng:t,maxLng:h,minLat:o,maxLat:v}).filter(function(m){return We(m,r,d)})}function jt(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.resolution,i=r===void 0?1/0:r,a=Ct(e,i),t=(0,Ee.merge)(a),o=Lt(e,i),c=I(t).concat(I(o)),h={type:"Polygon",coordinates:e},v=ye((0,je.geoBounds)(h),2),d=ye(v[0],2),m=d[0],_=d[1],b=ye(v[1],2),y=b[0],A=b[1],l=m>y||A>=89||_<=-89,C=[];if(l){var E=(0,Pt.geoVoronoi)(c).triangles(),te=new Map(c.map(function(pe,Pe){var Me=ye(pe,2),ve=Me[0],Be=Me[1];return["".concat(ve,"-").concat(Be),Pe]}));E.features.forEach(function(pe){var Pe,Me=pe.geometry.coordinates[0].slice(0,3).reverse(),ve=[];if(Me.forEach(function(ke){var we=ye(ke,2),Ne=we[0],Wt=we[1],qe="".concat(Ne,"-").concat(Wt);te.has(qe)&&ve.push(te.get(qe))}),ve.length===3){if(ve.some(function(ke){return ke<t.length})){var Be=pe.properties.circumcenter;if(!We(Be,h,l))return}(Pe=C).push.apply(Pe,I(ve))}})}else if(o.length)for(var fe=function(pe,Pe){var Me,ve=[2,1,0].map(function(we){return ce.triangles[pe+we]}),Be=ve.map(function(we){return c[we]});if(ve.some(function(we){return we<t.length})){var ke=[0,1].map(function(we){return(0,Ee.mean)(Be,function(Ne){return Ne[we]})});if(!We(ke,h,l))return"continue"}(Me=C).push.apply(Me,I(ve))},ce=wt.default.from(c),be=0,he=ce.triangles.length;be<he;be+=3)fe(be,he);else{var V=De.default.flatten(a),le=V.vertices,de=V.holes,Ae=de===void 0?[]:de;C=(0,De.default)(le,Ae,2)}var Ue=(0,He.scaleLinear)((0,Ee.extent)(c,function(pe){return pe[0]}),[0,1]),zt=(0,He.scaleLinear)((0,Ee.extent)(c,function(pe){return pe[1]}),[0,1]),Gt=c.map(function(pe){var Pe=ye(pe,2),Me=Pe[0],ve=Pe[1];return[Ue(Me),zt(ve)]}),Dt={points:c,indices:C,uvs:Gt};return{contour:a,triangles:Dt}}var Bt=jt,Ke=new s.BufferGeometry().setAttribute?"setAttribute":"addAttribute";function Ve(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=e.map(function(a){return a.map(function(t){var o=ye(t,2),c=o[0],h=o[1];return r?yt(c,h,n):[c,h,n]})});return De.default.flatten(i)}function $e(e,n,r){for(var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=Ve(e,n,i),t=a.vertices,o=a.holes,c=Ve(e,r,i),h=c.vertices,v=(0,Ee.merge)([h,t]),d=Math.round(h.length/3),m=new Set(o),_=0,b=[],y=0;y<d;y++){var A=y+1;if(A===d)A=_;else if(m.has(A)){var l=A;A=_,_=l}b.push(y,y+d,A+d),b.push(A+d,A,y)}for(var C=[],E=1;E>=0;E--)for(var te=0;te<d;te+=1)C.push(te/(d-1),E);return{indices:b,vertices:v,uvs:C,topVerts:h}}function Ye(e,n,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return{indices:i?e.indices:e.indices.slice().reverse(),vertices:Ve([e.points],n,a).vertices,uvs:r}}var kt=function(e){"use strict";P(r,e);var n=R(r);function r(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};L(this,r);var t;t=n.call(this),t.type="PolygonBufferGeometry",t.parameters=(0,M.Z)({},{polygonGeoJson:i,startHeight:0,endHeight:1,closedBottom:!0,closedTop:!0,includeSides:!0,curvatureResolution:5,cartesian:!0,userDataRsoOffset:0},a);var o=t.parameters,c=o.startHeight,h=o.endHeight,v=o.closedBottom,d=o.closedTop,m=o.includeSides,_=o.curvatureResolution,b=o.cartesian,y=o.userDataRsoOffset;(0,gt.default)(i[0])||i[0].reverse();var A=Bt(i,{resolution:_}),l=A.contour,C=A.triangles,E=(0,Ee.merge)(C.uvs),te=[],V=[],le=[],de=0,Ae=function(ce){var be=Math.round(te.length/3),he=le.length;te=te.concat(ce.vertices),V=V.concat(ce.uvs),le=le.concat(be?ce.indices.map(function(Ue){return Ue+be}):ce.indices),t.addGroup(he,le.length-he,de++)};if(m){var fe=$e(l,c,h,b);Ae(fe),t.userData.rso=y?$e(l,c,h+y,b):fe}return v&&Ae(Ye(C,c,E,!1,b)),d&&Ae(Ye(C,h,E,!0,b)),t.setIndex(le),t[Ke]("position",new s.Float32BufferAttribute(te,3)),t[Ke]("uv",new s.Float32BufferAttribute(V,2)),t.computeVertexNormals(),t}return r}(s.BufferGeometry),Tt=function(e){"use strict";P(r,e);var n=R(r);function r(a){L(this,r);var t;return t=n.call(this),t.options=(0,M.Z)({},{geojson:[[[]]],startHeight:0,height:5,closedBottom:!0,closedTop:!0,curvatureResolution:1,cartesian:!0,userDataRsoOffset:0},a),t}var i=r.prototype;return i.create=function(){var t=this.options,o=t.startHeight,c=t.height,h=t.closedBottom,v=t.closedTop,d=t.curvatureResolution,m=t.userDataRsoOffset,_=t.cartesian,b=new kt(this.options.geojson,{startHeight:o,endHeight:o+c,closedBottom:h,closedTop:v,curvatureResolution:d,cartesian:_,userDataRsoOffset:m});this.createMesh(b,this.options.material)},r}(p),Je=N(705);function Qe(e){var n=e.split,r=e.depth,i=e.points,a=new s.ExtrudeGeometry(new s.Shape(i),{depth:r,bevelEnabled:!1,UVGenerator:(0,Je.y)({split:n})});return(0,Je.C)(),a}var Rt=function(e){"use strict";P(r,e);var n=R(r);function r(a){L(this,r);var t;return t=n.call(this),t.options=(0,M.Z)({},a),t}var i=r.prototype;return i.create=function(){var t=this,o=this.options,c=o.points,h=o.pointsArr,v=o.coordinatesArr,d=o.material,m=o.useGroups,_=o.depth,b=o.split,y=o.workerController,A=o.projection;if(c)this.createMesh(Qe({points:c,depth:_,split:b}),d);else if(h){var l=Ze.mergeBufferGeometries(h.map(function(C){return Qe({points:C,depth:_,split:b})}),m!=null?m:!1);this.createMesh(l,d)}else if(v&&y)return new Promise(function(C){y.postMessage({coordinatesArr:v,depth:_,split:b,useGroups:m,projection:A},function(E){var te=new s.BufferGeometry;Object.keys(E).forEach(function(V){te.setAttribute(V,new s.BufferAttribute(E[V].array,E[V].itemSize))}),t.createMesh(te,d),C("")})})},r}(p)})();var Yt=me.Ei,Jt=me.Yo,Qt=me.Ee,qt=me.x1,er=me.VJ,tr=me.r7,rr=me.XA,nr=me.NB,ir=me.xv,ar=me.nk;export{Yt as ConicPolygon,Jt as ExtrudePolygon,Qt as Image,qt as Line,er as MeshLine,tr as MeshLineMaterial,rr as MeshLineRaycast,nr as Node,ir as Text,ar as Video};
|
|
132
|
+
`),ge=function(e){"use strict";P(r,e);var n=R(r);function r(){L(this,r);var i;return i=n.call(this),i.isMeshLine=!0,i.type="MeshLine",i.positions=[],i.previous=[],i.next=[],i.side=[],i.width=[],i.indices_array=[],i.uvs=[],i.counters=[],i._points=[],i._geom=null,i.widthCallback=null,i.matrixWorld=new s.Matrix4,Object.defineProperties(k(i),{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(t){this.setGeometry(t,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(t){this.setPoints(t,this.widthCallback)}}}),i}return r}(s.BufferGeometry);ge.prototype.setMatrixWorld=function(e){this.matrixWorld=e},ge.prototype.setGeometry=function(e,n){this._geometry=e,this.setPoints(e.getAttribute("position").array,n)},ge.prototype.setPoints=function(e,n){if(!(e instanceof Float32Array)&&!(e instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=e,this.widthCallback=n,this.positions=[],this.counters=[],e.length&&e[0]instanceof s.Vector3)for(var r=0;r<e.length;r++){var i=e[r],a=r/e.length;this.positions.push(i.x,i.y,i.z),this.positions.push(i.x,i.y,i.z),this.counters.push(a),this.counters.push(a)}else for(var r=0;r<e.length;r+=3){var a=r/e.length;this.positions.push(e[r],e[r+1],e[r+2]),this.positions.push(e[r],e[r+1],e[r+2]),this.counters.push(a),this.counters.push(a)}this.process()};function Ie(e,n){var r=new s.Matrix4,i=new s.Ray,a=new s.Sphere,t=new s.Vector3,o=this.geometry;if(o.boundingSphere||o.computeBoundingSphere(),a.copy(o.boundingSphere),a.applyMatrix4(this.matrixWorld),e.ray.intersectSphere(a,t)!==!1){r.copy(this.matrixWorld).invert(),i.copy(e.ray).applyMatrix4(r);var c=new s.Vector3,h=new s.Vector3,v=new s.Vector3,d=this instanceof s.LineSegments?2:1,m=o.index,_=o.attributes;if(m!==null)for(var b=m.array,y=_.position.array,A=_.width.array,l=0,C=b.length-1;l<C;l+=d){var E=b[l],te=b[l+1];c.fromArray(y,E*3),h.fromArray(y,te*3);var V=A[Math.floor(l/3)]!==void 0?A[Math.floor(l/3)]:1,le=e.params.Line.threshold+this.material.lineWidth*V/2,de=le*le,Ae=i.distanceSqToSegment(c,h,t,v);if(!(Ae>de)){t.applyMatrix4(this.matrixWorld);var fe=e.ray.origin.distanceTo(t);fe<e.near||fe>e.far||(n.push({distance:fe,point:v.clone().applyMatrix4(this.matrixWorld),index:l,face:null,faceIndex:null,object:this}),l=C)}}}}ge.prototype.raycast=Ie,ge.prototype.compareV3=function(e,n){var r=e*6,i=n*6;return this.positions[r]===this.positions[i]&&this.positions[r+1]===this.positions[i+1]&&this.positions[r+2]===this.positions[i+2]},ge.prototype.copyV3=function(e){var n=e*6;return[this.positions[n],this.positions[n+1],this.positions[n+2]]},ge.prototype.process=function(){var e=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var n,r;this.compareV3(0,e-1)?r=this.copyV3(e-2):r=this.copyV3(0),this.previous.push(r[0],r[1],r[2]),this.previous.push(r[0],r[1],r[2]);for(var i=0;i<e;i++){if(this.side.push(1),this.side.push(-1),this.widthCallback?n=this.widthCallback(i/(e-1)):n=1,this.width.push(n),this.width.push(n),this.uvs.push(i/(e-1),0),this.uvs.push(i/(e-1),1),i<e-1){r=this.copyV3(i),this.previous.push(r[0],r[1],r[2]),this.previous.push(r[0],r[1],r[2]);var a=i*2;this.indices_array.push(a,a+1,a+2),this.indices_array.push(a+2,a+1,a+3)}i>0&&(r=this.copyV3(i),this.next.push(r[0],r[1],r[2]),this.next.push(r[0],r[1],r[2]))}this.compareV3(e-1,0)?r=this.copyV3(1):r=this.copyV3(e-1),this.next.push(r[0],r[1],r[2]),this.next.push(r[0],r[1],r[2]),!this._attributes||this._attributes.position.count!==this.positions.length?this._attributes={position:new s.BufferAttribute(new Float32Array(this.positions),3),previous:new s.BufferAttribute(new Float32Array(this.previous),3),next:new s.BufferAttribute(new Float32Array(this.next),3),side:new s.BufferAttribute(new Float32Array(this.side),1),width:new s.BufferAttribute(new Float32Array(this.width),1),uv:new s.BufferAttribute(new Float32Array(this.uvs),2),index:new s.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new s.BufferAttribute(new Float32Array(this.counters),1)}:(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()};function ze(e,n,r,i,a){var t;if(e=e.subarray||e.slice?e:e.buffer,r=r.subarray||r.slice?r:r.buffer,e=n?e.subarray?e.subarray(n,a&&n+a):e.slice(n,a&&n+a):e,r.set)r.set(e,i);else for(t=0;t<e.length;t++)r[t+i]=e[t];return r}ge.prototype.advance=function(e){var n=this._attributes.position.array,r=this._attributes.previous.array,i=this._attributes.next.array,a=n.length;ze(n,0,r,0,a),ze(n,6,n,0,a-6),n[a-6]=e.x,n[a-5]=e.y,n[a-4]=e.z,n[a-3]=e.x,n[a-2]=e.y,n[a-1]=e.z,ze(n,6,i,0,a-6),i[a-6]=e.x,i[a-5]=e.y,i[a-4]=e.z,i[a-3]=e.x,i[a-2]=e.y,i[a-1]=e.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0},s.ShaderChunk.meshline_vert=ot,s.ShaderChunk.meshline_frag=st;var Ge=function(e){"use strict";P(r,e);var n=R(r);function r(i){L(this,r);var a;return a=n.call(this,{uniforms:Object.assign({},s.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new s.Color(16777215)},opacity:{value:1},resolution:{value:new s.Vector2(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new s.Vector2(1,1)},offset:{value:new s.Vector2(1,1)},lineLightAnimation:{value:1},time:{value:0},size:{value:300},speed:{value:.3},lightWidth:{value:.1},uCenter:{value:new s.Vector2(0,0)},lightColor:{value:new s.Color(16777215)}}),vertexShader:s.ShaderChunk.meshline_vert,fragmentShader:s.ShaderChunk.meshline_frag}),a.isMeshLineMaterial=!0,a.type="MeshLineMaterial",Object.defineProperties(k(a),{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(o){this.uniforms.lineWidth.value=o}},lineLightAnimation:{enumerable:!0,get:function(){return this.uniforms.lineLightAnimation.value},set:function(o){this.uniforms.lineLightAnimation.value=o}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(o){this.uniforms.map.value=o}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(o){this.uniforms.useMap.value=o}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(o){this.uniforms.alphaMap.value=o}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(o){this.uniforms.useAlphaMap.value=o}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(o){this.uniforms.color.value=o}},lightColor:{enumerable:!0,get:function(){return this.uniforms.lightColor.value},set:function(o){this.uniforms.lightColor.value=o}},time:{enumerable:!0,get:function(){return this.uniforms.time.value},set:function(o){this.uniforms.time.value=o}},uCenter:{enumerable:!0,get:function(){return this.uniforms.uCenter.value},set:function(o){this.uniforms.uCenter.value=o}},size:{enumerable:!0,get:function(){return this.uniforms.size.value},set:function(o){this.uniforms.size.value=o}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(o){this.uniforms.opacity.value=o}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(o){this.uniforms.resolution.value.copy(o)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(o){this.uniforms.sizeAttenuation.value=o}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(o){this.uniforms.dashArray.value=o,this.useDash=o!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(o){this.uniforms.dashOffset.value=o}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(o){this.uniforms.dashRatio.value=o}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(o){this.uniforms.useDash.value=o}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(o){this.uniforms.visibility.value=o}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(o){this.uniforms.alphaTest.value=o}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(o){this.uniforms.repeat.value.copy(o)}}}),a.setValues(i),a}return r}(s.ShaderMaterial);Ge.prototype.copy=function(e){return s.ShaderMaterial.prototype.copy.call(this,e),this.lineWidth=e.lineWidth,this.map=e.map,this.useMap=e.useMap,this.alphaMap=e.alphaMap,this.useAlphaMap=e.useAlphaMap,this.color.copy(e.color),this.opacity=e.opacity,this.resolution.copy(e.resolution),this.sizeAttenuation=e.sizeAttenuation,this.dashArray.copy(e.dashArray),this.dashOffset.copy(e.dashOffset),this.dashRatio.copy(e.dashRatio),this.useDash=e.useDash,this.visibility=e.visibility,this.alphaTest=e.alphaTest,this.repeat.copy(e.repeat),this};function ut(e,n){if(e==null)return{};var r={},i=Object.keys(e),a,t;for(t=0;t<i.length;t++)a=i[t],!(n.indexOf(a)>=0)&&(r[a]=e[a]);return r}function ct(e,n){if(e==null)return{};var r=ut(e,n),i,a;if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);for(a=0;a<t.length;a++)i=t[a],!(n.indexOf(i)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,i)||(r[i]=e[i]))}return r}var lt=e=>{var n={};return N.d(n,e),n},or=e=>()=>e,Ze=lt({animate:()=>nt.animate,linear:()=>nt.linear}),ft=e=>{var n={};return N.d(n,e),n},sr=e=>()=>e,Xe=ft({mergeBufferGeometries:()=>Nt.mergeBufferGeometries});function He(e){var n=e.setPointWidth,r=e.nodes,i=new s.BufferGeometry,a=new ge;return i.setFromPoints(r),a.setGeometry(i,n),a}var ht={color:new s.Color("#ffffff"),lineWidth:3,sizeAttenuation:0},pt=function(e){"use strict";P(r,e);var n=R(r);function r(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};L(this,r);var t;return t=n.call(this),t.options=(0,M.Z)({},ht,a),t}var i=r.prototype;return i.create=function(){var t=this,o=this.options,c=o.duration,h=o.delay,v=o.onComplete,d=o.setPointWidth,m=o.key,_=o.nodes,b=o.nodesArr,y=o.coordinatesArr,A=o.projection,l=o.workerController,C=o.useGroups,E=ct(o,["duration","delay","onComplete","setPointWidth","key","nodes","nodesArr","coordinatesArr","projection","workerController","useGroups"]),te=this.pencil.getSize(),V=te.width,le=te.height,de=new Ge(O((0,M.Z)({},E),{resolution:new s.Vector2(V,le)}));if(this.material=de,_)this.createMesh(He({nodes:_,setPointWidth:d}),de);else if(b){var Ae=Xe.mergeBufferGeometries(b.map(function(fe){return He({nodes:fe,setPointWidth:d})}),C!=null?C:!1);this.createMesh(Ae,de)}else if(y&&l)return new Promise(function(fe){l.postMessage({coordinatesArr:y,projection:A,useGroups:C},function(ce){var be=new s.BufferGeometry;Object.keys(ce).forEach(function(he){he==="index"?be.setIndex(new s.BufferAttribute(ce[he].array,ce[he].itemSize)):be.setAttribute(he,new s.BufferAttribute(ce[he].array,ce[he].itemSize))}),t.createMesh(be,de),fe("")})})},i.resize=function(t,o){this.material.uniforms.resolution.value.set(t,o)},i.animate=function(){var t=this.options,o=t.duration,c=t.delay,h=t.onComplete,v=this.material.uniforms.offset,d=c!=null?c:0,m=(0,Ze.animate)({from:v.value,to:{x:0},duration:o!=null?o:1e3,elapsed:-d,repeat:1/0,onComplete:h,ease:Ze.linear,onUpdate:function(_){v.value.x=_.x}});this.tween=m},i.dispose=function(){var t;Oe(x(r.prototype),"dispose",this).call(this),(t=this.tween)===null||t===void 0||t.stop()},r}(p);function vt(e){if(Array.isArray(e))return e}function dt(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ye(e,n){return vt(e)||X(e,n)||H(e,n)||dt()}var mt=e=>{var n={};return N.d(n,e),n},ur=e=>()=>e,Ee=mt({extent:()=>Fe.extent,mean:()=>Fe.mean,merge:()=>Fe.merge}),_t=e=>{var n={};return N.d(n,e),n},cr=e=>()=>e,De=_t({default:()=>Ft.default}),gt=e=>{var n={};return N.d(n,e),n},lr=e=>()=>e,yt=gt({default:()=>It.default});function bt(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=(90-n)*Math.PI/180,a=(90-e)*Math.PI/180;return[r*Math.sin(i)*Math.cos(a),r*Math.cos(i),r*Math.sin(i)*Math.sin(a)]}var wt=e=>{var n={};return N.d(n,e),n},fr=e=>()=>e,xt=wt({default:()=>Zt.default}),At=e=>{var n={};return N.d(n,e),n},hr=e=>()=>e,Mt=At({default:()=>Xt.default}),St=e=>{var n={};return N.d(n,e),n},pr=e=>()=>e,je=St({geoBounds:()=>Re.geoBounds,geoContains:()=>Re.geoContains,geoDistance:()=>Re.geoDistance,geoInterpolate:()=>Re.geoInterpolate}),Pt=e=>{var n={};return N.d(n,e),n},vr=e=>()=>e,Ot=Pt({geoVoronoi:()=>Ht.geoVoronoi}),Ct=e=>{var n={};return N.d(n,e),n},dr=e=>()=>e,Ke=Ct({scaleLinear:()=>Kt.scaleLinear});function Et(e,n){return e.map(function(r){var i=[],a;return r.forEach(function(t){if(a){var o=(0,je.geoDistance)(t,a)*180/Math.PI;if(o>n)for(var c=(0,je.geoInterpolate)(a,t),h=1/Math.ceil(o/n),v=h;v<1;)i.push(c(v)),v+=h}i.push(a=t)}),i})}function Lt(e){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.minLng,i=n.maxLng,a=n.minLat,t=n.maxLat,o=Math.round(Math.pow(360/e,2)/Math.PI),c=(1+Math.sqrt(5))/2,h=function(l){return l/c*360%360-180},v=function(l){return Math.acos(2*l/o-1)/Math.PI*180-90},d=function(l){return o*(Math.cos((l+90)*Math.PI/180)+1)/2},m=[t!==void 0?Math.ceil(d(t)):0,a!==void 0?Math.floor(d(a)):o-1],_=r===void 0&&i===void 0?function(){return!0}:r===void 0?function(l){return l<=i}:i===void 0?function(l){return l>=r}:i>=r?function(l){return l>=r&&l<=i}:function(l){return l>=r||l<=i},b=[],y=m[0];y<=m[1];y++){var A=h(y);_(A)&&b.push([A,v(y)])}return b}function We(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return r?(0,je.geoContains)(n,e):(0,Mt.default)(e,n)}function jt(e,n){var r={type:"Polygon",coordinates:e},i=ye((0,je.geoBounds)(r),2),a=ye(i[0],2),t=a[0],o=a[1],c=ye(i[1],2),h=c[0],v=c[1];if(Math.min(Math.abs(h-t),Math.abs(v-o))<n)return[];var d=t>h||v>=89||o<=-89;return Lt(n,{minLng:t,maxLng:h,minLat:o,maxLat:v}).filter(function(m){return We(m,r,d)})}function Bt(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.resolution,i=r===void 0?1/0:r,a=Et(e,i),t=(0,Ee.merge)(a),o=jt(e,i),c=I(t).concat(I(o)),h={type:"Polygon",coordinates:e},v=ye((0,je.geoBounds)(h),2),d=ye(v[0],2),m=d[0],_=d[1],b=ye(v[1],2),y=b[0],A=b[1],l=m>y||A>=89||_<=-89,C=[];if(l){var E=(0,Ot.geoVoronoi)(c).triangles(),te=new Map(c.map(function(pe,Pe){var Me=ye(pe,2),ve=Me[0],Be=Me[1];return["".concat(ve,"-").concat(Be),Pe]}));E.features.forEach(function(pe){var Pe,Me=pe.geometry.coordinates[0].slice(0,3).reverse(),ve=[];if(Me.forEach(function(ke){var we=ye(ke,2),Ne=we[0],Vt=we[1],et="".concat(Ne,"-").concat(Vt);te.has(et)&&ve.push(te.get(et))}),ve.length===3){if(ve.some(function(ke){return ke<t.length})){var Be=pe.properties.circumcenter;if(!We(Be,h,l))return}(Pe=C).push.apply(Pe,I(ve))}})}else if(o.length)for(var fe=function(pe,Pe){var Me,ve=[2,1,0].map(function(we){return ce.triangles[pe+we]}),Be=ve.map(function(we){return c[we]});if(ve.some(function(we){return we<t.length})){var ke=[0,1].map(function(we){return(0,Ee.mean)(Be,function(Ne){return Ne[we]})});if(!We(ke,h,l))return"continue"}(Me=C).push.apply(Me,I(ve))},ce=xt.default.from(c),be=0,he=ce.triangles.length;be<he;be+=3)fe(be,he);else{var V=De.default.flatten(a),le=V.vertices,de=V.holes,Ae=de===void 0?[]:de;C=(0,De.default)(le,Ae,2)}var Ue=(0,Ke.scaleLinear)((0,Ee.extent)(c,function(pe){return pe[0]}),[0,1]),Gt=(0,Ke.scaleLinear)((0,Ee.extent)(c,function(pe){return pe[1]}),[0,1]),Dt=c.map(function(pe){var Pe=ye(pe,2),Me=Pe[0],ve=Pe[1];return[Ue(Me),Gt(ve)]}),Wt={points:c,indices:C,uvs:Dt};return{contour:a,triangles:Wt}}var kt=Bt,$e=new s.BufferGeometry().setAttribute?"setAttribute":"addAttribute";function Ve(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=e.map(function(a){return a.map(function(t){var o=ye(t,2),c=o[0],h=o[1];return r?bt(c,h,n):[c,h,n]})});return De.default.flatten(i)}function Ye(e,n,r){for(var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=Ve(e,n,i),t=a.vertices,o=a.holes,c=Ve(e,r,i),h=c.vertices,v=(0,Ee.merge)([h,t]),d=Math.round(h.length/3),m=new Set(o),_=0,b=[],y=0;y<d;y++){var A=y+1;if(A===d)A=_;else if(m.has(A)){var l=A;A=_,_=l}b.push(y,y+d,A+d),b.push(A+d,A,y)}for(var C=[],E=1;E>=0;E--)for(var te=0;te<d;te+=1)C.push(te/(d-1),E);return{indices:b,vertices:v,uvs:C,topVerts:h}}function Je(e,n,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return{indices:i?e.indices:e.indices.slice().reverse(),vertices:Ve([e.points],n,a).vertices,uvs:r}}var Tt=function(e){"use strict";P(r,e);var n=R(r);function r(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};L(this,r);var t;t=n.call(this),t.type="PolygonBufferGeometry",t.parameters=(0,M.Z)({},{polygonGeoJson:i,startHeight:0,endHeight:1,closedBottom:!0,closedTop:!0,includeSides:!0,curvatureResolution:5,cartesian:!0,userDataRsoOffset:0},a);var o=t.parameters,c=o.startHeight,h=o.endHeight,v=o.closedBottom,d=o.closedTop,m=o.includeSides,_=o.curvatureResolution,b=o.cartesian,y=o.userDataRsoOffset;(0,yt.default)(i[0])||i[0].reverse();var A=kt(i,{resolution:_}),l=A.contour,C=A.triangles,E=(0,Ee.merge)(C.uvs),te=[],V=[],le=[],de=0,Ae=function(ce){var be=Math.round(te.length/3),he=le.length;te=te.concat(ce.vertices),V=V.concat(ce.uvs),le=le.concat(be?ce.indices.map(function(Ue){return Ue+be}):ce.indices),t.addGroup(he,le.length-he,de++)};if(m){var fe=Ye(l,c,h,b);Ae(fe),t.userData.rso=y?Ye(l,c,h+y,b):fe}return v&&Ae(Je(C,c,E,!1,b)),d&&Ae(Je(C,h,E,!0,b)),t.setIndex(le),t[$e]("position",new s.Float32BufferAttribute(te,3)),t[$e]("uv",new s.Float32BufferAttribute(V,2)),t.computeVertexNormals(),t}return r}(s.BufferGeometry),Rt=function(e){"use strict";P(r,e);var n=R(r);function r(a){L(this,r);var t;return t=n.call(this),t.options=(0,M.Z)({},{geojson:[[[]]],startHeight:0,height:5,closedBottom:!0,closedTop:!0,curvatureResolution:1,cartesian:!0,userDataRsoOffset:0},a),t}var i=r.prototype;return i.create=function(){var t=this.options,o=t.startHeight,c=t.height,h=t.closedBottom,v=t.closedTop,d=t.curvatureResolution,m=t.userDataRsoOffset,_=t.cartesian,b=new Tt(this.options.geojson,{startHeight:o,endHeight:o+c,closedBottom:h,closedTop:v,curvatureResolution:d,cartesian:_,userDataRsoOffset:m});this.createMesh(b,this.options.material)},r}(p),Qe=N(705);function qe(e){var n=e.split,r=e.depth,i=e.points,a=new s.ExtrudeGeometry(new s.Shape(i),{depth:r,bevelEnabled:!1,UVGenerator:(0,Qe.y)({split:n})});return(0,Qe.C)(),a}var zt=function(e){"use strict";P(r,e);var n=R(r);function r(a){L(this,r);var t;return t=n.call(this),t.options=(0,M.Z)({},a),t}var i=r.prototype;return i.create=function(){var t=this,o=this.options,c=o.points,h=o.pointsArr,v=o.coordinatesArr,d=o.material,m=o.useGroups,_=o.depth,b=o.split,y=o.workerController,A=o.projection;if(c)this.createMesh(qe({points:c,depth:_,split:b}),d);else if(h){var l=Xe.mergeBufferGeometries(h.map(function(C){return qe({points:C,depth:_,split:b})}),m!=null?m:!1);this.createMesh(l,d)}else if(v&&y)return new Promise(function(C){y.postMessage({coordinatesArr:v,depth:_,split:b,useGroups:m,projection:A},function(E){var te=new s.BufferGeometry;Object.keys(E).forEach(function(V){te.setAttribute(V,new s.BufferAttribute(E[V].array,E[V].itemSize))}),t.createMesh(te,d),C("")})})},r}(p)})();var Yt=me.Ei,Jt=me.Yo,Qt=me.Ee,qt=me.x1,er=me.VJ,tr=me.r7,rr=me.XA,nr=me.NB,ir=me.xv,ar=me.nk;export{Yt as ConicPolygon,Jt as ExtrudePolygon,Qt as Image,qt as Line,er as MeshLine,tr as MeshLineMaterial,rr as MeshLineRaycast,nr as Node,ir as Text,ar as Video};
|