gl-draw 0.8.32 → 0.8.34
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/objects/index.d.ts
CHANGED
|
@@ -7,5 +7,6 @@ export { MeshLine, MeshLineMaterial, MeshLineRaycast } from './line/meshLine';
|
|
|
7
7
|
export { default as Line } from './line';
|
|
8
8
|
export { default as getLineGeometry } from './line/getWorkerGeometry';
|
|
9
9
|
export { default as ConicPolygon } from './conicPolygon';
|
|
10
|
+
export { default as ConicPolygonGeometry } from './conicPolygon/geometry';
|
|
10
11
|
export { default as ExtrudePolygon } from './extrudePolygon';
|
|
11
12
|
export { default as getExtrudePolygonGeometry } from './extrudePolygon/getWorkerGeometry';
|
package/dist/objects/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(){var nt={666:function(L){var V=function(A){"use strict";var C=Object.prototype,j=C.hasOwnProperty,z,k=typeof Symbol=="function"?Symbol:{},Z=k.iterator||"@@iterator",F=k.asyncIterator||"@@asyncIterator",U=k.toStringTag||"@@toStringTag";function M(v,l,m){return Object.defineProperty(v,l,{value:m,enumerable:!0,configurable:!0,writable:!0}),v[l]}try{M({},"")}catch(v){M=function(l,m,S){return l[m]=S}}function N(v,l,m,S){var P=l&&l.prototype instanceof c?l:c,Y=Object.create(P.prototype),se=new W(S||[]);return Y._invoke=fe(v,m,se),Y}A.wrap=N;function $(v,l,m){try{return{type:"normal",arg:v.call(l,m)}}catch(S){return{type:"throw",arg:S}}}var q="suspendedStart",ae="suspendedYield",ve="executing",ce="completed",T={};function c(){}function O(){}function D(){}var R={};M(R,Z,function(){return this});var le=Object.getPrototypeOf,J=le&&le(le(Se([])));J&&J!==C&&j.call(J,Z)&&(R=J);var K=D.prototype=c.prototype=Object.create(R);O.prototype=D,M(K,"constructor",D),M(D,"constructor",O),O.displayName=M(D,U,"GeneratorFunction");function ee(v){["next","throw","return"].forEach(function(l){M(v,l,function(m){return this._invoke(l,m)})})}A.isGeneratorFunction=function(v){var l=typeof v=="function"&&v.constructor;return l?l===O||(l.displayName||l.name)==="GeneratorFunction":!1},A.mark=function(v){return Object.setPrototypeOf?Object.setPrototypeOf(v,D):(v.__proto__=D,M(v,U,"GeneratorFunction")),v.prototype=Object.create(K),v},A.awrap=function(v){return{__await:v}};function re(v,l){function m(Y,se,he,de){var ie=$(v[Y],v,se);if(ie.type==="throw")de(ie.arg);else{var Oe=ie.arg,Ce=Oe.value;return Ce&&typeof Ce=="object"&&j.call(Ce,"__await")?l.resolve(Ce.__await).then(function(Pe){m("next",Pe,he,de)},function(Pe){m("throw",Pe,he,de)}):l.resolve(Ce).then(function(Pe){Oe.value=Pe,he(Oe)},function(Pe){return m("throw",Pe,he,de)})}}var S;function P(Y,se){function he(){return new l(function(de,ie){m(Y,se,de,ie)})}return S=S?S.then(he,he):he()}this._invoke=P}ee(re.prototype),M(re.prototype,F,function(){return this}),A.AsyncIterator=re,A.async=function(v,l,m,S,P){P===void 0&&(P=Promise);var Y=new re(N(v,l,m,S),P);return A.isGeneratorFunction(l)?Y:Y.next().then(function(se){return se.done?se.value:Y.next()})};function fe(v,l,m){var S=q;return function(Y,se){if(S===ve)throw new Error("Generator is already running");if(S===ce){if(Y==="throw")throw se;return Te()}for(m.method=Y,m.arg=se;;){var he=m.delegate;if(he){var de=me(he,m);if(de){if(de===T)continue;return de}}if(m.method==="next")m.sent=m._sent=m.arg;else if(m.method==="throw"){if(S===q)throw S=ce,m.arg;m.dispatchException(m.arg)}else m.method==="return"&&m.abrupt("return",m.arg);S=ve;var ie=$(v,l,m);if(ie.type==="normal"){if(S=m.done?ce:ae,ie.arg===T)continue;return{value:ie.arg,done:m.done}}else ie.type==="throw"&&(S=ce,m.method="throw",m.arg=ie.arg)}}}function me(v,l){var m=v.iterator[l.method];if(m===z){if(l.delegate=null,l.method==="throw"){if(v.iterator.return&&(l.method="return",l.arg=z,me(v,l),l.method==="throw"))return T;l.method="throw",l.arg=new TypeError("The iterator does not provide a 'throw' method")}return T}var S=$(m,v.iterator,l.arg);if(S.type==="throw")return l.method="throw",l.arg=S.arg,l.delegate=null,T;var P=S.arg;if(!P)return l.method="throw",l.arg=new TypeError("iterator result is not an object"),l.delegate=null,T;if(P.done)l[v.resultName]=P.value,l.next=v.nextLoc,l.method!=="return"&&(l.method="next",l.arg=z);else return P;return l.delegate=null,T}ee(K),M(K,U,"Generator"),M(K,Z,function(){return this}),M(K,"toString",function(){return"[object Generator]"});function ne(v){var l={tryLoc:v[0]};1 in v&&(l.catchLoc=v[1]),2 in v&&(l.finallyLoc=v[2],l.afterLoc=v[3]),this.tryEntries.push(l)}function X(v){var l=v.completion||{};l.type="normal",delete l.arg,v.completion=l}function W(v){this.tryEntries=[{tryLoc:"root"}],v.forEach(ne,this),this.reset(!0)}A.keys=function(v){var l=[];for(var m in v)l.push(m);return l.reverse(),function S(){for(;l.length;){var P=l.pop();if(P in v)return S.value=P,S.done=!1,S}return S.done=!0,S}};function Se(v){if(v){var l=v[Z];if(l)return l.call(v);if(typeof v.next=="function")return v;if(!isNaN(v.length)){var m=-1,S=function P(){for(;++m<v.length;)if(j.call(v,m))return P.value=v[m],P.done=!1,P;return P.value=z,P.done=!0,P};return S.next=S}}return{next:Te}}A.values=Se;function Te(){return{value:z,done:!0}}return W.prototype={constructor:W,reset:function(v){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(X),!v)for(var l in this)l.charAt(0)==="t"&&j.call(this,l)&&!isNaN(+l.slice(1))&&(this[l]=z)},stop:function(){this.done=!0;var v=this.tryEntries[0],l=v.completion;if(l.type==="throw")throw l.arg;return this.rval},dispatchException:function(v){if(this.done)throw v;var l=this;function m(de,ie){return Y.type="throw",Y.arg=v,l.next=de,ie&&(l.method="next",l.arg=z),!!ie}for(var S=this.tryEntries.length-1;S>=0;--S){var P=this.tryEntries[S],Y=P.completion;if(P.tryLoc==="root")return m("end");if(P.tryLoc<=this.prev){var se=j.call(P,"catchLoc"),he=j.call(P,"finallyLoc");if(se&&he){if(this.prev<P.catchLoc)return m(P.catchLoc,!0);if(this.prev<P.finallyLoc)return m(P.finallyLoc)}else if(se){if(this.prev<P.catchLoc)return m(P.catchLoc,!0)}else if(he){if(this.prev<P.finallyLoc)return m(P.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(v,l){for(var m=this.tryEntries.length-1;m>=0;--m){var S=this.tryEntries[m];if(S.tryLoc<=this.prev&&j.call(S,"finallyLoc")&&this.prev<S.finallyLoc){var P=S;break}}P&&(v==="break"||v==="continue")&&P.tryLoc<=l&&l<=P.finallyLoc&&(P=null);var Y=P?P.completion:{};return Y.type=v,Y.arg=l,P?(this.method="next",this.next=P.finallyLoc,T):this.complete(Y)},complete:function(v,l){if(v.type==="throw")throw v.arg;return v.type==="break"||v.type==="continue"?this.next=v.arg:v.type==="return"?(this.rval=this.arg=v.arg,this.method="return",this.next="end"):v.type==="normal"&&l&&(this.next=l),T},finish:function(v){for(var l=this.tryEntries.length-1;l>=0;--l){var m=this.tryEntries[l];if(m.finallyLoc===v)return this.complete(m.completion,m.afterLoc),X(m),T}},catch:function(v){for(var l=this.tryEntries.length-1;l>=0;--l){var m=this.tryEntries[l];if(m.tryLoc===v){var S=m.completion;if(S.type==="throw"){var P=S.arg;X(m)}return P}}throw new Error("illegal catch attempt")},delegateYield:function(v,l,m){return this.delegate={iterator:Se(v),resultName:l,nextLoc:m},this.method==="next"&&(this.arg=z),T}},A}(L.exports);try{regeneratorRuntime=V}catch(A){typeof globalThis=="object"?globalThis.regeneratorRuntime=V:Function("r","regeneratorRuntime = r")(V)}},695:function(L,V,A){"use strict";A.d(V,{Z:function(){return C}});function C(j){if(j.geometry&&j.geometry.dispose(),j.material){var z=Array.isArray(j.material)?j.material:[j.material];z.forEach(function(k){var Z,F,U,M,N,$,q,ae,ve,ce,T,c,O;(Z=k.map)===null||Z===void 0||Z.dispose(),(F=k.lightMap)===null||F===void 0||F.dispose(),(U=k.bumpMap)===null||U===void 0||U.dispose(),(M=k.normalMap)===null||M===void 0||M.dispose(),(N=k.specularMap)===null||N===void 0||N.dispose(),($=k.envMap)===null||$===void 0||$.dispose(),(q=k.alphaMap)===null||q===void 0||q.dispose(),(ae=k.aoMap)===null||ae===void 0||ae.dispose(),(ve=k.displacementMap)===null||ve===void 0||ve.dispose(),(ce=k.emissiveMap)===null||ce===void 0||ce.dispose(),(T=k.gradientMap)===null||T===void 0||T.dispose(),(c=k.metalnessMap)===null||c===void 0||c.dispose(),(O=k.roughnessMap)===null||O===void 0||O.dispose(),k.dispose()})}}},584:function(L,V,A){"use strict";A.d(V,{disposeMesh:function(){return k.Z}});var C=A(666),j=A.n(C),z=null,k=A(695),Z=A(644);function F(T){if(T.material){var c=Array.isArray(T.material)?T.material:[T.material];c.forEach(function(O){var D,R;(D=O.color)===null||D===void 0||D.convertSRGBToLinear(),(R=O.emissive)===null||R===void 0||R.convertSRGBToLinear(),O.map&&(O.map.encoding=THREE.sRGBEncoding),O.emissiveMap&&(O.emissiveMap.encoding=THREE.sRGBEncoding)})}}var U=A(568),M=A(924),N=A(360),$=A(484),q=null,ae=null,ve=function(){var T=(0,U.Z)(j().mark(function c(O,D){var R,le,J,K,ee,re,fe,me,ne;return j().wrap(function(W){for(;;)switch(W.prev=W.next){case 0:return R=D.type,le=R===void 0?"blob":R,J=D.version,K=J===void 0?"1":J,W.next=4,(0,N.get)(O);case 4:if(re=W.sent,!(re&&re[K])){W.next=9;break}ee=re[K],W.next=15;break;case 9:return W.next=11,(0,$.Z)(fetch(O).then(function(Se){if(Se.ok)return Se[le]();throw new Error}));case 11:fe=W.sent,me=fe.res,ne=fe.err,ne||(ee=me,(0,N.set)(O,(0,M.Z)({},K,me)));case 15:return W.abrupt("return",ee?{url:le==="json"?O:URL.createObjectURL(ee),store:ee}:{url:O});case 16:case"end":return W.stop()}},c)}));return function(O,D){return T.apply(this,arguments)}}(),ce=A(705)},484:function(L,V,A){"use strict";A.d(V,{Z:function(){return j}});var C=A(42);function j(z){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return z.then(function(Z){return(0,C.Z)({err:null,res:Z},k)}).catch(function(Z){return(0,C.Z)({err:Z,res:void 0},k)})}},705:function(L,V,A){"use strict";A.d(V,{C:function(){return Z},y:function(){return k}});var C=A(644),j=A.n(C),z=new Map,k=function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{generateTopUV:function(U,M,N,$,q){var ae=M[N*3],ve=M[N*3+1],ce=M[$*3],T=M[$*3+1],c=M[q*3],O=M[q*3+1],D;if(z.has(U))D=z.get(U);else{var R=F.box3||new C.Box3;if(!F.box3){var le=U.parameters.shapes.getPoints();R.setFromArray(le.map(function(fe){return[fe.x,fe.y,0]}).flat())}var J=R.getSize(new C.Vector3);F.split&&(J.y/=F.split),D={box:R,size:J},z.set(U,D)}var K=D.box,ee=D.size,re=F.split?1-F.split:0;return[new C.Vector2((ae-K.min.x)/ee.x,(ve-K.min.y)/ee.y+re),new C.Vector2((ce-K.min.x)/ee.x,(T-K.min.y)/ee.y+re),new C.Vector2((c-K.min.x)/ee.x,(O-K.min.y)/ee.y+re)]},generateSideWallUV:function(U,M,N,$,q,ae){var ve=M[N*3],ce=M[N*3+1],T=M[N*3+2],c=M[$*3],O=M[$*3+1],D=M[$*3+2],R=M[q*3],le=M[q*3+1],J=M[q*3+2],K=M[ae*3],ee=M[ae*3+1],re=M[ae*3+2],fe;if(z.has(M))fe=z.get(M);else{var me=new C.Box3;me.setFromArray(M);var ne=me.getSize(new C.Vector3);F.split&&(ne.z/=1-F.split),fe={box:me,size:ne},z.set(M,fe)}var X=fe.box,W=fe.size;return Math.abs(ce-O)<Math.abs(ve-c)?[new C.Vector2((ve-X.min.x)/W.x,(T-X.min.z)/W.z),new C.Vector2((c-X.min.x)/W.x,(D-X.min.z)/W.z),new C.Vector2((R-X.min.x)/W.x,(J-X.min.z)/W.z),new C.Vector2((K-X.min.x)/W.x,(re-X.min.z)/W.z)]:[new C.Vector2((ce-X.min.y)/W.y,(T-X.min.z)/W.z),new C.Vector2((O-X.min.y)/W.y,(D-X.min.z)/W.z),new C.Vector2((le-X.min.y)/W.y,(J-X.min.z)/W.z),new C.Vector2((ee-X.min.y)/W.y,(re-X.min.z)/W.z)]}}},Z=function(){z.clear()}},360:function(L){"use strict";L.exports=require("idb-keyval")},644:function(L){"use strict";L.exports=require("three")},568:function(L,V,A){"use strict";A.d(V,{Z:function(){return j}});function C(z,k,Z,F,U,M,N){try{var $=z[M](N),q=$.value}catch(ae){Z(ae);return}$.done?k(q):Promise.resolve(q).then(F,U)}function j(z){return function(){var k=this,Z=arguments;return new Promise(function(F,U){var M=z.apply(k,Z);function N(q){C(M,F,U,N,$,"next",q)}function $(q){C(M,F,U,N,$,"throw",q)}N(void 0)})}}},924:function(L,V,A){"use strict";A.d(V,{Z:function(){return C}});function C(j,z,k){return z in j?Object.defineProperty(j,z,{value:k,enumerable:!0,configurable:!0,writable:!0}):j[z]=k,j}},42:function(L,V,A){"use strict";A.d(V,{Z:function(){return j}});var C=A(924);function j(z){for(var k=1;k<arguments.length;k++){var Z=arguments[k]!=null?arguments[k]:{},F=Object.keys(Z);typeof Object.getOwnPropertySymbols=="function"&&(F=F.concat(Object.getOwnPropertySymbols(Z).filter(function(U){return Object.getOwnPropertyDescriptor(Z,U).enumerable}))),F.forEach(function(U){(0,C.Z)(z,U,Z[U])})}return z}}},Ne={};function Q(L){var V=Ne[L];if(V!==void 0)return V.exports;var A=Ne[L]={exports:{}};return nt[L](A,A.exports,Q),A.exports}(function(){Q.n=function(L){var V=L&&L.__esModule?function(){return L.default}:function(){return L};return Q.d(V,{a:V}),V}})(),function(){Q.d=function(L,V){for(var A in V)Q.o(V,A)&&!Q.o(L,A)&&Object.defineProperty(L,A,{enumerable:!0,get:V[A]})}}(),function(){Q.o=function(L,V){return Object.prototype.hasOwnProperty.call(L,V)}}(),function(){Q.r=function(L){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(L,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(L,"__esModule",{value:!0})}}();var Ve={};(function(){"use strict";Q.r(Ve),Q.d(Ve,{ConicPolygon:function(){return kt},ExtrudePolygon:function(){return Tt},Group:function(){return at},Image:function(){return se},Line:function(){return vt},MeshLine:function(){return xe},MeshLineMaterial:function(){return De},MeshLineRaycast:function(){return Ke},Node:function(){return it},Text:function(){return he},Video:function(){return Ce},getExtrudePolygonGeometry:function(){return Et},getLineGeometry:function(){return dt}});function L(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")}function V(t,i){return V=Object.setPrototypeOf||function(n,a){return n.__proto__=a,n},V(t,i)}function A(t,i){return V(t,i)}function C(t,i){if(typeof i!="function"&&i!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(i&&i.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),i&&A(t,i)}var j=Q(42);function z(){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(t){return!1}}function k(t,i,r){return z()?k=Reflect.construct:k=function(a,e,o){var s=[null];s.push.apply(s,e);var f=Function.bind.apply(a,s),h=new f;return o&&A(h,o.prototype),h},k.apply(null,arguments)}function Z(t,i,r){return k.apply(null,arguments)}function F(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function U(t){return U=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},U(t)}function M(t){return U(t)}function N(t){var i=typeof Map=="function"?new Map:void 0;return N=function(n){if(n===null||!F(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof i!="undefined"){if(i.has(n))return i.get(n);i.set(n,a)}function a(){return Z(n,arguments,M(this).constructor)}return a.prototype=Object.create(n.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),A(a,n)},N(t)}function $(t){return N(t)}function q(){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(t){return!1}}function ae(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ve(t){return t&&t.constructor===Symbol?"symbol":typeof t}function ce(t,i){return i&&(ve(i)==="object"||typeof i=="function")?i:ae(t)}function T(t){var i=q();return function(){var n=M(t),a;if(i){var e=M(this).constructor;a=Reflect.construct(n,arguments,e)}else a=n.apply(this,arguments);return ce(this,a)}}var c=Q(644),O=Q(568),D=Q(666),R=Q.n(D);function le(t,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(t,n.key,n)}}function J(t,i,r){return i&&le(t.prototype,i),r&&le(t,r),t}function K(t,i){(i==null||i>t.length)&&(i=t.length);for(var r=0,n=new Array(i);r<i;r++)n[r]=t[r];return n}function ee(t){if(Array.isArray(t))return K(t)}function re(t){if(typeof Symbol!="undefined"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function fe(){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 me(t,i){if(!!t){if(typeof t=="string")return K(t,i);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return K(t,i)}}function ne(t){return ee(t)||re(t)||me(t)||fe()}var X=Q(484);function W(){var t=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}),t&&(r.promise=(0,X.Z)(r.promise,i)),r}var Se=require("three/examples/jsm/renderers/CSS2DRenderer"),Te=require("three/examples/jsm/renderers/CSS3DRenderer"),v=Q(584),l=function(t){t&&((0,v.disposeMesh)(t),t.children.forEach(function(i){i.userData.BaseObject_||l(i)}))},m=function(){"use strict";function t(){L(this,t),this.objecttype__="BaseObject",this.userData={},this.pm=W(),this.visible=!1}var i=t.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),e=0;e<n;e++)a[e]=arguments[e];return this.object3d=Z(c.Mesh,ne(a)),this},i.createGroup=function(){return this.object3d=new c.Group,this},i.createPoints=function(){for(var n=arguments.length,a=new Array(n),e=0;e<n;e++)a[e]=arguments[e];return this.object3d=Z(c.Points,ne(a)),this},i.createCSS2DObject=function(n){return this.object3d=new Se.CSS2DObject(n),this},i.createCSS3DObject=function(n){return this.object3d=new Te.CSS3DObject(n),this},i.createCSS3DSprite=function(n){return this.object3d=new Te.CSS3DSprite(n),this},i.createSprite=function(n){return this.object3d=new c.Sprite(n),this},i.add=function(){for(var n=arguments.length,a=new Array(n),e=0;e<n;e++)a[e]=arguments[e];var o;return(o=this.object3d).add.apply(o,ne(a)),this},i.remove=function(){for(var n=arguments.length,a=new Array(n),e=0;e<n;e++)a[e]=arguments[e];var o;return(o=this.object3d).remove.apply(o,ne(a)),this},i.getSize=function(){var n=new c.Box3().setFromObject(this.object3d);return{min:n.min,max:n.max,size:n.getSize(new c.Vector3)}},i.traverse=function(n){n(this),this.children.forEach(function(a){a.traverse(n)})},i.dispose=function(){l(this.object3d)},J(t,[{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})}}]),t}(),S=+c.REVISION<144,P=S?"ExtrudeBufferGeometry":"ExtrudeGeometry",Y=S?"PlaneBufferGeometry":"PlaneGeometry",se=function(t){"use strict";C(r,t);var i=T(r);function r(a){L(this,r);var e;return e=i.call(this),e.scale=1,e.options=(0,j.Z)({},{scale:1},a),e}var n=r.prototype;return n.getMaterial=function(){var e=this;return(0,O.Z)(R().mark(function o(){var s,f,h,p,d,b,w,_,y,u;return R().wrap(function(x){for(;;)switch(x.prev=x.next){case 0:return s=e.options,f=s.transparent,h=s.blending,p=s.depthWrite,d=s.depthTest,b=s.alphaTest,w=s.sprite,_=s.sizeAttenuation,x.next=3,e.getTexture();case 3:return y=x.sent,u=w?new c.SpriteMaterial({map:y,transparent:f!=null?f:!1,blending:h!=null?h:c.NormalBlending,depthWrite:p!=null?p:!0,depthTest:d!=null?d:!0,alphaTest:b!=null?b:0,sizeAttenuation:_!=null?_:!0}):new c.MeshBasicMaterial({map:y,transparent:f!=null?f:!1,blending:h!=null?h:c.NormalBlending,depthWrite:p!=null?p:!0,depthTest:d!=null?d:!0,alphaTest:b!=null?b:0}),x.abrupt("return",u);case 6:case"end":return x.stop()}},o)}))()},n.create=function(){var e=this;return(0,O.Z)(R().mark(function o(){var s,f,h,p,d,b,w,_,y;return R().wrap(function(g){for(;;)switch(g.prev=g.next){case 0:if(s=e.options,f=s.scale,h=s.position,p=s.src,d=s.cache,b=s.sprite,w=p,!(d&&!d.get(w))){g.next=8;break}return d.init(w),g.next=6,e.getMaterial();case 6:_=g.sent,d.set(w,_);case 8:if(!d){g.next=14;break}return g.next=11,d.get(w);case 11:g.t0=g.sent,g.next=17;break;case 14:return g.next=16,e.getMaterial();case 16:g.t0=g.sent;case 17:y=g.t0,e.texture=y.map,b?e.createSprite(y):e.createMesh(new c[Y](1,1),y),e.setScale(f),h&&e.object3d.position.copy(h);case 22:case"end":return g.stop()}},o)}))()},n.setScale=function(e){this.scale=e,this.object3d.scale.set(this.texture.image.width*e,this.texture.image.height*e,1)},n.setTexture=function(e){var o=this.object3d;o.material.map&&o.material.map.dispose(),o.material.map=e,o.material.needsUpdate=!0,this.texture=e,this.setScale(this.scale)},n.getTexture=function(){var e=this.options.src;return new c.TextureLoader().loadAsync(e)},r}(m),he=function(t){"use strict";C(r,t);var i=T(r);function r(a){L(this,r);var e;return e=i.call(this,a),e.canvas=document.createElement("canvas"),e}var n=r.prototype;return n.getTexture=function(){var e=this.options,o=e.text,s=e.textOptions,f=(0,j.Z)({},{fontSize:28,fontFamily:"system-ui,-apple-system,BlinkMacSystemFont,sans-serif",fontWeight:"normal",flipX:!1,color:"#ffffff",setCtx:function(E){}},s||{}),h=f.fontSize,p=f.fontFamily,d=f.fontWeight,b=f.flipX,w=f.color,_=f.setCtx,y=this.canvas;y.width=h*o.length*2,y.height=h;var u=y.getContext("2d");u.font="".concat(d," ").concat(h,"px/1 ").concat(p);var g=u.measureText(o).width;y.width=g,u=y.getContext("2d"),u.clearRect(0,0,y.width,y.height),b&&u.scale(-1,1),u.font="".concat(d," ").concat(h,"px/1 ").concat(p),u.textBaseline="middle",u.fillStyle=w,_&&_(u),u.fillText(o,b?g*-1:0,y.height/2),u.restore();var x=new c.Texture(y);return x.anisotropy=this.pencil.renderer.capabilities.getMaxAnisotropy(),x.needsUpdate=!0,Promise.resolve(x)},r}($(se));function de(t,i){for(;!Object.prototype.hasOwnProperty.call(t,i)&&(t=M(t),t!==null););return t}function ie(t,i,r){return typeof Reflect!="undefined"&&Reflect.get?ie=Reflect.get:ie=function(a,e,o){var s=de(a,e);if(!!s){var f=Object.getOwnPropertyDescriptor(s,e);return f.get?f.get.call(o||a):f.value}},ie(t,i,r)}function Oe(t,i,r){return ie(t,i,r)}var Ce=function(t){"use strict";C(r,t);var i=T(r);function r(a){L(this,r);var e;return e=i.call(this),e.scale=1,e.options=(0,j.Z)({},{scale:1,autoPlay:!0,loop:!0},a),e}var n=r.prototype;return n.getMaterial=function(){var e=this.options,o=e.src,s=e.transparent,f=e.blending,h=e.depthWrite,p=e.depthTest,d=e.format,b=e.autoPlay,w=e.loop,_=e.alphaTest,y=e.sprite,u=W(),g=document.createElement("video");return g.addEventListener("loadedmetadata",function(){var x=new c.VideoTexture(g);x.format=d!=null?d:c.RGBAFormat,x.needsUpdate=!0;var E=y?new c.SpriteMaterial({map:x,transparent:s!=null?s:!1,blending:f!=null?f:c.NormalBlending,depthWrite:h!=null?h:!0,depthTest:p!=null?p:!0,alphaTest:_!=null?_:0}):new c.MeshBasicMaterial({map:x,transparent:s!=null?s:!1,blending:f!=null?f:c.NormalBlending,depthWrite:h!=null?h:!0,depthTest:p!=null?p:!0,alphaTest:_!=null?_:0});u.resolve(E)},!1),g.src=o,g.muted=!0,g.autoplay=b,g.loop=w,g.preload="auto",u.promise},n.create=function(){var e=this;return(0,O.Z)(R().mark(function o(){var s,f,h,p,d,b,w,_;return R().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(s=e.options,f=s.scale,h=s.position,p=s.src,d=s.cache,b=s.sprite,!(d&&!d.get(p))){u.next=7;break}return d.init(p),u.next=5,e.getMaterial();case 5:w=u.sent,d.set(p,w);case 7:if(!d){u.next=13;break}return u.next=10,d.get(p);case 10:u.t0=u.sent,u.next=16;break;case 13:return u.next=15,e.getMaterial();case 15:u.t0=u.sent;case 16:_=u.t0,e.video=_.map.image,b?e.createSprite(_):e.createMesh(new c[Y](1,1),_),e.setScale(f),h&&e.object3d.position.copy(h);case 21:case"end":return u.stop()}},o)}))()},n.setScale=function(e){this.scale=e,this.object3d.scale.set(this.video.videoWidth*e,this.video.videoHeight*e,1)},n.render=function(){var e=this.options.autoPlay;e&&this.video.play()},n.dispose=function(){this.video.pause(),this.video.src="",this.video.load(),Oe(M(r.prototype),"dispose",this).call(this)},r}(m),Pe=function(t){"use strict";C(r,t);var i=T(r);function r(a){L(this,r);var e;return e=i.call(this),e.type_="node",e.options=(0,j.Z)({},{event:"click"},a),e}var n=r.prototype;return n.create=function(){var e=this.options,o=e.position,s=e.children,f=e.handler,h=e.event,p=document.createElement("div");this.element=p,p.appendChild(s),this.createCSS2DObject(p),o&&this.object3d.position.copy(o),f&&h&&this.clickTarge.forEach(function(d){var b=Array.isArray(h)?h:[h],w=Array.isArray(f)?f:[f];b.forEach(function(_,y){var u=w[y];u&&d.addEventListener(_,u)})})},n.getMaterial=function(e){return(0,O.Z)(R().mark(function o(){var s,f,h,p;return R().wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return s=document.createElement("canvas"),s.width=256,s.height=256,f=s.getContext("2d"),f.fillStyle="#ff0000",f.fillRect(0,0,256,256),h=new c.CanvasTexture(s),p=new c.SpriteMaterial({map:h,opacity:e?1:0,transparent:!0,alphaTest:.1,sizeAttenuation:!1}),b.abrupt("return",p);case 9:case"end":return b.stop()}},o)}))()},n.createPickObject=function(e){var o=e.show,s=o===void 0?!1:o,f=e.scale,h=f===void 0?new c.Vector3(1,1,1):f,p=e.position,d=p===void 0?new c.Vector3(0,0,0):p,b=e.cache,w=this;return(0,O.Z)(R().mark(function _(){var y,u,g,x;return R().wrap(function(B){for(;;)switch(B.prev=B.next){case 0:if(y="node-create-pick-object",!(b&&!b.get(y))){B.next=7;break}return b.init(y),B.next=5,w.getMaterial(s);case 5:u=B.sent,b.set(y,u);case 7:if(!b){B.next=13;break}return B.next=10,b.get(y);case 10:B.t0=B.sent,B.next=16;break;case 13:return B.next=15,w.getMaterial(s);case 15:B.t0=B.sent;case 16:g=B.t0,x=new c.Sprite(g),x.scale.set(g.map.image.width*h.x,g.map.image.height*h.y,1),x.position.copy(d),w.add(x),w.pickObject=x;case 22:case"end":return B.stop()}},_)}))()},n.dispose=function(){var e=this.options,o=e.handler,s=e.event;o&&s&&this.clickTarge.forEach(function(f){var h=Array.isArray(s)?s:[s],p=Array.isArray(o)?o:[o];h.forEach(function(d,b){var w=p[b];w&&f.removeEventListener(d,w)})}),Oe(M(r.prototype),"dispose",this).call(this)},J(r,[{key:"clickTarge",get:function(){var e=this,o=this.options.eventTarge;if(o){var s=o.map(function(f){return ne(e.element.querySelectorAll(f))}).flat();return s}return[this.element]}}]),r}(m),it=Pe,at=function(t){"use strict";C(r,t);var i=T(r);function r(){return L(this,r),i.apply(this,arguments)}var n=r.prototype;return n.create=function(){this.createGroup()},r}(m),ot=`
|
|
1
|
+
(function(){var it={666:function(T){var z=function(x){"use strict";var C=Object.prototype,j=C.hasOwnProperty,G,k=typeof Symbol=="function"?Symbol:{},Z=k.iterator||"@@iterator",I=k.asyncIterator||"@@asyncIterator",D=k.toStringTag||"@@toStringTag";function _(p,l,d){return Object.defineProperty(p,l,{value:d,enumerable:!0,configurable:!0,writable:!0}),p[l]}try{_({},"")}catch(p){_=function(l,d,P){return l[d]=P}}function F(p,l,d,P){var A=l&&l.prototype instanceof c?l:c,X=Object.create(A.prototype),se=new B(P||[]);return X._invoke=le(p,d,se),X}x.wrap=F;function H(p,l,d){try{return{type:"normal",arg:p.call(l,d)}}catch(P){return{type:"throw",arg:P}}}var $="suspendedStart",ae="suspendedYield",he="executing",ue="completed",E={};function c(){}function O(){}function W(){}var R={};_(R,Z,function(){return this});var ce=Object.getPrototypeOf,ee=ce&&ce(ce(Se([])));ee&&ee!==C&&j.call(ee,Z)&&(R=ee);var N=W.prototype=c.prototype=Object.create(R);O.prototype=W,_(N,"constructor",W),_(W,"constructor",O),O.displayName=_(W,D,"GeneratorFunction");function te(p){["next","throw","return"].forEach(function(l){_(p,l,function(d){return this._invoke(l,d)})})}x.isGeneratorFunction=function(p){var l=typeof p=="function"&&p.constructor;return l?l===O||(l.displayName||l.name)==="GeneratorFunction":!1},x.mark=function(p){return Object.setPrototypeOf?Object.setPrototypeOf(p,W):(p.__proto__=W,_(p,D,"GeneratorFunction")),p.prototype=Object.create(N),p},x.awrap=function(p){return{__await:p}};function re(p,l){function d(X,se,fe,pe){var ie=H(p[X],p,se);if(ie.type==="throw")pe(ie.arg);else{var Oe=ie.arg,Ce=Oe.value;return Ce&&typeof Ce=="object"&&j.call(Ce,"__await")?l.resolve(Ce.__await).then(function(Ae){d("next",Ae,fe,pe)},function(Ae){d("throw",Ae,fe,pe)}):l.resolve(Ce).then(function(Ae){Oe.value=Ae,fe(Oe)},function(Ae){return d("throw",Ae,fe,pe)})}}var P;function A(X,se){function fe(){return new l(function(pe,ie){d(X,se,pe,ie)})}return P=P?P.then(fe,fe):fe()}this._invoke=A}te(re.prototype),_(re.prototype,I,function(){return this}),x.AsyncIterator=re,x.async=function(p,l,d,P,A){A===void 0&&(A=Promise);var X=new re(F(p,l,d,P),A);return x.isGeneratorFunction(l)?X:X.next().then(function(se){return se.done?se.value:X.next()})};function le(p,l,d){var P=$;return function(X,se){if(P===he)throw new Error("Generator is already running");if(P===ue){if(X==="throw")throw se;return Te()}for(d.method=X,d.arg=se;;){var fe=d.delegate;if(fe){var pe=me(fe,d);if(pe){if(pe===E)continue;return pe}}if(d.method==="next")d.sent=d._sent=d.arg;else if(d.method==="throw"){if(P===$)throw P=ue,d.arg;d.dispatchException(d.arg)}else d.method==="return"&&d.abrupt("return",d.arg);P=he;var ie=H(p,l,d);if(ie.type==="normal"){if(P=d.done?ue:ae,ie.arg===E)continue;return{value:ie.arg,done:d.done}}else ie.type==="throw"&&(P=ue,d.method="throw",d.arg=ie.arg)}}}function me(p,l){var d=p.iterator[l.method];if(d===G){if(l.delegate=null,l.method==="throw"){if(p.iterator.return&&(l.method="return",l.arg=G,me(p,l),l.method==="throw"))return E;l.method="throw",l.arg=new TypeError("The iterator does not provide a 'throw' method")}return E}var P=H(d,p.iterator,l.arg);if(P.type==="throw")return l.method="throw",l.arg=P.arg,l.delegate=null,E;var A=P.arg;if(!A)return l.method="throw",l.arg=new TypeError("iterator result is not an object"),l.delegate=null,E;if(A.done)l[p.resultName]=A.value,l.next=p.nextLoc,l.method!=="return"&&(l.method="next",l.arg=G);else return A;return l.delegate=null,E}te(N),_(N,D,"Generator"),_(N,Z,function(){return this}),_(N,"toString",function(){return"[object Generator]"});function ne(p){var l={tryLoc:p[0]};1 in p&&(l.catchLoc=p[1]),2 in p&&(l.finallyLoc=p[2],l.afterLoc=p[3]),this.tryEntries.push(l)}function q(p){var l=p.completion||{};l.type="normal",delete l.arg,p.completion=l}function B(p){this.tryEntries=[{tryLoc:"root"}],p.forEach(ne,this),this.reset(!0)}x.keys=function(p){var l=[];for(var d in p)l.push(d);return l.reverse(),function P(){for(;l.length;){var A=l.pop();if(A in p)return P.value=A,P.done=!1,P}return P.done=!0,P}};function Se(p){if(p){var l=p[Z];if(l)return l.call(p);if(typeof p.next=="function")return p;if(!isNaN(p.length)){var d=-1,P=function A(){for(;++d<p.length;)if(j.call(p,d))return A.value=p[d],A.done=!1,A;return A.value=G,A.done=!0,A};return P.next=P}}return{next:Te}}x.values=Se;function Te(){return{value:G,done:!0}}return B.prototype={constructor:B,reset:function(p){if(this.prev=0,this.next=0,this.sent=this._sent=G,this.done=!1,this.delegate=null,this.method="next",this.arg=G,this.tryEntries.forEach(q),!p)for(var l in this)l.charAt(0)==="t"&&j.call(this,l)&&!isNaN(+l.slice(1))&&(this[l]=G)},stop:function(){this.done=!0;var p=this.tryEntries[0],l=p.completion;if(l.type==="throw")throw l.arg;return this.rval},dispatchException:function(p){if(this.done)throw p;var l=this;function d(pe,ie){return X.type="throw",X.arg=p,l.next=pe,ie&&(l.method="next",l.arg=G),!!ie}for(var P=this.tryEntries.length-1;P>=0;--P){var A=this.tryEntries[P],X=A.completion;if(A.tryLoc==="root")return d("end");if(A.tryLoc<=this.prev){var se=j.call(A,"catchLoc"),fe=j.call(A,"finallyLoc");if(se&&fe){if(this.prev<A.catchLoc)return d(A.catchLoc,!0);if(this.prev<A.finallyLoc)return d(A.finallyLoc)}else if(se){if(this.prev<A.catchLoc)return d(A.catchLoc,!0)}else if(fe){if(this.prev<A.finallyLoc)return d(A.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(p,l){for(var d=this.tryEntries.length-1;d>=0;--d){var P=this.tryEntries[d];if(P.tryLoc<=this.prev&&j.call(P,"finallyLoc")&&this.prev<P.finallyLoc){var A=P;break}}A&&(p==="break"||p==="continue")&&A.tryLoc<=l&&l<=A.finallyLoc&&(A=null);var X=A?A.completion:{};return X.type=p,X.arg=l,A?(this.method="next",this.next=A.finallyLoc,E):this.complete(X)},complete:function(p,l){if(p.type==="throw")throw p.arg;return p.type==="break"||p.type==="continue"?this.next=p.arg:p.type==="return"?(this.rval=this.arg=p.arg,this.method="return",this.next="end"):p.type==="normal"&&l&&(this.next=l),E},finish:function(p){for(var l=this.tryEntries.length-1;l>=0;--l){var d=this.tryEntries[l];if(d.finallyLoc===p)return this.complete(d.completion,d.afterLoc),q(d),E}},catch:function(p){for(var l=this.tryEntries.length-1;l>=0;--l){var d=this.tryEntries[l];if(d.tryLoc===p){var P=d.completion;if(P.type==="throw"){var A=P.arg;q(d)}return A}}throw new Error("illegal catch attempt")},delegateYield:function(p,l,d){return this.delegate={iterator:Se(p),resultName:l,nextLoc:d},this.method==="next"&&(this.arg=G),E}},x}(T.exports);try{regeneratorRuntime=z}catch(x){typeof globalThis=="object"?globalThis.regeneratorRuntime=z:Function("r","regeneratorRuntime = r")(z)}},695:function(T,z,x){"use strict";x.d(z,{Z:function(){return C}});function C(j){if(j.geometry&&j.geometry.dispose(),j.material){var G=Array.isArray(j.material)?j.material:[j.material];G.forEach(function(k){var Z,I,D,_,F,H,$,ae,he,ue,E,c,O;(Z=k.map)===null||Z===void 0||Z.dispose(),(I=k.lightMap)===null||I===void 0||I.dispose(),(D=k.bumpMap)===null||D===void 0||D.dispose(),(_=k.normalMap)===null||_===void 0||_.dispose(),(F=k.specularMap)===null||F===void 0||F.dispose(),(H=k.envMap)===null||H===void 0||H.dispose(),($=k.alphaMap)===null||$===void 0||$.dispose(),(ae=k.aoMap)===null||ae===void 0||ae.dispose(),(he=k.displacementMap)===null||he===void 0||he.dispose(),(ue=k.emissiveMap)===null||ue===void 0||ue.dispose(),(E=k.gradientMap)===null||E===void 0||E.dispose(),(c=k.metalnessMap)===null||c===void 0||c.dispose(),(O=k.roughnessMap)===null||O===void 0||O.dispose(),k.dispose()})}}},584:function(T,z,x){"use strict";x.d(z,{disposeMesh:function(){return k.Z}});var C=x(666),j=x.n(C),G=null,k=x(695),Z=x(644);function I(E){if(E.material){var c=Array.isArray(E.material)?E.material:[E.material];c.forEach(function(O){var W,R;(W=O.color)===null||W===void 0||W.convertSRGBToLinear(),(R=O.emissive)===null||R===void 0||R.convertSRGBToLinear(),O.map&&(O.map.encoding=THREE.sRGBEncoding),O.emissiveMap&&(O.emissiveMap.encoding=THREE.sRGBEncoding)})}}var D=x(568),_=x(924),F=x(360),H=x(484),$=null,ae=null,he=function(){var E=(0,D.Z)(j().mark(function c(O,W){var R,ce,ee,N,te,re,le,me,ne;return j().wrap(function(B){for(;;)switch(B.prev=B.next){case 0:return R=W.type,ce=R===void 0?"blob":R,ee=W.version,N=ee===void 0?"1":ee,B.next=4,(0,F.get)(O);case 4:if(re=B.sent,!(re&&re[N])){B.next=9;break}te=re[N],B.next=15;break;case 9:return B.next=11,(0,H.Z)(fetch(O).then(function(Se){if(Se.ok)return Se[ce]();throw new Error}));case 11:le=B.sent,me=le.res,ne=le.err,ne||(te=me,(0,F.set)(O,(0,_.Z)({},N,me)));case 15:return B.abrupt("return",te?{url:ce==="json"?O:URL.createObjectURL(te),store:te}:{url:O});case 16:case"end":return B.stop()}},c)}));return function(O,W){return E.apply(this,arguments)}}(),ue=x(705)},484:function(T,z,x){"use strict";x.d(z,{Z:function(){return j}});var C=x(42);function j(G){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return G.then(function(Z){return(0,C.Z)({err:null,res:Z},k)}).catch(function(Z){return(0,C.Z)({err:Z,res:void 0},k)})}},705:function(T,z,x){"use strict";x.d(z,{C:function(){return Z},y:function(){return k}});var C=x(644),j=x.n(C),G=new Map,k=function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{generateTopUV:function(D,_,F,H,$){var ae=_[F*3],he=_[F*3+1],ue=_[H*3],E=_[H*3+1],c=_[$*3],O=_[$*3+1],W;if(G.has(D))W=G.get(D);else{var R=I.box3||new C.Box3;if(!I.box3){var ce=D.parameters.shapes.getPoints();R.setFromArray(ce.map(function(le){return[le.x,le.y,0]}).flat())}var ee=R.getSize(new C.Vector3);I.split&&(ee.y/=I.split),W={box:R,size:ee},G.set(D,W)}var N=W.box,te=W.size,re=I.split?1-I.split:0;return[new C.Vector2((ae-N.min.x)/te.x,(he-N.min.y)/te.y+re),new C.Vector2((ue-N.min.x)/te.x,(E-N.min.y)/te.y+re),new C.Vector2((c-N.min.x)/te.x,(O-N.min.y)/te.y+re)]},generateSideWallUV:function(D,_,F,H,$,ae){var he=_[F*3],ue=_[F*3+1],E=_[F*3+2],c=_[H*3],O=_[H*3+1],W=_[H*3+2],R=_[$*3],ce=_[$*3+1],ee=_[$*3+2],N=_[ae*3],te=_[ae*3+1],re=_[ae*3+2],le;if(G.has(_))le=G.get(_);else{var me=new C.Box3;me.setFromArray(_);var ne=me.getSize(new C.Vector3);I.split&&(ne.z/=1-I.split),le={box:me,size:ne},G.set(_,le)}var q=le.box,B=le.size;return Math.abs(ue-O)<Math.abs(he-c)?[new C.Vector2((he-q.min.x)/B.x,(E-q.min.z)/B.z),new C.Vector2((c-q.min.x)/B.x,(W-q.min.z)/B.z),new C.Vector2((R-q.min.x)/B.x,(ee-q.min.z)/B.z),new C.Vector2((N-q.min.x)/B.x,(re-q.min.z)/B.z)]:[new C.Vector2((ue-q.min.y)/B.y,(E-q.min.z)/B.z),new C.Vector2((O-q.min.y)/B.y,(W-q.min.z)/B.z),new C.Vector2((ce-q.min.y)/B.y,(ee-q.min.z)/B.z),new C.Vector2((te-q.min.y)/B.y,(re-q.min.z)/B.z)]}}},Z=function(){G.clear()}},360:function(T){"use strict";T.exports=require("idb-keyval")},644:function(T){"use strict";T.exports=require("three")},568:function(T,z,x){"use strict";x.d(z,{Z:function(){return j}});function C(G,k,Z,I,D,_,F){try{var H=G[_](F),$=H.value}catch(ae){Z(ae);return}H.done?k($):Promise.resolve($).then(I,D)}function j(G){return function(){var k=this,Z=arguments;return new Promise(function(I,D){var _=G.apply(k,Z);function F($){C(_,I,D,F,H,"next",$)}function H($){C(_,I,D,F,H,"throw",$)}F(void 0)})}}},924:function(T,z,x){"use strict";x.d(z,{Z:function(){return C}});function C(j,G,k){return G in j?Object.defineProperty(j,G,{value:k,enumerable:!0,configurable:!0,writable:!0}):j[G]=k,j}},42:function(T,z,x){"use strict";x.d(z,{Z:function(){return j}});var C=x(924);function j(G){for(var k=1;k<arguments.length;k++){var Z=arguments[k]!=null?arguments[k]:{},I=Object.keys(Z);typeof Object.getOwnPropertySymbols=="function"&&(I=I.concat(Object.getOwnPropertySymbols(Z).filter(function(D){return Object.getOwnPropertyDescriptor(Z,D).enumerable}))),I.forEach(function(D){(0,C.Z)(G,D,Z[D])})}return G}}},Fe={};function Y(T){var z=Fe[T];if(z!==void 0)return z.exports;var x=Fe[T]={exports:{}};return it[T](x,x.exports,Y),x.exports}(function(){Y.n=function(T){var z=T&&T.__esModule?function(){return T.default}:function(){return T};return Y.d(z,{a:z}),z}})(),function(){Y.d=function(T,z){for(var x in z)Y.o(z,x)&&!Y.o(T,x)&&Object.defineProperty(T,x,{enumerable:!0,get:z[x]})}}(),function(){Y.o=function(T,z){return Object.prototype.hasOwnProperty.call(T,z)}}(),function(){Y.r=function(T){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(T,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(T,"__esModule",{value:!0})}}();var Be={};(function(){"use strict";Y.r(Be),Y.d(Be,{ConicPolygon:function(){return Tt},ConicPolygonGeometry:function(){return Je},ExtrudePolygon:function(){return kt},Group:function(){return ot},Image:function(){return se},Line:function(){return dt},MeshLine:function(){return we},MeshLineMaterial:function(){return We},MeshLineRaycast:function(){return Ne},Node:function(){return at},Text:function(){return fe},Video:function(){return Ce},getExtrudePolygonGeometry:function(){return Et},getLineGeometry:function(){return mt}});function T(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")}function z(t,i){return z=Object.setPrototypeOf||function(n,a){return n.__proto__=a,n},z(t,i)}function x(t,i){return z(t,i)}function C(t,i){if(typeof i!="function"&&i!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(i&&i.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),i&&x(t,i)}var j=Y(42);function G(){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(t){return!1}}function k(t,i,r){return G()?k=Reflect.construct:k=function(a,e,o){var s=[null];s.push.apply(s,e);var f=Function.bind.apply(a,s),h=new f;return o&&x(h,o.prototype),h},k.apply(null,arguments)}function Z(t,i,r){return k.apply(null,arguments)}function I(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function D(t){return D=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},D(t)}function _(t){return D(t)}function F(t){var i=typeof Map=="function"?new Map:void 0;return F=function(n){if(n===null||!I(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof i!="undefined"){if(i.has(n))return i.get(n);i.set(n,a)}function a(){return Z(n,arguments,_(this).constructor)}return a.prototype=Object.create(n.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),x(a,n)},F(t)}function H(t){return F(t)}function $(){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(t){return!1}}function ae(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function he(t){return t&&t.constructor===Symbol?"symbol":typeof t}function ue(t,i){return i&&(he(i)==="object"||typeof i=="function")?i:ae(t)}function E(t){var i=$();return function(){var n=_(t),a;if(i){var e=_(this).constructor;a=Reflect.construct(n,arguments,e)}else a=n.apply(this,arguments);return ue(this,a)}}var c=Y(644),O=Y(568),W=Y(666),R=Y.n(W);function ce(t,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(t,n.key,n)}}function ee(t,i,r){return i&&ce(t.prototype,i),r&&ce(t,r),t}function N(t,i){(i==null||i>t.length)&&(i=t.length);for(var r=0,n=new Array(i);r<i;r++)n[r]=t[r];return n}function te(t){if(Array.isArray(t))return N(t)}function re(t){if(typeof Symbol!="undefined"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function le(){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 me(t,i){if(!!t){if(typeof t=="string")return N(t,i);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return N(t,i)}}function ne(t){return te(t)||re(t)||me(t)||le()}var q=Y(484);function B(){var t=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}),t&&(r.promise=(0,q.Z)(r.promise,i)),r}var Se=require("three/examples/jsm/renderers/CSS2DRenderer"),Te=require("three/examples/jsm/renderers/CSS3DRenderer"),p=Y(584),l=function(t){t&&((0,p.disposeMesh)(t),t.children.forEach(function(i){i.userData.BaseObject_||l(i)}))},d=function(){"use strict";function t(){T(this,t),this.objecttype__="BaseObject",this.userData={},this.pm=B(),this.visible=!1}var i=t.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),e=0;e<n;e++)a[e]=arguments[e];return this.object3d=Z(c.Mesh,ne(a)),this},i.createGroup=function(){return this.object3d=new c.Group,this},i.createPoints=function(){for(var n=arguments.length,a=new Array(n),e=0;e<n;e++)a[e]=arguments[e];return this.object3d=Z(c.Points,ne(a)),this},i.createCSS2DObject=function(n){return this.object3d=new Se.CSS2DObject(n),this},i.createCSS3DObject=function(n){return this.object3d=new Te.CSS3DObject(n),this},i.createCSS3DSprite=function(n){return this.object3d=new Te.CSS3DSprite(n),this},i.createSprite=function(n){return this.object3d=new c.Sprite(n),this},i.add=function(){for(var n=arguments.length,a=new Array(n),e=0;e<n;e++)a[e]=arguments[e];var o;return(o=this.object3d).add.apply(o,ne(a)),this},i.remove=function(){for(var n=arguments.length,a=new Array(n),e=0;e<n;e++)a[e]=arguments[e];var o;return(o=this.object3d).remove.apply(o,ne(a)),this},i.getSize=function(){var n=new c.Box3().setFromObject(this.object3d);return{min:n.min,max:n.max,size:n.getSize(new c.Vector3)}},i.traverse=function(n){n(this),this.children.forEach(function(a){a.traverse(n)})},i.dispose=function(){l(this.object3d)},ee(t,[{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})}}]),t}(),P=+c.REVISION<144,A=P?"ExtrudeBufferGeometry":"ExtrudeGeometry",X=P?"PlaneBufferGeometry":"PlaneGeometry",se=function(t){"use strict";C(r,t);var i=E(r);function r(a){T(this,r);var e;return e=i.call(this),e.scale=1,e.options=(0,j.Z)({},{scale:1},a),e}var n=r.prototype;return n.getMaterial=function(){var e=this;return(0,O.Z)(R().mark(function o(){var s,f,h,v,m,y,b,w,g,u;return R().wrap(function(S){for(;;)switch(S.prev=S.next){case 0:return s=e.options,f=s.transparent,h=s.blending,v=s.depthWrite,m=s.depthTest,y=s.alphaTest,b=s.sprite,w=s.sizeAttenuation,S.next=3,e.getTexture();case 3:return g=S.sent,u=b?new c.SpriteMaterial({map:g,transparent:f!=null?f:!1,blending:h!=null?h:c.NormalBlending,depthWrite:v!=null?v:!0,depthTest:m!=null?m:!0,alphaTest:y!=null?y:0,sizeAttenuation:w!=null?w:!0}):new c.MeshBasicMaterial({map:g,transparent:f!=null?f:!1,blending:h!=null?h:c.NormalBlending,depthWrite:v!=null?v:!0,depthTest:m!=null?m:!0,alphaTest:y!=null?y:0}),S.abrupt("return",u);case 6:case"end":return S.stop()}},o)}))()},n.create=function(){var e=this;return(0,O.Z)(R().mark(function o(){var s,f,h,v,m,y,b,w;return R().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(s=e.options,f=s.scale,h=s.position,v=s.src,m=s.cache,y=s.sprite,b=v,!m){u.next=8;break}return u.next=5,m.get(b,function(){return e.getMaterial()});case 5:u.t0=u.sent,u.next=11;break;case 8:return u.next=10,e.getMaterial();case 10:u.t0=u.sent;case 11:w=u.t0,e.texture=w.map,y?e.createSprite(w):e.createMesh(new c[X](1,1),w),e.setScale(f),h&&e.object3d.position.copy(h);case 16:case"end":return u.stop()}},o)}))()},n.setScale=function(e){this.scale=e,this.object3d.scale.set(this.texture.image.width*e,this.texture.image.height*e,1)},n.setTexture=function(e){var o=this.object3d;o.material.map&&o.material.map.dispose(),o.material.map=e,o.material.needsUpdate=!0,this.texture=e,this.setScale(this.scale)},n.getTexture=function(){var e=this.options.src;return new c.TextureLoader().loadAsync(e)},r}(d),fe=function(t){"use strict";C(r,t);var i=E(r);function r(a){T(this,r);var e;return e=i.call(this,a),e.canvas=document.createElement("canvas"),e}var n=r.prototype;return n.getTexture=function(){var e=this.options,o=e.text,s=e.textOptions,f=(0,j.Z)({},{fontSize:28,fontFamily:"system-ui,-apple-system,BlinkMacSystemFont,sans-serif",fontWeight:"normal",flipX:!1,color:"#ffffff",setCtx:function(L){}},s||{}),h=f.fontSize,v=f.fontFamily,m=f.fontWeight,y=f.flipX,b=f.color,w=f.setCtx,g=this.canvas;g.width=h*o.length*2,g.height=h;var u=g.getContext("2d");u.font="".concat(m," ").concat(h,"px/1 ").concat(v);var M=u.measureText(o).width;g.width=M,u=g.getContext("2d"),u.clearRect(0,0,g.width,g.height),y&&u.scale(-1,1),u.font="".concat(m," ").concat(h,"px/1 ").concat(v),u.textBaseline="middle",u.fillStyle=b,w&&w(u),u.fillText(o,y?M*-1:0,g.height/2),u.restore();var S=new c.Texture(g);return S.anisotropy=this.pencil.renderer.capabilities.getMaxAnisotropy(),S.needsUpdate=!0,Promise.resolve(S)},r}(H(se));function pe(t,i){for(;!Object.prototype.hasOwnProperty.call(t,i)&&(t=_(t),t!==null););return t}function ie(t,i,r){return typeof Reflect!="undefined"&&Reflect.get?ie=Reflect.get:ie=function(a,e,o){var s=pe(a,e);if(!!s){var f=Object.getOwnPropertyDescriptor(s,e);return f.get?f.get.call(o||a):f.value}},ie(t,i,r)}function Oe(t,i,r){return ie(t,i,r)}var Ce=function(t){"use strict";C(r,t);var i=E(r);function r(a){T(this,r);var e;return e=i.call(this),e.scale=1,e.options=(0,j.Z)({},{scale:1,autoPlay:!0,loop:!0},a),e}var n=r.prototype;return n.getMaterial=function(){var e=this.options,o=e.src,s=e.transparent,f=e.blending,h=e.depthWrite,v=e.depthTest,m=e.format,y=e.autoPlay,b=e.loop,w=e.alphaTest,g=e.sprite,u=B(),M=document.createElement("video");return M.addEventListener("loadedmetadata",function(){var S=new c.VideoTexture(M);S.format=m!=null?m:c.RGBAFormat,S.needsUpdate=!0;var L=g?new c.SpriteMaterial({map:S,transparent:s!=null?s:!1,blending:f!=null?f:c.NormalBlending,depthWrite:h!=null?h:!0,depthTest:v!=null?v:!0,alphaTest:w!=null?w:0}):new c.MeshBasicMaterial({map:S,transparent:s!=null?s:!1,blending:f!=null?f:c.NormalBlending,depthWrite:h!=null?h:!0,depthTest:v!=null?v:!0,alphaTest:w!=null?w:0});u.resolve(L)},!1),M.src=o,M.muted=!0,M.autoplay=y,M.loop=b,M.preload="auto",u.promise},n.create=function(){var e=this;return(0,O.Z)(R().mark(function o(){var s,f,h,v,m,y,b;return R().wrap(function(g){for(;;)switch(g.prev=g.next){case 0:if(s=e.options,f=s.scale,h=s.position,v=s.src,m=s.cache,y=s.sprite,!m){g.next=7;break}return g.next=4,m.get(v,function(){return e.getMaterial()});case 4:g.t0=g.sent,g.next=10;break;case 7:return g.next=9,e.getMaterial();case 9:g.t0=g.sent;case 10:b=g.t0,e.video=b.map.image,y?e.createSprite(b):e.createMesh(new c[X](1,1),b),e.setScale(f),h&&e.object3d.position.copy(h);case 15:case"end":return g.stop()}},o)}))()},n.setScale=function(e){this.scale=e,this.object3d.scale.set(this.video.videoWidth*e,this.video.videoHeight*e,1)},n.render=function(){var e=this.options.autoPlay;e&&this.video.play()},n.dispose=function(){this.video.pause(),this.video.src="",this.video.load(),Oe(_(r.prototype),"dispose",this).call(this)},r}(d),Ae=function(t){"use strict";C(r,t);var i=E(r);function r(a){T(this,r);var e;return e=i.call(this),e.type_="node",e.options=(0,j.Z)({},{event:"click"},a),e}var n=r.prototype;return n.create=function(){var e=this.options,o=e.position,s=e.children,f=e.handler,h=e.event,v=document.createElement("div");this.element=v,v.appendChild(s),this.createCSS2DObject(v),o&&this.object3d.position.copy(o),f&&h&&this.clickTarge.forEach(function(m){var y=Array.isArray(h)?h:[h],b=Array.isArray(f)?f:[f];y.forEach(function(w,g){var u=b[g];u&&m.addEventListener(w,u)})})},n.getMaterial=function(e){return(0,O.Z)(R().mark(function o(){var s,f,h,v;return R().wrap(function(y){for(;;)switch(y.prev=y.next){case 0:return s=document.createElement("canvas"),s.width=256,s.height=256,f=s.getContext("2d"),f.fillStyle="#ff0000",f.fillRect(0,0,256,256),h=new c.CanvasTexture(s),v=new c.SpriteMaterial({map:h,opacity:e?1:0,transparent:!0,alphaTest:.1,sizeAttenuation:!1}),y.abrupt("return",v);case 9:case"end":return y.stop()}},o)}))()},n.createPickObject=function(e){var o=e.show,s=o===void 0?!1:o,f=e.scale,h=f===void 0?new c.Vector3(1,1,1):f,v=e.position,m=v===void 0?new c.Vector3(0,0,0):v,y=e.cache,b=this;return(0,O.Z)(R().mark(function w(){var g,u,M;return R().wrap(function(L){for(;;)switch(L.prev=L.next){case 0:if(g="node-create-pick-object",!y){L.next=7;break}return L.next=4,y.get(g,function(){return b.getMaterial(s)});case 4:L.t0=L.sent,L.next=10;break;case 7:return L.next=9,b.getMaterial(s);case 9:L.t0=L.sent;case 10:u=L.t0,M=new c.Sprite(u),M.scale.set(u.map.image.width*h.x,u.map.image.height*h.y,1),M.position.copy(m),b.add(M),b.pickObject=M;case 16:case"end":return L.stop()}},w)}))()},n.dispose=function(){var e=this.options,o=e.handler,s=e.event;o&&s&&this.clickTarge.forEach(function(f){var h=Array.isArray(s)?s:[s],v=Array.isArray(o)?o:[o];h.forEach(function(m,y){var b=v[y];b&&f.removeEventListener(m,b)})}),Oe(_(r.prototype),"dispose",this).call(this)},ee(r,[{key:"clickTarge",get:function(){var e=this,o=this.options.eventTarge;if(o){var s=o.map(function(f){return ne(e.element.querySelectorAll(f))}).flat();return s}return[this.element]}}]),r}(d),at=Ae,ot=function(t){"use strict";C(r,t);var i=E(r);function r(){return T(this,r),i.apply(this,arguments)}var n=r.prototype;return n.create=function(){this.createGroup()},r}(d),st=`
|
|
2
2
|
`.concat(c.ShaderChunk.logdepthbuf_pars_vertex,`
|
|
3
3
|
`).concat(c.ShaderChunk.fog_pars_vertex,`
|
|
4
4
|
attribute vec3 previous;
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
|
|
96
96
|
`).concat(c.ShaderChunk.fog_vertex,`
|
|
97
97
|
}
|
|
98
|
-
`),
|
|
98
|
+
`),ut=`
|
|
99
99
|
`.concat(c.ShaderChunk.fog_pars_fragment,`
|
|
100
100
|
`).concat(c.ShaderChunk.logdepthbuf_pars_fragment,`
|
|
101
101
|
|
|
@@ -129,4 +129,4 @@ void main() {
|
|
|
129
129
|
gl_FragColor.a *= step(vCounters, visibility);
|
|
130
130
|
`).concat(c.ShaderChunk.fog_fragment,`
|
|
131
131
|
}
|
|
132
|
-
`),xe=function(t){"use strict";C(r,t);var i=T(r);function r(){L(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 c.Matrix4,Object.defineProperties(ae(n),{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(e){this.setGeometry(e,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(e){this.setPoints(e,this.widthCallback)}}}),n}return r}(c.BufferGeometry);xe.prototype.setMatrixWorld=function(t){this.matrixWorld=t},xe.prototype.setGeometry=function(t,i){this._geometry=t,this.setPoints(t.getAttribute("position").array,i)},xe.prototype.setPoints=function(t,i){if(!(t instanceof Float32Array)&&!(t instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=t,this.widthCallback=i,this.positions=[],this.counters=[],t.length&&t[0]instanceof c.Vector3)for(var r=0;r<t.length;r++){var n=t[r],a=r/t.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<t.length;r+=3){var a=r/t.length;this.positions.push(t[r],t[r+1],t[r+2]),this.positions.push(t[r],t[r+1],t[r+2]),this.counters.push(a),this.counters.push(a)}this.process()};function Ke(t,i){var r=new c.Matrix4,n=new c.Ray,a=new c.Sphere,e=new c.Vector3,o=this.geometry;if(o.boundingSphere||o.computeBoundingSphere(),a.copy(o.boundingSphere),a.applyMatrix4(this.matrixWorld),t.ray.intersectSphere(a,e)!==!1){r.copy(this.matrixWorld).invert(),n.copy(t.ray).applyMatrix4(r);var s=new c.Vector3,f=new c.Vector3,h=new c.Vector3,p=this instanceof c.LineSegments?2:1,d=o.index,b=o.attributes;if(d!==null)for(var w=d.array,_=b.position.array,y=b.width.array,u=0,g=w.length-1;u<g;u+=p){var x=w[u],E=w[u+1];s.fromArray(_,x*3),f.fromArray(_,E*3);var B=y[Math.floor(u/3)]!==void 0?y[Math.floor(u/3)]:1,G=t.params.Line.threshold+this.material.lineWidth*B/2,oe=G*G,I=n.distanceSqToSegment(s,f,e,h);if(!(I>oe)){e.applyMatrix4(this.matrixWorld);var ue=t.ray.origin.distanceTo(e);ue<t.near||ue>t.far||(i.push({distance:ue,point:h.clone().applyMatrix4(this.matrixWorld),index:u,face:null,faceIndex:null,object:this}),u=g)}}}}xe.prototype.raycast=Ke,xe.prototype.compareV3=function(t,i){var r=t*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]},xe.prototype.copyV3=function(t){var i=t*6;return[this.positions[i],this.positions[i+1],this.positions[i+2]]},xe.prototype.process=function(){var t=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var i,r;this.compareV3(0,t-1)?r=this.copyV3(t-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<t;n++){if(this.side.push(1),this.side.push(-1),this.widthCallback?i=this.widthCallback(n/(t-1)):i=1,this.width.push(i),this.width.push(i),this.uvs.push(n/(t-1),0),this.uvs.push(n/(t-1),1),n<t-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(t-1,0)?r=this.copyV3(1):r=this.copyV3(t-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 c.BufferAttribute(new Float32Array(this.positions),3),previous:new c.BufferAttribute(new Float32Array(this.previous),3),next:new c.BufferAttribute(new Float32Array(this.next),3),side:new c.BufferAttribute(new Float32Array(this.side),1),width:new c.BufferAttribute(new Float32Array(this.width),1),uv:new c.BufferAttribute(new Float32Array(this.uvs),2),index:new c.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new c.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 We(t,i,r,n,a){var e;if(t=t.subarray||t.slice?t:t.buffer,r=r.subarray||r.slice?r:r.buffer,t=i?t.subarray?t.subarray(i,a&&i+a):t.slice(i,a&&i+a):t,r.set)r.set(t,n);else for(e=0;e<t.length;e++)r[e+n]=t[e];return r}xe.prototype.advance=function(t){var i=this._attributes.position.array,r=this._attributes.previous.array,n=this._attributes.next.array,a=i.length;We(i,0,r,0,a),We(i,6,i,0,a-6),i[a-6]=t.x,i[a-5]=t.y,i[a-4]=t.z,i[a-3]=t.x,i[a-2]=t.y,i[a-1]=t.z,We(i,6,n,0,a-6),n[a-6]=t.x,n[a-5]=t.y,n[a-4]=t.z,n[a-3]=t.x,n[a-2]=t.y,n[a-1]=t.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0},c.ShaderChunk.meshline_vert=ot,c.ShaderChunk.meshline_frag=st;var De=function(t){"use strict";C(r,t);var i=T(r);function r(n){L(this,r);var a;return a=i.call(this,{uniforms:Object.assign({},c.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new c.Color(16777215)},opacity:{value:1},resolution:{value:new c.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 c.Vector2(1,1)},offset:{value:new c.Vector2(1,1)},lineLightAnimation:{value:1},time:{value:0},size:{value:300},speed:{value:.3},lightWidth:{value:.1},uCenter:{value:new c.Vector2(0,0)},lightColor:{value:new c.Color(16777215)}}),vertexShader:c.ShaderChunk.meshline_vert,fragmentShader:c.ShaderChunk.meshline_frag}),a.isMeshLineMaterial=!0,a.type="MeshLineMaterial",Object.defineProperties(ae(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}(c.ShaderMaterial);De.prototype.copy=function(t){return c.ShaderMaterial.prototype.copy.call(this,t),this.lineWidth=t.lineWidth,this.map=t.map,this.useMap=t.useMap,this.alphaMap=t.alphaMap,this.useAlphaMap=t.useAlphaMap,this.color.copy(t.color),this.opacity=t.opacity,this.resolution.copy(t.resolution),this.sizeAttenuation=t.sizeAttenuation,this.dashArray.copy(t.dashArray),this.dashOffset.copy(t.dashOffset),this.dashRatio.copy(t.dashRatio),this.useDash=t.useDash,this.visibility=t.visibility,this.alphaTest=t.alphaTest,this.repeat.copy(t.repeat),this};function ut(t,i){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);i&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function He(t,i){return i=i!=null?i:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):ut(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))}),t}function ct(t,i){if(t==null)return{};var r={},n=Object.keys(t),a,e;for(e=0;e<n.length;e++)a=n[e],!(i.indexOf(a)>=0)&&(r[a]=t[a]);return r}function lt(t,i){if(t==null)return{};var r=ct(t,i),n,a;if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);for(a=0;a<e.length;a++)n=e[a],!(i.indexOf(n)>=0)&&(!Object.prototype.propertyIsEnumerable.call(t,n)||(r[n]=t[n]))}return r}function ft(t){if(Array.isArray(t))return t}function ht(){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 we(t,i){return ft(t)||re(t,i)||me(t,i)||ht()}var $e=require("popmotion"),Le=require("three/examples/jsm//utils/BufferGeometryUtils");function qe(t){var i=t.setPointWidth,r=t.nodes,n=new c.BufferGeometry,a=new xe;return n.setFromPoints(r),a.setGeometry(n,i),a}var pt={color:new c.Color("#ffffff"),lineWidth:1},vt=function(t){"use strict";C(r,t);var i=T(r);function r(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};L(this,r);var e;return e=i.call(this),e.options=(0,j.Z)({},pt,a),e}var n=r.prototype;return n.create=function(){var e=this;return(0,O.Z)(R().mark(function o(){var s,f,h,p,d,b,w,_,y,u,g,x,E,B,G,oe,I,ue,ge,ye;return R().wrap(function(te){for(;;)switch(te.prev=te.next){case 0:if(s=e.options,f=s.duration,h=s.delay,p=s.onComplete,d=s.setPointWidth,b=s.key,w=s.nodes,_=s.nodesArr,y=s.geometry,u=s.geometryArr,g=s.useGroups,x=s.material,E=s.cache,B=s.cacheKey,G=lt(s,["duration","delay","onComplete","setPointWidth","key","nodes","nodesArr","geometry","geometryArr","useGroups","material","cache","cacheKey"]),oe=x,I=y,oe){te.next=16;break}if(ue="LineMaterial:".concat(B),E&&!E.get(ue)&&(E.init(ue),ge=e.getMaterial((0,j.Z)({},G)),E.set(ue,ge)),!E){te.next=12;break}return te.next=9,E.get(ue);case 9:te.t0=te.sent,te.next=15;break;case 12:return te.next=14,e.getMaterial(G);case 14:te.t0=te.sent;case 15:oe=te.t0;case 16:!I&&w?I=qe({nodes:w,setPointWidth:d}):!I&&_?I=Le.mergeBufferGeometries(_.map(function(je){return qe({nodes:je,setPointWidth:d})}),g!=null?g:!1):!I&&u&&u.length>1?I=Le.mergeBufferGeometries(u,g!=null?g:!1):!I&&u&&u.length===1&&(ye=we(u,1),I=ye[0]),e.createMesh(I,oe);case 18:case"end":return te.stop()}},o)}))()},n.getMaterial=function(e){var o=this.pencil.getSize(),s=o.width,f=o.height,h=new De(He((0,j.Z)({},e),{resolution:new c.Vector2(s,f)}));return h},n.addGeometries=function(e){var o=this.object3d,s=Le.mergeBufferGeometries([o.geometry].concat(ne(e)),!1);o.geometry=s},n.resize=function(e,o){this.material.uniforms.resolution.value.set(e,o)},n.animate=function(){var e=this.options,o=e.duration,s=e.delay,f=e.onComplete,h=this.material.uniforms.offset,p=s!=null?s:0,d=(0,$e.animate)({from:h.value,to:{x:0},duration:o!=null?o:1e3,elapsed:-p,repeat:1/0,onComplete:f,ease:$e.linear,onUpdate:function(b){h.value.x=b.x}});this.tween=d},n.dispose=function(){var e;Oe(M(r.prototype),"dispose",this).call(this),(e=this.tween)===null||e===void 0||e.stop()},J(r,[{key:"material",get:function(){return this.object3d.material}}]),r}(m);function dt(t){var i=t.worker,r=t.workerKey,n=t.coordinatesArr,a=t.lineWidth,e=t.projection,o=t.cacheVersion;return new Promise(function(s,f){i.postMessage({coordinatesArr:n,lineWidth:a,projection:e,workerKey:r},{cb:function(h){try{var p=new c.BufferGeometry;Object.keys(h).forEach(function(d){d==="index"?p.setIndex(new c.BufferAttribute(h[d].array,h[d].itemSize)):p.setAttribute(d,new c.BufferAttribute(h[d].array,h[d].itemSize))}),s(p)}catch(d){i.postMessage({delCache:!0,workerKey:r},{cb:f,cacheVersion:o})}},cacheVersion:o})})}var ke=require("d3-array"),mt=require("earcut"),Ue=Q.n(mt),gt=require("@turf/boolean-clockwise"),yt=Q.n(gt);function bt(t,i){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=(90-i)*Math.PI/180,a=(90-t)*Math.PI/180;return[r*Math.sin(n)*Math.cos(a),r*Math.cos(n),r*Math.sin(n)*Math.sin(a)]}var wt=require("delaunator"),_t=Q.n(wt),Mt=require("@turf/boolean-point-in-polygon"),xt=Q.n(Mt),Ee=require("d3-geo"),At=require("d3-geo-voronoi"),Xe=require("d3-scale");function Pt(t,i){return t.map(function(r){var n=[],a;return r.forEach(function(e){if(a){var o=(0,Ee.geoDistance)(e,a)*180/Math.PI;if(o>i)for(var s=(0,Ee.geoInterpolate)(a,e),f=1/Math.ceil(o/i),h=f;h<1;)n.push(s(h)),h+=f}n.push(a=e)}),n})}function St(t){for(var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=i.minLng,n=i.maxLng,a=i.minLat,e=i.maxLat,o=Math.round(Math.pow(360/t,2)/Math.PI),s=(1+Math.sqrt(5))/2,f=function(u){return u/s*360%360-180},h=function(u){return Math.acos(2*u/o-1)/Math.PI*180-90},p=function(u){return o*(Math.cos((u+90)*Math.PI/180)+1)/2},d=[e!==void 0?Math.ceil(p(e)):0,a!==void 0?Math.floor(p(a)):o-1],b=r===void 0&&n===void 0?function(){return!0}:r===void 0?function(u){return u<=n}:n===void 0?function(u){return u>=r}:n>=r?function(u){return u>=r&&u<=n}:function(u){return u>=r||u<=n},w=[],_=d[0];_<=d[1];_++){var y=f(_);b(y)&&w.push([y,h(_)])}return w}function Ie(t,i){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return r?(0,Ee.geoContains)(i,t):xt()(t,i)}function Ot(t,i){var r={type:"Polygon",coordinates:t},n=we((0,Ee.geoBounds)(r),2),a=we(n[0],2),e=a[0],o=a[1],s=we(n[1],2),f=s[0],h=s[1];if(Math.min(Math.abs(f-e),Math.abs(h-o))<i)return[];var p=e>f||h>=89||o<=-89;return St(i,{minLng:e,maxLng:f,minLat:o,maxLat:h}).filter(function(d){return Ie(d,r,p)})}function Ct(t){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=i.resolution,n=r===void 0?1/0:r,a=Pt(t,n),e=(0,ke.merge)(a),o=Ot(t,n),s=ne(e).concat(ne(o)),f={type:"Polygon",coordinates:t},h=we((0,Ee.geoBounds)(f),2),p=we(h[0],2),d=p[0],b=p[1],w=we(h[1],2),_=w[0],y=w[1],u=d>_||y>=89||b<=-89,g=[];if(u){var x=(0,At.geoVoronoi)(s).triangles(),E=new Map(s.map(function(be,H){var Me=we(be,2),pe=Me[0],ze=Me[1];return["".concat(pe,"-").concat(ze),H]}));x.features.forEach(function(be){var H,Me=be.geometry.coordinates[0].slice(0,3).reverse(),pe=[];if(Me.forEach(function(Be){var Ae=we(Be,2),Fe=Ae[0],Rt=Ae[1],rt="".concat(Fe,"-").concat(Rt);E.has(rt)&&pe.push(E.get(rt))}),pe.length===3){if(pe.some(function(Be){return Be<e.length})){var ze=be.properties.circumcenter;if(!Ie(ze,f,u))return}(H=g).push.apply(H,ne(pe))}})}else if(o.length)for(var ue=function(be,H){var Me,pe=[2,1,0].map(function(Ae){return ge.triangles[be+Ae]}),ze=pe.map(function(Ae){return s[Ae]});if(pe.some(function(Ae){return Ae<e.length})){var Be=[0,1].map(function(Ae){return(0,ke.mean)(ze,function(Fe){return Fe[Ae]})});if(!Ie(Be,f,u))return"continue"}(Me=g).push.apply(Me,ne(pe))},ge=_t().from(s),ye=0,_e=ge.triangles.length;ye<_e;ye+=3)ue(ye,_e);else{var B=Ue().flatten(a),G=B.vertices,oe=B.holes,I=oe===void 0?[]:oe;g=Ue()(G,I,2)}var te=(0,Xe.scaleLinear)((0,ke.extent)(s,function(be){return be[0]}),[0,1]),je=(0,Xe.scaleLinear)((0,ke.extent)(s,function(be){return be[1]}),[0,1]),Re=s.map(function(be){var H=we(be,2),Me=H[0],pe=H[1];return[te(Me),je(pe)]}),Ge={points:s,indices:g,uvs:Re};return{contour:a,triangles:Ge}}var jt=Ct,Ye=new c.BufferGeometry().setAttribute?"setAttribute":"addAttribute";function Ze(t,i){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,n=t.map(function(a){return a.map(function(e){var o=we(e,2),s=o[0],f=o[1];return r?bt(s,f,i):[s,f,i]})});return Ue().flatten(n)}function Qe(t,i,r){for(var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=Ze(t,i,n),e=a.vertices,o=a.holes,s=Ze(t,r,n),f=s.vertices,h=(0,ke.merge)([f,e]),p=Math.round(f.length/3),d=new Set(o),b=0,w=[],_=0;_<p;_++){var y=_+1;if(y===p)y=b;else if(d.has(y)){var u=y;y=b,b=u}w.push(_,_+p,y+p),w.push(y+p,y,_)}for(var g=[],x=1;x>=0;x--)for(var E=0;E<p;E+=1)g.push(E/(p-1),x);return{indices:w,vertices:h,uvs:g,topVerts:f}}function Je(t,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?t.indices:t.indices.slice().reverse(),vertices:Ze([t.points],i,a).vertices,uvs:r}}var Lt=function(t){"use strict";C(r,t);var i=T(r);function r(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};L(this,r);var e;e=i.call(this),e.type="PolygonBufferGeometry",e.parameters=(0,j.Z)({},{polygonGeoJson:n,startHeight:0,endHeight:1,closedBottom:!0,closedTop:!0,includeSides:!0,curvatureResolution:5,cartesian:!0,userDataRsoOffset:0},a);var o=e.parameters,s=o.startHeight,f=o.endHeight,h=o.closedBottom,p=o.closedTop,d=o.includeSides,b=o.curvatureResolution,w=o.cartesian,_=o.userDataRsoOffset;yt()(n[0])||n[0].reverse();var y=jt(n,{resolution:b}),u=y.contour,g=y.triangles,x=(0,ke.merge)(g.uvs),E=[],B=[],G=[],oe=0,I=function(ge){var ye=Math.round(E.length/3),_e=G.length;E=E.concat(ge.vertices),B=B.concat(ge.uvs),G=G.concat(ye?ge.indices.map(function(te){return te+ye}):ge.indices),e.addGroup(_e,G.length-_e,oe++)};if(d){var ue=Qe(u,s,f,w);I(ue),e.userData.rso=_?Qe(u,s,f+_,w):ue}return h&&I(Je(g,s,x,!1,w)),p&&I(Je(g,f,x,!0,w)),e.setIndex(G),e[Ye]("position",new c.Float32BufferAttribute(E,3)),e[Ye]("uv",new c.Float32BufferAttribute(B,2)),e.computeVertexNormals(),e}return r}(c.BufferGeometry),kt=function(t){"use strict";C(r,t);var i=T(r);function r(a){L(this,r);var e;return e=i.call(this),e.options=(0,j.Z)({},{geojson:[[[]]],startHeight:0,height:5,closedBottom:!0,closedTop:!0,curvatureResolution:1,cartesian:!0,userDataRsoOffset:0},a),e}var n=r.prototype;return n.create=function(){var e=this.options,o=e.startHeight,s=e.height,f=e.closedBottom,h=e.closedTop,p=e.curvatureResolution,d=e.userDataRsoOffset,b=e.cartesian,w=new Lt(this.options.geojson,{startHeight:o,endHeight:o+s,closedBottom:f,closedTop:h,curvatureResolution:p,cartesian:b,userDataRsoOffset:d});this.createMesh(w,this.options.material)},r}(m),et=Q(705);function tt(t){var i=t.split,r=t.depth,n=t.points,a=t.box3,e=new c[P](new c.Shape(n),{depth:r,bevelEnabled:!1,UVGenerator:(0,et.y)({split:i,box3:a})});return(0,et.C)(),e}var Tt=function(t){"use strict";C(r,t);var i=T(r);function r(a){L(this,r);var e;return e=i.call(this),e.options=He((0,j.Z)({depth:1},a),{materialOptions:(0,j.Z)({},{split:.1},a.materialOptions||{})}),e}var n=r.prototype;return n.create=function(){var e=this;return(0,O.Z)(R().mark(function o(){var s,f,h,p,d,b,w,_,y,u,g,x,E,B,G,oe,I,ue,ge,ye,_e,te,je,Re,Ge;return R().wrap(function(H){for(;;)switch(H.prev=H.next){case 0:if(s=e.options,f=s.points,h=s.pointsArr,p=s.useGroups,d=s.depth,b=s.geometry,w=s.geometryArr,_=s.material,y=s.materialOptions,u=s.cache,g=s.cacheKey,x=s.box3,E=0,B=Array.isArray(d)?d:[d],G=Array.isArray(x)?x:[x],oe=_,I=b,!(!oe&&y)){H.next=26;break}if(E=y.split,ue=y.topColor,ge=y.sideColor,ye=y.sideMap,_e="ExtrudePolygonMaterial:".concat(g||"".concat(ge||ye||"").concat(ue||"")),!(u&&!u.get(_e))){H.next=16;break}return u.init(_e),H.next=14,e.getMaterial(y);case 14:te=H.sent,u.set(_e,te);case 16:if(!u){H.next=22;break}return H.next=19,u.get(_e);case 19:H.t0=H.sent,H.next=25;break;case 22:return H.next=24,e.getMaterial(y);case 24:H.t0=H.sent;case 25:oe=H.t0;case 26:!I&&f?I=tt({points:f,depth:B[0],split:E,box3:G[0]}):!I&&h?I=Le.mergeBufferGeometries(h.map(function(Me,pe){return tt({points:Me,depth:(je=B[pe])!==null&&je!==void 0?je:B[0],split:E,box3:(Re=G[pe])!==null&&Re!==void 0?Re:G[0]})}),p!=null?p:!1):!I&&w&&w.length>1?I=Le.mergeBufferGeometries(w,p!=null?p:!1):!I&&w&&w.length===1&&(Ge=we(w,1),I=Ge[0]),e.createMesh(I,oe);case 28:case"end":return H.stop()}},o)}))()},n.addGeometries=function(e){var o=this.object3d,s=Le.mergeBufferGeometries([o.geometry].concat(ne(e)),!1);o.geometry=s},n.getMaterial=function(e){var o=this,s=e.topColor,f=e.sideColor,h=e.sideMap,p=e.type,d=e.parameters,b=e.createCanvasObjectURL,w=e.split,_=e.maxAnisotropy;return new Promise(function(y){var u=h?document.createElement("img"):{src:"",onload:function(){},width:1024,height:1024};u.onload=function(){var g=w,x=document.createElement("canvas"),E=x.getContext("2d");x.height=u.height/(1-g),x.width=u.width,g&&s&&(E.fillStyle=s,E.fillRect(0,0,u.width,x.height*g)),h&&u instanceof HTMLImageElement?E.drawImage(u,0,x.height*g,u.width,u.height):f&&(E.fillStyle=f,E.fillRect(0,x.height*g,u.width,u.height)),b&&x.toBlob(function(oe){console.log(URL.createObjectURL(oe))});var B=new c.CanvasTexture(x);B.anisotropy=_||o.pencil.renderer.capabilities.getMaxAnisotropy();var G=new c[p||"MeshBasicMaterial"]((0,j.Z)({map:B},d||{}));y(G)},h?u.src=h:u instanceof HTMLImageElement||u.onload()})},n.setMaterialColor=function(e){var o=this;return(0,O.Z)(R().mark(function s(){var f,h,p,d,b,w,_,y,u,g,x,E;return R().wrap(function(G){for(;;)switch(G.prev=G.next){case 0:if(f=o.options,h=f.materialOptions,p=f.cache,d=h.sideColor,b=h.sideMap,w=h.topColor,_=h.cacheKey,y=e.sideColor,u=e.topColor,!(u||y)){G.next=22;break}if(g="ExtrudePolygonMaterial:".concat(_||"".concat(y||d||b||"").concat(u||w||"")),!(p&&!p.get(g))){G.next=11;break}return p.init(g),G.next=9,o.getMaterial((0,j.Z)({},h,e));case 9:x=G.sent,p.set(g,x);case 11:if(!p){G.next=17;break}return G.next=14,p.get(g);case 14:G.t0=G.sent,G.next=20;break;case 17:return G.next=19,o.getMaterial((0,j.Z)({},h,e));case 19:G.t0=G.sent;case 20:E=G.t0,o.object3d.material=E;case 22:case"end":return G.stop()}},s)}))()},r}(m);function Et(t){var i=t.worker,r=t.workerKey,n=t.coordinatesArr,a=t.depth,e=t.split,o=t.projection,s=t.cacheVersion;return new Promise(function(f,h){i.postMessage({coordinatesArr:n,depth:a,split:e!=null?e:.1,projection:o,workerKey:r},{cb:function(p){try{var d=new c.BufferGeometry;Object.keys(p).forEach(function(b){d.setAttribute(b,new c.BufferAttribute(p[b].array,p[b].itemSize))}),f(d)}catch(b){i.postMessage({delCache:!0,workerKey:r},{cb:h,cacheVersion:s})}},cacheVersion:s})})}})(),module.exports=Ve})();
|
|
132
|
+
`),we=function(t){"use strict";C(r,t);var i=E(r);function r(){T(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 c.Matrix4,Object.defineProperties(ae(n),{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(e){this.setGeometry(e,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(e){this.setPoints(e,this.widthCallback)}}}),n}return r}(c.BufferGeometry);we.prototype.setMatrixWorld=function(t){this.matrixWorld=t},we.prototype.setGeometry=function(t,i){this._geometry=t,this.setPoints(t.getAttribute("position").array,i)},we.prototype.setPoints=function(t,i){if(!(t instanceof Float32Array)&&!(t instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=t,this.widthCallback=i,this.positions=[],this.counters=[],t.length&&t[0]instanceof c.Vector3)for(var r=0;r<t.length;r++){var n=t[r],a=r/t.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<t.length;r+=3){var a=r/t.length;this.positions.push(t[r],t[r+1],t[r+2]),this.positions.push(t[r],t[r+1],t[r+2]),this.counters.push(a),this.counters.push(a)}this.process()};function Ne(t,i){var r=new c.Matrix4,n=new c.Ray,a=new c.Sphere,e=new c.Vector3,o=this.geometry;if(o.boundingSphere||o.computeBoundingSphere(),a.copy(o.boundingSphere),a.applyMatrix4(this.matrixWorld),t.ray.intersectSphere(a,e)!==!1){r.copy(this.matrixWorld).invert(),n.copy(t.ray).applyMatrix4(r);var s=new c.Vector3,f=new c.Vector3,h=new c.Vector3,v=this instanceof c.LineSegments?2:1,m=o.index,y=o.attributes;if(m!==null)for(var b=m.array,w=y.position.array,g=y.width.array,u=0,M=b.length-1;u<M;u+=v){var S=b[u],L=b[u+1];s.fromArray(w,S*3),f.fromArray(w,L*3);var V=g[Math.floor(u/3)]!==void 0?g[Math.floor(u/3)]:1,J=t.params.Line.threshold+this.material.lineWidth*V/2,oe=J*J,U=n.distanceSqToSegment(s,f,e,h);if(!(U>oe)){e.applyMatrix4(this.matrixWorld);var ve=t.ray.origin.distanceTo(e);ve<t.near||ve>t.far||(i.push({distance:ve,point:h.clone().applyMatrix4(this.matrixWorld),index:u,face:null,faceIndex:null,object:this}),u=M)}}}}we.prototype.raycast=Ne,we.prototype.compareV3=function(t,i){var r=t*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]},we.prototype.copyV3=function(t){var i=t*6;return[this.positions[i],this.positions[i+1],this.positions[i+2]]},we.prototype.process=function(){var t=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var i,r;this.compareV3(0,t-1)?r=this.copyV3(t-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<t;n++){if(this.side.push(1),this.side.push(-1),this.widthCallback?i=this.widthCallback(n/(t-1)):i=1,this.width.push(i),this.width.push(i),this.uvs.push(n/(t-1),0),this.uvs.push(n/(t-1),1),n<t-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(t-1,0)?r=this.copyV3(1):r=this.copyV3(t-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 c.BufferAttribute(new Float32Array(this.positions),3),previous:new c.BufferAttribute(new Float32Array(this.previous),3),next:new c.BufferAttribute(new Float32Array(this.next),3),side:new c.BufferAttribute(new Float32Array(this.side),1),width:new c.BufferAttribute(new Float32Array(this.width),1),uv:new c.BufferAttribute(new Float32Array(this.uvs),2),index:new c.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new c.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 Ve(t,i,r,n,a){var e;if(t=t.subarray||t.slice?t:t.buffer,r=r.subarray||r.slice?r:r.buffer,t=i?t.subarray?t.subarray(i,a&&i+a):t.slice(i,a&&i+a):t,r.set)r.set(t,n);else for(e=0;e<t.length;e++)r[e+n]=t[e];return r}we.prototype.advance=function(t){var i=this._attributes.position.array,r=this._attributes.previous.array,n=this._attributes.next.array,a=i.length;Ve(i,0,r,0,a),Ve(i,6,i,0,a-6),i[a-6]=t.x,i[a-5]=t.y,i[a-4]=t.z,i[a-3]=t.x,i[a-2]=t.y,i[a-1]=t.z,Ve(i,6,n,0,a-6),n[a-6]=t.x,n[a-5]=t.y,n[a-4]=t.z,n[a-3]=t.x,n[a-2]=t.y,n[a-1]=t.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0},c.ShaderChunk.meshline_vert=st,c.ShaderChunk.meshline_frag=ut;var We=function(t){"use strict";C(r,t);var i=E(r);function r(n){T(this,r);var a;return a=i.call(this,{uniforms:Object.assign({},c.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new c.Color(16777215)},opacity:{value:1},resolution:{value:new c.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 c.Vector2(1,1)},offset:{value:new c.Vector2(1,1)},lineLightAnimation:{value:1},time:{value:0},size:{value:300},speed:{value:.3},lightWidth:{value:.1},uCenter:{value:new c.Vector2(0,0)},lightColor:{value:new c.Color(16777215)}}),vertexShader:c.ShaderChunk.meshline_vert,fragmentShader:c.ShaderChunk.meshline_frag}),a.isMeshLineMaterial=!0,a.type="MeshLineMaterial",Object.defineProperties(ae(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}(c.ShaderMaterial);We.prototype.copy=function(t){return c.ShaderMaterial.prototype.copy.call(this,t),this.lineWidth=t.lineWidth,this.map=t.map,this.useMap=t.useMap,this.alphaMap=t.alphaMap,this.useAlphaMap=t.useAlphaMap,this.color.copy(t.color),this.opacity=t.opacity,this.resolution.copy(t.resolution),this.sizeAttenuation=t.sizeAttenuation,this.dashArray.copy(t.dashArray),this.dashOffset.copy(t.dashOffset),this.dashRatio.copy(t.dashRatio),this.useDash=t.useDash,this.visibility=t.visibility,this.alphaTest=t.alphaTest,this.repeat.copy(t.repeat),this};function ct(t,i){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);i&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function Ke(t,i){return i=i!=null?i:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):ct(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))}),t}function lt(t,i){if(t==null)return{};var r={},n=Object.keys(t),a,e;for(e=0;e<n.length;e++)a=n[e],!(i.indexOf(a)>=0)&&(r[a]=t[a]);return r}function ft(t,i){if(t==null)return{};var r=lt(t,i),n,a;if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);for(a=0;a<e.length;a++)n=e[a],!(i.indexOf(n)>=0)&&(!Object.prototype.propertyIsEnumerable.call(t,n)||(r[n]=t[n]))}return r}function ht(t){if(Array.isArray(t))return t}function pt(){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 ge(t,i){return ht(t)||re(t,i)||me(t,i)||pt()}var He=require("popmotion"),je=require("three/examples/jsm//utils/BufferGeometryUtils");function $e(t){var i=t.setPointWidth,r=t.nodes,n=new c.BufferGeometry,a=new we;return n.setFromPoints(r),a.setGeometry(n,i),a}var vt={color:new c.Color("#ffffff"),lineWidth:1},dt=function(t){"use strict";C(r,t);var i=E(r);function r(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r);var e;return e=i.call(this),e.options=(0,j.Z)({},vt,a),e}var n=r.prototype;return n.create=function(){var e=this;return(0,O.Z)(R().mark(function o(){var s,f,h,v,m,y,b,w,g,u,M,S,L,V,J,oe,U,ve,de;return R().wrap(function(Q){for(;;)switch(Q.prev=Q.next){case 0:if(s=e.options,f=s.duration,h=s.delay,v=s.onComplete,m=s.setPointWidth,y=s.key,b=s.nodes,w=s.nodesArr,g=s.geometry,u=s.geometryArr,M=s.useGroups,S=s.material,L=s.cache,V=s.cacheKey,J=ft(s,["duration","delay","onComplete","setPointWidth","key","nodes","nodesArr","geometry","geometryArr","useGroups","material","cache","cacheKey"]),oe=S,U=g,oe){Q.next=15;break}if(ve="LineMaterial:".concat(V),!L){Q.next=11;break}return Q.next=8,L.get(ve,function(){return e.getMaterial((0,j.Z)({},J))});case 8:Q.t0=Q.sent,Q.next=14;break;case 11:return Q.next=13,e.getMaterial((0,j.Z)({},J));case 13:Q.t0=Q.sent;case 14:oe=Q.t0;case 15:!U&&b?U=$e({nodes:b,setPointWidth:m}):!U&&w?U=je.mergeBufferGeometries(w.map(function(Pe){return $e({nodes:Pe,setPointWidth:m})}),M!=null?M:!1):!U&&u&&u.length>1?U=je.mergeBufferGeometries(u,M!=null?M:!1):!U&&u&&u.length===1&&(de=ge(u,1),U=de[0]),e.createMesh(U,oe);case 17:case"end":return Q.stop()}},o)}))()},n.getMaterial=function(e){var o=this.pencil.getSize(),s=o.width,f=o.height,h=new We(Ke((0,j.Z)({},e),{resolution:new c.Vector2(s,f)}));return h},n.addGeometries=function(e){var o=this.object3d,s=je.mergeBufferGeometries([o.geometry].concat(ne(e)),!1);o.geometry=s},n.resize=function(e,o){this.material.uniforms.resolution.value.set(e,o)},n.animate=function(){var e=this.options,o=e.duration,s=e.delay,f=e.onComplete,h=this.material.uniforms.offset,v=s!=null?s:0,m=(0,He.animate)({from:h.value,to:{x:0},duration:o!=null?o:1e3,elapsed:-v,repeat:1/0,onComplete:f,ease:He.linear,onUpdate:function(y){h.value.x=y.x}});this.tween=m},n.dispose=function(){var e;Oe(_(r.prototype),"dispose",this).call(this),(e=this.tween)===null||e===void 0||e.stop()},ee(r,[{key:"material",get:function(){return this.object3d.material}}]),r}(d);function mt(t){var i=t.worker,r=t.workerKey,n=t.coordinatesArr,a=t.lineWidth,e=t.projection,o=t.cacheVersion;return new Promise(function(s,f){i.postMessage({coordinatesArr:n,lineWidth:a,projection:e,workerKey:r},{cb:function(h){try{var v=new c.BufferGeometry;Object.keys(h).forEach(function(m){m==="index"?v.setIndex(new c.BufferAttribute(h[m].array,h[m].itemSize)):v.setAttribute(m,new c.BufferAttribute(h[m].array,h[m].itemSize))}),s(v)}catch(m){i.postMessage({delCache:!0,workerKey:r},{cb:f,cacheVersion:o})}},cacheVersion:o})})}var Le=require("d3-array"),gt=require("earcut"),De=Y.n(gt),yt=require("@turf/boolean-clockwise"),bt=Y.n(yt);function wt(t,i){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=(90-i)*Math.PI/180,a=(90-t)*Math.PI/180;return[r*Math.sin(n)*Math.cos(a),r*Math.cos(n),r*Math.sin(n)*Math.sin(a)]}var _t=require("delaunator"),Mt=Y.n(_t),xt=require("@turf/boolean-point-in-polygon"),At=Y.n(xt),ke=require("d3-geo"),Pt=require("d3-geo-voronoi"),qe=require("d3-scale");function St(t,i){return t.map(function(r){var n=[],a;return r.forEach(function(e){if(a){var o=(0,ke.geoDistance)(e,a)*180/Math.PI;if(o>i)for(var s=(0,ke.geoInterpolate)(a,e),f=1/Math.ceil(o/i),h=f;h<1;)n.push(s(h)),h+=f}n.push(a=e)}),n})}function Ot(t){for(var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=i.minLng,n=i.maxLng,a=i.minLat,e=i.maxLat,o=Math.round(Math.pow(360/t,2)/Math.PI),s=(1+Math.sqrt(5))/2,f=function(u){return u/s*360%360-180},h=function(u){return Math.acos(2*u/o-1)/Math.PI*180-90},v=function(u){return o*(Math.cos((u+90)*Math.PI/180)+1)/2},m=[e!==void 0?Math.ceil(v(e)):0,a!==void 0?Math.floor(v(a)):o-1],y=r===void 0&&n===void 0?function(){return!0}:r===void 0?function(u){return u<=n}:n===void 0?function(u){return u>=r}:n>=r?function(u){return u>=r&&u<=n}:function(u){return u>=r||u<=n},b=[],w=m[0];w<=m[1];w++){var g=f(w);y(g)&&b.push([g,h(w)])}return b}function Ue(t,i){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return r?(0,ke.geoContains)(i,t):At()(t,i)}function Ct(t,i){var r={type:"Polygon",coordinates:t},n=ge((0,ke.geoBounds)(r),2),a=ge(n[0],2),e=a[0],o=a[1],s=ge(n[1],2),f=s[0],h=s[1];if(Math.min(Math.abs(f-e),Math.abs(h-o))<i)return[];var v=e>f||h>=89||o<=-89;return Ot(i,{minLng:e,maxLng:f,minLat:o,maxLat:h}).filter(function(m){return Ue(m,r,v)})}function jt(t){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=i.resolution,n=r===void 0?1/0:r,a=St(t,n),e=(0,Le.merge)(a),o=Ct(t,n),s=ne(e).concat(ne(o)),f={type:"Polygon",coordinates:t},h=ge((0,ke.geoBounds)(f),2),v=ge(h[0],2),m=v[0],y=v[1],b=ge(h[1],2),w=b[0],g=b[1],u=m>w||g>=89||y<=-89,M=[];if(u){var S=(0,Pt.geoVoronoi)(s).triangles(),L=new Map(s.map(function(K,Me){var ye=ge(K,2),be=ye[0],Ge=ye[1];return["".concat(be,"-").concat(Ge),Me]}));S.features.forEach(function(K){var Me,ye=K.geometry.coordinates[0].slice(0,3).reverse(),be=[];if(ye.forEach(function(ze){var xe=ge(ze,2),Ie=xe[0],Rt=xe[1],nt="".concat(Ie,"-").concat(Rt);L.has(nt)&&be.push(L.get(nt))}),be.length===3){if(be.some(function(ze){return ze<e.length})){var Ge=K.properties.circumcenter;if(!Ue(Ge,f,u))return}(Me=M).push.apply(Me,ne(be))}})}else if(o.length)for(var ve=function(K,Me){var ye,be=[2,1,0].map(function(xe){return de.triangles[K+xe]}),Ge=be.map(function(xe){return s[xe]});if(be.some(function(xe){return xe<e.length})){var ze=[0,1].map(function(xe){return(0,Le.mean)(Ge,function(Ie){return Ie[xe]})});if(!Ue(ze,f,u))return"continue"}(ye=M).push.apply(ye,ne(be))},de=Mt().from(s),_e=0,Q=de.triangles.length;_e<Q;_e+=3)ve(_e,Q);else{var V=De().flatten(a),J=V.vertices,oe=V.holes,U=oe===void 0?[]:oe;M=De()(J,U,2)}var Pe=(0,qe.scaleLinear)((0,Le.extent)(s,function(K){return K[0]}),[0,1]),Ee=(0,qe.scaleLinear)((0,Le.extent)(s,function(K){return K[1]}),[0,1]),Re=s.map(function(K){var Me=ge(K,2),ye=Me[0],be=Me[1];return[Pe(ye),Ee(be)]}),rt={points:s,indices:M,uvs:Re};return{contour:a,triangles:rt}}var Lt=jt,Xe=new c.BufferGeometry().setAttribute?"setAttribute":"addAttribute";function Ze(t,i){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,n=t.map(function(a){return a.map(function(e){var o=ge(e,2),s=o[0],f=o[1];return r?wt(s,f,i):[s,f,i]})});return De().flatten(n)}function Ye(t,i,r){for(var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=Ze(t,i,n),e=a.vertices,o=a.holes,s=Ze(t,r,n),f=s.vertices,h=(0,Le.merge)([f,e]),v=Math.round(f.length/3),m=new Set(o),y=0,b=[],w=0;w<v;w++){var g=w+1;if(g===v)g=y;else if(m.has(g)){var u=g;g=y,y=u}b.push(w,w+v,g+v),b.push(g+v,g,w)}for(var M=[],S=1;S>=0;S--)for(var L=0;L<v;L+=1)M.push(L/(v-1),S);return{indices:b,vertices:h,uvs:M,topVerts:f}}function Qe(t,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?t.indices:t.indices.slice().reverse(),vertices:Ze([t.points],i,a).vertices,uvs:r}}var Je=function(t){"use strict";C(r,t);var i=E(r);function r(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};T(this,r);var e;e=i.call(this),e.type="PolygonBufferGeometry",e.parameters=(0,j.Z)({},{polygonGeoJson:n,startHeight:0,endHeight:1,closedBottom:!0,closedTop:!0,includeSides:!0,curvatureResolution:5,cartesian:!0,userDataRsoOffset:0},a);var o=e.parameters,s=o.startHeight,f=o.endHeight,h=o.closedBottom,v=o.closedTop,m=o.includeSides,y=o.curvatureResolution,b=o.cartesian,w=o.userDataRsoOffset;bt()(n[0])||n[0].reverse();var g=Lt(n,{resolution:y}),u=g.contour,M=g.triangles,S=(0,Le.merge)(M.uvs),L=[],V=[],J=[],oe=0,U=function(de){var _e=Math.round(L.length/3),Q=J.length;L=L.concat(de.vertices),V=V.concat(de.uvs),J=J.concat(_e?de.indices.map(function(Pe){return Pe+_e}):de.indices),e.addGroup(Q,J.length-Q,oe++)};if(m){var ve=Ye(u,s,f,b);U(ve),e.userData.rso=w?Ye(u,s,f+w,b):ve}return h&&U(Qe(M,s,S,!1,b)),v&&U(Qe(M,f,S,!0,b)),e.setIndex(J),e[Xe]("position",new c.Float32BufferAttribute(L,3)),e[Xe]("uv",new c.Float32BufferAttribute(V,2)),e.computeVertexNormals(),e}return r}(c.BufferGeometry),Tt=function(t){"use strict";C(r,t);var i=E(r);function r(a){T(this,r);var e;return e=i.call(this),e.options=(0,j.Z)({},{geojson:[[[]]],startHeight:0,height:5,closedBottom:!0,closedTop:!0,curvatureResolution:1,cartesian:!0,userDataRsoOffset:0},a),e}var n=r.prototype;return n.create=function(){var e=this.options,o=e.startHeight,s=e.height,f=e.closedBottom,h=e.closedTop,v=e.curvatureResolution,m=e.userDataRsoOffset,y=e.cartesian,b=new Je(this.options.geojson,{startHeight:o,endHeight:o+s,closedBottom:f,closedTop:h,curvatureResolution:v,cartesian:y,userDataRsoOffset:m});this.createMesh(b,this.options.material)},r}(d),et=Y(705);function tt(t){var i=t.split,r=t.depth,n=t.points,a=t.box3,e=new c[A](new c.Shape(n),{depth:r,bevelEnabled:!1,UVGenerator:(0,et.y)({split:i,box3:a})});return(0,et.C)(),e}var kt=function(t){"use strict";C(r,t);var i=E(r);function r(a){T(this,r);var e;return e=i.call(this),e.options=Ke((0,j.Z)({depth:1},a),{materialOptions:(0,j.Z)({},{split:.1},a.materialOptions||{})}),e}var n=r.prototype;return n.create=function(){var e=this;return(0,O.Z)(R().mark(function o(){var s,f,h,v,m,y,b,w,g,u,M,S,L,V,J,oe,U,ve,de,_e,Q,Pe,Ee,Re;return R().wrap(function(K){for(;;)switch(K.prev=K.next){case 0:if(s=e.options,f=s.points,h=s.pointsArr,v=s.useGroups,m=s.depth,y=s.geometry,b=s.geometryArr,w=s.material,g=s.materialOptions,u=s.cache,M=s.cacheKey,S=s.box3,L=0,V=Array.isArray(m)?m:[m],J=Array.isArray(S)?S:[S],oe=w,U=y,!(!oe&&g)){K.next=20;break}if(L=g.split,ve=g.topColor,de=g.sideColor,_e=g.sideMap,Q="ExtrudePolygonMaterial:".concat(M||"".concat(de||_e||"").concat(ve||"")),!u){K.next=16;break}return K.next=13,u.get(Q,function(){return e.getMaterial(g)});case 13:K.t0=K.sent,K.next=19;break;case 16:return K.next=18,e.getMaterial(g);case 18:K.t0=K.sent;case 19:oe=K.t0;case 20:!U&&f?U=tt({points:f,depth:V[0],split:L,box3:J[0]}):!U&&h?U=je.mergeBufferGeometries(h.map(function(Me,ye){return tt({points:Me,depth:(Pe=V[ye])!==null&&Pe!==void 0?Pe:V[0],split:L,box3:(Ee=J[ye])!==null&&Ee!==void 0?Ee:J[0]})}),v!=null?v:!1):!U&&b&&b.length>1?U=je.mergeBufferGeometries(b,v!=null?v:!1):!U&&b&&b.length===1&&(Re=ge(b,1),U=Re[0]),e.createMesh(U,oe);case 22:case"end":return K.stop()}},o)}))()},n.addGeometries=function(e){var o=this.object3d,s=je.mergeBufferGeometries([o.geometry].concat(ne(e)),!1);o.geometry=s},n.getMaterial=function(e){var o=this,s=e.topColor,f=e.sideColor,h=e.sideMap,v=e.type,m=e.parameters,y=e.createCanvasObjectURL,b=e.split,w=e.maxAnisotropy;return new Promise(function(g){var u=h?document.createElement("img"):{src:"",onload:function(){},width:1024,height:1024};u.onload=function(){var M=b,S=document.createElement("canvas"),L=S.getContext("2d");S.height=u.height/(1-M),S.width=u.width,M&&s&&(L.fillStyle=s,L.fillRect(0,0,u.width,S.height*M)),h&&u instanceof HTMLImageElement?L.drawImage(u,0,S.height*M,u.width,u.height):f&&(L.fillStyle=f,L.fillRect(0,S.height*M,u.width,u.height)),y&&S.toBlob(function(oe){console.log(URL.createObjectURL(oe))});var V=new c.CanvasTexture(S);V.anisotropy=w||o.pencil.renderer.capabilities.getMaxAnisotropy();var J=new c[v||"MeshBasicMaterial"]((0,j.Z)({map:V},m||{}));g(J)},h?u.src=h:u instanceof HTMLImageElement||u.onload()})},n.setMaterialColor=function(e){var o=this;return(0,O.Z)(R().mark(function s(){var f,h,v,m,y,b,w,g,u,M,S;return R().wrap(function(V){for(;;)switch(V.prev=V.next){case 0:if(f=o.options,h=f.materialOptions,v=f.cache,m=h.sideColor,y=h.sideMap,b=h.topColor,w=h.cacheKey,g=e.sideColor,u=e.topColor,!(u||g)){V.next=16;break}if(M="ExtrudePolygonMaterial:".concat(w||"".concat(g||m||y||"").concat(u||b||"")),!v){V.next=11;break}return V.next=8,v.get(M,function(){return o.getMaterial((0,j.Z)({},h,e))});case 8:V.t0=V.sent,V.next=14;break;case 11:return V.next=13,o.getMaterial((0,j.Z)({},h,e));case 13:V.t0=V.sent;case 14:S=V.t0,o.object3d.material=S;case 16:case"end":return V.stop()}},s)}))()},r}(d);function Et(t){var i=t.worker,r=t.workerKey,n=t.coordinatesArr,a=t.depth,e=t.split,o=t.projection,s=t.cacheVersion;return new Promise(function(f,h){i.postMessage({coordinatesArr:n,depth:a,split:e!=null?e:.1,projection:o,workerKey:r},{cb:function(v){try{var m=new c.BufferGeometry;Object.keys(v).forEach(function(y){m.setAttribute(y,new c.BufferAttribute(v[y].array,v[y].itemSize))}),f(m)}catch(y){i.postMessage({delCache:!0,workerKey:r},{cb:h,cacheVersion:s})}},cacheVersion:s})})}})(),module.exports=Be})();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import*as ot from"idb-keyval";import*as $t from"three";import*as Yt from"three/examples/jsm/renderers/CSS2DRenderer";import*as st from"three/examples/jsm/renderers/CSS3DRenderer";import*as ut from"popmotion";import*as Jt from"three/examples/jsm//utils/BufferGeometryUtils";import*as He from"d3-array";import*as Qt from"earcut";import*as qt from"@turf/boolean-clockwise";import*as er from"delaunator";import*as tr from"@turf/boolean-point-in-polygon";import*as ze from"d3-geo";import*as rr from"d3-geo-voronoi";import*as nr from"d3-scale";var ir={666:function(k){var G=function(A){"use strict";var P=Object.prototype,x=P.hasOwnProperty,D,L=typeof Symbol=="function"?Symbol:{},z=L.iterator||"@@iterator",$=L.asyncIterator||"@@asyncIterator",C=L.toStringTag||"@@toStringTag";function R(v,f,g){return Object.defineProperty(v,f,{value:g,enumerable:!0,configurable:!0,writable:!0}),v[f]}try{R({},"")}catch(v){R=function(f,g,E){return f[g]=E}}function K(v,f,g,E){var O=f&&f.prototype instanceof c?f:c,Q=Object.create(O.prototype),ee=new se(E||[]);return Q._invoke=xe(v,g,ee),Q}A.wrap=K;function H(v,f,g){try{return{type:"normal",arg:v.call(f,g)}}catch(E){return{type:"throw",arg:E}}}var q="suspendedStart",oe="suspendedYield",pe="executing",fe="completed",j={};function c(){}function S(){}function N(){}var W={};R(W,z,function(){return this});var ne=Object.getPrototypeOf,Y=ne&&ne(ne(Oe([])));Y&&Y!==P&&x.call(Y,z)&&(W=Y);var F=N.prototype=c.prototype=Object.create(W);S.prototype=N,R(F,"constructor",N),R(N,"constructor",S),S.displayName=R(N,C,"GeneratorFunction");function ie(v){["next","throw","return"].forEach(function(f){R(v,f,function(g){return this._invoke(f,g)})})}A.isGeneratorFunction=function(v){var f=typeof v=="function"&&v.constructor;return f?f===S||(f.displayName||f.name)==="GeneratorFunction":!1},A.mark=function(v){return Object.setPrototypeOf?Object.setPrototypeOf(v,N):(v.__proto__=N,R(v,C,"GeneratorFunction")),v.prototype=Object.create(F),v},A.awrap=function(v){return{__await:v}};function te(v,f){function g(Q,ee,ue,ve){var ce=H(v[Q],v,ee);if(ce.type==="throw")ve(ce.arg);else{var Le=ce.arg,Ce=Le.value;return Ce&&typeof Ce=="object"&&x.call(Ce,"__await")?f.resolve(Ce.__await).then(function(Se){g("next",Se,ue,ve)},function(Se){g("throw",Se,ue,ve)}):f.resolve(Ce).then(function(Se){Le.value=Se,ue(Le)},function(Se){return g("throw",Se,ue,ve)})}}var E;function O(Q,ee){function ue(){return new f(function(ve,ce){g(Q,ee,ve,ce)})}return E=E?E.then(ue,ue):ue()}this._invoke=O}ie(te.prototype),R(te.prototype,$,function(){return this}),A.AsyncIterator=te,A.async=function(v,f,g,E,O){O===void 0&&(O=Promise);var Q=new te(K(v,f,g,E),O);return A.isGeneratorFunction(f)?Q:Q.next().then(function(ee){return ee.done?ee.value:Q.next()})};function xe(v,f,g){var E=q;return function(Q,ee){if(E===pe)throw new Error("Generator is already running");if(E===fe){if(Q==="throw")throw ee;return De()}for(g.method=Q,g.arg=ee;;){var ue=g.delegate;if(ue){var ve=_e(ue,g);if(ve){if(ve===j)continue;return ve}}if(g.method==="next")g.sent=g._sent=g.arg;else if(g.method==="throw"){if(E===q)throw E=fe,g.arg;g.dispatchException(g.arg)}else g.method==="return"&&g.abrupt("return",g.arg);E=pe;var ce=H(v,f,g);if(ce.type==="normal"){if(E=g.done?fe:oe,ce.arg===j)continue;return{value:ce.arg,done:g.done}}else ce.type==="throw"&&(E=fe,g.method="throw",g.arg=ce.arg)}}}function _e(v,f){var g=v.iterator[f.method];if(g===D){if(f.delegate=null,f.method==="throw"){if(v.iterator.return&&(f.method="return",f.arg=D,_e(v,f),f.method==="throw"))return j;f.method="throw",f.arg=new TypeError("The iterator does not provide a 'throw' method")}return j}var E=H(g,v.iterator,f.arg);if(E.type==="throw")return f.method="throw",f.arg=E.arg,f.delegate=null,j;var O=E.arg;if(!O)return f.method="throw",f.arg=new TypeError("iterator result is not an object"),f.delegate=null,j;if(O.done)f[v.resultName]=O.value,f.next=v.nextLoc,f.method!=="return"&&(f.method="next",f.arg=D);else return O;return f.delegate=null,j}ie(F),R(F,C,"Generator"),R(F,z,function(){return this}),R(F,"toString",function(){return"[object Generator]"});function U(v){var f={tryLoc:v[0]};1 in v&&(f.catchLoc=v[1]),2 in v&&(f.finallyLoc=v[2],f.afterLoc=v[3]),this.tryEntries.push(f)}function J(v){var f=v.completion||{};f.type="normal",delete f.arg,v.completion=f}function se(v){this.tryEntries=[{tryLoc:"root"}],v.forEach(U,this),this.reset(!0)}A.keys=function(v){var f=[];for(var g in v)f.push(g);return f.reverse(),function E(){for(;f.length;){var O=f.pop();if(O in v)return E.value=O,E.done=!1,E}return E.done=!0,E}};function Oe(v){if(v){var f=v[z];if(f)return f.call(v);if(typeof v.next=="function")return v;if(!isNaN(v.length)){var g=-1,E=function O(){for(;++g<v.length;)if(x.call(v,g))return O.value=v[g],O.done=!1,O;return O.value=D,O.done=!0,O};return E.next=E}}return{next:De}}A.values=Oe;function De(){return{value:D,done:!0}}return se.prototype={constructor:se,reset:function(v){if(this.prev=0,this.next=0,this.sent=this._sent=D,this.done=!1,this.delegate=null,this.method="next",this.arg=D,this.tryEntries.forEach(J),!v)for(var f in this)f.charAt(0)==="t"&&x.call(this,f)&&!isNaN(+f.slice(1))&&(this[f]=D)},stop:function(){this.done=!0;var v=this.tryEntries[0],f=v.completion;if(f.type==="throw")throw f.arg;return this.rval},dispatchException:function(v){if(this.done)throw v;var f=this;function g(ve,ce){return Q.type="throw",Q.arg=v,f.next=ve,ce&&(f.method="next",f.arg=D),!!ce}for(var E=this.tryEntries.length-1;E>=0;--E){var O=this.tryEntries[E],Q=O.completion;if(O.tryLoc==="root")return g("end");if(O.tryLoc<=this.prev){var ee=x.call(O,"catchLoc"),ue=x.call(O,"finallyLoc");if(ee&&ue){if(this.prev<O.catchLoc)return g(O.catchLoc,!0);if(this.prev<O.finallyLoc)return g(O.finallyLoc)}else if(ee){if(this.prev<O.catchLoc)return g(O.catchLoc,!0)}else if(ue){if(this.prev<O.finallyLoc)return g(O.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(v,f){for(var g=this.tryEntries.length-1;g>=0;--g){var E=this.tryEntries[g];if(E.tryLoc<=this.prev&&x.call(E,"finallyLoc")&&this.prev<E.finallyLoc){var O=E;break}}O&&(v==="break"||v==="continue")&&O.tryLoc<=f&&f<=O.finallyLoc&&(O=null);var Q=O?O.completion:{};return Q.type=v,Q.arg=f,O?(this.method="next",this.next=O.finallyLoc,j):this.complete(Q)},complete:function(v,f){if(v.type==="throw")throw v.arg;return v.type==="break"||v.type==="continue"?this.next=v.arg:v.type==="return"?(this.rval=this.arg=v.arg,this.method="return",this.next="end"):v.type==="normal"&&f&&(this.next=f),j},finish:function(v){for(var f=this.tryEntries.length-1;f>=0;--f){var g=this.tryEntries[f];if(g.finallyLoc===v)return this.complete(g.completion,g.afterLoc),J(g),j}},catch:function(v){for(var f=this.tryEntries.length-1;f>=0;--f){var g=this.tryEntries[f];if(g.tryLoc===v){var E=g.completion;if(E.type==="throw"){var O=E.arg;J(g)}return O}}throw new Error("illegal catch attempt")},delegateYield:function(v,f,g){return this.delegate={iterator:Oe(v),resultName:f,nextLoc:g},this.method==="next"&&(this.arg=D),j}},A}(k.exports);try{regeneratorRuntime=G}catch(A){typeof globalThis=="object"?globalThis.regeneratorRuntime=G:Function("r","regeneratorRuntime = r")(G)}},695:function(k,G,A){A.d(G,{Z:function(){return P}});function P(x){if(x.geometry&&x.geometry.dispose(),x.material){var D=Array.isArray(x.material)?x.material:[x.material];D.forEach(function(L){var z,$,C,R,K,H,q,oe,pe,fe,j,c,S;(z=L.map)===null||z===void 0||z.dispose(),($=L.lightMap)===null||$===void 0||$.dispose(),(C=L.bumpMap)===null||C===void 0||C.dispose(),(R=L.normalMap)===null||R===void 0||R.dispose(),(K=L.specularMap)===null||K===void 0||K.dispose(),(H=L.envMap)===null||H===void 0||H.dispose(),(q=L.alphaMap)===null||q===void 0||q.dispose(),(oe=L.aoMap)===null||oe===void 0||oe.dispose(),(pe=L.displacementMap)===null||pe===void 0||pe.dispose(),(fe=L.emissiveMap)===null||fe===void 0||fe.dispose(),(j=L.gradientMap)===null||j===void 0||j.dispose(),(c=L.metalnessMap)===null||c===void 0||c.dispose(),(S=L.roughnessMap)===null||S===void 0||S.dispose(),L.dispose()})}}},584:function(k,G,A){A.d(G,{wf:function(){return L.Z}});var P=A(666),x=A.n(P),D=null,L=A(695),z=A(949);function $(j){if(j.material){var c=Array.isArray(j.material)?j.material:[j.material];c.forEach(function(S){var N,W;(N=S.color)===null||N===void 0||N.convertSRGBToLinear(),(W=S.emissive)===null||W===void 0||W.convertSRGBToLinear(),S.map&&(S.map.encoding=THREE.sRGBEncoding),S.emissiveMap&&(S.emissiveMap.encoding=THREE.sRGBEncoding)})}}var C=A(568),R=A(924),K=A(77),H=A(484),q=null,oe=null,pe=function(){var j=(0,C.Z)(x().mark(function c(S,N){var W,ne,Y,F,ie,te,xe,_e,U;return x().wrap(function(se){for(;;)switch(se.prev=se.next){case 0:return W=N.type,ne=W===void 0?"blob":W,Y=N.version,F=Y===void 0?"1":Y,se.next=4,(0,K.get)(S);case 4:if(te=se.sent,!(te&&te[F])){se.next=9;break}ie=te[F],se.next=15;break;case 9:return se.next=11,(0,H.Z)(fetch(S).then(function(Oe){if(Oe.ok)return Oe[ne]();throw new Error}));case 11:xe=se.sent,_e=xe.res,U=xe.err,U||(ie=_e,(0,K.set)(S,(0,R.Z)({},F,_e)));case 15:return se.abrupt("return",ie?{url:ne==="json"?S:URL.createObjectURL(ie),store:ie}:{url:S});case 16:case"end":return se.stop()}},c)}));return function(S,N){return j.apply(this,arguments)}}(),fe=A(705)},484:function(k,G,A){A.d(G,{Z:function(){return x}});var P=A(42);function x(D){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return D.then(function(z){return(0,P.Z)({err:null,res:z},L)}).catch(function(z){return(0,P.Z)({err:z,res:void 0},L)})}},705:function(k,G,A){A.d(G,{C:function(){return L},y:function(){return D}});var P=A(949),x=new Map,D=function(){var z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{generateTopUV:function($,C,R,K,H){var q=C[R*3],oe=C[R*3+1],pe=C[K*3],fe=C[K*3+1],j=C[H*3],c=C[H*3+1],S;if(x.has($))S=x.get($);else{var N=z.box3||new P.Box3;if(!z.box3){var W=$.parameters.shapes.getPoints();N.setFromArray(W.map(function(te){return[te.x,te.y,0]}).flat())}var ne=N.getSize(new P.Vector3);z.split&&(ne.y/=z.split),S={box:N,size:ne},x.set($,S)}var Y=S.box,F=S.size,ie=z.split?1-z.split:0;return[new P.Vector2((q-Y.min.x)/F.x,(oe-Y.min.y)/F.y+ie),new P.Vector2((pe-Y.min.x)/F.x,(fe-Y.min.y)/F.y+ie),new P.Vector2((j-Y.min.x)/F.x,(c-Y.min.y)/F.y+ie)]},generateSideWallUV:function($,C,R,K,H,q){var oe=C[R*3],pe=C[R*3+1],fe=C[R*3+2],j=C[K*3],c=C[K*3+1],S=C[K*3+2],N=C[H*3],W=C[H*3+1],ne=C[H*3+2],Y=C[q*3],F=C[q*3+1],ie=C[q*3+2],te;if(x.has(C))te=x.get(C);else{var xe=new P.Box3;xe.setFromArray(C);var _e=xe.getSize(new P.Vector3);z.split&&(_e.z/=1-z.split),te={box:xe,size:_e},x.set(C,te)}var U=te.box,J=te.size;return Math.abs(pe-c)<Math.abs(oe-j)?[new P.Vector2((oe-U.min.x)/J.x,(fe-U.min.z)/J.z),new P.Vector2((j-U.min.x)/J.x,(S-U.min.z)/J.z),new P.Vector2((N-U.min.x)/J.x,(ne-U.min.z)/J.z),new P.Vector2((Y-U.min.x)/J.x,(ie-U.min.z)/J.z)]:[new P.Vector2((pe-U.min.y)/J.y,(fe-U.min.z)/J.z),new P.Vector2((c-U.min.y)/J.y,(S-U.min.z)/J.z),new P.Vector2((W-U.min.y)/J.y,(ne-U.min.z)/J.z),new P.Vector2((F-U.min.y)/J.y,(ie-U.min.z)/J.z)]}}},L=function(){x.clear()}},77:function(k,G,A){var P=D=>{var L={};return A.d(L,D),L},x=D=>()=>D;k.exports=P({get:()=>ot.get,set:()=>ot.set})},949:function(k){var G=P=>{var x={};return Z.d(x,P),x},A=P=>()=>P;k.exports=$t},568:function(k,G,A){A.d(G,{Z:function(){return x}});function P(D,L,z,$,C,R,K){try{var H=D[R](K),q=H.value}catch(oe){z(oe);return}H.done?L(q):Promise.resolve(q).then($,C)}function x(D){return function(){var L=this,z=arguments;return new Promise(function($,C){var R=D.apply(L,z);function K(q){P(R,$,C,K,H,"next",q)}function H(q){P(R,$,C,K,H,"throw",q)}K(void 0)})}}},924:function(k,G,A){A.d(G,{Z:function(){return P}});function P(x,D,L){return D in x?Object.defineProperty(x,D,{value:L,enumerable:!0,configurable:!0,writable:!0}):x[D]=L,x}},42:function(k,G,A){A.d(G,{Z:function(){return x}});var P=A(924);function x(D){for(var L=1;L<arguments.length;L++){var z=arguments[L]!=null?arguments[L]:{},$=Object.keys(z);typeof Object.getOwnPropertySymbols=="function"&&($=$.concat(Object.getOwnPropertySymbols(z).filter(function(C){return Object.getOwnPropertyDescriptor(z,C).enumerable}))),$.forEach(function(C){(0,P.Z)(D,C,z[C])})}return D}}},ct={};function Z(k){var G=ct[k];if(G!==void 0)return G.exports;var A=ct[k]={exports:{}};return ir[k](A,A.exports,Z),A.exports}(function(){Z.n=function(k){var G=k&&k.__esModule?function(){return k.default}:function(){return k};return Z.d(G,{a:G}),G}})(),function(){Z.d=function(k,G){for(var A in G)Z.o(G,A)&&!Z.o(k,A)&&Object.defineProperty(k,A,{enumerable:!0,get:G[A]})}}(),function(){Z.o=function(k,G){return Object.prototype.hasOwnProperty.call(k,G)}}();var de={};(function(){Z.d(de,{Ei:function(){return Kt},Yo:function(){return Ft},ZA:function(){return pt},Ee:function(){return Le},x1:function(){return Mt},VJ:function(){return Me},r7:function(){return Ie},XA:function(){return $e},NB:function(){return ht},xv:function(){return Ce},nk:function(){return lt},JX:function(){return Xt},TQ:function(){return Pt}});function k(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function G(e,n){return G=Object.setPrototypeOf||function(i,a){return i.__proto__=a,i},G(e,n)}function A(e,n){return G(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&&A(e,n)}var x=Z(42);function D(){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 L(e,n,r){return D()?L=Reflect.construct:L=function(a,t,o){var s=[null];s.push.apply(s,t);var l=Function.bind.apply(a,s),h=new l;return o&&A(h,o.prototype),h},L.apply(null,arguments)}function z(e,n,r){return L.apply(null,arguments)}function $(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function C(e){return C=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},C(e)}function R(e){return C(e)}function K(e){var n=typeof Map=="function"?new Map:void 0;return K=function(i){if(i===null||!$(i))return i;if(typeof i!="function")throw new TypeError("Super expression must either be null or a function");if(typeof n!="undefined"){if(n.has(i))return n.get(i);n.set(i,a)}function a(){return z(i,arguments,R(this).constructor)}return a.prototype=Object.create(i.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),A(a,i)},K(e)}function H(e){return K(e)}function q(){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 oe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function pe(e){return e&&e.constructor===Symbol?"symbol":typeof e}function fe(e,n){return n&&(pe(n)==="object"||typeof n=="function")?n:oe(e)}function j(e){var n=q();return function(){var i=R(e),a;if(n){var t=R(this).constructor;a=Reflect.construct(i,arguments,t)}else a=i.apply(this,arguments);return fe(this,a)}}var c=Z(949),S=Z(568),N=Z(666),W=Z.n(N);function ne(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 Y(e,n,r){return n&&ne(e.prototype,n),r&&ne(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 ie(e){if(Array.isArray(e))return F(e)}function te(e){if(typeof Symbol!="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function xe(){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 _e(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 U(e){return ie(e)||te(e)||_e(e)||xe()}var J=Z(484);function se(){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,J.Z)(r.promise,n)),r}var Oe=e=>{var n={};return Z.d(n,e),n},De=e=>()=>e,v=Oe({CSS2DObject:()=>Yt.CSS2DObject}),f=e=>{var n={};return Z.d(n,e),n},g=e=>()=>e,E=f({CSS3DObject:()=>st.CSS3DObject,CSS3DSprite:()=>st.CSS3DSprite}),O=Z(584),Q=function(e){e&&((0,O.wf)(e),e.children.forEach(function(n){n.userData.BaseObject_||Q(n)}))},ee=function(){"use strict";function e(){k(this,e),this.objecttype__="BaseObject",this.userData={},this.pm=se(),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=z(c.Mesh,U(a)),this},n.createGroup=function(){return this.object3d=new c.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=z(c.Points,U(a)),this},n.createCSS2DObject=function(i){return this.object3d=new v.CSS2DObject(i),this},n.createCSS3DObject=function(i){return this.object3d=new E.CSS3DObject(i),this},n.createCSS3DSprite=function(i){return this.object3d=new E.CSS3DSprite(i),this},n.createSprite=function(i){return this.object3d=new c.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,U(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,U(a)),this},n.getSize=function(){var i=new c.Box3().setFromObject(this.object3d);return{min:i.min,max:i.max,size:i.getSize(new c.Vector3)}},n.traverse=function(i){i(this),this.children.forEach(function(a){a.traverse(i)})},n.dispose=function(){Q(this.object3d)},Y(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}(),ue=+c.REVISION<144,ve=ue?"ExtrudeBufferGeometry":"ExtrudeGeometry",ce=ue?"PlaneBufferGeometry":"PlaneGeometry",Le=function(e){"use strict";P(r,e);var n=j(r);function r(a){k(this,r);var t;return t=n.call(this),t.scale=1,t.options=(0,x.Z)({},{scale:1},a),t}var i=r.prototype;return i.getMaterial=function(){var t=this;return(0,S.Z)(W().mark(function o(){var s,l,h,p,d,_,b,w,y,u;return W().wrap(function(M){for(;;)switch(M.prev=M.next){case 0:return s=t.options,l=s.transparent,h=s.blending,p=s.depthWrite,d=s.depthTest,_=s.alphaTest,b=s.sprite,w=s.sizeAttenuation,M.next=3,t.getTexture();case 3:return y=M.sent,u=b?new c.SpriteMaterial({map:y,transparent:l!=null?l:!1,blending:h!=null?h:c.NormalBlending,depthWrite:p!=null?p:!0,depthTest:d!=null?d:!0,alphaTest:_!=null?_:0,sizeAttenuation:w!=null?w:!0}):new c.MeshBasicMaterial({map:y,transparent:l!=null?l:!1,blending:h!=null?h:c.NormalBlending,depthWrite:p!=null?p:!0,depthTest:d!=null?d:!0,alphaTest:_!=null?_:0}),M.abrupt("return",u);case 6:case"end":return M.stop()}},o)}))()},i.create=function(){var t=this;return(0,S.Z)(W().mark(function o(){var s,l,h,p,d,_,b,w,y;return W().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:if(s=t.options,l=s.scale,h=s.position,p=s.src,d=s.cache,_=s.sprite,b=p,!(d&&!d.get(b))){m.next=8;break}return d.init(b),m.next=6,t.getMaterial();case 6:w=m.sent,d.set(b,w);case 8:if(!d){m.next=14;break}return m.next=11,d.get(b);case 11:m.t0=m.sent,m.next=17;break;case 14:return m.next=16,t.getMaterial();case 16:m.t0=m.sent;case 17:y=m.t0,t.texture=y.map,_?t.createSprite(y):t.createMesh(new c[ce](1,1),y),t.setScale(l),h&&t.object3d.position.copy(h);case 22:case"end":return m.stop()}},o)}))()},i.setScale=function(t){this.scale=t,this.object3d.scale.set(this.texture.image.width*t,this.texture.image.height*t,1)},i.setTexture=function(t){var o=this.object3d;o.material.map&&o.material.map.dispose(),o.material.map=t,o.material.needsUpdate=!0,this.texture=t,this.setScale(this.scale)},i.getTexture=function(){var t=this.options.src;return new c.TextureLoader().loadAsync(t)},r}(ee),Ce=function(e){"use strict";P(r,e);var n=j(r);function r(a){k(this,r);var t;return t=n.call(this,a),t.canvas=document.createElement("canvas"),t}var i=r.prototype;return i.getTexture=function(){var t=this.options,o=t.text,s=t.textOptions,l=(0,x.Z)({},{fontSize:28,fontFamily:"system-ui,-apple-system,BlinkMacSystemFont,sans-serif",fontWeight:"normal",flipX:!1,color:"#ffffff",setCtx:function(T){}},s||{}),h=l.fontSize,p=l.fontFamily,d=l.fontWeight,_=l.flipX,b=l.color,w=l.setCtx,y=this.canvas;y.width=h*o.length*2,y.height=h;var u=y.getContext("2d");u.font="".concat(d," ").concat(h,"px/1 ").concat(p);var m=u.measureText(o).width;y.width=m,u=y.getContext("2d"),u.clearRect(0,0,y.width,y.height),_&&u.scale(-1,1),u.font="".concat(d," ").concat(h,"px/1 ").concat(p),u.textBaseline="middle",u.fillStyle=b,w&&w(u),u.fillText(o,_?m*-1:0,y.height/2),u.restore();var M=new c.Texture(y);return M.anisotropy=this.pencil.renderer.capabilities.getMaxAnisotropy(),M.needsUpdate=!0,Promise.resolve(M)},r}(H(Le));function Se(e,n){for(;!Object.prototype.hasOwnProperty.call(e,n)&&(e=R(e),e!==null););return e}function Ve(e,n,r){return typeof Reflect!="undefined"&&Reflect.get?Ve=Reflect.get:Ve=function(a,t,o){var s=Se(a,t);if(!!s){var l=Object.getOwnPropertyDescriptor(s,t);return l.get?l.get.call(o||a):l.value}},Ve(e,n,r)}function Ue(e,n,r){return Ve(e,n,r)}var lt=function(e){"use strict";P(r,e);var n=j(r);function r(a){k(this,r);var t;return t=n.call(this),t.scale=1,t.options=(0,x.Z)({},{scale:1,autoPlay:!0,loop:!0},a),t}var i=r.prototype;return i.getMaterial=function(){var t=this.options,o=t.src,s=t.transparent,l=t.blending,h=t.depthWrite,p=t.depthTest,d=t.format,_=t.autoPlay,b=t.loop,w=t.alphaTest,y=t.sprite,u=se(),m=document.createElement("video");return m.addEventListener("loadedmetadata",function(){var M=new c.VideoTexture(m);M.format=d!=null?d:c.RGBAFormat,M.needsUpdate=!0;var T=y?new c.SpriteMaterial({map:M,transparent:s!=null?s:!1,blending:l!=null?l:c.NormalBlending,depthWrite:h!=null?h:!0,depthTest:p!=null?p:!0,alphaTest:w!=null?w:0}):new c.MeshBasicMaterial({map:M,transparent:s!=null?s:!1,blending:l!=null?l:c.NormalBlending,depthWrite:h!=null?h:!0,depthTest:p!=null?p:!0,alphaTest:w!=null?w:0});u.resolve(T)},!1),m.src=o,m.muted=!0,m.autoplay=_,m.loop=b,m.preload="auto",u.promise},i.create=function(){var t=this;return(0,S.Z)(W().mark(function o(){var s,l,h,p,d,_,b,w;return W().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(s=t.options,l=s.scale,h=s.position,p=s.src,d=s.cache,_=s.sprite,!(d&&!d.get(p))){u.next=7;break}return d.init(p),u.next=5,t.getMaterial();case 5:b=u.sent,d.set(p,b);case 7:if(!d){u.next=13;break}return u.next=10,d.get(p);case 10:u.t0=u.sent,u.next=16;break;case 13:return u.next=15,t.getMaterial();case 15:u.t0=u.sent;case 16:w=u.t0,t.video=w.map.image,_?t.createSprite(w):t.createMesh(new c[ce](1,1),w),t.setScale(l),h&&t.object3d.position.copy(h);case 21:case"end":return u.stop()}},o)}))()},i.setScale=function(t){this.scale=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(),Ue(R(r.prototype),"dispose",this).call(this)},r}(ee),ft=function(e){"use strict";P(r,e);var n=j(r);function r(a){k(this,r);var t;return t=n.call(this),t.type_="node",t.options=(0,x.Z)({},{event:"click"},a),t}var i=r.prototype;return i.create=function(){var t=this.options,o=t.position,s=t.children,l=t.handler,h=t.event,p=document.createElement("div");this.element=p,p.appendChild(s),this.createCSS2DObject(p),o&&this.object3d.position.copy(o),l&&h&&this.clickTarge.forEach(function(d){var _=Array.isArray(h)?h:[h],b=Array.isArray(l)?l:[l];_.forEach(function(w,y){var u=b[y];u&&d.addEventListener(w,u)})})},i.getMaterial=function(t){return(0,S.Z)(W().mark(function o(){var s,l,h,p;return W().wrap(function(_){for(;;)switch(_.prev=_.next){case 0:return s=document.createElement("canvas"),s.width=256,s.height=256,l=s.getContext("2d"),l.fillStyle="#ff0000",l.fillRect(0,0,256,256),h=new c.CanvasTexture(s),p=new c.SpriteMaterial({map:h,opacity:t?1:0,transparent:!0,alphaTest:.1,sizeAttenuation:!1}),_.abrupt("return",p);case 9:case"end":return _.stop()}},o)}))()},i.createPickObject=function(t){var o=t.show,s=o===void 0?!1:o,l=t.scale,h=l===void 0?new c.Vector3(1,1,1):l,p=t.position,d=p===void 0?new c.Vector3(0,0,0):p,_=t.cache,b=this;return(0,S.Z)(W().mark(function w(){var y,u,m,M;return W().wrap(function(V){for(;;)switch(V.prev=V.next){case 0:if(y="node-create-pick-object",!(_&&!_.get(y))){V.next=7;break}return _.init(y),V.next=5,b.getMaterial(s);case 5:u=V.sent,_.set(y,u);case 7:if(!_){V.next=13;break}return V.next=10,_.get(y);case 10:V.t0=V.sent,V.next=16;break;case 13:return V.next=15,b.getMaterial(s);case 15:V.t0=V.sent;case 16:m=V.t0,M=new c.Sprite(m),M.scale.set(m.map.image.width*h.x,m.map.image.height*h.y,1),M.position.copy(d),b.add(M),b.pickObject=M;case 22:case"end":return V.stop()}},w)}))()},i.dispose=function(){var t=this.options,o=t.handler,s=t.event;o&&s&&this.clickTarge.forEach(function(l){var h=Array.isArray(s)?s:[s],p=Array.isArray(o)?o:[o];h.forEach(function(d,_){var b=p[_];b&&l.removeEventListener(d,b)})}),Ue(R(r.prototype),"dispose",this).call(this)},Y(r,[{key:"clickTarge",get:function(){var t=this,o=this.options.eventTarge;if(o){var s=o.map(function(l){return U(t.element.querySelectorAll(l))}).flat();return s}return[this.element]}}]),r}(ee),ht=ft,pt=function(e){"use strict";P(r,e);var n=j(r);function r(){return k(this,r),n.apply(this,arguments)}var i=r.prototype;return i.create=function(){this.createGroup()},r}(ee),vt=`
|
|
1
|
+
import*as st from"idb-keyval";import*as $t from"three";import*as Yt from"three/examples/jsm/renderers/CSS2DRenderer";import*as ut from"three/examples/jsm/renderers/CSS3DRenderer";import*as ct from"popmotion";import*as Jt from"three/examples/jsm//utils/BufferGeometryUtils";import*as Xe from"d3-array";import*as Qt from"earcut";import*as qt from"@turf/boolean-clockwise";import*as er from"delaunator";import*as tr from"@turf/boolean-point-in-polygon";import*as De from"d3-geo";import*as rr from"d3-geo-voronoi";import*as nr from"d3-scale";var ir={666:function(T){var B=function(x){"use strict";var M=Object.prototype,b=M.hasOwnProperty,D,L=typeof Symbol=="function"?Symbol:{},W=L.iterator||"@@iterator",H=L.asyncIterator||"@@asyncIterator",O=L.toStringTag||"@@toStringTag";function R(p,f,g){return Object.defineProperty(p,f,{value:g,enumerable:!0,configurable:!0,writable:!0}),p[f]}try{R({},"")}catch(p){R=function(f,g,C){return f[g]=C}}function I(p,f,g,C){var S=f&&f.prototype instanceof c?f:c,J=Object.create(S.prototype),q=new se(C||[]);return J._invoke=be(p,g,q),J}x.wrap=I;function X(p,f,g){try{return{type:"normal",arg:p.call(f,g)}}catch(C){return{type:"throw",arg:C}}}var Q="suspendedStart",oe="suspendedYield",he="executing",le="completed",k={};function c(){}function P(){}function U(){}var G={};R(G,W,function(){return this});var ne=Object.getPrototypeOf,$=ne&&ne(ne(Oe([])));$&&$!==M&&b.call($,W)&&(G=$);var K=U.prototype=c.prototype=Object.create(G);P.prototype=U,R(K,"constructor",U),R(U,"constructor",P),P.displayName=R(U,O,"GeneratorFunction");function ie(p){["next","throw","return"].forEach(function(f){R(p,f,function(g){return this._invoke(f,g)})})}x.isGeneratorFunction=function(p){var f=typeof p=="function"&&p.constructor;return f?f===P||(f.displayName||f.name)==="GeneratorFunction":!1},x.mark=function(p){return Object.setPrototypeOf?Object.setPrototypeOf(p,U):(p.__proto__=U,R(p,O,"GeneratorFunction")),p.prototype=Object.create(K),p},x.awrap=function(p){return{__await:p}};function te(p,f){function g(J,q,ue,pe){var ce=X(p[J],p,q);if(ce.type==="throw")pe(ce.arg);else{var Ee=ce.arg,Ce=Ee.value;return Ce&&typeof Ce=="object"&&b.call(Ce,"__await")?f.resolve(Ce.__await).then(function(Pe){g("next",Pe,ue,pe)},function(Pe){g("throw",Pe,ue,pe)}):f.resolve(Ce).then(function(Pe){Ee.value=Pe,ue(Ee)},function(Pe){return g("throw",Pe,ue,pe)})}}var C;function S(J,q){function ue(){return new f(function(pe,ce){g(J,q,pe,ce)})}return C=C?C.then(ue,ue):ue()}this._invoke=S}ie(te.prototype),R(te.prototype,H,function(){return this}),x.AsyncIterator=te,x.async=function(p,f,g,C,S){S===void 0&&(S=Promise);var J=new te(I(p,f,g,C),S);return x.isGeneratorFunction(f)?J:J.next().then(function(q){return q.done?q.value:J.next()})};function be(p,f,g){var C=Q;return function(J,q){if(C===he)throw new Error("Generator is already running");if(C===le){if(J==="throw")throw q;return Ve()}for(g.method=J,g.arg=q;;){var ue=g.delegate;if(ue){var pe=me(ue,g);if(pe){if(pe===k)continue;return pe}}if(g.method==="next")g.sent=g._sent=g.arg;else if(g.method==="throw"){if(C===Q)throw C=le,g.arg;g.dispatchException(g.arg)}else g.method==="return"&&g.abrupt("return",g.arg);C=he;var ce=X(p,f,g);if(ce.type==="normal"){if(C=g.done?le:oe,ce.arg===k)continue;return{value:ce.arg,done:g.done}}else ce.type==="throw"&&(C=le,g.method="throw",g.arg=ce.arg)}}}function me(p,f){var g=p.iterator[f.method];if(g===D){if(f.delegate=null,f.method==="throw"){if(p.iterator.return&&(f.method="return",f.arg=D,me(p,f),f.method==="throw"))return k;f.method="throw",f.arg=new TypeError("The iterator does not provide a 'throw' method")}return k}var C=X(g,p.iterator,f.arg);if(C.type==="throw")return f.method="throw",f.arg=C.arg,f.delegate=null,k;var S=C.arg;if(!S)return f.method="throw",f.arg=new TypeError("iterator result is not an object"),f.delegate=null,k;if(S.done)f[p.resultName]=S.value,f.next=p.nextLoc,f.method!=="return"&&(f.method="next",f.arg=D);else return S;return f.delegate=null,k}ie(K),R(K,O,"Generator"),R(K,W,function(){return this}),R(K,"toString",function(){return"[object Generator]"});function V(p){var f={tryLoc:p[0]};1 in p&&(f.catchLoc=p[1]),2 in p&&(f.finallyLoc=p[2],f.afterLoc=p[3]),this.tryEntries.push(f)}function Y(p){var f=p.completion||{};f.type="normal",delete f.arg,p.completion=f}function se(p){this.tryEntries=[{tryLoc:"root"}],p.forEach(V,this),this.reset(!0)}x.keys=function(p){var f=[];for(var g in p)f.push(g);return f.reverse(),function C(){for(;f.length;){var S=f.pop();if(S in p)return C.value=S,C.done=!1,C}return C.done=!0,C}};function Oe(p){if(p){var f=p[W];if(f)return f.call(p);if(typeof p.next=="function")return p;if(!isNaN(p.length)){var g=-1,C=function S(){for(;++g<p.length;)if(b.call(p,g))return S.value=p[g],S.done=!1,S;return S.value=D,S.done=!0,S};return C.next=C}}return{next:Ve}}x.values=Oe;function Ve(){return{value:D,done:!0}}return se.prototype={constructor:se,reset:function(p){if(this.prev=0,this.next=0,this.sent=this._sent=D,this.done=!1,this.delegate=null,this.method="next",this.arg=D,this.tryEntries.forEach(Y),!p)for(var f in this)f.charAt(0)==="t"&&b.call(this,f)&&!isNaN(+f.slice(1))&&(this[f]=D)},stop:function(){this.done=!0;var p=this.tryEntries[0],f=p.completion;if(f.type==="throw")throw f.arg;return this.rval},dispatchException:function(p){if(this.done)throw p;var f=this;function g(pe,ce){return J.type="throw",J.arg=p,f.next=pe,ce&&(f.method="next",f.arg=D),!!ce}for(var C=this.tryEntries.length-1;C>=0;--C){var S=this.tryEntries[C],J=S.completion;if(S.tryLoc==="root")return g("end");if(S.tryLoc<=this.prev){var q=b.call(S,"catchLoc"),ue=b.call(S,"finallyLoc");if(q&&ue){if(this.prev<S.catchLoc)return g(S.catchLoc,!0);if(this.prev<S.finallyLoc)return g(S.finallyLoc)}else if(q){if(this.prev<S.catchLoc)return g(S.catchLoc,!0)}else if(ue){if(this.prev<S.finallyLoc)return g(S.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(p,f){for(var g=this.tryEntries.length-1;g>=0;--g){var C=this.tryEntries[g];if(C.tryLoc<=this.prev&&b.call(C,"finallyLoc")&&this.prev<C.finallyLoc){var S=C;break}}S&&(p==="break"||p==="continue")&&S.tryLoc<=f&&f<=S.finallyLoc&&(S=null);var J=S?S.completion:{};return J.type=p,J.arg=f,S?(this.method="next",this.next=S.finallyLoc,k):this.complete(J)},complete:function(p,f){if(p.type==="throw")throw p.arg;return p.type==="break"||p.type==="continue"?this.next=p.arg:p.type==="return"?(this.rval=this.arg=p.arg,this.method="return",this.next="end"):p.type==="normal"&&f&&(this.next=f),k},finish:function(p){for(var f=this.tryEntries.length-1;f>=0;--f){var g=this.tryEntries[f];if(g.finallyLoc===p)return this.complete(g.completion,g.afterLoc),Y(g),k}},catch:function(p){for(var f=this.tryEntries.length-1;f>=0;--f){var g=this.tryEntries[f];if(g.tryLoc===p){var C=g.completion;if(C.type==="throw"){var S=C.arg;Y(g)}return S}}throw new Error("illegal catch attempt")},delegateYield:function(p,f,g){return this.delegate={iterator:Oe(p),resultName:f,nextLoc:g},this.method==="next"&&(this.arg=D),k}},x}(T.exports);try{regeneratorRuntime=B}catch(x){typeof globalThis=="object"?globalThis.regeneratorRuntime=B:Function("r","regeneratorRuntime = r")(B)}},695:function(T,B,x){x.d(B,{Z:function(){return M}});function M(b){if(b.geometry&&b.geometry.dispose(),b.material){var D=Array.isArray(b.material)?b.material:[b.material];D.forEach(function(L){var W,H,O,R,I,X,Q,oe,he,le,k,c,P;(W=L.map)===null||W===void 0||W.dispose(),(H=L.lightMap)===null||H===void 0||H.dispose(),(O=L.bumpMap)===null||O===void 0||O.dispose(),(R=L.normalMap)===null||R===void 0||R.dispose(),(I=L.specularMap)===null||I===void 0||I.dispose(),(X=L.envMap)===null||X===void 0||X.dispose(),(Q=L.alphaMap)===null||Q===void 0||Q.dispose(),(oe=L.aoMap)===null||oe===void 0||oe.dispose(),(he=L.displacementMap)===null||he===void 0||he.dispose(),(le=L.emissiveMap)===null||le===void 0||le.dispose(),(k=L.gradientMap)===null||k===void 0||k.dispose(),(c=L.metalnessMap)===null||c===void 0||c.dispose(),(P=L.roughnessMap)===null||P===void 0||P.dispose(),L.dispose()})}}},584:function(T,B,x){x.d(B,{wf:function(){return L.Z}});var M=x(666),b=x.n(M),D=null,L=x(695),W=x(949);function H(k){if(k.material){var c=Array.isArray(k.material)?k.material:[k.material];c.forEach(function(P){var U,G;(U=P.color)===null||U===void 0||U.convertSRGBToLinear(),(G=P.emissive)===null||G===void 0||G.convertSRGBToLinear(),P.map&&(P.map.encoding=THREE.sRGBEncoding),P.emissiveMap&&(P.emissiveMap.encoding=THREE.sRGBEncoding)})}}var O=x(568),R=x(924),I=x(77),X=x(484),Q=null,oe=null,he=function(){var k=(0,O.Z)(b().mark(function c(P,U){var G,ne,$,K,ie,te,be,me,V;return b().wrap(function(se){for(;;)switch(se.prev=se.next){case 0:return G=U.type,ne=G===void 0?"blob":G,$=U.version,K=$===void 0?"1":$,se.next=4,(0,I.get)(P);case 4:if(te=se.sent,!(te&&te[K])){se.next=9;break}ie=te[K],se.next=15;break;case 9:return se.next=11,(0,X.Z)(fetch(P).then(function(Oe){if(Oe.ok)return Oe[ne]();throw new Error}));case 11:be=se.sent,me=be.res,V=be.err,V||(ie=me,(0,I.set)(P,(0,R.Z)({},K,me)));case 15:return se.abrupt("return",ie?{url:ne==="json"?P:URL.createObjectURL(ie),store:ie}:{url:P});case 16:case"end":return se.stop()}},c)}));return function(P,U){return k.apply(this,arguments)}}(),le=x(705)},484:function(T,B,x){x.d(B,{Z:function(){return b}});var M=x(42);function b(D){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return D.then(function(W){return(0,M.Z)({err:null,res:W},L)}).catch(function(W){return(0,M.Z)({err:W,res:void 0},L)})}},705:function(T,B,x){x.d(B,{C:function(){return L},y:function(){return D}});var M=x(949),b=new Map,D=function(){var W=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{generateTopUV:function(H,O,R,I,X){var Q=O[R*3],oe=O[R*3+1],he=O[I*3],le=O[I*3+1],k=O[X*3],c=O[X*3+1],P;if(b.has(H))P=b.get(H);else{var U=W.box3||new M.Box3;if(!W.box3){var G=H.parameters.shapes.getPoints();U.setFromArray(G.map(function(te){return[te.x,te.y,0]}).flat())}var ne=U.getSize(new M.Vector3);W.split&&(ne.y/=W.split),P={box:U,size:ne},b.set(H,P)}var $=P.box,K=P.size,ie=W.split?1-W.split:0;return[new M.Vector2((Q-$.min.x)/K.x,(oe-$.min.y)/K.y+ie),new M.Vector2((he-$.min.x)/K.x,(le-$.min.y)/K.y+ie),new M.Vector2((k-$.min.x)/K.x,(c-$.min.y)/K.y+ie)]},generateSideWallUV:function(H,O,R,I,X,Q){var oe=O[R*3],he=O[R*3+1],le=O[R*3+2],k=O[I*3],c=O[I*3+1],P=O[I*3+2],U=O[X*3],G=O[X*3+1],ne=O[X*3+2],$=O[Q*3],K=O[Q*3+1],ie=O[Q*3+2],te;if(b.has(O))te=b.get(O);else{var be=new M.Box3;be.setFromArray(O);var me=be.getSize(new M.Vector3);W.split&&(me.z/=1-W.split),te={box:be,size:me},b.set(O,te)}var V=te.box,Y=te.size;return Math.abs(he-c)<Math.abs(oe-k)?[new M.Vector2((oe-V.min.x)/Y.x,(le-V.min.z)/Y.z),new M.Vector2((k-V.min.x)/Y.x,(P-V.min.z)/Y.z),new M.Vector2((U-V.min.x)/Y.x,(ne-V.min.z)/Y.z),new M.Vector2(($-V.min.x)/Y.x,(ie-V.min.z)/Y.z)]:[new M.Vector2((he-V.min.y)/Y.y,(le-V.min.z)/Y.z),new M.Vector2((c-V.min.y)/Y.y,(P-V.min.z)/Y.z),new M.Vector2((G-V.min.y)/Y.y,(ne-V.min.z)/Y.z),new M.Vector2((K-V.min.y)/Y.y,(ie-V.min.z)/Y.z)]}}},L=function(){b.clear()}},77:function(T,B,x){var M=D=>{var L={};return x.d(L,D),L},b=D=>()=>D;T.exports=M({get:()=>st.get,set:()=>st.set})},949:function(T){var B=M=>{var b={};return Z.d(b,M),b},x=M=>()=>M;T.exports=$t},568:function(T,B,x){x.d(B,{Z:function(){return b}});function M(D,L,W,H,O,R,I){try{var X=D[R](I),Q=X.value}catch(oe){W(oe);return}X.done?L(Q):Promise.resolve(Q).then(H,O)}function b(D){return function(){var L=this,W=arguments;return new Promise(function(H,O){var R=D.apply(L,W);function I(Q){M(R,H,O,I,X,"next",Q)}function X(Q){M(R,H,O,I,X,"throw",Q)}I(void 0)})}}},924:function(T,B,x){x.d(B,{Z:function(){return M}});function M(b,D,L){return D in b?Object.defineProperty(b,D,{value:L,enumerable:!0,configurable:!0,writable:!0}):b[D]=L,b}},42:function(T,B,x){x.d(B,{Z:function(){return b}});var M=x(924);function b(D){for(var L=1;L<arguments.length;L++){var W=arguments[L]!=null?arguments[L]:{},H=Object.keys(W);typeof Object.getOwnPropertySymbols=="function"&&(H=H.concat(Object.getOwnPropertySymbols(W).filter(function(O){return Object.getOwnPropertyDescriptor(W,O).enumerable}))),H.forEach(function(O){(0,M.Z)(D,O,W[O])})}return D}}},lt={};function Z(T){var B=lt[T];if(B!==void 0)return B.exports;var x=lt[T]={exports:{}};return ir[T](x,x.exports,Z),x.exports}(function(){Z.n=function(T){var B=T&&T.__esModule?function(){return T.default}:function(){return T};return Z.d(B,{a:B}),B}})(),function(){Z.d=function(T,B){for(var x in B)Z.o(B,x)&&!Z.o(T,x)&&Object.defineProperty(T,x,{enumerable:!0,get:B[x]})}}(),function(){Z.o=function(T,B){return Object.prototype.hasOwnProperty.call(T,B)}}();var fe={};(function(){Z.d(fe,{Ei:function(){return Kt},ED:function(){return rt},Yo:function(){return Ft},ZA:function(){return vt},Ee:function(){return Ee},x1:function(){return Pt},VJ:function(){return we},r7:function(){return Ne},XA:function(){return He},NB:function(){return pt},xv:function(){return Ce},nk:function(){return ft},JX:function(){return Xt},TQ:function(){return St}});function T(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function B(e,n){return B=Object.setPrototypeOf||function(i,a){return i.__proto__=a,i},B(e,n)}function x(e,n){return B(e,n)}function M(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&&x(e,n)}var b=Z(42);function D(){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 L(e,n,r){return D()?L=Reflect.construct:L=function(a,t,o){var s=[null];s.push.apply(s,t);var l=Function.bind.apply(a,s),h=new l;return o&&x(h,o.prototype),h},L.apply(null,arguments)}function W(e,n,r){return L.apply(null,arguments)}function H(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function O(e){return O=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},O(e)}function R(e){return O(e)}function I(e){var n=typeof Map=="function"?new Map:void 0;return I=function(i){if(i===null||!H(i))return i;if(typeof i!="function")throw new TypeError("Super expression must either be null or a function");if(typeof n!="undefined"){if(n.has(i))return n.get(i);n.set(i,a)}function a(){return W(i,arguments,R(this).constructor)}return a.prototype=Object.create(i.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),x(a,i)},I(e)}function X(e){return I(e)}function Q(){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 oe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function he(e){return e&&e.constructor===Symbol?"symbol":typeof e}function le(e,n){return n&&(he(n)==="object"||typeof n=="function")?n:oe(e)}function k(e){var n=Q();return function(){var i=R(e),a;if(n){var t=R(this).constructor;a=Reflect.construct(i,arguments,t)}else a=i.apply(this,arguments);return le(this,a)}}var c=Z(949),P=Z(568),U=Z(666),G=Z.n(U);function ne(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 $(e,n,r){return n&&ne(e.prototype,n),r&&ne(e,r),e}function K(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 ie(e){if(Array.isArray(e))return K(e)}function te(e){if(typeof Symbol!="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function be(){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 me(e,n){if(!!e){if(typeof e=="string")return K(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 K(e,n)}}function V(e){return ie(e)||te(e)||me(e)||be()}var Y=Z(484);function se(){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,Y.Z)(r.promise,n)),r}var Oe=e=>{var n={};return Z.d(n,e),n},Ve=e=>()=>e,p=Oe({CSS2DObject:()=>Yt.CSS2DObject}),f=e=>{var n={};return Z.d(n,e),n},g=e=>()=>e,C=f({CSS3DObject:()=>ut.CSS3DObject,CSS3DSprite:()=>ut.CSS3DSprite}),S=Z(584),J=function(e){e&&((0,S.wf)(e),e.children.forEach(function(n){n.userData.BaseObject_||J(n)}))},q=function(){"use strict";function e(){T(this,e),this.objecttype__="BaseObject",this.userData={},this.pm=se(),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=W(c.Mesh,V(a)),this},n.createGroup=function(){return this.object3d=new c.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=W(c.Points,V(a)),this},n.createCSS2DObject=function(i){return this.object3d=new p.CSS2DObject(i),this},n.createCSS3DObject=function(i){return this.object3d=new C.CSS3DObject(i),this},n.createCSS3DSprite=function(i){return this.object3d=new C.CSS3DSprite(i),this},n.createSprite=function(i){return this.object3d=new c.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,V(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,V(a)),this},n.getSize=function(){var i=new c.Box3().setFromObject(this.object3d);return{min:i.min,max:i.max,size:i.getSize(new c.Vector3)}},n.traverse=function(i){i(this),this.children.forEach(function(a){a.traverse(i)})},n.dispose=function(){J(this.object3d)},$(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}(),ue=+c.REVISION<144,pe=ue?"ExtrudeBufferGeometry":"ExtrudeGeometry",ce=ue?"PlaneBufferGeometry":"PlaneGeometry",Ee=function(e){"use strict";M(r,e);var n=k(r);function r(a){T(this,r);var t;return t=n.call(this),t.scale=1,t.options=(0,b.Z)({},{scale:1},a),t}var i=r.prototype;return i.getMaterial=function(){var t=this;return(0,P.Z)(G().mark(function o(){var s,l,h,v,d,y,_,w,m,u;return G().wrap(function(E){for(;;)switch(E.prev=E.next){case 0:return s=t.options,l=s.transparent,h=s.blending,v=s.depthWrite,d=s.depthTest,y=s.alphaTest,_=s.sprite,w=s.sizeAttenuation,E.next=3,t.getTexture();case 3:return m=E.sent,u=_?new c.SpriteMaterial({map:m,transparent:l!=null?l:!1,blending:h!=null?h:c.NormalBlending,depthWrite:v!=null?v:!0,depthTest:d!=null?d:!0,alphaTest:y!=null?y:0,sizeAttenuation:w!=null?w:!0}):new c.MeshBasicMaterial({map:m,transparent:l!=null?l:!1,blending:h!=null?h:c.NormalBlending,depthWrite:v!=null?v:!0,depthTest:d!=null?d:!0,alphaTest:y!=null?y:0}),E.abrupt("return",u);case 6:case"end":return E.stop()}},o)}))()},i.create=function(){var t=this;return(0,P.Z)(G().mark(function o(){var s,l,h,v,d,y,_,w;return G().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(s=t.options,l=s.scale,h=s.position,v=s.src,d=s.cache,y=s.sprite,_=v,!d){u.next=8;break}return u.next=5,d.get(_,function(){return t.getMaterial()});case 5:u.t0=u.sent,u.next=11;break;case 8:return u.next=10,t.getMaterial();case 10:u.t0=u.sent;case 11:w=u.t0,t.texture=w.map,y?t.createSprite(w):t.createMesh(new c[ce](1,1),w),t.setScale(l),h&&t.object3d.position.copy(h);case 16:case"end":return u.stop()}},o)}))()},i.setScale=function(t){this.scale=t,this.object3d.scale.set(this.texture.image.width*t,this.texture.image.height*t,1)},i.setTexture=function(t){var o=this.object3d;o.material.map&&o.material.map.dispose(),o.material.map=t,o.material.needsUpdate=!0,this.texture=t,this.setScale(this.scale)},i.getTexture=function(){var t=this.options.src;return new c.TextureLoader().loadAsync(t)},r}(q),Ce=function(e){"use strict";M(r,e);var n=k(r);function r(a){T(this,r);var t;return t=n.call(this,a),t.canvas=document.createElement("canvas"),t}var i=r.prototype;return i.getTexture=function(){var t=this.options,o=t.text,s=t.textOptions,l=(0,b.Z)({},{fontSize:28,fontFamily:"system-ui,-apple-system,BlinkMacSystemFont,sans-serif",fontWeight:"normal",flipX:!1,color:"#ffffff",setCtx:function(j){}},s||{}),h=l.fontSize,v=l.fontFamily,d=l.fontWeight,y=l.flipX,_=l.color,w=l.setCtx,m=this.canvas;m.width=h*o.length*2,m.height=h;var u=m.getContext("2d");u.font="".concat(d," ").concat(h,"px/1 ").concat(v);var A=u.measureText(o).width;m.width=A,u=m.getContext("2d"),u.clearRect(0,0,m.width,m.height),y&&u.scale(-1,1),u.font="".concat(d," ").concat(h,"px/1 ").concat(v),u.textBaseline="middle",u.fillStyle=_,w&&w(u),u.fillText(o,y?A*-1:0,m.height/2),u.restore();var E=new c.Texture(m);return E.anisotropy=this.pencil.renderer.capabilities.getMaxAnisotropy(),E.needsUpdate=!0,Promise.resolve(E)},r}(X(Ee));function Pe(e,n){for(;!Object.prototype.hasOwnProperty.call(e,n)&&(e=R(e),e!==null););return e}function We(e,n,r){return typeof Reflect!="undefined"&&Reflect.get?We=Reflect.get:We=function(a,t,o){var s=Pe(a,t);if(!!s){var l=Object.getOwnPropertyDescriptor(s,t);return l.get?l.get.call(o||a):l.value}},We(e,n,r)}function ze(e,n,r){return We(e,n,r)}var ft=function(e){"use strict";M(r,e);var n=k(r);function r(a){T(this,r);var t;return t=n.call(this),t.scale=1,t.options=(0,b.Z)({},{scale:1,autoPlay:!0,loop:!0},a),t}var i=r.prototype;return i.getMaterial=function(){var t=this.options,o=t.src,s=t.transparent,l=t.blending,h=t.depthWrite,v=t.depthTest,d=t.format,y=t.autoPlay,_=t.loop,w=t.alphaTest,m=t.sprite,u=se(),A=document.createElement("video");return A.addEventListener("loadedmetadata",function(){var E=new c.VideoTexture(A);E.format=d!=null?d:c.RGBAFormat,E.needsUpdate=!0;var j=m?new c.SpriteMaterial({map:E,transparent:s!=null?s:!1,blending:l!=null?l:c.NormalBlending,depthWrite:h!=null?h:!0,depthTest:v!=null?v:!0,alphaTest:w!=null?w:0}):new c.MeshBasicMaterial({map:E,transparent:s!=null?s:!1,blending:l!=null?l:c.NormalBlending,depthWrite:h!=null?h:!0,depthTest:v!=null?v:!0,alphaTest:w!=null?w:0});u.resolve(j)},!1),A.src=o,A.muted=!0,A.autoplay=y,A.loop=_,A.preload="auto",u.promise},i.create=function(){var t=this;return(0,P.Z)(G().mark(function o(){var s,l,h,v,d,y,_;return G().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:if(s=t.options,l=s.scale,h=s.position,v=s.src,d=s.cache,y=s.sprite,!d){m.next=7;break}return m.next=4,d.get(v,function(){return t.getMaterial()});case 4:m.t0=m.sent,m.next=10;break;case 7:return m.next=9,t.getMaterial();case 9:m.t0=m.sent;case 10:_=m.t0,t.video=_.map.image,y?t.createSprite(_):t.createMesh(new c[ce](1,1),_),t.setScale(l),h&&t.object3d.position.copy(h);case 15:case"end":return m.stop()}},o)}))()},i.setScale=function(t){this.scale=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(),ze(R(r.prototype),"dispose",this).call(this)},r}(q),ht=function(e){"use strict";M(r,e);var n=k(r);function r(a){T(this,r);var t;return t=n.call(this),t.type_="node",t.options=(0,b.Z)({},{event:"click"},a),t}var i=r.prototype;return i.create=function(){var t=this.options,o=t.position,s=t.children,l=t.handler,h=t.event,v=document.createElement("div");this.element=v,v.appendChild(s),this.createCSS2DObject(v),o&&this.object3d.position.copy(o),l&&h&&this.clickTarge.forEach(function(d){var y=Array.isArray(h)?h:[h],_=Array.isArray(l)?l:[l];y.forEach(function(w,m){var u=_[m];u&&d.addEventListener(w,u)})})},i.getMaterial=function(t){return(0,P.Z)(G().mark(function o(){var s,l,h,v;return G().wrap(function(y){for(;;)switch(y.prev=y.next){case 0:return s=document.createElement("canvas"),s.width=256,s.height=256,l=s.getContext("2d"),l.fillStyle="#ff0000",l.fillRect(0,0,256,256),h=new c.CanvasTexture(s),v=new c.SpriteMaterial({map:h,opacity:t?1:0,transparent:!0,alphaTest:.1,sizeAttenuation:!1}),y.abrupt("return",v);case 9:case"end":return y.stop()}},o)}))()},i.createPickObject=function(t){var o=t.show,s=o===void 0?!1:o,l=t.scale,h=l===void 0?new c.Vector3(1,1,1):l,v=t.position,d=v===void 0?new c.Vector3(0,0,0):v,y=t.cache,_=this;return(0,P.Z)(G().mark(function w(){var m,u,A;return G().wrap(function(j){for(;;)switch(j.prev=j.next){case 0:if(m="node-create-pick-object",!y){j.next=7;break}return j.next=4,y.get(m,function(){return _.getMaterial(s)});case 4:j.t0=j.sent,j.next=10;break;case 7:return j.next=9,_.getMaterial(s);case 9:j.t0=j.sent;case 10:u=j.t0,A=new c.Sprite(u),A.scale.set(u.map.image.width*h.x,u.map.image.height*h.y,1),A.position.copy(d),_.add(A),_.pickObject=A;case 16:case"end":return j.stop()}},w)}))()},i.dispose=function(){var t=this.options,o=t.handler,s=t.event;o&&s&&this.clickTarge.forEach(function(l){var h=Array.isArray(s)?s:[s],v=Array.isArray(o)?o:[o];h.forEach(function(d,y){var _=v[y];_&&l.removeEventListener(d,_)})}),ze(R(r.prototype),"dispose",this).call(this)},$(r,[{key:"clickTarge",get:function(){var t=this,o=this.options.eventTarge;if(o){var s=o.map(function(l){return V(t.element.querySelectorAll(l))}).flat();return s}return[this.element]}}]),r}(q),pt=ht,vt=function(e){"use strict";M(r,e);var n=k(r);function r(){return T(this,r),n.apply(this,arguments)}var i=r.prototype;return i.create=function(){this.createGroup()},r}(q),dt=`
|
|
2
2
|
`.concat(c.ShaderChunk.logdepthbuf_pars_vertex,`
|
|
3
3
|
`).concat(c.ShaderChunk.fog_pars_vertex,`
|
|
4
4
|
attribute vec3 previous;
|
|
@@ -95,7 +95,7 @@ import*as ot from"idb-keyval";import*as $t from"three";import*as Yt from"three/e
|
|
|
95
95
|
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
|
|
96
96
|
`).concat(c.ShaderChunk.fog_vertex,`
|
|
97
97
|
}
|
|
98
|
-
`),
|
|
98
|
+
`),mt=`
|
|
99
99
|
`.concat(c.ShaderChunk.fog_pars_fragment,`
|
|
100
100
|
`).concat(c.ShaderChunk.logdepthbuf_pars_fragment,`
|
|
101
101
|
|
|
@@ -129,4 +129,4 @@ void main() {
|
|
|
129
129
|
gl_FragColor.a *= step(vCounters, visibility);
|
|
130
130
|
`).concat(c.ShaderChunk.fog_fragment,`
|
|
131
131
|
}
|
|
132
|
-
`),Me=function(e){"use strict";P(r,e);var n=j(r);function r(){k(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 c.Matrix4,Object.defineProperties(oe(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}(c.BufferGeometry);Me.prototype.setMatrixWorld=function(e){this.matrixWorld=e},Me.prototype.setGeometry=function(e,n){this._geometry=e,this.setPoints(e.getAttribute("position").array,n)},Me.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 c.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 $e(e,n){var r=new c.Matrix4,i=new c.Ray,a=new c.Sphere,t=new c.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 s=new c.Vector3,l=new c.Vector3,h=new c.Vector3,p=this instanceof c.LineSegments?2:1,d=o.index,_=o.attributes;if(d!==null)for(var b=d.array,w=_.position.array,y=_.width.array,u=0,m=b.length-1;u<m;u+=p){var M=b[u],T=b[u+1];s.fromArray(w,M*3),l.fromArray(w,T*3);var V=y[Math.floor(u/3)]!==void 0?y[Math.floor(u/3)]:1,B=e.params.Line.threshold+this.material.lineWidth*V/2,ae=B*B,I=i.distanceSqToSegment(s,l,t,h);if(!(I>ae)){t.applyMatrix4(this.matrixWorld);var le=e.ray.origin.distanceTo(t);le<e.near||le>e.far||(n.push({distance:le,point:h.clone().applyMatrix4(this.matrixWorld),index:u,face:null,faceIndex:null,object:this}),u=m)}}}}Me.prototype.raycast=$e,Me.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]},Me.prototype.copyV3=function(e){var n=e*6;return[this.positions[n],this.positions[n+1],this.positions[n+2]]},Me.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 c.BufferAttribute(new Float32Array(this.positions),3),previous:new c.BufferAttribute(new Float32Array(this.previous),3),next:new c.BufferAttribute(new Float32Array(this.next),3),side:new c.BufferAttribute(new Float32Array(this.side),1),width:new c.BufferAttribute(new Float32Array(this.width),1),uv:new c.BufferAttribute(new Float32Array(this.uvs),2),index:new c.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new c.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 Ne(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}Me.prototype.advance=function(e){var n=this._attributes.position.array,r=this._attributes.previous.array,i=this._attributes.next.array,a=n.length;Ne(n,0,r,0,a),Ne(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,Ne(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},c.ShaderChunk.meshline_vert=vt,c.ShaderChunk.meshline_frag=dt;var Ie=function(e){"use strict";P(r,e);var n=j(r);function r(i){k(this,r);var a;return a=n.call(this,{uniforms:Object.assign({},c.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new c.Color(16777215)},opacity:{value:1},resolution:{value:new c.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 c.Vector2(1,1)},offset:{value:new c.Vector2(1,1)},lineLightAnimation:{value:1},time:{value:0},size:{value:300},speed:{value:.3},lightWidth:{value:.1},uCenter:{value:new c.Vector2(0,0)},lightColor:{value:new c.Color(16777215)}}),vertexShader:c.ShaderChunk.meshline_vert,fragmentShader:c.ShaderChunk.meshline_frag}),a.isMeshLineMaterial=!0,a.type="MeshLineMaterial",Object.defineProperties(oe(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}(c.ShaderMaterial);Ie.prototype.copy=function(e){return c.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 mt(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 Ye(e,n){return n=n!=null?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mt(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}),e}function gt(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 yt(e,n){if(e==null)return{};var r=gt(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}function _t(e){if(Array.isArray(e))return e}function bt(){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,n){return _t(e)||te(e,n)||_e(e,n)||bt()}var wt=e=>{var n={};return Z.d(n,e),n},yr=e=>()=>e,Je=wt({animate:()=>ut.animate,linear:()=>ut.linear}),xt=e=>{var n={};return Z.d(n,e),n},_r=e=>()=>e,je=xt({mergeBufferGeometries:()=>Jt.mergeBufferGeometries});function Qe(e){var n=e.setPointWidth,r=e.nodes,i=new c.BufferGeometry,a=new Me;return i.setFromPoints(r),a.setGeometry(i,n),a}var At={color:new c.Color("#ffffff"),lineWidth:1},Mt=function(e){"use strict";P(r,e);var n=j(r);function r(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};k(this,r);var t;return t=n.call(this),t.options=(0,x.Z)({},At,a),t}var i=r.prototype;return i.create=function(){var t=this;return(0,S.Z)(W().mark(function o(){var s,l,h,p,d,_,b,w,y,u,m,M,T,V,B,ae,I,le,me,ge;return W().wrap(function(re){for(;;)switch(re.prev=re.next){case 0:if(s=t.options,l=s.duration,h=s.delay,p=s.onComplete,d=s.setPointWidth,_=s.key,b=s.nodes,w=s.nodesArr,y=s.geometry,u=s.geometryArr,m=s.useGroups,M=s.material,T=s.cache,V=s.cacheKey,B=yt(s,["duration","delay","onComplete","setPointWidth","key","nodes","nodesArr","geometry","geometryArr","useGroups","material","cache","cacheKey"]),ae=M,I=y,ae){re.next=16;break}if(le="LineMaterial:".concat(V),T&&!T.get(le)&&(T.init(le),me=t.getMaterial((0,x.Z)({},B)),T.set(le,me)),!T){re.next=12;break}return re.next=9,T.get(le);case 9:re.t0=re.sent,re.next=15;break;case 12:return re.next=14,t.getMaterial(B);case 14:re.t0=re.sent;case 15:ae=re.t0;case 16:!I&&b?I=Qe({nodes:b,setPointWidth:d}):!I&&w?I=je.mergeBufferGeometries(w.map(function(Ee){return Qe({nodes:Ee,setPointWidth:d})}),m!=null?m:!1):!I&&u&&u.length>1?I=je.mergeBufferGeometries(u,m!=null?m:!1):!I&&u&&u.length===1&&(ge=be(u,1),I=ge[0]),t.createMesh(I,ae);case 18:case"end":return re.stop()}},o)}))()},i.getMaterial=function(t){var o=this.pencil.getSize(),s=o.width,l=o.height,h=new Ie(Ye((0,x.Z)({},t),{resolution:new c.Vector2(s,l)}));return h},i.addGeometries=function(t){var o=this.object3d,s=je.mergeBufferGeometries([o.geometry].concat(U(t)),!1);o.geometry=s},i.resize=function(t,o){this.material.uniforms.resolution.value.set(t,o)},i.animate=function(){var t=this.options,o=t.duration,s=t.delay,l=t.onComplete,h=this.material.uniforms.offset,p=s!=null?s:0,d=(0,Je.animate)({from:h.value,to:{x:0},duration:o!=null?o:1e3,elapsed:-p,repeat:1/0,onComplete:l,ease:Je.linear,onUpdate:function(_){h.value.x=_.x}});this.tween=d},i.dispose=function(){var t;Ue(R(r.prototype),"dispose",this).call(this),(t=this.tween)===null||t===void 0||t.stop()},Y(r,[{key:"material",get:function(){return this.object3d.material}}]),r}(ee);function Pt(e){var n=e.worker,r=e.workerKey,i=e.coordinatesArr,a=e.lineWidth,t=e.projection,o=e.cacheVersion;return new Promise(function(s,l){n.postMessage({coordinatesArr:i,lineWidth:a,projection:t,workerKey:r},{cb:function(h){try{var p=new c.BufferGeometry;Object.keys(h).forEach(function(d){d==="index"?p.setIndex(new c.BufferAttribute(h[d].array,h[d].itemSize)):p.setAttribute(d,new c.BufferAttribute(h[d].array,h[d].itemSize))}),s(p)}catch(d){n.postMessage({delCache:!0,workerKey:r},{cb:l,cacheVersion:o})}},cacheVersion:o})})}var St=e=>{var n={};return Z.d(n,e),n},br=e=>()=>e,ke=St({extent:()=>He.extent,mean:()=>He.mean,merge:()=>He.merge}),Ot=e=>{var n={};return Z.d(n,e),n},wr=e=>()=>e,Ze=Ot({default:()=>Qt.default}),Ct=e=>{var n={};return Z.d(n,e),n},xr=e=>()=>e,Et=Ct({default:()=>qt.default});function Lt(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 jt=e=>{var n={};return Z.d(n,e),n},Ar=e=>()=>e,kt=jt({default:()=>er.default}),Tt=e=>{var n={};return Z.d(n,e),n},Mr=e=>()=>e,Rt=Tt({default:()=>tr.default}),Bt=e=>{var n={};return Z.d(n,e),n},Pr=e=>()=>e,Te=Bt({geoBounds:()=>ze.geoBounds,geoContains:()=>ze.geoContains,geoDistance:()=>ze.geoDistance,geoInterpolate:()=>ze.geoInterpolate}),Gt=e=>{var n={};return Z.d(n,e),n},Sr=e=>()=>e,Wt=Gt({geoVoronoi:()=>rr.geoVoronoi}),Vt=e=>{var n={};return Z.d(n,e),n},Or=e=>()=>e,qe=Vt({scaleLinear:()=>nr.scaleLinear});function zt(e,n){return e.map(function(r){var i=[],a;return r.forEach(function(t){if(a){var o=(0,Te.geoDistance)(t,a)*180/Math.PI;if(o>n)for(var s=(0,Te.geoInterpolate)(a,t),l=1/Math.ceil(o/n),h=l;h<1;)i.push(s(h)),h+=l}i.push(a=t)}),i})}function Dt(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),s=(1+Math.sqrt(5))/2,l=function(u){return u/s*360%360-180},h=function(u){return Math.acos(2*u/o-1)/Math.PI*180-90},p=function(u){return o*(Math.cos((u+90)*Math.PI/180)+1)/2},d=[t!==void 0?Math.ceil(p(t)):0,a!==void 0?Math.floor(p(a)):o-1],_=r===void 0&&i===void 0?function(){return!0}:r===void 0?function(u){return u<=i}:i===void 0?function(u){return u>=r}:i>=r?function(u){return u>=r&&u<=i}:function(u){return u>=r||u<=i},b=[],w=d[0];w<=d[1];w++){var y=l(w);_(y)&&b.push([y,h(w)])}return b}function Ke(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return r?(0,Te.geoContains)(n,e):(0,Rt.default)(e,n)}function Ut(e,n){var r={type:"Polygon",coordinates:e},i=be((0,Te.geoBounds)(r),2),a=be(i[0],2),t=a[0],o=a[1],s=be(i[1],2),l=s[0],h=s[1];if(Math.min(Math.abs(l-t),Math.abs(h-o))<n)return[];var p=t>l||h>=89||o<=-89;return Dt(n,{minLng:t,maxLng:l,minLat:o,maxLat:h}).filter(function(d){return Ke(d,r,p)})}function Nt(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.resolution,i=r===void 0?1/0:r,a=zt(e,i),t=(0,ke.merge)(a),o=Ut(e,i),s=U(t).concat(U(o)),l={type:"Polygon",coordinates:e},h=be((0,Te.geoBounds)(l),2),p=be(h[0],2),d=p[0],_=p[1],b=be(h[1],2),w=b[0],y=b[1],u=d>w||y>=89||_<=-89,m=[];if(u){var M=(0,Wt.geoVoronoi)(s).triangles(),T=new Map(s.map(function(ye,X){var Ae=be(ye,2),he=Ae[0],Ge=Ae[1];return["".concat(he,"-").concat(Ge),X]}));M.features.forEach(function(ye){var X,Ae=ye.geometry.coordinates[0].slice(0,3).reverse(),he=[];if(Ae.forEach(function(We){var Pe=be(We,2),Xe=Pe[0],Ht=Pe[1],at="".concat(Xe,"-").concat(Ht);T.has(at)&&he.push(T.get(at))}),he.length===3){if(he.some(function(We){return We<t.length})){var Ge=ye.properties.circumcenter;if(!Ke(Ge,l,u))return}(X=m).push.apply(X,U(he))}})}else if(o.length)for(var le=function(ye,X){var Ae,he=[2,1,0].map(function(Pe){return me.triangles[ye+Pe]}),Ge=he.map(function(Pe){return s[Pe]});if(he.some(function(Pe){return Pe<t.length})){var We=[0,1].map(function(Pe){return(0,ke.mean)(Ge,function(Xe){return Xe[Pe]})});if(!Ke(We,l,u))return"continue"}(Ae=m).push.apply(Ae,U(he))},me=kt.default.from(s),ge=0,we=me.triangles.length;ge<we;ge+=3)le(ge,we);else{var V=Ze.default.flatten(a),B=V.vertices,ae=V.holes,I=ae===void 0?[]:ae;m=(0,Ze.default)(B,I,2)}var re=(0,qe.scaleLinear)((0,ke.extent)(s,function(ye){return ye[0]}),[0,1]),Ee=(0,qe.scaleLinear)((0,ke.extent)(s,function(ye){return ye[1]}),[0,1]),Re=s.map(function(ye){var X=be(ye,2),Ae=X[0],he=X[1];return[re(Ae),Ee(he)]}),Be={points:s,indices:m,uvs:Re};return{contour:a,triangles:Be}}var It=Nt,et=new c.BufferGeometry().setAttribute?"setAttribute":"addAttribute";function Fe(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=be(t,2),s=o[0],l=o[1];return r?Lt(s,l,n):[s,l,n]})});return Ze.default.flatten(i)}function tt(e,n,r){for(var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=Fe(e,n,i),t=a.vertices,o=a.holes,s=Fe(e,r,i),l=s.vertices,h=(0,ke.merge)([l,t]),p=Math.round(l.length/3),d=new Set(o),_=0,b=[],w=0;w<p;w++){var y=w+1;if(y===p)y=_;else if(d.has(y)){var u=y;y=_,_=u}b.push(w,w+p,y+p),b.push(y+p,y,w)}for(var m=[],M=1;M>=0;M--)for(var T=0;T<p;T+=1)m.push(T/(p-1),M);return{indices:b,vertices:h,uvs:m,topVerts:l}}function rt(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:Fe([e.points],n,a).vertices,uvs:r}}var Zt=function(e){"use strict";P(r,e);var n=j(r);function r(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};k(this,r);var t;t=n.call(this),t.type="PolygonBufferGeometry",t.parameters=(0,x.Z)({},{polygonGeoJson:i,startHeight:0,endHeight:1,closedBottom:!0,closedTop:!0,includeSides:!0,curvatureResolution:5,cartesian:!0,userDataRsoOffset:0},a);var o=t.parameters,s=o.startHeight,l=o.endHeight,h=o.closedBottom,p=o.closedTop,d=o.includeSides,_=o.curvatureResolution,b=o.cartesian,w=o.userDataRsoOffset;(0,Et.default)(i[0])||i[0].reverse();var y=It(i,{resolution:_}),u=y.contour,m=y.triangles,M=(0,ke.merge)(m.uvs),T=[],V=[],B=[],ae=0,I=function(me){var ge=Math.round(T.length/3),we=B.length;T=T.concat(me.vertices),V=V.concat(me.uvs),B=B.concat(ge?me.indices.map(function(re){return re+ge}):me.indices),t.addGroup(we,B.length-we,ae++)};if(d){var le=tt(u,s,l,b);I(le),t.userData.rso=w?tt(u,s,l+w,b):le}return h&&I(rt(m,s,M,!1,b)),p&&I(rt(m,l,M,!0,b)),t.setIndex(B),t[et]("position",new c.Float32BufferAttribute(T,3)),t[et]("uv",new c.Float32BufferAttribute(V,2)),t.computeVertexNormals(),t}return r}(c.BufferGeometry),Kt=function(e){"use strict";P(r,e);var n=j(r);function r(a){k(this,r);var t;return t=n.call(this),t.options=(0,x.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,s=t.height,l=t.closedBottom,h=t.closedTop,p=t.curvatureResolution,d=t.userDataRsoOffset,_=t.cartesian,b=new Zt(this.options.geojson,{startHeight:o,endHeight:o+s,closedBottom:l,closedTop:h,curvatureResolution:p,cartesian:_,userDataRsoOffset:d});this.createMesh(b,this.options.material)},r}(ee),nt=Z(705);function it(e){var n=e.split,r=e.depth,i=e.points,a=e.box3,t=new c[ve](new c.Shape(i),{depth:r,bevelEnabled:!1,UVGenerator:(0,nt.y)({split:n,box3:a})});return(0,nt.C)(),t}var Ft=function(e){"use strict";P(r,e);var n=j(r);function r(a){k(this,r);var t;return t=n.call(this),t.options=Ye((0,x.Z)({depth:1},a),{materialOptions:(0,x.Z)({},{split:.1},a.materialOptions||{})}),t}var i=r.prototype;return i.create=function(){var t=this;return(0,S.Z)(W().mark(function o(){var s,l,h,p,d,_,b,w,y,u,m,M,T,V,B,ae,I,le,me,ge,we,re,Ee,Re,Be;return W().wrap(function(X){for(;;)switch(X.prev=X.next){case 0:if(s=t.options,l=s.points,h=s.pointsArr,p=s.useGroups,d=s.depth,_=s.geometry,b=s.geometryArr,w=s.material,y=s.materialOptions,u=s.cache,m=s.cacheKey,M=s.box3,T=0,V=Array.isArray(d)?d:[d],B=Array.isArray(M)?M:[M],ae=w,I=_,!(!ae&&y)){X.next=26;break}if(T=y.split,le=y.topColor,me=y.sideColor,ge=y.sideMap,we="ExtrudePolygonMaterial:".concat(m||"".concat(me||ge||"").concat(le||"")),!(u&&!u.get(we))){X.next=16;break}return u.init(we),X.next=14,t.getMaterial(y);case 14:re=X.sent,u.set(we,re);case 16:if(!u){X.next=22;break}return X.next=19,u.get(we);case 19:X.t0=X.sent,X.next=25;break;case 22:return X.next=24,t.getMaterial(y);case 24:X.t0=X.sent;case 25:ae=X.t0;case 26:!I&&l?I=it({points:l,depth:V[0],split:T,box3:B[0]}):!I&&h?I=je.mergeBufferGeometries(h.map(function(Ae,he){return it({points:Ae,depth:(Ee=V[he])!==null&&Ee!==void 0?Ee:V[0],split:T,box3:(Re=B[he])!==null&&Re!==void 0?Re:B[0]})}),p!=null?p:!1):!I&&b&&b.length>1?I=je.mergeBufferGeometries(b,p!=null?p:!1):!I&&b&&b.length===1&&(Be=be(b,1),I=Be[0]),t.createMesh(I,ae);case 28:case"end":return X.stop()}},o)}))()},i.addGeometries=function(t){var o=this.object3d,s=je.mergeBufferGeometries([o.geometry].concat(U(t)),!1);o.geometry=s},i.getMaterial=function(t){var o=this,s=t.topColor,l=t.sideColor,h=t.sideMap,p=t.type,d=t.parameters,_=t.createCanvasObjectURL,b=t.split,w=t.maxAnisotropy;return new Promise(function(y){var u=h?document.createElement("img"):{src:"",onload:function(){},width:1024,height:1024};u.onload=function(){var m=b,M=document.createElement("canvas"),T=M.getContext("2d");M.height=u.height/(1-m),M.width=u.width,m&&s&&(T.fillStyle=s,T.fillRect(0,0,u.width,M.height*m)),h&&u instanceof HTMLImageElement?T.drawImage(u,0,M.height*m,u.width,u.height):l&&(T.fillStyle=l,T.fillRect(0,M.height*m,u.width,u.height)),_&&M.toBlob(function(ae){console.log(URL.createObjectURL(ae))});var V=new c.CanvasTexture(M);V.anisotropy=w||o.pencil.renderer.capabilities.getMaxAnisotropy();var B=new c[p||"MeshBasicMaterial"]((0,x.Z)({map:V},d||{}));y(B)},h?u.src=h:u instanceof HTMLImageElement||u.onload()})},i.setMaterialColor=function(t){var o=this;return(0,S.Z)(W().mark(function s(){var l,h,p,d,_,b,w,y,u,m,M,T;return W().wrap(function(B){for(;;)switch(B.prev=B.next){case 0:if(l=o.options,h=l.materialOptions,p=l.cache,d=h.sideColor,_=h.sideMap,b=h.topColor,w=h.cacheKey,y=t.sideColor,u=t.topColor,!(u||y)){B.next=22;break}if(m="ExtrudePolygonMaterial:".concat(w||"".concat(y||d||_||"").concat(u||b||"")),!(p&&!p.get(m))){B.next=11;break}return p.init(m),B.next=9,o.getMaterial((0,x.Z)({},h,t));case 9:M=B.sent,p.set(m,M);case 11:if(!p){B.next=17;break}return B.next=14,p.get(m);case 14:B.t0=B.sent,B.next=20;break;case 17:return B.next=19,o.getMaterial((0,x.Z)({},h,t));case 19:B.t0=B.sent;case 20:T=B.t0,o.object3d.material=T;case 22:case"end":return B.stop()}},s)}))()},r}(ee);function Xt(e){var n=e.worker,r=e.workerKey,i=e.coordinatesArr,a=e.depth,t=e.split,o=e.projection,s=e.cacheVersion;return new Promise(function(l,h){n.postMessage({coordinatesArr:i,depth:a,split:t!=null?t:.1,projection:o,workerKey:r},{cb:function(p){try{var d=new c.BufferGeometry;Object.keys(p).forEach(function(_){d.setAttribute(_,new c.BufferAttribute(p[_].array,p[_].itemSize))}),l(d)}catch(_){n.postMessage({delCache:!0,workerKey:r},{cb:h,cacheVersion:s})}},cacheVersion:s})})}})();var ar=de.Ei,or=de.Yo,sr=de.ZA,ur=de.Ee,cr=de.x1,lr=de.VJ,fr=de.r7,hr=de.XA,pr=de.NB,vr=de.xv,dr=de.nk,mr=de.JX,gr=de.TQ;export{ar as ConicPolygon,or as ExtrudePolygon,sr as Group,ur as Image,cr as Line,lr as MeshLine,fr as MeshLineMaterial,hr as MeshLineRaycast,pr as Node,vr as Text,dr as Video,mr as getExtrudePolygonGeometry,gr as getLineGeometry};
|
|
132
|
+
`),we=function(e){"use strict";M(r,e);var n=k(r);function r(){T(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 c.Matrix4,Object.defineProperties(oe(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}(c.BufferGeometry);we.prototype.setMatrixWorld=function(e){this.matrixWorld=e},we.prototype.setGeometry=function(e,n){this._geometry=e,this.setPoints(e.getAttribute("position").array,n)},we.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 c.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 He(e,n){var r=new c.Matrix4,i=new c.Ray,a=new c.Sphere,t=new c.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 s=new c.Vector3,l=new c.Vector3,h=new c.Vector3,v=this instanceof c.LineSegments?2:1,d=o.index,y=o.attributes;if(d!==null)for(var _=d.array,w=y.position.array,m=y.width.array,u=0,A=_.length-1;u<A;u+=v){var E=_[u],j=_[u+1];s.fromArray(w,E*3),l.fromArray(w,j*3);var z=m[Math.floor(u/3)]!==void 0?m[Math.floor(u/3)]:1,re=e.params.Line.threshold+this.material.lineWidth*z/2,ae=re*re,N=i.distanceSqToSegment(s,l,t,h);if(!(N>ae)){t.applyMatrix4(this.matrixWorld);var ve=e.ray.origin.distanceTo(t);ve<e.near||ve>e.far||(n.push({distance:ve,point:h.clone().applyMatrix4(this.matrixWorld),index:u,face:null,faceIndex:null,object:this}),u=A)}}}}we.prototype.raycast=He,we.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]},we.prototype.copyV3=function(e){var n=e*6;return[this.positions[n],this.positions[n+1],this.positions[n+2]]},we.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 c.BufferAttribute(new Float32Array(this.positions),3),previous:new c.BufferAttribute(new Float32Array(this.previous),3),next:new c.BufferAttribute(new Float32Array(this.next),3),side:new c.BufferAttribute(new Float32Array(this.side),1),width:new c.BufferAttribute(new Float32Array(this.width),1),uv:new c.BufferAttribute(new Float32Array(this.uvs),2),index:new c.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new c.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 Ue(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}we.prototype.advance=function(e){var n=this._attributes.position.array,r=this._attributes.previous.array,i=this._attributes.next.array,a=n.length;Ue(n,0,r,0,a),Ue(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,Ue(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},c.ShaderChunk.meshline_vert=dt,c.ShaderChunk.meshline_frag=mt;var Ne=function(e){"use strict";M(r,e);var n=k(r);function r(i){T(this,r);var a;return a=n.call(this,{uniforms:Object.assign({},c.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new c.Color(16777215)},opacity:{value:1},resolution:{value:new c.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 c.Vector2(1,1)},offset:{value:new c.Vector2(1,1)},lineLightAnimation:{value:1},time:{value:0},size:{value:300},speed:{value:.3},lightWidth:{value:.1},uCenter:{value:new c.Vector2(0,0)},lightColor:{value:new c.Color(16777215)}}),vertexShader:c.ShaderChunk.meshline_vert,fragmentShader:c.ShaderChunk.meshline_frag}),a.isMeshLineMaterial=!0,a.type="MeshLineMaterial",Object.defineProperties(oe(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}(c.ShaderMaterial);Ne.prototype.copy=function(e){return c.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 gt(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 $e(e,n){return n=n!=null?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gt(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}),e}function yt(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 _t(e,n){if(e==null)return{};var r=yt(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}function bt(e){if(Array.isArray(e))return e}function wt(){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 ge(e,n){return bt(e)||te(e,n)||me(e,n)||wt()}var xt=e=>{var n={};return Z.d(n,e),n},_r=e=>()=>e,Ye=xt({animate:()=>ct.animate,linear:()=>ct.linear}),At=e=>{var n={};return Z.d(n,e),n},br=e=>()=>e,Le=At({mergeBufferGeometries:()=>Jt.mergeBufferGeometries});function Je(e){var n=e.setPointWidth,r=e.nodes,i=new c.BufferGeometry,a=new we;return i.setFromPoints(r),a.setGeometry(i,n),a}var Mt={color:new c.Color("#ffffff"),lineWidth:1},Pt=function(e){"use strict";M(r,e);var n=k(r);function r(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r);var t;return t=n.call(this),t.options=(0,b.Z)({},Mt,a),t}var i=r.prototype;return i.create=function(){var t=this;return(0,P.Z)(G().mark(function o(){var s,l,h,v,d,y,_,w,m,u,A,E,j,z,re,ae,N,ve,de;return G().wrap(function(ee){for(;;)switch(ee.prev=ee.next){case 0:if(s=t.options,l=s.duration,h=s.delay,v=s.onComplete,d=s.setPointWidth,y=s.key,_=s.nodes,w=s.nodesArr,m=s.geometry,u=s.geometryArr,A=s.useGroups,E=s.material,j=s.cache,z=s.cacheKey,re=_t(s,["duration","delay","onComplete","setPointWidth","key","nodes","nodesArr","geometry","geometryArr","useGroups","material","cache","cacheKey"]),ae=E,N=m,ae){ee.next=15;break}if(ve="LineMaterial:".concat(z),!j){ee.next=11;break}return ee.next=8,j.get(ve,function(){return t.getMaterial((0,b.Z)({},re))});case 8:ee.t0=ee.sent,ee.next=14;break;case 11:return ee.next=13,t.getMaterial((0,b.Z)({},re));case 13:ee.t0=ee.sent;case 14:ae=ee.t0;case 15:!N&&_?N=Je({nodes:_,setPointWidth:d}):!N&&w?N=Le.mergeBufferGeometries(w.map(function(Se){return Je({nodes:Se,setPointWidth:d})}),A!=null?A:!1):!N&&u&&u.length>1?N=Le.mergeBufferGeometries(u,A!=null?A:!1):!N&&u&&u.length===1&&(de=ge(u,1),N=de[0]),t.createMesh(N,ae);case 17:case"end":return ee.stop()}},o)}))()},i.getMaterial=function(t){var o=this.pencil.getSize(),s=o.width,l=o.height,h=new Ne($e((0,b.Z)({},t),{resolution:new c.Vector2(s,l)}));return h},i.addGeometries=function(t){var o=this.object3d,s=Le.mergeBufferGeometries([o.geometry].concat(V(t)),!1);o.geometry=s},i.resize=function(t,o){this.material.uniforms.resolution.value.set(t,o)},i.animate=function(){var t=this.options,o=t.duration,s=t.delay,l=t.onComplete,h=this.material.uniforms.offset,v=s!=null?s:0,d=(0,Ye.animate)({from:h.value,to:{x:0},duration:o!=null?o:1e3,elapsed:-v,repeat:1/0,onComplete:l,ease:Ye.linear,onUpdate:function(y){h.value.x=y.x}});this.tween=d},i.dispose=function(){var t;ze(R(r.prototype),"dispose",this).call(this),(t=this.tween)===null||t===void 0||t.stop()},$(r,[{key:"material",get:function(){return this.object3d.material}}]),r}(q);function St(e){var n=e.worker,r=e.workerKey,i=e.coordinatesArr,a=e.lineWidth,t=e.projection,o=e.cacheVersion;return new Promise(function(s,l){n.postMessage({coordinatesArr:i,lineWidth:a,projection:t,workerKey:r},{cb:function(h){try{var v=new c.BufferGeometry;Object.keys(h).forEach(function(d){d==="index"?v.setIndex(new c.BufferAttribute(h[d].array,h[d].itemSize)):v.setAttribute(d,new c.BufferAttribute(h[d].array,h[d].itemSize))}),s(v)}catch(d){n.postMessage({delCache:!0,workerKey:r},{cb:l,cacheVersion:o})}},cacheVersion:o})})}var Ot=e=>{var n={};return Z.d(n,e),n},wr=e=>()=>e,je=Ot({extent:()=>Xe.extent,mean:()=>Xe.mean,merge:()=>Xe.merge}),Ct=e=>{var n={};return Z.d(n,e),n},xr=e=>()=>e,Ze=Ct({default:()=>Qt.default}),Et=e=>{var n={};return Z.d(n,e),n},Ar=e=>()=>e,Lt=Et({default:()=>qt.default});function jt(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 kt=e=>{var n={};return Z.d(n,e),n},Mr=e=>()=>e,Tt=kt({default:()=>er.default}),Rt=e=>{var n={};return Z.d(n,e),n},Pr=e=>()=>e,Bt=Rt({default:()=>tr.default}),Gt=e=>{var n={};return Z.d(n,e),n},Sr=e=>()=>e,ke=Gt({geoBounds:()=>De.geoBounds,geoContains:()=>De.geoContains,geoDistance:()=>De.geoDistance,geoInterpolate:()=>De.geoInterpolate}),Wt=e=>{var n={};return Z.d(n,e),n},Or=e=>()=>e,Dt=Wt({geoVoronoi:()=>rr.geoVoronoi}),Vt=e=>{var n={};return Z.d(n,e),n},Cr=e=>()=>e,Qe=Vt({scaleLinear:()=>nr.scaleLinear});function zt(e,n){return e.map(function(r){var i=[],a;return r.forEach(function(t){if(a){var o=(0,ke.geoDistance)(t,a)*180/Math.PI;if(o>n)for(var s=(0,ke.geoInterpolate)(a,t),l=1/Math.ceil(o/n),h=l;h<1;)i.push(s(h)),h+=l}i.push(a=t)}),i})}function Ut(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),s=(1+Math.sqrt(5))/2,l=function(u){return u/s*360%360-180},h=function(u){return Math.acos(2*u/o-1)/Math.PI*180-90},v=function(u){return o*(Math.cos((u+90)*Math.PI/180)+1)/2},d=[t!==void 0?Math.ceil(v(t)):0,a!==void 0?Math.floor(v(a)):o-1],y=r===void 0&&i===void 0?function(){return!0}:r===void 0?function(u){return u<=i}:i===void 0?function(u){return u>=r}:i>=r?function(u){return u>=r&&u<=i}:function(u){return u>=r||u<=i},_=[],w=d[0];w<=d[1];w++){var m=l(w);y(m)&&_.push([m,h(w)])}return _}function Ie(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return r?(0,ke.geoContains)(n,e):(0,Bt.default)(e,n)}function Nt(e,n){var r={type:"Polygon",coordinates:e},i=ge((0,ke.geoBounds)(r),2),a=ge(i[0],2),t=a[0],o=a[1],s=ge(i[1],2),l=s[0],h=s[1];if(Math.min(Math.abs(l-t),Math.abs(h-o))<n)return[];var v=t>l||h>=89||o<=-89;return Ut(n,{minLng:t,maxLng:l,minLat:o,maxLat:h}).filter(function(d){return Ie(d,r,v)})}function Zt(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.resolution,i=r===void 0?1/0:r,a=zt(e,i),t=(0,je.merge)(a),o=Nt(e,i),s=V(t).concat(V(o)),l={type:"Polygon",coordinates:e},h=ge((0,ke.geoBounds)(l),2),v=ge(h[0],2),d=v[0],y=v[1],_=ge(h[1],2),w=_[0],m=_[1],u=d>w||m>=89||y<=-89,A=[];if(u){var E=(0,Dt.geoVoronoi)(s).triangles(),j=new Map(s.map(function(F,Ae){var ye=ge(F,2),_e=ye[0],Be=ye[1];return["".concat(_e,"-").concat(Be),Ae]}));E.features.forEach(function(F){var Ae,ye=F.geometry.coordinates[0].slice(0,3).reverse(),_e=[];if(ye.forEach(function(Ge){var Me=ge(Ge,2),Fe=Me[0],Ht=Me[1],ot="".concat(Fe,"-").concat(Ht);j.has(ot)&&_e.push(j.get(ot))}),_e.length===3){if(_e.some(function(Ge){return Ge<t.length})){var Be=F.properties.circumcenter;if(!Ie(Be,l,u))return}(Ae=A).push.apply(Ae,V(_e))}})}else if(o.length)for(var ve=function(F,Ae){var ye,_e=[2,1,0].map(function(Me){return de.triangles[F+Me]}),Be=_e.map(function(Me){return s[Me]});if(_e.some(function(Me){return Me<t.length})){var Ge=[0,1].map(function(Me){return(0,je.mean)(Be,function(Fe){return Fe[Me]})});if(!Ie(Ge,l,u))return"continue"}(ye=A).push.apply(ye,V(_e))},de=Tt.default.from(s),xe=0,ee=de.triangles.length;xe<ee;xe+=3)ve(xe,ee);else{var z=Ze.default.flatten(a),re=z.vertices,ae=z.holes,N=ae===void 0?[]:ae;A=(0,Ze.default)(re,N,2)}var Se=(0,Qe.scaleLinear)((0,je.extent)(s,function(F){return F[0]}),[0,1]),Te=(0,Qe.scaleLinear)((0,je.extent)(s,function(F){return F[1]}),[0,1]),Re=s.map(function(F){var Ae=ge(F,2),ye=Ae[0],_e=Ae[1];return[Se(ye),Te(_e)]}),at={points:s,indices:A,uvs:Re};return{contour:a,triangles:at}}var It=Zt,qe=new c.BufferGeometry().setAttribute?"setAttribute":"addAttribute";function Ke(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=ge(t,2),s=o[0],l=o[1];return r?jt(s,l,n):[s,l,n]})});return Ze.default.flatten(i)}function et(e,n,r){for(var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=Ke(e,n,i),t=a.vertices,o=a.holes,s=Ke(e,r,i),l=s.vertices,h=(0,je.merge)([l,t]),v=Math.round(l.length/3),d=new Set(o),y=0,_=[],w=0;w<v;w++){var m=w+1;if(m===v)m=y;else if(d.has(m)){var u=m;m=y,y=u}_.push(w,w+v,m+v),_.push(m+v,m,w)}for(var A=[],E=1;E>=0;E--)for(var j=0;j<v;j+=1)A.push(j/(v-1),E);return{indices:_,vertices:h,uvs:A,topVerts:l}}function tt(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:Ke([e.points],n,a).vertices,uvs:r}}var rt=function(e){"use strict";M(r,e);var n=k(r);function r(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};T(this,r);var t;t=n.call(this),t.type="PolygonBufferGeometry",t.parameters=(0,b.Z)({},{polygonGeoJson:i,startHeight:0,endHeight:1,closedBottom:!0,closedTop:!0,includeSides:!0,curvatureResolution:5,cartesian:!0,userDataRsoOffset:0},a);var o=t.parameters,s=o.startHeight,l=o.endHeight,h=o.closedBottom,v=o.closedTop,d=o.includeSides,y=o.curvatureResolution,_=o.cartesian,w=o.userDataRsoOffset;(0,Lt.default)(i[0])||i[0].reverse();var m=It(i,{resolution:y}),u=m.contour,A=m.triangles,E=(0,je.merge)(A.uvs),j=[],z=[],re=[],ae=0,N=function(de){var xe=Math.round(j.length/3),ee=re.length;j=j.concat(de.vertices),z=z.concat(de.uvs),re=re.concat(xe?de.indices.map(function(Se){return Se+xe}):de.indices),t.addGroup(ee,re.length-ee,ae++)};if(d){var ve=et(u,s,l,_);N(ve),t.userData.rso=w?et(u,s,l+w,_):ve}return h&&N(tt(A,s,E,!1,_)),v&&N(tt(A,l,E,!0,_)),t.setIndex(re),t[qe]("position",new c.Float32BufferAttribute(j,3)),t[qe]("uv",new c.Float32BufferAttribute(z,2)),t.computeVertexNormals(),t}return r}(c.BufferGeometry),Kt=function(e){"use strict";M(r,e);var n=k(r);function r(a){T(this,r);var t;return t=n.call(this),t.options=(0,b.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,s=t.height,l=t.closedBottom,h=t.closedTop,v=t.curvatureResolution,d=t.userDataRsoOffset,y=t.cartesian,_=new rt(this.options.geojson,{startHeight:o,endHeight:o+s,closedBottom:l,closedTop:h,curvatureResolution:v,cartesian:y,userDataRsoOffset:d});this.createMesh(_,this.options.material)},r}(q),nt=Z(705);function it(e){var n=e.split,r=e.depth,i=e.points,a=e.box3,t=new c[pe](new c.Shape(i),{depth:r,bevelEnabled:!1,UVGenerator:(0,nt.y)({split:n,box3:a})});return(0,nt.C)(),t}var Ft=function(e){"use strict";M(r,e);var n=k(r);function r(a){T(this,r);var t;return t=n.call(this),t.options=$e((0,b.Z)({depth:1},a),{materialOptions:(0,b.Z)({},{split:.1},a.materialOptions||{})}),t}var i=r.prototype;return i.create=function(){var t=this;return(0,P.Z)(G().mark(function o(){var s,l,h,v,d,y,_,w,m,u,A,E,j,z,re,ae,N,ve,de,xe,ee,Se,Te,Re;return G().wrap(function(F){for(;;)switch(F.prev=F.next){case 0:if(s=t.options,l=s.points,h=s.pointsArr,v=s.useGroups,d=s.depth,y=s.geometry,_=s.geometryArr,w=s.material,m=s.materialOptions,u=s.cache,A=s.cacheKey,E=s.box3,j=0,z=Array.isArray(d)?d:[d],re=Array.isArray(E)?E:[E],ae=w,N=y,!(!ae&&m)){F.next=20;break}if(j=m.split,ve=m.topColor,de=m.sideColor,xe=m.sideMap,ee="ExtrudePolygonMaterial:".concat(A||"".concat(de||xe||"").concat(ve||"")),!u){F.next=16;break}return F.next=13,u.get(ee,function(){return t.getMaterial(m)});case 13:F.t0=F.sent,F.next=19;break;case 16:return F.next=18,t.getMaterial(m);case 18:F.t0=F.sent;case 19:ae=F.t0;case 20:!N&&l?N=it({points:l,depth:z[0],split:j,box3:re[0]}):!N&&h?N=Le.mergeBufferGeometries(h.map(function(Ae,ye){return it({points:Ae,depth:(Se=z[ye])!==null&&Se!==void 0?Se:z[0],split:j,box3:(Te=re[ye])!==null&&Te!==void 0?Te:re[0]})}),v!=null?v:!1):!N&&_&&_.length>1?N=Le.mergeBufferGeometries(_,v!=null?v:!1):!N&&_&&_.length===1&&(Re=ge(_,1),N=Re[0]),t.createMesh(N,ae);case 22:case"end":return F.stop()}},o)}))()},i.addGeometries=function(t){var o=this.object3d,s=Le.mergeBufferGeometries([o.geometry].concat(V(t)),!1);o.geometry=s},i.getMaterial=function(t){var o=this,s=t.topColor,l=t.sideColor,h=t.sideMap,v=t.type,d=t.parameters,y=t.createCanvasObjectURL,_=t.split,w=t.maxAnisotropy;return new Promise(function(m){var u=h?document.createElement("img"):{src:"",onload:function(){},width:1024,height:1024};u.onload=function(){var A=_,E=document.createElement("canvas"),j=E.getContext("2d");E.height=u.height/(1-A),E.width=u.width,A&&s&&(j.fillStyle=s,j.fillRect(0,0,u.width,E.height*A)),h&&u instanceof HTMLImageElement?j.drawImage(u,0,E.height*A,u.width,u.height):l&&(j.fillStyle=l,j.fillRect(0,E.height*A,u.width,u.height)),y&&E.toBlob(function(ae){console.log(URL.createObjectURL(ae))});var z=new c.CanvasTexture(E);z.anisotropy=w||o.pencil.renderer.capabilities.getMaxAnisotropy();var re=new c[v||"MeshBasicMaterial"]((0,b.Z)({map:z},d||{}));m(re)},h?u.src=h:u instanceof HTMLImageElement||u.onload()})},i.setMaterialColor=function(t){var o=this;return(0,P.Z)(G().mark(function s(){var l,h,v,d,y,_,w,m,u,A,E;return G().wrap(function(z){for(;;)switch(z.prev=z.next){case 0:if(l=o.options,h=l.materialOptions,v=l.cache,d=h.sideColor,y=h.sideMap,_=h.topColor,w=h.cacheKey,m=t.sideColor,u=t.topColor,!(u||m)){z.next=16;break}if(A="ExtrudePolygonMaterial:".concat(w||"".concat(m||d||y||"").concat(u||_||"")),!v){z.next=11;break}return z.next=8,v.get(A,function(){return o.getMaterial((0,b.Z)({},h,t))});case 8:z.t0=z.sent,z.next=14;break;case 11:return z.next=13,o.getMaterial((0,b.Z)({},h,t));case 13:z.t0=z.sent;case 14:E=z.t0,o.object3d.material=E;case 16:case"end":return z.stop()}},s)}))()},r}(q);function Xt(e){var n=e.worker,r=e.workerKey,i=e.coordinatesArr,a=e.depth,t=e.split,o=e.projection,s=e.cacheVersion;return new Promise(function(l,h){n.postMessage({coordinatesArr:i,depth:a,split:t!=null?t:.1,projection:o,workerKey:r},{cb:function(v){try{var d=new c.BufferGeometry;Object.keys(v).forEach(function(y){d.setAttribute(y,new c.BufferAttribute(v[y].array,v[y].itemSize))}),l(d)}catch(y){n.postMessage({delCache:!0,workerKey:r},{cb:h,cacheVersion:s})}},cacheVersion:s})})}})();var ar=fe.Ei,or=fe.ED,sr=fe.Yo,ur=fe.ZA,cr=fe.Ee,lr=fe.x1,fr=fe.VJ,hr=fe.r7,pr=fe.XA,vr=fe.NB,dr=fe.xv,mr=fe.nk,gr=fe.JX,yr=fe.TQ;export{ar as ConicPolygon,or as ConicPolygonGeometry,sr as ExtrudePolygon,ur as Group,cr as Image,lr as Line,fr as MeshLine,hr as MeshLineMaterial,pr as MeshLineRaycast,vr as Node,dr as Text,mr as Video,gr as getExtrudePolygonGeometry,yr as getLineGeometry};
|
package/dist/plugins/Cache.d.ts
CHANGED
package/dist/plugins/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){var X={666:function(_){var g=function(p){"use strict";var C=Object.prototype,T=C.hasOwnProperty,d,O=typeof Symbol=="function"?Symbol:{},w=O.iterator||"@@iterator",L=O.asyncIterator||"@@asyncIterator",j=O.toStringTag||"@@toStringTag";function v(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{v({},"")}catch(t){v=function(e,n,l){return e[n]=l}}function R(t,e,n,l){var u=e&&e.prototype instanceof V?e:V,b=Object.create(u.prototype),S=new h(l||[]);return b._invoke=r(t,n,S),b}p.wrap=R;function x(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(l){return{type:"throw",arg:l}}}var z="suspendedStart",N="suspendedYield",Z="executing",H="completed",E={};function V(){}function y(){}function m(){}var P={};v(P,w,function(){return this});var D=Object.getPrototypeOf,G=D&&D(D(k([])));G&&G!==C&&T.call(G,w)&&(P=G);var a=m.prototype=V.prototype=Object.create(P);y.prototype=m,v(a,"constructor",m),v(m,"constructor",y),y.displayName=v(m,j,"GeneratorFunction");function i(t){["next","throw","return"].forEach(function(e){v(t,e,function(n){return this._invoke(e,n)})})}p.isGeneratorFunction=function(t){var e=typeof t=="function"&&t.constructor;return e?e===y||(e.displayName||e.name)==="GeneratorFunction":!1},p.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,v(t,j,"GeneratorFunction")),t.prototype=Object.create(a),t},p.awrap=function(t){return{__await:t}};function s(t,e){function n(b,S,A,B){var I=x(t[b],t,S);if(I.type==="throw")B(I.arg);else{var $=I.arg,F=$.value;return F&&typeof F=="object"&&T.call(F,"__await")?e.resolve(F.__await).then(function(W){n("next",W,A,B)},function(W){n("throw",W,A,B)}):e.resolve(F).then(function(W){$.value=W,A($)},function(W){return n("throw",W,A,B)})}}var l;function u(b,S){function A(){return new e(function(B,I){n(b,S,B,I)})}return l=l?l.then(A,A):A()}this._invoke=u}i(s.prototype),v(s.prototype,L,function(){return this}),p.AsyncIterator=s,p.async=function(t,e,n,l,u){u===void 0&&(u=Promise);var b=new s(R(t,e,n,l),u);return p.isGeneratorFunction(e)?b:b.next().then(function(S){return S.done?S.value:b.next()})};function r(t,e,n){var l=z;return function(b,S){if(l===Z)throw new Error("Generator is already running");if(l===H){if(b==="throw")throw S;return M()}for(n.method=b,n.arg=S;;){var A=n.delegate;if(A){var B=o(A,n);if(B){if(B===E)continue;return B}}if(n.method==="next")n.sent=n._sent=n.arg;else if(n.method==="throw"){if(l===z)throw l=H,n.arg;n.dispatchException(n.arg)}else n.method==="return"&&n.abrupt("return",n.arg);l=Z;var I=x(t,e,n);if(I.type==="normal"){if(l=n.done?H:N,I.arg===E)continue;return{value:I.arg,done:n.done}}else I.type==="throw"&&(l=H,n.method="throw",n.arg=I.arg)}}}function o(t,e){var n=t.iterator[e.method];if(n===d){if(e.delegate=null,e.method==="throw"){if(t.iterator.return&&(e.method="return",e.arg=d,o(t,e),e.method==="throw"))return E;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return E}var l=x(n,t.iterator,e.arg);if(l.type==="throw")return e.method="throw",e.arg=l.arg,e.delegate=null,E;var u=l.arg;if(!u)return e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,E;if(u.done)e[t.resultName]=u.value,e.next=t.nextLoc,e.method!=="return"&&(e.method="next",e.arg=d);else return u;return e.delegate=null,E}i(a),v(a,j,"Generator"),v(a,w,function(){return this}),v(a,"toString",function(){return"[object Generator]"});function f(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function c(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function h(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(f,this),this.reset(!0)}p.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function l(){for(;e.length;){var u=e.pop();if(u in t)return l.value=u,l.done=!1,l}return l.done=!0,l}};function k(t){if(t){var e=t[w];if(e)return e.call(t);if(typeof t.next=="function")return t;if(!isNaN(t.length)){var n=-1,l=function u(){for(;++n<t.length;)if(T.call(t,n))return u.value=t[n],u.done=!1,u;return u.value=d,u.done=!0,u};return l.next=l}}return{next:M}}p.values=k;function M(){return{value:d,done:!0}}return h.prototype={constructor:h,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=d,this.done=!1,this.delegate=null,this.method="next",this.arg=d,this.tryEntries.forEach(c),!t)for(var e in this)e.charAt(0)==="t"&&T.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=d)},stop:function(){this.done=!0;var t=this.tryEntries[0],e=t.completion;if(e.type==="throw")throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(B,I){return b.type="throw",b.arg=t,e.next=B,I&&(e.method="next",e.arg=d),!!I}for(var l=this.tryEntries.length-1;l>=0;--l){var u=this.tryEntries[l],b=u.completion;if(u.tryLoc==="root")return n("end");if(u.tryLoc<=this.prev){var S=T.call(u,"catchLoc"),A=T.call(u,"finallyLoc");if(S&&A){if(this.prev<u.catchLoc)return n(u.catchLoc,!0);if(this.prev<u.finallyLoc)return n(u.finallyLoc)}else if(S){if(this.prev<u.catchLoc)return n(u.catchLoc,!0)}else if(A){if(this.prev<u.finallyLoc)return n(u.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var l=this.tryEntries[n];if(l.tryLoc<=this.prev&&T.call(l,"finallyLoc")&&this.prev<l.finallyLoc){var u=l;break}}u&&(t==="break"||t==="continue")&&u.tryLoc<=e&&e<=u.finallyLoc&&(u=null);var b=u?u.completion:{};return b.type=t,b.arg=e,u?(this.method="next",this.next=u.finallyLoc,E):this.complete(b)},complete:function(t,e){if(t.type==="throw")throw t.arg;return t.type==="break"||t.type==="continue"?this.next=t.arg:t.type==="return"?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):t.type==="normal"&&e&&(this.next=e),E},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),c(n),E}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var l=n.completion;if(l.type==="throw"){var u=l.arg;c(n)}return u}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},this.method==="next"&&(this.arg=d),E}},p}(_.exports);try{regeneratorRuntime=g}catch(p){typeof globalThis=="object"?globalThis.regeneratorRuntime=g:Function("r","regeneratorRuntime = r")(g)}},584:function(_,g,p){"use strict";p.d(g,{makePromiseCreator:function(){return C.Z}});var C=p(282),T=p(666),d=p.n(T),O=null,w=p(644);function L(E){if(E.material){var V=Array.isArray(E.material)?E.material:[E.material];V.forEach(function(y){var m,P;(m=y.color)===null||m===void 0||m.convertSRGBToLinear(),(P=y.emissive)===null||P===void 0||P.convertSRGBToLinear(),y.map&&(y.map.encoding=THREE.sRGBEncoding),y.emissiveMap&&(y.emissiveMap.encoding=THREE.sRGBEncoding)})}}var j=p(568),v=p(924),R=p(360),x=p(484),z=null,N=null,Z=function(){var E=(0,j.Z)(d().mark(function V(y,m){var P,D,G,a,i,s,r,o,f;return d().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:return P=m.type,D=P===void 0?"blob":P,G=m.version,a=G===void 0?"1":G,h.next=4,(0,R.get)(y);case 4:if(s=h.sent,!(s&&s[a])){h.next=9;break}i=s[a],h.next=15;break;case 9:return h.next=11,(0,x.Z)(fetch(y).then(function(k){if(k.ok)return k[D]();throw new Error}));case 11:r=h.sent,o=r.res,f=r.err,f||(i=o,(0,R.set)(y,(0,v.Z)({},a,o)));case 15:return h.abrupt("return",i?{url:D==="json"?y:URL.createObjectURL(i),store:i}:{url:y});case 16:case"end":return h.stop()}},V)}));return function(y,m){return E.apply(this,arguments)}}(),H=p(705)},282:function(_,g,p){"use strict";p.d(g,{Z:function(){return T}});var C=p(484);function T(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},w={};return w.promise=new Promise(function(L,j){w.resolve=L,w.reject=j}),d&&(w.promise=(0,C.Z)(w.promise,O)),w}},484:function(_,g,p){"use strict";p.d(g,{Z:function(){return T}});var C=p(42);function T(d){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return d.then(function(w){return(0,C.Z)({err:null,res:w},O)}).catch(function(w){return(0,C.Z)({err:w,res:void 0},O)})}},705:function(_,g,p){"use strict";var C=p(644),T=p.n(C),d=new Map,O=function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{generateTopUV:function(j,v,R,x,z){var N=v[R*3],Z=v[R*3+1],H=v[x*3],E=v[x*3+1],V=v[z*3],y=v[z*3+1],m;if(d.has(j))m=d.get(j);else{var P=L.box3||new THREE.Box3;if(!L.box3){var D=j.parameters.shapes.getPoints();P.setFromArray(D.map(function(r){return[r.x,r.y,0]}).flat())}var G=P.getSize(new THREE.Vector3);L.split&&(G.y/=L.split),m={box:P,size:G},d.set(j,m)}var a=m.box,i=m.size,s=L.split?1-L.split:0;return[new THREE.Vector2((N-a.min.x)/i.x,(Z-a.min.y)/i.y+s),new THREE.Vector2((H-a.min.x)/i.x,(E-a.min.y)/i.y+s),new THREE.Vector2((V-a.min.x)/i.x,(y-a.min.y)/i.y+s)]},generateSideWallUV:function(j,v,R,x,z,N){var Z=v[R*3],H=v[R*3+1],E=v[R*3+2],V=v[x*3],y=v[x*3+1],m=v[x*3+2],P=v[z*3],D=v[z*3+1],G=v[z*3+2],a=v[N*3],i=v[N*3+1],s=v[N*3+2],r;if(d.has(v))r=d.get(v);else{var o=new THREE.Box3;o.setFromArray(v);var f=o.getSize(new THREE.Vector3);L.split&&(f.z/=1-L.split),r={box:o,size:f},d.set(v,r)}var c=r.box,h=r.size;return Math.abs(H-y)<Math.abs(Z-V)?[new THREE.Vector2((Z-c.min.x)/h.x,(E-c.min.z)/h.z),new THREE.Vector2((V-c.min.x)/h.x,(m-c.min.z)/h.z),new THREE.Vector2((P-c.min.x)/h.x,(G-c.min.z)/h.z),new THREE.Vector2((a-c.min.x)/h.x,(s-c.min.z)/h.z)]:[new THREE.Vector2((H-c.min.y)/h.y,(E-c.min.z)/h.z),new THREE.Vector2((y-c.min.y)/h.y,(m-c.min.z)/h.z),new THREE.Vector2((D-c.min.y)/h.y,(G-c.min.z)/h.z),new THREE.Vector2((i-c.min.y)/h.y,(s-c.min.z)/h.z)]}}},w=function(){d.clear()}},360:function(_){"use strict";_.exports=require("idb-keyval")},644:function(_){"use strict";_.exports=require("three")},568:function(_,g,p){"use strict";p.d(g,{Z:function(){return T}});function C(d,O,w,L,j,v,R){try{var x=d[v](R),z=x.value}catch(N){w(N);return}x.done?O(z):Promise.resolve(z).then(L,j)}function T(d){return function(){var O=this,w=arguments;return new Promise(function(L,j){var v=d.apply(O,w);function R(z){C(v,L,j,R,x,"next",z)}function x(z){C(v,L,j,R,x,"throw",z)}R(void 0)})}}},924:function(_,g,p){"use strict";p.d(g,{Z:function(){return C}});function C(T,d,O){return d in T?Object.defineProperty(T,d,{value:O,enumerable:!0,configurable:!0,writable:!0}):T[d]=O,T}},42:function(_,g,p){"use strict";p.d(g,{Z:function(){return T}});var C=p(924);function T(d){for(var O=1;O<arguments.length;O++){var w=arguments[O]!=null?arguments[O]:{},L=Object.keys(w);typeof Object.getOwnPropertySymbols=="function"&&(L=L.concat(Object.getOwnPropertySymbols(w).filter(function(j){return Object.getOwnPropertyDescriptor(w,j).enumerable}))),L.forEach(function(j){(0,C.Z)(d,j,w[j])})}return d}}},Y={};function U(_){var g=Y[_];if(g!==void 0)return g.exports;var p=Y[_]={exports:{}};return X[_](p,p.exports,U),p.exports}(function(){U.n=function(_){var g=_&&_.__esModule?function(){return _.default}:function(){return _};return U.d(g,{a:g}),g}})(),function(){U.d=function(_,g){for(var p in g)U.o(g,p)&&!U.o(_,p)&&Object.defineProperty(_,p,{enumerable:!0,get:g[p]})}}(),function(){U.o=function(_,g){return Object.prototype.hasOwnProperty.call(_,g)}}(),function(){U.r=function(_){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(_,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(_,"__esModule",{value:!0})}}();var K={};(function(){"use strict";U.r(K),U.d(K,{Cache:function(){return p},Data:function(){return y},Draw:function(){return V},Wk:function(){return G}});function _(a,i){if(!(a instanceof i))throw new TypeError("Cannot call a class as a function")}var g=U(584),p=function(){"use strict";function a(){_(this,a),this.cache=new Map}var i=a.prototype;return i.install=function(){},i.init=function(r){var o=(0,g.makePromiseCreator)();this.cache.set(r,o)},i.get=function(r){var o;return(o=this.cache.get(r))===null||o===void 0?void 0:o.promise},i.set=function(r,o){var f=this.cache.get(r);f?f.resolve(o):console.warn("init cache first")},i.dispose=function(){this.cache.forEach(function(r,o){r.reject("stop set cache:".concat(o))}),this.cache.clear()},a}(),C=U(568);function T(a,i){for(var s=0;s<i.length;s++){var r=i[s];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(a,r.key,r)}}function d(a,i,s){return i&&T(a.prototype,i),s&&T(a,s),a}function O(a){if(Array.isArray(a))return a}function w(a){if(typeof Symbol!="undefined"&&a[Symbol.iterator]!=null||a["@@iterator"]!=null)return Array.from(a)}function L(){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 j(a,i){(i==null||i>a.length)&&(i=a.length);for(var s=0,r=new Array(i);s<i;s++)r[s]=a[s];return r}function v(a,i){if(!!a){if(typeof a=="string")return j(a,i);var s=Object.prototype.toString.call(a).slice(8,-1);if(s==="Object"&&a.constructor&&(s=a.constructor.name),s==="Map"||s==="Set")return Array.from(s);if(s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return j(a,i)}}function R(a,i){return O(a)||w(a,i)||v(a,i)||L()}function x(a){if(Array.isArray(a))return j(a)}function z(){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 N(a){return x(a)||w(a)||v(a)||z()}var Z=U(666),H=U.n(Z),E=U(644),V=function(){"use strict";function a(s){_(this,a),this.onTopBase=new Map,this.objectNamesToFactories=new Map,this.objects=new Map,this.objects_=s}var i=a.prototype;return i.install=function(r){this.pencil=r,this.initObjectFactories()},i.initObjectFactories=function(){var r=this,o=this.objects_;Object.keys(o).forEach(function(f){var c=function(){function h(){_(this,h)}var k=h.prototype;return k.create=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new o[f](t)},h}();r.objectNamesToFactories.set(f,c)})},i.getObject=function(r,o){r.includes("#")&&console.warn("getObject:err:\u4E0D\u652F\u6301 #",r);var f=(o||{}).key,c="".concat(r).concat(f?"#".concat(f):""),h=this.objects.get(c);return h},i.getAllObject=function(r,o){r.includes("#")&&console.warn("getAllObject:err:\u4E0D\u652F\u6301 #",r);var f=(o||{}).key,c="".concat(r).concat(f?"#".concat(f):""),h=[];return this.objects.forEach(function(k,M){(M.startsWith("".concat(c,"#"))||M===c)&&h.push(k)}),h},i.draw=function(r,o,f){var c=this;return(0,C.Z)(H().mark(function h(){var k,M,t,e,n,l,u,b;return H().wrap(function(A){for(;;)switch(A.prev=A.next){case 0:if(k=c.objectNamesToFactories.get(r),!k){A.next=16;break}return M=(o||{}).key,t="".concat(r).concat(M?"#".concat(M):""),c.objects.has(t)&&(e=E.MathUtils.generateUUID(),t+="#".concat(e)),n=(o==null?void 0:o.target)||f,l=(o==null?void 0:o.onTop)||0,typeof n=="string"?u=c.objects.get(n):(n==null?void 0:n.objecttype__)==="BaseObject"?u=n:u=c.pencil.scene,b=new k().create(o),b.pencil=c.pencil,b.key=t,c.objects.set(t,b),A.next=15,c.addMesh(b,u,l);case 15:return A.abrupt("return",b);case 16:throw new Error("Unrecognized:".concat(r));case 17:case"end":return A.stop()}},h)}))()},i.addMesh=function(r,o,f){var c=this;return(0,C.Z)(H().mark(function h(){var k,M,t;return H().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,r.create();case 2:r.object3d&&(r.object3d.userData.BaseObject_=r,f&&(r.type_==="node"?r.object3d.renderOrder=f:(k=1e3+f*2,M="".concat(k-1),c.onTopBase.has(M)||(t=new E.Points(void 0,new E.PointsMaterial({transparent:!0,opacity:0})),t.renderOrder=k-1,t.onBeforeRender=function(){c.pencil.renderer.clearDepth()},t.frustumCulled=!1,c.onTopBase.set(M,!0),c.pencil.scene.add(t)),r.object3d.renderOrder=k)),o.add(r.object3d)),r.visible=!0,r.render(),r.pm.resolve();case 6:case"end":return n.stop()}},h)}))()},i.erase=function(){for(var r=arguments.length,o=new Array(r),f=0;f<r;f++)o[f]=arguments[f];var c=this;N(o).forEach(function(h){var k=[];if(typeof h=="string"){var M,t=R(h.split("#"),2),e=t[0],n=t[1];(M=k).push.apply(M,N(c.getAllObject(e,{key:n})))}else k.push(h);k.forEach(function(l){c.removeMesh(l)})})},i.removeMesh=function(r){var o=this,f=r.parent;r.object3d&&f.remove(r.object3d),r.traverse(function(c){c.visible=!1,c.dispose(),o.objects.delete(c.key)})},i.update=function(r,o){this.objects.forEach(function(f){f.update(r,o)})},i.setSize=function(r,o){this.objects.forEach(function(f){f.resize(r,o)})},i.dispose=function(){this.objects.forEach(function(r,o){r.dispose(),r.pm.reject("stop draw:".concat(o))}),this.objects.clear(),this.onTopBase.clear(),this.objectNamesToFactories.clear()},d(a,[{key:"objectsPromise",get:function(){var r=[];return this.objects.forEach(function(o){r.push(o.pm.promise)}),r}}]),a}(),y=function(){"use strict";function a(){_(this,a),this.data={}}var i=a.prototype;return i.install=function(){},i.setData=function(r,o){var f,c;this.data[r]=o,(c=(f=this).cb)===null||c===void 0||c.call(f,r)},i.runAll=function(){var r=this;Object.keys(this.data).forEach(function(o){var f,c;(c=(f=r).cb)===null||c===void 0||c.call(f,o)})},i.dispose=function(){this.data={},this.cb=void 0},a}(),m=U(924),P=U(42),D=U(360),G=function(){"use strict";function a(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};_(this,a),this.messageList=[],this.options=(0,P.Z)({},{cache:!1,cacheVersion:"1"},s)}var i=a.prototype;return i.install=function(){},i.init=function(r,o){var f=this,c=this.options,h=c.cache,k=c.cacheVersion;this.workerList=Array.from({length:o},function(M,t){var e=typeof r=="string"?new Worker(r):r();return e.onmessage=function(n){var l=n.data,u=l.res,b=l.uuid,S=f.messageList.find(function(B){var I=B.uuid;return b===I});if(S==null||S.options.cb(u),f.workerList[t].inUse=!1,f.checkMessage(),h){var A=(S==null?void 0:S.options.cacheVersion)||k;(0,D.set)(b,(0,m.Z)({},A,u))}},{worker:e,inUse:!1}})},i.postMessage=function(r,o){var f=this,c=this.options,h=c.cache,k=c.cacheVersion;if(h&&!r.workerKey){console.warn("worker cache need workerKey");return}if(h&&r.workerKey&&r.delCache){console.warn("worker cache del: ".concat(r.workerKey)),(0,D.del)(r.workerKey);return}var M=r.workerKey||E.MathUtils.generateUUID();(h?(0,D.get)(M):Promise.resolve()).then(function(t){var e=o.cacheVersion||k;t&&t[e]?o.cb(t[e]):(f.messageList.push({req:r,options:o,uuid:M,inUse:!1}),f.checkMessage())}).catch(function(){console.warn("err:worker cache"),f.messageList.push({req:r,options:o,uuid:M,inUse:!1}),f.checkMessage()})},i.checkMessage=function(){var r=this.workerList.find(function(f){var c=f.inUse;return!c});if(r){var o=this.messageList.find(function(f){var c=f.inUse;return!c});o&&(o.inUse=!0,r.inUse=!0,r.worker.postMessage({req:o.req,uuid:o.uuid}))}},i.dispose=function(){this.workerList.forEach(function(r){var o=r.worker;o.terminate()}),this.workerList=[],this.messageList=[]},a}()})(),module.exports=K})();
|
|
1
|
+
(function(){var X={666:function(m){var _=function(p){"use strict";var T=Object.prototype,O=T.hasOwnProperty,d,L=typeof Symbol=="function"?Symbol:{},j=L.iterator||"@@iterator",P=L.asyncIterator||"@@asyncIterator",k=L.toStringTag||"@@toStringTag";function v(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{v({},"")}catch(t){v=function(e,n,l){return e[n]=l}}function C(t,e,n,l){var h=e&&e.prototype instanceof V?e:V,w=Object.create(h.prototype),R=new f(l||[]);return w._invoke=r(t,n,R),w}p.wrap=C;function z(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(l){return{type:"throw",arg:l}}}var U="suspendedStart",Z="suspendedYield",N="executing",B="completed",E={};function V(){}function y(){}function g(){}var A={};v(A,j,function(){return this});var D=Object.getPrototypeOf,G=D&&D(D(b([])));G&&G!==T&&O.call(G,j)&&(A=G);var a=g.prototype=V.prototype=Object.create(A);y.prototype=g,v(a,"constructor",g),v(g,"constructor",y),y.displayName=v(g,k,"GeneratorFunction");function s(t){["next","throw","return"].forEach(function(e){v(t,e,function(n){return this._invoke(e,n)})})}p.isGeneratorFunction=function(t){var e=typeof t=="function"&&t.constructor;return e?e===y||(e.displayName||e.name)==="GeneratorFunction":!1},p.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,v(t,k,"GeneratorFunction")),t.prototype=Object.create(a),t},p.awrap=function(t){return{__await:t}};function c(t,e){function n(w,R,S,H){var I=z(t[w],t,R);if(I.type==="throw")H(I.arg);else{var $=I.arg,F=$.value;return F&&typeof F=="object"&&O.call(F,"__await")?e.resolve(F.__await).then(function(W){n("next",W,S,H)},function(W){n("throw",W,S,H)}):e.resolve(F).then(function(W){$.value=W,S($)},function(W){return n("throw",W,S,H)})}}var l;function h(w,R){function S(){return new e(function(H,I){n(w,R,H,I)})}return l=l?l.then(S,S):S()}this._invoke=h}s(c.prototype),v(c.prototype,P,function(){return this}),p.AsyncIterator=c,p.async=function(t,e,n,l,h){h===void 0&&(h=Promise);var w=new c(C(t,e,n,l),h);return p.isGeneratorFunction(e)?w:w.next().then(function(R){return R.done?R.value:w.next()})};function r(t,e,n){var l=U;return function(w,R){if(l===N)throw new Error("Generator is already running");if(l===B){if(w==="throw")throw R;return M()}for(n.method=w,n.arg=R;;){var S=n.delegate;if(S){var H=i(S,n);if(H){if(H===E)continue;return H}}if(n.method==="next")n.sent=n._sent=n.arg;else if(n.method==="throw"){if(l===U)throw l=B,n.arg;n.dispatchException(n.arg)}else n.method==="return"&&n.abrupt("return",n.arg);l=N;var I=z(t,e,n);if(I.type==="normal"){if(l=n.done?B:Z,I.arg===E)continue;return{value:I.arg,done:n.done}}else I.type==="throw"&&(l=B,n.method="throw",n.arg=I.arg)}}}function i(t,e){var n=t.iterator[e.method];if(n===d){if(e.delegate=null,e.method==="throw"){if(t.iterator.return&&(e.method="return",e.arg=d,i(t,e),e.method==="throw"))return E;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return E}var l=z(n,t.iterator,e.arg);if(l.type==="throw")return e.method="throw",e.arg=l.arg,e.delegate=null,E;var h=l.arg;if(!h)return e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,E;if(h.done)e[t.resultName]=h.value,e.next=t.nextLoc,e.method!=="return"&&(e.method="next",e.arg=d);else return h;return e.delegate=null,E}s(a),v(a,k,"Generator"),v(a,j,function(){return this}),v(a,"toString",function(){return"[object Generator]"});function u(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function o(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function f(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(u,this),this.reset(!0)}p.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function l(){for(;e.length;){var h=e.pop();if(h in t)return l.value=h,l.done=!1,l}return l.done=!0,l}};function b(t){if(t){var e=t[j];if(e)return e.call(t);if(typeof t.next=="function")return t;if(!isNaN(t.length)){var n=-1,l=function h(){for(;++n<t.length;)if(O.call(t,n))return h.value=t[n],h.done=!1,h;return h.value=d,h.done=!0,h};return l.next=l}}return{next:M}}p.values=b;function M(){return{value:d,done:!0}}return f.prototype={constructor:f,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=d,this.done=!1,this.delegate=null,this.method="next",this.arg=d,this.tryEntries.forEach(o),!t)for(var e in this)e.charAt(0)==="t"&&O.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=d)},stop:function(){this.done=!0;var t=this.tryEntries[0],e=t.completion;if(e.type==="throw")throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(H,I){return w.type="throw",w.arg=t,e.next=H,I&&(e.method="next",e.arg=d),!!I}for(var l=this.tryEntries.length-1;l>=0;--l){var h=this.tryEntries[l],w=h.completion;if(h.tryLoc==="root")return n("end");if(h.tryLoc<=this.prev){var R=O.call(h,"catchLoc"),S=O.call(h,"finallyLoc");if(R&&S){if(this.prev<h.catchLoc)return n(h.catchLoc,!0);if(this.prev<h.finallyLoc)return n(h.finallyLoc)}else if(R){if(this.prev<h.catchLoc)return n(h.catchLoc,!0)}else if(S){if(this.prev<h.finallyLoc)return n(h.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var l=this.tryEntries[n];if(l.tryLoc<=this.prev&&O.call(l,"finallyLoc")&&this.prev<l.finallyLoc){var h=l;break}}h&&(t==="break"||t==="continue")&&h.tryLoc<=e&&e<=h.finallyLoc&&(h=null);var w=h?h.completion:{};return w.type=t,w.arg=e,h?(this.method="next",this.next=h.finallyLoc,E):this.complete(w)},complete:function(t,e){if(t.type==="throw")throw t.arg;return t.type==="break"||t.type==="continue"?this.next=t.arg:t.type==="return"?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):t.type==="normal"&&e&&(this.next=e),E},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),o(n),E}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var l=n.completion;if(l.type==="throw"){var h=l.arg;o(n)}return h}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:b(t),resultName:e,nextLoc:n},this.method==="next"&&(this.arg=d),E}},p}(m.exports);try{regeneratorRuntime=_}catch(p){typeof globalThis=="object"?globalThis.regeneratorRuntime=_:Function("r","regeneratorRuntime = r")(_)}},584:function(m,_,p){"use strict";p.d(_,{makePromiseCreator:function(){return T.Z}});var T=p(282),O=p(666),d=p.n(O),L=null,j=p(644);function P(E){if(E.material){var V=Array.isArray(E.material)?E.material:[E.material];V.forEach(function(y){var g,A;(g=y.color)===null||g===void 0||g.convertSRGBToLinear(),(A=y.emissive)===null||A===void 0||A.convertSRGBToLinear(),y.map&&(y.map.encoding=THREE.sRGBEncoding),y.emissiveMap&&(y.emissiveMap.encoding=THREE.sRGBEncoding)})}}var k=p(568),v=p(924),C=p(360),z=p(484),U=null,Z=null,N=function(){var E=(0,k.Z)(d().mark(function V(y,g){var A,D,G,a,s,c,r,i,u;return d().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:return A=g.type,D=A===void 0?"blob":A,G=g.version,a=G===void 0?"1":G,f.next=4,(0,C.get)(y);case 4:if(c=f.sent,!(c&&c[a])){f.next=9;break}s=c[a],f.next=15;break;case 9:return f.next=11,(0,z.Z)(fetch(y).then(function(b){if(b.ok)return b[D]();throw new Error}));case 11:r=f.sent,i=r.res,u=r.err,u||(s=i,(0,C.set)(y,(0,v.Z)({},a,i)));case 15:return f.abrupt("return",s?{url:D==="json"?y:URL.createObjectURL(s),store:s}:{url:y});case 16:case"end":return f.stop()}},V)}));return function(y,g){return E.apply(this,arguments)}}(),B=p(705)},282:function(m,_,p){"use strict";p.d(_,{Z:function(){return O}});var T=p(484);function O(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},j={};return j.promise=new Promise(function(P,k){j.resolve=P,j.reject=k}),d&&(j.promise=(0,T.Z)(j.promise,L)),j}},484:function(m,_,p){"use strict";p.d(_,{Z:function(){return O}});var T=p(42);function O(d){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return d.then(function(j){return(0,T.Z)({err:null,res:j},L)}).catch(function(j){return(0,T.Z)({err:j,res:void 0},L)})}},705:function(m,_,p){"use strict";var T=p(644),O=p.n(T),d=new Map,L=function(){var P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{generateTopUV:function(k,v,C,z,U){var Z=v[C*3],N=v[C*3+1],B=v[z*3],E=v[z*3+1],V=v[U*3],y=v[U*3+1],g;if(d.has(k))g=d.get(k);else{var A=P.box3||new THREE.Box3;if(!P.box3){var D=k.parameters.shapes.getPoints();A.setFromArray(D.map(function(r){return[r.x,r.y,0]}).flat())}var G=A.getSize(new THREE.Vector3);P.split&&(G.y/=P.split),g={box:A,size:G},d.set(k,g)}var a=g.box,s=g.size,c=P.split?1-P.split:0;return[new THREE.Vector2((Z-a.min.x)/s.x,(N-a.min.y)/s.y+c),new THREE.Vector2((B-a.min.x)/s.x,(E-a.min.y)/s.y+c),new THREE.Vector2((V-a.min.x)/s.x,(y-a.min.y)/s.y+c)]},generateSideWallUV:function(k,v,C,z,U,Z){var N=v[C*3],B=v[C*3+1],E=v[C*3+2],V=v[z*3],y=v[z*3+1],g=v[z*3+2],A=v[U*3],D=v[U*3+1],G=v[U*3+2],a=v[Z*3],s=v[Z*3+1],c=v[Z*3+2],r;if(d.has(v))r=d.get(v);else{var i=new THREE.Box3;i.setFromArray(v);var u=i.getSize(new THREE.Vector3);P.split&&(u.z/=1-P.split),r={box:i,size:u},d.set(v,r)}var o=r.box,f=r.size;return Math.abs(B-y)<Math.abs(N-V)?[new THREE.Vector2((N-o.min.x)/f.x,(E-o.min.z)/f.z),new THREE.Vector2((V-o.min.x)/f.x,(g-o.min.z)/f.z),new THREE.Vector2((A-o.min.x)/f.x,(G-o.min.z)/f.z),new THREE.Vector2((a-o.min.x)/f.x,(c-o.min.z)/f.z)]:[new THREE.Vector2((B-o.min.y)/f.y,(E-o.min.z)/f.z),new THREE.Vector2((y-o.min.y)/f.y,(g-o.min.z)/f.z),new THREE.Vector2((D-o.min.y)/f.y,(G-o.min.z)/f.z),new THREE.Vector2((s-o.min.y)/f.y,(c-o.min.z)/f.z)]}}},j=function(){d.clear()}},360:function(m){"use strict";m.exports=require("idb-keyval")},644:function(m){"use strict";m.exports=require("three")},568:function(m,_,p){"use strict";p.d(_,{Z:function(){return O}});function T(d,L,j,P,k,v,C){try{var z=d[v](C),U=z.value}catch(Z){j(Z);return}z.done?L(U):Promise.resolve(U).then(P,k)}function O(d){return function(){var L=this,j=arguments;return new Promise(function(P,k){var v=d.apply(L,j);function C(U){T(v,P,k,C,z,"next",U)}function z(U){T(v,P,k,C,z,"throw",U)}C(void 0)})}}},924:function(m,_,p){"use strict";p.d(_,{Z:function(){return T}});function T(O,d,L){return d in O?Object.defineProperty(O,d,{value:L,enumerable:!0,configurable:!0,writable:!0}):O[d]=L,O}},42:function(m,_,p){"use strict";p.d(_,{Z:function(){return O}});var T=p(924);function O(d){for(var L=1;L<arguments.length;L++){var j=arguments[L]!=null?arguments[L]:{},P=Object.keys(j);typeof Object.getOwnPropertySymbols=="function"&&(P=P.concat(Object.getOwnPropertySymbols(j).filter(function(k){return Object.getOwnPropertyDescriptor(j,k).enumerable}))),P.forEach(function(k){(0,T.Z)(d,k,j[k])})}return d}}},Y={};function x(m){var _=Y[m];if(_!==void 0)return _.exports;var p=Y[m]={exports:{}};return X[m](p,p.exports,x),p.exports}(function(){x.n=function(m){var _=m&&m.__esModule?function(){return m.default}:function(){return m};return x.d(_,{a:_}),_}})(),function(){x.d=function(m,_){for(var p in _)x.o(_,p)&&!x.o(m,p)&&Object.defineProperty(m,p,{enumerable:!0,get:_[p]})}}(),function(){x.o=function(m,_){return Object.prototype.hasOwnProperty.call(m,_)}}(),function(){x.r=function(m){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(m,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(m,"__esModule",{value:!0})}}();var K={};(function(){"use strict";x.r(K),x.d(K,{Cache:function(){return d},Data:function(){return y},Draw:function(){return V},Wk:function(){return G}});var m=x(568);function _(a,s){if(!(a instanceof s))throw new TypeError("Cannot call a class as a function")}var p=x(666),T=x.n(p),O=x(584),d=function(){"use strict";function a(){_(this,a),this.cache=new Map}var s=a.prototype;return s.install=function(){},s.init=function(r){var i=(0,O.makePromiseCreator)();this.cache.set(r,i)},s.get=function(r,i){var u=this;return(0,m.Z)(T().mark(function o(){var f,b;return T().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!(!u.cache.get(r)&&i)){t.next=6;break}return u.init(r),t.next=4,i();case 4:f=t.sent,u.set(r,f);case 6:if(!u.cache.get(r)){t.next=11;break}return t.next=9,u.cache.get(r).promise;case 9:return b=t.sent,t.abrupt("return",b);case 11:case"end":return t.stop()}},o)}))()},s.set=function(r,i){var u=this.cache.get(r);u?u.resolve(i):console.warn("init cache first")},s.dispose=function(){this.cache.forEach(function(r,i){r.reject("stop set cache:".concat(i))}),this.cache.clear()},a}();function L(a,s){for(var c=0;c<s.length;c++){var r=s[c];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(a,r.key,r)}}function j(a,s,c){return s&&L(a.prototype,s),c&&L(a,c),a}function P(a){if(Array.isArray(a))return a}function k(a){if(typeof Symbol!="undefined"&&a[Symbol.iterator]!=null||a["@@iterator"]!=null)return Array.from(a)}function v(){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 C(a,s){(s==null||s>a.length)&&(s=a.length);for(var c=0,r=new Array(s);c<s;c++)r[c]=a[c];return r}function z(a,s){if(!!a){if(typeof a=="string")return C(a,s);var c=Object.prototype.toString.call(a).slice(8,-1);if(c==="Object"&&a.constructor&&(c=a.constructor.name),c==="Map"||c==="Set")return Array.from(c);if(c==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c))return C(a,s)}}function U(a,s){return P(a)||k(a,s)||z(a,s)||v()}function Z(a){if(Array.isArray(a))return C(a)}function N(){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 B(a){return Z(a)||k(a)||z(a)||N()}var E=x(644),V=function(){"use strict";function a(c){_(this,a),this.onTopBase=new Map,this.objectNamesToFactories=new Map,this.objects=new Map,this.objects_=c}var s=a.prototype;return s.install=function(r){this.pencil=r,this.initObjectFactories()},s.initObjectFactories=function(){var r=this,i=this.objects_;Object.keys(i).forEach(function(u){var o=function(){function f(){_(this,f)}var b=f.prototype;return b.create=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new i[u](t)},f}();r.objectNamesToFactories.set(u,o)})},s.getObject=function(r,i){r.includes("#")&&console.warn("getObject:err:\u4E0D\u652F\u6301 #",r);var u=(i||{}).key,o="".concat(r).concat(u?"#".concat(u):""),f=this.objects.get(o);return f},s.getAllObject=function(r,i){r.includes("#")&&console.warn("getAllObject:err:\u4E0D\u652F\u6301 #",r);var u=(i||{}).key,o="".concat(r).concat(u?"#".concat(u):""),f=[];return this.objects.forEach(function(b,M){(M.startsWith("".concat(o,"#"))||M===o)&&f.push(b)}),f},s.draw=function(r,i,u){var o=this;return(0,m.Z)(T().mark(function f(){var b,M,t,e,n,l,h,w;return T().wrap(function(S){for(;;)switch(S.prev=S.next){case 0:if(b=o.objectNamesToFactories.get(r),!b){S.next=16;break}return M=(i||{}).key,t="".concat(r).concat(M?"#".concat(M):""),o.objects.has(t)&&(e=E.MathUtils.generateUUID(),t+="#".concat(e)),n=(i==null?void 0:i.target)||u,l=(i==null?void 0:i.onTop)||0,typeof n=="string"?h=o.objects.get(n):(n==null?void 0:n.objecttype__)==="BaseObject"?h=n:h=o.pencil.scene,w=new b().create(i),w.pencil=o.pencil,w.key=t,o.objects.set(t,w),S.next=15,o.addMesh(w,h,l);case 15:return S.abrupt("return",w);case 16:throw new Error("Unrecognized:".concat(r));case 17:case"end":return S.stop()}},f)}))()},s.addMesh=function(r,i,u){var o=this;return(0,m.Z)(T().mark(function f(){var b,M,t;return T().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,r.create();case 2:r.object3d&&(r.object3d.userData.BaseObject_=r,u&&(r.type_==="node"?r.object3d.renderOrder=u:(b=1e3+u*2,M="".concat(b-1),o.onTopBase.has(M)||(t=new E.Points(void 0,new E.PointsMaterial({transparent:!0,opacity:0})),t.renderOrder=b-1,t.onBeforeRender=function(){o.pencil.renderer.clearDepth()},t.frustumCulled=!1,o.onTopBase.set(M,!0),o.pencil.scene.add(t)),r.object3d.renderOrder=b)),i.add(r.object3d)),r.visible=!0,r.render(),r.pm.resolve();case 6:case"end":return n.stop()}},f)}))()},s.erase=function(){for(var r=arguments.length,i=new Array(r),u=0;u<r;u++)i[u]=arguments[u];var o=this;B(i).forEach(function(f){var b=[];if(typeof f=="string"){var M,t=U(f.split("#"),2),e=t[0],n=t[1];(M=b).push.apply(M,B(o.getAllObject(e,{key:n})))}else b.push(f);b.forEach(function(l){o.removeMesh(l)})})},s.removeMesh=function(r){var i=this,u=r.parent;r.object3d&&u.remove(r.object3d),r.traverse(function(o){o.visible=!1,o.dispose(),i.objects.delete(o.key)})},s.update=function(r,i){this.objects.forEach(function(u){u.update(r,i)})},s.setSize=function(r,i){this.objects.forEach(function(u){u.resize(r,i)})},s.dispose=function(){this.objects.forEach(function(r,i){r.dispose(),r.pm.reject("stop draw:".concat(i))}),this.objects.clear(),this.onTopBase.clear(),this.objectNamesToFactories.clear()},j(a,[{key:"objectsPromise",get:function(){var r=[];return this.objects.forEach(function(i){r.push(i.pm.promise)}),r}}]),a}(),y=function(){"use strict";function a(){_(this,a),this.data={}}var s=a.prototype;return s.install=function(){},s.setData=function(r,i){var u,o;this.data[r]=i,(o=(u=this).cb)===null||o===void 0||o.call(u,r)},s.runAll=function(){var r=this;Object.keys(this.data).forEach(function(i){var u,o;(o=(u=r).cb)===null||o===void 0||o.call(u,i)})},s.dispose=function(){this.data={},this.cb=void 0},a}(),g=x(924),A=x(42),D=x(360),G=function(){"use strict";function a(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};_(this,a),this.messageList=[],this.options=(0,A.Z)({},{cache:!1,cacheVersion:"1"},c)}var s=a.prototype;return s.install=function(){},s.init=function(r,i){var u=this,o=this.options,f=o.cache,b=o.cacheVersion;this.workerList=Array.from({length:i},function(M,t){var e=typeof r=="string"?new Worker(r):r();return e.onmessage=function(n){var l=n.data,h=l.res,w=l.uuid,R=u.messageList.find(function(H){var I=H.uuid;return w===I});if(R==null||R.options.cb(h),u.workerList[t].inUse=!1,u.checkMessage(),f){var S=(R==null?void 0:R.options.cacheVersion)||b;(0,D.set)(w,(0,g.Z)({},S,h))}},{worker:e,inUse:!1}})},s.postMessage=function(r,i){var u=this,o=this.options,f=o.cache,b=o.cacheVersion;if(f&&!r.workerKey){console.warn("worker cache need workerKey");return}if(f&&r.workerKey&&r.delCache){console.warn("worker cache del: ".concat(r.workerKey)),(0,D.del)(r.workerKey);return}var M=r.workerKey||E.MathUtils.generateUUID();(f?(0,D.get)(M):Promise.resolve()).then(function(t){var e=i.cacheVersion||b;t&&t[e]?i.cb(t[e]):(u.messageList.push({req:r,options:i,uuid:M,inUse:!1}),u.checkMessage())}).catch(function(){console.warn("err:worker cache"),u.messageList.push({req:r,options:i,uuid:M,inUse:!1}),u.checkMessage()})},s.checkMessage=function(){var r=this.workerList.find(function(u){var o=u.inUse;return!o});if(r){var i=this.messageList.find(function(u){var o=u.inUse;return!o});i&&(i.inUse=!0,r.inUse=!0,r.worker.postMessage({req:i.req,uuid:i.uuid}))}},s.dispose=function(){this.workerList.forEach(function(r){var i=r.worker;i.terminate()}),this.workerList=[],this.messageList=[]},a}()})(),module.exports=K})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as X from"idb-keyval";import*as Y from"three";var Q={666:function(b){var g=function(h){"use strict";var O=Object.prototype,m=O.hasOwnProperty,v,w=typeof Symbol=="function"?Symbol:{},d=w.iterator||"@@iterator",x=w.asyncIterator||"@@asyncIterator",p=w.toStringTag||"@@toStringTag";function k(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{k({},"")}catch(t){k=function(e,n,l){return e[n]=l}}function R(t,e,n,l){var f=e&&e.prototype instanceof D?e:D,E=Object.create(f.prototype),A=new y(l||[]);return E._invoke=r(t,n,A),E}h.wrap=R;function U(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(l){return{type:"throw",arg:l}}}var G="suspendedStart",N="suspendedYield",W="executing",H="completed",j={};function D(){}function _(){}function T(){}var C={};k(C,d,function(){return this});var z=Object.getPrototypeOf,S=z&&z(z(L([])));S&&S!==O&&m.call(S,d)&&(C=S);var a=T.prototype=D.prototype=Object.create(C);_.prototype=T,k(a,"constructor",T),k(T,"constructor",_),_.displayName=k(T,p,"GeneratorFunction");function u(t){["next","throw","return"].forEach(function(e){k(t,e,function(n){return this._invoke(e,n)})})}h.isGeneratorFunction=function(t){var e=typeof t=="function"&&t.constructor;return e?e===_||(e.displayName||e.name)==="GeneratorFunction":!1},h.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,T):(t.__proto__=T,k(t,p,"GeneratorFunction")),t.prototype=Object.create(a),t},h.awrap=function(t){return{__await:t}};function i(t,e){function n(E,A,P,I){var V=U(t[E],t,A);if(V.type==="throw")I(V.arg);else{var $=V.arg,F=$.value;return F&&typeof F=="object"&&m.call(F,"__await")?e.resolve(F.__await).then(function(Z){n("next",Z,P,I)},function(Z){n("throw",Z,P,I)}):e.resolve(F).then(function(Z){$.value=Z,P($)},function(Z){return n("throw",Z,P,I)})}}var l;function f(E,A){function P(){return new e(function(I,V){n(E,A,I,V)})}return l=l?l.then(P,P):P()}this._invoke=f}u(i.prototype),k(i.prototype,x,function(){return this}),h.AsyncIterator=i,h.async=function(t,e,n,l,f){f===void 0&&(f=Promise);var E=new i(R(t,e,n,l),f);return h.isGeneratorFunction(e)?E:E.next().then(function(A){return A.done?A.value:E.next()})};function r(t,e,n){var l=G;return function(E,A){if(l===W)throw new Error("Generator is already running");if(l===H){if(E==="throw")throw A;return M()}for(n.method=E,n.arg=A;;){var P=n.delegate;if(P){var I=s(P,n);if(I){if(I===j)continue;return I}}if(n.method==="next")n.sent=n._sent=n.arg;else if(n.method==="throw"){if(l===G)throw l=H,n.arg;n.dispatchException(n.arg)}else n.method==="return"&&n.abrupt("return",n.arg);l=W;var V=U(t,e,n);if(V.type==="normal"){if(l=n.done?H:N,V.arg===j)continue;return{value:V.arg,done:n.done}}else V.type==="throw"&&(l=H,n.method="throw",n.arg=V.arg)}}}function s(t,e){var n=t.iterator[e.method];if(n===v){if(e.delegate=null,e.method==="throw"){if(t.iterator.return&&(e.method="return",e.arg=v,s(t,e),e.method==="throw"))return j;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return j}var l=U(n,t.iterator,e.arg);if(l.type==="throw")return e.method="throw",e.arg=l.arg,e.delegate=null,j;var f=l.arg;if(!f)return e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,j;if(f.done)e[t.resultName]=f.value,e.next=t.nextLoc,e.method!=="return"&&(e.method="next",e.arg=v);else return f;return e.delegate=null,j}u(a),k(a,p,"Generator"),k(a,d,function(){return this}),k(a,"toString",function(){return"[object Generator]"});function o(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function c(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function y(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(o,this),this.reset(!0)}h.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function l(){for(;e.length;){var f=e.pop();if(f in t)return l.value=f,l.done=!1,l}return l.done=!0,l}};function L(t){if(t){var e=t[d];if(e)return e.call(t);if(typeof t.next=="function")return t;if(!isNaN(t.length)){var n=-1,l=function f(){for(;++n<t.length;)if(m.call(t,n))return f.value=t[n],f.done=!1,f;return f.value=v,f.done=!0,f};return l.next=l}}return{next:M}}h.values=L;function M(){return{value:v,done:!0}}return y.prototype={constructor:y,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=v,this.done=!1,this.delegate=null,this.method="next",this.arg=v,this.tryEntries.forEach(c),!t)for(var e in this)e.charAt(0)==="t"&&m.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=v)},stop:function(){this.done=!0;var t=this.tryEntries[0],e=t.completion;if(e.type==="throw")throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(I,V){return E.type="throw",E.arg=t,e.next=I,V&&(e.method="next",e.arg=v),!!V}for(var l=this.tryEntries.length-1;l>=0;--l){var f=this.tryEntries[l],E=f.completion;if(f.tryLoc==="root")return n("end");if(f.tryLoc<=this.prev){var A=m.call(f,"catchLoc"),P=m.call(f,"finallyLoc");if(A&&P){if(this.prev<f.catchLoc)return n(f.catchLoc,!0);if(this.prev<f.finallyLoc)return n(f.finallyLoc)}else if(A){if(this.prev<f.catchLoc)return n(f.catchLoc,!0)}else if(P){if(this.prev<f.finallyLoc)return n(f.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var l=this.tryEntries[n];if(l.tryLoc<=this.prev&&m.call(l,"finallyLoc")&&this.prev<l.finallyLoc){var f=l;break}}f&&(t==="break"||t==="continue")&&f.tryLoc<=e&&e<=f.finallyLoc&&(f=null);var E=f?f.completion:{};return E.type=t,E.arg=e,f?(this.method="next",this.next=f.finallyLoc,j):this.complete(E)},complete:function(t,e){if(t.type==="throw")throw t.arg;return t.type==="break"||t.type==="continue"?this.next=t.arg:t.type==="return"?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):t.type==="normal"&&e&&(this.next=e),j},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),c(n),j}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var l=n.completion;if(l.type==="throw"){var f=l.arg;c(n)}return f}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:L(t),resultName:e,nextLoc:n},this.method==="next"&&(this.arg=v),j}},h}(b.exports);try{regeneratorRuntime=g}catch(h){typeof globalThis=="object"?globalThis.regeneratorRuntime=g:Function("r","regeneratorRuntime = r")(g)}},584:function(b,g,h){h.d(g,{Mf:function(){return O.Z}});var O=h(282),m=h(666),v=h.n(m),w=null,d=h(949);function x(j){if(j.material){var D=Array.isArray(j.material)?j.material:[j.material];D.forEach(function(_){var T,C;(T=_.color)===null||T===void 0||T.convertSRGBToLinear(),(C=_.emissive)===null||C===void 0||C.convertSRGBToLinear(),_.map&&(_.map.encoding=THREE.sRGBEncoding),_.emissiveMap&&(_.emissiveMap.encoding=THREE.sRGBEncoding)})}}var p=h(568),k=h(924),R=h(77),U=h(484),G=null,N=null,W=function(){var j=(0,p.Z)(v().mark(function D(_,T){var C,z,S,a,u,i,r,s,o;return v().wrap(function(y){for(;;)switch(y.prev=y.next){case 0:return C=T.type,z=C===void 0?"blob":C,S=T.version,a=S===void 0?"1":S,y.next=4,(0,R.get)(_);case 4:if(i=y.sent,!(i&&i[a])){y.next=9;break}u=i[a],y.next=15;break;case 9:return y.next=11,(0,U.Z)(fetch(_).then(function(L){if(L.ok)return L[z]();throw new Error}));case 11:r=y.sent,s=r.res,o=r.err,o||(u=s,(0,R.set)(_,(0,k.Z)({},a,s)));case 15:return y.abrupt("return",u?{url:z==="json"?_:URL.createObjectURL(u),store:u}:{url:_});case 16:case"end":return y.stop()}},D)}));return function(_,T){return j.apply(this,arguments)}}(),H=h(705)},282:function(b,g,h){h.d(g,{Z:function(){return m}});var O=h(484);function m(){var v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},d={};return d.promise=new Promise(function(x,p){d.resolve=x,d.reject=p}),v&&(d.promise=(0,O.Z)(d.promise,w)),d}},484:function(b,g,h){h.d(g,{Z:function(){return m}});var O=h(42);function m(v){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return v.then(function(d){return(0,O.Z)({err:null,res:d},w)}).catch(function(d){return(0,O.Z)({err:d,res:void 0},w)})}},705:function(b,g,h){var O=h(949),m=new Map,v=function(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{generateTopUV:function(x,p,k,R,U){var G=p[k*3],N=p[k*3+1],W=p[R*3],H=p[R*3+1],j=p[U*3],D=p[U*3+1],_;if(m.has(x))_=m.get(x);else{var T=d.box3||new THREE.Box3;if(!d.box3){var C=x.parameters.shapes.getPoints();T.setFromArray(C.map(function(i){return[i.x,i.y,0]}).flat())}var z=T.getSize(new THREE.Vector3);d.split&&(z.y/=d.split),_={box:T,size:z},m.set(x,_)}var S=_.box,a=_.size,u=d.split?1-d.split:0;return[new THREE.Vector2((G-S.min.x)/a.x,(N-S.min.y)/a.y+u),new THREE.Vector2((W-S.min.x)/a.x,(H-S.min.y)/a.y+u),new THREE.Vector2((j-S.min.x)/a.x,(D-S.min.y)/a.y+u)]},generateSideWallUV:function(x,p,k,R,U,G){var N=p[k*3],W=p[k*3+1],H=p[k*3+2],j=p[R*3],D=p[R*3+1],_=p[R*3+2],T=p[U*3],C=p[U*3+1],z=p[U*3+2],S=p[G*3],a=p[G*3+1],u=p[G*3+2],i;if(m.has(p))i=m.get(p);else{var r=new THREE.Box3;r.setFromArray(p);var s=r.getSize(new THREE.Vector3);d.split&&(s.z/=1-d.split),i={box:r,size:s},m.set(p,i)}var o=i.box,c=i.size;return Math.abs(W-D)<Math.abs(N-j)?[new THREE.Vector2((N-o.min.x)/c.x,(H-o.min.z)/c.z),new THREE.Vector2((j-o.min.x)/c.x,(_-o.min.z)/c.z),new THREE.Vector2((T-o.min.x)/c.x,(z-o.min.z)/c.z),new THREE.Vector2((S-o.min.x)/c.x,(u-o.min.z)/c.z)]:[new THREE.Vector2((W-o.min.y)/c.y,(H-o.min.z)/c.z),new THREE.Vector2((D-o.min.y)/c.y,(_-o.min.z)/c.z),new THREE.Vector2((C-o.min.y)/c.y,(z-o.min.z)/c.z),new THREE.Vector2((a-o.min.y)/c.y,(u-o.min.z)/c.z)]}}},w=function(){m.clear()}},77:function(b,g,h){var O=v=>{var w={};return h.d(w,v),w},m=v=>()=>v;b.exports=O({del:()=>X.del,get:()=>X.get,set:()=>X.set})},949:function(b,g,h){var O=v=>{var w={};return h.d(w,v),w},m=v=>()=>v;b.exports=O({MathUtils:()=>Y.MathUtils,Points:()=>Y.Points,PointsMaterial:()=>Y.PointsMaterial})},568:function(b,g,h){h.d(g,{Z:function(){return m}});function O(v,w,d,x,p,k,R){try{var U=v[k](R),G=U.value}catch(N){d(N);return}U.done?w(G):Promise.resolve(G).then(x,p)}function m(v){return function(){var w=this,d=arguments;return new Promise(function(x,p){var k=v.apply(w,d);function R(G){O(k,x,p,R,U,"next",G)}function U(G){O(k,x,p,R,U,"throw",G)}R(void 0)})}}},924:function(b,g,h){h.d(g,{Z:function(){return O}});function O(m,v,w){return v in m?Object.defineProperty(m,v,{value:w,enumerable:!0,configurable:!0,writable:!0}):m[v]=w,m}},42:function(b,g,h){h.d(g,{Z:function(){return m}});var O=h(924);function m(v){for(var w=1;w<arguments.length;w++){var d=arguments[w]!=null?arguments[w]:{},x=Object.keys(d);typeof Object.getOwnPropertySymbols=="function"&&(x=x.concat(Object.getOwnPropertySymbols(d).filter(function(p){return Object.getOwnPropertyDescriptor(d,p).enumerable}))),x.forEach(function(p){(0,O.Z)(v,p,d[p])})}return v}}},J={};function B(b){var g=J[b];if(g!==void 0)return g.exports;var h=J[b]={exports:{}};return Q[b](h,h.exports,B),h.exports}(function(){B.n=function(b){var g=b&&b.__esModule?function(){return b.default}:function(){return b};return B.d(g,{a:g}),g}})(),function(){B.d=function(b,g){for(var h in g)B.o(g,h)&&!B.o(b,h)&&Object.defineProperty(b,h,{enumerable:!0,get:g[h]})}}(),function(){B.o=function(b,g){return Object.prototype.hasOwnProperty.call(b,g)}}();var K={};(function(){B.d(K,{Ct:function(){return h},Vw:function(){return _},hG:function(){return D},Wk:function(){return S}});function b(a,u){if(!(a instanceof u))throw new TypeError("Cannot call a class as a function")}var g=B(584),h=function(){"use strict";function a(){b(this,a),this.cache=new Map}var u=a.prototype;return u.install=function(){},u.init=function(r){var s=(0,g.Mf)();this.cache.set(r,s)},u.get=function(r){var s;return(s=this.cache.get(r))===null||s===void 0?void 0:s.promise},u.set=function(r,s){var o=this.cache.get(r);o?o.resolve(s):console.warn("init cache first")},u.dispose=function(){this.cache.forEach(function(r,s){r.reject("stop set cache:".concat(s))}),this.cache.clear()},a}(),O=B(568);function m(a,u){for(var i=0;i<u.length;i++){var r=u[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(a,r.key,r)}}function v(a,u,i){return u&&m(a.prototype,u),i&&m(a,i),a}function w(a){if(Array.isArray(a))return a}function d(a){if(typeof Symbol!="undefined"&&a[Symbol.iterator]!=null||a["@@iterator"]!=null)return Array.from(a)}function x(){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 p(a,u){(u==null||u>a.length)&&(u=a.length);for(var i=0,r=new Array(u);i<u;i++)r[i]=a[i];return r}function k(a,u){if(!!a){if(typeof a=="string")return p(a,u);var i=Object.prototype.toString.call(a).slice(8,-1);if(i==="Object"&&a.constructor&&(i=a.constructor.name),i==="Map"||i==="Set")return Array.from(i);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return p(a,u)}}function R(a,u){return w(a)||d(a,u)||k(a,u)||x()}function U(a){if(Array.isArray(a))return p(a)}function G(){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 N(a){return U(a)||d(a)||k(a)||G()}var W=B(666),H=B.n(W),j=B(949),D=function(){"use strict";function a(i){b(this,a),this.onTopBase=new Map,this.objectNamesToFactories=new Map,this.objects=new Map,this.objects_=i}var u=a.prototype;return u.install=function(r){this.pencil=r,this.initObjectFactories()},u.initObjectFactories=function(){var r=this,s=this.objects_;Object.keys(s).forEach(function(o){var c=function(){function y(){b(this,y)}var L=y.prototype;return L.create=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new s[o](t)},y}();r.objectNamesToFactories.set(o,c)})},u.getObject=function(r,s){r.includes("#")&&console.warn("getObject:err:\u4E0D\u652F\u6301 #",r);var o=(s||{}).key,c="".concat(r).concat(o?"#".concat(o):""),y=this.objects.get(c);return y},u.getAllObject=function(r,s){r.includes("#")&&console.warn("getAllObject:err:\u4E0D\u652F\u6301 #",r);var o=(s||{}).key,c="".concat(r).concat(o?"#".concat(o):""),y=[];return this.objects.forEach(function(L,M){(M.startsWith("".concat(c,"#"))||M===c)&&y.push(L)}),y},u.draw=function(r,s,o){var c=this;return(0,O.Z)(H().mark(function y(){var L,M,t,e,n,l,f,E;return H().wrap(function(P){for(;;)switch(P.prev=P.next){case 0:if(L=c.objectNamesToFactories.get(r),!L){P.next=16;break}return M=(s||{}).key,t="".concat(r).concat(M?"#".concat(M):""),c.objects.has(t)&&(e=j.MathUtils.generateUUID(),t+="#".concat(e)),n=(s==null?void 0:s.target)||o,l=(s==null?void 0:s.onTop)||0,typeof n=="string"?f=c.objects.get(n):(n==null?void 0:n.objecttype__)==="BaseObject"?f=n:f=c.pencil.scene,E=new L().create(s),E.pencil=c.pencil,E.key=t,c.objects.set(t,E),P.next=15,c.addMesh(E,f,l);case 15:return P.abrupt("return",E);case 16:throw new Error("Unrecognized:".concat(r));case 17:case"end":return P.stop()}},y)}))()},u.addMesh=function(r,s,o){var c=this;return(0,O.Z)(H().mark(function y(){var L,M,t;return H().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,r.create();case 2:r.object3d&&(r.object3d.userData.BaseObject_=r,o&&(r.type_==="node"?r.object3d.renderOrder=o:(L=1e3+o*2,M="".concat(L-1),c.onTopBase.has(M)||(t=new j.Points(void 0,new j.PointsMaterial({transparent:!0,opacity:0})),t.renderOrder=L-1,t.onBeforeRender=function(){c.pencil.renderer.clearDepth()},t.frustumCulled=!1,c.onTopBase.set(M,!0),c.pencil.scene.add(t)),r.object3d.renderOrder=L)),s.add(r.object3d)),r.visible=!0,r.render(),r.pm.resolve();case 6:case"end":return n.stop()}},y)}))()},u.erase=function(){for(var r=arguments.length,s=new Array(r),o=0;o<r;o++)s[o]=arguments[o];var c=this;N(s).forEach(function(y){var L=[];if(typeof y=="string"){var M,t=R(y.split("#"),2),e=t[0],n=t[1];(M=L).push.apply(M,N(c.getAllObject(e,{key:n})))}else L.push(y);L.forEach(function(l){c.removeMesh(l)})})},u.removeMesh=function(r){var s=this,o=r.parent;r.object3d&&o.remove(r.object3d),r.traverse(function(c){c.visible=!1,c.dispose(),s.objects.delete(c.key)})},u.update=function(r,s){this.objects.forEach(function(o){o.update(r,s)})},u.setSize=function(r,s){this.objects.forEach(function(o){o.resize(r,s)})},u.dispose=function(){this.objects.forEach(function(r,s){r.dispose(),r.pm.reject("stop draw:".concat(s))}),this.objects.clear(),this.onTopBase.clear(),this.objectNamesToFactories.clear()},v(a,[{key:"objectsPromise",get:function(){var r=[];return this.objects.forEach(function(s){r.push(s.pm.promise)}),r}}]),a}(),_=function(){"use strict";function a(){b(this,a),this.data={}}var u=a.prototype;return u.install=function(){},u.setData=function(r,s){var o,c;this.data[r]=s,(c=(o=this).cb)===null||c===void 0||c.call(o,r)},u.runAll=function(){var r=this;Object.keys(this.data).forEach(function(s){var o,c;(c=(o=r).cb)===null||c===void 0||c.call(o,s)})},u.dispose=function(){this.data={},this.cb=void 0},a}(),T=B(924),C=B(42),z=B(77),S=function(){"use strict";function a(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};b(this,a),this.messageList=[],this.options=(0,C.Z)({},{cache:!1,cacheVersion:"1"},i)}var u=a.prototype;return u.install=function(){},u.init=function(r,s){var o=this,c=this.options,y=c.cache,L=c.cacheVersion;this.workerList=Array.from({length:s},function(M,t){var e=typeof r=="string"?new Worker(r):r();return e.onmessage=function(n){var l=n.data,f=l.res,E=l.uuid,A=o.messageList.find(function(I){var V=I.uuid;return E===V});if(A==null||A.options.cb(f),o.workerList[t].inUse=!1,o.checkMessage(),y){var P=(A==null?void 0:A.options.cacheVersion)||L;(0,z.set)(E,(0,T.Z)({},P,f))}},{worker:e,inUse:!1}})},u.postMessage=function(r,s){var o=this,c=this.options,y=c.cache,L=c.cacheVersion;if(y&&!r.workerKey){console.warn("worker cache need workerKey");return}if(y&&r.workerKey&&r.delCache){console.warn("worker cache del: ".concat(r.workerKey)),(0,z.del)(r.workerKey);return}var M=r.workerKey||j.MathUtils.generateUUID();(y?(0,z.get)(M):Promise.resolve()).then(function(t){var e=s.cacheVersion||L;t&&t[e]?s.cb(t[e]):(o.messageList.push({req:r,options:s,uuid:M,inUse:!1}),o.checkMessage())}).catch(function(){console.warn("err:worker cache"),o.messageList.push({req:r,options:s,uuid:M,inUse:!1}),o.checkMessage()})},u.checkMessage=function(){var r=this.workerList.find(function(o){var c=o.inUse;return!c});if(r){var s=this.messageList.find(function(o){var c=o.inUse;return!c});s&&(s.inUse=!0,r.inUse=!0,r.worker.postMessage({req:s.req,uuid:s.uuid}))}},u.dispose=function(){this.workerList.forEach(function(r){var s=r.worker;s.terminate()}),this.workerList=[],this.messageList=[]},a}()})();var q=K.Ct,tt=K.Vw,et=K.hG,rt=K.Wk;export{q as Cache,tt as Data,et as Draw,rt as Wk};
|
|
1
|
+
import*as X from"idb-keyval";import*as Y from"three";var Q={666:function(w){var y=function(h){"use strict";var L=Object.prototype,g=L.hasOwnProperty,d,b=typeof Symbol=="function"?Symbol:{},m=b.iterator||"@@iterator",C=b.asyncIterator||"@@asyncIterator",p=b.toStringTag||"@@toStringTag";function O(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{O({},"")}catch(t){O=function(e,n,l){return e[n]=l}}function A(t,e,n,l){var f=e&&e.prototype instanceof D?e:D,k=Object.create(f.prototype),x=new v(l||[]);return k._invoke=r(t,n,x),k}h.wrap=A;function S(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(l){return{type:"throw",arg:l}}}var G="suspendedStart",N="suspendedYield",W="executing",I="completed",j={};function D(){}function _(){}function T(){}var R={};O(R,m,function(){return this});var z=Object.getPrototypeOf,U=z&&z(z(E([])));U&&U!==L&&g.call(U,m)&&(R=U);var a=T.prototype=D.prototype=Object.create(R);_.prototype=T,O(a,"constructor",T),O(T,"constructor",_),_.displayName=O(T,p,"GeneratorFunction");function u(t){["next","throw","return"].forEach(function(e){O(t,e,function(n){return this._invoke(e,n)})})}h.isGeneratorFunction=function(t){var e=typeof t=="function"&&t.constructor;return e?e===_||(e.displayName||e.name)==="GeneratorFunction":!1},h.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,T):(t.__proto__=T,O(t,p,"GeneratorFunction")),t.prototype=Object.create(a),t},h.awrap=function(t){return{__await:t}};function i(t,e){function n(k,x,M,H){var V=S(t[k],t,x);if(V.type==="throw")H(V.arg);else{var $=V.arg,F=$.value;return F&&typeof F=="object"&&g.call(F,"__await")?e.resolve(F.__await).then(function(Z){n("next",Z,M,H)},function(Z){n("throw",Z,M,H)}):e.resolve(F).then(function(Z){$.value=Z,M($)},function(Z){return n("throw",Z,M,H)})}}var l;function f(k,x){function M(){return new e(function(H,V){n(k,x,H,V)})}return l=l?l.then(M,M):M()}this._invoke=f}u(i.prototype),O(i.prototype,C,function(){return this}),h.AsyncIterator=i,h.async=function(t,e,n,l,f){f===void 0&&(f=Promise);var k=new i(A(t,e,n,l),f);return h.isGeneratorFunction(e)?k:k.next().then(function(x){return x.done?x.value:k.next()})};function r(t,e,n){var l=G;return function(k,x){if(l===W)throw new Error("Generator is already running");if(l===I){if(k==="throw")throw x;return P()}for(n.method=k,n.arg=x;;){var M=n.delegate;if(M){var H=c(M,n);if(H){if(H===j)continue;return H}}if(n.method==="next")n.sent=n._sent=n.arg;else if(n.method==="throw"){if(l===G)throw l=I,n.arg;n.dispatchException(n.arg)}else n.method==="return"&&n.abrupt("return",n.arg);l=W;var V=S(t,e,n);if(V.type==="normal"){if(l=n.done?I:N,V.arg===j)continue;return{value:V.arg,done:n.done}}else V.type==="throw"&&(l=I,n.method="throw",n.arg=V.arg)}}}function c(t,e){var n=t.iterator[e.method];if(n===d){if(e.delegate=null,e.method==="throw"){if(t.iterator.return&&(e.method="return",e.arg=d,c(t,e),e.method==="throw"))return j;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return j}var l=S(n,t.iterator,e.arg);if(l.type==="throw")return e.method="throw",e.arg=l.arg,e.delegate=null,j;var f=l.arg;if(!f)return e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,j;if(f.done)e[t.resultName]=f.value,e.next=t.nextLoc,e.method!=="return"&&(e.method="next",e.arg=d);else return f;return e.delegate=null,j}u(a),O(a,p,"Generator"),O(a,m,function(){return this}),O(a,"toString",function(){return"[object Generator]"});function o(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function s(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function v(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(o,this),this.reset(!0)}h.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function l(){for(;e.length;){var f=e.pop();if(f in t)return l.value=f,l.done=!1,l}return l.done=!0,l}};function E(t){if(t){var e=t[m];if(e)return e.call(t);if(typeof t.next=="function")return t;if(!isNaN(t.length)){var n=-1,l=function f(){for(;++n<t.length;)if(g.call(t,n))return f.value=t[n],f.done=!1,f;return f.value=d,f.done=!0,f};return l.next=l}}return{next:P}}h.values=E;function P(){return{value:d,done:!0}}return v.prototype={constructor:v,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=d,this.done=!1,this.delegate=null,this.method="next",this.arg=d,this.tryEntries.forEach(s),!t)for(var e in this)e.charAt(0)==="t"&&g.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=d)},stop:function(){this.done=!0;var t=this.tryEntries[0],e=t.completion;if(e.type==="throw")throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(H,V){return k.type="throw",k.arg=t,e.next=H,V&&(e.method="next",e.arg=d),!!V}for(var l=this.tryEntries.length-1;l>=0;--l){var f=this.tryEntries[l],k=f.completion;if(f.tryLoc==="root")return n("end");if(f.tryLoc<=this.prev){var x=g.call(f,"catchLoc"),M=g.call(f,"finallyLoc");if(x&&M){if(this.prev<f.catchLoc)return n(f.catchLoc,!0);if(this.prev<f.finallyLoc)return n(f.finallyLoc)}else if(x){if(this.prev<f.catchLoc)return n(f.catchLoc,!0)}else if(M){if(this.prev<f.finallyLoc)return n(f.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var l=this.tryEntries[n];if(l.tryLoc<=this.prev&&g.call(l,"finallyLoc")&&this.prev<l.finallyLoc){var f=l;break}}f&&(t==="break"||t==="continue")&&f.tryLoc<=e&&e<=f.finallyLoc&&(f=null);var k=f?f.completion:{};return k.type=t,k.arg=e,f?(this.method="next",this.next=f.finallyLoc,j):this.complete(k)},complete:function(t,e){if(t.type==="throw")throw t.arg;return t.type==="break"||t.type==="continue"?this.next=t.arg:t.type==="return"?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):t.type==="normal"&&e&&(this.next=e),j},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),s(n),j}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var l=n.completion;if(l.type==="throw"){var f=l.arg;s(n)}return f}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},this.method==="next"&&(this.arg=d),j}},h}(w.exports);try{regeneratorRuntime=y}catch(h){typeof globalThis=="object"?globalThis.regeneratorRuntime=y:Function("r","regeneratorRuntime = r")(y)}},584:function(w,y,h){h.d(y,{Mf:function(){return L.Z}});var L=h(282),g=h(666),d=h.n(g),b=null,m=h(949);function C(j){if(j.material){var D=Array.isArray(j.material)?j.material:[j.material];D.forEach(function(_){var T,R;(T=_.color)===null||T===void 0||T.convertSRGBToLinear(),(R=_.emissive)===null||R===void 0||R.convertSRGBToLinear(),_.map&&(_.map.encoding=THREE.sRGBEncoding),_.emissiveMap&&(_.emissiveMap.encoding=THREE.sRGBEncoding)})}}var p=h(568),O=h(924),A=h(77),S=h(484),G=null,N=null,W=function(){var j=(0,p.Z)(d().mark(function D(_,T){var R,z,U,a,u,i,r,c,o;return d().wrap(function(v){for(;;)switch(v.prev=v.next){case 0:return R=T.type,z=R===void 0?"blob":R,U=T.version,a=U===void 0?"1":U,v.next=4,(0,A.get)(_);case 4:if(i=v.sent,!(i&&i[a])){v.next=9;break}u=i[a],v.next=15;break;case 9:return v.next=11,(0,S.Z)(fetch(_).then(function(E){if(E.ok)return E[z]();throw new Error}));case 11:r=v.sent,c=r.res,o=r.err,o||(u=c,(0,A.set)(_,(0,O.Z)({},a,c)));case 15:return v.abrupt("return",u?{url:z==="json"?_:URL.createObjectURL(u),store:u}:{url:_});case 16:case"end":return v.stop()}},D)}));return function(_,T){return j.apply(this,arguments)}}(),I=h(705)},282:function(w,y,h){h.d(y,{Z:function(){return g}});var L=h(484);function g(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},m={};return m.promise=new Promise(function(C,p){m.resolve=C,m.reject=p}),d&&(m.promise=(0,L.Z)(m.promise,b)),m}},484:function(w,y,h){h.d(y,{Z:function(){return g}});var L=h(42);function g(d){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return d.then(function(m){return(0,L.Z)({err:null,res:m},b)}).catch(function(m){return(0,L.Z)({err:m,res:void 0},b)})}},705:function(w,y,h){var L=h(949),g=new Map,d=function(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{generateTopUV:function(C,p,O,A,S){var G=p[O*3],N=p[O*3+1],W=p[A*3],I=p[A*3+1],j=p[S*3],D=p[S*3+1],_;if(g.has(C))_=g.get(C);else{var T=m.box3||new THREE.Box3;if(!m.box3){var R=C.parameters.shapes.getPoints();T.setFromArray(R.map(function(i){return[i.x,i.y,0]}).flat())}var z=T.getSize(new THREE.Vector3);m.split&&(z.y/=m.split),_={box:T,size:z},g.set(C,_)}var U=_.box,a=_.size,u=m.split?1-m.split:0;return[new THREE.Vector2((G-U.min.x)/a.x,(N-U.min.y)/a.y+u),new THREE.Vector2((W-U.min.x)/a.x,(I-U.min.y)/a.y+u),new THREE.Vector2((j-U.min.x)/a.x,(D-U.min.y)/a.y+u)]},generateSideWallUV:function(C,p,O,A,S,G){var N=p[O*3],W=p[O*3+1],I=p[O*3+2],j=p[A*3],D=p[A*3+1],_=p[A*3+2],T=p[S*3],R=p[S*3+1],z=p[S*3+2],U=p[G*3],a=p[G*3+1],u=p[G*3+2],i;if(g.has(p))i=g.get(p);else{var r=new THREE.Box3;r.setFromArray(p);var c=r.getSize(new THREE.Vector3);m.split&&(c.z/=1-m.split),i={box:r,size:c},g.set(p,i)}var o=i.box,s=i.size;return Math.abs(W-D)<Math.abs(N-j)?[new THREE.Vector2((N-o.min.x)/s.x,(I-o.min.z)/s.z),new THREE.Vector2((j-o.min.x)/s.x,(_-o.min.z)/s.z),new THREE.Vector2((T-o.min.x)/s.x,(z-o.min.z)/s.z),new THREE.Vector2((U-o.min.x)/s.x,(u-o.min.z)/s.z)]:[new THREE.Vector2((W-o.min.y)/s.y,(I-o.min.z)/s.z),new THREE.Vector2((D-o.min.y)/s.y,(_-o.min.z)/s.z),new THREE.Vector2((R-o.min.y)/s.y,(z-o.min.z)/s.z),new THREE.Vector2((a-o.min.y)/s.y,(u-o.min.z)/s.z)]}}},b=function(){g.clear()}},77:function(w,y,h){var L=d=>{var b={};return h.d(b,d),b},g=d=>()=>d;w.exports=L({del:()=>X.del,get:()=>X.get,set:()=>X.set})},949:function(w,y,h){var L=d=>{var b={};return h.d(b,d),b},g=d=>()=>d;w.exports=L({MathUtils:()=>Y.MathUtils,Points:()=>Y.Points,PointsMaterial:()=>Y.PointsMaterial})},568:function(w,y,h){h.d(y,{Z:function(){return g}});function L(d,b,m,C,p,O,A){try{var S=d[O](A),G=S.value}catch(N){m(N);return}S.done?b(G):Promise.resolve(G).then(C,p)}function g(d){return function(){var b=this,m=arguments;return new Promise(function(C,p){var O=d.apply(b,m);function A(G){L(O,C,p,A,S,"next",G)}function S(G){L(O,C,p,A,S,"throw",G)}A(void 0)})}}},924:function(w,y,h){h.d(y,{Z:function(){return L}});function L(g,d,b){return d in g?Object.defineProperty(g,d,{value:b,enumerable:!0,configurable:!0,writable:!0}):g[d]=b,g}},42:function(w,y,h){h.d(y,{Z:function(){return g}});var L=h(924);function g(d){for(var b=1;b<arguments.length;b++){var m=arguments[b]!=null?arguments[b]:{},C=Object.keys(m);typeof Object.getOwnPropertySymbols=="function"&&(C=C.concat(Object.getOwnPropertySymbols(m).filter(function(p){return Object.getOwnPropertyDescriptor(m,p).enumerable}))),C.forEach(function(p){(0,L.Z)(d,p,m[p])})}return d}}},J={};function B(w){var y=J[w];if(y!==void 0)return y.exports;var h=J[w]={exports:{}};return Q[w](h,h.exports,B),h.exports}(function(){B.n=function(w){var y=w&&w.__esModule?function(){return w.default}:function(){return w};return B.d(y,{a:y}),y}})(),function(){B.d=function(w,y){for(var h in y)B.o(y,h)&&!B.o(w,h)&&Object.defineProperty(w,h,{enumerable:!0,get:y[h]})}}(),function(){B.o=function(w,y){return Object.prototype.hasOwnProperty.call(w,y)}}();var K={};(function(){B.d(K,{Ct:function(){return d},Vw:function(){return _},hG:function(){return D},Wk:function(){return U}});var w=B(568);function y(a,u){if(!(a instanceof u))throw new TypeError("Cannot call a class as a function")}var h=B(666),L=B.n(h),g=B(584),d=function(){"use strict";function a(){y(this,a),this.cache=new Map}var u=a.prototype;return u.install=function(){},u.init=function(r){var c=(0,g.Mf)();this.cache.set(r,c)},u.get=function(r,c){var o=this;return(0,w.Z)(L().mark(function s(){var v,E;return L().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!(!o.cache.get(r)&&c)){t.next=6;break}return o.init(r),t.next=4,c();case 4:v=t.sent,o.set(r,v);case 6:if(!o.cache.get(r)){t.next=11;break}return t.next=9,o.cache.get(r).promise;case 9:return E=t.sent,t.abrupt("return",E);case 11:case"end":return t.stop()}},s)}))()},u.set=function(r,c){var o=this.cache.get(r);o?o.resolve(c):console.warn("init cache first")},u.dispose=function(){this.cache.forEach(function(r,c){r.reject("stop set cache:".concat(c))}),this.cache.clear()},a}();function b(a,u){for(var i=0;i<u.length;i++){var r=u[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(a,r.key,r)}}function m(a,u,i){return u&&b(a.prototype,u),i&&b(a,i),a}function C(a){if(Array.isArray(a))return a}function p(a){if(typeof Symbol!="undefined"&&a[Symbol.iterator]!=null||a["@@iterator"]!=null)return Array.from(a)}function O(){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 A(a,u){(u==null||u>a.length)&&(u=a.length);for(var i=0,r=new Array(u);i<u;i++)r[i]=a[i];return r}function S(a,u){if(!!a){if(typeof a=="string")return A(a,u);var i=Object.prototype.toString.call(a).slice(8,-1);if(i==="Object"&&a.constructor&&(i=a.constructor.name),i==="Map"||i==="Set")return Array.from(i);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return A(a,u)}}function G(a,u){return C(a)||p(a,u)||S(a,u)||O()}function N(a){if(Array.isArray(a))return A(a)}function W(){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 I(a){return N(a)||p(a)||S(a)||W()}var j=B(949),D=function(){"use strict";function a(i){y(this,a),this.onTopBase=new Map,this.objectNamesToFactories=new Map,this.objects=new Map,this.objects_=i}var u=a.prototype;return u.install=function(r){this.pencil=r,this.initObjectFactories()},u.initObjectFactories=function(){var r=this,c=this.objects_;Object.keys(c).forEach(function(o){var s=function(){function v(){y(this,v)}var E=v.prototype;return E.create=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new c[o](t)},v}();r.objectNamesToFactories.set(o,s)})},u.getObject=function(r,c){r.includes("#")&&console.warn("getObject:err:\u4E0D\u652F\u6301 #",r);var o=(c||{}).key,s="".concat(r).concat(o?"#".concat(o):""),v=this.objects.get(s);return v},u.getAllObject=function(r,c){r.includes("#")&&console.warn("getAllObject:err:\u4E0D\u652F\u6301 #",r);var o=(c||{}).key,s="".concat(r).concat(o?"#".concat(o):""),v=[];return this.objects.forEach(function(E,P){(P.startsWith("".concat(s,"#"))||P===s)&&v.push(E)}),v},u.draw=function(r,c,o){var s=this;return(0,w.Z)(L().mark(function v(){var E,P,t,e,n,l,f,k;return L().wrap(function(M){for(;;)switch(M.prev=M.next){case 0:if(E=s.objectNamesToFactories.get(r),!E){M.next=16;break}return P=(c||{}).key,t="".concat(r).concat(P?"#".concat(P):""),s.objects.has(t)&&(e=j.MathUtils.generateUUID(),t+="#".concat(e)),n=(c==null?void 0:c.target)||o,l=(c==null?void 0:c.onTop)||0,typeof n=="string"?f=s.objects.get(n):(n==null?void 0:n.objecttype__)==="BaseObject"?f=n:f=s.pencil.scene,k=new E().create(c),k.pencil=s.pencil,k.key=t,s.objects.set(t,k),M.next=15,s.addMesh(k,f,l);case 15:return M.abrupt("return",k);case 16:throw new Error("Unrecognized:".concat(r));case 17:case"end":return M.stop()}},v)}))()},u.addMesh=function(r,c,o){var s=this;return(0,w.Z)(L().mark(function v(){var E,P,t;return L().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,r.create();case 2:r.object3d&&(r.object3d.userData.BaseObject_=r,o&&(r.type_==="node"?r.object3d.renderOrder=o:(E=1e3+o*2,P="".concat(E-1),s.onTopBase.has(P)||(t=new j.Points(void 0,new j.PointsMaterial({transparent:!0,opacity:0})),t.renderOrder=E-1,t.onBeforeRender=function(){s.pencil.renderer.clearDepth()},t.frustumCulled=!1,s.onTopBase.set(P,!0),s.pencil.scene.add(t)),r.object3d.renderOrder=E)),c.add(r.object3d)),r.visible=!0,r.render(),r.pm.resolve();case 6:case"end":return n.stop()}},v)}))()},u.erase=function(){for(var r=arguments.length,c=new Array(r),o=0;o<r;o++)c[o]=arguments[o];var s=this;I(c).forEach(function(v){var E=[];if(typeof v=="string"){var P,t=G(v.split("#"),2),e=t[0],n=t[1];(P=E).push.apply(P,I(s.getAllObject(e,{key:n})))}else E.push(v);E.forEach(function(l){s.removeMesh(l)})})},u.removeMesh=function(r){var c=this,o=r.parent;r.object3d&&o.remove(r.object3d),r.traverse(function(s){s.visible=!1,s.dispose(),c.objects.delete(s.key)})},u.update=function(r,c){this.objects.forEach(function(o){o.update(r,c)})},u.setSize=function(r,c){this.objects.forEach(function(o){o.resize(r,c)})},u.dispose=function(){this.objects.forEach(function(r,c){r.dispose(),r.pm.reject("stop draw:".concat(c))}),this.objects.clear(),this.onTopBase.clear(),this.objectNamesToFactories.clear()},m(a,[{key:"objectsPromise",get:function(){var r=[];return this.objects.forEach(function(c){r.push(c.pm.promise)}),r}}]),a}(),_=function(){"use strict";function a(){y(this,a),this.data={}}var u=a.prototype;return u.install=function(){},u.setData=function(r,c){var o,s;this.data[r]=c,(s=(o=this).cb)===null||s===void 0||s.call(o,r)},u.runAll=function(){var r=this;Object.keys(this.data).forEach(function(c){var o,s;(s=(o=r).cb)===null||s===void 0||s.call(o,c)})},u.dispose=function(){this.data={},this.cb=void 0},a}(),T=B(924),R=B(42),z=B(77),U=function(){"use strict";function a(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};y(this,a),this.messageList=[],this.options=(0,R.Z)({},{cache:!1,cacheVersion:"1"},i)}var u=a.prototype;return u.install=function(){},u.init=function(r,c){var o=this,s=this.options,v=s.cache,E=s.cacheVersion;this.workerList=Array.from({length:c},function(P,t){var e=typeof r=="string"?new Worker(r):r();return e.onmessage=function(n){var l=n.data,f=l.res,k=l.uuid,x=o.messageList.find(function(H){var V=H.uuid;return k===V});if(x==null||x.options.cb(f),o.workerList[t].inUse=!1,o.checkMessage(),v){var M=(x==null?void 0:x.options.cacheVersion)||E;(0,z.set)(k,(0,T.Z)({},M,f))}},{worker:e,inUse:!1}})},u.postMessage=function(r,c){var o=this,s=this.options,v=s.cache,E=s.cacheVersion;if(v&&!r.workerKey){console.warn("worker cache need workerKey");return}if(v&&r.workerKey&&r.delCache){console.warn("worker cache del: ".concat(r.workerKey)),(0,z.del)(r.workerKey);return}var P=r.workerKey||j.MathUtils.generateUUID();(v?(0,z.get)(P):Promise.resolve()).then(function(t){var e=c.cacheVersion||E;t&&t[e]?c.cb(t[e]):(o.messageList.push({req:r,options:c,uuid:P,inUse:!1}),o.checkMessage())}).catch(function(){console.warn("err:worker cache"),o.messageList.push({req:r,options:c,uuid:P,inUse:!1}),o.checkMessage()})},u.checkMessage=function(){var r=this.workerList.find(function(o){var s=o.inUse;return!s});if(r){var c=this.messageList.find(function(o){var s=o.inUse;return!s});c&&(c.inUse=!0,r.inUse=!0,r.worker.postMessage({req:c.req,uuid:c.uuid}))}},u.dispose=function(){this.workerList.forEach(function(r){var c=r.worker;c.terminate()}),this.workerList=[],this.messageList=[]},a}()})();var q=K.Ct,tt=K.Vw,et=K.hG,rt=K.Wk;export{q as Cache,tt as Data,et as Draw,rt as Wk};
|