@roomle/web-sdk 3.7.0-alpha.1 → 3.7.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/lib/{BufferGeometry-BLeRuMkh.mjs → BufferGeometry-C696z6r3.mjs} +2 -2
  2. package/lib/{BufferGeometry-BLeRuMkh.mjs.map → BufferGeometry-C696z6r3.mjs.map} +1 -1
  3. package/lib/ConfiguratorKernel.wasm +0 -0
  4. package/lib/{GLTFExporter-CFXCqoLa.mjs → GLTFExporter-AfQIvZAD.mjs} +1 -1
  5. package/lib/{GLTFExporter-CFXCqoLa.mjs.map → GLTFExporter-AfQIvZAD.mjs.map} +1 -1
  6. package/lib/{Object3D-DSjIOhON.mjs → Object3D-C3wqWk6O.mjs} +1 -1
  7. package/lib/{Object3D-DSjIOhON.mjs.map → Object3D-C3wqWk6O.mjs.map} +1 -1
  8. package/lib/{PointLightHelper-BEJEy6l_.mjs → PointLightHelper-wVSmrAnD.mjs} +4 -4
  9. package/lib/{PointLightHelper-BEJEy6l_.mjs.map → PointLightHelper-wVSmrAnD.mjs.map} +1 -1
  10. package/lib/RoomleCore.wasm +0 -0
  11. package/lib/RoomleToolsCore.wasm +0 -0
  12. package/lib/{SpotLightHelper-aXFW8qaJ.mjs → SpotLightHelper-C7J95t4f.mjs} +3 -3
  13. package/lib/{SpotLightHelper-aXFW8qaJ.mjs.map → SpotLightHelper-C7J95t4f.mjs.map} +1 -1
  14. package/lib/{USDZExporter-B4hsiwhd.mjs → USDZExporter-BBk0APeK.mjs} +2 -2
  15. package/lib/{USDZExporter-B4hsiwhd.mjs.map → USDZExporter-BBk0APeK.mjs.map} +1 -1
  16. package/lib/{Vector4-DGmBYfpK.mjs → Vector4-DUqY3Egg.mjs} +2 -2
  17. package/lib/{Vector4-DGmBYfpK.mjs.map → Vector4-DUqY3Egg.mjs.map} +1 -1
  18. package/lib/{api-C2-6Jm5W.mjs → api-oYzhcs_W.mjs} +2 -2
  19. package/lib/{api-C2-6Jm5W.mjs.map → api-oYzhcs_W.mjs.map} +1 -1
  20. package/lib/asset-loader.worker-A7nEeQB4.mjs +6 -0
  21. package/lib/asset-loader.worker-A7nEeQB4.mjs.map +1 -0
  22. package/lib/{banana-for-scale-BV_na-g3.mjs → banana-for-scale-D8t2dmc7.mjs} +3 -3
  23. package/lib/{banana-for-scale-BV_na-g3.mjs.map → banana-for-scale-D8t2dmc7.mjs.map} +1 -1
  24. package/lib/budgeteer.sw-CQWYbQSc.mjs +6 -0
  25. package/lib/budgeteer.sw-CQWYbQSc.mjs.map +1 -0
  26. package/lib/common-utils-qErzZAiR.mjs.map +1 -1
  27. package/lib/{component-dimensioning-DCQTqssC.mjs → component-dimensioning-DlB7-9Om.mjs} +5 -5
  28. package/lib/{component-dimensioning-DCQTqssC.mjs.map → component-dimensioning-DlB7-9Om.mjs.map} +1 -1
  29. package/lib/{component-raycast-helper-B3WXp3oq.mjs → component-raycast-helper-C6ptEb0K.mjs} +27 -28
  30. package/lib/{component-raycast-helper-B3WXp3oq.mjs.map → component-raycast-helper-C6ptEb0K.mjs.map} +1 -1
  31. package/lib/component-raycast-helper-LrhRpeDD.mjs +2 -0
  32. package/lib/configurator-CRMunIq7.mjs +45 -0
  33. package/lib/{configurator-Dx6kcXY_.mjs.map → configurator-CRMunIq7.mjs.map} +1 -1
  34. package/lib/configurator-DqiW717d.mjs +2 -0
  35. package/lib/{continuous-drawing-helper-DzULJ9d1.mjs → continuous-drawing-helper-BwulJHKj.mjs} +2 -2
  36. package/lib/{continuous-drawing-helper-DzULJ9d1.mjs.map → continuous-drawing-helper-BwulJHKj.mjs.map} +1 -1
  37. package/lib/dat.gui.module-CZHqOVGq.mjs +1500 -0
  38. package/lib/dat.gui.module-CZHqOVGq.mjs.map +1 -0
  39. package/lib/{decorate-BIflHDAa.mjs → decorate-BAtqSPNS.mjs} +3 -3
  40. package/lib/decorate-BAtqSPNS.mjs.map +1 -0
  41. package/lib/{dimensioning-helper-Cj20VTW0.mjs → dimensioning-helper--Y0Y-Wr1.mjs} +54 -63
  42. package/lib/{dimensioning-helper-Cj20VTW0.mjs.map → dimensioning-helper--Y0Y-Wr1.mjs.map} +1 -1
  43. package/lib/dimensioning-helper-BpUreWo2.mjs +2 -0
  44. package/lib/{fflate.module-dFNj5UPI.mjs → fflate.module-CBz7CLOg.mjs} +1 -1
  45. package/lib/{fflate.module-dFNj5UPI.mjs.map → fflate.module-CBz7CLOg.mjs.map} +1 -1
  46. package/lib/{glb-viewer-BqFcaUlb.mjs → glb-viewer-CXEoIw1b.mjs} +20 -20
  47. package/lib/glb-viewer-CXEoIw1b.mjs.map +1 -0
  48. package/lib/glb-viewer-IDXgmONx.mjs +2 -0
  49. package/lib/{homag-intelligence-Dkz0AhB4.mjs → homag-intelligence-gb9MqBrz.mjs} +6 -3
  50. package/lib/{homag-intelligence-Dkz0AhB4.mjs.map → homag-intelligence-gb9MqBrz.mjs.map} +1 -1
  51. package/lib/{imos-ix-poc-export-helper-BjIgAfUu.mjs → imos-ix-poc-export-helper-CW7QZhhn.mjs} +3 -3
  52. package/lib/{imos-ix-poc-export-helper-BjIgAfUu.mjs.map → imos-ix-poc-export-helper-CW7QZhhn.mjs.map} +1 -1
  53. package/lib/{kernel-BAQSG9r5.mjs → kernel-C7YDLxq8.mjs} +3 -2
  54. package/lib/kernel-C7YDLxq8.mjs.map +1 -0
  55. package/lib/{kernel-utils-CfGzR_WC.mjs → kernel-utils-DCnHzW4n.mjs} +2 -2
  56. package/lib/kernel-utils-DCnHzW4n.mjs.map +1 -0
  57. package/lib/{main-DMIVdAcT.mjs → main-BJZ9-cDk.mjs} +1772 -1660
  58. package/lib/main-BJZ9-cDk.mjs.map +1 -0
  59. package/lib/{material-viewer-BkwvhHbQ.mjs → material-viewer-D8Nmpwg0.mjs} +20 -20
  60. package/lib/material-viewer-D8Nmpwg0.mjs.map +1 -0
  61. package/lib/packages-Uv53SHfb.mjs +4 -0
  62. package/lib/planner-5VarJrpy.mjs +44 -0
  63. package/lib/{planner-BPlxsTRJ.mjs.map → planner-5VarJrpy.mjs.map} +1 -1
  64. package/lib/planner-DJcn-iih.mjs +2 -0
  65. package/lib/{plugin-system-XhOJU1MI.mjs → plugin-system-DInww4H_.mjs} +3 -3
  66. package/lib/{plugin-system-XhOJU1MI.mjs.map → plugin-system-DInww4H_.mjs.map} +1 -1
  67. package/lib/{chunk-C97zSiVS.mjs → rolldown-runtime-DgwB9i60.mjs} +3 -10
  68. package/lib/roomle-headless-setup-LoBO7UJe.mjs +1150 -0
  69. package/lib/roomle-headless-setup-LoBO7UJe.mjs.map +1 -0
  70. package/lib/roomle-headless.d.ts +9910 -0
  71. package/lib/roomle-headless.js +321 -0
  72. package/lib/roomle-headless.js.map +1 -0
  73. package/lib/{roomle-renderer-BwPvUqSW.mjs → roomle-renderer-DVlJsHYn.mjs} +1 -1
  74. package/lib/{roomle-renderer-BwPvUqSW.mjs.map → roomle-renderer-DVlJsHYn.mjs.map} +1 -1
  75. package/lib/roomle-sdk.d.ts +354 -15
  76. package/lib/roomle-sdk.js +8 -7
  77. package/lib/{roomle-webgpu-renderer-CSC5zFdC.mjs → roomle-webgpu-renderer-CVxBRv6o.mjs} +46 -46
  78. package/lib/{roomle-webgpu-renderer-CSC5zFdC.mjs.map → roomle-webgpu-renderer-CVxBRv6o.mjs.map} +1 -1
  79. package/lib/{scene-renderer-DWY_zPvU.mjs → scene-renderer-BHZrQYAH.mjs} +9 -9
  80. package/lib/scene-renderer-BHZrQYAH.mjs.map +1 -0
  81. package/lib/script-loader-gpkcl1h-.mjs +86 -0
  82. package/lib/script-loader-gpkcl1h-.mjs.map +1 -0
  83. package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/package.json +1 -1
  84. package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/src/embind/configuratorCallback.d.ts +3 -3
  85. package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/src/embind/configuratorCallback.js +3 -3
  86. package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/src/embind/configuratorCallback.js.map +1 -1
  87. package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/src/embind/configuratorCoreInterface.d.ts +5 -2
  88. package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/src/embind/configuratorCoreInterface.js +1 -1
  89. package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/src/embind/configuratorCoreInterface.js.map +1 -1
  90. package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/src/embind/plannerCoreCallback.d.ts +1 -0
  91. package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/src/embind/plannerCoreCallback.js +3 -0
  92. package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/src/embind/plannerCoreCallback.js.map +1 -1
  93. package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/src/embind/plannerCoreInterface.d.ts +1 -0
  94. package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/src/embind/plannerCoreInterface.js.map +1 -1
  95. package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/src/loader/configurationLoader.d.ts +3 -2
  96. package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/src/loader/configurationLoader.js +31 -9
  97. package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/src/loader/configurationLoader.js.map +1 -1
  98. package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/src/loader/configurationManager.js +8 -1
  99. package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/src/loader/configurationManager.js.map +1 -1
  100. package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/wasm_modern/ConfiguratorKernel.wasm +0 -0
  101. package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/wasm_modern/RoomleCore.wasm +0 -0
  102. package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/wasm_modern/RoomleToolsCore.wasm +0 -0
  103. package/lib/{stats-helper-C954Cfgh.mjs → stats-helper-Cv5SoEWT.mjs} +4 -4
  104. package/lib/{stats-helper-C954Cfgh.mjs.map → stats-helper-Cv5SoEWT.mjs.map} +1 -1
  105. package/lib/{three.webgpu-0l2TztLa.mjs → three.webgpu-BbVYfCDp.mjs} +2279 -2279
  106. package/lib/{three.webgpu-0l2TztLa.mjs.map → three.webgpu-BbVYfCDp.mjs.map} +1 -1
  107. package/lib/three.webgpu-Bnp8Whu8.mjs +3 -0
  108. package/lib/threejs-utils-Bq4pVWBA.mjs +753 -0
  109. package/lib/threejs-utils-Bq4pVWBA.mjs.map +1 -0
  110. package/lib/{tools-core-BzhFD2Wk.mjs → tools-core-DqnhFefF.mjs} +6 -6
  111. package/lib/{tools-core-BzhFD2Wk.mjs.map → tools-core-DqnhFefF.mjs.map} +1 -1
  112. package/lib/workers-BJYv3y38.mjs +6 -0
  113. package/lib/workers-BJYv3y38.mjs.map +1 -0
  114. package/package.json +20 -5
  115. package/lib/configurator-CrNkzBp9.mjs +0 -2
  116. package/lib/configurator-Dx6kcXY_.mjs +0 -45
  117. package/lib/decorate-BIflHDAa.mjs.map +0 -1
  118. package/lib/glb-viewer-BqFcaUlb.mjs.map +0 -1
  119. package/lib/glb-viewer-FYw7R-ya.mjs +0 -2
  120. package/lib/kernel-BAQSG9r5.mjs.map +0 -1
  121. package/lib/kernel-utils-CfGzR_WC.mjs.map +0 -1
  122. package/lib/main-DMIVdAcT.mjs.map +0 -1
  123. package/lib/material-viewer-BkwvhHbQ.mjs.map +0 -1
  124. package/lib/planner-BPlxsTRJ.mjs +0 -44
  125. package/lib/planner-oj08ktHE.mjs +0 -2
  126. package/lib/scene-renderer-DWY_zPvU.mjs.map +0 -1
  127. package/lib/script-loader-CA-XHFKN.mjs +0 -45
  128. package/lib/script-loader-CA-XHFKN.mjs.map +0 -1
  129. package/lib/threejs-utils-8zlxt158.mjs +0 -2232
  130. package/lib/threejs-utils-8zlxt158.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"USDZExporter-B4hsiwhd.mjs","names":[],"sources":["../../../../node_modules/three/examples/jsm/exporters/USDZExporter.js"],"sourcesContent":["import {\n\tNoColorSpace,\n\tDoubleSide,\n\tColor,\n} from 'three';\n\nimport {\n\tstrToU8,\n\tzipSync,\n} from '../libs/fflate.module.js';\n\nclass USDNode {\n\n\tconstructor( name, type = '', metadata = [], properties = [] ) {\n\n\t\tthis.name = name;\n\t\tthis.type = type;\n\t\tthis.metadata = metadata;\n\t\tthis.properties = properties;\n\t\tthis.children = [];\n\n\t}\n\n\taddMetadata( key, value ) {\n\n\t\tthis.metadata.push( { key, value } );\n\n\t}\n\n\taddProperty( property, metadata = [] ) {\n\n\t\tthis.properties.push( { property, metadata } );\n\n\t}\n\n\taddChild( child ) {\n\n\t\tthis.children.push( child );\n\n\t}\n\n\ttoString( indent = 0 ) {\n\n\t\tconst pad = '\\t'.repeat( indent );\n\n\t\tconst formattedMetadata = this.metadata.map( ( item ) => {\n\n\t\t\tconst key = item.key;\n\t\t\tconst value = item.value;\n\n\t\t\tif ( Array.isArray( value ) ) {\n\n\t\t\t\tconst lines = [];\n\t\t\t\tlines.push( `${key} = {` );\n\t\t\t\tvalue.forEach( ( line ) => {\n\n\t\t\t\t\tlines.push( `${pad}\\t\\t${line}` );\n\n\t\t\t\t} );\n\t\t\t\tlines.push( `${pad}\\t}` );\n\t\t\t\treturn lines.join( '\\n' );\n\n\t\t\t} else {\n\n\t\t\t\treturn `${key} = ${value}`;\n\n\t\t\t}\n\n\t\t} );\n\n\t\tconst meta = formattedMetadata.length\n\t\t\t? ` (\\n${formattedMetadata\n\t\t\t\t.map( ( l ) => `${pad}\\t${l}` )\n\t\t\t\t.join( '\\n' )}\\n${pad})`\n\t\t\t: '';\n\n\t\tconst properties = this.properties.map( ( l ) => {\n\n\t\t\tconst property = l.property;\n\t\t\tconst metadata = l.metadata.length\n\t\t\t\t? ` (\\n${l.metadata.map( ( m ) => `${pad}\\t\\t${m}` ).join( '\\n' )}\\n${pad}\\t)`\n\t\t\t\t: '';\n\t\t\treturn `${pad}\\t${property}${metadata}`;\n\n\t\t} );\n\t\tconst children = this.children.map( ( c ) => c.toString( indent + 1 ) );\n\n\t\tconst bodyLines = [];\n\n\t\tif ( properties.length > 0 ) {\n\n\t\t\tbodyLines.push( ...properties );\n\n\t\t}\n\n\t\tif ( children.length > 0 ) {\n\n\t\t\tif ( properties.length > 0 ) {\n\n\t\t\t\tbodyLines.push( '' );\n\n\t\t\t}\n\n\t\t\tfor ( let i = 0; i < children.length; i ++ ) {\n\n\t\t\t\tbodyLines.push( children[ i ] );\n\t\t\t\tif ( i < children.length - 1 ) {\n\n\t\t\t\t\tbodyLines.push( '' );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst bodyContent = bodyLines.join( '\\n' );\n\n\t\tconst type = this.type ? this.type + ' ' : '';\n\n\t\treturn `${pad}def ${type}\"${this.name}\"${meta}\\n${pad}{\\n${bodyContent}\\n${pad}}`;\n\n\t}\n\n}\n\n/**\n * An exporter for USDZ.\n *\n * ```js\n * const exporter = new USDZExporter();\n * const arraybuffer = await exporter.parseAsync( scene );\n * ```\n *\n * @three_import import { USDZExporter } from 'three/addons/exporters/USDZExporter.js';\n */\nclass USDZExporter {\n\n\t/**\n\t * Constructs a new USDZ exporter.\n\t */\n\tconstructor() {\n\n\t\t/**\n\t\t * A reference to a texture utils module.\n\t\t *\n\t\t * @type {?(WebGLTextureUtils|WebGPUTextureUtils)}\n\t\t * @default null\n\t\t */\n\t\tthis.textureUtils = null;\n\n\t}\n\n\t/**\n\t * Sets the texture utils for this exporter. Only relevant when compressed textures have to be exported.\n\t *\n\t * Depending on whether you use {@link WebGLRenderer} or {@link WebGPURenderer}, you must inject the\n\t * corresponding texture utils {@link WebGLTextureUtils} or {@link WebGPUTextureUtils}.\n\t *\n\t * @param {WebGLTextureUtils|WebGPUTextureUtils} utils - The texture utils.\n\t */\n\tsetTextureUtils( utils ) {\n\n\t\tthis.textureUtils = utils;\n\n\t}\n\n\t/**\n\t * Parse the given 3D object and generates the USDZ output.\n\t *\n\t * @param {Object3D} scene - The 3D object to export.\n\t * @param {USDZExporter~OnDone} onDone - A callback function that is executed when the export has finished.\n\t * @param {USDZExporter~OnError} onError - A callback function that is executed when an error happens.\n\t * @param {USDZExporter~Options} options - The export options.\n\t */\n\tparse( scene, onDone, onError, options ) {\n\n\t\tthis.parseAsync( scene, options ).then( onDone ).catch( onError );\n\n\t}\n\n\t/**\n\t * Async version of {@link USDZExporter#parse}.\n\t *\n\t * @async\n\t * @param {Object3D} scene - The 3D object to export.\n\t * @param {USDZExporter~Options} options - The export options.\n\t * @return {Promise<ArrayBuffer>} A Promise that resolved with the exported USDZ data.\n\t */\n\tasync parseAsync( scene, options = {} ) {\n\n\t\toptions = Object.assign(\n\t\t\t{\n\t\t\t\tar: {\n\t\t\t\t\tanchoring: { type: 'plane' },\n\t\t\t\t\tplaneAnchoring: { alignment: 'horizontal' },\n\t\t\t\t},\n\t\t\t\tincludeAnchoringProperties: true,\n\t\t\t\tonlyVisible: true,\n\t\t\t\tquickLookCompatible: false,\n\t\t\t\tmaxTextureSize: 1024,\n\t\t\t},\n\t\t\toptions\n\t\t);\n\n\t\tconst usedNames = new Set();\n\n\t\tconst files = {};\n\t\tconst modelFileName = 'model.usda';\n\n\t\t// model file should be first in USDZ archive so we init it here\n\t\tfiles[ modelFileName ] = null;\n\n\t\tconst root = new USDNode( 'Root', 'Xform' );\n\t\tconst scenesNode = new USDNode( 'Scenes', 'Scope' );\n\t\tscenesNode.addMetadata( 'kind', '\"sceneLibrary\"' );\n\t\troot.addChild( scenesNode );\n\n\t\tconst sceneName = 'Scene';\n\t\tconst sceneNode = new USDNode( sceneName, 'Xform' );\n\t\tsceneNode.addMetadata( 'customData', [\n\t\t\t'bool preliminary_collidesWithEnvironment = 0',\n\t\t\t`string sceneName = \"${sceneName}\"`,\n\t\t] );\n\t\tsceneNode.addMetadata( 'sceneName', `\"${sceneName}\"` );\n\t\tif ( options.includeAnchoringProperties ) {\n\n\t\t\tsceneNode.addProperty(\n\t\t\t\t`token preliminary:anchoring:type = \"${options.ar.anchoring.type}\"`\n\t\t\t);\n\t\t\tsceneNode.addProperty(\n\t\t\t\t`token preliminary:planeAnchoring:alignment = \"${options.ar.planeAnchoring.alignment}\"`\n\t\t\t);\n\n\t\t}\n\n\t\tscenesNode.addChild( sceneNode );\n\n\t\tlet output;\n\n\t\tconst materials = {};\n\t\tconst textures = {};\n\n\t\tbuildHierarchy( scene, sceneNode, materials, usedNames, files, options );\n\n\t\tconst materialsNode = buildMaterials(\n\t\t\tmaterials,\n\t\t\ttextures,\n\t\t\toptions.quickLookCompatible\n\t\t);\n\n\t\toutput =\n\t\t\tbuildHeader() +\n\t\t\t'\\n' +\n\t\t\troot.toString() +\n\t\t\t'\\n\\n' +\n\t\t\tmaterialsNode.toString();\n\n\t\tfiles[ modelFileName ] = strToU8( output );\n\t\toutput = null;\n\n\t\tfor ( const id in textures ) {\n\n\t\t\tlet texture = textures[ id ];\n\n\t\t\tif ( texture.isCompressedTexture === true ) {\n\n\t\t\t\tif ( this.textureUtils === null ) {\n\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t'THREE.USDZExporter: setTextureUtils() must be called to process compressed textures.'\n\t\t\t\t\t);\n\n\t\t\t\t} else {\n\n\t\t\t\t\ttexture = await this.textureUtils.decompress( texture );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst canvas = imageToCanvas(\n\t\t\t\ttexture.image,\n\t\t\t\ttexture.flipY,\n\t\t\t\toptions.maxTextureSize\n\t\t\t);\n\t\t\tconst blob = await new Promise( ( resolve ) =>\n\t\t\t\tcanvas.toBlob( resolve, 'image/png', 1 )\n\t\t\t);\n\n\t\t\tfiles[ `textures/Texture_${id}.png` ] = new Uint8Array(\n\t\t\t\tawait blob.arrayBuffer()\n\t\t\t);\n\n\t\t}\n\n\t\t// 64 byte alignment\n\t\t// https://github.com/101arrowz/fflate/issues/39#issuecomment-777263109\n\n\t\tlet offset = 0;\n\n\t\tfor ( const filename in files ) {\n\n\t\t\tconst file = files[ filename ];\n\t\t\tconst headerSize = 34 + filename.length;\n\n\t\t\toffset += headerSize;\n\n\t\t\tconst offsetMod64 = offset & 63;\n\n\t\t\tif ( offsetMod64 !== 4 ) {\n\n\t\t\t\tconst padLength = 64 - offsetMod64;\n\t\t\t\tconst padding = new Uint8Array( padLength );\n\n\t\t\t\tfiles[ filename ] = [ file, { extra: { 12345: padding } } ];\n\n\t\t\t}\n\n\t\t\toffset = file.length;\n\n\t\t}\n\n\t\treturn zipSync( files, { level: 0 } );\n\n\t}\n\n}\n\nfunction getName( object, namesSet ) {\n\n\tlet name = object.name;\n\tname = name.replace( /[^A-Za-z0-9_]/g, '' );\n\tif ( /^[0-9]/.test( name ) ) {\n\n\t\tname = '_' + name;\n\n\t}\n\n\tif ( name === '' ) {\n\n\t\tif ( object.isCamera ) {\n\n\t\t\tname = 'Camera';\n\n\t\t} else {\n\n\t\t\tname = 'Object';\n\n\t\t}\n\n\t}\n\n\tif ( namesSet.has( name ) ) {\n\n\t\tname = name + '_' + object.id;\n\n\t}\n\n\tnamesSet.add( name );\n\n\treturn name;\n\n}\n\nfunction imageToCanvas( image, flipY, maxTextureSize ) {\n\n\tif (\n\t\t( typeof HTMLImageElement !== 'undefined' &&\n\t\t\timage instanceof HTMLImageElement ) ||\n\t\t( typeof HTMLCanvasElement !== 'undefined' &&\n\t\t\timage instanceof HTMLCanvasElement ) ||\n\t\t( typeof OffscreenCanvas !== 'undefined' &&\n\t\t\timage instanceof OffscreenCanvas ) ||\n\t\t( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap )\n\t) {\n\n\t\tconst scale = maxTextureSize / Math.max( image.width, image.height );\n\n\t\tconst canvas = document.createElement( 'canvas' );\n\t\tcanvas.width = image.width * Math.min( 1, scale );\n\t\tcanvas.height = image.height * Math.min( 1, scale );\n\n\t\tconst context = canvas.getContext( '2d' );\n\n\t\t// TODO: We should be able to do this in the UsdTransform2d?\n\n\t\tif ( flipY === true ) {\n\n\t\t\tcontext.translate( 0, canvas.height );\n\t\t\tcontext.scale( 1, - 1 );\n\n\t\t}\n\n\t\tcontext.drawImage( image, 0, 0, canvas.width, canvas.height );\n\n\t\treturn canvas;\n\n\t} else {\n\n\t\tthrow new Error(\n\t\t\t'THREE.USDZExporter: No valid image data found. Unable to process texture.'\n\t\t);\n\n\t}\n\n}\n\n//\n\nconst PRECISION = 7;\n\nfunction buildHeader() {\n\n\treturn `#usda 1.0\n(\n\tcustomLayerData = {\n\t\tstring creator = \"Three.js USDZExporter\"\n\t}\n\tdefaultPrim = \"Root\"\n\tmetersPerUnit = 1\n\tupAxis = \"Y\"\n)\n`;\n\n}\n\n// Xform\n\nfunction buildHierarchy( object, parentNode, materials, usedNames, files, options ) {\n\n\tfor ( let i = 0, l = object.children.length; i < l; i ++ ) {\n\n\t\tconst child = object.children[ i ];\n\n\t\tif ( child.visible === false && options.onlyVisible === true ) continue;\n\n\t\tlet childNode;\n\n\t\tif ( child.isMesh ) {\n\n\t\t\tconst geometry = child.geometry;\n\t\t\tconst material = child.material;\n\n\t\t\tif ( material.isMeshStandardMaterial ) {\n\n\t\t\t\tconst geometryFileName = 'geometries/Geometry_' + geometry.id + '.usda';\n\n\t\t\t\tif ( ! ( geometryFileName in files ) ) {\n\n\t\t\t\t\tconst meshObject = buildMeshObject( geometry );\n\t\t\t\t\tfiles[ geometryFileName ] = strToU8(\n\t\t\t\t\t\tbuildHeader() + '\\n' + meshObject.toString()\n\t\t\t\t\t);\n\n\t\t\t\t}\n\n\t\t\t\tif ( ! ( material.uuid in materials ) ) {\n\n\t\t\t\t\tmaterials[ material.uuid ] = material;\n\n\t\t\t\t}\n\n\t\t\t\tchildNode = buildMesh(\n\t\t\t\t\tchild,\n\t\t\t\t\tgeometry,\n\t\t\t\t\tmaterials[ material.uuid ],\n\t\t\t\t\tusedNames\n\t\t\t\t);\n\n\t\t\t} else {\n\n\t\t\t\tconsole.warn(\n\t\t\t\t\t'THREE.USDZExporter: Unsupported material type (USDZ only supports MeshStandardMaterial)',\n\t\t\t\t\tchild\n\t\t\t\t);\n\n\t\t\t}\n\n\t\t} else if ( child.isCamera ) {\n\n\t\t\tchildNode = buildCamera( child, usedNames );\n\n\t\t} else {\n\n\t\t\tchildNode = buildXform( child, usedNames );\n\n\t\t}\n\n\t\tif ( childNode ) {\n\n\t\t\tparentNode.addChild( childNode );\n\t\t\tbuildHierarchy( child, childNode, materials, usedNames, files, options );\n\n\t\t}\n\n\t}\n\n}\n\nfunction buildXform( object, usedNames ) {\n\n\tconst name = getName( object, usedNames );\n\n\tif ( object.matrix.determinant() < 0 ) {\n\n\t\tconsole.warn(\n\t\t\t'THREE.USDZExporter: USDZ does not support negative scales',\n\t\t\tobject\n\t\t);\n\n\t}\n\n\tconst node = new USDNode( name, 'Xform' );\n\n\tif ( object.pivot !== null ) {\n\n\t\t// Export with pivot using separate transform ops\n\t\tconst p = object.position;\n\t\tconst q = object.quaternion;\n\t\tconst s = object.scale;\n\t\tconst piv = object.pivot;\n\n\t\tnode.addProperty( `float3 xformOp:translate = (${p.x.toPrecision( PRECISION )}, ${p.y.toPrecision( PRECISION )}, ${p.z.toPrecision( PRECISION )})` );\n\t\tnode.addProperty( `float3 xformOp:translate:pivot = (${piv.x.toPrecision( PRECISION )}, ${piv.y.toPrecision( PRECISION )}, ${piv.z.toPrecision( PRECISION )})` );\n\t\tnode.addProperty( `quatf xformOp:orient = (${q.w.toPrecision( PRECISION )}, ${q.x.toPrecision( PRECISION )}, ${q.y.toPrecision( PRECISION )}, ${q.z.toPrecision( PRECISION )})` );\n\t\tnode.addProperty( `float3 xformOp:scale = (${s.x.toPrecision( PRECISION )}, ${s.y.toPrecision( PRECISION )}, ${s.z.toPrecision( PRECISION )})` );\n\t\tnode.addProperty( 'uniform token[] xformOpOrder = [\"xformOp:translate\", \"xformOp:translate:pivot\", \"xformOp:orient\", \"xformOp:scale\", \"!invert!xformOp:translate:pivot\"]' );\n\n\t} else {\n\n\t\t// Export as single transform matrix\n\t\tconst transform = buildMatrix( object.matrix );\n\t\tnode.addProperty( `matrix4d xformOp:transform = ${transform}` );\n\t\tnode.addProperty( 'uniform token[] xformOpOrder = [\"xformOp:transform\"]' );\n\n\t}\n\n\treturn node;\n\n}\n\nfunction buildMesh( object, geometry, material, usedNames ) {\n\n\tconst node = buildXform( object, usedNames );\n\n\tnode.addMetadata(\n\t\t'prepend references',\n\t\t`@./geometries/Geometry_${geometry.id}.usda@</Geometry>`\n\t);\n\tnode.addMetadata( 'prepend apiSchemas', '[\"MaterialBindingAPI\"]' );\n\n\tnode.addProperty(\n\t\t`rel material:binding = </Materials/Material_${material.id}>`\n\t);\n\n\treturn node;\n\n}\n\nfunction buildMatrix( matrix ) {\n\n\tconst array = matrix.elements;\n\n\treturn `( ${buildMatrixRow( array, 0 )}, ${buildMatrixRow(\n\t\tarray,\n\t\t4\n\t)}, ${buildMatrixRow( array, 8 )}, ${buildMatrixRow( array, 12 )} )`;\n\n}\n\nfunction buildMatrixRow( array, offset ) {\n\n\treturn `(${array[ offset + 0 ]}, ${array[ offset + 1 ]}, ${array[ offset + 2 ]}, ${\n\t\tarray[ offset + 3 ]\n\t})`;\n\n}\n\n// Mesh\n\nfunction buildMeshObject( geometry ) {\n\n\tconst node = new USDNode( 'Geometry' );\n\n\tconst meshNode = buildMeshNode( geometry );\n\tnode.addChild( meshNode );\n\n\treturn node;\n\n}\n\nfunction buildMeshNode( geometry ) {\n\n\tconst name = 'Geometry';\n\tconst attributes = geometry.attributes;\n\tconst count = attributes.position.count;\n\n\tconst node = new USDNode( name, 'Mesh' );\n\n\tnode.addProperty(\n\t\t`int[] faceVertexCounts = [${buildMeshVertexCount( geometry )}]`\n\t);\n\tnode.addProperty(\n\t\t`int[] faceVertexIndices = [${buildMeshVertexIndices( geometry )}]`\n\t);\n\tnode.addProperty(\n\t\t`normal3f[] normals = [${buildVector3Array( attributes.normal, count )}]`,\n\t\t[ 'interpolation = \"vertex\"' ]\n\t);\n\tnode.addProperty(\n\t\t`point3f[] points = [${buildVector3Array( attributes.position, count )}]`\n\t);\n\n\tfor ( let i = 0; i < 4; i ++ ) {\n\n\t\tconst id = i > 0 ? i : '';\n\t\tconst attribute = attributes[ 'uv' + id ];\n\t\tif ( attribute !== undefined ) {\n\n\t\t\tnode.addProperty(\n\t\t\t\t`texCoord2f[] primvars:st${id} = [${buildVector2Array( attribute )}]`,\n\t\t\t\t[ 'interpolation = \"vertex\"' ]\n\t\t\t);\n\n\t\t}\n\n\t}\n\n\tconst colorAttribute = attributes.color;\n\tif ( colorAttribute !== undefined ) {\n\n\t\tnode.addProperty(\n\t\t\t`color3f[] primvars:displayColor = [${buildVector3Array(\n\t\t\t\tcolorAttribute,\n\t\t\t\tcount\n\t\t\t)}]`,\n\t\t\t[ 'interpolation = \"vertex\"' ]\n\t\t);\n\n\t}\n\n\tnode.addProperty( 'uniform token subdivisionScheme = \"none\"' );\n\n\treturn node;\n\n}\n\nfunction buildMeshVertexCount( geometry ) {\n\n\tconst count =\n\t\tgeometry.index !== null\n\t\t\t? geometry.index.count\n\t\t\t: geometry.attributes.position.count;\n\n\treturn Array( count / 3 )\n\t\t.fill( 3 )\n\t\t.join( ', ' );\n\n}\n\nfunction buildMeshVertexIndices( geometry ) {\n\n\tconst index = geometry.index;\n\tconst array = [];\n\n\tif ( index !== null ) {\n\n\t\tfor ( let i = 0; i < index.count; i ++ ) {\n\n\t\t\tarray.push( index.getX( i ) );\n\n\t\t}\n\n\t} else {\n\n\t\tconst length = geometry.attributes.position.count;\n\n\t\tfor ( let i = 0; i < length; i ++ ) {\n\n\t\t\tarray.push( i );\n\n\t\t}\n\n\t}\n\n\treturn array.join( ', ' );\n\n}\n\nfunction buildVector3Array( attribute, count ) {\n\n\tif ( attribute === undefined ) {\n\n\t\tconsole.warn( 'USDZExporter: Normals missing.' );\n\t\treturn Array( count ).fill( '(0, 0, 0)' ).join( ', ' );\n\n\t}\n\n\tconst array = [];\n\n\tfor ( let i = 0; i < attribute.count; i ++ ) {\n\n\t\tconst x = attribute.getX( i );\n\t\tconst y = attribute.getY( i );\n\t\tconst z = attribute.getZ( i );\n\n\t\tarray.push(\n\t\t\t`(${x.toPrecision( PRECISION )}, ${y.toPrecision(\n\t\t\t\tPRECISION\n\t\t\t)}, ${z.toPrecision( PRECISION )})`\n\t\t);\n\n\t}\n\n\treturn array.join( ', ' );\n\n}\n\nfunction buildVector2Array( attribute ) {\n\n\tconst array = [];\n\n\tfor ( let i = 0; i < attribute.count; i ++ ) {\n\n\t\tconst x = attribute.getX( i );\n\t\tconst y = attribute.getY( i );\n\n\t\tarray.push(\n\t\t\t`(${x.toPrecision( PRECISION )}, ${1 - y.toPrecision( PRECISION )})`\n\t\t);\n\n\t}\n\n\treturn array.join( ', ' );\n\n}\n\n// Materials\n\nfunction buildMaterials( materials, textures, quickLookCompatible = false ) {\n\n\tconst materialsNode = new USDNode( 'Materials' );\n\n\tfor ( const uuid in materials ) {\n\n\t\tconst material = materials[ uuid ];\n\n\t\tmaterialsNode.addChild(\n\t\t\tbuildMaterial( material, textures, quickLookCompatible )\n\t\t);\n\n\t}\n\n\treturn materialsNode;\n\n}\n\nfunction buildMaterial( material, textures, quickLookCompatible = false ) {\n\n\t// https://graphics.pixar.com/usd/docs/UsdPreviewSurface-Proposal.html\n\n\tconst materialNode = new USDNode( `Material_${material.id}`, 'Material' );\n\n\tfunction buildTextureNodes( texture, mapType, color ) {\n\n\t\tconst id = texture.source.id + '_' + texture.flipY;\n\n\t\ttextures[ id ] = texture;\n\n\t\tconst uv = texture.channel > 0 ? 'st' + texture.channel : 'st';\n\n\t\tconst WRAPPINGS = {\n\t\t\t1000: 'repeat', // RepeatWrapping\n\t\t\t1001: 'clamp', // ClampToEdgeWrapping\n\t\t\t1002: 'mirror', // MirroredRepeatWrapping\n\t\t};\n\n\t\tconst repeat = texture.repeat.clone();\n\t\tconst offset = texture.offset.clone();\n\t\tconst rotation = texture.rotation;\n\n\t\t// rotation is around the wrong point. after rotation we need to shift offset again so that we're rotating around the right spot\n\t\tconst xRotationOffset = Math.sin( rotation );\n\t\tconst yRotationOffset = Math.cos( rotation );\n\n\t\t// texture coordinates start in the opposite corner, need to correct\n\t\toffset.y = 1 - offset.y - repeat.y;\n\n\t\t// turns out QuickLook is buggy and interprets texture repeat inverted/applies operations in a different order.\n\t\t// Apple Feedback: \tFB10036297 and FB11442287\n\t\tif ( quickLookCompatible ) {\n\n\t\t\t// This is NOT correct yet in QuickLook, but comes close for a range of models.\n\t\t\t// It becomes more incorrect the bigger the offset is\n\n\t\t\toffset.x = offset.x / repeat.x;\n\t\t\toffset.y = offset.y / repeat.y;\n\n\t\t\toffset.x += xRotationOffset / repeat.x;\n\t\t\toffset.y += yRotationOffset - 1;\n\n\t\t} else {\n\n\t\t\t// results match glTF results exactly. verified correct in usdview.\n\t\t\toffset.x += xRotationOffset * repeat.x;\n\t\t\toffset.y += ( 1 - yRotationOffset ) * repeat.y;\n\n\t\t}\n\n\t\tconst primvarReaderNode = new USDNode( `PrimvarReader_${mapType}`, 'Shader' );\n\t\tprimvarReaderNode.addProperty(\n\t\t\t'uniform token info:id = \"UsdPrimvarReader_float2\"'\n\t\t);\n\t\tprimvarReaderNode.addProperty( 'float2 inputs:fallback = (0.0, 0.0)' );\n\t\tprimvarReaderNode.addProperty( `string inputs:varname = \"${uv}\"` );\n\t\tprimvarReaderNode.addProperty( 'float2 outputs:result' );\n\n\t\tconst transform2dNode = new USDNode( `Transform2d_${mapType}`, 'Shader' );\n\t\ttransform2dNode.addProperty( 'uniform token info:id = \"UsdTransform2d\"' );\n\t\ttransform2dNode.addProperty(\n\t\t\t`float2 inputs:in.connect = </Materials/Material_${material.id}/PrimvarReader_${mapType}.outputs:result>`\n\t\t);\n\t\ttransform2dNode.addProperty(\n\t\t\t`float inputs:rotation = ${( rotation * ( 180 / Math.PI ) ).toFixed(\n\t\t\t\tPRECISION\n\t\t\t)}`\n\t\t);\n\t\ttransform2dNode.addProperty(\n\t\t\t`float2 inputs:scale = ${buildVector2( repeat )}`\n\t\t);\n\t\ttransform2dNode.addProperty(\n\t\t\t`float2 inputs:translation = ${buildVector2( offset )}`\n\t\t);\n\t\ttransform2dNode.addProperty( 'float2 outputs:result' );\n\n\t\tconst textureNode = new USDNode(\n\t\t\t`Texture_${texture.id}_${mapType}`,\n\t\t\t'Shader'\n\t\t);\n\t\ttextureNode.addProperty( 'uniform token info:id = \"UsdUVTexture\"' );\n\t\ttextureNode.addProperty( `asset inputs:file = @textures/Texture_${id}.png@` );\n\t\ttextureNode.addProperty(\n\t\t\t`float2 inputs:st.connect = </Materials/Material_${material.id}/Transform2d_${mapType}.outputs:result>`\n\t\t);\n\n\t\tif ( color !== undefined ) {\n\n\t\t\ttextureNode.addProperty( `float4 inputs:scale = ${buildColor4( color )}` );\n\n\t\t}\n\n\t\tif ( mapType === 'normal' ) {\n\n\t\t\ttextureNode.addProperty( 'float4 inputs:scale = (2, 2, 2, 1)' );\n\t\t\ttextureNode.addProperty( 'float4 inputs:bias = (-1, -1, -1, 0)' );\n\n\t\t}\n\n\t\ttextureNode.addProperty(\n\t\t\t`token inputs:sourceColorSpace = \"${\n\t\t\t\ttexture.colorSpace === NoColorSpace ? 'raw' : 'sRGB'\n\t\t\t}\"`\n\t\t);\n\t\ttextureNode.addProperty(\n\t\t\t`token inputs:wrapS = \"${WRAPPINGS[ texture.wrapS ]}\"`\n\t\t);\n\t\ttextureNode.addProperty(\n\t\t\t`token inputs:wrapT = \"${WRAPPINGS[ texture.wrapT ]}\"`\n\t\t);\n\t\ttextureNode.addProperty( 'float outputs:r' );\n\t\ttextureNode.addProperty( 'float outputs:g' );\n\t\ttextureNode.addProperty( 'float outputs:b' );\n\t\ttextureNode.addProperty( 'float3 outputs:rgb' );\n\n\t\tif ( material.transparent || material.alphaTest > 0.0 ) {\n\n\t\t\ttextureNode.addProperty( 'float outputs:a' );\n\n\t\t}\n\n\t\treturn [ primvarReaderNode, transform2dNode, textureNode ];\n\n\t}\n\n\tif ( material.side === DoubleSide ) {\n\n\t\tconsole.warn(\n\t\t\t'THREE.USDZExporter: USDZ does not support double sided materials',\n\t\t\tmaterial\n\t\t);\n\n\t}\n\n\tconst previewSurfaceNode = new USDNode( 'PreviewSurface', 'Shader' );\n\tpreviewSurfaceNode.addProperty( 'uniform token info:id = \"UsdPreviewSurface\"' );\n\n\tif ( material.map !== null ) {\n\n\t\tpreviewSurfaceNode.addProperty(\n\t\t\t`color3f inputs:diffuseColor.connect = </Materials/Material_${material.id}/Texture_${material.map.id}_diffuse.outputs:rgb>`\n\t\t);\n\n\t\tif ( material.transparent ) {\n\n\t\t\tpreviewSurfaceNode.addProperty(\n\t\t\t\t`float inputs:opacity.connect = </Materials/Material_${material.id}/Texture_${material.map.id}_diffuse.outputs:a>`\n\t\t\t);\n\n\t\t} else if ( material.alphaTest > 0.0 ) {\n\n\t\t\tpreviewSurfaceNode.addProperty(\n\t\t\t\t`float inputs:opacity.connect = </Materials/Material_${material.id}/Texture_${material.map.id}_diffuse.outputs:a>`\n\t\t\t);\n\t\t\tpreviewSurfaceNode.addProperty(\n\t\t\t\t`float inputs:opacityThreshold = ${material.alphaTest}`\n\t\t\t);\n\n\t\t}\n\n\t\tconst textureNodes = buildTextureNodes(\n\t\t\tmaterial.map,\n\t\t\t'diffuse',\n\t\t\tmaterial.color\n\t\t);\n\t\ttextureNodes.forEach( ( node ) => materialNode.addChild( node ) );\n\n\t} else {\n\n\t\tpreviewSurfaceNode.addProperty(\n\t\t\t`color3f inputs:diffuseColor = ${buildColor( material.color )}`\n\t\t);\n\n\t}\n\n\tif ( material.emissiveMap !== null ) {\n\n\t\tpreviewSurfaceNode.addProperty(\n\t\t\t`color3f inputs:emissiveColor.connect = </Materials/Material_${material.id}/Texture_${material.emissiveMap.id}_emissive.outputs:rgb>`\n\t\t);\n\n\t\tconst emissiveColor = new Color(\n\t\t\tmaterial.emissive.r * material.emissiveIntensity,\n\t\t\tmaterial.emissive.g * material.emissiveIntensity,\n\t\t\tmaterial.emissive.b * material.emissiveIntensity\n\t\t);\n\t\tconst textureNodes = buildTextureNodes(\n\t\t\tmaterial.emissiveMap,\n\t\t\t'emissive',\n\t\t\temissiveColor\n\t\t);\n\t\ttextureNodes.forEach( ( node ) => materialNode.addChild( node ) );\n\n\t} else if ( material.emissive.getHex() > 0 ) {\n\n\t\tpreviewSurfaceNode.addProperty(\n\t\t\t`color3f inputs:emissiveColor = ${buildColor( material.emissive )}`\n\t\t);\n\n\t}\n\n\tif ( material.normalMap !== null ) {\n\n\t\tpreviewSurfaceNode.addProperty(\n\t\t\t`normal3f inputs:normal.connect = </Materials/Material_${material.id}/Texture_${material.normalMap.id}_normal.outputs:rgb>`\n\t\t);\n\n\t\tconst textureNodes = buildTextureNodes( material.normalMap, 'normal' );\n\t\ttextureNodes.forEach( ( node ) => materialNode.addChild( node ) );\n\n\t}\n\n\tif ( material.aoMap !== null ) {\n\n\t\tpreviewSurfaceNode.addProperty(\n\t\t\t`float inputs:occlusion.connect = </Materials/Material_${material.id}/Texture_${material.aoMap.id}_occlusion.outputs:r>`\n\t\t);\n\n\t\tconst aoColor = new Color(\n\t\t\tmaterial.aoMapIntensity,\n\t\t\tmaterial.aoMapIntensity,\n\t\t\tmaterial.aoMapIntensity\n\t\t);\n\t\tconst textureNodes = buildTextureNodes(\n\t\t\tmaterial.aoMap,\n\t\t\t'occlusion',\n\t\t\taoColor\n\t\t);\n\t\ttextureNodes.forEach( ( node ) => materialNode.addChild( node ) );\n\n\t}\n\n\tif ( material.roughnessMap !== null ) {\n\n\t\tpreviewSurfaceNode.addProperty(\n\t\t\t`float inputs:roughness.connect = </Materials/Material_${material.id}/Texture_${material.roughnessMap.id}_roughness.outputs:g>`\n\t\t);\n\n\t\tconst roughnessColor = new Color(\n\t\t\tmaterial.roughness,\n\t\t\tmaterial.roughness,\n\t\t\tmaterial.roughness\n\t\t);\n\t\tconst textureNodes = buildTextureNodes(\n\t\t\tmaterial.roughnessMap,\n\t\t\t'roughness',\n\t\t\troughnessColor\n\t\t);\n\t\ttextureNodes.forEach( ( node ) => materialNode.addChild( node ) );\n\n\t} else {\n\n\t\tpreviewSurfaceNode.addProperty(\n\t\t\t`float inputs:roughness = ${material.roughness}`\n\t\t);\n\n\t}\n\n\tif ( material.metalnessMap !== null ) {\n\n\t\tpreviewSurfaceNode.addProperty(\n\t\t\t`float inputs:metallic.connect = </Materials/Material_${material.id}/Texture_${material.metalnessMap.id}_metallic.outputs:b>`\n\t\t);\n\n\t\tconst metalnessColor = new Color(\n\t\t\tmaterial.metalness,\n\t\t\tmaterial.metalness,\n\t\t\tmaterial.metalness\n\t\t);\n\t\tconst textureNodes = buildTextureNodes(\n\t\t\tmaterial.metalnessMap,\n\t\t\t'metallic',\n\t\t\tmetalnessColor\n\t\t);\n\t\ttextureNodes.forEach( ( node ) => materialNode.addChild( node ) );\n\n\t} else {\n\n\t\tpreviewSurfaceNode.addProperty(\n\t\t\t`float inputs:metallic = ${material.metalness}`\n\t\t);\n\n\t}\n\n\tif ( material.alphaMap !== null ) {\n\n\t\tpreviewSurfaceNode.addProperty(\n\t\t\t`float inputs:opacity.connect = </Materials/Material_${material.id}/Texture_${material.alphaMap.id}_opacity.outputs:r>`\n\t\t);\n\t\tpreviewSurfaceNode.addProperty( 'float inputs:opacityThreshold = 0.0001' );\n\n\t\tconst textureNodes = buildTextureNodes( material.alphaMap, 'opacity' );\n\t\ttextureNodes.forEach( ( node ) => materialNode.addChild( node ) );\n\n\t} else {\n\n\t\tpreviewSurfaceNode.addProperty(\n\t\t\t`float inputs:opacity = ${material.opacity}`\n\t\t);\n\n\t}\n\n\tif ( material.isMeshPhysicalMaterial ) {\n\n\t\tif ( material.clearcoatMap !== null ) {\n\n\t\t\tpreviewSurfaceNode.addProperty(\n\t\t\t\t`float inputs:clearcoat.connect = </Materials/Material_${material.id}/Texture_${material.clearcoatMap.id}_clearcoat.outputs:r>`\n\t\t\t);\n\n\t\t\tconst clearcoatColor = new Color(\n\t\t\t\tmaterial.clearcoat,\n\t\t\t\tmaterial.clearcoat,\n\t\t\t\tmaterial.clearcoat\n\t\t\t);\n\t\t\tconst textureNodes = buildTextureNodes(\n\t\t\t\tmaterial.clearcoatMap,\n\t\t\t\t'clearcoat',\n\t\t\t\tclearcoatColor\n\t\t\t);\n\t\t\ttextureNodes.forEach( ( node ) => materialNode.addChild( node ) );\n\n\t\t} else {\n\n\t\t\tpreviewSurfaceNode.addProperty(\n\t\t\t\t`float inputs:clearcoat = ${material.clearcoat}`\n\t\t\t);\n\n\t\t}\n\n\t\tif ( material.clearcoatRoughnessMap !== null ) {\n\n\t\t\tpreviewSurfaceNode.addProperty(\n\t\t\t\t`float inputs:clearcoatRoughness.connect = </Materials/Material_${material.id}/Texture_${material.clearcoatRoughnessMap.id}_clearcoatRoughness.outputs:g>`\n\t\t\t);\n\n\t\t\tconst clearcoatRoughnessColor = new Color(\n\t\t\t\tmaterial.clearcoatRoughness,\n\t\t\t\tmaterial.clearcoatRoughness,\n\t\t\t\tmaterial.clearcoatRoughness\n\t\t\t);\n\t\t\tconst textureNodes = buildTextureNodes(\n\t\t\t\tmaterial.clearcoatRoughnessMap,\n\t\t\t\t'clearcoatRoughness',\n\t\t\t\tclearcoatRoughnessColor\n\t\t\t);\n\t\t\ttextureNodes.forEach( ( node ) => materialNode.addChild( node ) );\n\n\t\t} else {\n\n\t\t\tpreviewSurfaceNode.addProperty(\n\t\t\t\t`float inputs:clearcoatRoughness = ${material.clearcoatRoughness}`\n\t\t\t);\n\n\t\t}\n\n\t\tpreviewSurfaceNode.addProperty( `float inputs:ior = ${material.ior}` );\n\n\t}\n\n\tpreviewSurfaceNode.addProperty( 'int inputs:useSpecularWorkflow = 0' );\n\tpreviewSurfaceNode.addProperty( 'token outputs:surface' );\n\n\tmaterialNode.addChild( previewSurfaceNode );\n\n\tmaterialNode.addProperty(\n\t\t`token outputs:surface.connect = </Materials/Material_${material.id}/PreviewSurface.outputs:surface>`\n\t);\n\n\treturn materialNode;\n\n}\n\nfunction buildColor( color ) {\n\n\treturn `(${color.r}, ${color.g}, ${color.b})`;\n\n}\n\nfunction buildColor4( color ) {\n\n\treturn `(${color.r}, ${color.g}, ${color.b}, 1.0)`;\n\n}\n\nfunction buildVector2( vector ) {\n\n\treturn `(${vector.x}, ${vector.y})`;\n\n}\n\nfunction buildCamera( camera, usedNames ) {\n\n\tconst name = getName( camera, usedNames );\n\n\tconst transform = buildMatrix( camera.matrix );\n\n\tif ( camera.matrix.determinant() < 0 ) {\n\n\t\tconsole.warn(\n\t\t\t'THREE.USDZExporter: USDZ does not support negative scales',\n\t\t\tcamera\n\t\t);\n\n\t}\n\n\tconst node = new USDNode( name, 'Camera' );\n\tnode.addProperty( `matrix4d xformOp:transform = ${transform}` );\n\tnode.addProperty( 'uniform token[] xformOpOrder = [\"xformOp:transform\"]' );\n\n\tconst projection = camera.isOrthographicCamera\n\t\t? 'orthographic'\n\t\t: 'perspective';\n\tnode.addProperty( `token projection = \"${projection}\"` );\n\n\tconst clippingRange = `(${camera.near.toPrecision(\n\t\tPRECISION\n\t)}, ${camera.far.toPrecision( PRECISION )})`;\n\tnode.addProperty( `float2 clippingRange = ${clippingRange}` );\n\n\tlet horizontalAperture;\n\tif ( camera.isOrthographicCamera ) {\n\n\t\thorizontalAperture = (\n\t\t\t( Math.abs( camera.left ) + Math.abs( camera.right ) ) *\n\t\t\t10\n\t\t).toPrecision( PRECISION );\n\n\t} else {\n\n\t\thorizontalAperture = camera.getFilmWidth().toPrecision( PRECISION );\n\n\t}\n\n\tnode.addProperty( `float horizontalAperture = ${horizontalAperture}` );\n\n\tlet verticalAperture;\n\tif ( camera.isOrthographicCamera ) {\n\n\t\tverticalAperture = (\n\t\t\t( Math.abs( camera.top ) + Math.abs( camera.bottom ) ) *\n\t\t\t10\n\t\t).toPrecision( PRECISION );\n\n\t} else {\n\n\t\tverticalAperture = camera.getFilmHeight().toPrecision( PRECISION );\n\n\t}\n\n\tnode.addProperty( `float verticalAperture = ${verticalAperture}` );\n\n\tif ( camera.isPerspectiveCamera ) {\n\n\t\tconst focalLength = camera.getFocalLength().toPrecision( PRECISION );\n\t\tnode.addProperty( `float focalLength = ${focalLength}` );\n\n\t\tconst focusDistance = camera.focus.toPrecision( PRECISION );\n\t\tnode.addProperty( `float focusDistance = ${focusDistance}` );\n\n\t}\n\n\treturn node;\n\n}\n\n/**\n * Export options of `USDZExporter`.\n *\n * @typedef {Object} USDZExporter~Options\n * @property {number} [maxTextureSize=1024] - The maximum texture size that is going to be exported.\n * @property {boolean} [includeAnchoringProperties=true] - Whether to include anchoring properties or not.\n * @property {boolean} [onlyVisible=true] - Export only visible 3D objects.\n * @property {Object} [ar] - If `includeAnchoringProperties` is set to `true`, the anchoring type and alignment\n * can be configured via `ar.anchoring.type` and `ar.planeAnchoring.alignment`.\n * @property {boolean} [quickLookCompatible=false] - Whether to make the exported USDZ compatible to QuickLook\n * which means the asset is modified to accommodate the bugs FB10036297 and FB11442287 (Apple Feedback).\n **/\n\n/**\n * onDone callback of `USDZExporter`.\n *\n * @callback USDZExporter~OnDone\n * @param {ArrayBuffer} result - The generated USDZ.\n */\n\n/**\n * onError callback of `USDZExporter`.\n *\n * @callback USDZExporter~OnError\n * @param {Error} error - The error object.\n */\n\nexport { USDZExporter };\n"],"x_google_ignoreList":[0],"mappings":";;;AAWA,IAAM,IAAN,MAAc;CAEb,YAAa,GAAM,IAAO,IAAI,IAAW,EAAE,EAAE,IAAa,EAAE,EAAG;AAM9D,EAJA,KAAK,OAAO,GACZ,KAAK,OAAO,GACZ,KAAK,WAAW,GAChB,KAAK,aAAa,GAClB,KAAK,WAAW,EAAE;;CAInB,YAAa,GAAK,GAAQ;AAEzB,OAAK,SAAS,KAAM;GAAE;GAAK;GAAO,CAAE;;CAIrC,YAAa,GAAU,IAAW,EAAE,EAAG;AAEtC,OAAK,WAAW,KAAM;GAAE;GAAU;GAAU,CAAE;;CAI/C,SAAU,GAAQ;AAEjB,OAAK,SAAS,KAAM,EAAO;;CAI5B,SAAU,IAAS,GAAI;EA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a,EAAW,GAIP,EAAO,eAAe,CAAC,YAAa,EAAW,EAInE,EAAK,YAAa,4BAA4B,IAAoB,EAE7D,EAAO,qBAAsB;EAEjC,IAAM,IAAc,EAAO,gBAAgB,CAAC,YAAa,EAAW;AACpE,IAAK,YAAa,uBAAuB,IAAe;EAExD,IAAM,IAAgB,EAAO,MAAM,YAAa,EAAW;AAC3D,IAAK,YAAa,yBAAyB,IAAiB;;AAI7D,QAAO"}
1
+ {"version":3,"file":"USDZExporter-BBk0APeK.mjs","names":[],"sources":["../../../../node_modules/three/examples/jsm/exporters/USDZExporter.js"],"sourcesContent":["import {\n\tNoColorSpace,\n\tDoubleSide,\n\tColor,\n} from 'three';\n\nimport {\n\tstrToU8,\n\tzipSync,\n} from '../libs/fflate.module.js';\n\nclass USDNode {\n\n\tconstructor( name, type = '', metadata = [], properties = [] ) {\n\n\t\tthis.name = name;\n\t\tthis.type = type;\n\t\tthis.metadata = metadata;\n\t\tthis.properties = properties;\n\t\tthis.children = [];\n\n\t}\n\n\taddMetadata( key, value ) {\n\n\t\tthis.metadata.push( { key, value } );\n\n\t}\n\n\taddProperty( property, metadata = [] ) {\n\n\t\tthis.properties.push( { property, metadata } );\n\n\t}\n\n\taddChild( child ) {\n\n\t\tthis.children.push( child );\n\n\t}\n\n\ttoString( indent = 0 ) {\n\n\t\tconst pad = '\\t'.repeat( indent );\n\n\t\tconst formattedMetadata = this.metadata.map( ( item ) => {\n\n\t\t\tconst key = item.key;\n\t\t\tconst value = item.value;\n\n\t\t\tif ( Array.isArray( value ) ) {\n\n\t\t\t\tconst lines = [];\n\t\t\t\tlines.push( `${key} = {` );\n\t\t\t\tvalue.forEach( ( line ) => {\n\n\t\t\t\t\tlines.push( `${pad}\\t\\t${line}` );\n\n\t\t\t\t} );\n\t\t\t\tlines.push( `${pad}\\t}` );\n\t\t\t\treturn lines.join( '\\n' );\n\n\t\t\t} else {\n\n\t\t\t\treturn `${key} = ${value}`;\n\n\t\t\t}\n\n\t\t} );\n\n\t\tconst meta = formattedMetadata.length\n\t\t\t? ` (\\n${formattedMetadata\n\t\t\t\t.map( ( l ) => `${pad}\\t${l}` )\n\t\t\t\t.join( '\\n' )}\\n${pad})`\n\t\t\t: '';\n\n\t\tconst properties = this.properties.map( ( l ) => {\n\n\t\t\tconst property = l.property;\n\t\t\tconst metadata = l.metadata.length\n\t\t\t\t? ` (\\n${l.metadata.map( ( m ) => `${pad}\\t\\t${m}` ).join( '\\n' )}\\n${pad}\\t)`\n\t\t\t\t: '';\n\t\t\treturn `${pad}\\t${property}${metadata}`;\n\n\t\t} );\n\t\tconst children = this.children.map( ( c ) => c.toString( indent + 1 ) );\n\n\t\tconst bodyLines = [];\n\n\t\tif ( properties.length > 0 ) {\n\n\t\t\tbodyLines.push( ...properties );\n\n\t\t}\n\n\t\tif ( children.length > 0 ) {\n\n\t\t\tif ( properties.length > 0 ) {\n\n\t\t\t\tbodyLines.push( '' );\n\n\t\t\t}\n\n\t\t\tfor ( let i = 0; i < children.length; i ++ ) {\n\n\t\t\t\tbodyLines.push( children[ i ] );\n\t\t\t\tif ( i < children.length - 1 ) {\n\n\t\t\t\t\tbodyLines.push( '' );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst bodyContent = bodyLines.join( '\\n' );\n\n\t\tconst type = this.type ? this.type + ' ' : '';\n\n\t\treturn `${pad}def ${type}\"${this.name}\"${meta}\\n${pad}{\\n${bodyContent}\\n${pad}}`;\n\n\t}\n\n}\n\n/**\n * An exporter for USDZ.\n *\n * ```js\n * const exporter = new USDZExporter();\n * const arraybuffer = await exporter.parseAsync( scene );\n * ```\n *\n * @three_import import { USDZExporter } from 'three/addons/exporters/USDZExporter.js';\n */\nclass USDZExporter {\n\n\t/**\n\t * Constructs a new USDZ exporter.\n\t */\n\tconstructor() {\n\n\t\t/**\n\t\t * A reference to a texture utils module.\n\t\t *\n\t\t * @type {?(WebGLTextureUtils|WebGPUTextureUtils)}\n\t\t * @default null\n\t\t */\n\t\tthis.textureUtils = null;\n\n\t}\n\n\t/**\n\t * Sets the texture utils for this exporter. Only relevant when compressed textures have to be exported.\n\t *\n\t * Depending on whether you use {@link WebGLRenderer} or {@link WebGPURenderer}, you must inject the\n\t * corresponding texture utils {@link WebGLTextureUtils} or {@link WebGPUTextureUtils}.\n\t *\n\t * @param {WebGLTextureUtils|WebGPUTextureUtils} utils - The texture utils.\n\t */\n\tsetTextureUtils( utils ) {\n\n\t\tthis.textureUtils = utils;\n\n\t}\n\n\t/**\n\t * Parse the given 3D object and generates the USDZ output.\n\t *\n\t * @param {Object3D} scene - The 3D object to export.\n\t * @param {USDZExporter~OnDone} onDone - A callback function that is executed when the export has finished.\n\t * @param {USDZExporter~OnError} onError - A callback function that is executed when an error happens.\n\t * @param {USDZExporter~Options} options - The export options.\n\t */\n\tparse( scene, onDone, onError, options ) {\n\n\t\tthis.parseAsync( scene, options ).then( onDone ).catch( onError );\n\n\t}\n\n\t/**\n\t * Async version of {@link USDZExporter#parse}.\n\t *\n\t * @async\n\t * @param {Object3D} scene - The 3D object to export.\n\t * @param {USDZExporter~Options} options - The export options.\n\t * @return {Promise<ArrayBuffer>} A Promise that resolved with the exported USDZ data.\n\t */\n\tasync parseAsync( scene, options = {} ) {\n\n\t\toptions = Object.assign(\n\t\t\t{\n\t\t\t\tar: {\n\t\t\t\t\tanchoring: { type: 'plane' },\n\t\t\t\t\tplaneAnchoring: { alignment: 'horizontal' },\n\t\t\t\t},\n\t\t\t\tincludeAnchoringProperties: true,\n\t\t\t\tonlyVisible: true,\n\t\t\t\tquickLookCompatible: false,\n\t\t\t\tmaxTextureSize: 1024,\n\t\t\t},\n\t\t\toptions\n\t\t);\n\n\t\tconst usedNames = new Set();\n\n\t\tconst files = {};\n\t\tconst modelFileName = 'model.usda';\n\n\t\t// model file should be first in USDZ archive so we init it here\n\t\tfiles[ modelFileName ] = null;\n\n\t\tconst root = new USDNode( 'Root', 'Xform' );\n\t\tconst scenesNode = new USDNode( 'Scenes', 'Scope' );\n\t\tscenesNode.addMetadata( 'kind', '\"sceneLibrary\"' );\n\t\troot.addChild( scenesNode );\n\n\t\tconst sceneName = 'Scene';\n\t\tconst sceneNode = new USDNode( sceneName, 'Xform' );\n\t\tsceneNode.addMetadata( 'customData', [\n\t\t\t'bool preliminary_collidesWithEnvironment = 0',\n\t\t\t`string sceneName = \"${sceneName}\"`,\n\t\t] );\n\t\tsceneNode.addMetadata( 'sceneName', `\"${sceneName}\"` );\n\t\tif ( options.includeAnchoringProperties ) {\n\n\t\t\tsceneNode.addProperty(\n\t\t\t\t`token preliminary:anchoring:type = \"${options.ar.anchoring.type}\"`\n\t\t\t);\n\t\t\tsceneNode.addProperty(\n\t\t\t\t`token preliminary:planeAnchoring:alignment = \"${options.ar.planeAnchoring.alignment}\"`\n\t\t\t);\n\n\t\t}\n\n\t\tscenesNode.addChild( sceneNode );\n\n\t\tlet output;\n\n\t\tconst materials = {};\n\t\tconst textures = {};\n\n\t\tbuildHierarchy( scene, sceneNode, materials, usedNames, files, options );\n\n\t\tconst materialsNode = buildMaterials(\n\t\t\tmaterials,\n\t\t\ttextures,\n\t\t\toptions.quickLookCompatible\n\t\t);\n\n\t\toutput =\n\t\t\tbuildHeader() +\n\t\t\t'\\n' +\n\t\t\troot.toString() +\n\t\t\t'\\n\\n' +\n\t\t\tmaterialsNode.toString();\n\n\t\tfiles[ modelFileName ] = strToU8( output );\n\t\toutput = null;\n\n\t\tfor ( const id in textures ) {\n\n\t\t\tlet texture = textures[ id ];\n\n\t\t\tif ( texture.isCompressedTexture === true ) {\n\n\t\t\t\tif ( this.textureUtils === null ) {\n\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t'THREE.USDZExporter: setTextureUtils() must be called to process compressed textures.'\n\t\t\t\t\t);\n\n\t\t\t\t} else {\n\n\t\t\t\t\ttexture = await this.textureUtils.decompress( texture );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst canvas = imageToCanvas(\n\t\t\t\ttexture.image,\n\t\t\t\ttexture.flipY,\n\t\t\t\toptions.maxTextureSize\n\t\t\t);\n\t\t\tconst blob = await new Promise( ( resolve ) =>\n\t\t\t\tcanvas.toBlob( resolve, 'image/png', 1 )\n\t\t\t);\n\n\t\t\tfiles[ `textures/Texture_${id}.png` ] = new Uint8Array(\n\t\t\t\tawait blob.arrayBuffer()\n\t\t\t);\n\n\t\t}\n\n\t\t// 64 byte alignment\n\t\t// https://github.com/101arrowz/fflate/issues/39#issuecomment-777263109\n\n\t\tlet offset = 0;\n\n\t\tfor ( const filename in files ) {\n\n\t\t\tconst file = files[ filename ];\n\t\t\tconst headerSize = 34 + filename.length;\n\n\t\t\toffset += headerSize;\n\n\t\t\tconst offsetMod64 = offset & 63;\n\n\t\t\tif ( offsetMod64 !== 4 ) {\n\n\t\t\t\tconst padLength = 64 - offsetMod64;\n\t\t\t\tconst padding = new Uint8Array( padLength );\n\n\t\t\t\tfiles[ filename ] = [ file, { extra: { 12345: padding } } ];\n\n\t\t\t}\n\n\t\t\toffset = file.length;\n\n\t\t}\n\n\t\treturn zipSync( files, { level: 0 } );\n\n\t}\n\n}\n\nfunction getName( object, namesSet ) {\n\n\tlet name = object.name;\n\tname = name.replace( /[^A-Za-z0-9_]/g, '' );\n\tif ( /^[0-9]/.test( name ) ) {\n\n\t\tname = '_' + name;\n\n\t}\n\n\tif ( name === '' ) {\n\n\t\tif ( object.isCamera ) {\n\n\t\t\tname = 'Camera';\n\n\t\t} else {\n\n\t\t\tname = 'Object';\n\n\t\t}\n\n\t}\n\n\tif ( namesSet.has( name ) ) {\n\n\t\tname = name + '_' + object.id;\n\n\t}\n\n\tnamesSet.add( name );\n\n\treturn name;\n\n}\n\nfunction imageToCanvas( image, flipY, maxTextureSize ) {\n\n\tif (\n\t\t( typeof HTMLImageElement !== 'undefined' &&\n\t\t\timage instanceof HTMLImageElement ) ||\n\t\t( typeof HTMLCanvasElement !== 'undefined' &&\n\t\t\timage instanceof HTMLCanvasElement ) ||\n\t\t( typeof OffscreenCanvas !== 'undefined' &&\n\t\t\timage instanceof OffscreenCanvas ) ||\n\t\t( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap )\n\t) {\n\n\t\tconst scale = maxTextureSize / Math.max( image.width, image.height );\n\n\t\tconst canvas = document.createElement( 'canvas' );\n\t\tcanvas.width = image.width * Math.min( 1, scale );\n\t\tcanvas.height = image.height * Math.min( 1, scale );\n\n\t\tconst context = canvas.getContext( '2d' );\n\n\t\t// TODO: We should be able to do this in the UsdTransform2d?\n\n\t\tif ( flipY === true ) {\n\n\t\t\tcontext.translate( 0, canvas.height );\n\t\t\tcontext.scale( 1, - 1 );\n\n\t\t}\n\n\t\tcontext.drawImage( image, 0, 0, canvas.width, canvas.height );\n\n\t\treturn canvas;\n\n\t} else {\n\n\t\tthrow new Error(\n\t\t\t'THREE.USDZExporter: No valid image data found. Unable to process texture.'\n\t\t);\n\n\t}\n\n}\n\n//\n\nconst PRECISION = 7;\n\nfunction buildHeader() {\n\n\treturn `#usda 1.0\n(\n\tcustomLayerData = {\n\t\tstring creator = \"Three.js USDZExporter\"\n\t}\n\tdefaultPrim = \"Root\"\n\tmetersPerUnit = 1\n\tupAxis = \"Y\"\n)\n`;\n\n}\n\n// Xform\n\nfunction buildHierarchy( object, parentNode, materials, usedNames, files, options ) {\n\n\tfor ( let i = 0, l = object.children.length; i < l; i ++ ) {\n\n\t\tconst child = object.children[ i ];\n\n\t\tif ( child.visible === false && options.onlyVisible === true ) continue;\n\n\t\tlet childNode;\n\n\t\tif ( child.isMesh ) {\n\n\t\t\tconst geometry = child.geometry;\n\t\t\tconst material = child.material;\n\n\t\t\tif ( material.isMeshStandardMaterial ) {\n\n\t\t\t\tconst geometryFileName = 'geometries/Geometry_' + geometry.id + '.usda';\n\n\t\t\t\tif ( ! ( geometryFileName in files ) ) {\n\n\t\t\t\t\tconst meshObject = buildMeshObject( geometry );\n\t\t\t\t\tfiles[ geometryFileName ] = strToU8(\n\t\t\t\t\t\tbuildHeader() + '\\n' + meshObject.toString()\n\t\t\t\t\t);\n\n\t\t\t\t}\n\n\t\t\t\tif ( ! ( material.uuid in materials ) ) {\n\n\t\t\t\t\tmaterials[ material.uuid ] = material;\n\n\t\t\t\t}\n\n\t\t\t\tchildNode = buildMesh(\n\t\t\t\t\tchild,\n\t\t\t\t\tgeometry,\n\t\t\t\t\tmaterials[ material.uuid ],\n\t\t\t\t\tusedNames\n\t\t\t\t);\n\n\t\t\t} else {\n\n\t\t\t\tconsole.warn(\n\t\t\t\t\t'THREE.USDZExporter: Unsupported material type (USDZ only supports MeshStandardMaterial)',\n\t\t\t\t\tchild\n\t\t\t\t);\n\n\t\t\t}\n\n\t\t} else if ( child.isCamera ) {\n\n\t\t\tchildNode = buildCamera( child, usedNames );\n\n\t\t} else {\n\n\t\t\tchildNode = buildXform( child, usedNames );\n\n\t\t}\n\n\t\tif ( childNode ) {\n\n\t\t\tparentNode.addChild( childNode );\n\t\t\tbuildHierarchy( child, childNode, materials, usedNames, files, options );\n\n\t\t}\n\n\t}\n\n}\n\nfunction buildXform( object, usedNames ) {\n\n\tconst name = getName( object, usedNames );\n\n\tif ( object.matrix.determinant() < 0 ) {\n\n\t\tconsole.warn(\n\t\t\t'THREE.USDZExporter: USDZ does not support negative scales',\n\t\t\tobject\n\t\t);\n\n\t}\n\n\tconst node = new USDNode( name, 'Xform' );\n\n\tif ( object.pivot !== null ) {\n\n\t\t// Export with pivot using separate transform ops\n\t\tconst p = object.position;\n\t\tconst q = object.quaternion;\n\t\tconst s = object.scale;\n\t\tconst piv = object.pivot;\n\n\t\tnode.addProperty( `float3 xformOp:translate = (${p.x.toPrecision( PRECISION )}, ${p.y.toPrecision( PRECISION )}, ${p.z.toPrecision( PRECISION )})` );\n\t\tnode.addProperty( `float3 xformOp:translate:pivot = (${piv.x.toPrecision( PRECISION )}, ${piv.y.toPrecision( PRECISION )}, ${piv.z.toPrecision( PRECISION )})` );\n\t\tnode.addProperty( `quatf xformOp:orient = (${q.w.toPrecision( PRECISION )}, ${q.x.toPrecision( PRECISION )}, ${q.y.toPrecision( PRECISION )}, ${q.z.toPrecision( PRECISION )})` );\n\t\tnode.addProperty( `float3 xformOp:scale = (${s.x.toPrecision( PRECISION )}, ${s.y.toPrecision( PRECISION )}, ${s.z.toPrecision( PRECISION )})` );\n\t\tnode.addProperty( 'uniform token[] xformOpOrder = [\"xformOp:translate\", \"xformOp:translate:pivot\", \"xformOp:orient\", \"xformOp:scale\", \"!invert!xformOp:translate:pivot\"]' );\n\n\t} else {\n\n\t\t// Export as single transform matrix\n\t\tconst transform = buildMatrix( object.matrix );\n\t\tnode.addProperty( `matrix4d xformOp:transform = ${transform}` );\n\t\tnode.addProperty( 'uniform token[] xformOpOrder = [\"xformOp:transform\"]' );\n\n\t}\n\n\treturn node;\n\n}\n\nfunction buildMesh( object, geometry, material, usedNames ) {\n\n\tconst node = buildXform( object, usedNames );\n\n\tnode.addMetadata(\n\t\t'prepend references',\n\t\t`@./geometries/Geometry_${geometry.id}.usda@</Geometry>`\n\t);\n\tnode.addMetadata( 'prepend apiSchemas', '[\"MaterialBindingAPI\"]' );\n\n\tnode.addProperty(\n\t\t`rel material:binding = </Materials/Material_${material.id}>`\n\t);\n\n\treturn node;\n\n}\n\nfunction buildMatrix( matrix ) {\n\n\tconst array = matrix.elements;\n\n\treturn `( ${buildMatrixRow( array, 0 )}, ${buildMatrixRow(\n\t\tarray,\n\t\t4\n\t)}, ${buildMatrixRow( array, 8 )}, ${buildMatrixRow( array, 12 )} )`;\n\n}\n\nfunction buildMatrixRow( array, offset ) {\n\n\treturn `(${array[ offset + 0 ]}, ${array[ offset + 1 ]}, ${array[ offset + 2 ]}, ${\n\t\tarray[ offset + 3 ]\n\t})`;\n\n}\n\n// Mesh\n\nfunction buildMeshObject( geometry ) {\n\n\tconst node = new USDNode( 'Geometry' );\n\n\tconst meshNode = buildMeshNode( geometry );\n\tnode.addChild( meshNode );\n\n\treturn node;\n\n}\n\nfunction buildMeshNode( geometry ) {\n\n\tconst name = 'Geometry';\n\tconst attributes = geometry.attributes;\n\tconst count = attributes.position.count;\n\n\tconst node = new USDNode( name, 'Mesh' );\n\n\tnode.addProperty(\n\t\t`int[] faceVertexCounts = [${buildMeshVertexCount( geometry )}]`\n\t);\n\tnode.addProperty(\n\t\t`int[] faceVertexIndices = [${buildMeshVertexIndices( geometry )}]`\n\t);\n\tnode.addProperty(\n\t\t`normal3f[] normals = [${buildVector3Array( attributes.normal, count )}]`,\n\t\t[ 'interpolation = \"vertex\"' ]\n\t);\n\tnode.addProperty(\n\t\t`point3f[] points = [${buildVector3Array( attributes.position, count )}]`\n\t);\n\n\tfor ( let i = 0; i < 4; i ++ ) {\n\n\t\tconst id = i > 0 ? i : '';\n\t\tconst attribute = attributes[ 'uv' + id ];\n\t\tif ( attribute !== undefined ) {\n\n\t\t\tnode.addProperty(\n\t\t\t\t`texCoord2f[] primvars:st${id} = [${buildVector2Array( attribute )}]`,\n\t\t\t\t[ 'interpolation = \"vertex\"' ]\n\t\t\t);\n\n\t\t}\n\n\t}\n\n\tconst colorAttribute = attributes.color;\n\tif ( colorAttribute !== undefined ) {\n\n\t\tnode.addProperty(\n\t\t\t`color3f[] primvars:displayColor = [${buildVector3Array(\n\t\t\t\tcolorAttribute,\n\t\t\t\tcount\n\t\t\t)}]`,\n\t\t\t[ 'interpolation = \"vertex\"' ]\n\t\t);\n\n\t}\n\n\tnode.addProperty( 'uniform token subdivisionScheme = \"none\"' );\n\n\treturn node;\n\n}\n\nfunction buildMeshVertexCount( geometry ) {\n\n\tconst count =\n\t\tgeometry.index !== null\n\t\t\t? geometry.index.count\n\t\t\t: geometry.attributes.position.count;\n\n\treturn Array( count / 3 )\n\t\t.fill( 3 )\n\t\t.join( ', ' );\n\n}\n\nfunction buildMeshVertexIndices( geometry ) {\n\n\tconst index = geometry.index;\n\tconst array = [];\n\n\tif ( index !== null ) {\n\n\t\tfor ( let i = 0; i < index.count; i ++ ) {\n\n\t\t\tarray.push( index.getX( i ) );\n\n\t\t}\n\n\t} else {\n\n\t\tconst length = geometry.attributes.position.count;\n\n\t\tfor ( let i = 0; i < length; i ++ ) {\n\n\t\t\tarray.push( i );\n\n\t\t}\n\n\t}\n\n\treturn array.join( ', ' );\n\n}\n\nfunction buildVector3Array( attribute, count ) {\n\n\tif ( attribute === undefined ) {\n\n\t\tconsole.warn( 'USDZExporter: Normals missing.' );\n\t\treturn Array( count ).fill( '(0, 0, 0)' ).join( ', ' );\n\n\t}\n\n\tconst array = [];\n\n\tfor ( let i = 0; i < attribute.count; i ++ ) {\n\n\t\tconst x = attribute.getX( i );\n\t\tconst y = attribute.getY( i );\n\t\tconst z = attribute.getZ( i );\n\n\t\tarray.push(\n\t\t\t`(${x.toPrecision( PRECISION )}, ${y.toPrecision(\n\t\t\t\tPRECISION\n\t\t\t)}, ${z.toPrecision( PRECISION )})`\n\t\t);\n\n\t}\n\n\treturn array.join( ', ' );\n\n}\n\nfunction buildVector2Array( attribute ) {\n\n\tconst array = [];\n\n\tfor ( let i = 0; i < attribute.count; i ++ ) {\n\n\t\tconst x = attribute.getX( i );\n\t\tconst y = attribute.getY( i );\n\n\t\tarray.push(\n\t\t\t`(${x.toPrecision( PRECISION )}, ${1 - y.toPrecision( PRECISION )})`\n\t\t);\n\n\t}\n\n\treturn array.join( ', ' );\n\n}\n\n// Materials\n\nfunction buildMaterials( materials, textures, quickLookCompatible = false ) {\n\n\tconst materialsNode = new USDNode( 'Materials' );\n\n\tfor ( const uuid in materials ) {\n\n\t\tconst material = materials[ uuid ];\n\n\t\tmaterialsNode.addChild(\n\t\t\tbuildMaterial( material, textures, quickLookCompatible )\n\t\t);\n\n\t}\n\n\treturn materialsNode;\n\n}\n\nfunction buildMaterial( material, textures, quickLookCompatible = false ) {\n\n\t// https://graphics.pixar.com/usd/docs/UsdPreviewSurface-Proposal.html\n\n\tconst materialNode = new USDNode( `Material_${material.id}`, 'Material' );\n\n\tfunction buildTextureNodes( texture, mapType, color ) {\n\n\t\tconst id = texture.source.id + '_' + texture.flipY;\n\n\t\ttextures[ id ] = texture;\n\n\t\tconst uv = texture.channel > 0 ? 'st' + texture.channel : 'st';\n\n\t\tconst WRAPPINGS = {\n\t\t\t1000: 'repeat', // RepeatWrapping\n\t\t\t1001: 'clamp', // ClampToEdgeWrapping\n\t\t\t1002: 'mirror', // MirroredRepeatWrapping\n\t\t};\n\n\t\tconst repeat = texture.repeat.clone();\n\t\tconst offset = texture.offset.clone();\n\t\tconst rotation = texture.rotation;\n\n\t\t// rotation is around the wrong point. after rotation we need to shift offset again so that we're rotating around the right spot\n\t\tconst xRotationOffset = Math.sin( rotation );\n\t\tconst yRotationOffset = Math.cos( rotation );\n\n\t\t// texture coordinates start in the opposite corner, need to correct\n\t\toffset.y = 1 - offset.y - repeat.y;\n\n\t\t// turns out QuickLook is buggy and interprets texture repeat inverted/applies operations in a different order.\n\t\t// Apple Feedback: \tFB10036297 and FB11442287\n\t\tif ( quickLookCompatible ) {\n\n\t\t\t// This is NOT correct yet in QuickLook, but comes close for a range of models.\n\t\t\t// It becomes more incorrect the bigger the offset is\n\n\t\t\toffset.x = offset.x / repeat.x;\n\t\t\toffset.y = offset.y / repeat.y;\n\n\t\t\toffset.x += xRotationOffset / repeat.x;\n\t\t\toffset.y += yRotationOffset - 1;\n\n\t\t} else {\n\n\t\t\t// results match glTF results exactly. verified correct in usdview.\n\t\t\toffset.x += xRotationOffset * repeat.x;\n\t\t\toffset.y += ( 1 - yRotationOffset ) * repeat.y;\n\n\t\t}\n\n\t\tconst primvarReaderNode = new USDNode( `PrimvarReader_${mapType}`, 'Shader' );\n\t\tprimvarReaderNode.addProperty(\n\t\t\t'uniform token info:id = \"UsdPrimvarReader_float2\"'\n\t\t);\n\t\tprimvarReaderNode.addProperty( 'float2 inputs:fallback = (0.0, 0.0)' );\n\t\tprimvarReaderNode.addProperty( `string inputs:varname = \"${uv}\"` );\n\t\tprimvarReaderNode.addProperty( 'float2 outputs:result' );\n\n\t\tconst transform2dNode = new USDNode( `Transform2d_${mapType}`, 'Shader' );\n\t\ttransform2dNode.addProperty( 'uniform token info:id = \"UsdTransform2d\"' );\n\t\ttransform2dNode.addProperty(\n\t\t\t`float2 inputs:in.connect = </Materials/Material_${material.id}/PrimvarReader_${mapType}.outputs:result>`\n\t\t);\n\t\ttransform2dNode.addProperty(\n\t\t\t`float inputs:rotation = ${( rotation * ( 180 / Math.PI ) ).toFixed(\n\t\t\t\tPRECISION\n\t\t\t)}`\n\t\t);\n\t\ttransform2dNode.addProperty(\n\t\t\t`float2 inputs:scale = ${buildVector2( repeat )}`\n\t\t);\n\t\ttransform2dNode.addProperty(\n\t\t\t`float2 inputs:translation = ${buildVector2( offset )}`\n\t\t);\n\t\ttransform2dNode.addProperty( 'float2 outputs:result' );\n\n\t\tconst textureNode = new USDNode(\n\t\t\t`Texture_${texture.id}_${mapType}`,\n\t\t\t'Shader'\n\t\t);\n\t\ttextureNode.addProperty( 'uniform token info:id = \"UsdUVTexture\"' );\n\t\ttextureNode.addProperty( `asset inputs:file = @textures/Texture_${id}.png@` );\n\t\ttextureNode.addProperty(\n\t\t\t`float2 inputs:st.connect = </Materials/Material_${material.id}/Transform2d_${mapType}.outputs:result>`\n\t\t);\n\n\t\tif ( color !== undefined ) {\n\n\t\t\ttextureNode.addProperty( `float4 inputs:scale = ${buildColor4( color )}` );\n\n\t\t}\n\n\t\tif ( mapType === 'normal' ) {\n\n\t\t\ttextureNode.addProperty( 'float4 inputs:scale = (2, 2, 2, 1)' );\n\t\t\ttextureNode.addProperty( 'float4 inputs:bias = (-1, -1, -1, 0)' );\n\n\t\t}\n\n\t\ttextureNode.addProperty(\n\t\t\t`token inputs:sourceColorSpace = \"${\n\t\t\t\ttexture.colorSpace === NoColorSpace ? 'raw' : 'sRGB'\n\t\t\t}\"`\n\t\t);\n\t\ttextureNode.addProperty(\n\t\t\t`token inputs:wrapS = \"${WRAPPINGS[ texture.wrapS ]}\"`\n\t\t);\n\t\ttextureNode.addProperty(\n\t\t\t`token inputs:wrapT = \"${WRAPPINGS[ texture.wrapT ]}\"`\n\t\t);\n\t\ttextureNode.addProperty( 'float outputs:r' );\n\t\ttextureNode.addProperty( 'float outputs:g' );\n\t\ttextureNode.addProperty( 'float outputs:b' );\n\t\ttextureNode.addProperty( 'float3 outputs:rgb' );\n\n\t\tif ( material.transparent || material.alphaTest > 0.0 ) {\n\n\t\t\ttextureNode.addProperty( 'float outputs:a' );\n\n\t\t}\n\n\t\treturn [ primvarReaderNode, transform2dNode, textureNode ];\n\n\t}\n\n\tif ( material.side === DoubleSide ) {\n\n\t\tconsole.warn(\n\t\t\t'THREE.USDZExporter: USDZ does not support double sided materials',\n\t\t\tmaterial\n\t\t);\n\n\t}\n\n\tconst previewSurfaceNode = new USDNode( 'PreviewSurface', 'Shader' );\n\tpreviewSurfaceNode.addProperty( 'uniform token info:id = \"UsdPreviewSurface\"' );\n\n\tif ( material.map !== null ) {\n\n\t\tpreviewSurfaceNode.addProperty(\n\t\t\t`color3f inputs:diffuseColor.connect = </Materials/Material_${material.id}/Texture_${material.map.id}_diffuse.outputs:rgb>`\n\t\t);\n\n\t\tif ( material.transparent ) {\n\n\t\t\tpreviewSurfaceNode.addProperty(\n\t\t\t\t`float inputs:opacity.connect = </Materials/Material_${material.id}/Texture_${material.map.id}_diffuse.outputs:a>`\n\t\t\t);\n\n\t\t} else if ( material.alphaTest > 0.0 ) {\n\n\t\t\tpreviewSurfaceNode.addProperty(\n\t\t\t\t`float inputs:opacity.connect = </Materials/Material_${material.id}/Texture_${material.map.id}_diffuse.outputs:a>`\n\t\t\t);\n\t\t\tpreviewSurfaceNode.addProperty(\n\t\t\t\t`float inputs:opacityThreshold = ${material.alphaTest}`\n\t\t\t);\n\n\t\t}\n\n\t\tconst textureNodes = buildTextureNodes(\n\t\t\tmaterial.map,\n\t\t\t'diffuse',\n\t\t\tmaterial.color\n\t\t);\n\t\ttextureNodes.forEach( ( node ) => materialNode.addChild( node ) );\n\n\t} else {\n\n\t\tpreviewSurfaceNode.addProperty(\n\t\t\t`color3f inputs:diffuseColor = ${buildColor( material.color )}`\n\t\t);\n\n\t}\n\n\tif ( material.emissiveMap !== null ) {\n\n\t\tpreviewSurfaceNode.addProperty(\n\t\t\t`color3f inputs:emissiveColor.connect = </Materials/Material_${material.id}/Texture_${material.emissiveMap.id}_emissive.outputs:rgb>`\n\t\t);\n\n\t\tconst emissiveColor = new Color(\n\t\t\tmaterial.emissive.r * material.emissiveIntensity,\n\t\t\tmaterial.emissive.g * material.emissiveIntensity,\n\t\t\tmaterial.emissive.b * material.emissiveIntensity\n\t\t);\n\t\tconst textureNodes = buildTextureNodes(\n\t\t\tmaterial.emissiveMap,\n\t\t\t'emissive',\n\t\t\temissiveColor\n\t\t);\n\t\ttextureNodes.forEach( ( node ) => materialNode.addChild( node ) );\n\n\t} else if ( material.emissive.getHex() > 0 ) {\n\n\t\tpreviewSurfaceNode.addProperty(\n\t\t\t`color3f inputs:emissiveColor = ${buildColor( material.emissive )}`\n\t\t);\n\n\t}\n\n\tif ( material.normalMap !== null ) {\n\n\t\tpreviewSurfaceNode.addProperty(\n\t\t\t`normal3f inputs:normal.connect = </Materials/Material_${material.id}/Texture_${material.normalMap.id}_normal.outputs:rgb>`\n\t\t);\n\n\t\tconst textureNodes = buildTextureNodes( material.normalMap, 'normal' );\n\t\ttextureNodes.forEach( ( node ) => materialNode.addChild( node ) );\n\n\t}\n\n\tif ( material.aoMap !== null ) {\n\n\t\tpreviewSurfaceNode.addProperty(\n\t\t\t`float inputs:occlusion.connect = </Materials/Material_${material.id}/Texture_${material.aoMap.id}_occlusion.outputs:r>`\n\t\t);\n\n\t\tconst aoColor = new Color(\n\t\t\tmaterial.aoMapIntensity,\n\t\t\tmaterial.aoMapIntensity,\n\t\t\tmaterial.aoMapIntensity\n\t\t);\n\t\tconst textureNodes = buildTextureNodes(\n\t\t\tmaterial.aoMap,\n\t\t\t'occlusion',\n\t\t\taoColor\n\t\t);\n\t\ttextureNodes.forEach( ( node ) => materialNode.addChild( node ) );\n\n\t}\n\n\tif ( material.roughnessMap !== null ) {\n\n\t\tpreviewSurfaceNode.addProperty(\n\t\t\t`float inputs:roughness.connect = </Materials/Material_${material.id}/Texture_${material.roughnessMap.id}_roughness.outputs:g>`\n\t\t);\n\n\t\tconst roughnessColor = new Color(\n\t\t\tmaterial.roughness,\n\t\t\tmaterial.roughness,\n\t\t\tmaterial.roughness\n\t\t);\n\t\tconst textureNodes = buildTextureNodes(\n\t\t\tmaterial.roughnessMap,\n\t\t\t'roughness',\n\t\t\troughnessColor\n\t\t);\n\t\ttextureNodes.forEach( ( node ) => materialNode.addChild( node ) );\n\n\t} else {\n\n\t\tpreviewSurfaceNode.addProperty(\n\t\t\t`float inputs:roughness = ${material.roughness}`\n\t\t);\n\n\t}\n\n\tif ( material.metalnessMap !== null ) {\n\n\t\tpreviewSurfaceNode.addProperty(\n\t\t\t`float inputs:metallic.connect = </Materials/Material_${material.id}/Texture_${material.metalnessMap.id}_metallic.outputs:b>`\n\t\t);\n\n\t\tconst metalnessColor = new Color(\n\t\t\tmaterial.metalness,\n\t\t\tmaterial.metalness,\n\t\t\tmaterial.metalness\n\t\t);\n\t\tconst textureNodes = buildTextureNodes(\n\t\t\tmaterial.metalnessMap,\n\t\t\t'metallic',\n\t\t\tmetalnessColor\n\t\t);\n\t\ttextureNodes.forEach( ( node ) => materialNode.addChild( node ) );\n\n\t} else {\n\n\t\tpreviewSurfaceNode.addProperty(\n\t\t\t`float inputs:metallic = ${material.metalness}`\n\t\t);\n\n\t}\n\n\tif ( material.alphaMap !== null ) {\n\n\t\tpreviewSurfaceNode.addProperty(\n\t\t\t`float inputs:opacity.connect = </Materials/Material_${material.id}/Texture_${material.alphaMap.id}_opacity.outputs:r>`\n\t\t);\n\t\tpreviewSurfaceNode.addProperty( 'float inputs:opacityThreshold = 0.0001' );\n\n\t\tconst textureNodes = buildTextureNodes( material.alphaMap, 'opacity' );\n\t\ttextureNodes.forEach( ( node ) => materialNode.addChild( node ) );\n\n\t} else {\n\n\t\tpreviewSurfaceNode.addProperty(\n\t\t\t`float inputs:opacity = ${material.opacity}`\n\t\t);\n\n\t}\n\n\tif ( material.isMeshPhysicalMaterial ) {\n\n\t\tif ( material.clearcoatMap !== null ) {\n\n\t\t\tpreviewSurfaceNode.addProperty(\n\t\t\t\t`float inputs:clearcoat.connect = </Materials/Material_${material.id}/Texture_${material.clearcoatMap.id}_clearcoat.outputs:r>`\n\t\t\t);\n\n\t\t\tconst clearcoatColor = new Color(\n\t\t\t\tmaterial.clearcoat,\n\t\t\t\tmaterial.clearcoat,\n\t\t\t\tmaterial.clearcoat\n\t\t\t);\n\t\t\tconst textureNodes = buildTextureNodes(\n\t\t\t\tmaterial.clearcoatMap,\n\t\t\t\t'clearcoat',\n\t\t\t\tclearcoatColor\n\t\t\t);\n\t\t\ttextureNodes.forEach( ( node ) => materialNode.addChild( node ) );\n\n\t\t} else {\n\n\t\t\tpreviewSurfaceNode.addProperty(\n\t\t\t\t`float inputs:clearcoat = ${material.clearcoat}`\n\t\t\t);\n\n\t\t}\n\n\t\tif ( material.clearcoatRoughnessMap !== null ) {\n\n\t\t\tpreviewSurfaceNode.addProperty(\n\t\t\t\t`float inputs:clearcoatRoughness.connect = </Materials/Material_${material.id}/Texture_${material.clearcoatRoughnessMap.id}_clearcoatRoughness.outputs:g>`\n\t\t\t);\n\n\t\t\tconst clearcoatRoughnessColor = new Color(\n\t\t\t\tmaterial.clearcoatRoughness,\n\t\t\t\tmaterial.clearcoatRoughness,\n\t\t\t\tmaterial.clearcoatRoughness\n\t\t\t);\n\t\t\tconst textureNodes = buildTextureNodes(\n\t\t\t\tmaterial.clearcoatRoughnessMap,\n\t\t\t\t'clearcoatRoughness',\n\t\t\t\tclearcoatRoughnessColor\n\t\t\t);\n\t\t\ttextureNodes.forEach( ( node ) => materialNode.addChild( node ) );\n\n\t\t} else {\n\n\t\t\tpreviewSurfaceNode.addProperty(\n\t\t\t\t`float inputs:clearcoatRoughness = ${material.clearcoatRoughness}`\n\t\t\t);\n\n\t\t}\n\n\t\tpreviewSurfaceNode.addProperty( `float inputs:ior = ${material.ior}` );\n\n\t}\n\n\tpreviewSurfaceNode.addProperty( 'int inputs:useSpecularWorkflow = 0' );\n\tpreviewSurfaceNode.addProperty( 'token outputs:surface' );\n\n\tmaterialNode.addChild( previewSurfaceNode );\n\n\tmaterialNode.addProperty(\n\t\t`token outputs:surface.connect = </Materials/Material_${material.id}/PreviewSurface.outputs:surface>`\n\t);\n\n\treturn materialNode;\n\n}\n\nfunction buildColor( color ) {\n\n\treturn `(${color.r}, ${color.g}, ${color.b})`;\n\n}\n\nfunction buildColor4( color ) {\n\n\treturn `(${color.r}, ${color.g}, ${color.b}, 1.0)`;\n\n}\n\nfunction buildVector2( vector ) {\n\n\treturn `(${vector.x}, ${vector.y})`;\n\n}\n\nfunction buildCamera( camera, usedNames ) {\n\n\tconst name = getName( camera, usedNames );\n\n\tconst transform = buildMatrix( camera.matrix );\n\n\tif ( camera.matrix.determinant() < 0 ) {\n\n\t\tconsole.warn(\n\t\t\t'THREE.USDZExporter: USDZ does not support negative scales',\n\t\t\tcamera\n\t\t);\n\n\t}\n\n\tconst node = new USDNode( name, 'Camera' );\n\tnode.addProperty( `matrix4d xformOp:transform = ${transform}` );\n\tnode.addProperty( 'uniform token[] xformOpOrder = [\"xformOp:transform\"]' );\n\n\tconst projection = camera.isOrthographicCamera\n\t\t? 'orthographic'\n\t\t: 'perspective';\n\tnode.addProperty( `token projection = \"${projection}\"` );\n\n\tconst clippingRange = `(${camera.near.toPrecision(\n\t\tPRECISION\n\t)}, ${camera.far.toPrecision( PRECISION )})`;\n\tnode.addProperty( `float2 clippingRange = ${clippingRange}` );\n\n\tlet horizontalAperture;\n\tif ( camera.isOrthographicCamera ) {\n\n\t\thorizontalAperture = (\n\t\t\t( Math.abs( camera.left ) + Math.abs( camera.right ) ) *\n\t\t\t10\n\t\t).toPrecision( PRECISION );\n\n\t} else {\n\n\t\thorizontalAperture = camera.getFilmWidth().toPrecision( PRECISION );\n\n\t}\n\n\tnode.addProperty( `float horizontalAperture = ${horizontalAperture}` );\n\n\tlet verticalAperture;\n\tif ( camera.isOrthographicCamera ) {\n\n\t\tverticalAperture = (\n\t\t\t( Math.abs( camera.top ) + Math.abs( camera.bottom ) ) *\n\t\t\t10\n\t\t).toPrecision( PRECISION );\n\n\t} else {\n\n\t\tverticalAperture = camera.getFilmHeight().toPrecision( PRECISION );\n\n\t}\n\n\tnode.addProperty( `float verticalAperture = ${verticalAperture}` );\n\n\tif ( camera.isPerspectiveCamera ) {\n\n\t\tconst focalLength = camera.getFocalLength().toPrecision( PRECISION );\n\t\tnode.addProperty( `float focalLength = ${focalLength}` );\n\n\t\tconst focusDistance = camera.focus.toPrecision( PRECISION );\n\t\tnode.addProperty( `float focusDistance = ${focusDistance}` );\n\n\t}\n\n\treturn node;\n\n}\n\n/**\n * Export options of `USDZExporter`.\n *\n * @typedef {Object} USDZExporter~Options\n * @property {number} [maxTextureSize=1024] - The maximum texture size that is going to be exported.\n * @property {boolean} [includeAnchoringProperties=true] - Whether to include anchoring properties or not.\n * @property {boolean} [onlyVisible=true] - Export only visible 3D objects.\n * @property {Object} [ar] - If `includeAnchoringProperties` is set to `true`, the anchoring type and alignment\n * can be configured via `ar.anchoring.type` and `ar.planeAnchoring.alignment`.\n * @property {boolean} [quickLookCompatible=false] - Whether to make the exported USDZ compatible to QuickLook\n * which means the asset is modified to accommodate the bugs FB10036297 and FB11442287 (Apple Feedback).\n **/\n\n/**\n * onDone callback of `USDZExporter`.\n *\n * @callback USDZExporter~OnDone\n * @param {ArrayBuffer} result - The generated USDZ.\n */\n\n/**\n * onError callback of `USDZExporter`.\n *\n * @callback USDZExporter~OnError\n * @param {Error} error - The error object.\n */\n\nexport { USDZExporter };\n"],"x_google_ignoreList":[0],"mappings":";;;AAWA,IAAM,IAAN,MAAc;CAEb,YAAa,GAAM,IAAO,IAAI,IAAW,EAAE,EAAE,IAAa,EAAE,EAAG;AAM9D,EAJA,KAAK,OAAO,GACZ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B;CAE7D,IAAI;AAcJ,CAbA,AASC,IATI,EAAO,yBAGR,KAAK,IAAK,EAAO,KAAM,GAAG,KAAK,IAAK,EAAO,MAAO,IACpD,IACC,YAAa,EAAW,GAIL,EAAO,cAAc,CAAC,YAAa,EAAW,EAIpE,EAAK,YAAa,8BAA8B,IAAsB;CAEtE,IAAI;AAgBJ,KAfA,AASC,IATI,EAAO,yBAGR,KAAK,IAAK,EAAO,IAAK,GAAG,KAAK,IAAK,EAAO,OAAQ,IACpD,IACC,YAAa,EAAW,GAIP,EAAO,eAAe,CAAC,YAAa,EAAW,EAInE,EAAK,YAAa,4BAA4B,IAAoB,EAE7D,EAAO,qBAAsB;EAEjC,IAAM,IAAc,EAAO,gBAAgB,CAAC,YAAa,EAAW;AACpE,IAAK,YAAa,uBAAuB,IAAe;EAExD,IAAM,IAAgB,EAAO,MAAM,YAAa,EAAW;AAC3D,IAAK,YAAa,yBAAyB,IAAiB;;AAI7D,QAAO"}
@@ -1,4 +1,4 @@
1
- import { p as e } from "./Object3D-DSjIOhON.mjs";
1
+ import { p as e } from "./Object3D-C3wqWk6O.mjs";
2
2
  //#region ../../node_modules/three/src/math/Vector4.js
3
3
  var t = class t {
4
4
  constructor(e = 0, n = 0, r = 0, i = 1) {
@@ -201,4 +201,4 @@ var t = class t {
201
201
  //#endregion
202
202
  export { t };
203
203
 
204
- //# sourceMappingURL=Vector4-DGmBYfpK.mjs.map
204
+ //# sourceMappingURL=Vector4-DUqY3Egg.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Vector4-DGmBYfpK.mjs","names":[],"sources":["../../../../node_modules/three/src/math/Vector4.js"],"sourcesContent":["import { clamp } from './MathUtils.js';\n\n/**\n * Class representing a 4D vector. A 4D vector is an ordered quadruplet of numbers\n * (labeled x, y, z and w), which can be used to represent a number of things, such as:\n *\n * - A point in 4D space.\n * - A direction and length in 4D space. In three.js the length will\n * always be the Euclidean distance(straight-line distance) from `(0, 0, 0, 0)` to `(x, y, z, w)`\n * and the direction is also measured from `(0, 0, 0, 0)` towards `(x, y, z, w)`.\n * - Any arbitrary ordered quadruplet of numbers.\n *\n * There are other things a 4D vector can be used to represent, however these\n * are the most common uses in *three.js*.\n *\n * Iterating through a vector instance will yield its components `(x, y, z, w)` in\n * the corresponding order.\n * ```js\n * const a = new THREE.Vector4( 0, 1, 0, 0 );\n *\n * //no arguments; will be initialised to (0, 0, 0, 1)\n * const b = new THREE.Vector4( );\n *\n * const d = a.dot( b );\n * ```\n */\nclass Vector4 {\n\n\t/**\n\t * Constructs a new 4D vector.\n\t *\n\t * @param {number} [x=0] - The x value of this vector.\n\t * @param {number} [y=0] - The y value of this vector.\n\t * @param {number} [z=0] - The z value of this vector.\n\t * @param {number} [w=1] - The w value of this vector.\n\t */\n\tconstructor( x = 0, y = 0, z = 0, w = 1 ) {\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tVector4.prototype.isVector4 = true;\n\n\t\t/**\n\t\t * The x value of this vector.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tthis.x = x;\n\n\t\t/**\n\t\t * The y value of this vector.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tthis.y = y;\n\n\t\t/**\n\t\t * The z value of this vector.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tthis.z = z;\n\n\t\t/**\n\t\t * The w value of this vector.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tthis.w = w;\n\n\t}\n\n\t/**\n\t * Alias for {@link Vector4#z}.\n\t *\n\t * @type {number}\n\t */\n\tget width() {\n\n\t\treturn this.z;\n\n\t}\n\n\tset width( value ) {\n\n\t\tthis.z = value;\n\n\t}\n\n\t/**\n\t * Alias for {@link Vector4#w}.\n\t *\n\t * @type {number}\n\t */\n\tget height() {\n\n\t\treturn this.w;\n\n\t}\n\n\tset height( value ) {\n\n\t\tthis.w = value;\n\n\t}\n\n\t/**\n\t * Sets the vector components.\n\t *\n\t * @param {number} x - The value of the x component.\n\t * @param {number} y - The value of the y component.\n\t * @param {number} z - The value of the z component.\n\t * @param {number} w - The value of the w component.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tset( x, y, z, w ) {\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.z = z;\n\t\tthis.w = w;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the vector components to the same value.\n\t *\n\t * @param {number} scalar - The value to set for all vector components.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsetScalar( scalar ) {\n\n\t\tthis.x = scalar;\n\t\tthis.y = scalar;\n\t\tthis.z = scalar;\n\t\tthis.w = scalar;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the vector's x component to the given value\n\t *\n\t * @param {number} x - The value to set.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsetX( x ) {\n\n\t\tthis.x = x;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the vector's y component to the given value\n\t *\n\t * @param {number} y - The value to set.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsetY( y ) {\n\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the vector's z component to the given value\n\t *\n\t * @param {number} z - The value to set.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsetZ( z ) {\n\n\t\tthis.z = z;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the vector's w component to the given value\n\t *\n\t * @param {number} w - The value to set.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsetW( w ) {\n\n\t\tthis.w = w;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Allows to set a vector component with an index.\n\t *\n\t * @param {number} index - The component index. `0` equals to x, `1` equals to y,\n\t * `2` equals to z, `3` equals to w.\n\t * @param {number} value - The value to set.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsetComponent( index, value ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: this.x = value; break;\n\t\t\tcase 1: this.y = value; break;\n\t\t\tcase 2: this.z = value; break;\n\t\t\tcase 3: this.w = value; break;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns the value of the vector component which matches the given index.\n\t *\n\t * @param {number} index - The component index. `0` equals to x, `1` equals to y,\n\t * `2` equals to z, `3` equals to w.\n\t * @return {number} A vector component value.\n\t */\n\tgetComponent( index ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: return this.x;\n\t\t\tcase 1: return this.y;\n\t\t\tcase 2: return this.z;\n\t\t\tcase 3: return this.w;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Returns a new vector with copied values from this instance.\n\t *\n\t * @return {Vector4} A clone of this instance.\n\t */\n\tclone() {\n\n\t\treturn new this.constructor( this.x, this.y, this.z, this.w );\n\n\t}\n\n\t/**\n\t * Copies the values of the given vector to this instance.\n\t *\n\t * @param {Vector3|Vector4} v - The vector to copy.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tcopy( v ) {\n\n\t\tthis.x = v.x;\n\t\tthis.y = v.y;\n\t\tthis.z = v.z;\n\t\tthis.w = ( v.w !== undefined ) ? v.w : 1;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds the given vector to this instance.\n\t *\n\t * @param {Vector4} v - The vector to add.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tadd( v ) {\n\n\t\tthis.x += v.x;\n\t\tthis.y += v.y;\n\t\tthis.z += v.z;\n\t\tthis.w += v.w;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds the given scalar value to all components of this instance.\n\t *\n\t * @param {number} s - The scalar to add.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\taddScalar( s ) {\n\n\t\tthis.x += s;\n\t\tthis.y += s;\n\t\tthis.z += s;\n\t\tthis.w += s;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds the given vectors and stores the result in this instance.\n\t *\n\t * @param {Vector4} a - The first vector.\n\t * @param {Vector4} b - The second vector.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\taddVectors( a, b ) {\n\n\t\tthis.x = a.x + b.x;\n\t\tthis.y = a.y + b.y;\n\t\tthis.z = a.z + b.z;\n\t\tthis.w = a.w + b.w;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds the given vector scaled by the given factor to this instance.\n\t *\n\t * @param {Vector4} v - The vector.\n\t * @param {number} s - The factor that scales `v`.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\taddScaledVector( v, s ) {\n\n\t\tthis.x += v.x * s;\n\t\tthis.y += v.y * s;\n\t\tthis.z += v.z * s;\n\t\tthis.w += v.w * s;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Subtracts the given vector from this instance.\n\t *\n\t * @param {Vector4} v - The vector to subtract.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsub( v ) {\n\n\t\tthis.x -= v.x;\n\t\tthis.y -= v.y;\n\t\tthis.z -= v.z;\n\t\tthis.w -= v.w;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Subtracts the given scalar value from all components of this instance.\n\t *\n\t * @param {number} s - The scalar to subtract.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsubScalar( s ) {\n\n\t\tthis.x -= s;\n\t\tthis.y -= s;\n\t\tthis.z -= s;\n\t\tthis.w -= s;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Subtracts the given vectors and stores the result in this instance.\n\t *\n\t * @param {Vector4} a - The first vector.\n\t * @param {Vector4} b - The second vector.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsubVectors( a, b ) {\n\n\t\tthis.x = a.x - b.x;\n\t\tthis.y = a.y - b.y;\n\t\tthis.z = a.z - b.z;\n\t\tthis.w = a.w - b.w;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Multiplies the given vector with this instance.\n\t *\n\t * @param {Vector4} v - The vector to multiply.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tmultiply( v ) {\n\n\t\tthis.x *= v.x;\n\t\tthis.y *= v.y;\n\t\tthis.z *= v.z;\n\t\tthis.w *= v.w;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Multiplies the given scalar value with all components of this instance.\n\t *\n\t * @param {number} scalar - The scalar to multiply.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tmultiplyScalar( scalar ) {\n\n\t\tthis.x *= scalar;\n\t\tthis.y *= scalar;\n\t\tthis.z *= scalar;\n\t\tthis.w *= scalar;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Multiplies this vector with the given 4x4 matrix.\n\t *\n\t * @param {Matrix4} m - The 4x4 matrix.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tapplyMatrix4( m ) {\n\n\t\tconst x = this.x, y = this.y, z = this.z, w = this.w;\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] * w;\n\t\tthis.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] * w;\n\t\tthis.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] * w;\n\t\tthis.w = e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] * w;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Divides this instance by the given vector.\n\t *\n\t * @param {Vector4} v - The vector to divide.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tdivide( v ) {\n\n\t\tthis.x /= v.x;\n\t\tthis.y /= v.y;\n\t\tthis.z /= v.z;\n\t\tthis.w /= v.w;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Divides this vector by the given scalar.\n\t *\n\t * @param {number} scalar - The scalar to divide.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tdivideScalar( scalar ) {\n\n\t\treturn this.multiplyScalar( 1 / scalar );\n\n\t}\n\n\t/**\n\t * Sets the x, y and z components of this\n\t * vector to the quaternion's axis and w to the angle.\n\t *\n\t * @param {Quaternion} q - The Quaternion to set.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsetAxisAngleFromQuaternion( q ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm\n\n\t\t// q is assumed to be normalized\n\n\t\tthis.w = 2 * Math.acos( q.w );\n\n\t\tconst s = Math.sqrt( 1 - q.w * q.w );\n\n\t\tif ( s < 0.0001 ) {\n\n\t\t\tthis.x = 1;\n\t\t\tthis.y = 0;\n\t\t\tthis.z = 0;\n\n\t\t} else {\n\n\t\t\tthis.x = q.x / s;\n\t\t\tthis.y = q.y / s;\n\t\t\tthis.z = q.z / s;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the x, y and z components of this\n\t * vector to the axis of rotation and w to the angle.\n\t *\n\t * @param {Matrix4} m - A 4x4 matrix of which the upper left 3x3 matrix is a pure rotation matrix.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsetAxisAngleFromRotationMatrix( m ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tlet angle, x, y, z; // variables for result\n\t\tconst epsilon = 0.01,\t\t// margin to allow for rounding errors\n\t\t\tepsilon2 = 0.1,\t\t// margin to distinguish between 0 and 180 degrees\n\n\t\t\tte = m.elements,\n\n\t\t\tm11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ],\n\t\t\tm21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ],\n\t\t\tm31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ];\n\n\t\tif ( ( Math.abs( m12 - m21 ) < epsilon ) &&\n\t\t ( Math.abs( m13 - m31 ) < epsilon ) &&\n\t\t ( Math.abs( m23 - m32 ) < epsilon ) ) {\n\n\t\t\t// singularity found\n\t\t\t// first check for identity matrix which must have +1 for all terms\n\t\t\t// in leading diagonal and zero in other terms\n\n\t\t\tif ( ( Math.abs( m12 + m21 ) < epsilon2 ) &&\n\t\t\t ( Math.abs( m13 + m31 ) < epsilon2 ) &&\n\t\t\t ( Math.abs( m23 + m32 ) < epsilon2 ) &&\n\t\t\t ( Math.abs( m11 + m22 + m33 - 3 ) < epsilon2 ) ) {\n\n\t\t\t\t// this singularity is identity matrix so angle = 0\n\n\t\t\t\tthis.set( 1, 0, 0, 0 );\n\n\t\t\t\treturn this; // zero angle, arbitrary axis\n\n\t\t\t}\n\n\t\t\t// otherwise this singularity is angle = 180\n\n\t\t\tangle = Math.PI;\n\n\t\t\tconst xx = ( m11 + 1 ) / 2;\n\t\t\tconst yy = ( m22 + 1 ) / 2;\n\t\t\tconst zz = ( m33 + 1 ) / 2;\n\t\t\tconst xy = ( m12 + m21 ) / 4;\n\t\t\tconst xz = ( m13 + m31 ) / 4;\n\t\t\tconst yz = ( m23 + m32 ) / 4;\n\n\t\t\tif ( ( xx > yy ) && ( xx > zz ) ) {\n\n\t\t\t\t// m11 is the largest diagonal term\n\n\t\t\t\tif ( xx < epsilon ) {\n\n\t\t\t\t\tx = 0;\n\t\t\t\t\ty = 0.707106781;\n\t\t\t\t\tz = 0.707106781;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tx = Math.sqrt( xx );\n\t\t\t\t\ty = xy / x;\n\t\t\t\t\tz = xz / x;\n\n\t\t\t\t}\n\n\t\t\t} else if ( yy > zz ) {\n\n\t\t\t\t// m22 is the largest diagonal term\n\n\t\t\t\tif ( yy < epsilon ) {\n\n\t\t\t\t\tx = 0.707106781;\n\t\t\t\t\ty = 0;\n\t\t\t\t\tz = 0.707106781;\n\n\t\t\t\t} else {\n\n\t\t\t\t\ty = Math.sqrt( yy );\n\t\t\t\t\tx = xy / y;\n\t\t\t\t\tz = yz / y;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// m33 is the largest diagonal term so base result on this\n\n\t\t\t\tif ( zz < epsilon ) {\n\n\t\t\t\t\tx = 0.707106781;\n\t\t\t\t\ty = 0.707106781;\n\t\t\t\t\tz = 0;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tz = Math.sqrt( zz );\n\t\t\t\t\tx = xz / z;\n\t\t\t\t\ty = yz / z;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.set( x, y, z, angle );\n\n\t\t\treturn this; // return 180 deg rotation\n\n\t\t}\n\n\t\t// as we have reached here there are no singularities so we can handle normally\n\n\t\tlet s = Math.sqrt( ( m32 - m23 ) * ( m32 - m23 ) +\n\t\t\t( m13 - m31 ) * ( m13 - m31 ) +\n\t\t\t( m21 - m12 ) * ( m21 - m12 ) ); // used to normalize\n\n\t\tif ( Math.abs( s ) < 0.001 ) s = 1;\n\n\t\t// prevent divide by zero, should not happen if matrix is orthogonal and should be\n\t\t// caught by singularity test above, but I've left it in just in case\n\n\t\tthis.x = ( m32 - m23 ) / s;\n\t\tthis.y = ( m13 - m31 ) / s;\n\t\tthis.z = ( m21 - m12 ) / s;\n\t\tthis.w = Math.acos( ( m11 + m22 + m33 - 1 ) / 2 );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the vector components to the position elements of the\n\t * given transformation matrix.\n\t *\n\t * @param {Matrix4} m - The 4x4 matrix.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsetFromMatrixPosition( m ) {\n\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 12 ];\n\t\tthis.y = e[ 13 ];\n\t\tthis.z = e[ 14 ];\n\t\tthis.w = e[ 15 ];\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * If this vector's x, y, z or w value is greater than the given vector's x, y, z or w\n\t * value, replace that value with the corresponding min value.\n\t *\n\t * @param {Vector4} v - The vector.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tmin( v ) {\n\n\t\tthis.x = Math.min( this.x, v.x );\n\t\tthis.y = Math.min( this.y, v.y );\n\t\tthis.z = Math.min( this.z, v.z );\n\t\tthis.w = Math.min( this.w, v.w );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * If this vector's x, y, z or w value is less than the given vector's x, y, z or w\n\t * value, replace that value with the corresponding max value.\n\t *\n\t * @param {Vector4} v - The vector.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tmax( v ) {\n\n\t\tthis.x = Math.max( this.x, v.x );\n\t\tthis.y = Math.max( this.y, v.y );\n\t\tthis.z = Math.max( this.z, v.z );\n\t\tthis.w = Math.max( this.w, v.w );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * If this vector's x, y, z or w value is greater than the max vector's x, y, z or w\n\t * value, it is replaced by the corresponding value.\n\t * If this vector's x, y, z or w value is less than the min vector's x, y, z or w value,\n\t * it is replaced by the corresponding value.\n\t *\n\t * @param {Vector4} min - The minimum x, y and z values.\n\t * @param {Vector4} max - The maximum x, y and z values in the desired range.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tclamp( min, max ) {\n\n\t\t// assumes min < max, componentwise\n\n\t\tthis.x = clamp( this.x, min.x, max.x );\n\t\tthis.y = clamp( this.y, min.y, max.y );\n\t\tthis.z = clamp( this.z, min.z, max.z );\n\t\tthis.w = clamp( this.w, min.w, max.w );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * If this vector's x, y, z or w values are greater than the max value, they are\n\t * replaced by the max value.\n\t * If this vector's x, y, z or w values are less than the min value, they are\n\t * replaced by the min value.\n\t *\n\t * @param {number} minVal - The minimum value the components will be clamped to.\n\t * @param {number} maxVal - The maximum value the components will be clamped to.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tclampScalar( minVal, maxVal ) {\n\n\t\tthis.x = clamp( this.x, minVal, maxVal );\n\t\tthis.y = clamp( this.y, minVal, maxVal );\n\t\tthis.z = clamp( this.z, minVal, maxVal );\n\t\tthis.w = clamp( this.w, minVal, maxVal );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * If this vector's length is greater than the max value, it is replaced by\n\t * the max value.\n\t * If this vector's length is less than the min value, it is replaced by the\n\t * min value.\n\t *\n\t * @param {number} min - The minimum value the vector length will be clamped to.\n\t * @param {number} max - The maximum value the vector length will be clamped to.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tclampLength( min, max ) {\n\n\t\tconst length = this.length();\n\n\t\treturn this.divideScalar( length || 1 ).multiplyScalar( clamp( length, min, max ) );\n\n\t}\n\n\t/**\n\t * The components of this vector are rounded down to the nearest integer value.\n\t *\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tfloor() {\n\n\t\tthis.x = Math.floor( this.x );\n\t\tthis.y = Math.floor( this.y );\n\t\tthis.z = Math.floor( this.z );\n\t\tthis.w = Math.floor( this.w );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * The components of this vector are rounded up to the nearest integer value.\n\t *\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tceil() {\n\n\t\tthis.x = Math.ceil( this.x );\n\t\tthis.y = Math.ceil( this.y );\n\t\tthis.z = Math.ceil( this.z );\n\t\tthis.w = Math.ceil( this.w );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * The components of this vector are rounded to the nearest integer value\n\t *\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tround() {\n\n\t\tthis.x = Math.round( this.x );\n\t\tthis.y = Math.round( this.y );\n\t\tthis.z = Math.round( this.z );\n\t\tthis.w = Math.round( this.w );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * The components of this vector are rounded towards zero (up if negative,\n\t * down if positive) to an integer value.\n\t *\n\t * @return {Vector4} A reference to this vector.\n\t */\n\troundToZero() {\n\n\t\tthis.x = Math.trunc( this.x );\n\t\tthis.y = Math.trunc( this.y );\n\t\tthis.z = Math.trunc( this.z );\n\t\tthis.w = Math.trunc( this.w );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Inverts this vector - i.e. sets x = -x, y = -y, z = -z, w = -w.\n\t *\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tnegate() {\n\n\t\tthis.x = - this.x;\n\t\tthis.y = - this.y;\n\t\tthis.z = - this.z;\n\t\tthis.w = - this.w;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Calculates the dot product of the given vector with this instance.\n\t *\n\t * @param {Vector4} v - The vector to compute the dot product with.\n\t * @return {number} The result of the dot product.\n\t */\n\tdot( v ) {\n\n\t\treturn this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w;\n\n\t}\n\n\t/**\n\t * Computes the square of the Euclidean length (straight-line length) from\n\t * (0, 0, 0, 0) to (x, y, z, w). If you are comparing the lengths of vectors, you should\n\t * compare the length squared instead as it is slightly more efficient to calculate.\n\t *\n\t * @return {number} The square length of this vector.\n\t */\n\tlengthSq() {\n\n\t\treturn this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w;\n\n\t}\n\n\t/**\n\t * Computes the Euclidean length (straight-line length) from (0, 0, 0, 0) to (x, y, z, w).\n\t *\n\t * @return {number} The length of this vector.\n\t */\n\tlength() {\n\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w );\n\n\t}\n\n\t/**\n\t * Computes the Manhattan length of this vector.\n\t *\n\t * @return {number} The length of this vector.\n\t */\n\tmanhattanLength() {\n\n\t\treturn Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z ) + Math.abs( this.w );\n\n\t}\n\n\t/**\n\t * Converts this vector to a unit vector - that is, sets it equal to a vector\n\t * with the same direction as this one, but with a vector length of `1`.\n\t *\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tnormalize() {\n\n\t\treturn this.divideScalar( this.length() || 1 );\n\n\t}\n\n\t/**\n\t * Sets this vector to a vector with the same direction as this one, but\n\t * with the specified length.\n\t *\n\t * @param {number} length - The new length of this vector.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsetLength( length ) {\n\n\t\treturn this.normalize().multiplyScalar( length );\n\n\t}\n\n\t/**\n\t * Linearly interpolates between the given vector and this instance, where\n\t * alpha is the percent distance along the line - alpha = 0 will be this\n\t * vector, and alpha = 1 will be the given one.\n\t *\n\t * @param {Vector4} v - The vector to interpolate towards.\n\t * @param {number} alpha - The interpolation factor, typically in the closed interval `[0, 1]`.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tlerp( v, alpha ) {\n\n\t\tthis.x += ( v.x - this.x ) * alpha;\n\t\tthis.y += ( v.y - this.y ) * alpha;\n\t\tthis.z += ( v.z - this.z ) * alpha;\n\t\tthis.w += ( v.w - this.w ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Linearly interpolates between the given vectors, where alpha is the percent\n\t * distance along the line - alpha = 0 will be first vector, and alpha = 1 will\n\t * be the second one. The result is stored in this instance.\n\t *\n\t * @param {Vector4} v1 - The first vector.\n\t * @param {Vector4} v2 - The second vector.\n\t * @param {number} alpha - The interpolation factor, typically in the closed interval `[0, 1]`.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tlerpVectors( v1, v2, alpha ) {\n\n\t\tthis.x = v1.x + ( v2.x - v1.x ) * alpha;\n\t\tthis.y = v1.y + ( v2.y - v1.y ) * alpha;\n\t\tthis.z = v1.z + ( v2.z - v1.z ) * alpha;\n\t\tthis.w = v1.w + ( v2.w - v1.w ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns `true` if this vector is equal with the given one.\n\t *\n\t * @param {Vector4} v - The vector to test for equality.\n\t * @return {boolean} Whether this vector is equal with the given one.\n\t */\n\tequals( v ) {\n\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) && ( v.w === this.w ) );\n\n\t}\n\n\t/**\n\t * Sets this vector's x value to be `array[ offset ]`, y value to be `array[ offset + 1 ]`,\n\t * z value to be `array[ offset + 2 ]`, w value to be `array[ offset + 3 ]`.\n\t *\n\t * @param {Array<number>} array - An array holding the vector component values.\n\t * @param {number} [offset=0] - The offset into the array.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis.x = array[ offset ];\n\t\tthis.y = array[ offset + 1 ];\n\t\tthis.z = array[ offset + 2 ];\n\t\tthis.w = array[ offset + 3 ];\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Writes the components of this vector to the given array. If no array is provided,\n\t * the method returns a new instance.\n\t *\n\t * @param {Array<number>} [array=[]] - The target array holding the vector components.\n\t * @param {number} [offset=0] - Index of the first element in the array.\n\t * @return {Array<number>} The vector components.\n\t */\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this.x;\n\t\tarray[ offset + 1 ] = this.y;\n\t\tarray[ offset + 2 ] = this.z;\n\t\tarray[ offset + 3 ] = this.w;\n\n\t\treturn array;\n\n\t}\n\n\t/**\n\t * Sets the components of this vector from the given buffer attribute.\n\t *\n\t * @param {BufferAttribute} attribute - The buffer attribute holding vector data.\n\t * @param {number} index - The index into the attribute.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis.x = attribute.getX( index );\n\t\tthis.y = attribute.getY( index );\n\t\tthis.z = attribute.getZ( index );\n\t\tthis.w = attribute.getW( index );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets each component of this vector to a pseudo-random value between `0` and\n\t * `1`, excluding `1`.\n\t *\n\t * @return {Vector4} A reference to this vector.\n\t */\n\trandom() {\n\n\t\tthis.x = Math.random();\n\t\tthis.y = Math.random();\n\t\tthis.z = Math.random();\n\t\tthis.w = Math.random();\n\n\t\treturn this;\n\n\t}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this.x;\n\t\tyield this.y;\n\t\tyield this.z;\n\t\tyield this.w;\n\n\t}\n\n}\n\nexport { Vector4 };\n"],"x_google_ignoreList":[0],"mappings":";;AA0BA,IAAM,IAAN,MAAM,EAAQ;CAUb,YAAa,IAAI,G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A,KAAK,IAAI,EAAO,IAChB,KAAK,IAAI,EAAO,IAAS,IACzB,KAAK,IAAI,EAAO,IAAS,IACzB,KAAK,IAAI,EAAO,IAAS,IAElB;;CAYR,QAAS,IAAQ,EAAE,EAAE,IAAS,GAAI;AAOjC,SALA,EAAO,KAAW,KAAK,GACvB,EAAO,IAAS,KAAM,KAAK,GAC3B,EAAO,IAAS,KAAM,KAAK,GAC3B,EAAO,IAAS,KAAM,KAAK,GAEpB;;CAWR,oBAAqB,GAAW,GAAQ;AAOvC,SALA,KAAK,IAAI,EAAU,KAAM,EAAO,EAChC,KAAK,IAAI,EAAU,KAAM,EAAO,EAChC,KAAK,IAAI,EAAU,KAAM,EAAO,EAChC,KAAK,IAAI,EAAU,KAAM,EAAO,EAEzB;;CAUR,SAAS;AAOR,SALA,KAAK,IAAI,KAAK,QAAQ,EACtB,KAAK,IAAI,KAAK,QAAQ,EACtB,KAAK,IAAI,KAAK,QAAQ,EACtB,KAAK,IAAI,KAAK,QAAQ,EAEf;;CAIR,EAAG,OAAO,YAAa;AAKtB,EAHA,MAAM,KAAK,GACX,MAAM,KAAK,GACX,MAAM,KAAK,GACX,MAAM,KAAK"}
1
+ {"version":3,"file":"Vector4-DUqY3Egg.mjs","names":[],"sources":["../../../../node_modules/three/src/math/Vector4.js"],"sourcesContent":["import { clamp } from './MathUtils.js';\n\n/**\n * Class representing a 4D vector. A 4D vector is an ordered quadruplet of numbers\n * (labeled x, y, z and w), which can be used to represent a number of things, such as:\n *\n * - A point in 4D space.\n * - A direction and length in 4D space. In three.js the length will\n * always be the Euclidean distance(straight-line distance) from `(0, 0, 0, 0)` to `(x, y, z, w)`\n * and the direction is also measured from `(0, 0, 0, 0)` towards `(x, y, z, w)`.\n * - Any arbitrary ordered quadruplet of numbers.\n *\n * There are other things a 4D vector can be used to represent, however these\n * are the most common uses in *three.js*.\n *\n * Iterating through a vector instance will yield its components `(x, y, z, w)` in\n * the corresponding order.\n * ```js\n * const a = new THREE.Vector4( 0, 1, 0, 0 );\n *\n * //no arguments; will be initialised to (0, 0, 0, 1)\n * const b = new THREE.Vector4( );\n *\n * const d = a.dot( b );\n * ```\n */\nclass Vector4 {\n\n\t/**\n\t * Constructs a new 4D vector.\n\t *\n\t * @param {number} [x=0] - The x value of this vector.\n\t * @param {number} [y=0] - The y value of this vector.\n\t * @param {number} [z=0] - The z value of this vector.\n\t * @param {number} [w=1] - The w value of this vector.\n\t */\n\tconstructor( x = 0, y = 0, z = 0, w = 1 ) {\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tVector4.prototype.isVector4 = true;\n\n\t\t/**\n\t\t * The x value of this vector.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tthis.x = x;\n\n\t\t/**\n\t\t * The y value of this vector.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tthis.y = y;\n\n\t\t/**\n\t\t * The z value of this vector.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tthis.z = z;\n\n\t\t/**\n\t\t * The w value of this vector.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tthis.w = w;\n\n\t}\n\n\t/**\n\t * Alias for {@link Vector4#z}.\n\t *\n\t * @type {number}\n\t */\n\tget width() {\n\n\t\treturn this.z;\n\n\t}\n\n\tset width( value ) {\n\n\t\tthis.z = value;\n\n\t}\n\n\t/**\n\t * Alias for {@link Vector4#w}.\n\t *\n\t * @type {number}\n\t */\n\tget height() {\n\n\t\treturn this.w;\n\n\t}\n\n\tset height( value ) {\n\n\t\tthis.w = value;\n\n\t}\n\n\t/**\n\t * Sets the vector components.\n\t *\n\t * @param {number} x - The value of the x component.\n\t * @param {number} y - The value of the y component.\n\t * @param {number} z - The value of the z component.\n\t * @param {number} w - The value of the w component.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tset( x, y, z, w ) {\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.z = z;\n\t\tthis.w = w;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the vector components to the same value.\n\t *\n\t * @param {number} scalar - The value to set for all vector components.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsetScalar( scalar ) {\n\n\t\tthis.x = scalar;\n\t\tthis.y = scalar;\n\t\tthis.z = scalar;\n\t\tthis.w = scalar;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the vector's x component to the given value\n\t *\n\t * @param {number} x - The value to set.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsetX( x ) {\n\n\t\tthis.x = x;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the vector's y component to the given value\n\t *\n\t * @param {number} y - The value to set.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsetY( y ) {\n\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the vector's z component to the given value\n\t *\n\t * @param {number} z - The value to set.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsetZ( z ) {\n\n\t\tthis.z = z;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the vector's w component to the given value\n\t *\n\t * @param {number} w - The value to set.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsetW( w ) {\n\n\t\tthis.w = w;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Allows to set a vector component with an index.\n\t *\n\t * @param {number} index - The component index. `0` equals to x, `1` equals to y,\n\t * `2` equals to z, `3` equals to w.\n\t * @param {number} value - The value to set.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsetComponent( index, value ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: this.x = value; break;\n\t\t\tcase 1: this.y = value; break;\n\t\t\tcase 2: this.z = value; break;\n\t\t\tcase 3: this.w = value; break;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns the value of the vector component which matches the given index.\n\t *\n\t * @param {number} index - The component index. `0` equals to x, `1` equals to y,\n\t * `2` equals to z, `3` equals to w.\n\t * @return {number} A vector component value.\n\t */\n\tgetComponent( index ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: return this.x;\n\t\t\tcase 1: return this.y;\n\t\t\tcase 2: return this.z;\n\t\t\tcase 3: return this.w;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Returns a new vector with copied values from this instance.\n\t *\n\t * @return {Vector4} A clone of this instance.\n\t */\n\tclone() {\n\n\t\treturn new this.constructor( this.x, this.y, this.z, this.w );\n\n\t}\n\n\t/**\n\t * Copies the values of the given vector to this instance.\n\t *\n\t * @param {Vector3|Vector4} v - The vector to copy.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tcopy( v ) {\n\n\t\tthis.x = v.x;\n\t\tthis.y = v.y;\n\t\tthis.z = v.z;\n\t\tthis.w = ( v.w !== undefined ) ? v.w : 1;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds the given vector to this instance.\n\t *\n\t * @param {Vector4} v - The vector to add.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tadd( v ) {\n\n\t\tthis.x += v.x;\n\t\tthis.y += v.y;\n\t\tthis.z += v.z;\n\t\tthis.w += v.w;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds the given scalar value to all components of this instance.\n\t *\n\t * @param {number} s - The scalar to add.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\taddScalar( s ) {\n\n\t\tthis.x += s;\n\t\tthis.y += s;\n\t\tthis.z += s;\n\t\tthis.w += s;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds the given vectors and stores the result in this instance.\n\t *\n\t * @param {Vector4} a - The first vector.\n\t * @param {Vector4} b - The second vector.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\taddVectors( a, b ) {\n\n\t\tthis.x = a.x + b.x;\n\t\tthis.y = a.y + b.y;\n\t\tthis.z = a.z + b.z;\n\t\tthis.w = a.w + b.w;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Adds the given vector scaled by the given factor to this instance.\n\t *\n\t * @param {Vector4} v - The vector.\n\t * @param {number} s - The factor that scales `v`.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\taddScaledVector( v, s ) {\n\n\t\tthis.x += v.x * s;\n\t\tthis.y += v.y * s;\n\t\tthis.z += v.z * s;\n\t\tthis.w += v.w * s;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Subtracts the given vector from this instance.\n\t *\n\t * @param {Vector4} v - The vector to subtract.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsub( v ) {\n\n\t\tthis.x -= v.x;\n\t\tthis.y -= v.y;\n\t\tthis.z -= v.z;\n\t\tthis.w -= v.w;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Subtracts the given scalar value from all components of this instance.\n\t *\n\t * @param {number} s - The scalar to subtract.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsubScalar( s ) {\n\n\t\tthis.x -= s;\n\t\tthis.y -= s;\n\t\tthis.z -= s;\n\t\tthis.w -= s;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Subtracts the given vectors and stores the result in this instance.\n\t *\n\t * @param {Vector4} a - The first vector.\n\t * @param {Vector4} b - The second vector.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsubVectors( a, b ) {\n\n\t\tthis.x = a.x - b.x;\n\t\tthis.y = a.y - b.y;\n\t\tthis.z = a.z - b.z;\n\t\tthis.w = a.w - b.w;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Multiplies the given vector with this instance.\n\t *\n\t * @param {Vector4} v - The vector to multiply.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tmultiply( v ) {\n\n\t\tthis.x *= v.x;\n\t\tthis.y *= v.y;\n\t\tthis.z *= v.z;\n\t\tthis.w *= v.w;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Multiplies the given scalar value with all components of this instance.\n\t *\n\t * @param {number} scalar - The scalar to multiply.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tmultiplyScalar( scalar ) {\n\n\t\tthis.x *= scalar;\n\t\tthis.y *= scalar;\n\t\tthis.z *= scalar;\n\t\tthis.w *= scalar;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Multiplies this vector with the given 4x4 matrix.\n\t *\n\t * @param {Matrix4} m - The 4x4 matrix.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tapplyMatrix4( m ) {\n\n\t\tconst x = this.x, y = this.y, z = this.z, w = this.w;\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] * w;\n\t\tthis.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] * w;\n\t\tthis.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] * w;\n\t\tthis.w = e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] * w;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Divides this instance by the given vector.\n\t *\n\t * @param {Vector4} v - The vector to divide.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tdivide( v ) {\n\n\t\tthis.x /= v.x;\n\t\tthis.y /= v.y;\n\t\tthis.z /= v.z;\n\t\tthis.w /= v.w;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Divides this vector by the given scalar.\n\t *\n\t * @param {number} scalar - The scalar to divide.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tdivideScalar( scalar ) {\n\n\t\treturn this.multiplyScalar( 1 / scalar );\n\n\t}\n\n\t/**\n\t * Sets the x, y and z components of this\n\t * vector to the quaternion's axis and w to the angle.\n\t *\n\t * @param {Quaternion} q - The Quaternion to set.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsetAxisAngleFromQuaternion( q ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm\n\n\t\t// q is assumed to be normalized\n\n\t\tthis.w = 2 * Math.acos( q.w );\n\n\t\tconst s = Math.sqrt( 1 - q.w * q.w );\n\n\t\tif ( s < 0.0001 ) {\n\n\t\t\tthis.x = 1;\n\t\t\tthis.y = 0;\n\t\t\tthis.z = 0;\n\n\t\t} else {\n\n\t\t\tthis.x = q.x / s;\n\t\t\tthis.y = q.y / s;\n\t\t\tthis.z = q.z / s;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the x, y and z components of this\n\t * vector to the axis of rotation and w to the angle.\n\t *\n\t * @param {Matrix4} m - A 4x4 matrix of which the upper left 3x3 matrix is a pure rotation matrix.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsetAxisAngleFromRotationMatrix( m ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tlet angle, x, y, z; // variables for result\n\t\tconst epsilon = 0.01,\t\t// margin to allow for rounding errors\n\t\t\tepsilon2 = 0.1,\t\t// margin to distinguish between 0 and 180 degrees\n\n\t\t\tte = m.elements,\n\n\t\t\tm11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ],\n\t\t\tm21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ],\n\t\t\tm31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ];\n\n\t\tif ( ( Math.abs( m12 - m21 ) < epsilon ) &&\n\t\t ( Math.abs( m13 - m31 ) < epsilon ) &&\n\t\t ( Math.abs( m23 - m32 ) < epsilon ) ) {\n\n\t\t\t// singularity found\n\t\t\t// first check for identity matrix which must have +1 for all terms\n\t\t\t// in leading diagonal and zero in other terms\n\n\t\t\tif ( ( Math.abs( m12 + m21 ) < epsilon2 ) &&\n\t\t\t ( Math.abs( m13 + m31 ) < epsilon2 ) &&\n\t\t\t ( Math.abs( m23 + m32 ) < epsilon2 ) &&\n\t\t\t ( Math.abs( m11 + m22 + m33 - 3 ) < epsilon2 ) ) {\n\n\t\t\t\t// this singularity is identity matrix so angle = 0\n\n\t\t\t\tthis.set( 1, 0, 0, 0 );\n\n\t\t\t\treturn this; // zero angle, arbitrary axis\n\n\t\t\t}\n\n\t\t\t// otherwise this singularity is angle = 180\n\n\t\t\tangle = Math.PI;\n\n\t\t\tconst xx = ( m11 + 1 ) / 2;\n\t\t\tconst yy = ( m22 + 1 ) / 2;\n\t\t\tconst zz = ( m33 + 1 ) / 2;\n\t\t\tconst xy = ( m12 + m21 ) / 4;\n\t\t\tconst xz = ( m13 + m31 ) / 4;\n\t\t\tconst yz = ( m23 + m32 ) / 4;\n\n\t\t\tif ( ( xx > yy ) && ( xx > zz ) ) {\n\n\t\t\t\t// m11 is the largest diagonal term\n\n\t\t\t\tif ( xx < epsilon ) {\n\n\t\t\t\t\tx = 0;\n\t\t\t\t\ty = 0.707106781;\n\t\t\t\t\tz = 0.707106781;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tx = Math.sqrt( xx );\n\t\t\t\t\ty = xy / x;\n\t\t\t\t\tz = xz / x;\n\n\t\t\t\t}\n\n\t\t\t} else if ( yy > zz ) {\n\n\t\t\t\t// m22 is the largest diagonal term\n\n\t\t\t\tif ( yy < epsilon ) {\n\n\t\t\t\t\tx = 0.707106781;\n\t\t\t\t\ty = 0;\n\t\t\t\t\tz = 0.707106781;\n\n\t\t\t\t} else {\n\n\t\t\t\t\ty = Math.sqrt( yy );\n\t\t\t\t\tx = xy / y;\n\t\t\t\t\tz = yz / y;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// m33 is the largest diagonal term so base result on this\n\n\t\t\t\tif ( zz < epsilon ) {\n\n\t\t\t\t\tx = 0.707106781;\n\t\t\t\t\ty = 0.707106781;\n\t\t\t\t\tz = 0;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tz = Math.sqrt( zz );\n\t\t\t\t\tx = xz / z;\n\t\t\t\t\ty = yz / z;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.set( x, y, z, angle );\n\n\t\t\treturn this; // return 180 deg rotation\n\n\t\t}\n\n\t\t// as we have reached here there are no singularities so we can handle normally\n\n\t\tlet s = Math.sqrt( ( m32 - m23 ) * ( m32 - m23 ) +\n\t\t\t( m13 - m31 ) * ( m13 - m31 ) +\n\t\t\t( m21 - m12 ) * ( m21 - m12 ) ); // used to normalize\n\n\t\tif ( Math.abs( s ) < 0.001 ) s = 1;\n\n\t\t// prevent divide by zero, should not happen if matrix is orthogonal and should be\n\t\t// caught by singularity test above, but I've left it in just in case\n\n\t\tthis.x = ( m32 - m23 ) / s;\n\t\tthis.y = ( m13 - m31 ) / s;\n\t\tthis.z = ( m21 - m12 ) / s;\n\t\tthis.w = Math.acos( ( m11 + m22 + m33 - 1 ) / 2 );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the vector components to the position elements of the\n\t * given transformation matrix.\n\t *\n\t * @param {Matrix4} m - The 4x4 matrix.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsetFromMatrixPosition( m ) {\n\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 12 ];\n\t\tthis.y = e[ 13 ];\n\t\tthis.z = e[ 14 ];\n\t\tthis.w = e[ 15 ];\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * If this vector's x, y, z or w value is greater than the given vector's x, y, z or w\n\t * value, replace that value with the corresponding min value.\n\t *\n\t * @param {Vector4} v - The vector.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tmin( v ) {\n\n\t\tthis.x = Math.min( this.x, v.x );\n\t\tthis.y = Math.min( this.y, v.y );\n\t\tthis.z = Math.min( this.z, v.z );\n\t\tthis.w = Math.min( this.w, v.w );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * If this vector's x, y, z or w value is less than the given vector's x, y, z or w\n\t * value, replace that value with the corresponding max value.\n\t *\n\t * @param {Vector4} v - The vector.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tmax( v ) {\n\n\t\tthis.x = Math.max( this.x, v.x );\n\t\tthis.y = Math.max( this.y, v.y );\n\t\tthis.z = Math.max( this.z, v.z );\n\t\tthis.w = Math.max( this.w, v.w );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * If this vector's x, y, z or w value is greater than the max vector's x, y, z or w\n\t * value, it is replaced by the corresponding value.\n\t * If this vector's x, y, z or w value is less than the min vector's x, y, z or w value,\n\t * it is replaced by the corresponding value.\n\t *\n\t * @param {Vector4} min - The minimum x, y and z values.\n\t * @param {Vector4} max - The maximum x, y and z values in the desired range.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tclamp( min, max ) {\n\n\t\t// assumes min < max, componentwise\n\n\t\tthis.x = clamp( this.x, min.x, max.x );\n\t\tthis.y = clamp( this.y, min.y, max.y );\n\t\tthis.z = clamp( this.z, min.z, max.z );\n\t\tthis.w = clamp( this.w, min.w, max.w );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * If this vector's x, y, z or w values are greater than the max value, they are\n\t * replaced by the max value.\n\t * If this vector's x, y, z or w values are less than the min value, they are\n\t * replaced by the min value.\n\t *\n\t * @param {number} minVal - The minimum value the components will be clamped to.\n\t * @param {number} maxVal - The maximum value the components will be clamped to.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tclampScalar( minVal, maxVal ) {\n\n\t\tthis.x = clamp( this.x, minVal, maxVal );\n\t\tthis.y = clamp( this.y, minVal, maxVal );\n\t\tthis.z = clamp( this.z, minVal, maxVal );\n\t\tthis.w = clamp( this.w, minVal, maxVal );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * If this vector's length is greater than the max value, it is replaced by\n\t * the max value.\n\t * If this vector's length is less than the min value, it is replaced by the\n\t * min value.\n\t *\n\t * @param {number} min - The minimum value the vector length will be clamped to.\n\t * @param {number} max - The maximum value the vector length will be clamped to.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tclampLength( min, max ) {\n\n\t\tconst length = this.length();\n\n\t\treturn this.divideScalar( length || 1 ).multiplyScalar( clamp( length, min, max ) );\n\n\t}\n\n\t/**\n\t * The components of this vector are rounded down to the nearest integer value.\n\t *\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tfloor() {\n\n\t\tthis.x = Math.floor( this.x );\n\t\tthis.y = Math.floor( this.y );\n\t\tthis.z = Math.floor( this.z );\n\t\tthis.w = Math.floor( this.w );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * The components of this vector are rounded up to the nearest integer value.\n\t *\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tceil() {\n\n\t\tthis.x = Math.ceil( this.x );\n\t\tthis.y = Math.ceil( this.y );\n\t\tthis.z = Math.ceil( this.z );\n\t\tthis.w = Math.ceil( this.w );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * The components of this vector are rounded to the nearest integer value\n\t *\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tround() {\n\n\t\tthis.x = Math.round( this.x );\n\t\tthis.y = Math.round( this.y );\n\t\tthis.z = Math.round( this.z );\n\t\tthis.w = Math.round( this.w );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * The components of this vector are rounded towards zero (up if negative,\n\t * down if positive) to an integer value.\n\t *\n\t * @return {Vector4} A reference to this vector.\n\t */\n\troundToZero() {\n\n\t\tthis.x = Math.trunc( this.x );\n\t\tthis.y = Math.trunc( this.y );\n\t\tthis.z = Math.trunc( this.z );\n\t\tthis.w = Math.trunc( this.w );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Inverts this vector - i.e. sets x = -x, y = -y, z = -z, w = -w.\n\t *\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tnegate() {\n\n\t\tthis.x = - this.x;\n\t\tthis.y = - this.y;\n\t\tthis.z = - this.z;\n\t\tthis.w = - this.w;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Calculates the dot product of the given vector with this instance.\n\t *\n\t * @param {Vector4} v - The vector to compute the dot product with.\n\t * @return {number} The result of the dot product.\n\t */\n\tdot( v ) {\n\n\t\treturn this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w;\n\n\t}\n\n\t/**\n\t * Computes the square of the Euclidean length (straight-line length) from\n\t * (0, 0, 0, 0) to (x, y, z, w). If you are comparing the lengths of vectors, you should\n\t * compare the length squared instead as it is slightly more efficient to calculate.\n\t *\n\t * @return {number} The square length of this vector.\n\t */\n\tlengthSq() {\n\n\t\treturn this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w;\n\n\t}\n\n\t/**\n\t * Computes the Euclidean length (straight-line length) from (0, 0, 0, 0) to (x, y, z, w).\n\t *\n\t * @return {number} The length of this vector.\n\t */\n\tlength() {\n\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w );\n\n\t}\n\n\t/**\n\t * Computes the Manhattan length of this vector.\n\t *\n\t * @return {number} The length of this vector.\n\t */\n\tmanhattanLength() {\n\n\t\treturn Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z ) + Math.abs( this.w );\n\n\t}\n\n\t/**\n\t * Converts this vector to a unit vector - that is, sets it equal to a vector\n\t * with the same direction as this one, but with a vector length of `1`.\n\t *\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tnormalize() {\n\n\t\treturn this.divideScalar( this.length() || 1 );\n\n\t}\n\n\t/**\n\t * Sets this vector to a vector with the same direction as this one, but\n\t * with the specified length.\n\t *\n\t * @param {number} length - The new length of this vector.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tsetLength( length ) {\n\n\t\treturn this.normalize().multiplyScalar( length );\n\n\t}\n\n\t/**\n\t * Linearly interpolates between the given vector and this instance, where\n\t * alpha is the percent distance along the line - alpha = 0 will be this\n\t * vector, and alpha = 1 will be the given one.\n\t *\n\t * @param {Vector4} v - The vector to interpolate towards.\n\t * @param {number} alpha - The interpolation factor, typically in the closed interval `[0, 1]`.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tlerp( v, alpha ) {\n\n\t\tthis.x += ( v.x - this.x ) * alpha;\n\t\tthis.y += ( v.y - this.y ) * alpha;\n\t\tthis.z += ( v.z - this.z ) * alpha;\n\t\tthis.w += ( v.w - this.w ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Linearly interpolates between the given vectors, where alpha is the percent\n\t * distance along the line - alpha = 0 will be first vector, and alpha = 1 will\n\t * be the second one. The result is stored in this instance.\n\t *\n\t * @param {Vector4} v1 - The first vector.\n\t * @param {Vector4} v2 - The second vector.\n\t * @param {number} alpha - The interpolation factor, typically in the closed interval `[0, 1]`.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tlerpVectors( v1, v2, alpha ) {\n\n\t\tthis.x = v1.x + ( v2.x - v1.x ) * alpha;\n\t\tthis.y = v1.y + ( v2.y - v1.y ) * alpha;\n\t\tthis.z = v1.z + ( v2.z - v1.z ) * alpha;\n\t\tthis.w = v1.w + ( v2.w - v1.w ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Returns `true` if this vector is equal with the given one.\n\t *\n\t * @param {Vector4} v - The vector to test for equality.\n\t * @return {boolean} Whether this vector is equal with the given one.\n\t */\n\tequals( v ) {\n\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) && ( v.w === this.w ) );\n\n\t}\n\n\t/**\n\t * Sets this vector's x value to be `array[ offset ]`, y value to be `array[ offset + 1 ]`,\n\t * z value to be `array[ offset + 2 ]`, w value to be `array[ offset + 3 ]`.\n\t *\n\t * @param {Array<number>} array - An array holding the vector component values.\n\t * @param {number} [offset=0] - The offset into the array.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis.x = array[ offset ];\n\t\tthis.y = array[ offset + 1 ];\n\t\tthis.z = array[ offset + 2 ];\n\t\tthis.w = array[ offset + 3 ];\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Writes the components of this vector to the given array. If no array is provided,\n\t * the method returns a new instance.\n\t *\n\t * @param {Array<number>} [array=[]] - The target array holding the vector components.\n\t * @param {number} [offset=0] - Index of the first element in the array.\n\t * @return {Array<number>} The vector components.\n\t */\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this.x;\n\t\tarray[ offset + 1 ] = this.y;\n\t\tarray[ offset + 2 ] = this.z;\n\t\tarray[ offset + 3 ] = this.w;\n\n\t\treturn array;\n\n\t}\n\n\t/**\n\t * Sets the components of this vector from the given buffer attribute.\n\t *\n\t * @param {BufferAttribute} attribute - The buffer attribute holding vector data.\n\t * @param {number} index - The index into the attribute.\n\t * @return {Vector4} A reference to this vector.\n\t */\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis.x = attribute.getX( index );\n\t\tthis.y = attribute.getY( index );\n\t\tthis.z = attribute.getZ( index );\n\t\tthis.w = attribute.getW( index );\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets each component of this vector to a pseudo-random value between `0` and\n\t * `1`, excluding `1`.\n\t *\n\t * @return {Vector4} A reference to this vector.\n\t */\n\trandom() {\n\n\t\tthis.x = Math.random();\n\t\tthis.y = Math.random();\n\t\tthis.z = Math.random();\n\t\tthis.w = Math.random();\n\n\t\treturn this;\n\n\t}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this.x;\n\t\tyield this.y;\n\t\tyield this.z;\n\t\tyield this.w;\n\n\t}\n\n}\n\nexport { Vector4 };\n"],"x_google_ignoreList":[0],"mappings":";;AA0BA,IAAM,IAAN,MAAM,EAAQ;CAUb,YAAa,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAI;AAqCzC,EA5BA,EAAQ,UAAU,YAAY,IAO9B,KAAK,IAAI,GAOT,KAAK,IAAI,GAOT,KAAK,IAAI,GAOT,KAAK,IAAI;;CASV,IAAI,QAAQ;AAEX,SAAO,KAAK;;CAIb,IAAI,MAAO,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AS,KAAM,KAAK,GAC3B,EAAO,IAAS,KAAM,KAAK,GAC3B,EAAO,IAAS,KAAM,KAAK,GAEpB;;CAWR,oBAAqB,GAAW,GAAQ;AAOvC,SALA,KAAK,IAAI,EAAU,KAAM,EAAO,EAChC,KAAK,IAAI,EAAU,KAAM,EAAO,EAChC,KAAK,IAAI,EAAU,KAAM,EAAO,EAChC,KAAK,IAAI,EAAU,KAAM,EAAO,EAEzB;;CAUR,SAAS;AAOR,SALA,KAAK,IAAI,KAAK,QAAQ,EACtB,KAAK,IAAI,KAAK,QAAQ,EACtB,KAAK,IAAI,KAAK,QAAQ,EACtB,KAAK,IAAI,KAAK,QAAQ,EAEf;;CAIR,EAAG,OAAO,YAAa;AAKtB,EAHA,MAAM,KAAK,GACX,MAAM,KAAK,GACX,MAAM,KAAK,GACX,MAAM,KAAK"}
@@ -1,4 +1,4 @@
1
- import { I as e } from "./main-DMIVdAcT.mjs";
1
+ import { R as e } from "./main-BJZ9-cDk.mjs";
2
2
  //#region packages/homag-intelligence/src/api.ts
3
3
  var t = class {
4
4
  constructor(e) {
@@ -52,4 +52,4 @@ var t = class {
52
52
  //#endregion
53
53
  export { t };
54
54
 
55
- //# sourceMappingURL=api-C2-6Jm5W.mjs.map
55
+ //# sourceMappingURL=api-oYzhcs_W.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-C2-6Jm5W.mjs","names":[],"sources":["../../packages/homag-intelligence/src/api.ts"],"sourcesContent":["import type { RoomDesignerRequests } from './glue-logic';\nimport type { MasterData, PosGroup } from './model/oc-scripts-domain.model';\nimport type { RoomlePlannerType } from '../../typings/external-objects';\nimport {\n HI_CONTEXT_ACTION,\n type LoadExternalObjectOptions,\n} from './external-object-api';\n\nexport interface ExternalObjectModuleIdMap {\n originalModuleId: string;\n newModuleId: string;\n}\n\nexport class RoomDesignerApi implements RoomDesignerRequests {\n private _roomlePlanner: RoomlePlannerType;\n\n constructor(roomlePlanner: RoomlePlannerType) {\n this._roomlePlanner = roomlePlanner;\n }\n\n public loadMasterData(masterData: MasterData) {\n this._roomlePlanner.loadExternalObjectMasterData(masterData);\n }\n\n public async loadPosGroups(\n posDataJson: PosGroup | PosGroup[],\n options: LoadExternalObjectOptions,\n ): Promise<void> {\n const posDataArray = Array.isArray(posDataJson)\n ? posDataJson\n : [posDataJson];\n await this._roomlePlanner.loadExternalObjectGroups(posDataArray, options);\n }\n\n completelyLoaded(): void {\n this._roomlePlanner.externalObjectsCompletelyLoaded();\n }\n\n public async selectGroup(groupId: string): Promise<void> {\n await this._roomlePlanner.selectExternalObject(\n groupId,\n null,\n HI_CONTEXT_ACTION.ROOM,\n );\n }\n\n public async selectRoot(rootModuleId: string): Promise<void> {\n await this._roomlePlanner.selectExternalObject(\n rootModuleId,\n null,\n HI_CONTEXT_ACTION.ISOLATION,\n );\n }\n\n public async selectModule(\n rootModuleId: string,\n subModuleId: string,\n ): Promise<void> {\n await this._roomlePlanner.selectExternalObject(\n rootModuleId,\n subModuleId,\n HI_CONTEXT_ACTION.ISOLATION,\n );\n }\n\n public openCloseGroup(\n groupOrRootModuleId: string,\n subModuleId: string | null,\n open: boolean,\n animate: boolean,\n ) {\n this._roomlePlanner.openOrCloseGeometryOfExternalObject(\n groupOrRootModuleId,\n subModuleId ?? null,\n open,\n animate,\n );\n return Promise.resolve();\n }\n\n public deleteGroup(groupId: string) {\n this._roomlePlanner.removeExternalObject(groupId);\n }\n\n public deleteRootModule(rootModuleId: string) {\n this._roomlePlanner.removeExternalObject(rootModuleId);\n }\n\n public async getPosDataOfAllGroups() {\n const groups =\n (await this._roomlePlanner.getExternalObjectGroups()) as PosGroup[];\n return groups;\n }\n\n public async getRoomInformation() {\n const rooms = await this._roomlePlanner.getExternalRoomInformation();\n return rooms;\n }\n\n public async saveExternalObjectSnapshot() {\n return this._roomlePlanner.saveExternalObjectSnapshot();\n }\n\n public async saveCurrentPlanSnapshot() {\n return this._roomlePlanner.saveCurrentPlanSnapshot();\n }\n\n public async renderPosDataImage(posDataJson: object) {\n const posDataArray = Array.isArray(posDataJson)\n ? posDataJson\n : [posDataJson];\n await this._roomlePlanner.renderImagesOfExternalObjectGroup(posDataArray);\n }\n}\n"],"mappings":";;AAaA,IAAa,IAAb,MAA6D;CAG3D,YAAY,GAAkC;AAC5C,OAAK,iBAAiB;;CAGxB,eAAsB,GAAwB;AAC5C,OAAK,eAAe,6BAA6B,EAAW;;CAG9D,MAAa,cACX,GACA,GACe;EACf,IAAM,IAAe,MAAM,QAAQ,EAAY,GAC3C,IACA,CAAC,EAAY;AACjB,QAAM,KAAK,eAAe,yBAAyB,GAAc,EAAQ;;CAG3E,mBAAyB;AACvB,OAAK,eAAe,iCAAiC;;CAGvD,MAAa,YAAY,GAAgC;AACvD,QAAM,KAAK,eAAe,qBACxB,GACA,MACA,EAAkB,KACnB;;CAGH,MAAa,WAAW,GAAqC;AAC3D,QAAM,KAAK,eAAe,qBACxB,GACA,MACA,EAAkB,UACnB;;CAGH,MAAa,aACX,GACA,GACe;AACf,QAAM,KAAK,eAAe,qBACxB,GACA,GACA,EAAkB,UACnB;;CAGH,eACE,GACA,GACA,GACA,GACA;AAOA,SANA,KAAK,eAAe,oCAClB,GACA,KAAe,MACf,GACA,EACD,EACM,QAAQ,SAAS;;CAG1B,YAAmB,GAAiB;AAClC,OAAK,eAAe,qBAAqB,EAAQ;;CAGnD,iBAAwB,GAAsB;AAC5C,OAAK,eAAe,qBAAqB,EAAa;;CAGxD,MAAa,wBAAwB;AAGnC,SADG,MAAM,KAAK,eAAe,yBAAyB;;CAIxD,MAAa,qBAAqB;AAEhC,SADc,MAAM,KAAK,eAAe,4BAA4B;;CAItE,MAAa,6BAA6B;AACxC,SAAO,KAAK,eAAe,4BAA4B;;CAGzD,MAAa,0BAA0B;AACrC,SAAO,KAAK,eAAe,yBAAyB;;CAGtD,MAAa,mBAAmB,GAAqB;EACnD,IAAM,IAAe,MAAM,QAAQ,EAAY,GAC3C,IACA,CAAC,EAAY;AACjB,QAAM,KAAK,eAAe,kCAAkC,EAAa"}
1
+ {"version":3,"file":"api-oYzhcs_W.mjs","names":[],"sources":["../../packages/homag-intelligence/src/api.ts"],"sourcesContent":["import type { RoomDesignerRequests } from './glue-logic';\nimport type { MasterData, PosGroup } from './model/oc-scripts-domain.model';\nimport type { RoomlePlannerType } from '../../typings/external-objects';\nimport {\n HI_CONTEXT_ACTION,\n type LoadExternalObjectOptions,\n} from './external-object-api';\n\nexport interface ExternalObjectModuleIdMap {\n originalModuleId: string;\n newModuleId: string;\n}\n\nexport class RoomDesignerApi implements RoomDesignerRequests {\n private _roomlePlanner: RoomlePlannerType;\n\n constructor(roomlePlanner: RoomlePlannerType) {\n this._roomlePlanner = roomlePlanner;\n }\n\n public loadMasterData(masterData: MasterData) {\n this._roomlePlanner.loadExternalObjectMasterData(masterData);\n }\n\n public async loadPosGroups(\n posDataJson: PosGroup | PosGroup[],\n options: LoadExternalObjectOptions,\n ): Promise<void> {\n const posDataArray = Array.isArray(posDataJson)\n ? posDataJson\n : [posDataJson];\n await this._roomlePlanner.loadExternalObjectGroups(posDataArray, options);\n }\n\n completelyLoaded(): void {\n this._roomlePlanner.externalObjectsCompletelyLoaded();\n }\n\n public async selectGroup(groupId: string): Promise<void> {\n await this._roomlePlanner.selectExternalObject(\n groupId,\n null,\n HI_CONTEXT_ACTION.ROOM,\n );\n }\n\n public async selectRoot(rootModuleId: string): Promise<void> {\n await this._roomlePlanner.selectExternalObject(\n rootModuleId,\n null,\n HI_CONTEXT_ACTION.ISOLATION,\n );\n }\n\n public async selectModule(\n rootModuleId: string,\n subModuleId: string,\n ): Promise<void> {\n await this._roomlePlanner.selectExternalObject(\n rootModuleId,\n subModuleId,\n HI_CONTEXT_ACTION.ISOLATION,\n );\n }\n\n public openCloseGroup(\n groupOrRootModuleId: string,\n subModuleId: string | null,\n open: boolean,\n animate: boolean,\n ) {\n this._roomlePlanner.openOrCloseGeometryOfExternalObject(\n groupOrRootModuleId,\n subModuleId ?? null,\n open,\n animate,\n );\n return Promise.resolve();\n }\n\n public deleteGroup(groupId: string) {\n this._roomlePlanner.removeExternalObject(groupId);\n }\n\n public deleteRootModule(rootModuleId: string) {\n this._roomlePlanner.removeExternalObject(rootModuleId);\n }\n\n public async getPosDataOfAllGroups() {\n const groups =\n (await this._roomlePlanner.getExternalObjectGroups()) as PosGroup[];\n return groups;\n }\n\n public async getRoomInformation() {\n const rooms = await this._roomlePlanner.getExternalRoomInformation();\n return rooms;\n }\n\n public async saveExternalObjectSnapshot() {\n return this._roomlePlanner.saveExternalObjectSnapshot();\n }\n\n public async saveCurrentPlanSnapshot() {\n return this._roomlePlanner.saveCurrentPlanSnapshot();\n }\n\n public async renderPosDataImage(posDataJson: object) {\n const posDataArray = Array.isArray(posDataJson)\n ? posDataJson\n : [posDataJson];\n await this._roomlePlanner.renderImagesOfExternalObjectGroup(posDataArray);\n }\n}\n"],"mappings":";;AAaA,IAAa,IAAb,MAA6D;CAG3D,YAAY,GAAkC;AAC5C,OAAK,iBAAiB;;CAGxB,eAAsB,GAAwB;AAC5C,OAAK,eAAe,6BAA6B,EAAW;;CAG9D,MAAa,cACX,GACA,GACe;EACf,IAAM,IAAe,MAAM,QAAQ,EAAY,GAC3C,IACA,CAAC,EAAY;AACjB,QAAM,KAAK,eAAe,yBAAyB,GAAc,EAAQ;;CAG3E,mBAAyB;AACvB,OAAK,eAAe,iCAAiC;;CAGvD,MAAa,YAAY,GAAgC;AACvD,QAAM,KAAK,eAAe,qBACxB,GACA,MACA,EAAkB,KACnB;;CAGH,MAAa,WAAW,GAAqC;AAC3D,QAAM,KAAK,eAAe,qBACxB,GACA,MACA,EAAkB,UACnB;;CAGH,MAAa,aACX,GACA,GACe;AACf,QAAM,KAAK,eAAe,qBACxB,GACA,GACA,EAAkB,UACnB;;CAGH,eACE,GACA,GACA,GACA,GACA;AAOA,SANA,KAAK,eAAe,oCAClB,GACA,KAAe,MACf,GACA,EACD,EACM,QAAQ,SAAS;;CAG1B,YAAmB,GAAiB;AAClC,OAAK,eAAe,qBAAqB,EAAQ;;CAGnD,iBAAwB,GAAsB;AAC5C,OAAK,eAAe,qBAAqB,EAAa;;CAGxD,MAAa,wBAAwB;AAGnC,SADG,MAAM,KAAK,eAAe,yBAAyB;;CAIxD,MAAa,qBAAqB;AAEhC,SADc,MAAM,KAAK,eAAe,4BAA4B;;CAItE,MAAa,6BAA6B;AACxC,SAAO,KAAK,eAAe,4BAA4B;;CAGzD,MAAa,0BAA0B;AACrC,SAAO,KAAK,eAAe,yBAAyB;;CAGtD,MAAa,mBAAmB,GAAqB;EACnD,IAAM,IAAe,MAAM,QAAQ,EAAY,GAC3C,IACA,CAAC,EAAY;AACjB,QAAM,KAAK,eAAe,kCAAkC,EAAa"}
@@ -0,0 +1,6 @@
1
+ //#region packages/workers/generated/asset-loader.worker.js?no-inline?url
2
+ var e = "" + new URL("asset-loader.worker.js", import.meta.url).href;
3
+ //#endregion
4
+ export { e as default };
5
+
6
+ //# sourceMappingURL=asset-loader.worker-A7nEeQB4.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asset-loader.worker-A7nEeQB4.mjs","names":[],"sources":["../../packages/workers/generated/asset-loader.worker.js?no-inline?url"],"sourcesContent":["export default \"__VITE_ASSET__ykb1zIozoJBMq4UvQnlhcQ__\""],"mappings":";AAAA,IAAA,IAAe,KAAA,IAAA,IAAA,0BAAA,OAAA,KAAA,IAAA,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import { xi as e } from "./three.core-mM-jZdgg.mjs";
2
- import { n as t, r as n, t as r } from "./decorate-BIflHDAa.mjs";
3
- import { n as i } from "./plugin-system-XhOJU1MI.mjs";
2
+ import { n as t, r as n, t as r } from "./decorate-BAtqSPNS.mjs";
3
+ import { n as i } from "./plugin-system-DInww4H_.mjs";
4
4
  //#region packages/configurator-core/public/geometry/banana.glb?no-inline?url
5
5
  var a = "" + new URL("banana.glb", import.meta.url).href, o = class extends i {
6
6
  setScene(e) {
@@ -33,4 +33,4 @@ r([n, t("design:type", Object)], o.prototype, "_staticItemLoader", void 0);
33
33
  //#endregion
34
34
  export { o as default };
35
35
 
36
- //# sourceMappingURL=banana-for-scale-BV_na-g3.mjs.map
36
+ //# sourceMappingURL=banana-for-scale-D8t2dmc7.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"banana-for-scale-BV_na-g3.mjs","names":[],"sources":["../../packages/configurator-core/public/geometry/banana.glb?no-inline?url","../../packages/configurator-core/src/webgl/banana-for-scale.ts"],"sourcesContent":["export default \"__VITE_ASSET__rN_1li4k2aIbHGs0zKW8QQ__\"","import inject from '../../../common-core/src/di/inject';\nimport type StaticItemLoader from '../../../common-core/src/webgl/static-item-loader';\nimport { ScenePluginDefaultImplementation } from './plugin-system';\nimport { BANANA_FILE_NAME } from '../static-files/geometries';\nimport type { Box3, Object3D, Scene } from 'three';\nimport { Vector3 } from 'three';\n\nexport default class BananaForScale extends ScenePluginDefaultImplementation {\n private _scene: Scene;\n private _bounds: Box3;\n private _banana: Object3D;\n\n @inject\n private _staticItemLoader: StaticItemLoader;\n\n public setScene(scene: Scene) {\n this._scene = scene;\n\n this._staticItemLoader.loadGLB(BANANA_FILE_NAME).then((glb) => {\n this._banana = glb.scene;\n this.updateBounds(null);\n });\n\n console.log(\n '%c' + 'Banana 3D model by https://sketchfab.com/daniel132',\n 'color: #ffe135',\n );\n console.log(\n '%c' +\n 'Banana source: https://sketchfab.com/3d-models/banana-mark-2-a7fef734bf4544cb8a780a858fa6af97',\n 'color: #ffe135',\n );\n console.log(\n '%c' +\n 'Licensed under Creative Commons 4.0: https://creativecommons.org/licenses/by/4.0/',\n 'color: #ffe135',\n );\n }\n\n public updateBounds(bounds: Box3 | null) {\n if (bounds) {\n this._bounds = bounds;\n }\n if (!this._bounds) {\n return;\n }\n if (this._banana) {\n const size = this._bounds.getSize(new Vector3());\n const center = this._bounds.getCenter(new Vector3());\n const position = center.clone();\n position.x -= size.x / 2 + 0.18;\n position.z += size.z / 2 + 0.05;\n position.y = 0;\n let scale = 0.1;\n this._banana.scale.copy(new Vector3(scale, scale, scale));\n this._banana.rotation.y = 0.6;\n this._banana.position.copy(position);\n }\n if (!this._scene.children.includes(this._banana)) {\n this.addToScene();\n }\n }\n\n public clearScene(scene: Scene, uiScene: Scene): void {\n super.clearScene(scene, uiScene);\n\n this.removeFromScene();\n }\n\n public addToScene(): void {\n if (!this._scene || !this._banana) {\n return;\n }\n this._scene.add(this._banana);\n }\n\n public removeFromScene(): void {\n if (!this._scene || !this._banana) {\n return;\n }\n this._scene.remove(this._banana);\n }\n}\n"],"mappings":";;;;AAAA,IAAA,IAAe,KAAA,IAAA,IAAA,cAAA,OAAA,KAAA,IAAA,CAAA,MCOM,IAArB,cAA4C,EAAiC;CAQ3E,SAAgB,GAAc;AAiB5B,EAhBA,KAAK,SAAS,GAEd,KAAK,kBAAkB,QAAQ,EAAiB,CAAC,MAAM,MAAQ;AAE7D,GADA,KAAK,UAAU,EAAI,OACnB,KAAK,aAAa,KAAK;IACvB,EAEF,QAAQ,IACN,wDACA,iBACD,EACD,QAAQ,IACN,mGAEA,iBACD,EACD,QAAQ,IACN,uFAEA,iBACD;;CAGH,aAAoB,GAAqB;AACvC,MAAI,MACF,KAAK,UAAU,IAEZ,KAAK,SAGV;OAAI,KAAK,SAAS;IAChB,IAAM,IAAO,KAAK,QAAQ,QAAQ,IAAI,GAAS,CAAC,EAE1C,IADS,KAAK,QAAQ,UAAU,IAAI,GAAS,CAAC,CAC5B,OAAO;AAG/B,IAFA,EAAS,KAAK,EAAK,IAAI,IAAI,KAC3B,EAAS,KAAK,EAAK,IAAI,IAAI,KAC3B,EAAS,IAAI;IACb,IAAI,IAAQ;AAGZ,IAFA,KAAK,QAAQ,MAAM,KAAK,IAAI,EAAQ,GAAO,GAAO,EAAM,CAAC,EACzD,KAAK,QAAQ,SAAS,IAAI,IAC1B,KAAK,QAAQ,SAAS,KAAK,EAAS;;AAEtC,GAAK,KAAK,OAAO,SAAS,SAAS,KAAK,QAAQ,IAC9C,KAAK,YAAY;;;CAIrB,WAAkB,GAAc,GAAsB;AAGpD,EAFA,MAAM,WAAW,GAAO,EAAQ,EAEhC,KAAK,iBAAiB;;CAGxB,aAA0B;AACpB,GAAC,KAAK,UAAU,CAAC,KAAK,WAG1B,KAAK,OAAO,IAAI,KAAK,QAAQ;;CAG/B,kBAA+B;AACzB,GAAC,KAAK,UAAU,CAAC,KAAK,WAG1B,KAAK,OAAO,OAAO,KAAK,QAAQ;;;GApEjC,GAAA,EAAA,eAAA,OAAA,CAAA,EAAA,EAAA,WAAA,qBAAA,KAAA,EAAA"}
1
+ {"version":3,"file":"banana-for-scale-D8t2dmc7.mjs","names":[],"sources":["../../packages/configurator-core/public/geometry/banana.glb?no-inline?url","../../packages/configurator-core/src/webgl/banana-for-scale.ts"],"sourcesContent":["export default \"__VITE_ASSET__2$LtLFQdS6IeO$uJxLxRJQ__\"","import inject from '../../../common-core/src/di/inject';\nimport type StaticItemLoader from '../../../common-core/src/webgl/static-item-loader';\nimport { ScenePluginDefaultImplementation } from './plugin-system';\nimport { BANANA_FILE_NAME } from '../static-files/geometries';\nimport type { Box3, Object3D, Scene } from 'three';\nimport { Vector3 } from 'three';\n\nexport default class BananaForScale extends ScenePluginDefaultImplementation {\n private _scene: Scene;\n private _bounds: Box3;\n private _banana: Object3D;\n\n @inject\n private _staticItemLoader: StaticItemLoader;\n\n public setScene(scene: Scene) {\n this._scene = scene;\n\n this._staticItemLoader.loadGLB(BANANA_FILE_NAME).then((glb) => {\n this._banana = glb.scene;\n this.updateBounds(null);\n });\n\n console.log(\n '%c' + 'Banana 3D model by https://sketchfab.com/daniel132',\n 'color: #ffe135',\n );\n console.log(\n '%c' +\n 'Banana source: https://sketchfab.com/3d-models/banana-mark-2-a7fef734bf4544cb8a780a858fa6af97',\n 'color: #ffe135',\n );\n console.log(\n '%c' +\n 'Licensed under Creative Commons 4.0: https://creativecommons.org/licenses/by/4.0/',\n 'color: #ffe135',\n );\n }\n\n public updateBounds(bounds: Box3 | null) {\n if (bounds) {\n this._bounds = bounds;\n }\n if (!this._bounds) {\n return;\n }\n if (this._banana) {\n const size = this._bounds.getSize(new Vector3());\n const center = this._bounds.getCenter(new Vector3());\n const position = center.clone();\n position.x -= size.x / 2 + 0.18;\n position.z += size.z / 2 + 0.05;\n position.y = 0;\n let scale = 0.1;\n this._banana.scale.copy(new Vector3(scale, scale, scale));\n this._banana.rotation.y = 0.6;\n this._banana.position.copy(position);\n }\n if (!this._scene.children.includes(this._banana)) {\n this.addToScene();\n }\n }\n\n public clearScene(scene: Scene, uiScene: Scene): void {\n super.clearScene(scene, uiScene);\n\n this.removeFromScene();\n }\n\n public addToScene(): void {\n if (!this._scene || !this._banana) {\n return;\n }\n this._scene.add(this._banana);\n }\n\n public removeFromScene(): void {\n if (!this._scene || !this._banana) {\n return;\n }\n this._scene.remove(this._banana);\n }\n}\n"],"mappings":";;;;AAAA,IAAA,IAAe,KAAA,IAAA,IAAA,cAAA,OAAA,KAAA,IAAA,CAAA,MCOM,IAArB,cAA4C,EAAiC;CAQ3E,SAAgB,GAAc;AAiB5B,EAhBA,KAAK,SAAS,GAEd,KAAK,kBAAkB,QAAQ,EAAiB,CAAC,MAAM,MAAQ;AAE7D,GADA,KAAK,UAAU,EAAI,OACnB,KAAK,aAAa,KAAK;IACvB,EAEF,QAAQ,IACN,wDACA,iBACD,EACD,QAAQ,IACN,mGAEA,iBACD,EACD,QAAQ,IACN,uFAEA,iBACD;;CAGH,aAAoB,GAAqB;AACvC,MAAI,MACF,KAAK,UAAU,IAEZ,KAAK,SAGV;OAAI,KAAK,SAAS;IAChB,IAAM,IAAO,KAAK,QAAQ,QAAQ,IAAI,GAAS,CAAC,EAE1C,IADS,KAAK,QAAQ,UAAU,IAAI,GAAS,CAAC,CAC5B,OAAO;AAG/B,IAFA,EAAS,KAAK,EAAK,IAAI,IAAI,KAC3B,EAAS,KAAK,EAAK,IAAI,IAAI,KAC3B,EAAS,IAAI;IACb,IAAI,IAAQ;AAGZ,IAFA,KAAK,QAAQ,MAAM,KAAK,IAAI,EAAQ,GAAO,GAAO,EAAM,CAAC,EACzD,KAAK,QAAQ,SAAS,IAAI,IAC1B,KAAK,QAAQ,SAAS,KAAK,EAAS;;AAEtC,GAAK,KAAK,OAAO,SAAS,SAAS,KAAK,QAAQ,IAC9C,KAAK,YAAY;;;CAIrB,WAAkB,GAAc,GAAsB;AAGpD,EAFA,MAAM,WAAW,GAAO,EAAQ,EAEhC,KAAK,iBAAiB;;CAGxB,aAA0B;AACpB,GAAC,KAAK,UAAU,CAAC,KAAK,WAG1B,KAAK,OAAO,IAAI,KAAK,QAAQ;;CAG/B,kBAA+B;AACzB,GAAC,KAAK,UAAU,CAAC,KAAK,WAG1B,KAAK,OAAO,OAAO,KAAK,QAAQ;;;GApEjC,GAAA,EAAA,eAAA,OAAA,CAAA,EAAA,EAAA,WAAA,qBAAA,KAAA,EAAA"}
@@ -0,0 +1,6 @@
1
+ //#region packages/workers/generated/budgeteer.sw.js?no-inline?url
2
+ var e = "" + new URL("budgeteer.sw.js", import.meta.url).href;
3
+ //#endregion
4
+ export { e as default };
5
+
6
+ //# sourceMappingURL=budgeteer.sw-CQWYbQSc.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"budgeteer.sw-CQWYbQSc.mjs","names":[],"sources":["../../packages/workers/generated/budgeteer.sw.js?no-inline?url"],"sourcesContent":["export default \"__VITE_ASSET__ZoP2ebLT5e$hm8jPkF9mgA__\""],"mappings":";AAAA,IAAA,IAAe,KAAA,IAAA,IAAA,mBAAA,OAAA,KAAA,IAAA,CAAA"}