gl-draw 0.8.25 → 0.8.26

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.
@@ -1,4 +1,4 @@
1
- (function(){var nt={666:function(L){var B=function(A){"use strict";var C=Object.prototype,j=C.hasOwnProperty,G,k=typeof Symbol=="function"?Symbol:{},I=k.iterator||"@@iterator",Z=k.asyncIterator||"@@asyncIterator",D=k.toStringTag||"@@toStringTag";function _(p,l,m){return Object.defineProperty(p,l,{value:m,enumerable:!0,configurable:!0,writable:!0}),p[l]}try{_({},"")}catch(p){_=function(l,m,S){return l[m]=S}}function F(p,l,m,S){var P=l&&l.prototype instanceof c?l:c,X=Object.create(P.prototype),se=new V(S||[]);return X._invoke=fe(p,m,se),X}A.wrap=F;function H(p,l,m){try{return{type:"normal",arg:p.call(l,m)}}catch(S){return{type:"throw",arg:S}}}var $="suspendedStart",oe="suspendedYield",ve="executing",ce="completed",E={};function c(){}function O(){}function W(){}var R={};_(R,I,function(){return this});var le=Object.getPrototypeOf,te=le&&le(le(Se([])));te&&te!==C&&j.call(te,I)&&(R=te);var N=W.prototype=c.prototype=Object.create(R);O.prototype=W,_(N,"constructor",W),_(W,"constructor",O),O.displayName=_(W,D,"GeneratorFunction");function re(p){["next","throw","return"].forEach(function(l){_(p,l,function(m){return this._invoke(l,m)})})}A.isGeneratorFunction=function(p){var l=typeof p=="function"&&p.constructor;return l?l===O||(l.displayName||l.name)==="GeneratorFunction":!1},A.mark=function(p){return Object.setPrototypeOf?Object.setPrototypeOf(p,W):(p.__proto__=W,_(p,D,"GeneratorFunction")),p.prototype=Object.create(N),p},A.awrap=function(p){return{__await:p}};function ne(p,l){function m(X,se,he,de){var ae=H(p[X],p,se);if(ae.type==="throw")de(ae.arg);else{var Oe=ae.arg,Ce=Oe.value;return Ce&&typeof Ce=="object"&&j.call(Ce,"__await")?l.resolve(Ce.__await).then(function(Ae){m("next",Ae,he,de)},function(Ae){m("throw",Ae,he,de)}):l.resolve(Ce).then(function(Ae){Oe.value=Ae,he(Oe)},function(Ae){return m("throw",Ae,he,de)})}}var S;function P(X,se){function he(){return new l(function(de,ae){m(X,se,de,ae)})}return S=S?S.then(he,he):he()}this._invoke=P}re(ne.prototype),_(ne.prototype,Z,function(){return this}),A.AsyncIterator=ne,A.async=function(p,l,m,S,P){P===void 0&&(P=Promise);var X=new ne(F(p,l,m,S),P);return A.isGeneratorFunction(l)?X:X.next().then(function(se){return se.done?se.value:X.next()})};function fe(p,l,m){var S=$;return function(X,se){if(S===ve)throw new Error("Generator is already running");if(S===ce){if(X==="throw")throw se;return Te()}for(m.method=X,m.arg=se;;){var he=m.delegate;if(he){var de=me(he,m);if(de){if(de===E)continue;return de}}if(m.method==="next")m.sent=m._sent=m.arg;else if(m.method==="throw"){if(S===$)throw S=ce,m.arg;m.dispatchException(m.arg)}else m.method==="return"&&m.abrupt("return",m.arg);S=ve;var ae=H(p,l,m);if(ae.type==="normal"){if(S=m.done?ce:oe,ae.arg===E)continue;return{value:ae.arg,done:m.done}}else ae.type==="throw"&&(S=ce,m.method="throw",m.arg=ae.arg)}}}function me(p,l){var m=p.iterator[l.method];if(m===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 S=H(m,p.iterator,l.arg);if(S.type==="throw")return l.method="throw",l.arg=S.arg,l.delegate=null,E;var P=S.arg;if(!P)return l.method="throw",l.arg=new TypeError("iterator result is not an object"),l.delegate=null,E;if(P.done)l[p.resultName]=P.value,l.next=p.nextLoc,l.method!=="return"&&(l.method="next",l.arg=G);else return P;return l.delegate=null,E}re(N),_(N,D,"Generator"),_(N,I,function(){return this}),_(N,"toString",function(){return"[object Generator]"});function ie(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 V(p){this.tryEntries=[{tryLoc:"root"}],p.forEach(ie,this),this.reset(!0)}A.keys=function(p){var l=[];for(var m in p)l.push(m);return l.reverse(),function S(){for(;l.length;){var P=l.pop();if(P in p)return S.value=P,S.done=!1,S}return S.done=!0,S}};function Se(p){if(p){var l=p[I];if(l)return l.call(p);if(typeof p.next=="function")return p;if(!isNaN(p.length)){var m=-1,S=function P(){for(;++m<p.length;)if(j.call(p,m))return P.value=p[m],P.done=!1,P;return P.value=G,P.done=!0,P};return S.next=S}}return{next:Te}}A.values=Se;function Te(){return{value:G,done:!0}}return V.prototype={constructor:V,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 m(de,ae){return X.type="throw",X.arg=p,l.next=de,ae&&(l.method="next",l.arg=G),!!ae}for(var S=this.tryEntries.length-1;S>=0;--S){var P=this.tryEntries[S],X=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(p,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&&(p==="break"||p==="continue")&&P.tryLoc<=l&&l<=P.finallyLoc&&(P=null);var X=P?P.completion:{};return X.type=p,X.arg=l,P?(this.method="next",this.next=P.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 m=this.tryEntries[l];if(m.finallyLoc===p)return this.complete(m.completion,m.afterLoc),q(m),E}},catch:function(p){for(var l=this.tryEntries.length-1;l>=0;--l){var m=this.tryEntries[l];if(m.tryLoc===p){var S=m.completion;if(S.type==="throw"){var P=S.arg;q(m)}return P}}throw new Error("illegal catch attempt")},delegateYield:function(p,l,m){return this.delegate={iterator:Se(p),resultName:l,nextLoc:m},this.method==="next"&&(this.arg=G),E}},A}(L.exports);try{regeneratorRuntime=B}catch(A){typeof globalThis=="object"?globalThis.regeneratorRuntime=B:Function("r","regeneratorRuntime = r")(B)}},695:function(L,B,A){"use strict";A.d(B,{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 I,Z,D,_,F,H,$,oe,ve,ce,E,c,O;(I=k.map)===null||I===void 0||I.dispose(),(Z=k.lightMap)===null||Z===void 0||Z.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(),(oe=k.aoMap)===null||oe===void 0||oe.dispose(),(ve=k.displacementMap)===null||ve===void 0||ve.dispose(),(ce=k.emissiveMap)===null||ce===void 0||ce.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(L,B,A){"use strict";A.d(B,{disposeMesh:function(){return k.Z}});var C=A(666),j=A.n(C),G=null,k=A(695),I=A(644);function Z(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=A(568),_=A(924),F=A(360),H=A(484),$=null,oe=null,ve=function(){var E=(0,D.Z)(j().mark(function c(O,W){var R,le,te,N,re,ne,fe,me,ie;return j().wrap(function(V){for(;;)switch(V.prev=V.next){case 0:return R=W.type,le=R===void 0?"blob":R,te=W.version,N=te===void 0?"1":te,V.next=4,(0,F.get)(O);case 4:if(ne=V.sent,!(ne&&ne[N])){V.next=9;break}re=ne[N],V.next=15;break;case 9:return V.next=11,(0,H.Z)(fetch(O).then(function(Se){if(Se.ok)return Se[le]();throw new Error}));case 11:fe=V.sent,me=fe.res,ie=fe.err,ie||(re=me,(0,F.set)(O,(0,_.Z)({},N,me)));case 15:return V.abrupt("return",re?{url:le==="json"?O:URL.createObjectURL(re),store:re}:{url:O});case 16:case"end":return V.stop()}},c)}));return function(O,W){return E.apply(this,arguments)}}(),ce=A(705)},484:function(L,B,A){"use strict";A.d(B,{Z:function(){return j}});var C=A(42);function j(G){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return G.then(function(I){return(0,C.Z)({err:null,res:I},k)}).catch(function(I){return(0,C.Z)({err:I,res:void 0},k)})}},705:function(L,B,A){"use strict";A.d(B,{C:function(){return I},y:function(){return k}});var C=A(644),j=A.n(C),G=new Map,k=function(){var Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{generateTopUV:function(D,_,F,H,$){var oe=_[F*3],ve=_[F*3+1],ce=_[H*3],E=_[H*3+1],c=_[$*3],O=_[$*3+1],W;if(G.has(D))W=G.get(D);else{var R=Z.box3||new C.Box3;if(!Z.box3){var le=D.parameters.shapes.getPoints();R.setFromArray(le.map(function(fe){return[fe.x,fe.y,0]}).flat())}var te=R.getSize(new C.Vector3);Z.split&&(te.y/=Z.split),W={box:R,size:te},G.set(D,W)}var N=W.box,re=W.size,ne=Z.split?1-Z.split:0;return[new C.Vector2((oe-N.min.x)/re.x,(ve-N.min.y)/re.y+ne),new C.Vector2((ce-N.min.x)/re.x,(E-N.min.y)/re.y+ne),new C.Vector2((c-N.min.x)/re.x,(O-N.min.y)/re.y+ne)]},generateSideWallUV:function(D,_,F,H,$,oe){var ve=_[F*3],ce=_[F*3+1],E=_[F*3+2],c=_[H*3],O=_[H*3+1],W=_[H*3+2],R=_[$*3],le=_[$*3+1],te=_[$*3+2],N=_[oe*3],re=_[oe*3+1],ne=_[oe*3+2],fe;if(G.has(_))fe=G.get(_);else{var me=new C.Box3;me.setFromArray(_);var ie=me.getSize(new C.Vector3);Z.split&&(ie.z/=1-Z.split),fe={box:me,size:ie},G.set(_,fe)}var q=fe.box,V=fe.size;return Math.abs(ce-O)<Math.abs(ve-c)?[new C.Vector2((ve-q.min.x)/V.x,(E-q.min.z)/V.z),new C.Vector2((c-q.min.x)/V.x,(W-q.min.z)/V.z),new C.Vector2((R-q.min.x)/V.x,(te-q.min.z)/V.z),new C.Vector2((N-q.min.x)/V.x,(ne-q.min.z)/V.z)]:[new C.Vector2((ce-q.min.y)/V.y,(E-q.min.z)/V.z),new C.Vector2((O-q.min.y)/V.y,(W-q.min.z)/V.z),new C.Vector2((le-q.min.y)/V.y,(te-q.min.z)/V.z),new C.Vector2((re-q.min.y)/V.y,(ne-q.min.z)/V.z)]}}},I=function(){G.clear()}},360:function(L){"use strict";L.exports=require("idb-keyval")},644:function(L){"use strict";L.exports=require("three")},568:function(L,B,A){"use strict";A.d(B,{Z:function(){return j}});function C(G,k,I,Z,D,_,F){try{var H=G[_](F),$=H.value}catch(oe){I(oe);return}H.done?k($):Promise.resolve($).then(Z,D)}function j(G){return function(){var k=this,I=arguments;return new Promise(function(Z,D){var _=G.apply(k,I);function F($){C(_,Z,D,F,H,"next",$)}function H($){C(_,Z,D,F,H,"throw",$)}F(void 0)})}}},924:function(L,B,A){"use strict";A.d(B,{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(L,B,A){"use strict";A.d(B,{Z:function(){return j}});var C=A(924);function j(G){for(var k=1;k<arguments.length;k++){var I=arguments[k]!=null?arguments[k]:{},Z=Object.keys(I);typeof Object.getOwnPropertySymbols=="function"&&(Z=Z.concat(Object.getOwnPropertySymbols(I).filter(function(D){return Object.getOwnPropertyDescriptor(I,D).enumerable}))),Z.forEach(function(D){(0,C.Z)(G,D,I[D])})}return G}}},Fe={};function Y(L){var B=Fe[L];if(B!==void 0)return B.exports;var A=Fe[L]={exports:{}};return nt[L](A,A.exports,Y),A.exports}(function(){Y.n=function(L){var B=L&&L.__esModule?function(){return L.default}:function(){return L};return Y.d(B,{a:B}),B}})(),function(){Y.d=function(L,B){for(var A in B)Y.o(B,A)&&!Y.o(L,A)&&Object.defineProperty(L,A,{enumerable:!0,get:B[A]})}}(),function(){Y.o=function(L,B){return Object.prototype.hasOwnProperty.call(L,B)}}(),function(){Y.r=function(L){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(L,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(L,"__esModule",{value:!0})}}();var Be={};(function(){"use strict";Y.r(Be),Y.d(Be,{ConicPolygon:function(){return kt},ExtrudePolygon:function(){return Tt},Group:function(){return at},Image:function(){return se},Line:function(){return vt},MeshLine:function(){return _e},MeshLineMaterial:function(){return We},MeshLineRaycast:function(){return Ne},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 B(t,i){return B=Object.setPrototypeOf||function(n,a){return n.__proto__=a,n},B(t,i)}function A(t,i){return B(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=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&&A(h,o.prototype),h},k.apply(null,arguments)}function I(t,i,r){return k.apply(null,arguments)}function Z(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||!Z(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 I(n,arguments,_(this).constructor)}return a.prototype=Object.create(n.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),A(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 oe(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:oe(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 ce(this,a)}}var c=Y(644),O=Y(568),W=Y(666),R=Y.n(W);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 te(t,i,r){return i&&le(t.prototype,i),r&&le(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 re(t){if(Array.isArray(t))return N(t)}function ne(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 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 ie(t){return re(t)||ne(t)||me(t)||fe()}var q=Y(484);function V(){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)}))},m=function(){"use strict";function t(){L(this,t),this.objecttype__="BaseObject",this.userData={},this.pm=V(),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=I(c.Mesh,ie(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=I(c.Points,ie(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,ie(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,ie(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)},te(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",X=S?"PlaneBufferGeometry":"PlaneGeometry",se=function(t){"use strict";C(r,t);var i=E(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,v,d,w,y,M,b;return R().wrap(function(g){for(;;)switch(g.prev=g.next){case 0:return s=e.options,f=s.transparent,h=s.blending,v=s.depthWrite,d=s.alphaTest,w=s.sprite,y=s.sizeAttenuation,g.next=3,e.getTexture();case 3:return M=g.sent,b=w?new c.SpriteMaterial({map:M,transparent:f!=null?f:!1,blending:h!=null?h:c.NormalBlending,depthWrite:v!=null?v:!0,alphaTest:d!=null?d:0,sizeAttenuation:y!=null?y:!0}):new c.MeshBasicMaterial({map:M,transparent:f!=null?f:!1,blending:h!=null?h:c.NormalBlending,depthWrite:v!=null?v:!0,alphaTest:d!=null?d:0}),g.abrupt("return",b);case 6:case"end":return g.stop()}},o)}))()},n.create=function(){var e=this;return(0,O.Z)(R().mark(function o(){var s,f,h,v,d,w,y,M,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,d=s.cache,w=s.sprite,y=v,!(d&&!d.get(y))){g.next=8;break}return d.init(y),g.next=6,e.getMaterial();case 6:M=g.sent,d.set(y,M);case 8:if(!d){g.next=14;break}return g.next=11,d.get(y);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:b=g.t0,e.texture=b.map,w?e.createSprite(b):e.createMesh(new c[X](1,1),b),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=E(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(z){}},s||{}),h=f.fontSize,v=f.fontFamily,d=f.fontWeight,w=f.flipX,y=f.color,M=f.setCtx,b=this.canvas;b.width=h*o.length*2,b.height=h;var u=b.getContext("2d");u.font="".concat(d," ").concat(h,"px/1 ").concat(v);var g=u.measureText(o).width;b.width=g,u=b.getContext("2d"),u.clearRect(0,0,b.width,b.height),w&&u.scale(-1,1),u.font="".concat(d," ").concat(h,"px/1 ").concat(v),u.textBaseline="middle",u.fillStyle=y,M&&M(u),u.fillText(o,w?g*-1:0,b.height/2),u.restore();var T=new c.Texture(b);return T.anisotropy=this.pencil.renderer.capabilities.getMaxAnisotropy(),T.needsUpdate=!0,Promise.resolve(T)},r}(H(se));function de(t,i){for(;!Object.prototype.hasOwnProperty.call(t,i)&&(t=_(t),t!==null););return t}function ae(t,i,r){return typeof Reflect!="undefined"&&Reflect.get?ae=Reflect.get:ae=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}},ae(t,i,r)}function Oe(t,i,r){return ae(t,i,r)}var Ce=function(t){"use strict";C(r,t);var i=E(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,v=e.format,d=e.autoPlay,w=e.loop,y=e.alphaTest,M=e.sprite,b=V(),u=document.createElement("video");return u.addEventListener("loadedmetadata",function(){var g=new c.VideoTexture(u);g.format=v!=null?v:c.RGBAFormat,g.needsUpdate=!0;var T=M?new c.SpriteMaterial({map:g,transparent:s!=null?s:!1,blending:f!=null?f:c.NormalBlending,depthWrite:h!=null?h:!0,alphaTest:y!=null?y:0}):new c.MeshBasicMaterial({map:g,transparent:s!=null?s:!1,blending:f!=null?f:c.NormalBlending,depthWrite:h!=null?h:!0,alphaTest:y!=null?y:0});b.resolve(T)},!1),u.src=o,u.muted=!0,u.autoplay=d,u.loop=w,u.preload="auto",b.promise},n.create=function(){var e=this;return(0,O.Z)(R().mark(function o(){var s,f,h,v,d,w,y,M;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,d=s.cache,w=s.sprite,!(d&&!d.get(v))){u.next=7;break}return d.init(v),u.next=5,e.getMaterial();case 5:y=u.sent,d.set(v,y);case 7:if(!d){u.next=13;break}return u.next=10,d.get(v);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:M=u.t0,e.video=M.map.image,w?e.createSprite(M):e.createMesh(new c[X](1,1),M),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(_(r.prototype),"dispose",this).call(this)},r}(m),Ae=function(t){"use strict";C(r,t);var i=E(r);function r(a){L(this,r);var e;return e=i.call(this),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=e.zIndexFix,d=e.event2,w=e.handler2,y=document.createElement("div");this.element=y,y.appendChild(s),this.createCSS2DObject(y),o&&this.object3d.position.copy(o),f&&h&&this.clickTarge.forEach(function(M){M.addEventListener(h,f),w&&d&&M.addEventListener(d,w)}),v&&(this.object3d.userData.zIndexFix=v)},n.getMaterial=function(e){return(0,O.Z)(R().mark(function o(){var s,f,h,v;return R().wrap(function(w){for(;;)switch(w.prev=w.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}),w.abrupt("return",v);case 9:case"end":return w.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,d=v===void 0?new c.Vector3(0,0,0):v,w=e.cache,y=this;return(0,O.Z)(R().mark(function M(){var b,u,g,T;return R().wrap(function(x){for(;;)switch(x.prev=x.next){case 0:if(b="node-create-pick-object",!(w&&!w.get(b))){x.next=7;break}return w.init(b),x.next=5,y.getMaterial(s);case 5:u=x.sent,w.set(b,u);case 7:if(!w){x.next=13;break}return x.next=10,w.get(b);case 10:x.t0=x.sent,x.next=16;break;case 13:return x.next=15,y.getMaterial(s);case 15:x.t0=x.sent;case 16:g=x.t0,T=new c.Sprite(g),T.scale.set(g.map.image.width*h.x,g.map.image.height*h.y,1),T.position.copy(d),y.add(T),y.pickObject=T;case 22:case"end":return x.stop()}},M)}))()},n.dispose=function(){var e=this.options,o=e.handler,s=e.event,f=e.handler2,h=e.event2;o&&s&&this.clickTarge.forEach(function(v){v.removeEventListener(s,o),f&&h&&v.removeEventListener(h,f)}),Oe(_(r.prototype),"dispose",this).call(this)},te(r,[{key:"clickTarge",get:function(){var e=this,o=this.options.eventTarge;if(o){var s=o.map(function(f){return ie(e.element.querySelectorAll(f))}).flat();return s}return[this.element]}}]),r}(m),it=Ae,at=function(t){"use strict";C(r,t);var i=E(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 nt={666:function(L){var B=function(x){"use strict";var C=Object.prototype,j=C.hasOwnProperty,G,k=typeof Symbol=="function"?Symbol:{},I=k.iterator||"@@iterator",Z=k.asyncIterator||"@@asyncIterator",D=k.toStringTag||"@@toStringTag";function _(p,l,m){return Object.defineProperty(p,l,{value:m,enumerable:!0,configurable:!0,writable:!0}),p[l]}try{_({},"")}catch(p){_=function(l,m,S){return l[m]=S}}function F(p,l,m,S){var P=l&&l.prototype instanceof c?l:c,X=Object.create(P.prototype),se=new V(S||[]);return X._invoke=fe(p,m,se),X}x.wrap=F;function H(p,l,m){try{return{type:"normal",arg:p.call(l,m)}}catch(S){return{type:"throw",arg:S}}}var $="suspendedStart",oe="suspendedYield",ve="executing",ce="completed",E={};function c(){}function O(){}function W(){}var R={};_(R,I,function(){return this});var le=Object.getPrototypeOf,te=le&&le(le(Se([])));te&&te!==C&&j.call(te,I)&&(R=te);var N=W.prototype=c.prototype=Object.create(R);O.prototype=W,_(N,"constructor",W),_(W,"constructor",O),O.displayName=_(W,D,"GeneratorFunction");function re(p){["next","throw","return"].forEach(function(l){_(p,l,function(m){return this._invoke(l,m)})})}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 ne(p,l){function m(X,se,he,de){var ae=H(p[X],p,se);if(ae.type==="throw")de(ae.arg);else{var Oe=ae.arg,Ce=Oe.value;return Ce&&typeof Ce=="object"&&j.call(Ce,"__await")?l.resolve(Ce.__await).then(function(Ae){m("next",Ae,he,de)},function(Ae){m("throw",Ae,he,de)}):l.resolve(Ce).then(function(Ae){Oe.value=Ae,he(Oe)},function(Ae){return m("throw",Ae,he,de)})}}var S;function P(X,se){function he(){return new l(function(de,ae){m(X,se,de,ae)})}return S=S?S.then(he,he):he()}this._invoke=P}re(ne.prototype),_(ne.prototype,Z,function(){return this}),x.AsyncIterator=ne,x.async=function(p,l,m,S,P){P===void 0&&(P=Promise);var X=new ne(F(p,l,m,S),P);return x.isGeneratorFunction(l)?X:X.next().then(function(se){return se.done?se.value:X.next()})};function fe(p,l,m){var S=$;return function(X,se){if(S===ve)throw new Error("Generator is already running");if(S===ce){if(X==="throw")throw se;return Te()}for(m.method=X,m.arg=se;;){var he=m.delegate;if(he){var de=me(he,m);if(de){if(de===E)continue;return de}}if(m.method==="next")m.sent=m._sent=m.arg;else if(m.method==="throw"){if(S===$)throw S=ce,m.arg;m.dispatchException(m.arg)}else m.method==="return"&&m.abrupt("return",m.arg);S=ve;var ae=H(p,l,m);if(ae.type==="normal"){if(S=m.done?ce:oe,ae.arg===E)continue;return{value:ae.arg,done:m.done}}else ae.type==="throw"&&(S=ce,m.method="throw",m.arg=ae.arg)}}}function me(p,l){var m=p.iterator[l.method];if(m===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 S=H(m,p.iterator,l.arg);if(S.type==="throw")return l.method="throw",l.arg=S.arg,l.delegate=null,E;var P=S.arg;if(!P)return l.method="throw",l.arg=new TypeError("iterator result is not an object"),l.delegate=null,E;if(P.done)l[p.resultName]=P.value,l.next=p.nextLoc,l.method!=="return"&&(l.method="next",l.arg=G);else return P;return l.delegate=null,E}re(N),_(N,D,"Generator"),_(N,I,function(){return this}),_(N,"toString",function(){return"[object Generator]"});function ie(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 V(p){this.tryEntries=[{tryLoc:"root"}],p.forEach(ie,this),this.reset(!0)}x.keys=function(p){var l=[];for(var m in p)l.push(m);return l.reverse(),function S(){for(;l.length;){var P=l.pop();if(P in p)return S.value=P,S.done=!1,S}return S.done=!0,S}};function Se(p){if(p){var l=p[I];if(l)return l.call(p);if(typeof p.next=="function")return p;if(!isNaN(p.length)){var m=-1,S=function P(){for(;++m<p.length;)if(j.call(p,m))return P.value=p[m],P.done=!1,P;return P.value=G,P.done=!0,P};return S.next=S}}return{next:Te}}x.values=Se;function Te(){return{value:G,done:!0}}return V.prototype={constructor:V,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 m(de,ae){return X.type="throw",X.arg=p,l.next=de,ae&&(l.method="next",l.arg=G),!!ae}for(var S=this.tryEntries.length-1;S>=0;--S){var P=this.tryEntries[S],X=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(p,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&&(p==="break"||p==="continue")&&P.tryLoc<=l&&l<=P.finallyLoc&&(P=null);var X=P?P.completion:{};return X.type=p,X.arg=l,P?(this.method="next",this.next=P.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 m=this.tryEntries[l];if(m.finallyLoc===p)return this.complete(m.completion,m.afterLoc),q(m),E}},catch:function(p){for(var l=this.tryEntries.length-1;l>=0;--l){var m=this.tryEntries[l];if(m.tryLoc===p){var S=m.completion;if(S.type==="throw"){var P=S.arg;q(m)}return P}}throw new Error("illegal catch attempt")},delegateYield:function(p,l,m){return this.delegate={iterator:Se(p),resultName:l,nextLoc:m},this.method==="next"&&(this.arg=G),E}},x}(L.exports);try{regeneratorRuntime=B}catch(x){typeof globalThis=="object"?globalThis.regeneratorRuntime=B:Function("r","regeneratorRuntime = r")(B)}},695:function(L,B,x){"use strict";x.d(B,{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 I,Z,D,_,F,H,$,oe,ve,ce,E,c,O;(I=k.map)===null||I===void 0||I.dispose(),(Z=k.lightMap)===null||Z===void 0||Z.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(),(oe=k.aoMap)===null||oe===void 0||oe.dispose(),(ve=k.displacementMap)===null||ve===void 0||ve.dispose(),(ce=k.emissiveMap)===null||ce===void 0||ce.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(L,B,x){"use strict";x.d(B,{disposeMesh:function(){return k.Z}});var C=x(666),j=x.n(C),G=null,k=x(695),I=x(644);function Z(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,oe=null,ve=function(){var E=(0,D.Z)(j().mark(function c(O,W){var R,le,te,N,re,ne,fe,me,ie;return j().wrap(function(V){for(;;)switch(V.prev=V.next){case 0:return R=W.type,le=R===void 0?"blob":R,te=W.version,N=te===void 0?"1":te,V.next=4,(0,F.get)(O);case 4:if(ne=V.sent,!(ne&&ne[N])){V.next=9;break}re=ne[N],V.next=15;break;case 9:return V.next=11,(0,H.Z)(fetch(O).then(function(Se){if(Se.ok)return Se[le]();throw new Error}));case 11:fe=V.sent,me=fe.res,ie=fe.err,ie||(re=me,(0,F.set)(O,(0,_.Z)({},N,me)));case 15:return V.abrupt("return",re?{url:le==="json"?O:URL.createObjectURL(re),store:re}:{url:O});case 16:case"end":return V.stop()}},c)}));return function(O,W){return E.apply(this,arguments)}}(),ce=x(705)},484:function(L,B,x){"use strict";x.d(B,{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(I){return(0,C.Z)({err:null,res:I},k)}).catch(function(I){return(0,C.Z)({err:I,res:void 0},k)})}},705:function(L,B,x){"use strict";x.d(B,{C:function(){return I},y:function(){return k}});var C=x(644),j=x.n(C),G=new Map,k=function(){var Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{generateTopUV:function(D,_,F,H,$){var oe=_[F*3],ve=_[F*3+1],ce=_[H*3],E=_[H*3+1],c=_[$*3],O=_[$*3+1],W;if(G.has(D))W=G.get(D);else{var R=Z.box3||new C.Box3;if(!Z.box3){var le=D.parameters.shapes.getPoints();R.setFromArray(le.map(function(fe){return[fe.x,fe.y,0]}).flat())}var te=R.getSize(new C.Vector3);Z.split&&(te.y/=Z.split),W={box:R,size:te},G.set(D,W)}var N=W.box,re=W.size,ne=Z.split?1-Z.split:0;return[new C.Vector2((oe-N.min.x)/re.x,(ve-N.min.y)/re.y+ne),new C.Vector2((ce-N.min.x)/re.x,(E-N.min.y)/re.y+ne),new C.Vector2((c-N.min.x)/re.x,(O-N.min.y)/re.y+ne)]},generateSideWallUV:function(D,_,F,H,$,oe){var ve=_[F*3],ce=_[F*3+1],E=_[F*3+2],c=_[H*3],O=_[H*3+1],W=_[H*3+2],R=_[$*3],le=_[$*3+1],te=_[$*3+2],N=_[oe*3],re=_[oe*3+1],ne=_[oe*3+2],fe;if(G.has(_))fe=G.get(_);else{var me=new C.Box3;me.setFromArray(_);var ie=me.getSize(new C.Vector3);Z.split&&(ie.z/=1-Z.split),fe={box:me,size:ie},G.set(_,fe)}var q=fe.box,V=fe.size;return Math.abs(ce-O)<Math.abs(ve-c)?[new C.Vector2((ve-q.min.x)/V.x,(E-q.min.z)/V.z),new C.Vector2((c-q.min.x)/V.x,(W-q.min.z)/V.z),new C.Vector2((R-q.min.x)/V.x,(te-q.min.z)/V.z),new C.Vector2((N-q.min.x)/V.x,(ne-q.min.z)/V.z)]:[new C.Vector2((ce-q.min.y)/V.y,(E-q.min.z)/V.z),new C.Vector2((O-q.min.y)/V.y,(W-q.min.z)/V.z),new C.Vector2((le-q.min.y)/V.y,(te-q.min.z)/V.z),new C.Vector2((re-q.min.y)/V.y,(ne-q.min.z)/V.z)]}}},I=function(){G.clear()}},360:function(L){"use strict";L.exports=require("idb-keyval")},644:function(L){"use strict";L.exports=require("three")},568:function(L,B,x){"use strict";x.d(B,{Z:function(){return j}});function C(G,k,I,Z,D,_,F){try{var H=G[_](F),$=H.value}catch(oe){I(oe);return}H.done?k($):Promise.resolve($).then(Z,D)}function j(G){return function(){var k=this,I=arguments;return new Promise(function(Z,D){var _=G.apply(k,I);function F($){C(_,Z,D,F,H,"next",$)}function H($){C(_,Z,D,F,H,"throw",$)}F(void 0)})}}},924:function(L,B,x){"use strict";x.d(B,{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(L,B,x){"use strict";x.d(B,{Z:function(){return j}});var C=x(924);function j(G){for(var k=1;k<arguments.length;k++){var I=arguments[k]!=null?arguments[k]:{},Z=Object.keys(I);typeof Object.getOwnPropertySymbols=="function"&&(Z=Z.concat(Object.getOwnPropertySymbols(I).filter(function(D){return Object.getOwnPropertyDescriptor(I,D).enumerable}))),Z.forEach(function(D){(0,C.Z)(G,D,I[D])})}return G}}},Fe={};function Y(L){var B=Fe[L];if(B!==void 0)return B.exports;var x=Fe[L]={exports:{}};return nt[L](x,x.exports,Y),x.exports}(function(){Y.n=function(L){var B=L&&L.__esModule?function(){return L.default}:function(){return L};return Y.d(B,{a:B}),B}})(),function(){Y.d=function(L,B){for(var x in B)Y.o(B,x)&&!Y.o(L,x)&&Object.defineProperty(L,x,{enumerable:!0,get:B[x]})}}(),function(){Y.o=function(L,B){return Object.prototype.hasOwnProperty.call(L,B)}}(),function(){Y.r=function(L){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(L,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(L,"__esModule",{value:!0})}}();var Be={};(function(){"use strict";Y.r(Be),Y.d(Be,{ConicPolygon:function(){return kt},ExtrudePolygon:function(){return Tt},Group:function(){return at},Image:function(){return se},Line:function(){return vt},MeshLine:function(){return _e},MeshLineMaterial:function(){return We},MeshLineRaycast:function(){return Ne},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 B(t,i){return B=Object.setPrototypeOf||function(n,a){return n.__proto__=a,n},B(t,i)}function x(t,i){return B(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 I(t,i,r){return k.apply(null,arguments)}function Z(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||!Z(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 I(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 oe(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:oe(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 ce(this,a)}}var c=Y(644),O=Y(568),W=Y(666),R=Y.n(W);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 te(t,i,r){return i&&le(t.prototype,i),r&&le(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 re(t){if(Array.isArray(t))return N(t)}function ne(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 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 ie(t){return re(t)||ne(t)||me(t)||fe()}var q=Y(484);function V(){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)}))},m=function(){"use strict";function t(){L(this,t),this.objecttype__="BaseObject",this.userData={},this.pm=V(),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=I(c.Mesh,ie(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=I(c.Points,ie(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,ie(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,ie(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)},te(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",X=S?"PlaneBufferGeometry":"PlaneGeometry",se=function(t){"use strict";C(r,t);var i=E(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,v,d,w,y,A,b;return R().wrap(function(g){for(;;)switch(g.prev=g.next){case 0:return s=e.options,f=s.transparent,h=s.blending,v=s.depthWrite,d=s.alphaTest,w=s.sprite,y=s.sizeAttenuation,g.next=3,e.getTexture();case 3:return A=g.sent,b=w?new c.SpriteMaterial({map:A,transparent:f!=null?f:!1,blending:h!=null?h:c.NormalBlending,depthWrite:v!=null?v:!0,alphaTest:d!=null?d:0,sizeAttenuation:y!=null?y:!0}):new c.MeshBasicMaterial({map:A,transparent:f!=null?f:!1,blending:h!=null?h:c.NormalBlending,depthWrite:v!=null?v:!0,alphaTest:d!=null?d:0}),g.abrupt("return",b);case 6:case"end":return g.stop()}},o)}))()},n.create=function(){var e=this;return(0,O.Z)(R().mark(function o(){var s,f,h,v,d,w,y,A,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,d=s.cache,w=s.sprite,y=v,!(d&&!d.get(y))){g.next=8;break}return d.init(y),g.next=6,e.getMaterial();case 6:A=g.sent,d.set(y,A);case 8:if(!d){g.next=14;break}return g.next=11,d.get(y);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:b=g.t0,e.texture=b.map,w?e.createSprite(b):e.createMesh(new c[X](1,1),b),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=E(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(z){}},s||{}),h=f.fontSize,v=f.fontFamily,d=f.fontWeight,w=f.flipX,y=f.color,A=f.setCtx,b=this.canvas;b.width=h*o.length*2,b.height=h;var u=b.getContext("2d");u.font="".concat(d," ").concat(h,"px/1 ").concat(v);var g=u.measureText(o).width;b.width=g,u=b.getContext("2d"),u.clearRect(0,0,b.width,b.height),w&&u.scale(-1,1),u.font="".concat(d," ").concat(h,"px/1 ").concat(v),u.textBaseline="middle",u.fillStyle=y,A&&A(u),u.fillText(o,w?g*-1:0,b.height/2),u.restore();var T=new c.Texture(b);return T.anisotropy=this.pencil.renderer.capabilities.getMaxAnisotropy(),T.needsUpdate=!0,Promise.resolve(T)},r}(H(se));function de(t,i){for(;!Object.prototype.hasOwnProperty.call(t,i)&&(t=_(t),t!==null););return t}function ae(t,i,r){return typeof Reflect!="undefined"&&Reflect.get?ae=Reflect.get:ae=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}},ae(t,i,r)}function Oe(t,i,r){return ae(t,i,r)}var Ce=function(t){"use strict";C(r,t);var i=E(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,v=e.format,d=e.autoPlay,w=e.loop,y=e.alphaTest,A=e.sprite,b=V(),u=document.createElement("video");return u.addEventListener("loadedmetadata",function(){var g=new c.VideoTexture(u);g.format=v!=null?v:c.RGBAFormat,g.needsUpdate=!0;var T=A?new c.SpriteMaterial({map:g,transparent:s!=null?s:!1,blending:f!=null?f:c.NormalBlending,depthWrite:h!=null?h:!0,alphaTest:y!=null?y:0}):new c.MeshBasicMaterial({map:g,transparent:s!=null?s:!1,blending:f!=null?f:c.NormalBlending,depthWrite:h!=null?h:!0,alphaTest:y!=null?y:0});b.resolve(T)},!1),u.src=o,u.muted=!0,u.autoplay=d,u.loop=w,u.preload="auto",b.promise},n.create=function(){var e=this;return(0,O.Z)(R().mark(function o(){var s,f,h,v,d,w,y,A;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,d=s.cache,w=s.sprite,!(d&&!d.get(v))){u.next=7;break}return d.init(v),u.next=5,e.getMaterial();case 5:y=u.sent,d.set(v,y);case 7:if(!d){u.next=13;break}return u.next=10,d.get(v);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:A=u.t0,e.video=A.map.image,w?e.createSprite(A):e.createMesh(new c[X](1,1),A),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(_(r.prototype),"dispose",this).call(this)},r}(m),Ae=function(t){"use strict";C(r,t);var i=E(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,v=e.event2,d=e.handler2,w=document.createElement("div");this.element=w,w.appendChild(s),this.createCSS2DObject(w),o&&this.object3d.position.copy(o),f&&h&&this.clickTarge.forEach(function(y){y.addEventListener(h,f),d&&v&&y.addEventListener(v,d)})},n.getMaterial=function(e){return(0,O.Z)(R().mark(function o(){var s,f,h,v;return R().wrap(function(w){for(;;)switch(w.prev=w.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}),w.abrupt("return",v);case 9:case"end":return w.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,d=v===void 0?new c.Vector3(0,0,0):v,w=e.cache,y=this;return(0,O.Z)(R().mark(function A(){var b,u,g,T;return R().wrap(function(M){for(;;)switch(M.prev=M.next){case 0:if(b="node-create-pick-object",!(w&&!w.get(b))){M.next=7;break}return w.init(b),M.next=5,y.getMaterial(s);case 5:u=M.sent,w.set(b,u);case 7:if(!w){M.next=13;break}return M.next=10,w.get(b);case 10:M.t0=M.sent,M.next=16;break;case 13:return M.next=15,y.getMaterial(s);case 15:M.t0=M.sent;case 16:g=M.t0,T=new c.Sprite(g),T.scale.set(g.map.image.width*h.x,g.map.image.height*h.y,1),T.position.copy(d),y.add(T),y.pickObject=T;case 22:case"end":return M.stop()}},A)}))()},n.dispose=function(){var e=this.options,o=e.handler,s=e.event,f=e.handler2,h=e.event2;o&&s&&this.clickTarge.forEach(function(v){v.removeEventListener(s,o),f&&h&&v.removeEventListener(h,f)}),Oe(_(r.prototype),"dispose",this).call(this)},te(r,[{key:"clickTarge",get:function(){var e=this,o=this.options.eventTarge;if(o){var s=o.map(function(f){return ie(e.element.querySelectorAll(f))}).flat();return s}return[this.element]}}]),r}(m),it=Ae,at=function(t){"use strict";C(r,t);var i=E(r);function r(){return L(this,r),i.apply(this,arguments)}var n=r.prototype;return n.create=function(){this.createGroup()},r}(m),ot=`
2
2
  `.concat(c.ShaderChunk.logdepthbuf_pars_vertex,`
3
3
  `).concat(c.ShaderChunk.fog_pars_vertex,`
4
4
  attribute vec3 previous;
@@ -129,4 +129,4 @@ void main() {
129
129
  gl_FragColor.a *= step(vCounters, visibility);
130
130
  `).concat(c.ShaderChunk.fog_fragment,`
131
131
  }
132
- `),_e=function(t){"use strict";C(r,t);var i=E(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(oe(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);_e.prototype.setMatrixWorld=function(t){this.matrixWorld=t},_e.prototype.setGeometry=function(t,i){this._geometry=t,this.setPoints(t.getAttribute("position").array,i)},_e.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,d=o.index,w=o.attributes;if(d!==null)for(var y=d.array,M=w.position.array,b=w.width.array,u=0,g=y.length-1;u<g;u+=v){var T=y[u],z=y[u+1];s.fromArray(M,T*3),f.fromArray(M,z*3);var x=b[Math.floor(u/3)]!==void 0?b[Math.floor(u/3)]:1,Q=t.params.Line.threshold+this.material.lineWidth*x/2,K=Q*Q,J=n.distanceSqToSegment(s,f,e,h);if(!(J>K)){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)}}}}_e.prototype.raycast=Ne,_e.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]},_e.prototype.copyV3=function(t){var i=t*6;return[this.positions[i],this.positions[i+1],this.positions[i+2]]},_e.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}_e.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=ot,c.ShaderChunk.meshline_frag=st;var We=function(t){"use strict";C(r,t);var i=E(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(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(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 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 ye(t,i){return ft(t)||ne(t,i)||me(t,i)||ht()}var Ke=require("popmotion"),Le=require("three/examples/jsm//utils/BufferGeometryUtils");function $e(t){var i=t.setPointWidth,r=t.nodes,n=new c.BufferGeometry,a=new _e;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=E(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,v,d,w,y,M,b,u,g,T,z,x,Q,K,J,ue,ge,pe;return R().wrap(function(ee){for(;;)switch(ee.prev=ee.next){case 0:if(s=e.options,f=s.duration,h=s.delay,v=s.onComplete,d=s.setPointWidth,w=s.key,y=s.nodes,M=s.nodesArr,b=s.geometry,u=s.geometryArr,g=s.useGroups,T=s.material,z=s.cache,x=s.cacheKey,Q=lt(s,["duration","delay","onComplete","setPointWidth","key","nodes","nodesArr","geometry","geometryArr","useGroups","material","cache","cacheKey"]),K=T,J=b,K){ee.next=16;break}if(ue="LineMaterial:".concat(x),z&&!z.get(ue)&&(z.init(ue),ge=e.getMaterial((0,j.Z)({},Q)),z.set(ue,ge)),!z){ee.next=12;break}return ee.next=9,z.get(ue);case 9:ee.t0=ee.sent,ee.next=15;break;case 12:return ee.next=14,e.getMaterial(Q);case 14:ee.t0=ee.sent;case 15:K=ee.t0;case 16:!J&&y?J=$e({nodes:y,setPointWidth:d}):!J&&M?J=Le.mergeBufferGeometries(M.map(function(je){return $e({nodes:je,setPointWidth:d})}),g!=null?g:!1):!J&&u&&u.length>1?J=Le.mergeBufferGeometries(u,g!=null?g:!1):!J&&u&&u.length===1&&(pe=ye(u,1),J=pe[0]),e.createMesh(J,K);case 18:case"end":return ee.stop()}},o)}))()},n.getMaterial=function(e){var o=this.pencil.getSize(),s=o.width,f=o.height,h=new We(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(ie(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,d=(0,Ke.animate)({from:h.value,to:{x:0},duration:o!=null?o:1e3,elapsed:-v,repeat:1/0,onComplete:f,ease:Ke.linear,onUpdate:function(w){h.value.x=w.x}});this.tween=d},n.dispose=function(){var e;Oe(_(r.prototype),"dispose",this).call(this),(e=this.tween)===null||e===void 0||e.stop()},te(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 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){i.postMessage({delCache:!0,workerKey:r},{cb:f,cacheVersion:o})}},cacheVersion:o})})}var ke=require("d3-array"),mt=require("earcut"),De=Y.n(mt),gt=require("@turf/boolean-clockwise"),yt=Y.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=Y.n(wt),Mt=require("@turf/boolean-point-in-polygon"),xt=Y.n(Mt),Ee=require("d3-geo"),At=require("d3-geo-voronoi"),qe=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},v=function(u){return o*(Math.cos((u+90)*Math.PI/180)+1)/2},d=[e!==void 0?Math.ceil(v(e)):0,a!==void 0?Math.floor(v(a)):o-1],w=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},y=[],M=d[0];M<=d[1];M++){var b=f(M);w(b)&&y.push([b,h(M)])}return y}function Ue(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=ye((0,Ee.geoBounds)(r),2),a=ye(n[0],2),e=a[0],o=a[1],s=ye(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 St(i,{minLng:e,maxLng:f,minLat:o,maxLat:h}).filter(function(d){return Ue(d,r,v)})}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=ie(e).concat(ie(o)),f={type:"Polygon",coordinates:t},h=ye((0,Ee.geoBounds)(f),2),v=ye(h[0],2),d=v[0],w=v[1],y=ye(h[1],2),M=y[0],b=y[1],u=d>M||b>=89||w<=-89,g=[];if(u){var T=(0,At.geoVoronoi)(s).triangles(),z=new Map(s.map(function(U,Me){var be=ye(U,2),we=be[0],Ge=be[1];return["".concat(we,"-").concat(Ge),Me]}));T.features.forEach(function(U){var Me,be=U.geometry.coordinates[0].slice(0,3).reverse(),we=[];if(be.forEach(function(ze){var xe=ye(ze,2),Ze=xe[0],Rt=xe[1],rt="".concat(Ze,"-").concat(Rt);z.has(rt)&&we.push(z.get(rt))}),we.length===3){if(we.some(function(ze){return ze<e.length})){var Ge=U.properties.circumcenter;if(!Ue(Ge,f,u))return}(Me=g).push.apply(Me,ie(we))}})}else if(o.length)for(var ue=function(U,Me){var be,we=[2,1,0].map(function(xe){return ge.triangles[U+xe]}),Ge=we.map(function(xe){return s[xe]});if(we.some(function(xe){return xe<e.length})){var ze=[0,1].map(function(xe){return(0,ke.mean)(Ge,function(Ze){return Ze[xe]})});if(!Ue(ze,f,u))return"continue"}(be=g).push.apply(be,ie(we))},ge=_t().from(s),pe=0,Pe=ge.triangles.length;pe<Pe;pe+=3)ue(pe,Pe);else{var x=De().flatten(a),Q=x.vertices,K=x.holes,J=K===void 0?[]:K;g=De()(Q,J,2)}var ee=(0,qe.scaleLinear)((0,ke.extent)(s,function(U){return U[0]}),[0,1]),je=(0,qe.scaleLinear)((0,ke.extent)(s,function(U){return U[1]}),[0,1]),Re=s.map(function(U){var Me=ye(U,2),be=Me[0],we=Me[1];return[ee(be),je(we)]}),tt={points:s,indices:g,uvs:Re};return{contour:a,triangles:tt}}var jt=Ct,Xe=new c.BufferGeometry().setAttribute?"setAttribute":"addAttribute";function Ie(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=ye(e,2),s=o[0],f=o[1];return r?bt(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=Ie(t,i,n),e=a.vertices,o=a.holes,s=Ie(t,r,n),f=s.vertices,h=(0,ke.merge)([f,e]),v=Math.round(f.length/3),d=new Set(o),w=0,y=[],M=0;M<v;M++){var b=M+1;if(b===v)b=w;else if(d.has(b)){var u=b;b=w,w=u}y.push(M,M+v,b+v),y.push(b+v,b,M)}for(var g=[],T=1;T>=0;T--)for(var z=0;z<v;z+=1)g.push(z/(v-1),T);return{indices:y,vertices:h,uvs:g,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:Ie([t.points],i,a).vertices,uvs:r}}var Lt=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]:{};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,v=o.closedTop,d=o.includeSides,w=o.curvatureResolution,y=o.cartesian,M=o.userDataRsoOffset;yt()(n[0])||n[0].reverse();var b=jt(n,{resolution:w}),u=b.contour,g=b.triangles,T=(0,ke.merge)(g.uvs),z=[],x=[],Q=[],K=0,J=function(ge){var pe=Math.round(z.length/3),Pe=Q.length;z=z.concat(ge.vertices),x=x.concat(ge.uvs),Q=Q.concat(pe?ge.indices.map(function(ee){return ee+pe}):ge.indices),e.addGroup(Pe,Q.length-Pe,K++)};if(d){var ue=Ye(u,s,f,y);J(ue),e.userData.rso=M?Ye(u,s,f+M,y):ue}return h&&J(Qe(g,s,T,!1,y)),v&&J(Qe(g,f,T,!0,y)),e.setIndex(Q),e[Xe]("position",new c.Float32BufferAttribute(z,3)),e[Xe]("uv",new c.Float32BufferAttribute(x,2)),e.computeVertexNormals(),e}return r}(c.BufferGeometry),kt=function(t){"use strict";C(r,t);var i=E(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,v=e.curvatureResolution,d=e.userDataRsoOffset,w=e.cartesian,y=new Lt(this.options.geojson,{startHeight:o,endHeight:o+s,closedBottom:f,closedTop:h,curvatureResolution:v,cartesian:w,userDataRsoOffset:d});this.createMesh(y,this.options.material)},r}(m),Je=Y(705);function et(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,Je.y)({split:i,box3:a})});return(0,Je.C)(),e}var Tt=function(t){"use strict";C(r,t);var i=E(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,v,d,w,y,M,b,u,g,T,z,x,Q,K,J,ue,ge,pe,Pe,ee,je,Re;return R().wrap(function(U){for(;;)switch(U.prev=U.next){case 0:if(s=e.options,f=s.points,h=s.pointsArr,v=s.useGroups,d=s.depth,w=s.geometry,y=s.geometryArr,M=s.material,b=s.materialOptions,u=s.cache,g=s.box3,T=0,z=Array.isArray(d)?d:[d],x=Array.isArray(g)?g:[g],Q=M,K=w,!(!Q&&b)){U.next=26;break}if(T=b.split,J=b.topColor,ue=b.sideColor,ge=b.sideMap,pe="ExtrudePolygonMaterial:".concat(ue||ge).concat(J||""),!(u&&!u.get(pe))){U.next=16;break}return u.init(pe),U.next=14,e.getMaterial(b);case 14:Pe=U.sent,u.set(pe,Pe);case 16:if(!u){U.next=22;break}return U.next=19,u.get(pe);case 19:U.t0=U.sent,U.next=25;break;case 22:return U.next=24,e.getMaterial(b);case 24:U.t0=U.sent;case 25:Q=U.t0;case 26:!K&&f?K=et({points:f,depth:z[0],split:T,box3:x[0]}):!K&&h?K=Le.mergeBufferGeometries(h.map(function(Me,be){return et({points:Me,depth:(ee=z[be])!==null&&ee!==void 0?ee:z[0],split:T,box3:(je=x[be])!==null&&je!==void 0?je:x[0]})}),v!=null?v:!1):!K&&y&&y.length>1?K=Le.mergeBufferGeometries(y,v!=null?v:!1):!K&&y&&y.length===1&&(Re=ye(y,1),K=Re[0]),e.createMesh(K,Q);case 28:case"end":return U.stop()}},o)}))()},n.addGeometries=function(e){var o=this.object3d,s=Le.mergeBufferGeometries([o.geometry].concat(ie(e)),!1);o.geometry=s},n.getMaterial=function(e){var o=this,s=e.topColor,f=e.sideColor,h=e.sideMap,v=e.type,d=e.parameters,w=e.createCanvasObjectURL,y=e.split,M=e.maxAnisotropy;return new Promise(function(b){var u=h?document.createElement("img"):{src:"",onload:function(){},width:1024,height:1024};u.onload=function(){var g=y,T=document.createElement("canvas"),z=T.getContext("2d");T.height=u.height/(1-g),T.width=u.width,g&&s&&(z.fillStyle=s,z.fillRect(0,0,u.width,T.height*g)),h&&u instanceof HTMLImageElement?z.drawImage(u,0,T.height*g,u.width,u.height):f&&(z.fillStyle=f,z.fillRect(0,T.height*g,u.width,u.height)),w&&T.toBlob(function(K){console.log(URL.createObjectURL(K))});var x=new c.CanvasTexture(T);x.anisotropy=M||o.pencil.renderer.capabilities.getMaxAnisotropy();var Q=new c[v||"MeshBasicMaterial"]((0,j.Z)({map:x},d||{}));b(Q)},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,d,w,y,M,b,u,g,T;return R().wrap(function(x){for(;;)switch(x.prev=x.next){case 0:if(f=o.options,h=f.materialOptions,v=f.cache,d=h.sideColor,w=h.sideMap,y=h.topColor,M=e.sideColor,b=e.topColor,!(b||M)){x.next=22;break}if(u="ExtrudePolygonMaterial:".concat(M||d||w||"").concat(b||y||""),!(v&&!v.get(u))){x.next=11;break}return v.init(u),x.next=9,o.getMaterial((0,j.Z)({},h,e));case 9:g=x.sent,v.set(u,g);case 11:if(!v){x.next=17;break}return x.next=14,v.get(u);case 14:x.t0=x.sent,x.next=20;break;case 17:return x.next=19,o.getMaterial((0,j.Z)({},h,e));case 19:x.t0=x.sent;case 20:T=x.t0,o.object3d.material=T;case 22:case"end":return x.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(v){try{var d=new c.BufferGeometry;Object.keys(v).forEach(function(w){d.setAttribute(w,new c.BufferAttribute(v[w].array,v[w].itemSize))}),f(d)}catch(w){i.postMessage({delCache:!0,workerKey:r},{cb:h,cacheVersion:s})}},cacheVersion:s})})}})(),module.exports=Be})();
132
+ `),_e=function(t){"use strict";C(r,t);var i=E(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(oe(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);_e.prototype.setMatrixWorld=function(t){this.matrixWorld=t},_e.prototype.setGeometry=function(t,i){this._geometry=t,this.setPoints(t.getAttribute("position").array,i)},_e.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,d=o.index,w=o.attributes;if(d!==null)for(var y=d.array,A=w.position.array,b=w.width.array,u=0,g=y.length-1;u<g;u+=v){var T=y[u],z=y[u+1];s.fromArray(A,T*3),f.fromArray(A,z*3);var M=b[Math.floor(u/3)]!==void 0?b[Math.floor(u/3)]:1,Q=t.params.Line.threshold+this.material.lineWidth*M/2,K=Q*Q,J=n.distanceSqToSegment(s,f,e,h);if(!(J>K)){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)}}}}_e.prototype.raycast=Ne,_e.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]},_e.prototype.copyV3=function(t){var i=t*6;return[this.positions[i],this.positions[i+1],this.positions[i+2]]},_e.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}_e.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=ot,c.ShaderChunk.meshline_frag=st;var We=function(t){"use strict";C(r,t);var i=E(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(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(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 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 ye(t,i){return ft(t)||ne(t,i)||me(t,i)||ht()}var Ke=require("popmotion"),Le=require("three/examples/jsm//utils/BufferGeometryUtils");function $e(t){var i=t.setPointWidth,r=t.nodes,n=new c.BufferGeometry,a=new _e;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=E(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,v,d,w,y,A,b,u,g,T,z,M,Q,K,J,ue,ge,pe;return R().wrap(function(ee){for(;;)switch(ee.prev=ee.next){case 0:if(s=e.options,f=s.duration,h=s.delay,v=s.onComplete,d=s.setPointWidth,w=s.key,y=s.nodes,A=s.nodesArr,b=s.geometry,u=s.geometryArr,g=s.useGroups,T=s.material,z=s.cache,M=s.cacheKey,Q=lt(s,["duration","delay","onComplete","setPointWidth","key","nodes","nodesArr","geometry","geometryArr","useGroups","material","cache","cacheKey"]),K=T,J=b,K){ee.next=16;break}if(ue="LineMaterial:".concat(M),z&&!z.get(ue)&&(z.init(ue),ge=e.getMaterial((0,j.Z)({},Q)),z.set(ue,ge)),!z){ee.next=12;break}return ee.next=9,z.get(ue);case 9:ee.t0=ee.sent,ee.next=15;break;case 12:return ee.next=14,e.getMaterial(Q);case 14:ee.t0=ee.sent;case 15:K=ee.t0;case 16:!J&&y?J=$e({nodes:y,setPointWidth:d}):!J&&A?J=Le.mergeBufferGeometries(A.map(function(je){return $e({nodes:je,setPointWidth:d})}),g!=null?g:!1):!J&&u&&u.length>1?J=Le.mergeBufferGeometries(u,g!=null?g:!1):!J&&u&&u.length===1&&(pe=ye(u,1),J=pe[0]),e.createMesh(J,K);case 18:case"end":return ee.stop()}},o)}))()},n.getMaterial=function(e){var o=this.pencil.getSize(),s=o.width,f=o.height,h=new We(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(ie(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,d=(0,Ke.animate)({from:h.value,to:{x:0},duration:o!=null?o:1e3,elapsed:-v,repeat:1/0,onComplete:f,ease:Ke.linear,onUpdate:function(w){h.value.x=w.x}});this.tween=d},n.dispose=function(){var e;Oe(_(r.prototype),"dispose",this).call(this),(e=this.tween)===null||e===void 0||e.stop()},te(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 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){i.postMessage({delCache:!0,workerKey:r},{cb:f,cacheVersion:o})}},cacheVersion:o})})}var ke=require("d3-array"),mt=require("earcut"),De=Y.n(mt),gt=require("@turf/boolean-clockwise"),yt=Y.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=Y.n(wt),Mt=require("@turf/boolean-point-in-polygon"),xt=Y.n(Mt),Ee=require("d3-geo"),At=require("d3-geo-voronoi"),qe=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},v=function(u){return o*(Math.cos((u+90)*Math.PI/180)+1)/2},d=[e!==void 0?Math.ceil(v(e)):0,a!==void 0?Math.floor(v(a)):o-1],w=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},y=[],A=d[0];A<=d[1];A++){var b=f(A);w(b)&&y.push([b,h(A)])}return y}function Ue(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=ye((0,Ee.geoBounds)(r),2),a=ye(n[0],2),e=a[0],o=a[1],s=ye(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 St(i,{minLng:e,maxLng:f,minLat:o,maxLat:h}).filter(function(d){return Ue(d,r,v)})}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=ie(e).concat(ie(o)),f={type:"Polygon",coordinates:t},h=ye((0,Ee.geoBounds)(f),2),v=ye(h[0],2),d=v[0],w=v[1],y=ye(h[1],2),A=y[0],b=y[1],u=d>A||b>=89||w<=-89,g=[];if(u){var T=(0,At.geoVoronoi)(s).triangles(),z=new Map(s.map(function(U,Me){var be=ye(U,2),we=be[0],Ge=be[1];return["".concat(we,"-").concat(Ge),Me]}));T.features.forEach(function(U){var Me,be=U.geometry.coordinates[0].slice(0,3).reverse(),we=[];if(be.forEach(function(ze){var xe=ye(ze,2),Ze=xe[0],Rt=xe[1],rt="".concat(Ze,"-").concat(Rt);z.has(rt)&&we.push(z.get(rt))}),we.length===3){if(we.some(function(ze){return ze<e.length})){var Ge=U.properties.circumcenter;if(!Ue(Ge,f,u))return}(Me=g).push.apply(Me,ie(we))}})}else if(o.length)for(var ue=function(U,Me){var be,we=[2,1,0].map(function(xe){return ge.triangles[U+xe]}),Ge=we.map(function(xe){return s[xe]});if(we.some(function(xe){return xe<e.length})){var ze=[0,1].map(function(xe){return(0,ke.mean)(Ge,function(Ze){return Ze[xe]})});if(!Ue(ze,f,u))return"continue"}(be=g).push.apply(be,ie(we))},ge=_t().from(s),pe=0,Pe=ge.triangles.length;pe<Pe;pe+=3)ue(pe,Pe);else{var M=De().flatten(a),Q=M.vertices,K=M.holes,J=K===void 0?[]:K;g=De()(Q,J,2)}var ee=(0,qe.scaleLinear)((0,ke.extent)(s,function(U){return U[0]}),[0,1]),je=(0,qe.scaleLinear)((0,ke.extent)(s,function(U){return U[1]}),[0,1]),Re=s.map(function(U){var Me=ye(U,2),be=Me[0],we=Me[1];return[ee(be),je(we)]}),tt={points:s,indices:g,uvs:Re};return{contour:a,triangles:tt}}var jt=Ct,Xe=new c.BufferGeometry().setAttribute?"setAttribute":"addAttribute";function Ie(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=ye(e,2),s=o[0],f=o[1];return r?bt(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=Ie(t,i,n),e=a.vertices,o=a.holes,s=Ie(t,r,n),f=s.vertices,h=(0,ke.merge)([f,e]),v=Math.round(f.length/3),d=new Set(o),w=0,y=[],A=0;A<v;A++){var b=A+1;if(b===v)b=w;else if(d.has(b)){var u=b;b=w,w=u}y.push(A,A+v,b+v),y.push(b+v,b,A)}for(var g=[],T=1;T>=0;T--)for(var z=0;z<v;z+=1)g.push(z/(v-1),T);return{indices:y,vertices:h,uvs:g,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:Ie([t.points],i,a).vertices,uvs:r}}var Lt=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]:{};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,v=o.closedTop,d=o.includeSides,w=o.curvatureResolution,y=o.cartesian,A=o.userDataRsoOffset;yt()(n[0])||n[0].reverse();var b=jt(n,{resolution:w}),u=b.contour,g=b.triangles,T=(0,ke.merge)(g.uvs),z=[],M=[],Q=[],K=0,J=function(ge){var pe=Math.round(z.length/3),Pe=Q.length;z=z.concat(ge.vertices),M=M.concat(ge.uvs),Q=Q.concat(pe?ge.indices.map(function(ee){return ee+pe}):ge.indices),e.addGroup(Pe,Q.length-Pe,K++)};if(d){var ue=Ye(u,s,f,y);J(ue),e.userData.rso=A?Ye(u,s,f+A,y):ue}return h&&J(Qe(g,s,T,!1,y)),v&&J(Qe(g,f,T,!0,y)),e.setIndex(Q),e[Xe]("position",new c.Float32BufferAttribute(z,3)),e[Xe]("uv",new c.Float32BufferAttribute(M,2)),e.computeVertexNormals(),e}return r}(c.BufferGeometry),kt=function(t){"use strict";C(r,t);var i=E(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,v=e.curvatureResolution,d=e.userDataRsoOffset,w=e.cartesian,y=new Lt(this.options.geojson,{startHeight:o,endHeight:o+s,closedBottom:f,closedTop:h,curvatureResolution:v,cartesian:w,userDataRsoOffset:d});this.createMesh(y,this.options.material)},r}(m),Je=Y(705);function et(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,Je.y)({split:i,box3:a})});return(0,Je.C)(),e}var Tt=function(t){"use strict";C(r,t);var i=E(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,v,d,w,y,A,b,u,g,T,z,M,Q,K,J,ue,ge,pe,Pe,ee,je,Re;return R().wrap(function(U){for(;;)switch(U.prev=U.next){case 0:if(s=e.options,f=s.points,h=s.pointsArr,v=s.useGroups,d=s.depth,w=s.geometry,y=s.geometryArr,A=s.material,b=s.materialOptions,u=s.cache,g=s.box3,T=0,z=Array.isArray(d)?d:[d],M=Array.isArray(g)?g:[g],Q=A,K=w,!(!Q&&b)){U.next=26;break}if(T=b.split,J=b.topColor,ue=b.sideColor,ge=b.sideMap,pe="ExtrudePolygonMaterial:".concat(ue||ge).concat(J||""),!(u&&!u.get(pe))){U.next=16;break}return u.init(pe),U.next=14,e.getMaterial(b);case 14:Pe=U.sent,u.set(pe,Pe);case 16:if(!u){U.next=22;break}return U.next=19,u.get(pe);case 19:U.t0=U.sent,U.next=25;break;case 22:return U.next=24,e.getMaterial(b);case 24:U.t0=U.sent;case 25:Q=U.t0;case 26:!K&&f?K=et({points:f,depth:z[0],split:T,box3:M[0]}):!K&&h?K=Le.mergeBufferGeometries(h.map(function(Me,be){return et({points:Me,depth:(ee=z[be])!==null&&ee!==void 0?ee:z[0],split:T,box3:(je=M[be])!==null&&je!==void 0?je:M[0]})}),v!=null?v:!1):!K&&y&&y.length>1?K=Le.mergeBufferGeometries(y,v!=null?v:!1):!K&&y&&y.length===1&&(Re=ye(y,1),K=Re[0]),e.createMesh(K,Q);case 28:case"end":return U.stop()}},o)}))()},n.addGeometries=function(e){var o=this.object3d,s=Le.mergeBufferGeometries([o.geometry].concat(ie(e)),!1);o.geometry=s},n.getMaterial=function(e){var o=this,s=e.topColor,f=e.sideColor,h=e.sideMap,v=e.type,d=e.parameters,w=e.createCanvasObjectURL,y=e.split,A=e.maxAnisotropy;return new Promise(function(b){var u=h?document.createElement("img"):{src:"",onload:function(){},width:1024,height:1024};u.onload=function(){var g=y,T=document.createElement("canvas"),z=T.getContext("2d");T.height=u.height/(1-g),T.width=u.width,g&&s&&(z.fillStyle=s,z.fillRect(0,0,u.width,T.height*g)),h&&u instanceof HTMLImageElement?z.drawImage(u,0,T.height*g,u.width,u.height):f&&(z.fillStyle=f,z.fillRect(0,T.height*g,u.width,u.height)),w&&T.toBlob(function(K){console.log(URL.createObjectURL(K))});var M=new c.CanvasTexture(T);M.anisotropy=A||o.pencil.renderer.capabilities.getMaxAnisotropy();var Q=new c[v||"MeshBasicMaterial"]((0,j.Z)({map:M},d||{}));b(Q)},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,d,w,y,A,b,u,g,T;return R().wrap(function(M){for(;;)switch(M.prev=M.next){case 0:if(f=o.options,h=f.materialOptions,v=f.cache,d=h.sideColor,w=h.sideMap,y=h.topColor,A=e.sideColor,b=e.topColor,!(b||A)){M.next=22;break}if(u="ExtrudePolygonMaterial:".concat(A||d||w||"").concat(b||y||""),!(v&&!v.get(u))){M.next=11;break}return v.init(u),M.next=9,o.getMaterial((0,j.Z)({},h,e));case 9:g=M.sent,v.set(u,g);case 11:if(!v){M.next=17;break}return M.next=14,v.get(u);case 14:M.t0=M.sent,M.next=20;break;case 17:return M.next=19,o.getMaterial((0,j.Z)({},h,e));case 19:M.t0=M.sent;case 20:T=M.t0,o.object3d.material=T;case 22:case"end":return M.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(v){try{var d=new c.BufferGeometry;Object.keys(v).forEach(function(w){d.setAttribute(w,new c.BufferAttribute(v[w].array,v[w].itemSize))}),f(d)}catch(w){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 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 ze from"d3-geo";import*as rr from"d3-geo-voronoi";import*as nr from"d3-scale";var ir={666:function(T){var B=function(M){"use strict";var P=Object.prototype,w=P.hasOwnProperty,D,L=typeof Symbol=="function"?Symbol:{},W=L.iterator||"@@iterator",H=L.asyncIterator||"@@asyncIterator",C=L.toStringTag||"@@toStringTag";function R(p,l,y){return Object.defineProperty(p,l,{value:y,enumerable:!0,configurable:!0,writable:!0}),p[l]}try{R({},"")}catch(p){R=function(l,y,E){return l[y]=E}}function Z(p,l,y,E){var O=l&&l.prototype instanceof c?l:c,J=Object.create(O.prototype),q=new se(E||[]);return J._invoke=we(p,y,q),J}M.wrap=Z;function K(p,l,y){try{return{type:"normal",arg:p.call(l,y)}}catch(E){return{type:"throw",arg:E}}}var Q="suspendedStart",oe="suspendedYield",pe="executing",fe="completed",k={};function c(){}function S(){}function U(){}var G={};R(G,W,function(){return this});var ie=Object.getPrototypeOf,$=ie&&ie(ie(Oe([])));$&&$!==P&&w.call($,W)&&(G=$);var F=U.prototype=c.prototype=Object.create(G);S.prototype=U,R(F,"constructor",U),R(U,"constructor",S),S.displayName=R(U,C,"GeneratorFunction");function ae(p){["next","throw","return"].forEach(function(l){R(p,l,function(y){return this._invoke(l,y)})})}M.isGeneratorFunction=function(p){var l=typeof p=="function"&&p.constructor;return l?l===S||(l.displayName||l.name)==="GeneratorFunction":!1},M.mark=function(p){return Object.setPrototypeOf?Object.setPrototypeOf(p,U):(p.__proto__=U,R(p,C,"GeneratorFunction")),p.prototype=Object.create(F),p},M.awrap=function(p){return{__await:p}};function ee(p,l){function y(J,q,ue,ve){var ce=K(p[J],p,q);if(ce.type==="throw")ve(ce.arg);else{var Le=ce.arg,Ce=Le.value;return Ce&&typeof Ce=="object"&&w.call(Ce,"__await")?l.resolve(Ce.__await).then(function(Pe){y("next",Pe,ue,ve)},function(Pe){y("throw",Pe,ue,ve)}):l.resolve(Ce).then(function(Pe){Le.value=Pe,ue(Le)},function(Pe){return y("throw",Pe,ue,ve)})}}var E;function O(J,q){function ue(){return new l(function(ve,ce){y(J,q,ve,ce)})}return E=E?E.then(ue,ue):ue()}this._invoke=O}ae(ee.prototype),R(ee.prototype,H,function(){return this}),M.AsyncIterator=ee,M.async=function(p,l,y,E,O){O===void 0&&(O=Promise);var J=new ee(Z(p,l,y,E),O);return M.isGeneratorFunction(l)?J:J.next().then(function(q){return q.done?q.value:J.next()})};function we(p,l,y){var E=Q;return function(J,q){if(E===pe)throw new Error("Generator is already running");if(E===fe){if(J==="throw")throw q;return De()}for(y.method=J,y.arg=q;;){var ue=y.delegate;if(ue){var ve=ge(ue,y);if(ve){if(ve===k)continue;return ve}}if(y.method==="next")y.sent=y._sent=y.arg;else if(y.method==="throw"){if(E===Q)throw E=fe,y.arg;y.dispatchException(y.arg)}else y.method==="return"&&y.abrupt("return",y.arg);E=pe;var ce=K(p,l,y);if(ce.type==="normal"){if(E=y.done?fe:oe,ce.arg===k)continue;return{value:ce.arg,done:y.done}}else ce.type==="throw"&&(E=fe,y.method="throw",y.arg=ce.arg)}}}function ge(p,l){var y=p.iterator[l.method];if(y===D){if(l.delegate=null,l.method==="throw"){if(p.iterator.return&&(l.method="return",l.arg=D,ge(p,l),l.method==="throw"))return k;l.method="throw",l.arg=new TypeError("The iterator does not provide a 'throw' method")}return k}var E=K(y,p.iterator,l.arg);if(E.type==="throw")return l.method="throw",l.arg=E.arg,l.delegate=null,k;var O=E.arg;if(!O)return l.method="throw",l.arg=new TypeError("iterator result is not an object"),l.delegate=null,k;if(O.done)l[p.resultName]=O.value,l.next=p.nextLoc,l.method!=="return"&&(l.method="next",l.arg=D);else return O;return l.delegate=null,k}ae(F),R(F,C,"Generator"),R(F,W,function(){return this}),R(F,"toString",function(){return"[object Generator]"});function V(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 Y(p){var l=p.completion||{};l.type="normal",delete l.arg,p.completion=l}function se(p){this.tryEntries=[{tryLoc:"root"}],p.forEach(V,this),this.reset(!0)}M.keys=function(p){var l=[];for(var y in p)l.push(y);return l.reverse(),function E(){for(;l.length;){var O=l.pop();if(O in p)return E.value=O,E.done=!1,E}return E.done=!0,E}};function Oe(p){if(p){var l=p[W];if(l)return l.call(p);if(typeof p.next=="function")return p;if(!isNaN(p.length)){var y=-1,E=function O(){for(;++y<p.length;)if(w.call(p,y))return O.value=p[y],O.done=!1,O;return O.value=D,O.done=!0,O};return E.next=E}}return{next:De}}M.values=Oe;function De(){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 l in this)l.charAt(0)==="t"&&w.call(this,l)&&!isNaN(+l.slice(1))&&(this[l]=D)},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 y(ve,ce){return J.type="throw",J.arg=p,l.next=ve,ce&&(l.method="next",l.arg=D),!!ce}for(var E=this.tryEntries.length-1;E>=0;--E){var O=this.tryEntries[E],J=O.completion;if(O.tryLoc==="root")return y("end");if(O.tryLoc<=this.prev){var q=w.call(O,"catchLoc"),ue=w.call(O,"finallyLoc");if(q&&ue){if(this.prev<O.catchLoc)return y(O.catchLoc,!0);if(this.prev<O.finallyLoc)return y(O.finallyLoc)}else if(q){if(this.prev<O.catchLoc)return y(O.catchLoc,!0)}else if(ue){if(this.prev<O.finallyLoc)return y(O.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(p,l){for(var y=this.tryEntries.length-1;y>=0;--y){var E=this.tryEntries[y];if(E.tryLoc<=this.prev&&w.call(E,"finallyLoc")&&this.prev<E.finallyLoc){var O=E;break}}O&&(p==="break"||p==="continue")&&O.tryLoc<=l&&l<=O.finallyLoc&&(O=null);var J=O?O.completion:{};return J.type=p,J.arg=l,O?(this.method="next",this.next=O.finallyLoc,k):this.complete(J)},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),k},finish:function(p){for(var l=this.tryEntries.length-1;l>=0;--l){var y=this.tryEntries[l];if(y.finallyLoc===p)return this.complete(y.completion,y.afterLoc),Y(y),k}},catch:function(p){for(var l=this.tryEntries.length-1;l>=0;--l){var y=this.tryEntries[l];if(y.tryLoc===p){var E=y.completion;if(E.type==="throw"){var O=E.arg;Y(y)}return O}}throw new Error("illegal catch attempt")},delegateYield:function(p,l,y){return this.delegate={iterator:Oe(p),resultName:l,nextLoc:y},this.method==="next"&&(this.arg=D),k}},M}(T.exports);try{regeneratorRuntime=B}catch(M){typeof globalThis=="object"?globalThis.regeneratorRuntime=B:Function("r","regeneratorRuntime = r")(B)}},695:function(T,B,M){M.d(B,{Z:function(){return P}});function P(w){if(w.geometry&&w.geometry.dispose(),w.material){var D=Array.isArray(w.material)?w.material:[w.material];D.forEach(function(L){var W,H,C,R,Z,K,Q,oe,pe,fe,k,c,S;(W=L.map)===null||W===void 0||W.dispose(),(H=L.lightMap)===null||H===void 0||H.dispose(),(C=L.bumpMap)===null||C===void 0||C.dispose(),(R=L.normalMap)===null||R===void 0||R.dispose(),(Z=L.specularMap)===null||Z===void 0||Z.dispose(),(K=L.envMap)===null||K===void 0||K.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(),(k=L.gradientMap)===null||k===void 0||k.dispose(),(c=L.metalnessMap)===null||c===void 0||c.dispose(),(S=L.roughnessMap)===null||S===void 0||S.dispose(),L.dispose()})}}},584:function(T,B,M){M.d(B,{wf:function(){return L.Z}});var P=M(666),w=M.n(P),D=null,L=M(695),W=M(949);function H(k){if(k.material){var c=Array.isArray(k.material)?k.material:[k.material];c.forEach(function(S){var U,G;(U=S.color)===null||U===void 0||U.convertSRGBToLinear(),(G=S.emissive)===null||G===void 0||G.convertSRGBToLinear(),S.map&&(S.map.encoding=THREE.sRGBEncoding),S.emissiveMap&&(S.emissiveMap.encoding=THREE.sRGBEncoding)})}}var C=M(568),R=M(924),Z=M(77),K=M(484),Q=null,oe=null,pe=function(){var k=(0,C.Z)(w().mark(function c(S,U){var G,ie,$,F,ae,ee,we,ge,V;return w().wrap(function(se){for(;;)switch(se.prev=se.next){case 0:return G=U.type,ie=G===void 0?"blob":G,$=U.version,F=$===void 0?"1":$,se.next=4,(0,Z.get)(S);case 4:if(ee=se.sent,!(ee&&ee[F])){se.next=9;break}ae=ee[F],se.next=15;break;case 9:return se.next=11,(0,K.Z)(fetch(S).then(function(Oe){if(Oe.ok)return Oe[ie]();throw new Error}));case 11:we=se.sent,ge=we.res,V=we.err,V||(ae=ge,(0,Z.set)(S,(0,R.Z)({},F,ge)));case 15:return se.abrupt("return",ae?{url:ie==="json"?S:URL.createObjectURL(ae),store:ae}:{url:S});case 16:case"end":return se.stop()}},c)}));return function(S,U){return k.apply(this,arguments)}}(),fe=M(705)},484:function(T,B,M){M.d(B,{Z:function(){return w}});var P=M(42);function w(D){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return D.then(function(W){return(0,P.Z)({err:null,res:W},L)}).catch(function(W){return(0,P.Z)({err:W,res:void 0},L)})}},705:function(T,B,M){M.d(B,{C:function(){return L},y:function(){return D}});var P=M(949),w=new Map,D=function(){var W=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{generateTopUV:function(H,C,R,Z,K){var Q=C[R*3],oe=C[R*3+1],pe=C[Z*3],fe=C[Z*3+1],k=C[K*3],c=C[K*3+1],S;if(w.has(H))S=w.get(H);else{var U=W.box3||new P.Box3;if(!W.box3){var G=H.parameters.shapes.getPoints();U.setFromArray(G.map(function(ee){return[ee.x,ee.y,0]}).flat())}var ie=U.getSize(new P.Vector3);W.split&&(ie.y/=W.split),S={box:U,size:ie},w.set(H,S)}var $=S.box,F=S.size,ae=W.split?1-W.split:0;return[new P.Vector2((Q-$.min.x)/F.x,(oe-$.min.y)/F.y+ae),new P.Vector2((pe-$.min.x)/F.x,(fe-$.min.y)/F.y+ae),new P.Vector2((k-$.min.x)/F.x,(c-$.min.y)/F.y+ae)]},generateSideWallUV:function(H,C,R,Z,K,Q){var oe=C[R*3],pe=C[R*3+1],fe=C[R*3+2],k=C[Z*3],c=C[Z*3+1],S=C[Z*3+2],U=C[K*3],G=C[K*3+1],ie=C[K*3+2],$=C[Q*3],F=C[Q*3+1],ae=C[Q*3+2],ee;if(w.has(C))ee=w.get(C);else{var we=new P.Box3;we.setFromArray(C);var ge=we.getSize(new P.Vector3);W.split&&(ge.z/=1-W.split),ee={box:we,size:ge},w.set(C,ee)}var V=ee.box,Y=ee.size;return Math.abs(pe-c)<Math.abs(oe-k)?[new P.Vector2((oe-V.min.x)/Y.x,(fe-V.min.z)/Y.z),new P.Vector2((k-V.min.x)/Y.x,(S-V.min.z)/Y.z),new P.Vector2((U-V.min.x)/Y.x,(ie-V.min.z)/Y.z),new P.Vector2(($-V.min.x)/Y.x,(ae-V.min.z)/Y.z)]:[new P.Vector2((pe-V.min.y)/Y.y,(fe-V.min.z)/Y.z),new P.Vector2((c-V.min.y)/Y.y,(S-V.min.z)/Y.z),new P.Vector2((G-V.min.y)/Y.y,(ie-V.min.z)/Y.z),new P.Vector2((F-V.min.y)/Y.y,(ae-V.min.z)/Y.z)]}}},L=function(){w.clear()}},77:function(T,B,M){var P=D=>{var L={};return M.d(L,D),L},w=D=>()=>D;T.exports=P({get:()=>ot.get,set:()=>ot.set})},949:function(T){var B=P=>{var w={};return I.d(w,P),w},M=P=>()=>P;T.exports=$t},568:function(T,B,M){M.d(B,{Z:function(){return w}});function P(D,L,W,H,C,R,Z){try{var K=D[R](Z),Q=K.value}catch(oe){W(oe);return}K.done?L(Q):Promise.resolve(Q).then(H,C)}function w(D){return function(){var L=this,W=arguments;return new Promise(function(H,C){var R=D.apply(L,W);function Z(Q){P(R,H,C,Z,K,"next",Q)}function K(Q){P(R,H,C,Z,K,"throw",Q)}Z(void 0)})}}},924:function(T,B,M){M.d(B,{Z:function(){return P}});function P(w,D,L){return D in w?Object.defineProperty(w,D,{value:L,enumerable:!0,configurable:!0,writable:!0}):w[D]=L,w}},42:function(T,B,M){M.d(B,{Z:function(){return w}});var P=M(924);function w(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(C){return Object.getOwnPropertyDescriptor(W,C).enumerable}))),H.forEach(function(C){(0,P.Z)(D,C,W[C])})}return D}}},ct={};function I(T){var B=ct[T];if(B!==void 0)return B.exports;var M=ct[T]={exports:{}};return ir[T](M,M.exports,I),M.exports}(function(){I.n=function(T){var B=T&&T.__esModule?function(){return T.default}:function(){return T};return I.d(B,{a:B}),B}})(),function(){I.d=function(T,B){for(var M in B)I.o(B,M)&&!I.o(T,M)&&Object.defineProperty(T,M,{enumerable:!0,get:B[M]})}}(),function(){I.o=function(T,B){return Object.prototype.hasOwnProperty.call(T,B)}}();var de={};(function(){I.d(de,{Ei:function(){return Ft},Yo:function(){return Kt},ZA:function(){return pt},Ee:function(){return Le},x1:function(){return At},VJ:function(){return xe},r7:function(){return Ne},XA:function(){return He},NB:function(){return ht},xv:function(){return Ce},nk:function(){return lt},JX:function(){return Xt},TQ:function(){return Pt}});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 M(e,n){return B(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&&M(e,n)}var w=I(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 f=Function.bind.apply(a,s),h=new f;return o&&M(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 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 Z(e){var n=typeof Map=="function"?new Map:void 0;return Z=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}}),M(a,i)},Z(e)}function K(e){return Z(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 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 fe(this,a)}}var c=I(949),S=I(568),U=I(666),G=I.n(U);function ie(e,n){for(var r=0;r<n.length;r++){var i=n[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function $(e,n,r){return n&&ie(e.prototype,n),r&&ie(e,r),e}function F(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=new Array(n);r<n;r++)i[r]=e[r];return i}function ae(e){if(Array.isArray(e))return F(e)}function ee(e){if(typeof Symbol!="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function we(){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 ge(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 V(e){return ae(e)||ee(e)||ge(e)||we()}var Y=I(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 I.d(n,e),n},De=e=>()=>e,p=Oe({CSS2DObject:()=>Yt.CSS2DObject}),l=e=>{var n={};return I.d(n,e),n},y=e=>()=>e,E=l({CSS3DObject:()=>st.CSS3DObject,CSS3DSprite:()=>st.CSS3DSprite}),O=I(584),J=function(e){e&&((0,O.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 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,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,ve=ue?"ExtrudeBufferGeometry":"ExtrudeGeometry",ce=ue?"PlaneBufferGeometry":"PlaneGeometry",Le=function(e){"use strict";P(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,w.Z)({},{scale:1},a),t}var i=r.prototype;return i.getMaterial=function(){var t=this;return(0,S.Z)(G().mark(function o(){var s,f,h,v,d,b,g,x,_;return G().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return s=t.options,f=s.transparent,h=s.blending,v=s.depthWrite,d=s.alphaTest,b=s.sprite,g=s.sizeAttenuation,m.next=3,t.getTexture();case 3:return x=m.sent,_=b?new c.SpriteMaterial({map:x,transparent:f!=null?f:!1,blending:h!=null?h:c.NormalBlending,depthWrite:v!=null?v:!0,alphaTest:d!=null?d:0,sizeAttenuation:g!=null?g:!0}):new c.MeshBasicMaterial({map:x,transparent:f!=null?f:!1,blending:h!=null?h:c.NormalBlending,depthWrite:v!=null?v:!0,alphaTest:d!=null?d:0}),m.abrupt("return",_);case 6:case"end":return m.stop()}},o)}))()},i.create=function(){var t=this;return(0,S.Z)(G().mark(function o(){var s,f,h,v,d,b,g,x,_;return G().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:if(s=t.options,f=s.scale,h=s.position,v=s.src,d=s.cache,b=s.sprite,g=v,!(d&&!d.get(g))){m.next=8;break}return d.init(g),m.next=6,t.getMaterial();case 6:x=m.sent,d.set(g,x);case 8:if(!d){m.next=14;break}return m.next=11,d.get(g);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:_=m.t0,t.texture=_.map,b?t.createSprite(_):t.createMesh(new c[ce](1,1),_),t.setScale(f),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}(q),Ce=function(e){"use strict";P(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,f=(0,w.Z)({},{fontSize:28,fontFamily:"system-ui,-apple-system,BlinkMacSystemFont,sans-serif",fontWeight:"normal",flipX:!1,color:"#ffffff",setCtx:function(z){}},s||{}),h=f.fontSize,v=f.fontFamily,d=f.fontWeight,b=f.flipX,g=f.color,x=f.setCtx,_=this.canvas;_.width=h*o.length*2,_.height=h;var u=_.getContext("2d");u.font="".concat(d," ").concat(h,"px/1 ").concat(v);var m=u.measureText(o).width;_.width=m,u=_.getContext("2d"),u.clearRect(0,0,_.width,_.height),b&&u.scale(-1,1),u.font="".concat(d," ").concat(h,"px/1 ").concat(v),u.textBaseline="middle",u.fillStyle=g,x&&x(u),u.fillText(o,b?m*-1:0,_.height/2),u.restore();var j=new c.Texture(_);return j.anisotropy=this.pencil.renderer.capabilities.getMaxAnisotropy(),j.needsUpdate=!0,Promise.resolve(j)},r}(K(Le));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 f=Object.getOwnPropertyDescriptor(s,t);return f.get?f.get.call(o||a):f.value}},We(e,n,r)}function Ve(e,n,r){return We(e,n,r)}var lt=function(e){"use strict";P(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,w.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,f=t.blending,h=t.depthWrite,v=t.format,d=t.autoPlay,b=t.loop,g=t.alphaTest,x=t.sprite,_=se(),u=document.createElement("video");return u.addEventListener("loadedmetadata",function(){var m=new c.VideoTexture(u);m.format=v!=null?v:c.RGBAFormat,m.needsUpdate=!0;var j=x?new c.SpriteMaterial({map:m,transparent:s!=null?s:!1,blending:f!=null?f:c.NormalBlending,depthWrite:h!=null?h:!0,alphaTest:g!=null?g:0}):new c.MeshBasicMaterial({map:m,transparent:s!=null?s:!1,blending:f!=null?f:c.NormalBlending,depthWrite:h!=null?h:!0,alphaTest:g!=null?g:0});_.resolve(j)},!1),u.src=o,u.muted=!0,u.autoplay=d,u.loop=b,u.preload="auto",_.promise},i.create=function(){var t=this;return(0,S.Z)(G().mark(function o(){var s,f,h,v,d,b,g,x;return G().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(s=t.options,f=s.scale,h=s.position,v=s.src,d=s.cache,b=s.sprite,!(d&&!d.get(v))){u.next=7;break}return d.init(v),u.next=5,t.getMaterial();case 5:g=u.sent,d.set(v,g);case 7:if(!d){u.next=13;break}return u.next=10,d.get(v);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:x=u.t0,t.video=x.map.image,b?t.createSprite(x):t.createMesh(new c[ce](1,1),x),t.setScale(f),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(),Ve(R(r.prototype),"dispose",this).call(this)},r}(q),ft=function(e){"use strict";P(r,e);var n=k(r);function r(a){T(this,r);var t;return t=n.call(this),t.options=(0,w.Z)({},{event:"click"},a),t}var i=r.prototype;return i.create=function(){var t=this.options,o=t.position,s=t.children,f=t.handler,h=t.event,v=t.zIndexFix,d=t.event2,b=t.handler2,g=document.createElement("div");this.element=g,g.appendChild(s),this.createCSS2DObject(g),o&&this.object3d.position.copy(o),f&&h&&this.clickTarge.forEach(function(x){x.addEventListener(h,f),b&&d&&x.addEventListener(d,b)}),v&&(this.object3d.userData.zIndexFix=v)},i.getMaterial=function(t){return(0,S.Z)(G().mark(function o(){var s,f,h,v;return G().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),v=new c.SpriteMaterial({map:h,opacity:t?1:0,transparent:!0,alphaTest:.1,sizeAttenuation:!1}),b.abrupt("return",v);case 9:case"end":return b.stop()}},o)}))()},i.createPickObject=function(t){var o=t.show,s=o===void 0?!1:o,f=t.scale,h=f===void 0?new c.Vector3(1,1,1):f,v=t.position,d=v===void 0?new c.Vector3(0,0,0):v,b=t.cache,g=this;return(0,S.Z)(G().mark(function x(){var _,u,m,j;return G().wrap(function(A){for(;;)switch(A.prev=A.next){case 0:if(_="node-create-pick-object",!(b&&!b.get(_))){A.next=7;break}return b.init(_),A.next=5,g.getMaterial(s);case 5:u=A.sent,b.set(_,u);case 7:if(!b){A.next=13;break}return A.next=10,b.get(_);case 10:A.t0=A.sent,A.next=16;break;case 13:return A.next=15,g.getMaterial(s);case 15:A.t0=A.sent;case 16:m=A.t0,j=new c.Sprite(m),j.scale.set(m.map.image.width*h.x,m.map.image.height*h.y,1),j.position.copy(d),g.add(j),g.pickObject=j;case 22:case"end":return A.stop()}},x)}))()},i.dispose=function(){var t=this.options,o=t.handler,s=t.event,f=t.handler2,h=t.event2;o&&s&&this.clickTarge.forEach(function(v){v.removeEventListener(s,o),f&&h&&v.removeEventListener(h,f)}),Ve(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(f){return V(t.element.querySelectorAll(f))}).flat();return s}return[this.element]}}]),r}(q),ht=ft,pt=function(e){"use strict";P(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),vt=`
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 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 Ve 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 P=Object.prototype,w=P.hasOwnProperty,z,L=typeof Symbol=="function"?Symbol:{},W=L.iterator||"@@iterator",H=L.asyncIterator||"@@asyncIterator",C=L.toStringTag||"@@toStringTag";function R(p,l,g){return Object.defineProperty(p,l,{value:g,enumerable:!0,configurable:!0,writable:!0}),p[l]}try{R({},"")}catch(p){R=function(l,g,E){return l[g]=E}}function Z(p,l,g,E){var O=l&&l.prototype instanceof c?l:c,J=Object.create(O.prototype),q=new se(E||[]);return J._invoke=we(p,g,q),J}x.wrap=Z;function K(p,l,g){try{return{type:"normal",arg:p.call(l,g)}}catch(E){return{type:"throw",arg:E}}}var Q="suspendedStart",oe="suspendedYield",pe="executing",fe="completed",k={};function c(){}function S(){}function U(){}var G={};R(G,W,function(){return this});var ie=Object.getPrototypeOf,$=ie&&ie(ie(Oe([])));$&&$!==P&&w.call($,W)&&(G=$);var F=U.prototype=c.prototype=Object.create(G);S.prototype=U,R(F,"constructor",U),R(U,"constructor",S),S.displayName=R(U,C,"GeneratorFunction");function ae(p){["next","throw","return"].forEach(function(l){R(p,l,function(g){return this._invoke(l,g)})})}x.isGeneratorFunction=function(p){var l=typeof p=="function"&&p.constructor;return l?l===S||(l.displayName||l.name)==="GeneratorFunction":!1},x.mark=function(p){return Object.setPrototypeOf?Object.setPrototypeOf(p,U):(p.__proto__=U,R(p,C,"GeneratorFunction")),p.prototype=Object.create(F),p},x.awrap=function(p){return{__await:p}};function ee(p,l){function g(J,q,ue,ve){var ce=K(p[J],p,q);if(ce.type==="throw")ve(ce.arg);else{var Le=ce.arg,Ce=Le.value;return Ce&&typeof Ce=="object"&&w.call(Ce,"__await")?l.resolve(Ce.__await).then(function(Pe){g("next",Pe,ue,ve)},function(Pe){g("throw",Pe,ue,ve)}):l.resolve(Ce).then(function(Pe){Le.value=Pe,ue(Le)},function(Pe){return g("throw",Pe,ue,ve)})}}var E;function O(J,q){function ue(){return new l(function(ve,ce){g(J,q,ve,ce)})}return E=E?E.then(ue,ue):ue()}this._invoke=O}ae(ee.prototype),R(ee.prototype,H,function(){return this}),x.AsyncIterator=ee,x.async=function(p,l,g,E,O){O===void 0&&(O=Promise);var J=new ee(Z(p,l,g,E),O);return x.isGeneratorFunction(l)?J:J.next().then(function(q){return q.done?q.value:J.next()})};function we(p,l,g){var E=Q;return function(J,q){if(E===pe)throw new Error("Generator is already running");if(E===fe){if(J==="throw")throw q;return ze()}for(g.method=J,g.arg=q;;){var ue=g.delegate;if(ue){var ve=ge(ue,g);if(ve){if(ve===k)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=K(p,l,g);if(ce.type==="normal"){if(E=g.done?fe:oe,ce.arg===k)continue;return{value:ce.arg,done:g.done}}else ce.type==="throw"&&(E=fe,g.method="throw",g.arg=ce.arg)}}}function ge(p,l){var g=p.iterator[l.method];if(g===z){if(l.delegate=null,l.method==="throw"){if(p.iterator.return&&(l.method="return",l.arg=z,ge(p,l),l.method==="throw"))return k;l.method="throw",l.arg=new TypeError("The iterator does not provide a 'throw' method")}return k}var E=K(g,p.iterator,l.arg);if(E.type==="throw")return l.method="throw",l.arg=E.arg,l.delegate=null,k;var O=E.arg;if(!O)return l.method="throw",l.arg=new TypeError("iterator result is not an object"),l.delegate=null,k;if(O.done)l[p.resultName]=O.value,l.next=p.nextLoc,l.method!=="return"&&(l.method="next",l.arg=z);else return O;return l.delegate=null,k}ae(F),R(F,C,"Generator"),R(F,W,function(){return this}),R(F,"toString",function(){return"[object Generator]"});function D(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 Y(p){var l=p.completion||{};l.type="normal",delete l.arg,p.completion=l}function se(p){this.tryEntries=[{tryLoc:"root"}],p.forEach(D,this),this.reset(!0)}x.keys=function(p){var l=[];for(var g in p)l.push(g);return l.reverse(),function E(){for(;l.length;){var O=l.pop();if(O in p)return E.value=O,E.done=!1,E}return E.done=!0,E}};function Oe(p){if(p){var l=p[W];if(l)return l.call(p);if(typeof p.next=="function")return p;if(!isNaN(p.length)){var g=-1,E=function O(){for(;++g<p.length;)if(w.call(p,g))return O.value=p[g],O.done=!1,O;return O.value=z,O.done=!0,O};return E.next=E}}return{next:ze}}x.values=Oe;function ze(){return{value:z,done:!0}}return se.prototype={constructor:se,reset:function(p){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(Y),!p)for(var l in this)l.charAt(0)==="t"&&w.call(this,l)&&!isNaN(+l.slice(1))&&(this[l]=z)},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 g(ve,ce){return J.type="throw",J.arg=p,l.next=ve,ce&&(l.method="next",l.arg=z),!!ce}for(var E=this.tryEntries.length-1;E>=0;--E){var O=this.tryEntries[E],J=O.completion;if(O.tryLoc==="root")return g("end");if(O.tryLoc<=this.prev){var q=w.call(O,"catchLoc"),ue=w.call(O,"finallyLoc");if(q&&ue){if(this.prev<O.catchLoc)return g(O.catchLoc,!0);if(this.prev<O.finallyLoc)return g(O.finallyLoc)}else if(q){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(p,l){for(var g=this.tryEntries.length-1;g>=0;--g){var E=this.tryEntries[g];if(E.tryLoc<=this.prev&&w.call(E,"finallyLoc")&&this.prev<E.finallyLoc){var O=E;break}}O&&(p==="break"||p==="continue")&&O.tryLoc<=l&&l<=O.finallyLoc&&(O=null);var J=O?O.completion:{};return J.type=p,J.arg=l,O?(this.method="next",this.next=O.finallyLoc,k):this.complete(J)},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),k},finish:function(p){for(var l=this.tryEntries.length-1;l>=0;--l){var g=this.tryEntries[l];if(g.finallyLoc===p)return this.complete(g.completion,g.afterLoc),Y(g),k}},catch:function(p){for(var l=this.tryEntries.length-1;l>=0;--l){var g=this.tryEntries[l];if(g.tryLoc===p){var E=g.completion;if(E.type==="throw"){var O=E.arg;Y(g)}return O}}throw new Error("illegal catch attempt")},delegateYield:function(p,l,g){return this.delegate={iterator:Oe(p),resultName:l,nextLoc:g},this.method==="next"&&(this.arg=z),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 P}});function P(w){if(w.geometry&&w.geometry.dispose(),w.material){var z=Array.isArray(w.material)?w.material:[w.material];z.forEach(function(L){var W,H,C,R,Z,K,Q,oe,pe,fe,k,c,S;(W=L.map)===null||W===void 0||W.dispose(),(H=L.lightMap)===null||H===void 0||H.dispose(),(C=L.bumpMap)===null||C===void 0||C.dispose(),(R=L.normalMap)===null||R===void 0||R.dispose(),(Z=L.specularMap)===null||Z===void 0||Z.dispose(),(K=L.envMap)===null||K===void 0||K.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(),(k=L.gradientMap)===null||k===void 0||k.dispose(),(c=L.metalnessMap)===null||c===void 0||c.dispose(),(S=L.roughnessMap)===null||S===void 0||S.dispose(),L.dispose()})}}},584:function(T,B,x){x.d(B,{wf:function(){return L.Z}});var P=x(666),w=x.n(P),z=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(S){var U,G;(U=S.color)===null||U===void 0||U.convertSRGBToLinear(),(G=S.emissive)===null||G===void 0||G.convertSRGBToLinear(),S.map&&(S.map.encoding=THREE.sRGBEncoding),S.emissiveMap&&(S.emissiveMap.encoding=THREE.sRGBEncoding)})}}var C=x(568),R=x(924),Z=x(77),K=x(484),Q=null,oe=null,pe=function(){var k=(0,C.Z)(w().mark(function c(S,U){var G,ie,$,F,ae,ee,we,ge,D;return w().wrap(function(se){for(;;)switch(se.prev=se.next){case 0:return G=U.type,ie=G===void 0?"blob":G,$=U.version,F=$===void 0?"1":$,se.next=4,(0,Z.get)(S);case 4:if(ee=se.sent,!(ee&&ee[F])){se.next=9;break}ae=ee[F],se.next=15;break;case 9:return se.next=11,(0,K.Z)(fetch(S).then(function(Oe){if(Oe.ok)return Oe[ie]();throw new Error}));case 11:we=se.sent,ge=we.res,D=we.err,D||(ae=ge,(0,Z.set)(S,(0,R.Z)({},F,ge)));case 15:return se.abrupt("return",ae?{url:ie==="json"?S:URL.createObjectURL(ae),store:ae}:{url:S});case 16:case"end":return se.stop()}},c)}));return function(S,U){return k.apply(this,arguments)}}(),fe=x(705)},484:function(T,B,x){x.d(B,{Z:function(){return w}});var P=x(42);function w(z){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return z.then(function(W){return(0,P.Z)({err:null,res:W},L)}).catch(function(W){return(0,P.Z)({err:W,res:void 0},L)})}},705:function(T,B,x){x.d(B,{C:function(){return L},y:function(){return z}});var P=x(949),w=new Map,z=function(){var W=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{generateTopUV:function(H,C,R,Z,K){var Q=C[R*3],oe=C[R*3+1],pe=C[Z*3],fe=C[Z*3+1],k=C[K*3],c=C[K*3+1],S;if(w.has(H))S=w.get(H);else{var U=W.box3||new P.Box3;if(!W.box3){var G=H.parameters.shapes.getPoints();U.setFromArray(G.map(function(ee){return[ee.x,ee.y,0]}).flat())}var ie=U.getSize(new P.Vector3);W.split&&(ie.y/=W.split),S={box:U,size:ie},w.set(H,S)}var $=S.box,F=S.size,ae=W.split?1-W.split:0;return[new P.Vector2((Q-$.min.x)/F.x,(oe-$.min.y)/F.y+ae),new P.Vector2((pe-$.min.x)/F.x,(fe-$.min.y)/F.y+ae),new P.Vector2((k-$.min.x)/F.x,(c-$.min.y)/F.y+ae)]},generateSideWallUV:function(H,C,R,Z,K,Q){var oe=C[R*3],pe=C[R*3+1],fe=C[R*3+2],k=C[Z*3],c=C[Z*3+1],S=C[Z*3+2],U=C[K*3],G=C[K*3+1],ie=C[K*3+2],$=C[Q*3],F=C[Q*3+1],ae=C[Q*3+2],ee;if(w.has(C))ee=w.get(C);else{var we=new P.Box3;we.setFromArray(C);var ge=we.getSize(new P.Vector3);W.split&&(ge.z/=1-W.split),ee={box:we,size:ge},w.set(C,ee)}var D=ee.box,Y=ee.size;return Math.abs(pe-c)<Math.abs(oe-k)?[new P.Vector2((oe-D.min.x)/Y.x,(fe-D.min.z)/Y.z),new P.Vector2((k-D.min.x)/Y.x,(S-D.min.z)/Y.z),new P.Vector2((U-D.min.x)/Y.x,(ie-D.min.z)/Y.z),new P.Vector2(($-D.min.x)/Y.x,(ae-D.min.z)/Y.z)]:[new P.Vector2((pe-D.min.y)/Y.y,(fe-D.min.z)/Y.z),new P.Vector2((c-D.min.y)/Y.y,(S-D.min.z)/Y.z),new P.Vector2((G-D.min.y)/Y.y,(ie-D.min.z)/Y.z),new P.Vector2((F-D.min.y)/Y.y,(ae-D.min.z)/Y.z)]}}},L=function(){w.clear()}},77:function(T,B,x){var P=z=>{var L={};return x.d(L,z),L},w=z=>()=>z;T.exports=P({get:()=>ot.get,set:()=>ot.set})},949:function(T){var B=P=>{var w={};return I.d(w,P),w},x=P=>()=>P;T.exports=$t},568:function(T,B,x){x.d(B,{Z:function(){return w}});function P(z,L,W,H,C,R,Z){try{var K=z[R](Z),Q=K.value}catch(oe){W(oe);return}K.done?L(Q):Promise.resolve(Q).then(H,C)}function w(z){return function(){var L=this,W=arguments;return new Promise(function(H,C){var R=z.apply(L,W);function Z(Q){P(R,H,C,Z,K,"next",Q)}function K(Q){P(R,H,C,Z,K,"throw",Q)}Z(void 0)})}}},924:function(T,B,x){x.d(B,{Z:function(){return P}});function P(w,z,L){return z in w?Object.defineProperty(w,z,{value:L,enumerable:!0,configurable:!0,writable:!0}):w[z]=L,w}},42:function(T,B,x){x.d(B,{Z:function(){return w}});var P=x(924);function w(z){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(C){return Object.getOwnPropertyDescriptor(W,C).enumerable}))),H.forEach(function(C){(0,P.Z)(z,C,W[C])})}return z}}},ct={};function I(T){var B=ct[T];if(B!==void 0)return B.exports;var x=ct[T]={exports:{}};return ir[T](x,x.exports,I),x.exports}(function(){I.n=function(T){var B=T&&T.__esModule?function(){return T.default}:function(){return T};return I.d(B,{a:B}),B}})(),function(){I.d=function(T,B){for(var x in B)I.o(B,x)&&!I.o(T,x)&&Object.defineProperty(T,x,{enumerable:!0,get:B[x]})}}(),function(){I.o=function(T,B){return Object.prototype.hasOwnProperty.call(T,B)}}();var de={};(function(){I.d(de,{Ei:function(){return Ft},Yo:function(){return Kt},ZA:function(){return pt},Ee:function(){return Le},x1:function(){return At},VJ:function(){return xe},r7:function(){return Ne},XA:function(){return He},NB:function(){return ht},xv:function(){return Ce},nk:function(){return lt},JX:function(){return Xt},TQ:function(){return Pt}});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 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&&x(e,n)}var w=I(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(e){return!1}}function L(e,n,r){return z()?L=Reflect.construct:L=function(a,t,o){var s=[null];s.push.apply(s,t);var f=Function.bind.apply(a,s),h=new f;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 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 Z(e){var n=typeof Map=="function"?new Map:void 0;return Z=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)},Z(e)}function K(e){return Z(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 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 fe(this,a)}}var c=I(949),S=I(568),U=I(666),G=I.n(U);function ie(e,n){for(var r=0;r<n.length;r++){var i=n[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function $(e,n,r){return n&&ie(e.prototype,n),r&&ie(e,r),e}function F(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=new Array(n);r<n;r++)i[r]=e[r];return i}function ae(e){if(Array.isArray(e))return F(e)}function ee(e){if(typeof Symbol!="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function we(){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 ge(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 D(e){return ae(e)||ee(e)||ge(e)||we()}var Y=I(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 I.d(n,e),n},ze=e=>()=>e,p=Oe({CSS2DObject:()=>Yt.CSS2DObject}),l=e=>{var n={};return I.d(n,e),n},g=e=>()=>e,E=l({CSS3DObject:()=>st.CSS3DObject,CSS3DSprite:()=>st.CSS3DSprite}),O=I(584),J=function(e){e&&((0,O.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,D(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,D(a)),this},n.createCSS2DObject=function(i){return this.object3d=new p.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,D(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,D(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,ve=ue?"ExtrudeBufferGeometry":"ExtrudeGeometry",ce=ue?"PlaneBufferGeometry":"PlaneGeometry",Le=function(e){"use strict";P(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,w.Z)({},{scale:1},a),t}var i=r.prototype;return i.getMaterial=function(){var t=this;return(0,S.Z)(G().mark(function o(){var s,f,h,v,d,b,y,A,_;return G().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return s=t.options,f=s.transparent,h=s.blending,v=s.depthWrite,d=s.alphaTest,b=s.sprite,y=s.sizeAttenuation,m.next=3,t.getTexture();case 3:return A=m.sent,_=b?new c.SpriteMaterial({map:A,transparent:f!=null?f:!1,blending:h!=null?h:c.NormalBlending,depthWrite:v!=null?v:!0,alphaTest:d!=null?d:0,sizeAttenuation:y!=null?y:!0}):new c.MeshBasicMaterial({map:A,transparent:f!=null?f:!1,blending:h!=null?h:c.NormalBlending,depthWrite:v!=null?v:!0,alphaTest:d!=null?d:0}),m.abrupt("return",_);case 6:case"end":return m.stop()}},o)}))()},i.create=function(){var t=this;return(0,S.Z)(G().mark(function o(){var s,f,h,v,d,b,y,A,_;return G().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:if(s=t.options,f=s.scale,h=s.position,v=s.src,d=s.cache,b=s.sprite,y=v,!(d&&!d.get(y))){m.next=8;break}return d.init(y),m.next=6,t.getMaterial();case 6:A=m.sent,d.set(y,A);case 8:if(!d){m.next=14;break}return m.next=11,d.get(y);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:_=m.t0,t.texture=_.map,b?t.createSprite(_):t.createMesh(new c[ce](1,1),_),t.setScale(f),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}(q),Ce=function(e){"use strict";P(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,f=(0,w.Z)({},{fontSize:28,fontFamily:"system-ui,-apple-system,BlinkMacSystemFont,sans-serif",fontWeight:"normal",flipX:!1,color:"#ffffff",setCtx:function(V){}},s||{}),h=f.fontSize,v=f.fontFamily,d=f.fontWeight,b=f.flipX,y=f.color,A=f.setCtx,_=this.canvas;_.width=h*o.length*2,_.height=h;var u=_.getContext("2d");u.font="".concat(d," ").concat(h,"px/1 ").concat(v);var m=u.measureText(o).width;_.width=m,u=_.getContext("2d"),u.clearRect(0,0,_.width,_.height),b&&u.scale(-1,1),u.font="".concat(d," ").concat(h,"px/1 ").concat(v),u.textBaseline="middle",u.fillStyle=y,A&&A(u),u.fillText(o,b?m*-1:0,_.height/2),u.restore();var j=new c.Texture(_);return j.anisotropy=this.pencil.renderer.capabilities.getMaxAnisotropy(),j.needsUpdate=!0,Promise.resolve(j)},r}(K(Le));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 f=Object.getOwnPropertyDescriptor(s,t);return f.get?f.get.call(o||a):f.value}},We(e,n,r)}function De(e,n,r){return We(e,n,r)}var lt=function(e){"use strict";P(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,w.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,f=t.blending,h=t.depthWrite,v=t.format,d=t.autoPlay,b=t.loop,y=t.alphaTest,A=t.sprite,_=se(),u=document.createElement("video");return u.addEventListener("loadedmetadata",function(){var m=new c.VideoTexture(u);m.format=v!=null?v:c.RGBAFormat,m.needsUpdate=!0;var j=A?new c.SpriteMaterial({map:m,transparent:s!=null?s:!1,blending:f!=null?f:c.NormalBlending,depthWrite:h!=null?h:!0,alphaTest:y!=null?y:0}):new c.MeshBasicMaterial({map:m,transparent:s!=null?s:!1,blending:f!=null?f:c.NormalBlending,depthWrite:h!=null?h:!0,alphaTest:y!=null?y:0});_.resolve(j)},!1),u.src=o,u.muted=!0,u.autoplay=d,u.loop=b,u.preload="auto",_.promise},i.create=function(){var t=this;return(0,S.Z)(G().mark(function o(){var s,f,h,v,d,b,y,A;return G().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(s=t.options,f=s.scale,h=s.position,v=s.src,d=s.cache,b=s.sprite,!(d&&!d.get(v))){u.next=7;break}return d.init(v),u.next=5,t.getMaterial();case 5:y=u.sent,d.set(v,y);case 7:if(!d){u.next=13;break}return u.next=10,d.get(v);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:A=u.t0,t.video=A.map.image,b?t.createSprite(A):t.createMesh(new c[ce](1,1),A),t.setScale(f),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(),De(R(r.prototype),"dispose",this).call(this)},r}(q),ft=function(e){"use strict";P(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,w.Z)({},{event:"click"},a),t}var i=r.prototype;return i.create=function(){var t=this.options,o=t.position,s=t.children,f=t.handler,h=t.event,v=t.event2,d=t.handler2,b=document.createElement("div");this.element=b,b.appendChild(s),this.createCSS2DObject(b),o&&this.object3d.position.copy(o),f&&h&&this.clickTarge.forEach(function(y){y.addEventListener(h,f),d&&v&&y.addEventListener(v,d)})},i.getMaterial=function(t){return(0,S.Z)(G().mark(function o(){var s,f,h,v;return G().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),v=new c.SpriteMaterial({map:h,opacity:t?1:0,transparent:!0,alphaTest:.1,sizeAttenuation:!1}),b.abrupt("return",v);case 9:case"end":return b.stop()}},o)}))()},i.createPickObject=function(t){var o=t.show,s=o===void 0?!1:o,f=t.scale,h=f===void 0?new c.Vector3(1,1,1):f,v=t.position,d=v===void 0?new c.Vector3(0,0,0):v,b=t.cache,y=this;return(0,S.Z)(G().mark(function A(){var _,u,m,j;return G().wrap(function(M){for(;;)switch(M.prev=M.next){case 0:if(_="node-create-pick-object",!(b&&!b.get(_))){M.next=7;break}return b.init(_),M.next=5,y.getMaterial(s);case 5:u=M.sent,b.set(_,u);case 7:if(!b){M.next=13;break}return M.next=10,b.get(_);case 10:M.t0=M.sent,M.next=16;break;case 13:return M.next=15,y.getMaterial(s);case 15:M.t0=M.sent;case 16:m=M.t0,j=new c.Sprite(m),j.scale.set(m.map.image.width*h.x,m.map.image.height*h.y,1),j.position.copy(d),y.add(j),y.pickObject=j;case 22:case"end":return M.stop()}},A)}))()},i.dispose=function(){var t=this.options,o=t.handler,s=t.event,f=t.handler2,h=t.event2;o&&s&&this.clickTarge.forEach(function(v){v.removeEventListener(s,o),f&&h&&v.removeEventListener(h,f)}),De(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(f){return D(t.element.querySelectorAll(f))}).flat();return s}return[this.element]}}]),r}(q),ht=ft,pt=function(e){"use strict";P(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),vt=`
2
2
  `.concat(c.ShaderChunk.logdepthbuf_pars_vertex,`
3
3
  `).concat(c.ShaderChunk.fog_pars_vertex,`
4
4
  attribute vec3 previous;
@@ -129,4 +129,4 @@ void main() {
129
129
  gl_FragColor.a *= step(vCounters, visibility);
130
130
  `).concat(c.ShaderChunk.fog_fragment,`
131
131
  }
132
- `),xe=function(e){"use strict";P(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);xe.prototype.setMatrixWorld=function(e){this.matrixWorld=e},xe.prototype.setGeometry=function(e,n){this._geometry=e,this.setPoints(e.getAttribute("position").array,n)},xe.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,f=new c.Vector3,h=new c.Vector3,v=this instanceof c.LineSegments?2:1,d=o.index,b=o.attributes;if(d!==null)for(var g=d.array,x=b.position.array,_=b.width.array,u=0,m=g.length-1;u<m;u+=v){var j=g[u],z=g[u+1];s.fromArray(x,j*3),f.fromArray(x,z*3);var A=_[Math.floor(u/3)]!==void 0?_[Math.floor(u/3)]:1,te=e.params.Line.threshold+this.material.lineWidth*A/2,X=te*te,re=i.distanceSqToSegment(s,f,t,h);if(!(re>X)){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)}}}}xe.prototype.raycast=He,xe.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]},xe.prototype.copyV3=function(e){var n=e*6;return[this.positions[n],this.positions[n+1],this.positions[n+2]]},xe.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}xe.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=vt,c.ShaderChunk.meshline_frag=dt;var Ne=function(e){"use strict";P(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 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 $e(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 ye(e,n){return _t(e)||ee(e,n)||ge(e,n)||bt()}var wt=e=>{var n={};return I.d(n,e),n},yr=e=>()=>e,Ye=wt({animate:()=>ut.animate,linear:()=>ut.linear}),xt=e=>{var n={};return I.d(n,e),n},_r=e=>()=>e,je=xt({mergeBufferGeometries:()=>Jt.mergeBufferGeometries});function Je(e){var n=e.setPointWidth,r=e.nodes,i=new c.BufferGeometry,a=new xe;return i.setFromPoints(r),a.setGeometry(i,n),a}var Mt={color:new c.Color("#ffffff"),lineWidth:1},At=function(e){"use strict";P(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,w.Z)({},Mt,a),t}var i=r.prototype;return i.create=function(){var t=this;return(0,S.Z)(G().mark(function o(){var s,f,h,v,d,b,g,x,_,u,m,j,z,A,te,X,re,le,me,he;return G().wrap(function(ne){for(;;)switch(ne.prev=ne.next){case 0:if(s=t.options,f=s.duration,h=s.delay,v=s.onComplete,d=s.setPointWidth,b=s.key,g=s.nodes,x=s.nodesArr,_=s.geometry,u=s.geometryArr,m=s.useGroups,j=s.material,z=s.cache,A=s.cacheKey,te=yt(s,["duration","delay","onComplete","setPointWidth","key","nodes","nodesArr","geometry","geometryArr","useGroups","material","cache","cacheKey"]),X=j,re=_,X){ne.next=16;break}if(le="LineMaterial:".concat(A),z&&!z.get(le)&&(z.init(le),me=t.getMaterial((0,w.Z)({},te)),z.set(le,me)),!z){ne.next=12;break}return ne.next=9,z.get(le);case 9:ne.t0=ne.sent,ne.next=15;break;case 12:return ne.next=14,t.getMaterial(te);case 14:ne.t0=ne.sent;case 15:X=ne.t0;case 16:!re&&g?re=Je({nodes:g,setPointWidth:d}):!re&&x?re=je.mergeBufferGeometries(x.map(function(Ee){return Je({nodes:Ee,setPointWidth:d})}),m!=null?m:!1):!re&&u&&u.length>1?re=je.mergeBufferGeometries(u,m!=null?m:!1):!re&&u&&u.length===1&&(he=ye(u,1),re=he[0]),t.createMesh(re,X);case 18:case"end":return ne.stop()}},o)}))()},i.getMaterial=function(t){var o=this.pencil.getSize(),s=o.width,f=o.height,h=new Ne($e((0,w.Z)({},t),{resolution:new c.Vector2(s,f)}));return h},i.addGeometries=function(t){var o=this.object3d,s=je.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,f=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:f,ease:Ye.linear,onUpdate:function(b){h.value.x=b.x}});this.tween=d},i.dispose=function(){var t;Ve(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 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,f){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:f,cacheVersion:o})}},cacheVersion:o})})}var St=e=>{var n={};return I.d(n,e),n},br=e=>()=>e,ke=St({extent:()=>Xe.extent,mean:()=>Xe.mean,merge:()=>Xe.merge}),Ot=e=>{var n={};return I.d(n,e),n},wr=e=>()=>e,Ie=Ot({default:()=>Qt.default}),Ct=e=>{var n={};return I.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 I.d(n,e),n},Mr=e=>()=>e,kt=jt({default:()=>er.default}),Tt=e=>{var n={};return I.d(n,e),n},Ar=e=>()=>e,Rt=Tt({default:()=>tr.default}),Bt=e=>{var n={};return I.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 I.d(n,e),n},Sr=e=>()=>e,Wt=Gt({geoVoronoi:()=>rr.geoVoronoi}),zt=e=>{var n={};return I.d(n,e),n},Or=e=>()=>e,Qe=zt({scaleLinear:()=>nr.scaleLinear});function Dt(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),f=1/Math.ceil(o/n),h=f;h<1;)i.push(s(h)),h+=f}i.push(a=t)}),i})}function Vt(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,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},d=[t!==void 0?Math.ceil(v(t)):0,a!==void 0?Math.floor(v(a)):o-1],b=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},g=[],x=d[0];x<=d[1];x++){var _=f(x);b(_)&&g.push([_,h(x)])}return g}function Ze(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=ye((0,Te.geoBounds)(r),2),a=ye(i[0],2),t=a[0],o=a[1],s=ye(i[1],2),f=s[0],h=s[1];if(Math.min(Math.abs(f-t),Math.abs(h-o))<n)return[];var v=t>f||h>=89||o<=-89;return Vt(n,{minLng:t,maxLng:f,minLat:o,maxLat:h}).filter(function(d){return Ze(d,r,v)})}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=Dt(e,i),t=(0,ke.merge)(a),o=Ut(e,i),s=V(t).concat(V(o)),f={type:"Polygon",coordinates:e},h=ye((0,Te.geoBounds)(f),2),v=ye(h[0],2),d=v[0],b=v[1],g=ye(h[1],2),x=g[0],_=g[1],u=d>x||_>=89||b<=-89,m=[];if(u){var j=(0,Wt.geoVoronoi)(s).triangles(),z=new Map(s.map(function(N,Me){var _e=ye(N,2),be=_e[0],Be=_e[1];return["".concat(be,"-").concat(Be),Me]}));j.features.forEach(function(N){var Me,_e=N.geometry.coordinates[0].slice(0,3).reverse(),be=[];if(_e.forEach(function(Ge){var Ae=ye(Ge,2),Ke=Ae[0],Ht=Ae[1],at="".concat(Ke,"-").concat(Ht);z.has(at)&&be.push(z.get(at))}),be.length===3){if(be.some(function(Ge){return Ge<t.length})){var Be=N.properties.circumcenter;if(!Ze(Be,f,u))return}(Me=m).push.apply(Me,V(be))}})}else if(o.length)for(var le=function(N,Me){var _e,be=[2,1,0].map(function(Ae){return me.triangles[N+Ae]}),Be=be.map(function(Ae){return s[Ae]});if(be.some(function(Ae){return Ae<t.length})){var Ge=[0,1].map(function(Ae){return(0,ke.mean)(Be,function(Ke){return Ke[Ae]})});if(!Ze(Ge,f,u))return"continue"}(_e=m).push.apply(_e,V(be))},me=kt.default.from(s),he=0,Se=me.triangles.length;he<Se;he+=3)le(he,Se);else{var A=Ie.default.flatten(a),te=A.vertices,X=A.holes,re=X===void 0?[]:X;m=(0,Ie.default)(te,re,2)}var ne=(0,Qe.scaleLinear)((0,ke.extent)(s,function(N){return N[0]}),[0,1]),Ee=(0,Qe.scaleLinear)((0,ke.extent)(s,function(N){return N[1]}),[0,1]),Re=s.map(function(N){var Me=ye(N,2),_e=Me[0],be=Me[1];return[ne(_e),Ee(be)]}),it={points:s,indices:m,uvs:Re};return{contour:a,triangles:it}}var It=Nt,qe=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=ye(t,2),s=o[0],f=o[1];return r?Lt(s,f,n):[s,f,n]})});return Ie.default.flatten(i)}function et(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),f=s.vertices,h=(0,ke.merge)([f,t]),v=Math.round(f.length/3),d=new Set(o),b=0,g=[],x=0;x<v;x++){var _=x+1;if(_===v)_=b;else if(d.has(_)){var u=_;_=b,b=u}g.push(x,x+v,_+v),g.push(_+v,_,x)}for(var m=[],j=1;j>=0;j--)for(var z=0;z<v;z+=1)m.push(z/(v-1),j);return{indices:g,vertices:h,uvs:m,topVerts:f}}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:Fe([e.points],n,a).vertices,uvs:r}}var Zt=function(e){"use strict";P(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,w.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,f=o.endHeight,h=o.closedBottom,v=o.closedTop,d=o.includeSides,b=o.curvatureResolution,g=o.cartesian,x=o.userDataRsoOffset;(0,Et.default)(i[0])||i[0].reverse();var _=It(i,{resolution:b}),u=_.contour,m=_.triangles,j=(0,ke.merge)(m.uvs),z=[],A=[],te=[],X=0,re=function(me){var he=Math.round(z.length/3),Se=te.length;z=z.concat(me.vertices),A=A.concat(me.uvs),te=te.concat(he?me.indices.map(function(ne){return ne+he}):me.indices),t.addGroup(Se,te.length-Se,X++)};if(d){var le=et(u,s,f,g);re(le),t.userData.rso=x?et(u,s,f+x,g):le}return h&&re(tt(m,s,j,!1,g)),v&&re(tt(m,f,j,!0,g)),t.setIndex(te),t[qe]("position",new c.Float32BufferAttribute(z,3)),t[qe]("uv",new c.Float32BufferAttribute(A,2)),t.computeVertexNormals(),t}return r}(c.BufferGeometry),Ft=function(e){"use strict";P(r,e);var n=k(r);function r(a){T(this,r);var t;return t=n.call(this),t.options=(0,w.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,f=t.closedBottom,h=t.closedTop,v=t.curvatureResolution,d=t.userDataRsoOffset,b=t.cartesian,g=new Zt(this.options.geojson,{startHeight:o,endHeight:o+s,closedBottom:f,closedTop:h,curvatureResolution:v,cartesian:b,userDataRsoOffset:d});this.createMesh(g,this.options.material)},r}(q),rt=I(705);function nt(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,rt.y)({split:n,box3:a})});return(0,rt.C)(),t}var Kt=function(e){"use strict";P(r,e);var n=k(r);function r(a){T(this,r);var t;return t=n.call(this),t.options=$e((0,w.Z)({depth:1},a),{materialOptions:(0,w.Z)({},{split:.1},a.materialOptions||{})}),t}var i=r.prototype;return i.create=function(){var t=this;return(0,S.Z)(G().mark(function o(){var s,f,h,v,d,b,g,x,_,u,m,j,z,A,te,X,re,le,me,he,Se,ne,Ee,Re;return G().wrap(function(N){for(;;)switch(N.prev=N.next){case 0:if(s=t.options,f=s.points,h=s.pointsArr,v=s.useGroups,d=s.depth,b=s.geometry,g=s.geometryArr,x=s.material,_=s.materialOptions,u=s.cache,m=s.box3,j=0,z=Array.isArray(d)?d:[d],A=Array.isArray(m)?m:[m],te=x,X=b,!(!te&&_)){N.next=26;break}if(j=_.split,re=_.topColor,le=_.sideColor,me=_.sideMap,he="ExtrudePolygonMaterial:".concat(le||me).concat(re||""),!(u&&!u.get(he))){N.next=16;break}return u.init(he),N.next=14,t.getMaterial(_);case 14:Se=N.sent,u.set(he,Se);case 16:if(!u){N.next=22;break}return N.next=19,u.get(he);case 19:N.t0=N.sent,N.next=25;break;case 22:return N.next=24,t.getMaterial(_);case 24:N.t0=N.sent;case 25:te=N.t0;case 26:!X&&f?X=nt({points:f,depth:z[0],split:j,box3:A[0]}):!X&&h?X=je.mergeBufferGeometries(h.map(function(Me,_e){return nt({points:Me,depth:(ne=z[_e])!==null&&ne!==void 0?ne:z[0],split:j,box3:(Ee=A[_e])!==null&&Ee!==void 0?Ee:A[0]})}),v!=null?v:!1):!X&&g&&g.length>1?X=je.mergeBufferGeometries(g,v!=null?v:!1):!X&&g&&g.length===1&&(Re=ye(g,1),X=Re[0]),t.createMesh(X,te);case 28:case"end":return N.stop()}},o)}))()},i.addGeometries=function(t){var o=this.object3d,s=je.mergeBufferGeometries([o.geometry].concat(V(t)),!1);o.geometry=s},i.getMaterial=function(t){var o=this,s=t.topColor,f=t.sideColor,h=t.sideMap,v=t.type,d=t.parameters,b=t.createCanvasObjectURL,g=t.split,x=t.maxAnisotropy;return new Promise(function(_){var u=h?document.createElement("img"):{src:"",onload:function(){},width:1024,height:1024};u.onload=function(){var m=g,j=document.createElement("canvas"),z=j.getContext("2d");j.height=u.height/(1-m),j.width=u.width,m&&s&&(z.fillStyle=s,z.fillRect(0,0,u.width,j.height*m)),h&&u instanceof HTMLImageElement?z.drawImage(u,0,j.height*m,u.width,u.height):f&&(z.fillStyle=f,z.fillRect(0,j.height*m,u.width,u.height)),b&&j.toBlob(function(X){console.log(URL.createObjectURL(X))});var A=new c.CanvasTexture(j);A.anisotropy=x||o.pencil.renderer.capabilities.getMaxAnisotropy();var te=new c[v||"MeshBasicMaterial"]((0,w.Z)({map:A},d||{}));_(te)},h?u.src=h:u instanceof HTMLImageElement||u.onload()})},i.setMaterialColor=function(t){var o=this;return(0,S.Z)(G().mark(function s(){var f,h,v,d,b,g,x,_,u,m,j;return G().wrap(function(A){for(;;)switch(A.prev=A.next){case 0:if(f=o.options,h=f.materialOptions,v=f.cache,d=h.sideColor,b=h.sideMap,g=h.topColor,x=t.sideColor,_=t.topColor,!(_||x)){A.next=22;break}if(u="ExtrudePolygonMaterial:".concat(x||d||b||"").concat(_||g||""),!(v&&!v.get(u))){A.next=11;break}return v.init(u),A.next=9,o.getMaterial((0,w.Z)({},h,t));case 9:m=A.sent,v.set(u,m);case 11:if(!v){A.next=17;break}return A.next=14,v.get(u);case 14:A.t0=A.sent,A.next=20;break;case 17:return A.next=19,o.getMaterial((0,w.Z)({},h,t));case 19:A.t0=A.sent;case 20:j=A.t0,o.object3d.material=j;case 22:case"end":return A.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(f,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(b){d.setAttribute(b,new c.BufferAttribute(v[b].array,v[b].itemSize))}),f(d)}catch(b){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
+ `),xe=function(e){"use strict";P(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);xe.prototype.setMatrixWorld=function(e){this.matrixWorld=e},xe.prototype.setGeometry=function(e,n){this._geometry=e,this.setPoints(e.getAttribute("position").array,n)},xe.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,f=new c.Vector3,h=new c.Vector3,v=this instanceof c.LineSegments?2:1,d=o.index,b=o.attributes;if(d!==null)for(var y=d.array,A=b.position.array,_=b.width.array,u=0,m=y.length-1;u<m;u+=v){var j=y[u],V=y[u+1];s.fromArray(A,j*3),f.fromArray(A,V*3);var M=_[Math.floor(u/3)]!==void 0?_[Math.floor(u/3)]:1,te=e.params.Line.threshold+this.material.lineWidth*M/2,X=te*te,re=i.distanceSqToSegment(s,f,t,h);if(!(re>X)){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)}}}}xe.prototype.raycast=He,xe.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]},xe.prototype.copyV3=function(e){var n=e*6;return[this.positions[n],this.positions[n+1],this.positions[n+2]]},xe.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}xe.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=vt,c.ShaderChunk.meshline_frag=dt;var Ne=function(e){"use strict";P(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 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 $e(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 ye(e,n){return _t(e)||ee(e,n)||ge(e,n)||bt()}var wt=e=>{var n={};return I.d(n,e),n},yr=e=>()=>e,Ye=wt({animate:()=>ut.animate,linear:()=>ut.linear}),xt=e=>{var n={};return I.d(n,e),n},_r=e=>()=>e,je=xt({mergeBufferGeometries:()=>Jt.mergeBufferGeometries});function Je(e){var n=e.setPointWidth,r=e.nodes,i=new c.BufferGeometry,a=new xe;return i.setFromPoints(r),a.setGeometry(i,n),a}var Mt={color:new c.Color("#ffffff"),lineWidth:1},At=function(e){"use strict";P(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,w.Z)({},Mt,a),t}var i=r.prototype;return i.create=function(){var t=this;return(0,S.Z)(G().mark(function o(){var s,f,h,v,d,b,y,A,_,u,m,j,V,M,te,X,re,le,me,he;return G().wrap(function(ne){for(;;)switch(ne.prev=ne.next){case 0:if(s=t.options,f=s.duration,h=s.delay,v=s.onComplete,d=s.setPointWidth,b=s.key,y=s.nodes,A=s.nodesArr,_=s.geometry,u=s.geometryArr,m=s.useGroups,j=s.material,V=s.cache,M=s.cacheKey,te=yt(s,["duration","delay","onComplete","setPointWidth","key","nodes","nodesArr","geometry","geometryArr","useGroups","material","cache","cacheKey"]),X=j,re=_,X){ne.next=16;break}if(le="LineMaterial:".concat(M),V&&!V.get(le)&&(V.init(le),me=t.getMaterial((0,w.Z)({},te)),V.set(le,me)),!V){ne.next=12;break}return ne.next=9,V.get(le);case 9:ne.t0=ne.sent,ne.next=15;break;case 12:return ne.next=14,t.getMaterial(te);case 14:ne.t0=ne.sent;case 15:X=ne.t0;case 16:!re&&y?re=Je({nodes:y,setPointWidth:d}):!re&&A?re=je.mergeBufferGeometries(A.map(function(Ee){return Je({nodes:Ee,setPointWidth:d})}),m!=null?m:!1):!re&&u&&u.length>1?re=je.mergeBufferGeometries(u,m!=null?m:!1):!re&&u&&u.length===1&&(he=ye(u,1),re=he[0]),t.createMesh(re,X);case 18:case"end":return ne.stop()}},o)}))()},i.getMaterial=function(t){var o=this.pencil.getSize(),s=o.width,f=o.height,h=new Ne($e((0,w.Z)({},t),{resolution:new c.Vector2(s,f)}));return h},i.addGeometries=function(t){var o=this.object3d,s=je.mergeBufferGeometries([o.geometry].concat(D(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,f=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:f,ease:Ye.linear,onUpdate:function(b){h.value.x=b.x}});this.tween=d},i.dispose=function(){var t;De(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 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,f){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:f,cacheVersion:o})}},cacheVersion:o})})}var St=e=>{var n={};return I.d(n,e),n},br=e=>()=>e,ke=St({extent:()=>Xe.extent,mean:()=>Xe.mean,merge:()=>Xe.merge}),Ot=e=>{var n={};return I.d(n,e),n},wr=e=>()=>e,Ie=Ot({default:()=>Qt.default}),Ct=e=>{var n={};return I.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 I.d(n,e),n},Mr=e=>()=>e,kt=jt({default:()=>er.default}),Tt=e=>{var n={};return I.d(n,e),n},Ar=e=>()=>e,Rt=Tt({default:()=>tr.default}),Bt=e=>{var n={};return I.d(n,e),n},Pr=e=>()=>e,Te=Bt({geoBounds:()=>Ve.geoBounds,geoContains:()=>Ve.geoContains,geoDistance:()=>Ve.geoDistance,geoInterpolate:()=>Ve.geoInterpolate}),Gt=e=>{var n={};return I.d(n,e),n},Sr=e=>()=>e,Wt=Gt({geoVoronoi:()=>rr.geoVoronoi}),Vt=e=>{var n={};return I.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),f=1/Math.ceil(o/n),h=f;h<1;)i.push(s(h)),h+=f}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,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},d=[t!==void 0?Math.ceil(v(t)):0,a!==void 0?Math.floor(v(a)):o-1],b=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},y=[],A=d[0];A<=d[1];A++){var _=f(A);b(_)&&y.push([_,h(A)])}return y}function Ze(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=ye((0,Te.geoBounds)(r),2),a=ye(i[0],2),t=a[0],o=a[1],s=ye(i[1],2),f=s[0],h=s[1];if(Math.min(Math.abs(f-t),Math.abs(h-o))<n)return[];var v=t>f||h>=89||o<=-89;return Dt(n,{minLng:t,maxLng:f,minLat:o,maxLat:h}).filter(function(d){return Ze(d,r,v)})}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=D(t).concat(D(o)),f={type:"Polygon",coordinates:e},h=ye((0,Te.geoBounds)(f),2),v=ye(h[0],2),d=v[0],b=v[1],y=ye(h[1],2),A=y[0],_=y[1],u=d>A||_>=89||b<=-89,m=[];if(u){var j=(0,Wt.geoVoronoi)(s).triangles(),V=new Map(s.map(function(N,Me){var _e=ye(N,2),be=_e[0],Be=_e[1];return["".concat(be,"-").concat(Be),Me]}));j.features.forEach(function(N){var Me,_e=N.geometry.coordinates[0].slice(0,3).reverse(),be=[];if(_e.forEach(function(Ge){var Ae=ye(Ge,2),Ke=Ae[0],Ht=Ae[1],at="".concat(Ke,"-").concat(Ht);V.has(at)&&be.push(V.get(at))}),be.length===3){if(be.some(function(Ge){return Ge<t.length})){var Be=N.properties.circumcenter;if(!Ze(Be,f,u))return}(Me=m).push.apply(Me,D(be))}})}else if(o.length)for(var le=function(N,Me){var _e,be=[2,1,0].map(function(Ae){return me.triangles[N+Ae]}),Be=be.map(function(Ae){return s[Ae]});if(be.some(function(Ae){return Ae<t.length})){var Ge=[0,1].map(function(Ae){return(0,ke.mean)(Be,function(Ke){return Ke[Ae]})});if(!Ze(Ge,f,u))return"continue"}(_e=m).push.apply(_e,D(be))},me=kt.default.from(s),he=0,Se=me.triangles.length;he<Se;he+=3)le(he,Se);else{var M=Ie.default.flatten(a),te=M.vertices,X=M.holes,re=X===void 0?[]:X;m=(0,Ie.default)(te,re,2)}var ne=(0,Qe.scaleLinear)((0,ke.extent)(s,function(N){return N[0]}),[0,1]),Ee=(0,Qe.scaleLinear)((0,ke.extent)(s,function(N){return N[1]}),[0,1]),Re=s.map(function(N){var Me=ye(N,2),_e=Me[0],be=Me[1];return[ne(_e),Ee(be)]}),it={points:s,indices:m,uvs:Re};return{contour:a,triangles:it}}var It=Nt,qe=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=ye(t,2),s=o[0],f=o[1];return r?Lt(s,f,n):[s,f,n]})});return Ie.default.flatten(i)}function et(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),f=s.vertices,h=(0,ke.merge)([f,t]),v=Math.round(f.length/3),d=new Set(o),b=0,y=[],A=0;A<v;A++){var _=A+1;if(_===v)_=b;else if(d.has(_)){var u=_;_=b,b=u}y.push(A,A+v,_+v),y.push(_+v,_,A)}for(var m=[],j=1;j>=0;j--)for(var V=0;V<v;V+=1)m.push(V/(v-1),j);return{indices:y,vertices:h,uvs:m,topVerts:f}}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:Fe([e.points],n,a).vertices,uvs:r}}var Zt=function(e){"use strict";P(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,w.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,f=o.endHeight,h=o.closedBottom,v=o.closedTop,d=o.includeSides,b=o.curvatureResolution,y=o.cartesian,A=o.userDataRsoOffset;(0,Et.default)(i[0])||i[0].reverse();var _=It(i,{resolution:b}),u=_.contour,m=_.triangles,j=(0,ke.merge)(m.uvs),V=[],M=[],te=[],X=0,re=function(me){var he=Math.round(V.length/3),Se=te.length;V=V.concat(me.vertices),M=M.concat(me.uvs),te=te.concat(he?me.indices.map(function(ne){return ne+he}):me.indices),t.addGroup(Se,te.length-Se,X++)};if(d){var le=et(u,s,f,y);re(le),t.userData.rso=A?et(u,s,f+A,y):le}return h&&re(tt(m,s,j,!1,y)),v&&re(tt(m,f,j,!0,y)),t.setIndex(te),t[qe]("position",new c.Float32BufferAttribute(V,3)),t[qe]("uv",new c.Float32BufferAttribute(M,2)),t.computeVertexNormals(),t}return r}(c.BufferGeometry),Ft=function(e){"use strict";P(r,e);var n=k(r);function r(a){T(this,r);var t;return t=n.call(this),t.options=(0,w.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,f=t.closedBottom,h=t.closedTop,v=t.curvatureResolution,d=t.userDataRsoOffset,b=t.cartesian,y=new Zt(this.options.geojson,{startHeight:o,endHeight:o+s,closedBottom:f,closedTop:h,curvatureResolution:v,cartesian:b,userDataRsoOffset:d});this.createMesh(y,this.options.material)},r}(q),rt=I(705);function nt(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,rt.y)({split:n,box3:a})});return(0,rt.C)(),t}var Kt=function(e){"use strict";P(r,e);var n=k(r);function r(a){T(this,r);var t;return t=n.call(this),t.options=$e((0,w.Z)({depth:1},a),{materialOptions:(0,w.Z)({},{split:.1},a.materialOptions||{})}),t}var i=r.prototype;return i.create=function(){var t=this;return(0,S.Z)(G().mark(function o(){var s,f,h,v,d,b,y,A,_,u,m,j,V,M,te,X,re,le,me,he,Se,ne,Ee,Re;return G().wrap(function(N){for(;;)switch(N.prev=N.next){case 0:if(s=t.options,f=s.points,h=s.pointsArr,v=s.useGroups,d=s.depth,b=s.geometry,y=s.geometryArr,A=s.material,_=s.materialOptions,u=s.cache,m=s.box3,j=0,V=Array.isArray(d)?d:[d],M=Array.isArray(m)?m:[m],te=A,X=b,!(!te&&_)){N.next=26;break}if(j=_.split,re=_.topColor,le=_.sideColor,me=_.sideMap,he="ExtrudePolygonMaterial:".concat(le||me).concat(re||""),!(u&&!u.get(he))){N.next=16;break}return u.init(he),N.next=14,t.getMaterial(_);case 14:Se=N.sent,u.set(he,Se);case 16:if(!u){N.next=22;break}return N.next=19,u.get(he);case 19:N.t0=N.sent,N.next=25;break;case 22:return N.next=24,t.getMaterial(_);case 24:N.t0=N.sent;case 25:te=N.t0;case 26:!X&&f?X=nt({points:f,depth:V[0],split:j,box3:M[0]}):!X&&h?X=je.mergeBufferGeometries(h.map(function(Me,_e){return nt({points:Me,depth:(ne=V[_e])!==null&&ne!==void 0?ne:V[0],split:j,box3:(Ee=M[_e])!==null&&Ee!==void 0?Ee:M[0]})}),v!=null?v:!1):!X&&y&&y.length>1?X=je.mergeBufferGeometries(y,v!=null?v:!1):!X&&y&&y.length===1&&(Re=ye(y,1),X=Re[0]),t.createMesh(X,te);case 28:case"end":return N.stop()}},o)}))()},i.addGeometries=function(t){var o=this.object3d,s=je.mergeBufferGeometries([o.geometry].concat(D(t)),!1);o.geometry=s},i.getMaterial=function(t){var o=this,s=t.topColor,f=t.sideColor,h=t.sideMap,v=t.type,d=t.parameters,b=t.createCanvasObjectURL,y=t.split,A=t.maxAnisotropy;return new Promise(function(_){var u=h?document.createElement("img"):{src:"",onload:function(){},width:1024,height:1024};u.onload=function(){var m=y,j=document.createElement("canvas"),V=j.getContext("2d");j.height=u.height/(1-m),j.width=u.width,m&&s&&(V.fillStyle=s,V.fillRect(0,0,u.width,j.height*m)),h&&u instanceof HTMLImageElement?V.drawImage(u,0,j.height*m,u.width,u.height):f&&(V.fillStyle=f,V.fillRect(0,j.height*m,u.width,u.height)),b&&j.toBlob(function(X){console.log(URL.createObjectURL(X))});var M=new c.CanvasTexture(j);M.anisotropy=A||o.pencil.renderer.capabilities.getMaxAnisotropy();var te=new c[v||"MeshBasicMaterial"]((0,w.Z)({map:M},d||{}));_(te)},h?u.src=h:u instanceof HTMLImageElement||u.onload()})},i.setMaterialColor=function(t){var o=this;return(0,S.Z)(G().mark(function s(){var f,h,v,d,b,y,A,_,u,m,j;return G().wrap(function(M){for(;;)switch(M.prev=M.next){case 0:if(f=o.options,h=f.materialOptions,v=f.cache,d=h.sideColor,b=h.sideMap,y=h.topColor,A=t.sideColor,_=t.topColor,!(_||A)){M.next=22;break}if(u="ExtrudePolygonMaterial:".concat(A||d||b||"").concat(_||y||""),!(v&&!v.get(u))){M.next=11;break}return v.init(u),M.next=9,o.getMaterial((0,w.Z)({},h,t));case 9:m=M.sent,v.set(u,m);case 11:if(!v){M.next=17;break}return M.next=14,v.get(u);case 14:M.t0=M.sent,M.next=20;break;case 17:return M.next=19,o.getMaterial((0,w.Z)({},h,t));case 19:M.t0=M.sent;case 20:j=M.t0,o.object3d.material=j;case 22:case"end":return M.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(f,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(b){d.setAttribute(b,new c.BufferAttribute(v[b].array,v[b].itemSize))}),f(d)}catch(b){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};
@@ -10,13 +10,13 @@ interface Options {
10
10
  eventTarge?: string[];
11
11
  handler?: (event: Event) => void;
12
12
  handler2?: (event: Event) => void;
13
- zIndexFix?: number;
14
13
  }
15
14
  export declare class Node extends BaseObject {
16
15
  options: Options;
17
16
  pickObject?: THREE.Sprite;
18
17
  object3d: CSS2DObject;
19
18
  element: HTMLDivElement;
19
+ type_: string;
20
20
  constructor(options: Options);
21
21
  get clickTarge(): HTMLDivElement[];
22
22
  create(): void;
@@ -1 +1 @@
1
- (function(){var X={666:function(_){var g=function(v){"use strict";var C=Object.prototype,T=C.hasOwnProperty,d,O=typeof Symbol=="function"?Symbol:{},w=O.iterator||"@@iterator",L=O.asyncIterator||"@@asyncIterator",k=O.toStringTag||"@@toStringTag";function p(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{p({},"")}catch(e){p=function(t,n,l){return t[n]=l}}function R(e,t,n,l){var u=t&&t.prototype instanceof V?t:V,b=Object.create(u.prototype),S=new h(l||[]);return b._invoke=r(e,n,S),b}v.wrap=R;function x(e,t,n){try{return{type:"normal",arg:e.call(t,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 A={};p(A,w,function(){return this});var D=Object.getPrototypeOf,G=D&&D(D(j([])));G&&G!==C&&T.call(G,w)&&(A=G);var a=m.prototype=V.prototype=Object.create(A);y.prototype=m,p(a,"constructor",m),p(m,"constructor",y),y.displayName=p(m,k,"GeneratorFunction");function i(e){["next","throw","return"].forEach(function(t){p(e,t,function(n){return this._invoke(t,n)})})}v.isGeneratorFunction=function(e){var t=typeof e=="function"&&e.constructor;return t?t===y||(t.displayName||t.name)==="GeneratorFunction":!1},v.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,p(e,k,"GeneratorFunction")),e.prototype=Object.create(a),e},v.awrap=function(e){return{__await:e}};function s(e,t){function n(b,S,M,B){var I=x(e[b],e,S);if(I.type==="throw")B(I.arg);else{var $=I.arg,F=$.value;return F&&typeof F=="object"&&T.call(F,"__await")?t.resolve(F.__await).then(function(W){n("next",W,M,B)},function(W){n("throw",W,M,B)}):t.resolve(F).then(function(W){$.value=W,M($)},function(W){return n("throw",W,M,B)})}}var l;function u(b,S){function M(){return new t(function(B,I){n(b,S,B,I)})}return l=l?l.then(M,M):M()}this._invoke=u}i(s.prototype),p(s.prototype,L,function(){return this}),v.AsyncIterator=s,v.async=function(e,t,n,l,u){u===void 0&&(u=Promise);var b=new s(R(e,t,n,l),u);return v.isGeneratorFunction(t)?b:b.next().then(function(S){return S.done?S.value:b.next()})};function r(e,t,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 P()}for(n.method=b,n.arg=S;;){var M=n.delegate;if(M){var B=o(M,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(e,t,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(e,t){var n=e.iterator[t.method];if(n===d){if(t.delegate=null,t.method==="throw"){if(e.iterator.return&&(t.method="return",t.arg=d,o(e,t),t.method==="throw"))return E;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return E}var l=x(n,e.iterator,t.arg);if(l.type==="throw")return t.method="throw",t.arg=l.arg,t.delegate=null,E;var u=l.arg;if(!u)return t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,E;if(u.done)t[e.resultName]=u.value,t.next=e.nextLoc,t.method!=="return"&&(t.method="next",t.arg=d);else return u;return t.delegate=null,E}i(a),p(a,k,"Generator"),p(a,w,function(){return this}),p(a,"toString",function(){return"[object Generator]"});function f(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function c(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function h(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(f,this),this.reset(!0)}v.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function l(){for(;t.length;){var u=t.pop();if(u in e)return l.value=u,l.done=!1,l}return l.done=!0,l}};function j(e){if(e){var t=e[w];if(t)return t.call(e);if(typeof e.next=="function")return e;if(!isNaN(e.length)){var n=-1,l=function u(){for(;++n<e.length;)if(T.call(e,n))return u.value=e[n],u.done=!1,u;return u.value=d,u.done=!0,u};return l.next=l}}return{next:P}}v.values=j;function P(){return{value:d,done:!0}}return h.prototype={constructor:h,reset:function(e){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),!e)for(var t in this)t.charAt(0)==="t"&&T.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=d)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if(t.type==="throw")throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(B,I){return b.type="throw",b.arg=e,t.next=B,I&&(t.method="next",t.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"),M=T.call(u,"finallyLoc");if(S&&M){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(M){if(this.prev<u.finallyLoc)return n(u.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(e,t){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&&(e==="break"||e==="continue")&&u.tryLoc<=t&&t<=u.finallyLoc&&(u=null);var b=u?u.completion:{};return b.type=e,b.arg=t,u?(this.method="next",this.next=u.finallyLoc,E):this.complete(b)},complete:function(e,t){if(e.type==="throw")throw e.arg;return e.type==="break"||e.type==="continue"?this.next=e.arg:e.type==="return"?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):e.type==="normal"&&t&&(this.next=t),E},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),c(n),E}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var l=n.completion;if(l.type==="throw"){var u=l.arg;c(n)}return u}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:j(e),resultName:t,nextLoc:n},this.method==="next"&&(this.arg=d),E}},v}(_.exports);try{regeneratorRuntime=g}catch(v){typeof globalThis=="object"?globalThis.regeneratorRuntime=g:Function("r","regeneratorRuntime = r")(g)}},584:function(_,g,v){"use strict";v.d(g,{makePromiseCreator:function(){return C.Z}});var C=v(282),T=v(666),d=v.n(T),O=null,w=v(644);function L(E){if(E.material){var V=Array.isArray(E.material)?E.material:[E.material];V.forEach(function(y){var m,A;(m=y.color)===null||m===void 0||m.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=v(568),p=v(924),R=v(360),x=v(484),z=null,N=null,Z=function(){var E=(0,k.Z)(d().mark(function V(y,m){var A,D,G,a,i,s,r,o,f;return d().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:return A=m.type,D=A===void 0?"blob":A,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(j){if(j.ok)return j[D]();throw new Error}));case 11:r=h.sent,o=r.res,f=r.err,f||(i=o,(0,R.set)(y,(0,p.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=v(705)},282:function(_,g,v){"use strict";v.d(g,{Z:function(){return T}});var C=v(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,k){w.resolve=L,w.reject=k}),d&&(w.promise=(0,C.Z)(w.promise,O)),w}},484:function(_,g,v){"use strict";v.d(g,{Z:function(){return T}});var C=v(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,v){"use strict";var C=v(644),T=v.n(C),d=new Map,O=function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{generateTopUV:function(k,p,R,x,z){var N=p[R*3],Z=p[R*3+1],H=p[x*3],E=p[x*3+1],V=p[z*3],y=p[z*3+1],m;if(d.has(k))m=d.get(k);else{var A=L.box3||new THREE.Box3;if(!L.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);L.split&&(G.y/=L.split),m={box:A,size:G},d.set(k,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(k,p,R,x,z,N){var Z=p[R*3],H=p[R*3+1],E=p[R*3+2],V=p[x*3],y=p[x*3+1],m=p[x*3+2],A=p[z*3],D=p[z*3+1],G=p[z*3+2],a=p[N*3],i=p[N*3+1],s=p[N*3+2],r;if(d.has(p))r=d.get(p);else{var o=new THREE.Box3;o.setFromArray(p);var f=o.getSize(new THREE.Vector3);L.split&&(f.z/=1-L.split),r={box:o,size:f},d.set(p,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((A-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,v){"use strict";v.d(g,{Z:function(){return T}});function C(d,O,w,L,k,p,R){try{var x=d[p](R),z=x.value}catch(N){w(N);return}x.done?O(z):Promise.resolve(z).then(L,k)}function T(d){return function(){var O=this,w=arguments;return new Promise(function(L,k){var p=d.apply(O,w);function R(z){C(p,L,k,R,x,"next",z)}function x(z){C(p,L,k,R,x,"throw",z)}R(void 0)})}}},924:function(_,g,v){"use strict";v.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,v){"use strict";v.d(g,{Z:function(){return T}});var C=v(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(k){return Object.getOwnPropertyDescriptor(w,k).enumerable}))),L.forEach(function(k){(0,C.Z)(d,k,w[k])})}return d}}},Y={};function U(_){var g=Y[_];if(g!==void 0)return g.exports;var v=Y[_]={exports:{}};return X[_](v,v.exports,U),v.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 v in g)U.o(g,v)&&!U.o(_,v)&&Object.defineProperty(_,v,{enumerable:!0,get:g[v]})}}(),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 v},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),v=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 k(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 p(a,i){if(!!a){if(typeof a=="string")return k(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 k(a,i)}}function R(a,i){return O(a)||w(a,i)||p(a,i)||L()}function x(a){if(Array.isArray(a))return k(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)||p(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 j=h.prototype;return j.create=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new o[f](e)},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(j,P){(P.startsWith("".concat(c,"#"))||P===c)&&h.push(j)}),h},i.draw=function(r,o,f){var c=this;return(0,C.Z)(H().mark(function h(){var j,P,e,t,n,l,u,b;return H().wrap(function(M){for(;;)switch(M.prev=M.next){case 0:if(j=c.objectNamesToFactories.get(r),!j){M.next=16;break}return P=(o||{}).key,e="".concat(r).concat(P?"#".concat(P):""),c.objects.has(e)&&(t=E.MathUtils.generateUUID(),e+="#".concat(t)),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 j().create(o),b.pencil=c.pencil,b.key=e,c.objects.set(e,b),M.next=15,c.addMesh(b,u,l);case 15:return M.abrupt("return",b);case 16:throw new Error("Unrecognized:".concat(r));case 17:case"end":return M.stop()}},h)}))()},i.addMesh=function(r,o,f){var c=this;return(0,C.Z)(H().mark(function h(){var j,P;return H().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.create();case 2:r.object3d&&(r.object3d.userData.BaseObject_=r,f&&(j=1e3+f*2,c.onTopBase.has(j-1)||(P=new E.Points,P.renderOrder=j-1,P.onBeforeRender=function(){c.pencil.renderer.clearDepth()},P.frustumCulled=!1,c.onTopBase.set(j-1,!0),c.pencil.scene.add(P)),r.object3d.renderOrder=j),o.add(r.object3d)),r.visible=!0,r.render(),r.pm.resolve();case 6:case"end":return t.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 j=[];if(typeof h=="string"){var P,e=R(h.split("#"),2),t=e[0],n=e[1];(P=j).push.apply(P,N(c.getAllObject(t,{key:n})))}else j.push(h);j.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),A=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,A.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,j=c.cacheVersion;this.workerList=Array.from({length:o},function(P,e){var t=typeof r=="string"?new Worker(r):r();return t.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[e].inUse=!1,f.checkMessage(),h){var M=(S==null?void 0:S.options.cacheVersion)||j;(0,D.set)(b,(0,m.Z)({},M,u))}},{worker:t,inUse:!1}})},i.postMessage=function(r,o){var f=this,c=this.options,h=c.cache,j=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 P=r.workerKey||E.MathUtils.generateUUID();(h?(0,D.get)(P):Promise.resolve()).then(function(e){var t=o.cacheVersion||j;e&&e[t]?o.cb(e[t]):(f.messageList.push({req:r,options:o,uuid:P,inUse:!1}),f.checkMessage())}).catch(function(){console.warn("err:worker cache"),f.messageList.push({req:r,options:o,uuid:P,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(_){var g=function(v){"use strict";var C=Object.prototype,T=C.hasOwnProperty,d,O=typeof Symbol=="function"?Symbol:{},w=O.iterator||"@@iterator",L=O.asyncIterator||"@@asyncIterator",k=O.toStringTag||"@@toStringTag";function p(r,t,n){return Object.defineProperty(r,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),r[t]}try{p({},"")}catch(r){p=function(t,n,l){return t[n]=l}}function R(r,t,n,l){var u=t&&t.prototype instanceof V?t:V,b=Object.create(u.prototype),S=new h(l||[]);return b._invoke=e(r,n,S),b}v.wrap=R;function x(r,t,n){try{return{type:"normal",arg:r.call(t,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 A={};p(A,w,function(){return this});var D=Object.getPrototypeOf,G=D&&D(D(j([])));G&&G!==C&&T.call(G,w)&&(A=G);var a=m.prototype=V.prototype=Object.create(A);y.prototype=m,p(a,"constructor",m),p(m,"constructor",y),y.displayName=p(m,k,"GeneratorFunction");function i(r){["next","throw","return"].forEach(function(t){p(r,t,function(n){return this._invoke(t,n)})})}v.isGeneratorFunction=function(r){var t=typeof r=="function"&&r.constructor;return t?t===y||(t.displayName||t.name)==="GeneratorFunction":!1},v.mark=function(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,m):(r.__proto__=m,p(r,k,"GeneratorFunction")),r.prototype=Object.create(a),r},v.awrap=function(r){return{__await:r}};function s(r,t){function n(b,S,M,B){var I=x(r[b],r,S);if(I.type==="throw")B(I.arg);else{var $=I.arg,F=$.value;return F&&typeof F=="object"&&T.call(F,"__await")?t.resolve(F.__await).then(function(W){n("next",W,M,B)},function(W){n("throw",W,M,B)}):t.resolve(F).then(function(W){$.value=W,M($)},function(W){return n("throw",W,M,B)})}}var l;function u(b,S){function M(){return new t(function(B,I){n(b,S,B,I)})}return l=l?l.then(M,M):M()}this._invoke=u}i(s.prototype),p(s.prototype,L,function(){return this}),v.AsyncIterator=s,v.async=function(r,t,n,l,u){u===void 0&&(u=Promise);var b=new s(R(r,t,n,l),u);return v.isGeneratorFunction(t)?b:b.next().then(function(S){return S.done?S.value:b.next()})};function e(r,t,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 P()}for(n.method=b,n.arg=S;;){var M=n.delegate;if(M){var B=o(M,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(r,t,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(r,t){var n=r.iterator[t.method];if(n===d){if(t.delegate=null,t.method==="throw"){if(r.iterator.return&&(t.method="return",t.arg=d,o(r,t),t.method==="throw"))return E;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return E}var l=x(n,r.iterator,t.arg);if(l.type==="throw")return t.method="throw",t.arg=l.arg,t.delegate=null,E;var u=l.arg;if(!u)return t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,E;if(u.done)t[r.resultName]=u.value,t.next=r.nextLoc,t.method!=="return"&&(t.method="next",t.arg=d);else return u;return t.delegate=null,E}i(a),p(a,k,"Generator"),p(a,w,function(){return this}),p(a,"toString",function(){return"[object Generator]"});function f(r){var t={tryLoc:r[0]};1 in r&&(t.catchLoc=r[1]),2 in r&&(t.finallyLoc=r[2],t.afterLoc=r[3]),this.tryEntries.push(t)}function c(r){var t=r.completion||{};t.type="normal",delete t.arg,r.completion=t}function h(r){this.tryEntries=[{tryLoc:"root"}],r.forEach(f,this),this.reset(!0)}v.keys=function(r){var t=[];for(var n in r)t.push(n);return t.reverse(),function l(){for(;t.length;){var u=t.pop();if(u in r)return l.value=u,l.done=!1,l}return l.done=!0,l}};function j(r){if(r){var t=r[w];if(t)return t.call(r);if(typeof r.next=="function")return r;if(!isNaN(r.length)){var n=-1,l=function u(){for(;++n<r.length;)if(T.call(r,n))return u.value=r[n],u.done=!1,u;return u.value=d,u.done=!0,u};return l.next=l}}return{next:P}}v.values=j;function P(){return{value:d,done:!0}}return h.prototype={constructor:h,reset:function(r){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),!r)for(var t in this)t.charAt(0)==="t"&&T.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=d)},stop:function(){this.done=!0;var r=this.tryEntries[0],t=r.completion;if(t.type==="throw")throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var t=this;function n(B,I){return b.type="throw",b.arg=r,t.next=B,I&&(t.method="next",t.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"),M=T.call(u,"finallyLoc");if(S&&M){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(M){if(this.prev<u.finallyLoc)return n(u.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(r,t){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&&(r==="break"||r==="continue")&&u.tryLoc<=t&&t<=u.finallyLoc&&(u=null);var b=u?u.completion:{};return b.type=r,b.arg=t,u?(this.method="next",this.next=u.finallyLoc,E):this.complete(b)},complete:function(r,t){if(r.type==="throw")throw r.arg;return r.type==="break"||r.type==="continue"?this.next=r.arg:r.type==="return"?(this.rval=this.arg=r.arg,this.method="return",this.next="end"):r.type==="normal"&&t&&(this.next=t),E},finish:function(r){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===r)return this.complete(n.completion,n.afterLoc),c(n),E}},catch:function(r){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===r){var l=n.completion;if(l.type==="throw"){var u=l.arg;c(n)}return u}}throw new Error("illegal catch attempt")},delegateYield:function(r,t,n){return this.delegate={iterator:j(r),resultName:t,nextLoc:n},this.method==="next"&&(this.arg=d),E}},v}(_.exports);try{regeneratorRuntime=g}catch(v){typeof globalThis=="object"?globalThis.regeneratorRuntime=g:Function("r","regeneratorRuntime = r")(g)}},584:function(_,g,v){"use strict";v.d(g,{makePromiseCreator:function(){return C.Z}});var C=v(282),T=v(666),d=v.n(T),O=null,w=v(644);function L(E){if(E.material){var V=Array.isArray(E.material)?E.material:[E.material];V.forEach(function(y){var m,A;(m=y.color)===null||m===void 0||m.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=v(568),p=v(924),R=v(360),x=v(484),z=null,N=null,Z=function(){var E=(0,k.Z)(d().mark(function V(y,m){var A,D,G,a,i,s,e,o,f;return d().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:return A=m.type,D=A===void 0?"blob":A,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(j){if(j.ok)return j[D]();throw new Error}));case 11:e=h.sent,o=e.res,f=e.err,f||(i=o,(0,R.set)(y,(0,p.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=v(705)},282:function(_,g,v){"use strict";v.d(g,{Z:function(){return T}});var C=v(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,k){w.resolve=L,w.reject=k}),d&&(w.promise=(0,C.Z)(w.promise,O)),w}},484:function(_,g,v){"use strict";v.d(g,{Z:function(){return T}});var C=v(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,v){"use strict";var C=v(644),T=v.n(C),d=new Map,O=function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{generateTopUV:function(k,p,R,x,z){var N=p[R*3],Z=p[R*3+1],H=p[x*3],E=p[x*3+1],V=p[z*3],y=p[z*3+1],m;if(d.has(k))m=d.get(k);else{var A=L.box3||new THREE.Box3;if(!L.box3){var D=k.parameters.shapes.getPoints();A.setFromArray(D.map(function(e){return[e.x,e.y,0]}).flat())}var G=A.getSize(new THREE.Vector3);L.split&&(G.y/=L.split),m={box:A,size:G},d.set(k,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(k,p,R,x,z,N){var Z=p[R*3],H=p[R*3+1],E=p[R*3+2],V=p[x*3],y=p[x*3+1],m=p[x*3+2],A=p[z*3],D=p[z*3+1],G=p[z*3+2],a=p[N*3],i=p[N*3+1],s=p[N*3+2],e;if(d.has(p))e=d.get(p);else{var o=new THREE.Box3;o.setFromArray(p);var f=o.getSize(new THREE.Vector3);L.split&&(f.z/=1-L.split),e={box:o,size:f},d.set(p,e)}var c=e.box,h=e.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((A-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,v){"use strict";v.d(g,{Z:function(){return T}});function C(d,O,w,L,k,p,R){try{var x=d[p](R),z=x.value}catch(N){w(N);return}x.done?O(z):Promise.resolve(z).then(L,k)}function T(d){return function(){var O=this,w=arguments;return new Promise(function(L,k){var p=d.apply(O,w);function R(z){C(p,L,k,R,x,"next",z)}function x(z){C(p,L,k,R,x,"throw",z)}R(void 0)})}}},924:function(_,g,v){"use strict";v.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,v){"use strict";v.d(g,{Z:function(){return T}});var C=v(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(k){return Object.getOwnPropertyDescriptor(w,k).enumerable}))),L.forEach(function(k){(0,C.Z)(d,k,w[k])})}return d}}},Y={};function U(_){var g=Y[_];if(g!==void 0)return g.exports;var v=Y[_]={exports:{}};return X[_](v,v.exports,U),v.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 v in g)U.o(g,v)&&!U.o(_,v)&&Object.defineProperty(_,v,{enumerable:!0,get:g[v]})}}(),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 v},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),v=function(){"use strict";function a(){_(this,a),this.cache=new Map}var i=a.prototype;return i.install=function(){},i.init=function(e){var o=(0,g.makePromiseCreator)();this.cache.set(e,o)},i.get=function(e){var o;return(o=this.cache.get(e))===null||o===void 0?void 0:o.promise},i.set=function(e,o){var f=this.cache.get(e);f?f.resolve(o):console.warn("init cache first")},i.dispose=function(){this.cache.forEach(function(e,o){e.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 e=i[s];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(a,e.key,e)}}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 k(a,i){(i==null||i>a.length)&&(i=a.length);for(var s=0,e=new Array(i);s<i;s++)e[s]=a[s];return e}function p(a,i){if(!!a){if(typeof a=="string")return k(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 k(a,i)}}function R(a,i){return O(a)||w(a,i)||p(a,i)||L()}function x(a){if(Array.isArray(a))return k(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)||p(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(e){this.pencil=e,this.initObjectFactories()},i.initObjectFactories=function(){var e=this,o=this.objects_;Object.keys(o).forEach(function(f){var c=function(){function h(){_(this,h)}var j=h.prototype;return j.create=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new o[f](r)},h}();e.objectNamesToFactories.set(f,c)})},i.getObject=function(e,o){e.includes("#")&&console.warn("getObject:err:\u4E0D\u652F\u6301 #",e);var f=(o||{}).key,c="".concat(e).concat(f?"#".concat(f):""),h=this.objects.get(c);return h},i.getAllObject=function(e,o){e.includes("#")&&console.warn("getAllObject:err:\u4E0D\u652F\u6301 #",e);var f=(o||{}).key,c="".concat(e).concat(f?"#".concat(f):""),h=[];return this.objects.forEach(function(j,P){(P.startsWith("".concat(c,"#"))||P===c)&&h.push(j)}),h},i.draw=function(e,o,f){var c=this;return(0,C.Z)(H().mark(function h(){var j,P,r,t,n,l,u,b;return H().wrap(function(M){for(;;)switch(M.prev=M.next){case 0:if(j=c.objectNamesToFactories.get(e),!j){M.next=16;break}return P=(o||{}).key,r="".concat(e).concat(P?"#".concat(P):""),c.objects.has(r)&&(t=E.MathUtils.generateUUID(),r+="#".concat(t)),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 j().create(o),b.pencil=c.pencil,b.key=r,c.objects.set(r,b),M.next=15,c.addMesh(b,u,l);case 15:return M.abrupt("return",b);case 16:throw new Error("Unrecognized:".concat(e));case 17:case"end":return M.stop()}},h)}))()},i.addMesh=function(e,o,f){var c=this;return(0,C.Z)(H().mark(function h(){var j,P;return H().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.create();case 2:e.object3d&&(e.object3d.userData.BaseObject_=e,f&&(e.type_==="node"?e.object3d.renderOrder=f:(j=1e3+f*2,c.onTopBase.has(j-1)||(P=new E.Points,P.renderOrder=j-1,P.onBeforeRender=function(){c.pencil.renderer.clearDepth()},P.frustumCulled=!1,c.onTopBase.set(j-1,!0),c.pencil.scene.add(P)),e.object3d.renderOrder=j)),o.add(e.object3d)),e.visible=!0,e.render(),e.pm.resolve();case 6:case"end":return t.stop()}},h)}))()},i.erase=function(){for(var e=arguments.length,o=new Array(e),f=0;f<e;f++)o[f]=arguments[f];var c=this;N(o).forEach(function(h){var j=[];if(typeof h=="string"){var P,r=R(h.split("#"),2),t=r[0],n=r[1];(P=j).push.apply(P,N(c.getAllObject(t,{key:n})))}else j.push(h);j.forEach(function(l){c.removeMesh(l)})})},i.removeMesh=function(e){var o=this,f=e.parent;e.object3d&&f.remove(e.object3d),e.traverse(function(c){c.visible=!1,c.dispose(),o.objects.delete(c.key)})},i.update=function(e,o){this.objects.forEach(function(f){f.update(e,o)})},i.setSize=function(e,o){this.objects.forEach(function(f){f.resize(e,o)})},i.dispose=function(){this.objects.forEach(function(e,o){e.dispose(),e.pm.reject("stop draw:".concat(o))}),this.objects.clear(),this.onTopBase.clear(),this.objectNamesToFactories.clear()},d(a,[{key:"objectsPromise",get:function(){var e=[];return this.objects.forEach(function(o){e.push(o.pm.promise)}),e}}]),a}(),y=function(){"use strict";function a(){_(this,a),this.data={}}var i=a.prototype;return i.install=function(){},i.setData=function(e,o){var f,c;this.data[e]=o,(c=(f=this).cb)===null||c===void 0||c.call(f,e)},i.runAll=function(){var e=this;Object.keys(this.data).forEach(function(o){var f,c;(c=(f=e).cb)===null||c===void 0||c.call(f,o)})},i.dispose=function(){this.data={},this.cb=void 0},a}(),m=U(924),A=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,A.Z)({},{cache:!1,cacheVersion:"1"},s)}var i=a.prototype;return i.install=function(){},i.init=function(e,o){var f=this,c=this.options,h=c.cache,j=c.cacheVersion;this.workerList=Array.from({length:o},function(P,r){var t=typeof e=="string"?new Worker(e):e();return t.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[r].inUse=!1,f.checkMessage(),h){var M=(S==null?void 0:S.options.cacheVersion)||j;(0,D.set)(b,(0,m.Z)({},M,u))}},{worker:t,inUse:!1}})},i.postMessage=function(e,o){var f=this,c=this.options,h=c.cache,j=c.cacheVersion;if(h&&!e.workerKey){console.warn("worker cache need workerKey");return}if(h&&e.workerKey&&e.delCache){console.warn("worker cache del: ".concat(e.workerKey)),(0,D.del)(e.workerKey);return}var P=e.workerKey||E.MathUtils.generateUUID();(h?(0,D.get)(P):Promise.resolve()).then(function(r){var t=o.cacheVersion||j;r&&r[t]?o.cb(r[t]):(f.messageList.push({req:e,options:o,uuid:P,inUse:!1}),f.checkMessage())}).catch(function(){console.warn("err:worker cache"),f.messageList.push({req:e,options:o,uuid:P,inUse:!1}),f.checkMessage()})},i.checkMessage=function(){var e=this.workerList.find(function(f){var c=f.inUse;return!c});if(e){var o=this.messageList.find(function(f){var c=f.inUse;return!c});o&&(o.inUse=!0,e.inUse=!0,e.worker.postMessage({req:o.req,uuid:o.uuid}))}},i.dispose=function(){this.workerList.forEach(function(e){var o=e.worker;o.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(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{k({},"")}catch(e){k=function(t,n,l){return t[n]=l}}function R(e,t,n,l){var f=t&&t.prototype instanceof D?t:D,E=Object.create(f.prototype),M=new y(l||[]);return E._invoke=r(e,n,M),E}h.wrap=R;function U(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(l){return{type:"throw",arg:l}}}var G="suspendedStart",W="suspendedYield",B="executing",I="completed",T={};function D(){}function _(){}function j(){}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=j.prototype=D.prototype=Object.create(C);_.prototype=j,k(a,"constructor",j),k(j,"constructor",_),_.displayName=k(j,p,"GeneratorFunction");function u(e){["next","throw","return"].forEach(function(t){k(e,t,function(n){return this._invoke(t,n)})})}h.isGeneratorFunction=function(e){var t=typeof e=="function"&&e.constructor;return t?t===_||(t.displayName||t.name)==="GeneratorFunction":!1},h.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,j):(e.__proto__=j,k(e,p,"GeneratorFunction")),e.prototype=Object.create(a),e},h.awrap=function(e){return{__await:e}};function o(e,t){function n(E,M,P,N){var V=U(e[E],e,M);if(V.type==="throw")N(V.arg);else{var $=V.arg,F=$.value;return F&&typeof F=="object"&&m.call(F,"__await")?t.resolve(F.__await).then(function(Z){n("next",Z,P,N)},function(Z){n("throw",Z,P,N)}):t.resolve(F).then(function(Z){$.value=Z,P($)},function(Z){return n("throw",Z,P,N)})}}var l;function f(E,M){function P(){return new t(function(N,V){n(E,M,N,V)})}return l=l?l.then(P,P):P()}this._invoke=f}u(o.prototype),k(o.prototype,x,function(){return this}),h.AsyncIterator=o,h.async=function(e,t,n,l,f){f===void 0&&(f=Promise);var E=new o(R(e,t,n,l),f);return h.isGeneratorFunction(t)?E:E.next().then(function(M){return M.done?M.value:E.next()})};function r(e,t,n){var l=G;return function(E,M){if(l===B)throw new Error("Generator is already running");if(l===I){if(E==="throw")throw M;return A()}for(n.method=E,n.arg=M;;){var P=n.delegate;if(P){var N=i(P,n);if(N){if(N===T)continue;return N}}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=B;var V=U(e,t,n);if(V.type==="normal"){if(l=n.done?I:W,V.arg===T)continue;return{value:V.arg,done:n.done}}else V.type==="throw"&&(l=I,n.method="throw",n.arg=V.arg)}}}function i(e,t){var n=e.iterator[t.method];if(n===v){if(t.delegate=null,t.method==="throw"){if(e.iterator.return&&(t.method="return",t.arg=v,i(e,t),t.method==="throw"))return T;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return T}var l=U(n,e.iterator,t.arg);if(l.type==="throw")return t.method="throw",t.arg=l.arg,t.delegate=null,T;var f=l.arg;if(!f)return t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,T;if(f.done)t[e.resultName]=f.value,t.next=e.nextLoc,t.method!=="return"&&(t.method="next",t.arg=v);else return f;return t.delegate=null,T}u(a),k(a,p,"Generator"),k(a,d,function(){return this}),k(a,"toString",function(){return"[object Generator]"});function s(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function c(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function y(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(s,this),this.reset(!0)}h.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function l(){for(;t.length;){var f=t.pop();if(f in e)return l.value=f,l.done=!1,l}return l.done=!0,l}};function L(e){if(e){var t=e[d];if(t)return t.call(e);if(typeof e.next=="function")return e;if(!isNaN(e.length)){var n=-1,l=function f(){for(;++n<e.length;)if(m.call(e,n))return f.value=e[n],f.done=!1,f;return f.value=v,f.done=!0,f};return l.next=l}}return{next:A}}h.values=L;function A(){return{value:v,done:!0}}return y.prototype={constructor:y,reset:function(e){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),!e)for(var t in this)t.charAt(0)==="t"&&m.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=v)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if(t.type==="throw")throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(N,V){return E.type="throw",E.arg=e,t.next=N,V&&(t.method="next",t.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 M=m.call(f,"catchLoc"),P=m.call(f,"finallyLoc");if(M&&P){if(this.prev<f.catchLoc)return n(f.catchLoc,!0);if(this.prev<f.finallyLoc)return n(f.finallyLoc)}else if(M){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(e,t){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&&(e==="break"||e==="continue")&&f.tryLoc<=t&&t<=f.finallyLoc&&(f=null);var E=f?f.completion:{};return E.type=e,E.arg=t,f?(this.method="next",this.next=f.finallyLoc,T):this.complete(E)},complete:function(e,t){if(e.type==="throw")throw e.arg;return e.type==="break"||e.type==="continue"?this.next=e.arg:e.type==="return"?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):e.type==="normal"&&t&&(this.next=t),T},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),c(n),T}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var l=n.completion;if(l.type==="throw"){var f=l.arg;c(n)}return f}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:L(e),resultName:t,nextLoc:n},this.method==="next"&&(this.arg=v),T}},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(T){if(T.material){var D=Array.isArray(T.material)?T.material:[T.material];D.forEach(function(_){var j,C;(j=_.color)===null||j===void 0||j.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,W=null,B=function(){var T=(0,p.Z)(v().mark(function D(_,j){var C,z,S,a,u,o,r,i,s;return v().wrap(function(y){for(;;)switch(y.prev=y.next){case 0:return C=j.type,z=C===void 0?"blob":C,S=j.version,a=S===void 0?"1":S,y.next=4,(0,R.get)(_);case 4:if(o=y.sent,!(o&&o[a])){y.next=9;break}u=o[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,i=r.res,s=r.err,s||(u=i,(0,R.set)(_,(0,k.Z)({},a,i)));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(_,j){return T.apply(this,arguments)}}(),I=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],W=p[k*3+1],B=p[R*3],I=p[R*3+1],T=p[U*3],D=p[U*3+1],_;if(m.has(x))_=m.get(x);else{var j=d.box3||new THREE.Box3;if(!d.box3){var C=x.parameters.shapes.getPoints();j.setFromArray(C.map(function(o){return[o.x,o.y,0]}).flat())}var z=j.getSize(new THREE.Vector3);d.split&&(z.y/=d.split),_={box:j,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,(W-S.min.y)/a.y+u),new THREE.Vector2((B-S.min.x)/a.x,(I-S.min.y)/a.y+u),new THREE.Vector2((T-S.min.x)/a.x,(D-S.min.y)/a.y+u)]},generateSideWallUV:function(x,p,k,R,U,G){var W=p[k*3],B=p[k*3+1],I=p[k*3+2],T=p[R*3],D=p[R*3+1],_=p[R*3+2],j=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],o;if(m.has(p))o=m.get(p);else{var r=new THREE.Box3;r.setFromArray(p);var i=r.getSize(new THREE.Vector3);d.split&&(i.z/=1-d.split),o={box:r,size:i},m.set(p,o)}var s=o.box,c=o.size;return Math.abs(B-D)<Math.abs(W-T)?[new THREE.Vector2((W-s.min.x)/c.x,(I-s.min.z)/c.z),new THREE.Vector2((T-s.min.x)/c.x,(_-s.min.z)/c.z),new THREE.Vector2((j-s.min.x)/c.x,(z-s.min.z)/c.z),new THREE.Vector2((S-s.min.x)/c.x,(u-s.min.z)/c.z)]:[new THREE.Vector2((B-s.min.y)/c.y,(I-s.min.z)/c.z),new THREE.Vector2((D-s.min.y)/c.y,(_-s.min.z)/c.z),new THREE.Vector2((C-s.min.y)/c.y,(z-s.min.z)/c.z),new THREE.Vector2((a-s.min.y)/c.y,(u-s.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})},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(W){d(W);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 H(b){var g=J[b];if(g!==void 0)return g.exports;var h=J[b]={exports:{}};return Q[b](h,h.exports,H),h.exports}(function(){H.n=function(b){var g=b&&b.__esModule?function(){return b.default}:function(){return b};return H.d(g,{a:g}),g}})(),function(){H.d=function(b,g){for(var h in g)H.o(g,h)&&!H.o(b,h)&&Object.defineProperty(b,h,{enumerable:!0,get:g[h]})}}(),function(){H.o=function(b,g){return Object.prototype.hasOwnProperty.call(b,g)}}();var K={};(function(){H.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=H(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 i=(0,g.Mf)();this.cache.set(r,i)},u.get=function(r){var i;return(i=this.cache.get(r))===null||i===void 0?void 0:i.promise},u.set=function(r,i){var s=this.cache.get(r);s?s.resolve(i):console.warn("init cache first")},u.dispose=function(){this.cache.forEach(function(r,i){r.reject("stop set cache:".concat(i))}),this.cache.clear()},a}(),O=H(568);function m(a,u){for(var o=0;o<u.length;o++){var r=u[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(a,r.key,r)}}function v(a,u,o){return u&&m(a.prototype,u),o&&m(a,o),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 o=0,r=new Array(u);o<u;o++)r[o]=a[o];return r}function k(a,u){if(!!a){if(typeof a=="string")return p(a,u);var o=Object.prototype.toString.call(a).slice(8,-1);if(o==="Object"&&a.constructor&&(o=a.constructor.name),o==="Map"||o==="Set")return Array.from(o);if(o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))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 W(a){return U(a)||d(a)||k(a)||G()}var B=H(666),I=H.n(B),T=H(949),D=function(){"use strict";function a(o){b(this,a),this.onTopBase=new Map,this.objectNamesToFactories=new Map,this.objects=new Map,this.objects_=o}var u=a.prototype;return u.install=function(r){this.pencil=r,this.initObjectFactories()},u.initObjectFactories=function(){var r=this,i=this.objects_;Object.keys(i).forEach(function(s){var c=function(){function y(){b(this,y)}var L=y.prototype;return L.create=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new i[s](e)},y}();r.objectNamesToFactories.set(s,c)})},u.getObject=function(r,i){r.includes("#")&&console.warn("getObject:err:\u4E0D\u652F\u6301 #",r);var s=(i||{}).key,c="".concat(r).concat(s?"#".concat(s):""),y=this.objects.get(c);return y},u.getAllObject=function(r,i){r.includes("#")&&console.warn("getAllObject:err:\u4E0D\u652F\u6301 #",r);var s=(i||{}).key,c="".concat(r).concat(s?"#".concat(s):""),y=[];return this.objects.forEach(function(L,A){(A.startsWith("".concat(c,"#"))||A===c)&&y.push(L)}),y},u.draw=function(r,i,s){var c=this;return(0,O.Z)(I().mark(function y(){var L,A,e,t,n,l,f,E;return I().wrap(function(P){for(;;)switch(P.prev=P.next){case 0:if(L=c.objectNamesToFactories.get(r),!L){P.next=16;break}return A=(i||{}).key,e="".concat(r).concat(A?"#".concat(A):""),c.objects.has(e)&&(t=T.MathUtils.generateUUID(),e+="#".concat(t)),n=(i==null?void 0:i.target)||s,l=(i==null?void 0:i.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(i),E.pencil=c.pencil,E.key=e,c.objects.set(e,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,i,s){var c=this;return(0,O.Z)(I().mark(function y(){var L,A;return I().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.create();case 2:r.object3d&&(r.object3d.userData.BaseObject_=r,s&&(L=1e3+s*2,c.onTopBase.has(L-1)||(A=new T.Points,A.renderOrder=L-1,A.onBeforeRender=function(){c.pencil.renderer.clearDepth()},A.frustumCulled=!1,c.onTopBase.set(L-1,!0),c.pencil.scene.add(A)),r.object3d.renderOrder=L),i.add(r.object3d)),r.visible=!0,r.render(),r.pm.resolve();case 6:case"end":return t.stop()}},y)}))()},u.erase=function(){for(var r=arguments.length,i=new Array(r),s=0;s<r;s++)i[s]=arguments[s];var c=this;W(i).forEach(function(y){var L=[];if(typeof y=="string"){var A,e=R(y.split("#"),2),t=e[0],n=e[1];(A=L).push.apply(A,W(c.getAllObject(t,{key:n})))}else L.push(y);L.forEach(function(l){c.removeMesh(l)})})},u.removeMesh=function(r){var i=this,s=r.parent;r.object3d&&s.remove(r.object3d),r.traverse(function(c){c.visible=!1,c.dispose(),i.objects.delete(c.key)})},u.update=function(r,i){this.objects.forEach(function(s){s.update(r,i)})},u.setSize=function(r,i){this.objects.forEach(function(s){s.resize(r,i)})},u.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()},v(a,[{key:"objectsPromise",get:function(){var r=[];return this.objects.forEach(function(i){r.push(i.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,i){var s,c;this.data[r]=i,(c=(s=this).cb)===null||c===void 0||c.call(s,r)},u.runAll=function(){var r=this;Object.keys(this.data).forEach(function(i){var s,c;(c=(s=r).cb)===null||c===void 0||c.call(s,i)})},u.dispose=function(){this.data={},this.cb=void 0},a}(),j=H(924),C=H(42),z=H(77),S=function(){"use strict";function a(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};b(this,a),this.messageList=[],this.options=(0,C.Z)({},{cache:!1,cacheVersion:"1"},o)}var u=a.prototype;return u.install=function(){},u.init=function(r,i){var s=this,c=this.options,y=c.cache,L=c.cacheVersion;this.workerList=Array.from({length:i},function(A,e){var t=typeof r=="string"?new Worker(r):r();return t.onmessage=function(n){var l=n.data,f=l.res,E=l.uuid,M=s.messageList.find(function(N){var V=N.uuid;return E===V});if(M==null||M.options.cb(f),s.workerList[e].inUse=!1,s.checkMessage(),y){var P=(M==null?void 0:M.options.cacheVersion)||L;(0,z.set)(E,(0,j.Z)({},P,f))}},{worker:t,inUse:!1}})},u.postMessage=function(r,i){var s=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 A=r.workerKey||T.MathUtils.generateUUID();(y?(0,z.get)(A):Promise.resolve()).then(function(e){var t=i.cacheVersion||L;e&&e[t]?i.cb(e[t]):(s.messageList.push({req:r,options:i,uuid:A,inUse:!1}),s.checkMessage())}).catch(function(){console.warn("err:worker cache"),s.messageList.push({req:r,options:i,uuid:A,inUse:!1}),s.checkMessage()})},u.checkMessage=function(){var r=this.workerList.find(function(s){var c=s.inUse;return!c});if(r){var i=this.messageList.find(function(s){var c=s.inUse;return!c});i&&(i.inUse=!0,r.inUse=!0,r.worker.postMessage({req:i.req,uuid:i.uuid}))}},u.dispose=function(){this.workerList.forEach(function(r){var i=r.worker;i.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(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(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{k({},"")}catch(e){k=function(t,n,l){return t[n]=l}}function R(e,t,n,l){var f=t&&t.prototype instanceof D?t:D,E=Object.create(f.prototype),M=new y(l||[]);return E._invoke=r(e,n,M),E}h.wrap=R;function U(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(l){return{type:"throw",arg:l}}}var G="suspendedStart",W="suspendedYield",B="executing",I="completed",T={};function D(){}function _(){}function j(){}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=j.prototype=D.prototype=Object.create(C);_.prototype=j,k(a,"constructor",j),k(j,"constructor",_),_.displayName=k(j,p,"GeneratorFunction");function u(e){["next","throw","return"].forEach(function(t){k(e,t,function(n){return this._invoke(t,n)})})}h.isGeneratorFunction=function(e){var t=typeof e=="function"&&e.constructor;return t?t===_||(t.displayName||t.name)==="GeneratorFunction":!1},h.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,j):(e.__proto__=j,k(e,p,"GeneratorFunction")),e.prototype=Object.create(a),e},h.awrap=function(e){return{__await:e}};function i(e,t){function n(E,M,P,N){var V=U(e[E],e,M);if(V.type==="throw")N(V.arg);else{var $=V.arg,F=$.value;return F&&typeof F=="object"&&m.call(F,"__await")?t.resolve(F.__await).then(function(Z){n("next",Z,P,N)},function(Z){n("throw",Z,P,N)}):t.resolve(F).then(function(Z){$.value=Z,P($)},function(Z){return n("throw",Z,P,N)})}}var l;function f(E,M){function P(){return new t(function(N,V){n(E,M,N,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(e,t,n,l,f){f===void 0&&(f=Promise);var E=new i(R(e,t,n,l),f);return h.isGeneratorFunction(t)?E:E.next().then(function(M){return M.done?M.value:E.next()})};function r(e,t,n){var l=G;return function(E,M){if(l===B)throw new Error("Generator is already running");if(l===I){if(E==="throw")throw M;return A()}for(n.method=E,n.arg=M;;){var P=n.delegate;if(P){var N=s(P,n);if(N){if(N===T)continue;return N}}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=B;var V=U(e,t,n);if(V.type==="normal"){if(l=n.done?I:W,V.arg===T)continue;return{value:V.arg,done:n.done}}else V.type==="throw"&&(l=I,n.method="throw",n.arg=V.arg)}}}function s(e,t){var n=e.iterator[t.method];if(n===v){if(t.delegate=null,t.method==="throw"){if(e.iterator.return&&(t.method="return",t.arg=v,s(e,t),t.method==="throw"))return T;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return T}var l=U(n,e.iterator,t.arg);if(l.type==="throw")return t.method="throw",t.arg=l.arg,t.delegate=null,T;var f=l.arg;if(!f)return t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,T;if(f.done)t[e.resultName]=f.value,t.next=e.nextLoc,t.method!=="return"&&(t.method="next",t.arg=v);else return f;return t.delegate=null,T}u(a),k(a,p,"Generator"),k(a,d,function(){return this}),k(a,"toString",function(){return"[object Generator]"});function o(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function c(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function y(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(o,this),this.reset(!0)}h.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function l(){for(;t.length;){var f=t.pop();if(f in e)return l.value=f,l.done=!1,l}return l.done=!0,l}};function L(e){if(e){var t=e[d];if(t)return t.call(e);if(typeof e.next=="function")return e;if(!isNaN(e.length)){var n=-1,l=function f(){for(;++n<e.length;)if(m.call(e,n))return f.value=e[n],f.done=!1,f;return f.value=v,f.done=!0,f};return l.next=l}}return{next:A}}h.values=L;function A(){return{value:v,done:!0}}return y.prototype={constructor:y,reset:function(e){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),!e)for(var t in this)t.charAt(0)==="t"&&m.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=v)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if(t.type==="throw")throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(N,V){return E.type="throw",E.arg=e,t.next=N,V&&(t.method="next",t.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 M=m.call(f,"catchLoc"),P=m.call(f,"finallyLoc");if(M&&P){if(this.prev<f.catchLoc)return n(f.catchLoc,!0);if(this.prev<f.finallyLoc)return n(f.finallyLoc)}else if(M){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(e,t){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&&(e==="break"||e==="continue")&&f.tryLoc<=t&&t<=f.finallyLoc&&(f=null);var E=f?f.completion:{};return E.type=e,E.arg=t,f?(this.method="next",this.next=f.finallyLoc,T):this.complete(E)},complete:function(e,t){if(e.type==="throw")throw e.arg;return e.type==="break"||e.type==="continue"?this.next=e.arg:e.type==="return"?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):e.type==="normal"&&t&&(this.next=t),T},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),c(n),T}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var l=n.completion;if(l.type==="throw"){var f=l.arg;c(n)}return f}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:L(e),resultName:t,nextLoc:n},this.method==="next"&&(this.arg=v),T}},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(T){if(T.material){var D=Array.isArray(T.material)?T.material:[T.material];D.forEach(function(_){var j,C;(j=_.color)===null||j===void 0||j.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,W=null,B=function(){var T=(0,p.Z)(v().mark(function D(_,j){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=j.type,z=C===void 0?"blob":C,S=j.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(_,j){return T.apply(this,arguments)}}(),I=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],W=p[k*3+1],B=p[R*3],I=p[R*3+1],T=p[U*3],D=p[U*3+1],_;if(m.has(x))_=m.get(x);else{var j=d.box3||new THREE.Box3;if(!d.box3){var C=x.parameters.shapes.getPoints();j.setFromArray(C.map(function(i){return[i.x,i.y,0]}).flat())}var z=j.getSize(new THREE.Vector3);d.split&&(z.y/=d.split),_={box:j,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,(W-S.min.y)/a.y+u),new THREE.Vector2((B-S.min.x)/a.x,(I-S.min.y)/a.y+u),new THREE.Vector2((T-S.min.x)/a.x,(D-S.min.y)/a.y+u)]},generateSideWallUV:function(x,p,k,R,U,G){var W=p[k*3],B=p[k*3+1],I=p[k*3+2],T=p[R*3],D=p[R*3+1],_=p[R*3+2],j=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(B-D)<Math.abs(W-T)?[new THREE.Vector2((W-o.min.x)/c.x,(I-o.min.z)/c.z),new THREE.Vector2((T-o.min.x)/c.x,(_-o.min.z)/c.z),new THREE.Vector2((j-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((B-o.min.y)/c.y,(I-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})},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(W){d(W);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 H(b){var g=J[b];if(g!==void 0)return g.exports;var h=J[b]={exports:{}};return Q[b](h,h.exports,H),h.exports}(function(){H.n=function(b){var g=b&&b.__esModule?function(){return b.default}:function(){return b};return H.d(g,{a:g}),g}})(),function(){H.d=function(b,g){for(var h in g)H.o(g,h)&&!H.o(b,h)&&Object.defineProperty(b,h,{enumerable:!0,get:g[h]})}}(),function(){H.o=function(b,g){return Object.prototype.hasOwnProperty.call(b,g)}}();var K={};(function(){H.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=H(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=H(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 W(a){return U(a)||d(a)||k(a)||G()}var B=H(666),I=H.n(B),T=H(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 e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new s[o](e)},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,A){(A.startsWith("".concat(c,"#"))||A===c)&&y.push(L)}),y},u.draw=function(r,s,o){var c=this;return(0,O.Z)(I().mark(function y(){var L,A,e,t,n,l,f,E;return I().wrap(function(P){for(;;)switch(P.prev=P.next){case 0:if(L=c.objectNamesToFactories.get(r),!L){P.next=16;break}return A=(s||{}).key,e="".concat(r).concat(A?"#".concat(A):""),c.objects.has(e)&&(t=T.MathUtils.generateUUID(),e+="#".concat(t)),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=e,c.objects.set(e,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)(I().mark(function y(){var L,A;return I().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.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,c.onTopBase.has(L-1)||(A=new T.Points,A.renderOrder=L-1,A.onBeforeRender=function(){c.pencil.renderer.clearDepth()},A.frustumCulled=!1,c.onTopBase.set(L-1,!0),c.pencil.scene.add(A)),r.object3d.renderOrder=L)),s.add(r.object3d)),r.visible=!0,r.render(),r.pm.resolve();case 6:case"end":return t.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;W(s).forEach(function(y){var L=[];if(typeof y=="string"){var A,e=R(y.split("#"),2),t=e[0],n=e[1];(A=L).push.apply(A,W(c.getAllObject(t,{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}(),j=H(924),C=H(42),z=H(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(A,e){var t=typeof r=="string"?new Worker(r):r();return t.onmessage=function(n){var l=n.data,f=l.res,E=l.uuid,M=o.messageList.find(function(N){var V=N.uuid;return E===V});if(M==null||M.options.cb(f),o.workerList[e].inUse=!1,o.checkMessage(),y){var P=(M==null?void 0:M.options.cacheVersion)||L;(0,z.set)(E,(0,j.Z)({},P,f))}},{worker:t,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 A=r.workerKey||T.MathUtils.generateUUID();(y?(0,z.get)(A):Promise.resolve()).then(function(e){var t=s.cacheVersion||L;e&&e[t]?s.cb(e[t]):(o.messageList.push({req:r,options:s,uuid:A,inUse:!1}),o.checkMessage())}).catch(function(){console.warn("err:worker cache"),o.messageList.push({req:r,options:s,uuid:A,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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gl-draw",
3
- "version": "0.8.25",
3
+ "version": "0.8.26",
4
4
  "author": "gitplus <hstits@gmail.com>",
5
5
  "scripts": {
6
6
  "start": "PORT=3003 bundler-dev",