gl-draw 0.0.28 → 0.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/plugins/Data.d.ts +1 -0
- package/dist/plugins/index.js +1 -1
- package/package.json +1 -1
package/dist/plugins/Data.d.ts
CHANGED
package/dist/plugins/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){var J={666:function(v){var d=function(s){"use strict";var O=Object.prototype,g=O.hasOwnProperty,_,b=typeof Symbol=="function"?Symbol:{},y=b.iterator||"@@iterator",T=b.asyncIterator||"@@asyncIterator",j=b.toStringTag||"@@toStringTag";function w(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{w({},"")}catch(e){w=function(t,n,f){return t[n]=f}}function R(e,t,n,f){var c=t&&t.prototype instanceof m?t:m,E=Object.create(c.prototype),M=new x(f||[]);return E._invoke=p(e,n,M),E}s.wrap=R;function I(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(f){return{type:"throw",arg:f}}}var Z="suspendedStart",W="suspendedYield",z="executing",A="completed",P={};function m(){}function k(){}function i(){}var o={};w(o,y,function(){return this});var a=Object.getPrototypeOf,r=a&&a(a(N([])));r&&r!==O&&g.call(r,y)&&(o=r);var u=i.prototype=m.prototype=Object.create(o);k.prototype=i,w(u,"constructor",i),w(i,"constructor",k),k.displayName=w(i,j,"GeneratorFunction");function h(e){["next","throw","return"].forEach(function(t){w(e,t,function(n){return this._invoke(t,n)})})}s.isGeneratorFunction=function(e){var t=typeof e=="function"&&e.constructor;return t?t===k||(t.displayName||t.name)==="GeneratorFunction":!1},s.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,i):(e.__proto__=i,w(e,j,"GeneratorFunction")),e.prototype=Object.create(u),e},s.awrap=function(e){return{__await:e}};function l(e,t){function n(E,M,G,B){var D=I(e[E],e,M);if(D.type==="throw")B(D.arg);else{var Y=D.arg,H=Y.value;return H&&typeof H=="object"&&g.call(H,"__await")?t.resolve(H.__await).then(function($){n("next",$,G,B)},function($){n("throw",$,G,B)}):t.resolve(H).then(function($){Y.value=$,G(Y)},function($){return n("throw",$,G,B)})}}var f;function c(E,M){function G(){return new t(function(B,D){n(E,M,B,D)})}return f=f?f.then(G,G):G()}this._invoke=c}h(l.prototype),w(l.prototype,T,function(){return this}),s.AsyncIterator=l,s.async=function(e,t,n,f,c){c===void 0&&(c=Promise);var E=new l(R(e,t,n,f),c);return s.isGeneratorFunction(t)?E:E.next().then(function(M){return M.done?M.value:E.next()})};function p(e,t,n){var f=Z;return function(E,M){if(f===z)throw new Error("Generator is already running");if(f===A){if(E==="throw")throw M;return F()}for(n.method=E,n.arg=M;;){var G=n.delegate;if(G){var B=L(G,n);if(B){if(B===P)continue;return B}}if(n.method==="next")n.sent=n._sent=n.arg;else if(n.method==="throw"){if(f===Z)throw f=A,n.arg;n.dispatchException(n.arg)}else n.method==="return"&&n.abrupt("return",n.arg);f=z;var D=I(e,t,n);if(D.type==="normal"){if(f=n.done?A:W,D.arg===P)continue;return{value:D.arg,done:n.done}}else D.type==="throw"&&(f=A,n.method="throw",n.arg=D.arg)}}}function L(e,t){var n=e.iterator[t.method];if(n===_){if(t.delegate=null,t.method==="throw"){if(e.iterator.return&&(t.method="return",t.arg=_,L(e,t),t.method==="throw"))return P;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return P}var f=I(n,e.iterator,t.arg);if(f.type==="throw")return t.method="throw",t.arg=f.arg,t.delegate=null,P;var c=f.arg;if(!c)return t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,P;if(c.done)t[e.resultName]=c.value,t.next=e.nextLoc,t.method!=="return"&&(t.method="next",t.arg=_);else return c;return t.delegate=null,P}h(u),w(u,j,"Generator"),w(u,y,function(){return this}),w(u,"toString",function(){return"[object Generator]"});function U(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 x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(U,this),this.reset(!0)}s.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function f(){for(;t.length;){var c=t.pop();if(c in e)return f.value=c,f.done=!1,f}return f.done=!0,f}};function N(e){if(e){var t=e[y];if(t)return t.call(e);if(typeof e.next=="function")return e;if(!isNaN(e.length)){var n=-1,f=function c(){for(;++n<e.length;)if(g.call(e,n))return c.value=e[n],c.done=!1,c;return c.value=_,c.done=!0,c};return f.next=f}}return{next:F}}s.values=N;function F(){return{value:_,done:!0}}return x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=_,this.done=!1,this.delegate=null,this.method="next",this.arg=_,this.tryEntries.forEach(C),!e)for(var t in this)t.charAt(0)==="t"&&g.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=_)},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,D){return E.type="throw",E.arg=e,t.next=B,D&&(t.method="next",t.arg=_),!!D}for(var f=this.tryEntries.length-1;f>=0;--f){var c=this.tryEntries[f],E=c.completion;if(c.tryLoc==="root")return n("end");if(c.tryLoc<=this.prev){var M=g.call(c,"catchLoc"),G=g.call(c,"finallyLoc");if(M&&G){if(this.prev<c.catchLoc)return n(c.catchLoc,!0);if(this.prev<c.finallyLoc)return n(c.finallyLoc)}else if(M){if(this.prev<c.catchLoc)return n(c.catchLoc,!0)}else if(G){if(this.prev<c.finallyLoc)return n(c.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 f=this.tryEntries[n];if(f.tryLoc<=this.prev&&g.call(f,"finallyLoc")&&this.prev<f.finallyLoc){var c=f;break}}c&&(e==="break"||e==="continue")&&c.tryLoc<=t&&t<=c.finallyLoc&&(c=null);var E=c?c.completion:{};return E.type=e,E.arg=t,c?(this.method="next",this.next=c.finallyLoc,P):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),P},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),P}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var f=n.completion;if(f.type==="throw"){var c=f.arg;C(n)}return c}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:N(e),resultName:t,nextLoc:n},this.method==="next"&&(this.arg=_),P}},s}(v.exports);try{regeneratorRuntime=d}catch(s){typeof globalThis=="object"?globalThis.regeneratorRuntime=d:Function("r","regeneratorRuntime = r")(d)}},519:function(v,d,s){"use strict";s.d(d,{makePromiseCreator:function(){return O.Z}});var O=s(282),g=s(666),_=s.n(g),b=null,y=s(644);function T(A){if(A.material){var P=Array.isArray(A.material)?A.material:[A.material];P.forEach(function(m){var k,i;(k=m.color)===null||k===void 0||k.convertSRGBToLinear(),(i=m.emissive)===null||i===void 0||i.convertSRGBToLinear(),m.map&&(m.map.encoding=THREE.sRGBEncoding),m.emissiveMap&&(m.emissiveMap.encoding=THREE.sRGBEncoding)})}}var j=s(568),w=s(924),R=require("idb-keyval"),I=s(484),Z=null,W=null,z=function(){var A=(0,j.Z)(_().mark(function P(m,k){var i,o,a,r,u,h;return _().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return i=k.version,p.next=4,(0,R.get)(m);case 4:if(a=p.sent,!(a&&a[i])){p.next=9;break}o=a[i],p.next=15;break;case 9:return p.next=11,(0,I.Z)(fetch(m).then(function(L){if(L.ok)return L.blob();throw new Error}));case 11:r=p.sent,u=r.res,h=r.err,h||(o=u,(0,R.set)(m,(0,w.Z)({},i,u)));case 15:return p.abrupt("return",o?{url:URL.createObjectURL(o)}:{url:m});case 16:case"end":return p.stop()}},P)}));return function(m,k){return A.apply(this,arguments)}}()},282:function(v,d,s){"use strict";s.d(d,{Z:function(){return g}});var O=s(484);function g(){var _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},y={};return y.promise=new Promise(function(T,j){y.resolve=T,y.reject=j}),_&&(y.promise=(0,O.Z)(y.promise,b)),y}},484:function(v,d,s){"use strict";s.d(d,{Z:function(){return g}});var O=s(42);function g(_){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return _.then(function(y){return(0,O.Z)({err:null,res:y},b)}).catch(function(y){return(0,O.Z)({err:y,res:void 0},b)})}},644:function(v){"use strict";v.exports=require("three")},568:function(v,d,s){"use strict";s.d(d,{Z:function(){return g}});function O(_,b,y,T,j,w,R){try{var I=_[w](R),Z=I.value}catch(W){y(W);return}I.done?b(Z):Promise.resolve(Z).then(T,j)}function g(_){return function(){var b=this,y=arguments;return new Promise(function(T,j){var w=_.apply(b,y);function R(Z){O(w,T,j,R,I,"next",Z)}function I(Z){O(w,T,j,R,I,"throw",Z)}R(void 0)})}}},924:function(v,d,s){"use strict";s.d(d,{Z:function(){return O}});function O(g,_,b){return _ in g?Object.defineProperty(g,_,{value:b,enumerable:!0,configurable:!0,writable:!0}):g[_]=b,g}},42:function(v,d,s){"use strict";s.d(d,{Z:function(){return g}});var O=s(924);function g(_){for(var b=1;b<arguments.length;b++){var y=arguments[b]!=null?arguments[b]:{},T=Object.keys(y);typeof Object.getOwnPropertySymbols=="function"&&(T=T.concat(Object.getOwnPropertySymbols(y).filter(function(j){return Object.getOwnPropertyDescriptor(y,j).enumerable}))),T.forEach(function(j){(0,O.Z)(_,j,y[j])})}return _}}},X={};function S(v){var d=X[v];if(d!==void 0)return d.exports;var s=X[v]={exports:{}};return J[v](s,s.exports,S),s.exports}(function(){S.n=function(v){var d=v&&v.__esModule?function(){return v.default}:function(){return v};return S.d(d,{a:d}),d}})(),function(){S.d=function(v,d){for(var s in d)S.o(d,s)&&!S.o(v,s)&&Object.defineProperty(v,s,{enumerable:!0,get:d[s]})}}(),function(){S.o=function(v,d){return Object.prototype.hasOwnProperty.call(v,d)}}(),function(){S.r=function(v){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(v,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(v,"__esModule",{value:!0})}}();var K={};(function(){"use strict";S.r(K),S.d(K,{Cache:function(){return s},Data:function(){return k},Draw:function(){return m}});function v(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")}var d=S(519),s=function(){"use strict";function i(){v(this,i),this.cache=new Map}var o=i.prototype;return o.install=function(){},o.init=function(r){var u=(0,d.makePromiseCreator)();this.cache.set(r,u)},o.get=function(r){var u;return(u=this.cache.get(r))===null||u===void 0?void 0:u.promise},o.set=function(r,u){var h=this.cache.get(r);h?h.resolve(u):console.warn("init cache first")},o.dispose=function(){this.cache.forEach(function(r,u){r.reject("stop set cache:".concat(u))}),this.cache.clear()},i}(),O=S(568);function g(i,o){for(var a=0;a<o.length;a++){var r=o[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,r.key,r)}}function _(i,o,a){return o&&g(i.prototype,o),a&&g(i,a),i}function b(i){if(Array.isArray(i))return i}function y(i){if(typeof Symbol!="undefined"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function T(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function j(i,o){(o==null||o>i.length)&&(o=i.length);for(var a=0,r=new Array(o);a<o;a++)r[a]=i[a];return r}function w(i,o){if(!!i){if(typeof i=="string")return j(i,o);var a=Object.prototype.toString.call(i).slice(8,-1);if(a==="Object"&&i.constructor&&(a=i.constructor.name),a==="Map"||a==="Set")return Array.from(a);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return j(i,o)}}function R(i,o){return b(i)||y(i,o)||w(i,o)||T()}function I(i){if(Array.isArray(i))return j(i)}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 W(i){return I(i)||y(i)||w(i)||Z()}var z=S(666),A=S.n(z),P=S(644),m=function(){"use strict";function i(a){v(this,i),this.objectNamesToFactories=new Map,this.objects=new Map,this.objects_=a}var o=i.prototype;return o.install=function(r){this.pencil=r,this.initObjectFactories()},o.initObjectFactories=function(){var r=this,u=this.objects_;Object.keys(u).forEach(function(h){var l=function(){function p(){v(this,p)}var L=p.prototype;return L.create=function(){var C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new u[h](C)},p}();r.objectNamesToFactories.set(h,l)})},o.getObject=function(r,u){r.includes("#")&&console.warn("getObject:err:\u4E0D\u652F\u6301 #",r);var h=(u||{}).key,l="".concat(r).concat(h?"#".concat(h):""),p=this.objects.get(l);return p},o.getAllObject=function(r,u){r.includes("#")&&console.warn("getAllObject:err:\u4E0D\u652F\u6301 #",r);var h=(u||{}).key,l="".concat(r).concat(h?"#".concat(h):""),p=[];return this.objects.forEach(function(L,U){(U.startsWith("".concat(l,"#"))||U===l)&&p.push(L)}),p},o.draw=function(r,u,h){var l=this;return(0,O.Z)(A().mark(function p(){var L,U,C,x,N,F,e;return A().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if(L=l.objectNamesToFactories.get(r),!L){n.next=15;break}return U=(u||{}).key,C="".concat(r).concat(U?"#".concat(U):""),l.objects.has(C)&&(x=P.MathUtils.generateUUID(),C+="#".concat(x)),N=(u==null?void 0:u.target)||h,typeof N=="string"?F=l.objects.get(N):(N==null?void 0:N.objecttype__)==="BaseObject"?F=N:F=l.pencil.scene,e=new L().create(u),e.pencil=l.pencil,e.key=C,l.objects.set(C,e),n.next=14,l.addMesh(e,F);case 14:return n.abrupt("return",e);case 15:throw new Error("Unrecognized:".concat(r));case 16:case"end":return n.stop()}},p)}))()},o.addMesh=function(r,u){return(0,O.Z)(A().mark(function h(){return A().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return p.next=2,r.create();case 2:r.object3d&&(r.object3d.userData.BaseObject_=r,u.add(r.object3d)),r.visible=!0,r.render(),r.pm.resolve();case 6:case"end":return p.stop()}},h)}))()},o.erase=function(){for(var r=arguments.length,u=new Array(r),h=0;h<r;h++)u[h]=arguments[h];var l=this;W(u).forEach(function(p){var L=[];if(typeof p=="string"){var U,C=R(p.split("#"),2),x=C[0],N=C[1];(U=L).push.apply(U,W(l.getAllObject(x,{key:N})))}else L.push(p);L.forEach(function(F){l.removeMesh(F)})})},o.removeMesh=function(r){var u=this,h=r.parent;r.object3d&&h.remove(r.object3d),r.traverse(function(l){l.visible=!1,l.dispose(),u.objects.delete(l.key)})},o.update=function(r,u){this.objects.forEach(function(h){h.update(r,u)})},o.setSize=function(r,u){this.objects.forEach(function(h){h.resize(r,u)})},o.dispose=function(){this.objects.forEach(function(r,u){r.dispose(),r.pm.reject("stop draw:".concat(u))}),this.objects.clear(),this.objectNamesToFactories.clear()},_(i,[{key:"objectsPromise",get:function(){var r=[];return this.objects.forEach(function(u){r.push(u.pm.promise)}),r}}]),i}(),k=function(){"use strict";function i(){v(this,i),this.data={}}var o=i.prototype;return o.install=function(){},o.setData=function(r,u){var h,l;this.data[r]=u,(l=(h=this).cb)===null||l===void 0||l.call(h,r)},o.dispose=function(){this.data={},this.cb=void 0},i}()})(),module.exports=K})();
|
|
1
|
+
(function(){var J={666:function(v){var d=function(s){"use strict";var O=Object.prototype,g=O.hasOwnProperty,_,b=typeof Symbol=="function"?Symbol:{},y=b.iterator||"@@iterator",T=b.asyncIterator||"@@asyncIterator",j=b.toStringTag||"@@toStringTag";function w(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{w({},"")}catch(e){w=function(t,n,f){return t[n]=f}}function R(e,t,n,f){var c=t&&t.prototype instanceof m?t:m,E=Object.create(c.prototype),M=new x(f||[]);return E._invoke=p(e,n,M),E}s.wrap=R;function I(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(f){return{type:"throw",arg:f}}}var Z="suspendedStart",W="suspendedYield",z="executing",P="completed",k={};function m(){}function A(){}function i(){}var o={};w(o,y,function(){return this});var a=Object.getPrototypeOf,r=a&&a(a(N([])));r&&r!==O&&g.call(r,y)&&(o=r);var u=i.prototype=m.prototype=Object.create(o);A.prototype=i,w(u,"constructor",i),w(i,"constructor",A),A.displayName=w(i,j,"GeneratorFunction");function h(e){["next","throw","return"].forEach(function(t){w(e,t,function(n){return this._invoke(t,n)})})}s.isGeneratorFunction=function(e){var t=typeof e=="function"&&e.constructor;return t?t===A||(t.displayName||t.name)==="GeneratorFunction":!1},s.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,i):(e.__proto__=i,w(e,j,"GeneratorFunction")),e.prototype=Object.create(u),e},s.awrap=function(e){return{__await:e}};function l(e,t){function n(E,M,G,B){var D=I(e[E],e,M);if(D.type==="throw")B(D.arg);else{var Y=D.arg,H=Y.value;return H&&typeof H=="object"&&g.call(H,"__await")?t.resolve(H.__await).then(function($){n("next",$,G,B)},function($){n("throw",$,G,B)}):t.resolve(H).then(function($){Y.value=$,G(Y)},function($){return n("throw",$,G,B)})}}var f;function c(E,M){function G(){return new t(function(B,D){n(E,M,B,D)})}return f=f?f.then(G,G):G()}this._invoke=c}h(l.prototype),w(l.prototype,T,function(){return this}),s.AsyncIterator=l,s.async=function(e,t,n,f,c){c===void 0&&(c=Promise);var E=new l(R(e,t,n,f),c);return s.isGeneratorFunction(t)?E:E.next().then(function(M){return M.done?M.value:E.next()})};function p(e,t,n){var f=Z;return function(E,M){if(f===z)throw new Error("Generator is already running");if(f===P){if(E==="throw")throw M;return F()}for(n.method=E,n.arg=M;;){var G=n.delegate;if(G){var B=L(G,n);if(B){if(B===k)continue;return B}}if(n.method==="next")n.sent=n._sent=n.arg;else if(n.method==="throw"){if(f===Z)throw f=P,n.arg;n.dispatchException(n.arg)}else n.method==="return"&&n.abrupt("return",n.arg);f=z;var D=I(e,t,n);if(D.type==="normal"){if(f=n.done?P:W,D.arg===k)continue;return{value:D.arg,done:n.done}}else D.type==="throw"&&(f=P,n.method="throw",n.arg=D.arg)}}}function L(e,t){var n=e.iterator[t.method];if(n===_){if(t.delegate=null,t.method==="throw"){if(e.iterator.return&&(t.method="return",t.arg=_,L(e,t),t.method==="throw"))return k;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return k}var f=I(n,e.iterator,t.arg);if(f.type==="throw")return t.method="throw",t.arg=f.arg,t.delegate=null,k;var c=f.arg;if(!c)return t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,k;if(c.done)t[e.resultName]=c.value,t.next=e.nextLoc,t.method!=="return"&&(t.method="next",t.arg=_);else return c;return t.delegate=null,k}h(u),w(u,j,"Generator"),w(u,y,function(){return this}),w(u,"toString",function(){return"[object Generator]"});function U(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 x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(U,this),this.reset(!0)}s.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function f(){for(;t.length;){var c=t.pop();if(c in e)return f.value=c,f.done=!1,f}return f.done=!0,f}};function N(e){if(e){var t=e[y];if(t)return t.call(e);if(typeof e.next=="function")return e;if(!isNaN(e.length)){var n=-1,f=function c(){for(;++n<e.length;)if(g.call(e,n))return c.value=e[n],c.done=!1,c;return c.value=_,c.done=!0,c};return f.next=f}}return{next:F}}s.values=N;function F(){return{value:_,done:!0}}return x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=_,this.done=!1,this.delegate=null,this.method="next",this.arg=_,this.tryEntries.forEach(C),!e)for(var t in this)t.charAt(0)==="t"&&g.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=_)},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,D){return E.type="throw",E.arg=e,t.next=B,D&&(t.method="next",t.arg=_),!!D}for(var f=this.tryEntries.length-1;f>=0;--f){var c=this.tryEntries[f],E=c.completion;if(c.tryLoc==="root")return n("end");if(c.tryLoc<=this.prev){var M=g.call(c,"catchLoc"),G=g.call(c,"finallyLoc");if(M&&G){if(this.prev<c.catchLoc)return n(c.catchLoc,!0);if(this.prev<c.finallyLoc)return n(c.finallyLoc)}else if(M){if(this.prev<c.catchLoc)return n(c.catchLoc,!0)}else if(G){if(this.prev<c.finallyLoc)return n(c.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 f=this.tryEntries[n];if(f.tryLoc<=this.prev&&g.call(f,"finallyLoc")&&this.prev<f.finallyLoc){var c=f;break}}c&&(e==="break"||e==="continue")&&c.tryLoc<=t&&t<=c.finallyLoc&&(c=null);var E=c?c.completion:{};return E.type=e,E.arg=t,c?(this.method="next",this.next=c.finallyLoc,k):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),k},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),k}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var f=n.completion;if(f.type==="throw"){var c=f.arg;C(n)}return c}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:N(e),resultName:t,nextLoc:n},this.method==="next"&&(this.arg=_),k}},s}(v.exports);try{regeneratorRuntime=d}catch(s){typeof globalThis=="object"?globalThis.regeneratorRuntime=d:Function("r","regeneratorRuntime = r")(d)}},519:function(v,d,s){"use strict";s.d(d,{makePromiseCreator:function(){return O.Z}});var O=s(282),g=s(666),_=s.n(g),b=null,y=s(644);function T(P){if(P.material){var k=Array.isArray(P.material)?P.material:[P.material];k.forEach(function(m){var A,i;(A=m.color)===null||A===void 0||A.convertSRGBToLinear(),(i=m.emissive)===null||i===void 0||i.convertSRGBToLinear(),m.map&&(m.map.encoding=THREE.sRGBEncoding),m.emissiveMap&&(m.emissiveMap.encoding=THREE.sRGBEncoding)})}}var j=s(568),w=s(924),R=require("idb-keyval"),I=s(484),Z=null,W=null,z=function(){var P=(0,j.Z)(_().mark(function k(m,A){var i,o,a,r,u,h;return _().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return i=A.version,p.next=4,(0,R.get)(m);case 4:if(a=p.sent,!(a&&a[i])){p.next=9;break}o=a[i],p.next=15;break;case 9:return p.next=11,(0,I.Z)(fetch(m).then(function(L){if(L.ok)return L.blob();throw new Error}));case 11:r=p.sent,u=r.res,h=r.err,h||(o=u,(0,R.set)(m,(0,w.Z)({},i,u)));case 15:return p.abrupt("return",o?{url:URL.createObjectURL(o)}:{url:m});case 16:case"end":return p.stop()}},k)}));return function(m,A){return P.apply(this,arguments)}}()},282:function(v,d,s){"use strict";s.d(d,{Z:function(){return g}});var O=s(484);function g(){var _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},y={};return y.promise=new Promise(function(T,j){y.resolve=T,y.reject=j}),_&&(y.promise=(0,O.Z)(y.promise,b)),y}},484:function(v,d,s){"use strict";s.d(d,{Z:function(){return g}});var O=s(42);function g(_){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return _.then(function(y){return(0,O.Z)({err:null,res:y},b)}).catch(function(y){return(0,O.Z)({err:y,res:void 0},b)})}},644:function(v){"use strict";v.exports=require("three")},568:function(v,d,s){"use strict";s.d(d,{Z:function(){return g}});function O(_,b,y,T,j,w,R){try{var I=_[w](R),Z=I.value}catch(W){y(W);return}I.done?b(Z):Promise.resolve(Z).then(T,j)}function g(_){return function(){var b=this,y=arguments;return new Promise(function(T,j){var w=_.apply(b,y);function R(Z){O(w,T,j,R,I,"next",Z)}function I(Z){O(w,T,j,R,I,"throw",Z)}R(void 0)})}}},924:function(v,d,s){"use strict";s.d(d,{Z:function(){return O}});function O(g,_,b){return _ in g?Object.defineProperty(g,_,{value:b,enumerable:!0,configurable:!0,writable:!0}):g[_]=b,g}},42:function(v,d,s){"use strict";s.d(d,{Z:function(){return g}});var O=s(924);function g(_){for(var b=1;b<arguments.length;b++){var y=arguments[b]!=null?arguments[b]:{},T=Object.keys(y);typeof Object.getOwnPropertySymbols=="function"&&(T=T.concat(Object.getOwnPropertySymbols(y).filter(function(j){return Object.getOwnPropertyDescriptor(y,j).enumerable}))),T.forEach(function(j){(0,O.Z)(_,j,y[j])})}return _}}},X={};function S(v){var d=X[v];if(d!==void 0)return d.exports;var s=X[v]={exports:{}};return J[v](s,s.exports,S),s.exports}(function(){S.n=function(v){var d=v&&v.__esModule?function(){return v.default}:function(){return v};return S.d(d,{a:d}),d}})(),function(){S.d=function(v,d){for(var s in d)S.o(d,s)&&!S.o(v,s)&&Object.defineProperty(v,s,{enumerable:!0,get:d[s]})}}(),function(){S.o=function(v,d){return Object.prototype.hasOwnProperty.call(v,d)}}(),function(){S.r=function(v){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(v,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(v,"__esModule",{value:!0})}}();var K={};(function(){"use strict";S.r(K),S.d(K,{Cache:function(){return s},Data:function(){return A},Draw:function(){return m}});function v(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")}var d=S(519),s=function(){"use strict";function i(){v(this,i),this.cache=new Map}var o=i.prototype;return o.install=function(){},o.init=function(r){var u=(0,d.makePromiseCreator)();this.cache.set(r,u)},o.get=function(r){var u;return(u=this.cache.get(r))===null||u===void 0?void 0:u.promise},o.set=function(r,u){var h=this.cache.get(r);h?h.resolve(u):console.warn("init cache first")},o.dispose=function(){this.cache.forEach(function(r,u){r.reject("stop set cache:".concat(u))}),this.cache.clear()},i}(),O=S(568);function g(i,o){for(var a=0;a<o.length;a++){var r=o[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,r.key,r)}}function _(i,o,a){return o&&g(i.prototype,o),a&&g(i,a),i}function b(i){if(Array.isArray(i))return i}function y(i){if(typeof Symbol!="undefined"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function T(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function j(i,o){(o==null||o>i.length)&&(o=i.length);for(var a=0,r=new Array(o);a<o;a++)r[a]=i[a];return r}function w(i,o){if(!!i){if(typeof i=="string")return j(i,o);var a=Object.prototype.toString.call(i).slice(8,-1);if(a==="Object"&&i.constructor&&(a=i.constructor.name),a==="Map"||a==="Set")return Array.from(a);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return j(i,o)}}function R(i,o){return b(i)||y(i,o)||w(i,o)||T()}function I(i){if(Array.isArray(i))return j(i)}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 W(i){return I(i)||y(i)||w(i)||Z()}var z=S(666),P=S.n(z),k=S(644),m=function(){"use strict";function i(a){v(this,i),this.objectNamesToFactories=new Map,this.objects=new Map,this.objects_=a}var o=i.prototype;return o.install=function(r){this.pencil=r,this.initObjectFactories()},o.initObjectFactories=function(){var r=this,u=this.objects_;Object.keys(u).forEach(function(h){var l=function(){function p(){v(this,p)}var L=p.prototype;return L.create=function(){var C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new u[h](C)},p}();r.objectNamesToFactories.set(h,l)})},o.getObject=function(r,u){r.includes("#")&&console.warn("getObject:err:\u4E0D\u652F\u6301 #",r);var h=(u||{}).key,l="".concat(r).concat(h?"#".concat(h):""),p=this.objects.get(l);return p},o.getAllObject=function(r,u){r.includes("#")&&console.warn("getAllObject:err:\u4E0D\u652F\u6301 #",r);var h=(u||{}).key,l="".concat(r).concat(h?"#".concat(h):""),p=[];return this.objects.forEach(function(L,U){(U.startsWith("".concat(l,"#"))||U===l)&&p.push(L)}),p},o.draw=function(r,u,h){var l=this;return(0,O.Z)(P().mark(function p(){var L,U,C,x,N,F,e;return P().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if(L=l.objectNamesToFactories.get(r),!L){n.next=15;break}return U=(u||{}).key,C="".concat(r).concat(U?"#".concat(U):""),l.objects.has(C)&&(x=k.MathUtils.generateUUID(),C+="#".concat(x)),N=(u==null?void 0:u.target)||h,typeof N=="string"?F=l.objects.get(N):(N==null?void 0:N.objecttype__)==="BaseObject"?F=N:F=l.pencil.scene,e=new L().create(u),e.pencil=l.pencil,e.key=C,l.objects.set(C,e),n.next=14,l.addMesh(e,F);case 14:return n.abrupt("return",e);case 15:throw new Error("Unrecognized:".concat(r));case 16:case"end":return n.stop()}},p)}))()},o.addMesh=function(r,u){return(0,O.Z)(P().mark(function h(){return P().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return p.next=2,r.create();case 2:r.object3d&&(r.object3d.userData.BaseObject_=r,u.add(r.object3d)),r.visible=!0,r.render(),r.pm.resolve();case 6:case"end":return p.stop()}},h)}))()},o.erase=function(){for(var r=arguments.length,u=new Array(r),h=0;h<r;h++)u[h]=arguments[h];var l=this;W(u).forEach(function(p){var L=[];if(typeof p=="string"){var U,C=R(p.split("#"),2),x=C[0],N=C[1];(U=L).push.apply(U,W(l.getAllObject(x,{key:N})))}else L.push(p);L.forEach(function(F){l.removeMesh(F)})})},o.removeMesh=function(r){var u=this,h=r.parent;r.object3d&&h.remove(r.object3d),r.traverse(function(l){l.visible=!1,l.dispose(),u.objects.delete(l.key)})},o.update=function(r,u){this.objects.forEach(function(h){h.update(r,u)})},o.setSize=function(r,u){this.objects.forEach(function(h){h.resize(r,u)})},o.dispose=function(){this.objects.forEach(function(r,u){r.dispose(),r.pm.reject("stop draw:".concat(u))}),this.objects.clear(),this.objectNamesToFactories.clear()},_(i,[{key:"objectsPromise",get:function(){var r=[];return this.objects.forEach(function(u){r.push(u.pm.promise)}),r}}]),i}(),A=function(){"use strict";function i(){v(this,i),this.data={}}var o=i.prototype;return o.install=function(){},o.setData=function(r,u){var h,l;this.data[r]=u,(l=(h=this).cb)===null||l===void 0||l.call(h,r)},o.runAll=function(){var r=this;Object.keys(this.data).forEach(function(u){var h,l;(l=(h=r).cb)===null||l===void 0||l.call(h,u)})},o.dispose=function(){this.data={},this.cb=void 0},i}()})(),module.exports=K})();
|