toto10 commited on
Commit
fb54f6e
1 Parent(s): 5b3cd29

5abb6291403b19368a3b842ea4f13b1f23694d90948b2da0ae23e85acf2bb1e9

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +2 -0
  2. sd-3dmodel-loader/doc/images/sceneVisible.png +0 -0
  3. sd-3dmodel-loader/doc/images/sendToControlNet.png +0 -0
  4. sd-3dmodel-loader/doc/images/uploadSettingsPanel.png +0 -0
  5. sd-3dmodel-loader/index.html +25 -0
  6. sd-3dmodel-loader/javascript/3d-model-loader-import.js +40 -0
  7. sd-3dmodel-loader/javascript/lazyload/3d-model-loader-webui.js +116 -0
  8. sd-3dmodel-loader/js/3d-model-loader.bundle.js +0 -0
  9. sd-3dmodel-loader/js/draco_decoder.js +0 -0
  10. sd-3dmodel-loader/js/draco_decoder.wasm +3 -0
  11. sd-3dmodel-loader/js/draco_encoder.js +0 -0
  12. sd-3dmodel-loader/js/draco_wasm_wrapper.js +104 -0
  13. sd-3dmodel-loader/js/es-module-shims.js +789 -0
  14. sd-3dmodel-loader/models/Samba Dancing.fbx +3 -0
  15. sd-3dmodel-loader/models/male02.obj +0 -0
  16. sd-3dmodel-loader/models/pose.vrm +3 -0
  17. sd-3dmodel-loader/package.json +59 -0
  18. sd-3dmodel-loader/poses/kneel.json +1 -0
  19. sd-3dmodel-loader/public/favicon.ico +0 -0
  20. sd-3dmodel-loader/public/index.html +15 -0
  21. sd-3dmodel-loader/public/logo192.png +0 -0
  22. sd-3dmodel-loader/public/logo512.png +0 -0
  23. sd-3dmodel-loader/public/manifest.json +25 -0
  24. sd-3dmodel-loader/public/robots.txt +3 -0
  25. sd-3dmodel-loader/scripts/__pycache__/main.cpython-310.pyc +0 -0
  26. sd-3dmodel-loader/scripts/main.py +84 -0
  27. sd-3dmodel-loader/src/AnimationPanel.js +50 -0
  28. sd-3dmodel-loader/src/CameraPanel.js +58 -0
  29. sd-3dmodel-loader/src/CanvasSettingsPanel.js +95 -0
  30. sd-3dmodel-loader/src/ModelPanel.js +40 -0
  31. sd-3dmodel-loader/src/NumberInput.js +40 -0
  32. sd-3dmodel-loader/src/PosePanel.js +434 -0
  33. sd-3dmodel-loader/src/ScenePanel.js +262 -0
  34. sd-3dmodel-loader/src/SendToControlNetPanel.js +87 -0
  35. sd-3dmodel-loader/src/ThreeJsScene.js +761 -0
  36. sd-3dmodel-loader/src/TopToolbar.js +43 -0
  37. sd-3dmodel-loader/src/index.css +13 -0
  38. sd-3dmodel-loader/src/index.js +105 -0
  39. sd-3dmodel-loader/style.css +14 -0
  40. sd-3dmodel-loader/webpack.config.js +48 -0
  41. sd-webui-3d-open-pose-editor/.devcontainer/devcontainer.json +35 -0
  42. sd-webui-3d-open-pose-editor/.devcontainer/init.sh +8 -0
  43. sd-webui-3d-open-pose-editor/.env.online +1 -0
  44. sd-webui-3d-open-pose-editor/.eslintrc.cjs +21 -0
  45. sd-webui-3d-open-pose-editor/.github/ISSUE_TEMPLATE/bug_report.md +34 -0
  46. sd-webui-3d-open-pose-editor/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  47. sd-webui-3d-open-pose-editor/.github/workflows/pages.yml +68 -0
  48. sd-webui-3d-open-pose-editor/.gitignore +189 -0
  49. sd-webui-3d-open-pose-editor/.prettierrc.cjs +6 -0
  50. sd-webui-3d-open-pose-editor/LICENSE +21 -0
.gitattributes CHANGED
@@ -40,3 +40,5 @@ Stable-Diffusion-Webui-Civitai-Helper/img/all_in_one.png filter=lfs diff=lfs mer
40
  posex/image/sample-webui2.jpg filter=lfs diff=lfs merge=lfs -text
41
  posex/image/sample-webui2.png filter=lfs diff=lfs merge=lfs -text
42
  sd_feed/assets/pinterest.png filter=lfs diff=lfs merge=lfs -text
 
 
 
40
  posex/image/sample-webui2.jpg filter=lfs diff=lfs merge=lfs -text
41
  posex/image/sample-webui2.png filter=lfs diff=lfs merge=lfs -text
42
  sd_feed/assets/pinterest.png filter=lfs diff=lfs merge=lfs -text
43
+ sd-3dmodel-loader/models/Samba[[:space:]]Dancing.fbx filter=lfs diff=lfs merge=lfs -text
44
+ sd-3dmodel-loader/models/pose.vrm filter=lfs diff=lfs merge=lfs -text
sd-3dmodel-loader/doc/images/sceneVisible.png ADDED
sd-3dmodel-loader/doc/images/sendToControlNet.png ADDED
sd-3dmodel-loader/doc/images/uploadSettingsPanel.png ADDED
sd-3dmodel-loader/index.html ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <script async src="js/es-module-shims.js"></script>
6
+ <script type="importmap">
7
+ {
8
+ "imports": {
9
+ "threeDModelLoader": "./js/3d-model-loader.bundle.js"
10
+ }
11
+ }
12
+
13
+ </script>
14
+ <script type="esms-options">
15
+ {
16
+ "noLoadEventRetriggers": true
17
+ }
18
+
19
+
20
+ </script>
21
+ </head>
22
+ <body>
23
+
24
+ </body>
25
+ </html>
sd-3dmodel-loader/javascript/3d-model-loader-import.js ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function () {
2
+ if (!globalThis.threeDModelLoader) globalThis.threeDModelLoader = {};
3
+ const threeDModelLoader = globalThis.threeDModelLoader;
4
+
5
+ function load(cont) {
6
+ const scripts = cont.textContent.trim().split('\n');
7
+ const base_path = `/file=${scripts.shift()}/js`;
8
+ cont.textContent = '';
9
+
10
+ const df = document.createDocumentFragment();
11
+ for (let src of scripts) {
12
+ const script = document.createElement('script');
13
+ script.async = true;
14
+ script.type = 'module';
15
+ script.src = `file=${src}`;
16
+ df.appendChild(script);
17
+ }
18
+
19
+ globalThis.threeDModelLoader.import = async () => {
20
+ const threeDModelLoader = await import(`${base_path}/3d-model-loader.bundle.js`);
21
+
22
+ return {threeDModelLoader};
23
+ };
24
+
25
+ if (!globalThis.threeDModelLoader.imports) {
26
+ globalThis.threeDModelLoader.imports = {};
27
+ }
28
+
29
+ if (!globalThis.threeDModelLoader.imports.threeDModelLoader) {
30
+ globalThis.threeDModelLoader.imports.threeDModelLoader = async () => await import(`${base_path}/3d-model-loader.bundle.js`);
31
+ }
32
+
33
+ cont.appendChild(df);
34
+ }
35
+
36
+ onUiLoaded(function () {
37
+ webGLOutputDiv3DModel = gradioApp().querySelector('#WebGL-output-3dmodel-import');
38
+ load(webGLOutputDiv3DModel);
39
+ })
40
+ })();
sd-3dmodel-loader/javascript/lazyload/3d-model-loader-webui.js ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ console.log('[3D Model Loader] loading...');
2
+
3
+ async function _import() {
4
+ if (!globalThis.threeDModelLoader || !globalThis.threeDModelLoader.import) {
5
+ return await import('threeDModelLoader');
6
+ } else {
7
+ return await globalThis.threeDModelLoader.imports.threeDModelLoader();
8
+ }
9
+ }
10
+
11
+ await _import();
12
+
13
+ (async function () {
14
+ const container = gradioApp().querySelector('#threeDModelLoader-container');
15
+
16
+ const parent = container.parentNode;
17
+ parent.classList.remove("prose");
18
+
19
+ const controlNetNumInput = gradioApp().querySelector('#threeDModelLoader-control-net-num');
20
+ const controlNetNum = controlNetNumInput.value;
21
+
22
+ async function init_canvas() {
23
+ create3dmodelLoaderApp({container: container, controlNetNum: controlNetNum});
24
+
25
+ setSendImageFunc3dmodel(sendImage);
26
+ }
27
+
28
+ await init_canvas();
29
+
30
+ function sendImage(type, index, dt) {
31
+ const selector = type === "txt2img" ? "#txt2img_script_container" : "#img2img_script_container";
32
+
33
+ if (type === "txt2img") {
34
+ switch_to_txt2img();
35
+ } else if (type === "img2img") {
36
+ switch_to_img2img();
37
+ }
38
+
39
+ let container = gradioApp().querySelector(selector);
40
+
41
+ let element = container.querySelector('#controlnet');
42
+
43
+ if (!element) {
44
+ for (const spans of container.querySelectorAll < HTMLSpanElement > (
45
+ '.cursor-pointer > span'
46
+ )) {
47
+ if (!spans.textContent?.includes('ControlNet')) {
48
+ continue
49
+ }
50
+ if (spans.textContent?.includes('M2M')) {
51
+ continue
52
+ }
53
+ element = spans.parentElement?.parentElement
54
+ }
55
+ if (!element) {
56
+ console.error('ControlNet element not found')
57
+ return
58
+ }
59
+ }
60
+
61
+ const imageElems = element.querySelectorAll('div[data-testid="image"]')
62
+
63
+ if (!imageElems[Number(index)]) {
64
+ let accordion = element.querySelector('.icon');
65
+
66
+ if (accordion) {
67
+ accordion.click();
68
+
69
+ let controlNetAppeared = false;
70
+
71
+ let observer = new MutationObserver(function (mutations) {
72
+ mutations.forEach(function (mutation) {
73
+ if (mutation.type === "childList" && mutation.addedNodes.length > 0) {
74
+ for (let i = 0; i < mutation.addedNodes.length; i++) {
75
+ if (mutation.addedNodes[i].tagName === "INPUT") {
76
+
77
+ controlNetAppeared = true;
78
+
79
+ const imageElems2 = element.querySelectorAll('div[data-testid="image"]');
80
+
81
+ updateGradioImage(imageElems2[Number(index)], dt);
82
+
83
+ observer.disconnect();
84
+
85
+ return;
86
+ }
87
+ }
88
+ }
89
+ });
90
+ });
91
+
92
+ observer.observe(element, {childList: true, subtree: true});
93
+ }
94
+ } else {
95
+ updateGradioImage(imageElems[Number(index)], dt);
96
+ }
97
+ }
98
+
99
+ function updateGradioImage(element, dt) {
100
+ let clearButton = element.querySelector("button[aria-label='Clear']");
101
+
102
+ if (clearButton) {
103
+ clearButton.click();
104
+ }
105
+
106
+ const input = element.querySelector("input[type='file']");
107
+ input.value = ''
108
+ input.files = dt.files
109
+ input.dispatchEvent(
110
+ new Event('change', {
111
+ bubbles: true,
112
+ composed: true,
113
+ })
114
+ )
115
+ }
116
+ })();
sd-3dmodel-loader/js/3d-model-loader.bundle.js ADDED
The diff for this file is too large to render. See raw diff
 
sd-3dmodel-loader/js/draco_decoder.js ADDED
The diff for this file is too large to render. See raw diff
 
sd-3dmodel-loader/js/draco_decoder.wasm ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:92322d1cabaa55c8e216c983e58670043b063af59d86a7b6ae8201452ff7987f
3
+ size 281481
sd-3dmodel-loader/js/draco_encoder.js ADDED
The diff for this file is too large to render. See raw diff
 
sd-3dmodel-loader/js/draco_wasm_wrapper.js ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(f){var m=0;return function(){return m<f.length?{done:!1,value:f[m++]}:{done:!0}}};$jscomp.arrayIterator=function(f){return{next:$jscomp.arrayIteratorImpl(f)}};$jscomp.makeIterator=function(f){var m="undefined"!=typeof Symbol&&Symbol.iterator&&f[Symbol.iterator];return m?m.call(f):$jscomp.arrayIterator(f)};
2
+ $jscomp.getGlobal=function(f){return"undefined"!=typeof window&&window===f?f:"undefined"!=typeof global&&null!=global?global:f};$jscomp.global=$jscomp.getGlobal(this);$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(f,m,v){f!=Array.prototype&&f!=Object.prototype&&(f[m]=v.value)};
3
+ $jscomp.polyfill=function(f,m,v,t){if(m){v=$jscomp.global;f=f.split(".");for(t=0;t<f.length-1;t++){var h=f[t];h in v||(v[h]={});v=v[h]}f=f[f.length-1];t=v[f];m=m(t);m!=t&&null!=m&&$jscomp.defineProperty(v,f,{configurable:!0,writable:!0,value:m})}};$jscomp.FORCE_POLYFILL_PROMISE=!1;
4
+ $jscomp.polyfill("Promise",function(f){function m(){this.batch_=null}function v(e){return e instanceof h?e:new h(function(l,f){l(e)})}if(f&&!$jscomp.FORCE_POLYFILL_PROMISE)return f;m.prototype.asyncExecute=function(e){if(null==this.batch_){this.batch_=[];var l=this;this.asyncExecuteFunction(function(){l.executeBatch_()})}this.batch_.push(e)};var t=$jscomp.global.setTimeout;m.prototype.asyncExecuteFunction=function(e){t(e,0)};m.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var e=
5
+ this.batch_;this.batch_=[];for(var l=0;l<e.length;++l){var f=e[l];e[l]=null;try{f()}catch(z){this.asyncThrow_(z)}}}this.batch_=null};m.prototype.asyncThrow_=function(e){this.asyncExecuteFunction(function(){throw e;})};var h=function(e){this.state_=0;this.result_=void 0;this.onSettledCallbacks_=[];var l=this.createResolveAndReject_();try{e(l.resolve,l.reject)}catch(S){l.reject(S)}};h.prototype.createResolveAndReject_=function(){function e(e){return function(h){f||(f=!0,e.call(l,h))}}var l=this,f=!1;
6
+ return{resolve:e(this.resolveTo_),reject:e(this.reject_)}};h.prototype.resolveTo_=function(e){if(e===this)this.reject_(new TypeError("A Promise cannot resolve to itself"));else if(e instanceof h)this.settleSameAsPromise_(e);else{a:switch(typeof e){case "object":var l=null!=e;break a;case "function":l=!0;break a;default:l=!1}l?this.resolveToNonPromiseObj_(e):this.fulfill_(e)}};h.prototype.resolveToNonPromiseObj_=function(e){var l=void 0;try{l=e.then}catch(S){this.reject_(S);return}"function"==typeof l?
7
+ this.settleSameAsThenable_(l,e):this.fulfill_(e)};h.prototype.reject_=function(e){this.settle_(2,e)};h.prototype.fulfill_=function(e){this.settle_(1,e)};h.prototype.settle_=function(e,l){if(0!=this.state_)throw Error("Cannot settle("+e+", "+l+"): Promise already settled in state"+this.state_);this.state_=e;this.result_=l;this.executeOnSettledCallbacks_()};h.prototype.executeOnSettledCallbacks_=function(){if(null!=this.onSettledCallbacks_){for(var e=0;e<this.onSettledCallbacks_.length;++e)X.asyncExecute(this.onSettledCallbacks_[e]);
8
+ this.onSettledCallbacks_=null}};var X=new m;h.prototype.settleSameAsPromise_=function(e){var l=this.createResolveAndReject_();e.callWhenSettled_(l.resolve,l.reject)};h.prototype.settleSameAsThenable_=function(e,l){var f=this.createResolveAndReject_();try{e.call(l,f.resolve,f.reject)}catch(z){f.reject(z)}};h.prototype.then=function(e,f){function l(e,f){return"function"==typeof e?function(f){try{m(e(f))}catch(p){v(p)}}:f}var m,v,t=new h(function(e,f){m=e;v=f});this.callWhenSettled_(l(e,m),l(f,v));return t};
9
+ h.prototype.catch=function(e){return this.then(void 0,e)};h.prototype.callWhenSettled_=function(e,f){function l(){switch(h.state_){case 1:e(h.result_);break;case 2:f(h.result_);break;default:throw Error("Unexpected state: "+h.state_);}}var h=this;null==this.onSettledCallbacks_?X.asyncExecute(l):this.onSettledCallbacks_.push(l)};h.resolve=v;h.reject=function(e){return new h(function(f,h){h(e)})};h.race=function(e){return new h(function(f,h){for(var l=$jscomp.makeIterator(e),m=l.next();!m.done;m=l.next())v(m.value).callWhenSettled_(f,
10
+ h)})};h.all=function(e){var f=$jscomp.makeIterator(e),m=f.next();return m.done?v([]):new h(function(e,h){function l(f){return function(h){t[f]=h;z--;0==z&&e(t)}}var t=[],z=0;do t.push(void 0),z++,v(m.value).callWhenSettled_(l(t.length-1),h),m=f.next();while(!m.done)})};return h},"es6","es3");
11
+ var DracoDecoderModule=function(){var f="undefined"!==typeof document&&document.currentScript?document.currentScript.src:void 0;"undefined"!==typeof __filename&&(f=f||__filename);return function(m){function v(k){return a.locateFile?a.locateFile(k,M):M+k}function t(a,c){a||z("Assertion failed: "+c)}function h(a,c,b){var d=c+b;for(b=c;a[b]&&!(b>=d);)++b;if(16<b-c&&a.subarray&&xa)return xa.decode(a.subarray(c,b));for(d="";c<b;){var k=a[c++];if(k&128){var e=a[c++]&63;if(192==(k&224))d+=String.fromCharCode((k&
12
+ 31)<<6|e);else{var f=a[c++]&63;k=224==(k&240)?(k&15)<<12|e<<6|f:(k&7)<<18|e<<12|f<<6|a[c++]&63;65536>k?d+=String.fromCharCode(k):(k-=65536,d+=String.fromCharCode(55296|k>>10,56320|k&1023))}}else d+=String.fromCharCode(k)}return d}function X(a,c){return a?h(ca,a,c):""}function e(a,c){0<a%c&&(a+=c-a%c);return a}function l(k){ka=k;a.HEAP8=T=new Int8Array(k);a.HEAP16=new Int16Array(k);a.HEAP32=P=new Int32Array(k);a.HEAPU8=ca=new Uint8Array(k);a.HEAPU16=new Uint16Array(k);a.HEAPU32=new Uint32Array(k);
13
+ a.HEAPF32=new Float32Array(k);a.HEAPF64=new Float64Array(k)}function S(k){for(;0<k.length;){var c=k.shift();if("function"==typeof c)c();else{var b=c.func;"number"===typeof b?void 0===c.arg?a.dynCall_v(b):a.dynCall_vi(b,c.arg):b(void 0===c.arg?null:c.arg)}}}function z(k){if(a.onAbort)a.onAbort(k);k+="";ya(k);Y(k);za=!0;throw new WebAssembly.RuntimeError("abort("+k+"). Build with -s ASSERTIONS=1 for more info.");}function va(a){return String.prototype.startsWith?a.startsWith("data:application/octet-stream;base64,"):
14
+ 0===a.indexOf("data:application/octet-stream;base64,")}function wa(){try{if(da)return new Uint8Array(da);if(la)return la(U);throw"both async and sync fetching of the wasm failed";}catch(k){z(k)}}function Ma(){return da||!ea&&!Z||"function"!==typeof fetch?new Promise(function(a,c){a(wa())}):fetch(U,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+U+"'";return a.arrayBuffer()}).catch(function(){return wa()})}function ba(){if(!ba.strings){var a={USER:"web_user",
15
+ LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"===typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:na},c;for(c in Aa)a[c]=Aa[c];var b=[];for(c in a)b.push(c+"="+a[c]);ba.strings=b}return ba.strings}function ma(k){function c(){if(!fa&&(fa=!0,!za)){Ba=!0;S(Ca);S(Da);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;)Ea.unshift(a.postRun.shift());
16
+ S(Ea)}}if(!(0<aa)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)Fa.unshift(a.preRun.shift());S(Fa);0<aa||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);c()},1)):c())}}function p(){}function u(a){return(a||p).__cache__}function N(a,c){var b=u(c),d=b[a];if(d)return d;d=Object.create((c||p).prototype);d.ptr=a;return b[a]=d}function V(a){if("string"===typeof a){for(var c=0,b=0;b<a.length;++b){var d=a.charCodeAt(b);
17
+ 55296<=d&&57343>=d&&(d=65536+((d&1023)<<10)|a.charCodeAt(++b)&1023);127>=d?++c:c=2047>=d?c+2:65535>=d?c+3:c+4}c=Array(c+1);b=0;d=c.length;if(0<d){d=b+d-1;for(var k=0;k<a.length;++k){var e=a.charCodeAt(k);if(55296<=e&&57343>=e){var f=a.charCodeAt(++k);e=65536+((e&1023)<<10)|f&1023}if(127>=e){if(b>=d)break;c[b++]=e}else{if(2047>=e){if(b+1>=d)break;c[b++]=192|e>>6}else{if(65535>=e){if(b+2>=d)break;c[b++]=224|e>>12}else{if(b+3>=d)break;c[b++]=240|e>>18;c[b++]=128|e>>12&63}c[b++]=128|e>>6&63}c[b++]=128|
18
+ e&63}}c[b]=0}a=n.alloc(c,T);n.copy(c,T,a)}return a}function x(){throw"cannot construct a Status, no constructor in IDL";}function A(){this.ptr=Oa();u(A)[this.ptr]=this}function B(){this.ptr=Pa();u(B)[this.ptr]=this}function C(){this.ptr=Qa();u(C)[this.ptr]=this}function D(){this.ptr=Ra();u(D)[this.ptr]=this}function E(){this.ptr=Sa();u(E)[this.ptr]=this}function q(){this.ptr=Ta();u(q)[this.ptr]=this}function J(){this.ptr=Ua();u(J)[this.ptr]=this}function w(){this.ptr=Va();u(w)[this.ptr]=this}function F(){this.ptr=
19
+ Wa();u(F)[this.ptr]=this}function r(){this.ptr=Xa();u(r)[this.ptr]=this}function G(){this.ptr=Ya();u(G)[this.ptr]=this}function H(){this.ptr=Za();u(H)[this.ptr]=this}function O(){this.ptr=$a();u(O)[this.ptr]=this}function K(){this.ptr=ab();u(K)[this.ptr]=this}function g(){this.ptr=bb();u(g)[this.ptr]=this}function y(){this.ptr=cb();u(y)[this.ptr]=this}function Q(){throw"cannot construct a VoidPtr, no constructor in IDL";}function I(){this.ptr=db();u(I)[this.ptr]=this}function L(){this.ptr=eb();u(L)[this.ptr]=
20
+ this}m=m||{};var a="undefined"!==typeof m?m:{},Ga=!1,Ha=!1;a.onRuntimeInitialized=function(){Ga=!0;if(Ha&&"function"===typeof a.onModuleLoaded)a.onModuleLoaded(a)};a.onModuleParsed=function(){Ha=!0;if(Ga&&"function"===typeof a.onModuleLoaded)a.onModuleLoaded(a)};a.isVersionSupported=function(a){if("string"!==typeof a)return!1;a=a.split(".");return 2>a.length||3<a.length?!1:1==a[0]&&0<=a[1]&&3>=a[1]?!0:0!=a[0]||10<a[1]?!1:!0};var ha={},W;for(W in a)a.hasOwnProperty(W)&&(ha[W]=a[W]);var na="./this.program",
21
+ ea=!1,Z=!1,oa=!1,fb=!1,Ia=!1;ea="object"===typeof window;Z="function"===typeof importScripts;oa=(fb="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node)&&!ea&&!Z;Ia=!ea&&!oa&&!Z;var M="",pa,qa;if(oa){M=__dirname+"/";var ra=function(a,c){pa||(pa=require("fs"));qa||(qa=require("path"));a=qa.normalize(a);return pa.readFileSync(a,c?null:"utf8")};var la=function(a){a=ra(a,!0);a.buffer||(a=new Uint8Array(a));t(a.buffer);return a};1<process.argv.length&&
22
+ (na=process.argv[1].replace(/\\/g,"/"));process.argv.slice(2);process.on("uncaughtException",function(a){throw a;});process.on("unhandledRejection",z);a.inspect=function(){return"[Emscripten Module object]"}}else if(Ia)"undefined"!=typeof read&&(ra=function(a){return read(a)}),la=function(a){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(a));a=read(a,"binary");t("object"===typeof a);return a},"undefined"!==typeof print&&("undefined"===typeof console&&(console={}),console.log=print,
23
+ console.warn=console.error="undefined"!==typeof printErr?printErr:print);else if(ea||Z)Z?M=self.location.href:document.currentScript&&(M=document.currentScript.src),f&&(M=f),M=0!==M.indexOf("blob:")?M.substr(0,M.lastIndexOf("/")+1):"",ra=function(a){var c=new XMLHttpRequest;c.open("GET",a,!1);c.send(null);return c.responseText},Z&&(la=function(a){var c=new XMLHttpRequest;c.open("GET",a,!1);c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)});var ya=a.print||console.log.bind(console),
24
+ Y=a.printErr||console.warn.bind(console);for(W in ha)ha.hasOwnProperty(W)&&(a[W]=ha[W]);ha=null;a.thisProgram&&(na=a.thisProgram);var da;a.wasmBinary&&(da=a.wasmBinary);"object"!==typeof WebAssembly&&Y("no native wasm support detected");var ia,gb=new WebAssembly.Table({initial:381,maximum:381,element:"anyfunc"}),za=!1,xa="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;"undefined"!==typeof TextDecoder&&new TextDecoder("utf-16le");var T,ca,P,Ja=a.TOTAL_MEMORY||16777216;if(ia=a.wasmMemory?
25
+ a.wasmMemory:new WebAssembly.Memory({initial:Ja/65536}))var ka=ia.buffer;Ja=ka.byteLength;l(ka);P[4604]=5261456;var Fa=[],Ca=[],Da=[],Ea=[],Ba=!1,aa=0,sa=null,ja=null;a.preloadedImages={};a.preloadedAudios={};var U="draco_decoder.wasm";va(U)||(U=v(U));Ca.push({func:function(){hb()}});var Aa={},R={buffers:[null,[],[]],printChar:function(a,c){var b=R.buffers[a];0===c||10===c?((1===a?ya:Y)(h(b,0)),b.length=0):b.push(c)},varargs:0,get:function(a){R.varargs+=4;return P[R.varargs-4>>2]},getStr:function(){return X(R.get())},
26
+ get64:function(){var a=R.get();R.get();return a},getZero:function(){R.get()}},Ka={__cxa_allocate_exception:function(a){return ib(a)},__cxa_throw:function(a,c,b){"uncaught_exception"in ta?ta.uncaught_exceptions++:ta.uncaught_exceptions=1;throw a;},abort:function(){z()},emscripten_get_sbrk_ptr:function(){return 18416},emscripten_memcpy_big:function(a,c,b){ca.set(ca.subarray(c,c+b),a)},emscripten_resize_heap:function(a){if(2147418112<a)return!1;for(var c=Math.max(T.length,16777216);c<a;)c=536870912>=
27
+ c?e(2*c,65536):Math.min(e((3*c+2147483648)/4,65536),2147418112);a:{try{ia.grow(c-ka.byteLength+65535>>16);l(ia.buffer);var b=1;break a}catch(d){}b=void 0}return b?!0:!1},environ_get:function(a,c){var b=0;ba().forEach(function(d,e){var f=c+b;e=P[a+4*e>>2]=f;for(f=0;f<d.length;++f)T[e++>>0]=d.charCodeAt(f);T[e>>0]=0;b+=d.length+1});return 0},environ_sizes_get:function(a,c){var b=ba();P[a>>2]=b.length;var d=0;b.forEach(function(a){d+=a.length+1});P[c>>2]=d;return 0},fd_close:function(a){return 0},fd_seek:function(a,
28
+ c,b,d,e){return 0},fd_write:function(a,c,b,d){try{for(var e=0,f=0;f<b;f++){for(var g=P[c+8*f>>2],k=P[c+(8*f+4)>>2],h=0;h<k;h++)R.printChar(a,ca[g+h]);e+=k}P[d>>2]=e;return 0}catch(ua){return"undefined"!==typeof FS&&ua instanceof FS.ErrnoError||z(ua),ua.errno}},memory:ia,setTempRet0:function(a){},table:gb},La=function(){function e(c,b){a.asm=c.exports;aa--;a.monitorRunDependencies&&a.monitorRunDependencies(aa);0==aa&&(null!==sa&&(clearInterval(sa),sa=null),ja&&(c=ja,ja=null,c()))}function c(a){e(a.instance)}
29
+ function b(a){return Ma().then(function(a){return WebAssembly.instantiate(a,d)}).then(a,function(a){Y("failed to asynchronously prepare wasm: "+a);z(a)})}var d={env:Ka,wasi_unstable:Ka};aa++;a.monitorRunDependencies&&a.monitorRunDependencies(aa);if(a.instantiateWasm)try{return a.instantiateWasm(d,e)}catch(Na){return Y("Module.instantiateWasm callback failed with error: "+Na),!1}(function(){if(da||"function"!==typeof WebAssembly.instantiateStreaming||va(U)||"function"!==typeof fetch)return b(c);fetch(U,
30
+ {credentials:"same-origin"}).then(function(a){return WebAssembly.instantiateStreaming(a,d).then(c,function(a){Y("wasm streaming compile failed: "+a);Y("falling back to ArrayBuffer instantiation");b(c)})})})();return{}}();a.asm=La;var hb=a.___wasm_call_ctors=function(){return a.asm.__wasm_call_ctors.apply(null,arguments)},jb=a._emscripten_bind_Status_code_0=function(){return a.asm.emscripten_bind_Status_code_0.apply(null,arguments)},kb=a._emscripten_bind_Status_ok_0=function(){return a.asm.emscripten_bind_Status_ok_0.apply(null,
31
+ arguments)},lb=a._emscripten_bind_Status_error_msg_0=function(){return a.asm.emscripten_bind_Status_error_msg_0.apply(null,arguments)},mb=a._emscripten_bind_Status___destroy___0=function(){return a.asm.emscripten_bind_Status___destroy___0.apply(null,arguments)},Oa=a._emscripten_bind_DracoUInt16Array_DracoUInt16Array_0=function(){return a.asm.emscripten_bind_DracoUInt16Array_DracoUInt16Array_0.apply(null,arguments)},nb=a._emscripten_bind_DracoUInt16Array_GetValue_1=function(){return a.asm.emscripten_bind_DracoUInt16Array_GetValue_1.apply(null,
32
+ arguments)},ob=a._emscripten_bind_DracoUInt16Array_size_0=function(){return a.asm.emscripten_bind_DracoUInt16Array_size_0.apply(null,arguments)},pb=a._emscripten_bind_DracoUInt16Array___destroy___0=function(){return a.asm.emscripten_bind_DracoUInt16Array___destroy___0.apply(null,arguments)},Pa=a._emscripten_bind_PointCloud_PointCloud_0=function(){return a.asm.emscripten_bind_PointCloud_PointCloud_0.apply(null,arguments)},qb=a._emscripten_bind_PointCloud_num_attributes_0=function(){return a.asm.emscripten_bind_PointCloud_num_attributes_0.apply(null,
33
+ arguments)},rb=a._emscripten_bind_PointCloud_num_points_0=function(){return a.asm.emscripten_bind_PointCloud_num_points_0.apply(null,arguments)},sb=a._emscripten_bind_PointCloud___destroy___0=function(){return a.asm.emscripten_bind_PointCloud___destroy___0.apply(null,arguments)},Qa=a._emscripten_bind_DracoUInt8Array_DracoUInt8Array_0=function(){return a.asm.emscripten_bind_DracoUInt8Array_DracoUInt8Array_0.apply(null,arguments)},tb=a._emscripten_bind_DracoUInt8Array_GetValue_1=function(){return a.asm.emscripten_bind_DracoUInt8Array_GetValue_1.apply(null,
34
+ arguments)},ub=a._emscripten_bind_DracoUInt8Array_size_0=function(){return a.asm.emscripten_bind_DracoUInt8Array_size_0.apply(null,arguments)},vb=a._emscripten_bind_DracoUInt8Array___destroy___0=function(){return a.asm.emscripten_bind_DracoUInt8Array___destroy___0.apply(null,arguments)},Ra=a._emscripten_bind_DracoUInt32Array_DracoUInt32Array_0=function(){return a.asm.emscripten_bind_DracoUInt32Array_DracoUInt32Array_0.apply(null,arguments)},wb=a._emscripten_bind_DracoUInt32Array_GetValue_1=function(){return a.asm.emscripten_bind_DracoUInt32Array_GetValue_1.apply(null,
35
+ arguments)},xb=a._emscripten_bind_DracoUInt32Array_size_0=function(){return a.asm.emscripten_bind_DracoUInt32Array_size_0.apply(null,arguments)},yb=a._emscripten_bind_DracoUInt32Array___destroy___0=function(){return a.asm.emscripten_bind_DracoUInt32Array___destroy___0.apply(null,arguments)},Sa=a._emscripten_bind_AttributeOctahedronTransform_AttributeOctahedronTransform_0=function(){return a.asm.emscripten_bind_AttributeOctahedronTransform_AttributeOctahedronTransform_0.apply(null,arguments)},zb=a._emscripten_bind_AttributeOctahedronTransform_InitFromAttribute_1=
36
+ function(){return a.asm.emscripten_bind_AttributeOctahedronTransform_InitFromAttribute_1.apply(null,arguments)},Ab=a._emscripten_bind_AttributeOctahedronTransform_quantization_bits_0=function(){return a.asm.emscripten_bind_AttributeOctahedronTransform_quantization_bits_0.apply(null,arguments)},Bb=a._emscripten_bind_AttributeOctahedronTransform___destroy___0=function(){return a.asm.emscripten_bind_AttributeOctahedronTransform___destroy___0.apply(null,arguments)},Ta=a._emscripten_bind_PointAttribute_PointAttribute_0=
37
+ function(){return a.asm.emscripten_bind_PointAttribute_PointAttribute_0.apply(null,arguments)},Cb=a._emscripten_bind_PointAttribute_size_0=function(){return a.asm.emscripten_bind_PointAttribute_size_0.apply(null,arguments)},Db=a._emscripten_bind_PointAttribute_GetAttributeTransformData_0=function(){return a.asm.emscripten_bind_PointAttribute_GetAttributeTransformData_0.apply(null,arguments)},Eb=a._emscripten_bind_PointAttribute_attribute_type_0=function(){return a.asm.emscripten_bind_PointAttribute_attribute_type_0.apply(null,
38
+ arguments)},Fb=a._emscripten_bind_PointAttribute_data_type_0=function(){return a.asm.emscripten_bind_PointAttribute_data_type_0.apply(null,arguments)},Gb=a._emscripten_bind_PointAttribute_num_components_0=function(){return a.asm.emscripten_bind_PointAttribute_num_components_0.apply(null,arguments)},Hb=a._emscripten_bind_PointAttribute_normalized_0=function(){return a.asm.emscripten_bind_PointAttribute_normalized_0.apply(null,arguments)},Ib=a._emscripten_bind_PointAttribute_byte_stride_0=function(){return a.asm.emscripten_bind_PointAttribute_byte_stride_0.apply(null,
39
+ arguments)},Jb=a._emscripten_bind_PointAttribute_byte_offset_0=function(){return a.asm.emscripten_bind_PointAttribute_byte_offset_0.apply(null,arguments)},Kb=a._emscripten_bind_PointAttribute_unique_id_0=function(){return a.asm.emscripten_bind_PointAttribute_unique_id_0.apply(null,arguments)},Lb=a._emscripten_bind_PointAttribute___destroy___0=function(){return a.asm.emscripten_bind_PointAttribute___destroy___0.apply(null,arguments)},Ua=a._emscripten_bind_AttributeTransformData_AttributeTransformData_0=
40
+ function(){return a.asm.emscripten_bind_AttributeTransformData_AttributeTransformData_0.apply(null,arguments)},Mb=a._emscripten_bind_AttributeTransformData_transform_type_0=function(){return a.asm.emscripten_bind_AttributeTransformData_transform_type_0.apply(null,arguments)},Nb=a._emscripten_bind_AttributeTransformData___destroy___0=function(){return a.asm.emscripten_bind_AttributeTransformData___destroy___0.apply(null,arguments)},Va=a._emscripten_bind_AttributeQuantizationTransform_AttributeQuantizationTransform_0=
41
+ function(){return a.asm.emscripten_bind_AttributeQuantizationTransform_AttributeQuantizationTransform_0.apply(null,arguments)},Ob=a._emscripten_bind_AttributeQuantizationTransform_InitFromAttribute_1=function(){return a.asm.emscripten_bind_AttributeQuantizationTransform_InitFromAttribute_1.apply(null,arguments)},Pb=a._emscripten_bind_AttributeQuantizationTransform_quantization_bits_0=function(){return a.asm.emscripten_bind_AttributeQuantizationTransform_quantization_bits_0.apply(null,arguments)},
42
+ Qb=a._emscripten_bind_AttributeQuantizationTransform_min_value_1=function(){return a.asm.emscripten_bind_AttributeQuantizationTransform_min_value_1.apply(null,arguments)},Rb=a._emscripten_bind_AttributeQuantizationTransform_range_0=function(){return a.asm.emscripten_bind_AttributeQuantizationTransform_range_0.apply(null,arguments)},Sb=a._emscripten_bind_AttributeQuantizationTransform___destroy___0=function(){return a.asm.emscripten_bind_AttributeQuantizationTransform___destroy___0.apply(null,arguments)},
43
+ Wa=a._emscripten_bind_DracoInt8Array_DracoInt8Array_0=function(){return a.asm.emscripten_bind_DracoInt8Array_DracoInt8Array_0.apply(null,arguments)},Tb=a._emscripten_bind_DracoInt8Array_GetValue_1=function(){return a.asm.emscripten_bind_DracoInt8Array_GetValue_1.apply(null,arguments)},Ub=a._emscripten_bind_DracoInt8Array_size_0=function(){return a.asm.emscripten_bind_DracoInt8Array_size_0.apply(null,arguments)},Vb=a._emscripten_bind_DracoInt8Array___destroy___0=function(){return a.asm.emscripten_bind_DracoInt8Array___destroy___0.apply(null,
44
+ arguments)},Xa=a._emscripten_bind_MetadataQuerier_MetadataQuerier_0=function(){return a.asm.emscripten_bind_MetadataQuerier_MetadataQuerier_0.apply(null,arguments)},Wb=a._emscripten_bind_MetadataQuerier_HasEntry_2=function(){return a.asm.emscripten_bind_MetadataQuerier_HasEntry_2.apply(null,arguments)},Xb=a._emscripten_bind_MetadataQuerier_GetIntEntry_2=function(){return a.asm.emscripten_bind_MetadataQuerier_GetIntEntry_2.apply(null,arguments)},Yb=a._emscripten_bind_MetadataQuerier_GetIntEntryArray_3=
45
+ function(){return a.asm.emscripten_bind_MetadataQuerier_GetIntEntryArray_3.apply(null,arguments)},Zb=a._emscripten_bind_MetadataQuerier_GetDoubleEntry_2=function(){return a.asm.emscripten_bind_MetadataQuerier_GetDoubleEntry_2.apply(null,arguments)},$b=a._emscripten_bind_MetadataQuerier_GetStringEntry_2=function(){return a.asm.emscripten_bind_MetadataQuerier_GetStringEntry_2.apply(null,arguments)},ac=a._emscripten_bind_MetadataQuerier_NumEntries_1=function(){return a.asm.emscripten_bind_MetadataQuerier_NumEntries_1.apply(null,
46
+ arguments)},bc=a._emscripten_bind_MetadataQuerier_GetEntryName_2=function(){return a.asm.emscripten_bind_MetadataQuerier_GetEntryName_2.apply(null,arguments)},cc=a._emscripten_bind_MetadataQuerier___destroy___0=function(){return a.asm.emscripten_bind_MetadataQuerier___destroy___0.apply(null,arguments)},Ya=a._emscripten_bind_DracoInt16Array_DracoInt16Array_0=function(){return a.asm.emscripten_bind_DracoInt16Array_DracoInt16Array_0.apply(null,arguments)},dc=a._emscripten_bind_DracoInt16Array_GetValue_1=
47
+ function(){return a.asm.emscripten_bind_DracoInt16Array_GetValue_1.apply(null,arguments)},ec=a._emscripten_bind_DracoInt16Array_size_0=function(){return a.asm.emscripten_bind_DracoInt16Array_size_0.apply(null,arguments)},fc=a._emscripten_bind_DracoInt16Array___destroy___0=function(){return a.asm.emscripten_bind_DracoInt16Array___destroy___0.apply(null,arguments)},Za=a._emscripten_bind_DracoFloat32Array_DracoFloat32Array_0=function(){return a.asm.emscripten_bind_DracoFloat32Array_DracoFloat32Array_0.apply(null,
48
+ arguments)},gc=a._emscripten_bind_DracoFloat32Array_GetValue_1=function(){return a.asm.emscripten_bind_DracoFloat32Array_GetValue_1.apply(null,arguments)},hc=a._emscripten_bind_DracoFloat32Array_size_0=function(){return a.asm.emscripten_bind_DracoFloat32Array_size_0.apply(null,arguments)},ic=a._emscripten_bind_DracoFloat32Array___destroy___0=function(){return a.asm.emscripten_bind_DracoFloat32Array___destroy___0.apply(null,arguments)},$a=a._emscripten_bind_GeometryAttribute_GeometryAttribute_0=function(){return a.asm.emscripten_bind_GeometryAttribute_GeometryAttribute_0.apply(null,
49
+ arguments)},jc=a._emscripten_bind_GeometryAttribute___destroy___0=function(){return a.asm.emscripten_bind_GeometryAttribute___destroy___0.apply(null,arguments)},ab=a._emscripten_bind_DecoderBuffer_DecoderBuffer_0=function(){return a.asm.emscripten_bind_DecoderBuffer_DecoderBuffer_0.apply(null,arguments)},kc=a._emscripten_bind_DecoderBuffer_Init_2=function(){return a.asm.emscripten_bind_DecoderBuffer_Init_2.apply(null,arguments)},lc=a._emscripten_bind_DecoderBuffer___destroy___0=function(){return a.asm.emscripten_bind_DecoderBuffer___destroy___0.apply(null,
50
+ arguments)},bb=a._emscripten_bind_Decoder_Decoder_0=function(){return a.asm.emscripten_bind_Decoder_Decoder_0.apply(null,arguments)},mc=a._emscripten_bind_Decoder_GetEncodedGeometryType_1=function(){return a.asm.emscripten_bind_Decoder_GetEncodedGeometryType_1.apply(null,arguments)},nc=a._emscripten_bind_Decoder_DecodeBufferToPointCloud_2=function(){return a.asm.emscripten_bind_Decoder_DecodeBufferToPointCloud_2.apply(null,arguments)},oc=a._emscripten_bind_Decoder_DecodeBufferToMesh_2=function(){return a.asm.emscripten_bind_Decoder_DecodeBufferToMesh_2.apply(null,
51
+ arguments)},pc=a._emscripten_bind_Decoder_GetAttributeId_2=function(){return a.asm.emscripten_bind_Decoder_GetAttributeId_2.apply(null,arguments)},qc=a._emscripten_bind_Decoder_GetAttributeIdByName_2=function(){return a.asm.emscripten_bind_Decoder_GetAttributeIdByName_2.apply(null,arguments)},rc=a._emscripten_bind_Decoder_GetAttributeIdByMetadataEntry_3=function(){return a.asm.emscripten_bind_Decoder_GetAttributeIdByMetadataEntry_3.apply(null,arguments)},sc=a._emscripten_bind_Decoder_GetAttribute_2=
52
+ function(){return a.asm.emscripten_bind_Decoder_GetAttribute_2.apply(null,arguments)},tc=a._emscripten_bind_Decoder_GetAttributeByUniqueId_2=function(){return a.asm.emscripten_bind_Decoder_GetAttributeByUniqueId_2.apply(null,arguments)},uc=a._emscripten_bind_Decoder_GetMetadata_1=function(){return a.asm.emscripten_bind_Decoder_GetMetadata_1.apply(null,arguments)},vc=a._emscripten_bind_Decoder_GetAttributeMetadata_2=function(){return a.asm.emscripten_bind_Decoder_GetAttributeMetadata_2.apply(null,
53
+ arguments)},wc=a._emscripten_bind_Decoder_GetFaceFromMesh_3=function(){return a.asm.emscripten_bind_Decoder_GetFaceFromMesh_3.apply(null,arguments)},xc=a._emscripten_bind_Decoder_GetTriangleStripsFromMesh_2=function(){return a.asm.emscripten_bind_Decoder_GetTriangleStripsFromMesh_2.apply(null,arguments)},yc=a._emscripten_bind_Decoder_GetTrianglesUInt16Array_3=function(){return a.asm.emscripten_bind_Decoder_GetTrianglesUInt16Array_3.apply(null,arguments)},zc=a._emscripten_bind_Decoder_GetTrianglesUInt32Array_3=
54
+ function(){return a.asm.emscripten_bind_Decoder_GetTrianglesUInt32Array_3.apply(null,arguments)},Ac=a._emscripten_bind_Decoder_GetAttributeFloat_3=function(){return a.asm.emscripten_bind_Decoder_GetAttributeFloat_3.apply(null,arguments)},Bc=a._emscripten_bind_Decoder_GetAttributeFloatForAllPoints_3=function(){return a.asm.emscripten_bind_Decoder_GetAttributeFloatForAllPoints_3.apply(null,arguments)},Cc=a._emscripten_bind_Decoder_GetAttributeIntForAllPoints_3=function(){return a.asm.emscripten_bind_Decoder_GetAttributeIntForAllPoints_3.apply(null,
55
+ arguments)},Dc=a._emscripten_bind_Decoder_GetAttributeInt8ForAllPoints_3=function(){return a.asm.emscripten_bind_Decoder_GetAttributeInt8ForAllPoints_3.apply(null,arguments)},Ec=a._emscripten_bind_Decoder_GetAttributeUInt8ForAllPoints_3=function(){return a.asm.emscripten_bind_Decoder_GetAttributeUInt8ForAllPoints_3.apply(null,arguments)},Fc=a._emscripten_bind_Decoder_GetAttributeInt16ForAllPoints_3=function(){return a.asm.emscripten_bind_Decoder_GetAttributeInt16ForAllPoints_3.apply(null,arguments)},
56
+ Gc=a._emscripten_bind_Decoder_GetAttributeUInt16ForAllPoints_3=function(){return a.asm.emscripten_bind_Decoder_GetAttributeUInt16ForAllPoints_3.apply(null,arguments)},Hc=a._emscripten_bind_Decoder_GetAttributeInt32ForAllPoints_3=function(){return a.asm.emscripten_bind_Decoder_GetAttributeInt32ForAllPoints_3.apply(null,arguments)},Ic=a._emscripten_bind_Decoder_GetAttributeUInt32ForAllPoints_3=function(){return a.asm.emscripten_bind_Decoder_GetAttributeUInt32ForAllPoints_3.apply(null,arguments)},Jc=
57
+ a._emscripten_bind_Decoder_GetAttributeDataArrayForAllPoints_5=function(){return a.asm.emscripten_bind_Decoder_GetAttributeDataArrayForAllPoints_5.apply(null,arguments)},Kc=a._emscripten_bind_Decoder_SkipAttributeTransform_1=function(){return a.asm.emscripten_bind_Decoder_SkipAttributeTransform_1.apply(null,arguments)},Lc=a._emscripten_bind_Decoder___destroy___0=function(){return a.asm.emscripten_bind_Decoder___destroy___0.apply(null,arguments)},cb=a._emscripten_bind_Mesh_Mesh_0=function(){return a.asm.emscripten_bind_Mesh_Mesh_0.apply(null,
58
+ arguments)},Mc=a._emscripten_bind_Mesh_num_faces_0=function(){return a.asm.emscripten_bind_Mesh_num_faces_0.apply(null,arguments)},Nc=a._emscripten_bind_Mesh_num_attributes_0=function(){return a.asm.emscripten_bind_Mesh_num_attributes_0.apply(null,arguments)},Oc=a._emscripten_bind_Mesh_num_points_0=function(){return a.asm.emscripten_bind_Mesh_num_points_0.apply(null,arguments)},Pc=a._emscripten_bind_Mesh___destroy___0=function(){return a.asm.emscripten_bind_Mesh___destroy___0.apply(null,arguments)},
59
+ Qc=a._emscripten_bind_VoidPtr___destroy___0=function(){return a.asm.emscripten_bind_VoidPtr___destroy___0.apply(null,arguments)},db=a._emscripten_bind_DracoInt32Array_DracoInt32Array_0=function(){return a.asm.emscripten_bind_DracoInt32Array_DracoInt32Array_0.apply(null,arguments)},Rc=a._emscripten_bind_DracoInt32Array_GetValue_1=function(){return a.asm.emscripten_bind_DracoInt32Array_GetValue_1.apply(null,arguments)},Sc=a._emscripten_bind_DracoInt32Array_size_0=function(){return a.asm.emscripten_bind_DracoInt32Array_size_0.apply(null,
60
+ arguments)},Tc=a._emscripten_bind_DracoInt32Array___destroy___0=function(){return a.asm.emscripten_bind_DracoInt32Array___destroy___0.apply(null,arguments)},eb=a._emscripten_bind_Metadata_Metadata_0=function(){return a.asm.emscripten_bind_Metadata_Metadata_0.apply(null,arguments)},Uc=a._emscripten_bind_Metadata___destroy___0=function(){return a.asm.emscripten_bind_Metadata___destroy___0.apply(null,arguments)},Vc=a._emscripten_enum_draco_StatusCode_OK=function(){return a.asm.emscripten_enum_draco_StatusCode_OK.apply(null,
61
+ arguments)},Wc=a._emscripten_enum_draco_StatusCode_DRACO_ERROR=function(){return a.asm.emscripten_enum_draco_StatusCode_DRACO_ERROR.apply(null,arguments)},Xc=a._emscripten_enum_draco_StatusCode_IO_ERROR=function(){return a.asm.emscripten_enum_draco_StatusCode_IO_ERROR.apply(null,arguments)},Yc=a._emscripten_enum_draco_StatusCode_INVALID_PARAMETER=function(){return a.asm.emscripten_enum_draco_StatusCode_INVALID_PARAMETER.apply(null,arguments)},Zc=a._emscripten_enum_draco_StatusCode_UNSUPPORTED_VERSION=
62
+ function(){return a.asm.emscripten_enum_draco_StatusCode_UNSUPPORTED_VERSION.apply(null,arguments)},$c=a._emscripten_enum_draco_StatusCode_UNKNOWN_VERSION=function(){return a.asm.emscripten_enum_draco_StatusCode_UNKNOWN_VERSION.apply(null,arguments)},ad=a._emscripten_enum_draco_DataType_DT_INVALID=function(){return a.asm.emscripten_enum_draco_DataType_DT_INVALID.apply(null,arguments)},bd=a._emscripten_enum_draco_DataType_DT_INT8=function(){return a.asm.emscripten_enum_draco_DataType_DT_INT8.apply(null,
63
+ arguments)},cd=a._emscripten_enum_draco_DataType_DT_UINT8=function(){return a.asm.emscripten_enum_draco_DataType_DT_UINT8.apply(null,arguments)},dd=a._emscripten_enum_draco_DataType_DT_INT16=function(){return a.asm.emscripten_enum_draco_DataType_DT_INT16.apply(null,arguments)},ed=a._emscripten_enum_draco_DataType_DT_UINT16=function(){return a.asm.emscripten_enum_draco_DataType_DT_UINT16.apply(null,arguments)},fd=a._emscripten_enum_draco_DataType_DT_INT32=function(){return a.asm.emscripten_enum_draco_DataType_DT_INT32.apply(null,
64
+ arguments)},gd=a._emscripten_enum_draco_DataType_DT_UINT32=function(){return a.asm.emscripten_enum_draco_DataType_DT_UINT32.apply(null,arguments)},hd=a._emscripten_enum_draco_DataType_DT_INT64=function(){return a.asm.emscripten_enum_draco_DataType_DT_INT64.apply(null,arguments)},id=a._emscripten_enum_draco_DataType_DT_UINT64=function(){return a.asm.emscripten_enum_draco_DataType_DT_UINT64.apply(null,arguments)},jd=a._emscripten_enum_draco_DataType_DT_FLOAT32=function(){return a.asm.emscripten_enum_draco_DataType_DT_FLOAT32.apply(null,
65
+ arguments)},kd=a._emscripten_enum_draco_DataType_DT_FLOAT64=function(){return a.asm.emscripten_enum_draco_DataType_DT_FLOAT64.apply(null,arguments)},ld=a._emscripten_enum_draco_DataType_DT_BOOL=function(){return a.asm.emscripten_enum_draco_DataType_DT_BOOL.apply(null,arguments)},md=a._emscripten_enum_draco_DataType_DT_TYPES_COUNT=function(){return a.asm.emscripten_enum_draco_DataType_DT_TYPES_COUNT.apply(null,arguments)},nd=a._emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE=function(){return a.asm.emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE.apply(null,
66
+ arguments)},od=a._emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD=function(){return a.asm.emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD.apply(null,arguments)},pd=a._emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH=function(){return a.asm.emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH.apply(null,arguments)},qd=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_INVALID_TRANSFORM=function(){return a.asm.emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_INVALID_TRANSFORM.apply(null,
67
+ arguments)},rd=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_NO_TRANSFORM=function(){return a.asm.emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_NO_TRANSFORM.apply(null,arguments)},sd=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_QUANTIZATION_TRANSFORM=function(){return a.asm.emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_QUANTIZATION_TRANSFORM.apply(null,arguments)},td=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_OCTAHEDRON_TRANSFORM=function(){return a.asm.emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_OCTAHEDRON_TRANSFORM.apply(null,
68
+ arguments)},ud=a._emscripten_enum_draco_GeometryAttribute_Type_INVALID=function(){return a.asm.emscripten_enum_draco_GeometryAttribute_Type_INVALID.apply(null,arguments)},vd=a._emscripten_enum_draco_GeometryAttribute_Type_POSITION=function(){return a.asm.emscripten_enum_draco_GeometryAttribute_Type_POSITION.apply(null,arguments)},wd=a._emscripten_enum_draco_GeometryAttribute_Type_NORMAL=function(){return a.asm.emscripten_enum_draco_GeometryAttribute_Type_NORMAL.apply(null,arguments)},xd=a._emscripten_enum_draco_GeometryAttribute_Type_COLOR=
69
+ function(){return a.asm.emscripten_enum_draco_GeometryAttribute_Type_COLOR.apply(null,arguments)},yd=a._emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD=function(){return a.asm.emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD.apply(null,arguments)},zd=a._emscripten_enum_draco_GeometryAttribute_Type_GENERIC=function(){return a.asm.emscripten_enum_draco_GeometryAttribute_Type_GENERIC.apply(null,arguments)};a._setThrew=function(){return a.asm.setThrew.apply(null,arguments)};var ta=a.__ZSt18uncaught_exceptionv=
70
+ function(){return a.asm._ZSt18uncaught_exceptionv.apply(null,arguments)};a._free=function(){return a.asm.free.apply(null,arguments)};var ib=a._malloc=function(){return a.asm.malloc.apply(null,arguments)};a.stackSave=function(){return a.asm.stackSave.apply(null,arguments)};a.stackAlloc=function(){return a.asm.stackAlloc.apply(null,arguments)};a.stackRestore=function(){return a.asm.stackRestore.apply(null,arguments)};a.__growWasmMemory=function(){return a.asm.__growWasmMemory.apply(null,arguments)};
71
+ a.dynCall_ii=function(){return a.asm.dynCall_ii.apply(null,arguments)};a.dynCall_vi=function(){return a.asm.dynCall_vi.apply(null,arguments)};a.dynCall_iii=function(){return a.asm.dynCall_iii.apply(null,arguments)};a.dynCall_vii=function(){return a.asm.dynCall_vii.apply(null,arguments)};a.dynCall_iiii=function(){return a.asm.dynCall_iiii.apply(null,arguments)};a.dynCall_v=function(){return a.asm.dynCall_v.apply(null,arguments)};a.dynCall_viii=function(){return a.asm.dynCall_viii.apply(null,arguments)};
72
+ a.dynCall_viiii=function(){return a.asm.dynCall_viiii.apply(null,arguments)};a.dynCall_iiiiiii=function(){return a.asm.dynCall_iiiiiii.apply(null,arguments)};a.dynCall_iidiiii=function(){return a.asm.dynCall_iidiiii.apply(null,arguments)};a.dynCall_jiji=function(){return a.asm.dynCall_jiji.apply(null,arguments)};a.dynCall_viiiiii=function(){return a.asm.dynCall_viiiiii.apply(null,arguments)};a.dynCall_viiiii=function(){return a.asm.dynCall_viiiii.apply(null,arguments)};a.asm=La;var fa;a.then=function(e){if(fa)e(a);
73
+ else{var c=a.onRuntimeInitialized;a.onRuntimeInitialized=function(){c&&c();e(a)}}return a};ja=function c(){fa||ma();fa||(ja=c)};a.run=ma;if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();ma();p.prototype=Object.create(p.prototype);p.prototype.constructor=p;p.prototype.__class__=p;p.__cache__={};a.WrapperObject=p;a.getCache=u;a.wrapPointer=N;a.castObject=function(a,b){return N(a.ptr,b)};a.NULL=N(0);a.destroy=function(a){if(!a.__destroy__)throw"Error: Cannot destroy object. (Did you create it yourself?)";
74
+ a.__destroy__();delete u(a.__class__)[a.ptr]};a.compare=function(a,b){return a.ptr===b.ptr};a.getPointer=function(a){return a.ptr};a.getClass=function(a){return a.__class__};var n={buffer:0,size:0,pos:0,temps:[],needed:0,prepare:function(){if(n.needed){for(var c=0;c<n.temps.length;c++)a._free(n.temps[c]);n.temps.length=0;a._free(n.buffer);n.buffer=0;n.size+=n.needed;n.needed=0}n.buffer||(n.size+=128,n.buffer=a._malloc(n.size),t(n.buffer));n.pos=0},alloc:function(c,b){t(n.buffer);c=c.length*b.BYTES_PER_ELEMENT;
75
+ c=c+7&-8;n.pos+c>=n.size?(t(0<c),n.needed+=c,b=a._malloc(c),n.temps.push(b)):(b=n.buffer+n.pos,n.pos+=c);return b},copy:function(a,b,d){switch(b.BYTES_PER_ELEMENT){case 2:d>>=1;break;case 4:d>>=2;break;case 8:d>>=3}for(var c=0;c<a.length;c++)b[d+c]=a[c]}};x.prototype=Object.create(p.prototype);x.prototype.constructor=x;x.prototype.__class__=x;x.__cache__={};a.Status=x;x.prototype.code=x.prototype.code=function(){return jb(this.ptr)};x.prototype.ok=x.prototype.ok=function(){return!!kb(this.ptr)};x.prototype.error_msg=
76
+ x.prototype.error_msg=function(){return X(lb(this.ptr))};x.prototype.__destroy__=x.prototype.__destroy__=function(){mb(this.ptr)};A.prototype=Object.create(p.prototype);A.prototype.constructor=A;A.prototype.__class__=A;A.__cache__={};a.DracoUInt16Array=A;A.prototype.GetValue=A.prototype.GetValue=function(a){var c=this.ptr;a&&"object"===typeof a&&(a=a.ptr);return nb(c,a)};A.prototype.size=A.prototype.size=function(){return ob(this.ptr)};A.prototype.__destroy__=A.prototype.__destroy__=function(){pb(this.ptr)};
77
+ B.prototype=Object.create(p.prototype);B.prototype.constructor=B;B.prototype.__class__=B;B.__cache__={};a.PointCloud=B;B.prototype.num_attributes=B.prototype.num_attributes=function(){return qb(this.ptr)};B.prototype.num_points=B.prototype.num_points=function(){return rb(this.ptr)};B.prototype.__destroy__=B.prototype.__destroy__=function(){sb(this.ptr)};C.prototype=Object.create(p.prototype);C.prototype.constructor=C;C.prototype.__class__=C;C.__cache__={};a.DracoUInt8Array=C;C.prototype.GetValue=
78
+ C.prototype.GetValue=function(a){var c=this.ptr;a&&"object"===typeof a&&(a=a.ptr);return tb(c,a)};C.prototype.size=C.prototype.size=function(){return ub(this.ptr)};C.prototype.__destroy__=C.prototype.__destroy__=function(){vb(this.ptr)};D.prototype=Object.create(p.prototype);D.prototype.constructor=D;D.prototype.__class__=D;D.__cache__={};a.DracoUInt32Array=D;D.prototype.GetValue=D.prototype.GetValue=function(a){var c=this.ptr;a&&"object"===typeof a&&(a=a.ptr);return wb(c,a)};D.prototype.size=D.prototype.size=
79
+ function(){return xb(this.ptr)};D.prototype.__destroy__=D.prototype.__destroy__=function(){yb(this.ptr)};E.prototype=Object.create(p.prototype);E.prototype.constructor=E;E.prototype.__class__=E;E.__cache__={};a.AttributeOctahedronTransform=E;E.prototype.InitFromAttribute=E.prototype.InitFromAttribute=function(a){var c=this.ptr;a&&"object"===typeof a&&(a=a.ptr);return!!zb(c,a)};E.prototype.quantization_bits=E.prototype.quantization_bits=function(){return Ab(this.ptr)};E.prototype.__destroy__=E.prototype.__destroy__=
80
+ function(){Bb(this.ptr)};q.prototype=Object.create(p.prototype);q.prototype.constructor=q;q.prototype.__class__=q;q.__cache__={};a.PointAttribute=q;q.prototype.size=q.prototype.size=function(){return Cb(this.ptr)};q.prototype.GetAttributeTransformData=q.prototype.GetAttributeTransformData=function(){return N(Db(this.ptr),J)};q.prototype.attribute_type=q.prototype.attribute_type=function(){return Eb(this.ptr)};q.prototype.data_type=q.prototype.data_type=function(){return Fb(this.ptr)};q.prototype.num_components=
81
+ q.prototype.num_components=function(){return Gb(this.ptr)};q.prototype.normalized=q.prototype.normalized=function(){return!!Hb(this.ptr)};q.prototype.byte_stride=q.prototype.byte_stride=function(){return Ib(this.ptr)};q.prototype.byte_offset=q.prototype.byte_offset=function(){return Jb(this.ptr)};q.prototype.unique_id=q.prototype.unique_id=function(){return Kb(this.ptr)};q.prototype.__destroy__=q.prototype.__destroy__=function(){Lb(this.ptr)};J.prototype=Object.create(p.prototype);J.prototype.constructor=
82
+ J;J.prototype.__class__=J;J.__cache__={};a.AttributeTransformData=J;J.prototype.transform_type=J.prototype.transform_type=function(){return Mb(this.ptr)};J.prototype.__destroy__=J.prototype.__destroy__=function(){Nb(this.ptr)};w.prototype=Object.create(p.prototype);w.prototype.constructor=w;w.prototype.__class__=w;w.__cache__={};a.AttributeQuantizationTransform=w;w.prototype.InitFromAttribute=w.prototype.InitFromAttribute=function(a){var c=this.ptr;a&&"object"===typeof a&&(a=a.ptr);return!!Ob(c,a)};
83
+ w.prototype.quantization_bits=w.prototype.quantization_bits=function(){return Pb(this.ptr)};w.prototype.min_value=w.prototype.min_value=function(a){var c=this.ptr;a&&"object"===typeof a&&(a=a.ptr);return Qb(c,a)};w.prototype.range=w.prototype.range=function(){return Rb(this.ptr)};w.prototype.__destroy__=w.prototype.__destroy__=function(){Sb(this.ptr)};F.prototype=Object.create(p.prototype);F.prototype.constructor=F;F.prototype.__class__=F;F.__cache__={};a.DracoInt8Array=F;F.prototype.GetValue=F.prototype.GetValue=
84
+ function(a){var c=this.ptr;a&&"object"===typeof a&&(a=a.ptr);return Tb(c,a)};F.prototype.size=F.prototype.size=function(){return Ub(this.ptr)};F.prototype.__destroy__=F.prototype.__destroy__=function(){Vb(this.ptr)};r.prototype=Object.create(p.prototype);r.prototype.constructor=r;r.prototype.__class__=r;r.__cache__={};a.MetadataQuerier=r;r.prototype.HasEntry=r.prototype.HasEntry=function(a,b){var c=this.ptr;n.prepare();a&&"object"===typeof a&&(a=a.ptr);b=b&&"object"===typeof b?b.ptr:V(b);return!!Wb(c,
85
+ a,b)};r.prototype.GetIntEntry=r.prototype.GetIntEntry=function(a,b){var c=this.ptr;n.prepare();a&&"object"===typeof a&&(a=a.ptr);b=b&&"object"===typeof b?b.ptr:V(b);return Xb(c,a,b)};r.prototype.GetIntEntryArray=r.prototype.GetIntEntryArray=function(a,b,d){var c=this.ptr;n.prepare();a&&"object"===typeof a&&(a=a.ptr);b=b&&"object"===typeof b?b.ptr:V(b);d&&"object"===typeof d&&(d=d.ptr);Yb(c,a,b,d)};r.prototype.GetDoubleEntry=r.prototype.GetDoubleEntry=function(a,b){var c=this.ptr;n.prepare();a&&"object"===
86
+ typeof a&&(a=a.ptr);b=b&&"object"===typeof b?b.ptr:V(b);return Zb(c,a,b)};r.prototype.GetStringEntry=r.prototype.GetStringEntry=function(a,b){var c=this.ptr;n.prepare();a&&"object"===typeof a&&(a=a.ptr);b=b&&"object"===typeof b?b.ptr:V(b);return X($b(c,a,b))};r.prototype.NumEntries=r.prototype.NumEntries=function(a){var c=this.ptr;a&&"object"===typeof a&&(a=a.ptr);return ac(c,a)};r.prototype.GetEntryName=r.prototype.GetEntryName=function(a,b){var c=this.ptr;a&&"object"===typeof a&&(a=a.ptr);b&&"object"===
87
+ typeof b&&(b=b.ptr);return X(bc(c,a,b))};r.prototype.__destroy__=r.prototype.__destroy__=function(){cc(this.ptr)};G.prototype=Object.create(p.prototype);G.prototype.constructor=G;G.prototype.__class__=G;G.__cache__={};a.DracoInt16Array=G;G.prototype.GetValue=G.prototype.GetValue=function(a){var c=this.ptr;a&&"object"===typeof a&&(a=a.ptr);return dc(c,a)};G.prototype.size=G.prototype.size=function(){return ec(this.ptr)};G.prototype.__destroy__=G.prototype.__destroy__=function(){fc(this.ptr)};H.prototype=
88
+ Object.create(p.prototype);H.prototype.constructor=H;H.prototype.__class__=H;H.__cache__={};a.DracoFloat32Array=H;H.prototype.GetValue=H.prototype.GetValue=function(a){var c=this.ptr;a&&"object"===typeof a&&(a=a.ptr);return gc(c,a)};H.prototype.size=H.prototype.size=function(){return hc(this.ptr)};H.prototype.__destroy__=H.prototype.__destroy__=function(){ic(this.ptr)};O.prototype=Object.create(p.prototype);O.prototype.constructor=O;O.prototype.__class__=O;O.__cache__={};a.GeometryAttribute=O;O.prototype.__destroy__=
89
+ O.prototype.__destroy__=function(){jc(this.ptr)};K.prototype=Object.create(p.prototype);K.prototype.constructor=K;K.prototype.__class__=K;K.__cache__={};a.DecoderBuffer=K;K.prototype.Init=K.prototype.Init=function(a,b){var c=this.ptr;n.prepare();if("object"==typeof a&&"object"===typeof a){var e=n.alloc(a,T);n.copy(a,T,e);a=e}b&&"object"===typeof b&&(b=b.ptr);kc(c,a,b)};K.prototype.__destroy__=K.prototype.__destroy__=function(){lc(this.ptr)};g.prototype=Object.create(p.prototype);g.prototype.constructor=
90
+ g;g.prototype.__class__=g;g.__cache__={};a.Decoder=g;g.prototype.GetEncodedGeometryType=g.prototype.GetEncodedGeometryType=function(a){var c=this.ptr;a&&"object"===typeof a&&(a=a.ptr);return mc(c,a)};g.prototype.DecodeBufferToPointCloud=g.prototype.DecodeBufferToPointCloud=function(a,b){var c=this.ptr;a&&"object"===typeof a&&(a=a.ptr);b&&"object"===typeof b&&(b=b.ptr);return N(nc(c,a,b),x)};g.prototype.DecodeBufferToMesh=g.prototype.DecodeBufferToMesh=function(a,b){var c=this.ptr;a&&"object"===typeof a&&
91
+ (a=a.ptr);b&&"object"===typeof b&&(b=b.ptr);return N(oc(c,a,b),x)};g.prototype.GetAttributeId=g.prototype.GetAttributeId=function(a,b){var c=this.ptr;a&&"object"===typeof a&&(a=a.ptr);b&&"object"===typeof b&&(b=b.ptr);return pc(c,a,b)};g.prototype.GetAttributeIdByName=g.prototype.GetAttributeIdByName=function(a,b){var c=this.ptr;n.prepare();a&&"object"===typeof a&&(a=a.ptr);b=b&&"object"===typeof b?b.ptr:V(b);return qc(c,a,b)};g.prototype.GetAttributeIdByMetadataEntry=g.prototype.GetAttributeIdByMetadataEntry=
92
+ function(a,b,d){var c=this.ptr;n.prepare();a&&"object"===typeof a&&(a=a.ptr);b=b&&"object"===typeof b?b.ptr:V(b);d=d&&"object"===typeof d?d.ptr:V(d);return rc(c,a,b,d)};g.prototype.GetAttribute=g.prototype.GetAttribute=function(a,b){var c=this.ptr;a&&"object"===typeof a&&(a=a.ptr);b&&"object"===typeof b&&(b=b.ptr);return N(sc(c,a,b),q)};g.prototype.GetAttributeByUniqueId=g.prototype.GetAttributeByUniqueId=function(a,b){var c=this.ptr;a&&"object"===typeof a&&(a=a.ptr);b&&"object"===typeof b&&(b=b.ptr);
93
+ return N(tc(c,a,b),q)};g.prototype.GetMetadata=g.prototype.GetMetadata=function(a){var c=this.ptr;a&&"object"===typeof a&&(a=a.ptr);return N(uc(c,a),L)};g.prototype.GetAttributeMetadata=g.prototype.GetAttributeMetadata=function(a,b){var c=this.ptr;a&&"object"===typeof a&&(a=a.ptr);b&&"object"===typeof b&&(b=b.ptr);return N(vc(c,a,b),L)};g.prototype.GetFaceFromMesh=g.prototype.GetFaceFromMesh=function(a,b,d){var c=this.ptr;a&&"object"===typeof a&&(a=a.ptr);b&&"object"===typeof b&&(b=b.ptr);d&&"object"===
94
+ typeof d&&(d=d.ptr);return!!wc(c,a,b,d)};g.prototype.GetTriangleStripsFromMesh=g.prototype.GetTriangleStripsFromMesh=function(a,b){var c=this.ptr;a&&"object"===typeof a&&(a=a.ptr);b&&"object"===typeof b&&(b=b.ptr);return xc(c,a,b)};g.prototype.GetTrianglesUInt16Array=g.prototype.GetTrianglesUInt16Array=function(a,b,d){var c=this.ptr;a&&"object"===typeof a&&(a=a.ptr);b&&"object"===typeof b&&(b=b.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!yc(c,a,b,d)};g.prototype.GetTrianglesUInt32Array=g.prototype.GetTrianglesUInt32Array=
95
+ function(a,b,d){var c=this.ptr;a&&"object"===typeof a&&(a=a.ptr);b&&"object"===typeof b&&(b=b.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!zc(c,a,b,d)};g.prototype.GetAttributeFloat=g.prototype.GetAttributeFloat=function(a,b,d){var c=this.ptr;a&&"object"===typeof a&&(a=a.ptr);b&&"object"===typeof b&&(b=b.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!Ac(c,a,b,d)};g.prototype.GetAttributeFloatForAllPoints=g.prototype.GetAttributeFloatForAllPoints=function(a,b,d){var c=this.ptr;a&&"object"===typeof a&&
96
+ (a=a.ptr);b&&"object"===typeof b&&(b=b.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!Bc(c,a,b,d)};g.prototype.GetAttributeIntForAllPoints=g.prototype.GetAttributeIntForAllPoints=function(a,b,d){var c=this.ptr;a&&"object"===typeof a&&(a=a.ptr);b&&"object"===typeof b&&(b=b.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!Cc(c,a,b,d)};g.prototype.GetAttributeInt8ForAllPoints=g.prototype.GetAttributeInt8ForAllPoints=function(a,b,d){var c=this.ptr;a&&"object"===typeof a&&(a=a.ptr);b&&"object"===typeof b&&
97
+ (b=b.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!Dc(c,a,b,d)};g.prototype.GetAttributeUInt8ForAllPoints=g.prototype.GetAttributeUInt8ForAllPoints=function(a,b,d){var c=this.ptr;a&&"object"===typeof a&&(a=a.ptr);b&&"object"===typeof b&&(b=b.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!Ec(c,a,b,d)};g.prototype.GetAttributeInt16ForAllPoints=g.prototype.GetAttributeInt16ForAllPoints=function(a,b,d){var c=this.ptr;a&&"object"===typeof a&&(a=a.ptr);b&&"object"===typeof b&&(b=b.ptr);d&&"object"===typeof d&&
98
+ (d=d.ptr);return!!Fc(c,a,b,d)};g.prototype.GetAttributeUInt16ForAllPoints=g.prototype.GetAttributeUInt16ForAllPoints=function(a,b,d){var c=this.ptr;a&&"object"===typeof a&&(a=a.ptr);b&&"object"===typeof b&&(b=b.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!Gc(c,a,b,d)};g.prototype.GetAttributeInt32ForAllPoints=g.prototype.GetAttributeInt32ForAllPoints=function(a,b,d){var c=this.ptr;a&&"object"===typeof a&&(a=a.ptr);b&&"object"===typeof b&&(b=b.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!Hc(c,
99
+ a,b,d)};g.prototype.GetAttributeUInt32ForAllPoints=g.prototype.GetAttributeUInt32ForAllPoints=function(a,b,d){var c=this.ptr;a&&"object"===typeof a&&(a=a.ptr);b&&"object"===typeof b&&(b=b.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!Ic(c,a,b,d)};g.prototype.GetAttributeDataArrayForAllPoints=g.prototype.GetAttributeDataArrayForAllPoints=function(a,b,d,e,f){var c=this.ptr;a&&"object"===typeof a&&(a=a.ptr);b&&"object"===typeof b&&(b=b.ptr);d&&"object"===typeof d&&(d=d.ptr);e&&"object"===typeof e&&
100
+ (e=e.ptr);f&&"object"===typeof f&&(f=f.ptr);return!!Jc(c,a,b,d,e,f)};g.prototype.SkipAttributeTransform=g.prototype.SkipAttributeTransform=function(a){var b=this.ptr;a&&"object"===typeof a&&(a=a.ptr);Kc(b,a)};g.prototype.__destroy__=g.prototype.__destroy__=function(){Lc(this.ptr)};y.prototype=Object.create(p.prototype);y.prototype.constructor=y;y.prototype.__class__=y;y.__cache__={};a.Mesh=y;y.prototype.num_faces=y.prototype.num_faces=function(){return Mc(this.ptr)};y.prototype.num_attributes=y.prototype.num_attributes=
101
+ function(){return Nc(this.ptr)};y.prototype.num_points=y.prototype.num_points=function(){return Oc(this.ptr)};y.prototype.__destroy__=y.prototype.__destroy__=function(){Pc(this.ptr)};Q.prototype=Object.create(p.prototype);Q.prototype.constructor=Q;Q.prototype.__class__=Q;Q.__cache__={};a.VoidPtr=Q;Q.prototype.__destroy__=Q.prototype.__destroy__=function(){Qc(this.ptr)};I.prototype=Object.create(p.prototype);I.prototype.constructor=I;I.prototype.__class__=I;I.__cache__={};a.DracoInt32Array=I;I.prototype.GetValue=
102
+ I.prototype.GetValue=function(a){var b=this.ptr;a&&"object"===typeof a&&(a=a.ptr);return Rc(b,a)};I.prototype.size=I.prototype.size=function(){return Sc(this.ptr)};I.prototype.__destroy__=I.prototype.__destroy__=function(){Tc(this.ptr)};L.prototype=Object.create(p.prototype);L.prototype.constructor=L;L.prototype.__class__=L;L.__cache__={};a.Metadata=L;L.prototype.__destroy__=L.prototype.__destroy__=function(){Uc(this.ptr)};(function(){function c(){a.OK=Vc();a.DRACO_ERROR=Wc();a.IO_ERROR=Xc();a.INVALID_PARAMETER=
103
+ Yc();a.UNSUPPORTED_VERSION=Zc();a.UNKNOWN_VERSION=$c();a.DT_INVALID=ad();a.DT_INT8=bd();a.DT_UINT8=cd();a.DT_INT16=dd();a.DT_UINT16=ed();a.DT_INT32=fd();a.DT_UINT32=gd();a.DT_INT64=hd();a.DT_UINT64=id();a.DT_FLOAT32=jd();a.DT_FLOAT64=kd();a.DT_BOOL=ld();a.DT_TYPES_COUNT=md();a.INVALID_GEOMETRY_TYPE=nd();a.POINT_CLOUD=od();a.TRIANGULAR_MESH=pd();a.ATTRIBUTE_INVALID_TRANSFORM=qd();a.ATTRIBUTE_NO_TRANSFORM=rd();a.ATTRIBUTE_QUANTIZATION_TRANSFORM=sd();a.ATTRIBUTE_OCTAHEDRON_TRANSFORM=td();a.INVALID=ud();
104
+ a.POSITION=vd();a.NORMAL=wd();a.COLOR=xd();a.TEX_COORD=yd();a.GENERIC=zd()}Ba?c():Da.unshift(c)})();if("function"===typeof a.onModuleParsed)a.onModuleParsed();return m}}();"object"===typeof exports&&"object"===typeof module?module.exports=DracoDecoderModule:"function"===typeof define&&define.amd?define([],function(){return DracoDecoderModule}):"object"===typeof exports&&(exports.DracoDecoderModule=DracoDecoderModule);
sd-3dmodel-loader/js/es-module-shims.js ADDED
@@ -0,0 +1,789 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* ES Module Shims 1.3.6 */
2
+ (function () {
3
+
4
+ const edge = navigator.userAgent.match(/Edge\/\d\d\.\d+$/);
5
+
6
+ let baseUrl;
7
+
8
+ function createBlob (source, type = 'text/javascript') {
9
+ return URL.createObjectURL(new Blob([source], { type }));
10
+ }
11
+
12
+ const noop = () => {};
13
+
14
+ const baseEl = document.querySelector('base[href]');
15
+ if (baseEl)
16
+ baseUrl = baseEl.href;
17
+
18
+ if (!baseUrl && typeof location !== 'undefined') {
19
+ baseUrl = location.href.split('#')[0].split('?')[0];
20
+ const lastSepIndex = baseUrl.lastIndexOf('/');
21
+ if (lastSepIndex !== -1)
22
+ baseUrl = baseUrl.slice(0, lastSepIndex + 1);
23
+ }
24
+
25
+ function isURL (url) {
26
+ try {
27
+ new URL(url);
28
+ return true;
29
+ }
30
+ catch {
31
+ return false;
32
+ }
33
+ }
34
+
35
+ const backslashRegEx = /\\/g;
36
+ function resolveIfNotPlainOrUrl (relUrl, parentUrl) {
37
+ // strip off any trailing query params or hashes
38
+ parentUrl = parentUrl && parentUrl.split('#')[0].split('?')[0];
39
+ if (relUrl.indexOf('\\') !== -1)
40
+ relUrl = relUrl.replace(backslashRegEx, '/');
41
+ // protocol-relative
42
+ if (relUrl[0] === '/' && relUrl[1] === '/') {
43
+ return parentUrl.slice(0, parentUrl.indexOf(':') + 1) + relUrl;
44
+ }
45
+ // relative-url
46
+ else if (relUrl[0] === '.' && (relUrl[1] === '/' || relUrl[1] === '.' && (relUrl[2] === '/' || relUrl.length === 2 && (relUrl += '/')) ||
47
+ relUrl.length === 1 && (relUrl += '/')) ||
48
+ relUrl[0] === '/') {
49
+ const parentProtocol = parentUrl.slice(0, parentUrl.indexOf(':') + 1);
50
+ // Disabled, but these cases will give inconsistent results for deep backtracking
51
+ //if (parentUrl[parentProtocol.length] !== '/')
52
+ // throw new Error('Cannot resolve');
53
+ // read pathname from parent URL
54
+ // pathname taken to be part after leading "/"
55
+ let pathname;
56
+ if (parentUrl[parentProtocol.length + 1] === '/') {
57
+ // resolving to a :// so we need to read out the auth and host
58
+ if (parentProtocol !== 'file:') {
59
+ pathname = parentUrl.slice(parentProtocol.length + 2);
60
+ pathname = pathname.slice(pathname.indexOf('/') + 1);
61
+ }
62
+ else {
63
+ pathname = parentUrl.slice(8);
64
+ }
65
+ }
66
+ else {
67
+ // resolving to :/ so pathname is the /... part
68
+ pathname = parentUrl.slice(parentProtocol.length + (parentUrl[parentProtocol.length] === '/'));
69
+ }
70
+
71
+ if (relUrl[0] === '/')
72
+ return parentUrl.slice(0, parentUrl.length - pathname.length - 1) + relUrl;
73
+
74
+ // join together and split for removal of .. and . segments
75
+ // looping the string instead of anything fancy for perf reasons
76
+ // '../../../../../z' resolved to 'x/y' is just 'z'
77
+ const segmented = pathname.slice(0, pathname.lastIndexOf('/') + 1) + relUrl;
78
+
79
+ const output = [];
80
+ let segmentIndex = -1;
81
+ for (let i = 0; i < segmented.length; i++) {
82
+ // busy reading a segment - only terminate on '/'
83
+ if (segmentIndex !== -1) {
84
+ if (segmented[i] === '/') {
85
+ output.push(segmented.slice(segmentIndex, i + 1));
86
+ segmentIndex = -1;
87
+ }
88
+ }
89
+
90
+ // new segment - check if it is relative
91
+ else if (segmented[i] === '.') {
92
+ // ../ segment
93
+ if (segmented[i + 1] === '.' && (segmented[i + 2] === '/' || i + 2 === segmented.length)) {
94
+ output.pop();
95
+ i += 2;
96
+ }
97
+ // ./ segment
98
+ else if (segmented[i + 1] === '/' || i + 1 === segmented.length) {
99
+ i += 1;
100
+ }
101
+ else {
102
+ // the start of a new segment as below
103
+ segmentIndex = i;
104
+ }
105
+ }
106
+ // it is the start of a new segment
107
+ else {
108
+ segmentIndex = i;
109
+ }
110
+ }
111
+ // finish reading out the last segment
112
+ if (segmentIndex !== -1)
113
+ output.push(segmented.slice(segmentIndex));
114
+ return parentUrl.slice(0, parentUrl.length - pathname.length) + output.join('');
115
+ }
116
+ }
117
+
118
+ /*
119
+ * Import maps implementation
120
+ *
121
+ * To make lookups fast we pre-resolve the entire import map
122
+ * and then match based on backtracked hash lookups
123
+ *
124
+ */
125
+ function resolveUrl (relUrl, parentUrl) {
126
+ return resolveIfNotPlainOrUrl(relUrl, parentUrl) || (relUrl.indexOf(':') !== -1 ? relUrl : resolveIfNotPlainOrUrl('./' + relUrl, parentUrl));
127
+ }
128
+
129
+ function resolveAndComposePackages (packages, outPackages, baseUrl, parentMap) {
130
+ for (let p in packages) {
131
+ const resolvedLhs = resolveIfNotPlainOrUrl(p, baseUrl) || p;
132
+ if (outPackages[resolvedLhs]) {
133
+ throw new Error(`Dynamic import map rejected: Overrides entry "${resolvedLhs}" from ${outPackages[resolvedLhs]} to ${packages[resolvedLhs]}.`);
134
+ }
135
+ let target = packages[p];
136
+ if (typeof target !== 'string')
137
+ continue;
138
+ const mapped = resolveImportMap(parentMap, resolveIfNotPlainOrUrl(target, baseUrl) || target, baseUrl);
139
+ if (mapped) {
140
+ outPackages[resolvedLhs] = mapped;
141
+ continue;
142
+ }
143
+ targetWarning(p, packages[p], 'bare specifier did not resolve');
144
+ }
145
+ }
146
+
147
+ function resolveAndComposeImportMap (json, baseUrl, parentMap) {
148
+ const outMap = { imports: Object.assign({}, parentMap.imports), scopes: Object.assign({}, parentMap.scopes) };
149
+
150
+ if (json.imports)
151
+ resolveAndComposePackages(json.imports, outMap.imports, baseUrl, parentMap);
152
+
153
+ if (json.scopes)
154
+ for (let s in json.scopes) {
155
+ const resolvedScope = resolveUrl(s, baseUrl);
156
+ resolveAndComposePackages(json.scopes[s], outMap.scopes[resolvedScope] || (outMap.scopes[resolvedScope] = {}), baseUrl, parentMap);
157
+ }
158
+
159
+ return outMap;
160
+ }
161
+
162
+ function getMatch (path, matchObj) {
163
+ if (matchObj[path])
164
+ return path;
165
+ let sepIndex = path.length;
166
+ do {
167
+ const segment = path.slice(0, sepIndex + 1);
168
+ if (segment in matchObj)
169
+ return segment;
170
+ } while ((sepIndex = path.lastIndexOf('/', sepIndex - 1)) !== -1)
171
+ }
172
+
173
+ function applyPackages (id, packages) {
174
+ const pkgName = getMatch(id, packages);
175
+ if (pkgName) {
176
+ const pkg = packages[pkgName];
177
+ if (pkg === null) return;
178
+ if (id.length > pkgName.length && pkg[pkg.length - 1] !== '/')
179
+ targetWarning(pkgName, pkg, "should have a trailing '/'");
180
+ else
181
+ return pkg + id.slice(pkgName.length);
182
+ }
183
+ }
184
+
185
+ function targetWarning (match, target, msg) {
186
+ console.warn("Package target " + msg + ", resolving target '" + target + "' for " + match);
187
+ }
188
+
189
+ function resolveImportMap (importMap, resolvedOrPlain, parentUrl) {
190
+ let scopeUrl = parentUrl && getMatch(parentUrl, importMap.scopes);
191
+ while (scopeUrl) {
192
+ const packageResolution = applyPackages(resolvedOrPlain, importMap.scopes[scopeUrl]);
193
+ if (packageResolution)
194
+ return packageResolution;
195
+ scopeUrl = getMatch(scopeUrl.slice(0, scopeUrl.lastIndexOf('/')), importMap.scopes);
196
+ }
197
+ return applyPackages(resolvedOrPlain, importMap.imports) || resolvedOrPlain.indexOf(':') !== -1 && resolvedOrPlain;
198
+ }
199
+
200
+ const optionsScript = document.querySelector('script[type=esms-options]');
201
+
202
+ const esmsInitOptions = optionsScript ? JSON.parse(optionsScript.innerHTML) : self.esmsInitOptions ? self.esmsInitOptions : {};
203
+
204
+ let shimMode = !!esmsInitOptions.shimMode;
205
+ const resolveHook = globalHook(shimMode && esmsInitOptions.resolve);
206
+
207
+ const skip = esmsInitOptions.skip ? new RegExp(esmsInitOptions.skip) : null;
208
+
209
+ let nonce = esmsInitOptions.nonce;
210
+
211
+ if (!nonce) {
212
+ const nonceElement = document.querySelector('script[nonce]');
213
+ if (nonceElement)
214
+ nonce = nonceElement.nonce || nonceElement.getAttribute('nonce');
215
+ }
216
+
217
+ const onerror = globalHook(esmsInitOptions.onerror || noop);
218
+ const onpolyfill = globalHook(esmsInitOptions.onpolyfill || noop);
219
+
220
+ const { revokeBlobURLs, noLoadEventRetriggers } = esmsInitOptions;
221
+
222
+ const fetchHook = esmsInitOptions.fetch ? globalHook(esmsInitOptions.fetch) : fetch;
223
+
224
+ function globalHook (name) {
225
+ return typeof name === 'string' ? self[name] : name;
226
+ }
227
+
228
+ const enable = Array.isArray(esmsInitOptions.polyfillEnable) ? esmsInitOptions.polyfillEnable : [];
229
+ const cssModulesEnabled = enable.includes('css-modules');
230
+ const jsonModulesEnabled = enable.includes('json-modules');
231
+
232
+ function setShimMode () {
233
+ shimMode = true;
234
+ }
235
+
236
+ let err;
237
+ window.addEventListener('error', _err => err = _err);
238
+ function dynamicImportScript (url, { errUrl = url } = {}) {
239
+ err = undefined;
240
+ const src = createBlob(`import*as m from'${url}';self._esmsi=m`);
241
+ const s = Object.assign(document.createElement('script'), { type: 'module', src });
242
+ s.setAttribute('nonce', nonce);
243
+ s.setAttribute('noshim', '');
244
+ const p = new Promise((resolve, reject) => {
245
+ // Safari is unique in supporting module script error events
246
+ s.addEventListener('error', cb);
247
+ s.addEventListener('load', cb);
248
+
249
+ function cb (_err) {
250
+ document.head.removeChild(s);
251
+ if (self._esmsi) {
252
+ resolve(self._esmsi, baseUrl);
253
+ self._esmsi = undefined;
254
+ }
255
+ else {
256
+ reject(!(_err instanceof Event) && _err || err && err.error || new Error(`Error loading or executing the graph of ${errUrl} (check the console for ${src}).`));
257
+ err = undefined;
258
+ }
259
+ }
260
+ });
261
+ document.head.appendChild(s);
262
+ return p;
263
+ }
264
+
265
+ let dynamicImport = dynamicImportScript;
266
+
267
+ const supportsDynamicImportCheck = dynamicImportScript(createBlob('export default u=>import(u)')).then(_dynamicImport => {
268
+ if (_dynamicImport)
269
+ dynamicImport = _dynamicImport.default;
270
+ return !!_dynamicImport;
271
+ }, noop);
272
+
273
+ // support browsers without dynamic import support (eg Firefox 6x)
274
+ let supportsJsonAssertions = false;
275
+ let supportsCssAssertions = false;
276
+
277
+ let supportsImportMeta = false;
278
+ let supportsImportMaps = false;
279
+
280
+ let supportsDynamicImport = false;
281
+
282
+ const featureDetectionPromise = Promise.resolve(supportsDynamicImportCheck).then(_supportsDynamicImport => {
283
+ if (!_supportsDynamicImport)
284
+ return;
285
+ supportsDynamicImport = true;
286
+
287
+ return Promise.all([
288
+ dynamicImport(createBlob('import.meta')).then(() => supportsImportMeta = true, noop),
289
+ cssModulesEnabled && dynamicImport(createBlob('import"data:text/css,{}"assert{type:"css"}')).then(() => supportsCssAssertions = true, noop),
290
+ jsonModulesEnabled && dynamicImport(createBlob('import"data:text/json,{}"assert{type:"json"}')).then(() => supportsJsonAssertions = true, noop),
291
+ new Promise(resolve => {
292
+ self._$s = v => {
293
+ document.head.removeChild(iframe);
294
+ if (v) supportsImportMaps = true;
295
+ delete self._$s;
296
+ resolve();
297
+ };
298
+ const iframe = document.createElement('iframe');
299
+ iframe.style.display = 'none';
300
+ document.head.appendChild(iframe);
301
+ iframe.src = createBlob(`<script type=importmap nonce="${nonce}">{"imports":{"x":"data:text/javascript,"}}<${''}/script><script nonce="${nonce}">import('x').then(()=>1,()=>0).then(v=>parent._$s(v))<${''}/script>`, 'text/html');
302
+ })
303
+ ]);
304
+ });
305
+
306
+ let e,r,a,i=4194304;const s=1===new Uint8Array(new Uint16Array([1]).buffer)[0];let t,f,c$1;function parse(k,l="@"){if(t=k,f=l,t.length>i||!e){for(;t.length>i;)i*=2;r=new ArrayBuffer(4*i),e=function(e,r,a){"use asm";var i=new e.Int8Array(a),s=new e.Int16Array(a),t=new e.Int32Array(a),f=new e.Uint8Array(a),c=new e.Uint16Array(a),n=816;function b(e){e=e|0;var r=0,a=0,f=0,b=0,l=0;l=n;n=n+14336|0;b=l;i[589]=1;s[291]=0;s[292]=0;s[293]=-1;t[15]=t[2];i[590]=0;t[14]=0;i[588]=0;t[16]=l+10240;t[17]=l+2048;i[591]=0;e=(t[3]|0)+-2|0;t[18]=e;r=e+(t[12]<<1)|0;t[19]=r;e:while(1){a=e+2|0;t[18]=a;if(e>>>0>=r>>>0){f=18;break}r:do{switch(s[a>>1]|0){case 9:case 10:case 11:case 12:case 13:case 32:break;case 101:{if((((s[292]|0)==0?R(a)|0:0)?B(e+4|0,120,112,111,114,116)|0:0)?(u(),(i[589]|0)==0):0){f=9;break e}else f=17;break}case 105:{if(R(a)|0?B(e+4|0,109,112,111,114,116)|0:0){k();f=17;}else f=17;break}case 59:{f=17;break}case 47:switch(s[e+4>>1]|0){case 47:{G();break r}case 42:{p(1);break r}default:{f=16;break e}}default:{f=16;break e}}}while(0);if((f|0)==17){f=0;t[15]=t[18];}e=t[18]|0;r=t[19]|0;}if((f|0)==9){e=t[18]|0;t[15]=e;f=19;}else if((f|0)==16){i[589]=0;t[18]=e;f=19;}else if((f|0)==18)if(!(i[588]|0)){e=a;f=19;}else e=0;do{if((f|0)==19){e:while(1){r=e+2|0;t[18]=r;a=r;if(e>>>0>=(t[19]|0)>>>0){f=75;break}r:do{switch(s[r>>1]|0){case 9:case 10:case 11:case 12:case 13:case 32:break;case 101:{if(((s[292]|0)==0?R(r)|0:0)?B(e+4|0,120,112,111,114,116)|0:0){u();f=74;}else f=74;break}case 105:{if(R(r)|0?B(e+4|0,109,112,111,114,116)|0:0){k();f=74;}else f=74;break}case 99:{if((R(r)|0?z(e+4|0,108,97,115,115)|0:0)?Z(s[e+12>>1]|0)|0:0){i[591]=1;f=74;}else f=74;break}case 40:{r=t[15]|0;a=t[17]|0;f=s[292]|0;s[292]=f+1<<16>>16;t[a+((f&65535)<<2)>>2]=r;f=74;break}case 41:{e=s[292]|0;if(!(e<<16>>16)){f=36;break e}f=e+-1<<16>>16;s[292]=f;e=t[11]|0;if((e|0)!=0?(t[e+20>>2]|0)==(t[(t[17]|0)+((f&65535)<<2)>>2]|0):0){r=e+4|0;if(!(t[r>>2]|0))t[r>>2]=a;t[e+12>>2]=a;t[11]=0;f=74;}else f=74;break}case 123:{f=t[15]|0;a=t[8]|0;e=f;do{if((s[f>>1]|0)==41&(a|0)!=0?(t[a+4>>2]|0)==(f|0):0){r=t[9]|0;t[8]=r;if(!r){t[4]=0;break}else {t[r+28>>2]=0;break}}}while(0);r=s[292]|0;f=r&65535;i[b+f>>0]=i[591]|0;i[591]=0;a=t[17]|0;s[292]=r+1<<16>>16;t[a+(f<<2)>>2]=e;f=74;break}case 125:{e=s[292]|0;if(!(e<<16>>16)){f=49;break e}a=e+-1<<16>>16;s[292]=a;r=s[293]|0;if(e<<16>>16!=r<<16>>16)if(r<<16>>16!=-1&(a&65535)<(r&65535)){f=53;break e}else {f=74;break r}else {a=t[16]|0;f=(s[291]|0)+-1<<16>>16;s[291]=f;s[293]=s[a+((f&65535)<<1)>>1]|0;h();f=74;break r}}case 39:{d(39);f=74;break}case 34:{d(34);f=74;break}case 47:switch(s[e+4>>1]|0){case 47:{G();break r}case 42:{p(1);break r}default:{r=t[15]|0;a=s[r>>1]|0;a:do{if(!(x(a)|0)){switch(a<<16>>16){case 41:if(L(t[(t[17]|0)+(c[292]<<2)>>2]|0)|0){f=71;break a}else {f=68;break a}case 125:break;default:{f=68;break a}}e=c[292]|0;if(!(y(t[(t[17]|0)+(e<<2)>>2]|0)|0)?(i[b+e>>0]|0)==0:0)f=68;else f=71;}else switch(a<<16>>16){case 46:if(((s[r+-2>>1]|0)+-48&65535)<10){f=68;break a}else {f=71;break a}case 43:if((s[r+-2>>1]|0)==43){f=68;break a}else {f=71;break a}case 45:if((s[r+-2>>1]|0)==45){f=68;break a}else {f=71;break a}default:{f=71;break a}}}while(0);a:do{if((f|0)==68){f=0;if(!(o(r)|0)){switch(a<<16>>16){case 0:{f=71;break a}case 47:break;default:{e=1;break a}}if(!(i[590]|0))e=1;else f=71;}else f=71;}}while(0);if((f|0)==71){I();e=0;}i[590]=e;f=74;break r}}case 96:{h();f=74;break}default:f=74;}}while(0);if((f|0)==74){f=0;t[15]=t[18];}e=t[18]|0;}if((f|0)==36){Y();e=0;break}else if((f|0)==49){Y();e=0;break}else if((f|0)==53){Y();e=0;break}else if((f|0)==75){e=(s[293]|0)==-1&(s[292]|0)==0&(i[588]|0)==0;break}}}while(0);n=l;return e|0}function u(){var e=0,r=0,a=0,f=0,c=0,n=0;c=t[18]|0;n=c+12|0;t[18]=n;r=w(1)|0;e=t[18]|0;if(!((e|0)==(n|0)?!(S(r)|0):0))f=3;e:do{if((f|0)==3){r:do{switch(r<<16>>16){case 100:{J(e,e+14|0);break e}case 97:{t[18]=e+10;w(1)|0;e=t[18]|0;f=6;break}case 102:{f=6;break}case 99:{if(z(e+2|0,108,97,115,115)|0?(a=e+10|0,F(s[a>>1]|0)|0):0){t[18]=a;c=w(1)|0;n=t[18]|0;H(c)|0;J(n,t[18]|0);t[18]=(t[18]|0)+-2;break e}e=e+4|0;t[18]=e;f=13;break}case 108:case 118:{f=13;break}case 123:{t[18]=e+2;e=w(1)|0;a=t[18]|0;while(1){if(_(e)|0){d(e);e=(t[18]|0)+2|0;t[18]=e;}else {H(e)|0;e=t[18]|0;}w(1)|0;e=g(a,e)|0;if(e<<16>>16==44){t[18]=(t[18]|0)+2;e=w(1)|0;}r=a;a=t[18]|0;if(e<<16>>16==125){f=32;break}if((a|0)==(r|0)){f=29;break}if(a>>>0>(t[19]|0)>>>0){f=31;break}}if((f|0)==29){Y();break e}else if((f|0)==31){Y();break e}else if((f|0)==32){t[18]=a+2;f=34;break r}break}case 42:{t[18]=e+2;w(1)|0;f=t[18]|0;g(f,f)|0;f=34;break}default:{}}}while(0);if((f|0)==6){t[18]=e+16;e=w(1)|0;if(e<<16>>16==42){t[18]=(t[18]|0)+2;e=w(1)|0;}n=t[18]|0;H(e)|0;J(n,t[18]|0);t[18]=(t[18]|0)+-2;break}else if((f|0)==13){e=e+4|0;t[18]=e;i[589]=0;r:while(1){t[18]=e+2;n=w(1)|0;e=t[18]|0;switch((H(n)|0)<<16>>16){case 91:case 123:{f=15;break r}default:{}}r=t[18]|0;if((r|0)==(e|0))break e;J(e,r);switch((w(1)|0)<<16>>16){case 61:{f=19;break r}case 44:break;default:{f=20;break r}}e=t[18]|0;}if((f|0)==15){t[18]=(t[18]|0)+-2;break}else if((f|0)==19){t[18]=(t[18]|0)+-2;break}else if((f|0)==20){t[18]=(t[18]|0)+-2;break}}else if((f|0)==34)r=w(1)|0;e=t[18]|0;if(r<<16>>16==102?K(e+2|0,114,111,109)|0:0){t[18]=e+8;l(c,w(1)|0);break}t[18]=e+-2;}}while(0);return}function k(){var e=0,r=0,a=0,f=0,c=0;c=t[18]|0;r=c+12|0;t[18]=r;e:do{switch((w(1)|0)<<16>>16){case 40:{r=t[17]|0;a=s[292]|0;s[292]=a+1<<16>>16;t[r+((a&65535)<<2)>>2]=c;if((s[t[15]>>1]|0)!=46){v(c,(t[18]|0)+2|0,0,c);t[11]=t[8];t[18]=(t[18]|0)+2;switch((w(1)|0)<<16>>16){case 39:{d(39);break}case 34:{d(34);break}default:{t[18]=(t[18]|0)+-2;break e}}t[18]=(t[18]|0)+2;switch((w(1)|0)<<16>>16){case 44:{c=t[18]|0;t[(t[8]|0)+4>>2]=c;t[18]=c+2;w(1)|0;c=t[18]|0;a=t[8]|0;t[a+16>>2]=c;i[a+24>>0]=1;t[18]=c+-2;break e}case 41:{s[292]=(s[292]|0)+-1<<16>>16;a=t[18]|0;c=t[8]|0;t[c+4>>2]=a;t[c+12>>2]=a;i[c+24>>0]=1;break e}default:{t[18]=(t[18]|0)+-2;break e}}}break}case 46:{t[18]=(t[18]|0)+2;if(((w(1)|0)<<16>>16==109?(e=t[18]|0,K(e+2|0,101,116,97)|0):0)?(s[t[15]>>1]|0)!=46:0)v(c,c,e+8|0,2);break}case 42:case 39:case 34:{f=16;break}case 123:{e=t[18]|0;if(s[292]|0){t[18]=e+-2;break e}while(1){if(e>>>0>=(t[19]|0)>>>0)break;e=w(1)|0;if(!(_(e)|0)){if(e<<16>>16==125){f=31;break}}else d(e);e=(t[18]|0)+2|0;t[18]=e;}if((f|0)==31)t[18]=(t[18]|0)+2;w(1)|0;e=t[18]|0;if(!(z(e,102,114,111,109)|0)){Y();break e}t[18]=e+8;e=w(1)|0;if(_(e)|0){l(c,e);break e}else {Y();break e}}default:if((t[18]|0)!=(r|0))f=16;}}while(0);do{if((f|0)==16){if(s[292]|0){t[18]=(t[18]|0)+-2;break}e=t[19]|0;r=t[18]|0;while(1){if(r>>>0>=e>>>0){f=23;break}a=s[r>>1]|0;if(_(a)|0){f=21;break}f=r+2|0;t[18]=f;r=f;}if((f|0)==21){l(c,a);break}else if((f|0)==23){Y();break}}}while(0);return}function l(e,r){e=e|0;r=r|0;var a=0,i=0;a=(t[18]|0)+2|0;switch(r<<16>>16){case 39:{d(39);i=5;break}case 34:{d(34);i=5;break}default:Y();}do{if((i|0)==5){v(e,a,t[18]|0,1);t[18]=(t[18]|0)+2;i=(w(0)|0)<<16>>16==97;r=t[18]|0;if(i?B(r+2|0,115,115,101,114,116)|0:0){t[18]=r+12;if((w(1)|0)<<16>>16!=123){t[18]=r;break}e=t[18]|0;a=e;e:while(1){t[18]=a+2;a=w(1)|0;switch(a<<16>>16){case 39:{d(39);t[18]=(t[18]|0)+2;a=w(1)|0;break}case 34:{d(34);t[18]=(t[18]|0)+2;a=w(1)|0;break}default:a=H(a)|0;}if(a<<16>>16!=58){i=16;break}t[18]=(t[18]|0)+2;switch((w(1)|0)<<16>>16){case 39:{d(39);break}case 34:{d(34);break}default:{i=20;break e}}t[18]=(t[18]|0)+2;switch((w(1)|0)<<16>>16){case 125:{i=25;break e}case 44:break;default:{i=24;break e}}t[18]=(t[18]|0)+2;if((w(1)|0)<<16>>16==125){i=25;break}a=t[18]|0;}if((i|0)==16){t[18]=r;break}else if((i|0)==20){t[18]=r;break}else if((i|0)==24){t[18]=r;break}else if((i|0)==25){i=t[8]|0;t[i+16>>2]=e;t[i+12>>2]=(t[18]|0)+2;break}}t[18]=r+-2;}}while(0);return}function o(e){e=e|0;e:do{switch(s[e>>1]|0){case 100:switch(s[e+-2>>1]|0){case 105:{e=q(e+-4|0,118,111)|0;break e}case 108:{e=P(e+-4|0,121,105,101)|0;break e}default:{e=0;break e}}case 101:{switch(s[e+-2>>1]|0){case 115:break;case 116:{e=E(e+-4|0,100,101,108,101)|0;break e}default:{e=0;break e}}switch(s[e+-4>>1]|0){case 108:{e=D(e+-6|0,101)|0;break e}case 97:{e=D(e+-6|0,99)|0;break e}default:{e=0;break e}}}case 102:{if((s[e+-2>>1]|0)==111?(s[e+-4>>1]|0)==101:0)switch(s[e+-6>>1]|0){case 99:{e=O(e+-8|0,105,110,115,116,97,110)|0;break e}case 112:{e=q(e+-8|0,116,121)|0;break e}default:{e=0;break e}}else e=0;break}case 110:{e=e+-2|0;if(D(e,105)|0)e=1;else e=$(e,114,101,116,117,114)|0;break}case 111:{e=D(e+-2|0,100)|0;break}case 114:{e=m(e+-2|0,100,101,98,117,103,103,101)|0;break}case 116:{e=E(e+-2|0,97,119,97,105)|0;break}case 119:switch(s[e+-2>>1]|0){case 101:{e=D(e+-4|0,110)|0;break e}case 111:{e=P(e+-4|0,116,104,114)|0;break e}default:{e=0;break e}}default:e=0;}}while(0);return e|0}function h(){var e=0,r=0,a=0;r=t[19]|0;a=t[18]|0;e:while(1){e=a+2|0;if(a>>>0>=r>>>0){r=8;break}switch(s[e>>1]|0){case 96:{r=9;break e}case 36:{if((s[a+4>>1]|0)==123){r=6;break e}break}case 92:{e=a+4|0;break}default:{}}a=e;}if((r|0)==6){t[18]=a+4;e=s[293]|0;r=t[16]|0;a=s[291]|0;s[291]=a+1<<16>>16;s[r+((a&65535)<<1)>>1]=e;a=(s[292]|0)+1<<16>>16;s[292]=a;s[293]=a;}else if((r|0)==8){t[18]=e;Y();}else if((r|0)==9)t[18]=e;return}function w(e){e=e|0;var r=0,a=0,i=0;a=t[18]|0;e:do{r=s[a>>1]|0;r:do{if(r<<16>>16!=47)if(e)if(Z(r)|0)break;else break e;else if(Q(r)|0)break;else break e;else switch(s[a+2>>1]|0){case 47:{G();break r}case 42:{p(e);break r}default:{r=47;break e}}}while(0);i=t[18]|0;a=i+2|0;t[18]=a;}while(i>>>0<(t[19]|0)>>>0);return r|0}function d(e){e=e|0;var r=0,a=0,i=0,f=0;f=t[19]|0;r=t[18]|0;while(1){i=r+2|0;if(r>>>0>=f>>>0){r=9;break}a=s[i>>1]|0;if(a<<16>>16==e<<16>>16){r=10;break}if(a<<16>>16==92){a=r+4|0;if((s[a>>1]|0)==13){r=r+6|0;r=(s[r>>1]|0)==10?r:a;}else r=a;}else if(ae(a)|0){r=9;break}else r=i;}if((r|0)==9){t[18]=i;Y();}else if((r|0)==10)t[18]=i;return}function v(e,r,a,s){e=e|0;r=r|0;a=a|0;s=s|0;var f=0,c=0;f=t[13]|0;t[13]=f+32;c=t[8]|0;t[((c|0)==0?16:c+28|0)>>2]=f;t[9]=c;t[8]=f;t[f+8>>2]=e;do{if(2!=(s|0))if(1==(s|0)){t[f+12>>2]=a+2;break}else {t[f+12>>2]=t[3];break}else t[f+12>>2]=a;}while(0);t[f>>2]=r;t[f+4>>2]=a;t[f+16>>2]=0;t[f+20>>2]=s;i[f+24>>0]=1==(s|0)&1;t[f+28>>2]=0;return}function A(){var e=0,r=0,a=0;a=t[19]|0;r=t[18]|0;e:while(1){e=r+2|0;if(r>>>0>=a>>>0){r=6;break}switch(s[e>>1]|0){case 13:case 10:{r=6;break e}case 93:{r=7;break e}case 92:{e=r+4|0;break}default:{}}r=e;}if((r|0)==6){t[18]=e;Y();e=0;}else if((r|0)==7){t[18]=e;e=93;}return e|0}function C(e,r,a,i,t,f,c,n){e=e|0;r=r|0;a=a|0;i=i|0;t=t|0;f=f|0;c=c|0;n=n|0;if((((((s[e+12>>1]|0)==n<<16>>16?(s[e+10>>1]|0)==c<<16>>16:0)?(s[e+8>>1]|0)==f<<16>>16:0)?(s[e+6>>1]|0)==t<<16>>16:0)?(s[e+4>>1]|0)==i<<16>>16:0)?(s[e+2>>1]|0)==a<<16>>16:0)r=(s[e>>1]|0)==r<<16>>16;else r=0;return r|0}function y(e){e=e|0;switch(s[e>>1]|0){case 62:{e=(s[e+-2>>1]|0)==61;break}case 41:case 59:{e=1;break}case 104:{e=E(e+-2|0,99,97,116,99)|0;break}case 121:{e=O(e+-2|0,102,105,110,97,108,108)|0;break}case 101:{e=P(e+-2|0,101,108,115)|0;break}default:e=0;}return e|0}function g(e,r){e=e|0;r=r|0;var a=0,i=0;a=t[18]|0;i=s[a>>1]|0;if(i<<16>>16==97){t[18]=a+4;a=w(1)|0;e=t[18]|0;if(_(a)|0){d(a);r=(t[18]|0)+2|0;t[18]=r;}else {H(a)|0;r=t[18]|0;}i=w(1)|0;a=t[18]|0;}if((a|0)!=(e|0))J(e,r);return i|0}function I(){var e=0,r=0,a=0;e:while(1){e=t[18]|0;r=e+2|0;t[18]=r;if(e>>>0>=(t[19]|0)>>>0){a=7;break}switch(s[r>>1]|0){case 13:case 10:{a=7;break e}case 47:break e;case 91:{A()|0;break}case 92:{t[18]=e+4;break}default:{}}}if((a|0)==7)Y();return}function p(e){e=e|0;var r=0,a=0,i=0,f=0,c=0;f=(t[18]|0)+2|0;t[18]=f;a=t[19]|0;while(1){r=f+2|0;if(f>>>0>=a>>>0)break;i=s[r>>1]|0;if(!e?ae(i)|0:0)break;if(i<<16>>16==42?(s[f+4>>1]|0)==47:0){c=8;break}f=r;}if((c|0)==8){t[18]=r;r=f+4|0;}t[18]=r;return}function U(e,r,a,i,t,f,c){e=e|0;r=r|0;a=a|0;i=i|0;t=t|0;f=f|0;c=c|0;if(((((s[e+10>>1]|0)==c<<16>>16?(s[e+8>>1]|0)==f<<16>>16:0)?(s[e+6>>1]|0)==t<<16>>16:0)?(s[e+4>>1]|0)==i<<16>>16:0)?(s[e+2>>1]|0)==a<<16>>16:0)r=(s[e>>1]|0)==r<<16>>16;else r=0;return r|0}function m(e,r,a,i,f,c,n,b){e=e|0;r=r|0;a=a|0;i=i|0;f=f|0;c=c|0;n=n|0;b=b|0;var u=0,k=0;k=e+-12|0;u=t[3]|0;if(k>>>0>=u>>>0?C(k,r,a,i,f,c,n,b)|0:0)if((k|0)==(u|0))u=1;else u=F(s[e+-14>>1]|0)|0;else u=0;return u|0}function S(e){e=e|0;e:do{switch(e<<16>>16){case 38:case 37:case 33:{e=1;break}default:if((e&-8)<<16>>16==40|(e+-58&65535)<6)e=1;else {switch(e<<16>>16){case 91:case 93:case 94:{e=1;break e}default:{}}e=(e+-123&65535)<4;}}}while(0);return e|0}function x(e){e=e|0;e:do{switch(e<<16>>16){case 38:case 37:case 33:break;default:if(!((e+-58&65535)<6|(e+-40&65535)<7&e<<16>>16!=41)){switch(e<<16>>16){case 91:case 94:break e;default:{}}return e<<16>>16!=125&(e+-123&65535)<4|0}}}while(0);return 1}function O(e,r,a,i,f,c,n){e=e|0;r=r|0;a=a|0;i=i|0;f=f|0;c=c|0;n=n|0;var b=0,u=0;u=e+-10|0;b=t[3]|0;if(u>>>0>=b>>>0?U(u,r,a,i,f,c,n)|0:0)if((u|0)==(b|0))b=1;else b=F(s[e+-12>>1]|0)|0;else b=0;return b|0}function $(e,r,a,i,f,c){e=e|0;r=r|0;a=a|0;i=i|0;f=f|0;c=c|0;var n=0,b=0;b=e+-8|0;n=t[3]|0;if(b>>>0>=n>>>0?B(b,r,a,i,f,c)|0:0)if((b|0)==(n|0))n=1;else n=F(s[e+-10>>1]|0)|0;else n=0;return n|0}function j(e){e=e|0;var r=0,a=0,i=0,f=0;a=n;n=n+16|0;i=a;t[i>>2]=0;t[12]=e;r=t[3]|0;f=r+(e<<1)|0;e=f+2|0;s[f>>1]=0;t[i>>2]=e;t[13]=e;t[4]=0;t[8]=0;t[6]=0;t[5]=0;t[10]=0;t[7]=0;n=a;return r|0}function B(e,r,a,i,t,f){e=e|0;r=r|0;a=a|0;i=i|0;t=t|0;f=f|0;if((((s[e+8>>1]|0)==f<<16>>16?(s[e+6>>1]|0)==t<<16>>16:0)?(s[e+4>>1]|0)==i<<16>>16:0)?(s[e+2>>1]|0)==a<<16>>16:0)r=(s[e>>1]|0)==r<<16>>16;else r=0;return r|0}function E(e,r,a,i,f){e=e|0;r=r|0;a=a|0;i=i|0;f=f|0;var c=0,n=0;n=e+-6|0;c=t[3]|0;if(n>>>0>=c>>>0?z(n,r,a,i,f)|0:0)if((n|0)==(c|0))c=1;else c=F(s[e+-8>>1]|0)|0;else c=0;return c|0}function P(e,r,a,i){e=e|0;r=r|0;a=a|0;i=i|0;var f=0,c=0;c=e+-4|0;f=t[3]|0;if(c>>>0>=f>>>0?K(c,r,a,i)|0:0)if((c|0)==(f|0))f=1;else f=F(s[e+-6>>1]|0)|0;else f=0;return f|0}function q(e,r,a){e=e|0;r=r|0;a=a|0;var i=0,f=0;f=e+-2|0;i=t[3]|0;if(f>>>0>=i>>>0?N(f,r,a)|0:0)if((f|0)==(i|0))i=1;else i=F(s[e+-4>>1]|0)|0;else i=0;return i|0}function z(e,r,a,i,t){e=e|0;r=r|0;a=a|0;i=i|0;t=t|0;if(((s[e+6>>1]|0)==t<<16>>16?(s[e+4>>1]|0)==i<<16>>16:0)?(s[e+2>>1]|0)==a<<16>>16:0)r=(s[e>>1]|0)==r<<16>>16;else r=0;return r|0}function D(e,r){e=e|0;r=r|0;var a=0;a=t[3]|0;if(a>>>0<=e>>>0?(s[e>>1]|0)==r<<16>>16:0)if((a|0)==(e|0))a=1;else a=F(s[e+-2>>1]|0)|0;else a=0;return a|0}function F(e){e=e|0;e:do{if((e+-9&65535)<5)e=1;else {switch(e<<16>>16){case 32:case 160:{e=1;break e}default:{}}e=e<<16>>16!=46&(S(e)|0);}}while(0);return e|0}function G(){var e=0,r=0,a=0;e=t[19]|0;a=t[18]|0;e:while(1){r=a+2|0;if(a>>>0>=e>>>0)break;switch(s[r>>1]|0){case 13:case 10:break e;default:a=r;}}t[18]=r;return}function H(e){e=e|0;while(1){if(Z(e)|0)break;if(S(e)|0)break;e=(t[18]|0)+2|0;t[18]=e;e=s[e>>1]|0;if(!(e<<16>>16)){e=0;break}}return e|0}function J(e,r){e=e|0;r=r|0;var a=0,i=0;a=t[13]|0;t[13]=a+12;i=t[10]|0;t[((i|0)==0?20:i+8|0)>>2]=a;t[10]=a;t[a>>2]=e;t[a+4>>2]=r;t[a+8>>2]=0;return}function K(e,r,a,i){e=e|0;r=r|0;a=a|0;i=i|0;if((s[e+4>>1]|0)==i<<16>>16?(s[e+2>>1]|0)==a<<16>>16:0)r=(s[e>>1]|0)==r<<16>>16;else r=0;return r|0}function L(e){e=e|0;if(!($(e,119,104,105,108,101)|0)?!(P(e,102,111,114)|0):0)e=q(e,105,102)|0;else e=1;return e|0}function M(){var e=0;e=t[(t[6]|0)+20>>2]|0;switch(e|0){case 1:{e=-1;break}case 2:{e=-2;break}default:e=e-(t[3]|0)>>1;}return e|0}function N(e,r,a){e=e|0;r=r|0;a=a|0;if((s[e+2>>1]|0)==a<<16>>16)r=(s[e>>1]|0)==r<<16>>16;else r=0;return r|0}function Q(e){e=e|0;switch(e<<16>>16){case 160:case 32:case 12:case 11:case 9:{e=1;break}default:e=0;}return e|0}function R(e){e=e|0;if((t[3]|0)==(e|0))e=1;else e=F(s[e+-2>>1]|0)|0;return e|0}function T(){var e=0;e=t[(t[6]|0)+16>>2]|0;if(!e)e=-1;else e=e-(t[3]|0)>>1;return e|0}function V(){var e=0;e=t[6]|0;e=t[((e|0)==0?16:e+28|0)>>2]|0;t[6]=e;return (e|0)!=0|0}function W(){var e=0;e=t[7]|0;e=t[((e|0)==0?20:e+8|0)>>2]|0;t[7]=e;return (e|0)!=0|0}function X(e){e=e|0;var r=0;r=n;n=n+e|0;n=n+15&-16;return r|0}function Y(){i[588]=1;t[14]=(t[18]|0)-(t[3]|0)>>1;t[18]=(t[19]|0)+2;return}function Z(e){e=e|0;return (e|128)<<16>>16==160|(e+-9&65535)<5|0}function _(e){e=e|0;return e<<16>>16==39|e<<16>>16==34|0}function ee(){return (t[(t[6]|0)+12>>2]|0)-(t[3]|0)>>1|0}function re(){return (t[(t[6]|0)+8>>2]|0)-(t[3]|0)>>1|0}function ae(e){e=e|0;return e<<16>>16==13|e<<16>>16==10|0}function ie(){return (t[(t[6]|0)+4>>2]|0)-(t[3]|0)>>1|0}function se(){return (t[(t[7]|0)+4>>2]|0)-(t[3]|0)>>1|0}function te(){return (t[t[6]>>2]|0)-(t[3]|0)>>1|0}function fe(){return (t[t[7]>>2]|0)-(t[3]|0)>>1|0}function ce(){return f[(t[6]|0)+24>>0]|0|0}function ne(e){e=e|0;t[3]=e;return}function be(){return (i[589]|0)!=0|0}function ue(){return t[14]|0}return {ai:T,e:ue,ee:se,es:fe,f:be,id:M,ie:ie,ip:ce,is:te,p:b,re:W,ri:V,sa:j,se:ee,ses:ne,ss:re,sta:X}}({Int8Array:Int8Array,Int16Array:Int16Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Uint16Array:Uint16Array},{},r),a=e.sta(2*i);}const o=t.length+1;e.ses(a),e.sa(o-1),(s?b:n)(t,new Uint16Array(r,a,o)),e.p()||(c$1=e.e(),h());const w=[],d=[];for(;e.ri();){const r=e.is(),a=e.ie(),i=e.ai(),s=e.id(),f=e.ss(),c=e.se();let n;e.ip()&&(n=u(-1===s?r:r+1,t.charCodeAt(-1===s?r-1:r))),w.push({n:n,s:r,e:a,ss:f,se:c,d:s,a:i});}for(;e.re();){const r=e.es(),a=t.charCodeAt(r);d.push(34===a||39===a?u(r+1,a):t.slice(e.es(),e.ee()));}return [w,d,!!e.f()]}function n(e,r){const a=e.length;let i=0;for(;i<a;){const a=e.charCodeAt(i);r[i++]=(255&a)<<8|a>>>8;}}function b(e,r){const a=e.length;let i=0;for(;i<a;)r[i]=e.charCodeAt(i++);}function u(e,r){c$1=e;let a="",i=c$1;for(;;){c$1>=t.length&&h();const e=t.charCodeAt(c$1);if(e===r)break;92===e?(a+=t.slice(i,c$1),a+=k(),i=c$1):(8232===e||8233===e||o(e)&&h(),++c$1);}return a+=t.slice(i,c$1++),a}function k(){let e=t.charCodeAt(++c$1);switch(++c$1,e){case 110:return "\n";case 114:return "\r";case 120:return String.fromCharCode(l(2));case 117:return function(){let e;123===t.charCodeAt(c$1)?(++c$1,e=l(t.indexOf("}",c$1)-c$1),++c$1,e>1114111&&h()):e=l(4);return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}();case 116:return "\t";case 98:return "\b";case 118:return "\v";case 102:return "\f";case 13:10===t.charCodeAt(c$1)&&++c$1;case 10:return "";case 56:case 57:h();default:if(e>=48&&e<=55){let r=t.substr(c$1-1,3).match(/^[0-7]+/)[0],a=parseInt(r,8);return a>255&&(r=r.slice(0,-1),a=parseInt(r,8)),c$1+=r.length-1,e=t.charCodeAt(c$1),"0"===r&&56!==e&&57!==e||h(),String.fromCharCode(a)}return o(e)?"":String.fromCharCode(e)}}function l(e){const r=c$1;let a=0,i=0;for(let r=0;r<e;++r,++c$1){let e,s=t.charCodeAt(c$1);if(95!==s){if(s>=97)e=s-97+10;else if(s>=65)e=s-65+10;else {if(!(s>=48&&s<=57))break;e=s-48;}if(e>=16)break;i=s,a=16*a+e;}else 95!==i&&0!==r||h(),i=s;}return 95!==i&&c$1-r===e||h(),a}function o(e){return 13===e||10===e}function h(){throw Object.assign(new Error(`Parse error ${f}:${t.slice(0,c$1).split("\n").length}:${c$1-t.lastIndexOf("\n",c$1-1)}`),{idx:c$1})}
307
+
308
+ async function defaultResolve (id, parentUrl) {
309
+ return resolveImportMap(importMap, resolveIfNotPlainOrUrl(id, parentUrl) || id, parentUrl);
310
+ }
311
+
312
+ async function _resolve (id, parentUrl) {
313
+ const urlResolved = resolveIfNotPlainOrUrl(id, parentUrl);
314
+ return {
315
+ r: resolveImportMap(importMap, urlResolved || id, parentUrl),
316
+ // b = bare specifier
317
+ b: !urlResolved && !isURL(id)
318
+ };
319
+ }
320
+
321
+ const resolve = resolveHook ? async (id, parentUrl) => ({ r: await resolveHook(id, parentUrl, defaultResolve), b: false }) : _resolve;
322
+
323
+ let id = 0;
324
+ const registry = {};
325
+
326
+ async function loadAll (load, seen) {
327
+ if (load.b || seen[load.u])
328
+ return;
329
+ seen[load.u] = 1;
330
+ await load.L;
331
+ await Promise.all(load.d.map(dep => loadAll(dep, seen)));
332
+ if (!load.n)
333
+ load.n = load.d.some(dep => dep.n);
334
+ }
335
+
336
+ let importMap = { imports: {}, scopes: {} };
337
+ let importMapSrcOrLazy = false;
338
+ let baselinePassthrough;
339
+
340
+ const initPromise = featureDetectionPromise.then(() => {
341
+ // shim mode is determined on initialization, no late shim mode
342
+ if (!shimMode) {
343
+ let seenScript = false;
344
+ for (const script of document.querySelectorAll('script[type="module-shim"],script[type="importmap-shim"],script[type="module"],script[type="importmap"]')) {
345
+ if (!seenScript && script.type === 'module')
346
+ seenScript = true;
347
+ if (script.type.endsWith('-shim')) {
348
+ setShimMode();
349
+ break;
350
+ }
351
+ if (seenScript && script.type === 'importmap') {
352
+ importMapSrcOrLazy = true;
353
+ break;
354
+ }
355
+ }
356
+ }
357
+ baselinePassthrough = supportsDynamicImport && supportsImportMeta && supportsImportMaps && (!jsonModulesEnabled || supportsJsonAssertions) && (!cssModulesEnabled || supportsCssAssertions) && !importMapSrcOrLazy && !false;
358
+ if (!baselinePassthrough) onpolyfill();
359
+ if (shimMode || !baselinePassthrough) {
360
+ new MutationObserver(mutations => {
361
+ for (const mutation of mutations) {
362
+ if (mutation.type !== 'childList') continue;
363
+ for (const node of mutation.addedNodes) {
364
+ if (node.tagName === 'SCRIPT') {
365
+ if (!shimMode && node.type === 'module' || shimMode && node.type === 'module-shim')
366
+ processScript(node);
367
+ if (!shimMode && node.type === 'importmap' || shimMode && node.type === 'importmap-shim')
368
+ processImportMap(node);
369
+ }
370
+ else if (node.tagName === 'LINK' && node.rel === 'modulepreload')
371
+ processPreload(node);
372
+ }
373
+ }
374
+ }).observe(document, { childList: true, subtree: true });
375
+ processImportMaps();
376
+ processScriptsAndPreloads();
377
+ return undefined;
378
+ }
379
+ });
380
+ let importMapPromise = initPromise;
381
+
382
+ let acceptingImportMaps = true;
383
+ async function topLevelLoad (url, fetchOpts, source, nativelyLoaded, lastStaticLoadPromise) {
384
+ if (!shimMode)
385
+ acceptingImportMaps = false;
386
+ await importMapPromise;
387
+ // early analysis opt-out - no need to even fetch if we have feature support
388
+ if (!shimMode && baselinePassthrough) {
389
+ // for polyfill case, only dynamic import needs a return value here, and dynamic import will never pass nativelyLoaded
390
+ if (nativelyLoaded)
391
+ return null;
392
+ await lastStaticLoadPromise;
393
+ return dynamicImport(source ? createBlob(source) : url, { errUrl: url || source });
394
+ }
395
+ const load = getOrCreateLoad(url, fetchOpts, source);
396
+ const seen = {};
397
+ await loadAll(load, seen);
398
+ lastLoad = undefined;
399
+ resolveDeps(load, seen);
400
+ await lastStaticLoadPromise;
401
+ if (source && !shimMode && !load.n && !false) {
402
+ const module = await dynamicImport(createBlob(source), { errUrl: source });
403
+ if (revokeBlobURLs) revokeObjectURLs(Object.keys(seen));
404
+ return module;
405
+ }
406
+ const module = await dynamicImport(!shimMode && !load.n && nativelyLoaded ? load.u : load.b, { errUrl: load.u });
407
+ // if the top-level load is a shell, run its update function
408
+ if (load.s)
409
+ (await dynamicImport(load.s)).u$_(module);
410
+ if (revokeBlobURLs) revokeObjectURLs(Object.keys(seen));
411
+ // when tla is supported, this should return the tla promise as an actual handle
412
+ // so readystate can still correspond to the sync subgraph exec completions
413
+ return module;
414
+ }
415
+
416
+ function revokeObjectURLs(registryKeys) {
417
+ let batch = 0;
418
+ const keysLength = registryKeys.length;
419
+ const schedule = self.requestIdleCallback ? self.requestIdleCallback : self.requestAnimationFrame;
420
+ schedule(cleanup);
421
+ function cleanup() {
422
+ const batchStartIndex = batch * 100;
423
+ if (batchStartIndex > keysLength) return
424
+ for (const key of registryKeys.slice(batchStartIndex, batchStartIndex + 100)) {
425
+ const load = registry[key];
426
+ if (load) URL.revokeObjectURL(load.b);
427
+ }
428
+ batch++;
429
+ schedule(cleanup);
430
+ }
431
+ }
432
+
433
+ async function importShim (id, parentUrl = baseUrl, _assertion) {
434
+ // needed for shim check
435
+ await initPromise;
436
+ if (acceptingImportMaps || shimMode || !baselinePassthrough) {
437
+ processImportMaps();
438
+ if (!shimMode)
439
+ acceptingImportMaps = false;
440
+ }
441
+ await importMapPromise;
442
+ return topLevelLoad((await resolve(id, parentUrl)).r || throwUnresolved(id, parentUrl), { credentials: 'same-origin' });
443
+ }
444
+
445
+ self.importShim = importShim;
446
+
447
+ if (shimMode) {
448
+ importShim.getImportMap = () => JSON.parse(JSON.stringify(importMap));
449
+ }
450
+
451
+ const meta = {};
452
+
453
+ async function importMetaResolve (id, parentUrl = this.url) {
454
+ return (await resolve(id, `${parentUrl}`)).r || throwUnresolved(id, parentUrl);
455
+ }
456
+
457
+ self._esmsm = meta;
458
+
459
+ function urlJsString (url) {
460
+ return `'${url.replace(/'/g, "\\'")}'`;
461
+ }
462
+
463
+ let lastLoad;
464
+ function resolveDeps (load, seen) {
465
+ if (load.b || !seen[load.u])
466
+ return;
467
+ seen[load.u] = 0;
468
+
469
+ for (const dep of load.d)
470
+ resolveDeps(dep, seen);
471
+
472
+ const [imports] = load.a;
473
+
474
+ // "execution"
475
+ const source = load.S;
476
+
477
+ // edge doesnt execute sibling in order, so we fix this up by ensuring all previous executions are explicit dependencies
478
+ let resolvedSource = edge && lastLoad ? `import '${lastLoad}';` : '';
479
+
480
+ if (!imports.length) {
481
+ resolvedSource += source;
482
+ }
483
+ else {
484
+ // once all deps have loaded we can inline the dependency resolution blobs
485
+ // and define this blob
486
+ let lastIndex = 0, depIndex = 0;
487
+ for (const { s: start, se: end, d: dynamicImportIndex } of imports) {
488
+ // dependency source replacements
489
+ if (dynamicImportIndex === -1) {
490
+ const depLoad = load.d[depIndex++];
491
+ let blobUrl = depLoad.b;
492
+ if (!blobUrl) {
493
+ // circular shell creation
494
+ if (!(blobUrl = depLoad.s)) {
495
+ blobUrl = depLoad.s = createBlob(`export function u$_(m){${
496
+ depLoad.a[1].map(
497
+ name => name === 'default' ? `$_default=m.default` : `${name}=m.${name}`
498
+ ).join(',')
499
+ }}${
500
+ depLoad.a[1].map(name =>
501
+ name === 'default' ? `let $_default;export{$_default as default}` : `export let ${name}`
502
+ ).join(';')
503
+ }\n//# sourceURL=${depLoad.r}?cycle`);
504
+ }
505
+ }
506
+ // circular shell execution
507
+ else if (depLoad.s) {
508
+ resolvedSource += `${source.slice(lastIndex, start - 1)}/*${source.slice(start - 1, end)}*/${urlJsString(blobUrl)};import*as m$_${depIndex} from'${depLoad.b}';import{u$_ as u$_${depIndex}}from'${depLoad.s}';u$_${depIndex}(m$_${depIndex})`;
509
+ lastIndex = end;
510
+ depLoad.s = undefined;
511
+ continue;
512
+ }
513
+ resolvedSource += `${source.slice(lastIndex, start - 1)}/*${source.slice(start - 1, end)}*/${urlJsString(blobUrl)}`;
514
+ lastIndex = end;
515
+ }
516
+ // import.meta
517
+ else if (dynamicImportIndex === -2) {
518
+ meta[load.r] = { url: load.r, resolve: importMetaResolve };
519
+ resolvedSource += `${source.slice(lastIndex, start)}self._esmsm[${urlJsString(load.r)}]`;
520
+ lastIndex = end;
521
+ }
522
+ // dynamic import
523
+ else {
524
+ resolvedSource += `${source.slice(lastIndex, dynamicImportIndex + 6)}Shim(${source.slice(start, end)}, ${load.r && urlJsString(load.r)}`;
525
+ lastIndex = end;
526
+ }
527
+ }
528
+
529
+ resolvedSource += source.slice(lastIndex);
530
+ }
531
+
532
+ // ; and // trailer support added for Ruby 7 source maps compatibility
533
+ let hasSourceURL = false;
534
+ resolvedSource = resolvedSource.replace(sourceMapURLRegEx, (match, isMapping, url) => (hasSourceURL = !isMapping, match.replace(url, () => new URL(url, load.r))));
535
+ if (!hasSourceURL)
536
+ resolvedSource += '\n//# sourceURL=' + load.r;
537
+
538
+ load.b = lastLoad = createBlob(resolvedSource);
539
+ load.S = undefined;
540
+ }
541
+
542
+ const sourceMapURLRegEx = /\n\/\/# source(Mapping)?URL=([^\n]+)\s*((;|\/\/[^#][^\n]*)\s*)*$/;
543
+
544
+ const jsContentType = /^(text|application)\/(x-)?javascript(;|$)/;
545
+ const jsonContentType = /^(text|application)\/json(;|$)/;
546
+ const cssContentType = /^(text|application)\/css(;|$)/;
547
+ const wasmContentType = /^application\/wasm(;|$)/;
548
+
549
+ const cssUrlRegEx = /url\(\s*(?:(["'])((?:\\.|[^\n\\"'])+)\1|((?:\\.|[^\s,"'()\\])+))\s*\)/g;
550
+
551
+ // restrict in-flight fetches to a pool of 100
552
+ let p = [];
553
+ let c = 0;
554
+ function pushFetchPool () {
555
+ if (++c > 100)
556
+ return new Promise(r => p.push(r));
557
+ }
558
+ function popFetchPool () {
559
+ c--;
560
+ if (p.length)
561
+ p.shift()();
562
+ }
563
+
564
+ async function doFetch (url, fetchOpts) {
565
+ const poolQueue = pushFetchPool();
566
+ if (poolQueue) await poolQueue;
567
+ try {
568
+ var res = await fetchHook(url, fetchOpts);
569
+ }
570
+ finally {
571
+ popFetchPool();
572
+ }
573
+ if (!res.ok)
574
+ throw new Error(`${res.status} ${res.statusText} ${res.url}`);
575
+ const contentType = res.headers.get('content-type');
576
+ if (jsContentType.test(contentType))
577
+ return { r: res.url, s: await res.text(), t: 'js' };
578
+ else if (jsonContentType.test(contentType))
579
+ return { r: res.url, s: `export default ${await res.text()}`, t: 'json' };
580
+ else if (cssContentType.test(contentType))
581
+ return { r: res.url, s: `var s=new CSSStyleSheet();s.replaceSync(${
582
+ JSON.stringify((await res.text()).replace(cssUrlRegEx, (_match, quotes, relUrl1, relUrl2) => `url(${quotes}${resolveUrl(relUrl1 || relUrl2, url)}${quotes})`))
583
+ });export default s;`, t: 'css' };
584
+ else if (wasmContentType.test(contentType))
585
+ throw new Error('WASM modules not supported');
586
+ else
587
+ throw new Error(`Unknown Content-Type "${contentType}"`);
588
+ }
589
+
590
+ function getOrCreateLoad (url, fetchOpts, source) {
591
+ let load = registry[url];
592
+ if (load)
593
+ return load;
594
+
595
+ load = registry[url] = {
596
+ // url
597
+ u: url,
598
+ // response url
599
+ r: undefined,
600
+ // fetchPromise
601
+ f: undefined,
602
+ // source
603
+ S: undefined,
604
+ // linkPromise
605
+ L: undefined,
606
+ // analysis
607
+ a: undefined,
608
+ // deps
609
+ d: undefined,
610
+ // blobUrl
611
+ b: undefined,
612
+ // shellUrl
613
+ s: undefined,
614
+ // needsShim
615
+ n: false,
616
+ // type
617
+ t: null
618
+ };
619
+
620
+ load.f = (async () => {
621
+ if (!source) {
622
+ // preload fetch options override fetch options (race)
623
+ let t;
624
+ ({ r: load.r, s: source, t } = await (fetchCache[url] || doFetch(url, fetchOpts)));
625
+ if (t && !shimMode) {
626
+ if (t === 'css' && !cssModulesEnabled || t === 'json' && !jsonModulesEnabled)
627
+ throw new Error(`${t}-modules require <script type="esms-options">{ "polyfillEnable": ["${t}-modules"] }<${''}/script>`);
628
+ if (t === 'css' && !supportsCssAssertions || t === 'json' && !supportsJsonAssertions)
629
+ load.n = true;
630
+ }
631
+ }
632
+ try {
633
+ load.a = parse(source, load.u);
634
+ }
635
+ catch (e) {
636
+ console.warn(e);
637
+ load.a = [[], []];
638
+ }
639
+ load.S = source;
640
+ return load;
641
+ })();
642
+
643
+ load.L = load.f.then(async () => {
644
+ let childFetchOpts = fetchOpts;
645
+ load.d = (await Promise.all(load.a[0].map(async ({ n, d }) => {
646
+ if (d >= 0 && !supportsDynamicImport || d === 2 && !supportsImportMeta)
647
+ load.n = true;
648
+ if (!n) return;
649
+ const { r, b } = await resolve(n, load.r || load.u);
650
+ if (b && (!supportsImportMaps || importMapSrcOrLazy))
651
+ load.n = true;
652
+ if (d !== -1) return;
653
+ if (!r)
654
+ throwUnresolved(n, load.r || load.u);
655
+ if (skip && skip.test(r)) return { b: r };
656
+ if (childFetchOpts.integrity)
657
+ childFetchOpts = Object.assign({}, childFetchOpts, { integrity: undefined });
658
+ return getOrCreateLoad(r, childFetchOpts).f;
659
+ }))).filter(l => l);
660
+ });
661
+
662
+ return load;
663
+ }
664
+
665
+ function processScriptsAndPreloads () {
666
+ for (const script of document.querySelectorAll(shimMode ? 'script[type="module-shim"]' : 'script[type="module"]'))
667
+ processScript(script);
668
+ for (const link of document.querySelectorAll('link[rel="modulepreload"]'))
669
+ processPreload(link);
670
+ }
671
+
672
+ function processImportMaps () {
673
+ for (const script of document.querySelectorAll(shimMode ? 'script[type="importmap-shim"]' : 'script[type="importmap"]'))
674
+ processImportMap(script);
675
+ }
676
+
677
+ function getFetchOpts (script) {
678
+ const fetchOpts = {};
679
+ if (script.integrity)
680
+ fetchOpts.integrity = script.integrity;
681
+ if (script.referrerpolicy)
682
+ fetchOpts.referrerPolicy = script.referrerpolicy;
683
+ if (script.crossorigin === 'use-credentials')
684
+ fetchOpts.credentials = 'include';
685
+ else if (script.crossorigin === 'anonymous')
686
+ fetchOpts.credentials = 'omit';
687
+ else
688
+ fetchOpts.credentials = 'same-origin';
689
+ return fetchOpts;
690
+ }
691
+
692
+ let lastStaticLoadPromise = Promise.resolve();
693
+
694
+ let domContentLoadedCnt = 1;
695
+ function domContentLoadedCheck () {
696
+ if (--domContentLoadedCnt === 0 && !noLoadEventRetriggers)
697
+ document.dispatchEvent(new Event('DOMContentLoaded'));
698
+ }
699
+ // this should always trigger because we assume es-module-shims is itself a domcontentloaded requirement
700
+ document.addEventListener('DOMContentLoaded', async () => {
701
+ await initPromise;
702
+ domContentLoadedCheck();
703
+ if (shimMode || !baselinePassthrough) {
704
+ processImportMaps();
705
+ processScriptsAndPreloads();
706
+ }
707
+ });
708
+
709
+ let readyStateCompleteCnt = 1;
710
+ if (document.readyState === 'complete') {
711
+ readyStateCompleteCheck();
712
+ }
713
+ else {
714
+ document.addEventListener('readystatechange', async () => {
715
+ processImportMaps();
716
+ await initPromise;
717
+ readyStateCompleteCheck();
718
+ });
719
+ }
720
+ function readyStateCompleteCheck () {
721
+ if (--readyStateCompleteCnt === 0 && !noLoadEventRetriggers)
722
+ document.dispatchEvent(new Event('readystatechange'));
723
+ }
724
+
725
+ function processImportMap (script) {
726
+ if (script.ep) // ep marker = script processed
727
+ return;
728
+ // empty inline scripts sometimes show before domready
729
+ if (!script.src && !script.innerHTML)
730
+ return;
731
+ script.ep = true;
732
+ // we dont currently support multiple, external or dynamic imports maps in polyfill mode to match native
733
+ if (script.src) {
734
+ if (!shimMode)
735
+ return;
736
+ importMapSrcOrLazy = true;
737
+ }
738
+ if (acceptingImportMaps) {
739
+ importMapPromise = importMapPromise
740
+ .then(async () => {
741
+ importMap = resolveAndComposeImportMap(script.src ? await (await fetchHook(script.src)).json() : JSON.parse(script.innerHTML), script.src || baseUrl, importMap);
742
+ })
743
+ .catch(error => setTimeout(() => { throw error }));
744
+ if (!shimMode)
745
+ acceptingImportMaps = false;
746
+ }
747
+ }
748
+
749
+ function processScript (script) {
750
+ if (script.ep) // ep marker = script processed
751
+ return;
752
+ if (script.getAttribute('noshim') !== null)
753
+ return;
754
+ // empty inline scripts sometimes show before domready
755
+ if (!script.src && !script.innerHTML)
756
+ return;
757
+ script.ep = true;
758
+ // does this load block readystate complete
759
+ const isReadyScript = readyStateCompleteCnt > 0;
760
+ // does this load block DOMContentLoaded
761
+ const isDomContentLoadedScript = domContentLoadedCnt > 0;
762
+ if (isReadyScript) readyStateCompleteCnt++;
763
+ if (isDomContentLoadedScript) domContentLoadedCnt++;
764
+ const blocks = script.getAttribute('async') === null && isReadyScript;
765
+ const loadPromise = topLevelLoad(script.src || `${baseUrl}?${id++}`, getFetchOpts(script), !script.src && script.innerHTML, !shimMode, blocks && lastStaticLoadPromise).catch(e => {
766
+ setTimeout(() => { throw e });
767
+ onerror(e);
768
+ });
769
+ if (blocks)
770
+ lastStaticLoadPromise = loadPromise.then(readyStateCompleteCheck);
771
+ if (isDomContentLoadedScript)
772
+ loadPromise.then(domContentLoadedCheck);
773
+ }
774
+
775
+ const fetchCache = {};
776
+ function processPreload (link) {
777
+ if (link.ep) // ep marker = processed
778
+ return;
779
+ link.ep = true;
780
+ if (fetchCache[link.href])
781
+ return;
782
+ fetchCache[link.href] = doFetch(link.href, getFetchOpts(link));
783
+ }
784
+
785
+ function throwUnresolved (id, parentUrl) {
786
+ throw Error("Unable to resolve specifier '" + id + (parentUrl ? "' from " + parentUrl : "'"));
787
+ }
788
+
789
+ })();
sd-3dmodel-loader/models/Samba Dancing.fbx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b9003ee562c87bf03051c3a502411b0808d3513f1d74a2011f7530d9f067069f
3
+ size 3681360
sd-3dmodel-loader/models/male02.obj ADDED
The diff for this file is too large to render. See raw diff
 
sd-3dmodel-loader/models/pose.vrm ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:12c2b97e95e700783a6a550dc0eee2d7880aeedccef9ae67bc4c5a2f0f2631a2
3
+ size 10776032
sd-3dmodel-loader/package.json ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "react-threejs",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "dependencies": {
6
+ "@emotion/react": "^11.10.6",
7
+ "@emotion/styled": "^11.10.6",
8
+ "@mui/icons-material": "^5.11.16",
9
+ "@mui/lab": "^5.0.0-alpha.127",
10
+ "@mui/material": "^5.12.1",
11
+ "@mui/system": "^5.12.1",
12
+ "@pixiv/three-vrm": "^1.0.9",
13
+ "@testing-library/jest-dom": "^5.16.5",
14
+ "@testing-library/react": "^13.4.0",
15
+ "@testing-library/user-event": "^13.5.0",
16
+ "dat.gui": "^0.7.9",
17
+ "drei": "^2.2.21",
18
+ "react": "^18.2.0",
19
+ "react-color": "^2.19.3",
20
+ "react-dom": "^18.2.0",
21
+ "react-scripts": "5.0.1",
22
+ "react-three-fiber": "^6.0.13",
23
+ "web-vitals": "^2.1.4"
24
+ },
25
+ "scripts": {
26
+ "start": "react-scripts start",
27
+ "build": "react-scripts build",
28
+ "test": "react-scripts test",
29
+ "eject": "react-scripts eject"
30
+ },
31
+ "eslintConfig": {
32
+ "extends": [
33
+ "react-app",
34
+ "react-app/jest"
35
+ ]
36
+ },
37
+ "browserslist": {
38
+ "production": [
39
+ ">0.2%",
40
+ "not dead",
41
+ "not op_mini all"
42
+ ],
43
+ "development": [
44
+ "last 1 chrome version",
45
+ "last 1 firefox version",
46
+ "last 1 safari version"
47
+ ]
48
+ },
49
+ "devDependencies": {
50
+ "@babel/core": "^7.21.4",
51
+ "@babel/preset-env": "^7.21.4",
52
+ "@babel/preset-react": "^7.18.6",
53
+ "babel-loader": "^9.1.2",
54
+ "three": "0.149.0",
55
+ "webpack": "^5.79.0",
56
+ "webpack-cli": "^5.0.1",
57
+ "webpack-dev-server": "^4.13.3"
58
+ }
59
+ }
sd-3dmodel-loader/poses/kneel.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"poses":[{"name":"pose1","poseData":[{"boneName":"hips","x":0,"y":0,"z":0},{"boneName":"spine","x":0.2827433388230814,"y":0,"z":0},{"boneName":"chest","x":0,"y":0,"z":0},{"boneName":"upperChest","x":0,"y":0,"z":0},{"boneName":"neck","x":-0.3141592653589793,"y":-0.06283185307179587,"z":-0.2827433388230814},{"boneName":"head","x":0,"y":0,"z":0},{"boneName":"leftShoulder","x":0,"y":0,"z":0},{"boneName":"leftUpperArm","x":0.18849555921538758,"y":-1.5707963267948966,"z":-0.8796459430051422},{"boneName":"leftLowerArm","x":0,"y":-0.37699111843077515,"z":-0.031415926535897934},{"boneName":"leftHand","x":-0.12566370614359174,"y":-0.031415926535897934,"z":0},{"boneName":"leftThumbMetacarpal","x":0,"y":0,"z":0},{"boneName":"leftThumbProximal","x":0,"y":0,"z":0},{"boneName":"leftThumbDistal","x":0,"y":0,"z":0},{"boneName":"leftIndexProximal","x":0,"y":0,"z":0},{"boneName":"leftIndexIntermediate","x":0,"y":0,"z":0},{"boneName":"leftIndexDistal","x":0,"y":0,"z":0},{"boneName":"leftMiddleProximal","x":0,"y":0,"z":0},{"boneName":"leftMiddleIntermediate","x":0,"y":0,"z":0},{"boneName":"leftMiddleDistal","x":0,"y":0,"z":0},{"boneName":"leftRingProximal","x":0,"y":0,"z":0},{"boneName":"leftRingIntermediate","x":0,"y":0,"z":0},{"boneName":"leftRingDistal","x":0,"y":0,"z":0},{"boneName":"leftLittleProximal","x":0,"y":0,"z":0},{"boneName":"leftLittleIntermediate","x":0,"y":0,"z":0},{"boneName":"leftLittleDistal","x":0,"y":0,"z":0},{"boneName":"rightShoulder","x":0,"y":0,"z":0},{"boneName":"rightUpperArm","x":-0.09424777960769379,"y":1.5707963267948966,"z":1.0367255756846319},{"boneName":"rightLowerArm","x":0,"y":0.4084070449666731,"z":0},{"boneName":"rightHand","x":0,"y":0,"z":0},{"boneName":"rightLittleProximal","x":0,"y":0,"z":0},{"boneName":"rightLittleIntermediate","x":0,"y":0,"z":0},{"boneName":"rightLittleDistal","x":0,"y":0,"z":0},{"boneName":"rightRingProximal","x":0,"y":0,"z":0},{"boneName":"rightRingIntermediate","x":0,"y":0,"z":0},{"boneName":"rightRingDistal","x":0,"y":0,"z":0},{"boneName":"rightMiddleProximal","x":0,"y":0,"z":0},{"boneName":"rightMiddleIntermediate","x":0,"y":0,"z":0},{"boneName":"rightMiddleDistal","x":0,"y":0,"z":0},{"boneName":"rightIndexProximal","x":0,"y":0,"z":0},{"boneName":"rightIndexIntermediate","x":0,"y":0,"z":0},{"boneName":"rightIndexDistal","x":0,"y":0,"z":0},{"boneName":"rightThumbMetacarpal","x":0,"y":0,"z":0},{"boneName":"rightThumbProximal","x":0,"y":0,"z":0},{"boneName":"rightThumbDistal","x":0,"y":0,"z":0},{"boneName":"leftUpperLeg","x":-0.7853981633974483,"y":-0.37699111843077515,"z":-0.18849555921538758},{"boneName":"leftLowerLeg","x":2.199114857512855,"y":0.031415926535897934,"z":-0.031415926535897934},{"boneName":"leftFoot","x":0.6283185307179586,"y":0.15707963267948966,"z":0.031415926535897934},{"boneName":"leftToes","x":0,"y":0,"z":0},{"boneName":"rightUpperLeg","x":-0.8482300164692442,"y":0.3141592653589793,"z":0},{"boneName":"rightLowerLeg","x":2.199114857512855,"y":-0.5340707511102649,"z":-0.15707963267948966},{"boneName":"rightFoot","x":0.6283185307179586,"y":-0.031415926535897934,"z":0.12566370614359174},{"boneName":"rightToes","x":0,"y":0,"z":0}]},{"name":"pose2","poseData":[{"boneName":"hips","x":0,"y":0,"z":0},{"boneName":"spine","x":0.3141592653589793,"y":-0.12566370614359174,"z":-0.15707963267948966},{"boneName":"chest","x":0,"y":0,"z":0},{"boneName":"upperChest","x":0,"y":0,"z":0},{"boneName":"neck","x":-0.5340707511102649,"y":0,"z":0},{"boneName":"head","x":0,"y":0,"z":0},{"boneName":"leftShoulder","x":0,"y":0,"z":0},{"boneName":"leftUpperArm","x":-0.25132741228718347,"y":0.4084070449666731,"z":-0.9424777960769379},{"boneName":"leftLowerArm","x":-0.4084070449666731,"y":0,"z":-1.2566370614359172},{"boneName":"leftHand","x":-0.47123889803846897,"y":0,"z":-0.3141592653589793},{"boneName":"leftThumbMetacarpal","x":0,"y":0,"z":0},{"boneName":"leftThumbProximal","x":0,"y":0,"z":0},{"boneName":"leftThumbDistal","x":0,"y":0,"z":0},{"boneName":"leftIndexProximal","x":0,"y":0,"z":0},{"boneName":"leftIndexIntermediate","x":0,"y":0,"z":0},{"boneName":"leftIndexDistal","x":0,"y":0,"z":0},{"boneName":"leftMiddleProximal","x":0,"y":0,"z":0},{"boneName":"leftMiddleIntermediate","x":0,"y":0,"z":0},{"boneName":"leftMiddleDistal","x":0,"y":0,"z":0},{"boneName":"leftRingProximal","x":0,"y":0,"z":0},{"boneName":"leftRingIntermediate","x":0,"y":0,"z":0},{"boneName":"leftRingDistal","x":0,"y":0,"z":0},{"boneName":"leftLittleProximal","x":0,"y":0,"z":0},{"boneName":"leftLittleIntermediate","x":0,"y":0,"z":0},{"boneName":"leftLittleDistal","x":0,"y":0,"z":0},{"boneName":"rightShoulder","x":0,"y":0,"z":0},{"boneName":"rightUpperArm","x":-0.21991148575128555,"y":0.25132741228718347,"z":1.2566370614359172},{"boneName":"rightLowerArm","x":0.031415926535897934,"y":-0.031415926535897934,"z":0.34557519189487723},{"boneName":"rightHand","x":0,"y":0,"z":0},{"boneName":"rightLittleProximal","x":0,"y":0,"z":0},{"boneName":"rightLittleIntermediate","x":0,"y":0,"z":0},{"boneName":"rightLittleDistal","x":0,"y":0,"z":0},{"boneName":"rightRingProximal","x":0,"y":0,"z":0},{"boneName":"rightRingIntermediate","x":0,"y":0,"z":0},{"boneName":"rightRingDistal","x":0,"y":0,"z":0},{"boneName":"rightMiddleProximal","x":0,"y":0,"z":0},{"boneName":"rightMiddleIntermediate","x":0,"y":0,"z":0},{"boneName":"rightMiddleDistal","x":0,"y":0,"z":0},{"boneName":"rightIndexProximal","x":0,"y":0,"z":0},{"boneName":"rightIndexIntermediate","x":0,"y":0,"z":0},{"boneName":"rightIndexDistal","x":0,"y":0,"z":0},{"boneName":"rightThumbMetacarpal","x":0,"y":0,"z":0},{"boneName":"rightThumbProximal","x":0,"y":0,"z":0},{"boneName":"rightThumbDistal","x":0,"y":0,"z":0},{"boneName":"leftUpperLeg","x":-0.25132741228718347,"y":-0.06283185307179587,"z":0.47123889803846897},{"boneName":"leftLowerLeg","x":1.7278759594743864,"y":0.5654866776461628,"z":0},{"boneName":"leftFoot","x":0.6283185307179586,"y":-0.09424777960769379,"z":0},{"boneName":"leftToes","x":0,"y":0,"z":0},{"boneName":"rightUpperLeg","x":-0.34557519189487723,"y":-0.06283185307179587,"z":-0.34557519189487723},{"boneName":"rightLowerLeg","x":2.1362830044410597,"y":0,"z":0.031415926535897934},{"boneName":"rightFoot","x":-0.47123889803846897,"y":0,"z":0},{"boneName":"rightToes","x":0,"y":0,"z":0}]}]}
sd-3dmodel-loader/public/favicon.ico ADDED
sd-3dmodel-loader/public/index.html ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <title>React Three.js App</title>
7
+ </head>
8
+ <body>
9
+ <div id="sd-3d-model-loader-container"></div>
10
+ <script src="../js/3d-model-loader.bundle.js"></script>
11
+ <script>
12
+ create3dmodelLoaderApp(document.getElementById('sd-3d-model-loader-container'), 0);
13
+ </script>
14
+ </body>
15
+ </html>
sd-3dmodel-loader/public/logo192.png ADDED
sd-3dmodel-loader/public/logo512.png ADDED
sd-3dmodel-loader/public/manifest.json ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "short_name": "React App",
3
+ "name": "Create React App Sample",
4
+ "icons": [
5
+ {
6
+ "src": "favicon.ico",
7
+ "sizes": "64x64 32x32 24x24 16x16",
8
+ "type": "image/x-icon"
9
+ },
10
+ {
11
+ "src": "logo192.png",
12
+ "type": "image/png",
13
+ "sizes": "192x192"
14
+ },
15
+ {
16
+ "src": "logo512.png",
17
+ "type": "image/png",
18
+ "sizes": "512x512"
19
+ }
20
+ ],
21
+ "start_url": ".",
22
+ "display": "standalone",
23
+ "theme_color": "#000000",
24
+ "background_color": "#ffffff"
25
+ }
sd-3dmodel-loader/public/robots.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # https://www.robotstxt.org/robotstxt.html
2
+ User-agent: *
3
+ Disallow:
sd-3dmodel-loader/scripts/__pycache__/main.cpython-310.pyc ADDED
Binary file (3.38 kB). View file
 
sd-3dmodel-loader/scripts/main.py ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ import modules.scripts as scripts
4
+ from modules import script_callbacks
5
+ from modules import shared
6
+ from modules.shared import opts
7
+ from modules import extensions
8
+
9
+ import os
10
+
11
+
12
+ class Script(scripts.Script):
13
+ def __init__(self) -> None:
14
+ super().__init__()
15
+
16
+ def title(self):
17
+ return "3D Model&Pose Loader"
18
+
19
+ def show(self, is_img2img):
20
+ return scripts.AlwaysVisible
21
+
22
+ def ui(self, is_img2img):
23
+ return ()
24
+
25
+
26
+ def on_ui_tabs():
27
+ with gr.Blocks(analytics_enabled=False) as threeDModel_loader:
28
+ with gr.Row():
29
+ gr.HTML('<div id="threeDModelLoader-container"></div>')
30
+
31
+ import_id = 'WebGL-output-3dmodel-import'
32
+
33
+ ext = get_self_extension()
34
+
35
+ try:
36
+ control_net_num = opts.control_net_max_models_num
37
+ except:
38
+ control_net_num = 0
39
+
40
+ gr.HTML(f'<input type="hidden" id="threeDModelLoader-control-net-num" value="{control_net_num}" />', visible=False)
41
+
42
+ if ext is None:
43
+ return []
44
+ js_ = [f'{x.path}?{os.path.getmtime(x.path)}' for x in ext.list_files('javascript/lazyload', '.js')]
45
+ js_.insert(0, ext.path)
46
+
47
+ gr.HTML(value='\n'.join(js_), elem_id=import_id, visible=False)
48
+
49
+ return [(threeDModel_loader, "3D Model&Pose Loader", "3dmodel_loador")]
50
+
51
+
52
+ def get_self_extension():
53
+ if '__file__' in globals():
54
+ filepath = __file__
55
+ else:
56
+ import inspect
57
+ filepath = inspect.getfile(lambda: None)
58
+ for ext in extensions.active():
59
+ if ext.path in filepath:
60
+ return ext
61
+
62
+
63
+ def on_ui_settings():
64
+ section = ('3dmodel', "3D Model&Pose")
65
+ shared.opts.add_option("threeDmodel_bg_color", shared.OptionInfo(
66
+ "#ffffff", "Canvas Background Color", gr.ColorPicker, {"interactive": True}, section=section))
67
+ shared.opts.add_option("threeDmodel_ground_color", shared.OptionInfo(
68
+ "#ffffff", "Canvas Ground Color", gr.ColorPicker, {"interactive": True}, section=section))
69
+ shared.opts.add_option("threeDmodel_canvas_width", shared.OptionInfo(
70
+ 512, "Canvas Width", gr.Slider, {"minimum": 64, "maximum": 2048, "step": 64, "interactive": True},
71
+ section=section))
72
+ shared.opts.add_option("threeDmodel_canvas_height", shared.OptionInfo(
73
+ 512, "Canvas Height", gr.Slider, {"minimum": 64, "maximum": 2048, "step": 64, "interactive": True},
74
+ section=section))
75
+ shared.opts.add_option("threeDmodel_has_ground", shared.OptionInfo(
76
+ True, "Show Ground", gr.Checkbox, {"interactive": True}, section=section))
77
+ shared.opts.add_option("threeDmodel_has_ground_grid", shared.OptionInfo(
78
+ True, "Show Grid", gr.Checkbox, {"interactive": True}, section=section))
79
+ shared.opts.add_option("threeDmodel_has_axis", shared.OptionInfo(
80
+ True, "Show Axis", gr.Checkbox, {"interactive": True}, section=section))
81
+
82
+
83
+ script_callbacks.on_ui_tabs(on_ui_tabs)
84
+ script_callbacks.on_ui_settings(on_ui_settings)
sd-3dmodel-loader/src/AnimationPanel.js ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import React, {useState} from 'react';
2
+ import Slider from '@mui/material/Slider';
3
+ import Box from '@mui/material/Box';
4
+ import {Accordion, AccordionSummary, AccordionDetails, Button} from '@mui/material';
5
+ import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
6
+
7
+ let _animationProgress;
8
+
9
+ export function setAnimationProgress(animationProgress) {
10
+ _animationProgress = animationProgress;
11
+
12
+ //TODO need update progress bar here
13
+ }
14
+
15
+ function AnimationPanel({setAnimationPlaying, setAnimationStopPlaying, controlAnimation}) {
16
+ const [value, setValue] = useState(0);
17
+
18
+ return (
19
+ <div>
20
+ <Box mb={1} mt={1}>
21
+ <Accordion>
22
+ <AccordionSummary expandIcon={<ExpandMoreIcon/>}>
23
+ Animation
24
+ </AccordionSummary>
25
+ <AccordionDetails>
26
+ <Button variant="contained" color="primary" fullWidth sx={{margin: '2px'}} onClick={() => {
27
+ if (setAnimationPlaying) {
28
+ setAnimationPlaying();
29
+ }
30
+ }}>Play/Pause</Button>
31
+ <Button variant="contained" color="primary" fullWidth sx={{margin: '2px'}}
32
+ onClick={setAnimationStopPlaying}>Stop</Button>
33
+ <Box width="100%">
34
+ <Slider min={0} max={100}
35
+ value={value}
36
+ onChange={(event, newValue) => {
37
+ setValue(newValue);
38
+ controlAnimation(newValue);
39
+ }}
40
+ aria-labelledby="continuous-slider"
41
+ />
42
+ </Box>
43
+ </AccordionDetails>
44
+ </Accordion>
45
+ </Box>
46
+ </div>
47
+ );
48
+ }
49
+
50
+ export default AnimationPanel;
sd-3dmodel-loader/src/CameraPanel.js ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import React, {useState} from 'react';
2
+ import Slider from '@mui/material/Slider';
3
+ import Box from '@mui/material/Box';
4
+ import {Accordion, AccordionSummary, AccordionDetails, Typography} from '@mui/material';
5
+ import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
6
+
7
+ function CameraPanel({setCameraNear, setCameraFar, setCameraFOV}) {
8
+ const [far, setFar] = useState(1000);
9
+ const [near, setNear] = useState(0.1);
10
+ const [fov, setFOV] = useState(45);
11
+
12
+ return (<div>
13
+ <Box mb={1} mt={1}>
14
+ <Accordion>
15
+ <AccordionSummary expandIcon={<ExpandMoreIcon/>}>
16
+ Camera
17
+ </AccordionSummary>
18
+ <AccordionDetails>
19
+ <Box width="100%">
20
+ <Typography gutterBottom>Near</Typography>
21
+ <Slider min={0.1} max={100}
22
+ valueLabelDisplay="auto"
23
+ step={0.1}
24
+ value={near}
25
+ onChange={(event, newValue) => {
26
+ setNear(newValue);
27
+ setCameraNear(newValue);
28
+ }}
29
+ aria-labelledby="continuous-slider"
30
+ />
31
+ <Typography gutterBottom>Far</Typography>
32
+ <Slider min={0.1} max={20000}
33
+ valueLabelDisplay="auto"
34
+ value={far}
35
+ onChange={(event, newValue) => {
36
+ setFar(newValue);
37
+ setCameraFar(newValue)
38
+ }}
39
+ aria-labelledby="continuous-slider"
40
+ />
41
+ <Typography gutterBottom>FOV</Typography>
42
+ <Slider min={1} max={100}
43
+ valueLabelDisplay="auto"
44
+ value={fov}
45
+ onChange={(event, newValue) => {
46
+ setFOV(newValue);
47
+ setCameraFOV(newValue);
48
+ }}
49
+ aria-labelledby="continuous-slider"
50
+ />
51
+ </Box>
52
+ </AccordionDetails>
53
+ </Accordion>
54
+ </Box>
55
+ </div>);
56
+ }
57
+
58
+ export default CameraPanel;
sd-3dmodel-loader/src/CanvasSettingsPanel.js ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import React, {useState} from 'react';
2
+ import FormControlLabel from '@mui/material/FormControlLabel';
3
+ import Checkbox from '@mui/material/Checkbox';
4
+ import {SketchPicker} from 'react-color';
5
+ import {Accordion, AccordionSummary, AccordionDetails} from '@mui/material';
6
+ import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
7
+ import Box from '@mui/material/Box';
8
+
9
+ function CanvasSettingsPanel({setCanvasBgColor, setCanvasGround, setCanvasGrid, setCanvasAxis}) {
10
+ const [bgColorChecked, setBgColorChecked] = useState(false);
11
+ const [bgColor, setBgColor] = useState();
12
+ const [groundChecked, setGroundChecked] = useState(true);
13
+ const [axisChecked, setAxisChecked] = useState(true);
14
+ const [gridChecked, setGridChecked] = useState(true);
15
+
16
+ return (
17
+ <div>
18
+ <Box mb={1} mt={1}>
19
+ <Accordion>
20
+ <AccordionSummary expandIcon={<ExpandMoreIcon/>}>
21
+ Canvas
22
+ </AccordionSummary>
23
+ <AccordionDetails>
24
+ <FormControlLabel
25
+ control={
26
+ <Checkbox
27
+ checked={bgColorChecked}
28
+ onChange={(event) => {
29
+ setBgColorChecked(event.target.checked);
30
+ }}
31
+ color="primary"
32
+ />
33
+ }
34
+ label={'Background Color'}
35
+ />
36
+ {bgColorChecked && (
37
+ <SketchPicker
38
+ color={bgColor}
39
+ onChangeComplete={(color) => {
40
+ setBgColor(color);
41
+ setCanvasBgColor(color);
42
+ }}
43
+ disableAlpha={true}
44
+ />
45
+ )}
46
+ <FormControlLabel
47
+ control={
48
+ <Checkbox
49
+ checked={groundChecked}
50
+ onChange={(event) => {
51
+ setGroundChecked(event.target.checked);
52
+
53
+ if (setCanvasGround) {
54
+ setCanvasGround(event.target.checked);
55
+ }
56
+ }}
57
+ color="primary"
58
+ />
59
+ }
60
+ label='Ground'
61
+ />
62
+ <FormControlLabel
63
+ control={
64
+ <Checkbox
65
+ checked={gridChecked}
66
+ onChange={(event) => {
67
+ setGridChecked(event.target.checked);
68
+ setCanvasGrid(event.target.checked)
69
+ }}
70
+ color="primary"
71
+ />
72
+ }
73
+ label='Grid'
74
+ />
75
+ <FormControlLabel
76
+ control={
77
+ <Checkbox
78
+ checked={axisChecked}
79
+ onChange={(event) => {
80
+ setAxisChecked(event.target.checked);
81
+ setCanvasAxis(event.target.checked)
82
+ }}
83
+ color="primary"
84
+ />
85
+ }
86
+ label='Axis'
87
+ />
88
+ </AccordionDetails>
89
+ </Accordion>
90
+ </Box>
91
+ </div>
92
+ );
93
+ }
94
+
95
+ export default CanvasSettingsPanel;
sd-3dmodel-loader/src/ModelPanel.js ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import React from 'react';
2
+ import {Accordion, AccordionSummary, AccordionDetails} from '@mui/material';
3
+ import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
4
+ import Box from '@mui/material/Box';
5
+ import {Button} from "@mui/material";
6
+
7
+ export default function ModelPanel({setUploadedModelFile}) {
8
+ const loadSingleModel = () => {
9
+ const input = document.createElement("input");
10
+
11
+ input.type = "file";
12
+ input.accept = ".obj, .stl, .fbx, .gltf, .glb, .dae, .vrm";
13
+
14
+ input.addEventListener("change", function (e) {
15
+ const file = e.target.files[0];
16
+
17
+ if (setUploadedModelFile) {
18
+ setUploadedModelFile(file);
19
+ }
20
+ });
21
+
22
+ input.click();
23
+ };
24
+
25
+ return (
26
+ <div>
27
+ <Box mb={1} mt={1}>
28
+ <Accordion>
29
+ <AccordionSummary expandIcon={<ExpandMoreIcon/>}>
30
+ Model
31
+ </AccordionSummary>
32
+ <AccordionDetails>
33
+ <Button variant="contained" color="primary" fullWidth sx={{margin: '2px'}}
34
+ onClick={loadSingleModel}>Load Model</Button>
35
+ </AccordionDetails>
36
+ </Accordion>
37
+ </Box>
38
+ </div>
39
+ );
40
+ }
sd-3dmodel-loader/src/NumberInput.js ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import React, {useState} from "react";
2
+ import {
3
+ Button,
4
+ TextField
5
+ } from '@mui/material';
6
+
7
+ const NumberInput = () => {
8
+ const [value, setValue] = useState(0);
9
+
10
+ const handleDecrease = () => {
11
+ setValue(value - 1);
12
+ };
13
+
14
+ const handleIncrease = () => {
15
+ setValue(value + 1);
16
+ };
17
+
18
+ const handleChange = (event) => {
19
+ const newValue = parseInt(event.target.value);
20
+ if (!isNaN(newValue)) {
21
+ setValue(newValue);
22
+ }
23
+ };
24
+
25
+ const containerStyle = {
26
+ display: "flex",
27
+ justifyContent: "space-between",
28
+ alignItems: "center"
29
+ };
30
+
31
+ return (
32
+ <div style={containerStyle}>
33
+ <Button onClick={handleDecrease}>-</Button>
34
+ <TextField value={value} onChange={handleChange}/>
35
+ <Button onClick={handleIncrease}>+</Button>
36
+ </div>
37
+ );
38
+ };
39
+
40
+ export default NumberInput;
sd-3dmodel-loader/src/PosePanel.js ADDED
@@ -0,0 +1,434 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import React, {createContext, useContext, useEffect, useRef, useState} from 'react';
2
+ import {
3
+ Accordion,
4
+ AccordionSummary,
5
+ AccordionDetails, FormControl, FormLabel, RadioGroup, FormControlLabel, Radio,
6
+ } from '@mui/material';
7
+ import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
8
+ import Box from '@mui/material/Box';
9
+ import {Button} from "@mui/material";
10
+ import {TreeItem, TreeView} from "@mui/lab";
11
+ import ChevronRightIcon from "@mui/icons-material/ChevronRight";
12
+
13
+
14
+ const ObjectContext = createContext([]);
15
+
16
+ function useObjectUpdate() {
17
+ const context = useContext(ObjectContext);
18
+
19
+ if (!context) {
20
+ throw new Error('useObjectUpdate must be used within ObjectProvider');
21
+ }
22
+
23
+ return context;
24
+ }
25
+
26
+ function ObjectProvider({children}) {
27
+ const [objects, setObjects] = useState([]);
28
+
29
+ const updateObjects = (newObjects) => {
30
+ setObjects(newObjects);
31
+ };
32
+
33
+ return (<ObjectContext.Provider value={{objects, updateObjects}}>
34
+ {children}
35
+ </ObjectContext.Provider>);
36
+ }
37
+
38
+ function processNode(node, handlePoseSelectedObject, setSelectedObj, transformControlMap) {
39
+ if (!node) {
40
+ return null;
41
+ }
42
+
43
+ return (<TreeItem key={node.name} nodeId={node.name} label={node.name} onClick={(objEvent) => {
44
+ const objName = objEvent.target.innerHTML;
45
+
46
+ setSelectedObj(objName);
47
+
48
+ handlePoseSelectedObject(objName, transformControlMap[objName]);
49
+ }}>
50
+ {node.children && node.children.map((child) => processNode(child, handlePoseSelectedObject, setSelectedObj, transformControlMap))}
51
+
52
+ </TreeItem>);
53
+ }
54
+
55
+ const boneNameTransformMap = {
56
+ 'hips': "none",
57
+ 'spine': "none",
58
+ 'chest': "none",
59
+ 'upperChest': "none",
60
+ 'neck': "none",
61
+ 'head': "none",
62
+ 'leftShoulder': "none",
63
+ 'leftUpperArm': "none",
64
+ 'leftLowerArm': "none",
65
+ 'leftHand': "none",
66
+ 'leftThumbMetacarpal': "none",
67
+ 'leftThumbProximal': "none",
68
+ 'leftThumbDistal': "none",
69
+ 'leftIndexProximal': "none",
70
+ 'leftIndexIntermediate': "none",
71
+ 'leftIndexDistal': "none",
72
+ 'leftMiddleProximal': "none",
73
+ 'leftMiddleIntermediate': "none",
74
+ 'leftMiddleDistal': "none",
75
+ 'leftRingProximal': "none",
76
+ 'leftRingIntermediate': "none",
77
+ 'leftRingDistal': "none",
78
+ 'leftLittleProximal': "none",
79
+ 'leftLittleIntermediate': "none",
80
+ 'leftLittleDistal': "none",
81
+ 'rightShoulder': "none",
82
+ 'rightUpperArm': "none",
83
+ 'rightLowerArm': "none",
84
+ 'rightHand': "none",
85
+ 'rightLittleProximal': "none",
86
+ 'rightLittleIntermediate': "none",
87
+ 'rightLittleDistal': "none",
88
+ 'rightRingProximal': "none",
89
+ 'rightRingIntermediate': "none",
90
+ 'rightRingDistal': "none",
91
+ 'rightMiddleProximal': "none",
92
+ 'rightMiddleIntermediate': "none",
93
+ 'rightMiddleDistal': "none",
94
+ 'rightIndexProximal': "none",
95
+ 'rightIndexIntermediate': "none",
96
+ 'rightIndexDistal': "none",
97
+ 'rightThumbMetacarpal': "none",
98
+ 'rightThumbProximal': "none",
99
+ 'rightThumbDistal': "none",
100
+ 'leftUpperLeg': "none",
101
+ 'leftLowerLeg': "none",
102
+ 'leftFoot': "none",
103
+ 'leftToes': "none",
104
+ 'rightUpperLeg': "none",
105
+ 'rightLowerLeg': "none",
106
+ 'rightFoot': "none",
107
+ 'rightToes': "none"
108
+ };
109
+
110
+ const boneNameList = {
111
+ "name": "body",
112
+ "children": [
113
+ {
114
+ "name": "mainBody",
115
+ "children": [
116
+ {
117
+ "name": "hips",
118
+ },
119
+ {
120
+ "name": "spine",
121
+ },
122
+ {
123
+ "name": "chest",
124
+ },
125
+ {
126
+ "name": "upperChest",
127
+ },
128
+ {
129
+ "name": "head",
130
+ }
131
+ ]
132
+ },
133
+ {
134
+ "name": "leftArm",
135
+ "children": [
136
+ {
137
+ "name": "leftShoulder",
138
+ },
139
+ {
140
+ "name": "leftUpperArm",
141
+ },
142
+ {
143
+ "name": "leftLowerArm",
144
+ },
145
+ {
146
+ "name": "leftHand",
147
+ "children": [
148
+ {
149
+ "name": "leftThumb",
150
+ "children": [
151
+ {
152
+ "name": "leftThumbMetacarpal",
153
+ },
154
+ {
155
+ "name": "leftThumbProximal",
156
+ },
157
+ {
158
+ "name": "leftThumbDistal",
159
+ },
160
+ ]
161
+ },
162
+ {
163
+ "name": "leftIndex",
164
+ "children": [
165
+ {
166
+ "name": "leftIndexProximal",
167
+ },
168
+ {
169
+ "name": "leftIndexIntermediate",
170
+ },
171
+ {
172
+ "name": "leftIndexDistal",
173
+ },
174
+ ]
175
+ },
176
+ {
177
+ "name": "leftMiddle",
178
+ "children": [
179
+ {
180
+ "name": "leftMiddleProximal",
181
+ },
182
+ {
183
+ "name": "leftMiddleIntermediate",
184
+ },
185
+ {
186
+ "name": "leftMiddleDistal",
187
+ },
188
+ ]
189
+ },
190
+ {
191
+ "name": "leftRing",
192
+ "children": [
193
+ {
194
+ "name": "leftRingProximal",
195
+ },
196
+ {
197
+ "name": "leftRingIntermediate",
198
+ },
199
+ {
200
+ "name": "leftRingDistal",
201
+ },
202
+ ]
203
+ },
204
+ {
205
+ "name": "leftLittle",
206
+ "children": [
207
+ {
208
+ "name": "leftLittleProximal",
209
+ },
210
+ {
211
+ "name": "leftLittleIntermediate",
212
+ },
213
+ {
214
+ "name": "leftLittleDistal",
215
+ }
216
+ ]
217
+ },
218
+ ]
219
+ },
220
+ ]
221
+ },
222
+ {
223
+ "name": "rightArm",
224
+ "children": [
225
+ {
226
+ "name": "rightShoulder",
227
+ },
228
+ {
229
+ "name": "rightUpperArm",
230
+ },
231
+ {
232
+ "name": "rightLowerArm",
233
+ },
234
+ {
235
+ "name": "rightHand",
236
+ "children": [
237
+ {
238
+ "name": "rightThumb",
239
+ "children": [
240
+ {
241
+ "name": "rightThumbMetacarpal",
242
+ },
243
+ {
244
+ "name": "rightThumbProximal",
245
+ },
246
+ {
247
+ "name": "rightThumbDistal",
248
+ },
249
+ ]
250
+ },
251
+ {
252
+ "name": "rightIndex",
253
+ "children": [
254
+ {
255
+ "name": "rightIndexProximal",
256
+ },
257
+ {
258
+ "name": "rightIndexIntermediate",
259
+ },
260
+ {
261
+ "name": "rightIndexDistal",
262
+ },
263
+ ]
264
+ },
265
+ {
266
+ "name": "rightMiddle",
267
+ "children": [
268
+ {
269
+ "name": "rightMiddleProximal",
270
+ },
271
+ {
272
+ "name": "rightMiddleIntermediate",
273
+ },
274
+ {
275
+ "name": "rightMiddleDistal",
276
+ },
277
+ ]
278
+ },
279
+ {
280
+ "name": "rightRing",
281
+ "children": [
282
+ {
283
+ "name": "rightRingProximal",
284
+ },
285
+ {
286
+ "name": "rightRingIntermediate",
287
+ },
288
+ {
289
+ "name": "rightRingDistal",
290
+ },
291
+ ]
292
+ },
293
+ {
294
+ "name": "rightLittle",
295
+ "children": [
296
+ {
297
+ "name": "rightLittleProximal",
298
+ },
299
+ {
300
+ "name": "rightLittleIntermediate",
301
+ },
302
+ {
303
+ "name": "rightLittleDistal",
304
+ },
305
+ ]
306
+ }
307
+ ]
308
+ },
309
+ ]
310
+ },
311
+ {
312
+ "name": "leftLeg",
313
+ "children": [
314
+ {
315
+ "name": "leftUpperLeg",
316
+ },
317
+ {
318
+ "name": "leftLowerLeg",
319
+ },
320
+ {
321
+ "name": "leftFoot",
322
+ },
323
+ {
324
+ "name": "leftToes",
325
+ }
326
+ ]
327
+ },
328
+ {
329
+ "name": "rightLeg",
330
+ "children": [
331
+ {
332
+ "name": "rightUpperLeg",
333
+ },
334
+ {
335
+ "name": "rightLowerLeg",
336
+ },
337
+ {
338
+ "name": "rightFoot",
339
+ },
340
+ {
341
+ "name": "rightToes",
342
+ }
343
+ ]
344
+ }
345
+ ]
346
+ }
347
+
348
+ function BodyTree({handlePoseSelectedObject, setSelectedObj, transformControlMap}) {
349
+ return (<TreeView
350
+ defaultCollapseIcon={<ExpandMoreIcon/>}
351
+ defaultExpandIcon={<ChevronRightIcon/>}
352
+ defaultEndIcon={<div/>}
353
+ >
354
+ {processNode(boneNameList, handlePoseSelectedObject, setSelectedObj, transformControlMap)}
355
+ </TreeView>);
356
+ }
357
+
358
+ export default function PosePanel({
359
+ setPoseModelFileName,
360
+ handlePoseSelectedObject,
361
+ }) {
362
+ return (<ObjectProvider>
363
+ <BodyTreeWrapper setPoseModelFileName={setPoseModelFileName}
364
+ handlePoseSelectedObject={handlePoseSelectedObject}/>
365
+ </ObjectProvider>)
366
+ }
367
+
368
+ function BodyTreeWrapper({
369
+ setPoseModelFileName,
370
+ handlePoseSelectedObject
371
+ }) {
372
+ const [selectedObj, setSelectedObj] = useState(null);
373
+
374
+ const loadPoseModel = () => {
375
+ setPoseModelFileName("pose.vrm");
376
+ };
377
+
378
+ const {updateObjects} = useObjectUpdate();
379
+ const [transformControlMap, setTransformControlMap] = useState(boneNameTransformMap);
380
+
381
+ const updateObjectsRef = useRef();
382
+
383
+ updateObjectsRef.current = updateObjects;
384
+
385
+ useEffect(() => {
386
+ window.updateObjects = (newObjects) => {
387
+ if (updateObjectsRef.current) {
388
+ updateObjectsRef.current(newObjects);
389
+ }
390
+ };
391
+ return () => {
392
+ window.updateObjects = null;
393
+ };
394
+ }, []);
395
+
396
+ return (<div>
397
+ <Box mb={1} mt={1}>
398
+ <Accordion>
399
+ <AccordionSummary expandIcon={<ExpandMoreIcon/>}>
400
+ Pose
401
+ </AccordionSummary>
402
+ <AccordionDetails>
403
+ <Button variant="contained" color="primary" fullWidth sx={{margin: '2px'}}
404
+ onClick={loadPoseModel}>Load Pose Model (VRM)</Button>
405
+ <div><h6>Pose edit only supports VRM file currently.</h6></div>
406
+ <BodyTree handlePoseSelectedObject={handlePoseSelectedObject} setSelectedObj={setSelectedObj} transformControlMap={transformControlMap}/>
407
+ { (selectedObj in boneNameTransformMap) && <FormControl>
408
+ <FormLabel>Operate</FormLabel>
409
+ <RadioGroup
410
+ aria-labelledby="operate-radio-buttons-group-label"
411
+ defaultValue="none"
412
+ name="operate-radio-buttons-group"
413
+ row={true}
414
+ onChange={(event) => {
415
+ handlePoseSelectedObject(selectedObj, event.target.value);
416
+
417
+ const updatedMap = {...transformControlMap};
418
+
419
+ updatedMap[selectedObj] = event.target.value;
420
+
421
+ setTransformControlMap(updatedMap);
422
+ }}
423
+ >
424
+ <FormControlLabel value="none" control={<Radio/>} label="None"
425
+ checked={transformControlMap[selectedObj] === "none"}/>
426
+ <FormControlLabel value="rotate" control={<Radio/>} label="Rotate"
427
+ checked={transformControlMap[selectedObj] === "rotate"}/>
428
+ </RadioGroup>
429
+ </FormControl>}
430
+ </AccordionDetails>
431
+ </Accordion>
432
+ </Box>
433
+ </div>);
434
+ }
sd-3dmodel-loader/src/ScenePanel.js ADDED
@@ -0,0 +1,262 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import React, {createContext, useContext, useState, useEffect, useRef} from 'react';
2
+ import {TreeView, TreeItem} from '@mui/lab';
3
+ import {styled} from '@mui/system';
4
+ import Box from '@mui/material/Box';
5
+ import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
6
+ import ChevronRightIcon from '@mui/icons-material/ChevronRight';
7
+ import {
8
+ Accordion,
9
+ AccordionSummary,
10
+ AccordionDetails,
11
+ Button,
12
+ FormControl,
13
+ Radio,
14
+ RadioGroup,
15
+ FormLabel,
16
+ FormControlLabel,
17
+ Typography
18
+ } from '@mui/material';
19
+ import Checkbox from "@mui/material/Checkbox";
20
+ import Slider from "@mui/material/Slider";
21
+ import {SketchPicker} from "react-color";
22
+ import NumberInput from "./NumberInput.js";
23
+
24
+ const CustomTreeView = styled(TreeView)`
25
+ height: 240px;
26
+ overflow-y: auto;
27
+ `;
28
+
29
+ const transformControlObjNames = ["Hemisphere Light", "Directional Light"];
30
+ let transformControlValues = {"Hemisphere Light": "none", "Directional Light": "none"};
31
+
32
+ const treeItemObjNames = ["Scene", "mainObject", "Hemisphere Light", "Directional Light", "Ground", "Grid", "Axis", "Preview Camera"];
33
+
34
+ const visibleControlObjNames = ["Directional Light", "Ground", "Grid", "Axis"];
35
+
36
+ let visibleValues = {"Directional Light": true, "Ground": true, "Grid": true, "Axis": true};
37
+
38
+ const ObjectContext = createContext([]);
39
+
40
+ function useObjectUpdate() {
41
+ const context = useContext(ObjectContext);
42
+
43
+ if (!context) {
44
+ throw new Error('useObjectUpdate must be used within ObjectProvider');
45
+ }
46
+
47
+ return context;
48
+ }
49
+
50
+ function ObjectProvider({children}) {
51
+ const [objects, setObjects] = useState([]);
52
+
53
+ const updateObjects = (newObjects) => {
54
+ setObjects(newObjects);
55
+ };
56
+
57
+ return (<ObjectContext.Provider value={{objects, updateObjects}}>
58
+ {children}
59
+ </ObjectContext.Provider>);
60
+ }
61
+
62
+ function processNode(node, handleSelectedObject, setSelectedObj, transformControlMap) {
63
+ if (!node) {
64
+ return null;
65
+ }
66
+
67
+ if (!(treeItemObjNames.includes(node.name) || node.name.startsWith("mainObject"))) {
68
+ return null;
69
+ }
70
+
71
+ return (<TreeItem key={node.uuid} nodeId={node.uuid} label={node.name || node.type} onClick={(objEvent) => {
72
+ const objName = objEvent.target.innerHTML;
73
+
74
+ handleSelectedObject(objName, transformControlMap[objName]);
75
+ setSelectedObj(objName);
76
+ }}>
77
+ {node.children && node.children.map((child) => processNode(child, handleSelectedObject, setSelectedObj, transformControlMap))}
78
+ </TreeItem>);
79
+ }
80
+
81
+ function ScenePanel({
82
+ refreshSceneTree,
83
+ handleSelectedObject,
84
+ setVisible,
85
+ setCameraNear,
86
+ setCameraFar,
87
+ setCameraFOV,
88
+ setCanvasBgColor,
89
+ removeObject
90
+ }) {
91
+ return (<ObjectProvider>
92
+ <SceneTreeWrapper refreshSceneTree={refreshSceneTree} handleSelectedObject={handleSelectedObject}
93
+ setVisible={setVisible}
94
+ setCameraNear={setCameraNear} setCameraFar={setCameraFar} setCameraFOV={setCameraFOV}
95
+ setCanvasBgColor={setCanvasBgColor} removeObject={removeObject}/>
96
+ </ObjectProvider>)
97
+ }
98
+
99
+ function SceneTree({handleSelectedObject, setSelectedObj, transformControlMap}) {
100
+ const {objects} = useObjectUpdate();
101
+
102
+ return (<TreeView
103
+ defaultCollapseIcon={<ExpandMoreIcon/>}
104
+ defaultExpandIcon={<ChevronRightIcon/>}
105
+ defaultEndIcon={<div/>}
106
+ >
107
+ {processNode(objects.object, handleSelectedObject, setSelectedObj, transformControlMap)}
108
+ </TreeView>);
109
+ }
110
+
111
+ function SceneTreeWrapper({
112
+ refreshSceneTree,
113
+ handleSelectedObject,
114
+ setVisible,
115
+ setCameraNear,
116
+ setCameraFar,
117
+ setCameraFOV,
118
+ setCanvasBgColor,
119
+ removeObject
120
+ }) {
121
+ const [selectedObj, setSelectedObj] = useState(null);
122
+ const [far, setFar] = useState(1000);
123
+ const [near, setNear] = useState(0.1);
124
+ const [fov, setFOV] = useState(45);
125
+ const [visibleMap, setVisibleMap] = useState(visibleValues);
126
+ const [transformControlMap, setTransformControlMap] = useState(transformControlValues);
127
+ const [bgColor, setBgColor] = useState();
128
+
129
+ const {updateObjects} = useObjectUpdate();
130
+
131
+ const updateObjectsRef = useRef();
132
+
133
+ updateObjectsRef.current = updateObjects;
134
+
135
+ useEffect(() => {
136
+ window.updateObjects = (newObjects) => {
137
+ if (updateObjectsRef.current) {
138
+ updateObjectsRef.current(newObjects);
139
+ }
140
+ };
141
+ return () => {
142
+ window.updateObjects = null;
143
+ };
144
+ }, []);
145
+
146
+ return (<div>
147
+ <Box mb={1} mt={1}>
148
+ <Accordion>
149
+ <AccordionSummary expandIcon={<ExpandMoreIcon/>}>
150
+ Scene
151
+ </AccordionSummary>
152
+ <AccordionDetails>
153
+ <SceneTree handleSelectedObject={handleSelectedObject} setSelectedObj={setSelectedObj}
154
+ transformControlMap={transformControlMap}/>
155
+ <Button variant="contained" color="primary" fullWidth sx={{margin: '2px'}}
156
+ onClick={refreshSceneTree}>Refresh Scene Tree</Button>
157
+
158
+ {(transformControlObjNames.includes(selectedObj) || (selectedObj && selectedObj.startsWith("mainObject"))) &&
159
+ <FormControl>
160
+ <FormLabel>Operate</FormLabel>
161
+ <RadioGroup
162
+ aria-labelledby="operate-radio-buttons-group-label"
163
+ defaultValue="none"
164
+ name="operate-radio-buttons-group"
165
+ row={true}
166
+ onChange={(event) => {
167
+ handleSelectedObject(selectedObj, event.target.value);
168
+
169
+ const updatedMap = {...transformControlMap};
170
+
171
+ updatedMap[selectedObj] = event.target.value;
172
+
173
+ setTransformControlMap(updatedMap);
174
+ }}
175
+ >
176
+ <FormControlLabel value="none" control={<Radio/>} label="None"
177
+ checked={transformControlMap[selectedObj] === "none" || !transformControlMap[selectedObj]}/>
178
+ <FormControlLabel value="translate" control={<Radio/>} label="Translate"
179
+ checked={transformControlMap[selectedObj] === "translate"}/>
180
+ <FormControlLabel value="rotate" control={<Radio/>} label="Rotate"
181
+ checked={transformControlMap[selectedObj] === "rotate"}/>
182
+ </RadioGroup>
183
+ </FormControl>}
184
+ {(visibleControlObjNames.includes(selectedObj) || (selectedObj && selectedObj.startsWith("mainObject"))) &&
185
+ <FormControlLabel
186
+ control={
187
+ <Checkbox
188
+ checked={visibleMap[selectedObj] || !(selectedObj in visibleMap)}
189
+ onChange={(event) => {
190
+ setVisible(selectedObj, event.target.checked);
191
+
192
+ const updatedMap = {...visibleMap};
193
+ updatedMap[selectedObj] = event.target.checked;
194
+ setVisibleMap(updatedMap);
195
+ }}
196
+ color="primary"
197
+ />
198
+ }
199
+ label='Visible'
200
+ />
201
+ }
202
+ {
203
+ selectedObj === "Preview Camera" && <Box width="100%">
204
+ <Typography gutterBottom>Near</Typography>
205
+ <Slider min={0.1} max={100}
206
+ valueLabelDisplay="auto"
207
+ step={0.1}
208
+ value={near}
209
+ onChange={(event, newValue) => {
210
+ setNear(newValue);
211
+ setCameraNear(newValue);
212
+ }}
213
+ aria-labelledby="continuous-slider"
214
+ />
215
+ <Typography gutterBottom>Far</Typography>
216
+ <Slider min={0.1} max={20000}
217
+ valueLabelDisplay="auto"
218
+ value={far}
219
+ onChange={(event, newValue) => {
220
+ setFar(newValue);
221
+ setCameraFar(newValue)
222
+ }}
223
+ aria-labelledby="continuous-slider"
224
+ />
225
+ <Typography gutterBottom>FOV</Typography>
226
+ <Slider min={1} max={100}
227
+ valueLabelDisplay="auto"
228
+ value={fov}
229
+ onChange={(event, newValue) => {
230
+ setFOV(newValue);
231
+ setCameraFOV(newValue);
232
+ }}
233
+ aria-labelledby="continuous-slider"
234
+ />
235
+ </Box>
236
+ }
237
+ {
238
+ selectedObj && selectedObj.startsWith("mainObject") &&
239
+ <Button variant="contained" color="primary" fullWidth sx={{margin: '2px'}}
240
+ onClick={() => {
241
+ removeObject(selectedObj);
242
+ refreshSceneTree();
243
+ setSelectedObj(null);
244
+ }}>Remove</Button>
245
+ }
246
+ {
247
+ selectedObj === "Scene" && <SketchPicker
248
+ color={bgColor}
249
+ onChangeComplete={(color) => {
250
+ setBgColor(color);
251
+ setCanvasBgColor(color);
252
+ }}
253
+ disableAlpha={true}
254
+ />
255
+ }
256
+ </AccordionDetails>
257
+ </Accordion>
258
+ </Box>
259
+ </div>);
260
+ }
261
+
262
+ export default ScenePanel;
sd-3dmodel-loader/src/SendToControlNetPanel.js ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import React, {useState} from 'react';
2
+ import Select from '@mui/material/Select';
3
+ import MenuItem from '@mui/material/MenuItem';
4
+ import FormControl from '@mui/material/FormControl';
5
+ import InputLabel from '@mui/material/InputLabel';
6
+ import {Accordion, AccordionSummary, AccordionDetails} from '@mui/material';
7
+ import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
8
+ import Box from '@mui/material/Box';
9
+ import {Button} from "@mui/material";
10
+ import Checkbox from "@mui/material/Checkbox";
11
+ import FormControlLabel from "@mui/material/FormControlLabel";
12
+
13
+ export default function SendToControlNetPanel({options, onValueChange, setRendererImage, sendImage, setPreviewSize}) {
14
+ const [selectedValue, setSelectedValue] = useState('');
15
+ const [sizeValue, setSizeValue] = useState('1:1');
16
+ const sizes = [
17
+ {label:"1:1", value:"1:1"},
18
+ {label:"2:3", value:"2:3"},
19
+ {label:"3:2", value:"3:2"}
20
+ ];
21
+
22
+ return (
23
+ <div>
24
+ <Box mb={1} mt={1}>
25
+ <Accordion>
26
+ <AccordionSummary expandIcon={<ExpandMoreIcon/>}>
27
+ Send To ControlNet
28
+ </AccordionSummary>
29
+ <AccordionDetails>
30
+ <FormControl variant="outlined" fullWidth sx={{margin: '2px'}}>
31
+ <InputLabel htmlFor="dropdown-list">Select an option</InputLabel>
32
+ <Select
33
+ value={selectedValue}
34
+ onChange={(event) => {
35
+ setSelectedValue(event.target.value);
36
+ if (onValueChange) {
37
+ onValueChange(event.target.value);
38
+ }
39
+ }}
40
+ label="ControlNet Index"
41
+ inputProps={{
42
+ name: 'dropdown-list',
43
+ id: 'dropdown-list',
44
+ }}
45
+ >
46
+ {options.map((option, index) => (
47
+ <MenuItem key={index} value={option.value}>
48
+ {option.label}
49
+ </MenuItem>
50
+ ))}
51
+ </Select>
52
+ </FormControl>
53
+ <FormControl variant="outlined" fullWidth sx={{margin: '2px'}}>
54
+ <InputLabel htmlFor="dropdown-list">Size</InputLabel>
55
+ <Select
56
+ value={sizeValue}
57
+ onChange={(event) => {
58
+ setSizeValue(event.target.value);
59
+ if (setPreviewSize) {
60
+ setPreviewSize(event.target.value);
61
+ }
62
+ }}
63
+ label="Size"
64
+ inputProps={{
65
+ name: 'dropdown-list',
66
+ id: 'dropdown-list',
67
+ }}
68
+ >
69
+ {sizes.map((option, index) => (
70
+ <MenuItem key={index} value={option.value}>
71
+ {option.label}
72
+ </MenuItem>
73
+ ))}
74
+ </Select>
75
+ </FormControl>
76
+ <Button variant="contained" color="primary" fullWidth sx={{margin: '2px'}} onClick={() => {
77
+ setRendererImage(sendImage, selectedValue, 'txt2img');
78
+ }}>Send to txt2img</Button>
79
+ <Button variant="contained" color="primary" fullWidth sx={{margin: '2px'}} onClick={() => {
80
+ setRendererImage(sendImage, selectedValue, 'img2img');
81
+ }}>Send to img2img</Button>
82
+ </AccordionDetails>
83
+ </Accordion>
84
+ </Box>
85
+ </div>
86
+ );
87
+ }
sd-3dmodel-loader/src/ThreeJsScene.js ADDED
@@ -0,0 +1,761 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import React, {useRef, useEffect} from 'react';
2
+ import {OrbitControls} from 'three/addons/controls/OrbitControls.js';
3
+ import * as THREE from 'three';
4
+ import {TransformControls} from 'three/examples/jsm/controls/TransformControls';
5
+ import {OBJLoader} from 'three/addons/loaders/OBJLoader.js';
6
+ import {STLLoader} from 'three/addons/loaders/STLLoader.js';
7
+ import {FBXLoader} from 'three/addons/loaders/FBXLoader.js';
8
+ import {DRACOLoader} from 'three/addons/loaders/DRACOLoader.js';
9
+ import {GLTFLoader} from 'three/addons/loaders/GLTFLoader.js';
10
+ import {ColladaLoader} from 'three/addons/loaders/ColladaLoader.js';
11
+ import {VRMLoaderPlugin, VRMUtils} from "@pixiv/three-vrm";
12
+ import {setAnimationProgress} from './AnimationPanel'
13
+
14
+ let _playing = true;
15
+ let _renderer;
16
+ let _container;
17
+ let _camera;
18
+ let _groundMesh;
19
+ let _groundGrid;
20
+ let _axis;
21
+ let _action;
22
+ let _mixer;
23
+ let _totalTime;
24
+ let _currentTime;
25
+ let _progress;
26
+ let _controlByProgressBar;
27
+ let _secondCamera;
28
+ let _scene;
29
+
30
+ let previewWidth = 300;
31
+ let previewHeight = 300;
32
+
33
+ let _width;
34
+ let _height;
35
+ let _transformControls;
36
+ let _orbitController;
37
+ let _selectedObject;
38
+ let _currentVRM;
39
+
40
+ let _mainObjectCounter = 1;
41
+
42
+ export function setPreviewSize(previewSize) {
43
+ if (previewSize === "1:1") {
44
+ previewWidth = 300;
45
+ previewHeight = 300;
46
+ } else if (previewSize === "2:3") {
47
+ previewWidth = 300;
48
+ previewHeight = 450;
49
+ } else if (previewSize === "3:2") {
50
+ previewWidth = 450;
51
+ previewHeight = 300;
52
+ }
53
+ }
54
+
55
+ export function removeObject(objName) {
56
+ const object = _scene.getObjectByName(objName);
57
+
58
+ if (object) {
59
+ _scene.remove(object);
60
+
61
+ _transformControls.detach();
62
+ }
63
+
64
+ if (_currentVRM && _currentVRM.scene.name === objName) {
65
+ _currentVRM = undefined;
66
+ }
67
+ }
68
+
69
+ export function handlePoseSelectedObject(objName, transformControlsMode) {
70
+ if (transformControlsMode && transformControlsMode !== "none") {
71
+ if (_currentVRM) {
72
+ const boneNode = _currentVRM.humanoid.getNormalizedBoneNode(objName);
73
+
74
+ if (boneNode) {
75
+ _transformControls.setMode(transformControlsMode);
76
+ _transformControls.attach(boneNode);
77
+ }
78
+ }
79
+ } else {
80
+ _transformControls.detach();
81
+ }
82
+ }
83
+
84
+ export function handleSelectedObject(objName, transformControlsMode) {
85
+ if (objName !== "Scene" && transformControlsMode && transformControlsMode !== "none") {
86
+ _selectedObject = _scene.getObjectByName(objName);
87
+
88
+ _transformControls.setMode(transformControlsMode);
89
+
90
+ _transformControls.attach(_selectedObject);
91
+ } else {
92
+ _transformControls.detach();
93
+ }
94
+ }
95
+
96
+ export function refreshSceneTree() {
97
+ window.updateObjects(convertThreeJsObjects());
98
+ }
99
+
100
+ export function setFar(far) {
101
+ _camera.far = far;
102
+ _camera.updateProjectionMatrix();
103
+ _secondCamera.far = far;
104
+ _secondCamera.updateProjectionMatrix();
105
+ }
106
+
107
+ export function setNear(near) {
108
+ _camera.near = near;
109
+ _camera.updateProjectionMatrix();
110
+ _secondCamera.near = near;
111
+ _secondCamera.updateProjectionMatrix();
112
+ }
113
+
114
+ export function setFOV(fov) {
115
+ _camera.fov = fov;
116
+ _camera.updateProjectionMatrix();
117
+ _secondCamera.fov = fov;
118
+ _secondCamera.updateProjectionMatrix();
119
+ }
120
+
121
+ const observer = new IntersectionObserver((entries, observer) => {
122
+ entries.forEach(entry => {
123
+ if (entry.isIntersecting) {
124
+ onWindowResize();
125
+ }
126
+ });
127
+ });
128
+
129
+ const onWindowResize = () => {
130
+ _width = _container.clientWidth;
131
+ _height = _container.clientHeight;
132
+
133
+ _camera.aspect = _width / _height;
134
+ _camera.updateProjectionMatrix();
135
+
136
+ _renderer.setSize(_width, _height);
137
+ };
138
+
139
+ function checkDivVisible(div) {
140
+ if ((div.offsetWidth > 0) && (div.offsetHeight > 0)) {
141
+ return true;
142
+ }
143
+
144
+ return false;
145
+ }
146
+
147
+ function ThreeJsScene({uploadedModelFile}) {
148
+ const containerRef = useRef();
149
+ const managerRef = useRef();
150
+ const sceneRef = useRef();
151
+
152
+ useEffect(() => {
153
+ _container = containerRef.current;
154
+
155
+ _renderer = new THREE.WebGLRenderer({antialias: true, preserveDrawingBuffer: true,});
156
+
157
+ _renderer.domElement.style.width = '100%';
158
+ _renderer.domElement.style.height = '100%';
159
+
160
+ _container.appendChild(_renderer.domElement);
161
+
162
+ observer.observe(_container);
163
+
164
+ _scene = new THREE.Scene();
165
+ _scene.name = "Scene";
166
+
167
+ sceneRef.current = _scene;
168
+
169
+ _width = _container.clientWidth;
170
+ _height = _container.clientHeight;
171
+
172
+ managerRef.current = new THREE.LoadingManager();
173
+
174
+ const hemisphereLight = new THREE.HemisphereLight(0xffffff, 0x444444);
175
+
176
+ hemisphereLight.name = "Hemisphere Light";
177
+ hemisphereLight.position.set(0, 200, 0);
178
+
179
+ _scene.add(hemisphereLight);
180
+
181
+ const directionalLight = new THREE.DirectionalLight(0xffffff);
182
+
183
+ directionalLight.name = "Directional Light";
184
+ directionalLight.position.set(0, 200, 100);
185
+ directionalLight.castShadow = true;
186
+ directionalLight.shadow.camera.top = 180;
187
+ directionalLight.shadow.camera.bottom = -100;
188
+ directionalLight.shadow.camera.left = -120;
189
+ directionalLight.shadow.camera.right = 120;
190
+
191
+ _scene.add(directionalLight);
192
+
193
+ _camera = new THREE.PerspectiveCamera(45, _width / _height, 0.1, 1000);
194
+
195
+ _camera.position.x = -30;
196
+ _camera.position.y = 40;
197
+ _camera.position.z = 30;
198
+
199
+ _camera.lookAt(_scene.position);
200
+
201
+ _renderer.setSize(_width, _height);
202
+
203
+ const groundMaterial = new THREE.MeshBasicMaterial({color: 0xbebebe});
204
+
205
+ _groundMesh = new THREE.Mesh(new THREE.PlaneBufferGeometry(2000, 2000), groundMaterial);
206
+
207
+ _groundMesh.name = "Ground";
208
+ _groundMesh.rotation.x = -Math.PI / 2;
209
+ _groundMesh.receiveShadow = true;
210
+
211
+ _scene.add(_groundMesh);
212
+
213
+ _groundGrid = new THREE.GridHelper(2000, 20, 0x000000, 0x000000);
214
+
215
+ _groundGrid.name = "Grid";
216
+ _groundGrid.material.opacity = 0.2;
217
+ _groundGrid.material.transparent = true;
218
+
219
+ _scene.add(_groundGrid);
220
+
221
+ _axis = new THREE.AxesHelper(2000);
222
+
223
+ _axis.name = "Axis";
224
+
225
+ _scene.add(_axis);
226
+
227
+ _orbitController = new OrbitControls(_camera, _renderer.domElement);
228
+
229
+ _orbitController.mouseButtons = {LEFT: THREE.MOUSE.ROTATE, MIDDLE: THREE.MOUSE.PAN, RIGHT: THREE.MOUSE.PAN};
230
+
231
+ const clock = new THREE.Clock();
232
+
233
+ _secondCamera = new THREE.PerspectiveCamera(45, previewWidth / previewHeight, 0.1, 1000);
234
+
235
+ _secondCamera.name = "Preview Camera";
236
+
237
+ _secondCamera.position.copy(_camera.position);
238
+
239
+ _secondCamera.quaternion.copy(_camera.quaternion);
240
+
241
+ const orbitController2 = new OrbitControls(_secondCamera, _renderer.domElement);
242
+ orbitController2.mouseButtons = {LEFT: THREE.MOUSE.ROTATE, MIDDLE: THREE.MOUSE.PAN, RIGHT: THREE.MOUSE.PAN};
243
+ _scene.add(_secondCamera);
244
+
245
+ _transformControls = new TransformControls(_camera, _renderer.domElement);
246
+
247
+ _transformControls.name = "Transform Controls";
248
+
249
+ _transformControls.addEventListener('dragging-changed', (event) => {
250
+ _orbitController.enabled = !event.value;
251
+ orbitController2.enabled = !event.value;
252
+ });
253
+
254
+ _scene.add(_transformControls);
255
+ const animate = () => {
256
+ requestAnimationFrame(animate);
257
+
258
+ if (checkDivVisible(_container)) {
259
+ _orbitController.update();
260
+
261
+ let delta = clock.getDelta();
262
+
263
+ if (_mixer && _playing) {
264
+ _currentTime = _mixer.time % _totalTime;
265
+
266
+ _progress = ((_currentTime / _totalTime) * 100).toFixed(1);
267
+
268
+ setAnimationProgress(_progress);
269
+ }
270
+
271
+ if (_mixer && (_playing || _controlByProgressBar)) {
272
+ _mixer.update(delta);
273
+
274
+ if (!_currentVRM) {
275
+ _controlByProgressBar = false;
276
+ }
277
+ }
278
+
279
+ if ((_currentVRM && _playing) || (_currentVRM && _controlByProgressBar)) {
280
+ _currentVRM.update(delta);
281
+
282
+ _controlByProgressBar = false;
283
+ }
284
+
285
+ _renderer.setViewport(0, 0, _container.clientWidth, _container.clientHeight);
286
+ _renderer.setScissor(0, 0, _container.clientWidth, _container.clientHeight);
287
+ _renderer.setScissorTest(true);
288
+ _camera.updateProjectionMatrix();
289
+
290
+ _renderer.render(_scene, _camera);
291
+
292
+ orbitController2.update()
293
+
294
+ _renderer.setViewport(0, 0, previewWidth, previewHeight);
295
+ _renderer.setScissor(0, 0, previewWidth, previewHeight);
296
+ _renderer.setScissorTest(true);
297
+
298
+ _secondCamera.aspect = previewWidth / previewHeight;
299
+ _secondCamera.updateProjectionMatrix();
300
+
301
+ _renderer.render(_scene, _secondCamera);
302
+ }
303
+ };
304
+
305
+ if (window.updateObjects) {
306
+ window.updateObjects(convertThreeJsObjects());
307
+ }
308
+
309
+ window.addEventListener('resize', onWindowResize);
310
+
311
+ animate();
312
+
313
+ return () => {
314
+ // 组件卸载时的清理操作
315
+ window.removeEventListener('resize', onWindowResize);
316
+ };
317
+ }, []);
318
+
319
+ function isGLTF1(contents) {
320
+ let resultContent;
321
+
322
+ if (typeof contents === 'string') {
323
+ resultContent = contents;
324
+ } else {
325
+ const magic = THREE.LoaderUtils.decodeText(new Uint8Array(contents, 0, 4));
326
+
327
+ if (magic === 'glTF') {
328
+ const version = new DataView(contents).getUint32(4, true);
329
+
330
+ return version < 2;
331
+
332
+ } else {
333
+ resultContent = THREE.LoaderUtils.decodeText(new Uint8Array(contents));
334
+ }
335
+ }
336
+
337
+ const json = JSON.parse(resultContent);
338
+
339
+ return (json.asset !== undefined && json.asset.version[0] < 2);
340
+ }
341
+
342
+ function loadOBJ(event) {
343
+ const contents = event.target.result;
344
+
345
+ const mainObject = new OBJLoader().parse(contents);
346
+
347
+ mainObject.name = "mainObject" + _mainObjectCounter.toString();
348
+
349
+ _mainObjectCounter++;
350
+
351
+ scaleObjectToProper(mainObject);
352
+
353
+ _scene.add(mainObject);
354
+
355
+ window.updateObjects(convertThreeJsObjects());
356
+ }
357
+
358
+ function loadSTL(event) {
359
+ const contents = event.target.result;
360
+ const geometry = new STLLoader().parse(contents);
361
+ const material = new THREE.MeshStandardMaterial();
362
+
363
+ geometry.sourceType = "stl";
364
+ //geometry.sourceFile = file.name;
365
+
366
+ const mainObject = new THREE.Mesh(geometry, material);
367
+
368
+ mainObject.name = "mainObject" + _mainObjectCounter.toString();
369
+
370
+ _mainObjectCounter++;
371
+
372
+ scaleObjectToProper(mainObject);
373
+
374
+ _scene.add(mainObject);
375
+
376
+ window.updateObjects(convertThreeJsObjects());
377
+ }
378
+
379
+ // eslint-disable-next-line react-hooks/exhaustive-deps
380
+ function loadFBX(event) {
381
+ const contents = event.target.result;
382
+ const loader = new FBXLoader(managerRef.current);
383
+ const mainObject = loader.parse(contents);
384
+ _mixer = new THREE.AnimationMixer(mainObject);
385
+
386
+ if (mainObject.animations[0]) {
387
+ _action = _mixer.clipAction(mainObject.animations[0]);
388
+
389
+ if (_playing) {
390
+ _action.play();
391
+ }
392
+
393
+ const clip = _action.getClip();
394
+
395
+ _totalTime = clip.duration;
396
+ }
397
+
398
+ mainObject.traverse(function (child) {
399
+ if (child.isMesh) {
400
+ child.castShadow = true;
401
+ child.receiveShadow = true;
402
+ }
403
+ });
404
+
405
+ mainObject.name = "mainObject" + _mainObjectCounter.toString();
406
+
407
+ _mainObjectCounter++;
408
+
409
+ scaleObjectToProper(mainObject);
410
+
411
+ _scene.add(mainObject);
412
+
413
+ window.updateObjects(convertThreeJsObjects());
414
+ }
415
+
416
+ // eslint-disable-next-line react-hooks/exhaustive-deps
417
+ function loadGLTF(event) {
418
+ const contents = event.target.result;
419
+
420
+ let loader;
421
+
422
+ if (isGLTF1(contents)) {
423
+ alert('Import of glTF asset not possible. Only versions >= 2.0 are supported. Please try to upgrade the file to glTF 2.0 using glTF-Pipeline.');
424
+ } else {
425
+ const dracoLoader = new DRACOLoader();
426
+ dracoLoader.setDecoderPath('/file=extensions/sd-3dmodel-loader/js/');
427
+
428
+ loader = new GLTFLoader(managerRef.current);
429
+ loader.setDRACOLoader(dracoLoader);
430
+ }
431
+
432
+ loader.parse(contents, '', function (result) {
433
+ const resultScene = result.scene;
434
+ resultScene.name = "mainObject" + _mainObjectCounter.toString();
435
+
436
+ _mainObjectCounter++;
437
+
438
+ resultScene.animations.push(...result.animations);
439
+
440
+ _scene.add(resultScene);
441
+
442
+ window.updateObjects(convertThreeJsObjects());
443
+ });
444
+ }
445
+
446
+ function loadGLB(event) {
447
+ const contents = event.target.result;
448
+
449
+ const dracoLoader = new DRACOLoader();
450
+ dracoLoader.setDecoderPath('/file=extensions/sd-3dmodel-loader/js/');
451
+
452
+ const loader = new GLTFLoader();
453
+
454
+ loader.setDRACOLoader(dracoLoader);
455
+
456
+ loader.parse(contents, '', function (result) {
457
+ const resultScene = result.scene;
458
+ resultScene.name = "mainObject" + _mainObjectCounter.toString();
459
+
460
+ _mainObjectCounter++;
461
+
462
+ resultScene.animations.push(...result.animations);
463
+
464
+ _scene.add(resultScene);
465
+
466
+ window.updateObjects(convertThreeJsObjects());
467
+ });
468
+ }
469
+
470
+ // eslint-disable-next-line react-hooks/exhaustive-deps
471
+ function loadDAE(event) {
472
+ const contents = event.target.result;
473
+
474
+ const loader = new ColladaLoader(managerRef.current);
475
+
476
+ const collada = loader.parse(contents);
477
+
478
+ collada.scene.name = "mainObject" + _mainObjectCounter.toString();
479
+
480
+ _mainObjectCounter++;
481
+
482
+ _scene.add(collada.scene);
483
+
484
+ window.updateObjects(convertThreeJsObjects());
485
+ }
486
+
487
+ // eslint-disable-next-line react-hooks/exhaustive-deps
488
+ function loadVRM(event) {
489
+ const contents = event.target.result;
490
+
491
+ const loader = new GLTFLoader(managerRef.current);
492
+
493
+ loader.register((parser) => {
494
+ return new VRMLoaderPlugin(parser);
495
+ });
496
+
497
+ loader.parse(contents, '', function (result) {
498
+ const vrm = result.userData.vrm;
499
+
500
+ if (!_currentVRM) {
501
+ _currentVRM = vrm;
502
+ }
503
+
504
+ const resultScene = vrm.scene;
505
+
506
+ resultScene.name = "mainObject" + _mainObjectCounter.toString();
507
+
508
+ _mainObjectCounter++;
509
+
510
+ scaleObjectToProper(resultScene);
511
+
512
+ _scene.add(resultScene);
513
+
514
+ window.updateObjects(convertThreeJsObjects());
515
+ });
516
+ }
517
+
518
+
519
+ useEffect(() => {
520
+ if (uploadedModelFile) {
521
+ const filename = uploadedModelFile.name;
522
+ const extension = filename.split('.').pop().toLowerCase();
523
+ const reader = new FileReader();
524
+
525
+ //removeMainObject();
526
+
527
+ switch (extension) {
528
+ case 'obj':
529
+ reader.addEventListener('load', loadOBJ, false);
530
+
531
+ reader.readAsText(uploadedModelFile);
532
+
533
+ break;
534
+ case 'stl':
535
+ reader.addEventListener('load', loadSTL, false);
536
+
537
+ if (reader.readAsBinaryString !== undefined) {
538
+ reader.readAsBinaryString(uploadedModelFile);
539
+ } else {
540
+ reader.readAsArrayBuffer(uploadedModelFile);
541
+ }
542
+
543
+ break;
544
+ case 'fbx':
545
+ reader.addEventListener('load', loadFBX, false);
546
+ reader.readAsArrayBuffer(uploadedModelFile);
547
+ break;
548
+ case 'gltf':
549
+ reader.addEventListener('load', loadGLTF, false);
550
+ reader.readAsArrayBuffer(uploadedModelFile);
551
+ break;
552
+ case 'glb':
553
+ reader.addEventListener('load', loadGLB, false);
554
+
555
+ reader.readAsArrayBuffer(uploadedModelFile);
556
+
557
+ break;
558
+ case 'dae':
559
+ reader.addEventListener('load', loadDAE, false);
560
+
561
+ reader.readAsText(uploadedModelFile);
562
+
563
+ break;
564
+ case 'vrm':
565
+ reader.addEventListener('load', loadVRM, false);
566
+
567
+ reader.readAsArrayBuffer(uploadedModelFile);
568
+
569
+ break;
570
+ }
571
+
572
+
573
+ }
574
+
575
+ }, [uploadedModelFile, loadOBJ, loadSTL, loadFBX, loadGLTF, loadDAE, loadVRM]);
576
+
577
+ return (
578
+ <div ref={containerRef} style={{width: '100%', height: '100%'}}></div>
579
+ );
580
+ }
581
+
582
+ function scaleObjectToProper(object) {
583
+ const boundingBox = new THREE.Box3();
584
+
585
+ boundingBox.setFromObject(object);
586
+
587
+ if (object.geometry) {
588
+ const center = new THREE.Vector3();
589
+
590
+ boundingBox.getCenter(center);
591
+
592
+ object.geometry.translate(-center.x, -center.y, -center.z);
593
+ }
594
+
595
+ const expectRadius = 20;
596
+
597
+ const radius = boundingBox.getBoundingSphere(new THREE.Sphere()).radius;
598
+
599
+ const modelScale = expectRadius / radius;
600
+
601
+ object.scale.set(modelScale, modelScale, modelScale);
602
+ }
603
+
604
+ export function loadPoseModel(poseModelFileName) {
605
+ if (poseModelFileName && !_currentVRM) {
606
+ let manager = new THREE.LoadingManager();
607
+
608
+ let path = "/file=extensions/sd-3dmodel-loader/models/" + poseModelFileName;
609
+ //let path = "/file=/modelss/" + poseModelFileName;
610
+
611
+ const ext = poseModelFileName.split('.').pop().toLowerCase()
612
+
613
+ switch (ext) {
614
+ case "vrm": {
615
+ const loader = new GLTFLoader(manager);
616
+ loader.crossOrigin = 'anonymous';
617
+
618
+ loader.register((parser) => {
619
+ return new VRMLoaderPlugin(parser);
620
+ });
621
+
622
+ loader.load(
623
+ path,
624
+ (gltf) => {
625
+ const vrm = gltf.userData.vrm;
626
+
627
+ const resultScene = vrm.scene;
628
+
629
+ resultScene.name = "mainObject" + _mainObjectCounter.toString();
630
+
631
+ _mainObjectCounter++;
632
+
633
+ scaleObjectToProper(resultScene);
634
+
635
+ _scene.add(resultScene);
636
+
637
+ _currentVRM = vrm;
638
+
639
+ vrm.scene.traverse((obj) => {
640
+ obj.frustumCulled = false;
641
+ });
642
+
643
+ VRMUtils.rotateVRM0(vrm);
644
+ }
645
+ )
646
+ break;
647
+ }
648
+ case "fbx": {
649
+ const loader = new FBXLoader(manager);
650
+ loader.load(path, (object) => {
651
+ object.traverse(function (child) {
652
+ if (child.isMesh) {
653
+ child.castShadow = true;
654
+ child.receiveShadow = true;
655
+ }
656
+ });
657
+
658
+ object.name = "mainObject";
659
+
660
+ scaleObjectToProper(object);
661
+
662
+ _scene.add(object);
663
+ });
664
+
665
+ break;
666
+ }
667
+ }
668
+ }
669
+ }
670
+
671
+ export function convertThreeJsObjects() {
672
+ return _scene.toJSON();
673
+ }
674
+
675
+ export default ThreeJsScene;
676
+
677
+ export function setBgColor(bgColor) {
678
+ const backgroundColor = new THREE.Color(bgColor.hex);
679
+
680
+ _renderer.setClearColor(backgroundColor);
681
+ }
682
+
683
+ export function setPlaying() {
684
+ _playing = !_playing;
685
+
686
+ if (_action && _playing) {
687
+ _action.play();
688
+ }
689
+ }
690
+
691
+ export function setStopPlaying() {
692
+ if (_action) {
693
+ _action.stop();
694
+ }
695
+
696
+ _playing = false;
697
+ }
698
+
699
+ export function setVisible(objName, visible) {
700
+ if (_scene) {
701
+ const selectedObject = _scene.getObjectByName(objName);
702
+
703
+ selectedObject.visible = visible;
704
+ }
705
+ }
706
+
707
+ export function controlAnimationProgress(e) {
708
+ if (_action && !_playing) {
709
+ _currentTime = e / 100 * _totalTime;
710
+
711
+ _action.time = _currentTime;
712
+ _mixer.time = _currentTime;
713
+
714
+ _controlByProgressBar = true;
715
+ }
716
+ }
717
+
718
+ export function setRendererImage(sendImage, controlNetIndex, type) {
719
+ if (controlNetIndex !== '') {
720
+ _renderer.domElement.toBlob((blob) => {
721
+ const image = new Image();
722
+
723
+ image.onload = function () {
724
+ const canvas = document.createElement('canvas');
725
+
726
+ const canvas2 = document.createElement('canvas');
727
+
728
+ canvas.width = _width;
729
+ canvas.height = _height;
730
+
731
+ const ctx = canvas.getContext('2d');
732
+
733
+ ctx.drawImage(image, 0, 0);
734
+
735
+ const imageData = ctx.getImageData(0, image.height - previewHeight, previewWidth, previewHeight);
736
+
737
+ canvas2.width = previewWidth;
738
+ canvas2.height = previewHeight;
739
+
740
+ const ctx2 = canvas2.getContext('2d');
741
+
742
+ canvas2.width = previewWidth;
743
+ canvas2.height = previewHeight;
744
+
745
+ ctx2.putImageData(imageData, 0, 0);
746
+
747
+ canvas2.toBlob((blob2) => {
748
+ const file = new File([blob2], "pose.png")
749
+ const dt = new DataTransfer();
750
+ dt.items.add(file);
751
+
752
+ sendImage(type, controlNetIndex, dt);
753
+ });
754
+ };
755
+
756
+ image.src = URL.createObjectURL(blob);
757
+ });
758
+ } else {
759
+ alert('No ControlNet Selected');
760
+ }
761
+ }
sd-3dmodel-loader/src/TopToolbar.js ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import React, {useState} from 'react';
2
+ import AppBar from '@mui/material/AppBar';
3
+ import Toolbar from '@mui/material/Toolbar';
4
+ import Typography from '@mui/material/Typography';
5
+ import IconButton from '@mui/material/IconButton';
6
+ import MenuIcon from '@mui/icons-material/Menu';
7
+ import Menu from '@mui/material/Menu';
8
+ import MenuItem from '@mui/material/MenuItem';
9
+
10
+ function TopToolbar() {
11
+ const [anchorEl, setAnchorEl] = useState(null);
12
+
13
+ return (
14
+ <div>
15
+ <AppBar position="static">
16
+ <Toolbar>
17
+ <IconButton
18
+ edge="start"
19
+ color="inherit"
20
+ aria-label="menu"
21
+ onClick={(event) => setAnchorEl(event.currentTarget)}
22
+ >
23
+ <MenuIcon/>
24
+ </IconButton>
25
+ <Typography variant="h6" component="div">
26
+ My Application
27
+ </Typography>
28
+ </Toolbar>
29
+ </AppBar>
30
+ <Menu
31
+ anchorEl={anchorEl}
32
+ open={Boolean(anchorEl)}
33
+ onClose={() => setAnchorEl(null)}
34
+ >
35
+ <MenuItem onClick={() => setAnchorEl(null)}>Menu Item 1</MenuItem>
36
+ <MenuItem onClick={() => setAnchorEl(null)}>Menu Item 2</MenuItem>
37
+ <MenuItem onClick={() => setAnchorEl(null)}>Menu Item 3</MenuItem>
38
+ </Menu>
39
+ </div>
40
+ );
41
+ }
42
+
43
+ export default TopToolbar;
sd-3dmodel-loader/src/index.css ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ body {
2
+ margin: 0;
3
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4
+ 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5
+ sans-serif;
6
+ -webkit-font-smoothing: antialiased;
7
+ -moz-osx-font-smoothing: grayscale;
8
+ }
9
+
10
+ code {
11
+ font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12
+ monospace;
13
+ }
sd-3dmodel-loader/src/index.js ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import React from 'react';
2
+ import {useState, useCallback} from 'react';
3
+ import ReactDOM from 'react-dom/client';
4
+ import {Container, Grid} from '@mui/material';
5
+ import ThreeJsScene from './ThreeJsScene';
6
+ import {
7
+ convertThreeJsObjects,
8
+ setBgColor,
9
+ setPlaying,
10
+ setStopPlaying,
11
+ controlAnimationProgress,
12
+ setRendererImage,
13
+ setFar,
14
+ setFOV,
15
+ setNear,
16
+ refreshSceneTree,
17
+ handleSelectedObject,
18
+ setVisible,
19
+ handlePoseSelectedObject,
20
+ removeObject,
21
+ loadPoseModel,
22
+ setPreviewSize
23
+ } from './ThreeJsScene';
24
+ import ScenePanel from './ScenePanel'
25
+ import AnimationPanel from './AnimationPanel'
26
+ import SendToControlNetPanel from './SendToControlNetPanel'
27
+ import ModelPanel from './ModelPanel'
28
+ import PosePanel from './PosePanel'
29
+
30
+ let _sendImage;
31
+
32
+ export default function App({controlNetNum}) {
33
+ const [uploadedModelFile, setUploadedModelFile] = useState(null);
34
+
35
+ const generateControlNetOptions = () => {
36
+ const options = [];
37
+ for (let i = 0; i < controlNetNum; i++) {
38
+ const option = {value: i.toString(), label: i.toString()};
39
+
40
+ options.push(option);
41
+ }
42
+
43
+ return options;
44
+ }
45
+
46
+ const options = generateControlNetOptions();
47
+
48
+ const handleValueChange = (value) => {
49
+ console.log('Selected value:', value);
50
+ };
51
+
52
+ return (
53
+ <>
54
+ <Container maxWidth="none">
55
+ <Grid container spacing={3}>
56
+ <Grid item xs={10} style={{height: '80vh'}}>
57
+
58
+ <ThreeJsScene
59
+ uploadedModelFile={uploadedModelFile}
60
+ />
61
+ </Grid>
62
+ <Grid item xs={2}>
63
+ <PosePanel handlePoseSelectedObject={handlePoseSelectedObject}
64
+ setPoseModelFileName={loadPoseModel}/>
65
+ <ModelPanel setUploadedModelFile={setUploadedModelFile}/>
66
+
67
+ <ScenePanel refreshSceneTree={refreshSceneTree} handleSelectedObject={handleSelectedObject}
68
+ setVisible={setVisible}
69
+ setCameraNear={setNear} setCameraFar={setFar} setCameraFOV={setFOV}
70
+ setCanvasBgColor={setBgColor} removeObject={removeObject}/>
71
+
72
+ <AnimationPanel setAnimationPlaying={setPlaying} setAnimationStopPlaying={setStopPlaying}
73
+ controlAnimation={controlAnimationProgress}/>
74
+
75
+ <SendToControlNetPanel options={options} onValueChange={handleValueChange}
76
+ setRendererImage={setRendererImage}
77
+ sendImage={_sendImage} setPreviewSize={setPreviewSize}/>
78
+ </Grid>
79
+ </Grid>
80
+ </Container>
81
+ </>
82
+ );
83
+ }
84
+
85
+ export function create3dmodelLoaderApp({container, controlNetNum}) {
86
+ const root = ReactDOM.createRoot(container);
87
+
88
+ root.render(<App controlNetNum={controlNetNum}/>);
89
+ }
90
+
91
+ function localDev() {
92
+ const root = ReactDOM.createRoot(document.getElementById('sd-3d-model-loader-container'));
93
+
94
+ root.render(<App controlNetNum={3}/>);
95
+ }
96
+
97
+ export function setSendImageFunc3dmodel(sendImage) {
98
+ _sendImage = sendImage;
99
+ }
100
+
101
+ window.create3dmodelLoaderApp = create3dmodelLoaderApp;
102
+ window.setSendImageFunc3dmodel = setSendImageFunc3dmodel;
103
+
104
+ // enable this method for local dev, and run npm start
105
+ //localDev();
sd-3dmodel-loader/style.css ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #threeDModelLoader-container [type=button] {
2
+ background-color: rgb(25, 118, 210);
3
+ text-transform: uppercase;
4
+ margin: 2px;
5
+ padding: 6px 16px;
6
+ color: rgb(255, 255, 255);
7
+ line-height: 1.75;
8
+ font-family: Roboto, Helvetica, Arial, sans-serif;
9
+ }
10
+
11
+ #threeDModelLoader-container menu,
12
+ #threeDModelLoader-container ul {
13
+ margin: 0px 0px 0px 17px;
14
+ }
sd-3dmodel-loader/webpack.config.js ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const path = require('path');
2
+ const HtmlWebpackPlugin = require('html-webpack-plugin');
3
+
4
+ module.exports = {
5
+ entry: './src/index.js',
6
+ output: {
7
+ path: path.join(__dirname, 'dist'),
8
+ filename: '3d-model-loader.bundle.js'
9
+ },
10
+ module: {
11
+ rules: [
12
+ {
13
+ test: /\.(js|jsx)$/,
14
+ exclude: /node_modules/,
15
+ use: {
16
+ loader: 'babel-loader',
17
+ options: {
18
+ presets: ['@babel/env', '@babel/react']
19
+ }
20
+ }
21
+ },
22
+ {
23
+ test: /\.css$/,
24
+ use: ['style-loader', 'css-loader'],
25
+ },
26
+ {
27
+ test: /\.(png|jpe?g|gif)$/i,
28
+ loader: 'url-loader',
29
+ options: {
30
+ limit: 8192,
31
+ name: '[name].[ext]',
32
+ outputPath: 'images/',
33
+ publicPath: 'images/',
34
+ },
35
+ },
36
+ ]
37
+ },
38
+ devServer: {
39
+ contentBase: path.join(__dirname, 'public'),
40
+ compress: true,
41
+ port: 3000,
42
+ },
43
+ plugins: [
44
+ new HtmlWebpackPlugin({
45
+ template: 'public/index.html',
46
+ }),
47
+ ],
48
+ };
sd-webui-3d-open-pose-editor/.devcontainer/devcontainer.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "Debian",
3
+ "image": "mcr.microsoft.com/devcontainers/base:bullseye",
4
+ "features": {
5
+ "ghcr.io/devcontainers/features/node:1": {
6
+ "version": "16"
7
+ },
8
+ "ghcr.io/devcontainers/features/python:1": {
9
+ "version": "3.10"
10
+ }
11
+ },
12
+ "mounts": [
13
+ {
14
+ "type": "bind",
15
+ "source": "${localEnv:HOME}/.gitconfig",
16
+ "target": "/home/vscode/.gitconfig"
17
+ },
18
+ {
19
+ "type": "bind",
20
+ "source": "${localEnv:HOME}/.gnupg",
21
+ "target": "/home/vscode/.gnupg"
22
+ },
23
+ {
24
+ "type": "volume",
25
+ "source": "sd-webui-3d-open-pose-editor-venv",
26
+ "target": "${containerWorkspaceFolder}/.venv"
27
+ },
28
+ {
29
+ "type": "volume",
30
+ "source": "sd-webui-3d-open-pose-editor-nodemodules",
31
+ "target": "${containerWorkspaceFolder}/node_modules"
32
+ }
33
+ ],
34
+ "postCreateCommand": "bash .devcontainer/init.sh"
35
+ }
sd-webui-3d-open-pose-editor/.devcontainer/init.sh ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ echo "export GPG_TTY=\$(tty)" >> ~/.bashrc
3
+
4
+ sudo chown vscode:vscode .venv
5
+ pipenv install
6
+
7
+ sudo chown vscode:vscode node_modules
8
+ pnpm install
sd-webui-3d-open-pose-editor/.env.online ADDED
@@ -0,0 +1 @@
 
 
1
+ VITE_IS_ONLINE=true
sd-webui-3d-open-pose-editor/.eslintrc.cjs ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ module.exports = {
2
+ env: {
3
+ browser: true,
4
+ es2021: true,
5
+ node: true,
6
+ },
7
+ extends: [
8
+ 'eslint:recommended',
9
+ 'plugin:@typescript-eslint/recommended',
10
+ 'prettier',
11
+ ],
12
+ parser: '@typescript-eslint/parser',
13
+ parserOptions: {
14
+ ecmaFeatures: {
15
+ jsx: true,
16
+ },
17
+ ecmaVersion: 'latest',
18
+ sourceType: 'module',
19
+ },
20
+ plugins: ['@typescript-eslint'],
21
+ }
sd-webui-3d-open-pose-editor/.github/ISSUE_TEMPLATE/bug_report.md ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: "[Bug] "
5
+ labels: bug
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Describe the bug**
11
+ A clear and concise description of what the bug is.
12
+
13
+ **To Reproduce**
14
+ Steps to reproduce the behavior:
15
+ 1. Go to '...'
16
+ 2. Click on '....'
17
+ 3. Scroll down to '....'
18
+ 4. See error
19
+
20
+ **Expected behavior**
21
+ A clear and concise description of what you expected to happen.
22
+
23
+ **Screenshots**
24
+ If applicable, add screenshots to help explain your problem.
25
+
26
+ **Environment (please complete the following information):**
27
+ - OS: [e.g. Windows, Linux]
28
+ - Browser: [e.g. Chrome, Safari]
29
+ - A1111 WebUI Version: [e.g. b9a66b02]
30
+ - Extension Version: [e.g. 99f3e80 (Tue Mar 28 11:58:16 2023)]
31
+ - ControlNet Version: [e.g. 241c05f8 (Thu Mar 23 15:18:35 2023)]
32
+
33
+ **Additional context**
34
+ Add any other context about the problem here.
sd-webui-3d-open-pose-editor/.github/ISSUE_TEMPLATE/feature_request.md ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: "[Feature Request] "
5
+ labels: enhancement
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Is your feature request related to a problem? Please describe.**
11
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
+
13
+ **Describe the solution you'd like**
14
+ A clear and concise description of what you want to happen.
15
+
16
+ **Describe alternatives you've considered**
17
+ A clear and concise description of any alternative solutions or features you've considered.
18
+
19
+ **Additional context**
20
+ Add any other context or screenshots about the feature request here.
sd-webui-3d-open-pose-editor/.github/workflows/pages.yml ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Deploy GitHub Pages
2
+
3
+ on:
4
+ # Runs on pushes targeting the default branch
5
+ push:
6
+ tags:
7
+ - "v*"
8
+
9
+ # Allows you to run this workflow manually from the Actions tab
10
+ workflow_dispatch:
11
+
12
+ # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13
+ permissions:
14
+ contents: write
15
+ pages: write
16
+ id-token: write
17
+
18
+ # Allow one concurrent deployment
19
+ concurrency:
20
+ group: "pages"
21
+ cancel-in-progress: true
22
+
23
+ jobs:
24
+ # Build job
25
+ build:
26
+ runs-on: ubuntu-latest
27
+ strategy:
28
+ matrix:
29
+ node-version: [16.x]
30
+ # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
31
+
32
+ steps:
33
+ - uses: actions/checkout@v3
34
+ - uses: pnpm/action-setup@v2.2.4
35
+ with:
36
+ version: 7
37
+ - name: Use Node.js ${{ matrix.node-version }}
38
+ uses: actions/setup-node@v3
39
+ with:
40
+ node-version: ${{ matrix.node-version }}
41
+ cache: "pnpm"
42
+ - run: pnpm install
43
+ - run: pnpm build
44
+ - name: Setup Pages
45
+ uses: actions/configure-pages@v2
46
+ - name: Upload artifact
47
+ uses: actions/upload-pages-artifact@v1
48
+ with:
49
+ # Upload entire repository
50
+ path: './dist'
51
+ - run: pnpm build-singlefile
52
+ - name: Release
53
+ uses: softprops/action-gh-release@v1
54
+ if: startsWith(github.ref, 'refs/tags/')
55
+ with:
56
+ files: html.zip
57
+
58
+ # Deployment job
59
+ deploy:
60
+ environment:
61
+ name: github-pages
62
+ url: ${{ steps.deployment.outputs.page_url }}
63
+ runs-on: ubuntu-latest
64
+ needs: build
65
+ steps:
66
+ - name: Deploy to GitHub Pages
67
+ id: deployment
68
+ uses: actions/deploy-pages@v1
sd-webui-3d-open-pose-editor/.gitignore ADDED
@@ -0,0 +1,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Logs
2
+ logs
3
+ *.log
4
+ npm-debug.log*
5
+ yarn-debug.log*
6
+ yarn-error.log*
7
+ pnpm-debug.log*
8
+ lerna-debug.log*
9
+
10
+ node_modules
11
+ dist
12
+ dist-ssr
13
+ *.local
14
+
15
+ # Editor directories and files
16
+ .vscode/*
17
+ !.vscode/extensions.json
18
+ .idea
19
+ .DS_Store
20
+ *.suo
21
+ *.ntvs*
22
+ *.njsproj
23
+ *.sln
24
+ *.sw?
25
+
26
+ # Byte-compiled / optimized / DLL files
27
+ __pycache__/
28
+ *.py[cod]
29
+ *$py.class
30
+
31
+ # C extensions
32
+ *.so
33
+
34
+ # Distribution / packaging
35
+ .Python
36
+ build/
37
+ develop-eggs/
38
+ dist/
39
+ downloads/
40
+ eggs/
41
+ .eggs/
42
+ lib/
43
+ lib64/
44
+ parts/
45
+ sdist/
46
+ var/
47
+ wheels/
48
+ share/python-wheels/
49
+ *.egg-info/
50
+ .installed.cfg
51
+ *.egg
52
+ MANIFEST
53
+
54
+ # PyInstaller
55
+ # Usually these files are written by a python script from a template
56
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
57
+ *.manifest
58
+ *.spec
59
+
60
+ # Installer logs
61
+ pip-log.txt
62
+ pip-delete-this-directory.txt
63
+
64
+ # Unit test / coverage reports
65
+ htmlcov/
66
+ .tox/
67
+ .nox/
68
+ .coverage
69
+ .coverage.*
70
+ .cache
71
+ nosetests.xml
72
+ coverage.xml
73
+ *.cover
74
+ *.py,cover
75
+ .hypothesis/
76
+ .pytest_cache/
77
+ cover/
78
+
79
+ # Translations
80
+ *.mo
81
+ *.pot
82
+
83
+ # Django stuff:
84
+ *.log
85
+ local_settings.py
86
+ db.sqlite3
87
+ db.sqlite3-journal
88
+
89
+ # Flask stuff:
90
+ instance/
91
+ .webassets-cache
92
+
93
+ # Scrapy stuff:
94
+ .scrapy
95
+
96
+ # Sphinx documentation
97
+ docs/_build/
98
+
99
+ # PyBuilder
100
+ .pybuilder/
101
+ target/
102
+
103
+ # Jupyter Notebook
104
+ .ipynb_checkpoints
105
+
106
+ # IPython
107
+ profile_default/
108
+ ipython_config.py
109
+
110
+ # pyenv
111
+ # For a library or package, you might want to ignore these files since the code is
112
+ # intended to run in multiple environments; otherwise, check them in:
113
+ # .python-version
114
+
115
+ # pipenv
116
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
117
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
118
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
119
+ # install all needed dependencies.
120
+ #Pipfile.lock
121
+
122
+ # poetry
123
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
124
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
125
+ # commonly ignored for libraries.
126
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
127
+ #poetry.lock
128
+
129
+ # pdm
130
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
131
+ #pdm.lock
132
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
133
+ # in version control.
134
+ # https://pdm.fming.dev/#use-with-ide
135
+ .pdm.toml
136
+
137
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
138
+ __pypackages__/
139
+
140
+ # Celery stuff
141
+ celerybeat-schedule
142
+ celerybeat.pid
143
+
144
+ # SageMath parsed files
145
+ *.sage.py
146
+
147
+ # Environments
148
+ .env
149
+ .venv
150
+ env/
151
+ venv/
152
+ ENV/
153
+ env.bak/
154
+ venv.bak/
155
+
156
+ # Spyder project settings
157
+ .spyderproject
158
+ .spyproject
159
+
160
+ # Rope project settings
161
+ .ropeproject
162
+
163
+ # mkdocs documentation
164
+ /site
165
+
166
+ # mypy
167
+ .mypy_cache/
168
+ .dmypy.json
169
+ dmypy.json
170
+
171
+ # Pyre type checker
172
+ .pyre/
173
+
174
+ # pytype static type analyzer
175
+ .pytype/
176
+
177
+ # Cython debug symbols
178
+ cython_debug/
179
+
180
+ # PyCharm
181
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
182
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
183
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
184
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
185
+ #.idea/
186
+
187
+ # Custom
188
+ /stats.html
189
+ .pnpm-store/
sd-webui-3d-open-pose-editor/.prettierrc.cjs ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ module.exports = {
2
+ trailingComma: 'es5',
3
+ tabWidth: 4,
4
+ semi: false,
5
+ singleQuote: true,
6
+ }
sd-webui-3d-open-pose-editor/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2021 yzhu
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.