/* * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). * This devtool is neither made for production nor for readable output files. * It uses "eval()" calls to create a separate source file in the browser devtools. * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) * or disable the default devtool with "devtool: false". * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). */ /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ "./node_modules/@auth0/auth0-react/dist/auth0-react.esm.js": /*!*****************************************************************!*\ !*** ./node_modules/@auth0/auth0-react/dist/auth0-react.esm.js ***! \*****************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Auth0Context: () => (/* binding */ Auth0Context),\n/* harmony export */ Auth0Provider: () => (/* binding */ Auth0Provider),\n/* harmony export */ InMemoryCache: () => (/* binding */ va),\n/* harmony export */ LocalStorageCache: () => (/* binding */ ya),\n/* harmony export */ OAuthError: () => (/* binding */ OAuthError),\n/* harmony export */ User: () => (/* binding */ Ua),\n/* harmony export */ initialContext: () => (/* binding */ initialContext),\n/* harmony export */ useAuth0: () => (/* binding */ useAuth0),\n/* harmony export */ withAuth0: () => (/* binding */ withAuth0),\n/* harmony export */ withAuthenticationRequired: () => (/* binding */ withAuthenticationRequired)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nvar __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n return __assign.apply(this, arguments);\r\n};\r\n\r\nfunction __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nfunction __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nfunction __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\n\nvar e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t;}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);},e(t,n)};function t(t,n){if(\"function\"!=typeof n&&null!==n)throw new TypeError(\"Class extends value \"+String(n)+\" is not a constructor or null\");function r(){this.constructor=t;}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r);}var n=function(){return n=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])||6!==i[0]&&2!==i[0])){c=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0)&&!(r=i.next()).done;)c.push(r.value);}catch(e){o={error:e};}finally{try{r&&!r.done&&(n=i.return)&&n.call(i);}finally{if(o)throw o.error}}return c}function a(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o0&&f[0]<4?1:+(f[0]+f[1])),!d&&B&&(!(f=B.match(/Edge\\/(\\d+)/))||f[1]>=74)&&(f=B.match(/Chrome\\/(\\d+)/))&&(d=+f[1]);var te=d,ne=!!Object.getOwnPropertySymbols&&!y((function(){var e=Symbol();return !String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&te&&te<41})),re=ne&&!Symbol.sham&&\"symbol\"==typeof Symbol.iterator,oe=Object,ie=re?function(e){return \"symbol\"==typeof e}:function(e){var t=z(\"Symbol\");return H(t)&&M(t.prototype,oe(e))},ce=String,ae=function(e){try{return ce(e)}catch(e){return \"Object\"}},se=TypeError,ue=function(e){if(H(e))return e;throw se(ae(e)+\" is not a function\")},le=function(e,t){var n=e[t];return P(n)?void 0:ue(n)},fe=TypeError,de=Object.defineProperty,he=function(e,t){try{de(p,e,{value:t,configurable:!0,writable:!0});}catch(n){p[e]=t;}return t},pe=p[\"__core-js_shared__\"]||he(\"__core-js_shared__\",{}),ye=l((function(e){(e.exports=function(e,t){return pe[e]||(pe[e]=void 0!==t?t:{})})(\"versions\",[]).push({version:\"3.25.4\",mode:\"global\",copyright:\"© 2014-2022 Denis Pushkarev (zloirock.ru)\",license:\"https://github.com/zloirock/core-js/blob/v3.25.4/LICENSE\",source:\"https://github.com/zloirock/core-js\"});})),ve=Object,me=function(e){return ve(F(e))},be=L({}.hasOwnProperty),ge=Object.hasOwn||function(e,t){return be(me(e),t)},we=0,Se=Math.random(),ke=L(1..toString),_e=function(e){return \"Symbol(\"+(void 0===e?\"\":e)+\")_\"+ke(++we+Se,36)},Ie=ye(\"wks\"),Oe=p.Symbol,xe=Oe&&Oe.for,Te=re?Oe:Oe&&Oe.withoutSetter||_e,Ce=function(e){if(!ge(Ie,e)||!ne&&\"string\"!=typeof Ie[e]){var t=\"Symbol.\"+e;ne&&ge(Oe,e)?Ie[e]=Oe[e]:Ie[e]=re&&xe?xe(t):Te(t);}return Ie[e]},je=TypeError,Le=Ce(\"toPrimitive\"),Re=function(e,t){if(!J(e)||ie(e))return e;var n,r=le(e,Le);if(r){if(void 0===t&&(t=\"default\"),n=g(r,e,t),!J(n)||ie(n))return n;throw je(\"Can't convert object to primitive value\")}return void 0===t&&(t=\"number\"),function(e,t){var n,r;if(\"string\"===t&&H(n=e.toString)&&!J(r=g(n,e)))return r;if(H(n=e.valueOf)&&!J(r=g(n,e)))return r;if(\"string\"!==t&&H(n=e.toString)&&!J(r=g(n,e)))return r;throw fe(\"Can't convert object to primitive value\")}(e,t)},We=function(e){var t=Re(e,\"string\");return ie(t)?t:t+\"\"},Ze=p.document,Ee=J(Ze)&&J(Ze.createElement),Ge=function(e){return Ee?Ze.createElement(e):{}},Ae=!v&&!y((function(){return 7!=Object.defineProperty(Ge(\"div\"),\"a\",{get:function(){return 7}}).a})),Pe=Object.getOwnPropertyDescriptor,Xe={f:v?Pe:function(e,t){if(e=K(e),t=We(t),Ae)try{return Pe(e,t)}catch(e){}if(ge(e,t))return I(!g(_.f,e,t),e[t])}},Fe=v&&y((function(){return 42!=Object.defineProperty((function(){}),\"prototype\",{value:42,writable:!1}).prototype})),Ke=String,Ne=TypeError,Ue=function(e){if(J(e))return e;throw Ne(Ke(e)+\" is not an object\")},De=TypeError,He=Object.defineProperty,Ye=Object.getOwnPropertyDescriptor,Je={f:v?Fe?function(e,t,n){if(Ue(e),t=We(t),Ue(n),\"function\"==typeof e&&\"prototype\"===t&&\"value\"in n&&\"writable\"in n&&!n.writable){var r=Ye(e,t);r&&r.writable&&(e[t]=n.value,n={configurable:\"configurable\"in n?n.configurable:r.configurable,enumerable:\"enumerable\"in n?n.enumerable:r.enumerable,writable:!1});}return He(e,t,n)}:He:function(e,t,n){if(Ue(e),t=We(t),Ue(n),Ae)try{return He(e,t,n)}catch(e){}if(\"get\"in n||\"set\"in n)throw De(\"Accessors not supported\");return \"value\"in n&&(e[t]=n.value),e}},Ve=v?function(e,t,n){return Je.f(e,t,I(1,n))}:function(e,t,n){return e[t]=n,e},ze=Function.prototype,Me=v&&Object.getOwnPropertyDescriptor,Be=ge(ze,\"name\"),Qe={EXISTS:Be,PROPER:Be&&\"something\"===function(){}.name,CONFIGURABLE:Be&&(!v||v&&Me(ze,\"name\").configurable)},qe=L(Function.toString);H(pe.inspectSource)||(pe.inspectSource=function(e){return qe(e)});var $e,et,tt,nt=pe.inspectSource,rt=p.WeakMap,ot=H(rt)&&/native code/.test(String(rt)),it=ye(\"keys\"),ct=function(e){return it[e]||(it[e]=_e(e))},at={},st=p.TypeError,ut=p.WeakMap;if(ot||pe.state){var lt=pe.state||(pe.state=new ut),ft=L(lt.get),dt=L(lt.has),ht=L(lt.set);$e=function(e,t){if(dt(lt,e))throw st(\"Object already initialized\");return t.facade=e,ht(lt,e,t),t},et=function(e){return ft(lt,e)||{}},tt=function(e){return dt(lt,e)};}else {var pt=ct(\"state\");at[pt]=!0,$e=function(e,t){if(ge(e,pt))throw st(\"Object already initialized\");return t.facade=e,Ve(e,pt,t),t},et=function(e){return ge(e,pt)?e[pt]:{}},tt=function(e){return ge(e,pt)};}var yt={set:$e,get:et,has:tt,enforce:function(e){return tt(e)?et(e):$e(e,{})},getterFor:function(e){return function(t){var n;if(!J(t)||(n=et(t)).type!==e)throw st(\"Incompatible receiver, \"+e+\" required\");return n}}},vt=l((function(e){var t=Qe.CONFIGURABLE,n=yt.enforce,r=yt.get,o=Object.defineProperty,i=v&&!y((function(){return 8!==o((function(){}),\"length\",{value:8}).length})),c=String(String).split(\"String\"),a=e.exports=function(e,r,a){\"Symbol(\"===String(r).slice(0,7)&&(r=\"[\"+String(r).replace(/^Symbol\\(([^)]*)\\)/,\"$1\")+\"]\"),a&&a.getter&&(r=\"get \"+r),a&&a.setter&&(r=\"set \"+r),(!ge(e,\"name\")||t&&e.name!==r)&&(v?o(e,\"name\",{value:r,configurable:!0}):e.name=r),i&&a&&ge(a,\"arity\")&&e.length!==a.arity&&o(e,\"length\",{value:a.arity});try{a&&ge(a,\"constructor\")&&a.constructor?v&&o(e,\"prototype\",{writable:!1}):e.prototype&&(e.prototype=void 0);}catch(e){}var s=n(e);return ge(s,\"source\")||(s.source=c.join(\"string\"==typeof r?r:\"\")),e};Function.prototype.toString=a((function(){return H(this)&&r(this).source||nt(this)}),\"toString\");})),mt=function(e,t,n,r){r||(r={});var o=r.enumerable,i=void 0!==r.name?r.name:t;if(H(n)&&vt(n,i,r),r.global)o?e[t]=n:he(t,n);else {try{r.unsafe?e[t]&&(o=!0):delete e[t];}catch(e){}o?e[t]=n:Je.f(e,t,{value:n,enumerable:!1,configurable:!r.nonConfigurable,writable:!r.nonWritable});}return e},bt=Math.ceil,gt=Math.floor,wt=Math.trunc||function(e){var t=+e;return (t>0?gt:bt)(t)},St=function(e){var t=+e;return t!=t||0===t?0:wt(t)},kt=Math.max,_t=Math.min,It=function(e,t){var n=St(e);return n<0?kt(n+t,0):_t(n,t)},Ot=Math.min,xt=function(e){return e>0?Ot(St(e),9007199254740991):0},Tt=function(e){return xt(e.length)},Ct=function(e){return function(t,n,r){var o,i=K(t),c=Tt(i),a=It(r,c);if(e&&n!=n){for(;c>a;)if((o=i[a++])!=o)return !0}else for(;c>a;a++)if((e||a in i)&&i[a]===n)return e||a||0;return !e&&-1}},jt={includes:Ct(!0),indexOf:Ct(!1)},Lt=jt.indexOf,Rt=L([].push),Wt=function(e,t){var n,r=K(e),o=0,i=[];for(n in r)!ge(at,n)&&ge(r,n)&&Rt(i,n);for(;t.length>o;)ge(r,n=t[o++])&&(~Lt(i,n)||Rt(i,n));return i},Zt=[\"constructor\",\"hasOwnProperty\",\"isPrototypeOf\",\"propertyIsEnumerable\",\"toLocaleString\",\"toString\",\"valueOf\"],Et=Zt.concat(\"length\",\"prototype\"),Gt={f:Object.getOwnPropertyNames||function(e){return Wt(e,Et)}},At={f:Object.getOwnPropertySymbols},Pt=L([].concat),Xt=z(\"Reflect\",\"ownKeys\")||function(e){var t=Gt.f(Ue(e)),n=At.f;return n?Pt(t,n(e)):t},Ft=function(e,t,n){for(var r=Xt(t),o=Je.f,i=Xe.f,c=0;c1?arguments[1]:void 0,t.length)),r=rn(e);return fn?fn(t,r,n):dn(t,n,n+r.length)===r}});var vn=function(e,t){return L(p[e].prototype[t])};vn(\"String\",\"startsWith\");var mn=Array.isArray||function(e){return \"Array\"==Z(e)},bn=TypeError,gn=function(e){if(e>9007199254740991)throw bn(\"Maximum allowed index exceeded\");return e},wn=function(e,t,n){var r=We(t);r in e?Je.f(e,r,I(0,n)):e[r]=n;},Sn=function(){},kn=[],_n=z(\"Reflect\",\"construct\"),In=/^\\s*(?:class|function)\\b/,On=L(In.exec),xn=!In.exec(Sn),Tn=function(e){if(!H(e))return !1;try{return _n(Sn,kn,e),!0}catch(e){return !1}},Cn=function(e){if(!H(e))return !1;switch(tn(e)){case\"AsyncFunction\":case\"GeneratorFunction\":case\"AsyncGeneratorFunction\":return !1}try{return xn||!!On(In,nt(e))}catch(e){return !0}};Cn.sham=!0;var jn,Ln=!_n||y((function(){var e;return Tn(Tn.call)||!Tn(Object)||!Tn((function(){e=!0;}))||e}))?Cn:Tn,Rn=Ce(\"species\"),Wn=Array,Zn=function(e,t){return new(function(e){var t;return mn(e)&&(t=e.constructor,(Ln(t)&&(t===Wn||mn(t.prototype))||J(t)&&null===(t=t[Rn]))&&(t=void 0)),void 0===t?Wn:t}(e))(0===t?0:t)},En=Ce(\"species\"),Gn=Ce(\"isConcatSpreadable\"),An=te>=51||!y((function(){var e=[];return e[Gn]=!1,e.concat()[0]!==e})),Pn=(jn=\"concat\",te>=51||!y((function(){var e=[];return (e.constructor={})[En]=function(){return {foo:1}},1!==e[jn](Boolean).foo}))),Xn=function(e){if(!J(e))return !1;var t=e[Gn];return void 0!==t?!!t:mn(e)};zt({target:\"Array\",proto:!0,arity:1,forced:!An||!Pn},{concat:function(e){var t,n,r,o,i,c=me(this),a=Zn(c,0),s=0;for(t=-1,r=arguments.length;tc;)Je.f(e,n=o[c++],r[n]);return e},Dn={f:Un},Hn=z(\"document\",\"documentElement\"),Yn=ct(\"IE_PROTO\"),Jn=function(){},Vn=function(e){return \"\n * ```\n *\n * Elements by their ID are made available by browsers on the `window` object,\n * which is a security risk.\n * Using a prefix solves this problem.\n *\n * More information on how to handle clobbering and the prefix is explained in\n * Example: headings (DOM clobbering) in `rehype-sanitize`.\n *\n * ###### Unknown nodes\n *\n * Unknown nodes are nodes with a type that isn’t in `handlers` or `passThrough`.\n * The default behavior for unknown nodes is:\n *\n * * when the node has a `value` (and doesn’t have `data.hName`,\n * `data.hProperties`, or `data.hChildren`, see later), create a hast `text`\n * node\n * * otherwise, create a `
` element (which could be changed with\n * `data.hName`), with its children mapped from mdast to hast as well\n *\n * This behavior can be changed by passing an `unknownHandler`.\n *\n * @param {MdastNodes} tree\n * mdast tree.\n * @param {Options | null | undefined} [options]\n * Configuration (optional).\n * @returns {HastNodes}\n * hast tree.\n */\nfunction toHast(tree, options) {\n const state = (0,_state_js__WEBPACK_IMPORTED_MODULE_0__.createState)(tree, options)\n const node = state.one(tree, undefined)\n const foot = (0,_footer_js__WEBPACK_IMPORTED_MODULE_1__.footer)(state)\n /** @type {HastNodes} */\n const result = Array.isArray(node)\n ? {type: 'root', children: node}\n : node || {type: 'root', children: []}\n\n if (foot) {\n // If there’s a footer, there were definitions, meaning block\n // content.\n // So `result` is a parent node.\n (0,devlop__WEBPACK_IMPORTED_MODULE_2__.ok)('children' in result)\n result.children.push({type: 'text', value: '\\n'}, foot)\n }\n\n return result\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/mdast-util-to-hast/lib/index.js?"); /***/ }), /***/ "./node_modules/mdast-util-to-hast/lib/revert.js": /*!*******************************************************!*\ !*** ./node_modules/mdast-util-to-hast/lib/revert.js ***! \*******************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ revert: () => (/* binding */ revert)\n/* harmony export */ });\n/**\n * @typedef {import('hast').ElementContent} ElementContent\n *\n * @typedef {import('mdast').Nodes} Nodes\n * @typedef {import('mdast').Reference} Reference\n *\n * @typedef {import('./state.js').State} State\n */\n\n// Make VS Code show references to the above types.\n''\n\n/**\n * Return the content of a reference without definition as plain text.\n *\n * @param {State} state\n * Info passed around.\n * @param {Extract} node\n * Reference node (image, link).\n * @returns {Array}\n * hast content.\n */\nfunction revert(state, node) {\n const subtype = node.referenceType\n let suffix = ']'\n\n if (subtype === 'collapsed') {\n suffix += '[]'\n } else if (subtype === 'full') {\n suffix += '[' + (node.label || node.identifier) + ']'\n }\n\n if (node.type === 'imageReference') {\n return [{type: 'text', value: '![' + node.alt + suffix}]\n }\n\n const contents = state.all(node)\n const head = contents[0]\n\n if (head && head.type === 'text') {\n head.value = '[' + head.value\n } else {\n contents.unshift({type: 'text', value: '['})\n }\n\n const tail = contents[contents.length - 1]\n\n if (tail && tail.type === 'text') {\n tail.value += suffix\n } else {\n contents.push({type: 'text', value: suffix})\n }\n\n return contents\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/mdast-util-to-hast/lib/revert.js?"); /***/ }), /***/ "./node_modules/mdast-util-to-hast/lib/state.js": /*!******************************************************!*\ !*** ./node_modules/mdast-util-to-hast/lib/state.js ***! \******************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createState: () => (/* binding */ createState),\n/* harmony export */ wrap: () => (/* binding */ wrap)\n/* harmony export */ });\n/* harmony import */ var _ungap_structured_clone__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ungap/structured-clone */ \"./node_modules/@ungap/structured-clone/esm/index.js\");\n/* harmony import */ var unist_util_visit__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! unist-util-visit */ \"./node_modules/unist-util-visit/lib/index.js\");\n/* harmony import */ var unist_util_position__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! unist-util-position */ \"./node_modules/unist-util-position/lib/index.js\");\n/* harmony import */ var _handlers_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./handlers/index.js */ \"./node_modules/mdast-util-to-hast/lib/handlers/index.js\");\n/**\n * @typedef {import('hast').Element} HastElement\n * @typedef {import('hast').ElementContent} HastElementContent\n * @typedef {import('hast').Nodes} HastNodes\n * @typedef {import('hast').Properties} HastProperties\n * @typedef {import('hast').RootContent} HastRootContent\n * @typedef {import('hast').Text} HastText\n *\n * @typedef {import('mdast').Definition} MdastDefinition\n * @typedef {import('mdast').FootnoteDefinition} MdastFootnoteDefinition\n * @typedef {import('mdast').Nodes} MdastNodes\n * @typedef {import('mdast').Parents} MdastParents\n *\n * @typedef {import('./footer.js').FootnoteBackContentTemplate} FootnoteBackContentTemplate\n * @typedef {import('./footer.js').FootnoteBackLabelTemplate} FootnoteBackLabelTemplate\n */\n\n/**\n * @callback Handler\n * Handle a node.\n * @param {State} state\n * Info passed around.\n * @param {any} node\n * mdast node to handle.\n * @param {MdastParents | undefined} parent\n * Parent of `node`.\n * @returns {Array | HastElementContent | undefined}\n * hast node.\n *\n * @typedef {Partial>} Handlers\n * Handle nodes.\n *\n * @typedef Options\n * Configuration (optional).\n * @property {boolean | null | undefined} [allowDangerousHtml=false]\n * Whether to persist raw HTML in markdown in the hast tree (default:\n * `false`).\n * @property {string | null | undefined} [clobberPrefix='user-content-']\n * Prefix to use before the `id` property on footnotes to prevent them from\n * *clobbering* (default: `'user-content-'`).\n *\n * Pass `''` for trusted markdown and when you are careful with\n * polyfilling.\n * You could pass a different prefix.\n *\n * DOM clobbering is this:\n *\n * ```html\n *

\n * \n * ```\n *\n * The above example shows that elements are made available by browsers, by\n * their ID, on the `window` object.\n * This is a security risk because you might be expecting some other variable\n * at that place.\n * It can also break polyfills.\n * Using a prefix solves these problems.\n * @property {FootnoteBackContentTemplate | string | null | undefined} [footnoteBackContent]\n * Content of the backreference back to references (default: `defaultFootnoteBackContent`).\n *\n * The default value is:\n *\n * ```js\n * function defaultFootnoteBackContent(_, rereferenceIndex) {\n * const result = [{type: 'text', value: '↩'}]\n *\n * if (rereferenceIndex > 1) {\n * result.push({\n * type: 'element',\n * tagName: 'sup',\n * properties: {},\n * children: [{type: 'text', value: String(rereferenceIndex)}]\n * })\n * }\n *\n * return result\n * }\n * ```\n *\n * This content is used in the `a` element of each backreference (the `↩`\n * links).\n * @property {FootnoteBackLabelTemplate | string | null | undefined} [footnoteBackLabel]\n * Label to describe the backreference back to references (default:\n * `defaultFootnoteBackLabel`).\n *\n * The default value is:\n *\n * ```js\n * function defaultFootnoteBackLabel(referenceIndex, rereferenceIndex) {\n * return (\n * 'Back to reference ' +\n * (referenceIndex + 1) +\n * (rereferenceIndex > 1 ? '-' + rereferenceIndex : '')\n * )\n * }\n * ```\n *\n * Change it when the markdown is not in English.\n *\n * This label is used in the `ariaLabel` property on each backreference\n * (the `↩` links).\n * It affects users of assistive technology.\n * @property {string | null | undefined} [footnoteLabel='Footnotes']\n * Textual label to use for the footnotes section (default: `'Footnotes'`).\n *\n * Change it when the markdown is not in English.\n *\n * This label is typically hidden visually (assuming a `sr-only` CSS class\n * is defined that does that) and so affects screen readers only.\n * If you do have such a class, but want to show this section to everyone,\n * pass different properties with the `footnoteLabelProperties` option.\n * @property {HastProperties | null | undefined} [footnoteLabelProperties={className: ['sr-only']}]\n * Properties to use on the footnote label (default: `{className:\n * ['sr-only']}`).\n *\n * Change it to show the label and add other properties.\n *\n * This label is typically hidden visually (assuming an `sr-only` CSS class\n * is defined that does that) and so affects screen readers only.\n * If you do have such a class, but want to show this section to everyone,\n * pass an empty string.\n * You can also add different properties.\n *\n * > 👉 **Note**: `id: 'footnote-label'` is always added, because footnote\n * > calls use it with `aria-describedby` to provide an accessible label.\n * @property {string | null | undefined} [footnoteLabelTagName='h2']\n * HTML tag name to use for the footnote label element (default: `'h2'`).\n *\n * Change it to match your document structure.\n *\n * This label is typically hidden visually (assuming a `sr-only` CSS class\n * is defined that does that) and so affects screen readers only.\n * If you do have such a class, but want to show this section to everyone,\n * pass different properties with the `footnoteLabelProperties` option.\n * @property {Handlers | null | undefined} [handlers]\n * Extra handlers for nodes (optional).\n * @property {Array | null | undefined} [passThrough]\n * List of custom mdast node types to pass through (keep) in hast (note that\n * the node itself is passed, but eventual children are transformed)\n * (optional).\n * @property {Handler | null | undefined} [unknownHandler]\n * Handler for all unknown nodes (optional).\n *\n * @typedef State\n * Info passed around.\n * @property {(node: MdastNodes) => Array} all\n * Transform the children of an mdast parent to hast.\n * @property {(from: MdastNodes, to: Type) => HastElement | Type} applyData\n * Honor the `data` of `from`, and generate an element instead of `node`.\n * @property {Map} definitionById\n * Definitions by their identifier.\n * @property {Map} footnoteById\n * Footnote definitions by their identifier.\n * @property {Map} footnoteCounts\n * Counts for how often the same footnote was called.\n * @property {Array} footnoteOrder\n * Identifiers of order when footnote calls first appear in tree order.\n * @property {Handlers} handlers\n * Applied handlers.\n * @property {(node: MdastNodes, parent: MdastParents | undefined) => Array | HastElementContent | undefined} one\n * Transform an mdast node to hast.\n * @property {Options} options\n * Configuration.\n * @property {(from: MdastNodes, node: HastNodes) => undefined} patch\n * Copy a node’s positional info.\n * @property {(nodes: Array, loose?: boolean | undefined) => Array} wrap\n * Wrap `nodes` with line endings between each node, adds initial/final line endings when `loose`.\n */\n\n\n\n\n\n\nconst own = {}.hasOwnProperty\n\n/** @type {Options} */\nconst emptyOptions = {}\n\n/**\n * Create `state` from an mdast tree.\n *\n * @param {MdastNodes} tree\n * mdast node to transform.\n * @param {Options | null | undefined} [options]\n * Configuration (optional).\n * @returns {State}\n * `state` function.\n */\nfunction createState(tree, options) {\n const settings = options || emptyOptions\n /** @type {Map} */\n const definitionById = new Map()\n /** @type {Map} */\n const footnoteById = new Map()\n /** @type {Map} */\n const footnoteCounts = new Map()\n /** @type {Handlers} */\n // @ts-expect-error: the root handler returns a root.\n // Hard to type.\n const handlers = {..._handlers_index_js__WEBPACK_IMPORTED_MODULE_1__.handlers, ...settings.handlers}\n\n /** @type {State} */\n const state = {\n all,\n applyData,\n definitionById,\n footnoteById,\n footnoteCounts,\n footnoteOrder: [],\n handlers,\n one,\n options: settings,\n patch,\n wrap\n }\n\n ;(0,unist_util_visit__WEBPACK_IMPORTED_MODULE_2__.visit)(tree, function (node) {\n if (node.type === 'definition' || node.type === 'footnoteDefinition') {\n const map = node.type === 'definition' ? definitionById : footnoteById\n const id = String(node.identifier).toUpperCase()\n\n // Mimick CM behavior of link definitions.\n // See: .\n if (!map.has(id)) {\n // @ts-expect-error: node type matches map.\n map.set(id, node)\n }\n }\n })\n\n return state\n\n /**\n * Transform an mdast node into a hast node.\n *\n * @param {MdastNodes} node\n * mdast node.\n * @param {MdastParents | undefined} [parent]\n * Parent of `node`.\n * @returns {Array | HastElementContent | undefined}\n * Resulting hast node.\n */\n function one(node, parent) {\n const type = node.type\n const handle = state.handlers[type]\n\n if (own.call(state.handlers, type) && handle) {\n return handle(state, node, parent)\n }\n\n if (state.options.passThrough && state.options.passThrough.includes(type)) {\n if ('children' in node) {\n const {children, ...shallow} = node\n const result = (0,_ungap_structured_clone__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(shallow)\n // @ts-expect-error: TS doesn’t understand…\n result.children = state.all(node)\n // @ts-expect-error: TS doesn’t understand…\n return result\n }\n\n // @ts-expect-error: it’s custom.\n return (0,_ungap_structured_clone__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(node)\n }\n\n const unknown = state.options.unknownHandler || defaultUnknownHandler\n\n return unknown(state, node, parent)\n }\n\n /**\n * Transform the children of an mdast node into hast nodes.\n *\n * @param {MdastNodes} parent\n * mdast node to compile\n * @returns {Array}\n * Resulting hast nodes.\n */\n function all(parent) {\n /** @type {Array} */\n const values = []\n\n if ('children' in parent) {\n const nodes = parent.children\n let index = -1\n while (++index < nodes.length) {\n const result = state.one(nodes[index], parent)\n\n // To do: see if we van clean this? Can we merge texts?\n if (result) {\n if (index && nodes[index - 1].type === 'break') {\n if (!Array.isArray(result) && result.type === 'text') {\n result.value = trimMarkdownSpaceStart(result.value)\n }\n\n if (!Array.isArray(result) && result.type === 'element') {\n const head = result.children[0]\n\n if (head && head.type === 'text') {\n head.value = trimMarkdownSpaceStart(head.value)\n }\n }\n }\n\n if (Array.isArray(result)) {\n values.push(...result)\n } else {\n values.push(result)\n }\n }\n }\n }\n\n return values\n }\n}\n\n/**\n * Copy a node’s positional info.\n *\n * @param {MdastNodes} from\n * mdast node to copy from.\n * @param {HastNodes} to\n * hast node to copy into.\n * @returns {undefined}\n * Nothing.\n */\nfunction patch(from, to) {\n if (from.position) to.position = (0,unist_util_position__WEBPACK_IMPORTED_MODULE_3__.position)(from)\n}\n\n/**\n * Honor the `data` of `from` and maybe generate an element instead of `to`.\n *\n * @template {HastNodes} Type\n * Node type.\n * @param {MdastNodes} from\n * mdast node to use data from.\n * @param {Type} to\n * hast node to change.\n * @returns {HastElement | Type}\n * Nothing.\n */\nfunction applyData(from, to) {\n /** @type {HastElement | Type} */\n let result = to\n\n // Handle `data.hName`, `data.hProperties, `data.hChildren`.\n if (from && from.data) {\n const hName = from.data.hName\n const hChildren = from.data.hChildren\n const hProperties = from.data.hProperties\n\n if (typeof hName === 'string') {\n // Transforming the node resulted in an element with a different name\n // than wanted:\n if (result.type === 'element') {\n result.tagName = hName\n }\n // Transforming the node resulted in a non-element, which happens for\n // raw, text, and root nodes (unless custom handlers are passed).\n // The intent of `hName` is to create an element, but likely also to keep\n // the content around (otherwise: pass `hChildren`).\n else {\n /** @type {Array} */\n // @ts-expect-error: assume no doctypes in `root`.\n const children = 'children' in result ? result.children : [result]\n result = {type: 'element', tagName: hName, properties: {}, children}\n }\n }\n\n if (result.type === 'element' && hProperties) {\n Object.assign(result.properties, (0,_ungap_structured_clone__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(hProperties))\n }\n\n if (\n 'children' in result &&\n result.children &&\n hChildren !== null &&\n hChildren !== undefined\n ) {\n result.children = hChildren\n }\n }\n\n return result\n}\n\n/**\n * Transform an unknown node.\n *\n * @param {State} state\n * Info passed around.\n * @param {MdastNodes} node\n * Unknown mdast node.\n * @returns {HastElement | HastText}\n * Resulting hast node.\n */\nfunction defaultUnknownHandler(state, node) {\n const data = node.data || {}\n /** @type {HastElement | HastText} */\n const result =\n 'value' in node &&\n !(own.call(data, 'hProperties') || own.call(data, 'hChildren'))\n ? {type: 'text', value: node.value}\n : {\n type: 'element',\n tagName: 'div',\n properties: {},\n children: state.all(node)\n }\n\n state.patch(node, result)\n return state.applyData(node, result)\n}\n\n/**\n * Wrap `nodes` with line endings between each node.\n *\n * @template {HastRootContent} Type\n * Node type.\n * @param {Array} nodes\n * List of nodes to wrap.\n * @param {boolean | undefined} [loose=false]\n * Whether to add line endings at start and end (default: `false`).\n * @returns {Array}\n * Wrapped nodes.\n */\nfunction wrap(nodes, loose) {\n /** @type {Array} */\n const result = []\n let index = -1\n\n if (loose) {\n result.push({type: 'text', value: '\\n'})\n }\n\n while (++index < nodes.length) {\n if (index) result.push({type: 'text', value: '\\n'})\n result.push(nodes[index])\n }\n\n if (loose && nodes.length > 0) {\n result.push({type: 'text', value: '\\n'})\n }\n\n return result\n}\n\n/**\n * Trim spaces and tabs at the start of `value`.\n *\n * @param {string} value\n * Value to trim.\n * @returns {string}\n * Result.\n */\nfunction trimMarkdownSpaceStart(value) {\n let index = 0\n let code = value.charCodeAt(index)\n\n while (code === 9 || code === 32) {\n index++\n code = value.charCodeAt(index)\n }\n\n return value.slice(index)\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/mdast-util-to-hast/lib/state.js?"); /***/ }), /***/ "./node_modules/mdast-util-to-string/lib/index.js": /*!********************************************************!*\ !*** ./node_modules/mdast-util-to-string/lib/index.js ***! \********************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ toString: () => (/* binding */ toString)\n/* harmony export */ });\n/**\n * @typedef {import('mdast').Nodes} Nodes\n *\n * @typedef Options\n * Configuration (optional).\n * @property {boolean | null | undefined} [includeImageAlt=true]\n * Whether to use `alt` for `image`s (default: `true`).\n * @property {boolean | null | undefined} [includeHtml=true]\n * Whether to use `value` of HTML (default: `true`).\n */\n\n/** @type {Options} */\nconst emptyOptions = {}\n\n/**\n * Get the text content of a node or list of nodes.\n *\n * Prefers the node’s plain-text fields, otherwise serializes its children,\n * and if the given value is an array, serialize the nodes in it.\n *\n * @param {unknown} [value]\n * Thing to serialize, typically `Node`.\n * @param {Options | null | undefined} [options]\n * Configuration (optional).\n * @returns {string}\n * Serialized `value`.\n */\nfunction toString(value, options) {\n const settings = options || emptyOptions\n const includeImageAlt =\n typeof settings.includeImageAlt === 'boolean'\n ? settings.includeImageAlt\n : true\n const includeHtml =\n typeof settings.includeHtml === 'boolean' ? settings.includeHtml : true\n\n return one(value, includeImageAlt, includeHtml)\n}\n\n/**\n * One node or several nodes.\n *\n * @param {unknown} value\n * Thing to serialize.\n * @param {boolean} includeImageAlt\n * Include image `alt`s.\n * @param {boolean} includeHtml\n * Include HTML.\n * @returns {string}\n * Serialized node.\n */\nfunction one(value, includeImageAlt, includeHtml) {\n if (node(value)) {\n if ('value' in value) {\n return value.type === 'html' && !includeHtml ? '' : value.value\n }\n\n if (includeImageAlt && 'alt' in value && value.alt) {\n return value.alt\n }\n\n if ('children' in value) {\n return all(value.children, includeImageAlt, includeHtml)\n }\n }\n\n if (Array.isArray(value)) {\n return all(value, includeImageAlt, includeHtml)\n }\n\n return ''\n}\n\n/**\n * Serialize a list of nodes.\n *\n * @param {Array} values\n * Thing to serialize.\n * @param {boolean} includeImageAlt\n * Include image `alt`s.\n * @param {boolean} includeHtml\n * Include HTML.\n * @returns {string}\n * Serialized nodes.\n */\nfunction all(values, includeImageAlt, includeHtml) {\n /** @type {Array} */\n const result = []\n let index = -1\n\n while (++index < values.length) {\n result[index] = one(values[index], includeImageAlt, includeHtml)\n }\n\n return result.join('')\n}\n\n/**\n * Check if `value` looks like a node.\n *\n * @param {unknown} value\n * Thing.\n * @returns {value is Nodes}\n * Whether `value` is a node.\n */\nfunction node(value) {\n return Boolean(value && typeof value === 'object')\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/mdast-util-to-string/lib/index.js?"); /***/ }), /***/ "./node_modules/micromark-core-commonmark/dev/lib/attention.js": /*!*********************************************************************!*\ !*** ./node_modules/micromark-core-commonmark/dev/lib/attention.js ***! \*********************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ attention: () => (/* binding */ attention)\n/* harmony export */ });\n/* harmony import */ var micromark_util_chunked__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! micromark-util-chunked */ \"./node_modules/micromark-util-chunked/dev/index.js\");\n/* harmony import */ var micromark_util_classify_character__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! micromark-util-classify-character */ \"./node_modules/micromark-util-classify-character/dev/index.js\");\n/* harmony import */ var micromark_util_resolve_all__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! micromark-util-resolve-all */ \"./node_modules/micromark-util-resolve-all/index.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/types.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/codes.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/constants.js\");\n/* harmony import */ var devlop__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! devlop */ \"./node_modules/devlop/lib/development.js\");\n/**\n * @typedef {import('micromark-util-types').Code} Code\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Event} Event\n * @typedef {import('micromark-util-types').Point} Point\n * @typedef {import('micromark-util-types').Resolver} Resolver\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n */\n\n\n\n\n\n\n\n/** @type {Construct} */\nconst attention = {\n name: 'attention',\n tokenize: tokenizeAttention,\n resolveAll: resolveAllAttention\n}\n\n/**\n * Take all events and resolve attention to emphasis or strong.\n *\n * @type {Resolver}\n */\n// eslint-disable-next-line complexity\nfunction resolveAllAttention(events, context) {\n let index = -1\n /** @type {number} */\n let open\n /** @type {Token} */\n let group\n /** @type {Token} */\n let text\n /** @type {Token} */\n let openingSequence\n /** @type {Token} */\n let closingSequence\n /** @type {number} */\n let use\n /** @type {Array} */\n let nextEvents\n /** @type {number} */\n let offset\n\n // Walk through all events.\n //\n // Note: performance of this is fine on an mb of normal markdown, but it’s\n // a bottleneck for malicious stuff.\n while (++index < events.length) {\n // Find a token that can close.\n if (\n events[index][0] === 'enter' &&\n events[index][1].type === 'attentionSequence' &&\n events[index][1]._close\n ) {\n open = index\n\n // Now walk back to find an opener.\n while (open--) {\n // Find a token that can open the closer.\n if (\n events[open][0] === 'exit' &&\n events[open][1].type === 'attentionSequence' &&\n events[open][1]._open &&\n // If the markers are the same:\n context.sliceSerialize(events[open][1]).charCodeAt(0) ===\n context.sliceSerialize(events[index][1]).charCodeAt(0)\n ) {\n // If the opening can close or the closing can open,\n // and the close size *is not* a multiple of three,\n // but the sum of the opening and closing size *is* multiple of three,\n // then don’t match.\n if (\n (events[open][1]._close || events[index][1]._open) &&\n (events[index][1].end.offset - events[index][1].start.offset) % 3 &&\n !(\n (events[open][1].end.offset -\n events[open][1].start.offset +\n events[index][1].end.offset -\n events[index][1].start.offset) %\n 3\n )\n ) {\n continue\n }\n\n // Number of markers to use from the sequence.\n use =\n events[open][1].end.offset - events[open][1].start.offset > 1 &&\n events[index][1].end.offset - events[index][1].start.offset > 1\n ? 2\n : 1\n\n const start = Object.assign({}, events[open][1].end)\n const end = Object.assign({}, events[index][1].start)\n movePoint(start, -use)\n movePoint(end, use)\n\n openingSequence = {\n type: use > 1 ? micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.strongSequence : micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.emphasisSequence,\n start,\n end: Object.assign({}, events[open][1].end)\n }\n closingSequence = {\n type: use > 1 ? micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.strongSequence : micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.emphasisSequence,\n start: Object.assign({}, events[index][1].start),\n end\n }\n text = {\n type: use > 1 ? micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.strongText : micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.emphasisText,\n start: Object.assign({}, events[open][1].end),\n end: Object.assign({}, events[index][1].start)\n }\n group = {\n type: use > 1 ? micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.strong : micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.emphasis,\n start: Object.assign({}, openingSequence.start),\n end: Object.assign({}, closingSequence.end)\n }\n\n events[open][1].end = Object.assign({}, openingSequence.start)\n events[index][1].start = Object.assign({}, closingSequence.end)\n\n nextEvents = []\n\n // If there are more markers in the opening, add them before.\n if (events[open][1].end.offset - events[open][1].start.offset) {\n nextEvents = (0,micromark_util_chunked__WEBPACK_IMPORTED_MODULE_1__.push)(nextEvents, [\n ['enter', events[open][1], context],\n ['exit', events[open][1], context]\n ])\n }\n\n // Opening.\n nextEvents = (0,micromark_util_chunked__WEBPACK_IMPORTED_MODULE_1__.push)(nextEvents, [\n ['enter', group, context],\n ['enter', openingSequence, context],\n ['exit', openingSequence, context],\n ['enter', text, context]\n ])\n\n // Always populated by defaults.\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_2__.ok)(\n context.parser.constructs.insideSpan.null,\n 'expected `insideSpan` to be populated'\n )\n\n // Between.\n nextEvents = (0,micromark_util_chunked__WEBPACK_IMPORTED_MODULE_1__.push)(\n nextEvents,\n (0,micromark_util_resolve_all__WEBPACK_IMPORTED_MODULE_3__.resolveAll)(\n context.parser.constructs.insideSpan.null,\n events.slice(open + 1, index),\n context\n )\n )\n\n // Closing.\n nextEvents = (0,micromark_util_chunked__WEBPACK_IMPORTED_MODULE_1__.push)(nextEvents, [\n ['exit', text, context],\n ['enter', closingSequence, context],\n ['exit', closingSequence, context],\n ['exit', group, context]\n ])\n\n // If there are more markers in the closing, add them after.\n if (events[index][1].end.offset - events[index][1].start.offset) {\n offset = 2\n nextEvents = (0,micromark_util_chunked__WEBPACK_IMPORTED_MODULE_1__.push)(nextEvents, [\n ['enter', events[index][1], context],\n ['exit', events[index][1], context]\n ])\n } else {\n offset = 0\n }\n\n (0,micromark_util_chunked__WEBPACK_IMPORTED_MODULE_1__.splice)(events, open - 1, index - open + 3, nextEvents)\n\n index = open + nextEvents.length - offset - 2\n break\n }\n }\n }\n }\n\n // Remove remaining sequences.\n index = -1\n\n while (++index < events.length) {\n if (events[index][1].type === 'attentionSequence') {\n events[index][1].type = 'data'\n }\n }\n\n return events\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeAttention(effects, ok) {\n const attentionMarkers = this.parser.constructs.attentionMarkers.null\n const previous = this.previous\n const before = (0,micromark_util_classify_character__WEBPACK_IMPORTED_MODULE_4__.classifyCharacter)(previous)\n\n /** @type {NonNullable} */\n let marker\n\n return start\n\n /**\n * Before a sequence.\n *\n * ```markdown\n * > | **\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_2__.ok)(\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_5__.codes.asterisk || code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_5__.codes.underscore,\n 'expected asterisk or underscore'\n )\n marker = code\n effects.enter('attentionSequence')\n return inside(code)\n }\n\n /**\n * In a sequence.\n *\n * ```markdown\n * > | **\n * ^^\n * ```\n *\n * @type {State}\n */\n function inside(code) {\n if (code === marker) {\n effects.consume(code)\n return inside\n }\n\n const token = effects.exit('attentionSequence')\n\n // To do: next major: move this to resolver, just like `markdown-rs`.\n const after = (0,micromark_util_classify_character__WEBPACK_IMPORTED_MODULE_4__.classifyCharacter)(code)\n\n // Always populated by defaults.\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_2__.ok)(attentionMarkers, 'expected `attentionMarkers` to be populated')\n\n const open =\n !after ||\n (after === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_6__.constants.characterGroupPunctuation && before) ||\n attentionMarkers.includes(code)\n const close =\n !before ||\n (before === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_6__.constants.characterGroupPunctuation && after) ||\n attentionMarkers.includes(previous)\n\n token._open = Boolean(\n marker === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_5__.codes.asterisk ? open : open && (before || !close)\n )\n token._close = Boolean(\n marker === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_5__.codes.asterisk ? close : close && (after || !open)\n )\n return ok(code)\n }\n}\n\n/**\n * Move a point a bit.\n *\n * Note: `move` only works inside lines! It’s not possible to move past other\n * chunks (replacement characters, tabs, or line endings).\n *\n * @param {Point} point\n * @param {number} offset\n * @returns {undefined}\n */\nfunction movePoint(point, offset) {\n point.column += offset\n point.offset += offset\n point._bufferIndex += offset\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-core-commonmark/dev/lib/attention.js?"); /***/ }), /***/ "./node_modules/micromark-core-commonmark/dev/lib/autolink.js": /*!********************************************************************!*\ !*** ./node_modules/micromark-core-commonmark/dev/lib/autolink.js ***! \********************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ autolink: () => (/* binding */ autolink)\n/* harmony export */ });\n/* harmony import */ var micromark_util_character__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! micromark-util-character */ \"./node_modules/micromark-util-character/dev/index.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/codes.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/types.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/constants.js\");\n/* harmony import */ var devlop__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! devlop */ \"./node_modules/devlop/lib/development.js\");\n/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n */\n\n\n\n\n\n/** @type {Construct} */\nconst autolink = {name: 'autolink', tokenize: tokenizeAutolink}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeAutolink(effects, ok, nok) {\n let size = 0\n\n return start\n\n /**\n * Start of an autolink.\n *\n * ```markdown\n * > | ab\n * ^\n * > | ab\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_0__.ok)(code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.lessThan, 'expected `<`')\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.autolink)\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.autolinkMarker)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.autolinkMarker)\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.autolinkProtocol)\n return open\n }\n\n /**\n * After `<`, at protocol or atext.\n *\n * ```markdown\n * > | ab\n * ^\n * > | ab\n * ^\n * ```\n *\n * @type {State}\n */\n function open(code) {\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.asciiAlpha)(code)) {\n effects.consume(code)\n return schemeOrEmailAtext\n }\n\n return emailAtext(code)\n }\n\n /**\n * At second byte of protocol or atext.\n *\n * ```markdown\n * > | ab\n * ^\n * > | ab\n * ^\n * ```\n *\n * @type {State}\n */\n function schemeOrEmailAtext(code) {\n // ASCII alphanumeric and `+`, `-`, and `.`.\n if (\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.plusSign ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.dash ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.dot ||\n (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.asciiAlphanumeric)(code)\n ) {\n // Count the previous alphabetical from `open` too.\n size = 1\n return schemeInsideOrEmailAtext(code)\n }\n\n return emailAtext(code)\n }\n\n /**\n * In ambiguous protocol or atext.\n *\n * ```markdown\n * > | ab\n * ^\n * > | ab\n * ^\n * ```\n *\n * @type {State}\n */\n function schemeInsideOrEmailAtext(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.colon) {\n effects.consume(code)\n size = 0\n return urlInside\n }\n\n // ASCII alphanumeric and `+`, `-`, and `.`.\n if (\n (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.plusSign ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.dash ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.dot ||\n (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.asciiAlphanumeric)(code)) &&\n size++ < micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.constants.autolinkSchemeSizeMax\n ) {\n effects.consume(code)\n return schemeInsideOrEmailAtext\n }\n\n size = 0\n return emailAtext(code)\n }\n\n /**\n * After protocol, in URL.\n *\n * ```markdown\n * > | ab\n * ^\n * ```\n *\n * @type {State}\n */\n function urlInside(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.greaterThan) {\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.autolinkProtocol)\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.autolinkMarker)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.autolinkMarker)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.autolink)\n return ok\n }\n\n // ASCII control, space, or `<`.\n if (\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.eof ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.space ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.lessThan ||\n (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.asciiControl)(code)\n ) {\n return nok(code)\n }\n\n effects.consume(code)\n return urlInside\n }\n\n /**\n * In email atext.\n *\n * ```markdown\n * > | ab\n * ^\n * ```\n *\n * @type {State}\n */\n function emailAtext(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.atSign) {\n effects.consume(code)\n return emailAtSignOrDot\n }\n\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.asciiAtext)(code)) {\n effects.consume(code)\n return emailAtext\n }\n\n return nok(code)\n }\n\n /**\n * In label, after at-sign or dot.\n *\n * ```markdown\n * > | ab\n * ^ ^\n * ```\n *\n * @type {State}\n */\n function emailAtSignOrDot(code) {\n return (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.asciiAlphanumeric)(code) ? emailLabel(code) : nok(code)\n }\n\n /**\n * In label, where `.` and `>` are allowed.\n *\n * ```markdown\n * > | ab\n * ^\n * ```\n *\n * @type {State}\n */\n function emailLabel(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.dot) {\n effects.consume(code)\n size = 0\n return emailAtSignOrDot\n }\n\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.greaterThan) {\n // Exit, then change the token type.\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.autolinkProtocol).type = micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.autolinkEmail\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.autolinkMarker)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.autolinkMarker)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.autolink)\n return ok\n }\n\n return emailValue(code)\n }\n\n /**\n * In label, where `.` and `>` are *not* allowed.\n *\n * Though, this is also used in `emailLabel` to parse other values.\n *\n * ```markdown\n * > | ab\n * ^\n * ```\n *\n * @type {State}\n */\n function emailValue(code) {\n // ASCII alphanumeric or `-`.\n if (\n (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.dash || (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.asciiAlphanumeric)(code)) &&\n size++ < micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.constants.autolinkDomainSizeMax\n ) {\n const next = code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.dash ? emailValue : emailLabel\n effects.consume(code)\n return next\n }\n\n return nok(code)\n }\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-core-commonmark/dev/lib/autolink.js?"); /***/ }), /***/ "./node_modules/micromark-core-commonmark/dev/lib/blank-line.js": /*!**********************************************************************!*\ !*** ./node_modules/micromark-core-commonmark/dev/lib/blank-line.js ***! \**********************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ blankLine: () => (/* binding */ blankLine)\n/* harmony export */ });\n/* harmony import */ var micromark_factory_space__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! micromark-factory-space */ \"./node_modules/micromark-factory-space/dev/index.js\");\n/* harmony import */ var micromark_util_character__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! micromark-util-character */ \"./node_modules/micromark-util-character/dev/index.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/types.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/codes.js\");\n/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n */\n\n\n\n\n\n/** @type {Construct} */\nconst blankLine = {tokenize: tokenizeBlankLine, partial: true}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeBlankLine(effects, ok, nok) {\n return start\n\n /**\n * Start of blank line.\n *\n * > 👉 **Note**: `␠` represents a space character.\n *\n * ```markdown\n * > | ␠␠␊\n * ^\n * > | ␊\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n return (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_0__.markdownSpace)(code)\n ? (0,micromark_factory_space__WEBPACK_IMPORTED_MODULE_1__.factorySpace)(effects, after, micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.linePrefix)(code)\n : after(code)\n }\n\n /**\n * At eof/eol, after optional whitespace.\n *\n * > 👉 **Note**: `␠` represents a space character.\n *\n * ```markdown\n * > | ␠␠␊\n * ^\n * > | ␊\n * ^\n * ```\n *\n * @type {State}\n */\n function after(code) {\n return code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.codes.eof || (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_0__.markdownLineEnding)(code) ? ok(code) : nok(code)\n }\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-core-commonmark/dev/lib/blank-line.js?"); /***/ }), /***/ "./node_modules/micromark-core-commonmark/dev/lib/block-quote.js": /*!***********************************************************************!*\ !*** ./node_modules/micromark-core-commonmark/dev/lib/block-quote.js ***! \***********************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ blockQuote: () => (/* binding */ blockQuote)\n/* harmony export */ });\n/* harmony import */ var micromark_factory_space__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! micromark-factory-space */ \"./node_modules/micromark-factory-space/dev/index.js\");\n/* harmony import */ var micromark_util_character__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! micromark-util-character */ \"./node_modules/micromark-util-character/dev/index.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/codes.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/types.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/constants.js\");\n/* harmony import */ var devlop__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! devlop */ \"./node_modules/devlop/lib/development.js\");\n/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Exiter} Exiter\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n */\n\n\n\n\n\n\n/** @type {Construct} */\nconst blockQuote = {\n name: 'blockQuote',\n tokenize: tokenizeBlockQuoteStart,\n continuation: {tokenize: tokenizeBlockQuoteContinuation},\n exit\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeBlockQuoteStart(effects, ok, nok) {\n const self = this\n\n return start\n\n /**\n * Start of block quote.\n *\n * ```markdown\n * > | > a\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.greaterThan) {\n const state = self.containerState\n\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(state, 'expected `containerState` to be defined in container')\n\n if (!state.open) {\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.blockQuote, {_container: true})\n state.open = true\n }\n\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.blockQuotePrefix)\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.blockQuoteMarker)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.blockQuoteMarker)\n return after\n }\n\n return nok(code)\n }\n\n /**\n * After `>`, before optional whitespace.\n *\n * ```markdown\n * > | > a\n * ^\n * ```\n *\n * @type {State}\n */\n function after(code) {\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.markdownSpace)(code)) {\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.blockQuotePrefixWhitespace)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.blockQuotePrefixWhitespace)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.blockQuotePrefix)\n return ok\n }\n\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.blockQuotePrefix)\n return ok(code)\n }\n}\n\n/**\n * Start of block quote continuation.\n *\n * ```markdown\n * | > a\n * > | > b\n * ^\n * ```\n *\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeBlockQuoteContinuation(effects, ok, nok) {\n const self = this\n\n return contStart\n\n /**\n * Start of block quote continuation.\n *\n * Also used to parse the first block quote opening.\n *\n * ```markdown\n * | > a\n * > | > b\n * ^\n * ```\n *\n * @type {State}\n */\n function contStart(code) {\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.markdownSpace)(code)) {\n // Always populated by defaults.\n (0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(\n self.parser.constructs.disable.null,\n 'expected `disable.null` to be populated'\n )\n\n return (0,micromark_factory_space__WEBPACK_IMPORTED_MODULE_4__.factorySpace)(\n effects,\n contBefore,\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.linePrefix,\n self.parser.constructs.disable.null.includes('codeIndented')\n ? undefined\n : micromark_util_symbol__WEBPACK_IMPORTED_MODULE_5__.constants.tabSize\n )(code)\n }\n\n return contBefore(code)\n }\n\n /**\n * At `>`, after optional whitespace.\n *\n * Also used to parse the first block quote opening.\n *\n * ```markdown\n * | > a\n * > | > b\n * ^\n * ```\n *\n * @type {State}\n */\n function contBefore(code) {\n return effects.attempt(blockQuote, ok, nok)(code)\n }\n}\n\n/** @type {Exiter} */\nfunction exit(effects) {\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.blockQuote)\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-core-commonmark/dev/lib/block-quote.js?"); /***/ }), /***/ "./node_modules/micromark-core-commonmark/dev/lib/character-escape.js": /*!****************************************************************************!*\ !*** ./node_modules/micromark-core-commonmark/dev/lib/character-escape.js ***! \****************************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ characterEscape: () => (/* binding */ characterEscape)\n/* harmony export */ });\n/* harmony import */ var micromark_util_character__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! micromark-util-character */ \"./node_modules/micromark-util-character/dev/index.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/codes.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/types.js\");\n/* harmony import */ var devlop__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! devlop */ \"./node_modules/devlop/lib/development.js\");\n/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n */\n\n\n\n\n\n/** @type {Construct} */\nconst characterEscape = {\n name: 'characterEscape',\n tokenize: tokenizeCharacterEscape\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeCharacterEscape(effects, ok, nok) {\n return start\n\n /**\n * Start of character escape.\n *\n * ```markdown\n * > | a\\*b\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_0__.ok)(code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.backslash, 'expected `\\\\`')\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.characterEscape)\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.escapeMarker)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.escapeMarker)\n return inside\n }\n\n /**\n * After `\\`, at punctuation.\n *\n * ```markdown\n * > | a\\*b\n * ^\n * ```\n *\n * @type {State}\n */\n function inside(code) {\n // ASCII punctuation.\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.asciiPunctuation)(code)) {\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.characterEscapeValue)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.characterEscapeValue)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.characterEscape)\n return ok\n }\n\n return nok(code)\n }\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-core-commonmark/dev/lib/character-escape.js?"); /***/ }), /***/ "./node_modules/micromark-core-commonmark/dev/lib/character-reference.js": /*!*******************************************************************************!*\ !*** ./node_modules/micromark-core-commonmark/dev/lib/character-reference.js ***! \*******************************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ characterReference: () => (/* binding */ characterReference)\n/* harmony export */ });\n/* harmony import */ var decode_named_character_reference__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! decode-named-character-reference */ \"./node_modules/decode-named-character-reference/index.dom.js\");\n/* harmony import */ var micromark_util_character__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! micromark-util-character */ \"./node_modules/micromark-util-character/dev/index.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/codes.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/types.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/constants.js\");\n/* harmony import */ var devlop__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! devlop */ \"./node_modules/devlop/lib/development.js\");\n/**\n * @typedef {import('micromark-util-types').Code} Code\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n */\n\n\n\n\n\n\n/** @type {Construct} */\nconst characterReference = {\n name: 'characterReference',\n tokenize: tokenizeCharacterReference\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeCharacterReference(effects, ok, nok) {\n const self = this\n let size = 0\n /** @type {number} */\n let max\n /** @type {(code: Code) => boolean} */\n let test\n\n return start\n\n /**\n * Start of character reference.\n *\n * ```markdown\n * > | a&b\n * ^\n * > | a{b\n * ^\n * > | a b\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_0__.ok)(code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.ampersand, 'expected `&`')\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.characterReference)\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.characterReferenceMarker)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.characterReferenceMarker)\n return open\n }\n\n /**\n * After `&`, at `#` for numeric references or alphanumeric for named\n * references.\n *\n * ```markdown\n * > | a&b\n * ^\n * > | a{b\n * ^\n * > | a b\n * ^\n * ```\n *\n * @type {State}\n */\n function open(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.numberSign) {\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.characterReferenceMarkerNumeric)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.characterReferenceMarkerNumeric)\n return numeric\n }\n\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.characterReferenceValue)\n max = micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.constants.characterReferenceNamedSizeMax\n test = micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.asciiAlphanumeric\n return value(code)\n }\n\n /**\n * After `#`, at `x` for hexadecimals or digit for decimals.\n *\n * ```markdown\n * > | a{b\n * ^\n * > | a b\n * ^\n * ```\n *\n * @type {State}\n */\n function numeric(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.uppercaseX || code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.lowercaseX) {\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.characterReferenceMarkerHexadecimal)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.characterReferenceMarkerHexadecimal)\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.characterReferenceValue)\n max = micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.constants.characterReferenceHexadecimalSizeMax\n test = micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.asciiHexDigit\n return value\n }\n\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.characterReferenceValue)\n max = micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.constants.characterReferenceDecimalSizeMax\n test = micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.asciiDigit\n return value(code)\n }\n\n /**\n * After markers (`&#x`, `&#`, or `&`), in value, before `;`.\n *\n * The character reference kind defines what and how many characters are\n * allowed.\n *\n * ```markdown\n * > | a&b\n * ^^^\n * > | a{b\n * ^^^\n * > | a b\n * ^\n * ```\n *\n * @type {State}\n */\n function value(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.semicolon && size) {\n const token = effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.characterReferenceValue)\n\n if (\n test === micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.asciiAlphanumeric &&\n !(0,decode_named_character_reference__WEBPACK_IMPORTED_MODULE_5__.decodeNamedCharacterReference)(self.sliceSerialize(token))\n ) {\n return nok(code)\n }\n\n // To do: `markdown-rs` uses a different name:\n // `CharacterReferenceMarkerSemi`.\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.characterReferenceMarker)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.characterReferenceMarker)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.characterReference)\n return ok\n }\n\n if (test(code) && size++ < max) {\n effects.consume(code)\n return value\n }\n\n return nok(code)\n }\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-core-commonmark/dev/lib/character-reference.js?"); /***/ }), /***/ "./node_modules/micromark-core-commonmark/dev/lib/code-fenced.js": /*!***********************************************************************!*\ !*** ./node_modules/micromark-core-commonmark/dev/lib/code-fenced.js ***! \***********************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ codeFenced: () => (/* binding */ codeFenced)\n/* harmony export */ });\n/* harmony import */ var micromark_factory_space__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! micromark-factory-space */ \"./node_modules/micromark-factory-space/dev/index.js\");\n/* harmony import */ var micromark_util_character__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! micromark-util-character */ \"./node_modules/micromark-util-character/dev/index.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/codes.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/types.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/constants.js\");\n/* harmony import */ var devlop__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! devlop */ \"./node_modules/devlop/lib/development.js\");\n/**\n * @typedef {import('micromark-util-types').Code} Code\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n */\n\n\n\n\n\n\n/** @type {Construct} */\nconst nonLazyContinuation = {\n tokenize: tokenizeNonLazyContinuation,\n partial: true\n}\n\n/** @type {Construct} */\nconst codeFenced = {\n name: 'codeFenced',\n tokenize: tokenizeCodeFenced,\n concrete: true\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeCodeFenced(effects, ok, nok) {\n const self = this\n /** @type {Construct} */\n const closeStart = {tokenize: tokenizeCloseStart, partial: true}\n let initialPrefix = 0\n let sizeOpen = 0\n /** @type {NonNullable} */\n let marker\n\n return start\n\n /**\n * Start of code.\n *\n * ```markdown\n * > | ~~~js\n * ^\n * | alert(1)\n * | ~~~\n * ```\n *\n * @type {State}\n */\n function start(code) {\n // To do: parse whitespace like `markdown-rs`.\n return beforeSequenceOpen(code)\n }\n\n /**\n * In opening fence, after prefix, at sequence.\n *\n * ```markdown\n * > | ~~~js\n * ^\n * | alert(1)\n * | ~~~\n * ```\n *\n * @type {State}\n */\n function beforeSequenceOpen(code) {\n (0,devlop__WEBPACK_IMPORTED_MODULE_0__.ok)(\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.graveAccent || code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.tilde,\n 'expected `` ` `` or `~`'\n )\n\n const tail = self.events[self.events.length - 1]\n initialPrefix =\n tail && tail[1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.linePrefix\n ? tail[2].sliceSerialize(tail[1], true).length\n : 0\n\n marker = code\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.codeFenced)\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.codeFencedFence)\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.codeFencedFenceSequence)\n return sequenceOpen(code)\n }\n\n /**\n * In opening fence sequence.\n *\n * ```markdown\n * > | ~~~js\n * ^\n * | alert(1)\n * | ~~~\n * ```\n *\n * @type {State}\n */\n function sequenceOpen(code) {\n if (code === marker) {\n sizeOpen++\n effects.consume(code)\n return sequenceOpen\n }\n\n if (sizeOpen < micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.constants.codeFencedSequenceSizeMin) {\n return nok(code)\n }\n\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.codeFencedFenceSequence)\n return (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.markdownSpace)(code)\n ? (0,micromark_factory_space__WEBPACK_IMPORTED_MODULE_5__.factorySpace)(effects, infoBefore, micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.whitespace)(code)\n : infoBefore(code)\n }\n\n /**\n * In opening fence, after the sequence (and optional whitespace), before info.\n *\n * ```markdown\n * > | ~~~js\n * ^\n * | alert(1)\n * | ~~~\n * ```\n *\n * @type {State}\n */\n function infoBefore(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.eof || (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.markdownLineEnding)(code)) {\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.codeFencedFence)\n return self.interrupt\n ? ok(code)\n : effects.check(nonLazyContinuation, atNonLazyBreak, after)(code)\n }\n\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.codeFencedFenceInfo)\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.chunkString, {contentType: micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.constants.contentTypeString})\n return info(code)\n }\n\n /**\n * In info.\n *\n * ```markdown\n * > | ~~~js\n * ^\n * | alert(1)\n * | ~~~\n * ```\n *\n * @type {State}\n */\n function info(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.eof || (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.markdownLineEnding)(code)) {\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.chunkString)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.codeFencedFenceInfo)\n return infoBefore(code)\n }\n\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.markdownSpace)(code)) {\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.chunkString)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.codeFencedFenceInfo)\n return (0,micromark_factory_space__WEBPACK_IMPORTED_MODULE_5__.factorySpace)(effects, metaBefore, micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.whitespace)(code)\n }\n\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.graveAccent && code === marker) {\n return nok(code)\n }\n\n effects.consume(code)\n return info\n }\n\n /**\n * In opening fence, after info and whitespace, before meta.\n *\n * ```markdown\n * > | ~~~js eval\n * ^\n * | alert(1)\n * | ~~~\n * ```\n *\n * @type {State}\n */\n function metaBefore(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.eof || (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.markdownLineEnding)(code)) {\n return infoBefore(code)\n }\n\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.codeFencedFenceMeta)\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.chunkString, {contentType: micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.constants.contentTypeString})\n return meta(code)\n }\n\n /**\n * In meta.\n *\n * ```markdown\n * > | ~~~js eval\n * ^\n * | alert(1)\n * | ~~~\n * ```\n *\n * @type {State}\n */\n function meta(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.eof || (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.markdownLineEnding)(code)) {\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.chunkString)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.codeFencedFenceMeta)\n return infoBefore(code)\n }\n\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.graveAccent && code === marker) {\n return nok(code)\n }\n\n effects.consume(code)\n return meta\n }\n\n /**\n * At eol/eof in code, before a non-lazy closing fence or content.\n *\n * ```markdown\n * > | ~~~js\n * ^\n * > | alert(1)\n * ^\n * | ~~~\n * ```\n *\n * @type {State}\n */\n function atNonLazyBreak(code) {\n (0,devlop__WEBPACK_IMPORTED_MODULE_0__.ok)((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.markdownLineEnding)(code), 'expected eol')\n return effects.attempt(closeStart, after, contentBefore)(code)\n }\n\n /**\n * Before code content, not a closing fence, at eol.\n *\n * ```markdown\n * | ~~~js\n * > | alert(1)\n * ^\n * | ~~~\n * ```\n *\n * @type {State}\n */\n function contentBefore(code) {\n (0,devlop__WEBPACK_IMPORTED_MODULE_0__.ok)((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.markdownLineEnding)(code), 'expected eol')\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.lineEnding)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.lineEnding)\n return contentStart\n }\n\n /**\n * Before code content, not a closing fence.\n *\n * ```markdown\n * | ~~~js\n * > | alert(1)\n * ^\n * | ~~~\n * ```\n *\n * @type {State}\n */\n function contentStart(code) {\n return initialPrefix > 0 && (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.markdownSpace)(code)\n ? (0,micromark_factory_space__WEBPACK_IMPORTED_MODULE_5__.factorySpace)(\n effects,\n beforeContentChunk,\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.linePrefix,\n initialPrefix + 1\n )(code)\n : beforeContentChunk(code)\n }\n\n /**\n * Before code content, after optional prefix.\n *\n * ```markdown\n * | ~~~js\n * > | alert(1)\n * ^\n * | ~~~\n * ```\n *\n * @type {State}\n */\n function beforeContentChunk(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.eof || (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.markdownLineEnding)(code)) {\n return effects.check(nonLazyContinuation, atNonLazyBreak, after)(code)\n }\n\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.codeFlowValue)\n return contentChunk(code)\n }\n\n /**\n * In code content.\n *\n * ```markdown\n * | ~~~js\n * > | alert(1)\n * ^^^^^^^^\n * | ~~~\n * ```\n *\n * @type {State}\n */\n function contentChunk(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.eof || (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.markdownLineEnding)(code)) {\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.codeFlowValue)\n return beforeContentChunk(code)\n }\n\n effects.consume(code)\n return contentChunk\n }\n\n /**\n * After code.\n *\n * ```markdown\n * | ~~~js\n * | alert(1)\n * > | ~~~\n * ^\n * ```\n *\n * @type {State}\n */\n function after(code) {\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.codeFenced)\n return ok(code)\n }\n\n /**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\n function tokenizeCloseStart(effects, ok, nok) {\n let size = 0\n\n return startBefore\n\n /**\n *\n *\n * @type {State}\n */\n function startBefore(code) {\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_0__.ok)((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.markdownLineEnding)(code), 'expected eol')\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.lineEnding)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.lineEnding)\n return start\n }\n\n /**\n * Before closing fence, at optional whitespace.\n *\n * ```markdown\n * | ~~~js\n * | alert(1)\n * > | ~~~\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n // Always populated by defaults.\n (0,devlop__WEBPACK_IMPORTED_MODULE_0__.ok)(\n self.parser.constructs.disable.null,\n 'expected `disable.null` to be populated'\n )\n\n // To do: `enter` here or in next state?\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.codeFencedFence)\n return (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.markdownSpace)(code)\n ? (0,micromark_factory_space__WEBPACK_IMPORTED_MODULE_5__.factorySpace)(\n effects,\n beforeSequenceClose,\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.linePrefix,\n self.parser.constructs.disable.null.includes('codeIndented')\n ? undefined\n : micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.constants.tabSize\n )(code)\n : beforeSequenceClose(code)\n }\n\n /**\n * In closing fence, after optional whitespace, at sequence.\n *\n * ```markdown\n * | ~~~js\n * | alert(1)\n * > | ~~~\n * ^\n * ```\n *\n * @type {State}\n */\n function beforeSequenceClose(code) {\n if (code === marker) {\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.codeFencedFenceSequence)\n return sequenceClose(code)\n }\n\n return nok(code)\n }\n\n /**\n * In closing fence sequence.\n *\n * ```markdown\n * | ~~~js\n * | alert(1)\n * > | ~~~\n * ^\n * ```\n *\n * @type {State}\n */\n function sequenceClose(code) {\n if (code === marker) {\n size++\n effects.consume(code)\n return sequenceClose\n }\n\n if (size >= sizeOpen) {\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.codeFencedFenceSequence)\n return (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.markdownSpace)(code)\n ? (0,micromark_factory_space__WEBPACK_IMPORTED_MODULE_5__.factorySpace)(effects, sequenceCloseAfter, micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.whitespace)(code)\n : sequenceCloseAfter(code)\n }\n\n return nok(code)\n }\n\n /**\n * After closing fence sequence, after optional whitespace.\n *\n * ```markdown\n * | ~~~js\n * | alert(1)\n * > | ~~~\n * ^\n * ```\n *\n * @type {State}\n */\n function sequenceCloseAfter(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.eof || (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.markdownLineEnding)(code)) {\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.codeFencedFence)\n return ok(code)\n }\n\n return nok(code)\n }\n }\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeNonLazyContinuation(effects, ok, nok) {\n const self = this\n\n return start\n\n /**\n *\n *\n * @type {State}\n */\n function start(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.eof) {\n return nok(code)\n }\n\n (0,devlop__WEBPACK_IMPORTED_MODULE_0__.ok)((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.markdownLineEnding)(code), 'expected eol')\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.lineEnding)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.lineEnding)\n return lineStart\n }\n\n /**\n *\n *\n * @type {State}\n */\n function lineStart(code) {\n return self.parser.lazy[self.now().line] ? nok(code) : ok(code)\n }\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-core-commonmark/dev/lib/code-fenced.js?"); /***/ }), /***/ "./node_modules/micromark-core-commonmark/dev/lib/code-indented.js": /*!*************************************************************************!*\ !*** ./node_modules/micromark-core-commonmark/dev/lib/code-indented.js ***! \*************************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ codeIndented: () => (/* binding */ codeIndented)\n/* harmony export */ });\n/* harmony import */ var micromark_factory_space__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! micromark-factory-space */ \"./node_modules/micromark-factory-space/dev/index.js\");\n/* harmony import */ var micromark_util_character__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! micromark-util-character */ \"./node_modules/micromark-util-character/dev/index.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/types.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/constants.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/codes.js\");\n/* harmony import */ var devlop__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! devlop */ \"./node_modules/devlop/lib/development.js\");\n/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n */\n\n\n\n\n\n\n/** @type {Construct} */\nconst codeIndented = {\n name: 'codeIndented',\n tokenize: tokenizeCodeIndented\n}\n\n/** @type {Construct} */\nconst furtherStart = {tokenize: tokenizeFurtherStart, partial: true}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeCodeIndented(effects, ok, nok) {\n const self = this\n return start\n\n /**\n * Start of code (indented).\n *\n * > **Parsing note**: it is not needed to check if this first line is a\n * > filled line (that it has a non-whitespace character), because blank lines\n * > are parsed already, so we never run into that.\n *\n * ```markdown\n * > | aaa\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n // To do: manually check if interrupting like `markdown-rs`.\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_0__.ok)((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_1__.markdownSpace)(code))\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.codeIndented)\n // To do: use an improved `space_or_tab` function like `markdown-rs`,\n // so that we can drop the next state.\n return (0,micromark_factory_space__WEBPACK_IMPORTED_MODULE_3__.factorySpace)(\n effects,\n afterPrefix,\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.linePrefix,\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.constants.tabSize + 1\n )(code)\n }\n\n /**\n * At start, after 1 or 4 spaces.\n *\n * ```markdown\n * > | aaa\n * ^\n * ```\n *\n * @type {State}\n */\n function afterPrefix(code) {\n const tail = self.events[self.events.length - 1]\n return tail &&\n tail[1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.linePrefix &&\n tail[2].sliceSerialize(tail[1], true).length >= micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.constants.tabSize\n ? atBreak(code)\n : nok(code)\n }\n\n /**\n * At a break.\n *\n * ```markdown\n * > | aaa\n * ^ ^\n * ```\n *\n * @type {State}\n */\n function atBreak(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_5__.codes.eof) {\n return after(code)\n }\n\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_1__.markdownLineEnding)(code)) {\n return effects.attempt(furtherStart, atBreak, after)(code)\n }\n\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.codeFlowValue)\n return inside(code)\n }\n\n /**\n * In code content.\n *\n * ```markdown\n * > | aaa\n * ^^^^\n * ```\n *\n * @type {State}\n */\n function inside(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_5__.codes.eof || (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_1__.markdownLineEnding)(code)) {\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.codeFlowValue)\n return atBreak(code)\n }\n\n effects.consume(code)\n return inside\n }\n\n /** @type {State} */\n function after(code) {\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.codeIndented)\n // To do: allow interrupting like `markdown-rs`.\n // Feel free to interrupt.\n // tokenizer.interrupt = false\n return ok(code)\n }\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeFurtherStart(effects, ok, nok) {\n const self = this\n\n return furtherStart\n\n /**\n * At eol, trying to parse another indent.\n *\n * ```markdown\n * > | aaa\n * ^\n * | bbb\n * ```\n *\n * @type {State}\n */\n function furtherStart(code) {\n // To do: improve `lazy` / `pierce` handling.\n // If this is a lazy line, it can’t be code.\n if (self.parser.lazy[self.now().line]) {\n return nok(code)\n }\n\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_1__.markdownLineEnding)(code)) {\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.lineEnding)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.lineEnding)\n return furtherStart\n }\n\n // To do: the code here in `micromark-js` is a bit different from\n // `markdown-rs` because there it can attempt spaces.\n // We can’t yet.\n //\n // To do: use an improved `space_or_tab` function like `markdown-rs`,\n // so that we can drop the next state.\n return (0,micromark_factory_space__WEBPACK_IMPORTED_MODULE_3__.factorySpace)(\n effects,\n afterPrefix,\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.linePrefix,\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.constants.tabSize + 1\n )(code)\n }\n\n /**\n * At start, after 1 or 4 spaces.\n *\n * ```markdown\n * > | aaa\n * ^\n * ```\n *\n * @type {State}\n */\n function afterPrefix(code) {\n const tail = self.events[self.events.length - 1]\n return tail &&\n tail[1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.linePrefix &&\n tail[2].sliceSerialize(tail[1], true).length >= micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.constants.tabSize\n ? ok(code)\n : (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_1__.markdownLineEnding)(code)\n ? furtherStart(code)\n : nok(code)\n }\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-core-commonmark/dev/lib/code-indented.js?"); /***/ }), /***/ "./node_modules/micromark-core-commonmark/dev/lib/code-text.js": /*!*********************************************************************!*\ !*** ./node_modules/micromark-core-commonmark/dev/lib/code-text.js ***! \*********************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ codeText: () => (/* binding */ codeText)\n/* harmony export */ });\n/* harmony import */ var micromark_util_character__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! micromark-util-character */ \"./node_modules/micromark-util-character/dev/index.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/types.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/codes.js\");\n/* harmony import */ var devlop__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! devlop */ \"./node_modules/devlop/lib/development.js\");\n/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Previous} Previous\n * @typedef {import('micromark-util-types').Resolver} Resolver\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n */\n\n\n\n\n\n/** @type {Construct} */\nconst codeText = {\n name: 'codeText',\n tokenize: tokenizeCodeText,\n resolve: resolveCodeText,\n previous\n}\n\n// To do: next major: don’t resolve, like `markdown-rs`.\n/** @type {Resolver} */\nfunction resolveCodeText(events) {\n let tailExitIndex = events.length - 4\n let headEnterIndex = 3\n /** @type {number} */\n let index\n /** @type {number | undefined} */\n let enter\n\n // If we start and end with an EOL or a space.\n if (\n (events[headEnterIndex][1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.lineEnding ||\n events[headEnterIndex][1].type === 'space') &&\n (events[tailExitIndex][1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.lineEnding ||\n events[tailExitIndex][1].type === 'space')\n ) {\n index = headEnterIndex\n\n // And we have data.\n while (++index < tailExitIndex) {\n if (events[index][1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.codeTextData) {\n // Then we have padding.\n events[headEnterIndex][1].type = micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.codeTextPadding\n events[tailExitIndex][1].type = micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.codeTextPadding\n headEnterIndex += 2\n tailExitIndex -= 2\n break\n }\n }\n }\n\n // Merge adjacent spaces and data.\n index = headEnterIndex - 1\n tailExitIndex++\n\n while (++index <= tailExitIndex) {\n if (enter === undefined) {\n if (\n index !== tailExitIndex &&\n events[index][1].type !== micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.lineEnding\n ) {\n enter = index\n }\n } else if (\n index === tailExitIndex ||\n events[index][1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.lineEnding\n ) {\n events[enter][1].type = micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.codeTextData\n\n if (index !== enter + 2) {\n events[enter][1].end = events[index - 1][1].end\n events.splice(enter + 2, index - enter - 2)\n tailExitIndex -= index - enter - 2\n index = enter + 2\n }\n\n enter = undefined\n }\n }\n\n return events\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Previous}\n */\nfunction previous(code) {\n // If there is a previous code, there will always be a tail.\n return (\n code !== micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.graveAccent ||\n this.events[this.events.length - 1][1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.characterEscape\n )\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeCodeText(effects, ok, nok) {\n const self = this\n let sizeOpen = 0\n /** @type {number} */\n let size\n /** @type {Token} */\n let token\n\n return start\n\n /**\n * Start of code (text).\n *\n * ```markdown\n * > | `a`\n * ^\n * > | \\`a`\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_2__.ok)(code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.graveAccent, 'expected `` ` ``')\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_2__.ok)(previous.call(self, self.previous), 'expected correct previous')\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.codeText)\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.codeTextSequence)\n return sequenceOpen(code)\n }\n\n /**\n * In opening sequence.\n *\n * ```markdown\n * > | `a`\n * ^\n * ```\n *\n * @type {State}\n */\n function sequenceOpen(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.graveAccent) {\n effects.consume(code)\n sizeOpen++\n return sequenceOpen\n }\n\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.codeTextSequence)\n return between(code)\n }\n\n /**\n * Between something and something else.\n *\n * ```markdown\n * > | `a`\n * ^^\n * ```\n *\n * @type {State}\n */\n function between(code) {\n // EOF.\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.eof) {\n return nok(code)\n }\n\n // To do: next major: don’t do spaces in resolve, but when compiling,\n // like `markdown-rs`.\n // Tabs don’t work, and virtual spaces don’t make sense.\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.space) {\n effects.enter('space')\n effects.consume(code)\n effects.exit('space')\n return between\n }\n\n // Closing fence? Could also be data.\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.graveAccent) {\n token = effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.codeTextSequence)\n size = 0\n return sequenceClose(code)\n }\n\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.markdownLineEnding)(code)) {\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.lineEnding)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.lineEnding)\n return between\n }\n\n // Data.\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.codeTextData)\n return data(code)\n }\n\n /**\n * In data.\n *\n * ```markdown\n * > | `a`\n * ^\n * ```\n *\n * @type {State}\n */\n function data(code) {\n if (\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.eof ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.space ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.graveAccent ||\n (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.markdownLineEnding)(code)\n ) {\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.codeTextData)\n return between(code)\n }\n\n effects.consume(code)\n return data\n }\n\n /**\n * In closing sequence.\n *\n * ```markdown\n * > | `a`\n * ^\n * ```\n *\n * @type {State}\n */\n function sequenceClose(code) {\n // More.\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.graveAccent) {\n effects.consume(code)\n size++\n return sequenceClose\n }\n\n // Done!\n if (size === sizeOpen) {\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.codeTextSequence)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.codeText)\n return ok(code)\n }\n\n // More or less accents: mark as data.\n token.type = micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.codeTextData\n return data(code)\n }\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-core-commonmark/dev/lib/code-text.js?"); /***/ }), /***/ "./node_modules/micromark-core-commonmark/dev/lib/content.js": /*!*******************************************************************!*\ !*** ./node_modules/micromark-core-commonmark/dev/lib/content.js ***! \*******************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ content: () => (/* binding */ content)\n/* harmony export */ });\n/* harmony import */ var micromark_factory_space__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! micromark-factory-space */ \"./node_modules/micromark-factory-space/dev/index.js\");\n/* harmony import */ var micromark_util_character__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! micromark-util-character */ \"./node_modules/micromark-util-character/dev/index.js\");\n/* harmony import */ var micromark_util_subtokenize__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! micromark-util-subtokenize */ \"./node_modules/micromark-util-subtokenize/dev/index.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/codes.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/types.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/constants.js\");\n/* harmony import */ var devlop__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! devlop */ \"./node_modules/devlop/lib/development.js\");\n/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Resolver} Resolver\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n */\n\n\n\n\n\n\n\n/**\n * No name because it must not be turned off.\n * @type {Construct}\n */\nconst content = {tokenize: tokenizeContent, resolve: resolveContent}\n\n/** @type {Construct} */\nconst continuationConstruct = {tokenize: tokenizeContinuation, partial: true}\n\n/**\n * Content is transparent: it’s parsed right now. That way, definitions are also\n * parsed right now: before text in paragraphs (specifically, media) are parsed.\n *\n * @type {Resolver}\n */\nfunction resolveContent(events) {\n ;(0,micromark_util_subtokenize__WEBPACK_IMPORTED_MODULE_0__.subtokenize)(events)\n return events\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeContent(effects, ok) {\n /** @type {Token | undefined} */\n let previous\n\n return chunkStart\n\n /**\n * Before a content chunk.\n *\n * ```markdown\n * > | abc\n * ^\n * ```\n *\n * @type {State}\n */\n function chunkStart(code) {\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(\n code !== micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.eof && !(0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.markdownLineEnding)(code),\n 'expected no eof or eol'\n )\n\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.types.content)\n previous = effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.types.chunkContent, {\n contentType: micromark_util_symbol__WEBPACK_IMPORTED_MODULE_5__.constants.contentTypeContent\n })\n return chunkInside(code)\n }\n\n /**\n * In a content chunk.\n *\n * ```markdown\n * > | abc\n * ^^^\n * ```\n *\n * @type {State}\n */\n function chunkInside(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.eof) {\n return contentEnd(code)\n }\n\n // To do: in `markdown-rs`, each line is parsed on its own, and everything\n // is stitched together resolving.\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.markdownLineEnding)(code)) {\n return effects.check(\n continuationConstruct,\n contentContinue,\n contentEnd\n )(code)\n }\n\n // Data.\n effects.consume(code)\n return chunkInside\n }\n\n /**\n *\n *\n * @type {State}\n */\n function contentEnd(code) {\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.types.chunkContent)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.types.content)\n return ok(code)\n }\n\n /**\n *\n *\n * @type {State}\n */\n function contentContinue(code) {\n (0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.markdownLineEnding)(code), 'expected eol')\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.types.chunkContent)\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(previous, 'expected previous token')\n previous.next = effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.types.chunkContent, {\n contentType: micromark_util_symbol__WEBPACK_IMPORTED_MODULE_5__.constants.contentTypeContent,\n previous\n })\n previous = previous.next\n return chunkInside\n }\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeContinuation(effects, ok, nok) {\n const self = this\n\n return startLookahead\n\n /**\n *\n *\n * @type {State}\n */\n function startLookahead(code) {\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.markdownLineEnding)(code), 'expected a line ending')\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.types.chunkContent)\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.types.lineEnding)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.types.lineEnding)\n return (0,micromark_factory_space__WEBPACK_IMPORTED_MODULE_6__.factorySpace)(effects, prefixed, micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.types.linePrefix)\n }\n\n /**\n *\n *\n * @type {State}\n */\n function prefixed(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.eof || (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.markdownLineEnding)(code)) {\n return nok(code)\n }\n\n // Always populated by defaults.\n (0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(\n self.parser.constructs.disable.null,\n 'expected `disable.null` to be populated'\n )\n\n const tail = self.events[self.events.length - 1]\n\n if (\n !self.parser.constructs.disable.null.includes('codeIndented') &&\n tail &&\n tail[1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.types.linePrefix &&\n tail[2].sliceSerialize(tail[1], true).length >= micromark_util_symbol__WEBPACK_IMPORTED_MODULE_5__.constants.tabSize\n ) {\n return ok(code)\n }\n\n return effects.interrupt(self.parser.constructs.flow, nok, ok)(code)\n }\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-core-commonmark/dev/lib/content.js?"); /***/ }), /***/ "./node_modules/micromark-core-commonmark/dev/lib/definition.js": /*!**********************************************************************!*\ !*** ./node_modules/micromark-core-commonmark/dev/lib/definition.js ***! \**********************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ definition: () => (/* binding */ definition)\n/* harmony export */ });\n/* harmony import */ var micromark_factory_destination__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! micromark-factory-destination */ \"./node_modules/micromark-factory-destination/dev/index.js\");\n/* harmony import */ var micromark_factory_label__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! micromark-factory-label */ \"./node_modules/micromark-factory-label/dev/index.js\");\n/* harmony import */ var micromark_factory_space__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! micromark-factory-space */ \"./node_modules/micromark-factory-space/dev/index.js\");\n/* harmony import */ var micromark_factory_title__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! micromark-factory-title */ \"./node_modules/micromark-factory-title/dev/index.js\");\n/* harmony import */ var micromark_factory_whitespace__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! micromark-factory-whitespace */ \"./node_modules/micromark-factory-whitespace/dev/index.js\");\n/* harmony import */ var micromark_util_character__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! micromark-util-character */ \"./node_modules/micromark-util-character/dev/index.js\");\n/* harmony import */ var micromark_util_normalize_identifier__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! micromark-util-normalize-identifier */ \"./node_modules/micromark-util-normalize-identifier/dev/index.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/types.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/codes.js\");\n/* harmony import */ var devlop__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! devlop */ \"./node_modules/devlop/lib/development.js\");\n/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n */\n\n\n\n\n\n\n\n\n\n\n\n/** @type {Construct} */\nconst definition = {name: 'definition', tokenize: tokenizeDefinition}\n\n/** @type {Construct} */\nconst titleBefore = {tokenize: tokenizeTitleBefore, partial: true}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeDefinition(effects, ok, nok) {\n const self = this\n /** @type {string} */\n let identifier\n\n return start\n\n /**\n * At start of a definition.\n *\n * ```markdown\n * > | [a]: b \"c\"\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n // Do not interrupt paragraphs (but do follow definitions).\n // To do: do `interrupt` the way `markdown-rs` does.\n // To do: parse whitespace the way `markdown-rs` does.\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.definition)\n return before(code)\n }\n\n /**\n * After optional whitespace, at `[`.\n *\n * ```markdown\n * > | [a]: b \"c\"\n * ^\n * ```\n *\n * @type {State}\n */\n function before(code) {\n // To do: parse whitespace the way `markdown-rs` does.\n (0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.leftSquareBracket, 'expected `[`')\n return micromark_factory_label__WEBPACK_IMPORTED_MODULE_3__.factoryLabel.call(\n self,\n effects,\n labelAfter,\n // Note: we don’t need to reset the way `markdown-rs` does.\n nok,\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.definitionLabel,\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.definitionLabelMarker,\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.definitionLabelString\n )(code)\n }\n\n /**\n * After label.\n *\n * ```markdown\n * > | [a]: b \"c\"\n * ^\n * ```\n *\n * @type {State}\n */\n function labelAfter(code) {\n identifier = (0,micromark_util_normalize_identifier__WEBPACK_IMPORTED_MODULE_4__.normalizeIdentifier)(\n self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1)\n )\n\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.colon) {\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.definitionMarker)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.definitionMarker)\n return markerAfter\n }\n\n return nok(code)\n }\n\n /**\n * After marker.\n *\n * ```markdown\n * > | [a]: b \"c\"\n * ^\n * ```\n *\n * @type {State}\n */\n function markerAfter(code) {\n // Note: whitespace is optional.\n return (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_5__.markdownLineEndingOrSpace)(code)\n ? (0,micromark_factory_whitespace__WEBPACK_IMPORTED_MODULE_6__.factoryWhitespace)(effects, destinationBefore)(code)\n : destinationBefore(code)\n }\n\n /**\n * Before destination.\n *\n * ```markdown\n * > | [a]: b \"c\"\n * ^\n * ```\n *\n * @type {State}\n */\n function destinationBefore(code) {\n return (0,micromark_factory_destination__WEBPACK_IMPORTED_MODULE_7__.factoryDestination)(\n effects,\n destinationAfter,\n // Note: we don’t need to reset the way `markdown-rs` does.\n nok,\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.definitionDestination,\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.definitionDestinationLiteral,\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.definitionDestinationLiteralMarker,\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.definitionDestinationRaw,\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.definitionDestinationString\n )(code)\n }\n\n /**\n * After destination.\n *\n * ```markdown\n * > | [a]: b \"c\"\n * ^\n * ```\n *\n * @type {State}\n */\n function destinationAfter(code) {\n return effects.attempt(titleBefore, after, after)(code)\n }\n\n /**\n * After definition.\n *\n * ```markdown\n * > | [a]: b\n * ^\n * > | [a]: b \"c\"\n * ^\n * ```\n *\n * @type {State}\n */\n function after(code) {\n return (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_5__.markdownSpace)(code)\n ? (0,micromark_factory_space__WEBPACK_IMPORTED_MODULE_8__.factorySpace)(effects, afterWhitespace, micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.whitespace)(code)\n : afterWhitespace(code)\n }\n\n /**\n * After definition, after optional whitespace.\n *\n * ```markdown\n * > | [a]: b\n * ^\n * > | [a]: b \"c\"\n * ^\n * ```\n *\n * @type {State}\n */\n function afterWhitespace(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.eof || (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_5__.markdownLineEnding)(code)) {\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.definition)\n\n // Note: we don’t care about uniqueness.\n // It’s likely that that doesn’t happen very frequently.\n // It is more likely that it wastes precious time.\n self.parser.defined.push(identifier)\n\n // To do: `markdown-rs` interrupt.\n // // You’d be interrupting.\n // tokenizer.interrupt = true\n return ok(code)\n }\n\n return nok(code)\n }\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeTitleBefore(effects, ok, nok) {\n return titleBefore\n\n /**\n * After destination, at whitespace.\n *\n * ```markdown\n * > | [a]: b\n * ^\n * > | [a]: b \"c\"\n * ^\n * ```\n *\n * @type {State}\n */\n function titleBefore(code) {\n return (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_5__.markdownLineEndingOrSpace)(code)\n ? (0,micromark_factory_whitespace__WEBPACK_IMPORTED_MODULE_6__.factoryWhitespace)(effects, beforeMarker)(code)\n : nok(code)\n }\n\n /**\n * At title.\n *\n * ```markdown\n * | [a]: b\n * > | \"c\"\n * ^\n * ```\n *\n * @type {State}\n */\n function beforeMarker(code) {\n return (0,micromark_factory_title__WEBPACK_IMPORTED_MODULE_9__.factoryTitle)(\n effects,\n titleAfter,\n nok,\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.definitionTitle,\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.definitionTitleMarker,\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.definitionTitleString\n )(code)\n }\n\n /**\n * After title.\n *\n * ```markdown\n * > | [a]: b \"c\"\n * ^\n * ```\n *\n * @type {State}\n */\n function titleAfter(code) {\n return (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_5__.markdownSpace)(code)\n ? (0,micromark_factory_space__WEBPACK_IMPORTED_MODULE_8__.factorySpace)(\n effects,\n titleAfterOptionalWhitespace,\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.whitespace\n )(code)\n : titleAfterOptionalWhitespace(code)\n }\n\n /**\n * After title, after optional whitespace.\n *\n * ```markdown\n * > | [a]: b \"c\"\n * ^\n * ```\n *\n * @type {State}\n */\n function titleAfterOptionalWhitespace(code) {\n return code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.eof || (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_5__.markdownLineEnding)(code) ? ok(code) : nok(code)\n }\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-core-commonmark/dev/lib/definition.js?"); /***/ }), /***/ "./node_modules/micromark-core-commonmark/dev/lib/hard-break-escape.js": /*!*****************************************************************************!*\ !*** ./node_modules/micromark-core-commonmark/dev/lib/hard-break-escape.js ***! \*****************************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hardBreakEscape: () => (/* binding */ hardBreakEscape)\n/* harmony export */ });\n/* harmony import */ var micromark_util_character__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! micromark-util-character */ \"./node_modules/micromark-util-character/dev/index.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/codes.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/types.js\");\n/* harmony import */ var devlop__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! devlop */ \"./node_modules/devlop/lib/development.js\");\n/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n */\n\n\n\n\n\n/** @type {Construct} */\nconst hardBreakEscape = {\n name: 'hardBreakEscape',\n tokenize: tokenizeHardBreakEscape\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeHardBreakEscape(effects, ok, nok) {\n return start\n\n /**\n * Start of a hard break (escape).\n *\n * ```markdown\n * > | a\\\n * ^\n * | b\n * ```\n *\n * @type {State}\n */\n function start(code) {\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_0__.ok)(code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.backslash, 'expected `\\\\`')\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.hardBreakEscape)\n effects.consume(code)\n return after\n }\n\n /**\n * After `\\`, at eol.\n *\n * ```markdown\n * > | a\\\n * ^\n * | b\n * ```\n *\n * @type {State}\n */\n function after(code) {\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.markdownLineEnding)(code)) {\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.hardBreakEscape)\n return ok(code)\n }\n\n return nok(code)\n }\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-core-commonmark/dev/lib/hard-break-escape.js?"); /***/ }), /***/ "./node_modules/micromark-core-commonmark/dev/lib/heading-atx.js": /*!***********************************************************************!*\ !*** ./node_modules/micromark-core-commonmark/dev/lib/heading-atx.js ***! \***********************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ headingAtx: () => (/* binding */ headingAtx)\n/* harmony export */ });\n/* harmony import */ var micromark_factory_space__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! micromark-factory-space */ \"./node_modules/micromark-factory-space/dev/index.js\");\n/* harmony import */ var micromark_util_character__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! micromark-util-character */ \"./node_modules/micromark-util-character/dev/index.js\");\n/* harmony import */ var micromark_util_chunked__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! micromark-util-chunked */ \"./node_modules/micromark-util-chunked/dev/index.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/types.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/constants.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/codes.js\");\n/* harmony import */ var devlop__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! devlop */ \"./node_modules/devlop/lib/development.js\");\n/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Resolver} Resolver\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n */\n\n\n\n\n\n\n\n/** @type {Construct} */\nconst headingAtx = {\n name: 'headingAtx',\n tokenize: tokenizeHeadingAtx,\n resolve: resolveHeadingAtx\n}\n\n/** @type {Resolver} */\nfunction resolveHeadingAtx(events, context) {\n let contentEnd = events.length - 2\n let contentStart = 3\n /** @type {Token} */\n let content\n /** @type {Token} */\n let text\n\n // Prefix whitespace, part of the opening.\n if (events[contentStart][1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.whitespace) {\n contentStart += 2\n }\n\n // Suffix whitespace, part of the closing.\n if (\n contentEnd - 2 > contentStart &&\n events[contentEnd][1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.whitespace\n ) {\n contentEnd -= 2\n }\n\n if (\n events[contentEnd][1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.atxHeadingSequence &&\n (contentStart === contentEnd - 1 ||\n (contentEnd - 4 > contentStart &&\n events[contentEnd - 2][1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.whitespace))\n ) {\n contentEnd -= contentStart + 1 === contentEnd ? 2 : 4\n }\n\n if (contentEnd > contentStart) {\n content = {\n type: micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.atxHeadingText,\n start: events[contentStart][1].start,\n end: events[contentEnd][1].end\n }\n text = {\n type: micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.chunkText,\n start: events[contentStart][1].start,\n end: events[contentEnd][1].end,\n contentType: micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.constants.contentTypeText\n }\n\n ;(0,micromark_util_chunked__WEBPACK_IMPORTED_MODULE_2__.splice)(events, contentStart, contentEnd - contentStart + 1, [\n ['enter', content, context],\n ['enter', text, context],\n ['exit', text, context],\n ['exit', content, context]\n ])\n }\n\n return events\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeHeadingAtx(effects, ok, nok) {\n let size = 0\n\n return start\n\n /**\n * Start of a heading (atx).\n *\n * ```markdown\n * > | ## aa\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n // To do: parse indent like `markdown-rs`.\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.atxHeading)\n return before(code)\n }\n\n /**\n * After optional whitespace, at `#`.\n *\n * ```markdown\n * > | ## aa\n * ^\n * ```\n *\n * @type {State}\n */\n function before(code) {\n (0,devlop__WEBPACK_IMPORTED_MODULE_3__.ok)(code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.codes.numberSign, 'expected `#`')\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.atxHeadingSequence)\n return sequenceOpen(code)\n }\n\n /**\n * In opening sequence.\n *\n * ```markdown\n * > | ## aa\n * ^\n * ```\n *\n * @type {State}\n */\n function sequenceOpen(code) {\n if (\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.codes.numberSign &&\n size++ < micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.constants.atxHeadingOpeningFenceSizeMax\n ) {\n effects.consume(code)\n return sequenceOpen\n }\n\n // Always at least one `#`.\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.codes.eof || (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_5__.markdownLineEndingOrSpace)(code)) {\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.atxHeadingSequence)\n return atBreak(code)\n }\n\n return nok(code)\n }\n\n /**\n * After something, before something else.\n *\n * ```markdown\n * > | ## aa\n * ^\n * ```\n *\n * @type {State}\n */\n function atBreak(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.codes.numberSign) {\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.atxHeadingSequence)\n return sequenceFurther(code)\n }\n\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.codes.eof || (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_5__.markdownLineEnding)(code)) {\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.atxHeading)\n // To do: interrupt like `markdown-rs`.\n // // Feel free to interrupt.\n // tokenizer.interrupt = false\n return ok(code)\n }\n\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_5__.markdownSpace)(code)) {\n return (0,micromark_factory_space__WEBPACK_IMPORTED_MODULE_6__.factorySpace)(effects, atBreak, micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.whitespace)(code)\n }\n\n // To do: generate `data` tokens, add the `text` token later.\n // Needs edit map, see: `markdown.rs`.\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.atxHeadingText)\n return data(code)\n }\n\n /**\n * In further sequence (after whitespace).\n *\n * Could be normal “visible” hashes in the heading or a final sequence.\n *\n * ```markdown\n * > | ## aa ##\n * ^\n * ```\n *\n * @type {State}\n */\n function sequenceFurther(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.codes.numberSign) {\n effects.consume(code)\n return sequenceFurther\n }\n\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.atxHeadingSequence)\n return atBreak(code)\n }\n\n /**\n * In text.\n *\n * ```markdown\n * > | ## aa\n * ^\n * ```\n *\n * @type {State}\n */\n function data(code) {\n if (\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.codes.eof ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.codes.numberSign ||\n (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_5__.markdownLineEndingOrSpace)(code)\n ) {\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.atxHeadingText)\n return atBreak(code)\n }\n\n effects.consume(code)\n return data\n }\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-core-commonmark/dev/lib/heading-atx.js?"); /***/ }), /***/ "./node_modules/micromark-core-commonmark/dev/lib/html-flow.js": /*!*********************************************************************!*\ !*** ./node_modules/micromark-core-commonmark/dev/lib/html-flow.js ***! \*********************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ htmlFlow: () => (/* binding */ htmlFlow)\n/* harmony export */ });\n/* harmony import */ var micromark_util_character__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! micromark-util-character */ \"./node_modules/micromark-util-character/dev/index.js\");\n/* harmony import */ var micromark_util_html_tag_name__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! micromark-util-html-tag-name */ \"./node_modules/micromark-util-html-tag-name/index.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/types.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/codes.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/constants.js\");\n/* harmony import */ var devlop__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! devlop */ \"./node_modules/devlop/lib/development.js\");\n/* harmony import */ var _blank_line_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./blank-line.js */ \"./node_modules/micromark-core-commonmark/dev/lib/blank-line.js\");\n/**\n * @typedef {import('micromark-util-types').Code} Code\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Resolver} Resolver\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n */\n\n\n\n\n\n\n\n/** @type {Construct} */\nconst htmlFlow = {\n name: 'htmlFlow',\n tokenize: tokenizeHtmlFlow,\n resolveTo: resolveToHtmlFlow,\n concrete: true\n}\n\n/** @type {Construct} */\nconst blankLineBefore = {tokenize: tokenizeBlankLineBefore, partial: true}\nconst nonLazyContinuationStart = {\n tokenize: tokenizeNonLazyContinuationStart,\n partial: true\n}\n\n/** @type {Resolver} */\nfunction resolveToHtmlFlow(events) {\n let index = events.length\n\n while (index--) {\n if (\n events[index][0] === 'enter' &&\n events[index][1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.htmlFlow\n ) {\n break\n }\n }\n\n if (index > 1 && events[index - 2][1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.linePrefix) {\n // Add the prefix start to the HTML token.\n events[index][1].start = events[index - 2][1].start\n // Add the prefix start to the HTML line token.\n events[index + 1][1].start = events[index - 2][1].start\n // Remove the line prefix.\n events.splice(index - 2, 2)\n }\n\n return events\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeHtmlFlow(effects, ok, nok) {\n const self = this\n /** @type {number} */\n let marker\n /** @type {boolean} */\n let closingTag\n /** @type {string} */\n let buffer\n /** @type {number} */\n let index\n /** @type {Code} */\n let markerB\n\n return start\n\n /**\n * Start of HTML (flow).\n *\n * ```markdown\n * > | \n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n // To do: parse indent like `markdown-rs`.\n return before(code)\n }\n\n /**\n * At `<`, after optional whitespace.\n *\n * ```markdown\n * > | \n * ^\n * ```\n *\n * @type {State}\n */\n function before(code) {\n (0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.lessThan, 'expected `<`')\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.htmlFlow)\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.htmlFlowData)\n effects.consume(code)\n return open\n }\n\n /**\n * After `<`, at tag name or other stuff.\n *\n * ```markdown\n * > | \n * ^\n * > | \n * ^\n * > | \n * ^\n * ```\n *\n * @type {State}\n */\n function open(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.exclamationMark) {\n effects.consume(code)\n return declarationOpen\n }\n\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.slash) {\n effects.consume(code)\n closingTag = true\n return tagCloseStart\n }\n\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.questionMark) {\n effects.consume(code)\n marker = micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.constants.htmlInstruction\n // To do:\n // tokenizer.concrete = true\n // To do: use `markdown-rs` style interrupt.\n // While we’re in an instruction instead of a declaration, we’re on a `?`\n // right now, so we do need to search for `>`, similar to declarations.\n return self.interrupt ? ok : continuationDeclarationInside\n }\n\n // ASCII alphabetical.\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.asciiAlpha)(code)) {\n effects.consume(code)\n // @ts-expect-error: not null.\n buffer = String.fromCharCode(code)\n return tagName\n }\n\n return nok(code)\n }\n\n /**\n * After ` | \n * ^\n * > | \n * ^\n * > | &<]]>\n * ^\n * ```\n *\n * @type {State}\n */\n function declarationOpen(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.dash) {\n effects.consume(code)\n marker = micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.constants.htmlComment\n return commentOpenInside\n }\n\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.leftSquareBracket) {\n effects.consume(code)\n marker = micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.constants.htmlCdata\n index = 0\n return cdataOpenInside\n }\n\n // ASCII alphabetical.\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.asciiAlpha)(code)) {\n effects.consume(code)\n marker = micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.constants.htmlDeclaration\n // // Do not form containers.\n // tokenizer.concrete = true\n return self.interrupt ? ok : continuationDeclarationInside\n }\n\n return nok(code)\n }\n\n /**\n * After ` | \n * ^\n * ```\n *\n * @type {State}\n */\n function commentOpenInside(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.dash) {\n effects.consume(code)\n // // Do not form containers.\n // tokenizer.concrete = true\n return self.interrupt ? ok : continuationDeclarationInside\n }\n\n return nok(code)\n }\n\n /**\n * After ` | &<]]>\n * ^^^^^^\n * ```\n *\n * @type {State}\n */\n function cdataOpenInside(code) {\n const value = micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.constants.cdataOpeningString\n\n if (code === value.charCodeAt(index++)) {\n effects.consume(code)\n\n if (index === value.length) {\n // // Do not form containers.\n // tokenizer.concrete = true\n return self.interrupt ? ok : continuation\n }\n\n return cdataOpenInside\n }\n\n return nok(code)\n }\n\n /**\n * After ` | \n * ^\n * ```\n *\n * @type {State}\n */\n function tagCloseStart(code) {\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.asciiAlpha)(code)) {\n effects.consume(code)\n // @ts-expect-error: not null.\n buffer = String.fromCharCode(code)\n return tagName\n }\n\n return nok(code)\n }\n\n /**\n * In tag name.\n *\n * ```markdown\n * > | \n * ^^\n * > | \n * ^^\n * ```\n *\n * @type {State}\n */\n function tagName(code) {\n if (\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.eof ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.slash ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.greaterThan ||\n (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.markdownLineEndingOrSpace)(code)\n ) {\n const slash = code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.slash\n const name = buffer.toLowerCase()\n\n if (!slash && !closingTag && micromark_util_html_tag_name__WEBPACK_IMPORTED_MODULE_5__.htmlRawNames.includes(name)) {\n marker = micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.constants.htmlRaw\n // // Do not form containers.\n // tokenizer.concrete = true\n return self.interrupt ? ok(code) : continuation(code)\n }\n\n if (micromark_util_html_tag_name__WEBPACK_IMPORTED_MODULE_5__.htmlBlockNames.includes(buffer.toLowerCase())) {\n marker = micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.constants.htmlBasic\n\n if (slash) {\n effects.consume(code)\n return basicSelfClosing\n }\n\n // // Do not form containers.\n // tokenizer.concrete = true\n return self.interrupt ? ok(code) : continuation(code)\n }\n\n marker = micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.constants.htmlComplete\n // Do not support complete HTML when interrupting.\n return self.interrupt && !self.parser.lazy[self.now().line]\n ? nok(code)\n : closingTag\n ? completeClosingTagAfter(code)\n : completeAttributeNameBefore(code)\n }\n\n // ASCII alphanumerical and `-`.\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.dash || (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.asciiAlphanumeric)(code)) {\n effects.consume(code)\n buffer += String.fromCharCode(code)\n return tagName\n }\n\n return nok(code)\n }\n\n /**\n * After closing slash of a basic tag name.\n *\n * ```markdown\n * > |
\n * ^\n * ```\n *\n * @type {State}\n */\n function basicSelfClosing(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.greaterThan) {\n effects.consume(code)\n // // Do not form containers.\n // tokenizer.concrete = true\n return self.interrupt ? ok : continuation\n }\n\n return nok(code)\n }\n\n /**\n * After closing slash of a complete tag name.\n *\n * ```markdown\n * > | \n * ^\n * ```\n *\n * @type {State}\n */\n function completeClosingTagAfter(code) {\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.markdownSpace)(code)) {\n effects.consume(code)\n return completeClosingTagAfter\n }\n\n return completeEnd(code)\n }\n\n /**\n * At an attribute name.\n *\n * At first, this state is used after a complete tag name, after whitespace,\n * where it expects optional attributes or the end of the tag.\n * It is also reused after attributes, when expecting more optional\n * attributes.\n *\n * ```markdown\n * > | \n * ^\n * > | \n * ^\n * > | \n * ^\n * > | \n * ^\n * > | \n * ^\n * ```\n *\n * @type {State}\n */\n function completeAttributeNameBefore(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.slash) {\n effects.consume(code)\n return completeEnd\n }\n\n // ASCII alphanumerical and `:` and `_`.\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.colon || code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.underscore || (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.asciiAlpha)(code)) {\n effects.consume(code)\n return completeAttributeName\n }\n\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.markdownSpace)(code)) {\n effects.consume(code)\n return completeAttributeNameBefore\n }\n\n return completeEnd(code)\n }\n\n /**\n * In attribute name.\n *\n * ```markdown\n * > | \n * ^\n * > | \n * ^\n * > | \n * ^\n * ```\n *\n * @type {State}\n */\n function completeAttributeName(code) {\n // ASCII alphanumerical and `-`, `.`, `:`, and `_`.\n if (\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.dash ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.dot ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.colon ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.underscore ||\n (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.asciiAlphanumeric)(code)\n ) {\n effects.consume(code)\n return completeAttributeName\n }\n\n return completeAttributeNameAfter(code)\n }\n\n /**\n * After attribute name, at an optional initializer, the end of the tag, or\n * whitespace.\n *\n * ```markdown\n * > | \n * ^\n * > | \n * ^\n * ```\n *\n * @type {State}\n */\n function completeAttributeNameAfter(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.equalsTo) {\n effects.consume(code)\n return completeAttributeValueBefore\n }\n\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.markdownSpace)(code)) {\n effects.consume(code)\n return completeAttributeNameAfter\n }\n\n return completeAttributeNameBefore(code)\n }\n\n /**\n * Before unquoted, double quoted, or single quoted attribute value, allowing\n * whitespace.\n *\n * ```markdown\n * > | \n * ^\n * > | \n * ^\n * ```\n *\n * @type {State}\n */\n function completeAttributeValueBefore(code) {\n if (\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.eof ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.lessThan ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.equalsTo ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.greaterThan ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.graveAccent\n ) {\n return nok(code)\n }\n\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.quotationMark || code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.apostrophe) {\n effects.consume(code)\n markerB = code\n return completeAttributeValueQuoted\n }\n\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.markdownSpace)(code)) {\n effects.consume(code)\n return completeAttributeValueBefore\n }\n\n return completeAttributeValueUnquoted(code)\n }\n\n /**\n * In double or single quoted attribute value.\n *\n * ```markdown\n * > | \n * ^\n * > | \n * ^\n * ```\n *\n * @type {State}\n */\n function completeAttributeValueQuoted(code) {\n if (code === markerB) {\n effects.consume(code)\n markerB = null\n return completeAttributeValueQuotedAfter\n }\n\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.eof || (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.markdownLineEnding)(code)) {\n return nok(code)\n }\n\n effects.consume(code)\n return completeAttributeValueQuoted\n }\n\n /**\n * In unquoted attribute value.\n *\n * ```markdown\n * > | \n * ^\n * ```\n *\n * @type {State}\n */\n function completeAttributeValueUnquoted(code) {\n if (\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.eof ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.quotationMark ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.apostrophe ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.slash ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.lessThan ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.equalsTo ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.greaterThan ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.graveAccent ||\n (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.markdownLineEndingOrSpace)(code)\n ) {\n return completeAttributeNameAfter(code)\n }\n\n effects.consume(code)\n return completeAttributeValueUnquoted\n }\n\n /**\n * After double or single quoted attribute value, before whitespace or the\n * end of the tag.\n *\n * ```markdown\n * > | \n * ^\n * ```\n *\n * @type {State}\n */\n function completeAttributeValueQuotedAfter(code) {\n if (\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.slash ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.greaterThan ||\n (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.markdownSpace)(code)\n ) {\n return completeAttributeNameBefore(code)\n }\n\n return nok(code)\n }\n\n /**\n * In certain circumstances of a complete tag where only an `>` is allowed.\n *\n * ```markdown\n * > | \n * ^\n * ```\n *\n * @type {State}\n */\n function completeEnd(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.greaterThan) {\n effects.consume(code)\n return completeAfter\n }\n\n return nok(code)\n }\n\n /**\n * After `>` in a complete tag.\n *\n * ```markdown\n * > | \n * ^\n * ```\n *\n * @type {State}\n */\n function completeAfter(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.eof || (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.markdownLineEnding)(code)) {\n // // Do not form containers.\n // tokenizer.concrete = true\n return continuation(code)\n }\n\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.markdownSpace)(code)) {\n effects.consume(code)\n return completeAfter\n }\n\n return nok(code)\n }\n\n /**\n * In continuation of any HTML kind.\n *\n * ```markdown\n * > | \n * ^\n * ```\n *\n * @type {State}\n */\n function continuation(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.dash && marker === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.constants.htmlComment) {\n effects.consume(code)\n return continuationCommentInside\n }\n\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.lessThan && marker === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.constants.htmlRaw) {\n effects.consume(code)\n return continuationRawTagOpen\n }\n\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.greaterThan && marker === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.constants.htmlDeclaration) {\n effects.consume(code)\n return continuationClose\n }\n\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.questionMark && marker === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.constants.htmlInstruction) {\n effects.consume(code)\n return continuationDeclarationInside\n }\n\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.rightSquareBracket && marker === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.constants.htmlCdata) {\n effects.consume(code)\n return continuationCdataInside\n }\n\n if (\n (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.markdownLineEnding)(code) &&\n (marker === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.constants.htmlBasic || marker === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.constants.htmlComplete)\n ) {\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.htmlFlowData)\n return effects.check(\n blankLineBefore,\n continuationAfter,\n continuationStart\n )(code)\n }\n\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.eof || (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.markdownLineEnding)(code)) {\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.htmlFlowData)\n return continuationStart(code)\n }\n\n effects.consume(code)\n return continuation\n }\n\n /**\n * In continuation, at eol.\n *\n * ```markdown\n * > | \n * ^\n * | asd\n * ```\n *\n * @type {State}\n */\n function continuationStart(code) {\n return effects.check(\n nonLazyContinuationStart,\n continuationStartNonLazy,\n continuationAfter\n )(code)\n }\n\n /**\n * In continuation, at eol, before non-lazy content.\n *\n * ```markdown\n * > | \n * ^\n * | asd\n * ```\n *\n * @type {State}\n */\n function continuationStartNonLazy(code) {\n (0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.markdownLineEnding)(code))\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.lineEnding)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.lineEnding)\n return continuationBefore\n }\n\n /**\n * In continuation, before non-lazy content.\n *\n * ```markdown\n * | \n * > | asd\n * ^\n * ```\n *\n * @type {State}\n */\n function continuationBefore(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.eof || (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.markdownLineEnding)(code)) {\n return continuationStart(code)\n }\n\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.htmlFlowData)\n return continuation(code)\n }\n\n /**\n * In comment continuation, after one `-`, expecting another.\n *\n * ```markdown\n * > | \n * ^\n * ```\n *\n * @type {State}\n */\n function continuationCommentInside(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.dash) {\n effects.consume(code)\n return continuationDeclarationInside\n }\n\n return continuation(code)\n }\n\n /**\n * In raw continuation, after `<`, at `/`.\n *\n * ```markdown\n * > | \n * ^\n * ```\n *\n * @type {State}\n */\n function continuationRawTagOpen(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.slash) {\n effects.consume(code)\n buffer = ''\n return continuationRawEndTag\n }\n\n return continuation(code)\n }\n\n /**\n * In raw continuation, after ` | \n * ^^^^^^\n * ```\n *\n * @type {State}\n */\n function continuationRawEndTag(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.greaterThan) {\n const name = buffer.toLowerCase()\n\n if (micromark_util_html_tag_name__WEBPACK_IMPORTED_MODULE_5__.htmlRawNames.includes(name)) {\n effects.consume(code)\n return continuationClose\n }\n\n return continuation(code)\n }\n\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.asciiAlpha)(code) && buffer.length < micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.constants.htmlRawSizeMax) {\n effects.consume(code)\n // @ts-expect-error: not null.\n buffer += String.fromCharCode(code)\n return continuationRawEndTag\n }\n\n return continuation(code)\n }\n\n /**\n * In cdata continuation, after `]`, expecting `]>`.\n *\n * ```markdown\n * > | &<]]>\n * ^\n * ```\n *\n * @type {State}\n */\n function continuationCdataInside(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.rightSquareBracket) {\n effects.consume(code)\n return continuationDeclarationInside\n }\n\n return continuation(code)\n }\n\n /**\n * In declaration or instruction continuation, at `>`.\n *\n * ```markdown\n * > | \n * ^\n * > | \n * ^\n * > | \n * ^\n * > | \n * ^\n * > | &<]]>\n * ^\n * ```\n *\n * @type {State}\n */\n function continuationDeclarationInside(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.greaterThan) {\n effects.consume(code)\n return continuationClose\n }\n\n // More dashes.\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.dash && marker === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.constants.htmlComment) {\n effects.consume(code)\n return continuationDeclarationInside\n }\n\n return continuation(code)\n }\n\n /**\n * In closed continuation: everything we get until the eol/eof is part of it.\n *\n * ```markdown\n * > | \n * ^\n * ```\n *\n * @type {State}\n */\n function continuationClose(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.eof || (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.markdownLineEnding)(code)) {\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.htmlFlowData)\n return continuationAfter(code)\n }\n\n effects.consume(code)\n return continuationClose\n }\n\n /**\n * Done.\n *\n * ```markdown\n * > | \n * ^\n * ```\n *\n * @type {State}\n */\n function continuationAfter(code) {\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.htmlFlow)\n // // Feel free to interrupt.\n // tokenizer.interrupt = false\n // // No longer concrete.\n // tokenizer.concrete = false\n return ok(code)\n }\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeNonLazyContinuationStart(effects, ok, nok) {\n const self = this\n\n return start\n\n /**\n * At eol, before continuation.\n *\n * ```markdown\n * > | * ```js\n * ^\n * | b\n * ```\n *\n * @type {State}\n */\n function start(code) {\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.markdownLineEnding)(code)) {\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.lineEnding)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.lineEnding)\n return after\n }\n\n return nok(code)\n }\n\n /**\n * A continuation.\n *\n * ```markdown\n * | * ```js\n * > | b\n * ^\n * ```\n *\n * @type {State}\n */\n function after(code) {\n return self.parser.lazy[self.now().line] ? nok(code) : ok(code)\n }\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeBlankLineBefore(effects, ok, nok) {\n return start\n\n /**\n * Before eol, expecting blank line.\n *\n * ```markdown\n * > |
\n * ^\n * |\n * ```\n *\n * @type {State}\n */\n function start(code) {\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.markdownLineEnding)(code), 'expected a line ending')\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.lineEnding)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.lineEnding)\n return effects.attempt(_blank_line_js__WEBPACK_IMPORTED_MODULE_6__.blankLine, ok, nok)\n }\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-core-commonmark/dev/lib/html-flow.js?"); /***/ }), /***/ "./node_modules/micromark-core-commonmark/dev/lib/html-text.js": /*!*********************************************************************!*\ !*** ./node_modules/micromark-core-commonmark/dev/lib/html-text.js ***! \*********************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ htmlText: () => (/* binding */ htmlText)\n/* harmony export */ });\n/* harmony import */ var micromark_factory_space__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! micromark-factory-space */ \"./node_modules/micromark-factory-space/dev/index.js\");\n/* harmony import */ var micromark_util_character__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! micromark-util-character */ \"./node_modules/micromark-util-character/dev/index.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/codes.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/types.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/constants.js\");\n/* harmony import */ var devlop__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! devlop */ \"./node_modules/devlop/lib/development.js\");\n/**\n * @typedef {import('micromark-util-types').Code} Code\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n */\n\n\n\n\n\n\n/** @type {Construct} */\nconst htmlText = {name: 'htmlText', tokenize: tokenizeHtmlText}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeHtmlText(effects, ok, nok) {\n const self = this\n /** @type {NonNullable | undefined} */\n let marker\n /** @type {number} */\n let index\n /** @type {State} */\n let returnState\n\n return start\n\n /**\n * Start of HTML (text).\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_0__.ok)(code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.lessThan, 'expected `<`')\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.htmlText)\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.htmlTextData)\n effects.consume(code)\n return open\n }\n\n /**\n * After `<`, at tag name or other stuff.\n *\n * ```markdown\n * > | a c\n * ^\n * > | a c\n * ^\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function open(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.exclamationMark) {\n effects.consume(code)\n return declarationOpen\n }\n\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.slash) {\n effects.consume(code)\n return tagCloseStart\n }\n\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.questionMark) {\n effects.consume(code)\n return instruction\n }\n\n // ASCII alphabetical.\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.asciiAlpha)(code)) {\n effects.consume(code)\n return tagOpen\n }\n\n return nok(code)\n }\n\n /**\n * After ` | a c\n * ^\n * > | a c\n * ^\n * > | a &<]]> c\n * ^\n * ```\n *\n * @type {State}\n */\n function declarationOpen(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.dash) {\n effects.consume(code)\n return commentOpenInside\n }\n\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.leftSquareBracket) {\n effects.consume(code)\n index = 0\n return cdataOpenInside\n }\n\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.asciiAlpha)(code)) {\n effects.consume(code)\n return declaration\n }\n\n return nok(code)\n }\n\n /**\n * In a comment, after ` | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function commentOpenInside(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.dash) {\n effects.consume(code)\n return commentEnd\n }\n\n return nok(code)\n }\n\n /**\n * In comment.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function comment(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.eof) {\n return nok(code)\n }\n\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.dash) {\n effects.consume(code)\n return commentClose\n }\n\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.markdownLineEnding)(code)) {\n returnState = comment\n return lineEndingBefore(code)\n }\n\n effects.consume(code)\n return comment\n }\n\n /**\n * In comment, after `-`.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function commentClose(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.dash) {\n effects.consume(code)\n return commentEnd\n }\n\n return comment(code)\n }\n\n /**\n * In comment, after `--`.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function commentEnd(code) {\n return code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.greaterThan\n ? end(code)\n : code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.dash\n ? commentClose(code)\n : comment(code)\n }\n\n /**\n * After ` | a &<]]> b\n * ^^^^^^\n * ```\n *\n * @type {State}\n */\n function cdataOpenInside(code) {\n const value = micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.constants.cdataOpeningString\n\n if (code === value.charCodeAt(index++)) {\n effects.consume(code)\n return index === value.length ? cdata : cdataOpenInside\n }\n\n return nok(code)\n }\n\n /**\n * In CDATA.\n *\n * ```markdown\n * > | a &<]]> b\n * ^^^\n * ```\n *\n * @type {State}\n */\n function cdata(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.eof) {\n return nok(code)\n }\n\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.rightSquareBracket) {\n effects.consume(code)\n return cdataClose\n }\n\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.markdownLineEnding)(code)) {\n returnState = cdata\n return lineEndingBefore(code)\n }\n\n effects.consume(code)\n return cdata\n }\n\n /**\n * In CDATA, after `]`, at another `]`.\n *\n * ```markdown\n * > | a &<]]> b\n * ^\n * ```\n *\n * @type {State}\n */\n function cdataClose(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.rightSquareBracket) {\n effects.consume(code)\n return cdataEnd\n }\n\n return cdata(code)\n }\n\n /**\n * In CDATA, after `]]`, at `>`.\n *\n * ```markdown\n * > | a &<]]> b\n * ^\n * ```\n *\n * @type {State}\n */\n function cdataEnd(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.greaterThan) {\n return end(code)\n }\n\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.rightSquareBracket) {\n effects.consume(code)\n return cdataEnd\n }\n\n return cdata(code)\n }\n\n /**\n * In declaration.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function declaration(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.eof || code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.greaterThan) {\n return end(code)\n }\n\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.markdownLineEnding)(code)) {\n returnState = declaration\n return lineEndingBefore(code)\n }\n\n effects.consume(code)\n return declaration\n }\n\n /**\n * In instruction.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function instruction(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.eof) {\n return nok(code)\n }\n\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.questionMark) {\n effects.consume(code)\n return instructionClose\n }\n\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.markdownLineEnding)(code)) {\n returnState = instruction\n return lineEndingBefore(code)\n }\n\n effects.consume(code)\n return instruction\n }\n\n /**\n * In instruction, after `?`, at `>`.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function instructionClose(code) {\n return code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.greaterThan ? end(code) : instruction(code)\n }\n\n /**\n * After ` | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function tagCloseStart(code) {\n // ASCII alphabetical.\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.asciiAlpha)(code)) {\n effects.consume(code)\n return tagClose\n }\n\n return nok(code)\n }\n\n /**\n * After ` | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function tagClose(code) {\n // ASCII alphanumerical and `-`.\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.dash || (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.asciiAlphanumeric)(code)) {\n effects.consume(code)\n return tagClose\n }\n\n return tagCloseBetween(code)\n }\n\n /**\n * In closing tag, after tag name.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function tagCloseBetween(code) {\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.markdownLineEnding)(code)) {\n returnState = tagCloseBetween\n return lineEndingBefore(code)\n }\n\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.markdownSpace)(code)) {\n effects.consume(code)\n return tagCloseBetween\n }\n\n return end(code)\n }\n\n /**\n * After ` | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpen(code) {\n // ASCII alphanumerical and `-`.\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.dash || (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.asciiAlphanumeric)(code)) {\n effects.consume(code)\n return tagOpen\n }\n\n if (\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.slash ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.greaterThan ||\n (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.markdownLineEndingOrSpace)(code)\n ) {\n return tagOpenBetween(code)\n }\n\n return nok(code)\n }\n\n /**\n * In opening tag, after tag name.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenBetween(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.slash) {\n effects.consume(code)\n return end\n }\n\n // ASCII alphabetical and `:` and `_`.\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.colon || code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.underscore || (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.asciiAlpha)(code)) {\n effects.consume(code)\n return tagOpenAttributeName\n }\n\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.markdownLineEnding)(code)) {\n returnState = tagOpenBetween\n return lineEndingBefore(code)\n }\n\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.markdownSpace)(code)) {\n effects.consume(code)\n return tagOpenBetween\n }\n\n return end(code)\n }\n\n /**\n * In attribute name.\n *\n * ```markdown\n * > | a d\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenAttributeName(code) {\n // ASCII alphabetical and `-`, `.`, `:`, and `_`.\n if (\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.dash ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.dot ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.colon ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.underscore ||\n (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.asciiAlphanumeric)(code)\n ) {\n effects.consume(code)\n return tagOpenAttributeName\n }\n\n return tagOpenAttributeNameAfter(code)\n }\n\n /**\n * After attribute name, before initializer, the end of the tag, or\n * whitespace.\n *\n * ```markdown\n * > | a d\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenAttributeNameAfter(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.equalsTo) {\n effects.consume(code)\n return tagOpenAttributeValueBefore\n }\n\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.markdownLineEnding)(code)) {\n returnState = tagOpenAttributeNameAfter\n return lineEndingBefore(code)\n }\n\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.markdownSpace)(code)) {\n effects.consume(code)\n return tagOpenAttributeNameAfter\n }\n\n return tagOpenBetween(code)\n }\n\n /**\n * Before unquoted, double quoted, or single quoted attribute value, allowing\n * whitespace.\n *\n * ```markdown\n * > | a e\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenAttributeValueBefore(code) {\n if (\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.eof ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.lessThan ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.equalsTo ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.greaterThan ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.graveAccent\n ) {\n return nok(code)\n }\n\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.quotationMark || code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.apostrophe) {\n effects.consume(code)\n marker = code\n return tagOpenAttributeValueQuoted\n }\n\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.markdownLineEnding)(code)) {\n returnState = tagOpenAttributeValueBefore\n return lineEndingBefore(code)\n }\n\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.markdownSpace)(code)) {\n effects.consume(code)\n return tagOpenAttributeValueBefore\n }\n\n effects.consume(code)\n return tagOpenAttributeValueUnquoted\n }\n\n /**\n * In double or single quoted attribute value.\n *\n * ```markdown\n * > | a e\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenAttributeValueQuoted(code) {\n if (code === marker) {\n effects.consume(code)\n marker = undefined\n return tagOpenAttributeValueQuotedAfter\n }\n\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.eof) {\n return nok(code)\n }\n\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.markdownLineEnding)(code)) {\n returnState = tagOpenAttributeValueQuoted\n return lineEndingBefore(code)\n }\n\n effects.consume(code)\n return tagOpenAttributeValueQuoted\n }\n\n /**\n * In unquoted attribute value.\n *\n * ```markdown\n * > | a e\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenAttributeValueUnquoted(code) {\n if (\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.eof ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.quotationMark ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.apostrophe ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.lessThan ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.equalsTo ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.graveAccent\n ) {\n return nok(code)\n }\n\n if (\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.slash ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.greaterThan ||\n (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.markdownLineEndingOrSpace)(code)\n ) {\n return tagOpenBetween(code)\n }\n\n effects.consume(code)\n return tagOpenAttributeValueUnquoted\n }\n\n /**\n * After double or single quoted attribute value, before whitespace or the end\n * of the tag.\n *\n * ```markdown\n * > | a e\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenAttributeValueQuotedAfter(code) {\n if (\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.slash ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.greaterThan ||\n (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.markdownLineEndingOrSpace)(code)\n ) {\n return tagOpenBetween(code)\n }\n\n return nok(code)\n }\n\n /**\n * In certain circumstances of a tag where only an `>` is allowed.\n *\n * ```markdown\n * > | a e\n * ^\n * ```\n *\n * @type {State}\n */\n function end(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.greaterThan) {\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.htmlTextData)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.htmlText)\n return ok\n }\n\n return nok(code)\n }\n\n /**\n * At eol.\n *\n * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about\n * > empty tokens.\n *\n * ```markdown\n * > | a \n * ```\n *\n * @type {State}\n */\n function lineEndingBefore(code) {\n (0,devlop__WEBPACK_IMPORTED_MODULE_0__.ok)(returnState, 'expected return state')\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_0__.ok)((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.markdownLineEnding)(code), 'expected eol')\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.htmlTextData)\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.lineEnding)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.lineEnding)\n return lineEndingAfter\n }\n\n /**\n * After eol, at optional whitespace.\n *\n * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about\n * > empty tokens.\n *\n * ```markdown\n * | a \n * ^\n * ```\n *\n * @type {State}\n */\n function lineEndingAfter(code) {\n // Always populated by defaults.\n (0,devlop__WEBPACK_IMPORTED_MODULE_0__.ok)(\n self.parser.constructs.disable.null,\n 'expected `disable.null` to be populated'\n )\n return (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.markdownSpace)(code)\n ? (0,micromark_factory_space__WEBPACK_IMPORTED_MODULE_5__.factorySpace)(\n effects,\n lineEndingAfterPrefix,\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.linePrefix,\n self.parser.constructs.disable.null.includes('codeIndented')\n ? undefined\n : micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.constants.tabSize\n )(code)\n : lineEndingAfterPrefix(code)\n }\n\n /**\n * After eol, after optional whitespace.\n *\n * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about\n * > empty tokens.\n *\n * ```markdown\n * | a \n * ^\n * ```\n *\n * @type {State}\n */\n function lineEndingAfterPrefix(code) {\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.htmlTextData)\n return returnState(code)\n }\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-core-commonmark/dev/lib/html-text.js?"); /***/ }), /***/ "./node_modules/micromark-core-commonmark/dev/lib/label-end.js": /*!*********************************************************************!*\ !*** ./node_modules/micromark-core-commonmark/dev/lib/label-end.js ***! \*********************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ labelEnd: () => (/* binding */ labelEnd)\n/* harmony export */ });\n/* harmony import */ var micromark_factory_destination__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! micromark-factory-destination */ \"./node_modules/micromark-factory-destination/dev/index.js\");\n/* harmony import */ var micromark_factory_label__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! micromark-factory-label */ \"./node_modules/micromark-factory-label/dev/index.js\");\n/* harmony import */ var micromark_factory_title__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! micromark-factory-title */ \"./node_modules/micromark-factory-title/dev/index.js\");\n/* harmony import */ var micromark_factory_whitespace__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! micromark-factory-whitespace */ \"./node_modules/micromark-factory-whitespace/dev/index.js\");\n/* harmony import */ var micromark_util_character__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! micromark-util-character */ \"./node_modules/micromark-util-character/dev/index.js\");\n/* harmony import */ var micromark_util_chunked__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! micromark-util-chunked */ \"./node_modules/micromark-util-chunked/dev/index.js\");\n/* harmony import */ var micromark_util_normalize_identifier__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! micromark-util-normalize-identifier */ \"./node_modules/micromark-util-normalize-identifier/dev/index.js\");\n/* harmony import */ var micromark_util_resolve_all__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! micromark-util-resolve-all */ \"./node_modules/micromark-util-resolve-all/index.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/types.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/codes.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/constants.js\");\n/* harmony import */ var devlop__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! devlop */ \"./node_modules/devlop/lib/development.js\");\n/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Event} Event\n * @typedef {import('micromark-util-types').Resolver} Resolver\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n */\n\n\n\n\n\n\n\n\n\n\n\n\n/** @type {Construct} */\nconst labelEnd = {\n name: 'labelEnd',\n tokenize: tokenizeLabelEnd,\n resolveTo: resolveToLabelEnd,\n resolveAll: resolveAllLabelEnd\n}\n\n/** @type {Construct} */\nconst resourceConstruct = {tokenize: tokenizeResource}\n/** @type {Construct} */\nconst referenceFullConstruct = {tokenize: tokenizeReferenceFull}\n/** @type {Construct} */\nconst referenceCollapsedConstruct = {tokenize: tokenizeReferenceCollapsed}\n\n/** @type {Resolver} */\nfunction resolveAllLabelEnd(events) {\n let index = -1\n\n while (++index < events.length) {\n const token = events[index][1]\n\n if (\n token.type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.labelImage ||\n token.type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.labelLink ||\n token.type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.labelEnd\n ) {\n // Remove the marker.\n events.splice(index + 1, token.type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.labelImage ? 4 : 2)\n token.type = micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.data\n index++\n }\n }\n\n return events\n}\n\n/** @type {Resolver} */\nfunction resolveToLabelEnd(events, context) {\n let index = events.length\n let offset = 0\n /** @type {Token} */\n let token\n /** @type {number | undefined} */\n let open\n /** @type {number | undefined} */\n let close\n /** @type {Array} */\n let media\n\n // Find an opening.\n while (index--) {\n token = events[index][1]\n\n if (open) {\n // If we see another link, or inactive link label, we’ve been here before.\n if (\n token.type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.link ||\n (token.type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.labelLink && token._inactive)\n ) {\n break\n }\n\n // Mark other link openings as inactive, as we can’t have links in\n // links.\n if (events[index][0] === 'enter' && token.type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.labelLink) {\n token._inactive = true\n }\n } else if (close) {\n if (\n events[index][0] === 'enter' &&\n (token.type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.labelImage || token.type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.labelLink) &&\n !token._balanced\n ) {\n open = index\n\n if (token.type !== micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.labelLink) {\n offset = 2\n break\n }\n }\n } else if (token.type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.labelEnd) {\n close = index\n }\n }\n\n (0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(open !== undefined, '`open` is supposed to be found')\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(close !== undefined, '`close` is supposed to be found')\n\n const group = {\n type: events[open][1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.labelLink ? micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.link : micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.image,\n start: Object.assign({}, events[open][1].start),\n end: Object.assign({}, events[events.length - 1][1].end)\n }\n\n const label = {\n type: micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.label,\n start: Object.assign({}, events[open][1].start),\n end: Object.assign({}, events[close][1].end)\n }\n\n const text = {\n type: micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.labelText,\n start: Object.assign({}, events[open + offset + 2][1].end),\n end: Object.assign({}, events[close - 2][1].start)\n }\n\n media = [\n ['enter', group, context],\n ['enter', label, context]\n ]\n\n // Opening marker.\n media = (0,micromark_util_chunked__WEBPACK_IMPORTED_MODULE_2__.push)(media, events.slice(open + 1, open + offset + 3))\n\n // Text open.\n media = (0,micromark_util_chunked__WEBPACK_IMPORTED_MODULE_2__.push)(media, [['enter', text, context]])\n\n // Always populated by defaults.\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(\n context.parser.constructs.insideSpan.null,\n 'expected `insideSpan.null` to be populated'\n )\n // Between.\n media = (0,micromark_util_chunked__WEBPACK_IMPORTED_MODULE_2__.push)(\n media,\n (0,micromark_util_resolve_all__WEBPACK_IMPORTED_MODULE_3__.resolveAll)(\n context.parser.constructs.insideSpan.null,\n events.slice(open + offset + 4, close - 3),\n context\n )\n )\n\n // Text close, marker close, label close.\n media = (0,micromark_util_chunked__WEBPACK_IMPORTED_MODULE_2__.push)(media, [\n ['exit', text, context],\n events[close - 2],\n events[close - 1],\n ['exit', label, context]\n ])\n\n // Reference, resource, or so.\n media = (0,micromark_util_chunked__WEBPACK_IMPORTED_MODULE_2__.push)(media, events.slice(close + 1))\n\n // Media close.\n media = (0,micromark_util_chunked__WEBPACK_IMPORTED_MODULE_2__.push)(media, [['exit', group, context]])\n\n ;(0,micromark_util_chunked__WEBPACK_IMPORTED_MODULE_2__.splice)(events, open, events.length, media)\n\n return events\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeLabelEnd(effects, ok, nok) {\n const self = this\n let index = self.events.length\n /** @type {Token} */\n let labelStart\n /** @type {boolean} */\n let defined\n\n // Find an opening.\n while (index--) {\n if (\n (self.events[index][1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.labelImage ||\n self.events[index][1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.labelLink) &&\n !self.events[index][1]._balanced\n ) {\n labelStart = self.events[index][1]\n break\n }\n }\n\n return start\n\n /**\n * Start of label end.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * > | [a][b] c\n * ^\n * > | [a][] b\n * ^\n * > | [a] b\n * ```\n *\n * @type {State}\n */\n function start(code) {\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.codes.rightSquareBracket, 'expected `]`')\n\n // If there is not an okay opening.\n if (!labelStart) {\n return nok(code)\n }\n\n // If the corresponding label (link) start is marked as inactive,\n // it means we’d be wrapping a link, like this:\n //\n // ```markdown\n // > | a [b [c](d) e](f) g.\n // ^\n // ```\n //\n // We can’t have that, so it’s just balanced brackets.\n if (labelStart._inactive) {\n return labelEndNok(code)\n }\n\n defined = self.parser.defined.includes(\n (0,micromark_util_normalize_identifier__WEBPACK_IMPORTED_MODULE_5__.normalizeIdentifier)(\n self.sliceSerialize({start: labelStart.end, end: self.now()})\n )\n )\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.labelEnd)\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.labelMarker)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.labelMarker)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.labelEnd)\n return after\n }\n\n /**\n * After `]`.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * > | [a][b] c\n * ^\n * > | [a][] b\n * ^\n * > | [a] b\n * ^\n * ```\n *\n * @type {State}\n */\n function after(code) {\n // Note: `markdown-rs` also parses GFM footnotes here, which for us is in\n // an extension.\n\n // Resource (`[asd](fgh)`)?\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.codes.leftParenthesis) {\n return effects.attempt(\n resourceConstruct,\n labelEndOk,\n defined ? labelEndOk : labelEndNok\n )(code)\n }\n\n // Full (`[asd][fgh]`) or collapsed (`[asd][]`) reference?\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.codes.leftSquareBracket) {\n return effects.attempt(\n referenceFullConstruct,\n labelEndOk,\n defined ? referenceNotFull : labelEndNok\n )(code)\n }\n\n // Shortcut (`[asd]`) reference?\n return defined ? labelEndOk(code) : labelEndNok(code)\n }\n\n /**\n * After `]`, at `[`, but not at a full reference.\n *\n * > 👉 **Note**: we only get here if the label is defined.\n *\n * ```markdown\n * > | [a][] b\n * ^\n * > | [a] b\n * ^\n * ```\n *\n * @type {State}\n */\n function referenceNotFull(code) {\n return effects.attempt(\n referenceCollapsedConstruct,\n labelEndOk,\n labelEndNok\n )(code)\n }\n\n /**\n * Done, we found something.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * > | [a][b] c\n * ^\n * > | [a][] b\n * ^\n * > | [a] b\n * ^\n * ```\n *\n * @type {State}\n */\n function labelEndOk(code) {\n // Note: `markdown-rs` does a bunch of stuff here.\n return ok(code)\n }\n\n /**\n * Done, it’s nothing.\n *\n * There was an okay opening, but we didn’t match anything.\n *\n * ```markdown\n * > | [a](b c\n * ^\n * > | [a][b c\n * ^\n * > | [a] b\n * ^\n * ```\n *\n * @type {State}\n */\n function labelEndNok(code) {\n labelStart._balanced = true\n return nok(code)\n }\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeResource(effects, ok, nok) {\n return resourceStart\n\n /**\n * At a resource.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceStart(code) {\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.codes.leftParenthesis, 'expected left paren')\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.resource)\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.resourceMarker)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.resourceMarker)\n return resourceBefore\n }\n\n /**\n * In resource, after `(`, at optional whitespace.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceBefore(code) {\n return (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_6__.markdownLineEndingOrSpace)(code)\n ? (0,micromark_factory_whitespace__WEBPACK_IMPORTED_MODULE_7__.factoryWhitespace)(effects, resourceOpen)(code)\n : resourceOpen(code)\n }\n\n /**\n * In resource, after optional whitespace, at `)` or a destination.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceOpen(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.codes.rightParenthesis) {\n return resourceEnd(code)\n }\n\n return (0,micromark_factory_destination__WEBPACK_IMPORTED_MODULE_8__.factoryDestination)(\n effects,\n resourceDestinationAfter,\n resourceDestinationMissing,\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.resourceDestination,\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.resourceDestinationLiteral,\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.resourceDestinationLiteralMarker,\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.resourceDestinationRaw,\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.resourceDestinationString,\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_9__.constants.linkResourceDestinationBalanceMax\n )(code)\n }\n\n /**\n * In resource, after destination, at optional whitespace.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceDestinationAfter(code) {\n return (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_6__.markdownLineEndingOrSpace)(code)\n ? (0,micromark_factory_whitespace__WEBPACK_IMPORTED_MODULE_7__.factoryWhitespace)(effects, resourceBetween)(code)\n : resourceEnd(code)\n }\n\n /**\n * At invalid destination.\n *\n * ```markdown\n * > | [a](<<) b\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceDestinationMissing(code) {\n return nok(code)\n }\n\n /**\n * In resource, after destination and whitespace, at `(` or title.\n *\n * ```markdown\n * > | [a](b ) c\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceBetween(code) {\n if (\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.codes.quotationMark ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.codes.apostrophe ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.codes.leftParenthesis\n ) {\n return (0,micromark_factory_title__WEBPACK_IMPORTED_MODULE_10__.factoryTitle)(\n effects,\n resourceTitleAfter,\n nok,\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.resourceTitle,\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.resourceTitleMarker,\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.resourceTitleString\n )(code)\n }\n\n return resourceEnd(code)\n }\n\n /**\n * In resource, after title, at optional whitespace.\n *\n * ```markdown\n * > | [a](b \"c\") d\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceTitleAfter(code) {\n return (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_6__.markdownLineEndingOrSpace)(code)\n ? (0,micromark_factory_whitespace__WEBPACK_IMPORTED_MODULE_7__.factoryWhitespace)(effects, resourceEnd)(code)\n : resourceEnd(code)\n }\n\n /**\n * In resource, at `)`.\n *\n * ```markdown\n * > | [a](b) d\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceEnd(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.codes.rightParenthesis) {\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.resourceMarker)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.resourceMarker)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.resource)\n return ok\n }\n\n return nok(code)\n }\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeReferenceFull(effects, ok, nok) {\n const self = this\n\n return referenceFull\n\n /**\n * In a reference (full), at the `[`.\n *\n * ```markdown\n * > | [a][b] d\n * ^\n * ```\n *\n * @type {State}\n */\n function referenceFull(code) {\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.codes.leftSquareBracket, 'expected left bracket')\n return micromark_factory_label__WEBPACK_IMPORTED_MODULE_11__.factoryLabel.call(\n self,\n effects,\n referenceFullAfter,\n referenceFullMissing,\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.reference,\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.referenceMarker,\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.referenceString\n )(code)\n }\n\n /**\n * In a reference (full), after `]`.\n *\n * ```markdown\n * > | [a][b] d\n * ^\n * ```\n *\n * @type {State}\n */\n function referenceFullAfter(code) {\n return self.parser.defined.includes(\n (0,micromark_util_normalize_identifier__WEBPACK_IMPORTED_MODULE_5__.normalizeIdentifier)(\n self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1)\n )\n )\n ? ok(code)\n : nok(code)\n }\n\n /**\n * In reference (full) that was missing.\n *\n * ```markdown\n * > | [a][b d\n * ^\n * ```\n *\n * @type {State}\n */\n function referenceFullMissing(code) {\n return nok(code)\n }\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeReferenceCollapsed(effects, ok, nok) {\n return referenceCollapsedStart\n\n /**\n * In reference (collapsed), at `[`.\n *\n * > 👉 **Note**: we only get here if the label is defined.\n *\n * ```markdown\n * > | [a][] d\n * ^\n * ```\n *\n * @type {State}\n */\n function referenceCollapsedStart(code) {\n // We only attempt a collapsed label if there’s a `[`.\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.codes.leftSquareBracket, 'expected left bracket')\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.reference)\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.referenceMarker)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.referenceMarker)\n return referenceCollapsedOpen\n }\n\n /**\n * In reference (collapsed), at `]`.\n *\n * > 👉 **Note**: we only get here if the label is defined.\n *\n * ```markdown\n * > | [a][] d\n * ^\n * ```\n *\n * @type {State}\n */\n function referenceCollapsedOpen(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.codes.rightSquareBracket) {\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.referenceMarker)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.referenceMarker)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.reference)\n return ok\n }\n\n return nok(code)\n }\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-core-commonmark/dev/lib/label-end.js?"); /***/ }), /***/ "./node_modules/micromark-core-commonmark/dev/lib/label-start-image.js": /*!*****************************************************************************!*\ !*** ./node_modules/micromark-core-commonmark/dev/lib/label-start-image.js ***! \*****************************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ labelStartImage: () => (/* binding */ labelStartImage)\n/* harmony export */ });\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/codes.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/types.js\");\n/* harmony import */ var devlop__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! devlop */ \"./node_modules/devlop/lib/development.js\");\n/* harmony import */ var _label_end_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./label-end.js */ \"./node_modules/micromark-core-commonmark/dev/lib/label-end.js\");\n/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n */\n\n\n\n\n\n/** @type {Construct} */\nconst labelStartImage = {\n name: 'labelStartImage',\n tokenize: tokenizeLabelStartImage,\n resolveAll: _label_end_js__WEBPACK_IMPORTED_MODULE_0__.labelEnd.resolveAll\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeLabelStartImage(effects, ok, nok) {\n const self = this\n\n return start\n\n /**\n * Start of label (image) start.\n *\n * ```markdown\n * > | a ![b] c\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.exclamationMark, 'expected `!`')\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.types.labelImage)\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.types.labelImageMarker)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.types.labelImageMarker)\n return open\n }\n\n /**\n * After `!`, at `[`.\n *\n * ```markdown\n * > | a ![b] c\n * ^\n * ```\n *\n * @type {State}\n */\n function open(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.leftSquareBracket) {\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.types.labelMarker)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.types.labelMarker)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.types.labelImage)\n return after\n }\n\n return nok(code)\n }\n\n /**\n * After `![`.\n *\n * ```markdown\n * > | a ![b] c\n * ^\n * ```\n *\n * This is needed in because, when GFM footnotes are enabled, images never\n * form when started with a `^`.\n * Instead, links form:\n *\n * ```markdown\n * ![^a](b)\n *\n * ![^a][b]\n *\n * [b]: c\n * ```\n *\n * ```html\n *

!^a

\n *

!^a

\n * ```\n *\n * @type {State}\n */\n function after(code) {\n // To do: use a new field to do this, this is still needed for\n // `micromark-extension-gfm-footnote`, but the `label-start-link`\n // behavior isn’t.\n // Hidden footnotes hook.\n /* c8 ignore next 3 */\n return code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.caret &&\n '_hiddenFootnoteSupport' in self.parser.constructs\n ? nok(code)\n : ok(code)\n }\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-core-commonmark/dev/lib/label-start-image.js?"); /***/ }), /***/ "./node_modules/micromark-core-commonmark/dev/lib/label-start-link.js": /*!****************************************************************************!*\ !*** ./node_modules/micromark-core-commonmark/dev/lib/label-start-link.js ***! \****************************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ labelStartLink: () => (/* binding */ labelStartLink)\n/* harmony export */ });\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/codes.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/types.js\");\n/* harmony import */ var devlop__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! devlop */ \"./node_modules/devlop/lib/development.js\");\n/* harmony import */ var _label_end_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./label-end.js */ \"./node_modules/micromark-core-commonmark/dev/lib/label-end.js\");\n/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n */\n\n\n\n\n\n/** @type {Construct} */\nconst labelStartLink = {\n name: 'labelStartLink',\n tokenize: tokenizeLabelStartLink,\n resolveAll: _label_end_js__WEBPACK_IMPORTED_MODULE_0__.labelEnd.resolveAll\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeLabelStartLink(effects, ok, nok) {\n const self = this\n\n return start\n\n /**\n * Start of label (link) start.\n *\n * ```markdown\n * > | a [b] c\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.leftSquareBracket, 'expected `[`')\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.types.labelLink)\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.types.labelMarker)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.types.labelMarker)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.types.labelLink)\n return after\n }\n\n /** @type {State} */\n function after(code) {\n // To do: this isn’t needed in `micromark-extension-gfm-footnote`,\n // remove.\n // Hidden footnotes hook.\n /* c8 ignore next 3 */\n return code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.caret &&\n '_hiddenFootnoteSupport' in self.parser.constructs\n ? nok(code)\n : ok(code)\n }\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-core-commonmark/dev/lib/label-start-link.js?"); /***/ }), /***/ "./node_modules/micromark-core-commonmark/dev/lib/line-ending.js": /*!***********************************************************************!*\ !*** ./node_modules/micromark-core-commonmark/dev/lib/line-ending.js ***! \***********************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ lineEnding: () => (/* binding */ lineEnding)\n/* harmony export */ });\n/* harmony import */ var micromark_factory_space__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! micromark-factory-space */ \"./node_modules/micromark-factory-space/dev/index.js\");\n/* harmony import */ var micromark_util_character__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! micromark-util-character */ \"./node_modules/micromark-util-character/dev/index.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/types.js\");\n/* harmony import */ var devlop__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! devlop */ \"./node_modules/devlop/lib/development.js\");\n/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n */\n\n\n\n\n\n\n/** @type {Construct} */\nconst lineEnding = {name: 'lineEnding', tokenize: tokenizeLineEnding}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeLineEnding(effects, ok) {\n return start\n\n /** @type {State} */\n function start(code) {\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_0__.ok)((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_1__.markdownLineEnding)(code), 'expected eol')\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.lineEnding)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.lineEnding)\n return (0,micromark_factory_space__WEBPACK_IMPORTED_MODULE_3__.factorySpace)(effects, ok, micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.linePrefix)\n }\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-core-commonmark/dev/lib/line-ending.js?"); /***/ }), /***/ "./node_modules/micromark-core-commonmark/dev/lib/list.js": /*!****************************************************************!*\ !*** ./node_modules/micromark-core-commonmark/dev/lib/list.js ***! \****************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ list: () => (/* binding */ list)\n/* harmony export */ });\n/* harmony import */ var micromark_factory_space__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! micromark-factory-space */ \"./node_modules/micromark-factory-space/dev/index.js\");\n/* harmony import */ var micromark_util_character__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! micromark-util-character */ \"./node_modules/micromark-util-character/dev/index.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/types.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/codes.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/constants.js\");\n/* harmony import */ var devlop__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! devlop */ \"./node_modules/devlop/lib/development.js\");\n/* harmony import */ var _blank_line_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./blank-line.js */ \"./node_modules/micromark-core-commonmark/dev/lib/blank-line.js\");\n/* harmony import */ var _thematic_break_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./thematic-break.js */ \"./node_modules/micromark-core-commonmark/dev/lib/thematic-break.js\");\n/**\n * @typedef {import('micromark-util-types').Code} Code\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').ContainerState} ContainerState\n * @typedef {import('micromark-util-types').Exiter} Exiter\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n */\n\n\n\n\n\n\n\n\n/** @type {Construct} */\nconst list = {\n name: 'list',\n tokenize: tokenizeListStart,\n continuation: {tokenize: tokenizeListContinuation},\n exit: tokenizeListEnd\n}\n\n/** @type {Construct} */\nconst listItemPrefixWhitespaceConstruct = {\n tokenize: tokenizeListItemPrefixWhitespace,\n partial: true\n}\n\n/** @type {Construct} */\nconst indentConstruct = {tokenize: tokenizeIndent, partial: true}\n\n// To do: `markdown-rs` parses list items on their own and later stitches them\n// together.\n\n/**\n * @type {Tokenizer}\n * @this {TokenizeContext}\n */\nfunction tokenizeListStart(effects, ok, nok) {\n const self = this\n const tail = self.events[self.events.length - 1]\n let initialSize =\n tail && tail[1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.linePrefix\n ? tail[2].sliceSerialize(tail[1], true).length\n : 0\n let size = 0\n\n return start\n\n /** @type {State} */\n function start(code) {\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(self.containerState, 'expected state')\n const kind =\n self.containerState.type ||\n (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.asterisk || code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.plusSign || code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.dash\n ? micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.listUnordered\n : micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.listOrdered)\n\n if (\n kind === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.listUnordered\n ? !self.containerState.marker || code === self.containerState.marker\n : (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.asciiDigit)(code)\n ) {\n if (!self.containerState.type) {\n self.containerState.type = kind\n effects.enter(kind, {_container: true})\n }\n\n if (kind === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.listUnordered) {\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.listItemPrefix)\n return code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.asterisk || code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.dash\n ? effects.check(_thematic_break_js__WEBPACK_IMPORTED_MODULE_4__.thematicBreak, nok, atMarker)(code)\n : atMarker(code)\n }\n\n if (!self.interrupt || code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.digit1) {\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.listItemPrefix)\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.listItemValue)\n return inside(code)\n }\n }\n\n return nok(code)\n }\n\n /** @type {State} */\n function inside(code) {\n (0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(self.containerState, 'expected state')\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.asciiDigit)(code) && ++size < micromark_util_symbol__WEBPACK_IMPORTED_MODULE_5__.constants.listItemValueSizeMax) {\n effects.consume(code)\n return inside\n }\n\n if (\n (!self.interrupt || size < 2) &&\n (self.containerState.marker\n ? code === self.containerState.marker\n : code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.rightParenthesis || code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.dot)\n ) {\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.listItemValue)\n return atMarker(code)\n }\n\n return nok(code)\n }\n\n /**\n * @type {State}\n **/\n function atMarker(code) {\n (0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(self.containerState, 'expected state')\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(code !== micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.eof, 'eof (`null`) is not a marker')\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.listItemMarker)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.listItemMarker)\n self.containerState.marker = self.containerState.marker || code\n return effects.check(\n _blank_line_js__WEBPACK_IMPORTED_MODULE_6__.blankLine,\n // Can’t be empty when interrupting.\n self.interrupt ? nok : onBlank,\n effects.attempt(\n listItemPrefixWhitespaceConstruct,\n endOfPrefix,\n otherPrefix\n )\n )\n }\n\n /** @type {State} */\n function onBlank(code) {\n (0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(self.containerState, 'expected state')\n self.containerState.initialBlankLine = true\n initialSize++\n return endOfPrefix(code)\n }\n\n /** @type {State} */\n function otherPrefix(code) {\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.markdownSpace)(code)) {\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.listItemPrefixWhitespace)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.listItemPrefixWhitespace)\n return endOfPrefix\n }\n\n return nok(code)\n }\n\n /** @type {State} */\n function endOfPrefix(code) {\n (0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(self.containerState, 'expected state')\n self.containerState.size =\n initialSize +\n self.sliceSerialize(effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.listItemPrefix), true).length\n return ok(code)\n }\n}\n\n/**\n * @type {Tokenizer}\n * @this {TokenizeContext}\n */\nfunction tokenizeListContinuation(effects, ok, nok) {\n const self = this\n\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(self.containerState, 'expected state')\n self.containerState._closeFlow = undefined\n\n return effects.check(_blank_line_js__WEBPACK_IMPORTED_MODULE_6__.blankLine, onBlank, notBlank)\n\n /** @type {State} */\n function onBlank(code) {\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(self.containerState, 'expected state')\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(typeof self.containerState.size === 'number', 'expected size')\n self.containerState.furtherBlankLines =\n self.containerState.furtherBlankLines ||\n self.containerState.initialBlankLine\n\n // We have a blank line.\n // Still, try to consume at most the items size.\n return (0,micromark_factory_space__WEBPACK_IMPORTED_MODULE_7__.factorySpace)(\n effects,\n ok,\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.listItemIndent,\n self.containerState.size + 1\n )(code)\n }\n\n /** @type {State} */\n function notBlank(code) {\n (0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(self.containerState, 'expected state')\n if (self.containerState.furtherBlankLines || !(0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.markdownSpace)(code)) {\n self.containerState.furtherBlankLines = undefined\n self.containerState.initialBlankLine = undefined\n return notInCurrentItem(code)\n }\n\n self.containerState.furtherBlankLines = undefined\n self.containerState.initialBlankLine = undefined\n return effects.attempt(indentConstruct, ok, notInCurrentItem)(code)\n }\n\n /** @type {State} */\n function notInCurrentItem(code) {\n (0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(self.containerState, 'expected state')\n // While we do continue, we signal that the flow should be closed.\n self.containerState._closeFlow = true\n // As we’re closing flow, we’re no longer interrupting.\n self.interrupt = undefined\n // Always populated by defaults.\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(\n self.parser.constructs.disable.null,\n 'expected `disable.null` to be populated'\n )\n return (0,micromark_factory_space__WEBPACK_IMPORTED_MODULE_7__.factorySpace)(\n effects,\n effects.attempt(list, ok, nok),\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.linePrefix,\n self.parser.constructs.disable.null.includes('codeIndented')\n ? undefined\n : micromark_util_symbol__WEBPACK_IMPORTED_MODULE_5__.constants.tabSize\n )(code)\n }\n}\n\n/**\n * @type {Tokenizer}\n * @this {TokenizeContext}\n */\nfunction tokenizeIndent(effects, ok, nok) {\n const self = this\n\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(self.containerState, 'expected state')\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(typeof self.containerState.size === 'number', 'expected size')\n\n return (0,micromark_factory_space__WEBPACK_IMPORTED_MODULE_7__.factorySpace)(\n effects,\n afterPrefix,\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.listItemIndent,\n self.containerState.size + 1\n )\n\n /** @type {State} */\n function afterPrefix(code) {\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(self.containerState, 'expected state')\n const tail = self.events[self.events.length - 1]\n return tail &&\n tail[1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.listItemIndent &&\n tail[2].sliceSerialize(tail[1], true).length === self.containerState.size\n ? ok(code)\n : nok(code)\n }\n}\n\n/**\n * @type {Exiter}\n * @this {TokenizeContext}\n */\nfunction tokenizeListEnd(effects) {\n (0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(this.containerState, 'expected state')\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(typeof this.containerState.type === 'string', 'expected type')\n effects.exit(this.containerState.type)\n}\n\n/**\n * @type {Tokenizer}\n * @this {TokenizeContext}\n */\nfunction tokenizeListItemPrefixWhitespace(effects, ok, nok) {\n const self = this\n\n // Always populated by defaults.\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(\n self.parser.constructs.disable.null,\n 'expected `disable.null` to be populated'\n )\n\n return (0,micromark_factory_space__WEBPACK_IMPORTED_MODULE_7__.factorySpace)(\n effects,\n afterPrefix,\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.listItemPrefixWhitespace,\n self.parser.constructs.disable.null.includes('codeIndented')\n ? undefined\n : micromark_util_symbol__WEBPACK_IMPORTED_MODULE_5__.constants.tabSize + 1\n )\n\n /** @type {State} */\n function afterPrefix(code) {\n const tail = self.events[self.events.length - 1]\n\n return !(0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.markdownSpace)(code) &&\n tail &&\n tail[1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.listItemPrefixWhitespace\n ? ok(code)\n : nok(code)\n }\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-core-commonmark/dev/lib/list.js?"); /***/ }), /***/ "./node_modules/micromark-core-commonmark/dev/lib/setext-underline.js": /*!****************************************************************************!*\ !*** ./node_modules/micromark-core-commonmark/dev/lib/setext-underline.js ***! \****************************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ setextUnderline: () => (/* binding */ setextUnderline)\n/* harmony export */ });\n/* harmony import */ var micromark_factory_space__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! micromark-factory-space */ \"./node_modules/micromark-factory-space/dev/index.js\");\n/* harmony import */ var micromark_util_character__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! micromark-util-character */ \"./node_modules/micromark-util-character/dev/index.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/types.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/codes.js\");\n/* harmony import */ var devlop__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! devlop */ \"./node_modules/devlop/lib/development.js\");\n/**\n * @typedef {import('micromark-util-types').Code} Code\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Resolver} Resolver\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n */\n\n\n\n\n\n\n/** @type {Construct} */\nconst setextUnderline = {\n name: 'setextUnderline',\n tokenize: tokenizeSetextUnderline,\n resolveTo: resolveToSetextUnderline\n}\n\n/** @type {Resolver} */\nfunction resolveToSetextUnderline(events, context) {\n // To do: resolve like `markdown-rs`.\n let index = events.length\n /** @type {number | undefined} */\n let content\n /** @type {number | undefined} */\n let text\n /** @type {number | undefined} */\n let definition\n\n // Find the opening of the content.\n // It’ll always exist: we don’t tokenize if it isn’t there.\n while (index--) {\n if (events[index][0] === 'enter') {\n if (events[index][1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.content) {\n content = index\n break\n }\n\n if (events[index][1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.paragraph) {\n text = index\n }\n }\n // Exit\n else {\n if (events[index][1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.content) {\n // Remove the content end (if needed we’ll add it later)\n events.splice(index, 1)\n }\n\n if (!definition && events[index][1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.definition) {\n definition = index\n }\n }\n }\n\n (0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(text !== undefined, 'expected a `text` index to be found')\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(content !== undefined, 'expected a `text` index to be found')\n\n const heading = {\n type: micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.setextHeading,\n start: Object.assign({}, events[text][1].start),\n end: Object.assign({}, events[events.length - 1][1].end)\n }\n\n // Change the paragraph to setext heading text.\n events[text][1].type = micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.setextHeadingText\n\n // If we have definitions in the content, we’ll keep on having content,\n // but we need move it.\n if (definition) {\n events.splice(text, 0, ['enter', heading, context])\n events.splice(definition + 1, 0, ['exit', events[content][1], context])\n events[content][1].end = Object.assign({}, events[definition][1].end)\n } else {\n events[content][1] = heading\n }\n\n // Add the heading exit at the end.\n events.push(['exit', heading, context])\n\n return events\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeSetextUnderline(effects, ok, nok) {\n const self = this\n /** @type {NonNullable} */\n let marker\n\n return start\n\n /**\n * At start of heading (setext) underline.\n *\n * ```markdown\n * | aa\n * > | ==\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n let index = self.events.length\n /** @type {boolean | undefined} */\n let paragraph\n\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.dash || code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.equalsTo,\n 'expected `=` or `-`'\n )\n\n // Find an opening.\n while (index--) {\n // Skip enter/exit of line ending, line prefix, and content.\n // We can now either have a definition or a paragraph.\n if (\n self.events[index][1].type !== micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.lineEnding &&\n self.events[index][1].type !== micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.linePrefix &&\n self.events[index][1].type !== micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.content\n ) {\n paragraph = self.events[index][1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.paragraph\n break\n }\n }\n\n // To do: handle lazy/pierce like `markdown-rs`.\n // To do: parse indent like `markdown-rs`.\n if (!self.parser.lazy[self.now().line] && (self.interrupt || paragraph)) {\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.setextHeadingLine)\n marker = code\n return before(code)\n }\n\n return nok(code)\n }\n\n /**\n * After optional whitespace, at `-` or `=`.\n *\n * ```markdown\n * | aa\n * > | ==\n * ^\n * ```\n *\n * @type {State}\n */\n function before(code) {\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.setextHeadingLineSequence)\n return inside(code)\n }\n\n /**\n * In sequence.\n *\n * ```markdown\n * | aa\n * > | ==\n * ^\n * ```\n *\n * @type {State}\n */\n function inside(code) {\n if (code === marker) {\n effects.consume(code)\n return inside\n }\n\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.setextHeadingLineSequence)\n\n return (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.markdownSpace)(code)\n ? (0,micromark_factory_space__WEBPACK_IMPORTED_MODULE_4__.factorySpace)(effects, after, micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.lineSuffix)(code)\n : after(code)\n }\n\n /**\n * After sequence, after optional whitespace.\n *\n * ```markdown\n * | aa\n * > | ==\n * ^\n * ```\n *\n * @type {State}\n */\n function after(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.eof || (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.markdownLineEnding)(code)) {\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.setextHeadingLine)\n return ok(code)\n }\n\n return nok(code)\n }\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-core-commonmark/dev/lib/setext-underline.js?"); /***/ }), /***/ "./node_modules/micromark-core-commonmark/dev/lib/thematic-break.js": /*!**************************************************************************!*\ !*** ./node_modules/micromark-core-commonmark/dev/lib/thematic-break.js ***! \**************************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ thematicBreak: () => (/* binding */ thematicBreak)\n/* harmony export */ });\n/* harmony import */ var micromark_factory_space__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! micromark-factory-space */ \"./node_modules/micromark-factory-space/dev/index.js\");\n/* harmony import */ var micromark_util_character__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! micromark-util-character */ \"./node_modules/micromark-util-character/dev/index.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/types.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/codes.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/constants.js\");\n/* harmony import */ var devlop__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! devlop */ \"./node_modules/devlop/lib/development.js\");\n/**\n * @typedef {import('micromark-util-types').Code} Code\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n */\n\n\n\n\n\n\n/** @type {Construct} */\nconst thematicBreak = {\n name: 'thematicBreak',\n tokenize: tokenizeThematicBreak\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeThematicBreak(effects, ok, nok) {\n let size = 0\n /** @type {NonNullable} */\n let marker\n\n return start\n\n /**\n * Start of thematic break.\n *\n * ```markdown\n * > | ***\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.thematicBreak)\n // To do: parse indent like `markdown-rs`.\n return before(code)\n }\n\n /**\n * After optional whitespace, at marker.\n *\n * ```markdown\n * > | ***\n * ^\n * ```\n *\n * @type {State}\n */\n function before(code) {\n (0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.asterisk ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.dash ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.underscore,\n 'expected `*`, `-`, or `_`'\n )\n marker = code\n return atBreak(code)\n }\n\n /**\n * After something, before something else.\n *\n * ```markdown\n * > | ***\n * ^\n * ```\n *\n * @type {State}\n */\n function atBreak(code) {\n if (code === marker) {\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.thematicBreakSequence)\n return sequence(code)\n }\n\n if (\n size >= micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.constants.thematicBreakMarkerCountMin &&\n (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.codes.eof || (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.markdownLineEnding)(code))\n ) {\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.thematicBreak)\n return ok(code)\n }\n\n return nok(code)\n }\n\n /**\n * In sequence.\n *\n * ```markdown\n * > | ***\n * ^\n * ```\n *\n * @type {State}\n */\n function sequence(code) {\n if (code === marker) {\n effects.consume(code)\n size++\n return sequence\n }\n\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.thematicBreakSequence)\n return (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_4__.markdownSpace)(code)\n ? (0,micromark_factory_space__WEBPACK_IMPORTED_MODULE_5__.factorySpace)(effects, atBreak, micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.whitespace)(code)\n : atBreak(code)\n }\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-core-commonmark/dev/lib/thematic-break.js?"); /***/ }), /***/ "./node_modules/micromark-factory-destination/dev/index.js": /*!*****************************************************************!*\ !*** ./node_modules/micromark-factory-destination/dev/index.js ***! \*****************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ factoryDestination: () => (/* binding */ factoryDestination)\n/* harmony export */ });\n/* harmony import */ var micromark_util_character__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! micromark-util-character */ \"./node_modules/micromark-util-character/dev/index.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/codes.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/types.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/constants.js\");\n/**\n * @typedef {import('micromark-util-types').Effects} Effects\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenType} TokenType\n */\n\n\n\n\n/**\n * Parse destinations.\n *\n * ###### Examples\n *\n * ```markdown\n * \n * b>\n * \n * \n * a\n * a\\)b\n * a(b)c\n * a(b)\n * ```\n *\n * @param {Effects} effects\n * Context.\n * @param {State} ok\n * State switched to when successful.\n * @param {State} nok\n * State switched to when unsuccessful.\n * @param {TokenType} type\n * Type for whole (`` or `b`).\n * @param {TokenType} literalType\n * Type when enclosed (``).\n * @param {TokenType} literalMarkerType\n * Type for enclosing (`<` and `>`).\n * @param {TokenType} rawType\n * Type when not enclosed (`b`).\n * @param {TokenType} stringType\n * Type for the value (`a` or `b`).\n * @param {number | undefined} [max=Infinity]\n * Depth of nested parens (inclusive).\n * @returns {State}\n * Start state.\n */\n// eslint-disable-next-line max-params\nfunction factoryDestination(\n effects,\n ok,\n nok,\n type,\n literalType,\n literalMarkerType,\n rawType,\n stringType,\n max\n) {\n const limit = max || Number.POSITIVE_INFINITY\n let balance = 0\n\n return start\n\n /**\n * Start of destination.\n *\n * ```markdown\n * > | \n * ^\n * > | aa\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.lessThan) {\n effects.enter(type)\n effects.enter(literalType)\n effects.enter(literalMarkerType)\n effects.consume(code)\n effects.exit(literalMarkerType)\n return enclosedBefore\n }\n\n // ASCII control, space, closing paren.\n if (\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.eof ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.space ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.rightParenthesis ||\n (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_1__.asciiControl)(code)\n ) {\n return nok(code)\n }\n\n effects.enter(type)\n effects.enter(rawType)\n effects.enter(stringType)\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.chunkString, {contentType: micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.constants.contentTypeString})\n return raw(code)\n }\n\n /**\n * After `<`, at an enclosed destination.\n *\n * ```markdown\n * > | \n * ^\n * ```\n *\n * @type {State}\n */\n function enclosedBefore(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.greaterThan) {\n effects.enter(literalMarkerType)\n effects.consume(code)\n effects.exit(literalMarkerType)\n effects.exit(literalType)\n effects.exit(type)\n return ok\n }\n\n effects.enter(stringType)\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.chunkString, {contentType: micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.constants.contentTypeString})\n return enclosed(code)\n }\n\n /**\n * In enclosed destination.\n *\n * ```markdown\n * > | \n * ^\n * ```\n *\n * @type {State}\n */\n function enclosed(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.greaterThan) {\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.chunkString)\n effects.exit(stringType)\n return enclosedBefore(code)\n }\n\n if (\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.eof ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.lessThan ||\n (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_1__.markdownLineEnding)(code)\n ) {\n return nok(code)\n }\n\n effects.consume(code)\n return code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.backslash ? enclosedEscape : enclosed\n }\n\n /**\n * After `\\`, at a special character.\n *\n * ```markdown\n * > | \n * ^\n * ```\n *\n * @type {State}\n */\n function enclosedEscape(code) {\n if (\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.lessThan ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.greaterThan ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.backslash\n ) {\n effects.consume(code)\n return enclosed\n }\n\n return enclosed(code)\n }\n\n /**\n * In raw destination.\n *\n * ```markdown\n * > | aa\n * ^\n * ```\n *\n * @type {State}\n */\n function raw(code) {\n if (\n !balance &&\n (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.eof ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.rightParenthesis ||\n (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_1__.markdownLineEndingOrSpace)(code))\n ) {\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.chunkString)\n effects.exit(stringType)\n effects.exit(rawType)\n effects.exit(type)\n return ok(code)\n }\n\n if (balance < limit && code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.leftParenthesis) {\n effects.consume(code)\n balance++\n return raw\n }\n\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.rightParenthesis) {\n effects.consume(code)\n balance--\n return raw\n }\n\n // ASCII control (but *not* `\\0`) and space and `(`.\n // Note: in `markdown-rs`, `\\0` exists in codes, in `micromark-js` it\n // doesn’t.\n if (\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.eof ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.space ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.leftParenthesis ||\n (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_1__.asciiControl)(code)\n ) {\n return nok(code)\n }\n\n effects.consume(code)\n return code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.backslash ? rawEscape : raw\n }\n\n /**\n * After `\\`, at special character.\n *\n * ```markdown\n * > | a\\*a\n * ^\n * ```\n *\n * @type {State}\n */\n function rawEscape(code) {\n if (\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.leftParenthesis ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.rightParenthesis ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.backslash\n ) {\n effects.consume(code)\n return raw\n }\n\n return raw(code)\n }\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-factory-destination/dev/index.js?"); /***/ }), /***/ "./node_modules/micromark-factory-label/dev/index.js": /*!***********************************************************!*\ !*** ./node_modules/micromark-factory-label/dev/index.js ***! \***********************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ factoryLabel: () => (/* binding */ factoryLabel)\n/* harmony export */ });\n/* harmony import */ var micromark_util_character__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! micromark-util-character */ \"./node_modules/micromark-util-character/dev/index.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/codes.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/constants.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/types.js\");\n/* harmony import */ var devlop__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! devlop */ \"./node_modules/devlop/lib/development.js\");\n/**\n * @typedef {import('micromark-util-types').Effects} Effects\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').TokenType} TokenType\n */\n\n\n\n\n\n/**\n * Parse labels.\n *\n * > 👉 **Note**: labels in markdown are capped at 999 characters in the string.\n *\n * ###### Examples\n *\n * ```markdown\n * [a]\n * [a\n * b]\n * [a\\]b]\n * ```\n *\n * @this {TokenizeContext}\n * Tokenize context.\n * @param {Effects} effects\n * Context.\n * @param {State} ok\n * State switched to when successful.\n * @param {State} nok\n * State switched to when unsuccessful.\n * @param {TokenType} type\n * Type of the whole label (`[a]`).\n * @param {TokenType} markerType\n * Type for the markers (`[` and `]`).\n * @param {TokenType} stringType\n * Type for the identifier (`a`).\n * @returns {State}\n * Start state.\n */\n// eslint-disable-next-line max-params\nfunction factoryLabel(effects, ok, nok, type, markerType, stringType) {\n const self = this\n let size = 0\n /** @type {boolean} */\n let seen\n\n return start\n\n /**\n * Start of label.\n *\n * ```markdown\n * > | [a]\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_0__.ok)(code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.leftSquareBracket, 'expected `[`')\n effects.enter(type)\n effects.enter(markerType)\n effects.consume(code)\n effects.exit(markerType)\n effects.enter(stringType)\n return atBreak\n }\n\n /**\n * In label, at something, before something else.\n *\n * ```markdown\n * > | [a]\n * ^\n * ```\n *\n * @type {State}\n */\n function atBreak(code) {\n if (\n size > micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.constants.linkReferenceSizeMax ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.eof ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.leftSquareBracket ||\n (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.rightSquareBracket && !seen) ||\n // To do: remove in the future once we’ve switched from\n // `micromark-extension-footnote` to `micromark-extension-gfm-footnote`,\n // which doesn’t need this.\n // Hidden footnotes hook.\n /* c8 ignore next 3 */\n (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.caret &&\n !size &&\n '_hiddenFootnoteSupport' in self.parser.constructs)\n ) {\n return nok(code)\n }\n\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.rightSquareBracket) {\n effects.exit(stringType)\n effects.enter(markerType)\n effects.consume(code)\n effects.exit(markerType)\n effects.exit(type)\n return ok\n }\n\n // To do: indent? Link chunks and EOLs together?\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.markdownLineEnding)(code)) {\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.types.lineEnding)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.types.lineEnding)\n return atBreak\n }\n\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.types.chunkString, {contentType: micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.constants.contentTypeString})\n return labelInside(code)\n }\n\n /**\n * In label, in text.\n *\n * ```markdown\n * > | [a]\n * ^\n * ```\n *\n * @type {State}\n */\n function labelInside(code) {\n if (\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.eof ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.leftSquareBracket ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.rightSquareBracket ||\n (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.markdownLineEnding)(code) ||\n size++ > micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.constants.linkReferenceSizeMax\n ) {\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.types.chunkString)\n return atBreak(code)\n }\n\n effects.consume(code)\n if (!seen) seen = !(0,micromark_util_character__WEBPACK_IMPORTED_MODULE_3__.markdownSpace)(code)\n return code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.backslash ? labelEscape : labelInside\n }\n\n /**\n * After `\\`, at a special character.\n *\n * ```markdown\n * > | [a\\*a]\n * ^\n * ```\n *\n * @type {State}\n */\n function labelEscape(code) {\n if (\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.leftSquareBracket ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.backslash ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.rightSquareBracket\n ) {\n effects.consume(code)\n size++\n return labelInside\n }\n\n return labelInside(code)\n }\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-factory-label/dev/index.js?"); /***/ }), /***/ "./node_modules/micromark-factory-space/dev/index.js": /*!***********************************************************!*\ !*** ./node_modules/micromark-factory-space/dev/index.js ***! \***********************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ factorySpace: () => (/* binding */ factorySpace)\n/* harmony export */ });\n/* harmony import */ var micromark_util_character__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! micromark-util-character */ \"./node_modules/micromark-util-character/dev/index.js\");\n/**\n * @typedef {import('micromark-util-types').Effects} Effects\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenType} TokenType\n */\n\n\n\n// To do: implement `spaceOrTab`, `spaceOrTabMinMax`, `spaceOrTabWithOptions`.\n\n/**\n * Parse spaces and tabs.\n *\n * There is no `nok` parameter:\n *\n * * spaces in markdown are often optional, in which case this factory can be\n * used and `ok` will be switched to whether spaces were found or not\n * * one line ending or space can be detected with `markdownSpace(code)` right\n * before using `factorySpace`\n *\n * ###### Examples\n *\n * Where `␉` represents a tab (plus how much it expands) and `␠` represents a\n * single space.\n *\n * ```markdown\n * ␉\n * ␠␠␠␠\n * ␉␠\n * ```\n *\n * @param {Effects} effects\n * Context.\n * @param {State} ok\n * State switched to when successful.\n * @param {TokenType} type\n * Type (`' \\t'`).\n * @param {number | undefined} [max=Infinity]\n * Max (exclusive).\n * @returns {State}\n * Start state.\n */\nfunction factorySpace(effects, ok, type, max) {\n const limit = max ? max - 1 : Number.POSITIVE_INFINITY\n let size = 0\n\n return start\n\n /** @type {State} */\n function start(code) {\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_0__.markdownSpace)(code)) {\n effects.enter(type)\n return prefix(code)\n }\n\n return ok(code)\n }\n\n /** @type {State} */\n function prefix(code) {\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_0__.markdownSpace)(code) && size++ < limit) {\n effects.consume(code)\n return prefix\n }\n\n effects.exit(type)\n return ok(code)\n }\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-factory-space/dev/index.js?"); /***/ }), /***/ "./node_modules/micromark-factory-title/dev/index.js": /*!***********************************************************!*\ !*** ./node_modules/micromark-factory-title/dev/index.js ***! \***********************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ factoryTitle: () => (/* binding */ factoryTitle)\n/* harmony export */ });\n/* harmony import */ var micromark_factory_space__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! micromark-factory-space */ \"./node_modules/micromark-factory-space/dev/index.js\");\n/* harmony import */ var micromark_util_character__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! micromark-util-character */ \"./node_modules/micromark-util-character/dev/index.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/codes.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/types.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/constants.js\");\n/**\n * @typedef {import('micromark-util-types').Code} Code\n * @typedef {import('micromark-util-types').Effects} Effects\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenType} TokenType\n */\n\n\n\n\n\n/**\n * Parse titles.\n *\n * ###### Examples\n *\n * ```markdown\n * \"a\"\n * 'b'\n * (c)\n * \"a\n * b\"\n * 'a\n * b'\n * (a\\)b)\n * ```\n *\n * @param {Effects} effects\n * Context.\n * @param {State} ok\n * State switched to when successful.\n * @param {State} nok\n * State switched to when unsuccessful.\n * @param {TokenType} type\n * Type of the whole title (`\"a\"`, `'b'`, `(c)`).\n * @param {TokenType} markerType\n * Type for the markers (`\"`, `'`, `(`, and `)`).\n * @param {TokenType} stringType\n * Type for the value (`a`).\n * @returns {State}\n * Start state.\n */\n// eslint-disable-next-line max-params\nfunction factoryTitle(effects, ok, nok, type, markerType, stringType) {\n /** @type {NonNullable} */\n let marker\n\n return start\n\n /**\n * Start of title.\n *\n * ```markdown\n * > | \"a\"\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n if (\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.quotationMark ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.apostrophe ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.leftParenthesis\n ) {\n effects.enter(type)\n effects.enter(markerType)\n effects.consume(code)\n effects.exit(markerType)\n marker = code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.leftParenthesis ? micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.rightParenthesis : code\n return begin\n }\n\n return nok(code)\n }\n\n /**\n * After opening marker.\n *\n * This is also used at the closing marker.\n *\n * ```markdown\n * > | \"a\"\n * ^\n * ```\n *\n * @type {State}\n */\n function begin(code) {\n if (code === marker) {\n effects.enter(markerType)\n effects.consume(code)\n effects.exit(markerType)\n effects.exit(type)\n return ok\n }\n\n effects.enter(stringType)\n return atBreak(code)\n }\n\n /**\n * At something, before something else.\n *\n * ```markdown\n * > | \"a\"\n * ^\n * ```\n *\n * @type {State}\n */\n function atBreak(code) {\n if (code === marker) {\n effects.exit(stringType)\n return begin(marker)\n }\n\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.eof) {\n return nok(code)\n }\n\n // Note: blank lines can’t exist in content.\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_1__.markdownLineEnding)(code)) {\n // To do: use `space_or_tab_eol_with_options`, connect.\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.lineEnding)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.lineEnding)\n return (0,micromark_factory_space__WEBPACK_IMPORTED_MODULE_3__.factorySpace)(effects, atBreak, micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.linePrefix)\n }\n\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.chunkString, {contentType: micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.constants.contentTypeString})\n return inside(code)\n }\n\n /**\n *\n *\n * @type {State}\n */\n function inside(code) {\n if (code === marker || code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.eof || (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_1__.markdownLineEnding)(code)) {\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.types.chunkString)\n return atBreak(code)\n }\n\n effects.consume(code)\n return code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.backslash ? escape : inside\n }\n\n /**\n * After `\\`, at a special character.\n *\n * ```markdown\n * > | \"a\\*b\"\n * ^\n * ```\n *\n * @type {State}\n */\n function escape(code) {\n if (code === marker || code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.backslash) {\n effects.consume(code)\n return inside\n }\n\n return inside(code)\n }\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-factory-title/dev/index.js?"); /***/ }), /***/ "./node_modules/micromark-factory-whitespace/dev/index.js": /*!****************************************************************!*\ !*** ./node_modules/micromark-factory-whitespace/dev/index.js ***! \****************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ factoryWhitespace: () => (/* binding */ factoryWhitespace)\n/* harmony export */ });\n/* harmony import */ var micromark_factory_space__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! micromark-factory-space */ \"./node_modules/micromark-factory-space/dev/index.js\");\n/* harmony import */ var micromark_util_character__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! micromark-util-character */ \"./node_modules/micromark-util-character/dev/index.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/types.js\");\n/**\n * @typedef {import('micromark-util-types').Effects} Effects\n * @typedef {import('micromark-util-types').State} State\n */\n\n\n\n\n\n/**\n * Parse spaces and tabs.\n *\n * There is no `nok` parameter:\n *\n * * line endings or spaces in markdown are often optional, in which case this\n * factory can be used and `ok` will be switched to whether spaces were found\n * or not\n * * one line ending or space can be detected with\n * `markdownLineEndingOrSpace(code)` right before using `factoryWhitespace`\n *\n * @param {Effects} effects\n * Context.\n * @param {State} ok\n * State switched to when successful.\n * @returns {State}\n * Start state.\n */\nfunction factoryWhitespace(effects, ok) {\n /** @type {boolean} */\n let seen\n\n return start\n\n /** @type {State} */\n function start(code) {\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_0__.markdownLineEnding)(code)) {\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.types.lineEnding)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.types.lineEnding)\n seen = true\n return start\n }\n\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_0__.markdownSpace)(code)) {\n return (0,micromark_factory_space__WEBPACK_IMPORTED_MODULE_2__.factorySpace)(\n effects,\n start,\n seen ? micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.types.linePrefix : micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.types.lineSuffix\n )(code)\n }\n\n return ok(code)\n }\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-factory-whitespace/dev/index.js?"); /***/ }), /***/ "./node_modules/micromark-util-character/dev/index.js": /*!************************************************************!*\ !*** ./node_modules/micromark-util-character/dev/index.js ***! \************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ asciiAlpha: () => (/* binding */ asciiAlpha),\n/* harmony export */ asciiAlphanumeric: () => (/* binding */ asciiAlphanumeric),\n/* harmony export */ asciiAtext: () => (/* binding */ asciiAtext),\n/* harmony export */ asciiControl: () => (/* binding */ asciiControl),\n/* harmony export */ asciiDigit: () => (/* binding */ asciiDigit),\n/* harmony export */ asciiHexDigit: () => (/* binding */ asciiHexDigit),\n/* harmony export */ asciiPunctuation: () => (/* binding */ asciiPunctuation),\n/* harmony export */ markdownLineEnding: () => (/* binding */ markdownLineEnding),\n/* harmony export */ markdownLineEndingOrSpace: () => (/* binding */ markdownLineEndingOrSpace),\n/* harmony export */ markdownSpace: () => (/* binding */ markdownSpace),\n/* harmony export */ unicodePunctuation: () => (/* binding */ unicodePunctuation),\n/* harmony export */ unicodeWhitespace: () => (/* binding */ unicodeWhitespace)\n/* harmony export */ });\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/codes.js\");\n/**\n * @typedef {import('micromark-util-types').Code} Code\n */\n\n\n\nconst unicodePunctuationInternal = regexCheck(/\\p{P}/u)\n\n/**\n * Check whether the character code represents an ASCII alpha (`a` through `z`,\n * case insensitive).\n *\n * An **ASCII alpha** is an ASCII upper alpha or ASCII lower alpha.\n *\n * An **ASCII upper alpha** is a character in the inclusive range U+0041 (`A`)\n * to U+005A (`Z`).\n *\n * An **ASCII lower alpha** is a character in the inclusive range U+0061 (`a`)\n * to U+007A (`z`).\n *\n * @param code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nconst asciiAlpha = regexCheck(/[A-Za-z]/)\n\n/**\n * Check whether the character code represents an ASCII alphanumeric (`a`\n * through `z`, case insensitive, or `0` through `9`).\n *\n * An **ASCII alphanumeric** is an ASCII digit (see `asciiDigit`) or ASCII alpha\n * (see `asciiAlpha`).\n *\n * @param code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nconst asciiAlphanumeric = regexCheck(/[\\dA-Za-z]/)\n\n/**\n * Check whether the character code represents an ASCII atext.\n *\n * atext is an ASCII alphanumeric (see `asciiAlphanumeric`), or a character in\n * the inclusive ranges U+0023 NUMBER SIGN (`#`) to U+0027 APOSTROPHE (`'`),\n * U+002A ASTERISK (`*`), U+002B PLUS SIGN (`+`), U+002D DASH (`-`), U+002F\n * SLASH (`/`), U+003D EQUALS TO (`=`), U+003F QUESTION MARK (`?`), U+005E\n * CARET (`^`) to U+0060 GRAVE ACCENT (`` ` ``), or U+007B LEFT CURLY BRACE\n * (`{`) to U+007E TILDE (`~`).\n *\n * See:\n * **\\[RFC5322]**:\n * [Internet Message Format](https://tools.ietf.org/html/rfc5322).\n * P. Resnick.\n * IETF.\n *\n * @param code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nconst asciiAtext = regexCheck(/[#-'*+\\--9=?A-Z^-~]/)\n\n/**\n * Check whether a character code is an ASCII control character.\n *\n * An **ASCII control** is a character in the inclusive range U+0000 NULL (NUL)\n * to U+001F (US), or U+007F (DEL).\n *\n * @param {Code} code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nfunction asciiControl(code) {\n return (\n // Special whitespace codes (which have negative values), C0 and Control\n // character DEL\n code !== null && (code < micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.space || code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.del)\n )\n}\n\n/**\n * Check whether the character code represents an ASCII digit (`0` through `9`).\n *\n * An **ASCII digit** is a character in the inclusive range U+0030 (`0`) to\n * U+0039 (`9`).\n *\n * @param code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nconst asciiDigit = regexCheck(/\\d/)\n\n/**\n * Check whether the character code represents an ASCII hex digit (`a` through\n * `f`, case insensitive, or `0` through `9`).\n *\n * An **ASCII hex digit** is an ASCII digit (see `asciiDigit`), ASCII upper hex\n * digit, or an ASCII lower hex digit.\n *\n * An **ASCII upper hex digit** is a character in the inclusive range U+0041\n * (`A`) to U+0046 (`F`).\n *\n * An **ASCII lower hex digit** is a character in the inclusive range U+0061\n * (`a`) to U+0066 (`f`).\n *\n * @param code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nconst asciiHexDigit = regexCheck(/[\\dA-Fa-f]/)\n\n/**\n * Check whether the character code represents ASCII punctuation.\n *\n * An **ASCII punctuation** is a character in the inclusive ranges U+0021\n * EXCLAMATION MARK (`!`) to U+002F SLASH (`/`), U+003A COLON (`:`) to U+0040 AT\n * SIGN (`@`), U+005B LEFT SQUARE BRACKET (`[`) to U+0060 GRAVE ACCENT\n * (`` ` ``), or U+007B LEFT CURLY BRACE (`{`) to U+007E TILDE (`~`).\n *\n * @param code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nconst asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/)\n\n/**\n * Check whether a character code is a markdown line ending.\n *\n * A **markdown line ending** is the virtual characters M-0003 CARRIAGE RETURN\n * LINE FEED (CRLF), M-0004 LINE FEED (LF) and M-0005 CARRIAGE RETURN (CR).\n *\n * In micromark, the actual character U+000A LINE FEED (LF) and U+000D CARRIAGE\n * RETURN (CR) are replaced by these virtual characters depending on whether\n * they occurred together.\n *\n * @param {Code} code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nfunction markdownLineEnding(code) {\n return code !== null && code < micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.horizontalTab\n}\n\n/**\n * Check whether a character code is a markdown line ending (see\n * `markdownLineEnding`) or markdown space (see `markdownSpace`).\n *\n * @param {Code} code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nfunction markdownLineEndingOrSpace(code) {\n return code !== null && (code < micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.nul || code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.space)\n}\n\n/**\n * Check whether a character code is a markdown space.\n *\n * A **markdown space** is the concrete character U+0020 SPACE (SP) and the\n * virtual characters M-0001 VIRTUAL SPACE (VS) and M-0002 HORIZONTAL TAB (HT).\n *\n * In micromark, the actual character U+0009 CHARACTER TABULATION (HT) is\n * replaced by one M-0002 HORIZONTAL TAB (HT) and between 0 and 3 M-0001 VIRTUAL\n * SPACE (VS) characters, depending on the column at which the tab occurred.\n *\n * @param {Code} code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nfunction markdownSpace(code) {\n return (\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.horizontalTab ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.virtualSpace ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.space\n )\n}\n\n// Size note: removing ASCII from the regex and using `asciiPunctuation` here\n// In fact adds to the bundle size.\n/**\n * Check whether the character code represents Unicode punctuation.\n *\n * A **Unicode punctuation** is a character in the Unicode `Pc` (Punctuation,\n * Connector), `Pd` (Punctuation, Dash), `Pe` (Punctuation, Close), `Pf`\n * (Punctuation, Final quote), `Pi` (Punctuation, Initial quote), `Po`\n * (Punctuation, Other), or `Ps` (Punctuation, Open) categories, or an ASCII\n * punctuation (see `asciiPunctuation`).\n *\n * See:\n * **\\[UNICODE]**:\n * [The Unicode Standard](https://www.unicode.org/versions/).\n * Unicode Consortium.\n *\n * @param {Code} code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nfunction unicodePunctuation(code) {\n return asciiPunctuation(code) || unicodePunctuationInternal(code)\n}\n\n/**\n * Check whether the character code represents Unicode whitespace.\n *\n * Note that this does handle micromark specific markdown whitespace characters.\n * See `markdownLineEndingOrSpace` to check that.\n *\n * A **Unicode whitespace** is a character in the Unicode `Zs` (Separator,\n * Space) category, or U+0009 CHARACTER TABULATION (HT), U+000A LINE FEED (LF),\n * U+000C (FF), or U+000D CARRIAGE RETURN (CR) (**\\[UNICODE]**).\n *\n * See:\n * **\\[UNICODE]**:\n * [The Unicode Standard](https://www.unicode.org/versions/).\n * Unicode Consortium.\n *\n * @param code\n * Code.\n * @returns {boolean}\n * Whether it matches.\n */\nconst unicodeWhitespace = regexCheck(/\\s/)\n\n/**\n * Create a code check from a regex.\n *\n * @param {RegExp} regex\n * @returns {(code: Code) => boolean}\n */\nfunction regexCheck(regex) {\n return check\n\n /**\n * Check whether a code matches the bound regex.\n *\n * @param {Code} code\n * Character code.\n * @returns {boolean}\n * Whether the character code matches the bound regex.\n */\n function check(code) {\n return code !== null && code > -1 && regex.test(String.fromCharCode(code))\n }\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-util-character/dev/index.js?"); /***/ }), /***/ "./node_modules/micromark-util-chunked/dev/index.js": /*!**********************************************************!*\ !*** ./node_modules/micromark-util-chunked/dev/index.js ***! \**********************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ push: () => (/* binding */ push),\n/* harmony export */ splice: () => (/* binding */ splice)\n/* harmony export */ });\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/constants.js\");\n\n\n/**\n * Like `Array#splice`, but smarter for giant arrays.\n *\n * `Array#splice` takes all items to be inserted as individual argument which\n * causes a stack overflow in V8 when trying to insert 100k items for instance.\n *\n * Otherwise, this does not return the removed items, and takes `items` as an\n * array instead of rest parameters.\n *\n * @template {unknown} T\n * Item type.\n * @param {Array} list\n * List to operate on.\n * @param {number} start\n * Index to remove/insert at (can be negative).\n * @param {number} remove\n * Number of items to remove.\n * @param {Array} items\n * Items to inject into `list`.\n * @returns {undefined}\n * Nothing.\n */\nfunction splice(list, start, remove, items) {\n const end = list.length\n let chunkStart = 0\n /** @type {Array} */\n let parameters\n\n // Make start between zero and `end` (included).\n if (start < 0) {\n start = -start > end ? 0 : end + start\n } else {\n start = start > end ? end : start\n }\n\n remove = remove > 0 ? remove : 0\n\n // No need to chunk the items if there’s only a couple (10k) items.\n if (items.length < micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.constants.v8MaxSafeChunkSize) {\n parameters = Array.from(items)\n parameters.unshift(start, remove)\n // @ts-expect-error Hush, it’s fine.\n list.splice(...parameters)\n } else {\n // Delete `remove` items starting from `start`\n if (remove) list.splice(start, remove)\n\n // Insert the items in chunks to not cause stack overflows.\n while (chunkStart < items.length) {\n parameters = items.slice(\n chunkStart,\n chunkStart + micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.constants.v8MaxSafeChunkSize\n )\n parameters.unshift(start, 0)\n // @ts-expect-error Hush, it’s fine.\n list.splice(...parameters)\n\n chunkStart += micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.constants.v8MaxSafeChunkSize\n start += micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.constants.v8MaxSafeChunkSize\n }\n }\n}\n\n/**\n * Append `items` (an array) at the end of `list` (another array).\n * When `list` was empty, returns `items` instead.\n *\n * This prevents a potentially expensive operation when `list` is empty,\n * and adds items in batches to prevent V8 from hanging.\n *\n * @template {unknown} T\n * Item type.\n * @param {Array} list\n * List to operate on.\n * @param {Array} items\n * Items to add to `list`.\n * @returns {Array}\n * Either `list` or `items`.\n */\nfunction push(list, items) {\n if (list.length > 0) {\n splice(list, list.length, 0, items)\n return list\n }\n\n return items\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-util-chunked/dev/index.js?"); /***/ }), /***/ "./node_modules/micromark-util-classify-character/dev/index.js": /*!*********************************************************************!*\ !*** ./node_modules/micromark-util-classify-character/dev/index.js ***! \*********************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ classifyCharacter: () => (/* binding */ classifyCharacter)\n/* harmony export */ });\n/* harmony import */ var micromark_util_character__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! micromark-util-character */ \"./node_modules/micromark-util-character/dev/index.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/codes.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/constants.js\");\n/**\n * @typedef {import('micromark-util-types').Code} Code\n */\n\n\n\n\n/**\n * Classify whether a code represents whitespace, punctuation, or something\n * else.\n *\n * Used for attention (emphasis, strong), whose sequences can open or close\n * based on the class of surrounding characters.\n *\n * > 👉 **Note**: eof (`null`) is seen as whitespace.\n *\n * @param {Code} code\n * Code.\n * @returns {typeof constants.characterGroupWhitespace | typeof constants.characterGroupPunctuation | undefined}\n * Group.\n */\nfunction classifyCharacter(code) {\n if (\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.eof ||\n (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_1__.markdownLineEndingOrSpace)(code) ||\n (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_1__.unicodeWhitespace)(code)\n ) {\n return micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.constants.characterGroupWhitespace\n }\n\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_1__.unicodePunctuation)(code)) {\n return micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.constants.characterGroupPunctuation\n }\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-util-classify-character/dev/index.js?"); /***/ }), /***/ "./node_modules/micromark-util-combine-extensions/index.js": /*!*****************************************************************!*\ !*** ./node_modules/micromark-util-combine-extensions/index.js ***! \*****************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ combineExtensions: () => (/* binding */ combineExtensions),\n/* harmony export */ combineHtmlExtensions: () => (/* binding */ combineHtmlExtensions)\n/* harmony export */ });\n/* harmony import */ var micromark_util_chunked__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! micromark-util-chunked */ \"./node_modules/micromark-util-chunked/dev/index.js\");\n/**\n * @typedef {import('micromark-util-types').Extension} Extension\n * @typedef {import('micromark-util-types').Handles} Handles\n * @typedef {import('micromark-util-types').HtmlExtension} HtmlExtension\n * @typedef {import('micromark-util-types').NormalizedExtension} NormalizedExtension\n */\n\n\n\nconst hasOwnProperty = {}.hasOwnProperty\n\n/**\n * Combine multiple syntax extensions into one.\n *\n * @param {Array} extensions\n * List of syntax extensions.\n * @returns {NormalizedExtension}\n * A single combined extension.\n */\nfunction combineExtensions(extensions) {\n /** @type {NormalizedExtension} */\n const all = {}\n let index = -1\n\n while (++index < extensions.length) {\n syntaxExtension(all, extensions[index])\n }\n\n return all\n}\n\n/**\n * Merge `extension` into `all`.\n *\n * @param {NormalizedExtension} all\n * Extension to merge into.\n * @param {Extension} extension\n * Extension to merge.\n * @returns {undefined}\n */\nfunction syntaxExtension(all, extension) {\n /** @type {keyof Extension} */\n let hook\n\n for (hook in extension) {\n const maybe = hasOwnProperty.call(all, hook) ? all[hook] : undefined\n /** @type {Record} */\n const left = maybe || (all[hook] = {})\n /** @type {Record | undefined} */\n const right = extension[hook]\n /** @type {string} */\n let code\n\n if (right) {\n for (code in right) {\n if (!hasOwnProperty.call(left, code)) left[code] = []\n const value = right[code]\n constructs(\n // @ts-expect-error Looks like a list.\n left[code],\n Array.isArray(value) ? value : value ? [value] : []\n )\n }\n }\n }\n}\n\n/**\n * Merge `list` into `existing` (both lists of constructs).\n * Mutates `existing`.\n *\n * @param {Array} existing\n * @param {Array} list\n * @returns {undefined}\n */\nfunction constructs(existing, list) {\n let index = -1\n /** @type {Array} */\n const before = []\n\n while (++index < list.length) {\n // @ts-expect-error Looks like an object.\n ;(list[index].add === 'after' ? existing : before).push(list[index])\n }\n\n (0,micromark_util_chunked__WEBPACK_IMPORTED_MODULE_0__.splice)(existing, 0, 0, before)\n}\n\n/**\n * Combine multiple HTML extensions into one.\n *\n * @param {Array} htmlExtensions\n * List of HTML extensions.\n * @returns {HtmlExtension}\n * A single combined HTML extension.\n */\nfunction combineHtmlExtensions(htmlExtensions) {\n /** @type {HtmlExtension} */\n const handlers = {}\n let index = -1\n\n while (++index < htmlExtensions.length) {\n htmlExtension(handlers, htmlExtensions[index])\n }\n\n return handlers\n}\n\n/**\n * Merge `extension` into `all`.\n *\n * @param {HtmlExtension} all\n * Extension to merge into.\n * @param {HtmlExtension} extension\n * Extension to merge.\n * @returns {undefined}\n */\nfunction htmlExtension(all, extension) {\n /** @type {keyof HtmlExtension} */\n let hook\n\n for (hook in extension) {\n const maybe = hasOwnProperty.call(all, hook) ? all[hook] : undefined\n const left = maybe || (all[hook] = {})\n const right = extension[hook]\n /** @type {keyof Handles} */\n let type\n\n if (right) {\n for (type in right) {\n // @ts-expect-error assume document vs regular handler are managed correctly.\n left[type] = right[type]\n }\n }\n }\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-util-combine-extensions/index.js?"); /***/ }), /***/ "./node_modules/micromark-util-decode-numeric-character-reference/dev/index.js": /*!*************************************************************************************!*\ !*** ./node_modules/micromark-util-decode-numeric-character-reference/dev/index.js ***! \*************************************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decodeNumericCharacterReference: () => (/* binding */ decodeNumericCharacterReference)\n/* harmony export */ });\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/codes.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/values.js\");\n\n\n/**\n * Turn the number (in string form as either hexa- or plain decimal) coming from\n * a numeric character reference into a character.\n *\n * Sort of like `String.fromCodePoint(Number.parseInt(value, base))`, but makes\n * non-characters and control characters safe.\n *\n * @param {string} value\n * Value to decode.\n * @param {number} base\n * Numeric base.\n * @returns {string}\n * Character.\n */\nfunction decodeNumericCharacterReference(value, base) {\n const code = Number.parseInt(value, base)\n\n if (\n // C0 except for HT, LF, FF, CR, space.\n code < micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.ht ||\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.vt ||\n (code > micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.cr && code < micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.space) ||\n // Control character (DEL) of C0, and C1 controls.\n (code > micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.tilde && code < 160) ||\n // Lone high surrogates and low surrogates.\n (code > 55_295 && code < 57_344) ||\n // Noncharacters.\n (code > 64_975 && code < 65_008) ||\n /* eslint-disable no-bitwise */\n (code & 65_535) === 65_535 ||\n (code & 65_535) === 65_534 ||\n /* eslint-enable no-bitwise */\n // Out of range\n code > 1_114_111\n ) {\n return micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.values.replacementCharacter\n }\n\n return String.fromCodePoint(code)\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-util-decode-numeric-character-reference/dev/index.js?"); /***/ }), /***/ "./node_modules/micromark-util-decode-string/dev/index.js": /*!****************************************************************!*\ !*** ./node_modules/micromark-util-decode-string/dev/index.js ***! \****************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decodeString: () => (/* binding */ decodeString)\n/* harmony export */ });\n/* harmony import */ var decode_named_character_reference__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! decode-named-character-reference */ \"./node_modules/decode-named-character-reference/index.dom.js\");\n/* harmony import */ var micromark_util_decode_numeric_character_reference__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! micromark-util-decode-numeric-character-reference */ \"./node_modules/micromark-util-decode-numeric-character-reference/dev/index.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/codes.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/constants.js\");\n\n\n\n\nconst characterEscapeOrReference =\n /\\\\([!-/:-@[-`{-~])|&(#(?:\\d{1,7}|x[\\da-f]{1,6})|[\\da-z]{1,31});/gi\n\n/**\n * Decode markdown strings (which occur in places such as fenced code info\n * strings, destinations, labels, and titles).\n *\n * The “string” content type allows character escapes and -references.\n * This decodes those.\n *\n * @param {string} value\n * Value to decode.\n * @returns {string}\n * Decoded value.\n */\nfunction decodeString(value) {\n return value.replace(characterEscapeOrReference, decode)\n}\n\n/**\n * @param {string} $0\n * @param {string} $1\n * @param {string} $2\n * @returns {string}\n */\nfunction decode($0, $1, $2) {\n if ($1) {\n // Escape.\n return $1\n }\n\n // Reference.\n const head = $2.charCodeAt(0)\n\n if (head === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.numberSign) {\n const head = $2.charCodeAt(1)\n const hex = head === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.lowercaseX || head === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.uppercaseX\n return (0,micromark_util_decode_numeric_character_reference__WEBPACK_IMPORTED_MODULE_1__.decodeNumericCharacterReference)(\n $2.slice(hex ? 2 : 1),\n hex ? micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.constants.numericBaseHexadecimal : micromark_util_symbol__WEBPACK_IMPORTED_MODULE_2__.constants.numericBaseDecimal\n )\n }\n\n return (0,decode_named_character_reference__WEBPACK_IMPORTED_MODULE_3__.decodeNamedCharacterReference)($2) || $0\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-util-decode-string/dev/index.js?"); /***/ }), /***/ "./node_modules/micromark-util-encode/index.js": /*!*****************************************************!*\ !*** ./node_modules/micromark-util-encode/index.js ***! \*****************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ encode: () => (/* binding */ encode)\n/* harmony export */ });\nconst characterReferences = {'\"': 'quot', '&': 'amp', '<': 'lt', '>': 'gt'}\n\n/**\n * Encode only the dangerous HTML characters.\n *\n * This ensures that certain characters which have special meaning in HTML are\n * dealt with.\n * Technically, we can skip `>` and `\"` in many cases, but CM includes them.\n *\n * @param {string} value\n * Value to encode.\n * @returns {string}\n * Encoded value.\n */\nfunction encode(value) {\n return value.replace(/[\"&<>]/g, replace)\n\n /**\n * @param {string} value\n * @returns {string}\n */\n function replace(value) {\n // @ts-expect-error Hush, it’s fine.\n return '&' + characterReferences[value] + ';'\n }\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-util-encode/index.js?"); /***/ }), /***/ "./node_modules/micromark-util-html-tag-name/index.js": /*!************************************************************!*\ !*** ./node_modules/micromark-util-html-tag-name/index.js ***! \************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ htmlBlockNames: () => (/* binding */ htmlBlockNames),\n/* harmony export */ htmlRawNames: () => (/* binding */ htmlRawNames)\n/* harmony export */ });\n/**\n * List of lowercase HTML “block” tag names.\n *\n * The list, when parsing HTML (flow), results in more relaxed rules (condition\n * 6).\n * Because they are known blocks, the HTML-like syntax doesn’t have to be\n * strictly parsed.\n * For tag names not in this list, a more strict algorithm (condition 7) is used\n * to detect whether the HTML-like syntax is seen as HTML (flow) or not.\n *\n * This is copied from:\n * .\n *\n * > 👉 **Note**: `search` was added in `CommonMark@0.31`.\n */\nconst htmlBlockNames = [\n 'address',\n 'article',\n 'aside',\n 'base',\n 'basefont',\n 'blockquote',\n 'body',\n 'caption',\n 'center',\n 'col',\n 'colgroup',\n 'dd',\n 'details',\n 'dialog',\n 'dir',\n 'div',\n 'dl',\n 'dt',\n 'fieldset',\n 'figcaption',\n 'figure',\n 'footer',\n 'form',\n 'frame',\n 'frameset',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'head',\n 'header',\n 'hr',\n 'html',\n 'iframe',\n 'legend',\n 'li',\n 'link',\n 'main',\n 'menu',\n 'menuitem',\n 'nav',\n 'noframes',\n 'ol',\n 'optgroup',\n 'option',\n 'p',\n 'param',\n 'search',\n 'section',\n 'summary',\n 'table',\n 'tbody',\n 'td',\n 'tfoot',\n 'th',\n 'thead',\n 'title',\n 'tr',\n 'track',\n 'ul'\n]\n\n/**\n * List of lowercase HTML “raw” tag names.\n *\n * The list, when parsing HTML (flow), results in HTML that can include lines\n * without exiting, until a closing tag also in this list is found (condition\n * 1).\n *\n * This module is copied from:\n * .\n *\n * > 👉 **Note**: `textarea` was added in `CommonMark@0.30`.\n */\nconst htmlRawNames = ['pre', 'script', 'style', 'textarea']\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-util-html-tag-name/index.js?"); /***/ }), /***/ "./node_modules/micromark-util-normalize-identifier/dev/index.js": /*!***********************************************************************!*\ !*** ./node_modules/micromark-util-normalize-identifier/dev/index.js ***! \***********************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ normalizeIdentifier: () => (/* binding */ normalizeIdentifier)\n/* harmony export */ });\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/values.js\");\n\n\n/**\n * Normalize an identifier (as found in references, definitions).\n *\n * Collapses markdown whitespace, trim, and then lower- and uppercase.\n *\n * Some characters are considered “uppercase”, such as U+03F4 (`ϴ`), but if their\n * lowercase counterpart (U+03B8 (`θ`)) is uppercased will result in a different\n * uppercase character (U+0398 (`Θ`)).\n * So, to get a canonical form, we perform both lower- and uppercase.\n *\n * Using uppercase last makes sure keys will never interact with default\n * prototypal values (such as `constructor`): nothing in the prototype of\n * `Object` is uppercase.\n *\n * @param {string} value\n * Identifier to normalize.\n * @returns {string}\n * Normalized identifier.\n */\nfunction normalizeIdentifier(value) {\n return (\n value\n // Collapse markdown whitespace.\n .replace(/[\\t\\n\\r ]+/g, micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.values.space)\n // Trim.\n .replace(/^ | $/g, '')\n // Some characters are considered “uppercase”, but if their lowercase\n // counterpart is uppercased will result in a different uppercase\n // character.\n // Hence, to get that form, we perform both lower- and uppercase.\n // Upper case makes sure keys will not interact with default prototypal\n // methods: no method is uppercase.\n .toLowerCase()\n .toUpperCase()\n )\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-util-normalize-identifier/dev/index.js?"); /***/ }), /***/ "./node_modules/micromark-util-resolve-all/index.js": /*!**********************************************************!*\ !*** ./node_modules/micromark-util-resolve-all/index.js ***! \**********************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ resolveAll: () => (/* binding */ resolveAll)\n/* harmony export */ });\n/**\n * @typedef {import('micromark-util-types').Event} Event\n * @typedef {import('micromark-util-types').Resolver} Resolver\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n */\n\n/**\n * Call all `resolveAll`s.\n *\n * @param {Array<{resolveAll?: Resolver | undefined}>} constructs\n * List of constructs, optionally with `resolveAll`s.\n * @param {Array} events\n * List of events.\n * @param {TokenizeContext} context\n * Context used by `tokenize`.\n * @returns {Array}\n * Changed events.\n */\nfunction resolveAll(constructs, events, context) {\n /** @type {Array} */\n const called = []\n let index = -1\n\n while (++index < constructs.length) {\n const resolve = constructs[index].resolveAll\n\n if (resolve && !called.includes(resolve)) {\n events = resolve(events, context)\n called.push(resolve)\n }\n }\n\n return events\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-util-resolve-all/index.js?"); /***/ }), /***/ "./node_modules/micromark-util-sanitize-uri/dev/index.js": /*!***************************************************************!*\ !*** ./node_modules/micromark-util-sanitize-uri/dev/index.js ***! \***************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ normalizeUri: () => (/* binding */ normalizeUri),\n/* harmony export */ sanitizeUri: () => (/* binding */ sanitizeUri)\n/* harmony export */ });\n/* harmony import */ var micromark_util_character__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! micromark-util-character */ \"./node_modules/micromark-util-character/dev/index.js\");\n/* harmony import */ var micromark_util_encode__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! micromark-util-encode */ \"./node_modules/micromark-util-encode/index.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/codes.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/values.js\");\n\n\n\n\n/**\n * Make a value safe for injection as a URL.\n *\n * This encodes unsafe characters with percent-encoding and skips already\n * encoded sequences (see `normalizeUri`).\n * Further unsafe characters are encoded as character references (see\n * `micromark-util-encode`).\n *\n * A regex of allowed protocols can be given, in which case the URL is\n * sanitized.\n * For example, `/^(https?|ircs?|mailto|xmpp)$/i` can be used for `a[href]`, or\n * `/^https?$/i` for `img[src]` (this is what `github.com` allows).\n * If the URL includes an unknown protocol (one not matched by `protocol`, such\n * as a dangerous example, `javascript:`), the value is ignored.\n *\n * @param {string | null | undefined} url\n * URI to sanitize.\n * @param {RegExp | null | undefined} [protocol]\n * Allowed protocols.\n * @returns {string}\n * Sanitized URI.\n */\nfunction sanitizeUri(url, protocol) {\n const value = (0,micromark_util_encode__WEBPACK_IMPORTED_MODULE_0__.encode)(normalizeUri(url || ''))\n\n if (!protocol) {\n return value\n }\n\n const colon = value.indexOf(':')\n const questionMark = value.indexOf('?')\n const numberSign = value.indexOf('#')\n const slash = value.indexOf('/')\n\n if (\n // If there is no protocol, it’s relative.\n colon < 0 ||\n // If the first colon is after a `?`, `#`, or `/`, it’s not a protocol.\n (slash > -1 && colon > slash) ||\n (questionMark > -1 && colon > questionMark) ||\n (numberSign > -1 && colon > numberSign) ||\n // It is a protocol, it should be allowed.\n protocol.test(value.slice(0, colon))\n ) {\n return value\n }\n\n return ''\n}\n\n/**\n * Normalize a URL.\n *\n * Encode unsafe characters with percent-encoding, skipping already encoded\n * sequences.\n *\n * @param {string} value\n * URI to normalize.\n * @returns {string}\n * Normalized URI.\n */\nfunction normalizeUri(value) {\n /** @type {Array} */\n const result = []\n let index = -1\n let start = 0\n let skip = 0\n\n while (++index < value.length) {\n const code = value.charCodeAt(index)\n /** @type {string} */\n let replace = ''\n\n // A correct percent encoded value.\n if (\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.percentSign &&\n (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_2__.asciiAlphanumeric)(value.charCodeAt(index + 1)) &&\n (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_2__.asciiAlphanumeric)(value.charCodeAt(index + 2))\n ) {\n skip = 2\n }\n // ASCII.\n else if (code < 128) {\n if (!/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(code))) {\n replace = String.fromCharCode(code)\n }\n }\n // Astral.\n else if (code > 55_295 && code < 57_344) {\n const next = value.charCodeAt(index + 1)\n\n // A correct surrogate pair.\n if (code < 56_320 && next > 56_319 && next < 57_344) {\n replace = String.fromCharCode(code, next)\n skip = 1\n }\n // Lone surrogate.\n else {\n replace = micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.values.replacementCharacter\n }\n }\n // Unicode.\n else {\n replace = String.fromCharCode(code)\n }\n\n if (replace) {\n result.push(value.slice(start, index), encodeURIComponent(replace))\n start = index + skip + 1\n replace = ''\n }\n\n if (skip) {\n index += skip\n skip = 0\n }\n }\n\n return result.join('') + value.slice(start)\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-util-sanitize-uri/dev/index.js?"); /***/ }), /***/ "./node_modules/micromark-util-subtokenize/dev/index.js": /*!**************************************************************!*\ !*** ./node_modules/micromark-util-subtokenize/dev/index.js ***! \**************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ subtokenize: () => (/* binding */ subtokenize)\n/* harmony export */ });\n/* harmony import */ var micromark_util_chunked__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! micromark-util-chunked */ \"./node_modules/micromark-util-chunked/dev/index.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/types.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/codes.js\");\n/* harmony import */ var devlop__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! devlop */ \"./node_modules/devlop/lib/development.js\");\n/**\n * @typedef {import('micromark-util-types').Chunk} Chunk\n * @typedef {import('micromark-util-types').Event} Event\n * @typedef {import('micromark-util-types').Token} Token\n */\n\n\n\n\n\n/**\n * Tokenize subcontent.\n *\n * @param {Array} events\n * List of events.\n * @returns {boolean}\n * Whether subtokens were found.\n */\n// eslint-disable-next-line complexity\nfunction subtokenize(events) {\n /** @type {Record} */\n const jumps = {}\n let index = -1\n /** @type {Event} */\n let event\n /** @type {number | undefined} */\n let lineIndex\n /** @type {number} */\n let otherIndex\n /** @type {Event} */\n let otherEvent\n /** @type {Array} */\n let parameters\n /** @type {Array} */\n let subevents\n /** @type {boolean | undefined} */\n let more\n\n while (++index < events.length) {\n while (index in jumps) {\n index = jumps[index]\n }\n\n event = events[index]\n\n // Add a hook for the GFM tasklist extension, which needs to know if text\n // is in the first content of a list item.\n if (\n index &&\n event[1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.chunkFlow &&\n events[index - 1][1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.listItemPrefix\n ) {\n (0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(event[1]._tokenizer, 'expected `_tokenizer` on subtokens')\n subevents = event[1]._tokenizer.events\n otherIndex = 0\n\n if (\n otherIndex < subevents.length &&\n subevents[otherIndex][1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.lineEndingBlank\n ) {\n otherIndex += 2\n }\n\n if (\n otherIndex < subevents.length &&\n subevents[otherIndex][1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.content\n ) {\n while (++otherIndex < subevents.length) {\n if (subevents[otherIndex][1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.content) {\n break\n }\n\n if (subevents[otherIndex][1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.chunkText) {\n subevents[otherIndex][1]._isInFirstContentOfListItem = true\n otherIndex++\n }\n }\n }\n }\n\n // Enter.\n if (event[0] === 'enter') {\n if (event[1].contentType) {\n Object.assign(jumps, subcontent(events, index))\n index = jumps[index]\n more = true\n }\n }\n // Exit.\n else if (event[1]._container) {\n otherIndex = index\n lineIndex = undefined\n\n while (otherIndex--) {\n otherEvent = events[otherIndex]\n\n if (\n otherEvent[1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.lineEnding ||\n otherEvent[1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.lineEndingBlank\n ) {\n if (otherEvent[0] === 'enter') {\n if (lineIndex) {\n events[lineIndex][1].type = micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.lineEndingBlank\n }\n\n otherEvent[1].type = micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.types.lineEnding\n lineIndex = otherIndex\n }\n } else {\n break\n }\n }\n\n if (lineIndex) {\n // Fix position.\n event[1].end = Object.assign({}, events[lineIndex][1].start)\n\n // Switch container exit w/ line endings.\n parameters = events.slice(lineIndex, index)\n parameters.unshift(event)\n ;(0,micromark_util_chunked__WEBPACK_IMPORTED_MODULE_2__.splice)(events, lineIndex, index - lineIndex + 1, parameters)\n }\n }\n }\n\n return !more\n}\n\n/**\n * Tokenize embedded tokens.\n *\n * @param {Array} events\n * @param {number} eventIndex\n * @returns {Record}\n */\nfunction subcontent(events, eventIndex) {\n const token = events[eventIndex][1]\n const context = events[eventIndex][2]\n let startPosition = eventIndex - 1\n /** @type {Array} */\n const startPositions = []\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(token.contentType, 'expected `contentType` on subtokens')\n const tokenizer =\n token._tokenizer || context.parser[token.contentType](token.start)\n const childEvents = tokenizer.events\n /** @type {Array<[number, number]>} */\n const jumps = []\n /** @type {Record} */\n const gaps = {}\n /** @type {Array} */\n let stream\n /** @type {Token | undefined} */\n let previous\n let index = -1\n /** @type {Token | undefined} */\n let current = token\n let adjust = 0\n let start = 0\n const breaks = [start]\n\n // Loop forward through the linked tokens to pass them in order to the\n // subtokenizer.\n while (current) {\n // Find the position of the event for this token.\n while (events[++startPosition][1] !== current) {\n // Empty.\n }\n\n (0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(\n !previous || current.previous === previous,\n 'expected previous to match'\n )\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(!previous || previous.next === current, 'expected next to match')\n\n startPositions.push(startPosition)\n\n if (!current._tokenizer) {\n stream = context.sliceStream(current)\n\n if (!current.next) {\n stream.push(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.codes.eof)\n }\n\n if (previous) {\n tokenizer.defineSkip(current.start)\n }\n\n if (current._isInFirstContentOfListItem) {\n tokenizer._gfmTasklistFirstContentOfListItem = true\n }\n\n tokenizer.write(stream)\n\n if (current._isInFirstContentOfListItem) {\n tokenizer._gfmTasklistFirstContentOfListItem = undefined\n }\n }\n\n // Unravel the next token.\n previous = current\n current = current.next\n }\n\n // Now, loop back through all events (and linked tokens), to figure out which\n // parts belong where.\n current = token\n\n while (++index < childEvents.length) {\n if (\n // Find a void token that includes a break.\n childEvents[index][0] === 'exit' &&\n childEvents[index - 1][0] === 'enter' &&\n childEvents[index][1].type === childEvents[index - 1][1].type &&\n childEvents[index][1].start.line !== childEvents[index][1].end.line\n ) {\n (0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(current, 'expected a current token')\n start = index + 1\n breaks.push(start)\n // Help GC.\n current._tokenizer = undefined\n current.previous = undefined\n current = current.next\n }\n }\n\n // Help GC.\n tokenizer.events = []\n\n // If there’s one more token (which is the cases for lines that end in an\n // EOF), that’s perfect: the last point we found starts it.\n // If there isn’t then make sure any remaining content is added to it.\n if (current) {\n // Help GC.\n current._tokenizer = undefined\n current.previous = undefined\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(!current.next, 'expected no next token')\n } else {\n breaks.pop()\n }\n\n // Now splice the events from the subtokenizer into the current events,\n // moving back to front so that splice indices aren’t affected.\n index = breaks.length\n\n while (index--) {\n const slice = childEvents.slice(breaks[index], breaks[index + 1])\n const start = startPositions.pop()\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_1__.ok)(start !== undefined, 'expected a start position when splicing')\n jumps.unshift([start, start + slice.length - 1])\n ;(0,micromark_util_chunked__WEBPACK_IMPORTED_MODULE_2__.splice)(events, start, 2, slice)\n }\n\n index = -1\n\n while (++index < jumps.length) {\n gaps[adjust + jumps[index][0]] = adjust + jumps[index][1]\n adjust += jumps[index][1] - jumps[index][0] - 1\n }\n\n return gaps\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-util-subtokenize/dev/index.js?"); /***/ }), /***/ "./node_modules/micromark-util-symbol/lib/codes.js": /*!*********************************************************!*\ !*** ./node_modules/micromark-util-symbol/lib/codes.js ***! \*********************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ codes: () => (/* binding */ codes)\n/* harmony export */ });\n/**\n * Character codes.\n *\n * This module is compiled away!\n *\n * micromark works based on character codes.\n * This module contains constants for the ASCII block and the replacement\n * character.\n * A couple of them are handled in a special way, such as the line endings\n * (CR, LF, and CR+LF, commonly known as end-of-line: EOLs), the tab (horizontal\n * tab) and its expansion based on what column it’s at (virtual space),\n * and the end-of-file (eof) character.\n * As values are preprocessed before handling them, the actual characters LF,\n * CR, HT, and NUL (which is present as the replacement character), are\n * guaranteed to not exist.\n *\n * Unicode basic latin block.\n */\nconst codes = /** @type {const} */ ({\n carriageReturn: -5,\n lineFeed: -4,\n carriageReturnLineFeed: -3,\n horizontalTab: -2,\n virtualSpace: -1,\n eof: null,\n nul: 0,\n soh: 1,\n stx: 2,\n etx: 3,\n eot: 4,\n enq: 5,\n ack: 6,\n bel: 7,\n bs: 8,\n ht: 9, // `\\t`\n lf: 10, // `\\n`\n vt: 11, // `\\v`\n ff: 12, // `\\f`\n cr: 13, // `\\r`\n so: 14,\n si: 15,\n dle: 16,\n dc1: 17,\n dc2: 18,\n dc3: 19,\n dc4: 20,\n nak: 21,\n syn: 22,\n etb: 23,\n can: 24,\n em: 25,\n sub: 26,\n esc: 27,\n fs: 28,\n gs: 29,\n rs: 30,\n us: 31,\n space: 32,\n exclamationMark: 33, // `!`\n quotationMark: 34, // `\"`\n numberSign: 35, // `#`\n dollarSign: 36, // `$`\n percentSign: 37, // `%`\n ampersand: 38, // `&`\n apostrophe: 39, // `'`\n leftParenthesis: 40, // `(`\n rightParenthesis: 41, // `)`\n asterisk: 42, // `*`\n plusSign: 43, // `+`\n comma: 44, // `,`\n dash: 45, // `-`\n dot: 46, // `.`\n slash: 47, // `/`\n digit0: 48, // `0`\n digit1: 49, // `1`\n digit2: 50, // `2`\n digit3: 51, // `3`\n digit4: 52, // `4`\n digit5: 53, // `5`\n digit6: 54, // `6`\n digit7: 55, // `7`\n digit8: 56, // `8`\n digit9: 57, // `9`\n colon: 58, // `:`\n semicolon: 59, // `;`\n lessThan: 60, // `<`\n equalsTo: 61, // `=`\n greaterThan: 62, // `>`\n questionMark: 63, // `?`\n atSign: 64, // `@`\n uppercaseA: 65, // `A`\n uppercaseB: 66, // `B`\n uppercaseC: 67, // `C`\n uppercaseD: 68, // `D`\n uppercaseE: 69, // `E`\n uppercaseF: 70, // `F`\n uppercaseG: 71, // `G`\n uppercaseH: 72, // `H`\n uppercaseI: 73, // `I`\n uppercaseJ: 74, // `J`\n uppercaseK: 75, // `K`\n uppercaseL: 76, // `L`\n uppercaseM: 77, // `M`\n uppercaseN: 78, // `N`\n uppercaseO: 79, // `O`\n uppercaseP: 80, // `P`\n uppercaseQ: 81, // `Q`\n uppercaseR: 82, // `R`\n uppercaseS: 83, // `S`\n uppercaseT: 84, // `T`\n uppercaseU: 85, // `U`\n uppercaseV: 86, // `V`\n uppercaseW: 87, // `W`\n uppercaseX: 88, // `X`\n uppercaseY: 89, // `Y`\n uppercaseZ: 90, // `Z`\n leftSquareBracket: 91, // `[`\n backslash: 92, // `\\`\n rightSquareBracket: 93, // `]`\n caret: 94, // `^`\n underscore: 95, // `_`\n graveAccent: 96, // `` ` ``\n lowercaseA: 97, // `a`\n lowercaseB: 98, // `b`\n lowercaseC: 99, // `c`\n lowercaseD: 100, // `d`\n lowercaseE: 101, // `e`\n lowercaseF: 102, // `f`\n lowercaseG: 103, // `g`\n lowercaseH: 104, // `h`\n lowercaseI: 105, // `i`\n lowercaseJ: 106, // `j`\n lowercaseK: 107, // `k`\n lowercaseL: 108, // `l`\n lowercaseM: 109, // `m`\n lowercaseN: 110, // `n`\n lowercaseO: 111, // `o`\n lowercaseP: 112, // `p`\n lowercaseQ: 113, // `q`\n lowercaseR: 114, // `r`\n lowercaseS: 115, // `s`\n lowercaseT: 116, // `t`\n lowercaseU: 117, // `u`\n lowercaseV: 118, // `v`\n lowercaseW: 119, // `w`\n lowercaseX: 120, // `x`\n lowercaseY: 121, // `y`\n lowercaseZ: 122, // `z`\n leftCurlyBrace: 123, // `{`\n verticalBar: 124, // `|`\n rightCurlyBrace: 125, // `}`\n tilde: 126, // `~`\n del: 127,\n // Unicode Specials block.\n byteOrderMarker: 65279,\n // Unicode Specials block.\n replacementCharacter: 65533 // `�`\n})\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-util-symbol/lib/codes.js?"); /***/ }), /***/ "./node_modules/micromark-util-symbol/lib/constants.js": /*!*************************************************************!*\ !*** ./node_modules/micromark-util-symbol/lib/constants.js ***! \*************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ constants: () => (/* binding */ constants)\n/* harmony export */ });\n/**\n * This module is compiled away!\n *\n * Parsing markdown comes with a couple of constants, such as minimum or maximum\n * sizes of certain sequences.\n * Additionally, there are a couple symbols used inside micromark.\n * These are all defined here, but compiled away by scripts.\n */\nconst constants = /** @type {const} */ ({\n attentionSideBefore: 1, // Symbol to mark an attention sequence as before content: `*a`\n attentionSideAfter: 2, // Symbol to mark an attention sequence as after content: `a*`\n atxHeadingOpeningFenceSizeMax: 6, // 6 number signs is fine, 7 isn’t.\n autolinkDomainSizeMax: 63, // 63 characters is fine, 64 is too many.\n autolinkSchemeSizeMax: 32, // 32 characters is fine, 33 is too many.\n cdataOpeningString: 'CDATA[', // And preceded by ``\n htmlComment: 2, // Symbol for ``\n htmlInstruction: 3, // Symbol for ``\n htmlDeclaration: 4, // Symbol for ``\n htmlCdata: 5, // Symbol for ``\n htmlBasic: 6, // Symbol for ``\n htmlRawSizeMax: 8, // Length of `textarea`.\n linkResourceDestinationBalanceMax: 32, // See: , \n linkReferenceSizeMax: 999, // See: \n listItemValueSizeMax: 10, // See: \n numericBaseDecimal: 10,\n numericBaseHexadecimal: 0x10,\n tabSize: 4, // Tabs have a hard-coded size of 4, per CommonMark.\n thematicBreakMarkerCountMin: 3, // At least 3 asterisks, dashes, or underscores are needed.\n v8MaxSafeChunkSize: 10000 // V8 (and potentially others) have problems injecting giant arrays into other arrays, hence we operate in chunks.\n})\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-util-symbol/lib/constants.js?"); /***/ }), /***/ "./node_modules/micromark-util-symbol/lib/types.js": /*!*********************************************************!*\ !*** ./node_modules/micromark-util-symbol/lib/types.js ***! \*********************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ types: () => (/* binding */ types)\n/* harmony export */ });\n/**\n * This module is compiled away!\n *\n * Here is the list of all types of tokens exposed by micromark, with a short\n * explanation of what they include and where they are found.\n * In picking names, generally, the rule is to be as explicit as possible\n * instead of reusing names.\n * For example, there is a `definitionDestination` and a `resourceDestination`,\n * instead of one shared name.\n */\n\n// Note: when changing the next record, you must also change `TokenTypeMap`\n// in `micromark-util-types/index.d.ts`.\nconst types = /** @type {const} */ ({\n // Generic type for data, such as in a title, a destination, etc.\n data: 'data',\n\n // Generic type for syntactic whitespace (tabs, virtual spaces, spaces).\n // Such as, between a fenced code fence and an info string.\n whitespace: 'whitespace',\n\n // Generic type for line endings (line feed, carriage return, carriage return +\n // line feed).\n lineEnding: 'lineEnding',\n\n // A line ending, but ending a blank line.\n lineEndingBlank: 'lineEndingBlank',\n\n // Generic type for whitespace (tabs, virtual spaces, spaces) at the start of a\n // line.\n linePrefix: 'linePrefix',\n\n // Generic type for whitespace (tabs, virtual spaces, spaces) at the end of a\n // line.\n lineSuffix: 'lineSuffix',\n\n // Whole ATX heading:\n //\n // ```markdown\n // #\n // ## Alpha\n // ### Bravo ###\n // ```\n //\n // Includes `atxHeadingSequence`, `whitespace`, `atxHeadingText`.\n atxHeading: 'atxHeading',\n\n // Sequence of number signs in an ATX heading (`###`).\n atxHeadingSequence: 'atxHeadingSequence',\n\n // Content in an ATX heading (`alpha`).\n // Includes text.\n atxHeadingText: 'atxHeadingText',\n\n // Whole autolink (`` or ``)\n // Includes `autolinkMarker` and `autolinkProtocol` or `autolinkEmail`.\n autolink: 'autolink',\n\n // Email autolink w/o markers (`admin@example.com`)\n autolinkEmail: 'autolinkEmail',\n\n // Marker around an `autolinkProtocol` or `autolinkEmail` (`<` or `>`).\n autolinkMarker: 'autolinkMarker',\n\n // Protocol autolink w/o markers (`https://example.com`)\n autolinkProtocol: 'autolinkProtocol',\n\n // A whole character escape (`\\-`).\n // Includes `escapeMarker` and `characterEscapeValue`.\n characterEscape: 'characterEscape',\n\n // The escaped character (`-`).\n characterEscapeValue: 'characterEscapeValue',\n\n // A whole character reference (`&`, `≠`, or `𝌆`).\n // Includes `characterReferenceMarker`, an optional\n // `characterReferenceMarkerNumeric`, in which case an optional\n // `characterReferenceMarkerHexadecimal`, and a `characterReferenceValue`.\n characterReference: 'characterReference',\n\n // The start or end marker (`&` or `;`).\n characterReferenceMarker: 'characterReferenceMarker',\n\n // Mark reference as numeric (`#`).\n characterReferenceMarkerNumeric: 'characterReferenceMarkerNumeric',\n\n // Mark reference as numeric (`x` or `X`).\n characterReferenceMarkerHexadecimal: 'characterReferenceMarkerHexadecimal',\n\n // Value of character reference w/o markers (`amp`, `8800`, or `1D306`).\n characterReferenceValue: 'characterReferenceValue',\n\n // Whole fenced code:\n //\n // ````markdown\n // ```js\n // alert(1)\n // ```\n // ````\n codeFenced: 'codeFenced',\n\n // A fenced code fence, including whitespace, sequence, info, and meta\n // (` ```js `).\n codeFencedFence: 'codeFencedFence',\n\n // Sequence of grave accent or tilde characters (` ``` `) in a fence.\n codeFencedFenceSequence: 'codeFencedFenceSequence',\n\n // Info word (`js`) in a fence.\n // Includes string.\n codeFencedFenceInfo: 'codeFencedFenceInfo',\n\n // Meta words (`highlight=\"1\"`) in a fence.\n // Includes string.\n codeFencedFenceMeta: 'codeFencedFenceMeta',\n\n // A line of code.\n codeFlowValue: 'codeFlowValue',\n\n // Whole indented code:\n //\n // ```markdown\n // alert(1)\n // ```\n //\n // Includes `lineEnding`, `linePrefix`, and `codeFlowValue`.\n codeIndented: 'codeIndented',\n\n // A text code (``` `alpha` ```).\n // Includes `codeTextSequence`, `codeTextData`, `lineEnding`, and can include\n // `codeTextPadding`.\n codeText: 'codeText',\n\n codeTextData: 'codeTextData',\n\n // A space or line ending right after or before a tick.\n codeTextPadding: 'codeTextPadding',\n\n // A text code fence (` `` `).\n codeTextSequence: 'codeTextSequence',\n\n // Whole content:\n //\n // ```markdown\n // [a]: b\n // c\n // =\n // d\n // ```\n //\n // Includes `paragraph` and `definition`.\n content: 'content',\n // Whole definition:\n //\n // ```markdown\n // [micromark]: https://github.com/micromark/micromark\n // ```\n //\n // Includes `definitionLabel`, `definitionMarker`, `whitespace`,\n // `definitionDestination`, and optionally `lineEnding` and `definitionTitle`.\n definition: 'definition',\n\n // Destination of a definition (`https://github.com/micromark/micromark` or\n // ``).\n // Includes `definitionDestinationLiteral` or `definitionDestinationRaw`.\n definitionDestination: 'definitionDestination',\n\n // Enclosed destination of a definition\n // (``).\n // Includes `definitionDestinationLiteralMarker` and optionally\n // `definitionDestinationString`.\n definitionDestinationLiteral: 'definitionDestinationLiteral',\n\n // Markers of an enclosed definition destination (`<` or `>`).\n definitionDestinationLiteralMarker: 'definitionDestinationLiteralMarker',\n\n // Unenclosed destination of a definition\n // (`https://github.com/micromark/micromark`).\n // Includes `definitionDestinationString`.\n definitionDestinationRaw: 'definitionDestinationRaw',\n\n // Text in an destination (`https://github.com/micromark/micromark`).\n // Includes string.\n definitionDestinationString: 'definitionDestinationString',\n\n // Label of a definition (`[micromark]`).\n // Includes `definitionLabelMarker` and `definitionLabelString`.\n definitionLabel: 'definitionLabel',\n\n // Markers of a definition label (`[` or `]`).\n definitionLabelMarker: 'definitionLabelMarker',\n\n // Value of a definition label (`micromark`).\n // Includes string.\n definitionLabelString: 'definitionLabelString',\n\n // Marker between a label and a destination (`:`).\n definitionMarker: 'definitionMarker',\n\n // Title of a definition (`\"x\"`, `'y'`, or `(z)`).\n // Includes `definitionTitleMarker` and optionally `definitionTitleString`.\n definitionTitle: 'definitionTitle',\n\n // Marker around a title of a definition (`\"`, `'`, `(`, or `)`).\n definitionTitleMarker: 'definitionTitleMarker',\n\n // Data without markers in a title (`z`).\n // Includes string.\n definitionTitleString: 'definitionTitleString',\n\n // Emphasis (`*alpha*`).\n // Includes `emphasisSequence` and `emphasisText`.\n emphasis: 'emphasis',\n\n // Sequence of emphasis markers (`*` or `_`).\n emphasisSequence: 'emphasisSequence',\n\n // Emphasis text (`alpha`).\n // Includes text.\n emphasisText: 'emphasisText',\n\n // The character escape marker (`\\`).\n escapeMarker: 'escapeMarker',\n\n // A hard break created with a backslash (`\\\\n`).\n // Note: does not include the line ending.\n hardBreakEscape: 'hardBreakEscape',\n\n // A hard break created with trailing spaces (` \\n`).\n // Does not include the line ending.\n hardBreakTrailing: 'hardBreakTrailing',\n\n // Flow HTML:\n //\n // ```markdown\n // b`).\n // Includes `lineEnding`, `htmlTextData`.\n htmlText: 'htmlText',\n\n htmlTextData: 'htmlTextData',\n\n // Whole image (`![alpha](bravo)`, `![alpha][bravo]`, `![alpha][]`, or\n // `![alpha]`).\n // Includes `label` and an optional `resource` or `reference`.\n image: 'image',\n\n // Whole link label (`[*alpha*]`).\n // Includes `labelLink` or `labelImage`, `labelText`, and `labelEnd`.\n label: 'label',\n\n // Text in an label (`*alpha*`).\n // Includes text.\n labelText: 'labelText',\n\n // Start a link label (`[`).\n // Includes a `labelMarker`.\n labelLink: 'labelLink',\n\n // Start an image label (`![`).\n // Includes `labelImageMarker` and `labelMarker`.\n labelImage: 'labelImage',\n\n // Marker of a label (`[` or `]`).\n labelMarker: 'labelMarker',\n\n // Marker to start an image (`!`).\n labelImageMarker: 'labelImageMarker',\n\n // End a label (`]`).\n // Includes `labelMarker`.\n labelEnd: 'labelEnd',\n\n // Whole link (`[alpha](bravo)`, `[alpha][bravo]`, `[alpha][]`, or `[alpha]`).\n // Includes `label` and an optional `resource` or `reference`.\n link: 'link',\n\n // Whole paragraph:\n //\n // ```markdown\n // alpha\n // bravo.\n // ```\n //\n // Includes text.\n paragraph: 'paragraph',\n\n // A reference (`[alpha]` or `[]`).\n // Includes `referenceMarker` and an optional `referenceString`.\n reference: 'reference',\n\n // A reference marker (`[` or `]`).\n referenceMarker: 'referenceMarker',\n\n // Reference text (`alpha`).\n // Includes string.\n referenceString: 'referenceString',\n\n // A resource (`(https://example.com \"alpha\")`).\n // Includes `resourceMarker`, an optional `resourceDestination` with an optional\n // `whitespace` and `resourceTitle`.\n resource: 'resource',\n\n // A resource destination (`https://example.com`).\n // Includes `resourceDestinationLiteral` or `resourceDestinationRaw`.\n resourceDestination: 'resourceDestination',\n\n // A literal resource destination (``).\n // Includes `resourceDestinationLiteralMarker` and optionally\n // `resourceDestinationString`.\n resourceDestinationLiteral: 'resourceDestinationLiteral',\n\n // A resource destination marker (`<` or `>`).\n resourceDestinationLiteralMarker: 'resourceDestinationLiteralMarker',\n\n // A raw resource destination (`https://example.com`).\n // Includes `resourceDestinationString`.\n resourceDestinationRaw: 'resourceDestinationRaw',\n\n // Resource destination text (`https://example.com`).\n // Includes string.\n resourceDestinationString: 'resourceDestinationString',\n\n // A resource marker (`(` or `)`).\n resourceMarker: 'resourceMarker',\n\n // A resource title (`\"alpha\"`, `'alpha'`, or `(alpha)`).\n // Includes `resourceTitleMarker` and optionally `resourceTitleString`.\n resourceTitle: 'resourceTitle',\n\n // A resource title marker (`\"`, `'`, `(`, or `)`).\n resourceTitleMarker: 'resourceTitleMarker',\n\n // Resource destination title (`alpha`).\n // Includes string.\n resourceTitleString: 'resourceTitleString',\n\n // Whole setext heading:\n //\n // ```markdown\n // alpha\n // bravo\n // =====\n // ```\n //\n // Includes `setextHeadingText`, `lineEnding`, `linePrefix`, and\n // `setextHeadingLine`.\n setextHeading: 'setextHeading',\n\n // Content in a setext heading (`alpha\\nbravo`).\n // Includes text.\n setextHeadingText: 'setextHeadingText',\n\n // Underline in a setext heading, including whitespace suffix (`==`).\n // Includes `setextHeadingLineSequence`.\n setextHeadingLine: 'setextHeadingLine',\n\n // Sequence of equals or dash characters in underline in a setext heading (`-`).\n setextHeadingLineSequence: 'setextHeadingLineSequence',\n\n // Strong (`**alpha**`).\n // Includes `strongSequence` and `strongText`.\n strong: 'strong',\n\n // Sequence of strong markers (`**` or `__`).\n strongSequence: 'strongSequence',\n\n // Strong text (`alpha`).\n // Includes text.\n strongText: 'strongText',\n\n // Whole thematic break:\n //\n // ```markdown\n // * * *\n // ```\n //\n // Includes `thematicBreakSequence` and `whitespace`.\n thematicBreak: 'thematicBreak',\n\n // A sequence of one or more thematic break markers (`***`).\n thematicBreakSequence: 'thematicBreakSequence',\n\n // Whole block quote:\n //\n // ```markdown\n // > a\n // >\n // > b\n // ```\n //\n // Includes `blockQuotePrefix` and flow.\n blockQuote: 'blockQuote',\n // The `>` or `> ` of a block quote.\n blockQuotePrefix: 'blockQuotePrefix',\n // The `>` of a block quote prefix.\n blockQuoteMarker: 'blockQuoteMarker',\n // The optional ` ` of a block quote prefix.\n blockQuotePrefixWhitespace: 'blockQuotePrefixWhitespace',\n\n // Whole unordered list:\n //\n // ```markdown\n // - a\n // b\n // ```\n //\n // Includes `listItemPrefix`, flow, and optionally `listItemIndent` on further\n // lines.\n listOrdered: 'listOrdered',\n\n // Whole ordered list:\n //\n // ```markdown\n // 1. a\n // b\n // ```\n //\n // Includes `listItemPrefix`, flow, and optionally `listItemIndent` on further\n // lines.\n listUnordered: 'listUnordered',\n\n // The indent of further list item lines.\n listItemIndent: 'listItemIndent',\n\n // A marker, as in, `*`, `+`, `-`, `.`, or `)`.\n listItemMarker: 'listItemMarker',\n\n // The thing that starts a list item, such as `1. `.\n // Includes `listItemValue` if ordered, `listItemMarker`, and\n // `listItemPrefixWhitespace` (unless followed by a line ending).\n listItemPrefix: 'listItemPrefix',\n\n // The whitespace after a marker.\n listItemPrefixWhitespace: 'listItemPrefixWhitespace',\n\n // The numerical value of an ordered item.\n listItemValue: 'listItemValue',\n\n // Internal types used for subtokenizers, compiled away\n chunkDocument: 'chunkDocument',\n chunkContent: 'chunkContent',\n chunkFlow: 'chunkFlow',\n chunkText: 'chunkText',\n chunkString: 'chunkString'\n})\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-util-symbol/lib/types.js?"); /***/ }), /***/ "./node_modules/micromark-util-symbol/lib/values.js": /*!**********************************************************!*\ !*** ./node_modules/micromark-util-symbol/lib/values.js ***! \**********************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ values: () => (/* binding */ values)\n/* harmony export */ });\n/**\n * This module is compiled away!\n *\n * While micromark works based on character codes, this module includes the\n * string versions of ’em.\n * The C0 block, except for LF, CR, HT, and w/ the replacement character added,\n * are available here.\n */\nconst values = /** @type {const} */ ({\n ht: '\\t',\n lf: '\\n',\n cr: '\\r',\n space: ' ',\n exclamationMark: '!',\n quotationMark: '\"',\n numberSign: '#',\n dollarSign: '$',\n percentSign: '%',\n ampersand: '&',\n apostrophe: \"'\",\n leftParenthesis: '(',\n rightParenthesis: ')',\n asterisk: '*',\n plusSign: '+',\n comma: ',',\n dash: '-',\n dot: '.',\n slash: '/',\n digit0: '0',\n digit1: '1',\n digit2: '2',\n digit3: '3',\n digit4: '4',\n digit5: '5',\n digit6: '6',\n digit7: '7',\n digit8: '8',\n digit9: '9',\n colon: ':',\n semicolon: ';',\n lessThan: '<',\n equalsTo: '=',\n greaterThan: '>',\n questionMark: '?',\n atSign: '@',\n uppercaseA: 'A',\n uppercaseB: 'B',\n uppercaseC: 'C',\n uppercaseD: 'D',\n uppercaseE: 'E',\n uppercaseF: 'F',\n uppercaseG: 'G',\n uppercaseH: 'H',\n uppercaseI: 'I',\n uppercaseJ: 'J',\n uppercaseK: 'K',\n uppercaseL: 'L',\n uppercaseM: 'M',\n uppercaseN: 'N',\n uppercaseO: 'O',\n uppercaseP: 'P',\n uppercaseQ: 'Q',\n uppercaseR: 'R',\n uppercaseS: 'S',\n uppercaseT: 'T',\n uppercaseU: 'U',\n uppercaseV: 'V',\n uppercaseW: 'W',\n uppercaseX: 'X',\n uppercaseY: 'Y',\n uppercaseZ: 'Z',\n leftSquareBracket: '[',\n backslash: '\\\\',\n rightSquareBracket: ']',\n caret: '^',\n underscore: '_',\n graveAccent: '`',\n lowercaseA: 'a',\n lowercaseB: 'b',\n lowercaseC: 'c',\n lowercaseD: 'd',\n lowercaseE: 'e',\n lowercaseF: 'f',\n lowercaseG: 'g',\n lowercaseH: 'h',\n lowercaseI: 'i',\n lowercaseJ: 'j',\n lowercaseK: 'k',\n lowercaseL: 'l',\n lowercaseM: 'm',\n lowercaseN: 'n',\n lowercaseO: 'o',\n lowercaseP: 'p',\n lowercaseQ: 'q',\n lowercaseR: 'r',\n lowercaseS: 's',\n lowercaseT: 't',\n lowercaseU: 'u',\n lowercaseV: 'v',\n lowercaseW: 'w',\n lowercaseX: 'x',\n lowercaseY: 'y',\n lowercaseZ: 'z',\n leftCurlyBrace: '{',\n verticalBar: '|',\n rightCurlyBrace: '}',\n tilde: '~',\n replacementCharacter: '�'\n})\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark-util-symbol/lib/values.js?"); /***/ }), /***/ "./node_modules/micromark/dev/lib/constructs.js": /*!******************************************************!*\ !*** ./node_modules/micromark/dev/lib/constructs.js ***! \******************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ attentionMarkers: () => (/* binding */ attentionMarkers),\n/* harmony export */ contentInitial: () => (/* binding */ contentInitial),\n/* harmony export */ disable: () => (/* binding */ disable),\n/* harmony export */ document: () => (/* binding */ document),\n/* harmony export */ flow: () => (/* binding */ flow),\n/* harmony export */ flowInitial: () => (/* binding */ flowInitial),\n/* harmony export */ insideSpan: () => (/* binding */ insideSpan),\n/* harmony export */ string: () => (/* binding */ string),\n/* harmony export */ text: () => (/* binding */ text)\n/* harmony export */ });\n/* harmony import */ var micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! micromark-core-commonmark */ \"./node_modules/micromark-core-commonmark/dev/lib/list.js\");\n/* harmony import */ var micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! micromark-core-commonmark */ \"./node_modules/micromark-core-commonmark/dev/lib/block-quote.js\");\n/* harmony import */ var micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! micromark-core-commonmark */ \"./node_modules/micromark-core-commonmark/dev/lib/definition.js\");\n/* harmony import */ var micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! micromark-core-commonmark */ \"./node_modules/micromark-core-commonmark/dev/lib/code-indented.js\");\n/* harmony import */ var micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! micromark-core-commonmark */ \"./node_modules/micromark-core-commonmark/dev/lib/heading-atx.js\");\n/* harmony import */ var micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! micromark-core-commonmark */ \"./node_modules/micromark-core-commonmark/dev/lib/thematic-break.js\");\n/* harmony import */ var micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! micromark-core-commonmark */ \"./node_modules/micromark-core-commonmark/dev/lib/setext-underline.js\");\n/* harmony import */ var micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! micromark-core-commonmark */ \"./node_modules/micromark-core-commonmark/dev/lib/html-flow.js\");\n/* harmony import */ var micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! micromark-core-commonmark */ \"./node_modules/micromark-core-commonmark/dev/lib/code-fenced.js\");\n/* harmony import */ var micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! micromark-core-commonmark */ \"./node_modules/micromark-core-commonmark/dev/lib/character-reference.js\");\n/* harmony import */ var micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! micromark-core-commonmark */ \"./node_modules/micromark-core-commonmark/dev/lib/character-escape.js\");\n/* harmony import */ var micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! micromark-core-commonmark */ \"./node_modules/micromark-core-commonmark/dev/lib/line-ending.js\");\n/* harmony import */ var micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! micromark-core-commonmark */ \"./node_modules/micromark-core-commonmark/dev/lib/label-start-image.js\");\n/* harmony import */ var micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! micromark-core-commonmark */ \"./node_modules/micromark-core-commonmark/dev/lib/attention.js\");\n/* harmony import */ var micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! micromark-core-commonmark */ \"./node_modules/micromark-core-commonmark/dev/lib/autolink.js\");\n/* harmony import */ var micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! micromark-core-commonmark */ \"./node_modules/micromark-core-commonmark/dev/lib/html-text.js\");\n/* harmony import */ var micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! micromark-core-commonmark */ \"./node_modules/micromark-core-commonmark/dev/lib/label-start-link.js\");\n/* harmony import */ var micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! micromark-core-commonmark */ \"./node_modules/micromark-core-commonmark/dev/lib/hard-break-escape.js\");\n/* harmony import */ var micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! micromark-core-commonmark */ \"./node_modules/micromark-core-commonmark/dev/lib/label-end.js\");\n/* harmony import */ var micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! micromark-core-commonmark */ \"./node_modules/micromark-core-commonmark/dev/lib/code-text.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/codes.js\");\n/* harmony import */ var _initialize_text_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./initialize/text.js */ \"./node_modules/micromark/dev/lib/initialize/text.js\");\n/**\n * @typedef {import('micromark-util-types').Extension} Extension\n */\n\n\n\n\n\n/** @satisfies {Extension['document']} */\nconst document = {\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.asterisk]: micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_1__.list,\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.plusSign]: micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_1__.list,\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.dash]: micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_1__.list,\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.digit0]: micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_1__.list,\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.digit1]: micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_1__.list,\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.digit2]: micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_1__.list,\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.digit3]: micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_1__.list,\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.digit4]: micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_1__.list,\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.digit5]: micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_1__.list,\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.digit6]: micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_1__.list,\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.digit7]: micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_1__.list,\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.digit8]: micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_1__.list,\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.digit9]: micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_1__.list,\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.greaterThan]: micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_2__.blockQuote\n}\n\n/** @satisfies {Extension['contentInitial']} */\nconst contentInitial = {\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.leftSquareBracket]: micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_3__.definition\n}\n\n/** @satisfies {Extension['flowInitial']} */\nconst flowInitial = {\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.horizontalTab]: micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_4__.codeIndented,\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.virtualSpace]: micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_4__.codeIndented,\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.space]: micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_4__.codeIndented\n}\n\n/** @satisfies {Extension['flow']} */\nconst flow = {\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.numberSign]: micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_5__.headingAtx,\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.asterisk]: micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_6__.thematicBreak,\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.dash]: [micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_7__.setextUnderline, micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_6__.thematicBreak],\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.lessThan]: micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_8__.htmlFlow,\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.equalsTo]: micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_7__.setextUnderline,\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.underscore]: micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_6__.thematicBreak,\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.graveAccent]: micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_9__.codeFenced,\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.tilde]: micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_9__.codeFenced\n}\n\n/** @satisfies {Extension['string']} */\nconst string = {\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.ampersand]: micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_10__.characterReference,\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.backslash]: micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_11__.characterEscape\n}\n\n/** @satisfies {Extension['text']} */\nconst text = {\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.carriageReturn]: micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_12__.lineEnding,\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.lineFeed]: micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_12__.lineEnding,\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.carriageReturnLineFeed]: micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_12__.lineEnding,\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.exclamationMark]: micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_13__.labelStartImage,\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.ampersand]: micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_10__.characterReference,\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.asterisk]: micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_14__.attention,\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.lessThan]: [micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_15__.autolink, micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_16__.htmlText],\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.leftSquareBracket]: micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_17__.labelStartLink,\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.backslash]: [micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_18__.hardBreakEscape, micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_11__.characterEscape],\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.rightSquareBracket]: micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_19__.labelEnd,\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.underscore]: micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_14__.attention,\n [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.graveAccent]: micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_20__.codeText\n}\n\n/** @satisfies {Extension['insideSpan']} */\nconst insideSpan = {null: [micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_14__.attention, _initialize_text_js__WEBPACK_IMPORTED_MODULE_21__.resolver]}\n\n/** @satisfies {Extension['attentionMarkers']} */\nconst attentionMarkers = {null: [micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.asterisk, micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.underscore]}\n\n/** @satisfies {Extension['disable']} */\nconst disable = {null: []}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark/dev/lib/constructs.js?"); /***/ }), /***/ "./node_modules/micromark/dev/lib/create-tokenizer.js": /*!************************************************************!*\ !*** ./node_modules/micromark/dev/lib/create-tokenizer.js ***! \************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createTokenizer: () => (/* binding */ createTokenizer)\n/* harmony export */ });\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\");\n/* harmony import */ var micromark_util_character__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! micromark-util-character */ \"./node_modules/micromark-util-character/dev/index.js\");\n/* harmony import */ var micromark_util_chunked__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! micromark-util-chunked */ \"./node_modules/micromark-util-chunked/dev/index.js\");\n/* harmony import */ var micromark_util_resolve_all__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! micromark-util-resolve-all */ \"./node_modules/micromark-util-resolve-all/index.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/codes.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/values.js\");\n/* harmony import */ var devlop__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! devlop */ \"./node_modules/devlop/lib/development.js\");\n/**\n * @typedef {import('micromark-util-types').Chunk} Chunk\n * @typedef {import('micromark-util-types').Code} Code\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').ConstructRecord} ConstructRecord\n * @typedef {import('micromark-util-types').Effects} Effects\n * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct\n * @typedef {import('micromark-util-types').ParseContext} ParseContext\n * @typedef {import('micromark-util-types').Point} Point\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').TokenType} TokenType\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n */\n\n/**\n * @callback Restore\n * @returns {undefined}\n *\n * @typedef Info\n * @property {Restore} restore\n * @property {number} from\n *\n * @callback ReturnHandle\n * Handle a successful run.\n * @param {Construct} construct\n * @param {Info} info\n * @returns {undefined}\n */\n\n\n\n\n\n\n\n\nconst debug = debug__WEBPACK_IMPORTED_MODULE_0__('micromark')\n\n/**\n * Create a tokenizer.\n * Tokenizers deal with one type of data (e.g., containers, flow, text).\n * The parser is the object dealing with it all.\n * `initialize` works like other constructs, except that only its `tokenize`\n * function is used, in which case it doesn’t receive an `ok` or `nok`.\n * `from` can be given to set the point before the first character, although\n * when further lines are indented, they must be set with `defineSkip`.\n *\n * @param {ParseContext} parser\n * @param {InitialConstruct} initialize\n * @param {Omit | undefined} [from]\n * @returns {TokenizeContext}\n */\nfunction createTokenizer(parser, initialize, from) {\n /** @type {Point} */\n let point = Object.assign(\n from ? Object.assign({}, from) : {line: 1, column: 1, offset: 0},\n {_index: 0, _bufferIndex: -1}\n )\n /** @type {Record} */\n const columnStart = {}\n /** @type {Array} */\n const resolveAllConstructs = []\n /** @type {Array} */\n let chunks = []\n /** @type {Array} */\n let stack = []\n /** @type {boolean | undefined} */\n let consumed = true\n\n /**\n * Tools used for tokenizing.\n *\n * @type {Effects}\n */\n const effects = {\n consume,\n enter,\n exit,\n attempt: constructFactory(onsuccessfulconstruct),\n check: constructFactory(onsuccessfulcheck),\n interrupt: constructFactory(onsuccessfulcheck, {interrupt: true})\n }\n\n /**\n * State and tools for resolving and serializing.\n *\n * @type {TokenizeContext}\n */\n const context = {\n previous: micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.eof,\n code: micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.eof,\n containerState: {},\n events: [],\n parser,\n sliceStream,\n sliceSerialize,\n now,\n defineSkip,\n write\n }\n\n /**\n * The state function.\n *\n * @type {State | undefined}\n */\n let state = initialize.tokenize.call(context, effects)\n\n /**\n * Track which character we expect to be consumed, to catch bugs.\n *\n * @type {Code}\n */\n let expectedCode\n\n if (initialize.resolveAll) {\n resolveAllConstructs.push(initialize)\n }\n\n return context\n\n /** @type {TokenizeContext['write']} */\n function write(slice) {\n chunks = (0,micromark_util_chunked__WEBPACK_IMPORTED_MODULE_2__.push)(chunks, slice)\n\n main()\n\n // Exit if we’re not done, resolve might change stuff.\n if (chunks[chunks.length - 1] !== micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.eof) {\n return []\n }\n\n addResult(initialize, 0)\n\n // Otherwise, resolve, and exit.\n context.events = (0,micromark_util_resolve_all__WEBPACK_IMPORTED_MODULE_3__.resolveAll)(resolveAllConstructs, context.events, context)\n\n return context.events\n }\n\n //\n // Tools.\n //\n\n /** @type {TokenizeContext['sliceSerialize']} */\n function sliceSerialize(token, expandTabs) {\n return serializeChunks(sliceStream(token), expandTabs)\n }\n\n /** @type {TokenizeContext['sliceStream']} */\n function sliceStream(token) {\n return sliceChunks(chunks, token)\n }\n\n /** @type {TokenizeContext['now']} */\n function now() {\n // This is a hot path, so we clone manually instead of `Object.assign({}, point)`\n const {line, column, offset, _index, _bufferIndex} = point\n return {line, column, offset, _index, _bufferIndex}\n }\n\n /** @type {TokenizeContext['defineSkip']} */\n function defineSkip(value) {\n columnStart[value.line] = value.column\n accountForPotentialSkip()\n debug('position: define skip: `%j`', point)\n }\n\n //\n // State management.\n //\n\n /**\n * Main loop (note that `_index` and `_bufferIndex` in `point` are modified by\n * `consume`).\n * Here is where we walk through the chunks, which either include strings of\n * several characters, or numerical character codes.\n * The reason to do this in a loop instead of a call is so the stack can\n * drain.\n *\n * @returns {undefined}\n */\n function main() {\n /** @type {number} */\n let chunkIndex\n\n while (point._index < chunks.length) {\n const chunk = chunks[point._index]\n\n // If we’re in a buffer chunk, loop through it.\n if (typeof chunk === 'string') {\n chunkIndex = point._index\n\n if (point._bufferIndex < 0) {\n point._bufferIndex = 0\n }\n\n while (\n point._index === chunkIndex &&\n point._bufferIndex < chunk.length\n ) {\n go(chunk.charCodeAt(point._bufferIndex))\n }\n } else {\n go(chunk)\n }\n }\n }\n\n /**\n * Deal with one code.\n *\n * @param {Code} code\n * @returns {undefined}\n */\n function go(code) {\n (0,devlop__WEBPACK_IMPORTED_MODULE_4__.ok)(consumed === true, 'expected character to be consumed')\n consumed = undefined\n debug('main: passing `%s` to %s', code, state && state.name)\n expectedCode = code\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_4__.ok)(typeof state === 'function', 'expected state')\n state = state(code)\n }\n\n /** @type {Effects['consume']} */\n function consume(code) {\n (0,devlop__WEBPACK_IMPORTED_MODULE_4__.ok)(code === expectedCode, 'expected given code to equal expected code')\n\n debug('consume: `%s`', code)\n\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_4__.ok)(\n consumed === undefined,\n 'expected code to not have been consumed: this might be because `return x(code)` instead of `return x` was used'\n )\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_4__.ok)(\n code === null\n ? context.events.length === 0 ||\n context.events[context.events.length - 1][0] === 'exit'\n : context.events[context.events.length - 1][0] === 'enter',\n 'expected last token to be open'\n )\n\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_5__.markdownLineEnding)(code)) {\n point.line++\n point.column = 1\n point.offset += code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.carriageReturnLineFeed ? 2 : 1\n accountForPotentialSkip()\n debug('position: after eol: `%j`', point)\n } else if (code !== micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.virtualSpace) {\n point.column++\n point.offset++\n }\n\n // Not in a string chunk.\n if (point._bufferIndex < 0) {\n point._index++\n } else {\n point._bufferIndex++\n\n // At end of string chunk.\n // @ts-expect-error Points w/ non-negative `_bufferIndex` reference\n // strings.\n if (point._bufferIndex === chunks[point._index].length) {\n point._bufferIndex = -1\n point._index++\n }\n }\n\n // Expose the previous character.\n context.previous = code\n\n // Mark as consumed.\n consumed = true\n }\n\n /** @type {Effects['enter']} */\n function enter(type, fields) {\n /** @type {Token} */\n // @ts-expect-error Patch instead of assign required fields to help GC.\n const token = fields || {}\n token.type = type\n token.start = now()\n\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_4__.ok)(typeof type === 'string', 'expected string type')\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_4__.ok)(type.length > 0, 'expected non-empty string')\n debug('enter: `%s`', type)\n\n context.events.push(['enter', token, context])\n\n stack.push(token)\n\n return token\n }\n\n /** @type {Effects['exit']} */\n function exit(type) {\n (0,devlop__WEBPACK_IMPORTED_MODULE_4__.ok)(typeof type === 'string', 'expected string type')\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_4__.ok)(type.length > 0, 'expected non-empty string')\n\n const token = stack.pop()\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_4__.ok)(token, 'cannot close w/o open tokens')\n token.end = now()\n\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_4__.ok)(type === token.type, 'expected exit token to match current token')\n\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_4__.ok)(\n !(\n token.start._index === token.end._index &&\n token.start._bufferIndex === token.end._bufferIndex\n ),\n 'expected non-empty token (`' + type + '`)'\n )\n\n debug('exit: `%s`', token.type)\n context.events.push(['exit', token, context])\n\n return token\n }\n\n /**\n * Use results.\n *\n * @type {ReturnHandle}\n */\n function onsuccessfulconstruct(construct, info) {\n addResult(construct, info.from)\n }\n\n /**\n * Discard results.\n *\n * @type {ReturnHandle}\n */\n function onsuccessfulcheck(_, info) {\n info.restore()\n }\n\n /**\n * Factory to attempt/check/interrupt.\n *\n * @param {ReturnHandle} onreturn\n * @param {{interrupt?: boolean | undefined} | undefined} [fields]\n */\n function constructFactory(onreturn, fields) {\n return hook\n\n /**\n * Handle either an object mapping codes to constructs, a list of\n * constructs, or a single construct.\n *\n * @param {Array | Construct | ConstructRecord} constructs\n * @param {State} returnState\n * @param {State | undefined} [bogusState]\n * @returns {State}\n */\n function hook(constructs, returnState, bogusState) {\n /** @type {Array} */\n let listOfConstructs\n /** @type {number} */\n let constructIndex\n /** @type {Construct} */\n let currentConstruct\n /** @type {Info} */\n let info\n\n return Array.isArray(constructs)\n ? /* c8 ignore next 1 */\n handleListOfConstructs(constructs)\n : 'tokenize' in constructs\n ? // @ts-expect-error Looks like a construct.\n handleListOfConstructs([constructs])\n : handleMapOfConstructs(constructs)\n\n /**\n * Handle a list of construct.\n *\n * @param {ConstructRecord} map\n * @returns {State}\n */\n function handleMapOfConstructs(map) {\n return start\n\n /** @type {State} */\n function start(code) {\n const def = code !== null && map[code]\n const all = code !== null && map.null\n const list = [\n // To do: add more extension tests.\n /* c8 ignore next 2 */\n ...(Array.isArray(def) ? def : def ? [def] : []),\n ...(Array.isArray(all) ? all : all ? [all] : [])\n ]\n\n return handleListOfConstructs(list)(code)\n }\n }\n\n /**\n * Handle a list of construct.\n *\n * @param {Array} list\n * @returns {State}\n */\n function handleListOfConstructs(list) {\n listOfConstructs = list\n constructIndex = 0\n\n if (list.length === 0) {\n (0,devlop__WEBPACK_IMPORTED_MODULE_4__.ok)(bogusState, 'expected `bogusState` to be given')\n return bogusState\n }\n\n return handleConstruct(list[constructIndex])\n }\n\n /**\n * Handle a single construct.\n *\n * @param {Construct} construct\n * @returns {State}\n */\n function handleConstruct(construct) {\n return start\n\n /** @type {State} */\n function start(code) {\n // To do: not needed to store if there is no bogus state, probably?\n // Currently doesn’t work because `inspect` in document does a check\n // w/o a bogus, which doesn’t make sense. But it does seem to help perf\n // by not storing.\n info = store()\n currentConstruct = construct\n\n if (!construct.partial) {\n context.currentConstruct = construct\n }\n\n // Always populated by defaults.\n (0,devlop__WEBPACK_IMPORTED_MODULE_4__.ok)(\n context.parser.constructs.disable.null,\n 'expected `disable.null` to be populated'\n )\n\n if (\n construct.name &&\n context.parser.constructs.disable.null.includes(construct.name)\n ) {\n return nok(code)\n }\n\n return construct.tokenize.call(\n // If we do have fields, create an object w/ `context` as its\n // prototype.\n // This allows a “live binding”, which is needed for `interrupt`.\n fields ? Object.assign(Object.create(context), fields) : context,\n effects,\n ok,\n nok\n )(code)\n }\n }\n\n /** @type {State} */\n function ok(code) {\n (0,devlop__WEBPACK_IMPORTED_MODULE_4__.ok)(code === expectedCode, 'expected code')\n consumed = true\n onreturn(currentConstruct, info)\n return returnState\n }\n\n /** @type {State} */\n function nok(code) {\n (0,devlop__WEBPACK_IMPORTED_MODULE_4__.ok)(code === expectedCode, 'expected code')\n consumed = true\n info.restore()\n\n if (++constructIndex < listOfConstructs.length) {\n return handleConstruct(listOfConstructs[constructIndex])\n }\n\n return bogusState\n }\n }\n }\n\n /**\n * @param {Construct} construct\n * @param {number} from\n * @returns {undefined}\n */\n function addResult(construct, from) {\n if (construct.resolveAll && !resolveAllConstructs.includes(construct)) {\n resolveAllConstructs.push(construct)\n }\n\n if (construct.resolve) {\n (0,micromark_util_chunked__WEBPACK_IMPORTED_MODULE_2__.splice)(\n context.events,\n from,\n context.events.length - from,\n construct.resolve(context.events.slice(from), context)\n )\n }\n\n if (construct.resolveTo) {\n context.events = construct.resolveTo(context.events, context)\n }\n\n (0,devlop__WEBPACK_IMPORTED_MODULE_4__.ok)(\n construct.partial ||\n context.events.length === 0 ||\n context.events[context.events.length - 1][0] === 'exit',\n 'expected last token to end'\n )\n }\n\n /**\n * Store state.\n *\n * @returns {Info}\n */\n function store() {\n const startPoint = now()\n const startPrevious = context.previous\n const startCurrentConstruct = context.currentConstruct\n const startEventsIndex = context.events.length\n const startStack = Array.from(stack)\n\n return {restore, from: startEventsIndex}\n\n /**\n * Restore state.\n *\n * @returns {undefined}\n */\n function restore() {\n point = startPoint\n context.previous = startPrevious\n context.currentConstruct = startCurrentConstruct\n context.events.length = startEventsIndex\n stack = startStack\n accountForPotentialSkip()\n debug('position: restore: `%j`', point)\n }\n }\n\n /**\n * Move the current point a bit forward in the line when it’s on a column\n * skip.\n *\n * @returns {undefined}\n */\n function accountForPotentialSkip() {\n if (point.line in columnStart && point.column < 2) {\n point.column = columnStart[point.line]\n point.offset += columnStart[point.line] - 1\n }\n }\n}\n\n/**\n * Get the chunks from a slice of chunks in the range of a token.\n *\n * @param {Array} chunks\n * @param {Pick} token\n * @returns {Array}\n */\nfunction sliceChunks(chunks, token) {\n const startIndex = token.start._index\n const startBufferIndex = token.start._bufferIndex\n const endIndex = token.end._index\n const endBufferIndex = token.end._bufferIndex\n /** @type {Array} */\n let view\n\n if (startIndex === endIndex) {\n (0,devlop__WEBPACK_IMPORTED_MODULE_4__.ok)(endBufferIndex > -1, 'expected non-negative end buffer index')\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_4__.ok)(startBufferIndex > -1, 'expected non-negative start buffer index')\n // @ts-expect-error `_bufferIndex` is used on string chunks.\n view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)]\n } else {\n view = chunks.slice(startIndex, endIndex)\n\n if (startBufferIndex > -1) {\n const head = view[0]\n if (typeof head === 'string') {\n view[0] = head.slice(startBufferIndex)\n } else {\n (0,devlop__WEBPACK_IMPORTED_MODULE_4__.ok)(startBufferIndex === 0, 'expected `startBufferIndex` to be `0`')\n view.shift()\n }\n }\n\n if (endBufferIndex > 0) {\n // @ts-expect-error `_bufferIndex` is used on string chunks.\n view.push(chunks[endIndex].slice(0, endBufferIndex))\n }\n }\n\n return view\n}\n\n/**\n * Get the string value of a slice of chunks.\n *\n * @param {Array} chunks\n * @param {boolean | undefined} [expandTabs=false]\n * @returns {string}\n */\nfunction serializeChunks(chunks, expandTabs) {\n let index = -1\n /** @type {Array} */\n const result = []\n /** @type {boolean | undefined} */\n let atTab\n\n while (++index < chunks.length) {\n const chunk = chunks[index]\n /** @type {string} */\n let value\n\n if (typeof chunk === 'string') {\n value = chunk\n } else\n switch (chunk) {\n case micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.carriageReturn: {\n value = micromark_util_symbol__WEBPACK_IMPORTED_MODULE_6__.values.cr\n\n break\n }\n\n case micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.lineFeed: {\n value = micromark_util_symbol__WEBPACK_IMPORTED_MODULE_6__.values.lf\n\n break\n }\n\n case micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.carriageReturnLineFeed: {\n value = micromark_util_symbol__WEBPACK_IMPORTED_MODULE_6__.values.cr + micromark_util_symbol__WEBPACK_IMPORTED_MODULE_6__.values.lf\n\n break\n }\n\n case micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.horizontalTab: {\n value = expandTabs ? micromark_util_symbol__WEBPACK_IMPORTED_MODULE_6__.values.space : micromark_util_symbol__WEBPACK_IMPORTED_MODULE_6__.values.ht\n\n break\n }\n\n case micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.virtualSpace: {\n if (!expandTabs && atTab) continue\n value = micromark_util_symbol__WEBPACK_IMPORTED_MODULE_6__.values.space\n\n break\n }\n\n default: {\n (0,devlop__WEBPACK_IMPORTED_MODULE_4__.ok)(typeof chunk === 'number', 'expected number')\n // Currently only replacement character.\n value = String.fromCharCode(chunk)\n }\n }\n\n atTab = chunk === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.horizontalTab\n result.push(value)\n }\n\n return result.join('')\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark/dev/lib/create-tokenizer.js?"); /***/ }), /***/ "./node_modules/micromark/dev/lib/initialize/content.js": /*!**************************************************************!*\ !*** ./node_modules/micromark/dev/lib/initialize/content.js ***! \**************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ content: () => (/* binding */ content)\n/* harmony export */ });\n/* harmony import */ var micromark_factory_space__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! micromark-factory-space */ \"./node_modules/micromark-factory-space/dev/index.js\");\n/* harmony import */ var micromark_util_character__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! micromark-util-character */ \"./node_modules/micromark-util-character/dev/index.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/codes.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/types.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/constants.js\");\n/* harmony import */ var devlop__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! devlop */ \"./node_modules/devlop/lib/development.js\");\n/**\n * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct\n * @typedef {import('micromark-util-types').Initializer} Initializer\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n */\n\n\n\n\n\n\n/** @type {InitialConstruct} */\nconst content = {tokenize: initializeContent}\n\n/**\n * @this {TokenizeContext}\n * @type {Initializer}\n */\nfunction initializeContent(effects) {\n const contentStart = effects.attempt(\n this.parser.constructs.contentInitial,\n afterContentStartConstruct,\n paragraphInitial\n )\n /** @type {Token} */\n let previous\n\n return contentStart\n\n /** @type {State} */\n function afterContentStartConstruct(code) {\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_0__.ok)(\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.eof || (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_2__.markdownLineEnding)(code),\n 'expected eol or eof'\n )\n\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.eof) {\n effects.consume(code)\n return\n }\n\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.types.lineEnding)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.types.lineEnding)\n return (0,micromark_factory_space__WEBPACK_IMPORTED_MODULE_4__.factorySpace)(effects, contentStart, micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.types.linePrefix)\n }\n\n /** @type {State} */\n function paragraphInitial(code) {\n (0,devlop__WEBPACK_IMPORTED_MODULE_0__.ok)(\n code !== micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.eof && !(0,micromark_util_character__WEBPACK_IMPORTED_MODULE_2__.markdownLineEnding)(code),\n 'expected anything other than a line ending or EOF'\n )\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.types.paragraph)\n return lineStart(code)\n }\n\n /** @type {State} */\n function lineStart(code) {\n const token = effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.types.chunkText, {\n contentType: micromark_util_symbol__WEBPACK_IMPORTED_MODULE_5__.constants.contentTypeText,\n previous\n })\n\n if (previous) {\n previous.next = token\n }\n\n previous = token\n\n return data(code)\n }\n\n /** @type {State} */\n function data(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.codes.eof) {\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.types.chunkText)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.types.paragraph)\n effects.consume(code)\n return\n }\n\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_2__.markdownLineEnding)(code)) {\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.types.chunkText)\n return lineStart\n }\n\n // Data.\n effects.consume(code)\n return data\n }\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark/dev/lib/initialize/content.js?"); /***/ }), /***/ "./node_modules/micromark/dev/lib/initialize/document.js": /*!***************************************************************!*\ !*** ./node_modules/micromark/dev/lib/initialize/document.js ***! \***************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ document: () => (/* binding */ document)\n/* harmony export */ });\n/* harmony import */ var micromark_factory_space__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! micromark-factory-space */ \"./node_modules/micromark-factory-space/dev/index.js\");\n/* harmony import */ var micromark_util_character__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! micromark-util-character */ \"./node_modules/micromark-util-character/dev/index.js\");\n/* harmony import */ var micromark_util_chunked__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! micromark-util-chunked */ \"./node_modules/micromark-util-chunked/dev/index.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/types.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/codes.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/constants.js\");\n/* harmony import */ var devlop__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! devlop */ \"./node_modules/devlop/lib/development.js\");\n/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').ContainerState} ContainerState\n * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct\n * @typedef {import('micromark-util-types').Initializer} Initializer\n * @typedef {import('micromark-util-types').Point} Point\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n */\n\n/**\n * @typedef {[Construct, ContainerState]} StackItem\n */\n\n\n\n\n\n\n\n/** @type {InitialConstruct} */\nconst document = {tokenize: initializeDocument}\n\n/** @type {Construct} */\nconst containerConstruct = {tokenize: tokenizeContainer}\n\n/**\n * @this {TokenizeContext}\n * @type {Initializer}\n */\nfunction initializeDocument(effects) {\n const self = this\n /** @type {Array} */\n const stack = []\n let continued = 0\n /** @type {TokenizeContext | undefined} */\n let childFlow\n /** @type {Token | undefined} */\n let childToken\n /** @type {number} */\n let lineStartOffset\n\n return start\n\n /** @type {State} */\n function start(code) {\n // First we iterate through the open blocks, starting with the root\n // document, and descending through last children down to the last open\n // block.\n // Each block imposes a condition that the line must satisfy if the block is\n // to remain open.\n // For example, a block quote requires a `>` character.\n // A paragraph requires a non-blank line.\n // In this phase we may match all or just some of the open blocks.\n // But we cannot close unmatched blocks yet, because we may have a lazy\n // continuation line.\n if (continued < stack.length) {\n const item = stack[continued]\n self.containerState = item[1]\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_0__.ok)(\n item[0].continuation,\n 'expected `continuation` to be defined on container construct'\n )\n return effects.attempt(\n item[0].continuation,\n documentContinue,\n checkNewContainers\n )(code)\n }\n\n // Done.\n return checkNewContainers(code)\n }\n\n /** @type {State} */\n function documentContinue(code) {\n (0,devlop__WEBPACK_IMPORTED_MODULE_0__.ok)(\n self.containerState,\n 'expected `containerState` to be defined after continuation'\n )\n\n continued++\n\n // Note: this field is called `_closeFlow` but it also closes containers.\n // Perhaps a good idea to rename it but it’s already used in the wild by\n // extensions.\n if (self.containerState._closeFlow) {\n self.containerState._closeFlow = undefined\n\n if (childFlow) {\n closeFlow()\n }\n\n // Note: this algorithm for moving events around is similar to the\n // algorithm when dealing with lazy lines in `writeToChild`.\n const indexBeforeExits = self.events.length\n let indexBeforeFlow = indexBeforeExits\n /** @type {Point | undefined} */\n let point\n\n // Find the flow chunk.\n while (indexBeforeFlow--) {\n if (\n self.events[indexBeforeFlow][0] === 'exit' &&\n self.events[indexBeforeFlow][1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.types.chunkFlow\n ) {\n point = self.events[indexBeforeFlow][1].end\n break\n }\n }\n\n (0,devlop__WEBPACK_IMPORTED_MODULE_0__.ok)(point, 'could not find previous flow chunk')\n\n exitContainers(continued)\n\n // Fix positions.\n let index = indexBeforeExits\n\n while (index < self.events.length) {\n self.events[index][1].end = Object.assign({}, point)\n index++\n }\n\n // Inject the exits earlier (they’re still also at the end).\n (0,micromark_util_chunked__WEBPACK_IMPORTED_MODULE_2__.splice)(\n self.events,\n indexBeforeFlow + 1,\n 0,\n self.events.slice(indexBeforeExits)\n )\n\n // Discard the duplicate exits.\n self.events.length = index\n\n return checkNewContainers(code)\n }\n\n return start(code)\n }\n\n /** @type {State} */\n function checkNewContainers(code) {\n // Next, after consuming the continuation markers for existing blocks, we\n // look for new block starts (e.g. `>` for a block quote).\n // If we encounter a new block start, we close any blocks unmatched in\n // step 1 before creating the new block as a child of the last matched\n // block.\n if (continued === stack.length) {\n // No need to `check` whether there’s a container, of `exitContainers`\n // would be moot.\n // We can instead immediately `attempt` to parse one.\n if (!childFlow) {\n return documentContinued(code)\n }\n\n // If we have concrete content, such as block HTML or fenced code,\n // we can’t have containers “pierce” into them, so we can immediately\n // start.\n if (childFlow.currentConstruct && childFlow.currentConstruct.concrete) {\n return flowStart(code)\n }\n\n // If we do have flow, it could still be a blank line,\n // but we’d be interrupting it w/ a new container if there’s a current\n // construct.\n // To do: next major: remove `_gfmTableDynamicInterruptHack` (no longer\n // needed in micromark-extension-gfm-table@1.0.6).\n self.interrupt = Boolean(\n childFlow.currentConstruct && !childFlow._gfmTableDynamicInterruptHack\n )\n }\n\n // Check if there is a new container.\n self.containerState = {}\n return effects.check(\n containerConstruct,\n thereIsANewContainer,\n thereIsNoNewContainer\n )(code)\n }\n\n /** @type {State} */\n function thereIsANewContainer(code) {\n if (childFlow) closeFlow()\n exitContainers(continued)\n return documentContinued(code)\n }\n\n /** @type {State} */\n function thereIsNoNewContainer(code) {\n self.parser.lazy[self.now().line] = continued !== stack.length\n lineStartOffset = self.now().offset\n return flowStart(code)\n }\n\n /** @type {State} */\n function documentContinued(code) {\n // Try new containers.\n self.containerState = {}\n return effects.attempt(\n containerConstruct,\n containerContinue,\n flowStart\n )(code)\n }\n\n /** @type {State} */\n function containerContinue(code) {\n (0,devlop__WEBPACK_IMPORTED_MODULE_0__.ok)(\n self.currentConstruct,\n 'expected `currentConstruct` to be defined on tokenizer'\n )\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_0__.ok)(\n self.containerState,\n 'expected `containerState` to be defined on tokenizer'\n )\n continued++\n stack.push([self.currentConstruct, self.containerState])\n // Try another.\n return documentContinued(code)\n }\n\n /** @type {State} */\n function flowStart(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.codes.eof) {\n if (childFlow) closeFlow()\n exitContainers(0)\n effects.consume(code)\n return\n }\n\n childFlow = childFlow || self.parser.flow(self.now())\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.types.chunkFlow, {\n contentType: micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.constants.contentTypeFlow,\n previous: childToken,\n _tokenizer: childFlow\n })\n\n return flowContinue(code)\n }\n\n /** @type {State} */\n function flowContinue(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.codes.eof) {\n writeToChild(effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.types.chunkFlow), true)\n exitContainers(0)\n effects.consume(code)\n return\n }\n\n if ((0,micromark_util_character__WEBPACK_IMPORTED_MODULE_5__.markdownLineEnding)(code)) {\n effects.consume(code)\n writeToChild(effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.types.chunkFlow))\n // Get ready for the next line.\n continued = 0\n self.interrupt = undefined\n return start\n }\n\n effects.consume(code)\n return flowContinue\n }\n\n /**\n * @param {Token} token\n * @param {boolean | undefined} [eof]\n * @returns {undefined}\n */\n function writeToChild(token, eof) {\n (0,devlop__WEBPACK_IMPORTED_MODULE_0__.ok)(childFlow, 'expected `childFlow` to be defined when continuing')\n const stream = self.sliceStream(token)\n if (eof) stream.push(null)\n token.previous = childToken\n if (childToken) childToken.next = token\n childToken = token\n childFlow.defineSkip(token.start)\n childFlow.write(stream)\n\n // Alright, so we just added a lazy line:\n //\n // ```markdown\n // > a\n // b.\n //\n // Or:\n //\n // > ~~~c\n // d\n //\n // Or:\n //\n // > | e |\n // f\n // ```\n //\n // The construct in the second example (fenced code) does not accept lazy\n // lines, so it marked itself as done at the end of its first line, and\n // then the content construct parses `d`.\n // Most constructs in markdown match on the first line: if the first line\n // forms a construct, a non-lazy line can’t “unmake” it.\n //\n // The construct in the third example is potentially a GFM table, and\n // those are *weird*.\n // It *could* be a table, from the first line, if the following line\n // matches a condition.\n // In this case, that second line is lazy, which “unmakes” the first line\n // and turns the whole into one content block.\n //\n // We’ve now parsed the non-lazy and the lazy line, and can figure out\n // whether the lazy line started a new flow block.\n // If it did, we exit the current containers between the two flow blocks.\n if (self.parser.lazy[token.start.line]) {\n let index = childFlow.events.length\n\n while (index--) {\n if (\n // The token starts before the line ending…\n childFlow.events[index][1].start.offset < lineStartOffset &&\n // …and either is not ended yet…\n (!childFlow.events[index][1].end ||\n // …or ends after it.\n childFlow.events[index][1].end.offset > lineStartOffset)\n ) {\n // Exit: there’s still something open, which means it’s a lazy line\n // part of something.\n return\n }\n }\n\n // Note: this algorithm for moving events around is similar to the\n // algorithm when closing flow in `documentContinue`.\n const indexBeforeExits = self.events.length\n let indexBeforeFlow = indexBeforeExits\n /** @type {boolean | undefined} */\n let seen\n /** @type {Point | undefined} */\n let point\n\n // Find the previous chunk (the one before the lazy line).\n while (indexBeforeFlow--) {\n if (\n self.events[indexBeforeFlow][0] === 'exit' &&\n self.events[indexBeforeFlow][1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.types.chunkFlow\n ) {\n if (seen) {\n point = self.events[indexBeforeFlow][1].end\n break\n }\n\n seen = true\n }\n }\n\n (0,devlop__WEBPACK_IMPORTED_MODULE_0__.ok)(point, 'could not find previous flow chunk')\n\n exitContainers(continued)\n\n // Fix positions.\n index = indexBeforeExits\n\n while (index < self.events.length) {\n self.events[index][1].end = Object.assign({}, point)\n index++\n }\n\n // Inject the exits earlier (they’re still also at the end).\n (0,micromark_util_chunked__WEBPACK_IMPORTED_MODULE_2__.splice)(\n self.events,\n indexBeforeFlow + 1,\n 0,\n self.events.slice(indexBeforeExits)\n )\n\n // Discard the duplicate exits.\n self.events.length = index\n }\n }\n\n /**\n * @param {number} size\n * @returns {undefined}\n */\n function exitContainers(size) {\n let index = stack.length\n\n // Exit open containers.\n while (index-- > size) {\n const entry = stack[index]\n self.containerState = entry[1]\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_0__.ok)(\n entry[0].exit,\n 'expected `exit` to be defined on container construct'\n )\n entry[0].exit.call(self, effects)\n }\n\n stack.length = size\n }\n\n function closeFlow() {\n (0,devlop__WEBPACK_IMPORTED_MODULE_0__.ok)(\n self.containerState,\n 'expected `containerState` to be defined when closing flow'\n )\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_0__.ok)(childFlow, 'expected `childFlow` to be defined when closing it')\n childFlow.write([micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.codes.eof])\n childToken = undefined\n childFlow = undefined\n self.containerState._closeFlow = undefined\n }\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeContainer(effects, ok, nok) {\n // Always populated by defaults.\n (0,devlop__WEBPACK_IMPORTED_MODULE_0__.ok)(\n this.parser.constructs.disable.null,\n 'expected `disable.null` to be populated'\n )\n return (0,micromark_factory_space__WEBPACK_IMPORTED_MODULE_6__.factorySpace)(\n effects,\n effects.attempt(this.parser.constructs.document, ok, nok),\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.types.linePrefix,\n this.parser.constructs.disable.null.includes('codeIndented')\n ? undefined\n : micromark_util_symbol__WEBPACK_IMPORTED_MODULE_4__.constants.tabSize\n )\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark/dev/lib/initialize/document.js?"); /***/ }), /***/ "./node_modules/micromark/dev/lib/initialize/flow.js": /*!***********************************************************!*\ !*** ./node_modules/micromark/dev/lib/initialize/flow.js ***! \***********************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ flow: () => (/* binding */ flow)\n/* harmony export */ });\n/* harmony import */ var micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! micromark-core-commonmark */ \"./node_modules/micromark-core-commonmark/dev/lib/blank-line.js\");\n/* harmony import */ var micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! micromark-core-commonmark */ \"./node_modules/micromark-core-commonmark/dev/lib/content.js\");\n/* harmony import */ var micromark_factory_space__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! micromark-factory-space */ \"./node_modules/micromark-factory-space/dev/index.js\");\n/* harmony import */ var micromark_util_character__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! micromark-util-character */ \"./node_modules/micromark-util-character/dev/index.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/types.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/codes.js\");\n/* harmony import */ var devlop__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! devlop */ \"./node_modules/devlop/lib/development.js\");\n/**\n * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct\n * @typedef {import('micromark-util-types').Initializer} Initializer\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n */\n\n\n\n\n\n\n\n/** @type {InitialConstruct} */\nconst flow = {tokenize: initializeFlow}\n\n/**\n * @this {TokenizeContext}\n * @type {Initializer}\n */\nfunction initializeFlow(effects) {\n const self = this\n const initial = effects.attempt(\n // Try to parse a blank line.\n micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_0__.blankLine,\n atBlankEnding,\n // Try to parse initial flow (essentially, only code).\n effects.attempt(\n this.parser.constructs.flowInitial,\n afterConstruct,\n (0,micromark_factory_space__WEBPACK_IMPORTED_MODULE_1__.factorySpace)(\n effects,\n effects.attempt(\n this.parser.constructs.flow,\n afterConstruct,\n effects.attempt(micromark_core_commonmark__WEBPACK_IMPORTED_MODULE_2__.content, afterConstruct)\n ),\n micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.types.linePrefix\n )\n )\n )\n\n return initial\n\n /** @type {State} */\n function atBlankEnding(code) {\n ;(0,devlop__WEBPACK_IMPORTED_MODULE_4__.ok)(\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_5__.codes.eof || (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_6__.markdownLineEnding)(code),\n 'expected eol or eof'\n )\n\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_5__.codes.eof) {\n effects.consume(code)\n return\n }\n\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.types.lineEndingBlank)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.types.lineEndingBlank)\n self.currentConstruct = undefined\n return initial\n }\n\n /** @type {State} */\n function afterConstruct(code) {\n (0,devlop__WEBPACK_IMPORTED_MODULE_4__.ok)(\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_5__.codes.eof || (0,micromark_util_character__WEBPACK_IMPORTED_MODULE_6__.markdownLineEnding)(code),\n 'expected eol or eof'\n )\n\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_5__.codes.eof) {\n effects.consume(code)\n return\n }\n\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.types.lineEnding)\n effects.consume(code)\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.types.lineEnding)\n self.currentConstruct = undefined\n return initial\n }\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark/dev/lib/initialize/flow.js?"); /***/ }), /***/ "./node_modules/micromark/dev/lib/initialize/text.js": /*!***********************************************************!*\ !*** ./node_modules/micromark/dev/lib/initialize/text.js ***! \***********************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ resolver: () => (/* binding */ resolver),\n/* harmony export */ string: () => (/* binding */ string),\n/* harmony export */ text: () => (/* binding */ text)\n/* harmony export */ });\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/codes.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/types.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/constants.js\");\n/* harmony import */ var devlop__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! devlop */ \"./node_modules/devlop/lib/development.js\");\n/**\n * @typedef {import('micromark-util-types').Code} Code\n * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct\n * @typedef {import('micromark-util-types').Initializer} Initializer\n * @typedef {import('micromark-util-types').Resolver} Resolver\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n */\n\n\n\n\nconst resolver = {resolveAll: createResolver()}\nconst string = initializeFactory('string')\nconst text = initializeFactory('text')\n\n/**\n * @param {'string' | 'text'} field\n * @returns {InitialConstruct}\n */\nfunction initializeFactory(field) {\n return {\n tokenize: initializeText,\n resolveAll: createResolver(\n field === 'text' ? resolveAllLineSuffixes : undefined\n )\n }\n\n /**\n * @this {TokenizeContext}\n * @type {Initializer}\n */\n function initializeText(effects) {\n const self = this\n const constructs = this.parser.constructs[field]\n const text = effects.attempt(constructs, start, notText)\n\n return start\n\n /** @type {State} */\n function start(code) {\n return atBreak(code) ? text(code) : notText(code)\n }\n\n /** @type {State} */\n function notText(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.eof) {\n effects.consume(code)\n return\n }\n\n effects.enter(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.types.data)\n effects.consume(code)\n return data\n }\n\n /** @type {State} */\n function data(code) {\n if (atBreak(code)) {\n effects.exit(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.types.data)\n return text(code)\n }\n\n // Data.\n effects.consume(code)\n return data\n }\n\n /**\n * @param {Code} code\n * @returns {boolean}\n */\n function atBreak(code) {\n if (code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.eof) {\n return true\n }\n\n const list = constructs[code]\n let index = -1\n\n if (list) {\n // Always populated by defaults.\n (0,devlop__WEBPACK_IMPORTED_MODULE_2__.ok)(Array.isArray(list), 'expected `disable.null` to be populated')\n\n while (++index < list.length) {\n const item = list[index]\n if (!item.previous || item.previous.call(self, self.previous)) {\n return true\n }\n }\n }\n\n return false\n }\n }\n}\n\n/**\n * @param {Resolver | undefined} [extraResolver]\n * @returns {Resolver}\n */\nfunction createResolver(extraResolver) {\n return resolveAllText\n\n /** @type {Resolver} */\n function resolveAllText(events, context) {\n let index = -1\n /** @type {number | undefined} */\n let enter\n\n // A rather boring computation (to merge adjacent `data` events) which\n // improves mm performance by 29%.\n while (++index <= events.length) {\n if (enter === undefined) {\n if (events[index] && events[index][1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.types.data) {\n enter = index\n index++\n }\n } else if (!events[index] || events[index][1].type !== micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.types.data) {\n // Don’t do anything if there is one data token.\n if (index !== enter + 2) {\n events[enter][1].end = events[index - 1][1].end\n events.splice(enter + 2, index - enter - 2)\n index = enter + 2\n }\n\n enter = undefined\n }\n }\n\n return extraResolver ? extraResolver(events, context) : events\n }\n}\n\n/**\n * A rather ugly set of instructions which again looks at chunks in the input\n * stream.\n * The reason to do this here is that it is *much* faster to parse in reverse.\n * And that we can’t hook into `null` to split the line suffix before an EOF.\n * To do: figure out if we can make this into a clean utility, or even in core.\n * As it will be useful for GFMs literal autolink extension (and maybe even\n * tables?)\n *\n * @type {Resolver}\n */\nfunction resolveAllLineSuffixes(events, context) {\n let eventIndex = 0 // Skip first.\n\n while (++eventIndex <= events.length) {\n if (\n (eventIndex === events.length ||\n events[eventIndex][1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.types.lineEnding) &&\n events[eventIndex - 1][1].type === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.types.data\n ) {\n const data = events[eventIndex - 1][1]\n const chunks = context.sliceStream(data)\n let index = chunks.length\n let bufferIndex = -1\n let size = 0\n /** @type {boolean | undefined} */\n let tabs\n\n while (index--) {\n const chunk = chunks[index]\n\n if (typeof chunk === 'string') {\n bufferIndex = chunk.length\n\n while (chunk.charCodeAt(bufferIndex - 1) === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.space) {\n size++\n bufferIndex--\n }\n\n if (bufferIndex) break\n bufferIndex = -1\n }\n // Number\n else if (chunk === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.horizontalTab) {\n tabs = true\n size++\n } else if (chunk === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.virtualSpace) {\n // Empty\n } else {\n // Replacement character, exit.\n index++\n break\n }\n }\n\n if (size) {\n const token = {\n type:\n eventIndex === events.length ||\n tabs ||\n size < micromark_util_symbol__WEBPACK_IMPORTED_MODULE_3__.constants.hardBreakPrefixSizeMin\n ? micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.types.lineSuffix\n : micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.types.hardBreakTrailing,\n start: {\n line: data.end.line,\n column: data.end.column - size,\n offset: data.end.offset - size,\n _index: data.start._index + index,\n _bufferIndex: index\n ? bufferIndex\n : data.start._bufferIndex + bufferIndex\n },\n end: Object.assign({}, data.end)\n }\n\n data.end = Object.assign({}, token.start)\n\n if (data.start.offset === data.end.offset) {\n Object.assign(data, token)\n } else {\n events.splice(\n eventIndex,\n 0,\n ['enter', token, context],\n ['exit', token, context]\n )\n eventIndex += 2\n }\n }\n\n eventIndex++\n }\n }\n\n return events\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark/dev/lib/initialize/text.js?"); /***/ }), /***/ "./node_modules/micromark/dev/lib/parse.js": /*!*************************************************!*\ !*** ./node_modules/micromark/dev/lib/parse.js ***! \*************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ parse: () => (/* binding */ parse)\n/* harmony export */ });\n/* harmony import */ var micromark_util_combine_extensions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! micromark-util-combine-extensions */ \"./node_modules/micromark-util-combine-extensions/index.js\");\n/* harmony import */ var _initialize_content_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./initialize/content.js */ \"./node_modules/micromark/dev/lib/initialize/content.js\");\n/* harmony import */ var _initialize_document_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./initialize/document.js */ \"./node_modules/micromark/dev/lib/initialize/document.js\");\n/* harmony import */ var _initialize_flow_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./initialize/flow.js */ \"./node_modules/micromark/dev/lib/initialize/flow.js\");\n/* harmony import */ var _initialize_text_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./initialize/text.js */ \"./node_modules/micromark/dev/lib/initialize/text.js\");\n/* harmony import */ var _create_tokenizer_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./create-tokenizer.js */ \"./node_modules/micromark/dev/lib/create-tokenizer.js\");\n/* harmony import */ var _constructs_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constructs.js */ \"./node_modules/micromark/dev/lib/constructs.js\");\n/**\n * @typedef {import('micromark-util-types').Create} Create\n * @typedef {import('micromark-util-types').FullNormalizedExtension} FullNormalizedExtension\n * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct\n * @typedef {import('micromark-util-types').ParseContext} ParseContext\n * @typedef {import('micromark-util-types').ParseOptions} ParseOptions\n */\n\n\n\n\n\n\n\n\n\n/**\n * @param {ParseOptions | null | undefined} [options]\n * @returns {ParseContext}\n */\nfunction parse(options) {\n const settings = options || {}\n const constructs = /** @type {FullNormalizedExtension} */ (\n (0,micromark_util_combine_extensions__WEBPACK_IMPORTED_MODULE_0__.combineExtensions)([_constructs_js__WEBPACK_IMPORTED_MODULE_1__, ...(settings.extensions || [])])\n )\n\n /** @type {ParseContext} */\n const parser = {\n defined: [],\n lazy: {},\n constructs,\n content: create(_initialize_content_js__WEBPACK_IMPORTED_MODULE_2__.content),\n document: create(_initialize_document_js__WEBPACK_IMPORTED_MODULE_3__.document),\n flow: create(_initialize_flow_js__WEBPACK_IMPORTED_MODULE_4__.flow),\n string: create(_initialize_text_js__WEBPACK_IMPORTED_MODULE_5__.string),\n text: create(_initialize_text_js__WEBPACK_IMPORTED_MODULE_5__.text)\n }\n\n return parser\n\n /**\n * @param {InitialConstruct} initial\n */\n function create(initial) {\n return creator\n /** @type {Create} */\n function creator(from) {\n return (0,_create_tokenizer_js__WEBPACK_IMPORTED_MODULE_6__.createTokenizer)(parser, initial, from)\n }\n }\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark/dev/lib/parse.js?"); /***/ }), /***/ "./node_modules/micromark/dev/lib/postprocess.js": /*!*******************************************************!*\ !*** ./node_modules/micromark/dev/lib/postprocess.js ***! \*******************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ postprocess: () => (/* binding */ postprocess)\n/* harmony export */ });\n/* harmony import */ var micromark_util_subtokenize__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! micromark-util-subtokenize */ \"./node_modules/micromark-util-subtokenize/dev/index.js\");\n/**\n * @typedef {import('micromark-util-types').Event} Event\n */\n\n\n\n/**\n * @param {Array} events\n * @returns {Array}\n */\nfunction postprocess(events) {\n while (!(0,micromark_util_subtokenize__WEBPACK_IMPORTED_MODULE_0__.subtokenize)(events)) {\n // Empty\n }\n\n return events\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark/dev/lib/postprocess.js?"); /***/ }), /***/ "./node_modules/micromark/dev/lib/preprocess.js": /*!******************************************************!*\ !*** ./node_modules/micromark/dev/lib/preprocess.js ***! \******************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ preprocess: () => (/* binding */ preprocess)\n/* harmony export */ });\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/codes.js\");\n/* harmony import */ var micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! micromark-util-symbol */ \"./node_modules/micromark-util-symbol/lib/constants.js\");\n/**\n * @typedef {import('micromark-util-types').Chunk} Chunk\n * @typedef {import('micromark-util-types').Code} Code\n * @typedef {import('micromark-util-types').Encoding} Encoding\n * @typedef {import('micromark-util-types').Value} Value\n */\n\n/**\n * @callback Preprocessor\n * @param {Value} value\n * @param {Encoding | null | undefined} [encoding]\n * @param {boolean | null | undefined} [end=false]\n * @returns {Array}\n */\n\n\n\nconst search = /[\\0\\t\\n\\r]/g\n\n/**\n * @returns {Preprocessor}\n */\nfunction preprocess() {\n let column = 1\n let buffer = ''\n /** @type {boolean | undefined} */\n let start = true\n /** @type {boolean | undefined} */\n let atCarriageReturn\n\n return preprocessor\n\n /** @type {Preprocessor} */\n // eslint-disable-next-line complexity\n function preprocessor(value, encoding, end) {\n /** @type {Array} */\n const chunks = []\n /** @type {RegExpMatchArray | null} */\n let match\n /** @type {number} */\n let next\n /** @type {number} */\n let startPosition\n /** @type {number} */\n let endPosition\n /** @type {Code} */\n let code\n\n value =\n buffer +\n (typeof value === 'string'\n ? value.toString()\n : new TextDecoder(encoding || undefined).decode(value))\n\n startPosition = 0\n buffer = ''\n\n if (start) {\n // To do: `markdown-rs` actually parses BOMs (byte order mark).\n if (value.charCodeAt(0) === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.byteOrderMarker) {\n startPosition++\n }\n\n start = undefined\n }\n\n while (startPosition < value.length) {\n search.lastIndex = startPosition\n match = search.exec(value)\n endPosition =\n match && match.index !== undefined ? match.index : value.length\n code = value.charCodeAt(endPosition)\n\n if (!match) {\n buffer = value.slice(startPosition)\n break\n }\n\n if (\n code === micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.lf &&\n startPosition === endPosition &&\n atCarriageReturn\n ) {\n chunks.push(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.carriageReturnLineFeed)\n atCarriageReturn = undefined\n } else {\n if (atCarriageReturn) {\n chunks.push(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.carriageReturn)\n atCarriageReturn = undefined\n }\n\n if (startPosition < endPosition) {\n chunks.push(value.slice(startPosition, endPosition))\n column += endPosition - startPosition\n }\n\n switch (code) {\n case micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.nul: {\n chunks.push(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.replacementCharacter)\n column++\n\n break\n }\n\n case micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.ht: {\n next = Math.ceil(column / micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.constants.tabSize) * micromark_util_symbol__WEBPACK_IMPORTED_MODULE_1__.constants.tabSize\n chunks.push(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.horizontalTab)\n while (column++ < next) chunks.push(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.virtualSpace)\n\n break\n }\n\n case micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.lf: {\n chunks.push(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.lineFeed)\n column = 1\n\n break\n }\n\n default: {\n atCarriageReturn = true\n column = 1\n }\n }\n }\n\n startPosition = endPosition + 1\n }\n\n if (end) {\n if (atCarriageReturn) chunks.push(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.carriageReturn)\n if (buffer) chunks.push(buffer)\n chunks.push(micromark_util_symbol__WEBPACK_IMPORTED_MODULE_0__.codes.eof)\n }\n\n return chunks\n }\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/micromark/dev/lib/preprocess.js?"); /***/ }), /***/ "./node_modules/potpack/index.mjs": /*!****************************************!*\ !*** ./node_modules/potpack/index.mjs ***! \****************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ potpack)\n/* harmony export */ });\n\nfunction potpack(boxes) {\n\n // calculate total box area and maximum box width\n let area = 0;\n let maxWidth = 0;\n\n for (const box of boxes) {\n area += box.w * box.h;\n maxWidth = Math.max(maxWidth, box.w);\n }\n\n // sort the boxes for insertion by height, descending\n boxes.sort((a, b) => b.h - a.h);\n\n // aim for a squarish resulting container,\n // slightly adjusted for sub-100% space utilization\n const startWidth = Math.max(Math.ceil(Math.sqrt(area / 0.95)), maxWidth);\n\n // start with a single empty space, unbounded at the bottom\n const spaces = [{x: 0, y: 0, w: startWidth, h: Infinity}];\n\n let width = 0;\n let height = 0;\n\n for (const box of boxes) {\n // look through spaces backwards so that we check smaller spaces first\n for (let i = spaces.length - 1; i >= 0; i--) {\n const space = spaces[i];\n\n // look for empty spaces that can accommodate the current box\n if (box.w > space.w || box.h > space.h) continue;\n\n // found the space; add the box to its top-left corner\n // |-------|-------|\n // | box | |\n // |_______| |\n // | space |\n // |_______________|\n box.x = space.x;\n box.y = space.y;\n\n height = Math.max(height, box.y + box.h);\n width = Math.max(width, box.x + box.w);\n\n if (box.w === space.w && box.h === space.h) {\n // space matches the box exactly; remove it\n const last = spaces.pop();\n if (i < spaces.length) spaces[i] = last;\n\n } else if (box.h === space.h) {\n // space matches the box height; update it accordingly\n // |-------|---------------|\n // | box | updated space |\n // |_______|_______________|\n space.x += box.w;\n space.w -= box.w;\n\n } else if (box.w === space.w) {\n // space matches the box width; update it accordingly\n // |---------------|\n // | box |\n // |_______________|\n // | updated space |\n // |_______________|\n space.y += box.h;\n space.h -= box.h;\n\n } else {\n // otherwise the box splits the space into two spaces\n // |-------|-----------|\n // | box | new space |\n // |_______|___________|\n // | updated space |\n // |___________________|\n spaces.push({\n x: space.x + box.w,\n y: space.y,\n w: space.w - box.w,\n h: box.h\n });\n space.y += box.h;\n space.h -= box.h;\n }\n break;\n }\n }\n\n return {\n w: width, // container width\n h: height, // container height\n fill: (area / (width * height)) || 0 // space utilization\n };\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/potpack/index.mjs?"); /***/ }), /***/ "./node_modules/property-information/index.js": /*!****************************************************!*\ !*** ./node_modules/property-information/index.js ***! \****************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ find: () => (/* reexport safe */ _lib_find_js__WEBPACK_IMPORTED_MODULE_0__.find),\n/* harmony export */ hastToReact: () => (/* reexport safe */ _lib_hast_to_react_js__WEBPACK_IMPORTED_MODULE_1__.hastToReact),\n/* harmony export */ html: () => (/* binding */ html),\n/* harmony export */ normalize: () => (/* reexport safe */ _lib_normalize_js__WEBPACK_IMPORTED_MODULE_2__.normalize),\n/* harmony export */ svg: () => (/* binding */ svg)\n/* harmony export */ });\n/* harmony import */ var _lib_util_merge_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./lib/util/merge.js */ \"./node_modules/property-information/lib/util/merge.js\");\n/* harmony import */ var _lib_xlink_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./lib/xlink.js */ \"./node_modules/property-information/lib/xlink.js\");\n/* harmony import */ var _lib_xml_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./lib/xml.js */ \"./node_modules/property-information/lib/xml.js\");\n/* harmony import */ var _lib_xmlns_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./lib/xmlns.js */ \"./node_modules/property-information/lib/xmlns.js\");\n/* harmony import */ var _lib_aria_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./lib/aria.js */ \"./node_modules/property-information/lib/aria.js\");\n/* harmony import */ var _lib_html_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./lib/html.js */ \"./node_modules/property-information/lib/html.js\");\n/* harmony import */ var _lib_svg_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./lib/svg.js */ \"./node_modules/property-information/lib/svg.js\");\n/* harmony import */ var _lib_find_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./lib/find.js */ \"./node_modules/property-information/lib/find.js\");\n/* harmony import */ var _lib_hast_to_react_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./lib/hast-to-react.js */ \"./node_modules/property-information/lib/hast-to-react.js\");\n/* harmony import */ var _lib_normalize_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./lib/normalize.js */ \"./node_modules/property-information/lib/normalize.js\");\n/**\n * @typedef {import('./lib/util/info.js').Info} Info\n * @typedef {import('./lib/util/schema.js').Schema} Schema\n */\n\n\n\n\n\n\n\n\n\n\n\n\nconst html = (0,_lib_util_merge_js__WEBPACK_IMPORTED_MODULE_3__.merge)([_lib_xml_js__WEBPACK_IMPORTED_MODULE_4__.xml, _lib_xlink_js__WEBPACK_IMPORTED_MODULE_5__.xlink, _lib_xmlns_js__WEBPACK_IMPORTED_MODULE_6__.xmlns, _lib_aria_js__WEBPACK_IMPORTED_MODULE_7__.aria, _lib_html_js__WEBPACK_IMPORTED_MODULE_8__.html], 'html')\nconst svg = (0,_lib_util_merge_js__WEBPACK_IMPORTED_MODULE_3__.merge)([_lib_xml_js__WEBPACK_IMPORTED_MODULE_4__.xml, _lib_xlink_js__WEBPACK_IMPORTED_MODULE_5__.xlink, _lib_xmlns_js__WEBPACK_IMPORTED_MODULE_6__.xmlns, _lib_aria_js__WEBPACK_IMPORTED_MODULE_7__.aria, _lib_svg_js__WEBPACK_IMPORTED_MODULE_9__.svg], 'svg')\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/property-information/index.js?"); /***/ }), /***/ "./node_modules/property-information/lib/aria.js": /*!*******************************************************!*\ !*** ./node_modules/property-information/lib/aria.js ***! \*******************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ aria: () => (/* binding */ aria)\n/* harmony export */ });\n/* harmony import */ var _util_types_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./util/types.js */ \"./node_modules/property-information/lib/util/types.js\");\n/* harmony import */ var _util_create_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/create.js */ \"./node_modules/property-information/lib/util/create.js\");\n\n\n\nconst aria = (0,_util_create_js__WEBPACK_IMPORTED_MODULE_0__.create)({\n transform(_, prop) {\n return prop === 'role' ? prop : 'aria-' + prop.slice(4).toLowerCase()\n },\n properties: {\n ariaActiveDescendant: null,\n ariaAtomic: _util_types_js__WEBPACK_IMPORTED_MODULE_1__.booleanish,\n ariaAutoComplete: null,\n ariaBusy: _util_types_js__WEBPACK_IMPORTED_MODULE_1__.booleanish,\n ariaChecked: _util_types_js__WEBPACK_IMPORTED_MODULE_1__.booleanish,\n ariaColCount: _util_types_js__WEBPACK_IMPORTED_MODULE_1__.number,\n ariaColIndex: _util_types_js__WEBPACK_IMPORTED_MODULE_1__.number,\n ariaColSpan: _util_types_js__WEBPACK_IMPORTED_MODULE_1__.number,\n ariaControls: _util_types_js__WEBPACK_IMPORTED_MODULE_1__.spaceSeparated,\n ariaCurrent: null,\n ariaDescribedBy: _util_types_js__WEBPACK_IMPORTED_MODULE_1__.spaceSeparated,\n ariaDetails: null,\n ariaDisabled: _util_types_js__WEBPACK_IMPORTED_MODULE_1__.booleanish,\n ariaDropEffect: _util_types_js__WEBPACK_IMPORTED_MODULE_1__.spaceSeparated,\n ariaErrorMessage: null,\n ariaExpanded: _util_types_js__WEBPACK_IMPORTED_MODULE_1__.booleanish,\n ariaFlowTo: _util_types_js__WEBPACK_IMPORTED_MODULE_1__.spaceSeparated,\n ariaGrabbed: _util_types_js__WEBPACK_IMPORTED_MODULE_1__.booleanish,\n ariaHasPopup: null,\n ariaHidden: _util_types_js__WEBPACK_IMPORTED_MODULE_1__.booleanish,\n ariaInvalid: null,\n ariaKeyShortcuts: null,\n ariaLabel: null,\n ariaLabelledBy: _util_types_js__WEBPACK_IMPORTED_MODULE_1__.spaceSeparated,\n ariaLevel: _util_types_js__WEBPACK_IMPORTED_MODULE_1__.number,\n ariaLive: null,\n ariaModal: _util_types_js__WEBPACK_IMPORTED_MODULE_1__.booleanish,\n ariaMultiLine: _util_types_js__WEBPACK_IMPORTED_MODULE_1__.booleanish,\n ariaMultiSelectable: _util_types_js__WEBPACK_IMPORTED_MODULE_1__.booleanish,\n ariaOrientation: null,\n ariaOwns: _util_types_js__WEBPACK_IMPORTED_MODULE_1__.spaceSeparated,\n ariaPlaceholder: null,\n ariaPosInSet: _util_types_js__WEBPACK_IMPORTED_MODULE_1__.number,\n ariaPressed: _util_types_js__WEBPACK_IMPORTED_MODULE_1__.booleanish,\n ariaReadOnly: _util_types_js__WEBPACK_IMPORTED_MODULE_1__.booleanish,\n ariaRelevant: null,\n ariaRequired: _util_types_js__WEBPACK_IMPORTED_MODULE_1__.booleanish,\n ariaRoleDescription: _util_types_js__WEBPACK_IMPORTED_MODULE_1__.spaceSeparated,\n ariaRowCount: _util_types_js__WEBPACK_IMPORTED_MODULE_1__.number,\n ariaRowIndex: _util_types_js__WEBPACK_IMPORTED_MODULE_1__.number,\n ariaRowSpan: _util_types_js__WEBPACK_IMPORTED_MODULE_1__.number,\n ariaSelected: _util_types_js__WEBPACK_IMPORTED_MODULE_1__.booleanish,\n ariaSetSize: _util_types_js__WEBPACK_IMPORTED_MODULE_1__.number,\n ariaSort: null,\n ariaValueMax: _util_types_js__WEBPACK_IMPORTED_MODULE_1__.number,\n ariaValueMin: _util_types_js__WEBPACK_IMPORTED_MODULE_1__.number,\n ariaValueNow: _util_types_js__WEBPACK_IMPORTED_MODULE_1__.number,\n ariaValueText: null,\n role: null\n }\n})\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/property-information/lib/aria.js?"); /***/ }), /***/ "./node_modules/property-information/lib/find.js": /*!*******************************************************!*\ !*** ./node_modules/property-information/lib/find.js ***! \*******************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ find: () => (/* binding */ find)\n/* harmony export */ });\n/* harmony import */ var _normalize_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./normalize.js */ \"./node_modules/property-information/lib/normalize.js\");\n/* harmony import */ var _util_defined_info_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./util/defined-info.js */ \"./node_modules/property-information/lib/util/defined-info.js\");\n/* harmony import */ var _util_info_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./util/info.js */ \"./node_modules/property-information/lib/util/info.js\");\n/**\n * @typedef {import('./util/schema.js').Schema} Schema\n */\n\n\n\n\n\nconst valid = /^data[-\\w.:]+$/i\nconst dash = /-[a-z]/g\nconst cap = /[A-Z]/g\n\n/**\n * @param {Schema} schema\n * @param {string} value\n * @returns {Info}\n */\nfunction find(schema, value) {\n const normal = (0,_normalize_js__WEBPACK_IMPORTED_MODULE_0__.normalize)(value)\n let prop = value\n let Type = _util_info_js__WEBPACK_IMPORTED_MODULE_1__.Info\n\n if (normal in schema.normal) {\n return schema.property[schema.normal[normal]]\n }\n\n if (normal.length > 4 && normal.slice(0, 4) === 'data' && valid.test(value)) {\n // Attribute or property.\n if (value.charAt(4) === '-') {\n // Turn it into a property.\n const rest = value.slice(5).replace(dash, camelcase)\n prop = 'data' + rest.charAt(0).toUpperCase() + rest.slice(1)\n } else {\n // Turn it into an attribute.\n const rest = value.slice(4)\n\n if (!dash.test(rest)) {\n let dashes = rest.replace(cap, kebab)\n\n if (dashes.charAt(0) !== '-') {\n dashes = '-' + dashes\n }\n\n value = 'data' + dashes\n }\n }\n\n Type = _util_defined_info_js__WEBPACK_IMPORTED_MODULE_2__.DefinedInfo\n }\n\n return new Type(prop, value)\n}\n\n/**\n * @param {string} $0\n * @returns {string}\n */\nfunction kebab($0) {\n return '-' + $0.toLowerCase()\n}\n\n/**\n * @param {string} $0\n * @returns {string}\n */\nfunction camelcase($0) {\n return $0.charAt(1).toUpperCase()\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/property-information/lib/find.js?"); /***/ }), /***/ "./node_modules/property-information/lib/hast-to-react.js": /*!****************************************************************!*\ !*** ./node_modules/property-information/lib/hast-to-react.js ***! \****************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hastToReact: () => (/* binding */ hastToReact)\n/* harmony export */ });\n/**\n * `hast` is close to `React`, but differs in a couple of cases.\n *\n * To get a React property from a hast property, check if it is in\n * `hastToReact`, if it is, then use the corresponding value,\n * otherwise, use the hast property.\n *\n * @type {Record}\n */\nconst hastToReact = {\n classId: 'classID',\n dataType: 'datatype',\n itemId: 'itemID',\n strokeDashArray: 'strokeDasharray',\n strokeDashOffset: 'strokeDashoffset',\n strokeLineCap: 'strokeLinecap',\n strokeLineJoin: 'strokeLinejoin',\n strokeMiterLimit: 'strokeMiterlimit',\n typeOf: 'typeof',\n xLinkActuate: 'xlinkActuate',\n xLinkArcRole: 'xlinkArcrole',\n xLinkHref: 'xlinkHref',\n xLinkRole: 'xlinkRole',\n xLinkShow: 'xlinkShow',\n xLinkTitle: 'xlinkTitle',\n xLinkType: 'xlinkType',\n xmlnsXLink: 'xmlnsXlink'\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/property-information/lib/hast-to-react.js?"); /***/ }), /***/ "./node_modules/property-information/lib/html.js": /*!*******************************************************!*\ !*** ./node_modules/property-information/lib/html.js ***! \*******************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ html: () => (/* binding */ html)\n/* harmony export */ });\n/* harmony import */ var _util_types_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./util/types.js */ \"./node_modules/property-information/lib/util/types.js\");\n/* harmony import */ var _util_create_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/create.js */ \"./node_modules/property-information/lib/util/create.js\");\n/* harmony import */ var _util_case_insensitive_transform_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./util/case-insensitive-transform.js */ \"./node_modules/property-information/lib/util/case-insensitive-transform.js\");\n\n\n\n\nconst html = (0,_util_create_js__WEBPACK_IMPORTED_MODULE_0__.create)({\n space: 'html',\n attributes: {\n acceptcharset: 'accept-charset',\n classname: 'class',\n htmlfor: 'for',\n httpequiv: 'http-equiv'\n },\n transform: _util_case_insensitive_transform_js__WEBPACK_IMPORTED_MODULE_1__.caseInsensitiveTransform,\n mustUseProperty: ['checked', 'multiple', 'muted', 'selected'],\n properties: {\n // Standard Properties.\n abbr: null,\n accept: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.commaSeparated,\n acceptCharset: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.spaceSeparated,\n accessKey: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.spaceSeparated,\n action: null,\n allow: null,\n allowFullScreen: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.boolean,\n allowPaymentRequest: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.boolean,\n allowUserMedia: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.boolean,\n alt: null,\n as: null,\n async: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.boolean,\n autoCapitalize: null,\n autoComplete: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.spaceSeparated,\n autoFocus: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.boolean,\n autoPlay: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.boolean,\n blocking: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.spaceSeparated,\n capture: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.boolean,\n charSet: null,\n checked: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.boolean,\n cite: null,\n className: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.spaceSeparated,\n cols: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.number,\n colSpan: null,\n content: null,\n contentEditable: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.booleanish,\n controls: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.boolean,\n controlsList: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.spaceSeparated,\n coords: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.number | _util_types_js__WEBPACK_IMPORTED_MODULE_2__.commaSeparated,\n crossOrigin: null,\n data: null,\n dateTime: null,\n decoding: null,\n default: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.boolean,\n defer: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.boolean,\n dir: null,\n dirName: null,\n disabled: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.boolean,\n download: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.overloadedBoolean,\n draggable: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.booleanish,\n encType: null,\n enterKeyHint: null,\n fetchPriority: null,\n form: null,\n formAction: null,\n formEncType: null,\n formMethod: null,\n formNoValidate: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.boolean,\n formTarget: null,\n headers: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.spaceSeparated,\n height: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.number,\n hidden: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.boolean,\n high: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.number,\n href: null,\n hrefLang: null,\n htmlFor: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.spaceSeparated,\n httpEquiv: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.spaceSeparated,\n id: null,\n imageSizes: null,\n imageSrcSet: null,\n inert: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.boolean,\n inputMode: null,\n integrity: null,\n is: null,\n isMap: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.boolean,\n itemId: null,\n itemProp: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.spaceSeparated,\n itemRef: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.spaceSeparated,\n itemScope: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.boolean,\n itemType: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.spaceSeparated,\n kind: null,\n label: null,\n lang: null,\n language: null,\n list: null,\n loading: null,\n loop: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.boolean,\n low: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.number,\n manifest: null,\n max: null,\n maxLength: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.number,\n media: null,\n method: null,\n min: null,\n minLength: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.number,\n multiple: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.boolean,\n muted: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.boolean,\n name: null,\n nonce: null,\n noModule: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.boolean,\n noValidate: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.boolean,\n onAbort: null,\n onAfterPrint: null,\n onAuxClick: null,\n onBeforeMatch: null,\n onBeforePrint: null,\n onBeforeToggle: null,\n onBeforeUnload: null,\n onBlur: null,\n onCancel: null,\n onCanPlay: null,\n onCanPlayThrough: null,\n onChange: null,\n onClick: null,\n onClose: null,\n onContextLost: null,\n onContextMenu: null,\n onContextRestored: null,\n onCopy: null,\n onCueChange: null,\n onCut: null,\n onDblClick: null,\n onDrag: null,\n onDragEnd: null,\n onDragEnter: null,\n onDragExit: null,\n onDragLeave: null,\n onDragOver: null,\n onDragStart: null,\n onDrop: null,\n onDurationChange: null,\n onEmptied: null,\n onEnded: null,\n onError: null,\n onFocus: null,\n onFormData: null,\n onHashChange: null,\n onInput: null,\n onInvalid: null,\n onKeyDown: null,\n onKeyPress: null,\n onKeyUp: null,\n onLanguageChange: null,\n onLoad: null,\n onLoadedData: null,\n onLoadedMetadata: null,\n onLoadEnd: null,\n onLoadStart: null,\n onMessage: null,\n onMessageError: null,\n onMouseDown: null,\n onMouseEnter: null,\n onMouseLeave: null,\n onMouseMove: null,\n onMouseOut: null,\n onMouseOver: null,\n onMouseUp: null,\n onOffline: null,\n onOnline: null,\n onPageHide: null,\n onPageShow: null,\n onPaste: null,\n onPause: null,\n onPlay: null,\n onPlaying: null,\n onPopState: null,\n onProgress: null,\n onRateChange: null,\n onRejectionHandled: null,\n onReset: null,\n onResize: null,\n onScroll: null,\n onScrollEnd: null,\n onSecurityPolicyViolation: null,\n onSeeked: null,\n onSeeking: null,\n onSelect: null,\n onSlotChange: null,\n onStalled: null,\n onStorage: null,\n onSubmit: null,\n onSuspend: null,\n onTimeUpdate: null,\n onToggle: null,\n onUnhandledRejection: null,\n onUnload: null,\n onVolumeChange: null,\n onWaiting: null,\n onWheel: null,\n open: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.boolean,\n optimum: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.number,\n pattern: null,\n ping: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.spaceSeparated,\n placeholder: null,\n playsInline: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.boolean,\n popover: null,\n popoverTarget: null,\n popoverTargetAction: null,\n poster: null,\n preload: null,\n readOnly: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.boolean,\n referrerPolicy: null,\n rel: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.spaceSeparated,\n required: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.boolean,\n reversed: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.boolean,\n rows: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.number,\n rowSpan: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.number,\n sandbox: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.spaceSeparated,\n scope: null,\n scoped: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.boolean,\n seamless: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.boolean,\n selected: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.boolean,\n shadowRootDelegatesFocus: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.boolean,\n shadowRootMode: null,\n shape: null,\n size: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.number,\n sizes: null,\n slot: null,\n span: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.number,\n spellCheck: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.booleanish,\n src: null,\n srcDoc: null,\n srcLang: null,\n srcSet: null,\n start: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.number,\n step: null,\n style: null,\n tabIndex: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.number,\n target: null,\n title: null,\n translate: null,\n type: null,\n typeMustMatch: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.boolean,\n useMap: null,\n value: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.booleanish,\n width: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.number,\n wrap: null,\n\n // Legacy.\n // See: https://html.spec.whatwg.org/#other-elements,-attributes-and-apis\n align: null, // Several. Use CSS `text-align` instead,\n aLink: null, // ``. Use CSS `a:active {color}` instead\n archive: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.spaceSeparated, // ``. List of URIs to archives\n axis: null, // `` and ``. Use `scope` on ``\n background: null, // ``. Use CSS `background-image` instead\n bgColor: null, // `` and table elements. Use CSS `background-color` instead\n border: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.number, // ``. Use CSS `border-width` instead,\n borderColor: null, // `
`. Use CSS `border-color` instead,\n bottomMargin: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.number, // ``\n cellPadding: null, // `
`\n cellSpacing: null, // `
`\n char: null, // Several table elements. When `align=char`, sets the character to align on\n charOff: null, // Several table elements. When `char`, offsets the alignment\n classId: null, // ``\n clear: null, // `
`. Use CSS `clear` instead\n code: null, // ``\n codeBase: null, // ``\n codeType: null, // ``\n color: null, // `` and `
`. Use CSS instead\n compact: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.boolean, // Lists. Use CSS to reduce space between items instead\n declare: _util_types_js__WEBPACK_IMPORTED_MODULE_2__.boolean, // ``\n event: null, // `\n * ```\n *\n * Elements by their ID are made available by browsers on the `window` object,\n * which is a security risk.\n * Using a prefix solves this problem.\n *\n * More information on how to handle clobbering and the prefix is explained in\n * *Example: headings (DOM clobbering)* in `rehype-sanitize`.\n *\n * ###### Unknown nodes\n *\n * Unknown nodes are nodes with a type that isn’t in `handlers` or `passThrough`.\n * The default behavior for unknown nodes is:\n *\n * * when the node has a `value` (and doesn’t have `data.hName`,\n * `data.hProperties`, or `data.hChildren`, see later), create a hast `text`\n * node\n * * otherwise, create a `
` element (which could be changed with\n * `data.hName`), with its children mapped from mdast to hast as well\n *\n * This behavior can be changed by passing an `unknownHandler`.\n *\n * @overload\n * @param {Processor} processor\n * @param {Readonly | null | undefined} [options]\n * @returns {TransformBridge}\n *\n * @overload\n * @param {Readonly | null | undefined} [options]\n * @returns {TransformMutate}\n *\n * @param {Readonly | Processor | null | undefined} [destination]\n * Processor or configuration (optional).\n * @param {Readonly | null | undefined} [options]\n * When a processor was given, configuration (optional).\n * @returns {TransformBridge | TransformMutate}\n * Transform.\n */\nfunction remarkRehype(destination, options) {\n if (destination && 'run' in destination) {\n /**\n * @type {TransformBridge}\n */\n return async function (tree, file) {\n // Cast because root in -> root out.\n const hastTree = /** @type {HastRoot} */ ((0,mdast_util_to_hast__WEBPACK_IMPORTED_MODULE_0__.toHast)(tree, options))\n await destination.run(hastTree, file)\n }\n }\n\n /**\n * @type {TransformMutate}\n */\n return function (tree) {\n // Cast because root in -> root out.\n return /** @type {HastRoot} */ ((0,mdast_util_to_hast__WEBPACK_IMPORTED_MODULE_0__.toHast)(tree, options || destination))\n }\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/remark-rehype/lib/index.js?"); /***/ }), /***/ "./node_modules/space-separated-tokens/index.js": /*!******************************************************!*\ !*** ./node_modules/space-separated-tokens/index.js ***! \******************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ parse: () => (/* binding */ parse),\n/* harmony export */ stringify: () => (/* binding */ stringify)\n/* harmony export */ });\n/**\n * Parse space-separated tokens to an array of strings.\n *\n * @param {string} value\n * Space-separated tokens.\n * @returns {Array}\n * List of tokens.\n */\nfunction parse(value) {\n const input = String(value || '').trim()\n return input ? input.split(/[ \\t\\n\\r\\f]+/g) : []\n}\n\n/**\n * Serialize an array of strings as space separated-tokens.\n *\n * @param {Array} values\n * List of tokens.\n * @returns {string}\n * Space-separated tokens.\n */\nfunction stringify(values) {\n return values.join(' ').trim()\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/space-separated-tokens/index.js?"); /***/ }), /***/ "./node_modules/style-to-object/esm/index.mjs": /*!****************************************************!*\ !*** ./node_modules/style-to-object/esm/index.mjs ***! \****************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _cjs_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../cjs/index.js */ \"./node_modules/style-to-object/cjs/index.js\");\n\n\n// ensure compatibility with rollup umd build\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_cjs_index_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] || _cjs_index_js__WEBPACK_IMPORTED_MODULE_0__);\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/style-to-object/esm/index.mjs?"); /***/ }), /***/ "./node_modules/stylis/src/Enum.js": /*!*****************************************!*\ !*** ./node_modules/stylis/src/Enum.js ***! \*****************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CHARSET: () => (/* binding */ CHARSET),\n/* harmony export */ COMMENT: () => (/* binding */ COMMENT),\n/* harmony export */ COUNTER_STYLE: () => (/* binding */ COUNTER_STYLE),\n/* harmony export */ DECLARATION: () => (/* binding */ DECLARATION),\n/* harmony export */ DOCUMENT: () => (/* binding */ DOCUMENT),\n/* harmony export */ FONT_FACE: () => (/* binding */ FONT_FACE),\n/* harmony export */ FONT_FEATURE_VALUES: () => (/* binding */ FONT_FEATURE_VALUES),\n/* harmony export */ IMPORT: () => (/* binding */ IMPORT),\n/* harmony export */ KEYFRAMES: () => (/* binding */ KEYFRAMES),\n/* harmony export */ LAYER: () => (/* binding */ LAYER),\n/* harmony export */ MEDIA: () => (/* binding */ MEDIA),\n/* harmony export */ MOZ: () => (/* binding */ MOZ),\n/* harmony export */ MS: () => (/* binding */ MS),\n/* harmony export */ NAMESPACE: () => (/* binding */ NAMESPACE),\n/* harmony export */ PAGE: () => (/* binding */ PAGE),\n/* harmony export */ RULESET: () => (/* binding */ RULESET),\n/* harmony export */ SUPPORTS: () => (/* binding */ SUPPORTS),\n/* harmony export */ VIEWPORT: () => (/* binding */ VIEWPORT),\n/* harmony export */ WEBKIT: () => (/* binding */ WEBKIT)\n/* harmony export */ });\nvar MS = '-ms-'\nvar MOZ = '-moz-'\nvar WEBKIT = '-webkit-'\n\nvar COMMENT = 'comm'\nvar RULESET = 'rule'\nvar DECLARATION = 'decl'\n\nvar PAGE = '@page'\nvar MEDIA = '@media'\nvar IMPORT = '@import'\nvar CHARSET = '@charset'\nvar VIEWPORT = '@viewport'\nvar SUPPORTS = '@supports'\nvar DOCUMENT = '@document'\nvar NAMESPACE = '@namespace'\nvar KEYFRAMES = '@keyframes'\nvar FONT_FACE = '@font-face'\nvar COUNTER_STYLE = '@counter-style'\nvar FONT_FEATURE_VALUES = '@font-feature-values'\nvar LAYER = '@layer'\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/stylis/src/Enum.js?"); /***/ }), /***/ "./node_modules/stylis/src/Middleware.js": /*!***********************************************!*\ !*** ./node_modules/stylis/src/Middleware.js ***! \***********************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ middleware: () => (/* binding */ middleware),\n/* harmony export */ namespace: () => (/* binding */ namespace),\n/* harmony export */ prefixer: () => (/* binding */ prefixer),\n/* harmony export */ rulesheet: () => (/* binding */ rulesheet)\n/* harmony export */ });\n/* harmony import */ var _Enum_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Enum.js */ \"./node_modules/stylis/src/Enum.js\");\n/* harmony import */ var _Utility_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Utility.js */ \"./node_modules/stylis/src/Utility.js\");\n/* harmony import */ var _Tokenizer_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Tokenizer.js */ \"./node_modules/stylis/src/Tokenizer.js\");\n/* harmony import */ var _Serializer_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Serializer.js */ \"./node_modules/stylis/src/Serializer.js\");\n/* harmony import */ var _Prefixer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Prefixer.js */ \"./node_modules/stylis/src/Prefixer.js\");\n\n\n\n\n\n\n/**\n * @param {function[]} collection\n * @return {function}\n */\nfunction middleware (collection) {\n\tvar length = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.sizeof)(collection)\n\n\treturn function (element, index, children, callback) {\n\t\tvar output = ''\n\n\t\tfor (var i = 0; i < length; i++)\n\t\t\toutput += collection[i](element, index, children, callback) || ''\n\n\t\treturn output\n\t}\n}\n\n/**\n * @param {function} callback\n * @return {function}\n */\nfunction rulesheet (callback) {\n\treturn function (element) {\n\t\tif (!element.root)\n\t\t\tif (element = element.return)\n\t\t\t\tcallback(element)\n\t}\n}\n\n/**\n * @param {object} element\n * @param {number} index\n * @param {object[]} children\n * @param {function} callback\n */\nfunction prefixer (element, index, children, callback) {\n\tif (element.length > -1)\n\t\tif (!element.return)\n\t\t\tswitch (element.type) {\n\t\t\t\tcase _Enum_js__WEBPACK_IMPORTED_MODULE_1__.DECLARATION: element.return = (0,_Prefixer_js__WEBPACK_IMPORTED_MODULE_2__.prefix)(element.value, element.length, children)\n\t\t\t\t\treturn\n\t\t\t\tcase _Enum_js__WEBPACK_IMPORTED_MODULE_1__.KEYFRAMES:\n\t\t\t\t\treturn (0,_Serializer_js__WEBPACK_IMPORTED_MODULE_3__.serialize)([(0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_4__.copy)(element, {value: (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.replace)(element.value, '@', '@' + _Enum_js__WEBPACK_IMPORTED_MODULE_1__.WEBKIT)})], callback)\n\t\t\t\tcase _Enum_js__WEBPACK_IMPORTED_MODULE_1__.RULESET:\n\t\t\t\t\tif (element.length)\n\t\t\t\t\t\treturn (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.combine)(element.props, function (value) {\n\t\t\t\t\t\t\tswitch ((0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.match)(value, /(::plac\\w+|:read-\\w+)/)) {\n\t\t\t\t\t\t\t\t// :read-(only|write)\n\t\t\t\t\t\t\t\tcase ':read-only': case ':read-write':\n\t\t\t\t\t\t\t\t\treturn (0,_Serializer_js__WEBPACK_IMPORTED_MODULE_3__.serialize)([(0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_4__.copy)(element, {props: [(0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.replace)(value, /:(read-\\w+)/, ':' + _Enum_js__WEBPACK_IMPORTED_MODULE_1__.MOZ + '$1')]})], callback)\n\t\t\t\t\t\t\t\t// :placeholder\n\t\t\t\t\t\t\t\tcase '::placeholder':\n\t\t\t\t\t\t\t\t\treturn (0,_Serializer_js__WEBPACK_IMPORTED_MODULE_3__.serialize)([\n\t\t\t\t\t\t\t\t\t\t(0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_4__.copy)(element, {props: [(0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.replace)(value, /:(plac\\w+)/, ':' + _Enum_js__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + 'input-$1')]}),\n\t\t\t\t\t\t\t\t\t\t(0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_4__.copy)(element, {props: [(0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.replace)(value, /:(plac\\w+)/, ':' + _Enum_js__WEBPACK_IMPORTED_MODULE_1__.MOZ + '$1')]}),\n\t\t\t\t\t\t\t\t\t\t(0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_4__.copy)(element, {props: [(0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.replace)(value, /:(plac\\w+)/, _Enum_js__WEBPACK_IMPORTED_MODULE_1__.MS + 'input-$1')]})\n\t\t\t\t\t\t\t\t\t], callback)\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn ''\n\t\t\t\t\t\t})\n\t\t\t}\n}\n\n/**\n * @param {object} element\n * @param {number} index\n * @param {object[]} children\n */\nfunction namespace (element) {\n\tswitch (element.type) {\n\t\tcase _Enum_js__WEBPACK_IMPORTED_MODULE_1__.RULESET:\n\t\t\telement.props = element.props.map(function (value) {\n\t\t\t\treturn (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.combine)((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_4__.tokenize)(value), function (value, index, children) {\n\t\t\t\t\tswitch ((0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.charat)(value, 0)) {\n\t\t\t\t\t\t// \\f\n\t\t\t\t\t\tcase 12:\n\t\t\t\t\t\t\treturn (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.substr)(value, 1, (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.strlen)(value))\n\t\t\t\t\t\t// \\0 ( + > ~\n\t\t\t\t\t\tcase 0: case 40: case 43: case 62: case 126:\n\t\t\t\t\t\t\treturn value\n\t\t\t\t\t\t// :\n\t\t\t\t\t\tcase 58:\n\t\t\t\t\t\t\tif (children[++index] === 'global')\n\t\t\t\t\t\t\t\tchildren[index] = '', children[++index] = '\\f' + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.substr)(children[index], index = 1, -1)\n\t\t\t\t\t\t// \\s\n\t\t\t\t\t\tcase 32:\n\t\t\t\t\t\t\treturn index === 1 ? '' : value\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tswitch (index) {\n\t\t\t\t\t\t\t\tcase 0: element = value\n\t\t\t\t\t\t\t\t\treturn (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.sizeof)(children) > 1 ? '' : value\n\t\t\t\t\t\t\t\tcase index = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.sizeof)(children) - 1: case 2:\n\t\t\t\t\t\t\t\t\treturn index === 2 ? value + element + element : value + element\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\treturn value\n\t\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t})\n\t}\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/stylis/src/Middleware.js?"); /***/ }), /***/ "./node_modules/stylis/src/Parser.js": /*!*******************************************!*\ !*** ./node_modules/stylis/src/Parser.js ***! \*******************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ comment: () => (/* binding */ comment),\n/* harmony export */ compile: () => (/* binding */ compile),\n/* harmony export */ declaration: () => (/* binding */ declaration),\n/* harmony export */ parse: () => (/* binding */ parse),\n/* harmony export */ ruleset: () => (/* binding */ ruleset)\n/* harmony export */ });\n/* harmony import */ var _Enum_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Enum.js */ \"./node_modules/stylis/src/Enum.js\");\n/* harmony import */ var _Utility_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Utility.js */ \"./node_modules/stylis/src/Utility.js\");\n/* harmony import */ var _Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Tokenizer.js */ \"./node_modules/stylis/src/Tokenizer.js\");\n\n\n\n\n/**\n * @param {string} value\n * @return {object[]}\n */\nfunction compile (value) {\n\treturn (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__.dealloc)(parse('', null, null, null, [''], value = (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__.alloc)(value), 0, [0], value))\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {string[]} rule\n * @param {string[]} rules\n * @param {string[]} rulesets\n * @param {number[]} pseudo\n * @param {number[]} points\n * @param {string[]} declarations\n * @return {object}\n */\nfunction parse (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {\n\tvar index = 0\n\tvar offset = 0\n\tvar length = pseudo\n\tvar atrule = 0\n\tvar property = 0\n\tvar previous = 0\n\tvar variable = 1\n\tvar scanning = 1\n\tvar ampersand = 1\n\tvar character = 0\n\tvar type = ''\n\tvar props = rules\n\tvar children = rulesets\n\tvar reference = rule\n\tvar characters = type\n\n\twhile (scanning)\n\t\tswitch (previous = character, character = (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__.next)()) {\n\t\t\t// (\n\t\t\tcase 40:\n\t\t\t\tif (previous != 108 && (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.charat)(characters, length - 1) == 58) {\n\t\t\t\t\tif ((0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.indexof)(characters += (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__.delimit)(character), '&', '&\\f'), '&\\f') != -1)\n\t\t\t\t\t\tampersand = -1\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t// \" ' [\n\t\t\tcase 34: case 39: case 91:\n\t\t\t\tcharacters += (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__.delimit)(character)\n\t\t\t\tbreak\n\t\t\t// \\t \\n \\r \\s\n\t\t\tcase 9: case 10: case 13: case 32:\n\t\t\t\tcharacters += (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__.whitespace)(previous)\n\t\t\t\tbreak\n\t\t\t// \\\n\t\t\tcase 92:\n\t\t\t\tcharacters += (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__.escaping)((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__.caret)() - 1, 7)\n\t\t\t\tcontinue\n\t\t\t// /\n\t\t\tcase 47:\n\t\t\t\tswitch ((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__.peek)()) {\n\t\t\t\t\tcase 42: case 47:\n\t\t\t\t\t\t;(0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.append)(comment((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__.commenter)((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__.next)(), (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__.caret)()), root, parent), declarations)\n\t\t\t\t\t\tbreak\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tcharacters += '/'\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t// {\n\t\t\tcase 123 * variable:\n\t\t\t\tpoints[index++] = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.strlen)(characters) * ampersand\n\t\t\t// } ; \\0\n\t\t\tcase 125 * variable: case 59: case 0:\n\t\t\t\tswitch (character) {\n\t\t\t\t\t// \\0 }\n\t\t\t\t\tcase 0: case 125: scanning = 0\n\t\t\t\t\t// ;\n\t\t\t\t\tcase 59 + offset: if (ampersand == -1) characters = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(characters, /\\f/g, '')\n\t\t\t\t\t\tif (property > 0 && ((0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.strlen)(characters) - length))\n\t\t\t\t\t\t\t(0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.append)(property > 32 ? declaration(characters + ';', rule, parent, length - 1) : declaration((0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(characters, ' ', '') + ';', rule, parent, length - 2), declarations)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// @ ;\n\t\t\t\t\tcase 59: characters += ';'\n\t\t\t\t\t// { rule/at-rule\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t;(0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.append)(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length), rulesets)\n\n\t\t\t\t\t\tif (character === 123)\n\t\t\t\t\t\t\tif (offset === 0)\n\t\t\t\t\t\t\t\tparse(characters, root, reference, reference, props, rulesets, length, points, children)\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tswitch (atrule === 99 && (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.charat)(characters, 3) === 110 ? 100 : atrule) {\n\t\t\t\t\t\t\t\t\t// d l m s\n\t\t\t\t\t\t\t\t\tcase 100: case 108: case 109: case 115:\n\t\t\t\t\t\t\t\t\t\tparse(value, reference, reference, rule && (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.append)(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length), children), rules, children, length, points, rule ? props : children)\n\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\tparse(characters, reference, reference, reference, [''], children, 0, points, children)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tindex = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo\n\t\t\t\tbreak\n\t\t\t// :\n\t\t\tcase 58:\n\t\t\t\tlength = 1 + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.strlen)(characters), property = previous\n\t\t\tdefault:\n\t\t\t\tif (variable < 1)\n\t\t\t\t\tif (character == 123)\n\t\t\t\t\t\t--variable\n\t\t\t\t\telse if (character == 125 && variable++ == 0 && (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__.prev)() == 125)\n\t\t\t\t\t\tcontinue\n\n\t\t\t\tswitch (characters += (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.from)(character), character * variable) {\n\t\t\t\t\t// &\n\t\t\t\t\tcase 38:\n\t\t\t\t\t\tampersand = offset > 0 ? 1 : (characters += '\\f', -1)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// ,\n\t\t\t\t\tcase 44:\n\t\t\t\t\t\tpoints[index++] = ((0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.strlen)(characters) - 1) * ampersand, ampersand = 1\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// @\n\t\t\t\t\tcase 64:\n\t\t\t\t\t\t// -\n\t\t\t\t\t\tif ((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__.peek)() === 45)\n\t\t\t\t\t\t\tcharacters += (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__.delimit)((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__.next)())\n\n\t\t\t\t\t\tatrule = (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__.peek)(), offset = length = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.strlen)(type = characters += (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__.identifier)((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__.caret)())), character++\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// -\n\t\t\t\t\tcase 45:\n\t\t\t\t\t\tif (previous === 45 && (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.strlen)(characters) == 2)\n\t\t\t\t\t\t\tvariable = 0\n\t\t\t\t}\n\t\t}\n\n\treturn rulesets\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {number} index\n * @param {number} offset\n * @param {string[]} rules\n * @param {number[]} points\n * @param {string} type\n * @param {string[]} props\n * @param {string[]} children\n * @param {number} length\n * @return {object}\n */\nfunction ruleset (value, root, parent, index, offset, rules, points, type, props, children, length) {\n\tvar post = offset - 1\n\tvar rule = offset === 0 ? rules : ['']\n\tvar size = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.sizeof)(rule)\n\n\tfor (var i = 0, j = 0, k = 0; i < index; ++i)\n\t\tfor (var x = 0, y = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.substr)(value, post + 1, post = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.abs)(j = points[i])), z = value; x < size; ++x)\n\t\t\tif (z = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.trim)(j > 0 ? rule[x] + ' ' + y : (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(y, /&\\f/g, rule[x])))\n\t\t\t\tprops[k++] = z\n\n\treturn (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__.node)(value, root, parent, offset === 0 ? _Enum_js__WEBPACK_IMPORTED_MODULE_2__.RULESET : type, props, children, length)\n}\n\n/**\n * @param {number} value\n * @param {object} root\n * @param {object?} parent\n * @return {object}\n */\nfunction comment (value, root, parent) {\n\treturn (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__.node)(value, root, parent, _Enum_js__WEBPACK_IMPORTED_MODULE_2__.COMMENT, (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.from)((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__.char)()), (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.substr)(value, 2, -2), 0)\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {number} length\n * @return {object}\n */\nfunction declaration (value, root, parent, length) {\n\treturn (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_0__.node)(value, root, parent, _Enum_js__WEBPACK_IMPORTED_MODULE_2__.DECLARATION, (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.substr)(value, 0, length), (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.substr)(value, length + 1, -1), length)\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/stylis/src/Parser.js?"); /***/ }), /***/ "./node_modules/stylis/src/Prefixer.js": /*!*********************************************!*\ !*** ./node_modules/stylis/src/Prefixer.js ***! \*********************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ prefix: () => (/* binding */ prefix)\n/* harmony export */ });\n/* harmony import */ var _Enum_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Enum.js */ \"./node_modules/stylis/src/Enum.js\");\n/* harmony import */ var _Utility_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Utility.js */ \"./node_modules/stylis/src/Utility.js\");\n\n\n\n/**\n * @param {string} value\n * @param {number} length\n * @param {object[]} children\n * @return {string}\n */\nfunction prefix (value, length, children) {\n\tswitch ((0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.hash)(value, length)) {\n\t\t// color-adjust\n\t\tcase 5103:\n\t\t\treturn _Enum_js__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + 'print-' + value + value\n\t\t// animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)\n\t\tcase 5737: case 4201: case 3177: case 3433: case 1641: case 4457: case 2921:\n\t\t// text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break\n\t\tcase 5572: case 6356: case 5844: case 3191: case 6645: case 3005:\n\t\t// mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,\n\t\tcase 6391: case 5879: case 5623: case 6135: case 4599: case 4855:\n\t\t// background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)\n\t\tcase 4215: case 6389: case 5109: case 5365: case 5621: case 3829:\n\t\t\treturn _Enum_js__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + value + value\n\t\t// tab-size\n\t\tcase 4789:\n\t\t\treturn _Enum_js__WEBPACK_IMPORTED_MODULE_1__.MOZ + value + value\n\t\t// appearance, user-select, transform, hyphens, text-size-adjust\n\t\tcase 5349: case 4246: case 4810: case 6968: case 2756:\n\t\t\treturn _Enum_js__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + value + _Enum_js__WEBPACK_IMPORTED_MODULE_1__.MOZ + value + _Enum_js__WEBPACK_IMPORTED_MODULE_1__.MS + value + value\n\t\t// writing-mode\n\t\tcase 5936:\n\t\t\tswitch ((0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.charat)(value, length + 11)) {\n\t\t\t\t// vertical-l(r)\n\t\t\t\tcase 114:\n\t\t\t\t\treturn _Enum_js__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + value + _Enum_js__WEBPACK_IMPORTED_MODULE_1__.MS + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.replace)(value, /[svh]\\w+-[tblr]{2}/, 'tb') + value\n\t\t\t\t// vertical-r(l)\n\t\t\t\tcase 108:\n\t\t\t\t\treturn _Enum_js__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + value + _Enum_js__WEBPACK_IMPORTED_MODULE_1__.MS + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.replace)(value, /[svh]\\w+-[tblr]{2}/, 'tb-rl') + value\n\t\t\t\t// horizontal(-)tb\n\t\t\t\tcase 45:\n\t\t\t\t\treturn _Enum_js__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + value + _Enum_js__WEBPACK_IMPORTED_MODULE_1__.MS + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.replace)(value, /[svh]\\w+-[tblr]{2}/, 'lr') + value\n\t\t\t\t// default: fallthrough to below\n\t\t\t}\n\t\t// flex, flex-direction, scroll-snap-type, writing-mode\n\t\tcase 6828: case 4268: case 2903:\n\t\t\treturn _Enum_js__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + value + _Enum_js__WEBPACK_IMPORTED_MODULE_1__.MS + value + value\n\t\t// order\n\t\tcase 6165:\n\t\t\treturn _Enum_js__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + value + _Enum_js__WEBPACK_IMPORTED_MODULE_1__.MS + 'flex-' + value + value\n\t\t// align-items\n\t\tcase 5187:\n\t\t\treturn _Enum_js__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + value + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.replace)(value, /(\\w+).+(:[^]+)/, _Enum_js__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + 'box-$1$2' + _Enum_js__WEBPACK_IMPORTED_MODULE_1__.MS + 'flex-$1$2') + value\n\t\t// align-self\n\t\tcase 5443:\n\t\t\treturn _Enum_js__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + value + _Enum_js__WEBPACK_IMPORTED_MODULE_1__.MS + 'flex-item-' + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.replace)(value, /flex-|-self/g, '') + (!(0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.match)(value, /flex-|baseline/) ? _Enum_js__WEBPACK_IMPORTED_MODULE_1__.MS + 'grid-row-' + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.replace)(value, /flex-|-self/g, '') : '') + value\n\t\t// align-content\n\t\tcase 4675:\n\t\t\treturn _Enum_js__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + value + _Enum_js__WEBPACK_IMPORTED_MODULE_1__.MS + 'flex-line-pack' + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.replace)(value, /align-content|flex-|-self/g, '') + value\n\t\t// flex-shrink\n\t\tcase 5548:\n\t\t\treturn _Enum_js__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + value + _Enum_js__WEBPACK_IMPORTED_MODULE_1__.MS + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.replace)(value, 'shrink', 'negative') + value\n\t\t// flex-basis\n\t\tcase 5292:\n\t\t\treturn _Enum_js__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + value + _Enum_js__WEBPACK_IMPORTED_MODULE_1__.MS + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.replace)(value, 'basis', 'preferred-size') + value\n\t\t// flex-grow\n\t\tcase 6060:\n\t\t\treturn _Enum_js__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + 'box-' + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.replace)(value, '-grow', '') + _Enum_js__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + value + _Enum_js__WEBPACK_IMPORTED_MODULE_1__.MS + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.replace)(value, 'grow', 'positive') + value\n\t\t// transition\n\t\tcase 4554:\n\t\t\treturn _Enum_js__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.replace)(value, /([^-])(transform)/g, '$1' + _Enum_js__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + '$2') + value\n\t\t// cursor\n\t\tcase 6187:\n\t\t\treturn (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.replace)((0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.replace)((0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.replace)(value, /(zoom-|grab)/, _Enum_js__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + '$1'), /(image-set)/, _Enum_js__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + '$1'), value, '') + value\n\t\t// background, background-image\n\t\tcase 5495: case 3959:\n\t\t\treturn (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.replace)(value, /(image-set\\([^]*)/, _Enum_js__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + '$1' + '$`$1')\n\t\t// justify-content\n\t\tcase 4968:\n\t\t\treturn (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.replace)((0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.replace)(value, /(.+:)(flex-)?(.*)/, _Enum_js__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + 'box-pack:$3' + _Enum_js__WEBPACK_IMPORTED_MODULE_1__.MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + _Enum_js__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + value + value\n\t\t// justify-self\n\t\tcase 4200:\n\t\t\tif (!(0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.match)(value, /flex-|baseline/)) return _Enum_js__WEBPACK_IMPORTED_MODULE_1__.MS + 'grid-column-align' + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.substr)(value, length) + value\n\t\t\tbreak\n\t\t// grid-template-(columns|rows)\n\t\tcase 2592: case 3360:\n\t\t\treturn _Enum_js__WEBPACK_IMPORTED_MODULE_1__.MS + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.replace)(value, 'template-', '') + value\n\t\t// grid-(row|column)-start\n\t\tcase 4384: case 3616:\n\t\t\tif (children && children.some(function (element, index) { return length = index, (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.match)(element.props, /grid-\\w+-end/) })) {\n\t\t\t\treturn ~(0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.indexof)(value + (children = children[length].value), 'span') ? value : (_Enum_js__WEBPACK_IMPORTED_MODULE_1__.MS + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.replace)(value, '-start', '') + value + _Enum_js__WEBPACK_IMPORTED_MODULE_1__.MS + 'grid-row-span:' + (~(0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.indexof)(children, 'span') ? (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.match)(children, /\\d+/) : +(0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.match)(children, /\\d+/) - +(0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.match)(value, /\\d+/)) + ';')\n\t\t\t}\n\t\t\treturn _Enum_js__WEBPACK_IMPORTED_MODULE_1__.MS + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.replace)(value, '-start', '') + value\n\t\t// grid-(row|column)-end\n\t\tcase 4896: case 4128:\n\t\t\treturn (children && children.some(function (element) { return (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.match)(element.props, /grid-\\w+-start/) })) ? value : _Enum_js__WEBPACK_IMPORTED_MODULE_1__.MS + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.replace)((0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.replace)(value, '-end', '-span'), 'span ', '') + value\n\t\t// (margin|padding)-inline-(start|end)\n\t\tcase 4095: case 3583: case 4068: case 2532:\n\t\t\treturn (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.replace)(value, /(.+)-inline(.+)/, _Enum_js__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + '$1$2') + value\n\t\t// (min|max)?(width|height|inline-size|block-size)\n\t\tcase 8116: case 7059: case 5753: case 5535:\n\t\tcase 5445: case 5701: case 4933: case 4677:\n\t\tcase 5533: case 5789: case 5021: case 4765:\n\t\t\t// stretch, max-content, min-content, fill-available\n\t\t\tif ((0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.strlen)(value) - 1 - length > 6)\n\t\t\t\tswitch ((0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.charat)(value, length + 1)) {\n\t\t\t\t\t// (m)ax-content, (m)in-content\n\t\t\t\t\tcase 109:\n\t\t\t\t\t\t// -\n\t\t\t\t\t\tif ((0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.charat)(value, length + 4) !== 45)\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t// (f)ill-available, (f)it-content\n\t\t\t\t\tcase 102:\n\t\t\t\t\t\treturn (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.replace)(value, /(.+:)(.+)-([^]+)/, '$1' + _Enum_js__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + '$2-$3' + '$1' + _Enum_js__WEBPACK_IMPORTED_MODULE_1__.MOZ + ((0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.charat)(value, length + 3) == 108 ? '$3' : '$2-$3')) + value\n\t\t\t\t\t// (s)tretch\n\t\t\t\t\tcase 115:\n\t\t\t\t\t\treturn ~(0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.indexof)(value, 'stretch') ? prefix((0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.replace)(value, 'stretch', 'fill-available'), length, children) + value : value\n\t\t\t\t}\n\t\t\tbreak\n\t\t// grid-(column|row)\n\t\tcase 5152: case 5920:\n\t\t\treturn (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.replace)(value, /(.+?):(\\d+)(\\s*\\/\\s*(span)?\\s*(\\d+))?(.*)/, function (_, a, b, c, d, e, f) { return (_Enum_js__WEBPACK_IMPORTED_MODULE_1__.MS + a + ':' + b + f) + (c ? (_Enum_js__WEBPACK_IMPORTED_MODULE_1__.MS + a + '-span:' + (d ? e : +e - +b)) + f : '') + value })\n\t\t// position: sticky\n\t\tcase 4949:\n\t\t\t// stick(y)?\n\t\t\tif ((0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.charat)(value, length + 6) === 121)\n\t\t\t\treturn (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.replace)(value, ':', ':' + _Enum_js__WEBPACK_IMPORTED_MODULE_1__.WEBKIT) + value\n\t\t\tbreak\n\t\t// display: (flex|inline-flex|grid|inline-grid)\n\t\tcase 6444:\n\t\t\tswitch ((0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.charat)(value, (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.charat)(value, 14) === 45 ? 18 : 11)) {\n\t\t\t\t// (inline-)?fle(x)\n\t\t\t\tcase 120:\n\t\t\t\t\treturn (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.replace)(value, /(.+:)([^;\\s!]+)(;|(\\s+)?!.+)?/, '$1' + _Enum_js__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + ((0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.charat)(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + _Enum_js__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + '$2$3' + '$1' + _Enum_js__WEBPACK_IMPORTED_MODULE_1__.MS + '$2box$3') + value\n\t\t\t\t// (inline-)?gri(d)\n\t\t\t\tcase 100:\n\t\t\t\t\treturn (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.replace)(value, ':', ':' + _Enum_js__WEBPACK_IMPORTED_MODULE_1__.MS) + value\n\t\t\t}\n\t\t\tbreak\n\t\t// scroll-margin, scroll-margin-(top|right|bottom|left)\n\t\tcase 5719: case 2647: case 2135: case 3927: case 2391:\n\t\t\treturn (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.replace)(value, 'scroll-', 'scroll-snap-') + value\n\t}\n\n\treturn value\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/stylis/src/Prefixer.js?"); /***/ }), /***/ "./node_modules/stylis/src/Serializer.js": /*!***********************************************!*\ !*** ./node_modules/stylis/src/Serializer.js ***! \***********************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ serialize: () => (/* binding */ serialize),\n/* harmony export */ stringify: () => (/* binding */ stringify)\n/* harmony export */ });\n/* harmony import */ var _Enum_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Enum.js */ \"./node_modules/stylis/src/Enum.js\");\n/* harmony import */ var _Utility_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Utility.js */ \"./node_modules/stylis/src/Utility.js\");\n\n\n\n/**\n * @param {object[]} children\n * @param {function} callback\n * @return {string}\n */\nfunction serialize (children, callback) {\n\tvar output = ''\n\tvar length = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.sizeof)(children)\n\n\tfor (var i = 0; i < length; i++)\n\t\toutput += callback(children[i], i, children, callback) || ''\n\n\treturn output\n}\n\n/**\n * @param {object} element\n * @param {number} index\n * @param {object[]} children\n * @param {function} callback\n * @return {string}\n */\nfunction stringify (element, index, children, callback) {\n\tswitch (element.type) {\n\t\tcase _Enum_js__WEBPACK_IMPORTED_MODULE_1__.LAYER: if (element.children.length) break\n\t\tcase _Enum_js__WEBPACK_IMPORTED_MODULE_1__.IMPORT: case _Enum_js__WEBPACK_IMPORTED_MODULE_1__.DECLARATION: return element.return = element.return || element.value\n\t\tcase _Enum_js__WEBPACK_IMPORTED_MODULE_1__.COMMENT: return ''\n\t\tcase _Enum_js__WEBPACK_IMPORTED_MODULE_1__.KEYFRAMES: return element.return = element.value + '{' + serialize(element.children, callback) + '}'\n\t\tcase _Enum_js__WEBPACK_IMPORTED_MODULE_1__.RULESET: element.value = element.props.join(',')\n\t}\n\n\treturn (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.strlen)(children = serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : ''\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/stylis/src/Serializer.js?"); /***/ }), /***/ "./node_modules/stylis/src/Tokenizer.js": /*!**********************************************!*\ !*** ./node_modules/stylis/src/Tokenizer.js ***! \**********************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ alloc: () => (/* binding */ alloc),\n/* harmony export */ caret: () => (/* binding */ caret),\n/* harmony export */ char: () => (/* binding */ char),\n/* harmony export */ character: () => (/* binding */ character),\n/* harmony export */ characters: () => (/* binding */ characters),\n/* harmony export */ column: () => (/* binding */ column),\n/* harmony export */ commenter: () => (/* binding */ commenter),\n/* harmony export */ copy: () => (/* binding */ copy),\n/* harmony export */ dealloc: () => (/* binding */ dealloc),\n/* harmony export */ delimit: () => (/* binding */ delimit),\n/* harmony export */ delimiter: () => (/* binding */ delimiter),\n/* harmony export */ escaping: () => (/* binding */ escaping),\n/* harmony export */ identifier: () => (/* binding */ identifier),\n/* harmony export */ length: () => (/* binding */ length),\n/* harmony export */ line: () => (/* binding */ line),\n/* harmony export */ next: () => (/* binding */ next),\n/* harmony export */ node: () => (/* binding */ node),\n/* harmony export */ peek: () => (/* binding */ peek),\n/* harmony export */ position: () => (/* binding */ position),\n/* harmony export */ prev: () => (/* binding */ prev),\n/* harmony export */ slice: () => (/* binding */ slice),\n/* harmony export */ token: () => (/* binding */ token),\n/* harmony export */ tokenize: () => (/* binding */ tokenize),\n/* harmony export */ tokenizer: () => (/* binding */ tokenizer),\n/* harmony export */ whitespace: () => (/* binding */ whitespace)\n/* harmony export */ });\n/* harmony import */ var _Utility_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Utility.js */ \"./node_modules/stylis/src/Utility.js\");\n\n\nvar line = 1\nvar column = 1\nvar length = 0\nvar position = 0\nvar character = 0\nvar characters = ''\n\n/**\n * @param {string} value\n * @param {object | null} root\n * @param {object | null} parent\n * @param {string} type\n * @param {string[] | string} props\n * @param {object[] | string} children\n * @param {number} length\n */\nfunction node (value, root, parent, type, props, children, length) {\n\treturn {value: value, root: root, parent: parent, type: type, props: props, children: children, line: line, column: column, length: length, return: ''}\n}\n\n/**\n * @param {object} root\n * @param {object} props\n * @return {object}\n */\nfunction copy (root, props) {\n\treturn (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.assign)(node('', null, null, '', null, null, 0), root, {length: -root.length}, props)\n}\n\n/**\n * @return {number}\n */\nfunction char () {\n\treturn character\n}\n\n/**\n * @return {number}\n */\nfunction prev () {\n\tcharacter = position > 0 ? (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.charat)(characters, --position) : 0\n\n\tif (column--, character === 10)\n\t\tcolumn = 1, line--\n\n\treturn character\n}\n\n/**\n * @return {number}\n */\nfunction next () {\n\tcharacter = position < length ? (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.charat)(characters, position++) : 0\n\n\tif (column++, character === 10)\n\t\tcolumn = 1, line++\n\n\treturn character\n}\n\n/**\n * @return {number}\n */\nfunction peek () {\n\treturn (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.charat)(characters, position)\n}\n\n/**\n * @return {number}\n */\nfunction caret () {\n\treturn position\n}\n\n/**\n * @param {number} begin\n * @param {number} end\n * @return {string}\n */\nfunction slice (begin, end) {\n\treturn (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.substr)(characters, begin, end)\n}\n\n/**\n * @param {number} type\n * @return {number}\n */\nfunction token (type) {\n\tswitch (type) {\n\t\t// \\0 \\t \\n \\r \\s whitespace token\n\t\tcase 0: case 9: case 10: case 13: case 32:\n\t\t\treturn 5\n\t\t// ! + , / > @ ~ isolate token\n\t\tcase 33: case 43: case 44: case 47: case 62: case 64: case 126:\n\t\t// ; { } breakpoint token\n\t\tcase 59: case 123: case 125:\n\t\t\treturn 4\n\t\t// : accompanied token\n\t\tcase 58:\n\t\t\treturn 3\n\t\t// \" ' ( [ opening delimit token\n\t\tcase 34: case 39: case 40: case 91:\n\t\t\treturn 2\n\t\t// ) ] closing delimit token\n\t\tcase 41: case 93:\n\t\t\treturn 1\n\t}\n\n\treturn 0\n}\n\n/**\n * @param {string} value\n * @return {any[]}\n */\nfunction alloc (value) {\n\treturn line = column = 1, length = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.strlen)(characters = value), position = 0, []\n}\n\n/**\n * @param {any} value\n * @return {any}\n */\nfunction dealloc (value) {\n\treturn characters = '', value\n}\n\n/**\n * @param {number} type\n * @return {string}\n */\nfunction delimit (type) {\n\treturn (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.trim)(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)))\n}\n\n/**\n * @param {string} value\n * @return {string[]}\n */\nfunction tokenize (value) {\n\treturn dealloc(tokenizer(alloc(value)))\n}\n\n/**\n * @param {number} type\n * @return {string}\n */\nfunction whitespace (type) {\n\twhile (character = peek())\n\t\tif (character < 33)\n\t\t\tnext()\n\t\telse\n\t\t\tbreak\n\n\treturn token(type) > 2 || token(character) > 3 ? '' : ' '\n}\n\n/**\n * @param {string[]} children\n * @return {string[]}\n */\nfunction tokenizer (children) {\n\twhile (next())\n\t\tswitch (token(character)) {\n\t\t\tcase 0: (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.append)(identifier(position - 1), children)\n\t\t\t\tbreak\n\t\t\tcase 2: ;(0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.append)(delimit(character), children)\n\t\t\t\tbreak\n\t\t\tdefault: ;(0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.append)((0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.from)(character), children)\n\t\t}\n\n\treturn children\n}\n\n/**\n * @param {number} index\n * @param {number} count\n * @return {string}\n */\nfunction escaping (index, count) {\n\twhile (--count && next())\n\t\t// not 0-9 A-F a-f\n\t\tif (character < 48 || character > 102 || (character > 57 && character < 65) || (character > 70 && character < 97))\n\t\t\tbreak\n\n\treturn slice(index, caret() + (count < 6 && peek() == 32 && next() == 32))\n}\n\n/**\n * @param {number} type\n * @return {number}\n */\nfunction delimiter (type) {\n\twhile (next())\n\t\tswitch (character) {\n\t\t\t// ] ) \" '\n\t\t\tcase type:\n\t\t\t\treturn position\n\t\t\t// \" '\n\t\t\tcase 34: case 39:\n\t\t\t\tif (type !== 34 && type !== 39)\n\t\t\t\t\tdelimiter(character)\n\t\t\t\tbreak\n\t\t\t// (\n\t\t\tcase 40:\n\t\t\t\tif (type === 41)\n\t\t\t\t\tdelimiter(type)\n\t\t\t\tbreak\n\t\t\t// \\\n\t\t\tcase 92:\n\t\t\t\tnext()\n\t\t\t\tbreak\n\t\t}\n\n\treturn position\n}\n\n/**\n * @param {number} type\n * @param {number} index\n * @return {number}\n */\nfunction commenter (type, index) {\n\twhile (next())\n\t\t// //\n\t\tif (type + character === 47 + 10)\n\t\t\tbreak\n\t\t// /*\n\t\telse if (type + character === 42 + 42 && peek() === 47)\n\t\t\tbreak\n\n\treturn '/*' + slice(index, position - 1) + '*' + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.from)(type === 47 ? type : next())\n}\n\n/**\n * @param {number} index\n * @return {string}\n */\nfunction identifier (index) {\n\twhile (!token(peek()))\n\t\tnext()\n\n\treturn slice(index, position)\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/stylis/src/Tokenizer.js?"); /***/ }), /***/ "./node_modules/stylis/src/Utility.js": /*!********************************************!*\ !*** ./node_modules/stylis/src/Utility.js ***! \********************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ abs: () => (/* binding */ abs),\n/* harmony export */ append: () => (/* binding */ append),\n/* harmony export */ assign: () => (/* binding */ assign),\n/* harmony export */ charat: () => (/* binding */ charat),\n/* harmony export */ combine: () => (/* binding */ combine),\n/* harmony export */ from: () => (/* binding */ from),\n/* harmony export */ hash: () => (/* binding */ hash),\n/* harmony export */ indexof: () => (/* binding */ indexof),\n/* harmony export */ match: () => (/* binding */ match),\n/* harmony export */ replace: () => (/* binding */ replace),\n/* harmony export */ sizeof: () => (/* binding */ sizeof),\n/* harmony export */ strlen: () => (/* binding */ strlen),\n/* harmony export */ substr: () => (/* binding */ substr),\n/* harmony export */ trim: () => (/* binding */ trim)\n/* harmony export */ });\n/**\n * @param {number}\n * @return {number}\n */\nvar abs = Math.abs\n\n/**\n * @param {number}\n * @return {string}\n */\nvar from = String.fromCharCode\n\n/**\n * @param {object}\n * @return {object}\n */\nvar assign = Object.assign\n\n/**\n * @param {string} value\n * @param {number} length\n * @return {number}\n */\nfunction hash (value, length) {\n\treturn charat(value, 0) ^ 45 ? (((((((length << 2) ^ charat(value, 0)) << 2) ^ charat(value, 1)) << 2) ^ charat(value, 2)) << 2) ^ charat(value, 3) : 0\n}\n\n/**\n * @param {string} value\n * @return {string}\n */\nfunction trim (value) {\n\treturn value.trim()\n}\n\n/**\n * @param {string} value\n * @param {RegExp} pattern\n * @return {string?}\n */\nfunction match (value, pattern) {\n\treturn (value = pattern.exec(value)) ? value[0] : value\n}\n\n/**\n * @param {string} value\n * @param {(string|RegExp)} pattern\n * @param {string} replacement\n * @return {string}\n */\nfunction replace (value, pattern, replacement) {\n\treturn value.replace(pattern, replacement)\n}\n\n/**\n * @param {string} value\n * @param {string} search\n * @return {number}\n */\nfunction indexof (value, search) {\n\treturn value.indexOf(search)\n}\n\n/**\n * @param {string} value\n * @param {number} index\n * @return {number}\n */\nfunction charat (value, index) {\n\treturn value.charCodeAt(index) | 0\n}\n\n/**\n * @param {string} value\n * @param {number} begin\n * @param {number} end\n * @return {string}\n */\nfunction substr (value, begin, end) {\n\treturn value.slice(begin, end)\n}\n\n/**\n * @param {string} value\n * @return {number}\n */\nfunction strlen (value) {\n\treturn value.length\n}\n\n/**\n * @param {any[]} value\n * @return {number}\n */\nfunction sizeof (value) {\n\treturn value.length\n}\n\n/**\n * @param {any} value\n * @param {any[]} array\n * @return {any}\n */\nfunction append (value, array) {\n\treturn array.push(value), value\n}\n\n/**\n * @param {string[]} array\n * @param {function} callback\n * @return {string}\n */\nfunction combine (array, callback) {\n\treturn array.map(callback).join('')\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/stylis/src/Utility.js?"); /***/ }), /***/ "./node_modules/three-mesh-bvh/src/core/Constants.js": /*!***********************************************************!*\ !*** ./node_modules/three-mesh-bvh/src/core/Constants.js ***! \***********************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AVERAGE: () => (/* binding */ AVERAGE),\n/* harmony export */ BYTES_PER_NODE: () => (/* binding */ BYTES_PER_NODE),\n/* harmony export */ CENTER: () => (/* binding */ CENTER),\n/* harmony export */ CONTAINED: () => (/* binding */ CONTAINED),\n/* harmony export */ FLOAT32_EPSILON: () => (/* binding */ FLOAT32_EPSILON),\n/* harmony export */ INTERSECTED: () => (/* binding */ INTERSECTED),\n/* harmony export */ IS_LEAFNODE_FLAG: () => (/* binding */ IS_LEAFNODE_FLAG),\n/* harmony export */ NOT_INTERSECTED: () => (/* binding */ NOT_INTERSECTED),\n/* harmony export */ SAH: () => (/* binding */ SAH),\n/* harmony export */ TRAVERSAL_COST: () => (/* binding */ TRAVERSAL_COST),\n/* harmony export */ TRIANGLE_INTERSECT_COST: () => (/* binding */ TRIANGLE_INTERSECT_COST)\n/* harmony export */ });\n// Split strategy constants\nconst CENTER = 0;\nconst AVERAGE = 1;\nconst SAH = 2;\n\n// Traversal constants\nconst NOT_INTERSECTED = 0;\nconst INTERSECTED = 1;\nconst CONTAINED = 2;\n\n// SAH cost constants\n// TODO: hone these costs more. The relative difference between them should be the\n// difference in measured time to perform a triangle intersection vs traversing\n// bounds.\nconst TRIANGLE_INTERSECT_COST = 1.25;\nconst TRAVERSAL_COST = 1;\n\n\n// Build constants\nconst BYTES_PER_NODE = 6 * 4 + 4 + 4;\nconst IS_LEAFNODE_FLAG = 0xFFFF;\n\n// EPSILON for computing floating point error during build\n// https://en.wikipedia.org/wiki/Machine_epsilon#Values_for_standard_hardware_floating_point_arithmetics\nconst FLOAT32_EPSILON = Math.pow( 2, - 24 );\n\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/three-mesh-bvh/src/core/Constants.js?"); /***/ }), /***/ "./node_modules/three-mesh-bvh/src/core/MeshBVH.js": /*!*********************************************************!*\ !*** ./node_modules/three-mesh-bvh/src/core/MeshBVH.js ***! \*********************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MeshBVH: () => (/* binding */ MeshBVH)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var _Constants_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Constants.js */ \"./node_modules/three-mesh-bvh/src/core/Constants.js\");\n/* harmony import */ var _buildFunctions_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./buildFunctions.js */ \"./node_modules/three-mesh-bvh/src/core/buildFunctions.js\");\n/* harmony import */ var _castFunctions_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./castFunctions.js */ \"./node_modules/three-mesh-bvh/src/core/castFunctions.js\");\n/* harmony import */ var _math_OrientedBox_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../math/OrientedBox.js */ \"./node_modules/three-mesh-bvh/src/math/OrientedBox.js\");\n/* harmony import */ var _math_ExtendedTriangle_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../math/ExtendedTriangle.js */ \"./node_modules/three-mesh-bvh/src/math/ExtendedTriangle.js\");\n/* harmony import */ var _utils_PrimitivePool_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/PrimitivePool.js */ \"./node_modules/three-mesh-bvh/src/utils/PrimitivePool.js\");\n/* harmony import */ var _utils_ArrayBoxUtilities_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../utils/ArrayBoxUtilities.js */ \"./node_modules/three-mesh-bvh/src/utils/ArrayBoxUtilities.js\");\n/* harmony import */ var _utils_TriangleUtilities_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils/TriangleUtilities.js */ \"./node_modules/three-mesh-bvh/src/utils/TriangleUtilities.js\");\n\n\n\n\n\n\n\n\n\n\nconst SKIP_GENERATION = Symbol( 'skip tree generation' );\n\nconst aabb = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_0__.Box3();\nconst aabb2 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_0__.Box3();\nconst tempMatrix = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4();\nconst obb = /* @__PURE__ */ new _math_OrientedBox_js__WEBPACK_IMPORTED_MODULE_1__.OrientedBox();\nconst obb2 = /* @__PURE__ */ new _math_OrientedBox_js__WEBPACK_IMPORTED_MODULE_1__.OrientedBox();\nconst temp = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\nconst temp1 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\nconst temp2 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\nconst temp3 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\nconst temp4 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\nconst tempBox = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_0__.Box3();\nconst trianglePool = /* @__PURE__ */ new _utils_PrimitivePool_js__WEBPACK_IMPORTED_MODULE_2__.PrimitivePool( () => new _math_ExtendedTriangle_js__WEBPACK_IMPORTED_MODULE_3__.ExtendedTriangle() );\n\nclass MeshBVH {\n\n\tstatic serialize( bvh, options = {} ) {\n\n\t\tif ( options.isBufferGeometry ) {\n\n\t\t\tconsole.warn( 'MeshBVH.serialize: The arguments for the function have changed. See documentation for new signature.' );\n\n\t\t\treturn MeshBVH.serialize(\n\t\t\t\targuments[ 0 ],\n\t\t\t\t{\n\t\t\t\t\tcloneBuffers: arguments[ 2 ] === undefined ? true : arguments[ 2 ],\n\t\t\t\t}\n\t\t\t);\n\n\t\t}\n\n\t\toptions = {\n\t\t\tcloneBuffers: true,\n\t\t\t...options,\n\t\t};\n\n\t\tconst geometry = bvh.geometry;\n\t\tconst rootData = bvh._roots;\n\t\tconst indexAttribute = geometry.getIndex();\n\t\tlet result;\n\t\tif ( options.cloneBuffers ) {\n\n\t\t\tresult = {\n\t\t\t\troots: rootData.map( root => root.slice() ),\n\t\t\t\tindex: indexAttribute.array.slice(),\n\t\t\t};\n\n\t\t} else {\n\n\t\t\tresult = {\n\t\t\t\troots: rootData,\n\t\t\t\tindex: indexAttribute.array,\n\t\t\t};\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\tstatic deserialize( data, geometry, options = {} ) {\n\n\t\tif ( typeof options === 'boolean' ) {\n\n\t\t\tconsole.warn( 'MeshBVH.deserialize: The arguments for the function have changed. See documentation for new signature.' );\n\n\t\t\treturn MeshBVH.deserialize(\n\t\t\t\targuments[ 0 ],\n\t\t\t\targuments[ 1 ],\n\t\t\t\t{\n\t\t\t\t\tsetIndex: arguments[ 2 ] === undefined ? true : arguments[ 2 ],\n\t\t\t\t}\n\t\t\t);\n\n\t\t}\n\n\t\toptions = {\n\t\t\tsetIndex: true,\n\t\t\t...options,\n\t\t};\n\n\t\tconst { index, roots } = data;\n\t\tconst bvh = new MeshBVH( geometry, { ...options, [ SKIP_GENERATION ]: true } );\n\t\tbvh._roots = roots;\n\n\t\tif ( options.setIndex ) {\n\n\t\t\tconst indexAttribute = geometry.getIndex();\n\t\t\tif ( indexAttribute === null ) {\n\n\t\t\t\tconst newIndex = new three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute( data.index, 1, false );\n\t\t\t\tgeometry.setIndex( newIndex );\n\n\t\t\t} else if ( indexAttribute.array !== index ) {\n\n\t\t\t\tindexAttribute.array.set( index );\n\t\t\t\tindexAttribute.needsUpdate = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn bvh;\n\n\t}\n\n\tconstructor( geometry, options = {} ) {\n\n\t\tif ( ! geometry.isBufferGeometry ) {\n\n\t\t\tthrow new Error( 'MeshBVH: Only BufferGeometries are supported.' );\n\n\t\t} else if ( geometry.index && geometry.index.isInterleavedBufferAttribute ) {\n\n\t\t\tthrow new Error( 'MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.' );\n\n\t\t}\n\n\t\t// default options\n\t\toptions = Object.assign( {\n\n\t\t\tstrategy: _Constants_js__WEBPACK_IMPORTED_MODULE_4__.CENTER,\n\t\t\tmaxDepth: 40,\n\t\t\tmaxLeafTris: 10,\n\t\t\tverbose: true,\n\t\t\tuseSharedArrayBuffer: false,\n\t\t\tsetBoundingBox: true,\n\t\t\tonProgress: null,\n\n\t\t\t// undocumented options\n\n\t\t\t// Whether to skip generating the tree. Used for deserialization.\n\t\t\t[ SKIP_GENERATION ]: false,\n\n\t\t}, options );\n\n\t\tif ( options.useSharedArrayBuffer && typeof SharedArrayBuffer === 'undefined' ) {\n\n\t\t\tthrow new Error( 'MeshBVH: SharedArrayBuffer is not available.' );\n\n\t\t}\n\n\t\tthis._roots = null;\n\t\tif ( ! options[ SKIP_GENERATION ] ) {\n\n\t\t\tthis._roots = (0,_buildFunctions_js__WEBPACK_IMPORTED_MODULE_5__.buildPackedTree)( geometry, options );\n\n\t\t\tif ( ! geometry.boundingBox && options.setBoundingBox ) {\n\n\t\t\t\tgeometry.boundingBox = this.getBoundingBox( new three__WEBPACK_IMPORTED_MODULE_0__.Box3() );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// retain references to the geometry so we can use them it without having to\n\t\t// take a geometry reference in every function.\n\t\tthis.geometry = geometry;\n\n\t}\n\n\trefit( nodeIndices = null ) {\n\n\t\tif ( nodeIndices && Array.isArray( nodeIndices ) ) {\n\n\t\t\tnodeIndices = new Set( nodeIndices );\n\n\t\t}\n\n\t\tconst geometry = this.geometry;\n\t\tconst indexArr = geometry.index.array;\n\t\tconst posAttr = geometry.attributes.position;\n\n\t\tlet buffer, uint32Array, uint16Array, float32Array;\n\t\tlet byteOffset = 0;\n\t\tconst roots = this._roots;\n\t\tfor ( let i = 0, l = roots.length; i < l; i ++ ) {\n\n\t\t\tbuffer = roots[ i ];\n\t\t\tuint32Array = new Uint32Array( buffer );\n\t\t\tuint16Array = new Uint16Array( buffer );\n\t\t\tfloat32Array = new Float32Array( buffer );\n\n\t\t\t_traverse( 0, byteOffset );\n\t\t\tbyteOffset += buffer.byteLength;\n\n\t\t}\n\n\t\tfunction _traverse( node32Index, byteOffset, force = false ) {\n\n\t\t\tconst node16Index = node32Index * 2;\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === _Constants_js__WEBPACK_IMPORTED_MODULE_4__.IS_LEAFNODE_FLAG;\n\t\t\tif ( isLeaf ) {\n\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\n\n\t\t\t\tlet minx = Infinity;\n\t\t\t\tlet miny = Infinity;\n\t\t\t\tlet minz = Infinity;\n\t\t\t\tlet maxx = - Infinity;\n\t\t\t\tlet maxy = - Infinity;\n\t\t\t\tlet maxz = - Infinity;\n\n\t\t\t\tfor ( let i = 3 * offset, l = 3 * ( offset + count ); i < l; i ++ ) {\n\n\t\t\t\t\tconst index = indexArr[ i ];\n\t\t\t\t\tconst x = posAttr.getX( index );\n\t\t\t\t\tconst y = posAttr.getY( index );\n\t\t\t\t\tconst z = posAttr.getZ( index );\n\n\t\t\t\t\tif ( x < minx ) minx = x;\n\t\t\t\t\tif ( x > maxx ) maxx = x;\n\n\t\t\t\t\tif ( y < miny ) miny = y;\n\t\t\t\t\tif ( y > maxy ) maxy = y;\n\n\t\t\t\t\tif ( z < minz ) minz = z;\n\t\t\t\t\tif ( z > maxz ) maxz = z;\n\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] !== minx ||\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] !== miny ||\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] !== minz ||\n\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] !== maxx ||\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] !== maxy ||\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] !== maxz\n\t\t\t\t) {\n\n\t\t\t\t\tfloat32Array[ node32Index + 0 ] = minx;\n\t\t\t\t\tfloat32Array[ node32Index + 1 ] = miny;\n\t\t\t\t\tfloat32Array[ node32Index + 2 ] = minz;\n\n\t\t\t\t\tfloat32Array[ node32Index + 3 ] = maxx;\n\t\t\t\t\tfloat32Array[ node32Index + 4 ] = maxy;\n\t\t\t\t\tfloat32Array[ node32Index + 5 ] = maxz;\n\n\t\t\t\t\treturn true;\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconst left = node32Index + 8;\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\n\n\t\t\t\t// the identifying node indices provided by the shapecast function include offsets of all\n\t\t\t\t// root buffers to guarantee they're unique between roots so offset left and right indices here.\n\t\t\t\tconst offsetLeft = left + byteOffset;\n\t\t\t\tconst offsetRight = right + byteOffset;\n\t\t\t\tlet forceChildren = force;\n\t\t\t\tlet includesLeft = false;\n\t\t\t\tlet includesRight = false;\n\n\t\t\t\tif ( nodeIndices ) {\n\n\t\t\t\t\t// if we see that neither the left or right child are included in the set that need to be updated\n\t\t\t\t\t// then we assume that all children need to be updated.\n\t\t\t\t\tif ( ! forceChildren ) {\n\n\t\t\t\t\t\tincludesLeft = nodeIndices.has( offsetLeft );\n\t\t\t\t\t\tincludesRight = nodeIndices.has( offsetRight );\n\t\t\t\t\t\tforceChildren = ! includesLeft && ! includesRight;\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tincludesLeft = true;\n\t\t\t\t\tincludesRight = true;\n\n\t\t\t\t}\n\n\t\t\t\tconst traverseLeft = forceChildren || includesLeft;\n\t\t\t\tconst traverseRight = forceChildren || includesRight;\n\n\t\t\t\tlet leftChange = false;\n\t\t\t\tif ( traverseLeft ) {\n\n\t\t\t\t\tleftChange = _traverse( left, byteOffset, forceChildren );\n\n\t\t\t\t}\n\n\t\t\t\tlet rightChange = false;\n\t\t\t\tif ( traverseRight ) {\n\n\t\t\t\t\trightChange = _traverse( right, byteOffset, forceChildren );\n\n\t\t\t\t}\n\n\t\t\t\tconst didChange = leftChange || rightChange;\n\t\t\t\tif ( didChange ) {\n\n\t\t\t\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\t\t\t\tconst lefti = left + i;\n\t\t\t\t\t\tconst righti = right + i;\n\t\t\t\t\t\tconst minLeftValue = float32Array[ lefti ];\n\t\t\t\t\t\tconst maxLeftValue = float32Array[ lefti + 3 ];\n\t\t\t\t\t\tconst minRightValue = float32Array[ righti ];\n\t\t\t\t\t\tconst maxRightValue = float32Array[ righti + 3 ];\n\n\t\t\t\t\t\tfloat32Array[ node32Index + i ] = minLeftValue < minRightValue ? minLeftValue : minRightValue;\n\t\t\t\t\t\tfloat32Array[ node32Index + i + 3 ] = maxLeftValue > maxRightValue ? maxLeftValue : maxRightValue;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\treturn didChange;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttraverse( callback, rootIndex = 0 ) {\n\n\t\tconst buffer = this._roots[ rootIndex ];\n\t\tconst uint32Array = new Uint32Array( buffer );\n\t\tconst uint16Array = new Uint16Array( buffer );\n\t\t_traverse( 0 );\n\n\t\tfunction _traverse( node32Index, depth = 0 ) {\n\n\t\t\tconst node16Index = node32Index * 2;\n\t\t\tconst isLeaf = uint16Array[ node16Index + 15 ] === _Constants_js__WEBPACK_IMPORTED_MODULE_4__.IS_LEAFNODE_FLAG;\n\t\t\tif ( isLeaf ) {\n\n\t\t\t\tconst offset = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst count = uint16Array[ node16Index + 14 ];\n\t\t\t\tcallback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), offset, count );\n\n\t\t\t} else {\n\n\t\t\t\t// TODO: use node functions here\n\t\t\t\tconst left = node32Index + _Constants_js__WEBPACK_IMPORTED_MODULE_4__.BYTES_PER_NODE / 4;\n\t\t\t\tconst right = uint32Array[ node32Index + 6 ];\n\t\t\t\tconst splitAxis = uint32Array[ node32Index + 7 ];\n\t\t\t\tconst stopTraversal = callback( depth, isLeaf, new Float32Array( buffer, node32Index * 4, 6 ), splitAxis );\n\n\t\t\t\tif ( ! stopTraversal ) {\n\n\t\t\t\t\t_traverse( left, depth + 1 );\n\t\t\t\t\t_traverse( right, depth + 1 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t/* Core Cast Functions */\n\traycast( ray, materialOrSide = three__WEBPACK_IMPORTED_MODULE_0__.FrontSide ) {\n\n\t\tconst roots = this._roots;\n\t\tconst geometry = this.geometry;\n\t\tconst intersects = [];\n\t\tconst isMaterial = materialOrSide.isMaterial;\n\t\tconst isArrayMaterial = Array.isArray( materialOrSide );\n\n\t\tconst groups = geometry.groups;\n\t\tconst side = isMaterial ? materialOrSide.side : materialOrSide;\n\t\tfor ( let i = 0, l = roots.length; i < l; i ++ ) {\n\n\t\t\tconst materialSide = isArrayMaterial ? materialOrSide[ groups[ i ].materialIndex ].side : side;\n\t\t\tconst startCount = intersects.length;\n\n\t\t\t(0,_castFunctions_js__WEBPACK_IMPORTED_MODULE_6__.setBuffer)( roots[ i ] );\n\t\t\t(0,_castFunctions_js__WEBPACK_IMPORTED_MODULE_6__.raycast)( 0, geometry, materialSide, ray, intersects );\n\t\t\t(0,_castFunctions_js__WEBPACK_IMPORTED_MODULE_6__.clearBuffer)();\n\n\t\t\tif ( isArrayMaterial ) {\n\n\t\t\t\tconst materialIndex = groups[ i ].materialIndex;\n\t\t\t\tfor ( let j = startCount, jl = intersects.length; j < jl; j ++ ) {\n\n\t\t\t\t\tintersects[ j ].face.materialIndex = materialIndex;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn intersects;\n\n\t}\n\n\traycastFirst( ray, materialOrSide = three__WEBPACK_IMPORTED_MODULE_0__.FrontSide ) {\n\n\t\tconst roots = this._roots;\n\t\tconst geometry = this.geometry;\n\t\tconst isMaterial = materialOrSide.isMaterial;\n\t\tconst isArrayMaterial = Array.isArray( materialOrSide );\n\n\t\tlet closestResult = null;\n\n\t\tconst groups = geometry.groups;\n\t\tconst side = isMaterial ? materialOrSide.side : materialOrSide;\n\t\tfor ( let i = 0, l = roots.length; i < l; i ++ ) {\n\n\t\t\tconst materialSide = isArrayMaterial ? materialOrSide[ groups[ i ].materialIndex ].side : side;\n\n\t\t\t(0,_castFunctions_js__WEBPACK_IMPORTED_MODULE_6__.setBuffer)( roots[ i ] );\n\t\t\tconst result = (0,_castFunctions_js__WEBPACK_IMPORTED_MODULE_6__.raycastFirst)( 0, geometry, materialSide, ray );\n\t\t\t(0,_castFunctions_js__WEBPACK_IMPORTED_MODULE_6__.clearBuffer)();\n\n\t\t\tif ( result != null && ( closestResult == null || result.distance < closestResult.distance ) ) {\n\n\t\t\t\tclosestResult = result;\n\t\t\t\tif ( isArrayMaterial ) {\n\n\t\t\t\t\tresult.face.materialIndex = groups[ i ].materialIndex;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn closestResult;\n\n\t}\n\n\tintersectsGeometry( otherGeometry, geomToMesh ) {\n\n\t\tconst geometry = this.geometry;\n\t\tlet result = false;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\t(0,_castFunctions_js__WEBPACK_IMPORTED_MODULE_6__.setBuffer)( root );\n\t\t\tresult = (0,_castFunctions_js__WEBPACK_IMPORTED_MODULE_6__.intersectsGeometry)( 0, geometry, otherGeometry, geomToMesh );\n\t\t\t(0,_castFunctions_js__WEBPACK_IMPORTED_MODULE_6__.clearBuffer)();\n\n\t\t\tif ( result ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\tshapecast( callbacks, _intersectsTriangleFunc, _orderNodesFunc ) {\n\n\t\tconst geometry = this.geometry;\n\t\tif ( callbacks instanceof Function ) {\n\n\t\t\tif ( _intersectsTriangleFunc ) {\n\n\t\t\t\t// Support the previous function signature that provided three sequential index buffer\n\t\t\t\t// indices here.\n\t\t\t\tconst originalTriangleFunc = _intersectsTriangleFunc;\n\t\t\t\t_intersectsTriangleFunc = ( tri, index, contained, depth ) => {\n\n\t\t\t\t\tconst i3 = index * 3;\n\t\t\t\t\treturn originalTriangleFunc( tri, i3, i3 + 1, i3 + 2, contained, depth );\n\n\t\t\t\t};\n\n\n\t\t\t}\n\n\t\t\tcallbacks = {\n\n\t\t\t\tboundsTraverseOrder: _orderNodesFunc,\n\t\t\t\tintersectsBounds: callbacks,\n\t\t\t\tintersectsTriangle: _intersectsTriangleFunc,\n\t\t\t\tintersectsRange: null,\n\n\t\t\t};\n\n\t\t\tconsole.warn( 'MeshBVH: Shapecast function signature has changed and now takes an object of callbacks as a second argument. See docs for new signature.' );\n\n\t\t}\n\n\t\tconst triangle = trianglePool.getPrimitive();\n\t\tlet {\n\t\t\tboundsTraverseOrder,\n\t\t\tintersectsBounds,\n\t\t\tintersectsRange,\n\t\t\tintersectsTriangle,\n\t\t} = callbacks;\n\n\t\tif ( intersectsRange && intersectsTriangle ) {\n\n\t\t\tconst originalIntersectsRange = intersectsRange;\n\t\t\tintersectsRange = ( offset, count, contained, depth, nodeIndex ) => {\n\n\t\t\t\tif ( ! originalIntersectsRange( offset, count, contained, depth, nodeIndex ) ) {\n\n\t\t\t\t\treturn (0,_utils_TriangleUtilities_js__WEBPACK_IMPORTED_MODULE_7__.iterateOverTriangles)( offset, count, geometry, intersectsTriangle, contained, depth, triangle );\n\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\n\t\t\t};\n\n\t\t} else if ( ! intersectsRange ) {\n\n\t\t\tif ( intersectsTriangle ) {\n\n\t\t\t\tintersectsRange = ( offset, count, contained, depth ) => {\n\n\t\t\t\t\treturn (0,_utils_TriangleUtilities_js__WEBPACK_IMPORTED_MODULE_7__.iterateOverTriangles)( offset, count, geometry, intersectsTriangle, contained, depth, triangle );\n\n\t\t\t\t};\n\n\t\t\t} else {\n\n\t\t\t\tintersectsRange = ( offset, count, contained ) => {\n\n\t\t\t\t\treturn contained;\n\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t}\n\n\t\tlet result = false;\n\t\tlet byteOffset = 0;\n\t\tfor ( const root of this._roots ) {\n\n\t\t\t(0,_castFunctions_js__WEBPACK_IMPORTED_MODULE_6__.setBuffer)( root );\n\t\t\tresult = (0,_castFunctions_js__WEBPACK_IMPORTED_MODULE_6__.shapecast)( 0, geometry, intersectsBounds, intersectsRange, boundsTraverseOrder, byteOffset );\n\t\t\t(0,_castFunctions_js__WEBPACK_IMPORTED_MODULE_6__.clearBuffer)();\n\n\t\t\tif ( result ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tbyteOffset += root.byteLength;\n\n\t\t}\n\n\t\ttrianglePool.releasePrimitive( triangle );\n\n\t\treturn result;\n\n\t}\n\n\tbvhcast( otherBvh, matrixToLocal, callbacks ) {\n\n\t\t// BVHCast function for intersecting two BVHs against each other. Ultimately just uses two recursive shapecast calls rather\n\t\t// than an approach that walks down the tree (see bvhcast.js file for more info).\n\n\t\tlet {\n\t\t\tintersectsRanges,\n\t\t\tintersectsTriangles,\n\t\t} = callbacks;\n\n\t\tconst indexAttr = this.geometry.index;\n\t\tconst positionAttr = this.geometry.attributes.position;\n\n\t\tconst otherIndexAttr = otherBvh.geometry.index;\n\t\tconst otherPositionAttr = otherBvh.geometry.attributes.position;\n\n\t\ttempMatrix.copy( matrixToLocal ).invert();\n\n\t\tconst triangle = trianglePool.getPrimitive();\n\t\tconst triangle2 = trianglePool.getPrimitive();\n\n\t\tif ( intersectsTriangles ) {\n\n\t\t\tfunction iterateOverDoubleTriangles( offset1, count1, offset2, count2, depth1, index1, depth2, index2 ) {\n\n\t\t\t\tfor ( let i2 = offset2, l2 = offset2 + count2; i2 < l2; i2 ++ ) {\n\n\t\t\t\t\t(0,_utils_TriangleUtilities_js__WEBPACK_IMPORTED_MODULE_7__.setTriangle)( triangle2, i2 * 3, otherIndexAttr, otherPositionAttr );\n\t\t\t\t\ttriangle2.a.applyMatrix4( matrixToLocal );\n\t\t\t\t\ttriangle2.b.applyMatrix4( matrixToLocal );\n\t\t\t\t\ttriangle2.c.applyMatrix4( matrixToLocal );\n\t\t\t\t\ttriangle2.needsUpdate = true;\n\n\t\t\t\t\tfor ( let i1 = offset1, l1 = offset1 + count1; i1 < l1; i1 ++ ) {\n\n\t\t\t\t\t\t(0,_utils_TriangleUtilities_js__WEBPACK_IMPORTED_MODULE_7__.setTriangle)( triangle, i1 * 3, indexAttr, positionAttr );\n\t\t\t\t\t\ttriangle.needsUpdate = true;\n\n\t\t\t\t\t\tif ( intersectsTriangles( triangle, triangle2, i1, i2, depth1, index1, depth2, index2 ) ) {\n\n\t\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t\tif ( intersectsRanges ) {\n\n\t\t\t\tconst originalIntersectsRanges = intersectsRanges;\n\t\t\t\tintersectsRanges = function ( offset1, count1, offset2, count2, depth1, index1, depth2, index2 ) {\n\n\t\t\t\t\tif ( ! originalIntersectsRanges( offset1, count1, offset2, count2, depth1, index1, depth2, index2 ) ) {\n\n\t\t\t\t\t\treturn iterateOverDoubleTriangles( offset1, count1, offset2, count2, depth1, index1, depth2, index2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\treturn true;\n\n\t\t\t\t};\n\n\t\t\t} else {\n\n\t\t\t\tintersectsRanges = iterateOverDoubleTriangles;\n\n\t\t\t}\n\n\t\t}\n\n\t\totherBvh.getBoundingBox( aabb2 );\n\t\taabb2.applyMatrix4( matrixToLocal );\n\t\tconst result = this.shapecast( {\n\n\t\t\tintersectsBounds: box => aabb2.intersectsBox( box ),\n\n\t\t\tintersectsRange: ( offset1, count1, contained, depth1, nodeIndex1, box ) => {\n\n\t\t\t\taabb.copy( box );\n\t\t\t\taabb.applyMatrix4( tempMatrix );\n\t\t\t\treturn otherBvh.shapecast( {\n\n\t\t\t\t\tintersectsBounds: box => aabb.intersectsBox( box ),\n\n\t\t\t\t\tintersectsRange: ( offset2, count2, contained, depth2, nodeIndex2 ) => {\n\n\t\t\t\t\t\treturn intersectsRanges( offset1, count1, offset2, count2, depth1, nodeIndex1, depth2, nodeIndex2 );\n\n\t\t\t\t\t},\n\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t} );\n\n\t\ttrianglePool.releasePrimitive( triangle );\n\t\ttrianglePool.releasePrimitive( triangle2 );\n\t\treturn result;\n\n\t}\n\n\t/* Derived Cast Functions */\n\tintersectsBox( box, boxToMesh ) {\n\n\t\tobb.set( box.min, box.max, boxToMesh );\n\t\tobb.needsUpdate = true;\n\n\t\treturn this.shapecast(\n\t\t\t{\n\t\t\t\tintersectsBounds: box => obb.intersectsBox( box ),\n\t\t\t\tintersectsTriangle: tri => obb.intersectsTriangle( tri )\n\t\t\t}\n\t\t);\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\treturn this.shapecast(\n\t\t\t{\n\t\t\t\tintersectsBounds: box => sphere.intersectsBox( box ),\n\t\t\t\tintersectsTriangle: tri => tri.intersectsSphere( sphere )\n\t\t\t}\n\t\t);\n\n\t}\n\n\tclosestPointToGeometry( otherGeometry, geometryToBvh, target1 = { }, target2 = { }, minThreshold = 0, maxThreshold = Infinity ) {\n\n\t\tif ( ! otherGeometry.boundingBox ) {\n\n\t\t\totherGeometry.computeBoundingBox();\n\n\t\t}\n\n\t\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\n\t\tobb.needsUpdate = true;\n\n\t\tconst geometry = this.geometry;\n\t\tconst pos = geometry.attributes.position;\n\t\tconst index = geometry.index;\n\t\tconst otherPos = otherGeometry.attributes.position;\n\t\tconst otherIndex = otherGeometry.index;\n\t\tconst triangle = trianglePool.getPrimitive();\n\t\tconst triangle2 = trianglePool.getPrimitive();\n\n\t\tlet tempTarget1 = temp1;\n\t\tlet tempTargetDest1 = temp2;\n\t\tlet tempTarget2 = null;\n\t\tlet tempTargetDest2 = null;\n\n\t\tif ( target2 ) {\n\n\t\t\ttempTarget2 = temp3;\n\t\t\ttempTargetDest2 = temp4;\n\n\t\t}\n\n\t\tlet closestDistance = Infinity;\n\t\tlet closestDistanceTriIndex = null;\n\t\tlet closestDistanceOtherTriIndex = null;\n\t\ttempMatrix.copy( geometryToBvh ).invert();\n\t\tobb2.matrix.copy( tempMatrix );\n\t\tthis.shapecast(\n\t\t\t{\n\n\t\t\t\tboundsTraverseOrder: box => {\n\n\t\t\t\t\treturn obb.distanceToBox( box );\n\n\t\t\t\t},\n\n\t\t\t\tintersectsBounds: ( box, isLeaf, score ) => {\n\n\t\t\t\t\tif ( score < closestDistance && score < maxThreshold ) {\n\n\t\t\t\t\t\t// if we know the triangles of this bounds will be intersected next then\n\t\t\t\t\t\t// save the bounds to use during triangle checks.\n\t\t\t\t\t\tif ( isLeaf ) {\n\n\t\t\t\t\t\t\tobb2.min.copy( box.min );\n\t\t\t\t\t\t\tobb2.max.copy( box.max );\n\t\t\t\t\t\t\tobb2.needsUpdate = true;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t}\n\n\t\t\t\t\treturn false;\n\n\t\t\t\t},\n\n\t\t\t\tintersectsRange: ( offset, count ) => {\n\n\t\t\t\t\tif ( otherGeometry.boundsTree ) {\n\n\t\t\t\t\t\t// if the other geometry has a bvh then use the accelerated path where we use shapecast to find\n\t\t\t\t\t\t// the closest bounds in the other geometry to check.\n\t\t\t\t\t\treturn otherGeometry.boundsTree.shapecast( {\n\t\t\t\t\t\t\tboundsTraverseOrder: box => {\n\n\t\t\t\t\t\t\t\treturn obb2.distanceToBox( box );\n\n\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\tintersectsBounds: ( box, isLeaf, score ) => {\n\n\t\t\t\t\t\t\t\treturn score < closestDistance && score < maxThreshold;\n\n\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\tintersectsRange: ( otherOffset, otherCount ) => {\n\n\t\t\t\t\t\t\t\tfor ( let i2 = otherOffset * 3, l2 = ( otherOffset + otherCount ) * 3; i2 < l2; i2 += 3 ) {\n\n\t\t\t\t\t\t\t\t\t(0,_utils_TriangleUtilities_js__WEBPACK_IMPORTED_MODULE_7__.setTriangle)( triangle2, i2, otherIndex, otherPos );\n\t\t\t\t\t\t\t\t\ttriangle2.a.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\t\t\t\ttriangle2.b.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\t\t\t\ttriangle2.c.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\t\t\t\ttriangle2.needsUpdate = true;\n\n\t\t\t\t\t\t\t\t\tfor ( let i = offset * 3, l = ( offset + count ) * 3; i < l; i += 3 ) {\n\n\t\t\t\t\t\t\t\t\t\t(0,_utils_TriangleUtilities_js__WEBPACK_IMPORTED_MODULE_7__.setTriangle)( triangle, i, index, pos );\n\t\t\t\t\t\t\t\t\t\ttriangle.needsUpdate = true;\n\n\t\t\t\t\t\t\t\t\t\tconst dist = triangle.distanceToTriangle( triangle2, tempTarget1, tempTarget2 );\n\t\t\t\t\t\t\t\t\t\tif ( dist < closestDistance ) {\n\n\t\t\t\t\t\t\t\t\t\t\ttempTargetDest1.copy( tempTarget1 );\n\n\t\t\t\t\t\t\t\t\t\t\tif ( tempTargetDest2 ) {\n\n\t\t\t\t\t\t\t\t\t\t\t\ttempTargetDest2.copy( tempTarget2 );\n\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\tclosestDistance = dist;\n\t\t\t\t\t\t\t\t\t\t\tclosestDistanceTriIndex = i / 3;\n\t\t\t\t\t\t\t\t\t\t\tclosestDistanceOtherTriIndex = i2 / 3;\n\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t// stop traversal if we find a point that's under the given threshold\n\t\t\t\t\t\t\t\t\t\tif ( dist < minThreshold ) {\n\n\t\t\t\t\t\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t} );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// If no bounds tree then we'll just check every triangle.\n\t\t\t\t\t\tconst triCount = otherIndex ? otherIndex.count : otherPos.count;\n\t\t\t\t\t\tfor ( let i2 = 0, l2 = triCount; i2 < l2; i2 += 3 ) {\n\n\t\t\t\t\t\t\t(0,_utils_TriangleUtilities_js__WEBPACK_IMPORTED_MODULE_7__.setTriangle)( triangle2, i2, otherIndex, otherPos );\n\t\t\t\t\t\t\ttriangle2.a.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\t\ttriangle2.b.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\t\ttriangle2.c.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\t\ttriangle2.needsUpdate = true;\n\n\t\t\t\t\t\t\tfor ( let i = offset * 3, l = ( offset + count ) * 3; i < l; i += 3 ) {\n\n\t\t\t\t\t\t\t\t(0,_utils_TriangleUtilities_js__WEBPACK_IMPORTED_MODULE_7__.setTriangle)( triangle, i, index, pos );\n\t\t\t\t\t\t\t\ttriangle.needsUpdate = true;\n\n\t\t\t\t\t\t\t\tconst dist = triangle.distanceToTriangle( triangle2, tempTarget1, tempTarget2 );\n\t\t\t\t\t\t\t\tif ( dist < closestDistance ) {\n\n\t\t\t\t\t\t\t\t\ttempTargetDest1.copy( tempTarget1 );\n\n\t\t\t\t\t\t\t\t\tif ( tempTargetDest2 ) {\n\n\t\t\t\t\t\t\t\t\t\ttempTargetDest2.copy( tempTarget2 );\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tclosestDistance = dist;\n\t\t\t\t\t\t\t\t\tclosestDistanceTriIndex = i / 3;\n\t\t\t\t\t\t\t\t\tclosestDistanceOtherTriIndex = i2 / 3;\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t// stop traversal if we find a point that's under the given threshold\n\t\t\t\t\t\t\t\tif ( dist < minThreshold ) {\n\n\t\t\t\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t},\n\n\t\t\t}\n\n\t\t);\n\n\t\ttrianglePool.releasePrimitive( triangle );\n\t\ttrianglePool.releasePrimitive( triangle2 );\n\n\t\tif ( closestDistance === Infinity ) return null;\n\n\t\tif ( ! target1.point ) target1.point = tempTargetDest1.clone();\n\t\telse target1.point.copy( tempTargetDest1 );\n\t\ttarget1.distance = closestDistance,\n\t\ttarget1.faceIndex = closestDistanceTriIndex;\n\n\t\tif ( target2 ) {\n\n\t\t\tif ( ! target2.point ) target2.point = tempTargetDest2.clone();\n\t\t\telse target2.point.copy( tempTargetDest2 );\n\t\t\ttarget2.point.applyMatrix4( tempMatrix );\n\t\t\ttempTargetDest1.applyMatrix4( tempMatrix );\n\t\t\ttarget2.distance = tempTargetDest1.sub( target2.point ).length();\n\t\t\ttarget2.faceIndex = closestDistanceOtherTriIndex;\n\n\t\t}\n\n\t\treturn target1;\n\n\t}\n\n\tclosestPointToPoint( point, target = { }, minThreshold = 0, maxThreshold = Infinity ) {\n\n\t\t// early out if under minThreshold\n\t\t// skip checking if over maxThreshold\n\t\t// set minThreshold = maxThreshold to quickly check if a point is within a threshold\n\t\t// returns Infinity if no value found\n\t\tconst minThresholdSq = minThreshold * minThreshold;\n\t\tconst maxThresholdSq = maxThreshold * maxThreshold;\n\t\tlet closestDistanceSq = Infinity;\n\t\tlet closestDistanceTriIndex = null;\n\t\tthis.shapecast(\n\n\t\t\t{\n\n\t\t\t\tboundsTraverseOrder: box => {\n\n\t\t\t\t\ttemp.copy( point ).clamp( box.min, box.max );\n\t\t\t\t\treturn temp.distanceToSquared( point );\n\n\t\t\t\t},\n\n\t\t\t\tintersectsBounds: ( box, isLeaf, score ) => {\n\n\t\t\t\t\treturn score < closestDistanceSq && score < maxThresholdSq;\n\n\t\t\t\t},\n\n\t\t\t\tintersectsTriangle: ( tri, triIndex ) => {\n\n\t\t\t\t\ttri.closestPointToPoint( point, temp );\n\t\t\t\t\tconst distSq = point.distanceToSquared( temp );\n\t\t\t\t\tif ( distSq < closestDistanceSq ) {\n\n\t\t\t\t\t\ttemp1.copy( temp );\n\t\t\t\t\t\tclosestDistanceSq = distSq;\n\t\t\t\t\t\tclosestDistanceTriIndex = triIndex;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( distSq < minThresholdSq ) {\n\n\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\treturn false;\n\n\t\t\t\t\t}\n\n\t\t\t\t},\n\n\t\t\t}\n\n\t\t);\n\n\t\tif ( closestDistanceSq === Infinity ) return null;\n\n\t\tconst closestDistance = Math.sqrt( closestDistanceSq );\n\n\t\tif ( ! target.point ) target.point = temp1.clone();\n\t\telse target.point.copy( temp1 );\n\t\ttarget.distance = closestDistance,\n\t\ttarget.faceIndex = closestDistanceTriIndex;\n\n\t\treturn target;\n\n\t}\n\n\tgetBoundingBox( target ) {\n\n\t\ttarget.makeEmpty();\n\n\t\tconst roots = this._roots;\n\t\troots.forEach( buffer => {\n\n\t\t\t(0,_utils_ArrayBoxUtilities_js__WEBPACK_IMPORTED_MODULE_8__.arrayToBox)( 0, new Float32Array( buffer ), tempBox );\n\t\t\ttarget.union( tempBox );\n\n\t\t} );\n\n\t\treturn target;\n\n\t}\n\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/three-mesh-bvh/src/core/MeshBVH.js?"); /***/ }), /***/ "./node_modules/three-mesh-bvh/src/core/MeshBVHNode.js": /*!*************************************************************!*\ !*** ./node_modules/three-mesh-bvh/src/core/MeshBVHNode.js ***! \*************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MeshBVHNode: () => (/* binding */ MeshBVHNode)\n/* harmony export */ });\nclass MeshBVHNode {\n\n\tconstructor() {\n\n\t\t// internal nodes have boundingData, left, right, and splitAxis\n\t\t// leaf nodes have offset and count (referring to primitives in the mesh geometry)\n\n\t}\n\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/three-mesh-bvh/src/core/MeshBVHNode.js?"); /***/ }), /***/ "./node_modules/three-mesh-bvh/src/core/buildFunctions.js": /*!****************************************************************!*\ !*** ./node_modules/three-mesh-bvh/src/core/buildFunctions.js ***! \****************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ buildPackedTree: () => (/* binding */ buildPackedTree),\n/* harmony export */ buildTree: () => (/* binding */ buildTree)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var _MeshBVHNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./MeshBVHNode.js */ \"./node_modules/three-mesh-bvh/src/core/MeshBVHNode.js\");\n/* harmony import */ var _utils_ArrayBoxUtilities_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/ArrayBoxUtilities.js */ \"./node_modules/three-mesh-bvh/src/utils/ArrayBoxUtilities.js\");\n/* harmony import */ var _Constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Constants.js */ \"./node_modules/three-mesh-bvh/src/core/Constants.js\");\n\n\n\n\n\nfunction ensureIndex( geo, options ) {\n\n\tif ( ! geo.index ) {\n\n\t\tconst vertexCount = geo.attributes.position.count;\n\t\tconst BufferConstructor = options.useSharedArrayBuffer ? SharedArrayBuffer : ArrayBuffer;\n\t\tlet index;\n\t\tif ( vertexCount > 65535 ) {\n\n\t\t\tindex = new Uint32Array( new BufferConstructor( 4 * vertexCount ) );\n\n\t\t} else {\n\n\t\t\tindex = new Uint16Array( new BufferConstructor( 2 * vertexCount ) );\n\n\t\t}\n\n\t\tgeo.setIndex( new three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute( index, 1 ) );\n\n\t\tfor ( let i = 0; i < vertexCount; i ++ ) {\n\n\t\t\tindex[ i ] = i;\n\n\t\t}\n\n\t}\n\n}\n\n// Computes the set of { offset, count } ranges which need independent BVH roots. Each\n// region in the geometry index that belongs to a different set of material groups requires\n// a separate BVH root, so that triangles indices belonging to one group never get swapped\n// with triangle indices belongs to another group. For example, if the groups were like this:\n//\n// [-------------------------------------------------------------]\n// |__________________|\n// g0 = [0, 20] |______________________||_____________________|\n// g1 = [16, 40] g2 = [41, 60]\n//\n// we would need four BVH roots: [0, 15], [16, 20], [21, 40], [41, 60].\nfunction getRootIndexRanges( geo ) {\n\n\tif ( ! geo.groups || ! geo.groups.length ) {\n\n\t\treturn [ { offset: 0, count: geo.index.count / 3 } ];\n\n\t}\n\n\tconst ranges = [];\n\tconst rangeBoundaries = new Set();\n\tfor ( const group of geo.groups ) {\n\n\t\trangeBoundaries.add( group.start );\n\t\trangeBoundaries.add( group.start + group.count );\n\n\t}\n\n\t// note that if you don't pass in a comparator, it sorts them lexicographically as strings :-(\n\tconst sortedBoundaries = Array.from( rangeBoundaries.values() ).sort( ( a, b ) => a - b );\n\tfor ( let i = 0; i < sortedBoundaries.length - 1; i ++ ) {\n\n\t\tconst start = sortedBoundaries[ i ], end = sortedBoundaries[ i + 1 ];\n\t\tranges.push( { offset: ( start / 3 ), count: ( end - start ) / 3 } );\n\n\t}\n\n\treturn ranges;\n\n}\n\n// computes the union of the bounds of all of the given triangles and puts the resulting box in target. If\n// centroidTarget is provided then a bounding box is computed for the centroids of the triangles, as well.\n// These are computed together to avoid redundant accesses to bounds array.\nfunction getBounds( triangleBounds, offset, count, target, centroidTarget = null ) {\n\n\tlet minx = Infinity;\n\tlet miny = Infinity;\n\tlet minz = Infinity;\n\tlet maxx = - Infinity;\n\tlet maxy = - Infinity;\n\tlet maxz = - Infinity;\n\n\tlet cminx = Infinity;\n\tlet cminy = Infinity;\n\tlet cminz = Infinity;\n\tlet cmaxx = - Infinity;\n\tlet cmaxy = - Infinity;\n\tlet cmaxz = - Infinity;\n\n\tconst includeCentroid = centroidTarget !== null;\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\n\n\t\tconst cx = triangleBounds[ i + 0 ];\n\t\tconst hx = triangleBounds[ i + 1 ];\n\t\tconst lx = cx - hx;\n\t\tconst rx = cx + hx;\n\t\tif ( lx < minx ) minx = lx;\n\t\tif ( rx > maxx ) maxx = rx;\n\t\tif ( includeCentroid && cx < cminx ) cminx = cx;\n\t\tif ( includeCentroid && cx > cmaxx ) cmaxx = cx;\n\n\t\tconst cy = triangleBounds[ i + 2 ];\n\t\tconst hy = triangleBounds[ i + 3 ];\n\t\tconst ly = cy - hy;\n\t\tconst ry = cy + hy;\n\t\tif ( ly < miny ) miny = ly;\n\t\tif ( ry > maxy ) maxy = ry;\n\t\tif ( includeCentroid && cy < cminy ) cminy = cy;\n\t\tif ( includeCentroid && cy > cmaxy ) cmaxy = cy;\n\n\t\tconst cz = triangleBounds[ i + 4 ];\n\t\tconst hz = triangleBounds[ i + 5 ];\n\t\tconst lz = cz - hz;\n\t\tconst rz = cz + hz;\n\t\tif ( lz < minz ) minz = lz;\n\t\tif ( rz > maxz ) maxz = rz;\n\t\tif ( includeCentroid && cz < cminz ) cminz = cz;\n\t\tif ( includeCentroid && cz > cmaxz ) cmaxz = cz;\n\n\t}\n\n\ttarget[ 0 ] = minx;\n\ttarget[ 1 ] = miny;\n\ttarget[ 2 ] = minz;\n\n\ttarget[ 3 ] = maxx;\n\ttarget[ 4 ] = maxy;\n\ttarget[ 5 ] = maxz;\n\n\tif ( includeCentroid ) {\n\n\t\tcentroidTarget[ 0 ] = cminx;\n\t\tcentroidTarget[ 1 ] = cminy;\n\t\tcentroidTarget[ 2 ] = cminz;\n\n\t\tcentroidTarget[ 3 ] = cmaxx;\n\t\tcentroidTarget[ 4 ] = cmaxy;\n\t\tcentroidTarget[ 5 ] = cmaxz;\n\n\t}\n\n}\n\n// A stand alone function for retrieving the centroid bounds.\nfunction getCentroidBounds( triangleBounds, offset, count, centroidTarget ) {\n\n\tlet cminx = Infinity;\n\tlet cminy = Infinity;\n\tlet cminz = Infinity;\n\tlet cmaxx = - Infinity;\n\tlet cmaxy = - Infinity;\n\tlet cmaxz = - Infinity;\n\n\tfor ( let i = offset * 6, end = ( offset + count ) * 6; i < end; i += 6 ) {\n\n\t\tconst cx = triangleBounds[ i + 0 ];\n\t\tif ( cx < cminx ) cminx = cx;\n\t\tif ( cx > cmaxx ) cmaxx = cx;\n\n\t\tconst cy = triangleBounds[ i + 2 ];\n\t\tif ( cy < cminy ) cminy = cy;\n\t\tif ( cy > cmaxy ) cmaxy = cy;\n\n\t\tconst cz = triangleBounds[ i + 4 ];\n\t\tif ( cz < cminz ) cminz = cz;\n\t\tif ( cz > cmaxz ) cmaxz = cz;\n\n\t}\n\n\tcentroidTarget[ 0 ] = cminx;\n\tcentroidTarget[ 1 ] = cminy;\n\tcentroidTarget[ 2 ] = cminz;\n\n\tcentroidTarget[ 3 ] = cmaxx;\n\tcentroidTarget[ 4 ] = cmaxy;\n\tcentroidTarget[ 5 ] = cmaxz;\n\n}\n\n\n// reorders `tris` such that for `count` elements after `offset`, elements on the left side of the split\n// will be on the left and elements on the right side of the split will be on the right. returns the index\n// of the first element on the right side, or offset + count if there are no elements on the right side.\nfunction partition( index, triangleBounds, offset, count, split ) {\n\n\tlet left = offset;\n\tlet right = offset + count - 1;\n\tconst pos = split.pos;\n\tconst axisOffset = split.axis * 2;\n\n\t// hoare partitioning, see e.g. https://en.wikipedia.org/wiki/Quicksort#Hoare_partition_scheme\n\twhile ( true ) {\n\n\t\twhile ( left <= right && triangleBounds[ left * 6 + axisOffset ] < pos ) {\n\n\t\t\tleft ++;\n\n\t\t}\n\n\n\t\t// if a triangle center lies on the partition plane it is considered to be on the right side\n\t\twhile ( left <= right && triangleBounds[ right * 6 + axisOffset ] >= pos ) {\n\n\t\t\tright --;\n\n\t\t}\n\n\t\tif ( left < right ) {\n\n\t\t\t// we need to swap all of the information associated with the triangles at index\n\t\t\t// left and right; that's the verts in the geometry index, the bounds,\n\t\t\t// and perhaps the SAH planes\n\n\t\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\t\tlet t0 = index[ left * 3 + i ];\n\t\t\t\tindex[ left * 3 + i ] = index[ right * 3 + i ];\n\t\t\t\tindex[ right * 3 + i ] = t0;\n\n\t\t\t\tlet t1 = triangleBounds[ left * 6 + i * 2 + 0 ];\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 0 ] = triangleBounds[ right * 6 + i * 2 + 0 ];\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 0 ] = t1;\n\n\t\t\t\tlet t2 = triangleBounds[ left * 6 + i * 2 + 1 ];\n\t\t\t\ttriangleBounds[ left * 6 + i * 2 + 1 ] = triangleBounds[ right * 6 + i * 2 + 1 ];\n\t\t\t\ttriangleBounds[ right * 6 + i * 2 + 1 ] = t2;\n\n\t\t\t}\n\n\t\t\tleft ++;\n\t\t\tright --;\n\n\t\t} else {\n\n\t\t\treturn left;\n\n\t\t}\n\n\t}\n\n}\n\nconst BIN_COUNT = 32;\nconst binsSort = ( a, b ) => a.candidate - b.candidate;\nconst sahBins = new Array( BIN_COUNT ).fill().map( () => {\n\n\treturn {\n\n\t\tcount: 0,\n\t\tbounds: new Float32Array( 6 ),\n\t\trightCacheBounds: new Float32Array( 6 ),\n\t\tleftCacheBounds: new Float32Array( 6 ),\n\t\tcandidate: 0,\n\n\t};\n\n} );\nconst leftBounds = new Float32Array( 6 );\n\nfunction getOptimalSplit( nodeBoundingData, centroidBoundingData, triangleBounds, offset, count, strategy ) {\n\n\tlet axis = - 1;\n\tlet pos = 0;\n\n\t// Center\n\tif ( strategy === _Constants_js__WEBPACK_IMPORTED_MODULE_1__.CENTER ) {\n\n\t\taxis = (0,_utils_ArrayBoxUtilities_js__WEBPACK_IMPORTED_MODULE_2__.getLongestEdgeIndex)( centroidBoundingData );\n\t\tif ( axis !== - 1 ) {\n\n\t\t\tpos = ( centroidBoundingData[ axis ] + centroidBoundingData[ axis + 3 ] ) / 2;\n\n\t\t}\n\n\t} else if ( strategy === _Constants_js__WEBPACK_IMPORTED_MODULE_1__.AVERAGE ) {\n\n\t\taxis = (0,_utils_ArrayBoxUtilities_js__WEBPACK_IMPORTED_MODULE_2__.getLongestEdgeIndex)( nodeBoundingData );\n\t\tif ( axis !== - 1 ) {\n\n\t\t\tpos = getAverage( triangleBounds, offset, count, axis );\n\n\t\t}\n\n\t} else if ( strategy === _Constants_js__WEBPACK_IMPORTED_MODULE_1__.SAH ) {\n\n\t\tconst rootSurfaceArea = (0,_utils_ArrayBoxUtilities_js__WEBPACK_IMPORTED_MODULE_2__.computeSurfaceArea)( nodeBoundingData );\n\t\tlet bestCost = _Constants_js__WEBPACK_IMPORTED_MODULE_1__.TRIANGLE_INTERSECT_COST * count;\n\n\t\t// iterate over all axes\n\t\tconst cStart = offset * 6;\n\t\tconst cEnd = ( offset + count ) * 6;\n\t\tfor ( let a = 0; a < 3; a ++ ) {\n\n\t\t\tconst axisLeft = centroidBoundingData[ a ];\n\t\t\tconst axisRight = centroidBoundingData[ a + 3 ];\n\t\t\tconst axisLength = axisRight - axisLeft;\n\t\t\tconst binWidth = axisLength / BIN_COUNT;\n\n\t\t\t// If we have fewer triangles than we're planning to split then just check all\n\t\t\t// the triangle positions because it will be faster.\n\t\t\tif ( count < BIN_COUNT / 4 ) {\n\n\t\t\t\t// initialize the bin candidates\n\t\t\t\tconst truncatedBins = [ ...sahBins ];\n\t\t\t\ttruncatedBins.length = count;\n\n\t\t\t\t// set the candidates\n\t\t\t\tlet b = 0;\n\t\t\t\tfor ( let c = cStart; c < cEnd; c += 6, b ++ ) {\n\n\t\t\t\t\tconst bin = truncatedBins[ b ];\n\t\t\t\t\tbin.candidate = triangleBounds[ c + 2 * a ];\n\t\t\t\t\tbin.count = 0;\n\n\t\t\t\t\tconst {\n\t\t\t\t\t\tbounds,\n\t\t\t\t\t\tleftCacheBounds,\n\t\t\t\t\t\trightCacheBounds,\n\t\t\t\t\t} = bin;\n\t\t\t\t\tfor ( let d = 0; d < 3; d ++ ) {\n\n\t\t\t\t\t\trightCacheBounds[ d ] = Infinity;\n\t\t\t\t\t\trightCacheBounds[ d + 3 ] = - Infinity;\n\n\t\t\t\t\t\tleftCacheBounds[ d ] = Infinity;\n\t\t\t\t\t\tleftCacheBounds[ d + 3 ] = - Infinity;\n\n\t\t\t\t\t\tbounds[ d ] = Infinity;\n\t\t\t\t\t\tbounds[ d + 3 ] = - Infinity;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t(0,_utils_ArrayBoxUtilities_js__WEBPACK_IMPORTED_MODULE_2__.expandByTriangleBounds)( c, triangleBounds, bounds );\n\n\t\t\t\t}\n\n\t\t\t\ttruncatedBins.sort( binsSort );\n\n\t\t\t\t// remove redundant splits\n\t\t\t\tlet splitCount = count;\n\t\t\t\tfor ( let bi = 0; bi < splitCount; bi ++ ) {\n\n\t\t\t\t\tconst bin = truncatedBins[ bi ];\n\t\t\t\t\twhile ( bi + 1 < splitCount && truncatedBins[ bi + 1 ].candidate === bin.candidate ) {\n\n\t\t\t\t\t\ttruncatedBins.splice( bi + 1, 1 );\n\t\t\t\t\t\tsplitCount --;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t// find the appropriate bin for each triangle and expand the bounds.\n\t\t\t\tfor ( let c = cStart; c < cEnd; c += 6 ) {\n\n\t\t\t\t\tconst center = triangleBounds[ c + 2 * a ];\n\t\t\t\t\tfor ( let bi = 0; bi < splitCount; bi ++ ) {\n\n\t\t\t\t\t\tconst bin = truncatedBins[ bi ];\n\t\t\t\t\t\tif ( center >= bin.candidate ) {\n\n\t\t\t\t\t\t\t(0,_utils_ArrayBoxUtilities_js__WEBPACK_IMPORTED_MODULE_2__.expandByTriangleBounds)( c, triangleBounds, bin.rightCacheBounds );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t(0,_utils_ArrayBoxUtilities_js__WEBPACK_IMPORTED_MODULE_2__.expandByTriangleBounds)( c, triangleBounds, bin.leftCacheBounds );\n\t\t\t\t\t\t\tbin.count ++;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t// expand all the bounds\n\t\t\t\tfor ( let bi = 0; bi < splitCount; bi ++ ) {\n\n\t\t\t\t\tconst bin = truncatedBins[ bi ];\n\t\t\t\t\tconst leftCount = bin.count;\n\t\t\t\t\tconst rightCount = count - bin.count;\n\n\t\t\t\t\t// check the cost of this split\n\t\t\t\t\tconst leftBounds = bin.leftCacheBounds;\n\t\t\t\t\tconst rightBounds = bin.rightCacheBounds;\n\n\t\t\t\t\tlet leftProb = 0;\n\t\t\t\t\tif ( leftCount !== 0 ) {\n\n\t\t\t\t\t\tleftProb = (0,_utils_ArrayBoxUtilities_js__WEBPACK_IMPORTED_MODULE_2__.computeSurfaceArea)( leftBounds ) / rootSurfaceArea;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tlet rightProb = 0;\n\t\t\t\t\tif ( rightCount !== 0 ) {\n\n\t\t\t\t\t\trightProb = (0,_utils_ArrayBoxUtilities_js__WEBPACK_IMPORTED_MODULE_2__.computeSurfaceArea)( rightBounds ) / rootSurfaceArea;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst cost = _Constants_js__WEBPACK_IMPORTED_MODULE_1__.TRAVERSAL_COST + _Constants_js__WEBPACK_IMPORTED_MODULE_1__.TRIANGLE_INTERSECT_COST * (\n\t\t\t\t\t\tleftProb * leftCount + rightProb * rightCount\n\t\t\t\t\t);\n\n\t\t\t\t\tif ( cost < bestCost ) {\n\n\t\t\t\t\t\taxis = a;\n\t\t\t\t\t\tbestCost = cost;\n\t\t\t\t\t\tpos = bin.candidate;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// reset the bins\n\t\t\t\tfor ( let i = 0; i < BIN_COUNT; i ++ ) {\n\n\t\t\t\t\tconst bin = sahBins[ i ];\n\t\t\t\t\tbin.count = 0;\n\t\t\t\t\tbin.candidate = axisLeft + binWidth + i * binWidth;\n\n\t\t\t\t\tconst bounds = bin.bounds;\n\t\t\t\t\tfor ( let d = 0; d < 3; d ++ ) {\n\n\t\t\t\t\t\tbounds[ d ] = Infinity;\n\t\t\t\t\t\tbounds[ d + 3 ] = - Infinity;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t// iterate over all center positions\n\t\t\t\tfor ( let c = cStart; c < cEnd; c += 6 ) {\n\n\t\t\t\t\tconst triCenter = triangleBounds[ c + 2 * a ];\n\t\t\t\t\tconst relativeCenter = triCenter - axisLeft;\n\n\t\t\t\t\t// in the partition function if the centroid lies on the split plane then it is\n\t\t\t\t\t// considered to be on the right side of the split\n\t\t\t\t\tlet binIndex = ~ ~ ( relativeCenter / binWidth );\n\t\t\t\t\tif ( binIndex >= BIN_COUNT ) binIndex = BIN_COUNT - 1;\n\n\t\t\t\t\tconst bin = sahBins[ binIndex ];\n\t\t\t\t\tbin.count ++;\n\n\t\t\t\t\t(0,_utils_ArrayBoxUtilities_js__WEBPACK_IMPORTED_MODULE_2__.expandByTriangleBounds)( c, triangleBounds, bin.bounds );\n\n\t\t\t\t}\n\n\t\t\t\t// cache the unioned bounds from right to left so we don't have to regenerate them each time\n\t\t\t\tconst lastBin = sahBins[ BIN_COUNT - 1 ];\n\t\t\t\t(0,_utils_ArrayBoxUtilities_js__WEBPACK_IMPORTED_MODULE_2__.copyBounds)( lastBin.bounds, lastBin.rightCacheBounds );\n\t\t\t\tfor ( let i = BIN_COUNT - 2; i >= 0; i -- ) {\n\n\t\t\t\t\tconst bin = sahBins[ i ];\n\t\t\t\t\tconst nextBin = sahBins[ i + 1 ];\n\t\t\t\t\t(0,_utils_ArrayBoxUtilities_js__WEBPACK_IMPORTED_MODULE_2__.unionBounds)( bin.bounds, nextBin.rightCacheBounds, bin.rightCacheBounds );\n\n\t\t\t\t}\n\n\t\t\t\tlet leftCount = 0;\n\t\t\t\tfor ( let i = 0; i < BIN_COUNT - 1; i ++ ) {\n\n\t\t\t\t\tconst bin = sahBins[ i ];\n\t\t\t\t\tconst binCount = bin.count;\n\t\t\t\t\tconst bounds = bin.bounds;\n\n\t\t\t\t\tconst nextBin = sahBins[ i + 1 ];\n\t\t\t\t\tconst rightBounds = nextBin.rightCacheBounds;\n\n\t\t\t\t\t// don't do anything with the bounds if the new bounds have no triangles\n\t\t\t\t\tif ( binCount !== 0 ) {\n\n\t\t\t\t\t\tif ( leftCount === 0 ) {\n\n\t\t\t\t\t\t\t(0,_utils_ArrayBoxUtilities_js__WEBPACK_IMPORTED_MODULE_2__.copyBounds)( bounds, leftBounds );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t(0,_utils_ArrayBoxUtilities_js__WEBPACK_IMPORTED_MODULE_2__.unionBounds)( bounds, leftBounds, leftBounds );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tleftCount += binCount;\n\n\t\t\t\t\t// check the cost of this split\n\t\t\t\t\tlet leftProb = 0;\n\t\t\t\t\tlet rightProb = 0;\n\n\t\t\t\t\tif ( leftCount !== 0 ) {\n\n\t\t\t\t\t\tleftProb = (0,_utils_ArrayBoxUtilities_js__WEBPACK_IMPORTED_MODULE_2__.computeSurfaceArea)( leftBounds ) / rootSurfaceArea;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst rightCount = count - leftCount;\n\t\t\t\t\tif ( rightCount !== 0 ) {\n\n\t\t\t\t\t\trightProb = (0,_utils_ArrayBoxUtilities_js__WEBPACK_IMPORTED_MODULE_2__.computeSurfaceArea)( rightBounds ) / rootSurfaceArea;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst cost = _Constants_js__WEBPACK_IMPORTED_MODULE_1__.TRAVERSAL_COST + _Constants_js__WEBPACK_IMPORTED_MODULE_1__.TRIANGLE_INTERSECT_COST * (\n\t\t\t\t\t\tleftProb * leftCount + rightProb * rightCount\n\t\t\t\t\t);\n\n\t\t\t\t\tif ( cost < bestCost ) {\n\n\t\t\t\t\t\taxis = a;\n\t\t\t\t\t\tbestCost = cost;\n\t\t\t\t\t\tpos = bin.candidate;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t} else {\n\n\t\tconsole.warn( `MeshBVH: Invalid build strategy value ${ strategy } used.` );\n\n\t}\n\n\treturn { axis, pos };\n\n}\n\n// returns the average coordinate on the specified axis of the all the provided triangles\nfunction getAverage( triangleBounds, offset, count, axis ) {\n\n\tlet avg = 0;\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\n\n\t\tavg += triangleBounds[ i * 6 + axis * 2 ];\n\n\t}\n\n\treturn avg / count;\n\n}\n\n// precomputes the bounding box for each triangle; required for quickly calculating tree splits.\n// result is an array of size tris.length * 6 where triangle i maps to a\n// [x_center, x_delta, y_center, y_delta, z_center, z_delta] tuple starting at index i * 6,\n// representing the center and half-extent in each dimension of triangle i\nfunction computeTriangleBounds( geo, fullBounds ) {\n\n\tconst posAttr = geo.attributes.position;\n\tconst index = geo.index.array;\n\tconst triCount = index.length / 3;\n\tconst triangleBounds = new Float32Array( triCount * 6 );\n\tconst normalized = posAttr.normalized;\n\n\t// used for non-normalized positions\n\tconst posArr = posAttr.array;\n\n\t// support for an interleaved position buffer\n\tconst bufferOffset = posAttr.offset || 0;\n\tlet stride = 3;\n\tif ( posAttr.isInterleavedBufferAttribute ) {\n\n\t\tstride = posAttr.data.stride;\n\n\t}\n\n\t// used for normalized positions\n\tconst getters = [ 'getX', 'getY', 'getZ' ];\n\n\tfor ( let tri = 0; tri < triCount; tri ++ ) {\n\n\t\tconst tri3 = tri * 3;\n\t\tconst tri6 = tri * 6;\n\n\t\tlet ai, bi, ci;\n\n\t\tif ( normalized ) {\n\n\t\t\tai = index[ tri3 + 0 ];\n\t\t\tbi = index[ tri3 + 1 ];\n\t\t\tci = index[ tri3 + 2 ];\n\n\t\t} else {\n\n\t\t\tai = index[ tri3 + 0 ] * stride + bufferOffset;\n\t\t\tbi = index[ tri3 + 1 ] * stride + bufferOffset;\n\t\t\tci = index[ tri3 + 2 ] * stride + bufferOffset;\n\n\t\t}\n\n\t\tfor ( let el = 0; el < 3; el ++ ) {\n\n\t\t\tlet a, b, c;\n\n\t\t\tif ( normalized ) {\n\n\t\t\t\ta = posAttr[ getters[ el ] ]( ai );\n\t\t\t\tb = posAttr[ getters[ el ] ]( bi );\n\t\t\t\tc = posAttr[ getters[ el ] ]( ci );\n\n\t\t\t} else {\n\n\t\t\t\ta = posArr[ ai + el ];\n\t\t\t\tb = posArr[ bi + el ];\n\t\t\t\tc = posArr[ ci + el ];\n\n\t\t\t}\n\n\t\t\tlet min = a;\n\t\t\tif ( b < min ) min = b;\n\t\t\tif ( c < min ) min = c;\n\n\t\t\tlet max = a;\n\t\t\tif ( b > max ) max = b;\n\t\t\tif ( c > max ) max = c;\n\n\t\t\t// Increase the bounds size by float32 epsilon to avoid precision errors when\n\t\t\t// converting to 32 bit float. Scale the epsilon by the size of the numbers being\n\t\t\t// worked with.\n\t\t\tconst halfExtents = ( max - min ) / 2;\n\t\t\tconst el2 = el * 2;\n\t\t\ttriangleBounds[ tri6 + el2 + 0 ] = min + halfExtents;\n\t\t\ttriangleBounds[ tri6 + el2 + 1 ] = halfExtents + ( Math.abs( min ) + halfExtents ) * _Constants_js__WEBPACK_IMPORTED_MODULE_1__.FLOAT32_EPSILON;\n\n\t\t\tif ( min < fullBounds[ el ] ) fullBounds[ el ] = min;\n\t\t\tif ( max > fullBounds[ el + 3 ] ) fullBounds[ el + 3 ] = max;\n\n\t\t}\n\n\t}\n\n\treturn triangleBounds;\n\n}\n\nfunction buildTree( geo, options ) {\n\n\tfunction triggerProgress( trianglesProcessed ) {\n\n\t\tif ( onProgress ) {\n\n\t\t\tonProgress( trianglesProcessed / totalTriangles );\n\n\t\t}\n\n\t}\n\n\t// either recursively splits the given node, creating left and right subtrees for it, or makes it a leaf node,\n\t// recording the offset and count of its triangles and writing them into the reordered geometry index.\n\tfunction splitNode( node, offset, count, centroidBoundingData = null, depth = 0 ) {\n\n\t\tif ( ! reachedMaxDepth && depth >= maxDepth ) {\n\n\t\t\treachedMaxDepth = true;\n\t\t\tif ( verbose ) {\n\n\t\t\t\tconsole.warn( `MeshBVH: Max depth of ${ maxDepth } reached when generating BVH. Consider increasing maxDepth.` );\n\t\t\t\tconsole.warn( geo );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// early out if we've met our capacity\n\t\tif ( count <= maxLeafTris || depth >= maxDepth ) {\n\n\t\t\ttriggerProgress( offset + count );\n\t\t\tnode.offset = offset;\n\t\t\tnode.count = count;\n\t\t\treturn node;\n\n\t\t}\n\n\t\t// Find where to split the volume\n\t\tconst split = getOptimalSplit( node.boundingData, centroidBoundingData, triangleBounds, offset, count, strategy );\n\t\tif ( split.axis === - 1 ) {\n\n\t\t\ttriggerProgress( offset + count );\n\t\t\tnode.offset = offset;\n\t\t\tnode.count = count;\n\t\t\treturn node;\n\n\t\t}\n\n\t\tconst splitOffset = partition( indexArray, triangleBounds, offset, count, split );\n\n\t\t// create the two new child nodes\n\t\tif ( splitOffset === offset || splitOffset === offset + count ) {\n\n\t\t\ttriggerProgress( offset + count );\n\t\t\tnode.offset = offset;\n\t\t\tnode.count = count;\n\n\t\t} else {\n\n\t\t\tnode.splitAxis = split.axis;\n\n\t\t\t// create the left child and compute its bounding box\n\t\t\tconst left = new _MeshBVHNode_js__WEBPACK_IMPORTED_MODULE_3__.MeshBVHNode();\n\t\t\tconst lstart = offset;\n\t\t\tconst lcount = splitOffset - offset;\n\t\t\tnode.left = left;\n\t\t\tleft.boundingData = new Float32Array( 6 );\n\n\t\t\tgetBounds( triangleBounds, lstart, lcount, left.boundingData, cacheCentroidBoundingData );\n\t\t\tsplitNode( left, lstart, lcount, cacheCentroidBoundingData, depth + 1 );\n\n\t\t\t// repeat for right\n\t\t\tconst right = new _MeshBVHNode_js__WEBPACK_IMPORTED_MODULE_3__.MeshBVHNode();\n\t\t\tconst rstart = splitOffset;\n\t\t\tconst rcount = count - lcount;\n\t\t\tnode.right = right;\n\t\t\tright.boundingData = new Float32Array( 6 );\n\n\t\t\tgetBounds( triangleBounds, rstart, rcount, right.boundingData, cacheCentroidBoundingData );\n\t\t\tsplitNode( right, rstart, rcount, cacheCentroidBoundingData, depth + 1 );\n\n\t\t}\n\n\t\treturn node;\n\n\t}\n\n\tensureIndex( geo, options );\n\n\t// Compute the full bounds of the geometry at the same time as triangle bounds because\n\t// we'll need it for the root bounds in the case with no groups and it should be fast here.\n\t// We can't use the geometrying bounding box if it's available because it may be out of date.\n\tconst fullBounds = new Float32Array( 6 );\n\tconst cacheCentroidBoundingData = new Float32Array( 6 );\n\tconst triangleBounds = computeTriangleBounds( geo, fullBounds );\n\tconst indexArray = geo.index.array;\n\tconst maxDepth = options.maxDepth;\n\tconst verbose = options.verbose;\n\tconst maxLeafTris = options.maxLeafTris;\n\tconst strategy = options.strategy;\n\tconst onProgress = options.onProgress;\n\tconst totalTriangles = geo.index.count / 3;\n\tlet reachedMaxDepth = false;\n\n\tconst roots = [];\n\tconst ranges = getRootIndexRanges( geo );\n\n\tif ( ranges.length === 1 ) {\n\n\t\tconst range = ranges[ 0 ];\n\t\tconst root = new _MeshBVHNode_js__WEBPACK_IMPORTED_MODULE_3__.MeshBVHNode();\n\t\troot.boundingData = fullBounds;\n\t\tgetCentroidBounds( triangleBounds, range.offset, range.count, cacheCentroidBoundingData );\n\n\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\n\t\troots.push( root );\n\n\t} else {\n\n\t\tfor ( let range of ranges ) {\n\n\t\t\tconst root = new _MeshBVHNode_js__WEBPACK_IMPORTED_MODULE_3__.MeshBVHNode();\n\t\t\troot.boundingData = new Float32Array( 6 );\n\t\t\tgetBounds( triangleBounds, range.offset, range.count, root.boundingData, cacheCentroidBoundingData );\n\n\t\t\tsplitNode( root, range.offset, range.count, cacheCentroidBoundingData );\n\t\t\troots.push( root );\n\n\t\t}\n\n\t}\n\n\treturn roots;\n\n}\n\nfunction buildPackedTree( geo, options ) {\n\n\t// boundingData \t\t\t\t: 6 float32\n\t// right / offset \t\t\t\t: 1 uint32\n\t// splitAxis / isLeaf + count \t: 1 uint32 / 2 uint16\n\tconst roots = buildTree( geo, options );\n\n\tlet float32Array;\n\tlet uint32Array;\n\tlet uint16Array;\n\tconst packedRoots = [];\n\tconst BufferConstructor = options.useSharedArrayBuffer ? SharedArrayBuffer : ArrayBuffer;\n\tfor ( let i = 0; i < roots.length; i ++ ) {\n\n\t\tconst root = roots[ i ];\n\t\tlet nodeCount = countNodes( root );\n\n\t\tconst buffer = new BufferConstructor( _Constants_js__WEBPACK_IMPORTED_MODULE_1__.BYTES_PER_NODE * nodeCount );\n\t\tfloat32Array = new Float32Array( buffer );\n\t\tuint32Array = new Uint32Array( buffer );\n\t\tuint16Array = new Uint16Array( buffer );\n\t\tpopulateBuffer( 0, root );\n\t\tpackedRoots.push( buffer );\n\n\t}\n\n\treturn packedRoots;\n\n\tfunction countNodes( node ) {\n\n\t\tif ( node.count ) {\n\n\t\t\treturn 1;\n\n\t\t} else {\n\n\t\t\treturn 1 + countNodes( node.left ) + countNodes( node.right );\n\n\t\t}\n\n\t}\n\n\tfunction populateBuffer( byteOffset, node ) {\n\n\t\tconst stride4Offset = byteOffset / 4;\n\t\tconst stride2Offset = byteOffset / 2;\n\t\tconst isLeaf = ! ! node.count;\n\t\tconst boundingData = node.boundingData;\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tfloat32Array[ stride4Offset + i ] = boundingData[ i ];\n\n\t\t}\n\n\t\tif ( isLeaf ) {\n\n\t\t\tconst offset = node.offset;\n\t\t\tconst count = node.count;\n\t\t\tuint32Array[ stride4Offset + 6 ] = offset;\n\t\t\tuint16Array[ stride2Offset + 14 ] = count;\n\t\t\tuint16Array[ stride2Offset + 15 ] = _Constants_js__WEBPACK_IMPORTED_MODULE_1__.IS_LEAFNODE_FLAG;\n\t\t\treturn byteOffset + _Constants_js__WEBPACK_IMPORTED_MODULE_1__.BYTES_PER_NODE;\n\n\t\t} else {\n\n\t\t\tconst left = node.left;\n\t\t\tconst right = node.right;\n\t\t\tconst splitAxis = node.splitAxis;\n\n\t\t\tlet nextUnusedPointer;\n\t\t\tnextUnusedPointer = populateBuffer( byteOffset + _Constants_js__WEBPACK_IMPORTED_MODULE_1__.BYTES_PER_NODE, left );\n\n\t\t\tif ( ( nextUnusedPointer / 4 ) > Math.pow( 2, 32 ) ) {\n\n\t\t\t\tthrow new Error( 'MeshBVH: Cannot store child pointer greater than 32 bits.' );\n\n\t\t\t}\n\n\t\t\tuint32Array[ stride4Offset + 6 ] = nextUnusedPointer / 4;\n\t\t\tnextUnusedPointer = populateBuffer( nextUnusedPointer, right );\n\n\t\t\tuint32Array[ stride4Offset + 7 ] = splitAxis;\n\t\t\treturn nextUnusedPointer;\n\n\t\t}\n\n\t}\n\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/three-mesh-bvh/src/core/buildFunctions.js?"); /***/ }), /***/ "./node_modules/three-mesh-bvh/src/core/castFunctions.js": /*!***************************************************************!*\ !*** ./node_modules/three-mesh-bvh/src/core/castFunctions.js ***! \***************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ clearBuffer: () => (/* binding */ clearBuffer),\n/* harmony export */ intersectsGeometry: () => (/* binding */ intersectsGeometry),\n/* harmony export */ raycast: () => (/* binding */ raycast),\n/* harmony export */ raycastFirst: () => (/* binding */ raycastFirst),\n/* harmony export */ setBuffer: () => (/* binding */ setBuffer),\n/* harmony export */ shapecast: () => (/* binding */ shapecast)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var _Constants_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Constants.js */ \"./node_modules/three-mesh-bvh/src/core/Constants.js\");\n/* harmony import */ var _math_OrientedBox_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../math/OrientedBox.js */ \"./node_modules/three-mesh-bvh/src/math/OrientedBox.js\");\n/* harmony import */ var _math_ExtendedTriangle_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../math/ExtendedTriangle.js */ \"./node_modules/three-mesh-bvh/src/math/ExtendedTriangle.js\");\n/* harmony import */ var _utils_GeometryRayIntersectUtilities_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/GeometryRayIntersectUtilities.js */ \"./node_modules/three-mesh-bvh/src/utils/GeometryRayIntersectUtilities.js\");\n/* harmony import */ var _utils_TriangleUtilities_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../utils/TriangleUtilities.js */ \"./node_modules/three-mesh-bvh/src/utils/TriangleUtilities.js\");\n/* harmony import */ var _utils_ArrayBoxUtilities_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils/ArrayBoxUtilities.js */ \"./node_modules/three-mesh-bvh/src/utils/ArrayBoxUtilities.js\");\n/* harmony import */ var _utils_PrimitivePool_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils/PrimitivePool.js */ \"./node_modules/three-mesh-bvh/src/utils/PrimitivePool.js\");\n/* harmony import */ var _nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./nodeBufferFunctions.js */ \"./node_modules/three-mesh-bvh/src/core/nodeBufferFunctions.js\");\n\n\n\n\n\n\n\n\n\n\n\nconst boundingBox = new three__WEBPACK_IMPORTED_MODULE_0__.Box3();\nconst boxIntersection = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\nconst xyzFields = [ 'x', 'y', 'z' ];\n\nfunction raycast( nodeIndex32, geometry, side, ray, intersects ) {\n\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\n\n\tconst isLeaf = (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.IS_LEAF)( nodeIndex16, uint16Array );\n\tif ( isLeaf ) {\n\n\t\tconst offset = (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.OFFSET)( nodeIndex32, uint32Array );\n\t\tconst count = (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.COUNT)( nodeIndex16, uint16Array );\n\n\t\t(0,_utils_GeometryRayIntersectUtilities_js__WEBPACK_IMPORTED_MODULE_2__.intersectTris)( geometry, side, ray, offset, count, intersects );\n\n\t} else {\n\n\t\tconst leftIndex = (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.LEFT_NODE)( nodeIndex32 );\n\t\tif ( intersectRay( leftIndex, float32Array, ray, boxIntersection ) ) {\n\n\t\t\traycast( leftIndex, geometry, side, ray, intersects );\n\n\t\t}\n\n\t\tconst rightIndex = (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.RIGHT_NODE)( nodeIndex32, uint32Array );\n\t\tif ( intersectRay( rightIndex, float32Array, ray, boxIntersection ) ) {\n\n\t\t\traycast( rightIndex, geometry, side, ray, intersects );\n\n\t\t}\n\n\t}\n\n}\n\nfunction raycastFirst( nodeIndex32, geometry, side, ray ) {\n\n\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\n\n\tconst isLeaf = (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.IS_LEAF)( nodeIndex16, uint16Array );\n\tif ( isLeaf ) {\n\n\t\tconst offset = (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.OFFSET)( nodeIndex32, uint32Array );\n\t\tconst count = (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.COUNT)( nodeIndex16, uint16Array );\n\t\treturn (0,_utils_GeometryRayIntersectUtilities_js__WEBPACK_IMPORTED_MODULE_2__.intersectClosestTri)( geometry, side, ray, offset, count );\n\n\t} else {\n\n\t\t// consider the position of the split plane with respect to the oncoming ray; whichever direction\n\t\t// the ray is coming from, look for an intersection among that side of the tree first\n\t\tconst splitAxis = (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.SPLIT_AXIS)( nodeIndex32, uint32Array );\n\t\tconst xyzAxis = xyzFields[ splitAxis ];\n\t\tconst rayDir = ray.direction[ xyzAxis ];\n\t\tconst leftToRight = rayDir >= 0;\n\n\t\t// c1 is the child to check first\n\t\tlet c1, c2;\n\t\tif ( leftToRight ) {\n\n\t\t\tc1 = (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.LEFT_NODE)( nodeIndex32 );\n\t\t\tc2 = (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.RIGHT_NODE)( nodeIndex32, uint32Array );\n\n\t\t} else {\n\n\t\t\tc1 = (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.RIGHT_NODE)( nodeIndex32, uint32Array );\n\t\t\tc2 = (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.LEFT_NODE)( nodeIndex32 );\n\n\t\t}\n\n\t\tconst c1Intersection = intersectRay( c1, float32Array, ray, boxIntersection );\n\t\tconst c1Result = c1Intersection ? raycastFirst( c1, geometry, side, ray ) : null;\n\n\t\t// if we got an intersection in the first node and it's closer than the second node's bounding\n\t\t// box, we don't need to consider the second node because it couldn't possibly be a better result\n\t\tif ( c1Result ) {\n\n\t\t\t// check if the point is within the second bounds\n\t\t\t// \"point\" is in the local frame of the bvh\n\t\t\tconst point = c1Result.point[ xyzAxis ];\n\t\t\tconst isOutside = leftToRight ?\n\t\t\t\tpoint <= float32Array[ c2 + splitAxis ] : // min bounding data\n\t\t\t\tpoint >= float32Array[ c2 + splitAxis + 3 ]; // max bounding data\n\n\t\t\tif ( isOutside ) {\n\n\t\t\t\treturn c1Result;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// either there was no intersection in the first node, or there could still be a closer\n\t\t// intersection in the second, so check the second node and then take the better of the two\n\t\tconst c2Intersection = intersectRay( c2, float32Array, ray, boxIntersection );\n\t\tconst c2Result = c2Intersection ? raycastFirst( c2, geometry, side, ray ) : null;\n\n\t\tif ( c1Result && c2Result ) {\n\n\t\t\treturn c1Result.distance <= c2Result.distance ? c1Result : c2Result;\n\n\t\t} else {\n\n\t\t\treturn c1Result || c2Result || null;\n\n\t\t}\n\n\t}\n\n}\n\nconst shapecast = ( function () {\n\n\tlet _box1, _box2;\n\tconst boxStack = [];\n\tconst boxPool = new _utils_PrimitivePool_js__WEBPACK_IMPORTED_MODULE_3__.PrimitivePool( () => new three__WEBPACK_IMPORTED_MODULE_0__.Box3() );\n\n\treturn function shapecast( ...args ) {\n\n\t\t_box1 = boxPool.getPrimitive();\n\t\t_box2 = boxPool.getPrimitive();\n\t\tboxStack.push( _box1, _box2 );\n\n\t\tconst result = shapecastTraverse( ...args );\n\n\t\tboxPool.releasePrimitive( _box1 );\n\t\tboxPool.releasePrimitive( _box2 );\n\t\tboxStack.pop();\n\t\tboxStack.pop();\n\n\t\tconst length = boxStack.length;\n\t\tif ( length > 0 ) {\n\n\t\t\t_box2 = boxStack[ length - 1 ];\n\t\t\t_box1 = boxStack[ length - 2 ];\n\n\t\t}\n\n\t\treturn result;\n\n\t};\n\n\tfunction shapecastTraverse(\n\t\tnodeIndex32,\n\t\tgeometry,\n\t\tintersectsBoundsFunc,\n\t\tintersectsRangeFunc,\n\t\tnodeScoreFunc = null,\n\t\tnodeIndexByteOffset = 0, // offset for unique node identifier\n\t\tdepth = 0\n\t) {\n\n\t\t// Define these inside the function so it has access to the local variables needed\n\t\t// when converting to the buffer equivalents\n\t\tfunction getLeftOffset( nodeIndex32 ) {\n\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\n\n\t\t\t// traverse until we find a leaf\n\t\t\twhile ( ! (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.IS_LEAF)( nodeIndex16, uint16Array ) ) {\n\n\t\t\t\tnodeIndex32 = (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.LEFT_NODE)( nodeIndex32 );\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\n\n\t\t\t}\n\n\t\t\treturn (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.OFFSET)( nodeIndex32, uint32Array );\n\n\t\t}\n\n\t\tfunction getRightEndOffset( nodeIndex32 ) {\n\n\t\t\tlet nodeIndex16 = nodeIndex32 * 2, uint16Array = _uint16Array, uint32Array = _uint32Array;\n\n\t\t\t// traverse until we find a leaf\n\t\t\twhile ( ! (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.IS_LEAF)( nodeIndex16, uint16Array ) ) {\n\n\t\t\t\t// adjust offset to point to the right node\n\t\t\t\tnodeIndex32 = (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.RIGHT_NODE)( nodeIndex32, uint32Array );\n\t\t\t\tnodeIndex16 = nodeIndex32 * 2;\n\n\t\t\t}\n\n\t\t\t// return the end offset of the triangle range\n\t\t\treturn (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.OFFSET)( nodeIndex32, uint32Array ) + (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.COUNT)( nodeIndex16, uint16Array );\n\n\t\t}\n\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\n\n\t\tconst isLeaf = (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.IS_LEAF)( nodeIndex16, uint16Array );\n\t\tif ( isLeaf ) {\n\n\t\t\tconst offset = (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.OFFSET)( nodeIndex32, uint32Array );\n\t\t\tconst count = (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.COUNT)( nodeIndex16, uint16Array );\n\t\t\t(0,_utils_ArrayBoxUtilities_js__WEBPACK_IMPORTED_MODULE_4__.arrayToBox)( (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.BOUNDING_DATA_INDEX)( nodeIndex32 ), float32Array, _box1 );\n\t\t\treturn intersectsRangeFunc( offset, count, false, depth, nodeIndexByteOffset + nodeIndex32, _box1 );\n\n\t\t} else {\n\n\t\t\tconst left = (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.LEFT_NODE)( nodeIndex32 );\n\t\t\tconst right = (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.RIGHT_NODE)( nodeIndex32, uint32Array );\n\t\t\tlet c1 = left;\n\t\t\tlet c2 = right;\n\n\t\t\tlet score1, score2;\n\t\t\tlet box1, box2;\n\t\t\tif ( nodeScoreFunc ) {\n\n\t\t\t\tbox1 = _box1;\n\t\t\t\tbox2 = _box2;\n\n\t\t\t\t// bounding data is not offset\n\t\t\t\t(0,_utils_ArrayBoxUtilities_js__WEBPACK_IMPORTED_MODULE_4__.arrayToBox)( (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.BOUNDING_DATA_INDEX)( c1 ), float32Array, box1 );\n\t\t\t\t(0,_utils_ArrayBoxUtilities_js__WEBPACK_IMPORTED_MODULE_4__.arrayToBox)( (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.BOUNDING_DATA_INDEX)( c2 ), float32Array, box2 );\n\n\t\t\t\tscore1 = nodeScoreFunc( box1 );\n\t\t\t\tscore2 = nodeScoreFunc( box2 );\n\n\t\t\t\tif ( score2 < score1 ) {\n\n\t\t\t\t\tc1 = right;\n\t\t\t\t\tc2 = left;\n\n\t\t\t\t\tconst temp = score1;\n\t\t\t\t\tscore1 = score2;\n\t\t\t\t\tscore2 = temp;\n\n\t\t\t\t\tbox1 = box2;\n\t\t\t\t\t// box2 is always set before use below\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Check box 1 intersection\n\t\t\tif ( ! box1 ) {\n\n\t\t\t\tbox1 = _box1;\n\t\t\t\t(0,_utils_ArrayBoxUtilities_js__WEBPACK_IMPORTED_MODULE_4__.arrayToBox)( (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.BOUNDING_DATA_INDEX)( c1 ), float32Array, box1 );\n\n\t\t\t}\n\n\t\t\tconst isC1Leaf = (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.IS_LEAF)( c1 * 2, uint16Array );\n\t\t\tconst c1Intersection = intersectsBoundsFunc( box1, isC1Leaf, score1, depth + 1, nodeIndexByteOffset + c1 );\n\n\t\t\tlet c1StopTraversal;\n\t\t\tif ( c1Intersection === _Constants_js__WEBPACK_IMPORTED_MODULE_5__.CONTAINED ) {\n\n\t\t\t\tconst offset = getLeftOffset( c1 );\n\t\t\t\tconst end = getRightEndOffset( c1 );\n\t\t\t\tconst count = end - offset;\n\n\t\t\t\tc1StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, nodeIndexByteOffset + c1, box1 );\n\n\t\t\t} else {\n\n\t\t\t\tc1StopTraversal =\n\t\t\t\t\tc1Intersection &&\n\t\t\t\t\tshapecastTraverse(\n\t\t\t\t\t\tc1,\n\t\t\t\t\t\tgeometry,\n\t\t\t\t\t\tintersectsBoundsFunc,\n\t\t\t\t\t\tintersectsRangeFunc,\n\t\t\t\t\t\tnodeScoreFunc,\n\t\t\t\t\t\tnodeIndexByteOffset,\n\t\t\t\t\t\tdepth + 1\n\t\t\t\t\t);\n\n\t\t\t}\n\n\t\t\tif ( c1StopTraversal ) return true;\n\n\t\t\t// Check box 2 intersection\n\t\t\t// cached box2 will have been overwritten by previous traversal\n\t\t\tbox2 = _box2;\n\t\t\t(0,_utils_ArrayBoxUtilities_js__WEBPACK_IMPORTED_MODULE_4__.arrayToBox)( (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.BOUNDING_DATA_INDEX)( c2 ), float32Array, box2 );\n\n\t\t\tconst isC2Leaf = (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.IS_LEAF)( c2 * 2, uint16Array );\n\t\t\tconst c2Intersection = intersectsBoundsFunc( box2, isC2Leaf, score2, depth + 1, nodeIndexByteOffset + c2 );\n\n\t\t\tlet c2StopTraversal;\n\t\t\tif ( c2Intersection === _Constants_js__WEBPACK_IMPORTED_MODULE_5__.CONTAINED ) {\n\n\t\t\t\tconst offset = getLeftOffset( c2 );\n\t\t\t\tconst end = getRightEndOffset( c2 );\n\t\t\t\tconst count = end - offset;\n\n\t\t\t\tc2StopTraversal = intersectsRangeFunc( offset, count, true, depth + 1, nodeIndexByteOffset + c2, box2 );\n\n\t\t\t} else {\n\n\t\t\t\tc2StopTraversal =\n\t\t\t\t\tc2Intersection &&\n\t\t\t\t\tshapecastTraverse(\n\t\t\t\t\t\tc2,\n\t\t\t\t\t\tgeometry,\n\t\t\t\t\t\tintersectsBoundsFunc,\n\t\t\t\t\t\tintersectsRangeFunc,\n\t\t\t\t\t\tnodeScoreFunc,\n\t\t\t\t\t\tnodeIndexByteOffset,\n\t\t\t\t\t\tdepth + 1\n\t\t\t\t\t);\n\n\t\t\t}\n\n\t\t\tif ( c2StopTraversal ) return true;\n\n\t\t\treturn false;\n\n\t\t}\n\n\t}\n\n} )();\n\nconst intersectsGeometry = ( function () {\n\n\tconst triangle = new _math_ExtendedTriangle_js__WEBPACK_IMPORTED_MODULE_6__.ExtendedTriangle();\n\tconst triangle2 = new _math_ExtendedTriangle_js__WEBPACK_IMPORTED_MODULE_6__.ExtendedTriangle();\n\tconst invertedMat = new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4();\n\n\tconst obb = new _math_OrientedBox_js__WEBPACK_IMPORTED_MODULE_7__.OrientedBox();\n\tconst obb2 = new _math_OrientedBox_js__WEBPACK_IMPORTED_MODULE_7__.OrientedBox();\n\n\treturn function intersectsGeometry( nodeIndex32, geometry, otherGeometry, geometryToBvh, cachedObb = null ) {\n\n\t\tlet nodeIndex16 = nodeIndex32 * 2, float32Array = _float32Array, uint16Array = _uint16Array, uint32Array = _uint32Array;\n\n\t\tif ( cachedObb === null ) {\n\n\t\t\tif ( ! otherGeometry.boundingBox ) {\n\n\t\t\t\totherGeometry.computeBoundingBox();\n\n\t\t\t}\n\n\t\t\tobb.set( otherGeometry.boundingBox.min, otherGeometry.boundingBox.max, geometryToBvh );\n\t\t\tcachedObb = obb;\n\n\t\t}\n\n\t\tconst isLeaf = (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.IS_LEAF)( nodeIndex16, uint16Array );\n\t\tif ( isLeaf ) {\n\n\t\t\tconst thisGeometry = geometry;\n\t\t\tconst thisIndex = thisGeometry.index;\n\t\t\tconst thisPos = thisGeometry.attributes.position;\n\n\t\t\tconst index = otherGeometry.index;\n\t\t\tconst pos = otherGeometry.attributes.position;\n\n\t\t\tconst offset = (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.OFFSET)( nodeIndex32, uint32Array );\n\t\t\tconst count = (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.COUNT)( nodeIndex16, uint16Array );\n\n\t\t\t// get the inverse of the geometry matrix so we can transform our triangles into the\n\t\t\t// geometry space we're trying to test. We assume there are fewer triangles being checked\n\t\t\t// here.\n\t\t\tinvertedMat.copy( geometryToBvh ).invert();\n\n\t\t\tif ( otherGeometry.boundsTree ) {\n\n\t\t\t\t(0,_utils_ArrayBoxUtilities_js__WEBPACK_IMPORTED_MODULE_4__.arrayToBox)( (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.BOUNDING_DATA_INDEX)( nodeIndex32 ), float32Array, obb2 );\n\t\t\t\tobb2.matrix.copy( invertedMat );\n\t\t\t\tobb2.needsUpdate = true;\n\n\t\t\t\tconst res = otherGeometry.boundsTree.shapecast( {\n\n\t\t\t\t\tintersectsBounds: box => obb2.intersectsBox( box ),\n\n\t\t\t\t\tintersectsTriangle: tri => {\n\n\t\t\t\t\t\ttri.a.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttri.b.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttri.c.applyMatrix4( geometryToBvh );\n\t\t\t\t\t\ttri.needsUpdate = true;\n\n\t\t\t\t\t\tfor ( let i = offset * 3, l = ( count + offset ) * 3; i < l; i += 3 ) {\n\n\t\t\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\n\t\t\t\t\t\t\t(0,_utils_TriangleUtilities_js__WEBPACK_IMPORTED_MODULE_8__.setTriangle)( triangle2, i, thisIndex, thisPos );\n\t\t\t\t\t\t\ttriangle2.needsUpdate = true;\n\t\t\t\t\t\t\tif ( tri.intersectsTriangle( triangle2 ) ) {\n\n\t\t\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn false;\n\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t\treturn res;\n\n\t\t\t} else {\n\n\t\t\t\tfor ( let i = offset * 3, l = ( count + offset * 3 ); i < l; i += 3 ) {\n\n\t\t\t\t\t// this triangle needs to be transformed into the current BVH coordinate frame\n\t\t\t\t\t(0,_utils_TriangleUtilities_js__WEBPACK_IMPORTED_MODULE_8__.setTriangle)( triangle, i, thisIndex, thisPos );\n\t\t\t\t\ttriangle.a.applyMatrix4( invertedMat );\n\t\t\t\t\ttriangle.b.applyMatrix4( invertedMat );\n\t\t\t\t\ttriangle.c.applyMatrix4( invertedMat );\n\t\t\t\t\ttriangle.needsUpdate = true;\n\n\t\t\t\t\tfor ( let i2 = 0, l2 = index.count; i2 < l2; i2 += 3 ) {\n\n\t\t\t\t\t\t(0,_utils_TriangleUtilities_js__WEBPACK_IMPORTED_MODULE_8__.setTriangle)( triangle2, i2, index, pos );\n\t\t\t\t\t\ttriangle2.needsUpdate = true;\n\n\t\t\t\t\t\tif ( triangle.intersectsTriangle( triangle2 ) ) {\n\n\t\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst left = nodeIndex32 + 8;\n\t\t\tconst right = uint32Array[ nodeIndex32 + 6 ];\n\n\t\t\t(0,_utils_ArrayBoxUtilities_js__WEBPACK_IMPORTED_MODULE_4__.arrayToBox)( (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.BOUNDING_DATA_INDEX)( left ), float32Array, boundingBox );\n\t\t\tconst leftIntersection =\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\n\t\t\t\tintersectsGeometry( left, geometry, otherGeometry, geometryToBvh, cachedObb );\n\n\t\t\tif ( leftIntersection ) return true;\n\n\t\t\t(0,_utils_ArrayBoxUtilities_js__WEBPACK_IMPORTED_MODULE_4__.arrayToBox)( (0,_nodeBufferFunctions_js__WEBPACK_IMPORTED_MODULE_1__.BOUNDING_DATA_INDEX)( right ), float32Array, boundingBox );\n\t\t\tconst rightIntersection =\n\t\t\t\tcachedObb.intersectsBox( boundingBox ) &&\n\t\t\t\tintersectsGeometry( right, geometry, otherGeometry, geometryToBvh, cachedObb );\n\n\t\t\tif ( rightIntersection ) return true;\n\n\t\t\treturn false;\n\n\t\t}\n\n\t};\n\n} )();\n\nfunction intersectRay( nodeIndex32, array, ray, target ) {\n\n\t(0,_utils_ArrayBoxUtilities_js__WEBPACK_IMPORTED_MODULE_4__.arrayToBox)( nodeIndex32, array, boundingBox );\n\treturn ray.intersectBox( boundingBox, target );\n\n}\n\nconst bufferStack = [];\nlet _prevBuffer;\nlet _float32Array;\nlet _uint16Array;\nlet _uint32Array;\nfunction setBuffer( buffer ) {\n\n\tif ( _prevBuffer ) {\n\n\t\tbufferStack.push( _prevBuffer );\n\n\t}\n\n\t_prevBuffer = buffer;\n\t_float32Array = new Float32Array( buffer );\n\t_uint16Array = new Uint16Array( buffer );\n\t_uint32Array = new Uint32Array( buffer );\n\n}\n\nfunction clearBuffer() {\n\n\t_prevBuffer = null;\n\t_float32Array = null;\n\t_uint16Array = null;\n\t_uint32Array = null;\n\n\tif ( bufferStack.length ) {\n\n\t\tsetBuffer( bufferStack.pop() );\n\n\t}\n\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/three-mesh-bvh/src/core/castFunctions.js?"); /***/ }), /***/ "./node_modules/three-mesh-bvh/src/core/nodeBufferFunctions.js": /*!*********************************************************************!*\ !*** ./node_modules/three-mesh-bvh/src/core/nodeBufferFunctions.js ***! \*********************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BOUNDING_DATA_INDEX: () => (/* binding */ BOUNDING_DATA_INDEX),\n/* harmony export */ COUNT: () => (/* binding */ COUNT),\n/* harmony export */ IS_LEAF: () => (/* binding */ IS_LEAF),\n/* harmony export */ LEFT_NODE: () => (/* binding */ LEFT_NODE),\n/* harmony export */ OFFSET: () => (/* binding */ OFFSET),\n/* harmony export */ RIGHT_NODE: () => (/* binding */ RIGHT_NODE),\n/* harmony export */ SPLIT_AXIS: () => (/* binding */ SPLIT_AXIS)\n/* harmony export */ });\nfunction IS_LEAF( n16, uint16Array ) {\n\n\treturn uint16Array[ n16 + 15 ] === 0xFFFF;\n\n}\n\nfunction OFFSET( n32, uint32Array ) {\n\n\treturn uint32Array[ n32 + 6 ];\n\n}\n\nfunction COUNT( n16, uint16Array ) {\n\n\treturn uint16Array[ n16 + 14 ];\n\n}\n\nfunction LEFT_NODE( n32 ) {\n\n\treturn n32 + 8;\n\n}\n\nfunction RIGHT_NODE( n32, uint32Array ) {\n\n\treturn uint32Array[ n32 + 6 ];\n\n}\n\nfunction SPLIT_AXIS( n32, uint32Array ) {\n\n\treturn uint32Array[ n32 + 7 ];\n\n}\n\nfunction BOUNDING_DATA_INDEX( n32 ) {\n\n\treturn n32;\n\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/three-mesh-bvh/src/core/nodeBufferFunctions.js?"); /***/ }), /***/ "./node_modules/three-mesh-bvh/src/debug/Debug.js": /*!********************************************************!*\ !*** ./node_modules/three-mesh-bvh/src/debug/Debug.js ***! \********************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ estimateMemoryInBytes: () => (/* binding */ estimateMemoryInBytes),\n/* harmony export */ getBVHExtremes: () => (/* binding */ getBVHExtremes),\n/* harmony export */ getJSONStructure: () => (/* binding */ getJSONStructure),\n/* harmony export */ validateBounds: () => (/* binding */ validateBounds)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var _core_Constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Constants.js */ \"./node_modules/three-mesh-bvh/src/core/Constants.js\");\n/* harmony import */ var _utils_ArrayBoxUtilities_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/ArrayBoxUtilities.js */ \"./node_modules/three-mesh-bvh/src/utils/ArrayBoxUtilities.js\");\n\n\n\n\nconst _box1 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_0__.Box3();\nconst _box2 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_0__.Box3();\nconst _vec = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\n// https://stackoverflow.com/questions/1248302/how-to-get-the-size-of-a-javascript-object\nfunction getPrimitiveSize( el ) {\n\n\tswitch ( typeof el ) {\n\n\t\tcase 'number':\n\t\t\treturn 8;\n\t\tcase 'string':\n\t\t\treturn el.length * 2;\n\t\tcase 'boolean':\n\t\t\treturn 4;\n\t\tdefault:\n\t\t\treturn 0;\n\n\t}\n\n}\n\nfunction isTypedArray( arr ) {\n\n\tconst regex = /(Uint|Int|Float)(8|16|32)Array/;\n\treturn regex.test( arr.constructor.name );\n\n}\n\nfunction getRootExtremes( bvh, group ) {\n\n\tconst result = {\n\t\tnodeCount: 0,\n\t\tleafNodeCount: 0,\n\n\t\tdepth: {\n\t\t\tmin: Infinity, max: - Infinity\n\t\t},\n\t\ttris: {\n\t\t\tmin: Infinity, max: - Infinity\n\t\t},\n\t\tsplits: [ 0, 0, 0 ],\n\t\tsurfaceAreaScore: 0,\n\t};\n\n\tbvh.traverse( ( depth, isLeaf, boundingData, offsetOrSplit, count ) => {\n\n\t\tconst l0 = boundingData[ 0 + 3 ] - boundingData[ 0 ];\n\t\tconst l1 = boundingData[ 1 + 3 ] - boundingData[ 1 ];\n\t\tconst l2 = boundingData[ 2 + 3 ] - boundingData[ 2 ];\n\n\t\tconst surfaceArea = 2 * ( l0 * l1 + l1 * l2 + l2 * l0 );\n\n\t\tresult.nodeCount ++;\n\t\tif ( isLeaf ) {\n\n\t\t\tresult.leafNodeCount ++;\n\n\t\t\tresult.depth.min = Math.min( depth, result.depth.min );\n\t\t\tresult.depth.max = Math.max( depth, result.depth.max );\n\n\t\t\tresult.tris.min = Math.min( count, result.tris.min );\n\t\t\tresult.tris.max = Math.max( count, result.tris.max );\n\n\t\t\tresult.surfaceAreaScore += surfaceArea * _core_Constants_js__WEBPACK_IMPORTED_MODULE_1__.TRIANGLE_INTERSECT_COST * count;\n\n\t\t} else {\n\n\t\t\tresult.splits[ offsetOrSplit ] ++;\n\n\t\t\tresult.surfaceAreaScore += surfaceArea * _core_Constants_js__WEBPACK_IMPORTED_MODULE_1__.TRAVERSAL_COST;\n\n\t\t}\n\n\t}, group );\n\n\t// If there are no leaf nodes because the tree hasn't finished generating yet.\n\tif ( result.tris.min === Infinity ) {\n\n\t\tresult.tris.min = 0;\n\t\tresult.tris.max = 0;\n\n\t}\n\n\tif ( result.depth.min === Infinity ) {\n\n\t\tresult.depth.min = 0;\n\t\tresult.depth.max = 0;\n\n\t}\n\n\treturn result;\n\n}\n\nfunction getBVHExtremes( bvh ) {\n\n\treturn bvh._roots.map( ( root, i ) => getRootExtremes( bvh, i ) );\n\n}\n\nfunction estimateMemoryInBytes( obj ) {\n\n\tconst traversed = new Set();\n\tconst stack = [ obj ];\n\tlet bytes = 0;\n\n\twhile ( stack.length ) {\n\n\t\tconst curr = stack.pop();\n\t\tif ( traversed.has( curr ) ) {\n\n\t\t\tcontinue;\n\n\t\t}\n\n\t\ttraversed.add( curr );\n\n\t\tfor ( let key in curr ) {\n\n\t\t\tif ( ! curr.hasOwnProperty( key ) ) {\n\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tbytes += getPrimitiveSize( key );\n\n\t\t\tconst value = curr[ key ];\n\t\t\tif ( value && ( typeof value === 'object' || typeof value === 'function' ) ) {\n\n\t\t\t\tif ( isTypedArray( value ) ) {\n\n\t\t\t\t\tbytes += value.byteLength;\n\n\t\t\t\t} else if ( value instanceof ArrayBuffer ) {\n\n\t\t\t\t\tbytes += value.byteLength;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tstack.push( value );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tbytes += getPrimitiveSize( value );\n\n\t\t\t}\n\n\n\t\t}\n\n\t}\n\n\treturn bytes;\n\n}\n\nfunction validateBounds( bvh ) {\n\n\tconst geometry = bvh.geometry;\n\tconst depthStack = [];\n\tconst index = geometry.index;\n\tconst position = geometry.getAttribute( 'position' );\n\tlet passes = true;\n\n\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\n\n\t\tconst info = {\n\t\t\tdepth,\n\t\t\tisLeaf,\n\t\t\tboundingData,\n\t\t\toffset,\n\t\t\tcount,\n\t\t};\n\t\tdepthStack[ depth ] = info;\n\n\t\t(0,_utils_ArrayBoxUtilities_js__WEBPACK_IMPORTED_MODULE_2__.arrayToBox)( 0, boundingData, _box1 );\n\t\tconst parent = depthStack[ depth - 1 ];\n\n\t\tif ( isLeaf ) {\n\n\t\t\t// check triangles\n\t\t\tfor ( let i = offset * 3, l = ( offset + count ) * 3; i < l; i += 3 ) {\n\n\t\t\t\tconst i0 = index.getX( i );\n\t\t\t\tconst i1 = index.getX( i + 1 );\n\t\t\t\tconst i2 = index.getX( i + 2 );\n\n\t\t\t\tlet isContained;\n\n\t\t\t\t_vec.fromBufferAttribute( position, i0 );\n\t\t\t\tisContained = _box1.containsPoint( _vec );\n\n\t\t\t\t_vec.fromBufferAttribute( position, i1 );\n\t\t\t\tisContained = isContained && _box1.containsPoint( _vec );\n\n\t\t\t\t_vec.fromBufferAttribute( position, i2 );\n\t\t\t\tisContained = isContained && _box1.containsPoint( _vec );\n\n\t\t\t\tconsole.assert( isContained, 'Leaf bounds does not fully contain triangle.' );\n\t\t\t\tpasses = passes && isContained;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( parent ) {\n\n\t\t\t// check if my bounds fit in my parents\n\t\t\t(0,_utils_ArrayBoxUtilities_js__WEBPACK_IMPORTED_MODULE_2__.arrayToBox)( 0, boundingData, _box2 );\n\n\t\t\tconst isContained = _box2.containsBox( _box1 );\n\t\t\tconsole.assert( isContained, 'Parent bounds does not fully contain child.' );\n\t\t\tpasses = passes && isContained;\n\n\t\t}\n\n\t} );\n\n\treturn passes;\n\n}\n\n// Returns a simple, human readable object that represents the BVH.\nfunction getJSONStructure( bvh ) {\n\n\tconst depthStack = [];\n\n\tbvh.traverse( ( depth, isLeaf, boundingData, offset, count ) => {\n\n\t\tconst info = {\n\t\t\tbounds: (0,_utils_ArrayBoxUtilities_js__WEBPACK_IMPORTED_MODULE_2__.arrayToBox)( 0, boundingData, new three__WEBPACK_IMPORTED_MODULE_0__.Box3() ),\n\t\t};\n\n\t\tif ( isLeaf ) {\n\n\t\t\tinfo.count = count;\n\t\t\tinfo.offset = offset;\n\n\t\t} else {\n\n\t\t\tinfo.left = null;\n\t\t\tinfo.right = null;\n\n\t\t}\n\n\t\tdepthStack[ depth ] = info;\n\n\t\t// traversal hits the left then right node\n\t\tconst parent = depthStack[ depth - 1 ];\n\t\tif ( parent ) {\n\n\t\t\tif ( parent.left === null ) {\n\n\t\t\t\tparent.left = info;\n\n\t\t\t} else {\n\n\t\t\t\tparent.right = info;\n\n\t\t\t}\n\n\t\t}\n\n\t} );\n\n\treturn depthStack[ 0 ];\n\n}\n\n\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/three-mesh-bvh/src/debug/Debug.js?"); /***/ }), /***/ "./node_modules/three-mesh-bvh/src/math/ExtendedTriangle.js": /*!******************************************************************!*\ !*** ./node_modules/three-mesh-bvh/src/math/ExtendedTriangle.js ***! \******************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ExtendedTriangle: () => (/* binding */ ExtendedTriangle)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var _SeparatingAxisBounds_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./SeparatingAxisBounds.js */ \"./node_modules/three-mesh-bvh/src/math/SeparatingAxisBounds.js\");\n/* harmony import */ var _MathUtilities_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./MathUtilities.js */ \"./node_modules/three-mesh-bvh/src/math/MathUtilities.js\");\n\n\n\n\nconst DIST_EPSILON = 1e-15;\nfunction isNearZero( value ) {\n\n\treturn Math.abs( value ) < DIST_EPSILON;\n\n}\n\nclass ExtendedTriangle extends three__WEBPACK_IMPORTED_MODULE_0__.Triangle {\n\n\tconstructor( ...args ) {\n\n\t\tsuper( ...args );\n\n\t\tthis.isExtendedTriangle = true;\n\t\tthis.satAxes = new Array( 4 ).fill().map( () => new three__WEBPACK_IMPORTED_MODULE_0__.Vector3() );\n\t\tthis.satBounds = new Array( 4 ).fill().map( () => new _SeparatingAxisBounds_js__WEBPACK_IMPORTED_MODULE_1__.SeparatingAxisBounds() );\n\t\tthis.points = [ this.a, this.b, this.c ];\n\t\tthis.sphere = new three__WEBPACK_IMPORTED_MODULE_0__.Sphere();\n\t\tthis.plane = new three__WEBPACK_IMPORTED_MODULE_0__.Plane();\n\t\tthis.needsUpdate = true;\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\treturn (0,_MathUtilities_js__WEBPACK_IMPORTED_MODULE_2__.sphereIntersectTriangle)( sphere, this );\n\n\t}\n\n\tupdate() {\n\n\t\tconst a = this.a;\n\t\tconst b = this.b;\n\t\tconst c = this.c;\n\t\tconst points = this.points;\n\n\t\tconst satAxes = this.satAxes;\n\t\tconst satBounds = this.satBounds;\n\n\t\tconst axis0 = satAxes[ 0 ];\n\t\tconst sab0 = satBounds[ 0 ];\n\t\tthis.getNormal( axis0 );\n\t\tsab0.setFromPoints( axis0, points );\n\n\t\tconst axis1 = satAxes[ 1 ];\n\t\tconst sab1 = satBounds[ 1 ];\n\t\taxis1.subVectors( a, b );\n\t\tsab1.setFromPoints( axis1, points );\n\n\t\tconst axis2 = satAxes[ 2 ];\n\t\tconst sab2 = satBounds[ 2 ];\n\t\taxis2.subVectors( b, c );\n\t\tsab2.setFromPoints( axis2, points );\n\n\t\tconst axis3 = satAxes[ 3 ];\n\t\tconst sab3 = satBounds[ 3 ];\n\t\taxis3.subVectors( c, a );\n\t\tsab3.setFromPoints( axis3, points );\n\n\t\tthis.sphere.setFromPoints( this.points );\n\t\tthis.plane.setFromNormalAndCoplanarPoint( axis0, a );\n\t\tthis.needsUpdate = false;\n\n\t}\n\n}\n\nExtendedTriangle.prototype.closestPointToSegment = ( function () {\n\n\tconst point1 = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\tconst point2 = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\tconst edge = new three__WEBPACK_IMPORTED_MODULE_0__.Line3();\n\n\treturn function distanceToSegment( segment, target1 = null, target2 = null ) {\n\n\t\tconst { start, end } = segment;\n\t\tconst points = this.points;\n\t\tlet distSq;\n\t\tlet closestDistanceSq = Infinity;\n\n\t\t// check the triangle edges\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst nexti = ( i + 1 ) % 3;\n\t\t\tedge.start.copy( points[ i ] );\n\t\t\tedge.end.copy( points[ nexti ] );\n\n\t\t\t(0,_MathUtilities_js__WEBPACK_IMPORTED_MODULE_2__.closestPointsSegmentToSegment)( edge, segment, point1, point2 );\n\n\t\t\tdistSq = point1.distanceToSquared( point2 );\n\t\t\tif ( distSq < closestDistanceSq ) {\n\n\t\t\t\tclosestDistanceSq = distSq;\n\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// check end points\n\t\tthis.closestPointToPoint( start, point1 );\n\t\tdistSq = start.distanceToSquared( point1 );\n\t\tif ( distSq < closestDistanceSq ) {\n\n\t\t\tclosestDistanceSq = distSq;\n\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\tif ( target2 ) target2.copy( start );\n\n\t\t}\n\n\t\tthis.closestPointToPoint( end, point1 );\n\t\tdistSq = end.distanceToSquared( point1 );\n\t\tif ( distSq < closestDistanceSq ) {\n\n\t\t\tclosestDistanceSq = distSq;\n\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\tif ( target2 ) target2.copy( end );\n\n\t\t}\n\n\t\treturn Math.sqrt( closestDistanceSq );\n\n\t};\n\n} )();\n\nExtendedTriangle.prototype.intersectsTriangle = ( function () {\n\n\tconst saTri2 = new ExtendedTriangle();\n\tconst arr1 = new Array( 3 );\n\tconst arr2 = new Array( 3 );\n\tconst cachedSatBounds = new _SeparatingAxisBounds_js__WEBPACK_IMPORTED_MODULE_1__.SeparatingAxisBounds();\n\tconst cachedSatBounds2 = new _SeparatingAxisBounds_js__WEBPACK_IMPORTED_MODULE_1__.SeparatingAxisBounds();\n\tconst cachedAxis = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\tconst dir1 = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\tconst dir2 = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\tconst tempDir = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\tconst edge = new three__WEBPACK_IMPORTED_MODULE_0__.Line3();\n\tconst edge1 = new three__WEBPACK_IMPORTED_MODULE_0__.Line3();\n\tconst edge2 = new three__WEBPACK_IMPORTED_MODULE_0__.Line3();\n\n\t// TODO: If the triangles are coplanar and intersecting the target is nonsensical. It should at least\n\t// be a line contained by both triangles if not a different special case somehow represented in the return result.\n\treturn function intersectsTriangle( other, target = null, suppressLog = false ) {\n\n\t\tif ( this.needsUpdate ) {\n\n\t\t\tthis.update();\n\n\t\t}\n\n\t\tif ( ! other.isExtendedTriangle ) {\n\n\t\t\tsaTri2.copy( other );\n\t\t\tsaTri2.update();\n\t\t\tother = saTri2;\n\n\t\t} else if ( other.needsUpdate ) {\n\n\t\t\tother.update();\n\n\t\t}\n\n\t\tconst plane1 = this.plane;\n\t\tconst plane2 = other.plane;\n\n\t\tif ( Math.abs( plane1.normal.dot( plane2.normal ) ) > 1.0 - 1e-10 ) {\n\n\t\t\t// perform separating axis intersection test only for coplanar triangles\n\t\t\tconst satBounds1 = this.satBounds;\n\t\t\tconst satAxes1 = this.satAxes;\n\t\t\tarr2[ 0 ] = other.a;\n\t\t\tarr2[ 1 ] = other.b;\n\t\t\tarr2[ 2 ] = other.c;\n\t\t\tfor ( let i = 0; i < 4; i ++ ) {\n\n\t\t\t\tconst sb = satBounds1[ i ];\n\t\t\t\tconst sa = satAxes1[ i ];\n\t\t\t\tcachedSatBounds.setFromPoints( sa, arr2 );\n\t\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\n\n\t\t\t}\n\n\t\t\tconst satBounds2 = other.satBounds;\n\t\t\tconst satAxes2 = other.satAxes;\n\t\t\tarr1[ 0 ] = this.a;\n\t\t\tarr1[ 1 ] = this.b;\n\t\t\tarr1[ 2 ] = this.c;\n\t\t\tfor ( let i = 0; i < 4; i ++ ) {\n\n\t\t\t\tconst sb = satBounds2[ i ];\n\t\t\t\tconst sa = satAxes2[ i ];\n\t\t\t\tcachedSatBounds.setFromPoints( sa, arr1 );\n\t\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\n\n\t\t\t}\n\n\t\t\t// check crossed axes\n\t\t\tfor ( let i = 0; i < 4; i ++ ) {\n\n\t\t\t\tconst sa1 = satAxes1[ i ];\n\t\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\n\n\t\t\t\t\tconst sa2 = satAxes2[ i2 ];\n\t\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\n\t\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, arr1 );\n\t\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, arr2 );\n\t\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( target ) {\n\n\t\t\t\t// TODO find two points that intersect on the edges and make that the result\n\t\t\t\tif ( ! suppressLog ) {\n\n\t\t\t\t\tconsole.warn( 'ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0.' );\n\n\t\t\t\t}\n\n\t\t\t\ttarget.start.set( 0, 0, 0 );\n\t\t\t\ttarget.end.set( 0, 0, 0 );\n\n\t\t\t}\n\n\t\t\treturn true;\n\n\t\t} else {\n\n\t\t\t// find the edge that intersects the other triangle plane\n\t\t\tconst points1 = this.points;\n\t\t\tlet found1 = false;\n\t\t\tlet count1 = 0;\n\t\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\t\tconst p = points1[ i ];\n\t\t\t\tconst pNext = points1[ ( i + 1 ) % 3 ];\n\n\t\t\t\tedge.start.copy( p );\n\t\t\t\tedge.end.copy( pNext );\n\t\t\t\tedge.delta( dir1 );\n\n\t\t\t\tconst targetPoint = found1 ? edge1.start : edge1.end;\n\t\t\t\tconst startIntersects = isNearZero( plane2.distanceToPoint( p ) );\n\t\t\t\tif ( isNearZero( plane2.normal.dot( dir1 ) ) && startIntersects ) {\n\n\t\t\t\t\t// if the edge lies on the plane then take the line\n\t\t\t\t\tedge1.copy( edge );\n\t\t\t\t\tcount1 = 2;\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t\t// check if the start point is near the plane because \"intersectLine\" is not robust to that case\n\t\t\t\tconst doesIntersect = plane2.intersectLine( edge, targetPoint ) || startIntersects;\n\t\t\t\tif ( doesIntersect && ! isNearZero( targetPoint.distanceTo( pNext ) ) ) {\n\n\t\t\t\t\tcount1 ++;\n\t\t\t\t\tif ( found1 ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfound1 = true;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( count1 === 1 && other.containsPoint( edge1.end ) ) {\n\n\t\t\t\tif ( target ) {\n\n\t\t\t\t\ttarget.start.copy( edge1.end );\n\t\t\t\t\ttarget.end.copy( edge1.end );\n\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\n\t\t\t} else if ( count1 !== 2 ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t\t// find the other triangles edge that intersects this plane\n\t\t\tconst points2 = other.points;\n\t\t\tlet found2 = false;\n\t\t\tlet count2 = 0;\n\t\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\t\tconst p = points2[ i ];\n\t\t\t\tconst pNext = points2[ ( i + 1 ) % 3 ];\n\n\t\t\t\tedge.start.copy( p );\n\t\t\t\tedge.end.copy( pNext );\n\t\t\t\tedge.delta( dir2 );\n\n\t\t\t\tconst targetPoint = found2 ? edge2.start : edge2.end;\n\t\t\t\tconst startIntersects = isNearZero( plane1.distanceToPoint( p ) );\n\t\t\t\tif ( isNearZero( plane1.normal.dot( dir2 ) ) && startIntersects ) {\n\n\t\t\t\t\t// if the edge lies on the plane then take the line\n\t\t\t\t\tedge2.copy( edge );\n\t\t\t\t\tcount2 = 2;\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t\t// check if the start point is near the plane because \"intersectLine\" is not robust to that case\n\t\t\t\tconst doesIntersect = plane1.intersectLine( edge, targetPoint ) || startIntersects;\n\t\t\t\tif ( doesIntersect && ! isNearZero( targetPoint.distanceTo( pNext ) ) ) {\n\n\t\t\t\t\tcount2 ++;\n\t\t\t\t\tif ( found2 ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfound2 = true;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( count2 === 1 && this.containsPoint( edge2.end ) ) {\n\n\t\t\t\tif ( target ) {\n\n\t\t\t\t\ttarget.start.copy( edge2.end );\n\t\t\t\t\ttarget.end.copy( edge2.end );\n\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\n\t\t\t} else if ( count2 !== 2 ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t\t// find swap the second edge so both lines are running the same direction\n\t\t\tedge1.delta( dir1 );\n\t\t\tedge2.delta( dir2 );\n\n\t\t\tif ( dir1.dot( dir2 ) < 0 ) {\n\n\t\t\t\tlet tmp = edge2.start;\n\t\t\t\tedge2.start = edge2.end;\n\t\t\t\tedge2.end = tmp;\n\n\t\t\t}\n\n\t\t\t// check if the edges are overlapping\n\t\t\tconst s1 = edge1.start.dot( dir1 );\n\t\t\tconst e1 = edge1.end.dot( dir1 );\n\t\t\tconst s2 = edge2.start.dot( dir1 );\n\t\t\tconst e2 = edge2.end.dot( dir1 );\n\t\t\tconst separated1 = e1 < s2;\n\t\t\tconst separated2 = s1 < e2;\n\n\t\t\tif ( s1 !== e2 && s2 !== e1 && separated1 === separated2 ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t\t// assign the target output\n\t\t\tif ( target ) {\n\n\t\t\t\ttempDir.subVectors( edge1.start, edge2.start );\n\t\t\t\tif ( tempDir.dot( dir1 ) > 0 ) {\n\n\t\t\t\t\ttarget.start.copy( edge1.start );\n\n\t\t\t\t} else {\n\n\t\t\t\t\ttarget.start.copy( edge2.start );\n\n\t\t\t\t}\n\n\t\t\t\ttempDir.subVectors( edge1.end, edge2.end );\n\t\t\t\tif ( tempDir.dot( dir1 ) < 0 ) {\n\n\t\t\t\t\ttarget.end.copy( edge1.end );\n\n\t\t\t\t} else {\n\n\t\t\t\t\ttarget.end.copy( edge2.end );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn true;\n\n\t\t}\n\n\t};\n\n} )();\n\n\nExtendedTriangle.prototype.distanceToPoint = ( function () {\n\n\tconst target = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\treturn function distanceToPoint( point ) {\n\n\t\tthis.closestPointToPoint( point, target );\n\t\treturn point.distanceTo( target );\n\n\t};\n\n} )();\n\n\nExtendedTriangle.prototype.distanceToTriangle = ( function () {\n\n\tconst point = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\tconst point2 = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\tconst cornerFields = [ 'a', 'b', 'c' ];\n\tconst line1 = new three__WEBPACK_IMPORTED_MODULE_0__.Line3();\n\tconst line2 = new three__WEBPACK_IMPORTED_MODULE_0__.Line3();\n\n\treturn function distanceToTriangle( other, target1 = null, target2 = null ) {\n\n\t\tconst lineTarget = target1 || target2 ? line1 : null;\n\t\tif ( this.intersectsTriangle( other, lineTarget ) ) {\n\n\t\t\tif ( target1 || target2 ) {\n\n\t\t\t\tif ( target1 ) lineTarget.getCenter( target1 );\n\t\t\t\tif ( target2 ) lineTarget.getCenter( target2 );\n\n\t\t\t}\n\n\t\t\treturn 0;\n\n\t\t}\n\n\t\tlet closestDistanceSq = Infinity;\n\n\t\t// check all point distances\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tlet dist;\n\t\t\tconst field = cornerFields[ i ];\n\t\t\tconst otherVec = other[ field ];\n\t\t\tthis.closestPointToPoint( otherVec, point );\n\n\t\t\tdist = otherVec.distanceToSquared( point );\n\n\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\tif ( target1 ) target1.copy( point );\n\t\t\t\tif ( target2 ) target2.copy( otherVec );\n\n\t\t\t}\n\n\n\t\t\tconst thisVec = this[ field ];\n\t\t\tother.closestPointToPoint( thisVec, point );\n\n\t\t\tdist = thisVec.distanceToSquared( point );\n\n\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\tif ( target1 ) target1.copy( thisVec );\n\t\t\t\tif ( target2 ) target2.copy( point );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst f11 = cornerFields[ i ];\n\t\t\tconst f12 = cornerFields[ ( i + 1 ) % 3 ];\n\t\t\tline1.set( this[ f11 ], this[ f12 ] );\n\t\t\tfor ( let i2 = 0; i2 < 3; i2 ++ ) {\n\n\t\t\t\tconst f21 = cornerFields[ i2 ];\n\t\t\t\tconst f22 = cornerFields[ ( i2 + 1 ) % 3 ];\n\t\t\t\tline2.set( other[ f21 ], other[ f22 ] );\n\n\t\t\t\t(0,_MathUtilities_js__WEBPACK_IMPORTED_MODULE_2__.closestPointsSegmentToSegment)( line1, line2, point, point2 );\n\n\t\t\t\tconst dist = point.distanceToSquared( point2 );\n\t\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\t\tif ( target1 ) target1.copy( point );\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn Math.sqrt( closestDistanceSq );\n\n\t};\n\n} )();\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/three-mesh-bvh/src/math/ExtendedTriangle.js?"); /***/ }), /***/ "./node_modules/three-mesh-bvh/src/math/MathUtilities.js": /*!***************************************************************!*\ !*** ./node_modules/three-mesh-bvh/src/math/MathUtilities.js ***! \***************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ closestPointLineToLine: () => (/* binding */ closestPointLineToLine),\n/* harmony export */ closestPointsSegmentToSegment: () => (/* binding */ closestPointsSegmentToSegment),\n/* harmony export */ sphereIntersectTriangle: () => (/* binding */ sphereIntersectTriangle)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\nconst closestPointLineToLine = ( function () {\n\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Line.cpp#L56\n\tconst dir1 = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\tconst dir2 = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\tconst v02 = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\treturn function closestPointLineToLine( l1, l2, result ) {\n\n\t\tconst v0 = l1.start;\n\t\tconst v10 = dir1;\n\t\tconst v2 = l2.start;\n\t\tconst v32 = dir2;\n\n\t\tv02.subVectors( v0, v2 );\n\t\tdir1.subVectors( l1.end, l1.start );\n\t\tdir2.subVectors( l2.end, l2.start );\n\n\t\t// float d0232 = v02.Dot(v32);\n\t\tconst d0232 = v02.dot( v32 );\n\n\t\t// float d3210 = v32.Dot(v10);\n\t\tconst d3210 = v32.dot( v10 );\n\n\t\t// float d3232 = v32.Dot(v32);\n\t\tconst d3232 = v32.dot( v32 );\n\n\t\t// float d0210 = v02.Dot(v10);\n\t\tconst d0210 = v02.dot( v10 );\n\n\t\t// float d1010 = v10.Dot(v10);\n\t\tconst d1010 = v10.dot( v10 );\n\n\t\t// float denom = d1010*d3232 - d3210*d3210;\n\t\tconst denom = d1010 * d3232 - d3210 * d3210;\n\n\t\tlet d, d2;\n\t\tif ( denom !== 0 ) {\n\n\t\t\td = ( d0232 * d3210 - d0210 * d3232 ) / denom;\n\n\t\t} else {\n\n\t\t\td = 0;\n\n\t\t}\n\n\t\td2 = ( d0232 + d * d3210 ) / d3232;\n\n\t\tresult.x = d;\n\t\tresult.y = d2;\n\n\t};\n\n} )();\n\nconst closestPointsSegmentToSegment = ( function () {\n\n\t// https://github.com/juj/MathGeoLib/blob/master/src/Geometry/LineSegment.cpp#L187\n\tconst paramResult = new three__WEBPACK_IMPORTED_MODULE_0__.Vector2();\n\tconst temp1 = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\tconst temp2 = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\treturn function closestPointsSegmentToSegment( l1, l2, target1, target2 ) {\n\n\t\tclosestPointLineToLine( l1, l2, paramResult );\n\n\t\tlet d = paramResult.x;\n\t\tlet d2 = paramResult.y;\n\t\tif ( d >= 0 && d <= 1 && d2 >= 0 && d2 <= 1 ) {\n\n\t\t\tl1.at( d, target1 );\n\t\t\tl2.at( d2, target2 );\n\n\t\t\treturn;\n\n\t\t} else if ( d >= 0 && d <= 1 ) {\n\n\t\t\t// Only d2 is out of bounds.\n\t\t\tif ( d2 < 0 ) {\n\n\t\t\t\tl2.at( 0, target2 );\n\n\t\t\t} else {\n\n\t\t\t\tl2.at( 1, target2 );\n\n\t\t\t}\n\n\t\t\tl1.closestPointToPoint( target2, true, target1 );\n\t\t\treturn;\n\n\t\t} else if ( d2 >= 0 && d2 <= 1 ) {\n\n\t\t\t// Only d is out of bounds.\n\t\t\tif ( d < 0 ) {\n\n\t\t\t\tl1.at( 0, target1 );\n\n\t\t\t} else {\n\n\t\t\t\tl1.at( 1, target1 );\n\n\t\t\t}\n\n\t\t\tl2.closestPointToPoint( target1, true, target2 );\n\t\t\treturn;\n\n\t\t} else {\n\n\t\t\t// Both u and u2 are out of bounds.\n\t\t\tlet p;\n\t\t\tif ( d < 0 ) {\n\n\t\t\t\tp = l1.start;\n\n\t\t\t} else {\n\n\t\t\t\tp = l1.end;\n\n\t\t\t}\n\n\t\t\tlet p2;\n\t\t\tif ( d2 < 0 ) {\n\n\t\t\t\tp2 = l2.start;\n\n\t\t\t} else {\n\n\t\t\t\tp2 = l2.end;\n\n\t\t\t}\n\n\t\t\tconst closestPoint = temp1;\n\t\t\tconst closestPoint2 = temp2;\n\t\t\tl1.closestPointToPoint( p2, true, temp1 );\n\t\t\tl2.closestPointToPoint( p, true, temp2 );\n\n\t\t\tif ( closestPoint.distanceToSquared( p2 ) <= closestPoint2.distanceToSquared( p ) ) {\n\n\t\t\t\ttarget1.copy( closestPoint );\n\t\t\t\ttarget2.copy( p2 );\n\t\t\t\treturn;\n\n\t\t\t} else {\n\n\t\t\t\ttarget1.copy( p );\n\t\t\t\ttarget2.copy( closestPoint2 );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t};\n\n} )();\n\n\nconst sphereIntersectTriangle = ( function () {\n\n\t// https://stackoverflow.com/questions/34043955/detect-collision-between-sphere-and-triangle-in-three-js\n\tconst closestPointTemp = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\tconst projectedPointTemp = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\tconst planeTemp = new three__WEBPACK_IMPORTED_MODULE_0__.Plane();\n\tconst lineTemp = new three__WEBPACK_IMPORTED_MODULE_0__.Line3();\n\treturn function sphereIntersectTriangle( sphere, triangle ) {\n\n\t\tconst { radius, center } = sphere;\n\t\tconst { a, b, c } = triangle;\n\n\t\t// phase 1\n\t\tlineTemp.start = a;\n\t\tlineTemp.end = b;\n\t\tconst closestPoint1 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint1.distanceTo( center ) <= radius ) return true;\n\n\t\tlineTemp.start = a;\n\t\tlineTemp.end = c;\n\t\tconst closestPoint2 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint2.distanceTo( center ) <= radius ) return true;\n\n\t\tlineTemp.start = b;\n\t\tlineTemp.end = c;\n\t\tconst closestPoint3 = lineTemp.closestPointToPoint( center, true, closestPointTemp );\n\t\tif ( closestPoint3.distanceTo( center ) <= radius ) return true;\n\n\t\t// phase 2\n\t\tconst plane = triangle.getPlane( planeTemp );\n\t\tconst dp = Math.abs( plane.distanceToPoint( center ) );\n\t\tif ( dp <= radius ) {\n\n\t\t\tconst pp = plane.projectPoint( center, projectedPointTemp );\n\t\t\tconst cp = triangle.containsPoint( pp );\n\t\t\tif ( cp ) return true;\n\n\t\t}\n\n\t\treturn false;\n\n\t};\n\n} )();\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/three-mesh-bvh/src/math/MathUtilities.js?"); /***/ }), /***/ "./node_modules/three-mesh-bvh/src/math/OrientedBox.js": /*!*************************************************************!*\ !*** ./node_modules/three-mesh-bvh/src/math/OrientedBox.js ***! \*************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ OrientedBox: () => (/* binding */ OrientedBox)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var _SeparatingAxisBounds_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./SeparatingAxisBounds.js */ \"./node_modules/three-mesh-bvh/src/math/SeparatingAxisBounds.js\");\n/* harmony import */ var _ExtendedTriangle_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ExtendedTriangle.js */ \"./node_modules/three-mesh-bvh/src/math/ExtendedTriangle.js\");\n/* harmony import */ var _MathUtilities_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./MathUtilities.js */ \"./node_modules/three-mesh-bvh/src/math/MathUtilities.js\");\n\n\n\n\n\nclass OrientedBox {\n\n\tconstructor( min, max, matrix ) {\n\n\t\tthis.isOrientedBox = true;\n\t\tthis.min = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\t\tthis.max = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\t\tthis.matrix = new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4();\n\t\tthis.invMatrix = new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4();\n\t\tthis.points = new Array( 8 ).fill().map( () => new three__WEBPACK_IMPORTED_MODULE_0__.Vector3() );\n\t\tthis.satAxes = new Array( 3 ).fill().map( () => new three__WEBPACK_IMPORTED_MODULE_0__.Vector3() );\n\t\tthis.satBounds = new Array( 3 ).fill().map( () => new _SeparatingAxisBounds_js__WEBPACK_IMPORTED_MODULE_1__.SeparatingAxisBounds() );\n\t\tthis.alignedSatBounds = new Array( 3 ).fill().map( () => new _SeparatingAxisBounds_js__WEBPACK_IMPORTED_MODULE_1__.SeparatingAxisBounds() );\n\t\tthis.needsUpdate = false;\n\n\t\tif ( min ) this.min.copy( min );\n\t\tif ( max ) this.max.copy( max );\n\t\tif ( matrix ) this.matrix.copy( matrix );\n\n\t}\n\n\tset( min, max, matrix ) {\n\n\t\tthis.min.copy( min );\n\t\tthis.max.copy( max );\n\t\tthis.matrix.copy( matrix );\n\t\tthis.needsUpdate = true;\n\n\t}\n\n\tcopy( other ) {\n\n\t\tthis.min.copy( other.min );\n\t\tthis.max.copy( other.max );\n\t\tthis.matrix.copy( other.matrix );\n\t\tthis.needsUpdate = true;\n\n\t}\n\n}\n\nOrientedBox.prototype.update = ( function () {\n\n\treturn function update() {\n\n\t\tconst matrix = this.matrix;\n\t\tconst min = this.min;\n\t\tconst max = this.max;\n\n\t\tconst points = this.points;\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\n\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\n\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\n\n\t\t\t\t\tconst i = ( ( 1 << 0 ) * x ) | ( ( 1 << 1 ) * y ) | ( ( 1 << 2 ) * z );\n\t\t\t\t\tconst v = points[ i ];\n\t\t\t\t\tv.x = x ? max.x : min.x;\n\t\t\t\t\tv.y = y ? max.y : min.y;\n\t\t\t\t\tv.z = z ? max.z : min.z;\n\n\t\t\t\t\tv.applyMatrix4( matrix );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\t\tconst minVec = points[ 0 ];\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst axis = satAxes[ i ];\n\t\t\tconst sb = satBounds[ i ];\n\t\t\tconst index = 1 << i;\n\t\t\tconst pi = points[ index ];\n\n\t\t\taxis.subVectors( minVec, pi );\n\t\t\tsb.setFromPoints( axis, points );\n\n\t\t}\n\n\t\tconst alignedSatBounds = this.alignedSatBounds;\n\t\talignedSatBounds[ 0 ].setFromPointsField( points, 'x' );\n\t\talignedSatBounds[ 1 ].setFromPointsField( points, 'y' );\n\t\talignedSatBounds[ 2 ].setFromPointsField( points, 'z' );\n\n\t\tthis.invMatrix.copy( this.matrix ).invert();\n\t\tthis.needsUpdate = false;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.intersectsBox = ( function () {\n\n\tconst aabbBounds = new _SeparatingAxisBounds_js__WEBPACK_IMPORTED_MODULE_1__.SeparatingAxisBounds();\n\treturn function intersectsBox( box ) {\n\n\t\t// TODO: should this be doing SAT against the AABB?\n\t\tif ( this.needsUpdate ) {\n\n\t\t\tthis.update();\n\n\t\t}\n\n\t\tconst min = box.min;\n\t\tconst max = box.max;\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\t\tconst alignedSatBounds = this.alignedSatBounds;\n\n\t\taabbBounds.min = min.x;\n\t\taabbBounds.max = max.x;\n\t\tif ( alignedSatBounds[ 0 ].isSeparated( aabbBounds ) ) return false;\n\n\t\taabbBounds.min = min.y;\n\t\taabbBounds.max = max.y;\n\t\tif ( alignedSatBounds[ 1 ].isSeparated( aabbBounds ) ) return false;\n\n\t\taabbBounds.min = min.z;\n\t\taabbBounds.max = max.z;\n\t\tif ( alignedSatBounds[ 2 ].isSeparated( aabbBounds ) ) return false;\n\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst axis = satAxes[ i ];\n\t\t\tconst sb = satBounds[ i ];\n\t\t\taabbBounds.setFromBox( axis, box );\n\t\t\tif ( sb.isSeparated( aabbBounds ) ) return false;\n\n\t\t}\n\n\t\treturn true;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.intersectsTriangle = ( function () {\n\n\tconst saTri = new _ExtendedTriangle_js__WEBPACK_IMPORTED_MODULE_2__.ExtendedTriangle();\n\tconst pointsArr = new Array( 3 );\n\tconst cachedSatBounds = new _SeparatingAxisBounds_js__WEBPACK_IMPORTED_MODULE_1__.SeparatingAxisBounds();\n\tconst cachedSatBounds2 = new _SeparatingAxisBounds_js__WEBPACK_IMPORTED_MODULE_1__.SeparatingAxisBounds();\n\tconst cachedAxis = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\treturn function intersectsTriangle( triangle ) {\n\n\t\tif ( this.needsUpdate ) {\n\n\t\t\tthis.update();\n\n\t\t}\n\n\t\tif ( ! triangle.isExtendedTriangle ) {\n\n\t\t\tsaTri.copy( triangle );\n\t\t\tsaTri.update();\n\t\t\ttriangle = saTri;\n\n\t\t} else if ( triangle.needsUpdate ) {\n\n\t\t\ttriangle.update();\n\n\t\t}\n\n\t\tconst satBounds = this.satBounds;\n\t\tconst satAxes = this.satAxes;\n\n\t\tpointsArr[ 0 ] = triangle.a;\n\t\tpointsArr[ 1 ] = triangle.b;\n\t\tpointsArr[ 2 ] = triangle.c;\n\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sb = satBounds[ i ];\n\t\t\tconst sa = satAxes[ i ];\n\t\t\tcachedSatBounds.setFromPoints( sa, pointsArr );\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\n\n\t\t}\n\n\t\tconst triSatBounds = triangle.satBounds;\n\t\tconst triSatAxes = triangle.satAxes;\n\t\tconst points = this.points;\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sb = triSatBounds[ i ];\n\t\t\tconst sa = triSatAxes[ i ];\n\t\t\tcachedSatBounds.setFromPoints( sa, points );\n\t\t\tif ( sb.isSeparated( cachedSatBounds ) ) return false;\n\n\t\t}\n\n\t\t// check crossed axes\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sa1 = satAxes[ i ];\n\t\t\tfor ( let i2 = 0; i2 < 4; i2 ++ ) {\n\n\t\t\t\tconst sa2 = triSatAxes[ i2 ];\n\t\t\t\tcachedAxis.crossVectors( sa1, sa2 );\n\t\t\t\tcachedSatBounds.setFromPoints( cachedAxis, pointsArr );\n\t\t\t\tcachedSatBounds2.setFromPoints( cachedAxis, points );\n\t\t\t\tif ( cachedSatBounds.isSeparated( cachedSatBounds2 ) ) return false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.closestPointToPoint = ( function () {\n\n\treturn function closestPointToPoint( point, target1 ) {\n\n\t\tif ( this.needsUpdate ) {\n\n\t\t\tthis.update();\n\n\t\t}\n\n\t\ttarget1\n\t\t\t.copy( point )\n\t\t\t.applyMatrix4( this.invMatrix )\n\t\t\t.clamp( this.min, this.max )\n\t\t\t.applyMatrix4( this.matrix );\n\n\t\treturn target1;\n\n\t};\n\n} )();\n\nOrientedBox.prototype.distanceToPoint = ( function () {\n\n\tconst target = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\treturn function distanceToPoint( point ) {\n\n\t\tthis.closestPointToPoint( point, target );\n\t\treturn point.distanceTo( target );\n\n\t};\n\n} )();\n\nOrientedBox.prototype.distanceToBox = ( function () {\n\n\tconst xyzFields = [ 'x', 'y', 'z' ];\n\tconst segments1 = new Array( 12 ).fill().map( () => new three__WEBPACK_IMPORTED_MODULE_0__.Line3() );\n\tconst segments2 = new Array( 12 ).fill().map( () => new three__WEBPACK_IMPORTED_MODULE_0__.Line3() );\n\n\tconst point1 = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\tconst point2 = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\n\t// early out if we find a value below threshold\n\treturn function distanceToBox( box, threshold = 0, target1 = null, target2 = null ) {\n\n\t\tif ( this.needsUpdate ) {\n\n\t\t\tthis.update();\n\n\t\t}\n\n\t\tif ( this.intersectsBox( box ) ) {\n\n\t\t\tif ( target1 || target2 ) {\n\n\t\t\t\tbox.getCenter( point2 );\n\t\t\t\tthis.closestPointToPoint( point2, point1 );\n\t\t\t\tbox.closestPointToPoint( point1, point2 );\n\n\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t}\n\n\t\t\treturn 0;\n\n\t\t}\n\n\t\tconst threshold2 = threshold * threshold;\n\t\tconst min = box.min;\n\t\tconst max = box.max;\n\t\tconst points = this.points;\n\n\n\t\t// iterate over every edge and compare distances\n\t\tlet closestDistanceSq = Infinity;\n\n\t\t// check over all these points\n\t\tfor ( let i = 0; i < 8; i ++ ) {\n\n\t\t\tconst p = points[ i ];\n\t\t\tpoint2.copy( p ).clamp( min, max );\n\n\t\t\tconst dist = p.distanceToSquared( point2 );\n\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\tif ( target1 ) target1.copy( p );\n\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate and check all line segment distances\n\t\tlet count = 0;\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tfor ( let i1 = 0; i1 <= 1; i1 ++ ) {\n\n\t\t\t\tfor ( let i2 = 0; i2 <= 1; i2 ++ ) {\n\n\t\t\t\t\tconst nextIndex = ( i + 1 ) % 3;\n\t\t\t\t\tconst nextIndex2 = ( i + 2 ) % 3;\n\n\t\t\t\t\t// get obb line segments\n\t\t\t\t\tconst index = i1 << nextIndex | i2 << nextIndex2;\n\t\t\t\t\tconst index2 = 1 << i | i1 << nextIndex | i2 << nextIndex2;\n\t\t\t\t\tconst p1 = points[ index ];\n\t\t\t\t\tconst p2 = points[ index2 ];\n\t\t\t\t\tconst line1 = segments1[ count ];\n\t\t\t\t\tline1.set( p1, p2 );\n\n\n\t\t\t\t\t// get aabb line segments\n\t\t\t\t\tconst f1 = xyzFields[ i ];\n\t\t\t\t\tconst f2 = xyzFields[ nextIndex ];\n\t\t\t\t\tconst f3 = xyzFields[ nextIndex2 ];\n\t\t\t\t\tconst line2 = segments2[ count ];\n\t\t\t\t\tconst start = line2.start;\n\t\t\t\t\tconst end = line2.end;\n\n\t\t\t\t\tstart[ f1 ] = min[ f1 ];\n\t\t\t\t\tstart[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\n\t\t\t\t\tstart[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\n\n\t\t\t\t\tend[ f1 ] = max[ f1 ];\n\t\t\t\t\tend[ f2 ] = i1 ? min[ f2 ] : max[ f2 ];\n\t\t\t\t\tend[ f3 ] = i2 ? min[ f3 ] : max[ f2 ];\n\n\t\t\t\t\tcount ++;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// check all the other boxes point\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\n\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\n\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\n\n\t\t\t\t\tpoint2.x = x ? max.x : min.x;\n\t\t\t\t\tpoint2.y = y ? max.y : min.y;\n\t\t\t\t\tpoint2.z = z ? max.z : min.z;\n\n\t\t\t\t\tthis.closestPointToPoint( point2, point1 );\n\t\t\t\t\tconst dist = point2.distanceToSquared( point1 );\n\t\t\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( let i = 0; i < 12; i ++ ) {\n\n\t\t\tconst l1 = segments1[ i ];\n\t\t\tfor ( let i2 = 0; i2 < 12; i2 ++ ) {\n\n\t\t\t\tconst l2 = segments2[ i2 ];\n\t\t\t\t(0,_MathUtilities_js__WEBPACK_IMPORTED_MODULE_3__.closestPointsSegmentToSegment)( l1, l2, point1, point2 );\n\t\t\t\tconst dist = point1.distanceToSquared( point2 );\n\t\t\t\tif ( dist < closestDistanceSq ) {\n\n\t\t\t\t\tclosestDistanceSq = dist;\n\t\t\t\t\tif ( target1 ) target1.copy( point1 );\n\t\t\t\t\tif ( target2 ) target2.copy( point2 );\n\n\t\t\t\t\tif ( dist < threshold2 ) return Math.sqrt( dist );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn Math.sqrt( closestDistanceSq );\n\n\t};\n\n} )();\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/three-mesh-bvh/src/math/OrientedBox.js?"); /***/ }), /***/ "./node_modules/three-mesh-bvh/src/math/SeparatingAxisBounds.js": /*!**********************************************************************!*\ !*** ./node_modules/three-mesh-bvh/src/math/SeparatingAxisBounds.js ***! \**********************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ SeparatingAxisBounds: () => (/* binding */ SeparatingAxisBounds),\n/* harmony export */ areIntersecting: () => (/* binding */ areIntersecting)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\nclass SeparatingAxisBounds {\n\n\tconstructor() {\n\n\t\tthis.min = Infinity;\n\t\tthis.max = - Infinity;\n\n\t}\n\n\tsetFromPointsField( points, field ) {\n\n\t\tlet min = Infinity;\n\t\tlet max = - Infinity;\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\n\n\t\t\tconst p = points[ i ];\n\t\t\tconst val = p[ field ];\n\t\t\tmin = val < min ? val : min;\n\t\t\tmax = val > max ? val : max;\n\n\t\t}\n\n\t\tthis.min = min;\n\t\tthis.max = max;\n\n\t}\n\n\tsetFromPoints( axis, points ) {\n\n\t\tlet min = Infinity;\n\t\tlet max = - Infinity;\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\n\n\t\t\tconst p = points[ i ];\n\t\t\tconst val = axis.dot( p );\n\t\t\tmin = val < min ? val : min;\n\t\t\tmax = val > max ? val : max;\n\n\t\t}\n\n\t\tthis.min = min;\n\t\tthis.max = max;\n\n\t}\n\n\tisSeparated( other ) {\n\n\t\treturn this.min > other.max || other.min > this.max;\n\n\t}\n\n}\n\nSeparatingAxisBounds.prototype.setFromBox = ( function () {\n\n\tconst p = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\treturn function setFromBox( axis, box ) {\n\n\t\tconst boxMin = box.min;\n\t\tconst boxMax = box.max;\n\t\tlet min = Infinity;\n\t\tlet max = - Infinity;\n\t\tfor ( let x = 0; x <= 1; x ++ ) {\n\n\t\t\tfor ( let y = 0; y <= 1; y ++ ) {\n\n\t\t\t\tfor ( let z = 0; z <= 1; z ++ ) {\n\n\t\t\t\t\tp.x = boxMin.x * x + boxMax.x * ( 1 - x );\n\t\t\t\t\tp.y = boxMin.y * y + boxMax.y * ( 1 - y );\n\t\t\t\t\tp.z = boxMin.z * z + boxMax.z * ( 1 - z );\n\n\t\t\t\t\tconst val = axis.dot( p );\n\t\t\t\t\tmin = Math.min( val, min );\n\t\t\t\t\tmax = Math.max( val, max );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.min = min;\n\t\tthis.max = max;\n\n\t};\n\n} )();\n\nconst areIntersecting = ( function () {\n\n\tconst cacheSatBounds = new SeparatingAxisBounds();\n\treturn function areIntersecting( shape1, shape2 ) {\n\n\t\tconst points1 = shape1.points;\n\t\tconst satAxes1 = shape1.satAxes;\n\t\tconst satBounds1 = shape1.satBounds;\n\n\t\tconst points2 = shape2.points;\n\t\tconst satAxes2 = shape2.satAxes;\n\t\tconst satBounds2 = shape2.satBounds;\n\n\t\t// check axes of the first shape\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sb = satBounds1[ i ];\n\t\t\tconst sa = satAxes1[ i ];\n\t\t\tcacheSatBounds.setFromPoints( sa, points2 );\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\n\n\t\t}\n\n\t\t// check axes of the second shape\n\t\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\t\tconst sb = satBounds2[ i ];\n\t\t\tconst sa = satAxes2[ i ];\n\t\t\tcacheSatBounds.setFromPoints( sa, points1 );\n\t\t\tif ( sb.isSeparated( cacheSatBounds ) ) return false;\n\n\t\t}\n\n\t};\n\n} )();\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/three-mesh-bvh/src/math/SeparatingAxisBounds.js?"); /***/ }), /***/ "./node_modules/three-mesh-bvh/src/objects/MeshBVHVisualizer.js": /*!**********************************************************************!*\ !*** ./node_modules/three-mesh-bvh/src/objects/MeshBVHVisualizer.js ***! \**********************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MeshBVHVisualizer: () => (/* binding */ MeshBVHVisualizer)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var _utils_ArrayBoxUtilities_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/ArrayBoxUtilities.js */ \"./node_modules/three-mesh-bvh/src/utils/ArrayBoxUtilities.js\");\n\n\n\nconst boundingBox = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_0__.Box3();\nclass MeshBVHRootVisualizer extends three__WEBPACK_IMPORTED_MODULE_0__.Object3D {\n\n\tget isMesh() {\n\n\t\treturn ! this.displayEdges;\n\n\t}\n\n\tget isLineSegments() {\n\n\t\treturn this.displayEdges;\n\n\t}\n\n\tget isLine() {\n\n\t\treturn this.displayEdges;\n\n\t}\n\n\tconstructor( mesh, material, depth = 10, group = 0 ) {\n\n\t\tsuper();\n\n\t\tthis.material = material;\n\t\tthis.geometry = new three__WEBPACK_IMPORTED_MODULE_0__.BufferGeometry();\n\t\tthis.name = 'MeshBVHRootVisualizer';\n\t\tthis.depth = depth;\n\t\tthis.displayParents = false;\n\t\tthis.mesh = mesh;\n\t\tthis.displayEdges = true;\n\t\tthis._group = group;\n\n\t}\n\n\traycast() {}\n\n\tupdate() {\n\n\t\tconst geometry = this.geometry;\n\t\tconst boundsTree = this.mesh.geometry.boundsTree;\n\t\tconst group = this._group;\n\t\tgeometry.dispose();\n\t\tthis.visible = false;\n\t\tif ( boundsTree ) {\n\n\t\t\t// count the number of bounds required\n\t\t\tconst targetDepth = this.depth - 1;\n\t\t\tconst displayParents = this.displayParents;\n\t\t\tlet boundsCount = 0;\n\t\t\tboundsTree.traverse( ( depth, isLeaf ) => {\n\n\t\t\t\tif ( depth === targetDepth || isLeaf ) {\n\n\t\t\t\t\tboundsCount ++;\n\t\t\t\t\treturn true;\n\n\t\t\t\t} else if ( displayParents ) {\n\n\t\t\t\t\tboundsCount ++;\n\n\t\t\t\t}\n\n\t\t\t}, group );\n\n\t\t\t// fill in the position buffer with the bounds corners\n\t\t\tlet posIndex = 0;\n\t\t\tconst positionArray = new Float32Array( 8 * 3 * boundsCount );\n\t\t\tboundsTree.traverse( ( depth, isLeaf, boundingData ) => {\n\n\t\t\t\tconst terminate = depth === targetDepth || isLeaf;\n\t\t\t\tif ( terminate || displayParents ) {\n\n\t\t\t\t\t(0,_utils_ArrayBoxUtilities_js__WEBPACK_IMPORTED_MODULE_1__.arrayToBox)( 0, boundingData, boundingBox );\n\n\t\t\t\t\tconst { min, max } = boundingBox;\n\t\t\t\t\tfor ( let x = - 1; x <= 1; x += 2 ) {\n\n\t\t\t\t\t\tconst xVal = x < 0 ? min.x : max.x;\n\t\t\t\t\t\tfor ( let y = - 1; y <= 1; y += 2 ) {\n\n\t\t\t\t\t\t\tconst yVal = y < 0 ? min.y : max.y;\n\t\t\t\t\t\t\tfor ( let z = - 1; z <= 1; z += 2 ) {\n\n\t\t\t\t\t\t\t\tconst zVal = z < 0 ? min.z : max.z;\n\t\t\t\t\t\t\t\tpositionArray[ posIndex + 0 ] = xVal;\n\t\t\t\t\t\t\t\tpositionArray[ posIndex + 1 ] = yVal;\n\t\t\t\t\t\t\t\tpositionArray[ posIndex + 2 ] = zVal;\n\n\t\t\t\t\t\t\t\tposIndex += 3;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\treturn terminate;\n\n\t\t\t\t}\n\n\t\t\t}, group );\n\n\t\t\tlet indexArray;\n\t\t\tlet indices;\n\t\t\tif ( this.displayEdges ) {\n\n\t\t\t\t// fill in the index buffer to point to the corner points\n\t\t\t\tindices = new Uint8Array( [\n\t\t\t\t\t// x axis\n\t\t\t\t\t0, 4,\n\t\t\t\t\t1, 5,\n\t\t\t\t\t2, 6,\n\t\t\t\t\t3, 7,\n\n\t\t\t\t\t// y axis\n\t\t\t\t\t0, 2,\n\t\t\t\t\t1, 3,\n\t\t\t\t\t4, 6,\n\t\t\t\t\t5, 7,\n\n\t\t\t\t\t// z axis\n\t\t\t\t\t0, 1,\n\t\t\t\t\t2, 3,\n\t\t\t\t\t4, 5,\n\t\t\t\t\t6, 7,\n\t\t\t\t] );\n\n\t\t\t} else {\n\n\t\t\t\tindices = new Uint8Array( [\n\n\t\t\t\t\t// X-, X+\n\t\t\t\t\t0, 1, 2,\n\t\t\t\t\t2, 1, 3,\n\n\t\t\t\t\t4, 6, 5,\n\t\t\t\t\t6, 7, 5,\n\n\t\t\t\t\t// Y-, Y+\n\t\t\t\t\t1, 4, 5,\n\t\t\t\t\t0, 4, 1,\n\n\t\t\t\t\t2, 3, 6,\n\t\t\t\t\t3, 7, 6,\n\n\t\t\t\t\t// Z-, Z+\n\t\t\t\t\t0, 2, 4,\n\t\t\t\t\t2, 6, 4,\n\n\t\t\t\t\t1, 5, 3,\n\t\t\t\t\t3, 5, 7,\n\n\t\t\t\t] );\n\n\t\t\t}\n\n\t\t\tif ( positionArray.length > 65535 ) {\n\n\t\t\t\tindexArray = new Uint32Array( indices.length * boundsCount );\n\n\t\t\t} else {\n\n\t\t\t\tindexArray = new Uint16Array( indices.length * boundsCount );\n\n\t\t\t}\n\n\t\t\tconst indexLength = indices.length;\n\t\t\tfor ( let i = 0; i < boundsCount; i ++ ) {\n\n\t\t\t\tconst posOffset = i * 8;\n\t\t\t\tconst indexOffset = i * indexLength;\n\t\t\t\tfor ( let j = 0; j < indexLength; j ++ ) {\n\n\t\t\t\t\tindexArray[ indexOffset + j ] = posOffset + indices[ j ];\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// update the geometry\n\t\t\tgeometry.setIndex(\n\t\t\t\tnew three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute( indexArray, 1, false ),\n\t\t\t);\n\t\t\tgeometry.setAttribute(\n\t\t\t\t'position',\n\t\t\t\tnew three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute( positionArray, 3, false ),\n\t\t\t);\n\t\t\tthis.visible = true;\n\n\t\t}\n\n\t}\n\n}\n\nclass MeshBVHVisualizer extends three__WEBPACK_IMPORTED_MODULE_0__.Group {\n\n\tget color() {\n\n\t\treturn this.edgeMaterial.color;\n\n\t}\n\n\tget opacity() {\n\n\t\treturn this.edgeMaterial.opacity;\n\n\t}\n\n\tset opacity( v ) {\n\n\t\tthis.edgeMaterial.opacity = v;\n\t\tthis.meshMaterial.opacity = v;\n\n\t}\n\n\tconstructor( mesh, depth = 10 ) {\n\n\t\tsuper();\n\n\t\tthis.name = 'MeshBVHVisualizer';\n\t\tthis.depth = depth;\n\t\tthis.mesh = mesh;\n\t\tthis.displayParents = false;\n\t\tthis.displayEdges = true;\n\t\tthis._roots = [];\n\n\t\tconst edgeMaterial = new three__WEBPACK_IMPORTED_MODULE_0__.LineBasicMaterial( {\n\t\t\tcolor: 0x00FF88,\n\t\t\ttransparent: true,\n\t\t\topacity: 0.3,\n\t\t\tdepthWrite: false,\n\t\t} );\n\n\t\tconst meshMaterial = new three__WEBPACK_IMPORTED_MODULE_0__.MeshBasicMaterial( {\n\t\t\tcolor: 0x00FF88,\n\t\t\ttransparent: true,\n\t\t\topacity: 0.3,\n\t\t\tdepthWrite: false,\n\t\t} );\n\n\t\tmeshMaterial.color = edgeMaterial.color;\n\n\t\tthis.edgeMaterial = edgeMaterial;\n\t\tthis.meshMaterial = meshMaterial;\n\n\t\tthis.update();\n\n\t}\n\n\tupdate() {\n\n\t\tconst bvh = this.mesh.geometry.boundsTree;\n\t\tconst totalRoots = bvh ? bvh._roots.length : 0;\n\t\twhile ( this._roots.length > totalRoots ) {\n\n\t\t\tconst root = this._roots.pop();\n\t\t\troot.geometry.dispose();\n\t\t\tthis.remove( root );\n\n\t\t}\n\n\t\tfor ( let i = 0; i < totalRoots; i ++ ) {\n\n\t\t\tif ( i >= this._roots.length ) {\n\n\t\t\t\tconst root = new MeshBVHRootVisualizer( this.mesh, this.edgeMaterial, this.depth, i );\n\t\t\t\tthis.add( root );\n\t\t\t\tthis._roots.push( root );\n\n\t\t\t}\n\n\t\t\tconst root = this._roots[ i ];\n\t\t\troot.depth = this.depth;\n\t\t\troot.mesh = this.mesh;\n\t\t\troot.displayParents = this.displayParents;\n\t\t\troot.displayEdges = this.displayEdges;\n\t\t\troot.material = this.displayEdges ? this.edgeMaterial : this.meshMaterial;\n\t\t\troot.update();\n\n\t\t}\n\n\t}\n\n\tupdateMatrixWorld( ...args ) {\n\n\t\tthis.position.copy( this.mesh.position );\n\t\tthis.rotation.copy( this.mesh.rotation );\n\t\tthis.scale.copy( this.mesh.scale );\n\n\t\tsuper.updateMatrixWorld( ...args );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.depth = source.depth;\n\t\tthis.mesh = source.mesh;\n\n\t}\n\n\tclone() {\n\n\t\treturn new MeshBVHVisualizer( this.mesh, this.depth );\n\n\t}\n\n\tdispose() {\n\n\t\tthis.edgeMaterial.dispose();\n\t\tthis.meshMaterial.dispose();\n\n\t\tconst children = this.children;\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tchildren[ i ].geometry.dispose();\n\n\t\t}\n\n\t}\n\n}\n\n\n\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/three-mesh-bvh/src/objects/MeshBVHVisualizer.js?"); /***/ }), /***/ "./node_modules/three-mesh-bvh/src/utils/ArrayBoxUtilities.js": /*!********************************************************************!*\ !*** ./node_modules/three-mesh-bvh/src/utils/ArrayBoxUtilities.js ***! \********************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ arrayToBox: () => (/* binding */ arrayToBox),\n/* harmony export */ computeSurfaceArea: () => (/* binding */ computeSurfaceArea),\n/* harmony export */ copyBounds: () => (/* binding */ copyBounds),\n/* harmony export */ expandByTriangleBounds: () => (/* binding */ expandByTriangleBounds),\n/* harmony export */ getLongestEdgeIndex: () => (/* binding */ getLongestEdgeIndex),\n/* harmony export */ unionBounds: () => (/* binding */ unionBounds)\n/* harmony export */ });\nfunction arrayToBox( nodeIndex32, array, target ) {\n\n\ttarget.min.x = array[ nodeIndex32 ];\n\ttarget.min.y = array[ nodeIndex32 + 1 ];\n\ttarget.min.z = array[ nodeIndex32 + 2 ];\n\n\ttarget.max.x = array[ nodeIndex32 + 3 ];\n\ttarget.max.y = array[ nodeIndex32 + 4 ];\n\ttarget.max.z = array[ nodeIndex32 + 5 ];\n\n\treturn target;\n\n}\n\nfunction getLongestEdgeIndex( bounds ) {\n\n\tlet splitDimIdx = - 1;\n\tlet splitDist = - Infinity;\n\n\tfor ( let i = 0; i < 3; i ++ ) {\n\n\t\tconst dist = bounds[ i + 3 ] - bounds[ i ];\n\t\tif ( dist > splitDist ) {\n\n\t\t\tsplitDist = dist;\n\t\t\tsplitDimIdx = i;\n\n\t\t}\n\n\t}\n\n\treturn splitDimIdx;\n\n}\n\n// copies bounds a into bounds b\nfunction copyBounds( source, target ) {\n\n\ttarget.set( source );\n\n}\n\n// sets bounds target to the union of bounds a and b\nfunction unionBounds( a, b, target ) {\n\n\tlet aVal, bVal;\n\tfor ( let d = 0; d < 3; d ++ ) {\n\n\t\tconst d3 = d + 3;\n\n\t\t// set the minimum values\n\t\taVal = a[ d ];\n\t\tbVal = b[ d ];\n\t\ttarget[ d ] = aVal < bVal ? aVal : bVal;\n\n\t\t// set the max values\n\t\taVal = a[ d3 ];\n\t\tbVal = b[ d3 ];\n\t\ttarget[ d3 ] = aVal > bVal ? aVal : bVal;\n\n\t}\n\n}\n\n// expands the given bounds by the provided triangle bounds\nfunction expandByTriangleBounds( startIndex, triangleBounds, bounds ) {\n\n\tfor ( let d = 0; d < 3; d ++ ) {\n\n\t\tconst tCenter = triangleBounds[ startIndex + 2 * d ];\n\t\tconst tHalf = triangleBounds[ startIndex + 2 * d + 1 ];\n\n\t\tconst tMin = tCenter - tHalf;\n\t\tconst tMax = tCenter + tHalf;\n\n\t\tif ( tMin < bounds[ d ] ) {\n\n\t\t\tbounds[ d ] = tMin;\n\n\t\t}\n\n\t\tif ( tMax > bounds[ d + 3 ] ) {\n\n\t\t\tbounds[ d + 3 ] = tMax;\n\n\t\t}\n\n\t}\n\n}\n\n// compute bounds surface area\nfunction computeSurfaceArea( bounds ) {\n\n\tconst d0 = bounds[ 3 ] - bounds[ 0 ];\n\tconst d1 = bounds[ 4 ] - bounds[ 1 ];\n\tconst d2 = bounds[ 5 ] - bounds[ 2 ];\n\n\treturn 2 * ( d0 * d1 + d1 * d2 + d2 * d0 );\n\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/three-mesh-bvh/src/utils/ArrayBoxUtilities.js?"); /***/ }), /***/ "./node_modules/three-mesh-bvh/src/utils/ExtensionUtilities.js": /*!*********************************************************************!*\ !*** ./node_modules/three-mesh-bvh/src/utils/ExtensionUtilities.js ***! \*********************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ acceleratedRaycast: () => (/* binding */ acceleratedRaycast),\n/* harmony export */ computeBoundsTree: () => (/* binding */ computeBoundsTree),\n/* harmony export */ disposeBoundsTree: () => (/* binding */ disposeBoundsTree)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var _GeometryRayIntersectUtilities_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./GeometryRayIntersectUtilities.js */ \"./node_modules/three-mesh-bvh/src/utils/GeometryRayIntersectUtilities.js\");\n/* harmony import */ var _core_MeshBVH_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/MeshBVH.js */ \"./node_modules/three-mesh-bvh/src/core/MeshBVH.js\");\n\n\n\n\nconst ray = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_0__.Ray();\nconst tmpInverseMatrix = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4();\nconst origMeshRaycastFunc = three__WEBPACK_IMPORTED_MODULE_0__.Mesh.prototype.raycast;\n\nfunction acceleratedRaycast( raycaster, intersects ) {\n\n\tif ( this.geometry.boundsTree ) {\n\n\t\tif ( this.material === undefined ) return;\n\n\t\ttmpInverseMatrix.copy( this.matrixWorld ).invert();\n\t\tray.copy( raycaster.ray ).applyMatrix4( tmpInverseMatrix );\n\n\t\tconst bvh = this.geometry.boundsTree;\n\t\tif ( raycaster.firstHitOnly === true ) {\n\n\t\t\tconst hit = (0,_GeometryRayIntersectUtilities_js__WEBPACK_IMPORTED_MODULE_1__.convertRaycastIntersect)( bvh.raycastFirst( ray, this.material ), this, raycaster );\n\t\t\tif ( hit ) {\n\n\t\t\t\tintersects.push( hit );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst hits = bvh.raycast( ray, this.material );\n\t\t\tfor ( let i = 0, l = hits.length; i < l; i ++ ) {\n\n\t\t\t\tconst hit = (0,_GeometryRayIntersectUtilities_js__WEBPACK_IMPORTED_MODULE_1__.convertRaycastIntersect)( hits[ i ], this, raycaster );\n\t\t\t\tif ( hit ) {\n\n\t\t\t\t\tintersects.push( hit );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t} else {\n\n\t\torigMeshRaycastFunc.call( this, raycaster, intersects );\n\n\t}\n\n}\n\nfunction computeBoundsTree( options ) {\n\n\tthis.boundsTree = new _core_MeshBVH_js__WEBPACK_IMPORTED_MODULE_2__.MeshBVH( this, options );\n\treturn this.boundsTree;\n\n}\n\nfunction disposeBoundsTree() {\n\n\tthis.boundsTree = null;\n\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/three-mesh-bvh/src/utils/ExtensionUtilities.js?"); /***/ }), /***/ "./node_modules/three-mesh-bvh/src/utils/GeometryRayIntersectUtilities.js": /*!********************************************************************************!*\ !*** ./node_modules/three-mesh-bvh/src/utils/GeometryRayIntersectUtilities.js ***! \********************************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ convertRaycastIntersect: () => (/* binding */ convertRaycastIntersect),\n/* harmony export */ intersectClosestTri: () => (/* binding */ intersectClosestTri),\n/* harmony export */ intersectTris: () => (/* binding */ intersectTris)\n/* harmony export */ });\n/* harmony import */ var _ThreeRayIntersectUtilities_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ThreeRayIntersectUtilities.js */ \"./node_modules/three-mesh-bvh/src/utils/ThreeRayIntersectUtilities.js\");\n\n\nfunction intersectTris( geo, side, ray, offset, count, intersections ) {\n\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\n\n\t\t(0,_ThreeRayIntersectUtilities_js__WEBPACK_IMPORTED_MODULE_0__.intersectTri)( geo, side, ray, i, intersections );\n\n\t}\n\n}\n\nfunction intersectClosestTri( geo, side, ray, offset, count ) {\n\n\tlet dist = Infinity;\n\tlet res = null;\n\tfor ( let i = offset, end = offset + count; i < end; i ++ ) {\n\n\t\tconst intersection = (0,_ThreeRayIntersectUtilities_js__WEBPACK_IMPORTED_MODULE_0__.intersectTri)( geo, side, ray, i );\n\t\tif ( intersection && intersection.distance < dist ) {\n\n\t\t\tres = intersection;\n\t\t\tdist = intersection.distance;\n\n\t\t}\n\n\t}\n\n\treturn res;\n\n}\n\n// converts the given BVH raycast intersection to align with the three.js raycast\n// structure (include object, world space distance and point).\nfunction convertRaycastIntersect( hit, object, raycaster ) {\n\n\tif ( hit === null ) {\n\n\t\treturn null;\n\n\t}\n\n\thit.point.applyMatrix4( object.matrixWorld );\n\thit.distance = hit.point.distanceTo( raycaster.ray.origin );\n\thit.object = object;\n\n\tif ( hit.distance < raycaster.near || hit.distance > raycaster.far ) {\n\n\t\treturn null;\n\n\t} else {\n\n\t\treturn hit;\n\n\t}\n\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/three-mesh-bvh/src/utils/GeometryRayIntersectUtilities.js?"); /***/ }), /***/ "./node_modules/three-mesh-bvh/src/utils/PrimitivePool.js": /*!****************************************************************!*\ !*** ./node_modules/three-mesh-bvh/src/utils/PrimitivePool.js ***! \****************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PrimitivePool: () => (/* binding */ PrimitivePool)\n/* harmony export */ });\nclass PrimitivePool {\n\n\tconstructor( getNewPrimitive ) {\n\n\t\tthis._getNewPrimitive = getNewPrimitive;\n\t\tthis._primitives = [];\n\n\t}\n\n\tgetPrimitive() {\n\n\t\tconst primitives = this._primitives;\n\t\tif ( primitives.length === 0 ) {\n\n\t\t\treturn this._getNewPrimitive();\n\n\t\t} else {\n\n\t\t\treturn primitives.pop();\n\n\t\t}\n\n\t}\n\n\treleasePrimitive( primitive ) {\n\n\t\tthis._primitives.push( primitive );\n\n\t}\n\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/three-mesh-bvh/src/utils/PrimitivePool.js?"); /***/ }), /***/ "./node_modules/three-mesh-bvh/src/utils/ThreeRayIntersectUtilities.js": /*!*****************************************************************************!*\ !*** ./node_modules/three-mesh-bvh/src/utils/ThreeRayIntersectUtilities.js ***! \*****************************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ intersectTri: () => (/* binding */ intersectTri)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n// Ripped and modified From THREE.js Mesh raycast\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L115\nconst vA = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\nconst vB = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\nconst vC = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\nconst uvA = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_0__.Vector2();\nconst uvB = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_0__.Vector2();\nconst uvC = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_0__.Vector2();\n\nconst intersectionPoint = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\nfunction checkIntersection( ray, pA, pB, pC, point, side ) {\n\n\tlet intersect;\n\tif ( side === three__WEBPACK_IMPORTED_MODULE_0__.BackSide ) {\n\n\t\tintersect = ray.intersectTriangle( pC, pB, pA, true, point );\n\n\t} else {\n\n\t\tintersect = ray.intersectTriangle( pA, pB, pC, side !== three__WEBPACK_IMPORTED_MODULE_0__.DoubleSide, point );\n\n\t}\n\n\tif ( intersect === null ) return null;\n\n\tconst distance = ray.origin.distanceTo( point );\n\n\treturn {\n\n\t\tdistance: distance,\n\t\tpoint: point.clone(),\n\n\t};\n\n}\n\nfunction checkBufferGeometryIntersection( ray, position, uv, a, b, c, side ) {\n\n\tvA.fromBufferAttribute( position, a );\n\tvB.fromBufferAttribute( position, b );\n\tvC.fromBufferAttribute( position, c );\n\n\tconst intersection = checkIntersection( ray, vA, vB, vC, intersectionPoint, side );\n\n\tif ( intersection ) {\n\n\t\tif ( uv ) {\n\n\t\t\tuvA.fromBufferAttribute( uv, a );\n\t\t\tuvB.fromBufferAttribute( uv, b );\n\t\t\tuvC.fromBufferAttribute( uv, c );\n\n\t\t\tintersection.uv = three__WEBPACK_IMPORTED_MODULE_0__.Triangle.getUV( intersectionPoint, vA, vB, vC, uvA, uvB, uvC, new three__WEBPACK_IMPORTED_MODULE_0__.Vector2( ) );\n\n\t\t}\n\n\t\tconst face = {\n\t\t\ta: a,\n\t\t\tb: b,\n\t\t\tc: c,\n\t\t\tnormal: new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(),\n\t\t\tmaterialIndex: 0\n\t\t};\n\n\t\tthree__WEBPACK_IMPORTED_MODULE_0__.Triangle.getNormal( vA, vB, vC, face.normal );\n\n\t\tintersection.face = face;\n\t\tintersection.faceIndex = a;\n\n\t}\n\n\treturn intersection;\n\n}\n\n// https://github.com/mrdoob/three.js/blob/0aa87c999fe61e216c1133fba7a95772b503eddf/src/objects/Mesh.js#L258\nfunction intersectTri( geo, side, ray, tri, intersections ) {\n\n\tconst triOffset = tri * 3;\n\tconst a = geo.index.getX( triOffset );\n\tconst b = geo.index.getX( triOffset + 1 );\n\tconst c = geo.index.getX( triOffset + 2 );\n\n\tconst intersection = checkBufferGeometryIntersection( ray, geo.attributes.position, geo.attributes.uv, a, b, c, side );\n\n\tif ( intersection ) {\n\n\t\tintersection.faceIndex = tri;\n\t\tif ( intersections ) intersections.push( intersection );\n\t\treturn intersection;\n\n\t}\n\n\treturn null;\n\n}\n\n\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/three-mesh-bvh/src/utils/ThreeRayIntersectUtilities.js?"); /***/ }), /***/ "./node_modules/three-mesh-bvh/src/utils/TriangleUtilities.js": /*!********************************************************************!*\ !*** ./node_modules/three-mesh-bvh/src/utils/TriangleUtilities.js ***! \********************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getTriangleHitPointInfo: () => (/* binding */ getTriangleHitPointInfo),\n/* harmony export */ iterateOverTriangles: () => (/* binding */ iterateOverTriangles),\n/* harmony export */ setTriangle: () => (/* binding */ setTriangle)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n// sets the vertices of triangle `tri` with the 3 vertices after i\nfunction setTriangle( tri, i, index, pos ) {\n\n\tconst ta = tri.a;\n\tconst tb = tri.b;\n\tconst tc = tri.c;\n\n\tlet i0 = i;\n\tlet i1 = i + 1;\n\tlet i2 = i + 2;\n\tif ( index ) {\n\n\t\ti0 = index.getX( i );\n\t\ti1 = index.getX( i + 1 );\n\t\ti2 = index.getX( i + 2 );\n\n\t}\n\n\tta.x = pos.getX( i0 );\n\tta.y = pos.getY( i0 );\n\tta.z = pos.getZ( i0 );\n\n\ttb.x = pos.getX( i1 );\n\ttb.y = pos.getY( i1 );\n\ttb.z = pos.getZ( i1 );\n\n\ttc.x = pos.getX( i2 );\n\ttc.y = pos.getY( i2 );\n\ttc.z = pos.getZ( i2 );\n\n}\n\nfunction iterateOverTriangles(\n\toffset,\n\tcount,\n\tgeometry,\n\tintersectsTriangleFunc,\n\tcontained,\n\tdepth,\n\ttriangle\n) {\n\n\tconst index = geometry.index;\n\tconst pos = geometry.attributes.position;\n\tfor ( let i = offset, l = count + offset; i < l; i ++ ) {\n\n\t\tsetTriangle( triangle, i * 3, index, pos );\n\t\ttriangle.needsUpdate = true;\n\n\t\tif ( intersectsTriangleFunc( triangle, i, contained, depth ) ) {\n\n\t\t\treturn true;\n\n\t\t}\n\n\t}\n\n\treturn false;\n\n}\n\nconst tempV1 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\nconst tempV2 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\nconst tempV3 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\nconst tempUV1 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_0__.Vector2();\nconst tempUV2 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_0__.Vector2();\nconst tempUV3 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_0__.Vector2();\n\nfunction getTriangleHitPointInfo( point, geometry, triangleIndex, target ) {\n\n\tconst indices = geometry.getIndex().array;\n\tconst positions = geometry.getAttribute( 'position' );\n\tconst uvs = geometry.getAttribute( 'uv' );\n\n\tconst a = indices[ triangleIndex * 3 ];\n\tconst b = indices[ triangleIndex * 3 + 1 ];\n\tconst c = indices[ triangleIndex * 3 + 2 ];\n\n\ttempV1.fromBufferAttribute( positions, a );\n\ttempV2.fromBufferAttribute( positions, b );\n\ttempV3.fromBufferAttribute( positions, c );\n\n\t// find the associated material index\n\tlet materialIndex = 0;\n\tconst groups = geometry.groups;\n\tconst firstVertexIndex = triangleIndex * 3;\n\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\tconst group = groups[ i ];\n\t\tconst { start, count } = group;\n\t\tif ( firstVertexIndex >= start && firstVertexIndex < start + count ) {\n\n\t\t\tmaterialIndex = group.materialIndex;\n\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\t// extract uvs\n\tlet uv = null;\n\tif ( uvs ) {\n\n\t\ttempUV1.fromBufferAttribute( uvs, a );\n\t\ttempUV2.fromBufferAttribute( uvs, b );\n\t\ttempUV3.fromBufferAttribute( uvs, c );\n\n\t\tif ( target && target.uv ) uv = target.uv;\n\t\telse uv = new three__WEBPACK_IMPORTED_MODULE_0__.Vector2();\n\n\t\tthree__WEBPACK_IMPORTED_MODULE_0__.Triangle.getUV( point, tempV1, tempV2, tempV3, tempUV1, tempUV2, tempUV3, uv );\n\n\t}\n\n\t// adjust the provided target or create a new one\n\tif ( target ) {\n\n\t\tif ( ! target.face ) target.face = { };\n\t\ttarget.face.a = a;\n\t\ttarget.face.b = b;\n\t\ttarget.face.c = c;\n\t\ttarget.face.materialIndex = materialIndex;\n\t\tif ( ! target.face.normal ) target.face.normal = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\t\tthree__WEBPACK_IMPORTED_MODULE_0__.Triangle.getNormal( tempV1, tempV2, tempV3, target.face.normal );\n\n\t\tif ( uv ) target.uv = uv;\n\n\t\treturn target;\n\n\t} else {\n\n\t\treturn {\n\t\t\tface: {\n\t\t\t\ta: a,\n\t\t\t\tb: b,\n\t\t\t\tc: c,\n\t\t\t\tmaterialIndex: materialIndex,\n\t\t\t\tnormal: three__WEBPACK_IMPORTED_MODULE_0__.Triangle.getNormal( tempV1, tempV2, tempV3, new three__WEBPACK_IMPORTED_MODULE_0__.Vector3() )\n\t\t\t},\n\t\t\tuv: uv\n\t\t};\n\n\t}\n\n}\n\n\n//# sourceURL=webpack://cadflow-react/./node_modules/three-mesh-bvh/src/utils/TriangleUtilities.js?"); /***/ }), /***/ "./node_modules/three-stdlib/index.js": /*!********************************************!*\ !*** ./node_modules/three-stdlib/index.js ***! \********************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ACESFilmicToneMappingShader: () => (/* binding */ ACESFilmicToneMappingShader),\n/* harmony export */ AMFLoader: () => (/* binding */ AMFLoader),\n/* harmony export */ ARButton: () => (/* binding */ ARButton),\n/* harmony export */ AdaptiveToneMappingPass: () => (/* binding */ AdaptiveToneMappingPass),\n/* harmony export */ AfterimagePass: () => (/* binding */ AfterimagePass),\n/* harmony export */ AfterimageShader: () => (/* binding */ AfterimageShader),\n/* harmony export */ AmmoPhysics: () => (/* binding */ AmmoPhysics),\n/* harmony export */ AnaglyphEffect: () => (/* binding */ AnaglyphEffect),\n/* harmony export */ AnimationClipCreator: () => (/* binding */ AnimationClipCreator),\n/* harmony export */ ArcballControls: () => (/* binding */ ArcballControls),\n/* harmony export */ AsciiEffect: () => (/* binding */ AsciiEffect),\n/* harmony export */ AssimpLoader: () => (/* binding */ AssimpLoader),\n/* harmony export */ BVHLoader: () => (/* binding */ BVHLoader),\n/* harmony export */ BasicShader: () => (/* binding */ BasicShader),\n/* harmony export */ BasisTextureLoader: () => (/* binding */ BasisTextureLoader),\n/* harmony export */ BleachBypassShader: () => (/* binding */ BleachBypassShader),\n/* harmony export */ BlendShader: () => (/* binding */ BlendShader),\n/* harmony export */ BloomPass: () => (/* binding */ BloomPass),\n/* harmony export */ BlurShaderUtils: () => (/* binding */ BlurShaderUtils),\n/* harmony export */ BokehDepthShader: () => (/* binding */ BokehDepthShader),\n/* harmony export */ BokehPass: () => (/* binding */ BokehPass),\n/* harmony export */ BokehShader: () => (/* binding */ BokehShader),\n/* harmony export */ BokehShader2: () => (/* binding */ BokehShader2),\n/* harmony export */ BoxLineGeometry: () => (/* binding */ BoxLineGeometry),\n/* harmony export */ BrightnessContrastShader: () => (/* binding */ BrightnessContrastShader),\n/* harmony export */ CCDIKHelper: () => (/* binding */ CCDIKHelper),\n/* harmony export */ CCDIKSolver: () => (/* binding */ CCDIKSolver),\n/* harmony export */ CSM: () => (/* binding */ CSM),\n/* harmony export */ CSMFrustum: () => (/* binding */ CSMFrustum),\n/* harmony export */ CSMHelper: () => (/* binding */ CSMHelper),\n/* harmony export */ CSMShader: () => (/* binding */ CSMShader),\n/* harmony export */ CSS2DObject: () => (/* binding */ CSS2DObject),\n/* harmony export */ CSS2DRenderer: () => (/* binding */ CSS2DRenderer),\n/* harmony export */ CSS3DObject: () => (/* binding */ CSS3DObject),\n/* harmony export */ CSS3DRenderer: () => (/* binding */ CSS3DRenderer),\n/* harmony export */ CSS3DSprite: () => (/* binding */ CSS3DSprite),\n/* harmony export */ CameraControls: () => (/* binding */ CameraControls),\n/* harmony export */ Capsule: () => (/* binding */ Capsule),\n/* harmony export */ CinematicCamera: () => (/* binding */ CinematicCamera),\n/* harmony export */ CinquefoilKnot: () => (/* binding */ CinquefoilKnot),\n/* harmony export */ ClearMaskPass: () => (/* binding */ ClearMaskPass),\n/* harmony export */ ClearPass: () => (/* binding */ ClearPass),\n/* harmony export */ ColladaExporter: () => (/* binding */ ColladaExporter),\n/* harmony export */ ColladaLoader: () => (/* binding */ ColladaLoader),\n/* harmony export */ ColorConverter: () => (/* binding */ ColorConverter),\n/* harmony export */ ColorCorrectionShader: () => (/* binding */ ColorCorrectionShader),\n/* harmony export */ ColorMapKeywords: () => (/* binding */ ColorMapKeywords),\n/* harmony export */ ColorifyShader: () => (/* binding */ ColorifyShader),\n/* harmony export */ ConvexGeometry: () => (/* binding */ ConvexGeometry),\n/* harmony export */ ConvexHull: () => (/* binding */ ConvexHull),\n/* harmony export */ ConvexObjectBreaker: () => (/* binding */ ConvexObjectBreaker),\n/* harmony export */ ConvolutionShader: () => (/* binding */ ConvolutionShader),\n/* harmony export */ CopyShader: () => (/* binding */ CopyShader),\n/* harmony export */ CubeTexturePass: () => (/* binding */ CubeTexturePass),\n/* harmony export */ DDSLoader: () => (/* binding */ DDSLoader),\n/* harmony export */ DOFMipMapShader: () => (/* binding */ DOFMipMapShader),\n/* harmony export */ DRACOExporter: () => (/* binding */ DRACOExporter),\n/* harmony export */ DRACOLoader: () => (/* binding */ DRACOLoader),\n/* harmony export */ DecalGeometry: () => (/* binding */ DecalGeometry),\n/* harmony export */ DecalVertex: () => (/* binding */ DecalVertex),\n/* harmony export */ DecoratedTorusKnot4a: () => (/* binding */ DecoratedTorusKnot4a),\n/* harmony export */ DecoratedTorusKnot4b: () => (/* binding */ DecoratedTorusKnot4b),\n/* harmony export */ DecoratedTorusKnot5a: () => (/* binding */ DecoratedTorusKnot5a),\n/* harmony export */ DecoratedTorusKnot5c: () => (/* binding */ DecoratedTorusKnot5c),\n/* harmony export */ DepthLimitedBlurShader: () => (/* binding */ DepthLimitedBlurShader),\n/* harmony export */ DeviceOrientationControls: () => (/* binding */ DeviceOrientationControls),\n/* harmony export */ DigitalGlitch: () => (/* binding */ DigitalGlitch),\n/* harmony export */ DotScreenPass: () => (/* binding */ DotScreenPass),\n/* harmony export */ DotScreenShader: () => (/* binding */ DotScreenShader),\n/* harmony export */ DragControls: () => (/* binding */ DragControls),\n/* harmony export */ EXRLoader: () => (/* binding */ EXRLoader),\n/* harmony export */ EdgeSplitModifier: () => (/* binding */ EdgeSplitModifier),\n/* harmony export */ EffectComposer: () => (/* binding */ EffectComposer),\n/* harmony export */ FBXLoader: () => (/* binding */ FBXLoader),\n/* harmony export */ FXAAShader: () => (/* binding */ FXAAShader),\n/* harmony export */ Face: () => (/* binding */ Face$1),\n/* harmony export */ Face3: () => (/* binding */ Face3),\n/* harmony export */ FigureEightPolynomialKnot: () => (/* binding */ FigureEightPolynomialKnot),\n/* harmony export */ FilmPass: () => (/* binding */ FilmPass),\n/* harmony export */ FilmShader: () => (/* binding */ FilmShader),\n/* harmony export */ FirstPersonControls: () => (/* binding */ FirstPersonControls),\n/* harmony export */ FlakesTexture: () => (/* binding */ FlakesTexture),\n/* harmony export */ Flow: () => (/* binding */ Flow),\n/* harmony export */ FlyControls: () => (/* binding */ FlyControls),\n/* harmony export */ FocusShader: () => (/* binding */ FocusShader),\n/* harmony export */ Font: () => (/* binding */ Font),\n/* harmony export */ FontLoader: () => (/* binding */ FontLoader),\n/* harmony export */ FreiChenShader: () => (/* binding */ FreiChenShader),\n/* harmony export */ FresnelShader: () => (/* binding */ FresnelShader),\n/* harmony export */ FullScreenQuad: () => (/* binding */ FullScreenQuad),\n/* harmony export */ GCodeLoader: () => (/* binding */ GCodeLoader),\n/* harmony export */ GLTFExporter: () => (/* binding */ GLTFExporter),\n/* harmony export */ GLTFLoader: () => (/* binding */ GLTFLoader),\n/* harmony export */ GPUComputationRenderer: () => (/* binding */ GPUComputationRenderer),\n/* harmony export */ GammaCorrectionShader: () => (/* binding */ GammaCorrectionShader),\n/* harmony export */ Geometry: () => (/* binding */ Geometry),\n/* harmony export */ GeometryCompressionUtils: () => (/* binding */ GeometryCompressionUtils),\n/* harmony export */ GeometryUtils: () => (/* binding */ GeometryUtils),\n/* harmony export */ GlitchPass: () => (/* binding */ GlitchPass),\n/* harmony export */ GodRaysCombineShader: () => (/* binding */ GodRaysCombineShader),\n/* harmony export */ GodRaysDepthMaskShader: () => (/* binding */ GodRaysDepthMaskShader),\n/* harmony export */ GodRaysFakeSunShader: () => (/* binding */ GodRaysFakeSunShader),\n/* harmony export */ GodRaysGenerateShader: () => (/* binding */ GodRaysGenerateShader),\n/* harmony export */ GrannyKnot: () => (/* binding */ GrannyKnot),\n/* harmony export */ GroundProjectedEnv: () => (/* binding */ GroundProjectedEnv),\n/* harmony export */ Gyroscope: () => (/* binding */ Gyroscope),\n/* harmony export */ HDRCubeTextureLoader: () => (/* binding */ HDRCubeTextureLoader),\n/* harmony export */ HTMLMesh: () => (/* binding */ HTMLMesh),\n/* harmony export */ HalfEdge: () => (/* binding */ HalfEdge),\n/* harmony export */ HalftonePass: () => (/* binding */ HalftonePass),\n/* harmony export */ HalftoneShader: () => (/* binding */ HalftoneShader),\n/* harmony export */ HeartCurve: () => (/* binding */ HeartCurve),\n/* harmony export */ HelixCurve: () => (/* binding */ HelixCurve),\n/* harmony export */ HorizontalBlurShader: () => (/* binding */ HorizontalBlurShader),\n/* harmony export */ HorizontalTiltShiftShader: () => (/* binding */ HorizontalTiltShiftShader),\n/* harmony export */ HueSaturationShader: () => (/* binding */ HueSaturationShader),\n/* harmony export */ ImprovedNoise: () => (/* binding */ ImprovedNoise),\n/* harmony export */ InstancedFlow: () => (/* binding */ InstancedFlow),\n/* harmony export */ InteractiveGroup: () => (/* binding */ InteractiveGroup),\n/* harmony export */ KMZLoader: () => (/* binding */ KMZLoader),\n/* harmony export */ KTX2Loader: () => (/* binding */ KTX2Loader),\n/* harmony export */ KTXLoader: () => (/* binding */ KTXLoader),\n/* harmony export */ KaleidoShader: () => (/* binding */ KaleidoShader),\n/* harmony export */ KnotCurve: () => (/* binding */ KnotCurve),\n/* harmony export */ LDrawLoader: () => (/* binding */ LDrawLoader),\n/* harmony export */ LUT3dlLoader: () => (/* binding */ LUT3dlLoader),\n/* harmony export */ LUTCubeLoader: () => (/* binding */ LUTCubeLoader),\n/* harmony export */ LUTPass: () => (/* binding */ LUTPass),\n/* harmony export */ LWOLoader: () => (/* binding */ LWOLoader),\n/* harmony export */ Lensflare: () => (/* binding */ Lensflare),\n/* harmony export */ LensflareElement: () => (/* binding */ LensflareElement),\n/* harmony export */ LightProbeGenerator: () => (/* binding */ LightProbeGenerator),\n/* harmony export */ LightProbeHelper: () => (/* binding */ LightProbeHelper),\n/* harmony export */ LightningStorm: () => (/* binding */ LightningStorm),\n/* harmony export */ LightningStrike: () => (/* binding */ LightningStrike),\n/* harmony export */ Line2: () => (/* binding */ Line2),\n/* harmony export */ LineGeometry: () => (/* binding */ LineGeometry),\n/* harmony export */ LineMaterial: () => (/* binding */ LineMaterial),\n/* harmony export */ LineSegments2: () => (/* binding */ LineSegments2),\n/* harmony export */ LineSegmentsGeometry: () => (/* binding */ LineSegmentsGeometry),\n/* harmony export */ LottieLoader: () => (/* binding */ LottieLoader),\n/* harmony export */ LuminosityHighPassShader: () => (/* binding */ LuminosityHighPassShader),\n/* harmony export */ LuminosityShader: () => (/* binding */ LuminosityShader),\n/* harmony export */ Lut: () => (/* binding */ Lut),\n/* harmony export */ MD2Character: () => (/* binding */ MD2Character),\n/* harmony export */ MD2CharacterComplex: () => (/* binding */ MD2CharacterComplex),\n/* harmony export */ MD2Loader: () => (/* binding */ MD2Loader),\n/* harmony export */ MDDLoader: () => (/* binding */ MDDLoader),\n/* harmony export */ MMDAnimationHelper: () => (/* binding */ MMDAnimationHelper),\n/* harmony export */ MMDExporter: () => (/* binding */ MMDExporter),\n/* harmony export */ MMDLoader: () => (/* binding */ MMDLoader),\n/* harmony export */ MMDPhysics: () => (/* binding */ MMDPhysics),\n/* harmony export */ MTLLoader: () => (/* binding */ MTLLoader),\n/* harmony export */ MapControls: () => (/* binding */ MapControls),\n/* harmony export */ MapControlsExp: () => (/* binding */ MapControlsExp),\n/* harmony export */ MarchingCubes: () => (/* binding */ MarchingCubes),\n/* harmony export */ MaskPass: () => (/* binding */ MaskPass),\n/* harmony export */ MeshSurfaceSampler: () => (/* binding */ MeshSurfaceSampler),\n/* harmony export */ MeshoptDecoder: () => (/* binding */ MeshoptDecoder),\n/* harmony export */ MirrorShader: () => (/* binding */ MirrorShader),\n/* harmony export */ MorphAnimMesh: () => (/* binding */ MorphAnimMesh),\n/* harmony export */ MorphBlendMesh: () => (/* binding */ MorphBlendMesh),\n/* harmony export */ MotionController: () => (/* binding */ MotionController),\n/* harmony export */ MotionControllerConstants: () => (/* binding */ MotionControllerConstants),\n/* harmony export */ NRRDLoader: () => (/* binding */ NRRDLoader),\n/* harmony export */ NURBSCurve: () => (/* binding */ NURBSCurve),\n/* harmony export */ NURBSSurface: () => (/* binding */ NURBSSurface),\n/* harmony export */ NormalMapShader: () => (/* binding */ NormalMapShader),\n/* harmony export */ OBB: () => (/* binding */ OBB),\n/* harmony export */ OBJExporter: () => (/* binding */ OBJExporter),\n/* harmony export */ OBJLoader: () => (/* binding */ OBJLoader),\n/* harmony export */ Octree: () => (/* binding */ Octree),\n/* harmony export */ OculusHandModel: () => (/* binding */ OculusHandModel),\n/* harmony export */ OculusHandPointerModel: () => (/* binding */ OculusHandPointerModel),\n/* harmony export */ OrbitControls: () => (/* binding */ OrbitControls),\n/* harmony export */ OrbitControlsExp: () => (/* binding */ OrbitControlsExp),\n/* harmony export */ OutlineEffect: () => (/* binding */ OutlineEffect),\n/* harmony export */ OutlinePass: () => (/* binding */ OutlinePass),\n/* harmony export */ PCDLoader: () => (/* binding */ PCDLoader),\n/* harmony export */ PDBLoader: () => (/* binding */ PDBLoader),\n/* harmony export */ PLYExporter: () => (/* binding */ PLYExporter),\n/* harmony export */ PLYLoader: () => (/* binding */ PLYLoader),\n/* harmony export */ PRWMLoader: () => (/* binding */ PRWMLoader),\n/* harmony export */ PVRLoader: () => (/* binding */ PVRLoader),\n/* harmony export */ PackedPhongMaterial: () => (/* binding */ PackedPhongMaterial),\n/* harmony export */ ParallaxBarrierEffect: () => (/* binding */ ParallaxBarrierEffect),\n/* harmony export */ ParallaxShader: () => (/* binding */ ParallaxShader),\n/* harmony export */ ParametricGeometries: () => (/* binding */ ParametricGeometries),\n/* harmony export */ ParametricGeometry: () => (/* binding */ ParametricGeometry),\n/* harmony export */ Pass: () => (/* binding */ Pass),\n/* harmony export */ PeppersGhostEffect: () => (/* binding */ PeppersGhostEffect),\n/* harmony export */ PixelShader: () => (/* binding */ PixelShader),\n/* harmony export */ PointerLockControls: () => (/* binding */ PointerLockControls),\n/* harmony export */ PositionalAudioHelper: () => (/* binding */ PositionalAudioHelper),\n/* harmony export */ ProgressiveLightMap: () => (/* binding */ ProgressiveLightMap),\n/* harmony export */ Projector: () => (/* binding */ Projector),\n/* harmony export */ RGBELoader: () => (/* binding */ RGBELoader),\n/* harmony export */ RGBMLoader: () => (/* binding */ RGBMLoader),\n/* harmony export */ RGBShiftShader: () => (/* binding */ RGBShiftShader),\n/* harmony export */ RectAreaLightHelper: () => (/* binding */ RectAreaLightHelper),\n/* harmony export */ RectAreaLightUniformsLib: () => (/* binding */ RectAreaLightUniformsLib),\n/* harmony export */ Reflector: () => (/* binding */ Reflector),\n/* harmony export */ ReflectorForSSRPass: () => (/* binding */ ReflectorForSSRPass),\n/* harmony export */ ReflectorRTT: () => (/* binding */ ReflectorRTT),\n/* harmony export */ Refractor: () => (/* binding */ Refractor),\n/* harmony export */ RenderPass: () => (/* binding */ RenderPass),\n/* harmony export */ RenderPixelatedPass: () => (/* binding */ RenderPixelatedPass),\n/* harmony export */ RenderableFace: () => (/* binding */ RenderableFace),\n/* harmony export */ RenderableLine: () => (/* binding */ RenderableLine),\n/* harmony export */ RenderableObject: () => (/* binding */ RenderableObject),\n/* harmony export */ RenderableSprite: () => (/* binding */ RenderableSprite),\n/* harmony export */ RenderableVertex: () => (/* binding */ RenderableVertex),\n/* harmony export */ Rhino3dmLoader: () => (/* binding */ Rhino3dmLoader),\n/* harmony export */ RollerCoasterGeometry: () => (/* binding */ RollerCoasterGeometry),\n/* harmony export */ RollerCoasterLiftersGeometry: () => (/* binding */ RollerCoasterLiftersGeometry),\n/* harmony export */ RollerCoasterShadowGeometry: () => (/* binding */ RollerCoasterShadowGeometry),\n/* harmony export */ RoomEnvironment: () => (/* binding */ RoomEnvironment),\n/* harmony export */ RoughnessMipmapper: () => (/* binding */ RoughnessMipmapper),\n/* harmony export */ RoundedBoxGeometry: () => (/* binding */ RoundedBoxGeometry),\n/* harmony export */ SAOPass: () => (/* binding */ SAOPass),\n/* harmony export */ SAOShader: () => (/* binding */ SAOShader),\n/* harmony export */ SMAABlendShader: () => (/* binding */ SMAABlendShader),\n/* harmony export */ SMAAEdgesShader: () => (/* binding */ SMAAEdgesShader),\n/* harmony export */ SMAAPass: () => (/* binding */ SMAAPass),\n/* harmony export */ SMAAWeightsShader: () => (/* binding */ SMAAWeightsShader),\n/* harmony export */ SSAARenderPass: () => (/* binding */ SSAARenderPass),\n/* harmony export */ SSAOBlurShader: () => (/* binding */ SSAOBlurShader),\n/* harmony export */ SSAODepthShader: () => (/* binding */ SSAODepthShader),\n/* harmony export */ SSAOPass: () => (/* binding */ SSAOPass),\n/* harmony export */ SSAOShader: () => (/* binding */ SSAOShader),\n/* harmony export */ SSRBlurShader: () => (/* binding */ SSRBlurShader),\n/* harmony export */ SSRDepthShader: () => (/* binding */ SSRDepthShader),\n/* harmony export */ SSRPass: () => (/* binding */ SSRPass),\n/* harmony export */ SSRShader: () => (/* binding */ SSRShader),\n/* harmony export */ STATE: () => (/* binding */ STATE$1),\n/* harmony export */ STLExporter: () => (/* binding */ STLExporter),\n/* harmony export */ STLLoader: () => (/* binding */ STLLoader),\n/* harmony export */ SVGLoader: () => (/* binding */ SVGLoader),\n/* harmony export */ SVGObject: () => (/* binding */ SVGObject),\n/* harmony export */ SVGRenderer: () => (/* binding */ SVGRenderer),\n/* harmony export */ SavePass: () => (/* binding */ SavePass),\n/* harmony export */ SceneUtils: () => (/* binding */ SceneUtils),\n/* harmony export */ SelectionBox: () => (/* binding */ SelectionBox),\n/* harmony export */ SelectionHelper: () => (/* binding */ SelectionHelper),\n/* harmony export */ SepiaShader: () => (/* binding */ SepiaShader),\n/* harmony export */ ShaderPass: () => (/* binding */ ShaderPass),\n/* harmony export */ ShadowMapViewer: () => (/* binding */ ShadowMapViewer),\n/* harmony export */ ShadowMesh: () => (/* binding */ ShadowMesh),\n/* harmony export */ SimplexNoise: () => (/* binding */ SimplexNoise),\n/* harmony export */ SimplifyModifier: () => (/* binding */ SimplifyModifier),\n/* harmony export */ SkeletonUtils: () => (/* binding */ SkeletonUtils),\n/* harmony export */ Sky: () => (/* binding */ Sky),\n/* harmony export */ SkyGeometry: () => (/* binding */ SkyGeometry),\n/* harmony export */ SobelOperatorShader: () => (/* binding */ SobelOperatorShader),\n/* harmony export */ StereoEffect: () => (/* binding */ StereoEffect),\n/* harmony export */ SubsurfaceScatteringShader: () => (/* binding */ SubsurfaceScatteringShader),\n/* harmony export */ TAARenderPass: () => (/* binding */ TAARenderPass),\n/* harmony export */ TDSLoader: () => (/* binding */ TDSLoader),\n/* harmony export */ TGALoader: () => (/* binding */ TGALoader),\n/* harmony export */ TTFLoader: () => (/* binding */ TTFLoader),\n/* harmony export */ TeapotGeometry: () => (/* binding */ TeapotGeometry),\n/* harmony export */ TechnicolorShader: () => (/* binding */ TechnicolorShader),\n/* harmony export */ TessellateModifier: () => (/* binding */ TessellateModifier),\n/* harmony export */ TextBufferGeometry: () => (/* binding */ TextGeometry),\n/* harmony export */ TextGeometry: () => (/* binding */ TextGeometry),\n/* harmony export */ TexturePass: () => (/* binding */ TexturePass),\n/* harmony export */ ThreeMFLoader: () => (/* binding */ ThreeMFLoader),\n/* harmony export */ TiltLoader: () => (/* binding */ TiltLoader),\n/* harmony export */ Timer: () => (/* binding */ Timer),\n/* harmony export */ ToneMapShader: () => (/* binding */ ToneMapShader),\n/* harmony export */ ToonShader1: () => (/* binding */ ToonShader1),\n/* harmony export */ ToonShader2: () => (/* binding */ ToonShader2),\n/* harmony export */ ToonShaderDotted: () => (/* binding */ ToonShaderDotted),\n/* harmony export */ ToonShaderHatching: () => (/* binding */ ToonShaderHatching),\n/* harmony export */ TorusKnot: () => (/* binding */ TorusKnot),\n/* harmony export */ TrackballControls: () => (/* binding */ TrackballControls),\n/* harmony export */ TrackballControlsExp: () => (/* binding */ TrackballControlsExp),\n/* harmony export */ TransformControls: () => (/* binding */ TransformControls),\n/* harmony export */ TransformControlsGizmo: () => (/* binding */ TransformControlsGizmo),\n/* harmony export */ TransformControlsPlane: () => (/* binding */ TransformControlsPlane),\n/* harmony export */ TreesGeometry: () => (/* binding */ TreesGeometry),\n/* harmony export */ TrefoilKnot: () => (/* binding */ TrefoilKnot),\n/* harmony export */ TrefoilPolynomialKnot: () => (/* binding */ TrefoilPolynomialKnot),\n/* harmony export */ TriangleBlurShader: () => (/* binding */ TriangleBlurShader),\n/* harmony export */ TubePainter: () => (/* binding */ TubePainter),\n/* harmony export */ USDZExporter: () => (/* binding */ USDZExporter),\n/* harmony export */ UVsDebug: () => (/* binding */ UVsDebug),\n/* harmony export */ UnpackDepthRGBAShader: () => (/* binding */ UnpackDepthRGBAShader),\n/* harmony export */ UnrealBloomPass: () => (/* binding */ UnrealBloomPass),\n/* harmony export */ VOXData3DTexture: () => (/* binding */ VOXData3DTexture),\n/* harmony export */ VOXLoader: () => (/* binding */ VOXLoader),\n/* harmony export */ VOXMesh: () => (/* binding */ VOXMesh),\n/* harmony export */ VRButton: () => (/* binding */ VRButton),\n/* harmony export */ VRMLLoader: () => (/* binding */ VRMLLoader),\n/* harmony export */ VRMLoader: () => (/* binding */ VRMLoader),\n/* harmony export */ VTKLoader: () => (/* binding */ VTKLoader),\n/* harmony export */ VertexList: () => (/* binding */ VertexList),\n/* harmony export */ VertexNode: () => (/* binding */ VertexNode),\n/* harmony export */ VertexNormalsHelper: () => (/* binding */ VertexNormalsHelper),\n/* harmony export */ VertexTangentsHelper: () => (/* binding */ VertexTangentsHelper),\n/* harmony export */ VerticalBlurShader: () => (/* binding */ VerticalBlurShader),\n/* harmony export */ VerticalTiltShiftShader: () => (/* binding */ VerticalTiltShiftShader),\n/* harmony export */ VignetteShader: () => (/* binding */ VignetteShader),\n/* harmony export */ VivianiCurve: () => (/* binding */ VivianiCurve),\n/* harmony export */ Volume: () => (/* binding */ Volume),\n/* harmony export */ VolumeRenderShader1: () => (/* binding */ VolumeRenderShader1),\n/* harmony export */ VolumeSlice: () => (/* binding */ VolumeSlice),\n/* harmony export */ Water: () => (/* binding */ Water),\n/* harmony export */ Water2: () => (/* binding */ Water2),\n/* harmony export */ WaterPass: () => (/* binding */ WaterPass),\n/* harmony export */ WaterRefractionShader: () => (/* binding */ WaterRefractionShader),\n/* harmony export */ Wireframe: () => (/* binding */ Wireframe),\n/* harmony export */ WireframeGeometry2: () => (/* binding */ WireframeGeometry2),\n/* harmony export */ XLoader: () => (/* binding */ XLoader),\n/* harmony export */ XRControllerModelFactory: () => (/* binding */ XRControllerModelFactory),\n/* harmony export */ XREstimatedLight: () => (/* binding */ XREstimatedLight),\n/* harmony export */ XRHandMeshModel: () => (/* binding */ XRHandMeshModel),\n/* harmony export */ XRHandModelFactory: () => (/* binding */ XRHandModelFactory),\n/* harmony export */ XRHandPrimitiveModel: () => (/* binding */ XRHandPrimitiveModel),\n/* harmony export */ XYZLoader: () => (/* binding */ XYZLoader),\n/* harmony export */ calcBSplineDerivatives: () => (/* binding */ calcBSplineDerivatives),\n/* harmony export */ calcBSplinePoint: () => (/* binding */ calcBSplinePoint),\n/* harmony export */ calcBasisFunctionDerivatives: () => (/* binding */ calcBasisFunctionDerivatives),\n/* harmony export */ calcBasisFunctions: () => (/* binding */ calcBasisFunctions),\n/* harmony export */ calcKoverI: () => (/* binding */ calcKoverI),\n/* harmony export */ calcNURBSDerivatives: () => (/* binding */ calcNURBSDerivatives),\n/* harmony export */ calcRationalCurveDerivatives: () => (/* binding */ calcRationalCurveDerivatives),\n/* harmony export */ calcSurfacePoint: () => (/* binding */ calcSurfacePoint),\n/* harmony export */ computeMorphedAttributes: () => (/* binding */ computeMorphedAttributes),\n/* harmony export */ createText: () => (/* binding */ createText),\n/* harmony export */ edgeTable: () => (/* binding */ edgeTable),\n/* harmony export */ estimateBytesUsed: () => (/* binding */ estimateBytesUsed),\n/* harmony export */ fetchProfile: () => (/* binding */ fetchProfile),\n/* harmony export */ fetchProfilesList: () => (/* binding */ fetchProfilesList),\n/* harmony export */ findSpan: () => (/* binding */ findSpan),\n/* harmony export */ getErrorMessage: () => (/* binding */ getErrorMessage),\n/* harmony export */ getUniforms: () => (/* binding */ getUniforms),\n/* harmony export */ getWebGL2ErrorMessage: () => (/* binding */ getWebGL2ErrorMessage),\n/* harmony export */ getWebGLErrorMessage: () => (/* binding */ getWebGLErrorMessage),\n/* harmony export */ initSplineTexture: () => (/* binding */ initSplineTexture),\n/* harmony export */ interleaveAttributes: () => (/* binding */ interleaveAttributes),\n/* harmony export */ isWebGL2Available: () => (/* binding */ isWebGL2Available),\n/* harmony export */ isWebGLAvailable: () => (/* binding */ isWebGLAvailable),\n/* harmony export */ mergeBufferAttributes: () => (/* binding */ mergeBufferAttributes),\n/* harmony export */ mergeBufferGeometries: () => (/* binding */ mergeBufferGeometries),\n/* harmony export */ mergeVertices: () => (/* binding */ mergeVertices),\n/* harmony export */ modifyShader: () => (/* binding */ modifyShader),\n/* harmony export */ toCreasedNormals: () => (/* binding */ toCreasedNormals),\n/* harmony export */ toTrianglesDrawMode: () => (/* binding */ toTrianglesDrawMode),\n/* harmony export */ triTable: () => (/* binding */ triTable),\n/* harmony export */ updateSplineTexture: () => (/* binding */ updateSplineTexture)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var potpack__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! potpack */ \"./node_modules/potpack/index.mjs\");\n/* harmony import */ var fflate__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(/*! fflate */ \"./node_modules/fflate/esm/browser.js\");\n/* harmony import */ var mmd_parser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! mmd-parser */ \"./node_modules/mmd-parser/build/mmdparser.js\");\n/* harmony import */ var lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash/isEmpty */ \"./node_modules/lodash/isEmpty.js\");\n/* harmony import */ var lodash_map__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lodash/map */ \"./node_modules/lodash/map.js\");\n/* harmony import */ var lodash_forEach__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! lodash/forEach */ \"./node_modules/lodash/forEach.js\");\n/* harmony import */ var lodash_values__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! lodash/values */ \"./node_modules/lodash/values.js\");\n/* harmony import */ var lodash_has__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! lodash/has */ \"./node_modules/lodash/has.js\");\n/* harmony import */ var lodash_clone__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! lodash/clone */ \"./node_modules/lodash/clone.js\");\n/* harmony import */ var lodash_drop__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! lodash/drop */ \"./node_modules/lodash/drop.js\");\n/* harmony import */ var lodash_isString__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! lodash/isString */ \"./node_modules/lodash/isString.js\");\n/* harmony import */ var lodash_isRegExp__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! lodash/isRegExp */ \"./node_modules/lodash/isRegExp.js\");\n/* harmony import */ var lodash_pickBy__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! lodash/pickBy */ \"./node_modules/lodash/pickBy.js\");\n/* harmony import */ var lodash_assign__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! lodash/assign */ \"./node_modules/lodash/assign.js\");\n/* harmony import */ var lodash_some__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! lodash/some */ \"./node_modules/lodash/some.js\");\n/* harmony import */ var lodash_every__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! lodash/every */ \"./node_modules/lodash/every.js\");\n/* harmony import */ var lodash_includes__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! lodash/includes */ \"./node_modules/lodash/includes.js\");\n/* harmony import */ var lodash_flatten__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! lodash/flatten */ \"./node_modules/lodash/flatten.js\");\n/* harmony import */ var lodash_uniq__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! lodash/uniq */ \"./node_modules/lodash/uniq.js\");\n/* harmony import */ var lodash_isUndefined__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! lodash/isUndefined */ \"./node_modules/lodash/isUndefined.js\");\n/* harmony import */ var regexp_to_ast__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! regexp-to-ast */ \"./node_modules/regexp-to-ast/lib/regexp-to-ast.js\");\n/* harmony import */ var lodash_first__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! lodash/first */ \"./node_modules/lodash/first.js\");\n/* harmony import */ var lodash_compact__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! lodash/compact */ \"./node_modules/lodash/compact.js\");\n/* harmony import */ var lodash_isArray__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! lodash/isArray */ \"./node_modules/lodash/isArray.js\");\n/* harmony import */ var lodash_reject__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! lodash/reject */ \"./node_modules/lodash/reject.js\");\n/* harmony import */ var lodash_difference__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! lodash/difference */ \"./node_modules/lodash/difference.js\");\n/* harmony import */ var lodash_indexOf__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! lodash/indexOf */ \"./node_modules/lodash/indexOf.js\");\n/* harmony import */ var lodash_isFunction__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! lodash/isFunction */ \"./node_modules/lodash/isFunction.js\");\n/* harmony import */ var lodash_find__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! lodash/find */ \"./node_modules/lodash/find.js\");\n/* harmony import */ var lodash_keys__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! lodash/keys */ \"./node_modules/lodash/keys.js\");\n/* harmony import */ var lodash_filter__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! lodash/filter */ \"./node_modules/lodash/filter.js\");\n/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! lodash/defaults */ \"./node_modules/lodash/defaults.js\");\n/* harmony import */ var lodash_reduce__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! lodash/reduce */ \"./node_modules/lodash/reduce.js\");\n/* harmony import */ var lodash_noop__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! lodash/noop */ \"./node_modules/lodash/noop.js\");\n/* harmony import */ var lodash_last__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! lodash/last */ \"./node_modules/lodash/last.js\");\n/* harmony import */ var lodash_identity__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! lodash/identity */ \"./node_modules/lodash/identity.js\");\n/* harmony import */ var lodash_groupBy__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! lodash/groupBy */ \"./node_modules/lodash/groupBy.js\");\n/* harmony import */ var lodash_flatMap__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! lodash/flatMap */ \"./node_modules/lodash/flatMap.js\");\n/* harmony import */ var lodash_dropRight__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! lodash/dropRight */ \"./node_modules/lodash/dropRight.js\");\n/* harmony import */ var lodash_isObject__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! lodash/isObject */ \"./node_modules/lodash/isObject.js\");\n/* harmony import */ var lodash_upperFirst__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(/*! lodash/upperFirst */ \"./node_modules/lodash/upperFirst.js\");\n/* harmony import */ var ktx_parse__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(/*! ktx-parse */ \"./node_modules/ktx-parse/dist/ktx-parse.modern.js\");\n/* harmony import */ var zstddec__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(/*! zstddec */ \"./node_modules/zstddec/dist/zstddec.modern.js\");\n/* harmony import */ var opentype_js__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! opentype.js */ \"./node_modules/opentype.js/dist/opentype.module.js\");\nvar __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => {\n __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\n return value;\n};\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst _normalData = [\n [-0.525731, 0, 0.850651],\n [-0.442863, 0.238856, 0.864188],\n [-0.295242, 0, 0.955423],\n [-0.309017, 0.5, 0.809017],\n [-0.16246, 0.262866, 0.951056],\n [0, 0, 1],\n [0, 0.850651, 0.525731],\n [-0.147621, 0.716567, 0.681718],\n [0.147621, 0.716567, 0.681718],\n [0, 0.525731, 0.850651],\n [0.309017, 0.5, 0.809017],\n [0.525731, 0, 0.850651],\n [0.295242, 0, 0.955423],\n [0.442863, 0.238856, 0.864188],\n [0.16246, 0.262866, 0.951056],\n [-0.681718, 0.147621, 0.716567],\n [-0.809017, 0.309017, 0.5],\n [-0.587785, 0.425325, 0.688191],\n [-0.850651, 0.525731, 0],\n [-0.864188, 0.442863, 0.238856],\n [-0.716567, 0.681718, 0.147621],\n [-0.688191, 0.587785, 0.425325],\n [-0.5, 0.809017, 0.309017],\n [-0.238856, 0.864188, 0.442863],\n [-0.425325, 0.688191, 0.587785],\n [-0.716567, 0.681718, -0.147621],\n [-0.5, 0.809017, -0.309017],\n [-0.525731, 0.850651, 0],\n [0, 0.850651, -0.525731],\n [-0.238856, 0.864188, -0.442863],\n [0, 0.955423, -0.295242],\n [-0.262866, 0.951056, -0.16246],\n [0, 1, 0],\n [0, 0.955423, 0.295242],\n [-0.262866, 0.951056, 0.16246],\n [0.238856, 0.864188, 0.442863],\n [0.262866, 0.951056, 0.16246],\n [0.5, 0.809017, 0.309017],\n [0.238856, 0.864188, -0.442863],\n [0.262866, 0.951056, -0.16246],\n [0.5, 0.809017, -0.309017],\n [0.850651, 0.525731, 0],\n [0.716567, 0.681718, 0.147621],\n [0.716567, 0.681718, -0.147621],\n [0.525731, 0.850651, 0],\n [0.425325, 0.688191, 0.587785],\n [0.864188, 0.442863, 0.238856],\n [0.688191, 0.587785, 0.425325],\n [0.809017, 0.309017, 0.5],\n [0.681718, 0.147621, 0.716567],\n [0.587785, 0.425325, 0.688191],\n [0.955423, 0.295242, 0],\n [1, 0, 0],\n [0.951056, 0.16246, 0.262866],\n [0.850651, -0.525731, 0],\n [0.955423, -0.295242, 0],\n [0.864188, -0.442863, 0.238856],\n [0.951056, -0.16246, 0.262866],\n [0.809017, -0.309017, 0.5],\n [0.681718, -0.147621, 0.716567],\n [0.850651, 0, 0.525731],\n [0.864188, 0.442863, -0.238856],\n [0.809017, 0.309017, -0.5],\n [0.951056, 0.16246, -0.262866],\n [0.525731, 0, -0.850651],\n [0.681718, 0.147621, -0.716567],\n [0.681718, -0.147621, -0.716567],\n [0.850651, 0, -0.525731],\n [0.809017, -0.309017, -0.5],\n [0.864188, -0.442863, -0.238856],\n [0.951056, -0.16246, -0.262866],\n [0.147621, 0.716567, -0.681718],\n [0.309017, 0.5, -0.809017],\n [0.425325, 0.688191, -0.587785],\n [0.442863, 0.238856, -0.864188],\n [0.587785, 0.425325, -0.688191],\n [0.688191, 0.587785, -0.425325],\n [-0.147621, 0.716567, -0.681718],\n [-0.309017, 0.5, -0.809017],\n [0, 0.525731, -0.850651],\n [-0.525731, 0, -0.850651],\n [-0.442863, 0.238856, -0.864188],\n [-0.295242, 0, -0.955423],\n [-0.16246, 0.262866, -0.951056],\n [0, 0, -1],\n [0.295242, 0, -0.955423],\n [0.16246, 0.262866, -0.951056],\n [-0.442863, -0.238856, -0.864188],\n [-0.309017, -0.5, -0.809017],\n [-0.16246, -0.262866, -0.951056],\n [0, -0.850651, -0.525731],\n [-0.147621, -0.716567, -0.681718],\n [0.147621, -0.716567, -0.681718],\n [0, -0.525731, -0.850651],\n [0.309017, -0.5, -0.809017],\n [0.442863, -0.238856, -0.864188],\n [0.16246, -0.262866, -0.951056],\n [0.238856, -0.864188, -0.442863],\n [0.5, -0.809017, -0.309017],\n [0.425325, -0.688191, -0.587785],\n [0.716567, -0.681718, -0.147621],\n [0.688191, -0.587785, -0.425325],\n [0.587785, -0.425325, -0.688191],\n [0, -0.955423, -0.295242],\n [0, -1, 0],\n [0.262866, -0.951056, -0.16246],\n [0, -0.850651, 0.525731],\n [0, -0.955423, 0.295242],\n [0.238856, -0.864188, 0.442863],\n [0.262866, -0.951056, 0.16246],\n [0.5, -0.809017, 0.309017],\n [0.716567, -0.681718, 0.147621],\n [0.525731, -0.850651, 0],\n [-0.238856, -0.864188, -0.442863],\n [-0.5, -0.809017, -0.309017],\n [-0.262866, -0.951056, -0.16246],\n [-0.850651, -0.525731, 0],\n [-0.716567, -0.681718, -0.147621],\n [-0.716567, -0.681718, 0.147621],\n [-0.525731, -0.850651, 0],\n [-0.5, -0.809017, 0.309017],\n [-0.238856, -0.864188, 0.442863],\n [-0.262866, -0.951056, 0.16246],\n [-0.864188, -0.442863, 0.238856],\n [-0.809017, -0.309017, 0.5],\n [-0.688191, -0.587785, 0.425325],\n [-0.681718, -0.147621, 0.716567],\n [-0.442863, -0.238856, 0.864188],\n [-0.587785, -0.425325, 0.688191],\n [-0.309017, -0.5, 0.809017],\n [-0.147621, -0.716567, 0.681718],\n [-0.425325, -0.688191, 0.587785],\n [-0.16246, -0.262866, 0.951056],\n [0.442863, -0.238856, 0.864188],\n [0.16246, -0.262866, 0.951056],\n [0.309017, -0.5, 0.809017],\n [0.147621, -0.716567, 0.681718],\n [0, -0.525731, 0.850651],\n [0.425325, -0.688191, 0.587785],\n [0.587785, -0.425325, 0.688191],\n [0.688191, -0.587785, 0.425325],\n [-0.955423, 0.295242, 0],\n [-0.951056, 0.16246, 0.262866],\n [-1, 0, 0],\n [-0.850651, 0, 0.525731],\n [-0.955423, -0.295242, 0],\n [-0.951056, -0.16246, 0.262866],\n [-0.864188, 0.442863, -0.238856],\n [-0.951056, 0.16246, -0.262866],\n [-0.809017, 0.309017, -0.5],\n [-0.864188, -0.442863, -0.238856],\n [-0.951056, -0.16246, -0.262866],\n [-0.809017, -0.309017, -0.5],\n [-0.681718, 0.147621, -0.716567],\n [-0.681718, -0.147621, -0.716567],\n [-0.850651, 0, -0.525731],\n [-0.688191, 0.587785, -0.425325],\n [-0.587785, 0.425325, -0.688191],\n [-0.425325, 0.688191, -0.587785],\n [-0.425325, -0.688191, -0.587785],\n [-0.587785, -0.425325, -0.688191],\n [-0.688191, -0.587785, -0.425325]\n];\nclass MD2Loader extends three__WEBPACK_IMPORTED_MODULE_42__.Loader {\n constructor(manager) {\n super(manager);\n }\n load(url, onLoad, onProgress, onError) {\n const scope = this;\n const loader = new three__WEBPACK_IMPORTED_MODULE_42__.FileLoader(scope.manager);\n loader.setPath(scope.path);\n loader.setResponseType(\"arraybuffer\");\n loader.setRequestHeader(scope.requestHeader);\n loader.setWithCredentials(scope.withCredentials);\n loader.load(\n url,\n function(buffer) {\n try {\n onLoad(scope.parse(buffer));\n } catch (e) {\n if (onError) {\n onError(e);\n } else {\n console.error(e);\n }\n scope.manager.itemError(url);\n }\n },\n onProgress,\n onError\n );\n }\n parse(buffer) {\n const data = new DataView(buffer);\n const header = {};\n const headerNames = [\n \"ident\",\n \"version\",\n \"skinwidth\",\n \"skinheight\",\n \"framesize\",\n \"num_skins\",\n \"num_vertices\",\n \"num_st\",\n \"num_tris\",\n \"num_glcmds\",\n \"num_frames\",\n \"offset_skins\",\n \"offset_st\",\n \"offset_tris\",\n \"offset_frames\",\n \"offset_glcmds\",\n \"offset_end\"\n ];\n for (let i2 = 0; i2 < headerNames.length; i2++) {\n header[headerNames[i2]] = data.getInt32(i2 * 4, true);\n }\n if (header.ident !== 844121161 || header.version !== 8) {\n console.error(\"Not a valid MD2 file\");\n return;\n }\n if (header.offset_end !== data.byteLength) {\n console.error(\"Corrupted MD2 file\");\n return;\n }\n const geometry2 = new three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry();\n const uvsTemp = [];\n let offset = header.offset_st;\n for (let i2 = 0, l = header.num_st; i2 < l; i2++) {\n const u = data.getInt16(offset + 0, true);\n const v = data.getInt16(offset + 2, true);\n uvsTemp.push(u / header.skinwidth, 1 - v / header.skinheight);\n offset += 4;\n }\n offset = header.offset_tris;\n const vertexIndices = [];\n const uvIndices = [];\n for (let i2 = 0, l = header.num_tris; i2 < l; i2++) {\n vertexIndices.push(\n data.getUint16(offset + 0, true),\n data.getUint16(offset + 2, true),\n data.getUint16(offset + 4, true)\n );\n uvIndices.push(\n data.getUint16(offset + 6, true),\n data.getUint16(offset + 8, true),\n data.getUint16(offset + 10, true)\n );\n offset += 12;\n }\n const translation = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const scale = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const string = [];\n const frames = [];\n offset = header.offset_frames;\n for (let i2 = 0, l = header.num_frames; i2 < l; i2++) {\n scale.set(data.getFloat32(offset + 0, true), data.getFloat32(offset + 4, true), data.getFloat32(offset + 8, true));\n translation.set(\n data.getFloat32(offset + 12, true),\n data.getFloat32(offset + 16, true),\n data.getFloat32(offset + 20, true)\n );\n offset += 24;\n for (let j = 0; j < 16; j++) {\n const character = data.getUint8(offset + j, true);\n if (character === 0)\n break;\n string[j] = character;\n }\n const frame = {\n name: String.fromCharCode.apply(null, string),\n vertices: [],\n normals: []\n };\n offset += 16;\n for (let j = 0; j < header.num_vertices; j++) {\n let x = data.getUint8(offset++, true);\n let y = data.getUint8(offset++, true);\n let z = data.getUint8(offset++, true);\n const n = _normalData[data.getUint8(offset++, true)];\n x = x * scale.x + translation.x;\n y = y * scale.y + translation.y;\n z = z * scale.z + translation.z;\n frame.vertices.push(x, z, y);\n frame.normals.push(n[0], n[2], n[1]);\n }\n frames.push(frame);\n }\n const positions = [];\n const normals = [];\n const uvs = [];\n const verticesTemp = frames[0].vertices;\n const normalsTemp = frames[0].normals;\n for (let i2 = 0, l = vertexIndices.length; i2 < l; i2++) {\n const vertexIndex = vertexIndices[i2];\n let stride = vertexIndex * 3;\n const x = verticesTemp[stride];\n const y = verticesTemp[stride + 1];\n const z = verticesTemp[stride + 2];\n positions.push(x, y, z);\n const nx = normalsTemp[stride];\n const ny = normalsTemp[stride + 1];\n const nz = normalsTemp[stride + 2];\n normals.push(nx, ny, nz);\n const uvIndex = uvIndices[i2];\n stride = uvIndex * 2;\n const u = uvsTemp[stride];\n const v = uvsTemp[stride + 1];\n uvs.push(u, v);\n }\n geometry2.setAttribute(\"position\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(positions, 3));\n geometry2.setAttribute(\"normal\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(normals, 3));\n geometry2.setAttribute(\"uv\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(uvs, 2));\n const morphPositions = [];\n const morphNormals = [];\n for (let i2 = 0, l = frames.length; i2 < l; i2++) {\n const frame = frames[i2];\n const attributeName = frame.name;\n if (frame.vertices.length > 0) {\n const positions2 = [];\n for (let j = 0, jl = vertexIndices.length; j < jl; j++) {\n const vertexIndex = vertexIndices[j];\n const stride = vertexIndex * 3;\n const x = frame.vertices[stride];\n const y = frame.vertices[stride + 1];\n const z = frame.vertices[stride + 2];\n positions2.push(x, y, z);\n }\n const positionAttribute = new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(positions2, 3);\n positionAttribute.name = attributeName;\n morphPositions.push(positionAttribute);\n }\n if (frame.normals.length > 0) {\n const normals2 = [];\n for (let j = 0, jl = vertexIndices.length; j < jl; j++) {\n const vertexIndex = vertexIndices[j];\n const stride = vertexIndex * 3;\n const nx = frame.normals[stride];\n const ny = frame.normals[stride + 1];\n const nz = frame.normals[stride + 2];\n normals2.push(nx, ny, nz);\n }\n const normalAttribute = new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(normals2, 3);\n normalAttribute.name = attributeName;\n morphNormals.push(normalAttribute);\n }\n }\n geometry2.morphAttributes.position = morphPositions;\n geometry2.morphAttributes.normal = morphNormals;\n geometry2.morphTargetsRelative = false;\n geometry2.animations = three__WEBPACK_IMPORTED_MODULE_42__.AnimationClip.CreateClipsFromMorphTargetSequences(frames, 10);\n return geometry2;\n }\n}\nclass MorphBlendMesh extends three__WEBPACK_IMPORTED_MODULE_42__.Mesh {\n constructor(geometry2, material2) {\n super(geometry2, material2);\n this.animationsMap = {};\n this.animationsList = [];\n const numFrames = Object.keys(this.morphTargetDictionary).length;\n const name = \"__default\";\n const startFrame = 0;\n const endFrame = numFrames - 1;\n const fps = numFrames / 1;\n this.createAnimation(name, startFrame, endFrame, fps);\n this.setAnimationWeight(name, 1);\n }\n createAnimation(name, start, end, fps) {\n const animation = {\n start,\n end,\n length: end - start + 1,\n fps,\n duration: (end - start) / fps,\n lastFrame: 0,\n currentFrame: 0,\n active: false,\n time: 0,\n direction: 1,\n weight: 1,\n directionBackwards: false,\n mirroredLoop: false\n };\n this.animationsMap[name] = animation;\n this.animationsList.push(animation);\n }\n autoCreateAnimations(fps) {\n const pattern = /([a-z]+)_?(\\d+)/i;\n let firstAnimation;\n const frameRanges = {};\n let i2 = 0;\n for (const key in this.morphTargetDictionary) {\n const chunks = key.match(pattern);\n if (chunks && chunks.length > 1) {\n const name = chunks[1];\n if (!frameRanges[name])\n frameRanges[name] = { start: Infinity, end: -Infinity };\n const range = frameRanges[name];\n if (i2 < range.start)\n range.start = i2;\n if (i2 > range.end)\n range.end = i2;\n if (!firstAnimation)\n firstAnimation = name;\n }\n i2++;\n }\n for (const name in frameRanges) {\n const range = frameRanges[name];\n this.createAnimation(name, range.start, range.end, fps);\n }\n this.firstAnimation = firstAnimation;\n }\n setAnimationDirectionForward(name) {\n const animation = this.animationsMap[name];\n if (animation) {\n animation.direction = 1;\n animation.directionBackwards = false;\n }\n }\n setAnimationDirectionBackward(name) {\n const animation = this.animationsMap[name];\n if (animation) {\n animation.direction = -1;\n animation.directionBackwards = true;\n }\n }\n setAnimationFPS(name, fps) {\n const animation = this.animationsMap[name];\n if (animation) {\n animation.fps = fps;\n animation.duration = (animation.end - animation.start) / animation.fps;\n }\n }\n setAnimationDuration(name, duration) {\n const animation = this.animationsMap[name];\n if (animation) {\n animation.duration = duration;\n animation.fps = (animation.end - animation.start) / animation.duration;\n }\n }\n setAnimationWeight(name, weight) {\n const animation = this.animationsMap[name];\n if (animation) {\n animation.weight = weight;\n }\n }\n setAnimationTime(name, time) {\n const animation = this.animationsMap[name];\n if (animation) {\n animation.time = time;\n }\n }\n getAnimationTime(name) {\n let time = 0;\n const animation = this.animationsMap[name];\n if (animation) {\n time = animation.time;\n }\n return time;\n }\n getAnimationDuration(name) {\n let duration = -1;\n const animation = this.animationsMap[name];\n if (animation) {\n duration = animation.duration;\n }\n return duration;\n }\n playAnimation(name) {\n const animation = this.animationsMap[name];\n if (animation) {\n animation.time = 0;\n animation.active = true;\n } else {\n console.warn(\"THREE.MorphBlendMesh: animation[\" + name + \"] undefined in .playAnimation()\");\n }\n }\n stopAnimation(name) {\n const animation = this.animationsMap[name];\n if (animation) {\n animation.active = false;\n }\n }\n update(delta) {\n for (let i2 = 0, il = this.animationsList.length; i2 < il; i2++) {\n const animation = this.animationsList[i2];\n if (!animation.active)\n continue;\n const frameTime = animation.duration / animation.length;\n animation.time += animation.direction * delta;\n if (animation.mirroredLoop) {\n if (animation.time > animation.duration || animation.time < 0) {\n animation.direction *= -1;\n if (animation.time > animation.duration) {\n animation.time = animation.duration;\n animation.directionBackwards = true;\n }\n if (animation.time < 0) {\n animation.time = 0;\n animation.directionBackwards = false;\n }\n }\n } else {\n animation.time = animation.time % animation.duration;\n if (animation.time < 0)\n animation.time += animation.duration;\n }\n const keyframe = animation.start + three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.clamp(Math.floor(animation.time / frameTime), 0, animation.length - 1);\n const weight = animation.weight;\n if (keyframe !== animation.currentFrame) {\n this.morphTargetInfluences[animation.lastFrame] = 0;\n this.morphTargetInfluences[animation.currentFrame] = 1 * weight;\n this.morphTargetInfluences[keyframe] = 0;\n animation.lastFrame = animation.currentFrame;\n animation.currentFrame = keyframe;\n }\n let mix = animation.time % frameTime / frameTime;\n if (animation.directionBackwards)\n mix = 1 - mix;\n if (animation.currentFrame !== animation.lastFrame) {\n this.morphTargetInfluences[animation.currentFrame] = mix * weight;\n this.morphTargetInfluences[animation.lastFrame] = (1 - mix) * weight;\n } else {\n this.morphTargetInfluences[animation.currentFrame] = weight;\n }\n }\n }\n}\nclass MD2CharacterComplex {\n constructor() {\n this.scale = 1;\n this.animationFPS = 6;\n this.transitionFrames = 15;\n this.maxSpeed = 275;\n this.maxReverseSpeed = -275;\n this.frontAcceleration = 600;\n this.backAcceleration = 600;\n this.frontDecceleration = 600;\n this.angularSpeed = 2.5;\n this.root = new three__WEBPACK_IMPORTED_MODULE_42__.Object3D();\n this.meshBody = null;\n this.meshWeapon = null;\n this.controls = null;\n this.skinsBody = [];\n this.skinsWeapon = [];\n this.weapons = [];\n this.currentSkin = void 0;\n this.onLoadComplete = function() {\n };\n this.meshes = [];\n this.animations = {};\n this.loadCounter = 0;\n this.speed = 0;\n this.bodyOrientation = 0;\n this.walkSpeed = this.maxSpeed;\n this.crouchSpeed = this.maxSpeed * 0.5;\n this.activeAnimation = null;\n this.oldAnimation = null;\n }\n enableShadows(enable) {\n for (let i2 = 0; i2 < this.meshes.length; i2++) {\n this.meshes[i2].castShadow = enable;\n this.meshes[i2].receiveShadow = enable;\n }\n }\n setVisible(enable) {\n for (let i2 = 0; i2 < this.meshes.length; i2++) {\n this.meshes[i2].visible = enable;\n this.meshes[i2].visible = enable;\n }\n }\n shareParts(original) {\n this.animations = original.animations;\n this.walkSpeed = original.walkSpeed;\n this.crouchSpeed = original.crouchSpeed;\n this.skinsBody = original.skinsBody;\n this.skinsWeapon = original.skinsWeapon;\n const mesh = this._createPart(original.meshBody.geometry, this.skinsBody[0]);\n mesh.scale.set(this.scale, this.scale, this.scale);\n this.root.position.y = original.root.position.y;\n this.root.add(mesh);\n this.meshBody = mesh;\n this.meshes.push(mesh);\n for (let i2 = 0; i2 < original.weapons.length; i2++) {\n const meshWeapon = this._createPart(original.weapons[i2].geometry, this.skinsWeapon[i2]);\n meshWeapon.scale.set(this.scale, this.scale, this.scale);\n meshWeapon.visible = false;\n meshWeapon.name = original.weapons[i2].name;\n this.root.add(meshWeapon);\n this.weapons[i2] = meshWeapon;\n this.meshWeapon = meshWeapon;\n this.meshes.push(meshWeapon);\n }\n }\n loadParts(config) {\n const scope = this;\n function loadTextures(baseUrl, textureUrls) {\n const textureLoader = new three__WEBPACK_IMPORTED_MODULE_42__.TextureLoader();\n const textures = [];\n for (let i2 = 0; i2 < textureUrls.length; i2++) {\n textures[i2] = textureLoader.load(baseUrl + textureUrls[i2], checkLoadingComplete);\n textures[i2].mapping = three__WEBPACK_IMPORTED_MODULE_42__.UVMapping;\n textures[i2].name = textureUrls[i2];\n if (\"colorSpace\" in textures[i2])\n textures[i2].colorSpace = \"srgb\";\n else\n textures[i2].encoding = 3001;\n }\n return textures;\n }\n function checkLoadingComplete() {\n scope.loadCounter -= 1;\n if (scope.loadCounter === 0)\n scope.onLoadComplete();\n }\n this.animations = config.animations;\n this.walkSpeed = config.walkSpeed;\n this.crouchSpeed = config.crouchSpeed;\n this.loadCounter = config.weapons.length * 2 + config.skins.length + 1;\n const weaponsTextures = [];\n for (let i2 = 0; i2 < config.weapons.length; i2++)\n weaponsTextures[i2] = config.weapons[i2][1];\n this.skinsBody = loadTextures(config.baseUrl + \"skins/\", config.skins);\n this.skinsWeapon = loadTextures(config.baseUrl + \"skins/\", weaponsTextures);\n const loader = new MD2Loader();\n loader.load(config.baseUrl + config.body, function(geo) {\n const boundingBox = new three__WEBPACK_IMPORTED_MODULE_42__.Box3();\n boundingBox.setFromBufferAttribute(geo.attributes.position);\n scope.root.position.y = -scope.scale * boundingBox.min.y;\n const mesh = scope._createPart(geo, scope.skinsBody[0]);\n mesh.scale.set(scope.scale, scope.scale, scope.scale);\n scope.root.add(mesh);\n scope.meshBody = mesh;\n scope.meshes.push(mesh);\n checkLoadingComplete();\n });\n const generateCallback = function(index, name) {\n return function(geo) {\n const mesh = scope._createPart(geo, scope.skinsWeapon[index]);\n mesh.scale.set(scope.scale, scope.scale, scope.scale);\n mesh.visible = false;\n mesh.name = name;\n scope.root.add(mesh);\n scope.weapons[index] = mesh;\n scope.meshWeapon = mesh;\n scope.meshes.push(mesh);\n checkLoadingComplete();\n };\n };\n for (let i2 = 0; i2 < config.weapons.length; i2++) {\n loader.load(config.baseUrl + config.weapons[i2][0], generateCallback(i2, config.weapons[i2][0]));\n }\n }\n setPlaybackRate(rate) {\n if (this.meshBody)\n this.meshBody.duration = this.meshBody.baseDuration / rate;\n if (this.meshWeapon)\n this.meshWeapon.duration = this.meshWeapon.baseDuration / rate;\n }\n setWireframe(wireframeEnabled) {\n if (wireframeEnabled) {\n if (this.meshBody)\n this.meshBody.material = this.meshBody.materialWireframe;\n if (this.meshWeapon)\n this.meshWeapon.material = this.meshWeapon.materialWireframe;\n } else {\n if (this.meshBody)\n this.meshBody.material = this.meshBody.materialTexture;\n if (this.meshWeapon)\n this.meshWeapon.material = this.meshWeapon.materialTexture;\n }\n }\n setSkin(index) {\n if (this.meshBody && this.meshBody.material.wireframe === false) {\n this.meshBody.material.map = this.skinsBody[index];\n this.currentSkin = index;\n }\n }\n setWeapon(index) {\n for (let i2 = 0; i2 < this.weapons.length; i2++)\n this.weapons[i2].visible = false;\n const activeWeapon = this.weapons[index];\n if (activeWeapon) {\n activeWeapon.visible = true;\n this.meshWeapon = activeWeapon;\n if (this.activeAnimation) {\n activeWeapon.playAnimation(this.activeAnimation);\n this.meshWeapon.setAnimationTime(this.activeAnimation, this.meshBody.getAnimationTime(this.activeAnimation));\n }\n }\n }\n setAnimation(animationName) {\n if (animationName === this.activeAnimation || !animationName)\n return;\n if (this.meshBody) {\n this.meshBody.setAnimationWeight(animationName, 0);\n this.meshBody.playAnimation(animationName);\n this.oldAnimation = this.activeAnimation;\n this.activeAnimation = animationName;\n this.blendCounter = this.transitionFrames;\n }\n if (this.meshWeapon) {\n this.meshWeapon.setAnimationWeight(animationName, 0);\n this.meshWeapon.playAnimation(animationName);\n }\n }\n update(delta) {\n if (this.controls)\n this.updateMovementModel(delta);\n if (this.animations) {\n this.updateBehaviors();\n this.updateAnimations(delta);\n }\n }\n updateAnimations(delta) {\n let mix = 1;\n if (this.blendCounter > 0) {\n mix = (this.transitionFrames - this.blendCounter) / this.transitionFrames;\n this.blendCounter -= 1;\n }\n if (this.meshBody) {\n this.meshBody.update(delta);\n this.meshBody.setAnimationWeight(this.activeAnimation, mix);\n this.meshBody.setAnimationWeight(this.oldAnimation, 1 - mix);\n }\n if (this.meshWeapon) {\n this.meshWeapon.update(delta);\n this.meshWeapon.setAnimationWeight(this.activeAnimation, mix);\n this.meshWeapon.setAnimationWeight(this.oldAnimation, 1 - mix);\n }\n }\n updateBehaviors() {\n const controls = this.controls;\n const animations = this.animations;\n let moveAnimation, idleAnimation;\n if (controls.crouch) {\n moveAnimation = animations[\"crouchMove\"];\n idleAnimation = animations[\"crouchIdle\"];\n } else {\n moveAnimation = animations[\"move\"];\n idleAnimation = animations[\"idle\"];\n }\n if (controls.jump) {\n moveAnimation = animations[\"jump\"];\n idleAnimation = animations[\"jump\"];\n }\n if (controls.attack) {\n if (controls.crouch) {\n moveAnimation = animations[\"crouchAttack\"];\n idleAnimation = animations[\"crouchAttack\"];\n } else {\n moveAnimation = animations[\"attack\"];\n idleAnimation = animations[\"attack\"];\n }\n }\n if (controls.moveForward || controls.moveBackward || controls.moveLeft || controls.moveRight) {\n if (this.activeAnimation !== moveAnimation) {\n this.setAnimation(moveAnimation);\n }\n }\n if (Math.abs(this.speed) < 0.2 * this.maxSpeed && !(controls.moveLeft || controls.moveRight || controls.moveForward || controls.moveBackward)) {\n if (this.activeAnimation !== idleAnimation) {\n this.setAnimation(idleAnimation);\n }\n }\n if (controls.moveForward) {\n if (this.meshBody) {\n this.meshBody.setAnimationDirectionForward(this.activeAnimation);\n this.meshBody.setAnimationDirectionForward(this.oldAnimation);\n }\n if (this.meshWeapon) {\n this.meshWeapon.setAnimationDirectionForward(this.activeAnimation);\n this.meshWeapon.setAnimationDirectionForward(this.oldAnimation);\n }\n }\n if (controls.moveBackward) {\n if (this.meshBody) {\n this.meshBody.setAnimationDirectionBackward(this.activeAnimation);\n this.meshBody.setAnimationDirectionBackward(this.oldAnimation);\n }\n if (this.meshWeapon) {\n this.meshWeapon.setAnimationDirectionBackward(this.activeAnimation);\n this.meshWeapon.setAnimationDirectionBackward(this.oldAnimation);\n }\n }\n }\n updateMovementModel(delta) {\n function exponentialEaseOut(k) {\n return k === 1 ? 1 : -Math.pow(2, -10 * k) + 1;\n }\n const controls = this.controls;\n if (controls.crouch)\n this.maxSpeed = this.crouchSpeed;\n else\n this.maxSpeed = this.walkSpeed;\n this.maxReverseSpeed = -this.maxSpeed;\n if (controls.moveForward)\n this.speed = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.clamp(this.speed + delta * this.frontAcceleration, this.maxReverseSpeed, this.maxSpeed);\n if (controls.moveBackward)\n this.speed = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.clamp(this.speed - delta * this.backAcceleration, this.maxReverseSpeed, this.maxSpeed);\n const dir = 1;\n if (controls.moveLeft) {\n this.bodyOrientation += delta * this.angularSpeed;\n this.speed = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.clamp(\n this.speed + dir * delta * this.frontAcceleration,\n this.maxReverseSpeed,\n this.maxSpeed\n );\n }\n if (controls.moveRight) {\n this.bodyOrientation -= delta * this.angularSpeed;\n this.speed = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.clamp(\n this.speed + dir * delta * this.frontAcceleration,\n this.maxReverseSpeed,\n this.maxSpeed\n );\n }\n if (!(controls.moveForward || controls.moveBackward)) {\n if (this.speed > 0) {\n const k = exponentialEaseOut(this.speed / this.maxSpeed);\n this.speed = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.clamp(this.speed - k * delta * this.frontDecceleration, 0, this.maxSpeed);\n } else {\n const k = exponentialEaseOut(this.speed / this.maxReverseSpeed);\n this.speed = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.clamp(this.speed + k * delta * this.backAcceleration, this.maxReverseSpeed, 0);\n }\n }\n const forwardDelta = this.speed * delta;\n this.root.position.x += Math.sin(this.bodyOrientation) * forwardDelta;\n this.root.position.z += Math.cos(this.bodyOrientation) * forwardDelta;\n this.root.rotation.y = this.bodyOrientation;\n }\n // internal\n _createPart(geometry2, skinMap) {\n const materialWireframe = new three__WEBPACK_IMPORTED_MODULE_42__.MeshLambertMaterial({\n color: 16755200,\n wireframe: true,\n morphTargets: true,\n morphNormals: true\n });\n const materialTexture = new three__WEBPACK_IMPORTED_MODULE_42__.MeshLambertMaterial({\n color: 16777215,\n wireframe: false,\n map: skinMap,\n morphTargets: true,\n morphNormals: true\n });\n const mesh = new MorphBlendMesh(geometry2, materialTexture);\n mesh.rotation.y = -Math.PI / 2;\n mesh.materialTexture = materialTexture;\n mesh.materialWireframe = materialWireframe;\n mesh.autoCreateAnimations(this.animationFPS);\n return mesh;\n }\n}\nconst Visible = 0;\nconst Deleted = 1;\nconst _v1$5 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst _line3 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Line3();\nconst _plane$2 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Plane();\nconst _closestPoint$1 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst _triangle = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Triangle();\nclass ConvexHull {\n constructor() {\n this.tolerance = -1;\n this.faces = [];\n this.newFaces = [];\n this.assigned = new VertexList();\n this.unassigned = new VertexList();\n this.vertices = [];\n }\n setFromPoints(points) {\n if (points.length >= 4) {\n this.makeEmpty();\n for (let i2 = 0, l = points.length; i2 < l; i2++) {\n this.vertices.push(new VertexNode(points[i2]));\n }\n this.compute();\n }\n return this;\n }\n setFromObject(object) {\n const points = [];\n object.updateMatrixWorld(true);\n object.traverse(function(node) {\n const geometry2 = node.geometry;\n if (geometry2 !== void 0) {\n const attribute = geometry2.attributes.position;\n if (attribute !== void 0) {\n for (let i2 = 0, l = attribute.count; i2 < l; i2++) {\n const point = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n point.fromBufferAttribute(attribute, i2).applyMatrix4(node.matrixWorld);\n points.push(point);\n }\n }\n }\n });\n return this.setFromPoints(points);\n }\n containsPoint(point) {\n const faces = this.faces;\n for (let i2 = 0, l = faces.length; i2 < l; i2++) {\n const face = faces[i2];\n if (face.distanceToPoint(point) > this.tolerance)\n return false;\n }\n return true;\n }\n intersectRay(ray, target) {\n const faces = this.faces;\n let tNear = -Infinity;\n let tFar = Infinity;\n for (let i2 = 0, l = faces.length; i2 < l; i2++) {\n const face = faces[i2];\n const vN = face.distanceToPoint(ray.origin);\n const vD = face.normal.dot(ray.direction);\n if (vN > 0 && vD >= 0)\n return null;\n const t2 = vD !== 0 ? -vN / vD : 0;\n if (t2 <= 0)\n continue;\n if (vD > 0) {\n tFar = Math.min(t2, tFar);\n } else {\n tNear = Math.max(t2, tNear);\n }\n if (tNear > tFar) {\n return null;\n }\n }\n if (tNear !== -Infinity) {\n ray.at(tNear, target);\n } else {\n ray.at(tFar, target);\n }\n return target;\n }\n intersectsRay(ray) {\n return this.intersectRay(ray, _v1$5) !== null;\n }\n makeEmpty() {\n this.faces = [];\n this.vertices = [];\n return this;\n }\n // Adds a vertex to the 'assigned' list of vertices and assigns it to the given face\n addVertexToFace(vertex, face) {\n vertex.face = face;\n if (face.outside === null) {\n this.assigned.append(vertex);\n } else {\n this.assigned.insertBefore(face.outside, vertex);\n }\n face.outside = vertex;\n return this;\n }\n // Removes a vertex from the 'assigned' list of vertices and from the given face\n removeVertexFromFace(vertex, face) {\n if (vertex === face.outside) {\n if (vertex.next !== null && vertex.next.face === face) {\n face.outside = vertex.next;\n } else {\n face.outside = null;\n }\n }\n this.assigned.remove(vertex);\n return this;\n }\n // Removes all the visible vertices that a given face is able to see which are stored in the 'assigned' vertex list\n removeAllVerticesFromFace(face) {\n if (face.outside !== null) {\n const start = face.outside;\n let end = face.outside;\n while (end.next !== null && end.next.face === face) {\n end = end.next;\n }\n this.assigned.removeSubList(start, end);\n start.prev = end.next = null;\n face.outside = null;\n return start;\n }\n }\n // Removes all the visible vertices that 'face' is able to see\n deleteFaceVertices(face, absorbingFace) {\n const faceVertices = this.removeAllVerticesFromFace(face);\n if (faceVertices !== void 0) {\n if (absorbingFace === void 0) {\n this.unassigned.appendChain(faceVertices);\n } else {\n let vertex = faceVertices;\n do {\n const nextVertex = vertex.next;\n const distance = absorbingFace.distanceToPoint(vertex.point);\n if (distance > this.tolerance) {\n this.addVertexToFace(vertex, absorbingFace);\n } else {\n this.unassigned.append(vertex);\n }\n vertex = nextVertex;\n } while (vertex !== null);\n }\n }\n return this;\n }\n // Reassigns as many vertices as possible from the unassigned list to the new faces\n resolveUnassignedPoints(newFaces) {\n if (this.unassigned.isEmpty() === false) {\n let vertex = this.unassigned.first();\n do {\n const nextVertex = vertex.next;\n let maxDistance = this.tolerance;\n let maxFace = null;\n for (let i2 = 0; i2 < newFaces.length; i2++) {\n const face = newFaces[i2];\n if (face.mark === Visible) {\n const distance = face.distanceToPoint(vertex.point);\n if (distance > maxDistance) {\n maxDistance = distance;\n maxFace = face;\n }\n if (maxDistance > 1e3 * this.tolerance)\n break;\n }\n }\n if (maxFace !== null) {\n this.addVertexToFace(vertex, maxFace);\n }\n vertex = nextVertex;\n } while (vertex !== null);\n }\n return this;\n }\n // Computes the extremes of a simplex which will be the initial hull\n computeExtremes() {\n const min = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const max = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const minVertices = [];\n const maxVertices = [];\n for (let i2 = 0; i2 < 3; i2++) {\n minVertices[i2] = maxVertices[i2] = this.vertices[0];\n }\n min.copy(this.vertices[0].point);\n max.copy(this.vertices[0].point);\n for (let i2 = 0, l = this.vertices.length; i2 < l; i2++) {\n const vertex = this.vertices[i2];\n const point = vertex.point;\n for (let j = 0; j < 3; j++) {\n if (point.getComponent(j) < min.getComponent(j)) {\n min.setComponent(j, point.getComponent(j));\n minVertices[j] = vertex;\n }\n }\n for (let j = 0; j < 3; j++) {\n if (point.getComponent(j) > max.getComponent(j)) {\n max.setComponent(j, point.getComponent(j));\n maxVertices[j] = vertex;\n }\n }\n }\n this.tolerance = 3 * Number.EPSILON * (Math.max(Math.abs(min.x), Math.abs(max.x)) + Math.max(Math.abs(min.y), Math.abs(max.y)) + Math.max(Math.abs(min.z), Math.abs(max.z)));\n return { min: minVertices, max: maxVertices };\n }\n // Computes the initial simplex assigning to its faces all the points\n // that are candidates to form part of the hull\n computeInitialHull() {\n const vertices = this.vertices;\n const extremes = this.computeExtremes();\n const min = extremes.min;\n const max = extremes.max;\n let maxDistance = 0;\n let index = 0;\n for (let i2 = 0; i2 < 3; i2++) {\n const distance = max[i2].point.getComponent(i2) - min[i2].point.getComponent(i2);\n if (distance > maxDistance) {\n maxDistance = distance;\n index = i2;\n }\n }\n const v0 = min[index];\n const v12 = max[index];\n let v2;\n let v3;\n maxDistance = 0;\n _line3.set(v0.point, v12.point);\n for (let i2 = 0, l = this.vertices.length; i2 < l; i2++) {\n const vertex = vertices[i2];\n if (vertex !== v0 && vertex !== v12) {\n _line3.closestPointToPoint(vertex.point, true, _closestPoint$1);\n const distance = _closestPoint$1.distanceToSquared(vertex.point);\n if (distance > maxDistance) {\n maxDistance = distance;\n v2 = vertex;\n }\n }\n }\n maxDistance = -1;\n _plane$2.setFromCoplanarPoints(v0.point, v12.point, v2.point);\n for (let i2 = 0, l = this.vertices.length; i2 < l; i2++) {\n const vertex = vertices[i2];\n if (vertex !== v0 && vertex !== v12 && vertex !== v2) {\n const distance = Math.abs(_plane$2.distanceToPoint(vertex.point));\n if (distance > maxDistance) {\n maxDistance = distance;\n v3 = vertex;\n }\n }\n }\n const faces = [];\n if (_plane$2.distanceToPoint(v3.point) < 0) {\n faces.push(Face$1.create(v0, v12, v2), Face$1.create(v3, v12, v0), Face$1.create(v3, v2, v12), Face$1.create(v3, v0, v2));\n for (let i2 = 0; i2 < 3; i2++) {\n const j = (i2 + 1) % 3;\n faces[i2 + 1].getEdge(2).setTwin(faces[0].getEdge(j));\n faces[i2 + 1].getEdge(1).setTwin(faces[j + 1].getEdge(0));\n }\n } else {\n faces.push(Face$1.create(v0, v2, v12), Face$1.create(v3, v0, v12), Face$1.create(v3, v12, v2), Face$1.create(v3, v2, v0));\n for (let i2 = 0; i2 < 3; i2++) {\n const j = (i2 + 1) % 3;\n faces[i2 + 1].getEdge(2).setTwin(faces[0].getEdge((3 - i2) % 3));\n faces[i2 + 1].getEdge(0).setTwin(faces[j + 1].getEdge(1));\n }\n }\n for (let i2 = 0; i2 < 4; i2++) {\n this.faces.push(faces[i2]);\n }\n for (let i2 = 0, l = vertices.length; i2 < l; i2++) {\n const vertex = vertices[i2];\n if (vertex !== v0 && vertex !== v12 && vertex !== v2 && vertex !== v3) {\n maxDistance = this.tolerance;\n let maxFace = null;\n for (let j = 0; j < 4; j++) {\n const distance = this.faces[j].distanceToPoint(vertex.point);\n if (distance > maxDistance) {\n maxDistance = distance;\n maxFace = this.faces[j];\n }\n }\n if (maxFace !== null) {\n this.addVertexToFace(vertex, maxFace);\n }\n }\n }\n return this;\n }\n // Removes inactive faces\n reindexFaces() {\n const activeFaces = [];\n for (let i2 = 0; i2 < this.faces.length; i2++) {\n const face = this.faces[i2];\n if (face.mark === Visible) {\n activeFaces.push(face);\n }\n }\n this.faces = activeFaces;\n return this;\n }\n // Finds the next vertex to create faces with the current hull\n nextVertexToAdd() {\n if (this.assigned.isEmpty() === false) {\n let eyeVertex, maxDistance = 0;\n const eyeFace = this.assigned.first().face;\n let vertex = eyeFace.outside;\n do {\n const distance = eyeFace.distanceToPoint(vertex.point);\n if (distance > maxDistance) {\n maxDistance = distance;\n eyeVertex = vertex;\n }\n vertex = vertex.next;\n } while (vertex !== null && vertex.face === eyeFace);\n return eyeVertex;\n }\n }\n // Computes a chain of half edges in CCW order called the 'horizon'.\n // For an edge to be part of the horizon it must join a face that can see\n // 'eyePoint' and a face that cannot see 'eyePoint'.\n computeHorizon(eyePoint, crossEdge, face, horizon) {\n this.deleteFaceVertices(face);\n face.mark = Deleted;\n let edge;\n if (crossEdge === null) {\n edge = crossEdge = face.getEdge(0);\n } else {\n edge = crossEdge.next;\n }\n do {\n const twinEdge = edge.twin;\n const oppositeFace = twinEdge.face;\n if (oppositeFace.mark === Visible) {\n if (oppositeFace.distanceToPoint(eyePoint) > this.tolerance) {\n this.computeHorizon(eyePoint, twinEdge, oppositeFace, horizon);\n } else {\n horizon.push(edge);\n }\n }\n edge = edge.next;\n } while (edge !== crossEdge);\n return this;\n }\n // Creates a face with the vertices 'eyeVertex.point', 'horizonEdge.tail' and 'horizonEdge.head' in CCW order\n addAdjoiningFace(eyeVertex, horizonEdge) {\n const face = Face$1.create(eyeVertex, horizonEdge.tail(), horizonEdge.head());\n this.faces.push(face);\n face.getEdge(-1).setTwin(horizonEdge.twin);\n return face.getEdge(0);\n }\n // Adds 'horizon.length' faces to the hull, each face will be linked with the\n // horizon opposite face and the face on the left/right\n addNewFaces(eyeVertex, horizon) {\n this.newFaces = [];\n let firstSideEdge = null;\n let previousSideEdge = null;\n for (let i2 = 0; i2 < horizon.length; i2++) {\n const horizonEdge = horizon[i2];\n const sideEdge = this.addAdjoiningFace(eyeVertex, horizonEdge);\n if (firstSideEdge === null) {\n firstSideEdge = sideEdge;\n } else {\n sideEdge.next.setTwin(previousSideEdge);\n }\n this.newFaces.push(sideEdge.face);\n previousSideEdge = sideEdge;\n }\n firstSideEdge.next.setTwin(previousSideEdge);\n return this;\n }\n // Adds a vertex to the hull\n addVertexToHull(eyeVertex) {\n const horizon = [];\n this.unassigned.clear();\n this.removeVertexFromFace(eyeVertex, eyeVertex.face);\n this.computeHorizon(eyeVertex.point, null, eyeVertex.face, horizon);\n this.addNewFaces(eyeVertex, horizon);\n this.resolveUnassignedPoints(this.newFaces);\n return this;\n }\n cleanup() {\n this.assigned.clear();\n this.unassigned.clear();\n this.newFaces = [];\n return this;\n }\n compute() {\n let vertex;\n this.computeInitialHull();\n while ((vertex = this.nextVertexToAdd()) !== void 0) {\n this.addVertexToHull(vertex);\n }\n this.reindexFaces();\n this.cleanup();\n return this;\n }\n}\nlet Face$1 = class Face {\n constructor() {\n this.normal = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this.midpoint = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this.area = 0;\n this.constant = 0;\n this.outside = null;\n this.mark = Visible;\n this.edge = null;\n }\n static create(a2, b2, c) {\n const face = new Face();\n const e0 = new HalfEdge(a2, face);\n const e1 = new HalfEdge(b2, face);\n const e2 = new HalfEdge(c, face);\n e0.next = e2.prev = e1;\n e1.next = e0.prev = e2;\n e2.next = e1.prev = e0;\n face.edge = e0;\n return face.compute();\n }\n getEdge(i2) {\n let edge = this.edge;\n while (i2 > 0) {\n edge = edge.next;\n i2--;\n }\n while (i2 < 0) {\n edge = edge.prev;\n i2++;\n }\n return edge;\n }\n compute() {\n const a2 = this.edge.tail();\n const b2 = this.edge.head();\n const c = this.edge.next.head();\n _triangle.set(a2.point, b2.point, c.point);\n _triangle.getNormal(this.normal);\n _triangle.getMidpoint(this.midpoint);\n this.area = _triangle.getArea();\n this.constant = this.normal.dot(this.midpoint);\n return this;\n }\n distanceToPoint(point) {\n return this.normal.dot(point) - this.constant;\n }\n};\nclass HalfEdge {\n constructor(vertex, face) {\n this.vertex = vertex;\n this.prev = null;\n this.next = null;\n this.twin = null;\n this.face = face;\n }\n head() {\n return this.vertex;\n }\n tail() {\n return this.prev ? this.prev.vertex : null;\n }\n length() {\n const head = this.head();\n const tail = this.tail();\n if (tail !== null) {\n return tail.point.distanceTo(head.point);\n }\n return -1;\n }\n lengthSquared() {\n const head = this.head();\n const tail = this.tail();\n if (tail !== null) {\n return tail.point.distanceToSquared(head.point);\n }\n return -1;\n }\n setTwin(edge) {\n this.twin = edge;\n edge.twin = this;\n return this;\n }\n}\nclass VertexNode {\n constructor(point) {\n this.point = point;\n this.prev = null;\n this.next = null;\n this.face = null;\n }\n}\nclass VertexList {\n constructor() {\n this.head = null;\n this.tail = null;\n }\n first() {\n return this.head;\n }\n last() {\n return this.tail;\n }\n clear() {\n this.head = this.tail = null;\n return this;\n }\n // Inserts a vertex before the target vertex\n insertBefore(target, vertex) {\n vertex.prev = target.prev;\n vertex.next = target;\n if (vertex.prev === null) {\n this.head = vertex;\n } else {\n vertex.prev.next = vertex;\n }\n target.prev = vertex;\n return this;\n }\n // Inserts a vertex after the target vertex\n insertAfter(target, vertex) {\n vertex.prev = target;\n vertex.next = target.next;\n if (vertex.next === null) {\n this.tail = vertex;\n } else {\n vertex.next.prev = vertex;\n }\n target.next = vertex;\n return this;\n }\n // Appends a vertex to the end of the linked list\n append(vertex) {\n if (this.head === null) {\n this.head = vertex;\n } else {\n this.tail.next = vertex;\n }\n vertex.prev = this.tail;\n vertex.next = null;\n this.tail = vertex;\n return this;\n }\n // Appends a chain of vertices where 'vertex' is the head.\n appendChain(vertex) {\n if (this.head === null) {\n this.head = vertex;\n } else {\n this.tail.next = vertex;\n }\n vertex.prev = this.tail;\n while (vertex.next !== null) {\n vertex = vertex.next;\n }\n this.tail = vertex;\n return this;\n }\n // Removes a vertex from the linked list\n remove(vertex) {\n if (vertex.prev === null) {\n this.head = vertex.next;\n } else {\n vertex.prev.next = vertex.next;\n }\n if (vertex.next === null) {\n this.tail = vertex.prev;\n } else {\n vertex.next.prev = vertex.prev;\n }\n return this;\n }\n // Removes a list of vertices whose 'head' is 'a' and whose 'tail' is b\n removeSubList(a2, b2) {\n if (a2.prev === null) {\n this.head = b2.next;\n } else {\n a2.prev.next = b2.next;\n }\n if (b2.next === null) {\n this.tail = a2.prev;\n } else {\n b2.next.prev = a2.prev;\n }\n return this;\n }\n isEmpty() {\n return this.head === null;\n }\n}\nclass ConvexGeometry extends three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry {\n constructor(points = []) {\n super();\n const vertices = [];\n const normals = [];\n const convexHull = new ConvexHull().setFromPoints(points);\n const faces = convexHull.faces;\n for (let i2 = 0; i2 < faces.length; i2++) {\n const face = faces[i2];\n let edge = face.edge;\n do {\n const point = edge.head().point;\n vertices.push(point.x, point.y, point.z);\n normals.push(face.normal.x, face.normal.y, face.normal.z);\n edge = edge.next;\n } while (edge !== face.edge);\n }\n this.setAttribute(\"position\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(vertices, 3));\n this.setAttribute(\"normal\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(normals, 3));\n }\n}\nconst _v1$4 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nclass ConvexObjectBreaker {\n constructor(minSizeForBreak = 1.4, smallDelta = 1e-4) {\n this.minSizeForBreak = minSizeForBreak;\n this.smallDelta = smallDelta;\n this.tempLine1 = new three__WEBPACK_IMPORTED_MODULE_42__.Line3();\n this.tempPlane1 = new three__WEBPACK_IMPORTED_MODULE_42__.Plane();\n this.tempPlane2 = new three__WEBPACK_IMPORTED_MODULE_42__.Plane();\n this.tempPlane_Cut = new three__WEBPACK_IMPORTED_MODULE_42__.Plane();\n this.tempCM1 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this.tempCM2 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this.tempVector3 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this.tempVector3_2 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this.tempVector3_3 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this.tempVector3_P0 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this.tempVector3_P1 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this.tempVector3_P2 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this.tempVector3_N0 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this.tempVector3_N1 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this.tempVector3_AB = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this.tempVector3_CB = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this.tempResultObjects = { object1: null, object2: null };\n this.segments = [];\n const n = 30 * 30;\n for (let i2 = 0; i2 < n; i2++)\n this.segments[i2] = false;\n }\n prepareBreakableObject(object, mass, velocity, angularVelocity, breakable) {\n const userData = object.userData;\n userData.mass = mass;\n userData.velocity = velocity.clone();\n userData.angularVelocity = angularVelocity.clone();\n userData.breakable = breakable;\n }\n /*\n * @param {int} maxRadialIterations Iterations for radial cuts.\n * @param {int} maxRandomIterations Max random iterations for not-radial cuts\n *\n * Returns the array of pieces\n */\n subdivideByImpact(object, pointOfImpact, normal, maxRadialIterations, maxRandomIterations) {\n const debris = [];\n const tempPlane1 = this.tempPlane1;\n const tempPlane2 = this.tempPlane2;\n this.tempVector3.addVectors(pointOfImpact, normal);\n tempPlane1.setFromCoplanarPoints(pointOfImpact, object.position, this.tempVector3);\n const maxTotalIterations = maxRandomIterations + maxRadialIterations;\n const scope = this;\n function subdivideRadial(subObject, startAngle, endAngle, numIterations) {\n if (Math.random() < numIterations * 0.05 || numIterations > maxTotalIterations) {\n debris.push(subObject);\n return;\n }\n let angle = Math.PI;\n if (numIterations === 0) {\n tempPlane2.normal.copy(tempPlane1.normal);\n tempPlane2.constant = tempPlane1.constant;\n } else {\n if (numIterations <= maxRadialIterations) {\n angle = (endAngle - startAngle) * (0.2 + 0.6 * Math.random()) + startAngle;\n scope.tempVector3_2.copy(object.position).sub(pointOfImpact).applyAxisAngle(normal, angle).add(pointOfImpact);\n tempPlane2.setFromCoplanarPoints(pointOfImpact, scope.tempVector3, scope.tempVector3_2);\n } else {\n angle = (0.5 * (numIterations & 1) + 0.2 * (2 - Math.random())) * Math.PI;\n scope.tempVector3_2.copy(pointOfImpact).sub(subObject.position).applyAxisAngle(normal, angle).add(subObject.position);\n scope.tempVector3_3.copy(normal).add(subObject.position);\n tempPlane2.setFromCoplanarPoints(subObject.position, scope.tempVector3_3, scope.tempVector3_2);\n }\n }\n scope.cutByPlane(subObject, tempPlane2, scope.tempResultObjects);\n const obj1 = scope.tempResultObjects.object1;\n const obj2 = scope.tempResultObjects.object2;\n if (obj1) {\n subdivideRadial(obj1, startAngle, angle, numIterations + 1);\n }\n if (obj2) {\n subdivideRadial(obj2, angle, endAngle, numIterations + 1);\n }\n }\n subdivideRadial(object, 0, 2 * Math.PI, 0);\n return debris;\n }\n cutByPlane(object, plane, output) {\n const geometry2 = object.geometry;\n const coords = geometry2.attributes.position.array;\n const normals = geometry2.attributes.normal.array;\n const numPoints = coords.length / 3;\n let numFaces = numPoints / 3;\n let indices = geometry2.getIndex();\n if (indices) {\n indices = indices.array;\n numFaces = indices.length / 3;\n }\n function getVertexIndex(faceIdx, vert) {\n const idx = faceIdx * 3 + vert;\n return indices ? indices[idx] : idx;\n }\n const points1 = [];\n const points2 = [];\n const delta = this.smallDelta;\n const numPointPairs = numPoints * numPoints;\n for (let i2 = 0; i2 < numPointPairs; i2++)\n this.segments[i2] = false;\n const p0 = this.tempVector3_P0;\n const p1 = this.tempVector3_P1;\n const n0 = this.tempVector3_N0;\n const n1 = this.tempVector3_N1;\n for (let i2 = 0; i2 < numFaces - 1; i2++) {\n const a1 = getVertexIndex(i2, 0);\n const b1 = getVertexIndex(i2, 1);\n const c1 = getVertexIndex(i2, 2);\n n0.set(normals[a1], normals[a1] + 1, normals[a1] + 2);\n for (let j = i2 + 1; j < numFaces; j++) {\n const a2 = getVertexIndex(j, 0);\n const b2 = getVertexIndex(j, 1);\n const c2 = getVertexIndex(j, 2);\n n1.set(normals[a2], normals[a2] + 1, normals[a2] + 2);\n const coplanar = 1 - n0.dot(n1) < delta;\n if (coplanar) {\n if (a1 === a2 || a1 === b2 || a1 === c2) {\n if (b1 === a2 || b1 === b2 || b1 === c2) {\n this.segments[a1 * numPoints + b1] = true;\n this.segments[b1 * numPoints + a1] = true;\n } else {\n this.segments[c1 * numPoints + a1] = true;\n this.segments[a1 * numPoints + c1] = true;\n }\n } else if (b1 === a2 || b1 === b2 || b1 === c2) {\n this.segments[c1 * numPoints + b1] = true;\n this.segments[b1 * numPoints + c1] = true;\n }\n }\n }\n }\n const localPlane = this.tempPlane_Cut;\n object.updateMatrix();\n ConvexObjectBreaker.transformPlaneToLocalSpace(plane, object.matrix, localPlane);\n for (let i2 = 0; i2 < numFaces; i2++) {\n const va = getVertexIndex(i2, 0);\n const vb = getVertexIndex(i2, 1);\n const vc = getVertexIndex(i2, 2);\n for (let segment = 0; segment < 3; segment++) {\n const i0 = segment === 0 ? va : segment === 1 ? vb : vc;\n const i1 = segment === 0 ? vb : segment === 1 ? vc : va;\n const segmentState = this.segments[i0 * numPoints + i1];\n if (segmentState)\n continue;\n this.segments[i0 * numPoints + i1] = true;\n this.segments[i1 * numPoints + i0] = true;\n p0.set(coords[3 * i0], coords[3 * i0 + 1], coords[3 * i0 + 2]);\n p1.set(coords[3 * i1], coords[3 * i1 + 1], coords[3 * i1 + 2]);\n let mark0 = 0;\n let d = localPlane.distanceToPoint(p0);\n if (d > delta) {\n mark0 = 2;\n points2.push(p0.clone());\n } else if (d < -delta) {\n mark0 = 1;\n points1.push(p0.clone());\n } else {\n mark0 = 3;\n points1.push(p0.clone());\n points2.push(p0.clone());\n }\n let mark1 = 0;\n d = localPlane.distanceToPoint(p1);\n if (d > delta) {\n mark1 = 2;\n points2.push(p1.clone());\n } else if (d < -delta) {\n mark1 = 1;\n points1.push(p1.clone());\n } else {\n mark1 = 3;\n points1.push(p1.clone());\n points2.push(p1.clone());\n }\n if (mark0 === 1 && mark1 === 2 || mark0 === 2 && mark1 === 1) {\n this.tempLine1.start.copy(p0);\n this.tempLine1.end.copy(p1);\n let intersection = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n intersection = localPlane.intersectLine(this.tempLine1, intersection);\n if (intersection === null) {\n console.error(\"Internal error: segment does not intersect plane.\");\n output.segmentedObject1 = null;\n output.segmentedObject2 = null;\n return 0;\n }\n points1.push(intersection);\n points2.push(intersection.clone());\n }\n }\n }\n const newMass = object.userData.mass * 0.5;\n this.tempCM1.set(0, 0, 0);\n let radius1 = 0;\n const numPoints1 = points1.length;\n if (numPoints1 > 0) {\n for (let i2 = 0; i2 < numPoints1; i2++)\n this.tempCM1.add(points1[i2]);\n this.tempCM1.divideScalar(numPoints1);\n for (let i2 = 0; i2 < numPoints1; i2++) {\n const p = points1[i2];\n p.sub(this.tempCM1);\n radius1 = Math.max(radius1, p.x, p.y, p.z);\n }\n this.tempCM1.add(object.position);\n }\n this.tempCM2.set(0, 0, 0);\n let radius2 = 0;\n const numPoints2 = points2.length;\n if (numPoints2 > 0) {\n for (let i2 = 0; i2 < numPoints2; i2++)\n this.tempCM2.add(points2[i2]);\n this.tempCM2.divideScalar(numPoints2);\n for (let i2 = 0; i2 < numPoints2; i2++) {\n const p = points2[i2];\n p.sub(this.tempCM2);\n radius2 = Math.max(radius2, p.x, p.y, p.z);\n }\n this.tempCM2.add(object.position);\n }\n let object1 = null;\n let object2 = null;\n let numObjects = 0;\n if (numPoints1 > 4) {\n object1 = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new ConvexGeometry(points1), object.material);\n object1.position.copy(this.tempCM1);\n object1.quaternion.copy(object.quaternion);\n this.prepareBreakableObject(\n object1,\n newMass,\n object.userData.velocity,\n object.userData.angularVelocity,\n 2 * radius1 > this.minSizeForBreak\n );\n numObjects++;\n }\n if (numPoints2 > 4) {\n object2 = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new ConvexGeometry(points2), object.material);\n object2.position.copy(this.tempCM2);\n object2.quaternion.copy(object.quaternion);\n this.prepareBreakableObject(\n object2,\n newMass,\n object.userData.velocity,\n object.userData.angularVelocity,\n 2 * radius2 > this.minSizeForBreak\n );\n numObjects++;\n }\n output.object1 = object1;\n output.object2 = object2;\n return numObjects;\n }\n static transformFreeVector(v, m) {\n const x = v.x, y = v.y, z = v.z;\n const e = m.elements;\n v.x = e[0] * x + e[4] * y + e[8] * z;\n v.y = e[1] * x + e[5] * y + e[9] * z;\n v.z = e[2] * x + e[6] * y + e[10] * z;\n return v;\n }\n static transformFreeVectorInverse(v, m) {\n const x = v.x, y = v.y, z = v.z;\n const e = m.elements;\n v.x = e[0] * x + e[1] * y + e[2] * z;\n v.y = e[4] * x + e[5] * y + e[6] * z;\n v.z = e[8] * x + e[9] * y + e[10] * z;\n return v;\n }\n static transformTiedVectorInverse(v, m) {\n const x = v.x, y = v.y, z = v.z;\n const e = m.elements;\n v.x = e[0] * x + e[1] * y + e[2] * z - e[12];\n v.y = e[4] * x + e[5] * y + e[6] * z - e[13];\n v.z = e[8] * x + e[9] * y + e[10] * z - e[14];\n return v;\n }\n static transformPlaneToLocalSpace(plane, m, resultPlane) {\n resultPlane.normal.copy(plane.normal);\n resultPlane.constant = plane.constant;\n const referencePoint = ConvexObjectBreaker.transformTiedVectorInverse(plane.coplanarPoint(_v1$4), m);\n ConvexObjectBreaker.transformFreeVectorInverse(resultPlane.normal, m);\n resultPlane.constant = -referencePoint.dot(resultPlane.normal);\n }\n}\nclass GPUComputationRenderer {\n constructor(sizeX, sizeY, renderer) {\n this.variables = [];\n this.currentTextureIndex = 0;\n let dataType = three__WEBPACK_IMPORTED_MODULE_42__.FloatType;\n const scene = new three__WEBPACK_IMPORTED_MODULE_42__.Scene();\n const camera = new three__WEBPACK_IMPORTED_MODULE_42__.Camera();\n camera.position.z = 1;\n const passThruUniforms = {\n passThruTexture: { value: null }\n };\n const passThruShader = createShaderMaterial(getPassThroughFragmentShader(), passThruUniforms);\n const mesh = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.PlaneGeometry(2, 2), passThruShader);\n scene.add(mesh);\n this.setDataType = function(type) {\n dataType = type;\n return this;\n };\n this.addVariable = function(variableName, computeFragmentShader, initialValueTexture) {\n const material2 = this.createShaderMaterial(computeFragmentShader);\n const variable = {\n name: variableName,\n initialValueTexture,\n material: material2,\n dependencies: null,\n renderTargets: [],\n wrapS: null,\n wrapT: null,\n minFilter: three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter,\n magFilter: three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter\n };\n this.variables.push(variable);\n return variable;\n };\n this.setVariableDependencies = function(variable, dependencies) {\n variable.dependencies = dependencies;\n };\n this.init = function() {\n if (renderer.capabilities.isWebGL2 === false && renderer.extensions.has(\"OES_texture_float\") === false) {\n return \"No OES_texture_float support for float textures.\";\n }\n if (renderer.capabilities.maxVertexTextures === 0) {\n return \"No support for vertex shader textures.\";\n }\n for (let i2 = 0; i2 < this.variables.length; i2++) {\n const variable = this.variables[i2];\n variable.renderTargets[0] = this.createRenderTarget(\n sizeX,\n sizeY,\n variable.wrapS,\n variable.wrapT,\n variable.minFilter,\n variable.magFilter\n );\n variable.renderTargets[1] = this.createRenderTarget(\n sizeX,\n sizeY,\n variable.wrapS,\n variable.wrapT,\n variable.minFilter,\n variable.magFilter\n );\n this.renderTexture(variable.initialValueTexture, variable.renderTargets[0]);\n this.renderTexture(variable.initialValueTexture, variable.renderTargets[1]);\n const material2 = variable.material;\n const uniforms = material2.uniforms;\n if (variable.dependencies !== null) {\n for (let d = 0; d < variable.dependencies.length; d++) {\n const depVar = variable.dependencies[d];\n if (depVar.name !== variable.name) {\n let found = false;\n for (let j = 0; j < this.variables.length; j++) {\n if (depVar.name === this.variables[j].name) {\n found = true;\n break;\n }\n }\n if (!found) {\n return \"Variable dependency not found. Variable=\" + variable.name + \", dependency=\" + depVar.name;\n }\n }\n uniforms[depVar.name] = { value: null };\n material2.fragmentShader = \"\\nuniform sampler2D \" + depVar.name + \";\\n\" + material2.fragmentShader;\n }\n }\n }\n this.currentTextureIndex = 0;\n return null;\n };\n this.compute = function() {\n const currentTextureIndex = this.currentTextureIndex;\n const nextTextureIndex = this.currentTextureIndex === 0 ? 1 : 0;\n for (let i2 = 0, il = this.variables.length; i2 < il; i2++) {\n const variable = this.variables[i2];\n if (variable.dependencies !== null) {\n const uniforms = variable.material.uniforms;\n for (let d = 0, dl = variable.dependencies.length; d < dl; d++) {\n const depVar = variable.dependencies[d];\n uniforms[depVar.name].value = depVar.renderTargets[currentTextureIndex].texture;\n }\n }\n this.doRenderTarget(variable.material, variable.renderTargets[nextTextureIndex]);\n }\n this.currentTextureIndex = nextTextureIndex;\n };\n this.getCurrentRenderTarget = function(variable) {\n return variable.renderTargets[this.currentTextureIndex];\n };\n this.getAlternateRenderTarget = function(variable) {\n return variable.renderTargets[this.currentTextureIndex === 0 ? 1 : 0];\n };\n this.dispose = function() {\n mesh.geometry.dispose();\n mesh.material.dispose();\n const variables = this.variables;\n for (let i2 = 0; i2 < variables.length; i2++) {\n const variable = variables[i2];\n if (variable.initialValueTexture)\n variable.initialValueTexture.dispose();\n const renderTargets = variable.renderTargets;\n for (let j = 0; j < renderTargets.length; j++) {\n const renderTarget = renderTargets[j];\n renderTarget.dispose();\n }\n }\n };\n function addResolutionDefine(materialShader) {\n materialShader.defines.resolution = \"vec2( \" + sizeX.toFixed(1) + \", \" + sizeY.toFixed(1) + \" )\";\n }\n this.addResolutionDefine = addResolutionDefine;\n function createShaderMaterial(computeFragmentShader, uniforms) {\n uniforms = uniforms || {};\n const material2 = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms,\n vertexShader: getPassThroughVertexShader(),\n fragmentShader: computeFragmentShader\n });\n addResolutionDefine(material2);\n return material2;\n }\n this.createShaderMaterial = createShaderMaterial;\n this.createRenderTarget = function(sizeXTexture, sizeYTexture, wrapS, wrapT, minFilter, magFilter) {\n sizeXTexture = sizeXTexture || sizeX;\n sizeYTexture = sizeYTexture || sizeY;\n wrapS = wrapS || three__WEBPACK_IMPORTED_MODULE_42__.ClampToEdgeWrapping;\n wrapT = wrapT || three__WEBPACK_IMPORTED_MODULE_42__.ClampToEdgeWrapping;\n minFilter = minFilter || three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter;\n magFilter = magFilter || three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter;\n const renderTarget = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(sizeXTexture, sizeYTexture, {\n wrapS,\n wrapT,\n minFilter,\n magFilter,\n format: three__WEBPACK_IMPORTED_MODULE_42__.RGBAFormat,\n type: dataType,\n depthBuffer: false\n });\n return renderTarget;\n };\n this.createTexture = function() {\n const data = new Float32Array(sizeX * sizeY * 4);\n const texture = new three__WEBPACK_IMPORTED_MODULE_42__.DataTexture(data, sizeX, sizeY, three__WEBPACK_IMPORTED_MODULE_42__.RGBAFormat, three__WEBPACK_IMPORTED_MODULE_42__.FloatType);\n texture.needsUpdate = true;\n return texture;\n };\n this.renderTexture = function(input, output) {\n passThruUniforms.passThruTexture.value = input;\n this.doRenderTarget(passThruShader, output);\n passThruUniforms.passThruTexture.value = null;\n };\n this.doRenderTarget = function(material2, output) {\n const currentRenderTarget = renderer.getRenderTarget();\n const currentXrEnabled = renderer.xr.enabled;\n const currentShadowAutoUpdate = renderer.shadowMap.autoUpdate;\n const currentOutputColorSpace = renderer.outputColorSpace;\n const currentToneMapping = renderer.toneMapping;\n renderer.xr.enabled = false;\n renderer.shadowMap.autoUpdate = false;\n if (\"outputColorSpace\" in renderer)\n renderer.outputColorSpace = \"srgb-linear\";\n else\n renderer.encoding = 3e3;\n renderer.toneMapping = three__WEBPACK_IMPORTED_MODULE_42__.NoToneMapping;\n mesh.material = material2;\n renderer.setRenderTarget(output);\n renderer.render(scene, camera);\n mesh.material = passThruShader;\n renderer.xr.enabled = currentXrEnabled;\n renderer.shadowMap.autoUpdate = currentShadowAutoUpdate;\n renderer.outputColorSpace = currentOutputColorSpace;\n renderer.toneMapping = currentToneMapping;\n renderer.setRenderTarget(currentRenderTarget);\n };\n function getPassThroughVertexShader() {\n return \"void main()\t{\\n\\n\tgl_Position = vec4( position, 1.0 );\\n\\n}\\n\";\n }\n function getPassThroughFragmentShader() {\n return \"uniform sampler2D passThruTexture;\\n\\nvoid main() {\\n\\n\tvec2 uv = gl_FragCoord.xy / resolution.xy;\\n\\n\tgl_FragColor = texture2D( passThruTexture, uv );\\n\\n}\\n\";\n }\n }\n}\nconst _translationObject = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst _quaternionObject = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion();\nconst _scaleObject = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst _translationWorld = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst _quaternionWorld = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion();\nconst _scaleWorld = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nclass Gyroscope extends three__WEBPACK_IMPORTED_MODULE_42__.Object3D {\n constructor() {\n super();\n }\n updateMatrixWorld(force) {\n this.matrixAutoUpdate && this.updateMatrix();\n if (this.matrixWorldNeedsUpdate || force) {\n if (this.parent !== null) {\n this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix);\n this.matrixWorld.decompose(_translationWorld, _quaternionWorld, _scaleWorld);\n this.matrix.decompose(_translationObject, _quaternionObject, _scaleObject);\n this.matrixWorld.compose(_translationWorld, _quaternionObject, _scaleWorld);\n } else {\n this.matrixWorld.copy(this.matrix);\n }\n this.matrixWorldNeedsUpdate = false;\n force = true;\n }\n for (let i2 = 0, l = this.children.length; i2 < l; i2++) {\n this.children[i2].updateMatrixWorld(force);\n }\n }\n}\nclass MorphAnimMesh extends three__WEBPACK_IMPORTED_MODULE_42__.Mesh {\n constructor(geometry2, material2) {\n super(geometry2, material2);\n this.type = \"MorphAnimMesh\";\n this.mixer = new three__WEBPACK_IMPORTED_MODULE_42__.AnimationMixer(this);\n this.activeAction = null;\n }\n setDirectionForward() {\n this.mixer.timeScale = 1;\n }\n setDirectionBackward() {\n this.mixer.timeScale = -1;\n }\n playAnimation(label, fps) {\n if (this.activeAction) {\n this.activeAction.stop();\n this.activeAction = null;\n }\n const clip = three__WEBPACK_IMPORTED_MODULE_42__.AnimationClip.findByName(this, label);\n if (clip) {\n const action = this.mixer.clipAction(clip);\n action.timeScale = clip.tracks.length * fps / clip.duration;\n this.activeAction = action.play();\n } else {\n throw new Error(\"THREE.MorphAnimMesh: animations[\" + label + \"] undefined in .playAnimation()\");\n }\n }\n updateAnimation(delta) {\n this.mixer.update(delta);\n }\n copy(source, recursive) {\n super.copy(source, recursive);\n this.mixer = new three__WEBPACK_IMPORTED_MODULE_42__.AnimationMixer(this);\n return this;\n }\n}\nclass RollerCoasterGeometry extends three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry {\n constructor(curve, divisions) {\n super();\n const vertices = [];\n const normals = [];\n const colors = [];\n const color1 = [1, 1, 1];\n const color2 = [1, 1, 0];\n const up = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 1, 0);\n const forward = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const right = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const quaternion = new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion();\n const prevQuaternion = new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion();\n prevQuaternion.setFromAxisAngle(up, Math.PI / 2);\n const point = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const prevPoint = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n prevPoint.copy(curve.getPointAt(0));\n const step = [\n new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(-0.225, 0, 0),\n new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, -0.05, 0),\n new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, -0.175, 0),\n new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, -0.05, 0),\n new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0.225, 0, 0),\n new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, -0.175, 0)\n ];\n const PI2 = Math.PI * 2;\n let sides = 5;\n const tube1 = [];\n for (let i2 = 0; i2 < sides; i2++) {\n const angle = i2 / sides * PI2;\n tube1.push(new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(Math.sin(angle) * 0.06, Math.cos(angle) * 0.06, 0));\n }\n sides = 6;\n const tube2 = [];\n for (let i2 = 0; i2 < sides; i2++) {\n const angle = i2 / sides * PI2;\n tube2.push(new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(Math.sin(angle) * 0.025, Math.cos(angle) * 0.025, 0));\n }\n const vector = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const normal = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n function drawShape(shape, color) {\n normal.set(0, 0, -1).applyQuaternion(quaternion);\n for (let j = 0; j < shape.length; j++) {\n vector.copy(shape[j]);\n vector.applyQuaternion(quaternion);\n vector.add(point);\n vertices.push(vector.x, vector.y, vector.z);\n normals.push(normal.x, normal.y, normal.z);\n colors.push(color[0], color[1], color[2]);\n }\n normal.set(0, 0, 1).applyQuaternion(quaternion);\n for (let j = shape.length - 1; j >= 0; j--) {\n vector.copy(shape[j]);\n vector.applyQuaternion(quaternion);\n vector.add(point);\n vertices.push(vector.x, vector.y, vector.z);\n normals.push(normal.x, normal.y, normal.z);\n colors.push(color[0], color[1], color[2]);\n }\n }\n const vector1 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const vector2 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const vector3 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const vector4 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const normal1 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const normal2 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const normal3 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const normal4 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n function extrudeShape(shape, offset2, color) {\n for (let j = 0, jl = shape.length; j < jl; j++) {\n const point1 = shape[j];\n const point2 = shape[(j + 1) % jl];\n vector1.copy(point1).add(offset2);\n vector1.applyQuaternion(quaternion);\n vector1.add(point);\n vector2.copy(point2).add(offset2);\n vector2.applyQuaternion(quaternion);\n vector2.add(point);\n vector3.copy(point2).add(offset2);\n vector3.applyQuaternion(prevQuaternion);\n vector3.add(prevPoint);\n vector4.copy(point1).add(offset2);\n vector4.applyQuaternion(prevQuaternion);\n vector4.add(prevPoint);\n vertices.push(vector1.x, vector1.y, vector1.z);\n vertices.push(vector2.x, vector2.y, vector2.z);\n vertices.push(vector4.x, vector4.y, vector4.z);\n vertices.push(vector2.x, vector2.y, vector2.z);\n vertices.push(vector3.x, vector3.y, vector3.z);\n vertices.push(vector4.x, vector4.y, vector4.z);\n normal1.copy(point1);\n normal1.applyQuaternion(quaternion);\n normal1.normalize();\n normal2.copy(point2);\n normal2.applyQuaternion(quaternion);\n normal2.normalize();\n normal3.copy(point2);\n normal3.applyQuaternion(prevQuaternion);\n normal3.normalize();\n normal4.copy(point1);\n normal4.applyQuaternion(prevQuaternion);\n normal4.normalize();\n normals.push(normal1.x, normal1.y, normal1.z);\n normals.push(normal2.x, normal2.y, normal2.z);\n normals.push(normal4.x, normal4.y, normal4.z);\n normals.push(normal2.x, normal2.y, normal2.z);\n normals.push(normal3.x, normal3.y, normal3.z);\n normals.push(normal4.x, normal4.y, normal4.z);\n colors.push(color[0], color[1], color[2]);\n colors.push(color[0], color[1], color[2]);\n colors.push(color[0], color[1], color[2]);\n colors.push(color[0], color[1], color[2]);\n colors.push(color[0], color[1], color[2]);\n colors.push(color[0], color[1], color[2]);\n }\n }\n const offset = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n for (let i2 = 1; i2 <= divisions; i2++) {\n point.copy(curve.getPointAt(i2 / divisions));\n up.set(0, 1, 0);\n forward.subVectors(point, prevPoint).normalize();\n right.crossVectors(up, forward).normalize();\n up.crossVectors(forward, right);\n const angle = Math.atan2(forward.x, forward.z);\n quaternion.setFromAxisAngle(up, angle);\n if (i2 % 2 === 0) {\n drawShape(step, color2);\n }\n extrudeShape(tube1, offset.set(0, -0.125, 0), color2);\n extrudeShape(tube2, offset.set(0.2, 0, 0), color1);\n extrudeShape(tube2, offset.set(-0.2, 0, 0), color1);\n prevPoint.copy(point);\n prevQuaternion.copy(quaternion);\n }\n this.setAttribute(\"position\", new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(new Float32Array(vertices), 3));\n this.setAttribute(\"normal\", new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(new Float32Array(normals), 3));\n this.setAttribute(\"color\", new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(new Float32Array(colors), 3));\n }\n}\nclass RollerCoasterLiftersGeometry extends three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry {\n constructor(curve, divisions) {\n super();\n const vertices = [];\n const normals = [];\n const quaternion = new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion();\n const up = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 1, 0);\n const point = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const tangent = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const tube1 = [new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 0.05, -0.05), new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 0.05, 0.05), new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, -0.05, 0)];\n const tube2 = [new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(-0.05, 0, 0.05), new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(-0.05, 0, -0.05), new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0.05, 0, 0)];\n const tube3 = [new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0.05, 0, -0.05), new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0.05, 0, 0.05), new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(-0.05, 0, 0)];\n const vector1 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const vector2 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const vector3 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const vector4 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const normal1 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const normal2 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const normal3 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const normal4 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n function extrudeShape(shape, fromPoint2, toPoint2) {\n for (let j = 0, jl = shape.length; j < jl; j++) {\n const point1 = shape[j];\n const point2 = shape[(j + 1) % jl];\n vector1.copy(point1);\n vector1.applyQuaternion(quaternion);\n vector1.add(fromPoint2);\n vector2.copy(point2);\n vector2.applyQuaternion(quaternion);\n vector2.add(fromPoint2);\n vector3.copy(point2);\n vector3.applyQuaternion(quaternion);\n vector3.add(toPoint2);\n vector4.copy(point1);\n vector4.applyQuaternion(quaternion);\n vector4.add(toPoint2);\n vertices.push(vector1.x, vector1.y, vector1.z);\n vertices.push(vector2.x, vector2.y, vector2.z);\n vertices.push(vector4.x, vector4.y, vector4.z);\n vertices.push(vector2.x, vector2.y, vector2.z);\n vertices.push(vector3.x, vector3.y, vector3.z);\n vertices.push(vector4.x, vector4.y, vector4.z);\n normal1.copy(point1);\n normal1.applyQuaternion(quaternion);\n normal1.normalize();\n normal2.copy(point2);\n normal2.applyQuaternion(quaternion);\n normal2.normalize();\n normal3.copy(point2);\n normal3.applyQuaternion(quaternion);\n normal3.normalize();\n normal4.copy(point1);\n normal4.applyQuaternion(quaternion);\n normal4.normalize();\n normals.push(normal1.x, normal1.y, normal1.z);\n normals.push(normal2.x, normal2.y, normal2.z);\n normals.push(normal4.x, normal4.y, normal4.z);\n normals.push(normal2.x, normal2.y, normal2.z);\n normals.push(normal3.x, normal3.y, normal3.z);\n normals.push(normal4.x, normal4.y, normal4.z);\n }\n }\n const fromPoint = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const toPoint = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n for (let i2 = 1; i2 <= divisions; i2++) {\n point.copy(curve.getPointAt(i2 / divisions));\n tangent.copy(curve.getTangentAt(i2 / divisions));\n const angle = Math.atan2(tangent.x, tangent.z);\n quaternion.setFromAxisAngle(up, angle);\n if (point.y > 10) {\n fromPoint.set(-0.75, -0.35, 0);\n fromPoint.applyQuaternion(quaternion);\n fromPoint.add(point);\n toPoint.set(0.75, -0.35, 0);\n toPoint.applyQuaternion(quaternion);\n toPoint.add(point);\n extrudeShape(tube1, fromPoint, toPoint);\n fromPoint.set(-0.7, -0.3, 0);\n fromPoint.applyQuaternion(quaternion);\n fromPoint.add(point);\n toPoint.set(-0.7, -point.y, 0);\n toPoint.applyQuaternion(quaternion);\n toPoint.add(point);\n extrudeShape(tube2, fromPoint, toPoint);\n fromPoint.set(0.7, -0.3, 0);\n fromPoint.applyQuaternion(quaternion);\n fromPoint.add(point);\n toPoint.set(0.7, -point.y, 0);\n toPoint.applyQuaternion(quaternion);\n toPoint.add(point);\n extrudeShape(tube3, fromPoint, toPoint);\n } else {\n fromPoint.set(0, -0.2, 0);\n fromPoint.applyQuaternion(quaternion);\n fromPoint.add(point);\n toPoint.set(0, -point.y, 0);\n toPoint.applyQuaternion(quaternion);\n toPoint.add(point);\n extrudeShape(tube3, fromPoint, toPoint);\n }\n }\n this.setAttribute(\"position\", new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(new Float32Array(vertices), 3));\n this.setAttribute(\"normal\", new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(new Float32Array(normals), 3));\n }\n}\nclass RollerCoasterShadowGeometry extends three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry {\n constructor(curve, divisions) {\n super();\n const vertices = [];\n const up = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 1, 0);\n const forward = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const quaternion = new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion();\n const prevQuaternion = new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion();\n prevQuaternion.setFromAxisAngle(up, Math.PI / 2);\n const point = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const prevPoint = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n prevPoint.copy(curve.getPointAt(0));\n prevPoint.y = 0;\n const vector1 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const vector2 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const vector3 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const vector4 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n for (let i2 = 1; i2 <= divisions; i2++) {\n point.copy(curve.getPointAt(i2 / divisions));\n point.y = 0;\n forward.subVectors(point, prevPoint);\n const angle = Math.atan2(forward.x, forward.z);\n quaternion.setFromAxisAngle(up, angle);\n vector1.set(-0.3, 0, 0);\n vector1.applyQuaternion(quaternion);\n vector1.add(point);\n vector2.set(0.3, 0, 0);\n vector2.applyQuaternion(quaternion);\n vector2.add(point);\n vector3.set(0.3, 0, 0);\n vector3.applyQuaternion(prevQuaternion);\n vector3.add(prevPoint);\n vector4.set(-0.3, 0, 0);\n vector4.applyQuaternion(prevQuaternion);\n vector4.add(prevPoint);\n vertices.push(vector1.x, vector1.y, vector1.z);\n vertices.push(vector2.x, vector2.y, vector2.z);\n vertices.push(vector4.x, vector4.y, vector4.z);\n vertices.push(vector2.x, vector2.y, vector2.z);\n vertices.push(vector3.x, vector3.y, vector3.z);\n vertices.push(vector4.x, vector4.y, vector4.z);\n prevPoint.copy(point);\n prevQuaternion.copy(quaternion);\n }\n this.setAttribute(\"position\", new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(new Float32Array(vertices), 3));\n }\n}\nclass SkyGeometry extends three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry {\n constructor() {\n super();\n const vertices = [];\n for (let i2 = 0; i2 < 100; i2++) {\n const x = Math.random() * 800 - 400;\n const y = Math.random() * 50 + 50;\n const z = Math.random() * 800 - 400;\n const size2 = Math.random() * 40 + 20;\n vertices.push(x - size2, y, z - size2);\n vertices.push(x + size2, y, z - size2);\n vertices.push(x - size2, y, z + size2);\n vertices.push(x + size2, y, z - size2);\n vertices.push(x + size2, y, z + size2);\n vertices.push(x - size2, y, z + size2);\n }\n this.setAttribute(\"position\", new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(new Float32Array(vertices), 3));\n }\n}\nclass TreesGeometry extends three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry {\n constructor(landscape) {\n super();\n const vertices = [];\n const colors = [];\n const raycaster = new three__WEBPACK_IMPORTED_MODULE_42__.Raycaster();\n raycaster.ray.direction.set(0, -1, 0);\n const _color2 = new three__WEBPACK_IMPORTED_MODULE_42__.Color();\n for (let i2 = 0; i2 < 2e3; i2++) {\n const x = Math.random() * 500 - 250;\n const z = Math.random() * 500 - 250;\n raycaster.ray.origin.set(x, 50, z);\n const intersections = raycaster.intersectObject(landscape);\n if (intersections.length === 0)\n continue;\n const y = intersections[0].point.y;\n const height = Math.random() * 5 + 0.5;\n let angle = Math.random() * Math.PI * 2;\n vertices.push(x + Math.sin(angle), y, z + Math.cos(angle));\n vertices.push(x, y + height, z);\n vertices.push(x + Math.sin(angle + Math.PI), y, z + Math.cos(angle + Math.PI));\n angle += Math.PI / 2;\n vertices.push(x + Math.sin(angle), y, z + Math.cos(angle));\n vertices.push(x, y + height, z);\n vertices.push(x + Math.sin(angle + Math.PI), y, z + Math.cos(angle + Math.PI));\n const random = Math.random() * 0.1;\n for (let j = 0; j < 6; j++) {\n _color2.setRGB(0.2 + random, 0.4 + random, 0, \"srgb\");\n colors.push(_color2.r, _color2.g, _color2.b);\n }\n }\n this.setAttribute(\"position\", new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(new Float32Array(vertices), 3));\n this.setAttribute(\"color\", new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(new Float32Array(colors), 3));\n }\n}\nclass Timer {\n constructor() {\n __publicField(this, \"_previousTime\");\n __publicField(this, \"_currentTime\");\n __publicField(this, \"_delta\");\n __publicField(this, \"_elapsed\");\n __publicField(this, \"_timescale\");\n __publicField(this, \"_useFixedDelta\");\n __publicField(this, \"_fixedDelta\");\n __publicField(this, \"_usePageVisibilityAPI\");\n __publicField(this, \"_pageVisibilityHandler\");\n this._previousTime = 0;\n this._currentTime = 0;\n this._delta = 0;\n this._elapsed = 0;\n this._timescale = 1;\n this._useFixedDelta = false;\n this._fixedDelta = 16.67;\n this._usePageVisibilityAPI = typeof document !== \"undefined\" && document.hidden !== void 0;\n }\n // https://github.com/mrdoob/three.js/issues/20575\n // use Page Visibility API to avoid large time delta values\n connect() {\n if (this._usePageVisibilityAPI) {\n this._pageVisibilityHandler = handleVisibilityChange.bind(this);\n document.addEventListener(\"visibilitychange\", this._pageVisibilityHandler, false);\n }\n return this;\n }\n dispose() {\n if (this._usePageVisibilityAPI && this._pageVisibilityHandler) {\n document.removeEventListener(\"visibilitychange\", this._pageVisibilityHandler);\n }\n return this;\n }\n disableFixedDelta() {\n this._useFixedDelta = false;\n return this;\n }\n enableFixedDelta() {\n this._useFixedDelta = true;\n return this;\n }\n getDelta() {\n return this._delta / 1e3;\n }\n getElapsedTime() {\n return this._elapsed / 1e3;\n }\n getFixedDelta() {\n return this._fixedDelta / 1e3;\n }\n getTimescale() {\n return this._timescale;\n }\n reset() {\n this._currentTime = this._now();\n return this;\n }\n setFixedDelta(fixedDelta) {\n this._fixedDelta = fixedDelta * 1e3;\n return this;\n }\n setTimescale(timescale) {\n this._timescale = timescale;\n return this;\n }\n update() {\n if (this._useFixedDelta === true) {\n this._delta = this._fixedDelta;\n } else {\n this._previousTime = this._currentTime;\n this._currentTime = this._now();\n this._delta = this._currentTime - this._previousTime;\n }\n this._delta *= this._timescale;\n this._elapsed += this._delta;\n return this;\n }\n // For THREE.Clock backward compatibility\n get elapsedTime() {\n return this.getElapsedTime();\n }\n // private\n _now() {\n return (typeof performance === \"undefined\" ? Date : performance).now();\n }\n}\nfunction handleVisibilityChange() {\n if (document.hidden === false)\n this.reset();\n}\nlet webGLAvailable, webGL2Available;\nfunction isWebGLAvailable() {\n var _a2;\n if (webGLAvailable !== void 0)\n return webGLAvailable;\n try {\n let gl;\n const canvas = document.createElement(\"canvas\");\n webGLAvailable = !!(window.WebGLRenderingContext && (gl = canvas.getContext(\"webgl\")));\n if (gl)\n (_a2 = gl.getExtension(\"WEBGL_lose_context\")) == null ? void 0 : _a2.loseContext();\n return webGLAvailable;\n } catch (e) {\n return webGLAvailable = false;\n }\n}\nfunction isWebGL2Available() {\n var _a2;\n if (webGL2Available !== void 0)\n return webGL2Available;\n try {\n let gl;\n const canvas = document.createElement(\"canvas\");\n webGL2Available = !!(window.WebGL2RenderingContext && (gl = canvas.getContext(\"webgl2\")));\n if (gl)\n (_a2 = gl.getExtension(\"WEBGL_lose_context\")) == null ? void 0 : _a2.loseContext();\n return webGL2Available;\n } catch (e) {\n return webGL2Available = false;\n }\n}\nfunction getWebGLErrorMessage() {\n return getErrorMessage(1);\n}\nfunction getWebGL2ErrorMessage() {\n return getErrorMessage(2);\n}\nfunction getErrorMessage(version2) {\n const names = {\n 1: \"WebGL\",\n 2: \"WebGL 2\"\n };\n const contexts = {\n 1: window.WebGLRenderingContext,\n 2: window.WebGL2RenderingContext\n };\n const element = document.createElement(\"div\");\n element.id = \"webglmessage\";\n element.style.fontFamily = \"monospace\";\n element.style.fontSize = \"13px\";\n element.style.fontWeight = \"normal\";\n element.style.textAlign = \"center\";\n element.style.background = \"#fff\";\n element.style.color = \"#000\";\n element.style.padding = \"1.5em\";\n element.style.width = \"400px\";\n element.style.margin = \"5em auto 0\";\n let message = 'Your $0 does not seem to support $1';\n if (contexts[version2]) {\n message = message.replace(\"$0\", \"graphics card\");\n } else {\n message = message.replace(\"$0\", \"browser\");\n }\n message = message.replace(\"$1\", names[version2]);\n element.innerHTML = message;\n return element;\n}\nclass MD2Character {\n constructor() {\n this.scale = 1;\n this.animationFPS = 6;\n this.root = new three__WEBPACK_IMPORTED_MODULE_42__.Object3D();\n this.meshBody = null;\n this.meshWeapon = null;\n this.skinsBody = [];\n this.skinsWeapon = [];\n this.weapons = [];\n this.activeAnimation = null;\n this.mixer = null;\n this.onLoadComplete = function() {\n };\n this.loadCounter = 0;\n }\n loadParts(config) {\n const scope = this;\n function createPart(geometry2, skinMap) {\n const materialWireframe = new three__WEBPACK_IMPORTED_MODULE_42__.MeshLambertMaterial({\n color: 16755200,\n wireframe: true,\n morphTargets: true,\n morphNormals: true\n });\n const materialTexture = new three__WEBPACK_IMPORTED_MODULE_42__.MeshLambertMaterial({\n color: 16777215,\n wireframe: false,\n map: skinMap,\n morphTargets: true,\n morphNormals: true\n });\n const mesh = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(geometry2, materialTexture);\n mesh.rotation.y = -Math.PI / 2;\n mesh.castShadow = true;\n mesh.receiveShadow = true;\n mesh.materialTexture = materialTexture;\n mesh.materialWireframe = materialWireframe;\n return mesh;\n }\n function loadTextures(baseUrl, textureUrls) {\n const textureLoader = new three__WEBPACK_IMPORTED_MODULE_42__.TextureLoader();\n const textures = [];\n for (let i2 = 0; i2 < textureUrls.length; i2++) {\n textures[i2] = textureLoader.load(baseUrl + textureUrls[i2], checkLoadingComplete);\n textures[i2].mapping = three__WEBPACK_IMPORTED_MODULE_42__.UVMapping;\n textures[i2].name = textureUrls[i2];\n if (\"colorSpace\" in textures[i2])\n textures[i2].colorSpace = \"srgb\";\n else\n textures[i2].encoding = 3001;\n }\n return textures;\n }\n function checkLoadingComplete() {\n scope.loadCounter -= 1;\n if (scope.loadCounter === 0)\n scope.onLoadComplete();\n }\n this.loadCounter = config.weapons.length * 2 + config.skins.length + 1;\n const weaponsTextures = [];\n for (let i2 = 0; i2 < config.weapons.length; i2++)\n weaponsTextures[i2] = config.weapons[i2][1];\n this.skinsBody = loadTextures(config.baseUrl + \"skins/\", config.skins);\n this.skinsWeapon = loadTextures(config.baseUrl + \"skins/\", weaponsTextures);\n const loader = new MD2Loader();\n loader.load(config.baseUrl + config.body, function(geo) {\n const boundingBox = new three__WEBPACK_IMPORTED_MODULE_42__.Box3();\n boundingBox.setFromBufferAttribute(geo.attributes.position);\n scope.root.position.y = -scope.scale * boundingBox.min.y;\n const mesh = createPart(geo, scope.skinsBody[0]);\n mesh.scale.set(scope.scale, scope.scale, scope.scale);\n scope.root.add(mesh);\n scope.meshBody = mesh;\n scope.meshBody.clipOffset = 0;\n scope.activeAnimationClipName = mesh.geometry.animations[0].name;\n scope.mixer = new three__WEBPACK_IMPORTED_MODULE_42__.AnimationMixer(mesh);\n checkLoadingComplete();\n });\n const generateCallback = function(index, name) {\n return function(geo) {\n const mesh = createPart(geo, scope.skinsWeapon[index]);\n mesh.scale.set(scope.scale, scope.scale, scope.scale);\n mesh.visible = false;\n mesh.name = name;\n scope.root.add(mesh);\n scope.weapons[index] = mesh;\n scope.meshWeapon = mesh;\n checkLoadingComplete();\n };\n };\n for (let i2 = 0; i2 < config.weapons.length; i2++) {\n loader.load(config.baseUrl + config.weapons[i2][0], generateCallback(i2, config.weapons[i2][0]));\n }\n }\n setPlaybackRate(rate) {\n if (rate !== 0) {\n this.mixer.timeScale = 1 / rate;\n } else {\n this.mixer.timeScale = 0;\n }\n }\n setWireframe(wireframeEnabled) {\n if (wireframeEnabled) {\n if (this.meshBody)\n this.meshBody.material = this.meshBody.materialWireframe;\n if (this.meshWeapon)\n this.meshWeapon.material = this.meshWeapon.materialWireframe;\n } else {\n if (this.meshBody)\n this.meshBody.material = this.meshBody.materialTexture;\n if (this.meshWeapon)\n this.meshWeapon.material = this.meshWeapon.materialTexture;\n }\n }\n setSkin(index) {\n if (this.meshBody && this.meshBody.material.wireframe === false) {\n this.meshBody.material.map = this.skinsBody[index];\n }\n }\n setWeapon(index) {\n for (let i2 = 0; i2 < this.weapons.length; i2++)\n this.weapons[i2].visible = false;\n const activeWeapon = this.weapons[index];\n if (activeWeapon) {\n activeWeapon.visible = true;\n this.meshWeapon = activeWeapon;\n this.syncWeaponAnimation();\n }\n }\n setAnimation(clipName) {\n if (this.meshBody) {\n if (this.meshBody.activeAction) {\n this.meshBody.activeAction.stop();\n this.meshBody.activeAction = null;\n }\n const action = this.mixer.clipAction(clipName, this.meshBody);\n if (action) {\n this.meshBody.activeAction = action.play();\n }\n }\n this.activeClipName = clipName;\n this.syncWeaponAnimation();\n }\n syncWeaponAnimation() {\n const clipName = this.activeClipName;\n if (this.meshWeapon) {\n if (this.meshWeapon.activeAction) {\n this.meshWeapon.activeAction.stop();\n this.meshWeapon.activeAction = null;\n }\n const action = this.mixer.clipAction(clipName, this.meshWeapon);\n if (action) {\n this.meshWeapon.activeAction = action.syncWith(this.meshBody.activeAction).play();\n }\n }\n }\n update(delta) {\n if (this.mixer)\n this.mixer.update(delta);\n }\n}\nclass VolumeSlice {\n constructor(volume, index, axis) {\n const slice2 = this;\n this.volume = volume;\n index = index || 0;\n Object.defineProperty(this, \"index\", {\n get: function() {\n return index;\n },\n set: function(value) {\n index = value;\n slice2.geometryNeedsUpdate = true;\n return index;\n }\n });\n this.axis = axis || \"z\";\n this.canvas = document.createElement(\"canvas\");\n this.canvasBuffer = document.createElement(\"canvas\");\n this.updateGeometry();\n const canvasMap = new three__WEBPACK_IMPORTED_MODULE_42__.Texture(this.canvas);\n canvasMap.minFilter = three__WEBPACK_IMPORTED_MODULE_42__.LinearFilter;\n canvasMap.wrapS = canvasMap.wrapT = three__WEBPACK_IMPORTED_MODULE_42__.ClampToEdgeWrapping;\n if (\"colorSpace\" in canvasMap)\n canvasMap.colorSpace = \"srgb\";\n else\n canvasMap.encoding = 3001;\n const material2 = new three__WEBPACK_IMPORTED_MODULE_42__.MeshBasicMaterial({ map: canvasMap, side: three__WEBPACK_IMPORTED_MODULE_42__.DoubleSide, transparent: true });\n this.mesh = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(this.geometry, material2);\n this.mesh.matrixAutoUpdate = false;\n this.geometryNeedsUpdate = true;\n this.repaint();\n }\n /**\n * @member {Function} repaint Refresh the texture and the geometry if geometryNeedsUpdate is set to true\n * @memberof VolumeSlice\n */\n repaint() {\n if (this.geometryNeedsUpdate) {\n this.updateGeometry();\n }\n const iLength = this.iLength, jLength = this.jLength, sliceAccess = this.sliceAccess, volume = this.volume, canvas = this.canvasBuffer, ctx = this.ctxBuffer;\n const imgData = ctx.getImageData(0, 0, iLength, jLength);\n const data = imgData.data;\n const volumeData = volume.data;\n const upperThreshold = volume.upperThreshold;\n const lowerThreshold = volume.lowerThreshold;\n const windowLow = volume.windowLow;\n const windowHigh = volume.windowHigh;\n let pixelCount = 0;\n if (volume.dataType === \"label\") {\n for (let j = 0; j < jLength; j++) {\n for (let i2 = 0; i2 < iLength; i2++) {\n let label = volumeData[sliceAccess(i2, j)];\n label = label >= this.colorMap.length ? label % this.colorMap.length + 1 : label;\n const color = this.colorMap[label];\n data[4 * pixelCount] = color >> 24 & 255;\n data[4 * pixelCount + 1] = color >> 16 & 255;\n data[4 * pixelCount + 2] = color >> 8 & 255;\n data[4 * pixelCount + 3] = color & 255;\n pixelCount++;\n }\n }\n } else {\n for (let j = 0; j < jLength; j++) {\n for (let i2 = 0; i2 < iLength; i2++) {\n let value = volumeData[sliceAccess(i2, j)];\n let alpha = 255;\n alpha = upperThreshold >= value ? lowerThreshold <= value ? alpha : 0 : 0;\n value = Math.floor(255 * (value - windowLow) / (windowHigh - windowLow));\n value = value > 255 ? 255 : value < 0 ? 0 : value | 0;\n data[4 * pixelCount] = value;\n data[4 * pixelCount + 1] = value;\n data[4 * pixelCount + 2] = value;\n data[4 * pixelCount + 3] = alpha;\n pixelCount++;\n }\n }\n }\n ctx.putImageData(imgData, 0, 0);\n this.ctx.drawImage(canvas, 0, 0, iLength, jLength, 0, 0, this.canvas.width, this.canvas.height);\n this.mesh.material.map.needsUpdate = true;\n }\n /**\n * @member {Function} Refresh the geometry according to axis and index\n * @see Volume.extractPerpendicularPlane\n * @memberof VolumeSlice\n */\n updateGeometry() {\n const extracted = this.volume.extractPerpendicularPlane(this.axis, this.index);\n this.sliceAccess = extracted.sliceAccess;\n this.jLength = extracted.jLength;\n this.iLength = extracted.iLength;\n this.matrix = extracted.matrix;\n this.canvas.width = extracted.planeWidth;\n this.canvas.height = extracted.planeHeight;\n this.canvasBuffer.width = this.iLength;\n this.canvasBuffer.height = this.jLength;\n this.ctx = this.canvas.getContext(\"2d\");\n this.ctxBuffer = this.canvasBuffer.getContext(\"2d\");\n if (this.geometry)\n this.geometry.dispose();\n this.geometry = new three__WEBPACK_IMPORTED_MODULE_42__.PlaneGeometry(extracted.planeWidth, extracted.planeHeight);\n if (this.mesh) {\n this.mesh.geometry = this.geometry;\n this.mesh.matrix.identity();\n this.mesh.applyMatrix4(this.matrix);\n }\n this.geometryNeedsUpdate = false;\n }\n}\nfunction TubePainter() {\n const BUFFER_SIZE = 1e6 * 3;\n const positions = new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(new Float32Array(BUFFER_SIZE), 3);\n positions.usage = three__WEBPACK_IMPORTED_MODULE_42__.DynamicDrawUsage;\n const normals = new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(new Float32Array(BUFFER_SIZE), 3);\n normals.usage = three__WEBPACK_IMPORTED_MODULE_42__.DynamicDrawUsage;\n const colors = new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(new Float32Array(BUFFER_SIZE), 3);\n colors.usage = three__WEBPACK_IMPORTED_MODULE_42__.DynamicDrawUsage;\n const geometry2 = new three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry();\n geometry2.setAttribute(\"position\", positions);\n geometry2.setAttribute(\"normal\", normals);\n geometry2.setAttribute(\"color\", colors);\n geometry2.drawRange.count = 0;\n const material2 = new three__WEBPACK_IMPORTED_MODULE_42__.MeshStandardMaterial({\n vertexColors: true\n });\n const mesh = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(geometry2, material2);\n mesh.frustumCulled = false;\n function getPoints(size3) {\n const PI2 = Math.PI * 2;\n const sides = 10;\n const array = [];\n const radius = 0.01 * size3;\n for (let i2 = 0; i2 < sides; i2++) {\n const angle = i2 / sides * PI2;\n array.push(new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(Math.sin(angle) * radius, Math.cos(angle) * radius, 0));\n }\n return array;\n }\n const vector1 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const vector2 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const vector3 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const vector4 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const color = new three__WEBPACK_IMPORTED_MODULE_42__.Color(16777215);\n let size2 = 1;\n function stroke(position1, position2, matrix12, matrix22) {\n if (position1.distanceToSquared(position2) === 0)\n return;\n let count2 = geometry2.drawRange.count;\n const points = getPoints(size2);\n for (let i2 = 0, il = points.length; i2 < il; i2++) {\n const vertex1 = points[i2];\n const vertex2 = points[(i2 + 1) % il];\n vector1.copy(vertex1).applyMatrix4(matrix22).add(position2);\n vector2.copy(vertex2).applyMatrix4(matrix22).add(position2);\n vector3.copy(vertex2).applyMatrix4(matrix12).add(position1);\n vector4.copy(vertex1).applyMatrix4(matrix12).add(position1);\n vector1.toArray(positions.array, (count2 + 0) * 3);\n vector2.toArray(positions.array, (count2 + 1) * 3);\n vector4.toArray(positions.array, (count2 + 2) * 3);\n vector2.toArray(positions.array, (count2 + 3) * 3);\n vector3.toArray(positions.array, (count2 + 4) * 3);\n vector4.toArray(positions.array, (count2 + 5) * 3);\n vector1.copy(vertex1).applyMatrix4(matrix22).normalize();\n vector2.copy(vertex2).applyMatrix4(matrix22).normalize();\n vector3.copy(vertex2).applyMatrix4(matrix12).normalize();\n vector4.copy(vertex1).applyMatrix4(matrix12).normalize();\n vector1.toArray(normals.array, (count2 + 0) * 3);\n vector2.toArray(normals.array, (count2 + 1) * 3);\n vector4.toArray(normals.array, (count2 + 2) * 3);\n vector2.toArray(normals.array, (count2 + 3) * 3);\n vector3.toArray(normals.array, (count2 + 4) * 3);\n vector4.toArray(normals.array, (count2 + 5) * 3);\n color.toArray(colors.array, (count2 + 0) * 3);\n color.toArray(colors.array, (count2 + 1) * 3);\n color.toArray(colors.array, (count2 + 2) * 3);\n color.toArray(colors.array, (count2 + 3) * 3);\n color.toArray(colors.array, (count2 + 4) * 3);\n color.toArray(colors.array, (count2 + 5) * 3);\n count2 += 6;\n }\n geometry2.drawRange.count = count2;\n }\n const up = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 1, 0);\n const point1 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const point2 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const matrix1 = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n const matrix2 = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n function moveTo(position) {\n point1.copy(position);\n matrix1.lookAt(point2, point1, up);\n point2.copy(position);\n matrix2.copy(matrix1);\n }\n function lineTo(position) {\n point1.copy(position);\n matrix1.lookAt(point2, point1, up);\n stroke(point1, point2, matrix1, matrix2);\n point2.copy(point1);\n matrix2.copy(matrix1);\n }\n function setSize(value) {\n size2 = value;\n }\n let count = 0;\n function update() {\n const start = count;\n const end = geometry2.drawRange.count;\n if (start === end)\n return;\n positions.updateRange.offset = start * 3;\n positions.updateRange.count = (end - start) * 3;\n positions.needsUpdate = true;\n normals.updateRange.offset = start * 3;\n normals.updateRange.count = (end - start) * 3;\n normals.needsUpdate = true;\n colors.updateRange.offset = start * 3;\n colors.updateRange.count = (end - start) * 3;\n colors.needsUpdate = true;\n count = geometry2.drawRange.count;\n }\n return {\n mesh,\n moveTo,\n lineTo,\n setSize,\n update\n };\n}\nclass Volume {\n constructor(xLength, yLength, zLength, type, arrayBuffer) {\n if (xLength !== void 0) {\n this.xLength = Number(xLength) || 1;\n this.yLength = Number(yLength) || 1;\n this.zLength = Number(zLength) || 1;\n this.axisOrder = [\"x\", \"y\", \"z\"];\n switch (type) {\n case \"Uint8\":\n case \"uint8\":\n case \"uchar\":\n case \"unsigned char\":\n case \"uint8_t\":\n this.data = new Uint8Array(arrayBuffer);\n break;\n case \"Int8\":\n case \"int8\":\n case \"signed char\":\n case \"int8_t\":\n this.data = new Int8Array(arrayBuffer);\n break;\n case \"Int16\":\n case \"int16\":\n case \"short\":\n case \"short int\":\n case \"signed short\":\n case \"signed short int\":\n case \"int16_t\":\n this.data = new Int16Array(arrayBuffer);\n break;\n case \"Uint16\":\n case \"uint16\":\n case \"ushort\":\n case \"unsigned short\":\n case \"unsigned short int\":\n case \"uint16_t\":\n this.data = new Uint16Array(arrayBuffer);\n break;\n case \"Int32\":\n case \"int32\":\n case \"int\":\n case \"signed int\":\n case \"int32_t\":\n this.data = new Int32Array(arrayBuffer);\n break;\n case \"Uint32\":\n case \"uint32\":\n case \"uint\":\n case \"unsigned int\":\n case \"uint32_t\":\n this.data = new Uint32Array(arrayBuffer);\n break;\n case \"longlong\":\n case \"long long\":\n case \"long long int\":\n case \"signed long long\":\n case \"signed long long int\":\n case \"int64\":\n case \"int64_t\":\n case \"ulonglong\":\n case \"unsigned long long\":\n case \"unsigned long long int\":\n case \"uint64\":\n case \"uint64_t\":\n throw new Error(\"Error in Volume constructor : this type is not supported in JavaScript\");\n case \"Float32\":\n case \"float32\":\n case \"float\":\n this.data = new Float32Array(arrayBuffer);\n break;\n case \"Float64\":\n case \"float64\":\n case \"double\":\n this.data = new Float64Array(arrayBuffer);\n break;\n default:\n this.data = new Uint8Array(arrayBuffer);\n }\n if (this.data.length !== this.xLength * this.yLength * this.zLength) {\n throw new Error(\"Error in Volume constructor, lengths are not matching arrayBuffer size\");\n }\n }\n this.spacing = [1, 1, 1];\n this.offset = [0, 0, 0];\n this.matrix = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix3();\n this.matrix.identity();\n let lowerThreshold = -Infinity;\n Object.defineProperty(this, \"lowerThreshold\", {\n get: function() {\n return lowerThreshold;\n },\n set: function(value) {\n lowerThreshold = value;\n this.sliceList.forEach(function(slice2) {\n slice2.geometryNeedsUpdate = true;\n });\n }\n });\n let upperThreshold = Infinity;\n Object.defineProperty(this, \"upperThreshold\", {\n get: function() {\n return upperThreshold;\n },\n set: function(value) {\n upperThreshold = value;\n this.sliceList.forEach(function(slice2) {\n slice2.geometryNeedsUpdate = true;\n });\n }\n });\n this.sliceList = [];\n this.segmentation = false;\n }\n /**\n * @member {Function} getData Shortcut for data[access(i,j,k)]\n * @memberof Volume\n * @param {number} i First coordinate\n * @param {number} j Second coordinate\n * @param {number} k Third coordinate\n * @returns {number} value in the data array\n */\n getData(i2, j, k) {\n return this.data[k * this.xLength * this.yLength + j * this.xLength + i2];\n }\n /**\n * @member {Function} access compute the index in the data array corresponding to the given coordinates in IJK system\n * @memberof Volume\n * @param {number} i First coordinate\n * @param {number} j Second coordinate\n * @param {number} k Third coordinate\n * @returns {number} index\n */\n access(i2, j, k) {\n return k * this.xLength * this.yLength + j * this.xLength + i2;\n }\n /**\n * @member {Function} reverseAccess Retrieve the IJK coordinates of the voxel corresponding of the given index in the data\n * @memberof Volume\n * @param {number} index index of the voxel\n * @returns {Array} [x,y,z]\n */\n reverseAccess(index) {\n const z = Math.floor(index / (this.yLength * this.xLength));\n const y = Math.floor((index - z * this.yLength * this.xLength) / this.xLength);\n const x = index - z * this.yLength * this.xLength - y * this.xLength;\n return [x, y, z];\n }\n /**\n * @member {Function} map Apply a function to all the voxels, be careful, the value will be replaced\n * @memberof Volume\n * @param {Function} functionToMap A function to apply to every voxel, will be called with the following parameters :\n * value of the voxel\n * index of the voxel\n * the data (TypedArray)\n * @param {Object} context You can specify a context in which call the function, default if this Volume\n * @returns {Volume} this\n */\n map(functionToMap, context) {\n const length = this.data.length;\n context = context || this;\n for (let i2 = 0; i2 < length; i2++) {\n this.data[i2] = functionToMap.call(context, this.data[i2], i2, this.data);\n }\n return this;\n }\n /**\n * @member {Function} extractPerpendicularPlane Compute the orientation of the slice and returns all the information relative to the geometry such as sliceAccess, the plane matrix (orientation and position in RAS coordinate) and the dimensions of the plane in both coordinate system.\n * @memberof Volume\n * @param {string} axis the normal axis to the slice 'x' 'y' or 'z'\n * @param {number} index the index of the slice\n * @returns {Object} an object containing all the usefull information on the geometry of the slice\n */\n extractPerpendicularPlane(axis, RASIndex) {\n let firstSpacing, secondSpacing, positionOffset, IJKIndex;\n const axisInIJK = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(), firstDirection = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(), secondDirection = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(), planeMatrix = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4().identity(), volume = this;\n const dimensions = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(this.xLength, this.yLength, this.zLength);\n switch (axis) {\n case \"x\":\n axisInIJK.set(1, 0, 0);\n firstDirection.set(0, 0, -1);\n secondDirection.set(0, -1, 0);\n firstSpacing = this.spacing[this.axisOrder.indexOf(\"z\")];\n secondSpacing = this.spacing[this.axisOrder.indexOf(\"y\")];\n IJKIndex = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(RASIndex, 0, 0);\n planeMatrix.multiply(new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4().makeRotationY(Math.PI / 2));\n positionOffset = (volume.RASDimensions[0] - 1) / 2;\n planeMatrix.setPosition(new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(RASIndex - positionOffset, 0, 0));\n break;\n case \"y\":\n axisInIJK.set(0, 1, 0);\n firstDirection.set(1, 0, 0);\n secondDirection.set(0, 0, 1);\n firstSpacing = this.spacing[this.axisOrder.indexOf(\"x\")];\n secondSpacing = this.spacing[this.axisOrder.indexOf(\"z\")];\n IJKIndex = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, RASIndex, 0);\n planeMatrix.multiply(new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4().makeRotationX(-Math.PI / 2));\n positionOffset = (volume.RASDimensions[1] - 1) / 2;\n planeMatrix.setPosition(new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, RASIndex - positionOffset, 0));\n break;\n case \"z\":\n default:\n axisInIJK.set(0, 0, 1);\n firstDirection.set(1, 0, 0);\n secondDirection.set(0, -1, 0);\n firstSpacing = this.spacing[this.axisOrder.indexOf(\"x\")];\n secondSpacing = this.spacing[this.axisOrder.indexOf(\"y\")];\n IJKIndex = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 0, RASIndex);\n positionOffset = (volume.RASDimensions[2] - 1) / 2;\n planeMatrix.setPosition(new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 0, RASIndex - positionOffset));\n break;\n }\n let iLength, jLength;\n if (!this.segmentation) {\n firstDirection.applyMatrix4(volume.inverseMatrix).normalize();\n secondDirection.applyMatrix4(volume.inverseMatrix).normalize();\n axisInIJK.applyMatrix4(volume.inverseMatrix).normalize();\n }\n firstDirection.arglet = \"i\";\n secondDirection.arglet = \"j\";\n iLength = Math.floor(Math.abs(firstDirection.dot(dimensions)));\n jLength = Math.floor(Math.abs(secondDirection.dot(dimensions)));\n const planeWidth = Math.abs(iLength * firstSpacing);\n const planeHeight = Math.abs(jLength * secondSpacing);\n IJKIndex = Math.abs(Math.round(IJKIndex.applyMatrix4(volume.inverseMatrix).dot(axisInIJK)));\n const base = [new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(1, 0, 0), new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 1, 0), new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 0, 1)];\n const iDirection = [firstDirection, secondDirection, axisInIJK].find(function(x) {\n return Math.abs(x.dot(base[0])) > 0.9;\n });\n const jDirection = [firstDirection, secondDirection, axisInIJK].find(function(x) {\n return Math.abs(x.dot(base[1])) > 0.9;\n });\n const kDirection = [firstDirection, secondDirection, axisInIJK].find(function(x) {\n return Math.abs(x.dot(base[2])) > 0.9;\n });\n function sliceAccess(i2, j) {\n const si = iDirection === axisInIJK ? IJKIndex : iDirection.arglet === \"i\" ? i2 : j;\n const sj = jDirection === axisInIJK ? IJKIndex : jDirection.arglet === \"i\" ? i2 : j;\n const sk = kDirection === axisInIJK ? IJKIndex : kDirection.arglet === \"i\" ? i2 : j;\n const accessI = iDirection.dot(base[0]) > 0 ? si : volume.xLength - 1 - si;\n const accessJ = jDirection.dot(base[1]) > 0 ? sj : volume.yLength - 1 - sj;\n const accessK = kDirection.dot(base[2]) > 0 ? sk : volume.zLength - 1 - sk;\n return volume.access(accessI, accessJ, accessK);\n }\n return {\n iLength,\n jLength,\n sliceAccess,\n matrix: planeMatrix,\n planeWidth,\n planeHeight\n };\n }\n /**\n * @member {Function} extractSlice Returns a slice corresponding to the given axis and index\n * The coordinate are given in the Right Anterior Superior coordinate format\n * @memberof Volume\n * @param {string} axis the normal axis to the slice 'x' 'y' or 'z'\n * @param {number} index the index of the slice\n * @returns {VolumeSlice} the extracted slice\n */\n extractSlice(axis, index) {\n const slice2 = new VolumeSlice(this, index, axis);\n this.sliceList.push(slice2);\n return slice2;\n }\n /**\n * @member {Function} repaintAllSlices Call repaint on all the slices extracted from this volume\n * @see VolumeSlice.repaint\n * @memberof Volume\n * @returns {Volume} this\n */\n repaintAllSlices() {\n this.sliceList.forEach(function(slice2) {\n slice2.repaint();\n });\n return this;\n }\n /**\n * @member {Function} computeMinMax Compute the minimum and the maximum of the data in the volume\n * @memberof Volume\n * @returns {Array} [min,max]\n */\n computeMinMax() {\n let min = Infinity;\n let max = -Infinity;\n const datasize = this.data.length;\n let i2 = 0;\n for (i2 = 0; i2 < datasize; i2++) {\n if (!isNaN(this.data[i2])) {\n const value = this.data[i2];\n min = Math.min(min, value);\n max = Math.max(max, value);\n }\n }\n this.min = min;\n this.max = max;\n return [min, max];\n }\n}\nclass ProgressiveLightMap {\n constructor(renderer, res = 1024) {\n this.renderer = renderer;\n this.res = res;\n this.lightMapContainers = [];\n this.compiled = false;\n this.scene = new three__WEBPACK_IMPORTED_MODULE_42__.Scene();\n this.scene.background = null;\n this.tinyTarget = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(1, 1);\n this.buffer1Active = false;\n this.firstUpdate = true;\n this.warned = false;\n const format = /(Android|iPad|iPhone|iPod)/g.test(navigator.userAgent) ? alfFloatType : three__WEBPACK_IMPORTED_MODULE_42__.FloatType;\n this.progressiveLightMap1 = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(this.res, this.res, { type: format });\n this.progressiveLightMap2 = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(this.res, this.res, { type: format });\n this.uvMat = new three__WEBPACK_IMPORTED_MODULE_42__.MeshPhongMaterial();\n this.uvMat.uniforms = {};\n this.uvMat.onBeforeCompile = (shader) => {\n shader.vertexShader = \"#define USE_LIGHTMAP\\n\" + shader.vertexShader.slice(0, -1) + \"\tgl_Position = vec4((uv2 - 0.5) * 2.0, 1.0, 1.0); }\";\n const bodyStart = shader.fragmentShader.indexOf(\"void main() {\");\n shader.fragmentShader = \"varying vec2 vUv2;\\n\" + shader.fragmentShader.slice(0, bodyStart) + \"\tuniform sampler2D previousShadowMap;\\n\tuniform float averagingWindow;\\n\" + shader.fragmentShader.slice(bodyStart - 1, -1) + `\nvec3 texelOld = texture2D(previousShadowMap, vUv2).rgb;\n\t\t\t\tgl_FragColor.rgb = mix(texelOld, gl_FragColor.rgb, 1.0/averagingWindow);\n\t\t\t}`;\n shader.uniforms.previousShadowMap = { value: this.progressiveLightMap1.texture };\n shader.uniforms.averagingWindow = { value: 100 };\n this.uvMat.uniforms = shader.uniforms;\n this.uvMat.userData.shader = shader;\n this.compiled = true;\n };\n }\n /**\n * Sets these objects' materials' lightmaps and modifies their uv2's.\n * @param {Object3D} objects An array of objects and lights to set up your lightmap.\n */\n addObjectsToLightMap(objects) {\n this.uv_boxes = [];\n const padding = 3 / this.res;\n for (let ob = 0; ob < objects.length; ob++) {\n const object = objects[ob];\n if (object.isLight) {\n this.scene.attach(object);\n continue;\n }\n if (!object.geometry.hasAttribute(\"uv\")) {\n console.warn(\"All lightmap objects need UVs!\");\n continue;\n }\n if (this.blurringPlane == null) {\n this._initializeBlurPlane(this.res, this.progressiveLightMap1);\n }\n object.material.lightMap = this.progressiveLightMap2.texture;\n object.material.dithering = true;\n object.castShadow = true;\n object.receiveShadow = true;\n object.renderOrder = 1e3 + ob;\n this.uv_boxes.push({ w: 1 + padding * 2, h: 1 + padding * 2, index: ob });\n this.lightMapContainers.push({ basicMat: object.material, object });\n this.compiled = false;\n }\n const dimensions = (0,potpack__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(this.uv_boxes);\n this.uv_boxes.forEach((box) => {\n const uv2 = objects[box.index].geometry.getAttribute(\"uv\").clone();\n for (let i2 = 0; i2 < uv2.array.length; i2 += uv2.itemSize) {\n uv2.array[i2] = (uv2.array[i2] + box.x + padding) / dimensions.w;\n uv2.array[i2 + 1] = (uv2.array[i2 + 1] + box.y + padding) / dimensions.h;\n }\n objects[box.index].geometry.setAttribute(\"uv2\", uv2);\n objects[box.index].geometry.getAttribute(\"uv2\").needsUpdate = true;\n });\n }\n /**\n * This function renders each mesh one at a time into their respective surface maps\n * @param {Camera} camera Standard Rendering Camera\n * @param {number} blendWindow When >1, samples will accumulate over time.\n * @param {boolean} blurEdges Whether to fix UV Edges via blurring\n */\n update(camera, blendWindow = 100, blurEdges = true) {\n if (this.blurringPlane == null) {\n return;\n }\n const oldTarget = this.renderer.getRenderTarget();\n this.blurringPlane.visible = blurEdges;\n for (let l = 0; l < this.lightMapContainers.length; l++) {\n this.lightMapContainers[l].object.oldScene = this.lightMapContainers[l].object.parent;\n this.scene.attach(this.lightMapContainers[l].object);\n }\n if (this.firstUpdate) {\n this.renderer.setRenderTarget(this.tinyTarget);\n this.renderer.render(this.scene, camera);\n this.firstUpdate = false;\n }\n for (let l = 0; l < this.lightMapContainers.length; l++) {\n this.uvMat.uniforms.averagingWindow = { value: blendWindow };\n this.lightMapContainers[l].object.material = this.uvMat;\n this.lightMapContainers[l].object.oldFrustumCulled = this.lightMapContainers[l].object.frustumCulled;\n this.lightMapContainers[l].object.frustumCulled = false;\n }\n const activeMap = this.buffer1Active ? this.progressiveLightMap1 : this.progressiveLightMap2;\n const inactiveMap = this.buffer1Active ? this.progressiveLightMap2 : this.progressiveLightMap1;\n this.renderer.setRenderTarget(activeMap);\n this.uvMat.uniforms.previousShadowMap = { value: inactiveMap.texture };\n this.blurringPlane.material.uniforms.previousShadowMap = { value: inactiveMap.texture };\n this.buffer1Active = !this.buffer1Active;\n this.renderer.render(this.scene, camera);\n for (let l = 0; l < this.lightMapContainers.length; l++) {\n this.lightMapContainers[l].object.frustumCulled = this.lightMapContainers[l].object.oldFrustumCulled;\n this.lightMapContainers[l].object.material = this.lightMapContainers[l].basicMat;\n this.lightMapContainers[l].object.oldScene.attach(this.lightMapContainers[l].object);\n }\n this.renderer.setRenderTarget(oldTarget);\n }\n /** DEBUG\n * Draw the lightmap in the main scene. Call this after adding the objects to it.\n * @param {boolean} visible Whether the debug plane should be visible\n * @param {Vector3} position Where the debug plane should be drawn\n */\n showDebugLightmap(visible, position = void 0) {\n if (this.lightMapContainers.length == 0) {\n if (!this.warned) {\n console.warn(\"Call this after adding the objects!\");\n this.warned = true;\n }\n return;\n }\n if (this.labelMesh == null) {\n this.labelMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.MeshBasicMaterial({\n map: this.progressiveLightMap1.texture,\n side: three__WEBPACK_IMPORTED_MODULE_42__.DoubleSide\n });\n this.labelPlane = new three__WEBPACK_IMPORTED_MODULE_42__.PlaneGeometry(100, 100);\n this.labelMesh = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(this.labelPlane, this.labelMaterial);\n this.labelMesh.position.y = 250;\n this.lightMapContainers[0].object.parent.add(this.labelMesh);\n }\n if (position != void 0) {\n this.labelMesh.position.copy(position);\n }\n this.labelMesh.visible = visible;\n }\n /**\n * INTERNAL Creates the Blurring Plane\n * @param {number} res The square resolution of this object's lightMap.\n * @param {WebGLRenderTexture} lightMap The lightmap to initialize the plane with.\n */\n _initializeBlurPlane(res, lightMap = null) {\n const blurMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.MeshBasicMaterial();\n blurMaterial.uniforms = {\n previousShadowMap: { value: null },\n pixelOffset: { value: 1 / res },\n polygonOffset: true,\n polygonOffsetFactor: -1,\n polygonOffsetUnits: 3\n };\n blurMaterial.onBeforeCompile = (shader) => {\n shader.vertexShader = \"#define USE_UV\\n\" + shader.vertexShader.slice(0, -1) + \"\tgl_Position = vec4((uv - 0.5) * 2.0, 1.0, 1.0); }\";\n const bodyStart = shader.fragmentShader.indexOf(\"void main() {\");\n shader.fragmentShader = \"#define USE_UV\\n\" + shader.fragmentShader.slice(0, bodyStart) + \"\tuniform sampler2D previousShadowMap;\\n\tuniform float pixelOffset;\\n\" + shader.fragmentShader.slice(bodyStart - 1, -1) + `\tgl_FragColor.rgb = (\n\t\t\t texture2D(previousShadowMap, vUv + vec2( pixelOffset, 0.0 )).rgb +\n\t\t\t texture2D(previousShadowMap, vUv + vec2( 0.0 , pixelOffset)).rgb +\n\t\t\t texture2D(previousShadowMap, vUv + vec2( 0.0 , -pixelOffset)).rgb +\n\t\t\t texture2D(previousShadowMap, vUv + vec2(-pixelOffset, 0.0 )).rgb +\n\t\t\t texture2D(previousShadowMap, vUv + vec2( pixelOffset, pixelOffset)).rgb +\n\t\t\t texture2D(previousShadowMap, vUv + vec2(-pixelOffset, pixelOffset)).rgb +\n\t\t\t texture2D(previousShadowMap, vUv + vec2( pixelOffset, -pixelOffset)).rgb +\n\t\t\t texture2D(previousShadowMap, vUv + vec2(-pixelOffset, -pixelOffset)).rgb)/8.0;\n\t\t}`;\n shader.uniforms.previousShadowMap = { value: lightMap.texture };\n shader.uniforms.pixelOffset = { value: 0.5 / res };\n blurMaterial.uniforms = shader.uniforms;\n blurMaterial.userData.shader = shader;\n this.compiled = true;\n };\n this.blurringPlane = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.PlaneGeometry(1, 1), blurMaterial);\n this.blurringPlane.name = \"Blurring Plane\";\n this.blurringPlane.frustumCulled = false;\n this.blurringPlane.renderOrder = 0;\n this.blurringPlane.material.depthWrite = false;\n this.scene.add(this.blurringPlane);\n }\n}\nclass CSS2DObject extends three__WEBPACK_IMPORTED_MODULE_42__.Object3D {\n constructor(element = document.createElement(\"div\")) {\n super();\n this.isCSS2DObject = true;\n this.element = element;\n this.element.style.position = \"absolute\";\n this.element.style.userSelect = \"none\";\n this.element.setAttribute(\"draggable\", false);\n this.center = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(0.5, 0.5);\n this.addEventListener(\"removed\", function() {\n this.traverse(function(object) {\n if (object.element instanceof Element && object.element.parentNode !== null) {\n object.element.parentNode.removeChild(object.element);\n }\n });\n });\n }\n copy(source, recursive) {\n super.copy(source, recursive);\n this.element = source.element.cloneNode(true);\n this.center = source.center;\n return this;\n }\n}\nconst _vector$4 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst _viewMatrix = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\nconst _viewProjectionMatrix = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\nconst _a = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst _b = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nclass CSS2DRenderer {\n constructor(parameters = {}) {\n const _this = this;\n let _width, _height;\n let _widthHalf, _heightHalf;\n const cache = {\n objects: /* @__PURE__ */ new WeakMap()\n };\n const domElement = parameters.element !== void 0 ? parameters.element : document.createElement(\"div\");\n domElement.style.overflow = \"hidden\";\n this.domElement = domElement;\n this.getSize = function() {\n return {\n width: _width,\n height: _height\n };\n };\n this.render = function(scene, camera) {\n if (scene.matrixWorldAutoUpdate === true)\n scene.updateMatrixWorld();\n if (camera.parent === null && camera.matrixWorldAutoUpdate === true)\n camera.updateMatrixWorld();\n _viewMatrix.copy(camera.matrixWorldInverse);\n _viewProjectionMatrix.multiplyMatrices(camera.projectionMatrix, _viewMatrix);\n renderObject(scene, scene, camera);\n zOrder(scene);\n };\n this.setSize = function(width, height) {\n _width = width;\n _height = height;\n _widthHalf = _width / 2;\n _heightHalf = _height / 2;\n domElement.style.width = width + \"px\";\n domElement.style.height = height + \"px\";\n };\n function renderObject(object, scene, camera) {\n if (object.isCSS2DObject) {\n _vector$4.setFromMatrixPosition(object.matrixWorld);\n _vector$4.applyMatrix4(_viewProjectionMatrix);\n const visible = object.visible === true && _vector$4.z >= -1 && _vector$4.z <= 1 && object.layers.test(camera.layers) === true;\n object.element.style.display = visible === true ? \"\" : \"none\";\n if (visible === true) {\n object.onBeforeRender(_this, scene, camera);\n const element = object.element;\n element.style.transform = \"translate(\" + -100 * object.center.x + \"%,\" + -100 * object.center.y + \"%)translate(\" + (_vector$4.x * _widthHalf + _widthHalf) + \"px,\" + (-_vector$4.y * _heightHalf + _heightHalf) + \"px)\";\n if (element.parentNode !== domElement) {\n domElement.appendChild(element);\n }\n object.onAfterRender(_this, scene, camera);\n }\n const objectData = {\n distanceToCameraSquared: getDistanceToSquared(camera, object)\n };\n cache.objects.set(object, objectData);\n }\n for (let i2 = 0, l = object.children.length; i2 < l; i2++) {\n renderObject(object.children[i2], scene, camera);\n }\n }\n function getDistanceToSquared(object1, object2) {\n _a.setFromMatrixPosition(object1.matrixWorld);\n _b.setFromMatrixPosition(object2.matrixWorld);\n return _a.distanceToSquared(_b);\n }\n function filterAndFlatten(scene) {\n const result = [];\n scene.traverse(function(object) {\n if (object.isCSS2DObject)\n result.push(object);\n });\n return result;\n }\n function zOrder(scene) {\n const sorted = filterAndFlatten(scene).sort(function(a2, b2) {\n if (a2.renderOrder !== b2.renderOrder) {\n return b2.renderOrder - a2.renderOrder;\n }\n const distanceA = cache.objects.get(a2).distanceToCameraSquared;\n const distanceB = cache.objects.get(b2).distanceToCameraSquared;\n return distanceA - distanceB;\n });\n const zMax = sorted.length;\n for (let i2 = 0, l = sorted.length; i2 < l; i2++) {\n sorted[i2].element.style.zIndex = zMax - i2;\n }\n }\n }\n}\nconst _position$1 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst _quaternion$1 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion();\nconst _scale$1 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nclass CSS3DObject extends three__WEBPACK_IMPORTED_MODULE_42__.Object3D {\n constructor(element = document.createElement(\"div\")) {\n super();\n this.isCSS3DObject = true;\n this.element = element;\n this.element.style.position = \"absolute\";\n this.element.style.pointerEvents = \"auto\";\n this.element.style.userSelect = \"none\";\n this.element.setAttribute(\"draggable\", false);\n this.addEventListener(\"removed\", function() {\n this.traverse(function(object) {\n if (object.element instanceof Element && object.element.parentNode !== null) {\n object.element.parentNode.removeChild(object.element);\n }\n });\n });\n }\n copy(source, recursive) {\n super.copy(source, recursive);\n this.element = source.element.cloneNode(true);\n return this;\n }\n}\nclass CSS3DSprite extends CSS3DObject {\n constructor(element) {\n super(element);\n this.isCSS3DSprite = true;\n this.rotation2D = 0;\n }\n copy(source, recursive) {\n super.copy(source, recursive);\n this.rotation2D = source.rotation2D;\n return this;\n }\n}\nconst _matrix$2 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\nconst _matrix2 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\nclass CSS3DRenderer {\n constructor(parameters = {}) {\n const _this = this;\n let _width, _height;\n let _widthHalf, _heightHalf;\n const cache = {\n camera: { fov: 0, style: \"\" },\n objects: /* @__PURE__ */ new WeakMap()\n };\n const domElement = parameters.element !== void 0 ? parameters.element : document.createElement(\"div\");\n domElement.style.overflow = \"hidden\";\n this.domElement = domElement;\n const viewElement = document.createElement(\"div\");\n viewElement.style.transformOrigin = \"0 0\";\n viewElement.style.pointerEvents = \"none\";\n domElement.appendChild(viewElement);\n const cameraElement = document.createElement(\"div\");\n cameraElement.style.transformStyle = \"preserve-3d\";\n viewElement.appendChild(cameraElement);\n this.getSize = function() {\n return {\n width: _width,\n height: _height\n };\n };\n this.render = function(scene, camera) {\n const fov = camera.projectionMatrix.elements[5] * _heightHalf;\n if (cache.camera.fov !== fov) {\n viewElement.style.perspective = camera.isPerspectiveCamera ? fov + \"px\" : \"\";\n cache.camera.fov = fov;\n }\n if (camera.view && camera.view.enabled) {\n viewElement.style.transform = `translate( ${-camera.view.offsetX * (_width / camera.view.width)}px, ${-camera.view.offsetY * (_height / camera.view.height)}px )`;\n viewElement.style.transform += `scale( ${camera.view.fullWidth / camera.view.width}, ${camera.view.fullHeight / camera.view.height} )`;\n } else {\n viewElement.style.transform = \"\";\n }\n if (scene.matrixWorldAutoUpdate === true)\n scene.updateMatrixWorld();\n if (camera.parent === null && camera.matrixWorldAutoUpdate === true)\n camera.updateMatrixWorld();\n let tx, ty;\n if (camera.isOrthographicCamera) {\n tx = -(camera.right + camera.left) / 2;\n ty = (camera.top + camera.bottom) / 2;\n }\n const scaleByViewOffset = camera.view && camera.view.enabled ? camera.view.height / camera.view.fullHeight : 1;\n const cameraCSSMatrix = camera.isOrthographicCamera ? `scale( ${scaleByViewOffset} )scale(` + fov + \")translate(\" + epsilon(tx) + \"px,\" + epsilon(ty) + \"px)\" + getCameraCSSMatrix(camera.matrixWorldInverse) : `scale( ${scaleByViewOffset} )translateZ(` + fov + \"px)\" + getCameraCSSMatrix(camera.matrixWorldInverse);\n const style = cameraCSSMatrix + \"translate(\" + _widthHalf + \"px,\" + _heightHalf + \"px)\";\n if (cache.camera.style !== style) {\n cameraElement.style.transform = style;\n cache.camera.style = style;\n }\n renderObject(scene, scene, camera);\n };\n this.setSize = function(width, height) {\n _width = width;\n _height = height;\n _widthHalf = _width / 2;\n _heightHalf = _height / 2;\n domElement.style.width = width + \"px\";\n domElement.style.height = height + \"px\";\n viewElement.style.width = width + \"px\";\n viewElement.style.height = height + \"px\";\n cameraElement.style.width = width + \"px\";\n cameraElement.style.height = height + \"px\";\n };\n function epsilon(value) {\n return Math.abs(value) < 1e-10 ? 0 : value;\n }\n function getCameraCSSMatrix(matrix2) {\n const elements = matrix2.elements;\n return \"matrix3d(\" + epsilon(elements[0]) + \",\" + epsilon(-elements[1]) + \",\" + epsilon(elements[2]) + \",\" + epsilon(elements[3]) + \",\" + epsilon(elements[4]) + \",\" + epsilon(-elements[5]) + \",\" + epsilon(elements[6]) + \",\" + epsilon(elements[7]) + \",\" + epsilon(elements[8]) + \",\" + epsilon(-elements[9]) + \",\" + epsilon(elements[10]) + \",\" + epsilon(elements[11]) + \",\" + epsilon(elements[12]) + \",\" + epsilon(-elements[13]) + \",\" + epsilon(elements[14]) + \",\" + epsilon(elements[15]) + \")\";\n }\n function getObjectCSSMatrix(matrix2) {\n const elements = matrix2.elements;\n const matrix3d = \"matrix3d(\" + epsilon(elements[0]) + \",\" + epsilon(elements[1]) + \",\" + epsilon(elements[2]) + \",\" + epsilon(elements[3]) + \",\" + epsilon(-elements[4]) + \",\" + epsilon(-elements[5]) + \",\" + epsilon(-elements[6]) + \",\" + epsilon(-elements[7]) + \",\" + epsilon(elements[8]) + \",\" + epsilon(elements[9]) + \",\" + epsilon(elements[10]) + \",\" + epsilon(elements[11]) + \",\" + epsilon(elements[12]) + \",\" + epsilon(elements[13]) + \",\" + epsilon(elements[14]) + \",\" + epsilon(elements[15]) + \")\";\n return \"translate(-50%,-50%)\" + matrix3d;\n }\n function renderObject(object, scene, camera, cameraCSSMatrix) {\n if (object.isCSS3DObject) {\n const visible = object.visible === true && object.layers.test(camera.layers) === true;\n object.element.style.display = visible === true ? \"\" : \"none\";\n if (visible === true) {\n object.onBeforeRender(_this, scene, camera);\n let style;\n if (object.isCSS3DSprite) {\n _matrix$2.copy(camera.matrixWorldInverse);\n _matrix$2.transpose();\n if (object.rotation2D !== 0)\n _matrix$2.multiply(_matrix2.makeRotationZ(object.rotation2D));\n object.matrixWorld.decompose(_position$1, _quaternion$1, _scale$1);\n _matrix$2.setPosition(_position$1);\n _matrix$2.scale(_scale$1);\n _matrix$2.elements[3] = 0;\n _matrix$2.elements[7] = 0;\n _matrix$2.elements[11] = 0;\n _matrix$2.elements[15] = 1;\n style = getObjectCSSMatrix(_matrix$2);\n } else {\n style = getObjectCSSMatrix(object.matrixWorld);\n }\n const element = object.element;\n const cachedObject = cache.objects.get(object);\n if (cachedObject === void 0 || cachedObject.style !== style) {\n element.style.transform = style;\n const objectData = { style };\n cache.objects.set(object, objectData);\n }\n if (element.parentNode !== cameraElement) {\n cameraElement.appendChild(element);\n }\n object.onAfterRender(_this, scene, camera);\n }\n }\n for (let i2 = 0, l = object.children.length; i2 < l; i2++) {\n renderObject(object.children[i2], scene, camera);\n }\n }\n }\n}\nclass RenderableObject {\n constructor() {\n this.id = 0;\n this.object = null;\n this.z = 0;\n this.renderOrder = 0;\n }\n}\nclass RenderableFace {\n constructor() {\n this.id = 0;\n this.v1 = new RenderableVertex();\n this.v2 = new RenderableVertex();\n this.v3 = new RenderableVertex();\n this.normalModel = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this.vertexNormalsModel = [new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(), new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(), new three__WEBPACK_IMPORTED_MODULE_42__.Vector3()];\n this.vertexNormalsLength = 0;\n this.color = new three__WEBPACK_IMPORTED_MODULE_42__.Color();\n this.material = null;\n this.uvs = [new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(), new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(), new three__WEBPACK_IMPORTED_MODULE_42__.Vector2()];\n this.z = 0;\n this.renderOrder = 0;\n }\n}\nclass RenderableVertex {\n constructor() {\n this.position = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this.positionWorld = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this.positionScreen = new three__WEBPACK_IMPORTED_MODULE_42__.Vector4();\n this.visible = true;\n }\n copy(vertex) {\n this.positionWorld.copy(vertex.positionWorld);\n this.positionScreen.copy(vertex.positionScreen);\n }\n}\nclass RenderableLine {\n constructor() {\n this.id = 0;\n this.v1 = new RenderableVertex();\n this.v2 = new RenderableVertex();\n this.vertexColors = [new three__WEBPACK_IMPORTED_MODULE_42__.Color(), new three__WEBPACK_IMPORTED_MODULE_42__.Color()];\n this.material = null;\n this.z = 0;\n this.renderOrder = 0;\n }\n}\nclass RenderableSprite {\n constructor() {\n this.id = 0;\n this.object = null;\n this.x = 0;\n this.y = 0;\n this.z = 0;\n this.rotation = 0;\n this.scale = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2();\n this.material = null;\n this.renderOrder = 0;\n }\n}\nclass Projector {\n constructor() {\n let _object, _objectCount, _objectPoolLength = 0, _vertex, _vertexCount, _vertexPoolLength = 0, _face2, _faceCount, _facePoolLength = 0, _line4, _lineCount, _linePoolLength = 0, _sprite, _spriteCount, _spritePoolLength = 0, _modelMatrix;\n const _renderData = { objects: [], lights: [], elements: [] }, _vector3 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(), _vector4 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector4(), _clipBox = new three__WEBPACK_IMPORTED_MODULE_42__.Box3(new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(-1, -1, -1), new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(1, 1, 1)), _boundingBox = new three__WEBPACK_IMPORTED_MODULE_42__.Box3(), _points3 = new Array(3), _viewMatrix2 = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4(), _viewProjectionMatrix2 = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4(), _modelViewProjectionMatrix = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4(), _frustum = new three__WEBPACK_IMPORTED_MODULE_42__.Frustum(), _objectPool = [], _vertexPool = [], _facePool = [], _linePool = [], _spritePool = [];\n function RenderList() {\n const normals = [];\n const colors = [];\n const uvs = [];\n let object = null;\n const normalMatrix = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix3();\n function setObject(value) {\n object = value;\n normalMatrix.getNormalMatrix(object.matrixWorld);\n normals.length = 0;\n colors.length = 0;\n uvs.length = 0;\n }\n function projectVertex(vertex) {\n const position = vertex.position;\n const positionWorld = vertex.positionWorld;\n const positionScreen = vertex.positionScreen;\n positionWorld.copy(position).applyMatrix4(_modelMatrix);\n positionScreen.copy(positionWorld).applyMatrix4(_viewProjectionMatrix2);\n const invW = 1 / positionScreen.w;\n positionScreen.x *= invW;\n positionScreen.y *= invW;\n positionScreen.z *= invW;\n vertex.visible = positionScreen.x >= -1 && positionScreen.x <= 1 && positionScreen.y >= -1 && positionScreen.y <= 1 && positionScreen.z >= -1 && positionScreen.z <= 1;\n }\n function pushVertex(x, y, z) {\n _vertex = getNextVertexInPool();\n _vertex.position.set(x, y, z);\n projectVertex(_vertex);\n }\n function pushNormal(x, y, z) {\n normals.push(x, y, z);\n }\n function pushColor(r, g, b2) {\n colors.push(r, g, b2);\n }\n function pushUv(x, y) {\n uvs.push(x, y);\n }\n function checkTriangleVisibility(v12, v2, v3) {\n if (v12.visible === true || v2.visible === true || v3.visible === true)\n return true;\n _points3[0] = v12.positionScreen;\n _points3[1] = v2.positionScreen;\n _points3[2] = v3.positionScreen;\n return _clipBox.intersectsBox(_boundingBox.setFromPoints(_points3));\n }\n function checkBackfaceCulling(v12, v2, v3) {\n return (v3.positionScreen.x - v12.positionScreen.x) * (v2.positionScreen.y - v12.positionScreen.y) - (v3.positionScreen.y - v12.positionScreen.y) * (v2.positionScreen.x - v12.positionScreen.x) < 0;\n }\n function pushLine(a2, b2) {\n const v12 = _vertexPool[a2];\n const v2 = _vertexPool[b2];\n v12.positionScreen.copy(v12.position).applyMatrix4(_modelViewProjectionMatrix);\n v2.positionScreen.copy(v2.position).applyMatrix4(_modelViewProjectionMatrix);\n if (clipLine(v12.positionScreen, v2.positionScreen) === true) {\n v12.positionScreen.multiplyScalar(1 / v12.positionScreen.w);\n v2.positionScreen.multiplyScalar(1 / v2.positionScreen.w);\n _line4 = getNextLineInPool();\n _line4.id = object.id;\n _line4.v1.copy(v12);\n _line4.v2.copy(v2);\n _line4.z = Math.max(v12.positionScreen.z, v2.positionScreen.z);\n _line4.renderOrder = object.renderOrder;\n _line4.material = object.material;\n if (object.material.vertexColors) {\n _line4.vertexColors[0].fromArray(colors, a2 * 3);\n _line4.vertexColors[1].fromArray(colors, b2 * 3);\n }\n _renderData.elements.push(_line4);\n }\n }\n function pushTriangle(a2, b2, c, material2) {\n const v12 = _vertexPool[a2];\n const v2 = _vertexPool[b2];\n const v3 = _vertexPool[c];\n if (checkTriangleVisibility(v12, v2, v3) === false)\n return;\n if (material2.side === three__WEBPACK_IMPORTED_MODULE_42__.DoubleSide || checkBackfaceCulling(v12, v2, v3) === true) {\n _face2 = getNextFaceInPool();\n _face2.id = object.id;\n _face2.v1.copy(v12);\n _face2.v2.copy(v2);\n _face2.v3.copy(v3);\n _face2.z = (v12.positionScreen.z + v2.positionScreen.z + v3.positionScreen.z) / 3;\n _face2.renderOrder = object.renderOrder;\n _vector3.subVectors(v3.position, v2.position);\n _vector4.subVectors(v12.position, v2.position);\n _vector3.cross(_vector4);\n _face2.normalModel.copy(_vector3);\n _face2.normalModel.applyMatrix3(normalMatrix).normalize();\n for (let i2 = 0; i2 < 3; i2++) {\n const normal = _face2.vertexNormalsModel[i2];\n normal.fromArray(normals, arguments[i2] * 3);\n normal.applyMatrix3(normalMatrix).normalize();\n const uv = _face2.uvs[i2];\n uv.fromArray(uvs, arguments[i2] * 2);\n }\n _face2.vertexNormalsLength = 3;\n _face2.material = material2;\n if (material2.vertexColors) {\n _face2.color.fromArray(colors, a2 * 3);\n }\n _renderData.elements.push(_face2);\n }\n }\n return {\n setObject,\n projectVertex,\n checkTriangleVisibility,\n checkBackfaceCulling,\n pushVertex,\n pushNormal,\n pushColor,\n pushUv,\n pushLine,\n pushTriangle\n };\n }\n const renderList = new RenderList();\n function projectObject(object) {\n if (object.visible === false)\n return;\n if (object.isLight) {\n _renderData.lights.push(object);\n } else if (object.isMesh || object.isLine || object.isPoints) {\n if (object.material.visible === false)\n return;\n if (object.frustumCulled === true && _frustum.intersectsObject(object) === false)\n return;\n addObject(object);\n } else if (object.isSprite) {\n if (object.material.visible === false)\n return;\n if (object.frustumCulled === true && _frustum.intersectsSprite(object) === false)\n return;\n addObject(object);\n }\n const children = object.children;\n for (let i2 = 0, l = children.length; i2 < l; i2++) {\n projectObject(children[i2]);\n }\n }\n function addObject(object) {\n _object = getNextObjectInPool();\n _object.id = object.id;\n _object.object = object;\n _vector3.setFromMatrixPosition(object.matrixWorld);\n _vector3.applyMatrix4(_viewProjectionMatrix2);\n _object.z = _vector3.z;\n _object.renderOrder = object.renderOrder;\n _renderData.objects.push(_object);\n }\n this.projectScene = function(scene, camera, sortObjects, sortElements) {\n _faceCount = 0;\n _lineCount = 0;\n _spriteCount = 0;\n _renderData.elements.length = 0;\n if (scene.matrixWorldAutoUpdate === true)\n scene.updateMatrixWorld();\n if (camera.parent === null && camera.matrixWorldAutoUpdate === true)\n camera.updateMatrixWorld();\n _viewMatrix2.copy(camera.matrixWorldInverse);\n _viewProjectionMatrix2.multiplyMatrices(camera.projectionMatrix, _viewMatrix2);\n _frustum.setFromProjectionMatrix(_viewProjectionMatrix2);\n _objectCount = 0;\n _renderData.objects.length = 0;\n _renderData.lights.length = 0;\n projectObject(scene);\n if (sortObjects === true) {\n _renderData.objects.sort(painterSort);\n }\n const objects = _renderData.objects;\n for (let o = 0, ol = objects.length; o < ol; o++) {\n const object = objects[o].object;\n const geometry2 = object.geometry;\n renderList.setObject(object);\n _modelMatrix = object.matrixWorld;\n _vertexCount = 0;\n if (object.isMesh) {\n let material2 = object.material;\n const isMultiMaterial = Array.isArray(material2);\n const attributes = geometry2.attributes;\n const groups = geometry2.groups;\n if (attributes.position === void 0)\n continue;\n const positions = attributes.position.array;\n for (let i2 = 0, l = positions.length; i2 < l; i2 += 3) {\n let x = positions[i2];\n let y = positions[i2 + 1];\n let z = positions[i2 + 2];\n const morphTargets = geometry2.morphAttributes.position;\n if (morphTargets !== void 0) {\n const morphTargetsRelative = geometry2.morphTargetsRelative;\n const morphInfluences = object.morphTargetInfluences;\n for (let t2 = 0, tl = morphTargets.length; t2 < tl; t2++) {\n const influence = morphInfluences[t2];\n if (influence === 0)\n continue;\n const target = morphTargets[t2];\n if (morphTargetsRelative) {\n x += target.getX(i2 / 3) * influence;\n y += target.getY(i2 / 3) * influence;\n z += target.getZ(i2 / 3) * influence;\n } else {\n x += (target.getX(i2 / 3) - positions[i2]) * influence;\n y += (target.getY(i2 / 3) - positions[i2 + 1]) * influence;\n z += (target.getZ(i2 / 3) - positions[i2 + 2]) * influence;\n }\n }\n }\n renderList.pushVertex(x, y, z);\n }\n if (attributes.normal !== void 0) {\n const normals = attributes.normal.array;\n for (let i2 = 0, l = normals.length; i2 < l; i2 += 3) {\n renderList.pushNormal(normals[i2], normals[i2 + 1], normals[i2 + 2]);\n }\n }\n if (attributes.color !== void 0) {\n const colors = attributes.color.array;\n for (let i2 = 0, l = colors.length; i2 < l; i2 += 3) {\n renderList.pushColor(colors[i2], colors[i2 + 1], colors[i2 + 2]);\n }\n }\n if (attributes.uv !== void 0) {\n const uvs = attributes.uv.array;\n for (let i2 = 0, l = uvs.length; i2 < l; i2 += 2) {\n renderList.pushUv(uvs[i2], uvs[i2 + 1]);\n }\n }\n if (geometry2.index !== null) {\n const indices = geometry2.index.array;\n if (groups.length > 0) {\n for (let g = 0; g < groups.length; g++) {\n const group = groups[g];\n material2 = isMultiMaterial === true ? object.material[group.materialIndex] : object.material;\n if (material2 === void 0)\n continue;\n for (let i2 = group.start, l = group.start + group.count; i2 < l; i2 += 3) {\n renderList.pushTriangle(indices[i2], indices[i2 + 1], indices[i2 + 2], material2);\n }\n }\n } else {\n for (let i2 = 0, l = indices.length; i2 < l; i2 += 3) {\n renderList.pushTriangle(indices[i2], indices[i2 + 1], indices[i2 + 2], material2);\n }\n }\n } else {\n if (groups.length > 0) {\n for (let g = 0; g < groups.length; g++) {\n const group = groups[g];\n material2 = isMultiMaterial === true ? object.material[group.materialIndex] : object.material;\n if (material2 === void 0)\n continue;\n for (let i2 = group.start, l = group.start + group.count; i2 < l; i2 += 3) {\n renderList.pushTriangle(i2, i2 + 1, i2 + 2, material2);\n }\n }\n } else {\n for (let i2 = 0, l = positions.length / 3; i2 < l; i2 += 3) {\n renderList.pushTriangle(i2, i2 + 1, i2 + 2, material2);\n }\n }\n }\n } else if (object.isLine) {\n _modelViewProjectionMatrix.multiplyMatrices(_viewProjectionMatrix2, _modelMatrix);\n const attributes = geometry2.attributes;\n if (attributes.position !== void 0) {\n const positions = attributes.position.array;\n for (let i2 = 0, l = positions.length; i2 < l; i2 += 3) {\n renderList.pushVertex(positions[i2], positions[i2 + 1], positions[i2 + 2]);\n }\n if (attributes.color !== void 0) {\n const colors = attributes.color.array;\n for (let i2 = 0, l = colors.length; i2 < l; i2 += 3) {\n renderList.pushColor(colors[i2], colors[i2 + 1], colors[i2 + 2]);\n }\n }\n if (geometry2.index !== null) {\n const indices = geometry2.index.array;\n for (let i2 = 0, l = indices.length; i2 < l; i2 += 2) {\n renderList.pushLine(indices[i2], indices[i2 + 1]);\n }\n } else {\n const step = object.isLineSegments ? 2 : 1;\n for (let i2 = 0, l = positions.length / 3 - 1; i2 < l; i2 += step) {\n renderList.pushLine(i2, i2 + 1);\n }\n }\n }\n } else if (object.isPoints) {\n _modelViewProjectionMatrix.multiplyMatrices(_viewProjectionMatrix2, _modelMatrix);\n const attributes = geometry2.attributes;\n if (attributes.position !== void 0) {\n const positions = attributes.position.array;\n for (let i2 = 0, l = positions.length; i2 < l; i2 += 3) {\n _vector4.set(positions[i2], positions[i2 + 1], positions[i2 + 2], 1);\n _vector4.applyMatrix4(_modelViewProjectionMatrix);\n pushPoint(_vector4, object, camera);\n }\n }\n } else if (object.isSprite) {\n object.modelViewMatrix.multiplyMatrices(camera.matrixWorldInverse, object.matrixWorld);\n _vector4.set(_modelMatrix.elements[12], _modelMatrix.elements[13], _modelMatrix.elements[14], 1);\n _vector4.applyMatrix4(_viewProjectionMatrix2);\n pushPoint(_vector4, object, camera);\n }\n }\n if (sortElements === true) {\n _renderData.elements.sort(painterSort);\n }\n return _renderData;\n };\n function pushPoint(_vector42, object, camera) {\n const invW = 1 / _vector42.w;\n _vector42.z *= invW;\n if (_vector42.z >= -1 && _vector42.z <= 1) {\n _sprite = getNextSpriteInPool();\n _sprite.id = object.id;\n _sprite.x = _vector42.x * invW;\n _sprite.y = _vector42.y * invW;\n _sprite.z = _vector42.z;\n _sprite.renderOrder = object.renderOrder;\n _sprite.object = object;\n _sprite.rotation = object.rotation;\n _sprite.scale.x = object.scale.x * Math.abs(\n _sprite.x - (_vector42.x + camera.projectionMatrix.elements[0]) / (_vector42.w + camera.projectionMatrix.elements[12])\n );\n _sprite.scale.y = object.scale.y * Math.abs(\n _sprite.y - (_vector42.y + camera.projectionMatrix.elements[5]) / (_vector42.w + camera.projectionMatrix.elements[13])\n );\n _sprite.material = object.material;\n _renderData.elements.push(_sprite);\n }\n }\n function getNextObjectInPool() {\n if (_objectCount === _objectPoolLength) {\n const object = new RenderableObject();\n _objectPool.push(object);\n _objectPoolLength++;\n _objectCount++;\n return object;\n }\n return _objectPool[_objectCount++];\n }\n function getNextVertexInPool() {\n if (_vertexCount === _vertexPoolLength) {\n const vertex = new RenderableVertex();\n _vertexPool.push(vertex);\n _vertexPoolLength++;\n _vertexCount++;\n return vertex;\n }\n return _vertexPool[_vertexCount++];\n }\n function getNextFaceInPool() {\n if (_faceCount === _facePoolLength) {\n const face = new RenderableFace();\n _facePool.push(face);\n _facePoolLength++;\n _faceCount++;\n return face;\n }\n return _facePool[_faceCount++];\n }\n function getNextLineInPool() {\n if (_lineCount === _linePoolLength) {\n const line = new RenderableLine();\n _linePool.push(line);\n _linePoolLength++;\n _lineCount++;\n return line;\n }\n return _linePool[_lineCount++];\n }\n function getNextSpriteInPool() {\n if (_spriteCount === _spritePoolLength) {\n const sprite = new RenderableSprite();\n _spritePool.push(sprite);\n _spritePoolLength++;\n _spriteCount++;\n return sprite;\n }\n return _spritePool[_spriteCount++];\n }\n function painterSort(a2, b2) {\n if (a2.renderOrder !== b2.renderOrder) {\n return a2.renderOrder - b2.renderOrder;\n } else if (a2.z !== b2.z) {\n return b2.z - a2.z;\n } else if (a2.id !== b2.id) {\n return a2.id - b2.id;\n } else {\n return 0;\n }\n }\n function clipLine(s1, s2) {\n let alpha1 = 0, alpha2 = 1;\n const bc1near = s1.z + s1.w, bc2near = s2.z + s2.w, bc1far = -s1.z + s1.w, bc2far = -s2.z + s2.w;\n if (bc1near >= 0 && bc2near >= 0 && bc1far >= 0 && bc2far >= 0) {\n return true;\n } else if (bc1near < 0 && bc2near < 0 || bc1far < 0 && bc2far < 0) {\n return false;\n } else {\n if (bc1near < 0) {\n alpha1 = Math.max(alpha1, bc1near / (bc1near - bc2near));\n } else if (bc2near < 0) {\n alpha2 = Math.min(alpha2, bc1near / (bc1near - bc2near));\n }\n if (bc1far < 0) {\n alpha1 = Math.max(alpha1, bc1far / (bc1far - bc2far));\n } else if (bc2far < 0) {\n alpha2 = Math.min(alpha2, bc1far / (bc1far - bc2far));\n }\n if (alpha2 < alpha1) {\n return false;\n } else {\n s1.lerp(s2, alpha1);\n s2.lerp(s1, 1 - alpha2);\n return true;\n }\n }\n }\n }\n}\nclass SVGObject extends three__WEBPACK_IMPORTED_MODULE_42__.Object3D {\n constructor(node) {\n super();\n this.isSVGObject = true;\n this.node = node;\n }\n}\nclass SVGRenderer {\n constructor() {\n let _renderData, _elements, _lights, _svgWidth, _svgHeight, _svgWidthHalf, _svgHeightHalf, _v12, _v22, _v32, _svgNode, _pathCount = 0, _precision = null, _quality = 1, _currentPath, _currentStyle;\n const _this = this, _clipBox = new three__WEBPACK_IMPORTED_MODULE_42__.Box2(), _elemBox = new three__WEBPACK_IMPORTED_MODULE_42__.Box2(), _color2 = new three__WEBPACK_IMPORTED_MODULE_42__.Color(), _diffuseColor = new three__WEBPACK_IMPORTED_MODULE_42__.Color(), _ambientLight = new three__WEBPACK_IMPORTED_MODULE_42__.Color(), _directionalLights = new three__WEBPACK_IMPORTED_MODULE_42__.Color(), _pointLights = new three__WEBPACK_IMPORTED_MODULE_42__.Color(), _clearColor = new three__WEBPACK_IMPORTED_MODULE_42__.Color(), _vector3 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(), _centroid = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(), _normal = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(), _normalViewMatrix = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix3(), _viewMatrix2 = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4(), _viewProjectionMatrix2 = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4(), _svgPathPool = [], _projector = new Projector(), _svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n this.domElement = _svg;\n this.autoClear = true;\n this.sortObjects = true;\n this.sortElements = true;\n this.overdraw = 0.5;\n this.info = {\n render: {\n vertices: 0,\n faces: 0\n }\n };\n this.setQuality = function(quality) {\n switch (quality) {\n case \"high\":\n _quality = 1;\n break;\n case \"low\":\n _quality = 0;\n break;\n }\n };\n this.setClearColor = function(color) {\n _clearColor.set(color);\n };\n this.setPixelRatio = function() {\n };\n this.setSize = function(width, height) {\n _svgWidth = width;\n _svgHeight = height;\n _svgWidthHalf = _svgWidth / 2;\n _svgHeightHalf = _svgHeight / 2;\n _svg.setAttribute(\"viewBox\", -_svgWidthHalf + \" \" + -_svgHeightHalf + \" \" + _svgWidth + \" \" + _svgHeight);\n _svg.setAttribute(\"width\", _svgWidth);\n _svg.setAttribute(\"height\", _svgHeight);\n _clipBox.min.set(-_svgWidthHalf, -_svgHeightHalf);\n _clipBox.max.set(_svgWidthHalf, _svgHeightHalf);\n };\n this.getSize = function() {\n return {\n width: _svgWidth,\n height: _svgHeight\n };\n };\n this.setPrecision = function(precision) {\n _precision = precision;\n };\n function removeChildNodes() {\n _pathCount = 0;\n while (_svg.childNodes.length > 0) {\n _svg.removeChild(_svg.childNodes[0]);\n }\n }\n function convert(c) {\n return _precision !== null ? c.toFixed(_precision) : c;\n }\n this.clear = function() {\n removeChildNodes();\n _svg.style.backgroundColor = _clearColor.getStyle();\n };\n this.render = function(scene, camera) {\n if (camera instanceof three__WEBPACK_IMPORTED_MODULE_42__.Camera === false) {\n console.error(\"THREE.SVGRenderer.render: camera is not an instance of Camera.\");\n return;\n }\n const background = scene.background;\n if (background && background.isColor) {\n removeChildNodes();\n _svg.style.backgroundColor = background.getStyle();\n } else if (this.autoClear === true) {\n this.clear();\n }\n _this.info.render.vertices = 0;\n _this.info.render.faces = 0;\n _viewMatrix2.copy(camera.matrixWorldInverse);\n _viewProjectionMatrix2.multiplyMatrices(camera.projectionMatrix, _viewMatrix2);\n _renderData = _projector.projectScene(scene, camera, this.sortObjects, this.sortElements);\n _elements = _renderData.elements;\n _lights = _renderData.lights;\n _normalViewMatrix.getNormalMatrix(camera.matrixWorldInverse);\n calculateLights(_lights);\n _currentPath = \"\";\n _currentStyle = \"\";\n for (let e = 0, el = _elements.length; e < el; e++) {\n const element = _elements[e];\n const material2 = element.material;\n if (material2 === void 0 || material2.opacity === 0)\n continue;\n _elemBox.makeEmpty();\n if (element instanceof RenderableSprite) {\n _v12 = element;\n _v12.x *= _svgWidthHalf;\n _v12.y *= -_svgHeightHalf;\n renderSprite(_v12, element, material2);\n } else if (element instanceof RenderableLine) {\n _v12 = element.v1;\n _v22 = element.v2;\n _v12.positionScreen.x *= _svgWidthHalf;\n _v12.positionScreen.y *= -_svgHeightHalf;\n _v22.positionScreen.x *= _svgWidthHalf;\n _v22.positionScreen.y *= -_svgHeightHalf;\n _elemBox.setFromPoints([_v12.positionScreen, _v22.positionScreen]);\n if (_clipBox.intersectsBox(_elemBox) === true) {\n renderLine(_v12, _v22, material2);\n }\n } else if (element instanceof RenderableFace) {\n _v12 = element.v1;\n _v22 = element.v2;\n _v32 = element.v3;\n if (_v12.positionScreen.z < -1 || _v12.positionScreen.z > 1)\n continue;\n if (_v22.positionScreen.z < -1 || _v22.positionScreen.z > 1)\n continue;\n if (_v32.positionScreen.z < -1 || _v32.positionScreen.z > 1)\n continue;\n _v12.positionScreen.x *= _svgWidthHalf;\n _v12.positionScreen.y *= -_svgHeightHalf;\n _v22.positionScreen.x *= _svgWidthHalf;\n _v22.positionScreen.y *= -_svgHeightHalf;\n _v32.positionScreen.x *= _svgWidthHalf;\n _v32.positionScreen.y *= -_svgHeightHalf;\n if (this.overdraw > 0) {\n expand(_v12.positionScreen, _v22.positionScreen, this.overdraw);\n expand(_v22.positionScreen, _v32.positionScreen, this.overdraw);\n expand(_v32.positionScreen, _v12.positionScreen, this.overdraw);\n }\n _elemBox.setFromPoints([_v12.positionScreen, _v22.positionScreen, _v32.positionScreen]);\n if (_clipBox.intersectsBox(_elemBox) === true) {\n renderFace3(_v12, _v22, _v32, element, material2);\n }\n }\n }\n flushPath();\n scene.traverseVisible(function(object) {\n if (object.isSVGObject) {\n _vector3.setFromMatrixPosition(object.matrixWorld);\n _vector3.applyMatrix4(_viewProjectionMatrix2);\n if (_vector3.z < -1 || _vector3.z > 1)\n return;\n const x = _vector3.x * _svgWidthHalf;\n const y = -_vector3.y * _svgHeightHalf;\n const node = object.node;\n node.setAttribute(\"transform\", \"translate(\" + x + \",\" + y + \")\");\n _svg.appendChild(node);\n }\n });\n };\n function calculateLights(lights) {\n _ambientLight.setRGB(0, 0, 0);\n _directionalLights.setRGB(0, 0, 0);\n _pointLights.setRGB(0, 0, 0);\n for (let l = 0, ll = lights.length; l < ll; l++) {\n const light = lights[l];\n const lightColor = light.color;\n if (light.isAmbientLight) {\n _ambientLight.r += lightColor.r;\n _ambientLight.g += lightColor.g;\n _ambientLight.b += lightColor.b;\n } else if (light.isDirectionalLight) {\n _directionalLights.r += lightColor.r;\n _directionalLights.g += lightColor.g;\n _directionalLights.b += lightColor.b;\n } else if (light.isPointLight) {\n _pointLights.r += lightColor.r;\n _pointLights.g += lightColor.g;\n _pointLights.b += lightColor.b;\n }\n }\n }\n function calculateLight(lights, position, normal, color) {\n for (let l = 0, ll = lights.length; l < ll; l++) {\n const light = lights[l];\n const lightColor = light.color;\n if (light.isDirectionalLight) {\n const lightPosition = _vector3.setFromMatrixPosition(light.matrixWorld).normalize();\n let amount = normal.dot(lightPosition);\n if (amount <= 0)\n continue;\n amount *= light.intensity;\n color.r += lightColor.r * amount;\n color.g += lightColor.g * amount;\n color.b += lightColor.b * amount;\n } else if (light.isPointLight) {\n const lightPosition = _vector3.setFromMatrixPosition(light.matrixWorld);\n let amount = normal.dot(_vector3.subVectors(lightPosition, position).normalize());\n if (amount <= 0)\n continue;\n amount *= light.distance == 0 ? 1 : 1 - Math.min(position.distanceTo(lightPosition) / light.distance, 1);\n if (amount == 0)\n continue;\n amount *= light.intensity;\n color.r += lightColor.r * amount;\n color.g += lightColor.g * amount;\n color.b += lightColor.b * amount;\n }\n }\n }\n function renderSprite(v12, element, material2) {\n let scaleX = element.scale.x * _svgWidthHalf;\n let scaleY = element.scale.y * _svgHeightHalf;\n if (material2.isPointsMaterial) {\n scaleX *= material2.size;\n scaleY *= material2.size;\n }\n const path = \"M\" + convert(v12.x - scaleX * 0.5) + \",\" + convert(v12.y - scaleY * 0.5) + \"h\" + convert(scaleX) + \"v\" + convert(scaleY) + \"h\" + convert(-scaleX) + \"z\";\n let style = \"\";\n if (material2.isSpriteMaterial || material2.isPointsMaterial) {\n style = \"fill:\" + material2.color.getStyle() + \";fill-opacity:\" + material2.opacity;\n }\n addPath(style, path);\n }\n function renderLine(v12, v2, material2) {\n const path = \"M\" + convert(v12.positionScreen.x) + \",\" + convert(v12.positionScreen.y) + \"L\" + convert(v2.positionScreen.x) + \",\" + convert(v2.positionScreen.y);\n if (material2.isLineBasicMaterial) {\n let style = \"fill:none;stroke:\" + material2.color.getStyle() + \";stroke-opacity:\" + material2.opacity + \";stroke-width:\" + material2.linewidth + \";stroke-linecap:\" + material2.linecap;\n if (material2.isLineDashedMaterial) {\n style = style + \";stroke-dasharray:\" + material2.dashSize + \",\" + material2.gapSize;\n }\n addPath(style, path);\n }\n }\n function renderFace3(v12, v2, v3, element, material2) {\n _this.info.render.vertices += 3;\n _this.info.render.faces++;\n const path = \"M\" + convert(v12.positionScreen.x) + \",\" + convert(v12.positionScreen.y) + \"L\" + convert(v2.positionScreen.x) + \",\" + convert(v2.positionScreen.y) + \"L\" + convert(v3.positionScreen.x) + \",\" + convert(v3.positionScreen.y) + \"z\";\n let style = \"\";\n if (material2.isMeshBasicMaterial) {\n _color2.copy(material2.color);\n if (material2.vertexColors) {\n _color2.multiply(element.color);\n }\n } else if (material2.isMeshLambertMaterial || material2.isMeshPhongMaterial || material2.isMeshStandardMaterial) {\n _diffuseColor.copy(material2.color);\n if (material2.vertexColors) {\n _diffuseColor.multiply(element.color);\n }\n _color2.copy(_ambientLight);\n _centroid.copy(v12.positionWorld).add(v2.positionWorld).add(v3.positionWorld).divideScalar(3);\n calculateLight(_lights, _centroid, element.normalModel, _color2);\n _color2.multiply(_diffuseColor).add(material2.emissive);\n } else if (material2.isMeshNormalMaterial) {\n _normal.copy(element.normalModel).applyMatrix3(_normalViewMatrix).normalize();\n _color2.setRGB(_normal.x, _normal.y, _normal.z).multiplyScalar(0.5).addScalar(0.5);\n }\n if (material2.wireframe) {\n style = \"fill:none;stroke:\" + _color2.getStyle() + \";stroke-opacity:\" + material2.opacity + \";stroke-width:\" + material2.wireframeLinewidth + \";stroke-linecap:\" + material2.wireframeLinecap + \";stroke-linejoin:\" + material2.wireframeLinejoin;\n } else {\n style = \"fill:\" + _color2.getStyle() + \";fill-opacity:\" + material2.opacity;\n }\n addPath(style, path);\n }\n function expand(v12, v2, pixels) {\n let x = v2.x - v12.x, y = v2.y - v12.y;\n const det = x * x + y * y;\n if (det === 0)\n return;\n const idet = pixels / Math.sqrt(det);\n x *= idet;\n y *= idet;\n v2.x += x;\n v2.y += y;\n v12.x -= x;\n v12.y -= y;\n }\n function addPath(style, path) {\n if (_currentStyle === style) {\n _currentPath += path;\n } else {\n flushPath();\n _currentStyle = style;\n _currentPath = path;\n }\n }\n function flushPath() {\n if (_currentPath) {\n _svgNode = getPathNode(_pathCount++);\n _svgNode.setAttribute(\"d\", _currentPath);\n _svgNode.setAttribute(\"style\", _currentStyle);\n _svg.appendChild(_svgNode);\n }\n _currentPath = \"\";\n _currentStyle = \"\";\n }\n function getPathNode(id) {\n if (_svgPathPool[id] == null) {\n _svgPathPool[id] = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\");\n if (_quality == 0) {\n _svgPathPool[id].setAttribute(\"shape-rendering\", \"crispEdges\");\n }\n return _svgPathPool[id];\n }\n return _svgPathPool[id];\n }\n }\n}\nclass FlakesTexture {\n constructor(width = 512, height = 512) {\n const canvas = document.createElement(\"canvas\");\n canvas.width = width;\n canvas.height = height;\n const context = canvas.getContext(\"2d\");\n context.fillStyle = \"rgb(127,127,255)\";\n context.fillRect(0, 0, width, height);\n for (let i2 = 0; i2 < 4e3; i2++) {\n const x = Math.random() * width;\n const y = Math.random() * height;\n const r = Math.random() * 3 + 3;\n let nx = Math.random() * 2 - 1;\n let ny = Math.random() * 2 - 1;\n let nz = 1.5;\n const l = Math.sqrt(nx * nx + ny * ny + nz * nz);\n nx /= l;\n ny /= l;\n nz /= l;\n context.fillStyle = \"rgb(\" + (nx * 127 + 127) + \",\" + (ny * 127 + 127) + \",\" + nz * 255 + \")\";\n context.beginPath();\n context.arc(x, y, r, 0, Math.PI * 2);\n context.fill();\n }\n return canvas;\n }\n}\nconst CHANNELS = 4;\nconst TEXTURE_WIDTH = 1024;\nconst TEXTURE_HEIGHT = 4;\nconst initSplineTexture = (numberOfCurves = 1) => {\n const dataArray2 = new Float32Array(TEXTURE_WIDTH * TEXTURE_HEIGHT * numberOfCurves * CHANNELS);\n const dataTexture = new three__WEBPACK_IMPORTED_MODULE_42__.DataTexture(dataArray2, TEXTURE_WIDTH, TEXTURE_HEIGHT * numberOfCurves, three__WEBPACK_IMPORTED_MODULE_42__.RGBAFormat, three__WEBPACK_IMPORTED_MODULE_42__.FloatType);\n dataTexture.wrapS = three__WEBPACK_IMPORTED_MODULE_42__.RepeatWrapping;\n dataTexture.wrapT = three__WEBPACK_IMPORTED_MODULE_42__.RepeatWrapping;\n dataTexture.magFilter = three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter;\n dataTexture.needsUpdate = true;\n return dataTexture;\n};\nconst updateSplineTexture = (texture, splineCurve, offset = 0) => {\n const numberOfPoints = Math.floor(TEXTURE_WIDTH * (TEXTURE_HEIGHT / 4));\n splineCurve.arcLengthDivisions = numberOfPoints / 2;\n splineCurve.updateArcLengths();\n const points = splineCurve.getSpacedPoints(numberOfPoints);\n const frenetFrames = splineCurve.computeFrenetFrames(numberOfPoints, true);\n for (let i2 = 0; i2 < numberOfPoints; i2++) {\n const rowOffset = Math.floor(i2 / TEXTURE_WIDTH);\n const rowIndex = i2 % TEXTURE_WIDTH;\n let pt = points[i2];\n setTextureValue(texture, rowIndex, pt.x, pt.y, pt.z, 0 + rowOffset + TEXTURE_HEIGHT * offset);\n pt = frenetFrames.tangents[i2];\n setTextureValue(texture, rowIndex, pt.x, pt.y, pt.z, 1 + rowOffset + TEXTURE_HEIGHT * offset);\n pt = frenetFrames.normals[i2];\n setTextureValue(texture, rowIndex, pt.x, pt.y, pt.z, 2 + rowOffset + TEXTURE_HEIGHT * offset);\n pt = frenetFrames.binormals[i2];\n setTextureValue(texture, rowIndex, pt.x, pt.y, pt.z, 3 + rowOffset + TEXTURE_HEIGHT * offset);\n }\n texture.needsUpdate = true;\n};\nconst setTextureValue = (texture, index, x, y, z, o) => {\n const image = texture.image;\n const { data } = image;\n const i2 = CHANNELS * TEXTURE_WIDTH * o;\n data[index * CHANNELS + i2 + 0] = x;\n data[index * CHANNELS + i2 + 1] = y;\n data[index * CHANNELS + i2 + 2] = z;\n data[index * CHANNELS + i2 + 3] = 1;\n};\nconst getUniforms = (splineTexture) => ({\n spineTexture: { value: splineTexture },\n pathOffset: { type: \"f\", value: 0 },\n // time of path curve\n pathSegment: { type: \"f\", value: 1 },\n // fractional length of path\n spineOffset: { type: \"f\", value: 161 },\n spineLength: { type: \"f\", value: 400 },\n flow: { type: \"i\", value: 1 }\n});\nfunction modifyShader(material2, uniforms, numberOfCurves = 1) {\n if (material2.__ok)\n return;\n material2.__ok = true;\n material2.onBeforeCompile = (shader) => {\n if (shader.__modified)\n return;\n shader.__modified = true;\n Object.assign(shader.uniforms, uniforms);\n const vertexShader = (\n /* glsl */\n `\n\t\tuniform sampler2D spineTexture;\n\t\tuniform float pathOffset;\n\t\tuniform float pathSegment;\n\t\tuniform float spineOffset;\n\t\tuniform float spineLength;\n\t\tuniform int flow;\n\n\t\tfloat textureLayers = ${TEXTURE_HEIGHT * numberOfCurves}.;\n\t\tfloat textureStacks = ${TEXTURE_HEIGHT / 4}.;\n\n\t\t${shader.vertexShader}\n\t\t`.replace(\"#include \", \"\").replace(\"#include \", \"\").replace(\"#include \", \"\").replace(\n /void\\s*main\\s*\\(\\)\\s*\\{/,\n /* glsl */\n `\n void main() {\n #include \n\n vec4 worldPos = modelMatrix * vec4(position, 1.);\n\n bool bend = flow > 0;\n float xWeight = bend ? 0. : 1.;\n\n #ifdef USE_INSTANCING\n float pathOffsetFromInstanceMatrix = instanceMatrix[3][2];\n float spineLengthFromInstanceMatrix = instanceMatrix[3][0];\n float spinePortion = bend ? (worldPos.x + spineOffset) / spineLengthFromInstanceMatrix : 0.;\n float mt = (spinePortion * pathSegment + pathOffset + pathOffsetFromInstanceMatrix)*textureStacks;\n #else\n float spinePortion = bend ? (worldPos.x + spineOffset) / spineLength : 0.;\n float mt = (spinePortion * pathSegment + pathOffset)*textureStacks;\n #endif\n\n mt = mod(mt, textureStacks);\n float rowOffset = floor(mt);\n\n #ifdef USE_INSTANCING\n rowOffset += instanceMatrix[3][1] * ${TEXTURE_HEIGHT}.;\n #endif\n\n vec3 spinePos = texture2D(spineTexture, vec2(mt, (0. + rowOffset + 0.5) / textureLayers)).xyz;\n vec3 a = texture2D(spineTexture, vec2(mt, (1. + rowOffset + 0.5) / textureLayers)).xyz;\n vec3 b = texture2D(spineTexture, vec2(mt, (2. + rowOffset + 0.5) / textureLayers)).xyz;\n vec3 c = texture2D(spineTexture, vec2(mt, (3. + rowOffset + 0.5) / textureLayers)).xyz;\n mat3 basis = mat3(a, b, c);\n\n vec3 transformed = basis\n * vec3(worldPos.x * xWeight, worldPos.y * 1., worldPos.z * 1.)\n + spinePos;\n\n vec3 transformedNormal = normalMatrix * (basis * objectNormal);\n\t\t\t`\n ).replace(\n \"#include \",\n /* glsl */\n `vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n\t\t\t\tgl_Position = projectionMatrix * mvPosition;`\n )\n );\n shader.vertexShader = vertexShader;\n };\n}\nclass Flow {\n /**\n * @param {Mesh} mesh The mesh to clone and modify to bend around the curve\n * @param {number} numberOfCurves The amount of space that should preallocated for additional curves\n */\n constructor(mesh, numberOfCurves = 1) {\n __publicField(this, \"curveArray\");\n __publicField(this, \"curveLengthArray\");\n __publicField(this, \"object3D\");\n __publicField(this, \"splineTexure\");\n __publicField(this, \"uniforms\");\n const obj3D = mesh.clone();\n const splineTexure = initSplineTexture(numberOfCurves);\n const uniforms = getUniforms(splineTexure);\n obj3D.traverse((child) => {\n if (child instanceof three__WEBPACK_IMPORTED_MODULE_42__.Mesh || child instanceof three__WEBPACK_IMPORTED_MODULE_42__.InstancedMesh) {\n child.material = child.material.clone();\n modifyShader(child.material, uniforms, numberOfCurves);\n }\n });\n this.curveArray = new Array(numberOfCurves);\n this.curveLengthArray = new Array(numberOfCurves);\n this.object3D = obj3D;\n this.splineTexure = splineTexure;\n this.uniforms = uniforms;\n }\n updateCurve(index, curve) {\n if (index >= this.curveArray.length)\n throw Error(\"Index out of range for Flow\");\n const curveLength = curve.getLength();\n this.uniforms.spineLength.value = curveLength;\n this.curveLengthArray[index] = curveLength;\n this.curveArray[index] = curve;\n updateSplineTexture(this.splineTexure, curve, index);\n }\n moveAlongCurve(amount) {\n this.uniforms.pathOffset.value += amount;\n }\n}\nconst matrix$1 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\nclass InstancedFlow extends Flow {\n /**\n *\n * @param {number} count The number of instanced elements\n * @param {number} curveCount The number of curves to preallocate for\n * @param {Geometry} geometry The geometry to use for the instanced mesh\n * @param {Material} material The material to use for the instanced mesh\n */\n constructor(count, curveCount, geometry2, material2) {\n const mesh = new three__WEBPACK_IMPORTED_MODULE_42__.InstancedMesh(geometry2, material2, count);\n mesh.instanceMatrix.setUsage(three__WEBPACK_IMPORTED_MODULE_42__.DynamicDrawUsage);\n mesh.frustumCulled = false;\n super(mesh, curveCount);\n __publicField(this, \"offsets\");\n __publicField(this, \"whichCurve\");\n this.offsets = new Array(count).fill(0);\n this.whichCurve = new Array(count).fill(0);\n }\n /**\n * The extra information about which curve and curve position is stored in the translation components of the matrix for the instanced objects\n * This writes that information to the matrix and marks it as needing update.\n *\n * @param {number} index of the instanced element to update\n */\n writeChanges(index) {\n matrix$1.makeTranslation(this.curveLengthArray[this.whichCurve[index]], this.whichCurve[index], this.offsets[index]);\n this.object3D.setMatrixAt(index, matrix$1);\n this.object3D.instanceMatrix.needsUpdate = true;\n }\n /**\n * Move an individual element along the curve by a specific amount\n *\n * @param {number} index Which element to update\n * @param {number} offset Move by how much\n */\n moveIndividualAlongCurve(index, offset) {\n this.offsets[index] += offset;\n this.writeChanges(index);\n }\n /**\n * Select which curve to use for an element\n *\n * @param {number} index the index of the instanced element to update\n * @param {number} curveNo the index of the curve it should use\n */\n setCurve(index, curveNo) {\n if (isNaN(curveNo))\n throw Error(\"curve index being set is Not a Number (NaN)\");\n this.whichCurve[index] = curveNo;\n this.writeChanges(index);\n }\n}\nconst getWithKey = (obj, key) => obj[key];\nconst mergeBufferGeometries = (geometries, useGroups) => {\n const isIndexed = geometries[0].index !== null;\n const attributesUsed = new Set(Object.keys(geometries[0].attributes));\n const morphAttributesUsed = new Set(Object.keys(geometries[0].morphAttributes));\n const attributes = {};\n const morphAttributes = {};\n const morphTargetsRelative = geometries[0].morphTargetsRelative;\n const mergedGeometry = new three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry();\n let offset = 0;\n geometries.forEach((geom, i2) => {\n let attributesCount = 0;\n if (isIndexed !== (geom.index !== null)) {\n console.error(\n \"THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index \" + i2 + \". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them.\"\n );\n return null;\n }\n for (let name in geom.attributes) {\n if (!attributesUsed.has(name)) {\n console.error(\n \"THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index \" + i2 + '. All geometries must have compatible attributes; make sure \"' + name + '\" attribute exists among all geometries, or in none of them.'\n );\n return null;\n }\n if (attributes[name] === void 0) {\n attributes[name] = [];\n }\n attributes[name].push(geom.attributes[name]);\n attributesCount++;\n }\n if (attributesCount !== attributesUsed.size) {\n console.error(\n \"THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index \" + i2 + \". Make sure all geometries have the same number of attributes.\"\n );\n return null;\n }\n if (morphTargetsRelative !== geom.morphTargetsRelative) {\n console.error(\n \"THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index \" + i2 + \". .morphTargetsRelative must be consistent throughout all geometries.\"\n );\n return null;\n }\n for (let name in geom.morphAttributes) {\n if (!morphAttributesUsed.has(name)) {\n console.error(\n \"THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index \" + i2 + \". .morphAttributes must be consistent throughout all geometries.\"\n );\n return null;\n }\n if (morphAttributes[name] === void 0)\n morphAttributes[name] = [];\n morphAttributes[name].push(geom.morphAttributes[name]);\n }\n mergedGeometry.userData.mergedUserData = mergedGeometry.userData.mergedUserData || [];\n mergedGeometry.userData.mergedUserData.push(geom.userData);\n if (useGroups) {\n let count;\n if (geom.index) {\n count = geom.index.count;\n } else if (geom.attributes.position !== void 0) {\n count = geom.attributes.position.count;\n } else {\n console.error(\n \"THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index \" + i2 + \". The geometry must have either an index or a position attribute\"\n );\n return null;\n }\n mergedGeometry.addGroup(offset, count, i2);\n offset += count;\n }\n });\n if (isIndexed) {\n let indexOffset = 0;\n const mergedIndex = [];\n geometries.forEach((geom) => {\n const index = geom.index;\n for (let j = 0; j < index.count; ++j) {\n mergedIndex.push(index.getX(j) + indexOffset);\n }\n indexOffset += geom.attributes.position.count;\n });\n mergedGeometry.setIndex(mergedIndex);\n }\n for (let name in attributes) {\n const mergedAttribute = mergeBufferAttributes(attributes[name]);\n if (!mergedAttribute) {\n console.error(\n \"THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the \" + name + \" attribute.\"\n );\n return null;\n }\n mergedGeometry.setAttribute(name, mergedAttribute);\n }\n for (let name in morphAttributes) {\n const numMorphTargets = morphAttributes[name][0].length;\n if (numMorphTargets === 0)\n break;\n mergedGeometry.morphAttributes = mergedGeometry.morphAttributes || {};\n mergedGeometry.morphAttributes[name] = [];\n for (let i2 = 0; i2 < numMorphTargets; ++i2) {\n const morphAttributesToMerge = [];\n for (let j = 0; j < morphAttributes[name].length; ++j) {\n morphAttributesToMerge.push(morphAttributes[name][j][i2]);\n }\n const mergedMorphAttribute = mergeBufferAttributes(morphAttributesToMerge);\n if (!mergedMorphAttribute) {\n console.error(\n \"THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the \" + name + \" morphAttribute.\"\n );\n return null;\n }\n mergedGeometry.morphAttributes[name].push(mergedMorphAttribute);\n }\n }\n return mergedGeometry;\n};\nconst mergeBufferAttributes = (attributes) => {\n let TypedArray = void 0;\n let itemSize = void 0;\n let normalized = void 0;\n let arrayLength = 0;\n attributes.forEach((attr) => {\n if (TypedArray === void 0) {\n TypedArray = attr.array.constructor;\n }\n if (TypedArray !== attr.array.constructor) {\n console.error(\n \"THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes.\"\n );\n return null;\n }\n if (itemSize === void 0)\n itemSize = attr.itemSize;\n if (itemSize !== attr.itemSize) {\n console.error(\n \"THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes.\"\n );\n return null;\n }\n if (normalized === void 0)\n normalized = attr.normalized;\n if (normalized !== attr.normalized) {\n console.error(\n \"THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes.\"\n );\n return null;\n }\n arrayLength += attr.array.length;\n });\n if (TypedArray && itemSize) {\n const array = new TypedArray(arrayLength);\n let offset = 0;\n attributes.forEach((attr) => {\n array.set(attr.array, offset);\n offset += attr.array.length;\n });\n return new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(array, itemSize, normalized);\n }\n};\nconst interleaveAttributes = (attributes) => {\n let TypedArray = void 0;\n let arrayLength = 0;\n let stride = 0;\n for (let i2 = 0, l = attributes.length; i2 < l; ++i2) {\n const attribute = attributes[i2];\n if (TypedArray === void 0)\n TypedArray = attribute.array.constructor;\n if (TypedArray !== attribute.array.constructor) {\n console.error(\"AttributeBuffers of different types cannot be interleaved\");\n return null;\n }\n arrayLength += attribute.array.length;\n stride += attribute.itemSize;\n }\n const interleavedBuffer = new three__WEBPACK_IMPORTED_MODULE_42__.InterleavedBuffer(new TypedArray(arrayLength), stride);\n let offset = 0;\n const res = [];\n const getters = [\"getX\", \"getY\", \"getZ\", \"getW\"];\n const setters = [\"setX\", \"setY\", \"setZ\", \"setW\"];\n for (let j = 0, l = attributes.length; j < l; j++) {\n const attribute = attributes[j];\n const itemSize = attribute.itemSize;\n const count = attribute.count;\n const iba = new three__WEBPACK_IMPORTED_MODULE_42__.InterleavedBufferAttribute(interleavedBuffer, itemSize, offset, attribute.normalized);\n res.push(iba);\n offset += itemSize;\n for (let c = 0; c < count; c++) {\n for (let k = 0; k < itemSize; k++) {\n const set = getWithKey(iba, setters[k]);\n const get2 = getWithKey(attribute, getters[k]);\n set(c, get2(c));\n }\n }\n }\n return res;\n};\nfunction estimateBytesUsed(geometry2) {\n let mem = 0;\n for (let name in geometry2.attributes) {\n const attr = geometry2.getAttribute(name);\n mem += attr.count * attr.itemSize * attr.array.BYTES_PER_ELEMENT;\n }\n const indices = geometry2.getIndex();\n mem += indices ? indices.count * indices.itemSize * indices.array.BYTES_PER_ELEMENT : 0;\n return mem;\n}\nfunction mergeVertices(geometry2, tolerance = 1e-4) {\n tolerance = Math.max(tolerance, Number.EPSILON);\n const hashToIndex = {};\n const indices = geometry2.getIndex();\n const positions = geometry2.getAttribute(\"position\");\n const vertexCount = indices ? indices.count : positions.count;\n let nextIndex = 0;\n const attributeNames = Object.keys(geometry2.attributes);\n const attrArrays = {};\n const morphAttrsArrays = {};\n const newIndices = [];\n const getters = [\"getX\", \"getY\", \"getZ\", \"getW\"];\n for (let i2 = 0, l = attributeNames.length; i2 < l; i2++) {\n const name = attributeNames[i2];\n attrArrays[name] = [];\n const morphAttr = geometry2.morphAttributes[name];\n if (morphAttr) {\n morphAttrsArrays[name] = new Array(morphAttr.length).fill(0).map(() => []);\n }\n }\n const decimalShift = Math.log10(1 / tolerance);\n const shiftMultiplier = Math.pow(10, decimalShift);\n for (let i2 = 0; i2 < vertexCount; i2++) {\n const index = indices ? indices.getX(i2) : i2;\n let hash = \"\";\n for (let j = 0, l = attributeNames.length; j < l; j++) {\n const name = attributeNames[j];\n const attribute = geometry2.getAttribute(name);\n const itemSize = attribute.itemSize;\n for (let k = 0; k < itemSize; k++) {\n hash += `${~~(attribute[getters[k]](index) * shiftMultiplier)},`;\n }\n }\n if (hash in hashToIndex) {\n newIndices.push(hashToIndex[hash]);\n } else {\n for (let j = 0, l = attributeNames.length; j < l; j++) {\n const name = attributeNames[j];\n const attribute = geometry2.getAttribute(name);\n const morphAttr = geometry2.morphAttributes[name];\n const itemSize = attribute.itemSize;\n const newarray = attrArrays[name];\n const newMorphArrays = morphAttrsArrays[name];\n for (let k = 0; k < itemSize; k++) {\n const getterFunc = getters[k];\n newarray.push(attribute[getterFunc](index));\n if (morphAttr) {\n for (let m = 0, ml = morphAttr.length; m < ml; m++) {\n newMorphArrays[m].push(morphAttr[m][getterFunc](index));\n }\n }\n }\n }\n hashToIndex[hash] = nextIndex;\n newIndices.push(nextIndex);\n nextIndex++;\n }\n }\n const result = geometry2.clone();\n for (let i2 = 0, l = attributeNames.length; i2 < l; i2++) {\n const name = attributeNames[i2];\n const oldAttribute = geometry2.getAttribute(name);\n const buffer = new oldAttribute.array.constructor(attrArrays[name]);\n const attribute = new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(buffer, oldAttribute.itemSize, oldAttribute.normalized);\n result.setAttribute(name, attribute);\n if (name in morphAttrsArrays) {\n for (let j = 0; j < morphAttrsArrays[name].length; j++) {\n const oldMorphAttribute = geometry2.morphAttributes[name][j];\n const buffer2 = new oldMorphAttribute.array.constructor(morphAttrsArrays[name][j]);\n const morphAttribute = new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(buffer2, oldMorphAttribute.itemSize, oldMorphAttribute.normalized);\n result.morphAttributes[name][j] = morphAttribute;\n }\n }\n }\n result.setIndex(newIndices);\n return result;\n}\nfunction toTrianglesDrawMode(geometry2, drawMode) {\n if (drawMode === three__WEBPACK_IMPORTED_MODULE_42__.TrianglesDrawMode) {\n console.warn(\"THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles.\");\n return geometry2;\n }\n if (drawMode === three__WEBPACK_IMPORTED_MODULE_42__.TriangleFanDrawMode || drawMode === three__WEBPACK_IMPORTED_MODULE_42__.TriangleStripDrawMode) {\n let index = geometry2.getIndex();\n if (index === null) {\n const indices = [];\n const position = geometry2.getAttribute(\"position\");\n if (position !== void 0) {\n for (let i2 = 0; i2 < position.count; i2++) {\n indices.push(i2);\n }\n geometry2.setIndex(indices);\n index = geometry2.getIndex();\n } else {\n console.error(\n \"THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible.\"\n );\n return geometry2;\n }\n }\n const numberOfTriangles = index.count - 2;\n const newIndices = [];\n if (index) {\n if (drawMode === three__WEBPACK_IMPORTED_MODULE_42__.TriangleFanDrawMode) {\n for (let i2 = 1; i2 <= numberOfTriangles; i2++) {\n newIndices.push(index.getX(0));\n newIndices.push(index.getX(i2));\n newIndices.push(index.getX(i2 + 1));\n }\n } else {\n for (let i2 = 0; i2 < numberOfTriangles; i2++) {\n if (i2 % 2 === 0) {\n newIndices.push(index.getX(i2));\n newIndices.push(index.getX(i2 + 1));\n newIndices.push(index.getX(i2 + 2));\n } else {\n newIndices.push(index.getX(i2 + 2));\n newIndices.push(index.getX(i2 + 1));\n newIndices.push(index.getX(i2));\n }\n }\n }\n }\n if (newIndices.length / 3 !== numberOfTriangles) {\n console.error(\"THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.\");\n }\n const newGeometry = geometry2.clone();\n newGeometry.setIndex(newIndices);\n newGeometry.clearGroups();\n return newGeometry;\n } else {\n console.error(\"THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:\", drawMode);\n return geometry2;\n }\n}\nfunction computeMorphedAttributes(object) {\n if (object.geometry.isBufferGeometry !== true) {\n console.error(\"THREE.BufferGeometryUtils: Geometry is not of type BufferGeometry.\");\n return null;\n }\n const _vA2 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const _vB2 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const _vC2 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const _tempA = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const _tempB = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const _tempC = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const _morphA = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const _morphB = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const _morphC = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n function _calculateMorphedAttributeData(object2, material22, attribute, morphAttribute, morphTargetsRelative2, a22, b22, c2, modifiedAttributeArray) {\n _vA2.fromBufferAttribute(attribute, a22);\n _vB2.fromBufferAttribute(attribute, b22);\n _vC2.fromBufferAttribute(attribute, c2);\n const morphInfluences = object2.morphTargetInfluences;\n if (\n // @ts-ignore\n material22.morphTargets && morphAttribute && morphInfluences\n ) {\n _morphA.set(0, 0, 0);\n _morphB.set(0, 0, 0);\n _morphC.set(0, 0, 0);\n for (let i22 = 0, il2 = morphAttribute.length; i22 < il2; i22++) {\n const influence = morphInfluences[i22];\n const morph = morphAttribute[i22];\n if (influence === 0)\n continue;\n _tempA.fromBufferAttribute(morph, a22);\n _tempB.fromBufferAttribute(morph, b22);\n _tempC.fromBufferAttribute(morph, c2);\n if (morphTargetsRelative2) {\n _morphA.addScaledVector(_tempA, influence);\n _morphB.addScaledVector(_tempB, influence);\n _morphC.addScaledVector(_tempC, influence);\n } else {\n _morphA.addScaledVector(_tempA.sub(_vA2), influence);\n _morphB.addScaledVector(_tempB.sub(_vB2), influence);\n _morphC.addScaledVector(_tempC.sub(_vC2), influence);\n }\n }\n _vA2.add(_morphA);\n _vB2.add(_morphB);\n _vC2.add(_morphC);\n }\n if (object2.isSkinnedMesh) {\n object2.boneTransform(a22, _vA2);\n object2.boneTransform(b22, _vB2);\n object2.boneTransform(c2, _vC2);\n }\n modifiedAttributeArray[a22 * 3 + 0] = _vA2.x;\n modifiedAttributeArray[a22 * 3 + 1] = _vA2.y;\n modifiedAttributeArray[a22 * 3 + 2] = _vA2.z;\n modifiedAttributeArray[b22 * 3 + 0] = _vB2.x;\n modifiedAttributeArray[b22 * 3 + 1] = _vB2.y;\n modifiedAttributeArray[b22 * 3 + 2] = _vB2.z;\n modifiedAttributeArray[c2 * 3 + 0] = _vC2.x;\n modifiedAttributeArray[c2 * 3 + 1] = _vC2.y;\n modifiedAttributeArray[c2 * 3 + 2] = _vC2.z;\n }\n const geometry2 = object.geometry;\n const material2 = object.material;\n let a2, b2, c;\n const index = geometry2.index;\n const positionAttribute = geometry2.attributes.position;\n const morphPosition = geometry2.morphAttributes.position;\n const morphTargetsRelative = geometry2.morphTargetsRelative;\n const normalAttribute = geometry2.attributes.normal;\n const morphNormal = geometry2.morphAttributes.position;\n const groups = geometry2.groups;\n const drawRange = geometry2.drawRange;\n let i2, j, il, jl;\n let group, groupMaterial;\n let start, end;\n const modifiedPosition = new Float32Array(positionAttribute.count * positionAttribute.itemSize);\n const modifiedNormal = new Float32Array(normalAttribute.count * normalAttribute.itemSize);\n if (index !== null) {\n if (Array.isArray(material2)) {\n for (i2 = 0, il = groups.length; i2 < il; i2++) {\n group = groups[i2];\n groupMaterial = material2[group.materialIndex];\n start = Math.max(group.start, drawRange.start);\n end = Math.min(group.start + group.count, drawRange.start + drawRange.count);\n for (j = start, jl = end; j < jl; j += 3) {\n a2 = index.getX(j);\n b2 = index.getX(j + 1);\n c = index.getX(j + 2);\n _calculateMorphedAttributeData(\n object,\n groupMaterial,\n positionAttribute,\n morphPosition,\n morphTargetsRelative,\n a2,\n b2,\n c,\n modifiedPosition\n );\n _calculateMorphedAttributeData(\n object,\n groupMaterial,\n normalAttribute,\n morphNormal,\n morphTargetsRelative,\n a2,\n b2,\n c,\n modifiedNormal\n );\n }\n }\n } else {\n start = Math.max(0, drawRange.start);\n end = Math.min(index.count, drawRange.start + drawRange.count);\n for (i2 = start, il = end; i2 < il; i2 += 3) {\n a2 = index.getX(i2);\n b2 = index.getX(i2 + 1);\n c = index.getX(i2 + 2);\n _calculateMorphedAttributeData(\n object,\n material2,\n positionAttribute,\n morphPosition,\n morphTargetsRelative,\n a2,\n b2,\n c,\n modifiedPosition\n );\n _calculateMorphedAttributeData(\n object,\n material2,\n normalAttribute,\n morphNormal,\n morphTargetsRelative,\n a2,\n b2,\n c,\n modifiedNormal\n );\n }\n }\n } else if (positionAttribute !== void 0) {\n if (Array.isArray(material2)) {\n for (i2 = 0, il = groups.length; i2 < il; i2++) {\n group = groups[i2];\n groupMaterial = material2[group.materialIndex];\n start = Math.max(group.start, drawRange.start);\n end = Math.min(group.start + group.count, drawRange.start + drawRange.count);\n for (j = start, jl = end; j < jl; j += 3) {\n a2 = j;\n b2 = j + 1;\n c = j + 2;\n _calculateMorphedAttributeData(\n object,\n groupMaterial,\n positionAttribute,\n morphPosition,\n morphTargetsRelative,\n a2,\n b2,\n c,\n modifiedPosition\n );\n _calculateMorphedAttributeData(\n object,\n groupMaterial,\n normalAttribute,\n morphNormal,\n morphTargetsRelative,\n a2,\n b2,\n c,\n modifiedNormal\n );\n }\n }\n } else {\n start = Math.max(0, drawRange.start);\n end = Math.min(positionAttribute.count, drawRange.start + drawRange.count);\n for (i2 = start, il = end; i2 < il; i2 += 3) {\n a2 = i2;\n b2 = i2 + 1;\n c = i2 + 2;\n _calculateMorphedAttributeData(\n object,\n material2,\n positionAttribute,\n morphPosition,\n morphTargetsRelative,\n a2,\n b2,\n c,\n modifiedPosition\n );\n _calculateMorphedAttributeData(\n object,\n material2,\n normalAttribute,\n morphNormal,\n morphTargetsRelative,\n a2,\n b2,\n c,\n modifiedNormal\n );\n }\n }\n }\n const morphedPositionAttribute = new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(modifiedPosition, 3);\n const morphedNormalAttribute = new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(modifiedNormal, 3);\n return {\n positionAttribute,\n normalAttribute,\n morphedPositionAttribute,\n morphedNormalAttribute\n };\n}\nfunction toCreasedNormals(geometry2, creaseAngle = Math.PI / 3) {\n const creaseDot = Math.cos(creaseAngle);\n const hashMultiplier = (1 + 1e-10) * 100;\n const verts = [new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(), new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(), new three__WEBPACK_IMPORTED_MODULE_42__.Vector3()];\n const tempVec1 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const tempVec2 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const tempNorm = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const tempNorm2 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n function hashVertex(v) {\n const x = ~~(v.x * hashMultiplier);\n const y = ~~(v.y * hashMultiplier);\n const z = ~~(v.z * hashMultiplier);\n return `${x},${y},${z}`;\n }\n const resultGeometry = geometry2.index ? geometry2.toNonIndexed() : geometry2;\n const posAttr = resultGeometry.attributes.position;\n const vertexMap = {};\n for (let i2 = 0, l = posAttr.count / 3; i2 < l; i2++) {\n const i3 = 3 * i2;\n const a2 = verts[0].fromBufferAttribute(posAttr, i3 + 0);\n const b2 = verts[1].fromBufferAttribute(posAttr, i3 + 1);\n const c = verts[2].fromBufferAttribute(posAttr, i3 + 2);\n tempVec1.subVectors(c, b2);\n tempVec2.subVectors(a2, b2);\n const normal = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3().crossVectors(tempVec1, tempVec2).normalize();\n for (let n = 0; n < 3; n++) {\n const vert = verts[n];\n const hash = hashVertex(vert);\n if (!(hash in vertexMap)) {\n vertexMap[hash] = [];\n }\n vertexMap[hash].push(normal);\n }\n }\n const normalArray = new Float32Array(posAttr.count * 3);\n const normAttr = new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(normalArray, 3, false);\n for (let i2 = 0, l = posAttr.count / 3; i2 < l; i2++) {\n const i3 = 3 * i2;\n const a2 = verts[0].fromBufferAttribute(posAttr, i3 + 0);\n const b2 = verts[1].fromBufferAttribute(posAttr, i3 + 1);\n const c = verts[2].fromBufferAttribute(posAttr, i3 + 2);\n tempVec1.subVectors(c, b2);\n tempVec2.subVectors(a2, b2);\n tempNorm.crossVectors(tempVec1, tempVec2).normalize();\n for (let n = 0; n < 3; n++) {\n const vert = verts[n];\n const hash = hashVertex(vert);\n const otherNormals = vertexMap[hash];\n tempNorm2.set(0, 0, 0);\n for (let k = 0, lk = otherNormals.length; k < lk; k++) {\n const otherNorm = otherNormals[k];\n if (tempNorm.dot(otherNorm) > creaseDot) {\n tempNorm2.add(otherNorm);\n }\n }\n tempNorm2.normalize();\n normAttr.setXYZ(i3 + n, tempNorm2.x, tempNorm2.y, tempNorm2.z);\n }\n }\n resultGeometry.setAttribute(\"normal\", normAttr);\n return resultGeometry;\n}\nconst BufferGeometryUtils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({\n __proto__: null,\n computeMorphedAttributes,\n estimateBytesUsed,\n interleaveAttributes,\n mergeBufferAttributes,\n mergeBufferGeometries,\n mergeVertices,\n toCreasedNormals,\n toTrianglesDrawMode\n}, Symbol.toStringTag, { value: \"Module\" }));\nconst cb = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst ab = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nfunction pushIfUnique(array, object) {\n if (array.indexOf(object) === -1)\n array.push(object);\n}\nfunction removeFromArray(array, object) {\n const k = array.indexOf(object);\n if (k > -1)\n array.splice(k, 1);\n}\nclass Vertex {\n constructor(v, id) {\n __publicField(this, \"position\");\n __publicField(this, \"id\");\n __publicField(this, \"faces\");\n __publicField(this, \"neighbors\");\n __publicField(this, \"collapseCost\");\n __publicField(this, \"collapseNeighbor\");\n __publicField(this, \"minCost\", 0);\n __publicField(this, \"totalCost\", 0);\n __publicField(this, \"costCount\", 0);\n this.position = v;\n this.id = id;\n this.faces = [];\n this.neighbors = [];\n this.collapseCost = 0;\n this.collapseNeighbor = null;\n }\n addUniqueNeighbor(vertex) {\n pushIfUnique(this.neighbors, vertex);\n }\n removeIfNonNeighbor(n) {\n const neighbors = this.neighbors;\n const faces = this.faces;\n const offset = neighbors.indexOf(n);\n if (offset === -1)\n return;\n for (let i2 = 0; i2 < faces.length; i2++) {\n if (faces[i2].hasVertex(n))\n return;\n }\n neighbors.splice(offset, 1);\n }\n}\nclass Triangle {\n constructor(v12, v2, v3, a2, b2, c) {\n __publicField(this, \"a\");\n __publicField(this, \"b\");\n __publicField(this, \"c\");\n __publicField(this, \"v1\");\n __publicField(this, \"v2\");\n __publicField(this, \"v3\");\n __publicField(this, \"normal\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n this.a = a2;\n this.b = b2;\n this.c = c;\n this.v1 = v12;\n this.v2 = v2;\n this.v3 = v3;\n this.computeNormal();\n v12.faces.push(this);\n v12.addUniqueNeighbor(v2);\n v12.addUniqueNeighbor(v3);\n v2.faces.push(this);\n v2.addUniqueNeighbor(v12);\n v2.addUniqueNeighbor(v3);\n v3.faces.push(this);\n v3.addUniqueNeighbor(v12);\n v3.addUniqueNeighbor(v2);\n }\n computeNormal() {\n const vA = this.v1.position;\n const vB = this.v2.position;\n const vC = this.v3.position;\n cb.subVectors(vC, vB);\n ab.subVectors(vA, vB);\n cb.cross(ab).normalize();\n this.normal.copy(cb);\n }\n hasVertex(v) {\n return v === this.v1 || v === this.v2 || v === this.v3;\n }\n replaceVertex(oldv, newv) {\n if (oldv === this.v1)\n this.v1 = newv;\n else if (oldv === this.v2)\n this.v2 = newv;\n else if (oldv === this.v3)\n this.v3 = newv;\n removeFromArray(oldv.faces, this);\n newv.faces.push(this);\n oldv.removeIfNonNeighbor(this.v1);\n this.v1.removeIfNonNeighbor(oldv);\n oldv.removeIfNonNeighbor(this.v2);\n this.v2.removeIfNonNeighbor(oldv);\n oldv.removeIfNonNeighbor(this.v3);\n this.v3.removeIfNonNeighbor(oldv);\n this.v1.addUniqueNeighbor(this.v2);\n this.v1.addUniqueNeighbor(this.v3);\n this.v2.addUniqueNeighbor(this.v1);\n this.v2.addUniqueNeighbor(this.v3);\n this.v3.addUniqueNeighbor(this.v1);\n this.v3.addUniqueNeighbor(this.v2);\n this.computeNormal();\n }\n}\nclass SimplifyModifier {\n constructor() {\n __publicField(this, \"computeEdgeCollapseCost\", (u, v) => {\n const edgelength = v.position.distanceTo(u.position);\n let curvature = 0;\n const sideFaces = [];\n let i2, il = u.faces.length, face, sideFace;\n for (i2 = 0; i2 < il; i2++) {\n face = u.faces[i2];\n if (face.hasVertex(v)) {\n sideFaces.push(face);\n }\n }\n for (i2 = 0; i2 < il; i2++) {\n let minCurvature = 1;\n face = u.faces[i2];\n for (let j = 0; j < sideFaces.length; j++) {\n sideFace = sideFaces[j];\n const dotProd = face.normal.dot(sideFace.normal);\n minCurvature = Math.min(minCurvature, (1.001 - dotProd) / 2);\n }\n curvature = Math.max(curvature, minCurvature);\n }\n const borders = 0;\n if (sideFaces.length < 2) {\n curvature = 1;\n }\n const amt = edgelength * curvature + borders;\n return amt;\n });\n __publicField(this, \"computeEdgeCostAtVertex\", (v) => {\n if (v.neighbors.length === 0) {\n v.collapseNeighbor = null;\n v.collapseCost = -0.01;\n return;\n }\n v.collapseCost = 1e5;\n v.collapseNeighbor = null;\n for (let i2 = 0; i2 < v.neighbors.length; i2++) {\n const collapseCost = this.computeEdgeCollapseCost(v, v.neighbors[i2]);\n if (!v.collapseNeighbor) {\n v.collapseNeighbor = v.neighbors[i2];\n v.collapseCost = collapseCost;\n v.minCost = collapseCost;\n v.totalCost = 0;\n v.costCount = 0;\n }\n v.costCount++;\n v.totalCost += collapseCost;\n if (collapseCost < v.minCost) {\n v.collapseNeighbor = v.neighbors[i2];\n v.minCost = collapseCost;\n }\n }\n v.collapseCost = v.totalCost / v.costCount;\n });\n __publicField(this, \"removeFace\", (f, faces) => {\n removeFromArray(faces, f);\n if (f.v1)\n removeFromArray(f.v1.faces, f);\n if (f.v2)\n removeFromArray(f.v2.faces, f);\n if (f.v3)\n removeFromArray(f.v3.faces, f);\n const vs = [f.v1, f.v2, f.v3];\n let v12, v2;\n for (let i2 = 0; i2 < 3; i2++) {\n v12 = vs[i2];\n v2 = vs[(i2 + 1) % 3];\n if (!v12 || !v2)\n continue;\n v12.removeIfNonNeighbor(v2);\n v2.removeIfNonNeighbor(v12);\n }\n });\n __publicField(this, \"collapse\", (vertices, faces, u, v) => {\n if (!v) {\n this.removeVertex(u, vertices);\n return;\n }\n let i2;\n const tmpVertices = [];\n for (i2 = 0; i2 < u.neighbors.length; i2++) {\n tmpVertices.push(u.neighbors[i2]);\n }\n for (i2 = u.faces.length - 1; i2 >= 0; i2--) {\n if (u.faces[i2].hasVertex(v)) {\n this.removeFace(u.faces[i2], faces);\n }\n }\n for (i2 = u.faces.length - 1; i2 >= 0; i2--) {\n u.faces[i2].replaceVertex(u, v);\n }\n this.removeVertex(u, vertices);\n for (i2 = 0; i2 < tmpVertices.length; i2++) {\n this.computeEdgeCostAtVertex(tmpVertices[i2]);\n }\n });\n __publicField(this, \"minimumCostEdge\", (vertices) => {\n let least = vertices[0];\n for (let i2 = 0; i2 < vertices.length; i2++) {\n if (vertices[i2].collapseCost < least.collapseCost) {\n least = vertices[i2];\n }\n }\n return least;\n });\n __publicField(this, \"modify\", (geometry2, count) => {\n geometry2 = geometry2.clone();\n const attributes = geometry2.attributes;\n for (let name in attributes) {\n if (name !== \"position\")\n geometry2.deleteAttribute(name);\n }\n geometry2 = mergeVertices(geometry2);\n const vertices = [];\n const faces = [];\n const positionAttribute = geometry2.getAttribute(\"position\");\n for (let i2 = 0; i2 < positionAttribute.count; i2++) {\n const v = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3().fromBufferAttribute(positionAttribute, i2);\n const vertex = new Vertex(v, i2);\n vertices.push(vertex);\n }\n const geomIndex = geometry2.getIndex();\n if (geomIndex !== null) {\n for (let i2 = 0; i2 < geomIndex.count; i2 += 3) {\n const a2 = geomIndex.getX(i2);\n const b2 = geomIndex.getX(i2 + 1);\n const c = geomIndex.getX(i2 + 2);\n const triangle = new Triangle(vertices[a2], vertices[b2], vertices[c], a2, b2, c);\n faces.push(triangle);\n }\n } else {\n for (let i2 = 0; i2 < positionAttribute.count; i2 += 3) {\n const a2 = i2;\n const b2 = i2 + 1;\n const c = i2 + 2;\n const triangle = new Triangle(vertices[a2], vertices[b2], vertices[c], a2, b2, c);\n faces.push(triangle);\n }\n }\n for (let i2 = 0, il = vertices.length; i2 < il; i2++) {\n this.computeEdgeCostAtVertex(vertices[i2]);\n }\n let nextVertex;\n let z = count;\n while (z--) {\n nextVertex = this.minimumCostEdge(vertices);\n if (!nextVertex) {\n console.log(\"THREE.SimplifyModifier: No next vertex\");\n break;\n } else {\n this.collapse(vertices, faces, nextVertex, nextVertex.collapseNeighbor);\n }\n }\n const simplifiedGeometry = new three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry();\n const position = [];\n let index = [];\n for (let i2 = 0; i2 < vertices.length; i2++) {\n const vertex = vertices[i2].position;\n position.push(vertex.x, vertex.y, vertex.z);\n }\n for (let i2 = 0; i2 < faces.length; i2++) {\n const face = faces[i2];\n const a2 = vertices.indexOf(face.v1);\n const b2 = vertices.indexOf(face.v2);\n const c = vertices.indexOf(face.v3);\n index.push(a2, b2, c);\n }\n simplifiedGeometry.setAttribute(\"position\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(position, 3));\n simplifiedGeometry.setIndex(index);\n return simplifiedGeometry;\n });\n }\n removeVertex(v, vertices) {\n console.assert(v.faces.length === 0);\n while (v.neighbors.length) {\n const n = v.neighbors.pop();\n removeFromArray(n.neighbors, v);\n }\n removeFromArray(vertices, v);\n }\n}\nclass EdgeSplitModifier {\n constructor() {\n __publicField(this, \"A\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"B\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"C\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"positions\", []);\n __publicField(this, \"normals\", new Float32Array());\n __publicField(this, \"indexes\", []);\n __publicField(this, \"pointToIndexMap\", []);\n __publicField(this, \"splitIndexes\", []);\n __publicField(this, \"oldNormals\", []);\n __publicField(this, \"computeNormals\", () => {\n this.normals = new Float32Array(this.indexes.length * 3);\n for (let i2 = 0; i2 < this.indexes.length; i2 += 3) {\n let index = this.indexes[i2];\n this.A.set(this.positions[3 * index], this.positions[3 * index + 1], this.positions[3 * index + 2]);\n index = this.indexes[i2 + 1];\n this.B.set(this.positions[3 * index], this.positions[3 * index + 1], this.positions[3 * index + 2]);\n index = this.indexes[i2 + 2];\n this.C.set(this.positions[3 * index], this.positions[3 * index + 1], this.positions[3 * index + 2]);\n this.C.sub(this.B);\n this.A.sub(this.B);\n const normal = this.C.cross(this.A).normalize();\n for (let j = 0; j < 3; j++) {\n this.normals[3 * (i2 + j)] = normal.x;\n this.normals[3 * (i2 + j) + 1] = normal.y;\n this.normals[3 * (i2 + j) + 2] = normal.z;\n }\n }\n });\n __publicField(this, \"mapPositionsToIndexes\", () => {\n this.pointToIndexMap = Array(this.positions.length / 3);\n for (let i2 = 0; i2 < this.indexes.length; i2++) {\n const index = this.indexes[i2];\n if (this.pointToIndexMap[index] == null) {\n this.pointToIndexMap[index] = [];\n }\n this.pointToIndexMap[index].push(i2);\n }\n });\n __publicField(this, \"edgeSplitToGroups\", (indexes, cutOff, firstIndex) => {\n this.A.set(\n this.normals[3 * firstIndex],\n this.normals[3 * firstIndex + 1],\n this.normals[3 * firstIndex + 2]\n ).normalize();\n const result = {\n splitGroup: [],\n currentGroup: [firstIndex]\n };\n for (let j of indexes) {\n if (j !== firstIndex) {\n this.B.set(this.normals[3 * j], this.normals[3 * j + 1], this.normals[3 * j + 2]).normalize();\n if (this.B.dot(this.A) < cutOff) {\n result.splitGroup.push(j);\n } else {\n result.currentGroup.push(j);\n }\n }\n }\n return result;\n });\n __publicField(this, \"edgeSplit\", (indexes, cutOff, original = null) => {\n if (indexes.length === 0)\n return;\n const groupResults = [];\n for (let index of indexes) {\n groupResults.push(this.edgeSplitToGroups(indexes, cutOff, index));\n }\n let result = groupResults[0];\n for (let groupResult of groupResults) {\n if (groupResult.currentGroup.length > result.currentGroup.length) {\n result = groupResult;\n }\n }\n if (original != null) {\n this.splitIndexes.push({\n original,\n indexes: result.currentGroup\n });\n }\n if (result.splitGroup.length) {\n this.edgeSplit(result.splitGroup, cutOff, original || result.currentGroup[0]);\n }\n });\n __publicField(this, \"modify\", (geometry2, cutOffAngle, tryKeepNormals = true) => {\n let hadNormals = false;\n if (geometry2.attributes.normal) {\n hadNormals = true;\n geometry2 = geometry2.clone();\n if (tryKeepNormals === true && geometry2.index !== null) {\n this.oldNormals = geometry2.attributes.normal.array;\n }\n geometry2.deleteAttribute(\"normal\");\n }\n if (geometry2.index == null) {\n if (BufferGeometryUtils === void 0) {\n throw \"THREE.EdgeSplitModifier relies on BufferGeometryUtils\";\n }\n geometry2 = mergeVertices(geometry2);\n }\n this.indexes = geometry2.index.array;\n this.positions = geometry2.getAttribute(\"position\").array;\n this.computeNormals();\n this.mapPositionsToIndexes();\n this.splitIndexes = [];\n for (let vertexIndexes of this.pointToIndexMap) {\n this.edgeSplit(vertexIndexes, Math.cos(cutOffAngle) - 1e-3);\n }\n const newAttributes = {};\n for (let name of Object.keys(geometry2.attributes)) {\n const oldAttribute = geometry2.attributes[name];\n const newArray = new oldAttribute.array.constructor(\n (this.indexes.length + this.splitIndexes.length) * oldAttribute.itemSize\n );\n newArray.set(oldAttribute.array);\n newAttributes[name] = new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(newArray, oldAttribute.itemSize, oldAttribute.normalized);\n }\n const newIndexes = new Uint32Array(this.indexes.length);\n newIndexes.set(this.indexes);\n for (let i2 = 0; i2 < this.splitIndexes.length; i2++) {\n const split = this.splitIndexes[i2];\n const index = this.indexes[split.original];\n for (let attribute of Object.values(newAttributes)) {\n for (let j = 0; j < attribute.itemSize; j++) {\n attribute.array[(this.indexes.length + i2) * attribute.itemSize + j] = attribute.array[index * attribute.itemSize + j];\n }\n }\n for (let j of split.indexes) {\n newIndexes[j] = this.indexes.length + i2;\n }\n }\n geometry2 = new three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry();\n geometry2.setIndex(new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(newIndexes, 1));\n for (let name of Object.keys(newAttributes)) {\n geometry2.setAttribute(name, newAttributes[name]);\n }\n if (hadNormals) {\n geometry2.computeVertexNormals();\n if (this.oldNormals !== null) {\n const changedNormals = new Array(this.oldNormals.length / 3).fill(false);\n for (let splitData of this.splitIndexes)\n changedNormals[splitData.original] = true;\n for (let i2 = 0; i2 < changedNormals.length; i2++) {\n if (changedNormals[i2] === false) {\n for (let j = 0; j < 3; j++) {\n geometry2.attributes.normal.array[3 * i2 + j] = this.oldNormals[3 * i2 + j];\n }\n }\n }\n }\n }\n return geometry2;\n });\n }\n}\nclass TessellateModifier {\n constructor(maxEdgeLength = 0.1, maxIterations = 6) {\n __publicField(this, \"maxEdgeLength\");\n __publicField(this, \"maxIterations\");\n __publicField(this, \"modify\", (geometry2) => {\n if (geometry2.index !== null) {\n geometry2 = geometry2.toNonIndexed();\n }\n const maxIterations = this.maxIterations;\n const maxEdgeLengthSquared = this.maxEdgeLength * this.maxEdgeLength;\n const va = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const vb = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const vc = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const vm = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const vs = [va, vb, vc, vm];\n const na = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const nb = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const nc = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const nm = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const ns = [na, nb, nc, nm];\n const ca = new three__WEBPACK_IMPORTED_MODULE_42__.Color();\n const cb2 = new three__WEBPACK_IMPORTED_MODULE_42__.Color();\n const cc = new three__WEBPACK_IMPORTED_MODULE_42__.Color();\n const cm = new three__WEBPACK_IMPORTED_MODULE_42__.Color();\n const cs = [ca, cb2, cc, cm];\n const ua = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2();\n const ub = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2();\n const uc = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2();\n const um = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2();\n const us = [ua, ub, uc, um];\n const u2a = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2();\n const u2b = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2();\n const u2c = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2();\n const u2m = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2();\n const u2s = [u2a, u2b, u2c, u2m];\n const attributes = geometry2.attributes;\n const hasNormals = attributes.normal !== void 0;\n const hasColors = attributes.color !== void 0;\n const hasUVs = attributes.uv !== void 0;\n const hasUV2s = attributes.uv2 !== void 0;\n let positions = attributes.position.array;\n let normals = hasNormals ? attributes.normal.array : null;\n let colors = hasColors ? attributes.color.array : null;\n let uvs = hasUVs ? attributes.uv.array : null;\n let uv2s = hasUV2s ? attributes.uv2.array : null;\n let positions2 = positions;\n let normals2 = normals;\n let colors2 = colors;\n let uvs2 = uvs;\n let uv2s2 = uv2s;\n let iteration = 0;\n let tessellating = true;\n function addTriangle(a2, b2, c) {\n const v12 = vs[a2];\n const v2 = vs[b2];\n const v3 = vs[c];\n positions2.push(v12.x, v12.y, v12.z);\n positions2.push(v2.x, v2.y, v2.z);\n positions2.push(v3.x, v3.y, v3.z);\n if (hasNormals) {\n const n1 = ns[a2];\n const n2 = ns[b2];\n const n3 = ns[c];\n normals2.push(n1.x, n1.y, n1.z);\n normals2.push(n2.x, n2.y, n2.z);\n normals2.push(n3.x, n3.y, n3.z);\n }\n if (hasColors) {\n const c1 = cs[a2];\n const c2 = cs[b2];\n const c3 = cs[c];\n colors2.push(c1.r, c1.g, c1.b);\n colors2.push(c2.r, c2.g, c2.b);\n colors2.push(c3.r, c3.g, c3.b);\n }\n if (hasUVs) {\n const u1 = us[a2];\n const u2 = us[b2];\n const u3 = us[c];\n uvs2.push(u1.x, u1.y);\n uvs2.push(u2.x, u2.y);\n uvs2.push(u3.x, u3.y);\n }\n if (hasUV2s) {\n const u21 = u2s[a2];\n const u22 = u2s[b2];\n const u23 = u2s[c];\n uv2s2.push(u21.x, u21.y);\n uv2s2.push(u22.x, u22.y);\n uv2s2.push(u23.x, u23.y);\n }\n }\n while (tessellating && iteration < maxIterations) {\n iteration++;\n tessellating = false;\n positions = positions2;\n positions2 = [];\n if (hasNormals) {\n normals = normals2;\n normals2 = [];\n }\n if (hasColors) {\n colors = colors2;\n colors2 = [];\n }\n if (hasUVs) {\n uvs = uvs2;\n uvs2 = [];\n }\n if (hasUV2s) {\n uv2s = uv2s2;\n uv2s2 = [];\n }\n for (let i2 = 0, i22 = 0, il = positions.length; i2 < il; i2 += 9, i22 += 6) {\n va.fromArray(positions, i2 + 0);\n vb.fromArray(positions, i2 + 3);\n vc.fromArray(positions, i2 + 6);\n if (hasNormals && normals) {\n na.fromArray(normals, i2 + 0);\n nb.fromArray(normals, i2 + 3);\n nc.fromArray(normals, i2 + 6);\n }\n if (hasColors && colors) {\n ca.fromArray(colors, i2 + 0);\n cb2.fromArray(colors, i2 + 3);\n cc.fromArray(colors, i2 + 6);\n }\n if (hasUVs && uvs) {\n ua.fromArray(uvs, i22 + 0);\n ub.fromArray(uvs, i22 + 2);\n uc.fromArray(uvs, i22 + 4);\n }\n if (hasUV2s && uv2s) {\n u2a.fromArray(uv2s, i22 + 0);\n u2b.fromArray(uv2s, i22 + 2);\n u2c.fromArray(uv2s, i22 + 4);\n }\n const dab = va.distanceToSquared(vb);\n const dbc = vb.distanceToSquared(vc);\n const dac = va.distanceToSquared(vc);\n if (dab > maxEdgeLengthSquared || dbc > maxEdgeLengthSquared || dac > maxEdgeLengthSquared) {\n tessellating = true;\n if (dab >= dbc && dab >= dac) {\n vm.lerpVectors(va, vb, 0.5);\n if (hasNormals)\n nm.lerpVectors(na, nb, 0.5);\n if (hasColors)\n cm.lerpColors(ca, cb2, 0.5);\n if (hasUVs)\n um.lerpVectors(ua, ub, 0.5);\n if (hasUV2s)\n u2m.lerpVectors(u2a, u2b, 0.5);\n addTriangle(0, 3, 2);\n addTriangle(3, 1, 2);\n } else if (dbc >= dab && dbc >= dac) {\n vm.lerpVectors(vb, vc, 0.5);\n if (hasNormals)\n nm.lerpVectors(nb, nc, 0.5);\n if (hasColors)\n cm.lerpColors(cb2, cc, 0.5);\n if (hasUVs)\n um.lerpVectors(ub, uc, 0.5);\n if (hasUV2s)\n u2m.lerpVectors(u2b, u2c, 0.5);\n addTriangle(0, 1, 3);\n addTriangle(3, 2, 0);\n } else {\n vm.lerpVectors(va, vc, 0.5);\n if (hasNormals)\n nm.lerpVectors(na, nc, 0.5);\n if (hasColors)\n cm.lerpColors(ca, cc, 0.5);\n if (hasUVs)\n um.lerpVectors(ua, uc, 0.5);\n if (hasUV2s)\n u2m.lerpVectors(u2a, u2c, 0.5);\n addTriangle(0, 1, 3);\n addTriangle(3, 1, 2);\n }\n } else {\n addTriangle(0, 1, 2);\n }\n }\n }\n const geometry22 = new three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry();\n geometry22.setAttribute(\"position\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(positions2, 3));\n if (hasNormals) {\n geometry22.setAttribute(\"normal\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(normals2, 3));\n }\n if (hasColors) {\n geometry22.setAttribute(\"color\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(colors2, 3));\n }\n if (hasUVs) {\n geometry22.setAttribute(\"uv\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(uvs2, 2));\n }\n if (hasUV2s) {\n geometry22.setAttribute(\"uv2\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(uv2s2, 2));\n }\n return geometry22;\n });\n this.maxEdgeLength = maxEdgeLength;\n this.maxIterations = maxIterations;\n }\n}\nlet _renderer;\nlet fullscreenQuadGeometry;\nlet fullscreenQuadMaterial;\nlet fullscreenQuad;\nfunction decompress(texture, maxTextureSize = Infinity, renderer = null) {\n if (!fullscreenQuadGeometry)\n fullscreenQuadGeometry = new three__WEBPACK_IMPORTED_MODULE_42__.PlaneGeometry(2, 2, 1, 1);\n if (!fullscreenQuadMaterial)\n fullscreenQuadMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: { blitTexture: new three__WEBPACK_IMPORTED_MODULE_42__.Uniform(texture) },\n vertexShader: (\n /* glsl */\n `\n varying vec2 vUv;\n void main(){\n vUv = uv;\n gl_Position = vec4(position.xy * 1.0,0.,.999999);\n }\n `\n ),\n fragmentShader: (\n /* glsl */\n `\n uniform sampler2D blitTexture; \n varying vec2 vUv;\n\n void main(){ \n gl_FragColor = vec4(vUv.xy, 0, 1);\n \n #ifdef IS_SRGB\n gl_FragColor = LinearTosRGB( texture2D( blitTexture, vUv) );\n #else\n gl_FragColor = texture2D( blitTexture, vUv);\n #endif\n }\n `\n )\n });\n fullscreenQuadMaterial.uniforms.blitTexture.value = texture;\n fullscreenQuadMaterial.defines.IS_SRGB = \"colorSpace\" in texture ? texture.colorSpace === \"srgb\" : texture.encoding === 3001;\n fullscreenQuadMaterial.needsUpdate = true;\n if (!fullscreenQuad) {\n fullscreenQuad = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(fullscreenQuadGeometry, fullscreenQuadMaterial);\n fullscreenQuad.frustrumCulled = false;\n }\n const _camera = new three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera();\n const _scene = new three__WEBPACK_IMPORTED_MODULE_42__.Scene();\n _scene.add(fullscreenQuad);\n if (!renderer) {\n renderer = _renderer = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderer({ antialias: false });\n }\n renderer.setSize(Math.min(texture.image.width, maxTextureSize), Math.min(texture.image.height, maxTextureSize));\n renderer.clear();\n renderer.render(_scene, _camera);\n const readableTexture = new three__WEBPACK_IMPORTED_MODULE_42__.Texture(renderer.domElement);\n readableTexture.minFilter = texture.minFilter;\n readableTexture.magFilter = texture.magFilter;\n readableTexture.wrapS = texture.wrapS;\n readableTexture.wrapT = texture.wrapT;\n readableTexture.name = texture.name;\n if (_renderer) {\n _renderer.dispose();\n _renderer = null;\n }\n return readableTexture;\n}\nconst KHR_mesh_quantization_ExtraAttrTypes = {\n POSITION: [\n \"byte\",\n \"byte normalized\",\n \"unsigned byte\",\n \"unsigned byte normalized\",\n \"short\",\n \"short normalized\",\n \"unsigned short\",\n \"unsigned short normalized\"\n ],\n NORMAL: [\"byte normalized\", \"short normalized\"],\n TANGENT: [\"byte normalized\", \"short normalized\"],\n TEXCOORD: [\"byte\", \"byte normalized\", \"unsigned byte\", \"short\", \"short normalized\", \"unsigned short\"]\n};\nclass GLTFExporter {\n constructor() {\n this.pluginCallbacks = [];\n this.register(function(writer) {\n return new GLTFLightExtension(writer);\n });\n this.register(function(writer) {\n return new GLTFMaterialsUnlitExtension$1(writer);\n });\n this.register(function(writer) {\n return new GLTFMaterialsTransmissionExtension$1(writer);\n });\n this.register(function(writer) {\n return new GLTFMaterialsVolumeExtension$1(writer);\n });\n this.register(function(writer) {\n return new GLTFMaterialsIorExtension$1(writer);\n });\n this.register(function(writer) {\n return new GLTFMaterialsSpecularExtension$1(writer);\n });\n this.register(function(writer) {\n return new GLTFMaterialsClearcoatExtension$1(writer);\n });\n this.register(function(writer) {\n return new GLTFMaterialsIridescenceExtension$1(writer);\n });\n this.register(function(writer) {\n return new GLTFMaterialsSheenExtension$1(writer);\n });\n this.register(function(writer) {\n return new GLTFMaterialsAnisotropyExtension$1(writer);\n });\n this.register(function(writer) {\n return new GLTFMaterialsEmissiveStrengthExtension$1(writer);\n });\n }\n register(callback) {\n if (this.pluginCallbacks.indexOf(callback) === -1) {\n this.pluginCallbacks.push(callback);\n }\n return this;\n }\n unregister(callback) {\n if (this.pluginCallbacks.indexOf(callback) !== -1) {\n this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(callback), 1);\n }\n return this;\n }\n /**\n * Parse scenes and generate GLTF output\n * @param {Scene or [THREE.Scenes]} input Scene or Array of THREE.Scenes\n * @param {Function} onDone Callback on completed\n * @param {Function} onError Callback on errors\n * @param {Object} options options\n */\n parse(input, onDone, onError, options) {\n const writer = new GLTFWriter();\n const plugins = [];\n for (let i2 = 0, il = this.pluginCallbacks.length; i2 < il; i2++) {\n plugins.push(this.pluginCallbacks[i2](writer));\n }\n writer.setPlugins(plugins);\n writer.write(input, onDone, options).catch(onError);\n }\n parseAsync(input, options) {\n const scope = this;\n return new Promise(function(resolve, reject) {\n scope.parse(input, resolve, reject, options);\n });\n }\n}\nconst WEBGL_CONSTANTS$1 = {\n POINTS: 0,\n LINES: 1,\n LINE_LOOP: 2,\n LINE_STRIP: 3,\n TRIANGLES: 4,\n TRIANGLE_STRIP: 5,\n TRIANGLE_FAN: 6,\n BYTE: 5120,\n UNSIGNED_BYTE: 5121,\n SHORT: 5122,\n UNSIGNED_SHORT: 5123,\n INT: 5124,\n UNSIGNED_INT: 5125,\n FLOAT: 5126,\n ARRAY_BUFFER: 34962,\n ELEMENT_ARRAY_BUFFER: 34963,\n NEAREST: 9728,\n LINEAR: 9729,\n NEAREST_MIPMAP_NEAREST: 9984,\n LINEAR_MIPMAP_NEAREST: 9985,\n NEAREST_MIPMAP_LINEAR: 9986,\n LINEAR_MIPMAP_LINEAR: 9987,\n CLAMP_TO_EDGE: 33071,\n MIRRORED_REPEAT: 33648,\n REPEAT: 10497\n};\nconst KHR_MESH_QUANTIZATION = \"KHR_mesh_quantization\";\nconst THREE_TO_WEBGL = {};\nTHREE_TO_WEBGL[three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter] = WEBGL_CONSTANTS$1.NEAREST;\nTHREE_TO_WEBGL[three__WEBPACK_IMPORTED_MODULE_42__.NearestMipmapNearestFilter] = WEBGL_CONSTANTS$1.NEAREST_MIPMAP_NEAREST;\nTHREE_TO_WEBGL[three__WEBPACK_IMPORTED_MODULE_42__.NearestMipmapLinearFilter] = WEBGL_CONSTANTS$1.NEAREST_MIPMAP_LINEAR;\nTHREE_TO_WEBGL[three__WEBPACK_IMPORTED_MODULE_42__.LinearFilter] = WEBGL_CONSTANTS$1.LINEAR;\nTHREE_TO_WEBGL[three__WEBPACK_IMPORTED_MODULE_42__.LinearMipmapNearestFilter] = WEBGL_CONSTANTS$1.LINEAR_MIPMAP_NEAREST;\nTHREE_TO_WEBGL[three__WEBPACK_IMPORTED_MODULE_42__.LinearMipmapLinearFilter] = WEBGL_CONSTANTS$1.LINEAR_MIPMAP_LINEAR;\nTHREE_TO_WEBGL[three__WEBPACK_IMPORTED_MODULE_42__.ClampToEdgeWrapping] = WEBGL_CONSTANTS$1.CLAMP_TO_EDGE;\nTHREE_TO_WEBGL[three__WEBPACK_IMPORTED_MODULE_42__.RepeatWrapping] = WEBGL_CONSTANTS$1.REPEAT;\nTHREE_TO_WEBGL[three__WEBPACK_IMPORTED_MODULE_42__.MirroredRepeatWrapping] = WEBGL_CONSTANTS$1.MIRRORED_REPEAT;\nconst PATH_PROPERTIES$1 = {\n scale: \"scale\",\n position: \"translation\",\n quaternion: \"rotation\",\n morphTargetInfluences: \"weights\"\n};\nconst DEFAULT_SPECULAR_COLOR = new three__WEBPACK_IMPORTED_MODULE_42__.Color();\nconst GLB_HEADER_BYTES = 12;\nconst GLB_HEADER_MAGIC = 1179937895;\nconst GLB_VERSION = 2;\nconst GLB_CHUNK_PREFIX_BYTES = 8;\nconst GLB_CHUNK_TYPE_JSON = 1313821514;\nconst GLB_CHUNK_TYPE_BIN = 5130562;\nfunction equalArray(array1, array2) {\n return array1.length === array2.length && array1.every(function(element, index) {\n return element === array2[index];\n });\n}\nfunction stringToArrayBuffer(text) {\n return new TextEncoder().encode(text).buffer;\n}\nfunction isIdentityMatrix(matrix2) {\n return equalArray(matrix2.elements, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);\n}\nfunction getMinMax(attribute, start, count) {\n const output = {\n min: new Array(attribute.itemSize).fill(Number.POSITIVE_INFINITY),\n max: new Array(attribute.itemSize).fill(Number.NEGATIVE_INFINITY)\n };\n for (let i2 = start; i2 < start + count; i2++) {\n for (let a2 = 0; a2 < attribute.itemSize; a2++) {\n let value;\n if (attribute.itemSize > 4) {\n value = attribute.array[i2 * attribute.itemSize + a2];\n } else {\n if (a2 === 0)\n value = attribute.getX(i2);\n else if (a2 === 1)\n value = attribute.getY(i2);\n else if (a2 === 2)\n value = attribute.getZ(i2);\n else if (a2 === 3)\n value = attribute.getW(i2);\n if (attribute.normalized === true) {\n value = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.normalize(value, attribute.array);\n }\n }\n output.min[a2] = Math.min(output.min[a2], value);\n output.max[a2] = Math.max(output.max[a2], value);\n }\n }\n return output;\n}\nfunction getPaddedBufferSize(bufferSize) {\n return Math.ceil(bufferSize / 4) * 4;\n}\nfunction getPaddedArrayBuffer(arrayBuffer, paddingByte = 0) {\n const paddedLength = getPaddedBufferSize(arrayBuffer.byteLength);\n if (paddedLength !== arrayBuffer.byteLength) {\n const array = new Uint8Array(paddedLength);\n array.set(new Uint8Array(arrayBuffer));\n if (paddingByte !== 0) {\n for (let i2 = arrayBuffer.byteLength; i2 < paddedLength; i2++) {\n array[i2] = paddingByte;\n }\n }\n return array.buffer;\n }\n return arrayBuffer;\n}\nfunction getCanvas() {\n if (typeof document === \"undefined\" && typeof OffscreenCanvas !== \"undefined\") {\n return new OffscreenCanvas(1, 1);\n }\n return document.createElement(\"canvas\");\n}\nfunction getToBlobPromise(canvas, mimeType) {\n if (canvas.toBlob !== void 0) {\n return new Promise((resolve) => canvas.toBlob(resolve, mimeType));\n }\n let quality;\n if (mimeType === \"image/jpeg\") {\n quality = 0.92;\n } else if (mimeType === \"image/webp\") {\n quality = 0.8;\n }\n return canvas.convertToBlob({\n type: mimeType,\n quality\n });\n}\nclass GLTFWriter {\n constructor() {\n this.plugins = [];\n this.options = {};\n this.pending = [];\n this.buffers = [];\n this.byteOffset = 0;\n this.buffers = [];\n this.nodeMap = /* @__PURE__ */ new Map();\n this.skins = [];\n this.extensionsUsed = {};\n this.extensionsRequired = {};\n this.uids = /* @__PURE__ */ new Map();\n this.uid = 0;\n this.json = {\n asset: {\n version: \"2.0\",\n generator: \"THREE.GLTFExporter\"\n }\n };\n this.cache = {\n meshes: /* @__PURE__ */ new Map(),\n attributes: /* @__PURE__ */ new Map(),\n attributesNormalized: /* @__PURE__ */ new Map(),\n materials: /* @__PURE__ */ new Map(),\n textures: /* @__PURE__ */ new Map(),\n images: /* @__PURE__ */ new Map()\n };\n }\n setPlugins(plugins) {\n this.plugins = plugins;\n }\n /**\n * Parse scenes and generate GLTF output\n * @param {Scene or [THREE.Scenes]} input Scene or Array of THREE.Scenes\n * @param {Function} onDone Callback on completed\n * @param {Object} options options\n */\n async write(input, onDone, options = {}) {\n this.options = Object.assign(\n {\n // default options\n binary: false,\n trs: false,\n onlyVisible: true,\n maxTextureSize: Infinity,\n animations: [],\n includeCustomExtensions: false\n },\n options\n );\n if (this.options.animations.length > 0) {\n this.options.trs = true;\n }\n this.processInput(input);\n await Promise.all(this.pending);\n const writer = this;\n const buffers = writer.buffers;\n const json = writer.json;\n options = writer.options;\n const extensionsUsed = writer.extensionsUsed;\n const extensionsRequired = writer.extensionsRequired;\n const blob = new Blob(buffers, { type: \"application/octet-stream\" });\n const extensionsUsedList = Object.keys(extensionsUsed);\n const extensionsRequiredList = Object.keys(extensionsRequired);\n if (extensionsUsedList.length > 0)\n json.extensionsUsed = extensionsUsedList;\n if (extensionsRequiredList.length > 0)\n json.extensionsRequired = extensionsRequiredList;\n if (json.buffers && json.buffers.length > 0)\n json.buffers[0].byteLength = blob.size;\n if (options.binary === true) {\n const reader = new FileReader();\n reader.readAsArrayBuffer(blob);\n reader.onloadend = function() {\n const binaryChunk = getPaddedArrayBuffer(reader.result);\n const binaryChunkPrefix = new DataView(new ArrayBuffer(GLB_CHUNK_PREFIX_BYTES));\n binaryChunkPrefix.setUint32(0, binaryChunk.byteLength, true);\n binaryChunkPrefix.setUint32(4, GLB_CHUNK_TYPE_BIN, true);\n const jsonChunk = getPaddedArrayBuffer(stringToArrayBuffer(JSON.stringify(json)), 32);\n const jsonChunkPrefix = new DataView(new ArrayBuffer(GLB_CHUNK_PREFIX_BYTES));\n jsonChunkPrefix.setUint32(0, jsonChunk.byteLength, true);\n jsonChunkPrefix.setUint32(4, GLB_CHUNK_TYPE_JSON, true);\n const header = new ArrayBuffer(GLB_HEADER_BYTES);\n const headerView = new DataView(header);\n headerView.setUint32(0, GLB_HEADER_MAGIC, true);\n headerView.setUint32(4, GLB_VERSION, true);\n const totalByteLength = GLB_HEADER_BYTES + jsonChunkPrefix.byteLength + jsonChunk.byteLength + binaryChunkPrefix.byteLength + binaryChunk.byteLength;\n headerView.setUint32(8, totalByteLength, true);\n const glbBlob = new Blob([header, jsonChunkPrefix, jsonChunk, binaryChunkPrefix, binaryChunk], {\n type: \"application/octet-stream\"\n });\n const glbReader = new FileReader();\n glbReader.readAsArrayBuffer(glbBlob);\n glbReader.onloadend = function() {\n onDone(glbReader.result);\n };\n };\n } else {\n if (json.buffers && json.buffers.length > 0) {\n const reader = new FileReader();\n reader.readAsDataURL(blob);\n reader.onloadend = function() {\n const base64data = reader.result;\n json.buffers[0].uri = base64data;\n onDone(json);\n };\n } else {\n onDone(json);\n }\n }\n }\n /**\n * Serializes a userData.\n *\n * @param {THREE.Object3D|THREE.Material} object\n * @param {Object} objectDef\n */\n serializeUserData(object, objectDef) {\n if (Object.keys(object.userData).length === 0)\n return;\n const options = this.options;\n const extensionsUsed = this.extensionsUsed;\n try {\n const json = JSON.parse(JSON.stringify(object.userData));\n if (options.includeCustomExtensions && json.gltfExtensions) {\n if (objectDef.extensions === void 0)\n objectDef.extensions = {};\n for (const extensionName in json.gltfExtensions) {\n objectDef.extensions[extensionName] = json.gltfExtensions[extensionName];\n extensionsUsed[extensionName] = true;\n }\n delete json.gltfExtensions;\n }\n if (Object.keys(json).length > 0)\n objectDef.extras = json;\n } catch (error) {\n console.warn(\n \"THREE.GLTFExporter: userData of '\" + object.name + \"' won't be serialized because of JSON.stringify error - \" + error.message\n );\n }\n }\n /**\n * Returns ids for buffer attributes.\n * @param {Object} object\n * @return {Integer}\n */\n getUID(attribute, isRelativeCopy = false) {\n if (this.uids.has(attribute) === false) {\n const uids2 = /* @__PURE__ */ new Map();\n uids2.set(true, this.uid++);\n uids2.set(false, this.uid++);\n this.uids.set(attribute, uids2);\n }\n const uids = this.uids.get(attribute);\n return uids.get(isRelativeCopy);\n }\n /**\n * Checks if normal attribute values are normalized.\n *\n * @param {BufferAttribute} normal\n * @returns {Boolean}\n */\n isNormalizedNormalAttribute(normal) {\n const cache = this.cache;\n if (cache.attributesNormalized.has(normal))\n return false;\n const v = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n for (let i2 = 0, il = normal.count; i2 < il; i2++) {\n if (Math.abs(v.fromBufferAttribute(normal, i2).length() - 1) > 5e-4)\n return false;\n }\n return true;\n }\n /**\n * Creates normalized normal buffer attribute.\n *\n * @param {BufferAttribute} normal\n * @returns {BufferAttribute}\n *\n */\n createNormalizedNormalAttribute(normal) {\n const cache = this.cache;\n if (cache.attributesNormalized.has(normal))\n return cache.attributesNormalized.get(normal);\n const attribute = normal.clone();\n const v = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n for (let i2 = 0, il = attribute.count; i2 < il; i2++) {\n v.fromBufferAttribute(attribute, i2);\n if (v.x === 0 && v.y === 0 && v.z === 0) {\n v.setX(1);\n } else {\n v.normalize();\n }\n attribute.setXYZ(i2, v.x, v.y, v.z);\n }\n cache.attributesNormalized.set(normal, attribute);\n return attribute;\n }\n /**\n * Applies a texture transform, if present, to the map definition. Requires\n * the KHR_texture_transform extension.\n *\n * @param {Object} mapDef\n * @param {THREE.Texture} texture\n */\n applyTextureTransform(mapDef, texture) {\n let didTransform = false;\n const transformDef = {};\n if (texture.offset.x !== 0 || texture.offset.y !== 0) {\n transformDef.offset = texture.offset.toArray();\n didTransform = true;\n }\n if (texture.rotation !== 0) {\n transformDef.rotation = texture.rotation;\n didTransform = true;\n }\n if (texture.repeat.x !== 1 || texture.repeat.y !== 1) {\n transformDef.scale = texture.repeat.toArray();\n didTransform = true;\n }\n if (didTransform) {\n mapDef.extensions = mapDef.extensions || {};\n mapDef.extensions[\"KHR_texture_transform\"] = transformDef;\n this.extensionsUsed[\"KHR_texture_transform\"] = true;\n }\n }\n buildMetalRoughTexture(metalnessMap, roughnessMap) {\n if (metalnessMap === roughnessMap)\n return metalnessMap;\n function getEncodingConversion(map) {\n if (\"colorSpace\" in map ? map.colorSpace === \"srgb\" : map.encoding === 3001) {\n return function SRGBToLinear(c) {\n return c < 0.04045 ? c * 0.0773993808 : Math.pow(c * 0.9478672986 + 0.0521327014, 2.4);\n };\n }\n return function LinearToLinear(c) {\n return c;\n };\n }\n console.warn(\"THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures.\");\n if (metalnessMap instanceof three__WEBPACK_IMPORTED_MODULE_42__.CompressedTexture) {\n metalnessMap = decompress(metalnessMap);\n }\n if (roughnessMap instanceof three__WEBPACK_IMPORTED_MODULE_42__.CompressedTexture) {\n roughnessMap = decompress(roughnessMap);\n }\n const metalness = metalnessMap ? metalnessMap.image : null;\n const roughness = roughnessMap ? roughnessMap.image : null;\n const width = Math.max(metalness ? metalness.width : 0, roughness ? roughness.width : 0);\n const height = Math.max(metalness ? metalness.height : 0, roughness ? roughness.height : 0);\n const canvas = getCanvas();\n canvas.width = width;\n canvas.height = height;\n const context = canvas.getContext(\"2d\");\n context.fillStyle = \"#00ffff\";\n context.fillRect(0, 0, width, height);\n const composite = context.getImageData(0, 0, width, height);\n if (metalness) {\n context.drawImage(metalness, 0, 0, width, height);\n const convert = getEncodingConversion(metalnessMap);\n const data = context.getImageData(0, 0, width, height).data;\n for (let i2 = 2; i2 < data.length; i2 += 4) {\n composite.data[i2] = convert(data[i2] / 256) * 256;\n }\n }\n if (roughness) {\n context.drawImage(roughness, 0, 0, width, height);\n const convert = getEncodingConversion(roughnessMap);\n const data = context.getImageData(0, 0, width, height).data;\n for (let i2 = 1; i2 < data.length; i2 += 4) {\n composite.data[i2] = convert(data[i2] / 256) * 256;\n }\n }\n context.putImageData(composite, 0, 0);\n const reference = metalnessMap || roughnessMap;\n const texture = reference.clone();\n texture.source = new three__WEBPACK_IMPORTED_MODULE_42__.Texture(canvas).source;\n if (\"colorSpace\" in texture)\n texture.colorSpace = \"\";\n else\n texture.encoding = 3e3;\n texture.channel = (metalnessMap || roughnessMap).channel;\n if (metalnessMap && roughnessMap && metalnessMap.channel !== roughnessMap.channel) {\n console.warn(\"THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match.\");\n }\n return texture;\n }\n /**\n * Process a buffer to append to the default one.\n * @param {ArrayBuffer} buffer\n * @return {Integer}\n */\n processBuffer(buffer) {\n const json = this.json;\n const buffers = this.buffers;\n if (!json.buffers)\n json.buffers = [{ byteLength: 0 }];\n buffers.push(buffer);\n return 0;\n }\n /**\n * Process and generate a BufferView\n * @param {BufferAttribute} attribute\n * @param {number} componentType\n * @param {number} start\n * @param {number} count\n * @param {number} target (Optional) Target usage of the BufferView\n * @return {Object}\n */\n processBufferView(attribute, componentType, start, count, target) {\n const json = this.json;\n if (!json.bufferViews)\n json.bufferViews = [];\n let componentSize;\n switch (componentType) {\n case WEBGL_CONSTANTS$1.BYTE:\n case WEBGL_CONSTANTS$1.UNSIGNED_BYTE:\n componentSize = 1;\n break;\n case WEBGL_CONSTANTS$1.SHORT:\n case WEBGL_CONSTANTS$1.UNSIGNED_SHORT:\n componentSize = 2;\n break;\n default:\n componentSize = 4;\n }\n const byteLength = getPaddedBufferSize(count * attribute.itemSize * componentSize);\n const dataView = new DataView(new ArrayBuffer(byteLength));\n let offset = 0;\n for (let i2 = start; i2 < start + count; i2++) {\n for (let a2 = 0; a2 < attribute.itemSize; a2++) {\n let value;\n if (attribute.itemSize > 4) {\n value = attribute.array[i2 * attribute.itemSize + a2];\n } else {\n if (a2 === 0)\n value = attribute.getX(i2);\n else if (a2 === 1)\n value = attribute.getY(i2);\n else if (a2 === 2)\n value = attribute.getZ(i2);\n else if (a2 === 3)\n value = attribute.getW(i2);\n if (attribute.normalized === true) {\n value = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.normalize(value, attribute.array);\n }\n }\n if (componentType === WEBGL_CONSTANTS$1.FLOAT) {\n dataView.setFloat32(offset, value, true);\n } else if (componentType === WEBGL_CONSTANTS$1.INT) {\n dataView.setInt32(offset, value, true);\n } else if (componentType === WEBGL_CONSTANTS$1.UNSIGNED_INT) {\n dataView.setUint32(offset, value, true);\n } else if (componentType === WEBGL_CONSTANTS$1.SHORT) {\n dataView.setInt16(offset, value, true);\n } else if (componentType === WEBGL_CONSTANTS$1.UNSIGNED_SHORT) {\n dataView.setUint16(offset, value, true);\n } else if (componentType === WEBGL_CONSTANTS$1.BYTE) {\n dataView.setInt8(offset, value);\n } else if (componentType === WEBGL_CONSTANTS$1.UNSIGNED_BYTE) {\n dataView.setUint8(offset, value);\n }\n offset += componentSize;\n }\n }\n const bufferViewDef = {\n buffer: this.processBuffer(dataView.buffer),\n byteOffset: this.byteOffset,\n byteLength\n };\n if (target !== void 0)\n bufferViewDef.target = target;\n if (target === WEBGL_CONSTANTS$1.ARRAY_BUFFER) {\n bufferViewDef.byteStride = attribute.itemSize * componentSize;\n }\n this.byteOffset += byteLength;\n json.bufferViews.push(bufferViewDef);\n const output = {\n id: json.bufferViews.length - 1,\n byteLength: 0\n };\n return output;\n }\n /**\n * Process and generate a BufferView from an image Blob.\n * @param {Blob} blob\n * @return {Promise}\n */\n processBufferViewImage(blob) {\n const writer = this;\n const json = writer.json;\n if (!json.bufferViews)\n json.bufferViews = [];\n return new Promise(function(resolve) {\n const reader = new FileReader();\n reader.readAsArrayBuffer(blob);\n reader.onloadend = function() {\n const buffer = getPaddedArrayBuffer(reader.result);\n const bufferViewDef = {\n buffer: writer.processBuffer(buffer),\n byteOffset: writer.byteOffset,\n byteLength: buffer.byteLength\n };\n writer.byteOffset += buffer.byteLength;\n resolve(json.bufferViews.push(bufferViewDef) - 1);\n };\n });\n }\n /**\n * Process attribute to generate an accessor\n * @param {BufferAttribute} attribute Attribute to process\n * @param {THREE.BufferGeometry} geometry (Optional) Geometry used for truncated draw range\n * @param {Integer} start (Optional)\n * @param {Integer} count (Optional)\n * @return {Integer|null} Index of the processed accessor on the \"accessors\" array\n */\n processAccessor(attribute, geometry2, start, count) {\n const json = this.json;\n const types = {\n 1: \"SCALAR\",\n 2: \"VEC2\",\n 3: \"VEC3\",\n 4: \"VEC4\",\n 9: \"MAT3\",\n 16: \"MAT4\"\n };\n let componentType;\n if (attribute.array.constructor === Float32Array) {\n componentType = WEBGL_CONSTANTS$1.FLOAT;\n } else if (attribute.array.constructor === Int32Array) {\n componentType = WEBGL_CONSTANTS$1.INT;\n } else if (attribute.array.constructor === Uint32Array) {\n componentType = WEBGL_CONSTANTS$1.UNSIGNED_INT;\n } else if (attribute.array.constructor === Int16Array) {\n componentType = WEBGL_CONSTANTS$1.SHORT;\n } else if (attribute.array.constructor === Uint16Array) {\n componentType = WEBGL_CONSTANTS$1.UNSIGNED_SHORT;\n } else if (attribute.array.constructor === Int8Array) {\n componentType = WEBGL_CONSTANTS$1.BYTE;\n } else if (attribute.array.constructor === Uint8Array) {\n componentType = WEBGL_CONSTANTS$1.UNSIGNED_BYTE;\n } else {\n throw new Error(\n \"THREE.GLTFExporter: Unsupported bufferAttribute component type: \" + attribute.array.constructor.name\n );\n }\n if (start === void 0)\n start = 0;\n if (count === void 0)\n count = attribute.count;\n if (count === 0)\n return null;\n const minMax = getMinMax(attribute, start, count);\n let bufferViewTarget;\n if (geometry2 !== void 0) {\n bufferViewTarget = attribute === geometry2.index ? WEBGL_CONSTANTS$1.ELEMENT_ARRAY_BUFFER : WEBGL_CONSTANTS$1.ARRAY_BUFFER;\n }\n const bufferView = this.processBufferView(attribute, componentType, start, count, bufferViewTarget);\n const accessorDef = {\n bufferView: bufferView.id,\n byteOffset: bufferView.byteOffset,\n componentType,\n count,\n max: minMax.max,\n min: minMax.min,\n type: types[attribute.itemSize]\n };\n if (attribute.normalized === true)\n accessorDef.normalized = true;\n if (!json.accessors)\n json.accessors = [];\n return json.accessors.push(accessorDef) - 1;\n }\n /**\n * Process image\n * @param {Image} image to process\n * @param {Integer} format of the image (RGBAFormat)\n * @param {Boolean} flipY before writing out the image\n * @param {String} mimeType export format\n * @return {Integer} Index of the processed texture in the \"images\" array\n */\n processImage(image, format, flipY, mimeType = \"image/png\") {\n if (image !== null) {\n const writer = this;\n const cache = writer.cache;\n const json = writer.json;\n const options = writer.options;\n const pending = writer.pending;\n if (!cache.images.has(image))\n cache.images.set(image, {});\n const cachedImages = cache.images.get(image);\n const key = mimeType + \":flipY/\" + flipY.toString();\n if (cachedImages[key] !== void 0)\n return cachedImages[key];\n if (!json.images)\n json.images = [];\n const imageDef = { mimeType };\n const canvas = getCanvas();\n canvas.width = Math.min(image.width, options.maxTextureSize);\n canvas.height = Math.min(image.height, options.maxTextureSize);\n const ctx = canvas.getContext(\"2d\");\n if (flipY === true) {\n ctx.translate(0, canvas.height);\n ctx.scale(1, -1);\n }\n if (image.data !== void 0) {\n if (format !== three__WEBPACK_IMPORTED_MODULE_42__.RGBAFormat) {\n console.error(\"GLTFExporter: Only RGBAFormat is supported.\", format);\n }\n if (image.width > options.maxTextureSize || image.height > options.maxTextureSize) {\n console.warn(\"GLTFExporter: Image size is bigger than maxTextureSize\", image);\n }\n const data = new Uint8ClampedArray(image.height * image.width * 4);\n for (let i2 = 0; i2 < data.length; i2 += 4) {\n data[i2 + 0] = image.data[i2 + 0];\n data[i2 + 1] = image.data[i2 + 1];\n data[i2 + 2] = image.data[i2 + 2];\n data[i2 + 3] = image.data[i2 + 3];\n }\n ctx.putImageData(new ImageData(data, image.width, image.height), 0, 0);\n } else {\n ctx.drawImage(image, 0, 0, canvas.width, canvas.height);\n }\n if (options.binary === true) {\n pending.push(\n getToBlobPromise(canvas, mimeType).then((blob) => writer.processBufferViewImage(blob)).then((bufferViewIndex) => {\n imageDef.bufferView = bufferViewIndex;\n })\n );\n } else {\n if (canvas.toDataURL !== void 0) {\n imageDef.uri = canvas.toDataURL(mimeType);\n } else {\n pending.push(\n getToBlobPromise(canvas, mimeType).then((blob) => new FileReader().readAsDataURL(blob)).then((dataURL) => {\n imageDef.uri = dataURL;\n })\n );\n }\n }\n const index = json.images.push(imageDef) - 1;\n cachedImages[key] = index;\n return index;\n } else {\n throw new Error(\"THREE.GLTFExporter: No valid image data found. Unable to process texture.\");\n }\n }\n /**\n * Process sampler\n * @param {Texture} map Texture to process\n * @return {Integer} Index of the processed texture in the \"samplers\" array\n */\n processSampler(map) {\n const json = this.json;\n if (!json.samplers)\n json.samplers = [];\n const samplerDef = {\n magFilter: THREE_TO_WEBGL[map.magFilter],\n minFilter: THREE_TO_WEBGL[map.minFilter],\n wrapS: THREE_TO_WEBGL[map.wrapS],\n wrapT: THREE_TO_WEBGL[map.wrapT]\n };\n return json.samplers.push(samplerDef) - 1;\n }\n /**\n * Process texture\n * @param {Texture} map Map to process\n * @return {Integer} Index of the processed texture in the \"textures\" array\n */\n processTexture(map) {\n const writer = this;\n const options = writer.options;\n const cache = this.cache;\n const json = this.json;\n if (cache.textures.has(map))\n return cache.textures.get(map);\n if (!json.textures)\n json.textures = [];\n if (map instanceof three__WEBPACK_IMPORTED_MODULE_42__.CompressedTexture) {\n map = decompress(map, options.maxTextureSize);\n }\n let mimeType = map.userData.mimeType;\n if (mimeType === \"image/webp\")\n mimeType = \"image/png\";\n const textureDef = {\n sampler: this.processSampler(map),\n source: this.processImage(map.image, map.format, map.flipY, mimeType)\n };\n if (map.name)\n textureDef.name = map.name;\n this._invokeAll(function(ext) {\n ext.writeTexture && ext.writeTexture(map, textureDef);\n });\n const index = json.textures.push(textureDef) - 1;\n cache.textures.set(map, index);\n return index;\n }\n /**\n * Process material\n * @param {THREE.Material} material Material to process\n * @return {Integer|null} Index of the processed material in the \"materials\" array\n */\n processMaterial(material2) {\n const cache = this.cache;\n const json = this.json;\n if (cache.materials.has(material2))\n return cache.materials.get(material2);\n if (material2.isShaderMaterial) {\n console.warn(\"GLTFExporter: THREE.ShaderMaterial not supported.\");\n return null;\n }\n if (!json.materials)\n json.materials = [];\n const materialDef = { pbrMetallicRoughness: {} };\n if (material2.isMeshStandardMaterial !== true && material2.isMeshBasicMaterial !== true) {\n console.warn(\"GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.\");\n }\n const color = material2.color.toArray().concat([material2.opacity]);\n if (!equalArray(color, [1, 1, 1, 1])) {\n materialDef.pbrMetallicRoughness.baseColorFactor = color;\n }\n if (material2.isMeshStandardMaterial) {\n materialDef.pbrMetallicRoughness.metallicFactor = material2.metalness;\n materialDef.pbrMetallicRoughness.roughnessFactor = material2.roughness;\n } else {\n materialDef.pbrMetallicRoughness.metallicFactor = 0.5;\n materialDef.pbrMetallicRoughness.roughnessFactor = 0.5;\n }\n if (material2.metalnessMap || material2.roughnessMap) {\n const metalRoughTexture = this.buildMetalRoughTexture(material2.metalnessMap, material2.roughnessMap);\n const metalRoughMapDef = {\n index: this.processTexture(metalRoughTexture),\n channel: metalRoughTexture.channel\n };\n this.applyTextureTransform(metalRoughMapDef, metalRoughTexture);\n materialDef.pbrMetallicRoughness.metallicRoughnessTexture = metalRoughMapDef;\n }\n if (material2.map) {\n const baseColorMapDef = {\n index: this.processTexture(material2.map),\n texCoord: material2.map.channel\n };\n this.applyTextureTransform(baseColorMapDef, material2.map);\n materialDef.pbrMetallicRoughness.baseColorTexture = baseColorMapDef;\n }\n if (material2.emissive) {\n const emissive = material2.emissive;\n const maxEmissiveComponent = Math.max(emissive.r, emissive.g, emissive.b);\n if (maxEmissiveComponent > 0) {\n materialDef.emissiveFactor = material2.emissive.toArray();\n }\n if (material2.emissiveMap) {\n const emissiveMapDef = {\n index: this.processTexture(material2.emissiveMap),\n texCoord: material2.emissiveMap.channel\n };\n this.applyTextureTransform(emissiveMapDef, material2.emissiveMap);\n materialDef.emissiveTexture = emissiveMapDef;\n }\n }\n if (material2.normalMap) {\n const normalMapDef = {\n index: this.processTexture(material2.normalMap),\n texCoord: material2.normalMap.channel\n };\n if (material2.normalScale && material2.normalScale.x !== 1) {\n normalMapDef.scale = material2.normalScale.x;\n }\n this.applyTextureTransform(normalMapDef, material2.normalMap);\n materialDef.normalTexture = normalMapDef;\n }\n if (material2.aoMap) {\n const occlusionMapDef = {\n index: this.processTexture(material2.aoMap),\n texCoord: material2.aoMap.channel\n };\n if (material2.aoMapIntensity !== 1) {\n occlusionMapDef.strength = material2.aoMapIntensity;\n }\n this.applyTextureTransform(occlusionMapDef, material2.aoMap);\n materialDef.occlusionTexture = occlusionMapDef;\n }\n if (material2.transparent) {\n materialDef.alphaMode = \"BLEND\";\n } else {\n if (material2.alphaTest > 0) {\n materialDef.alphaMode = \"MASK\";\n materialDef.alphaCutoff = material2.alphaTest;\n }\n }\n if (material2.side === three__WEBPACK_IMPORTED_MODULE_42__.DoubleSide)\n materialDef.doubleSided = true;\n if (material2.name !== \"\")\n materialDef.name = material2.name;\n this.serializeUserData(material2, materialDef);\n this._invokeAll(function(ext) {\n ext.writeMaterial && ext.writeMaterial(material2, materialDef);\n });\n const index = json.materials.push(materialDef) - 1;\n cache.materials.set(material2, index);\n return index;\n }\n /**\n * Process mesh\n * @param {THREE.Mesh} mesh Mesh to process\n * @return {Integer|null} Index of the processed mesh in the \"meshes\" array\n */\n processMesh(mesh) {\n const cache = this.cache;\n const json = this.json;\n const meshCacheKeyParts = [mesh.geometry.uuid];\n if (Array.isArray(mesh.material)) {\n for (let i2 = 0, l = mesh.material.length; i2 < l; i2++) {\n meshCacheKeyParts.push(mesh.material[i2].uuid);\n }\n } else {\n meshCacheKeyParts.push(mesh.material.uuid);\n }\n const meshCacheKey = meshCacheKeyParts.join(\":\");\n if (cache.meshes.has(meshCacheKey))\n return cache.meshes.get(meshCacheKey);\n const geometry2 = mesh.geometry;\n let mode;\n if (mesh.isLineSegments) {\n mode = WEBGL_CONSTANTS$1.LINES;\n } else if (mesh.isLineLoop) {\n mode = WEBGL_CONSTANTS$1.LINE_LOOP;\n } else if (mesh.isLine) {\n mode = WEBGL_CONSTANTS$1.LINE_STRIP;\n } else if (mesh.isPoints) {\n mode = WEBGL_CONSTANTS$1.POINTS;\n } else {\n mode = mesh.material.wireframe ? WEBGL_CONSTANTS$1.LINES : WEBGL_CONSTANTS$1.TRIANGLES;\n }\n const meshDef = {};\n const attributes = {};\n const primitives = [];\n const targets = [];\n const nameConversion = {\n uv: \"TEXCOORD_0\",\n [three__WEBPACK_IMPORTED_MODULE_42__.REVISION.replace(/\\D+/g, \"\") >= 152 ? \"uv1\" : \"uv2\"]: \"TEXCOORD_1\",\n color: \"COLOR_0\",\n skinWeight: \"WEIGHTS_0\",\n skinIndex: \"JOINTS_0\"\n };\n const originalNormal = geometry2.getAttribute(\"normal\");\n if (originalNormal !== void 0 && !this.isNormalizedNormalAttribute(originalNormal)) {\n console.warn(\"THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one.\");\n geometry2.setAttribute(\"normal\", this.createNormalizedNormalAttribute(originalNormal));\n }\n let modifiedAttribute = null;\n for (let attributeName in geometry2.attributes) {\n if (attributeName.slice(0, 5) === \"morph\")\n continue;\n const attribute = geometry2.attributes[attributeName];\n attributeName = nameConversion[attributeName] || attributeName.toUpperCase();\n const validVertexAttributes = /^(POSITION|NORMAL|TANGENT|TEXCOORD_\\d+|COLOR_\\d+|JOINTS_\\d+|WEIGHTS_\\d+)$/;\n if (!validVertexAttributes.test(attributeName))\n attributeName = \"_\" + attributeName;\n if (cache.attributes.has(this.getUID(attribute))) {\n attributes[attributeName] = cache.attributes.get(this.getUID(attribute));\n continue;\n }\n modifiedAttribute = null;\n const array = attribute.array;\n if (attributeName === \"JOINTS_0\" && !(array instanceof Uint16Array) && !(array instanceof Uint8Array)) {\n console.warn('GLTFExporter: Attribute \"skinIndex\" converted to type UNSIGNED_SHORT.');\n modifiedAttribute = new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(new Uint16Array(array), attribute.itemSize, attribute.normalized);\n }\n const accessor = this.processAccessor(modifiedAttribute || attribute, geometry2);\n if (accessor !== null) {\n if (!attributeName.startsWith(\"_\")) {\n this.detectMeshQuantization(attributeName, attribute);\n }\n attributes[attributeName] = accessor;\n cache.attributes.set(this.getUID(attribute), accessor);\n }\n }\n if (originalNormal !== void 0)\n geometry2.setAttribute(\"normal\", originalNormal);\n if (Object.keys(attributes).length === 0)\n return null;\n if (mesh.morphTargetInfluences !== void 0 && mesh.morphTargetInfluences.length > 0) {\n const weights = [];\n const targetNames = [];\n const reverseDictionary = {};\n if (mesh.morphTargetDictionary !== void 0) {\n for (const key in mesh.morphTargetDictionary) {\n reverseDictionary[mesh.morphTargetDictionary[key]] = key;\n }\n }\n for (let i2 = 0; i2 < mesh.morphTargetInfluences.length; ++i2) {\n const target = {};\n let warned = false;\n for (const attributeName in geometry2.morphAttributes) {\n if (attributeName !== \"position\" && attributeName !== \"normal\") {\n if (!warned) {\n console.warn(\"GLTFExporter: Only POSITION and NORMAL morph are supported.\");\n warned = true;\n }\n continue;\n }\n const attribute = geometry2.morphAttributes[attributeName][i2];\n const gltfAttributeName = attributeName.toUpperCase();\n const baseAttribute = geometry2.attributes[attributeName];\n if (cache.attributes.has(this.getUID(attribute, true))) {\n target[gltfAttributeName] = cache.attributes.get(this.getUID(attribute, true));\n continue;\n }\n const relativeAttribute = attribute.clone();\n if (!geometry2.morphTargetsRelative) {\n for (let j = 0, jl = attribute.count; j < jl; j++) {\n for (let a2 = 0; a2 < attribute.itemSize; a2++) {\n if (a2 === 0)\n relativeAttribute.setX(j, attribute.getX(j) - baseAttribute.getX(j));\n if (a2 === 1)\n relativeAttribute.setY(j, attribute.getY(j) - baseAttribute.getY(j));\n if (a2 === 2)\n relativeAttribute.setZ(j, attribute.getZ(j) - baseAttribute.getZ(j));\n if (a2 === 3)\n relativeAttribute.setW(j, attribute.getW(j) - baseAttribute.getW(j));\n }\n }\n }\n target[gltfAttributeName] = this.processAccessor(relativeAttribute, geometry2);\n cache.attributes.set(this.getUID(baseAttribute, true), target[gltfAttributeName]);\n }\n targets.push(target);\n weights.push(mesh.morphTargetInfluences[i2]);\n if (mesh.morphTargetDictionary !== void 0)\n targetNames.push(reverseDictionary[i2]);\n }\n meshDef.weights = weights;\n if (targetNames.length > 0) {\n meshDef.extras = {};\n meshDef.extras.targetNames = targetNames;\n }\n }\n const isMultiMaterial = Array.isArray(mesh.material);\n if (isMultiMaterial && geometry2.groups.length === 0)\n return null;\n const materials = isMultiMaterial ? mesh.material : [mesh.material];\n const groups = isMultiMaterial ? geometry2.groups : [{ materialIndex: 0, start: void 0, count: void 0 }];\n for (let i2 = 0, il = groups.length; i2 < il; i2++) {\n const primitive = {\n mode,\n attributes\n };\n this.serializeUserData(geometry2, primitive);\n if (targets.length > 0)\n primitive.targets = targets;\n if (geometry2.index !== null) {\n let cacheKey = this.getUID(geometry2.index);\n if (groups[i2].start !== void 0 || groups[i2].count !== void 0) {\n cacheKey += \":\" + groups[i2].start + \":\" + groups[i2].count;\n }\n if (cache.attributes.has(cacheKey)) {\n primitive.indices = cache.attributes.get(cacheKey);\n } else {\n primitive.indices = this.processAccessor(geometry2.index, geometry2, groups[i2].start, groups[i2].count);\n cache.attributes.set(cacheKey, primitive.indices);\n }\n if (primitive.indices === null)\n delete primitive.indices;\n }\n const material2 = this.processMaterial(materials[groups[i2].materialIndex]);\n if (material2 !== null)\n primitive.material = material2;\n primitives.push(primitive);\n }\n meshDef.primitives = primitives;\n if (!json.meshes)\n json.meshes = [];\n this._invokeAll(function(ext) {\n ext.writeMesh && ext.writeMesh(mesh, meshDef);\n });\n const index = json.meshes.push(meshDef) - 1;\n cache.meshes.set(meshCacheKey, index);\n return index;\n }\n /**\n * If a vertex attribute with a\n * [non-standard data type](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#meshes-overview)\n * is used, it is checked whether it is a valid data type according to the\n * [KHR_mesh_quantization](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_mesh_quantization/README.md)\n * extension.\n * In this case the extension is automatically added to the list of used extensions.\n *\n * @param {string} attributeName\n * @param {THREE.BufferAttribute} attribute\n */\n detectMeshQuantization(attributeName, attribute) {\n if (this.extensionsUsed[KHR_MESH_QUANTIZATION])\n return;\n let attrType = void 0;\n switch (attribute.array.constructor) {\n case Int8Array:\n attrType = \"byte\";\n break;\n case Uint8Array:\n attrType = \"unsigned byte\";\n break;\n case Int16Array:\n attrType = \"short\";\n break;\n case Uint16Array:\n attrType = \"unsigned short\";\n break;\n default:\n return;\n }\n if (attribute.normalized)\n attrType += \" normalized\";\n const attrNamePrefix = attributeName.split(\"_\", 1)[0];\n if (KHR_mesh_quantization_ExtraAttrTypes[attrNamePrefix] && KHR_mesh_quantization_ExtraAttrTypes[attrNamePrefix].includes(attrType)) {\n this.extensionsUsed[KHR_MESH_QUANTIZATION] = true;\n this.extensionsRequired[KHR_MESH_QUANTIZATION] = true;\n }\n }\n /**\n * Process camera\n * @param {THREE.Camera} camera Camera to process\n * @return {Integer} Index of the processed mesh in the \"camera\" array\n */\n processCamera(camera) {\n const json = this.json;\n if (!json.cameras)\n json.cameras = [];\n const isOrtho = camera.isOrthographicCamera;\n const cameraDef = {\n type: isOrtho ? \"orthographic\" : \"perspective\"\n };\n if (isOrtho) {\n cameraDef.orthographic = {\n xmag: camera.right * 2,\n ymag: camera.top * 2,\n zfar: camera.far <= 0 ? 1e-3 : camera.far,\n znear: camera.near < 0 ? 0 : camera.near\n };\n } else {\n cameraDef.perspective = {\n aspectRatio: camera.aspect,\n yfov: three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.degToRad(camera.fov),\n zfar: camera.far <= 0 ? 1e-3 : camera.far,\n znear: camera.near < 0 ? 0 : camera.near\n };\n }\n if (camera.name !== \"\")\n cameraDef.name = camera.type;\n return json.cameras.push(cameraDef) - 1;\n }\n /**\n * Creates glTF animation entry from AnimationClip object.\n *\n * Status:\n * - Only properties listed in PATH_PROPERTIES may be animated.\n *\n * @param {THREE.AnimationClip} clip\n * @param {THREE.Object3D} root\n * @return {number|null}\n */\n processAnimation(clip, root) {\n const json = this.json;\n const nodeMap = this.nodeMap;\n if (!json.animations)\n json.animations = [];\n clip = GLTFExporter.Utils.mergeMorphTargetTracks(clip.clone(), root);\n const tracks = clip.tracks;\n const channels = [];\n const samplers = [];\n for (let i2 = 0; i2 < tracks.length; ++i2) {\n const track = tracks[i2];\n const trackBinding = three__WEBPACK_IMPORTED_MODULE_42__.PropertyBinding.parseTrackName(track.name);\n let trackNode = three__WEBPACK_IMPORTED_MODULE_42__.PropertyBinding.findNode(root, trackBinding.nodeName);\n const trackProperty = PATH_PROPERTIES$1[trackBinding.propertyName];\n if (trackBinding.objectName === \"bones\") {\n if (trackNode.isSkinnedMesh === true) {\n trackNode = trackNode.skeleton.getBoneByName(trackBinding.objectIndex);\n } else {\n trackNode = void 0;\n }\n }\n if (!trackNode || !trackProperty) {\n console.warn('THREE.GLTFExporter: Could not export animation track \"%s\".', track.name);\n return null;\n }\n const inputItemSize = 1;\n let outputItemSize = track.values.length / track.times.length;\n if (trackProperty === PATH_PROPERTIES$1.morphTargetInfluences) {\n outputItemSize /= trackNode.morphTargetInfluences.length;\n }\n let interpolation;\n if (track.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline === true) {\n interpolation = \"CUBICSPLINE\";\n outputItemSize /= 3;\n } else if (track.getInterpolation() === three__WEBPACK_IMPORTED_MODULE_42__.InterpolateDiscrete) {\n interpolation = \"STEP\";\n } else {\n interpolation = \"LINEAR\";\n }\n samplers.push({\n input: this.processAccessor(new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(track.times, inputItemSize)),\n output: this.processAccessor(new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(track.values, outputItemSize)),\n interpolation\n });\n channels.push({\n sampler: samplers.length - 1,\n target: {\n node: nodeMap.get(trackNode),\n path: trackProperty\n }\n });\n }\n json.animations.push({\n name: clip.name || \"clip_\" + json.animations.length,\n samplers,\n channels\n });\n return json.animations.length - 1;\n }\n /**\n * @param {THREE.Object3D} object\n * @return {number|null}\n */\n processSkin(object) {\n const json = this.json;\n const nodeMap = this.nodeMap;\n const node = json.nodes[nodeMap.get(object)];\n const skeleton = object.skeleton;\n if (skeleton === void 0)\n return null;\n const rootJoint = object.skeleton.bones[0];\n if (rootJoint === void 0)\n return null;\n const joints = [];\n const inverseBindMatrices = new Float32Array(skeleton.bones.length * 16);\n const temporaryBoneInverse = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n for (let i2 = 0; i2 < skeleton.bones.length; ++i2) {\n joints.push(nodeMap.get(skeleton.bones[i2]));\n temporaryBoneInverse.copy(skeleton.boneInverses[i2]);\n temporaryBoneInverse.multiply(object.bindMatrix).toArray(inverseBindMatrices, i2 * 16);\n }\n if (json.skins === void 0)\n json.skins = [];\n json.skins.push({\n inverseBindMatrices: this.processAccessor(new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(inverseBindMatrices, 16)),\n joints,\n skeleton: nodeMap.get(rootJoint)\n });\n const skinIndex = node.skin = json.skins.length - 1;\n return skinIndex;\n }\n /**\n * Process Object3D node\n * @param {THREE.Object3D} node Object3D to processNode\n * @return {Integer} Index of the node in the nodes list\n */\n processNode(object) {\n const json = this.json;\n const options = this.options;\n const nodeMap = this.nodeMap;\n if (!json.nodes)\n json.nodes = [];\n const nodeDef = {};\n if (options.trs) {\n const rotation = object.quaternion.toArray();\n const position = object.position.toArray();\n const scale = object.scale.toArray();\n if (!equalArray(rotation, [0, 0, 0, 1])) {\n nodeDef.rotation = rotation;\n }\n if (!equalArray(position, [0, 0, 0])) {\n nodeDef.translation = position;\n }\n if (!equalArray(scale, [1, 1, 1])) {\n nodeDef.scale = scale;\n }\n } else {\n if (object.matrixAutoUpdate) {\n object.updateMatrix();\n }\n if (isIdentityMatrix(object.matrix) === false) {\n nodeDef.matrix = object.matrix.elements;\n }\n }\n if (object.name !== \"\")\n nodeDef.name = String(object.name);\n this.serializeUserData(object, nodeDef);\n if (object.isMesh || object.isLine || object.isPoints) {\n const meshIndex = this.processMesh(object);\n if (meshIndex !== null)\n nodeDef.mesh = meshIndex;\n } else if (object.isCamera) {\n nodeDef.camera = this.processCamera(object);\n }\n if (object.isSkinnedMesh)\n this.skins.push(object);\n if (object.children.length > 0) {\n const children = [];\n for (let i2 = 0, l = object.children.length; i2 < l; i2++) {\n const child = object.children[i2];\n if (child.visible || options.onlyVisible === false) {\n const nodeIndex2 = this.processNode(child);\n if (nodeIndex2 !== null)\n children.push(nodeIndex2);\n }\n }\n if (children.length > 0)\n nodeDef.children = children;\n }\n this._invokeAll(function(ext) {\n ext.writeNode && ext.writeNode(object, nodeDef);\n });\n const nodeIndex = json.nodes.push(nodeDef) - 1;\n nodeMap.set(object, nodeIndex);\n return nodeIndex;\n }\n /**\n * Process Scene\n * @param {Scene} node Scene to process\n */\n processScene(scene) {\n const json = this.json;\n const options = this.options;\n if (!json.scenes) {\n json.scenes = [];\n json.scene = 0;\n }\n const sceneDef = {};\n if (scene.name !== \"\")\n sceneDef.name = scene.name;\n json.scenes.push(sceneDef);\n const nodes = [];\n for (let i2 = 0, l = scene.children.length; i2 < l; i2++) {\n const child = scene.children[i2];\n if (child.visible || options.onlyVisible === false) {\n const nodeIndex = this.processNode(child);\n if (nodeIndex !== null)\n nodes.push(nodeIndex);\n }\n }\n if (nodes.length > 0)\n sceneDef.nodes = nodes;\n this.serializeUserData(scene, sceneDef);\n }\n /**\n * Creates a Scene to hold a list of objects and parse it\n * @param {Array} objects List of objects to process\n */\n processObjects(objects) {\n const scene = new three__WEBPACK_IMPORTED_MODULE_42__.Scene();\n scene.name = \"AuxScene\";\n for (let i2 = 0; i2 < objects.length; i2++) {\n scene.children.push(objects[i2]);\n }\n this.processScene(scene);\n }\n /**\n * @param {THREE.Object3D|Array} input\n */\n processInput(input) {\n const options = this.options;\n input = input instanceof Array ? input : [input];\n this._invokeAll(function(ext) {\n ext.beforeParse && ext.beforeParse(input);\n });\n const objectsWithoutScene = [];\n for (let i2 = 0; i2 < input.length; i2++) {\n if (input[i2] instanceof three__WEBPACK_IMPORTED_MODULE_42__.Scene) {\n this.processScene(input[i2]);\n } else {\n objectsWithoutScene.push(input[i2]);\n }\n }\n if (objectsWithoutScene.length > 0)\n this.processObjects(objectsWithoutScene);\n for (let i2 = 0; i2 < this.skins.length; ++i2) {\n this.processSkin(this.skins[i2]);\n }\n for (let i2 = 0; i2 < options.animations.length; ++i2) {\n this.processAnimation(options.animations[i2], input[0]);\n }\n this._invokeAll(function(ext) {\n ext.afterParse && ext.afterParse(input);\n });\n }\n _invokeAll(func) {\n for (let i2 = 0, il = this.plugins.length; i2 < il; i2++) {\n func(this.plugins[i2]);\n }\n }\n}\nclass GLTFLightExtension {\n constructor(writer) {\n this.writer = writer;\n this.name = \"KHR_lights_punctual\";\n }\n writeNode(light, nodeDef) {\n if (!light.isLight)\n return;\n if (!light.isDirectionalLight && !light.isPointLight && !light.isSpotLight) {\n console.warn(\"THREE.GLTFExporter: Only directional, point, and spot lights are supported.\", light);\n return;\n }\n const writer = this.writer;\n const json = writer.json;\n const extensionsUsed = writer.extensionsUsed;\n const lightDef = {};\n if (light.name)\n lightDef.name = light.name;\n lightDef.color = light.color.toArray();\n lightDef.intensity = light.intensity;\n if (light.isDirectionalLight) {\n lightDef.type = \"directional\";\n } else if (light.isPointLight) {\n lightDef.type = \"point\";\n if (light.distance > 0)\n lightDef.range = light.distance;\n } else if (light.isSpotLight) {\n lightDef.type = \"spot\";\n if (light.distance > 0)\n lightDef.range = light.distance;\n lightDef.spot = {};\n lightDef.spot.innerConeAngle = (light.penumbra - 1) * light.angle * -1;\n lightDef.spot.outerConeAngle = light.angle;\n }\n if (light.decay !== void 0 && light.decay !== 2) {\n console.warn(\n \"THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2.\"\n );\n }\n if (light.target && (light.target.parent !== light || light.target.position.x !== 0 || light.target.position.y !== 0 || light.target.position.z !== -1)) {\n console.warn(\n \"THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1.\"\n );\n }\n if (!extensionsUsed[this.name]) {\n json.extensions = json.extensions || {};\n json.extensions[this.name] = { lights: [] };\n extensionsUsed[this.name] = true;\n }\n const lights = json.extensions[this.name].lights;\n lights.push(lightDef);\n nodeDef.extensions = nodeDef.extensions || {};\n nodeDef.extensions[this.name] = { light: lights.length - 1 };\n }\n}\nlet GLTFMaterialsUnlitExtension$1 = class GLTFMaterialsUnlitExtension {\n constructor(writer) {\n this.writer = writer;\n this.name = \"KHR_materials_unlit\";\n }\n writeMaterial(material2, materialDef) {\n if (!material2.isMeshBasicMaterial)\n return;\n const writer = this.writer;\n const extensionsUsed = writer.extensionsUsed;\n materialDef.extensions = materialDef.extensions || {};\n materialDef.extensions[this.name] = {};\n extensionsUsed[this.name] = true;\n materialDef.pbrMetallicRoughness.metallicFactor = 0;\n materialDef.pbrMetallicRoughness.roughnessFactor = 0.9;\n }\n};\nlet GLTFMaterialsClearcoatExtension$1 = class GLTFMaterialsClearcoatExtension {\n constructor(writer) {\n this.writer = writer;\n this.name = \"KHR_materials_clearcoat\";\n }\n writeMaterial(material2, materialDef) {\n if (!material2.isMeshPhysicalMaterial || material2.clearcoat === 0)\n return;\n const writer = this.writer;\n const extensionsUsed = writer.extensionsUsed;\n const extensionDef = {};\n extensionDef.clearcoatFactor = material2.clearcoat;\n if (material2.clearcoatMap) {\n const clearcoatMapDef = {\n index: writer.processTexture(material2.clearcoatMap),\n texCoord: material2.clearcoatMap.channel\n };\n writer.applyTextureTransform(clearcoatMapDef, material2.clearcoatMap);\n extensionDef.clearcoatTexture = clearcoatMapDef;\n }\n extensionDef.clearcoatRoughnessFactor = material2.clearcoatRoughness;\n if (material2.clearcoatRoughnessMap) {\n const clearcoatRoughnessMapDef = {\n index: writer.processTexture(material2.clearcoatRoughnessMap),\n texCoord: material2.clearcoatRoughnessMap.channel\n };\n writer.applyTextureTransform(clearcoatRoughnessMapDef, material2.clearcoatRoughnessMap);\n extensionDef.clearcoatRoughnessTexture = clearcoatRoughnessMapDef;\n }\n if (material2.clearcoatNormalMap) {\n const clearcoatNormalMapDef = {\n index: writer.processTexture(material2.clearcoatNormalMap),\n texCoord: material2.clearcoatNormalMap.channel\n };\n writer.applyTextureTransform(clearcoatNormalMapDef, material2.clearcoatNormalMap);\n extensionDef.clearcoatNormalTexture = clearcoatNormalMapDef;\n }\n materialDef.extensions = materialDef.extensions || {};\n materialDef.extensions[this.name] = extensionDef;\n extensionsUsed[this.name] = true;\n }\n};\nlet GLTFMaterialsIridescenceExtension$1 = class GLTFMaterialsIridescenceExtension {\n constructor(writer) {\n this.writer = writer;\n this.name = \"KHR_materials_iridescence\";\n }\n writeMaterial(material2, materialDef) {\n if (!material2.isMeshPhysicalMaterial || material2.iridescence === 0)\n return;\n const writer = this.writer;\n const extensionsUsed = writer.extensionsUsed;\n const extensionDef = {};\n extensionDef.iridescenceFactor = material2.iridescence;\n if (material2.iridescenceMap) {\n const iridescenceMapDef = {\n index: writer.processTexture(material2.iridescenceMap),\n texCoord: material2.iridescenceMap.channel\n };\n writer.applyTextureTransform(iridescenceMapDef, material2.iridescenceMap);\n extensionDef.iridescenceTexture = iridescenceMapDef;\n }\n extensionDef.iridescenceIor = material2.iridescenceIOR;\n extensionDef.iridescenceThicknessMinimum = material2.iridescenceThicknessRange[0];\n extensionDef.iridescenceThicknessMaximum = material2.iridescenceThicknessRange[1];\n if (material2.iridescenceThicknessMap) {\n const iridescenceThicknessMapDef = {\n index: writer.processTexture(material2.iridescenceThicknessMap),\n texCoord: material2.iridescenceThicknessMap.channel\n };\n writer.applyTextureTransform(iridescenceThicknessMapDef, material2.iridescenceThicknessMap);\n extensionDef.iridescenceThicknessTexture = iridescenceThicknessMapDef;\n }\n materialDef.extensions = materialDef.extensions || {};\n materialDef.extensions[this.name] = extensionDef;\n extensionsUsed[this.name] = true;\n }\n};\nlet GLTFMaterialsTransmissionExtension$1 = class GLTFMaterialsTransmissionExtension {\n constructor(writer) {\n this.writer = writer;\n this.name = \"KHR_materials_transmission\";\n }\n writeMaterial(material2, materialDef) {\n if (!material2.isMeshPhysicalMaterial || material2.transmission === 0)\n return;\n const writer = this.writer;\n const extensionsUsed = writer.extensionsUsed;\n const extensionDef = {};\n extensionDef.transmissionFactor = material2.transmission;\n if (material2.transmissionMap) {\n const transmissionMapDef = {\n index: writer.processTexture(material2.transmissionMap),\n texCoord: material2.transmissionMap.channel\n };\n writer.applyTextureTransform(transmissionMapDef, material2.transmissionMap);\n extensionDef.transmissionTexture = transmissionMapDef;\n }\n materialDef.extensions = materialDef.extensions || {};\n materialDef.extensions[this.name] = extensionDef;\n extensionsUsed[this.name] = true;\n }\n};\nlet GLTFMaterialsVolumeExtension$1 = class GLTFMaterialsVolumeExtension {\n constructor(writer) {\n this.writer = writer;\n this.name = \"KHR_materials_volume\";\n }\n writeMaterial(material2, materialDef) {\n if (!material2.isMeshPhysicalMaterial || material2.transmission === 0)\n return;\n const writer = this.writer;\n const extensionsUsed = writer.extensionsUsed;\n const extensionDef = {};\n extensionDef.thicknessFactor = material2.thickness;\n if (material2.thicknessMap) {\n const thicknessMapDef = {\n index: writer.processTexture(material2.thicknessMap),\n texCoord: material2.thicknessMap.channel\n };\n writer.applyTextureTransform(thicknessMapDef, material2.thicknessMap);\n extensionDef.thicknessTexture = thicknessMapDef;\n }\n extensionDef.attenuationDistance = material2.attenuationDistance;\n extensionDef.attenuationColor = material2.attenuationColor.toArray();\n materialDef.extensions = materialDef.extensions || {};\n materialDef.extensions[this.name] = extensionDef;\n extensionsUsed[this.name] = true;\n }\n};\nlet GLTFMaterialsIorExtension$1 = class GLTFMaterialsIorExtension {\n constructor(writer) {\n this.writer = writer;\n this.name = \"KHR_materials_ior\";\n }\n writeMaterial(material2, materialDef) {\n if (!material2.isMeshPhysicalMaterial || material2.ior === 1.5)\n return;\n const writer = this.writer;\n const extensionsUsed = writer.extensionsUsed;\n const extensionDef = {};\n extensionDef.ior = material2.ior;\n materialDef.extensions = materialDef.extensions || {};\n materialDef.extensions[this.name] = extensionDef;\n extensionsUsed[this.name] = true;\n }\n};\nlet GLTFMaterialsSpecularExtension$1 = class GLTFMaterialsSpecularExtension {\n constructor(writer) {\n this.writer = writer;\n this.name = \"KHR_materials_specular\";\n }\n writeMaterial(material2, materialDef) {\n if (!material2.isMeshPhysicalMaterial || material2.specularIntensity === 1 && material2.specularColor.equals(DEFAULT_SPECULAR_COLOR) && !material2.specularIntensityMap && !material2.specularColorTexture)\n return;\n const writer = this.writer;\n const extensionsUsed = writer.extensionsUsed;\n const extensionDef = {};\n if (material2.specularIntensityMap) {\n const specularIntensityMapDef = {\n index: writer.processTexture(material2.specularIntensityMap),\n texCoord: material2.specularIntensityMap.channel\n };\n writer.applyTextureTransform(specularIntensityMapDef, material2.specularIntensityMap);\n extensionDef.specularTexture = specularIntensityMapDef;\n }\n if (material2.specularColorMap) {\n const specularColorMapDef = {\n index: writer.processTexture(material2.specularColorMap),\n texCoord: material2.specularColorMap.channel\n };\n writer.applyTextureTransform(specularColorMapDef, material2.specularColorMap);\n extensionDef.specularColorTexture = specularColorMapDef;\n }\n extensionDef.specularFactor = material2.specularIntensity;\n extensionDef.specularColorFactor = material2.specularColor.toArray();\n materialDef.extensions = materialDef.extensions || {};\n materialDef.extensions[this.name] = extensionDef;\n extensionsUsed[this.name] = true;\n }\n};\nlet GLTFMaterialsSheenExtension$1 = class GLTFMaterialsSheenExtension {\n constructor(writer) {\n this.writer = writer;\n this.name = \"KHR_materials_sheen\";\n }\n writeMaterial(material2, materialDef) {\n if (!material2.isMeshPhysicalMaterial || material2.sheen == 0)\n return;\n const writer = this.writer;\n const extensionsUsed = writer.extensionsUsed;\n const extensionDef = {};\n if (material2.sheenRoughnessMap) {\n const sheenRoughnessMapDef = {\n index: writer.processTexture(material2.sheenRoughnessMap),\n texCoord: material2.sheenRoughnessMap.channel\n };\n writer.applyTextureTransform(sheenRoughnessMapDef, material2.sheenRoughnessMap);\n extensionDef.sheenRoughnessTexture = sheenRoughnessMapDef;\n }\n if (material2.sheenColorMap) {\n const sheenColorMapDef = {\n index: writer.processTexture(material2.sheenColorMap),\n texCoord: material2.sheenColorMap.channel\n };\n writer.applyTextureTransform(sheenColorMapDef, material2.sheenColorMap);\n extensionDef.sheenColorTexture = sheenColorMapDef;\n }\n extensionDef.sheenRoughnessFactor = material2.sheenRoughness;\n extensionDef.sheenColorFactor = material2.sheenColor.toArray();\n materialDef.extensions = materialDef.extensions || {};\n materialDef.extensions[this.name] = extensionDef;\n extensionsUsed[this.name] = true;\n }\n};\nlet GLTFMaterialsAnisotropyExtension$1 = class GLTFMaterialsAnisotropyExtension {\n constructor(writer) {\n this.writer = writer;\n this.name = \"KHR_materials_anisotropy\";\n }\n writeMaterial(material2, materialDef) {\n if (!material2.isMeshPhysicalMaterial || material2.anisotropy == 0)\n return;\n const writer = this.writer;\n const extensionsUsed = writer.extensionsUsed;\n const extensionDef = {};\n if (material2.anisotropyMap) {\n const anisotropyMapDef = { index: writer.processTexture(material2.anisotropyMap) };\n writer.applyTextureTransform(anisotropyMapDef, material2.anisotropyMap);\n extensionDef.anisotropyTexture = anisotropyMapDef;\n }\n extensionDef.anisotropyStrength = material2.anisotropy;\n extensionDef.anisotropyRotation = material2.anisotropyRotation;\n materialDef.extensions = materialDef.extensions || {};\n materialDef.extensions[this.name] = extensionDef;\n extensionsUsed[this.name] = true;\n }\n};\nlet GLTFMaterialsEmissiveStrengthExtension$1 = class GLTFMaterialsEmissiveStrengthExtension {\n constructor(writer) {\n this.writer = writer;\n this.name = \"KHR_materials_emissive_strength\";\n }\n writeMaterial(material2, materialDef) {\n if (!material2.isMeshStandardMaterial || material2.emissiveIntensity === 1)\n return;\n const writer = this.writer;\n const extensionsUsed = writer.extensionsUsed;\n const extensionDef = {};\n extensionDef.emissiveStrength = material2.emissiveIntensity;\n materialDef.extensions = materialDef.extensions || {};\n materialDef.extensions[this.name] = extensionDef;\n extensionsUsed[this.name] = true;\n }\n};\nGLTFExporter.Utils = {\n insertKeyframe: function(track, time) {\n const tolerance = 1e-3;\n const valueSize = track.getValueSize();\n const times = new track.TimeBufferType(track.times.length + 1);\n const values = new track.ValueBufferType(track.values.length + valueSize);\n const interpolant = track.createInterpolant(new track.ValueBufferType(valueSize));\n let index;\n if (track.times.length === 0) {\n times[0] = time;\n for (let i2 = 0; i2 < valueSize; i2++) {\n values[i2] = 0;\n }\n index = 0;\n } else if (time < track.times[0]) {\n if (Math.abs(track.times[0] - time) < tolerance)\n return 0;\n times[0] = time;\n times.set(track.times, 1);\n values.set(interpolant.evaluate(time), 0);\n values.set(track.values, valueSize);\n index = 0;\n } else if (time > track.times[track.times.length - 1]) {\n if (Math.abs(track.times[track.times.length - 1] - time) < tolerance) {\n return track.times.length - 1;\n }\n times[times.length - 1] = time;\n times.set(track.times, 0);\n values.set(track.values, 0);\n values.set(interpolant.evaluate(time), track.values.length);\n index = times.length - 1;\n } else {\n for (let i2 = 0; i2 < track.times.length; i2++) {\n if (Math.abs(track.times[i2] - time) < tolerance)\n return i2;\n if (track.times[i2] < time && track.times[i2 + 1] > time) {\n times.set(track.times.slice(0, i2 + 1), 0);\n times[i2 + 1] = time;\n times.set(track.times.slice(i2 + 1), i2 + 2);\n values.set(track.values.slice(0, (i2 + 1) * valueSize), 0);\n values.set(interpolant.evaluate(time), (i2 + 1) * valueSize);\n values.set(track.values.slice((i2 + 1) * valueSize), (i2 + 2) * valueSize);\n index = i2 + 1;\n break;\n }\n }\n }\n track.times = times;\n track.values = values;\n return index;\n },\n mergeMorphTargetTracks: function(clip, root) {\n const tracks = [];\n const mergedTracks = {};\n const sourceTracks = clip.tracks;\n for (let i2 = 0; i2 < sourceTracks.length; ++i2) {\n let sourceTrack = sourceTracks[i2];\n const sourceTrackBinding = three__WEBPACK_IMPORTED_MODULE_42__.PropertyBinding.parseTrackName(sourceTrack.name);\n const sourceTrackNode = three__WEBPACK_IMPORTED_MODULE_42__.PropertyBinding.findNode(root, sourceTrackBinding.nodeName);\n if (sourceTrackBinding.propertyName !== \"morphTargetInfluences\" || sourceTrackBinding.propertyIndex === void 0) {\n tracks.push(sourceTrack);\n continue;\n }\n if (sourceTrack.createInterpolant !== sourceTrack.InterpolantFactoryMethodDiscrete && sourceTrack.createInterpolant !== sourceTrack.InterpolantFactoryMethodLinear) {\n if (sourceTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline) {\n throw new Error(\"THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.\");\n }\n console.warn(\"THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead.\");\n sourceTrack = sourceTrack.clone();\n sourceTrack.setInterpolation(three__WEBPACK_IMPORTED_MODULE_42__.InterpolateLinear);\n }\n const targetCount = sourceTrackNode.morphTargetInfluences.length;\n const targetIndex = sourceTrackNode.morphTargetDictionary[sourceTrackBinding.propertyIndex];\n if (targetIndex === void 0) {\n throw new Error(\"THREE.GLTFExporter: Morph target name not found: \" + sourceTrackBinding.propertyIndex);\n }\n let mergedTrack;\n if (mergedTracks[sourceTrackNode.uuid] === void 0) {\n mergedTrack = sourceTrack.clone();\n const values = new mergedTrack.ValueBufferType(targetCount * mergedTrack.times.length);\n for (let j = 0; j < mergedTrack.times.length; j++) {\n values[j * targetCount + targetIndex] = mergedTrack.values[j];\n }\n mergedTrack.name = (sourceTrackBinding.nodeName || \"\") + \".morphTargetInfluences\";\n mergedTrack.values = values;\n mergedTracks[sourceTrackNode.uuid] = mergedTrack;\n tracks.push(mergedTrack);\n continue;\n }\n const sourceInterpolant = sourceTrack.createInterpolant(new sourceTrack.ValueBufferType(1));\n mergedTrack = mergedTracks[sourceTrackNode.uuid];\n for (let j = 0; j < mergedTrack.times.length; j++) {\n mergedTrack.values[j * targetCount + targetIndex] = sourceInterpolant.evaluate(mergedTrack.times[j]);\n }\n for (let j = 0; j < sourceTrack.times.length; j++) {\n const keyframeIndex = this.insertKeyframe(mergedTrack, sourceTrack.times[j]);\n mergedTrack.values[keyframeIndex * targetCount + targetIndex] = sourceTrack.values[j];\n }\n }\n clip.tracks = tracks;\n return clip;\n }\n};\nclass USDZExporter {\n constructor() {\n __publicField(this, \"PRECISION\", 7);\n __publicField(this, \"materials\");\n __publicField(this, \"textures\");\n __publicField(this, \"files\");\n this.materials = {};\n this.textures = {};\n this.files = {};\n }\n async parse(scene) {\n const modelFileName = \"model.usda\";\n this.files[modelFileName] = null;\n let output = this.buildHeader();\n scene.traverseVisible((object) => {\n if (object instanceof three__WEBPACK_IMPORTED_MODULE_42__.Mesh && object.isMesh && object.material.isMeshStandardMaterial) {\n const geometry2 = object.geometry;\n const material2 = object.material;\n const geometryFileName = \"geometries/Geometry_\" + geometry2.id + \".usd\";\n if (!(geometryFileName in this.files)) {\n const meshObject = this.buildMeshObject(geometry2);\n this.files[geometryFileName] = this.buildUSDFileAsString(meshObject);\n }\n if (!(material2.uuid in this.materials)) {\n this.materials[material2.uuid] = material2;\n }\n output += this.buildXform(object, geometry2, material2);\n }\n });\n output += this.buildMaterials(this.materials);\n this.files[modelFileName] = (0,fflate__WEBPACK_IMPORTED_MODULE_43__.strToU8)(output);\n output = null;\n for (const id in this.textures) {\n const texture = this.textures[id];\n const color = id.split(\"_\")[1];\n const isRGBA = texture.format === 1023;\n const canvas = this.imageToCanvas(texture.image, color);\n const blob = await new Promise(\n (resolve) => canvas == null ? void 0 : canvas.toBlob(resolve, isRGBA ? \"image/png\" : \"image/jpeg\", 1)\n );\n if (blob) {\n this.files[`textures/Texture_${id}.${isRGBA ? \"png\" : \"jpg\"}`] = new Uint8Array(await blob.arrayBuffer());\n }\n }\n let offset = 0;\n for (const filename in this.files) {\n const file = this.files[filename];\n const headerSize = 34 + filename.length;\n offset += headerSize;\n const offsetMod64 = offset & 63;\n if (offsetMod64 !== 4 && file !== null && file instanceof Uint8Array) {\n const padLength = 64 - offsetMod64;\n const padding = new Uint8Array(padLength);\n this.files[filename] = [file, { extra: { 12345: padding } }];\n }\n if (file && typeof file.length === \"number\") {\n offset = file.length;\n }\n }\n return (0,fflate__WEBPACK_IMPORTED_MODULE_43__.zipSync)(this.files, { level: 0 });\n }\n imageToCanvas(image, color) {\n if (typeof HTMLImageElement !== \"undefined\" && image instanceof HTMLImageElement || typeof HTMLCanvasElement !== \"undefined\" && image instanceof HTMLCanvasElement || typeof OffscreenCanvas !== \"undefined\" && image instanceof OffscreenCanvas || typeof ImageBitmap !== \"undefined\" && image instanceof ImageBitmap) {\n const scale = 1024 / Math.max(image.width, image.height);\n const canvas = document.createElement(\"canvas\");\n canvas.width = image.width * Math.min(1, scale);\n canvas.height = image.height * Math.min(1, scale);\n const context = canvas.getContext(\"2d\");\n context == null ? void 0 : context.drawImage(image, 0, 0, canvas.width, canvas.height);\n if (color !== void 0) {\n const hex = parseInt(color, 16);\n const r = (hex >> 16 & 255) / 255;\n const g = (hex >> 8 & 255) / 255;\n const b2 = (hex & 255) / 255;\n const imagedata = context == null ? void 0 : context.getImageData(0, 0, canvas.width, canvas.height);\n if (imagedata) {\n const data = imagedata == null ? void 0 : imagedata.data;\n for (let i2 = 0; i2 < data.length; i2 += 4) {\n data[i2 + 0] = data[i2 + 0] * r;\n data[i2 + 1] = data[i2 + 1] * g;\n data[i2 + 2] = data[i2 + 2] * b2;\n }\n context == null ? void 0 : context.putImageData(imagedata, 0, 0);\n }\n }\n return canvas;\n }\n }\n buildHeader() {\n return `#usda 1.0\n(\n customLayerData = {\n string creator = \"Three.js USDZExporter\"\n }\n metersPerUnit = 1\n upAxis = \"Y\"\n)\n`;\n }\n buildUSDFileAsString(dataToInsert) {\n let output = this.buildHeader();\n output += dataToInsert;\n return (0,fflate__WEBPACK_IMPORTED_MODULE_43__.strToU8)(output);\n }\n // Xform\n buildXform(object, geometry2, material2) {\n const name = \"Object_\" + object.id;\n const transform = this.buildMatrix(object.matrixWorld);\n if (object.matrixWorld.determinant() < 0) {\n console.warn(\"THREE.USDZExporter: USDZ does not support negative scales\", object);\n }\n return `def Xform \"${name}\" (\n prepend references = @./geometries/Geometry_${geometry2.id}.usd@\n)\n{\n matrix4d xformOp:transform = ${transform}\n uniform token[] xformOpOrder = [\"xformOp:transform\"]\n rel material:binding = \n}\n`;\n }\n buildMatrix(matrix2) {\n const array = matrix2.elements;\n return `( ${this.buildMatrixRow(array, 0)}, ${this.buildMatrixRow(array, 4)}, ${this.buildMatrixRow(\n array,\n 8\n )}, ${this.buildMatrixRow(array, 12)} )`;\n }\n buildMatrixRow(array, offset) {\n return `(${array[offset + 0]}, ${array[offset + 1]}, ${array[offset + 2]}, ${array[offset + 3]})`;\n }\n // Mesh\n buildMeshObject(geometry2) {\n const mesh = this.buildMesh(geometry2);\n return `\ndef \"Geometry\"\n{\n ${mesh}\n}\n`;\n }\n buildMesh(geometry2) {\n const name = \"Geometry\";\n const attributes = geometry2.attributes;\n const count = attributes.position.count;\n return `\n def Mesh \"${name}\"\n {\n int[] faceVertexCounts = [${this.buildMeshVertexCount(geometry2)}]\n int[] faceVertexIndices = [${this.buildMeshVertexIndices(geometry2)}]\n normal3f[] normals = [${this.buildVector3Array(attributes.normal, count)}] (\n interpolation = \"vertex\"\n )\n point3f[] points = [${this.buildVector3Array(attributes.position, count)}]\n float2[] primvars:st = [${this.buildVector2Array(attributes.uv, count)}] (\n interpolation = \"vertex\"\n )\n uniform token subdivisionScheme = \"none\"\n }\n`;\n }\n buildMeshVertexCount(geometry2) {\n const count = geometry2.index !== null ? geometry2.index.array.length : geometry2.attributes.position.count;\n return Array(count / 3).fill(3).join(\", \");\n }\n buildMeshVertexIndices(geometry2) {\n if (geometry2.index !== null) {\n return geometry2.index.array.join(\", \");\n }\n const array = [];\n const length = geometry2.attributes.position.count;\n for (let i2 = 0; i2 < length; i2++) {\n array.push(i2);\n }\n return array.join(\", \");\n }\n buildVector3Array(attribute, count) {\n if (attribute === void 0) {\n console.warn(\"USDZExporter: Normals missing.\");\n return Array(count).fill(\"(0, 0, 0)\").join(\", \");\n }\n const array = [];\n const data = attribute.array;\n for (let i2 = 0; i2 < data.length; i2 += 3) {\n array.push(\n `(${data[i2 + 0].toPrecision(this.PRECISION)}, ${data[i2 + 1].toPrecision(this.PRECISION)}, ${data[i2 + 2].toPrecision(this.PRECISION)})`\n );\n }\n return array.join(\", \");\n }\n buildVector2Array(attribute, count) {\n if (attribute === void 0) {\n console.warn(\"USDZExporter: UVs missing.\");\n return Array(count).fill(\"(0, 0)\").join(\", \");\n }\n const array = [];\n const data = attribute.array;\n for (let i2 = 0; i2 < data.length; i2 += 2) {\n array.push(`(${data[i2 + 0].toPrecision(this.PRECISION)}, ${1 - data[i2 + 1].toPrecision(this.PRECISION)})`);\n }\n return array.join(\", \");\n }\n // Materials\n buildMaterials(materials) {\n const array = [];\n for (const uuid in materials) {\n const material2 = materials[uuid];\n array.push(this.buildMaterial(material2));\n }\n return `def \"Materials\"\n{\n${array.join(\"\")}\n}\n`;\n }\n buildMaterial(material2) {\n const pad = \" \";\n const inputs = [];\n const samplers = [];\n if (material2.map !== null) {\n inputs.push(\n `${pad}color3f inputs:diffuseColor.connect = `\n );\n samplers.push(this.buildTexture(material2, material2.map, \"diffuse\", material2.color));\n } else {\n inputs.push(`${pad}color3f inputs:diffuseColor = ${this.buildColor(material2.color)}`);\n }\n if (material2.emissiveMap !== null) {\n inputs.push(\n `${pad}color3f inputs:emissiveColor.connect = `\n );\n samplers.push(this.buildTexture(material2, material2.emissiveMap, \"emissive\"));\n } else if (material2.emissive.getHex() > 0) {\n inputs.push(`${pad}color3f inputs:emissiveColor = ${this.buildColor(material2.emissive)}`);\n }\n if (material2.normalMap !== null) {\n inputs.push(\n `${pad}normal3f inputs:normal.connect = `\n );\n samplers.push(this.buildTexture(material2, material2.normalMap, \"normal\"));\n }\n if (material2.aoMap !== null) {\n inputs.push(\n `${pad}float inputs:occlusion.connect = `\n );\n samplers.push(this.buildTexture(material2, material2.aoMap, \"occlusion\"));\n }\n if (material2.roughnessMap !== null && material2.roughness === 1) {\n inputs.push(\n `${pad}float inputs:roughness.connect = `\n );\n samplers.push(this.buildTexture(material2, material2.roughnessMap, \"roughness\"));\n } else {\n inputs.push(`${pad}float inputs:roughness = ${material2.roughness}`);\n }\n if (material2.metalnessMap !== null && material2.metalness === 1) {\n inputs.push(\n `${pad}float inputs:metallic.connect = `\n );\n samplers.push(this.buildTexture(material2, material2.metalnessMap, \"metallic\"));\n } else {\n inputs.push(`${pad}float inputs:metallic = ${material2.metalness}`);\n }\n inputs.push(`${pad}float inputs:opacity = ${material2.opacity}`);\n if (material2 instanceof three__WEBPACK_IMPORTED_MODULE_42__.MeshPhysicalMaterial) {\n inputs.push(`${pad}float inputs:clearcoat = ${material2.clearcoat}`);\n inputs.push(`${pad}float inputs:clearcoatRoughness = ${material2.clearcoatRoughness}`);\n inputs.push(`${pad}float inputs:ior = ${material2.ior}`);\n }\n return `\n def Material \"Material_${material2.id}\"\n {\n def Shader \"PreviewSurface\"\n {\n uniform token info:id = \"UsdPreviewSurface\"\n${inputs.join(\"\\n\")}\n int inputs:useSpecularWorkflow = 0\n token outputs:surface\n }\n token outputs:surface.connect = \n token inputs:frame:stPrimvarName = \"st\"\n def Shader \"uvReader_st\"\n {\n uniform token info:id = \"UsdPrimvarReader_float2\"\n token inputs:varname.connect = \n float2 inputs:fallback = (0.0, 0.0)\n float2 outputs:result\n }\n${samplers.join(\"\\n\")}\n }\n`;\n }\n buildTexture(material2, texture, mapType, color) {\n const id = texture.id + (color ? \"_\" + color.getHexString() : \"\");\n const isRGBA = texture.format === 1023;\n this.textures[id] = texture;\n return `\n def Shader \"Transform2d_${mapType}\" (\n sdrMetadata = {\n string role = \"math\"\n }\n )\n {\n uniform token info:id = \"UsdTransform2d\"\n float2 inputs:in.connect = \n float2 inputs:scale = ${this.buildVector2(texture.repeat)}\n float2 inputs:translation = ${this.buildVector2(texture.offset)}\n float2 outputs:result\n }\n def Shader \"Texture_${texture.id}_${mapType}\"\n {\n uniform token info:id = \"UsdUVTexture\"\n asset inputs:file = @textures/Texture_${id}.${isRGBA ? \"png\" : \"jpg\"}@\n float2 inputs:st.connect = \n token inputs:wrapS = \"repeat\"\n token inputs:wrapT = \"repeat\"\n float outputs:r\n float outputs:g\n float outputs:b\n float3 outputs:rgb\n }`;\n }\n buildColor(color) {\n return `(${color.r}, ${color.g}, ${color.b})`;\n }\n buildVector2(vector) {\n return `(${vector.x}, ${vector.y})`;\n }\n}\nclass PLYExporter {\n parse(object, onDone, options) {\n if (onDone && typeof onDone === \"object\") {\n console.warn(\n 'THREE.PLYExporter: The options parameter is now the third argument to the \"parse\" function. See the documentation for the new API.'\n );\n options = onDone;\n onDone = void 0;\n }\n const defaultOptions2 = {\n binary: false,\n excludeAttributes: [],\n // normal, uv, color, index\n littleEndian: false\n };\n options = Object.assign(defaultOptions2, options);\n const excludeAttributes = options.excludeAttributes;\n let includeNormals = false;\n let includeColors = false;\n let includeUVs = false;\n let vertexCount = 0;\n let faceCount = 0;\n object.traverse(function(child) {\n if (child instanceof three__WEBPACK_IMPORTED_MODULE_42__.Mesh && child.isMesh) {\n const mesh = child;\n const geometry2 = mesh.geometry;\n if (!geometry2.isBufferGeometry) {\n throw new Error(\"THREE.PLYExporter: Geometry is not of type THREE.BufferGeometry.\");\n }\n const vertices = geometry2.getAttribute(\"position\");\n const normals = geometry2.getAttribute(\"normal\");\n const uvs = geometry2.getAttribute(\"uv\");\n const colors = geometry2.getAttribute(\"color\");\n const indices = geometry2.getIndex();\n if (vertices === void 0) {\n return;\n }\n vertexCount += vertices.count;\n faceCount += indices ? indices.count / 3 : vertices.count / 3;\n if (normals !== void 0)\n includeNormals = true;\n if (uvs !== void 0)\n includeUVs = true;\n if (colors !== void 0)\n includeColors = true;\n }\n });\n const includeIndices = (excludeAttributes == null ? void 0 : excludeAttributes.indexOf(\"index\")) === -1;\n includeNormals = includeNormals && (excludeAttributes == null ? void 0 : excludeAttributes.indexOf(\"normal\")) === -1;\n includeColors = includeColors && (excludeAttributes == null ? void 0 : excludeAttributes.indexOf(\"color\")) === -1;\n includeUVs = includeUVs && (excludeAttributes == null ? void 0 : excludeAttributes.indexOf(\"uv\")) === -1;\n if (includeIndices && faceCount !== Math.floor(faceCount)) {\n console.error(\n \"PLYExporter: Failed to generate a valid PLY file with triangle indices because the number of indices is not divisible by 3.\"\n );\n return null;\n }\n const indexByteCount = 4;\n let header = `ply\nformat ${options.binary ? options.littleEndian ? \"binary_little_endian\" : \"binary_big_endian\" : \"ascii\"} 1.0\nelement vertex ${vertexCount}\nproperty float x\nproperty float y\nproperty float z\n`;\n if (includeNormals) {\n header += \"property float nx\\nproperty float ny\\nproperty float nz\\n\";\n }\n if (includeUVs) {\n header += \"property float s\\nproperty float t\\n\";\n }\n if (includeColors) {\n header += \"property uchar red\\nproperty uchar green\\nproperty uchar blue\\n\";\n }\n if (includeIndices) {\n header += `${`element face ${faceCount}\n`}property list uchar int vertex_index\n`;\n }\n header += \"end_header\\n\";\n const vertex = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const normalMatrixWorld = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix3();\n let result = null;\n if (options.binary) {\n const headerBin = new TextEncoder().encode(header);\n const vertexListLength = vertexCount * (4 * 3 + (includeNormals ? 4 * 3 : 0) + (includeColors ? 3 : 0) + (includeUVs ? 4 * 2 : 0));\n const faceListLength = includeIndices ? faceCount * (indexByteCount * 3 + 1) : 0;\n const output = new DataView(new ArrayBuffer(headerBin.length + vertexListLength + faceListLength));\n new Uint8Array(output.buffer).set(headerBin, 0);\n let vOffset = headerBin.length;\n let fOffset = headerBin.length + vertexListLength;\n let writtenVertices = 0;\n this.traverseMeshes(object, function(mesh, geometry2) {\n const vertices = geometry2.getAttribute(\"position\");\n const normals = geometry2.getAttribute(\"normal\");\n const uvs = geometry2.getAttribute(\"uv\");\n const colors = geometry2.getAttribute(\"color\");\n const indices = geometry2.getIndex();\n normalMatrixWorld.getNormalMatrix(mesh.matrixWorld);\n for (let i2 = 0, l = vertices.count; i2 < l; i2++) {\n vertex.x = vertices.getX(i2);\n vertex.y = vertices.getY(i2);\n vertex.z = vertices.getZ(i2);\n vertex.applyMatrix4(mesh.matrixWorld);\n output.setFloat32(vOffset, vertex.x, options.littleEndian);\n vOffset += 4;\n output.setFloat32(vOffset, vertex.y, options.littleEndian);\n vOffset += 4;\n output.setFloat32(vOffset, vertex.z, options.littleEndian);\n vOffset += 4;\n if (includeNormals) {\n if (normals != null) {\n vertex.x = normals.getX(i2);\n vertex.y = normals.getY(i2);\n vertex.z = normals.getZ(i2);\n vertex.applyMatrix3(normalMatrixWorld).normalize();\n output.setFloat32(vOffset, vertex.x, options.littleEndian);\n vOffset += 4;\n output.setFloat32(vOffset, vertex.y, options.littleEndian);\n vOffset += 4;\n output.setFloat32(vOffset, vertex.z, options.littleEndian);\n vOffset += 4;\n } else {\n output.setFloat32(vOffset, 0, options.littleEndian);\n vOffset += 4;\n output.setFloat32(vOffset, 0, options.littleEndian);\n vOffset += 4;\n output.setFloat32(vOffset, 0, options.littleEndian);\n vOffset += 4;\n }\n }\n if (includeUVs) {\n if (uvs != null) {\n output.setFloat32(vOffset, uvs.getX(i2), options.littleEndian);\n vOffset += 4;\n output.setFloat32(vOffset, uvs.getY(i2), options.littleEndian);\n vOffset += 4;\n } else if (!includeUVs) {\n output.setFloat32(vOffset, 0, options.littleEndian);\n vOffset += 4;\n output.setFloat32(vOffset, 0, options.littleEndian);\n vOffset += 4;\n }\n }\n if (includeColors) {\n if (colors != null) {\n output.setUint8(vOffset, Math.floor(colors.getX(i2) * 255));\n vOffset += 1;\n output.setUint8(vOffset, Math.floor(colors.getY(i2) * 255));\n vOffset += 1;\n output.setUint8(vOffset, Math.floor(colors.getZ(i2) * 255));\n vOffset += 1;\n } else {\n output.setUint8(vOffset, 255);\n vOffset += 1;\n output.setUint8(vOffset, 255);\n vOffset += 1;\n output.setUint8(vOffset, 255);\n vOffset += 1;\n }\n }\n }\n if (includeIndices) {\n if (indices !== null) {\n for (let i2 = 0, l = indices.count; i2 < l; i2 += 3) {\n output.setUint8(fOffset, 3);\n fOffset += 1;\n output.setUint32(fOffset, indices.getX(i2 + 0) + writtenVertices, options.littleEndian);\n fOffset += indexByteCount;\n output.setUint32(fOffset, indices.getX(i2 + 1) + writtenVertices, options.littleEndian);\n fOffset += indexByteCount;\n output.setUint32(fOffset, indices.getX(i2 + 2) + writtenVertices, options.littleEndian);\n fOffset += indexByteCount;\n }\n } else {\n for (let i2 = 0, l = vertices.count; i2 < l; i2 += 3) {\n output.setUint8(fOffset, 3);\n fOffset += 1;\n output.setUint32(fOffset, writtenVertices + i2, options.littleEndian);\n fOffset += indexByteCount;\n output.setUint32(fOffset, writtenVertices + i2 + 1, options.littleEndian);\n fOffset += indexByteCount;\n output.setUint32(fOffset, writtenVertices + i2 + 2, options.littleEndian);\n fOffset += indexByteCount;\n }\n }\n }\n writtenVertices += vertices.count;\n });\n result = output.buffer;\n } else {\n let writtenVertices = 0;\n let vertexList = \"\";\n let faceList = \"\";\n this.traverseMeshes(object, function(mesh, geometry2) {\n const vertices = geometry2.getAttribute(\"position\");\n const normals = geometry2.getAttribute(\"normal\");\n const uvs = geometry2.getAttribute(\"uv\");\n const colors = geometry2.getAttribute(\"color\");\n const indices = geometry2.getIndex();\n normalMatrixWorld.getNormalMatrix(mesh.matrixWorld);\n for (let i2 = 0, l = vertices.count; i2 < l; i2++) {\n vertex.x = vertices.getX(i2);\n vertex.y = vertices.getY(i2);\n vertex.z = vertices.getZ(i2);\n vertex.applyMatrix4(mesh.matrixWorld);\n let line = vertex.x + \" \" + vertex.y + \" \" + vertex.z;\n if (includeNormals) {\n if (normals != null) {\n vertex.x = normals.getX(i2);\n vertex.y = normals.getY(i2);\n vertex.z = normals.getZ(i2);\n vertex.applyMatrix3(normalMatrixWorld).normalize();\n line += \" \" + vertex.x + \" \" + vertex.y + \" \" + vertex.z;\n } else {\n line += \" 0 0 0\";\n }\n }\n if (includeUVs) {\n if (uvs != null) {\n line += \" \" + uvs.getX(i2) + \" \" + uvs.getY(i2);\n } else if (includeUVs) {\n line += \" 0 0\";\n }\n }\n if (includeColors) {\n if (colors != null) {\n line += \" \" + Math.floor(colors.getX(i2) * 255) + \" \" + Math.floor(colors.getY(i2) * 255) + \" \" + Math.floor(colors.getZ(i2) * 255);\n } else {\n line += \" 255 255 255\";\n }\n }\n vertexList += line + \"\\n\";\n }\n if (includeIndices) {\n if (indices !== null) {\n for (let i2 = 0, l = indices.count; i2 < l; i2 += 3) {\n faceList += `3 ${indices.getX(i2 + 0) + writtenVertices}`;\n faceList += ` ${indices.getX(i2 + 1) + writtenVertices}`;\n faceList += ` ${indices.getX(i2 + 2) + writtenVertices}\n`;\n }\n } else {\n for (let i2 = 0, l = vertices.count; i2 < l; i2 += 3) {\n faceList += `3 ${writtenVertices + i2} ${writtenVertices + i2 + 1} ${writtenVertices + i2 + 2}\n`;\n }\n }\n faceCount += indices ? indices.count / 3 : vertices.count / 3;\n }\n writtenVertices += vertices.count;\n });\n result = `${header}${vertexList}${includeIndices ? `${faceList}\n` : \"\\n\"}`;\n }\n if (typeof onDone === \"function\") {\n requestAnimationFrame(() => onDone && onDone(typeof result === \"string\" ? result : \"\"));\n }\n return result;\n }\n // Iterate over the valid meshes in the object\n traverseMeshes(object, cb2) {\n object.traverse(function(child) {\n if (child instanceof three__WEBPACK_IMPORTED_MODULE_42__.Mesh && child.isMesh) {\n const mesh = child;\n const geometry2 = mesh.geometry;\n if (!geometry2.isBufferGeometry) {\n throw new Error(\"THREE.PLYExporter: Geometry is not of type THREE.BufferGeometry.\");\n }\n if (geometry2.hasAttribute(\"position\")) {\n cb2(mesh, geometry2);\n }\n }\n });\n }\n}\nconst _DRACOExporter = class {\n parse(object, options = {\n decodeSpeed: 5,\n encodeSpeed: 5,\n encoderMethod: _DRACOExporter.MESH_EDGEBREAKER_ENCODING,\n quantization: [16, 8, 8, 8, 8],\n exportUvs: true,\n exportNormals: true,\n exportColor: false\n }) {\n if (object instanceof three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry && object.isBufferGeometry) {\n throw new Error(\"DRACOExporter: The first parameter of parse() is now an instance of Mesh or Points.\");\n }\n if (DracoEncoderModule === void 0) {\n throw new Error(\"THREE.DRACOExporter: required the draco_encoder to work.\");\n }\n const geometry2 = object.geometry;\n const dracoEncoder = DracoEncoderModule();\n const encoder = new dracoEncoder.Encoder();\n let builder;\n let dracoObject;\n if (!geometry2.isBufferGeometry) {\n throw new Error(\"THREE.DRACOExporter.parse(geometry, options): geometry is not a THREE.BufferGeometry instance.\");\n }\n if (object instanceof three__WEBPACK_IMPORTED_MODULE_42__.Mesh && object.isMesh) {\n builder = new dracoEncoder.MeshBuilder();\n dracoObject = new dracoEncoder.Mesh();\n const vertices = geometry2.getAttribute(\"position\");\n builder.AddFloatAttributeToMesh(\n dracoObject,\n dracoEncoder.POSITION,\n vertices.count,\n vertices.itemSize,\n vertices.array\n );\n const faces = geometry2.getIndex();\n if (faces !== null) {\n builder.AddFacesToMesh(dracoObject, faces.count / 3, faces.array);\n } else {\n const faces2 = new (vertices.count > 65535 ? Uint32Array : Uint16Array)(vertices.count);\n for (let i2 = 0; i2 < faces2.length; i2++) {\n faces2[i2] = i2;\n }\n builder.AddFacesToMesh(dracoObject, vertices.count, faces2);\n }\n if (options.exportNormals) {\n const normals = geometry2.getAttribute(\"normal\");\n if (normals !== void 0) {\n builder.AddFloatAttributeToMesh(\n dracoObject,\n dracoEncoder.NORMAL,\n normals.count,\n normals.itemSize,\n normals.array\n );\n }\n }\n if (options.exportUvs) {\n const uvs = geometry2.getAttribute(\"uv\");\n if (uvs !== void 0) {\n builder.AddFloatAttributeToMesh(dracoObject, dracoEncoder.TEX_COORD, uvs.count, uvs.itemSize, uvs.array);\n }\n }\n if (options.exportColor) {\n const colors = geometry2.getAttribute(\"color\");\n if (colors !== void 0) {\n builder.AddFloatAttributeToMesh(dracoObject, dracoEncoder.COLOR, colors.count, colors.itemSize, colors.array);\n }\n }\n } else if (object instanceof three__WEBPACK_IMPORTED_MODULE_42__.Points && object.isPoints) {\n builder = new dracoEncoder.PointCloudBuilder();\n dracoObject = new dracoEncoder.PointCloud();\n const vertices = geometry2.getAttribute(\"position\");\n builder.AddFloatAttribute(dracoObject, dracoEncoder.POSITION, vertices.count, vertices.itemSize, vertices.array);\n if (options.exportColor) {\n const colors = geometry2.getAttribute(\"color\");\n if (colors !== void 0) {\n builder.AddFloatAttribute(dracoObject, dracoEncoder.COLOR, colors.count, colors.itemSize, colors.array);\n }\n }\n } else {\n throw new Error(\"DRACOExporter: Unsupported object type.\");\n }\n const encodedData = new dracoEncoder.DracoInt8Array();\n const encodeSpeed = options.encodeSpeed !== void 0 ? options.encodeSpeed : 5;\n const decodeSpeed = options.decodeSpeed !== void 0 ? options.decodeSpeed : 5;\n encoder.SetSpeedOptions(encodeSpeed, decodeSpeed);\n if (options.encoderMethod !== void 0) {\n encoder.SetEncodingMethod(options.encoderMethod);\n }\n if (options.quantization !== void 0) {\n for (let i2 = 0; i2 < 5; i2++) {\n if (options.quantization[i2] !== void 0) {\n encoder.SetAttributeQuantization(i2, options.quantization[i2]);\n }\n }\n }\n let length;\n if (object instanceof three__WEBPACK_IMPORTED_MODULE_42__.Mesh && object.isMesh) {\n length = encoder.EncodeMeshToDracoBuffer(dracoObject, encodedData);\n } else {\n length = encoder.EncodePointCloudToDracoBuffer(dracoObject, true, encodedData);\n }\n dracoEncoder.destroy(dracoObject);\n if (length === 0) {\n throw new Error(\"THREE.DRACOExporter: Draco encoding failed.\");\n }\n const outputData = new Int8Array(new ArrayBuffer(length));\n for (let i2 = 0; i2 < length; i2++) {\n outputData[i2] = encodedData.GetValue(i2);\n }\n dracoEncoder.destroy(encodedData);\n dracoEncoder.destroy(encoder);\n dracoEncoder.destroy(builder);\n return outputData;\n }\n};\nlet DRACOExporter = _DRACOExporter;\n// Encoder methods\n__publicField(DRACOExporter, \"MESH_EDGEBREAKER_ENCODING\", 1);\n__publicField(DRACOExporter, \"MESH_SEQUENTIAL_ENCODING\", 0);\n// Geometry type\n__publicField(DRACOExporter, \"POINT_CLOUD\", 0);\n__publicField(DRACOExporter, \"TRIANGULAR_MESH\", 1);\n// Attribute type\n__publicField(DRACOExporter, \"INVALID\", -1);\n__publicField(DRACOExporter, \"POSITION\", 0);\n__publicField(DRACOExporter, \"NORMAL\", 1);\n__publicField(DRACOExporter, \"COLOR\", 2);\n__publicField(DRACOExporter, \"TEX_COORD\", 3);\n__publicField(DRACOExporter, \"GENERIC\", 4);\nclass ColladaExporter {\n constructor() {\n __publicField(this, \"options\");\n __publicField(this, \"geometryInfo\");\n __publicField(this, \"materialMap\");\n __publicField(this, \"imageMap\");\n __publicField(this, \"textures\");\n __publicField(this, \"libraryImages\");\n __publicField(this, \"libraryGeometries\");\n __publicField(this, \"libraryEffects\");\n __publicField(this, \"libraryMaterials\");\n __publicField(this, \"canvas\");\n __publicField(this, \"ctx\");\n __publicField(this, \"transMat\");\n __publicField(this, \"getFuncs\", [\"getX\", \"getY\", \"getZ\", \"getW\"]);\n this.options = {\n version: \"1.4.1\",\n author: null,\n textureDirectory: \"\",\n upAxis: \"Y_UP\",\n unitName: null,\n unitMeter: null\n };\n this.geometryInfo = /* @__PURE__ */ new WeakMap();\n this.materialMap = /* @__PURE__ */ new WeakMap();\n this.imageMap = /* @__PURE__ */ new WeakMap();\n this.textures = [];\n this.libraryImages = [];\n this.libraryGeometries = [];\n this.libraryEffects = [];\n this.libraryMaterials = [];\n this.canvas = null;\n this.ctx = null;\n this.transMat = null;\n }\n parse(object, onDone, options = {}) {\n this.options = { ...this.options, ...options };\n if (this.options.upAxis.match(/^[XYZ]_UP$/) === null) {\n console.error(\"ColladaExporter: Invalid upAxis: valid values are X_UP, Y_UP or Z_UP.\");\n return null;\n }\n if (this.options.unitName !== null && this.options.unitMeter === null) {\n console.error(\"ColladaExporter: unitMeter needs to be specified if unitName is specified.\");\n return null;\n }\n if (this.options.unitMeter !== null && this.options.unitName === null) {\n console.error(\"ColladaExporter: unitName needs to be specified if unitMeter is specified.\");\n return null;\n }\n if (this.options.textureDirectory !== \"\") {\n this.options.textureDirectory = `${this.options.textureDirectory}/`.replace(/\\\\/g, \"/\").replace(/\\/+/g, \"/\");\n }\n if (this.options.version !== \"1.4.1\" && this.options.version !== \"1.5.0\") {\n console.warn(`ColladaExporter : Version ${this.options.version} not supported for export. Only 1.4.1 and 1.5.0.`);\n return null;\n }\n const libraryVisualScenes = this.processObject(object);\n const specLink = this.options.version === \"1.4.1\" ? \"http://www.collada.org/2005/11/COLLADASchema\" : \"https://www.khronos.org/collada/\";\n let dae = `${``}three.js Collada Exporter${this.options.author !== null ? `${this.options.author}` : \"\"}${`${(/* @__PURE__ */ new Date()).toISOString()}`}${`${(/* @__PURE__ */ new Date()).toISOString()}`}Y_UP`;\n dae += `${this.libraryImages.join(\"\")}`;\n dae += `${this.libraryEffects.join(\"\")}`;\n dae += `${this.libraryMaterials.join(\"\")}`;\n dae += `${this.libraryGeometries.join(\"\")}`;\n dae += `${libraryVisualScenes}`;\n dae += '';\n dae += \"\";\n const res = {\n data: this.format(dae),\n textures: this.textures\n };\n if (typeof onDone === \"function\") {\n requestAnimationFrame(() => onDone(res));\n }\n return res;\n }\n // Convert the urdf xml into a well-formatted, indented format\n format(urdf) {\n var _a2, _b2;\n const IS_END_TAG = /^<\\//;\n const IS_SELF_CLOSING = /(\\?>$)|(\\/>$)/;\n const HAS_TEXT = /<[^>]+>[^<]*<\\/[^<]+>/;\n const pad = (ch, num) => num > 0 ? ch + pad(ch, num - 1) : \"\";\n let tagnum = 0;\n return (_b2 = (_a2 = urdf.match(/(<[^>]+>[^<]+<\\/[^<]+>)|(<[^>]+>)/g)) == null ? void 0 : _a2.map((tag) => {\n if (!HAS_TEXT.test(tag) && !IS_SELF_CLOSING.test(tag) && IS_END_TAG.test(tag)) {\n tagnum--;\n }\n const res = `${pad(\" \", tagnum)}${tag}`;\n if (!HAS_TEXT.test(tag) && !IS_SELF_CLOSING.test(tag) && !IS_END_TAG.test(tag)) {\n tagnum++;\n }\n return res;\n }).join(\"\\n\")) != null ? _b2 : \"\";\n }\n // Convert an image into a png format for saving\n base64ToBuffer(str) {\n const b2 = atob(str);\n const buf = new Uint8Array(b2.length);\n for (let i2 = 0, l = buf.length; i2 < l; i2++) {\n buf[i2] = b2.charCodeAt(i2);\n }\n return buf;\n }\n imageToData(image, ext) {\n var _a2;\n this.canvas = this.canvas || document.createElement(\"canvas\");\n this.ctx = this.ctx || this.canvas.getContext(\"2d\");\n this.canvas.width = image.width instanceof SVGAnimatedLength ? 0 : image.width;\n this.canvas.height = image.height instanceof SVGAnimatedLength ? 0 : image.height;\n (_a2 = this.ctx) == null ? void 0 : _a2.drawImage(image, 0, 0);\n const base64data = this.canvas.toDataURL(`image/${ext}`, 1).replace(/^data:image\\/(png|jpg);base64,/, \"\");\n return this.base64ToBuffer(base64data);\n }\n // gets the attribute array. Generate a new array if the attribute is interleaved\n attrBufferToArray(attr) {\n if (attr instanceof three__WEBPACK_IMPORTED_MODULE_42__.InterleavedBufferAttribute && attr.isInterleavedBufferAttribute) {\n const TypedArrayConstructor = attr.array.constructor;\n const arr = new TypedArrayConstructor(attr.count * attr.itemSize);\n const size2 = attr.itemSize;\n for (let i2 = 0, l = attr.count; i2 < l; i2++) {\n for (let j = 0; j < size2; j++) {\n arr[i2 * size2 + j] = attr[this.getFuncs[j]](i2);\n }\n }\n return arr;\n } else {\n return attr.array;\n }\n }\n // Returns an array of the same type starting at the `st` index,\n // and `ct` length\n subArray(arr, st, ct) {\n if (Array.isArray(arr)) {\n return arr.slice(st, st + ct);\n } else {\n const TypedArrayConstructor = arr.constructor;\n return new TypedArrayConstructor(arr.buffer, st * arr.BYTES_PER_ELEMENT, ct);\n }\n }\n // Returns the string for a geometry's attribute\n getAttribute(attr, name, params, type) {\n const array = this.attrBufferToArray(attr);\n const res = Array.isArray(array) ? `${`` + array.join(\" \")}${``}${params.map((n) => ``).join(\"\")}` : \"\";\n return res;\n }\n // Returns the string for a node's transform information\n getTransform(o) {\n o.updateMatrix();\n this.transMat = this.transMat || new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n this.transMat.copy(o.matrix);\n this.transMat.transpose();\n return `${this.transMat.toArray().join(\" \")}`;\n }\n // Process the given piece of geometry into the geometry library\n // Returns the mesh id\n processGeometry(g) {\n let info = this.geometryInfo.get(g);\n if (!info) {\n const bufferGeometry = g;\n if (!bufferGeometry.isBufferGeometry) {\n throw new Error(\"THREE.ColladaExporter: Geometry is not of type THREE.BufferGeometry.\");\n }\n const meshid = `Mesh${this.libraryGeometries.length + 1}`;\n const indexCount = bufferGeometry.index ? bufferGeometry.index.count * bufferGeometry.index.itemSize : bufferGeometry.attributes.position.count;\n const groups = bufferGeometry.groups != null && bufferGeometry.groups.length !== 0 ? bufferGeometry.groups : [{ start: 0, count: indexCount, materialIndex: 0 }];\n const gname = g.name ? ` name=\"${g.name}\"` : \"\";\n let gnode = ``;\n const posName = `${meshid}-position`;\n const vertName = `${meshid}-vertices`;\n gnode += this.getAttribute(bufferGeometry.attributes.position, posName, [\"X\", \"Y\", \"Z\"], \"float\");\n gnode += ``;\n let triangleInputs = ``;\n if (\"normal\" in bufferGeometry.attributes) {\n const normName = `${meshid}-normal`;\n gnode += this.getAttribute(bufferGeometry.attributes.normal, normName, [\"X\", \"Y\", \"Z\"], \"float\");\n triangleInputs += ``;\n }\n if (\"uv\" in bufferGeometry.attributes) {\n const uvName = `${meshid}-texcoord`;\n gnode += this.getAttribute(bufferGeometry.attributes.uv, uvName, [\"S\", \"T\"], \"float\");\n triangleInputs += ``;\n }\n if (\"uv2\" in bufferGeometry.attributes) {\n const uvName = `${meshid}-texcoord2`;\n gnode += this.getAttribute(bufferGeometry.attributes.uv2, uvName, [\"S\", \"T\"], \"float\");\n triangleInputs += ``;\n }\n if (\"color\" in bufferGeometry.attributes) {\n const colName = `${meshid}-color`;\n gnode += this.getAttribute(bufferGeometry.attributes.color, colName, [\"X\", \"Y\", \"Z\"], \"uint8\");\n triangleInputs += ``;\n }\n let indexArray = null;\n if (bufferGeometry.index) {\n indexArray = this.attrBufferToArray(bufferGeometry.index);\n } else {\n indexArray = new Array(indexCount);\n for (let i2 = 0, l = indexArray.length; i2 < l && Array.isArray(indexArray); i2++)\n indexArray[i2] = i2;\n }\n for (let i2 = 0, l = groups.length; i2 < l; i2++) {\n const group = groups[i2];\n const subarr = this.subArray(indexArray, group.start, group.count);\n const polycount = subarr.length / 3;\n gnode += ``;\n gnode += triangleInputs;\n gnode += `

${subarr.join(\" \")}

`;\n gnode += \"
\";\n }\n gnode += \"
\";\n this.libraryGeometries.push(gnode);\n info = { meshid, bufferGeometry };\n this.geometryInfo.set(g, info);\n }\n return info;\n }\n // Process the given texture into the image library\n // Returns the image library\n processTexture(tex) {\n let texid = this.imageMap.get(tex);\n if (texid == null) {\n texid = `image-${this.libraryImages.length + 1}`;\n const ext = \"png\";\n const name = tex.name || texid;\n let imageNode = ``;\n if (this.options.version === \"1.5.0\") {\n imageNode += `${this.options.textureDirectory}${name}.${ext}`;\n } else {\n imageNode += `${this.options.textureDirectory}${name}.${ext}`;\n }\n imageNode += \"\";\n this.libraryImages.push(imageNode);\n this.imageMap.set(tex, texid);\n this.textures.push({\n directory: this.options.textureDirectory,\n name,\n ext,\n data: this.imageToData(tex.image, ext),\n original: tex\n });\n }\n return texid;\n }\n // Process the given material into the material and effect libraries\n // Returns the material id\n processMaterial(m) {\n let matid = this.materialMap.get(m);\n if (matid == null) {\n matid = `Mat${this.libraryEffects.length + 1}`;\n let type = \"phong\";\n if (m instanceof three__WEBPACK_IMPORTED_MODULE_42__.MeshLambertMaterial) {\n type = \"lambert\";\n } else if (m instanceof three__WEBPACK_IMPORTED_MODULE_42__.MeshBasicMaterial) {\n type = \"constant\";\n if (m.map !== null) {\n console.warn(\"ColladaExporter: Texture maps not supported with MeshBasicMaterial.\");\n }\n }\n if (m instanceof three__WEBPACK_IMPORTED_MODULE_42__.MeshPhongMaterial) {\n const emissive = m.emissive ? m.emissive : new three__WEBPACK_IMPORTED_MODULE_42__.Color(0, 0, 0);\n const diffuse = m.color ? m.color : new three__WEBPACK_IMPORTED_MODULE_42__.Color(0, 0, 0);\n const specular = m.specular ? m.specular : new three__WEBPACK_IMPORTED_MODULE_42__.Color(1, 1, 1);\n const shininess = m.shininess || 0;\n const reflectivity = m.reflectivity || 0;\n let transparencyNode = \"\";\n if (m.transparent) {\n transparencyNode += `${m.map ? '' : \"1\"}`;\n if (m.opacity < 1) {\n transparencyNode += `${m.opacity}`;\n }\n }\n const techniqueNode = `${`<${type}>`}${m.emissiveMap ? '' : `${emissive.r} ${emissive.g} ${emissive.b} 1`}${type !== \"constant\" ? `${m.map ? '' : `${diffuse.r} ${diffuse.g} ${diffuse.b} 1`}` : \"\"}${type !== \"constant\" ? `${m.normalMap ? '' : \"\"}` : \"\"}${type === \"phong\" ? `${`${specular.r} ${specular.g} ${specular.b} 1`}${m.specularMap ? '' : `${shininess}`}` : \"\"}${`${diffuse.r} ${diffuse.g} ${diffuse.b} 1`}${`${reflectivity}`}${transparencyNode}${``}`;\n const effectnode = `${``}${m.map ? `${`${this.processTexture(\n m.map\n )}`}diffuse-surface` : \"\"}${m.specularMap ? `${`${this.processTexture(\n m.specularMap\n )}`}specular-surface` : \"\"}${m.emissiveMap ? `${`${this.processTexture(\n m.emissiveMap\n )}`}emissive-surface` : \"\"}${m.normalMap ? `${`${this.processTexture(\n m.normalMap\n )}`}bump-surface` : \"\"}${techniqueNode}${m.side === three__WEBPACK_IMPORTED_MODULE_42__.DoubleSide ? '1' : \"\"}`;\n const materialName = m.name ? ` name=\"${m.name}\"` : \"\";\n const materialNode = ``;\n this.libraryMaterials.push(materialNode);\n this.libraryEffects.push(effectnode);\n this.materialMap.set(m, matid);\n }\n }\n return matid;\n }\n // Recursively process the object into a scene\n processObject(o) {\n let node = ``;\n node += this.getTransform(o);\n const a2 = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh();\n a2.geometry;\n if (o instanceof three__WEBPACK_IMPORTED_MODULE_42__.Mesh && o.isMesh && o.geometry !== null) {\n const geomInfo = this.processGeometry(o.geometry);\n const meshid = geomInfo.meshid;\n const geometry2 = geomInfo.bufferGeometry;\n let matids = null;\n let matidsArray;\n const mat = o.material || new three__WEBPACK_IMPORTED_MODULE_42__.MeshBasicMaterial();\n const materials = Array.isArray(mat) ? mat : [mat];\n if (geometry2.groups.length > materials.length) {\n matidsArray = new Array(geometry2.groups.length);\n } else {\n matidsArray = new Array(materials.length);\n }\n matids = matidsArray.fill(null).map((_, i2) => this.processMaterial(materials[i2 % materials.length]));\n node += `${`` + (matids != null ? `${matids.map(\n (id, i2) => `${``}`\n ).join(\"\")}` : \"\")}`;\n }\n o.children.forEach((c) => node += this.processObject(c));\n node += \"\";\n return node;\n }\n}\nclass MMDExporter {\n constructor() {\n // Unicode to Shift_JIS table\n __publicField(this, \"u2sTable\");\n }\n /* TODO: implement\n // mesh -> pmd\n this.parsePmd = function ( object ) {\n };\n */\n /* TODO: implement\n // mesh -> pmx\n this.parsePmx = function ( object ) {\n };\n */\n /* TODO: implement\n // animation + skeleton -> vmd\n this.parseVmd = function ( object ) {\n };\n */\n /*\n * skeleton -> vpd\n * Returns Shift_JIS encoded Uint8Array. Otherwise return strings.\n */\n parseVpd(skin, outputShiftJis, useOriginalBones) {\n if (skin.isSkinnedMesh !== true) {\n console.warn(\"THREE.MMDExporter: parseVpd() requires SkinnedMesh instance.\");\n return null;\n }\n function toStringsFromNumber(num) {\n if (Math.abs(num) < 1e-6)\n num = 0;\n let a2 = num.toString();\n if (a2.indexOf(\".\") === -1) {\n a2 += \".\";\n }\n a2 += \"000000\";\n const index = a2.indexOf(\".\");\n const d = a2.slice(0, index);\n const p = a2.slice(index + 1, index + 7);\n return d + \".\" + p;\n }\n function toStringsFromArray(array2) {\n const a2 = [];\n for (let i2 = 0, il = array2.length; i2 < il; i2++) {\n a2.push(toStringsFromNumber(array2[i2]));\n }\n return a2.join(\",\");\n }\n skin.updateMatrixWorld(true);\n const bones = skin.skeleton.bones;\n const bones2 = this.getBindBones(skin);\n const position = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const quaternion = new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion();\n const quaternion2 = new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion();\n const matrix2 = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n const array = [];\n array.push(\"Vocaloid Pose Data file\");\n array.push(\"\");\n array.push((skin.name !== \"\" ? skin.name.replace(/\\s/g, \"_\") : \"skin\") + \".osm;\");\n array.push(bones.length + \";\");\n array.push(\"\");\n for (let i2 = 0, il = bones.length; i2 < il; i2++) {\n const bone = bones[i2];\n const bone2 = bones2[i2];\n if (useOriginalBones === true && bone.userData.ik !== void 0 && bone.userData.ik.originalMatrix !== void 0) {\n matrix2.fromArray(bone.userData.ik.originalMatrix);\n } else {\n matrix2.copy(bone.matrix);\n }\n position.setFromMatrixPosition(matrix2);\n quaternion.setFromRotationMatrix(matrix2);\n const pArray = position.sub(bone2.position).toArray();\n const qArray = quaternion2.copy(bone2.quaternion).conjugate().multiply(quaternion).toArray();\n pArray[2] = -pArray[2];\n qArray[0] = -qArray[0];\n qArray[1] = -qArray[1];\n array.push(\"Bone\" + i2 + \"{\" + bone.name);\n array.push(\" \" + toStringsFromArray(pArray) + \";\");\n array.push(\" \" + toStringsFromArray(qArray) + \";\");\n array.push(\"}\");\n array.push(\"\");\n }\n array.push(\"\");\n const lines = array.join(\"\\n\");\n return outputShiftJis === true ? this.unicodeToShiftjis(lines) : lines;\n }\n unicodeToShiftjis(str) {\n if (this.u2sTable === void 0) {\n const encoder = new mmd_parser__WEBPACK_IMPORTED_MODULE_1__.CharsetEncoder();\n const table = encoder.s2uTable;\n this.u2sTable = {};\n const keys2 = Object.keys(table);\n for (let i2 = 0, il = keys2.length; i2 < il; i2++) {\n let key = keys2[i2];\n const value = table[key];\n this.u2sTable[value] = parseInt(key);\n }\n }\n const array = [];\n for (let i2 = 0, il = str.length; i2 < il; i2++) {\n const code = str.charCodeAt(i2);\n const value = this.u2sTable[code];\n if (value === void 0) {\n throw \"cannot convert charcode 0x\" + code.toString(16);\n } else if (value > 255) {\n array.push(value >> 8 & 255);\n array.push(value & 255);\n } else {\n array.push(value & 255);\n }\n }\n return new Uint8Array(array);\n }\n getBindBones(skin) {\n const poseSkin = skin.clone();\n poseSkin.pose();\n return poseSkin.skeleton.bones;\n }\n}\nclass STLExporter {\n constructor() {\n __publicField(this, \"binary\");\n __publicField(this, \"output\");\n __publicField(this, \"offset\");\n __publicField(this, \"objects\");\n __publicField(this, \"triangles\");\n __publicField(this, \"vA\");\n __publicField(this, \"vB\");\n __publicField(this, \"vC\");\n __publicField(this, \"cb\");\n __publicField(this, \"ab\");\n __publicField(this, \"normal\");\n this.binary = false;\n this.output = \"\";\n this.offset = 80;\n this.objects = [];\n this.triangles = 0;\n this.vA = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this.vB = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this.vC = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this.cb = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this.ab = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this.normal = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n }\n parse(scene, options) {\n this.binary = options.binary !== void 0 ? options.binary : false;\n scene.traverse((object) => {\n if (object instanceof three__WEBPACK_IMPORTED_MODULE_42__.Mesh && object.isMesh) {\n const geometry2 = object.geometry;\n if (!geometry2.isBufferGeometry) {\n throw new Error(\"THREE.STLExporter: Geometry is not of type THREE.BufferGeometry.\");\n }\n const index = geometry2.index;\n const positionAttribute = geometry2.getAttribute(\"position\");\n this.triangles += index !== null ? index.count / 3 : positionAttribute.count / 3;\n this.objects.push({\n object3d: object,\n geometry: geometry2\n });\n }\n });\n if (this.binary) {\n const bufferLength = this.triangles * 2 + this.triangles * 3 * 4 * 4 + 80 + 4;\n const arrayBuffer = new ArrayBuffer(bufferLength);\n this.output = new DataView(arrayBuffer);\n this.output.setUint32(this.offset, this.triangles, true);\n this.offset += 4;\n } else {\n this.output = \"\";\n this.output += \"solid exported\\n\";\n }\n for (let i2 = 0, il = this.objects.length; i2 < il; i2++) {\n const object = this.objects[i2].object3d;\n const geometry2 = this.objects[i2].geometry;\n const index = geometry2.index;\n const positionAttribute = geometry2.getAttribute(\"position\");\n if (object instanceof three__WEBPACK_IMPORTED_MODULE_42__.SkinnedMesh) {\n if (index !== null) {\n for (let j = 0; j < index.count; j += 3) {\n const a2 = index.getX(j + 0);\n const b2 = index.getX(j + 1);\n const c = index.getX(j + 2);\n this.writeFace(a2, b2, c, positionAttribute, object);\n }\n } else {\n for (let j = 0; j < positionAttribute.count; j += 3) {\n const a2 = j + 0;\n const b2 = j + 1;\n const c = j + 2;\n this.writeFace(a2, b2, c, positionAttribute, object);\n }\n }\n }\n }\n if (!this.binary) {\n this.output += \"endsolid exported\\n\";\n }\n return this.output;\n }\n writeFace(a2, b2, c, positionAttribute, object) {\n this.vA.fromBufferAttribute(positionAttribute, a2);\n this.vB.fromBufferAttribute(positionAttribute, b2);\n this.vC.fromBufferAttribute(positionAttribute, c);\n if (object.isSkinnedMesh) {\n object.boneTransform(a2, this.vA);\n object.boneTransform(b2, this.vB);\n object.boneTransform(c, this.vC);\n }\n this.vA.applyMatrix4(object.matrixWorld);\n this.vB.applyMatrix4(object.matrixWorld);\n this.vC.applyMatrix4(object.matrixWorld);\n this.writeNormal(this.vA, this.vB, this.vC);\n this.writeVertex(this.vA);\n this.writeVertex(this.vB);\n this.writeVertex(this.vC);\n if (this.binary && this.output instanceof DataView) {\n this.output.setUint16(this.offset, 0, true);\n this.offset += 2;\n } else {\n this.output += \"\t\tendloop\\n\";\n this.output += \"\tendfacet\\n\";\n }\n }\n writeNormal(vA, vB, vC) {\n this.cb.subVectors(vC, vB);\n this.ab.subVectors(vA, vB);\n this.cb.cross(this.ab).normalize();\n this.normal.copy(this.cb).normalize();\n if (this.binary && this.output instanceof DataView) {\n this.output.setFloat32(this.offset, this.normal.x, true);\n this.offset += 4;\n this.output.setFloat32(this.offset, this.normal.y, true);\n this.offset += 4;\n this.output.setFloat32(this.offset, this.normal.z, true);\n this.offset += 4;\n } else {\n this.output += `\tfacet normal ${this.normal.x} ${this.normal.y} ${this.normal.z}\n`;\n this.output += \"\t\touter loop\\n\";\n }\n }\n writeVertex(vertex) {\n if (this.binary && this.output instanceof DataView) {\n this.output.setFloat32(this.offset, vertex.x, true);\n this.offset += 4;\n this.output.setFloat32(this.offset, vertex.y, true);\n this.offset += 4;\n this.output.setFloat32(this.offset, vertex.z, true);\n this.offset += 4;\n } else {\n this.output += `\t\t\tvertex vertex.x vertex.y vertex.z\n`;\n }\n }\n}\nclass OBJExporter {\n constructor() {\n __publicField(this, \"output\");\n __publicField(this, \"indexVertex\");\n __publicField(this, \"indexVertexUvs\");\n __publicField(this, \"indexNormals\");\n __publicField(this, \"vertex\");\n __publicField(this, \"color\");\n __publicField(this, \"normal\");\n __publicField(this, \"uv\");\n __publicField(this, \"face\");\n this.output = \"\";\n this.indexVertex = 0;\n this.indexVertexUvs = 0;\n this.indexNormals = 0;\n this.vertex = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this.color = new three__WEBPACK_IMPORTED_MODULE_42__.Color();\n this.normal = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this.uv = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2();\n this.face = [];\n }\n parse(object) {\n object.traverse((child) => {\n if (child instanceof three__WEBPACK_IMPORTED_MODULE_42__.Mesh && child.isMesh) {\n this.parseMesh(child);\n }\n if (child instanceof three__WEBPACK_IMPORTED_MODULE_42__.Line && child.isLine) {\n this.parseLine(child);\n }\n if (child instanceof three__WEBPACK_IMPORTED_MODULE_42__.Points && child.isPoints) {\n this.parsePoints(child);\n }\n });\n return this.output;\n }\n parseMesh(mesh) {\n let nbVertex = 0;\n let nbNormals = 0;\n let nbVertexUvs = 0;\n const geometry2 = mesh.geometry;\n const normalMatrixWorld = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix3();\n if (!geometry2.isBufferGeometry) {\n throw new Error(\"THREE.OBJExporter: Geometry is not of type THREE.BufferGeometry.\");\n }\n const vertices = geometry2.getAttribute(\"position\");\n const normals = geometry2.getAttribute(\"normal\");\n const uvs = geometry2.getAttribute(\"uv\");\n const indices = geometry2.getIndex();\n this.output += `o ${mesh.name}\n`;\n if (mesh.material && !Array.isArray(mesh.material) && mesh.material.name) {\n this.output += `usemtl ${mesh.material.name}\n`;\n }\n if (vertices !== void 0) {\n for (let i2 = 0, l = vertices.count; i2 < l; i2++, nbVertex++) {\n this.vertex.x = vertices.getX(i2);\n this.vertex.y = vertices.getY(i2);\n this.vertex.z = vertices.getZ(i2);\n this.vertex.applyMatrix4(mesh.matrixWorld);\n this.output += `v ${this.vertex.x} ${this.vertex.y} ${this.vertex.z}\n`;\n }\n }\n if (uvs !== void 0) {\n for (let i2 = 0, l = uvs.count; i2 < l; i2++, nbVertexUvs++) {\n this.uv.x = uvs.getX(i2);\n this.uv.y = uvs.getY(i2);\n this.output += `vt ${this.uv.x} ${this.uv.y}\n`;\n }\n }\n if (normals !== void 0) {\n normalMatrixWorld.getNormalMatrix(mesh.matrixWorld);\n for (let i2 = 0, l = normals.count; i2 < l; i2++, nbNormals++) {\n this.normal.x = normals.getX(i2);\n this.normal.y = normals.getY(i2);\n this.normal.z = normals.getZ(i2);\n this.normal.applyMatrix3(normalMatrixWorld).normalize();\n this.output += `vn ${this.normal.x} ${this.normal.y} ${this.normal.z}\n`;\n }\n }\n if (indices !== null) {\n for (let i2 = 0, l = indices.count; i2 < l; i2 += 3) {\n for (let m = 0; m < 3; m++) {\n const j = indices.getX(i2 + m) + 1;\n this.face[m] = this.indexVertex + j + (normals || uvs ? `/${uvs ? this.indexVertexUvs + j : \"\"}${normals ? `/${this.indexNormals + j}` : \"\"}` : \"\");\n }\n this.output += `f ${this.face.join(\" \")}\n`;\n }\n } else {\n for (let i2 = 0, l = vertices.count; i2 < l; i2 += 3) {\n for (let m = 0; m < 3; m++) {\n const j = i2 + m + 1;\n this.face[m] = this.indexVertex + j + (normals || uvs ? `/${uvs ? this.indexVertexUvs + j : \"\"}${normals ? `/${this.indexNormals + j}` : \"\"}` : \"\");\n }\n this.output += `f ${this.face.join(\" \")}\n`;\n }\n }\n this.indexVertex += nbVertex;\n this.indexVertexUvs += nbVertexUvs;\n this.indexNormals += nbNormals;\n }\n parseLine(line) {\n let nbVertex = 0;\n const geometry2 = line.geometry;\n const type = line.type;\n if (geometry2.isBufferGeometry) {\n throw new Error(\"THREE.OBJExporter: Geometry is not of type THREE.BufferGeometry.\");\n }\n const vertices = geometry2.getAttribute(\"position\");\n this.output += `o ${line.name}\n`;\n if (vertices !== void 0) {\n for (let i2 = 0, l = vertices.count; i2 < l; i2++, nbVertex++) {\n this.vertex.x = vertices.getX(i2);\n this.vertex.y = vertices.getY(i2);\n this.vertex.z = vertices.getZ(i2);\n this.vertex.applyMatrix4(line.matrixWorld);\n this.output += `v ${this.vertex.x} ${this.vertex.y} ${this.vertex.z}\n`;\n }\n }\n if (type === \"Line\") {\n this.output += \"l \";\n for (let j = 1, l = vertices.count; j <= l; j++) {\n this.output += `${this.indexVertex + j} `;\n }\n this.output += \"\\n\";\n }\n if (type === \"LineSegments\") {\n for (let j = 1, k = j + 1, l = vertices.count; j < l; j += 2, k = j + 1) {\n this.output += `l ${this.indexVertex + j} ${this.indexVertex + k}\n`;\n }\n }\n this.indexVertex += nbVertex;\n }\n parsePoints(points) {\n let nbVertex = 0;\n const geometry2 = points.geometry;\n if (!geometry2.isBufferGeometry) {\n throw new Error(\"THREE.OBJExporter: Geometry is not of type THREE.BufferGeometry.\");\n }\n const vertices = geometry2.getAttribute(\"position\");\n const colors = geometry2.getAttribute(\"color\");\n this.output += `o ${points.name}\n`;\n if (vertices !== void 0) {\n for (let i2 = 0, l = vertices.count; i2 < l; i2++, nbVertex++) {\n this.vertex.fromBufferAttribute(vertices, i2);\n this.vertex.applyMatrix4(points.matrixWorld);\n this.output += `v ${this.vertex.x} ${this.vertex.y} ${this.vertex.z}`;\n if (colors !== void 0 && colors instanceof three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute) {\n this.color.fromBufferAttribute(colors, i2);\n this.output += ` ${this.color.r} ${this.color.g} ${this.color.b}`;\n }\n this.output += \"\\n\";\n }\n }\n this.output += \"p \";\n for (let j = 1, l = vertices.count; j <= l; j++) {\n this.output += `${this.indexVertex + j} `;\n }\n this.output += \"\\n\";\n this.indexVertex += nbVertex;\n }\n}\nfunction RoomEnvironment() {\n const scene = new three__WEBPACK_IMPORTED_MODULE_42__.Scene();\n const geometry2 = new three__WEBPACK_IMPORTED_MODULE_42__.BoxGeometry();\n geometry2.deleteAttribute(\"uv\");\n const roomMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.MeshStandardMaterial({ side: three__WEBPACK_IMPORTED_MODULE_42__.BackSide });\n const boxMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.MeshStandardMaterial();\n const mainLight = new three__WEBPACK_IMPORTED_MODULE_42__.PointLight(16777215, 5, 28, 2);\n mainLight.position.set(0.418, 16.199, 0.3);\n scene.add(mainLight);\n const room = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(geometry2, roomMaterial);\n room.position.set(-0.757, 13.219, 0.717);\n room.scale.set(31.713, 28.305, 28.591);\n scene.add(room);\n const box1 = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(geometry2, boxMaterial);\n box1.position.set(-10.906, 2.009, 1.846);\n box1.rotation.set(0, -0.195, 0);\n box1.scale.set(2.328, 7.905, 4.651);\n scene.add(box1);\n const box2 = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(geometry2, boxMaterial);\n box2.position.set(-5.607, -0.754, -0.758);\n box2.rotation.set(0, 0.994, 0);\n box2.scale.set(1.97, 1.534, 3.955);\n scene.add(box2);\n const box3 = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(geometry2, boxMaterial);\n box3.position.set(6.167, 0.857, 7.803);\n box3.rotation.set(0, 0.561, 0);\n box3.scale.set(3.927, 6.285, 3.687);\n scene.add(box3);\n const box4 = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(geometry2, boxMaterial);\n box4.position.set(-2.017, 0.018, 6.124);\n box4.rotation.set(0, 0.333, 0);\n box4.scale.set(2.002, 4.566, 2.064);\n scene.add(box4);\n const box5 = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(geometry2, boxMaterial);\n box5.position.set(2.291, -0.756, -2.621);\n box5.rotation.set(0, -0.286, 0);\n box5.scale.set(1.546, 1.552, 1.496);\n scene.add(box5);\n const box6 = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(geometry2, boxMaterial);\n box6.position.set(-2.193, -0.369, -5.547);\n box6.rotation.set(0, 0.516, 0);\n box6.scale.set(3.875, 3.487, 2.986);\n scene.add(box6);\n const light1 = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(geometry2, createAreaLightMaterial(50));\n light1.position.set(-16.116, 14.37, 8.208);\n light1.scale.set(0.1, 2.428, 2.739);\n scene.add(light1);\n const light2 = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(geometry2, createAreaLightMaterial(50));\n light2.position.set(-16.109, 18.021, -8.207);\n light2.scale.set(0.1, 2.425, 2.751);\n scene.add(light2);\n const light3 = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(geometry2, createAreaLightMaterial(17));\n light3.position.set(14.904, 12.198, -1.832);\n light3.scale.set(0.15, 4.265, 6.331);\n scene.add(light3);\n const light4 = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(geometry2, createAreaLightMaterial(43));\n light4.position.set(-0.462, 8.89, 14.52);\n light4.scale.set(4.38, 5.441, 0.088);\n scene.add(light4);\n const light5 = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(geometry2, createAreaLightMaterial(20));\n light5.position.set(3.235, 11.486, -12.541);\n light5.scale.set(2.5, 2, 0.1);\n scene.add(light5);\n const light6 = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(geometry2, createAreaLightMaterial(100));\n light6.position.set(0, 20, 0);\n light6.scale.set(1, 0.1, 1);\n scene.add(light6);\n function createAreaLightMaterial(intensity) {\n const material2 = new three__WEBPACK_IMPORTED_MODULE_42__.MeshBasicMaterial();\n material2.color.setScalar(intensity);\n return material2;\n }\n return scene;\n}\nclass AnimationClipCreator {\n static CreateRotationAnimation(period, axis = \"x\") {\n const times = [0, period], values = [0, 360];\n const trackName = \".rotation[\" + axis + \"]\";\n const track = new three__WEBPACK_IMPORTED_MODULE_42__.NumberKeyframeTrack(trackName, times, values);\n return new three__WEBPACK_IMPORTED_MODULE_42__.AnimationClip(null, period, [track]);\n }\n static CreateScaleAxisAnimation(period, axis = \"x\") {\n const times = [0, period], values = [0, 1];\n const trackName = \".scale[\" + axis + \"]\";\n const track = new three__WEBPACK_IMPORTED_MODULE_42__.NumberKeyframeTrack(trackName, times, values);\n return new three__WEBPACK_IMPORTED_MODULE_42__.AnimationClip(null, period, [track]);\n }\n static CreateShakeAnimation(duration, shakeScale) {\n const times = [], values = [], tmp = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n for (let i2 = 0; i2 < duration * 10; i2++) {\n times.push(i2 / 10);\n tmp.set(Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1).multiply(shakeScale).toArray(values, values.length);\n }\n const trackName = \".position\";\n const track = new three__WEBPACK_IMPORTED_MODULE_42__.VectorKeyframeTrack(trackName, times, values);\n return new three__WEBPACK_IMPORTED_MODULE_42__.AnimationClip(null, duration, [track]);\n }\n static CreatePulsationAnimation(duration, pulseScale) {\n const times = [], values = [], tmp = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n for (let i2 = 0; i2 < duration * 10; i2++) {\n times.push(i2 / 10);\n const scaleFactor = Math.random() * pulseScale;\n tmp.set(scaleFactor, scaleFactor, scaleFactor).toArray(values, values.length);\n }\n const trackName = \".scale\";\n const track = new three__WEBPACK_IMPORTED_MODULE_42__.VectorKeyframeTrack(trackName, times, values);\n return new three__WEBPACK_IMPORTED_MODULE_42__.AnimationClip(null, duration, [track]);\n }\n static CreateVisibilityAnimation(duration) {\n const times = [0, duration / 2, duration], values = [true, false, true];\n const trackName = \".visible\";\n const track = new three__WEBPACK_IMPORTED_MODULE_42__.BooleanKeyframeTrack(trackName, times, values);\n return new three__WEBPACK_IMPORTED_MODULE_42__.AnimationClip(null, duration, [track]);\n }\n static CreateMaterialColorAnimation(duration, colors) {\n const times = [], values = [], timeStep = duration / colors.length;\n for (let i2 = 0; i2 < colors.length; i2++) {\n times.push(i2 * timeStep);\n const color = colors[i2];\n values.push(color.r, color.g, color.b);\n }\n const trackName = \".material.color\";\n const track = new three__WEBPACK_IMPORTED_MODULE_42__.ColorKeyframeTrack(trackName, times, values);\n return new three__WEBPACK_IMPORTED_MODULE_42__.AnimationClip(null, duration, [track]);\n }\n}\nconst _q$2 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion();\nconst _targetPos = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst _targetVec = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst _effectorPos = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst _effectorVec = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst _linkPos = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst _invLinkQ = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion();\nconst _linkScale = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst _axis = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst _vector$3 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst _matrix$1 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\nclass CCDIKSolver {\n /**\n * @param {THREE.SkinnedMesh} mesh\n * @param {Array} iks\n */\n constructor(mesh, iks = []) {\n this.mesh = mesh;\n this.iks = iks;\n this._valid();\n }\n /**\n * Update all IK bones.\n *\n * @return {CCDIKSolver}\n */\n update() {\n const iks = this.iks;\n for (let i2 = 0, il = iks.length; i2 < il; i2++) {\n this.updateOne(iks[i2]);\n }\n return this;\n }\n /**\n * Update one IK bone\n *\n * @param {Object} ik parameter\n * @return {CCDIKSolver}\n */\n updateOne(ik) {\n const bones = this.mesh.skeleton.bones;\n const math = Math;\n const effector = bones[ik.effector];\n const target = bones[ik.target];\n _targetPos.setFromMatrixPosition(target.matrixWorld);\n const links = ik.links;\n const iteration = ik.iteration !== void 0 ? ik.iteration : 1;\n for (let i2 = 0; i2 < iteration; i2++) {\n let rotated = false;\n for (let j = 0, jl = links.length; j < jl; j++) {\n const link = bones[links[j].index];\n if (links[j].enabled === false)\n break;\n const limitation = links[j].limitation;\n const rotationMin = links[j].rotationMin;\n const rotationMax = links[j].rotationMax;\n link.matrixWorld.decompose(_linkPos, _invLinkQ, _linkScale);\n _invLinkQ.invert();\n _effectorPos.setFromMatrixPosition(effector.matrixWorld);\n _effectorVec.subVectors(_effectorPos, _linkPos);\n _effectorVec.applyQuaternion(_invLinkQ);\n _effectorVec.normalize();\n _targetVec.subVectors(_targetPos, _linkPos);\n _targetVec.applyQuaternion(_invLinkQ);\n _targetVec.normalize();\n let angle = _targetVec.dot(_effectorVec);\n if (angle > 1) {\n angle = 1;\n } else if (angle < -1) {\n angle = -1;\n }\n angle = math.acos(angle);\n if (angle < 1e-5)\n continue;\n if (ik.minAngle !== void 0 && angle < ik.minAngle) {\n angle = ik.minAngle;\n }\n if (ik.maxAngle !== void 0 && angle > ik.maxAngle) {\n angle = ik.maxAngle;\n }\n _axis.crossVectors(_effectorVec, _targetVec);\n _axis.normalize();\n _q$2.setFromAxisAngle(_axis, angle);\n link.quaternion.multiply(_q$2);\n if (limitation !== void 0) {\n let c = link.quaternion.w;\n if (c > 1)\n c = 1;\n const c2 = math.sqrt(1 - c * c);\n link.quaternion.set(limitation.x * c2, limitation.y * c2, limitation.z * c2, c);\n }\n if (rotationMin !== void 0) {\n link.rotation.setFromVector3(_vector$3.setFromEuler(link.rotation).max(rotationMin));\n }\n if (rotationMax !== void 0) {\n link.rotation.setFromVector3(_vector$3.setFromEuler(link.rotation).min(rotationMax));\n }\n link.updateMatrixWorld(true);\n rotated = true;\n }\n if (!rotated)\n break;\n }\n return this;\n }\n /**\n * Creates Helper\n *\n * @return {CCDIKHelper}\n */\n createHelper() {\n return new CCDIKHelper(this.mesh, this.iks);\n }\n // private methods\n _valid() {\n const iks = this.iks;\n const bones = this.mesh.skeleton.bones;\n for (let i2 = 0, il = iks.length; i2 < il; i2++) {\n const ik = iks[i2];\n const effector = bones[ik.effector];\n const links = ik.links;\n let link0, link1;\n link0 = effector;\n for (let j = 0, jl = links.length; j < jl; j++) {\n link1 = bones[links[j].index];\n if (link0.parent !== link1) {\n console.warn(\"THREE.CCDIKSolver: bone \" + link0.name + \" is not the child of bone \" + link1.name);\n }\n link0 = link1;\n }\n }\n }\n}\nfunction getPosition(bone, matrixWorldInv) {\n return _vector$3.setFromMatrixPosition(bone.matrixWorld).applyMatrix4(matrixWorldInv);\n}\nfunction setPositionOfBoneToAttributeArray(array, index, bone, matrixWorldInv) {\n const v = getPosition(bone, matrixWorldInv);\n array[index * 3 + 0] = v.x;\n array[index * 3 + 1] = v.y;\n array[index * 3 + 2] = v.z;\n}\nclass CCDIKHelper extends three__WEBPACK_IMPORTED_MODULE_42__.Object3D {\n constructor(mesh, iks = [], sphereSize = 0.25) {\n super();\n this.root = mesh;\n this.iks = iks;\n this.matrix.copy(mesh.matrixWorld);\n this.matrixAutoUpdate = false;\n this.sphereGeometry = new three__WEBPACK_IMPORTED_MODULE_42__.SphereGeometry(sphereSize, 16, 8);\n this.targetSphereMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.MeshBasicMaterial({\n color: new three__WEBPACK_IMPORTED_MODULE_42__.Color(16746632),\n depthTest: false,\n depthWrite: false,\n transparent: true\n });\n this.effectorSphereMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.MeshBasicMaterial({\n color: new three__WEBPACK_IMPORTED_MODULE_42__.Color(8978312),\n depthTest: false,\n depthWrite: false,\n transparent: true\n });\n this.linkSphereMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.MeshBasicMaterial({\n color: new three__WEBPACK_IMPORTED_MODULE_42__.Color(8947967),\n depthTest: false,\n depthWrite: false,\n transparent: true\n });\n this.lineMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.LineBasicMaterial({\n color: new three__WEBPACK_IMPORTED_MODULE_42__.Color(16711680),\n depthTest: false,\n depthWrite: false,\n transparent: true\n });\n this._init();\n }\n /**\n * Updates IK bones visualization.\n */\n updateMatrixWorld(force) {\n const mesh = this.root;\n if (this.visible) {\n let offset = 0;\n const iks = this.iks;\n const bones = mesh.skeleton.bones;\n _matrix$1.copy(mesh.matrixWorld).invert();\n for (let i2 = 0, il = iks.length; i2 < il; i2++) {\n const ik = iks[i2];\n const targetBone = bones[ik.target];\n const effectorBone = bones[ik.effector];\n const targetMesh = this.children[offset++];\n const effectorMesh = this.children[offset++];\n targetMesh.position.copy(getPosition(targetBone, _matrix$1));\n effectorMesh.position.copy(getPosition(effectorBone, _matrix$1));\n for (let j = 0, jl = ik.links.length; j < jl; j++) {\n const link = ik.links[j];\n const linkBone = bones[link.index];\n const linkMesh = this.children[offset++];\n linkMesh.position.copy(getPosition(linkBone, _matrix$1));\n }\n const line = this.children[offset++];\n const array = line.geometry.attributes.position.array;\n setPositionOfBoneToAttributeArray(array, 0, targetBone, _matrix$1);\n setPositionOfBoneToAttributeArray(array, 1, effectorBone, _matrix$1);\n for (let j = 0, jl = ik.links.length; j < jl; j++) {\n const link = ik.links[j];\n const linkBone = bones[link.index];\n setPositionOfBoneToAttributeArray(array, j + 2, linkBone, _matrix$1);\n }\n line.geometry.attributes.position.needsUpdate = true;\n }\n }\n this.matrix.copy(mesh.matrixWorld);\n super.updateMatrixWorld(force);\n }\n /**\n * Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app.\n */\n dispose() {\n this.sphereGeometry.dispose();\n this.targetSphereMaterial.dispose();\n this.effectorSphereMaterial.dispose();\n this.linkSphereMaterial.dispose();\n this.lineMaterial.dispose();\n const children = this.children;\n for (let i2 = 0; i2 < children.length; i2++) {\n const child = children[i2];\n if (child.isLine)\n child.geometry.dispose();\n }\n }\n // private method\n _init() {\n const scope = this;\n const iks = this.iks;\n function createLineGeometry(ik) {\n const geometry2 = new three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry();\n const vertices = new Float32Array((2 + ik.links.length) * 3);\n geometry2.setAttribute(\"position\", new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(vertices, 3));\n return geometry2;\n }\n function createTargetMesh() {\n return new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(scope.sphereGeometry, scope.targetSphereMaterial);\n }\n function createEffectorMesh() {\n return new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(scope.sphereGeometry, scope.effectorSphereMaterial);\n }\n function createLinkMesh() {\n return new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(scope.sphereGeometry, scope.linkSphereMaterial);\n }\n function createLine(ik) {\n return new three__WEBPACK_IMPORTED_MODULE_42__.Line(createLineGeometry(ik), scope.lineMaterial);\n }\n for (let i2 = 0, il = iks.length; i2 < il; i2++) {\n const ik = iks[i2];\n this.add(createTargetMesh());\n this.add(createEffectorMesh());\n for (let j = 0, jl = ik.links.length; j < jl; j++) {\n this.add(createLinkMesh());\n }\n this.add(createLine(ik));\n }\n }\n}\nclass CapsuleGeometry extends three__WEBPACK_IMPORTED_MODULE_42__.LatheGeometry {\n constructor(radius = 1, length = 1, capSegments = 4, radialSegments = 8) {\n const path = new three__WEBPACK_IMPORTED_MODULE_42__.Path();\n path.absarc(0, -length / 2, radius, Math.PI * 1.5, 0);\n path.absarc(0, length / 2, radius, 0, Math.PI * 0.5);\n super(path.getPoints(capSegments), radialSegments);\n this.type = \"CapsuleGeometry\";\n this.parameters = {\n radius,\n height: length,\n capSegments,\n radialSegments\n };\n }\n static fromJSON(data) {\n return new CapsuleGeometry(data.radius, data.length, data.capSegments, data.radialSegments);\n }\n}\nclass MMDPhysics {\n /**\n * @param {THREE.SkinnedMesh} mesh\n * @param {Array} rigidBodyParams\n * @param {Array} (optional) constraintParams\n * @param {Object} params - (optional)\n * @param {Number} params.unitStep - Default is 1 / 65.\n * @param {Integer} params.maxStepNum - Default is 3.\n * @param {Vector3} params.gravity - Default is ( 0, - 9.8 * 10, 0 )\n */\n constructor(mesh, rigidBodyParams, constraintParams = [], params = {}) {\n if (typeof Ammo === \"undefined\") {\n throw new Error(\"THREE.MMDPhysics: Import ammo.js https://github.com/kripken/ammo.js\");\n }\n this.manager = new ResourceManager();\n this.mesh = mesh;\n this.unitStep = params.unitStep !== void 0 ? params.unitStep : 1 / 65;\n this.maxStepNum = params.maxStepNum !== void 0 ? params.maxStepNum : 3;\n this.gravity = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, -9.8 * 10, 0);\n if (params.gravity !== void 0)\n this.gravity.copy(params.gravity);\n this.world = params.world !== void 0 ? params.world : null;\n this.bodies = [];\n this.constraints = [];\n this._init(mesh, rigidBodyParams, constraintParams);\n }\n /**\n * Advances Physics calculation and updates bones.\n *\n * @param {Number} delta - time in second\n * @return {MMDPhysics}\n */\n update(delta) {\n const manager = this.manager;\n const mesh = this.mesh;\n let isNonDefaultScale = false;\n const position = manager.allocThreeVector3();\n const quaternion = manager.allocThreeQuaternion();\n const scale = manager.allocThreeVector3();\n mesh.matrixWorld.decompose(position, quaternion, scale);\n if (scale.x !== 1 || scale.y !== 1 || scale.z !== 1) {\n isNonDefaultScale = true;\n }\n let parent;\n if (isNonDefaultScale) {\n parent = mesh.parent;\n if (parent !== null)\n mesh.parent = null;\n scale.copy(this.mesh.scale);\n mesh.scale.set(1, 1, 1);\n mesh.updateMatrixWorld(true);\n }\n this._updateRigidBodies();\n this._stepSimulation(delta);\n this._updateBones();\n if (isNonDefaultScale) {\n if (parent !== null)\n mesh.parent = parent;\n mesh.scale.copy(scale);\n }\n manager.freeThreeVector3(scale);\n manager.freeThreeQuaternion(quaternion);\n manager.freeThreeVector3(position);\n return this;\n }\n /**\n * Resets rigid bodies transorm to current bone's.\n *\n * @return {MMDPhysics}\n */\n reset() {\n for (let i2 = 0, il = this.bodies.length; i2 < il; i2++) {\n this.bodies[i2].reset();\n }\n return this;\n }\n /**\n * Warm ups Rigid bodies. Calculates cycles steps.\n *\n * @param {Integer} cycles\n * @return {MMDPhysics}\n */\n warmup(cycles) {\n for (let i2 = 0; i2 < cycles; i2++) {\n this.update(1 / 60);\n }\n return this;\n }\n /**\n * Sets gravity.\n *\n * @param {Vector3} gravity\n * @return {MMDPhysicsHelper}\n */\n setGravity(gravity) {\n this.world.setGravity(new Ammo.btVector3(gravity.x, gravity.y, gravity.z));\n this.gravity.copy(gravity);\n return this;\n }\n /**\n * Creates MMDPhysicsHelper\n *\n * @return {MMDPhysicsHelper}\n */\n createHelper() {\n return new MMDPhysicsHelper(this.mesh, this);\n }\n // private methods\n _init(mesh, rigidBodyParams, constraintParams) {\n const manager = this.manager;\n const parent = mesh.parent;\n if (parent !== null)\n mesh.parent = null;\n const currentPosition = manager.allocThreeVector3();\n const currentQuaternion = manager.allocThreeQuaternion();\n const currentScale = manager.allocThreeVector3();\n currentPosition.copy(mesh.position);\n currentQuaternion.copy(mesh.quaternion);\n currentScale.copy(mesh.scale);\n mesh.position.set(0, 0, 0);\n mesh.quaternion.set(0, 0, 0, 1);\n mesh.scale.set(1, 1, 1);\n mesh.updateMatrixWorld(true);\n if (this.world === null) {\n this.world = this._createWorld();\n this.setGravity(this.gravity);\n }\n this._initRigidBodies(rigidBodyParams);\n this._initConstraints(constraintParams);\n if (parent !== null)\n mesh.parent = parent;\n mesh.position.copy(currentPosition);\n mesh.quaternion.copy(currentQuaternion);\n mesh.scale.copy(currentScale);\n mesh.updateMatrixWorld(true);\n this.reset();\n manager.freeThreeVector3(currentPosition);\n manager.freeThreeQuaternion(currentQuaternion);\n manager.freeThreeVector3(currentScale);\n }\n _createWorld() {\n const config = new Ammo.btDefaultCollisionConfiguration();\n const dispatcher = new Ammo.btCollisionDispatcher(config);\n const cache = new Ammo.btDbvtBroadphase();\n const solver = new Ammo.btSequentialImpulseConstraintSolver();\n const world2 = new Ammo.btDiscreteDynamicsWorld(dispatcher, cache, solver, config);\n return world2;\n }\n _initRigidBodies(rigidBodies) {\n for (let i2 = 0, il = rigidBodies.length; i2 < il; i2++) {\n this.bodies.push(new RigidBody(this.mesh, this.world, rigidBodies[i2], this.manager));\n }\n }\n _initConstraints(constraints) {\n for (let i2 = 0, il = constraints.length; i2 < il; i2++) {\n const params = constraints[i2];\n const bodyA = this.bodies[params.rigidBodyIndex1];\n const bodyB = this.bodies[params.rigidBodyIndex2];\n this.constraints.push(new Constraint(this.mesh, this.world, bodyA, bodyB, params, this.manager));\n }\n }\n _stepSimulation(delta) {\n const unitStep = this.unitStep;\n let stepTime = delta;\n let maxStepNum = (delta / unitStep | 0) + 1;\n if (stepTime < unitStep) {\n stepTime = unitStep;\n maxStepNum = 1;\n }\n if (maxStepNum > this.maxStepNum) {\n maxStepNum = this.maxStepNum;\n }\n this.world.stepSimulation(stepTime, maxStepNum, unitStep);\n }\n _updateRigidBodies() {\n for (let i2 = 0, il = this.bodies.length; i2 < il; i2++) {\n this.bodies[i2].updateFromBone();\n }\n }\n _updateBones() {\n for (let i2 = 0, il = this.bodies.length; i2 < il; i2++) {\n this.bodies[i2].updateBone();\n }\n }\n}\nclass ResourceManager {\n constructor() {\n this.threeVector3s = [];\n this.threeMatrix4s = [];\n this.threeQuaternions = [];\n this.threeEulers = [];\n this.transforms = [];\n this.quaternions = [];\n this.vector3s = [];\n }\n allocThreeVector3() {\n return this.threeVector3s.length > 0 ? this.threeVector3s.pop() : new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n }\n freeThreeVector3(v) {\n this.threeVector3s.push(v);\n }\n allocThreeMatrix4() {\n return this.threeMatrix4s.length > 0 ? this.threeMatrix4s.pop() : new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n }\n freeThreeMatrix4(m) {\n this.threeMatrix4s.push(m);\n }\n allocThreeQuaternion() {\n return this.threeQuaternions.length > 0 ? this.threeQuaternions.pop() : new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion();\n }\n freeThreeQuaternion(q) {\n this.threeQuaternions.push(q);\n }\n allocThreeEuler() {\n return this.threeEulers.length > 0 ? this.threeEulers.pop() : new three__WEBPACK_IMPORTED_MODULE_42__.Euler();\n }\n freeThreeEuler(e) {\n this.threeEulers.push(e);\n }\n allocTransform() {\n return this.transforms.length > 0 ? this.transforms.pop() : new Ammo.btTransform();\n }\n freeTransform(t2) {\n this.transforms.push(t2);\n }\n allocQuaternion() {\n return this.quaternions.length > 0 ? this.quaternions.pop() : new Ammo.btQuaternion();\n }\n freeQuaternion(q) {\n this.quaternions.push(q);\n }\n allocVector3() {\n return this.vector3s.length > 0 ? this.vector3s.pop() : new Ammo.btVector3();\n }\n freeVector3(v) {\n this.vector3s.push(v);\n }\n setIdentity(t2) {\n t2.setIdentity();\n }\n getBasis(t2) {\n var q = this.allocQuaternion();\n t2.getBasis().getRotation(q);\n return q;\n }\n getBasisAsMatrix3(t2) {\n var q = this.getBasis(t2);\n var m = this.quaternionToMatrix3(q);\n this.freeQuaternion(q);\n return m;\n }\n getOrigin(t2) {\n return t2.getOrigin();\n }\n setOrigin(t2, v) {\n t2.getOrigin().setValue(v.x(), v.y(), v.z());\n }\n copyOrigin(t1, t2) {\n var o = t2.getOrigin();\n this.setOrigin(t1, o);\n }\n setBasis(t2, q) {\n t2.setRotation(q);\n }\n setBasisFromMatrix3(t2, m) {\n var q = this.matrix3ToQuaternion(m);\n this.setBasis(t2, q);\n this.freeQuaternion(q);\n }\n setOriginFromArray3(t2, a2) {\n t2.getOrigin().setValue(a2[0], a2[1], a2[2]);\n }\n setOriginFromThreeVector3(t2, v) {\n t2.getOrigin().setValue(v.x, v.y, v.z);\n }\n setBasisFromArray3(t2, a2) {\n var thQ = this.allocThreeQuaternion();\n var thE = this.allocThreeEuler();\n thE.set(a2[0], a2[1], a2[2]);\n this.setBasisFromThreeQuaternion(t2, thQ.setFromEuler(thE));\n this.freeThreeEuler(thE);\n this.freeThreeQuaternion(thQ);\n }\n setBasisFromThreeQuaternion(t2, a2) {\n var q = this.allocQuaternion();\n q.setX(a2.x);\n q.setY(a2.y);\n q.setZ(a2.z);\n q.setW(a2.w);\n this.setBasis(t2, q);\n this.freeQuaternion(q);\n }\n multiplyTransforms(t1, t2) {\n var t3 = this.allocTransform();\n this.setIdentity(t3);\n var m1 = this.getBasisAsMatrix3(t1);\n var m2 = this.getBasisAsMatrix3(t2);\n var o1 = this.getOrigin(t1);\n var o2 = this.getOrigin(t2);\n var v12 = this.multiplyMatrix3ByVector3(m1, o2);\n var v2 = this.addVector3(v12, o1);\n this.setOrigin(t3, v2);\n var m3 = this.multiplyMatrices3(m1, m2);\n this.setBasisFromMatrix3(t3, m3);\n this.freeVector3(v12);\n this.freeVector3(v2);\n return t3;\n }\n inverseTransform(t2) {\n var t22 = this.allocTransform();\n var m1 = this.getBasisAsMatrix3(t2);\n var o = this.getOrigin(t2);\n var m2 = this.transposeMatrix3(m1);\n var v12 = this.negativeVector3(o);\n var v2 = this.multiplyMatrix3ByVector3(m2, v12);\n this.setOrigin(t22, v2);\n this.setBasisFromMatrix3(t22, m2);\n this.freeVector3(v12);\n this.freeVector3(v2);\n return t22;\n }\n multiplyMatrices3(m1, m2) {\n var m3 = [];\n var v10 = this.rowOfMatrix3(m1, 0);\n var v11 = this.rowOfMatrix3(m1, 1);\n var v12 = this.rowOfMatrix3(m1, 2);\n var v20 = this.columnOfMatrix3(m2, 0);\n var v21 = this.columnOfMatrix3(m2, 1);\n var v22 = this.columnOfMatrix3(m2, 2);\n m3[0] = this.dotVectors3(v10, v20);\n m3[1] = this.dotVectors3(v10, v21);\n m3[2] = this.dotVectors3(v10, v22);\n m3[3] = this.dotVectors3(v11, v20);\n m3[4] = this.dotVectors3(v11, v21);\n m3[5] = this.dotVectors3(v11, v22);\n m3[6] = this.dotVectors3(v12, v20);\n m3[7] = this.dotVectors3(v12, v21);\n m3[8] = this.dotVectors3(v12, v22);\n this.freeVector3(v10);\n this.freeVector3(v11);\n this.freeVector3(v12);\n this.freeVector3(v20);\n this.freeVector3(v21);\n this.freeVector3(v22);\n return m3;\n }\n addVector3(v12, v2) {\n var v = this.allocVector3();\n v.setValue(v12.x() + v2.x(), v12.y() + v2.y(), v12.z() + v2.z());\n return v;\n }\n dotVectors3(v12, v2) {\n return v12.x() * v2.x() + v12.y() * v2.y() + v12.z() * v2.z();\n }\n rowOfMatrix3(m, i2) {\n var v = this.allocVector3();\n v.setValue(m[i2 * 3 + 0], m[i2 * 3 + 1], m[i2 * 3 + 2]);\n return v;\n }\n columnOfMatrix3(m, i2) {\n var v = this.allocVector3();\n v.setValue(m[i2 + 0], m[i2 + 3], m[i2 + 6]);\n return v;\n }\n negativeVector3(v) {\n var v2 = this.allocVector3();\n v2.setValue(-v.x(), -v.y(), -v.z());\n return v2;\n }\n multiplyMatrix3ByVector3(m, v) {\n var v4 = this.allocVector3();\n var v0 = this.rowOfMatrix3(m, 0);\n var v12 = this.rowOfMatrix3(m, 1);\n var v2 = this.rowOfMatrix3(m, 2);\n var x = this.dotVectors3(v0, v);\n var y = this.dotVectors3(v12, v);\n var z = this.dotVectors3(v2, v);\n v4.setValue(x, y, z);\n this.freeVector3(v0);\n this.freeVector3(v12);\n this.freeVector3(v2);\n return v4;\n }\n transposeMatrix3(m) {\n var m2 = [];\n m2[0] = m[0];\n m2[1] = m[3];\n m2[2] = m[6];\n m2[3] = m[1];\n m2[4] = m[4];\n m2[5] = m[7];\n m2[6] = m[2];\n m2[7] = m[5];\n m2[8] = m[8];\n return m2;\n }\n quaternionToMatrix3(q) {\n var m = [];\n var x = q.x();\n var y = q.y();\n var z = q.z();\n var w = q.w();\n var xx = x * x;\n var yy = y * y;\n var zz = z * z;\n var xy = x * y;\n var yz = y * z;\n var zx = z * x;\n var xw = x * w;\n var yw = y * w;\n var zw = z * w;\n m[0] = 1 - 2 * (yy + zz);\n m[1] = 2 * (xy - zw);\n m[2] = 2 * (zx + yw);\n m[3] = 2 * (xy + zw);\n m[4] = 1 - 2 * (zz + xx);\n m[5] = 2 * (yz - xw);\n m[6] = 2 * (zx - yw);\n m[7] = 2 * (yz + xw);\n m[8] = 1 - 2 * (xx + yy);\n return m;\n }\n matrix3ToQuaternion(m) {\n var t2 = m[0] + m[4] + m[8];\n var s, x, y, z, w;\n if (t2 > 0) {\n s = Math.sqrt(t2 + 1) * 2;\n w = 0.25 * s;\n x = (m[7] - m[5]) / s;\n y = (m[2] - m[6]) / s;\n z = (m[3] - m[1]) / s;\n } else if (m[0] > m[4] && m[0] > m[8]) {\n s = Math.sqrt(1 + m[0] - m[4] - m[8]) * 2;\n w = (m[7] - m[5]) / s;\n x = 0.25 * s;\n y = (m[1] + m[3]) / s;\n z = (m[2] + m[6]) / s;\n } else if (m[4] > m[8]) {\n s = Math.sqrt(1 + m[4] - m[0] - m[8]) * 2;\n w = (m[2] - m[6]) / s;\n x = (m[1] + m[3]) / s;\n y = 0.25 * s;\n z = (m[5] + m[7]) / s;\n } else {\n s = Math.sqrt(1 + m[8] - m[0] - m[4]) * 2;\n w = (m[3] - m[1]) / s;\n x = (m[2] + m[6]) / s;\n y = (m[5] + m[7]) / s;\n z = 0.25 * s;\n }\n var q = this.allocQuaternion();\n q.setX(x);\n q.setY(y);\n q.setZ(z);\n q.setW(w);\n return q;\n }\n}\nclass RigidBody {\n constructor(mesh, world2, params, manager) {\n this.mesh = mesh;\n this.world = world2;\n this.params = params;\n this.manager = manager;\n this.body = null;\n this.bone = null;\n this.boneOffsetForm = null;\n this.boneOffsetFormInverse = null;\n this._init();\n }\n /**\n * Resets rigid body transform to the current bone's.\n *\n * @return {RigidBody}\n */\n reset() {\n this._setTransformFromBone();\n return this;\n }\n /**\n * Updates rigid body's transform from the current bone.\n *\n * @return {RidigBody}\n */\n updateFromBone() {\n if (this.params.boneIndex !== -1 && this.params.type === 0) {\n this._setTransformFromBone();\n }\n return this;\n }\n /**\n * Updates bone from the current ridid body's transform.\n *\n * @return {RidigBody}\n */\n updateBone() {\n if (this.params.type === 0 || this.params.boneIndex === -1) {\n return this;\n }\n this._updateBoneRotation();\n if (this.params.type === 1) {\n this._updateBonePosition();\n }\n this.bone.updateMatrixWorld(true);\n if (this.params.type === 2) {\n this._setPositionFromBone();\n }\n return this;\n }\n // private methods\n _init() {\n function generateShape(p) {\n switch (p.shapeType) {\n case 0:\n return new Ammo.btSphereShape(p.width);\n case 1:\n return new Ammo.btBoxShape(new Ammo.btVector3(p.width, p.height, p.depth));\n case 2:\n return new Ammo.btCapsuleShape(p.width, p.height);\n default:\n throw new Error(\"unknown shape type \" + p.shapeType);\n }\n }\n const manager = this.manager;\n const params = this.params;\n const bones = this.mesh.skeleton.bones;\n const bone = params.boneIndex === -1 ? new three__WEBPACK_IMPORTED_MODULE_42__.Bone() : bones[params.boneIndex];\n const shape = generateShape(params);\n const weight = params.type === 0 ? 0 : params.weight;\n const localInertia = manager.allocVector3();\n localInertia.setValue(0, 0, 0);\n if (weight !== 0) {\n shape.calculateLocalInertia(weight, localInertia);\n }\n const boneOffsetForm = manager.allocTransform();\n manager.setIdentity(boneOffsetForm);\n manager.setOriginFromArray3(boneOffsetForm, params.position);\n manager.setBasisFromArray3(boneOffsetForm, params.rotation);\n const vector = manager.allocThreeVector3();\n const boneForm = manager.allocTransform();\n manager.setIdentity(boneForm);\n manager.setOriginFromThreeVector3(boneForm, bone.getWorldPosition(vector));\n const form = manager.multiplyTransforms(boneForm, boneOffsetForm);\n const state = new Ammo.btDefaultMotionState(form);\n const info = new Ammo.btRigidBodyConstructionInfo(weight, state, shape, localInertia);\n info.set_m_friction(params.friction);\n info.set_m_restitution(params.restitution);\n const body = new Ammo.btRigidBody(info);\n if (params.type === 0) {\n body.setCollisionFlags(body.getCollisionFlags() | 2);\n body.setActivationState(4);\n }\n body.setDamping(params.positionDamping, params.rotationDamping);\n body.setSleepingThresholds(0, 0);\n this.world.addRigidBody(body, 1 << params.groupIndex, params.groupTarget);\n this.body = body;\n this.bone = bone;\n this.boneOffsetForm = boneOffsetForm;\n this.boneOffsetFormInverse = manager.inverseTransform(boneOffsetForm);\n manager.freeVector3(localInertia);\n manager.freeTransform(form);\n manager.freeTransform(boneForm);\n manager.freeThreeVector3(vector);\n }\n _getBoneTransform() {\n const manager = this.manager;\n const p = manager.allocThreeVector3();\n const q = manager.allocThreeQuaternion();\n const s = manager.allocThreeVector3();\n this.bone.matrixWorld.decompose(p, q, s);\n const tr = manager.allocTransform();\n manager.setOriginFromThreeVector3(tr, p);\n manager.setBasisFromThreeQuaternion(tr, q);\n const form = manager.multiplyTransforms(tr, this.boneOffsetForm);\n manager.freeTransform(tr);\n manager.freeThreeVector3(s);\n manager.freeThreeQuaternion(q);\n manager.freeThreeVector3(p);\n return form;\n }\n _getWorldTransformForBone() {\n const manager = this.manager;\n const tr = this.body.getCenterOfMassTransform();\n return manager.multiplyTransforms(tr, this.boneOffsetFormInverse);\n }\n _setTransformFromBone() {\n const manager = this.manager;\n const form = this._getBoneTransform();\n this.body.setCenterOfMassTransform(form);\n this.body.getMotionState().setWorldTransform(form);\n manager.freeTransform(form);\n }\n _setPositionFromBone() {\n const manager = this.manager;\n const form = this._getBoneTransform();\n const tr = manager.allocTransform();\n this.body.getMotionState().getWorldTransform(tr);\n manager.copyOrigin(tr, form);\n this.body.setCenterOfMassTransform(tr);\n this.body.getMotionState().setWorldTransform(tr);\n manager.freeTransform(tr);\n manager.freeTransform(form);\n }\n _updateBoneRotation() {\n const manager = this.manager;\n const tr = this._getWorldTransformForBone();\n const q = manager.getBasis(tr);\n const thQ = manager.allocThreeQuaternion();\n const thQ2 = manager.allocThreeQuaternion();\n const thQ3 = manager.allocThreeQuaternion();\n thQ.set(q.x(), q.y(), q.z(), q.w());\n thQ2.setFromRotationMatrix(this.bone.matrixWorld);\n thQ2.conjugate();\n thQ2.multiply(thQ);\n thQ3.setFromRotationMatrix(this.bone.matrix);\n this.bone.quaternion.copy(thQ2.multiply(thQ3).normalize());\n manager.freeThreeQuaternion(thQ);\n manager.freeThreeQuaternion(thQ2);\n manager.freeThreeQuaternion(thQ3);\n manager.freeQuaternion(q);\n manager.freeTransform(tr);\n }\n _updateBonePosition() {\n const manager = this.manager;\n const tr = this._getWorldTransformForBone();\n const thV = manager.allocThreeVector3();\n const o = manager.getOrigin(tr);\n thV.set(o.x(), o.y(), o.z());\n if (this.bone.parent) {\n this.bone.parent.worldToLocal(thV);\n }\n this.bone.position.copy(thV);\n manager.freeThreeVector3(thV);\n manager.freeTransform(tr);\n }\n}\nclass Constraint {\n /**\n * @param {THREE.SkinnedMesh} mesh\n * @param {Ammo.btDiscreteDynamicsWorld} world\n * @param {RigidBody} bodyA\n * @param {RigidBody} bodyB\n * @param {Object} params\n * @param {ResourceManager} manager\n */\n constructor(mesh, world2, bodyA, bodyB, params, manager) {\n this.mesh = mesh;\n this.world = world2;\n this.bodyA = bodyA;\n this.bodyB = bodyB;\n this.params = params;\n this.manager = manager;\n this.constraint = null;\n this._init();\n }\n // private method\n _init() {\n const manager = this.manager;\n const params = this.params;\n const bodyA = this.bodyA;\n const bodyB = this.bodyB;\n const form = manager.allocTransform();\n manager.setIdentity(form);\n manager.setOriginFromArray3(form, params.position);\n manager.setBasisFromArray3(form, params.rotation);\n const formA = manager.allocTransform();\n const formB = manager.allocTransform();\n bodyA.body.getMotionState().getWorldTransform(formA);\n bodyB.body.getMotionState().getWorldTransform(formB);\n const formInverseA = manager.inverseTransform(formA);\n const formInverseB = manager.inverseTransform(formB);\n const formA2 = manager.multiplyTransforms(formInverseA, form);\n const formB2 = manager.multiplyTransforms(formInverseB, form);\n const constraint = new Ammo.btGeneric6DofSpringConstraint(bodyA.body, bodyB.body, formA2, formB2, true);\n const lll = manager.allocVector3();\n const lul = manager.allocVector3();\n const all = manager.allocVector3();\n const aul = manager.allocVector3();\n lll.setValue(params.translationLimitation1[0], params.translationLimitation1[1], params.translationLimitation1[2]);\n lul.setValue(params.translationLimitation2[0], params.translationLimitation2[1], params.translationLimitation2[2]);\n all.setValue(params.rotationLimitation1[0], params.rotationLimitation1[1], params.rotationLimitation1[2]);\n aul.setValue(params.rotationLimitation2[0], params.rotationLimitation2[1], params.rotationLimitation2[2]);\n constraint.setLinearLowerLimit(lll);\n constraint.setLinearUpperLimit(lul);\n constraint.setAngularLowerLimit(all);\n constraint.setAngularUpperLimit(aul);\n for (let i2 = 0; i2 < 3; i2++) {\n if (params.springPosition[i2] !== 0) {\n constraint.enableSpring(i2, true);\n constraint.setStiffness(i2, params.springPosition[i2]);\n }\n }\n for (let i2 = 0; i2 < 3; i2++) {\n if (params.springRotation[i2] !== 0) {\n constraint.enableSpring(i2 + 3, true);\n constraint.setStiffness(i2 + 3, params.springRotation[i2]);\n }\n }\n if (constraint.setParam !== void 0) {\n for (let i2 = 0; i2 < 6; i2++) {\n constraint.setParam(2, 0.475, i2);\n }\n }\n this.world.addConstraint(constraint, true);\n this.constraint = constraint;\n manager.freeTransform(form);\n manager.freeTransform(formA);\n manager.freeTransform(formB);\n manager.freeTransform(formInverseA);\n manager.freeTransform(formInverseB);\n manager.freeTransform(formA2);\n manager.freeTransform(formB2);\n manager.freeVector3(lll);\n manager.freeVector3(lul);\n manager.freeVector3(all);\n manager.freeVector3(aul);\n }\n}\nconst _position = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst _quaternion = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion();\nconst _scale = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst _matrixWorldInv = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\nclass MMDPhysicsHelper extends three__WEBPACK_IMPORTED_MODULE_42__.Object3D {\n /**\n * Visualize Rigid bodies\n *\n * @param {THREE.SkinnedMesh} mesh\n * @param {Physics} physics\n */\n constructor(mesh, physics) {\n super();\n this.root = mesh;\n this.physics = physics;\n this.matrix.copy(mesh.matrixWorld);\n this.matrixAutoUpdate = false;\n this.materials = [];\n this.materials.push(\n new three__WEBPACK_IMPORTED_MODULE_42__.MeshBasicMaterial({\n color: new three__WEBPACK_IMPORTED_MODULE_42__.Color(16746632),\n wireframe: true,\n depthTest: false,\n depthWrite: false,\n opacity: 0.25,\n transparent: true\n })\n );\n this.materials.push(\n new three__WEBPACK_IMPORTED_MODULE_42__.MeshBasicMaterial({\n color: new three__WEBPACK_IMPORTED_MODULE_42__.Color(8978312),\n wireframe: true,\n depthTest: false,\n depthWrite: false,\n opacity: 0.25,\n transparent: true\n })\n );\n this.materials.push(\n new three__WEBPACK_IMPORTED_MODULE_42__.MeshBasicMaterial({\n color: new three__WEBPACK_IMPORTED_MODULE_42__.Color(8947967),\n wireframe: true,\n depthTest: false,\n depthWrite: false,\n opacity: 0.25,\n transparent: true\n })\n );\n this._init();\n }\n /**\n * Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app.\n */\n dispose() {\n const materials = this.materials;\n const children = this.children;\n for (let i2 = 0; i2 < materials.length; i2++) {\n materials[i2].dispose();\n }\n for (let i2 = 0; i2 < children.length; i2++) {\n const child = children[i2];\n if (child.isMesh)\n child.geometry.dispose();\n }\n }\n /**\n * Updates Rigid Bodies visualization.\n */\n updateMatrixWorld(force) {\n var mesh = this.root;\n if (this.visible) {\n var bodies = this.physics.bodies;\n _matrixWorldInv.copy(mesh.matrixWorld).decompose(_position, _quaternion, _scale).compose(_position, _quaternion, _scale.set(1, 1, 1)).invert();\n for (var i2 = 0, il = bodies.length; i2 < il; i2++) {\n var body = bodies[i2].body;\n var child = this.children[i2];\n var tr = body.getCenterOfMassTransform();\n var origin = tr.getOrigin();\n var rotation = tr.getRotation();\n child.position.set(origin.x(), origin.y(), origin.z()).applyMatrix4(_matrixWorldInv);\n child.quaternion.setFromRotationMatrix(_matrixWorldInv).multiply(_quaternion.set(rotation.x(), rotation.y(), rotation.z(), rotation.w()));\n }\n }\n this.matrix.copy(mesh.matrixWorld).decompose(_position, _quaternion, _scale).compose(_position, _quaternion, _scale.set(1, 1, 1));\n super.updateMatrixWorld(force);\n }\n // private method\n _init() {\n var bodies = this.physics.bodies;\n function createGeometry(param2) {\n switch (param2.shapeType) {\n case 0:\n return new three__WEBPACK_IMPORTED_MODULE_42__.SphereGeometry(param2.width, 16, 8);\n case 1:\n return new three__WEBPACK_IMPORTED_MODULE_42__.BoxGeometry(param2.width * 2, param2.height * 2, param2.depth * 2, 8, 8, 8);\n case 2:\n return new CapsuleGeometry(param2.width, param2.height, 8, 16);\n default:\n return null;\n }\n }\n for (var i2 = 0, il = bodies.length; i2 < il; i2++) {\n var param = bodies[i2].params;\n this.add(new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(createGeometry(param), this.materials[param.type]));\n }\n }\n}\nclass MMDAnimationHelper {\n /**\n * @param {Object} params - (optional)\n * @param {boolean} params.sync - Whether animation durations of added objects are synched. Default is true.\n * @param {Number} params.afterglow - Default is 0.0.\n * @param {boolean} params.resetPhysicsOnLoop - Default is true.\n */\n constructor(params = {}) {\n this.meshes = [];\n this.camera = null;\n this.cameraTarget = new three__WEBPACK_IMPORTED_MODULE_42__.Object3D();\n this.cameraTarget.name = \"target\";\n this.audio = null;\n this.audioManager = null;\n this.objects = /* @__PURE__ */ new WeakMap();\n this.configuration = {\n sync: params.sync !== void 0 ? params.sync : true,\n afterglow: params.afterglow !== void 0 ? params.afterglow : 0,\n resetPhysicsOnLoop: params.resetPhysicsOnLoop !== void 0 ? params.resetPhysicsOnLoop : true,\n pmxAnimation: params.pmxAnimation !== void 0 ? params.pmxAnimation : false\n };\n this.enabled = {\n animation: true,\n ik: true,\n grant: true,\n physics: true,\n cameraAnimation: true\n };\n this.onBeforePhysics = function() {\n };\n this.sharedPhysics = false;\n this.masterPhysics = null;\n }\n /**\n * Adds an Three.js Object to helper and setups animation.\n * The anmation durations of added objects are synched\n * if this.configuration.sync is true.\n *\n * @param {THREE.SkinnedMesh|THREE.Camera|THREE.Audio} object\n * @param {Object} params - (optional)\n * @param {THREE.AnimationClip|Array} params.animation - Only for THREE.SkinnedMesh and THREE.Camera. Default is undefined.\n * @param {boolean} params.physics - Only for THREE.SkinnedMesh. Default is true.\n * @param {Integer} params.warmup - Only for THREE.SkinnedMesh and physics is true. Default is 60.\n * @param {Number} params.unitStep - Only for THREE.SkinnedMesh and physics is true. Default is 1 / 65.\n * @param {Integer} params.maxStepNum - Only for THREE.SkinnedMesh and physics is true. Default is 3.\n * @param {Vector3} params.gravity - Only for THREE.SkinnedMesh and physics is true. Default ( 0, - 9.8 * 10, 0 ).\n * @param {Number} params.delayTime - Only for THREE.Audio. Default is 0.0.\n * @return {MMDAnimationHelper}\n */\n add(object, params = {}) {\n if (object.isSkinnedMesh) {\n this._addMesh(object, params);\n } else if (object.isCamera) {\n this._setupCamera(object, params);\n } else if (object.type === \"Audio\") {\n this._setupAudio(object, params);\n } else {\n throw new Error(\n \"THREE.MMDAnimationHelper.add: accepts only THREE.SkinnedMesh or THREE.Camera or THREE.Audio instance.\"\n );\n }\n if (this.configuration.sync)\n this._syncDuration();\n return this;\n }\n /**\n * Removes an Three.js Object from helper.\n *\n * @param {THREE.SkinnedMesh|THREE.Camera|THREE.Audio} object\n * @return {MMDAnimationHelper}\n */\n remove(object) {\n if (object.isSkinnedMesh) {\n this._removeMesh(object);\n } else if (object.isCamera) {\n this._clearCamera(object);\n } else if (object.type === \"Audio\") {\n this._clearAudio(object);\n } else {\n throw new Error(\n \"THREE.MMDAnimationHelper.remove: accepts only THREE.SkinnedMesh or THREE.Camera or THREE.Audio instance.\"\n );\n }\n if (this.configuration.sync)\n this._syncDuration();\n return this;\n }\n /**\n * Updates the animation.\n *\n * @param {Number} delta\n * @return {MMDAnimationHelper}\n */\n update(delta) {\n if (this.audioManager !== null)\n this.audioManager.control(delta);\n for (let i2 = 0; i2 < this.meshes.length; i2++) {\n this._animateMesh(this.meshes[i2], delta);\n }\n if (this.sharedPhysics)\n this._updateSharedPhysics(delta);\n if (this.camera !== null)\n this._animateCamera(this.camera, delta);\n return this;\n }\n /**\n * Changes the pose of SkinnedMesh as VPD specifies.\n *\n * @param {THREE.SkinnedMesh} mesh\n * @param {Object} vpd - VPD content parsed MMDParser\n * @param {Object} params - (optional)\n * @param {boolean} params.resetPose - Default is true.\n * @param {boolean} params.ik - Default is true.\n * @param {boolean} params.grant - Default is true.\n * @return {MMDAnimationHelper}\n */\n pose(mesh, vpd, params = {}) {\n if (params.resetPose !== false)\n mesh.pose();\n const bones = mesh.skeleton.bones;\n const boneParams = vpd.bones;\n const boneNameDictionary = {};\n for (let i2 = 0, il = bones.length; i2 < il; i2++) {\n boneNameDictionary[bones[i2].name] = i2;\n }\n const vector = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const quaternion = new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion();\n for (let i2 = 0, il = boneParams.length; i2 < il; i2++) {\n const boneParam = boneParams[i2];\n const boneIndex = boneNameDictionary[boneParam.name];\n if (boneIndex === void 0)\n continue;\n const bone = bones[boneIndex];\n bone.position.add(vector.fromArray(boneParam.translation));\n bone.quaternion.multiply(quaternion.fromArray(boneParam.quaternion));\n }\n mesh.updateMatrixWorld(true);\n if (this.configuration.pmxAnimation && mesh.geometry.userData.MMD && mesh.geometry.userData.MMD.format === \"pmx\") {\n const sortedBonesData = this._sortBoneDataArray(mesh.geometry.userData.MMD.bones.slice());\n const ikSolver = params.ik !== false ? this._createCCDIKSolver(mesh) : null;\n const grantSolver = params.grant !== false ? this.createGrantSolver(mesh) : null;\n this._animatePMXMesh(mesh, sortedBonesData, ikSolver, grantSolver);\n } else {\n if (params.ik !== false) {\n this._createCCDIKSolver(mesh).update();\n }\n if (params.grant !== false) {\n this.createGrantSolver(mesh).update();\n }\n }\n return this;\n }\n /**\n * Enabes/Disables an animation feature.\n *\n * @param {string} key\n * @param {boolean} enabled\n * @return {MMDAnimationHelper}\n */\n enable(key, enabled) {\n if (this.enabled[key] === void 0) {\n throw new Error(\"THREE.MMDAnimationHelper.enable: unknown key \" + key);\n }\n this.enabled[key] = enabled;\n if (key === \"physics\") {\n for (let i2 = 0, il = this.meshes.length; i2 < il; i2++) {\n this._optimizeIK(this.meshes[i2], enabled);\n }\n }\n return this;\n }\n /**\n * Creates an GrantSolver instance.\n *\n * @param {THREE.SkinnedMesh} mesh\n * @return {GrantSolver}\n */\n createGrantSolver(mesh) {\n return new GrantSolver(mesh, mesh.geometry.userData.MMD.grants);\n }\n // private methods\n _addMesh(mesh, params) {\n if (this.meshes.indexOf(mesh) >= 0) {\n throw new Error(\"THREE.MMDAnimationHelper._addMesh: SkinnedMesh '\" + mesh.name + \"' has already been added.\");\n }\n this.meshes.push(mesh);\n this.objects.set(mesh, { looped: false });\n this._setupMeshAnimation(mesh, params.animation);\n if (params.physics !== false) {\n this._setupMeshPhysics(mesh, params);\n }\n return this;\n }\n _setupCamera(camera, params) {\n if (this.camera === camera) {\n throw new Error(\"THREE.MMDAnimationHelper._setupCamera: Camera '\" + camera.name + \"' has already been set.\");\n }\n if (this.camera)\n this.clearCamera(this.camera);\n this.camera = camera;\n camera.add(this.cameraTarget);\n this.objects.set(camera, {});\n if (params.animation !== void 0) {\n this._setupCameraAnimation(camera, params.animation);\n }\n return this;\n }\n _setupAudio(audio, params) {\n if (this.audio === audio) {\n throw new Error(\"THREE.MMDAnimationHelper._setupAudio: Audio '\" + audio.name + \"' has already been set.\");\n }\n if (this.audio)\n this.clearAudio(this.audio);\n this.audio = audio;\n this.audioManager = new AudioManager(audio, params);\n this.objects.set(this.audioManager, {\n duration: this.audioManager.duration\n });\n return this;\n }\n _removeMesh(mesh) {\n let found = false;\n let writeIndex = 0;\n for (let i2 = 0, il = this.meshes.length; i2 < il; i2++) {\n if (this.meshes[i2] === mesh) {\n this.objects.delete(mesh);\n found = true;\n continue;\n }\n this.meshes[writeIndex++] = this.meshes[i2];\n }\n if (!found) {\n throw new Error(\n \"THREE.MMDAnimationHelper._removeMesh: SkinnedMesh '\" + mesh.name + \"' has not been added yet.\"\n );\n }\n this.meshes.length = writeIndex;\n return this;\n }\n _clearCamera(camera) {\n if (camera !== this.camera) {\n throw new Error(\"THREE.MMDAnimationHelper._clearCamera: Camera '\" + camera.name + \"' has not been set yet.\");\n }\n this.camera.remove(this.cameraTarget);\n this.objects.delete(this.camera);\n this.camera = null;\n return this;\n }\n _clearAudio(audio) {\n if (audio !== this.audio) {\n throw new Error(\"THREE.MMDAnimationHelper._clearAudio: Audio '\" + audio.name + \"' has not been set yet.\");\n }\n this.objects.delete(this.audioManager);\n this.audio = null;\n this.audioManager = null;\n return this;\n }\n _setupMeshAnimation(mesh, animation) {\n const objects = this.objects.get(mesh);\n if (animation !== void 0) {\n const animations = Array.isArray(animation) ? animation : [animation];\n objects.mixer = new three__WEBPACK_IMPORTED_MODULE_42__.AnimationMixer(mesh);\n for (let i2 = 0, il = animations.length; i2 < il; i2++) {\n objects.mixer.clipAction(animations[i2]).play();\n }\n objects.mixer.addEventListener(\"loop\", function(event) {\n const tracks = event.action._clip.tracks;\n if (tracks.length > 0 && tracks[0].name.slice(0, 6) !== \".bones\")\n return;\n objects.looped = true;\n });\n }\n objects.ikSolver = this._createCCDIKSolver(mesh);\n objects.grantSolver = this.createGrantSolver(mesh);\n return this;\n }\n _setupCameraAnimation(camera, animation) {\n const animations = Array.isArray(animation) ? animation : [animation];\n const objects = this.objects.get(camera);\n objects.mixer = new three__WEBPACK_IMPORTED_MODULE_42__.AnimationMixer(camera);\n for (let i2 = 0, il = animations.length; i2 < il; i2++) {\n objects.mixer.clipAction(animations[i2]).play();\n }\n }\n _setupMeshPhysics(mesh, params) {\n const objects = this.objects.get(mesh);\n if (params.world === void 0 && this.sharedPhysics) {\n const masterPhysics = this._getMasterPhysics();\n if (masterPhysics !== null)\n world = masterPhysics.world;\n }\n objects.physics = this._createMMDPhysics(mesh, params);\n if (objects.mixer && params.animationWarmup !== false) {\n this._animateMesh(mesh, 0);\n objects.physics.reset();\n }\n objects.physics.warmup(params.warmup !== void 0 ? params.warmup : 60);\n this._optimizeIK(mesh, true);\n }\n _animateMesh(mesh, delta) {\n const objects = this.objects.get(mesh);\n const mixer = objects.mixer;\n const ikSolver = objects.ikSolver;\n const grantSolver = objects.grantSolver;\n const physics = objects.physics;\n const looped = objects.looped;\n if (mixer && this.enabled.animation) {\n this._restoreBones(mesh);\n mixer.update(delta);\n this._saveBones(mesh);\n if (this.configuration.pmxAnimation && mesh.geometry.userData.MMD && mesh.geometry.userData.MMD.format === \"pmx\") {\n if (!objects.sortedBonesData)\n objects.sortedBonesData = this._sortBoneDataArray(mesh.geometry.userData.MMD.bones.slice());\n this._animatePMXMesh(\n mesh,\n objects.sortedBonesData,\n ikSolver && this.enabled.ik ? ikSolver : null,\n grantSolver && this.enabled.grant ? grantSolver : null\n );\n } else {\n if (ikSolver && this.enabled.ik) {\n mesh.updateMatrixWorld(true);\n ikSolver.update();\n }\n if (grantSolver && this.enabled.grant) {\n grantSolver.update();\n }\n }\n }\n if (looped === true && this.enabled.physics) {\n if (physics && this.configuration.resetPhysicsOnLoop)\n physics.reset();\n objects.looped = false;\n }\n if (physics && this.enabled.physics && !this.sharedPhysics) {\n this.onBeforePhysics(mesh);\n physics.update(delta);\n }\n }\n // Sort bones in order by 1. transformationClass and 2. bone index.\n // In PMX animation system, bone transformations should be processed\n // in this order.\n _sortBoneDataArray(boneDataArray) {\n return boneDataArray.sort(function(a2, b2) {\n if (a2.transformationClass !== b2.transformationClass) {\n return a2.transformationClass - b2.transformationClass;\n } else {\n return a2.index - b2.index;\n }\n });\n }\n // PMX Animation system is a bit too complex and doesn't great match to\n // Three.js Animation system. This method attempts to simulate it as much as\n // possible but doesn't perfectly simulate.\n // This method is more costly than the regular one so\n // you are recommended to set constructor parameter \"pmxAnimation: true\"\n // only if your PMX model animation doesn't work well.\n // If you need better method you would be required to write your own.\n _animatePMXMesh(mesh, sortedBonesData, ikSolver, grantSolver) {\n _quaternionIndex = 0;\n _grantResultMap.clear();\n for (let i2 = 0, il = sortedBonesData.length; i2 < il; i2++) {\n updateOne(mesh, sortedBonesData[i2].index, ikSolver, grantSolver);\n }\n mesh.updateMatrixWorld(true);\n return this;\n }\n _animateCamera(camera, delta) {\n const mixer = this.objects.get(camera).mixer;\n if (mixer && this.enabled.cameraAnimation) {\n mixer.update(delta);\n camera.updateProjectionMatrix();\n camera.up.set(0, 1, 0);\n camera.up.applyQuaternion(camera.quaternion);\n camera.lookAt(this.cameraTarget.position);\n }\n }\n _optimizeIK(mesh, physicsEnabled) {\n const iks = mesh.geometry.userData.MMD.iks;\n const bones = mesh.geometry.userData.MMD.bones;\n for (let i2 = 0, il = iks.length; i2 < il; i2++) {\n const ik = iks[i2];\n const links = ik.links;\n for (let j = 0, jl = links.length; j < jl; j++) {\n const link = links[j];\n if (physicsEnabled === true) {\n link.enabled = bones[link.index].rigidBodyType > 0 ? false : true;\n } else {\n link.enabled = true;\n }\n }\n }\n }\n _createCCDIKSolver(mesh) {\n if (CCDIKSolver === void 0) {\n throw new Error(\"THREE.MMDAnimationHelper: Import CCDIKSolver.\");\n }\n return new CCDIKSolver(mesh, mesh.geometry.userData.MMD.iks);\n }\n _createMMDPhysics(mesh, params) {\n if (MMDPhysics === void 0) {\n throw new Error(\"THREE.MMDPhysics: Import MMDPhysics.\");\n }\n return new MMDPhysics(mesh, mesh.geometry.userData.MMD.rigidBodies, mesh.geometry.userData.MMD.constraints, params);\n }\n /*\n * Detects the longest duration and then sets it to them to sync.\n * TODO: Not to access private properties ( ._actions and ._clip )\n */\n _syncDuration() {\n let max = 0;\n const objects = this.objects;\n const meshes = this.meshes;\n const camera = this.camera;\n const audioManager = this.audioManager;\n for (let i2 = 0, il = meshes.length; i2 < il; i2++) {\n const mixer = this.objects.get(meshes[i2]).mixer;\n if (mixer === void 0)\n continue;\n for (let j = 0; j < mixer._actions.length; j++) {\n const clip = mixer._actions[j]._clip;\n if (!objects.has(clip)) {\n objects.set(clip, {\n duration: clip.duration\n });\n }\n max = Math.max(max, objects.get(clip).duration);\n }\n }\n if (camera !== null) {\n const mixer = this.objects.get(camera).mixer;\n if (mixer !== void 0) {\n for (let i2 = 0, il = mixer._actions.length; i2 < il; i2++) {\n const clip = mixer._actions[i2]._clip;\n if (!objects.has(clip)) {\n objects.set(clip, {\n duration: clip.duration\n });\n }\n max = Math.max(max, objects.get(clip).duration);\n }\n }\n }\n if (audioManager !== null) {\n max = Math.max(max, objects.get(audioManager).duration);\n }\n max += this.configuration.afterglow;\n for (let i2 = 0, il = this.meshes.length; i2 < il; i2++) {\n const mixer = this.objects.get(this.meshes[i2]).mixer;\n if (mixer === void 0)\n continue;\n for (let j = 0, jl = mixer._actions.length; j < jl; j++) {\n mixer._actions[j]._clip.duration = max;\n }\n }\n if (camera !== null) {\n const mixer = this.objects.get(camera).mixer;\n if (mixer !== void 0) {\n for (let i2 = 0, il = mixer._actions.length; i2 < il; i2++) {\n mixer._actions[i2]._clip.duration = max;\n }\n }\n }\n if (audioManager !== null) {\n audioManager.duration = max;\n }\n }\n // workaround\n _updatePropertyMixersBuffer(mesh) {\n const mixer = this.objects.get(mesh).mixer;\n const propertyMixers = mixer._bindings;\n const accuIndex = mixer._accuIndex;\n for (let i2 = 0, il = propertyMixers.length; i2 < il; i2++) {\n const propertyMixer = propertyMixers[i2];\n const buffer = propertyMixer.buffer;\n const stride = propertyMixer.valueSize;\n const offset = (accuIndex + 1) * stride;\n propertyMixer.binding.getValue(buffer, offset);\n }\n }\n /*\n * Avoiding these two issues by restore/save bones before/after mixer animation.\n *\n * 1. PropertyMixer used by AnimationMixer holds cache value in .buffer.\n * Calculating IK, Grant, and Physics after mixer animation can break\n * the cache coherency.\n *\n * 2. Applying Grant two or more times without reset the posing breaks model.\n */\n _saveBones(mesh) {\n const objects = this.objects.get(mesh);\n const bones = mesh.skeleton.bones;\n let backupBones = objects.backupBones;\n if (backupBones === void 0) {\n backupBones = new Float32Array(bones.length * 7);\n objects.backupBones = backupBones;\n }\n for (let i2 = 0, il = bones.length; i2 < il; i2++) {\n const bone = bones[i2];\n bone.position.toArray(backupBones, i2 * 7);\n bone.quaternion.toArray(backupBones, i2 * 7 + 3);\n }\n }\n _restoreBones(mesh) {\n const objects = this.objects.get(mesh);\n const backupBones = objects.backupBones;\n if (backupBones === void 0)\n return;\n const bones = mesh.skeleton.bones;\n for (let i2 = 0, il = bones.length; i2 < il; i2++) {\n const bone = bones[i2];\n bone.position.fromArray(backupBones, i2 * 7);\n bone.quaternion.fromArray(backupBones, i2 * 7 + 3);\n }\n }\n // experimental\n _getMasterPhysics() {\n if (this.masterPhysics !== null)\n return this.masterPhysics;\n for (let i2 = 0, il = this.meshes.length; i2 < il; i2++) {\n const physics = this.meshes[i2].physics;\n if (physics !== void 0 && physics !== null) {\n this.masterPhysics = physics;\n return this.masterPhysics;\n }\n }\n return null;\n }\n _updateSharedPhysics(delta) {\n if (this.meshes.length === 0 || !this.enabled.physics || !this.sharedPhysics)\n return;\n const physics = this._getMasterPhysics();\n if (physics === null)\n return;\n for (let i2 = 0, il = this.meshes.length; i2 < il; i2++) {\n const p = this.meshes[i2].physics;\n if (p !== null && p !== void 0) {\n p.updateRigidBodies();\n }\n }\n physics.stepSimulation(delta);\n for (let i2 = 0, il = this.meshes.length; i2 < il; i2++) {\n const p = this.meshes[i2].physics;\n if (p !== null && p !== void 0) {\n p.updateBones();\n }\n }\n }\n}\nconst _quaternions = [];\nlet _quaternionIndex = 0;\nfunction getQuaternion() {\n if (_quaternionIndex >= _quaternions.length) {\n _quaternions.push(new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion());\n }\n return _quaternions[_quaternionIndex++];\n}\nconst _grantResultMap = /* @__PURE__ */ new Map();\nfunction updateOne(mesh, boneIndex, ikSolver, grantSolver) {\n const bones = mesh.skeleton.bones;\n const bonesData = mesh.geometry.userData.MMD.bones;\n const boneData = bonesData[boneIndex];\n const bone = bones[boneIndex];\n if (_grantResultMap.has(boneIndex))\n return;\n const quaternion = getQuaternion();\n _grantResultMap.set(boneIndex, quaternion.copy(bone.quaternion));\n if (grantSolver && boneData.grant && !boneData.grant.isLocal && boneData.grant.affectRotation) {\n const parentIndex = boneData.grant.parentIndex;\n const ratio = boneData.grant.ratio;\n if (!_grantResultMap.has(parentIndex)) {\n updateOne(mesh, parentIndex, ikSolver, grantSolver);\n }\n grantSolver.addGrantRotation(bone, _grantResultMap.get(parentIndex), ratio);\n }\n if (ikSolver && boneData.ik) {\n mesh.updateMatrixWorld(true);\n ikSolver.updateOne(boneData.ik);\n const links = boneData.ik.links;\n for (let i2 = 0, il = links.length; i2 < il; i2++) {\n const link = links[i2];\n if (link.enabled === false)\n continue;\n const linkIndex = link.index;\n if (_grantResultMap.has(linkIndex)) {\n _grantResultMap.set(linkIndex, _grantResultMap.get(linkIndex).copy(bones[linkIndex].quaternion));\n }\n }\n }\n quaternion.copy(bone.quaternion);\n}\nclass AudioManager {\n /**\n * @param {THREE.Audio} audio\n * @param {Object} params - (optional)\n * @param {Nuumber} params.delayTime\n */\n constructor(audio, params = {}) {\n this.audio = audio;\n this.elapsedTime = 0;\n this.currentTime = 0;\n this.delayTime = params.delayTime !== void 0 ? params.delayTime : 0;\n this.audioDuration = this.audio.buffer.duration;\n this.duration = this.audioDuration + this.delayTime;\n }\n /**\n * @param {Number} delta\n * @return {AudioManager}\n */\n control(delta) {\n this.elapsed += delta;\n this.currentTime += delta;\n if (this._shouldStopAudio())\n this.audio.stop();\n if (this._shouldStartAudio())\n this.audio.play();\n return this;\n }\n // private methods\n _shouldStartAudio() {\n if (this.audio.isPlaying)\n return false;\n while (this.currentTime >= this.duration) {\n this.currentTime -= this.duration;\n }\n if (this.currentTime < this.delayTime)\n return false;\n if (this.currentTime - this.delayTime > this.audioDuration)\n return false;\n return true;\n }\n _shouldStopAudio() {\n return this.audio.isPlaying && this.currentTime >= this.duration;\n }\n}\nconst _q$1 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion();\nclass GrantSolver {\n constructor(mesh, grants = []) {\n this.mesh = mesh;\n this.grants = grants;\n }\n /**\n * Solve all the grant bones\n * @return {GrantSolver}\n */\n update() {\n const grants = this.grants;\n for (let i2 = 0, il = grants.length; i2 < il; i2++) {\n this.updateOne(grants[i2]);\n }\n return this;\n }\n /**\n * Solve a grant bone\n * @param {Object} grant - grant parameter\n * @return {GrantSolver}\n */\n updateOne(grant) {\n const bones = this.mesh.skeleton.bones;\n const bone = bones[grant.index];\n const parentBone = bones[grant.parentIndex];\n if (grant.isLocal) {\n if (grant.affectPosition)\n ;\n if (grant.affectRotation)\n ;\n } else {\n if (grant.affectPosition)\n ;\n if (grant.affectRotation) {\n this.addGrantRotation(bone, parentBone.quaternion, grant.ratio);\n }\n }\n return this;\n }\n addGrantRotation(bone, q, ratio) {\n _q$1.set(0, 0, 0, 1);\n _q$1.slerp(q, ratio);\n bone.quaternion.multiply(_q$1);\n return this;\n }\n}\nconst _Reflector = class extends three__WEBPACK_IMPORTED_MODULE_42__.Mesh {\n constructor(geometry2, options = {}) {\n super(geometry2);\n this.isReflector = true;\n this.type = \"Reflector\";\n this.camera = new three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera();\n const scope = this;\n const color = options.color !== void 0 ? new three__WEBPACK_IMPORTED_MODULE_42__.Color(options.color) : new three__WEBPACK_IMPORTED_MODULE_42__.Color(8355711);\n const textureWidth = options.textureWidth || 512;\n const textureHeight = options.textureHeight || 512;\n const clipBias = options.clipBias || 0;\n const shader = options.shader || _Reflector.ReflectorShader;\n const multisample = options.multisample !== void 0 ? options.multisample : 4;\n const reflectorPlane = new three__WEBPACK_IMPORTED_MODULE_42__.Plane();\n const normal = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const reflectorWorldPosition = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const cameraWorldPosition = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const rotationMatrix2 = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n const lookAtPosition = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 0, -1);\n const clipPlane = new three__WEBPACK_IMPORTED_MODULE_42__.Vector4();\n const view = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const target = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const q = new three__WEBPACK_IMPORTED_MODULE_42__.Vector4();\n const textureMatrix = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n const virtualCamera = this.camera;\n const renderTarget = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(textureWidth, textureHeight, {\n samples: multisample,\n type: three__WEBPACK_IMPORTED_MODULE_42__.HalfFloatType\n });\n const material2 = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(shader.uniforms),\n fragmentShader: shader.fragmentShader,\n vertexShader: shader.vertexShader\n });\n material2.uniforms[\"tDiffuse\"].value = renderTarget.texture;\n material2.uniforms[\"color\"].value = color;\n material2.uniforms[\"textureMatrix\"].value = textureMatrix;\n this.material = material2;\n this.onBeforeRender = function(renderer, scene, camera) {\n reflectorWorldPosition.setFromMatrixPosition(scope.matrixWorld);\n cameraWorldPosition.setFromMatrixPosition(camera.matrixWorld);\n rotationMatrix2.extractRotation(scope.matrixWorld);\n normal.set(0, 0, 1);\n normal.applyMatrix4(rotationMatrix2);\n view.subVectors(reflectorWorldPosition, cameraWorldPosition);\n if (view.dot(normal) > 0)\n return;\n view.reflect(normal).negate();\n view.add(reflectorWorldPosition);\n rotationMatrix2.extractRotation(camera.matrixWorld);\n lookAtPosition.set(0, 0, -1);\n lookAtPosition.applyMatrix4(rotationMatrix2);\n lookAtPosition.add(cameraWorldPosition);\n target.subVectors(reflectorWorldPosition, lookAtPosition);\n target.reflect(normal).negate();\n target.add(reflectorWorldPosition);\n virtualCamera.position.copy(view);\n virtualCamera.up.set(0, 1, 0);\n virtualCamera.up.applyMatrix4(rotationMatrix2);\n virtualCamera.up.reflect(normal);\n virtualCamera.lookAt(target);\n virtualCamera.far = camera.far;\n virtualCamera.updateMatrixWorld();\n virtualCamera.projectionMatrix.copy(camera.projectionMatrix);\n textureMatrix.set(0.5, 0, 0, 0.5, 0, 0.5, 0, 0.5, 0, 0, 0.5, 0.5, 0, 0, 0, 1);\n textureMatrix.multiply(virtualCamera.projectionMatrix);\n textureMatrix.multiply(virtualCamera.matrixWorldInverse);\n textureMatrix.multiply(scope.matrixWorld);\n reflectorPlane.setFromNormalAndCoplanarPoint(normal, reflectorWorldPosition);\n reflectorPlane.applyMatrix4(virtualCamera.matrixWorldInverse);\n clipPlane.set(reflectorPlane.normal.x, reflectorPlane.normal.y, reflectorPlane.normal.z, reflectorPlane.constant);\n const projectionMatrix = virtualCamera.projectionMatrix;\n q.x = (Math.sign(clipPlane.x) + projectionMatrix.elements[8]) / projectionMatrix.elements[0];\n q.y = (Math.sign(clipPlane.y) + projectionMatrix.elements[9]) / projectionMatrix.elements[5];\n q.z = -1;\n q.w = (1 + projectionMatrix.elements[10]) / projectionMatrix.elements[14];\n clipPlane.multiplyScalar(2 / clipPlane.dot(q));\n projectionMatrix.elements[2] = clipPlane.x;\n projectionMatrix.elements[6] = clipPlane.y;\n projectionMatrix.elements[10] = clipPlane.z + 1 - clipBias;\n projectionMatrix.elements[14] = clipPlane.w;\n scope.visible = false;\n const currentRenderTarget = renderer.getRenderTarget();\n const currentXrEnabled = renderer.xr.enabled;\n const currentShadowAutoUpdate = renderer.shadowMap.autoUpdate;\n const currentToneMapping = renderer.toneMapping;\n let isSRGB = false;\n if (\"outputColorSpace\" in renderer)\n isSRGB = renderer.outputColorSpace === \"srgb\";\n else\n isSRGB = renderer.outputEncoding === 3001;\n renderer.xr.enabled = false;\n renderer.shadowMap.autoUpdate = false;\n if (\"outputColorSpace\" in renderer)\n renderer.outputColorSpace = \"linear-srgb\";\n else\n renderer.outputEncoding = 3e3;\n renderer.toneMapping = three__WEBPACK_IMPORTED_MODULE_42__.NoToneMapping;\n renderer.setRenderTarget(renderTarget);\n renderer.state.buffers.depth.setMask(true);\n if (renderer.autoClear === false)\n renderer.clear();\n renderer.render(scene, virtualCamera);\n renderer.xr.enabled = currentXrEnabled;\n renderer.shadowMap.autoUpdate = currentShadowAutoUpdate;\n renderer.toneMapping = currentToneMapping;\n if (\"outputColorSpace\" in renderer)\n renderer.outputColorSpace = isSRGB ? \"srgb\" : \"srgb-linear\";\n else\n renderer.outputEncoding = isSRGB ? 3001 : 3e3;\n renderer.setRenderTarget(currentRenderTarget);\n const viewport = camera.viewport;\n if (viewport !== void 0) {\n renderer.state.viewport(viewport);\n }\n scope.visible = true;\n };\n this.getRenderTarget = function() {\n return renderTarget;\n };\n this.dispose = function() {\n renderTarget.dispose();\n scope.material.dispose();\n };\n }\n};\nlet Reflector = _Reflector;\n__publicField(Reflector, \"ReflectorShader\", {\n uniforms: {\n color: {\n value: null\n },\n tDiffuse: {\n value: null\n },\n textureMatrix: {\n value: null\n }\n },\n vertexShader: (\n /* glsl */\n `\n\t\tuniform mat4 textureMatrix;\n\t\tvarying vec4 vUv;\n\n\t\t#include \n\t\t#include \n\n\t\tvoid main() {\n\n\t\t\tvUv = textureMatrix * vec4( position, 1.0 );\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t\t#include \n\n\t\t}`\n ),\n fragmentShader: (\n /* glsl */\n `\n\t\tuniform vec3 color;\n\t\tuniform sampler2D tDiffuse;\n\t\tvarying vec4 vUv;\n\n\t\t#include \n\n\t\tfloat blendOverlay( float base, float blend ) {\n\n\t\t\treturn( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );\n\n\t\t}\n\n\t\tvec3 blendOverlay( vec3 base, vec3 blend ) {\n\n\t\t\treturn vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include \n\n\t\t\tvec4 base = texture2DProj( tDiffuse, vUv );\n\t\t\tgl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );\n\n\t\t\t#include \n\t\t\t#include <${parseInt(three__WEBPACK_IMPORTED_MODULE_42__.REVISION.replace(/\\D+/g, \"\")) >= 154 ? \"colorspace_fragment\" : \"encodings_fragment\"}>\n\n\t\t}`\n )\n});\nconst _Refractor = class extends three__WEBPACK_IMPORTED_MODULE_42__.Mesh {\n constructor(geometry2, options = {}) {\n super(geometry2);\n this.isRefractor = true;\n this.type = \"Refractor\";\n this.camera = new three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera();\n const scope = this;\n const color = options.color !== void 0 ? new three__WEBPACK_IMPORTED_MODULE_42__.Color(options.color) : new three__WEBPACK_IMPORTED_MODULE_42__.Color(8355711);\n const textureWidth = options.textureWidth || 512;\n const textureHeight = options.textureHeight || 512;\n const clipBias = options.clipBias || 0;\n const shader = options.shader || _Refractor.RefractorShader;\n const multisample = options.multisample !== void 0 ? options.multisample : 4;\n const virtualCamera = this.camera;\n virtualCamera.matrixAutoUpdate = false;\n virtualCamera.userData.refractor = true;\n const refractorPlane = new three__WEBPACK_IMPORTED_MODULE_42__.Plane();\n const textureMatrix = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n const renderTarget = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(textureWidth, textureHeight, {\n samples: multisample,\n type: three__WEBPACK_IMPORTED_MODULE_42__.HalfFloatType\n });\n this.material = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(shader.uniforms),\n vertexShader: shader.vertexShader,\n fragmentShader: shader.fragmentShader,\n transparent: true\n // ensures, refractors are drawn from farthest to closest\n });\n this.material.uniforms[\"color\"].value = color;\n this.material.uniforms[\"tDiffuse\"].value = renderTarget.texture;\n this.material.uniforms[\"textureMatrix\"].value = textureMatrix;\n const visible = function() {\n const refractorWorldPosition = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const cameraWorldPosition = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const rotationMatrix2 = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n const view = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const normal = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n return function visible2(camera) {\n refractorWorldPosition.setFromMatrixPosition(scope.matrixWorld);\n cameraWorldPosition.setFromMatrixPosition(camera.matrixWorld);\n view.subVectors(refractorWorldPosition, cameraWorldPosition);\n rotationMatrix2.extractRotation(scope.matrixWorld);\n normal.set(0, 0, 1);\n normal.applyMatrix4(rotationMatrix2);\n return view.dot(normal) < 0;\n };\n }();\n const updateRefractorPlane = function() {\n const normal = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const position = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const quaternion = new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion();\n const scale = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n return function updateRefractorPlane2() {\n scope.matrixWorld.decompose(position, quaternion, scale);\n normal.set(0, 0, 1).applyQuaternion(quaternion).normalize();\n normal.negate();\n refractorPlane.setFromNormalAndCoplanarPoint(normal, position);\n };\n }();\n const updateVirtualCamera = function() {\n const clipPlane = new three__WEBPACK_IMPORTED_MODULE_42__.Plane();\n const clipVector = new three__WEBPACK_IMPORTED_MODULE_42__.Vector4();\n const q = new three__WEBPACK_IMPORTED_MODULE_42__.Vector4();\n return function updateVirtualCamera2(camera) {\n virtualCamera.matrixWorld.copy(camera.matrixWorld);\n virtualCamera.matrixWorldInverse.copy(virtualCamera.matrixWorld).invert();\n virtualCamera.projectionMatrix.copy(camera.projectionMatrix);\n virtualCamera.far = camera.far;\n clipPlane.copy(refractorPlane);\n clipPlane.applyMatrix4(virtualCamera.matrixWorldInverse);\n clipVector.set(clipPlane.normal.x, clipPlane.normal.y, clipPlane.normal.z, clipPlane.constant);\n const projectionMatrix = virtualCamera.projectionMatrix;\n q.x = (Math.sign(clipVector.x) + projectionMatrix.elements[8]) / projectionMatrix.elements[0];\n q.y = (Math.sign(clipVector.y) + projectionMatrix.elements[9]) / projectionMatrix.elements[5];\n q.z = -1;\n q.w = (1 + projectionMatrix.elements[10]) / projectionMatrix.elements[14];\n clipVector.multiplyScalar(2 / clipVector.dot(q));\n projectionMatrix.elements[2] = clipVector.x;\n projectionMatrix.elements[6] = clipVector.y;\n projectionMatrix.elements[10] = clipVector.z + 1 - clipBias;\n projectionMatrix.elements[14] = clipVector.w;\n };\n }();\n function updateTextureMatrix(camera) {\n textureMatrix.set(0.5, 0, 0, 0.5, 0, 0.5, 0, 0.5, 0, 0, 0.5, 0.5, 0, 0, 0, 1);\n textureMatrix.multiply(camera.projectionMatrix);\n textureMatrix.multiply(camera.matrixWorldInverse);\n textureMatrix.multiply(scope.matrixWorld);\n }\n function render(renderer, scene, camera) {\n scope.visible = false;\n const currentRenderTarget = renderer.getRenderTarget();\n const currentXrEnabled = renderer.xr.enabled;\n const currentShadowAutoUpdate = renderer.shadowMap.autoUpdate;\n const currentToneMapping = renderer.toneMapping;\n let isSRGB = false;\n if (\"outputColorSpace\" in renderer)\n isSRGB = renderer.outputColorSpace === \"srgb\";\n else\n isSRGB = renderer.outputEncoding === 3001;\n renderer.xr.enabled = false;\n renderer.shadowMap.autoUpdate = false;\n if (\"outputColorSpace\" in renderer)\n renderer.outputColorSpace = \"linear-srgb\";\n else\n renderer.outputEncoding = 3e3;\n renderer.toneMapping = three__WEBPACK_IMPORTED_MODULE_42__.NoToneMapping;\n renderer.setRenderTarget(renderTarget);\n if (renderer.autoClear === false)\n renderer.clear();\n renderer.render(scene, virtualCamera);\n renderer.xr.enabled = currentXrEnabled;\n renderer.shadowMap.autoUpdate = currentShadowAutoUpdate;\n renderer.toneMapping = currentToneMapping;\n renderer.setRenderTarget(currentRenderTarget);\n if (\"outputColorSpace\" in renderer)\n renderer.outputColorSpace = isSRGB ? \"srgb\" : \"srgb-linear\";\n else\n renderer.outputEncoding = isSRGB ? 3001 : 3e3;\n const viewport = camera.viewport;\n if (viewport !== void 0) {\n renderer.state.viewport(viewport);\n }\n scope.visible = true;\n }\n this.onBeforeRender = function(renderer, scene, camera) {\n if (camera.userData.refractor === true)\n return;\n if (!visible(camera) === true)\n return;\n updateRefractorPlane();\n updateTextureMatrix(camera);\n updateVirtualCamera(camera);\n render(renderer, scene, camera);\n };\n this.getRenderTarget = function() {\n return renderTarget;\n };\n this.dispose = function() {\n renderTarget.dispose();\n scope.material.dispose();\n };\n }\n};\nlet Refractor = _Refractor;\n__publicField(Refractor, \"RefractorShader\", {\n uniforms: {\n color: {\n value: null\n },\n tDiffuse: {\n value: null\n },\n textureMatrix: {\n value: null\n }\n },\n vertexShader: (\n /* glsl */\n `\n\n\t\tuniform mat4 textureMatrix;\n\n\t\tvarying vec4 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = textureMatrix * vec4( position, 1.0 );\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}`\n ),\n fragmentShader: (\n /* glsl */\n `\n\n\t\tuniform vec3 color;\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec4 vUv;\n\n\t\tfloat blendOverlay( float base, float blend ) {\n\n\t\t\treturn( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );\n\n\t\t}\n\n\t\tvec3 blendOverlay( vec3 base, vec3 blend ) {\n\n\t\t\treturn vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec4 base = texture2DProj( tDiffuse, vUv );\n\t\t\tgl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );\n\n\t\t\t#include \n\t\t\t#include <${parseInt(three__WEBPACK_IMPORTED_MODULE_42__.REVISION.replace(/\\D+/g, \"\")) >= 154 ? \"colorspace_fragment\" : \"encodings_fragment\"}>\n\n\t\t}`\n )\n});\nconst _shadowMatrix = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\nclass ShadowMesh extends three__WEBPACK_IMPORTED_MODULE_42__.Mesh {\n constructor(mesh) {\n const shadowMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.MeshBasicMaterial({\n color: 0,\n transparent: true,\n opacity: 0.6,\n depthWrite: false,\n stencilWrite: true,\n stencilFunc: three__WEBPACK_IMPORTED_MODULE_42__.EqualStencilFunc,\n stencilRef: 0,\n stencilZPass: three__WEBPACK_IMPORTED_MODULE_42__.IncrementStencilOp\n });\n super(mesh.geometry, shadowMaterial);\n this.isShadowMesh = true;\n this.meshMatrix = mesh.matrixWorld;\n this.frustumCulled = false;\n this.matrixAutoUpdate = false;\n }\n update(plane, lightPosition4D) {\n const dot = plane.normal.x * lightPosition4D.x + plane.normal.y * lightPosition4D.y + plane.normal.z * lightPosition4D.z + -plane.constant * lightPosition4D.w;\n const sme = _shadowMatrix.elements;\n sme[0] = dot - lightPosition4D.x * plane.normal.x;\n sme[4] = -lightPosition4D.x * plane.normal.y;\n sme[8] = -lightPosition4D.x * plane.normal.z;\n sme[12] = -lightPosition4D.x * -plane.constant;\n sme[1] = -lightPosition4D.y * plane.normal.x;\n sme[5] = dot - lightPosition4D.y * plane.normal.y;\n sme[9] = -lightPosition4D.y * plane.normal.z;\n sme[13] = -lightPosition4D.y * -plane.constant;\n sme[2] = -lightPosition4D.z * plane.normal.x;\n sme[6] = -lightPosition4D.z * plane.normal.y;\n sme[10] = dot - lightPosition4D.z * plane.normal.z;\n sme[14] = -lightPosition4D.z * -plane.constant;\n sme[3] = -lightPosition4D.w * plane.normal.x;\n sme[7] = -lightPosition4D.w * plane.normal.y;\n sme[11] = -lightPosition4D.w * plane.normal.z;\n sme[15] = dot - lightPosition4D.w * -plane.constant;\n this.matrix.multiplyMatrices(_shadowMatrix, this.meshMatrix);\n }\n}\nconst geometry = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry();\nconst _Lensflare = class extends three__WEBPACK_IMPORTED_MODULE_42__.Mesh {\n constructor() {\n super(_Lensflare.Geometry, new three__WEBPACK_IMPORTED_MODULE_42__.MeshBasicMaterial({ opacity: 0, transparent: true }));\n this.isLensflare = true;\n this.type = \"Lensflare\";\n this.frustumCulled = false;\n this.renderOrder = Infinity;\n const positionScreen = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const positionView = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const tempMap = new three__WEBPACK_IMPORTED_MODULE_42__.DataTexture(new Uint8Array(16 * 16 * 3), 16, 16, three__WEBPACK_IMPORTED_MODULE_42__.RGBAFormat);\n tempMap.minFilter = three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter;\n tempMap.magFilter = three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter;\n tempMap.wrapS = three__WEBPACK_IMPORTED_MODULE_42__.ClampToEdgeWrapping;\n tempMap.wrapT = three__WEBPACK_IMPORTED_MODULE_42__.ClampToEdgeWrapping;\n const occlusionMap = new three__WEBPACK_IMPORTED_MODULE_42__.DataTexture(new Uint8Array(16 * 16 * 3), 16, 16, three__WEBPACK_IMPORTED_MODULE_42__.RGBAFormat);\n occlusionMap.minFilter = three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter;\n occlusionMap.magFilter = three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter;\n occlusionMap.wrapS = three__WEBPACK_IMPORTED_MODULE_42__.ClampToEdgeWrapping;\n occlusionMap.wrapT = three__WEBPACK_IMPORTED_MODULE_42__.ClampToEdgeWrapping;\n const geometry2 = _Lensflare.Geometry;\n const material1a = new three__WEBPACK_IMPORTED_MODULE_42__.RawShaderMaterial({\n uniforms: {\n scale: { value: null },\n screenPosition: { value: null }\n },\n vertexShader: (\n /* glsl */\n `\n\n\t\t\t\tprecision highp float;\n\n\t\t\t\tuniform vec3 screenPosition;\n\t\t\t\tuniform vec2 scale;\n\n\t\t\t\tattribute vec3 position;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tgl_Position = vec4( position.xy * scale + screenPosition.xy, screenPosition.z, 1.0 );\n\n\t\t\t\t}`\n ),\n fragmentShader: (\n /* glsl */\n `\n\n\t\t\t\tprecision highp float;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tgl_FragColor = vec4( 1.0, 0.0, 1.0, 1.0 );\n\n\t\t\t\t}`\n ),\n depthTest: true,\n depthWrite: false,\n transparent: false\n });\n const material1b = new three__WEBPACK_IMPORTED_MODULE_42__.RawShaderMaterial({\n uniforms: {\n map: { value: tempMap },\n scale: { value: null },\n screenPosition: { value: null }\n },\n vertexShader: (\n /* glsl */\n `\n\n\t\t\t\tprecision highp float;\n\n\t\t\t\tuniform vec3 screenPosition;\n\t\t\t\tuniform vec2 scale;\n\n\t\t\t\tattribute vec3 position;\n\t\t\t\tattribute vec2 uv;\n\n\t\t\t\tvarying vec2 vUV;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvUV = uv;\n\n\t\t\t\t\tgl_Position = vec4( position.xy * scale + screenPosition.xy, screenPosition.z, 1.0 );\n\n\t\t\t\t}`\n ),\n fragmentShader: (\n /* glsl */\n `\n\n\t\t\t\tprecision highp float;\n\n\t\t\t\tuniform sampler2D map;\n\n\t\t\t\tvarying vec2 vUV;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tgl_FragColor = texture2D( map, vUV );\n\n\t\t\t\t}`\n ),\n depthTest: false,\n depthWrite: false,\n transparent: false\n });\n const mesh1 = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(geometry2, material1a);\n const elements = [];\n const shader = LensflareElement.Shader;\n const material2 = new three__WEBPACK_IMPORTED_MODULE_42__.RawShaderMaterial({\n uniforms: {\n map: { value: null },\n occlusionMap: { value: occlusionMap },\n color: { value: new three__WEBPACK_IMPORTED_MODULE_42__.Color(16777215) },\n scale: { value: new three__WEBPACK_IMPORTED_MODULE_42__.Vector2() },\n screenPosition: { value: new three__WEBPACK_IMPORTED_MODULE_42__.Vector3() }\n },\n vertexShader: shader.vertexShader,\n fragmentShader: shader.fragmentShader,\n blending: three__WEBPACK_IMPORTED_MODULE_42__.AdditiveBlending,\n transparent: true,\n depthWrite: false\n });\n const mesh2 = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(geometry2, material2);\n this.addElement = function(element) {\n elements.push(element);\n };\n const scale = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2();\n const screenPositionPixels = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2();\n const validArea = new three__WEBPACK_IMPORTED_MODULE_42__.Box2();\n const viewport = new three__WEBPACK_IMPORTED_MODULE_42__.Vector4();\n this.onBeforeRender = function(renderer, scene, camera) {\n renderer.getCurrentViewport(viewport);\n const invAspect = viewport.w / viewport.z;\n const halfViewportWidth = viewport.z / 2;\n const halfViewportHeight = viewport.w / 2;\n let size2 = 16 / viewport.w;\n scale.set(size2 * invAspect, size2);\n validArea.min.set(viewport.x, viewport.y);\n validArea.max.set(viewport.x + (viewport.z - 16), viewport.y + (viewport.w - 16));\n positionView.setFromMatrixPosition(this.matrixWorld);\n positionView.applyMatrix4(camera.matrixWorldInverse);\n if (positionView.z > 0)\n return;\n positionScreen.copy(positionView).applyMatrix4(camera.projectionMatrix);\n screenPositionPixels.x = viewport.x + positionScreen.x * halfViewportWidth + halfViewportWidth - 8;\n screenPositionPixels.y = viewport.y + positionScreen.y * halfViewportHeight + halfViewportHeight - 8;\n if (validArea.containsPoint(screenPositionPixels)) {\n renderer.copyFramebufferToTexture(screenPositionPixels, tempMap);\n let uniforms = material1a.uniforms;\n uniforms[\"scale\"].value = scale;\n uniforms[\"screenPosition\"].value = positionScreen;\n renderer.renderBufferDirect(camera, null, geometry2, material1a, mesh1, null);\n renderer.copyFramebufferToTexture(screenPositionPixels, occlusionMap);\n uniforms = material1b.uniforms;\n uniforms[\"scale\"].value = scale;\n uniforms[\"screenPosition\"].value = positionScreen;\n renderer.renderBufferDirect(camera, null, geometry2, material1b, mesh1, null);\n const vecX = -positionScreen.x * 2;\n const vecY = -positionScreen.y * 2;\n for (let i2 = 0, l = elements.length; i2 < l; i2++) {\n const element = elements[i2];\n const uniforms2 = material2.uniforms;\n uniforms2[\"color\"].value.copy(element.color);\n uniforms2[\"map\"].value = element.texture;\n uniforms2[\"screenPosition\"].value.x = positionScreen.x + vecX * element.distance;\n uniforms2[\"screenPosition\"].value.y = positionScreen.y + vecY * element.distance;\n size2 = element.size / viewport.w;\n const invAspect2 = viewport.w / viewport.z;\n uniforms2[\"scale\"].value.set(size2 * invAspect2, size2);\n material2.uniformsNeedUpdate = true;\n renderer.renderBufferDirect(camera, null, geometry2, material2, mesh2, null);\n }\n }\n };\n this.dispose = function() {\n material1a.dispose();\n material1b.dispose();\n material2.dispose();\n tempMap.dispose();\n occlusionMap.dispose();\n for (let i2 = 0, l = elements.length; i2 < l; i2++) {\n elements[i2].texture.dispose();\n }\n };\n }\n};\nlet Lensflare = _Lensflare;\n__publicField(Lensflare, \"Geometry\", geometry);\nclass LensflareElement {\n constructor(texture, size2 = 1, distance = 0, color = new three__WEBPACK_IMPORTED_MODULE_42__.Color(16777215)) {\n this.texture = texture;\n this.size = size2;\n this.distance = distance;\n this.color = color;\n }\n}\n__publicField(LensflareElement, \"Shader\", {\n uniforms: {\n map: { value: null },\n occlusionMap: { value: null },\n color: { value: null },\n scale: { value: null },\n screenPosition: { value: null }\n },\n vertexShader: (\n /* glsl */\n `\n\n\t\tprecision highp float;\n\n\t\tuniform vec3 screenPosition;\n\t\tuniform vec2 scale;\n\n\t\tuniform sampler2D occlusionMap;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\n\t\tvarying vec2 vUV;\n\t\tvarying float vVisibility;\n\n\t\tvoid main() {\n\n\t\t\tvUV = uv;\n\n\t\t\tvec2 pos = position.xy;\n\n\t\t\tvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );\n\n\t\t\tvVisibility = visibility.r / 9.0;\n\t\t\tvVisibility *= 1.0 - visibility.g / 9.0;\n\t\t\tvVisibility *= visibility.b / 9.0;\n\n\t\t\tgl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n\n\t\t}`\n ),\n fragmentShader: (\n /* glsl */\n `\n\n\t\tprecision highp float;\n\n\t\tuniform sampler2D map;\n\t\tuniform vec3 color;\n\n\t\tvarying vec2 vUV;\n\t\tvarying float vVisibility;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texture = texture2D( map, vUV );\n\t\t\ttexture.a *= vVisibility;\n\t\t\tgl_FragColor = texture;\n\t\t\tgl_FragColor.rgb *= color;\n\n\t\t}`\n )\n});\nclass Water extends three__WEBPACK_IMPORTED_MODULE_42__.Mesh {\n constructor(geometry2, options = {}) {\n super(geometry2);\n this.isWater = true;\n const scope = this;\n const textureWidth = options.textureWidth !== void 0 ? options.textureWidth : 512;\n const textureHeight = options.textureHeight !== void 0 ? options.textureHeight : 512;\n const clipBias = options.clipBias !== void 0 ? options.clipBias : 0;\n const alpha = options.alpha !== void 0 ? options.alpha : 1;\n const time = options.time !== void 0 ? options.time : 0;\n const normalSampler = options.waterNormals !== void 0 ? options.waterNormals : null;\n const sunDirection = options.sunDirection !== void 0 ? options.sunDirection : new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0.70707, 0.70707, 0);\n const sunColor = new three__WEBPACK_IMPORTED_MODULE_42__.Color(options.sunColor !== void 0 ? options.sunColor : 16777215);\n const waterColor = new three__WEBPACK_IMPORTED_MODULE_42__.Color(options.waterColor !== void 0 ? options.waterColor : 8355711);\n const eye = options.eye !== void 0 ? options.eye : new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 0, 0);\n const distortionScale = options.distortionScale !== void 0 ? options.distortionScale : 20;\n const side = options.side !== void 0 ? options.side : three__WEBPACK_IMPORTED_MODULE_42__.FrontSide;\n const fog = options.fog !== void 0 ? options.fog : false;\n const mirrorPlane = new three__WEBPACK_IMPORTED_MODULE_42__.Plane();\n const normal = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const mirrorWorldPosition = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const cameraWorldPosition = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const rotationMatrix2 = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n const lookAtPosition = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 0, -1);\n const clipPlane = new three__WEBPACK_IMPORTED_MODULE_42__.Vector4();\n const view = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const target = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const q = new three__WEBPACK_IMPORTED_MODULE_42__.Vector4();\n const textureMatrix = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n const mirrorCamera = new three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera();\n const renderTarget = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(textureWidth, textureHeight);\n const mirrorShader = {\n uniforms: three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.merge([\n three__WEBPACK_IMPORTED_MODULE_42__.UniformsLib[\"fog\"],\n three__WEBPACK_IMPORTED_MODULE_42__.UniformsLib[\"lights\"],\n {\n normalSampler: { value: null },\n mirrorSampler: { value: null },\n alpha: { value: 1 },\n time: { value: 0 },\n size: { value: 1 },\n distortionScale: { value: 20 },\n textureMatrix: { value: new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4() },\n sunColor: { value: new three__WEBPACK_IMPORTED_MODULE_42__.Color(8355711) },\n sunDirection: { value: new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0.70707, 0.70707, 0) },\n eye: { value: new three__WEBPACK_IMPORTED_MODULE_42__.Vector3() },\n waterColor: { value: new three__WEBPACK_IMPORTED_MODULE_42__.Color(5592405) }\n }\n ]),\n vertexShader: (\n /* glsl */\n `\n\t\t\t\tuniform mat4 textureMatrix;\n\t\t\t\tuniform float time;\n\n\t\t\t\tvarying vec4 mirrorCoord;\n\t\t\t\tvarying vec4 worldPosition;\n\n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\t\t\t\t\tmirrorCoord = modelMatrix * vec4( position, 1.0 );\n\t\t\t\t\tworldPosition = mirrorCoord.xyzw;\n\t\t\t\t\tmirrorCoord = textureMatrix * mirrorCoord;\n\t\t\t\t\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t\tgl_Position = projectionMatrix * mvPosition;\n\n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t}`\n ),\n fragmentShader: (\n /* glsl */\n `\n\t\t\t\tuniform sampler2D mirrorSampler;\n\t\t\t\tuniform float alpha;\n\t\t\t\tuniform float time;\n\t\t\t\tuniform float size;\n\t\t\t\tuniform float distortionScale;\n\t\t\t\tuniform sampler2D normalSampler;\n\t\t\t\tuniform vec3 sunColor;\n\t\t\t\tuniform vec3 sunDirection;\n\t\t\t\tuniform vec3 eye;\n\t\t\t\tuniform vec3 waterColor;\n\n\t\t\t\tvarying vec4 mirrorCoord;\n\t\t\t\tvarying vec4 worldPosition;\n\n\t\t\t\tvec4 getNoise( vec2 uv ) {\n\t\t\t\t\tvec2 uv0 = ( uv / 103.0 ) + vec2(time / 17.0, time / 29.0);\n\t\t\t\t\tvec2 uv1 = uv / 107.0-vec2( time / -19.0, time / 31.0 );\n\t\t\t\t\tvec2 uv2 = uv / vec2( 8907.0, 9803.0 ) + vec2( time / 101.0, time / 97.0 );\n\t\t\t\t\tvec2 uv3 = uv / vec2( 1091.0, 1027.0 ) - vec2( time / 109.0, time / -113.0 );\n\t\t\t\t\tvec4 noise = texture2D( normalSampler, uv0 ) +\n\t\t\t\t\t\ttexture2D( normalSampler, uv1 ) +\n\t\t\t\t\t\ttexture2D( normalSampler, uv2 ) +\n\t\t\t\t\t\ttexture2D( normalSampler, uv3 );\n\t\t\t\t\treturn noise * 0.5 - 1.0;\n\t\t\t\t}\n\n\t\t\t\tvoid sunLight( const vec3 surfaceNormal, const vec3 eyeDirection, float shiny, float spec, float diffuse, inout vec3 diffuseColor, inout vec3 specularColor ) {\n\t\t\t\t\tvec3 reflection = normalize( reflect( -sunDirection, surfaceNormal ) );\n\t\t\t\t\tfloat direction = max( 0.0, dot( eyeDirection, reflection ) );\n\t\t\t\t\tspecularColor += pow( direction, shiny ) * sunColor * spec;\n\t\t\t\t\tdiffuseColor += max( dot( sunDirection, surfaceNormal ), 0.0 ) * sunColor * diffuse;\n\t\t\t\t}\n\n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\t#include \n\t\t\t\t\tvec4 noise = getNoise( worldPosition.xz * size );\n\t\t\t\t\tvec3 surfaceNormal = normalize( noise.xzy * vec3( 1.5, 1.0, 1.5 ) );\n\n\t\t\t\t\tvec3 diffuseLight = vec3(0.0);\n\t\t\t\t\tvec3 specularLight = vec3(0.0);\n\n\t\t\t\t\tvec3 worldToEye = eye-worldPosition.xyz;\n\t\t\t\t\tvec3 eyeDirection = normalize( worldToEye );\n\t\t\t\t\tsunLight( surfaceNormal, eyeDirection, 100.0, 2.0, 0.5, diffuseLight, specularLight );\n\n\t\t\t\t\tfloat distance = length(worldToEye);\n\n\t\t\t\t\tvec2 distortion = surfaceNormal.xz * ( 0.001 + 1.0 / distance ) * distortionScale;\n\t\t\t\t\tvec3 reflectionSample = vec3( texture2D( mirrorSampler, mirrorCoord.xy / mirrorCoord.w + distortion ) );\n\n\t\t\t\t\tfloat theta = max( dot( eyeDirection, surfaceNormal ), 0.0 );\n\t\t\t\t\tfloat rf0 = 0.3;\n\t\t\t\t\tfloat reflectance = rf0 + ( 1.0 - rf0 ) * pow( ( 1.0 - theta ), 5.0 );\n\t\t\t\t\tvec3 scatter = max( 0.0, dot( surfaceNormal, eyeDirection ) ) * waterColor;\n\t\t\t\t\tvec3 albedo = mix( ( sunColor * diffuseLight * 0.3 + scatter ) * getShadowMask(), ( vec3( 0.1 ) + reflectionSample * 0.9 + reflectionSample * specularLight ), reflectance);\n\t\t\t\t\tvec3 outgoingLight = albedo;\n\t\t\t\t\tgl_FragColor = vec4( outgoingLight, alpha );\n\n\t\t\t\t\t#include \n\t\t\t\t\t#include <${parseInt(three__WEBPACK_IMPORTED_MODULE_42__.REVISION.replace(/\\D+/g, \"\")) >= 154 ? \"colorspace_fragment\" : \"encodings_fragment\"}>\n\t\t\t\t\t#include \t\n\t\t\t\t}`\n )\n };\n const material2 = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n fragmentShader: mirrorShader.fragmentShader,\n vertexShader: mirrorShader.vertexShader,\n uniforms: three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(mirrorShader.uniforms),\n lights: true,\n side,\n fog\n });\n material2.uniforms[\"mirrorSampler\"].value = renderTarget.texture;\n material2.uniforms[\"textureMatrix\"].value = textureMatrix;\n material2.uniforms[\"alpha\"].value = alpha;\n material2.uniforms[\"time\"].value = time;\n material2.uniforms[\"normalSampler\"].value = normalSampler;\n material2.uniforms[\"sunColor\"].value = sunColor;\n material2.uniforms[\"waterColor\"].value = waterColor;\n material2.uniforms[\"sunDirection\"].value = sunDirection;\n material2.uniforms[\"distortionScale\"].value = distortionScale;\n material2.uniforms[\"eye\"].value = eye;\n scope.material = material2;\n scope.onBeforeRender = function(renderer, scene, camera) {\n mirrorWorldPosition.setFromMatrixPosition(scope.matrixWorld);\n cameraWorldPosition.setFromMatrixPosition(camera.matrixWorld);\n rotationMatrix2.extractRotation(scope.matrixWorld);\n normal.set(0, 0, 1);\n normal.applyMatrix4(rotationMatrix2);\n view.subVectors(mirrorWorldPosition, cameraWorldPosition);\n if (view.dot(normal) > 0)\n return;\n view.reflect(normal).negate();\n view.add(mirrorWorldPosition);\n rotationMatrix2.extractRotation(camera.matrixWorld);\n lookAtPosition.set(0, 0, -1);\n lookAtPosition.applyMatrix4(rotationMatrix2);\n lookAtPosition.add(cameraWorldPosition);\n target.subVectors(mirrorWorldPosition, lookAtPosition);\n target.reflect(normal).negate();\n target.add(mirrorWorldPosition);\n mirrorCamera.position.copy(view);\n mirrorCamera.up.set(0, 1, 0);\n mirrorCamera.up.applyMatrix4(rotationMatrix2);\n mirrorCamera.up.reflect(normal);\n mirrorCamera.lookAt(target);\n mirrorCamera.far = camera.far;\n mirrorCamera.updateMatrixWorld();\n mirrorCamera.projectionMatrix.copy(camera.projectionMatrix);\n textureMatrix.set(0.5, 0, 0, 0.5, 0, 0.5, 0, 0.5, 0, 0, 0.5, 0.5, 0, 0, 0, 1);\n textureMatrix.multiply(mirrorCamera.projectionMatrix);\n textureMatrix.multiply(mirrorCamera.matrixWorldInverse);\n mirrorPlane.setFromNormalAndCoplanarPoint(normal, mirrorWorldPosition);\n mirrorPlane.applyMatrix4(mirrorCamera.matrixWorldInverse);\n clipPlane.set(mirrorPlane.normal.x, mirrorPlane.normal.y, mirrorPlane.normal.z, mirrorPlane.constant);\n const projectionMatrix = mirrorCamera.projectionMatrix;\n q.x = (Math.sign(clipPlane.x) + projectionMatrix.elements[8]) / projectionMatrix.elements[0];\n q.y = (Math.sign(clipPlane.y) + projectionMatrix.elements[9]) / projectionMatrix.elements[5];\n q.z = -1;\n q.w = (1 + projectionMatrix.elements[10]) / projectionMatrix.elements[14];\n clipPlane.multiplyScalar(2 / clipPlane.dot(q));\n projectionMatrix.elements[2] = clipPlane.x;\n projectionMatrix.elements[6] = clipPlane.y;\n projectionMatrix.elements[10] = clipPlane.z + 1 - clipBias;\n projectionMatrix.elements[14] = clipPlane.w;\n eye.setFromMatrixPosition(camera.matrixWorld);\n const currentRenderTarget = renderer.getRenderTarget();\n const currentXrEnabled = renderer.xr.enabled;\n const currentShadowAutoUpdate = renderer.shadowMap.autoUpdate;\n scope.visible = false;\n renderer.xr.enabled = false;\n renderer.shadowMap.autoUpdate = false;\n renderer.setRenderTarget(renderTarget);\n renderer.state.buffers.depth.setMask(true);\n if (renderer.autoClear === false)\n renderer.clear();\n renderer.render(scene, mirrorCamera);\n scope.visible = true;\n renderer.xr.enabled = currentXrEnabled;\n renderer.shadowMap.autoUpdate = currentShadowAutoUpdate;\n renderer.setRenderTarget(currentRenderTarget);\n const viewport = camera.viewport;\n if (viewport !== void 0) {\n renderer.state.viewport(viewport);\n }\n };\n }\n}\nclass MarchingCubes extends three__WEBPACK_IMPORTED_MODULE_42__.Mesh {\n constructor(resolution, material2, enableUvs = false, enableColors = false, maxPolyCount = 1e4) {\n const geometry2 = new three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry();\n super(geometry2, material2);\n this.isMarchingCubes = true;\n const scope = this;\n const vlist = new Float32Array(12 * 3);\n const nlist = new Float32Array(12 * 3);\n const clist = new Float32Array(12 * 3);\n this.enableUvs = enableUvs;\n this.enableColors = enableColors;\n this.init = function(resolution2) {\n this.resolution = resolution2;\n this.isolation = 80;\n this.size = resolution2;\n this.size2 = this.size * this.size;\n this.size3 = this.size2 * this.size;\n this.halfsize = this.size / 2;\n this.delta = 2 / this.size;\n this.yd = this.size;\n this.zd = this.size2;\n this.field = new Float32Array(this.size3);\n this.normal_cache = new Float32Array(this.size3 * 3);\n this.palette = new Float32Array(this.size3 * 3);\n this.count = 0;\n const maxVertexCount = maxPolyCount * 3;\n this.positionArray = new Float32Array(maxVertexCount * 3);\n const positionAttribute = new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(this.positionArray, 3);\n positionAttribute.setUsage(three__WEBPACK_IMPORTED_MODULE_42__.DynamicDrawUsage);\n geometry2.setAttribute(\"position\", positionAttribute);\n this.normalArray = new Float32Array(maxVertexCount * 3);\n const normalAttribute = new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(this.normalArray, 3);\n normalAttribute.setUsage(three__WEBPACK_IMPORTED_MODULE_42__.DynamicDrawUsage);\n geometry2.setAttribute(\"normal\", normalAttribute);\n if (this.enableUvs) {\n this.uvArray = new Float32Array(maxVertexCount * 2);\n const uvAttribute = new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(this.uvArray, 2);\n uvAttribute.setUsage(three__WEBPACK_IMPORTED_MODULE_42__.DynamicDrawUsage);\n geometry2.setAttribute(\"uv\", uvAttribute);\n }\n if (this.enableColors) {\n this.colorArray = new Float32Array(maxVertexCount * 3);\n const colorAttribute = new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(this.colorArray, 3);\n colorAttribute.setUsage(three__WEBPACK_IMPORTED_MODULE_42__.DynamicDrawUsage);\n geometry2.setAttribute(\"color\", colorAttribute);\n }\n geometry2.boundingSphere = new three__WEBPACK_IMPORTED_MODULE_42__.Sphere(new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(), 1);\n };\n function lerp2(a2, b2, t2) {\n return a2 + (b2 - a2) * t2;\n }\n function VIntX(q, offset, isol, x, y, z, valp1, valp2, c_offset1, c_offset2) {\n const mu = (isol - valp1) / (valp2 - valp1), nc = scope.normal_cache;\n vlist[offset + 0] = x + mu * scope.delta;\n vlist[offset + 1] = y;\n vlist[offset + 2] = z;\n nlist[offset + 0] = lerp2(nc[q + 0], nc[q + 3], mu);\n nlist[offset + 1] = lerp2(nc[q + 1], nc[q + 4], mu);\n nlist[offset + 2] = lerp2(nc[q + 2], nc[q + 5], mu);\n clist[offset + 0] = lerp2(scope.palette[c_offset1 * 3 + 0], scope.palette[c_offset2 * 3 + 0], mu);\n clist[offset + 1] = lerp2(scope.palette[c_offset1 * 3 + 1], scope.palette[c_offset2 * 3 + 1], mu);\n clist[offset + 2] = lerp2(scope.palette[c_offset1 * 3 + 2], scope.palette[c_offset2 * 3 + 2], mu);\n }\n function VIntY(q, offset, isol, x, y, z, valp1, valp2, c_offset1, c_offset2) {\n const mu = (isol - valp1) / (valp2 - valp1), nc = scope.normal_cache;\n vlist[offset + 0] = x;\n vlist[offset + 1] = y + mu * scope.delta;\n vlist[offset + 2] = z;\n const q2 = q + scope.yd * 3;\n nlist[offset + 0] = lerp2(nc[q + 0], nc[q2 + 0], mu);\n nlist[offset + 1] = lerp2(nc[q + 1], nc[q2 + 1], mu);\n nlist[offset + 2] = lerp2(nc[q + 2], nc[q2 + 2], mu);\n clist[offset + 0] = lerp2(scope.palette[c_offset1 * 3 + 0], scope.palette[c_offset2 * 3 + 0], mu);\n clist[offset + 1] = lerp2(scope.palette[c_offset1 * 3 + 1], scope.palette[c_offset2 * 3 + 1], mu);\n clist[offset + 2] = lerp2(scope.palette[c_offset1 * 3 + 2], scope.palette[c_offset2 * 3 + 2], mu);\n }\n function VIntZ(q, offset, isol, x, y, z, valp1, valp2, c_offset1, c_offset2) {\n const mu = (isol - valp1) / (valp2 - valp1), nc = scope.normal_cache;\n vlist[offset + 0] = x;\n vlist[offset + 1] = y;\n vlist[offset + 2] = z + mu * scope.delta;\n const q2 = q + scope.zd * 3;\n nlist[offset + 0] = lerp2(nc[q + 0], nc[q2 + 0], mu);\n nlist[offset + 1] = lerp2(nc[q + 1], nc[q2 + 1], mu);\n nlist[offset + 2] = lerp2(nc[q + 2], nc[q2 + 2], mu);\n clist[offset + 0] = lerp2(scope.palette[c_offset1 * 3 + 0], scope.palette[c_offset2 * 3 + 0], mu);\n clist[offset + 1] = lerp2(scope.palette[c_offset1 * 3 + 1], scope.palette[c_offset2 * 3 + 1], mu);\n clist[offset + 2] = lerp2(scope.palette[c_offset1 * 3 + 2], scope.palette[c_offset2 * 3 + 2], mu);\n }\n function compNorm(q) {\n const q3 = q * 3;\n if (scope.normal_cache[q3] === 0) {\n scope.normal_cache[q3 + 0] = scope.field[q - 1] - scope.field[q + 1];\n scope.normal_cache[q3 + 1] = scope.field[q - scope.yd] - scope.field[q + scope.yd];\n scope.normal_cache[q3 + 2] = scope.field[q - scope.zd] - scope.field[q + scope.zd];\n }\n }\n function polygonize(fx, fy, fz, q, isol) {\n const q1 = q + 1, qy = q + scope.yd, qz = q + scope.zd, q1y = q1 + scope.yd, q1z = q1 + scope.zd, qyz = q + scope.yd + scope.zd, q1yz = q1 + scope.yd + scope.zd;\n let cubeindex = 0;\n const field0 = scope.field[q], field1 = scope.field[q1], field2 = scope.field[qy], field3 = scope.field[q1y], field4 = scope.field[qz], field5 = scope.field[q1z], field6 = scope.field[qyz], field7 = scope.field[q1yz];\n if (field0 < isol)\n cubeindex |= 1;\n if (field1 < isol)\n cubeindex |= 2;\n if (field2 < isol)\n cubeindex |= 8;\n if (field3 < isol)\n cubeindex |= 4;\n if (field4 < isol)\n cubeindex |= 16;\n if (field5 < isol)\n cubeindex |= 32;\n if (field6 < isol)\n cubeindex |= 128;\n if (field7 < isol)\n cubeindex |= 64;\n const bits = edgeTable[cubeindex];\n if (bits === 0)\n return 0;\n const d = scope.delta, fx2 = fx + d, fy2 = fy + d, fz2 = fz + d;\n if (bits & 1) {\n compNorm(q);\n compNorm(q1);\n VIntX(q * 3, 0, isol, fx, fy, fz, field0, field1, q, q1);\n }\n if (bits & 2) {\n compNorm(q1);\n compNorm(q1y);\n VIntY(q1 * 3, 3, isol, fx2, fy, fz, field1, field3, q1, q1y);\n }\n if (bits & 4) {\n compNorm(qy);\n compNorm(q1y);\n VIntX(qy * 3, 6, isol, fx, fy2, fz, field2, field3, qy, q1y);\n }\n if (bits & 8) {\n compNorm(q);\n compNorm(qy);\n VIntY(q * 3, 9, isol, fx, fy, fz, field0, field2, q, qy);\n }\n if (bits & 16) {\n compNorm(qz);\n compNorm(q1z);\n VIntX(qz * 3, 12, isol, fx, fy, fz2, field4, field5, qz, q1z);\n }\n if (bits & 32) {\n compNorm(q1z);\n compNorm(q1yz);\n VIntY(q1z * 3, 15, isol, fx2, fy, fz2, field5, field7, q1z, q1yz);\n }\n if (bits & 64) {\n compNorm(qyz);\n compNorm(q1yz);\n VIntX(qyz * 3, 18, isol, fx, fy2, fz2, field6, field7, qyz, q1yz);\n }\n if (bits & 128) {\n compNorm(qz);\n compNorm(qyz);\n VIntY(qz * 3, 21, isol, fx, fy, fz2, field4, field6, qz, qyz);\n }\n if (bits & 256) {\n compNorm(q);\n compNorm(qz);\n VIntZ(q * 3, 24, isol, fx, fy, fz, field0, field4, q, qz);\n }\n if (bits & 512) {\n compNorm(q1);\n compNorm(q1z);\n VIntZ(q1 * 3, 27, isol, fx2, fy, fz, field1, field5, q1, q1z);\n }\n if (bits & 1024) {\n compNorm(q1y);\n compNorm(q1yz);\n VIntZ(q1y * 3, 30, isol, fx2, fy2, fz, field3, field7, q1y, q1yz);\n }\n if (bits & 2048) {\n compNorm(qy);\n compNorm(qyz);\n VIntZ(qy * 3, 33, isol, fx, fy2, fz, field2, field6, qy, qyz);\n }\n cubeindex <<= 4;\n let o1, o2, o3, numtris = 0, i2 = 0;\n while (triTable[cubeindex + i2] != -1) {\n o1 = cubeindex + i2;\n o2 = o1 + 1;\n o3 = o1 + 2;\n posnormtriv(vlist, nlist, clist, 3 * triTable[o1], 3 * triTable[o2], 3 * triTable[o3]);\n i2 += 3;\n numtris++;\n }\n return numtris;\n }\n function posnormtriv(pos, norm, colors, o1, o2, o3) {\n const c = scope.count * 3;\n scope.positionArray[c + 0] = pos[o1];\n scope.positionArray[c + 1] = pos[o1 + 1];\n scope.positionArray[c + 2] = pos[o1 + 2];\n scope.positionArray[c + 3] = pos[o2];\n scope.positionArray[c + 4] = pos[o2 + 1];\n scope.positionArray[c + 5] = pos[o2 + 2];\n scope.positionArray[c + 6] = pos[o3];\n scope.positionArray[c + 7] = pos[o3 + 1];\n scope.positionArray[c + 8] = pos[o3 + 2];\n if (scope.material.flatShading === true) {\n const nx = (norm[o1 + 0] + norm[o2 + 0] + norm[o3 + 0]) / 3;\n const ny = (norm[o1 + 1] + norm[o2 + 1] + norm[o3 + 1]) / 3;\n const nz = (norm[o1 + 2] + norm[o2 + 2] + norm[o3 + 2]) / 3;\n scope.normalArray[c + 0] = nx;\n scope.normalArray[c + 1] = ny;\n scope.normalArray[c + 2] = nz;\n scope.normalArray[c + 3] = nx;\n scope.normalArray[c + 4] = ny;\n scope.normalArray[c + 5] = nz;\n scope.normalArray[c + 6] = nx;\n scope.normalArray[c + 7] = ny;\n scope.normalArray[c + 8] = nz;\n } else {\n scope.normalArray[c + 0] = norm[o1 + 0];\n scope.normalArray[c + 1] = norm[o1 + 1];\n scope.normalArray[c + 2] = norm[o1 + 2];\n scope.normalArray[c + 3] = norm[o2 + 0];\n scope.normalArray[c + 4] = norm[o2 + 1];\n scope.normalArray[c + 5] = norm[o2 + 2];\n scope.normalArray[c + 6] = norm[o3 + 0];\n scope.normalArray[c + 7] = norm[o3 + 1];\n scope.normalArray[c + 8] = norm[o3 + 2];\n }\n if (scope.enableUvs) {\n const d = scope.count * 2;\n scope.uvArray[d + 0] = pos[o1 + 0];\n scope.uvArray[d + 1] = pos[o1 + 2];\n scope.uvArray[d + 2] = pos[o2 + 0];\n scope.uvArray[d + 3] = pos[o2 + 2];\n scope.uvArray[d + 4] = pos[o3 + 0];\n scope.uvArray[d + 5] = pos[o3 + 2];\n }\n if (scope.enableColors) {\n scope.colorArray[c + 0] = colors[o1 + 0];\n scope.colorArray[c + 1] = colors[o1 + 1];\n scope.colorArray[c + 2] = colors[o1 + 2];\n scope.colorArray[c + 3] = colors[o2 + 0];\n scope.colorArray[c + 4] = colors[o2 + 1];\n scope.colorArray[c + 5] = colors[o2 + 2];\n scope.colorArray[c + 6] = colors[o3 + 0];\n scope.colorArray[c + 7] = colors[o3 + 1];\n scope.colorArray[c + 8] = colors[o3 + 2];\n }\n scope.count += 3;\n }\n this.addBall = function(ballx, bally, ballz, strength, subtract, colors) {\n const sign = Math.sign(strength);\n strength = Math.abs(strength);\n const userDefineColor = !(colors === void 0 || colors === null);\n let ballColor = new three__WEBPACK_IMPORTED_MODULE_42__.Color(ballx, bally, ballz);\n if (userDefineColor) {\n try {\n ballColor = colors instanceof three__WEBPACK_IMPORTED_MODULE_42__.Color ? colors : Array.isArray(colors) ? new three__WEBPACK_IMPORTED_MODULE_42__.Color(\n Math.min(Math.abs(colors[0]), 1),\n Math.min(Math.abs(colors[1]), 1),\n Math.min(Math.abs(colors[2]), 1)\n ) : new three__WEBPACK_IMPORTED_MODULE_42__.Color(colors);\n } catch (err) {\n ballColor = new three__WEBPACK_IMPORTED_MODULE_42__.Color(ballx, bally, ballz);\n }\n }\n const radius = this.size * Math.sqrt(strength / subtract), zs = ballz * this.size, ys = bally * this.size, xs = ballx * this.size;\n let min_z = Math.floor(zs - radius);\n if (min_z < 1)\n min_z = 1;\n let max_z = Math.floor(zs + radius);\n if (max_z > this.size - 1)\n max_z = this.size - 1;\n let min_y = Math.floor(ys - radius);\n if (min_y < 1)\n min_y = 1;\n let max_y = Math.floor(ys + radius);\n if (max_y > this.size - 1)\n max_y = this.size - 1;\n let min_x = Math.floor(xs - radius);\n if (min_x < 1)\n min_x = 1;\n let max_x = Math.floor(xs + radius);\n if (max_x > this.size - 1)\n max_x = this.size - 1;\n let x, y, z, y_offset, z_offset, fx, fy, fz, fz2, fy2, val;\n for (z = min_z; z < max_z; z++) {\n z_offset = this.size2 * z;\n fz = z / this.size - ballz;\n fz2 = fz * fz;\n for (y = min_y; y < max_y; y++) {\n y_offset = z_offset + this.size * y;\n fy = y / this.size - bally;\n fy2 = fy * fy;\n for (x = min_x; x < max_x; x++) {\n fx = x / this.size - ballx;\n val = strength / (1e-6 + fx * fx + fy2 + fz2) - subtract;\n if (val > 0) {\n this.field[y_offset + x] += val * sign;\n const ratio = Math.sqrt((x - xs) * (x - xs) + (y - ys) * (y - ys) + (z - zs) * (z - zs)) / radius;\n const contrib = 1 - ratio * ratio * ratio * (ratio * (ratio * 6 - 15) + 10);\n this.palette[(y_offset + x) * 3 + 0] += ballColor.r * contrib;\n this.palette[(y_offset + x) * 3 + 1] += ballColor.g * contrib;\n this.palette[(y_offset + x) * 3 + 2] += ballColor.b * contrib;\n }\n }\n }\n }\n };\n this.addPlaneX = function(strength, subtract) {\n const size2 = this.size, yd = this.yd, zd = this.zd, field = this.field;\n let x, y, z, xx, val, xdiv, cxy, dist = size2 * Math.sqrt(strength / subtract);\n if (dist > size2)\n dist = size2;\n for (x = 0; x < dist; x++) {\n xdiv = x / size2;\n xx = xdiv * xdiv;\n val = strength / (1e-4 + xx) - subtract;\n if (val > 0) {\n for (y = 0; y < size2; y++) {\n cxy = x + y * yd;\n for (z = 0; z < size2; z++) {\n field[zd * z + cxy] += val;\n }\n }\n }\n }\n };\n this.addPlaneY = function(strength, subtract) {\n const size2 = this.size, yd = this.yd, zd = this.zd, field = this.field;\n let x, y, z, yy, val, ydiv, cy, cxy, dist = size2 * Math.sqrt(strength / subtract);\n if (dist > size2)\n dist = size2;\n for (y = 0; y < dist; y++) {\n ydiv = y / size2;\n yy = ydiv * ydiv;\n val = strength / (1e-4 + yy) - subtract;\n if (val > 0) {\n cy = y * yd;\n for (x = 0; x < size2; x++) {\n cxy = cy + x;\n for (z = 0; z < size2; z++)\n field[zd * z + cxy] += val;\n }\n }\n }\n };\n this.addPlaneZ = function(strength, subtract) {\n const size2 = this.size, yd = this.yd, zd = this.zd, field = this.field;\n let x, y, z, zz, val, zdiv, cz, cyz, dist = size2 * Math.sqrt(strength / subtract);\n if (dist > size2)\n dist = size2;\n for (z = 0; z < dist; z++) {\n zdiv = z / size2;\n zz = zdiv * zdiv;\n val = strength / (1e-4 + zz) - subtract;\n if (val > 0) {\n cz = zd * z;\n for (y = 0; y < size2; y++) {\n cyz = cz + y * yd;\n for (x = 0; x < size2; x++)\n field[cyz + x] += val;\n }\n }\n }\n };\n this.setCell = function(x, y, z, value) {\n const index = this.size2 * z + this.size * y + x;\n this.field[index] = value;\n };\n this.getCell = function(x, y, z) {\n const index = this.size2 * z + this.size * y + x;\n return this.field[index];\n };\n this.blur = function(intensity = 1) {\n const field = this.field;\n const fieldCopy = field.slice();\n const size2 = this.size;\n const size22 = this.size2;\n for (let x = 0; x < size2; x++) {\n for (let y = 0; y < size2; y++) {\n for (let z = 0; z < size2; z++) {\n const index = size22 * z + size2 * y + x;\n let val = fieldCopy[index];\n let count = 1;\n for (let x2 = -1; x2 <= 1; x2 += 2) {\n const x3 = x2 + x;\n if (x3 < 0 || x3 >= size2)\n continue;\n for (let y2 = -1; y2 <= 1; y2 += 2) {\n const y3 = y2 + y;\n if (y3 < 0 || y3 >= size2)\n continue;\n for (let z2 = -1; z2 <= 1; z2 += 2) {\n const z3 = z2 + z;\n if (z3 < 0 || z3 >= size2)\n continue;\n const index2 = size22 * z3 + size2 * y3 + x3;\n const val2 = fieldCopy[index2];\n count++;\n val += intensity * (val2 - val) / count;\n }\n }\n }\n field[index] = val;\n }\n }\n }\n };\n this.reset = function() {\n for (let i2 = 0; i2 < this.size3; i2++) {\n this.normal_cache[i2 * 3] = 0;\n this.field[i2] = 0;\n this.palette[i2 * 3] = this.palette[i2 * 3 + 1] = this.palette[i2 * 3 + 2] = 0;\n }\n };\n this.update = function() {\n this.count = 0;\n const smin2 = this.size - 2;\n for (let z = 1; z < smin2; z++) {\n const z_offset = this.size2 * z;\n const fz = (z - this.halfsize) / this.halfsize;\n for (let y = 1; y < smin2; y++) {\n const y_offset = z_offset + this.size * y;\n const fy = (y - this.halfsize) / this.halfsize;\n for (let x = 1; x < smin2; x++) {\n const fx = (x - this.halfsize) / this.halfsize;\n const q = y_offset + x;\n polygonize(fx, fy, fz, q, this.isolation);\n }\n }\n }\n this.geometry.setDrawRange(0, this.count);\n geometry2.getAttribute(\"position\").needsUpdate = true;\n geometry2.getAttribute(\"normal\").needsUpdate = true;\n if (this.enableUvs)\n geometry2.getAttribute(\"uv\").needsUpdate = true;\n if (this.enableColors)\n geometry2.getAttribute(\"color\").needsUpdate = true;\n if (this.count / 3 > maxPolyCount)\n console.warn(\n \"THREE.MarchingCubes: Geometry buffers too small for rendering. Please create an instance with a higher poly count.\"\n );\n };\n this.init(resolution);\n }\n}\nconst edgeTable = new Int32Array([\n 0,\n 265,\n 515,\n 778,\n 1030,\n 1295,\n 1541,\n 1804,\n 2060,\n 2309,\n 2575,\n 2822,\n 3082,\n 3331,\n 3593,\n 3840,\n 400,\n 153,\n 915,\n 666,\n 1430,\n 1183,\n 1941,\n 1692,\n 2460,\n 2197,\n 2975,\n 2710,\n 3482,\n 3219,\n 3993,\n 3728,\n 560,\n 825,\n 51,\n 314,\n 1590,\n 1855,\n 1077,\n 1340,\n 2620,\n 2869,\n 2111,\n 2358,\n 3642,\n 3891,\n 3129,\n 3376,\n 928,\n 681,\n 419,\n 170,\n 1958,\n 1711,\n 1445,\n 1196,\n 2988,\n 2725,\n 2479,\n 2214,\n 4010,\n 3747,\n 3497,\n 3232,\n 1120,\n 1385,\n 1635,\n 1898,\n 102,\n 367,\n 613,\n 876,\n 3180,\n 3429,\n 3695,\n 3942,\n 2154,\n 2403,\n 2665,\n 2912,\n 1520,\n 1273,\n 2035,\n 1786,\n 502,\n 255,\n 1013,\n 764,\n 3580,\n 3317,\n 4095,\n 3830,\n 2554,\n 2291,\n 3065,\n 2800,\n 1616,\n 1881,\n 1107,\n 1370,\n 598,\n 863,\n 85,\n 348,\n 3676,\n 3925,\n 3167,\n 3414,\n 2650,\n 2899,\n 2137,\n 2384,\n 1984,\n 1737,\n 1475,\n 1226,\n 966,\n 719,\n 453,\n 204,\n 4044,\n 3781,\n 3535,\n 3270,\n 3018,\n 2755,\n 2505,\n 2240,\n 2240,\n 2505,\n 2755,\n 3018,\n 3270,\n 3535,\n 3781,\n 4044,\n 204,\n 453,\n 719,\n 966,\n 1226,\n 1475,\n 1737,\n 1984,\n 2384,\n 2137,\n 2899,\n 2650,\n 3414,\n 3167,\n 3925,\n 3676,\n 348,\n 85,\n 863,\n 598,\n 1370,\n 1107,\n 1881,\n 1616,\n 2800,\n 3065,\n 2291,\n 2554,\n 3830,\n 4095,\n 3317,\n 3580,\n 764,\n 1013,\n 255,\n 502,\n 1786,\n 2035,\n 1273,\n 1520,\n 2912,\n 2665,\n 2403,\n 2154,\n 3942,\n 3695,\n 3429,\n 3180,\n 876,\n 613,\n 367,\n 102,\n 1898,\n 1635,\n 1385,\n 1120,\n 3232,\n 3497,\n 3747,\n 4010,\n 2214,\n 2479,\n 2725,\n 2988,\n 1196,\n 1445,\n 1711,\n 1958,\n 170,\n 419,\n 681,\n 928,\n 3376,\n 3129,\n 3891,\n 3642,\n 2358,\n 2111,\n 2869,\n 2620,\n 1340,\n 1077,\n 1855,\n 1590,\n 314,\n 51,\n 825,\n 560,\n 3728,\n 3993,\n 3219,\n 3482,\n 2710,\n 2975,\n 2197,\n 2460,\n 1692,\n 1941,\n 1183,\n 1430,\n 666,\n 915,\n 153,\n 400,\n 3840,\n 3593,\n 3331,\n 3082,\n 2822,\n 2575,\n 2309,\n 2060,\n 1804,\n 1541,\n 1295,\n 1030,\n 778,\n 515,\n 265,\n 0\n]);\nconst triTable = new Int32Array([\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 0,\n 8,\n 3,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 0,\n 1,\n 9,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 1,\n 8,\n 3,\n 9,\n 8,\n 1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 1,\n 2,\n 10,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 0,\n 8,\n 3,\n 1,\n 2,\n 10,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 9,\n 2,\n 10,\n 0,\n 2,\n 9,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 2,\n 8,\n 3,\n 2,\n 10,\n 8,\n 10,\n 9,\n 8,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 3,\n 11,\n 2,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 0,\n 11,\n 2,\n 8,\n 11,\n 0,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 1,\n 9,\n 0,\n 2,\n 3,\n 11,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 1,\n 11,\n 2,\n 1,\n 9,\n 11,\n 9,\n 8,\n 11,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 3,\n 10,\n 1,\n 11,\n 10,\n 3,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 0,\n 10,\n 1,\n 0,\n 8,\n 10,\n 8,\n 11,\n 10,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 3,\n 9,\n 0,\n 3,\n 11,\n 9,\n 11,\n 10,\n 9,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 9,\n 8,\n 10,\n 10,\n 8,\n 11,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 4,\n 7,\n 8,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 4,\n 3,\n 0,\n 7,\n 3,\n 4,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 0,\n 1,\n 9,\n 8,\n 4,\n 7,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 4,\n 1,\n 9,\n 4,\n 7,\n 1,\n 7,\n 3,\n 1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 1,\n 2,\n 10,\n 8,\n 4,\n 7,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 3,\n 4,\n 7,\n 3,\n 0,\n 4,\n 1,\n 2,\n 10,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 9,\n 2,\n 10,\n 9,\n 0,\n 2,\n 8,\n 4,\n 7,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 2,\n 10,\n 9,\n 2,\n 9,\n 7,\n 2,\n 7,\n 3,\n 7,\n 9,\n 4,\n -1,\n -1,\n -1,\n -1,\n 8,\n 4,\n 7,\n 3,\n 11,\n 2,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 11,\n 4,\n 7,\n 11,\n 2,\n 4,\n 2,\n 0,\n 4,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 9,\n 0,\n 1,\n 8,\n 4,\n 7,\n 2,\n 3,\n 11,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 4,\n 7,\n 11,\n 9,\n 4,\n 11,\n 9,\n 11,\n 2,\n 9,\n 2,\n 1,\n -1,\n -1,\n -1,\n -1,\n 3,\n 10,\n 1,\n 3,\n 11,\n 10,\n 7,\n 8,\n 4,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 1,\n 11,\n 10,\n 1,\n 4,\n 11,\n 1,\n 0,\n 4,\n 7,\n 11,\n 4,\n -1,\n -1,\n -1,\n -1,\n 4,\n 7,\n 8,\n 9,\n 0,\n 11,\n 9,\n 11,\n 10,\n 11,\n 0,\n 3,\n -1,\n -1,\n -1,\n -1,\n 4,\n 7,\n 11,\n 4,\n 11,\n 9,\n 9,\n 11,\n 10,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 9,\n 5,\n 4,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 9,\n 5,\n 4,\n 0,\n 8,\n 3,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 0,\n 5,\n 4,\n 1,\n 5,\n 0,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 8,\n 5,\n 4,\n 8,\n 3,\n 5,\n 3,\n 1,\n 5,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 1,\n 2,\n 10,\n 9,\n 5,\n 4,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 3,\n 0,\n 8,\n 1,\n 2,\n 10,\n 4,\n 9,\n 5,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 5,\n 2,\n 10,\n 5,\n 4,\n 2,\n 4,\n 0,\n 2,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 2,\n 10,\n 5,\n 3,\n 2,\n 5,\n 3,\n 5,\n 4,\n 3,\n 4,\n 8,\n -1,\n -1,\n -1,\n -1,\n 9,\n 5,\n 4,\n 2,\n 3,\n 11,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 0,\n 11,\n 2,\n 0,\n 8,\n 11,\n 4,\n 9,\n 5,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 0,\n 5,\n 4,\n 0,\n 1,\n 5,\n 2,\n 3,\n 11,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 2,\n 1,\n 5,\n 2,\n 5,\n 8,\n 2,\n 8,\n 11,\n 4,\n 8,\n 5,\n -1,\n -1,\n -1,\n -1,\n 10,\n 3,\n 11,\n 10,\n 1,\n 3,\n 9,\n 5,\n 4,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 4,\n 9,\n 5,\n 0,\n 8,\n 1,\n 8,\n 10,\n 1,\n 8,\n 11,\n 10,\n -1,\n -1,\n -1,\n -1,\n 5,\n 4,\n 0,\n 5,\n 0,\n 11,\n 5,\n 11,\n 10,\n 11,\n 0,\n 3,\n -1,\n -1,\n -1,\n -1,\n 5,\n 4,\n 8,\n 5,\n 8,\n 10,\n 10,\n 8,\n 11,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 9,\n 7,\n 8,\n 5,\n 7,\n 9,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 9,\n 3,\n 0,\n 9,\n 5,\n 3,\n 5,\n 7,\n 3,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 0,\n 7,\n 8,\n 0,\n 1,\n 7,\n 1,\n 5,\n 7,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 1,\n 5,\n 3,\n 3,\n 5,\n 7,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 9,\n 7,\n 8,\n 9,\n 5,\n 7,\n 10,\n 1,\n 2,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 10,\n 1,\n 2,\n 9,\n 5,\n 0,\n 5,\n 3,\n 0,\n 5,\n 7,\n 3,\n -1,\n -1,\n -1,\n -1,\n 8,\n 0,\n 2,\n 8,\n 2,\n 5,\n 8,\n 5,\n 7,\n 10,\n 5,\n 2,\n -1,\n -1,\n -1,\n -1,\n 2,\n 10,\n 5,\n 2,\n 5,\n 3,\n 3,\n 5,\n 7,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 7,\n 9,\n 5,\n 7,\n 8,\n 9,\n 3,\n 11,\n 2,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 9,\n 5,\n 7,\n 9,\n 7,\n 2,\n 9,\n 2,\n 0,\n 2,\n 7,\n 11,\n -1,\n -1,\n -1,\n -1,\n 2,\n 3,\n 11,\n 0,\n 1,\n 8,\n 1,\n 7,\n 8,\n 1,\n 5,\n 7,\n -1,\n -1,\n -1,\n -1,\n 11,\n 2,\n 1,\n 11,\n 1,\n 7,\n 7,\n 1,\n 5,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 9,\n 5,\n 8,\n 8,\n 5,\n 7,\n 10,\n 1,\n 3,\n 10,\n 3,\n 11,\n -1,\n -1,\n -1,\n -1,\n 5,\n 7,\n 0,\n 5,\n 0,\n 9,\n 7,\n 11,\n 0,\n 1,\n 0,\n 10,\n 11,\n 10,\n 0,\n -1,\n 11,\n 10,\n 0,\n 11,\n 0,\n 3,\n 10,\n 5,\n 0,\n 8,\n 0,\n 7,\n 5,\n 7,\n 0,\n -1,\n 11,\n 10,\n 5,\n 7,\n 11,\n 5,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 10,\n 6,\n 5,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 0,\n 8,\n 3,\n 5,\n 10,\n 6,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 9,\n 0,\n 1,\n 5,\n 10,\n 6,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 1,\n 8,\n 3,\n 1,\n 9,\n 8,\n 5,\n 10,\n 6,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 1,\n 6,\n 5,\n 2,\n 6,\n 1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 1,\n 6,\n 5,\n 1,\n 2,\n 6,\n 3,\n 0,\n 8,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 9,\n 6,\n 5,\n 9,\n 0,\n 6,\n 0,\n 2,\n 6,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 5,\n 9,\n 8,\n 5,\n 8,\n 2,\n 5,\n 2,\n 6,\n 3,\n 2,\n 8,\n -1,\n -1,\n -1,\n -1,\n 2,\n 3,\n 11,\n 10,\n 6,\n 5,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 11,\n 0,\n 8,\n 11,\n 2,\n 0,\n 10,\n 6,\n 5,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 0,\n 1,\n 9,\n 2,\n 3,\n 11,\n 5,\n 10,\n 6,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 5,\n 10,\n 6,\n 1,\n 9,\n 2,\n 9,\n 11,\n 2,\n 9,\n 8,\n 11,\n -1,\n -1,\n -1,\n -1,\n 6,\n 3,\n 11,\n 6,\n 5,\n 3,\n 5,\n 1,\n 3,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 0,\n 8,\n 11,\n 0,\n 11,\n 5,\n 0,\n 5,\n 1,\n 5,\n 11,\n 6,\n -1,\n -1,\n -1,\n -1,\n 3,\n 11,\n 6,\n 0,\n 3,\n 6,\n 0,\n 6,\n 5,\n 0,\n 5,\n 9,\n -1,\n -1,\n -1,\n -1,\n 6,\n 5,\n 9,\n 6,\n 9,\n 11,\n 11,\n 9,\n 8,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 5,\n 10,\n 6,\n 4,\n 7,\n 8,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 4,\n 3,\n 0,\n 4,\n 7,\n 3,\n 6,\n 5,\n 10,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 1,\n 9,\n 0,\n 5,\n 10,\n 6,\n 8,\n 4,\n 7,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 10,\n 6,\n 5,\n 1,\n 9,\n 7,\n 1,\n 7,\n 3,\n 7,\n 9,\n 4,\n -1,\n -1,\n -1,\n -1,\n 6,\n 1,\n 2,\n 6,\n 5,\n 1,\n 4,\n 7,\n 8,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 1,\n 2,\n 5,\n 5,\n 2,\n 6,\n 3,\n 0,\n 4,\n 3,\n 4,\n 7,\n -1,\n -1,\n -1,\n -1,\n 8,\n 4,\n 7,\n 9,\n 0,\n 5,\n 0,\n 6,\n 5,\n 0,\n 2,\n 6,\n -1,\n -1,\n -1,\n -1,\n 7,\n 3,\n 9,\n 7,\n 9,\n 4,\n 3,\n 2,\n 9,\n 5,\n 9,\n 6,\n 2,\n 6,\n 9,\n -1,\n 3,\n 11,\n 2,\n 7,\n 8,\n 4,\n 10,\n 6,\n 5,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 5,\n 10,\n 6,\n 4,\n 7,\n 2,\n 4,\n 2,\n 0,\n 2,\n 7,\n 11,\n -1,\n -1,\n -1,\n -1,\n 0,\n 1,\n 9,\n 4,\n 7,\n 8,\n 2,\n 3,\n 11,\n 5,\n 10,\n 6,\n -1,\n -1,\n -1,\n -1,\n 9,\n 2,\n 1,\n 9,\n 11,\n 2,\n 9,\n 4,\n 11,\n 7,\n 11,\n 4,\n 5,\n 10,\n 6,\n -1,\n 8,\n 4,\n 7,\n 3,\n 11,\n 5,\n 3,\n 5,\n 1,\n 5,\n 11,\n 6,\n -1,\n -1,\n -1,\n -1,\n 5,\n 1,\n 11,\n 5,\n 11,\n 6,\n 1,\n 0,\n 11,\n 7,\n 11,\n 4,\n 0,\n 4,\n 11,\n -1,\n 0,\n 5,\n 9,\n 0,\n 6,\n 5,\n 0,\n 3,\n 6,\n 11,\n 6,\n 3,\n 8,\n 4,\n 7,\n -1,\n 6,\n 5,\n 9,\n 6,\n 9,\n 11,\n 4,\n 7,\n 9,\n 7,\n 11,\n 9,\n -1,\n -1,\n -1,\n -1,\n 10,\n 4,\n 9,\n 6,\n 4,\n 10,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 4,\n 10,\n 6,\n 4,\n 9,\n 10,\n 0,\n 8,\n 3,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 10,\n 0,\n 1,\n 10,\n 6,\n 0,\n 6,\n 4,\n 0,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 8,\n 3,\n 1,\n 8,\n 1,\n 6,\n 8,\n 6,\n 4,\n 6,\n 1,\n 10,\n -1,\n -1,\n -1,\n -1,\n 1,\n 4,\n 9,\n 1,\n 2,\n 4,\n 2,\n 6,\n 4,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 3,\n 0,\n 8,\n 1,\n 2,\n 9,\n 2,\n 4,\n 9,\n 2,\n 6,\n 4,\n -1,\n -1,\n -1,\n -1,\n 0,\n 2,\n 4,\n 4,\n 2,\n 6,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 8,\n 3,\n 2,\n 8,\n 2,\n 4,\n 4,\n 2,\n 6,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 10,\n 4,\n 9,\n 10,\n 6,\n 4,\n 11,\n 2,\n 3,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 0,\n 8,\n 2,\n 2,\n 8,\n 11,\n 4,\n 9,\n 10,\n 4,\n 10,\n 6,\n -1,\n -1,\n -1,\n -1,\n 3,\n 11,\n 2,\n 0,\n 1,\n 6,\n 0,\n 6,\n 4,\n 6,\n 1,\n 10,\n -1,\n -1,\n -1,\n -1,\n 6,\n 4,\n 1,\n 6,\n 1,\n 10,\n 4,\n 8,\n 1,\n 2,\n 1,\n 11,\n 8,\n 11,\n 1,\n -1,\n 9,\n 6,\n 4,\n 9,\n 3,\n 6,\n 9,\n 1,\n 3,\n 11,\n 6,\n 3,\n -1,\n -1,\n -1,\n -1,\n 8,\n 11,\n 1,\n 8,\n 1,\n 0,\n 11,\n 6,\n 1,\n 9,\n 1,\n 4,\n 6,\n 4,\n 1,\n -1,\n 3,\n 11,\n 6,\n 3,\n 6,\n 0,\n 0,\n 6,\n 4,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 6,\n 4,\n 8,\n 11,\n 6,\n 8,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 7,\n 10,\n 6,\n 7,\n 8,\n 10,\n 8,\n 9,\n 10,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 0,\n 7,\n 3,\n 0,\n 10,\n 7,\n 0,\n 9,\n 10,\n 6,\n 7,\n 10,\n -1,\n -1,\n -1,\n -1,\n 10,\n 6,\n 7,\n 1,\n 10,\n 7,\n 1,\n 7,\n 8,\n 1,\n 8,\n 0,\n -1,\n -1,\n -1,\n -1,\n 10,\n 6,\n 7,\n 10,\n 7,\n 1,\n 1,\n 7,\n 3,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 1,\n 2,\n 6,\n 1,\n 6,\n 8,\n 1,\n 8,\n 9,\n 8,\n 6,\n 7,\n -1,\n -1,\n -1,\n -1,\n 2,\n 6,\n 9,\n 2,\n 9,\n 1,\n 6,\n 7,\n 9,\n 0,\n 9,\n 3,\n 7,\n 3,\n 9,\n -1,\n 7,\n 8,\n 0,\n 7,\n 0,\n 6,\n 6,\n 0,\n 2,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 7,\n 3,\n 2,\n 6,\n 7,\n 2,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 2,\n 3,\n 11,\n 10,\n 6,\n 8,\n 10,\n 8,\n 9,\n 8,\n 6,\n 7,\n -1,\n -1,\n -1,\n -1,\n 2,\n 0,\n 7,\n 2,\n 7,\n 11,\n 0,\n 9,\n 7,\n 6,\n 7,\n 10,\n 9,\n 10,\n 7,\n -1,\n 1,\n 8,\n 0,\n 1,\n 7,\n 8,\n 1,\n 10,\n 7,\n 6,\n 7,\n 10,\n 2,\n 3,\n 11,\n -1,\n 11,\n 2,\n 1,\n 11,\n 1,\n 7,\n 10,\n 6,\n 1,\n 6,\n 7,\n 1,\n -1,\n -1,\n -1,\n -1,\n 8,\n 9,\n 6,\n 8,\n 6,\n 7,\n 9,\n 1,\n 6,\n 11,\n 6,\n 3,\n 1,\n 3,\n 6,\n -1,\n 0,\n 9,\n 1,\n 11,\n 6,\n 7,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 7,\n 8,\n 0,\n 7,\n 0,\n 6,\n 3,\n 11,\n 0,\n 11,\n 6,\n 0,\n -1,\n -1,\n -1,\n -1,\n 7,\n 11,\n 6,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 7,\n 6,\n 11,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 3,\n 0,\n 8,\n 11,\n 7,\n 6,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 0,\n 1,\n 9,\n 11,\n 7,\n 6,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 8,\n 1,\n 9,\n 8,\n 3,\n 1,\n 11,\n 7,\n 6,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 10,\n 1,\n 2,\n 6,\n 11,\n 7,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 1,\n 2,\n 10,\n 3,\n 0,\n 8,\n 6,\n 11,\n 7,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 2,\n 9,\n 0,\n 2,\n 10,\n 9,\n 6,\n 11,\n 7,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 6,\n 11,\n 7,\n 2,\n 10,\n 3,\n 10,\n 8,\n 3,\n 10,\n 9,\n 8,\n -1,\n -1,\n -1,\n -1,\n 7,\n 2,\n 3,\n 6,\n 2,\n 7,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 7,\n 0,\n 8,\n 7,\n 6,\n 0,\n 6,\n 2,\n 0,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 2,\n 7,\n 6,\n 2,\n 3,\n 7,\n 0,\n 1,\n 9,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 1,\n 6,\n 2,\n 1,\n 8,\n 6,\n 1,\n 9,\n 8,\n 8,\n 7,\n 6,\n -1,\n -1,\n -1,\n -1,\n 10,\n 7,\n 6,\n 10,\n 1,\n 7,\n 1,\n 3,\n 7,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 10,\n 7,\n 6,\n 1,\n 7,\n 10,\n 1,\n 8,\n 7,\n 1,\n 0,\n 8,\n -1,\n -1,\n -1,\n -1,\n 0,\n 3,\n 7,\n 0,\n 7,\n 10,\n 0,\n 10,\n 9,\n 6,\n 10,\n 7,\n -1,\n -1,\n -1,\n -1,\n 7,\n 6,\n 10,\n 7,\n 10,\n 8,\n 8,\n 10,\n 9,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 6,\n 8,\n 4,\n 11,\n 8,\n 6,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 3,\n 6,\n 11,\n 3,\n 0,\n 6,\n 0,\n 4,\n 6,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 8,\n 6,\n 11,\n 8,\n 4,\n 6,\n 9,\n 0,\n 1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 9,\n 4,\n 6,\n 9,\n 6,\n 3,\n 9,\n 3,\n 1,\n 11,\n 3,\n 6,\n -1,\n -1,\n -1,\n -1,\n 6,\n 8,\n 4,\n 6,\n 11,\n 8,\n 2,\n 10,\n 1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 1,\n 2,\n 10,\n 3,\n 0,\n 11,\n 0,\n 6,\n 11,\n 0,\n 4,\n 6,\n -1,\n -1,\n -1,\n -1,\n 4,\n 11,\n 8,\n 4,\n 6,\n 11,\n 0,\n 2,\n 9,\n 2,\n 10,\n 9,\n -1,\n -1,\n -1,\n -1,\n 10,\n 9,\n 3,\n 10,\n 3,\n 2,\n 9,\n 4,\n 3,\n 11,\n 3,\n 6,\n 4,\n 6,\n 3,\n -1,\n 8,\n 2,\n 3,\n 8,\n 4,\n 2,\n 4,\n 6,\n 2,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 0,\n 4,\n 2,\n 4,\n 6,\n 2,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 1,\n 9,\n 0,\n 2,\n 3,\n 4,\n 2,\n 4,\n 6,\n 4,\n 3,\n 8,\n -1,\n -1,\n -1,\n -1,\n 1,\n 9,\n 4,\n 1,\n 4,\n 2,\n 2,\n 4,\n 6,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 8,\n 1,\n 3,\n 8,\n 6,\n 1,\n 8,\n 4,\n 6,\n 6,\n 10,\n 1,\n -1,\n -1,\n -1,\n -1,\n 10,\n 1,\n 0,\n 10,\n 0,\n 6,\n 6,\n 0,\n 4,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 4,\n 6,\n 3,\n 4,\n 3,\n 8,\n 6,\n 10,\n 3,\n 0,\n 3,\n 9,\n 10,\n 9,\n 3,\n -1,\n 10,\n 9,\n 4,\n 6,\n 10,\n 4,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 4,\n 9,\n 5,\n 7,\n 6,\n 11,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 0,\n 8,\n 3,\n 4,\n 9,\n 5,\n 11,\n 7,\n 6,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 5,\n 0,\n 1,\n 5,\n 4,\n 0,\n 7,\n 6,\n 11,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 11,\n 7,\n 6,\n 8,\n 3,\n 4,\n 3,\n 5,\n 4,\n 3,\n 1,\n 5,\n -1,\n -1,\n -1,\n -1,\n 9,\n 5,\n 4,\n 10,\n 1,\n 2,\n 7,\n 6,\n 11,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 6,\n 11,\n 7,\n 1,\n 2,\n 10,\n 0,\n 8,\n 3,\n 4,\n 9,\n 5,\n -1,\n -1,\n -1,\n -1,\n 7,\n 6,\n 11,\n 5,\n 4,\n 10,\n 4,\n 2,\n 10,\n 4,\n 0,\n 2,\n -1,\n -1,\n -1,\n -1,\n 3,\n 4,\n 8,\n 3,\n 5,\n 4,\n 3,\n 2,\n 5,\n 10,\n 5,\n 2,\n 11,\n 7,\n 6,\n -1,\n 7,\n 2,\n 3,\n 7,\n 6,\n 2,\n 5,\n 4,\n 9,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 9,\n 5,\n 4,\n 0,\n 8,\n 6,\n 0,\n 6,\n 2,\n 6,\n 8,\n 7,\n -1,\n -1,\n -1,\n -1,\n 3,\n 6,\n 2,\n 3,\n 7,\n 6,\n 1,\n 5,\n 0,\n 5,\n 4,\n 0,\n -1,\n -1,\n -1,\n -1,\n 6,\n 2,\n 8,\n 6,\n 8,\n 7,\n 2,\n 1,\n 8,\n 4,\n 8,\n 5,\n 1,\n 5,\n 8,\n -1,\n 9,\n 5,\n 4,\n 10,\n 1,\n 6,\n 1,\n 7,\n 6,\n 1,\n 3,\n 7,\n -1,\n -1,\n -1,\n -1,\n 1,\n 6,\n 10,\n 1,\n 7,\n 6,\n 1,\n 0,\n 7,\n 8,\n 7,\n 0,\n 9,\n 5,\n 4,\n -1,\n 4,\n 0,\n 10,\n 4,\n 10,\n 5,\n 0,\n 3,\n 10,\n 6,\n 10,\n 7,\n 3,\n 7,\n 10,\n -1,\n 7,\n 6,\n 10,\n 7,\n 10,\n 8,\n 5,\n 4,\n 10,\n 4,\n 8,\n 10,\n -1,\n -1,\n -1,\n -1,\n 6,\n 9,\n 5,\n 6,\n 11,\n 9,\n 11,\n 8,\n 9,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 3,\n 6,\n 11,\n 0,\n 6,\n 3,\n 0,\n 5,\n 6,\n 0,\n 9,\n 5,\n -1,\n -1,\n -1,\n -1,\n 0,\n 11,\n 8,\n 0,\n 5,\n 11,\n 0,\n 1,\n 5,\n 5,\n 6,\n 11,\n -1,\n -1,\n -1,\n -1,\n 6,\n 11,\n 3,\n 6,\n 3,\n 5,\n 5,\n 3,\n 1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 1,\n 2,\n 10,\n 9,\n 5,\n 11,\n 9,\n 11,\n 8,\n 11,\n 5,\n 6,\n -1,\n -1,\n -1,\n -1,\n 0,\n 11,\n 3,\n 0,\n 6,\n 11,\n 0,\n 9,\n 6,\n 5,\n 6,\n 9,\n 1,\n 2,\n 10,\n -1,\n 11,\n 8,\n 5,\n 11,\n 5,\n 6,\n 8,\n 0,\n 5,\n 10,\n 5,\n 2,\n 0,\n 2,\n 5,\n -1,\n 6,\n 11,\n 3,\n 6,\n 3,\n 5,\n 2,\n 10,\n 3,\n 10,\n 5,\n 3,\n -1,\n -1,\n -1,\n -1,\n 5,\n 8,\n 9,\n 5,\n 2,\n 8,\n 5,\n 6,\n 2,\n 3,\n 8,\n 2,\n -1,\n -1,\n -1,\n -1,\n 9,\n 5,\n 6,\n 9,\n 6,\n 0,\n 0,\n 6,\n 2,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 1,\n 5,\n 8,\n 1,\n 8,\n 0,\n 5,\n 6,\n 8,\n 3,\n 8,\n 2,\n 6,\n 2,\n 8,\n -1,\n 1,\n 5,\n 6,\n 2,\n 1,\n 6,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 1,\n 3,\n 6,\n 1,\n 6,\n 10,\n 3,\n 8,\n 6,\n 5,\n 6,\n 9,\n 8,\n 9,\n 6,\n -1,\n 10,\n 1,\n 0,\n 10,\n 0,\n 6,\n 9,\n 5,\n 0,\n 5,\n 6,\n 0,\n -1,\n -1,\n -1,\n -1,\n 0,\n 3,\n 8,\n 5,\n 6,\n 10,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 10,\n 5,\n 6,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 11,\n 5,\n 10,\n 7,\n 5,\n 11,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 11,\n 5,\n 10,\n 11,\n 7,\n 5,\n 8,\n 3,\n 0,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 5,\n 11,\n 7,\n 5,\n 10,\n 11,\n 1,\n 9,\n 0,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 10,\n 7,\n 5,\n 10,\n 11,\n 7,\n 9,\n 8,\n 1,\n 8,\n 3,\n 1,\n -1,\n -1,\n -1,\n -1,\n 11,\n 1,\n 2,\n 11,\n 7,\n 1,\n 7,\n 5,\n 1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 0,\n 8,\n 3,\n 1,\n 2,\n 7,\n 1,\n 7,\n 5,\n 7,\n 2,\n 11,\n -1,\n -1,\n -1,\n -1,\n 9,\n 7,\n 5,\n 9,\n 2,\n 7,\n 9,\n 0,\n 2,\n 2,\n 11,\n 7,\n -1,\n -1,\n -1,\n -1,\n 7,\n 5,\n 2,\n 7,\n 2,\n 11,\n 5,\n 9,\n 2,\n 3,\n 2,\n 8,\n 9,\n 8,\n 2,\n -1,\n 2,\n 5,\n 10,\n 2,\n 3,\n 5,\n 3,\n 7,\n 5,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 8,\n 2,\n 0,\n 8,\n 5,\n 2,\n 8,\n 7,\n 5,\n 10,\n 2,\n 5,\n -1,\n -1,\n -1,\n -1,\n 9,\n 0,\n 1,\n 5,\n 10,\n 3,\n 5,\n 3,\n 7,\n 3,\n 10,\n 2,\n -1,\n -1,\n -1,\n -1,\n 9,\n 8,\n 2,\n 9,\n 2,\n 1,\n 8,\n 7,\n 2,\n 10,\n 2,\n 5,\n 7,\n 5,\n 2,\n -1,\n 1,\n 3,\n 5,\n 3,\n 7,\n 5,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 0,\n 8,\n 7,\n 0,\n 7,\n 1,\n 1,\n 7,\n 5,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 9,\n 0,\n 3,\n 9,\n 3,\n 5,\n 5,\n 3,\n 7,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 9,\n 8,\n 7,\n 5,\n 9,\n 7,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 5,\n 8,\n 4,\n 5,\n 10,\n 8,\n 10,\n 11,\n 8,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 5,\n 0,\n 4,\n 5,\n 11,\n 0,\n 5,\n 10,\n 11,\n 11,\n 3,\n 0,\n -1,\n -1,\n -1,\n -1,\n 0,\n 1,\n 9,\n 8,\n 4,\n 10,\n 8,\n 10,\n 11,\n 10,\n 4,\n 5,\n -1,\n -1,\n -1,\n -1,\n 10,\n 11,\n 4,\n 10,\n 4,\n 5,\n 11,\n 3,\n 4,\n 9,\n 4,\n 1,\n 3,\n 1,\n 4,\n -1,\n 2,\n 5,\n 1,\n 2,\n 8,\n 5,\n 2,\n 11,\n 8,\n 4,\n 5,\n 8,\n -1,\n -1,\n -1,\n -1,\n 0,\n 4,\n 11,\n 0,\n 11,\n 3,\n 4,\n 5,\n 11,\n 2,\n 11,\n 1,\n 5,\n 1,\n 11,\n -1,\n 0,\n 2,\n 5,\n 0,\n 5,\n 9,\n 2,\n 11,\n 5,\n 4,\n 5,\n 8,\n 11,\n 8,\n 5,\n -1,\n 9,\n 4,\n 5,\n 2,\n 11,\n 3,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 2,\n 5,\n 10,\n 3,\n 5,\n 2,\n 3,\n 4,\n 5,\n 3,\n 8,\n 4,\n -1,\n -1,\n -1,\n -1,\n 5,\n 10,\n 2,\n 5,\n 2,\n 4,\n 4,\n 2,\n 0,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 3,\n 10,\n 2,\n 3,\n 5,\n 10,\n 3,\n 8,\n 5,\n 4,\n 5,\n 8,\n 0,\n 1,\n 9,\n -1,\n 5,\n 10,\n 2,\n 5,\n 2,\n 4,\n 1,\n 9,\n 2,\n 9,\n 4,\n 2,\n -1,\n -1,\n -1,\n -1,\n 8,\n 4,\n 5,\n 8,\n 5,\n 3,\n 3,\n 5,\n 1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 0,\n 4,\n 5,\n 1,\n 0,\n 5,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 8,\n 4,\n 5,\n 8,\n 5,\n 3,\n 9,\n 0,\n 5,\n 0,\n 3,\n 5,\n -1,\n -1,\n -1,\n -1,\n 9,\n 4,\n 5,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 4,\n 11,\n 7,\n 4,\n 9,\n 11,\n 9,\n 10,\n 11,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 0,\n 8,\n 3,\n 4,\n 9,\n 7,\n 9,\n 11,\n 7,\n 9,\n 10,\n 11,\n -1,\n -1,\n -1,\n -1,\n 1,\n 10,\n 11,\n 1,\n 11,\n 4,\n 1,\n 4,\n 0,\n 7,\n 4,\n 11,\n -1,\n -1,\n -1,\n -1,\n 3,\n 1,\n 4,\n 3,\n 4,\n 8,\n 1,\n 10,\n 4,\n 7,\n 4,\n 11,\n 10,\n 11,\n 4,\n -1,\n 4,\n 11,\n 7,\n 9,\n 11,\n 4,\n 9,\n 2,\n 11,\n 9,\n 1,\n 2,\n -1,\n -1,\n -1,\n -1,\n 9,\n 7,\n 4,\n 9,\n 11,\n 7,\n 9,\n 1,\n 11,\n 2,\n 11,\n 1,\n 0,\n 8,\n 3,\n -1,\n 11,\n 7,\n 4,\n 11,\n 4,\n 2,\n 2,\n 4,\n 0,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 11,\n 7,\n 4,\n 11,\n 4,\n 2,\n 8,\n 3,\n 4,\n 3,\n 2,\n 4,\n -1,\n -1,\n -1,\n -1,\n 2,\n 9,\n 10,\n 2,\n 7,\n 9,\n 2,\n 3,\n 7,\n 7,\n 4,\n 9,\n -1,\n -1,\n -1,\n -1,\n 9,\n 10,\n 7,\n 9,\n 7,\n 4,\n 10,\n 2,\n 7,\n 8,\n 7,\n 0,\n 2,\n 0,\n 7,\n -1,\n 3,\n 7,\n 10,\n 3,\n 10,\n 2,\n 7,\n 4,\n 10,\n 1,\n 10,\n 0,\n 4,\n 0,\n 10,\n -1,\n 1,\n 10,\n 2,\n 8,\n 7,\n 4,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 4,\n 9,\n 1,\n 4,\n 1,\n 7,\n 7,\n 1,\n 3,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 4,\n 9,\n 1,\n 4,\n 1,\n 7,\n 0,\n 8,\n 1,\n 8,\n 7,\n 1,\n -1,\n -1,\n -1,\n -1,\n 4,\n 0,\n 3,\n 7,\n 4,\n 3,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 4,\n 8,\n 7,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 9,\n 10,\n 8,\n 10,\n 11,\n 8,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 3,\n 0,\n 9,\n 3,\n 9,\n 11,\n 11,\n 9,\n 10,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 0,\n 1,\n 10,\n 0,\n 10,\n 8,\n 8,\n 10,\n 11,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 3,\n 1,\n 10,\n 11,\n 3,\n 10,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 1,\n 2,\n 11,\n 1,\n 11,\n 9,\n 9,\n 11,\n 8,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 3,\n 0,\n 9,\n 3,\n 9,\n 11,\n 1,\n 2,\n 9,\n 2,\n 11,\n 9,\n -1,\n -1,\n -1,\n -1,\n 0,\n 2,\n 11,\n 8,\n 0,\n 11,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 3,\n 2,\n 11,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 2,\n 3,\n 8,\n 2,\n 8,\n 10,\n 10,\n 8,\n 9,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 9,\n 10,\n 2,\n 0,\n 9,\n 2,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 2,\n 3,\n 8,\n 2,\n 8,\n 10,\n 0,\n 1,\n 8,\n 1,\n 10,\n 8,\n -1,\n -1,\n -1,\n -1,\n 1,\n 10,\n 2,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 1,\n 3,\n 8,\n 9,\n 1,\n 8,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 0,\n 9,\n 1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n 0,\n 3,\n 8,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1,\n -1\n]);\nclass SimplexNoise {\n /**\n * You can pass in a random number generator object if you like.\n * It is assumed to have a random() method.\n */\n constructor(r = Math) {\n __publicField(this, \"grad3\", [\n [1, 1, 0],\n [-1, 1, 0],\n [1, -1, 0],\n [-1, -1, 0],\n [1, 0, 1],\n [-1, 0, 1],\n [1, 0, -1],\n [-1, 0, -1],\n [0, 1, 1],\n [0, -1, 1],\n [0, 1, -1],\n [0, -1, -1]\n ]);\n __publicField(this, \"grad4\", [\n [0, 1, 1, 1],\n [0, 1, 1, -1],\n [0, 1, -1, 1],\n [0, 1, -1, -1],\n [0, -1, 1, 1],\n [0, -1, 1, -1],\n [0, -1, -1, 1],\n [0, -1, -1, -1],\n [1, 0, 1, 1],\n [1, 0, 1, -1],\n [1, 0, -1, 1],\n [1, 0, -1, -1],\n [-1, 0, 1, 1],\n [-1, 0, 1, -1],\n [-1, 0, -1, 1],\n [-1, 0, -1, -1],\n [1, 1, 0, 1],\n [1, 1, 0, -1],\n [1, -1, 0, 1],\n [1, -1, 0, -1],\n [-1, 1, 0, 1],\n [-1, 1, 0, -1],\n [-1, -1, 0, 1],\n [-1, -1, 0, -1],\n [1, 1, 1, 0],\n [1, 1, -1, 0],\n [1, -1, 1, 0],\n [1, -1, -1, 0],\n [-1, 1, 1, 0],\n [-1, 1, -1, 0],\n [-1, -1, 1, 0],\n [-1, -1, -1, 0]\n ]);\n __publicField(this, \"p\", []);\n // To remove the need for index wrapping, double the permutation table length\n __publicField(this, \"perm\", []);\n // A lookup table to traverse the simplex around a given point in 4D.\n // Details can be found where this table is used, in the 4D noise method.\n __publicField(this, \"simplex\", [\n [0, 1, 2, 3],\n [0, 1, 3, 2],\n [0, 0, 0, 0],\n [0, 2, 3, 1],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [1, 2, 3, 0],\n [0, 2, 1, 3],\n [0, 0, 0, 0],\n [0, 3, 1, 2],\n [0, 3, 2, 1],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [1, 3, 2, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [1, 2, 0, 3],\n [0, 0, 0, 0],\n [1, 3, 0, 2],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [2, 3, 0, 1],\n [2, 3, 1, 0],\n [1, 0, 2, 3],\n [1, 0, 3, 2],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [2, 0, 3, 1],\n [0, 0, 0, 0],\n [2, 1, 3, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [2, 0, 1, 3],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [3, 0, 1, 2],\n [3, 0, 2, 1],\n [0, 0, 0, 0],\n [3, 1, 2, 0],\n [2, 1, 0, 3],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [0, 0, 0, 0],\n [3, 1, 0, 2],\n [0, 0, 0, 0],\n [3, 2, 0, 1],\n [3, 2, 1, 0]\n ]);\n __publicField(this, \"dot\", (g, x, y) => {\n return g[0] * x + g[1] * y;\n });\n __publicField(this, \"dot3\", (g, x, y, z) => {\n return g[0] * x + g[1] * y + g[2] * z;\n });\n __publicField(this, \"dot4\", (g, x, y, z, w) => {\n return g[0] * x + g[1] * y + g[2] * z + g[3] * w;\n });\n __publicField(this, \"noise\", (xin, yin) => {\n let n0;\n let n1;\n let n2;\n const F2 = 0.5 * (Math.sqrt(3) - 1);\n const s = (xin + yin) * F2;\n const i2 = Math.floor(xin + s);\n const j = Math.floor(yin + s);\n const G2 = (3 - Math.sqrt(3)) / 6;\n const t2 = (i2 + j) * G2;\n const X0 = i2 - t2;\n const Y0 = j - t2;\n const x0 = xin - X0;\n const y0 = yin - Y0;\n let i1 = 0;\n let j1 = 1;\n if (x0 > y0) {\n i1 = 1;\n j1 = 0;\n }\n const x1 = x0 - i1 + G2;\n const y1 = y0 - j1 + G2;\n const x2 = x0 - 1 + 2 * G2;\n const y2 = y0 - 1 + 2 * G2;\n const ii = i2 & 255;\n const jj = j & 255;\n const gi0 = this.perm[ii + this.perm[jj]] % 12;\n const gi1 = this.perm[ii + i1 + this.perm[jj + j1]] % 12;\n const gi2 = this.perm[ii + 1 + this.perm[jj + 1]] % 12;\n let t0 = 0.5 - x0 * x0 - y0 * y0;\n if (t0 < 0) {\n n0 = 0;\n } else {\n t0 *= t0;\n n0 = t0 * t0 * this.dot(this.grad3[gi0], x0, y0);\n }\n let t1 = 0.5 - x1 * x1 - y1 * y1;\n if (t1 < 0) {\n n1 = 0;\n } else {\n t1 *= t1;\n n1 = t1 * t1 * this.dot(this.grad3[gi1], x1, y1);\n }\n let t22 = 0.5 - x2 * x2 - y2 * y2;\n if (t22 < 0) {\n n2 = 0;\n } else {\n t22 *= t22;\n n2 = t22 * t22 * this.dot(this.grad3[gi2], x2, y2);\n }\n return 70 * (n0 + n1 + n2);\n });\n // 3D simplex noise\n __publicField(this, \"noise3d\", (xin, yin, zin) => {\n let n0;\n let n1;\n let n2;\n let n3;\n const F3 = 1 / 3;\n const s = (xin + yin + zin) * F3;\n const i2 = Math.floor(xin + s);\n const j = Math.floor(yin + s);\n const k = Math.floor(zin + s);\n const G3 = 1 / 6;\n const t2 = (i2 + j + k) * G3;\n const X0 = i2 - t2;\n const Y0 = j - t2;\n const Z0 = k - t2;\n const x0 = xin - X0;\n const y0 = yin - Y0;\n const z0 = zin - Z0;\n let i1;\n let j1;\n let k1;\n let i22;\n let j2;\n let k2;\n if (x0 >= y0) {\n if (y0 >= z0) {\n i1 = 1;\n j1 = 0;\n k1 = 0;\n i22 = 1;\n j2 = 1;\n k2 = 0;\n } else if (x0 >= z0) {\n i1 = 1;\n j1 = 0;\n k1 = 0;\n i22 = 1;\n j2 = 0;\n k2 = 1;\n } else {\n i1 = 0;\n j1 = 0;\n k1 = 1;\n i22 = 1;\n j2 = 0;\n k2 = 1;\n }\n } else {\n if (y0 < z0) {\n i1 = 0;\n j1 = 0;\n k1 = 1;\n i22 = 0;\n j2 = 1;\n k2 = 1;\n } else if (x0 < z0) {\n i1 = 0;\n j1 = 1;\n k1 = 0;\n i22 = 0;\n j2 = 1;\n k2 = 1;\n } else {\n i1 = 0;\n j1 = 1;\n k1 = 0;\n i22 = 1;\n j2 = 1;\n k2 = 0;\n }\n }\n const x1 = x0 - i1 + G3;\n const y1 = y0 - j1 + G3;\n const z1 = z0 - k1 + G3;\n const x2 = x0 - i22 + 2 * G3;\n const y2 = y0 - j2 + 2 * G3;\n const z2 = z0 - k2 + 2 * G3;\n const x3 = x0 - 1 + 3 * G3;\n const y3 = y0 - 1 + 3 * G3;\n const z3 = z0 - 1 + 3 * G3;\n const ii = i2 & 255;\n const jj = j & 255;\n const kk = k & 255;\n const gi0 = this.perm[ii + this.perm[jj + this.perm[kk]]] % 12;\n const gi1 = this.perm[ii + i1 + this.perm[jj + j1 + this.perm[kk + k1]]] % 12;\n const gi2 = this.perm[ii + i22 + this.perm[jj + j2 + this.perm[kk + k2]]] % 12;\n const gi3 = this.perm[ii + 1 + this.perm[jj + 1 + this.perm[kk + 1]]] % 12;\n let t0 = 0.6 - x0 * x0 - y0 * y0 - z0 * z0;\n if (t0 < 0) {\n n0 = 0;\n } else {\n t0 *= t0;\n n0 = t0 * t0 * this.dot3(this.grad3[gi0], x0, y0, z0);\n }\n let t1 = 0.6 - x1 * x1 - y1 * y1 - z1 * z1;\n if (t1 < 0) {\n n1 = 0;\n } else {\n t1 *= t1;\n n1 = t1 * t1 * this.dot3(this.grad3[gi1], x1, y1, z1);\n }\n let t22 = 0.6 - x2 * x2 - y2 * y2 - z2 * z2;\n if (t22 < 0) {\n n2 = 0;\n } else {\n t22 *= t22;\n n2 = t22 * t22 * this.dot3(this.grad3[gi2], x2, y2, z2);\n }\n let t3 = 0.6 - x3 * x3 - y3 * y3 - z3 * z3;\n if (t3 < 0) {\n n3 = 0;\n } else {\n t3 *= t3;\n n3 = t3 * t3 * this.dot3(this.grad3[gi3], x3, y3, z3);\n }\n return 32 * (n0 + n1 + n2 + n3);\n });\n // 4D simplex noise\n __publicField(this, \"noise4d\", (x, y, z, w) => {\n const grad4 = this.grad4;\n const simplex = this.simplex;\n const perm = this.perm;\n const F4 = (Math.sqrt(5) - 1) / 4;\n const G4 = (5 - Math.sqrt(5)) / 20;\n let n0;\n let n1;\n let n2;\n let n3;\n let n4;\n const s = (x + y + z + w) * F4;\n const i2 = Math.floor(x + s);\n const j = Math.floor(y + s);\n const k = Math.floor(z + s);\n const l = Math.floor(w + s);\n const t2 = (i2 + j + k + l) * G4;\n const X0 = i2 - t2;\n const Y0 = j - t2;\n const Z0 = k - t2;\n const W0 = l - t2;\n const x0 = x - X0;\n const y0 = y - Y0;\n const z0 = z - Z0;\n const w0 = w - W0;\n const c1 = x0 > y0 ? 32 : 0;\n const c2 = x0 > z0 ? 16 : 0;\n const c3 = y0 > z0 ? 8 : 0;\n const c4 = x0 > w0 ? 4 : 0;\n const c5 = y0 > w0 ? 2 : 0;\n const c6 = z0 > w0 ? 1 : 0;\n const c = c1 + c2 + c3 + c4 + c5 + c6;\n let i1;\n let j1;\n let k1;\n let l1;\n let i22;\n let j2;\n let k2;\n let l2;\n let i3;\n let j3;\n let k3;\n let l3;\n i1 = simplex[c][0] >= 3 ? 1 : 0;\n j1 = simplex[c][1] >= 3 ? 1 : 0;\n k1 = simplex[c][2] >= 3 ? 1 : 0;\n l1 = simplex[c][3] >= 3 ? 1 : 0;\n i22 = simplex[c][0] >= 2 ? 1 : 0;\n j2 = simplex[c][1] >= 2 ? 1 : 0;\n k2 = simplex[c][2] >= 2 ? 1 : 0;\n l2 = simplex[c][3] >= 2 ? 1 : 0;\n i3 = simplex[c][0] >= 1 ? 1 : 0;\n j3 = simplex[c][1] >= 1 ? 1 : 0;\n k3 = simplex[c][2] >= 1 ? 1 : 0;\n l3 = simplex[c][3] >= 1 ? 1 : 0;\n const x1 = x0 - i1 + G4;\n const y1 = y0 - j1 + G4;\n const z1 = z0 - k1 + G4;\n const w1 = w0 - l1 + G4;\n const x2 = x0 - i22 + 2 * G4;\n const y2 = y0 - j2 + 2 * G4;\n const z2 = z0 - k2 + 2 * G4;\n const w2 = w0 - l2 + 2 * G4;\n const x3 = x0 - i3 + 3 * G4;\n const y3 = y0 - j3 + 3 * G4;\n const z3 = z0 - k3 + 3 * G4;\n const w3 = w0 - l3 + 3 * G4;\n const x4 = x0 - 1 + 4 * G4;\n const y4 = y0 - 1 + 4 * G4;\n const z4 = z0 - 1 + 4 * G4;\n const w4 = w0 - 1 + 4 * G4;\n const ii = i2 & 255;\n const jj = j & 255;\n const kk = k & 255;\n const ll = l & 255;\n const gi0 = perm[ii + perm[jj + perm[kk + perm[ll]]]] % 32;\n const gi1 = perm[ii + i1 + perm[jj + j1 + perm[kk + k1 + perm[ll + l1]]]] % 32;\n const gi2 = perm[ii + i22 + perm[jj + j2 + perm[kk + k2 + perm[ll + l2]]]] % 32;\n const gi3 = perm[ii + i3 + perm[jj + j3 + perm[kk + k3 + perm[ll + l3]]]] % 32;\n const gi4 = perm[ii + 1 + perm[jj + 1 + perm[kk + 1 + perm[ll + 1]]]] % 32;\n let t0 = 0.6 - x0 * x0 - y0 * y0 - z0 * z0 - w0 * w0;\n if (t0 < 0) {\n n0 = 0;\n } else {\n t0 *= t0;\n n0 = t0 * t0 * this.dot4(grad4[gi0], x0, y0, z0, w0);\n }\n let t1 = 0.6 - x1 * x1 - y1 * y1 - z1 * z1 - w1 * w1;\n if (t1 < 0) {\n n1 = 0;\n } else {\n t1 *= t1;\n n1 = t1 * t1 * this.dot4(grad4[gi1], x1, y1, z1, w1);\n }\n let t22 = 0.6 - x2 * x2 - y2 * y2 - z2 * z2 - w2 * w2;\n if (t22 < 0) {\n n2 = 0;\n } else {\n t22 *= t22;\n n2 = t22 * t22 * this.dot4(grad4[gi2], x2, y2, z2, w2);\n }\n let t3 = 0.6 - x3 * x3 - y3 * y3 - z3 * z3 - w3 * w3;\n if (t3 < 0) {\n n3 = 0;\n } else {\n t3 *= t3;\n n3 = t3 * t3 * this.dot4(grad4[gi3], x3, y3, z3, w3);\n }\n let t4 = 0.6 - x4 * x4 - y4 * y4 - z4 * z4 - w4 * w4;\n if (t4 < 0) {\n n4 = 0;\n } else {\n t4 *= t4;\n n4 = t4 * t4 * this.dot4(grad4[gi4], x4, y4, z4, w4);\n }\n return 27 * (n0 + n1 + n2 + n3 + n4);\n });\n for (let i2 = 0; i2 < 256; i2++) {\n this.p[i2] = Math.floor(r.random() * 256);\n }\n for (let i2 = 0; i2 < 512; i2++) {\n this.perm[i2] = this.p[i2 & 255];\n }\n }\n}\nconst _LightningStrike = class extends three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry {\n constructor(rayParameters = {}) {\n super();\n this.isLightningStrike = true;\n this.type = \"LightningStrike\";\n this.init(_LightningStrike.copyParameters(rayParameters, rayParameters));\n this.createMesh();\n }\n static createRandomGenerator() {\n const numSeeds = 2053;\n const seeds = [];\n for (let i2 = 0; i2 < numSeeds; i2++) {\n seeds.push(Math.random());\n }\n const generator = {\n currentSeed: 0,\n random: function() {\n const value = seeds[generator.currentSeed];\n generator.currentSeed = (generator.currentSeed + 1) % numSeeds;\n return value;\n },\n getSeed: function() {\n return generator.currentSeed / numSeeds;\n },\n setSeed: function(seed) {\n generator.currentSeed = Math.floor(seed * numSeeds) % numSeeds;\n }\n };\n return generator;\n }\n static copyParameters(dest = {}, source = {}) {\n const vecCopy = function(v) {\n if (source === dest) {\n return v;\n } else {\n return v.clone();\n }\n };\n dest.sourceOffset = source.sourceOffset !== void 0 ? vecCopy(source.sourceOffset) : new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 100, 0), dest.destOffset = source.destOffset !== void 0 ? vecCopy(source.destOffset) : new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 0, 0), dest.timeScale = source.timeScale !== void 0 ? source.timeScale : 1, dest.roughness = source.roughness !== void 0 ? source.roughness : 0.9, dest.straightness = source.straightness !== void 0 ? source.straightness : 0.7, dest.up0 = source.up0 !== void 0 ? vecCopy(source.up0) : new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 0, 1);\n dest.up1 = source.up1 !== void 0 ? vecCopy(source.up1) : new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 0, 1), dest.radius0 = source.radius0 !== void 0 ? source.radius0 : 1, dest.radius1 = source.radius1 !== void 0 ? source.radius1 : 1, dest.radius0Factor = source.radius0Factor !== void 0 ? source.radius0Factor : 0.5, dest.radius1Factor = source.radius1Factor !== void 0 ? source.radius1Factor : 0.2, dest.minRadius = source.minRadius !== void 0 ? source.minRadius : 0.2, // These parameters should not be changed after lightning creation. They can be changed but the ray will change its form abruptly:\n dest.isEternal = source.isEternal !== void 0 ? source.isEternal : source.birthTime === void 0 || source.deathTime === void 0, dest.birthTime = source.birthTime, dest.deathTime = source.deathTime, dest.propagationTimeFactor = source.propagationTimeFactor !== void 0 ? source.propagationTimeFactor : 0.1, dest.vanishingTimeFactor = source.vanishingTimeFactor !== void 0 ? source.vanishingTimeFactor : 0.9, dest.subrayPeriod = source.subrayPeriod !== void 0 ? source.subrayPeriod : 4, dest.subrayDutyCycle = source.subrayDutyCycle !== void 0 ? source.subrayDutyCycle : 0.6;\n dest.maxIterations = source.maxIterations !== void 0 ? source.maxIterations : 9;\n dest.isStatic = source.isStatic !== void 0 ? source.isStatic : false;\n dest.ramification = source.ramification !== void 0 ? source.ramification : 5;\n dest.maxSubrayRecursion = source.maxSubrayRecursion !== void 0 ? source.maxSubrayRecursion : 3;\n dest.recursionProbability = source.recursionProbability !== void 0 ? source.recursionProbability : 0.6;\n dest.generateUVs = source.generateUVs !== void 0 ? source.generateUVs : false;\n dest.randomGenerator = source.randomGenerator, dest.noiseSeed = source.noiseSeed, dest.onDecideSubrayCreation = source.onDecideSubrayCreation, dest.onSubrayCreation = source.onSubrayCreation;\n return dest;\n }\n update(time) {\n if (this.isStatic)\n return;\n if (this.rayParameters.isEternal || this.rayParameters.birthTime <= time && time <= this.rayParameters.deathTime) {\n this.updateMesh(time);\n if (time < this.subrays[0].endPropagationTime) {\n this.state = _LightningStrike.RAY_PROPAGATING;\n } else if (time > this.subrays[0].beginVanishingTime) {\n this.state = _LightningStrike.RAY_VANISHING;\n } else {\n this.state = _LightningStrike.RAY_STEADY;\n }\n this.visible = true;\n } else {\n this.visible = false;\n if (time < this.rayParameters.birthTime) {\n this.state = _LightningStrike.RAY_UNBORN;\n } else {\n this.state = _LightningStrike.RAY_EXTINGUISHED;\n }\n }\n }\n init(rayParameters) {\n this.rayParameters = rayParameters;\n this.maxIterations = rayParameters.maxIterations !== void 0 ? Math.floor(rayParameters.maxIterations) : 9;\n rayParameters.maxIterations = this.maxIterations;\n this.isStatic = rayParameters.isStatic !== void 0 ? rayParameters.isStatic : false;\n rayParameters.isStatic = this.isStatic;\n this.ramification = rayParameters.ramification !== void 0 ? Math.floor(rayParameters.ramification) : 5;\n rayParameters.ramification = this.ramification;\n this.maxSubrayRecursion = rayParameters.maxSubrayRecursion !== void 0 ? Math.floor(rayParameters.maxSubrayRecursion) : 3;\n rayParameters.maxSubrayRecursion = this.maxSubrayRecursion;\n this.recursionProbability = rayParameters.recursionProbability !== void 0 ? rayParameters.recursionProbability : 0.6;\n rayParameters.recursionProbability = this.recursionProbability;\n this.generateUVs = rayParameters.generateUVs !== void 0 ? rayParameters.generateUVs : false;\n rayParameters.generateUVs = this.generateUVs;\n if (rayParameters.randomGenerator !== void 0) {\n this.randomGenerator = rayParameters.randomGenerator;\n this.seedGenerator = rayParameters.randomGenerator;\n if (rayParameters.noiseSeed !== void 0) {\n this.seedGenerator.setSeed(rayParameters.noiseSeed);\n }\n } else {\n this.randomGenerator = _LightningStrike.createRandomGenerator();\n this.seedGenerator = Math;\n }\n if (rayParameters.onDecideSubrayCreation !== void 0) {\n this.onDecideSubrayCreation = rayParameters.onDecideSubrayCreation;\n } else {\n this.createDefaultSubrayCreationCallbacks();\n if (rayParameters.onSubrayCreation !== void 0) {\n this.onSubrayCreation = rayParameters.onSubrayCreation;\n }\n }\n this.state = _LightningStrike.RAY_INITIALIZED;\n this.maxSubrays = Math.ceil(1 + Math.pow(this.ramification, Math.max(0, this.maxSubrayRecursion - 1)));\n rayParameters.maxSubrays = this.maxSubrays;\n this.maxRaySegments = 2 * (1 << this.maxIterations);\n this.subrays = [];\n for (let i2 = 0; i2 < this.maxSubrays; i2++) {\n this.subrays.push(this.createSubray());\n }\n this.raySegments = [];\n for (let i2 = 0; i2 < this.maxRaySegments; i2++) {\n this.raySegments.push(this.createSegment());\n }\n this.time = 0;\n this.timeFraction = 0;\n this.currentSegmentCallback = null;\n this.currentCreateTriangleVertices = this.generateUVs ? this.createTriangleVerticesWithUVs : this.createTriangleVerticesWithoutUVs;\n this.numSubrays = 0;\n this.currentSubray = null;\n this.currentSegmentIndex = 0;\n this.isInitialSegment = false;\n this.subrayProbability = 0;\n this.currentVertex = 0;\n this.currentIndex = 0;\n this.currentCoordinate = 0;\n this.currentUVCoordinate = 0;\n this.vertices = null;\n this.uvs = null;\n this.indices = null;\n this.positionAttribute = null;\n this.uvsAttribute = null;\n this.simplexX = new SimplexNoise(this.seedGenerator);\n this.simplexY = new SimplexNoise(this.seedGenerator);\n this.simplexZ = new SimplexNoise(this.seedGenerator);\n this.forwards = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this.forwardsFill = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this.side = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this.down = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this.middlePos = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this.middleLinPos = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this.newPos = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this.vPos = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this.cross1 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n }\n createMesh() {\n const maxDrawableSegmentsPerSubRay = 1 << this.maxIterations;\n const maxVerts = 3 * (maxDrawableSegmentsPerSubRay + 1) * this.maxSubrays;\n const maxIndices = 18 * maxDrawableSegmentsPerSubRay * this.maxSubrays;\n this.vertices = new Float32Array(maxVerts * 3);\n this.indices = new Uint32Array(maxIndices);\n if (this.generateUVs) {\n this.uvs = new Float32Array(maxVerts * 2);\n }\n this.fillMesh(0);\n this.setIndex(new three__WEBPACK_IMPORTED_MODULE_42__.Uint32BufferAttribute(this.indices, 1));\n this.positionAttribute = new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(this.vertices, 3);\n this.setAttribute(\"position\", this.positionAttribute);\n if (this.generateUVs) {\n this.uvsAttribute = new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(new Float32Array(this.uvs), 2);\n this.setAttribute(\"uv\", this.uvsAttribute);\n }\n if (!this.isStatic) {\n this.index.usage = three__WEBPACK_IMPORTED_MODULE_42__.DynamicDrawUsage;\n this.positionAttribute.usage = three__WEBPACK_IMPORTED_MODULE_42__.DynamicDrawUsage;\n if (this.generateUVs) {\n this.uvsAttribute.usage = three__WEBPACK_IMPORTED_MODULE_42__.DynamicDrawUsage;\n }\n }\n this.vertices = this.positionAttribute.array;\n this.indices = this.index.array;\n if (this.generateUVs) {\n this.uvs = this.uvsAttribute.array;\n }\n }\n updateMesh(time) {\n this.fillMesh(time);\n this.drawRange.count = this.currentIndex;\n this.index.needsUpdate = true;\n this.positionAttribute.needsUpdate = true;\n if (this.generateUVs) {\n this.uvsAttribute.needsUpdate = true;\n }\n }\n fillMesh(time) {\n const scope = this;\n this.currentVertex = 0;\n this.currentIndex = 0;\n this.currentCoordinate = 0;\n this.currentUVCoordinate = 0;\n this.fractalRay(time, function fillVertices(segment) {\n const subray = scope.currentSubray;\n if (time < subray.birthTime) {\n return;\n } else if (this.rayParameters.isEternal && scope.currentSubray.recursion == 0) {\n scope.createPrism(segment);\n scope.onDecideSubrayCreation(segment, scope);\n } else if (time < subray.endPropagationTime) {\n if (scope.timeFraction >= segment.fraction0 * subray.propagationTimeFactor) {\n scope.createPrism(segment);\n scope.onDecideSubrayCreation(segment, scope);\n }\n } else if (time < subray.beginVanishingTime) {\n scope.createPrism(segment);\n scope.onDecideSubrayCreation(segment, scope);\n } else {\n if (scope.timeFraction <= subray.vanishingTimeFactor + segment.fraction1 * (1 - subray.vanishingTimeFactor)) {\n scope.createPrism(segment);\n }\n scope.onDecideSubrayCreation(segment, scope);\n }\n });\n }\n addNewSubray() {\n return this.subrays[this.numSubrays++];\n }\n initSubray(subray, rayParameters) {\n subray.pos0.copy(rayParameters.sourceOffset);\n subray.pos1.copy(rayParameters.destOffset);\n subray.up0.copy(rayParameters.up0);\n subray.up1.copy(rayParameters.up1);\n subray.radius0 = rayParameters.radius0;\n subray.radius1 = rayParameters.radius1;\n subray.birthTime = rayParameters.birthTime;\n subray.deathTime = rayParameters.deathTime;\n subray.timeScale = rayParameters.timeScale;\n subray.roughness = rayParameters.roughness;\n subray.straightness = rayParameters.straightness;\n subray.propagationTimeFactor = rayParameters.propagationTimeFactor;\n subray.vanishingTimeFactor = rayParameters.vanishingTimeFactor;\n subray.maxIterations = this.maxIterations;\n subray.seed = rayParameters.noiseSeed !== void 0 ? rayParameters.noiseSeed : 0;\n subray.recursion = 0;\n }\n fractalRay(time, segmentCallback) {\n this.time = time;\n this.currentSegmentCallback = segmentCallback;\n this.numSubrays = 0;\n this.initSubray(this.addNewSubray(), this.rayParameters);\n for (let subrayIndex = 0; subrayIndex < this.numSubrays; subrayIndex++) {\n const subray = this.subrays[subrayIndex];\n this.currentSubray = subray;\n this.randomGenerator.setSeed(subray.seed);\n subray.endPropagationTime = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.lerp(subray.birthTime, subray.deathTime, subray.propagationTimeFactor);\n subray.beginVanishingTime = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.lerp(subray.deathTime, subray.birthTime, 1 - subray.vanishingTimeFactor);\n const random1 = this.randomGenerator.random;\n subray.linPos0.set(random1(), random1(), random1()).multiplyScalar(1e3);\n subray.linPos1.set(random1(), random1(), random1()).multiplyScalar(1e3);\n this.timeFraction = (time - subray.birthTime) / (subray.deathTime - subray.birthTime);\n this.currentSegmentIndex = 0;\n this.isInitialSegment = true;\n const segment = this.getNewSegment();\n segment.iteration = 0;\n segment.pos0.copy(subray.pos0);\n segment.pos1.copy(subray.pos1);\n segment.linPos0.copy(subray.linPos0);\n segment.linPos1.copy(subray.linPos1);\n segment.up0.copy(subray.up0);\n segment.up1.copy(subray.up1);\n segment.radius0 = subray.radius0;\n segment.radius1 = subray.radius1;\n segment.fraction0 = 0;\n segment.fraction1 = 1;\n segment.positionVariationFactor = 1 - subray.straightness;\n this.subrayProbability = this.ramification * Math.pow(this.recursionProbability, subray.recursion) / (1 << subray.maxIterations);\n this.fractalRayRecursive(segment);\n }\n this.currentSegmentCallback = null;\n this.currentSubray = null;\n }\n fractalRayRecursive(segment) {\n if (segment.iteration >= this.currentSubray.maxIterations) {\n this.currentSegmentCallback(segment);\n return;\n }\n this.forwards.subVectors(segment.pos1, segment.pos0);\n let lForwards = this.forwards.length();\n if (lForwards < 1e-6) {\n this.forwards.set(0, 0, 0.01);\n lForwards = this.forwards.length();\n }\n const middleRadius = (segment.radius0 + segment.radius1) * 0.5;\n const middleFraction = (segment.fraction0 + segment.fraction1) * 0.5;\n const timeDimension = this.time * this.currentSubray.timeScale * Math.pow(2, segment.iteration);\n this.middlePos.lerpVectors(segment.pos0, segment.pos1, 0.5);\n this.middleLinPos.lerpVectors(segment.linPos0, segment.linPos1, 0.5);\n const p = this.middleLinPos;\n this.newPos.set(\n this.simplexX.noise4d(p.x, p.y, p.z, timeDimension),\n this.simplexY.noise4d(p.x, p.y, p.z, timeDimension),\n this.simplexZ.noise4d(p.x, p.y, p.z, timeDimension)\n );\n this.newPos.multiplyScalar(segment.positionVariationFactor * lForwards);\n this.newPos.add(this.middlePos);\n const newSegment1 = this.getNewSegment();\n newSegment1.pos0.copy(segment.pos0);\n newSegment1.pos1.copy(this.newPos);\n newSegment1.linPos0.copy(segment.linPos0);\n newSegment1.linPos1.copy(this.middleLinPos);\n newSegment1.up0.copy(segment.up0);\n newSegment1.up1.copy(segment.up1);\n newSegment1.radius0 = segment.radius0;\n newSegment1.radius1 = middleRadius;\n newSegment1.fraction0 = segment.fraction0;\n newSegment1.fraction1 = middleFraction;\n newSegment1.positionVariationFactor = segment.positionVariationFactor * this.currentSubray.roughness;\n newSegment1.iteration = segment.iteration + 1;\n const newSegment2 = this.getNewSegment();\n newSegment2.pos0.copy(this.newPos);\n newSegment2.pos1.copy(segment.pos1);\n newSegment2.linPos0.copy(this.middleLinPos);\n newSegment2.linPos1.copy(segment.linPos1);\n this.cross1.crossVectors(segment.up0, this.forwards.normalize());\n newSegment2.up0.crossVectors(this.forwards, this.cross1).normalize();\n newSegment2.up1.copy(segment.up1);\n newSegment2.radius0 = middleRadius;\n newSegment2.radius1 = segment.radius1;\n newSegment2.fraction0 = middleFraction;\n newSegment2.fraction1 = segment.fraction1;\n newSegment2.positionVariationFactor = segment.positionVariationFactor * this.currentSubray.roughness;\n newSegment2.iteration = segment.iteration + 1;\n this.fractalRayRecursive(newSegment1);\n this.fractalRayRecursive(newSegment2);\n }\n createPrism(segment) {\n this.forwardsFill.subVectors(segment.pos1, segment.pos0).normalize();\n if (this.isInitialSegment) {\n this.currentCreateTriangleVertices(segment.pos0, segment.up0, this.forwardsFill, segment.radius0, 0);\n this.isInitialSegment = false;\n }\n this.currentCreateTriangleVertices(segment.pos1, segment.up0, this.forwardsFill, segment.radius1, segment.fraction1);\n this.createPrismFaces();\n }\n createTriangleVerticesWithoutUVs(pos, up, forwards, radius) {\n this.side.crossVectors(up, forwards).multiplyScalar(radius * _LightningStrike.COS30DEG);\n this.down.copy(up).multiplyScalar(-radius * _LightningStrike.SIN30DEG);\n const p = this.vPos;\n const v = this.vertices;\n p.copy(pos).sub(this.side).add(this.down);\n v[this.currentCoordinate++] = p.x;\n v[this.currentCoordinate++] = p.y;\n v[this.currentCoordinate++] = p.z;\n p.copy(pos).add(this.side).add(this.down);\n v[this.currentCoordinate++] = p.x;\n v[this.currentCoordinate++] = p.y;\n v[this.currentCoordinate++] = p.z;\n p.copy(up).multiplyScalar(radius).add(pos);\n v[this.currentCoordinate++] = p.x;\n v[this.currentCoordinate++] = p.y;\n v[this.currentCoordinate++] = p.z;\n this.currentVertex += 3;\n }\n createTriangleVerticesWithUVs(pos, up, forwards, radius, u) {\n this.side.crossVectors(up, forwards).multiplyScalar(radius * _LightningStrike.COS30DEG);\n this.down.copy(up).multiplyScalar(-radius * _LightningStrike.SIN30DEG);\n const p = this.vPos;\n const v = this.vertices;\n const uv = this.uvs;\n p.copy(pos).sub(this.side).add(this.down);\n v[this.currentCoordinate++] = p.x;\n v[this.currentCoordinate++] = p.y;\n v[this.currentCoordinate++] = p.z;\n uv[this.currentUVCoordinate++] = u;\n uv[this.currentUVCoordinate++] = 0;\n p.copy(pos).add(this.side).add(this.down);\n v[this.currentCoordinate++] = p.x;\n v[this.currentCoordinate++] = p.y;\n v[this.currentCoordinate++] = p.z;\n uv[this.currentUVCoordinate++] = u;\n uv[this.currentUVCoordinate++] = 0.5;\n p.copy(up).multiplyScalar(radius).add(pos);\n v[this.currentCoordinate++] = p.x;\n v[this.currentCoordinate++] = p.y;\n v[this.currentCoordinate++] = p.z;\n uv[this.currentUVCoordinate++] = u;\n uv[this.currentUVCoordinate++] = 1;\n this.currentVertex += 3;\n }\n createPrismFaces(vertex) {\n const indices = this.indices;\n vertex = this.currentVertex - 6;\n indices[this.currentIndex++] = vertex + 1;\n indices[this.currentIndex++] = vertex + 2;\n indices[this.currentIndex++] = vertex + 5;\n indices[this.currentIndex++] = vertex + 1;\n indices[this.currentIndex++] = vertex + 5;\n indices[this.currentIndex++] = vertex + 4;\n indices[this.currentIndex++] = vertex + 0;\n indices[this.currentIndex++] = vertex + 1;\n indices[this.currentIndex++] = vertex + 4;\n indices[this.currentIndex++] = vertex + 0;\n indices[this.currentIndex++] = vertex + 4;\n indices[this.currentIndex++] = vertex + 3;\n indices[this.currentIndex++] = vertex + 2;\n indices[this.currentIndex++] = vertex + 0;\n indices[this.currentIndex++] = vertex + 3;\n indices[this.currentIndex++] = vertex + 2;\n indices[this.currentIndex++] = vertex + 3;\n indices[this.currentIndex++] = vertex + 5;\n }\n createDefaultSubrayCreationCallbacks() {\n const random1 = this.randomGenerator.random;\n this.onDecideSubrayCreation = function(segment, lightningStrike) {\n const subray = lightningStrike.currentSubray;\n const period = lightningStrike.rayParameters.subrayPeriod;\n const dutyCycle = lightningStrike.rayParameters.subrayDutyCycle;\n const phase0 = lightningStrike.rayParameters.isEternal && subray.recursion == 0 ? -random1() * period : three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.lerp(subray.birthTime, subray.endPropagationTime, segment.fraction0) - random1() * period;\n const phase = lightningStrike.time - phase0;\n const currentCycle = Math.floor(phase / period);\n const childSubraySeed = random1() * (currentCycle + 1);\n const isActive = phase % period <= dutyCycle * period;\n let probability = 0;\n if (isActive) {\n probability = lightningStrike.subrayProbability;\n }\n if (subray.recursion < lightningStrike.maxSubrayRecursion && lightningStrike.numSubrays < lightningStrike.maxSubrays && random1() < probability) {\n const childSubray = lightningStrike.addNewSubray();\n const parentSeed = lightningStrike.randomGenerator.getSeed();\n childSubray.seed = childSubraySeed;\n lightningStrike.randomGenerator.setSeed(childSubraySeed);\n childSubray.recursion = subray.recursion + 1;\n childSubray.maxIterations = Math.max(1, subray.maxIterations - 1);\n childSubray.linPos0.set(random1(), random1(), random1()).multiplyScalar(1e3);\n childSubray.linPos1.set(random1(), random1(), random1()).multiplyScalar(1e3);\n childSubray.up0.copy(subray.up0);\n childSubray.up1.copy(subray.up1);\n childSubray.radius0 = segment.radius0 * lightningStrike.rayParameters.radius0Factor;\n childSubray.radius1 = Math.min(\n lightningStrike.rayParameters.minRadius,\n segment.radius1 * lightningStrike.rayParameters.radius1Factor\n );\n childSubray.birthTime = phase0 + currentCycle * period;\n childSubray.deathTime = childSubray.birthTime + period * dutyCycle;\n if (!lightningStrike.rayParameters.isEternal && subray.recursion == 0) {\n childSubray.birthTime = Math.max(childSubray.birthTime, subray.birthTime);\n childSubray.deathTime = Math.min(childSubray.deathTime, subray.deathTime);\n }\n childSubray.timeScale = subray.timeScale * 2;\n childSubray.roughness = subray.roughness;\n childSubray.straightness = subray.straightness;\n childSubray.propagationTimeFactor = subray.propagationTimeFactor;\n childSubray.vanishingTimeFactor = subray.vanishingTimeFactor;\n lightningStrike.onSubrayCreation(segment, subray, childSubray, lightningStrike);\n lightningStrike.randomGenerator.setSeed(parentSeed);\n }\n };\n const vec1Pos = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const vec2Forward = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const vec3Side = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const vec4Up = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this.onSubrayCreation = function(segment, parentSubray, childSubray, lightningStrike) {\n lightningStrike.subrayCylinderPosition(segment, parentSubray, childSubray, 0.5, 0.6, 0.2);\n };\n this.subrayConePosition = function(segment, parentSubray, childSubray, heightFactor, sideWidthFactor, minSideWidthFactor) {\n childSubray.pos0.copy(segment.pos0);\n vec1Pos.subVectors(parentSubray.pos1, parentSubray.pos0);\n vec2Forward.copy(vec1Pos).normalize();\n vec1Pos.multiplyScalar(segment.fraction0 + (1 - segment.fraction0) * (random1() * heightFactor));\n const length = vec1Pos.length();\n vec3Side.crossVectors(parentSubray.up0, vec2Forward);\n const angle = 2 * Math.PI * random1();\n vec3Side.multiplyScalar(Math.cos(angle));\n vec4Up.copy(parentSubray.up0).multiplyScalar(Math.sin(angle));\n childSubray.pos1.copy(vec3Side).add(vec4Up).multiplyScalar(length * sideWidthFactor * (minSideWidthFactor + random1() * (1 - minSideWidthFactor))).add(vec1Pos).add(parentSubray.pos0);\n };\n this.subrayCylinderPosition = function(segment, parentSubray, childSubray, heightFactor, sideWidthFactor, minSideWidthFactor) {\n childSubray.pos0.copy(segment.pos0);\n vec1Pos.subVectors(parentSubray.pos1, parentSubray.pos0);\n vec2Forward.copy(vec1Pos).normalize();\n vec1Pos.multiplyScalar(segment.fraction0 + (1 - segment.fraction0) * ((2 * random1() - 1) * heightFactor));\n const length = vec1Pos.length();\n vec3Side.crossVectors(parentSubray.up0, vec2Forward);\n const angle = 2 * Math.PI * random1();\n vec3Side.multiplyScalar(Math.cos(angle));\n vec4Up.copy(parentSubray.up0).multiplyScalar(Math.sin(angle));\n childSubray.pos1.copy(vec3Side).add(vec4Up).multiplyScalar(length * sideWidthFactor * (minSideWidthFactor + random1() * (1 - minSideWidthFactor))).add(vec1Pos).add(parentSubray.pos0);\n };\n }\n createSubray() {\n return {\n seed: 0,\n maxIterations: 0,\n recursion: 0,\n pos0: new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(),\n pos1: new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(),\n linPos0: new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(),\n linPos1: new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(),\n up0: new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(),\n up1: new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(),\n radius0: 0,\n radius1: 0,\n birthTime: 0,\n deathTime: 0,\n timeScale: 0,\n roughness: 0,\n straightness: 0,\n propagationTimeFactor: 0,\n vanishingTimeFactor: 0,\n endPropagationTime: 0,\n beginVanishingTime: 0\n };\n }\n createSegment() {\n return {\n iteration: 0,\n pos0: new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(),\n pos1: new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(),\n linPos0: new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(),\n linPos1: new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(),\n up0: new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(),\n up1: new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(),\n radius0: 0,\n radius1: 0,\n fraction0: 0,\n fraction1: 0,\n positionVariationFactor: 0\n };\n }\n getNewSegment() {\n return this.raySegments[this.currentSegmentIndex++];\n }\n copy(source) {\n super.copy(source);\n this.init(_LightningStrike.copyParameters({}, source.rayParameters));\n return this;\n }\n clone() {\n return new this.constructor(_LightningStrike.copyParameters({}, this.rayParameters));\n }\n};\nlet LightningStrike = _LightningStrike;\n// Ray states\n__publicField(LightningStrike, \"RAY_INITIALIZED\", 0);\n__publicField(LightningStrike, \"RAY_UNBORN\", 1);\n__publicField(LightningStrike, \"RAY_PROPAGATING\", 2);\n__publicField(LightningStrike, \"RAY_STEADY\", 3);\n__publicField(LightningStrike, \"RAY_VANISHING\", 4);\n__publicField(LightningStrike, \"RAY_EXTINGUISHED\", 5);\n__publicField(LightningStrike, \"COS30DEG\", Math.cos(30 * Math.PI / 180));\n__publicField(LightningStrike, \"SIN30DEG\", Math.sin(30 * Math.PI / 180));\nclass LightningStorm extends three__WEBPACK_IMPORTED_MODULE_42__.Object3D {\n constructor(stormParams = {}) {\n super();\n this.isLightningStorm = true;\n this.stormParams = stormParams;\n stormParams.size = stormParams.size !== void 0 ? stormParams.size : 1e3;\n stormParams.minHeight = stormParams.minHeight !== void 0 ? stormParams.minHeight : 80;\n stormParams.maxHeight = stormParams.maxHeight !== void 0 ? stormParams.maxHeight : 100;\n stormParams.maxSlope = stormParams.maxSlope !== void 0 ? stormParams.maxSlope : 1.1;\n stormParams.maxLightnings = stormParams.maxLightnings !== void 0 ? stormParams.maxLightnings : 3;\n stormParams.lightningMinPeriod = stormParams.lightningMinPeriod !== void 0 ? stormParams.lightningMinPeriod : 3;\n stormParams.lightningMaxPeriod = stormParams.lightningMaxPeriod !== void 0 ? stormParams.lightningMaxPeriod : 7;\n stormParams.lightningMinDuration = stormParams.lightningMinDuration !== void 0 ? stormParams.lightningMinDuration : 1;\n stormParams.lightningMaxDuration = stormParams.lightningMaxDuration !== void 0 ? stormParams.lightningMaxDuration : 2.5;\n this.lightningParameters = LightningStrike.copyParameters(\n stormParams.lightningParameters,\n stormParams.lightningParameters\n );\n this.lightningParameters.isEternal = false;\n this.lightningMaterial = stormParams.lightningMaterial !== void 0 ? stormParams.lightningMaterial : new three__WEBPACK_IMPORTED_MODULE_42__.MeshBasicMaterial({ color: 11599871 });\n if (stormParams.onRayPosition !== void 0) {\n this.onRayPosition = stormParams.onRayPosition;\n } else {\n this.onRayPosition = function(source, dest) {\n dest.set((Math.random() - 0.5) * stormParams.size, 0, (Math.random() - 0.5) * stormParams.size);\n const height = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.lerp(stormParams.minHeight, stormParams.maxHeight, Math.random());\n source.set(stormParams.maxSlope * (2 * Math.random() - 1), 1, stormParams.maxSlope * (2 * Math.random() - 1)).multiplyScalar(height).add(dest);\n };\n }\n this.onLightningDown = stormParams.onLightningDown;\n this.inited = false;\n this.nextLightningTime = 0;\n this.lightningsMeshes = [];\n this.deadLightningsMeshes = [];\n for (let i2 = 0; i2 < this.stormParams.maxLightnings; i2++) {\n const lightning = new LightningStrike(LightningStrike.copyParameters({}, this.lightningParameters));\n const mesh = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(lightning, this.lightningMaterial);\n this.deadLightningsMeshes.push(mesh);\n }\n }\n update(time) {\n if (!this.inited) {\n this.nextLightningTime = this.getNextLightningTime(time) * Math.random();\n this.inited = true;\n }\n if (time >= this.nextLightningTime) {\n const lightningMesh = this.deadLightningsMeshes.pop();\n if (lightningMesh) {\n const lightningParams1 = LightningStrike.copyParameters(\n lightningMesh.geometry.rayParameters,\n this.lightningParameters\n );\n lightningParams1.birthTime = time;\n lightningParams1.deathTime = time + three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.lerp(this.stormParams.lightningMinDuration, this.stormParams.lightningMaxDuration, Math.random());\n this.onRayPosition(lightningParams1.sourceOffset, lightningParams1.destOffset);\n lightningParams1.noiseSeed = Math.random();\n this.add(lightningMesh);\n this.lightningsMeshes.push(lightningMesh);\n }\n this.nextLightningTime = this.getNextLightningTime(time);\n }\n let i2 = 0, il = this.lightningsMeshes.length;\n while (i2 < il) {\n const mesh = this.lightningsMeshes[i2];\n const lightning = mesh.geometry;\n const prevState = lightning.state;\n lightning.update(time);\n if (prevState === LightningStrike.RAY_PROPAGATING && lightning.state > prevState) {\n if (this.onLightningDown) {\n this.onLightningDown(lightning);\n }\n }\n if (lightning.state === LightningStrike.RAY_EXTINGUISHED) {\n this.lightningsMeshes.splice(this.lightningsMeshes.indexOf(mesh), 1);\n this.deadLightningsMeshes.push(mesh);\n this.remove(mesh);\n il--;\n } else {\n i2++;\n }\n }\n }\n getNextLightningTime(currentTime) {\n return currentTime + three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.lerp(this.stormParams.lightningMinPeriod, this.stormParams.lightningMaxPeriod, Math.random()) / (this.stormParams.maxLightnings + 1);\n }\n copy(source, recursive) {\n super.copy(source, recursive);\n this.stormParams.size = source.stormParams.size;\n this.stormParams.minHeight = source.stormParams.minHeight;\n this.stormParams.maxHeight = source.stormParams.maxHeight;\n this.stormParams.maxSlope = source.stormParams.maxSlope;\n this.stormParams.maxLightnings = source.stormParams.maxLightnings;\n this.stormParams.lightningMinPeriod = source.stormParams.lightningMinPeriod;\n this.stormParams.lightningMaxPeriod = source.stormParams.lightningMaxPeriod;\n this.stormParams.lightningMinDuration = source.stormParams.lightningMinDuration;\n this.stormParams.lightningMaxDuration = source.stormParams.lightningMaxDuration;\n this.lightningParameters = LightningStrike.copyParameters({}, source.lightningParameters);\n this.lightningMaterial = source.stormParams.lightningMaterial;\n this.onLightningDown = source.onLightningDown;\n return this;\n }\n clone() {\n return new this.constructor(this.stormParams).copy(this);\n }\n}\nclass ReflectorRTT extends Reflector {\n constructor(geometry2, options) {\n super(geometry2, options);\n this.geometry.setDrawRange(0, 0);\n }\n}\nconst _ReflectorForSSRPass = class extends three__WEBPACK_IMPORTED_MODULE_42__.Mesh {\n constructor(geometry2, options = {}) {\n super(geometry2);\n this.isReflectorForSSRPass = true;\n this.type = \"ReflectorForSSRPass\";\n const scope = this;\n const color = options.color !== void 0 ? new three__WEBPACK_IMPORTED_MODULE_42__.Color(options.color) : new three__WEBPACK_IMPORTED_MODULE_42__.Color(8355711);\n const textureWidth = options.textureWidth || 512;\n const textureHeight = options.textureHeight || 512;\n const clipBias = options.clipBias || 0;\n const shader = options.shader || _ReflectorForSSRPass.ReflectorShader;\n const useDepthTexture = options.useDepthTexture === true;\n const yAxis2 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 1, 0);\n const vecTemp0 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const vecTemp1 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n scope.needsUpdate = false;\n scope.maxDistance = _ReflectorForSSRPass.ReflectorShader.uniforms.maxDistance.value;\n scope.opacity = _ReflectorForSSRPass.ReflectorShader.uniforms.opacity.value;\n scope.color = color;\n scope.resolution = options.resolution || new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(window.innerWidth, window.innerHeight);\n scope._distanceAttenuation = _ReflectorForSSRPass.ReflectorShader.defines.DISTANCE_ATTENUATION;\n Object.defineProperty(scope, \"distanceAttenuation\", {\n get() {\n return scope._distanceAttenuation;\n },\n set(val) {\n if (scope._distanceAttenuation === val)\n return;\n scope._distanceAttenuation = val;\n scope.material.defines.DISTANCE_ATTENUATION = val;\n scope.material.needsUpdate = true;\n }\n });\n scope._fresnel = _ReflectorForSSRPass.ReflectorShader.defines.FRESNEL;\n Object.defineProperty(scope, \"fresnel\", {\n get() {\n return scope._fresnel;\n },\n set(val) {\n if (scope._fresnel === val)\n return;\n scope._fresnel = val;\n scope.material.defines.FRESNEL = val;\n scope.material.needsUpdate = true;\n }\n });\n const normal = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const reflectorWorldPosition = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const cameraWorldPosition = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const rotationMatrix2 = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n const lookAtPosition = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 0, -1);\n const view = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const target = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const textureMatrix = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n const virtualCamera = new three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera();\n let depthTexture;\n if (useDepthTexture) {\n depthTexture = new three__WEBPACK_IMPORTED_MODULE_42__.DepthTexture();\n depthTexture.type = three__WEBPACK_IMPORTED_MODULE_42__.UnsignedShortType;\n depthTexture.minFilter = three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter;\n depthTexture.magFilter = three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter;\n }\n const parameters = {\n depthTexture: useDepthTexture ? depthTexture : null,\n type: three__WEBPACK_IMPORTED_MODULE_42__.HalfFloatType\n };\n const renderTarget = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(textureWidth, textureHeight, parameters);\n const material2 = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n transparent: useDepthTexture,\n defines: Object.assign({}, _ReflectorForSSRPass.ReflectorShader.defines, {\n useDepthTexture\n }),\n uniforms: three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(shader.uniforms),\n fragmentShader: shader.fragmentShader,\n vertexShader: shader.vertexShader\n });\n material2.uniforms[\"tDiffuse\"].value = renderTarget.texture;\n material2.uniforms[\"color\"].value = scope.color;\n material2.uniforms[\"textureMatrix\"].value = textureMatrix;\n if (useDepthTexture) {\n material2.uniforms[\"tDepth\"].value = renderTarget.depthTexture;\n }\n this.material = material2;\n const globalPlane = new three__WEBPACK_IMPORTED_MODULE_42__.Plane(new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 1, 0), clipBias);\n const globalPlanes = [globalPlane];\n this.doRender = function(renderer, scene, camera) {\n material2.uniforms[\"maxDistance\"].value = scope.maxDistance;\n material2.uniforms[\"color\"].value = scope.color;\n material2.uniforms[\"opacity\"].value = scope.opacity;\n vecTemp0.copy(camera.position).normalize();\n vecTemp1.copy(vecTemp0).reflect(yAxis2);\n material2.uniforms[\"fresnelCoe\"].value = (vecTemp0.dot(vecTemp1) + 1) / 2;\n reflectorWorldPosition.setFromMatrixPosition(scope.matrixWorld);\n cameraWorldPosition.setFromMatrixPosition(camera.matrixWorld);\n rotationMatrix2.extractRotation(scope.matrixWorld);\n normal.set(0, 0, 1);\n normal.applyMatrix4(rotationMatrix2);\n view.subVectors(reflectorWorldPosition, cameraWorldPosition);\n if (view.dot(normal) > 0)\n return;\n view.reflect(normal).negate();\n view.add(reflectorWorldPosition);\n rotationMatrix2.extractRotation(camera.matrixWorld);\n lookAtPosition.set(0, 0, -1);\n lookAtPosition.applyMatrix4(rotationMatrix2);\n lookAtPosition.add(cameraWorldPosition);\n target.subVectors(reflectorWorldPosition, lookAtPosition);\n target.reflect(normal).negate();\n target.add(reflectorWorldPosition);\n virtualCamera.position.copy(view);\n virtualCamera.up.set(0, 1, 0);\n virtualCamera.up.applyMatrix4(rotationMatrix2);\n virtualCamera.up.reflect(normal);\n virtualCamera.lookAt(target);\n virtualCamera.far = camera.far;\n virtualCamera.updateMatrixWorld();\n virtualCamera.projectionMatrix.copy(camera.projectionMatrix);\n material2.uniforms[\"virtualCameraNear\"].value = camera.near;\n material2.uniforms[\"virtualCameraFar\"].value = camera.far;\n material2.uniforms[\"virtualCameraMatrixWorld\"].value = virtualCamera.matrixWorld;\n material2.uniforms[\"virtualCameraProjectionMatrix\"].value = camera.projectionMatrix;\n material2.uniforms[\"virtualCameraProjectionMatrixInverse\"].value = camera.projectionMatrixInverse;\n material2.uniforms[\"resolution\"].value = scope.resolution;\n textureMatrix.set(0.5, 0, 0, 0.5, 0, 0.5, 0, 0.5, 0, 0, 0.5, 0.5, 0, 0, 0, 1);\n textureMatrix.multiply(virtualCamera.projectionMatrix);\n textureMatrix.multiply(virtualCamera.matrixWorldInverse);\n textureMatrix.multiply(scope.matrixWorld);\n const currentRenderTarget = renderer.getRenderTarget();\n const currentXrEnabled = renderer.xr.enabled;\n const currentShadowAutoUpdate = renderer.shadowMap.autoUpdate;\n const currentClippingPlanes = renderer.clippingPlanes;\n renderer.xr.enabled = false;\n renderer.shadowMap.autoUpdate = false;\n renderer.clippingPlanes = globalPlanes;\n renderer.setRenderTarget(renderTarget);\n renderer.state.buffers.depth.setMask(true);\n if (renderer.autoClear === false)\n renderer.clear();\n renderer.render(scene, virtualCamera);\n renderer.xr.enabled = currentXrEnabled;\n renderer.shadowMap.autoUpdate = currentShadowAutoUpdate;\n renderer.clippingPlanes = currentClippingPlanes;\n renderer.setRenderTarget(currentRenderTarget);\n const viewport = camera.viewport;\n if (viewport !== void 0) {\n renderer.state.viewport(viewport);\n }\n };\n this.getRenderTarget = function() {\n return renderTarget;\n };\n }\n};\nlet ReflectorForSSRPass = _ReflectorForSSRPass;\n__publicField(ReflectorForSSRPass, \"ReflectorShader\", {\n defines: {\n DISTANCE_ATTENUATION: true,\n FRESNEL: true\n },\n uniforms: {\n color: { value: null },\n tDiffuse: { value: null },\n tDepth: { value: null },\n textureMatrix: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4() },\n maxDistance: { value: 180 },\n opacity: { value: 0.5 },\n fresnelCoe: { value: null },\n virtualCameraNear: { value: null },\n virtualCameraFar: { value: null },\n virtualCameraProjectionMatrix: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4() },\n virtualCameraMatrixWorld: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4() },\n virtualCameraProjectionMatrixInverse: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4() },\n resolution: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector2() }\n },\n vertexShader: (\n /* glsl */\n `\n\t\tuniform mat4 textureMatrix;\n\t\tvarying vec4 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = textureMatrix * vec4( position, 1.0 );\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}`\n ),\n fragmentShader: (\n /* glsl */\n `\n\t\tuniform vec3 color;\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform sampler2D tDepth;\n\t\tuniform float maxDistance;\n\t\tuniform float opacity;\n\t\tuniform float fresnelCoe;\n\t\tuniform float virtualCameraNear;\n\t\tuniform float virtualCameraFar;\n\t\tuniform mat4 virtualCameraProjectionMatrix;\n\t\tuniform mat4 virtualCameraProjectionMatrixInverse;\n\t\tuniform mat4 virtualCameraMatrixWorld;\n\t\tuniform vec2 resolution;\n\t\tvarying vec4 vUv;\n\t\t#include \n\t\tfloat blendOverlay( float base, float blend ) {\n\t\t\treturn( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );\n\t\t}\n\t\tvec3 blendOverlay( vec3 base, vec3 blend ) {\n\t\t\treturn vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );\n\t\t}\n\t\tfloat getDepth( const in vec2 uv ) {\n\t\t\treturn texture2D( tDepth, uv ).x;\n\t\t}\n\t\tfloat getViewZ( const in float depth ) {\n\t\t\treturn perspectiveDepthToViewZ( depth, virtualCameraNear, virtualCameraFar );\n\t\t}\n\t\tvec3 getViewPosition( const in vec2 uv, const in float depth/*clip space*/, const in float clipW ) {\n\t\t\tvec4 clipPosition = vec4( ( vec3( uv, depth ) - 0.5 ) * 2.0, 1.0 );//ndc\n\t\t\tclipPosition *= clipW; //clip\n\t\t\treturn ( virtualCameraProjectionMatrixInverse * clipPosition ).xyz;//view\n\t\t}\n\t\tvoid main() {\n\t\t\tvec4 base = texture2DProj( tDiffuse, vUv );\n\t\t\t#ifdef useDepthTexture\n\t\t\t\tvec2 uv=(gl_FragCoord.xy-.5)/resolution.xy;\n\t\t\t\tuv.x=1.-uv.x;\n\t\t\t\tfloat depth = texture2DProj( tDepth, vUv ).r;\n\t\t\t\tfloat viewZ = getViewZ( depth );\n\t\t\t\tfloat clipW = virtualCameraProjectionMatrix[2][3] * viewZ+virtualCameraProjectionMatrix[3][3];\n\t\t\t\tvec3 viewPosition=getViewPosition( uv, depth, clipW );\n\t\t\t\tvec3 worldPosition=(virtualCameraMatrixWorld*vec4(viewPosition,1)).xyz;\n\t\t\t\tif(worldPosition.y>maxDistance) discard;\n\t\t\t\tfloat op=opacity;\n\t\t\t\t#ifdef DISTANCE_ATTENUATION\n\t\t\t\t\tfloat ratio=1.-(worldPosition.y/maxDistance);\n\t\t\t\t\tfloat attenuation=ratio*ratio;\n\t\t\t\t\top=opacity*attenuation;\n\t\t\t\t#endif\n\t\t\t\t#ifdef FRESNEL\n\t\t\t\t\top*=fresnelCoe;\n\t\t\t\t#endif\n\t\t\t\tgl_FragColor = vec4( blendOverlay( base.rgb, color ), op );\n\t\t\t#else\n\t\t\t\tgl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );\n\t\t\t#endif\n\t\t}\n\t`\n )\n});\nconst SkyShader = {\n uniforms: {\n turbidity: { value: 2 },\n rayleigh: { value: 1 },\n mieCoefficient: { value: 5e-3 },\n mieDirectionalG: { value: 0.8 },\n sunPosition: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3() },\n up: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 1, 0) }\n },\n vertexShader: (\n /* glsl */\n `\n uniform vec3 sunPosition;\n uniform float rayleigh;\n uniform float turbidity;\n uniform float mieCoefficient;\n uniform vec3 up;\n\n varying vec3 vWorldPosition;\n varying vec3 vSunDirection;\n varying float vSunfade;\n varying vec3 vBetaR;\n varying vec3 vBetaM;\n varying float vSunE;\n\n // constants for atmospheric scattering\n const float e = 2.71828182845904523536028747135266249775724709369995957;\n const float pi = 3.141592653589793238462643383279502884197169;\n\n // wavelength of used primaries, according to preetham\n const vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 );\n // this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function:\n // (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn))\n const vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 );\n\n // mie stuff\n // K coefficient for the primaries\n const float v = 4.0;\n const vec3 K = vec3( 0.686, 0.678, 0.666 );\n // MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K\n const vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 );\n\n // earth shadow hack\n // cutoffAngle = pi / 1.95;\n const float cutoffAngle = 1.6110731556870734;\n const float steepness = 1.5;\n const float EE = 1000.0;\n\n float sunIntensity( float zenithAngleCos ) {\n zenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 );\n return EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) );\n }\n\n vec3 totalMie( float T ) {\n float c = ( 0.2 * T ) * 10E-18;\n return 0.434 * c * MieConst;\n }\n\n void main() {\n\n vec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n vWorldPosition = worldPosition.xyz;\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n gl_Position.z = gl_Position.w; // set z to camera.far\n\n vSunDirection = normalize( sunPosition );\n\n vSunE = sunIntensity( dot( vSunDirection, up ) );\n\n vSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 );\n\n float rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) );\n\n // extinction (absorbtion + out scattering)\n // rayleigh coefficients\n vBetaR = totalRayleigh * rayleighCoefficient;\n\n // mie coefficients\n vBetaM = totalMie( turbidity ) * mieCoefficient;\n\n }\n `\n ),\n fragmentShader: (\n /* glsl */\n `\n varying vec3 vWorldPosition;\n varying vec3 vSunDirection;\n varying float vSunfade;\n varying vec3 vBetaR;\n varying vec3 vBetaM;\n varying float vSunE;\n\n uniform float mieDirectionalG;\n uniform vec3 up;\n\n const vec3 cameraPos = vec3( 0.0, 0.0, 0.0 );\n\n // constants for atmospheric scattering\n const float pi = 3.141592653589793238462643383279502884197169;\n\n const float n = 1.0003; // refractive index of air\n const float N = 2.545E25; // number of molecules per unit volume for air at 288.15K and 1013mb (sea level -45 celsius)\n\n // optical length at zenith for molecules\n const float rayleighZenithLength = 8.4E3;\n const float mieZenithLength = 1.25E3;\n // 66 arc seconds -> degrees, and the cosine of that\n const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;\n\n // 3.0 / ( 16.0 * pi )\n const float THREE_OVER_SIXTEENPI = 0.05968310365946075;\n // 1.0 / ( 4.0 * pi )\n const float ONE_OVER_FOURPI = 0.07957747154594767;\n\n float rayleighPhase( float cosTheta ) {\n return THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) );\n }\n\n float hgPhase( float cosTheta, float g ) {\n float g2 = pow( g, 2.0 );\n float inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 );\n return ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse );\n }\n\n void main() {\n\n vec3 direction = normalize( vWorldPosition - cameraPos );\n\n // optical length\n // cutoff angle at 90 to avoid singularity in next formula.\n float zenithAngle = acos( max( 0.0, dot( up, direction ) ) );\n float inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) );\n float sR = rayleighZenithLength * inverse;\n float sM = mieZenithLength * inverse;\n\n // combined extinction factor\n vec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) );\n\n // in scattering\n float cosTheta = dot( direction, vSunDirection );\n\n float rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 );\n vec3 betaRTheta = vBetaR * rPhase;\n\n float mPhase = hgPhase( cosTheta, mieDirectionalG );\n vec3 betaMTheta = vBetaM * mPhase;\n\n vec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) );\n Lin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) );\n\n // nightsky\n float theta = acos( direction.y ); // elevation --> y-axis, [-pi/2, pi/2]\n float phi = atan( direction.z, direction.x ); // azimuth --> x-axis [-pi/2, pi/2]\n vec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 );\n vec3 L0 = vec3( 0.1 ) * Fex;\n\n // composition + solar disc\n float sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta );\n L0 += ( vSunE * 19000.0 * Fex ) * sundisk;\n\n vec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 );\n\n vec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) );\n\n gl_FragColor = vec4( retColor, 1.0 );\n\n #include \n #include <${parseInt(three__WEBPACK_IMPORTED_MODULE_42__.REVISION.replace(/\\D+/g, \"\")) >= 154 ? \"colorspace_fragment\" : \"encodings_fragment\"}>\n\n }\n `\n )\n};\nconst material = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n name: \"SkyShader\",\n fragmentShader: SkyShader.fragmentShader,\n vertexShader: SkyShader.vertexShader,\n uniforms: /* @__PURE__ */ three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(SkyShader.uniforms),\n side: three__WEBPACK_IMPORTED_MODULE_42__.BackSide,\n depthWrite: false\n});\nclass Sky extends three__WEBPACK_IMPORTED_MODULE_42__.Mesh {\n constructor() {\n super(new three__WEBPACK_IMPORTED_MODULE_42__.BoxGeometry(1, 1, 1), material);\n }\n}\n__publicField(Sky, \"SkyShader\", SkyShader);\n__publicField(Sky, \"material\", material);\nconst _Water2 = class extends three__WEBPACK_IMPORTED_MODULE_42__.Mesh {\n constructor(geometry2, options = {}) {\n super(geometry2);\n this.isWater = true;\n this.type = \"Water\";\n const scope = this;\n const color = options.color !== void 0 ? new three__WEBPACK_IMPORTED_MODULE_42__.Color(options.color) : new three__WEBPACK_IMPORTED_MODULE_42__.Color(16777215);\n const textureWidth = options.textureWidth || 512;\n const textureHeight = options.textureHeight || 512;\n const clipBias = options.clipBias || 0;\n const flowDirection = options.flowDirection || new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(1, 0);\n const flowSpeed = options.flowSpeed || 0.03;\n const reflectivity = options.reflectivity || 0.02;\n const scale = options.scale || 1;\n const shader = options.shader || _Water2.WaterShader;\n const encoding = options.encoding !== void 0 ? options.encoding : 3e3;\n const flowMap = options.flowMap || void 0;\n const normalMap0 = options.normalMap0;\n const normalMap1 = options.normalMap1;\n const cycle = 0.15;\n const halfCycle = cycle * 0.5;\n const textureMatrix = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n const clock = new three__WEBPACK_IMPORTED_MODULE_42__.Clock();\n if (Reflector === void 0) {\n console.error(\"THREE.Water: Required component Reflector not found.\");\n return;\n }\n if (Refractor === void 0) {\n console.error(\"THREE.Water: Required component Refractor not found.\");\n return;\n }\n const reflector = new Reflector(geometry2, {\n textureWidth,\n textureHeight,\n clipBias,\n encoding\n });\n const refractor = new Refractor(geometry2, {\n textureWidth,\n textureHeight,\n clipBias,\n encoding\n });\n reflector.matrixAutoUpdate = false;\n refractor.matrixAutoUpdate = false;\n this.material = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.merge([three__WEBPACK_IMPORTED_MODULE_42__.UniformsLib[\"fog\"], shader.uniforms]),\n vertexShader: shader.vertexShader,\n fragmentShader: shader.fragmentShader,\n transparent: true,\n fog: true\n });\n if (flowMap !== void 0) {\n this.material.defines.USE_FLOWMAP = \"\";\n this.material.uniforms[\"tFlowMap\"] = {\n type: \"t\",\n value: flowMap\n };\n } else {\n this.material.uniforms[\"flowDirection\"] = {\n type: \"v2\",\n value: flowDirection\n };\n }\n normalMap0.wrapS = normalMap0.wrapT = three__WEBPACK_IMPORTED_MODULE_42__.RepeatWrapping;\n normalMap1.wrapS = normalMap1.wrapT = three__WEBPACK_IMPORTED_MODULE_42__.RepeatWrapping;\n this.material.uniforms[\"tReflectionMap\"].value = reflector.getRenderTarget().texture;\n this.material.uniforms[\"tRefractionMap\"].value = refractor.getRenderTarget().texture;\n this.material.uniforms[\"tNormalMap0\"].value = normalMap0;\n this.material.uniforms[\"tNormalMap1\"].value = normalMap1;\n this.material.uniforms[\"color\"].value = color;\n this.material.uniforms[\"reflectivity\"].value = reflectivity;\n this.material.uniforms[\"textureMatrix\"].value = textureMatrix;\n this.material.uniforms[\"config\"].value.x = 0;\n this.material.uniforms[\"config\"].value.y = halfCycle;\n this.material.uniforms[\"config\"].value.z = halfCycle;\n this.material.uniforms[\"config\"].value.w = scale;\n function updateTextureMatrix(camera) {\n textureMatrix.set(0.5, 0, 0, 0.5, 0, 0.5, 0, 0.5, 0, 0, 0.5, 0.5, 0, 0, 0, 1);\n textureMatrix.multiply(camera.projectionMatrix);\n textureMatrix.multiply(camera.matrixWorldInverse);\n textureMatrix.multiply(scope.matrixWorld);\n }\n function updateFlow() {\n const delta = clock.getDelta();\n const config = scope.material.uniforms[\"config\"];\n config.value.x += flowSpeed * delta;\n config.value.y = config.value.x + halfCycle;\n if (config.value.x >= cycle) {\n config.value.x = 0;\n config.value.y = halfCycle;\n } else if (config.value.y >= cycle) {\n config.value.y = config.value.y - cycle;\n }\n }\n this.onBeforeRender = function(renderer, scene, camera) {\n updateTextureMatrix(camera);\n updateFlow();\n scope.visible = false;\n reflector.matrixWorld.copy(scope.matrixWorld);\n refractor.matrixWorld.copy(scope.matrixWorld);\n reflector.onBeforeRender(renderer, scene, camera);\n refractor.onBeforeRender(renderer, scene, camera);\n scope.visible = true;\n };\n }\n};\nlet Water2 = _Water2;\n__publicField(Water2, \"WaterShader\", {\n uniforms: {\n color: {\n value: null\n },\n reflectivity: {\n value: 0\n },\n tReflectionMap: {\n value: null\n },\n tRefractionMap: {\n value: null\n },\n tNormalMap0: {\n value: null\n },\n tNormalMap1: {\n value: null\n },\n textureMatrix: {\n value: null\n },\n config: {\n value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector4()\n }\n },\n vertexShader: (\n /* glsl */\n `\n\n\t\t#include \n\t\t#include \n\t\t#include \n\n\t\tuniform mat4 textureMatrix;\n\n\t\tvarying vec4 vCoord;\n\t\tvarying vec2 vUv;\n\t\tvarying vec3 vToEye;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tvCoord = textureMatrix * vec4( position, 1.0 );\n\n\t\t\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\t\t\tvToEye = cameraPosition - worldPosition.xyz;\n\n\t\t\tvec4 mvPosition = viewMatrix * worldPosition; // used in fog_vertex\n\t\t\tgl_Position = projectionMatrix * mvPosition;\n\n\t\t\t#include \n\t\t\t#include \n\n\t\t}`\n ),\n fragmentShader: (\n /* glsl */\n `\n\n\t\t#include \n\t\t#include \n\t\t#include \n\n\t\tuniform sampler2D tReflectionMap;\n\t\tuniform sampler2D tRefractionMap;\n\t\tuniform sampler2D tNormalMap0;\n\t\tuniform sampler2D tNormalMap1;\n\n\t\t#ifdef USE_FLOWMAP\n\t\t\tuniform sampler2D tFlowMap;\n\t\t#else\n\t\t\tuniform vec2 flowDirection;\n\t\t#endif\n\n\t\tuniform vec3 color;\n\t\tuniform float reflectivity;\n\t\tuniform vec4 config;\n\n\t\tvarying vec4 vCoord;\n\t\tvarying vec2 vUv;\n\t\tvarying vec3 vToEye;\n\n\t\tvoid main() {\n\n\t\t\t#include \n\n\t\t\tfloat flowMapOffset0 = config.x;\n\t\t\tfloat flowMapOffset1 = config.y;\n\t\t\tfloat halfCycle = config.z;\n\t\t\tfloat scale = config.w;\n\n\t\t\tvec3 toEye = normalize( vToEye );\n\n\t\t\t// determine flow direction\n\t\t\tvec2 flow;\n\t\t\t#ifdef USE_FLOWMAP\n\t\t\t\tflow = texture2D( tFlowMap, vUv ).rg * 2.0 - 1.0;\n\t\t\t#else\n\t\t\t\tflow = flowDirection;\n\t\t\t#endif\n\t\t\tflow.x *= - 1.0;\n\n\t\t\t// sample normal maps (distort uvs with flowdata)\n\t\t\tvec4 normalColor0 = texture2D( tNormalMap0, ( vUv * scale ) + flow * flowMapOffset0 );\n\t\t\tvec4 normalColor1 = texture2D( tNormalMap1, ( vUv * scale ) + flow * flowMapOffset1 );\n\n\t\t\t// linear interpolate to get the final normal color\n\t\t\tfloat flowLerp = abs( halfCycle - flowMapOffset0 ) / halfCycle;\n\t\t\tvec4 normalColor = mix( normalColor0, normalColor1, flowLerp );\n\n\t\t\t// calculate normal vector\n\t\t\tvec3 normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b, normalColor.g * 2.0 - 1.0 ) );\n\n\t\t\t// calculate the fresnel term to blend reflection and refraction maps\n\t\t\tfloat theta = max( dot( toEye, normal ), 0.0 );\n\t\t\tfloat reflectance = reflectivity + ( 1.0 - reflectivity ) * pow( ( 1.0 - theta ), 5.0 );\n\n\t\t\t// calculate final uv coords\n\t\t\tvec3 coord = vCoord.xyz / vCoord.w;\n\t\t\tvec2 uv = coord.xy + coord.z * normal.xz * 0.05;\n\n\t\t\tvec4 reflectColor = texture2D( tReflectionMap, vec2( 1.0 - uv.x, uv.y ) );\n\t\t\tvec4 refractColor = texture2D( tRefractionMap, uv );\n\n\t\t\t// multiply water color with the mix of both textures\n\t\t\tgl_FragColor = vec4( color, 1.0 ) * mix( refractColor, reflectColor, reflectance );\n\n\t\t\t#include \n\t\t\t#include <${parseInt(three__WEBPACK_IMPORTED_MODULE_42__.REVISION.replace(/\\D+/g, \"\")) >= 154 ? \"colorspace_fragment\" : \"encodings_fragment\"}>\n\t\t\t#include \n\n\t\t}`\n )\n});\nconst isCubeTexture = (def) => def && def.isCubeTexture;\nclass GroundProjectedEnv extends three__WEBPACK_IMPORTED_MODULE_42__.Mesh {\n constructor(texture, options) {\n var _a2, _b2;\n const isCubeMap = isCubeTexture(texture);\n const w = (_b2 = isCubeMap ? (_a2 = texture.image[0]) == null ? void 0 : _a2.width : texture.image.width) != null ? _b2 : 1024;\n const cubeSize = w / 4;\n const _lodMax = Math.floor(Math.log2(cubeSize));\n const _cubeSize = Math.pow(2, _lodMax);\n const width = 3 * Math.max(_cubeSize, 16 * 7);\n const height = 4 * _cubeSize;\n const defines = [\n isCubeMap ? \"#define ENVMAP_TYPE_CUBE\" : \"\",\n `#define CUBEUV_TEXEL_WIDTH ${1 / width}`,\n `#define CUBEUV_TEXEL_HEIGHT ${1 / height}`,\n `#define CUBEUV_MAX_MIP ${_lodMax}.0`\n ];\n const vertexShader = (\n /* glsl */\n `\n varying vec3 vWorldPosition;\n void main() \n {\n vec4 worldPosition = ( modelMatrix * vec4( position, 1.0 ) );\n vWorldPosition = worldPosition.xyz;\n \n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }\n `\n );\n const fragmentShader = defines.join(\"\\n\") + /* glsl */\n `\n #define ENVMAP_TYPE_CUBE_UV\n varying vec3 vWorldPosition;\n uniform float radius;\n uniform float height;\n uniform float angle;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube map;\n #else\n uniform sampler2D map;\n #endif\n // From: https://www.shadertoy.com/view/4tsBD7\n float diskIntersectWithBackFaceCulling( vec3 ro, vec3 rd, vec3 c, vec3 n, float r ) \n {\n float d = dot ( rd, n );\n \n if( d > 0.0 ) { return 1e6; }\n \n vec3 o = ro - c;\n float t = - dot( n, o ) / d;\n vec3 q = o + rd * t;\n \n return ( dot( q, q ) < r * r ) ? t : 1e6;\n }\n // From: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm\n float sphereIntersect( vec3 ro, vec3 rd, vec3 ce, float ra ) \n {\n vec3 oc = ro - ce;\n float b = dot( oc, rd );\n float c = dot( oc, oc ) - ra * ra;\n float h = b * b - c;\n \n if( h < 0.0 ) { return -1.0; }\n \n h = sqrt( h );\n \n return - b + h;\n }\n vec3 project() \n {\n vec3 p = normalize( vWorldPosition );\n vec3 camPos = cameraPosition;\n camPos.y -= height;\n float intersection = sphereIntersect( camPos, p, vec3( 0.0 ), radius );\n if( intersection > 0.0 ) {\n \n vec3 h = vec3( 0.0, - height, 0.0 );\n float intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius );\n p = ( camPos + min( intersection, intersection2 ) * p ) / radius;\n } else {\n p = vec3( 0.0, 1.0, 0.0 );\n }\n return p;\n }\n #include \n #include \n void main() \n {\n vec3 projectedWorldPosition = project();\n \n #ifdef ENVMAP_TYPE_CUBE\n vec3 outcolor = textureCube( map, projectedWorldPosition ).rgb;\n #else\n vec3 direction = normalize( projectedWorldPosition );\n vec2 uv = equirectUv( direction );\n vec3 outcolor = texture2D( map, uv ).rgb;\n #endif\n gl_FragColor = vec4( outcolor, 1.0 );\n #include \n #include <${parseInt(three__WEBPACK_IMPORTED_MODULE_42__.REVISION.replace(/\\D+/g, \"\")) >= 154 ? \"colorspace_fragment\" : \"encodings_fragment\"}>\n }\n `;\n const uniforms = {\n map: { value: texture },\n height: { value: (options == null ? void 0 : options.height) || 15 },\n radius: { value: (options == null ? void 0 : options.radius) || 100 }\n };\n const geometry2 = new three__WEBPACK_IMPORTED_MODULE_42__.IcosahedronGeometry(1, 16);\n const material2 = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms,\n fragmentShader,\n vertexShader,\n side: three__WEBPACK_IMPORTED_MODULE_42__.DoubleSide\n });\n super(geometry2, material2);\n }\n set radius(radius) {\n this.material.uniforms.radius.value = radius;\n }\n get radius() {\n return this.material.uniforms.radius.value;\n }\n set height(height) {\n this.material.uniforms.height.value = height;\n }\n get height() {\n return this.material.uniforms.height.value;\n }\n}\nconst SceneUtils = {\n createMeshesFromInstancedMesh: function(instancedMesh) {\n const group = new three__WEBPACK_IMPORTED_MODULE_42__.Group();\n const count = instancedMesh.count;\n const geometry2 = instancedMesh.geometry;\n const material2 = instancedMesh.material;\n for (let i2 = 0; i2 < count; i2++) {\n const mesh = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(geometry2, material2);\n instancedMesh.getMatrixAt(i2, mesh.matrix);\n mesh.matrix.decompose(mesh.position, mesh.quaternion, mesh.scale);\n group.add(mesh);\n }\n group.copy(instancedMesh);\n group.updateMatrixWorld();\n return group;\n },\n createMultiMaterialObject: function(geometry2, materials) {\n const group = new three__WEBPACK_IMPORTED_MODULE_42__.Group();\n for (let i2 = 0, l = materials.length; i2 < l; i2++) {\n group.add(new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(geometry2, materials[i2]));\n }\n return group;\n },\n detach: function(child, parent, scene) {\n console.warn(\"THREE.SceneUtils: detach() has been deprecated. Use scene.attach( child ) instead.\");\n scene.attach(child);\n },\n attach: function(child, scene, parent) {\n console.warn(\"THREE.SceneUtils: attach() has been deprecated. Use parent.attach( child ) instead.\");\n parent.attach(child);\n }\n};\nfunction UVsDebug(geometry2, size2 = 1024) {\n const abc = \"abc\";\n const a2 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2();\n const b2 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2();\n const uvs = [new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(), new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(), new three__WEBPACK_IMPORTED_MODULE_42__.Vector2()];\n const face = [];\n const canvas = document.createElement(\"canvas\");\n const width = size2;\n const height = size2;\n canvas.width = width;\n canvas.height = height;\n const ctx = canvas.getContext(\"2d\");\n ctx.lineWidth = 1;\n ctx.strokeStyle = \"rgb( 63, 63, 63 )\";\n ctx.textAlign = \"center\";\n ctx.fillStyle = \"rgb( 255, 255, 255 )\";\n ctx.fillRect(0, 0, width, height);\n const index = geometry2.index;\n const uvAttribute = geometry2.attributes.uv;\n if (index) {\n for (let i2 = 0, il = index.count; i2 < il; i2 += 3) {\n face[0] = index.getX(i2);\n face[1] = index.getX(i2 + 1);\n face[2] = index.getX(i2 + 2);\n uvs[0].fromBufferAttribute(uvAttribute, face[0]);\n uvs[1].fromBufferAttribute(uvAttribute, face[1]);\n uvs[2].fromBufferAttribute(uvAttribute, face[2]);\n processFace(face, uvs, i2 / 3);\n }\n } else {\n for (let i2 = 0, il = uvAttribute.count; i2 < il; i2 += 3) {\n face[0] = i2;\n face[1] = i2 + 1;\n face[2] = i2 + 2;\n uvs[0].fromBufferAttribute(uvAttribute, face[0]);\n uvs[1].fromBufferAttribute(uvAttribute, face[1]);\n uvs[2].fromBufferAttribute(uvAttribute, face[2]);\n processFace(face, uvs, i2 / 3);\n }\n }\n return canvas;\n function processFace(face2, uvs2, index2) {\n ctx.beginPath();\n a2.set(0, 0);\n for (let j = 0, jl = uvs2.length; j < jl; j++) {\n const uv = uvs2[j];\n a2.x += uv.x;\n a2.y += uv.y;\n if (j === 0) {\n ctx.moveTo(uv.x * (width - 2) + 0.5, (1 - uv.y) * (height - 2) + 0.5);\n } else {\n ctx.lineTo(uv.x * (width - 2) + 0.5, (1 - uv.y) * (height - 2) + 0.5);\n }\n }\n ctx.closePath();\n ctx.stroke();\n a2.divideScalar(uvs2.length);\n ctx.font = \"18px Arial\";\n ctx.fillStyle = \"rgb( 63, 63, 63 )\";\n ctx.fillText(index2, a2.x * width, (1 - a2.y) * height);\n if (a2.x > 0.95) {\n ctx.fillText(index2, a2.x % 1 * width, (1 - a2.y) * height);\n }\n ctx.font = \"12px Arial\";\n ctx.fillStyle = \"rgb( 191, 191, 191 )\";\n for (let j = 0, jl = uvs2.length; j < jl; j++) {\n const uv = uvs2[j];\n b2.addVectors(a2, uv).divideScalar(2);\n const vnum = face2[j];\n ctx.fillText(abc[j] + vnum, b2.x * width, (1 - b2.y) * height);\n if (b2.x > 0.95) {\n ctx.fillText(abc[j] + vnum, b2.x % 1 * width, (1 - b2.y) * height);\n }\n }\n }\n}\nconst hilbert2D = (center2 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 0, 0), size2 = 10, iterations = 1, v0 = 0, v12 = 1, v2 = 2, v3 = 3) => {\n const half = size2 / 2;\n const vec_s = [\n new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(center2.x - half, center2.y, center2.z - half),\n new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(center2.x - half, center2.y, center2.z + half),\n new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(center2.x + half, center2.y, center2.z + half),\n new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(center2.x + half, center2.y, center2.z - half)\n ];\n const vec = [vec_s[v0], vec_s[v12], vec_s[v2], vec_s[v3]];\n if (0 <= --iterations) {\n const tmp = [];\n Array.prototype.push.apply(tmp, hilbert2D(vec[0], half, iterations, v0, v3, v2, v12));\n Array.prototype.push.apply(tmp, hilbert2D(vec[1], half, iterations, v0, v12, v2, v3));\n Array.prototype.push.apply(tmp, hilbert2D(vec[2], half, iterations, v0, v12, v2, v3));\n Array.prototype.push.apply(tmp, hilbert2D(vec[3], half, iterations, v2, v12, v0, v3));\n return tmp;\n }\n return vec;\n};\nconst hilbert3D = (center2 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 0, 0), size2 = 10, iterations = 1, v0 = 0, v12 = 1, v2 = 2, v3 = 3, v4 = 4, v5 = 5, v6 = 6, v7 = 7) => {\n const half = size2 / 2;\n const vec_s = [\n new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(center2.x - half, center2.y + half, center2.z - half),\n new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(center2.x - half, center2.y + half, center2.z + half),\n new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(center2.x - half, center2.y - half, center2.z + half),\n new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(center2.x - half, center2.y - half, center2.z - half),\n new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(center2.x + half, center2.y - half, center2.z - half),\n new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(center2.x + half, center2.y - half, center2.z + half),\n new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(center2.x + half, center2.y + half, center2.z + half),\n new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(center2.x + half, center2.y + half, center2.z - half)\n ];\n const vec = [vec_s[v0], vec_s[v12], vec_s[v2], vec_s[v3], vec_s[v4], vec_s[v5], vec_s[v6], vec_s[v7]];\n if (--iterations >= 0) {\n const tmp = [];\n Array.prototype.push.apply(tmp, hilbert3D(vec[0], half, iterations, v0, v3, v4, v7, v6, v5, v2, v12));\n Array.prototype.push.apply(tmp, hilbert3D(vec[1], half, iterations, v0, v7, v6, v12, v2, v5, v4, v3));\n Array.prototype.push.apply(tmp, hilbert3D(vec[2], half, iterations, v0, v7, v6, v12, v2, v5, v4, v3));\n Array.prototype.push.apply(tmp, hilbert3D(vec[3], half, iterations, v2, v3, v0, v12, v6, v7, v4, v5));\n Array.prototype.push.apply(tmp, hilbert3D(vec[4], half, iterations, v2, v3, v0, v12, v6, v7, v4, v5));\n Array.prototype.push.apply(tmp, hilbert3D(vec[5], half, iterations, v4, v3, v2, v5, v6, v12, v0, v7));\n Array.prototype.push.apply(tmp, hilbert3D(vec[6], half, iterations, v4, v3, v2, v5, v6, v12, v0, v7));\n Array.prototype.push.apply(tmp, hilbert3D(vec[7], half, iterations, v6, v5, v2, v12, v0, v3, v4, v7));\n return tmp;\n }\n return vec;\n};\nconst gosper = (size2 = 1) => {\n function fractalize(config) {\n let output = \"\";\n let input = config.axiom;\n for (let i2 = 0, il = config.steps; 0 <= il ? i2 < il : i2 > il; 0 <= il ? i2++ : i2--) {\n output = \"\";\n for (let j = 0, jl = input.length; j < jl; j++) {\n const char = input[j];\n if (char in config.rules) {\n output += config.rules[char];\n } else {\n output += char;\n }\n }\n input = output;\n }\n return output;\n }\n function toPoints(config) {\n let currX = 0;\n let currY = 0;\n let angle = 0;\n const path = [0, 0, 0];\n const fractal = config.fractal;\n for (let i2 = 0, l = fractal.length; i2 < l; i2++) {\n const char = fractal[i2];\n if (char === \"+\") {\n angle += config.angle;\n } else if (char === \"-\") {\n angle -= config.angle;\n } else if (char === \"F\") {\n currX += config.size * Math.cos(angle);\n currY += -config.size * Math.sin(angle);\n path.push(currX, currY, 0);\n }\n }\n return path;\n }\n const gosper2 = fractalize({\n axiom: \"A\",\n steps: 4,\n rules: {\n A: \"A+BF++BF-FA--FAFA-BF+\",\n B: \"-FA+BFBF++BF+FA--FA-B\"\n }\n });\n const points = toPoints({\n fractal: gosper2,\n size: size2,\n angle: Math.PI / 3\n // 60 degrees\n });\n return points;\n};\nconst GeometryUtils = {\n hilbert3D,\n gosper,\n hilbert2D\n};\nvar _mipmapMaterial = /* @__PURE__ */ _getMipmapMaterial();\nvar _mesh = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(/* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.PlaneGeometry(2, 2), _mipmapMaterial);\nvar _flatCamera = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.OrthographicCamera(0, 1, 0, 1, 0, 1);\nvar _tempTarget = null;\nclass RoughnessMipmapper {\n constructor(renderer) {\n __publicField(this, \"generateMipmaps\", function(material2) {\n if (\"roughnessMap\" in material2 === false)\n return;\n var { roughnessMap, normalMap } = material2;\n if (roughnessMap === null || normalMap === null || !roughnessMap.generateMipmaps || material2.userData.roughnessUpdated) {\n return;\n }\n material2.userData.roughnessUpdated = true;\n var width = Math.max(roughnessMap.image.width, normalMap.image.width);\n var height = Math.max(roughnessMap.image.height, normalMap.image.height);\n if (!three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.isPowerOfTwo(width) || !three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.isPowerOfTwo(height))\n return;\n var oldTarget = this._renderer.getRenderTarget();\n var autoClear = this._renderer.autoClear;\n this._renderer.autoClear = false;\n if (_tempTarget === null || _tempTarget.width !== width || _tempTarget.height !== height) {\n if (_tempTarget !== null)\n _tempTarget.dispose();\n _tempTarget = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(width, height, {\n depthBuffer: false\n });\n _tempTarget.scissorTest = true;\n }\n if (width !== roughnessMap.image.width || height !== roughnessMap.image.height) {\n var params = {\n wrapS: roughnessMap.wrapS,\n wrapT: roughnessMap.wrapT,\n magFilter: roughnessMap.magFilter,\n minFilter: roughnessMap.minFilter,\n depthBuffer: false\n };\n var newRoughnessTarget = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(width, height, params);\n newRoughnessTarget.texture.generateMipmaps = true;\n this._renderer.setRenderTarget(newRoughnessTarget);\n material2.roughnessMap = newRoughnessTarget.texture;\n if (material2.metalnessMap == roughnessMap)\n material2.metalnessMap = material2.roughnessMap;\n if (material2.aoMap == roughnessMap)\n material2.aoMap = material2.roughnessMap;\n }\n _mipmapMaterial.uniforms.roughnessMap.value = roughnessMap;\n _mipmapMaterial.uniforms.normalMap.value = normalMap;\n var position = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(0, 0);\n var texelSize = _mipmapMaterial.uniforms.texelSize.value;\n for (let mip = 0; width >= 1 && height >= 1; ++mip, width /= 2, height /= 2) {\n texelSize.set(1 / width, 1 / height);\n if (mip == 0)\n texelSize.set(0, 0);\n _tempTarget.viewport.set(position.x, position.y, width, height);\n _tempTarget.scissor.set(position.x, position.y, width, height);\n this._renderer.setRenderTarget(_tempTarget);\n this._renderer.render(_mesh, _flatCamera);\n this._renderer.copyFramebufferToTexture(position, material2.roughnessMap, mip);\n _mipmapMaterial.uniforms.roughnessMap.value = material2.roughnessMap;\n }\n if (roughnessMap !== material2.roughnessMap)\n roughnessMap.dispose();\n this._renderer.setRenderTarget(oldTarget);\n this._renderer.autoClear = autoClear;\n });\n __publicField(this, \"dispose\", function() {\n _mipmapMaterial.dispose();\n _mesh.geometry.dispose();\n if (_tempTarget != null)\n _tempTarget.dispose();\n });\n this._renderer = renderer;\n this._renderer.compile(_mesh, _flatCamera);\n }\n}\nfunction _getMipmapMaterial() {\n var shaderMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.RawShaderMaterial({\n uniforms: {\n roughnessMap: { value: null },\n normalMap: { value: null },\n texelSize: { value: new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(1, 1) }\n },\n vertexShader: (\n /* glsl */\n `\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tattribute vec3 position;\n\t\t\tattribute vec2 uv;\n\n\t\t\tvarying vec2 vUv;\n\n\t\t\tvoid main() {\n\n\t\t\t\tvUv = uv;\n\n\t\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t\t}\n\t\t`\n ),\n fragmentShader: (\n /* glsl */\n `\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec2 vUv;\n\n\t\t\tuniform sampler2D roughnessMap;\n\t\t\tuniform sampler2D normalMap;\n\t\t\tuniform vec2 texelSize;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\n\t\t\tvec4 envMapTexelToLinear( vec4 a ) { return a; }\n\n\t\t\t#include \n\n\t\t\tfloat roughnessToVariance( float roughness ) {\n\n\t\t\t\tfloat variance = 0.0;\n\n\t\t\t\tif ( roughness >= r1 ) {\n\n\t\t\t\t\tvariance = ( r0 - roughness ) * ( v1 - v0 ) / ( r0 - r1 ) + v0;\n\n\t\t\t\t} else if ( roughness >= r4 ) {\n\n\t\t\t\t\tvariance = ( r1 - roughness ) * ( v4 - v1 ) / ( r1 - r4 ) + v1;\n\n\t\t\t\t} else if ( roughness >= r5 ) {\n\n\t\t\t\t\tvariance = ( r4 - roughness ) * ( v5 - v4 ) / ( r4 - r5 ) + v4;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tfloat roughness2 = roughness * roughness;\n\n\t\t\t\t\tvariance = 1.79 * roughness2 * roughness2;\n\n\t\t\t\t}\n\n\t\t\t\treturn variance;\n\n\t\t\t}\n\n\t\t\tfloat varianceToRoughness( float variance ) {\n\n\t\t\t\tfloat roughness = 0.0;\n\n\t\t\t\tif ( variance >= v1 ) {\n\n\t\t\t\t\troughness = ( v0 - variance ) * ( r1 - r0 ) / ( v0 - v1 ) + r0;\n\n\t\t\t\t} else if ( variance >= v4 ) {\n\n\t\t\t\t\troughness = ( v1 - variance ) * ( r4 - r1 ) / ( v1 - v4 ) + r1;\n\n\t\t\t\t} else if ( variance >= v5 ) {\n\n\t\t\t\t\troughness = ( v4 - variance ) * ( r5 - r4 ) / ( v4 - v5 ) + r4;\n\n\t\t\t\t} else {\n\n\t\t\t\t\troughness = pow( 0.559 * variance, 0.25 ); // 0.559 = 1.0 / 1.79\n\n\t\t\t\t}\n\n\t\t\t\treturn roughness;\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = texture2D( roughnessMap, vUv, - 1.0 );\n\n\t\t\t\tif ( texelSize.x == 0.0 ) return;\n\n\t\t\t\tfloat roughness = gl_FragColor.g;\n\n\t\t\t\tfloat variance = roughnessToVariance( roughness );\n\n\t\t\t\tvec3 avgNormal;\n\n\t\t\t\tfor ( float x = - 1.0; x < 2.0; x += 2.0 ) {\n\n\t\t\t\t\tfor ( float y = - 1.0; y < 2.0; y += 2.0 ) {\n\n\t\t\t\t\t\tvec2 uv = vUv + vec2( x, y ) * 0.25 * texelSize;\n\n\t\t\t\t\t\tavgNormal += normalize( texture2D( normalMap, uv, - 1.0 ).xyz - 0.5 );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tvariance += 1.0 - 0.25 * length( avgNormal );\n\n\t\t\t\tgl_FragColor.g = varianceToRoughness( variance );\n\n\t\t\t}\n\t\t`\n ),\n blending: three__WEBPACK_IMPORTED_MODULE_42__.NoBlending,\n depthTest: false,\n depthWrite: false\n });\n shaderMaterial.type = \"RoughnessMipmapper\";\n return shaderMaterial;\n}\nfunction retarget(target, source, options = {}) {\n const pos = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(), quat = new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion(), scale = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(), bindBoneMatrix = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4(), relativeMatrix = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4(), globalMatrix = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n options.preserveMatrix = options.preserveMatrix !== void 0 ? options.preserveMatrix : true;\n options.preservePosition = options.preservePosition !== void 0 ? options.preservePosition : true;\n options.preserveHipPosition = options.preserveHipPosition !== void 0 ? options.preserveHipPosition : false;\n options.useTargetMatrix = options.useTargetMatrix !== void 0 ? options.useTargetMatrix : false;\n options.hip = options.hip !== void 0 ? options.hip : \"hip\";\n options.names = options.names || {};\n const sourceBones = source.isObject3D ? source.skeleton.bones : getBones(source), bones = target.isObject3D ? target.skeleton.bones : getBones(target);\n let bindBones, bone, name, boneTo, bonesPosition;\n if (target.isObject3D) {\n target.skeleton.pose();\n } else {\n options.useTargetMatrix = true;\n options.preserveMatrix = false;\n }\n if (options.preservePosition) {\n bonesPosition = [];\n for (let i2 = 0; i2 < bones.length; i2++) {\n bonesPosition.push(bones[i2].position.clone());\n }\n }\n if (options.preserveMatrix) {\n target.updateMatrixWorld();\n target.matrixWorld.identity();\n for (let i2 = 0; i2 < target.children.length; ++i2) {\n target.children[i2].updateMatrixWorld(true);\n }\n }\n if (options.offsets) {\n bindBones = [];\n for (let i2 = 0; i2 < bones.length; ++i2) {\n bone = bones[i2];\n name = options.names[bone.name] || bone.name;\n if (options.offsets[name]) {\n bone.matrix.multiply(options.offsets[name]);\n bone.matrix.decompose(bone.position, bone.quaternion, bone.scale);\n bone.updateMatrixWorld();\n }\n bindBones.push(bone.matrixWorld.clone());\n }\n }\n for (let i2 = 0; i2 < bones.length; ++i2) {\n bone = bones[i2];\n name = options.names[bone.name] || bone.name;\n boneTo = getBoneByName(name, sourceBones);\n globalMatrix.copy(bone.matrixWorld);\n if (boneTo) {\n boneTo.updateMatrixWorld();\n if (options.useTargetMatrix) {\n relativeMatrix.copy(boneTo.matrixWorld);\n } else {\n relativeMatrix.copy(target.matrixWorld).invert();\n relativeMatrix.multiply(boneTo.matrixWorld);\n }\n scale.setFromMatrixScale(relativeMatrix);\n relativeMatrix.scale(scale.set(1 / scale.x, 1 / scale.y, 1 / scale.z));\n globalMatrix.makeRotationFromQuaternion(quat.setFromRotationMatrix(relativeMatrix));\n if (target.isObject3D) {\n const boneIndex = bones.indexOf(bone), wBindMatrix = bindBones ? bindBones[boneIndex] : bindBoneMatrix.copy(target.skeleton.boneInverses[boneIndex]).invert();\n globalMatrix.multiply(wBindMatrix);\n }\n globalMatrix.copyPosition(relativeMatrix);\n }\n if (bone.parent && bone.parent.isBone) {\n bone.matrix.copy(bone.parent.matrixWorld).invert();\n bone.matrix.multiply(globalMatrix);\n } else {\n bone.matrix.copy(globalMatrix);\n }\n if (options.preserveHipPosition && name === options.hip) {\n bone.matrix.setPosition(pos.set(0, bone.position.y, 0));\n }\n bone.matrix.decompose(bone.position, bone.quaternion, bone.scale);\n bone.updateMatrixWorld();\n }\n if (options.preservePosition) {\n for (let i2 = 0; i2 < bones.length; ++i2) {\n bone = bones[i2];\n name = options.names[bone.name] || bone.name;\n if (name !== options.hip) {\n bone.position.copy(bonesPosition[i2]);\n }\n }\n }\n if (options.preserveMatrix) {\n target.updateMatrixWorld(true);\n }\n}\nfunction retargetClip(target, source, clip, options = {}) {\n options.useFirstFramePosition = options.useFirstFramePosition !== void 0 ? options.useFirstFramePosition : false;\n options.fps = options.fps !== void 0 ? options.fps : 30;\n options.names = options.names || [];\n if (!source.isObject3D) {\n source = getHelperFromSkeleton(source);\n }\n const numFrames = Math.round(clip.duration * (options.fps / 1e3) * 1e3), delta = 1 / options.fps, convertedTracks = [], mixer = new three__WEBPACK_IMPORTED_MODULE_42__.AnimationMixer(source), bones = getBones(target.skeleton), boneDatas = [];\n let positionOffset, bone, boneTo, boneData, name;\n mixer.clipAction(clip).play();\n mixer.update(0);\n source.updateMatrixWorld();\n for (let i2 = 0; i2 < numFrames; ++i2) {\n const time = i2 * delta;\n retarget(target, source, options);\n for (let j = 0; j < bones.length; ++j) {\n name = options.names[bones[j].name] || bones[j].name;\n boneTo = getBoneByName(name, source.skeleton);\n if (boneTo) {\n bone = bones[j];\n boneData = boneDatas[j] = boneDatas[j] || { bone };\n if (options.hip === name) {\n if (!boneData.pos) {\n boneData.pos = {\n times: new Float32Array(numFrames),\n values: new Float32Array(numFrames * 3)\n };\n }\n if (options.useFirstFramePosition) {\n if (i2 === 0) {\n positionOffset = bone.position.clone();\n }\n bone.position.sub(positionOffset);\n }\n boneData.pos.times[i2] = time;\n bone.position.toArray(boneData.pos.values, i2 * 3);\n }\n if (!boneData.quat) {\n boneData.quat = {\n times: new Float32Array(numFrames),\n values: new Float32Array(numFrames * 4)\n };\n }\n boneData.quat.times[i2] = time;\n bone.quaternion.toArray(boneData.quat.values, i2 * 4);\n }\n }\n mixer.update(delta);\n source.updateMatrixWorld();\n }\n for (let i2 = 0; i2 < boneDatas.length; ++i2) {\n boneData = boneDatas[i2];\n if (boneData) {\n if (boneData.pos) {\n convertedTracks.push(\n new three__WEBPACK_IMPORTED_MODULE_42__.VectorKeyframeTrack(\n \".bones[\" + boneData.bone.name + \"].position\",\n boneData.pos.times,\n boneData.pos.values\n )\n );\n }\n convertedTracks.push(\n new three__WEBPACK_IMPORTED_MODULE_42__.QuaternionKeyframeTrack(\n \".bones[\" + boneData.bone.name + \"].quaternion\",\n boneData.quat.times,\n boneData.quat.values\n )\n );\n }\n }\n mixer.uncacheAction(clip);\n return new three__WEBPACK_IMPORTED_MODULE_42__.AnimationClip(clip.name, -1, convertedTracks);\n}\nfunction clone(source) {\n const sourceLookup = /* @__PURE__ */ new Map();\n const cloneLookup = /* @__PURE__ */ new Map();\n const clone2 = source.clone();\n parallelTraverse(source, clone2, function(sourceNode, clonedNode) {\n sourceLookup.set(clonedNode, sourceNode);\n cloneLookup.set(sourceNode, clonedNode);\n });\n clone2.traverse(function(node) {\n if (!node.isSkinnedMesh)\n return;\n const clonedMesh = node;\n const sourceMesh = sourceLookup.get(node);\n const sourceBones = sourceMesh.skeleton.bones;\n clonedMesh.skeleton = sourceMesh.skeleton.clone();\n clonedMesh.bindMatrix.copy(sourceMesh.bindMatrix);\n clonedMesh.skeleton.bones = sourceBones.map(function(bone) {\n return cloneLookup.get(bone);\n });\n clonedMesh.bind(clonedMesh.skeleton, clonedMesh.bindMatrix);\n });\n return clone2;\n}\nfunction getBoneByName(name, skeleton) {\n for (let i2 = 0, bones = getBones(skeleton); i2 < bones.length; i2++) {\n if (name === bones[i2].name)\n return bones[i2];\n }\n}\nfunction getBones(skeleton) {\n return Array.isArray(skeleton) ? skeleton : skeleton.bones;\n}\nfunction getHelperFromSkeleton(skeleton) {\n const source = new three__WEBPACK_IMPORTED_MODULE_42__.SkeletonHelper(skeleton.bones[0]);\n source.skeleton = skeleton;\n return source;\n}\nfunction parallelTraverse(a2, b2, callback) {\n callback(a2, b2);\n for (let i2 = 0; i2 < a2.children.length; i2++) {\n parallelTraverse(a2.children[i2], b2.children[i2], callback);\n }\n}\nconst SkeletonUtils = { retarget, retargetClip, clone };\nconst UnpackDepthRGBAShader = {\n uniforms: {\n tDiffuse: { value: null },\n opacity: { value: 1 }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform float opacity;\",\n \"uniform sampler2D tDiffuse;\",\n \"varying vec2 vUv;\",\n \"#include \",\n \"void main() {\",\n \"\tfloat depth = 1.0 - unpackRGBAToDepth( texture2D( tDiffuse, vUv ) );\",\n \"\tgl_FragColor = vec4( vec3( depth ), opacity );\",\n \"}\"\n ].join(\"\\n\")\n};\nclass ShadowMapViewer {\n constructor(light) {\n const scope = this;\n const doRenderLabel = light.name !== void 0 && light.name !== \"\";\n let userAutoClearSetting;\n const frame = {\n x: 10,\n y: 10,\n width: 256,\n height: 256\n };\n const camera = new three__WEBPACK_IMPORTED_MODULE_42__.OrthographicCamera(\n window.innerWidth / -2,\n window.innerWidth / 2,\n window.innerHeight / 2,\n window.innerHeight / -2,\n 1,\n 10\n );\n camera.position.set(0, 0, 2);\n const scene = new three__WEBPACK_IMPORTED_MODULE_42__.Scene();\n const shader = UnpackDepthRGBAShader;\n const uniforms = three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(shader.uniforms);\n const material2 = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms,\n vertexShader: shader.vertexShader,\n fragmentShader: shader.fragmentShader\n });\n const plane = new three__WEBPACK_IMPORTED_MODULE_42__.PlaneGeometry(frame.width, frame.height);\n const mesh = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(plane, material2);\n scene.add(mesh);\n let labelCanvas, labelMesh;\n if (doRenderLabel) {\n labelCanvas = document.createElement(\"canvas\");\n const context = labelCanvas.getContext(\"2d\");\n context.font = \"Bold 20px Arial\";\n const labelWidth = context.measureText(light.name).width;\n labelCanvas.width = labelWidth;\n labelCanvas.height = 25;\n context.font = \"Bold 20px Arial\";\n context.fillStyle = \"rgba( 255, 0, 0, 1 )\";\n context.fillText(light.name, 0, 20);\n const labelTexture = new three__WEBPACK_IMPORTED_MODULE_42__.Texture(labelCanvas);\n labelTexture.magFilter = three__WEBPACK_IMPORTED_MODULE_42__.LinearFilter;\n labelTexture.minFilter = three__WEBPACK_IMPORTED_MODULE_42__.LinearFilter;\n labelTexture.needsUpdate = true;\n const labelMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.MeshBasicMaterial({ map: labelTexture, side: three__WEBPACK_IMPORTED_MODULE_42__.DoubleSide });\n labelMaterial.transparent = true;\n const labelPlane = new three__WEBPACK_IMPORTED_MODULE_42__.PlaneGeometry(labelCanvas.width, labelCanvas.height);\n labelMesh = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(labelPlane, labelMaterial);\n scene.add(labelMesh);\n }\n function resetPosition() {\n scope.position.set(scope.position.x, scope.position.y);\n }\n this.enabled = true;\n this.size = {\n width: frame.width,\n height: frame.height,\n set: function(width, height) {\n this.width = width;\n this.height = height;\n mesh.scale.set(this.width / frame.width, this.height / frame.height, 1);\n resetPosition();\n }\n };\n this.position = {\n x: frame.x,\n y: frame.y,\n set: function(x, y) {\n this.x = x;\n this.y = y;\n const width = scope.size.width;\n const height = scope.size.height;\n mesh.position.set(-window.innerWidth / 2 + width / 2 + this.x, window.innerHeight / 2 - height / 2 - this.y, 0);\n if (doRenderLabel)\n labelMesh.position.set(mesh.position.x, mesh.position.y - scope.size.height / 2 + labelCanvas.height / 2, 0);\n }\n };\n this.render = function(renderer) {\n if (this.enabled) {\n uniforms.tDiffuse.value = light.shadow.map.texture;\n userAutoClearSetting = renderer.autoClear;\n renderer.autoClear = false;\n renderer.clearDepth();\n renderer.render(scene, camera);\n renderer.autoClear = userAutoClearSetting;\n }\n };\n this.updateForWindowResize = function() {\n if (this.enabled) {\n camera.left = window.innerWidth / -2;\n camera.right = window.innerWidth / 2;\n camera.top = window.innerHeight / 2;\n camera.bottom = window.innerHeight / -2;\n camera.updateProjectionMatrix();\n this.update();\n }\n };\n this.update = function() {\n this.position.set(this.position.x, this.position.y);\n this.size.set(this.size.width, this.size.height);\n };\n this.update();\n }\n}\nvar GeometryCompressionUtils = {\n /**\n * Make the input mesh.geometry's normal attribute encoded and compressed by 3 different methods.\n * Also will change the mesh.material to `PackedPhongMaterial` which let the vertex shader program decode the normal data.\n *\n * @param {THREE.Mesh} mesh\n * @param {String} encodeMethod\t\t\"DEFAULT\" || \"OCT1Byte\" || \"OCT2Byte\" || \"ANGLES\"\n *\n */\n compressNormals: function(mesh, encodeMethod) {\n if (!mesh.geometry) {\n console.error(\"Mesh must contain geometry. \");\n }\n const normal = mesh.geometry.attributes.normal;\n if (!normal) {\n console.error(\"Geometry must contain normal attribute. \");\n }\n if (normal.isPacked)\n return;\n if (normal.itemSize != 3) {\n console.error(\"normal.itemSize is not 3, which cannot be encoded. \");\n }\n const array = normal.array;\n const count = normal.count;\n let result;\n if (encodeMethod == \"DEFAULT\") {\n result = new Uint8Array(count * 3);\n for (let idx = 0; idx < array.length; idx += 3) {\n const encoded = this.EncodingFuncs.defaultEncode(array[idx], array[idx + 1], array[idx + 2], 1);\n result[idx + 0] = encoded[0];\n result[idx + 1] = encoded[1];\n result[idx + 2] = encoded[2];\n }\n mesh.geometry.setAttribute(\"normal\", new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(result, 3, true));\n mesh.geometry.attributes.normal.bytes = result.length * 1;\n } else if (encodeMethod == \"OCT1Byte\") {\n result = new Int8Array(count * 2);\n for (let idx = 0; idx < array.length; idx += 3) {\n const encoded = this.EncodingFuncs.octEncodeBest(array[idx], array[idx + 1], array[idx + 2], 1);\n result[idx / 3 * 2 + 0] = encoded[0];\n result[idx / 3 * 2 + 1] = encoded[1];\n }\n mesh.geometry.setAttribute(\"normal\", new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(result, 2, true));\n mesh.geometry.attributes.normal.bytes = result.length * 1;\n } else if (encodeMethod == \"OCT2Byte\") {\n result = new Int16Array(count * 2);\n for (let idx = 0; idx < array.length; idx += 3) {\n const encoded = this.EncodingFuncs.octEncodeBest(array[idx], array[idx + 1], array[idx + 2], 2);\n result[idx / 3 * 2 + 0] = encoded[0];\n result[idx / 3 * 2 + 1] = encoded[1];\n }\n mesh.geometry.setAttribute(\"normal\", new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(result, 2, true));\n mesh.geometry.attributes.normal.bytes = result.length * 2;\n } else if (encodeMethod == \"ANGLES\") {\n result = new Uint16Array(count * 2);\n for (let idx = 0; idx < array.length; idx += 3) {\n const encoded = this.EncodingFuncs.anglesEncode(array[idx], array[idx + 1], array[idx + 2]);\n result[idx / 3 * 2 + 0] = encoded[0];\n result[idx / 3 * 2 + 1] = encoded[1];\n }\n mesh.geometry.setAttribute(\"normal\", new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(result, 2, true));\n mesh.geometry.attributes.normal.bytes = result.length * 2;\n } else {\n console.error(\"Unrecognized encoding method, should be `DEFAULT` or `ANGLES` or `OCT`. \");\n }\n mesh.geometry.attributes.normal.needsUpdate = true;\n mesh.geometry.attributes.normal.isPacked = true;\n mesh.geometry.attributes.normal.packingMethod = encodeMethod;\n if (!(mesh.material instanceof PackedPhongMaterial)) {\n mesh.material = new PackedPhongMaterial().copy(mesh.material);\n }\n if (encodeMethod == \"ANGLES\") {\n mesh.material.defines.USE_PACKED_NORMAL = 0;\n }\n if (encodeMethod == \"OCT1Byte\") {\n mesh.material.defines.USE_PACKED_NORMAL = 1;\n }\n if (encodeMethod == \"OCT2Byte\") {\n mesh.material.defines.USE_PACKED_NORMAL = 1;\n }\n if (encodeMethod == \"DEFAULT\") {\n mesh.material.defines.USE_PACKED_NORMAL = 2;\n }\n },\n /**\n * Make the input mesh.geometry's position attribute encoded and compressed.\n * Also will change the mesh.material to `PackedPhongMaterial` which let the vertex shader program decode the position data.\n *\n * @param {THREE.Mesh} mesh\n *\n */\n compressPositions: function(mesh) {\n if (!mesh.geometry) {\n console.error(\"Mesh must contain geometry. \");\n }\n const position = mesh.geometry.attributes.position;\n if (!position) {\n console.error(\"Geometry must contain position attribute. \");\n }\n if (position.isPacked)\n return;\n if (position.itemSize != 3) {\n console.error(\"position.itemSize is not 3, which cannot be packed. \");\n }\n const array = position.array;\n const encodingBytes = 2;\n const result = this.EncodingFuncs.quantizedEncode(array, encodingBytes);\n const quantized = result.quantized;\n const decodeMat = result.decodeMat;\n if (mesh.geometry.boundingBox == null)\n mesh.geometry.computeBoundingBox();\n if (mesh.geometry.boundingSphere == null)\n mesh.geometry.computeBoundingSphere();\n mesh.geometry.setAttribute(\"position\", new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(quantized, 3));\n mesh.geometry.attributes.position.isPacked = true;\n mesh.geometry.attributes.position.needsUpdate = true;\n mesh.geometry.attributes.position.bytes = quantized.length * encodingBytes;\n if (!(mesh.material instanceof PackedPhongMaterial)) {\n mesh.material = new PackedPhongMaterial().copy(mesh.material);\n }\n mesh.material.defines.USE_PACKED_POSITION = 0;\n mesh.material.uniforms.quantizeMatPos.value = decodeMat;\n mesh.material.uniforms.quantizeMatPos.needsUpdate = true;\n },\n /**\n * Make the input mesh.geometry's uv attribute encoded and compressed.\n * Also will change the mesh.material to `PackedPhongMaterial` which let the vertex shader program decode the uv data.\n *\n * @param {THREE.Mesh} mesh\n *\n */\n compressUvs: function(mesh) {\n if (!mesh.geometry) {\n console.error(\"Mesh must contain geometry property. \");\n }\n const uvs = mesh.geometry.attributes.uv;\n if (!uvs) {\n console.error(\"Geometry must contain uv attribute. \");\n }\n if (uvs.isPacked)\n return;\n const range = { min: Infinity, max: -Infinity };\n const array = uvs.array;\n for (let i2 = 0; i2 < array.length; i2++) {\n range.min = Math.min(range.min, array[i2]);\n range.max = Math.max(range.max, array[i2]);\n }\n let result;\n if (range.min >= -1 && range.max <= 1) {\n result = new Uint16Array(array.length);\n for (let i2 = 0; i2 < array.length; i2 += 2) {\n const encoded = this.EncodingFuncs.defaultEncode(array[i2], array[i2 + 1], 0, 2);\n result[i2] = encoded[0];\n result[i2 + 1] = encoded[1];\n }\n mesh.geometry.setAttribute(\"uv\", new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(result, 2, true));\n mesh.geometry.attributes.uv.isPacked = true;\n mesh.geometry.attributes.uv.needsUpdate = true;\n mesh.geometry.attributes.uv.bytes = result.length * 2;\n if (!(mesh.material instanceof PackedPhongMaterial)) {\n mesh.material = new PackedPhongMaterial().copy(mesh.material);\n }\n mesh.material.defines.USE_PACKED_UV = 0;\n } else {\n result = this.EncodingFuncs.quantizedEncodeUV(array, 2);\n mesh.geometry.setAttribute(\"uv\", new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(result.quantized, 2));\n mesh.geometry.attributes.uv.isPacked = true;\n mesh.geometry.attributes.uv.needsUpdate = true;\n mesh.geometry.attributes.uv.bytes = result.quantized.length * 2;\n if (!(mesh.material instanceof PackedPhongMaterial)) {\n mesh.material = new PackedPhongMaterial().copy(mesh.material);\n }\n mesh.material.defines.USE_PACKED_UV = 1;\n mesh.material.uniforms.quantizeMatUV.value = result.decodeMat;\n mesh.material.uniforms.quantizeMatUV.needsUpdate = true;\n }\n },\n EncodingFuncs: {\n defaultEncode: function(x, y, z, bytes) {\n if (bytes == 1) {\n const tmpx = Math.round((x + 1) * 0.5 * 255);\n const tmpy = Math.round((y + 1) * 0.5 * 255);\n const tmpz = Math.round((z + 1) * 0.5 * 255);\n return new Uint8Array([tmpx, tmpy, tmpz]);\n } else if (bytes == 2) {\n const tmpx = Math.round((x + 1) * 0.5 * 65535);\n const tmpy = Math.round((y + 1) * 0.5 * 65535);\n const tmpz = Math.round((z + 1) * 0.5 * 65535);\n return new Uint16Array([tmpx, tmpy, tmpz]);\n } else {\n console.error(\"number of bytes must be 1 or 2\");\n }\n },\n defaultDecode: function(array, bytes) {\n if (bytes == 1) {\n return [array[0] / 255 * 2 - 1, array[1] / 255 * 2 - 1, array[2] / 255 * 2 - 1];\n } else if (bytes == 2) {\n return [array[0] / 65535 * 2 - 1, array[1] / 65535 * 2 - 1, array[2] / 65535 * 2 - 1];\n } else {\n console.error(\"number of bytes must be 1 or 2\");\n }\n },\n // for `Angles` encoding\n anglesEncode: function(x, y, z) {\n const normal0 = parseInt(0.5 * (1 + Math.atan2(y, x) / Math.PI) * 65535);\n const normal1 = parseInt(0.5 * (1 + z) * 65535);\n return new Uint16Array([normal0, normal1]);\n },\n // for `Octahedron` encoding\n octEncodeBest: function(x, y, z, bytes) {\n var oct, dec, best, currentCos, bestCos;\n best = oct = octEncodeVec3(x, y, z, \"floor\", \"floor\");\n dec = octDecodeVec2(oct);\n bestCos = dot(x, y, z, dec);\n oct = octEncodeVec3(x, y, z, \"ceil\", \"floor\");\n dec = octDecodeVec2(oct);\n currentCos = dot(x, y, z, dec);\n if (currentCos > bestCos) {\n best = oct;\n bestCos = currentCos;\n }\n oct = octEncodeVec3(x, y, z, \"floor\", \"ceil\");\n dec = octDecodeVec2(oct);\n currentCos = dot(x, y, z, dec);\n if (currentCos > bestCos) {\n best = oct;\n bestCos = currentCos;\n }\n oct = octEncodeVec3(x, y, z, \"ceil\", \"ceil\");\n dec = octDecodeVec2(oct);\n currentCos = dot(x, y, z, dec);\n if (currentCos > bestCos) {\n best = oct;\n }\n return best;\n function octEncodeVec3(x0, y0, z0, xfunc, yfunc) {\n var x2 = x0 / (Math.abs(x0) + Math.abs(y0) + Math.abs(z0));\n var y2 = y0 / (Math.abs(x0) + Math.abs(y0) + Math.abs(z0));\n if (z < 0) {\n var tempx = (1 - Math.abs(y2)) * (x2 >= 0 ? 1 : -1);\n var tempy = (1 - Math.abs(x2)) * (y2 >= 0 ? 1 : -1);\n x2 = tempx;\n y2 = tempy;\n var diff = 1 - Math.abs(x2) - Math.abs(y2);\n if (diff > 0) {\n diff += 1e-3;\n x2 += x2 > 0 ? diff / 2 : -diff / 2;\n y2 += y2 > 0 ? diff / 2 : -diff / 2;\n }\n }\n if (bytes == 1) {\n return new Int8Array([Math[xfunc](x2 * 127.5 + (x2 < 0 ? 1 : 0)), Math[yfunc](y2 * 127.5 + (y2 < 0 ? 1 : 0))]);\n }\n if (bytes == 2) {\n return new Int16Array([\n Math[xfunc](x2 * 32767.5 + (x2 < 0 ? 1 : 0)),\n Math[yfunc](y2 * 32767.5 + (y2 < 0 ? 1 : 0))\n ]);\n }\n }\n function octDecodeVec2(oct2) {\n var x2 = oct2[0];\n var y2 = oct2[1];\n if (bytes == 1) {\n x2 /= x2 < 0 ? 127 : 128;\n y2 /= y2 < 0 ? 127 : 128;\n } else if (bytes == 2) {\n x2 /= x2 < 0 ? 32767 : 32768;\n y2 /= y2 < 0 ? 32767 : 32768;\n }\n var z2 = 1 - Math.abs(x2) - Math.abs(y2);\n if (z2 < 0) {\n var tmpx = x2;\n x2 = (1 - Math.abs(y2)) * (x2 >= 0 ? 1 : -1);\n y2 = (1 - Math.abs(tmpx)) * (y2 >= 0 ? 1 : -1);\n }\n var length = Math.sqrt(x2 * x2 + y2 * y2 + z2 * z2);\n return [x2 / length, y2 / length, z2 / length];\n }\n function dot(x2, y2, z2, vec3) {\n return x2 * vec3[0] + y2 * vec3[1] + z2 * vec3[2];\n }\n },\n quantizedEncode: function(array, bytes) {\n let quantized, segments;\n if (bytes == 1) {\n quantized = new Uint8Array(array.length);\n segments = 255;\n } else if (bytes == 2) {\n quantized = new Uint16Array(array.length);\n segments = 65535;\n } else {\n console.error(\"number of bytes error! \");\n }\n const decodeMat = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n const min = new Float32Array(3);\n const max = new Float32Array(3);\n min[0] = min[1] = min[2] = Number.MAX_VALUE;\n max[0] = max[1] = max[2] = -Number.MAX_VALUE;\n for (let i2 = 0; i2 < array.length; i2 += 3) {\n min[0] = Math.min(min[0], array[i2 + 0]);\n min[1] = Math.min(min[1], array[i2 + 1]);\n min[2] = Math.min(min[2], array[i2 + 2]);\n max[0] = Math.max(max[0], array[i2 + 0]);\n max[1] = Math.max(max[1], array[i2 + 1]);\n max[2] = Math.max(max[2], array[i2 + 2]);\n }\n decodeMat.scale(\n new three__WEBPACK_IMPORTED_MODULE_42__.Vector3((max[0] - min[0]) / segments, (max[1] - min[1]) / segments, (max[2] - min[2]) / segments)\n );\n decodeMat.elements[12] = min[0];\n decodeMat.elements[13] = min[1];\n decodeMat.elements[14] = min[2];\n decodeMat.transpose();\n const multiplier = new Float32Array([\n max[0] !== min[0] ? segments / (max[0] - min[0]) : 0,\n max[1] !== min[1] ? segments / (max[1] - min[1]) : 0,\n max[2] !== min[2] ? segments / (max[2] - min[2]) : 0\n ]);\n for (let i2 = 0; i2 < array.length; i2 += 3) {\n quantized[i2 + 0] = Math.floor((array[i2 + 0] - min[0]) * multiplier[0]);\n quantized[i2 + 1] = Math.floor((array[i2 + 1] - min[1]) * multiplier[1]);\n quantized[i2 + 2] = Math.floor((array[i2 + 2] - min[2]) * multiplier[2]);\n }\n return {\n quantized,\n decodeMat\n };\n },\n quantizedEncodeUV: function(array, bytes) {\n let quantized, segments;\n if (bytes == 1) {\n quantized = new Uint8Array(array.length);\n segments = 255;\n } else if (bytes == 2) {\n quantized = new Uint16Array(array.length);\n segments = 65535;\n } else {\n console.error(\"number of bytes error! \");\n }\n const decodeMat = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix3();\n const min = new Float32Array(2);\n const max = new Float32Array(2);\n min[0] = min[1] = Number.MAX_VALUE;\n max[0] = max[1] = -Number.MAX_VALUE;\n for (let i2 = 0; i2 < array.length; i2 += 2) {\n min[0] = Math.min(min[0], array[i2 + 0]);\n min[1] = Math.min(min[1], array[i2 + 1]);\n max[0] = Math.max(max[0], array[i2 + 0]);\n max[1] = Math.max(max[1], array[i2 + 1]);\n }\n decodeMat.scale((max[0] - min[0]) / segments, (max[1] - min[1]) / segments);\n decodeMat.elements[6] = min[0];\n decodeMat.elements[7] = min[1];\n decodeMat.transpose();\n const multiplier = new Float32Array([\n max[0] !== min[0] ? segments / (max[0] - min[0]) : 0,\n max[1] !== min[1] ? segments / (max[1] - min[1]) : 0\n ]);\n for (let i2 = 0; i2 < array.length; i2 += 2) {\n quantized[i2 + 0] = Math.floor((array[i2 + 0] - min[0]) * multiplier[0]);\n quantized[i2 + 1] = Math.floor((array[i2 + 1] - min[1]) * multiplier[1]);\n }\n return {\n quantized,\n decodeMat\n };\n }\n }\n};\nclass PackedPhongMaterial extends three__WEBPACK_IMPORTED_MODULE_42__.MeshPhongMaterial {\n constructor(parameters) {\n super();\n this.defines = {};\n this.type = \"PackedPhongMaterial\";\n this.uniforms = three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.merge([\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderLib.phong.uniforms,\n {\n quantizeMatPos: { value: null },\n quantizeMatUV: { value: null }\n }\n ]);\n this.vertexShader = [\n \"#define PHONG\",\n \"varying vec3 vViewPosition;\",\n \"#ifndef FLAT_SHADED\",\n \"varying vec3 vNormal;\",\n \"#endif\",\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.common,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.uv_pars_vertex,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.uv2_pars_vertex,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.displacementmap_pars_vertex,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.envmap_pars_vertex,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.color_pars_vertex,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.fog_pars_vertex,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.morphtarget_pars_vertex,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.skinning_pars_vertex,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.shadowmap_pars_vertex,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.logdepthbuf_pars_vertex,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.clipping_planes_pars_vertex,\n `#ifdef USE_PACKED_NORMAL\n\t\t\t\t\t#if USE_PACKED_NORMAL == 0\n\t\t\t\t\t\tvec3 decodeNormal(vec3 packedNormal)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfloat x = packedNormal.x * 2.0 - 1.0;\n\t\t\t\t\t\t\tfloat y = packedNormal.y * 2.0 - 1.0;\n\t\t\t\t\t\t\tvec2 scth = vec2(sin(x * PI), cos(x * PI));\n\t\t\t\t\t\t\tvec2 scphi = vec2(sqrt(1.0 - y * y), y);\n\t\t\t\t\t\t\treturn normalize( vec3(scth.y * scphi.x, scth.x * scphi.x, scphi.y) );\n\t\t\t\t\t\t}\n\t\t\t\t\t#endif\n\n\t\t\t\t\t#if USE_PACKED_NORMAL == 1\n\t\t\t\t\t\tvec3 decodeNormal(vec3 packedNormal)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvec3 v = vec3(packedNormal.xy, 1.0 - abs(packedNormal.x) - abs(packedNormal.y));\n\t\t\t\t\t\t\tif (v.z < 0.0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tv.xy = (1.0 - abs(v.yx)) * vec2((v.x >= 0.0) ? +1.0 : -1.0, (v.y >= 0.0) ? +1.0 : -1.0);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn normalize(v);\n\t\t\t\t\t\t}\n\t\t\t\t\t#endif\n\n\t\t\t\t\t#if USE_PACKED_NORMAL == 2\n\t\t\t\t\t\tvec3 decodeNormal(vec3 packedNormal)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvec3 v = (packedNormal * 2.0) - 1.0;\n\t\t\t\t\t\t\treturn normalize(v);\n\t\t\t\t\t\t}\n\t\t\t\t\t#endif\n\t\t\t\t#endif`,\n `#ifdef USE_PACKED_POSITION\n\t\t\t\t\t#if USE_PACKED_POSITION == 0\n\t\t\t\t\t\tuniform mat4 quantizeMatPos;\n\t\t\t\t\t#endif\n\t\t\t\t#endif`,\n `#ifdef USE_PACKED_UV\n\t\t\t\t\t#if USE_PACKED_UV == 1\n\t\t\t\t\t\tuniform mat3 quantizeMatUV;\n\t\t\t\t\t#endif\n\t\t\t\t#endif`,\n `#ifdef USE_PACKED_UV\n\t\t\t\t\t#if USE_PACKED_UV == 0\n\t\t\t\t\t\tvec2 decodeUV(vec2 packedUV)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvec2 uv = (packedUV * 2.0) - 1.0;\n\t\t\t\t\t\t\treturn uv;\n\t\t\t\t\t\t}\n\t\t\t\t\t#endif\n\n\t\t\t\t\t#if USE_PACKED_UV == 1\n\t\t\t\t\t\tvec2 decodeUV(vec2 packedUV)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvec2 uv = ( vec3(packedUV, 1.0) * quantizeMatUV ).xy;\n\t\t\t\t\t\t\treturn uv;\n\t\t\t\t\t\t}\n\t\t\t\t\t#endif\n\t\t\t\t#endif`,\n \"void main() {\",\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.uv_vertex,\n `#ifdef USE_UV\n\t\t\t\t\t#ifdef USE_PACKED_UV\n\t\t\t\t\t\tvUv = decodeUV(vUv);\n\t\t\t\t\t#endif\n\t\t\t\t#endif`,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.uv2_vertex,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.color_vertex,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.beginnormal_vertex,\n `#ifdef USE_PACKED_NORMAL\n\t\t\t\t\tobjectNormal = decodeNormal(objectNormal);\n\t\t\t\t#endif\n\n\t\t\t\t#ifdef USE_TANGENT\n\t\t\t\t\tvec3 objectTangent = vec3( tangent.xyz );\n\t\t\t\t#endif\n\t\t\t\t`,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.morphnormal_vertex,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.skinbase_vertex,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.skinnormal_vertex,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.defaultnormal_vertex,\n \"#ifndef FLAT_SHADED\",\n \"\tvNormal = normalize( transformedNormal );\",\n \"#endif\",\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.begin_vertex,\n `#ifdef USE_PACKED_POSITION\n\t\t\t\t\t#if USE_PACKED_POSITION == 0\n\t\t\t\t\t\ttransformed = ( vec4(transformed, 1.0) * quantizeMatPos ).xyz;\n\t\t\t\t\t#endif\n\t\t\t\t#endif`,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.morphtarget_vertex,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.skinning_vertex,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.displacementmap_vertex,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.project_vertex,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.logdepthbuf_vertex,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.clipping_planes_vertex,\n \"vViewPosition = - mvPosition.xyz;\",\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.worldpos_vertex,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.envmap_vertex,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.shadowmap_vertex,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.fog_vertex,\n \"}\"\n ].join(\"\\n\");\n this.fragmentShader = [\n \"#define PHONG\",\n \"uniform vec3 diffuse;\",\n \"uniform vec3 emissive;\",\n \"uniform vec3 specular;\",\n \"uniform float shininess;\",\n \"uniform float opacity;\",\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.common,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.packing,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.dithering_pars_fragment,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.color_pars_fragment,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.uv_pars_fragment,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.uv2_pars_fragment,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.map_pars_fragment,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.alphamap_pars_fragment,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.aomap_pars_fragment,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.lightmap_pars_fragment,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.emissivemap_pars_fragment,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.envmap_common_pars_fragment,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.envmap_pars_fragment,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.cube_uv_reflection_fragment,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.fog_pars_fragment,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.bsdfs,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.lights_pars_begin,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.lights_phong_pars_fragment,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.shadowmap_pars_fragment,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.bumpmap_pars_fragment,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.normalmap_pars_fragment,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.specularmap_pars_fragment,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.logdepthbuf_pars_fragment,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.clipping_planes_pars_fragment,\n \"void main() {\",\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.clipping_planes_fragment,\n \"vec4 diffuseColor = vec4( diffuse, opacity );\",\n \"ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\",\n \"vec3 totalEmissiveRadiance = emissive;\",\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.logdepthbuf_fragment,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.map_fragment,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.color_fragment,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.alphamap_fragment,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.alphatest_fragment,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.specularmap_fragment,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.normal_fragment_begin,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.normal_fragment_maps,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.emissivemap_fragment,\n // accumulation\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.lights_phong_fragment,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.lights_fragment_begin,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.lights_fragment_maps,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.lights_fragment_end,\n // modulation\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.aomap_fragment,\n \"vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\",\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.envmap_fragment,\n \"gl_FragColor = vec4( outgoingLight, diffuseColor.a );\",\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.tonemapping_fragment,\n parseInt(three__WEBPACK_IMPORTED_MODULE_42__.REVISION.replace(/\\D+/g, \"\")) >= 154 ? three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.colorspace_fragment : three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.encodings_fragment,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.fog_fragment,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.premultiplied_alpha_fragment,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.dithering_fragment,\n \"}\"\n ].join(\"\\n\");\n this.setValues(parameters);\n }\n}\nconst BokehShader2 = {\n uniforms: {\n textureWidth: { value: 1 },\n textureHeight: { value: 1 },\n focalDepth: { value: 1 },\n focalLength: { value: 24 },\n fstop: { value: 0.9 },\n tColor: { value: null },\n tDepth: { value: null },\n maxblur: { value: 1 },\n showFocus: { value: 0 },\n manualdof: { value: 0 },\n vignetting: { value: 0 },\n depthblur: { value: 0 },\n threshold: { value: 0.5 },\n gain: { value: 2 },\n bias: { value: 0.5 },\n fringe: { value: 0.7 },\n znear: { value: 0.1 },\n zfar: { value: 100 },\n noise: { value: 1 },\n dithering: { value: 1e-4 },\n pentagon: { value: 0 },\n shaderFocus: { value: 1 },\n focusCoords: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector2() }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"#include \",\n \"varying vec2 vUv;\",\n \"uniform sampler2D tColor;\",\n \"uniform sampler2D tDepth;\",\n \"uniform float textureWidth;\",\n \"uniform float textureHeight;\",\n \"uniform float focalDepth; //focal distance value in meters, but you may use autofocus option below\",\n \"uniform float focalLength; //focal length in mm\",\n \"uniform float fstop; //f-stop value\",\n \"uniform bool showFocus; //show debug focus point and focal range (red = focal point, green = focal range)\",\n \"/*\",\n \"make sure that these two values are the same for your camera, otherwise distances will be wrong.\",\n \"*/\",\n \"uniform float znear; // camera clipping start\",\n \"uniform float zfar; // camera clipping end\",\n \"//------------------------------------------\",\n \"//user variables\",\n \"const int samples = SAMPLES; //samples on the first ring\",\n \"const int rings = RINGS; //ring count\",\n \"const int maxringsamples = rings * samples;\",\n \"uniform bool manualdof; // manual dof calculation\",\n \"float ndofstart = 1.0; // near dof blur start\",\n \"float ndofdist = 2.0; // near dof blur falloff distance\",\n \"float fdofstart = 1.0; // far dof blur start\",\n \"float fdofdist = 3.0; // far dof blur falloff distance\",\n \"float CoC = 0.03; //circle of confusion size in mm (35mm film = 0.03mm)\",\n \"uniform bool vignetting; // use optical lens vignetting\",\n \"float vignout = 1.3; // vignetting outer border\",\n \"float vignin = 0.0; // vignetting inner border\",\n \"float vignfade = 22.0; // f-stops till vignete fades\",\n \"uniform bool shaderFocus;\",\n \"// disable if you use external focalDepth value\",\n \"uniform vec2 focusCoords;\",\n \"// autofocus point on screen (0.0,0.0 - left lower corner, 1.0,1.0 - upper right)\",\n \"// if center of screen use vec2(0.5, 0.5);\",\n \"uniform float maxblur;\",\n \"//clamp value of max blur (0.0 = no blur, 1.0 default)\",\n \"uniform float threshold; // highlight threshold;\",\n \"uniform float gain; // highlight gain;\",\n \"uniform float bias; // bokeh edge bias\",\n \"uniform float fringe; // bokeh chromatic aberration / fringing\",\n \"uniform bool noise; //use noise instead of pattern for sample dithering\",\n \"uniform float dithering;\",\n \"uniform bool depthblur; // blur the depth buffer\",\n \"float dbsize = 1.25; // depth blur size\",\n \"/*\",\n \"next part is experimental\",\n \"not looking good with small sample and ring count\",\n \"looks okay starting from samples = 4, rings = 4\",\n \"*/\",\n \"uniform bool pentagon; //use pentagon as bokeh shape?\",\n \"float feather = 0.4; //pentagon shape feather\",\n \"//------------------------------------------\",\n \"float penta(vec2 coords) {\",\n \"\t//pentagonal shape\",\n \"\tfloat scale = float(rings) - 1.3;\",\n \"\tvec4 HS0 = vec4( 1.0, 0.0, 0.0, 1.0);\",\n \"\tvec4 HS1 = vec4( 0.309016994, 0.951056516, 0.0, 1.0);\",\n \"\tvec4 HS2 = vec4(-0.809016994, 0.587785252, 0.0, 1.0);\",\n \"\tvec4 HS3 = vec4(-0.809016994,-0.587785252, 0.0, 1.0);\",\n \"\tvec4 HS4 = vec4( 0.309016994,-0.951056516, 0.0, 1.0);\",\n \"\tvec4 HS5 = vec4( 0.0 ,0.0 , 1.0, 1.0);\",\n \"\tvec4 one = vec4( 1.0 );\",\n \"\tvec4 P = vec4((coords),vec2(scale, scale));\",\n \"\tvec4 dist = vec4(0.0);\",\n \"\tfloat inorout = -4.0;\",\n \"\tdist.x = dot( P, HS0 );\",\n \"\tdist.y = dot( P, HS1 );\",\n \"\tdist.z = dot( P, HS2 );\",\n \"\tdist.w = dot( P, HS3 );\",\n \"\tdist = smoothstep( -feather, feather, dist );\",\n \"\tinorout += dot( dist, one );\",\n \"\tdist.x = dot( P, HS4 );\",\n \"\tdist.y = HS5.w - abs( P.z );\",\n \"\tdist = smoothstep( -feather, feather, dist );\",\n \"\tinorout += dist.x;\",\n \"\treturn clamp( inorout, 0.0, 1.0 );\",\n \"}\",\n \"float bdepth(vec2 coords) {\",\n \"\t// Depth buffer blur\",\n \"\tfloat d = 0.0;\",\n \"\tfloat kernel[9];\",\n \"\tvec2 offset[9];\",\n \"\tvec2 wh = vec2(1.0/textureWidth,1.0/textureHeight) * dbsize;\",\n \"\toffset[0] = vec2(-wh.x,-wh.y);\",\n \"\toffset[1] = vec2( 0.0, -wh.y);\",\n \"\toffset[2] = vec2( wh.x -wh.y);\",\n \"\toffset[3] = vec2(-wh.x, 0.0);\",\n \"\toffset[4] = vec2( 0.0, 0.0);\",\n \"\toffset[5] = vec2( wh.x, 0.0);\",\n \"\toffset[6] = vec2(-wh.x, wh.y);\",\n \"\toffset[7] = vec2( 0.0, wh.y);\",\n \"\toffset[8] = vec2( wh.x, wh.y);\",\n \"\tkernel[0] = 1.0/16.0; kernel[1] = 2.0/16.0; kernel[2] = 1.0/16.0;\",\n \"\tkernel[3] = 2.0/16.0; kernel[4] = 4.0/16.0; kernel[5] = 2.0/16.0;\",\n \"\tkernel[6] = 1.0/16.0; kernel[7] = 2.0/16.0; kernel[8] = 1.0/16.0;\",\n \"\tfor( int i=0; i<9; i++ ) {\",\n \"\t\tfloat tmp = texture2D(tDepth, coords + offset[i]).r;\",\n \"\t\td += tmp * kernel[i];\",\n \"\t}\",\n \"\treturn d;\",\n \"}\",\n \"vec3 color(vec2 coords,float blur) {\",\n \"\t//processing the sample\",\n \"\tvec3 col = vec3(0.0);\",\n \"\tvec2 texel = vec2(1.0/textureWidth,1.0/textureHeight);\",\n \"\tcol.r = texture2D(tColor,coords + vec2(0.0,1.0)*texel*fringe*blur).r;\",\n \"\tcol.g = texture2D(tColor,coords + vec2(-0.866,-0.5)*texel*fringe*blur).g;\",\n \"\tcol.b = texture2D(tColor,coords + vec2(0.866,-0.5)*texel*fringe*blur).b;\",\n \"\tvec3 lumcoeff = vec3(0.299,0.587,0.114);\",\n \"\tfloat lum = dot(col.rgb, lumcoeff);\",\n \"\tfloat thresh = max((lum-threshold)*gain, 0.0);\",\n \"\treturn col+mix(vec3(0.0),col,thresh*blur);\",\n \"}\",\n \"vec3 debugFocus(vec3 col, float blur, float depth) {\",\n \"\tfloat edge = 0.002*depth; //distance based edge smoothing\",\n \"\tfloat m = clamp(smoothstep(0.0,edge,blur),0.0,1.0);\",\n \"\tfloat e = clamp(smoothstep(1.0-edge,1.0,blur),0.0,1.0);\",\n \"\tcol = mix(col,vec3(1.0,0.5,0.0),(1.0-m)*0.6);\",\n \"\tcol = mix(col,vec3(0.0,0.5,1.0),((1.0-e)-(1.0-m))*0.2);\",\n \"\treturn col;\",\n \"}\",\n \"float linearize(float depth) {\",\n \"\treturn -zfar * znear / (depth * (zfar - znear) - zfar);\",\n \"}\",\n \"float vignette() {\",\n \"\tfloat dist = distance(vUv.xy, vec2(0.5,0.5));\",\n \"\tdist = smoothstep(vignout+(fstop/vignfade), vignin+(fstop/vignfade), dist);\",\n \"\treturn clamp(dist,0.0,1.0);\",\n \"}\",\n \"float gather(float i, float j, int ringsamples, inout vec3 col, float w, float h, float blur) {\",\n \"\tfloat rings2 = float(rings);\",\n \"\tfloat step = PI*2.0 / float(ringsamples);\",\n \"\tfloat pw = cos(j*step)*i;\",\n \"\tfloat ph = sin(j*step)*i;\",\n \"\tfloat p = 1.0;\",\n \"\tif (pentagon) {\",\n \"\t\tp = penta(vec2(pw,ph));\",\n \"\t}\",\n \"\tcol += color(vUv.xy + vec2(pw*w,ph*h), blur) * mix(1.0, i/rings2, bias) * p;\",\n \"\treturn 1.0 * mix(1.0, i /rings2, bias) * p;\",\n \"}\",\n \"void main() {\",\n \"\t//scene depth calculation\",\n \"\tfloat depth = linearize(texture2D(tDepth,vUv.xy).x);\",\n \"\t// Blur depth?\",\n \"\tif ( depthblur ) {\",\n \"\t\tdepth = linearize(bdepth(vUv.xy));\",\n \"\t}\",\n \"\t//focal plane calculation\",\n \"\tfloat fDepth = focalDepth;\",\n \"\tif (shaderFocus) {\",\n \"\t\tfDepth = linearize(texture2D(tDepth,focusCoords).x);\",\n \"\t}\",\n \"\t// dof blur factor calculation\",\n \"\tfloat blur = 0.0;\",\n \"\tif (manualdof) {\",\n \"\t\tfloat a = depth-fDepth; // Focal plane\",\n \"\t\tfloat b = (a-fdofstart)/fdofdist; // Far DoF\",\n \"\t\tfloat c = (-a-ndofstart)/ndofdist; // Near Dof\",\n \"\t\tblur = (a>0.0) ? b : c;\",\n \"\t} else {\",\n \"\t\tfloat f = focalLength; // focal length in mm\",\n \"\t\tfloat d = fDepth*1000.0; // focal plane in mm\",\n \"\t\tfloat o = depth*1000.0; // depth in mm\",\n \"\t\tfloat a = (o*f)/(o-f);\",\n \"\t\tfloat b = (d*f)/(d-f);\",\n \"\t\tfloat c = (d-f)/(d*fstop*CoC);\",\n \"\t\tblur = abs(a-b)*c;\",\n \"\t}\",\n \"\tblur = clamp(blur,0.0,1.0);\",\n \"\t// calculation of pattern for dithering\",\n \"\tvec2 noise = vec2(rand(vUv.xy), rand( vUv.xy + vec2( 0.4, 0.6 ) ) )*dithering*blur;\",\n \"\t// getting blur x and y step factor\",\n \"\tfloat w = (1.0/textureWidth)*blur*maxblur+noise.x;\",\n \"\tfloat h = (1.0/textureHeight)*blur*maxblur+noise.y;\",\n \"\t// calculation of final color\",\n \"\tvec3 col = vec3(0.0);\",\n \"\tif(blur < 0.05) {\",\n \"\t\t//some optimization thingy\",\n \"\t\tcol = texture2D(tColor, vUv.xy).rgb;\",\n \"\t} else {\",\n \"\t\tcol = texture2D(tColor, vUv.xy).rgb;\",\n \"\t\tfloat s = 1.0;\",\n \"\t\tint ringsamples;\",\n \"\t\tfor (int i = 1; i <= rings; i++) {\",\n \"\t\t\t/*unboxstart*/\",\n \"\t\t\tringsamples = i * samples;\",\n \"\t\t\tfor (int j = 0 ; j < maxringsamples ; j++) {\",\n \"\t\t\t\tif (j >= ringsamples) break;\",\n \"\t\t\t\ts += gather(float(i), float(j), ringsamples, col, w, h, blur);\",\n \"\t\t\t}\",\n \"\t\t\t/*unboxend*/\",\n \"\t\t}\",\n \"\t\tcol /= s; //divide by sample count\",\n \"\t}\",\n \"\tif (showFocus) {\",\n \"\t\tcol = debugFocus(col, blur, depth);\",\n \"\t}\",\n \"\tif (vignetting) {\",\n \"\t\tcol *= vignette();\",\n \"\t}\",\n \"\tgl_FragColor.rgb = col;\",\n \"\tgl_FragColor.a = 1.0;\",\n \"} \"\n ].join(\"\\n\")\n};\nconst BokehDepthShader = {\n uniforms: {\n mNear: { value: 1 },\n mFar: { value: 1e3 }\n },\n vertexShader: [\n \"varying float vViewZDepth;\",\n \"void main() {\",\n \"\t#include \",\n \"\t#include \",\n \"\tvViewZDepth = - mvPosition.z;\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform float mNear;\",\n \"uniform float mFar;\",\n \"varying float vViewZDepth;\",\n \"void main() {\",\n \"\tfloat color = 1.0 - smoothstep( mNear, mFar, vViewZDepth );\",\n \"\tgl_FragColor = vec4( vec3( color ), 1.0 );\",\n \"} \"\n ].join(\"\\n\")\n};\nclass CinematicCamera extends three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera {\n constructor(fov, aspect, near, far) {\n super(fov, aspect, near, far);\n this.type = \"CinematicCamera\";\n this.postprocessing = { enabled: true };\n this.shaderSettings = {\n rings: 3,\n samples: 4\n };\n const depthShader = BokehDepthShader;\n this.materialDepth = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: depthShader.uniforms,\n vertexShader: depthShader.vertexShader,\n fragmentShader: depthShader.fragmentShader\n });\n this.materialDepth.uniforms[\"mNear\"].value = near;\n this.materialDepth.uniforms[\"mFar\"].value = far;\n this.setLens();\n this.initPostProcessing();\n }\n // providing fnumber and coc(Circle of Confusion) as extra arguments\n setLens(focalLength, filmGauge, fNumber, coc) {\n if (focalLength === void 0)\n focalLength = 35;\n if (filmGauge !== void 0)\n this.filmGauge = filmGauge;\n this.setFocalLength(focalLength);\n if (fNumber === void 0)\n fNumber = 8;\n if (coc === void 0)\n coc = 0.019;\n this.fNumber = fNumber;\n this.coc = coc;\n this.aperture = focalLength / this.fNumber;\n this.hyperFocal = focalLength * focalLength / (this.aperture * this.coc);\n }\n linearize(depth) {\n const zfar = this.far;\n const znear = this.near;\n return -zfar * znear / (depth * (zfar - znear) - zfar);\n }\n smoothstep(near, far, depth) {\n const x = this.saturate((depth - near) / (far - near));\n return x * x * (3 - 2 * x);\n }\n saturate(x) {\n return Math.max(0, Math.min(1, x));\n }\n // function for focusing at a distance from the camera\n focusAt(focusDistance) {\n if (focusDistance === void 0)\n focusDistance = 20;\n const focalLength = this.getFocalLength();\n this.focus = focusDistance;\n this.nearPoint = this.hyperFocal * this.focus / (this.hyperFocal + (this.focus - focalLength));\n this.farPoint = this.hyperFocal * this.focus / (this.hyperFocal - (this.focus - focalLength));\n this.depthOfField = this.farPoint - this.nearPoint;\n if (this.depthOfField < 0)\n this.depthOfField = 0;\n this.sdistance = this.smoothstep(this.near, this.far, this.focus);\n this.ldistance = this.linearize(1 - this.sdistance);\n this.postprocessing.bokeh_uniforms[\"focalDepth\"].value = this.ldistance;\n }\n initPostProcessing() {\n if (this.postprocessing.enabled) {\n this.postprocessing.scene = new three__WEBPACK_IMPORTED_MODULE_42__.Scene();\n this.postprocessing.camera = new three__WEBPACK_IMPORTED_MODULE_42__.OrthographicCamera(\n window.innerWidth / -2,\n window.innerWidth / 2,\n window.innerHeight / 2,\n window.innerHeight / -2,\n -1e4,\n 1e4\n );\n this.postprocessing.scene.add(this.postprocessing.camera);\n this.postprocessing.rtTextureDepth = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(window.innerWidth, window.innerHeight);\n this.postprocessing.rtTextureColor = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(window.innerWidth, window.innerHeight);\n const bokeh_shader = BokehShader2;\n this.postprocessing.bokeh_uniforms = three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(bokeh_shader.uniforms);\n this.postprocessing.bokeh_uniforms[\"tColor\"].value = this.postprocessing.rtTextureColor.texture;\n this.postprocessing.bokeh_uniforms[\"tDepth\"].value = this.postprocessing.rtTextureDepth.texture;\n this.postprocessing.bokeh_uniforms[\"manualdof\"].value = 0;\n this.postprocessing.bokeh_uniforms[\"shaderFocus\"].value = 0;\n this.postprocessing.bokeh_uniforms[\"fstop\"].value = 2.8;\n this.postprocessing.bokeh_uniforms[\"showFocus\"].value = 1;\n this.postprocessing.bokeh_uniforms[\"focalDepth\"].value = 0.1;\n this.postprocessing.bokeh_uniforms[\"znear\"].value = this.near;\n this.postprocessing.bokeh_uniforms[\"zfar\"].value = this.near;\n this.postprocessing.bokeh_uniforms[\"textureWidth\"].value = window.innerWidth;\n this.postprocessing.bokeh_uniforms[\"textureHeight\"].value = window.innerHeight;\n this.postprocessing.materialBokeh = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: this.postprocessing.bokeh_uniforms,\n vertexShader: bokeh_shader.vertexShader,\n fragmentShader: bokeh_shader.fragmentShader,\n defines: {\n RINGS: this.shaderSettings.rings,\n SAMPLES: this.shaderSettings.samples,\n DEPTH_PACKING: 1\n }\n });\n this.postprocessing.quad = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(\n new three__WEBPACK_IMPORTED_MODULE_42__.PlaneGeometry(window.innerWidth, window.innerHeight),\n this.postprocessing.materialBokeh\n );\n this.postprocessing.quad.position.z = -500;\n this.postprocessing.scene.add(this.postprocessing.quad);\n }\n }\n renderCinematic(scene, renderer) {\n if (this.postprocessing.enabled) {\n const currentRenderTarget = renderer.getRenderTarget();\n renderer.clear();\n scene.overrideMaterial = null;\n renderer.setRenderTarget(this.postprocessing.rtTextureColor);\n renderer.clear();\n renderer.render(scene, this);\n scene.overrideMaterial = this.materialDepth;\n renderer.setRenderTarget(this.postprocessing.rtTextureDepth);\n renderer.clear();\n renderer.render(scene, this);\n renderer.setRenderTarget(null);\n renderer.render(this.postprocessing.scene, this.postprocessing.camera);\n renderer.setRenderTarget(currentRenderTarget);\n }\n }\n}\nconst _face = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Triangle();\nconst _color = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nclass MeshSurfaceSampler {\n constructor(mesh) {\n let geometry2 = mesh.geometry;\n if (geometry2.index) {\n console.warn(\"THREE.MeshSurfaceSampler: Converting geometry to non-indexed BufferGeometry.\");\n geometry2 = geometry2.toNonIndexed();\n }\n this.geometry = geometry2;\n this.randomFunction = Math.random;\n this.positionAttribute = this.geometry.getAttribute(\"position\");\n this.colorAttribute = this.geometry.getAttribute(\"color\");\n this.weightAttribute = null;\n this.distribution = null;\n }\n setWeightAttribute(name) {\n this.weightAttribute = name ? this.geometry.getAttribute(name) : null;\n return this;\n }\n build() {\n const positionAttribute = this.positionAttribute;\n const weightAttribute = this.weightAttribute;\n const faceWeights = new Float32Array(positionAttribute.count / 3);\n for (let i2 = 0; i2 < positionAttribute.count; i2 += 3) {\n let faceWeight = 1;\n if (weightAttribute) {\n faceWeight = weightAttribute.getX(i2) + weightAttribute.getX(i2 + 1) + weightAttribute.getX(i2 + 2);\n }\n _face.a.fromBufferAttribute(positionAttribute, i2);\n _face.b.fromBufferAttribute(positionAttribute, i2 + 1);\n _face.c.fromBufferAttribute(positionAttribute, i2 + 2);\n faceWeight *= _face.getArea();\n faceWeights[i2 / 3] = faceWeight;\n }\n this.distribution = new Float32Array(positionAttribute.count / 3);\n let cumulativeTotal = 0;\n for (let i2 = 0; i2 < faceWeights.length; i2++) {\n cumulativeTotal += faceWeights[i2];\n this.distribution[i2] = cumulativeTotal;\n }\n return this;\n }\n setRandomGenerator(randomFunction) {\n this.randomFunction = randomFunction;\n return this;\n }\n sample(targetPosition2, targetNormal, targetColor) {\n const faceIndex = this.sampleFaceIndex();\n return this.sampleFace(faceIndex, targetPosition2, targetNormal, targetColor);\n }\n sampleFaceIndex() {\n const cumulativeTotal = this.distribution[this.distribution.length - 1];\n return this.binarySearch(this.randomFunction() * cumulativeTotal);\n }\n binarySearch(x) {\n const dist = this.distribution;\n let start = 0;\n let end = dist.length - 1;\n let index = -1;\n while (start <= end) {\n const mid = Math.ceil((start + end) / 2);\n if (mid === 0 || dist[mid - 1] <= x && dist[mid] > x) {\n index = mid;\n break;\n } else if (x < dist[mid]) {\n end = mid - 1;\n } else {\n start = mid + 1;\n }\n }\n return index;\n }\n sampleFace(faceIndex, targetPosition2, targetNormal, targetColor) {\n let u = this.randomFunction();\n let v = this.randomFunction();\n if (u + v > 1) {\n u = 1 - u;\n v = 1 - v;\n }\n _face.a.fromBufferAttribute(this.positionAttribute, faceIndex * 3);\n _face.b.fromBufferAttribute(this.positionAttribute, faceIndex * 3 + 1);\n _face.c.fromBufferAttribute(this.positionAttribute, faceIndex * 3 + 2);\n targetPosition2.set(0, 0, 0).addScaledVector(_face.a, u).addScaledVector(_face.b, v).addScaledVector(_face.c, 1 - (u + v));\n if (targetNormal !== void 0) {\n _face.getNormal(targetNormal);\n }\n if (targetColor !== void 0 && this.colorAttribute !== void 0) {\n _face.a.fromBufferAttribute(this.colorAttribute, faceIndex * 3);\n _face.b.fromBufferAttribute(this.colorAttribute, faceIndex * 3 + 1);\n _face.c.fromBufferAttribute(this.colorAttribute, faceIndex * 3 + 2);\n _color.set(0, 0, 0).addScaledVector(_face.a, u).addScaledVector(_face.b, v).addScaledVector(_face.c, 1 - (u + v));\n targetColor.r = _color.x;\n targetColor.g = _color.y;\n targetColor.b = _color.z;\n }\n return this;\n }\n}\nconst a = {\n c: null,\n // center\n u: [/* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(), /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(), /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3()],\n // basis vectors\n e: []\n // half width\n};\nconst b = {\n c: null,\n // center\n u: [/* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(), /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(), /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3()],\n // basis vectors\n e: []\n // half width\n};\nconst R = [[], [], []];\nconst AbsR = [[], [], []];\nconst t = [];\nconst xAxis = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst yAxis = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst zAxis = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst v1 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst size = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst closestPoint = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst rotationMatrix = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Matrix3();\nconst aabb = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Box3();\nconst matrix = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\nconst inverse = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\nconst localRay = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Ray();\nclass OBB {\n constructor(center2 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(), halfSize = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(), rotation = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix3()) {\n this.center = center2;\n this.halfSize = halfSize;\n this.rotation = rotation;\n }\n set(center2, halfSize, rotation) {\n this.center = center2;\n this.halfSize = halfSize;\n this.rotation = rotation;\n return this;\n }\n copy(obb2) {\n this.center.copy(obb2.center);\n this.halfSize.copy(obb2.halfSize);\n this.rotation.copy(obb2.rotation);\n return this;\n }\n clone() {\n return new this.constructor().copy(this);\n }\n getSize(result) {\n return result.copy(this.halfSize).multiplyScalar(2);\n }\n /**\n * Reference: Closest Point on OBB to Point in Real-Time Collision Detection\n * by Christer Ericson (chapter 5.1.4)\n */\n clampPoint(point, result) {\n const halfSize = this.halfSize;\n v1.subVectors(point, this.center);\n this.rotation.extractBasis(xAxis, yAxis, zAxis);\n result.copy(this.center);\n const x = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.clamp(v1.dot(xAxis), -halfSize.x, halfSize.x);\n result.add(xAxis.multiplyScalar(x));\n const y = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.clamp(v1.dot(yAxis), -halfSize.y, halfSize.y);\n result.add(yAxis.multiplyScalar(y));\n const z = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.clamp(v1.dot(zAxis), -halfSize.z, halfSize.z);\n result.add(zAxis.multiplyScalar(z));\n return result;\n }\n containsPoint(point) {\n v1.subVectors(point, this.center);\n this.rotation.extractBasis(xAxis, yAxis, zAxis);\n return Math.abs(v1.dot(xAxis)) <= this.halfSize.x && Math.abs(v1.dot(yAxis)) <= this.halfSize.y && Math.abs(v1.dot(zAxis)) <= this.halfSize.z;\n }\n intersectsBox3(box3) {\n return this.intersectsOBB(obb.fromBox3(box3));\n }\n intersectsSphere(sphere) {\n this.clampPoint(sphere.center, closestPoint);\n return closestPoint.distanceToSquared(sphere.center) <= sphere.radius * sphere.radius;\n }\n /**\n * Reference: OBB-OBB Intersection in Real-Time Collision Detection\n * by Christer Ericson (chapter 4.4.1)\n *\n */\n intersectsOBB(obb2, epsilon = Number.EPSILON) {\n a.c = this.center;\n a.e[0] = this.halfSize.x;\n a.e[1] = this.halfSize.y;\n a.e[2] = this.halfSize.z;\n this.rotation.extractBasis(a.u[0], a.u[1], a.u[2]);\n b.c = obb2.center;\n b.e[0] = obb2.halfSize.x;\n b.e[1] = obb2.halfSize.y;\n b.e[2] = obb2.halfSize.z;\n obb2.rotation.extractBasis(b.u[0], b.u[1], b.u[2]);\n for (let i2 = 0; i2 < 3; i2++) {\n for (let j = 0; j < 3; j++) {\n R[i2][j] = a.u[i2].dot(b.u[j]);\n }\n }\n v1.subVectors(b.c, a.c);\n t[0] = v1.dot(a.u[0]);\n t[1] = v1.dot(a.u[1]);\n t[2] = v1.dot(a.u[2]);\n for (let i2 = 0; i2 < 3; i2++) {\n for (let j = 0; j < 3; j++) {\n AbsR[i2][j] = Math.abs(R[i2][j]) + epsilon;\n }\n }\n let ra, rb;\n for (let i2 = 0; i2 < 3; i2++) {\n ra = a.e[i2];\n rb = b.e[0] * AbsR[i2][0] + b.e[1] * AbsR[i2][1] + b.e[2] * AbsR[i2][2];\n if (Math.abs(t[i2]) > ra + rb)\n return false;\n }\n for (let i2 = 0; i2 < 3; i2++) {\n ra = a.e[0] * AbsR[0][i2] + a.e[1] * AbsR[1][i2] + a.e[2] * AbsR[2][i2];\n rb = b.e[i2];\n if (Math.abs(t[0] * R[0][i2] + t[1] * R[1][i2] + t[2] * R[2][i2]) > ra + rb)\n return false;\n }\n ra = a.e[1] * AbsR[2][0] + a.e[2] * AbsR[1][0];\n rb = b.e[1] * AbsR[0][2] + b.e[2] * AbsR[0][1];\n if (Math.abs(t[2] * R[1][0] - t[1] * R[2][0]) > ra + rb)\n return false;\n ra = a.e[1] * AbsR[2][1] + a.e[2] * AbsR[1][1];\n rb = b.e[0] * AbsR[0][2] + b.e[2] * AbsR[0][0];\n if (Math.abs(t[2] * R[1][1] - t[1] * R[2][1]) > ra + rb)\n return false;\n ra = a.e[1] * AbsR[2][2] + a.e[2] * AbsR[1][2];\n rb = b.e[0] * AbsR[0][1] + b.e[1] * AbsR[0][0];\n if (Math.abs(t[2] * R[1][2] - t[1] * R[2][2]) > ra + rb)\n return false;\n ra = a.e[0] * AbsR[2][0] + a.e[2] * AbsR[0][0];\n rb = b.e[1] * AbsR[1][2] + b.e[2] * AbsR[1][1];\n if (Math.abs(t[0] * R[2][0] - t[2] * R[0][0]) > ra + rb)\n return false;\n ra = a.e[0] * AbsR[2][1] + a.e[2] * AbsR[0][1];\n rb = b.e[0] * AbsR[1][2] + b.e[2] * AbsR[1][0];\n if (Math.abs(t[0] * R[2][1] - t[2] * R[0][1]) > ra + rb)\n return false;\n ra = a.e[0] * AbsR[2][2] + a.e[2] * AbsR[0][2];\n rb = b.e[0] * AbsR[1][1] + b.e[1] * AbsR[1][0];\n if (Math.abs(t[0] * R[2][2] - t[2] * R[0][2]) > ra + rb)\n return false;\n ra = a.e[0] * AbsR[1][0] + a.e[1] * AbsR[0][0];\n rb = b.e[1] * AbsR[2][2] + b.e[2] * AbsR[2][1];\n if (Math.abs(t[1] * R[0][0] - t[0] * R[1][0]) > ra + rb)\n return false;\n ra = a.e[0] * AbsR[1][1] + a.e[1] * AbsR[0][1];\n rb = b.e[0] * AbsR[2][2] + b.e[2] * AbsR[2][0];\n if (Math.abs(t[1] * R[0][1] - t[0] * R[1][1]) > ra + rb)\n return false;\n ra = a.e[0] * AbsR[1][2] + a.e[1] * AbsR[0][2];\n rb = b.e[0] * AbsR[2][1] + b.e[1] * AbsR[2][0];\n if (Math.abs(t[1] * R[0][2] - t[0] * R[1][2]) > ra + rb)\n return false;\n return true;\n }\n /**\n * Reference: Testing Box Against Plane in Real-Time Collision Detection\n * by Christer Ericson (chapter 5.2.3)\n */\n intersectsPlane(plane) {\n this.rotation.extractBasis(xAxis, yAxis, zAxis);\n const r = this.halfSize.x * Math.abs(plane.normal.dot(xAxis)) + this.halfSize.y * Math.abs(plane.normal.dot(yAxis)) + this.halfSize.z * Math.abs(plane.normal.dot(zAxis));\n const d = plane.normal.dot(this.center) - plane.constant;\n return Math.abs(d) <= r;\n }\n /**\n * Performs a ray/OBB intersection test and stores the intersection point\n * to the given 3D vector. If no intersection is detected, *null* is returned.\n */\n intersectRay(ray, result) {\n this.getSize(size);\n aabb.setFromCenterAndSize(v1.set(0, 0, 0), size);\n matrix.setFromMatrix3(this.rotation);\n matrix.setPosition(this.center);\n inverse.copy(matrix).invert();\n localRay.copy(ray).applyMatrix4(inverse);\n if (localRay.intersectBox(aabb, result)) {\n return result.applyMatrix4(matrix);\n } else {\n return null;\n }\n }\n /**\n * Performs a ray/OBB intersection test. Returns either true or false if\n * there is a intersection or not.\n */\n intersectsRay(ray) {\n return this.intersectRay(ray, v1) !== null;\n }\n fromBox3(box3) {\n box3.getCenter(this.center);\n box3.getSize(this.halfSize).multiplyScalar(0.5);\n this.rotation.identity();\n return this;\n }\n equals(obb2) {\n return obb2.center.equals(this.center) && obb2.halfSize.equals(this.halfSize) && obb2.rotation.equals(this.rotation);\n }\n applyMatrix4(matrix2) {\n const e = matrix2.elements;\n let sx = v1.set(e[0], e[1], e[2]).length();\n const sy = v1.set(e[4], e[5], e[6]).length();\n const sz = v1.set(e[8], e[9], e[10]).length();\n const det = matrix2.determinant();\n if (det < 0)\n sx = -sx;\n rotationMatrix.setFromMatrix4(matrix2);\n const invSX = 1 / sx;\n const invSY = 1 / sy;\n const invSZ = 1 / sz;\n rotationMatrix.elements[0] *= invSX;\n rotationMatrix.elements[1] *= invSX;\n rotationMatrix.elements[2] *= invSX;\n rotationMatrix.elements[3] *= invSY;\n rotationMatrix.elements[4] *= invSY;\n rotationMatrix.elements[5] *= invSY;\n rotationMatrix.elements[6] *= invSZ;\n rotationMatrix.elements[7] *= invSZ;\n rotationMatrix.elements[8] *= invSZ;\n this.rotation.multiply(rotationMatrix);\n this.halfSize.x *= sx;\n this.halfSize.y *= sy;\n this.halfSize.z *= sz;\n v1.setFromMatrixPosition(matrix2);\n this.center.add(v1);\n return this;\n }\n}\nconst obb = /* @__PURE__ */ new OBB();\nconst _v1$3 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst _v2$3 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst _v3 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst EPS = 1e-10;\nclass Capsule {\n constructor(start = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 0, 0), end = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 1, 0), radius = 1) {\n this.start = start;\n this.end = end;\n this.radius = radius;\n }\n clone() {\n return new Capsule(this.start.clone(), this.end.clone(), this.radius);\n }\n set(start, end, radius) {\n this.start.copy(start);\n this.end.copy(end);\n this.radius = radius;\n }\n copy(capsule) {\n this.start.copy(capsule.start);\n this.end.copy(capsule.end);\n this.radius = capsule.radius;\n }\n getCenter(target) {\n return target.copy(this.end).add(this.start).multiplyScalar(0.5);\n }\n translate(v) {\n this.start.add(v);\n this.end.add(v);\n }\n checkAABBAxis(p1x, p1y, p2x, p2y, minx, maxx, miny, maxy, radius) {\n return (minx - p1x < radius || minx - p2x < radius) && (p1x - maxx < radius || p2x - maxx < radius) && (miny - p1y < radius || miny - p2y < radius) && (p1y - maxy < radius || p2y - maxy < radius);\n }\n intersectsBox(box) {\n return this.checkAABBAxis(\n this.start.x,\n this.start.y,\n this.end.x,\n this.end.y,\n box.min.x,\n box.max.x,\n box.min.y,\n box.max.y,\n this.radius\n ) && this.checkAABBAxis(\n this.start.x,\n this.start.z,\n this.end.x,\n this.end.z,\n box.min.x,\n box.max.x,\n box.min.z,\n box.max.z,\n this.radius\n ) && this.checkAABBAxis(\n this.start.y,\n this.start.z,\n this.end.y,\n this.end.z,\n box.min.y,\n box.max.y,\n box.min.z,\n box.max.z,\n this.radius\n );\n }\n lineLineMinimumPoints(line1, line2) {\n const r = _v1$3.copy(line1.end).sub(line1.start);\n const s = _v2$3.copy(line2.end).sub(line2.start);\n const w = _v3.copy(line2.start).sub(line1.start);\n const a2 = r.dot(s), b2 = r.dot(r), c = s.dot(s), d = s.dot(w), e = r.dot(w);\n let t1, t2;\n const divisor = b2 * c - a2 * a2;\n if (Math.abs(divisor) < EPS) {\n const d1 = -d / c;\n const d2 = (a2 - d) / c;\n if (Math.abs(d1 - 0.5) < Math.abs(d2 - 0.5)) {\n t1 = 0;\n t2 = d1;\n } else {\n t1 = 1;\n t2 = d2;\n }\n } else {\n t1 = (d * a2 + e * c) / divisor;\n t2 = (t1 * a2 - d) / c;\n }\n t2 = Math.max(0, Math.min(1, t2));\n t1 = Math.max(0, Math.min(1, t1));\n const point1 = r.multiplyScalar(t1).add(line1.start);\n const point2 = s.multiplyScalar(t2).add(line2.start);\n return [point1, point2];\n }\n}\nconst _hsl = {};\nclass ColorConverter {\n static setHSV(color, h, s, v) {\n h = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.euclideanModulo(h, 1);\n s = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.clamp(s, 0, 1);\n v = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.clamp(v, 0, 1);\n return color.setHSL(h, s * v / ((h = (2 - s) * v) < 1 ? h : 2 - h), h * 0.5);\n }\n static getHSV(color, target) {\n color.getHSL(_hsl);\n _hsl.s *= _hsl.l < 0.5 ? _hsl.l : 1 - _hsl.l;\n target.h = _hsl.h;\n target.s = 2 * _hsl.s / (_hsl.l + _hsl.s);\n target.v = _hsl.l + _hsl.s;\n return target;\n }\n // where c, m, y, k is between 0 and 1\n static setCMYK(color, c, m, y, k) {\n const r = (1 - c) * (1 - k);\n const g = (1 - m) * (1 - k);\n const b2 = (1 - y) * (1 - k);\n return color.setRGB(r, g, b2);\n }\n static getCMYK(color, target) {\n const r = color.r;\n const g = color.g;\n const b2 = color.b;\n const k = 1 - Math.max(r, g, b2);\n const c = (1 - r - k) / (1 - k);\n const m = (1 - g - k) / (1 - k);\n const y = (1 - b2 - k) / (1 - k);\n target.c = c;\n target.m = m;\n target.y = y;\n target.k = k;\n return target;\n }\n}\nfunction init$1() {\n const _p2 = [\n 151,\n 160,\n 137,\n 91,\n 90,\n 15,\n 131,\n 13,\n 201,\n 95,\n 96,\n 53,\n 194,\n 233,\n 7,\n 225,\n 140,\n 36,\n 103,\n 30,\n 69,\n 142,\n 8,\n 99,\n 37,\n 240,\n 21,\n 10,\n 23,\n 190,\n 6,\n 148,\n 247,\n 120,\n 234,\n 75,\n 0,\n 26,\n 197,\n 62,\n 94,\n 252,\n 219,\n 203,\n 117,\n 35,\n 11,\n 32,\n 57,\n 177,\n 33,\n 88,\n 237,\n 149,\n 56,\n 87,\n 174,\n 20,\n 125,\n 136,\n 171,\n 168,\n 68,\n 175,\n 74,\n 165,\n 71,\n 134,\n 139,\n 48,\n 27,\n 166,\n 77,\n 146,\n 158,\n 231,\n 83,\n 111,\n 229,\n 122,\n 60,\n 211,\n 133,\n 230,\n 220,\n 105,\n 92,\n 41,\n 55,\n 46,\n 245,\n 40,\n 244,\n 102,\n 143,\n 54,\n 65,\n 25,\n 63,\n 161,\n 1,\n 216,\n 80,\n 73,\n 209,\n 76,\n 132,\n 187,\n 208,\n 89,\n 18,\n 169,\n 200,\n 196,\n 135,\n 130,\n 116,\n 188,\n 159,\n 86,\n 164,\n 100,\n 109,\n 198,\n 173,\n 186,\n 3,\n 64,\n 52,\n 217,\n 226,\n 250,\n 124,\n 123,\n 5,\n 202,\n 38,\n 147,\n 118,\n 126,\n 255,\n 82,\n 85,\n 212,\n 207,\n 206,\n 59,\n 227,\n 47,\n 16,\n 58,\n 17,\n 182,\n 189,\n 28,\n 42,\n 223,\n 183,\n 170,\n 213,\n 119,\n 248,\n 152,\n 2,\n 44,\n 154,\n 163,\n 70,\n 221,\n 153,\n 101,\n 155,\n 167,\n 43,\n 172,\n 9,\n 129,\n 22,\n 39,\n 253,\n 19,\n 98,\n 108,\n 110,\n 79,\n 113,\n 224,\n 232,\n 178,\n 185,\n 112,\n 104,\n 218,\n 246,\n 97,\n 228,\n 251,\n 34,\n 242,\n 193,\n 238,\n 210,\n 144,\n 12,\n 191,\n 179,\n 162,\n 241,\n 81,\n 51,\n 145,\n 235,\n 249,\n 14,\n 239,\n 107,\n 49,\n 192,\n 214,\n 31,\n 181,\n 199,\n 106,\n 157,\n 184,\n 84,\n 204,\n 176,\n 115,\n 121,\n 50,\n 45,\n 127,\n 4,\n 150,\n 254,\n 138,\n 236,\n 205,\n 93,\n 222,\n 114,\n 67,\n 29,\n 24,\n 72,\n 243,\n 141,\n 128,\n 195,\n 78,\n 66,\n 215,\n 61,\n 156,\n 180\n ];\n for (let i2 = 0; i2 < 256; i2++) {\n _p2[256 + i2] = _p2[i2];\n }\n return _p2;\n}\nconst _p = /* @__PURE__ */ init$1();\nfunction fade(t2) {\n return t2 * t2 * t2 * (t2 * (t2 * 6 - 15) + 10);\n}\nfunction lerp(t2, a2, b2) {\n return a2 + t2 * (b2 - a2);\n}\nfunction grad(hash, x, y, z) {\n const h = hash & 15;\n const u = h < 8 ? x : y, v = h < 4 ? y : h == 12 || h == 14 ? x : z;\n return ((h & 1) == 0 ? u : -u) + ((h & 2) == 0 ? v : -v);\n}\nclass ImprovedNoise {\n noise(x, y, z) {\n const floorX = Math.floor(x), floorY = Math.floor(y), floorZ = Math.floor(z);\n const X = floorX & 255, Y = floorY & 255, Z = floorZ & 255;\n x -= floorX;\n y -= floorY;\n z -= floorZ;\n const xMinus1 = x - 1, yMinus1 = y - 1, zMinus1 = z - 1;\n const u = fade(x), v = fade(y), w = fade(z);\n const A = _p[X] + Y, AA = _p[A] + Z, AB = _p[A + 1] + Z, B = _p[X + 1] + Y, BA = _p[B] + Z, BB = _p[B + 1] + Z;\n return lerp(\n w,\n lerp(\n v,\n lerp(u, grad(_p[AA], x, y, z), grad(_p[BA], xMinus1, y, z)),\n lerp(u, grad(_p[AB], x, yMinus1, z), grad(_p[BB], xMinus1, yMinus1, z))\n ),\n lerp(\n v,\n lerp(u, grad(_p[AA + 1], x, y, zMinus1), grad(_p[BA + 1], xMinus1, y, zMinus1)),\n lerp(u, grad(_p[AB + 1], x, yMinus1, zMinus1), grad(_p[BB + 1], xMinus1, yMinus1, zMinus1))\n )\n );\n }\n}\nconst _v1$2 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst _v2$2 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst _plane$1 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Plane();\nconst _line1 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Line3();\nconst _line2 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Line3();\nconst _sphere$1 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Sphere();\nconst _capsule = /* @__PURE__ */ new Capsule();\nclass Octree {\n constructor(box) {\n this.triangles = [];\n this.box = box;\n this.subTrees = [];\n }\n addTriangle(triangle) {\n if (!this.bounds)\n this.bounds = new three__WEBPACK_IMPORTED_MODULE_42__.Box3();\n this.bounds.min.x = Math.min(this.bounds.min.x, triangle.a.x, triangle.b.x, triangle.c.x);\n this.bounds.min.y = Math.min(this.bounds.min.y, triangle.a.y, triangle.b.y, triangle.c.y);\n this.bounds.min.z = Math.min(this.bounds.min.z, triangle.a.z, triangle.b.z, triangle.c.z);\n this.bounds.max.x = Math.max(this.bounds.max.x, triangle.a.x, triangle.b.x, triangle.c.x);\n this.bounds.max.y = Math.max(this.bounds.max.y, triangle.a.y, triangle.b.y, triangle.c.y);\n this.bounds.max.z = Math.max(this.bounds.max.z, triangle.a.z, triangle.b.z, triangle.c.z);\n this.triangles.push(triangle);\n return this;\n }\n calcBox() {\n this.box = this.bounds.clone();\n this.box.min.x -= 0.01;\n this.box.min.y -= 0.01;\n this.box.min.z -= 0.01;\n return this;\n }\n split(level) {\n if (!this.box)\n return;\n const subTrees = [];\n const halfsize = _v2$2.copy(this.box.max).sub(this.box.min).multiplyScalar(0.5);\n for (let x = 0; x < 2; x++) {\n for (let y = 0; y < 2; y++) {\n for (let z = 0; z < 2; z++) {\n const box = new three__WEBPACK_IMPORTED_MODULE_42__.Box3();\n const v = _v1$2.set(x, y, z);\n box.min.copy(this.box.min).add(v.multiply(halfsize));\n box.max.copy(box.min).add(halfsize);\n subTrees.push(new Octree(box));\n }\n }\n }\n let triangle;\n while (triangle = this.triangles.pop()) {\n for (let i2 = 0; i2 < subTrees.length; i2++) {\n if (subTrees[i2].box.intersectsTriangle(triangle)) {\n subTrees[i2].triangles.push(triangle);\n }\n }\n }\n for (let i2 = 0; i2 < subTrees.length; i2++) {\n const len = subTrees[i2].triangles.length;\n if (len > 8 && level < 16) {\n subTrees[i2].split(level + 1);\n }\n if (len !== 0) {\n this.subTrees.push(subTrees[i2]);\n }\n }\n return this;\n }\n build() {\n this.calcBox();\n this.split(0);\n return this;\n }\n getRayTriangles(ray, triangles) {\n for (let i2 = 0; i2 < this.subTrees.length; i2++) {\n const subTree = this.subTrees[i2];\n if (!ray.intersectsBox(subTree.box))\n continue;\n if (subTree.triangles.length > 0) {\n for (let j = 0; j < subTree.triangles.length; j++) {\n if (triangles.indexOf(subTree.triangles[j]) === -1)\n triangles.push(subTree.triangles[j]);\n }\n } else {\n subTree.getRayTriangles(ray, triangles);\n }\n }\n return triangles;\n }\n triangleCapsuleIntersect(capsule, triangle) {\n triangle.getPlane(_plane$1);\n const d1 = _plane$1.distanceToPoint(capsule.start) - capsule.radius;\n const d2 = _plane$1.distanceToPoint(capsule.end) - capsule.radius;\n if (d1 > 0 && d2 > 0 || d1 < -capsule.radius && d2 < -capsule.radius) {\n return false;\n }\n const delta = Math.abs(d1 / (Math.abs(d1) + Math.abs(d2)));\n const intersectPoint = _v1$2.copy(capsule.start).lerp(capsule.end, delta);\n if (triangle.containsPoint(intersectPoint)) {\n return { normal: _plane$1.normal.clone(), point: intersectPoint.clone(), depth: Math.abs(Math.min(d1, d2)) };\n }\n const r2 = capsule.radius * capsule.radius;\n const line1 = _line1.set(capsule.start, capsule.end);\n const lines = [\n [triangle.a, triangle.b],\n [triangle.b, triangle.c],\n [triangle.c, triangle.a]\n ];\n for (let i2 = 0; i2 < lines.length; i2++) {\n const line2 = _line2.set(lines[i2][0], lines[i2][1]);\n const [point1, point2] = capsule.lineLineMinimumPoints(line1, line2);\n if (point1.distanceToSquared(point2) < r2) {\n return {\n normal: point1.clone().sub(point2).normalize(),\n point: point2.clone(),\n depth: capsule.radius - point1.distanceTo(point2)\n };\n }\n }\n return false;\n }\n triangleSphereIntersect(sphere, triangle) {\n triangle.getPlane(_plane$1);\n if (!sphere.intersectsPlane(_plane$1))\n return false;\n const depth = Math.abs(_plane$1.distanceToSphere(sphere));\n const r2 = sphere.radius * sphere.radius - depth * depth;\n const plainPoint = _plane$1.projectPoint(sphere.center, _v1$2);\n if (triangle.containsPoint(sphere.center)) {\n return {\n normal: _plane$1.normal.clone(),\n point: plainPoint.clone(),\n depth: Math.abs(_plane$1.distanceToSphere(sphere))\n };\n }\n const lines = [\n [triangle.a, triangle.b],\n [triangle.b, triangle.c],\n [triangle.c, triangle.a]\n ];\n for (let i2 = 0; i2 < lines.length; i2++) {\n _line1.set(lines[i2][0], lines[i2][1]);\n _line1.closestPointToPoint(plainPoint, true, _v2$2);\n const d = _v2$2.distanceToSquared(sphere.center);\n if (d < r2) {\n return {\n normal: sphere.center.clone().sub(_v2$2).normalize(),\n point: _v2$2.clone(),\n depth: sphere.radius - Math.sqrt(d)\n };\n }\n }\n return false;\n }\n getSphereTriangles(sphere, triangles) {\n for (let i2 = 0; i2 < this.subTrees.length; i2++) {\n const subTree = this.subTrees[i2];\n if (!sphere.intersectsBox(subTree.box))\n continue;\n if (subTree.triangles.length > 0) {\n for (let j = 0; j < subTree.triangles.length; j++) {\n if (triangles.indexOf(subTree.triangles[j]) === -1)\n triangles.push(subTree.triangles[j]);\n }\n } else {\n subTree.getSphereTriangles(sphere, triangles);\n }\n }\n }\n getCapsuleTriangles(capsule, triangles) {\n for (let i2 = 0; i2 < this.subTrees.length; i2++) {\n const subTree = this.subTrees[i2];\n if (!capsule.intersectsBox(subTree.box))\n continue;\n if (subTree.triangles.length > 0) {\n for (let j = 0; j < subTree.triangles.length; j++) {\n if (triangles.indexOf(subTree.triangles[j]) === -1)\n triangles.push(subTree.triangles[j]);\n }\n } else {\n subTree.getCapsuleTriangles(capsule, triangles);\n }\n }\n }\n sphereIntersect(sphere) {\n _sphere$1.copy(sphere);\n const triangles = [];\n let result, hit = false;\n this.getSphereTriangles(sphere, triangles);\n for (let i2 = 0; i2 < triangles.length; i2++) {\n if (result = this.triangleSphereIntersect(_sphere$1, triangles[i2])) {\n hit = true;\n _sphere$1.center.add(result.normal.multiplyScalar(result.depth));\n }\n }\n if (hit) {\n const collisionVector = _sphere$1.center.clone().sub(sphere.center);\n const depth = collisionVector.length();\n return { normal: collisionVector.normalize(), depth };\n }\n return false;\n }\n capsuleIntersect(capsule) {\n _capsule.copy(capsule);\n const triangles = [];\n let result, hit = false;\n this.getCapsuleTriangles(_capsule, triangles);\n for (let i2 = 0; i2 < triangles.length; i2++) {\n if (result = this.triangleCapsuleIntersect(_capsule, triangles[i2])) {\n hit = true;\n _capsule.translate(result.normal.multiplyScalar(result.depth));\n }\n }\n if (hit) {\n const collisionVector = _capsule.getCenter(new three__WEBPACK_IMPORTED_MODULE_42__.Vector3()).sub(capsule.getCenter(_v1$2));\n const depth = collisionVector.length();\n return { normal: collisionVector.normalize(), depth };\n }\n return false;\n }\n rayIntersect(ray) {\n if (ray.direction.length() === 0)\n return;\n const triangles = [];\n let triangle, position, distance = 1e100;\n this.getRayTriangles(ray, triangles);\n for (let i2 = 0; i2 < triangles.length; i2++) {\n const result = ray.intersectTriangle(triangles[i2].a, triangles[i2].b, triangles[i2].c, true, _v1$2);\n if (result) {\n const newdistance = result.sub(ray.origin).length();\n if (distance > newdistance) {\n position = result.clone().add(ray.origin);\n distance = newdistance;\n triangle = triangles[i2];\n }\n }\n }\n return distance < 1e100 ? { distance, triangle, position } : false;\n }\n fromGraphNode(group) {\n group.updateWorldMatrix(true, true);\n group.traverse((obj) => {\n if (obj.isMesh === true) {\n let geometry2, isTemp = false;\n if (obj.geometry.index !== null) {\n isTemp = true;\n geometry2 = obj.geometry.toNonIndexed();\n } else {\n geometry2 = obj.geometry;\n }\n const positionAttribute = geometry2.getAttribute(\"position\");\n for (let i2 = 0; i2 < positionAttribute.count; i2 += 3) {\n const v12 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3().fromBufferAttribute(positionAttribute, i2);\n const v2 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3().fromBufferAttribute(positionAttribute, i2 + 1);\n const v3 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3().fromBufferAttribute(positionAttribute, i2 + 2);\n v12.applyMatrix4(obj.matrixWorld);\n v2.applyMatrix4(obj.matrixWorld);\n v3.applyMatrix4(obj.matrixWorld);\n this.addTriangle(new three__WEBPACK_IMPORTED_MODULE_42__.Triangle(v12, v2, v3));\n }\n if (isTemp) {\n geometry2.dispose();\n }\n }\n });\n this.build();\n return this;\n }\n}\nclass Lut {\n constructor(colormap, count = 32) {\n this.isLut = true;\n this.lut = [];\n this.map = [];\n this.n = 0;\n this.minV = 0;\n this.maxV = 1;\n this.setColorMap(colormap, count);\n }\n set(value) {\n if (value.isLut === true) {\n this.copy(value);\n }\n return this;\n }\n setMin(min) {\n this.minV = min;\n return this;\n }\n setMax(max) {\n this.maxV = max;\n return this;\n }\n setColorMap(colormap, count = 32) {\n this.map = ColorMapKeywords[colormap] || ColorMapKeywords.rainbow;\n this.n = count;\n const step = 1 / this.n;\n const minColor = new three__WEBPACK_IMPORTED_MODULE_42__.Color();\n const maxColor = new three__WEBPACK_IMPORTED_MODULE_42__.Color();\n this.lut.length = 0;\n this.lut.push(new three__WEBPACK_IMPORTED_MODULE_42__.Color(this.map[0][1]));\n for (let i2 = 1; i2 < count; i2++) {\n const alpha = i2 * step;\n for (let j = 0; j < this.map.length - 1; j++) {\n if (alpha > this.map[j][0] && alpha <= this.map[j + 1][0]) {\n const min = this.map[j][0];\n const max = this.map[j + 1][0];\n minColor.setHex(this.map[j][1], \"linear-srgb\");\n maxColor.setHex(this.map[j + 1][1], \"linear-srgb\");\n const color = new three__WEBPACK_IMPORTED_MODULE_42__.Color().lerpColors(minColor, maxColor, (alpha - min) / (max - min));\n this.lut.push(color);\n }\n }\n }\n this.lut.push(new three__WEBPACK_IMPORTED_MODULE_42__.Color(this.map[this.map.length - 1][1]));\n return this;\n }\n copy(lut) {\n this.lut = lut.lut;\n this.map = lut.map;\n this.n = lut.n;\n this.minV = lut.minV;\n this.maxV = lut.maxV;\n return this;\n }\n getColor(alpha) {\n alpha = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.clamp(alpha, this.minV, this.maxV);\n alpha = (alpha - this.minV) / (this.maxV - this.minV);\n const colorPosition = Math.round(alpha * this.n);\n return this.lut[colorPosition];\n }\n addColorMap(name, arrayOfColors) {\n ColorMapKeywords[name] = arrayOfColors;\n return this;\n }\n createCanvas() {\n const canvas = document.createElement(\"canvas\");\n canvas.width = 1;\n canvas.height = this.n;\n this.updateCanvas(canvas);\n return canvas;\n }\n updateCanvas(canvas) {\n const ctx = canvas.getContext(\"2d\", { alpha: false });\n const imageData = ctx.getImageData(0, 0, 1, this.n);\n const data = imageData.data;\n let k = 0;\n const step = 1 / this.n;\n const minColor = new three__WEBPACK_IMPORTED_MODULE_42__.Color();\n const maxColor = new three__WEBPACK_IMPORTED_MODULE_42__.Color();\n const finalColor = new three__WEBPACK_IMPORTED_MODULE_42__.Color();\n for (let i2 = 1; i2 >= 0; i2 -= step) {\n for (let j = this.map.length - 1; j >= 0; j--) {\n if (i2 < this.map[j][0] && i2 >= this.map[j - 1][0]) {\n const min = this.map[j - 1][0];\n const max = this.map[j][0];\n minColor.setHex(this.map[j - 1][1], \"linear-srgb\");\n maxColor.setHex(this.map[j][1], \"linear-srgb\");\n finalColor.lerpColors(minColor, maxColor, (i2 - min) / (max - min));\n data[k * 4] = Math.round(finalColor.r * 255);\n data[k * 4 + 1] = Math.round(finalColor.g * 255);\n data[k * 4 + 2] = Math.round(finalColor.b * 255);\n data[k * 4 + 3] = 255;\n k += 1;\n }\n }\n }\n ctx.putImageData(imageData, 0, 0);\n return canvas;\n }\n}\nconst ColorMapKeywords = {\n rainbow: [\n [0, 255],\n [0.2, 65535],\n [0.5, 65280],\n [0.8, 16776960],\n [1, 16711680]\n ],\n cooltowarm: [\n [0, 3952322],\n [0.2, 10206463],\n [0.5, 14474460],\n [0.8, 16163717],\n [1, 11797542]\n ],\n blackbody: [\n [0, 0],\n [0.2, 7864320],\n [0.5, 15086080],\n [0.8, 16776960],\n [1, 16777215]\n ],\n grayscale: [\n [0, 0],\n [0.2, 4210752],\n [0.5, 8355712],\n [0.8, 12566463],\n [1, 16777215]\n ]\n};\nvar STATE$1 = /* @__PURE__ */ ((STATE2) => {\n STATE2[STATE2[\"NONE\"] = -1] = \"NONE\";\n STATE2[STATE2[\"ROTATE\"] = 0] = \"ROTATE\";\n STATE2[STATE2[\"DOLLY\"] = 1] = \"DOLLY\";\n STATE2[STATE2[\"PAN\"] = 2] = \"PAN\";\n STATE2[STATE2[\"TOUCH_ROTATE\"] = 3] = \"TOUCH_ROTATE\";\n STATE2[STATE2[\"TOUCH_PAN\"] = 4] = \"TOUCH_PAN\";\n STATE2[STATE2[\"TOUCH_DOLLY_PAN\"] = 5] = \"TOUCH_DOLLY_PAN\";\n STATE2[STATE2[\"TOUCH_DOLLY_ROTATE\"] = 6] = \"TOUCH_DOLLY_ROTATE\";\n return STATE2;\n})(STATE$1 || {});\nclass CameraControls extends three__WEBPACK_IMPORTED_MODULE_42__.EventDispatcher {\n constructor(object, domElement) {\n super();\n __publicField(this, \"object\");\n __publicField(this, \"domElement\");\n /** Set to false to disable this control */\n __publicField(this, \"enabled\", true);\n /** \"target\" sets the location of focus, where the object orbits around */\n __publicField(this, \"target\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n /** Set to true to enable trackball behavior */\n __publicField(this, \"trackball\", false);\n /** How far you can dolly in ( PerspectiveCamera only ) */\n __publicField(this, \"minDistance\", 0);\n /** How far you can dolly out ( PerspectiveCamera only ) */\n __publicField(this, \"maxDistance\", Infinity);\n // How far you can zoom in and out ( OrthographicCamera only )\n __publicField(this, \"minZoom\", 0);\n __publicField(this, \"maxZoom\", Infinity);\n // How far you can orbit vertically, upper and lower limits.\n // Range is 0 to Math.PI radians.\n __publicField(this, \"minPolarAngle\", 0);\n __publicField(this, \"maxPolarAngle\", Math.PI);\n // How far you can orbit horizontally, upper and lower limits.\n // If set, must be a sub-interval of the interval [ - Math.PI, Math.PI ].\n __publicField(this, \"minAzimuthAngle\", -Infinity);\n // radians\n __publicField(this, \"maxAzimuthAngle\", Infinity);\n // radians\n // Set to true to enable damping (inertia)\n // If damping is enabled, you must call controls.update() in your animation loop\n __publicField(this, \"enableDamping\", false);\n __publicField(this, \"dampingFactor\", 0.05);\n /**\n * This option enables dollying in and out; property named as \"zoom\" for backwards compatibility\n * Set to false to disable zooming\n */\n __publicField(this, \"enableZoom\", true);\n __publicField(this, \"zoomSpeed\", 1);\n /** Set to false to disable rotating */\n __publicField(this, \"enableRotate\", true);\n __publicField(this, \"rotateSpeed\", 1);\n /** Set to false to disable panning */\n __publicField(this, \"enablePan\", true);\n __publicField(this, \"panSpeed\", 1);\n /** if true, pan in screen-space */\n __publicField(this, \"screenSpacePanning\", false);\n /** pixels moved per arrow key push */\n __publicField(this, \"keyPanSpeed\", 7);\n /**\n * Set to true to automatically rotate around the target\n * If auto-rotate is enabled, you must call controls.update() in your animation loop\n * auto-rotate is not supported for trackball behavior\n */\n __publicField(this, \"autoRotate\", false);\n __publicField(this, \"autoRotateSpeed\", 2);\n // 30 seconds per round when fps is 60\n /** Set to false to disable use of the keys */\n __publicField(this, \"enableKeys\", true);\n /** The four arrow keys */\n __publicField(this, \"keys\", { LEFT: \"ArrowLeft\", UP: \"ArrowUp\", RIGHT: \"ArrowRight\", BOTTOM: \"ArrowDown\" });\n __publicField(this, \"mouseButtons\");\n /** Touch fingers */\n __publicField(this, \"touches\", { ONE: three__WEBPACK_IMPORTED_MODULE_42__.TOUCH.ROTATE, TWO: three__WEBPACK_IMPORTED_MODULE_42__.TOUCH.DOLLY_PAN });\n // for reset\n __publicField(this, \"target0\");\n __publicField(this, \"position0\");\n __publicField(this, \"quaternion0\");\n __publicField(this, \"zoom0\");\n // current position in spherical coordinates\n __publicField(this, \"spherical\", new three__WEBPACK_IMPORTED_MODULE_42__.Spherical());\n __publicField(this, \"sphericalDelta\", new three__WEBPACK_IMPORTED_MODULE_42__.Spherical());\n __publicField(this, \"changeEvent\", { type: \"change\" });\n __publicField(this, \"startEvent\", { type: \"start\" });\n __publicField(this, \"endEvent\", { type: \"end\" });\n __publicField(this, \"state\", -1);\n __publicField(this, \"EPS\", 1e-6);\n __publicField(this, \"scale\", 1);\n __publicField(this, \"panOffset\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"zoomChanged\", false);\n __publicField(this, \"rotateStart\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector2());\n __publicField(this, \"rotateEnd\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector2());\n __publicField(this, \"rotateDelta\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector2());\n __publicField(this, \"panStart\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector2());\n __publicField(this, \"panEnd\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector2());\n __publicField(this, \"panDelta\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector2());\n __publicField(this, \"dollyStart\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector2());\n __publicField(this, \"dollyEnd\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector2());\n __publicField(this, \"dollyDelta\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector2());\n __publicField(this, \"offset\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"lastPosition\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"lastQuaternion\", new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion());\n __publicField(this, \"q\", new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion());\n __publicField(this, \"v\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"vec\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"quat\");\n __publicField(this, \"quatInverse\");\n __publicField(this, \"getPolarAngle\", () => this.spherical.phi);\n __publicField(this, \"getAzimuthalAngle\", () => this.spherical.theta);\n __publicField(this, \"saveState\", () => {\n this.target0.copy(this.target);\n this.position0.copy(this.object.position);\n this.quaternion0.copy(this.object.quaternion);\n this.zoom0 = this.object.zoom;\n });\n __publicField(this, \"reset\", () => {\n this.target.copy(this.target0);\n this.object.position.copy(this.position0);\n this.object.quaternion.copy(this.quaternion0);\n this.object.zoom = this.zoom0;\n this.object.updateProjectionMatrix();\n this.dispatchEvent(this.changeEvent);\n this.update();\n this.state = -1;\n });\n __publicField(this, \"dispose\", () => {\n this.domElement.removeEventListener(\"contextmenu\", this.onContextMenu, false);\n this.domElement.removeEventListener(\"mousedown\", this.onMouseDown, false);\n this.domElement.removeEventListener(\"wheel\", this.onMouseWheel, false);\n this.domElement.removeEventListener(\"touchstart\", this.onTouchStart, false);\n this.domElement.removeEventListener(\"touchend\", this.onTouchEnd, false);\n this.domElement.removeEventListener(\"touchmove\", this.onTouchMove, false);\n document.removeEventListener(\"mousemove\", this.onMouseMove, false);\n document.removeEventListener(\"mouseup\", this.onMouseUp, false);\n this.domElement.removeEventListener(\"keydown\", this.onKeyDown, false);\n });\n __publicField(this, \"update\", () => {\n const position = this.object.position;\n this.offset.copy(position).sub(this.target);\n if (this.trackball) {\n if (this.sphericalDelta.theta) {\n this.vec.set(0, 1, 0).applyQuaternion(this.object.quaternion);\n const factor = this.enableDamping ? this.dampingFactor : 1;\n this.q.setFromAxisAngle(this.vec, this.sphericalDelta.theta * factor);\n this.object.quaternion.premultiply(this.q);\n this.offset.applyQuaternion(this.q);\n }\n if (this.sphericalDelta.phi) {\n this.vec.set(1, 0, 0).applyQuaternion(this.object.quaternion);\n const factor = this.enableDamping ? this.dampingFactor : 1;\n this.q.setFromAxisAngle(this.vec, this.sphericalDelta.phi * factor);\n this.object.quaternion.premultiply(this.q);\n this.offset.applyQuaternion(this.q);\n }\n this.offset.multiplyScalar(this.scale);\n this.offset.clampLength(this.minDistance, this.maxDistance);\n } else {\n this.offset.applyQuaternion(this.quat);\n if (this.autoRotate && this.state === -1) {\n this.rotateLeft(this.getAutoRotationAngle());\n }\n this.spherical.setFromVector3(this.offset);\n if (this.enableDamping) {\n this.spherical.theta += this.sphericalDelta.theta * this.dampingFactor;\n this.spherical.phi += this.sphericalDelta.phi * this.dampingFactor;\n } else {\n this.spherical.theta += this.sphericalDelta.theta;\n this.spherical.phi += this.sphericalDelta.phi;\n }\n this.spherical.theta = Math.max(this.minAzimuthAngle, Math.min(this.maxAzimuthAngle, this.spherical.theta));\n this.spherical.phi = Math.max(this.minPolarAngle, Math.min(this.maxPolarAngle, this.spherical.phi));\n this.spherical.makeSafe();\n this.spherical.radius *= this.scale;\n this.spherical.radius = Math.max(this.minDistance, Math.min(this.maxDistance, this.spherical.radius));\n this.offset.setFromSpherical(this.spherical);\n this.offset.applyQuaternion(this.quatInverse);\n }\n if (this.enableDamping === true) {\n this.target.addScaledVector(this.panOffset, this.dampingFactor);\n } else {\n this.target.add(this.panOffset);\n }\n position.copy(this.target).add(this.offset);\n if (this.trackball === false) {\n this.object.lookAt(this.target);\n }\n if (this.enableDamping === true) {\n this.sphericalDelta.theta *= 1 - this.dampingFactor;\n this.sphericalDelta.phi *= 1 - this.dampingFactor;\n this.panOffset.multiplyScalar(1 - this.dampingFactor);\n } else {\n this.sphericalDelta.set(0, 0, 0);\n this.panOffset.set(0, 0, 0);\n }\n this.scale = 1;\n if (this.zoomChanged || this.lastPosition.distanceToSquared(this.object.position) > this.EPS || 8 * (1 - this.lastQuaternion.dot(this.object.quaternion)) > this.EPS) {\n this.dispatchEvent(this.changeEvent);\n this.lastPosition.copy(this.object.position);\n this.lastQuaternion.copy(this.object.quaternion);\n this.zoomChanged = false;\n return true;\n }\n return false;\n });\n __publicField(this, \"getAutoRotationAngle\", () => 2 * Math.PI / 60 / 60 * this.autoRotateSpeed);\n __publicField(this, \"getZoomScale\", () => Math.pow(0.95, this.zoomSpeed));\n __publicField(this, \"rotateLeft\", (angle) => {\n this.sphericalDelta.theta -= angle;\n });\n __publicField(this, \"rotateUp\", (angle) => {\n this.sphericalDelta.phi -= angle;\n });\n __publicField(this, \"panLeft\", (distance, objectMatrix) => {\n this.v.setFromMatrixColumn(objectMatrix, 0);\n this.v.multiplyScalar(-distance);\n this.panOffset.add(this.v);\n });\n __publicField(this, \"panUp\", (distance, objectMatrix) => {\n if (this.screenSpacePanning === true) {\n this.v.setFromMatrixColumn(objectMatrix, 1);\n } else {\n this.v.setFromMatrixColumn(objectMatrix, 0);\n this.v.crossVectors(this.object.up, this.v);\n }\n this.v.multiplyScalar(distance);\n this.panOffset.add(this.v);\n });\n // deltaX and deltaY are in pixels; right and down are positive\n __publicField(this, \"pan\", (deltaX, deltaY) => {\n const element = this.domElement;\n if (this.object instanceof three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera) {\n const position = this.object.position;\n this.offset.copy(position).sub(this.target);\n let targetDistance = this.offset.length();\n targetDistance *= Math.tan(this.object.fov / 2 * Math.PI / 180);\n this.panLeft(2 * deltaX * targetDistance / element.clientHeight, this.object.matrix);\n this.panUp(2 * deltaY * targetDistance / element.clientHeight, this.object.matrix);\n } else if (this.object.isOrthographicCamera) {\n this.panLeft(\n deltaX * (this.object.right - this.object.left) / this.object.zoom / element.clientWidth,\n this.object.matrix\n );\n this.panUp(\n deltaY * (this.object.top - this.object.bottom) / this.object.zoom / element.clientHeight,\n this.object.matrix\n );\n } else {\n console.warn(\"WARNING: CameraControls.js encountered an unknown camera type - pan disabled.\");\n this.enablePan = false;\n }\n });\n __publicField(this, \"dollyIn\", (dollyScale) => {\n if (this.object instanceof three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera) {\n this.scale /= dollyScale;\n } else if (this.object instanceof three__WEBPACK_IMPORTED_MODULE_42__.OrthographicCamera) {\n this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom * dollyScale));\n this.object.updateProjectionMatrix();\n this.zoomChanged = true;\n } else {\n console.warn(\"WARNING: CameraControls.js encountered an unknown camera type - dolly/zoom disabled.\");\n this.enableZoom = false;\n }\n });\n __publicField(this, \"dollyOut\", (dollyScale) => {\n if (this.object instanceof three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera) {\n this.scale *= dollyScale;\n } else if (this.object instanceof three__WEBPACK_IMPORTED_MODULE_42__.OrthographicCamera) {\n this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / dollyScale));\n this.object.updateProjectionMatrix();\n this.zoomChanged = true;\n } else {\n console.warn(\"WARNING: CameraControls.js encountered an unknown camera type - dolly/zoom disabled.\");\n this.enableZoom = false;\n }\n });\n // event callbacks - update the object state\n __publicField(this, \"handleMouseDownRotate\", (event) => {\n this.rotateStart.set(event.clientX, event.clientY);\n });\n // TODO: confirm if worthwhile to return the Vector2 instead of void\n __publicField(this, \"handleMouseDownDolly\", (event) => {\n this.dollyStart.set(event.clientX, event.clientY);\n });\n __publicField(this, \"handleMouseDownPan\", (event) => {\n this.panStart.set(event.clientX, event.clientY);\n });\n __publicField(this, \"handleMouseMoveRotate\", (event) => {\n this.rotateEnd.set(event.clientX, event.clientY);\n this.rotateDelta.subVectors(this.rotateEnd, this.rotateStart).multiplyScalar(this.rotateSpeed);\n const element = this.domElement;\n this.rotateLeft(2 * Math.PI * this.rotateDelta.x / element.clientHeight);\n this.rotateUp(2 * Math.PI * this.rotateDelta.y / element.clientHeight);\n this.rotateStart.copy(this.rotateEnd);\n this.update();\n });\n __publicField(this, \"handleMouseMoveDolly\", (event) => {\n this.dollyEnd.set(event.clientX, event.clientY);\n this.dollyDelta.subVectors(this.dollyEnd, this.dollyStart);\n if (this.dollyDelta.y > 0) {\n this.dollyIn(this.getZoomScale());\n } else if (this.dollyDelta.y < 0) {\n this.dollyOut(this.getZoomScale());\n }\n this.dollyStart.copy(this.dollyEnd);\n this.update();\n });\n __publicField(this, \"handleMouseMovePan\", (event) => {\n this.panEnd.set(event.clientX, event.clientY);\n this.panDelta.subVectors(this.panEnd, this.panStart).multiplyScalar(this.panSpeed);\n this.pan(this.panDelta.x, this.panDelta.y);\n this.panStart.copy(this.panEnd);\n this.update();\n });\n __publicField(this, \"handleMouseWheel\", (event) => {\n if (event.deltaY < 0) {\n this.dollyOut(this.getZoomScale());\n } else if (event.deltaY > 0) {\n this.dollyIn(this.getZoomScale());\n }\n this.update();\n });\n __publicField(this, \"handleKeyDown\", (event) => {\n let needsUpdate = false;\n switch (event.code) {\n case this.keys.UP:\n this.pan(0, this.keyPanSpeed);\n needsUpdate = true;\n break;\n case this.keys.BOTTOM:\n this.pan(0, -this.keyPanSpeed);\n needsUpdate = true;\n break;\n case this.keys.LEFT:\n this.pan(this.keyPanSpeed, 0);\n needsUpdate = true;\n break;\n case this.keys.RIGHT:\n this.pan(-this.keyPanSpeed, 0);\n needsUpdate = true;\n break;\n }\n if (needsUpdate) {\n event.preventDefault();\n this.update();\n }\n });\n __publicField(this, \"handleTouchStartRotate\", (event) => {\n if (event.touches.length == 1) {\n this.rotateStart.set(event.touches[0].pageX, event.touches[0].pageY);\n } else {\n const x = 0.5 * (event.touches[0].pageX + event.touches[1].pageX);\n const y = 0.5 * (event.touches[0].pageY + event.touches[1].pageY);\n this.rotateStart.set(x, y);\n }\n });\n __publicField(this, \"handleTouchStartPan\", (event) => {\n if (event.touches.length == 1) {\n this.panStart.set(event.touches[0].pageX, event.touches[0].pageY);\n } else {\n const x = 0.5 * (event.touches[0].pageX + event.touches[1].pageX);\n const y = 0.5 * (event.touches[0].pageY + event.touches[1].pageY);\n this.panStart.set(x, y);\n }\n });\n __publicField(this, \"handleTouchStartDolly\", (event) => {\n const dx = event.touches[0].pageX - event.touches[1].pageX;\n const dy = event.touches[0].pageY - event.touches[1].pageY;\n const distance = Math.sqrt(dx * dx + dy * dy);\n this.dollyStart.set(0, distance);\n });\n __publicField(this, \"handleTouchStartDollyPan\", (event) => {\n if (this.enableZoom)\n this.handleTouchStartDolly(event);\n if (this.enablePan)\n this.handleTouchStartPan(event);\n });\n __publicField(this, \"handleTouchStartDollyRotate\", (event) => {\n if (this.enableZoom)\n this.handleTouchStartDolly(event);\n if (this.enableRotate)\n this.handleTouchStartRotate(event);\n });\n __publicField(this, \"handleTouchMoveRotate\", (event) => {\n if (event.touches.length == 1) {\n this.rotateEnd.set(event.touches[0].pageX, event.touches[0].pageY);\n } else {\n const x = 0.5 * (event.touches[0].pageX + event.touches[1].pageX);\n const y = 0.5 * (event.touches[0].pageY + event.touches[1].pageY);\n this.rotateEnd.set(x, y);\n }\n this.rotateDelta.subVectors(this.rotateEnd, this.rotateStart).multiplyScalar(this.rotateSpeed);\n const element = this.domElement;\n this.rotateLeft(2 * Math.PI * this.rotateDelta.x / element.clientHeight);\n this.rotateUp(2 * Math.PI * this.rotateDelta.y / element.clientHeight);\n this.rotateStart.copy(this.rotateEnd);\n });\n __publicField(this, \"handleTouchMovePan\", (event) => {\n if (event.touches.length == 1) {\n this.panEnd.set(event.touches[0].pageX, event.touches[0].pageY);\n } else {\n const x = 0.5 * (event.touches[0].pageX + event.touches[1].pageX);\n const y = 0.5 * (event.touches[0].pageY + event.touches[1].pageY);\n this.panEnd.set(x, y);\n }\n this.panDelta.subVectors(this.panEnd, this.panStart).multiplyScalar(this.panSpeed);\n this.pan(this.panDelta.x, this.panDelta.y);\n this.panStart.copy(this.panEnd);\n });\n __publicField(this, \"handleTouchMoveDolly\", (event) => {\n const dx = event.touches[0].pageX - event.touches[1].pageX;\n const dy = event.touches[0].pageY - event.touches[1].pageY;\n const distance = Math.sqrt(dx * dx + dy * dy);\n this.dollyEnd.set(0, distance);\n this.dollyDelta.set(0, Math.pow(this.dollyEnd.y / this.dollyStart.y, this.zoomSpeed));\n this.dollyIn(this.dollyDelta.y);\n this.dollyStart.copy(this.dollyEnd);\n });\n __publicField(this, \"handleTouchMoveDollyPan\", (event) => {\n if (this.enableZoom)\n this.handleTouchMoveDolly(event);\n if (this.enablePan)\n this.handleTouchMovePan(event);\n });\n __publicField(this, \"handleTouchMoveDollyRotate\", (event) => {\n if (this.enableZoom)\n this.handleTouchMoveDolly(event);\n if (this.enableRotate)\n this.handleTouchMoveRotate(event);\n });\n //\n // event handlers - FSM: listen for events and reset state\n //\n __publicField(this, \"onMouseDown\", (event) => {\n if (this.enabled === false)\n return;\n event.preventDefault();\n this.domElement.focus ? this.domElement.focus() : window.focus();\n let mouseAction;\n switch (event.button) {\n case 0:\n mouseAction = this.mouseButtons.LEFT;\n break;\n case 1:\n mouseAction = this.mouseButtons.MIDDLE;\n break;\n case 2:\n mouseAction = this.mouseButtons.RIGHT;\n break;\n default:\n mouseAction = -1;\n }\n switch (mouseAction) {\n case three__WEBPACK_IMPORTED_MODULE_42__.MOUSE.DOLLY:\n if (this.enableZoom === false)\n return;\n this.handleMouseDownDolly(event);\n this.state = 1;\n break;\n case three__WEBPACK_IMPORTED_MODULE_42__.MOUSE.ROTATE:\n if (event.ctrlKey || event.metaKey || event.shiftKey) {\n if (this.enablePan === false)\n return;\n this.handleMouseDownPan(event);\n this.state = 2;\n } else {\n if (this.enableRotate === false)\n return;\n this.handleMouseDownRotate(event);\n this.state = 0;\n }\n break;\n case three__WEBPACK_IMPORTED_MODULE_42__.MOUSE.PAN:\n if (event.ctrlKey || event.metaKey || event.shiftKey) {\n if (this.enableRotate === false)\n return;\n this.handleMouseDownRotate(event);\n this.state = 0;\n } else {\n if (this.enablePan === false)\n return;\n this.handleMouseDownPan(event);\n this.state = 2;\n }\n break;\n default:\n this.state = -1;\n }\n if (this.state !== -1) {\n document.addEventListener(\"mousemove\", this.onMouseMove, false);\n document.addEventListener(\"mouseup\", this.onMouseUp, false);\n this.dispatchEvent(this.startEvent);\n }\n });\n __publicField(this, \"onMouseMove\", (event) => {\n if (this.enabled === false)\n return;\n event.preventDefault();\n switch (this.state) {\n case 0:\n if (this.enableRotate === false)\n return;\n this.handleMouseMoveRotate(event);\n break;\n case 1:\n if (this.enableZoom === false)\n return;\n this.handleMouseMoveDolly(event);\n break;\n case 2:\n if (this.enablePan === false)\n return;\n this.handleMouseMovePan(event);\n break;\n }\n });\n __publicField(this, \"onMouseUp\", () => {\n if (this.enabled === false)\n return;\n document.removeEventListener(\"mousemove\", this.onMouseMove, false);\n document.removeEventListener(\"mouseup\", this.onMouseUp, false);\n this.dispatchEvent(this.endEvent);\n this.state = -1;\n });\n __publicField(this, \"onMouseWheel\", (event) => {\n if (this.enabled === false || this.enableZoom === false || this.state !== -1 && this.state !== 0) {\n return;\n }\n event.preventDefault();\n this.dispatchEvent(this.startEvent);\n this.handleMouseWheel(event);\n this.dispatchEvent(this.endEvent);\n });\n __publicField(this, \"onKeyDown\", (event) => {\n if (this.enabled === false || this.enableKeys === false || this.enablePan === false)\n return;\n this.handleKeyDown(event);\n });\n __publicField(this, \"onTouchStart\", (event) => {\n if (this.enabled === false)\n return;\n event.preventDefault();\n switch (event.touches.length) {\n case 1:\n switch (this.touches.ONE) {\n case three__WEBPACK_IMPORTED_MODULE_42__.TOUCH.ROTATE:\n if (this.enableRotate === false)\n return;\n this.handleTouchStartRotate(event);\n this.state = 3;\n break;\n case three__WEBPACK_IMPORTED_MODULE_42__.TOUCH.PAN:\n if (this.enablePan === false)\n return;\n this.handleTouchStartPan(event);\n this.state = 4;\n break;\n default:\n this.state = -1;\n }\n break;\n case 2:\n switch (this.touches.TWO) {\n case three__WEBPACK_IMPORTED_MODULE_42__.TOUCH.DOLLY_PAN:\n if (this.enableZoom === false && this.enablePan === false)\n return;\n this.handleTouchStartDollyPan(event);\n this.state = 5;\n break;\n case three__WEBPACK_IMPORTED_MODULE_42__.TOUCH.DOLLY_ROTATE:\n if (this.enableZoom === false && this.enableRotate === false)\n return;\n this.handleTouchStartDollyRotate(event);\n this.state = 6;\n break;\n default:\n this.state = -1;\n }\n break;\n default:\n this.state = -1;\n }\n if (this.state !== -1) {\n this.dispatchEvent(this.startEvent);\n }\n });\n __publicField(this, \"onTouchMove\", (event) => {\n if (this.enabled === false)\n return;\n event.preventDefault();\n switch (this.state) {\n case 3:\n if (this.enableRotate === false)\n return;\n this.handleTouchMoveRotate(event);\n this.update();\n break;\n case 4:\n if (this.enablePan === false)\n return;\n this.handleTouchMovePan(event);\n this.update();\n break;\n case 5:\n if (this.enableZoom === false && this.enablePan === false)\n return;\n this.handleTouchMoveDollyPan(event);\n this.update();\n break;\n case 6:\n if (this.enableZoom === false && this.enableRotate === false)\n return;\n this.handleTouchMoveDollyRotate(event);\n this.update();\n break;\n default:\n this.state = -1;\n }\n });\n __publicField(this, \"onTouchEnd\", () => {\n if (this.enabled === false)\n return;\n this.dispatchEvent(this.endEvent);\n this.state = -1;\n });\n __publicField(this, \"onContextMenu\", (event) => {\n if (this.enabled === false)\n return;\n event.preventDefault();\n });\n if (domElement === void 0) {\n console.warn('THREE.CameraControls: The second parameter \"domElement\" is now mandatory.');\n }\n if (domElement instanceof Document) {\n console.error(\n 'THREE.CameraControls: \"document\" should not be used as the target \"domElement\". Please use \"renderer.domElement\" instead.'\n );\n }\n this.object = object;\n this.domElement = domElement;\n this.mouseButtons = {\n LEFT: three__WEBPACK_IMPORTED_MODULE_42__.MOUSE.ROTATE,\n MIDDLE: three__WEBPACK_IMPORTED_MODULE_42__.MOUSE.DOLLY,\n RIGHT: three__WEBPACK_IMPORTED_MODULE_42__.MOUSE.PAN\n };\n this.target0 = this.target.clone();\n this.position0 = this.object.position.clone();\n this.quaternion0 = this.object.quaternion.clone();\n this.zoom0 = this.object.zoom;\n this.quat = new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion().setFromUnitVectors(this.object.up, new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 1, 0));\n this.quatInverse = this.quat.clone().invert();\n this.lastPosition = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this.lastQuaternion = new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion();\n this.domElement.addEventListener(\"contextmenu\", this.onContextMenu, false);\n this.domElement.addEventListener(\"mousedown\", this.onMouseDown, false);\n this.domElement.addEventListener(\"wheel\", this.onMouseWheel, false);\n this.domElement.addEventListener(\"touchstart\", this.onTouchStart, false);\n this.domElement.addEventListener(\"touchend\", this.onTouchEnd, false);\n this.domElement.addEventListener(\"touchmove\", this.onTouchMove, false);\n this.domElement.addEventListener(\"keydown\", this.onKeyDown, false);\n if (this.domElement.tabIndex === -1) {\n this.domElement.tabIndex = 0;\n }\n this.object.lookAt(this.target);\n this.update();\n this.saveState();\n }\n handleMouseUp() {\n }\n handleTouchEnd() {\n }\n}\nclass OrbitControlsExp extends CameraControls {\n constructor(object, domElement) {\n super(object, domElement);\n __publicField(this, \"mouseButtons\");\n __publicField(this, \"touches\");\n this.mouseButtons = {\n LEFT: three__WEBPACK_IMPORTED_MODULE_42__.MOUSE.ROTATE,\n RIGHT: three__WEBPACK_IMPORTED_MODULE_42__.MOUSE.PAN\n };\n this.touches = {\n ONE: three__WEBPACK_IMPORTED_MODULE_42__.TOUCH.ROTATE,\n TWO: three__WEBPACK_IMPORTED_MODULE_42__.TOUCH.DOLLY_PAN\n };\n }\n}\nclass MapControlsExp extends CameraControls {\n constructor(object, domElement) {\n super(object, domElement);\n __publicField(this, \"mouseButtons\");\n __publicField(this, \"touches\");\n this.mouseButtons = {\n LEFT: three__WEBPACK_IMPORTED_MODULE_42__.MOUSE.PAN,\n RIGHT: three__WEBPACK_IMPORTED_MODULE_42__.MOUSE.ROTATE\n };\n this.touches = {\n ONE: three__WEBPACK_IMPORTED_MODULE_42__.TOUCH.PAN,\n TWO: three__WEBPACK_IMPORTED_MODULE_42__.TOUCH.DOLLY_ROTATE\n };\n }\n}\nclass TrackballControlsExp extends CameraControls {\n constructor(object, domElement) {\n super(object, domElement);\n __publicField(this, \"trackball\");\n __publicField(this, \"screenSpacePanning\");\n __publicField(this, \"autoRotate\");\n __publicField(this, \"mouseButtons\");\n __publicField(this, \"touches\");\n this.trackball = true;\n this.screenSpacePanning = true;\n this.autoRotate = false;\n this.mouseButtons = {\n LEFT: three__WEBPACK_IMPORTED_MODULE_42__.MOUSE.ROTATE,\n RIGHT: three__WEBPACK_IMPORTED_MODULE_42__.MOUSE.PAN\n };\n this.touches = {\n ONE: three__WEBPACK_IMPORTED_MODULE_42__.TOUCH.ROTATE,\n TWO: three__WEBPACK_IMPORTED_MODULE_42__.TOUCH.DOLLY_PAN\n };\n }\n}\nconst targetPosition = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nclass FirstPersonControls extends three__WEBPACK_IMPORTED_MODULE_42__.EventDispatcher {\n constructor(object, domElement) {\n super();\n __publicField(this, \"object\");\n __publicField(this, \"domElement\");\n __publicField(this, \"enabled\", true);\n __publicField(this, \"movementSpeed\", 1);\n __publicField(this, \"lookSpeed\", 5e-3);\n __publicField(this, \"lookVertical\", true);\n __publicField(this, \"autoForward\", false);\n __publicField(this, \"activeLook\", true);\n __publicField(this, \"heightSpeed\", false);\n __publicField(this, \"heightCoef\", 1);\n __publicField(this, \"heightMin\", 0);\n __publicField(this, \"heightMax\", 1);\n __publicField(this, \"constrainVertical\", false);\n __publicField(this, \"verticalMin\", 0);\n __publicField(this, \"verticalMax\", Math.PI);\n __publicField(this, \"mouseDragOn\", false);\n // internals\n __publicField(this, \"autoSpeedFactor\", 0);\n __publicField(this, \"mouseX\", 0);\n __publicField(this, \"mouseY\", 0);\n __publicField(this, \"moveForward\", false);\n __publicField(this, \"moveBackward\", false);\n __publicField(this, \"moveLeft\", false);\n __publicField(this, \"moveRight\", false);\n __publicField(this, \"moveUp\", false);\n __publicField(this, \"moveDown\", false);\n __publicField(this, \"viewHalfX\", 0);\n __publicField(this, \"viewHalfY\", 0);\n __publicField(this, \"lat\", 0);\n __publicField(this, \"lon\", 0);\n __publicField(this, \"lookDirection\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"spherical\", new three__WEBPACK_IMPORTED_MODULE_42__.Spherical());\n __publicField(this, \"target\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"connect\", (domElement) => {\n domElement.setAttribute(\"tabindex\", \"-1\");\n domElement.style.touchAction = \"none\";\n domElement.addEventListener(\"contextmenu\", this.contextmenu);\n domElement.addEventListener(\"mousemove\", this.onMouseMove);\n domElement.addEventListener(\"mousedown\", this.onMouseDown);\n domElement.addEventListener(\"mouseup\", this.onMouseUp);\n this.domElement = domElement;\n window.addEventListener(\"keydown\", this.onKeyDown);\n window.addEventListener(\"keyup\", this.onKeyUp);\n this.handleResize();\n });\n __publicField(this, \"dispose\", () => {\n var _a2, _b2, _c, _d;\n (_a2 = this.domElement) == null ? void 0 : _a2.removeEventListener(\"contextmenu\", this.contextmenu);\n (_b2 = this.domElement) == null ? void 0 : _b2.removeEventListener(\"mousedown\", this.onMouseDown);\n (_c = this.domElement) == null ? void 0 : _c.removeEventListener(\"mousemove\", this.onMouseMove);\n (_d = this.domElement) == null ? void 0 : _d.removeEventListener(\"mouseup\", this.onMouseUp);\n window.removeEventListener(\"keydown\", this.onKeyDown);\n window.removeEventListener(\"keyup\", this.onKeyUp);\n });\n __publicField(this, \"handleResize\", () => {\n if (this.domElement) {\n this.viewHalfX = this.domElement.offsetWidth / 2;\n this.viewHalfY = this.domElement.offsetHeight / 2;\n }\n });\n __publicField(this, \"onMouseDown\", (event) => {\n var _a2;\n (_a2 = this.domElement) == null ? void 0 : _a2.focus();\n if (this.activeLook) {\n switch (event.button) {\n case 0:\n this.moveForward = true;\n break;\n case 2:\n this.moveBackward = true;\n break;\n }\n }\n this.mouseDragOn = true;\n });\n __publicField(this, \"onMouseUp\", (event) => {\n if (this.activeLook) {\n switch (event.button) {\n case 0:\n this.moveForward = false;\n break;\n case 2:\n this.moveBackward = false;\n break;\n }\n }\n this.mouseDragOn = false;\n });\n __publicField(this, \"onMouseMove\", (event) => {\n if (this.domElement) {\n this.mouseX = event.pageX - this.domElement.offsetLeft - this.viewHalfX;\n this.mouseY = event.pageY - this.domElement.offsetTop - this.viewHalfY;\n }\n });\n __publicField(this, \"onKeyDown\", (event) => {\n switch (event.code) {\n case \"ArrowUp\":\n case \"KeyW\":\n this.moveForward = true;\n break;\n case \"ArrowLeft\":\n case \"KeyA\":\n this.moveLeft = true;\n break;\n case \"ArrowDown\":\n case \"KeyS\":\n this.moveBackward = true;\n break;\n case \"ArrowRight\":\n case \"KeyD\":\n this.moveRight = true;\n break;\n case \"KeyR\":\n this.moveUp = true;\n break;\n case \"KeyF\":\n this.moveDown = true;\n break;\n }\n });\n __publicField(this, \"onKeyUp\", (event) => {\n switch (event.code) {\n case \"ArrowUp\":\n case \"KeyW\":\n this.moveForward = false;\n break;\n case \"ArrowLeft\":\n case \"KeyA\":\n this.moveLeft = false;\n break;\n case \"ArrowDown\":\n case \"KeyS\":\n this.moveBackward = false;\n break;\n case \"ArrowRight\":\n case \"KeyD\":\n this.moveRight = false;\n break;\n case \"KeyR\":\n this.moveUp = false;\n break;\n case \"KeyF\":\n this.moveDown = false;\n break;\n }\n });\n __publicField(this, \"lookAt\", (x, y, z) => {\n if (x instanceof three__WEBPACK_IMPORTED_MODULE_42__.Vector3) {\n this.target.copy(x);\n } else if (y && z) {\n this.target.set(x, y, z);\n }\n this.object.lookAt(this.target);\n this.setOrientation();\n return this;\n });\n __publicField(this, \"update\", (delta) => {\n if (!this.enabled)\n return;\n if (this.heightSpeed) {\n const y = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.clamp(this.object.position.y, this.heightMin, this.heightMax);\n const heightDelta = y - this.heightMin;\n this.autoSpeedFactor = delta * (heightDelta * this.heightCoef);\n } else {\n this.autoSpeedFactor = 0;\n }\n const actualMoveSpeed = delta * this.movementSpeed;\n if (this.moveForward || this.autoForward && !this.moveBackward) {\n this.object.translateZ(-(actualMoveSpeed + this.autoSpeedFactor));\n }\n if (this.moveBackward)\n this.object.translateZ(actualMoveSpeed);\n if (this.moveLeft)\n this.object.translateX(-actualMoveSpeed);\n if (this.moveRight)\n this.object.translateX(actualMoveSpeed);\n if (this.moveUp)\n this.object.translateY(actualMoveSpeed);\n if (this.moveDown)\n this.object.translateY(-actualMoveSpeed);\n let actualLookSpeed = delta * this.lookSpeed;\n if (!this.activeLook) {\n actualLookSpeed = 0;\n }\n let verticalLookRatio = 1;\n if (this.constrainVertical) {\n verticalLookRatio = Math.PI / (this.verticalMax - this.verticalMin);\n }\n this.lon -= this.mouseX * actualLookSpeed;\n if (this.lookVertical)\n this.lat -= this.mouseY * actualLookSpeed * verticalLookRatio;\n this.lat = Math.max(-85, Math.min(85, this.lat));\n let phi = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.degToRad(90 - this.lat);\n const theta = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.degToRad(this.lon);\n if (this.constrainVertical) {\n phi = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.mapLinear(phi, 0, Math.PI, this.verticalMin, this.verticalMax);\n }\n const position = this.object.position;\n targetPosition.setFromSphericalCoords(1, phi, theta).add(position);\n this.object.lookAt(targetPosition);\n });\n __publicField(this, \"contextmenu\", (event) => event.preventDefault());\n __publicField(this, \"setOrientation\", () => {\n this.lookDirection.set(0, 0, -1).applyQuaternion(this.object.quaternion);\n this.spherical.setFromVector3(this.lookDirection);\n this.lat = 90 - three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.radToDeg(this.spherical.phi);\n this.lon = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.radToDeg(this.spherical.theta);\n });\n this.object = object;\n this.domElement = domElement;\n this.setOrientation();\n if (domElement)\n this.connect(domElement);\n }\n}\nclass TransformControls extends three__WEBPACK_IMPORTED_MODULE_42__.Object3D {\n constructor(camera, domElement) {\n super();\n __publicField(this, \"isTransformControls\", true);\n __publicField(this, \"visible\", false);\n __publicField(this, \"domElement\");\n __publicField(this, \"raycaster\", new three__WEBPACK_IMPORTED_MODULE_42__.Raycaster());\n __publicField(this, \"gizmo\");\n __publicField(this, \"plane\");\n __publicField(this, \"tempVector\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"tempVector2\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"tempQuaternion\", new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion());\n __publicField(this, \"unit\", {\n X: new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(1, 0, 0),\n Y: new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 1, 0),\n Z: new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 0, 1)\n });\n __publicField(this, \"pointStart\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"pointEnd\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"offset\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"rotationAxis\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"startNorm\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"endNorm\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"rotationAngle\", 0);\n __publicField(this, \"cameraPosition\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"cameraQuaternion\", new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion());\n __publicField(this, \"cameraScale\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"parentPosition\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"parentQuaternion\", new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion());\n __publicField(this, \"parentQuaternionInv\", new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion());\n __publicField(this, \"parentScale\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"worldPositionStart\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"worldQuaternionStart\", new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion());\n __publicField(this, \"worldScaleStart\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"worldPosition\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"worldQuaternion\", new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion());\n __publicField(this, \"worldQuaternionInv\", new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion());\n __publicField(this, \"worldScale\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"eye\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"positionStart\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"quaternionStart\", new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion());\n __publicField(this, \"scaleStart\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"camera\");\n __publicField(this, \"object\");\n __publicField(this, \"enabled\", true);\n __publicField(this, \"axis\", null);\n __publicField(this, \"mode\", \"translate\");\n __publicField(this, \"translationSnap\", null);\n __publicField(this, \"rotationSnap\", null);\n __publicField(this, \"scaleSnap\", null);\n __publicField(this, \"space\", \"world\");\n __publicField(this, \"size\", 1);\n __publicField(this, \"dragging\", false);\n __publicField(this, \"showX\", true);\n __publicField(this, \"showY\", true);\n __publicField(this, \"showZ\", true);\n // events\n __publicField(this, \"changeEvent\", { type: \"change\" });\n __publicField(this, \"mouseDownEvent\", { type: \"mouseDown\", mode: this.mode });\n __publicField(this, \"mouseUpEvent\", { type: \"mouseUp\", mode: this.mode });\n __publicField(this, \"objectChangeEvent\", { type: \"objectChange\" });\n __publicField(this, \"intersectObjectWithRay\", (object, raycaster, includeInvisible) => {\n const allIntersections = raycaster.intersectObject(object, true);\n for (let i2 = 0; i2 < allIntersections.length; i2++) {\n if (allIntersections[i2].object.visible || includeInvisible) {\n return allIntersections[i2];\n }\n }\n return false;\n });\n // Set current object\n __publicField(this, \"attach\", (object) => {\n this.object = object;\n this.visible = true;\n return this;\n });\n // Detatch from object\n __publicField(this, \"detach\", () => {\n this.object = void 0;\n this.visible = false;\n this.axis = null;\n return this;\n });\n // Reset\n __publicField(this, \"reset\", () => {\n if (!this.enabled)\n return this;\n if (this.dragging) {\n if (this.object !== void 0) {\n this.object.position.copy(this.positionStart);\n this.object.quaternion.copy(this.quaternionStart);\n this.object.scale.copy(this.scaleStart);\n this.dispatchEvent(this.changeEvent);\n this.dispatchEvent(this.objectChangeEvent);\n this.pointStart.copy(this.pointEnd);\n }\n }\n return this;\n });\n __publicField(this, \"updateMatrixWorld\", () => {\n if (this.object !== void 0) {\n this.object.updateMatrixWorld();\n if (this.object.parent === null) {\n console.error(\"TransformControls: The attached 3D object must be a part of the scene graph.\");\n } else {\n this.object.parent.matrixWorld.decompose(this.parentPosition, this.parentQuaternion, this.parentScale);\n }\n this.object.matrixWorld.decompose(this.worldPosition, this.worldQuaternion, this.worldScale);\n this.parentQuaternionInv.copy(this.parentQuaternion).invert();\n this.worldQuaternionInv.copy(this.worldQuaternion).invert();\n }\n this.camera.updateMatrixWorld();\n this.camera.matrixWorld.decompose(this.cameraPosition, this.cameraQuaternion, this.cameraScale);\n this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize();\n super.updateMatrixWorld();\n });\n __publicField(this, \"pointerHover\", (pointer) => {\n if (this.object === void 0 || this.dragging === true)\n return;\n this.raycaster.setFromCamera(pointer, this.camera);\n const intersect = this.intersectObjectWithRay(this.gizmo.picker[this.mode], this.raycaster);\n if (intersect) {\n this.axis = intersect.object.name;\n } else {\n this.axis = null;\n }\n });\n __publicField(this, \"pointerDown\", (pointer) => {\n if (this.object === void 0 || this.dragging === true || pointer.button !== 0)\n return;\n if (this.axis !== null) {\n this.raycaster.setFromCamera(pointer, this.camera);\n const planeIntersect = this.intersectObjectWithRay(this.plane, this.raycaster, true);\n if (planeIntersect) {\n let space = this.space;\n if (this.mode === \"scale\") {\n space = \"local\";\n } else if (this.axis === \"E\" || this.axis === \"XYZE\" || this.axis === \"XYZ\") {\n space = \"world\";\n }\n if (space === \"local\" && this.mode === \"rotate\") {\n const snap = this.rotationSnap;\n if (this.axis === \"X\" && snap)\n this.object.rotation.x = Math.round(this.object.rotation.x / snap) * snap;\n if (this.axis === \"Y\" && snap)\n this.object.rotation.y = Math.round(this.object.rotation.y / snap) * snap;\n if (this.axis === \"Z\" && snap)\n this.object.rotation.z = Math.round(this.object.rotation.z / snap) * snap;\n }\n this.object.updateMatrixWorld();\n if (this.object.parent) {\n this.object.parent.updateMatrixWorld();\n }\n this.positionStart.copy(this.object.position);\n this.quaternionStart.copy(this.object.quaternion);\n this.scaleStart.copy(this.object.scale);\n this.object.matrixWorld.decompose(this.worldPositionStart, this.worldQuaternionStart, this.worldScaleStart);\n this.pointStart.copy(planeIntersect.point).sub(this.worldPositionStart);\n }\n this.dragging = true;\n this.mouseDownEvent.mode = this.mode;\n this.dispatchEvent(this.mouseDownEvent);\n }\n });\n __publicField(this, \"pointerMove\", (pointer) => {\n const axis = this.axis;\n const mode = this.mode;\n const object = this.object;\n let space = this.space;\n if (mode === \"scale\") {\n space = \"local\";\n } else if (axis === \"E\" || axis === \"XYZE\" || axis === \"XYZ\") {\n space = \"world\";\n }\n if (object === void 0 || axis === null || this.dragging === false || pointer.button !== -1)\n return;\n this.raycaster.setFromCamera(pointer, this.camera);\n const planeIntersect = this.intersectObjectWithRay(this.plane, this.raycaster, true);\n if (!planeIntersect)\n return;\n this.pointEnd.copy(planeIntersect.point).sub(this.worldPositionStart);\n if (mode === \"translate\") {\n this.offset.copy(this.pointEnd).sub(this.pointStart);\n if (space === \"local\" && axis !== \"XYZ\") {\n this.offset.applyQuaternion(this.worldQuaternionInv);\n }\n if (axis.indexOf(\"X\") === -1)\n this.offset.x = 0;\n if (axis.indexOf(\"Y\") === -1)\n this.offset.y = 0;\n if (axis.indexOf(\"Z\") === -1)\n this.offset.z = 0;\n if (space === \"local\" && axis !== \"XYZ\") {\n this.offset.applyQuaternion(this.quaternionStart).divide(this.parentScale);\n } else {\n this.offset.applyQuaternion(this.parentQuaternionInv).divide(this.parentScale);\n }\n object.position.copy(this.offset).add(this.positionStart);\n if (this.translationSnap) {\n if (space === \"local\") {\n object.position.applyQuaternion(this.tempQuaternion.copy(this.quaternionStart).invert());\n if (axis.search(\"X\") !== -1) {\n object.position.x = Math.round(object.position.x / this.translationSnap) * this.translationSnap;\n }\n if (axis.search(\"Y\") !== -1) {\n object.position.y = Math.round(object.position.y / this.translationSnap) * this.translationSnap;\n }\n if (axis.search(\"Z\") !== -1) {\n object.position.z = Math.round(object.position.z / this.translationSnap) * this.translationSnap;\n }\n object.position.applyQuaternion(this.quaternionStart);\n }\n if (space === \"world\") {\n if (object.parent) {\n object.position.add(this.tempVector.setFromMatrixPosition(object.parent.matrixWorld));\n }\n if (axis.search(\"X\") !== -1) {\n object.position.x = Math.round(object.position.x / this.translationSnap) * this.translationSnap;\n }\n if (axis.search(\"Y\") !== -1) {\n object.position.y = Math.round(object.position.y / this.translationSnap) * this.translationSnap;\n }\n if (axis.search(\"Z\") !== -1) {\n object.position.z = Math.round(object.position.z / this.translationSnap) * this.translationSnap;\n }\n if (object.parent) {\n object.position.sub(this.tempVector.setFromMatrixPosition(object.parent.matrixWorld));\n }\n }\n }\n } else if (mode === \"scale\") {\n if (axis.search(\"XYZ\") !== -1) {\n let d = this.pointEnd.length() / this.pointStart.length();\n if (this.pointEnd.dot(this.pointStart) < 0)\n d *= -1;\n this.tempVector2.set(d, d, d);\n } else {\n this.tempVector.copy(this.pointStart);\n this.tempVector2.copy(this.pointEnd);\n this.tempVector.applyQuaternion(this.worldQuaternionInv);\n this.tempVector2.applyQuaternion(this.worldQuaternionInv);\n this.tempVector2.divide(this.tempVector);\n if (axis.search(\"X\") === -1) {\n this.tempVector2.x = 1;\n }\n if (axis.search(\"Y\") === -1) {\n this.tempVector2.y = 1;\n }\n if (axis.search(\"Z\") === -1) {\n this.tempVector2.z = 1;\n }\n }\n object.scale.copy(this.scaleStart).multiply(this.tempVector2);\n if (this.scaleSnap && this.object) {\n if (axis.search(\"X\") !== -1) {\n this.object.scale.x = Math.round(object.scale.x / this.scaleSnap) * this.scaleSnap || this.scaleSnap;\n }\n if (axis.search(\"Y\") !== -1) {\n object.scale.y = Math.round(object.scale.y / this.scaleSnap) * this.scaleSnap || this.scaleSnap;\n }\n if (axis.search(\"Z\") !== -1) {\n object.scale.z = Math.round(object.scale.z / this.scaleSnap) * this.scaleSnap || this.scaleSnap;\n }\n }\n } else if (mode === \"rotate\") {\n this.offset.copy(this.pointEnd).sub(this.pointStart);\n const ROTATION_SPEED = 20 / this.worldPosition.distanceTo(this.tempVector.setFromMatrixPosition(this.camera.matrixWorld));\n if (axis === \"E\") {\n this.rotationAxis.copy(this.eye);\n this.rotationAngle = this.pointEnd.angleTo(this.pointStart);\n this.startNorm.copy(this.pointStart).normalize();\n this.endNorm.copy(this.pointEnd).normalize();\n this.rotationAngle *= this.endNorm.cross(this.startNorm).dot(this.eye) < 0 ? 1 : -1;\n } else if (axis === \"XYZE\") {\n this.rotationAxis.copy(this.offset).cross(this.eye).normalize();\n this.rotationAngle = this.offset.dot(this.tempVector.copy(this.rotationAxis).cross(this.eye)) * ROTATION_SPEED;\n } else if (axis === \"X\" || axis === \"Y\" || axis === \"Z\") {\n this.rotationAxis.copy(this.unit[axis]);\n this.tempVector.copy(this.unit[axis]);\n if (space === \"local\") {\n this.tempVector.applyQuaternion(this.worldQuaternion);\n }\n this.rotationAngle = this.offset.dot(this.tempVector.cross(this.eye).normalize()) * ROTATION_SPEED;\n }\n if (this.rotationSnap) {\n this.rotationAngle = Math.round(this.rotationAngle / this.rotationSnap) * this.rotationSnap;\n }\n if (space === \"local\" && axis !== \"E\" && axis !== \"XYZE\") {\n object.quaternion.copy(this.quaternionStart);\n object.quaternion.multiply(this.tempQuaternion.setFromAxisAngle(this.rotationAxis, this.rotationAngle)).normalize();\n } else {\n this.rotationAxis.applyQuaternion(this.parentQuaternionInv);\n object.quaternion.copy(this.tempQuaternion.setFromAxisAngle(this.rotationAxis, this.rotationAngle));\n object.quaternion.multiply(this.quaternionStart).normalize();\n }\n }\n this.dispatchEvent(this.changeEvent);\n this.dispatchEvent(this.objectChangeEvent);\n });\n __publicField(this, \"pointerUp\", (pointer) => {\n if (pointer.button !== 0)\n return;\n if (this.dragging && this.axis !== null) {\n this.mouseUpEvent.mode = this.mode;\n this.dispatchEvent(this.mouseUpEvent);\n }\n this.dragging = false;\n this.axis = null;\n });\n __publicField(this, \"getPointer\", (event) => {\n var _a2, _b2;\n if (this.domElement && ((_a2 = this.domElement.ownerDocument) == null ? void 0 : _a2.pointerLockElement)) {\n return {\n x: 0,\n y: 0,\n button: event.button\n };\n } else {\n const pointer = event.changedTouches ? event.changedTouches[0] : event;\n const rect = (_b2 = this.domElement) == null ? void 0 : _b2.getBoundingClientRect();\n return {\n x: (pointer.clientX - rect.left) / rect.width * 2 - 1,\n y: -(pointer.clientY - rect.top) / rect.height * 2 + 1,\n button: event.button\n };\n }\n });\n __publicField(this, \"onPointerHover\", (event) => {\n if (!this.enabled)\n return;\n switch (event.pointerType) {\n case \"mouse\":\n case \"pen\":\n this.pointerHover(this.getPointer(event));\n break;\n }\n });\n __publicField(this, \"onPointerDown\", (event) => {\n if (!this.enabled || !this.domElement)\n return;\n this.domElement.style.touchAction = \"none\";\n this.domElement.ownerDocument.addEventListener(\"pointermove\", this.onPointerMove);\n this.pointerHover(this.getPointer(event));\n this.pointerDown(this.getPointer(event));\n });\n __publicField(this, \"onPointerMove\", (event) => {\n if (!this.enabled)\n return;\n this.pointerMove(this.getPointer(event));\n });\n __publicField(this, \"onPointerUp\", (event) => {\n if (!this.enabled || !this.domElement)\n return;\n this.domElement.style.touchAction = \"\";\n this.domElement.ownerDocument.removeEventListener(\"pointermove\", this.onPointerMove);\n this.pointerUp(this.getPointer(event));\n });\n __publicField(this, \"getMode\", () => this.mode);\n __publicField(this, \"setMode\", (mode) => {\n this.mode = mode;\n });\n __publicField(this, \"setTranslationSnap\", (translationSnap) => {\n this.translationSnap = translationSnap;\n });\n __publicField(this, \"setRotationSnap\", (rotationSnap) => {\n this.rotationSnap = rotationSnap;\n });\n __publicField(this, \"setScaleSnap\", (scaleSnap) => {\n this.scaleSnap = scaleSnap;\n });\n __publicField(this, \"setSize\", (size2) => {\n this.size = size2;\n });\n __publicField(this, \"setSpace\", (space) => {\n this.space = space;\n });\n __publicField(this, \"update\", () => {\n console.warn(\n \"THREE.TransformControls: update function has no more functionality and therefore has been deprecated.\"\n );\n });\n __publicField(this, \"connect\", (domElement) => {\n if (domElement === document) {\n console.error(\n 'THREE.OrbitControls: \"document\" should not be used as the target \"domElement\". Please use \"renderer.domElement\" instead.'\n );\n }\n this.domElement = domElement;\n this.domElement.addEventListener(\"pointerdown\", this.onPointerDown);\n this.domElement.addEventListener(\"pointermove\", this.onPointerHover);\n this.domElement.ownerDocument.addEventListener(\"pointerup\", this.onPointerUp);\n });\n __publicField(this, \"dispose\", () => {\n var _a2, _b2, _c, _d, _e, _f;\n (_a2 = this.domElement) == null ? void 0 : _a2.removeEventListener(\"pointerdown\", this.onPointerDown);\n (_b2 = this.domElement) == null ? void 0 : _b2.removeEventListener(\"pointermove\", this.onPointerHover);\n (_d = (_c = this.domElement) == null ? void 0 : _c.ownerDocument) == null ? void 0 : _d.removeEventListener(\"pointermove\", this.onPointerMove);\n (_f = (_e = this.domElement) == null ? void 0 : _e.ownerDocument) == null ? void 0 : _f.removeEventListener(\"pointerup\", this.onPointerUp);\n this.traverse((child) => {\n const mesh = child;\n if (mesh.geometry) {\n mesh.geometry.dispose();\n }\n if (mesh.material) {\n mesh.material.dispose();\n }\n });\n });\n this.domElement = domElement;\n this.camera = camera;\n this.gizmo = new TransformControlsGizmo();\n this.add(this.gizmo);\n this.plane = new TransformControlsPlane();\n this.add(this.plane);\n const defineProperty = (propName, defaultValue) => {\n let propValue = defaultValue;\n Object.defineProperty(this, propName, {\n get: function() {\n return propValue !== void 0 ? propValue : defaultValue;\n },\n set: function(value) {\n if (propValue !== value) {\n propValue = value;\n this.plane[propName] = value;\n this.gizmo[propName] = value;\n this.dispatchEvent({ type: propName + \"-changed\", value });\n this.dispatchEvent(this.changeEvent);\n }\n }\n });\n this[propName] = defaultValue;\n this.plane[propName] = defaultValue;\n this.gizmo[propName] = defaultValue;\n };\n defineProperty(\"camera\", this.camera);\n defineProperty(\"object\", this.object);\n defineProperty(\"enabled\", this.enabled);\n defineProperty(\"axis\", this.axis);\n defineProperty(\"mode\", this.mode);\n defineProperty(\"translationSnap\", this.translationSnap);\n defineProperty(\"rotationSnap\", this.rotationSnap);\n defineProperty(\"scaleSnap\", this.scaleSnap);\n defineProperty(\"space\", this.space);\n defineProperty(\"size\", this.size);\n defineProperty(\"dragging\", this.dragging);\n defineProperty(\"showX\", this.showX);\n defineProperty(\"showY\", this.showY);\n defineProperty(\"showZ\", this.showZ);\n defineProperty(\"worldPosition\", this.worldPosition);\n defineProperty(\"worldPositionStart\", this.worldPositionStart);\n defineProperty(\"worldQuaternion\", this.worldQuaternion);\n defineProperty(\"worldQuaternionStart\", this.worldQuaternionStart);\n defineProperty(\"cameraPosition\", this.cameraPosition);\n defineProperty(\"cameraQuaternion\", this.cameraQuaternion);\n defineProperty(\"pointStart\", this.pointStart);\n defineProperty(\"pointEnd\", this.pointEnd);\n defineProperty(\"rotationAxis\", this.rotationAxis);\n defineProperty(\"rotationAngle\", this.rotationAngle);\n defineProperty(\"eye\", this.eye);\n if (domElement !== void 0)\n this.connect(domElement);\n }\n}\nclass TransformControlsGizmo extends three__WEBPACK_IMPORTED_MODULE_42__.Object3D {\n constructor() {\n super();\n __publicField(this, \"isTransformControlsGizmo\", true);\n __publicField(this, \"type\", \"TransformControlsGizmo\");\n __publicField(this, \"tempVector\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 0, 0));\n __publicField(this, \"tempEuler\", new three__WEBPACK_IMPORTED_MODULE_42__.Euler());\n __publicField(this, \"alignVector\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 1, 0));\n __publicField(this, \"zeroVector\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 0, 0));\n __publicField(this, \"lookAtMatrix\", new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4());\n __publicField(this, \"tempQuaternion\", new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion());\n __publicField(this, \"tempQuaternion2\", new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion());\n __publicField(this, \"identityQuaternion\", new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion());\n __publicField(this, \"unitX\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(1, 0, 0));\n __publicField(this, \"unitY\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 1, 0));\n __publicField(this, \"unitZ\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 0, 1));\n __publicField(this, \"gizmo\");\n __publicField(this, \"picker\");\n __publicField(this, \"helper\");\n // these are set from parent class TransformControls\n __publicField(this, \"rotationAxis\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"cameraPosition\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"worldPositionStart\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"worldQuaternionStart\", new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion());\n __publicField(this, \"worldPosition\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"worldQuaternion\", new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion());\n __publicField(this, \"eye\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"camera\", null);\n __publicField(this, \"enabled\", true);\n __publicField(this, \"axis\", null);\n __publicField(this, \"mode\", \"translate\");\n __publicField(this, \"space\", \"world\");\n __publicField(this, \"size\", 1);\n __publicField(this, \"dragging\", false);\n __publicField(this, \"showX\", true);\n __publicField(this, \"showY\", true);\n __publicField(this, \"showZ\", true);\n // updateMatrixWorld will update transformations and appearance of individual handles\n __publicField(this, \"updateMatrixWorld\", () => {\n let space = this.space;\n if (this.mode === \"scale\") {\n space = \"local\";\n }\n const quaternion = space === \"local\" ? this.worldQuaternion : this.identityQuaternion;\n this.gizmo[\"translate\"].visible = this.mode === \"translate\";\n this.gizmo[\"rotate\"].visible = this.mode === \"rotate\";\n this.gizmo[\"scale\"].visible = this.mode === \"scale\";\n this.helper[\"translate\"].visible = this.mode === \"translate\";\n this.helper[\"rotate\"].visible = this.mode === \"rotate\";\n this.helper[\"scale\"].visible = this.mode === \"scale\";\n let handles = [];\n handles = handles.concat(this.picker[this.mode].children);\n handles = handles.concat(this.gizmo[this.mode].children);\n handles = handles.concat(this.helper[this.mode].children);\n for (let i2 = 0; i2 < handles.length; i2++) {\n const handle = handles[i2];\n handle.visible = true;\n handle.rotation.set(0, 0, 0);\n handle.position.copy(this.worldPosition);\n let factor;\n if (this.camera.isOrthographicCamera) {\n factor = (this.camera.top - this.camera.bottom) / this.camera.zoom;\n } else {\n factor = this.worldPosition.distanceTo(this.cameraPosition) * Math.min(1.9 * Math.tan(Math.PI * this.camera.fov / 360) / this.camera.zoom, 7);\n }\n handle.scale.set(1, 1, 1).multiplyScalar(factor * this.size / 7);\n if (handle.tag === \"helper\") {\n handle.visible = false;\n if (handle.name === \"AXIS\") {\n handle.position.copy(this.worldPositionStart);\n handle.visible = !!this.axis;\n if (this.axis === \"X\") {\n this.tempQuaternion.setFromEuler(this.tempEuler.set(0, 0, 0));\n handle.quaternion.copy(quaternion).multiply(this.tempQuaternion);\n if (Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(quaternion).dot(this.eye)) > 0.9) {\n handle.visible = false;\n }\n }\n if (this.axis === \"Y\") {\n this.tempQuaternion.setFromEuler(this.tempEuler.set(0, 0, Math.PI / 2));\n handle.quaternion.copy(quaternion).multiply(this.tempQuaternion);\n if (Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(quaternion).dot(this.eye)) > 0.9) {\n handle.visible = false;\n }\n }\n if (this.axis === \"Z\") {\n this.tempQuaternion.setFromEuler(this.tempEuler.set(0, Math.PI / 2, 0));\n handle.quaternion.copy(quaternion).multiply(this.tempQuaternion);\n if (Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(quaternion).dot(this.eye)) > 0.9) {\n handle.visible = false;\n }\n }\n if (this.axis === \"XYZE\") {\n this.tempQuaternion.setFromEuler(this.tempEuler.set(0, Math.PI / 2, 0));\n this.alignVector.copy(this.rotationAxis);\n handle.quaternion.setFromRotationMatrix(\n this.lookAtMatrix.lookAt(this.zeroVector, this.alignVector, this.unitY)\n );\n handle.quaternion.multiply(this.tempQuaternion);\n handle.visible = this.dragging;\n }\n if (this.axis === \"E\") {\n handle.visible = false;\n }\n } else if (handle.name === \"START\") {\n handle.position.copy(this.worldPositionStart);\n handle.visible = this.dragging;\n } else if (handle.name === \"END\") {\n handle.position.copy(this.worldPosition);\n handle.visible = this.dragging;\n } else if (handle.name === \"DELTA\") {\n handle.position.copy(this.worldPositionStart);\n handle.quaternion.copy(this.worldQuaternionStart);\n this.tempVector.set(1e-10, 1e-10, 1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1);\n this.tempVector.applyQuaternion(this.worldQuaternionStart.clone().invert());\n handle.scale.copy(this.tempVector);\n handle.visible = this.dragging;\n } else {\n handle.quaternion.copy(quaternion);\n if (this.dragging) {\n handle.position.copy(this.worldPositionStart);\n } else {\n handle.position.copy(this.worldPosition);\n }\n if (this.axis) {\n handle.visible = this.axis.search(handle.name) !== -1;\n }\n }\n continue;\n }\n handle.quaternion.copy(quaternion);\n if (this.mode === \"translate\" || this.mode === \"scale\") {\n const AXIS_HIDE_TRESHOLD = 0.99;\n const PLANE_HIDE_TRESHOLD = 0.2;\n const AXIS_FLIP_TRESHOLD = 0;\n if (handle.name === \"X\" || handle.name === \"XYZX\") {\n if (Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(quaternion).dot(this.eye)) > AXIS_HIDE_TRESHOLD) {\n handle.scale.set(1e-10, 1e-10, 1e-10);\n handle.visible = false;\n }\n }\n if (handle.name === \"Y\" || handle.name === \"XYZY\") {\n if (Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(quaternion).dot(this.eye)) > AXIS_HIDE_TRESHOLD) {\n handle.scale.set(1e-10, 1e-10, 1e-10);\n handle.visible = false;\n }\n }\n if (handle.name === \"Z\" || handle.name === \"XYZZ\") {\n if (Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(quaternion).dot(this.eye)) > AXIS_HIDE_TRESHOLD) {\n handle.scale.set(1e-10, 1e-10, 1e-10);\n handle.visible = false;\n }\n }\n if (handle.name === \"XY\") {\n if (Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(quaternion).dot(this.eye)) < PLANE_HIDE_TRESHOLD) {\n handle.scale.set(1e-10, 1e-10, 1e-10);\n handle.visible = false;\n }\n }\n if (handle.name === \"YZ\") {\n if (Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(quaternion).dot(this.eye)) < PLANE_HIDE_TRESHOLD) {\n handle.scale.set(1e-10, 1e-10, 1e-10);\n handle.visible = false;\n }\n }\n if (handle.name === \"XZ\") {\n if (Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(quaternion).dot(this.eye)) < PLANE_HIDE_TRESHOLD) {\n handle.scale.set(1e-10, 1e-10, 1e-10);\n handle.visible = false;\n }\n }\n if (handle.name.search(\"X\") !== -1) {\n if (this.alignVector.copy(this.unitX).applyQuaternion(quaternion).dot(this.eye) < AXIS_FLIP_TRESHOLD) {\n if (handle.tag === \"fwd\") {\n handle.visible = false;\n } else {\n handle.scale.x *= -1;\n }\n } else if (handle.tag === \"bwd\") {\n handle.visible = false;\n }\n }\n if (handle.name.search(\"Y\") !== -1) {\n if (this.alignVector.copy(this.unitY).applyQuaternion(quaternion).dot(this.eye) < AXIS_FLIP_TRESHOLD) {\n if (handle.tag === \"fwd\") {\n handle.visible = false;\n } else {\n handle.scale.y *= -1;\n }\n } else if (handle.tag === \"bwd\") {\n handle.visible = false;\n }\n }\n if (handle.name.search(\"Z\") !== -1) {\n if (this.alignVector.copy(this.unitZ).applyQuaternion(quaternion).dot(this.eye) < AXIS_FLIP_TRESHOLD) {\n if (handle.tag === \"fwd\") {\n handle.visible = false;\n } else {\n handle.scale.z *= -1;\n }\n } else if (handle.tag === \"bwd\") {\n handle.visible = false;\n }\n }\n } else if (this.mode === \"rotate\") {\n this.tempQuaternion2.copy(quaternion);\n this.alignVector.copy(this.eye).applyQuaternion(this.tempQuaternion.copy(quaternion).invert());\n if (handle.name.search(\"E\") !== -1) {\n handle.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.eye, this.zeroVector, this.unitY));\n }\n if (handle.name === \"X\") {\n this.tempQuaternion.setFromAxisAngle(this.unitX, Math.atan2(-this.alignVector.y, this.alignVector.z));\n this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2, this.tempQuaternion);\n handle.quaternion.copy(this.tempQuaternion);\n }\n if (handle.name === \"Y\") {\n this.tempQuaternion.setFromAxisAngle(this.unitY, Math.atan2(this.alignVector.x, this.alignVector.z));\n this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2, this.tempQuaternion);\n handle.quaternion.copy(this.tempQuaternion);\n }\n if (handle.name === \"Z\") {\n this.tempQuaternion.setFromAxisAngle(this.unitZ, Math.atan2(this.alignVector.y, this.alignVector.x));\n this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2, this.tempQuaternion);\n handle.quaternion.copy(this.tempQuaternion);\n }\n }\n handle.visible = handle.visible && (handle.name.indexOf(\"X\") === -1 || this.showX);\n handle.visible = handle.visible && (handle.name.indexOf(\"Y\") === -1 || this.showY);\n handle.visible = handle.visible && (handle.name.indexOf(\"Z\") === -1 || this.showZ);\n handle.visible = handle.visible && (handle.name.indexOf(\"E\") === -1 || this.showX && this.showY && this.showZ);\n handle.material.tempOpacity = handle.material.tempOpacity || handle.material.opacity;\n handle.material.tempColor = handle.material.tempColor || handle.material.color.clone();\n handle.material.color.copy(handle.material.tempColor);\n handle.material.opacity = handle.material.tempOpacity;\n if (!this.enabled) {\n handle.material.opacity *= 0.5;\n handle.material.color.lerp(new three__WEBPACK_IMPORTED_MODULE_42__.Color(1, 1, 1), 0.5);\n } else if (this.axis) {\n if (handle.name === this.axis) {\n handle.material.opacity = 1;\n handle.material.color.lerp(new three__WEBPACK_IMPORTED_MODULE_42__.Color(1, 1, 1), 0.5);\n } else if (this.axis.split(\"\").some(function(a2) {\n return handle.name === a2;\n })) {\n handle.material.opacity = 1;\n handle.material.color.lerp(new three__WEBPACK_IMPORTED_MODULE_42__.Color(1, 1, 1), 0.5);\n } else {\n handle.material.opacity *= 0.25;\n handle.material.color.lerp(new three__WEBPACK_IMPORTED_MODULE_42__.Color(1, 1, 1), 0.5);\n }\n }\n }\n super.updateMatrixWorld();\n });\n const gizmoMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.MeshBasicMaterial({\n depthTest: false,\n depthWrite: false,\n transparent: true,\n side: three__WEBPACK_IMPORTED_MODULE_42__.DoubleSide,\n fog: false,\n toneMapped: false\n });\n const gizmoLineMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.LineBasicMaterial({\n depthTest: false,\n depthWrite: false,\n transparent: true,\n linewidth: 1,\n fog: false,\n toneMapped: false\n });\n const matInvisible = gizmoMaterial.clone();\n matInvisible.opacity = 0.15;\n const matHelper = gizmoMaterial.clone();\n matHelper.opacity = 0.33;\n const matRed = gizmoMaterial.clone();\n matRed.color.set(16711680);\n const matGreen = gizmoMaterial.clone();\n matGreen.color.set(65280);\n const matBlue = gizmoMaterial.clone();\n matBlue.color.set(255);\n const matWhiteTransparent = gizmoMaterial.clone();\n matWhiteTransparent.opacity = 0.25;\n const matYellowTransparent = matWhiteTransparent.clone();\n matYellowTransparent.color.set(16776960);\n const matCyanTransparent = matWhiteTransparent.clone();\n matCyanTransparent.color.set(65535);\n const matMagentaTransparent = matWhiteTransparent.clone();\n matMagentaTransparent.color.set(16711935);\n const matYellow = gizmoMaterial.clone();\n matYellow.color.set(16776960);\n const matLineRed = gizmoLineMaterial.clone();\n matLineRed.color.set(16711680);\n const matLineGreen = gizmoLineMaterial.clone();\n matLineGreen.color.set(65280);\n const matLineBlue = gizmoLineMaterial.clone();\n matLineBlue.color.set(255);\n const matLineCyan = gizmoLineMaterial.clone();\n matLineCyan.color.set(65535);\n const matLineMagenta = gizmoLineMaterial.clone();\n matLineMagenta.color.set(16711935);\n const matLineYellow = gizmoLineMaterial.clone();\n matLineYellow.color.set(16776960);\n const matLineGray = gizmoLineMaterial.clone();\n matLineGray.color.set(7895160);\n const matLineYellowTransparent = matLineYellow.clone();\n matLineYellowTransparent.opacity = 0.25;\n const arrowGeometry = new three__WEBPACK_IMPORTED_MODULE_42__.CylinderGeometry(0, 0.05, 0.2, 12, 1, false);\n const scaleHandleGeometry = new three__WEBPACK_IMPORTED_MODULE_42__.BoxGeometry(0.125, 0.125, 0.125);\n const lineGeometry = new three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry();\n lineGeometry.setAttribute(\"position\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute([0, 0, 0, 1, 0, 0], 3));\n const CircleGeometry = (radius, arc) => {\n const geometry2 = new three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry();\n const vertices = [];\n for (let i2 = 0; i2 <= 64 * arc; ++i2) {\n vertices.push(0, Math.cos(i2 / 32 * Math.PI) * radius, Math.sin(i2 / 32 * Math.PI) * radius);\n }\n geometry2.setAttribute(\"position\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(vertices, 3));\n return geometry2;\n };\n const TranslateHelperGeometry = () => {\n const geometry2 = new three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry();\n geometry2.setAttribute(\"position\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute([0, 0, 0, 1, 1, 1], 3));\n return geometry2;\n };\n const gizmoTranslate = {\n X: [\n [new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(arrowGeometry, matRed), [1, 0, 0], [0, 0, -Math.PI / 2], null, \"fwd\"],\n [new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(arrowGeometry, matRed), [1, 0, 0], [0, 0, Math.PI / 2], null, \"bwd\"],\n [new three__WEBPACK_IMPORTED_MODULE_42__.Line(lineGeometry, matLineRed)]\n ],\n Y: [\n [new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(arrowGeometry, matGreen), [0, 1, 0], null, null, \"fwd\"],\n [new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(arrowGeometry, matGreen), [0, 1, 0], [Math.PI, 0, 0], null, \"bwd\"],\n [new three__WEBPACK_IMPORTED_MODULE_42__.Line(lineGeometry, matLineGreen), null, [0, 0, Math.PI / 2]]\n ],\n Z: [\n [new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(arrowGeometry, matBlue), [0, 0, 1], [Math.PI / 2, 0, 0], null, \"fwd\"],\n [new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(arrowGeometry, matBlue), [0, 0, 1], [-Math.PI / 2, 0, 0], null, \"bwd\"],\n [new three__WEBPACK_IMPORTED_MODULE_42__.Line(lineGeometry, matLineBlue), null, [0, -Math.PI / 2, 0]]\n ],\n XYZ: [[new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.OctahedronGeometry(0.1, 0), matWhiteTransparent.clone()), [0, 0, 0], [0, 0, 0]]],\n XY: [\n [new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.PlaneGeometry(0.295, 0.295), matYellowTransparent.clone()), [0.15, 0.15, 0]],\n [new three__WEBPACK_IMPORTED_MODULE_42__.Line(lineGeometry, matLineYellow), [0.18, 0.3, 0], null, [0.125, 1, 1]],\n [new three__WEBPACK_IMPORTED_MODULE_42__.Line(lineGeometry, matLineYellow), [0.3, 0.18, 0], [0, 0, Math.PI / 2], [0.125, 1, 1]]\n ],\n YZ: [\n [new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.PlaneGeometry(0.295, 0.295), matCyanTransparent.clone()), [0, 0.15, 0.15], [0, Math.PI / 2, 0]],\n [new three__WEBPACK_IMPORTED_MODULE_42__.Line(lineGeometry, matLineCyan), [0, 0.18, 0.3], [0, 0, Math.PI / 2], [0.125, 1, 1]],\n [new three__WEBPACK_IMPORTED_MODULE_42__.Line(lineGeometry, matLineCyan), [0, 0.3, 0.18], [0, -Math.PI / 2, 0], [0.125, 1, 1]]\n ],\n XZ: [\n [\n new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.PlaneGeometry(0.295, 0.295), matMagentaTransparent.clone()),\n [0.15, 0, 0.15],\n [-Math.PI / 2, 0, 0]\n ],\n [new three__WEBPACK_IMPORTED_MODULE_42__.Line(lineGeometry, matLineMagenta), [0.18, 0, 0.3], null, [0.125, 1, 1]],\n [new three__WEBPACK_IMPORTED_MODULE_42__.Line(lineGeometry, matLineMagenta), [0.3, 0, 0.18], [0, -Math.PI / 2, 0], [0.125, 1, 1]]\n ]\n };\n const pickerTranslate = {\n X: [[new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.CylinderGeometry(0.2, 0, 1, 4, 1, false), matInvisible), [0.6, 0, 0], [0, 0, -Math.PI / 2]]],\n Y: [[new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.CylinderGeometry(0.2, 0, 1, 4, 1, false), matInvisible), [0, 0.6, 0]]],\n Z: [[new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.CylinderGeometry(0.2, 0, 1, 4, 1, false), matInvisible), [0, 0, 0.6], [Math.PI / 2, 0, 0]]],\n XYZ: [[new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.OctahedronGeometry(0.2, 0), matInvisible)]],\n XY: [[new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.PlaneGeometry(0.4, 0.4), matInvisible), [0.2, 0.2, 0]]],\n YZ: [[new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.PlaneGeometry(0.4, 0.4), matInvisible), [0, 0.2, 0.2], [0, Math.PI / 2, 0]]],\n XZ: [[new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.PlaneGeometry(0.4, 0.4), matInvisible), [0.2, 0, 0.2], [-Math.PI / 2, 0, 0]]]\n };\n const helperTranslate = {\n START: [[new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.OctahedronGeometry(0.01, 2), matHelper), null, null, null, \"helper\"]],\n END: [[new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.OctahedronGeometry(0.01, 2), matHelper), null, null, null, \"helper\"]],\n DELTA: [[new three__WEBPACK_IMPORTED_MODULE_42__.Line(TranslateHelperGeometry(), matHelper), null, null, null, \"helper\"]],\n X: [[new three__WEBPACK_IMPORTED_MODULE_42__.Line(lineGeometry, matHelper.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], \"helper\"]],\n Y: [[new three__WEBPACK_IMPORTED_MODULE_42__.Line(lineGeometry, matHelper.clone()), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], \"helper\"]],\n Z: [[new three__WEBPACK_IMPORTED_MODULE_42__.Line(lineGeometry, matHelper.clone()), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], \"helper\"]]\n };\n const gizmoRotate = {\n X: [\n [new three__WEBPACK_IMPORTED_MODULE_42__.Line(CircleGeometry(1, 0.5), matLineRed)],\n [new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.OctahedronGeometry(0.04, 0), matRed), [0, 0, 0.99], null, [1, 3, 1]]\n ],\n Y: [\n [new three__WEBPACK_IMPORTED_MODULE_42__.Line(CircleGeometry(1, 0.5), matLineGreen), null, [0, 0, -Math.PI / 2]],\n [new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.OctahedronGeometry(0.04, 0), matGreen), [0, 0, 0.99], null, [3, 1, 1]]\n ],\n Z: [\n [new three__WEBPACK_IMPORTED_MODULE_42__.Line(CircleGeometry(1, 0.5), matLineBlue), null, [0, Math.PI / 2, 0]],\n [new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.OctahedronGeometry(0.04, 0), matBlue), [0.99, 0, 0], null, [1, 3, 1]]\n ],\n E: [\n [new three__WEBPACK_IMPORTED_MODULE_42__.Line(CircleGeometry(1.25, 1), matLineYellowTransparent), null, [0, Math.PI / 2, 0]],\n [\n new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.CylinderGeometry(0.03, 0, 0.15, 4, 1, false), matLineYellowTransparent),\n [1.17, 0, 0],\n [0, 0, -Math.PI / 2],\n [1, 1, 1e-3]\n ],\n [\n new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.CylinderGeometry(0.03, 0, 0.15, 4, 1, false), matLineYellowTransparent),\n [-1.17, 0, 0],\n [0, 0, Math.PI / 2],\n [1, 1, 1e-3]\n ],\n [\n new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.CylinderGeometry(0.03, 0, 0.15, 4, 1, false), matLineYellowTransparent),\n [0, -1.17, 0],\n [Math.PI, 0, 0],\n [1, 1, 1e-3]\n ],\n [\n new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.CylinderGeometry(0.03, 0, 0.15, 4, 1, false), matLineYellowTransparent),\n [0, 1.17, 0],\n [0, 0, 0],\n [1, 1, 1e-3]\n ]\n ],\n XYZE: [[new three__WEBPACK_IMPORTED_MODULE_42__.Line(CircleGeometry(1, 1), matLineGray), null, [0, Math.PI / 2, 0]]]\n };\n const helperRotate = {\n AXIS: [[new three__WEBPACK_IMPORTED_MODULE_42__.Line(lineGeometry, matHelper.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], \"helper\"]]\n };\n const pickerRotate = {\n X: [[new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.TorusGeometry(1, 0.1, 4, 24), matInvisible), [0, 0, 0], [0, -Math.PI / 2, -Math.PI / 2]]],\n Y: [[new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.TorusGeometry(1, 0.1, 4, 24), matInvisible), [0, 0, 0], [Math.PI / 2, 0, 0]]],\n Z: [[new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.TorusGeometry(1, 0.1, 4, 24), matInvisible), [0, 0, 0], [0, 0, -Math.PI / 2]]],\n E: [[new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.TorusGeometry(1.25, 0.1, 2, 24), matInvisible)]],\n XYZE: [[new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.SphereGeometry(0.7, 10, 8), matInvisible)]]\n };\n const gizmoScale = {\n X: [\n [new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(scaleHandleGeometry, matRed), [0.8, 0, 0], [0, 0, -Math.PI / 2]],\n [new three__WEBPACK_IMPORTED_MODULE_42__.Line(lineGeometry, matLineRed), null, null, [0.8, 1, 1]]\n ],\n Y: [\n [new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(scaleHandleGeometry, matGreen), [0, 0.8, 0]],\n [new three__WEBPACK_IMPORTED_MODULE_42__.Line(lineGeometry, matLineGreen), null, [0, 0, Math.PI / 2], [0.8, 1, 1]]\n ],\n Z: [\n [new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(scaleHandleGeometry, matBlue), [0, 0, 0.8], [Math.PI / 2, 0, 0]],\n [new three__WEBPACK_IMPORTED_MODULE_42__.Line(lineGeometry, matLineBlue), null, [0, -Math.PI / 2, 0], [0.8, 1, 1]]\n ],\n XY: [\n [new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(scaleHandleGeometry, matYellowTransparent), [0.85, 0.85, 0], null, [2, 2, 0.2]],\n [new three__WEBPACK_IMPORTED_MODULE_42__.Line(lineGeometry, matLineYellow), [0.855, 0.98, 0], null, [0.125, 1, 1]],\n [new three__WEBPACK_IMPORTED_MODULE_42__.Line(lineGeometry, matLineYellow), [0.98, 0.855, 0], [0, 0, Math.PI / 2], [0.125, 1, 1]]\n ],\n YZ: [\n [new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(scaleHandleGeometry, matCyanTransparent), [0, 0.85, 0.85], null, [0.2, 2, 2]],\n [new three__WEBPACK_IMPORTED_MODULE_42__.Line(lineGeometry, matLineCyan), [0, 0.855, 0.98], [0, 0, Math.PI / 2], [0.125, 1, 1]],\n [new three__WEBPACK_IMPORTED_MODULE_42__.Line(lineGeometry, matLineCyan), [0, 0.98, 0.855], [0, -Math.PI / 2, 0], [0.125, 1, 1]]\n ],\n XZ: [\n [new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(scaleHandleGeometry, matMagentaTransparent), [0.85, 0, 0.85], null, [2, 0.2, 2]],\n [new three__WEBPACK_IMPORTED_MODULE_42__.Line(lineGeometry, matLineMagenta), [0.855, 0, 0.98], null, [0.125, 1, 1]],\n [new three__WEBPACK_IMPORTED_MODULE_42__.Line(lineGeometry, matLineMagenta), [0.98, 0, 0.855], [0, -Math.PI / 2, 0], [0.125, 1, 1]]\n ],\n XYZX: [[new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.BoxGeometry(0.125, 0.125, 0.125), matWhiteTransparent.clone()), [1.1, 0, 0]]],\n XYZY: [[new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.BoxGeometry(0.125, 0.125, 0.125), matWhiteTransparent.clone()), [0, 1.1, 0]]],\n XYZZ: [[new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.BoxGeometry(0.125, 0.125, 0.125), matWhiteTransparent.clone()), [0, 0, 1.1]]]\n };\n const pickerScale = {\n X: [[new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.CylinderGeometry(0.2, 0, 0.8, 4, 1, false), matInvisible), [0.5, 0, 0], [0, 0, -Math.PI / 2]]],\n Y: [[new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.CylinderGeometry(0.2, 0, 0.8, 4, 1, false), matInvisible), [0, 0.5, 0]]],\n Z: [[new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.CylinderGeometry(0.2, 0, 0.8, 4, 1, false), matInvisible), [0, 0, 0.5], [Math.PI / 2, 0, 0]]],\n XY: [[new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(scaleHandleGeometry, matInvisible), [0.85, 0.85, 0], null, [3, 3, 0.2]]],\n YZ: [[new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(scaleHandleGeometry, matInvisible), [0, 0.85, 0.85], null, [0.2, 3, 3]]],\n XZ: [[new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(scaleHandleGeometry, matInvisible), [0.85, 0, 0.85], null, [3, 0.2, 3]]],\n XYZX: [[new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.BoxGeometry(0.2, 0.2, 0.2), matInvisible), [1.1, 0, 0]]],\n XYZY: [[new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.BoxGeometry(0.2, 0.2, 0.2), matInvisible), [0, 1.1, 0]]],\n XYZZ: [[new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.BoxGeometry(0.2, 0.2, 0.2), matInvisible), [0, 0, 1.1]]]\n };\n const helperScale = {\n X: [[new three__WEBPACK_IMPORTED_MODULE_42__.Line(lineGeometry, matHelper.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], \"helper\"]],\n Y: [[new three__WEBPACK_IMPORTED_MODULE_42__.Line(lineGeometry, matHelper.clone()), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], \"helper\"]],\n Z: [[new three__WEBPACK_IMPORTED_MODULE_42__.Line(lineGeometry, matHelper.clone()), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], \"helper\"]]\n };\n const setupGizmo = (gizmoMap) => {\n const gizmo = new three__WEBPACK_IMPORTED_MODULE_42__.Object3D();\n for (let name in gizmoMap) {\n for (let i2 = gizmoMap[name].length; i2--; ) {\n const object = gizmoMap[name][i2][0].clone();\n const position = gizmoMap[name][i2][1];\n const rotation = gizmoMap[name][i2][2];\n const scale = gizmoMap[name][i2][3];\n const tag = gizmoMap[name][i2][4];\n object.name = name;\n object.tag = tag;\n if (position) {\n object.position.set(position[0], position[1], position[2]);\n }\n if (rotation) {\n object.rotation.set(rotation[0], rotation[1], rotation[2]);\n }\n if (scale) {\n object.scale.set(scale[0], scale[1], scale[2]);\n }\n object.updateMatrix();\n const tempGeometry = object.geometry.clone();\n tempGeometry.applyMatrix4(object.matrix);\n object.geometry = tempGeometry;\n object.renderOrder = Infinity;\n object.position.set(0, 0, 0);\n object.rotation.set(0, 0, 0);\n object.scale.set(1, 1, 1);\n gizmo.add(object);\n }\n }\n return gizmo;\n };\n this.gizmo = {};\n this.picker = {};\n this.helper = {};\n this.add(this.gizmo[\"translate\"] = setupGizmo(gizmoTranslate));\n this.add(this.gizmo[\"rotate\"] = setupGizmo(gizmoRotate));\n this.add(this.gizmo[\"scale\"] = setupGizmo(gizmoScale));\n this.add(this.picker[\"translate\"] = setupGizmo(pickerTranslate));\n this.add(this.picker[\"rotate\"] = setupGizmo(pickerRotate));\n this.add(this.picker[\"scale\"] = setupGizmo(pickerScale));\n this.add(this.helper[\"translate\"] = setupGizmo(helperTranslate));\n this.add(this.helper[\"rotate\"] = setupGizmo(helperRotate));\n this.add(this.helper[\"scale\"] = setupGizmo(helperScale));\n this.picker[\"translate\"].visible = false;\n this.picker[\"rotate\"].visible = false;\n this.picker[\"scale\"].visible = false;\n }\n}\nclass TransformControlsPlane extends three__WEBPACK_IMPORTED_MODULE_42__.Mesh {\n constructor() {\n super(\n new three__WEBPACK_IMPORTED_MODULE_42__.PlaneGeometry(1e5, 1e5, 2, 2),\n new three__WEBPACK_IMPORTED_MODULE_42__.MeshBasicMaterial({\n visible: false,\n wireframe: true,\n side: three__WEBPACK_IMPORTED_MODULE_42__.DoubleSide,\n transparent: true,\n opacity: 0.1,\n toneMapped: false\n })\n );\n __publicField(this, \"isTransformControlsPlane\", true);\n __publicField(this, \"type\", \"TransformControlsPlane\");\n __publicField(this, \"unitX\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(1, 0, 0));\n __publicField(this, \"unitY\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 1, 0));\n __publicField(this, \"unitZ\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 0, 1));\n __publicField(this, \"tempVector\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"dirVector\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"alignVector\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"tempMatrix\", new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4());\n __publicField(this, \"identityQuaternion\", new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion());\n // these are set from parent class TransformControls\n __publicField(this, \"cameraQuaternion\", new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion());\n __publicField(this, \"worldPosition\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"worldQuaternion\", new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion());\n __publicField(this, \"eye\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"axis\", null);\n __publicField(this, \"mode\", \"translate\");\n __publicField(this, \"space\", \"world\");\n __publicField(this, \"updateMatrixWorld\", () => {\n let space = this.space;\n this.position.copy(this.worldPosition);\n if (this.mode === \"scale\")\n space = \"local\";\n this.unitX.set(1, 0, 0).applyQuaternion(space === \"local\" ? this.worldQuaternion : this.identityQuaternion);\n this.unitY.set(0, 1, 0).applyQuaternion(space === \"local\" ? this.worldQuaternion : this.identityQuaternion);\n this.unitZ.set(0, 0, 1).applyQuaternion(space === \"local\" ? this.worldQuaternion : this.identityQuaternion);\n this.alignVector.copy(this.unitY);\n switch (this.mode) {\n case \"translate\":\n case \"scale\":\n switch (this.axis) {\n case \"X\":\n this.alignVector.copy(this.eye).cross(this.unitX);\n this.dirVector.copy(this.unitX).cross(this.alignVector);\n break;\n case \"Y\":\n this.alignVector.copy(this.eye).cross(this.unitY);\n this.dirVector.copy(this.unitY).cross(this.alignVector);\n break;\n case \"Z\":\n this.alignVector.copy(this.eye).cross(this.unitZ);\n this.dirVector.copy(this.unitZ).cross(this.alignVector);\n break;\n case \"XY\":\n this.dirVector.copy(this.unitZ);\n break;\n case \"YZ\":\n this.dirVector.copy(this.unitX);\n break;\n case \"XZ\":\n this.alignVector.copy(this.unitZ);\n this.dirVector.copy(this.unitY);\n break;\n case \"XYZ\":\n case \"E\":\n this.dirVector.set(0, 0, 0);\n break;\n }\n break;\n case \"rotate\":\n default:\n this.dirVector.set(0, 0, 0);\n }\n if (this.dirVector.length() === 0) {\n this.quaternion.copy(this.cameraQuaternion);\n } else {\n this.tempMatrix.lookAt(this.tempVector.set(0, 0, 0), this.dirVector, this.alignVector);\n this.quaternion.setFromRotationMatrix(this.tempMatrix);\n }\n super.updateMatrixWorld();\n });\n }\n}\nclass DragControls extends three__WEBPACK_IMPORTED_MODULE_42__.EventDispatcher {\n constructor(_objects, _camera, _domElement) {\n super();\n __publicField(this, \"enabled\", true);\n __publicField(this, \"transformGroup\", false);\n __publicField(this, \"_objects\");\n __publicField(this, \"_camera\");\n __publicField(this, \"_domElement\");\n __publicField(this, \"_plane\", new three__WEBPACK_IMPORTED_MODULE_42__.Plane());\n __publicField(this, \"_raycaster\", new three__WEBPACK_IMPORTED_MODULE_42__.Raycaster());\n __publicField(this, \"_mouse\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector2());\n __publicField(this, \"_offset\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"_intersection\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"_worldPosition\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"_inverseMatrix\", new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4());\n __publicField(this, \"_intersections\", []);\n __publicField(this, \"_selected\", null);\n __publicField(this, \"_hovered\", null);\n __publicField(this, \"activate\", () => {\n this._domElement.addEventListener(\"pointermove\", this.onPointerMove);\n this._domElement.addEventListener(\"pointerdown\", this.onPointerDown);\n this._domElement.addEventListener(\"pointerup\", this.onPointerCancel);\n this._domElement.addEventListener(\"pointerleave\", this.onPointerCancel);\n this._domElement.addEventListener(\"touchmove\", this.onTouchMove);\n this._domElement.addEventListener(\"touchstart\", this.onTouchStart);\n this._domElement.addEventListener(\"touchend\", this.onTouchEnd);\n });\n __publicField(this, \"deactivate\", () => {\n this._domElement.removeEventListener(\"pointermove\", this.onPointerMove);\n this._domElement.removeEventListener(\"pointerdown\", this.onPointerDown);\n this._domElement.removeEventListener(\"pointerup\", this.onPointerCancel);\n this._domElement.removeEventListener(\"pointerleave\", this.onPointerCancel);\n this._domElement.removeEventListener(\"touchmove\", this.onTouchMove);\n this._domElement.removeEventListener(\"touchstart\", this.onTouchStart);\n this._domElement.removeEventListener(\"touchend\", this.onTouchEnd);\n this._domElement.style.cursor = \"\";\n });\n // TODO: confirm if this can be removed?\n __publicField(this, \"dispose\", () => this.deactivate());\n __publicField(this, \"getObjects\", () => this._objects);\n __publicField(this, \"getRaycaster\", () => this._raycaster);\n __publicField(this, \"onMouseMove\", (event) => {\n const rect = this._domElement.getBoundingClientRect();\n this._mouse.x = (event.clientX - rect.left) / rect.width * 2 - 1;\n this._mouse.y = -((event.clientY - rect.top) / rect.height) * 2 + 1;\n this._raycaster.setFromCamera(this._mouse, this._camera);\n if (this._selected && this.enabled) {\n if (this._raycaster.ray.intersectPlane(this._plane, this._intersection)) {\n this._selected.position.copy(this._intersection.sub(this._offset).applyMatrix4(this._inverseMatrix));\n }\n this.dispatchEvent({ type: \"drag\", object: this._selected });\n return;\n }\n this._intersections.length = 0;\n this._raycaster.setFromCamera(this._mouse, this._camera);\n this._raycaster.intersectObjects(this._objects, true, this._intersections);\n if (this._intersections.length > 0) {\n const object = this._intersections[0].object;\n this._plane.setFromNormalAndCoplanarPoint(\n this._camera.getWorldDirection(this._plane.normal),\n this._worldPosition.setFromMatrixPosition(object.matrixWorld)\n );\n if (this._hovered !== object) {\n this.dispatchEvent({ type: \"hoveron\", object });\n this._domElement.style.cursor = \"pointer\";\n this._hovered = object;\n }\n } else {\n if (this._hovered !== null) {\n this.dispatchEvent({ type: \"hoveroff\", object: this._hovered });\n this._domElement.style.cursor = \"auto\";\n this._hovered = null;\n }\n }\n });\n __publicField(this, \"onMouseDown\", () => {\n this._intersections.length = 0;\n this._raycaster.setFromCamera(this._mouse, this._camera);\n this._raycaster.intersectObjects(this._objects, true, this._intersections);\n if (this._intersections.length > 0) {\n this._selected = this.transformGroup === true ? this._objects[0] : this._intersections[0].object;\n if (this._raycaster.ray.intersectPlane(this._plane, this._intersection) && this._selected.parent) {\n this._inverseMatrix.copy(this._selected.parent.matrixWorld).invert();\n this._offset.copy(this._intersection).sub(this._worldPosition.setFromMatrixPosition(this._selected.matrixWorld));\n }\n this._domElement.style.cursor = \"move\";\n this.dispatchEvent({ type: \"dragstart\", object: this._selected });\n }\n });\n __publicField(this, \"onMouseCancel\", () => {\n if (this._selected) {\n this.dispatchEvent({ type: \"dragend\", object: this._selected });\n this._selected = null;\n }\n this._domElement.style.cursor = this._hovered ? \"pointer\" : \"auto\";\n });\n __publicField(this, \"onPointerMove\", (event) => {\n switch (event.pointerType) {\n case \"mouse\":\n case \"pen\":\n this.onMouseMove(event);\n break;\n }\n });\n __publicField(this, \"onPointerDown\", (event) => {\n switch (event.pointerType) {\n case \"mouse\":\n case \"pen\":\n this.onMouseDown();\n break;\n }\n });\n __publicField(this, \"onPointerCancel\", (event) => {\n switch (event.pointerType) {\n case \"mouse\":\n case \"pen\":\n this.onMouseCancel();\n break;\n }\n });\n __publicField(this, \"onTouchMove\", (event) => {\n event.preventDefault();\n const newEvent = event.changedTouches[0];\n const rect = this._domElement.getBoundingClientRect();\n this._mouse.x = (newEvent.clientX - rect.left) / rect.width * 2 - 1;\n this._mouse.y = -((newEvent.clientY - rect.top) / rect.height) * 2 + 1;\n this._raycaster.setFromCamera(this._mouse, this._camera);\n if (this._selected && this.enabled) {\n if (this._raycaster.ray.intersectPlane(this._plane, this._intersection)) {\n this._selected.position.copy(this._intersection.sub(this._offset).applyMatrix4(this._inverseMatrix));\n }\n this.dispatchEvent({ type: \"drag\", object: this._selected });\n return;\n }\n });\n __publicField(this, \"onTouchStart\", (event) => {\n event.preventDefault();\n const newEvent = event.changedTouches[0];\n const rect = this._domElement.getBoundingClientRect();\n this._mouse.x = (newEvent.clientX - rect.left) / rect.width * 2 - 1;\n this._mouse.y = -((newEvent.clientY - rect.top) / rect.height) * 2 + 1;\n this._intersections.length = 0;\n this._raycaster.setFromCamera(this._mouse, this._camera);\n this._raycaster.intersectObjects(this._objects, true, this._intersections);\n if (this._intersections.length > 0) {\n this._selected = this.transformGroup === true ? this._objects[0] : this._intersections[0].object;\n this._plane.setFromNormalAndCoplanarPoint(\n this._camera.getWorldDirection(this._plane.normal),\n this._worldPosition.setFromMatrixPosition(this._selected.matrixWorld)\n );\n if (this._raycaster.ray.intersectPlane(this._plane, this._intersection) && this._selected.parent) {\n this._inverseMatrix.copy(this._selected.parent.matrixWorld).invert();\n this._offset.copy(this._intersection).sub(this._worldPosition.setFromMatrixPosition(this._selected.matrixWorld));\n }\n this._domElement.style.cursor = \"move\";\n this.dispatchEvent({ type: \"dragstart\", object: this._selected });\n }\n });\n __publicField(this, \"onTouchEnd\", (event) => {\n event.preventDefault();\n if (this._selected) {\n this.dispatchEvent({ type: \"dragend\", object: this._selected });\n this._selected = null;\n }\n this._domElement.style.cursor = \"auto\";\n });\n this._objects = _objects;\n this._camera = _camera;\n this._domElement = _domElement;\n this.activate();\n }\n}\nconst _euler = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Euler(0, 0, 0, \"YXZ\");\nconst _vector$2 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst _changeEvent$1 = { type: \"change\" };\nconst _lockEvent = { type: \"lock\" };\nconst _unlockEvent = { type: \"unlock\" };\nconst _PI_2 = Math.PI / 2;\nclass PointerLockControls extends three__WEBPACK_IMPORTED_MODULE_42__.EventDispatcher {\n constructor(camera, domElement) {\n super();\n __publicField(this, \"camera\");\n __publicField(this, \"domElement\");\n __publicField(this, \"isLocked\");\n __publicField(this, \"minPolarAngle\");\n __publicField(this, \"maxPolarAngle\");\n __publicField(this, \"pointerSpeed\");\n __publicField(this, \"onMouseMove\", (event) => {\n if (!this.domElement || this.isLocked === false)\n return;\n const movementX = event.movementX || event.mozMovementX || event.webkitMovementX || 0;\n const movementY = event.movementY || event.mozMovementY || event.webkitMovementY || 0;\n _euler.setFromQuaternion(this.camera.quaternion);\n _euler.y -= movementX * 2e-3 * this.pointerSpeed;\n _euler.x -= movementY * 2e-3 * this.pointerSpeed;\n _euler.x = Math.max(_PI_2 - this.maxPolarAngle, Math.min(_PI_2 - this.minPolarAngle, _euler.x));\n this.camera.quaternion.setFromEuler(_euler);\n this.dispatchEvent(_changeEvent$1);\n });\n __publicField(this, \"onPointerlockChange\", () => {\n if (!this.domElement)\n return;\n if (this.domElement.ownerDocument.pointerLockElement === this.domElement) {\n this.dispatchEvent(_lockEvent);\n this.isLocked = true;\n } else {\n this.dispatchEvent(_unlockEvent);\n this.isLocked = false;\n }\n });\n __publicField(this, \"onPointerlockError\", () => {\n console.error(\"THREE.PointerLockControls: Unable to use Pointer Lock API\");\n });\n __publicField(this, \"connect\", (domElement) => {\n this.domElement = domElement || this.domElement;\n if (!this.domElement)\n return;\n this.domElement.ownerDocument.addEventListener(\"mousemove\", this.onMouseMove);\n this.domElement.ownerDocument.addEventListener(\"pointerlockchange\", this.onPointerlockChange);\n this.domElement.ownerDocument.addEventListener(\"pointerlockerror\", this.onPointerlockError);\n });\n __publicField(this, \"disconnect\", () => {\n if (!this.domElement)\n return;\n this.domElement.ownerDocument.removeEventListener(\"mousemove\", this.onMouseMove);\n this.domElement.ownerDocument.removeEventListener(\"pointerlockchange\", this.onPointerlockChange);\n this.domElement.ownerDocument.removeEventListener(\"pointerlockerror\", this.onPointerlockError);\n });\n __publicField(this, \"dispose\", () => {\n this.disconnect();\n });\n __publicField(this, \"getObject\", () => {\n return this.camera;\n });\n __publicField(this, \"direction\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 0, -1));\n __publicField(this, \"getDirection\", (v) => {\n return v.copy(this.direction).applyQuaternion(this.camera.quaternion);\n });\n __publicField(this, \"moveForward\", (distance) => {\n _vector$2.setFromMatrixColumn(this.camera.matrix, 0);\n _vector$2.crossVectors(this.camera.up, _vector$2);\n this.camera.position.addScaledVector(_vector$2, distance);\n });\n __publicField(this, \"moveRight\", (distance) => {\n _vector$2.setFromMatrixColumn(this.camera.matrix, 0);\n this.camera.position.addScaledVector(_vector$2, distance);\n });\n __publicField(this, \"lock\", () => {\n if (this.domElement)\n this.domElement.requestPointerLock();\n });\n __publicField(this, \"unlock\", () => {\n if (this.domElement)\n this.domElement.ownerDocument.exitPointerLock();\n });\n this.camera = camera;\n this.domElement = domElement;\n this.isLocked = false;\n this.minPolarAngle = 0;\n this.maxPolarAngle = Math.PI;\n this.pointerSpeed = 1;\n if (domElement)\n this.connect(domElement);\n }\n}\nclass DeviceOrientationControls extends three__WEBPACK_IMPORTED_MODULE_42__.EventDispatcher {\n // radians\n constructor(object) {\n super();\n __publicField(this, \"object\");\n __publicField(this, \"changeEvent\", { type: \"change\" });\n __publicField(this, \"EPS\", 1e-6);\n __publicField(this, \"enabled\", true);\n __publicField(this, \"deviceOrientation\", { alpha: 0, beta: 0, gamma: 0 });\n __publicField(this, \"screenOrientation\", 0);\n __publicField(this, \"alphaOffset\", 0);\n __publicField(this, \"onDeviceOrientationChangeEvent\", (event) => {\n this.deviceOrientation = event;\n });\n __publicField(this, \"onScreenOrientationChangeEvent\", () => {\n this.screenOrientation = window.orientation || 0;\n });\n // The angles alpha, beta and gamma form a set of intrinsic Tait-Bryan angles of type Z-X'-Y''\n __publicField(this, \"zee\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 0, 1));\n __publicField(this, \"euler\", new three__WEBPACK_IMPORTED_MODULE_42__.Euler());\n __publicField(this, \"q0\", new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion());\n __publicField(this, \"q1\", new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion(-Math.sqrt(0.5), 0, 0, Math.sqrt(0.5)));\n // - PI/2 around the x-axis\n __publicField(this, \"setObjectQuaternion\", (quaternion, alpha, beta, gamma, orient) => {\n this.euler.set(beta, alpha, -gamma, \"YXZ\");\n quaternion.setFromEuler(this.euler);\n quaternion.multiply(this.q1);\n quaternion.multiply(this.q0.setFromAxisAngle(this.zee, -orient));\n });\n __publicField(this, \"connect\", () => {\n this.onScreenOrientationChangeEvent();\n if (window.DeviceOrientationEvent !== void 0 && // @ts-ignore\n typeof window.DeviceOrientationEvent.requestPermission === \"function\") {\n window.DeviceOrientationEvent.requestPermission().then((response) => {\n if (response == \"granted\") {\n window.addEventListener(\"orientationchange\", this.onScreenOrientationChangeEvent);\n window.addEventListener(\"deviceorientation\", this.onDeviceOrientationChangeEvent);\n }\n }).catch((error) => {\n console.error(\"THREE.DeviceOrientationControls: Unable to use DeviceOrientation API:\", error);\n });\n } else {\n window.addEventListener(\"orientationchange\", this.onScreenOrientationChangeEvent);\n window.addEventListener(\"deviceorientation\", this.onDeviceOrientationChangeEvent);\n }\n this.enabled = true;\n });\n __publicField(this, \"disconnect\", () => {\n window.removeEventListener(\"orientationchange\", this.onScreenOrientationChangeEvent);\n window.removeEventListener(\"deviceorientation\", this.onDeviceOrientationChangeEvent);\n this.enabled = false;\n });\n __publicField(this, \"lastQuaternion\", new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion());\n __publicField(this, \"update\", () => {\n if (this.enabled === false)\n return;\n const device = this.deviceOrientation;\n if (device) {\n const alpha = device.alpha ? three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.degToRad(device.alpha) + this.alphaOffset : 0;\n const beta = device.beta ? three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.degToRad(device.beta) : 0;\n const gamma = device.gamma ? three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.degToRad(device.gamma) : 0;\n const orient = this.screenOrientation ? three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.degToRad(this.screenOrientation) : 0;\n this.setObjectQuaternion(this.object.quaternion, alpha, beta, gamma, orient);\n if (8 * (1 - this.lastQuaternion.dot(this.object.quaternion)) > this.EPS) {\n this.lastQuaternion.copy(this.object.quaternion);\n this.dispatchEvent(this.changeEvent);\n }\n }\n });\n __publicField(this, \"dispose\", () => this.disconnect());\n this.object = object;\n this.object.rotation.reorder(\"YXZ\");\n this.connect();\n }\n}\nclass TrackballControls extends three__WEBPACK_IMPORTED_MODULE_42__.EventDispatcher {\n constructor(object, domElement) {\n super();\n __publicField(this, \"enabled\", true);\n __publicField(this, \"screen\", { left: 0, top: 0, width: 0, height: 0 });\n __publicField(this, \"rotateSpeed\", 1);\n __publicField(this, \"zoomSpeed\", 1.2);\n __publicField(this, \"panSpeed\", 0.3);\n __publicField(this, \"noRotate\", false);\n __publicField(this, \"noZoom\", false);\n __publicField(this, \"noPan\", false);\n __publicField(this, \"staticMoving\", false);\n __publicField(this, \"dynamicDampingFactor\", 0.2);\n __publicField(this, \"minDistance\", 0);\n __publicField(this, \"maxDistance\", Infinity);\n __publicField(this, \"keys\", [\n \"KeyA\",\n \"KeyS\",\n \"KeyD\"\n /*D*/\n ]);\n __publicField(this, \"mouseButtons\", {\n LEFT: three__WEBPACK_IMPORTED_MODULE_42__.MOUSE.ROTATE,\n MIDDLE: three__WEBPACK_IMPORTED_MODULE_42__.MOUSE.DOLLY,\n RIGHT: three__WEBPACK_IMPORTED_MODULE_42__.MOUSE.PAN\n });\n __publicField(this, \"object\");\n __publicField(this, \"domElement\");\n __publicField(this, \"cursorZoom\", false);\n __publicField(this, \"target\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"mousePosition\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector2());\n // internals\n __publicField(this, \"STATE\", {\n NONE: -1,\n ROTATE: 0,\n ZOOM: 1,\n PAN: 2,\n TOUCH_ROTATE: 3,\n TOUCH_ZOOM_PAN: 4\n });\n __publicField(this, \"EPS\", 1e-6);\n __publicField(this, \"lastZoom\", 1);\n __publicField(this, \"lastPosition\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"cursorVector\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"targetVector\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"_state\", this.STATE.NONE);\n __publicField(this, \"_keyState\", this.STATE.NONE);\n __publicField(this, \"_eye\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"_movePrev\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector2());\n __publicField(this, \"_moveCurr\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector2());\n __publicField(this, \"_lastAxis\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"_lastAngle\", 0);\n __publicField(this, \"_zoomStart\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector2());\n __publicField(this, \"_zoomEnd\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector2());\n __publicField(this, \"_touchZoomDistanceStart\", 0);\n __publicField(this, \"_touchZoomDistanceEnd\", 0);\n __publicField(this, \"_panStart\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector2());\n __publicField(this, \"_panEnd\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector2());\n __publicField(this, \"target0\");\n __publicField(this, \"position0\");\n __publicField(this, \"up0\");\n __publicField(this, \"zoom0\");\n // events\n __publicField(this, \"changeEvent\", { type: \"change\" });\n __publicField(this, \"startEvent\", { type: \"start\" });\n __publicField(this, \"endEvent\", { type: \"end\" });\n __publicField(this, \"onScreenVector\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector2());\n __publicField(this, \"getMouseOnScreen\", (pageX, pageY) => {\n this.onScreenVector.set(\n (pageX - this.screen.left) / this.screen.width,\n (pageY - this.screen.top) / this.screen.height\n );\n return this.onScreenVector;\n });\n __publicField(this, \"onCircleVector\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector2());\n __publicField(this, \"getMouseOnCircle\", (pageX, pageY) => {\n this.onCircleVector.set(\n (pageX - this.screen.width * 0.5 - this.screen.left) / (this.screen.width * 0.5),\n (this.screen.height + 2 * (this.screen.top - pageY)) / this.screen.width\n // screen.width intentional\n );\n return this.onCircleVector;\n });\n __publicField(this, \"axis\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"quaternion\", new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion());\n __publicField(this, \"eyeDirection\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"objectUpDirection\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"objectSidewaysDirection\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"moveDirection\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"angle\", 0);\n __publicField(this, \"rotateCamera\", () => {\n this.moveDirection.set(this._moveCurr.x - this._movePrev.x, this._moveCurr.y - this._movePrev.y, 0);\n this.angle = this.moveDirection.length();\n if (this.angle) {\n this._eye.copy(this.object.position).sub(this.target);\n this.eyeDirection.copy(this._eye).normalize();\n this.objectUpDirection.copy(this.object.up).normalize();\n this.objectSidewaysDirection.crossVectors(this.objectUpDirection, this.eyeDirection).normalize();\n this.objectUpDirection.setLength(this._moveCurr.y - this._movePrev.y);\n this.objectSidewaysDirection.setLength(this._moveCurr.x - this._movePrev.x);\n this.moveDirection.copy(this.objectUpDirection.add(this.objectSidewaysDirection));\n this.axis.crossVectors(this.moveDirection, this._eye).normalize();\n this.angle *= this.rotateSpeed;\n this.quaternion.setFromAxisAngle(this.axis, this.angle);\n this._eye.applyQuaternion(this.quaternion);\n this.object.up.applyQuaternion(this.quaternion);\n this._lastAxis.copy(this.axis);\n this._lastAngle = this.angle;\n } else if (!this.staticMoving && this._lastAngle) {\n this._lastAngle *= Math.sqrt(1 - this.dynamicDampingFactor);\n this._eye.copy(this.object.position).sub(this.target);\n this.quaternion.setFromAxisAngle(this._lastAxis, this._lastAngle);\n this._eye.applyQuaternion(this.quaternion);\n this.object.up.applyQuaternion(this.quaternion);\n }\n this._movePrev.copy(this._moveCurr);\n });\n __publicField(this, \"zoomCamera\", () => {\n let factor;\n if (this._state === this.STATE.TOUCH_ZOOM_PAN) {\n factor = this._touchZoomDistanceStart / this._touchZoomDistanceEnd;\n this._touchZoomDistanceStart = this._touchZoomDistanceEnd;\n if (this.object.isPerspectiveCamera) {\n this._eye.multiplyScalar(factor);\n } else if (this.object.isOrthographicCamera) {\n this.object.zoom /= factor;\n this.object.updateProjectionMatrix();\n } else {\n console.warn(\"THREE.TrackballControls: Unsupported camera type\");\n }\n } else {\n factor = 1 + (this._zoomEnd.y - this._zoomStart.y) * this.zoomSpeed;\n if (Math.abs(factor - 1) > this.EPS && factor > 0) {\n if (this.object.isPerspectiveCamera) {\n if (factor > 1 && this._eye.length() >= this.maxDistance - this.EPS) {\n factor = 1;\n }\n this._eye.multiplyScalar(factor);\n } else if (this.object.isOrthographicCamera) {\n if (factor > 1 && this.object.zoom < this.maxDistance * this.maxDistance) {\n factor = 1;\n }\n this.object.zoom /= factor;\n } else {\n console.warn(\"THREE.TrackballControls: Unsupported camera type\");\n }\n }\n if (this.staticMoving) {\n this._zoomStart.copy(this._zoomEnd);\n } else {\n this._zoomStart.y += (this._zoomEnd.y - this._zoomStart.y) * this.dynamicDampingFactor;\n }\n if (this.cursorZoom) {\n this.targetVector.copy(this.target).project(this.object);\n let worldPos = this.cursorVector.set(this.mousePosition.x, this.mousePosition.y, this.targetVector.z).unproject(this.object);\n this.target.lerpVectors(worldPos, this.target, factor);\n }\n if (this.object.isOrthographicCamera) {\n this.object.updateProjectionMatrix();\n }\n }\n });\n __publicField(this, \"mouseChange\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector2());\n __publicField(this, \"objectUp\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"pan\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"panCamera\", () => {\n if (!this.domElement)\n return;\n this.mouseChange.copy(this._panEnd).sub(this._panStart);\n if (this.mouseChange.lengthSq() > this.EPS) {\n if (this.object.isOrthographicCamera) {\n const orthoObject = this.object;\n const scale_x = (orthoObject.right - orthoObject.left) / this.object.zoom;\n const scale_y = (orthoObject.top - orthoObject.bottom) / this.object.zoom;\n this.mouseChange.x *= scale_x;\n this.mouseChange.y *= scale_y;\n } else {\n this.mouseChange.multiplyScalar(this._eye.length() * this.panSpeed);\n }\n this.pan.copy(this._eye).cross(this.object.up).setLength(this.mouseChange.x);\n this.pan.add(this.objectUp.copy(this.object.up).setLength(this.mouseChange.y));\n this.object.position.add(this.pan);\n this.target.add(this.pan);\n if (this.staticMoving) {\n this._panStart.copy(this._panEnd);\n } else {\n this._panStart.add(\n this.mouseChange.subVectors(this._panEnd, this._panStart).multiplyScalar(this.dynamicDampingFactor)\n );\n }\n }\n });\n __publicField(this, \"checkDistances\", () => {\n if (!this.noZoom || !this.noPan) {\n if (this._eye.lengthSq() > this.maxDistance * this.maxDistance) {\n this.object.position.addVectors(this.target, this._eye.setLength(this.maxDistance));\n this._zoomStart.copy(this._zoomEnd);\n }\n if (this._eye.lengthSq() < this.minDistance * this.minDistance) {\n this.object.position.addVectors(this.target, this._eye.setLength(this.minDistance));\n this._zoomStart.copy(this._zoomEnd);\n }\n }\n });\n __publicField(this, \"handleResize\", () => {\n if (!this.domElement)\n return;\n const box = this.domElement.getBoundingClientRect();\n const d = this.domElement.ownerDocument.documentElement;\n this.screen.left = box.left + window.pageXOffset - d.clientLeft;\n this.screen.top = box.top + window.pageYOffset - d.clientTop;\n this.screen.width = box.width;\n this.screen.height = box.height;\n });\n __publicField(this, \"update\", () => {\n this._eye.subVectors(this.object.position, this.target);\n if (!this.noRotate) {\n this.rotateCamera();\n }\n if (!this.noZoom) {\n this.zoomCamera();\n }\n if (!this.noPan) {\n this.panCamera();\n }\n this.object.position.addVectors(this.target, this._eye);\n if (this.object.isPerspectiveCamera) {\n this.checkDistances();\n this.object.lookAt(this.target);\n if (this.lastPosition.distanceToSquared(this.object.position) > this.EPS) {\n this.dispatchEvent(this.changeEvent);\n this.lastPosition.copy(this.object.position);\n }\n } else if (this.object.isOrthographicCamera) {\n this.object.lookAt(this.target);\n if (this.lastPosition.distanceToSquared(this.object.position) > this.EPS || this.lastZoom !== this.object.zoom) {\n this.dispatchEvent(this.changeEvent);\n this.lastPosition.copy(this.object.position);\n this.lastZoom = this.object.zoom;\n }\n } else {\n console.warn(\"THREE.TrackballControls: Unsupported camera type\");\n }\n });\n __publicField(this, \"reset\", () => {\n this._state = this.STATE.NONE;\n this._keyState = this.STATE.NONE;\n this.target.copy(this.target0);\n this.object.position.copy(this.position0);\n this.object.up.copy(this.up0);\n this.object.zoom = this.zoom0;\n this.object.updateProjectionMatrix();\n this._eye.subVectors(this.object.position, this.target);\n this.object.lookAt(this.target);\n this.dispatchEvent(this.changeEvent);\n this.lastPosition.copy(this.object.position);\n this.lastZoom = this.object.zoom;\n });\n __publicField(this, \"keydown\", (event) => {\n if (this.enabled === false)\n return;\n window.removeEventListener(\"keydown\", this.keydown);\n if (this._keyState !== this.STATE.NONE) {\n return;\n } else if (event.code === this.keys[this.STATE.ROTATE] && !this.noRotate) {\n this._keyState = this.STATE.ROTATE;\n } else if (event.code === this.keys[this.STATE.ZOOM] && !this.noZoom) {\n this._keyState = this.STATE.ZOOM;\n } else if (event.code === this.keys[this.STATE.PAN] && !this.noPan) {\n this._keyState = this.STATE.PAN;\n }\n });\n __publicField(this, \"onPointerDown\", (event) => {\n if (this.enabled === false)\n return;\n switch (event.pointerType) {\n case \"mouse\":\n case \"pen\":\n this.onMouseDown(event);\n break;\n }\n });\n __publicField(this, \"onPointerMove\", (event) => {\n if (this.enabled === false)\n return;\n switch (event.pointerType) {\n case \"mouse\":\n case \"pen\":\n this.onMouseMove(event);\n break;\n }\n });\n __publicField(this, \"onPointerUp\", (event) => {\n if (this.enabled === false)\n return;\n switch (event.pointerType) {\n case \"mouse\":\n case \"pen\":\n this.onMouseUp();\n break;\n }\n });\n __publicField(this, \"keyup\", () => {\n if (this.enabled === false)\n return;\n this._keyState = this.STATE.NONE;\n window.addEventListener(\"keydown\", this.keydown);\n });\n __publicField(this, \"onMouseDown\", (event) => {\n if (!this.domElement)\n return;\n if (this._state === this.STATE.NONE) {\n switch (event.button) {\n case this.mouseButtons.LEFT:\n this._state = this.STATE.ROTATE;\n break;\n case this.mouseButtons.MIDDLE:\n this._state = this.STATE.ZOOM;\n break;\n case this.mouseButtons.RIGHT:\n this._state = this.STATE.PAN;\n break;\n default:\n this._state = this.STATE.NONE;\n }\n }\n const state = this._keyState !== this.STATE.NONE ? this._keyState : this._state;\n if (state === this.STATE.ROTATE && !this.noRotate) {\n this._moveCurr.copy(this.getMouseOnCircle(event.pageX, event.pageY));\n this._movePrev.copy(this._moveCurr);\n } else if (state === this.STATE.ZOOM && !this.noZoom) {\n this._zoomStart.copy(this.getMouseOnScreen(event.pageX, event.pageY));\n this._zoomEnd.copy(this._zoomStart);\n } else if (state === this.STATE.PAN && !this.noPan) {\n this._panStart.copy(this.getMouseOnScreen(event.pageX, event.pageY));\n this._panEnd.copy(this._panStart);\n }\n this.domElement.ownerDocument.addEventListener(\"pointermove\", this.onPointerMove);\n this.domElement.ownerDocument.addEventListener(\"pointerup\", this.onPointerUp);\n this.dispatchEvent(this.startEvent);\n });\n __publicField(this, \"onMouseMove\", (event) => {\n if (this.enabled === false)\n return;\n const state = this._keyState !== this.STATE.NONE ? this._keyState : this._state;\n if (state === this.STATE.ROTATE && !this.noRotate) {\n this._movePrev.copy(this._moveCurr);\n this._moveCurr.copy(this.getMouseOnCircle(event.pageX, event.pageY));\n } else if (state === this.STATE.ZOOM && !this.noZoom) {\n this._zoomEnd.copy(this.getMouseOnScreen(event.pageX, event.pageY));\n } else if (state === this.STATE.PAN && !this.noPan) {\n this._panEnd.copy(this.getMouseOnScreen(event.pageX, event.pageY));\n }\n });\n __publicField(this, \"onMouseUp\", () => {\n if (!this.domElement)\n return;\n if (this.enabled === false)\n return;\n this._state = this.STATE.NONE;\n this.domElement.ownerDocument.removeEventListener(\"pointermove\", this.onPointerMove);\n this.domElement.ownerDocument.removeEventListener(\"pointerup\", this.onPointerUp);\n this.dispatchEvent(this.endEvent);\n });\n __publicField(this, \"mousewheel\", (event) => {\n if (this.enabled === false)\n return;\n if (this.noZoom === true)\n return;\n event.preventDefault();\n switch (event.deltaMode) {\n case 2:\n this._zoomStart.y -= event.deltaY * 0.025;\n break;\n case 1:\n this._zoomStart.y -= event.deltaY * 0.01;\n break;\n default:\n this._zoomStart.y -= event.deltaY * 25e-5;\n break;\n }\n this.mousePosition.x = event.offsetX / this.screen.width * 2 - 1;\n this.mousePosition.y = -(event.offsetY / this.screen.height) * 2 + 1;\n this.dispatchEvent(this.startEvent);\n this.dispatchEvent(this.endEvent);\n });\n __publicField(this, \"touchstart\", (event) => {\n if (this.enabled === false)\n return;\n event.preventDefault();\n switch (event.touches.length) {\n case 1:\n this._state = this.STATE.TOUCH_ROTATE;\n this._moveCurr.copy(this.getMouseOnCircle(event.touches[0].pageX, event.touches[0].pageY));\n this._movePrev.copy(this._moveCurr);\n break;\n default:\n this._state = this.STATE.TOUCH_ZOOM_PAN;\n const dx = event.touches[0].pageX - event.touches[1].pageX;\n const dy = event.touches[0].pageY - event.touches[1].pageY;\n this._touchZoomDistanceEnd = this._touchZoomDistanceStart = Math.sqrt(dx * dx + dy * dy);\n const x = (event.touches[0].pageX + event.touches[1].pageX) / 2;\n const y = (event.touches[0].pageY + event.touches[1].pageY) / 2;\n this._panStart.copy(this.getMouseOnScreen(x, y));\n this._panEnd.copy(this._panStart);\n break;\n }\n this.dispatchEvent(this.startEvent);\n });\n __publicField(this, \"touchmove\", (event) => {\n if (this.enabled === false)\n return;\n event.preventDefault();\n switch (event.touches.length) {\n case 1:\n this._movePrev.copy(this._moveCurr);\n this._moveCurr.copy(this.getMouseOnCircle(event.touches[0].pageX, event.touches[0].pageY));\n break;\n default:\n const dx = event.touches[0].pageX - event.touches[1].pageX;\n const dy = event.touches[0].pageY - event.touches[1].pageY;\n this._touchZoomDistanceEnd = Math.sqrt(dx * dx + dy * dy);\n const x = (event.touches[0].pageX + event.touches[1].pageX) / 2;\n const y = (event.touches[0].pageY + event.touches[1].pageY) / 2;\n this._panEnd.copy(this.getMouseOnScreen(x, y));\n break;\n }\n });\n __publicField(this, \"touchend\", (event) => {\n if (this.enabled === false)\n return;\n switch (event.touches.length) {\n case 0:\n this._state = this.STATE.NONE;\n break;\n case 1:\n this._state = this.STATE.TOUCH_ROTATE;\n this._moveCurr.copy(this.getMouseOnCircle(event.touches[0].pageX, event.touches[0].pageY));\n this._movePrev.copy(this._moveCurr);\n break;\n }\n this.dispatchEvent(this.endEvent);\n });\n __publicField(this, \"contextmenu\", (event) => {\n if (this.enabled === false)\n return;\n event.preventDefault();\n });\n // https://github.com/mrdoob/three.js/issues/20575\n __publicField(this, \"connect\", (domElement) => {\n if (domElement === document) {\n console.error(\n 'THREE.OrbitControls: \"document\" should not be used as the target \"domElement\". Please use \"renderer.domElement\" instead.'\n );\n }\n this.domElement = domElement;\n this.domElement.addEventListener(\"contextmenu\", this.contextmenu);\n this.domElement.addEventListener(\"pointerdown\", this.onPointerDown);\n this.domElement.addEventListener(\"wheel\", this.mousewheel);\n this.domElement.addEventListener(\"touchstart\", this.touchstart);\n this.domElement.addEventListener(\"touchend\", this.touchend);\n this.domElement.addEventListener(\"touchmove\", this.touchmove);\n this.domElement.ownerDocument.addEventListener(\"pointermove\", this.onPointerMove);\n this.domElement.ownerDocument.addEventListener(\"pointerup\", this.onPointerUp);\n window.addEventListener(\"keydown\", this.keydown);\n window.addEventListener(\"keyup\", this.keyup);\n this.handleResize();\n });\n __publicField(this, \"dispose\", () => {\n if (!this.domElement)\n return;\n this.domElement.removeEventListener(\"contextmenu\", this.contextmenu);\n this.domElement.removeEventListener(\"pointerdown\", this.onPointerDown);\n this.domElement.removeEventListener(\"wheel\", this.mousewheel);\n this.domElement.removeEventListener(\"touchstart\", this.touchstart);\n this.domElement.removeEventListener(\"touchend\", this.touchend);\n this.domElement.removeEventListener(\"touchmove\", this.touchmove);\n this.domElement.ownerDocument.removeEventListener(\"pointermove\", this.onPointerMove);\n this.domElement.ownerDocument.removeEventListener(\"pointerup\", this.onPointerUp);\n window.removeEventListener(\"keydown\", this.keydown);\n window.removeEventListener(\"keyup\", this.keyup);\n });\n this.object = object;\n this.target0 = this.target.clone();\n this.position0 = this.object.position.clone();\n this.up0 = this.object.up.clone();\n this.zoom0 = this.object.zoom;\n if (domElement !== void 0)\n this.connect(domElement);\n this.update();\n }\n}\nconst _ray$2 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Ray();\nconst _plane = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Plane();\nconst TILT_LIMIT = Math.cos(70 * three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.DEG2RAD);\nconst moduloWrapAround = (offset, capacity) => (offset % capacity + capacity) % capacity;\nclass OrbitControls extends three__WEBPACK_IMPORTED_MODULE_42__.EventDispatcher {\n constructor(object, domElement) {\n super();\n __publicField(this, \"object\");\n __publicField(this, \"domElement\");\n // Set to false to disable this control\n __publicField(this, \"enabled\", true);\n // \"target\" sets the location of focus, where the object orbits around\n __publicField(this, \"target\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n // How far you can dolly in and out ( PerspectiveCamera only )\n __publicField(this, \"minDistance\", 0);\n __publicField(this, \"maxDistance\", Infinity);\n // How far you can zoom in and out ( OrthographicCamera only )\n __publicField(this, \"minZoom\", 0);\n __publicField(this, \"maxZoom\", Infinity);\n // How far you can orbit vertically, upper and lower limits.\n // Range is 0 to Math.PI radians.\n __publicField(this, \"minPolarAngle\", 0);\n // radians\n __publicField(this, \"maxPolarAngle\", Math.PI);\n // radians\n // How far you can orbit horizontally, upper and lower limits.\n // If set, the interval [ min, max ] must be a sub-interval of [ - 2 PI, 2 PI ], with ( max - min < 2 PI )\n __publicField(this, \"minAzimuthAngle\", -Infinity);\n // radians\n __publicField(this, \"maxAzimuthAngle\", Infinity);\n // radians\n // Set to true to enable damping (inertia)\n // If damping is enabled, you must call controls.update() in your animation loop\n __publicField(this, \"enableDamping\", false);\n __publicField(this, \"dampingFactor\", 0.05);\n // This option actually enables dollying in and out; left as \"zoom\" for backwards compatibility.\n // Set to false to disable zooming\n __publicField(this, \"enableZoom\", true);\n __publicField(this, \"zoomSpeed\", 1);\n // Set to false to disable rotating\n __publicField(this, \"enableRotate\", true);\n __publicField(this, \"rotateSpeed\", 1);\n // Set to false to disable panning\n __publicField(this, \"enablePan\", true);\n __publicField(this, \"panSpeed\", 1);\n __publicField(this, \"screenSpacePanning\", true);\n // if false, pan orthogonal to world-space direction camera.up\n __publicField(this, \"keyPanSpeed\", 7);\n // pixels moved per arrow key push\n __publicField(this, \"zoomToCursor\", false);\n // Set to true to automatically rotate around the target\n // If auto-rotate is enabled, you must call controls.update() in your animation loop\n __publicField(this, \"autoRotate\", false);\n __publicField(this, \"autoRotateSpeed\", 2);\n // 30 seconds per orbit when fps is 60\n __publicField(this, \"reverseOrbit\", false);\n // true if you want to reverse the orbit to mouse drag from left to right = orbits left\n __publicField(this, \"reverseHorizontalOrbit\", false);\n // true if you want to reverse the horizontal orbit direction\n __publicField(this, \"reverseVerticalOrbit\", false);\n // true if you want to reverse the vertical orbit direction\n // The four arrow keys\n __publicField(this, \"keys\", { LEFT: \"ArrowLeft\", UP: \"ArrowUp\", RIGHT: \"ArrowRight\", BOTTOM: \"ArrowDown\" });\n // Mouse buttons\n __publicField(this, \"mouseButtons\", {\n LEFT: three__WEBPACK_IMPORTED_MODULE_42__.MOUSE.ROTATE,\n MIDDLE: three__WEBPACK_IMPORTED_MODULE_42__.MOUSE.DOLLY,\n RIGHT: three__WEBPACK_IMPORTED_MODULE_42__.MOUSE.PAN\n });\n // Touch fingers\n __publicField(this, \"touches\", { ONE: three__WEBPACK_IMPORTED_MODULE_42__.TOUCH.ROTATE, TWO: three__WEBPACK_IMPORTED_MODULE_42__.TOUCH.DOLLY_PAN });\n __publicField(this, \"target0\");\n __publicField(this, \"position0\");\n __publicField(this, \"zoom0\");\n // the target DOM element for key events\n __publicField(this, \"_domElementKeyEvents\", null);\n __publicField(this, \"getPolarAngle\");\n __publicField(this, \"getAzimuthalAngle\");\n __publicField(this, \"setPolarAngle\");\n __publicField(this, \"setAzimuthalAngle\");\n __publicField(this, \"getDistance\");\n __publicField(this, \"listenToKeyEvents\");\n __publicField(this, \"stopListenToKeyEvents\");\n __publicField(this, \"saveState\");\n __publicField(this, \"reset\");\n __publicField(this, \"update\");\n __publicField(this, \"connect\");\n __publicField(this, \"dispose\");\n this.object = object;\n this.domElement = domElement;\n this.target0 = this.target.clone();\n this.position0 = this.object.position.clone();\n this.zoom0 = this.object.zoom;\n this.getPolarAngle = () => spherical.phi;\n this.getAzimuthalAngle = () => spherical.theta;\n this.setPolarAngle = (value) => {\n let phi = moduloWrapAround(value, 2 * Math.PI);\n let currentPhi = spherical.phi;\n if (currentPhi < 0)\n currentPhi += 2 * Math.PI;\n if (phi < 0)\n phi += 2 * Math.PI;\n let phiDist = Math.abs(phi - currentPhi);\n if (2 * Math.PI - phiDist < phiDist) {\n if (phi < currentPhi) {\n phi += 2 * Math.PI;\n } else {\n currentPhi += 2 * Math.PI;\n }\n }\n sphericalDelta.phi = phi - currentPhi;\n scope.update();\n };\n this.setAzimuthalAngle = (value) => {\n let theta = moduloWrapAround(value, 2 * Math.PI);\n let currentTheta = spherical.theta;\n if (currentTheta < 0)\n currentTheta += 2 * Math.PI;\n if (theta < 0)\n theta += 2 * Math.PI;\n let thetaDist = Math.abs(theta - currentTheta);\n if (2 * Math.PI - thetaDist < thetaDist) {\n if (theta < currentTheta) {\n theta += 2 * Math.PI;\n } else {\n currentTheta += 2 * Math.PI;\n }\n }\n sphericalDelta.theta = theta - currentTheta;\n scope.update();\n };\n this.getDistance = () => scope.object.position.distanceTo(scope.target);\n this.listenToKeyEvents = (domElement2) => {\n domElement2.addEventListener(\"keydown\", onKeyDown);\n this._domElementKeyEvents = domElement2;\n };\n this.stopListenToKeyEvents = () => {\n this._domElementKeyEvents.removeEventListener(\"keydown\", onKeyDown);\n this._domElementKeyEvents = null;\n };\n this.saveState = () => {\n scope.target0.copy(scope.target);\n scope.position0.copy(scope.object.position);\n scope.zoom0 = scope.object.zoom;\n };\n this.reset = () => {\n scope.target.copy(scope.target0);\n scope.object.position.copy(scope.position0);\n scope.object.zoom = scope.zoom0;\n scope.object.updateProjectionMatrix();\n scope.dispatchEvent(changeEvent);\n scope.update();\n state = STATE2.NONE;\n };\n this.update = (() => {\n const offset = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const up = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 1, 0);\n const quat = new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion().setFromUnitVectors(object.up, up);\n const quatInverse = quat.clone().invert();\n const lastPosition = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const lastQuaternion = new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion();\n const twoPI = 2 * Math.PI;\n return function update() {\n const position = scope.object.position;\n quat.setFromUnitVectors(object.up, up);\n quatInverse.copy(quat).invert();\n offset.copy(position).sub(scope.target);\n offset.applyQuaternion(quat);\n spherical.setFromVector3(offset);\n if (scope.autoRotate && state === STATE2.NONE) {\n rotateLeft(getAutoRotationAngle());\n }\n if (scope.enableDamping) {\n spherical.theta += sphericalDelta.theta * scope.dampingFactor;\n spherical.phi += sphericalDelta.phi * scope.dampingFactor;\n } else {\n spherical.theta += sphericalDelta.theta;\n spherical.phi += sphericalDelta.phi;\n }\n let min = scope.minAzimuthAngle;\n let max = scope.maxAzimuthAngle;\n if (isFinite(min) && isFinite(max)) {\n if (min < -Math.PI)\n min += twoPI;\n else if (min > Math.PI)\n min -= twoPI;\n if (max < -Math.PI)\n max += twoPI;\n else if (max > Math.PI)\n max -= twoPI;\n if (min <= max) {\n spherical.theta = Math.max(min, Math.min(max, spherical.theta));\n } else {\n spherical.theta = spherical.theta > (min + max) / 2 ? Math.max(min, spherical.theta) : Math.min(max, spherical.theta);\n }\n }\n spherical.phi = Math.max(scope.minPolarAngle, Math.min(scope.maxPolarAngle, spherical.phi));\n spherical.makeSafe();\n if (scope.enableDamping === true) {\n scope.target.addScaledVector(panOffset, scope.dampingFactor);\n } else {\n scope.target.add(panOffset);\n }\n if (scope.zoomToCursor && performCursorZoom || scope.object.isOrthographicCamera) {\n spherical.radius = clampDistance(spherical.radius);\n } else {\n spherical.radius = clampDistance(spherical.radius * scale);\n }\n offset.setFromSpherical(spherical);\n offset.applyQuaternion(quatInverse);\n position.copy(scope.target).add(offset);\n scope.object.lookAt(scope.target);\n if (scope.enableDamping === true) {\n sphericalDelta.theta *= 1 - scope.dampingFactor;\n sphericalDelta.phi *= 1 - scope.dampingFactor;\n panOffset.multiplyScalar(1 - scope.dampingFactor);\n } else {\n sphericalDelta.set(0, 0, 0);\n panOffset.set(0, 0, 0);\n }\n let zoomChanged = false;\n if (scope.zoomToCursor && performCursorZoom) {\n let newRadius = null;\n if (scope.object instanceof three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera && scope.object.isPerspectiveCamera) {\n const prevRadius = offset.length();\n newRadius = clampDistance(prevRadius * scale);\n const radiusDelta = prevRadius - newRadius;\n scope.object.position.addScaledVector(dollyDirection, radiusDelta);\n scope.object.updateMatrixWorld();\n } else if (scope.object.isOrthographicCamera) {\n const mouseBefore = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(mouse.x, mouse.y, 0);\n mouseBefore.unproject(scope.object);\n scope.object.zoom = Math.max(scope.minZoom, Math.min(scope.maxZoom, scope.object.zoom / scale));\n scope.object.updateProjectionMatrix();\n zoomChanged = true;\n const mouseAfter = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(mouse.x, mouse.y, 0);\n mouseAfter.unproject(scope.object);\n scope.object.position.sub(mouseAfter).add(mouseBefore);\n scope.object.updateMatrixWorld();\n newRadius = offset.length();\n } else {\n console.warn(\"WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled.\");\n scope.zoomToCursor = false;\n }\n if (newRadius !== null) {\n if (scope.screenSpacePanning) {\n scope.target.set(0, 0, -1).transformDirection(scope.object.matrix).multiplyScalar(newRadius).add(scope.object.position);\n } else {\n _ray$2.origin.copy(scope.object.position);\n _ray$2.direction.set(0, 0, -1).transformDirection(scope.object.matrix);\n if (Math.abs(scope.object.up.dot(_ray$2.direction)) < TILT_LIMIT) {\n object.lookAt(scope.target);\n } else {\n _plane.setFromNormalAndCoplanarPoint(scope.object.up, scope.target);\n _ray$2.intersectPlane(_plane, scope.target);\n }\n }\n }\n } else if (scope.object instanceof three__WEBPACK_IMPORTED_MODULE_42__.OrthographicCamera && scope.object.isOrthographicCamera) {\n scope.object.zoom = Math.max(scope.minZoom, Math.min(scope.maxZoom, scope.object.zoom / scale));\n scope.object.updateProjectionMatrix();\n zoomChanged = true;\n }\n scale = 1;\n performCursorZoom = false;\n if (zoomChanged || lastPosition.distanceToSquared(scope.object.position) > EPS2 || 8 * (1 - lastQuaternion.dot(scope.object.quaternion)) > EPS2) {\n scope.dispatchEvent(changeEvent);\n lastPosition.copy(scope.object.position);\n lastQuaternion.copy(scope.object.quaternion);\n zoomChanged = false;\n return true;\n }\n return false;\n };\n })();\n this.connect = (domElement2) => {\n if (domElement2 === document) {\n console.error(\n 'THREE.OrbitControls: \"document\" should not be used as the target \"domElement\". Please use \"renderer.domElement\" instead.'\n );\n }\n scope.domElement = domElement2;\n scope.domElement.style.touchAction = \"none\";\n scope.domElement.addEventListener(\"contextmenu\", onContextMenu);\n scope.domElement.addEventListener(\"pointerdown\", onPointerDown);\n scope.domElement.addEventListener(\"pointercancel\", onPointerCancel);\n scope.domElement.addEventListener(\"wheel\", onMouseWheel);\n };\n this.dispose = () => {\n var _a2, _b2, _c, _d, _e, _f;\n (_a2 = scope.domElement) == null ? void 0 : _a2.removeEventListener(\"contextmenu\", onContextMenu);\n (_b2 = scope.domElement) == null ? void 0 : _b2.removeEventListener(\"pointerdown\", onPointerDown);\n (_c = scope.domElement) == null ? void 0 : _c.removeEventListener(\"pointercancel\", onPointerCancel);\n (_d = scope.domElement) == null ? void 0 : _d.removeEventListener(\"wheel\", onMouseWheel);\n (_e = scope.domElement) == null ? void 0 : _e.ownerDocument.removeEventListener(\"pointermove\", onPointerMove);\n (_f = scope.domElement) == null ? void 0 : _f.ownerDocument.removeEventListener(\"pointerup\", onPointerUp);\n if (scope._domElementKeyEvents !== null) {\n scope._domElementKeyEvents.removeEventListener(\"keydown\", onKeyDown);\n }\n };\n const scope = this;\n const changeEvent = { type: \"change\" };\n const startEvent = { type: \"start\" };\n const endEvent = { type: \"end\" };\n const STATE2 = {\n NONE: -1,\n ROTATE: 0,\n DOLLY: 1,\n PAN: 2,\n TOUCH_ROTATE: 3,\n TOUCH_PAN: 4,\n TOUCH_DOLLY_PAN: 5,\n TOUCH_DOLLY_ROTATE: 6\n };\n let state = STATE2.NONE;\n const EPS2 = 1e-6;\n const spherical = new three__WEBPACK_IMPORTED_MODULE_42__.Spherical();\n const sphericalDelta = new three__WEBPACK_IMPORTED_MODULE_42__.Spherical();\n let scale = 1;\n const panOffset = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const rotateStart = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2();\n const rotateEnd = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2();\n const rotateDelta = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2();\n const panStart = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2();\n const panEnd = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2();\n const panDelta = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2();\n const dollyStart = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2();\n const dollyEnd = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2();\n const dollyDelta = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2();\n const dollyDirection = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const mouse = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2();\n let performCursorZoom = false;\n const pointers = [];\n const pointerPositions = {};\n function getAutoRotationAngle() {\n return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;\n }\n function getZoomScale() {\n return Math.pow(0.95, scope.zoomSpeed);\n }\n function rotateLeft(angle) {\n if (scope.reverseOrbit || scope.reverseHorizontalOrbit) {\n sphericalDelta.theta += angle;\n } else {\n sphericalDelta.theta -= angle;\n }\n }\n function rotateUp(angle) {\n if (scope.reverseOrbit || scope.reverseVerticalOrbit) {\n sphericalDelta.phi += angle;\n } else {\n sphericalDelta.phi -= angle;\n }\n }\n const panLeft = (() => {\n const v = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n return function panLeft2(distance, objectMatrix) {\n v.setFromMatrixColumn(objectMatrix, 0);\n v.multiplyScalar(-distance);\n panOffset.add(v);\n };\n })();\n const panUp = (() => {\n const v = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n return function panUp2(distance, objectMatrix) {\n if (scope.screenSpacePanning === true) {\n v.setFromMatrixColumn(objectMatrix, 1);\n } else {\n v.setFromMatrixColumn(objectMatrix, 0);\n v.crossVectors(scope.object.up, v);\n }\n v.multiplyScalar(distance);\n panOffset.add(v);\n };\n })();\n const pan = (() => {\n const offset = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n return function pan2(deltaX, deltaY) {\n const element = scope.domElement;\n if (element && scope.object instanceof three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera && scope.object.isPerspectiveCamera) {\n const position = scope.object.position;\n offset.copy(position).sub(scope.target);\n let targetDistance = offset.length();\n targetDistance *= Math.tan(scope.object.fov / 2 * Math.PI / 180);\n panLeft(2 * deltaX * targetDistance / element.clientHeight, scope.object.matrix);\n panUp(2 * deltaY * targetDistance / element.clientHeight, scope.object.matrix);\n } else if (element && scope.object instanceof three__WEBPACK_IMPORTED_MODULE_42__.OrthographicCamera && scope.object.isOrthographicCamera) {\n panLeft(\n deltaX * (scope.object.right - scope.object.left) / scope.object.zoom / element.clientWidth,\n scope.object.matrix\n );\n panUp(\n deltaY * (scope.object.top - scope.object.bottom) / scope.object.zoom / element.clientHeight,\n scope.object.matrix\n );\n } else {\n console.warn(\"WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.\");\n scope.enablePan = false;\n }\n };\n })();\n function dollyOut(dollyScale) {\n if (scope.object instanceof three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera && scope.object.isPerspectiveCamera || scope.object instanceof three__WEBPACK_IMPORTED_MODULE_42__.OrthographicCamera && scope.object.isOrthographicCamera) {\n scale /= dollyScale;\n } else {\n console.warn(\"WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.\");\n scope.enableZoom = false;\n }\n }\n function dollyIn(dollyScale) {\n if (scope.object instanceof three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera && scope.object.isPerspectiveCamera || scope.object instanceof three__WEBPACK_IMPORTED_MODULE_42__.OrthographicCamera && scope.object.isOrthographicCamera) {\n scale *= dollyScale;\n } else {\n console.warn(\"WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.\");\n scope.enableZoom = false;\n }\n }\n function updateMouseParameters(event) {\n if (!scope.zoomToCursor || !scope.domElement) {\n return;\n }\n performCursorZoom = true;\n const rect = scope.domElement.getBoundingClientRect();\n const x = event.clientX - rect.left;\n const y = event.clientY - rect.top;\n const w = rect.width;\n const h = rect.height;\n mouse.x = x / w * 2 - 1;\n mouse.y = -(y / h) * 2 + 1;\n dollyDirection.set(mouse.x, mouse.y, 1).unproject(scope.object).sub(scope.object.position).normalize();\n }\n function clampDistance(dist) {\n return Math.max(scope.minDistance, Math.min(scope.maxDistance, dist));\n }\n function handleMouseDownRotate(event) {\n rotateStart.set(event.clientX, event.clientY);\n }\n function handleMouseDownDolly(event) {\n updateMouseParameters(event);\n dollyStart.set(event.clientX, event.clientY);\n }\n function handleMouseDownPan(event) {\n panStart.set(event.clientX, event.clientY);\n }\n function handleMouseMoveRotate(event) {\n rotateEnd.set(event.clientX, event.clientY);\n rotateDelta.subVectors(rotateEnd, rotateStart).multiplyScalar(scope.rotateSpeed);\n const element = scope.domElement;\n if (element) {\n rotateLeft(2 * Math.PI * rotateDelta.x / element.clientHeight);\n rotateUp(2 * Math.PI * rotateDelta.y / element.clientHeight);\n }\n rotateStart.copy(rotateEnd);\n scope.update();\n }\n function handleMouseMoveDolly(event) {\n dollyEnd.set(event.clientX, event.clientY);\n dollyDelta.subVectors(dollyEnd, dollyStart);\n if (dollyDelta.y > 0) {\n dollyOut(getZoomScale());\n } else if (dollyDelta.y < 0) {\n dollyIn(getZoomScale());\n }\n dollyStart.copy(dollyEnd);\n scope.update();\n }\n function handleMouseMovePan(event) {\n panEnd.set(event.clientX, event.clientY);\n panDelta.subVectors(panEnd, panStart).multiplyScalar(scope.panSpeed);\n pan(panDelta.x, panDelta.y);\n panStart.copy(panEnd);\n scope.update();\n }\n function handleMouseWheel(event) {\n updateMouseParameters(event);\n if (event.deltaY < 0) {\n dollyIn(getZoomScale());\n } else if (event.deltaY > 0) {\n dollyOut(getZoomScale());\n }\n scope.update();\n }\n function handleKeyDown(event) {\n let needsUpdate = false;\n switch (event.code) {\n case scope.keys.UP:\n pan(0, scope.keyPanSpeed);\n needsUpdate = true;\n break;\n case scope.keys.BOTTOM:\n pan(0, -scope.keyPanSpeed);\n needsUpdate = true;\n break;\n case scope.keys.LEFT:\n pan(scope.keyPanSpeed, 0);\n needsUpdate = true;\n break;\n case scope.keys.RIGHT:\n pan(-scope.keyPanSpeed, 0);\n needsUpdate = true;\n break;\n }\n if (needsUpdate) {\n event.preventDefault();\n scope.update();\n }\n }\n function handleTouchStartRotate() {\n if (pointers.length == 1) {\n rotateStart.set(pointers[0].pageX, pointers[0].pageY);\n } else {\n const x = 0.5 * (pointers[0].pageX + pointers[1].pageX);\n const y = 0.5 * (pointers[0].pageY + pointers[1].pageY);\n rotateStart.set(x, y);\n }\n }\n function handleTouchStartPan() {\n if (pointers.length == 1) {\n panStart.set(pointers[0].pageX, pointers[0].pageY);\n } else {\n const x = 0.5 * (pointers[0].pageX + pointers[1].pageX);\n const y = 0.5 * (pointers[0].pageY + pointers[1].pageY);\n panStart.set(x, y);\n }\n }\n function handleTouchStartDolly() {\n const dx = pointers[0].pageX - pointers[1].pageX;\n const dy = pointers[0].pageY - pointers[1].pageY;\n const distance = Math.sqrt(dx * dx + dy * dy);\n dollyStart.set(0, distance);\n }\n function handleTouchStartDollyPan() {\n if (scope.enableZoom)\n handleTouchStartDolly();\n if (scope.enablePan)\n handleTouchStartPan();\n }\n function handleTouchStartDollyRotate() {\n if (scope.enableZoom)\n handleTouchStartDolly();\n if (scope.enableRotate)\n handleTouchStartRotate();\n }\n function handleTouchMoveRotate(event) {\n if (pointers.length == 1) {\n rotateEnd.set(event.pageX, event.pageY);\n } else {\n const position = getSecondPointerPosition(event);\n const x = 0.5 * (event.pageX + position.x);\n const y = 0.5 * (event.pageY + position.y);\n rotateEnd.set(x, y);\n }\n rotateDelta.subVectors(rotateEnd, rotateStart).multiplyScalar(scope.rotateSpeed);\n const element = scope.domElement;\n if (element) {\n rotateLeft(2 * Math.PI * rotateDelta.x / element.clientHeight);\n rotateUp(2 * Math.PI * rotateDelta.y / element.clientHeight);\n }\n rotateStart.copy(rotateEnd);\n }\n function handleTouchMovePan(event) {\n if (pointers.length == 1) {\n panEnd.set(event.pageX, event.pageY);\n } else {\n const position = getSecondPointerPosition(event);\n const x = 0.5 * (event.pageX + position.x);\n const y = 0.5 * (event.pageY + position.y);\n panEnd.set(x, y);\n }\n panDelta.subVectors(panEnd, panStart).multiplyScalar(scope.panSpeed);\n pan(panDelta.x, panDelta.y);\n panStart.copy(panEnd);\n }\n function handleTouchMoveDolly(event) {\n const position = getSecondPointerPosition(event);\n const dx = event.pageX - position.x;\n const dy = event.pageY - position.y;\n const distance = Math.sqrt(dx * dx + dy * dy);\n dollyEnd.set(0, distance);\n dollyDelta.set(0, Math.pow(dollyEnd.y / dollyStart.y, scope.zoomSpeed));\n dollyOut(dollyDelta.y);\n dollyStart.copy(dollyEnd);\n }\n function handleTouchMoveDollyPan(event) {\n if (scope.enableZoom)\n handleTouchMoveDolly(event);\n if (scope.enablePan)\n handleTouchMovePan(event);\n }\n function handleTouchMoveDollyRotate(event) {\n if (scope.enableZoom)\n handleTouchMoveDolly(event);\n if (scope.enableRotate)\n handleTouchMoveRotate(event);\n }\n function onPointerDown(event) {\n var _a2, _b2;\n if (scope.enabled === false)\n return;\n if (pointers.length === 0) {\n (_a2 = scope.domElement) == null ? void 0 : _a2.ownerDocument.addEventListener(\"pointermove\", onPointerMove);\n (_b2 = scope.domElement) == null ? void 0 : _b2.ownerDocument.addEventListener(\"pointerup\", onPointerUp);\n }\n addPointer(event);\n if (event.pointerType === \"touch\") {\n onTouchStart(event);\n } else {\n onMouseDown(event);\n }\n }\n function onPointerMove(event) {\n if (scope.enabled === false)\n return;\n if (event.pointerType === \"touch\") {\n onTouchMove(event);\n } else {\n onMouseMove(event);\n }\n }\n function onPointerUp(event) {\n var _a2, _b2, _c;\n removePointer(event);\n if (pointers.length === 0) {\n (_a2 = scope.domElement) == null ? void 0 : _a2.releasePointerCapture(event.pointerId);\n (_b2 = scope.domElement) == null ? void 0 : _b2.ownerDocument.removeEventListener(\"pointermove\", onPointerMove);\n (_c = scope.domElement) == null ? void 0 : _c.ownerDocument.removeEventListener(\"pointerup\", onPointerUp);\n }\n scope.dispatchEvent(endEvent);\n state = STATE2.NONE;\n }\n function onPointerCancel(event) {\n removePointer(event);\n }\n function onMouseDown(event) {\n let mouseAction;\n switch (event.button) {\n case 0:\n mouseAction = scope.mouseButtons.LEFT;\n break;\n case 1:\n mouseAction = scope.mouseButtons.MIDDLE;\n break;\n case 2:\n mouseAction = scope.mouseButtons.RIGHT;\n break;\n default:\n mouseAction = -1;\n }\n switch (mouseAction) {\n case three__WEBPACK_IMPORTED_MODULE_42__.MOUSE.DOLLY:\n if (scope.enableZoom === false)\n return;\n handleMouseDownDolly(event);\n state = STATE2.DOLLY;\n break;\n case three__WEBPACK_IMPORTED_MODULE_42__.MOUSE.ROTATE:\n if (event.ctrlKey || event.metaKey || event.shiftKey) {\n if (scope.enablePan === false)\n return;\n handleMouseDownPan(event);\n state = STATE2.PAN;\n } else {\n if (scope.enableRotate === false)\n return;\n handleMouseDownRotate(event);\n state = STATE2.ROTATE;\n }\n break;\n case three__WEBPACK_IMPORTED_MODULE_42__.MOUSE.PAN:\n if (event.ctrlKey || event.metaKey || event.shiftKey) {\n if (scope.enableRotate === false)\n return;\n handleMouseDownRotate(event);\n state = STATE2.ROTATE;\n } else {\n if (scope.enablePan === false)\n return;\n handleMouseDownPan(event);\n state = STATE2.PAN;\n }\n break;\n default:\n state = STATE2.NONE;\n }\n if (state !== STATE2.NONE) {\n scope.dispatchEvent(startEvent);\n }\n }\n function onMouseMove(event) {\n if (scope.enabled === false)\n return;\n switch (state) {\n case STATE2.ROTATE:\n if (scope.enableRotate === false)\n return;\n handleMouseMoveRotate(event);\n break;\n case STATE2.DOLLY:\n if (scope.enableZoom === false)\n return;\n handleMouseMoveDolly(event);\n break;\n case STATE2.PAN:\n if (scope.enablePan === false)\n return;\n handleMouseMovePan(event);\n break;\n }\n }\n function onMouseWheel(event) {\n if (scope.enabled === false || scope.enableZoom === false || state !== STATE2.NONE && state !== STATE2.ROTATE) {\n return;\n }\n event.preventDefault();\n scope.dispatchEvent(startEvent);\n handleMouseWheel(event);\n scope.dispatchEvent(endEvent);\n }\n function onKeyDown(event) {\n if (scope.enabled === false || scope.enablePan === false)\n return;\n handleKeyDown(event);\n }\n function onTouchStart(event) {\n trackPointer(event);\n switch (pointers.length) {\n case 1:\n switch (scope.touches.ONE) {\n case three__WEBPACK_IMPORTED_MODULE_42__.TOUCH.ROTATE:\n if (scope.enableRotate === false)\n return;\n handleTouchStartRotate();\n state = STATE2.TOUCH_ROTATE;\n break;\n case three__WEBPACK_IMPORTED_MODULE_42__.TOUCH.PAN:\n if (scope.enablePan === false)\n return;\n handleTouchStartPan();\n state = STATE2.TOUCH_PAN;\n break;\n default:\n state = STATE2.NONE;\n }\n break;\n case 2:\n switch (scope.touches.TWO) {\n case three__WEBPACK_IMPORTED_MODULE_42__.TOUCH.DOLLY_PAN:\n if (scope.enableZoom === false && scope.enablePan === false)\n return;\n handleTouchStartDollyPan();\n state = STATE2.TOUCH_DOLLY_PAN;\n break;\n case three__WEBPACK_IMPORTED_MODULE_42__.TOUCH.DOLLY_ROTATE:\n if (scope.enableZoom === false && scope.enableRotate === false)\n return;\n handleTouchStartDollyRotate();\n state = STATE2.TOUCH_DOLLY_ROTATE;\n break;\n default:\n state = STATE2.NONE;\n }\n break;\n default:\n state = STATE2.NONE;\n }\n if (state !== STATE2.NONE) {\n scope.dispatchEvent(startEvent);\n }\n }\n function onTouchMove(event) {\n trackPointer(event);\n switch (state) {\n case STATE2.TOUCH_ROTATE:\n if (scope.enableRotate === false)\n return;\n handleTouchMoveRotate(event);\n scope.update();\n break;\n case STATE2.TOUCH_PAN:\n if (scope.enablePan === false)\n return;\n handleTouchMovePan(event);\n scope.update();\n break;\n case STATE2.TOUCH_DOLLY_PAN:\n if (scope.enableZoom === false && scope.enablePan === false)\n return;\n handleTouchMoveDollyPan(event);\n scope.update();\n break;\n case STATE2.TOUCH_DOLLY_ROTATE:\n if (scope.enableZoom === false && scope.enableRotate === false)\n return;\n handleTouchMoveDollyRotate(event);\n scope.update();\n break;\n default:\n state = STATE2.NONE;\n }\n }\n function onContextMenu(event) {\n if (scope.enabled === false)\n return;\n event.preventDefault();\n }\n function addPointer(event) {\n pointers.push(event);\n }\n function removePointer(event) {\n delete pointerPositions[event.pointerId];\n for (let i2 = 0; i2 < pointers.length; i2++) {\n if (pointers[i2].pointerId == event.pointerId) {\n pointers.splice(i2, 1);\n return;\n }\n }\n }\n function trackPointer(event) {\n let position = pointerPositions[event.pointerId];\n if (position === void 0) {\n position = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2();\n pointerPositions[event.pointerId] = position;\n }\n position.set(event.pageX, event.pageY);\n }\n function getSecondPointerPosition(event) {\n const pointer = event.pointerId === pointers[0].pointerId ? pointers[1] : pointers[0];\n return pointerPositions[pointer.pointerId];\n }\n if (domElement !== void 0)\n this.connect(domElement);\n this.update();\n }\n}\nclass MapControls extends OrbitControls {\n constructor(object, domElement) {\n super(object, domElement);\n this.screenSpacePanning = false;\n this.mouseButtons.LEFT = three__WEBPACK_IMPORTED_MODULE_42__.MOUSE.PAN;\n this.mouseButtons.RIGHT = three__WEBPACK_IMPORTED_MODULE_42__.MOUSE.ROTATE;\n this.touches.ONE = three__WEBPACK_IMPORTED_MODULE_42__.TOUCH.PAN;\n this.touches.TWO = three__WEBPACK_IMPORTED_MODULE_42__.TOUCH.DOLLY_ROTATE;\n }\n}\nconst STATE = {\n IDLE: Symbol(),\n ROTATE: Symbol(),\n PAN: Symbol(),\n SCALE: Symbol(),\n FOV: Symbol(),\n FOCUS: Symbol(),\n ZROTATE: Symbol(),\n TOUCH_MULTI: Symbol(),\n ANIMATION_FOCUS: Symbol(),\n ANIMATION_ROTATE: Symbol()\n};\nconst INPUT = {\n NONE: Symbol(),\n ONE_FINGER: Symbol(),\n ONE_FINGER_SWITCHED: Symbol(),\n TWO_FINGER: Symbol(),\n MULT_FINGER: Symbol(),\n CURSOR: Symbol()\n};\nconst _center$1 = {\n x: 0,\n y: 0\n};\nconst _transformation = {\n camera: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4(),\n gizmos: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4()\n};\nconst _changeEvent = { type: \"change\" };\nconst _startEvent = { type: \"start\" };\nconst _endEvent = { type: \"end\" };\nclass ArcballControls extends three__WEBPACK_IMPORTED_MODULE_42__.EventDispatcher {\n constructor(camera, domElement = null, scene = null) {\n super();\n __publicField(this, \"camera\");\n __publicField(this, \"domElement\");\n __publicField(this, \"scene\");\n __publicField(this, \"mouseActions\");\n __publicField(this, \"_mouseOp\");\n __publicField(this, \"_v2_1\");\n __publicField(this, \"_v3_1\");\n __publicField(this, \"_v3_2\");\n __publicField(this, \"_m4_1\");\n __publicField(this, \"_m4_2\");\n __publicField(this, \"_quat\");\n __publicField(this, \"_translationMatrix\");\n __publicField(this, \"_rotationMatrix\");\n __publicField(this, \"_scaleMatrix\");\n __publicField(this, \"_rotationAxis\");\n __publicField(this, \"_cameraMatrixState\");\n __publicField(this, \"_cameraProjectionState\");\n __publicField(this, \"_fovState\");\n __publicField(this, \"_upState\");\n __publicField(this, \"_zoomState\");\n __publicField(this, \"_nearPos\");\n __publicField(this, \"_farPos\");\n __publicField(this, \"_gizmoMatrixState\");\n __publicField(this, \"_up0\");\n __publicField(this, \"_zoom0\");\n __publicField(this, \"_fov0\");\n __publicField(this, \"_initialNear\");\n __publicField(this, \"_nearPos0\");\n __publicField(this, \"_initialFar\");\n __publicField(this, \"_farPos0\");\n __publicField(this, \"_cameraMatrixState0\");\n __publicField(this, \"_gizmoMatrixState0\");\n __publicField(this, \"_button\");\n __publicField(this, \"_touchStart\");\n __publicField(this, \"_touchCurrent\");\n __publicField(this, \"_input\");\n __publicField(this, \"_switchSensibility\");\n __publicField(this, \"_startFingerDistance\");\n __publicField(this, \"_currentFingerDistance\");\n __publicField(this, \"_startFingerRotation\");\n __publicField(this, \"_currentFingerRotation\");\n __publicField(this, \"_devPxRatio\");\n __publicField(this, \"_downValid\");\n __publicField(this, \"_nclicks\");\n __publicField(this, \"_downEvents\");\n __publicField(this, \"_clickStart\");\n __publicField(this, \"_maxDownTime\");\n __publicField(this, \"_maxInterval\");\n __publicField(this, \"_posThreshold\");\n __publicField(this, \"_movementThreshold\");\n __publicField(this, \"_currentCursorPosition\");\n __publicField(this, \"_startCursorPosition\");\n __publicField(this, \"_grid\");\n __publicField(this, \"_gridPosition\");\n __publicField(this, \"_gizmos\");\n __publicField(this, \"_curvePts\");\n __publicField(this, \"_timeStart\");\n __publicField(this, \"_animationId\");\n __publicField(this, \"focusAnimationTime\");\n __publicField(this, \"_timePrev\");\n __publicField(this, \"_timeCurrent\");\n __publicField(this, \"_anglePrev\");\n __publicField(this, \"_angleCurrent\");\n __publicField(this, \"_cursorPosPrev\");\n __publicField(this, \"_cursorPosCurr\");\n __publicField(this, \"_wPrev\");\n __publicField(this, \"_wCurr\");\n __publicField(this, \"adjustNearFar\");\n __publicField(this, \"scaleFactor\");\n __publicField(this, \"dampingFactor\");\n __publicField(this, \"wMax\");\n __publicField(this, \"enableAnimations\");\n __publicField(this, \"enableGrid\");\n __publicField(this, \"cursorZoom\");\n __publicField(this, \"minFov\");\n __publicField(this, \"maxFov\");\n __publicField(this, \"enabled\");\n __publicField(this, \"enablePan\");\n __publicField(this, \"enableRotate\");\n __publicField(this, \"enableZoom\");\n __publicField(this, \"minDistance\");\n __publicField(this, \"maxDistance\");\n __publicField(this, \"minZoom\");\n __publicField(this, \"maxZoom\");\n __publicField(this, \"target\");\n __publicField(this, \"_currentTarget\");\n __publicField(this, \"_tbRadius\");\n __publicField(this, \"_state\");\n //listeners\n __publicField(this, \"onWindowResize\", () => {\n const scale = (this._gizmos.scale.x + this._gizmos.scale.y + this._gizmos.scale.z) / 3;\n if (this.camera) {\n const tbRadius = this.calculateTbRadius(this.camera);\n if (tbRadius !== void 0) {\n this._tbRadius = tbRadius;\n }\n }\n const newRadius = this._tbRadius / scale;\n const curve = new three__WEBPACK_IMPORTED_MODULE_42__.EllipseCurve(0, 0, newRadius, newRadius);\n const points = curve.getPoints(this._curvePts);\n const curveGeometry = new three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry().setFromPoints(points);\n for (const gizmo in this._gizmos.children) {\n const child = this._gizmos.children[gizmo];\n child.geometry = curveGeometry;\n }\n this.dispatchEvent(_changeEvent);\n });\n __publicField(this, \"onContextMenu\", (event) => {\n if (!this.enabled) {\n return;\n }\n for (let i2 = 0; i2 < this.mouseActions.length; i2++) {\n if (this.mouseActions[i2].mouse == 2) {\n event.preventDefault();\n break;\n }\n }\n });\n __publicField(this, \"onPointerCancel\", () => {\n this._touchStart.splice(0, this._touchStart.length);\n this._touchCurrent.splice(0, this._touchCurrent.length);\n this._input = INPUT.NONE;\n });\n __publicField(this, \"onPointerDown\", (event) => {\n if (event.button == 0 && event.isPrimary) {\n this._downValid = true;\n this._downEvents.push(event);\n } else {\n this._downValid = false;\n }\n if (event.pointerType == \"touch\" && this._input != INPUT.CURSOR) {\n this._touchStart.push(event);\n this._touchCurrent.push(event);\n switch (this._input) {\n case INPUT.NONE:\n this._input = INPUT.ONE_FINGER;\n this.onSinglePanStart(event, \"ROTATE\");\n window.addEventListener(\"pointermove\", this.onPointerMove);\n window.addEventListener(\"pointerup\", this.onPointerUp);\n break;\n case INPUT.ONE_FINGER:\n case INPUT.ONE_FINGER_SWITCHED:\n this._input = INPUT.TWO_FINGER;\n this.onRotateStart();\n this.onPinchStart();\n this.onDoublePanStart();\n break;\n case INPUT.TWO_FINGER:\n this._input = INPUT.MULT_FINGER;\n this.onTriplePanStart();\n break;\n }\n } else if (event.pointerType != \"touch\" && this._input == INPUT.NONE) {\n let modifier = null;\n if (event.ctrlKey || event.metaKey) {\n modifier = \"CTRL\";\n } else if (event.shiftKey) {\n modifier = \"SHIFT\";\n }\n this._mouseOp = this.getOpFromAction(event.button, modifier);\n if (this._mouseOp) {\n window.addEventListener(\"pointermove\", this.onPointerMove);\n window.addEventListener(\"pointerup\", this.onPointerUp);\n this._input = INPUT.CURSOR;\n this._button = event.button;\n this.onSinglePanStart(event, this._mouseOp);\n }\n }\n });\n __publicField(this, \"onPointerMove\", (event) => {\n if (event.pointerType == \"touch\" && this._input != INPUT.CURSOR) {\n switch (this._input) {\n case INPUT.ONE_FINGER:\n this.updateTouchEvent(event);\n this.onSinglePanMove(event, STATE.ROTATE);\n break;\n case INPUT.ONE_FINGER_SWITCHED:\n const movement = this.calculatePointersDistance(this._touchCurrent[0], event) * this._devPxRatio;\n if (movement >= this._switchSensibility) {\n this._input = INPUT.ONE_FINGER;\n this.updateTouchEvent(event);\n this.onSinglePanStart(event, \"ROTATE\");\n break;\n }\n break;\n case INPUT.TWO_FINGER:\n this.updateTouchEvent(event);\n this.onRotateMove();\n this.onPinchMove();\n this.onDoublePanMove();\n break;\n case INPUT.MULT_FINGER:\n this.updateTouchEvent(event);\n this.onTriplePanMove();\n break;\n }\n } else if (event.pointerType != \"touch\" && this._input == INPUT.CURSOR) {\n let modifier = null;\n if (event.ctrlKey || event.metaKey) {\n modifier = \"CTRL\";\n } else if (event.shiftKey) {\n modifier = \"SHIFT\";\n }\n const mouseOpState = this.getOpStateFromAction(this._button, modifier);\n if (mouseOpState) {\n this.onSinglePanMove(event, mouseOpState);\n }\n }\n if (this._downValid) {\n const movement = this.calculatePointersDistance(this._downEvents[this._downEvents.length - 1], event) * this._devPxRatio;\n if (movement > this._movementThreshold) {\n this._downValid = false;\n }\n }\n });\n __publicField(this, \"onPointerUp\", (event) => {\n if (event.pointerType == \"touch\" && this._input != INPUT.CURSOR) {\n const nTouch = this._touchCurrent.length;\n for (let i2 = 0; i2 < nTouch; i2++) {\n if (this._touchCurrent[i2].pointerId == event.pointerId) {\n this._touchCurrent.splice(i2, 1);\n this._touchStart.splice(i2, 1);\n break;\n }\n }\n switch (this._input) {\n case INPUT.ONE_FINGER:\n case INPUT.ONE_FINGER_SWITCHED:\n window.removeEventListener(\"pointermove\", this.onPointerMove);\n window.removeEventListener(\"pointerup\", this.onPointerUp);\n this._input = INPUT.NONE;\n this.onSinglePanEnd();\n break;\n case INPUT.TWO_FINGER:\n this.onDoublePanEnd();\n this.onPinchEnd();\n this.onRotateEnd();\n this._input = INPUT.ONE_FINGER_SWITCHED;\n break;\n case INPUT.MULT_FINGER:\n if (this._touchCurrent.length == 0) {\n window.removeEventListener(\"pointermove\", this.onPointerMove);\n window.removeEventListener(\"pointerup\", this.onPointerUp);\n this._input = INPUT.NONE;\n this.onTriplePanEnd();\n }\n break;\n }\n } else if (event.pointerType != \"touch\" && this._input == INPUT.CURSOR) {\n window.removeEventListener(\"pointermove\", this.onPointerMove);\n window.removeEventListener(\"pointerup\", this.onPointerUp);\n this._input = INPUT.NONE;\n this.onSinglePanEnd();\n this._button = -1;\n }\n if (event.isPrimary) {\n if (this._downValid) {\n const downTime = event.timeStamp - this._downEvents[this._downEvents.length - 1].timeStamp;\n if (downTime <= this._maxDownTime) {\n if (this._nclicks == 0) {\n this._nclicks = 1;\n this._clickStart = performance.now();\n } else {\n const clickInterval = event.timeStamp - this._clickStart;\n const movement = this.calculatePointersDistance(this._downEvents[1], this._downEvents[0]) * this._devPxRatio;\n if (clickInterval <= this._maxInterval && movement <= this._posThreshold) {\n this._nclicks = 0;\n this._downEvents.splice(0, this._downEvents.length);\n this.onDoubleTap(event);\n } else {\n this._nclicks = 1;\n this._downEvents.shift();\n this._clickStart = performance.now();\n }\n }\n } else {\n this._downValid = false;\n this._nclicks = 0;\n this._downEvents.splice(0, this._downEvents.length);\n }\n } else {\n this._nclicks = 0;\n this._downEvents.splice(0, this._downEvents.length);\n }\n }\n });\n __publicField(this, \"onWheel\", (event) => {\n var _a2, _b2;\n if (this.enabled && this.enableZoom && this.domElement) {\n let modifier = null;\n if (event.ctrlKey || event.metaKey) {\n modifier = \"CTRL\";\n } else if (event.shiftKey) {\n modifier = \"SHIFT\";\n }\n const mouseOp = this.getOpFromAction(\"WHEEL\", modifier);\n if (mouseOp) {\n event.preventDefault();\n this.dispatchEvent(_startEvent);\n const notchDeltaY = 125;\n let sgn = event.deltaY / notchDeltaY;\n let size2 = 1;\n if (sgn > 0) {\n size2 = 1 / this.scaleFactor;\n } else if (sgn < 0) {\n size2 = this.scaleFactor;\n }\n switch (mouseOp) {\n case \"ZOOM\":\n this.updateTbState(STATE.SCALE, true);\n if (sgn > 0) {\n size2 = 1 / Math.pow(this.scaleFactor, sgn);\n } else if (sgn < 0) {\n size2 = Math.pow(this.scaleFactor, -sgn);\n }\n if (this.cursorZoom && this.enablePan) {\n let scalePoint;\n if (this.camera instanceof three__WEBPACK_IMPORTED_MODULE_42__.OrthographicCamera) {\n scalePoint = (_a2 = this.unprojectOnTbPlane(this.camera, event.clientX, event.clientY, this.domElement)) == null ? void 0 : _a2.applyQuaternion(this.camera.quaternion).multiplyScalar(1 / this.camera.zoom).add(this._gizmos.position);\n }\n if (this.camera instanceof three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera) {\n scalePoint = (_b2 = this.unprojectOnTbPlane(this.camera, event.clientX, event.clientY, this.domElement)) == null ? void 0 : _b2.applyQuaternion(this.camera.quaternion).add(this._gizmos.position);\n }\n if (scalePoint !== void 0)\n this.applyTransformMatrix(this.applyScale(size2, scalePoint));\n } else {\n this.applyTransformMatrix(this.applyScale(size2, this._gizmos.position));\n }\n if (this._grid) {\n this.disposeGrid();\n this.drawGrid();\n }\n this.updateTbState(STATE.IDLE, false);\n this.dispatchEvent(_changeEvent);\n this.dispatchEvent(_endEvent);\n break;\n case \"FOV\":\n if (this.camera instanceof three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera) {\n this.updateTbState(STATE.FOV, true);\n if (event.deltaX != 0) {\n sgn = event.deltaX / notchDeltaY;\n size2 = 1;\n if (sgn > 0) {\n size2 = 1 / Math.pow(this.scaleFactor, sgn);\n } else if (sgn < 0) {\n size2 = Math.pow(this.scaleFactor, -sgn);\n }\n }\n this._v3_1.setFromMatrixPosition(this._cameraMatrixState);\n const x = this._v3_1.distanceTo(this._gizmos.position);\n let xNew = x / size2;\n xNew = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.clamp(xNew, this.minDistance, this.maxDistance);\n const y = x * Math.tan(three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.DEG2RAD * this.camera.fov * 0.5);\n let newFov = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.RAD2DEG * (Math.atan(y / xNew) * 2);\n if (newFov > this.maxFov) {\n newFov = this.maxFov;\n } else if (newFov < this.minFov) {\n newFov = this.minFov;\n }\n const newDistance = y / Math.tan(three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.DEG2RAD * (newFov / 2));\n size2 = x / newDistance;\n this.setFov(newFov);\n this.applyTransformMatrix(this.applyScale(size2, this._gizmos.position, false));\n }\n if (this._grid) {\n this.disposeGrid();\n this.drawGrid();\n }\n this.updateTbState(STATE.IDLE, false);\n this.dispatchEvent(_changeEvent);\n this.dispatchEvent(_endEvent);\n break;\n }\n }\n }\n });\n __publicField(this, \"onSinglePanStart\", (event, operation) => {\n if (this.enabled && this.domElement) {\n this.dispatchEvent(_startEvent);\n this.setCenter(event.clientX, event.clientY);\n switch (operation) {\n case \"PAN\":\n if (!this.enablePan)\n return;\n if (this._animationId != -1) {\n cancelAnimationFrame(this._animationId);\n this._animationId = -1;\n this._timeStart = -1;\n this.activateGizmos(false);\n this.dispatchEvent(_changeEvent);\n }\n if (this.camera) {\n this.updateTbState(STATE.PAN, true);\n const rayDir = this.unprojectOnTbPlane(this.camera, _center$1.x, _center$1.y, this.domElement);\n if (rayDir !== void 0) {\n this._startCursorPosition.copy(rayDir);\n }\n if (this.enableGrid) {\n this.drawGrid();\n this.dispatchEvent(_changeEvent);\n }\n }\n break;\n case \"ROTATE\":\n if (!this.enableRotate)\n return;\n if (this._animationId != -1) {\n cancelAnimationFrame(this._animationId);\n this._animationId = -1;\n this._timeStart = -1;\n }\n if (this.camera) {\n this.updateTbState(STATE.ROTATE, true);\n const rayDir = this.unprojectOnTbSurface(this.camera, _center$1.x, _center$1.y, this.domElement, this._tbRadius);\n if (rayDir !== void 0) {\n this._startCursorPosition.copy(rayDir);\n }\n this.activateGizmos(true);\n if (this.enableAnimations) {\n this._timePrev = this._timeCurrent = performance.now();\n this._angleCurrent = this._anglePrev = 0;\n this._cursorPosPrev.copy(this._startCursorPosition);\n this._cursorPosCurr.copy(this._cursorPosPrev);\n this._wCurr = 0;\n this._wPrev = this._wCurr;\n }\n }\n this.dispatchEvent(_changeEvent);\n break;\n case \"FOV\":\n if (!this.enableZoom)\n return;\n if (this.camera instanceof three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera) {\n if (this._animationId != -1) {\n cancelAnimationFrame(this._animationId);\n this._animationId = -1;\n this._timeStart = -1;\n this.activateGizmos(false);\n this.dispatchEvent(_changeEvent);\n }\n this.updateTbState(STATE.FOV, true);\n this._startCursorPosition.setY(this.getCursorNDC(_center$1.x, _center$1.y, this.domElement).y * 0.5);\n this._currentCursorPosition.copy(this._startCursorPosition);\n }\n break;\n case \"ZOOM\":\n if (!this.enableZoom)\n return;\n if (this._animationId != -1) {\n cancelAnimationFrame(this._animationId);\n this._animationId = -1;\n this._timeStart = -1;\n this.activateGizmos(false);\n this.dispatchEvent(_changeEvent);\n }\n this.updateTbState(STATE.SCALE, true);\n this._startCursorPosition.setY(this.getCursorNDC(_center$1.x, _center$1.y, this.domElement).y * 0.5);\n this._currentCursorPosition.copy(this._startCursorPosition);\n break;\n }\n }\n });\n __publicField(this, \"onSinglePanMove\", (event, opState) => {\n if (this.enabled && this.domElement) {\n const restart = opState != this._state;\n this.setCenter(event.clientX, event.clientY);\n switch (opState) {\n case STATE.PAN:\n if (this.enablePan && this.camera) {\n if (restart) {\n this.dispatchEvent(_endEvent);\n this.dispatchEvent(_startEvent);\n this.updateTbState(opState, true);\n const rayDir = this.unprojectOnTbPlane(this.camera, _center$1.x, _center$1.y, this.domElement);\n if (rayDir !== void 0) {\n this._startCursorPosition.copy(rayDir);\n }\n if (this.enableGrid) {\n this.drawGrid();\n }\n this.activateGizmos(false);\n } else {\n const rayDir = this.unprojectOnTbPlane(this.camera, _center$1.x, _center$1.y, this.domElement);\n if (rayDir !== void 0) {\n this._currentCursorPosition.copy(rayDir);\n }\n this.applyTransformMatrix(this.pan(this._startCursorPosition, this._currentCursorPosition));\n }\n }\n break;\n case STATE.ROTATE:\n if (this.enableRotate && this.camera) {\n if (restart) {\n this.dispatchEvent(_endEvent);\n this.dispatchEvent(_startEvent);\n this.updateTbState(opState, true);\n const rayDir = this.unprojectOnTbSurface(\n this.camera,\n _center$1.x,\n _center$1.y,\n this.domElement,\n this._tbRadius\n );\n if (rayDir !== void 0) {\n this._startCursorPosition.copy(rayDir);\n }\n if (this.enableGrid) {\n this.disposeGrid();\n }\n this.activateGizmos(true);\n } else {\n const rayDir = this.unprojectOnTbSurface(\n this.camera,\n _center$1.x,\n _center$1.y,\n this.domElement,\n this._tbRadius\n );\n if (rayDir !== void 0) {\n this._currentCursorPosition.copy(rayDir);\n }\n const distance = this._startCursorPosition.distanceTo(this._currentCursorPosition);\n const angle = this._startCursorPosition.angleTo(this._currentCursorPosition);\n const amount = Math.max(distance / this._tbRadius, angle);\n this.applyTransformMatrix(\n this.rotate(this.calculateRotationAxis(this._startCursorPosition, this._currentCursorPosition), amount)\n );\n if (this.enableAnimations) {\n this._timePrev = this._timeCurrent;\n this._timeCurrent = performance.now();\n this._anglePrev = this._angleCurrent;\n this._angleCurrent = amount;\n this._cursorPosPrev.copy(this._cursorPosCurr);\n this._cursorPosCurr.copy(this._currentCursorPosition);\n this._wPrev = this._wCurr;\n this._wCurr = this.calculateAngularSpeed(\n this._anglePrev,\n this._angleCurrent,\n this._timePrev,\n this._timeCurrent\n );\n }\n }\n }\n break;\n case STATE.SCALE:\n if (this.enableZoom) {\n if (restart) {\n this.dispatchEvent(_endEvent);\n this.dispatchEvent(_startEvent);\n this.updateTbState(opState, true);\n this._startCursorPosition.setY(this.getCursorNDC(_center$1.x, _center$1.y, this.domElement).y * 0.5);\n this._currentCursorPosition.copy(this._startCursorPosition);\n if (this.enableGrid) {\n this.disposeGrid();\n }\n this.activateGizmos(false);\n } else {\n const screenNotches = 8;\n this._currentCursorPosition.setY(this.getCursorNDC(_center$1.x, _center$1.y, this.domElement).y * 0.5);\n const movement = this._currentCursorPosition.y - this._startCursorPosition.y;\n let size2 = 1;\n if (movement < 0) {\n size2 = 1 / Math.pow(this.scaleFactor, -movement * screenNotches);\n } else if (movement > 0) {\n size2 = Math.pow(this.scaleFactor, movement * screenNotches);\n }\n this.applyTransformMatrix(this.applyScale(size2, this._gizmos.position));\n }\n }\n break;\n case STATE.FOV:\n if (this.enableZoom && this.camera instanceof three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera) {\n if (restart) {\n this.dispatchEvent(_endEvent);\n this.dispatchEvent(_startEvent);\n this.updateTbState(opState, true);\n this._startCursorPosition.setY(this.getCursorNDC(_center$1.x, _center$1.y, this.domElement).y * 0.5);\n this._currentCursorPosition.copy(this._startCursorPosition);\n if (this.enableGrid) {\n this.disposeGrid();\n }\n this.activateGizmos(false);\n } else {\n const screenNotches = 8;\n this._currentCursorPosition.setY(this.getCursorNDC(_center$1.x, _center$1.y, this.domElement).y * 0.5);\n const movement = this._currentCursorPosition.y - this._startCursorPosition.y;\n let size2 = 1;\n if (movement < 0) {\n size2 = 1 / Math.pow(this.scaleFactor, -movement * screenNotches);\n } else if (movement > 0) {\n size2 = Math.pow(this.scaleFactor, movement * screenNotches);\n }\n this._v3_1.setFromMatrixPosition(this._cameraMatrixState);\n const x = this._v3_1.distanceTo(this._gizmos.position);\n let xNew = x / size2;\n xNew = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.clamp(xNew, this.minDistance, this.maxDistance);\n const y = x * Math.tan(three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.DEG2RAD * this._fovState * 0.5);\n let newFov = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.RAD2DEG * (Math.atan(y / xNew) * 2);\n newFov = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.clamp(newFov, this.minFov, this.maxFov);\n const newDistance = y / Math.tan(three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.DEG2RAD * (newFov / 2));\n size2 = x / newDistance;\n this._v3_2.setFromMatrixPosition(this._gizmoMatrixState);\n this.setFov(newFov);\n this.applyTransformMatrix(this.applyScale(size2, this._v3_2, false));\n const direction = this._gizmos.position.clone().sub(this.camera.position).normalize().multiplyScalar(newDistance / x);\n this._m4_1.makeTranslation(direction.x, direction.y, direction.z);\n }\n }\n break;\n }\n this.dispatchEvent(_changeEvent);\n }\n });\n __publicField(this, \"onSinglePanEnd\", () => {\n if (this._state == STATE.ROTATE) {\n if (!this.enableRotate) {\n return;\n }\n if (this.enableAnimations) {\n const deltaTime = performance.now() - this._timeCurrent;\n if (deltaTime < 120) {\n const w = Math.abs((this._wPrev + this._wCurr) / 2);\n const self2 = this;\n this._animationId = window.requestAnimationFrame(function(t2) {\n self2.updateTbState(STATE.ANIMATION_ROTATE, true);\n const rotationAxis = self2.calculateRotationAxis(self2._cursorPosPrev, self2._cursorPosCurr);\n self2.onRotationAnim(t2, rotationAxis, Math.min(w, self2.wMax));\n });\n } else {\n this.updateTbState(STATE.IDLE, false);\n this.activateGizmos(false);\n this.dispatchEvent(_changeEvent);\n }\n } else {\n this.updateTbState(STATE.IDLE, false);\n this.activateGizmos(false);\n this.dispatchEvent(_changeEvent);\n }\n } else if (this._state == STATE.PAN || this._state == STATE.IDLE) {\n this.updateTbState(STATE.IDLE, false);\n if (this.enableGrid) {\n this.disposeGrid();\n }\n this.activateGizmos(false);\n this.dispatchEvent(_changeEvent);\n }\n this.dispatchEvent(_endEvent);\n });\n __publicField(this, \"onDoubleTap\", (event) => {\n if (this.enabled && this.enablePan && this.scene && this.camera && this.domElement) {\n this.dispatchEvent(_startEvent);\n this.setCenter(event.clientX, event.clientY);\n const hitP = this.unprojectOnObj(this.getCursorNDC(_center$1.x, _center$1.y, this.domElement), this.camera);\n if (hitP && this.enableAnimations) {\n const self2 = this;\n if (this._animationId != -1) {\n window.cancelAnimationFrame(this._animationId);\n }\n this._timeStart = -1;\n this._animationId = window.requestAnimationFrame(function(t2) {\n self2.updateTbState(STATE.ANIMATION_FOCUS, true);\n self2.onFocusAnim(t2, hitP, self2._cameraMatrixState, self2._gizmoMatrixState);\n });\n } else if (hitP && !this.enableAnimations) {\n this.updateTbState(STATE.FOCUS, true);\n this.focus(hitP, this.scaleFactor);\n this.updateTbState(STATE.IDLE, false);\n this.dispatchEvent(_changeEvent);\n }\n }\n this.dispatchEvent(_endEvent);\n });\n __publicField(this, \"onDoublePanStart\", () => {\n if (this.enabled && this.enablePan && this.camera && this.domElement) {\n this.dispatchEvent(_startEvent);\n this.updateTbState(STATE.PAN, true);\n this.setCenter(\n (this._touchCurrent[0].clientX + this._touchCurrent[1].clientX) / 2,\n (this._touchCurrent[0].clientY + this._touchCurrent[1].clientY) / 2\n );\n const rayDir = this.unprojectOnTbPlane(this.camera, _center$1.x, _center$1.y, this.domElement, true);\n if (rayDir !== void 0) {\n this._startCursorPosition.copy(rayDir);\n }\n this._currentCursorPosition.copy(this._startCursorPosition);\n this.activateGizmos(false);\n }\n });\n __publicField(this, \"onDoublePanMove\", () => {\n if (this.enabled && this.enablePan && this.camera && this.domElement) {\n this.setCenter(\n (this._touchCurrent[0].clientX + this._touchCurrent[1].clientX) / 2,\n (this._touchCurrent[0].clientY + this._touchCurrent[1].clientY) / 2\n );\n if (this._state != STATE.PAN) {\n this.updateTbState(STATE.PAN, true);\n this._startCursorPosition.copy(this._currentCursorPosition);\n }\n const rayDir = this.unprojectOnTbPlane(this.camera, _center$1.x, _center$1.y, this.domElement, true);\n if (rayDir !== void 0)\n this._currentCursorPosition.copy(rayDir);\n this.applyTransformMatrix(this.pan(this._startCursorPosition, this._currentCursorPosition, true));\n this.dispatchEvent(_changeEvent);\n }\n });\n __publicField(this, \"onDoublePanEnd\", () => {\n this.updateTbState(STATE.IDLE, false);\n this.dispatchEvent(_endEvent);\n });\n __publicField(this, \"onRotateStart\", () => {\n var _a2;\n if (this.enabled && this.enableRotate) {\n this.dispatchEvent(_startEvent);\n this.updateTbState(STATE.ZROTATE, true);\n this._startFingerRotation = this.getAngle(this._touchCurrent[1], this._touchCurrent[0]) + this.getAngle(this._touchStart[1], this._touchStart[0]);\n this._currentFingerRotation = this._startFingerRotation;\n (_a2 = this.camera) == null ? void 0 : _a2.getWorldDirection(this._rotationAxis);\n if (!this.enablePan && !this.enableZoom) {\n this.activateGizmos(true);\n }\n }\n });\n __publicField(this, \"onRotateMove\", () => {\n var _a2;\n if (this.enabled && this.enableRotate && this.camera && this.domElement) {\n this.setCenter(\n (this._touchCurrent[0].clientX + this._touchCurrent[1].clientX) / 2,\n (this._touchCurrent[0].clientY + this._touchCurrent[1].clientY) / 2\n );\n let rotationPoint;\n if (this._state != STATE.ZROTATE) {\n this.updateTbState(STATE.ZROTATE, true);\n this._startFingerRotation = this._currentFingerRotation;\n }\n this._currentFingerRotation = this.getAngle(this._touchCurrent[1], this._touchCurrent[0]) + this.getAngle(this._touchStart[1], this._touchStart[0]);\n if (!this.enablePan) {\n rotationPoint = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3().setFromMatrixPosition(this._gizmoMatrixState);\n } else if (this.camera) {\n this._v3_2.setFromMatrixPosition(this._gizmoMatrixState);\n rotationPoint = (_a2 = this.unprojectOnTbPlane(this.camera, _center$1.x, _center$1.y, this.domElement)) == null ? void 0 : _a2.applyQuaternion(this.camera.quaternion).multiplyScalar(1 / this.camera.zoom).add(this._v3_2);\n }\n const amount = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.DEG2RAD * (this._startFingerRotation - this._currentFingerRotation);\n if (rotationPoint !== void 0) {\n this.applyTransformMatrix(this.zRotate(rotationPoint, amount));\n }\n this.dispatchEvent(_changeEvent);\n }\n });\n __publicField(this, \"onRotateEnd\", () => {\n this.updateTbState(STATE.IDLE, false);\n this.activateGizmos(false);\n this.dispatchEvent(_endEvent);\n });\n __publicField(this, \"onPinchStart\", () => {\n if (this.enabled && this.enableZoom) {\n this.dispatchEvent(_startEvent);\n this.updateTbState(STATE.SCALE, true);\n this._startFingerDistance = this.calculatePointersDistance(this._touchCurrent[0], this._touchCurrent[1]);\n this._currentFingerDistance = this._startFingerDistance;\n this.activateGizmos(false);\n }\n });\n __publicField(this, \"onPinchMove\", () => {\n var _a2, _b2;\n if (this.enabled && this.enableZoom && this.domElement) {\n this.setCenter(\n (this._touchCurrent[0].clientX + this._touchCurrent[1].clientX) / 2,\n (this._touchCurrent[0].clientY + this._touchCurrent[1].clientY) / 2\n );\n const minDistance = 12;\n if (this._state != STATE.SCALE) {\n this._startFingerDistance = this._currentFingerDistance;\n this.updateTbState(STATE.SCALE, true);\n }\n this._currentFingerDistance = Math.max(\n this.calculatePointersDistance(this._touchCurrent[0], this._touchCurrent[1]),\n minDistance * this._devPxRatio\n );\n const amount = this._currentFingerDistance / this._startFingerDistance;\n let scalePoint;\n if (!this.enablePan) {\n scalePoint = this._gizmos.position;\n } else {\n if (this.camera instanceof three__WEBPACK_IMPORTED_MODULE_42__.OrthographicCamera) {\n scalePoint = (_a2 = this.unprojectOnTbPlane(this.camera, _center$1.x, _center$1.y, this.domElement)) == null ? void 0 : _a2.applyQuaternion(this.camera.quaternion).multiplyScalar(1 / this.camera.zoom).add(this._gizmos.position);\n } else if (this.camera instanceof three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera) {\n scalePoint = (_b2 = this.unprojectOnTbPlane(this.camera, _center$1.x, _center$1.y, this.domElement)) == null ? void 0 : _b2.applyQuaternion(this.camera.quaternion).add(this._gizmos.position);\n }\n }\n if (scalePoint !== void 0) {\n this.applyTransformMatrix(this.applyScale(amount, scalePoint));\n }\n this.dispatchEvent(_changeEvent);\n }\n });\n __publicField(this, \"onPinchEnd\", () => {\n this.updateTbState(STATE.IDLE, false);\n this.dispatchEvent(_endEvent);\n });\n __publicField(this, \"onTriplePanStart\", () => {\n if (this.enabled && this.enableZoom && this.domElement) {\n this.dispatchEvent(_startEvent);\n this.updateTbState(STATE.SCALE, true);\n let clientX = 0;\n let clientY = 0;\n const nFingers = this._touchCurrent.length;\n for (let i2 = 0; i2 < nFingers; i2++) {\n clientX += this._touchCurrent[i2].clientX;\n clientY += this._touchCurrent[i2].clientY;\n }\n this.setCenter(clientX / nFingers, clientY / nFingers);\n this._startCursorPosition.setY(this.getCursorNDC(_center$1.x, _center$1.y, this.domElement).y * 0.5);\n this._currentCursorPosition.copy(this._startCursorPosition);\n }\n });\n __publicField(this, \"onTriplePanMove\", () => {\n if (this.enabled && this.enableZoom && this.camera && this.domElement) {\n let clientX = 0;\n let clientY = 0;\n const nFingers = this._touchCurrent.length;\n for (let i2 = 0; i2 < nFingers; i2++) {\n clientX += this._touchCurrent[i2].clientX;\n clientY += this._touchCurrent[i2].clientY;\n }\n this.setCenter(clientX / nFingers, clientY / nFingers);\n const screenNotches = 8;\n this._currentCursorPosition.setY(this.getCursorNDC(_center$1.x, _center$1.y, this.domElement).y * 0.5);\n const movement = this._currentCursorPosition.y - this._startCursorPosition.y;\n let size2 = 1;\n if (movement < 0) {\n size2 = 1 / Math.pow(this.scaleFactor, -movement * screenNotches);\n } else if (movement > 0) {\n size2 = Math.pow(this.scaleFactor, movement * screenNotches);\n }\n this._v3_1.setFromMatrixPosition(this._cameraMatrixState);\n const x = this._v3_1.distanceTo(this._gizmos.position);\n let xNew = x / size2;\n xNew = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.clamp(xNew, this.minDistance, this.maxDistance);\n const y = x * Math.tan(three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.DEG2RAD * this._fovState * 0.5);\n let newFov = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.RAD2DEG * (Math.atan(y / xNew) * 2);\n newFov = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.clamp(newFov, this.minFov, this.maxFov);\n const newDistance = y / Math.tan(three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.DEG2RAD * (newFov / 2));\n size2 = x / newDistance;\n this._v3_2.setFromMatrixPosition(this._gizmoMatrixState);\n this.setFov(newFov);\n this.applyTransformMatrix(this.applyScale(size2, this._v3_2, false));\n const direction = this._gizmos.position.clone().sub(this.camera.position).normalize().multiplyScalar(newDistance / x);\n this._m4_1.makeTranslation(direction.x, direction.y, direction.z);\n this.dispatchEvent(_changeEvent);\n }\n });\n __publicField(this, \"onTriplePanEnd\", () => {\n this.updateTbState(STATE.IDLE, false);\n this.dispatchEvent(_endEvent);\n });\n /**\n * Set _center's x/y coordinates\n * @param {Number} clientX\n * @param {Number} clientY\n */\n __publicField(this, \"setCenter\", (clientX, clientY) => {\n _center$1.x = clientX;\n _center$1.y = clientY;\n });\n /**\n * Set default mouse actions\n */\n __publicField(this, \"initializeMouseActions\", () => {\n this.setMouseAction(\"PAN\", 0, \"CTRL\");\n this.setMouseAction(\"PAN\", 2);\n this.setMouseAction(\"ROTATE\", 0);\n this.setMouseAction(\"ZOOM\", \"WHEEL\");\n this.setMouseAction(\"ZOOM\", 1);\n this.setMouseAction(\"FOV\", \"WHEEL\", \"SHIFT\");\n this.setMouseAction(\"FOV\", 1, \"SHIFT\");\n });\n /**\n * Set a new mouse action by specifying the operation to be performed and a mouse/key combination. In case of conflict, replaces the existing one\n * @param {String} operation The operation to be performed ('PAN', 'ROTATE', 'ZOOM', 'FOV)\n * @param {*} mouse A mouse button (0, 1, 2) or 'WHEEL' for wheel notches\n * @param {*} key The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed\n * @returns {Boolean} True if the mouse action has been successfully added, false otherwise\n */\n __publicField(this, \"setMouseAction\", (operation, mouse, key = null) => {\n const operationInput = [\"PAN\", \"ROTATE\", \"ZOOM\", \"FOV\"];\n const mouseInput = [0, 1, 2, \"WHEEL\"];\n const keyInput = [\"CTRL\", \"SHIFT\", null];\n let state;\n if (!operationInput.includes(operation) || !mouseInput.includes(mouse) || !keyInput.includes(key)) {\n return false;\n }\n if (mouse == \"WHEEL\") {\n if (operation != \"ZOOM\" && operation != \"FOV\") {\n return false;\n }\n }\n switch (operation) {\n case \"PAN\":\n state = STATE.PAN;\n break;\n case \"ROTATE\":\n state = STATE.ROTATE;\n break;\n case \"ZOOM\":\n state = STATE.SCALE;\n break;\n case \"FOV\":\n state = STATE.FOV;\n break;\n }\n const action = {\n operation,\n mouse,\n key,\n state\n };\n for (let i2 = 0; i2 < this.mouseActions.length; i2++) {\n if (this.mouseActions[i2].mouse == action.mouse && this.mouseActions[i2].key == action.key) {\n this.mouseActions.splice(i2, 1, action);\n return true;\n }\n }\n this.mouseActions.push(action);\n return true;\n });\n /**\n * Return the operation associated to a mouse/keyboard combination\n * @param {*} mouse A mouse button (0, 1, 2) or 'WHEEL' for wheel notches\n * @param {*} key The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed\n * @returns The operation if it has been found, null otherwise\n */\n __publicField(this, \"getOpFromAction\", (mouse, key) => {\n let action;\n for (let i2 = 0; i2 < this.mouseActions.length; i2++) {\n action = this.mouseActions[i2];\n if (action.mouse == mouse && action.key == key) {\n return action.operation;\n }\n }\n if (key) {\n for (let i2 = 0; i2 < this.mouseActions.length; i2++) {\n action = this.mouseActions[i2];\n if (action.mouse == mouse && action.key == null) {\n return action.operation;\n }\n }\n }\n return null;\n });\n /**\n * Get the operation associated to mouse and key combination and returns the corresponding FSA state\n * @param {Number} mouse Mouse button\n * @param {String} key Keyboard modifier\n * @returns The FSA state obtained from the operation associated to mouse/keyboard combination\n */\n __publicField(this, \"getOpStateFromAction\", (mouse, key) => {\n let action;\n for (let i2 = 0; i2 < this.mouseActions.length; i2++) {\n action = this.mouseActions[i2];\n if (action.mouse == mouse && action.key == key) {\n return action.state;\n }\n }\n if (key) {\n for (let i2 = 0; i2 < this.mouseActions.length; i2++) {\n action = this.mouseActions[i2];\n if (action.mouse == mouse && action.key == null) {\n return action.state;\n }\n }\n }\n return null;\n });\n /**\n * Calculate the angle between two pointers\n * @param {PointerEvent} p1\n * @param {PointerEvent} p2\n * @returns {Number} The angle between two pointers in degrees\n */\n __publicField(this, \"getAngle\", (p1, p2) => {\n return Math.atan2(p2.clientY - p1.clientY, p2.clientX - p1.clientX) * 180 / Math.PI;\n });\n /**\n * Update a PointerEvent inside current pointerevents array\n * @param {PointerEvent} event\n */\n __publicField(this, \"updateTouchEvent\", (event) => {\n for (let i2 = 0; i2 < this._touchCurrent.length; i2++) {\n if (this._touchCurrent[i2].pointerId == event.pointerId) {\n this._touchCurrent.splice(i2, 1, event);\n break;\n }\n }\n });\n /**\n * Calculate the angular speed\n * @param {Number} p0 Position at t0\n * @param {Number} p1 Position at t1\n * @param {Number} t0 Initial time in milliseconds\n * @param {Number} t1 Ending time in milliseconds\n */\n __publicField(this, \"calculateAngularSpeed\", (p0, p1, t0, t1) => {\n const s = p1 - p0;\n const t2 = (t1 - t0) / 1e3;\n if (t2 == 0) {\n return 0;\n }\n return s / t2;\n });\n /**\n * Calculate the distance between two pointers\n * @param {PointerEvent} p0 The first pointer\n * @param {PointerEvent} p1 The second pointer\n * @returns {number} The distance between the two pointers\n */\n __publicField(this, \"calculatePointersDistance\", (p0, p1) => {\n return Math.sqrt(Math.pow(p1.clientX - p0.clientX, 2) + Math.pow(p1.clientY - p0.clientY, 2));\n });\n /**\n * Calculate the rotation axis as the vector perpendicular between two vectors\n * @param {Vector3} vec1 The first vector\n * @param {Vector3} vec2 The second vector\n * @returns {Vector3} The normalized rotation axis\n */\n __publicField(this, \"calculateRotationAxis\", (vec1, vec2) => {\n this._rotationMatrix.extractRotation(this._cameraMatrixState);\n this._quat.setFromRotationMatrix(this._rotationMatrix);\n this._rotationAxis.crossVectors(vec1, vec2).applyQuaternion(this._quat);\n return this._rotationAxis.normalize().clone();\n });\n /**\n * Calculate the trackball radius so that gizmo's diamater will be 2/3 of the minimum side of the camera frustum\n * @param {Camera} camera\n * @returns {Number} The trackball radius\n */\n __publicField(this, \"calculateTbRadius\", (camera) => {\n const factor = 0.67;\n const distance = camera.position.distanceTo(this._gizmos.position);\n if (camera instanceof three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera) {\n const halfFovV = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.DEG2RAD * camera.fov * 0.5;\n const halfFovH = Math.atan(camera.aspect * Math.tan(halfFovV));\n return Math.tan(Math.min(halfFovV, halfFovH)) * distance * factor;\n } else if (camera instanceof three__WEBPACK_IMPORTED_MODULE_42__.OrthographicCamera) {\n return Math.min(camera.top, camera.right) * factor;\n }\n });\n /**\n * Focus operation consist of positioning the point of interest in front of the camera and a slightly zoom in\n * @param {Vector3} point The point of interest\n * @param {Number} size Scale factor\n * @param {Number} amount Amount of operation to be completed (used for focus animations, default is complete full operation)\n */\n __publicField(this, \"focus\", (point, size2, amount = 1) => {\n if (this.camera) {\n const focusPoint = point.clone();\n focusPoint.sub(this._gizmos.position).multiplyScalar(amount);\n this._translationMatrix.makeTranslation(focusPoint.x, focusPoint.y, focusPoint.z);\n const gizmoStateTemp = this._gizmoMatrixState.clone();\n this._gizmoMatrixState.premultiply(this._translationMatrix);\n this._gizmoMatrixState.decompose(this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale);\n const cameraStateTemp = this._cameraMatrixState.clone();\n this._cameraMatrixState.premultiply(this._translationMatrix);\n this._cameraMatrixState.decompose(this.camera.position, this.camera.quaternion, this.camera.scale);\n if (this.enableZoom) {\n this.applyTransformMatrix(this.applyScale(size2, this._gizmos.position));\n }\n this._gizmoMatrixState.copy(gizmoStateTemp);\n this._cameraMatrixState.copy(cameraStateTemp);\n }\n });\n /**\n * Draw a grid and add it to the scene\n */\n __publicField(this, \"drawGrid\", () => {\n if (this.scene) {\n const color = 8947848;\n const multiplier = 3;\n let size2, divisions, maxLength, tick;\n if (this.camera instanceof three__WEBPACK_IMPORTED_MODULE_42__.OrthographicCamera) {\n const width = this.camera.right - this.camera.left;\n const height = this.camera.bottom - this.camera.top;\n maxLength = Math.max(width, height);\n tick = maxLength / 20;\n size2 = maxLength / this.camera.zoom * multiplier;\n divisions = size2 / tick * this.camera.zoom;\n } else if (this.camera instanceof three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera) {\n const distance = this.camera.position.distanceTo(this._gizmos.position);\n const halfFovV = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.DEG2RAD * this.camera.fov * 0.5;\n const halfFovH = Math.atan(this.camera.aspect * Math.tan(halfFovV));\n maxLength = Math.tan(Math.max(halfFovV, halfFovH)) * distance * 2;\n tick = maxLength / 20;\n size2 = maxLength * multiplier;\n divisions = size2 / tick;\n }\n if (this._grid == null && this.camera) {\n this._grid = new three__WEBPACK_IMPORTED_MODULE_42__.GridHelper(size2, divisions, color, color);\n this._grid.position.copy(this._gizmos.position);\n this._gridPosition.copy(this._grid.position);\n this._grid.quaternion.copy(this.camera.quaternion);\n this._grid.rotateX(Math.PI * 0.5);\n this.scene.add(this._grid);\n }\n }\n });\n __publicField(this, \"connect\", (domElement) => {\n if (domElement === document) {\n console.error(\n 'THREE.ArcballControls: \"document\" should not be used as the target \"domElement\". Please use \"renderer.domElement\" instead.'\n );\n }\n this.domElement = domElement;\n this.domElement.style.touchAction = \"none\";\n this.domElement.addEventListener(\"contextmenu\", this.onContextMenu);\n this.domElement.addEventListener(\"pointerdown\", this.onPointerDown);\n this.domElement.addEventListener(\"pointercancel\", this.onPointerCancel);\n this.domElement.addEventListener(\"wheel\", this.onWheel);\n });\n /**\n * Remove all listeners, stop animations and clean scene\n */\n __publicField(this, \"dispose\", () => {\n var _a2, _b2, _c, _d, _e;\n if (this._animationId != -1) {\n window.cancelAnimationFrame(this._animationId);\n }\n (_a2 = this.domElement) == null ? void 0 : _a2.removeEventListener(\"pointerdown\", this.onPointerDown);\n (_b2 = this.domElement) == null ? void 0 : _b2.removeEventListener(\"pointercancel\", this.onPointerCancel);\n (_c = this.domElement) == null ? void 0 : _c.removeEventListener(\"wheel\", this.onWheel);\n (_d = this.domElement) == null ? void 0 : _d.removeEventListener(\"contextmenu\", this.onContextMenu);\n window.removeEventListener(\"pointermove\", this.onPointerMove);\n window.removeEventListener(\"pointerup\", this.onPointerUp);\n window.removeEventListener(\"resize\", this.onWindowResize);\n (_e = this.scene) == null ? void 0 : _e.remove(this._gizmos);\n this.disposeGrid();\n });\n /**\n * remove the grid from the scene\n */\n __publicField(this, \"disposeGrid\", () => {\n if (this._grid && this.scene) {\n this.scene.remove(this._grid);\n this._grid = null;\n }\n });\n /**\n * Compute the easing out cubic function for ease out effect in animation\n * @param {Number} t The absolute progress of the animation in the bound of 0 (beginning of the) and 1 (ending of animation)\n * @returns {Number} Result of easing out cubic at time t\n */\n __publicField(this, \"easeOutCubic\", (t2) => {\n return 1 - Math.pow(1 - t2, 3);\n });\n /**\n * Make rotation gizmos more or less visible\n * @param {Boolean} isActive If true, make gizmos more visible\n */\n __publicField(this, \"activateGizmos\", (isActive) => {\n for (const gizmo of this._gizmos.children) {\n gizmo.material.setValues({ opacity: isActive ? 1 : 0.6 });\n }\n });\n /**\n * Calculate the cursor position in NDC\n * @param {number} x Cursor horizontal coordinate within the canvas\n * @param {number} y Cursor vertical coordinate within the canvas\n * @param {HTMLElement} canvas The canvas where the renderer draws its output\n * @returns {Vector2} Cursor normalized position inside the canvas\n */\n __publicField(this, \"getCursorNDC\", (cursorX, cursorY, canvas) => {\n const canvasRect = canvas.getBoundingClientRect();\n this._v2_1.setX((cursorX - canvasRect.left) / canvasRect.width * 2 - 1);\n this._v2_1.setY((canvasRect.bottom - cursorY) / canvasRect.height * 2 - 1);\n return this._v2_1.clone();\n });\n /**\n * Calculate the cursor position inside the canvas x/y coordinates with the origin being in the center of the canvas\n * @param {Number} x Cursor horizontal coordinate within the canvas\n * @param {Number} y Cursor vertical coordinate within the canvas\n * @param {HTMLElement} canvas The canvas where the renderer draws its output\n * @returns {Vector2} Cursor position inside the canvas\n */\n __publicField(this, \"getCursorPosition\", (cursorX, cursorY, canvas) => {\n this._v2_1.copy(this.getCursorNDC(cursorX, cursorY, canvas));\n if (this.camera instanceof three__WEBPACK_IMPORTED_MODULE_42__.OrthographicCamera) {\n this._v2_1.x *= (this.camera.right - this.camera.left) * 0.5;\n this._v2_1.y *= (this.camera.top - this.camera.bottom) * 0.5;\n }\n return this._v2_1.clone();\n });\n /**\n * Set the camera to be controlled\n * @param {Camera} camera The virtual camera to be controlled\n */\n __publicField(this, \"setCamera\", (camera) => {\n if (camera) {\n camera.lookAt(this.target);\n camera.updateMatrix();\n if (camera instanceof three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera) {\n this._fov0 = camera.fov;\n this._fovState = camera.fov;\n }\n this._cameraMatrixState0.copy(camera.matrix);\n this._cameraMatrixState.copy(this._cameraMatrixState0);\n this._cameraProjectionState.copy(camera.projectionMatrix);\n this._zoom0 = camera.zoom;\n this._zoomState = this._zoom0;\n this._initialNear = camera.near;\n this._nearPos0 = camera.position.distanceTo(this.target) - camera.near;\n this._nearPos = this._initialNear;\n this._initialFar = camera.far;\n this._farPos0 = camera.position.distanceTo(this.target) - camera.far;\n this._farPos = this._initialFar;\n this._up0.copy(camera.up);\n this._upState.copy(camera.up);\n this.camera = camera;\n this.camera.updateProjectionMatrix();\n const tbRadius = this.calculateTbRadius(camera);\n if (tbRadius !== void 0) {\n this._tbRadius = tbRadius;\n }\n this.makeGizmos(this.target, this._tbRadius);\n }\n });\n /**\n * Creates the rotation gizmos matching trackball center and radius\n * @param {Vector3} tbCenter The trackball center\n * @param {number} tbRadius The trackball radius\n */\n __publicField(this, \"makeGizmos\", (tbCenter, tbRadius) => {\n const curve = new three__WEBPACK_IMPORTED_MODULE_42__.EllipseCurve(0, 0, tbRadius, tbRadius);\n const points = curve.getPoints(this._curvePts);\n const curveGeometry = new three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry().setFromPoints(points);\n const curveMaterialX = new three__WEBPACK_IMPORTED_MODULE_42__.LineBasicMaterial({ color: 16744576, fog: false, transparent: true, opacity: 0.6 });\n const curveMaterialY = new three__WEBPACK_IMPORTED_MODULE_42__.LineBasicMaterial({ color: 8454016, fog: false, transparent: true, opacity: 0.6 });\n const curveMaterialZ = new three__WEBPACK_IMPORTED_MODULE_42__.LineBasicMaterial({ color: 8421631, fog: false, transparent: true, opacity: 0.6 });\n const gizmoX = new three__WEBPACK_IMPORTED_MODULE_42__.Line(curveGeometry, curveMaterialX);\n const gizmoY = new three__WEBPACK_IMPORTED_MODULE_42__.Line(curveGeometry, curveMaterialY);\n const gizmoZ = new three__WEBPACK_IMPORTED_MODULE_42__.Line(curveGeometry, curveMaterialZ);\n const rotation = Math.PI * 0.5;\n gizmoX.rotation.x = rotation;\n gizmoY.rotation.y = rotation;\n this._gizmoMatrixState0.identity().setPosition(tbCenter);\n this._gizmoMatrixState.copy(this._gizmoMatrixState0);\n if (this.camera && this.camera.zoom != 1) {\n const size2 = 1 / this.camera.zoom;\n this._scaleMatrix.makeScale(size2, size2, size2);\n this._translationMatrix.makeTranslation(-tbCenter.x, -tbCenter.y, -tbCenter.z);\n this._gizmoMatrixState.premultiply(this._translationMatrix).premultiply(this._scaleMatrix);\n this._translationMatrix.makeTranslation(tbCenter.x, tbCenter.y, tbCenter.z);\n this._gizmoMatrixState.premultiply(this._translationMatrix);\n }\n this._gizmoMatrixState.decompose(this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale);\n this._gizmos.clear();\n this._gizmos.add(gizmoX);\n this._gizmos.add(gizmoY);\n this._gizmos.add(gizmoZ);\n });\n /**\n * Perform animation for focus operation\n * @param {Number} time Instant in which this function is called as performance.now()\n * @param {Vector3} point Point of interest for focus operation\n * @param {Matrix4} cameraMatrix Camera matrix\n * @param {Matrix4} gizmoMatrix Gizmos matrix\n */\n __publicField(this, \"onFocusAnim\", (time, point, cameraMatrix, gizmoMatrix) => {\n if (this._timeStart == -1) {\n this._timeStart = time;\n }\n if (this._state == STATE.ANIMATION_FOCUS) {\n const deltaTime = time - this._timeStart;\n const animTime = deltaTime / this.focusAnimationTime;\n this._gizmoMatrixState.copy(gizmoMatrix);\n if (animTime >= 1) {\n this._gizmoMatrixState.decompose(this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale);\n this.focus(point, this.scaleFactor);\n this._timeStart = -1;\n this.updateTbState(STATE.IDLE, false);\n this.activateGizmos(false);\n this.dispatchEvent(_changeEvent);\n } else {\n const amount = this.easeOutCubic(animTime);\n const size2 = 1 - amount + this.scaleFactor * amount;\n this._gizmoMatrixState.decompose(this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale);\n this.focus(point, size2, amount);\n this.dispatchEvent(_changeEvent);\n const self2 = this;\n this._animationId = window.requestAnimationFrame(function(t2) {\n self2.onFocusAnim(t2, point, cameraMatrix, gizmoMatrix.clone());\n });\n }\n } else {\n this._animationId = -1;\n this._timeStart = -1;\n }\n });\n /**\n * Perform animation for rotation operation\n * @param {Number} time Instant in which this function is called as performance.now()\n * @param {Vector3} rotationAxis Rotation axis\n * @param {number} w0 Initial angular velocity\n */\n __publicField(this, \"onRotationAnim\", (time, rotationAxis, w0) => {\n if (this._timeStart == -1) {\n this._anglePrev = 0;\n this._angleCurrent = 0;\n this._timeStart = time;\n }\n if (this._state == STATE.ANIMATION_ROTATE) {\n const deltaTime = (time - this._timeStart) / 1e3;\n const w = w0 + -this.dampingFactor * deltaTime;\n if (w > 0) {\n this._angleCurrent = 0.5 * -this.dampingFactor * Math.pow(deltaTime, 2) + w0 * deltaTime + 0;\n this.applyTransformMatrix(this.rotate(rotationAxis, this._angleCurrent));\n this.dispatchEvent(_changeEvent);\n const self2 = this;\n this._animationId = window.requestAnimationFrame(function(t2) {\n self2.onRotationAnim(t2, rotationAxis, w0);\n });\n } else {\n this._animationId = -1;\n this._timeStart = -1;\n this.updateTbState(STATE.IDLE, false);\n this.activateGizmos(false);\n this.dispatchEvent(_changeEvent);\n }\n } else {\n this._animationId = -1;\n this._timeStart = -1;\n if (this._state != STATE.ROTATE) {\n this.activateGizmos(false);\n this.dispatchEvent(_changeEvent);\n }\n }\n });\n /**\n * Perform pan operation moving camera between two points\n * @param {Vector3} p0 Initial point\n * @param {Vector3} p1 Ending point\n * @param {Boolean} adjust If movement should be adjusted considering camera distance (Perspective only)\n */\n __publicField(this, \"pan\", (p0, p1, adjust = false) => {\n if (this.camera) {\n const movement = p0.clone().sub(p1);\n if (this.camera instanceof three__WEBPACK_IMPORTED_MODULE_42__.OrthographicCamera) {\n movement.multiplyScalar(1 / this.camera.zoom);\n }\n if (this.camera instanceof three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera && adjust) {\n this._v3_1.setFromMatrixPosition(this._cameraMatrixState0);\n this._v3_2.setFromMatrixPosition(this._gizmoMatrixState0);\n const distanceFactor = this._v3_1.distanceTo(this._v3_2) / this.camera.position.distanceTo(this._gizmos.position);\n movement.multiplyScalar(1 / distanceFactor);\n }\n this._v3_1.set(movement.x, movement.y, 0).applyQuaternion(this.camera.quaternion);\n this._m4_1.makeTranslation(this._v3_1.x, this._v3_1.y, this._v3_1.z);\n this.setTransformationMatrices(this._m4_1, this._m4_1);\n }\n return _transformation;\n });\n /**\n * Reset trackball\n */\n __publicField(this, \"reset\", () => {\n if (this.camera) {\n this.camera.zoom = this._zoom0;\n if (this.camera instanceof three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera) {\n this.camera.fov = this._fov0;\n }\n this.camera.near = this._nearPos;\n this.camera.far = this._farPos;\n this._cameraMatrixState.copy(this._cameraMatrixState0);\n this._cameraMatrixState.decompose(this.camera.position, this.camera.quaternion, this.camera.scale);\n this.camera.up.copy(this._up0);\n this.camera.updateMatrix();\n this.camera.updateProjectionMatrix();\n this._gizmoMatrixState.copy(this._gizmoMatrixState0);\n this._gizmoMatrixState0.decompose(this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale);\n this._gizmos.updateMatrix();\n const tbRadius = this.calculateTbRadius(this.camera);\n if (tbRadius !== void 0) {\n this._tbRadius = tbRadius;\n }\n this.makeGizmos(this._gizmos.position, this._tbRadius);\n this.camera.lookAt(this._gizmos.position);\n this.updateTbState(STATE.IDLE, false);\n this.dispatchEvent(_changeEvent);\n }\n });\n /**\n * Rotate the camera around an axis passing by trackball's center\n * @param {Vector3} axis Rotation axis\n * @param {number} angle Angle in radians\n * @returns {Object} Object with 'camera' field containing transformation matrix resulting from the operation to be applied to the camera\n */\n __publicField(this, \"rotate\", (axis, angle) => {\n const point = this._gizmos.position;\n this._translationMatrix.makeTranslation(-point.x, -point.y, -point.z);\n this._rotationMatrix.makeRotationAxis(axis, -angle);\n this._m4_1.makeTranslation(point.x, point.y, point.z);\n this._m4_1.multiply(this._rotationMatrix);\n this._m4_1.multiply(this._translationMatrix);\n this.setTransformationMatrices(this._m4_1);\n return _transformation;\n });\n __publicField(this, \"copyState\", () => {\n if (this.camera) {\n const state = JSON.stringify(\n this.camera instanceof three__WEBPACK_IMPORTED_MODULE_42__.OrthographicCamera ? {\n arcballState: {\n cameraFar: this.camera.far,\n cameraMatrix: this.camera.matrix,\n cameraNear: this.camera.near,\n cameraUp: this.camera.up,\n cameraZoom: this.camera.zoom,\n gizmoMatrix: this._gizmos.matrix\n }\n } : {\n arcballState: {\n cameraFar: this.camera.far,\n cameraFov: this.camera.fov,\n cameraMatrix: this.camera.matrix,\n cameraNear: this.camera.near,\n cameraUp: this.camera.up,\n cameraZoom: this.camera.zoom,\n gizmoMatrix: this._gizmos.matrix\n }\n }\n );\n navigator.clipboard.writeText(state);\n }\n });\n __publicField(this, \"pasteState\", () => {\n const self2 = this;\n navigator.clipboard.readText().then(function resolved(value) {\n self2.setStateFromJSON(value);\n });\n });\n /**\n * Save the current state of the control. This can later be recovered with .reset\n */\n __publicField(this, \"saveState\", () => {\n if (!this.camera)\n return;\n this._cameraMatrixState0.copy(this.camera.matrix);\n this._gizmoMatrixState0.copy(this._gizmos.matrix);\n this._nearPos = this.camera.near;\n this._farPos = this.camera.far;\n this._zoom0 = this.camera.zoom;\n this._up0.copy(this.camera.up);\n if (this.camera instanceof three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera) {\n this._fov0 = this.camera.fov;\n }\n });\n /**\n * Perform uniform scale operation around a given point\n * @param {Number} size Scale factor\n * @param {Vector3} point Point around which scale\n * @param {Boolean} scaleGizmos If gizmos should be scaled (Perspective only)\n * @returns {Object} Object with 'camera' and 'gizmo' fields containing transformation matrices resulting from the operation to be applied to the camera and gizmos\n */\n __publicField(this, \"applyScale\", (size2, point, scaleGizmos = true) => {\n if (!this.camera)\n return;\n const scalePoint = point.clone();\n let sizeInverse = 1 / size2;\n if (this.camera instanceof three__WEBPACK_IMPORTED_MODULE_42__.OrthographicCamera) {\n this.camera.zoom = this._zoomState;\n this.camera.zoom *= size2;\n if (this.camera.zoom > this.maxZoom) {\n this.camera.zoom = this.maxZoom;\n sizeInverse = this._zoomState / this.maxZoom;\n } else if (this.camera.zoom < this.minZoom) {\n this.camera.zoom = this.minZoom;\n sizeInverse = this._zoomState / this.minZoom;\n }\n this.camera.updateProjectionMatrix();\n this._v3_1.setFromMatrixPosition(this._gizmoMatrixState);\n this._scaleMatrix.makeScale(sizeInverse, sizeInverse, sizeInverse);\n this._translationMatrix.makeTranslation(-this._v3_1.x, -this._v3_1.y, -this._v3_1.z);\n this._m4_2.makeTranslation(this._v3_1.x, this._v3_1.y, this._v3_1.z).multiply(this._scaleMatrix);\n this._m4_2.multiply(this._translationMatrix);\n scalePoint.sub(this._v3_1);\n const amount = scalePoint.clone().multiplyScalar(sizeInverse);\n scalePoint.sub(amount);\n this._m4_1.makeTranslation(scalePoint.x, scalePoint.y, scalePoint.z);\n this._m4_2.premultiply(this._m4_1);\n this.setTransformationMatrices(this._m4_1, this._m4_2);\n return _transformation;\n }\n if (this.camera instanceof three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera) {\n this._v3_1.setFromMatrixPosition(this._cameraMatrixState);\n this._v3_2.setFromMatrixPosition(this._gizmoMatrixState);\n let distance = this._v3_1.distanceTo(scalePoint);\n let amount = distance - distance * sizeInverse;\n const newDistance = distance - amount;\n if (newDistance < this.minDistance) {\n sizeInverse = this.minDistance / distance;\n amount = distance - distance * sizeInverse;\n } else if (newDistance > this.maxDistance) {\n sizeInverse = this.maxDistance / distance;\n amount = distance - distance * sizeInverse;\n }\n let direction = scalePoint.clone().sub(this._v3_1).normalize().multiplyScalar(amount);\n this._m4_1.makeTranslation(direction.x, direction.y, direction.z);\n if (scaleGizmos) {\n const pos = this._v3_2;\n distance = pos.distanceTo(scalePoint);\n amount = distance - distance * sizeInverse;\n direction = scalePoint.clone().sub(this._v3_2).normalize().multiplyScalar(amount);\n this._translationMatrix.makeTranslation(pos.x, pos.y, pos.z);\n this._scaleMatrix.makeScale(sizeInverse, sizeInverse, sizeInverse);\n this._m4_2.makeTranslation(direction.x, direction.y, direction.z).multiply(this._translationMatrix);\n this._m4_2.multiply(this._scaleMatrix);\n this._translationMatrix.makeTranslation(-pos.x, -pos.y, -pos.z);\n this._m4_2.multiply(this._translationMatrix);\n this.setTransformationMatrices(this._m4_1, this._m4_2);\n } else {\n this.setTransformationMatrices(this._m4_1);\n }\n return _transformation;\n }\n });\n /**\n * Set camera fov\n * @param {Number} value fov to be setted\n */\n __publicField(this, \"setFov\", (value) => {\n if (this.camera instanceof three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera) {\n this.camera.fov = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.clamp(value, this.minFov, this.maxFov);\n this.camera.updateProjectionMatrix();\n }\n });\n /**\n * Set the trackball's center point\n * @param {Number} x X coordinate\n * @param {Number} y Y coordinate\n * @param {Number} z Z coordinate\n */\n __publicField(this, \"setTarget\", (x, y, z) => {\n if (this.camera) {\n this.target.set(x, y, z);\n this._gizmos.position.set(x, y, z);\n const tbRadius = this.calculateTbRadius(this.camera);\n if (tbRadius !== void 0) {\n this._tbRadius = tbRadius;\n }\n this.makeGizmos(this.target, this._tbRadius);\n this.camera.lookAt(this.target);\n }\n });\n /**\n * Rotate camera around its direction axis passing by a given point by a given angle\n * @param {Vector3} point The point where the rotation axis is passing trough\n * @param {Number} angle Angle in radians\n * @returns The computed transormation matix\n */\n __publicField(this, \"zRotate\", (point, angle) => {\n this._rotationMatrix.makeRotationAxis(this._rotationAxis, angle);\n this._translationMatrix.makeTranslation(-point.x, -point.y, -point.z);\n this._m4_1.makeTranslation(point.x, point.y, point.z);\n this._m4_1.multiply(this._rotationMatrix);\n this._m4_1.multiply(this._translationMatrix);\n this._v3_1.setFromMatrixPosition(this._gizmoMatrixState).sub(point);\n this._v3_2.copy(this._v3_1).applyAxisAngle(this._rotationAxis, angle);\n this._v3_2.sub(this._v3_1);\n this._m4_2.makeTranslation(this._v3_2.x, this._v3_2.y, this._v3_2.z);\n this.setTransformationMatrices(this._m4_1, this._m4_2);\n return _transformation;\n });\n /**\n * Unproject the cursor on the 3D object surface\n * @param {Vector2} cursor Cursor coordinates in NDC\n * @param {Camera} camera Virtual camera\n * @returns {Vector3} The point of intersection with the model, if exist, null otherwise\n */\n __publicField(this, \"unprojectOnObj\", (cursor, camera) => {\n if (!this.scene)\n return null;\n const raycaster = new three__WEBPACK_IMPORTED_MODULE_42__.Raycaster();\n raycaster.near = camera.near;\n raycaster.far = camera.far;\n raycaster.setFromCamera(cursor, camera);\n const intersect = raycaster.intersectObjects(this.scene.children, true);\n for (let i2 = 0; i2 < intersect.length; i2++) {\n if (intersect[i2].object.uuid != this._gizmos.uuid && intersect[i2].face) {\n return intersect[i2].point.clone();\n }\n }\n return null;\n });\n /**\n * Unproject the cursor on the trackball surface\n * @param {Camera} camera The virtual camera\n * @param {Number} cursorX Cursor horizontal coordinate on screen\n * @param {Number} cursorY Cursor vertical coordinate on screen\n * @param {HTMLElement} canvas The canvas where the renderer draws its output\n * @param {number} tbRadius The trackball radius\n * @returns {Vector3} The unprojected point on the trackball surface\n */\n __publicField(this, \"unprojectOnTbSurface\", (camera, cursorX, cursorY, canvas, tbRadius) => {\n if (camera instanceof three__WEBPACK_IMPORTED_MODULE_42__.OrthographicCamera) {\n this._v2_1.copy(this.getCursorPosition(cursorX, cursorY, canvas));\n this._v3_1.set(this._v2_1.x, this._v2_1.y, 0);\n const x2 = Math.pow(this._v2_1.x, 2);\n const y2 = Math.pow(this._v2_1.y, 2);\n const r2 = Math.pow(this._tbRadius, 2);\n if (x2 + y2 <= r2 * 0.5) {\n this._v3_1.setZ(Math.sqrt(r2 - (x2 + y2)));\n } else {\n this._v3_1.setZ(r2 * 0.5 / Math.sqrt(x2 + y2));\n }\n return this._v3_1;\n }\n if (camera instanceof three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera) {\n this._v2_1.copy(this.getCursorNDC(cursorX, cursorY, canvas));\n this._v3_1.set(this._v2_1.x, this._v2_1.y, -1);\n this._v3_1.applyMatrix4(camera.projectionMatrixInverse);\n const rayDir = this._v3_1.clone().normalize();\n const cameraGizmoDistance = camera.position.distanceTo(this._gizmos.position);\n const radius2 = Math.pow(tbRadius, 2);\n const h = this._v3_1.z;\n const l = Math.sqrt(Math.pow(this._v3_1.x, 2) + Math.pow(this._v3_1.y, 2));\n if (l == 0) {\n rayDir.set(this._v3_1.x, this._v3_1.y, tbRadius);\n return rayDir;\n }\n const m = h / l;\n const q = cameraGizmoDistance;\n let a2 = Math.pow(m, 2) + 1;\n let b2 = 2 * m * q;\n let c = Math.pow(q, 2) - radius2;\n let delta = Math.pow(b2, 2) - 4 * a2 * c;\n if (delta >= 0) {\n this._v2_1.setX((-b2 - Math.sqrt(delta)) / (2 * a2));\n this._v2_1.setY(m * this._v2_1.x + q);\n const angle = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.RAD2DEG * this._v2_1.angle();\n if (angle >= 45) {\n const rayLength2 = Math.sqrt(Math.pow(this._v2_1.x, 2) + Math.pow(cameraGizmoDistance - this._v2_1.y, 2));\n rayDir.multiplyScalar(rayLength2);\n rayDir.z += cameraGizmoDistance;\n return rayDir;\n }\n }\n a2 = m;\n b2 = q;\n c = -radius2 * 0.5;\n delta = Math.pow(b2, 2) - 4 * a2 * c;\n this._v2_1.setX((-b2 - Math.sqrt(delta)) / (2 * a2));\n this._v2_1.setY(m * this._v2_1.x + q);\n const rayLength = Math.sqrt(Math.pow(this._v2_1.x, 2) + Math.pow(cameraGizmoDistance - this._v2_1.y, 2));\n rayDir.multiplyScalar(rayLength);\n rayDir.z += cameraGizmoDistance;\n return rayDir;\n }\n });\n /**\n * Unproject the cursor on the plane passing through the center of the trackball orthogonal to the camera\n * @param {Camera} camera The virtual camera\n * @param {Number} cursorX Cursor horizontal coordinate on screen\n * @param {Number} cursorY Cursor vertical coordinate on screen\n * @param {HTMLElement} canvas The canvas where the renderer draws its output\n * @param {Boolean} initialDistance If initial distance between camera and gizmos should be used for calculations instead of current (Perspective only)\n * @returns {Vector3} The unprojected point on the trackball plane\n */\n __publicField(this, \"unprojectOnTbPlane\", (camera, cursorX, cursorY, canvas, initialDistance = false) => {\n if (camera instanceof three__WEBPACK_IMPORTED_MODULE_42__.OrthographicCamera) {\n this._v2_1.copy(this.getCursorPosition(cursorX, cursorY, canvas));\n this._v3_1.set(this._v2_1.x, this._v2_1.y, 0);\n return this._v3_1.clone();\n }\n if (camera instanceof three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera) {\n this._v2_1.copy(this.getCursorNDC(cursorX, cursorY, canvas));\n this._v3_1.set(this._v2_1.x, this._v2_1.y, -1);\n this._v3_1.applyMatrix4(camera.projectionMatrixInverse);\n const rayDir = this._v3_1.clone().normalize();\n const h = this._v3_1.z;\n const l = Math.sqrt(Math.pow(this._v3_1.x, 2) + Math.pow(this._v3_1.y, 2));\n let cameraGizmoDistance;\n if (initialDistance) {\n cameraGizmoDistance = this._v3_1.setFromMatrixPosition(this._cameraMatrixState0).distanceTo(this._v3_2.setFromMatrixPosition(this._gizmoMatrixState0));\n } else {\n cameraGizmoDistance = camera.position.distanceTo(this._gizmos.position);\n }\n if (l == 0) {\n rayDir.set(0, 0, 0);\n return rayDir;\n }\n const m = h / l;\n const q = cameraGizmoDistance;\n const x = -q / m;\n const rayLength = Math.sqrt(Math.pow(q, 2) + Math.pow(x, 2));\n rayDir.multiplyScalar(rayLength);\n rayDir.z = 0;\n return rayDir;\n }\n });\n /**\n * Update camera and gizmos state\n */\n __publicField(this, \"updateMatrixState\", () => {\n if (!this.camera)\n return;\n this._cameraMatrixState.copy(this.camera.matrix);\n this._gizmoMatrixState.copy(this._gizmos.matrix);\n if (this.camera instanceof three__WEBPACK_IMPORTED_MODULE_42__.OrthographicCamera) {\n this._cameraProjectionState.copy(this.camera.projectionMatrix);\n this.camera.updateProjectionMatrix();\n this._zoomState = this.camera.zoom;\n }\n if (this.camera instanceof three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera) {\n this._fovState = this.camera.fov;\n }\n });\n /**\n * Update the trackball FSA\n * @param {STATE} newState New state of the FSA\n * @param {Boolean} updateMatrices If matriices state should be updated\n */\n __publicField(this, \"updateTbState\", (newState, updateMatrices) => {\n this._state = newState;\n if (updateMatrices) {\n this.updateMatrixState();\n }\n });\n __publicField(this, \"update\", () => {\n const EPS2 = 1e-6;\n if (!this.target.equals(this._currentTarget) && this.camera) {\n this._gizmos.position.set(this.target.x, this.target.y, this.target.z);\n const tbRadius = this.calculateTbRadius(this.camera);\n if (tbRadius !== void 0) {\n this._tbRadius = tbRadius;\n }\n this.makeGizmos(this.target, this._tbRadius);\n this._currentTarget.copy(this.target);\n }\n if (!this.camera)\n return;\n if (this.camera instanceof three__WEBPACK_IMPORTED_MODULE_42__.OrthographicCamera) {\n if (this.camera.zoom > this.maxZoom || this.camera.zoom < this.minZoom) {\n const newZoom = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.clamp(this.camera.zoom, this.minZoom, this.maxZoom);\n this.applyTransformMatrix(this.applyScale(newZoom / this.camera.zoom, this._gizmos.position, true));\n }\n }\n if (this.camera instanceof three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera) {\n const distance = this.camera.position.distanceTo(this._gizmos.position);\n if (distance > this.maxDistance + EPS2 || distance < this.minDistance - EPS2) {\n const newDistance = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.clamp(distance, this.minDistance, this.maxDistance);\n this.applyTransformMatrix(this.applyScale(newDistance / distance, this._gizmos.position));\n this.updateMatrixState();\n }\n if (this.camera.fov < this.minFov || this.camera.fov > this.maxFov) {\n this.camera.fov = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.clamp(this.camera.fov, this.minFov, this.maxFov);\n this.camera.updateProjectionMatrix();\n }\n const oldRadius = this._tbRadius;\n const tbRadius = this.calculateTbRadius(this.camera);\n if (tbRadius !== void 0) {\n this._tbRadius = tbRadius;\n }\n if (oldRadius < this._tbRadius - EPS2 || oldRadius > this._tbRadius + EPS2) {\n const scale = (this._gizmos.scale.x + this._gizmos.scale.y + this._gizmos.scale.z) / 3;\n const newRadius = this._tbRadius / scale;\n const curve = new three__WEBPACK_IMPORTED_MODULE_42__.EllipseCurve(0, 0, newRadius, newRadius);\n const points = curve.getPoints(this._curvePts);\n const curveGeometry = new three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry().setFromPoints(points);\n for (const gizmo in this._gizmos.children) {\n const child = this._gizmos.children[gizmo];\n child.geometry = curveGeometry;\n }\n }\n }\n this.camera.lookAt(this._gizmos.position);\n });\n __publicField(this, \"setStateFromJSON\", (json) => {\n const state = JSON.parse(json);\n if (state.arcballState && this.camera) {\n this._cameraMatrixState.fromArray(state.arcballState.cameraMatrix.elements);\n this._cameraMatrixState.decompose(this.camera.position, this.camera.quaternion, this.camera.scale);\n this.camera.up.copy(state.arcballState.cameraUp);\n this.camera.near = state.arcballState.cameraNear;\n this.camera.far = state.arcballState.cameraFar;\n this.camera.zoom = state.arcballState.cameraZoom;\n if (this.camera instanceof three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera) {\n this.camera.fov = state.arcballState.cameraFov;\n }\n this._gizmoMatrixState.fromArray(state.arcballState.gizmoMatrix.elements);\n this._gizmoMatrixState.decompose(this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale);\n this.camera.updateMatrix();\n this.camera.updateProjectionMatrix();\n this._gizmos.updateMatrix();\n const tbRadius = this.calculateTbRadius(this.camera);\n if (tbRadius !== void 0) {\n this._tbRadius = tbRadius;\n }\n const gizmoTmp = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4().copy(this._gizmoMatrixState0);\n this.makeGizmos(this._gizmos.position, this._tbRadius);\n this._gizmoMatrixState0.copy(gizmoTmp);\n this.camera.lookAt(this._gizmos.position);\n this.updateTbState(STATE.IDLE, false);\n this.dispatchEvent(_changeEvent);\n }\n });\n this.camera = null;\n this.domElement = domElement;\n this.scene = scene;\n this.mouseActions = [];\n this._mouseOp = null;\n this._v2_1 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2();\n this._v3_1 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this._v3_2 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this._m4_1 = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n this._m4_2 = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n this._quat = new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion();\n this._translationMatrix = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n this._rotationMatrix = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n this._scaleMatrix = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n this._rotationAxis = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this._cameraMatrixState = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n this._cameraProjectionState = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n this._fovState = 1;\n this._upState = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this._zoomState = 1;\n this._nearPos = 0;\n this._farPos = 0;\n this._gizmoMatrixState = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n this._up0 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this._zoom0 = 1;\n this._fov0 = 0;\n this._initialNear = 0;\n this._nearPos0 = 0;\n this._initialFar = 0;\n this._farPos0 = 0;\n this._cameraMatrixState0 = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n this._gizmoMatrixState0 = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n this._button = -1;\n this._touchStart = [];\n this._touchCurrent = [];\n this._input = INPUT.NONE;\n this._switchSensibility = 32;\n this._startFingerDistance = 0;\n this._currentFingerDistance = 0;\n this._startFingerRotation = 0;\n this._currentFingerRotation = 0;\n this._devPxRatio = 0;\n this._downValid = true;\n this._nclicks = 0;\n this._downEvents = [];\n this._clickStart = 0;\n this._maxDownTime = 250;\n this._maxInterval = 300;\n this._posThreshold = 24;\n this._movementThreshold = 24;\n this._currentCursorPosition = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this._startCursorPosition = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this._grid = null;\n this._gridPosition = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this._gizmos = new three__WEBPACK_IMPORTED_MODULE_42__.Group();\n this._curvePts = 128;\n this._timeStart = -1;\n this._animationId = -1;\n this.focusAnimationTime = 500;\n this._timePrev = 0;\n this._timeCurrent = 0;\n this._anglePrev = 0;\n this._angleCurrent = 0;\n this._cursorPosPrev = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this._cursorPosCurr = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this._wPrev = 0;\n this._wCurr = 0;\n this.adjustNearFar = false;\n this.scaleFactor = 1.1;\n this.dampingFactor = 25;\n this.wMax = 20;\n this.enableAnimations = true;\n this.enableGrid = false;\n this.cursorZoom = false;\n this.minFov = 5;\n this.maxFov = 90;\n this.enabled = true;\n this.enablePan = true;\n this.enableRotate = true;\n this.enableZoom = true;\n this.minDistance = 0;\n this.maxDistance = Infinity;\n this.minZoom = 0;\n this.maxZoom = Infinity;\n this.target = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 0, 0);\n this._currentTarget = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 0, 0);\n this._tbRadius = 1;\n this._state = STATE.IDLE;\n this.setCamera(camera);\n if (this.scene) {\n this.scene.add(this._gizmos);\n }\n this._devPxRatio = window.devicePixelRatio;\n this.initializeMouseActions();\n if (this.domElement)\n this.connect(this.domElement);\n window.addEventListener(\"resize\", this.onWindowResize);\n }\n /**\n * Apply a transformation matrix, to the camera and gizmos\n * @param {Object} transformation Object containing matrices to apply to camera and gizmos\n */\n applyTransformMatrix(transformation) {\n if ((transformation == null ? void 0 : transformation.camera) && this.camera) {\n this._m4_1.copy(this._cameraMatrixState).premultiply(transformation.camera);\n this._m4_1.decompose(this.camera.position, this.camera.quaternion, this.camera.scale);\n this.camera.updateMatrix();\n if (this._state == STATE.ROTATE || this._state == STATE.ZROTATE || this._state == STATE.ANIMATION_ROTATE) {\n this.camera.up.copy(this._upState).applyQuaternion(this.camera.quaternion);\n }\n }\n if (transformation == null ? void 0 : transformation.gizmos) {\n this._m4_1.copy(this._gizmoMatrixState).premultiply(transformation.gizmos);\n this._m4_1.decompose(this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale);\n this._gizmos.updateMatrix();\n }\n if ((this._state == STATE.SCALE || this._state == STATE.FOCUS || this._state == STATE.ANIMATION_FOCUS) && this.camera) {\n const tbRadius = this.calculateTbRadius(this.camera);\n if (tbRadius !== void 0) {\n this._tbRadius = tbRadius;\n }\n if (this.adjustNearFar) {\n const cameraDistance = this.camera.position.distanceTo(this._gizmos.position);\n const bb = new three__WEBPACK_IMPORTED_MODULE_42__.Box3();\n bb.setFromObject(this._gizmos);\n const sphere = new three__WEBPACK_IMPORTED_MODULE_42__.Sphere();\n bb.getBoundingSphere(sphere);\n const adjustedNearPosition = Math.max(this._nearPos0, sphere.radius + sphere.center.length());\n const regularNearPosition = cameraDistance - this._initialNear;\n const minNearPos = Math.min(adjustedNearPosition, regularNearPosition);\n this.camera.near = cameraDistance - minNearPos;\n const adjustedFarPosition = Math.min(this._farPos0, -sphere.radius + sphere.center.length());\n const regularFarPosition = cameraDistance - this._initialFar;\n const minFarPos = Math.min(adjustedFarPosition, regularFarPosition);\n this.camera.far = cameraDistance - minFarPos;\n this.camera.updateProjectionMatrix();\n } else {\n let update = false;\n if (this.camera.near != this._initialNear) {\n this.camera.near = this._initialNear;\n update = true;\n }\n if (this.camera.far != this._initialFar) {\n this.camera.far = this._initialFar;\n update = true;\n }\n if (update) {\n this.camera.updateProjectionMatrix();\n }\n }\n }\n }\n /**\n * Set gizmos visibility\n * @param {Boolean} value Value of gizmos visibility\n */\n setGizmosVisible(value) {\n this._gizmos.visible = value;\n this.dispatchEvent(_changeEvent);\n }\n /**\n * Set values in transformation object\n * @param {Matrix4} camera Transformation to be applied to the camera\n * @param {Matrix4} gizmos Transformation to be applied to gizmos\n */\n setTransformationMatrices(camera = null, gizmos = null) {\n if (camera) {\n if (_transformation.camera) {\n _transformation.camera.copy(camera);\n } else {\n _transformation.camera = camera.clone();\n }\n } else {\n _transformation.camera = null;\n }\n if (gizmos) {\n if (_transformation.gizmos) {\n _transformation.gizmos.copy(gizmos);\n } else {\n _transformation.gizmos = gizmos.clone();\n }\n } else {\n _transformation.gizmos = null;\n }\n }\n}\nfunction contextmenu(event) {\n event.preventDefault();\n}\nclass FlyControls extends three__WEBPACK_IMPORTED_MODULE_42__.EventDispatcher {\n constructor(object, domElement) {\n super();\n __publicField(this, \"object\");\n __publicField(this, \"domElement\", null);\n __publicField(this, \"movementSpeed\", 1);\n __publicField(this, \"rollSpeed\", 5e-3);\n __publicField(this, \"dragToLook\", false);\n __publicField(this, \"autoForward\", false);\n __publicField(this, \"changeEvent\", { type: \"change\" });\n __publicField(this, \"EPS\", 1e-6);\n __publicField(this, \"tmpQuaternion\", new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion());\n __publicField(this, \"mouseStatus\", 0);\n __publicField(this, \"movementSpeedMultiplier\", 1);\n __publicField(this, \"moveState\", {\n up: 0,\n down: 0,\n left: 0,\n right: 0,\n forward: 0,\n back: 0,\n pitchUp: 0,\n pitchDown: 0,\n yawLeft: 0,\n yawRight: 0,\n rollLeft: 0,\n rollRight: 0\n });\n __publicField(this, \"moveVector\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 0, 0));\n __publicField(this, \"rotationVector\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 0, 0));\n __publicField(this, \"keydown\", (event) => {\n if (event.altKey) {\n return;\n }\n switch (event.code) {\n case \"ShiftLeft\":\n case \"ShiftRight\":\n this.movementSpeedMultiplier = 0.1;\n break;\n case \"KeyW\":\n this.moveState.forward = 1;\n break;\n case \"KeyS\":\n this.moveState.back = 1;\n break;\n case \"KeyA\":\n this.moveState.left = 1;\n break;\n case \"KeyD\":\n this.moveState.right = 1;\n break;\n case \"KeyR\":\n this.moveState.up = 1;\n break;\n case \"KeyF\":\n this.moveState.down = 1;\n break;\n case \"ArrowUp\":\n this.moveState.pitchUp = 1;\n break;\n case \"ArrowDown\":\n this.moveState.pitchDown = 1;\n break;\n case \"ArrowLeft\":\n this.moveState.yawLeft = 1;\n break;\n case \"ArrowRight\":\n this.moveState.yawRight = 1;\n break;\n case \"KeyQ\":\n this.moveState.rollLeft = 1;\n break;\n case \"KeyE\":\n this.moveState.rollRight = 1;\n break;\n }\n this.updateMovementVector();\n this.updateRotationVector();\n });\n __publicField(this, \"keyup\", (event) => {\n switch (event.code) {\n case \"ShiftLeft\":\n case \"ShiftRight\":\n this.movementSpeedMultiplier = 1;\n break;\n case \"KeyW\":\n this.moveState.forward = 0;\n break;\n case \"KeyS\":\n this.moveState.back = 0;\n break;\n case \"KeyA\":\n this.moveState.left = 0;\n break;\n case \"KeyD\":\n this.moveState.right = 0;\n break;\n case \"KeyR\":\n this.moveState.up = 0;\n break;\n case \"KeyF\":\n this.moveState.down = 0;\n break;\n case \"ArrowUp\":\n this.moveState.pitchUp = 0;\n break;\n case \"ArrowDown\":\n this.moveState.pitchDown = 0;\n break;\n case \"ArrowLeft\":\n this.moveState.yawLeft = 0;\n break;\n case \"ArrowRight\":\n this.moveState.yawRight = 0;\n break;\n case \"KeyQ\":\n this.moveState.rollLeft = 0;\n break;\n case \"KeyE\":\n this.moveState.rollRight = 0;\n break;\n }\n this.updateMovementVector();\n this.updateRotationVector();\n });\n __publicField(this, \"pointerdown\", (event) => {\n if (this.dragToLook) {\n this.mouseStatus++;\n } else {\n switch (event.button) {\n case 0:\n this.moveState.forward = 1;\n break;\n case 2:\n this.moveState.back = 1;\n break;\n }\n this.updateMovementVector();\n }\n });\n __publicField(this, \"pointermove\", (event) => {\n if (!this.dragToLook || this.mouseStatus > 0) {\n const container = this.getContainerDimensions();\n const halfWidth = container.size[0] / 2;\n const halfHeight = container.size[1] / 2;\n this.moveState.yawLeft = -(event.pageX - container.offset[0] - halfWidth) / halfWidth;\n this.moveState.pitchDown = (event.pageY - container.offset[1] - halfHeight) / halfHeight;\n this.updateRotationVector();\n }\n });\n __publicField(this, \"pointerup\", (event) => {\n if (this.dragToLook) {\n this.mouseStatus--;\n this.moveState.yawLeft = this.moveState.pitchDown = 0;\n } else {\n switch (event.button) {\n case 0:\n this.moveState.forward = 0;\n break;\n case 2:\n this.moveState.back = 0;\n break;\n }\n this.updateMovementVector();\n }\n this.updateRotationVector();\n });\n __publicField(this, \"lastQuaternion\", new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion());\n __publicField(this, \"lastPosition\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector3());\n __publicField(this, \"update\", (delta) => {\n const moveMult = delta * this.movementSpeed;\n const rotMult = delta * this.rollSpeed;\n this.object.translateX(this.moveVector.x * moveMult);\n this.object.translateY(this.moveVector.y * moveMult);\n this.object.translateZ(this.moveVector.z * moveMult);\n this.tmpQuaternion.set(this.rotationVector.x * rotMult, this.rotationVector.y * rotMult, this.rotationVector.z * rotMult, 1).normalize();\n this.object.quaternion.multiply(this.tmpQuaternion);\n if (this.lastPosition.distanceToSquared(this.object.position) > this.EPS || 8 * (1 - this.lastQuaternion.dot(this.object.quaternion)) > this.EPS) {\n this.dispatchEvent(this.changeEvent);\n this.lastQuaternion.copy(this.object.quaternion);\n this.lastPosition.copy(this.object.position);\n }\n });\n __publicField(this, \"updateMovementVector\", () => {\n const forward = this.moveState.forward || this.autoForward && !this.moveState.back ? 1 : 0;\n this.moveVector.x = -this.moveState.left + this.moveState.right;\n this.moveVector.y = -this.moveState.down + this.moveState.up;\n this.moveVector.z = -forward + this.moveState.back;\n });\n __publicField(this, \"updateRotationVector\", () => {\n this.rotationVector.x = -this.moveState.pitchDown + this.moveState.pitchUp;\n this.rotationVector.y = -this.moveState.yawRight + this.moveState.yawLeft;\n this.rotationVector.z = -this.moveState.rollRight + this.moveState.rollLeft;\n });\n __publicField(this, \"getContainerDimensions\", () => {\n if (this.domElement != document && !(this.domElement instanceof Document)) {\n return {\n size: [this.domElement.offsetWidth, this.domElement.offsetHeight],\n offset: [this.domElement.offsetLeft, this.domElement.offsetTop]\n };\n } else {\n return {\n size: [window.innerWidth, window.innerHeight],\n offset: [0, 0]\n };\n }\n });\n // https://github.com/mrdoob/three.js/issues/20575\n __publicField(this, \"connect\", (domElement) => {\n this.domElement = domElement;\n if (domElement && !(domElement instanceof Document)) {\n domElement.setAttribute(\"tabindex\", -1);\n }\n this.domElement.addEventListener(\"contextmenu\", contextmenu);\n this.domElement.addEventListener(\"pointermove\", this.pointermove);\n this.domElement.addEventListener(\"pointerdown\", this.pointerdown);\n this.domElement.addEventListener(\"pointerup\", this.pointerup);\n window.addEventListener(\"keydown\", this.keydown);\n window.addEventListener(\"keyup\", this.keyup);\n });\n __publicField(this, \"dispose\", () => {\n this.domElement.removeEventListener(\"contextmenu\", contextmenu);\n this.domElement.removeEventListener(\"pointermove\", this.pointermove);\n this.domElement.removeEventListener(\"pointerdown\", this.pointerdown);\n this.domElement.removeEventListener(\"pointerup\", this.pointerup);\n window.removeEventListener(\"keydown\", this.keydown);\n window.removeEventListener(\"keyup\", this.keyup);\n });\n this.object = object;\n if (domElement !== void 0)\n this.connect(domElement);\n this.updateMovementVector();\n this.updateRotationVector();\n }\n}\nclass Pass {\n constructor() {\n // if set to true, the pass is processed by the composer\n __publicField(this, \"enabled\", true);\n // if set to true, the pass indicates to swap read and write buffer after rendering\n __publicField(this, \"needsSwap\", true);\n // if set to true, the pass clears its buffer before rendering\n __publicField(this, \"clear\", false);\n // if set to true, the result of the pass is rendered to screen. This is set automatically by EffectComposer.\n __publicField(this, \"renderToScreen\", false);\n }\n setSize(width, height) {\n }\n render(renderer, writeBuffer, readBuffer, deltaTime, maskActive) {\n console.error(\"THREE.Pass: .render() must be implemented in derived pass.\");\n }\n}\nclass FullScreenQuad {\n constructor(material2) {\n __publicField(this, \"camera\", new three__WEBPACK_IMPORTED_MODULE_42__.OrthographicCamera(-1, 1, 1, -1, 0, 1));\n __publicField(this, \"geometry\", new three__WEBPACK_IMPORTED_MODULE_42__.PlaneGeometry(2, 2));\n __publicField(this, \"mesh\");\n this.mesh = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(this.geometry, material2);\n }\n get material() {\n return this.mesh.material;\n }\n set material(value) {\n this.mesh.material = value;\n }\n dispose() {\n this.mesh.geometry.dispose();\n }\n render(renderer) {\n renderer.render(this.mesh, this.camera);\n }\n}\nclass ShaderPass extends Pass {\n constructor(shader, textureID = \"tDiffuse\") {\n super();\n __publicField(this, \"textureID\");\n __publicField(this, \"uniforms\");\n __publicField(this, \"material\");\n __publicField(this, \"fsQuad\");\n this.textureID = textureID;\n if (shader instanceof three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial) {\n this.uniforms = shader.uniforms;\n this.material = shader;\n } else {\n this.uniforms = three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(shader.uniforms);\n this.material = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n defines: Object.assign({}, shader.defines),\n uniforms: this.uniforms,\n vertexShader: shader.vertexShader,\n fragmentShader: shader.fragmentShader\n });\n }\n this.fsQuad = new FullScreenQuad(this.material);\n }\n render(renderer, writeBuffer, readBuffer) {\n if (this.uniforms[this.textureID]) {\n this.uniforms[this.textureID].value = readBuffer.texture;\n }\n this.fsQuad.material = this.material;\n if (this.renderToScreen) {\n renderer.setRenderTarget(null);\n this.fsQuad.render(renderer);\n } else {\n renderer.setRenderTarget(writeBuffer);\n if (this.clear)\n renderer.clear(renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil);\n this.fsQuad.render(renderer);\n }\n }\n}\nconst LUTShader = {\n defines: {\n USE_3DTEXTURE: 1\n },\n uniforms: {\n lut3d: { value: null },\n lut: { value: null },\n lutSize: { value: 0 },\n tDiffuse: { value: null },\n intensity: { value: 1 }\n },\n vertexShader: (\n /* glsl */\n `\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}\n\n\t`\n ),\n fragmentShader: (\n /* glsl */\n `\n\n\t\tuniform float lutSize;\n\t\t#if USE_3DTEXTURE\n\t\tprecision highp sampler3D;\n\t\tuniform sampler3D lut3d;\n\t\t#else\n\t\tuniform sampler2D lut;\n\n\t\tvec3 lutLookup( sampler2D tex, float size, vec3 rgb ) {\n\n\t\t\tfloat sliceHeight = 1.0 / size;\n\t\t\tfloat yPixelHeight = 1.0 / ( size * size );\n\n\t\t\t// Get the slices on either side of the sample\n\t\t\tfloat slice = rgb.b * size;\n\t\t\tfloat interp = fract( slice );\n\t\t\tfloat slice0 = slice - interp;\n\t\t\tfloat centeredInterp = interp - 0.5;\n\n\t\t\tfloat slice1 = slice0 + sign( centeredInterp );\n\n\t\t\t// Pull y sample in by half a pixel in each direction to avoid color\n\t\t\t// bleeding from adjacent slices.\n\t\t\tfloat greenOffset = clamp( rgb.g * sliceHeight, yPixelHeight * 0.5, sliceHeight - yPixelHeight * 0.5 );\n\n\t\t\tvec2 uv0 = vec2(\n\t\t\t\trgb.r,\n\t\t\t\tslice0 * sliceHeight + greenOffset\n\t\t\t);\n\t\t\tvec2 uv1 = vec2(\n\t\t\t\trgb.r,\n\t\t\t\tslice1 * sliceHeight + greenOffset\n\t\t\t);\n\n\t\t\tvec3 sample0 = texture2D( tex, uv0 ).rgb;\n\t\t\tvec3 sample1 = texture2D( tex, uv1 ).rgb;\n\n\t\t\treturn mix( sample0, sample1, abs( centeredInterp ) );\n\n\t\t}\n\t\t#endif\n\n\t\tvarying vec2 vUv;\n\t\tuniform float intensity;\n\t\tuniform sampler2D tDiffuse;\n\t\tvoid main() {\n\n\t\t\tvec4 val = texture2D( tDiffuse, vUv );\n\t\t\tvec4 lutVal;\n\n\t\t\t// pull the sample in by half a pixel so the sample begins\n\t\t\t// at the center of the edge pixels.\n\t\t\tfloat pixelWidth = 1.0 / lutSize;\n\t\t\tfloat halfPixelWidth = 0.5 / lutSize;\n\t\t\tvec3 uvw = vec3( halfPixelWidth ) + val.rgb * ( 1.0 - pixelWidth );\n\n\t\t\t#if USE_3DTEXTURE\n\n\t\t\tlutVal = vec4( texture( lut3d, uvw ).rgb, val.a );\n\n\t\t\t#else\n\n\t\t\tlutVal = vec4( lutLookup( lut, lutSize, uvw ), val.a );\n\n\t\t\t#endif\n\n\t\t\tgl_FragColor = vec4( mix( val, lutVal, intensity ) );\n\n\t\t}\n\n\t`\n )\n};\nclass LUTPass extends ShaderPass {\n set lut(v) {\n const material2 = this.material;\n if (v !== this.lut) {\n material2.uniforms.lut3d.value = null;\n material2.uniforms.lut.value = null;\n if (v) {\n const is3dTextureDefine = v.isData3DTexture ? 1 : 0;\n if (is3dTextureDefine !== material2.defines.USE_3DTEXTURE) {\n material2.defines.USE_3DTEXTURE = is3dTextureDefine;\n material2.needsUpdate = true;\n }\n material2.uniforms.lutSize.value = v.image.width;\n if (v.isData3DTexture) {\n material2.uniforms.lut3d.value = v;\n } else {\n material2.uniforms.lut.value = v;\n }\n }\n }\n }\n get lut() {\n return this.material.uniforms.lut.value || this.material.uniforms.lut3d.value;\n }\n set intensity(v) {\n this.material.uniforms.intensity.value = v;\n }\n get intensity() {\n return this.material.uniforms.intensity.value;\n }\n constructor(options = {}) {\n super(LUTShader);\n this.lut = options.lut || null;\n this.intensity = \"intensity\" in options ? options.intensity : 1;\n }\n}\nclass ClearPass extends Pass {\n constructor(clearColor, clearAlpha) {\n super();\n __publicField(this, \"clearColor\");\n __publicField(this, \"clearAlpha\");\n __publicField(this, \"_oldClearColor\");\n this.needsSwap = false;\n this.clearColor = clearColor !== void 0 ? clearColor : 0;\n this.clearAlpha = clearAlpha !== void 0 ? clearAlpha : 0;\n this._oldClearColor = new three__WEBPACK_IMPORTED_MODULE_42__.Color();\n }\n render(renderer, writeBuffer, readBuffer) {\n let oldClearAlpha;\n if (this.clearColor) {\n renderer.getClearColor(this._oldClearColor);\n oldClearAlpha = renderer.getClearAlpha();\n renderer.setClearColor(this.clearColor, this.clearAlpha);\n }\n renderer.setRenderTarget(this.renderToScreen ? null : readBuffer);\n renderer.clear();\n if (this.clearColor) {\n renderer.setClearColor(this._oldClearColor, oldClearAlpha);\n }\n }\n}\nconst DigitalGlitch = {\n uniforms: {\n tDiffuse: { value: null },\n //diffuse texture\n tDisp: { value: null },\n //displacement texture for digital glitch squares\n byp: { value: 0 },\n //apply the glitch ?\n amount: { value: 0.08 },\n angle: { value: 0.02 },\n seed: { value: 0.02 },\n seed_x: { value: 0.02 },\n //-1,1\n seed_y: { value: 0.02 },\n //-1,1\n distortion_x: { value: 0.5 },\n distortion_y: { value: 0.6 },\n col_s: { value: 0.05 }\n },\n vertexShader: `varying vec2 vUv;\n void main() {\n \t vUv = uv;\n \t gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }`,\n fragmentShader: `uniform int byp; //should we apply the glitch ?\n uniform sampler2D tDiffuse;\n uniform sampler2D tDisp;\n uniform float amount;\n uniform float angle;\n uniform float seed;\n uniform float seed_x;\n uniform float seed_y;\n uniform float distortion_x;\n uniform float distortion_y;\n uniform float col_s;\n\n varying vec2 vUv;\n\n float rand(vec2 co){\n \t return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);\n }\n\n void main() {\n \tif(byp<1) {\n \t\tvec2 p = vUv;\n \t\tfloat xs = floor(gl_FragCoord.x / 0.5);\n \t\tfloat ys = floor(gl_FragCoord.y / 0.5);\n //based on staffantans glitch shader for unity https://github.com/staffantan/unityglitch\n \t\tvec4 normal = texture2D (tDisp, p*seed*seed);\n \t\tif(p.ydistortion_x-col_s*seed) {\n \t\t\tif(seed_x>0.){\n \t\t\t\tp.y = 1. - (p.y + distortion_y);\n \t\t\t}\n \t\t\telse {\n \t\t\t\tp.y = distortion_y;\n \t\t\t}\n \t\t}\n \t\tif(p.xdistortion_y-col_s*seed) {\n \t\t\tif(seed_y>0.){\n \t\t\t\tp.x=distortion_x;\n \t\t\t}\n \t\t\telse {\n \t\t\t\tp.x = 1. - (p.x + distortion_x);\n \t\t\t}\n \t\t}\n \t\tp.x+=normal.x*seed_x*(seed/5.);\n \t\tp.y+=normal.y*seed_y*(seed/5.);\n //base from RGB shift shader\n \t\tvec2 offset = amount * vec2( cos(angle), sin(angle));\n \t\tvec4 cr = texture2D(tDiffuse, p + offset);\n \t\tvec4 cga = texture2D(tDiffuse, p);\n \t\tvec4 cb = texture2D(tDiffuse, p - offset);\n \t\tgl_FragColor = vec4(cr.r, cga.g, cb.b, cga.a);\n //add noise\n \t\tvec4 snow = 200.*amount*vec4(rand(vec2(xs * seed,ys * seed*50.))*0.2);\n \t\tgl_FragColor = gl_FragColor+ snow;\n \t}\n \telse {\n \t\tgl_FragColor=texture2D (tDiffuse, vUv);\n \t}\n }`\n};\nclass GlitchPass extends Pass {\n constructor(dt_size = 64) {\n super();\n __publicField(this, \"material\");\n __publicField(this, \"fsQuad\");\n __publicField(this, \"goWild\");\n __publicField(this, \"curF\");\n __publicField(this, \"randX\");\n __publicField(this, \"uniforms\");\n this.uniforms = three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(DigitalGlitch.uniforms);\n this.uniforms[\"tDisp\"].value = this.generateHeightmap(dt_size);\n this.material = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: this.uniforms,\n vertexShader: DigitalGlitch.vertexShader,\n fragmentShader: DigitalGlitch.fragmentShader\n });\n this.fsQuad = new FullScreenQuad(this.material);\n this.goWild = false;\n this.curF = 0;\n this.generateTrigger();\n }\n render(renderer, writeBuffer, readBuffer) {\n if (renderer.capabilities.isWebGL2 === false)\n this.uniforms[\"tDisp\"].value.format = three__WEBPACK_IMPORTED_MODULE_42__.LuminanceFormat;\n this.uniforms[\"tDiffuse\"].value = readBuffer.texture;\n this.uniforms[\"seed\"].value = Math.random();\n this.uniforms[\"byp\"].value = 0;\n if (this.curF % this.randX == 0 || this.goWild == true) {\n this.uniforms[\"amount\"].value = Math.random() / 30;\n this.uniforms[\"angle\"].value = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.randFloat(-Math.PI, Math.PI);\n this.uniforms[\"seed_x\"].value = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.randFloat(-1, 1);\n this.uniforms[\"seed_y\"].value = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.randFloat(-1, 1);\n this.uniforms[\"distortion_x\"].value = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.randFloat(0, 1);\n this.uniforms[\"distortion_y\"].value = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.randFloat(0, 1);\n this.curF = 0;\n this.generateTrigger();\n } else if (this.curF % this.randX < this.randX / 5) {\n this.uniforms[\"amount\"].value = Math.random() / 90;\n this.uniforms[\"angle\"].value = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.randFloat(-Math.PI, Math.PI);\n this.uniforms[\"distortion_x\"].value = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.randFloat(0, 1);\n this.uniforms[\"distortion_y\"].value = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.randFloat(0, 1);\n this.uniforms[\"seed_x\"].value = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.randFloat(-0.3, 0.3);\n this.uniforms[\"seed_y\"].value = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.randFloat(-0.3, 0.3);\n } else if (this.goWild == false) {\n this.uniforms[\"byp\"].value = 1;\n }\n this.curF++;\n if (this.renderToScreen) {\n renderer.setRenderTarget(null);\n this.fsQuad.render(renderer);\n } else {\n renderer.setRenderTarget(writeBuffer);\n if (this.clear)\n renderer.clear();\n this.fsQuad.render(renderer);\n }\n }\n generateTrigger() {\n this.randX = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.randInt(120, 240);\n }\n generateHeightmap(dt_size) {\n const data_arr = new Float32Array(dt_size * dt_size);\n const length = dt_size * dt_size;\n for (let i2 = 0; i2 < length; i2++) {\n const val = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.randFloat(0, 1);\n data_arr[i2] = val;\n }\n const texture = new three__WEBPACK_IMPORTED_MODULE_42__.DataTexture(data_arr, dt_size, dt_size, three__WEBPACK_IMPORTED_MODULE_42__.RedFormat, three__WEBPACK_IMPORTED_MODULE_42__.FloatType);\n texture.needsUpdate = true;\n return texture;\n }\n}\nconst HalftoneShader = {\n uniforms: {\n tDiffuse: { value: null },\n shape: { value: 1 },\n radius: { value: 4 },\n rotateR: { value: Math.PI / 12 * 1 },\n rotateG: { value: Math.PI / 12 * 2 },\n rotateB: { value: Math.PI / 12 * 3 },\n scatter: { value: 0 },\n width: { value: 1 },\n height: { value: 1 },\n blending: { value: 1 },\n blendingMode: { value: 1 },\n greyscale: { value: false },\n disable: { value: false }\n },\n vertexShader: [\n \"varying vec2 vUV;\",\n \"void main() {\",\n \"\tvUV = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"#define SQRT2_MINUS_ONE 0.41421356\",\n \"#define SQRT2_HALF_MINUS_ONE 0.20710678\",\n \"#define PI2 6.28318531\",\n \"#define SHAPE_DOT 1\",\n \"#define SHAPE_ELLIPSE 2\",\n \"#define SHAPE_LINE 3\",\n \"#define SHAPE_SQUARE 4\",\n \"#define BLENDING_LINEAR 1\",\n \"#define BLENDING_MULTIPLY 2\",\n \"#define BLENDING_ADD 3\",\n \"#define BLENDING_LIGHTER 4\",\n \"#define BLENDING_DARKER 5\",\n \"uniform sampler2D tDiffuse;\",\n \"uniform float radius;\",\n \"uniform float rotateR;\",\n \"uniform float rotateG;\",\n \"uniform float rotateB;\",\n \"uniform float scatter;\",\n \"uniform float width;\",\n \"uniform float height;\",\n \"uniform int shape;\",\n \"uniform bool disable;\",\n \"uniform float blending;\",\n \"uniform int blendingMode;\",\n \"varying vec2 vUV;\",\n \"uniform bool greyscale;\",\n \"const int samples = 8;\",\n \"float blend( float a, float b, float t ) {\",\n // linear blend\n \"\treturn a * ( 1.0 - t ) + b * t;\",\n \"}\",\n \"float hypot( float x, float y ) {\",\n // vector magnitude\n \"\treturn sqrt( x * x + y * y );\",\n \"}\",\n \"float rand( vec2 seed ){\",\n // get pseudo-random number\n \"return fract( sin( dot( seed.xy, vec2( 12.9898, 78.233 ) ) ) * 43758.5453 );\",\n \"}\",\n \"float distanceToDotRadius( float channel, vec2 coord, vec2 normal, vec2 p, float angle, float rad_max ) {\",\n // apply shape-specific transforms\n \"\tfloat dist = hypot( coord.x - p.x, coord.y - p.y );\",\n \"\tfloat rad = channel;\",\n \"\tif ( shape == SHAPE_DOT ) {\",\n \"\t\trad = pow( abs( rad ), 1.125 ) * rad_max;\",\n \"\t} else if ( shape == SHAPE_ELLIPSE ) {\",\n \"\t\trad = pow( abs( rad ), 1.125 ) * rad_max;\",\n \"\t\tif ( dist != 0.0 ) {\",\n \"\t\t\tfloat dot_p = abs( ( p.x - coord.x ) / dist * normal.x + ( p.y - coord.y ) / dist * normal.y );\",\n \"\t\t\tdist = ( dist * ( 1.0 - SQRT2_HALF_MINUS_ONE ) ) + dot_p * dist * SQRT2_MINUS_ONE;\",\n \"\t\t}\",\n \"\t} else if ( shape == SHAPE_LINE ) {\",\n \"\t\trad = pow( abs( rad ), 1.5) * rad_max;\",\n \"\t\tfloat dot_p = ( p.x - coord.x ) * normal.x + ( p.y - coord.y ) * normal.y;\",\n \"\t\tdist = hypot( normal.x * dot_p, normal.y * dot_p );\",\n \"\t} else if ( shape == SHAPE_SQUARE ) {\",\n \"\t\tfloat theta = atan( p.y - coord.y, p.x - coord.x ) - angle;\",\n \"\t\tfloat sin_t = abs( sin( theta ) );\",\n \"\t\tfloat cos_t = abs( cos( theta ) );\",\n \"\t\trad = pow( abs( rad ), 1.4 );\",\n \"\t\trad = rad_max * ( rad + ( ( sin_t > cos_t ) ? rad - sin_t * rad : rad - cos_t * rad ) );\",\n \"\t}\",\n \"\treturn rad - dist;\",\n \"}\",\n \"struct Cell {\",\n // grid sample positions\n \"\tvec2 normal;\",\n \"\tvec2 p1;\",\n \"\tvec2 p2;\",\n \"\tvec2 p3;\",\n \"\tvec2 p4;\",\n \"\tfloat samp2;\",\n \"\tfloat samp1;\",\n \"\tfloat samp3;\",\n \"\tfloat samp4;\",\n \"};\",\n \"vec4 getSample( vec2 point ) {\",\n // multi-sampled point\n \"\tvec4 tex = texture2D( tDiffuse, vec2( point.x / width, point.y / height ) );\",\n \"\tfloat base = rand( vec2( floor( point.x ), floor( point.y ) ) ) * PI2;\",\n \"\tfloat step = PI2 / float( samples );\",\n \"\tfloat dist = radius * 0.66;\",\n \"\tfor ( int i = 0; i < samples; ++i ) {\",\n \"\t\tfloat r = base + step * float( i );\",\n \"\t\tvec2 coord = point + vec2( cos( r ) * dist, sin( r ) * dist );\",\n \"\t\ttex += texture2D( tDiffuse, vec2( coord.x / width, coord.y / height ) );\",\n \"\t}\",\n \"\ttex /= float( samples ) + 1.0;\",\n \"\treturn tex;\",\n \"}\",\n \"float getDotColour( Cell c, vec2 p, int channel, float angle, float aa ) {\",\n // get colour for given point\n \"\tfloat dist_c_1, dist_c_2, dist_c_3, dist_c_4, res;\",\n \"\tif ( channel == 0 ) {\",\n \"\t\tc.samp1 = getSample( c.p1 ).r;\",\n \"\t\tc.samp2 = getSample( c.p2 ).r;\",\n \"\t\tc.samp3 = getSample( c.p3 ).r;\",\n \"\t\tc.samp4 = getSample( c.p4 ).r;\",\n \"\t} else if (channel == 1) {\",\n \"\t\tc.samp1 = getSample( c.p1 ).g;\",\n \"\t\tc.samp2 = getSample( c.p2 ).g;\",\n \"\t\tc.samp3 = getSample( c.p3 ).g;\",\n \"\t\tc.samp4 = getSample( c.p4 ).g;\",\n \"\t} else {\",\n \"\t\tc.samp1 = getSample( c.p1 ).b;\",\n \"\t\tc.samp3 = getSample( c.p3 ).b;\",\n \"\t\tc.samp2 = getSample( c.p2 ).b;\",\n \"\t\tc.samp4 = getSample( c.p4 ).b;\",\n \"\t}\",\n \"\tdist_c_1 = distanceToDotRadius( c.samp1, c.p1, c.normal, p, angle, radius );\",\n \"\tdist_c_2 = distanceToDotRadius( c.samp2, c.p2, c.normal, p, angle, radius );\",\n \"\tdist_c_3 = distanceToDotRadius( c.samp3, c.p3, c.normal, p, angle, radius );\",\n \"\tdist_c_4 = distanceToDotRadius( c.samp4, c.p4, c.normal, p, angle, radius );\",\n \"\tres = ( dist_c_1 > 0.0 ) ? clamp( dist_c_1 / aa, 0.0, 1.0 ) : 0.0;\",\n \"\tres += ( dist_c_2 > 0.0 ) ? clamp( dist_c_2 / aa, 0.0, 1.0 ) : 0.0;\",\n \"\tres += ( dist_c_3 > 0.0 ) ? clamp( dist_c_3 / aa, 0.0, 1.0 ) : 0.0;\",\n \"\tres += ( dist_c_4 > 0.0 ) ? clamp( dist_c_4 / aa, 0.0, 1.0 ) : 0.0;\",\n \"\tres = clamp( res, 0.0, 1.0 );\",\n \"\treturn res;\",\n \"}\",\n \"Cell getReferenceCell( vec2 p, vec2 origin, float grid_angle, float step ) {\",\n // get containing cell\n \"\tCell c;\",\n // calc grid\n \"\tvec2 n = vec2( cos( grid_angle ), sin( grid_angle ) );\",\n \"\tfloat threshold = step * 0.5;\",\n \"\tfloat dot_normal = n.x * ( p.x - origin.x ) + n.y * ( p.y - origin.y );\",\n \"\tfloat dot_line = -n.y * ( p.x - origin.x ) + n.x * ( p.y - origin.y );\",\n \"\tvec2 offset = vec2( n.x * dot_normal, n.y * dot_normal );\",\n \"\tfloat offset_normal = mod( hypot( offset.x, offset.y ), step );\",\n \"\tfloat normal_dir = ( dot_normal < 0.0 ) ? 1.0 : -1.0;\",\n \"\tfloat normal_scale = ( ( offset_normal < threshold ) ? -offset_normal : step - offset_normal ) * normal_dir;\",\n \"\tfloat offset_line = mod( hypot( ( p.x - offset.x ) - origin.x, ( p.y - offset.y ) - origin.y ), step );\",\n \"\tfloat line_dir = ( dot_line < 0.0 ) ? 1.0 : -1.0;\",\n \"\tfloat line_scale = ( ( offset_line < threshold ) ? -offset_line : step - offset_line ) * line_dir;\",\n // get closest corner\n \"\tc.normal = n;\",\n \"\tc.p1.x = p.x - n.x * normal_scale + n.y * line_scale;\",\n \"\tc.p1.y = p.y - n.y * normal_scale - n.x * line_scale;\",\n // scatter\n \"\tif ( scatter != 0.0 ) {\",\n \"\t\tfloat off_mag = scatter * threshold * 0.5;\",\n \"\t\tfloat off_angle = rand( vec2( floor( c.p1.x ), floor( c.p1.y ) ) ) * PI2;\",\n \"\t\tc.p1.x += cos( off_angle ) * off_mag;\",\n \"\t\tc.p1.y += sin( off_angle ) * off_mag;\",\n \"\t}\",\n // find corners\n \"\tfloat normal_step = normal_dir * ( ( offset_normal < threshold ) ? step : -step );\",\n \"\tfloat line_step = line_dir * ( ( offset_line < threshold ) ? step : -step );\",\n \"\tc.p2.x = c.p1.x - n.x * normal_step;\",\n \"\tc.p2.y = c.p1.y - n.y * normal_step;\",\n \"\tc.p3.x = c.p1.x + n.y * line_step;\",\n \"\tc.p3.y = c.p1.y - n.x * line_step;\",\n \"\tc.p4.x = c.p1.x - n.x * normal_step + n.y * line_step;\",\n \"\tc.p4.y = c.p1.y - n.y * normal_step - n.x * line_step;\",\n \"\treturn c;\",\n \"}\",\n \"float blendColour( float a, float b, float t ) {\",\n // blend colours\n \"\tif ( blendingMode == BLENDING_LINEAR ) {\",\n \"\t\treturn blend( a, b, 1.0 - t );\",\n \"\t} else if ( blendingMode == BLENDING_ADD ) {\",\n \"\t\treturn blend( a, min( 1.0, a + b ), t );\",\n \"\t} else if ( blendingMode == BLENDING_MULTIPLY ) {\",\n \"\t\treturn blend( a, max( 0.0, a * b ), t );\",\n \"\t} else if ( blendingMode == BLENDING_LIGHTER ) {\",\n \"\t\treturn blend( a, max( a, b ), t );\",\n \"\t} else if ( blendingMode == BLENDING_DARKER ) {\",\n \"\t\treturn blend( a, min( a, b ), t );\",\n \"\t} else {\",\n \"\t\treturn blend( a, b, 1.0 - t );\",\n \"\t}\",\n \"}\",\n \"void main() {\",\n \"\tif ( ! disable ) {\",\n // setup\n \"\t\tvec2 p = vec2( vUV.x * width, vUV.y * height );\",\n \"\t\tvec2 origin = vec2( 0, 0 );\",\n \"\t\tfloat aa = ( radius < 2.5 ) ? radius * 0.5 : 1.25;\",\n // get channel samples\n \"\t\tCell cell_r = getReferenceCell( p, origin, rotateR, radius );\",\n \"\t\tCell cell_g = getReferenceCell( p, origin, rotateG, radius );\",\n \"\t\tCell cell_b = getReferenceCell( p, origin, rotateB, radius );\",\n \"\t\tfloat r = getDotColour( cell_r, p, 0, rotateR, aa );\",\n \"\t\tfloat g = getDotColour( cell_g, p, 1, rotateG, aa );\",\n \"\t\tfloat b = getDotColour( cell_b, p, 2, rotateB, aa );\",\n // blend with original\n \"\t\tvec4 colour = texture2D( tDiffuse, vUV );\",\n \"\t\tr = blendColour( r, colour.r, blending );\",\n \"\t\tg = blendColour( g, colour.g, blending );\",\n \"\t\tb = blendColour( b, colour.b, blending );\",\n \"\t\tif ( greyscale ) {\",\n \"\t\t\tr = g = b = (r + b + g) / 3.0;\",\n \"\t\t}\",\n \"\t\tgl_FragColor = vec4( r, g, b, 1.0 );\",\n \"\t} else {\",\n \"\t\tgl_FragColor = texture2D( tDiffuse, vUV );\",\n \"\t}\",\n \"}\"\n ].join(\"\\n\")\n};\nclass HalftonePass extends Pass {\n constructor(width, height, params) {\n super();\n __publicField(this, \"material\");\n __publicField(this, \"fsQuad\");\n __publicField(this, \"uniforms\");\n if (HalftoneShader === void 0) {\n console.error(\"THREE.HalftonePass requires HalftoneShader\");\n }\n this.uniforms = three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(HalftoneShader.uniforms);\n this.material = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: this.uniforms,\n fragmentShader: HalftoneShader.fragmentShader,\n vertexShader: HalftoneShader.vertexShader\n });\n this.uniforms.width.value = width;\n this.uniforms.height.value = height;\n for (const key in params) {\n if (params.hasOwnProperty(key) && this.uniforms.hasOwnProperty(key)) {\n this.uniforms[key].value = params[key];\n }\n }\n this.fsQuad = new FullScreenQuad(this.material);\n }\n render(renderer, writeBuffer, readBuffer) {\n this.material.uniforms[\"tDiffuse\"].value = readBuffer.texture;\n if (this.renderToScreen) {\n renderer.setRenderTarget(null);\n this.fsQuad.render(renderer);\n } else {\n renderer.setRenderTarget(writeBuffer);\n if (this.clear)\n renderer.clear();\n this.fsQuad.render(renderer);\n }\n }\n setSize(width, height) {\n this.uniforms.width.value = width;\n this.uniforms.height.value = height;\n }\n}\nconst SMAAEdgesShader = {\n defines: {\n SMAA_THRESHOLD: \"0.1\"\n },\n uniforms: {\n tDiffuse: { value: null },\n resolution: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(1 / 1024, 1 / 512) }\n },\n vertexShader: [\n \"uniform vec2 resolution;\",\n \"varying vec2 vUv;\",\n \"varying vec4 vOffset[ 3 ];\",\n \"void SMAAEdgeDetectionVS( vec2 texcoord ) {\",\n \"\tvOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -1.0, 0.0, 0.0, 1.0 );\",\n // WebGL port note: Changed sign in W component\n \"\tvOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( 1.0, 0.0, 0.0, -1.0 );\",\n // WebGL port note: Changed sign in W component\n \"\tvOffset[ 2 ] = texcoord.xyxy + resolution.xyxy * vec4( -2.0, 0.0, 0.0, 2.0 );\",\n // WebGL port note: Changed sign in W component\n \"}\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tSMAAEdgeDetectionVS( vUv );\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform sampler2D tDiffuse;\",\n \"varying vec2 vUv;\",\n \"varying vec4 vOffset[ 3 ];\",\n \"vec4 SMAAColorEdgeDetectionPS( vec2 texcoord, vec4 offset[3], sampler2D colorTex ) {\",\n \"\tvec2 threshold = vec2( SMAA_THRESHOLD, SMAA_THRESHOLD );\",\n // Calculate color deltas:\n \"\tvec4 delta;\",\n \"\tvec3 C = texture2D( colorTex, texcoord ).rgb;\",\n \"\tvec3 Cleft = texture2D( colorTex, offset[0].xy ).rgb;\",\n \"\tvec3 t = abs( C - Cleft );\",\n \"\tdelta.x = max( max( t.r, t.g ), t.b );\",\n \"\tvec3 Ctop = texture2D( colorTex, offset[0].zw ).rgb;\",\n \"\tt = abs( C - Ctop );\",\n \"\tdelta.y = max( max( t.r, t.g ), t.b );\",\n // We do the usual threshold:\n \"\tvec2 edges = step( threshold, delta.xy );\",\n // Then discard if there is no edge:\n \"\tif ( dot( edges, vec2( 1.0, 1.0 ) ) == 0.0 )\",\n \"\t\tdiscard;\",\n // Calculate right and bottom deltas:\n \"\tvec3 Cright = texture2D( colorTex, offset[1].xy ).rgb;\",\n \"\tt = abs( C - Cright );\",\n \"\tdelta.z = max( max( t.r, t.g ), t.b );\",\n \"\tvec3 Cbottom = texture2D( colorTex, offset[1].zw ).rgb;\",\n \"\tt = abs( C - Cbottom );\",\n \"\tdelta.w = max( max( t.r, t.g ), t.b );\",\n // Calculate the maximum delta in the direct neighborhood:\n \"\tfloat maxDelta = max( max( max( delta.x, delta.y ), delta.z ), delta.w );\",\n // Calculate left-left and top-top deltas:\n \"\tvec3 Cleftleft = texture2D( colorTex, offset[2].xy ).rgb;\",\n \"\tt = abs( C - Cleftleft );\",\n \"\tdelta.z = max( max( t.r, t.g ), t.b );\",\n \"\tvec3 Ctoptop = texture2D( colorTex, offset[2].zw ).rgb;\",\n \"\tt = abs( C - Ctoptop );\",\n \"\tdelta.w = max( max( t.r, t.g ), t.b );\",\n // Calculate the final maximum delta:\n \"\tmaxDelta = max( max( maxDelta, delta.z ), delta.w );\",\n // Local contrast adaptation in action:\n \"\tedges.xy *= step( 0.5 * maxDelta, delta.xy );\",\n \"\treturn vec4( edges, 0.0, 0.0 );\",\n \"}\",\n \"void main() {\",\n \"\tgl_FragColor = SMAAColorEdgeDetectionPS( vUv, vOffset, tDiffuse );\",\n \"}\"\n ].join(\"\\n\")\n};\nconst SMAAWeightsShader = {\n defines: {\n SMAA_MAX_SEARCH_STEPS: \"8\",\n SMAA_AREATEX_MAX_DISTANCE: \"16\",\n SMAA_AREATEX_PIXEL_SIZE: \"( 1.0 / vec2( 160.0, 560.0 ) )\",\n SMAA_AREATEX_SUBTEX_SIZE: \"( 1.0 / 7.0 )\"\n },\n uniforms: {\n tDiffuse: { value: null },\n tArea: { value: null },\n tSearch: { value: null },\n resolution: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(1 / 1024, 1 / 512) }\n },\n vertexShader: [\n \"uniform vec2 resolution;\",\n \"varying vec2 vUv;\",\n \"varying vec4 vOffset[ 3 ];\",\n \"varying vec2 vPixcoord;\",\n \"void SMAABlendingWeightCalculationVS( vec2 texcoord ) {\",\n \"\tvPixcoord = texcoord / resolution;\",\n // We will use these offsets for the searches later on (see @PSEUDO_GATHER4):\n \"\tvOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -0.25, 0.125, 1.25, 0.125 );\",\n // WebGL port note: Changed sign in Y and W components\n \"\tvOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( -0.125, 0.25, -0.125, -1.25 );\",\n // WebGL port note: Changed sign in Y and W components\n // And these for the searches, they indicate the ends of the loops:\n \"\tvOffset[ 2 ] = vec4( vOffset[ 0 ].xz, vOffset[ 1 ].yw ) + vec4( -2.0, 2.0, -2.0, 2.0 ) * resolution.xxyy * float( SMAA_MAX_SEARCH_STEPS );\",\n \"}\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tSMAABlendingWeightCalculationVS( vUv );\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"#define SMAASampleLevelZeroOffset( tex, coord, offset ) texture2D( tex, coord + float( offset ) * resolution, 0.0 )\",\n \"uniform sampler2D tDiffuse;\",\n \"uniform sampler2D tArea;\",\n \"uniform sampler2D tSearch;\",\n \"uniform vec2 resolution;\",\n \"varying vec2 vUv;\",\n \"varying vec4 vOffset[3];\",\n \"varying vec2 vPixcoord;\",\n \"#if __VERSION__ == 100\",\n \"vec2 round( vec2 x ) {\",\n \"\treturn sign( x ) * floor( abs( x ) + 0.5 );\",\n \"}\",\n \"#endif\",\n \"float SMAASearchLength( sampler2D searchTex, vec2 e, float bias, float scale ) {\",\n // Not required if searchTex accesses are set to point:\n // float2 SEARCH_TEX_PIXEL_SIZE = 1.0 / float2(66.0, 33.0);\n // e = float2(bias, 0.0) + 0.5 * SEARCH_TEX_PIXEL_SIZE +\n // e * float2(scale, 1.0) * float2(64.0, 32.0) * SEARCH_TEX_PIXEL_SIZE;\n \"\te.r = bias + e.r * scale;\",\n \"\treturn 255.0 * texture2D( searchTex, e, 0.0 ).r;\",\n \"}\",\n \"float SMAASearchXLeft( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {\",\n /**\n * @PSEUDO_GATHER4\n * This texcoord has been offset by (-0.25, -0.125) in the vertex shader to\n * sample between edge, thus fetching four edges in a row.\n * Sampling with different offsets in each direction allows to disambiguate\n * which edges are active from the four fetched ones.\n */\n \"\tvec2 e = vec2( 0.0, 1.0 );\",\n \"\tfor ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {\",\n // WebGL port note: Changed while to for\n \"\t\te = texture2D( edgesTex, texcoord, 0.0 ).rg;\",\n \"\t\ttexcoord -= vec2( 2.0, 0.0 ) * resolution;\",\n \"\t\tif ( ! ( texcoord.x > end && e.g > 0.8281 && e.r == 0.0 ) ) break;\",\n \"\t}\",\n // We correct the previous (-0.25, -0.125) offset we applied:\n \"\ttexcoord.x += 0.25 * resolution.x;\",\n // The searches are bias by 1, so adjust the coords accordingly:\n \"\ttexcoord.x += resolution.x;\",\n // Disambiguate the length added by the last step:\n \"\ttexcoord.x += 2.0 * resolution.x;\",\n // Undo last step\n \"\ttexcoord.x -= resolution.x * SMAASearchLength(searchTex, e, 0.0, 0.5);\",\n \"\treturn texcoord.x;\",\n \"}\",\n \"float SMAASearchXRight( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {\",\n \"\tvec2 e = vec2( 0.0, 1.0 );\",\n \"\tfor ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {\",\n // WebGL port note: Changed while to for\n \"\t\te = texture2D( edgesTex, texcoord, 0.0 ).rg;\",\n \"\t\ttexcoord += vec2( 2.0, 0.0 ) * resolution;\",\n \"\t\tif ( ! ( texcoord.x < end && e.g > 0.8281 && e.r == 0.0 ) ) break;\",\n \"\t}\",\n \"\ttexcoord.x -= 0.25 * resolution.x;\",\n \"\ttexcoord.x -= resolution.x;\",\n \"\ttexcoord.x -= 2.0 * resolution.x;\",\n \"\ttexcoord.x += resolution.x * SMAASearchLength( searchTex, e, 0.5, 0.5 );\",\n \"\treturn texcoord.x;\",\n \"}\",\n \"float SMAASearchYUp( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {\",\n \"\tvec2 e = vec2( 1.0, 0.0 );\",\n \"\tfor ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {\",\n // WebGL port note: Changed while to for\n \"\t\te = texture2D( edgesTex, texcoord, 0.0 ).rg;\",\n \"\t\ttexcoord += vec2( 0.0, 2.0 ) * resolution;\",\n // WebGL port note: Changed sign\n \"\t\tif ( ! ( texcoord.y > end && e.r > 0.8281 && e.g == 0.0 ) ) break;\",\n \"\t}\",\n \"\ttexcoord.y -= 0.25 * resolution.y;\",\n // WebGL port note: Changed sign\n \"\ttexcoord.y -= resolution.y;\",\n // WebGL port note: Changed sign\n \"\ttexcoord.y -= 2.0 * resolution.y;\",\n // WebGL port note: Changed sign\n \"\ttexcoord.y += resolution.y * SMAASearchLength( searchTex, e.gr, 0.0, 0.5 );\",\n // WebGL port note: Changed sign\n \"\treturn texcoord.y;\",\n \"}\",\n \"float SMAASearchYDown( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {\",\n \"\tvec2 e = vec2( 1.0, 0.0 );\",\n \"\tfor ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) {\",\n // WebGL port note: Changed while to for\n \"\t\te = texture2D( edgesTex, texcoord, 0.0 ).rg;\",\n \"\t\ttexcoord -= vec2( 0.0, 2.0 ) * resolution;\",\n // WebGL port note: Changed sign\n \"\t\tif ( ! ( texcoord.y < end && e.r > 0.8281 && e.g == 0.0 ) ) break;\",\n \"\t}\",\n \"\ttexcoord.y += 0.25 * resolution.y;\",\n // WebGL port note: Changed sign\n \"\ttexcoord.y += resolution.y;\",\n // WebGL port note: Changed sign\n \"\ttexcoord.y += 2.0 * resolution.y;\",\n // WebGL port note: Changed sign\n \"\ttexcoord.y -= resolution.y * SMAASearchLength( searchTex, e.gr, 0.5, 0.5 );\",\n // WebGL port note: Changed sign\n \"\treturn texcoord.y;\",\n \"}\",\n \"vec2 SMAAArea( sampler2D areaTex, vec2 dist, float e1, float e2, float offset ) {\",\n // Rounding prevents precision errors of bilinear filtering:\n \"\tvec2 texcoord = float( SMAA_AREATEX_MAX_DISTANCE ) * round( 4.0 * vec2( e1, e2 ) ) + dist;\",\n // We do a scale and bias for mapping to texel space:\n \"\ttexcoord = SMAA_AREATEX_PIXEL_SIZE * texcoord + ( 0.5 * SMAA_AREATEX_PIXEL_SIZE );\",\n // Move to proper place, according to the subpixel offset:\n \"\ttexcoord.y += SMAA_AREATEX_SUBTEX_SIZE * offset;\",\n \"\treturn texture2D( areaTex, texcoord, 0.0 ).rg;\",\n \"}\",\n \"vec4 SMAABlendingWeightCalculationPS( vec2 texcoord, vec2 pixcoord, vec4 offset[ 3 ], sampler2D edgesTex, sampler2D areaTex, sampler2D searchTex, ivec4 subsampleIndices ) {\",\n \"\tvec4 weights = vec4( 0.0, 0.0, 0.0, 0.0 );\",\n \"\tvec2 e = texture2D( edgesTex, texcoord ).rg;\",\n \"\tif ( e.g > 0.0 ) {\",\n // Edge at north\n \"\t\tvec2 d;\",\n // Find the distance to the left:\n \"\t\tvec2 coords;\",\n \"\t\tcoords.x = SMAASearchXLeft( edgesTex, searchTex, offset[ 0 ].xy, offset[ 2 ].x );\",\n \"\t\tcoords.y = offset[ 1 ].y;\",\n // offset[1].y = texcoord.y - 0.25 * resolution.y (@CROSSING_OFFSET)\n \"\t\td.x = coords.x;\",\n // Now fetch the left crossing edges, two at a time using bilinear\n // filtering. Sampling at -0.25 (see @CROSSING_OFFSET) enables to\n // discern what value each edge has:\n \"\t\tfloat e1 = texture2D( edgesTex, coords, 0.0 ).r;\",\n // Find the distance to the right:\n \"\t\tcoords.x = SMAASearchXRight( edgesTex, searchTex, offset[ 0 ].zw, offset[ 2 ].y );\",\n \"\t\td.y = coords.x;\",\n // We want the distances to be in pixel units (doing this here allow to\n // better interleave arithmetic and memory accesses):\n \"\t\td = d / resolution.x - pixcoord.x;\",\n // SMAAArea below needs a sqrt, as the areas texture is compressed\n // quadratically:\n \"\t\tvec2 sqrt_d = sqrt( abs( d ) );\",\n // Fetch the right crossing edges:\n \"\t\tcoords.y -= 1.0 * resolution.y;\",\n // WebGL port note: Added\n \"\t\tfloat e2 = SMAASampleLevelZeroOffset( edgesTex, coords, ivec2( 1, 0 ) ).r;\",\n // Ok, we know how this pattern looks like, now it is time for getting\n // the actual area:\n \"\t\tweights.rg = SMAAArea( areaTex, sqrt_d, e1, e2, float( subsampleIndices.y ) );\",\n \"\t}\",\n \"\tif ( e.r > 0.0 ) {\",\n // Edge at west\n \"\t\tvec2 d;\",\n // Find the distance to the top:\n \"\t\tvec2 coords;\",\n \"\t\tcoords.y = SMAASearchYUp( edgesTex, searchTex, offset[ 1 ].xy, offset[ 2 ].z );\",\n \"\t\tcoords.x = offset[ 0 ].x;\",\n // offset[1].x = texcoord.x - 0.25 * resolution.x;\n \"\t\td.x = coords.y;\",\n // Fetch the top crossing edges:\n \"\t\tfloat e1 = texture2D( edgesTex, coords, 0.0 ).g;\",\n // Find the distance to the bottom:\n \"\t\tcoords.y = SMAASearchYDown( edgesTex, searchTex, offset[ 1 ].zw, offset[ 2 ].w );\",\n \"\t\td.y = coords.y;\",\n // We want the distances to be in pixel units:\n \"\t\td = d / resolution.y - pixcoord.y;\",\n // SMAAArea below needs a sqrt, as the areas texture is compressed\n // quadratically:\n \"\t\tvec2 sqrt_d = sqrt( abs( d ) );\",\n // Fetch the bottom crossing edges:\n \"\t\tcoords.y -= 1.0 * resolution.y;\",\n // WebGL port note: Added\n \"\t\tfloat e2 = SMAASampleLevelZeroOffset( edgesTex, coords, ivec2( 0, 1 ) ).g;\",\n // Get the area for this direction:\n \"\t\tweights.ba = SMAAArea( areaTex, sqrt_d, e1, e2, float( subsampleIndices.x ) );\",\n \"\t}\",\n \"\treturn weights;\",\n \"}\",\n \"void main() {\",\n \"\tgl_FragColor = SMAABlendingWeightCalculationPS( vUv, vPixcoord, vOffset, tDiffuse, tArea, tSearch, ivec4( 0.0 ) );\",\n \"}\"\n ].join(\"\\n\")\n};\nconst SMAABlendShader = {\n uniforms: {\n tDiffuse: { value: null },\n tColor: { value: null },\n resolution: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(1 / 1024, 1 / 512) }\n },\n vertexShader: [\n \"uniform vec2 resolution;\",\n \"varying vec2 vUv;\",\n \"varying vec4 vOffset[ 2 ];\",\n \"void SMAANeighborhoodBlendingVS( vec2 texcoord ) {\",\n \"\tvOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -1.0, 0.0, 0.0, 1.0 );\",\n // WebGL port note: Changed sign in W component\n \"\tvOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( 1.0, 0.0, 0.0, -1.0 );\",\n // WebGL port note: Changed sign in W component\n \"}\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tSMAANeighborhoodBlendingVS( vUv );\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform sampler2D tDiffuse;\",\n \"uniform sampler2D tColor;\",\n \"uniform vec2 resolution;\",\n \"varying vec2 vUv;\",\n \"varying vec4 vOffset[ 2 ];\",\n \"vec4 SMAANeighborhoodBlendingPS( vec2 texcoord, vec4 offset[ 2 ], sampler2D colorTex, sampler2D blendTex ) {\",\n // Fetch the blending weights for current pixel:\n \"\tvec4 a;\",\n \"\ta.xz = texture2D( blendTex, texcoord ).xz;\",\n \"\ta.y = texture2D( blendTex, offset[ 1 ].zw ).g;\",\n \"\ta.w = texture2D( blendTex, offset[ 1 ].xy ).a;\",\n // Is there any blending weight with a value greater than 0.0?\n \"\tif ( dot(a, vec4( 1.0, 1.0, 1.0, 1.0 )) < 1e-5 ) {\",\n \"\t\treturn texture2D( colorTex, texcoord, 0.0 );\",\n \"\t} else {\",\n // Up to 4 lines can be crossing a pixel (one through each edge). We\n // favor blending by choosing the line with the maximum weight for each\n // direction:\n \"\t\tvec2 offset;\",\n \"\t\toffset.x = a.a > a.b ? a.a : -a.b;\",\n // left vs. right\n \"\t\toffset.y = a.g > a.r ? -a.g : a.r;\",\n // top vs. bottom // WebGL port note: Changed signs\n // Then we go in the direction that has the maximum weight:\n \"\t\tif ( abs( offset.x ) > abs( offset.y )) {\",\n // horizontal vs. vertical\n \"\t\t\toffset.y = 0.0;\",\n \"\t\t} else {\",\n \"\t\t\toffset.x = 0.0;\",\n \"\t\t}\",\n // Fetch the opposite color and lerp by hand:\n \"\t\tvec4 C = texture2D( colorTex, texcoord, 0.0 );\",\n \"\t\ttexcoord += sign( offset ) * resolution;\",\n \"\t\tvec4 Cop = texture2D( colorTex, texcoord, 0.0 );\",\n \"\t\tfloat s = abs( offset.x ) > abs( offset.y ) ? abs( offset.x ) : abs( offset.y );\",\n // WebGL port note: Added gamma correction\n \"\t\tC.xyz = pow(C.xyz, vec3(2.2));\",\n \"\t\tCop.xyz = pow(Cop.xyz, vec3(2.2));\",\n \"\t\tvec4 mixed = mix(C, Cop, s);\",\n \"\t\tmixed.xyz = pow(mixed.xyz, vec3(1.0 / 2.2));\",\n \"\t\treturn mixed;\",\n \"\t}\",\n \"}\",\n \"void main() {\",\n \"\tgl_FragColor = SMAANeighborhoodBlendingPS( vUv, vOffset, tColor, tDiffuse );\",\n \"}\"\n ].join(\"\\n\")\n};\nclass SMAAPass extends Pass {\n constructor(width, height) {\n super();\n this.edgesRT = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(width, height, {\n depthBuffer: false\n });\n this.edgesRT.texture.name = \"SMAAPass.edges\";\n this.weightsRT = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(width, height, {\n depthBuffer: false\n });\n this.weightsRT.texture.name = \"SMAAPass.weights\";\n const scope = this;\n const areaTextureImage = new Image();\n areaTextureImage.src = this.getAreaTexture();\n areaTextureImage.onload = function() {\n scope.areaTexture.needsUpdate = true;\n };\n this.areaTexture = new three__WEBPACK_IMPORTED_MODULE_42__.Texture();\n this.areaTexture.name = \"SMAAPass.area\";\n this.areaTexture.image = areaTextureImage;\n this.areaTexture.minFilter = three__WEBPACK_IMPORTED_MODULE_42__.LinearFilter;\n this.areaTexture.generateMipmaps = false;\n this.areaTexture.flipY = false;\n const searchTextureImage = new Image();\n searchTextureImage.src = this.getSearchTexture();\n searchTextureImage.onload = function() {\n scope.searchTexture.needsUpdate = true;\n };\n this.searchTexture = new three__WEBPACK_IMPORTED_MODULE_42__.Texture();\n this.searchTexture.name = \"SMAAPass.search\";\n this.searchTexture.image = searchTextureImage;\n this.searchTexture.magFilter = three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter;\n this.searchTexture.minFilter = three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter;\n this.searchTexture.generateMipmaps = false;\n this.searchTexture.flipY = false;\n if (SMAAEdgesShader === void 0) {\n console.error(\"THREE.SMAAPass relies on SMAAShader\");\n }\n this.uniformsEdges = three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(SMAAEdgesShader.uniforms);\n this.uniformsEdges[\"resolution\"].value.set(1 / width, 1 / height);\n this.materialEdges = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n defines: Object.assign({}, SMAAEdgesShader.defines),\n uniforms: this.uniformsEdges,\n vertexShader: SMAAEdgesShader.vertexShader,\n fragmentShader: SMAAEdgesShader.fragmentShader\n });\n this.uniformsWeights = three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(SMAAWeightsShader.uniforms);\n this.uniformsWeights[\"resolution\"].value.set(1 / width, 1 / height);\n this.uniformsWeights[\"tDiffuse\"].value = this.edgesRT.texture;\n this.uniformsWeights[\"tArea\"].value = this.areaTexture;\n this.uniformsWeights[\"tSearch\"].value = this.searchTexture;\n this.materialWeights = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n defines: Object.assign({}, SMAAWeightsShader.defines),\n uniforms: this.uniformsWeights,\n vertexShader: SMAAWeightsShader.vertexShader,\n fragmentShader: SMAAWeightsShader.fragmentShader\n });\n this.uniformsBlend = three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(SMAABlendShader.uniforms);\n this.uniformsBlend[\"resolution\"].value.set(1 / width, 1 / height);\n this.uniformsBlend[\"tDiffuse\"].value = this.weightsRT.texture;\n this.materialBlend = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: this.uniformsBlend,\n vertexShader: SMAABlendShader.vertexShader,\n fragmentShader: SMAABlendShader.fragmentShader\n });\n this.needsSwap = false;\n this.fsQuad = new FullScreenQuad(null);\n }\n render(renderer, writeBuffer, readBuffer) {\n this.uniformsEdges[\"tDiffuse\"].value = readBuffer.texture;\n this.fsQuad.material = this.materialEdges;\n renderer.setRenderTarget(this.edgesRT);\n if (this.clear)\n renderer.clear();\n this.fsQuad.render(renderer);\n this.fsQuad.material = this.materialWeights;\n renderer.setRenderTarget(this.weightsRT);\n if (this.clear)\n renderer.clear();\n this.fsQuad.render(renderer);\n this.uniformsBlend[\"tColor\"].value = readBuffer.texture;\n this.fsQuad.material = this.materialBlend;\n if (this.renderToScreen) {\n renderer.setRenderTarget(null);\n this.fsQuad.render(renderer);\n } else {\n renderer.setRenderTarget(writeBuffer);\n if (this.clear)\n renderer.clear();\n this.fsQuad.render(renderer);\n }\n }\n setSize(width, height) {\n this.edgesRT.setSize(width, height);\n this.weightsRT.setSize(width, height);\n this.materialEdges.uniforms[\"resolution\"].value.set(1 / width, 1 / height);\n this.materialWeights.uniforms[\"resolution\"].value.set(1 / width, 1 / height);\n this.materialBlend.uniforms[\"resolution\"].value.set(1 / width, 1 / height);\n }\n getAreaTexture() {\n return \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAIwCAIAAACOVPcQAACBeklEQVR42u39W4xlWXrnh/3WWvuciIzMrKxrV8/0rWbY0+SQFKcb4owIkSIFCjY9AC1BT/LYBozRi+EX+cV+8IMsYAaCwRcBwjzMiw2jAWtgwC8WR5Q8mDFHZLNHTarZGrLJJllt1W2qKrsumZWZcTvn7L3W54e1vrXX3vuciLPPORFR1XE2EomorB0nVuz//r71re/y/1eMvb4Cb3N11xV/PP/2v4UBAwJG/7H8urx6/25/Gf8O5hypMQ0EEEQwAqLfoN/Z+97f/SW+/NvcgQk4sGBJK6H7N4PFVL+K+e0N11yNfkKvwUdwdlUAXPHHL38oa15f/i/46Ih6SuMSPmLAYAwyRKn7dfMGH97jaMFBYCJUgotIC2YAdu+LyW9vvubxAP8kAL8H/koAuOKP3+q6+xGnd5kdYCeECnGIJViwGJMAkQKfDvB3WZxjLKGh8VSCCzhwEWBpMc5/kBbjawT4HnwJfhr+pPBIu7uu+OOTo9vsmtQcniMBGkKFd4jDWMSCRUpLjJYNJkM+IRzQ+PQvIeAMTrBS2LEiaiR9b/5PuT6Ap/AcfAFO4Y3dA3DFH7/VS+M8k4baEAQfMI4QfbVDDGIRg7GKaIY52qAjTAgTvGBAPGIIghOCYAUrGFNgzA7Q3QhgCwfwAnwe5vDejgG44o/fbm1C5ZlYQvQDARPAIQGxCWBM+wWl37ZQESb4gImexGMDouhGLx1Cst0Saa4b4AqO4Hk4gxo+3DHAV/nx27p3JziPM2pVgoiia5MdEzCGULprIN7gEEeQ5IQxEBBBQnxhsDb5auGmAAYcHMA9eAAz8PBol8/xij9+C4Djlim4gJjWcwZBhCBgMIIYxGAVIkH3ZtcBuLdtRFMWsPGoY9rN+HoBji9VBYdwD2ZQg4cnO7OSq/z4rU5KKdwVbFAjNojCQzTlCLPFSxtamwh2jMUcEgg2Wm/6XgErIBhBckQtGN3CzbVacERgCnfgLswhnvqf7QyAq/z4rRZm1YglYE3affGITaZsdIe2FmMIpnOCap25I6jt2kCwCW0D1uAD9sZctNGXcQIHCkINDQgc78aCr+zjtw3BU/ijdpw3zhCwcaONwBvdeS2YZKkJNJsMPf2JKEvC28RXxxI0ASJyzQCjCEQrO4Q7sFArEzjZhaFc4cdv+/JFdKULM4px0DfUBI2hIsy06BqLhGTQEVdbfAIZXYMPesq6VoCHICzUyjwInO4Y411//LYLs6TDa9wvg2CC2rElgAnpTBziThxaL22MYhzfkghz6GAs2VHbbdM91VZu1MEEpupMMwKyVTb5ij9+u4VJG/5EgEMMmFF01cFai3isRbKbzb+YaU/MQbAm2XSMoUPAmvZzbuKYRIFApbtlrfFuUGd6vq2hXNnH78ZLh/iFhsQG3T4D1ib7k5CC6vY0DCbtrohgLEIClXiGtl10zc0CnEGIhhatLBva7NP58Tvw0qE8yWhARLQ8h4+AhQSP+I4F5xoU+VilGRJs6wnS7ruti/4KvAY/CfdgqjsMy4pf8fodQO8/gnuX3f/3xi3om1/h7THr+co3x93PP9+FBUfbNUjcjEmhcrkT+8K7ml7V10Jo05mpIEFy1NmCJWx9SIKKt+EjAL4Ez8EBVOB6havuT/rByPvHXK+9zUcfcbb254+9fydJknYnRr1oGfdaiAgpxu1Rx/Rek8KISftx3L+DfsLWAANn8Hvw0/AFeAGO9DFV3c6D+CcWbL8Dj9e7f+T1k8AZv/d7+PXWM/Z+VvdCrIvuAKO09RpEEQJM0Ci6+B4xhTWr4cZNOvhktabw0ta0rSJmqz3Yw5/AKXwenod7cAhTmBSPKf6JBdvH8IP17h95pXqw50/+BFnj88fev4NchyaK47OPhhtI8RFSvAfDSNh0Ck0p2gLxGkib5NJj/JWCr90EWQJvwBzO4AHcgztwAFN1evHPUVGwfXON+0debT1YeGON9Yy9/63X+OguiwmhIhQhD7l4sMqlG3D86Suc3qWZ4rWjI1X7u0Ytw6x3rIMeIOPDprfe2XzNgyj6PahhBjO4C3e6puDgXrdg+/5l948vF3bqwZetZ+z9Rx9zdIY5pInPK4Nk0t+l52xdK2B45Qd87nM8fsD5EfUhIcJcERw4RdqqH7Yde5V7m1vhNmtedkz6EDzUMF/2jJYWbC+4fzzA/Y+/8PPH3j9dcBAPIRP8JLXd5BpAu03aziOL3VVHZzz3CXWDPWd+SH2AnxIqQoTZpo9Ckc6HIrFbAbzNmlcg8Ag8NFDDAhbJvTBZXbC94P7t68EXfv6o+21gUtPETU7bbkLxvNKRFG2+KXzvtObonPP4rBvsgmaKj404DlshFole1Glfh02fE7bYR7dZ82oTewIBGn1Md6CG6YUF26X376oevOLzx95vhUmgblI6LBZwTCDY7vMq0op5WVXgsObOXJ+1x3qaBl9j1FeLxbhU9w1F+Wiba6s1X/TBz1LnUfuYDi4r2C69f1f14BWfP+p+W2GFKuC9phcELMYRRLur9DEZTUdEH+iEqWdaM7X4WOoPGI+ZYD2+wcQ+y+ioHUZ9dTDbArzxmi/bJI9BND0Ynd6lBdve/butBw8+f/T9D3ABa3AG8W3VPX4hBin+bj8dMMmSpp5pg7fJ6xrBFE2WQQEWnV8Qg3FbAWzYfM1rREEnmvkN2o1+acG2d/9u68GDzx91v3mAjb1zkpqT21OipPKO0b9TO5W0nTdOmAQm0TObts3aBKgwARtoPDiCT0gHgwnbArzxmtcLc08HgF1asN0C4Ms/fvD5I+7PhfqyXE/b7RbbrGyRQRT9ARZcwAUmgdoz0ehJ9Fn7QAhUjhDAQSw0bV3T3WbNa59jzmiP6GsWbGXDX2ytjy8+f9T97fiBPq9YeLdBmyuizZHaqXITnXiMUEEVcJ7K4j3BFPurtB4bixW8wTpweL8DC95szWMOqucFYGsWbGU7p3TxxxefP+r+oTVktxY0v5hbq3KiOKYnY8ddJVSBxuMMVffNbxwIOERShst73HZ78DZrHpmJmH3K6sGz0fe3UUj0eyRrSCGTTc+rjVNoGzNSv05srAxUBh8IhqChiQgVNIIBH3AVPnrsnXQZbLTm8ammv8eVXn/vWpaTem5IXRlt+U/LA21zhSb9cye6jcOfCnOwhIAYXAMVTUNV0QhVha9xjgA27ODJbLbmitt3tRN80lqG6N/khgot4ZVlOyO4WNg3OIMzhIZQpUEHieg2im6F91hB3I2tubql6BYNN9Hj5S7G0G2tahslBWKDnOiIvuAEDzakDQKDNFQT6gbn8E2y4BBubM230YIpBnDbMa+y3dx0n1S0BtuG62lCCXwcY0F72T1VRR3t2ONcsmDjbmzNt9RFs2LO2hQNyb022JisaI8rAWuw4HI3FuAIhZdOGIcdjLJvvObqlpqvWTJnnQbyi/1M9O8UxWhBs//H42I0q1Yb/XPGONzcmm+ri172mHKvZBpHkJaNJz6v9jxqiklDj3U4CA2ugpAaYMWqNXsdXbmJNd9egCnJEsphXNM+MnK3m0FCJ5S1kmJpa3DgPVbnQnPGWIDspW9ozbcO4K/9LkfaQO2KHuqlfFXSbdNzcEcwoqNEFE9zcIXu9/6n/ym/BC/C3aJLzEKPuYVlbFnfhZ8kcWxV3dbv4bKl28566wD+8C53aw49lTABp9PWbsB+knfc/Li3eVizf5vv/xmvnPKg5ihwKEwlrcHqucuVcVOxEv8aH37E3ZqpZypUulrHEtIWKUr+txHg+ojZDGlwnqmkGlzcVi1dLiNSJiHjfbRNOPwKpx9TVdTn3K05DBx4psIk4Ei8aCkJahRgffk4YnEXe07T4H2RR1u27E6wfQsBDofUgjFUFnwC2AiVtA+05J2zpiDK2Oa0c5fmAecN1iJzmpqFZxqYBCYhFTCsUNEmUnIcZ6aEA5rQVhEywG6w7HSW02XfOoBlQmjwulOFQAg66SvJblrTEX1YtJ3uG15T/BH1OfOQeuR8g/c0gdpT5fx2SKbs9EfHTKdM8A1GaJRHLVIwhcGyydZsbifAFVKl5EMKNU2Hryo+06BeTgqnxzYjThVySDikbtJPieco75lYfKAJOMEZBTjoITuWHXXZVhcUDIS2hpiXHV9Ku4u44bN5OYLDOkJo8w+xJSMbhBRHEdEs9JZUCkQrPMAvaHyLkxgkEHxiNkx/x2YB0mGsQ8EUWj/stW5YLhtS5SMu+/YBbNPDCkGTUybN8krRLBGPlZkVOA0j+a1+rkyQKWGaPHPLZOkJhioQYnVZ2hS3zVxMtgC46KuRwbJNd9nV2PHgb36F194ecf/Yeu2vAFe5nm/bRBFrnY4BauE8ERmZRFUn0k8hbftiVYSKMEme2dJCJSCGYAlNqh87bXOPdUkGy24P6d1ll21MBqqx48Fvv8ZHH8HZFY7j/uAq1xMJUFqCSUlJPmNbIiNsmwuMs/q9CMtsZsFO6SprzCS1Z7QL8xCQClEelpjTduDMsmWD8S1PT152BtvmIGvUeDA/yRn83u/x0/4qxoPHjx+PXY9pqX9bgMvh/Nz9kpP4pOe1/fYf3axUiMdHLlPpZCNjgtNFAhcHEDxTumNONhHrBduW+vOyY++70WWnPXj98eA4kOt/mj/5E05l9+O4o8ePx67HFqyC+qSSnyselqjZGaVK2TadbFLPWAQ4NBhHqDCCV7OTpo34AlSSylPtIdd2AJZlyzYQrDJ5lcWGNceD80CunPLGGzsfD+7wRb95NevJI5docQ3tgCyr5bGnyaPRlmwNsFELViOOx9loebGNq2moDOKpHLVP5al2cymWHbkfzGXL7kfRl44H9wZy33tvt+PB/Xnf93e+nh5ZlU18wCiRUa9m7kib9LYuOk+hudQNbxwm0AQqbfloimaB2lM5fChex+ylMwuTbfmXQtmWlenZljbdXTLuOxjI/fDDHY4Hjx8/Hrse0zXfPFxbUN1kKqSCCSk50m0Ajtx3ub9XHBKHXESb8iO6E+qGytF4nO0OG3SXzbJlhxBnKtKyl0NwybjvYCD30aMdjgePHz8eu56SVTBbgxJMliQ3Oauwg0QHxXE2Ez/EIReLdQj42Gzb4CLS0YJD9xUx7bsi0vJi5mUbW1QzL0h0PFk17rtiIPfJk52MB48fPx67npJJwyrBa2RCCQRTbGZSPCxTPOiND4G2pYyOQ4h4jINIJh5wFU1NFZt+IsZ59LSnDqBjZ2awbOku+yInunLcd8VA7rNnOxkPHj9+PGY9B0MWJJNozOJmlglvDMXDEozdhQWbgs/U6oBanGzLrdSNNnZFjOkmbi5bNt1lX7JLLhn3vXAg9/h4y/Hg8ePHI9dzQMEkWCgdRfYykYKnkP7D4rIujsujaKPBsB54vE2TS00ccvFY/Tth7JXeq1hz+qgVy04sAJawTsvOknHfCwdyT062HA8eP348Zj0vdoXF4pilKa2BROed+9fyw9rWRXeTFXESMOanvDZfJuJaSXouQdMdDJZtekZcLLvEeK04d8m474UDuaenW44Hjx8/Xns9YYqZpszGWB3AN/4VHw+k7WSFtJ3Qicuqb/NlVmgXWsxh570xg2UwxUw3WfO6B5nOuO8aA7lnZxuPB48fPx6znm1i4bsfcbaptF3zNT78eFPtwi1OaCNOqp1x3zUGcs/PN++AGD1+fMXrSVm2baTtPhPahbPhA71wIHd2bXzRa69nG+3CraTtPivahV/55tXWg8fyRY/9AdsY8VbSdp8V7cKrrgdfM//z6ILQFtJ2nxHtwmuoB4/kf74+gLeRtvvMaBdeSz34+vifx0YG20jbfTa0C6+tHrwe//NmOG0L8EbSdp8R7cLrrQe/996O+ai3ujQOskpTNULa7jOjXXj99eCd8lHvoFiwsbTdZ0a78PrrwTvlo966pLuRtB2fFe3Cm6oHP9kNH/W2FryxtN1nTLvwRurBO+Kj3pWXHidtx2dFu/Bm68Fb81HvykuPlrb7LGkX3mw9eGs+6h1Y8MbSdjegXcguQLjmevDpTQLMxtJ2N6NdyBZu9AbrwVvwUW+LbteULUpCdqm0HTelXbhNPe8G68Gb8lFvVfYfSNuxvrTdTWoXbozAzdaDZzfkorOj1oxVxlIMlpSIlpLrt8D4hrQL17z+c3h6hU/wv4Q/utps4+bm+6P/hIcf0JwQ5oQGPBL0eKPTYEXTW+eL/2DKn73J9BTXYANG57hz1cEMviVf/4tf5b/6C5pTQkMIWoAq7hTpOJjtAM4pxKu5vg5vXeUrtI09/Mo/5H+4z+Mp5xULh7cEm2QbRP2tFIKR7WM3fPf/jZ3SWCqLM2l4NxID5zB72HQXv3jj/8mLR5xXNA5v8EbFQEz7PpRfl1+MB/hlAN65qgDn3wTgH13hK7T59bmP+NIx1SHHU84nLOITt3iVz8mNO+lPrjGAnBFqmioNn1mTyk1ta47R6d4MrX7tjrnjYUpdUbv2rVr6YpVfsGG58AG8Ah9eyUN8CX4WfgV+G8LVWPDGb+Zd4cU584CtqSbMKxauxTg+dyn/LkVgA+IR8KHtejeFKRtTmLLpxN6mYVLjYxwXf5x2VofiZcp/lwKk4wGOpYDnoIZPdg/AAbwMfx0+ge9dgZvYjuqKe4HnGnykYo5TvJbG0Vj12JagRhwKa44H95ShkZa5RyLGGdfYvG7aw1TsF6iapPAS29mNS3NmsTQZCmgTzFwgL3upCTgtBTRwvGMAKrgLn4evwin8+afJRcff+8izUGUM63GOOuAs3tJkw7J4kyoNreqrpO6cYLQeFUd7TTpr5YOTLc9RUUogUOVJQ1GYJaFLAW0oTmKyYS46ZooP4S4EON3xQ5zC8/CX4CnM4c1PE8ApexpoYuzqlP3d4S3OJP8ZDK7cKWNaTlqmgDiiHwl1YsE41w1zT4iRTm3DBqxvOUsbMKKDa/EHxagtnta072ejc3DOIh5ojvh8l3tk1JF/AV6FU6jh3U8HwEazLgdCLYSQ+MYiAI2ltomkzttUb0gGHdSUUgsIYjTzLG3mObX4FBRaYtpDVNZrih9TgTeYOBxsEnN1gOCTM8Bsw/ieMc75w9kuAT6A+/AiHGvN/+Gn4KRkiuzpNNDYhDGFndWRpE6SVfm8U5bxnSgVV2jrg6JCKmneqey8VMFgq2+AM/i4L4RUbfSi27lNXZ7R7W9RTcq/q9fk4Xw3AMQd4I5ifAZz8FcVtm9SAom/dyN4lczJQW/kC42ZrHgcCoIf1oVMKkVItmMBi9cOeNHGLqOZk+QqQmrbc5YmYgxELUUN35z2iohstgfLIFmcMV7s4CFmI74L9+EFmGsi+tGnAOD4Yk9gIpo01Y4cA43BWGygMdr4YZekG3OBIUXXNukvJS8tqa06e+lSDCtnqqMFu6hWHXCF+WaYt64m9QBmNxi7Ioy7D+fa1yHw+FMAcPt7SysFLtoG4PXAk7JOA3aAxBRqUiAdU9Yp5lK3HLSRFtOim0sa8euEt08xvKjYjzeJ2GU7YawexrnKI9tmobInjFXCewpwriY9+RR4aaezFhMhGCppKwom0ChrgFlKzyPKkGlTW1YQrE9HJqu8hKGgMc6hVi5QRq0PZxNfrYNgE64utmRv6KKHRpxf6VDUaOvNP5jCEx5q185My/7RKz69UQu2im5k4/eownpxZxNLwiZ1AZTO2ZjWjkU9uaB2HFn6Q3u0JcsSx/qV9hTEApRzeBLDJQXxYmTnq7bdLa3+uqFrxLJ5w1TehnNHx5ECvCh2g2c3hHH5YsfdaSKddztfjQ6imKFGSyFwlLzxEGPp6r5IevVjk1AMx3wMqi1NxDVjLBiPs9tbsCkIY5we5/ML22zrCScFxnNtzsr9Wcc3CnD+pYO+4VXXiDE0oc/vQQ/fDK3oPESJMYXNmJa/DuloJZkcTpcYE8lIH8Dz8DJMiynNC86Mb2lNaaqP/+L7f2fcE/yP7/Lde8xfgSOdMxvOixZf/9p3+M4hT1+F+zApxg9XfUvYjc8qX2lfOOpK2gNRtB4flpFu9FTKCp2XJRgXnX6olp1zyYjTKJSkGmLE2NjUr1bxFM4AeAAHBUFIeSLqXR+NvH/M9fOnfHzOD2vCSyQJKzfgsCh+yi/Mmc35F2fUrw7miW33W9hBD1vpuUojFphIyvg7aTeoymDkIkeW3XLHmguMzbIAJejN6B5MDrhipE2y6SoFRO/AK/AcHHZHNIfiWrEe/C6cr3f/yOvrQKB+zMM55/GQdLDsR+ifr5Fiuu+/y+M78LzOE5dsNuXC3PYvYWd8NXvphLSkJIasrlD2/HOqQ+RjcRdjKTGWYhhVUm4yxlyiGPuMsZR7sMCHUBeTuNWA7if+ifXgc/hovftHXs/DV+Fvwe+f8shzMiMcweFgBly3//vwJfg5AN4450fn1Hd1Rm1aBLu22Dy3y3H2+OqMemkbGZ4jozcDjJf6596xOLpC0eMTHbKnxLxH27uZ/bMTGs2jOaMOY4m87CfQwF0dw53oa1k80JRuz/XgS+8fX3N9Af4qPIMfzKgCp4H5TDGe9GGeFPzSsZz80SlPTxXjgwJmC45njzgt2vbQ4b4OAdUK4/vWhO8d8v6EE8fMUsfakXbPpFJeLs2ubM/qdm/la3WP91uWhxXHjoWhyRUq2iJ/+5mA73zwIIo+LoZ/SgvIRjAd1IMvvn98PfgOvAJfhhm8scAKVWDuaRaK8aQ9f7vuPDH6Bj47ZXau7rqYJ66mTDwEDU6lLbCjCK0qTXyl5mnDoeNRxanj3FJbaksTk0faXxHxLrssgPkWB9LnA/MFleXcJozzjwsUvUG0X/QCve51qkMDXp9mtcyOy3rwBfdvVJK7D6/ACSzg3RoruIq5UDeESfEmVclDxnniU82vxMLtceD0hGZWzBNPMM/jSPne2OVatiTKUpY5vY7gc0LdUAWeWM5tH+O2I66AOWw9xT2BuyRVLGdoDHUsVRXOo/c+ZdRXvFfnxWyIV4upFLCl9eAL7h8Zv0QH8Ry8pA2cHzQpGesctVA37ZtklBTgHjyvdSeKY/RZw/kJMk0Y25cSNRWSigQtlULPTw+kzuJPeYEkXjQRpoGZobYsLF79pyd1dMRHInbgFTZqNLhDqiIsTNpoex2WLcy0/X6rHcdMMQvFSd5dWA++4P7xv89deACnmr36uGlL69bRCL6BSZsS6c0TU2TKK5gtWCzgAOOwQcurqk9j8whvziZSMLcq5hbuwBEsYjopUBkqw1yYBGpLA97SRElEmx5MCInBY5vgLk94iKqSWmhIGmkJ4Bi9m4L645J68LyY4wsFYBfUg5feP/6gWWm58IEmKQM89hq7KsZNaKtP5TxxrUZZVkNmMJtjbKrGxLNEbHPJxhqy7lAmbC32ZqeF6lTaknRWcYaFpfLUBh/rwaQycCCJmW15Kstv6jRHyJFry2C1ahkkIW0LO75s61+owxK1y3XqweX9m5YLM2DPFeOjn/iiqCKJ+yKXF8t5Yl/kNsqaSCryxPq5xWTFIaP8KSW0RYxqupaUf0RcTNSSdJZGcKYdYA6kdtrtmyBckfKXwqk0pHpUHlwWaffjNRBYFPUDWa8e3Lt/o0R0CdisKDM89cX0pvRHEfM8ca4t0s2Xx4kgo91MPQJ/0c9MQYq0co8MBh7bz1fio0UUHLR4aAIOvOmoYO6kwlEVODSSTliWtOtH6sPkrtctF9ZtJ9GIerBskvhdVS5cFNv9s1BU0AbdUgdK4FG+dRnjFmDTzniRMdZO1QhzMK355vigbdkpz9P6qjUGE5J2qAcXmwJ20cZUiAD0z+pGMx6xkzJkmEf40Hr4qZfVg2XzF9YOyoV5BjzVkUJngKf8lgNYwKECEHrCNDrWZzMlflS3yBhr/InyoUgBc/lKT4pxVrrC6g1YwcceK3BmNxZcAtz3j5EIpqguh9H6wc011YN75cKDLpFDxuwkrPQmUwW4KTbj9mZTwBwLq4aQMUZbHm1rylJ46dzR0dua2n3RYCWZsiHROeywyJGR7mXKlpryyCiouY56sFkBWEnkEB/raeh/Sw4162KeuAxMQpEkzy5alMY5wamMsWKKrtW2WpEWNnReZWONKWjrdsKZarpFjqCslq773PLmEhM448Pc3+FKr1+94vv/rfw4tEcu+lKTBe4kZSdijBrykwv9vbCMPcLQTygBjzVckSLPRVGslqdunwJ4oegtFOYb4SwxNgWLCmD7T9kVjTv5YDgpo0XBmN34Z/rEHp0sgyz7lngsrm4lvMm2Mr1zNOJYJ5cuxuQxwMGJq/TP5emlb8fsQBZviK4t8hFL+zbhtlpwaRSxQRWfeETjuauPsdGxsBVdO7nmP4xvzSoT29pRl7kGqz+k26B3Oy0YNV+SXbbQas1ctC/GarskRdFpKczVAF1ZXnLcpaMuzVe6lZ2g/1ndcvOVgRG3sdUAY1bKD6achijMPdMxV4muKVorSpiDHituH7rSTs7n/4y5DhRXo4FVBN4vO/zbAcxhENzGbHCzU/98Mcx5e7a31kWjw9FCe/zNeYyQjZsWb1uc7U33pN4Mji6hCLhivqfa9Ss6xLg031AgfesA/l99m9fgvnaF9JoE6bYKmkGNK3aPbHB96w3+DnxFm4hs0drLsk7U8kf/N/CvwQNtllna0rjq61sH8L80HAuvwH1tvBy2ChqWSCaYTaGN19sTvlfzFD6n+iKTbvtayfrfe9ueWh6GJFoxLdr7V72a5ZpvHcCPDzma0wTO4EgbLyedxstO81n57LYBOBzyfsOhUKsW1J1BB5vr/tz8RyqOFylQP9Tvst2JALsC5lsH8PyQ40DV4ANzYa4dedNiKNR1s+x2wwbR7q4/4cTxqEk4LWDebfisuo36JXLiWFjOtLrlNWh3K1rRS4xvHcDNlFnNmWBBAl5SWaL3oPOfnvbr5pdjVnEaeBJSYjuLEkyLLsWhKccadmOphZkOPgVdalj2QpSmfOsADhMWE2ZBu4+EEJI4wKTAuCoC4xwQbWXBltpxbjkXJtKxxabo9e7tyhlgb6gNlSbUpMh+l/FaqzVwewGu8BW1Zx7pTpQDJUjb8tsUTW6+GDXbMn3mLbXlXJiGdggxFAoUrtPS3wE4Nk02UZG2OOzlk7fRs7i95QCLo3E0jtrjnM7SR3uS1p4qtS2nJ5OwtQVHgOvArLBFijZUV9QtSl8dAY5d0E0hM0w3HS2DpIeB6m/A1+HfhJcGUq4sOxH+x3f5+VO+Ds9rYNI7zPXOYWPrtf8bYMx6fuOAX5jzNR0PdsuON+X1f7EERxMJJoU6GkTEWBvVolVlb5lh3tKCg6Wx1IbaMDdJ+9sUCc5KC46hKGCk3IVOS4TCqdBNfUs7Kd4iXf2RjnT/LLysJy3XDcHLh/vde3x8DoGvwgsa67vBk91G5Pe/HbOe7xwym0NXbtiuuDkGO2IJDh9oQvJ4cY4vdoqLDuoH9Zl2F/ofsekn8lkuhIlhQcffUtSjytFyp++p6NiE7Rqx/lodgKVoceEp/CP4FfjrquZaTtj2AvH5K/ywpn7M34K/SsoYDAdIN448I1/0/wveW289T1/lX5xBzc8N5IaHr0XMOQdHsIkDuJFifj20pBm5jzwUv9e2FhwRsvhAbalCIuIw3bhJihY3p6nTFFIZgiSYjfTf3aXuOjmeGn4bPoGvwl+CFzTRczBIuHBEeImHc37/lGfwZR0cXzVDOvaKfNHvwe+suZ771K/y/XcBlsoN996JpBhoE2toYxOznNEOS5TJc6Id5GEXLjrWo+LEWGNpPDU4WAwsIRROu+1vM+0oW37z/MBN9kqHnSArwPfgFJ7Cq/Ai3Ie7g7ncmI09v8sjzw9mzOAEXoIHxURueaAce5V80f/DOuuZwHM8vsMb5wBzOFWM7wymTXPAEvm4vcFpZ2ut0VZRjkiP2MlmLd6DIpbGSiHOjdnUHN90hRYmhTnmvhzp1iKDNj+b7t5hi79lWGwQ+HN9RsfFMy0FXbEwhfuczKgCbyxYwBmcFhhvo/7a44v+i3XWcwDP86PzpGQYdWh7csP5dBvZ1jNzdxC8pBGuxqSW5vw40nBpj5JhMwvOzN0RWqERHMr4Lv1kWX84xLR830G3j6yqZ1a8UstTlW+qJPOZ+sZ7xZPKTJLhiNOAFd6tk+jrTH31ncLOxid8+nzRb128HhUcru/y0Wn6iT254YPC6FtVSIMoW2sk727AhvTtrWKZTvgsmckfXYZWeNRXx/3YQ2OUxLDrbHtN11IwrgXT6c8dATDwLniYwxzO4RzuQqTKSC5gAofMZ1QBK3zQ4JWobFbcvJm87FK+6JXrKahLn54m3p+McXzzYtP8VF/QpJuh1OwieElEoI1pRxPS09FBrkq2tWCU59+HdhNtTIqKm8EBrw2RTOEDpG3IKo2Y7mFdLm3ZeVjYwVw11o/oznceMve4CgMfNym/utA/d/ILMR7gpXzRy9eDsgLcgbs8O2Va1L0zzIdwGGemTBuwROHeoMShkUc7P+ISY3KH5ZZeWqO8mFTxQYeXTNuzvvK5FGPdQfuu00DwYFY9dyhctEt+OJDdnucfpmyhzUJzfsJjr29l8S0bXBfwRS9ZT26tmMIdZucch5ZboMz3Nio3nIOsYHCGoDT4kUA9MiXEp9Xsui1S8th/kbWIrMBxDGLodWUQIWcvnXy+9M23xPiSMOiRPqM+YMXkUN3gXFrZJwXGzUaMpJfyRS9ZT0lPe8TpScuRlbMHeUmlaKDoNuy62iWNTWNFYjoxFzuJs8oR+RhRx7O4SVNSXpa0ZJQ0K1LAHDQ+D9IepkMXpcsq5EVCvClBUIzDhDoyKwDw1Lc59GbTeORivugw1IcuaEOaGWdNm+Ps5fQ7/tm0DjMegq3yM3vb5j12qUId5UZD2oxDSEWOZMSqFl/W+5oynWDa/aI04tJRQ2eTXusg86SQVu/nwSYwpW6wLjlqIzwLuxGIvoAvul0PS+ZNz0/akp/pniO/8JDnGyaCkzbhl6YcqmK/69prxPqtpx2+Km9al9sjL+rwMgHw4jE/C8/HQ3m1vBuL1fldbzd8mOueVJ92syqdEY4KJjSCde3mcRw2TA6szxedn+zwhZMps0XrqEsiUjnC1hw0TELC2Ek7uAAdzcheXv1BYLagspxpzSAoZZUsIzIq35MnFQ9DOrlNB30jq3L4pkhccKUAA8/ocvN1Rzx9QyOtERs4CVsJRK/DF71kPYrxYsGsm6RMh4cps5g1DOmM54Ly1ii0Hd3Y/BMk8VWFgBVmhqrkJCPBHAolwZaWzLR9Vb7bcWdX9NyUYE+uB2BKfuaeBUcjDljbYVY4DdtsVWvzRZdWnyUzDpjNl1Du3aloAjVJTNDpcIOVVhrHFF66lLfJL1zJr9PQ2nFJSBaKoDe+sAvLufZVHVzYh7W0h/c6AAZ+7Tvj6q9j68G/cTCS/3n1vLKHZwNi+P+pS0WkZNMBMUl+LDLuiE4omZy71r3UFMwNJV+VJ/GC5ixVUkBStsT4gGKh0Gm4Oy3qvq7Lbmq24nPdDuDR9deR11XzP4vFu3TYzfnIyiSVmgizUYGqkIXNdKTY9pgb9D2Ix5t0+NHkVzCdU03suWkkVZAoCONCn0T35gAeW38de43mf97sMOpSvj4aa1KYUm58USI7Wxxes03bAZdRzk6UtbzMaCQ6IxO0dy7X+XsjoD16hpsBeGz9dfzHj+R/Hp8nCxZRqkEDTaCKCSywjiaoMJ1TITE9eg7Jqnq8HL6gDwiZb0u0V0Rr/rmvqjxKuaLCX7ZWXTvAY+uvm3z8CP7nzVpngqrJpZKwWnCUjIviYVlirlGOzPLI3SMVyp/elvBUjjDkNhrtufFFErQ8pmdSlbK16toBHlt/HV8uHMX/vEGALkV3RJREiSlopxwdMXOZPLZ+ix+kAHpMKIk8UtE1ygtquttwxNhphrIZ1IBzjGF3IIGxGcBj6q8bHJBG8T9vdsoWrTFEuebEZuVxhhClH6P5Zo89OG9fwHNjtNQTpD0TG9PJLEYqvEY6Rlxy+ZZGfL0Aj62/bnQCXp//eeM4KzfQVJbgMQbUjlMFIm6TpcfWlZje7NBSV6IsEVmumWIbjiloUzQX9OzYdo8L1wjw2PrrpimONfmfNyzKklrgnEkSzT5QWYQW40YShyzqsRmMXbvVxKtGuYyMKaU1ugenLDm5Ily4iT14fP11Mx+xJv+zZ3MvnfdFqxU3a1W/FTB4m3Qfsyc1XUcdVhDeUDZXSFHHLQj/Y5jtC7ZqM0CXGwB4bP11i3LhOvzPGygYtiUBiwQV/4wFO0majijGsafHyRLu0yG6q35cL1rOpVxr2s5cM2jJYMCdc10Aj6q/blRpWJ//+dmm5psMl0KA2+AFRx9jMe2WbC4jQxnikd4DU8TwUjRVacgdlhmr3bpddzuJ9zXqr2xnxJfzP29RexdtjDVZqzkqa6PyvcojGrfkXiJ8SEtml/nYskicv0ivlxbqjemwUjMw5evdg8fUX9nOiC/lf94Q2i7MURk9nW1MSj5j8eAyV6y5CN2S6qbnw3vdA1Iwq+XOSCl663udN3IzLnrt+us25cI1+Z83SXQUldqQq0b5XOT17bGpLd6ssN1VMPf8c+jG8L3NeCnMdF+Ra3fRa9dft39/LuZ/3vwHoHrqGmQFafmiQw6eyzMxS05K4bL9uA+SKUQzCnSDkqOGokXyJvbgJ/BHI+qvY69//4rl20NsmK2ou2dTsyIALv/91/8n3P2Aao71WFGi8KKv1fRC5+J67Q/507/E/SOshqN5TsmYIjVt+kcjAx98iz/4SaojbIV1rexE7/C29HcYD/DX4a0rBOF5VTu7omsb11L/AWcVlcVZHSsqGuXLLp9ha8I//w3Mv+T4Ew7nTBsmgapoCrNFObIcN4pf/Ob/mrvHTGqqgAupL8qWjWPS9m/31jAe4DjA+4+uCoQoT/zOzlrNd3qd4SdphFxsUvYwGWbTWtISc3wNOWH+kHBMfc6kpmpwPgHWwqaSUG2ZWWheYOGQGaHB+eQ/kn6b3pOgLV+ODSn94wDvr8Bvb70/LLuiPPEr8OGVWfDmr45PZyccEmsVXZGe1pRNX9SU5+AVQkNTIVPCHF/jGmyDC9j4R9LfWcQvfiETmgMMUCMN1uNCakkweZsowdYobiMSlnKA93u7NzTXlSfe+SVbfnPQXmg9LpYAQxpwEtONyEyaueWM4FPjjyjG3uOaFmBTWDNgBXGEiQpsaWhnAqIijB07Dlsy3fUGeP989xbWkyf+FF2SNEtT1E0f4DYYVlxFlbaSMPIRMk/3iMU5pME2SIWJvjckciebkQuIRRyhUvkHg/iUljG5kzVog5hV7vIlCuBrmlhvgPfNHQM8lCf+FEGsYbMIBC0qC9a0uuy2wLXVbLBaP5kjHokCRxapkQyzI4QEcwgYHRZBp+XEFTqXFuNVzMtjXLJgX4gAid24Hjwc4N3dtVSe+NNiwTrzH4WVUOlDobUqr1FuAgYllc8pmzoVrELRHSIW8ViPxNy4xwjBpyR55I6J220qQTZYR4guvUICJiSpr9gFFle4RcF/OMB7BRiX8sSfhpNSO3lvEZCQfLUVTKT78Ek1LRLhWN+yLyTnp8qWUZ46b6vxdRGXfHVqx3eI75YaLa4iNNiK4NOW7wPW6lhbSOF9/M9qw8e/aoB3d156qTzxp8pXx5BKAsYSTOIIiPkp68GmTq7sZtvyzBQaRLNxIZ+paozHWoLFeExIhRBrWitHCAHrCF7/thhD8JhYz84wg93QRV88wLuLY8zF8sQ36qF1J455bOlgnELfshKVxYOXKVuKx0jaj22sczTQqPqtV/XDgpswmGTWWMSDw3ssyUunLLrVPGjYRsH5ggHeHSWiV8kT33ycFSfMgkoOK8apCye0J6VW6GOYvffgU9RWsukEi2kUV2nl4dOYUzRik9p7bcA4ggdJ53LxKcEe17B1R8eqAd7dOepV8sTXf5lhejoL85hUdhDdknPtKHFhljOT+bdq0hxbm35p2nc8+Ja1Iw+tJykgp0EWuAAZYwMVwac5KzYMslhvgHdHRrxKnvhTYcfKsxTxtTETkjHO7rr3zjoV25lAQHrqpV7bTiy2aXMmUhTBnKS91jhtR3GEoF0oLnWhWNnYgtcc4N0FxlcgT7yz3TgNIKkscx9jtV1ZKpWW+Ub1tc1eOv5ucdgpx+FJy9pgbLE7xDyXb/f+hLHVGeitHOi6A7ybo3sF8sS7w7cgdk0nJaOn3hLj3uyD0Zp5pazFIUXUpuTTU18d1EPkDoX8SkmWTnVIozEdbTcZjoqxhNHf1JrSS/AcvHjZ/SMHhL/7i5z+POsTUh/8BvNfYMTA8n+yU/MlTZxSJDRStqvEuLQKWwDctMTQogUDyQRoTQG5Kc6oQRE1yV1jCA7ri7jdZyK0sYTRjCR0Hnnd+y7nHxNgTULqw+8wj0mQKxpYvhjm9uSUxg+TTy7s2GtLUGcywhXSKZN275GsqlclX90J6bRI1aouxmgL7Q0Nen5ziM80SqMIo8cSOo+8XplT/5DHNWsSUr/6lLN/QQ3rDyzLruEW5enpf7KqZoShEduuSFOV7DLX7Ye+GmXb6/hnNNqKsVXuMDFpb9Y9eH3C6NGEzuOuI3gpMH/I6e+zDiH1fXi15t3vA1czsLws0TGEtmPEJdiiFPwlwKbgLHAFk4P6ZyPdymYYHGE0dutsChQBl2JcBFlrEkY/N5bQeXQ18gjunuMfMfsBlxJSx3niO485fwO4fGD5T/+3fPQqkneWVdwnw/3bMPkW9Wbqg+iC765Zk+xcT98ibKZc2EdgHcLoF8cSOo/Oc8fS+OyEULF4g4sJqXVcmfMfsc7A8v1/yfGXmL9I6Fn5pRwZhsPv0TxFNlAfZCvG+Oohi82UC5f/2IsJo0cTOm9YrDoKhFPEUr/LBYTUNht9zelHXDqwfPCIw4owp3mOcIQcLttWXFe3VZ/j5H3cIc0G6oPbCR+6Y2xF2EC5cGUm6wKC5tGEzhsWqw5hNidUiKX5gFWE1GXh4/Qplw4sVzOmx9QxU78g3EF6wnZlEN4FzJ1QPSLEZz1KfXC7vd8ssGdIbNUYpVx4UapyFUHzJoTOo1McSkeNn1M5MDQfs4qQuhhX5vQZFw8suwWTcyYTgioISk2YdmkhehG4PkE7w51inyAGGaU+uCXADabGzJR1fn3lwkty0asIo8cROm9Vy1g0yDxxtPvHDAmpu+PKnM8Ix1wwsGw91YJqhteaWgjYBmmQiebmSpwKKzE19hx7jkzSWOm66oPbzZ8Yj6kxVSpYjVAuvLzYMCRo3oTQecOOjjgi3NQ4l9K5/hOGhNTdcWVOTrlgYNkEXINbpCkBRyqhp+LdRB3g0OU6rMfW2HPCFFMV9nSp+uB2woepdbLBuJQyaw/ZFysXrlXwHxI0b0LovEkiOpXGA1Ijagf+KUNC6rKNa9bQnLFqYNkEnMc1uJrg2u64ELPBHpkgWbmwKpJoDhMwNbbGzAp7Yg31wS2T5rGtzit59PrKhesWG550CZpHEzpv2NGRaxlNjbMqpmEIzygJqQfjypycs2pg2cS2RY9r8HUqkqdEgKTWtWTKoRvOBPDYBltja2SO0RGjy9UHtxwRjA11ujbKF+ti5cIR9eCnxUg6owidtyoU5tK4NLji5Q3HCtiyF2IqLGYsHViOXTXOYxucDqG0HyttqYAKqYo3KTY1ekyDXRAm2AWh9JmsVh/ccg9WJ2E8YjG201sPq5ULxxX8n3XLXuMInbft2mk80rRGjCGctJ8/GFdmEQ9Ug4FlE1ll1Y7jtiraqm5Fe04VV8lvSVBL8hiPrfFVd8+7QH3Qbu2ipTVi8cvSGivc9cj8yvH11YMHdNSERtuOslM97feYFOPKzGcsI4zW0YGAbTAOaxCnxdfiYUmVWslxiIblCeAYr9VYR1gM7GmoPrilunSxxeT3DN/2eBQ9H11+nk1adn6VK71+5+Jfct4/el10/7KBZfNryUunWSCPxPECk1rdOv1WVSrQmpC+Tl46YD3ikQYcpunSQgzVB2VHFhxHVGKDgMEY5GLlQnP7FMDzw7IacAWnO6sBr12u+XanW2AO0wQ8pknnFhsL7KYIqhkEPmEXFkwaN5KQphbkUmG72wgw7WSm9RiL9QT925hkjiVIIhphFS9HKI6/8QAjlpXqg9W2C0apyaVDwKQwrwLY3j6ADR13ZyUNByQXHQu6RY09Hu6zMqXRaNZGS/KEJs0cJEe9VH1QdvBSJv9h09eiRmy0V2uJcqHcShcdvbSNg5fxkenkVprXM9rDVnX24/y9MVtncvbKY706anNl3ASll9a43UiacVquXGhvq4s2FP62NGKfQLIQYu9q1WmdMfmUrDGt8eDS0cXozH/fjmUH6Jruvm50hBDSaEU/2Ru2LEN/dl006TSc/g7tfJERxGMsgDUEr104pfWH9lQaN+M4KWQjwZbVc2rZVNHsyHal23wZtIs2JJqtIc/WLXXRFCpJkfE9jvWlfFbsNQ9pP5ZBS0zKh4R0aMFj1IjTcTnvi0Zz2rt7NdvQb2mgbju1plsH8MmbnEk7KbK0b+wC2iy3aX3szW8xeZvDwET6hWZYwqTXSSG+wMETKum0Dq/q+x62gt2ua2ppAo309TRk9TPazfV3qL9H8z7uhGqGqxNVg/FKx0HBl9OVUORn8Q8Jx9gFttGQUDr3tzcXX9xGgN0EpzN9mdZ3GATtPhL+CjxFDmkeEU6x56kqZRusLzALXVqkCN7zMEcqwjmywDQ6OhyUe0Xao1Qpyncrg6wKp9XfWDsaZplElvQ/b3sdweeghorwBDlHzgk1JmMc/wiERICVy2VJFdMjFuLQSp3S0W3+sngt2njwNgLssFGVQdJ0tu0KH4ky1LW4yrbkuaA6Iy9oz/qEMMXMMDWyIHhsAyFZc2peV9hc7kiKvfULxCl9iddfRK1f8kk9qvbdOoBtOg7ZkOZ5MsGrSHsokgLXUp9y88smniwWyuFSIRVmjplga3yD8Uij5QS1ZiM4U3Qw5QlSm2bXjFe6jzzBFtpg+/YBbLAWG7OPynNjlCw65fukGNdkJRf7yM1fOxVzbxOJVocFoYIaGwH22mIQkrvu1E2nGuebxIgW9U9TSiukPGU+Lt++c3DJPKhyhEEbXCQLUpae2exiKy6tMPe9mDRBFCEMTWrtwxN8qvuGnt6MoihKWS5NSyBhbH8StXoAz8PLOrRgLtOT/+4vcu+7vDLnqNvztOq7fmd8sMmY9Xzn1zj8Dq8+XVdu2Nv0IIySgEdQo3xVHps3Q5i3fLFsV4aiqzAiBhbgMDEd1uh8qZZ+lwhjkgokkOIv4xNJmyncdfUUzgB4oFMBtiu71Xumpz/P+cfUP+SlwFExwWW62r7b+LSPxqxn/gvMZ5z9C16t15UbNlq+jbGJtco7p8wbYlL4alSyfWdeuu0j7JA3JFNuVAwtst7F7FhWBbPFNKIUORndWtLraFLmMu7KFVDDOzqkeaiN33YAW/r76wR4XDN/yN1z7hejPau06EddkS/6XThfcz1fI/4K736fO48vlxt2PXJYFaeUkFS8U15XE3428xdtn2kc8GQlf1vkIaNRRnOMvLTWrZbElEHeLWi1o0dlKPAh1MVgbbVquPJ5+Cr8LU5/H/+I2QlHIU2ClXM9G8v7Rr7oc/hozfUUgsPnb3D+I+7WF8kNO92GY0SNvuxiE+2Bt8prVJTkzE64sfOstxuwfxUUoyk8VjcTlsqe2qITSFoSj6Epd4KsT6BZOWmtgE3hBfir8IzZDwgV4ZTZvD8VvPHERo8v+vL1DASHTz/i9OlKueHDjK5Rnx/JB1Vb1ioXdBra16dmt7dgik10yA/FwJSVY6XjA3oy4SqM2frqDPPSRMex9qs3XQtoWxMj7/Er8GWYsXgjaVz4OYumP2+9kbxvny/6kvWsEBw+fcb5bInc8APdhpOSs01tEqIkoiZjbAqKMruLbJYddHuHFRIyJcbdEdbl2sVLaySygunutBg96Y2/JjKRCdyHV+AEFtTvIpbKIXOamknYSiB6KV/0JetZITgcjjk5ZdaskBtWO86UF0ap6ozGXJk2WNiRUlCPFir66lzdm/SLSuK7EUdPz8f1z29Skq6F1fXg8+5UVR6bszncP4Tn4KUkkdJ8UFCY1zR1i8RmL/qQL3rlei4THG7OODlnKko4oI01kd3CaM08Ia18kC3GNoVaO9iDh+hWxSyTXFABXoau7Q6q9OxYg/OVEMw6jdbtSrJ9cBcewGmaZmg+bvkUnUUaGr+ZfnMH45Ivevl61hMcXsxYLFTu1hTm2zViCp7u0o5l+2PSUh9bDj6FgYypufBDhqK2+oXkiuHFHR3zfj+9PtA8oR0xnqX8qn+sx3bFODSbbF0X8EUvWQ8jBIcjo5bRmLOljDNtcqNtOe756h3l0VhKa9hDd2l1eqmsnh0MNMT/Cqnx6BInumhLT8luljzQ53RiJeA/0dxe5NK0o2fA1+GLXr6eNQWHNUOJssQaTRlGpLHKL9fD+IrQzTOMZS9fNQD4AnRNVxvTdjC+fJdcDDWQcyB00B0t9BDwTxXgaAfzDZ/DBXzRnfWMFRwuNqocOmX6OKNkY63h5n/fFcB28McVHqnXZVI27K0i4rDLNE9lDKV/rT+udVbD8dFFu2GGZ8mOt0kAXcoX3ZkIWVtw+MNf5NjR2FbivROHmhV1/pj2egv/fMGIOWTIWrV3Av8N9imV9IWml36H6cUjqEWNv9aNc+veb2sH46PRaHSuMBxvtW+twxctq0z+QsHhux8Q7rCY4Ct8lqsx7c6Sy0dl5T89rIeEuZKoVctIk1hNpfavER6yyH1Vvm3MbsUHy4ab4hWr/OZPcsRBphnaV65/ZcdYPNNwsjN/djlf9NqCw9U5ExCPcdhKxUgLSmfROpLp4WSUr8ojdwbncbvCf+a/YzRaEc6QOvXcGO256TXc5Lab9POvB+AWY7PigWYjzhifbovuunzRawsO24ZqQQAqguBtmpmPB7ysXJfyDDaV/aPGillgz1MdQg4u5MYaEtBNNHFjkRlSpd65lp4hd2AVPTfbV7FGpyIOfmNc/XVsPfg7vzaS/3nkvLL593ANLvMuRMGpQIhiF7kUEW9QDpAUbTWYBcbp4WpacHHY1aacqQyjGZS9HI3yCBT9kUZJhVOD+zUDvEH9ddR11fzPcTDQ5TlgB0KwqdXSavk9BC0pKp0WmcuowSw07VXmXC5guzSa4p0UvRw2lbDiYUx0ExJJRzWzi6Gm8cnEkfXXsdcG/M/jAJa0+bmCgdmQ9CYlNlSYZOKixmRsgiFxkrmW4l3KdFKv1DM8tk6WxPYJZhUUzcd8Kdtgrw/gkfXXDT7+avmfVak32qhtkg6NVdUS5wgkru1YzIkSduTW1FDwVWV3JQVJVuieTc0y4iDpFwc7/BvSalvKdQM8sv662cevz/+8sQVnjVAT0W2wLllw1JiMhJRxgDjCjLQsOzSFSgZqx7lAW1JW0e03yAD3asC+GD3NbQhbe+mN5GXH1F83KDOM4n/e5JIuH4NpdQARrFPBVptUNcjj4cVMcFSRTE2NpR1LEYbYMmfWpXgP9KejaPsLUhuvLCsVXznAG9dfx9SR1ud/3hZdCLHb1GMdPqRJgqDmm76mHbvOXDtiO2QPUcKo/TWkQ0i2JFXpBoo7vij1i1Lp3ADAo+qvG3V0rM//vFnnTE4hxd5Ka/Cor5YEdsLVJyKtDgVoHgtW11pWSjolPNMnrlrVj9Fv2Qn60twMwKPqr+N/wvr8z5tZcDsDrv06tkqyzESM85Ycv6XBWA2birlNCXrI6VbD2lx2L0vQO0QVTVVLH4SE67fgsfVXv8n7sz7/85Z7cMtbE6f088wSaR4kCkCm10s6pKbJhfqiUNGLq+0gLWC6eUAZFPnLjwqtKd8EwGvWX59t7iPW4X/eAN1svgRVSY990YZg06BD1ohLMtyFTI4pKTJsS9xREq9EOaPWiO2gpms7397x6nQJkbh+Fz2q/rqRROX6/M8bJrqlVW4l6JEptKeUFuMYUbtCQ7CIttpGc6MY93x1r1vgAnRXvY5cvwWPqb9uWQm+lP95QxdNMeWhOq1x0Db55C7GcUv2ZUuN6n8iKzsvOxibC//Yfs9Na8r2Rlz02vXXDT57FP/zJi66/EJSmsJKa8QxnoqW3VLQ+jZVUtJwJ8PNX1NQCwfNgdhhHD9on7PdRdrdGPF28rJr1F+3LBdeyv+8yYfLoMYet1vX4upNAjVvwOUWnlNXJXlkzk5Il6kqeoiL0C07qno+/CYBXq/+utlnsz7/Mzvy0tmI4zm4ag23PRN3t/CWryoUVJGm+5+K8RJ0V8Hc88/XHUX/HfiAq7t+BH+x6v8t438enWmdJwFA6ZINriLGKv/95f8lT9/FnyA1NMVEvQyaXuu+gz36f/DD73E4pwqpLcvm/o0Vle78n//+L/NPvoefp1pTJye6e4A/D082FERa5/opeH9zpvh13cNm19/4v/LDe5xMWTi8I0Ta0qKlK27AS/v3/r+/x/2GO9K2c7kVMonDpq7//jc5PKCxeNPpFVzaRr01wF8C4Pu76hXuX18H4LduTr79guuFD3n5BHfI+ZRFhY8w29TYhbbLi/bvBdqKE4fUgg1pBKnV3FEaCWOWyA+m3WpORZr/j+9TKJtW8yBTF2/ZEODI9/QavHkVdGFp/Pjn4Q+u5hXapsP5sOH+OXXA1LiKuqJxiMNbhTkbdJTCy4llEt6NnqRT4dhg1V3nbdrm6dYMecA1yTOL4PWTE9L5VzPFlLBCvlG58AhehnN4uHsAYinyJ+AZ/NkVvELbfOBUuOO5syBIEtiqHU1k9XeISX5bsimrkUUhnGDxourN8SgUsCZVtKyGbyGzHXdjOhsAvOAswSRyIBddRdEZWP6GZhNK/yjwew9ehBo+3jEADu7Ay2n8mDc+TS7awUHg0OMzR0LABhqLD4hJEh/BEGyBdGlSJoXYXtr+3HS4ijzVpgi0paWXtdruGTknXBz+11qT1Q2inxaTzQCO46P3lfLpyS4fou2PH/PupwZgCxNhGlj4IvUuWEsTkqMWm6i4xCSMc9N1RDQoCVcuGItJ/MRWefais+3synowi/dESgJjkilnWnBTGvRWmaw8oR15257t7CHmCf8HOn7cwI8+NQBXMBEmAa8PMRemrNCEhLGEhDQKcGZWS319BX9PFBEwGTbRBhLbDcaV3drFcDqk5kCTd2JF1Wp0HraqBx8U0wwBTnbpCadwBA/gTH/CDrcCs93LV8E0YlmmcyQRQnjBa8JESmGUfIjK/7fkaDJpmD2QptFNVJU1bbtIAjjWQizepOKptRjbzR9Kag6xZmMLLjHOtcLT3Tx9o/0EcTT1XN3E45u24AiwEypDJXihKjQxjLprEwcmRKclaDNZCVqr/V8mYWyFADbusiY5hvgFoU2vio49RgJLn5OsReRFN6tabeetiiy0V7KFHT3HyZLx491u95sn4K1QQSPKM9hNT0wMVvAWbzDSVdrKw4zRjZMyJIHkfq1VAVCDl/bUhNKlGq0zGr05+YAceXVPCttVk0oqjVwMPt+BBefx4yPtGVkUsqY3CHDPiCM5ngupUwCdbkpd8kbPrCWHhkmtIKLEetF2499eS1jZlIPGYnlcPXeM2KD9vLS0bW3ktYNqUllpKLn5ZrsxlIzxvDu5eHxzGLctkZLEY4PgSOg2IUVVcUONzUDBEpRaMoXNmUc0tFZrTZquiLyKxrSm3DvIW9Fil+AkhXu5PhEPx9mUNwqypDvZWdKlhIJQY7vn2OsnmBeOWnYZ0m1iwbbw1U60by5om47iHRV6fOgzjMf/DAZrlP40Z7syxpLK0lJ0gqaAK1c2KQKu7tabTXkLFz0sCftuwX++MyNeNn68k5Buq23YQhUh0SNTJa1ioQ0p4nUG2y0XilF1JqODqdImloPS4Bp111DEWT0jJjVv95uX9BBV7eB3bUWcu0acSVM23YZdd8R8UbQUxJ9wdu3oMuhdt929ME+mh6JXJ8di2RxbTi6TbrDquqV4aUKR2iwT6aZbyOwEXN3DUsWr8Hn4EhwNyHuXHh7/pdaUjtR7vnDh/d8c9xD/s5f501eQ1+CuDiCvGhk1AN/4Tf74RfxPwD3toLarR0zNtsnPzmS64KIRk861dMWCU8ArasG9T9H0ZBpsDGnjtAOM2+/LuIb2iIUGXNgl5ZmKD/Tw8TlaAuihaFP5yrw18v4x1898zIdP+DDAX1bM3GAMvPgRP/cJn3zCW013nrhHkrITyvYuwOUkcHuKlRSW5C6rzIdY4ppnF7J8aAJbQepgbJYBjCY9usGXDKQxq7RZfh9eg5d1UHMVATRaD/4BHK93/1iAgYZ/+jqPn8Dn4UExmWrpa3+ZOK6MvM3bjwfzxNWA2dhs8+51XHSPJiaAhGSpWevEs5xHLXcEGFXYiCONySH3fPWq93JIsBiSWvWyc3CAN+EcXoT7rCSANloPPoa31rt/5PUA/gp8Q/jDD3hyrjzlR8VkanfOvB1XPubt17vzxAfdSVbD1pzAnfgyF3ycadOTOTXhpEUoLC1HZyNGW3dtmjeXgr2r56JNmRwdNNWaQVBddd6rh4MhviEB9EFRD/7RGvePvCbwAL4Mx/D6M541hHO4D3e7g6PafdcZVw689z7NGTwo5om7A8sPhccT6qKcl9NJl9aM/9kX+e59Hh1yPqGuCCZxuITcsmNaJ5F7d0q6J3H48TO1/+M57085q2icdu2U+W36Ldllz9Agiv4YGljoEN908EzvDOrBF98/vtJwCC/BF2AG75xxEmjmMIcjxbjoaxqOK3/4hPOZzhMPBpYPG44CM0dTVm1LjLtUWWVz1Bcf8tEx0zs8O2A2YVHRxKYOiy/aOVoAaMu0i7ubu43njjmd4ibMHU1sIDHaQNKrZND/FZYdk54oCXetjq7E7IVl9eAL7t+oHnwXXtLx44czzoRFHBztYVwtH1d+NOMkupZ5MTM+gUmq90X+Bh9zjRlmaQ+m7YMqUL/veemcecAtOJ0yq1JnVlN27di2E0+Klp1tAJ4KRw1eMI7aJjsO3R8kPSI3fUFXnIOfdQe86sIIVtWDL7h//Ok6vj8vwDk08NEcI8zz7OhBy+WwalzZeZ4+0XniRfst9pAJqQHDGLzVQ2pheZnnv1OWhwO43/AgcvAEXEVVpa4db9sGvNK8wjaENHkfFQ4Ci5i7dqnQlPoLQrHXZDvO3BIXZbJOBrOaEbML6sFL798I4FhKihjHMsPjBUZYCMFr6nvaArxqXPn4lCa+cHfSa2cP27g3Z3ziYTRrcbQNGLQmGF3F3cBdzzzX7AILx0IB9rbwn9kx2G1FW3Inic+ZLIsVvKR8Zwfj0l1fkqo8LWY1M3IX14OX3r9RKTIO+d9XzAI8qRPGPn/4NC2n6o4rN8XJ82TOIvuVA8zLKUHRFgBCetlDZlqR1gLKjS39xoE7Bt8UvA6BxuEDjU3tFsEijgA+615tmZkXKqiEENrh41iLDDZNq4pKTWR3LZfnos81LOuNa15cD956vLMsJd1rqYp51gDUQqMYm2XsxnUhD2jg1DM7SeuJxxgrmpfISSXVIJIS5qJJSvJPEQ49DQTVIbYWJ9QWa/E2+c/oPK1drmC7WSfJRNKBO5Yjvcp7Gc3dmmI/Xh1kDTEuiSnWqQf37h+fTMhGnDf6dsS8SQfQWlqqwXXGlc/PEZ/SC5mtzIV0nAshlQdM/LvUtYutrEZ/Y+EAFtq1k28zQhOwLr1AIeANzhF8t9qzTdZf2qRKO6MWE9ohBYwibbOmrFtNmg3mcS+tB28xv2uKd/agYCvOP+GkSc+0lr7RXzyufL7QbkUpjLjEWFLqOIkAGu2B0tNlO9Eau2W1qcOUvVRgKzypKIQZ5KI3q0MLzqTNRYqiZOqmtqloIRlmkBHVpHmRYV6/HixbO6UC47KOFJnoMrVyr7wYz+SlW6GUaghYbY1I6kkxA2W1fSJokUdSh2LQ1GAimRGm0MT+uu57H5l7QgOWxERpO9moLRPgTtquWCfFlGlIjQaRly9odmzMOWY+IBO5tB4sW/0+VWGUh32qYk79EidWKrjWuiLpiVNGFWFRJVktyeXWmbgBBzVl8anPuXyNJlBJOlKLTgAbi/EYHVHxWiDaVR06GnHQNpJcWcK2jJtiCfG2sEHLzuI66sGrMK47nPIInPnu799935aOK2cvmvubrE38ZzZjrELCmXM2hM7UcpXD2oC3+ECVp7xtIuxptJ0jUr3sBmBS47TVxlvJ1Sqb/E0uLdvLj0lLr29ypdd/eMX3f6lrxGlKwKQxEGvw0qHbkbwrF3uHKwVENbIV2wZ13kNEF6zD+x24aLNMfDTCbDPnEikZFyTNttxWBXDaBuM8KtI2rmaMdUY7cXcUPstqTGvBGSrFWIpNMfbdea990bvAOC1YX0qbc6smDS1mPxSJoW4fwEXvjMmhlijDRq6qale6aJEuFGoppYDoBELQzLBuh/mZNx7jkinv0EtnUp50lO9hbNK57lZaMAWuWR5Yo9/kYwcYI0t4gWM47Umnl3YmpeBPqSyNp3K7s2DSAS/39KRuEN2bS4xvowV3dFRMx/VFcp2Yp8w2nTO9hCXtHG1kF1L4KlrJr2wKfyq77R7MKpFKzWlY9UkhYxyHWW6nBWPaudvEAl3CGcNpSXPZ6R9BbBtIl6cHL3gIBi+42CYXqCx1gfGWe7Ap0h3luyXdt1MKy4YUT9xSF01G16YEdWsouW9mgDHd3veyA97H+Ya47ZmEbqMY72oPztCGvK0onL44AvgC49saZKkWRz4veWljE1FHjbRJaWv6ZKKtl875h4CziFCZhG5rx7tefsl0aRT1bMHZjm8dwL/6u7wCRysaQblQoG5yAQN5zpatMNY/+yf8z+GLcH/Qn0iX2W2oEfXP4GvwQHuIL9AYGnaO3zqAX6946nkgqZNnUhx43DIdQtMFeOPrgy/y3Yd85HlJWwjLFkU3kFwq28xPnuPhMWeS+tDLV9Otllq7pQCf3uXJDN9wFDiUTgefHaiYbdfi3b3u8+iY6TnzhgehI1LTe8lcd7s1wJSzKbahCRxKKztTLXstGAiu3a6rPuQs5pk9TWAan5f0BZmGf7Ylxzzk/A7PAs4QPPPAHeFQ2hbFHszlgZuKZsJcUmbDC40sEU403cEjczstOEypa+YxevL4QBC8oRYqWdK6b7sK25tfE+oDZgtOQ2Jg8T41HGcBE6fTWHn4JtHcu9S7uYgU5KSCkl/mcnq+5/YBXOEr6lCUCwOTOM1taOI8mSxx1NsCXBEmLKbMAg5MkwbLmpBaFOPrNSlO2HnLiEqW3tHEwd8AeiQLmn+2gxjC3k6AxREqvKcJbTEzlpLiw4rNZK6oJdidbMMGX9FULKr0AkW+2qDEPBNNm5QAt2Ik2nftNWHetubosHLo2nG4vQA7GkcVCgVCgaDixHqo9UUn1A6OshapaNR/LPRYFV8siT1cCtJE0k/3WtaNSuUZYKPnsVIW0xXWnMUxq5+En4Kvw/MqQmVXnAXj9Z+9zM98zM/Agy7F/qqj2Nh67b8HjFnPP3iBn/tkpdzwEJX/whIcQUXOaikeliCRGUk7tiwF0rItwMEhjkZ309hikFoRAmLTpEXWuHS6y+am/KB/fM50aLEhGnSMwkpxzOov4H0AvgovwJ1iGzDLtJn/9BU+fAINfwUe6FHSLhu83viV/+/HrOePX+STT2B9uWGbrMHHLldRBlhS/CJQmcRxJFqZica01XixAZsYiH1uolZxLrR/SgxVIJjkpQP4PE9sE59LKLr7kltSBogS5tyszzH8Fvw8/AS8rNOg0xUS9fIaHwb+6et8Q/gyvKRjf5OusOzGx8evA/BP4IP11uN/grca5O0lcsPLJ5YjwI4QkJBOHa0WdMZYGxPbh2W2nR9v3WxEWqgp/G3+6VZbRLSAAZ3BhdhAaUL33VUSw9yjEsvbaQ9u4A/gGXwZXoEHOuU1GSj2chf+Mo+f8IcfcAxfIKVmyunRbYQVnoevwgfw3TXXcw++xNuP4fhyueEUNttEduRVaDttddoP0eSxLe2LENk6itYxlrxBNBYrNNKSQmeaLcm9c8UsaB5WyO6675yyQIAWSDpBVoA/gxmcwEvwoDv0m58UE7gHn+fJOa8/Ywan8EKRfjsopF83eCglX/Sfr7OeaRoQfvt1CGvIDccH5BCvw1sWIzRGC/66t0VTcLZQZtm6PlAasbOJ9iwWtUo7biktTSIPxnR24jxP1ZKaqq+2RcXM9OrBAm/AAs7hDJ5bNmGb+KIfwCs8a3jnjBrOFeMjHSCdbKr+2uOLfnOd9eiA8Hvvwwq54VbP2OqwkB48Ytc4YEOiH2vTXqodabfWEOzso4qxdbqD5L6tbtNPECqbhnA708DZH4QOJUXqScmUlks7Ot6FBuZw3n2mEbaUX7kDzxHOOQk8nKWMzAzu6ZZ8sOFw4RK+6PcuXo9tB4SbMz58ApfKDXf3szjNIIbGpD5TKTRxGkEMLjLl+K3wlWXBsCUxIDU+jbOiysESqAy1MGUJpXgwbTWzNOVEziIXZrJ+VIztl1PUBxTSo0dwn2bOmfDRPD3TRTGlfbCJvO9KvuhL1hMHhB9wPuPRLGHcdOWG2xc0U+5bQtAJT0nRTewXL1pgk2+rZAdeWmz3jxAqfNQQdzTlbF8uJ5ecEIWvTkevAHpwz7w78QujlD/Lr491bD8/1vhM2yrUQRrWXNQY4fGilfctMWYjL72UL/qS9eiA8EmN88nbNdour+PBbbAjOjIa4iBhfFg6rxeKdEGcL6p3EWR1Qq2Qkhs2DrnkRnmN9tG2EAqmgPw6hoL7Oza7B+3SCrR9tRftko+Lsf2F/mkTndN2LmzuMcKTuj/mX2+4Va3ki16+nnJY+S7MefpkidxwnV+4wkXH8TKnX0tsYzYp29DOOoSW1nf7nTh2akYiWmcJOuTidSaqESrTYpwjJJNVGQr+rLI7WsqerHW6Kp/oM2pKuV7T1QY9gjqlZp41/WfKpl56FV/0kvXQFRyeQ83xaTu5E8p5dNP3dUF34ihyI3GSpeCsywSh22ZJdWto9winhqifb7VRvgktxp13vyjrS0EjvrRfZ62uyqddSWaWYlwTPAtJZ2oZ3j/Sgi/mi+6vpzesfAcWNA0n8xVyw90GVFGuZjTXEQy+6GfLGLMLL523f5E0OmxVjDoOuRiH91RKU+vtoCtH7TgmvBLvtFXWLW15H9GTdVw8ow4IlRLeHECN9ym1e9K0I+Cbnhgv4Yu+aD2HaQJ80XDqOzSGAV4+4yCqBxrsJAX6ZTIoX36QnvzhhzzMfFW2dZVLOJfo0zbce5OvwXMFaZ81mOnlTVXpDZsQNuoYWveketKb5+6JOOsgX+NTm7H49fUTlx+WLuWL7qxnOFh4BxpmJx0p2gDzA/BUARuS6phR+pUsY7MMboAHx5xNsSVfVZcYSwqCKrqon7zM+8ecCkeS4nm3rINuaWvVNnMRI1IRpxTqx8PZUZ0Br/UEduo3B3hNvmgZfs9gQPj8vIOxd2kndir3awvJ6BLvoUuOfFWNYB0LR1OQJoUySKb9IlOBx74q1+ADC2G6rOdmFdJcD8BkfualA+BdjOOzP9uUhGUEX/TwhZsUduwRr8wNuXKurCixLBgpQI0mDbJr9dIqUuV+92ngkJZ7xduCk2yZKbfWrH1VBiTg9VdzsgRjW3CVXCvAwDd+c1z9dWw9+B+8MJL/eY15ZQ/HqvTwVdsZn5WQsgRRnMaWaecu3jFvMBEmgg+FJFZsnSl0zjB9OqPYaBD7qmoVyImFvzi41usesV0julaAR9dfR15Xzv9sEruRDyk1nb+QaLU67T885GTls6YgcY+UiMa25M/pwGrbCfzkvR3e0jjtuaFtnwuagHTSb5y7boBH119HXhvwP487jJLsLJ4XnUkHX5sLbS61dpiAXRoZSCrFJ+EjpeU3puVfitngYNo6PJrAigKktmwjyQdZpfq30mmtulaAx9Zfx15Xzv+cyeuiBFUs9zq8Kq+XB9a4PVvph3GV4E3y8HENJrN55H1X2p8VyqSKwVusJDKzXOZzplWdzBUFK9e+B4+uv468xvI/b5xtSAkBHQaPvtqWzllVvEOxPbuiE6+j2pvjcKsbvI7txnRErgfH7LdXqjq0IokKzga14GzQ23SSbCQvO6r+Or7SMIr/efOkkqSdMnj9mBx2DRsiY29Uj6+qK9ZrssCKaptR6HKURdwUYeUWA2kPzVKQO8ku2nU3Anhs/XWkBx3F/7wJtCTTTIKftthue1ty9xvNYLY/zo5KSbIuKbXpbEdSyeRyYdAIwKY2neyoc3+k1XUaufYga3T9daMUx/r8z1s10ITknIO0kuoMt+TB8jK0lpayqqjsJ2qtXAYwBU932zinimgmd6mTRDnQfr88q36NAI+tv24E8Pr8zxtasBqx0+xHH9HhlrwsxxNUfKOHQaZBITNf0uccj8GXiVmXAuPEAKSdN/4GLHhs/XWj92dN/uetNuBMnVR+XWDc25JLjo5Mg5IZIq226tmCsip2zZliL213YrTlL2hcFjpCduyim3M7/eB16q/blQsv5X/esDRbtJeabLIosWy3ycavwLhtxdWzbMmHiBTiVjJo6lCLjXZsi7p9PEPnsq6X6wd4bP11i0rD5fzPm/0A6brrIsllenZs0lCJlU4abakR59enZKrKe3BZihbTxlyZ2zl1+g0wvgmA166/bhwDrcn/7Ddz0eWZuJvfSESug6NzZsox3Z04FIxz0mUjMwVOOVTq1CQ0AhdbBGVdjG/CgsfUX7esJl3K/7ytWHRv683praW/8iDOCqWLLhpljDY1ZpzK75QiaZoOTpLKl60auHS/97oBXrv+umU9+FL+5+NtLFgjqVLCdbmj7pY5zPCPLOHNCwXGOcLquOhi8CmCWvbcuO73XmMUPab+ug3A6/A/78Bwe0bcS2+tgHn4J5pyS2WbOck0F51Vq3LcjhLvZ67p1ABbaL2H67bg78BfjKi/jr3+T/ABV3ilLmNXTI2SpvxWBtt6/Z//D0z/FXaGbSBgylzlsEGp+5//xrd4/ae4d8DUUjlslfIYS3t06HZpvfQtvv0N7AHWqtjP2pW08QD/FLy//da38vo8PNlKHf5y37Dxdfe/oj4kVIgFq3koLReSR76W/bx//n9k8jonZxzWTANVwEniDsg87sOSd/z7//PvMp3jQiptGVWFX2caezzAXwfgtzYUvbr0iozs32c3Uge7varH+CNE6cvEYmzbPZ9hMaYDdjK4V2iecf6EcEbdUDVUARda2KzO/JtCuDbNQB/iTeL0EG1JSO1jbXS+nLxtPMDPw1fh5+EPrgSEKE/8Gry5A73ui87AmxwdatyMEBCPNOCSKUeRZ2P6Myb5MRvgCHmA9ywsMifU+AYXcB6Xa5GibUC5TSyerxyh0j6QgLVpdyhfArRTTLqQjwe4HOD9s92D4Ap54odXAPBWLAwB02igG5Kkc+piN4lvODIFGAZgT+EO4Si1s7fjSR7vcQETUkRm9O+MXyo9OYhfe4xt9STQ2pcZRLayCV90b4D3jR0DYAfyxJ+eywg2IL7NTMXna7S/RpQ63JhWEM8U41ZyQGjwsVS0QBrEKLu8xwZsbi4wLcCT+OGidPIOCe1PiSc9Qt+go+vYqB7cG+B9d8cAD+WJPz0Am2gxXgU9IneOqDpAAXOsOltVuMzpdakJXrdPCzXiNVUpCeOos5cxnpQT39G+XVLhs1osQVvJKPZyNq8HDwd4d7pNDuWJPxVX7MSzqUDU6gfadKiNlUFTzLeFHHDlzO4kpa7aiKhBPGKwOqxsBAmYkOIpipyXcQSPlRTf+Tii0U3EJGaZsDER2qoB3h2hu0qe+NNwUooYU8y5mILbJe6OuX+2FTKy7bieTDAemaQyQ0CPthljSWO+xmFDIYiESjM5xKd6Ik5lvLq5GrQ3aCMLvmCA9wowLuWJb9xF59hVVP6O0CrBi3ZjZSNOvRy+I6klNVRJYRBaEzdN+imiUXQ8iVF8fsp+W4JXw7WISW7fDh7lptWkCwZ4d7QTXyBPfJMYK7SijjFppGnlIVJBJBYj7eUwtiP1IBXGI1XCsjNpbjENVpSAJ2hq2LTywEly3hUYazt31J8w2+aiLx3g3fohXixPfOMYm6zCGs9LVo9MoW3MCJE7R5u/WsOIjrqBoHUO0bJE9vxBpbhsd3+Nb4/vtPCZ4oZYCitNeYuC/8UDvDvy0qvkiW/cgqNqRyzqSZa/s0mqNGjtKOoTm14zZpUauiQgVfqtQiZjq7Q27JNaSK5ExRcrGCXO1FJYh6jR6CFqK7bZdQZ4t8g0rSlPfP1RdBtqaa9diqtzJkQ9duSryi2brQXbxDwbRUpFMBHjRj8+Nt7GDKgvph9okW7LX47gu0SpGnnFQ1S1lYldOsC7hYteR574ZuKs7Ei1lBsfdz7IZoxzzCVmmVqaSySzQbBVAWDek+N4jh9E/4VqZrJjPwiv9BC1XcvOWgO8275CVyBPvAtTVlDJfZkaZGU7NpqBogAj/xEHkeAuJihWYCxGN6e8+9JtSegFXF1TrhhLGP1fak3pebgPz192/8gB4d/6WT7+GdYnpH7hH/DJzzFiYPn/vjW0SgNpTNuPIZoAEZv8tlGw4+RLxy+ZjnKa5NdFoC7UaW0aduoYse6+bXg1DLg6UfRYwmhGEjqPvF75U558SANrElK/+MdpXvmqBpaXOa/MTZaa1DOcSiLaw9j0NNNst3c+63c7EKTpkvKHzu6bPbP0RkuHAVcbRY8ijP46MIbQeeT1mhA+5PV/inyDdQipf8LTvMXbwvoDy7IruDNVZKTfV4CTSRUYdybUCnGU7KUTDxLgCknqUm5aAW6/1p6eMsOYsphLzsHrE0Y/P5bQedx1F/4yPHnMB3/IOoTU9+BL8PhtjuFKBpZXnYNJxTuv+2XqolKR2UQgHhS5novuxVySJhBNRF3SoKK1XZbbXjVwWNyOjlqWJjrWJIy+P5bQedyldNScP+HZ61xKSK3jyrz+NiHG1hcOLL/+P+PDF2gOkekKGiNWKgJ+8Z/x8Iv4DdQHzcpZyF4v19I27w9/yPGDFQvmEpKtqv/TLiWMfn4sofMm9eAH8Ao0zzh7h4sJqYtxZd5/D7hkYPneDzl5idlzNHcIB0jVlQ+8ULzw/nc5/ojzl2juE0apD7LRnJxe04dMz2iOCFNtGFpTuXA5AhcTRo8mdN4kz30nVjEC4YTZQy4gpC7GlTlrePKhGsKKgeXpCYeO0MAd/GH7yKQUlXPLOasOH3FnSphjHuDvEu4gB8g66oNbtr6eMbFIA4fIBJkgayoXriw2XEDQPJrQeROAlY6aeYOcMf+IVYTU3XFlZufMHinGywaW3YLpObVBAsbjF4QJMsVUSayjk4voPsHJOQfPWDhCgDnmDl6XIRerD24HsGtw86RMHOLvVSHrKBdeVE26gKB5NKHzaIwLOmrqBWJYZDLhASG16c0Tn+CdRhWDgWXnqRZUTnPIHuMJTfLVpkoYy5CzylHVTGZMTwkGAo2HBlkQplrJX6U+uF1wZz2uwS1SQ12IqWaPuO4baZaEFBdukksJmkcTOm+YJSvoqPFzxFA/YUhIvWxcmSdPWTWwbAKVp6rxTtPFUZfKIwpzm4IoMfaYQLWgmlG5FME2gdBgm+J7J+rtS/XBbaVLsR7bpPQnpMFlo2doWaVceHk9+MkyguZNCJ1He+kuHTWyQAzNM5YSUg/GlTk9ZunAsg1qELVOhUSAK0LABIJHLKbqaEbHZLL1VA3VgqoiOKXYiS+HRyaEKgsfIqX64HYWbLRXy/qWoylIV9gudL1OWBNgBgTNmxA6b4txDT4gi3Ri7xFSLxtXpmmYnzAcWDZgY8d503LFogz5sbonDgkKcxGsWsE1OI+rcQtlgBBCSOKD1mtqYpIU8cTvBmAT0yZe+zUzeY92fYjTtGipXLhuR0ePoHk0ofNWBX+lo8Z7pAZDk8mEw5L7dVyZZoE/pTewbI6SNbiAL5xeygW4xPRuLCGbhcO4RIeTMFYHEJkYyEO9HmJfXMDEj/LaH781wHHZEtqSQ/69UnGpzH7LKIAZEDSPJnTesJTUa+rwTepI9dLJEawYV+ZkRn9g+QirD8vF8Mq0jFQ29js6kCS3E1+jZIhgPNanHdHFqFvPJLHqFwQqbIA4jhDxcNsOCCQLDomaL/dr5lyJaJU6FxPFjO3JOh3kVMcROo8u+C+jo05GjMF3P3/FuDLn5x2M04xXULPwaS6hBYki+MrMdZJSgPHlcB7nCR5bJ9Kr5ACUn9jk5kivdd8tk95SOGrtqu9lr2IhK65ZtEl7ZKrp7DrqwZfRUSN1el7+7NJxZbywOC8neNKTch5vsTEMNsoCCqHBCqIPRjIPkm0BjvFODGtto99rCl+d3wmHkW0FPdpZtC7MMcVtGFQjJLX5bdQ2+x9ypdc313uj8xlsrfuLgWXz1cRhZvJYX0iNVBRcVcmCXZs6aEf3RQF2WI/TcCbKmGU3IOoDJGDdDub0+hYckt6PlGu2BcxmhbTdj/klhccLGJMcqRjMJP1jW2ETqLSWJ/29MAoORluJ+6LPffBZbi5gqi5h6catQpmOT7/OFf5UorRpLzCqcMltBLhwd1are3kztrSzXO0LUbXRQcdLh/RdSZ+swRm819REDrtqzC4es6Gw4JCKlSnjYVpo0xeq33PrADbFLL3RuCmObVmPN+24kfa+AojDuM4umKe2QwCf6EN906HwjujaitDs5o0s1y+k3lgbT2W2i7FJdnwbLXhJUBq/9liTctSmFC/0OqUinb0QddTWamtjbHRFuWJJ6NpqZ8vO3fZJ37Db+2GkaPYLGHs7XTTdiFQJ68SkVJFVmY6McR5UycflNCsccHFaV9FNbR4NttLxw4pQ7wJd066Z0ohVbzihaxHVExd/ay04oxUKWt+AsdiQ9OUyZ2krzN19IZIwafSTFgIBnMV73ADj7V/K8u1MaY2sJp2HWm0f41tqwajEvdHWOJs510MaAqN4aoSiPCXtN2KSi46dUxHdaMquar82O1x5jqhDGvqmoE9LfxcY3zqA7/x3HA67r9ZG4O6Cuxu12/+TP+eLP+I+HErqDDCDVmBDO4larujNe7x8om2rMug0MX0rL1+IWwdwfR+p1TNTyNmVJ85ljWzbWuGv8/C7HD/izjkHNZNYlhZcUOKVzKFUxsxxN/kax+8zPWPSFKw80rJr9Tizyj3o1gEsdwgWGoxPezDdZ1TSENE1dLdNvuKL+I84nxKesZgxXVA1VA1OcL49dFlpFV5yJMhzyCmNQ+a4BqusPJ2bB+xo8V9u3x48VVIEPS/mc3DvAbXyoYr6VgDfh5do5hhHOCXMqBZUPhWYbWZECwVJljLgMUWOCB4MUuMaxGNUQDVI50TQ+S3kFgIcu2qKkNSHVoM0SHsgoZxP2d5HH8B9woOk4x5bPkKtAHucZsdykjxuIpbUrSILgrT8G7G5oCW+K0990o7E3T6AdW4TilH5kDjds+H64kS0mz24grtwlzDHBJqI8YJQExotPvoC4JBq0lEjjQkyBZ8oH2LnRsQ4Hu1QsgDTJbO8fQDnllitkxuVskoiKbRF9VwzMDvxHAdwB7mD9yCplhHFEyUWHx3WtwCbSMMTCUCcEmSGlg4gTXkHpZXWQ7kpznK3EmCHiXInqndkQjunG5kxTKEeGye7jWz9cyMR2mGiFQ15ENRBTbCp+Gh86vAyASdgmJq2MC6hoADQ3GosP0QHbnMHjyBQvQqfhy/BUbeHd5WY/G/9LK/8Ka8Jd7UFeNWEZvzPb458Dn8DGLOe3/wGL/4xP+HXlRt+M1PE2iLhR8t+lfgxsuh7AfO2AOf+owWhSZRYQbd622hbpKWKuU+XuvNzP0OseRDa+mObgDHJUSc/pKx31QdKffQ5OIJpt8GWjlgTwMc/w5MPCR/yl1XC2a2Yut54SvOtMev55Of45BOat9aWG27p2ZVORRvnEk1hqWMVUmqa7S2YtvlIpspuF1pt0syuZS2NV14mUidCSfzQzg+KqvIYCMljIx2YK2AO34fX4GWdu5xcIAb8MzTw+j/lyWM+Dw/gjs4GD6ehNgA48kX/AI7XXM/XAN4WHr+9ntywqoCakCqmKP0rmQrJJEErG2Upg1JObr01lKQy4jskWalKYfJ/EDLMpjNSHFEUAde2fltaDgmrNaWQ9+AAb8I5vKjz3L1n1LriB/BXkG/wwR9y/oRX4LlioHA4LzP2inzRx/DWmutRweFjeP3tNeSGlaE1Fde0OS11yOpmbIp2u/jF1n2RRZviJM0yBT3IZl2HWImKjQOxIyeU325b/qWyU9Moj1o07tS0G7qJDoGHg5m8yeCxMoEH8GU45tnrNM84D2l297DQ9t1YP7jki/7RmutRweEA77/HWXOh3HCxkRgldDQkAjNTMl2Iloc1qN5JfJeeTlyTRzxURTdn1Ixv2uKjs12AbdEWlBtmVdk2k7FFwj07PCZ9XAwW3dG+8xKzNFr4EnwBZpy9Qzhh3jDXebBpYcpuo4fQ44u+fD1dweEnHzI7v0xuuOALRUV8rXpFyfSTQYkhd7IHm07jpyhlkCmI0ALYqPTpUxXS+z4jgDj1Pflvmz5ecuItpIBxyTHpSTGWd9g1ApfD/bvwUhL4nT1EzqgX7cxfCcNmb3mPL/qi9SwTHJ49oj5ZLjccbTG3pRmlYi6JCG0mQrAt1+i2UXTZ2dv9IlQpN5naMYtviaXlTrFpoMsl3bOAFEa8sqPj2WCMrx3Yjx99qFwO59Aw/wgx+HlqNz8oZvA3exRDvuhL1jMQHPaOJ0+XyA3fp1OfM3qObEVdhxjvynxNMXQV4+GJyvOEFqeQBaIbbO7i63rpxCltdZShPFxkjM2FPVkn3TG+Rp9pO3l2RzFegGfxGDHIAh8SteR0C4HopXzRF61nheDw6TFN05Ebvq8M3VKKpGjjO6r7nhudTEGMtYM92HTDaR1FDMXJ1eThsbKfywyoWwrzRSXkc51flG3vIid62h29bIcFbTGhfV+faaB+ohj7dPN0C2e2lC96+XouFByen9AsunLDJZ9z7NExiUc0OuoYW6UZkIyx2YUR2z6/TiRjyKMx5GbbjLHvHuf7YmtKghf34LJfx63Yg8vrvN2zC7lY0x0tvKezo4HmGYDU+Gab6dFL+KI761lDcNifcjLrrr9LWZJctG1FfU1uwhoQE22ObjdfkSzY63CbU5hzs21WeTddH2BaL11Gi7lVdlxP1nkxqhnKhVY6knS3EPgVGg1JpN5cP/hivujOelhXcPj8HC/LyI6MkteVjlolBdMmF3a3DbsuAYhL44dxzthWSN065xxUd55Lmf0wRbOYOqH09/o9WbO2VtFdaMb4qBgtFJoT1SqoN8wPXMoXLb3p1PUEhxfnnLzGzBI0Ku7FxrKsNJj/8bn/H8fPIVOd3rfrklUB/DOeO+nkghgSPzrlPxluCMtOnDL4Yml6dK1r3vsgMxgtPOrMFUZbEUbTdIzii5beq72G4PD0DKnwjmBULUVFmy8t+k7fZ3pKc0Q4UC6jpVRqS9Umv8bxw35flZVOU1X7qkjnhZlsMbk24qQ6Hz7QcuL6sDC0iHHki96Uh2UdvmgZnjIvExy2TeJdMDZNSbdZyAHe/Yd1xsQhHiKzjh7GxQ4yqMPaywPkjMamvqrYpmO7Knad+ZQC5msCuAPWUoxrxVhrGv7a+KLXFhyONdTMrZ7ke23qiO40ZJUyzgYyX5XyL0mV7NiUzEs9mjtbMN0dERqwyAJpigad0B3/zRV7s4PIfXSu6YV/MK7+OrYe/JvfGMn/PHJe2fyUdtnFrKRNpXV0Y2559aWPt/G4BlvjTMtXlVIWCnNyA3YQBDmYIodFz41PvXPSa6rq9lWZawZ4dP115HXV/M/tnFkkrBOdzg6aP4pID+MZnTJ1SuuB6iZlyiox4HT2y3YBtkUKWooacBQUDTpjwaDt5poBHl1/HXltwP887lKKXxNUEyPqpGTyA699UqY/lt9yGdlUKra0fFWS+36iylVWrAyd7Uw0CZM0z7xKTOduznLIjG2Hx8cDPLb+OvK6Bv7n1DYci4CxUuRxrjBc0bb4vD3rN5Zz36ntLb83eVJIB8LiIzCmn6SMPjlX+yNlTjvIGjs+QzHPf60Aj62/jrzG8j9vYMFtm1VoRWCJdmw7z9N0t+c8cxZpPeK4aTRicS25QhrVtUp7U578chk4q04Wx4YoQSjFryUlpcQ1AbxZ/XVMknIU//OGl7Q6z9Zpxi0+3yFhSkjUDpnCIUhLWVX23KQ+L9vKvFKI0ZWFQgkDLvBoylrHNVmaw10zwCPrr5tlodfnf94EWnQ0lFRWy8pW9LbkLsyUVDc2NSTHGDtnD1uMtchjbCeb1mpxFP0YbcClhzdLu6lfO8Bj6q+bdT2sz/+8SZCV7VIxtt0DUn9L7r4cLYWDSXnseEpOGFuty0qbOVlS7NNzs5FOGJUqQpl2Q64/yBpZf90sxbE+//PGdZ02HSipCbmD6NItmQ4Lk5XUrGpDMkhbMm2ZVheNYV+VbUWTcv99+2NyX1VoafSuC+AN6q9bFIMv5X/eagNWXZxEa9JjlMwNWb00akGUkSoepp1/yRuuqHGbUn3UdBSTxBU6SEVklzWRUkPndVvw2PrrpjvxOvzPmwHc0hpmq82npi7GRro8dXp0KXnUQmhZbRL7NEVp1uuZmO45vuzKsHrktS3GLWXODVjw+vXXLYx4Hf7njRPd0i3aoAGX6W29GnaV5YdyDj9TFkakje7GHYzDoObfddHtOSpoi2SmzJHrB3hM/XUDDEbxP2/oosszcRlehWXUvzHv4TpBVktHqwenFo8uLVmy4DKLa5d3RtLrmrM3aMFr1183E4sewf+85VWeg1c5ag276NZrM9IJVNcmLEvDNaV62aq+14IAOGFsBt973Ra8Xv11YzXwNfmft7Jg2oS+XOyoC8/cwzi66Dhmgk38kUmP1CUiYWOX1bpD2zWXt2FCp7uq8703APAa9dfNdscR/M/bZLIyouVxqJfeWvG9Je+JVckHQ9+CI9NWxz+blX/KYYvO5n2tAP/vrlZ7+8/h9y+9qeB/Hnt967e5mevX10rALDWK//FaAT5MXdBXdP0C/BAes792c40H+AiAp1e1oH8HgH94g/Lttx1gp63op1eyoM/Bvw5/G/7xFbqJPcCXnmBiwDPb/YKO4FX4OjyCb289db2/Noqicw4i7N6TVtoz8tNwDH+8x/i6Ae7lmaQVENzJFb3Di/BFeAwz+Is9SjeQySpPqbLFlNmyz47z5a/AF+AYFvDmHqibSXTEzoT4Gc3OALaqAP4KPFUJ6n+1x+rGAM6Zd78bgJ0a8QN4GU614vxwD9e1Amy6CcskNrczLx1JIp6HE5UZD/DBHrFr2oNlgG4Odv226BodoryjGJ9q2T/AR3vQrsOCS0ctXZi3ruLlhpFDJYl4HmYtjQCP9rhdn4suySLKDt6wLcC52h8xPlcjju1fn+yhuw4LZsAGUuo2b4Fx2UwQu77uqRHXGtg92aN3tQCbFexc0uk93vhTXbct6y7MulLycoUljx8ngDMBg1tvJjAazpEmOtxlzclvj1vQf1Tx7QlPDpGpqgtdSKz/d9/hdy1vTfFHSmC9dGDZbLiezz7Ac801HirGZsWjydfZyPvHXL/Y8Mjzg8BxTZiuwKz4Eb8sBE9zznszmjvFwHKPIWUnwhqfVRcd4Ck0K6ate48m1oOfrX3/yOtvAsJ8zsPAM89sjnddmuLuDPjX9Bu/L7x7xpMzFk6nWtyQfPg278Gn4Aekz2ZgOmU9eJ37R14vwE/BL8G3aibCiWMWWDQ0ZtkPMnlcGeAu/Ag+8ZyecU5BPuy2ILD+sQqyZhAKmn7XZd+jIMTN9eBL7x95xVLSX4On8EcNlXDqmBlqS13jG4LpmGbkF/0CnOi3H8ETOIXzmnmtb0a16Tzxj1sUvQCBiXZGDtmB3KAefPH94xcUa/6vwRn80GOFyjEXFpba4A1e8KQfFF+259tx5XS4egYn8fQsLGrqGrHbztr+uByTahWuL1NUGbDpsnrwBfePPwHHIf9X4RnM4Z2ABWdxUBlqQ2PwhuDxoS0vvqB1JzS0P4h2nA/QgTrsJFn+Y3AOjs9JFC07CGWX1oNX3T/yHOzgDjwPn1PM3g9Jk9lZrMEpxnlPmBbjyo2+KFXRU52TJM/2ALcY57RUzjObbjqxVw++4P6RAOf58pcVsw9Daje3htriYrpDOonre3CudSe6bfkTEgHBHuDiyu5MCsc7BHhYDx7ePxLjqigXZsw+ijMHFhuwBmtoTPtOxOrTvYJDnC75dnUbhfwu/ZW9AgYd+peL68HD+0emKquiXHhWjJg/UrkJYzuiaL3E9aI/ytrCvAd4GcYZMCkSQxfUg3v3j8c4e90j5ZTPdvmJJGHnOCI2nHS8081X013pHuBlV1gB2MX1YNmWLHqqGN/TWmG0y6clJWthxNUl48q38Bi8vtMKyzzpFdSDhxZ5WBA5ZLt8Jv3895DduBlgbPYAj8C4B8hO68FDkoh5lydC4FiWvBOVqjYdqjiLv92t8yPDjrDaiHdUD15qkSURSGmXJwOMSxWAXYwr3zaAufJ66l+94vv3AO+vPcD7aw/w/toDvL/2AO+vPcD7aw/wHuD9tQd4f+0B3l97gPfXHuD9tQd4f+0B3l97gG8LwP8G/AL8O/A5OCq0Ys2KIdv/qOIXG/4mvFAMF16gZD+2Xvu/B8as5+8bfllWyg0zaNO5bfXj6vfhhwD86/Aq3NfRS9t9WPnhfnvCIw/CT8GLcFTMnpntdF/z9V+PWc/vWoIH+FL3Znv57PitcdGP4R/C34avw5fgRVUInCwbsn1yyA8C8zm/BH8NXoXnVE6wVPjdeCI38kX/3+Ct9dbz1pTmHFRu+Hm4O9Ch3clr99negxfwj+ER/DR8EV6B5+DuQOnTgUw5rnkY+FbNU3gNXh0o/JYTuWOvyBf9FvzX663HH/HejO8LwAl8Hl5YLTd8q7sqA3wbjuExfAFegQdwfyDoSkWY8swzEf6o4Qyewefg+cHNbqMQruSL/u/WWc+E5g7vnnEXgDmcDeSGb/F4cBcCgT+GGRzDU3hZYburAt9TEtHgbM6JoxJ+6NMzzTcf6c2bycv2+KK/f+l6LBzw5IwfqZJhA3M472pWT/ajKxnjv4AFnMEpnBTPND6s2J7qHbPAqcMK74T2mZ4VGB9uJA465It+/eL1WKhYOD7xHOkr1ajK7d0C4+ke4Hy9qXZwpgLr+Znm/uNFw8xQOSy8H9IzjUrd9+BIfenYaylf9FsXr8fBAadnPIEDna8IBcwlxnuA0/Wv6GAWPd7dDIKjMdSWueAsBj4M7TOd06qBbwDwKr7oleuxMOEcTuEZTHWvDYUO7aHqAe0Bbq+HEFRzOz7WVoTDQkVds7A4sIIxfCQdCefFRoIOF/NFL1mPab/nvOakSL/Q1aFtNpUb/nFOVX6gzyg/1nISyDfUhsokIzaBR9Kxm80s5mK+6P56il1jXic7nhQxsxSm3OwBHl4fFdLqi64nDQZvqE2at7cWAp/IVvrN6/BFL1mPhYrGMBfOi4PyjuSGf6wBBh7p/FZTghCNWGgMzlBbrNJoPJX2mW5mwZfyRffXo7OFi5pZcS4qZUrlViptrXtw+GQoyhDPS+ANjcGBNRiLCQDPZPMHuiZfdFpPSTcQwwKYdRNqpkjm7AFeeT0pJzALgo7g8YYGrMHS0iocy+YTm2vyRUvvpXCIpQ5pe666TJrcygnScUf/p0NDs/iAI/nqDHC8TmQT8x3NF91l76oDdQGwu61Z6E0ABv7uO1dbf/37Zlv+Zw/Pbh8f1s4Avur6657/+YYBvur6657/+YYBvur6657/+YYBvur6657/+aYBvuL6657/+VMA8FXWX/f8zzcN8BXXX/f8zzcNMFdbf93zP38KLPiK6697/uebtuArrr/u+Z9vGmCusP6653/+1FjwVdZf9/zPN7oHX339dc//fNMu+irrr3v+50+Bi+Zq6697/uebA/jz8Pudf9ht/fWv517J/XUzAP8C/BAeX9WCDrUpZ3/dEMBxgPcfbtTVvsYV5Yn32u03B3Ac4P3b8I+vxNBKeeL9dRMAlwO83959qGO78sT769oB7g3w/vGVYFzKE++v6wV4OMD7F7tckFkmT7y/rhHgpQO8b+4Y46XyxPvrugBeNcB7BRiX8sT767oAvmCA9woAHsoT76+rBJjLBnh3txOvkifeX1dswZcO8G6N7sXyxPvr6i340gHe3TnqVfLE++uKAb50gHcXLnrX8sR7gNdPRqwzwLu7Y/FO5Yn3AK9jXCMGeHdgxDuVJ75VAI8ljP7PAb3/RfjcZfePHBB+79dpfpH1CanN30d+mT1h9GqAxxJGM5LQeeQ1+Tb+EQJrElLb38VHQ94TRq900aMIo8cSOo+8Dp8QfsB8zpqE1NO3OI9Zrj1h9EV78PqE0WMJnUdeU6E+Jjyk/hbrEFIfeWbvId8H9oTRFwdZaxJGvziW0Hn0gqYB/wyZ0PwRlxJST+BOw9m77Amj14ii1yGM/txYQudN0qDzGe4EqfA/5GJCagsHcPaEPWH0esekSwmjRxM6b5JEcZ4ww50ilvAOFxBSx4yLW+A/YU8YvfY5+ALC6NGEzhtmyZoFZoarwBLeZxUhtY4rc3bKnjB6TKJjFUHzJoTOozF2YBpsjcyxDgzhQ1YRUse8+J4wenwmaylB82hC5w0zoRXUNXaRBmSMQUqiWSWkLsaVqc/ZE0aPTFUuJWgeTei8SfLZQeMxNaZSIzbII4aE1Nmr13P2hNHjc9E9guYNCZ032YlNwESMLcZiLQHkE4aE1BFg0yAR4z1h9AiAGRA0jyZ03tyIxWMajMPWBIsxYJCnlITU5ShiHYdZ94TR4wCmSxg9jtB5KyPGYzymAYexWEMwAPIsAdYdV6aObmNPGD0aYLoEzaMJnTc0Ygs+YDw0GAtqxBjkuP38bMRWCHn73xNGjz75P73WenCEJnhwyVe3AEe8TtKdJcYhBl97wuhNAObK66lvD/9J9NS75v17wuitAN5fe4D31x7g/bUHeH/tAd5fe4D3AO+vPcD7aw/w/toDvL/2AO+vPcD7aw/w/toDvAd4f/24ABzZ8o+KLsSLS+Pv/TqTb3P4hKlQrTGh+fbIBT0Axqznnb+L/V2mb3HkN5Mb/nEHeK7d4IcDld6lmDW/iH9E+AH1MdOw/Jlu2T1xNmY98sv4wHnD7D3uNHu54WUuOsBTbQuvBsPT/UfzNxGYzwkP8c+Yz3C+r/i6DcyRL/rZ+utRwWH5PmfvcvYEt9jLDS/bg0/B64DWKrQM8AL8FPwS9beQCe6EMKNZYJol37jBMy35otdaz0Bw2H/C2Smc7+WGB0HWDELBmOByA3r5QONo4V+DpzR/hFS4U8wMW1PXNB4TOqYz9urxRV++ntWCw/U59Ty9ebdWbrgfRS9AYKKN63ZokZVygr8GZ/gfIhZXIXPsAlNjPOLBby5c1eOLvmQ9lwkOy5x6QV1j5TYqpS05JtUgUHUp5toHGsVfn4NX4RnMCe+AxTpwmApTYxqMxwfCeJGjpXzRF61nbcHhUBPqWze9svwcHJ+S6NPscKrEjug78Dx8Lj3T8D4YxGIdxmJcwhi34fzZUr7olevZCw5vkOhoClq5zBPZAnygD/Tl9EzDh6kl3VhsHYcDEb+hCtJSvuiV69kLDm+WycrOTArHmB5/VYyP6jOVjwgGawk2zQOaTcc1L+aLXrKeveDwZqlKrw8U9Y1p66uK8dEzdYwBeUQAY7DbyYNezBfdWQ97weEtAKYQg2xJIkuveAT3dYeLGH+ShrWNwZgN0b2YL7qznr3g8JYAo5bQBziPjx7BPZ0d9RCQp4UZbnFdzBddor4XHN4KYMrB2qHFRIzzcLAHQZ5the5ovui94PCWAPefaYnxIdzRwdHCbuR4B+tbiy96Lzi8E4D7z7S0mEPd+eqO3cT53Z0Y8SV80XvB4Z0ADJi/f7X113f+7p7/+UYBvur6657/+YYBvur6657/+aYBvuL6657/+aYBvuL6657/+aYBvuL6657/+aYBvuL6657/+VMA8FXWX/f8z58OgK+y/rrnf75RgLna+uue//lTA/CV1V/3/M837aKvvv6653++UQvmauuve/7nTwfAV1N/3fM/fzr24Cuuv+75nz8FFnxl9dc9//MOr/8/glixwRuUfM4AAAAASUVORK5CYII=\";\n }\n getSearchTexture() {\n return \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEIAAAAhCAAAAABIXyLAAAAAOElEQVRIx2NgGAWjYBSMglEwEICREYRgFBZBqDCSLA2MGPUIVQETE9iNUAqLR5gIeoQKRgwXjwAAGn4AtaFeYLEAAAAASUVORK5CYII=\";\n }\n}\nconst FilmShader = {\n uniforms: {\n tDiffuse: { value: null },\n time: { value: 0 },\n nIntensity: { value: 0.5 },\n sIntensity: { value: 0.05 },\n sCount: { value: 4096 },\n grayscale: { value: 1 }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"#include \",\n // control parameter\n \"uniform float time;\",\n \"uniform bool grayscale;\",\n // noise effect intensity value (0 = no effect, 1 = full effect)\n \"uniform float nIntensity;\",\n // scanlines effect intensity value (0 = no effect, 1 = full effect)\n \"uniform float sIntensity;\",\n // scanlines effect count value (0 = no effect, 4096 = full effect)\n \"uniform float sCount;\",\n \"uniform sampler2D tDiffuse;\",\n \"varying vec2 vUv;\",\n \"void main() {\",\n // sample the source\n \"\tvec4 cTextureScreen = texture2D( tDiffuse, vUv );\",\n // make some noise\n \"\tfloat dx = rand( vUv + time );\",\n // add noise\n \"\tvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx, 0.0, 1.0 );\",\n // get us a sine and cosine\n \"\tvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\",\n // add scanlines\n \"\tcResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\",\n // interpolate between source and result by intensity\n \"\tcResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\",\n // convert to grayscale if desired\n \"\tif( grayscale ) {\",\n \"\t\tcResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\",\n \"\t}\",\n \"\tgl_FragColor = vec4( cResult, cTextureScreen.a );\",\n \"}\"\n ].join(\"\\n\")\n};\nclass FilmPass extends Pass {\n constructor(noiseIntensity, scanlinesIntensity, scanlinesCount, grayscale) {\n super();\n __publicField(this, \"material\");\n __publicField(this, \"fsQuad\");\n __publicField(this, \"uniforms\");\n if (FilmShader === void 0)\n console.error(\"THREE.FilmPass relies on FilmShader\");\n const shader = FilmShader;\n this.uniforms = three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(shader.uniforms);\n this.material = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: this.uniforms,\n vertexShader: shader.vertexShader,\n fragmentShader: shader.fragmentShader\n });\n if (grayscale !== void 0)\n this.uniforms.grayscale.value = grayscale;\n if (noiseIntensity !== void 0)\n this.uniforms.nIntensity.value = noiseIntensity;\n if (scanlinesIntensity !== void 0)\n this.uniforms.sIntensity.value = scanlinesIntensity;\n if (scanlinesCount !== void 0)\n this.uniforms.sCount.value = scanlinesCount;\n this.fsQuad = new FullScreenQuad(this.material);\n }\n render(renderer, writeBuffer, readBuffer, deltaTime) {\n this.uniforms[\"tDiffuse\"].value = readBuffer.texture;\n this.uniforms[\"time\"].value += deltaTime;\n if (this.renderToScreen) {\n renderer.setRenderTarget(null);\n this.fsQuad.render(renderer);\n } else {\n renderer.setRenderTarget(writeBuffer);\n if (this.clear)\n renderer.clear();\n this.fsQuad.render(renderer);\n }\n }\n}\nconst CopyShader = {\n uniforms: {\n tDiffuse: { value: null },\n opacity: { value: 1 }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform float opacity;\",\n \"uniform sampler2D tDiffuse;\",\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvec4 texel = texture2D( tDiffuse, vUv );\",\n \"\tgl_FragColor = opacity * texel;\",\n \"}\"\n ].join(\"\\n\")\n};\nclass OutlinePass extends Pass {\n constructor(resolution, scene, camera, selectedObjects) {\n super();\n __publicField(this, \"renderScene\");\n __publicField(this, \"renderCamera\");\n __publicField(this, \"selectedObjects\");\n __publicField(this, \"visibleEdgeColor\");\n __publicField(this, \"hiddenEdgeColor\");\n __publicField(this, \"edgeGlow\");\n __publicField(this, \"usePatternTexture\");\n __publicField(this, \"edgeThickness\");\n __publicField(this, \"edgeStrength\");\n __publicField(this, \"downSampleRatio\");\n __publicField(this, \"pulsePeriod\");\n __publicField(this, \"resolution\");\n __publicField(this, \"renderTargetMaskBuffer\");\n __publicField(this, \"depthMaterial\");\n __publicField(this, \"prepareMaskMaterial\");\n __publicField(this, \"renderTargetDepthBuffer\");\n __publicField(this, \"renderTargetMaskDownSampleBuffer\");\n __publicField(this, \"renderTargetBlurBuffer1\");\n __publicField(this, \"renderTargetBlurBuffer2\");\n __publicField(this, \"edgeDetectionMaterial\");\n __publicField(this, \"renderTargetEdgeBuffer1\");\n __publicField(this, \"renderTargetEdgeBuffer2\");\n __publicField(this, \"separableBlurMaterial1\");\n __publicField(this, \"separableBlurMaterial2\");\n __publicField(this, \"overlayMaterial\");\n __publicField(this, \"materialCopy\");\n __publicField(this, \"oldClearAlpha\");\n __publicField(this, \"fsQuad\");\n __publicField(this, \"tempPulseColor1\");\n __publicField(this, \"tempPulseColor2\");\n __publicField(this, \"textureMatrix\");\n __publicField(this, \"patternTexture\");\n __publicField(this, \"_visibilityCache\");\n __publicField(this, \"_oldClearColor\");\n __publicField(this, \"copyUniforms\");\n __publicField(this, \"BlurDirectionX\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(1, 0));\n __publicField(this, \"BlurDirectionY\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(0, 1));\n this.renderScene = scene;\n this.renderCamera = camera;\n this.selectedObjects = selectedObjects !== void 0 ? selectedObjects : [];\n this.visibleEdgeColor = new three__WEBPACK_IMPORTED_MODULE_42__.Color(1, 1, 1);\n this.hiddenEdgeColor = new three__WEBPACK_IMPORTED_MODULE_42__.Color(0.1, 0.04, 0.02);\n this.edgeGlow = 0;\n this.usePatternTexture = false;\n this.edgeThickness = 1;\n this.edgeStrength = 3;\n this.downSampleRatio = 2;\n this.pulsePeriod = 0;\n this._visibilityCache = /* @__PURE__ */ new Map();\n this.resolution = resolution !== void 0 ? new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(resolution.x, resolution.y) : new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(256, 256);\n const resx = Math.round(this.resolution.x / this.downSampleRatio);\n const resy = Math.round(this.resolution.y / this.downSampleRatio);\n this.renderTargetMaskBuffer = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(this.resolution.x, this.resolution.y);\n this.renderTargetMaskBuffer.texture.name = \"OutlinePass.mask\";\n this.renderTargetMaskBuffer.texture.generateMipmaps = false;\n this.depthMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.MeshDepthMaterial();\n this.depthMaterial.side = three__WEBPACK_IMPORTED_MODULE_42__.DoubleSide;\n this.depthMaterial.depthPacking = three__WEBPACK_IMPORTED_MODULE_42__.RGBADepthPacking;\n this.depthMaterial.blending = three__WEBPACK_IMPORTED_MODULE_42__.NoBlending;\n this.prepareMaskMaterial = this.getPrepareMaskMaterial();\n this.prepareMaskMaterial.side = three__WEBPACK_IMPORTED_MODULE_42__.DoubleSide;\n this.prepareMaskMaterial.fragmentShader = replaceDepthToViewZ(\n this.prepareMaskMaterial.fragmentShader,\n this.renderCamera\n );\n this.renderTargetDepthBuffer = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(this.resolution.x, this.resolution.y);\n this.renderTargetDepthBuffer.texture.name = \"OutlinePass.depth\";\n this.renderTargetDepthBuffer.texture.generateMipmaps = false;\n this.renderTargetMaskDownSampleBuffer = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(resx, resy);\n this.renderTargetMaskDownSampleBuffer.texture.name = \"OutlinePass.depthDownSample\";\n this.renderTargetMaskDownSampleBuffer.texture.generateMipmaps = false;\n this.renderTargetBlurBuffer1 = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(resx, resy);\n this.renderTargetBlurBuffer1.texture.name = \"OutlinePass.blur1\";\n this.renderTargetBlurBuffer1.texture.generateMipmaps = false;\n this.renderTargetBlurBuffer2 = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(Math.round(resx / 2), Math.round(resy / 2));\n this.renderTargetBlurBuffer2.texture.name = \"OutlinePass.blur2\";\n this.renderTargetBlurBuffer2.texture.generateMipmaps = false;\n this.edgeDetectionMaterial = this.getEdgeDetectionMaterial();\n this.renderTargetEdgeBuffer1 = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(resx, resy);\n this.renderTargetEdgeBuffer1.texture.name = \"OutlinePass.edge1\";\n this.renderTargetEdgeBuffer1.texture.generateMipmaps = false;\n this.renderTargetEdgeBuffer2 = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(Math.round(resx / 2), Math.round(resy / 2));\n this.renderTargetEdgeBuffer2.texture.name = \"OutlinePass.edge2\";\n this.renderTargetEdgeBuffer2.texture.generateMipmaps = false;\n const MAX_EDGE_THICKNESS = 4;\n const MAX_EDGE_GLOW = 4;\n this.separableBlurMaterial1 = this.getSeperableBlurMaterial(MAX_EDGE_THICKNESS);\n this.separableBlurMaterial1.uniforms[\"texSize\"].value.set(resx, resy);\n this.separableBlurMaterial1.uniforms[\"kernelRadius\"].value = 1;\n this.separableBlurMaterial2 = this.getSeperableBlurMaterial(MAX_EDGE_GLOW);\n this.separableBlurMaterial2.uniforms[\"texSize\"].value.set(Math.round(resx / 2), Math.round(resy / 2));\n this.separableBlurMaterial2.uniforms[\"kernelRadius\"].value = MAX_EDGE_GLOW;\n this.overlayMaterial = this.getOverlayMaterial();\n if (CopyShader === void 0)\n console.error(\"THREE.OutlinePass relies on CopyShader\");\n const copyShader = CopyShader;\n this.copyUniforms = three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(copyShader.uniforms);\n this.copyUniforms[\"opacity\"].value = 1;\n this.materialCopy = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: this.copyUniforms,\n vertexShader: copyShader.vertexShader,\n fragmentShader: copyShader.fragmentShader,\n blending: three__WEBPACK_IMPORTED_MODULE_42__.NoBlending,\n depthTest: false,\n depthWrite: false,\n transparent: true\n });\n this.enabled = true;\n this.needsSwap = false;\n this._oldClearColor = new three__WEBPACK_IMPORTED_MODULE_42__.Color();\n this.oldClearAlpha = 1;\n this.fsQuad = new FullScreenQuad(this.materialCopy);\n this.tempPulseColor1 = new three__WEBPACK_IMPORTED_MODULE_42__.Color();\n this.tempPulseColor2 = new three__WEBPACK_IMPORTED_MODULE_42__.Color();\n this.textureMatrix = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n function replaceDepthToViewZ(string, camera2) {\n const type = camera2.isPerspectiveCamera ? \"perspective\" : \"orthographic\";\n return string.replace(/DEPTH_TO_VIEW_Z/g, type + \"DepthToViewZ\");\n }\n }\n dispose() {\n this.renderTargetMaskBuffer.dispose();\n this.renderTargetDepthBuffer.dispose();\n this.renderTargetMaskDownSampleBuffer.dispose();\n this.renderTargetBlurBuffer1.dispose();\n this.renderTargetBlurBuffer2.dispose();\n this.renderTargetEdgeBuffer1.dispose();\n this.renderTargetEdgeBuffer2.dispose();\n }\n setSize(width, height) {\n this.renderTargetMaskBuffer.setSize(width, height);\n this.renderTargetDepthBuffer.setSize(width, height);\n let resx = Math.round(width / this.downSampleRatio);\n let resy = Math.round(height / this.downSampleRatio);\n this.renderTargetMaskDownSampleBuffer.setSize(resx, resy);\n this.renderTargetBlurBuffer1.setSize(resx, resy);\n this.renderTargetEdgeBuffer1.setSize(resx, resy);\n this.separableBlurMaterial1.uniforms[\"texSize\"].value.set(resx, resy);\n resx = Math.round(resx / 2);\n resy = Math.round(resy / 2);\n this.renderTargetBlurBuffer2.setSize(resx, resy);\n this.renderTargetEdgeBuffer2.setSize(resx, resy);\n this.separableBlurMaterial2.uniforms[\"texSize\"].value.set(resx, resy);\n }\n changeVisibilityOfSelectedObjects(bVisible) {\n const cache = this._visibilityCache;\n function gatherSelectedMeshesCallBack(object) {\n if (object.isMesh) {\n if (bVisible === true) {\n object.visible = cache.get(object);\n } else {\n cache.set(object, object.visible);\n object.visible = bVisible;\n }\n }\n }\n for (let i2 = 0; i2 < this.selectedObjects.length; i2++) {\n const selectedObject = this.selectedObjects[i2];\n selectedObject.traverse(gatherSelectedMeshesCallBack);\n }\n }\n changeVisibilityOfNonSelectedObjects(bVisible) {\n const cache = this._visibilityCache;\n const selectedMeshes = [];\n function gatherSelectedMeshesCallBack(object) {\n if (object.isMesh)\n selectedMeshes.push(object);\n }\n for (let i2 = 0; i2 < this.selectedObjects.length; i2++) {\n const selectedObject = this.selectedObjects[i2];\n selectedObject.traverse(gatherSelectedMeshesCallBack);\n }\n function VisibilityChangeCallBack(object) {\n if (object.isMesh || object.isSprite) {\n let bFound = false;\n for (let i2 = 0; i2 < selectedMeshes.length; i2++) {\n const selectedObjectId = selectedMeshes[i2].id;\n if (selectedObjectId === object.id) {\n bFound = true;\n break;\n }\n }\n if (bFound === false) {\n const visibility = object.visible;\n if (bVisible === false || cache.get(object) === true) {\n object.visible = bVisible;\n }\n cache.set(object, visibility);\n }\n } else if (object.isPoints || object.isLine) {\n if (bVisible === true) {\n object.visible = cache.get(object);\n } else {\n cache.set(object, object.visible);\n object.visible = bVisible;\n }\n }\n }\n this.renderScene.traverse(VisibilityChangeCallBack);\n }\n updateTextureMatrix() {\n this.textureMatrix.set(0.5, 0, 0, 0.5, 0, 0.5, 0, 0.5, 0, 0, 0.5, 0.5, 0, 0, 0, 1);\n this.textureMatrix.multiply(this.renderCamera.projectionMatrix);\n this.textureMatrix.multiply(this.renderCamera.matrixWorldInverse);\n }\n render(renderer, writeBuffer, readBuffer, deltaTime, maskActive) {\n if (this.selectedObjects.length > 0) {\n renderer.getClearColor(this._oldClearColor);\n this.oldClearAlpha = renderer.getClearAlpha();\n const oldAutoClear = renderer.autoClear;\n renderer.autoClear = false;\n if (maskActive)\n renderer.state.buffers.stencil.setTest(false);\n renderer.setClearColor(16777215, 1);\n this.changeVisibilityOfSelectedObjects(false);\n const currentBackground = this.renderScene.background;\n this.renderScene.background = null;\n this.renderScene.overrideMaterial = this.depthMaterial;\n renderer.setRenderTarget(this.renderTargetDepthBuffer);\n renderer.clear();\n renderer.render(this.renderScene, this.renderCamera);\n this.changeVisibilityOfSelectedObjects(true);\n this._visibilityCache.clear();\n this.updateTextureMatrix();\n this.changeVisibilityOfNonSelectedObjects(false);\n this.renderScene.overrideMaterial = this.prepareMaskMaterial;\n this.prepareMaskMaterial.uniforms[\"cameraNearFar\"].value.set(\n this.renderCamera.near,\n this.renderCamera.far\n );\n this.prepareMaskMaterial.uniforms[\"depthTexture\"].value = this.renderTargetDepthBuffer.texture;\n this.prepareMaskMaterial.uniforms[\"textureMatrix\"].value = this.textureMatrix;\n renderer.setRenderTarget(this.renderTargetMaskBuffer);\n renderer.clear();\n renderer.render(this.renderScene, this.renderCamera);\n this.renderScene.overrideMaterial = null;\n this.changeVisibilityOfNonSelectedObjects(true);\n this._visibilityCache.clear();\n this.renderScene.background = currentBackground;\n this.fsQuad.material = this.materialCopy;\n this.copyUniforms[\"tDiffuse\"].value = this.renderTargetMaskBuffer.texture;\n renderer.setRenderTarget(this.renderTargetMaskDownSampleBuffer);\n renderer.clear();\n this.fsQuad.render(renderer);\n this.tempPulseColor1.copy(this.visibleEdgeColor);\n this.tempPulseColor2.copy(this.hiddenEdgeColor);\n if (this.pulsePeriod > 0) {\n const scalar = (1 + 0.25) / 2 + Math.cos(performance.now() * 0.01 / this.pulsePeriod) * (1 - 0.25) / 2;\n this.tempPulseColor1.multiplyScalar(scalar);\n this.tempPulseColor2.multiplyScalar(scalar);\n }\n this.fsQuad.material = this.edgeDetectionMaterial;\n this.edgeDetectionMaterial.uniforms[\"maskTexture\"].value = this.renderTargetMaskDownSampleBuffer.texture;\n this.edgeDetectionMaterial.uniforms[\"texSize\"].value.set(\n this.renderTargetMaskDownSampleBuffer.width,\n this.renderTargetMaskDownSampleBuffer.height\n );\n this.edgeDetectionMaterial.uniforms[\"visibleEdgeColor\"].value = this.tempPulseColor1;\n this.edgeDetectionMaterial.uniforms[\"hiddenEdgeColor\"].value = this.tempPulseColor2;\n renderer.setRenderTarget(this.renderTargetEdgeBuffer1);\n renderer.clear();\n this.fsQuad.render(renderer);\n this.fsQuad.material = this.separableBlurMaterial1;\n this.separableBlurMaterial1.uniforms[\"colorTexture\"].value = this.renderTargetEdgeBuffer1.texture;\n this.separableBlurMaterial1.uniforms[\"direction\"].value = this.BlurDirectionX;\n this.separableBlurMaterial1.uniforms[\"kernelRadius\"].value = this.edgeThickness;\n renderer.setRenderTarget(this.renderTargetBlurBuffer1);\n renderer.clear();\n this.fsQuad.render(renderer);\n this.separableBlurMaterial1.uniforms[\"colorTexture\"].value = this.renderTargetBlurBuffer1.texture;\n this.separableBlurMaterial1.uniforms[\"direction\"].value = this.BlurDirectionY;\n renderer.setRenderTarget(this.renderTargetEdgeBuffer1);\n renderer.clear();\n this.fsQuad.render(renderer);\n this.fsQuad.material = this.separableBlurMaterial2;\n this.separableBlurMaterial2.uniforms[\"colorTexture\"].value = this.renderTargetEdgeBuffer1.texture;\n this.separableBlurMaterial2.uniforms[\"direction\"].value = this.BlurDirectionX;\n renderer.setRenderTarget(this.renderTargetBlurBuffer2);\n renderer.clear();\n this.fsQuad.render(renderer);\n this.separableBlurMaterial2.uniforms[\"colorTexture\"].value = this.renderTargetBlurBuffer2.texture;\n this.separableBlurMaterial2.uniforms[\"direction\"].value = this.BlurDirectionY;\n renderer.setRenderTarget(this.renderTargetEdgeBuffer2);\n renderer.clear();\n this.fsQuad.render(renderer);\n this.fsQuad.material = this.overlayMaterial;\n this.overlayMaterial.uniforms[\"maskTexture\"].value = this.renderTargetMaskBuffer.texture;\n this.overlayMaterial.uniforms[\"edgeTexture1\"].value = this.renderTargetEdgeBuffer1.texture;\n this.overlayMaterial.uniforms[\"edgeTexture2\"].value = this.renderTargetEdgeBuffer2.texture;\n this.overlayMaterial.uniforms[\"patternTexture\"].value = this.patternTexture;\n this.overlayMaterial.uniforms[\"edgeStrength\"].value = this.edgeStrength;\n this.overlayMaterial.uniforms[\"edgeGlow\"].value = this.edgeGlow;\n this.overlayMaterial.uniforms[\"usePatternTexture\"].value = this.usePatternTexture;\n if (maskActive)\n renderer.state.buffers.stencil.setTest(true);\n renderer.setRenderTarget(readBuffer);\n this.fsQuad.render(renderer);\n renderer.setClearColor(this._oldClearColor, this.oldClearAlpha);\n renderer.autoClear = oldAutoClear;\n }\n if (this.renderToScreen) {\n this.fsQuad.material = this.materialCopy;\n this.copyUniforms[\"tDiffuse\"].value = readBuffer.texture;\n renderer.setRenderTarget(null);\n this.fsQuad.render(renderer);\n }\n }\n getPrepareMaskMaterial() {\n return new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: {\n depthTexture: { value: null },\n cameraNearFar: { value: new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(0.5, 0.5) },\n textureMatrix: { value: null }\n },\n vertexShader: `#include \n\t\t\t\t#include \n\t\t\t\tvarying vec4 projTexCoord;\n\t\t\t\tvarying vec4 vPosition;\n\t\t\t\tuniform mat4 textureMatrix;\n\t\t\t\tvoid main() {\n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\t\t\t\t\tvPosition = mvPosition;\n\t\t\t\t\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\t\t\t\t\tprojTexCoord = textureMatrix * worldPosition;\n\t\t\t\t}`,\n fragmentShader: `#include \n\t\t\t\tvarying vec4 vPosition;\n\t\t\t\tvarying vec4 projTexCoord;\n\t\t\t\tuniform sampler2D depthTexture;\n\t\t\t\tuniform vec2 cameraNearFar;\n\t\t\t\tvoid main() {\n\t\t\t\t\tfloat depth = unpackRGBAToDepth(texture2DProj( depthTexture, projTexCoord ));\n\t\t\t\t\tfloat viewZ = - DEPTH_TO_VIEW_Z( depth, cameraNearFar.x, cameraNearFar.y );\n\t\t\t\t\tfloat depthTest = (-vPosition.z > viewZ) ? 1.0 : 0.0;\n\t\t\t\t\tgl_FragColor = vec4(0.0, depthTest, 1.0, 1.0);\n\t\t\t\t}`\n });\n }\n getEdgeDetectionMaterial() {\n return new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: {\n maskTexture: { value: null },\n texSize: { value: new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(0.5, 0.5) },\n visibleEdgeColor: { value: new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(1, 1, 1) },\n hiddenEdgeColor: { value: new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(1, 1, 1) }\n },\n vertexShader: `varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}`,\n fragmentShader: `varying vec2 vUv;\n\t\t\t\tuniform sampler2D maskTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec3 visibleEdgeColor;\n\t\t\t\tuniform vec3 hiddenEdgeColor;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tvec4 uvOffset = vec4(1.0, 0.0, 0.0, 1.0) * vec4(invSize, invSize);\n\t\t\t\t\tvec4 c1 = texture2D( maskTexture, vUv + uvOffset.xy);\n\t\t\t\t\tvec4 c2 = texture2D( maskTexture, vUv - uvOffset.xy);\n\t\t\t\t\tvec4 c3 = texture2D( maskTexture, vUv + uvOffset.yw);\n\t\t\t\t\tvec4 c4 = texture2D( maskTexture, vUv - uvOffset.yw);\n\t\t\t\t\tfloat diff1 = (c1.r - c2.r)*0.5;\n\t\t\t\t\tfloat diff2 = (c3.r - c4.r)*0.5;\n\t\t\t\t\tfloat d = length( vec2(diff1, diff2) );\n\t\t\t\t\tfloat a1 = min(c1.g, c2.g);\n\t\t\t\t\tfloat a2 = min(c3.g, c4.g);\n\t\t\t\t\tfloat visibilityFactor = min(a1, a2);\n\t\t\t\t\tvec3 edgeColor = 1.0 - visibilityFactor > 0.001 ? visibleEdgeColor : hiddenEdgeColor;\n\t\t\t\t\tgl_FragColor = vec4(edgeColor, 1.0) * vec4(d);\n\t\t\t\t}`\n });\n }\n getSeperableBlurMaterial(maxRadius) {\n return new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n defines: {\n MAX_RADIUS: maxRadius\n },\n uniforms: {\n colorTexture: { value: null },\n texSize: { value: new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(0.5, 0.5) },\n direction: { value: new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(0.5, 0.5) },\n kernelRadius: { value: 1 }\n },\n vertexShader: `varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}`,\n fragmentShader: `#include \n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec2 direction;\n\t\t\t\tuniform float kernelRadius;\n\t\t\t\tfloat gaussianPdf(in float x, in float sigma) {\n\t\t\t\t\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\n\t\t\t\t}\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, kernelRadius);\n\t\t\t\t\tvec4 diffuseSum = texture2D( colorTexture, vUv) * weightSum;\n\t\t\t\t\tvec2 delta = direction * invSize * kernelRadius/float(MAX_RADIUS);\n\t\t\t\t\tvec2 uvOffset = delta;\n\t\t\t\t\tfor( int i = 1; i <= MAX_RADIUS; i ++ ) {\n\t\t\t\t\t\tfloat w = gaussianPdf(uvOffset.x, kernelRadius);\n\t\t\t\t\t\tvec4 sample1 = texture2D( colorTexture, vUv + uvOffset);\n\t\t\t\t\t\tvec4 sample2 = texture2D( colorTexture, vUv - uvOffset);\n\t\t\t\t\t\tdiffuseSum += ((sample1 + sample2) * w);\n\t\t\t\t\t\tweightSum += (2.0 * w);\n\t\t\t\t\t\tuvOffset += delta;\n\t\t\t\t\t}\n\t\t\t\t\tgl_FragColor = diffuseSum/weightSum;\n\t\t\t\t}`\n });\n }\n getOverlayMaterial() {\n return new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: {\n maskTexture: { value: null },\n edgeTexture1: { value: null },\n edgeTexture2: { value: null },\n patternTexture: { value: null },\n edgeStrength: { value: 1 },\n edgeGlow: { value: 1 },\n usePatternTexture: { value: 0 }\n },\n vertexShader: `varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}`,\n fragmentShader: `varying vec2 vUv;\n\t\t\t\tuniform sampler2D maskTexture;\n\t\t\t\tuniform sampler2D edgeTexture1;\n\t\t\t\tuniform sampler2D edgeTexture2;\n\t\t\t\tuniform sampler2D patternTexture;\n\t\t\t\tuniform float edgeStrength;\n\t\t\t\tuniform float edgeGlow;\n\t\t\t\tuniform bool usePatternTexture;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec4 edgeValue1 = texture2D(edgeTexture1, vUv);\n\t\t\t\t\tvec4 edgeValue2 = texture2D(edgeTexture2, vUv);\n\t\t\t\t\tvec4 maskColor = texture2D(maskTexture, vUv);\n\t\t\t\t\tvec4 patternColor = texture2D(patternTexture, 6.0 * vUv);\n\t\t\t\t\tfloat visibilityFactor = 1.0 - maskColor.g > 0.0 ? 1.0 : 0.5;\n\t\t\t\t\tvec4 edgeValue = edgeValue1 + edgeValue2 * edgeGlow;\n\t\t\t\t\tvec4 finalColor = edgeStrength * maskColor.r * edgeValue;\n\t\t\t\t\tif(usePatternTexture)\n\t\t\t\t\t\tfinalColor += + visibilityFactor * (1.0 - maskColor.r) * (1.0 - patternColor.r);\n\t\t\t\t\tgl_FragColor = finalColor;\n\t\t\t\t}`,\n blending: three__WEBPACK_IMPORTED_MODULE_42__.AdditiveBlending,\n depthTest: false,\n depthWrite: false,\n transparent: true\n });\n }\n}\nconst SSAOShader = {\n defines: {\n PERSPECTIVE_CAMERA: 1,\n KERNEL_SIZE: 32\n },\n uniforms: {\n tDiffuse: { value: null },\n tNormal: { value: null },\n tDepth: { value: null },\n tNoise: { value: null },\n kernel: { value: null },\n cameraNear: { value: null },\n cameraFar: { value: null },\n resolution: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector2() },\n cameraProjectionMatrix: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4() },\n cameraInverseProjectionMatrix: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4() },\n kernelRadius: { value: 8 },\n minDistance: { value: 5e-3 },\n maxDistance: { value: 0.05 }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform sampler2D tDiffuse;\",\n \"uniform sampler2D tNormal;\",\n \"uniform sampler2D tDepth;\",\n \"uniform sampler2D tNoise;\",\n \"uniform vec3 kernel[ KERNEL_SIZE ];\",\n \"uniform vec2 resolution;\",\n \"uniform float cameraNear;\",\n \"uniform float cameraFar;\",\n \"uniform mat4 cameraProjectionMatrix;\",\n \"uniform mat4 cameraInverseProjectionMatrix;\",\n \"uniform float kernelRadius;\",\n \"uniform float minDistance;\",\n // avoid artifacts caused by neighbour fragments with minimal depth difference\n \"uniform float maxDistance;\",\n // avoid the influence of fragments which are too far away\n \"varying vec2 vUv;\",\n \"#include \",\n \"float getDepth( const in vec2 screenPosition ) {\",\n \"\treturn texture2D( tDepth, screenPosition ).x;\",\n \"}\",\n \"float getLinearDepth( const in vec2 screenPosition ) {\",\n \"\t#if PERSPECTIVE_CAMERA == 1\",\n \"\t\tfloat fragCoordZ = texture2D( tDepth, screenPosition ).x;\",\n \"\t\tfloat viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );\",\n \"\t\treturn viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );\",\n \"\t#else\",\n \"\t\treturn texture2D( tDepth, screenPosition ).x;\",\n \"\t#endif\",\n \"}\",\n \"float getViewZ( const in float depth ) {\",\n \"\t#if PERSPECTIVE_CAMERA == 1\",\n \"\t\treturn perspectiveDepthToViewZ( depth, cameraNear, cameraFar );\",\n \"\t#else\",\n \"\t\treturn orthographicDepthToViewZ( depth, cameraNear, cameraFar );\",\n \"\t#endif\",\n \"}\",\n \"vec3 getViewPosition( const in vec2 screenPosition, const in float depth, const in float viewZ ) {\",\n \"\tfloat clipW = cameraProjectionMatrix[2][3] * viewZ + cameraProjectionMatrix[3][3];\",\n \"\tvec4 clipPosition = vec4( ( vec3( screenPosition, depth ) - 0.5 ) * 2.0, 1.0 );\",\n \"\tclipPosition *= clipW; // unprojection.\",\n \"\treturn ( cameraInverseProjectionMatrix * clipPosition ).xyz;\",\n \"}\",\n \"vec3 getViewNormal( const in vec2 screenPosition ) {\",\n \"\treturn unpackRGBToNormal( texture2D( tNormal, screenPosition ).xyz );\",\n \"}\",\n \"void main() {\",\n \"\tfloat depth = getDepth( vUv );\",\n \"\tfloat viewZ = getViewZ( depth );\",\n \"\tvec3 viewPosition = getViewPosition( vUv, depth, viewZ );\",\n \"\tvec3 viewNormal = getViewNormal( vUv );\",\n \" vec2 noiseScale = vec2( resolution.x / 4.0, resolution.y / 4.0 );\",\n \"\tvec3 random = texture2D( tNoise, vUv * noiseScale ).xyz;\",\n // compute matrix used to reorient a kernel vector\n \"\tvec3 tangent = normalize( random - viewNormal * dot( random, viewNormal ) );\",\n \"\tvec3 bitangent = cross( viewNormal, tangent );\",\n \"\tmat3 kernelMatrix = mat3( tangent, bitangent, viewNormal );\",\n \" float occlusion = 0.0;\",\n \" for ( int i = 0; i < KERNEL_SIZE; i ++ ) {\",\n \"\t\tvec3 sampleVector = kernelMatrix * kernel[ i ];\",\n // reorient sample vector in view space\n \"\t\tvec3 samplePoint = viewPosition + ( sampleVector * kernelRadius );\",\n // calculate sample point\n \"\t\tvec4 samplePointNDC = cameraProjectionMatrix * vec4( samplePoint, 1.0 );\",\n // project point and calculate NDC\n \"\t\tsamplePointNDC /= samplePointNDC.w;\",\n \"\t\tvec2 samplePointUv = samplePointNDC.xy * 0.5 + 0.5;\",\n // compute uv coordinates\n \"\t\tfloat realDepth = getLinearDepth( samplePointUv );\",\n // get linear depth from depth texture\n \"\t\tfloat sampleDepth = viewZToOrthographicDepth( samplePoint.z, cameraNear, cameraFar );\",\n // compute linear depth of the sample view Z value\n \"\t\tfloat delta = sampleDepth - realDepth;\",\n \"\t\tif ( delta > minDistance && delta < maxDistance ) {\",\n // if fragment is before sample point, increase occlusion\n \"\t\t\tocclusion += 1.0;\",\n \"\t\t}\",\n \"\t}\",\n \"\tocclusion = clamp( occlusion / float( KERNEL_SIZE ), 0.0, 1.0 );\",\n \"\tgl_FragColor = vec4( vec3( 1.0 - occlusion ), 1.0 );\",\n \"}\"\n ].join(\"\\n\")\n};\nconst SSAODepthShader = {\n defines: {\n PERSPECTIVE_CAMERA: 1\n },\n uniforms: {\n tDepth: { value: null },\n cameraNear: { value: null },\n cameraFar: { value: null }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform sampler2D tDepth;\",\n \"uniform float cameraNear;\",\n \"uniform float cameraFar;\",\n \"varying vec2 vUv;\",\n \"#include \",\n \"float getLinearDepth( const in vec2 screenPosition ) {\",\n \"\t#if PERSPECTIVE_CAMERA == 1\",\n \"\t\tfloat fragCoordZ = texture2D( tDepth, screenPosition ).x;\",\n \"\t\tfloat viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );\",\n \"\t\treturn viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );\",\n \"\t#else\",\n \"\t\treturn texture2D( tDepth, screenPosition ).x;\",\n \"\t#endif\",\n \"}\",\n \"void main() {\",\n \"\tfloat depth = getLinearDepth( vUv );\",\n \"\tgl_FragColor = vec4( vec3( 1.0 - depth ), 1.0 );\",\n \"}\"\n ].join(\"\\n\")\n};\nconst SSAOBlurShader = {\n uniforms: {\n tDiffuse: { value: null },\n resolution: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector2() }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform sampler2D tDiffuse;\",\n \"uniform vec2 resolution;\",\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvec2 texelSize = ( 1.0 / resolution );\",\n \"\tfloat result = 0.0;\",\n \"\tfor ( int i = - 2; i <= 2; i ++ ) {\",\n \"\t\tfor ( int j = - 2; j <= 2; j ++ ) {\",\n \"\t\t\tvec2 offset = ( vec2( float( i ), float( j ) ) ) * texelSize;\",\n \"\t\t\tresult += texture2D( tDiffuse, vUv + offset ).r;\",\n \"\t\t}\",\n \"\t}\",\n \"\tgl_FragColor = vec4( vec3( result / ( 5.0 * 5.0 ) ), 1.0 );\",\n \"}\"\n ].join(\"\\n\")\n};\nconst _SSAOPass = class extends Pass {\n constructor(scene, camera, width, height) {\n super();\n this.width = width !== void 0 ? width : 512;\n this.height = height !== void 0 ? height : 512;\n this.clear = true;\n this.camera = camera;\n this.scene = scene;\n this.kernelRadius = 8;\n this.kernelSize = 32;\n this.kernel = [];\n this.noiseTexture = null;\n this.output = 0;\n this.minDistance = 5e-3;\n this.maxDistance = 0.1;\n this._visibilityCache = /* @__PURE__ */ new Map();\n this.generateSampleKernel();\n this.generateRandomKernelRotations();\n const depthTexture = new three__WEBPACK_IMPORTED_MODULE_42__.DepthTexture();\n depthTexture.format = three__WEBPACK_IMPORTED_MODULE_42__.DepthStencilFormat;\n depthTexture.type = three__WEBPACK_IMPORTED_MODULE_42__.UnsignedInt248Type;\n this.beautyRenderTarget = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(this.width, this.height);\n this.normalRenderTarget = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(this.width, this.height, {\n minFilter: three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter,\n magFilter: three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter,\n depthTexture\n });\n this.ssaoRenderTarget = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(this.width, this.height);\n this.blurRenderTarget = this.ssaoRenderTarget.clone();\n if (SSAOShader === void 0) {\n console.error(\"THREE.SSAOPass: The pass relies on SSAOShader.\");\n }\n this.ssaoMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n defines: Object.assign({}, SSAOShader.defines),\n uniforms: three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(SSAOShader.uniforms),\n vertexShader: SSAOShader.vertexShader,\n fragmentShader: SSAOShader.fragmentShader,\n blending: three__WEBPACK_IMPORTED_MODULE_42__.NoBlending\n });\n this.ssaoMaterial.uniforms[\"tDiffuse\"].value = this.beautyRenderTarget.texture;\n this.ssaoMaterial.uniforms[\"tNormal\"].value = this.normalRenderTarget.texture;\n this.ssaoMaterial.uniforms[\"tDepth\"].value = this.normalRenderTarget.depthTexture;\n this.ssaoMaterial.uniforms[\"tNoise\"].value = this.noiseTexture;\n this.ssaoMaterial.uniforms[\"kernel\"].value = this.kernel;\n this.ssaoMaterial.uniforms[\"cameraNear\"].value = this.camera.near;\n this.ssaoMaterial.uniforms[\"cameraFar\"].value = this.camera.far;\n this.ssaoMaterial.uniforms[\"resolution\"].value.set(this.width, this.height);\n this.ssaoMaterial.uniforms[\"cameraProjectionMatrix\"].value.copy(this.camera.projectionMatrix);\n this.ssaoMaterial.uniforms[\"cameraInverseProjectionMatrix\"].value.copy(this.camera.projectionMatrixInverse);\n this.normalMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.MeshNormalMaterial();\n this.normalMaterial.blending = three__WEBPACK_IMPORTED_MODULE_42__.NoBlending;\n this.blurMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n defines: Object.assign({}, SSAOBlurShader.defines),\n uniforms: three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(SSAOBlurShader.uniforms),\n vertexShader: SSAOBlurShader.vertexShader,\n fragmentShader: SSAOBlurShader.fragmentShader\n });\n this.blurMaterial.uniforms[\"tDiffuse\"].value = this.ssaoRenderTarget.texture;\n this.blurMaterial.uniforms[\"resolution\"].value.set(this.width, this.height);\n this.depthRenderMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n defines: Object.assign({}, SSAODepthShader.defines),\n uniforms: three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(SSAODepthShader.uniforms),\n vertexShader: SSAODepthShader.vertexShader,\n fragmentShader: SSAODepthShader.fragmentShader,\n blending: three__WEBPACK_IMPORTED_MODULE_42__.NoBlending\n });\n this.depthRenderMaterial.uniforms[\"tDepth\"].value = this.normalRenderTarget.depthTexture;\n this.depthRenderMaterial.uniforms[\"cameraNear\"].value = this.camera.near;\n this.depthRenderMaterial.uniforms[\"cameraFar\"].value = this.camera.far;\n this.copyMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(CopyShader.uniforms),\n vertexShader: CopyShader.vertexShader,\n fragmentShader: CopyShader.fragmentShader,\n transparent: true,\n depthTest: false,\n depthWrite: false,\n blendSrc: three__WEBPACK_IMPORTED_MODULE_42__.DstColorFactor,\n blendDst: three__WEBPACK_IMPORTED_MODULE_42__.ZeroFactor,\n blendEquation: three__WEBPACK_IMPORTED_MODULE_42__.AddEquation,\n blendSrcAlpha: three__WEBPACK_IMPORTED_MODULE_42__.DstAlphaFactor,\n blendDstAlpha: three__WEBPACK_IMPORTED_MODULE_42__.ZeroFactor,\n blendEquationAlpha: three__WEBPACK_IMPORTED_MODULE_42__.AddEquation\n });\n this.fsQuad = new FullScreenQuad(null);\n this.originalClearColor = new three__WEBPACK_IMPORTED_MODULE_42__.Color();\n }\n dispose() {\n this.beautyRenderTarget.dispose();\n this.normalRenderTarget.dispose();\n this.ssaoRenderTarget.dispose();\n this.blurRenderTarget.dispose();\n this.normalMaterial.dispose();\n this.blurMaterial.dispose();\n this.copyMaterial.dispose();\n this.depthRenderMaterial.dispose();\n this.fsQuad.dispose();\n }\n render(renderer, writeBuffer) {\n if (renderer.capabilities.isWebGL2 === false)\n this.noiseTexture.format = three__WEBPACK_IMPORTED_MODULE_42__.LuminanceFormat;\n renderer.setRenderTarget(this.beautyRenderTarget);\n renderer.clear();\n renderer.render(this.scene, this.camera);\n this.overrideVisibility();\n this.renderOverride(renderer, this.normalMaterial, this.normalRenderTarget, 7829503, 1);\n this.restoreVisibility();\n this.ssaoMaterial.uniforms[\"kernelRadius\"].value = this.kernelRadius;\n this.ssaoMaterial.uniforms[\"minDistance\"].value = this.minDistance;\n this.ssaoMaterial.uniforms[\"maxDistance\"].value = this.maxDistance;\n this.renderPass(renderer, this.ssaoMaterial, this.ssaoRenderTarget);\n this.renderPass(renderer, this.blurMaterial, this.blurRenderTarget);\n switch (this.output) {\n case _SSAOPass.OUTPUT.SSAO:\n this.copyMaterial.uniforms[\"tDiffuse\"].value = this.ssaoRenderTarget.texture;\n this.copyMaterial.blending = three__WEBPACK_IMPORTED_MODULE_42__.NoBlending;\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer);\n break;\n case _SSAOPass.OUTPUT.Blur:\n this.copyMaterial.uniforms[\"tDiffuse\"].value = this.blurRenderTarget.texture;\n this.copyMaterial.blending = three__WEBPACK_IMPORTED_MODULE_42__.NoBlending;\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer);\n break;\n case _SSAOPass.OUTPUT.Beauty:\n this.copyMaterial.uniforms[\"tDiffuse\"].value = this.beautyRenderTarget.texture;\n this.copyMaterial.blending = three__WEBPACK_IMPORTED_MODULE_42__.NoBlending;\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer);\n break;\n case _SSAOPass.OUTPUT.Depth:\n this.renderPass(renderer, this.depthRenderMaterial, this.renderToScreen ? null : writeBuffer);\n break;\n case _SSAOPass.OUTPUT.Normal:\n this.copyMaterial.uniforms[\"tDiffuse\"].value = this.normalRenderTarget.texture;\n this.copyMaterial.blending = three__WEBPACK_IMPORTED_MODULE_42__.NoBlending;\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer);\n break;\n case _SSAOPass.OUTPUT.Default:\n this.copyMaterial.uniforms[\"tDiffuse\"].value = this.beautyRenderTarget.texture;\n this.copyMaterial.blending = three__WEBPACK_IMPORTED_MODULE_42__.NoBlending;\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer);\n this.copyMaterial.uniforms[\"tDiffuse\"].value = this.blurRenderTarget.texture;\n this.copyMaterial.blending = three__WEBPACK_IMPORTED_MODULE_42__.CustomBlending;\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer);\n break;\n default:\n console.warn(\"THREE.SSAOPass: Unknown output type.\");\n }\n }\n renderPass(renderer, passMaterial, renderTarget, clearColor, clearAlpha) {\n renderer.getClearColor(this.originalClearColor);\n const originalClearAlpha = renderer.getClearAlpha();\n const originalAutoClear = renderer.autoClear;\n renderer.setRenderTarget(renderTarget);\n renderer.autoClear = false;\n if (clearColor !== void 0 && clearColor !== null) {\n renderer.setClearColor(clearColor);\n renderer.setClearAlpha(clearAlpha || 0);\n renderer.clear();\n }\n this.fsQuad.material = passMaterial;\n this.fsQuad.render(renderer);\n renderer.autoClear = originalAutoClear;\n renderer.setClearColor(this.originalClearColor);\n renderer.setClearAlpha(originalClearAlpha);\n }\n renderOverride(renderer, overrideMaterial, renderTarget, clearColor, clearAlpha) {\n renderer.getClearColor(this.originalClearColor);\n const originalClearAlpha = renderer.getClearAlpha();\n const originalAutoClear = renderer.autoClear;\n renderer.setRenderTarget(renderTarget);\n renderer.autoClear = false;\n clearColor = overrideMaterial.clearColor || clearColor;\n clearAlpha = overrideMaterial.clearAlpha || clearAlpha;\n if (clearColor !== void 0 && clearColor !== null) {\n renderer.setClearColor(clearColor);\n renderer.setClearAlpha(clearAlpha || 0);\n renderer.clear();\n }\n this.scene.overrideMaterial = overrideMaterial;\n renderer.render(this.scene, this.camera);\n this.scene.overrideMaterial = null;\n renderer.autoClear = originalAutoClear;\n renderer.setClearColor(this.originalClearColor);\n renderer.setClearAlpha(originalClearAlpha);\n }\n setSize(width, height) {\n this.width = width;\n this.height = height;\n this.beautyRenderTarget.setSize(width, height);\n this.ssaoRenderTarget.setSize(width, height);\n this.normalRenderTarget.setSize(width, height);\n this.blurRenderTarget.setSize(width, height);\n this.ssaoMaterial.uniforms[\"resolution\"].value.set(width, height);\n this.ssaoMaterial.uniforms[\"cameraProjectionMatrix\"].value.copy(this.camera.projectionMatrix);\n this.ssaoMaterial.uniforms[\"cameraInverseProjectionMatrix\"].value.copy(this.camera.projectionMatrixInverse);\n this.blurMaterial.uniforms[\"resolution\"].value.set(width, height);\n }\n generateSampleKernel() {\n const kernelSize = this.kernelSize;\n const kernel = this.kernel;\n for (let i2 = 0; i2 < kernelSize; i2++) {\n const sample = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n sample.x = Math.random() * 2 - 1;\n sample.y = Math.random() * 2 - 1;\n sample.z = Math.random();\n sample.normalize();\n let scale = i2 / kernelSize;\n scale = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.lerp(0.1, 1, scale * scale);\n sample.multiplyScalar(scale);\n kernel.push(sample);\n }\n }\n generateRandomKernelRotations() {\n const width = 4, height = 4;\n if (SimplexNoise === void 0) {\n console.error(\"THREE.SSAOPass: The pass relies on SimplexNoise.\");\n }\n const simplex = new SimplexNoise();\n const size2 = width * height;\n const data = new Float32Array(size2);\n for (let i2 = 0; i2 < size2; i2++) {\n const x = Math.random() * 2 - 1;\n const y = Math.random() * 2 - 1;\n const z = 0;\n data[i2] = simplex.noise3d(x, y, z);\n }\n this.noiseTexture = new three__WEBPACK_IMPORTED_MODULE_42__.DataTexture(data, width, height, three__WEBPACK_IMPORTED_MODULE_42__.RedFormat, three__WEBPACK_IMPORTED_MODULE_42__.FloatType);\n this.noiseTexture.wrapS = three__WEBPACK_IMPORTED_MODULE_42__.RepeatWrapping;\n this.noiseTexture.wrapT = three__WEBPACK_IMPORTED_MODULE_42__.RepeatWrapping;\n this.noiseTexture.needsUpdate = true;\n }\n overrideVisibility() {\n const scene = this.scene;\n const cache = this._visibilityCache;\n scene.traverse(function(object) {\n cache.set(object, object.visible);\n if (object.isPoints || object.isLine)\n object.visible = false;\n });\n }\n restoreVisibility() {\n const scene = this.scene;\n const cache = this._visibilityCache;\n scene.traverse(function(object) {\n const visible = cache.get(object);\n object.visible = visible;\n });\n cache.clear();\n }\n};\nlet SSAOPass = _SSAOPass;\n__publicField(SSAOPass, \"OUTPUT\", {\n Default: 0,\n SSAO: 1,\n Blur: 2,\n Beauty: 3,\n Depth: 4,\n Normal: 5\n});\nclass SavePass extends Pass {\n constructor(renderTarget) {\n super();\n if (CopyShader === void 0)\n console.error(\"THREE.SavePass relies on CopyShader\");\n const shader = CopyShader;\n this.textureID = \"tDiffuse\";\n this.uniforms = three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(shader.uniforms);\n this.material = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: this.uniforms,\n vertexShader: shader.vertexShader,\n fragmentShader: shader.fragmentShader,\n blending: three__WEBPACK_IMPORTED_MODULE_42__.NoBlending\n });\n this.renderTarget = renderTarget;\n if (this.renderTarget === void 0) {\n this.renderTarget = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(window.innerWidth, window.innerHeight);\n this.renderTarget.texture.name = \"SavePass.rt\";\n }\n this.needsSwap = false;\n this.fsQuad = new FullScreenQuad(this.material);\n }\n render(renderer, writeBuffer, readBuffer) {\n if (this.uniforms[this.textureID]) {\n this.uniforms[this.textureID].value = readBuffer.texture;\n }\n renderer.setRenderTarget(this.renderTarget);\n if (this.clear)\n renderer.clear();\n this.fsQuad.render(renderer);\n }\n}\nconst BokehShader = {\n defines: {\n DEPTH_PACKING: 1,\n PERSPECTIVE_CAMERA: 1\n },\n uniforms: {\n tColor: { value: null },\n tDepth: { value: null },\n focus: { value: 1 },\n aspect: { value: 1 },\n aperture: { value: 0.025 },\n maxblur: { value: 0.01 },\n nearClip: { value: 1 },\n farClip: { value: 1e3 }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"#include \",\n \"varying vec2 vUv;\",\n \"uniform sampler2D tColor;\",\n \"uniform sampler2D tDepth;\",\n \"uniform float maxblur;\",\n // max blur amount\n \"uniform float aperture;\",\n // aperture - bigger values for shallower depth of field\n \"uniform float nearClip;\",\n \"uniform float farClip;\",\n \"uniform float focus;\",\n \"uniform float aspect;\",\n \"#include \",\n \"float getDepth( const in vec2 screenPosition ) {\",\n \"\t#if DEPTH_PACKING == 1\",\n \"\treturn unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );\",\n \"\t#else\",\n \"\treturn texture2D( tDepth, screenPosition ).x;\",\n \"\t#endif\",\n \"}\",\n \"float getViewZ( const in float depth ) {\",\n \"\t#if PERSPECTIVE_CAMERA == 1\",\n \"\treturn perspectiveDepthToViewZ( depth, nearClip, farClip );\",\n \"\t#else\",\n \"\treturn orthographicDepthToViewZ( depth, nearClip, farClip );\",\n \"\t#endif\",\n \"}\",\n \"void main() {\",\n \"\tvec2 aspectcorrect = vec2( 1.0, aspect );\",\n \"\tfloat viewZ = getViewZ( getDepth( vUv ) );\",\n \"\tfloat factor = ( focus + viewZ );\",\n // viewZ is <= 0, so this is a difference equation\n \"\tvec2 dofblur = vec2 ( clamp( factor * aperture, -maxblur, maxblur ) );\",\n \"\tvec2 dofblur9 = dofblur * 0.9;\",\n \"\tvec2 dofblur7 = dofblur * 0.7;\",\n \"\tvec2 dofblur4 = dofblur * 0.4;\",\n \"\tvec4 col = vec4( 0.0 );\",\n \"\tcol += texture2D( tColor, vUv.xy );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.15, 0.37 ) * aspectcorrect ) * dofblur );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.37, 0.15 ) * aspectcorrect ) * dofblur );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.40, 0.0 ) * aspectcorrect ) * dofblur );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.37, -0.15 ) * aspectcorrect ) * dofblur );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.15, 0.37 ) * aspectcorrect ) * dofblur );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.37, 0.15 ) * aspectcorrect ) * dofblur );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.15, -0.37 ) * aspectcorrect ) * dofblur );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.15, 0.37 ) * aspectcorrect ) * dofblur9 );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.37, 0.15 ) * aspectcorrect ) * dofblur9 );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.37, -0.15 ) * aspectcorrect ) * dofblur9 );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur9 );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.15, 0.37 ) * aspectcorrect ) * dofblur9 );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.37, 0.15 ) * aspectcorrect ) * dofblur9 );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur9 );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.15, -0.37 ) * aspectcorrect ) * dofblur9 );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur7 );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.40, 0.0 ) * aspectcorrect ) * dofblur7 );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur7 );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur7 );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur7 );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur7 );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur7 );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur7 );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur4 );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.4, 0.0 ) * aspectcorrect ) * dofblur4 );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur4 );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur4 );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur4 );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur4 );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur4 );\",\n \"\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur4 );\",\n \"\tgl_FragColor = col / 41.0;\",\n \"\tgl_FragColor.a = 1.0;\",\n \"}\"\n ].join(\"\\n\")\n};\nclass BokehPass extends Pass {\n constructor(scene, camera, params) {\n super();\n __publicField(this, \"scene\");\n __publicField(this, \"camera\");\n __publicField(this, \"renderTargetDepth\");\n __publicField(this, \"materialDepth\");\n __publicField(this, \"materialBokeh\");\n __publicField(this, \"fsQuad\");\n __publicField(this, \"_oldClearColor\");\n __publicField(this, \"uniforms\");\n this.scene = scene;\n this.camera = camera;\n const focus = params.focus !== void 0 ? params.focus : 1;\n const aspect = params.aspect !== void 0 ? params.aspect : camera.aspect;\n const aperture = params.aperture !== void 0 ? params.aperture : 0.025;\n const maxblur = params.maxblur !== void 0 ? params.maxblur : 1;\n const width = params.width || window.innerWidth || 1;\n const height = params.height || window.innerHeight || 1;\n this.renderTargetDepth = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(width, height, {\n minFilter: three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter,\n magFilter: three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter\n });\n this.renderTargetDepth.texture.name = \"BokehPass.depth\";\n this.materialDepth = new three__WEBPACK_IMPORTED_MODULE_42__.MeshDepthMaterial();\n this.materialDepth.depthPacking = three__WEBPACK_IMPORTED_MODULE_42__.RGBADepthPacking;\n this.materialDepth.blending = three__WEBPACK_IMPORTED_MODULE_42__.NoBlending;\n if (BokehShader === void 0) {\n console.error(\"BokehPass relies on BokehShader\");\n }\n const bokehShader = BokehShader;\n const bokehUniforms = three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(bokehShader.uniforms);\n bokehUniforms[\"tDepth\"].value = this.renderTargetDepth.texture;\n bokehUniforms[\"focus\"].value = focus;\n bokehUniforms[\"aspect\"].value = aspect;\n bokehUniforms[\"aperture\"].value = aperture;\n bokehUniforms[\"maxblur\"].value = maxblur;\n bokehUniforms[\"nearClip\"].value = camera.near;\n bokehUniforms[\"farClip\"].value = camera.far;\n this.materialBokeh = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n defines: Object.assign({}, bokehShader.defines),\n uniforms: bokehUniforms,\n vertexShader: bokehShader.vertexShader,\n fragmentShader: bokehShader.fragmentShader\n });\n this.uniforms = bokehUniforms;\n this.needsSwap = false;\n this.fsQuad = new FullScreenQuad(this.materialBokeh);\n this._oldClearColor = new three__WEBPACK_IMPORTED_MODULE_42__.Color();\n }\n render(renderer, writeBuffer, readBuffer) {\n this.scene.overrideMaterial = this.materialDepth;\n renderer.getClearColor(this._oldClearColor);\n const oldClearAlpha = renderer.getClearAlpha();\n const oldAutoClear = renderer.autoClear;\n renderer.autoClear = false;\n renderer.setClearColor(16777215);\n renderer.setClearAlpha(1);\n renderer.setRenderTarget(this.renderTargetDepth);\n renderer.clear();\n renderer.render(this.scene, this.camera);\n this.uniforms[\"tColor\"].value = readBuffer.texture;\n this.uniforms[\"nearClip\"].value = this.camera.near;\n this.uniforms[\"farClip\"].value = this.camera.far;\n if (this.renderToScreen) {\n renderer.setRenderTarget(null);\n this.fsQuad.render(renderer);\n } else {\n renderer.setRenderTarget(writeBuffer);\n renderer.clear();\n this.fsQuad.render(renderer);\n }\n this.scene.overrideMaterial = null;\n renderer.setClearColor(this._oldClearColor);\n renderer.setClearAlpha(oldClearAlpha);\n renderer.autoClear = oldAutoClear;\n }\n}\nclass TexturePass extends Pass {\n constructor(map, opacity) {\n super();\n const shader = CopyShader;\n this.map = map;\n this.opacity = opacity !== void 0 ? opacity : 1;\n this.uniforms = three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(shader.uniforms);\n this.material = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: this.uniforms,\n vertexShader: shader.vertexShader,\n fragmentShader: shader.fragmentShader,\n depthTest: false,\n depthWrite: false,\n premultipliedAlpha: true\n });\n this.needsSwap = false;\n this.fsQuad = new FullScreenQuad(null);\n }\n render(renderer, writeBuffer, readBuffer) {\n const oldAutoClear = renderer.autoClear;\n renderer.autoClear = false;\n this.fsQuad.material = this.material;\n this.uniforms[\"opacity\"].value = this.opacity;\n this.uniforms[\"tDiffuse\"].value = this.map;\n this.material.transparent = this.opacity < 1;\n renderer.setRenderTarget(this.renderToScreen ? null : readBuffer);\n if (this.clear)\n renderer.clear();\n this.fsQuad.render(renderer);\n renderer.autoClear = oldAutoClear;\n }\n dispose() {\n this.material.dispose();\n this.fsQuad.dispose();\n }\n}\nconst LuminosityShader = {\n uniforms: {\n tDiffuse: { value: null }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"#include \",\n \"uniform sampler2D tDiffuse;\",\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvec4 texel = texture2D( tDiffuse, vUv );\",\n \"\tfloat l = linearToRelativeLuminance( texel.rgb );\",\n \"\tgl_FragColor = vec4( l, l, l, texel.w );\",\n \"}\"\n ].join(\"\\n\")\n};\nconst ToneMapShader = {\n uniforms: {\n tDiffuse: { value: null },\n averageLuminance: { value: 1 },\n luminanceMap: { value: null },\n maxLuminance: { value: 16 },\n minLuminance: { value: 0.01 },\n middleGrey: { value: 0.6 }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"#include \",\n \"uniform sampler2D tDiffuse;\",\n \"varying vec2 vUv;\",\n \"uniform float middleGrey;\",\n \"uniform float minLuminance;\",\n \"uniform float maxLuminance;\",\n \"#ifdef ADAPTED_LUMINANCE\",\n \"\tuniform sampler2D luminanceMap;\",\n \"#else\",\n \"\tuniform float averageLuminance;\",\n \"#endif\",\n \"vec3 ToneMap( vec3 vColor ) {\",\n \"\t#ifdef ADAPTED_LUMINANCE\",\n // Get the calculated average luminance\n \"\t\tfloat fLumAvg = texture2D(luminanceMap, vec2(0.5, 0.5)).r;\",\n \"\t#else\",\n \"\t\tfloat fLumAvg = averageLuminance;\",\n \"\t#endif\",\n // Calculate the luminance of the current pixel\n \"\tfloat fLumPixel = linearToRelativeLuminance( vColor );\",\n // Apply the modified operator (Eq. 4)\n \"\tfloat fLumScaled = (fLumPixel * middleGrey) / max( minLuminance, fLumAvg );\",\n \"\tfloat fLumCompressed = (fLumScaled * (1.0 + (fLumScaled / (maxLuminance * maxLuminance)))) / (1.0 + fLumScaled);\",\n \"\treturn fLumCompressed * vColor;\",\n \"}\",\n \"void main() {\",\n \"\tvec4 texel = texture2D( tDiffuse, vUv );\",\n \"\tgl_FragColor = vec4( ToneMap( texel.xyz ), texel.w );\",\n \"}\"\n ].join(\"\\n\")\n};\nclass AdaptiveToneMappingPass extends Pass {\n constructor(adaptive, resolution) {\n super();\n this.resolution = resolution !== void 0 ? resolution : 256;\n this.needsInit = true;\n this.adaptive = adaptive !== void 0 ? !!adaptive : true;\n this.luminanceRT = null;\n this.previousLuminanceRT = null;\n this.currentLuminanceRT = null;\n const copyShader = CopyShader;\n this.copyUniforms = three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(copyShader.uniforms);\n this.materialCopy = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: this.copyUniforms,\n vertexShader: copyShader.vertexShader,\n fragmentShader: copyShader.fragmentShader,\n blending: three__WEBPACK_IMPORTED_MODULE_42__.NoBlending,\n depthTest: false\n });\n this.materialLuminance = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(LuminosityShader.uniforms),\n vertexShader: LuminosityShader.vertexShader,\n fragmentShader: LuminosityShader.fragmentShader,\n blending: three__WEBPACK_IMPORTED_MODULE_42__.NoBlending\n });\n this.adaptLuminanceShader = {\n defines: {\n MIP_LEVEL_1X1: (Math.log(this.resolution) / Math.log(2)).toFixed(1)\n },\n uniforms: {\n lastLum: { value: null },\n currentLum: { value: null },\n minLuminance: { value: 0.01 },\n delta: { value: 0.016 },\n tau: { value: 1 }\n },\n vertexShader: `varying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t\t\t}`,\n fragmentShader: `varying vec2 vUv;\n\n\t\t\t\tuniform sampler2D lastLum;\n\t\t\t\tuniform sampler2D currentLum;\n\t\t\t\tuniform float minLuminance;\n\t\t\t\tuniform float delta;\n\t\t\t\tuniform float tau;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec4 lastLum = texture2D( lastLum, vUv, MIP_LEVEL_1X1 );\n\t\t\t\t\tvec4 currentLum = texture2D( currentLum, vUv, MIP_LEVEL_1X1 );\n\n\t\t\t\t\tfloat fLastLum = max( minLuminance, lastLum.r );\n\t\t\t\t\tfloat fCurrentLum = max( minLuminance, currentLum.r );\n\n\t\t\t\t\t//The adaption seems to work better in extreme lighting differences\n\t\t\t\t\t//if the input luminance is squared.\n\t\t\t\t\tfCurrentLum *= fCurrentLum;\n\n\t\t\t\t\t// Adapt the luminance using Pattanaik's technique\n\t\t\t\t\tfloat fAdaptedLum = fLastLum + (fCurrentLum - fLastLum) * (1.0 - exp(-delta * tau));\n\t\t\t\t\t// \"fAdaptedLum = sqrt(fAdaptedLum);\n\t\t\t\t\tgl_FragColor.r = fAdaptedLum;\n\t\t\t\t}`\n };\n this.materialAdaptiveLum = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(this.adaptLuminanceShader.uniforms),\n vertexShader: this.adaptLuminanceShader.vertexShader,\n fragmentShader: this.adaptLuminanceShader.fragmentShader,\n defines: Object.assign({}, this.adaptLuminanceShader.defines),\n blending: three__WEBPACK_IMPORTED_MODULE_42__.NoBlending\n });\n this.materialToneMap = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(ToneMapShader.uniforms),\n vertexShader: ToneMapShader.vertexShader,\n fragmentShader: ToneMapShader.fragmentShader,\n blending: three__WEBPACK_IMPORTED_MODULE_42__.NoBlending\n });\n this.fsQuad = new FullScreenQuad(null);\n }\n render(renderer, writeBuffer, readBuffer, deltaTime) {\n if (this.needsInit) {\n this.reset(renderer);\n this.luminanceRT.texture.type = readBuffer.texture.type;\n this.previousLuminanceRT.texture.type = readBuffer.texture.type;\n this.currentLuminanceRT.texture.type = readBuffer.texture.type;\n this.needsInit = false;\n }\n if (this.adaptive) {\n this.fsQuad.material = this.materialLuminance;\n this.materialLuminance.uniforms.tDiffuse.value = readBuffer.texture;\n renderer.setRenderTarget(this.currentLuminanceRT);\n this.fsQuad.render(renderer);\n this.fsQuad.material = this.materialAdaptiveLum;\n this.materialAdaptiveLum.uniforms.delta.value = deltaTime;\n this.materialAdaptiveLum.uniforms.lastLum.value = this.previousLuminanceRT.texture;\n this.materialAdaptiveLum.uniforms.currentLum.value = this.currentLuminanceRT.texture;\n renderer.setRenderTarget(this.luminanceRT);\n this.fsQuad.render(renderer);\n this.fsQuad.material = this.materialCopy;\n this.copyUniforms.tDiffuse.value = this.luminanceRT.texture;\n renderer.setRenderTarget(this.previousLuminanceRT);\n this.fsQuad.render(renderer);\n }\n this.fsQuad.material = this.materialToneMap;\n this.materialToneMap.uniforms.tDiffuse.value = readBuffer.texture;\n if (this.renderToScreen) {\n renderer.setRenderTarget(null);\n this.fsQuad.render(renderer);\n } else {\n renderer.setRenderTarget(writeBuffer);\n if (this.clear)\n renderer.clear();\n this.fsQuad.render(renderer);\n }\n }\n reset() {\n if (this.luminanceRT) {\n this.luminanceRT.dispose();\n }\n if (this.currentLuminanceRT) {\n this.currentLuminanceRT.dispose();\n }\n if (this.previousLuminanceRT) {\n this.previousLuminanceRT.dispose();\n }\n this.luminanceRT = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(this.resolution, this.resolution);\n this.luminanceRT.texture.name = \"AdaptiveToneMappingPass.l\";\n this.luminanceRT.texture.generateMipmaps = false;\n this.previousLuminanceRT = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(this.resolution, this.resolution);\n this.previousLuminanceRT.texture.name = \"AdaptiveToneMappingPass.pl\";\n this.previousLuminanceRT.texture.generateMipmaps = false;\n const pars = { minFilter: three__WEBPACK_IMPORTED_MODULE_42__.LinearMipmapLinearFilter, generateMipmaps: true };\n this.currentLuminanceRT = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(this.resolution, this.resolution, pars);\n this.currentLuminanceRT.texture.name = \"AdaptiveToneMappingPass.cl\";\n if (this.adaptive) {\n this.materialToneMap.defines[\"ADAPTED_LUMINANCE\"] = \"\";\n this.materialToneMap.uniforms.luminanceMap.value = this.luminanceRT.texture;\n }\n this.fsQuad.material = new three__WEBPACK_IMPORTED_MODULE_42__.MeshBasicMaterial({ color: 7829367 });\n this.materialLuminance.needsUpdate = true;\n this.materialAdaptiveLum.needsUpdate = true;\n this.materialToneMap.needsUpdate = true;\n }\n setAdaptive(adaptive) {\n if (adaptive) {\n this.adaptive = true;\n this.materialToneMap.defines[\"ADAPTED_LUMINANCE\"] = \"\";\n this.materialToneMap.uniforms.luminanceMap.value = this.luminanceRT.texture;\n } else {\n this.adaptive = false;\n delete this.materialToneMap.defines[\"ADAPTED_LUMINANCE\"];\n this.materialToneMap.uniforms.luminanceMap.value = null;\n }\n this.materialToneMap.needsUpdate = true;\n }\n setAdaptionRate(rate) {\n if (rate) {\n this.materialAdaptiveLum.uniforms.tau.value = Math.abs(rate);\n }\n }\n setMinLuminance(minLum) {\n if (minLum) {\n this.materialToneMap.uniforms.minLuminance.value = minLum;\n this.materialAdaptiveLum.uniforms.minLuminance.value = minLum;\n }\n }\n setMaxLuminance(maxLum) {\n if (maxLum) {\n this.materialToneMap.uniforms.maxLuminance.value = maxLum;\n }\n }\n setAverageLuminance(avgLum) {\n if (avgLum) {\n this.materialToneMap.uniforms.averageLuminance.value = avgLum;\n }\n }\n setMiddleGrey(middleGrey) {\n if (middleGrey) {\n this.materialToneMap.uniforms.middleGrey.value = middleGrey;\n }\n }\n dispose() {\n if (this.luminanceRT) {\n this.luminanceRT.dispose();\n }\n if (this.previousLuminanceRT) {\n this.previousLuminanceRT.dispose();\n }\n if (this.currentLuminanceRT) {\n this.currentLuminanceRT.dispose();\n }\n if (this.materialLuminance) {\n this.materialLuminance.dispose();\n }\n if (this.materialAdaptiveLum) {\n this.materialAdaptiveLum.dispose();\n }\n if (this.materialCopy) {\n this.materialCopy.dispose();\n }\n if (this.materialToneMap) {\n this.materialToneMap.dispose();\n }\n }\n}\nconst LuminosityHighPassShader = {\n shaderID: \"luminosityHighPass\",\n uniforms: {\n tDiffuse: { value: null },\n luminosityThreshold: { value: 1 },\n smoothWidth: { value: 1 },\n defaultColor: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Color(0) },\n defaultOpacity: { value: 0 }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform sampler2D tDiffuse;\",\n \"uniform vec3 defaultColor;\",\n \"uniform float defaultOpacity;\",\n \"uniform float luminosityThreshold;\",\n \"uniform float smoothWidth;\",\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvec4 texel = texture2D( tDiffuse, vUv );\",\n \"\tvec3 luma = vec3( 0.299, 0.587, 0.114 );\",\n \"\tfloat v = dot( texel.xyz, luma );\",\n \"\tvec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );\",\n \"\tfloat alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );\",\n \"\tgl_FragColor = mix( outputColor, texel, alpha );\",\n \"}\"\n ].join(\"\\n\")\n};\nconst _UnrealBloomPass = class extends Pass {\n constructor(resolution, strength, radius, threshold) {\n super();\n this.strength = strength !== void 0 ? strength : 1;\n this.radius = radius;\n this.threshold = threshold;\n this.resolution = resolution !== void 0 ? new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(resolution.x, resolution.y) : new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(256, 256);\n this.clearColor = new three__WEBPACK_IMPORTED_MODULE_42__.Color(0, 0, 0);\n this.renderTargetsHorizontal = [];\n this.renderTargetsVertical = [];\n this.nMips = 5;\n let resx = Math.round(this.resolution.x / 2);\n let resy = Math.round(this.resolution.y / 2);\n this.renderTargetBright = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(resx, resy, { type: three__WEBPACK_IMPORTED_MODULE_42__.HalfFloatType });\n this.renderTargetBright.texture.name = \"UnrealBloomPass.bright\";\n this.renderTargetBright.texture.generateMipmaps = false;\n for (let i2 = 0; i2 < this.nMips; i2++) {\n const renderTargetHorizonal = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(resx, resy, { type: three__WEBPACK_IMPORTED_MODULE_42__.HalfFloatType });\n renderTargetHorizonal.texture.name = \"UnrealBloomPass.h\" + i2;\n renderTargetHorizonal.texture.generateMipmaps = false;\n this.renderTargetsHorizontal.push(renderTargetHorizonal);\n const renderTargetVertical = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(resx, resy, { type: three__WEBPACK_IMPORTED_MODULE_42__.HalfFloatType });\n renderTargetVertical.texture.name = \"UnrealBloomPass.v\" + i2;\n renderTargetVertical.texture.generateMipmaps = false;\n this.renderTargetsVertical.push(renderTargetVertical);\n resx = Math.round(resx / 2);\n resy = Math.round(resy / 2);\n }\n const highPassShader = LuminosityHighPassShader;\n this.highPassUniforms = three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(highPassShader.uniforms);\n this.highPassUniforms[\"luminosityThreshold\"].value = threshold;\n this.highPassUniforms[\"smoothWidth\"].value = 0.01;\n this.materialHighPassFilter = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: this.highPassUniforms,\n vertexShader: highPassShader.vertexShader,\n fragmentShader: highPassShader.fragmentShader,\n defines: {}\n });\n this.separableBlurMaterials = [];\n const kernelSizeArray = [3, 5, 7, 9, 11];\n resx = Math.round(this.resolution.x / 2);\n resy = Math.round(this.resolution.y / 2);\n for (let i2 = 0; i2 < this.nMips; i2++) {\n this.separableBlurMaterials.push(this.getSeperableBlurMaterial(kernelSizeArray[i2]));\n this.separableBlurMaterials[i2].uniforms[\"texSize\"].value = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(resx, resy);\n resx = Math.round(resx / 2);\n resy = Math.round(resy / 2);\n }\n this.compositeMaterial = this.getCompositeMaterial(this.nMips);\n this.compositeMaterial.uniforms[\"blurTexture1\"].value = this.renderTargetsVertical[0].texture;\n this.compositeMaterial.uniforms[\"blurTexture2\"].value = this.renderTargetsVertical[1].texture;\n this.compositeMaterial.uniforms[\"blurTexture3\"].value = this.renderTargetsVertical[2].texture;\n this.compositeMaterial.uniforms[\"blurTexture4\"].value = this.renderTargetsVertical[3].texture;\n this.compositeMaterial.uniforms[\"blurTexture5\"].value = this.renderTargetsVertical[4].texture;\n this.compositeMaterial.uniforms[\"bloomStrength\"].value = strength;\n this.compositeMaterial.uniforms[\"bloomRadius\"].value = 0.1;\n this.compositeMaterial.needsUpdate = true;\n const bloomFactors = [1, 0.8, 0.6, 0.4, 0.2];\n this.compositeMaterial.uniforms[\"bloomFactors\"].value = bloomFactors;\n this.bloomTintColors = [\n new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(1, 1, 1),\n new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(1, 1, 1),\n new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(1, 1, 1),\n new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(1, 1, 1),\n new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(1, 1, 1)\n ];\n this.compositeMaterial.uniforms[\"bloomTintColors\"].value = this.bloomTintColors;\n const copyShader = CopyShader;\n this.copyUniforms = three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(copyShader.uniforms);\n this.copyUniforms[\"opacity\"].value = 1;\n this.materialCopy = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: this.copyUniforms,\n vertexShader: copyShader.vertexShader,\n fragmentShader: copyShader.fragmentShader,\n blending: three__WEBPACK_IMPORTED_MODULE_42__.AdditiveBlending,\n depthTest: false,\n depthWrite: false,\n transparent: true\n });\n this.enabled = true;\n this.needsSwap = false;\n this._oldClearColor = new three__WEBPACK_IMPORTED_MODULE_42__.Color();\n this.oldClearAlpha = 1;\n this.basic = new three__WEBPACK_IMPORTED_MODULE_42__.MeshBasicMaterial();\n this.fsQuad = new FullScreenQuad(null);\n }\n dispose() {\n for (let i2 = 0; i2 < this.renderTargetsHorizontal.length; i2++) {\n this.renderTargetsHorizontal[i2].dispose();\n }\n for (let i2 = 0; i2 < this.renderTargetsVertical.length; i2++) {\n this.renderTargetsVertical[i2].dispose();\n }\n this.renderTargetBright.dispose();\n for (let i2 = 0; i2 < this.separableBlurMaterials.length; i2++) {\n this.separableBlurMaterials[i2].dispose();\n }\n this.compositeMaterial.dispose();\n this.materialCopy.dispose();\n this.basic.dispose();\n this.fsQuad.dispose();\n }\n setSize(width, height) {\n let resx = Math.round(width / 2);\n let resy = Math.round(height / 2);\n this.renderTargetBright.setSize(resx, resy);\n for (let i2 = 0; i2 < this.nMips; i2++) {\n this.renderTargetsHorizontal[i2].setSize(resx, resy);\n this.renderTargetsVertical[i2].setSize(resx, resy);\n this.separableBlurMaterials[i2].uniforms[\"texSize\"].value = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(resx, resy);\n resx = Math.round(resx / 2);\n resy = Math.round(resy / 2);\n }\n }\n render(renderer, writeBuffer, readBuffer, deltaTime, maskActive) {\n renderer.getClearColor(this._oldClearColor);\n this.oldClearAlpha = renderer.getClearAlpha();\n const oldAutoClear = renderer.autoClear;\n renderer.autoClear = false;\n renderer.setClearColor(this.clearColor, 0);\n if (maskActive)\n renderer.state.buffers.stencil.setTest(false);\n if (this.renderToScreen) {\n this.fsQuad.material = this.basic;\n this.basic.map = readBuffer.texture;\n renderer.setRenderTarget(null);\n renderer.clear();\n this.fsQuad.render(renderer);\n }\n this.highPassUniforms[\"tDiffuse\"].value = readBuffer.texture;\n this.highPassUniforms[\"luminosityThreshold\"].value = this.threshold;\n this.fsQuad.material = this.materialHighPassFilter;\n renderer.setRenderTarget(this.renderTargetBright);\n renderer.clear();\n this.fsQuad.render(renderer);\n let inputRenderTarget = this.renderTargetBright;\n for (let i2 = 0; i2 < this.nMips; i2++) {\n this.fsQuad.material = this.separableBlurMaterials[i2];\n this.separableBlurMaterials[i2].uniforms[\"colorTexture\"].value = inputRenderTarget.texture;\n this.separableBlurMaterials[i2].uniforms[\"direction\"].value = _UnrealBloomPass.BlurDirectionX;\n renderer.setRenderTarget(this.renderTargetsHorizontal[i2]);\n renderer.clear();\n this.fsQuad.render(renderer);\n this.separableBlurMaterials[i2].uniforms[\"colorTexture\"].value = this.renderTargetsHorizontal[i2].texture;\n this.separableBlurMaterials[i2].uniforms[\"direction\"].value = _UnrealBloomPass.BlurDirectionY;\n renderer.setRenderTarget(this.renderTargetsVertical[i2]);\n renderer.clear();\n this.fsQuad.render(renderer);\n inputRenderTarget = this.renderTargetsVertical[i2];\n }\n this.fsQuad.material = this.compositeMaterial;\n this.compositeMaterial.uniforms[\"bloomStrength\"].value = this.strength;\n this.compositeMaterial.uniforms[\"bloomRadius\"].value = this.radius;\n this.compositeMaterial.uniforms[\"bloomTintColors\"].value = this.bloomTintColors;\n renderer.setRenderTarget(this.renderTargetsHorizontal[0]);\n renderer.clear();\n this.fsQuad.render(renderer);\n this.fsQuad.material = this.materialCopy;\n this.copyUniforms[\"tDiffuse\"].value = this.renderTargetsHorizontal[0].texture;\n if (maskActive)\n renderer.state.buffers.stencil.setTest(true);\n if (this.renderToScreen) {\n renderer.setRenderTarget(null);\n this.fsQuad.render(renderer);\n } else {\n renderer.setRenderTarget(readBuffer);\n this.fsQuad.render(renderer);\n }\n renderer.setClearColor(this._oldClearColor, this.oldClearAlpha);\n renderer.autoClear = oldAutoClear;\n }\n getSeperableBlurMaterial(kernelRadius) {\n return new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n defines: {\n KERNEL_RADIUS: kernelRadius,\n SIGMA: kernelRadius\n },\n uniforms: {\n colorTexture: { value: null },\n texSize: { value: new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(0.5, 0.5) },\n direction: { value: new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(0.5, 0.5) }\n },\n vertexShader: `varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}`,\n fragmentShader: `#include \n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec2 direction;\n\n\t\t\t\tfloat gaussianPdf(in float x, in float sigma) {\n\t\t\t\t\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\n\t\t\t\t}\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tfloat fSigma = float(SIGMA);\n\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, fSigma);\n\t\t\t\t\tvec3 diffuseSum = texture2D( colorTexture, vUv).rgb * weightSum;\n\t\t\t\t\tfor( int i = 1; i < KERNEL_RADIUS; i ++ ) {\n\t\t\t\t\t\tfloat x = float(i);\n\t\t\t\t\t\tfloat w = gaussianPdf(x, fSigma);\n\t\t\t\t\t\tvec2 uvOffset = direction * invSize * x;\n\t\t\t\t\t\tvec3 sample1 = texture2D( colorTexture, vUv + uvOffset).rgb;\n\t\t\t\t\t\tvec3 sample2 = texture2D( colorTexture, vUv - uvOffset).rgb;\n\t\t\t\t\t\tdiffuseSum += (sample1 + sample2) * w;\n\t\t\t\t\t\tweightSum += 2.0 * w;\n\t\t\t\t\t}\n\t\t\t\t\tgl_FragColor = vec4(diffuseSum/weightSum, 1.0);\n\t\t\t\t}`\n });\n }\n getCompositeMaterial(nMips) {\n return new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n defines: {\n NUM_MIPS: nMips\n },\n uniforms: {\n blurTexture1: { value: null },\n blurTexture2: { value: null },\n blurTexture3: { value: null },\n blurTexture4: { value: null },\n blurTexture5: { value: null },\n bloomStrength: { value: 1 },\n bloomFactors: { value: null },\n bloomTintColors: { value: null },\n bloomRadius: { value: 0 }\n },\n vertexShader: `varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}`,\n fragmentShader: `varying vec2 vUv;\n\t\t\t\tuniform sampler2D blurTexture1;\n\t\t\t\tuniform sampler2D blurTexture2;\n\t\t\t\tuniform sampler2D blurTexture3;\n\t\t\t\tuniform sampler2D blurTexture4;\n\t\t\t\tuniform sampler2D blurTexture5;\n\t\t\t\tuniform float bloomStrength;\n\t\t\t\tuniform float bloomRadius;\n\t\t\t\tuniform float bloomFactors[NUM_MIPS];\n\t\t\t\tuniform vec3 bloomTintColors[NUM_MIPS];\n\n\t\t\t\tfloat lerpBloomFactor(const in float factor) {\n\t\t\t\t\tfloat mirrorFactor = 1.2 - factor;\n\t\t\t\t\treturn mix(factor, mirrorFactor, bloomRadius);\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tgl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );\n\t\t\t\t}`\n });\n }\n};\nlet UnrealBloomPass = _UnrealBloomPass;\n__publicField(UnrealBloomPass, \"BlurDirectionX\", /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(1, 0));\n__publicField(UnrealBloomPass, \"BlurDirectionY\", /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(0, 1));\nclass CubeTexturePass extends Pass {\n constructor(camera, tCube, opacity = 1) {\n super();\n this.camera = camera;\n this.needsSwap = false;\n this.cubeShader = three__WEBPACK_IMPORTED_MODULE_42__.ShaderLib[\"cube\"];\n this.cubeMesh = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(\n new three__WEBPACK_IMPORTED_MODULE_42__.BoxGeometry(10, 10, 10),\n new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(this.cubeShader.uniforms),\n vertexShader: this.cubeShader.vertexShader,\n fragmentShader: this.cubeShader.fragmentShader,\n depthTest: false,\n depthWrite: false,\n side: three__WEBPACK_IMPORTED_MODULE_42__.BackSide\n })\n );\n Object.defineProperty(this.cubeMesh.material, \"envMap\", {\n get: function() {\n return this.uniforms.tCube.value;\n }\n });\n this.tCube = tCube;\n this.opacity = opacity;\n this.cubeScene = new three__WEBPACK_IMPORTED_MODULE_42__.Scene();\n this.cubeCamera = new three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera();\n this.cubeScene.add(this.cubeMesh);\n }\n render(renderer, writeBuffer, readBuffer) {\n const oldAutoClear = renderer.autoClear;\n renderer.autoClear = false;\n this.cubeCamera.projectionMatrix.copy(this.camera.projectionMatrix);\n this.cubeCamera.quaternion.setFromRotationMatrix(this.camera.matrixWorld);\n this.cubeMesh.material.uniforms.tCube.value = this.tCube;\n this.cubeMesh.material.uniforms.tFlip.value = this.tCube.isCubeTexture && this.tCube.isRenderTargetTexture === false ? -1 : 1;\n this.cubeMesh.material.uniforms.opacity.value = this.opacity;\n this.cubeMesh.material.transparent = this.opacity < 1;\n renderer.setRenderTarget(this.renderToScreen ? null : readBuffer);\n if (this.clear)\n renderer.clear();\n renderer.render(this.cubeScene, this.cubeCamera);\n renderer.autoClear = oldAutoClear;\n }\n dispose() {\n this.cubeMesh.geometry.dispose();\n this.cubeMesh.material.dispose();\n }\n}\nconst SAOShader = {\n defines: {\n NUM_SAMPLES: 7,\n NUM_RINGS: 4,\n NORMAL_TEXTURE: 0,\n DIFFUSE_TEXTURE: 0,\n DEPTH_PACKING: 1,\n PERSPECTIVE_CAMERA: 1\n },\n uniforms: {\n tDepth: { value: null },\n tDiffuse: { value: null },\n tNormal: { value: null },\n size: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(512, 512) },\n cameraNear: { value: 1 },\n cameraFar: { value: 100 },\n cameraProjectionMatrix: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4() },\n cameraInverseProjectionMatrix: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4() },\n scale: { value: 1 },\n intensity: { value: 0.1 },\n bias: { value: 0.5 },\n minResolution: { value: 0 },\n kernelRadius: { value: 100 },\n randomSeed: { value: 0 }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"#include \",\n \"varying vec2 vUv;\",\n \"#if DIFFUSE_TEXTURE == 1\",\n \"uniform sampler2D tDiffuse;\",\n \"#endif\",\n \"uniform sampler2D tDepth;\",\n \"#if NORMAL_TEXTURE == 1\",\n \"uniform sampler2D tNormal;\",\n \"#endif\",\n \"uniform float cameraNear;\",\n \"uniform float cameraFar;\",\n \"uniform mat4 cameraProjectionMatrix;\",\n \"uniform mat4 cameraInverseProjectionMatrix;\",\n \"uniform float scale;\",\n \"uniform float intensity;\",\n \"uniform float bias;\",\n \"uniform float kernelRadius;\",\n \"uniform float minResolution;\",\n \"uniform vec2 size;\",\n \"uniform float randomSeed;\",\n \"// RGBA depth\",\n \"#include \",\n \"vec4 getDefaultColor( const in vec2 screenPosition ) {\",\n \"\t#if DIFFUSE_TEXTURE == 1\",\n \"\treturn texture2D( tDiffuse, vUv );\",\n \"\t#else\",\n \"\treturn vec4( 1.0 );\",\n \"\t#endif\",\n \"}\",\n \"float getDepth( const in vec2 screenPosition ) {\",\n \"\t#if DEPTH_PACKING == 1\",\n \"\treturn unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );\",\n \"\t#else\",\n \"\treturn texture2D( tDepth, screenPosition ).x;\",\n \"\t#endif\",\n \"}\",\n \"float getViewZ( const in float depth ) {\",\n \"\t#if PERSPECTIVE_CAMERA == 1\",\n \"\treturn perspectiveDepthToViewZ( depth, cameraNear, cameraFar );\",\n \"\t#else\",\n \"\treturn orthographicDepthToViewZ( depth, cameraNear, cameraFar );\",\n \"\t#endif\",\n \"}\",\n \"vec3 getViewPosition( const in vec2 screenPosition, const in float depth, const in float viewZ ) {\",\n \"\tfloat clipW = cameraProjectionMatrix[2][3] * viewZ + cameraProjectionMatrix[3][3];\",\n \"\tvec4 clipPosition = vec4( ( vec3( screenPosition, depth ) - 0.5 ) * 2.0, 1.0 );\",\n \"\tclipPosition *= clipW; // unprojection.\",\n \"\treturn ( cameraInverseProjectionMatrix * clipPosition ).xyz;\",\n \"}\",\n \"vec3 getViewNormal( const in vec3 viewPosition, const in vec2 screenPosition ) {\",\n \"\t#if NORMAL_TEXTURE == 1\",\n \"\treturn unpackRGBToNormal( texture2D( tNormal, screenPosition ).xyz );\",\n \"\t#else\",\n \"\treturn normalize( cross( dFdx( viewPosition ), dFdy( viewPosition ) ) );\",\n \"\t#endif\",\n \"}\",\n \"float scaleDividedByCameraFar;\",\n \"float minResolutionMultipliedByCameraFar;\",\n \"float getOcclusion( const in vec3 centerViewPosition, const in vec3 centerViewNormal, const in vec3 sampleViewPosition ) {\",\n \"\tvec3 viewDelta = sampleViewPosition - centerViewPosition;\",\n \"\tfloat viewDistance = length( viewDelta );\",\n \"\tfloat scaledScreenDistance = scaleDividedByCameraFar * viewDistance;\",\n \"\treturn max(0.0, (dot(centerViewNormal, viewDelta) - minResolutionMultipliedByCameraFar) / scaledScreenDistance - bias) / (1.0 + pow2( scaledScreenDistance ) );\",\n \"}\",\n \"// moving costly divides into consts\",\n \"const float ANGLE_STEP = PI2 * float( NUM_RINGS ) / float( NUM_SAMPLES );\",\n \"const float INV_NUM_SAMPLES = 1.0 / float( NUM_SAMPLES );\",\n \"float getAmbientOcclusion( const in vec3 centerViewPosition ) {\",\n \"\t// precompute some variables require in getOcclusion.\",\n \"\tscaleDividedByCameraFar = scale / cameraFar;\",\n \"\tminResolutionMultipliedByCameraFar = minResolution * cameraFar;\",\n \"\tvec3 centerViewNormal = getViewNormal( centerViewPosition, vUv );\",\n \"\t// jsfiddle that shows sample pattern: https://jsfiddle.net/a16ff1p7/\",\n \"\tfloat angle = rand( vUv + randomSeed ) * PI2;\",\n \"\tvec2 radius = vec2( kernelRadius * INV_NUM_SAMPLES ) / size;\",\n \"\tvec2 radiusStep = radius;\",\n \"\tfloat occlusionSum = 0.0;\",\n \"\tfloat weightSum = 0.0;\",\n \"\tfor( int i = 0; i < NUM_SAMPLES; i ++ ) {\",\n \"\t\tvec2 sampleUv = vUv + vec2( cos( angle ), sin( angle ) ) * radius;\",\n \"\t\tradius += radiusStep;\",\n \"\t\tangle += ANGLE_STEP;\",\n \"\t\tfloat sampleDepth = getDepth( sampleUv );\",\n \"\t\tif( sampleDepth >= ( 1.0 - EPSILON ) ) {\",\n \"\t\t\tcontinue;\",\n \"\t\t}\",\n \"\t\tfloat sampleViewZ = getViewZ( sampleDepth );\",\n \"\t\tvec3 sampleViewPosition = getViewPosition( sampleUv, sampleDepth, sampleViewZ );\",\n \"\t\tocclusionSum += getOcclusion( centerViewPosition, centerViewNormal, sampleViewPosition );\",\n \"\t\tweightSum += 1.0;\",\n \"\t}\",\n \"\tif( weightSum == 0.0 ) discard;\",\n \"\treturn occlusionSum * ( intensity / weightSum );\",\n \"}\",\n \"void main() {\",\n \"\tfloat centerDepth = getDepth( vUv );\",\n \"\tif( centerDepth >= ( 1.0 - EPSILON ) ) {\",\n \"\t\tdiscard;\",\n \"\t}\",\n \"\tfloat centerViewZ = getViewZ( centerDepth );\",\n \"\tvec3 viewPosition = getViewPosition( vUv, centerDepth, centerViewZ );\",\n \"\tfloat ambientOcclusion = getAmbientOcclusion( viewPosition );\",\n \"\tgl_FragColor = getDefaultColor( vUv );\",\n \"\tgl_FragColor.xyz *= 1.0 - ambientOcclusion;\",\n \"}\"\n ].join(\"\\n\")\n};\nconst DepthLimitedBlurShader = {\n defines: {\n KERNEL_RADIUS: 4,\n DEPTH_PACKING: 1,\n PERSPECTIVE_CAMERA: 1\n },\n uniforms: {\n tDiffuse: { value: null },\n size: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(512, 512) },\n sampleUvOffsets: { value: [/* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(0, 0)] },\n sampleWeights: { value: [1] },\n tDepth: { value: null },\n cameraNear: { value: 10 },\n cameraFar: { value: 1e3 },\n depthCutoff: { value: 10 }\n },\n vertexShader: [\n \"#include \",\n \"uniform vec2 size;\",\n \"varying vec2 vUv;\",\n \"varying vec2 vInvSize;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tvInvSize = 1.0 / size;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"#include \",\n \"#include \",\n \"uniform sampler2D tDiffuse;\",\n \"uniform sampler2D tDepth;\",\n \"uniform float cameraNear;\",\n \"uniform float cameraFar;\",\n \"uniform float depthCutoff;\",\n \"uniform vec2 sampleUvOffsets[ KERNEL_RADIUS + 1 ];\",\n \"uniform float sampleWeights[ KERNEL_RADIUS + 1 ];\",\n \"varying vec2 vUv;\",\n \"varying vec2 vInvSize;\",\n \"float getDepth( const in vec2 screenPosition ) {\",\n \"\t#if DEPTH_PACKING == 1\",\n \"\treturn unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );\",\n \"\t#else\",\n \"\treturn texture2D( tDepth, screenPosition ).x;\",\n \"\t#endif\",\n \"}\",\n \"float getViewZ( const in float depth ) {\",\n \"\t#if PERSPECTIVE_CAMERA == 1\",\n \"\treturn perspectiveDepthToViewZ( depth, cameraNear, cameraFar );\",\n \"\t#else\",\n \"\treturn orthographicDepthToViewZ( depth, cameraNear, cameraFar );\",\n \"\t#endif\",\n \"}\",\n \"void main() {\",\n \"\tfloat depth = getDepth( vUv );\",\n \"\tif( depth >= ( 1.0 - EPSILON ) ) {\",\n \"\t\tdiscard;\",\n \"\t}\",\n \"\tfloat centerViewZ = -getViewZ( depth );\",\n \"\tbool rBreak = false, lBreak = false;\",\n \"\tfloat weightSum = sampleWeights[0];\",\n \"\tvec4 diffuseSum = texture2D( tDiffuse, vUv ) * weightSum;\",\n \"\tfor( int i = 1; i <= KERNEL_RADIUS; i ++ ) {\",\n \"\t\tfloat sampleWeight = sampleWeights[i];\",\n \"\t\tvec2 sampleUvOffset = sampleUvOffsets[i] * vInvSize;\",\n \"\t\tvec2 sampleUv = vUv + sampleUvOffset;\",\n \"\t\tfloat viewZ = -getViewZ( getDepth( sampleUv ) );\",\n \"\t\tif( abs( viewZ - centerViewZ ) > depthCutoff ) rBreak = true;\",\n \"\t\tif( ! rBreak ) {\",\n \"\t\t\tdiffuseSum += texture2D( tDiffuse, sampleUv ) * sampleWeight;\",\n \"\t\t\tweightSum += sampleWeight;\",\n \"\t\t}\",\n \"\t\tsampleUv = vUv - sampleUvOffset;\",\n \"\t\tviewZ = -getViewZ( getDepth( sampleUv ) );\",\n \"\t\tif( abs( viewZ - centerViewZ ) > depthCutoff ) lBreak = true;\",\n \"\t\tif( ! lBreak ) {\",\n \"\t\t\tdiffuseSum += texture2D( tDiffuse, sampleUv ) * sampleWeight;\",\n \"\t\t\tweightSum += sampleWeight;\",\n \"\t\t}\",\n \"\t}\",\n \"\tgl_FragColor = diffuseSum / weightSum;\",\n \"}\"\n ].join(\"\\n\")\n};\nconst BlurShaderUtils = {\n createSampleWeights: (kernelRadius, stdDev) => {\n const gaussian = (x, stdDev2) => {\n return Math.exp(-(x * x) / (2 * (stdDev2 * stdDev2))) / (Math.sqrt(2 * Math.PI) * stdDev2);\n };\n const weights = [];\n for (let i2 = 0; i2 <= kernelRadius; i2++) {\n weights.push(gaussian(i2, stdDev));\n }\n return weights;\n },\n createSampleOffsets: (kernelRadius, uvIncrement) => {\n const offsets = [];\n for (let i2 = 0; i2 <= kernelRadius; i2++) {\n offsets.push(uvIncrement.clone().multiplyScalar(i2));\n }\n return offsets;\n },\n configure: (shader, kernelRadius, stdDev, uvIncrement) => {\n shader.defines[\"KERNEL_RADIUS\"] = kernelRadius;\n shader.uniforms[\"sampleUvOffsets\"].value = BlurShaderUtils.createSampleOffsets(kernelRadius, uvIncrement);\n shader.uniforms[\"sampleWeights\"].value = BlurShaderUtils.createSampleWeights(kernelRadius, stdDev);\n shader.needsUpdate = true;\n }\n};\nclass SAOPass extends Pass {\n constructor(scene, camera, useDepthTexture = false, useNormals = false, resolution = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(256, 256)) {\n super();\n this.scene = scene;\n this.camera = camera;\n this.clear = true;\n this.needsSwap = false;\n this.supportsDepthTextureExtension = useDepthTexture;\n this.supportsNormalTexture = useNormals;\n this.originalClearColor = new three__WEBPACK_IMPORTED_MODULE_42__.Color();\n this._oldClearColor = new three__WEBPACK_IMPORTED_MODULE_42__.Color();\n this.oldClearAlpha = 1;\n this.params = {\n output: 0,\n saoBias: 0.5,\n saoIntensity: 0.18,\n saoScale: 1,\n saoKernelRadius: 100,\n saoMinResolution: 0,\n saoBlur: true,\n saoBlurRadius: 8,\n saoBlurStdDev: 4,\n saoBlurDepthCutoff: 0.01\n };\n this.resolution = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(resolution.x, resolution.y);\n this.saoRenderTarget = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(this.resolution.x, this.resolution.y, { type: three__WEBPACK_IMPORTED_MODULE_42__.HalfFloatType });\n this.blurIntermediateRenderTarget = this.saoRenderTarget.clone();\n this.beautyRenderTarget = this.saoRenderTarget.clone();\n this.normalRenderTarget = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(this.resolution.x, this.resolution.y, {\n minFilter: three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter,\n magFilter: three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter,\n type: three__WEBPACK_IMPORTED_MODULE_42__.HalfFloatType\n });\n this.depthRenderTarget = this.normalRenderTarget.clone();\n let depthTexture;\n if (this.supportsDepthTextureExtension) {\n depthTexture = new three__WEBPACK_IMPORTED_MODULE_42__.DepthTexture();\n depthTexture.type = three__WEBPACK_IMPORTED_MODULE_42__.UnsignedShortType;\n this.beautyRenderTarget.depthTexture = depthTexture;\n this.beautyRenderTarget.depthBuffer = true;\n }\n this.depthMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.MeshDepthMaterial();\n this.depthMaterial.depthPacking = three__WEBPACK_IMPORTED_MODULE_42__.RGBADepthPacking;\n this.depthMaterial.blending = three__WEBPACK_IMPORTED_MODULE_42__.NoBlending;\n this.normalMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.MeshNormalMaterial();\n this.normalMaterial.blending = three__WEBPACK_IMPORTED_MODULE_42__.NoBlending;\n this.saoMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n defines: Object.assign({}, SAOShader.defines),\n fragmentShader: SAOShader.fragmentShader,\n vertexShader: SAOShader.vertexShader,\n uniforms: three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(SAOShader.uniforms)\n });\n this.saoMaterial.extensions.derivatives = true;\n this.saoMaterial.defines[\"DEPTH_PACKING\"] = this.supportsDepthTextureExtension ? 0 : 1;\n this.saoMaterial.defines[\"NORMAL_TEXTURE\"] = this.supportsNormalTexture ? 1 : 0;\n this.saoMaterial.defines[\"PERSPECTIVE_CAMERA\"] = this.camera.isPerspectiveCamera ? 1 : 0;\n this.saoMaterial.uniforms[\"tDepth\"].value = this.supportsDepthTextureExtension ? depthTexture : this.depthRenderTarget.texture;\n this.saoMaterial.uniforms[\"tNormal\"].value = this.normalRenderTarget.texture;\n this.saoMaterial.uniforms[\"size\"].value.set(this.resolution.x, this.resolution.y);\n this.saoMaterial.uniforms[\"cameraInverseProjectionMatrix\"].value.copy(this.camera.projectionMatrixInverse);\n this.saoMaterial.uniforms[\"cameraProjectionMatrix\"].value = this.camera.projectionMatrix;\n this.saoMaterial.blending = three__WEBPACK_IMPORTED_MODULE_42__.NoBlending;\n this.vBlurMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(DepthLimitedBlurShader.uniforms),\n defines: Object.assign({}, DepthLimitedBlurShader.defines),\n vertexShader: DepthLimitedBlurShader.vertexShader,\n fragmentShader: DepthLimitedBlurShader.fragmentShader\n });\n this.vBlurMaterial.defines[\"DEPTH_PACKING\"] = this.supportsDepthTextureExtension ? 0 : 1;\n this.vBlurMaterial.defines[\"PERSPECTIVE_CAMERA\"] = this.camera.isPerspectiveCamera ? 1 : 0;\n this.vBlurMaterial.uniforms[\"tDiffuse\"].value = this.saoRenderTarget.texture;\n this.vBlurMaterial.uniforms[\"tDepth\"].value = this.supportsDepthTextureExtension ? depthTexture : this.depthRenderTarget.texture;\n this.vBlurMaterial.uniforms[\"size\"].value.set(this.resolution.x, this.resolution.y);\n this.vBlurMaterial.blending = three__WEBPACK_IMPORTED_MODULE_42__.NoBlending;\n this.hBlurMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(DepthLimitedBlurShader.uniforms),\n defines: Object.assign({}, DepthLimitedBlurShader.defines),\n vertexShader: DepthLimitedBlurShader.vertexShader,\n fragmentShader: DepthLimitedBlurShader.fragmentShader\n });\n this.hBlurMaterial.defines[\"DEPTH_PACKING\"] = this.supportsDepthTextureExtension ? 0 : 1;\n this.hBlurMaterial.defines[\"PERSPECTIVE_CAMERA\"] = this.camera.isPerspectiveCamera ? 1 : 0;\n this.hBlurMaterial.uniforms[\"tDiffuse\"].value = this.blurIntermediateRenderTarget.texture;\n this.hBlurMaterial.uniforms[\"tDepth\"].value = this.supportsDepthTextureExtension ? depthTexture : this.depthRenderTarget.texture;\n this.hBlurMaterial.uniforms[\"size\"].value.set(this.resolution.x, this.resolution.y);\n this.hBlurMaterial.blending = three__WEBPACK_IMPORTED_MODULE_42__.NoBlending;\n this.materialCopy = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(CopyShader.uniforms),\n vertexShader: CopyShader.vertexShader,\n fragmentShader: CopyShader.fragmentShader,\n blending: three__WEBPACK_IMPORTED_MODULE_42__.NoBlending\n });\n this.materialCopy.transparent = true;\n this.materialCopy.depthTest = false;\n this.materialCopy.depthWrite = false;\n this.materialCopy.blending = three__WEBPACK_IMPORTED_MODULE_42__.CustomBlending;\n this.materialCopy.blendSrc = three__WEBPACK_IMPORTED_MODULE_42__.DstColorFactor;\n this.materialCopy.blendDst = three__WEBPACK_IMPORTED_MODULE_42__.ZeroFactor;\n this.materialCopy.blendEquation = three__WEBPACK_IMPORTED_MODULE_42__.AddEquation;\n this.materialCopy.blendSrcAlpha = three__WEBPACK_IMPORTED_MODULE_42__.DstAlphaFactor;\n this.materialCopy.blendDstAlpha = three__WEBPACK_IMPORTED_MODULE_42__.ZeroFactor;\n this.materialCopy.blendEquationAlpha = three__WEBPACK_IMPORTED_MODULE_42__.AddEquation;\n this.depthCopy = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(UnpackDepthRGBAShader.uniforms),\n vertexShader: UnpackDepthRGBAShader.vertexShader,\n fragmentShader: UnpackDepthRGBAShader.fragmentShader,\n blending: three__WEBPACK_IMPORTED_MODULE_42__.NoBlending\n });\n this.fsQuad = new FullScreenQuad(null);\n }\n render(renderer, writeBuffer, readBuffer) {\n if (this.renderToScreen) {\n this.materialCopy.blending = three__WEBPACK_IMPORTED_MODULE_42__.NoBlending;\n this.materialCopy.uniforms[\"tDiffuse\"].value = readBuffer.texture;\n this.materialCopy.needsUpdate = true;\n this.renderPass(renderer, this.materialCopy, null);\n }\n if (this.params.output === 1) {\n return;\n }\n renderer.getClearColor(this._oldClearColor);\n this.oldClearAlpha = renderer.getClearAlpha();\n const oldAutoClear = renderer.autoClear;\n renderer.autoClear = false;\n renderer.setRenderTarget(this.depthRenderTarget);\n renderer.clear();\n this.saoMaterial.uniforms[\"bias\"].value = this.params.saoBias;\n this.saoMaterial.uniforms[\"intensity\"].value = this.params.saoIntensity;\n this.saoMaterial.uniforms[\"scale\"].value = this.params.saoScale;\n this.saoMaterial.uniforms[\"kernelRadius\"].value = this.params.saoKernelRadius;\n this.saoMaterial.uniforms[\"minResolution\"].value = this.params.saoMinResolution;\n this.saoMaterial.uniforms[\"cameraNear\"].value = this.camera.near;\n this.saoMaterial.uniforms[\"cameraFar\"].value = this.camera.far;\n const depthCutoff = this.params.saoBlurDepthCutoff * (this.camera.far - this.camera.near);\n this.vBlurMaterial.uniforms[\"depthCutoff\"].value = depthCutoff;\n this.hBlurMaterial.uniforms[\"depthCutoff\"].value = depthCutoff;\n this.vBlurMaterial.uniforms[\"cameraNear\"].value = this.camera.near;\n this.vBlurMaterial.uniforms[\"cameraFar\"].value = this.camera.far;\n this.hBlurMaterial.uniforms[\"cameraNear\"].value = this.camera.near;\n this.hBlurMaterial.uniforms[\"cameraFar\"].value = this.camera.far;\n this.params.saoBlurRadius = Math.floor(this.params.saoBlurRadius);\n if (this.prevStdDev !== this.params.saoBlurStdDev || this.prevNumSamples !== this.params.saoBlurRadius) {\n BlurShaderUtils.configure(\n this.vBlurMaterial,\n this.params.saoBlurRadius,\n this.params.saoBlurStdDev,\n new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(0, 1)\n );\n BlurShaderUtils.configure(\n this.hBlurMaterial,\n this.params.saoBlurRadius,\n this.params.saoBlurStdDev,\n new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(1, 0)\n );\n this.prevStdDev = this.params.saoBlurStdDev;\n this.prevNumSamples = this.params.saoBlurRadius;\n }\n renderer.setClearColor(0);\n renderer.setRenderTarget(this.beautyRenderTarget);\n renderer.clear();\n renderer.render(this.scene, this.camera);\n if (!this.supportsDepthTextureExtension) {\n this.renderOverride(renderer, this.depthMaterial, this.depthRenderTarget, 0, 1);\n }\n if (this.supportsNormalTexture) {\n this.renderOverride(renderer, this.normalMaterial, this.normalRenderTarget, 7829503, 1);\n }\n this.renderPass(renderer, this.saoMaterial, this.saoRenderTarget, 16777215, 1);\n if (this.params.saoBlur) {\n this.renderPass(renderer, this.vBlurMaterial, this.blurIntermediateRenderTarget, 16777215, 1);\n this.renderPass(renderer, this.hBlurMaterial, this.saoRenderTarget, 16777215, 1);\n }\n let outputMaterial = this.materialCopy;\n if (this.params.output === 3) {\n if (this.supportsDepthTextureExtension) {\n this.materialCopy.uniforms[\"tDiffuse\"].value = this.beautyRenderTarget.depthTexture;\n this.materialCopy.needsUpdate = true;\n } else {\n this.depthCopy.uniforms[\"tDiffuse\"].value = this.depthRenderTarget.texture;\n this.depthCopy.needsUpdate = true;\n outputMaterial = this.depthCopy;\n }\n } else if (this.params.output === 4) {\n this.materialCopy.uniforms[\"tDiffuse\"].value = this.normalRenderTarget.texture;\n this.materialCopy.needsUpdate = true;\n } else {\n this.materialCopy.uniforms[\"tDiffuse\"].value = this.saoRenderTarget.texture;\n this.materialCopy.needsUpdate = true;\n }\n if (this.params.output === 0) {\n outputMaterial.blending = three__WEBPACK_IMPORTED_MODULE_42__.CustomBlending;\n } else {\n outputMaterial.blending = three__WEBPACK_IMPORTED_MODULE_42__.NoBlending;\n }\n this.renderPass(renderer, outputMaterial, this.renderToScreen ? null : readBuffer);\n renderer.setClearColor(this._oldClearColor, this.oldClearAlpha);\n renderer.autoClear = oldAutoClear;\n }\n renderPass(renderer, passMaterial, renderTarget, clearColor, clearAlpha) {\n renderer.getClearColor(this.originalClearColor);\n const originalClearAlpha = renderer.getClearAlpha();\n const originalAutoClear = renderer.autoClear;\n renderer.setRenderTarget(renderTarget);\n renderer.autoClear = false;\n if (clearColor !== void 0 && clearColor !== null) {\n renderer.setClearColor(clearColor);\n renderer.setClearAlpha(clearAlpha || 0);\n renderer.clear();\n }\n this.fsQuad.material = passMaterial;\n this.fsQuad.render(renderer);\n renderer.autoClear = originalAutoClear;\n renderer.setClearColor(this.originalClearColor);\n renderer.setClearAlpha(originalClearAlpha);\n }\n renderOverride(renderer, overrideMaterial, renderTarget, clearColor, clearAlpha) {\n renderer.getClearColor(this.originalClearColor);\n const originalClearAlpha = renderer.getClearAlpha();\n const originalAutoClear = renderer.autoClear;\n renderer.setRenderTarget(renderTarget);\n renderer.autoClear = false;\n clearColor = overrideMaterial.clearColor || clearColor;\n clearAlpha = overrideMaterial.clearAlpha || clearAlpha;\n if (clearColor !== void 0 && clearColor !== null) {\n renderer.setClearColor(clearColor);\n renderer.setClearAlpha(clearAlpha || 0);\n renderer.clear();\n }\n this.scene.overrideMaterial = overrideMaterial;\n renderer.render(this.scene, this.camera);\n this.scene.overrideMaterial = null;\n renderer.autoClear = originalAutoClear;\n renderer.setClearColor(this.originalClearColor);\n renderer.setClearAlpha(originalClearAlpha);\n }\n setSize(width, height) {\n this.beautyRenderTarget.setSize(width, height);\n this.saoRenderTarget.setSize(width, height);\n this.blurIntermediateRenderTarget.setSize(width, height);\n this.normalRenderTarget.setSize(width, height);\n this.depthRenderTarget.setSize(width, height);\n this.saoMaterial.uniforms[\"size\"].value.set(width, height);\n this.saoMaterial.uniforms[\"cameraInverseProjectionMatrix\"].value.copy(this.camera.projectionMatrixInverse);\n this.saoMaterial.uniforms[\"cameraProjectionMatrix\"].value = this.camera.projectionMatrix;\n this.saoMaterial.needsUpdate = true;\n this.vBlurMaterial.uniforms[\"size\"].value.set(width, height);\n this.vBlurMaterial.needsUpdate = true;\n this.hBlurMaterial.uniforms[\"size\"].value.set(width, height);\n this.hBlurMaterial.needsUpdate = true;\n }\n dispose() {\n this.saoRenderTarget.dispose();\n this.blurIntermediateRenderTarget.dispose();\n this.beautyRenderTarget.dispose();\n this.normalRenderTarget.dispose();\n this.depthRenderTarget.dispose();\n this.depthMaterial.dispose();\n this.normalMaterial.dispose();\n this.saoMaterial.dispose();\n this.vBlurMaterial.dispose();\n this.hBlurMaterial.dispose();\n this.materialCopy.dispose();\n this.depthCopy.dispose();\n this.fsQuad.dispose();\n }\n}\n__publicField(SAOPass, \"OUTPUT\", {\n Beauty: 1,\n Default: 0,\n SAO: 2,\n Depth: 3,\n Normal: 4\n});\nconst AfterimageShader = {\n uniforms: {\n damp: { value: 0.96 },\n tOld: { value: null },\n tNew: { value: null }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform float damp;\",\n \"uniform sampler2D tOld;\",\n \"uniform sampler2D tNew;\",\n \"varying vec2 vUv;\",\n \"vec4 when_gt( vec4 x, float y ) {\",\n \"\treturn max( sign( x - y ), 0.0 );\",\n \"}\",\n \"void main() {\",\n \"\tvec4 texelOld = texture2D( tOld, vUv );\",\n \"\tvec4 texelNew = texture2D( tNew, vUv );\",\n \"\ttexelOld *= damp * when_gt( texelOld, 0.1 );\",\n \"\tgl_FragColor = max(texelNew, texelOld);\",\n \"}\"\n ].join(\"\\n\")\n};\nclass AfterimagePass extends Pass {\n constructor(damp = 0.96, shader = AfterimageShader) {\n super();\n __publicField(this, \"shader\");\n __publicField(this, \"uniforms\");\n __publicField(this, \"textureComp\");\n __publicField(this, \"textureOld\");\n __publicField(this, \"shaderMaterial\");\n __publicField(this, \"compFsQuad\");\n __publicField(this, \"copyFsQuad\");\n this.shader = shader;\n this.uniforms = three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(shader.uniforms);\n this.uniforms[\"damp\"].value = damp;\n this.textureComp = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(window.innerWidth, window.innerHeight, {\n minFilter: three__WEBPACK_IMPORTED_MODULE_42__.LinearFilter,\n magFilter: three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter,\n format: three__WEBPACK_IMPORTED_MODULE_42__.RGBAFormat\n });\n this.textureOld = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(window.innerWidth, window.innerHeight, {\n minFilter: three__WEBPACK_IMPORTED_MODULE_42__.LinearFilter,\n magFilter: three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter,\n format: three__WEBPACK_IMPORTED_MODULE_42__.RGBAFormat\n });\n this.shaderMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: this.uniforms,\n vertexShader: this.shader.vertexShader,\n fragmentShader: this.shader.fragmentShader\n });\n this.compFsQuad = new FullScreenQuad(this.shaderMaterial);\n let material2 = new three__WEBPACK_IMPORTED_MODULE_42__.MeshBasicMaterial();\n this.copyFsQuad = new FullScreenQuad(material2);\n }\n render(renderer, writeBuffer, readBuffer) {\n this.uniforms[\"tOld\"].value = this.textureOld.texture;\n this.uniforms[\"tNew\"].value = readBuffer.texture;\n renderer.setRenderTarget(this.textureComp);\n this.compFsQuad.render(renderer);\n this.copyFsQuad.material.map = this.textureComp.texture;\n if (this.renderToScreen) {\n renderer.setRenderTarget(null);\n this.copyFsQuad.render(renderer);\n } else {\n renderer.setRenderTarget(writeBuffer);\n if (this.clear)\n renderer.clear();\n this.copyFsQuad.render(renderer);\n }\n let temp = this.textureOld;\n this.textureOld = this.textureComp;\n this.textureComp = temp;\n }\n setSize(width, height) {\n this.textureComp.setSize(width, height);\n this.textureOld.setSize(width, height);\n }\n}\nclass MaskPass extends Pass {\n constructor(scene, camera) {\n super();\n __publicField(this, \"scene\");\n __publicField(this, \"camera\");\n __publicField(this, \"inverse\");\n this.scene = scene;\n this.camera = camera;\n this.clear = true;\n this.needsSwap = false;\n this.inverse = false;\n }\n render(renderer, writeBuffer, readBuffer) {\n const context = renderer.getContext();\n const state = renderer.state;\n state.buffers.color.setMask(false);\n state.buffers.depth.setMask(false);\n state.buffers.color.setLocked(true);\n state.buffers.depth.setLocked(true);\n let writeValue, clearValue;\n if (this.inverse) {\n writeValue = 0;\n clearValue = 1;\n } else {\n writeValue = 1;\n clearValue = 0;\n }\n state.buffers.stencil.setTest(true);\n state.buffers.stencil.setOp(context.REPLACE, context.REPLACE, context.REPLACE);\n state.buffers.stencil.setFunc(context.ALWAYS, writeValue, 4294967295);\n state.buffers.stencil.setClear(clearValue);\n state.buffers.stencil.setLocked(true);\n renderer.setRenderTarget(readBuffer);\n if (this.clear)\n renderer.clear();\n renderer.render(this.scene, this.camera);\n renderer.setRenderTarget(writeBuffer);\n if (this.clear)\n renderer.clear();\n renderer.render(this.scene, this.camera);\n state.buffers.color.setLocked(false);\n state.buffers.depth.setLocked(false);\n state.buffers.stencil.setLocked(false);\n state.buffers.stencil.setFunc(context.EQUAL, 1, 4294967295);\n state.buffers.stencil.setOp(context.KEEP, context.KEEP, context.KEEP);\n state.buffers.stencil.setLocked(true);\n }\n}\nclass ClearMaskPass extends Pass {\n constructor() {\n super();\n this.needsSwap = false;\n }\n render(renderer) {\n renderer.state.buffers.stencil.setLocked(false);\n renderer.state.buffers.stencil.setTest(false);\n }\n}\nclass EffectComposer {\n constructor(renderer, renderTarget) {\n __publicField(this, \"renderer\");\n __publicField(this, \"_pixelRatio\");\n __publicField(this, \"_width\");\n __publicField(this, \"_height\");\n __publicField(this, \"renderTarget1\");\n __publicField(this, \"renderTarget2\");\n __publicField(this, \"writeBuffer\");\n __publicField(this, \"readBuffer\");\n __publicField(this, \"renderToScreen\");\n __publicField(this, \"passes\", []);\n __publicField(this, \"copyPass\");\n __publicField(this, \"clock\");\n this.renderer = renderer;\n if (renderTarget === void 0) {\n const parameters = {\n minFilter: three__WEBPACK_IMPORTED_MODULE_42__.LinearFilter,\n magFilter: three__WEBPACK_IMPORTED_MODULE_42__.LinearFilter,\n format: three__WEBPACK_IMPORTED_MODULE_42__.RGBAFormat\n };\n const size2 = renderer.getSize(new three__WEBPACK_IMPORTED_MODULE_42__.Vector2());\n this._pixelRatio = renderer.getPixelRatio();\n this._width = size2.width;\n this._height = size2.height;\n renderTarget = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(\n this._width * this._pixelRatio,\n this._height * this._pixelRatio,\n parameters\n );\n renderTarget.texture.name = \"EffectComposer.rt1\";\n } else {\n this._pixelRatio = 1;\n this._width = renderTarget.width;\n this._height = renderTarget.height;\n }\n this.renderTarget1 = renderTarget;\n this.renderTarget2 = renderTarget.clone();\n this.renderTarget2.texture.name = \"EffectComposer.rt2\";\n this.writeBuffer = this.renderTarget1;\n this.readBuffer = this.renderTarget2;\n this.renderToScreen = true;\n if (CopyShader === void 0) {\n console.error(\"THREE.EffectComposer relies on CopyShader\");\n }\n if (ShaderPass === void 0) {\n console.error(\"THREE.EffectComposer relies on ShaderPass\");\n }\n this.copyPass = new ShaderPass(CopyShader);\n this.copyPass.material.blending = three__WEBPACK_IMPORTED_MODULE_42__.NoBlending;\n this.clock = new three__WEBPACK_IMPORTED_MODULE_42__.Clock();\n }\n swapBuffers() {\n const tmp = this.readBuffer;\n this.readBuffer = this.writeBuffer;\n this.writeBuffer = tmp;\n }\n addPass(pass) {\n this.passes.push(pass);\n pass.setSize(this._width * this._pixelRatio, this._height * this._pixelRatio);\n }\n insertPass(pass, index) {\n this.passes.splice(index, 0, pass);\n pass.setSize(this._width * this._pixelRatio, this._height * this._pixelRatio);\n }\n removePass(pass) {\n const index = this.passes.indexOf(pass);\n if (index !== -1) {\n this.passes.splice(index, 1);\n }\n }\n isLastEnabledPass(passIndex) {\n for (let i2 = passIndex + 1; i2 < this.passes.length; i2++) {\n if (this.passes[i2].enabled) {\n return false;\n }\n }\n return true;\n }\n render(deltaTime) {\n if (deltaTime === void 0) {\n deltaTime = this.clock.getDelta();\n }\n const currentRenderTarget = this.renderer.getRenderTarget();\n let maskActive = false;\n const il = this.passes.length;\n for (let i2 = 0; i2 < il; i2++) {\n const pass = this.passes[i2];\n if (pass.enabled === false)\n continue;\n pass.renderToScreen = this.renderToScreen && this.isLastEnabledPass(i2);\n pass.render(this.renderer, this.writeBuffer, this.readBuffer, deltaTime, maskActive);\n if (pass.needsSwap) {\n if (maskActive) {\n const context = this.renderer.getContext();\n const stencil = this.renderer.state.buffers.stencil;\n stencil.setFunc(context.NOTEQUAL, 1, 4294967295);\n this.copyPass.render(this.renderer, this.writeBuffer, this.readBuffer, deltaTime);\n stencil.setFunc(context.EQUAL, 1, 4294967295);\n }\n this.swapBuffers();\n }\n if (MaskPass !== void 0) {\n if (pass instanceof MaskPass) {\n maskActive = true;\n } else if (pass instanceof ClearMaskPass) {\n maskActive = false;\n }\n }\n }\n this.renderer.setRenderTarget(currentRenderTarget);\n }\n reset(renderTarget) {\n if (renderTarget === void 0) {\n const size2 = this.renderer.getSize(new three__WEBPACK_IMPORTED_MODULE_42__.Vector2());\n this._pixelRatio = this.renderer.getPixelRatio();\n this._width = size2.width;\n this._height = size2.height;\n renderTarget = this.renderTarget1.clone();\n renderTarget.setSize(this._width * this._pixelRatio, this._height * this._pixelRatio);\n }\n this.renderTarget1.dispose();\n this.renderTarget2.dispose();\n this.renderTarget1 = renderTarget;\n this.renderTarget2 = renderTarget.clone();\n this.writeBuffer = this.renderTarget1;\n this.readBuffer = this.renderTarget2;\n }\n setSize(width, height) {\n this._width = width;\n this._height = height;\n const effectiveWidth = this._width * this._pixelRatio;\n const effectiveHeight = this._height * this._pixelRatio;\n this.renderTarget1.setSize(effectiveWidth, effectiveHeight);\n this.renderTarget2.setSize(effectiveWidth, effectiveHeight);\n for (let i2 = 0; i2 < this.passes.length; i2++) {\n this.passes[i2].setSize(effectiveWidth, effectiveHeight);\n }\n }\n setPixelRatio(pixelRatio) {\n this._pixelRatio = pixelRatio;\n this.setSize(this._width, this._height);\n }\n}\nconst DotScreenShader = {\n uniforms: {\n tDiffuse: { value: null },\n tSize: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(256, 256) },\n center: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(0.5, 0.5) },\n angle: { value: 1.57 },\n scale: { value: 1 }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform vec2 center;\",\n \"uniform float angle;\",\n \"uniform float scale;\",\n \"uniform vec2 tSize;\",\n \"uniform sampler2D tDiffuse;\",\n \"varying vec2 vUv;\",\n \"float pattern() {\",\n \"\tfloat s = sin( angle ), c = cos( angle );\",\n \"\tvec2 tex = vUv * tSize - center;\",\n \"\tvec2 point = vec2( c * tex.x - s * tex.y, s * tex.x + c * tex.y ) * scale;\",\n \"\treturn ( sin( point.x ) * sin( point.y ) ) * 4.0;\",\n \"}\",\n \"void main() {\",\n \"\tvec4 color = texture2D( tDiffuse, vUv );\",\n \"\tfloat average = ( color.r + color.g + color.b ) / 3.0;\",\n \"\tgl_FragColor = vec4( vec3( average * 10.0 - 5.0 + pattern() ), color.a );\",\n \"}\"\n ].join(\"\\n\")\n};\nclass DotScreenPass extends Pass {\n constructor(center2, angle, scale) {\n super();\n __publicField(this, \"material\");\n __publicField(this, \"fsQuad\");\n __publicField(this, \"uniforms\");\n if (DotScreenShader === void 0)\n console.error(\"THREE.DotScreenPass relies on THREE.DotScreenShader\");\n const shader = DotScreenShader;\n this.uniforms = three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(shader.uniforms);\n if (center2 !== void 0)\n this.uniforms[\"center\"].value.copy(center2);\n if (angle !== void 0)\n this.uniforms[\"angle\"].value = angle;\n if (scale !== void 0)\n this.uniforms[\"scale\"].value = scale;\n this.material = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: this.uniforms,\n vertexShader: shader.vertexShader,\n fragmentShader: shader.fragmentShader\n });\n this.fsQuad = new FullScreenQuad(this.material);\n }\n render(renderer, writeBuffer, readBuffer) {\n this.uniforms[\"tDiffuse\"].value = readBuffer.texture;\n this.uniforms[\"tSize\"].value.set(readBuffer.width, readBuffer.height);\n if (this.renderToScreen) {\n renderer.setRenderTarget(null);\n this.fsQuad.render(renderer);\n } else {\n renderer.setRenderTarget(writeBuffer);\n if (this.clear)\n renderer.clear();\n this.fsQuad.render(renderer);\n }\n }\n}\nconst SSRShader = {\n defines: {\n MAX_STEP: 0,\n isPerspectiveCamera: true,\n isDistanceAttenuation: true,\n isFresnel: true,\n isInfiniteThick: false,\n isSelective: false\n },\n uniforms: {\n tDiffuse: { value: null },\n tNormal: { value: null },\n tMetalness: { value: null },\n tDepth: { value: null },\n cameraNear: { value: null },\n cameraFar: { value: null },\n resolution: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector2() },\n cameraProjectionMatrix: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4() },\n cameraInverseProjectionMatrix: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4() },\n opacity: { value: 0.5 },\n maxDistance: { value: 180 },\n cameraRange: { value: 0 },\n surfDist: { value: 7e-3 },\n thickTolerance: { value: 0.03 }\n },\n vertexShader: (\n /* glsl */\n `\n\n varying vec2 vUv;\n\n void main() {\n\n\t\t\tvUv = uv;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }\n\n `\n ),\n fragmentShader: (\n /* glsl */\n `\n\t\t// precision highp float;\n\t\tprecision highp sampler2D;\n\t\tvarying vec2 vUv;\n\t\tuniform sampler2D tDepth;\n\t\tuniform sampler2D tNormal;\n\t\tuniform sampler2D tMetalness;\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float cameraRange;\n\t\tuniform vec2 resolution;\n\t\tuniform float opacity;\n\t\tuniform float cameraNear;\n\t\tuniform float cameraFar;\n\t\tuniform float maxDistance;\n\t\tuniform float surfDist;\n\t\tuniform mat4 cameraProjectionMatrix;\n\t\tuniform mat4 cameraInverseProjectionMatrix;\n\t\tuniform float thickTolerance;\n\t\t#include \n\t\tfloat pointToLineDistance(vec3 x0, vec3 x1, vec3 x2) {\n\t\t\t//x0: point, x1: linePointA, x2: linePointB\n\t\t\t//https://mathworld.wolfram.com/Point-LineDistance3-Dimensional.html\n\t\t\treturn length(cross(x0-x1,x0-x2))/length(x2-x1);\n\t\t}\n\t\tfloat pointPlaneDistance(vec3 point,vec3 planePoint,vec3 planeNormal){\n\t\t\t// https://mathworld.wolfram.com/Point-PlaneDistance.html\n\t\t\t//// https://en.wikipedia.org/wiki/Plane_(geometry)\n\t\t\t//// http://paulbourke.net/geometry/pointlineplane/\n\t\t\tfloat a=planeNormal.x,b=planeNormal.y,c=planeNormal.z;\n\t\t\tfloat x0=point.x,y0=point.y,z0=point.z;\n\t\t\tfloat x=planePoint.x,y=planePoint.y,z=planePoint.z;\n\t\t\tfloat d=-(a*x+b*y+c*z);\n\t\t\tfloat distance=(a*x0+b*y0+c*z0+d)/sqrt(a*a+b*b+c*c);\n\t\t\treturn distance;\n\t\t}\n\t\tfloat getDepth( const in vec2 uv ) {\n\t\t\treturn texture2D( tDepth, uv ).x;\n\t\t}\n\t\tfloat getViewZ( const in float depth ) {\n\t\t\t#ifdef isPerspectiveCamera\n\t\t\t\treturn perspectiveDepthToViewZ( depth, cameraNear, cameraFar );\n\t\t\t#else\n\t\t\t\treturn orthographicDepthToViewZ( depth, cameraNear, cameraFar );\n\t\t\t#endif\n\t\t}\n\t\tvec3 getViewPosition( const in vec2 uv, const in float depth/*clip space*/, const in float clipW ) {\n\t\t\tvec4 clipPosition = vec4( ( vec3( uv, depth ) - 0.5 ) * 2.0, 1.0 );//ndc\n\t\t\tclipPosition *= clipW; //clip\n\t\t\treturn ( cameraInverseProjectionMatrix * clipPosition ).xyz;//view\n\t\t}\n\t\tvec3 getViewNormal( const in vec2 uv ) {\n\t\t\treturn unpackRGBToNormal( texture2D( tNormal, uv ).xyz );\n\t\t}\n\t\tvec2 viewPositionToXY(vec3 viewPosition){\n\t\t\tvec2 xy;\n\t\t\tvec4 clip=cameraProjectionMatrix*vec4(viewPosition,1);\n\t\t\txy=clip.xy;//clip\n\t\t\tfloat clipW=clip.w;\n\t\t\txy/=clipW;//NDC\n\t\t\txy=(xy+1.)/2.;//uv\n\t\t\txy*=resolution;//screen\n\t\t\treturn xy;\n\t\t}\n\t\tvoid main(){\n\t\t\t#ifdef isSelective\n\t\t\t\tfloat metalness=texture2D(tMetalness,vUv).r;\n\t\t\t\tif(metalness==0.) return;\n\t\t\t#endif\n\n\t\t\tfloat depth = getDepth( vUv );\n\t\t\tfloat viewZ = getViewZ( depth );\n\t\t\tif(-viewZ>=cameraFar) return;\n\n\t\t\tfloat clipW = cameraProjectionMatrix[2][3] * viewZ+cameraProjectionMatrix[3][3];\n\t\t\tvec3 viewPosition=getViewPosition( vUv, depth, clipW );\n\n\t\t\tvec2 d0=gl_FragCoord.xy;\n\t\t\tvec2 d1;\n\n\t\t\tvec3 viewNormal=getViewNormal( vUv );\n\n\t\t\t#ifdef isPerspectiveCamera\n\t\t\t\tvec3 viewIncidenceDir=normalize(viewPosition);\n\t\t\t\tvec3 viewReflectDir=reflect(viewIncidenceDir,viewNormal);\n\t\t\t#else\n\t\t\t\tvec3 viewIncidenceDir=vec3(0,0,-1);\n\t\t\t\tvec3 viewReflectDir=reflect(viewIncidenceDir,viewNormal);\n\t\t\t#endif\n\n\t\t\tfloat maxReflectRayLen=maxDistance/dot(-viewIncidenceDir,viewNormal);\n\t\t\t// dot(a,b)==length(a)*length(b)*cos(theta) // https://www.mathsisfun.com/algebra/vectors-dot-product.html\n\t\t\t// if(a.isNormalized&&b.isNormalized) dot(a,b)==cos(theta)\n\t\t\t// maxDistance/maxReflectRayLen=cos(theta)\n\t\t\t// maxDistance/maxReflectRayLen==dot(a,b)\n\t\t\t// maxReflectRayLen==maxDistance/dot(a,b)\n\n\t\t\tvec3 d1viewPosition=viewPosition+viewReflectDir*maxReflectRayLen;\n\t\t\t#ifdef isPerspectiveCamera\n\t\t\t\tif(d1viewPosition.z>-cameraNear){\n\t\t\t\t\t//https://tutorial.math.lamar.edu/Classes/CalcIII/EqnsOfLines.aspx\n\t\t\t\t\tfloat t=(-cameraNear-viewPosition.z)/viewReflectDir.z;\n\t\t\t\t\td1viewPosition=viewPosition+viewReflectDir*t;\n\t\t\t\t}\n\t\t\t#endif\n\t\t\td1=viewPositionToXY(d1viewPosition);\n\n\t\t\tfloat totalLen=length(d1-d0);\n\t\t\tfloat xLen=d1.x-d0.x;\n\t\t\tfloat yLen=d1.y-d0.y;\n\t\t\tfloat totalStep=max(abs(xLen),abs(yLen));\n\t\t\tfloat xSpan=xLen/totalStep;\n\t\t\tfloat ySpan=yLen/totalStep;\n\t\t\tfor(float i=0.;i=totalStep) break;\n\t\t\t\tvec2 xy=vec2(d0.x+i*xSpan,d0.y+i*ySpan);\n\t\t\t\tif(xy.x<0.||xy.x>resolution.x||xy.y<0.||xy.y>resolution.y) break;\n\t\t\t\tfloat s=length(xy-d0)/totalLen;\n\t\t\t\tvec2 uv=xy/resolution;\n\n\t\t\t\tfloat d = getDepth(uv);\n\t\t\t\tfloat vZ = getViewZ( d );\n\t\t\t\tif(-vZ>=cameraFar) continue;\n\t\t\t\tfloat cW = cameraProjectionMatrix[2][3] * vZ+cameraProjectionMatrix[3][3];\n\t\t\t\tvec3 vP=getViewPosition( uv, d, cW );\n\n\t\t\t\t#ifdef isPerspectiveCamera\n\t\t\t\t\t// https://www.comp.nus.edu.sg/~lowkl/publications/lowk_persp_interp_techrep.pdf\n\t\t\t\t\tfloat recipVPZ=1./viewPosition.z;\n\t\t\t\t\tfloat viewReflectRayZ=1./(recipVPZ+s*(1./d1viewPosition.z-recipVPZ));\n\t\t\t\t\tfloat sD=surfDist*cW;\n\t\t\t\t#else\n\t\t\t\t\tfloat viewReflectRayZ=viewPosition.z+s*(d1viewPosition.z-viewPosition.z);\n\t\t\t\t\tfloat sD=surfDist;\n\t\t\t\t#endif\n\t\t\t\tif(viewReflectRayZ-sD>vZ) continue;\n\n\t\t\t\t#ifdef isInfiniteThick\n\t\t\t\t\tif(viewReflectRayZ+thickTolerance*clipW=0.) continue;\n\t\t\t\t\tfloat distance=pointPlaneDistance(vP,viewPosition,viewNormal);\n\t\t\t\t\tif(distance>maxDistance) break;\n\t\t\t\t\t#ifdef isDistanceAttenuation\n\t\t\t\t\t\tfloat ratio=1.-(distance/maxDistance);\n\t\t\t\t\t\tfloat attenuation=ratio*ratio;\n\t\t\t\t\t\top=opacity*attenuation;\n\t\t\t\t\t#endif\n\t\t\t\t\t#ifdef isFresnel\n\t\t\t\t\t\tfloat fresnel=(dot(viewIncidenceDir,viewReflectDir)+1.)/2.;\n\t\t\t\t\t\top*=fresnel;\n\t\t\t\t\t#endif\n\t\t\t\t\tvec4 reflectColor=texture2D(tDiffuse,uv);\n\t\t\t\t\tgl_FragColor.xyz=reflectColor.xyz;\n\t\t\t\t\tgl_FragColor.a=op;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t`\n )\n};\nconst SSRDepthShader = {\n defines: {\n PERSPECTIVE_CAMERA: 1\n },\n uniforms: {\n tDepth: { value: null },\n cameraNear: { value: null },\n cameraFar: { value: null }\n },\n vertexShader: (\n /* glsl */\n `\n\n varying vec2 vUv;\n\n void main() {\n\n \tvUv = uv;\n \tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }\n\n `\n ),\n fragmentShader: (\n /* glsl */\n `\n\n uniform sampler2D tDepth;\n\n uniform float cameraNear;\n uniform float cameraFar;\n\n varying vec2 vUv;\n\n #include \n\n\t\tfloat getLinearDepth( const in vec2 uv ) {\n\n\t\t\t#if PERSPECTIVE_CAMERA == 1\n\n\t\t\t\tfloat fragCoordZ = texture2D( tDepth, uv ).x;\n\t\t\t\tfloat viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );\n\t\t\t\treturn viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );\n\n\t\t\t#else\n\n\t\t\t\treturn texture2D( tDepth, uv ).x;\n\n\t\t\t#endif\n\n\t\t}\n\n void main() {\n\n \tfloat depth = getLinearDepth( vUv );\n\t\t\tfloat d = 1.0 - depth;\n\t\t\t// d=(d-.999)*1000.;\n \tgl_FragColor = vec4( vec3( d ), 1.0 );\n\n }\n\n `\n )\n};\nconst SSRBlurShader = {\n uniforms: {\n tDiffuse: { value: null },\n resolution: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector2() },\n opacity: { value: 0.5 }\n },\n vertexShader: (\n /* glsl */\n `\n\n varying vec2 vUv;\n\n void main() {\n\n \tvUv = uv;\n \tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }\n\n `\n ),\n fragmentShader: (\n /* glsl */\n `\n\n uniform sampler2D tDiffuse;\n uniform vec2 resolution;\n varying vec2 vUv;\n void main() {\n\t\t\t//reverse engineering from PhotoShop blur filter, then change coefficient\n\n \tvec2 texelSize = ( 1.0 / resolution );\n\n\t\t\tvec4 c=texture2D(tDiffuse,vUv);\n\n\t\t\tvec2 offset;\n\n\t\t\toffset=(vec2(-1,0))*texelSize;\n\t\t\tvec4 cl=texture2D(tDiffuse,vUv+offset);\n\n\t\t\toffset=(vec2(1,0))*texelSize;\n\t\t\tvec4 cr=texture2D(tDiffuse,vUv+offset);\n\n\t\t\toffset=(vec2(0,-1))*texelSize;\n\t\t\tvec4 cb=texture2D(tDiffuse,vUv+offset);\n\n\t\t\toffset=(vec2(0,1))*texelSize;\n\t\t\tvec4 ct=texture2D(tDiffuse,vUv+offset);\n\n\t\t\t// float coeCenter=.5;\n\t\t\t// float coeSide=.125;\n\t\t\tfloat coeCenter=.2;\n\t\t\tfloat coeSide=.2;\n\t\t\tfloat a=c.a*coeCenter+cl.a*coeSide+cr.a*coeSide+cb.a*coeSide+ct.a*coeSide;\n\t\t\tvec3 rgb=(c.rgb*c.a*coeCenter+cl.rgb*cl.a*coeSide+cr.rgb*cr.a*coeSide+cb.rgb*cb.a*coeSide+ct.rgb*ct.a*coeSide)/a;\n\t\t\tgl_FragColor=vec4(rgb,a);\n\n\t\t}\n\t`\n )\n};\nconst _SSRPass = class extends Pass {\n constructor({ renderer, scene, camera, width, height, selects, bouncing = false, groundReflector }) {\n super();\n this.width = width !== void 0 ? width : 512;\n this.height = height !== void 0 ? height : 512;\n this.clear = true;\n this.renderer = renderer;\n this.scene = scene;\n this.camera = camera;\n this.groundReflector = groundReflector;\n this.opacity = SSRShader.uniforms.opacity.value;\n this.output = 0;\n this.maxDistance = SSRShader.uniforms.maxDistance.value;\n this.thickness = SSRShader.uniforms.thickness.value;\n this.tempColor = new three__WEBPACK_IMPORTED_MODULE_42__.Color();\n this._selects = selects;\n this.selective = Array.isArray(this._selects);\n Object.defineProperty(this, \"selects\", {\n get() {\n return this._selects;\n },\n set(val) {\n if (this._selects === val)\n return;\n this._selects = val;\n if (Array.isArray(val)) {\n this.selective = true;\n this.ssrMaterial.defines.SELECTIVE = true;\n this.ssrMaterial.needsUpdate = true;\n } else {\n this.selective = false;\n this.ssrMaterial.defines.SELECTIVE = false;\n this.ssrMaterial.needsUpdate = true;\n }\n }\n });\n this._bouncing = bouncing;\n Object.defineProperty(this, \"bouncing\", {\n get() {\n return this._bouncing;\n },\n set(val) {\n if (this._bouncing === val)\n return;\n this._bouncing = val;\n if (val) {\n this.ssrMaterial.uniforms[\"tDiffuse\"].value = this.prevRenderTarget.texture;\n } else {\n this.ssrMaterial.uniforms[\"tDiffuse\"].value = this.beautyRenderTarget.texture;\n }\n }\n });\n this.blur = true;\n this._distanceAttenuation = SSRShader.defines.DISTANCE_ATTENUATION;\n Object.defineProperty(this, \"distanceAttenuation\", {\n get() {\n return this._distanceAttenuation;\n },\n set(val) {\n if (this._distanceAttenuation === val)\n return;\n this._distanceAttenuation = val;\n this.ssrMaterial.defines.DISTANCE_ATTENUATION = val;\n this.ssrMaterial.needsUpdate = true;\n }\n });\n this._fresnel = SSRShader.defines.FRESNEL;\n Object.defineProperty(this, \"fresnel\", {\n get() {\n return this._fresnel;\n },\n set(val) {\n if (this._fresnel === val)\n return;\n this._fresnel = val;\n this.ssrMaterial.defines.FRESNEL = val;\n this.ssrMaterial.needsUpdate = true;\n }\n });\n this._infiniteThick = SSRShader.defines.INFINITE_THICK;\n Object.defineProperty(this, \"infiniteThick\", {\n get() {\n return this._infiniteThick;\n },\n set(val) {\n if (this._infiniteThick === val)\n return;\n this._infiniteThick = val;\n this.ssrMaterial.defines.INFINITE_THICK = val;\n this.ssrMaterial.needsUpdate = true;\n }\n });\n const depthTexture = new three__WEBPACK_IMPORTED_MODULE_42__.DepthTexture();\n depthTexture.type = three__WEBPACK_IMPORTED_MODULE_42__.UnsignedShortType;\n depthTexture.minFilter = three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter;\n depthTexture.magFilter = three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter;\n this.beautyRenderTarget = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(this.width, this.height, {\n minFilter: three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter,\n magFilter: three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter,\n type: three__WEBPACK_IMPORTED_MODULE_42__.HalfFloatType,\n depthTexture,\n depthBuffer: true\n });\n this.prevRenderTarget = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(this.width, this.height, {\n minFilter: three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter,\n magFilter: three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter\n });\n this.normalRenderTarget = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(this.width, this.height, {\n minFilter: three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter,\n magFilter: three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter,\n type: three__WEBPACK_IMPORTED_MODULE_42__.HalfFloatType\n });\n this.metalnessRenderTarget = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(this.width, this.height, {\n minFilter: three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter,\n magFilter: three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter,\n type: three__WEBPACK_IMPORTED_MODULE_42__.HalfFloatType\n });\n this.ssrRenderTarget = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(this.width, this.height, {\n minFilter: three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter,\n magFilter: three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter\n });\n this.blurRenderTarget = this.ssrRenderTarget.clone();\n this.blurRenderTarget2 = this.ssrRenderTarget.clone();\n this.ssrMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n defines: Object.assign({}, SSRShader.defines, {\n MAX_STEP: Math.sqrt(this.width * this.width + this.height * this.height)\n }),\n uniforms: three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(SSRShader.uniforms),\n vertexShader: SSRShader.vertexShader,\n fragmentShader: SSRShader.fragmentShader,\n blending: three__WEBPACK_IMPORTED_MODULE_42__.NoBlending\n });\n this.ssrMaterial.uniforms[\"tDiffuse\"].value = this.beautyRenderTarget.texture;\n this.ssrMaterial.uniforms[\"tNormal\"].value = this.normalRenderTarget.texture;\n this.ssrMaterial.defines.SELECTIVE = this.selective;\n this.ssrMaterial.needsUpdate = true;\n this.ssrMaterial.uniforms[\"tMetalness\"].value = this.metalnessRenderTarget.texture;\n this.ssrMaterial.uniforms[\"tDepth\"].value = this.beautyRenderTarget.depthTexture;\n this.ssrMaterial.uniforms[\"cameraNear\"].value = this.camera.near;\n this.ssrMaterial.uniforms[\"cameraFar\"].value = this.camera.far;\n this.ssrMaterial.uniforms[\"thickness\"].value = this.thickness;\n this.ssrMaterial.uniforms[\"resolution\"].value.set(this.width, this.height);\n this.ssrMaterial.uniforms[\"cameraProjectionMatrix\"].value.copy(this.camera.projectionMatrix);\n this.ssrMaterial.uniforms[\"cameraInverseProjectionMatrix\"].value.copy(this.camera.projectionMatrixInverse);\n this.normalMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.MeshNormalMaterial();\n this.normalMaterial.blending = three__WEBPACK_IMPORTED_MODULE_42__.NoBlending;\n this.metalnessOnMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.MeshBasicMaterial({\n color: \"white\"\n });\n this.metalnessOffMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.MeshBasicMaterial({\n color: \"black\"\n });\n this.blurMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n defines: Object.assign({}, SSRBlurShader.defines),\n uniforms: three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(SSRBlurShader.uniforms),\n vertexShader: SSRBlurShader.vertexShader,\n fragmentShader: SSRBlurShader.fragmentShader\n });\n this.blurMaterial.uniforms[\"tDiffuse\"].value = this.ssrRenderTarget.texture;\n this.blurMaterial.uniforms[\"resolution\"].value.set(this.width, this.height);\n this.blurMaterial2 = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n defines: Object.assign({}, SSRBlurShader.defines),\n uniforms: three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(SSRBlurShader.uniforms),\n vertexShader: SSRBlurShader.vertexShader,\n fragmentShader: SSRBlurShader.fragmentShader\n });\n this.blurMaterial2.uniforms[\"tDiffuse\"].value = this.blurRenderTarget.texture;\n this.blurMaterial2.uniforms[\"resolution\"].value.set(this.width, this.height);\n this.depthRenderMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n defines: Object.assign({}, SSRDepthShader.defines),\n uniforms: three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(SSRDepthShader.uniforms),\n vertexShader: SSRDepthShader.vertexShader,\n fragmentShader: SSRDepthShader.fragmentShader,\n blending: three__WEBPACK_IMPORTED_MODULE_42__.NoBlending\n });\n this.depthRenderMaterial.uniforms[\"tDepth\"].value = this.beautyRenderTarget.depthTexture;\n this.depthRenderMaterial.uniforms[\"cameraNear\"].value = this.camera.near;\n this.depthRenderMaterial.uniforms[\"cameraFar\"].value = this.camera.far;\n this.copyMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(CopyShader.uniforms),\n vertexShader: CopyShader.vertexShader,\n fragmentShader: CopyShader.fragmentShader,\n transparent: true,\n depthTest: false,\n depthWrite: false,\n blendSrc: three__WEBPACK_IMPORTED_MODULE_42__.SrcAlphaFactor,\n blendDst: three__WEBPACK_IMPORTED_MODULE_42__.OneMinusSrcAlphaFactor,\n blendEquation: three__WEBPACK_IMPORTED_MODULE_42__.AddEquation,\n blendSrcAlpha: three__WEBPACK_IMPORTED_MODULE_42__.SrcAlphaFactor,\n blendDstAlpha: three__WEBPACK_IMPORTED_MODULE_42__.OneMinusSrcAlphaFactor,\n blendEquationAlpha: three__WEBPACK_IMPORTED_MODULE_42__.AddEquation\n // premultipliedAlpha:true,\n });\n this.fsQuad = new FullScreenQuad(null);\n this.originalClearColor = new three__WEBPACK_IMPORTED_MODULE_42__.Color();\n }\n dispose() {\n this.beautyRenderTarget.dispose();\n this.prevRenderTarget.dispose();\n this.normalRenderTarget.dispose();\n this.metalnessRenderTarget.dispose();\n this.ssrRenderTarget.dispose();\n this.blurRenderTarget.dispose();\n this.blurRenderTarget2.dispose();\n this.normalMaterial.dispose();\n this.metalnessOnMaterial.dispose();\n this.metalnessOffMaterial.dispose();\n this.blurMaterial.dispose();\n this.blurMaterial2.dispose();\n this.copyMaterial.dispose();\n this.depthRenderMaterial.dispose();\n this.fsQuad.dispose();\n }\n render(renderer, writeBuffer) {\n renderer.setRenderTarget(this.beautyRenderTarget);\n renderer.clear();\n if (this.groundReflector) {\n this.groundReflector.visible = false;\n this.groundReflector.doRender(this.renderer, this.scene, this.camera);\n this.groundReflector.visible = true;\n }\n renderer.render(this.scene, this.camera);\n if (this.groundReflector)\n this.groundReflector.visible = false;\n this.renderOverride(renderer, this.normalMaterial, this.normalRenderTarget, 0, 0);\n if (this.selective) {\n this.renderMetalness(renderer, this.metalnessOnMaterial, this.metalnessRenderTarget, 0, 0);\n }\n this.ssrMaterial.uniforms[\"opacity\"].value = this.opacity;\n this.ssrMaterial.uniforms[\"maxDistance\"].value = this.maxDistance;\n this.ssrMaterial.uniforms[\"thickness\"].value = this.thickness;\n this.renderPass(renderer, this.ssrMaterial, this.ssrRenderTarget);\n if (this.blur) {\n this.renderPass(renderer, this.blurMaterial, this.blurRenderTarget);\n this.renderPass(renderer, this.blurMaterial2, this.blurRenderTarget2);\n }\n switch (this.output) {\n case _SSRPass.OUTPUT.Default:\n if (this.bouncing) {\n this.copyMaterial.uniforms[\"tDiffuse\"].value = this.beautyRenderTarget.texture;\n this.copyMaterial.blending = three__WEBPACK_IMPORTED_MODULE_42__.NoBlending;\n this.renderPass(renderer, this.copyMaterial, this.prevRenderTarget);\n if (this.blur)\n this.copyMaterial.uniforms[\"tDiffuse\"].value = this.blurRenderTarget2.texture;\n else\n this.copyMaterial.uniforms[\"tDiffuse\"].value = this.ssrRenderTarget.texture;\n this.copyMaterial.blending = three__WEBPACK_IMPORTED_MODULE_42__.NormalBlending;\n this.renderPass(renderer, this.copyMaterial, this.prevRenderTarget);\n this.copyMaterial.uniforms[\"tDiffuse\"].value = this.prevRenderTarget.texture;\n this.copyMaterial.blending = three__WEBPACK_IMPORTED_MODULE_42__.NoBlending;\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer);\n } else {\n this.copyMaterial.uniforms[\"tDiffuse\"].value = this.beautyRenderTarget.texture;\n this.copyMaterial.blending = three__WEBPACK_IMPORTED_MODULE_42__.NoBlending;\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer);\n if (this.blur)\n this.copyMaterial.uniforms[\"tDiffuse\"].value = this.blurRenderTarget2.texture;\n else\n this.copyMaterial.uniforms[\"tDiffuse\"].value = this.ssrRenderTarget.texture;\n this.copyMaterial.blending = three__WEBPACK_IMPORTED_MODULE_42__.NormalBlending;\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer);\n }\n break;\n case _SSRPass.OUTPUT.SSR:\n if (this.blur)\n this.copyMaterial.uniforms[\"tDiffuse\"].value = this.blurRenderTarget2.texture;\n else\n this.copyMaterial.uniforms[\"tDiffuse\"].value = this.ssrRenderTarget.texture;\n this.copyMaterial.blending = three__WEBPACK_IMPORTED_MODULE_42__.NoBlending;\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer);\n if (this.bouncing) {\n if (this.blur)\n this.copyMaterial.uniforms[\"tDiffuse\"].value = this.blurRenderTarget2.texture;\n else\n this.copyMaterial.uniforms[\"tDiffuse\"].value = this.beautyRenderTarget.texture;\n this.copyMaterial.blending = three__WEBPACK_IMPORTED_MODULE_42__.NoBlending;\n this.renderPass(renderer, this.copyMaterial, this.prevRenderTarget);\n this.copyMaterial.uniforms[\"tDiffuse\"].value = this.ssrRenderTarget.texture;\n this.copyMaterial.blending = three__WEBPACK_IMPORTED_MODULE_42__.NormalBlending;\n this.renderPass(renderer, this.copyMaterial, this.prevRenderTarget);\n }\n break;\n case _SSRPass.OUTPUT.Beauty:\n this.copyMaterial.uniforms[\"tDiffuse\"].value = this.beautyRenderTarget.texture;\n this.copyMaterial.blending = three__WEBPACK_IMPORTED_MODULE_42__.NoBlending;\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer);\n break;\n case _SSRPass.OUTPUT.Depth:\n this.renderPass(renderer, this.depthRenderMaterial, this.renderToScreen ? null : writeBuffer);\n break;\n case _SSRPass.OUTPUT.Normal:\n this.copyMaterial.uniforms[\"tDiffuse\"].value = this.normalRenderTarget.texture;\n this.copyMaterial.blending = three__WEBPACK_IMPORTED_MODULE_42__.NoBlending;\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer);\n break;\n case _SSRPass.OUTPUT.Metalness:\n this.copyMaterial.uniforms[\"tDiffuse\"].value = this.metalnessRenderTarget.texture;\n this.copyMaterial.blending = three__WEBPACK_IMPORTED_MODULE_42__.NoBlending;\n this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer);\n break;\n default:\n console.warn(\"THREE.SSRPass: Unknown output type.\");\n }\n }\n renderPass(renderer, passMaterial, renderTarget, clearColor, clearAlpha) {\n this.originalClearColor.copy(renderer.getClearColor(this.tempColor));\n const originalClearAlpha = renderer.getClearAlpha(this.tempColor);\n const originalAutoClear = renderer.autoClear;\n renderer.setRenderTarget(renderTarget);\n renderer.autoClear = false;\n if (clearColor !== void 0 && clearColor !== null) {\n renderer.setClearColor(clearColor);\n renderer.setClearAlpha(clearAlpha || 0);\n renderer.clear();\n }\n this.fsQuad.material = passMaterial;\n this.fsQuad.render(renderer);\n renderer.autoClear = originalAutoClear;\n renderer.setClearColor(this.originalClearColor);\n renderer.setClearAlpha(originalClearAlpha);\n }\n renderOverride(renderer, overrideMaterial, renderTarget, clearColor, clearAlpha) {\n this.originalClearColor.copy(renderer.getClearColor(this.tempColor));\n const originalClearAlpha = renderer.getClearAlpha(this.tempColor);\n const originalAutoClear = renderer.autoClear;\n renderer.setRenderTarget(renderTarget);\n renderer.autoClear = false;\n clearColor = overrideMaterial.clearColor || clearColor;\n clearAlpha = overrideMaterial.clearAlpha || clearAlpha;\n if (clearColor !== void 0 && clearColor !== null) {\n renderer.setClearColor(clearColor);\n renderer.setClearAlpha(clearAlpha || 0);\n renderer.clear();\n }\n this.scene.overrideMaterial = overrideMaterial;\n renderer.render(this.scene, this.camera);\n this.scene.overrideMaterial = null;\n renderer.autoClear = originalAutoClear;\n renderer.setClearColor(this.originalClearColor);\n renderer.setClearAlpha(originalClearAlpha);\n }\n renderMetalness(renderer, overrideMaterial, renderTarget, clearColor, clearAlpha) {\n this.originalClearColor.copy(renderer.getClearColor(this.tempColor));\n const originalClearAlpha = renderer.getClearAlpha(this.tempColor);\n const originalAutoClear = renderer.autoClear;\n renderer.setRenderTarget(renderTarget);\n renderer.autoClear = false;\n clearColor = overrideMaterial.clearColor || clearColor;\n clearAlpha = overrideMaterial.clearAlpha || clearAlpha;\n if (clearColor !== void 0 && clearColor !== null) {\n renderer.setClearColor(clearColor);\n renderer.setClearAlpha(clearAlpha || 0);\n renderer.clear();\n }\n this.scene.traverseVisible((child) => {\n child._SSRPassBackupMaterial = child.material;\n if (this._selects.includes(child)) {\n child.material = this.metalnessOnMaterial;\n } else {\n child.material = this.metalnessOffMaterial;\n }\n });\n renderer.render(this.scene, this.camera);\n this.scene.traverseVisible((child) => {\n child.material = child._SSRPassBackupMaterial;\n });\n renderer.autoClear = originalAutoClear;\n renderer.setClearColor(this.originalClearColor);\n renderer.setClearAlpha(originalClearAlpha);\n }\n setSize(width, height) {\n this.width = width;\n this.height = height;\n this.ssrMaterial.defines.MAX_STEP = Math.sqrt(width * width + height * height);\n this.ssrMaterial.needsUpdate = true;\n this.beautyRenderTarget.setSize(width, height);\n this.prevRenderTarget.setSize(width, height);\n this.ssrRenderTarget.setSize(width, height);\n this.normalRenderTarget.setSize(width, height);\n this.metalnessRenderTarget.setSize(width, height);\n this.blurRenderTarget.setSize(width, height);\n this.blurRenderTarget2.setSize(width, height);\n this.ssrMaterial.uniforms[\"resolution\"].value.set(width, height);\n this.ssrMaterial.uniforms[\"cameraProjectionMatrix\"].value.copy(this.camera.projectionMatrix);\n this.ssrMaterial.uniforms[\"cameraInverseProjectionMatrix\"].value.copy(this.camera.projectionMatrixInverse);\n this.blurMaterial.uniforms[\"resolution\"].value.set(width, height);\n this.blurMaterial2.uniforms[\"resolution\"].value.set(width, height);\n }\n};\nlet SSRPass = _SSRPass;\n__publicField(SSRPass, \"OUTPUT\", {\n Default: 0,\n SSR: 1,\n Beauty: 3,\n Depth: 4,\n Normal: 5,\n Metalness: 7\n});\nclass SSAARenderPass extends Pass {\n constructor(scene, camera, clearColor, clearAlpha) {\n super();\n this.scene = scene;\n this.camera = camera;\n this.sampleLevel = 4;\n this.unbiased = true;\n this.clearColor = clearColor !== void 0 ? clearColor : 0;\n this.clearAlpha = clearAlpha !== void 0 ? clearAlpha : 0;\n this._oldClearColor = new three__WEBPACK_IMPORTED_MODULE_42__.Color();\n const copyShader = CopyShader;\n this.copyUniforms = three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(copyShader.uniforms);\n this.copyMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: this.copyUniforms,\n vertexShader: copyShader.vertexShader,\n fragmentShader: copyShader.fragmentShader,\n transparent: true,\n depthTest: false,\n depthWrite: false,\n premultipliedAlpha: true,\n blending: three__WEBPACK_IMPORTED_MODULE_42__.AdditiveBlending\n });\n this.fsQuad = new FullScreenQuad(this.copyMaterial);\n }\n dispose() {\n if (this.sampleRenderTarget) {\n this.sampleRenderTarget.dispose();\n this.sampleRenderTarget = null;\n }\n this.copyMaterial.dispose();\n this.fsQuad.dispose();\n }\n setSize(width, height) {\n if (this.sampleRenderTarget)\n this.sampleRenderTarget.setSize(width, height);\n }\n render(renderer, writeBuffer, readBuffer) {\n if (!this.sampleRenderTarget) {\n this.sampleRenderTarget = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(readBuffer.width, readBuffer.height, { type: three__WEBPACK_IMPORTED_MODULE_42__.HalfFloatType });\n this.sampleRenderTarget.texture.name = \"SSAARenderPass.sample\";\n }\n const jitterOffsets = _JitterVectors$1[Math.max(0, Math.min(this.sampleLevel, 5))];\n const autoClear = renderer.autoClear;\n renderer.autoClear = false;\n renderer.getClearColor(this._oldClearColor);\n const oldClearAlpha = renderer.getClearAlpha();\n const baseSampleWeight = 1 / jitterOffsets.length;\n const roundingRange = 1 / 32;\n this.copyUniforms[\"tDiffuse\"].value = this.sampleRenderTarget.texture;\n const viewOffset = {\n fullWidth: readBuffer.width,\n fullHeight: readBuffer.height,\n offsetX: 0,\n offsetY: 0,\n width: readBuffer.width,\n height: readBuffer.height\n };\n const originalViewOffset = Object.assign({}, this.camera.view);\n if (originalViewOffset.enabled)\n Object.assign(viewOffset, originalViewOffset);\n for (let i2 = 0; i2 < jitterOffsets.length; i2++) {\n const jitterOffset = jitterOffsets[i2];\n if (this.camera.setViewOffset) {\n this.camera.setViewOffset(\n viewOffset.fullWidth,\n viewOffset.fullHeight,\n viewOffset.offsetX + jitterOffset[0] * 0.0625,\n viewOffset.offsetY + jitterOffset[1] * 0.0625,\n // 0.0625 = 1 / 16\n viewOffset.width,\n viewOffset.height\n );\n }\n let sampleWeight = baseSampleWeight;\n if (this.unbiased) {\n const uniformCenteredDistribution = -0.5 + (i2 + 0.5) / jitterOffsets.length;\n sampleWeight += roundingRange * uniformCenteredDistribution;\n }\n this.copyUniforms[\"opacity\"].value = sampleWeight;\n renderer.setClearColor(this.clearColor, this.clearAlpha);\n renderer.setRenderTarget(this.sampleRenderTarget);\n renderer.clear();\n renderer.render(this.scene, this.camera);\n renderer.setRenderTarget(this.renderToScreen ? null : writeBuffer);\n if (i2 === 0) {\n renderer.setClearColor(0, 0);\n renderer.clear();\n }\n this.fsQuad.render(renderer);\n }\n if (this.camera.setViewOffset && originalViewOffset.enabled) {\n this.camera.setViewOffset(\n originalViewOffset.fullWidth,\n originalViewOffset.fullHeight,\n originalViewOffset.offsetX,\n originalViewOffset.offsetY,\n originalViewOffset.width,\n originalViewOffset.height\n );\n } else if (this.camera.clearViewOffset) {\n this.camera.clearViewOffset();\n }\n renderer.autoClear = autoClear;\n renderer.setClearColor(this._oldClearColor, oldClearAlpha);\n }\n}\nconst _JitterVectors$1 = [\n [\n [0, 0]\n ],\n [\n [4, 4],\n [-4, -4]\n ],\n [\n [-2, -6],\n [6, -2],\n [-6, 2],\n [2, 6]\n ],\n [\n [1, -3],\n [-1, 3],\n [5, 1],\n [-3, -5],\n [-5, 5],\n [-7, -1],\n [3, 7],\n [7, -7]\n ],\n [\n [1, 1],\n [-1, -3],\n [-3, 2],\n [4, -1],\n [-5, -2],\n [2, 5],\n [5, 3],\n [3, -5],\n [-2, 6],\n [0, -7],\n [-4, -6],\n [-6, 4],\n [-8, 0],\n [7, -4],\n [6, 7],\n [-7, -8]\n ],\n [\n [-4, -7],\n [-7, -5],\n [-3, -5],\n [-5, -4],\n [-1, -4],\n [-2, -2],\n [-6, -1],\n [-4, 0],\n [-7, 1],\n [-1, 2],\n [-6, 3],\n [-3, 3],\n [-7, 6],\n [-3, 6],\n [-5, 7],\n [-1, 7],\n [5, -7],\n [1, -6],\n [6, -5],\n [4, -4],\n [2, -3],\n [7, -2],\n [1, -1],\n [4, -1],\n [2, 1],\n [6, 2],\n [0, 4],\n [4, 4],\n [2, 5],\n [7, 5],\n [5, 6],\n [3, 7]\n ]\n];\nclass TAARenderPass extends SSAARenderPass {\n constructor(scene, camera, clearColor, clearAlpha) {\n super(scene, camera, clearColor, clearAlpha);\n this.sampleLevel = 0;\n this.accumulate = false;\n this.accumulateIndex = -1;\n }\n render(renderer, writeBuffer, readBuffer, deltaTime) {\n if (this.accumulate === false) {\n super.render(renderer, writeBuffer, readBuffer, deltaTime);\n this.accumulateIndex = -1;\n return;\n }\n const jitterOffsets = _JitterVectors[5];\n if (this.sampleRenderTarget === void 0) {\n this.sampleRenderTarget = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(readBuffer.width, readBuffer.height, { type: three__WEBPACK_IMPORTED_MODULE_42__.HalfFloatType });\n this.sampleRenderTarget.texture.name = \"TAARenderPass.sample\";\n }\n if (this.holdRenderTarget === void 0) {\n this.holdRenderTarget = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(readBuffer.width, readBuffer.height, { type: three__WEBPACK_IMPORTED_MODULE_42__.HalfFloatType });\n this.holdRenderTarget.texture.name = \"TAARenderPass.hold\";\n }\n if (this.accumulateIndex === -1) {\n super.render(renderer, this.holdRenderTarget, readBuffer, deltaTime);\n this.accumulateIndex = 0;\n }\n const autoClear = renderer.autoClear;\n renderer.autoClear = false;\n renderer.getClearColor(this._oldClearColor);\n const oldClearAlpha = renderer.getClearAlpha();\n const sampleWeight = 1 / jitterOffsets.length;\n if (this.accumulateIndex >= 0 && this.accumulateIndex < jitterOffsets.length) {\n this.copyUniforms[\"opacity\"].value = sampleWeight;\n this.copyUniforms[\"tDiffuse\"].value = writeBuffer.texture;\n const numSamplesPerFrame = Math.pow(2, this.sampleLevel);\n for (let i2 = 0; i2 < numSamplesPerFrame; i2++) {\n const j = this.accumulateIndex;\n const jitterOffset = jitterOffsets[j];\n if (this.camera.setViewOffset) {\n this.camera.setViewOffset(\n readBuffer.width,\n readBuffer.height,\n jitterOffset[0] * 0.0625,\n jitterOffset[1] * 0.0625,\n // 0.0625 = 1 / 16\n readBuffer.width,\n readBuffer.height\n );\n }\n renderer.setRenderTarget(writeBuffer);\n renderer.setClearColor(this.clearColor, this.clearAlpha);\n renderer.clear();\n renderer.render(this.scene, this.camera);\n renderer.setRenderTarget(this.sampleRenderTarget);\n if (this.accumulateIndex === 0) {\n renderer.setClearColor(0, 0);\n renderer.clear();\n }\n this.fsQuad.render(renderer);\n this.accumulateIndex++;\n if (this.accumulateIndex >= jitterOffsets.length)\n break;\n }\n if (this.camera.clearViewOffset)\n this.camera.clearViewOffset();\n }\n renderer.setClearColor(this.clearColor, this.clearAlpha);\n const accumulationWeight = this.accumulateIndex * sampleWeight;\n if (accumulationWeight > 0) {\n this.copyUniforms[\"opacity\"].value = 1;\n this.copyUniforms[\"tDiffuse\"].value = this.sampleRenderTarget.texture;\n renderer.setRenderTarget(writeBuffer);\n renderer.clear();\n this.fsQuad.render(renderer);\n }\n if (accumulationWeight < 1) {\n this.copyUniforms[\"opacity\"].value = 1 - accumulationWeight;\n this.copyUniforms[\"tDiffuse\"].value = this.holdRenderTarget.texture;\n renderer.setRenderTarget(writeBuffer);\n this.fsQuad.render(renderer);\n }\n renderer.autoClear = autoClear;\n renderer.setClearColor(this._oldClearColor, oldClearAlpha);\n }\n dispose() {\n super.dispose();\n if (this.sampleRenderTarget !== void 0)\n this.sampleRenderTarget.dispose();\n if (this.holdRenderTarget !== void 0)\n this.holdRenderTarget.dispose();\n }\n}\nconst _JitterVectors = [\n [\n [0, 0]\n ],\n [\n [4, 4],\n [-4, -4]\n ],\n [\n [-2, -6],\n [6, -2],\n [-6, 2],\n [2, 6]\n ],\n [\n [1, -3],\n [-1, 3],\n [5, 1],\n [-3, -5],\n [-5, 5],\n [-7, -1],\n [3, 7],\n [7, -7]\n ],\n [\n [1, 1],\n [-1, -3],\n [-3, 2],\n [4, -1],\n [-5, -2],\n [2, 5],\n [5, 3],\n [3, -5],\n [-2, 6],\n [0, -7],\n [-4, -6],\n [-6, 4],\n [-8, 0],\n [7, -4],\n [6, 7],\n [-7, -8]\n ],\n [\n [-4, -7],\n [-7, -5],\n [-3, -5],\n [-5, -4],\n [-1, -4],\n [-2, -2],\n [-6, -1],\n [-4, 0],\n [-7, 1],\n [-1, 2],\n [-6, 3],\n [-3, 3],\n [-7, 6],\n [-3, 6],\n [-5, 7],\n [-1, 7],\n [5, -7],\n [1, -6],\n [6, -5],\n [4, -4],\n [2, -3],\n [7, -2],\n [1, -1],\n [4, -1],\n [2, 1],\n [6, 2],\n [0, 4],\n [4, 4],\n [2, 5],\n [7, 5],\n [5, 6],\n [3, 7]\n ]\n];\nclass RenderPass extends Pass {\n constructor(scene, camera, overrideMaterial, clearColor, clearAlpha = 0) {\n super();\n __publicField(this, \"scene\");\n __publicField(this, \"camera\");\n __publicField(this, \"overrideMaterial\");\n __publicField(this, \"clearColor\");\n __publicField(this, \"clearAlpha\");\n __publicField(this, \"clearDepth\", false);\n __publicField(this, \"_oldClearColor\", new three__WEBPACK_IMPORTED_MODULE_42__.Color());\n this.scene = scene;\n this.camera = camera;\n this.overrideMaterial = overrideMaterial;\n this.clearColor = clearColor;\n this.clearAlpha = clearAlpha;\n this.clear = true;\n this.needsSwap = false;\n }\n render(renderer, writeBuffer, readBuffer) {\n let oldAutoClear = renderer.autoClear;\n renderer.autoClear = false;\n let oldClearAlpha;\n let oldOverrideMaterial = null;\n if (this.overrideMaterial !== void 0) {\n oldOverrideMaterial = this.scene.overrideMaterial;\n this.scene.overrideMaterial = this.overrideMaterial;\n }\n if (this.clearColor) {\n renderer.getClearColor(this._oldClearColor);\n oldClearAlpha = renderer.getClearAlpha();\n renderer.setClearColor(this.clearColor, this.clearAlpha);\n }\n if (this.clearDepth) {\n renderer.clearDepth();\n }\n renderer.setRenderTarget(this.renderToScreen ? null : readBuffer);\n if (this.clear)\n renderer.clear(renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil);\n renderer.render(this.scene, this.camera);\n if (this.clearColor) {\n renderer.setClearColor(this._oldClearColor, oldClearAlpha);\n }\n if (this.overrideMaterial !== void 0) {\n this.scene.overrideMaterial = oldOverrideMaterial;\n }\n renderer.autoClear = oldAutoClear;\n }\n}\nclass RenderPixelatedPass extends Pass {\n constructor(resolution, pixelSize, scene, camera, options = {}) {\n var _a2, _b2;\n super();\n this.pixelSize = pixelSize;\n this.resolution = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2();\n this.renderResolution = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2();\n this.setSize(resolution.x, resolution.y);\n this.fsQuad = new FullScreenQuad(this.material());\n this.scene = scene;\n this.camera = camera;\n this.normalEdgeStrength = (_a2 = options.normalEdgeStrength) != null ? _a2 : 0.3;\n this.depthEdgeStrength = (_b2 = options.depthEdgeStrength) != null ? _b2 : 0.4;\n this.rgbRenderTarget = pixelRenderTarget(this.renderResolution, three__WEBPACK_IMPORTED_MODULE_42__.RGBAFormat, true);\n this.normalRenderTarget = pixelRenderTarget(this.renderResolution, three__WEBPACK_IMPORTED_MODULE_42__.RGBAFormat, false);\n this.normalMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.MeshNormalMaterial();\n }\n dispose() {\n this.rgbRenderTarget.dispose();\n this.normalRenderTarget.dispose();\n this.fsQuad.dispose();\n }\n setSize(width, height) {\n var _a2, _b2, _c;\n this.resolution.set(width, height);\n this.renderResolution.set(width / this.pixelSize | 0, height / this.pixelSize | 0);\n const { x, y } = this.renderResolution;\n (_a2 = this.rgbRenderTarget) == null ? void 0 : _a2.setSize(x, y);\n (_b2 = this.normalRenderTarget) == null ? void 0 : _b2.setSize(x, y);\n (_c = this.fsQuad) == null ? void 0 : _c.material.uniforms.resolution.value.set(x, y, 1 / x, 1 / y);\n }\n setPixelSize(pixelSize) {\n this.pixelSize = pixelSize;\n this.setSize(this.resolution.x, this.resolution.y);\n }\n render(renderer, writeBuffer) {\n const uniforms = this.fsQuad.material.uniforms;\n uniforms.normalEdgeStrength.value = this.normalEdgeStrength;\n uniforms.depthEdgeStrength.value = this.depthEdgeStrength;\n renderer.setRenderTarget(this.rgbRenderTarget);\n renderer.render(this.scene, this.camera);\n const overrideMaterial_old = this.scene.overrideMaterial;\n renderer.setRenderTarget(this.normalRenderTarget);\n this.scene.overrideMaterial = this.normalMaterial;\n renderer.render(this.scene, this.camera);\n this.scene.overrideMaterial = overrideMaterial_old;\n uniforms.tDiffuse.value = this.rgbRenderTarget.texture;\n uniforms.tDepth.value = this.rgbRenderTarget.depthTexture;\n uniforms.tNormal.value = this.normalRenderTarget.texture;\n if (this.renderToScreen) {\n renderer.setRenderTarget(null);\n } else {\n renderer.setRenderTarget(writeBuffer);\n if (this.clear)\n renderer.clear();\n }\n this.fsQuad.render(renderer);\n }\n material() {\n return new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: {\n tDiffuse: { value: null },\n tDepth: { value: null },\n tNormal: { value: null },\n resolution: {\n value: new three__WEBPACK_IMPORTED_MODULE_42__.Vector4(\n this.renderResolution.x,\n this.renderResolution.y,\n 1 / this.renderResolution.x,\n 1 / this.renderResolution.y\n )\n },\n normalEdgeStrength: { value: 0 },\n depthEdgeStrength: { value: 0 }\n },\n vertexShader: `\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t\t\t}\n\t\t\t\t`,\n fragmentShader: `\n\t\t\t\tuniform sampler2D tDiffuse;\n\t\t\t\tuniform sampler2D tDepth;\n\t\t\t\tuniform sampler2D tNormal;\n\t\t\t\tuniform vec4 resolution;\n\t\t\t\tuniform float normalEdgeStrength;\n\t\t\t\tuniform float depthEdgeStrength;\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t\tfloat getDepth(int x, int y) {\n\n\t\t\t\t\treturn texture2D( tDepth, vUv + vec2(x, y) * resolution.zw ).r;\n\n\t\t\t\t}\n\n\t\t\t\tvec3 getNormal(int x, int y) {\n\n\t\t\t\t\treturn texture2D( tNormal, vUv + vec2(x, y) * resolution.zw ).rgb * 2.0 - 1.0;\n\n\t\t\t\t}\n\n\t\t\t\tfloat depthEdgeIndicator(float depth, vec3 normal) {\n\n\t\t\t\t\tfloat diff = 0.0;\n\t\t\t\t\tdiff += clamp(getDepth(1, 0) - depth, 0.0, 1.0);\n\t\t\t\t\tdiff += clamp(getDepth(-1, 0) - depth, 0.0, 1.0);\n\t\t\t\t\tdiff += clamp(getDepth(0, 1) - depth, 0.0, 1.0);\n\t\t\t\t\tdiff += clamp(getDepth(0, -1) - depth, 0.0, 1.0);\n\t\t\t\t\treturn floor(smoothstep(0.01, 0.02, diff) * 2.) / 2.;\n\n\t\t\t\t}\n\n\t\t\t\tfloat neighborNormalEdgeIndicator(int x, int y, float depth, vec3 normal) {\n\n\t\t\t\t\tfloat depthDiff = getDepth(x, y) - depth;\n\t\t\t\t\tvec3 neighborNormal = getNormal(x, y);\n\t\t\t\t\t\n\t\t\t\t\t// Edge pixels should yield to faces who's normals are closer to the bias normal.\n\t\t\t\t\tvec3 normalEdgeBias = vec3(1., 1., 1.); // This should probably be a parameter.\n\t\t\t\t\tfloat normalDiff = dot(normal - neighborNormal, normalEdgeBias);\n\t\t\t\t\tfloat normalIndicator = clamp(smoothstep(-.01, .01, normalDiff), 0.0, 1.0);\n\t\t\t\t\t\n\t\t\t\t\t// Only the shallower pixel should detect the normal edge.\n\t\t\t\t\tfloat depthIndicator = clamp(sign(depthDiff * .25 + .0025), 0.0, 1.0);\n\n\t\t\t\t\treturn (1.0 - dot(normal, neighborNormal)) * depthIndicator * normalIndicator;\n\n\t\t\t\t}\n\n\t\t\t\tfloat normalEdgeIndicator(float depth, vec3 normal) {\n\t\t\t\t\t\n\t\t\t\t\tfloat indicator = 0.0;\n\n\t\t\t\t\tindicator += neighborNormalEdgeIndicator(0, -1, depth, normal);\n\t\t\t\t\tindicator += neighborNormalEdgeIndicator(0, 1, depth, normal);\n\t\t\t\t\tindicator += neighborNormalEdgeIndicator(-1, 0, depth, normal);\n\t\t\t\t\tindicator += neighborNormalEdgeIndicator(1, 0, depth, normal);\n\n\t\t\t\t\treturn step(0.1, indicator);\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\n\t\t\t\t\tfloat depth = 0.0;\n\t\t\t\t\tvec3 normal = vec3(0.0);\n\n\t\t\t\t\tif (depthEdgeStrength > 0.0 || normalEdgeStrength > 0.0) {\n\n\t\t\t\t\t\tdepth = getDepth(0, 0);\n\t\t\t\t\t\tnormal = getNormal(0, 0);\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat dei = 0.0;\n\t\t\t\t\tif (depthEdgeStrength > 0.0) \n\t\t\t\t\t\tdei = depthEdgeIndicator(depth, normal);\n\n\t\t\t\t\tfloat nei = 0.0; \n\t\t\t\t\tif (normalEdgeStrength > 0.0) \n\t\t\t\t\t\tnei = normalEdgeIndicator(depth, normal);\n\n\t\t\t\t\tfloat Strength = dei > 0.0 ? (1.0 - depthEdgeStrength * dei) : (1.0 + normalEdgeStrength * nei);\n\n\t\t\t\t\tgl_FragColor = texel * Strength;\n\n\t\t\t\t}\n\t\t\t\t`\n });\n }\n}\nfunction pixelRenderTarget(resolution, pixelFormat, useDepthTexture) {\n const renderTarget = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(\n resolution.x,\n resolution.y,\n !useDepthTexture ? void 0 : {\n depthTexture: new three__WEBPACK_IMPORTED_MODULE_42__.DepthTexture(resolution.x, resolution.y),\n depthBuffer: true\n }\n );\n renderTarget.texture.format = pixelFormat;\n renderTarget.texture.minFilter = three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter;\n renderTarget.texture.magFilter = three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter;\n renderTarget.texture.generateMipmaps = false;\n renderTarget.stencilBuffer = false;\n return renderTarget;\n}\nconst ConvolutionShader = {\n defines: {\n KERNEL_SIZE_FLOAT: \"25.0\",\n KERNEL_SIZE_INT: \"25\"\n },\n uniforms: {\n tDiffuse: { value: null },\n uImageIncrement: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(1953125e-9, 0) },\n cKernel: { value: [] }\n },\n vertexShader: [\n \"uniform vec2 uImageIncrement;\",\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv - ( ( KERNEL_SIZE_FLOAT - 1.0 ) / 2.0 ) * uImageIncrement;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform float cKernel[ KERNEL_SIZE_INT ];\",\n \"uniform sampler2D tDiffuse;\",\n \"uniform vec2 uImageIncrement;\",\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvec2 imageCoord = vUv;\",\n \"\tvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\",\n \"\tfor( int i = 0; i < KERNEL_SIZE_INT; i ++ ) {\",\n \"\t\tsum += texture2D( tDiffuse, imageCoord ) * cKernel[ i ];\",\n \"\t\timageCoord += uImageIncrement;\",\n \"\t}\",\n \"\tgl_FragColor = sum;\",\n \"}\"\n ].join(\"\\n\"),\n buildKernel: function(sigma) {\n function gauss(x, sigma2) {\n return Math.exp(-(x * x) / (2 * sigma2 * sigma2));\n }\n const kMaxKernelSize = 25;\n const kernelSize = Math.min(2 * Math.ceil(sigma * 3) + 1, kMaxKernelSize);\n const halfWidth = (kernelSize - 1) * 0.5;\n const values = new Array(kernelSize);\n let sum = 0;\n for (let i2 = 0; i2 < kernelSize; ++i2) {\n values[i2] = gauss(i2 - halfWidth, sigma);\n sum += values[i2];\n }\n for (let i2 = 0; i2 < kernelSize; ++i2)\n values[i2] /= sum;\n return values;\n }\n};\nclass BloomPass extends Pass {\n constructor(strength = 1, kernelSize = 25, sigma = 4, resolution = 256) {\n super();\n __publicField(this, \"renderTargetX\");\n __publicField(this, \"renderTargetY\");\n __publicField(this, \"materialCombine\");\n __publicField(this, \"materialConvolution\");\n __publicField(this, \"fsQuad\");\n __publicField(this, \"combineUniforms\");\n __publicField(this, \"convolutionUniforms\");\n __publicField(this, \"blurX\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(1953125e-9, 0));\n __publicField(this, \"blurY\", new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(0, 1953125e-9));\n this.renderTargetX = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(resolution, resolution);\n this.renderTargetX.texture.name = \"BloomPass.x\";\n this.renderTargetY = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(resolution, resolution);\n this.renderTargetY.texture.name = \"BloomPass.y\";\n this.combineUniforms = three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(CombineShader.uniforms);\n this.combineUniforms[\"strength\"].value = strength;\n this.materialCombine = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: this.combineUniforms,\n vertexShader: CombineShader.vertexShader,\n fragmentShader: CombineShader.fragmentShader,\n blending: three__WEBPACK_IMPORTED_MODULE_42__.AdditiveBlending,\n transparent: true\n });\n if (ConvolutionShader === void 0)\n console.error(\"BloomPass relies on ConvolutionShader\");\n const convolutionShader = ConvolutionShader;\n this.convolutionUniforms = three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone(convolutionShader.uniforms);\n this.convolutionUniforms[\"uImageIncrement\"].value = this.blurX;\n this.convolutionUniforms[\"cKernel\"].value = ConvolutionShader.buildKernel(sigma);\n this.materialConvolution = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: this.convolutionUniforms,\n vertexShader: convolutionShader.vertexShader,\n fragmentShader: convolutionShader.fragmentShader,\n defines: {\n KERNEL_SIZE_FLOAT: kernelSize.toFixed(1),\n KERNEL_SIZE_INT: kernelSize.toFixed(0)\n }\n });\n this.needsSwap = false;\n this.fsQuad = new FullScreenQuad(this.materialConvolution);\n }\n render(renderer, writeBuffer, readBuffer, deltaTime, maskActive) {\n if (maskActive)\n renderer.state.buffers.stencil.setTest(false);\n this.fsQuad.material = this.materialConvolution;\n this.convolutionUniforms[\"tDiffuse\"].value = readBuffer.texture;\n this.convolutionUniforms[\"uImageIncrement\"].value = this.blurX;\n renderer.setRenderTarget(this.renderTargetX);\n renderer.clear();\n this.fsQuad.render(renderer);\n this.convolutionUniforms[\"tDiffuse\"].value = this.renderTargetX.texture;\n this.convolutionUniforms[\"uImageIncrement\"].value = this.blurY;\n renderer.setRenderTarget(this.renderTargetY);\n renderer.clear();\n this.fsQuad.render(renderer);\n this.fsQuad.material = this.materialCombine;\n this.combineUniforms[\"tDiffuse\"].value = this.renderTargetY.texture;\n if (maskActive)\n renderer.state.buffers.stencil.setTest(true);\n renderer.setRenderTarget(readBuffer);\n if (this.clear)\n renderer.clear();\n this.fsQuad.render(renderer);\n }\n}\nconst CombineShader = {\n uniforms: {\n tDiffuse: {\n value: null\n },\n strength: {\n value: 1\n }\n },\n vertexShader: (\n /* glsl */\n `\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }`\n ),\n fragmentShader: (\n /* glsl */\n `\n uniform float strength;\n uniform sampler2D tDiffuse;\n varying vec2 vUv;\n void main() {\n vec4 texel = texture2D( tDiffuse, vUv );\n gl_FragColor = strength * texel;\n }`\n )\n};\nclass WaterPass extends Pass {\n constructor() {\n super();\n __publicField(this, \"material\");\n __publicField(this, \"fsQuad\");\n __publicField(this, \"factor\");\n __publicField(this, \"time\");\n __publicField(this, \"uniforms\");\n this.uniforms = three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.clone({\n tex: { value: null },\n time: { value: 0 },\n factor: { value: 0 },\n resolution: { value: new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(64, 64) }\n });\n this.material = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: this.uniforms,\n vertexShader: `\n varying vec2 vUv;\n void main(){ \n vUv = uv; \n vec4 modelViewPosition = modelViewMatrix * vec4(position, 1.0);\n gl_Position = projectionMatrix * modelViewPosition;\n }`,\n fragmentShader: `\n uniform float time;\n uniform float factor;\n uniform vec2 resolution;\n uniform sampler2D tex;\n varying vec2 vUv;\n void main() { \n vec2 uv1 = vUv;\n vec2 uv = gl_FragCoord.xy/resolution.xy;\n float frequency = 6.0 * factor;\n float amplitude = 0.015 * factor;\n float x = uv1.y * frequency + time * .7; \n float y = uv1.x * frequency + time * .3;\n uv1.x += cos(x+y) * amplitude * cos(y);\n uv1.y += sin(x-y) * amplitude * cos(y);\n vec4 rgba = texture2D(tex, uv1);\n gl_FragColor = rgba;\n }`\n });\n this.fsQuad = new FullScreenQuad(this.material);\n this.factor = 0;\n this.time = 0;\n }\n render(renderer, writeBuffer, readBuffer) {\n this.uniforms[\"tex\"].value = readBuffer.texture;\n this.uniforms[\"time\"].value = this.time;\n this.uniforms[\"factor\"].value = this.factor;\n if (this.renderToScreen) {\n renderer.setRenderTarget(null);\n this.fsQuad.render(renderer);\n } else {\n renderer.setRenderTarget(writeBuffer);\n if (this.clear)\n renderer.clear();\n this.fsQuad.render(renderer);\n }\n }\n}\nclass ARButton {\n static createButton(renderer, sessionInit = {}) {\n const button = document.createElement(\"button\");\n function showStartAR() {\n if (sessionInit.domOverlay === void 0) {\n const overlay = document.createElement(\"div\");\n overlay.style.display = \"none\";\n document.body.appendChild(overlay);\n const svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n svg.setAttribute(\"width\", \"38px\");\n svg.setAttribute(\"height\", \"38px\");\n svg.style.position = \"absolute\";\n svg.style.right = \"20px\";\n svg.style.top = \"20px\";\n svg.addEventListener(\"click\", function() {\n currentSession == null ? void 0 : currentSession.end();\n });\n overlay.appendChild(svg);\n const path = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\");\n path.setAttribute(\"d\", \"M 12,12 L 28,28 M 28,12 12,28\");\n path.setAttribute(\"stroke\", \"#fff\");\n path.setAttribute(\"stroke-width\", \"2px\");\n svg.appendChild(path);\n if (sessionInit.optionalFeatures === void 0) {\n sessionInit.optionalFeatures = [];\n }\n sessionInit.optionalFeatures.push(\"dom-overlay\");\n sessionInit.domOverlay = { root: overlay };\n }\n let currentSession = null;\n async function onSessionStarted(session) {\n session.addEventListener(\"end\", onSessionEnded);\n renderer.xr.setReferenceSpaceType(\"local\");\n await renderer.xr.setSession(session);\n button.textContent = \"STOP AR\";\n sessionInit.domOverlay.root.style.display = \"\";\n currentSession = session;\n }\n function onSessionEnded() {\n currentSession.removeEventListener(\"end\", onSessionEnded);\n button.textContent = \"START AR\";\n sessionInit.domOverlay.root.style.display = \"none\";\n currentSession = null;\n }\n button.style.display = \"\";\n button.style.cursor = \"pointer\";\n button.style.left = \"calc(50% - 50px)\";\n button.style.width = \"100px\";\n button.textContent = \"START AR\";\n button.onmouseenter = () => {\n button.style.opacity = \"1.0\";\n };\n button.onmouseleave = () => {\n button.style.opacity = \"0.5\";\n };\n button.onclick = () => {\n if (currentSession === null) {\n navigator.xr.requestSession(\"immersive-ar\", sessionInit).then(onSessionStarted);\n } else {\n currentSession.end();\n }\n };\n }\n function disableButton() {\n button.style.display = \"\";\n button.style.cursor = \"auto\";\n button.style.left = \"calc(50% - 75px)\";\n button.style.width = \"150px\";\n button.onmouseenter = null;\n button.onmouseleave = null;\n button.onclick = null;\n }\n function showARNotSupported() {\n disableButton();\n button.textContent = \"AR NOT SUPPORTED\";\n }\n function stylizeElement(element) {\n element.style.position = \"absolute\";\n element.style.bottom = \"20px\";\n element.style.padding = \"12px 6px\";\n element.style.border = \"1px solid #fff\";\n element.style.borderRadius = \"4px\";\n element.style.background = \"rgba(0,0,0,0.1)\";\n element.style.color = \"#fff\";\n element.style.font = \"normal 13px sans-serif\";\n element.style.textAlign = \"center\";\n element.style.opacity = \"0.5\";\n element.style.outline = \"none\";\n element.style.zIndex = \"999\";\n }\n if (\"xr\" in navigator) {\n button.id = \"ARButton\";\n button.style.display = \"none\";\n stylizeElement(button);\n navigator.xr.isSessionSupported(\"immersive-ar\").then(function(supported) {\n supported ? showStartAR() : showARNotSupported();\n }).catch(showARNotSupported);\n return button;\n } else {\n const message = document.createElement(\"a\");\n if (window.isSecureContext === false) {\n message.href = document.location.href.replace(/^http:/, \"https:\");\n message.innerHTML = \"WEBXR NEEDS HTTPS\";\n } else {\n message.href = \"https://immersiveweb.dev/\";\n message.innerHTML = \"WEBXR NOT AVAILABLE\";\n }\n message.style.left = \"calc(50% - 90px)\";\n message.style.width = \"180px\";\n message.style.textDecoration = \"none\";\n stylizeElement(message);\n return message;\n }\n }\n}\nclass GLTFLoader extends three__WEBPACK_IMPORTED_MODULE_42__.Loader {\n constructor(manager) {\n super(manager);\n this.dracoLoader = null;\n this.ktx2Loader = null;\n this.meshoptDecoder = null;\n this.pluginCallbacks = [];\n this.register(function(parser2) {\n return new GLTFMaterialsClearcoatExtension2(parser2);\n });\n this.register(function(parser2) {\n return new GLTFTextureBasisUExtension(parser2);\n });\n this.register(function(parser2) {\n return new GLTFTextureWebPExtension(parser2);\n });\n this.register(function(parser2) {\n return new GLTFTextureAVIFExtension(parser2);\n });\n this.register(function(parser2) {\n return new GLTFMaterialsSheenExtension2(parser2);\n });\n this.register(function(parser2) {\n return new GLTFMaterialsTransmissionExtension2(parser2);\n });\n this.register(function(parser2) {\n return new GLTFMaterialsVolumeExtension2(parser2);\n });\n this.register(function(parser2) {\n return new GLTFMaterialsIorExtension2(parser2);\n });\n this.register(function(parser2) {\n return new GLTFMaterialsEmissiveStrengthExtension2(parser2);\n });\n this.register(function(parser2) {\n return new GLTFMaterialsSpecularExtension2(parser2);\n });\n this.register(function(parser2) {\n return new GLTFMaterialsIridescenceExtension2(parser2);\n });\n this.register(function(parser2) {\n return new GLTFMaterialsAnisotropyExtension2(parser2);\n });\n this.register(function(parser2) {\n return new GLTFLightsExtension(parser2);\n });\n this.register(function(parser2) {\n return new GLTFMeshoptCompression(parser2);\n });\n this.register(function(parser2) {\n return new GLTFMeshGpuInstancing(parser2);\n });\n }\n load(url, onLoad, onProgress, onError) {\n const scope = this;\n let resourcePath;\n if (this.resourcePath !== \"\") {\n resourcePath = this.resourcePath;\n } else if (this.path !== \"\") {\n resourcePath = this.path;\n } else {\n resourcePath = three__WEBPACK_IMPORTED_MODULE_42__.LoaderUtils.extractUrlBase(url);\n }\n this.manager.itemStart(url);\n const _onError = function(e) {\n if (onError) {\n onError(e);\n } else {\n console.error(e);\n }\n scope.manager.itemError(url);\n scope.manager.itemEnd(url);\n };\n const loader = new three__WEBPACK_IMPORTED_MODULE_42__.FileLoader(this.manager);\n loader.setPath(this.path);\n loader.setResponseType(\"arraybuffer\");\n loader.setRequestHeader(this.requestHeader);\n loader.setWithCredentials(this.withCredentials);\n loader.load(\n url,\n function(data) {\n try {\n scope.parse(\n data,\n resourcePath,\n function(gltf) {\n onLoad(gltf);\n scope.manager.itemEnd(url);\n },\n _onError\n );\n } catch (e) {\n _onError(e);\n }\n },\n onProgress,\n _onError\n );\n }\n setDRACOLoader(dracoLoader) {\n this.dracoLoader = dracoLoader;\n return this;\n }\n setDDSLoader() {\n throw new Error('THREE.GLTFLoader: \"MSFT_texture_dds\" no longer supported. Please update to \"KHR_texture_basisu\".');\n }\n setKTX2Loader(ktx2Loader) {\n this.ktx2Loader = ktx2Loader;\n return this;\n }\n setMeshoptDecoder(meshoptDecoder) {\n this.meshoptDecoder = meshoptDecoder;\n return this;\n }\n register(callback) {\n if (this.pluginCallbacks.indexOf(callback) === -1) {\n this.pluginCallbacks.push(callback);\n }\n return this;\n }\n unregister(callback) {\n if (this.pluginCallbacks.indexOf(callback) !== -1) {\n this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(callback), 1);\n }\n return this;\n }\n parse(data, path, onLoad, onError) {\n let json;\n const extensions = {};\n const plugins = {};\n if (typeof data === \"string\") {\n json = JSON.parse(data);\n } else if (data instanceof ArrayBuffer) {\n const magic = three__WEBPACK_IMPORTED_MODULE_42__.LoaderUtils.decodeText(new Uint8Array(data.slice(0, 4)));\n if (magic === BINARY_EXTENSION_HEADER_MAGIC) {\n try {\n extensions[EXTENSIONS.KHR_BINARY_GLTF] = new GLTFBinaryExtension(data);\n } catch (error) {\n if (onError)\n onError(error);\n return;\n }\n json = JSON.parse(extensions[EXTENSIONS.KHR_BINARY_GLTF].content);\n } else {\n json = JSON.parse(three__WEBPACK_IMPORTED_MODULE_42__.LoaderUtils.decodeText(new Uint8Array(data)));\n }\n } else {\n json = data;\n }\n if (json.asset === void 0 || json.asset.version[0] < 2) {\n if (onError)\n onError(new Error(\"THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.\"));\n return;\n }\n const parser2 = new GLTFParser(json, {\n path: path || this.resourcePath || \"\",\n crossOrigin: this.crossOrigin,\n requestHeader: this.requestHeader,\n manager: this.manager,\n ktx2Loader: this.ktx2Loader,\n meshoptDecoder: this.meshoptDecoder\n });\n parser2.fileLoader.setRequestHeader(this.requestHeader);\n for (let i2 = 0; i2 < this.pluginCallbacks.length; i2++) {\n const plugin = this.pluginCallbacks[i2](parser2);\n plugins[plugin.name] = plugin;\n extensions[plugin.name] = true;\n }\n if (json.extensionsUsed) {\n for (let i2 = 0; i2 < json.extensionsUsed.length; ++i2) {\n const extensionName = json.extensionsUsed[i2];\n const extensionsRequired = json.extensionsRequired || [];\n switch (extensionName) {\n case EXTENSIONS.KHR_MATERIALS_UNLIT:\n extensions[extensionName] = new GLTFMaterialsUnlitExtension2();\n break;\n case EXTENSIONS.KHR_DRACO_MESH_COMPRESSION:\n extensions[extensionName] = new GLTFDracoMeshCompressionExtension(json, this.dracoLoader);\n break;\n case EXTENSIONS.KHR_TEXTURE_TRANSFORM:\n extensions[extensionName] = new GLTFTextureTransformExtension();\n break;\n case EXTENSIONS.KHR_MESH_QUANTIZATION:\n extensions[extensionName] = new GLTFMeshQuantizationExtension();\n break;\n default:\n if (extensionsRequired.indexOf(extensionName) >= 0 && plugins[extensionName] === void 0) {\n console.warn('THREE.GLTFLoader: Unknown extension \"' + extensionName + '\".');\n }\n }\n }\n }\n parser2.setExtensions(extensions);\n parser2.setPlugins(plugins);\n parser2.parse(onLoad, onError);\n }\n parseAsync(data, path) {\n const scope = this;\n return new Promise(function(resolve, reject) {\n scope.parse(data, path, resolve, reject);\n });\n }\n}\nfunction GLTFRegistry() {\n let objects = {};\n return {\n get: function(key) {\n return objects[key];\n },\n add: function(key, object) {\n objects[key] = object;\n },\n remove: function(key) {\n delete objects[key];\n },\n removeAll: function() {\n objects = {};\n }\n };\n}\nconst EXTENSIONS = {\n KHR_BINARY_GLTF: \"KHR_binary_glTF\",\n KHR_DRACO_MESH_COMPRESSION: \"KHR_draco_mesh_compression\",\n KHR_LIGHTS_PUNCTUAL: \"KHR_lights_punctual\",\n KHR_MATERIALS_CLEARCOAT: \"KHR_materials_clearcoat\",\n KHR_MATERIALS_IOR: \"KHR_materials_ior\",\n KHR_MATERIALS_SHEEN: \"KHR_materials_sheen\",\n KHR_MATERIALS_SPECULAR: \"KHR_materials_specular\",\n KHR_MATERIALS_TRANSMISSION: \"KHR_materials_transmission\",\n KHR_MATERIALS_IRIDESCENCE: \"KHR_materials_iridescence\",\n KHR_MATERIALS_ANISOTROPY: \"KHR_materials_anisotropy\",\n KHR_MATERIALS_UNLIT: \"KHR_materials_unlit\",\n KHR_MATERIALS_VOLUME: \"KHR_materials_volume\",\n KHR_TEXTURE_BASISU: \"KHR_texture_basisu\",\n KHR_TEXTURE_TRANSFORM: \"KHR_texture_transform\",\n KHR_MESH_QUANTIZATION: \"KHR_mesh_quantization\",\n KHR_MATERIALS_EMISSIVE_STRENGTH: \"KHR_materials_emissive_strength\",\n EXT_TEXTURE_WEBP: \"EXT_texture_webp\",\n EXT_TEXTURE_AVIF: \"EXT_texture_avif\",\n EXT_MESHOPT_COMPRESSION: \"EXT_meshopt_compression\",\n EXT_MESH_GPU_INSTANCING: \"EXT_mesh_gpu_instancing\"\n};\nclass GLTFLightsExtension {\n constructor(parser2) {\n this.parser = parser2;\n this.name = EXTENSIONS.KHR_LIGHTS_PUNCTUAL;\n this.cache = { refs: {}, uses: {} };\n }\n _markDefs() {\n const parser2 = this.parser;\n const nodeDefs = this.parser.json.nodes || [];\n for (let nodeIndex = 0, nodeLength = nodeDefs.length; nodeIndex < nodeLength; nodeIndex++) {\n const nodeDef = nodeDefs[nodeIndex];\n if (nodeDef.extensions && nodeDef.extensions[this.name] && nodeDef.extensions[this.name].light !== void 0) {\n parser2._addNodeRef(this.cache, nodeDef.extensions[this.name].light);\n }\n }\n }\n _loadLight(lightIndex) {\n const parser2 = this.parser;\n const cacheKey = \"light:\" + lightIndex;\n let dependency = parser2.cache.get(cacheKey);\n if (dependency)\n return dependency;\n const json = parser2.json;\n const extensions = json.extensions && json.extensions[this.name] || {};\n const lightDefs = extensions.lights || [];\n const lightDef = lightDefs[lightIndex];\n let lightNode;\n const color = new three__WEBPACK_IMPORTED_MODULE_42__.Color(16777215);\n if (lightDef.color !== void 0)\n color.fromArray(lightDef.color);\n const range = lightDef.range !== void 0 ? lightDef.range : 0;\n switch (lightDef.type) {\n case \"directional\":\n lightNode = new three__WEBPACK_IMPORTED_MODULE_42__.DirectionalLight(color);\n lightNode.target.position.set(0, 0, -1);\n lightNode.add(lightNode.target);\n break;\n case \"point\":\n lightNode = new three__WEBPACK_IMPORTED_MODULE_42__.PointLight(color);\n lightNode.distance = range;\n break;\n case \"spot\":\n lightNode = new three__WEBPACK_IMPORTED_MODULE_42__.SpotLight(color);\n lightNode.distance = range;\n lightDef.spot = lightDef.spot || {};\n lightDef.spot.innerConeAngle = lightDef.spot.innerConeAngle !== void 0 ? lightDef.spot.innerConeAngle : 0;\n lightDef.spot.outerConeAngle = lightDef.spot.outerConeAngle !== void 0 ? lightDef.spot.outerConeAngle : Math.PI / 4;\n lightNode.angle = lightDef.spot.outerConeAngle;\n lightNode.penumbra = 1 - lightDef.spot.innerConeAngle / lightDef.spot.outerConeAngle;\n lightNode.target.position.set(0, 0, -1);\n lightNode.add(lightNode.target);\n break;\n default:\n throw new Error(\"THREE.GLTFLoader: Unexpected light type: \" + lightDef.type);\n }\n lightNode.position.set(0, 0, 0);\n lightNode.decay = 2;\n assignExtrasToUserData(lightNode, lightDef);\n if (lightDef.intensity !== void 0)\n lightNode.intensity = lightDef.intensity;\n lightNode.name = parser2.createUniqueName(lightDef.name || \"light_\" + lightIndex);\n dependency = Promise.resolve(lightNode);\n parser2.cache.add(cacheKey, dependency);\n return dependency;\n }\n getDependency(type, index) {\n if (type !== \"light\")\n return;\n return this._loadLight(index);\n }\n createNodeAttachment(nodeIndex) {\n const self2 = this;\n const parser2 = this.parser;\n const json = parser2.json;\n const nodeDef = json.nodes[nodeIndex];\n const lightDef = nodeDef.extensions && nodeDef.extensions[this.name] || {};\n const lightIndex = lightDef.light;\n if (lightIndex === void 0)\n return null;\n return this._loadLight(lightIndex).then(function(light) {\n return parser2._getNodeRef(self2.cache, lightIndex, light);\n });\n }\n}\nclass GLTFMaterialsUnlitExtension2 {\n constructor() {\n this.name = EXTENSIONS.KHR_MATERIALS_UNLIT;\n }\n getMaterialType() {\n return three__WEBPACK_IMPORTED_MODULE_42__.MeshBasicMaterial;\n }\n extendParams(materialParams, materialDef, parser2) {\n const pending = [];\n materialParams.color = new three__WEBPACK_IMPORTED_MODULE_42__.Color(1, 1, 1);\n materialParams.opacity = 1;\n const metallicRoughness = materialDef.pbrMetallicRoughness;\n if (metallicRoughness) {\n if (Array.isArray(metallicRoughness.baseColorFactor)) {\n const array = metallicRoughness.baseColorFactor;\n materialParams.color.fromArray(array);\n materialParams.opacity = array[3];\n }\n if (metallicRoughness.baseColorTexture !== void 0) {\n pending.push(parser2.assignTexture(materialParams, \"map\", metallicRoughness.baseColorTexture, 3001));\n }\n }\n return Promise.all(pending);\n }\n}\nclass GLTFMaterialsEmissiveStrengthExtension2 {\n constructor(parser2) {\n this.parser = parser2;\n this.name = EXTENSIONS.KHR_MATERIALS_EMISSIVE_STRENGTH;\n }\n extendMaterialParams(materialIndex, materialParams) {\n const parser2 = this.parser;\n const materialDef = parser2.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve();\n }\n const emissiveStrength = materialDef.extensions[this.name].emissiveStrength;\n if (emissiveStrength !== void 0) {\n materialParams.emissiveIntensity = emissiveStrength;\n }\n return Promise.resolve();\n }\n}\nclass GLTFMaterialsClearcoatExtension2 {\n constructor(parser2) {\n this.parser = parser2;\n this.name = EXTENSIONS.KHR_MATERIALS_CLEARCOAT;\n }\n getMaterialType(materialIndex) {\n const parser2 = this.parser;\n const materialDef = parser2.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name])\n return null;\n return three__WEBPACK_IMPORTED_MODULE_42__.MeshPhysicalMaterial;\n }\n extendMaterialParams(materialIndex, materialParams) {\n const parser2 = this.parser;\n const materialDef = parser2.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve();\n }\n const pending = [];\n const extension = materialDef.extensions[this.name];\n if (extension.clearcoatFactor !== void 0) {\n materialParams.clearcoat = extension.clearcoatFactor;\n }\n if (extension.clearcoatTexture !== void 0) {\n pending.push(parser2.assignTexture(materialParams, \"clearcoatMap\", extension.clearcoatTexture));\n }\n if (extension.clearcoatRoughnessFactor !== void 0) {\n materialParams.clearcoatRoughness = extension.clearcoatRoughnessFactor;\n }\n if (extension.clearcoatRoughnessTexture !== void 0) {\n pending.push(parser2.assignTexture(materialParams, \"clearcoatRoughnessMap\", extension.clearcoatRoughnessTexture));\n }\n if (extension.clearcoatNormalTexture !== void 0) {\n pending.push(parser2.assignTexture(materialParams, \"clearcoatNormalMap\", extension.clearcoatNormalTexture));\n if (extension.clearcoatNormalTexture.scale !== void 0) {\n const scale = extension.clearcoatNormalTexture.scale;\n materialParams.clearcoatNormalScale = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(scale, scale);\n }\n }\n return Promise.all(pending);\n }\n}\nclass GLTFMaterialsIridescenceExtension2 {\n constructor(parser2) {\n this.parser = parser2;\n this.name = EXTENSIONS.KHR_MATERIALS_IRIDESCENCE;\n }\n getMaterialType(materialIndex) {\n const parser2 = this.parser;\n const materialDef = parser2.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name])\n return null;\n return three__WEBPACK_IMPORTED_MODULE_42__.MeshPhysicalMaterial;\n }\n extendMaterialParams(materialIndex, materialParams) {\n const parser2 = this.parser;\n const materialDef = parser2.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve();\n }\n const pending = [];\n const extension = materialDef.extensions[this.name];\n if (extension.iridescenceFactor !== void 0) {\n materialParams.iridescence = extension.iridescenceFactor;\n }\n if (extension.iridescenceTexture !== void 0) {\n pending.push(parser2.assignTexture(materialParams, \"iridescenceMap\", extension.iridescenceTexture));\n }\n if (extension.iridescenceIor !== void 0) {\n materialParams.iridescenceIOR = extension.iridescenceIor;\n }\n if (materialParams.iridescenceThicknessRange === void 0) {\n materialParams.iridescenceThicknessRange = [100, 400];\n }\n if (extension.iridescenceThicknessMinimum !== void 0) {\n materialParams.iridescenceThicknessRange[0] = extension.iridescenceThicknessMinimum;\n }\n if (extension.iridescenceThicknessMaximum !== void 0) {\n materialParams.iridescenceThicknessRange[1] = extension.iridescenceThicknessMaximum;\n }\n if (extension.iridescenceThicknessTexture !== void 0) {\n pending.push(\n parser2.assignTexture(materialParams, \"iridescenceThicknessMap\", extension.iridescenceThicknessTexture)\n );\n }\n return Promise.all(pending);\n }\n}\nclass GLTFMaterialsSheenExtension2 {\n constructor(parser2) {\n this.parser = parser2;\n this.name = EXTENSIONS.KHR_MATERIALS_SHEEN;\n }\n getMaterialType(materialIndex) {\n const parser2 = this.parser;\n const materialDef = parser2.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name])\n return null;\n return three__WEBPACK_IMPORTED_MODULE_42__.MeshPhysicalMaterial;\n }\n extendMaterialParams(materialIndex, materialParams) {\n const parser2 = this.parser;\n const materialDef = parser2.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve();\n }\n const pending = [];\n materialParams.sheenColor = new three__WEBPACK_IMPORTED_MODULE_42__.Color(0, 0, 0);\n materialParams.sheenRoughness = 0;\n materialParams.sheen = 1;\n const extension = materialDef.extensions[this.name];\n if (extension.sheenColorFactor !== void 0) {\n materialParams.sheenColor.fromArray(extension.sheenColorFactor);\n }\n if (extension.sheenRoughnessFactor !== void 0) {\n materialParams.sheenRoughness = extension.sheenRoughnessFactor;\n }\n if (extension.sheenColorTexture !== void 0) {\n pending.push(parser2.assignTexture(materialParams, \"sheenColorMap\", extension.sheenColorTexture, 3001));\n }\n if (extension.sheenRoughnessTexture !== void 0) {\n pending.push(parser2.assignTexture(materialParams, \"sheenRoughnessMap\", extension.sheenRoughnessTexture));\n }\n return Promise.all(pending);\n }\n}\nclass GLTFMaterialsTransmissionExtension2 {\n constructor(parser2) {\n this.parser = parser2;\n this.name = EXTENSIONS.KHR_MATERIALS_TRANSMISSION;\n }\n getMaterialType(materialIndex) {\n const parser2 = this.parser;\n const materialDef = parser2.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name])\n return null;\n return three__WEBPACK_IMPORTED_MODULE_42__.MeshPhysicalMaterial;\n }\n extendMaterialParams(materialIndex, materialParams) {\n const parser2 = this.parser;\n const materialDef = parser2.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve();\n }\n const pending = [];\n const extension = materialDef.extensions[this.name];\n if (extension.transmissionFactor !== void 0) {\n materialParams.transmission = extension.transmissionFactor;\n }\n if (extension.transmissionTexture !== void 0) {\n pending.push(parser2.assignTexture(materialParams, \"transmissionMap\", extension.transmissionTexture));\n }\n return Promise.all(pending);\n }\n}\nclass GLTFMaterialsVolumeExtension2 {\n constructor(parser2) {\n this.parser = parser2;\n this.name = EXTENSIONS.KHR_MATERIALS_VOLUME;\n }\n getMaterialType(materialIndex) {\n const parser2 = this.parser;\n const materialDef = parser2.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name])\n return null;\n return three__WEBPACK_IMPORTED_MODULE_42__.MeshPhysicalMaterial;\n }\n extendMaterialParams(materialIndex, materialParams) {\n const parser2 = this.parser;\n const materialDef = parser2.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve();\n }\n const pending = [];\n const extension = materialDef.extensions[this.name];\n materialParams.thickness = extension.thicknessFactor !== void 0 ? extension.thicknessFactor : 0;\n if (extension.thicknessTexture !== void 0) {\n pending.push(parser2.assignTexture(materialParams, \"thicknessMap\", extension.thicknessTexture));\n }\n materialParams.attenuationDistance = extension.attenuationDistance || Infinity;\n const colorArray = extension.attenuationColor || [1, 1, 1];\n materialParams.attenuationColor = new three__WEBPACK_IMPORTED_MODULE_42__.Color(colorArray[0], colorArray[1], colorArray[2]);\n return Promise.all(pending);\n }\n}\nclass GLTFMaterialsIorExtension2 {\n constructor(parser2) {\n this.parser = parser2;\n this.name = EXTENSIONS.KHR_MATERIALS_IOR;\n }\n getMaterialType(materialIndex) {\n const parser2 = this.parser;\n const materialDef = parser2.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name])\n return null;\n return three__WEBPACK_IMPORTED_MODULE_42__.MeshPhysicalMaterial;\n }\n extendMaterialParams(materialIndex, materialParams) {\n const parser2 = this.parser;\n const materialDef = parser2.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve();\n }\n const extension = materialDef.extensions[this.name];\n materialParams.ior = extension.ior !== void 0 ? extension.ior : 1.5;\n return Promise.resolve();\n }\n}\nclass GLTFMaterialsSpecularExtension2 {\n constructor(parser2) {\n this.parser = parser2;\n this.name = EXTENSIONS.KHR_MATERIALS_SPECULAR;\n }\n getMaterialType(materialIndex) {\n const parser2 = this.parser;\n const materialDef = parser2.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name])\n return null;\n return three__WEBPACK_IMPORTED_MODULE_42__.MeshPhysicalMaterial;\n }\n extendMaterialParams(materialIndex, materialParams) {\n const parser2 = this.parser;\n const materialDef = parser2.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve();\n }\n const pending = [];\n const extension = materialDef.extensions[this.name];\n materialParams.specularIntensity = extension.specularFactor !== void 0 ? extension.specularFactor : 1;\n if (extension.specularTexture !== void 0) {\n pending.push(parser2.assignTexture(materialParams, \"specularIntensityMap\", extension.specularTexture));\n }\n const colorArray = extension.specularColorFactor || [1, 1, 1];\n materialParams.specularColor = new three__WEBPACK_IMPORTED_MODULE_42__.Color(colorArray[0], colorArray[1], colorArray[2]);\n if (extension.specularColorTexture !== void 0) {\n pending.push(\n parser2.assignTexture(materialParams, \"specularColorMap\", extension.specularColorTexture, 3001)\n // sRGBEncoding\n );\n }\n return Promise.all(pending);\n }\n}\nclass GLTFMaterialsAnisotropyExtension2 {\n constructor(parser2) {\n this.parser = parser2;\n this.name = EXTENSIONS.KHR_MATERIALS_ANISOTROPY;\n }\n getMaterialType(materialIndex) {\n const parser2 = this.parser;\n const materialDef = parser2.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name])\n return null;\n return three__WEBPACK_IMPORTED_MODULE_42__.MeshPhysicalMaterial;\n }\n extendMaterialParams(materialIndex, materialParams) {\n const parser2 = this.parser;\n const materialDef = parser2.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve();\n }\n const pending = [];\n const extension = materialDef.extensions[this.name];\n if (extension.anisotropyStrength !== void 0) {\n materialParams.anisotropy = extension.anisotropyStrength;\n }\n if (extension.anisotropyRotation !== void 0) {\n materialParams.anisotropyRotation = extension.anisotropyRotation;\n }\n if (extension.anisotropyTexture !== void 0) {\n pending.push(parser2.assignTexture(materialParams, \"anisotropyMap\", extension.anisotropyTexture));\n }\n return Promise.all(pending);\n }\n}\nclass GLTFTextureBasisUExtension {\n constructor(parser2) {\n this.parser = parser2;\n this.name = EXTENSIONS.KHR_TEXTURE_BASISU;\n }\n loadTexture(textureIndex) {\n const parser2 = this.parser;\n const json = parser2.json;\n const textureDef = json.textures[textureIndex];\n if (!textureDef.extensions || !textureDef.extensions[this.name]) {\n return null;\n }\n const extension = textureDef.extensions[this.name];\n const loader = parser2.options.ktx2Loader;\n if (!loader) {\n if (json.extensionsRequired && json.extensionsRequired.indexOf(this.name) >= 0) {\n throw new Error(\"THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures\");\n } else {\n return null;\n }\n }\n return parser2.loadTextureImage(textureIndex, extension.source, loader);\n }\n}\nclass GLTFTextureWebPExtension {\n constructor(parser2) {\n this.parser = parser2;\n this.name = EXTENSIONS.EXT_TEXTURE_WEBP;\n this.isSupported = null;\n }\n loadTexture(textureIndex) {\n const name = this.name;\n const parser2 = this.parser;\n const json = parser2.json;\n const textureDef = json.textures[textureIndex];\n if (!textureDef.extensions || !textureDef.extensions[name]) {\n return null;\n }\n const extension = textureDef.extensions[name];\n const source = json.images[extension.source];\n let loader = parser2.textureLoader;\n if (source.uri) {\n const handler = parser2.options.manager.getHandler(source.uri);\n if (handler !== null)\n loader = handler;\n }\n return this.detectSupport().then(function(isSupported) {\n if (isSupported)\n return parser2.loadTextureImage(textureIndex, extension.source, loader);\n if (json.extensionsRequired && json.extensionsRequired.indexOf(name) >= 0) {\n throw new Error(\"THREE.GLTFLoader: WebP required by asset but unsupported.\");\n }\n return parser2.loadTexture(textureIndex);\n });\n }\n detectSupport() {\n if (!this.isSupported) {\n this.isSupported = new Promise(function(resolve) {\n const image = new Image();\n image.src = \"data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA\";\n image.onload = image.onerror = function() {\n resolve(image.height === 1);\n };\n });\n }\n return this.isSupported;\n }\n}\nclass GLTFTextureAVIFExtension {\n constructor(parser2) {\n this.parser = parser2;\n this.name = EXTENSIONS.EXT_TEXTURE_AVIF;\n this.isSupported = null;\n }\n loadTexture(textureIndex) {\n const name = this.name;\n const parser2 = this.parser;\n const json = parser2.json;\n const textureDef = json.textures[textureIndex];\n if (!textureDef.extensions || !textureDef.extensions[name]) {\n return null;\n }\n const extension = textureDef.extensions[name];\n const source = json.images[extension.source];\n let loader = parser2.textureLoader;\n if (source.uri) {\n const handler = parser2.options.manager.getHandler(source.uri);\n if (handler !== null)\n loader = handler;\n }\n return this.detectSupport().then(function(isSupported) {\n if (isSupported)\n return parser2.loadTextureImage(textureIndex, extension.source, loader);\n if (json.extensionsRequired && json.extensionsRequired.indexOf(name) >= 0) {\n throw new Error(\"THREE.GLTFLoader: AVIF required by asset but unsupported.\");\n }\n return parser2.loadTexture(textureIndex);\n });\n }\n detectSupport() {\n if (!this.isSupported) {\n this.isSupported = new Promise(function(resolve) {\n const image = new Image();\n image.src = \"data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=\";\n image.onload = image.onerror = function() {\n resolve(image.height === 1);\n };\n });\n }\n return this.isSupported;\n }\n}\nclass GLTFMeshoptCompression {\n constructor(parser2) {\n this.name = EXTENSIONS.EXT_MESHOPT_COMPRESSION;\n this.parser = parser2;\n }\n loadBufferView(index) {\n const json = this.parser.json;\n const bufferView = json.bufferViews[index];\n if (bufferView.extensions && bufferView.extensions[this.name]) {\n const extensionDef = bufferView.extensions[this.name];\n const buffer = this.parser.getDependency(\"buffer\", extensionDef.buffer);\n const decoder = this.parser.options.meshoptDecoder;\n if (!decoder || !decoder.supported) {\n if (json.extensionsRequired && json.extensionsRequired.indexOf(this.name) >= 0) {\n throw new Error(\"THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files\");\n } else {\n return null;\n }\n }\n return buffer.then(function(res) {\n const byteOffset = extensionDef.byteOffset || 0;\n const byteLength = extensionDef.byteLength || 0;\n const count = extensionDef.count;\n const stride = extensionDef.byteStride;\n const source = new Uint8Array(res, byteOffset, byteLength);\n if (decoder.decodeGltfBufferAsync) {\n return decoder.decodeGltfBufferAsync(count, stride, source, extensionDef.mode, extensionDef.filter).then(function(res2) {\n return res2.buffer;\n });\n } else {\n return decoder.ready.then(function() {\n const result = new ArrayBuffer(count * stride);\n decoder.decodeGltfBuffer(\n new Uint8Array(result),\n count,\n stride,\n source,\n extensionDef.mode,\n extensionDef.filter\n );\n return result;\n });\n }\n });\n } else {\n return null;\n }\n }\n}\nclass GLTFMeshGpuInstancing {\n constructor(parser2) {\n this.name = EXTENSIONS.EXT_MESH_GPU_INSTANCING;\n this.parser = parser2;\n }\n createNodeMesh(nodeIndex) {\n const json = this.parser.json;\n const nodeDef = json.nodes[nodeIndex];\n if (!nodeDef.extensions || !nodeDef.extensions[this.name] || nodeDef.mesh === void 0) {\n return null;\n }\n const meshDef = json.meshes[nodeDef.mesh];\n for (const primitive of meshDef.primitives) {\n if (primitive.mode !== WEBGL_CONSTANTS.TRIANGLES && primitive.mode !== WEBGL_CONSTANTS.TRIANGLE_STRIP && primitive.mode !== WEBGL_CONSTANTS.TRIANGLE_FAN && primitive.mode !== void 0) {\n return null;\n }\n }\n const extensionDef = nodeDef.extensions[this.name];\n const attributesDef = extensionDef.attributes;\n const pending = [];\n const attributes = {};\n for (const key in attributesDef) {\n pending.push(\n this.parser.getDependency(\"accessor\", attributesDef[key]).then((accessor) => {\n attributes[key] = accessor;\n return attributes[key];\n })\n );\n }\n if (pending.length < 1) {\n return null;\n }\n pending.push(this.parser.createNodeMesh(nodeIndex));\n return Promise.all(pending).then((results) => {\n const nodeObject = results.pop();\n const meshes = nodeObject.isGroup ? nodeObject.children : [nodeObject];\n const count = results[0].count;\n const instancedMeshes = [];\n for (const mesh of meshes) {\n const m = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n const p = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const q = new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion();\n const s = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(1, 1, 1);\n const instancedMesh = new three__WEBPACK_IMPORTED_MODULE_42__.InstancedMesh(mesh.geometry, mesh.material, count);\n for (let i2 = 0; i2 < count; i2++) {\n if (attributes.TRANSLATION) {\n p.fromBufferAttribute(attributes.TRANSLATION, i2);\n }\n if (attributes.ROTATION) {\n q.fromBufferAttribute(attributes.ROTATION, i2);\n }\n if (attributes.SCALE) {\n s.fromBufferAttribute(attributes.SCALE, i2);\n }\n instancedMesh.setMatrixAt(i2, m.compose(p, q, s));\n }\n for (const attributeName in attributes) {\n if (attributeName !== \"TRANSLATION\" && attributeName !== \"ROTATION\" && attributeName !== \"SCALE\") {\n mesh.geometry.setAttribute(attributeName, attributes[attributeName]);\n }\n }\n three__WEBPACK_IMPORTED_MODULE_42__.Object3D.prototype.copy.call(instancedMesh, mesh);\n this.parser.assignFinalMaterial(instancedMesh);\n instancedMeshes.push(instancedMesh);\n }\n if (nodeObject.isGroup) {\n nodeObject.clear();\n nodeObject.add(...instancedMeshes);\n return nodeObject;\n }\n return instancedMeshes[0];\n });\n }\n}\nconst BINARY_EXTENSION_HEADER_MAGIC = \"glTF\";\nconst BINARY_EXTENSION_HEADER_LENGTH = 12;\nconst BINARY_EXTENSION_CHUNK_TYPES = { JSON: 1313821514, BIN: 5130562 };\nclass GLTFBinaryExtension {\n constructor(data) {\n this.name = EXTENSIONS.KHR_BINARY_GLTF;\n this.content = null;\n this.body = null;\n const headerView = new DataView(data, 0, BINARY_EXTENSION_HEADER_LENGTH);\n this.header = {\n magic: three__WEBPACK_IMPORTED_MODULE_42__.LoaderUtils.decodeText(new Uint8Array(data.slice(0, 4))),\n version: headerView.getUint32(4, true),\n length: headerView.getUint32(8, true)\n };\n if (this.header.magic !== BINARY_EXTENSION_HEADER_MAGIC) {\n throw new Error(\"THREE.GLTFLoader: Unsupported glTF-Binary header.\");\n } else if (this.header.version < 2) {\n throw new Error(\"THREE.GLTFLoader: Legacy binary file detected.\");\n }\n const chunkContentsLength = this.header.length - BINARY_EXTENSION_HEADER_LENGTH;\n const chunkView = new DataView(data, BINARY_EXTENSION_HEADER_LENGTH);\n let chunkIndex = 0;\n while (chunkIndex < chunkContentsLength) {\n const chunkLength = chunkView.getUint32(chunkIndex, true);\n chunkIndex += 4;\n const chunkType = chunkView.getUint32(chunkIndex, true);\n chunkIndex += 4;\n if (chunkType === BINARY_EXTENSION_CHUNK_TYPES.JSON) {\n const contentArray = new Uint8Array(data, BINARY_EXTENSION_HEADER_LENGTH + chunkIndex, chunkLength);\n this.content = three__WEBPACK_IMPORTED_MODULE_42__.LoaderUtils.decodeText(contentArray);\n } else if (chunkType === BINARY_EXTENSION_CHUNK_TYPES.BIN) {\n const byteOffset = BINARY_EXTENSION_HEADER_LENGTH + chunkIndex;\n this.body = data.slice(byteOffset, byteOffset + chunkLength);\n }\n chunkIndex += chunkLength;\n }\n if (this.content === null) {\n throw new Error(\"THREE.GLTFLoader: JSON content not found.\");\n }\n }\n}\nclass GLTFDracoMeshCompressionExtension {\n constructor(json, dracoLoader) {\n if (!dracoLoader) {\n throw new Error(\"THREE.GLTFLoader: No DRACOLoader instance provided.\");\n }\n this.name = EXTENSIONS.KHR_DRACO_MESH_COMPRESSION;\n this.json = json;\n this.dracoLoader = dracoLoader;\n this.dracoLoader.preload();\n }\n decodePrimitive(primitive, parser2) {\n const json = this.json;\n const dracoLoader = this.dracoLoader;\n const bufferViewIndex = primitive.extensions[this.name].bufferView;\n const gltfAttributeMap = primitive.extensions[this.name].attributes;\n const threeAttributeMap = {};\n const attributeNormalizedMap = {};\n const attributeTypeMap = {};\n for (const attributeName in gltfAttributeMap) {\n const threeAttributeName = ATTRIBUTES[attributeName] || attributeName.toLowerCase();\n threeAttributeMap[threeAttributeName] = gltfAttributeMap[attributeName];\n }\n for (const attributeName in primitive.attributes) {\n const threeAttributeName = ATTRIBUTES[attributeName] || attributeName.toLowerCase();\n if (gltfAttributeMap[attributeName] !== void 0) {\n const accessorDef = json.accessors[primitive.attributes[attributeName]];\n const componentType = WEBGL_COMPONENT_TYPES[accessorDef.componentType];\n attributeTypeMap[threeAttributeName] = componentType.name;\n attributeNormalizedMap[threeAttributeName] = accessorDef.normalized === true;\n }\n }\n return parser2.getDependency(\"bufferView\", bufferViewIndex).then(function(bufferView) {\n return new Promise(function(resolve) {\n dracoLoader.decodeDracoFile(\n bufferView,\n function(geometry2) {\n for (const attributeName in geometry2.attributes) {\n const attribute = geometry2.attributes[attributeName];\n const normalized = attributeNormalizedMap[attributeName];\n if (normalized !== void 0)\n attribute.normalized = normalized;\n }\n resolve(geometry2);\n },\n threeAttributeMap,\n attributeTypeMap\n );\n });\n });\n }\n}\nclass GLTFTextureTransformExtension {\n constructor() {\n this.name = EXTENSIONS.KHR_TEXTURE_TRANSFORM;\n }\n extendTexture(texture, transform) {\n if ((transform.texCoord === void 0 || transform.texCoord === texture.channel) && transform.offset === void 0 && transform.rotation === void 0 && transform.scale === void 0) {\n return texture;\n }\n texture = texture.clone();\n if (transform.texCoord !== void 0) {\n texture.channel = transform.texCoord;\n }\n if (transform.offset !== void 0) {\n texture.offset.fromArray(transform.offset);\n }\n if (transform.rotation !== void 0) {\n texture.rotation = transform.rotation;\n }\n if (transform.scale !== void 0) {\n texture.repeat.fromArray(transform.scale);\n }\n texture.needsUpdate = true;\n return texture;\n }\n}\nclass GLTFMeshQuantizationExtension {\n constructor() {\n this.name = EXTENSIONS.KHR_MESH_QUANTIZATION;\n }\n}\nclass GLTFCubicSplineInterpolant extends three__WEBPACK_IMPORTED_MODULE_42__.Interpolant {\n constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) {\n super(parameterPositions, sampleValues, sampleSize, resultBuffer);\n }\n copySampleValue_(index) {\n const result = this.resultBuffer, values = this.sampleValues, valueSize = this.valueSize, offset = index * valueSize * 3 + valueSize;\n for (let i2 = 0; i2 !== valueSize; i2++) {\n result[i2] = values[offset + i2];\n }\n return result;\n }\n interpolate_(i1, t0, t2, t1) {\n const result = this.resultBuffer;\n const values = this.sampleValues;\n const stride = this.valueSize;\n const stride2 = stride * 2;\n const stride3 = stride * 3;\n const td = t1 - t0;\n const p = (t2 - t0) / td;\n const pp = p * p;\n const ppp = pp * p;\n const offset1 = i1 * stride3;\n const offset0 = offset1 - stride3;\n const s2 = -2 * ppp + 3 * pp;\n const s3 = ppp - pp;\n const s0 = 1 - s2;\n const s1 = s3 - pp + p;\n for (let i2 = 0; i2 !== stride; i2++) {\n const p0 = values[offset0 + i2 + stride];\n const m0 = values[offset0 + i2 + stride2] * td;\n const p1 = values[offset1 + i2 + stride];\n const m1 = values[offset1 + i2] * td;\n result[i2] = s0 * p0 + s1 * m0 + s2 * p1 + s3 * m1;\n }\n return result;\n }\n}\nconst _q = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion();\nclass GLTFCubicSplineQuaternionInterpolant extends GLTFCubicSplineInterpolant {\n interpolate_(i1, t0, t2, t1) {\n const result = super.interpolate_(i1, t0, t2, t1);\n _q.fromArray(result).normalize().toArray(result);\n return result;\n }\n}\nconst WEBGL_CONSTANTS = {\n FLOAT: 5126,\n //FLOAT_MAT2: 35674,\n FLOAT_MAT3: 35675,\n FLOAT_MAT4: 35676,\n FLOAT_VEC2: 35664,\n FLOAT_VEC3: 35665,\n FLOAT_VEC4: 35666,\n LINEAR: 9729,\n REPEAT: 10497,\n SAMPLER_2D: 35678,\n POINTS: 0,\n LINES: 1,\n LINE_LOOP: 2,\n LINE_STRIP: 3,\n TRIANGLES: 4,\n TRIANGLE_STRIP: 5,\n TRIANGLE_FAN: 6,\n UNSIGNED_BYTE: 5121,\n UNSIGNED_SHORT: 5123\n};\nconst WEBGL_COMPONENT_TYPES = {\n 5120: Int8Array,\n 5121: Uint8Array,\n 5122: Int16Array,\n 5123: Uint16Array,\n 5125: Uint32Array,\n 5126: Float32Array\n};\nconst WEBGL_FILTERS = {\n 9728: three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter,\n 9729: three__WEBPACK_IMPORTED_MODULE_42__.LinearFilter,\n 9984: three__WEBPACK_IMPORTED_MODULE_42__.NearestMipmapNearestFilter,\n 9985: three__WEBPACK_IMPORTED_MODULE_42__.LinearMipmapNearestFilter,\n 9986: three__WEBPACK_IMPORTED_MODULE_42__.NearestMipmapLinearFilter,\n 9987: three__WEBPACK_IMPORTED_MODULE_42__.LinearMipmapLinearFilter\n};\nconst WEBGL_WRAPPINGS = {\n 33071: three__WEBPACK_IMPORTED_MODULE_42__.ClampToEdgeWrapping,\n 33648: three__WEBPACK_IMPORTED_MODULE_42__.MirroredRepeatWrapping,\n 10497: three__WEBPACK_IMPORTED_MODULE_42__.RepeatWrapping\n};\nconst WEBGL_TYPE_SIZES = {\n SCALAR: 1,\n VEC2: 2,\n VEC3: 3,\n VEC4: 4,\n MAT2: 4,\n MAT3: 9,\n MAT4: 16\n};\nconst ATTRIBUTES = {\n POSITION: \"position\",\n NORMAL: \"normal\",\n TANGENT: \"tangent\",\n // uv => uv1, 4 uv channels\n // https://github.com/mrdoob/three.js/pull/25943\n // https://github.com/mrdoob/three.js/pull/25788\n ...three__WEBPACK_IMPORTED_MODULE_42__.REVISION.replace(/\\D+/g, \"\") >= 152 ? {\n TEXCOORD_0: \"uv\",\n TEXCOORD_1: \"uv1\",\n TEXCOORD_2: \"uv2\",\n TEXCOORD_3: \"uv3\"\n } : {\n TEXCOORD_0: \"uv\",\n TEXCOORD_1: \"uv2\"\n },\n COLOR_0: \"color\",\n WEIGHTS_0: \"skinWeight\",\n JOINTS_0: \"skinIndex\"\n};\nconst PATH_PROPERTIES = {\n scale: \"scale\",\n translation: \"position\",\n rotation: \"quaternion\",\n weights: \"morphTargetInfluences\"\n};\nconst INTERPOLATION = {\n CUBICSPLINE: void 0,\n // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each\n // keyframe track will be initialized with a default interpolation type, then modified.\n LINEAR: three__WEBPACK_IMPORTED_MODULE_42__.InterpolateLinear,\n STEP: three__WEBPACK_IMPORTED_MODULE_42__.InterpolateDiscrete\n};\nconst ALPHA_MODES = {\n OPAQUE: \"OPAQUE\",\n MASK: \"MASK\",\n BLEND: \"BLEND\"\n};\nfunction createDefaultMaterial(cache) {\n if (cache[\"DefaultMaterial\"] === void 0) {\n cache[\"DefaultMaterial\"] = new three__WEBPACK_IMPORTED_MODULE_42__.MeshStandardMaterial({\n color: 16777215,\n emissive: 0,\n metalness: 1,\n roughness: 1,\n transparent: false,\n depthTest: true,\n side: three__WEBPACK_IMPORTED_MODULE_42__.FrontSide\n });\n }\n return cache[\"DefaultMaterial\"];\n}\nfunction addUnknownExtensionsToUserData(knownExtensions, object, objectDef) {\n for (const name in objectDef.extensions) {\n if (knownExtensions[name] === void 0) {\n object.userData.gltfExtensions = object.userData.gltfExtensions || {};\n object.userData.gltfExtensions[name] = objectDef.extensions[name];\n }\n }\n}\nfunction assignExtrasToUserData(object, gltfDef) {\n if (gltfDef.extras !== void 0) {\n if (typeof gltfDef.extras === \"object\") {\n Object.assign(object.userData, gltfDef.extras);\n } else {\n console.warn(\"THREE.GLTFLoader: Ignoring primitive type .extras, \" + gltfDef.extras);\n }\n }\n}\nfunction addMorphTargets(geometry2, targets, parser2) {\n let hasMorphPosition = false;\n let hasMorphNormal = false;\n let hasMorphColor = false;\n for (let i2 = 0, il = targets.length; i2 < il; i2++) {\n const target = targets[i2];\n if (target.POSITION !== void 0)\n hasMorphPosition = true;\n if (target.NORMAL !== void 0)\n hasMorphNormal = true;\n if (target.COLOR_0 !== void 0)\n hasMorphColor = true;\n if (hasMorphPosition && hasMorphNormal && hasMorphColor)\n break;\n }\n if (!hasMorphPosition && !hasMorphNormal && !hasMorphColor)\n return Promise.resolve(geometry2);\n const pendingPositionAccessors = [];\n const pendingNormalAccessors = [];\n const pendingColorAccessors = [];\n for (let i2 = 0, il = targets.length; i2 < il; i2++) {\n const target = targets[i2];\n if (hasMorphPosition) {\n const pendingAccessor = target.POSITION !== void 0 ? parser2.getDependency(\"accessor\", target.POSITION) : geometry2.attributes.position;\n pendingPositionAccessors.push(pendingAccessor);\n }\n if (hasMorphNormal) {\n const pendingAccessor = target.NORMAL !== void 0 ? parser2.getDependency(\"accessor\", target.NORMAL) : geometry2.attributes.normal;\n pendingNormalAccessors.push(pendingAccessor);\n }\n if (hasMorphColor) {\n const pendingAccessor = target.COLOR_0 !== void 0 ? parser2.getDependency(\"accessor\", target.COLOR_0) : geometry2.attributes.color;\n pendingColorAccessors.push(pendingAccessor);\n }\n }\n return Promise.all([\n Promise.all(pendingPositionAccessors),\n Promise.all(pendingNormalAccessors),\n Promise.all(pendingColorAccessors)\n ]).then(function(accessors) {\n const morphPositions = accessors[0];\n const morphNormals = accessors[1];\n const morphColors = accessors[2];\n if (hasMorphPosition)\n geometry2.morphAttributes.position = morphPositions;\n if (hasMorphNormal)\n geometry2.morphAttributes.normal = morphNormals;\n if (hasMorphColor)\n geometry2.morphAttributes.color = morphColors;\n geometry2.morphTargetsRelative = true;\n return geometry2;\n });\n}\nfunction updateMorphTargets(mesh, meshDef) {\n mesh.updateMorphTargets();\n if (meshDef.weights !== void 0) {\n for (let i2 = 0, il = meshDef.weights.length; i2 < il; i2++) {\n mesh.morphTargetInfluences[i2] = meshDef.weights[i2];\n }\n }\n if (meshDef.extras && Array.isArray(meshDef.extras.targetNames)) {\n const targetNames = meshDef.extras.targetNames;\n if (mesh.morphTargetInfluences.length === targetNames.length) {\n mesh.morphTargetDictionary = {};\n for (let i2 = 0, il = targetNames.length; i2 < il; i2++) {\n mesh.morphTargetDictionary[targetNames[i2]] = i2;\n }\n } else {\n console.warn(\"THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.\");\n }\n }\n}\nfunction createPrimitiveKey(primitiveDef) {\n let geometryKey;\n const dracoExtension = primitiveDef.extensions && primitiveDef.extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION];\n if (dracoExtension) {\n geometryKey = \"draco:\" + dracoExtension.bufferView + \":\" + dracoExtension.indices + \":\" + createAttributesKey(dracoExtension.attributes);\n } else {\n geometryKey = primitiveDef.indices + \":\" + createAttributesKey(primitiveDef.attributes) + \":\" + primitiveDef.mode;\n }\n if (primitiveDef.targets !== void 0) {\n for (let i2 = 0, il = primitiveDef.targets.length; i2 < il; i2++) {\n geometryKey += \":\" + createAttributesKey(primitiveDef.targets[i2]);\n }\n }\n return geometryKey;\n}\nfunction createAttributesKey(attributes) {\n let attributesKey = \"\";\n const keys2 = Object.keys(attributes).sort();\n for (let i2 = 0, il = keys2.length; i2 < il; i2++) {\n attributesKey += keys2[i2] + \":\" + attributes[keys2[i2]] + \";\";\n }\n return attributesKey;\n}\nfunction getNormalizedComponentScale(constructor) {\n switch (constructor) {\n case Int8Array:\n return 1 / 127;\n case Uint8Array:\n return 1 / 255;\n case Int16Array:\n return 1 / 32767;\n case Uint16Array:\n return 1 / 65535;\n default:\n throw new Error(\"THREE.GLTFLoader: Unsupported normalized accessor component type.\");\n }\n}\nfunction getImageURIMimeType(uri) {\n if (uri.search(/\\.jpe?g($|\\?)/i) > 0 || uri.search(/^data\\:image\\/jpeg/) === 0)\n return \"image/jpeg\";\n if (uri.search(/\\.webp($|\\?)/i) > 0 || uri.search(/^data\\:image\\/webp/) === 0)\n return \"image/webp\";\n return \"image/png\";\n}\nconst _identityMatrix = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\nclass GLTFParser {\n constructor(json = {}, options = {}) {\n this.json = json;\n this.extensions = {};\n this.plugins = {};\n this.options = options;\n this.cache = new GLTFRegistry();\n this.associations = /* @__PURE__ */ new Map();\n this.primitiveCache = {};\n this.nodeCache = {};\n this.meshCache = { refs: {}, uses: {} };\n this.cameraCache = { refs: {}, uses: {} };\n this.lightCache = { refs: {}, uses: {} };\n this.sourceCache = {};\n this.textureCache = {};\n this.nodeNamesUsed = {};\n let isSafari = false;\n let isFirefox = false;\n let firefoxVersion = -1;\n if (typeof navigator !== \"undefined\" && typeof navigator.userAgent !== \"undefined\") {\n isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent) === true;\n isFirefox = navigator.userAgent.indexOf(\"Firefox\") > -1;\n firefoxVersion = isFirefox ? navigator.userAgent.match(/Firefox\\/([0-9]+)\\./)[1] : -1;\n }\n if (typeof createImageBitmap === \"undefined\" || isSafari || isFirefox && firefoxVersion < 98) {\n this.textureLoader = new three__WEBPACK_IMPORTED_MODULE_42__.TextureLoader(this.options.manager);\n } else {\n this.textureLoader = new three__WEBPACK_IMPORTED_MODULE_42__.ImageBitmapLoader(this.options.manager);\n }\n this.textureLoader.setCrossOrigin(this.options.crossOrigin);\n this.textureLoader.setRequestHeader(this.options.requestHeader);\n this.fileLoader = new three__WEBPACK_IMPORTED_MODULE_42__.FileLoader(this.options.manager);\n this.fileLoader.setResponseType(\"arraybuffer\");\n if (this.options.crossOrigin === \"use-credentials\") {\n this.fileLoader.setWithCredentials(true);\n }\n }\n setExtensions(extensions) {\n this.extensions = extensions;\n }\n setPlugins(plugins) {\n this.plugins = plugins;\n }\n parse(onLoad, onError) {\n const parser2 = this;\n const json = this.json;\n const extensions = this.extensions;\n this.cache.removeAll();\n this.nodeCache = {};\n this._invokeAll(function(ext) {\n return ext._markDefs && ext._markDefs();\n });\n Promise.all(\n this._invokeAll(function(ext) {\n return ext.beforeRoot && ext.beforeRoot();\n })\n ).then(function() {\n return Promise.all([\n parser2.getDependencies(\"scene\"),\n parser2.getDependencies(\"animation\"),\n parser2.getDependencies(\"camera\")\n ]);\n }).then(function(dependencies) {\n const result = {\n scene: dependencies[0][json.scene || 0],\n scenes: dependencies[0],\n animations: dependencies[1],\n cameras: dependencies[2],\n asset: json.asset,\n parser: parser2,\n userData: {}\n };\n addUnknownExtensionsToUserData(extensions, result, json);\n assignExtrasToUserData(result, json);\n Promise.all(\n parser2._invokeAll(function(ext) {\n return ext.afterRoot && ext.afterRoot(result);\n })\n ).then(function() {\n onLoad(result);\n });\n }).catch(onError);\n }\n /**\n * Marks the special nodes/meshes in json for efficient parse.\n */\n _markDefs() {\n const nodeDefs = this.json.nodes || [];\n const skinDefs = this.json.skins || [];\n const meshDefs = this.json.meshes || [];\n for (let skinIndex = 0, skinLength = skinDefs.length; skinIndex < skinLength; skinIndex++) {\n const joints = skinDefs[skinIndex].joints;\n for (let i2 = 0, il = joints.length; i2 < il; i2++) {\n nodeDefs[joints[i2]].isBone = true;\n }\n }\n for (let nodeIndex = 0, nodeLength = nodeDefs.length; nodeIndex < nodeLength; nodeIndex++) {\n const nodeDef = nodeDefs[nodeIndex];\n if (nodeDef.mesh !== void 0) {\n this._addNodeRef(this.meshCache, nodeDef.mesh);\n if (nodeDef.skin !== void 0) {\n meshDefs[nodeDef.mesh].isSkinnedMesh = true;\n }\n }\n if (nodeDef.camera !== void 0) {\n this._addNodeRef(this.cameraCache, nodeDef.camera);\n }\n }\n }\n /**\n * Counts references to shared node / Object3D resources. These resources\n * can be reused, or \"instantiated\", at multiple nodes in the scene\n * hierarchy. Mesh, Camera, and Light instances are instantiated and must\n * be marked. Non-scenegraph resources (like Materials, Geometries, and\n * Textures) can be reused directly and are not marked here.\n *\n * Example: CesiumMilkTruck sample model reuses \"Wheel\" meshes.\n */\n _addNodeRef(cache, index) {\n if (index === void 0)\n return;\n if (cache.refs[index] === void 0) {\n cache.refs[index] = cache.uses[index] = 0;\n }\n cache.refs[index]++;\n }\n /** Returns a reference to a shared resource, cloning it if necessary. */\n _getNodeRef(cache, index, object) {\n if (cache.refs[index] <= 1)\n return object;\n const ref = object.clone();\n const updateMappings = (original, clone2) => {\n const mappings = this.associations.get(original);\n if (mappings != null) {\n this.associations.set(clone2, mappings);\n }\n for (const [i2, child] of original.children.entries()) {\n updateMappings(child, clone2.children[i2]);\n }\n };\n updateMappings(object, ref);\n ref.name += \"_instance_\" + cache.uses[index]++;\n return ref;\n }\n _invokeOne(func) {\n const extensions = Object.values(this.plugins);\n extensions.push(this);\n for (let i2 = 0; i2 < extensions.length; i2++) {\n const result = func(extensions[i2]);\n if (result)\n return result;\n }\n return null;\n }\n _invokeAll(func) {\n const extensions = Object.values(this.plugins);\n extensions.unshift(this);\n const pending = [];\n for (let i2 = 0; i2 < extensions.length; i2++) {\n const result = func(extensions[i2]);\n if (result)\n pending.push(result);\n }\n return pending;\n }\n /**\n * Requests the specified dependency asynchronously, with caching.\n * @param {string} type\n * @param {number} index\n * @return {Promise}\n */\n getDependency(type, index) {\n const cacheKey = type + \":\" + index;\n let dependency = this.cache.get(cacheKey);\n if (!dependency) {\n switch (type) {\n case \"scene\":\n dependency = this.loadScene(index);\n break;\n case \"node\":\n dependency = this._invokeOne(function(ext) {\n return ext.loadNode && ext.loadNode(index);\n });\n break;\n case \"mesh\":\n dependency = this._invokeOne(function(ext) {\n return ext.loadMesh && ext.loadMesh(index);\n });\n break;\n case \"accessor\":\n dependency = this.loadAccessor(index);\n break;\n case \"bufferView\":\n dependency = this._invokeOne(function(ext) {\n return ext.loadBufferView && ext.loadBufferView(index);\n });\n break;\n case \"buffer\":\n dependency = this.loadBuffer(index);\n break;\n case \"material\":\n dependency = this._invokeOne(function(ext) {\n return ext.loadMaterial && ext.loadMaterial(index);\n });\n break;\n case \"texture\":\n dependency = this._invokeOne(function(ext) {\n return ext.loadTexture && ext.loadTexture(index);\n });\n break;\n case \"skin\":\n dependency = this.loadSkin(index);\n break;\n case \"animation\":\n dependency = this._invokeOne(function(ext) {\n return ext.loadAnimation && ext.loadAnimation(index);\n });\n break;\n case \"camera\":\n dependency = this.loadCamera(index);\n break;\n default:\n dependency = this._invokeOne(function(ext) {\n return ext != this && ext.getDependency && ext.getDependency(type, index);\n });\n if (!dependency) {\n throw new Error(\"Unknown type: \" + type);\n }\n break;\n }\n this.cache.add(cacheKey, dependency);\n }\n return dependency;\n }\n /**\n * Requests all dependencies of the specified type asynchronously, with caching.\n * @param {string} type\n * @return {Promise>}\n */\n getDependencies(type) {\n let dependencies = this.cache.get(type);\n if (!dependencies) {\n const parser2 = this;\n const defs = this.json[type + (type === \"mesh\" ? \"es\" : \"s\")] || [];\n dependencies = Promise.all(\n defs.map(function(def, index) {\n return parser2.getDependency(type, index);\n })\n );\n this.cache.add(type, dependencies);\n }\n return dependencies;\n }\n /**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views\n * @param {number} bufferIndex\n * @return {Promise}\n */\n loadBuffer(bufferIndex) {\n const bufferDef = this.json.buffers[bufferIndex];\n const loader = this.fileLoader;\n if (bufferDef.type && bufferDef.type !== \"arraybuffer\") {\n throw new Error(\"THREE.GLTFLoader: \" + bufferDef.type + \" buffer type is not supported.\");\n }\n if (bufferDef.uri === void 0 && bufferIndex === 0) {\n return Promise.resolve(this.extensions[EXTENSIONS.KHR_BINARY_GLTF].body);\n }\n const options = this.options;\n return new Promise(function(resolve, reject) {\n loader.load(three__WEBPACK_IMPORTED_MODULE_42__.LoaderUtils.resolveURL(bufferDef.uri, options.path), resolve, void 0, function() {\n reject(new Error('THREE.GLTFLoader: Failed to load buffer \"' + bufferDef.uri + '\".'));\n });\n });\n }\n /**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views\n * @param {number} bufferViewIndex\n * @return {Promise}\n */\n loadBufferView(bufferViewIndex) {\n const bufferViewDef = this.json.bufferViews[bufferViewIndex];\n return this.getDependency(\"buffer\", bufferViewDef.buffer).then(function(buffer) {\n const byteLength = bufferViewDef.byteLength || 0;\n const byteOffset = bufferViewDef.byteOffset || 0;\n return buffer.slice(byteOffset, byteOffset + byteLength);\n });\n }\n /**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors\n * @param {number} accessorIndex\n * @return {Promise}\n */\n loadAccessor(accessorIndex) {\n const parser2 = this;\n const json = this.json;\n const accessorDef = this.json.accessors[accessorIndex];\n if (accessorDef.bufferView === void 0 && accessorDef.sparse === void 0) {\n const itemSize = WEBGL_TYPE_SIZES[accessorDef.type];\n const TypedArray = WEBGL_COMPONENT_TYPES[accessorDef.componentType];\n const normalized = accessorDef.normalized === true;\n const array = new TypedArray(accessorDef.count * itemSize);\n return Promise.resolve(new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(array, itemSize, normalized));\n }\n const pendingBufferViews = [];\n if (accessorDef.bufferView !== void 0) {\n pendingBufferViews.push(this.getDependency(\"bufferView\", accessorDef.bufferView));\n } else {\n pendingBufferViews.push(null);\n }\n if (accessorDef.sparse !== void 0) {\n pendingBufferViews.push(this.getDependency(\"bufferView\", accessorDef.sparse.indices.bufferView));\n pendingBufferViews.push(this.getDependency(\"bufferView\", accessorDef.sparse.values.bufferView));\n }\n return Promise.all(pendingBufferViews).then(function(bufferViews) {\n const bufferView = bufferViews[0];\n const itemSize = WEBGL_TYPE_SIZES[accessorDef.type];\n const TypedArray = WEBGL_COMPONENT_TYPES[accessorDef.componentType];\n const elementBytes = TypedArray.BYTES_PER_ELEMENT;\n const itemBytes = elementBytes * itemSize;\n const byteOffset = accessorDef.byteOffset || 0;\n const byteStride = accessorDef.bufferView !== void 0 ? json.bufferViews[accessorDef.bufferView].byteStride : void 0;\n const normalized = accessorDef.normalized === true;\n let array, bufferAttribute;\n if (byteStride && byteStride !== itemBytes) {\n const ibSlice = Math.floor(byteOffset / byteStride);\n const ibCacheKey = \"InterleavedBuffer:\" + accessorDef.bufferView + \":\" + accessorDef.componentType + \":\" + ibSlice + \":\" + accessorDef.count;\n let ib = parser2.cache.get(ibCacheKey);\n if (!ib) {\n array = new TypedArray(bufferView, ibSlice * byteStride, accessorDef.count * byteStride / elementBytes);\n ib = new three__WEBPACK_IMPORTED_MODULE_42__.InterleavedBuffer(array, byteStride / elementBytes);\n parser2.cache.add(ibCacheKey, ib);\n }\n bufferAttribute = new three__WEBPACK_IMPORTED_MODULE_42__.InterleavedBufferAttribute(\n ib,\n itemSize,\n byteOffset % byteStride / elementBytes,\n normalized\n );\n } else {\n if (bufferView === null) {\n array = new TypedArray(accessorDef.count * itemSize);\n } else {\n array = new TypedArray(bufferView, byteOffset, accessorDef.count * itemSize);\n }\n bufferAttribute = new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(array, itemSize, normalized);\n }\n if (accessorDef.sparse !== void 0) {\n const itemSizeIndices = WEBGL_TYPE_SIZES.SCALAR;\n const TypedArrayIndices = WEBGL_COMPONENT_TYPES[accessorDef.sparse.indices.componentType];\n const byteOffsetIndices = accessorDef.sparse.indices.byteOffset || 0;\n const byteOffsetValues = accessorDef.sparse.values.byteOffset || 0;\n const sparseIndices = new TypedArrayIndices(\n bufferViews[1],\n byteOffsetIndices,\n accessorDef.sparse.count * itemSizeIndices\n );\n const sparseValues = new TypedArray(bufferViews[2], byteOffsetValues, accessorDef.sparse.count * itemSize);\n if (bufferView !== null) {\n bufferAttribute = new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(\n bufferAttribute.array.slice(),\n bufferAttribute.itemSize,\n bufferAttribute.normalized\n );\n }\n for (let i2 = 0, il = sparseIndices.length; i2 < il; i2++) {\n const index = sparseIndices[i2];\n bufferAttribute.setX(index, sparseValues[i2 * itemSize]);\n if (itemSize >= 2)\n bufferAttribute.setY(index, sparseValues[i2 * itemSize + 1]);\n if (itemSize >= 3)\n bufferAttribute.setZ(index, sparseValues[i2 * itemSize + 2]);\n if (itemSize >= 4)\n bufferAttribute.setW(index, sparseValues[i2 * itemSize + 3]);\n if (itemSize >= 5)\n throw new Error(\"THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.\");\n }\n }\n return bufferAttribute;\n });\n }\n /**\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures\n * @param {number} textureIndex\n * @return {Promise}\n */\n loadTexture(textureIndex) {\n const json = this.json;\n const options = this.options;\n const textureDef = json.textures[textureIndex];\n const sourceIndex = textureDef.source;\n const sourceDef = json.images[sourceIndex];\n let loader = this.textureLoader;\n if (sourceDef.uri) {\n const handler = options.manager.getHandler(sourceDef.uri);\n if (handler !== null)\n loader = handler;\n }\n return this.loadTextureImage(textureIndex, sourceIndex, loader);\n }\n loadTextureImage(textureIndex, sourceIndex, loader) {\n const parser2 = this;\n const json = this.json;\n const textureDef = json.textures[textureIndex];\n const sourceDef = json.images[sourceIndex];\n const cacheKey = (sourceDef.uri || sourceDef.bufferView) + \":\" + textureDef.sampler;\n if (this.textureCache[cacheKey]) {\n return this.textureCache[cacheKey];\n }\n const promise = this.loadImageSource(sourceIndex, loader).then(function(texture) {\n texture.flipY = false;\n texture.name = textureDef.name || sourceDef.name || \"\";\n if (texture.name === \"\" && typeof sourceDef.uri === \"string\" && sourceDef.uri.startsWith(\"data:image/\") === false) {\n texture.name = sourceDef.uri;\n }\n const samplers = json.samplers || {};\n const sampler = samplers[textureDef.sampler] || {};\n texture.magFilter = WEBGL_FILTERS[sampler.magFilter] || three__WEBPACK_IMPORTED_MODULE_42__.LinearFilter;\n texture.minFilter = WEBGL_FILTERS[sampler.minFilter] || three__WEBPACK_IMPORTED_MODULE_42__.LinearMipmapLinearFilter;\n texture.wrapS = WEBGL_WRAPPINGS[sampler.wrapS] || three__WEBPACK_IMPORTED_MODULE_42__.RepeatWrapping;\n texture.wrapT = WEBGL_WRAPPINGS[sampler.wrapT] || three__WEBPACK_IMPORTED_MODULE_42__.RepeatWrapping;\n parser2.associations.set(texture, { textures: textureIndex });\n return texture;\n }).catch(function() {\n return null;\n });\n this.textureCache[cacheKey] = promise;\n return promise;\n }\n loadImageSource(sourceIndex, loader) {\n const parser2 = this;\n const json = this.json;\n const options = this.options;\n if (this.sourceCache[sourceIndex] !== void 0) {\n return this.sourceCache[sourceIndex].then((texture) => texture.clone());\n }\n const sourceDef = json.images[sourceIndex];\n const URL2 = self.URL || self.webkitURL;\n let sourceURI = sourceDef.uri || \"\";\n let isObjectURL = false;\n if (sourceDef.bufferView !== void 0) {\n sourceURI = parser2.getDependency(\"bufferView\", sourceDef.bufferView).then(function(bufferView) {\n isObjectURL = true;\n const blob = new Blob([bufferView], { type: sourceDef.mimeType });\n sourceURI = URL2.createObjectURL(blob);\n return sourceURI;\n });\n } else if (sourceDef.uri === void 0) {\n throw new Error(\"THREE.GLTFLoader: Image \" + sourceIndex + \" is missing URI and bufferView\");\n }\n const promise = Promise.resolve(sourceURI).then(function(sourceURI2) {\n return new Promise(function(resolve, reject) {\n let onLoad = resolve;\n if (loader.isImageBitmapLoader === true) {\n onLoad = function(imageBitmap) {\n const texture = new three__WEBPACK_IMPORTED_MODULE_42__.Texture(imageBitmap);\n texture.needsUpdate = true;\n resolve(texture);\n };\n }\n loader.load(three__WEBPACK_IMPORTED_MODULE_42__.LoaderUtils.resolveURL(sourceURI2, options.path), onLoad, void 0, reject);\n });\n }).then(function(texture) {\n if (isObjectURL === true) {\n URL2.revokeObjectURL(sourceURI);\n }\n texture.userData.mimeType = sourceDef.mimeType || getImageURIMimeType(sourceDef.uri);\n return texture;\n }).catch(function(error) {\n console.error(\"THREE.GLTFLoader: Couldn't load texture\", sourceURI);\n throw error;\n });\n this.sourceCache[sourceIndex] = promise;\n return promise;\n }\n /**\n * Asynchronously assigns a texture to the given material parameters.\n * @param {Object} materialParams\n * @param {string} mapName\n * @param {Object} mapDef\n * @return {Promise}\n */\n assignTexture(materialParams, mapName, mapDef, encoding) {\n const parser2 = this;\n return this.getDependency(\"texture\", mapDef.index).then(function(texture) {\n if (!texture)\n return null;\n if (mapDef.texCoord !== void 0 && mapDef.texCoord > 0) {\n texture = texture.clone();\n texture.channel = mapDef.texCoord;\n }\n if (parser2.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM]) {\n const transform = mapDef.extensions !== void 0 ? mapDef.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM] : void 0;\n if (transform) {\n const gltfReference = parser2.associations.get(texture);\n texture = parser2.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM].extendTexture(texture, transform);\n parser2.associations.set(texture, gltfReference);\n }\n }\n if (encoding !== void 0) {\n if (\"colorSpace\" in texture)\n texture.colorSpace = encoding === 3001 ? \"srgb\" : \"srgb-linear\";\n else\n texture.encoding = encoding;\n }\n materialParams[mapName] = texture;\n return texture;\n });\n }\n /**\n * Assigns final material to a Mesh, Line, or Points instance. The instance\n * already has a material (generated from the glTF material options alone)\n * but reuse of the same glTF material may require multiple threejs materials\n * to accommodate different primitive types, defines, etc. New materials will\n * be created if necessary, and reused from a cache.\n * @param {Object3D} mesh Mesh, Line, or Points instance.\n */\n assignFinalMaterial(mesh) {\n const geometry2 = mesh.geometry;\n let material2 = mesh.material;\n const useDerivativeTangents = geometry2.attributes.tangent === void 0;\n const useVertexColors = geometry2.attributes.color !== void 0;\n const useFlatShading = geometry2.attributes.normal === void 0;\n if (mesh.isPoints) {\n const cacheKey = \"PointsMaterial:\" + material2.uuid;\n let pointsMaterial = this.cache.get(cacheKey);\n if (!pointsMaterial) {\n pointsMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.PointsMaterial();\n three__WEBPACK_IMPORTED_MODULE_42__.Material.prototype.copy.call(pointsMaterial, material2);\n pointsMaterial.color.copy(material2.color);\n pointsMaterial.map = material2.map;\n pointsMaterial.sizeAttenuation = false;\n this.cache.add(cacheKey, pointsMaterial);\n }\n material2 = pointsMaterial;\n } else if (mesh.isLine) {\n const cacheKey = \"LineBasicMaterial:\" + material2.uuid;\n let lineMaterial = this.cache.get(cacheKey);\n if (!lineMaterial) {\n lineMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.LineBasicMaterial();\n three__WEBPACK_IMPORTED_MODULE_42__.Material.prototype.copy.call(lineMaterial, material2);\n lineMaterial.color.copy(material2.color);\n lineMaterial.map = material2.map;\n this.cache.add(cacheKey, lineMaterial);\n }\n material2 = lineMaterial;\n }\n if (useDerivativeTangents || useVertexColors || useFlatShading) {\n let cacheKey = \"ClonedMaterial:\" + material2.uuid + \":\";\n if (useDerivativeTangents)\n cacheKey += \"derivative-tangents:\";\n if (useVertexColors)\n cacheKey += \"vertex-colors:\";\n if (useFlatShading)\n cacheKey += \"flat-shading:\";\n let cachedMaterial = this.cache.get(cacheKey);\n if (!cachedMaterial) {\n cachedMaterial = material2.clone();\n if (useVertexColors)\n cachedMaterial.vertexColors = true;\n if (useFlatShading)\n cachedMaterial.flatShading = true;\n if (useDerivativeTangents) {\n if (cachedMaterial.normalScale)\n cachedMaterial.normalScale.y *= -1;\n if (cachedMaterial.clearcoatNormalScale)\n cachedMaterial.clearcoatNormalScale.y *= -1;\n }\n this.cache.add(cacheKey, cachedMaterial);\n this.associations.set(cachedMaterial, this.associations.get(material2));\n }\n material2 = cachedMaterial;\n }\n mesh.material = material2;\n }\n getMaterialType() {\n return three__WEBPACK_IMPORTED_MODULE_42__.MeshStandardMaterial;\n }\n /**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials\n * @param {number} materialIndex\n * @return {Promise}\n */\n loadMaterial(materialIndex) {\n const parser2 = this;\n const json = this.json;\n const extensions = this.extensions;\n const materialDef = json.materials[materialIndex];\n let materialType;\n const materialParams = {};\n const materialExtensions = materialDef.extensions || {};\n const pending = [];\n if (materialExtensions[EXTENSIONS.KHR_MATERIALS_UNLIT]) {\n const kmuExtension = extensions[EXTENSIONS.KHR_MATERIALS_UNLIT];\n materialType = kmuExtension.getMaterialType();\n pending.push(kmuExtension.extendParams(materialParams, materialDef, parser2));\n } else {\n const metallicRoughness = materialDef.pbrMetallicRoughness || {};\n materialParams.color = new three__WEBPACK_IMPORTED_MODULE_42__.Color(1, 1, 1);\n materialParams.opacity = 1;\n if (Array.isArray(metallicRoughness.baseColorFactor)) {\n const array = metallicRoughness.baseColorFactor;\n materialParams.color.fromArray(array);\n materialParams.opacity = array[3];\n }\n if (metallicRoughness.baseColorTexture !== void 0) {\n pending.push(parser2.assignTexture(materialParams, \"map\", metallicRoughness.baseColorTexture, 3001));\n }\n materialParams.metalness = metallicRoughness.metallicFactor !== void 0 ? metallicRoughness.metallicFactor : 1;\n materialParams.roughness = metallicRoughness.roughnessFactor !== void 0 ? metallicRoughness.roughnessFactor : 1;\n if (metallicRoughness.metallicRoughnessTexture !== void 0) {\n pending.push(parser2.assignTexture(materialParams, \"metalnessMap\", metallicRoughness.metallicRoughnessTexture));\n pending.push(parser2.assignTexture(materialParams, \"roughnessMap\", metallicRoughness.metallicRoughnessTexture));\n }\n materialType = this._invokeOne(function(ext) {\n return ext.getMaterialType && ext.getMaterialType(materialIndex);\n });\n pending.push(\n Promise.all(\n this._invokeAll(function(ext) {\n return ext.extendMaterialParams && ext.extendMaterialParams(materialIndex, materialParams);\n })\n )\n );\n }\n if (materialDef.doubleSided === true) {\n materialParams.side = three__WEBPACK_IMPORTED_MODULE_42__.DoubleSide;\n }\n const alphaMode = materialDef.alphaMode || ALPHA_MODES.OPAQUE;\n if (alphaMode === ALPHA_MODES.BLEND) {\n materialParams.transparent = true;\n materialParams.depthWrite = false;\n } else {\n materialParams.transparent = false;\n if (alphaMode === ALPHA_MODES.MASK) {\n materialParams.alphaTest = materialDef.alphaCutoff !== void 0 ? materialDef.alphaCutoff : 0.5;\n }\n }\n if (materialDef.normalTexture !== void 0 && materialType !== three__WEBPACK_IMPORTED_MODULE_42__.MeshBasicMaterial) {\n pending.push(parser2.assignTexture(materialParams, \"normalMap\", materialDef.normalTexture));\n materialParams.normalScale = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(1, 1);\n if (materialDef.normalTexture.scale !== void 0) {\n const scale = materialDef.normalTexture.scale;\n materialParams.normalScale.set(scale, scale);\n }\n }\n if (materialDef.occlusionTexture !== void 0 && materialType !== three__WEBPACK_IMPORTED_MODULE_42__.MeshBasicMaterial) {\n pending.push(parser2.assignTexture(materialParams, \"aoMap\", materialDef.occlusionTexture));\n if (materialDef.occlusionTexture.strength !== void 0) {\n materialParams.aoMapIntensity = materialDef.occlusionTexture.strength;\n }\n }\n if (materialDef.emissiveFactor !== void 0 && materialType !== three__WEBPACK_IMPORTED_MODULE_42__.MeshBasicMaterial) {\n materialParams.emissive = new three__WEBPACK_IMPORTED_MODULE_42__.Color().fromArray(materialDef.emissiveFactor);\n }\n if (materialDef.emissiveTexture !== void 0 && materialType !== three__WEBPACK_IMPORTED_MODULE_42__.MeshBasicMaterial) {\n pending.push(parser2.assignTexture(materialParams, \"emissiveMap\", materialDef.emissiveTexture, 3001));\n }\n return Promise.all(pending).then(function() {\n const material2 = new materialType(materialParams);\n if (materialDef.name)\n material2.name = materialDef.name;\n assignExtrasToUserData(material2, materialDef);\n parser2.associations.set(material2, { materials: materialIndex });\n if (materialDef.extensions)\n addUnknownExtensionsToUserData(extensions, material2, materialDef);\n return material2;\n });\n }\n /** When Object3D instances are targeted by animation, they need unique names. */\n createUniqueName(originalName) {\n const sanitizedName = three__WEBPACK_IMPORTED_MODULE_42__.PropertyBinding.sanitizeNodeName(originalName || \"\");\n if (sanitizedName in this.nodeNamesUsed) {\n return sanitizedName + \"_\" + ++this.nodeNamesUsed[sanitizedName];\n } else {\n this.nodeNamesUsed[sanitizedName] = 0;\n return sanitizedName;\n }\n }\n /**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry\n *\n * Creates BufferGeometries from primitives.\n *\n * @param {Array} primitives\n * @return {Promise>}\n */\n loadGeometries(primitives) {\n const parser2 = this;\n const extensions = this.extensions;\n const cache = this.primitiveCache;\n function createDracoPrimitive(primitive) {\n return extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(primitive, parser2).then(function(geometry2) {\n return addPrimitiveAttributes(geometry2, primitive, parser2);\n });\n }\n const pending = [];\n for (let i2 = 0, il = primitives.length; i2 < il; i2++) {\n const primitive = primitives[i2];\n const cacheKey = createPrimitiveKey(primitive);\n const cached = cache[cacheKey];\n if (cached) {\n pending.push(cached.promise);\n } else {\n let geometryPromise;\n if (primitive.extensions && primitive.extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION]) {\n geometryPromise = createDracoPrimitive(primitive);\n } else {\n geometryPromise = addPrimitiveAttributes(new three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry(), primitive, parser2);\n }\n cache[cacheKey] = { primitive, promise: geometryPromise };\n pending.push(geometryPromise);\n }\n }\n return Promise.all(pending);\n }\n /**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes\n * @param {number} meshIndex\n * @return {Promise}\n */\n loadMesh(meshIndex) {\n const parser2 = this;\n const json = this.json;\n const extensions = this.extensions;\n const meshDef = json.meshes[meshIndex];\n const primitives = meshDef.primitives;\n const pending = [];\n for (let i2 = 0, il = primitives.length; i2 < il; i2++) {\n const material2 = primitives[i2].material === void 0 ? createDefaultMaterial(this.cache) : this.getDependency(\"material\", primitives[i2].material);\n pending.push(material2);\n }\n pending.push(parser2.loadGeometries(primitives));\n return Promise.all(pending).then(function(results) {\n const materials = results.slice(0, results.length - 1);\n const geometries = results[results.length - 1];\n const meshes = [];\n for (let i2 = 0, il = geometries.length; i2 < il; i2++) {\n const geometry2 = geometries[i2];\n const primitive = primitives[i2];\n let mesh;\n const material2 = materials[i2];\n if (primitive.mode === WEBGL_CONSTANTS.TRIANGLES || primitive.mode === WEBGL_CONSTANTS.TRIANGLE_STRIP || primitive.mode === WEBGL_CONSTANTS.TRIANGLE_FAN || primitive.mode === void 0) {\n mesh = meshDef.isSkinnedMesh === true ? new three__WEBPACK_IMPORTED_MODULE_42__.SkinnedMesh(geometry2, material2) : new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(geometry2, material2);\n if (mesh.isSkinnedMesh === true) {\n mesh.normalizeSkinWeights();\n }\n if (primitive.mode === WEBGL_CONSTANTS.TRIANGLE_STRIP) {\n mesh.geometry = toTrianglesDrawMode(mesh.geometry, three__WEBPACK_IMPORTED_MODULE_42__.TriangleStripDrawMode);\n } else if (primitive.mode === WEBGL_CONSTANTS.TRIANGLE_FAN) {\n mesh.geometry = toTrianglesDrawMode(mesh.geometry, three__WEBPACK_IMPORTED_MODULE_42__.TriangleFanDrawMode);\n }\n } else if (primitive.mode === WEBGL_CONSTANTS.LINES) {\n mesh = new three__WEBPACK_IMPORTED_MODULE_42__.LineSegments(geometry2, material2);\n } else if (primitive.mode === WEBGL_CONSTANTS.LINE_STRIP) {\n mesh = new three__WEBPACK_IMPORTED_MODULE_42__.Line(geometry2, material2);\n } else if (primitive.mode === WEBGL_CONSTANTS.LINE_LOOP) {\n mesh = new three__WEBPACK_IMPORTED_MODULE_42__.LineLoop(geometry2, material2);\n } else if (primitive.mode === WEBGL_CONSTANTS.POINTS) {\n mesh = new three__WEBPACK_IMPORTED_MODULE_42__.Points(geometry2, material2);\n } else {\n throw new Error(\"THREE.GLTFLoader: Primitive mode unsupported: \" + primitive.mode);\n }\n if (Object.keys(mesh.geometry.morphAttributes).length > 0) {\n updateMorphTargets(mesh, meshDef);\n }\n mesh.name = parser2.createUniqueName(meshDef.name || \"mesh_\" + meshIndex);\n assignExtrasToUserData(mesh, meshDef);\n if (primitive.extensions)\n addUnknownExtensionsToUserData(extensions, mesh, primitive);\n parser2.assignFinalMaterial(mesh);\n meshes.push(mesh);\n }\n for (let i2 = 0, il = meshes.length; i2 < il; i2++) {\n parser2.associations.set(meshes[i2], {\n meshes: meshIndex,\n primitives: i2\n });\n }\n if (meshes.length === 1) {\n if (meshDef.extensions)\n addUnknownExtensionsToUserData(extensions, meshes[0], meshDef);\n return meshes[0];\n }\n const group = new three__WEBPACK_IMPORTED_MODULE_42__.Group();\n if (meshDef.extensions)\n addUnknownExtensionsToUserData(extensions, group, meshDef);\n parser2.associations.set(group, { meshes: meshIndex });\n for (let i2 = 0, il = meshes.length; i2 < il; i2++) {\n group.add(meshes[i2]);\n }\n return group;\n });\n }\n /**\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras\n * @param {number} cameraIndex\n * @return {Promise}\n */\n loadCamera(cameraIndex) {\n let camera;\n const cameraDef = this.json.cameras[cameraIndex];\n const params = cameraDef[cameraDef.type];\n if (!params) {\n console.warn(\"THREE.GLTFLoader: Missing camera parameters.\");\n return;\n }\n if (cameraDef.type === \"perspective\") {\n camera = new three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera(\n three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.radToDeg(params.yfov),\n params.aspectRatio || 1,\n params.znear || 1,\n params.zfar || 2e6\n );\n } else if (cameraDef.type === \"orthographic\") {\n camera = new three__WEBPACK_IMPORTED_MODULE_42__.OrthographicCamera(-params.xmag, params.xmag, params.ymag, -params.ymag, params.znear, params.zfar);\n }\n if (cameraDef.name)\n camera.name = this.createUniqueName(cameraDef.name);\n assignExtrasToUserData(camera, cameraDef);\n return Promise.resolve(camera);\n }\n /**\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins\n * @param {number} skinIndex\n * @return {Promise}\n */\n loadSkin(skinIndex) {\n const skinDef = this.json.skins[skinIndex];\n const pending = [];\n for (let i2 = 0, il = skinDef.joints.length; i2 < il; i2++) {\n pending.push(this._loadNodeShallow(skinDef.joints[i2]));\n }\n if (skinDef.inverseBindMatrices !== void 0) {\n pending.push(this.getDependency(\"accessor\", skinDef.inverseBindMatrices));\n } else {\n pending.push(null);\n }\n return Promise.all(pending).then(function(results) {\n const inverseBindMatrices = results.pop();\n const jointNodes = results;\n const bones = [];\n const boneInverses = [];\n for (let i2 = 0, il = jointNodes.length; i2 < il; i2++) {\n const jointNode = jointNodes[i2];\n if (jointNode) {\n bones.push(jointNode);\n const mat = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n if (inverseBindMatrices !== null) {\n mat.fromArray(inverseBindMatrices.array, i2 * 16);\n }\n boneInverses.push(mat);\n } else {\n console.warn('THREE.GLTFLoader: Joint \"%s\" could not be found.', skinDef.joints[i2]);\n }\n }\n return new three__WEBPACK_IMPORTED_MODULE_42__.Skeleton(bones, boneInverses);\n });\n }\n /**\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations\n * @param {number} animationIndex\n * @return {Promise}\n */\n loadAnimation(animationIndex) {\n const json = this.json;\n const animationDef = json.animations[animationIndex];\n const animationName = animationDef.name ? animationDef.name : \"animation_\" + animationIndex;\n const pendingNodes = [];\n const pendingInputAccessors = [];\n const pendingOutputAccessors = [];\n const pendingSamplers = [];\n const pendingTargets = [];\n for (let i2 = 0, il = animationDef.channels.length; i2 < il; i2++) {\n const channel = animationDef.channels[i2];\n const sampler = animationDef.samplers[channel.sampler];\n const target = channel.target;\n const name = target.node;\n const input = animationDef.parameters !== void 0 ? animationDef.parameters[sampler.input] : sampler.input;\n const output = animationDef.parameters !== void 0 ? animationDef.parameters[sampler.output] : sampler.output;\n if (target.node === void 0)\n continue;\n pendingNodes.push(this.getDependency(\"node\", name));\n pendingInputAccessors.push(this.getDependency(\"accessor\", input));\n pendingOutputAccessors.push(this.getDependency(\"accessor\", output));\n pendingSamplers.push(sampler);\n pendingTargets.push(target);\n }\n return Promise.all([\n Promise.all(pendingNodes),\n Promise.all(pendingInputAccessors),\n Promise.all(pendingOutputAccessors),\n Promise.all(pendingSamplers),\n Promise.all(pendingTargets)\n ]).then(function(dependencies) {\n const nodes = dependencies[0];\n const inputAccessors = dependencies[1];\n const outputAccessors = dependencies[2];\n const samplers = dependencies[3];\n const targets = dependencies[4];\n const tracks = [];\n for (let i2 = 0, il = nodes.length; i2 < il; i2++) {\n const node = nodes[i2];\n const inputAccessor = inputAccessors[i2];\n const outputAccessor = outputAccessors[i2];\n const sampler = samplers[i2];\n const target = targets[i2];\n if (node === void 0)\n continue;\n node.updateMatrix();\n let TypedKeyframeTrack;\n switch (PATH_PROPERTIES[target.path]) {\n case PATH_PROPERTIES.weights:\n TypedKeyframeTrack = three__WEBPACK_IMPORTED_MODULE_42__.NumberKeyframeTrack;\n break;\n case PATH_PROPERTIES.rotation:\n TypedKeyframeTrack = three__WEBPACK_IMPORTED_MODULE_42__.QuaternionKeyframeTrack;\n break;\n case PATH_PROPERTIES.position:\n case PATH_PROPERTIES.scale:\n default:\n TypedKeyframeTrack = three__WEBPACK_IMPORTED_MODULE_42__.VectorKeyframeTrack;\n break;\n }\n const targetName = node.name ? node.name : node.uuid;\n const interpolation = sampler.interpolation !== void 0 ? INTERPOLATION[sampler.interpolation] : three__WEBPACK_IMPORTED_MODULE_42__.InterpolateLinear;\n const targetNames = [];\n if (PATH_PROPERTIES[target.path] === PATH_PROPERTIES.weights) {\n node.traverse(function(object) {\n if (object.morphTargetInfluences) {\n targetNames.push(object.name ? object.name : object.uuid);\n }\n });\n } else {\n targetNames.push(targetName);\n }\n let outputArray = outputAccessor.array;\n if (outputAccessor.normalized) {\n const scale = getNormalizedComponentScale(outputArray.constructor);\n const scaled = new Float32Array(outputArray.length);\n for (let j = 0, jl = outputArray.length; j < jl; j++) {\n scaled[j] = outputArray[j] * scale;\n }\n outputArray = scaled;\n }\n for (let j = 0, jl = targetNames.length; j < jl; j++) {\n const track = new TypedKeyframeTrack(\n targetNames[j] + \".\" + PATH_PROPERTIES[target.path],\n inputAccessor.array,\n outputArray,\n interpolation\n );\n if (sampler.interpolation === \"CUBICSPLINE\") {\n track.createInterpolant = function InterpolantFactoryMethodGLTFCubicSpline(result) {\n const interpolantType = this instanceof three__WEBPACK_IMPORTED_MODULE_42__.QuaternionKeyframeTrack ? GLTFCubicSplineQuaternionInterpolant : GLTFCubicSplineInterpolant;\n return new interpolantType(this.times, this.values, this.getValueSize() / 3, result);\n };\n track.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = true;\n }\n tracks.push(track);\n }\n }\n return new three__WEBPACK_IMPORTED_MODULE_42__.AnimationClip(animationName, void 0, tracks);\n });\n }\n createNodeMesh(nodeIndex) {\n const json = this.json;\n const parser2 = this;\n const nodeDef = json.nodes[nodeIndex];\n if (nodeDef.mesh === void 0)\n return null;\n return parser2.getDependency(\"mesh\", nodeDef.mesh).then(function(mesh) {\n const node = parser2._getNodeRef(parser2.meshCache, nodeDef.mesh, mesh);\n if (nodeDef.weights !== void 0) {\n node.traverse(function(o) {\n if (!o.isMesh)\n return;\n for (let i2 = 0, il = nodeDef.weights.length; i2 < il; i2++) {\n o.morphTargetInfluences[i2] = nodeDef.weights[i2];\n }\n });\n }\n return node;\n });\n }\n /**\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy\n * @param {number} nodeIndex\n * @return {Promise}\n */\n loadNode(nodeIndex) {\n const json = this.json;\n const parser2 = this;\n const nodeDef = json.nodes[nodeIndex];\n const nodePending = parser2._loadNodeShallow(nodeIndex);\n const childPending = [];\n const childrenDef = nodeDef.children || [];\n for (let i2 = 0, il = childrenDef.length; i2 < il; i2++) {\n childPending.push(parser2.getDependency(\"node\", childrenDef[i2]));\n }\n const skeletonPending = nodeDef.skin === void 0 ? Promise.resolve(null) : parser2.getDependency(\"skin\", nodeDef.skin);\n return Promise.all([nodePending, Promise.all(childPending), skeletonPending]).then(function(results) {\n const node = results[0];\n const children = results[1];\n const skeleton = results[2];\n if (skeleton !== null) {\n node.traverse(function(mesh) {\n if (!mesh.isSkinnedMesh)\n return;\n mesh.bind(skeleton, _identityMatrix);\n });\n }\n for (let i2 = 0, il = children.length; i2 < il; i2++) {\n node.add(children[i2]);\n }\n return node;\n });\n }\n // ._loadNodeShallow() parses a single node.\n // skin and child nodes are created and added in .loadNode() (no '_' prefix).\n _loadNodeShallow(nodeIndex) {\n const json = this.json;\n const extensions = this.extensions;\n const parser2 = this;\n if (this.nodeCache[nodeIndex] !== void 0) {\n return this.nodeCache[nodeIndex];\n }\n const nodeDef = json.nodes[nodeIndex];\n const nodeName = nodeDef.name ? parser2.createUniqueName(nodeDef.name) : \"\";\n const pending = [];\n const meshPromise = parser2._invokeOne(function(ext) {\n return ext.createNodeMesh && ext.createNodeMesh(nodeIndex);\n });\n if (meshPromise) {\n pending.push(meshPromise);\n }\n if (nodeDef.camera !== void 0) {\n pending.push(\n parser2.getDependency(\"camera\", nodeDef.camera).then(function(camera) {\n return parser2._getNodeRef(parser2.cameraCache, nodeDef.camera, camera);\n })\n );\n }\n parser2._invokeAll(function(ext) {\n return ext.createNodeAttachment && ext.createNodeAttachment(nodeIndex);\n }).forEach(function(promise) {\n pending.push(promise);\n });\n this.nodeCache[nodeIndex] = Promise.all(pending).then(function(objects) {\n let node;\n if (nodeDef.isBone === true) {\n node = new three__WEBPACK_IMPORTED_MODULE_42__.Bone();\n } else if (objects.length > 1) {\n node = new three__WEBPACK_IMPORTED_MODULE_42__.Group();\n } else if (objects.length === 1) {\n node = objects[0];\n } else {\n node = new three__WEBPACK_IMPORTED_MODULE_42__.Object3D();\n }\n if (node !== objects[0]) {\n for (let i2 = 0, il = objects.length; i2 < il; i2++) {\n node.add(objects[i2]);\n }\n }\n if (nodeDef.name) {\n node.userData.name = nodeDef.name;\n node.name = nodeName;\n }\n assignExtrasToUserData(node, nodeDef);\n if (nodeDef.extensions)\n addUnknownExtensionsToUserData(extensions, node, nodeDef);\n if (nodeDef.matrix !== void 0) {\n const matrix2 = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n matrix2.fromArray(nodeDef.matrix);\n node.applyMatrix4(matrix2);\n } else {\n if (nodeDef.translation !== void 0) {\n node.position.fromArray(nodeDef.translation);\n }\n if (nodeDef.rotation !== void 0) {\n node.quaternion.fromArray(nodeDef.rotation);\n }\n if (nodeDef.scale !== void 0) {\n node.scale.fromArray(nodeDef.scale);\n }\n }\n if (!parser2.associations.has(node)) {\n parser2.associations.set(node, {});\n }\n parser2.associations.get(node).nodes = nodeIndex;\n return node;\n });\n return this.nodeCache[nodeIndex];\n }\n /**\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes\n * @param {number} sceneIndex\n * @return {Promise}\n */\n loadScene(sceneIndex) {\n const extensions = this.extensions;\n const sceneDef = this.json.scenes[sceneIndex];\n const parser2 = this;\n const scene = new three__WEBPACK_IMPORTED_MODULE_42__.Group();\n if (sceneDef.name)\n scene.name = parser2.createUniqueName(sceneDef.name);\n assignExtrasToUserData(scene, sceneDef);\n if (sceneDef.extensions)\n addUnknownExtensionsToUserData(extensions, scene, sceneDef);\n const nodeIds = sceneDef.nodes || [];\n const pending = [];\n for (let i2 = 0, il = nodeIds.length; i2 < il; i2++) {\n pending.push(parser2.getDependency(\"node\", nodeIds[i2]));\n }\n return Promise.all(pending).then(function(nodes) {\n for (let i2 = 0, il = nodes.length; i2 < il; i2++) {\n scene.add(nodes[i2]);\n }\n const reduceAssociations = (node) => {\n const reducedAssociations = /* @__PURE__ */ new Map();\n for (const [key, value] of parser2.associations) {\n if (key instanceof three__WEBPACK_IMPORTED_MODULE_42__.Material || key instanceof three__WEBPACK_IMPORTED_MODULE_42__.Texture) {\n reducedAssociations.set(key, value);\n }\n }\n node.traverse((node2) => {\n const mappings = parser2.associations.get(node2);\n if (mappings != null) {\n reducedAssociations.set(node2, mappings);\n }\n });\n return reducedAssociations;\n };\n parser2.associations = reduceAssociations(scene);\n return scene;\n });\n }\n}\nfunction computeBounds(geometry2, primitiveDef, parser2) {\n const attributes = primitiveDef.attributes;\n const box = new three__WEBPACK_IMPORTED_MODULE_42__.Box3();\n if (attributes.POSITION !== void 0) {\n const accessor = parser2.json.accessors[attributes.POSITION];\n const min = accessor.min;\n const max = accessor.max;\n if (min !== void 0 && max !== void 0) {\n box.set(new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(min[0], min[1], min[2]), new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(max[0], max[1], max[2]));\n if (accessor.normalized) {\n const boxScale = getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[accessor.componentType]);\n box.min.multiplyScalar(boxScale);\n box.max.multiplyScalar(boxScale);\n }\n } else {\n console.warn(\"THREE.GLTFLoader: Missing min/max properties for accessor POSITION.\");\n return;\n }\n } else {\n return;\n }\n const targets = primitiveDef.targets;\n if (targets !== void 0) {\n const maxDisplacement = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const vector = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n for (let i2 = 0, il = targets.length; i2 < il; i2++) {\n const target = targets[i2];\n if (target.POSITION !== void 0) {\n const accessor = parser2.json.accessors[target.POSITION];\n const min = accessor.min;\n const max = accessor.max;\n if (min !== void 0 && max !== void 0) {\n vector.setX(Math.max(Math.abs(min[0]), Math.abs(max[0])));\n vector.setY(Math.max(Math.abs(min[1]), Math.abs(max[1])));\n vector.setZ(Math.max(Math.abs(min[2]), Math.abs(max[2])));\n if (accessor.normalized) {\n const boxScale = getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[accessor.componentType]);\n vector.multiplyScalar(boxScale);\n }\n maxDisplacement.max(vector);\n } else {\n console.warn(\"THREE.GLTFLoader: Missing min/max properties for accessor POSITION.\");\n }\n }\n }\n box.expandByVector(maxDisplacement);\n }\n geometry2.boundingBox = box;\n const sphere = new three__WEBPACK_IMPORTED_MODULE_42__.Sphere();\n box.getCenter(sphere.center);\n sphere.radius = box.min.distanceTo(box.max) / 2;\n geometry2.boundingSphere = sphere;\n}\nfunction addPrimitiveAttributes(geometry2, primitiveDef, parser2) {\n const attributes = primitiveDef.attributes;\n const pending = [];\n function assignAttributeAccessor(accessorIndex, attributeName) {\n return parser2.getDependency(\"accessor\", accessorIndex).then(function(accessor) {\n geometry2.setAttribute(attributeName, accessor);\n });\n }\n for (const gltfAttributeName in attributes) {\n const threeAttributeName = ATTRIBUTES[gltfAttributeName] || gltfAttributeName.toLowerCase();\n if (threeAttributeName in geometry2.attributes)\n continue;\n pending.push(assignAttributeAccessor(attributes[gltfAttributeName], threeAttributeName));\n }\n if (primitiveDef.indices !== void 0 && !geometry2.index) {\n const accessor = parser2.getDependency(\"accessor\", primitiveDef.indices).then(function(accessor2) {\n geometry2.setIndex(accessor2);\n });\n pending.push(accessor);\n }\n assignExtrasToUserData(geometry2, primitiveDef);\n computeBounds(geometry2, primitiveDef, parser2);\n return Promise.all(pending).then(function() {\n return primitiveDef.targets !== void 0 ? addMorphTargets(geometry2, primitiveDef.targets, parser2) : geometry2;\n });\n}\nconst DEFAULT_HAND_PROFILE_PATH = \"https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles/generic-hand/\";\nclass XRHandMeshModel {\n constructor(handModel, controller, path = DEFAULT_HAND_PROFILE_PATH, handedness, customModelPath) {\n __publicField(this, \"controller\");\n __publicField(this, \"handModel\");\n __publicField(this, \"bones\");\n this.controller = controller;\n this.handModel = handModel;\n this.bones = [];\n const loader = new GLTFLoader();\n if (!customModelPath)\n loader.setPath(path);\n loader.load(customModelPath != null ? customModelPath : `${handedness}.glb`, (gltf) => {\n const object = gltf.scene.children[0];\n this.handModel.add(object);\n const mesh = object.getObjectByProperty(\"type\", \"SkinnedMesh\");\n mesh.frustumCulled = false;\n mesh.castShadow = true;\n mesh.receiveShadow = true;\n const joints = [\n \"wrist\",\n \"thumb-metacarpal\",\n \"thumb-phalanx-proximal\",\n \"thumb-phalanx-distal\",\n \"thumb-tip\",\n \"index-finger-metacarpal\",\n \"index-finger-phalanx-proximal\",\n \"index-finger-phalanx-intermediate\",\n \"index-finger-phalanx-distal\",\n \"index-finger-tip\",\n \"middle-finger-metacarpal\",\n \"middle-finger-phalanx-proximal\",\n \"middle-finger-phalanx-intermediate\",\n \"middle-finger-phalanx-distal\",\n \"middle-finger-tip\",\n \"ring-finger-metacarpal\",\n \"ring-finger-phalanx-proximal\",\n \"ring-finger-phalanx-intermediate\",\n \"ring-finger-phalanx-distal\",\n \"ring-finger-tip\",\n \"pinky-finger-metacarpal\",\n \"pinky-finger-phalanx-proximal\",\n \"pinky-finger-phalanx-intermediate\",\n \"pinky-finger-phalanx-distal\",\n \"pinky-finger-tip\"\n ];\n joints.forEach((jointName) => {\n const bone = object.getObjectByName(jointName);\n if (bone !== void 0) {\n bone.jointName = jointName;\n } else {\n console.warn(`Couldn't find ${jointName} in ${handedness} hand mesh`);\n }\n this.bones.push(bone);\n });\n });\n }\n updateMesh() {\n const XRJoints = this.controller.joints;\n for (let i2 = 0; i2 < this.bones.length; i2++) {\n const bone = this.bones[i2];\n if (bone) {\n const XRJoint = XRJoints[bone.jointName];\n if (XRJoint.visible) {\n const position = XRJoint.position;\n bone.position.copy(position);\n bone.quaternion.copy(XRJoint.quaternion);\n }\n }\n }\n }\n}\nconst TOUCH_RADIUS = 0.01;\nconst POINTING_JOINT = \"index-finger-tip\";\nclass OculusHandModel extends three__WEBPACK_IMPORTED_MODULE_42__.Object3D {\n constructor(controller, leftModelPath, rightModelPath) {\n super();\n __publicField(this, \"controller\");\n __publicField(this, \"motionController\");\n __publicField(this, \"envMap\");\n __publicField(this, \"mesh\");\n __publicField(this, \"xrInputSource\");\n this.controller = controller;\n this.motionController = null;\n this.envMap = null;\n this.mesh = null;\n this.xrInputSource = null;\n controller.addEventListener(\"connected\", (event) => {\n const xrInputSource = event.data;\n if (xrInputSource.hand && !this.motionController) {\n this.xrInputSource = xrInputSource;\n this.motionController = new XRHandMeshModel(\n this,\n controller,\n void 0,\n xrInputSource.handedness,\n xrInputSource.handedness === \"left\" ? leftModelPath : rightModelPath\n );\n }\n });\n controller.addEventListener(\"disconnected\", () => {\n this.dispose();\n });\n }\n updateMatrixWorld(force) {\n super.updateMatrixWorld(force);\n if (this.motionController) {\n this.motionController.updateMesh();\n }\n }\n getPointerPosition() {\n const indexFingerTip = this.controller.joints[POINTING_JOINT];\n if (indexFingerTip) {\n return indexFingerTip.position;\n } else {\n return null;\n }\n }\n intersectBoxObject(boxObject) {\n const pointerPosition = this.getPointerPosition();\n if (pointerPosition) {\n const indexSphere = new three__WEBPACK_IMPORTED_MODULE_42__.Sphere(pointerPosition, TOUCH_RADIUS);\n const box = new three__WEBPACK_IMPORTED_MODULE_42__.Box3().setFromObject(boxObject);\n return indexSphere.intersectsBox(box);\n } else {\n return false;\n }\n }\n checkButton(button) {\n if (this.intersectBoxObject(button)) {\n button.onPress();\n } else {\n button.onClear();\n }\n if (button.isPressed()) {\n button.whilePressed();\n }\n }\n dispose() {\n this.clear();\n this.motionController = null;\n }\n}\nconst PINCH_MAX = 0.05;\nconst PINCH_THRESHOLD = 0.02;\nconst PINCH_MIN = 0.01;\nconst POINTER_ADVANCE_MAX = 0.02;\nconst POINTER_OPACITY_MAX = 1;\nconst POINTER_OPACITY_MIN = 0.4;\nconst POINTER_FRONT_RADIUS = 2e-3;\nconst POINTER_REAR_RADIUS = 0.01;\nconst POINTER_REAR_RADIUS_MIN = 3e-3;\nconst POINTER_LENGTH = 0.035;\nconst POINTER_SEGMENTS = 16;\nconst POINTER_RINGS = 12;\nconst POINTER_HEMISPHERE_ANGLE = 110;\nconst YAXIS = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 1, 0);\nconst ZAXIS = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 0, 1);\nconst CURSOR_RADIUS = 0.02;\nconst CURSOR_MAX_DISTANCE = 1.5;\nclass OculusHandPointerModel extends three__WEBPACK_IMPORTED_MODULE_42__.Object3D {\n constructor(hand, controller) {\n super();\n this.hand = hand;\n this.controller = controller;\n this.motionController = null;\n this.envMap = null;\n this.mesh = null;\n this.pointerGeometry = null;\n this.pointerMesh = null;\n this.pointerObject = null;\n this.pinched = false;\n this.attached = false;\n this.cursorObject = null;\n this.raycaster = null;\n this._onConnected = this._onConnected.bind(this);\n this._onDisconnected = this._onDisconnected.bind(this);\n this.hand.addEventListener(\"connected\", this._onConnected);\n this.hand.addEventListener(\"disconnected\", this._onDisconnected);\n }\n _onConnected(event) {\n const xrInputSource = event.data;\n if (xrInputSource.hand) {\n this.visible = true;\n this.xrInputSource = xrInputSource;\n this.createPointer();\n }\n }\n _onDisconnected() {\n var _a2, _b2;\n this.visible = false;\n this.xrInputSource = null;\n (_a2 = this.pointerGeometry) == null ? void 0 : _a2.dispose();\n (_b2 = this.pointerMesh) == null ? void 0 : _b2.material.dispose();\n this.clear();\n }\n _drawVerticesRing(vertices, baseVector, ringIndex) {\n const segmentVector = baseVector.clone();\n for (var i2 = 0; i2 < POINTER_SEGMENTS; i2++) {\n segmentVector.applyAxisAngle(ZAXIS, Math.PI * 2 / POINTER_SEGMENTS);\n const vid = ringIndex * POINTER_SEGMENTS + i2;\n vertices[3 * vid] = segmentVector.x;\n vertices[3 * vid + 1] = segmentVector.y;\n vertices[3 * vid + 2] = segmentVector.z;\n }\n }\n _updatePointerVertices(rearRadius) {\n const vertices = this.pointerGeometry.attributes.position.array;\n const frontFaceBase = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(POINTER_FRONT_RADIUS, 0, -1 * (POINTER_LENGTH - rearRadius));\n this._drawVerticesRing(vertices, frontFaceBase, 0);\n const rearBase = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(\n Math.sin(Math.PI * POINTER_HEMISPHERE_ANGLE / 180) * rearRadius,\n Math.cos(Math.PI * POINTER_HEMISPHERE_ANGLE / 180) * rearRadius,\n 0\n );\n for (var i2 = 0; i2 < POINTER_RINGS; i2++) {\n this._drawVerticesRing(vertices, rearBase, i2 + 1);\n rearBase.applyAxisAngle(YAXIS, Math.PI * POINTER_HEMISPHERE_ANGLE / 180 / (POINTER_RINGS * -2));\n }\n const frontCenterIndex = POINTER_SEGMENTS * (1 + POINTER_RINGS);\n const rearCenterIndex = POINTER_SEGMENTS * (1 + POINTER_RINGS) + 1;\n const frontCenter = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 0, -1 * (POINTER_LENGTH - rearRadius));\n vertices[frontCenterIndex * 3] = frontCenter.x;\n vertices[frontCenterIndex * 3 + 1] = frontCenter.y;\n vertices[frontCenterIndex * 3 + 2] = frontCenter.z;\n const rearCenter = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 0, rearRadius);\n vertices[rearCenterIndex * 3] = rearCenter.x;\n vertices[rearCenterIndex * 3 + 1] = rearCenter.y;\n vertices[rearCenterIndex * 3 + 2] = rearCenter.z;\n this.pointerGeometry.setAttribute(\"position\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(vertices, 3));\n }\n createPointer() {\n var i2, j;\n const vertices = new Array(((POINTER_RINGS + 1) * POINTER_SEGMENTS + 2) * 3).fill(0);\n const indices = [];\n this.pointerGeometry = new three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry();\n this.pointerGeometry.setAttribute(\"position\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(vertices, 3));\n this._updatePointerVertices(POINTER_REAR_RADIUS);\n for (i2 = 0; i2 < POINTER_RINGS; i2++) {\n for (j = 0; j < POINTER_SEGMENTS - 1; j++) {\n indices.push(i2 * POINTER_SEGMENTS + j, i2 * POINTER_SEGMENTS + j + 1, (i2 + 1) * POINTER_SEGMENTS + j);\n indices.push(i2 * POINTER_SEGMENTS + j + 1, (i2 + 1) * POINTER_SEGMENTS + j + 1, (i2 + 1) * POINTER_SEGMENTS + j);\n }\n indices.push((i2 + 1) * POINTER_SEGMENTS - 1, i2 * POINTER_SEGMENTS, (i2 + 2) * POINTER_SEGMENTS - 1);\n indices.push(i2 * POINTER_SEGMENTS, (i2 + 1) * POINTER_SEGMENTS, (i2 + 2) * POINTER_SEGMENTS - 1);\n }\n const frontCenterIndex = POINTER_SEGMENTS * (1 + POINTER_RINGS);\n const rearCenterIndex = POINTER_SEGMENTS * (1 + POINTER_RINGS) + 1;\n for (i2 = 0; i2 < POINTER_SEGMENTS - 1; i2++) {\n indices.push(frontCenterIndex, i2 + 1, i2);\n indices.push(rearCenterIndex, i2 + POINTER_SEGMENTS * POINTER_RINGS, i2 + POINTER_SEGMENTS * POINTER_RINGS + 1);\n }\n indices.push(frontCenterIndex, 0, POINTER_SEGMENTS - 1);\n indices.push(rearCenterIndex, POINTER_SEGMENTS * (POINTER_RINGS + 1) - 1, POINTER_SEGMENTS * POINTER_RINGS);\n const material2 = new three__WEBPACK_IMPORTED_MODULE_42__.MeshBasicMaterial();\n material2.transparent = true;\n material2.opacity = POINTER_OPACITY_MIN;\n this.pointerGeometry.setIndex(indices);\n this.pointerMesh = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(this.pointerGeometry, material2);\n this.pointerMesh.position.set(0, 0, -1 * POINTER_REAR_RADIUS);\n this.pointerObject = new three__WEBPACK_IMPORTED_MODULE_42__.Object3D();\n this.pointerObject.add(this.pointerMesh);\n this.raycaster = new three__WEBPACK_IMPORTED_MODULE_42__.Raycaster();\n const cursorGeometry = new three__WEBPACK_IMPORTED_MODULE_42__.SphereGeometry(CURSOR_RADIUS, 10, 10);\n const cursorMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.MeshBasicMaterial();\n cursorMaterial.transparent = true;\n cursorMaterial.opacity = POINTER_OPACITY_MIN;\n this.cursorObject = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(cursorGeometry, cursorMaterial);\n this.pointerObject.add(this.cursorObject);\n this.add(this.pointerObject);\n }\n _updateRaycaster() {\n if (this.raycaster) {\n const pointerMatrix = this.pointerObject.matrixWorld;\n const tempMatrix = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n tempMatrix.identity().extractRotation(pointerMatrix);\n this.raycaster.ray.origin.setFromMatrixPosition(pointerMatrix);\n this.raycaster.ray.direction.set(0, 0, -1).applyMatrix4(tempMatrix);\n }\n }\n _updatePointer() {\n this.pointerObject.visible = this.controller.visible;\n const indexTip = this.hand.joints[\"index-finger-tip\"];\n const thumbTip = this.hand.joints[\"thumb-tip\"];\n const distance = indexTip.position.distanceTo(thumbTip.position);\n const position = indexTip.position.clone().add(thumbTip.position).multiplyScalar(0.5);\n this.pointerObject.position.copy(position);\n this.pointerObject.quaternion.copy(this.controller.quaternion);\n this.pinched = distance <= PINCH_THRESHOLD;\n const pinchScale = (distance - PINCH_MIN) / (PINCH_MAX - PINCH_MIN);\n const focusScale = (distance - PINCH_MIN) / (PINCH_THRESHOLD - PINCH_MIN);\n if (pinchScale > 1) {\n this._updatePointerVertices(POINTER_REAR_RADIUS);\n this.pointerMesh.position.set(0, 0, -1 * POINTER_REAR_RADIUS);\n this.pointerMesh.material.opacity = POINTER_OPACITY_MIN;\n } else if (pinchScale > 0) {\n const rearRadius = (POINTER_REAR_RADIUS - POINTER_REAR_RADIUS_MIN) * pinchScale + POINTER_REAR_RADIUS_MIN;\n this._updatePointerVertices(rearRadius);\n if (focusScale < 1) {\n this.pointerMesh.position.set(0, 0, -1 * rearRadius - (1 - focusScale) * POINTER_ADVANCE_MAX);\n this.pointerMesh.material.opacity = POINTER_OPACITY_MIN + (1 - focusScale) * (POINTER_OPACITY_MAX - POINTER_OPACITY_MIN);\n } else {\n this.pointerMesh.position.set(0, 0, -1 * rearRadius);\n this.pointerMesh.material.opacity = POINTER_OPACITY_MIN;\n }\n } else {\n this._updatePointerVertices(POINTER_REAR_RADIUS_MIN);\n this.pointerMesh.position.set(0, 0, -1 * POINTER_REAR_RADIUS_MIN - POINTER_ADVANCE_MAX);\n this.pointerMesh.material.opacity = POINTER_OPACITY_MAX;\n }\n this.cursorObject.material.opacity = this.pointerMesh.material.opacity;\n }\n updateMatrixWorld(force) {\n super.updateMatrixWorld(force);\n if (this.pointerGeometry) {\n this._updatePointer();\n this._updateRaycaster();\n }\n }\n isPinched() {\n return this.pinched;\n }\n setAttached(attached) {\n this.attached = attached;\n }\n isAttached() {\n return this.attached;\n }\n intersectObject(object, recursive = true) {\n if (this.raycaster) {\n return this.raycaster.intersectObject(object, recursive);\n }\n }\n intersectObjects(objects, recursive = true) {\n if (this.raycaster) {\n return this.raycaster.intersectObjects(objects, recursive);\n }\n }\n checkIntersections(objects, recursive = false) {\n if (this.raycaster && !this.attached) {\n const intersections = this.raycaster.intersectObjects(objects, recursive);\n const direction = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 0, -1);\n if (intersections.length > 0) {\n const intersection = intersections[0];\n const distance = intersection.distance;\n this.cursorObject.position.copy(direction.multiplyScalar(distance));\n } else {\n this.cursorObject.position.copy(direction.multiplyScalar(CURSOR_MAX_DISTANCE));\n }\n }\n }\n setCursor(distance) {\n const direction = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 0, -1);\n if (this.raycaster && !this.attached) {\n this.cursorObject.position.copy(direction.multiplyScalar(distance));\n }\n }\n dispose() {\n this._onDisconnected();\n this.hand.removeEventListener(\"connected\", this._onConnected);\n this.hand.removeEventListener(\"disconnected\", this._onDisconnected);\n }\n}\nfunction createText(message, height) {\n const canvas = document.createElement(\"canvas\");\n const context = canvas.getContext(\"2d\");\n let metrics = null;\n const textHeight = 100;\n context.font = \"normal \" + textHeight + \"px Arial\";\n metrics = context.measureText(message);\n const textWidth = metrics.width;\n canvas.width = textWidth;\n canvas.height = textHeight;\n context.font = \"normal \" + textHeight + \"px Arial\";\n context.textAlign = \"center\";\n context.textBaseline = \"middle\";\n context.fillStyle = \"#ffffff\";\n context.fillText(message, textWidth / 2, textHeight / 2);\n const texture = new three__WEBPACK_IMPORTED_MODULE_42__.Texture(canvas);\n texture.needsUpdate = true;\n const material2 = new three__WEBPACK_IMPORTED_MODULE_42__.MeshBasicMaterial({\n color: 16777215,\n side: three__WEBPACK_IMPORTED_MODULE_42__.DoubleSide,\n map: texture,\n transparent: true\n });\n const geometry2 = new three__WEBPACK_IMPORTED_MODULE_42__.PlaneGeometry(height * textWidth / textHeight, height);\n const plane = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(geometry2, material2);\n return plane;\n}\nconst _VRButton = class {\n static createButton(renderer, sessionInit = {}) {\n const button = document.createElement(\"button\");\n function showEnterVR() {\n let currentSession = null;\n async function onSessionStarted(session) {\n session.addEventListener(\"end\", onSessionEnded);\n await renderer.xr.setSession(session);\n button.textContent = \"EXIT VR\";\n currentSession = session;\n }\n function onSessionEnded() {\n currentSession.removeEventListener(\"end\", onSessionEnded);\n button.textContent = \"ENTER VR\";\n currentSession = null;\n }\n button.style.display = \"\";\n button.style.cursor = \"pointer\";\n button.style.left = \"calc(50% - 50px)\";\n button.style.width = \"100px\";\n button.textContent = \"ENTER VR\";\n button.onmouseenter = () => {\n button.style.opacity = \"1.0\";\n };\n button.onmouseleave = () => {\n button.style.opacity = \"0.5\";\n };\n button.onclick = () => {\n var _a2;\n if (currentSession === null) {\n const optionalFeatures = [sessionInit.optionalFeatures, \"local-floor\", \"bounded-floor\", \"hand-tracking\"].flat().filter(Boolean);\n (_a2 = navigator.xr) == null ? void 0 : _a2.requestSession(\"immersive-vr\", { ...sessionInit, optionalFeatures }).then(onSessionStarted);\n } else {\n currentSession.end();\n }\n };\n }\n function disableButton() {\n button.style.display = \"\";\n button.style.cursor = \"auto\";\n button.style.left = \"calc(50% - 75px)\";\n button.style.width = \"150px\";\n button.onmouseenter = null;\n button.onmouseleave = null;\n button.onclick = null;\n }\n function showWebXRNotFound() {\n disableButton();\n button.textContent = \"VR NOT SUPPORTED\";\n }\n function stylizeElement(element) {\n element.style.position = \"absolute\";\n element.style.bottom = \"20px\";\n element.style.padding = \"12px 6px\";\n element.style.border = \"1px solid #fff\";\n element.style.borderRadius = \"4px\";\n element.style.background = \"rgba(0,0,0,0.1)\";\n element.style.color = \"#fff\";\n element.style.font = \"normal 13px sans-serif\";\n element.style.textAlign = \"center\";\n element.style.opacity = \"0.5\";\n element.style.outline = \"none\";\n element.style.zIndex = \"999\";\n }\n if (\"xr\" in navigator) {\n stylizeElement(button);\n button.id = \"VRButton\";\n button.style.display = \"none\";\n navigator.xr.isSessionSupported(\"immersive-vr\").then((supported) => {\n supported ? showEnterVR() : showWebXRNotFound();\n if (supported && _VRButton.xrSessionIsGranted) {\n button.click();\n }\n });\n return button;\n } else {\n const message = document.createElement(\"a\");\n if (window.isSecureContext === false) {\n message.href = document.location.href.replace(/^http:/, \"https:\");\n message.innerHTML = \"WEBXR NEEDS HTTPS\";\n } else {\n message.href = \"https://immersiveweb.dev/\";\n message.innerHTML = \"WEBXR NOT AVAILABLE\";\n }\n message.style.left = \"calc(50% - 90px)\";\n message.style.width = \"180px\";\n message.style.textDecoration = \"none\";\n stylizeElement(message);\n return message;\n }\n }\n static registerSessionGrantedListener() {\n if (\"xr\" in navigator) {\n navigator.xr.addEventListener(\"sessiongranted\", () => {\n _VRButton.xrSessionIsGranted = true;\n });\n }\n }\n};\nlet VRButton = _VRButton;\n__publicField(VRButton, \"xrSessionIsGranted\", false);\nconst MotionControllerConstants = {\n Handedness: {\n NONE: \"none\",\n LEFT: \"left\",\n RIGHT: \"right\"\n },\n ComponentState: {\n DEFAULT: \"default\",\n TOUCHED: \"touched\",\n PRESSED: \"pressed\"\n },\n ComponentProperty: {\n BUTTON: \"button\",\n X_AXIS: \"xAxis\",\n Y_AXIS: \"yAxis\",\n STATE: \"state\"\n },\n ComponentType: {\n TRIGGER: \"trigger\",\n SQUEEZE: \"squeeze\",\n TOUCHPAD: \"touchpad\",\n THUMBSTICK: \"thumbstick\",\n BUTTON: \"button\"\n },\n ButtonTouchThreshold: 0.05,\n AxisTouchThreshold: 0.1,\n VisualResponseProperty: {\n TRANSFORM: \"transform\",\n VISIBILITY: \"visibility\"\n }\n};\nasync function fetchJsonFile(path) {\n const response = await fetch(path);\n if (!response.ok) {\n throw new Error(response.statusText);\n } else {\n return response.json();\n }\n}\nasync function fetchProfilesList(basePath) {\n if (!basePath) {\n throw new Error(\"No basePath supplied\");\n }\n const profileListFileName = \"profilesList.json\";\n const profilesList = await fetchJsonFile(`${basePath}/${profileListFileName}`);\n return profilesList;\n}\nasync function fetchProfile(xrInputSource, basePath, defaultProfile = null, getAssetPath = true) {\n if (!xrInputSource) {\n throw new Error(\"No xrInputSource supplied\");\n }\n if (!basePath) {\n throw new Error(\"No basePath supplied\");\n }\n const supportedProfilesList = await fetchProfilesList(basePath);\n let match = void 0;\n xrInputSource.profiles.some((profileId) => {\n const supportedProfile = supportedProfilesList[profileId];\n if (supportedProfile) {\n match = {\n profileId,\n profilePath: `${basePath}/${supportedProfile.path}`,\n deprecated: !!supportedProfile.deprecated\n };\n }\n return !!match;\n });\n if (!match) {\n if (!defaultProfile) {\n throw new Error(\"No matching profile name found\");\n }\n const supportedProfile = supportedProfilesList[defaultProfile];\n if (!supportedProfile) {\n throw new Error(`No matching profile name found and default profile \"${defaultProfile}\" missing.`);\n }\n match = {\n profileId: defaultProfile,\n profilePath: `${basePath}/${supportedProfile.path}`,\n deprecated: !!supportedProfile.deprecated\n };\n }\n const profile = await fetchJsonFile(match.profilePath);\n let assetPath = void 0;\n if (getAssetPath) {\n let layout;\n if (xrInputSource.handedness === \"any\") {\n layout = profile.layouts[Object.keys(profile.layouts)[0]];\n } else {\n layout = profile.layouts[xrInputSource.handedness];\n }\n if (!layout) {\n throw new Error(`No matching handedness, ${xrInputSource.handedness}, in profile ${match.profileId}`);\n }\n if (layout.assetPath) {\n assetPath = match.profilePath.replace(\"profile.json\", layout.assetPath);\n }\n }\n return { profile, assetPath };\n}\nconst defaultComponentValues = {\n xAxis: 0,\n yAxis: 0,\n button: 0,\n state: MotionControllerConstants.ComponentState.DEFAULT\n};\nfunction normalizeAxes(x = 0, y = 0) {\n let xAxis2 = x;\n let yAxis2 = y;\n const hypotenuse = Math.sqrt(x * x + y * y);\n if (hypotenuse > 1) {\n const theta = Math.atan2(y, x);\n xAxis2 = Math.cos(theta);\n yAxis2 = Math.sin(theta);\n }\n const result = {\n normalizedXAxis: xAxis2 * 0.5 + 0.5,\n normalizedYAxis: yAxis2 * 0.5 + 0.5\n };\n return result;\n}\nclass VisualResponse {\n constructor(visualResponseDescription) {\n __publicField(this, \"value\");\n __publicField(this, \"componentProperty\");\n __publicField(this, \"states\");\n __publicField(this, \"valueNodeName\");\n __publicField(this, \"valueNodeProperty\");\n __publicField(this, \"minNodeName\");\n __publicField(this, \"maxNodeName\");\n __publicField(this, \"valueNode\");\n __publicField(this, \"minNode\");\n __publicField(this, \"maxNode\");\n this.componentProperty = visualResponseDescription.componentProperty;\n this.states = visualResponseDescription.states;\n this.valueNodeName = visualResponseDescription.valueNodeName;\n this.valueNodeProperty = visualResponseDescription.valueNodeProperty;\n if (this.valueNodeProperty === MotionControllerConstants.VisualResponseProperty.TRANSFORM) {\n this.minNodeName = visualResponseDescription.minNodeName;\n this.maxNodeName = visualResponseDescription.maxNodeName;\n }\n this.value = 0;\n this.updateFromComponent(defaultComponentValues);\n }\n /**\n * Computes the visual response's interpolation weight based on component state\n * @param {Object} componentValues - The component from which to update\n * @param {number | undefined} xAxis - The reported X axis value of the component\n * @param {number | undefined} yAxis - The reported Y axis value of the component\n * @param {number | undefined} button - The reported value of the component's button\n * @param {string} state - The component's active state\n */\n updateFromComponent({\n xAxis: xAxis2,\n yAxis: yAxis2,\n button,\n state\n }) {\n const { normalizedXAxis, normalizedYAxis } = normalizeAxes(xAxis2, yAxis2);\n switch (this.componentProperty) {\n case MotionControllerConstants.ComponentProperty.X_AXIS:\n this.value = this.states.includes(state) ? normalizedXAxis : 0.5;\n break;\n case MotionControllerConstants.ComponentProperty.Y_AXIS:\n this.value = this.states.includes(state) ? normalizedYAxis : 0.5;\n break;\n case MotionControllerConstants.ComponentProperty.BUTTON:\n this.value = this.states.includes(state) && button ? button : 0;\n break;\n case MotionControllerConstants.ComponentProperty.STATE:\n if (this.valueNodeProperty === MotionControllerConstants.VisualResponseProperty.VISIBILITY) {\n this.value = this.states.includes(state);\n } else {\n this.value = this.states.includes(state) ? 1 : 0;\n }\n break;\n default:\n throw new Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`);\n }\n }\n}\nclass Component {\n /**\n * @param {string} componentId - Id of the component\n * @param {InputProfileComponent} componentDescription - Description of the component to be created\n */\n constructor(componentId, componentDescription) {\n __publicField(this, \"id\");\n __publicField(this, \"values\");\n __publicField(this, \"type\");\n __publicField(this, \"gamepadIndices\");\n __publicField(this, \"rootNodeName\");\n __publicField(this, \"visualResponses\");\n __publicField(this, \"touchPointNodeName\");\n __publicField(this, \"touchPointNode\");\n if (!componentId || !componentDescription || !componentDescription.visualResponses || !componentDescription.gamepadIndices || Object.keys(componentDescription.gamepadIndices).length === 0) {\n throw new Error(\"Invalid arguments supplied\");\n }\n this.id = componentId;\n this.type = componentDescription.type;\n this.rootNodeName = componentDescription.rootNodeName;\n this.touchPointNodeName = componentDescription.touchPointNodeName;\n this.visualResponses = {};\n Object.keys(componentDescription.visualResponses).forEach((responseName) => {\n const visualResponse = new VisualResponse(componentDescription.visualResponses[responseName]);\n this.visualResponses[responseName] = visualResponse;\n });\n this.gamepadIndices = Object.assign({}, componentDescription.gamepadIndices);\n this.values = {\n state: MotionControllerConstants.ComponentState.DEFAULT,\n button: this.gamepadIndices.button !== void 0 ? 0 : void 0,\n xAxis: this.gamepadIndices.xAxis !== void 0 ? 0 : void 0,\n yAxis: this.gamepadIndices.yAxis !== void 0 ? 0 : void 0\n };\n }\n get data() {\n const data = { id: this.id, ...this.values };\n return data;\n }\n /**\n * @description Poll for updated data based on current gamepad state\n * @param {Object} gamepad - The gamepad object from which the component data should be polled\n */\n updateFromGamepad(gamepad) {\n this.values.state = MotionControllerConstants.ComponentState.DEFAULT;\n if (this.gamepadIndices.button !== void 0 && gamepad.buttons.length > this.gamepadIndices.button) {\n const gamepadButton = gamepad.buttons[this.gamepadIndices.button];\n this.values.button = gamepadButton.value;\n this.values.button = this.values.button < 0 ? 0 : this.values.button;\n this.values.button = this.values.button > 1 ? 1 : this.values.button;\n if (gamepadButton.pressed || this.values.button === 1) {\n this.values.state = MotionControllerConstants.ComponentState.PRESSED;\n } else if (gamepadButton.touched || this.values.button > MotionControllerConstants.ButtonTouchThreshold) {\n this.values.state = MotionControllerConstants.ComponentState.TOUCHED;\n }\n }\n if (this.gamepadIndices.xAxis !== void 0 && gamepad.axes.length > this.gamepadIndices.xAxis) {\n this.values.xAxis = gamepad.axes[this.gamepadIndices.xAxis];\n this.values.xAxis = this.values.xAxis < -1 ? -1 : this.values.xAxis;\n this.values.xAxis = this.values.xAxis > 1 ? 1 : this.values.xAxis;\n if (this.values.state === MotionControllerConstants.ComponentState.DEFAULT && Math.abs(this.values.xAxis) > MotionControllerConstants.AxisTouchThreshold) {\n this.values.state = MotionControllerConstants.ComponentState.TOUCHED;\n }\n }\n if (this.gamepadIndices.yAxis !== void 0 && gamepad.axes.length > this.gamepadIndices.yAxis) {\n this.values.yAxis = gamepad.axes[this.gamepadIndices.yAxis];\n this.values.yAxis = this.values.yAxis < -1 ? -1 : this.values.yAxis;\n this.values.yAxis = this.values.yAxis > 1 ? 1 : this.values.yAxis;\n if (this.values.state === MotionControllerConstants.ComponentState.DEFAULT && Math.abs(this.values.yAxis) > MotionControllerConstants.AxisTouchThreshold) {\n this.values.state = MotionControllerConstants.ComponentState.TOUCHED;\n }\n }\n Object.values(this.visualResponses).forEach((visualResponse) => {\n visualResponse.updateFromComponent(this.values);\n });\n }\n}\nclass MotionController {\n /**\n * @param {XRInputSource} xrInputSource - The XRInputSource to build the MotionController around\n * @param {Profile} profile - The best matched profile description for the supplied xrInputSource\n * @param {string} assetUrl\n */\n constructor(xrInputSource, profile, assetUrl) {\n __publicField(this, \"xrInputSource\");\n __publicField(this, \"assetUrl\");\n __publicField(this, \"layoutDescription\");\n __publicField(this, \"id\");\n __publicField(this, \"components\");\n if (!xrInputSource) {\n throw new Error(\"No xrInputSource supplied\");\n }\n if (!profile) {\n throw new Error(\"No profile supplied\");\n }\n if (!profile.layouts[xrInputSource.handedness]) {\n throw new Error(\"No layout for \" + xrInputSource.handedness + \" handedness\");\n }\n this.xrInputSource = xrInputSource;\n this.assetUrl = assetUrl;\n this.id = profile.profileId;\n this.layoutDescription = profile.layouts[xrInputSource.handedness];\n this.components = {};\n Object.keys(this.layoutDescription.components).forEach((componentId) => {\n const componentDescription = this.layoutDescription.components[componentId];\n this.components[componentId] = new Component(componentId, componentDescription);\n });\n this.updateFromGamepad();\n }\n get gripSpace() {\n return this.xrInputSource.gripSpace;\n }\n get targetRaySpace() {\n return this.xrInputSource.targetRaySpace;\n }\n /**\n * @description Returns a subset of component data for simplified debugging\n */\n get data() {\n const data = [];\n Object.values(this.components).forEach((component) => {\n data.push(component.data);\n });\n return data;\n }\n /**\n * @description Poll for updated data based on current gamepad state\n */\n updateFromGamepad() {\n Object.values(this.components).forEach((component) => {\n component.updateFromGamepad(this.xrInputSource.gamepad);\n });\n }\n}\nconst DEFAULT_PROFILES_PATH = \"https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles\";\nconst DEFAULT_PROFILE = \"generic-trigger\";\nconst applyEnvironmentMap = (envMap, obj) => {\n obj.traverse((child) => {\n if (child instanceof three__WEBPACK_IMPORTED_MODULE_42__.Mesh && \"envMap\" in child.material) {\n child.material.envMap = envMap;\n child.material.needsUpdate = true;\n }\n });\n};\nclass XRControllerModel extends three__WEBPACK_IMPORTED_MODULE_42__.Object3D {\n constructor() {\n super();\n __publicField(this, \"envMap\");\n __publicField(this, \"motionController\");\n this.motionController = null;\n this.envMap = null;\n }\n setEnvironmentMap(envMap) {\n if (this.envMap == envMap) {\n return this;\n }\n this.envMap = envMap;\n applyEnvironmentMap(this.envMap, this);\n return this;\n }\n /**\n * Polls data from the XRInputSource and updates the model's components to match\n * the real world data\n */\n updateMatrixWorld(force) {\n super.updateMatrixWorld(force);\n if (!this.motionController)\n return;\n this.motionController.updateFromGamepad();\n Object.values(this.motionController.components).forEach((component) => {\n Object.values(component.visualResponses).forEach((visualResponse) => {\n const { valueNode, minNode, maxNode, value, valueNodeProperty } = visualResponse;\n if (!valueNode)\n return;\n if (valueNodeProperty === MotionControllerConstants.VisualResponseProperty.VISIBILITY && typeof value === \"boolean\") {\n valueNode.visible = value;\n } else if (valueNodeProperty === MotionControllerConstants.VisualResponseProperty.TRANSFORM && minNode && maxNode && typeof value === \"number\") {\n valueNode.quaternion.slerpQuaternions(minNode.quaternion, maxNode.quaternion, value);\n valueNode.position.lerpVectors(minNode.position, maxNode.position, value);\n }\n });\n });\n }\n}\nfunction findNodes(motionController, scene) {\n Object.values(motionController.components).forEach((component) => {\n const { type, touchPointNodeName, visualResponses } = component;\n if (type === MotionControllerConstants.ComponentType.TOUCHPAD && touchPointNodeName) {\n component.touchPointNode = scene.getObjectByName(touchPointNodeName);\n if (component.touchPointNode) {\n const sphereGeometry = new three__WEBPACK_IMPORTED_MODULE_42__.SphereGeometry(1e-3);\n const material2 = new three__WEBPACK_IMPORTED_MODULE_42__.MeshBasicMaterial({ color: 255 });\n const sphere = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(sphereGeometry, material2);\n component.touchPointNode.add(sphere);\n } else {\n console.warn(`Could not find touch dot, ${component.touchPointNodeName}, in touchpad component ${component.id}`);\n }\n }\n Object.values(visualResponses).forEach((visualResponse) => {\n const { valueNodeName, minNodeName, maxNodeName, valueNodeProperty } = visualResponse;\n if (valueNodeProperty === MotionControllerConstants.VisualResponseProperty.TRANSFORM && minNodeName && maxNodeName) {\n visualResponse.minNode = scene.getObjectByName(minNodeName);\n visualResponse.maxNode = scene.getObjectByName(maxNodeName);\n if (!visualResponse.minNode) {\n console.warn(`Could not find ${minNodeName} in the model`);\n return;\n }\n if (!visualResponse.maxNode) {\n console.warn(`Could not find ${maxNodeName} in the model`);\n return;\n }\n }\n visualResponse.valueNode = scene.getObjectByName(valueNodeName);\n if (!visualResponse.valueNode) {\n console.warn(`Could not find ${valueNodeName} in the model`);\n }\n });\n });\n}\nfunction addAssetSceneToControllerModel(controllerModel, scene) {\n findNodes(controllerModel.motionController, scene);\n if (controllerModel.envMap) {\n applyEnvironmentMap(controllerModel.envMap, scene);\n }\n controllerModel.add(scene);\n}\nclass XRControllerModelFactory {\n constructor(gltfLoader = null) {\n __publicField(this, \"gltfLoader\");\n __publicField(this, \"path\");\n __publicField(this, \"_assetCache\");\n this.gltfLoader = gltfLoader;\n this.path = DEFAULT_PROFILES_PATH;\n this._assetCache = {};\n if (!this.gltfLoader) {\n this.gltfLoader = new GLTFLoader();\n }\n }\n createControllerModel(controller) {\n const controllerModel = new XRControllerModel();\n let scene = null;\n const onConnected = (event) => {\n const xrInputSource = event.data;\n if (xrInputSource.targetRayMode !== \"tracked-pointer\" || !xrInputSource.gamepad)\n return;\n fetchProfile(xrInputSource, this.path, DEFAULT_PROFILE).then(({ profile, assetPath }) => {\n if (!assetPath) {\n throw new Error(\"no asset path\");\n }\n controllerModel.motionController = new MotionController(xrInputSource, profile, assetPath);\n const assetUrl = controllerModel.motionController.assetUrl;\n const cachedAsset = this._assetCache[assetUrl];\n if (cachedAsset) {\n scene = cachedAsset.scene.clone();\n addAssetSceneToControllerModel(controllerModel, scene);\n } else {\n if (!this.gltfLoader) {\n throw new Error(\"GLTFLoader not set.\");\n }\n this.gltfLoader.setPath(\"\");\n this.gltfLoader.load(\n controllerModel.motionController.assetUrl,\n (asset) => {\n if (!controllerModel.motionController) {\n console.warn(\"motionController gone while gltf load, bailing...\");\n return;\n }\n this._assetCache[assetUrl] = asset;\n scene = asset.scene.clone();\n addAssetSceneToControllerModel(controllerModel, scene);\n },\n () => {\n },\n () => {\n throw new Error(`Asset ${assetUrl} missing or malformed.`);\n }\n );\n }\n }).catch((err) => {\n console.warn(err);\n });\n };\n controller.addEventListener(\"connected\", onConnected);\n const onDisconnected = () => {\n controller.removeEventListener(\"connected\", onConnected);\n controller.removeEventListener(\"disconnected\", onDisconnected);\n controllerModel.motionController = null;\n if (scene) {\n controllerModel.remove(scene);\n }\n scene = null;\n };\n controller.addEventListener(\"disconnected\", onDisconnected);\n return controllerModel;\n }\n}\nclass SessionLightProbe {\n constructor(xrLight, renderer, lightProbe, environmentEstimation, estimationStartCallback) {\n this.xrLight = xrLight;\n this.renderer = renderer;\n this.lightProbe = lightProbe;\n this.xrWebGLBinding = null;\n this.estimationStartCallback = estimationStartCallback;\n this.frameCallback = this.onXRFrame.bind(this);\n const session = renderer.xr.getSession();\n if (environmentEstimation && \"XRWebGLBinding\" in window) {\n const cubeRenderTarget = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLCubeRenderTarget(16);\n xrLight.environment = cubeRenderTarget.texture;\n const gl = renderer.getContext();\n switch (session.preferredReflectionFormat) {\n case \"srgba8\":\n gl.getExtension(\"EXT_sRGB\");\n break;\n case \"rgba16f\":\n gl.getExtension(\"OES_texture_half_float\");\n break;\n }\n this.xrWebGLBinding = new XRWebGLBinding(session, gl);\n this.lightProbe.addEventListener(\"reflectionchange\", () => {\n this.updateReflection();\n });\n }\n session.requestAnimationFrame(this.frameCallback);\n }\n updateReflection() {\n const textureProperties = this.renderer.properties.get(this.xrLight.environment);\n if (textureProperties) {\n const cubeMap = this.xrWebGLBinding.getReflectionCubeMap(this.lightProbe);\n if (cubeMap) {\n textureProperties.__webglTexture = cubeMap;\n this.xrLight.environment.needsPMREMUpdate = true;\n }\n }\n }\n onXRFrame(time, xrFrame) {\n if (!this.xrLight) {\n return;\n }\n const session = xrFrame.session;\n session.requestAnimationFrame(this.frameCallback);\n const lightEstimate = xrFrame.getLightEstimate(this.lightProbe);\n if (lightEstimate) {\n this.xrLight.lightProbe.sh.fromArray(lightEstimate.sphericalHarmonicsCoefficients);\n this.xrLight.lightProbe.intensity = 1;\n const intensityScalar = Math.max(\n 1,\n Math.max(\n lightEstimate.primaryLightIntensity.x,\n Math.max(lightEstimate.primaryLightIntensity.y, lightEstimate.primaryLightIntensity.z)\n )\n );\n this.xrLight.directionalLight.color.setRGB(\n lightEstimate.primaryLightIntensity.x / intensityScalar,\n lightEstimate.primaryLightIntensity.y / intensityScalar,\n lightEstimate.primaryLightIntensity.z / intensityScalar\n );\n this.xrLight.directionalLight.intensity = intensityScalar;\n this.xrLight.directionalLight.position.copy(lightEstimate.primaryLightDirection);\n if (this.estimationStartCallback) {\n this.estimationStartCallback();\n this.estimationStartCallback = null;\n }\n }\n }\n dispose() {\n this.xrLight = null;\n this.renderer = null;\n this.lightProbe = null;\n this.xrWebGLBinding = null;\n }\n}\nclass XREstimatedLight extends three__WEBPACK_IMPORTED_MODULE_42__.Group {\n constructor(renderer, environmentEstimation = true) {\n super();\n this.lightProbe = new three__WEBPACK_IMPORTED_MODULE_42__.LightProbe();\n this.lightProbe.intensity = 0;\n this.add(this.lightProbe);\n this.directionalLight = new three__WEBPACK_IMPORTED_MODULE_42__.DirectionalLight();\n this.directionalLight.intensity = 0;\n this.add(this.directionalLight);\n this.environment = null;\n let sessionLightProbe = null;\n let estimationStarted = false;\n renderer.xr.addEventListener(\"sessionstart\", () => {\n const session = renderer.xr.getSession();\n if (\"requestLightProbe\" in session) {\n session.requestLightProbe({\n reflectionFormat: session.preferredReflectionFormat\n }).then((probe) => {\n sessionLightProbe = new SessionLightProbe(this, renderer, probe, environmentEstimation, () => {\n estimationStarted = true;\n this.dispatchEvent({ type: \"estimationstart\" });\n });\n });\n }\n });\n renderer.xr.addEventListener(\"sessionend\", () => {\n if (sessionLightProbe) {\n sessionLightProbe.dispose();\n sessionLightProbe = null;\n }\n if (estimationStarted) {\n this.dispatchEvent({ type: \"estimationend\" });\n }\n });\n this.dispose = () => {\n if (sessionLightProbe) {\n sessionLightProbe.dispose();\n sessionLightProbe = null;\n }\n this.remove(this.lightProbe);\n this.lightProbe = null;\n this.remove(this.directionalLight);\n this.directionalLight = null;\n this.environment = null;\n };\n }\n}\nconst _matrix = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\nconst _vector$1 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nclass XRHandPrimitiveModel {\n constructor(handModel, controller, path, handedness, options) {\n this.controller = controller;\n this.handModel = handModel;\n this.envMap = null;\n let geometry2;\n if (!options || !options.primitive || options.primitive === \"sphere\") {\n geometry2 = new three__WEBPACK_IMPORTED_MODULE_42__.SphereGeometry(1, 10, 10);\n } else if (options.primitive === \"box\") {\n geometry2 = new three__WEBPACK_IMPORTED_MODULE_42__.BoxGeometry(1, 1, 1);\n }\n const material2 = new three__WEBPACK_IMPORTED_MODULE_42__.MeshStandardMaterial();\n this.handMesh = new three__WEBPACK_IMPORTED_MODULE_42__.InstancedMesh(geometry2, material2, 30);\n this.handMesh.instanceMatrix.setUsage(three__WEBPACK_IMPORTED_MODULE_42__.DynamicDrawUsage);\n this.handMesh.castShadow = true;\n this.handMesh.receiveShadow = true;\n this.handModel.add(this.handMesh);\n this.joints = [\n \"wrist\",\n \"thumb-metacarpal\",\n \"thumb-phalanx-proximal\",\n \"thumb-phalanx-distal\",\n \"thumb-tip\",\n \"index-finger-metacarpal\",\n \"index-finger-phalanx-proximal\",\n \"index-finger-phalanx-intermediate\",\n \"index-finger-phalanx-distal\",\n \"index-finger-tip\",\n \"middle-finger-metacarpal\",\n \"middle-finger-phalanx-proximal\",\n \"middle-finger-phalanx-intermediate\",\n \"middle-finger-phalanx-distal\",\n \"middle-finger-tip\",\n \"ring-finger-metacarpal\",\n \"ring-finger-phalanx-proximal\",\n \"ring-finger-phalanx-intermediate\",\n \"ring-finger-phalanx-distal\",\n \"ring-finger-tip\",\n \"pinky-finger-metacarpal\",\n \"pinky-finger-phalanx-proximal\",\n \"pinky-finger-phalanx-intermediate\",\n \"pinky-finger-phalanx-distal\",\n \"pinky-finger-tip\"\n ];\n }\n updateMesh() {\n const defaultRadius = 8e-3;\n const joints = this.controller.joints;\n let count = 0;\n for (let i2 = 0; i2 < this.joints.length; i2++) {\n const joint = joints[this.joints[i2]];\n if (joint.visible) {\n _vector$1.setScalar(joint.jointRadius || defaultRadius);\n _matrix.compose(joint.position, joint.quaternion, _vector$1);\n this.handMesh.setMatrixAt(i2, _matrix);\n count++;\n }\n }\n this.handMesh.count = count;\n this.handMesh.instanceMatrix.needsUpdate = true;\n }\n}\nclass XRHandModel extends three__WEBPACK_IMPORTED_MODULE_42__.Object3D {\n constructor(controller) {\n super();\n this.controller = controller;\n this.motionController = null;\n this.envMap = null;\n this.mesh = null;\n }\n updateMatrixWorld(force) {\n super.updateMatrixWorld(force);\n if (this.motionController) {\n this.motionController.updateMesh();\n }\n }\n}\nclass XRHandModelFactory {\n constructor() {\n this.path = null;\n }\n setPath(path) {\n this.path = path;\n return this;\n }\n createHandModel(controller, profile) {\n const handModel = new XRHandModel(controller);\n controller.addEventListener(\"connected\", (event) => {\n const xrInputSource = event.data;\n if (xrInputSource.hand && !handModel.motionController) {\n handModel.xrInputSource = xrInputSource;\n if (profile === void 0 || profile === \"spheres\") {\n handModel.motionController = new XRHandPrimitiveModel(\n handModel,\n controller,\n this.path,\n xrInputSource.handedness,\n { primitive: \"sphere\" }\n );\n } else if (profile === \"boxes\") {\n handModel.motionController = new XRHandPrimitiveModel(\n handModel,\n controller,\n this.path,\n xrInputSource.handedness,\n { primitive: \"box\" }\n );\n } else if (profile === \"mesh\") {\n handModel.motionController = new XRHandMeshModel(handModel, controller, this.path, xrInputSource.handedness);\n }\n }\n });\n controller.addEventListener(\"disconnected\", () => {\n });\n return handModel;\n }\n}\nclass ParametricGeometry extends three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry {\n constructor(func = (u, v, target) => target.set(u, v, Math.cos(u) * Math.sin(v)), slices = 8, stacks = 8) {\n super();\n this.type = \"ParametricGeometry\";\n this.parameters = {\n func,\n slices,\n stacks\n };\n const indices = [];\n const vertices = [];\n const normals = [];\n const uvs = [];\n const EPS2 = 1e-5;\n const normal = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const p0 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(), p1 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const pu = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(), pv = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const sliceCount = slices + 1;\n for (let i2 = 0; i2 <= stacks; i2++) {\n const v = i2 / stacks;\n for (let j = 0; j <= slices; j++) {\n const u = j / slices;\n func(u, v, p0);\n vertices.push(p0.x, p0.y, p0.z);\n if (u - EPS2 >= 0) {\n func(u - EPS2, v, p1);\n pu.subVectors(p0, p1);\n } else {\n func(u + EPS2, v, p1);\n pu.subVectors(p1, p0);\n }\n if (v - EPS2 >= 0) {\n func(u, v - EPS2, p1);\n pv.subVectors(p0, p1);\n } else {\n func(u, v + EPS2, p1);\n pv.subVectors(p1, p0);\n }\n normal.crossVectors(pu, pv).normalize();\n normals.push(normal.x, normal.y, normal.z);\n uvs.push(u, v);\n }\n }\n for (let i2 = 0; i2 < stacks; i2++) {\n for (let j = 0; j < slices; j++) {\n const a2 = i2 * sliceCount + j;\n const b2 = i2 * sliceCount + j + 1;\n const c = (i2 + 1) * sliceCount + j + 1;\n const d = (i2 + 1) * sliceCount + j;\n indices.push(a2, b2, d);\n indices.push(b2, c, d);\n }\n }\n this.setIndex(indices);\n this.setAttribute(\"position\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(vertices, 3));\n this.setAttribute(\"normal\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(normals, 3));\n this.setAttribute(\"uv\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(uvs, 2));\n }\n}\nclass TubeGeometry extends ParametricGeometry {\n constructor(path, segments = 64, radius = 1, segmentsRadius = 8, closed = false) {\n const numpoints = segments + 1;\n const frames = path.computeFrenetFrames(segments, closed), tangents = frames.tangents, normals = frames.normals, binormals = frames.binormals;\n const position = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n function ParametricTube(u, v, target) {\n v *= 2 * Math.PI;\n const i2 = Math.floor(u * (numpoints - 1));\n path.getPointAt(u, position);\n const normal = normals[i2];\n const binormal = binormals[i2];\n const cx = -radius * Math.cos(v);\n const cy = radius * Math.sin(v);\n position.x += cx * normal.x + cy * binormal.x;\n position.y += cx * normal.y + cy * binormal.y;\n position.z += cx * normal.z + cy * binormal.z;\n target.copy(position);\n }\n super(ParametricTube, segments, segmentsRadius);\n this.tangents = tangents;\n this.normals = normals;\n this.binormals = binormals;\n this.path = path;\n this.segments = segments;\n this.radius = radius;\n this.segmentsRadius = segmentsRadius;\n this.closed = closed;\n }\n}\nconst ParametricGeometries = {\n klein: function(v, u, target) {\n u *= Math.PI;\n v *= 2 * Math.PI;\n u = u * 2;\n let x, z;\n if (u < Math.PI) {\n x = 3 * Math.cos(u) * (1 + Math.sin(u)) + 2 * (1 - Math.cos(u) / 2) * Math.cos(u) * Math.cos(v);\n z = -8 * Math.sin(u) - 2 * (1 - Math.cos(u) / 2) * Math.sin(u) * Math.cos(v);\n } else {\n x = 3 * Math.cos(u) * (1 + Math.sin(u)) + 2 * (1 - Math.cos(u) / 2) * Math.cos(v + Math.PI);\n z = -8 * Math.sin(u);\n }\n const y = -2 * (1 - Math.cos(u) / 2) * Math.sin(v);\n target.set(x, y, z);\n },\n plane: function(width, height) {\n return function(u, v, target) {\n const x = u * width;\n const y = 0;\n const z = v * height;\n target.set(x, y, z);\n };\n },\n mobius: function(u, t2, target) {\n u = u - 0.5;\n const v = 2 * Math.PI * t2;\n const a2 = 2;\n const x = Math.cos(v) * (a2 + u * Math.cos(v / 2));\n const y = Math.sin(v) * (a2 + u * Math.cos(v / 2));\n const z = u * Math.sin(v / 2);\n target.set(x, y, z);\n },\n mobius3d: function(u, t2, target) {\n u *= Math.PI;\n t2 *= 2 * Math.PI;\n u = u * 2;\n const phi = u / 2;\n const major = 2.25, a2 = 0.125, b2 = 0.65;\n let x = a2 * Math.cos(t2) * Math.cos(phi) - b2 * Math.sin(t2) * Math.sin(phi);\n const z = a2 * Math.cos(t2) * Math.sin(phi) + b2 * Math.sin(t2) * Math.cos(phi);\n const y = (major + x) * Math.sin(u);\n x = (major + x) * Math.cos(u);\n target.set(x, y, z);\n },\n TubeGeometry,\n TorusKnotGeometry: class TorusKnotGeometry extends TubeGeometry {\n constructor(radius = 200, tube = 40, segmentsT = 64, segmentsR = 8, p = 2, q = 3) {\n class TorusKnotCurve extends three__WEBPACK_IMPORTED_MODULE_42__.Curve {\n getPoint(t2, optionalTarget = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3()) {\n const point = optionalTarget;\n t2 *= Math.PI * 2;\n const r = 0.5;\n const x = (1 + r * Math.cos(q * t2)) * Math.cos(p * t2);\n const y = (1 + r * Math.cos(q * t2)) * Math.sin(p * t2);\n const z = r * Math.sin(q * t2);\n return point.set(x, y, z).multiplyScalar(radius);\n }\n }\n const segments = segmentsT;\n const radiusSegments = segmentsR;\n const extrudePath = new TorusKnotCurve();\n super(extrudePath, segments, tube, radiusSegments, true, false);\n this.radius = radius;\n this.tube = tube;\n this.segmentsT = segmentsT;\n this.segmentsR = segmentsR;\n this.p = p;\n this.q = q;\n }\n },\n SphereGeometry: class SphereGeometry2 extends ParametricGeometry {\n constructor(size2, u, v) {\n function sphere(u2, v2, target) {\n u2 *= Math.PI;\n v2 *= 2 * Math.PI;\n const x = size2 * Math.sin(u2) * Math.cos(v2);\n const y = size2 * Math.sin(u2) * Math.sin(v2);\n const z = size2 * Math.cos(u2);\n target.set(x, y, z);\n }\n super(sphere, u, v);\n }\n },\n PlaneGeometry: class PlaneGeometry2 extends ParametricGeometry {\n constructor(width, depth, segmentsWidth, segmentsDepth) {\n function plane(u, v, target) {\n const x = u * width;\n const y = 0;\n const z = v * depth;\n target.set(x, y, z);\n }\n super(plane, segmentsWidth, segmentsDepth);\n }\n }\n};\nconst tempNormal = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nfunction getUv(faceDirVector, normal, uvAxis, projectionAxis, radius, sideLength) {\n const totArcLength = 2 * Math.PI * radius / 4;\n const centerLength = Math.max(sideLength - 2 * radius, 0);\n const halfArc = Math.PI / 4;\n tempNormal.copy(normal);\n tempNormal[projectionAxis] = 0;\n tempNormal.normalize();\n const arcUvRatio = 0.5 * totArcLength / (totArcLength + centerLength);\n const arcAngleRatio = 1 - tempNormal.angleTo(faceDirVector) / halfArc;\n if (Math.sign(tempNormal[uvAxis]) === 1) {\n return arcAngleRatio * arcUvRatio;\n } else {\n const lenUv = centerLength / (totArcLength + centerLength);\n return lenUv + arcUvRatio + arcUvRatio * (1 - arcAngleRatio);\n }\n}\nclass RoundedBoxGeometry extends three__WEBPACK_IMPORTED_MODULE_42__.BoxGeometry {\n constructor(width = 1, height = 1, depth = 1, segments = 2, radius = 0.1) {\n segments = segments * 2 + 1;\n radius = Math.min(width / 2, height / 2, depth / 2, radius);\n super(1, 1, 1, segments, segments, segments);\n if (segments === 1)\n return;\n const geometry2 = this.toNonIndexed();\n this.index = null;\n this.attributes.position = geometry2.attributes.position;\n this.attributes.normal = geometry2.attributes.normal;\n this.attributes.uv = geometry2.attributes.uv;\n const position = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const normal = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const box = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(width, height, depth).divideScalar(2).subScalar(radius);\n const positions = this.attributes.position.array;\n const normals = this.attributes.normal.array;\n const uvs = this.attributes.uv.array;\n const faceTris = positions.length / 6;\n const faceDirVector = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const halfSegmentSize = 0.5 / segments;\n for (let i2 = 0, j = 0; i2 < positions.length; i2 += 3, j += 2) {\n position.fromArray(positions, i2);\n normal.copy(position);\n normal.x -= Math.sign(normal.x) * halfSegmentSize;\n normal.y -= Math.sign(normal.y) * halfSegmentSize;\n normal.z -= Math.sign(normal.z) * halfSegmentSize;\n normal.normalize();\n positions[i2 + 0] = box.x * Math.sign(position.x) + normal.x * radius;\n positions[i2 + 1] = box.y * Math.sign(position.y) + normal.y * radius;\n positions[i2 + 2] = box.z * Math.sign(position.z) + normal.z * radius;\n normals[i2 + 0] = normal.x;\n normals[i2 + 1] = normal.y;\n normals[i2 + 2] = normal.z;\n const side = Math.floor(i2 / faceTris);\n switch (side) {\n case 0:\n faceDirVector.set(1, 0, 0);\n uvs[j + 0] = getUv(faceDirVector, normal, \"z\", \"y\", radius, depth);\n uvs[j + 1] = 1 - getUv(faceDirVector, normal, \"y\", \"z\", radius, height);\n break;\n case 1:\n faceDirVector.set(-1, 0, 0);\n uvs[j + 0] = 1 - getUv(faceDirVector, normal, \"z\", \"y\", radius, depth);\n uvs[j + 1] = 1 - getUv(faceDirVector, normal, \"y\", \"z\", radius, height);\n break;\n case 2:\n faceDirVector.set(0, 1, 0);\n uvs[j + 0] = 1 - getUv(faceDirVector, normal, \"x\", \"z\", radius, width);\n uvs[j + 1] = getUv(faceDirVector, normal, \"z\", \"x\", radius, depth);\n break;\n case 3:\n faceDirVector.set(0, -1, 0);\n uvs[j + 0] = 1 - getUv(faceDirVector, normal, \"x\", \"z\", radius, width);\n uvs[j + 1] = 1 - getUv(faceDirVector, normal, \"z\", \"x\", radius, depth);\n break;\n case 4:\n faceDirVector.set(0, 0, 1);\n uvs[j + 0] = 1 - getUv(faceDirVector, normal, \"x\", \"y\", radius, width);\n uvs[j + 1] = 1 - getUv(faceDirVector, normal, \"y\", \"x\", radius, height);\n break;\n case 5:\n faceDirVector.set(0, 0, -1);\n uvs[j + 0] = getUv(faceDirVector, normal, \"x\", \"y\", radius, width);\n uvs[j + 1] = 1 - getUv(faceDirVector, normal, \"y\", \"x\", radius, height);\n break;\n }\n }\n }\n}\nclass BoxLineGeometry extends three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry {\n constructor(width, height, depth, widthSegments, heightSegments, depthSegments) {\n super();\n width = width || 1;\n height = height || 1;\n depth = depth || 1;\n widthSegments = Math.floor(widthSegments) || 1;\n heightSegments = Math.floor(heightSegments) || 1;\n depthSegments = Math.floor(depthSegments) || 1;\n const widthHalf = width / 2;\n const heightHalf = height / 2;\n const depthHalf = depth / 2;\n const segmentWidth = width / widthSegments;\n const segmentHeight = height / heightSegments;\n const segmentDepth = depth / depthSegments;\n const vertices = [];\n let x = -widthHalf, y = -heightHalf, z = -depthHalf;\n for (let i2 = 0; i2 <= widthSegments; i2++) {\n vertices.push(x, -heightHalf, -depthHalf, x, heightHalf, -depthHalf);\n vertices.push(x, heightHalf, -depthHalf, x, heightHalf, depthHalf);\n vertices.push(x, heightHalf, depthHalf, x, -heightHalf, depthHalf);\n vertices.push(x, -heightHalf, depthHalf, x, -heightHalf, -depthHalf);\n x += segmentWidth;\n }\n for (let i2 = 0; i2 <= heightSegments; i2++) {\n vertices.push(-widthHalf, y, -depthHalf, widthHalf, y, -depthHalf);\n vertices.push(widthHalf, y, -depthHalf, widthHalf, y, depthHalf);\n vertices.push(widthHalf, y, depthHalf, -widthHalf, y, depthHalf);\n vertices.push(-widthHalf, y, depthHalf, -widthHalf, y, -depthHalf);\n y += segmentHeight;\n }\n for (let i2 = 0; i2 <= depthSegments; i2++) {\n vertices.push(-widthHalf, -heightHalf, z, -widthHalf, heightHalf, z);\n vertices.push(-widthHalf, heightHalf, z, widthHalf, heightHalf, z);\n vertices.push(widthHalf, heightHalf, z, widthHalf, -heightHalf, z);\n vertices.push(widthHalf, -heightHalf, z, -widthHalf, -heightHalf, z);\n z += segmentDepth;\n }\n this.setAttribute(\"position\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(vertices, 3));\n }\n}\nclass DecalGeometry extends three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry {\n constructor(mesh, position, orientation, size2) {\n super();\n const vertices = [];\n const normals = [];\n const uvs = [];\n const plane = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const projectorMatrix = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n projectorMatrix.makeRotationFromEuler(orientation);\n projectorMatrix.setPosition(position);\n const projectorMatrixInverse = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n projectorMatrixInverse.copy(projectorMatrix).invert();\n generate2();\n this.setAttribute(\"position\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(vertices, 3));\n this.setAttribute(\"normal\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(normals, 3));\n this.setAttribute(\"uv\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(uvs, 2));\n function generate2() {\n let i2;\n let decalVertices = [];\n const vertex = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const normal = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n if (mesh.geometry.isGeometry === true) {\n console.error(\"THREE.DecalGeometry no longer supports THREE.Geometry. Use BufferGeometry instead.\");\n return;\n }\n const geometry2 = mesh.geometry;\n const positionAttribute = geometry2.attributes.position;\n const normalAttribute = geometry2.attributes.normal;\n if (geometry2.index !== null) {\n const index = geometry2.index;\n for (i2 = 0; i2 < index.count; i2++) {\n vertex.fromBufferAttribute(positionAttribute, index.getX(i2));\n normal.fromBufferAttribute(normalAttribute, index.getX(i2));\n pushDecalVertex(decalVertices, vertex, normal);\n }\n } else {\n for (i2 = 0; i2 < positionAttribute.count; i2++) {\n vertex.fromBufferAttribute(positionAttribute, i2);\n normal.fromBufferAttribute(normalAttribute, i2);\n pushDecalVertex(decalVertices, vertex, normal);\n }\n }\n decalVertices = clipGeometry(decalVertices, plane.set(1, 0, 0));\n decalVertices = clipGeometry(decalVertices, plane.set(-1, 0, 0));\n decalVertices = clipGeometry(decalVertices, plane.set(0, 1, 0));\n decalVertices = clipGeometry(decalVertices, plane.set(0, -1, 0));\n decalVertices = clipGeometry(decalVertices, plane.set(0, 0, 1));\n decalVertices = clipGeometry(decalVertices, plane.set(0, 0, -1));\n for (i2 = 0; i2 < decalVertices.length; i2++) {\n const decalVertex = decalVertices[i2];\n uvs.push(0.5 + decalVertex.position.x / size2.x, 0.5 + decalVertex.position.y / size2.y);\n decalVertex.position.applyMatrix4(projectorMatrix);\n vertices.push(decalVertex.position.x, decalVertex.position.y, decalVertex.position.z);\n normals.push(decalVertex.normal.x, decalVertex.normal.y, decalVertex.normal.z);\n }\n }\n function pushDecalVertex(decalVertices, vertex, normal) {\n vertex.applyMatrix4(mesh.matrixWorld);\n vertex.applyMatrix4(projectorMatrixInverse);\n normal.transformDirection(mesh.matrixWorld);\n decalVertices.push(new DecalVertex(vertex.clone(), normal.clone()));\n }\n function clipGeometry(inVertices, plane2) {\n const outVertices = [];\n const s = 0.5 * Math.abs(size2.dot(plane2));\n for (let i2 = 0; i2 < inVertices.length; i2 += 3) {\n let v1Out, v2Out, v3Out, total = 0;\n let nV1, nV2, nV3, nV4;\n const d1 = inVertices[i2 + 0].position.dot(plane2) - s;\n const d2 = inVertices[i2 + 1].position.dot(plane2) - s;\n const d3 = inVertices[i2 + 2].position.dot(plane2) - s;\n v1Out = d1 > 0;\n v2Out = d2 > 0;\n v3Out = d3 > 0;\n total = (v1Out ? 1 : 0) + (v2Out ? 1 : 0) + (v3Out ? 1 : 0);\n switch (total) {\n case 0: {\n outVertices.push(inVertices[i2]);\n outVertices.push(inVertices[i2 + 1]);\n outVertices.push(inVertices[i2 + 2]);\n break;\n }\n case 1: {\n if (v1Out) {\n nV1 = inVertices[i2 + 1];\n nV2 = inVertices[i2 + 2];\n nV3 = clip(inVertices[i2], nV1, plane2, s);\n nV4 = clip(inVertices[i2], nV2, plane2, s);\n }\n if (v2Out) {\n nV1 = inVertices[i2];\n nV2 = inVertices[i2 + 2];\n nV3 = clip(inVertices[i2 + 1], nV1, plane2, s);\n nV4 = clip(inVertices[i2 + 1], nV2, plane2, s);\n outVertices.push(nV3);\n outVertices.push(nV2.clone());\n outVertices.push(nV1.clone());\n outVertices.push(nV2.clone());\n outVertices.push(nV3.clone());\n outVertices.push(nV4);\n break;\n }\n if (v3Out) {\n nV1 = inVertices[i2];\n nV2 = inVertices[i2 + 1];\n nV3 = clip(inVertices[i2 + 2], nV1, plane2, s);\n nV4 = clip(inVertices[i2 + 2], nV2, plane2, s);\n }\n outVertices.push(nV1.clone());\n outVertices.push(nV2.clone());\n outVertices.push(nV3);\n outVertices.push(nV4);\n outVertices.push(nV3.clone());\n outVertices.push(nV2.clone());\n break;\n }\n case 2: {\n if (!v1Out) {\n nV1 = inVertices[i2].clone();\n nV2 = clip(nV1, inVertices[i2 + 1], plane2, s);\n nV3 = clip(nV1, inVertices[i2 + 2], plane2, s);\n outVertices.push(nV1);\n outVertices.push(nV2);\n outVertices.push(nV3);\n }\n if (!v2Out) {\n nV1 = inVertices[i2 + 1].clone();\n nV2 = clip(nV1, inVertices[i2 + 2], plane2, s);\n nV3 = clip(nV1, inVertices[i2], plane2, s);\n outVertices.push(nV1);\n outVertices.push(nV2);\n outVertices.push(nV3);\n }\n if (!v3Out) {\n nV1 = inVertices[i2 + 2].clone();\n nV2 = clip(nV1, inVertices[i2], plane2, s);\n nV3 = clip(nV1, inVertices[i2 + 1], plane2, s);\n outVertices.push(nV1);\n outVertices.push(nV2);\n outVertices.push(nV3);\n }\n break;\n }\n }\n }\n return outVertices;\n }\n function clip(v0, v12, p, s) {\n const d0 = v0.position.dot(p) - s;\n const d1 = v12.position.dot(p) - s;\n const s0 = d0 / (d0 - d1);\n const v = new DecalVertex(\n new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(\n v0.position.x + s0 * (v12.position.x - v0.position.x),\n v0.position.y + s0 * (v12.position.y - v0.position.y),\n v0.position.z + s0 * (v12.position.z - v0.position.z)\n ),\n new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(\n v0.normal.x + s0 * (v12.normal.x - v0.normal.x),\n v0.normal.y + s0 * (v12.normal.y - v0.normal.y),\n v0.normal.z + s0 * (v12.normal.z - v0.normal.z)\n )\n );\n return v;\n }\n }\n}\nclass DecalVertex {\n constructor(position, normal) {\n this.position = position;\n this.normal = normal;\n }\n clone() {\n return new this.constructor(this.position.clone(), this.normal.clone());\n }\n}\nclass TeapotGeometry extends three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry {\n constructor(size2, segments, bottom, lid, body, fitLid, blinn) {\n const teapotPatches = [\n /*rim*/\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 3,\n 16,\n 17,\n 18,\n 7,\n 19,\n 20,\n 21,\n 11,\n 22,\n 23,\n 24,\n 15,\n 25,\n 26,\n 27,\n 18,\n 28,\n 29,\n 30,\n 21,\n 31,\n 32,\n 33,\n 24,\n 34,\n 35,\n 36,\n 27,\n 37,\n 38,\n 39,\n 30,\n 40,\n 41,\n 0,\n 33,\n 42,\n 43,\n 4,\n 36,\n 44,\n 45,\n 8,\n 39,\n 46,\n 47,\n 12,\n /*body*/\n 12,\n 13,\n 14,\n 15,\n 48,\n 49,\n 50,\n 51,\n 52,\n 53,\n 54,\n 55,\n 56,\n 57,\n 58,\n 59,\n 15,\n 25,\n 26,\n 27,\n 51,\n 60,\n 61,\n 62,\n 55,\n 63,\n 64,\n 65,\n 59,\n 66,\n 67,\n 68,\n 27,\n 37,\n 38,\n 39,\n 62,\n 69,\n 70,\n 71,\n 65,\n 72,\n 73,\n 74,\n 68,\n 75,\n 76,\n 77,\n 39,\n 46,\n 47,\n 12,\n 71,\n 78,\n 79,\n 48,\n 74,\n 80,\n 81,\n 52,\n 77,\n 82,\n 83,\n 56,\n 56,\n 57,\n 58,\n 59,\n 84,\n 85,\n 86,\n 87,\n 88,\n 89,\n 90,\n 91,\n 92,\n 93,\n 94,\n 95,\n 59,\n 66,\n 67,\n 68,\n 87,\n 96,\n 97,\n 98,\n 91,\n 99,\n 100,\n 101,\n 95,\n 102,\n 103,\n 104,\n 68,\n 75,\n 76,\n 77,\n 98,\n 105,\n 106,\n 107,\n 101,\n 108,\n 109,\n 110,\n 104,\n 111,\n 112,\n 113,\n 77,\n 82,\n 83,\n 56,\n 107,\n 114,\n 115,\n 84,\n 110,\n 116,\n 117,\n 88,\n 113,\n 118,\n 119,\n 92,\n /*handle*/\n 120,\n 121,\n 122,\n 123,\n 124,\n 125,\n 126,\n 127,\n 128,\n 129,\n 130,\n 131,\n 132,\n 133,\n 134,\n 135,\n 123,\n 136,\n 137,\n 120,\n 127,\n 138,\n 139,\n 124,\n 131,\n 140,\n 141,\n 128,\n 135,\n 142,\n 143,\n 132,\n 132,\n 133,\n 134,\n 135,\n 144,\n 145,\n 146,\n 147,\n 148,\n 149,\n 150,\n 151,\n 68,\n 152,\n 153,\n 154,\n 135,\n 142,\n 143,\n 132,\n 147,\n 155,\n 156,\n 144,\n 151,\n 157,\n 158,\n 148,\n 154,\n 159,\n 160,\n 68,\n /*spout*/\n 161,\n 162,\n 163,\n 164,\n 165,\n 166,\n 167,\n 168,\n 169,\n 170,\n 171,\n 172,\n 173,\n 174,\n 175,\n 176,\n 164,\n 177,\n 178,\n 161,\n 168,\n 179,\n 180,\n 165,\n 172,\n 181,\n 182,\n 169,\n 176,\n 183,\n 184,\n 173,\n 173,\n 174,\n 175,\n 176,\n 185,\n 186,\n 187,\n 188,\n 189,\n 190,\n 191,\n 192,\n 193,\n 194,\n 195,\n 196,\n 176,\n 183,\n 184,\n 173,\n 188,\n 197,\n 198,\n 185,\n 192,\n 199,\n 200,\n 189,\n 196,\n 201,\n 202,\n 193,\n /*lid*/\n 203,\n 203,\n 203,\n 203,\n 204,\n 205,\n 206,\n 207,\n 208,\n 208,\n 208,\n 208,\n 209,\n 210,\n 211,\n 212,\n 203,\n 203,\n 203,\n 203,\n 207,\n 213,\n 214,\n 215,\n 208,\n 208,\n 208,\n 208,\n 212,\n 216,\n 217,\n 218,\n 203,\n 203,\n 203,\n 203,\n 215,\n 219,\n 220,\n 221,\n 208,\n 208,\n 208,\n 208,\n 218,\n 222,\n 223,\n 224,\n 203,\n 203,\n 203,\n 203,\n 221,\n 225,\n 226,\n 204,\n 208,\n 208,\n 208,\n 208,\n 224,\n 227,\n 228,\n 209,\n 209,\n 210,\n 211,\n 212,\n 229,\n 230,\n 231,\n 232,\n 233,\n 234,\n 235,\n 236,\n 237,\n 238,\n 239,\n 240,\n 212,\n 216,\n 217,\n 218,\n 232,\n 241,\n 242,\n 243,\n 236,\n 244,\n 245,\n 246,\n 240,\n 247,\n 248,\n 249,\n 218,\n 222,\n 223,\n 224,\n 243,\n 250,\n 251,\n 252,\n 246,\n 253,\n 254,\n 255,\n 249,\n 256,\n 257,\n 258,\n 224,\n 227,\n 228,\n 209,\n 252,\n 259,\n 260,\n 229,\n 255,\n 261,\n 262,\n 233,\n 258,\n 263,\n 264,\n 237,\n /*bottom*/\n 265,\n 265,\n 265,\n 265,\n 266,\n 267,\n 268,\n 269,\n 270,\n 271,\n 272,\n 273,\n 92,\n 119,\n 118,\n 113,\n 265,\n 265,\n 265,\n 265,\n 269,\n 274,\n 275,\n 276,\n 273,\n 277,\n 278,\n 279,\n 113,\n 112,\n 111,\n 104,\n 265,\n 265,\n 265,\n 265,\n 276,\n 280,\n 281,\n 282,\n 279,\n 283,\n 284,\n 285,\n 104,\n 103,\n 102,\n 95,\n 265,\n 265,\n 265,\n 265,\n 282,\n 286,\n 287,\n 266,\n 285,\n 288,\n 289,\n 270,\n 95,\n 94,\n 93,\n 92\n ];\n const teapotVertices = [\n 1.4,\n 0,\n 2.4,\n 1.4,\n -0.784,\n 2.4,\n 0.784,\n -1.4,\n 2.4,\n 0,\n -1.4,\n 2.4,\n 1.3375,\n 0,\n 2.53125,\n 1.3375,\n -0.749,\n 2.53125,\n 0.749,\n -1.3375,\n 2.53125,\n 0,\n -1.3375,\n 2.53125,\n 1.4375,\n 0,\n 2.53125,\n 1.4375,\n -0.805,\n 2.53125,\n 0.805,\n -1.4375,\n 2.53125,\n 0,\n -1.4375,\n 2.53125,\n 1.5,\n 0,\n 2.4,\n 1.5,\n -0.84,\n 2.4,\n 0.84,\n -1.5,\n 2.4,\n 0,\n -1.5,\n 2.4,\n -0.784,\n -1.4,\n 2.4,\n -1.4,\n -0.784,\n 2.4,\n -1.4,\n 0,\n 2.4,\n -0.749,\n -1.3375,\n 2.53125,\n -1.3375,\n -0.749,\n 2.53125,\n -1.3375,\n 0,\n 2.53125,\n -0.805,\n -1.4375,\n 2.53125,\n -1.4375,\n -0.805,\n 2.53125,\n -1.4375,\n 0,\n 2.53125,\n -0.84,\n -1.5,\n 2.4,\n -1.5,\n -0.84,\n 2.4,\n -1.5,\n 0,\n 2.4,\n -1.4,\n 0.784,\n 2.4,\n -0.784,\n 1.4,\n 2.4,\n 0,\n 1.4,\n 2.4,\n -1.3375,\n 0.749,\n 2.53125,\n -0.749,\n 1.3375,\n 2.53125,\n 0,\n 1.3375,\n 2.53125,\n -1.4375,\n 0.805,\n 2.53125,\n -0.805,\n 1.4375,\n 2.53125,\n 0,\n 1.4375,\n 2.53125,\n -1.5,\n 0.84,\n 2.4,\n -0.84,\n 1.5,\n 2.4,\n 0,\n 1.5,\n 2.4,\n 0.784,\n 1.4,\n 2.4,\n 1.4,\n 0.784,\n 2.4,\n 0.749,\n 1.3375,\n 2.53125,\n 1.3375,\n 0.749,\n 2.53125,\n 0.805,\n 1.4375,\n 2.53125,\n 1.4375,\n 0.805,\n 2.53125,\n 0.84,\n 1.5,\n 2.4,\n 1.5,\n 0.84,\n 2.4,\n 1.75,\n 0,\n 1.875,\n 1.75,\n -0.98,\n 1.875,\n 0.98,\n -1.75,\n 1.875,\n 0,\n -1.75,\n 1.875,\n 2,\n 0,\n 1.35,\n 2,\n -1.12,\n 1.35,\n 1.12,\n -2,\n 1.35,\n 0,\n -2,\n 1.35,\n 2,\n 0,\n 0.9,\n 2,\n -1.12,\n 0.9,\n 1.12,\n -2,\n 0.9,\n 0,\n -2,\n 0.9,\n -0.98,\n -1.75,\n 1.875,\n -1.75,\n -0.98,\n 1.875,\n -1.75,\n 0,\n 1.875,\n -1.12,\n -2,\n 1.35,\n -2,\n -1.12,\n 1.35,\n -2,\n 0,\n 1.35,\n -1.12,\n -2,\n 0.9,\n -2,\n -1.12,\n 0.9,\n -2,\n 0,\n 0.9,\n -1.75,\n 0.98,\n 1.875,\n -0.98,\n 1.75,\n 1.875,\n 0,\n 1.75,\n 1.875,\n -2,\n 1.12,\n 1.35,\n -1.12,\n 2,\n 1.35,\n 0,\n 2,\n 1.35,\n -2,\n 1.12,\n 0.9,\n -1.12,\n 2,\n 0.9,\n 0,\n 2,\n 0.9,\n 0.98,\n 1.75,\n 1.875,\n 1.75,\n 0.98,\n 1.875,\n 1.12,\n 2,\n 1.35,\n 2,\n 1.12,\n 1.35,\n 1.12,\n 2,\n 0.9,\n 2,\n 1.12,\n 0.9,\n 2,\n 0,\n 0.45,\n 2,\n -1.12,\n 0.45,\n 1.12,\n -2,\n 0.45,\n 0,\n -2,\n 0.45,\n 1.5,\n 0,\n 0.225,\n 1.5,\n -0.84,\n 0.225,\n 0.84,\n -1.5,\n 0.225,\n 0,\n -1.5,\n 0.225,\n 1.5,\n 0,\n 0.15,\n 1.5,\n -0.84,\n 0.15,\n 0.84,\n -1.5,\n 0.15,\n 0,\n -1.5,\n 0.15,\n -1.12,\n -2,\n 0.45,\n -2,\n -1.12,\n 0.45,\n -2,\n 0,\n 0.45,\n -0.84,\n -1.5,\n 0.225,\n -1.5,\n -0.84,\n 0.225,\n -1.5,\n 0,\n 0.225,\n -0.84,\n -1.5,\n 0.15,\n -1.5,\n -0.84,\n 0.15,\n -1.5,\n 0,\n 0.15,\n -2,\n 1.12,\n 0.45,\n -1.12,\n 2,\n 0.45,\n 0,\n 2,\n 0.45,\n -1.5,\n 0.84,\n 0.225,\n -0.84,\n 1.5,\n 0.225,\n 0,\n 1.5,\n 0.225,\n -1.5,\n 0.84,\n 0.15,\n -0.84,\n 1.5,\n 0.15,\n 0,\n 1.5,\n 0.15,\n 1.12,\n 2,\n 0.45,\n 2,\n 1.12,\n 0.45,\n 0.84,\n 1.5,\n 0.225,\n 1.5,\n 0.84,\n 0.225,\n 0.84,\n 1.5,\n 0.15,\n 1.5,\n 0.84,\n 0.15,\n -1.6,\n 0,\n 2.025,\n -1.6,\n -0.3,\n 2.025,\n -1.5,\n -0.3,\n 2.25,\n -1.5,\n 0,\n 2.25,\n -2.3,\n 0,\n 2.025,\n -2.3,\n -0.3,\n 2.025,\n -2.5,\n -0.3,\n 2.25,\n -2.5,\n 0,\n 2.25,\n -2.7,\n 0,\n 2.025,\n -2.7,\n -0.3,\n 2.025,\n -3,\n -0.3,\n 2.25,\n -3,\n 0,\n 2.25,\n -2.7,\n 0,\n 1.8,\n -2.7,\n -0.3,\n 1.8,\n -3,\n -0.3,\n 1.8,\n -3,\n 0,\n 1.8,\n -1.5,\n 0.3,\n 2.25,\n -1.6,\n 0.3,\n 2.025,\n -2.5,\n 0.3,\n 2.25,\n -2.3,\n 0.3,\n 2.025,\n -3,\n 0.3,\n 2.25,\n -2.7,\n 0.3,\n 2.025,\n -3,\n 0.3,\n 1.8,\n -2.7,\n 0.3,\n 1.8,\n -2.7,\n 0,\n 1.575,\n -2.7,\n -0.3,\n 1.575,\n -3,\n -0.3,\n 1.35,\n -3,\n 0,\n 1.35,\n -2.5,\n 0,\n 1.125,\n -2.5,\n -0.3,\n 1.125,\n -2.65,\n -0.3,\n 0.9375,\n -2.65,\n 0,\n 0.9375,\n -2,\n -0.3,\n 0.9,\n -1.9,\n -0.3,\n 0.6,\n -1.9,\n 0,\n 0.6,\n -3,\n 0.3,\n 1.35,\n -2.7,\n 0.3,\n 1.575,\n -2.65,\n 0.3,\n 0.9375,\n -2.5,\n 0.3,\n 1.125,\n -1.9,\n 0.3,\n 0.6,\n -2,\n 0.3,\n 0.9,\n 1.7,\n 0,\n 1.425,\n 1.7,\n -0.66,\n 1.425,\n 1.7,\n -0.66,\n 0.6,\n 1.7,\n 0,\n 0.6,\n 2.6,\n 0,\n 1.425,\n 2.6,\n -0.66,\n 1.425,\n 3.1,\n -0.66,\n 0.825,\n 3.1,\n 0,\n 0.825,\n 2.3,\n 0,\n 2.1,\n 2.3,\n -0.25,\n 2.1,\n 2.4,\n -0.25,\n 2.025,\n 2.4,\n 0,\n 2.025,\n 2.7,\n 0,\n 2.4,\n 2.7,\n -0.25,\n 2.4,\n 3.3,\n -0.25,\n 2.4,\n 3.3,\n 0,\n 2.4,\n 1.7,\n 0.66,\n 0.6,\n 1.7,\n 0.66,\n 1.425,\n 3.1,\n 0.66,\n 0.825,\n 2.6,\n 0.66,\n 1.425,\n 2.4,\n 0.25,\n 2.025,\n 2.3,\n 0.25,\n 2.1,\n 3.3,\n 0.25,\n 2.4,\n 2.7,\n 0.25,\n 2.4,\n 2.8,\n 0,\n 2.475,\n 2.8,\n -0.25,\n 2.475,\n 3.525,\n -0.25,\n 2.49375,\n 3.525,\n 0,\n 2.49375,\n 2.9,\n 0,\n 2.475,\n 2.9,\n -0.15,\n 2.475,\n 3.45,\n -0.15,\n 2.5125,\n 3.45,\n 0,\n 2.5125,\n 2.8,\n 0,\n 2.4,\n 2.8,\n -0.15,\n 2.4,\n 3.2,\n -0.15,\n 2.4,\n 3.2,\n 0,\n 2.4,\n 3.525,\n 0.25,\n 2.49375,\n 2.8,\n 0.25,\n 2.475,\n 3.45,\n 0.15,\n 2.5125,\n 2.9,\n 0.15,\n 2.475,\n 3.2,\n 0.15,\n 2.4,\n 2.8,\n 0.15,\n 2.4,\n 0,\n 0,\n 3.15,\n 0.8,\n 0,\n 3.15,\n 0.8,\n -0.45,\n 3.15,\n 0.45,\n -0.8,\n 3.15,\n 0,\n -0.8,\n 3.15,\n 0,\n 0,\n 2.85,\n 0.2,\n 0,\n 2.7,\n 0.2,\n -0.112,\n 2.7,\n 0.112,\n -0.2,\n 2.7,\n 0,\n -0.2,\n 2.7,\n -0.45,\n -0.8,\n 3.15,\n -0.8,\n -0.45,\n 3.15,\n -0.8,\n 0,\n 3.15,\n -0.112,\n -0.2,\n 2.7,\n -0.2,\n -0.112,\n 2.7,\n -0.2,\n 0,\n 2.7,\n -0.8,\n 0.45,\n 3.15,\n -0.45,\n 0.8,\n 3.15,\n 0,\n 0.8,\n 3.15,\n -0.2,\n 0.112,\n 2.7,\n -0.112,\n 0.2,\n 2.7,\n 0,\n 0.2,\n 2.7,\n 0.45,\n 0.8,\n 3.15,\n 0.8,\n 0.45,\n 3.15,\n 0.112,\n 0.2,\n 2.7,\n 0.2,\n 0.112,\n 2.7,\n 0.4,\n 0,\n 2.55,\n 0.4,\n -0.224,\n 2.55,\n 0.224,\n -0.4,\n 2.55,\n 0,\n -0.4,\n 2.55,\n 1.3,\n 0,\n 2.55,\n 1.3,\n -0.728,\n 2.55,\n 0.728,\n -1.3,\n 2.55,\n 0,\n -1.3,\n 2.55,\n 1.3,\n 0,\n 2.4,\n 1.3,\n -0.728,\n 2.4,\n 0.728,\n -1.3,\n 2.4,\n 0,\n -1.3,\n 2.4,\n -0.224,\n -0.4,\n 2.55,\n -0.4,\n -0.224,\n 2.55,\n -0.4,\n 0,\n 2.55,\n -0.728,\n -1.3,\n 2.55,\n -1.3,\n -0.728,\n 2.55,\n -1.3,\n 0,\n 2.55,\n -0.728,\n -1.3,\n 2.4,\n -1.3,\n -0.728,\n 2.4,\n -1.3,\n 0,\n 2.4,\n -0.4,\n 0.224,\n 2.55,\n -0.224,\n 0.4,\n 2.55,\n 0,\n 0.4,\n 2.55,\n -1.3,\n 0.728,\n 2.55,\n -0.728,\n 1.3,\n 2.55,\n 0,\n 1.3,\n 2.55,\n -1.3,\n 0.728,\n 2.4,\n -0.728,\n 1.3,\n 2.4,\n 0,\n 1.3,\n 2.4,\n 0.224,\n 0.4,\n 2.55,\n 0.4,\n 0.224,\n 2.55,\n 0.728,\n 1.3,\n 2.55,\n 1.3,\n 0.728,\n 2.55,\n 0.728,\n 1.3,\n 2.4,\n 1.3,\n 0.728,\n 2.4,\n 0,\n 0,\n 0,\n 1.425,\n 0,\n 0,\n 1.425,\n 0.798,\n 0,\n 0.798,\n 1.425,\n 0,\n 0,\n 1.425,\n 0,\n 1.5,\n 0,\n 0.075,\n 1.5,\n 0.84,\n 0.075,\n 0.84,\n 1.5,\n 0.075,\n 0,\n 1.5,\n 0.075,\n -0.798,\n 1.425,\n 0,\n -1.425,\n 0.798,\n 0,\n -1.425,\n 0,\n 0,\n -0.84,\n 1.5,\n 0.075,\n -1.5,\n 0.84,\n 0.075,\n -1.5,\n 0,\n 0.075,\n -1.425,\n -0.798,\n 0,\n -0.798,\n -1.425,\n 0,\n 0,\n -1.425,\n 0,\n -1.5,\n -0.84,\n 0.075,\n -0.84,\n -1.5,\n 0.075,\n 0,\n -1.5,\n 0.075,\n 0.798,\n -1.425,\n 0,\n 1.425,\n -0.798,\n 0,\n 0.84,\n -1.5,\n 0.075,\n 1.5,\n -0.84,\n 0.075\n ];\n super();\n size2 = size2 || 50;\n segments = segments !== void 0 ? Math.max(2, Math.floor(segments) || 10) : 10;\n bottom = bottom === void 0 ? true : bottom;\n lid = lid === void 0 ? true : lid;\n body = body === void 0 ? true : body;\n fitLid = fitLid === void 0 ? true : fitLid;\n const blinnScale = 1.3;\n blinn = blinn === void 0 ? true : blinn;\n const maxHeight = 3.15 * (blinn ? 1 : blinnScale);\n const maxHeight2 = maxHeight / 2;\n const trueSize = size2 / maxHeight2;\n let numTriangles = bottom ? (8 * segments - 4) * segments : 0;\n numTriangles += lid ? (16 * segments - 4) * segments : 0;\n numTriangles += body ? 40 * segments * segments : 0;\n const indices = new Uint32Array(numTriangles * 3);\n let numVertices = bottom ? 4 : 0;\n numVertices += lid ? 8 : 0;\n numVertices += body ? 20 : 0;\n numVertices *= (segments + 1) * (segments + 1);\n const vertices = new Float32Array(numVertices * 3);\n const normals = new Float32Array(numVertices * 3);\n const uvs = new Float32Array(numVertices * 2);\n const ms = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n ms.set(-1, 3, -3, 1, 3, -6, 3, 0, -3, 3, 0, 0, 1, 0, 0, 0);\n const g = [];\n let i2, r, c;\n const sp = [];\n const tp = [];\n const dsp = [];\n const dtp = [];\n const mgm = [];\n const vert = [];\n const sdir = [];\n const tdir = [];\n const norm = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n let tcoord;\n let sstep, tstep;\n let vertPerRow;\n let s, t2, sval, tval, p;\n let dsval = 0;\n let dtval = 0;\n const normOut = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n let v12, v2, v3, v4;\n const gmx = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n const tmtx = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n const vsp = new three__WEBPACK_IMPORTED_MODULE_42__.Vector4();\n const vtp = new three__WEBPACK_IMPORTED_MODULE_42__.Vector4();\n const vdsp = new three__WEBPACK_IMPORTED_MODULE_42__.Vector4();\n const vdtp = new three__WEBPACK_IMPORTED_MODULE_42__.Vector4();\n const vsdir = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const vtdir = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const mst = ms.clone();\n mst.transpose();\n const notDegenerate = (vtx1, vtx2, vtx3) => !(vertices[vtx1 * 3] === vertices[vtx2 * 3] && vertices[vtx1 * 3 + 1] === vertices[vtx2 * 3 + 1] && vertices[vtx1 * 3 + 2] === vertices[vtx2 * 3 + 2] || vertices[vtx1 * 3] === vertices[vtx3 * 3] && vertices[vtx1 * 3 + 1] === vertices[vtx3 * 3 + 1] && vertices[vtx1 * 3 + 2] === vertices[vtx3 * 3 + 2] || vertices[vtx2 * 3] === vertices[vtx3 * 3] && vertices[vtx2 * 3 + 1] === vertices[vtx3 * 3 + 1] && vertices[vtx2 * 3 + 2] === vertices[vtx3 * 3 + 2]);\n for (i2 = 0; i2 < 3; i2++) {\n mgm[i2] = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n }\n const minPatches = body ? 0 : 20;\n const maxPatches = bottom ? 32 : 28;\n vertPerRow = segments + 1;\n let surfCount = 0;\n let vertCount = 0;\n let normCount = 0;\n let uvCount = 0;\n let indexCount = 0;\n for (let surf = minPatches; surf < maxPatches; surf++) {\n if (lid || surf < 20 || surf >= 28) {\n for (i2 = 0; i2 < 3; i2++) {\n for (r = 0; r < 4; r++) {\n for (c = 0; c < 4; c++) {\n g[c * 4 + r] = teapotVertices[teapotPatches[surf * 16 + r * 4 + c] * 3 + i2];\n if (fitLid && surf >= 20 && surf < 28 && i2 !== 2) {\n g[c * 4 + r] *= 1.077;\n }\n if (!blinn && i2 === 2) {\n g[c * 4 + r] *= blinnScale;\n }\n }\n }\n gmx.set(g[0], g[1], g[2], g[3], g[4], g[5], g[6], g[7], g[8], g[9], g[10], g[11], g[12], g[13], g[14], g[15]);\n tmtx.multiplyMatrices(gmx, ms);\n mgm[i2].multiplyMatrices(mst, tmtx);\n }\n for (sstep = 0; sstep <= segments; sstep++) {\n s = sstep / segments;\n for (tstep = 0; tstep <= segments; tstep++) {\n t2 = tstep / segments;\n for (p = 4, sval = tval = 1; p--; ) {\n sp[p] = sval;\n tp[p] = tval;\n sval *= s;\n tval *= t2;\n if (p === 3) {\n dsp[p] = dtp[p] = 0;\n dsval = dtval = 1;\n } else {\n dsp[p] = dsval * (3 - p);\n dtp[p] = dtval * (3 - p);\n dsval *= s;\n dtval *= t2;\n }\n }\n vsp.fromArray(sp);\n vtp.fromArray(tp);\n vdsp.fromArray(dsp);\n vdtp.fromArray(dtp);\n for (i2 = 0; i2 < 3; i2++) {\n tcoord = vsp.clone();\n tcoord.applyMatrix4(mgm[i2]);\n vert[i2] = tcoord.dot(vtp);\n tcoord = vdsp.clone();\n tcoord.applyMatrix4(mgm[i2]);\n sdir[i2] = tcoord.dot(vtp);\n tcoord = vsp.clone();\n tcoord.applyMatrix4(mgm[i2]);\n tdir[i2] = tcoord.dot(vdtp);\n }\n vsdir.fromArray(sdir);\n vtdir.fromArray(tdir);\n norm.crossVectors(vtdir, vsdir);\n norm.normalize();\n if (vert[0] === 0 && vert[1] === 0) {\n normOut.set(0, vert[2] > maxHeight2 ? 1 : -1, 0);\n } else {\n normOut.set(norm.x, norm.z, -norm.y);\n }\n vertices[vertCount++] = trueSize * vert[0];\n vertices[vertCount++] = trueSize * (vert[2] - maxHeight2);\n vertices[vertCount++] = -trueSize * vert[1];\n normals[normCount++] = normOut.x;\n normals[normCount++] = normOut.y;\n normals[normCount++] = normOut.z;\n uvs[uvCount++] = 1 - t2;\n uvs[uvCount++] = 1 - s;\n }\n }\n for (sstep = 0; sstep < segments; sstep++) {\n for (tstep = 0; tstep < segments; tstep++) {\n v12 = surfCount * vertPerRow * vertPerRow + sstep * vertPerRow + tstep;\n v2 = v12 + 1;\n v3 = v2 + vertPerRow;\n v4 = v12 + vertPerRow;\n if (notDegenerate(v12, v2, v3)) {\n indices[indexCount++] = v12;\n indices[indexCount++] = v2;\n indices[indexCount++] = v3;\n }\n if (notDegenerate(v12, v3, v4)) {\n indices[indexCount++] = v12;\n indices[indexCount++] = v3;\n indices[indexCount++] = v4;\n }\n }\n }\n surfCount++;\n }\n }\n this.setIndex(new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(indices, 1));\n this.setAttribute(\"position\", new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(vertices, 3));\n this.setAttribute(\"normal\", new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(normals, 3));\n this.setAttribute(\"uv\", new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(uvs, 2));\n this.computeBoundingSphere();\n }\n}\nclass TextGeometry extends three__WEBPACK_IMPORTED_MODULE_42__.ExtrudeGeometry {\n constructor(text, parameters = {}) {\n const {\n bevelEnabled = false,\n bevelSize = 8,\n bevelThickness = 10,\n font,\n height = 50,\n size: size2 = 100,\n lineHeight = 1,\n letterSpacing = 0,\n ...rest2\n } = parameters;\n if (font === void 0) {\n super();\n } else {\n const shapes = font.generateShapes(text, size2, { lineHeight, letterSpacing });\n super(shapes, { ...rest2, bevelEnabled, bevelSize, bevelThickness, depth: height });\n }\n this.type = \"TextGeometry\";\n }\n}\nconst inverseProjectionMatrix = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\nclass CSMFrustum {\n constructor(data) {\n data = data || {};\n this.vertices = {\n near: [new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(), new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(), new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(), new three__WEBPACK_IMPORTED_MODULE_42__.Vector3()],\n far: [new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(), new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(), new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(), new three__WEBPACK_IMPORTED_MODULE_42__.Vector3()]\n };\n if (data.projectionMatrix !== void 0) {\n this.setFromProjectionMatrix(data.projectionMatrix, data.maxFar || 1e4);\n }\n }\n setFromProjectionMatrix(projectionMatrix, maxFar) {\n const isOrthographic = projectionMatrix.elements[2 * 4 + 3] === 0;\n inverseProjectionMatrix.copy(projectionMatrix).invert();\n this.vertices.near[0].set(1, 1, -1);\n this.vertices.near[1].set(1, -1, -1);\n this.vertices.near[2].set(-1, -1, -1);\n this.vertices.near[3].set(-1, 1, -1);\n this.vertices.near.forEach(function(v) {\n v.applyMatrix4(inverseProjectionMatrix);\n });\n this.vertices.far[0].set(1, 1, 1);\n this.vertices.far[1].set(1, -1, 1);\n this.vertices.far[2].set(-1, -1, 1);\n this.vertices.far[3].set(-1, 1, 1);\n this.vertices.far.forEach(function(v) {\n v.applyMatrix4(inverseProjectionMatrix);\n const absZ = Math.abs(v.z);\n if (isOrthographic) {\n v.z *= Math.min(maxFar / absZ, 1);\n } else {\n v.multiplyScalar(Math.min(maxFar / absZ, 1));\n }\n });\n return this.vertices;\n }\n split(breaks, target) {\n while (breaks.length > target.length) {\n target.push(new CSMFrustum());\n }\n target.length = breaks.length;\n for (let i2 = 0; i2 < breaks.length; i2++) {\n const cascade = target[i2];\n if (i2 === 0) {\n for (let j = 0; j < 4; j++) {\n cascade.vertices.near[j].copy(this.vertices.near[j]);\n }\n } else {\n for (let j = 0; j < 4; j++) {\n cascade.vertices.near[j].lerpVectors(this.vertices.near[j], this.vertices.far[j], breaks[i2 - 1]);\n }\n }\n if (i2 === breaks.length - 1) {\n for (let j = 0; j < 4; j++) {\n cascade.vertices.far[j].copy(this.vertices.far[j]);\n }\n } else {\n for (let j = 0; j < 4; j++) {\n cascade.vertices.far[j].lerpVectors(this.vertices.near[j], this.vertices.far[j], breaks[i2]);\n }\n }\n }\n }\n toSpace(cameraMatrix, target) {\n for (let i2 = 0; i2 < 4; i2++) {\n target.vertices.near[i2].copy(this.vertices.near[i2]).applyMatrix4(cameraMatrix);\n target.vertices.far[i2].copy(this.vertices.far[i2]).applyMatrix4(cameraMatrix);\n }\n }\n}\nconst CSMShader = {\n lights_fragment_begin: (\n /* glsl */\n `\nGeometricContext geometry;\n\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n\n#ifdef CLEARCOAT\n\n\tgeometry.clearcoatNormal = clearcoatNormal;\n\n#endif\n\nIncidentLight directLight;\n\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\n\t\tpointLight = pointLights[ i ];\n\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\n\t\tspotLight = spotLights[ i ];\n\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_DIR_LIGHTS > 0) && defined( RE_Direct ) && defined( USE_CSM ) && defined( CSM_CASCADES )\n\n\tDirectionalLight directionalLight;\n\tfloat linearDepth = (vViewPosition.z) / (shadowFar - cameraNear);\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\n\t#if defined( USE_SHADOWMAP ) && defined( CSM_FADE )\n\tvec2 cascade;\n\tfloat cascadeCenter;\n\tfloat closestEdge;\n\tfloat margin;\n\tfloat csmx;\n\tfloat csmy;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\n\t \t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\t\t// NOTE: Depth gets larger away from the camera.\n\t\t\t// cascade.x is closer, cascade.y is further\n\t\t\tcascade = CSM_cascades[ i ];\n\t\t\tcascadeCenter = ( cascade.x + cascade.y ) / 2.0;\n\t\t\tclosestEdge = linearDepth < cascadeCenter ? cascade.x : cascade.y;\n\t\t\tmargin = 0.25 * pow( closestEdge, 2.0 );\n\t\t\tcsmx = cascade.x - margin / 2.0;\n\t\t\tcsmy = cascade.y + margin / 2.0;\n\t\t\tif( linearDepth >= csmx && ( linearDepth < csmy || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1 ) ) {\n\n\t\t\t\tfloat dist = min( linearDepth - csmx, csmy - linearDepth );\n\t\t\t\tfloat ratio = clamp( dist / margin, 0.0, 1.0 );\n\n\t\t\t\tvec3 prevColor = directLight.color;\n\t\t\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\t\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\n\t\t\t\tbool shouldFadeLastCascade = UNROLLED_LOOP_INDEX == CSM_CASCADES - 1 && linearDepth > cascadeCenter;\n\t\t\t\tdirectLight.color = mix( prevColor, directLight.color, shouldFadeLastCascade ? ratio : 1.0 );\n\n\t\t\t\tReflectedLight prevLight = reflectedLight;\n\t\t\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t\t\t\tbool shouldBlend = UNROLLED_LOOP_INDEX != CSM_CASCADES - 1 || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1 && linearDepth < cascadeCenter;\n\t\t\t\tfloat blendRatio = shouldBlend ? ratio : 1.0;\n\n\t\t\t\treflectedLight.directDiffuse = mix( prevLight.directDiffuse, reflectedLight.directDiffuse, blendRatio );\n\t\t\t\treflectedLight.directSpecular = mix( prevLight.directSpecular, reflectedLight.directSpecular, blendRatio );\n\t\t\t\treflectedLight.indirectDiffuse = mix( prevLight.indirectDiffuse, reflectedLight.indirectDiffuse, blendRatio );\n\t\t\t\treflectedLight.indirectSpecular = mix( prevLight.indirectSpecular, reflectedLight.indirectSpecular, blendRatio );\n\n\t\t\t}\n\t \t#endif\n\n\t}\n\t#pragma unroll_loop_end\n\t#else\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\t\tdirectionalLight = directionalLights[ i ];\n\t\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\n\t\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\n\t\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\t\tif(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y) directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\n\t\t\tif(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && (linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1)) RE_Direct( directLight, geometry, material, reflectedLight );\n\n\t\t\t#endif\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t#endif\n\n\t#if ( NUM_DIR_LIGHTS > NUM_DIR_LIGHT_SHADOWS)\n\t\t// compute the lights not casting shadows (if any)\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = NUM_DIR_LIGHT_SHADOWS; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\t\tdirectionalLight = directionalLights[ i ];\n\n\t\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\n\t\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t#endif\n\n#endif\n\n\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) && !defined( USE_CSM ) && !defined( CSM_CASCADES )\n\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\tdirectionalLight = directionalLights[ i ];\n\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\n\tRectAreaLight rectAreaLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if defined( RE_IndirectDiffuse )\n\n\tvec3 iblIrradiance = vec3( 0.0 );\n\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t#endif\n\n#endif\n\n#if defined( RE_IndirectSpecular )\n\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n\n#endif\n`\n ),\n getlights_pars_begin() {\n return (\n /* glsl */\n `\n\t\t\t#if defined( USE_CSM ) && defined( CSM_CASCADES )\n\t\t\tuniform vec2 CSM_cascades[CSM_CASCADES];\n\t\t\tuniform float cameraNear;\n\t\t\tuniform float shadowFar;\n\t\t\t#endif\n\n\t\t\t${three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.lights_pars_begin}\n\t\t`\n );\n }\n};\nconst _cameraToLightMatrix = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\nconst _lightSpaceFrustum = /* @__PURE__ */ new CSMFrustum();\nconst _center = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst _bbox = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Box3();\nconst _uniformArray = [];\nconst _logArray = [];\nclass CSM {\n constructor(data) {\n data = data || {};\n this.camera = data.camera;\n this.parent = data.parent;\n this.cascades = data.cascades || 3;\n this.maxFar = data.maxFar || 1e5;\n this.mode = data.mode || \"practical\";\n this.shadowMapSize = data.shadowMapSize || 2048;\n this.shadowBias = data.shadowBias || 1e-6;\n this.lightDirection = data.lightDirection || new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(1, -1, 1).normalize();\n this.lightIntensity = data.lightIntensity || 1;\n this.lightNear = data.lightNear || 1;\n this.lightFar = data.lightFar || 2e3;\n this.lightMargin = data.lightMargin || 200;\n this.customSplitsCallback = data.customSplitsCallback;\n this.fade = false;\n this.mainFrustum = new CSMFrustum();\n this.frustums = [];\n this.breaks = [];\n this.lights = [];\n this.shaders = /* @__PURE__ */ new Map();\n this.createLights();\n this.updateFrustums();\n this.injectInclude();\n }\n createLights() {\n for (let i2 = 0; i2 < this.cascades; i2++) {\n const light = new three__WEBPACK_IMPORTED_MODULE_42__.DirectionalLight(16777215, this.lightIntensity);\n light.castShadow = true;\n light.shadow.mapSize.width = this.shadowMapSize;\n light.shadow.mapSize.height = this.shadowMapSize;\n light.shadow.camera.near = this.lightNear;\n light.shadow.camera.far = this.lightFar;\n light.shadow.bias = this.shadowBias;\n this.parent.add(light);\n this.parent.add(light.target);\n this.lights.push(light);\n }\n }\n initCascades() {\n const camera = this.camera;\n camera.updateProjectionMatrix();\n this.mainFrustum.setFromProjectionMatrix(camera.projectionMatrix, this.maxFar);\n this.mainFrustum.split(this.breaks, this.frustums);\n }\n updateShadowBounds() {\n const frustums = this.frustums;\n for (let i2 = 0; i2 < frustums.length; i2++) {\n const light = this.lights[i2];\n const shadowCam = light.shadow.camera;\n const frustum2 = this.frustums[i2];\n const nearVerts = frustum2.vertices.near;\n const farVerts = frustum2.vertices.far;\n const point1 = farVerts[0];\n let point2;\n if (point1.distanceTo(farVerts[2]) > point1.distanceTo(nearVerts[2])) {\n point2 = farVerts[2];\n } else {\n point2 = nearVerts[2];\n }\n let squaredBBWidth = point1.distanceTo(point2);\n if (this.fade) {\n const camera = this.camera;\n const far = Math.max(camera.far, this.maxFar);\n const linearDepth = frustum2.vertices.far[0].z / (far - camera.near);\n const margin = 0.25 * Math.pow(linearDepth, 2) * (far - camera.near);\n squaredBBWidth += margin;\n }\n shadowCam.left = -squaredBBWidth / 2;\n shadowCam.right = squaredBBWidth / 2;\n shadowCam.top = squaredBBWidth / 2;\n shadowCam.bottom = -squaredBBWidth / 2;\n shadowCam.updateProjectionMatrix();\n }\n }\n getBreaks() {\n const camera = this.camera;\n const far = Math.min(camera.far, this.maxFar);\n this.breaks.length = 0;\n switch (this.mode) {\n case \"uniform\":\n uniformSplit(this.cascades, camera.near, far, this.breaks);\n break;\n case \"logarithmic\":\n logarithmicSplit(this.cascades, camera.near, far, this.breaks);\n break;\n case \"practical\":\n practicalSplit(this.cascades, camera.near, far, 0.5, this.breaks);\n break;\n case \"custom\":\n if (this.customSplitsCallback === void 0)\n console.error(\"CSM: Custom split scheme callback not defined.\");\n this.customSplitsCallback(this.cascades, camera.near, far, this.breaks);\n break;\n }\n function uniformSplit(amount, near, far2, target) {\n for (let i2 = 1; i2 < amount; i2++) {\n target.push((near + (far2 - near) * i2 / amount) / far2);\n }\n target.push(1);\n }\n function logarithmicSplit(amount, near, far2, target) {\n for (let i2 = 1; i2 < amount; i2++) {\n target.push(near * (far2 / near) ** (i2 / amount) / far2);\n }\n target.push(1);\n }\n function practicalSplit(amount, near, far2, lambda, target) {\n _uniformArray.length = 0;\n _logArray.length = 0;\n logarithmicSplit(amount, near, far2, _logArray);\n uniformSplit(amount, near, far2, _uniformArray);\n for (let i2 = 1; i2 < amount; i2++) {\n target.push(three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.lerp(_uniformArray[i2 - 1], _logArray[i2 - 1], lambda));\n }\n target.push(1);\n }\n }\n update() {\n const camera = this.camera;\n const frustums = this.frustums;\n for (let i2 = 0; i2 < frustums.length; i2++) {\n const light = this.lights[i2];\n const shadowCam = light.shadow.camera;\n const texelWidth = (shadowCam.right - shadowCam.left) / this.shadowMapSize;\n const texelHeight = (shadowCam.top - shadowCam.bottom) / this.shadowMapSize;\n light.shadow.camera.updateMatrixWorld(true);\n _cameraToLightMatrix.multiplyMatrices(light.shadow.camera.matrixWorldInverse, camera.matrixWorld);\n frustums[i2].toSpace(_cameraToLightMatrix, _lightSpaceFrustum);\n const nearVerts = _lightSpaceFrustum.vertices.near;\n const farVerts = _lightSpaceFrustum.vertices.far;\n _bbox.makeEmpty();\n for (let j = 0; j < 4; j++) {\n _bbox.expandByPoint(nearVerts[j]);\n _bbox.expandByPoint(farVerts[j]);\n }\n _bbox.getCenter(_center);\n _center.z = _bbox.max.z + this.lightMargin;\n _center.x = Math.floor(_center.x / texelWidth) * texelWidth;\n _center.y = Math.floor(_center.y / texelHeight) * texelHeight;\n _center.applyMatrix4(light.shadow.camera.matrixWorld);\n light.position.copy(_center);\n light.target.position.copy(_center);\n light.target.position.x += this.lightDirection.x;\n light.target.position.y += this.lightDirection.y;\n light.target.position.z += this.lightDirection.z;\n }\n }\n injectInclude() {\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.lights_fragment_begin = CSMShader.lights_fragment_begin;\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk.lights_pars_begin = CSMShader.lights_pars_begin;\n }\n setupMaterial(material2) {\n material2.defines = material2.defines || {};\n material2.defines.USE_CSM = 1;\n material2.defines.CSM_CASCADES = this.cascades;\n if (this.fade) {\n material2.defines.CSM_FADE = \"\";\n }\n const breaksVec2 = [];\n const scope = this;\n const shaders2 = this.shaders;\n material2.onBeforeCompile = function(shader) {\n const far = Math.min(scope.camera.far, scope.maxFar);\n scope.getExtendedBreaks(breaksVec2);\n shader.uniforms.CSM_cascades = { value: breaksVec2 };\n shader.uniforms.cameraNear = { value: scope.camera.near };\n shader.uniforms.shadowFar = { value: far };\n shaders2.set(material2, shader);\n };\n shaders2.set(material2, null);\n }\n updateUniforms() {\n const far = Math.min(this.camera.far, this.maxFar);\n const shaders2 = this.shaders;\n shaders2.forEach(function(shader, material2) {\n if (shader !== null) {\n const uniforms = shader.uniforms;\n this.getExtendedBreaks(uniforms.CSM_cascades.value);\n uniforms.cameraNear.value = this.camera.near;\n uniforms.shadowFar.value = far;\n }\n if (!this.fade && \"CSM_FADE\" in material2.defines) {\n delete material2.defines.CSM_FADE;\n material2.needsUpdate = true;\n } else if (this.fade && !(\"CSM_FADE\" in material2.defines)) {\n material2.defines.CSM_FADE = \"\";\n material2.needsUpdate = true;\n }\n }, this);\n }\n getExtendedBreaks(target) {\n while (target.length < this.breaks.length) {\n target.push(new three__WEBPACK_IMPORTED_MODULE_42__.Vector2());\n }\n target.length = this.breaks.length;\n for (let i2 = 0; i2 < this.cascades; i2++) {\n const amount = this.breaks[i2];\n const prev = this.breaks[i2 - 1] || 0;\n target[i2].x = prev;\n target[i2].y = amount;\n }\n }\n updateFrustums() {\n this.getBreaks();\n this.initCascades();\n this.updateShadowBounds();\n this.updateUniforms();\n }\n remove() {\n for (let i2 = 0; i2 < this.lights.length; i2++) {\n this.parent.remove(this.lights[i2]);\n }\n }\n dispose() {\n const shaders2 = this.shaders;\n shaders2.forEach(function(shader, material2) {\n delete material2.onBeforeCompile;\n delete material2.defines.USE_CSM;\n delete material2.defines.CSM_CASCADES;\n delete material2.defines.CSM_FADE;\n if (shader !== null) {\n delete shader.uniforms.CSM_cascades;\n delete shader.uniforms.cameraNear;\n delete shader.uniforms.shadowFar;\n }\n material2.needsUpdate = true;\n });\n shaders2.clear();\n }\n}\nclass CSMHelper extends three__WEBPACK_IMPORTED_MODULE_42__.Group {\n constructor(csm) {\n super();\n this.csm = csm;\n this.displayFrustum = true;\n this.displayPlanes = true;\n this.displayShadowBounds = true;\n const indices = new Uint16Array([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7]);\n const positions = new Float32Array(24);\n const frustumGeometry = new three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry();\n frustumGeometry.setIndex(new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(indices, 1));\n frustumGeometry.setAttribute(\"position\", new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(positions, 3, false));\n const frustumLines = new three__WEBPACK_IMPORTED_MODULE_42__.LineSegments(frustumGeometry, new three__WEBPACK_IMPORTED_MODULE_42__.LineBasicMaterial());\n this.add(frustumLines);\n this.frustumLines = frustumLines;\n this.cascadeLines = [];\n this.cascadePlanes = [];\n this.shadowLines = [];\n }\n updateVisibility() {\n const displayFrustum = this.displayFrustum;\n const displayPlanes = this.displayPlanes;\n const displayShadowBounds = this.displayShadowBounds;\n const frustumLines = this.frustumLines;\n const cascadeLines = this.cascadeLines;\n const cascadePlanes = this.cascadePlanes;\n const shadowLines = this.shadowLines;\n for (let i2 = 0, l = cascadeLines.length; i2 < l; i2++) {\n const cascadeLine = cascadeLines[i2];\n const cascadePlane = cascadePlanes[i2];\n const shadowLineGroup = shadowLines[i2];\n cascadeLine.visible = displayFrustum;\n cascadePlane.visible = displayFrustum && displayPlanes;\n shadowLineGroup.visible = displayShadowBounds;\n }\n frustumLines.visible = displayFrustum;\n }\n update() {\n const csm = this.csm;\n const camera = csm.camera;\n const cascades = csm.cascades;\n const mainFrustum = csm.mainFrustum;\n const frustums = csm.frustums;\n const lights = csm.lights;\n const frustumLines = this.frustumLines;\n const frustumLinePositions = frustumLines.geometry.getAttribute(\"position\");\n const cascadeLines = this.cascadeLines;\n const cascadePlanes = this.cascadePlanes;\n const shadowLines = this.shadowLines;\n this.position.copy(camera.position);\n this.quaternion.copy(camera.quaternion);\n this.scale.copy(camera.scale);\n this.updateMatrixWorld(true);\n while (cascadeLines.length > cascades) {\n this.remove(cascadeLines.pop());\n this.remove(cascadePlanes.pop());\n this.remove(shadowLines.pop());\n }\n while (cascadeLines.length < cascades) {\n const cascadeLine = new three__WEBPACK_IMPORTED_MODULE_42__.Box3Helper(new three__WEBPACK_IMPORTED_MODULE_42__.Box3(), 16777215);\n const planeMat = new three__WEBPACK_IMPORTED_MODULE_42__.MeshBasicMaterial({ transparent: true, opacity: 0.1, depthWrite: false, side: three__WEBPACK_IMPORTED_MODULE_42__.DoubleSide });\n const cascadePlane = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.PlaneGeometry(), planeMat);\n const shadowLineGroup = new three__WEBPACK_IMPORTED_MODULE_42__.Group();\n const shadowLine = new three__WEBPACK_IMPORTED_MODULE_42__.Box3Helper(new three__WEBPACK_IMPORTED_MODULE_42__.Box3(), 16776960);\n shadowLineGroup.add(shadowLine);\n this.add(cascadeLine);\n this.add(cascadePlane);\n this.add(shadowLineGroup);\n cascadeLines.push(cascadeLine);\n cascadePlanes.push(cascadePlane);\n shadowLines.push(shadowLineGroup);\n }\n for (let i2 = 0; i2 < cascades; i2++) {\n const frustum2 = frustums[i2];\n const light = lights[i2];\n const shadowCam = light.shadow.camera;\n const farVerts2 = frustum2.vertices.far;\n const cascadeLine = cascadeLines[i2];\n const cascadePlane = cascadePlanes[i2];\n const shadowLineGroup = shadowLines[i2];\n const shadowLine = shadowLineGroup.children[0];\n cascadeLine.box.min.copy(farVerts2[2]);\n cascadeLine.box.max.copy(farVerts2[0]);\n cascadeLine.box.max.z += 1e-4;\n cascadePlane.position.addVectors(farVerts2[0], farVerts2[2]);\n cascadePlane.position.multiplyScalar(0.5);\n cascadePlane.scale.subVectors(farVerts2[0], farVerts2[2]);\n cascadePlane.scale.z = 1e-4;\n this.remove(shadowLineGroup);\n shadowLineGroup.position.copy(shadowCam.position);\n shadowLineGroup.quaternion.copy(shadowCam.quaternion);\n shadowLineGroup.scale.copy(shadowCam.scale);\n shadowLineGroup.updateMatrixWorld(true);\n this.attach(shadowLineGroup);\n shadowLine.box.min.set(shadowCam.bottom, shadowCam.left, -shadowCam.far);\n shadowLine.box.max.set(shadowCam.top, shadowCam.right, -shadowCam.near);\n }\n const nearVerts = mainFrustum.vertices.near;\n const farVerts = mainFrustum.vertices.far;\n frustumLinePositions.setXYZ(0, farVerts[0].x, farVerts[0].y, farVerts[0].z);\n frustumLinePositions.setXYZ(1, farVerts[3].x, farVerts[3].y, farVerts[3].z);\n frustumLinePositions.setXYZ(2, farVerts[2].x, farVerts[2].y, farVerts[2].z);\n frustumLinePositions.setXYZ(3, farVerts[1].x, farVerts[1].y, farVerts[1].z);\n frustumLinePositions.setXYZ(4, nearVerts[0].x, nearVerts[0].y, nearVerts[0].z);\n frustumLinePositions.setXYZ(5, nearVerts[3].x, nearVerts[3].y, nearVerts[3].z);\n frustumLinePositions.setXYZ(6, nearVerts[2].x, nearVerts[2].y, nearVerts[2].z);\n frustumLinePositions.setXYZ(7, nearVerts[1].x, nearVerts[1].y, nearVerts[1].z);\n frustumLinePositions.needsUpdate = true;\n }\n}\nconst ACESFilmicToneMappingShader = {\n uniforms: {\n tDiffuse: { value: null },\n exposure: { value: 1 }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"#define saturate(a) clamp( a, 0.0, 1.0 )\",\n \"uniform sampler2D tDiffuse;\",\n \"uniform float exposure;\",\n \"varying vec2 vUv;\",\n \"vec3 RRTAndODTFit( vec3 v ) {\",\n \"\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\",\n \"\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\",\n \"\treturn a / b;\",\n \"}\",\n \"vec3 ACESFilmicToneMapping( vec3 color ) {\",\n // sRGB => XYZ => D65_2_D60 => AP1 => RRT_SAT\n \"\tconst mat3 ACESInputMat = mat3(\",\n \"\t\tvec3( 0.59719, 0.07600, 0.02840 ),\",\n // transposed from source\n \"\t\tvec3( 0.35458, 0.90834, 0.13383 ),\",\n \"\t\tvec3( 0.04823, 0.01566, 0.83777 )\",\n \"\t);\",\n // ODT_SAT => XYZ => D60_2_D65 => sRGB\n \"\tconst mat3 ACESOutputMat = mat3(\",\n \"\t\tvec3( 1.60475, -0.10208, -0.00327 ),\",\n // transposed from source\n \"\t\tvec3( -0.53108, 1.10813, -0.07276 ),\",\n \"\t\tvec3( -0.07367, -0.00605, 1.07602 )\",\n \"\t);\",\n \"\tcolor = ACESInputMat * color;\",\n // Apply RRT and ODT\n \"\tcolor = RRTAndODTFit( color );\",\n \"\tcolor = ACESOutputMat * color;\",\n // Clamp to [0, 1]\n \"\treturn saturate( color );\",\n \"}\",\n \"void main() {\",\n \"\tvec4 tex = texture2D( tDiffuse, vUv );\",\n \"\ttex.rgb *= exposure / 0.6;\",\n // pre-exposed, outside of the tone mapping function\n \"\tgl_FragColor = vec4( ACESFilmicToneMapping( tex.rgb ), tex.a );\",\n \"}\"\n ].join(\"\\n\")\n};\nconst BasicShader = {\n uniforms: {},\n vertexShader: [\n \"void main() {\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\"void main() {\", \"\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\", \"}\"].join(\"\\n\")\n};\nconst BleachBypassShader = {\n uniforms: {\n tDiffuse: { value: null },\n opacity: { value: 1 }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform float opacity;\",\n \"uniform sampler2D tDiffuse;\",\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvec4 base = texture2D( tDiffuse, vUv );\",\n \"\tvec3 lumCoeff = vec3( 0.25, 0.65, 0.1 );\",\n \"\tfloat lum = dot( lumCoeff, base.rgb );\",\n \"\tvec3 blend = vec3( lum );\",\n \"\tfloat L = min( 1.0, max( 0.0, 10.0 * ( lum - 0.45 ) ) );\",\n \"\tvec3 result1 = 2.0 * base.rgb * blend;\",\n \"\tvec3 result2 = 1.0 - 2.0 * ( 1.0 - blend ) * ( 1.0 - base.rgb );\",\n \"\tvec3 newColor = mix( result1, result2, L );\",\n \"\tfloat A2 = opacity * base.a;\",\n \"\tvec3 mixRGB = A2 * newColor.rgb;\",\n \"\tmixRGB += ( ( 1.0 - A2 ) * base.rgb );\",\n \"\tgl_FragColor = vec4( mixRGB, base.a );\",\n \"}\"\n ].join(\"\\n\")\n};\nconst BlendShader = {\n uniforms: {\n tDiffuse1: { value: null },\n tDiffuse2: { value: null },\n mixRatio: { value: 0.5 },\n opacity: { value: 1 }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform float opacity;\",\n \"uniform float mixRatio;\",\n \"uniform sampler2D tDiffuse1;\",\n \"uniform sampler2D tDiffuse2;\",\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvec4 texel1 = texture2D( tDiffuse1, vUv );\",\n \"\tvec4 texel2 = texture2D( tDiffuse2, vUv );\",\n \"\tgl_FragColor = opacity * mix( texel1, texel2, mixRatio );\",\n \"}\"\n ].join(\"\\n\")\n};\nconst BrightnessContrastShader = {\n uniforms: {\n tDiffuse: { value: null },\n brightness: { value: 0 },\n contrast: { value: 0 }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform sampler2D tDiffuse;\",\n \"uniform float brightness;\",\n \"uniform float contrast;\",\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tgl_FragColor = texture2D( tDiffuse, vUv );\",\n \"\tgl_FragColor.rgb += brightness;\",\n \"\tif (contrast > 0.0) {\",\n \"\t\tgl_FragColor.rgb = (gl_FragColor.rgb - 0.5) / (1.0 - contrast) + 0.5;\",\n \"\t} else {\",\n \"\t\tgl_FragColor.rgb = (gl_FragColor.rgb - 0.5) * (1.0 + contrast) + 0.5;\",\n \"\t}\",\n \"}\"\n ].join(\"\\n\")\n};\nconst ColorCorrectionShader = {\n uniforms: {\n tDiffuse: { value: null },\n powRGB: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(2, 2, 2) },\n mulRGB: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(1, 1, 1) },\n addRGB: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 0, 0) }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform sampler2D tDiffuse;\",\n \"uniform vec3 powRGB;\",\n \"uniform vec3 mulRGB;\",\n \"uniform vec3 addRGB;\",\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tgl_FragColor = texture2D( tDiffuse, vUv );\",\n \"\tgl_FragColor.rgb = mulRGB * pow( ( gl_FragColor.rgb + addRGB ), powRGB );\",\n \"}\"\n ].join(\"\\n\")\n};\nconst ColorifyShader = {\n uniforms: {\n tDiffuse: { value: null },\n color: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Color(16777215) }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform vec3 color;\",\n \"uniform sampler2D tDiffuse;\",\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvec4 texel = texture2D( tDiffuse, vUv );\",\n \"\tvec3 luma = vec3( 0.299, 0.587, 0.114 );\",\n \"\tfloat v = dot( texel.xyz, luma );\",\n \"\tgl_FragColor = vec4( v * color, texel.w );\",\n \"}\"\n ].join(\"\\n\")\n};\nconst DOFMipMapShader = {\n uniforms: {\n tColor: { value: null },\n tDepth: { value: null },\n focus: { value: 1 },\n maxblur: { value: 1 }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform float focus;\",\n \"uniform float maxblur;\",\n \"uniform sampler2D tColor;\",\n \"uniform sampler2D tDepth;\",\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvec4 depth = texture2D( tDepth, vUv );\",\n \"\tfloat factor = depth.x - focus;\",\n \"\tvec4 col = texture2D( tColor, vUv, 2.0 * maxblur * abs( focus - depth.x ) );\",\n \"\tgl_FragColor = col;\",\n \"\tgl_FragColor.a = 1.0;\",\n \"}\"\n ].join(\"\\n\")\n};\nconst FXAAShader = {\n uniforms: {\n tDiffuse: { value: null },\n resolution: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(1 / 1024, 1 / 512) }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"precision highp float;\",\n \"\",\n \"uniform sampler2D tDiffuse;\",\n \"\",\n \"uniform vec2 resolution;\",\n \"\",\n \"varying vec2 vUv;\",\n \"\",\n \"// FXAA 3.11 implementation by NVIDIA, ported to WebGL by Agost Biro (biro@archilogic.com)\",\n \"\",\n \"//----------------------------------------------------------------------------------\",\n \"// File: es3-keplerFXAAassetsshaders/FXAA_DefaultES.frag\",\n \"// SDK Version: v3.00\",\n \"// Email: gameworks@nvidia.com\",\n \"// Site: http://developer.nvidia.com/\",\n \"//\",\n \"// Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.\",\n \"//\",\n \"// Redistribution and use in source and binary forms, with or without\",\n \"// modification, are permitted provided that the following conditions\",\n \"// are met:\",\n \"// * Redistributions of source code must retain the above copyright\",\n \"// notice, this list of conditions and the following disclaimer.\",\n \"// * Redistributions in binary form must reproduce the above copyright\",\n \"// notice, this list of conditions and the following disclaimer in the\",\n \"// documentation and/or other materials provided with the distribution.\",\n \"// * Neither the name of NVIDIA CORPORATION nor the names of its\",\n \"// contributors may be used to endorse or promote products derived\",\n \"// from this software without specific prior written permission.\",\n \"//\",\n \"// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY\",\n \"// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\",\n \"// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\",\n \"// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\",\n \"// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\",\n \"// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\",\n \"// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\",\n \"// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY\",\n \"// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\",\n \"// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\",\n \"// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\",\n \"//\",\n \"//----------------------------------------------------------------------------------\",\n \"\",\n \"#define FXAA_PC 1\",\n \"#define FXAA_GLSL_100 1\",\n \"#define FXAA_QUALITY_PRESET 12\",\n \"\",\n \"#define FXAA_GREEN_AS_LUMA 1\",\n \"\",\n \"/*--------------------------------------------------------------------------*/\",\n \"#ifndef FXAA_PC_CONSOLE\",\n \" //\",\n \" // The console algorithm for PC is included\",\n \" // for developers targeting really low spec machines.\",\n \" // Likely better to just run FXAA_PC, and use a really low preset.\",\n \" //\",\n \" #define FXAA_PC_CONSOLE 0\",\n \"#endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \"#ifndef FXAA_GLSL_120\",\n \" #define FXAA_GLSL_120 0\",\n \"#endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \"#ifndef FXAA_GLSL_130\",\n \" #define FXAA_GLSL_130 0\",\n \"#endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \"#ifndef FXAA_HLSL_3\",\n \" #define FXAA_HLSL_3 0\",\n \"#endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \"#ifndef FXAA_HLSL_4\",\n \" #define FXAA_HLSL_4 0\",\n \"#endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \"#ifndef FXAA_HLSL_5\",\n \" #define FXAA_HLSL_5 0\",\n \"#endif\",\n \"/*==========================================================================*/\",\n \"#ifndef FXAA_GREEN_AS_LUMA\",\n \" //\",\n \" // For those using non-linear color,\",\n \" // and either not able to get luma in alpha, or not wanting to,\",\n \" // this enables FXAA to run using green as a proxy for luma.\",\n \" // So with this enabled, no need to pack luma in alpha.\",\n \" //\",\n \" // This will turn off AA on anything which lacks some amount of green.\",\n \" // Pure red and blue or combination of only R and B, will get no AA.\",\n \" //\",\n \" // Might want to lower the settings for both,\",\n \" // fxaaConsoleEdgeThresholdMin\",\n \" // fxaaQualityEdgeThresholdMin\",\n \" // In order to insure AA does not get turned off on colors\",\n \" // which contain a minor amount of green.\",\n \" //\",\n \" // 1 = On.\",\n \" // 0 = Off.\",\n \" //\",\n \" #define FXAA_GREEN_AS_LUMA 0\",\n \"#endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \"#ifndef FXAA_EARLY_EXIT\",\n \" //\",\n \" // Controls algorithm's early exit path.\",\n \" // On PS3 turning this ON adds 2 cycles to the shader.\",\n \" // On 360 turning this OFF adds 10ths of a millisecond to the shader.\",\n \" // Turning this off on console will result in a more blurry image.\",\n \" // So this defaults to on.\",\n \" //\",\n \" // 1 = On.\",\n \" // 0 = Off.\",\n \" //\",\n \" #define FXAA_EARLY_EXIT 1\",\n \"#endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \"#ifndef FXAA_DISCARD\",\n \" //\",\n \" // Only valid for PC OpenGL currently.\",\n \" // Probably will not work when FXAA_GREEN_AS_LUMA = 1.\",\n \" //\",\n \" // 1 = Use discard on pixels which don't need AA.\",\n \" // For APIs which enable concurrent TEX+ROP from same surface.\",\n \" // 0 = Return unchanged color on pixels which don't need AA.\",\n \" //\",\n \" #define FXAA_DISCARD 0\",\n \"#endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \"#ifndef FXAA_FAST_PIXEL_OFFSET\",\n \" //\",\n \" // Used for GLSL 120 only.\",\n \" //\",\n \" // 1 = GL API supports fast pixel offsets\",\n \" // 0 = do not use fast pixel offsets\",\n \" //\",\n \" #ifdef GL_EXT_gpu_shader4\",\n \" #define FXAA_FAST_PIXEL_OFFSET 1\",\n \" #endif\",\n \" #ifdef GL_NV_gpu_shader5\",\n \" #define FXAA_FAST_PIXEL_OFFSET 1\",\n \" #endif\",\n \" #ifdef GL_ARB_gpu_shader5\",\n \" #define FXAA_FAST_PIXEL_OFFSET 1\",\n \" #endif\",\n \" #ifndef FXAA_FAST_PIXEL_OFFSET\",\n \" #define FXAA_FAST_PIXEL_OFFSET 0\",\n \" #endif\",\n \"#endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \"#ifndef FXAA_GATHER4_ALPHA\",\n \" //\",\n \" // 1 = API supports gather4 on alpha channel.\",\n \" // 0 = API does not support gather4 on alpha channel.\",\n \" //\",\n \" #if (FXAA_HLSL_5 == 1)\",\n \" #define FXAA_GATHER4_ALPHA 1\",\n \" #endif\",\n \" #ifdef GL_ARB_gpu_shader5\",\n \" #define FXAA_GATHER4_ALPHA 1\",\n \" #endif\",\n \" #ifdef GL_NV_gpu_shader5\",\n \" #define FXAA_GATHER4_ALPHA 1\",\n \" #endif\",\n \" #ifndef FXAA_GATHER4_ALPHA\",\n \" #define FXAA_GATHER4_ALPHA 0\",\n \" #endif\",\n \"#endif\",\n \"\",\n \"\",\n \"/*============================================================================\",\n \" FXAA QUALITY - TUNING KNOBS\",\n \"------------------------------------------------------------------------------\",\n \"NOTE the other tuning knobs are now in the shader function inputs!\",\n \"============================================================================*/\",\n \"#ifndef FXAA_QUALITY_PRESET\",\n \" //\",\n \" // Choose the quality preset.\",\n \" // This needs to be compiled into the shader as it effects code.\",\n \" // Best option to include multiple presets is to\",\n \" // in each shader define the preset, then include this file.\",\n \" //\",\n \" // OPTIONS\",\n \" // -----------------------------------------------------------------------\",\n \" // 10 to 15 - default medium dither (10=fastest, 15=highest quality)\",\n \" // 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)\",\n \" // 39 - no dither, very expensive\",\n \" //\",\n \" // NOTES\",\n \" // -----------------------------------------------------------------------\",\n \" // 12 = slightly faster then FXAA 3.9 and higher edge quality (default)\",\n \" // 13 = about same speed as FXAA 3.9 and better than 12\",\n \" // 23 = closest to FXAA 3.9 visually and performance wise\",\n \" // _ = the lowest digit is directly related to performance\",\n \" // _ = the highest digit is directly related to style\",\n \" //\",\n \" #define FXAA_QUALITY_PRESET 12\",\n \"#endif\",\n \"\",\n \"\",\n \"/*============================================================================\",\n \"\",\n \" FXAA QUALITY - PRESETS\",\n \"\",\n \"============================================================================*/\",\n \"\",\n \"/*============================================================================\",\n \" FXAA QUALITY - MEDIUM DITHER PRESETS\",\n \"============================================================================*/\",\n \"#if (FXAA_QUALITY_PRESET == 10)\",\n \" #define FXAA_QUALITY_PS 3\",\n \" #define FXAA_QUALITY_P0 1.5\",\n \" #define FXAA_QUALITY_P1 3.0\",\n \" #define FXAA_QUALITY_P2 12.0\",\n \"#endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \"#if (FXAA_QUALITY_PRESET == 11)\",\n \" #define FXAA_QUALITY_PS 4\",\n \" #define FXAA_QUALITY_P0 1.0\",\n \" #define FXAA_QUALITY_P1 1.5\",\n \" #define FXAA_QUALITY_P2 3.0\",\n \" #define FXAA_QUALITY_P3 12.0\",\n \"#endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \"#if (FXAA_QUALITY_PRESET == 12)\",\n \" #define FXAA_QUALITY_PS 5\",\n \" #define FXAA_QUALITY_P0 1.0\",\n \" #define FXAA_QUALITY_P1 1.5\",\n \" #define FXAA_QUALITY_P2 2.0\",\n \" #define FXAA_QUALITY_P3 4.0\",\n \" #define FXAA_QUALITY_P4 12.0\",\n \"#endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \"#if (FXAA_QUALITY_PRESET == 13)\",\n \" #define FXAA_QUALITY_PS 6\",\n \" #define FXAA_QUALITY_P0 1.0\",\n \" #define FXAA_QUALITY_P1 1.5\",\n \" #define FXAA_QUALITY_P2 2.0\",\n \" #define FXAA_QUALITY_P3 2.0\",\n \" #define FXAA_QUALITY_P4 4.0\",\n \" #define FXAA_QUALITY_P5 12.0\",\n \"#endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \"#if (FXAA_QUALITY_PRESET == 14)\",\n \" #define FXAA_QUALITY_PS 7\",\n \" #define FXAA_QUALITY_P0 1.0\",\n \" #define FXAA_QUALITY_P1 1.5\",\n \" #define FXAA_QUALITY_P2 2.0\",\n \" #define FXAA_QUALITY_P3 2.0\",\n \" #define FXAA_QUALITY_P4 2.0\",\n \" #define FXAA_QUALITY_P5 4.0\",\n \" #define FXAA_QUALITY_P6 12.0\",\n \"#endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \"#if (FXAA_QUALITY_PRESET == 15)\",\n \" #define FXAA_QUALITY_PS 8\",\n \" #define FXAA_QUALITY_P0 1.0\",\n \" #define FXAA_QUALITY_P1 1.5\",\n \" #define FXAA_QUALITY_P2 2.0\",\n \" #define FXAA_QUALITY_P3 2.0\",\n \" #define FXAA_QUALITY_P4 2.0\",\n \" #define FXAA_QUALITY_P5 2.0\",\n \" #define FXAA_QUALITY_P6 4.0\",\n \" #define FXAA_QUALITY_P7 12.0\",\n \"#endif\",\n \"\",\n \"/*============================================================================\",\n \" FXAA QUALITY - LOW DITHER PRESETS\",\n \"============================================================================*/\",\n \"#if (FXAA_QUALITY_PRESET == 20)\",\n \" #define FXAA_QUALITY_PS 3\",\n \" #define FXAA_QUALITY_P0 1.5\",\n \" #define FXAA_QUALITY_P1 2.0\",\n \" #define FXAA_QUALITY_P2 8.0\",\n \"#endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \"#if (FXAA_QUALITY_PRESET == 21)\",\n \" #define FXAA_QUALITY_PS 4\",\n \" #define FXAA_QUALITY_P0 1.0\",\n \" #define FXAA_QUALITY_P1 1.5\",\n \" #define FXAA_QUALITY_P2 2.0\",\n \" #define FXAA_QUALITY_P3 8.0\",\n \"#endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \"#if (FXAA_QUALITY_PRESET == 22)\",\n \" #define FXAA_QUALITY_PS 5\",\n \" #define FXAA_QUALITY_P0 1.0\",\n \" #define FXAA_QUALITY_P1 1.5\",\n \" #define FXAA_QUALITY_P2 2.0\",\n \" #define FXAA_QUALITY_P3 2.0\",\n \" #define FXAA_QUALITY_P4 8.0\",\n \"#endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \"#if (FXAA_QUALITY_PRESET == 23)\",\n \" #define FXAA_QUALITY_PS 6\",\n \" #define FXAA_QUALITY_P0 1.0\",\n \" #define FXAA_QUALITY_P1 1.5\",\n \" #define FXAA_QUALITY_P2 2.0\",\n \" #define FXAA_QUALITY_P3 2.0\",\n \" #define FXAA_QUALITY_P4 2.0\",\n \" #define FXAA_QUALITY_P5 8.0\",\n \"#endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \"#if (FXAA_QUALITY_PRESET == 24)\",\n \" #define FXAA_QUALITY_PS 7\",\n \" #define FXAA_QUALITY_P0 1.0\",\n \" #define FXAA_QUALITY_P1 1.5\",\n \" #define FXAA_QUALITY_P2 2.0\",\n \" #define FXAA_QUALITY_P3 2.0\",\n \" #define FXAA_QUALITY_P4 2.0\",\n \" #define FXAA_QUALITY_P5 3.0\",\n \" #define FXAA_QUALITY_P6 8.0\",\n \"#endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \"#if (FXAA_QUALITY_PRESET == 25)\",\n \" #define FXAA_QUALITY_PS 8\",\n \" #define FXAA_QUALITY_P0 1.0\",\n \" #define FXAA_QUALITY_P1 1.5\",\n \" #define FXAA_QUALITY_P2 2.0\",\n \" #define FXAA_QUALITY_P3 2.0\",\n \" #define FXAA_QUALITY_P4 2.0\",\n \" #define FXAA_QUALITY_P5 2.0\",\n \" #define FXAA_QUALITY_P6 4.0\",\n \" #define FXAA_QUALITY_P7 8.0\",\n \"#endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \"#if (FXAA_QUALITY_PRESET == 26)\",\n \" #define FXAA_QUALITY_PS 9\",\n \" #define FXAA_QUALITY_P0 1.0\",\n \" #define FXAA_QUALITY_P1 1.5\",\n \" #define FXAA_QUALITY_P2 2.0\",\n \" #define FXAA_QUALITY_P3 2.0\",\n \" #define FXAA_QUALITY_P4 2.0\",\n \" #define FXAA_QUALITY_P5 2.0\",\n \" #define FXAA_QUALITY_P6 2.0\",\n \" #define FXAA_QUALITY_P7 4.0\",\n \" #define FXAA_QUALITY_P8 8.0\",\n \"#endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \"#if (FXAA_QUALITY_PRESET == 27)\",\n \" #define FXAA_QUALITY_PS 10\",\n \" #define FXAA_QUALITY_P0 1.0\",\n \" #define FXAA_QUALITY_P1 1.5\",\n \" #define FXAA_QUALITY_P2 2.0\",\n \" #define FXAA_QUALITY_P3 2.0\",\n \" #define FXAA_QUALITY_P4 2.0\",\n \" #define FXAA_QUALITY_P5 2.0\",\n \" #define FXAA_QUALITY_P6 2.0\",\n \" #define FXAA_QUALITY_P7 2.0\",\n \" #define FXAA_QUALITY_P8 4.0\",\n \" #define FXAA_QUALITY_P9 8.0\",\n \"#endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \"#if (FXAA_QUALITY_PRESET == 28)\",\n \" #define FXAA_QUALITY_PS 11\",\n \" #define FXAA_QUALITY_P0 1.0\",\n \" #define FXAA_QUALITY_P1 1.5\",\n \" #define FXAA_QUALITY_P2 2.0\",\n \" #define FXAA_QUALITY_P3 2.0\",\n \" #define FXAA_QUALITY_P4 2.0\",\n \" #define FXAA_QUALITY_P5 2.0\",\n \" #define FXAA_QUALITY_P6 2.0\",\n \" #define FXAA_QUALITY_P7 2.0\",\n \" #define FXAA_QUALITY_P8 2.0\",\n \" #define FXAA_QUALITY_P9 4.0\",\n \" #define FXAA_QUALITY_P10 8.0\",\n \"#endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \"#if (FXAA_QUALITY_PRESET == 29)\",\n \" #define FXAA_QUALITY_PS 12\",\n \" #define FXAA_QUALITY_P0 1.0\",\n \" #define FXAA_QUALITY_P1 1.5\",\n \" #define FXAA_QUALITY_P2 2.0\",\n \" #define FXAA_QUALITY_P3 2.0\",\n \" #define FXAA_QUALITY_P4 2.0\",\n \" #define FXAA_QUALITY_P5 2.0\",\n \" #define FXAA_QUALITY_P6 2.0\",\n \" #define FXAA_QUALITY_P7 2.0\",\n \" #define FXAA_QUALITY_P8 2.0\",\n \" #define FXAA_QUALITY_P9 2.0\",\n \" #define FXAA_QUALITY_P10 4.0\",\n \" #define FXAA_QUALITY_P11 8.0\",\n \"#endif\",\n \"\",\n \"/*============================================================================\",\n \" FXAA QUALITY - EXTREME QUALITY\",\n \"============================================================================*/\",\n \"#if (FXAA_QUALITY_PRESET == 39)\",\n \" #define FXAA_QUALITY_PS 12\",\n \" #define FXAA_QUALITY_P0 1.0\",\n \" #define FXAA_QUALITY_P1 1.0\",\n \" #define FXAA_QUALITY_P2 1.0\",\n \" #define FXAA_QUALITY_P3 1.0\",\n \" #define FXAA_QUALITY_P4 1.0\",\n \" #define FXAA_QUALITY_P5 1.5\",\n \" #define FXAA_QUALITY_P6 2.0\",\n \" #define FXAA_QUALITY_P7 2.0\",\n \" #define FXAA_QUALITY_P8 2.0\",\n \" #define FXAA_QUALITY_P9 2.0\",\n \" #define FXAA_QUALITY_P10 4.0\",\n \" #define FXAA_QUALITY_P11 8.0\",\n \"#endif\",\n \"\",\n \"\",\n \"\",\n \"/*============================================================================\",\n \"\",\n \" API PORTING\",\n \"\",\n \"============================================================================*/\",\n \"#if (FXAA_GLSL_100 == 1) || (FXAA_GLSL_120 == 1) || (FXAA_GLSL_130 == 1)\",\n \" #define FxaaBool bool\",\n \" #define FxaaDiscard discard\",\n \" #define FxaaFloat float\",\n \" #define FxaaFloat2 vec2\",\n \" #define FxaaFloat3 vec3\",\n \" #define FxaaFloat4 vec4\",\n \" #define FxaaHalf float\",\n \" #define FxaaHalf2 vec2\",\n \" #define FxaaHalf3 vec3\",\n \" #define FxaaHalf4 vec4\",\n \" #define FxaaInt2 ivec2\",\n \" #define FxaaSat(x) clamp(x, 0.0, 1.0)\",\n \" #define FxaaTex sampler2D\",\n \"#else\",\n \" #define FxaaBool bool\",\n \" #define FxaaDiscard clip(-1)\",\n \" #define FxaaFloat float\",\n \" #define FxaaFloat2 float2\",\n \" #define FxaaFloat3 float3\",\n \" #define FxaaFloat4 float4\",\n \" #define FxaaHalf half\",\n \" #define FxaaHalf2 half2\",\n \" #define FxaaHalf3 half3\",\n \" #define FxaaHalf4 half4\",\n \" #define FxaaSat(x) saturate(x)\",\n \"#endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \"#if (FXAA_GLSL_100 == 1)\",\n \" #define FxaaTexTop(t, p) texture2D(t, p, 0.0)\",\n \" #define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), 0.0)\",\n \"#endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \"#if (FXAA_GLSL_120 == 1)\",\n \" // Requires,\",\n \" // #version 120\",\n \" // And at least,\",\n \" // #extension GL_EXT_gpu_shader4 : enable\",\n \" // (or set FXAA_FAST_PIXEL_OFFSET 1 to work like DX9)\",\n \" #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)\",\n \" #if (FXAA_FAST_PIXEL_OFFSET == 1)\",\n \" #define FxaaTexOff(t, p, o, r) texture2DLodOffset(t, p, 0.0, o)\",\n \" #else\",\n \" #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)\",\n \" #endif\",\n \" #if (FXAA_GATHER4_ALPHA == 1)\",\n \" // use #extension GL_ARB_gpu_shader5 : enable\",\n \" #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)\",\n \" #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)\",\n \" #define FxaaTexGreen4(t, p) textureGather(t, p, 1)\",\n \" #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)\",\n \" #endif\",\n \"#endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \"#if (FXAA_GLSL_130 == 1)\",\n ' // Requires \"#version 130\" or better',\n \" #define FxaaTexTop(t, p) textureLod(t, p, 0.0)\",\n \" #define FxaaTexOff(t, p, o, r) textureLodOffset(t, p, 0.0, o)\",\n \" #if (FXAA_GATHER4_ALPHA == 1)\",\n \" // use #extension GL_ARB_gpu_shader5 : enable\",\n \" #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)\",\n \" #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)\",\n \" #define FxaaTexGreen4(t, p) textureGather(t, p, 1)\",\n \" #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)\",\n \" #endif\",\n \"#endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \"#if (FXAA_HLSL_3 == 1)\",\n \" #define FxaaInt2 float2\",\n \" #define FxaaTex sampler2D\",\n \" #define FxaaTexTop(t, p) tex2Dlod(t, float4(p, 0.0, 0.0))\",\n \" #define FxaaTexOff(t, p, o, r) tex2Dlod(t, float4(p + (o * r), 0, 0))\",\n \"#endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \"#if (FXAA_HLSL_4 == 1)\",\n \" #define FxaaInt2 int2\",\n \" struct FxaaTex { SamplerState smpl; Texture2D tex; };\",\n \" #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)\",\n \" #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)\",\n \"#endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \"#if (FXAA_HLSL_5 == 1)\",\n \" #define FxaaInt2 int2\",\n \" struct FxaaTex { SamplerState smpl; Texture2D tex; };\",\n \" #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)\",\n \" #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)\",\n \" #define FxaaTexAlpha4(t, p) t.tex.GatherAlpha(t.smpl, p)\",\n \" #define FxaaTexOffAlpha4(t, p, o) t.tex.GatherAlpha(t.smpl, p, o)\",\n \" #define FxaaTexGreen4(t, p) t.tex.GatherGreen(t.smpl, p)\",\n \" #define FxaaTexOffGreen4(t, p, o) t.tex.GatherGreen(t.smpl, p, o)\",\n \"#endif\",\n \"\",\n \"\",\n \"/*============================================================================\",\n \" GREEN AS LUMA OPTION SUPPORT FUNCTION\",\n \"============================================================================*/\",\n \"#if (FXAA_GREEN_AS_LUMA == 0)\",\n \" FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.w; }\",\n \"#else\",\n \" FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }\",\n \"#endif\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"/*============================================================================\",\n \"\",\n \" FXAA3 QUALITY - PC\",\n \"\",\n \"============================================================================*/\",\n \"#if (FXAA_PC == 1)\",\n \"/*--------------------------------------------------------------------------*/\",\n \"FxaaFloat4 FxaaPixelShader(\",\n \" //\",\n \" // Use noperspective interpolation here (turn off perspective interpolation).\",\n \" // {xy} = center of pixel\",\n \" FxaaFloat2 pos,\",\n \" //\",\n \" // Used only for FXAA Console, and not used on the 360 version.\",\n \" // Use noperspective interpolation here (turn off perspective interpolation).\",\n \" // {xy_} = upper left of pixel\",\n \" // {_zw} = lower right of pixel\",\n \" FxaaFloat4 fxaaConsolePosPos,\",\n \" //\",\n \" // Input color texture.\",\n \" // {rgb_} = color in linear or perceptual color space\",\n \" // if (FXAA_GREEN_AS_LUMA == 0)\",\n \" // {__a} = luma in perceptual color space (not linear)\",\n \" FxaaTex tex,\",\n \" //\",\n \" // Only used on the optimized 360 version of FXAA Console.\",\n ' // For everything but 360, just use the same input here as for \"tex\".',\n \" // For 360, same texture, just alias with a 2nd sampler.\",\n \" // This sampler needs to have an exponent bias of -1.\",\n \" FxaaTex fxaaConsole360TexExpBiasNegOne,\",\n \" //\",\n \" // Only used on the optimized 360 version of FXAA Console.\",\n ' // For everything but 360, just use the same input here as for \"tex\".',\n \" // For 360, same texture, just alias with a 3nd sampler.\",\n \" // This sampler needs to have an exponent bias of -2.\",\n \" FxaaTex fxaaConsole360TexExpBiasNegTwo,\",\n \" //\",\n \" // Only used on FXAA Quality.\",\n \" // This must be from a constant/uniform.\",\n \" // {x_} = 1.0/screenWidthInPixels\",\n \" // {_y} = 1.0/screenHeightInPixels\",\n \" FxaaFloat2 fxaaQualityRcpFrame,\",\n \" //\",\n \" // Only used on FXAA Console.\",\n \" // This must be from a constant/uniform.\",\n \" // This effects sub-pixel AA quality and inversely sharpness.\",\n \" // Where N ranges between,\",\n \" // N = 0.50 (default)\",\n \" // N = 0.33 (sharper)\",\n \" // {x__} = -N/screenWidthInPixels\",\n \" // {_y_} = -N/screenHeightInPixels\",\n \" // {_z_} = N/screenWidthInPixels\",\n \" // {__w} = N/screenHeightInPixels\",\n \" FxaaFloat4 fxaaConsoleRcpFrameOpt,\",\n \" //\",\n \" // Only used on FXAA Console.\",\n \" // Not used on 360, but used on PS3 and PC.\",\n \" // This must be from a constant/uniform.\",\n \" // {x__} = -2.0/screenWidthInPixels\",\n \" // {_y_} = -2.0/screenHeightInPixels\",\n \" // {_z_} = 2.0/screenWidthInPixels\",\n \" // {__w} = 2.0/screenHeightInPixels\",\n \" FxaaFloat4 fxaaConsoleRcpFrameOpt2,\",\n \" //\",\n \" // Only used on FXAA Console.\",\n \" // Only used on 360 in place of fxaaConsoleRcpFrameOpt2.\",\n \" // This must be from a constant/uniform.\",\n \" // {x__} = 8.0/screenWidthInPixels\",\n \" // {_y_} = 8.0/screenHeightInPixels\",\n \" // {_z_} = -4.0/screenWidthInPixels\",\n \" // {__w} = -4.0/screenHeightInPixels\",\n \" FxaaFloat4 fxaaConsole360RcpFrameOpt2,\",\n \" //\",\n \" // Only used on FXAA Quality.\",\n \" // This used to be the FXAA_QUALITY_SUBPIX define.\",\n \" // It is here now to allow easier tuning.\",\n \" // Choose the amount of sub-pixel aliasing removal.\",\n \" // This can effect sharpness.\",\n \" // 1.00 - upper limit (softer)\",\n \" // 0.75 - default amount of filtering\",\n \" // 0.50 - lower limit (sharper, less sub-pixel aliasing removal)\",\n \" // 0.25 - almost off\",\n \" // 0.00 - completely off\",\n \" FxaaFloat fxaaQualitySubpix,\",\n \" //\",\n \" // Only used on FXAA Quality.\",\n \" // This used to be the FXAA_QUALITY_EDGE_THRESHOLD define.\",\n \" // It is here now to allow easier tuning.\",\n \" // The minimum amount of local contrast required to apply algorithm.\",\n \" // 0.333 - too little (faster)\",\n \" // 0.250 - low quality\",\n \" // 0.166 - default\",\n \" // 0.125 - high quality\",\n \" // 0.063 - overkill (slower)\",\n \" FxaaFloat fxaaQualityEdgeThreshold,\",\n \" //\",\n \" // Only used on FXAA Quality.\",\n \" // This used to be the FXAA_QUALITY_EDGE_THRESHOLD_MIN define.\",\n \" // It is here now to allow easier tuning.\",\n \" // Trims the algorithm from processing darks.\",\n \" // 0.0833 - upper limit (default, the start of visible unfiltered edges)\",\n \" // 0.0625 - high quality (faster)\",\n \" // 0.0312 - visible limit (slower)\",\n \" // Special notes when using FXAA_GREEN_AS_LUMA,\",\n \" // Likely want to set this to zero.\",\n \" // As colors that are mostly not-green\",\n \" // will appear very dark in the green channel!\",\n \" // Tune by looking at mostly non-green content,\",\n \" // then start at zero and increase until aliasing is a problem.\",\n \" FxaaFloat fxaaQualityEdgeThresholdMin,\",\n \" //\",\n \" // Only used on FXAA Console.\",\n \" // This used to be the FXAA_CONSOLE_EDGE_SHARPNESS define.\",\n \" // It is here now to allow easier tuning.\",\n \" // This does not effect PS3, as this needs to be compiled in.\",\n \" // Use FXAA_CONSOLE_PS3_EDGE_SHARPNESS for PS3.\",\n \" // Due to the PS3 being ALU bound,\",\n \" // there are only three safe values here: 2 and 4 and 8.\",\n \" // These options use the shaders ability to a free *|/ by 2|4|8.\",\n \" // For all other platforms can be a non-power of two.\",\n \" // 8.0 is sharper (default!!!)\",\n \" // 4.0 is softer\",\n \" // 2.0 is really soft (good only for vector graphics inputs)\",\n \" FxaaFloat fxaaConsoleEdgeSharpness,\",\n \" //\",\n \" // Only used on FXAA Console.\",\n \" // This used to be the FXAA_CONSOLE_EDGE_THRESHOLD define.\",\n \" // It is here now to allow easier tuning.\",\n \" // This does not effect PS3, as this needs to be compiled in.\",\n \" // Use FXAA_CONSOLE_PS3_EDGE_THRESHOLD for PS3.\",\n \" // Due to the PS3 being ALU bound,\",\n \" // there are only two safe values here: 1/4 and 1/8.\",\n \" // These options use the shaders ability to a free *|/ by 2|4|8.\",\n \" // The console setting has a different mapping than the quality setting.\",\n \" // Other platforms can use other values.\",\n \" // 0.125 leaves less aliasing, but is softer (default!!!)\",\n \" // 0.25 leaves more aliasing, and is sharper\",\n \" FxaaFloat fxaaConsoleEdgeThreshold,\",\n \" //\",\n \" // Only used on FXAA Console.\",\n \" // This used to be the FXAA_CONSOLE_EDGE_THRESHOLD_MIN define.\",\n \" // It is here now to allow easier tuning.\",\n \" // Trims the algorithm from processing darks.\",\n \" // The console setting has a different mapping than the quality setting.\",\n \" // This only applies when FXAA_EARLY_EXIT is 1.\",\n \" // This does not apply to PS3,\",\n \" // PS3 was simplified to avoid more shader instructions.\",\n \" // 0.06 - faster but more aliasing in darks\",\n \" // 0.05 - default\",\n \" // 0.04 - slower and less aliasing in darks\",\n \" // Special notes when using FXAA_GREEN_AS_LUMA,\",\n \" // Likely want to set this to zero.\",\n \" // As colors that are mostly not-green\",\n \" // will appear very dark in the green channel!\",\n \" // Tune by looking at mostly non-green content,\",\n \" // then start at zero and increase until aliasing is a problem.\",\n \" FxaaFloat fxaaConsoleEdgeThresholdMin,\",\n \" //\",\n \" // Extra constants for 360 FXAA Console only.\",\n \" // Use zeros or anything else for other platforms.\",\n \" // These must be in physical constant registers and NOT immediates.\",\n \" // Immediates will result in compiler un-optimizing.\",\n \" // {xyzw} = float4(1.0, -1.0, 0.25, -0.25)\",\n \" FxaaFloat4 fxaaConsole360ConstDir\",\n \") {\",\n \"/*--------------------------------------------------------------------------*/\",\n \" FxaaFloat2 posM;\",\n \" posM.x = pos.x;\",\n \" posM.y = pos.y;\",\n \" #if (FXAA_GATHER4_ALPHA == 1)\",\n \" #if (FXAA_DISCARD == 0)\",\n \" FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);\",\n \" #if (FXAA_GREEN_AS_LUMA == 0)\",\n \" #define lumaM rgbyM.w\",\n \" #else\",\n \" #define lumaM rgbyM.y\",\n \" #endif\",\n \" #endif\",\n \" #if (FXAA_GREEN_AS_LUMA == 0)\",\n \" FxaaFloat4 luma4A = FxaaTexAlpha4(tex, posM);\",\n \" FxaaFloat4 luma4B = FxaaTexOffAlpha4(tex, posM, FxaaInt2(-1, -1));\",\n \" #else\",\n \" FxaaFloat4 luma4A = FxaaTexGreen4(tex, posM);\",\n \" FxaaFloat4 luma4B = FxaaTexOffGreen4(tex, posM, FxaaInt2(-1, -1));\",\n \" #endif\",\n \" #if (FXAA_DISCARD == 1)\",\n \" #define lumaM luma4A.w\",\n \" #endif\",\n \" #define lumaE luma4A.z\",\n \" #define lumaS luma4A.x\",\n \" #define lumaSE luma4A.y\",\n \" #define lumaNW luma4B.w\",\n \" #define lumaN luma4B.z\",\n \" #define lumaW luma4B.x\",\n \" #else\",\n \" FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);\",\n \" #if (FXAA_GREEN_AS_LUMA == 0)\",\n \" #define lumaM rgbyM.w\",\n \" #else\",\n \" #define lumaM rgbyM.y\",\n \" #endif\",\n \" #if (FXAA_GLSL_100 == 1)\",\n \" FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 0.0, 1.0), fxaaQualityRcpFrame.xy));\",\n \" FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0, 0.0), fxaaQualityRcpFrame.xy));\",\n \" FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 0.0,-1.0), fxaaQualityRcpFrame.xy));\",\n \" FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 0.0), fxaaQualityRcpFrame.xy));\",\n \" #else\",\n \" FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));\",\n \" FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));\",\n \" FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));\",\n \" FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));\",\n \" #endif\",\n \" #endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \" FxaaFloat maxSM = max(lumaS, lumaM);\",\n \" FxaaFloat minSM = min(lumaS, lumaM);\",\n \" FxaaFloat maxESM = max(lumaE, maxSM);\",\n \" FxaaFloat minESM = min(lumaE, minSM);\",\n \" FxaaFloat maxWN = max(lumaN, lumaW);\",\n \" FxaaFloat minWN = min(lumaN, lumaW);\",\n \" FxaaFloat rangeMax = max(maxWN, maxESM);\",\n \" FxaaFloat rangeMin = min(minWN, minESM);\",\n \" FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;\",\n \" FxaaFloat range = rangeMax - rangeMin;\",\n \" FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);\",\n \" FxaaBool earlyExit = range < rangeMaxClamped;\",\n \"/*--------------------------------------------------------------------------*/\",\n \" if(earlyExit)\",\n \" #if (FXAA_DISCARD == 1)\",\n \" FxaaDiscard;\",\n \" #else\",\n \" return rgbyM;\",\n \" #endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \" #if (FXAA_GATHER4_ALPHA == 0)\",\n \" #if (FXAA_GLSL_100 == 1)\",\n \" FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0,-1.0), fxaaQualityRcpFrame.xy));\",\n \" FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0, 1.0), fxaaQualityRcpFrame.xy));\",\n \" FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0,-1.0), fxaaQualityRcpFrame.xy));\",\n \" FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 1.0), fxaaQualityRcpFrame.xy));\",\n \" #else\",\n \" FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));\",\n \" FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));\",\n \" FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));\",\n \" FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));\",\n \" #endif\",\n \" #else\",\n \" FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, -1), fxaaQualityRcpFrame.xy));\",\n \" FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));\",\n \" #endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \" FxaaFloat lumaNS = lumaN + lumaS;\",\n \" FxaaFloat lumaWE = lumaW + lumaE;\",\n \" FxaaFloat subpixRcpRange = 1.0/range;\",\n \" FxaaFloat subpixNSWE = lumaNS + lumaWE;\",\n \" FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;\",\n \" FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;\",\n \"/*--------------------------------------------------------------------------*/\",\n \" FxaaFloat lumaNESE = lumaNE + lumaSE;\",\n \" FxaaFloat lumaNWNE = lumaNW + lumaNE;\",\n \" FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;\",\n \" FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;\",\n \"/*--------------------------------------------------------------------------*/\",\n \" FxaaFloat lumaNWSW = lumaNW + lumaSW;\",\n \" FxaaFloat lumaSWSE = lumaSW + lumaSE;\",\n \" FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);\",\n \" FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);\",\n \" FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;\",\n \" FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;\",\n \" FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;\",\n \" FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;\",\n \"/*--------------------------------------------------------------------------*/\",\n \" FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;\",\n \" FxaaFloat lengthSign = fxaaQualityRcpFrame.x;\",\n \" FxaaBool horzSpan = edgeHorz >= edgeVert;\",\n \" FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;\",\n \"/*--------------------------------------------------------------------------*/\",\n \" if(!horzSpan) lumaN = lumaW;\",\n \" if(!horzSpan) lumaS = lumaE;\",\n \" if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;\",\n \" FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;\",\n \"/*--------------------------------------------------------------------------*/\",\n \" FxaaFloat gradientN = lumaN - lumaM;\",\n \" FxaaFloat gradientS = lumaS - lumaM;\",\n \" FxaaFloat lumaNN = lumaN + lumaM;\",\n \" FxaaFloat lumaSS = lumaS + lumaM;\",\n \" FxaaBool pairN = abs(gradientN) >= abs(gradientS);\",\n \" FxaaFloat gradient = max(abs(gradientN), abs(gradientS));\",\n \" if(pairN) lengthSign = -lengthSign;\",\n \" FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);\",\n \"/*--------------------------------------------------------------------------*/\",\n \" FxaaFloat2 posB;\",\n \" posB.x = posM.x;\",\n \" posB.y = posM.y;\",\n \" FxaaFloat2 offNP;\",\n \" offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;\",\n \" offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;\",\n \" if(!horzSpan) posB.x += lengthSign * 0.5;\",\n \" if( horzSpan) posB.y += lengthSign * 0.5;\",\n \"/*--------------------------------------------------------------------------*/\",\n \" FxaaFloat2 posN;\",\n \" posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;\",\n \" posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;\",\n \" FxaaFloat2 posP;\",\n \" posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;\",\n \" posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;\",\n \" FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;\",\n \" FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));\",\n \" FxaaFloat subpixE = subpixC * subpixC;\",\n \" FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));\",\n \"/*--------------------------------------------------------------------------*/\",\n \" if(!pairN) lumaNN = lumaSS;\",\n \" FxaaFloat gradientScaled = gradient * 1.0/4.0;\",\n \" FxaaFloat lumaMM = lumaM - lumaNN * 0.5;\",\n \" FxaaFloat subpixF = subpixD * subpixE;\",\n \" FxaaBool lumaMLTZero = lumaMM < 0.0;\",\n \"/*--------------------------------------------------------------------------*/\",\n \" lumaEndN -= lumaNN * 0.5;\",\n \" lumaEndP -= lumaNN * 0.5;\",\n \" FxaaBool doneN = abs(lumaEndN) >= gradientScaled;\",\n \" FxaaBool doneP = abs(lumaEndP) >= gradientScaled;\",\n \" if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;\",\n \" if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;\",\n \" FxaaBool doneNP = (!doneN) || (!doneP);\",\n \" if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;\",\n \" if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;\",\n \"/*--------------------------------------------------------------------------*/\",\n \" if(doneNP) {\",\n \" if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\",\n \" if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\",\n \" if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\",\n \" if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\",\n \" doneN = abs(lumaEndN) >= gradientScaled;\",\n \" doneP = abs(lumaEndP) >= gradientScaled;\",\n \" if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;\",\n \" if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;\",\n \" doneNP = (!doneN) || (!doneP);\",\n \" if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;\",\n \" if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;\",\n \"/*--------------------------------------------------------------------------*/\",\n \" #if (FXAA_QUALITY_PS > 3)\",\n \" if(doneNP) {\",\n \" if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\",\n \" if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\",\n \" if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\",\n \" if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\",\n \" doneN = abs(lumaEndN) >= gradientScaled;\",\n \" doneP = abs(lumaEndP) >= gradientScaled;\",\n \" if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;\",\n \" if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;\",\n \" doneNP = (!doneN) || (!doneP);\",\n \" if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;\",\n \" if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;\",\n \"/*--------------------------------------------------------------------------*/\",\n \" #if (FXAA_QUALITY_PS > 4)\",\n \" if(doneNP) {\",\n \" if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\",\n \" if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\",\n \" if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\",\n \" if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\",\n \" doneN = abs(lumaEndN) >= gradientScaled;\",\n \" doneP = abs(lumaEndP) >= gradientScaled;\",\n \" if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;\",\n \" if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;\",\n \" doneNP = (!doneN) || (!doneP);\",\n \" if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;\",\n \" if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;\",\n \"/*--------------------------------------------------------------------------*/\",\n \" #if (FXAA_QUALITY_PS > 5)\",\n \" if(doneNP) {\",\n \" if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\",\n \" if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\",\n \" if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\",\n \" if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\",\n \" doneN = abs(lumaEndN) >= gradientScaled;\",\n \" doneP = abs(lumaEndP) >= gradientScaled;\",\n \" if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;\",\n \" if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;\",\n \" doneNP = (!doneN) || (!doneP);\",\n \" if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;\",\n \" if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;\",\n \"/*--------------------------------------------------------------------------*/\",\n \" #if (FXAA_QUALITY_PS > 6)\",\n \" if(doneNP) {\",\n \" if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\",\n \" if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\",\n \" if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\",\n \" if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\",\n \" doneN = abs(lumaEndN) >= gradientScaled;\",\n \" doneP = abs(lumaEndP) >= gradientScaled;\",\n \" if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;\",\n \" if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;\",\n \" doneNP = (!doneN) || (!doneP);\",\n \" if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;\",\n \" if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;\",\n \"/*--------------------------------------------------------------------------*/\",\n \" #if (FXAA_QUALITY_PS > 7)\",\n \" if(doneNP) {\",\n \" if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\",\n \" if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\",\n \" if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\",\n \" if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\",\n \" doneN = abs(lumaEndN) >= gradientScaled;\",\n \" doneP = abs(lumaEndP) >= gradientScaled;\",\n \" if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;\",\n \" if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;\",\n \" doneNP = (!doneN) || (!doneP);\",\n \" if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;\",\n \" if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;\",\n \"/*--------------------------------------------------------------------------*/\",\n \" #if (FXAA_QUALITY_PS > 8)\",\n \" if(doneNP) {\",\n \" if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\",\n \" if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\",\n \" if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\",\n \" if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\",\n \" doneN = abs(lumaEndN) >= gradientScaled;\",\n \" doneP = abs(lumaEndP) >= gradientScaled;\",\n \" if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;\",\n \" if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;\",\n \" doneNP = (!doneN) || (!doneP);\",\n \" if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;\",\n \" if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;\",\n \"/*--------------------------------------------------------------------------*/\",\n \" #if (FXAA_QUALITY_PS > 9)\",\n \" if(doneNP) {\",\n \" if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\",\n \" if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\",\n \" if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\",\n \" if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\",\n \" doneN = abs(lumaEndN) >= gradientScaled;\",\n \" doneP = abs(lumaEndP) >= gradientScaled;\",\n \" if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;\",\n \" if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;\",\n \" doneNP = (!doneN) || (!doneP);\",\n \" if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;\",\n \" if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;\",\n \"/*--------------------------------------------------------------------------*/\",\n \" #if (FXAA_QUALITY_PS > 10)\",\n \" if(doneNP) {\",\n \" if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\",\n \" if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\",\n \" if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\",\n \" if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\",\n \" doneN = abs(lumaEndN) >= gradientScaled;\",\n \" doneP = abs(lumaEndP) >= gradientScaled;\",\n \" if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;\",\n \" if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;\",\n \" doneNP = (!doneN) || (!doneP);\",\n \" if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;\",\n \" if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;\",\n \"/*--------------------------------------------------------------------------*/\",\n \" #if (FXAA_QUALITY_PS > 11)\",\n \" if(doneNP) {\",\n \" if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\",\n \" if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\",\n \" if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\",\n \" if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\",\n \" doneN = abs(lumaEndN) >= gradientScaled;\",\n \" doneP = abs(lumaEndP) >= gradientScaled;\",\n \" if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;\",\n \" if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;\",\n \" doneNP = (!doneN) || (!doneP);\",\n \" if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;\",\n \" if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;\",\n \"/*--------------------------------------------------------------------------*/\",\n \" #if (FXAA_QUALITY_PS > 12)\",\n \" if(doneNP) {\",\n \" if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\",\n \" if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\",\n \" if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\",\n \" if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\",\n \" doneN = abs(lumaEndN) >= gradientScaled;\",\n \" doneP = abs(lumaEndP) >= gradientScaled;\",\n \" if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;\",\n \" if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;\",\n \" doneNP = (!doneN) || (!doneP);\",\n \" if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;\",\n \" if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;\",\n \"/*--------------------------------------------------------------------------*/\",\n \" }\",\n \" #endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \" }\",\n \" #endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \" }\",\n \" #endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \" }\",\n \" #endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \" }\",\n \" #endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \" }\",\n \" #endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \" }\",\n \" #endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \" }\",\n \" #endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \" }\",\n \" #endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \" }\",\n \" #endif\",\n \"/*--------------------------------------------------------------------------*/\",\n \" }\",\n \"/*--------------------------------------------------------------------------*/\",\n \" FxaaFloat dstN = posM.x - posN.x;\",\n \" FxaaFloat dstP = posP.x - posM.x;\",\n \" if(!horzSpan) dstN = posM.y - posN.y;\",\n \" if(!horzSpan) dstP = posP.y - posM.y;\",\n \"/*--------------------------------------------------------------------------*/\",\n \" FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;\",\n \" FxaaFloat spanLength = (dstP + dstN);\",\n \" FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;\",\n \" FxaaFloat spanLengthRcp = 1.0/spanLength;\",\n \"/*--------------------------------------------------------------------------*/\",\n \" FxaaBool directionN = dstN < dstP;\",\n \" FxaaFloat dst = min(dstN, dstP);\",\n \" FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;\",\n \" FxaaFloat subpixG = subpixF * subpixF;\",\n \" FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;\",\n \" FxaaFloat subpixH = subpixG * fxaaQualitySubpix;\",\n \"/*--------------------------------------------------------------------------*/\",\n \" FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;\",\n \" FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);\",\n \" if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;\",\n \" if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;\",\n \" #if (FXAA_DISCARD == 1)\",\n \" return FxaaTexTop(tex, posM);\",\n \" #else\",\n \" return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);\",\n \" #endif\",\n \"}\",\n \"/*==========================================================================*/\",\n \"#endif\",\n \"\",\n \"void main() {\",\n \" gl_FragColor = FxaaPixelShader(\",\n \" vUv,\",\n \" vec4(0.0),\",\n \" tDiffuse,\",\n \" tDiffuse,\",\n \" tDiffuse,\",\n \" resolution,\",\n \" vec4(0.0),\",\n \" vec4(0.0),\",\n \" vec4(0.0),\",\n \" 0.75,\",\n \" 0.166,\",\n \" 0.0833,\",\n \" 0.0,\",\n \" 0.0,\",\n \" 0.0,\",\n \" vec4(0.0)\",\n \" );\",\n \"\",\n \" // TODO avoid querying texture twice for same texel\",\n \" gl_FragColor.a = texture2D(tDiffuse, vUv).a;\",\n \"}\"\n ].join(\"\\n\")\n};\nconst FocusShader = {\n uniforms: {\n tDiffuse: { value: null },\n screenWidth: { value: 1024 },\n screenHeight: { value: 1024 },\n sampleDistance: { value: 0.94 },\n waveFactor: { value: 125e-5 }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform float screenWidth;\",\n \"uniform float screenHeight;\",\n \"uniform float sampleDistance;\",\n \"uniform float waveFactor;\",\n \"uniform sampler2D tDiffuse;\",\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvec4 color, org, tmp, add;\",\n \"\tfloat sample_dist, f;\",\n \"\tvec2 vin;\",\n \"\tvec2 uv = vUv;\",\n \"\tadd = color = org = texture2D( tDiffuse, uv );\",\n \"\tvin = ( uv - vec2( 0.5 ) ) * vec2( 1.4 );\",\n \"\tsample_dist = dot( vin, vin ) * 2.0;\",\n \"\tf = ( waveFactor * 100.0 + sample_dist ) * sampleDistance * 4.0;\",\n \"\tvec2 sampleSize = vec2( 1.0 / screenWidth, 1.0 / screenHeight ) * vec2( f );\",\n \"\tadd += tmp = texture2D( tDiffuse, uv + vec2( 0.111964, 0.993712 ) * sampleSize );\",\n \"\tif( tmp.b < color.b ) color = tmp;\",\n \"\tadd += tmp = texture2D( tDiffuse, uv + vec2( 0.846724, 0.532032 ) * sampleSize );\",\n \"\tif( tmp.b < color.b ) color = tmp;\",\n \"\tadd += tmp = texture2D( tDiffuse, uv + vec2( 0.943883, -0.330279 ) * sampleSize );\",\n \"\tif( tmp.b < color.b ) color = tmp;\",\n \"\tadd += tmp = texture2D( tDiffuse, uv + vec2( 0.330279, -0.943883 ) * sampleSize );\",\n \"\tif( tmp.b < color.b ) color = tmp;\",\n \"\tadd += tmp = texture2D( tDiffuse, uv + vec2( -0.532032, -0.846724 ) * sampleSize );\",\n \"\tif( tmp.b < color.b ) color = tmp;\",\n \"\tadd += tmp = texture2D( tDiffuse, uv + vec2( -0.993712, -0.111964 ) * sampleSize );\",\n \"\tif( tmp.b < color.b ) color = tmp;\",\n \"\tadd += tmp = texture2D( tDiffuse, uv + vec2( -0.707107, 0.707107 ) * sampleSize );\",\n \"\tif( tmp.b < color.b ) color = tmp;\",\n \"\tcolor = color * vec4( 2.0 ) - ( add / vec4( 8.0 ) );\",\n \"\tcolor = color + ( add / vec4( 8.0 ) - color ) * ( vec4( 1.0 ) - vec4( sample_dist * 0.5 ) );\",\n \"\tgl_FragColor = vec4( color.rgb * color.rgb * vec3( 0.95 ) + color.rgb, 1.0 );\",\n \"}\"\n ].join(\"\\n\")\n};\nconst FreiChenShader = {\n uniforms: {\n tDiffuse: { value: null },\n aspect: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(512, 512) }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform sampler2D tDiffuse;\",\n \"varying vec2 vUv;\",\n \"uniform vec2 aspect;\",\n \"vec2 texel = vec2(1.0 / aspect.x, 1.0 / aspect.y);\",\n \"mat3 G[9];\",\n // hard coded matrix values!!!! as suggested in https://github.com/neilmendoza/ofxPostProcessing/blob/master/src/EdgePass.cpp#L45\n \"const mat3 g0 = mat3( 0.3535533845424652, 0, -0.3535533845424652, 0.5, 0, -0.5, 0.3535533845424652, 0, -0.3535533845424652 );\",\n \"const mat3 g1 = mat3( 0.3535533845424652, 0.5, 0.3535533845424652, 0, 0, 0, -0.3535533845424652, -0.5, -0.3535533845424652 );\",\n \"const mat3 g2 = mat3( 0, 0.3535533845424652, -0.5, -0.3535533845424652, 0, 0.3535533845424652, 0.5, -0.3535533845424652, 0 );\",\n \"const mat3 g3 = mat3( 0.5, -0.3535533845424652, 0, -0.3535533845424652, 0, 0.3535533845424652, 0, 0.3535533845424652, -0.5 );\",\n \"const mat3 g4 = mat3( 0, -0.5, 0, 0.5, 0, 0.5, 0, -0.5, 0 );\",\n \"const mat3 g5 = mat3( -0.5, 0, 0.5, 0, 0, 0, 0.5, 0, -0.5 );\",\n \"const mat3 g6 = mat3( 0.1666666716337204, -0.3333333432674408, 0.1666666716337204, -0.3333333432674408, 0.6666666865348816, -0.3333333432674408, 0.1666666716337204, -0.3333333432674408, 0.1666666716337204 );\",\n \"const mat3 g7 = mat3( -0.3333333432674408, 0.1666666716337204, -0.3333333432674408, 0.1666666716337204, 0.6666666865348816, 0.1666666716337204, -0.3333333432674408, 0.1666666716337204, -0.3333333432674408 );\",\n \"const mat3 g8 = mat3( 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408 );\",\n \"void main(void)\",\n \"{\",\n \"\tG[0] = g0,\",\n \"\tG[1] = g1,\",\n \"\tG[2] = g2,\",\n \"\tG[3] = g3,\",\n \"\tG[4] = g4,\",\n \"\tG[5] = g5,\",\n \"\tG[6] = g6,\",\n \"\tG[7] = g7,\",\n \"\tG[8] = g8;\",\n \"\tmat3 I;\",\n \"\tfloat cnv[9];\",\n \"\tvec3 sample;\",\n /* fetch the 3x3 neighbourhood and use the RGB vector's length as intensity value */\n \"\tfor (float i=0.0; i<3.0; i++) {\",\n \"\t\tfor (float j=0.0; j<3.0; j++) {\",\n \"\t\t\tsample = texture2D(tDiffuse, vUv + texel * vec2(i-1.0,j-1.0) ).rgb;\",\n \"\t\t\tI[int(i)][int(j)] = length(sample);\",\n \"\t\t}\",\n \"\t}\",\n /* calculate the convolution values for all the masks */\n \"\tfor (int i=0; i<9; i++) {\",\n \"\t\tfloat dp3 = dot(G[i][0], I[0]) + dot(G[i][1], I[1]) + dot(G[i][2], I[2]);\",\n \"\t\tcnv[i] = dp3 * dp3;\",\n \"\t}\",\n \"\tfloat M = (cnv[0] + cnv[1]) + (cnv[2] + cnv[3]);\",\n \"\tfloat S = (cnv[4] + cnv[5]) + (cnv[6] + cnv[7]) + (cnv[8] + M);\",\n \"\tgl_FragColor = vec4(vec3(sqrt(M/S)), 1.0);\",\n \"}\"\n ].join(\"\\n\")\n};\nconst FresnelShader = {\n uniforms: {\n mRefractionRatio: { value: 1.02 },\n mFresnelBias: { value: 0.1 },\n mFresnelPower: { value: 2 },\n mFresnelScale: { value: 1 },\n tCube: { value: null }\n },\n vertexShader: [\n \"uniform float mRefractionRatio;\",\n \"uniform float mFresnelBias;\",\n \"uniform float mFresnelScale;\",\n \"uniform float mFresnelPower;\",\n \"varying vec3 vReflect;\",\n \"varying vec3 vRefract[3];\",\n \"varying float vReflectionFactor;\",\n \"void main() {\",\n \"\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\",\n \"\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\",\n \"\tvec3 worldNormal = normalize( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * normal );\",\n \"\tvec3 I = worldPosition.xyz - cameraPosition;\",\n \"\tvReflect = reflect( I, worldNormal );\",\n \"\tvRefract[0] = refract( normalize( I ), worldNormal, mRefractionRatio );\",\n \"\tvRefract[1] = refract( normalize( I ), worldNormal, mRefractionRatio * 0.99 );\",\n \"\tvRefract[2] = refract( normalize( I ), worldNormal, mRefractionRatio * 0.98 );\",\n \"\tvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), worldNormal ), mFresnelPower );\",\n \"\tgl_Position = projectionMatrix * mvPosition;\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform samplerCube tCube;\",\n \"varying vec3 vReflect;\",\n \"varying vec3 vRefract[3];\",\n \"varying float vReflectionFactor;\",\n \"void main() {\",\n \"\tvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\",\n \"\tvec4 refractedColor = vec4( 1.0 );\",\n \"\trefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\",\n \"\trefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\",\n \"\trefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\",\n \"\tgl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\",\n \"}\"\n ].join(\"\\n\")\n};\nconst GammaCorrectionShader = {\n uniforms: {\n tDiffuse: { value: null }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform sampler2D tDiffuse;\",\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvec4 tex = texture2D( tDiffuse, vUv );\",\n \"\tgl_FragColor = LinearTosRGB( tex );\",\n \"}\"\n ].join(\"\\n\")\n};\nconst GodRaysDepthMaskShader = {\n uniforms: {\n tInput: {\n value: null\n }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \" vUv = uv;\",\n \" gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"varying vec2 vUv;\",\n \"uniform sampler2D tInput;\",\n \"void main() {\",\n \"\tgl_FragColor = vec4( 1.0 ) - texture2D( tInput, vUv );\",\n \"}\"\n ].join(\"\\n\")\n};\nconst GodRaysGenerateShader = {\n uniforms: {\n tInput: {\n value: null\n },\n fStepSize: {\n value: 1\n },\n vSunPositionScreenSpace: {\n value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3()\n }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \" vUv = uv;\",\n \" gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"#define TAPS_PER_PASS 6.0\",\n \"varying vec2 vUv;\",\n \"uniform sampler2D tInput;\",\n \"uniform vec3 vSunPositionScreenSpace;\",\n \"uniform float fStepSize;\",\n // filter step size\n \"void main() {\",\n // delta from current pixel to \"sun\" position\n \"\tvec2 delta = vSunPositionScreenSpace.xy - vUv;\",\n \"\tfloat dist = length( delta );\",\n // Step vector (uv space)\n \"\tvec2 stepv = fStepSize * delta / dist;\",\n // Number of iterations between pixel and sun\n \"\tfloat iters = dist/fStepSize;\",\n \"\tvec2 uv = vUv.xy;\",\n \"\tfloat col = 0.0;\",\n // This breaks ANGLE in Chrome 22\n //\t- see http://code.google.com/p/chromium/issues/detail?id=153105\n /*\n \t\t// Unrolling didnt do much on my hardware (ATI Mobility Radeon 3450),\n \t\t// so i've just left the loop\n \n \t\t\"for ( float i = 0.0; i < TAPS_PER_PASS; i += 1.0 ) {\",\n \n \t\t// Accumulate samples, making sure we dont walk past the light source.\n \n \t\t// The check for uv.y < 1 would not be necessary with \"border\" UV wrap\n \t\t// mode, with a black border color. I don't think this is currently\n \t\t// exposed by three.js. As a result there might be artifacts when the\n \t\t// sun is to the left, right or bottom of screen as these cases are\n \t\t// not specifically handled.\n \n \t\t\"\tcol += ( i <= iters && uv.y < 1.0 ? texture2D( tInput, uv ).r : 0.0 );\",\n \t\t\"\tuv += stepv;\",\n \n \t\t\"}\",\n \t\t*/\n // Unrolling loop manually makes it work in ANGLE\n \"\tfloat f = min( 1.0, max( vSunPositionScreenSpace.z / 1000.0, 0.0 ) );\",\n // used to fade out godrays\n \"\tif ( 0.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;\",\n \"\tuv += stepv;\",\n \"\tif ( 1.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;\",\n \"\tuv += stepv;\",\n \"\tif ( 2.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;\",\n \"\tuv += stepv;\",\n \"\tif ( 3.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;\",\n \"\tuv += stepv;\",\n \"\tif ( 4.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;\",\n \"\tuv += stepv;\",\n \"\tif ( 5.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;\",\n \"\tuv += stepv;\",\n // Should technically be dividing by 'iters', but 'TAPS_PER_PASS' smooths out\n // objectionable artifacts, in particular near the sun position. The side\n // effect is that the result is darker than it should be around the sun, as\n // TAPS_PER_PASS is greater than the number of samples actually accumulated.\n // When the result is inverted (in the shader 'godrays_combine', this produces\n // a slight bright spot at the position of the sun, even when it is occluded.\n \"\tgl_FragColor = vec4( col/TAPS_PER_PASS );\",\n \"\tgl_FragColor.a = 1.0;\",\n \"}\"\n ].join(\"\\n\")\n};\nconst GodRaysCombineShader = {\n uniforms: {\n tColors: {\n value: null\n },\n tGodRays: {\n value: null\n },\n fGodRayIntensity: {\n value: 0.69\n }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"varying vec2 vUv;\",\n \"uniform sampler2D tColors;\",\n \"uniform sampler2D tGodRays;\",\n \"uniform float fGodRayIntensity;\",\n \"void main() {\",\n // Since THREE.MeshDepthMaterial renders foreground objects white and background\n // objects black, the god-rays will be white streaks. Therefore value is inverted\n // before being combined with tColors\n \"\tgl_FragColor = texture2D( tColors, vUv ) + fGodRayIntensity * vec4( 1.0 - texture2D( tGodRays, vUv ).r );\",\n \"\tgl_FragColor.a = 1.0;\",\n \"}\"\n ].join(\"\\n\")\n};\nconst GodRaysFakeSunShader = {\n uniforms: {\n vSunPositionScreenSpace: {\n value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3()\n },\n fAspect: {\n value: 1\n },\n sunColor: {\n value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Color(16772608)\n },\n bgColor: {\n value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Color(0)\n }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"varying vec2 vUv;\",\n \"uniform vec3 vSunPositionScreenSpace;\",\n \"uniform float fAspect;\",\n \"uniform vec3 sunColor;\",\n \"uniform vec3 bgColor;\",\n \"void main() {\",\n \"\tvec2 diff = vUv - vSunPositionScreenSpace.xy;\",\n // Correct for aspect ratio\n \"\tdiff.x *= fAspect;\",\n \"\tfloat prop = clamp( length( diff ) / 0.5, 0.0, 1.0 );\",\n \"\tprop = 0.35 * pow( 1.0 - prop, 3.0 );\",\n \"\tgl_FragColor.xyz = ( vSunPositionScreenSpace.z > 0.0 ) ? mix( sunColor, bgColor, 1.0 - prop ) : bgColor;\",\n \"\tgl_FragColor.w = 1.0;\",\n \"}\"\n ].join(\"\\n\")\n};\nconst HorizontalBlurShader = {\n uniforms: {\n tDiffuse: { value: null },\n h: { value: 1 / 512 }\n },\n vertexShader: (\n /* glsl */\n `\n varying vec2 vUv;\n\n void main() {\n\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }\n `\n ),\n fragmentShader: (\n /* glsl */\n `\n uniform sampler2D tDiffuse;\n uniform float h;\n\n varying vec2 vUv;\n\n void main() {\n\n \tvec4 sum = vec4( 0.0 );\n\n \tsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;\n \tsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;\n \tsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;\n \tsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;\n \tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n \tsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;\n \tsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;\n \tsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;\n \tsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;\n\n \tgl_FragColor = sum;\n\n }\n `\n )\n};\nconst HorizontalTiltShiftShader = {\n uniforms: {\n tDiffuse: { value: null },\n h: { value: 1 / 512 },\n r: { value: 0.35 }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform sampler2D tDiffuse;\",\n \"uniform float h;\",\n \"uniform float r;\",\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvec4 sum = vec4( 0.0 );\",\n \"\tfloat hh = h * abs( r - vUv.y );\",\n \"\tsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * hh, vUv.y ) ) * 0.051;\",\n \"\tsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * hh, vUv.y ) ) * 0.0918;\",\n \"\tsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * hh, vUv.y ) ) * 0.12245;\",\n \"\tsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * hh, vUv.y ) ) * 0.1531;\",\n \"\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\",\n \"\tsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * hh, vUv.y ) ) * 0.1531;\",\n \"\tsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * hh, vUv.y ) ) * 0.12245;\",\n \"\tsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * hh, vUv.y ) ) * 0.0918;\",\n \"\tsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * hh, vUv.y ) ) * 0.051;\",\n \"\tgl_FragColor = sum;\",\n \"}\"\n ].join(\"\\n\")\n};\nconst HueSaturationShader = {\n uniforms: {\n tDiffuse: { value: null },\n hue: { value: 0 },\n saturation: { value: 0 }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform sampler2D tDiffuse;\",\n \"uniform float hue;\",\n \"uniform float saturation;\",\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tgl_FragColor = texture2D( tDiffuse, vUv );\",\n // hue\n \"\tfloat angle = hue * 3.14159265;\",\n \"\tfloat s = sin(angle), c = cos(angle);\",\n \"\tvec3 weights = (vec3(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + 1.0) / 3.0;\",\n \"\tfloat len = length(gl_FragColor.rgb);\",\n \"\tgl_FragColor.rgb = vec3(\",\n \"\t\tdot(gl_FragColor.rgb, weights.xyz),\",\n \"\t\tdot(gl_FragColor.rgb, weights.zxy),\",\n \"\t\tdot(gl_FragColor.rgb, weights.yzx)\",\n \"\t);\",\n // saturation\n \"\tfloat average = (gl_FragColor.r + gl_FragColor.g + gl_FragColor.b) / 3.0;\",\n \"\tif (saturation > 0.0) {\",\n \"\t\tgl_FragColor.rgb += (average - gl_FragColor.rgb) * (1.0 - 1.0 / (1.001 - saturation));\",\n \"\t} else {\",\n \"\t\tgl_FragColor.rgb += (average - gl_FragColor.rgb) * (-saturation);\",\n \"\t}\",\n \"}\"\n ].join(\"\\n\")\n};\nconst KaleidoShader = {\n uniforms: {\n tDiffuse: { value: null },\n sides: { value: 6 },\n angle: { value: 0 }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform sampler2D tDiffuse;\",\n \"uniform float sides;\",\n \"uniform float angle;\",\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvec2 p = vUv - 0.5;\",\n \"\tfloat r = length(p);\",\n \"\tfloat a = atan(p.y, p.x) + angle;\",\n \"\tfloat tau = 2. * 3.1416 ;\",\n \"\ta = mod(a, tau/sides);\",\n \"\ta = abs(a - tau/sides/2.) ;\",\n \"\tp = r * vec2(cos(a), sin(a));\",\n \"\tvec4 color = texture2D(tDiffuse, p + 0.5);\",\n \"\tgl_FragColor = color;\",\n \"}\"\n ].join(\"\\n\")\n};\nconst MirrorShader = {\n uniforms: {\n tDiffuse: { value: null },\n side: { value: 1 }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform sampler2D tDiffuse;\",\n \"uniform int side;\",\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvec2 p = vUv;\",\n \"\tif (side == 0){\",\n \"\t\tif (p.x > 0.5) p.x = 1.0 - p.x;\",\n \"\t}else if (side == 1){\",\n \"\t\tif (p.x < 0.5) p.x = 1.0 - p.x;\",\n \"\t}else if (side == 2){\",\n \"\t\tif (p.y < 0.5) p.y = 1.0 - p.y;\",\n \"\t}else if (side == 3){\",\n \"\t\tif (p.y > 0.5) p.y = 1.0 - p.y;\",\n \"\t} \",\n \"\tvec4 color = texture2D(tDiffuse, p);\",\n \"\tgl_FragColor = color;\",\n \"}\"\n ].join(\"\\n\")\n};\nconst NormalMapShader = {\n uniforms: {\n heightMap: { value: null },\n resolution: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(512, 512) },\n scale: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(1, 1) },\n height: { value: 0.05 }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform float height;\",\n \"uniform vec2 resolution;\",\n \"uniform sampler2D heightMap;\",\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tfloat val = texture2D( heightMap, vUv ).x;\",\n \"\tfloat valU = texture2D( heightMap, vUv + vec2( 1.0 / resolution.x, 0.0 ) ).x;\",\n \"\tfloat valV = texture2D( heightMap, vUv + vec2( 0.0, 1.0 / resolution.y ) ).x;\",\n \"\tgl_FragColor = vec4( ( 0.5 * normalize( vec3( val - valU, val - valV, height ) ) + 0.5 ), 1.0 );\",\n \"}\"\n ].join(\"\\n\")\n};\nconst ParallaxShader = {\n // Ordered from fastest to best quality.\n modes: {\n none: \"NO_PARALLAX\",\n basic: \"USE_BASIC_PARALLAX\",\n steep: \"USE_STEEP_PARALLAX\",\n occlusion: \"USE_OCLUSION_PARALLAX\",\n // a.k.a. POM\n relief: \"USE_RELIEF_PARALLAX\"\n },\n uniforms: {\n bumpMap: { value: null },\n map: { value: null },\n parallaxScale: { value: null },\n parallaxMinLayers: { value: null },\n parallaxMaxLayers: { value: null }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"varying vec3 vViewPosition;\",\n \"varying vec3 vNormal;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\",\n \"\tvViewPosition = -mvPosition.xyz;\",\n \"\tvNormal = normalize( normalMatrix * normal );\",\n \"\tgl_Position = projectionMatrix * mvPosition;\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform sampler2D bumpMap;\",\n \"uniform sampler2D map;\",\n \"uniform float parallaxScale;\",\n \"uniform float parallaxMinLayers;\",\n \"uniform float parallaxMaxLayers;\",\n \"varying vec2 vUv;\",\n \"varying vec3 vViewPosition;\",\n \"varying vec3 vNormal;\",\n \"#ifdef USE_BASIC_PARALLAX\",\n \"\tvec2 parallaxMap( in vec3 V ) {\",\n \"\t\tfloat initialHeight = texture2D( bumpMap, vUv ).r;\",\n // No Offset Limitting: messy, floating output at grazing angles.\n //\"vec2 texCoordOffset = parallaxScale * V.xy / V.z * initialHeight;\",\n // Offset Limiting\n \"\t\tvec2 texCoordOffset = parallaxScale * V.xy * initialHeight;\",\n \"\t\treturn vUv - texCoordOffset;\",\n \"\t}\",\n \"#else\",\n \"\tvec2 parallaxMap( in vec3 V ) {\",\n // Determine number of layers from angle between V and N\n \"\t\tfloat numLayers = mix( parallaxMaxLayers, parallaxMinLayers, abs( dot( vec3( 0.0, 0.0, 1.0 ), V ) ) );\",\n \"\t\tfloat layerHeight = 1.0 / numLayers;\",\n \"\t\tfloat currentLayerHeight = 0.0;\",\n // Shift of texture coordinates for each iteration\n \"\t\tvec2 dtex = parallaxScale * V.xy / V.z / numLayers;\",\n \"\t\tvec2 currentTextureCoords = vUv;\",\n \"\t\tfloat heightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;\",\n // while ( heightFromTexture > currentLayerHeight )\n // Infinite loops are not well supported. Do a \"large\" finite\n // loop, but not too large, as it slows down some compilers.\n \"\t\tfor ( int i = 0; i < 30; i += 1 ) {\",\n \"\t\t\tif ( heightFromTexture <= currentLayerHeight ) {\",\n \"\t\t\t\tbreak;\",\n \"\t\t\t}\",\n \"\t\t\tcurrentLayerHeight += layerHeight;\",\n // Shift texture coordinates along vector V\n \"\t\t\tcurrentTextureCoords -= dtex;\",\n \"\t\t\theightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;\",\n \"\t\t}\",\n \"\t\t#ifdef USE_STEEP_PARALLAX\",\n \"\t\t\treturn currentTextureCoords;\",\n \"\t\t#elif defined( USE_RELIEF_PARALLAX )\",\n \"\t\t\tvec2 deltaTexCoord = dtex / 2.0;\",\n \"\t\t\tfloat deltaHeight = layerHeight / 2.0;\",\n // Return to the mid point of previous layer\n \"\t\t\tcurrentTextureCoords += deltaTexCoord;\",\n \"\t\t\tcurrentLayerHeight -= deltaHeight;\",\n // Binary search to increase precision of Steep Parallax Mapping\n \"\t\t\tconst int numSearches = 5;\",\n \"\t\t\tfor ( int i = 0; i < numSearches; i += 1 ) {\",\n \"\t\t\t\tdeltaTexCoord /= 2.0;\",\n \"\t\t\t\tdeltaHeight /= 2.0;\",\n \"\t\t\t\theightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;\",\n // Shift along or against vector V\n \"\t\t\t\tif( heightFromTexture > currentLayerHeight ) {\",\n // Below the surface\n \"\t\t\t\t\tcurrentTextureCoords -= deltaTexCoord;\",\n \"\t\t\t\t\tcurrentLayerHeight += deltaHeight;\",\n \"\t\t\t\t} else {\",\n // above the surface\n \"\t\t\t\t\tcurrentTextureCoords += deltaTexCoord;\",\n \"\t\t\t\t\tcurrentLayerHeight -= deltaHeight;\",\n \"\t\t\t\t}\",\n \"\t\t\t}\",\n \"\t\t\treturn currentTextureCoords;\",\n \"\t\t#elif defined( USE_OCLUSION_PARALLAX )\",\n \"\t\t\tvec2 prevTCoords = currentTextureCoords + dtex;\",\n // Heights for linear interpolation\n \"\t\t\tfloat nextH = heightFromTexture - currentLayerHeight;\",\n \"\t\t\tfloat prevH = texture2D( bumpMap, prevTCoords ).r - currentLayerHeight + layerHeight;\",\n // Proportions for linear interpolation\n \"\t\t\tfloat weight = nextH / ( nextH - prevH );\",\n // Interpolation of texture coordinates\n \"\t\t\treturn prevTCoords * weight + currentTextureCoords * ( 1.0 - weight );\",\n \"\t\t#else\",\n // NO_PARALLAX\n \"\t\t\treturn vUv;\",\n \"\t\t#endif\",\n \"\t}\",\n \"#endif\",\n \"vec2 perturbUv( vec3 surfPosition, vec3 surfNormal, vec3 viewPosition ) {\",\n \"\tvec2 texDx = dFdx( vUv );\",\n \"\tvec2 texDy = dFdy( vUv );\",\n \"\tvec3 vSigmaX = dFdx( surfPosition );\",\n \"\tvec3 vSigmaY = dFdy( surfPosition );\",\n \"\tvec3 vR1 = cross( vSigmaY, surfNormal );\",\n \"\tvec3 vR2 = cross( surfNormal, vSigmaX );\",\n \"\tfloat fDet = dot( vSigmaX, vR1 );\",\n \"\tvec2 vProjVscr = ( 1.0 / fDet ) * vec2( dot( vR1, viewPosition ), dot( vR2, viewPosition ) );\",\n \"\tvec3 vProjVtex;\",\n \"\tvProjVtex.xy = texDx * vProjVscr.x + texDy * vProjVscr.y;\",\n \"\tvProjVtex.z = dot( surfNormal, viewPosition );\",\n \"\treturn parallaxMap( vProjVtex );\",\n \"}\",\n \"void main() {\",\n \"\tvec2 mapUv = perturbUv( -vViewPosition, normalize( vNormal ), normalize( vViewPosition ) );\",\n \"\tgl_FragColor = texture2D( map, mapUv );\",\n \"}\"\n ].join(\"\\n\")\n};\nconst PixelShader = {\n uniforms: {\n tDiffuse: { value: null },\n resolution: { value: null },\n pixelSize: { value: 1 }\n },\n vertexShader: [\n \"varying highp vec2 vUv;\",\n \"void main() {\",\n \"vUv = uv;\",\n \"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform sampler2D tDiffuse;\",\n \"uniform float pixelSize;\",\n \"uniform vec2 resolution;\",\n \"varying highp vec2 vUv;\",\n \"void main(){\",\n \"vec2 dxy = pixelSize / resolution;\",\n \"vec2 coord = dxy * floor( vUv / dxy );\",\n \"gl_FragColor = texture2D(tDiffuse, coord);\",\n \"}\"\n ].join(\"\\n\")\n};\nconst RGBShiftShader = {\n uniforms: {\n tDiffuse: { value: null },\n amount: { value: 5e-3 },\n angle: { value: 0 }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform sampler2D tDiffuse;\",\n \"uniform float amount;\",\n \"uniform float angle;\",\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvec2 offset = amount * vec2( cos(angle), sin(angle));\",\n \"\tvec4 cr = texture2D(tDiffuse, vUv + offset);\",\n \"\tvec4 cga = texture2D(tDiffuse, vUv);\",\n \"\tvec4 cb = texture2D(tDiffuse, vUv - offset);\",\n \"\tgl_FragColor = vec4(cr.r, cga.g, cb.b, cga.a);\",\n \"}\"\n ].join(\"\\n\")\n};\nconst SepiaShader = {\n uniforms: {\n tDiffuse: { value: null },\n amount: { value: 1 }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform float amount;\",\n \"uniform sampler2D tDiffuse;\",\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvec4 color = texture2D( tDiffuse, vUv );\",\n \"\tvec3 c = color.rgb;\",\n \"\tcolor.r = dot( c, vec3( 1.0 - 0.607 * amount, 0.769 * amount, 0.189 * amount ) );\",\n \"\tcolor.g = dot( c, vec3( 0.349 * amount, 1.0 - 0.314 * amount, 0.168 * amount ) );\",\n \"\tcolor.b = dot( c, vec3( 0.272 * amount, 0.534 * amount, 1.0 - 0.869 * amount ) );\",\n \"\tgl_FragColor = vec4( min( vec3( 1.0 ), color.rgb ), color.a );\",\n \"}\"\n ].join(\"\\n\")\n};\nconst SobelOperatorShader = {\n uniforms: {\n tDiffuse: { value: null },\n resolution: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector2() }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform sampler2D tDiffuse;\",\n \"uniform vec2 resolution;\",\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvec2 texel = vec2( 1.0 / resolution.x, 1.0 / resolution.y );\",\n // kernel definition (in glsl matrices are filled in column-major order)\n \"\tconst mat3 Gx = mat3( -1, -2, -1, 0, 0, 0, 1, 2, 1 );\",\n // x direction kernel\n \"\tconst mat3 Gy = mat3( -1, 0, 1, -2, 0, 2, -1, 0, 1 );\",\n // y direction kernel\n // fetch the 3x3 neighbourhood of a fragment\n // first column\n \"\tfloat tx0y0 = texture2D( tDiffuse, vUv + texel * vec2( -1, -1 ) ).r;\",\n \"\tfloat tx0y1 = texture2D( tDiffuse, vUv + texel * vec2( -1, 0 ) ).r;\",\n \"\tfloat tx0y2 = texture2D( tDiffuse, vUv + texel * vec2( -1, 1 ) ).r;\",\n // second column\n \"\tfloat tx1y0 = texture2D( tDiffuse, vUv + texel * vec2( 0, -1 ) ).r;\",\n \"\tfloat tx1y1 = texture2D( tDiffuse, vUv + texel * vec2( 0, 0 ) ).r;\",\n \"\tfloat tx1y2 = texture2D( tDiffuse, vUv + texel * vec2( 0, 1 ) ).r;\",\n // third column\n \"\tfloat tx2y0 = texture2D( tDiffuse, vUv + texel * vec2( 1, -1 ) ).r;\",\n \"\tfloat tx2y1 = texture2D( tDiffuse, vUv + texel * vec2( 1, 0 ) ).r;\",\n \"\tfloat tx2y2 = texture2D( tDiffuse, vUv + texel * vec2( 1, 1 ) ).r;\",\n // gradient value in x direction\n \"\tfloat valueGx = Gx[0][0] * tx0y0 + Gx[1][0] * tx1y0 + Gx[2][0] * tx2y0 + \",\n \"\t\tGx[0][1] * tx0y1 + Gx[1][1] * tx1y1 + Gx[2][1] * tx2y1 + \",\n \"\t\tGx[0][2] * tx0y2 + Gx[1][2] * tx1y2 + Gx[2][2] * tx2y2; \",\n // gradient value in y direction\n \"\tfloat valueGy = Gy[0][0] * tx0y0 + Gy[1][0] * tx1y0 + Gy[2][0] * tx2y0 + \",\n \"\t\tGy[0][1] * tx0y1 + Gy[1][1] * tx1y1 + Gy[2][1] * tx2y1 + \",\n \"\t\tGy[0][2] * tx0y2 + Gy[1][2] * tx1y2 + Gy[2][2] * tx2y2; \",\n // magnitute of the total gradient\n \"\tfloat G = sqrt( ( valueGx * valueGx ) + ( valueGy * valueGy ) );\",\n \"\tgl_FragColor = vec4( vec3( G ), 1 );\",\n \"}\"\n ].join(\"\\n\")\n};\nlet _SubsurfaceScatteringShader;\nfunction get() {\n if (_SubsurfaceScatteringShader)\n return _SubsurfaceScatteringShader;\n const meshphong_frag_head = three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk[\"meshphong_frag\"].slice(\n 0,\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk[\"meshphong_frag\"].indexOf(\"void main() {\")\n );\n const meshphong_frag_body = three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk[\"meshphong_frag\"].slice(\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk[\"meshphong_frag\"].indexOf(\"void main() {\")\n );\n _SubsurfaceScatteringShader = {\n uniforms: /* @__PURE__ */ three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.merge([\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderLib[\"phong\"].uniforms,\n {\n thicknessMap: { value: null },\n thicknessColor: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Color(16777215) },\n thicknessDistortion: { value: 0.1 },\n thicknessAmbient: { value: 0 },\n thicknessAttenuation: { value: 0.1 },\n thicknessPower: { value: 2 },\n thicknessScale: { value: 10 }\n }\n ]),\n vertexShader: (\n /* glsl */\n `\n #define USE_UV\n ${three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk[\"meshphong_vert\"]}\n `\n ),\n fragmentShader: (\n /* glsl */\n `\n #define USE_UV',\n #define SUBSURFACE',\n\n ${meshphong_frag_head}\n\n uniform sampler2D thicknessMap;\n uniform float thicknessPower;\n uniform float thicknessScale;\n uniform float thicknessDistortion;\n uniform float thicknessAmbient;\n uniform float thicknessAttenuation;\n uniform vec3 thicknessColor;\n\n void RE_Direct_Scattering(const in IncidentLight directLight, const in vec2 uv, const in GeometricContext geometry, inout ReflectedLight reflectedLight) {\n \tvec3 thickness = thicknessColor * texture2D(thicknessMap, uv).r;\n \tvec3 scatteringHalf = normalize(directLight.direction + (geometry.normal * thicknessDistortion));\n \tfloat scatteringDot = pow(saturate(dot(geometry.viewDir, -scatteringHalf)), thicknessPower) * thicknessScale;\n \tvec3 scatteringIllu = (scatteringDot + thicknessAmbient) * thickness;\n \treflectedLight.directDiffuse += scatteringIllu * thicknessAttenuation * directLight.color;\n }\n\n ${meshphong_frag_body.replace(\n \"#include \",\n three__WEBPACK_IMPORTED_MODULE_42__.ShaderChunk[\"lights_fragment_begin\"].replace(\n /RE_Direct\\( directLight, geometry, material, reflectedLight \\);/g,\n /* glsl */\n `\n RE_Direct( directLight, geometry, material, reflectedLight );\n\n #if defined( SUBSURFACE ) && defined( USE_UV )\n RE_Direct_Scattering(directLight, vUv, geometry, reflectedLight);\n #endif\n `\n )\n )}\n `\n )\n };\n return _SubsurfaceScatteringShader;\n}\nconst SubsurfaceScatteringShader = {\n get uniforms() {\n return get().uniforms;\n },\n set uniforms(value) {\n get().uniforms = value;\n },\n get vertexShader() {\n return get().vertexShader;\n },\n set vertexShader(value) {\n get().vertexShader = value;\n },\n get fragmentShader() {\n return get().vertexShader;\n },\n set fragmentShader(value) {\n get().vertexShader = value;\n }\n};\nconst TechnicolorShader = {\n uniforms: {\n tDiffuse: { value: null }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform sampler2D tDiffuse;\",\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvec4 tex = texture2D( tDiffuse, vec2( vUv.x, vUv.y ) );\",\n \"\tvec4 newTex = vec4(tex.r, (tex.g + tex.b) * .5, (tex.g + tex.b) * .5, 1.0);\",\n \"\tgl_FragColor = newTex;\",\n \"}\"\n ].join(\"\\n\")\n};\nconst ToonShader1 = {\n uniforms: {\n uDirLightPos: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3() },\n uDirLightColor: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Color(15658734) },\n uAmbientLightColor: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Color(328965) },\n uBaseColor: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Color(16777215) }\n },\n vertexShader: [\n \"varying vec3 vNormal;\",\n \"varying vec3 vRefract;\",\n \"void main() {\",\n \"\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\",\n \"\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\",\n \"\tvec3 worldNormal = normalize ( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * normal );\",\n \"\tvNormal = normalize( normalMatrix * normal );\",\n \"\tvec3 I = worldPosition.xyz - cameraPosition;\",\n \"\tvRefract = refract( normalize( I ), worldNormal, 1.02 );\",\n \"\tgl_Position = projectionMatrix * mvPosition;\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform vec3 uBaseColor;\",\n \"uniform vec3 uDirLightPos;\",\n \"uniform vec3 uDirLightColor;\",\n \"uniform vec3 uAmbientLightColor;\",\n \"varying vec3 vNormal;\",\n \"varying vec3 vRefract;\",\n \"void main() {\",\n \"\tfloat directionalLightWeighting = max( dot( normalize( vNormal ), uDirLightPos ), 0.0);\",\n \"\tvec3 lightWeighting = uAmbientLightColor + uDirLightColor * directionalLightWeighting;\",\n \"\tfloat intensity = smoothstep( - 0.5, 1.0, pow( length(lightWeighting), 20.0 ) );\",\n \"\tintensity += length(lightWeighting) * 0.2;\",\n \"\tfloat cameraWeighting = dot( normalize( vNormal ), vRefract );\",\n \"\tintensity += pow( 1.0 - length( cameraWeighting ), 6.0 );\",\n \"\tintensity = intensity * 0.2 + 0.3;\",\n \"\tif ( intensity < 0.50 ) {\",\n \"\t\tgl_FragColor = vec4( 2.0 * intensity * uBaseColor, 1.0 );\",\n \"\t} else {\",\n \"\t\tgl_FragColor = vec4( 1.0 - 2.0 * ( 1.0 - intensity ) * ( 1.0 - uBaseColor ), 1.0 );\",\n \"}\",\n \"}\"\n ].join(\"\\n\")\n};\nconst ToonShader2 = {\n uniforms: {\n uDirLightPos: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3() },\n uDirLightColor: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Color(15658734) },\n uAmbientLightColor: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Color(328965) },\n uBaseColor: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Color(15658734) },\n uLineColor1: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Color(8421504) },\n uLineColor2: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Color(0) },\n uLineColor3: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Color(0) },\n uLineColor4: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Color(0) }\n },\n vertexShader: [\n \"varying vec3 vNormal;\",\n \"void main() {\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"\tvNormal = normalize( normalMatrix * normal );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform vec3 uBaseColor;\",\n \"uniform vec3 uLineColor1;\",\n \"uniform vec3 uLineColor2;\",\n \"uniform vec3 uLineColor3;\",\n \"uniform vec3 uLineColor4;\",\n \"uniform vec3 uDirLightPos;\",\n \"uniform vec3 uDirLightColor;\",\n \"uniform vec3 uAmbientLightColor;\",\n \"varying vec3 vNormal;\",\n \"void main() {\",\n \"\tfloat camera = max( dot( normalize( vNormal ), vec3( 0.0, 0.0, 1.0 ) ), 0.4);\",\n \"\tfloat light = max( dot( normalize( vNormal ), uDirLightPos ), 0.0);\",\n \"\tgl_FragColor = vec4( uBaseColor, 1.0 );\",\n \"\tif ( length(uAmbientLightColor + uDirLightColor * light) < 1.00 ) {\",\n \"\t\tgl_FragColor *= vec4( uLineColor1, 1.0 );\",\n \"\t}\",\n \"\tif ( length(uAmbientLightColor + uDirLightColor * camera) < 0.50 ) {\",\n \"\t\tgl_FragColor *= vec4( uLineColor2, 1.0 );\",\n \"\t}\",\n \"}\"\n ].join(\"\\n\")\n};\nconst ToonShaderHatching = {\n uniforms: {\n uDirLightPos: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3() },\n uDirLightColor: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Color(15658734) },\n uAmbientLightColor: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Color(328965) },\n uBaseColor: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Color(16777215) },\n uLineColor1: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Color(0) },\n uLineColor2: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Color(0) },\n uLineColor3: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Color(0) },\n uLineColor4: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Color(0) }\n },\n vertexShader: [\n \"varying vec3 vNormal;\",\n \"void main() {\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"\tvNormal = normalize( normalMatrix * normal );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform vec3 uBaseColor;\",\n \"uniform vec3 uLineColor1;\",\n \"uniform vec3 uLineColor2;\",\n \"uniform vec3 uLineColor3;\",\n \"uniform vec3 uLineColor4;\",\n \"uniform vec3 uDirLightPos;\",\n \"uniform vec3 uDirLightColor;\",\n \"uniform vec3 uAmbientLightColor;\",\n \"varying vec3 vNormal;\",\n \"void main() {\",\n \"\tfloat directionalLightWeighting = max( dot( normalize(vNormal), uDirLightPos ), 0.0);\",\n \"\tvec3 lightWeighting = uAmbientLightColor + uDirLightColor * directionalLightWeighting;\",\n \"\tgl_FragColor = vec4( uBaseColor, 1.0 );\",\n \"\tif ( length(lightWeighting) < 1.00 ) {\",\n \"\t\tif ( mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0) {\",\n \"\t\t\tgl_FragColor = vec4( uLineColor1, 1.0 );\",\n \"\t\t}\",\n \"\t}\",\n \"\tif ( length(lightWeighting) < 0.75 ) {\",\n \"\t\tif (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0) {\",\n \"\t\t\tgl_FragColor = vec4( uLineColor2, 1.0 );\",\n \"\t\t}\",\n \"\t}\",\n \"\tif ( length(lightWeighting) < 0.50 ) {\",\n \"\t\tif (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0) {\",\n \"\t\t\tgl_FragColor = vec4( uLineColor3, 1.0 );\",\n \"\t\t}\",\n \"\t}\",\n \"\tif ( length(lightWeighting) < 0.3465 ) {\",\n \"\t\tif (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0) {\",\n \"\t\t\tgl_FragColor = vec4( uLineColor4, 1.0 );\",\n \"\t}\",\n \"\t}\",\n \"}\"\n ].join(\"\\n\")\n};\nconst ToonShaderDotted = {\n uniforms: {\n uDirLightPos: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3() },\n uDirLightColor: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Color(15658734) },\n uAmbientLightColor: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Color(328965) },\n uBaseColor: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Color(16777215) },\n uLineColor1: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Color(0) }\n },\n vertexShader: [\n \"varying vec3 vNormal;\",\n \"void main() {\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"\tvNormal = normalize( normalMatrix * normal );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform vec3 uBaseColor;\",\n \"uniform vec3 uLineColor1;\",\n \"uniform vec3 uLineColor2;\",\n \"uniform vec3 uLineColor3;\",\n \"uniform vec3 uLineColor4;\",\n \"uniform vec3 uDirLightPos;\",\n \"uniform vec3 uDirLightColor;\",\n \"uniform vec3 uAmbientLightColor;\",\n \"varying vec3 vNormal;\",\n \"void main() {\",\n \"float directionalLightWeighting = max( dot( normalize(vNormal), uDirLightPos ), 0.0);\",\n \"vec3 lightWeighting = uAmbientLightColor + uDirLightColor * directionalLightWeighting;\",\n \"gl_FragColor = vec4( uBaseColor, 1.0 );\",\n \"if ( length(lightWeighting) < 1.00 ) {\",\n \"\t\tif ( ( mod(gl_FragCoord.x, 4.001) + mod(gl_FragCoord.y, 4.0) ) > 6.00 ) {\",\n \"\t\t\tgl_FragColor = vec4( uLineColor1, 1.0 );\",\n \"\t\t}\",\n \"\t}\",\n \"\tif ( length(lightWeighting) < 0.50 ) {\",\n \"\t\tif ( ( mod(gl_FragCoord.x + 2.0, 4.001) + mod(gl_FragCoord.y + 2.0, 4.0) ) > 6.00 ) {\",\n \"\t\t\tgl_FragColor = vec4( uLineColor1, 1.0 );\",\n \"\t\t}\",\n \"\t}\",\n \"}\"\n ].join(\"\\n\")\n};\nconst TriangleBlurShader = {\n uniforms: {\n texture: { value: null },\n delta: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(1, 1) }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"#include \",\n \"#define ITERATIONS 10.0\",\n \"uniform sampler2D texture;\",\n \"uniform vec2 delta;\",\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvec4 color = vec4( 0.0 );\",\n \"\tfloat total = 0.0;\",\n // randomize the lookup values to hide the fixed number of samples\n \"\tfloat offset = rand( vUv );\",\n \"\tfor ( float t = -ITERATIONS; t <= ITERATIONS; t ++ ) {\",\n \"\t\tfloat percent = ( t + offset - 0.5 ) / ITERATIONS;\",\n \"\t\tfloat weight = 1.0 - abs( percent );\",\n \"\t\tcolor += texture2D( texture, vUv + delta * percent ) * weight;\",\n \"\t\ttotal += weight;\",\n \"\t}\",\n \"\tgl_FragColor = color / total;\",\n \"}\"\n ].join(\"\\n\")\n};\nconst VerticalBlurShader = {\n uniforms: {\n tDiffuse: { value: null },\n v: { value: 1 / 512 }\n },\n vertexShader: (\n /* glsl */\n `\n varying vec2 vUv;\n\n void main() {\n\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }\n `\n ),\n fragmentShader: (\n /* glsl */\n `\n\n uniform sampler2D tDiffuse;\n uniform float v;\n\n varying vec2 vUv;\n\n void main() {\n\n vec4 sum = vec4( 0.0 );\n\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;\n\n gl_FragColor = sum;\n\n }\n `\n )\n};\nconst VerticalTiltShiftShader = {\n uniforms: {\n tDiffuse: { value: null },\n v: { value: 1 / 512 },\n r: { value: 0.35 }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform sampler2D tDiffuse;\",\n \"uniform float v;\",\n \"uniform float r;\",\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvec4 sum = vec4( 0.0 );\",\n \"\tfloat vv = v * abs( r - vUv.y );\",\n \"\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * vv ) ) * 0.051;\",\n \"\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * vv ) ) * 0.0918;\",\n \"\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * vv ) ) * 0.12245;\",\n \"\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * vv ) ) * 0.1531;\",\n \"\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\",\n \"\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * vv ) ) * 0.1531;\",\n \"\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * vv ) ) * 0.12245;\",\n \"\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * vv ) ) * 0.0918;\",\n \"\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * vv ) ) * 0.051;\",\n \"\tgl_FragColor = sum;\",\n \"}\"\n ].join(\"\\n\")\n};\nconst VignetteShader = {\n uniforms: {\n tDiffuse: { value: null },\n offset: { value: 1 },\n darkness: { value: 1 }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform float offset;\",\n \"uniform float darkness;\",\n \"uniform sampler2D tDiffuse;\",\n \"varying vec2 vUv;\",\n \"void main() {\",\n // Eskil's vignette\n \"\tvec4 texel = texture2D( tDiffuse, vUv );\",\n \"\tvec2 uv = ( vUv - vec2( 0.5 ) ) * vec2( offset );\",\n \"\tgl_FragColor = vec4( mix( texel.rgb, vec3( 1.0 - darkness ), dot( uv, uv ) ), texel.a );\",\n /*\n \t\t// alternative version from glfx.js\n \t\t// this one makes more \"dusty\" look (as opposed to \"burned\")\n \n \t\t\"\tvec4 color = texture2D( tDiffuse, vUv );\",\n \t\t\"\tfloat dist = distance( vUv, vec2( 0.5 ) );\",\n \t\t\"\tcolor.rgb *= smoothstep( 0.8, offset * 0.799, dist *( darkness + offset ) );\",\n \t\t\"\tgl_FragColor = color;\",\n \t\t*/\n \"}\"\n ].join(\"\\n\")\n};\nconst VolumeRenderShader1 = {\n uniforms: {\n u_size: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(1, 1, 1) },\n u_renderstyle: { value: 0 },\n u_renderthreshold: { value: 0.5 },\n u_clim: { value: /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(1, 1) },\n u_data: { value: null },\n u_cmdata: { value: null }\n },\n vertexShader: [\n \"\t\tvarying vec4 v_nearpos;\",\n \"\t\tvarying vec4 v_farpos;\",\n \"\t\tvarying vec3 v_position;\",\n \"\t\tvoid main() {\",\n // Prepare transforms to map to \"camera view\". See also:\n // https://threejs.org/docs/#api/renderers/webgl/WebGLProgram\n \"\t\t\t\tmat4 viewtransformf = modelViewMatrix;\",\n \"\t\t\t\tmat4 viewtransformi = inverse(modelViewMatrix);\",\n // Project local vertex coordinate to camera position. Then do a step\n // backward (in cam coords) to the near clipping plane, and project back. Do\n // the same for the far clipping plane. This gives us all the information we\n // need to calculate the ray and truncate it to the viewing cone.\n \"\t\t\t\tvec4 position4 = vec4(position, 1.0);\",\n \"\t\t\t\tvec4 pos_in_cam = viewtransformf * position4;\",\n // Intersection of ray and near clipping plane (z = -1 in clip coords)\n \"\t\t\t\tpos_in_cam.z = -pos_in_cam.w;\",\n \"\t\t\t\tv_nearpos = viewtransformi * pos_in_cam;\",\n // Intersection of ray and far clipping plane (z = +1 in clip coords)\n \"\t\t\t\tpos_in_cam.z = pos_in_cam.w;\",\n \"\t\t\t\tv_farpos = viewtransformi * pos_in_cam;\",\n // Set varyings and output pos\n \"\t\t\t\tv_position = position;\",\n \"\t\t\t\tgl_Position = projectionMatrix * viewMatrix * modelMatrix * position4;\",\n \"\t\t}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"\t\tprecision highp float;\",\n \"\t\tprecision mediump sampler3D;\",\n \"\t\tuniform vec3 u_size;\",\n \"\t\tuniform int u_renderstyle;\",\n \"\t\tuniform float u_renderthreshold;\",\n \"\t\tuniform vec2 u_clim;\",\n \"\t\tuniform sampler3D u_data;\",\n \"\t\tuniform sampler2D u_cmdata;\",\n \"\t\tvarying vec3 v_position;\",\n \"\t\tvarying vec4 v_nearpos;\",\n \"\t\tvarying vec4 v_farpos;\",\n // The maximum distance through our rendering volume is sqrt(3).\n \"\t\tconst int MAX_STEPS = 887;\t// 887 for 512^3, 1774 for 1024^3\",\n \"\t\tconst int REFINEMENT_STEPS = 4;\",\n \"\t\tconst float relative_step_size = 1.0;\",\n \"\t\tconst vec4 ambient_color = vec4(0.2, 0.4, 0.2, 1.0);\",\n \"\t\tconst vec4 diffuse_color = vec4(0.8, 0.2, 0.2, 1.0);\",\n \"\t\tconst vec4 specular_color = vec4(1.0, 1.0, 1.0, 1.0);\",\n \"\t\tconst float shininess = 40.0;\",\n \"\t\tvoid cast_mip(vec3 start_loc, vec3 step, int nsteps, vec3 view_ray);\",\n \"\t\tvoid cast_iso(vec3 start_loc, vec3 step, int nsteps, vec3 view_ray);\",\n \"\t\tfloat sample1(vec3 texcoords);\",\n \"\t\tvec4 apply_colormap(float val);\",\n \"\t\tvec4 add_lighting(float val, vec3 loc, vec3 step, vec3 view_ray);\",\n \"\t\tvoid main() {\",\n // Normalize clipping plane info\n \"\t\t\t\tvec3 farpos = v_farpos.xyz / v_farpos.w;\",\n \"\t\t\t\tvec3 nearpos = v_nearpos.xyz / v_nearpos.w;\",\n // Calculate unit vector pointing in the view direction through this fragment.\n \"\t\t\t\tvec3 view_ray = normalize(nearpos.xyz - farpos.xyz);\",\n // Compute the (negative) distance to the front surface or near clipping plane.\n // v_position is the back face of the cuboid, so the initial distance calculated in the dot\n // product below is the distance from near clip plane to the back of the cuboid\n \"\t\t\t\tfloat distance = dot(nearpos - v_position, view_ray);\",\n \"\t\t\t\tdistance = max(distance, min((-0.5 - v_position.x) / view_ray.x,\",\n \"\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(u_size.x - 0.5 - v_position.x) / view_ray.x));\",\n \"\t\t\t\tdistance = max(distance, min((-0.5 - v_position.y) / view_ray.y,\",\n \"\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(u_size.y - 0.5 - v_position.y) / view_ray.y));\",\n \"\t\t\t\tdistance = max(distance, min((-0.5 - v_position.z) / view_ray.z,\",\n \"\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(u_size.z - 0.5 - v_position.z) / view_ray.z));\",\n // Now we have the starting position on the front surface\n \"\t\t\t\tvec3 front = v_position + view_ray * distance;\",\n // Decide how many steps to take\n \"\t\t\t\tint nsteps = int(-distance / relative_step_size + 0.5);\",\n \"\t\t\t\tif ( nsteps < 1 )\",\n \"\t\t\t\t\t\tdiscard;\",\n // Get starting location and step vector in texture coordinates\n \"\t\t\t\tvec3 step = ((v_position - front) / u_size) / float(nsteps);\",\n \"\t\t\t\tvec3 start_loc = front / u_size;\",\n // For testing: show the number of steps. This helps to establish\n // whether the rays are correctly oriented\n //'gl_FragColor = vec4(0.0, float(nsteps) / 1.0 / u_size.x, 1.0, 1.0);',\n //'return;',\n \"\t\t\t\tif (u_renderstyle == 0)\",\n \"\t\t\t\t\t\tcast_mip(start_loc, step, nsteps, view_ray);\",\n \"\t\t\t\telse if (u_renderstyle == 1)\",\n \"\t\t\t\t\t\tcast_iso(start_loc, step, nsteps, view_ray);\",\n \"\t\t\t\tif (gl_FragColor.a < 0.05)\",\n \"\t\t\t\t\t\tdiscard;\",\n \"\t\t}\",\n \"\t\tfloat sample1(vec3 texcoords) {\",\n \"\t\t\t\t/* Sample float value from a 3D texture. Assumes intensity data. */\",\n \"\t\t\t\treturn texture(u_data, texcoords.xyz).r;\",\n \"\t\t}\",\n \"\t\tvec4 apply_colormap(float val) {\",\n \"\t\t\t\tval = (val - u_clim[0]) / (u_clim[1] - u_clim[0]);\",\n \"\t\t\t\treturn texture2D(u_cmdata, vec2(val, 0.5));\",\n \"\t\t}\",\n \"\t\tvoid cast_mip(vec3 start_loc, vec3 step, int nsteps, vec3 view_ray) {\",\n \"\t\t\t\tfloat max_val = -1e6;\",\n \"\t\t\t\tint max_i = 100;\",\n \"\t\t\t\tvec3 loc = start_loc;\",\n // Enter the raycasting loop. In WebGL 1 the loop index cannot be compared with\n // non-constant expression. So we use a hard-coded max, and an additional condition\n // inside the loop.\n \"\t\t\t\tfor (int iter=0; iter= nsteps)\",\n \"\t\t\t\t\t\t\t\tbreak;\",\n // Sample from the 3D texture\n \"\t\t\t\t\t\tfloat val = sample1(loc);\",\n // Apply MIP operation\n \"\t\t\t\t\t\tif (val > max_val) {\",\n \"\t\t\t\t\t\t\t\tmax_val = val;\",\n \"\t\t\t\t\t\t\t\tmax_i = iter;\",\n \"\t\t\t\t\t\t}\",\n // Advance location deeper into the volume\n \"\t\t\t\t\t\tloc += step;\",\n \"\t\t\t\t}\",\n // Refine location, gives crispier images\n \"\t\t\t\tvec3 iloc = start_loc + step * (float(max_i) - 0.5);\",\n \"\t\t\t\tvec3 istep = step / float(REFINEMENT_STEPS);\",\n \"\t\t\t\tfor (int i=0; i= nsteps)\",\n \"\t\t\t\t\t\t\t\tbreak;\",\n // Sample from the 3D texture\n \"\t\t\t\t\t\tfloat val = sample1(loc);\",\n \"\t\t\t\t\t\tif (val > low_threshold) {\",\n // Take the last interval in smaller steps\n \"\t\t\t\t\t\t\t\tvec3 iloc = loc - 0.5 * step;\",\n \"\t\t\t\t\t\t\t\tvec3 istep = step / float(REFINEMENT_STEPS);\",\n \"\t\t\t\t\t\t\t\tfor (int i=0; i u_renderthreshold) {\",\n \"\t\t\t\t\t\t\t\t\t\t\t\tgl_FragColor = add_lighting(val, iloc, dstep, view_ray);\",\n \"\t\t\t\t\t\t\t\t\t\t\t\treturn;\",\n \"\t\t\t\t\t\t\t\t\t\t}\",\n \"\t\t\t\t\t\t\t\t\t\tiloc += istep;\",\n \"\t\t\t\t\t\t\t\t}\",\n \"\t\t\t\t\t\t}\",\n // Advance location deeper into the volume\n \"\t\t\t\t\t\tloc += step;\",\n \"\t\t\t\t}\",\n \"\t\t}\",\n \"\t\tvec4 add_lighting(float val, vec3 loc, vec3 step, vec3 view_ray)\",\n \"\t\t{\",\n // Calculate color by incorporating lighting\n // View direction\n \"\t\t\t\tvec3 V = normalize(view_ray);\",\n // calculate normal vector from gradient\n \"\t\t\t\tvec3 N;\",\n \"\t\t\t\tfloat val1, val2;\",\n \"\t\t\t\tval1 = sample1(loc + vec3(-step[0], 0.0, 0.0));\",\n \"\t\t\t\tval2 = sample1(loc + vec3(+step[0], 0.0, 0.0));\",\n \"\t\t\t\tN[0] = val1 - val2;\",\n \"\t\t\t\tval = max(max(val1, val2), val);\",\n \"\t\t\t\tval1 = sample1(loc + vec3(0.0, -step[1], 0.0));\",\n \"\t\t\t\tval2 = sample1(loc + vec3(0.0, +step[1], 0.0));\",\n \"\t\t\t\tN[1] = val1 - val2;\",\n \"\t\t\t\tval = max(max(val1, val2), val);\",\n \"\t\t\t\tval1 = sample1(loc + vec3(0.0, 0.0, -step[2]));\",\n \"\t\t\t\tval2 = sample1(loc + vec3(0.0, 0.0, +step[2]));\",\n \"\t\t\t\tN[2] = val1 - val2;\",\n \"\t\t\t\tval = max(max(val1, val2), val);\",\n \"\t\t\t\tfloat gm = length(N); // gradient magnitude\",\n \"\t\t\t\tN = normalize(N);\",\n // Flip normal so it points towards viewer\n \"\t\t\t\tfloat Nselect = float(dot(N, V) > 0.0);\",\n \"\t\t\t\tN = (2.0 * Nselect - 1.0) * N;\t// ==\tNselect * N - (1.0-Nselect)*N;\",\n // Init colors\n \"\t\t\t\tvec4 ambient_color = vec4(0.0, 0.0, 0.0, 0.0);\",\n \"\t\t\t\tvec4 diffuse_color = vec4(0.0, 0.0, 0.0, 0.0);\",\n \"\t\t\t\tvec4 specular_color = vec4(0.0, 0.0, 0.0, 0.0);\",\n // note: could allow multiple lights\n \"\t\t\t\tfor (int i=0; i<1; i++)\",\n \"\t\t\t\t{\",\n // Get light direction (make sure to prevent zero devision)\n \"\t\t\t\t\t\tvec3 L = normalize(view_ray);\t//lightDirs[i];\",\n \"\t\t\t\t\t\tfloat lightEnabled = float( length(L) > 0.0 );\",\n \"\t\t\t\t\t\tL = normalize(L + (1.0 - lightEnabled));\",\n // Calculate lighting properties\n \"\t\t\t\t\t\tfloat lambertTerm = clamp(dot(N, L), 0.0, 1.0);\",\n \"\t\t\t\t\t\tvec3 H = normalize(L+V); // Halfway vector\",\n \"\t\t\t\t\t\tfloat specularTerm = pow(max(dot(H, N), 0.0), shininess);\",\n // Calculate mask\n \"\t\t\t\t\t\tfloat mask1 = lightEnabled;\",\n // Calculate colors\n \"\t\t\t\t\t\tambient_color +=\tmask1 * ambient_color;\t// * gl_LightSource[i].ambient;\",\n \"\t\t\t\t\t\tdiffuse_color +=\tmask1 * lambertTerm;\",\n \"\t\t\t\t\t\tspecular_color += mask1 * specularTerm * specular_color;\",\n \"\t\t\t\t}\",\n // Calculate final color by componing different components\n \"\t\t\t\tvec4 final_color;\",\n \"\t\t\t\tvec4 color = apply_colormap(val);\",\n \"\t\t\t\tfinal_color = color * (ambient_color + diffuse_color) + specular_color;\",\n \"\t\t\t\tfinal_color.a = color.a;\",\n \"\t\t\t\treturn final_color;\",\n \"\t\t}\"\n ].join(\"\\n\")\n};\nconst WaterRefractionShader = {\n uniforms: {\n color: {\n value: null\n },\n time: {\n value: 0\n },\n tDiffuse: {\n value: null\n },\n tDudv: {\n value: null\n },\n textureMatrix: {\n value: null\n }\n },\n vertexShader: [\n \"uniform mat4 textureMatrix;\",\n \"varying vec2 vUv;\",\n \"varying vec4 vUvRefraction;\",\n \"void main() {\",\n \"\tvUv = uv;\",\n \"\tvUvRefraction = textureMatrix * vec4( position, 1.0 );\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform vec3 color;\",\n \"uniform float time;\",\n \"uniform sampler2D tDiffuse;\",\n \"uniform sampler2D tDudv;\",\n \"varying vec2 vUv;\",\n \"varying vec4 vUvRefraction;\",\n \"float blendOverlay( float base, float blend ) {\",\n \"\treturn( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );\",\n \"}\",\n \"vec3 blendOverlay( vec3 base, vec3 blend ) {\",\n \"\treturn vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ),blendOverlay( base.b, blend.b ) );\",\n \"}\",\n \"void main() {\",\n \" float waveStrength = 0.1;\",\n \" float waveSpeed = 0.03;\",\n // simple distortion (ripple) via dudv map (see https://www.youtube.com/watch?v=6B7IF6GOu7s)\n \"\tvec2 distortedUv = texture2D( tDudv, vec2( vUv.x + time * waveSpeed, vUv.y ) ).rg * waveStrength;\",\n \"\tdistortedUv = vUv.xy + vec2( distortedUv.x, distortedUv.y + time * waveSpeed );\",\n \"\tvec2 distortion = ( texture2D( tDudv, distortedUv ).rg * 2.0 - 1.0 ) * waveStrength;\",\n // new uv coords\n \" vec4 uv = vec4( vUvRefraction );\",\n \" uv.xy += distortion;\",\n \"\tvec4 base = texture2DProj( tDiffuse, uv );\",\n \"\tgl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );\",\n \"}\"\n ].join(\"\\n\")\n};\nclass HTMLMesh extends three__WEBPACK_IMPORTED_MODULE_42__.Mesh {\n constructor(dom) {\n const texture = new HTMLTexture(dom);\n const geometry2 = new three__WEBPACK_IMPORTED_MODULE_42__.PlaneGeometry(texture.image.width * 1e-3, texture.image.height * 1e-3);\n const material2 = new three__WEBPACK_IMPORTED_MODULE_42__.MeshBasicMaterial({ map: texture, toneMapped: false, transparent: true });\n super(geometry2, material2);\n function onEvent(event) {\n material2.map.dispatchDOMEvent(event);\n }\n this.addEventListener(\"mousedown\", onEvent);\n this.addEventListener(\"mousemove\", onEvent);\n this.addEventListener(\"mouseup\", onEvent);\n this.addEventListener(\"click\", onEvent);\n this.dispose = function() {\n geometry2.dispose();\n material2.dispose();\n material2.map.dispose();\n canvases.delete(dom);\n this.removeEventListener(\"mousedown\", onEvent);\n this.removeEventListener(\"mousemove\", onEvent);\n this.removeEventListener(\"mouseup\", onEvent);\n this.removeEventListener(\"click\", onEvent);\n };\n }\n}\nclass HTMLTexture extends three__WEBPACK_IMPORTED_MODULE_42__.CanvasTexture {\n constructor(dom) {\n super(html2canvas(dom));\n this.dom = dom;\n this.anisotropy = 16;\n if (\"colorSpace\" in this)\n this.colorSpace = \"srgb\";\n else\n this.encoding = 3001;\n this.minFilter = three__WEBPACK_IMPORTED_MODULE_42__.LinearFilter;\n this.magFilter = three__WEBPACK_IMPORTED_MODULE_42__.LinearFilter;\n const observer = new MutationObserver(() => {\n if (!this.scheduleUpdate) {\n this.scheduleUpdate = setTimeout(() => this.update(), 16);\n }\n });\n const config = { attributes: true, childList: true, subtree: true, characterData: true };\n observer.observe(dom, config);\n this.observer = observer;\n }\n dispatchDOMEvent(event) {\n if (event.data) {\n htmlevent(this.dom, event.type, event.data.x, event.data.y);\n }\n }\n update() {\n this.image = html2canvas(this.dom);\n this.needsUpdate = true;\n this.scheduleUpdate = null;\n }\n dispose() {\n if (this.observer) {\n this.observer.disconnect();\n }\n this.scheduleUpdate = clearTimeout(this.scheduleUpdate);\n super.dispose();\n }\n}\nconst canvases = /* @__PURE__ */ new WeakMap();\nfunction html2canvas(element) {\n const range = document.createRange();\n const color = new three__WEBPACK_IMPORTED_MODULE_42__.Color();\n function Clipper(context2) {\n const clips = [];\n let isClipping = false;\n function doClip() {\n if (isClipping) {\n isClipping = false;\n context2.restore();\n }\n if (clips.length === 0)\n return;\n let minX = -Infinity, minY = -Infinity;\n let maxX = Infinity, maxY = Infinity;\n for (let i2 = 0; i2 < clips.length; i2++) {\n const clip = clips[i2];\n minX = Math.max(minX, clip.x);\n minY = Math.max(minY, clip.y);\n maxX = Math.min(maxX, clip.x + clip.width);\n maxY = Math.min(maxY, clip.y + clip.height);\n }\n context2.save();\n context2.beginPath();\n context2.rect(minX, minY, maxX - minX, maxY - minY);\n context2.clip();\n isClipping = true;\n }\n return {\n add: function(clip) {\n clips.push(clip);\n doClip();\n },\n remove: function() {\n clips.pop();\n doClip();\n }\n };\n }\n function drawText(style, x, y, string) {\n if (string !== \"\") {\n if (style.textTransform === \"uppercase\") {\n string = string.toUpperCase();\n }\n context.font = style.fontWeight + \" \" + style.fontSize + \" \" + style.fontFamily;\n context.textBaseline = \"top\";\n context.fillStyle = style.color;\n context.fillText(string, x, y + parseFloat(style.fontSize) * 0.1);\n }\n }\n function buildRectPath(x, y, w, h, r) {\n if (w < 2 * r)\n r = w / 2;\n if (h < 2 * r)\n r = h / 2;\n context.beginPath();\n context.moveTo(x + r, y);\n context.arcTo(x + w, y, x + w, y + h, r);\n context.arcTo(x + w, y + h, x, y + h, r);\n context.arcTo(x, y + h, x, y, r);\n context.arcTo(x, y, x + w, y, r);\n context.closePath();\n }\n function drawBorder(style, which, x, y, width, height) {\n const borderWidth = style[which + \"Width\"];\n const borderStyle = style[which + \"Style\"];\n const borderColor = style[which + \"Color\"];\n if (borderWidth !== \"0px\" && borderStyle !== \"none\" && borderColor !== \"transparent\" && borderColor !== \"rgba(0, 0, 0, 0)\") {\n context.strokeStyle = borderColor;\n context.lineWidth = parseFloat(borderWidth);\n context.beginPath();\n context.moveTo(x, y);\n context.lineTo(x + width, y + height);\n context.stroke();\n }\n }\n function drawElement(element2, style) {\n let x = 0, y = 0, width = 0, height = 0;\n if (element2.nodeType === Node.TEXT_NODE) {\n range.selectNode(element2);\n const rect = range.getBoundingClientRect();\n x = rect.left - offset.left - 0.5;\n y = rect.top - offset.top - 0.5;\n width = rect.width;\n height = rect.height;\n drawText(style, x, y, element2.nodeValue.trim());\n } else if (element2.nodeType === Node.COMMENT_NODE) {\n return;\n } else if (element2 instanceof HTMLCanvasElement) {\n if (element2.style.display === \"none\")\n return;\n context.save();\n const dpr = window.devicePixelRatio;\n context.scale(1 / dpr, 1 / dpr);\n context.drawImage(element2, 0, 0);\n context.restore();\n } else {\n if (element2.style.display === \"none\")\n return;\n const rect = element2.getBoundingClientRect();\n x = rect.left - offset.left - 0.5;\n y = rect.top - offset.top - 0.5;\n width = rect.width;\n height = rect.height;\n style = window.getComputedStyle(element2);\n buildRectPath(x, y, width, height, parseFloat(style.borderRadius));\n const backgroundColor = style.backgroundColor;\n if (backgroundColor !== \"transparent\" && backgroundColor !== \"rgba(0, 0, 0, 0)\") {\n context.fillStyle = backgroundColor;\n context.fill();\n }\n const borders = [\"borderTop\", \"borderLeft\", \"borderBottom\", \"borderRight\"];\n let match = true;\n let prevBorder = null;\n for (const border of borders) {\n if (prevBorder !== null) {\n match = style[border + \"Width\"] === style[prevBorder + \"Width\"] && style[border + \"Color\"] === style[prevBorder + \"Color\"] && style[border + \"Style\"] === style[prevBorder + \"Style\"];\n }\n if (match === false)\n break;\n prevBorder = border;\n }\n if (match === true) {\n const width2 = parseFloat(style.borderTopWidth);\n if (style.borderTopWidth !== \"0px\" && style.borderTopStyle !== \"none\" && style.borderTopColor !== \"transparent\" && style.borderTopColor !== \"rgba(0, 0, 0, 0)\") {\n context.strokeStyle = style.borderTopColor;\n context.lineWidth = width2;\n context.stroke();\n }\n } else {\n drawBorder(style, \"borderTop\", x, y, width, 0);\n drawBorder(style, \"borderLeft\", x, y, 0, height);\n drawBorder(style, \"borderBottom\", x, y + height, width, 0);\n drawBorder(style, \"borderRight\", x + width, y, 0, height);\n }\n if (element2 instanceof HTMLInputElement) {\n let accentColor = style.accentColor;\n if (accentColor === void 0 || accentColor === \"auto\")\n accentColor = style.color;\n color.set(accentColor);\n const luminance = Math.sqrt(0.299 * color.r ** 2 + 0.587 * color.g ** 2 + 0.114 * color.b ** 2);\n const accentTextColor = luminance < 0.5 ? \"white\" : \"#111111\";\n if (element2.type === \"radio\") {\n buildRectPath(x, y, width, height, height);\n context.fillStyle = \"white\";\n context.strokeStyle = accentColor;\n context.lineWidth = 1;\n context.fill();\n context.stroke();\n if (element2.checked) {\n buildRectPath(x + 2, y + 2, width - 4, height - 4, height);\n context.fillStyle = accentColor;\n context.strokeStyle = accentTextColor;\n context.lineWidth = 2;\n context.fill();\n context.stroke();\n }\n }\n if (element2.type === \"checkbox\") {\n buildRectPath(x, y, width, height, 2);\n context.fillStyle = element2.checked ? accentColor : \"white\";\n context.strokeStyle = element2.checked ? accentTextColor : accentColor;\n context.lineWidth = 1;\n context.stroke();\n context.fill();\n if (element2.checked) {\n const currentTextAlign = context.textAlign;\n context.textAlign = \"center\";\n const properties = {\n color: accentTextColor,\n fontFamily: style.fontFamily,\n fontSize: height + \"px\",\n fontWeight: \"bold\"\n };\n drawText(properties, x + width / 2, y, \"✔\");\n context.textAlign = currentTextAlign;\n }\n }\n if (element2.type === \"range\") {\n const [min, max, value] = [\"min\", \"max\", \"value\"].map((property) => parseFloat(element2[property]));\n const position = (value - min) / (max - min) * (width - height);\n buildRectPath(x, y + height / 4, width, height / 2, height / 4);\n context.fillStyle = accentTextColor;\n context.strokeStyle = accentColor;\n context.lineWidth = 1;\n context.fill();\n context.stroke();\n buildRectPath(x, y + height / 4, position + height / 2, height / 2, height / 4);\n context.fillStyle = accentColor;\n context.fill();\n buildRectPath(x + position, y, height, height, height / 2);\n context.fillStyle = accentColor;\n context.fill();\n }\n if (element2.type === \"color\" || element2.type === \"text\" || element2.type === \"number\") {\n clipper.add({ x, y, width, height });\n drawText(style, x + parseInt(style.paddingLeft), y + parseInt(style.paddingTop), element2.value);\n clipper.remove();\n }\n }\n }\n const isClipping = style.overflow === \"auto\" || style.overflow === \"hidden\";\n if (isClipping)\n clipper.add({ x, y, width, height });\n for (let i2 = 0; i2 < element2.childNodes.length; i2++) {\n drawElement(element2.childNodes[i2], style);\n }\n if (isClipping)\n clipper.remove();\n }\n const offset = element.getBoundingClientRect();\n let canvas = canvases.get(element);\n if (canvas === void 0) {\n canvas = document.createElement(\"canvas\");\n canvas.width = offset.width;\n canvas.height = offset.height;\n canvases.set(element, canvas);\n }\n const context = canvas.getContext(\n \"2d\"\n /*, { alpha: false }*/\n );\n const clipper = new Clipper(context);\n drawElement(element);\n return canvas;\n}\nfunction htmlevent(element, event, x, y) {\n const mouseEventInit = {\n clientX: x * element.offsetWidth + element.offsetLeft,\n clientY: y * element.offsetHeight + element.offsetTop,\n view: element.ownerDocument.defaultView\n };\n window.dispatchEvent(new MouseEvent(event, mouseEventInit));\n const rect = element.getBoundingClientRect();\n x = x * rect.width + rect.left;\n y = y * rect.height + rect.top;\n function traverse(element2) {\n if (element2.nodeType !== Node.TEXT_NODE && element2.nodeType !== Node.COMMENT_NODE) {\n const rect2 = element2.getBoundingClientRect();\n if (x > rect2.left && x < rect2.right && y > rect2.top && y < rect2.bottom) {\n element2.dispatchEvent(new MouseEvent(event, mouseEventInit));\n if (element2 instanceof HTMLInputElement && element2.type === \"range\" && (event === \"mousedown\" || event === \"click\")) {\n const [min, max] = [\"min\", \"max\"].map((property) => parseFloat(element2[property]));\n const width = rect2.width;\n const offsetX = x - rect2.x;\n const proportion = offsetX / width;\n element2.value = min + (max - min) * proportion;\n element2.dispatchEvent(new InputEvent(\"input\", { bubbles: true }));\n }\n }\n for (let i2 = 0; i2 < element2.childNodes.length; i2++) {\n traverse(element2.childNodes[i2]);\n }\n }\n }\n traverse(element);\n}\nconst _pointer = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector2();\nconst _event = { type: \"\", data: _pointer };\nclass InteractiveGroup extends three__WEBPACK_IMPORTED_MODULE_42__.Group {\n constructor(renderer, camera) {\n super();\n const scope = this;\n const raycaster = new three__WEBPACK_IMPORTED_MODULE_42__.Raycaster();\n const tempMatrix = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n const element = renderer.domElement;\n function onPointerEvent(event) {\n event.stopPropagation();\n _pointer.x = event.clientX / element.clientWidth * 2 - 1;\n _pointer.y = -(event.clientY / element.clientHeight) * 2 + 1;\n raycaster.setFromCamera(_pointer, camera);\n const intersects = raycaster.intersectObjects(scope.children, false);\n if (intersects.length > 0) {\n const intersection = intersects[0];\n const object = intersection.object;\n const uv = intersection.uv;\n _event.type = event.type;\n _event.data.set(uv.x, 1 - uv.y);\n object.dispatchEvent(_event);\n }\n }\n element.addEventListener(\"pointerdown\", onPointerEvent);\n element.addEventListener(\"pointerup\", onPointerEvent);\n element.addEventListener(\"pointermove\", onPointerEvent);\n element.addEventListener(\"mousedown\", onPointerEvent);\n element.addEventListener(\"mouseup\", onPointerEvent);\n element.addEventListener(\"mousemove\", onPointerEvent);\n element.addEventListener(\"click\", onPointerEvent);\n const events = {\n move: \"mousemove\",\n select: \"click\",\n selectstart: \"mousedown\",\n selectend: \"mouseup\"\n };\n function onXRControllerEvent(event) {\n const controller = event.target;\n tempMatrix.identity().extractRotation(controller.matrixWorld);\n raycaster.ray.origin.setFromMatrixPosition(controller.matrixWorld);\n raycaster.ray.direction.set(0, 0, -1).applyMatrix4(tempMatrix);\n const intersections = raycaster.intersectObjects(scope.children, false);\n if (intersections.length > 0) {\n const intersection = intersections[0];\n const object = intersection.object;\n const uv = intersection.uv;\n _event.type = events[event.type];\n _event.data.set(uv.x, 1 - uv.y);\n object.dispatchEvent(_event);\n }\n }\n const controller1 = renderer.xr.getController(0);\n controller1.addEventListener(\"move\", onXRControllerEvent);\n controller1.addEventListener(\"select\", onXRControllerEvent);\n controller1.addEventListener(\"selectstart\", onXRControllerEvent);\n controller1.addEventListener(\"selectend\", onXRControllerEvent);\n const controller2 = renderer.xr.getController(1);\n controller2.addEventListener(\"move\", onXRControllerEvent);\n controller2.addEventListener(\"select\", onXRControllerEvent);\n controller2.addEventListener(\"selectstart\", onXRControllerEvent);\n controller2.addEventListener(\"selectend\", onXRControllerEvent);\n }\n}\nclass SelectionHelper {\n constructor(selectionBox, renderer, cssClassName) {\n this.element = document.createElement(\"div\");\n this.element.classList.add(cssClassName);\n this.element.style.pointerEvents = \"none\";\n this.renderer = renderer;\n this.startPoint = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2();\n this.pointTopLeft = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2();\n this.pointBottomRight = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2();\n this.isDown = false;\n this.renderer.domElement.addEventListener(\"pointerdown\", (event) => {\n this.isDown = true;\n this.onSelectStart(event);\n });\n this.renderer.domElement.addEventListener(\"pointermove\", (event) => {\n if (this.isDown) {\n this.onSelectMove(event);\n }\n });\n this.renderer.domElement.addEventListener(\"pointerup\", (event) => {\n this.isDown = false;\n this.onSelectOver(event);\n });\n }\n onSelectStart(event) {\n this.renderer.domElement.parentElement.appendChild(this.element);\n this.element.style.left = `${event.clientX}px`;\n this.element.style.top = `${event.clientY}px`;\n this.element.style.width = \"0px\";\n this.element.style.height = \"0px\";\n this.startPoint.x = event.clientX;\n this.startPoint.y = event.clientY;\n }\n onSelectMove(event) {\n this.pointBottomRight.x = Math.max(this.startPoint.x, event.clientX);\n this.pointBottomRight.y = Math.max(this.startPoint.y, event.clientY);\n this.pointTopLeft.x = Math.min(this.startPoint.x, event.clientX);\n this.pointTopLeft.y = Math.min(this.startPoint.y, event.clientY);\n this.element.style.left = `${this.pointTopLeft.x}px`;\n this.element.style.top = `${this.pointTopLeft.y}px`;\n this.element.style.width = `${this.pointBottomRight.x - this.pointTopLeft.x}px`;\n this.element.style.height = `${this.pointBottomRight.y - this.pointTopLeft.y}px`;\n }\n onSelectOver() {\n this.element.parentElement.removeChild(this.element);\n }\n}\nconst frustum = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Frustum();\nconst center = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst tmpPoint = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst vecNear = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst vecTopLeft = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst vecTopRight = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst vecDownRight = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst vecDownLeft = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst vecFarTopLeft = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst vecFarTopRight = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst vecFarDownRight = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst vecFarDownLeft = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst vectemp1 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst vectemp2 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nconst vectemp3 = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nclass SelectionBox {\n constructor(camera, scene, deep) {\n this.camera = camera;\n this.scene = scene;\n this.startPoint = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this.endPoint = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n this.collection = [];\n this.deep = deep || Number.MAX_VALUE;\n }\n select(startPoint, endPoint) {\n this.startPoint = startPoint || this.startPoint;\n this.endPoint = endPoint || this.endPoint;\n this.collection = [];\n this.updateFrustum(this.startPoint, this.endPoint);\n this.searchChildInFrustum(frustum, this.scene);\n return this.collection;\n }\n updateFrustum(startPoint, endPoint) {\n startPoint = startPoint || this.startPoint;\n endPoint = endPoint || this.endPoint;\n if (startPoint.x === endPoint.x) {\n endPoint.x += Number.EPSILON;\n }\n if (startPoint.y === endPoint.y) {\n endPoint.y += Number.EPSILON;\n }\n this.camera.updateProjectionMatrix();\n this.camera.updateMatrixWorld();\n if (this.camera.isPerspectiveCamera) {\n tmpPoint.copy(startPoint);\n tmpPoint.x = Math.min(startPoint.x, endPoint.x);\n tmpPoint.y = Math.max(startPoint.y, endPoint.y);\n endPoint.x = Math.max(startPoint.x, endPoint.x);\n endPoint.y = Math.min(startPoint.y, endPoint.y);\n vecNear.setFromMatrixPosition(this.camera.matrixWorld);\n vecTopLeft.copy(tmpPoint);\n vecTopRight.set(endPoint.x, tmpPoint.y, 0);\n vecDownRight.copy(endPoint);\n vecDownLeft.set(tmpPoint.x, endPoint.y, 0);\n vecTopLeft.unproject(this.camera);\n vecTopRight.unproject(this.camera);\n vecDownRight.unproject(this.camera);\n vecDownLeft.unproject(this.camera);\n vectemp1.copy(vecTopLeft).sub(vecNear);\n vectemp2.copy(vecTopRight).sub(vecNear);\n vectemp3.copy(vecDownRight).sub(vecNear);\n vectemp1.normalize();\n vectemp2.normalize();\n vectemp3.normalize();\n vectemp1.multiplyScalar(this.deep);\n vectemp2.multiplyScalar(this.deep);\n vectemp3.multiplyScalar(this.deep);\n vectemp1.add(vecNear);\n vectemp2.add(vecNear);\n vectemp3.add(vecNear);\n var planes = frustum.planes;\n planes[0].setFromCoplanarPoints(vecNear, vecTopLeft, vecTopRight);\n planes[1].setFromCoplanarPoints(vecNear, vecTopRight, vecDownRight);\n planes[2].setFromCoplanarPoints(vecDownRight, vecDownLeft, vecNear);\n planes[3].setFromCoplanarPoints(vecDownLeft, vecTopLeft, vecNear);\n planes[4].setFromCoplanarPoints(vecTopRight, vecDownRight, vecDownLeft);\n planes[5].setFromCoplanarPoints(vectemp3, vectemp2, vectemp1);\n planes[5].normal.multiplyScalar(-1);\n } else if (this.camera.isOrthographicCamera) {\n const left = Math.min(startPoint.x, endPoint.x);\n const top = Math.max(startPoint.y, endPoint.y);\n const right = Math.max(startPoint.x, endPoint.x);\n const down = Math.min(startPoint.y, endPoint.y);\n vecTopLeft.set(left, top, -1);\n vecTopRight.set(right, top, -1);\n vecDownRight.set(right, down, -1);\n vecDownLeft.set(left, down, -1);\n vecFarTopLeft.set(left, top, 1);\n vecFarTopRight.set(right, top, 1);\n vecFarDownRight.set(right, down, 1);\n vecFarDownLeft.set(left, down, 1);\n vecTopLeft.unproject(this.camera);\n vecTopRight.unproject(this.camera);\n vecDownRight.unproject(this.camera);\n vecDownLeft.unproject(this.camera);\n vecFarTopLeft.unproject(this.camera);\n vecFarTopRight.unproject(this.camera);\n vecFarDownRight.unproject(this.camera);\n vecFarDownLeft.unproject(this.camera);\n var planes = frustum.planes;\n planes[0].setFromCoplanarPoints(vecTopLeft, vecFarTopLeft, vecFarTopRight);\n planes[1].setFromCoplanarPoints(vecTopRight, vecFarTopRight, vecFarDownRight);\n planes[2].setFromCoplanarPoints(vecFarDownRight, vecFarDownLeft, vecDownLeft);\n planes[3].setFromCoplanarPoints(vecFarDownLeft, vecFarTopLeft, vecTopLeft);\n planes[4].setFromCoplanarPoints(vecTopRight, vecDownRight, vecDownLeft);\n planes[5].setFromCoplanarPoints(vecFarDownRight, vecFarTopRight, vecFarTopLeft);\n planes[5].normal.multiplyScalar(-1);\n } else {\n console.error(\"THREE.SelectionBox: Unsupported camera type.\");\n }\n }\n searchChildInFrustum(frustum2, object) {\n if (object.isMesh || object.isLine || object.isPoints) {\n if (object.material !== void 0) {\n if (object.geometry.boundingSphere === null)\n object.geometry.computeBoundingSphere();\n center.copy(object.geometry.boundingSphere.center);\n center.applyMatrix4(object.matrixWorld);\n if (frustum2.containsPoint(center)) {\n this.collection.push(object);\n }\n }\n }\n if (object.children.length > 0) {\n for (let x = 0; x < object.children.length; x++) {\n this.searchChildInFrustum(frustum2, object.children[x]);\n }\n }\n }\n}\nasync function AmmoPhysics() {\n if (\"Ammo\" in window === false) {\n console.error(\"AmmoPhysics: Couldn't find Ammo.js\");\n return;\n }\n const AmmoLib = await Ammo();\n const frameRate = 60;\n const collisionConfiguration = new AmmoLib.btDefaultCollisionConfiguration();\n const dispatcher = new AmmoLib.btCollisionDispatcher(collisionConfiguration);\n const broadphase = new AmmoLib.btDbvtBroadphase();\n const solver = new AmmoLib.btSequentialImpulseConstraintSolver();\n const world2 = new AmmoLib.btDiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration);\n world2.setGravity(new AmmoLib.btVector3(0, -9.8, 0));\n const worldTransform = new AmmoLib.btTransform();\n function getShape(geometry2) {\n const parameters = geometry2.parameters;\n if (geometry2.type === \"BoxGeometry\") {\n const sx = parameters.width !== void 0 ? parameters.width / 2 : 0.5;\n const sy = parameters.height !== void 0 ? parameters.height / 2 : 0.5;\n const sz = parameters.depth !== void 0 ? parameters.depth / 2 : 0.5;\n const shape = new AmmoLib.btBoxShape(new AmmoLib.btVector3(sx, sy, sz));\n shape.setMargin(0.05);\n return shape;\n } else if (geometry2.type === \"SphereGeometry\" || geometry2.type === \"IcosahedronGeometry\") {\n const radius = parameters.radius !== void 0 ? parameters.radius : 1;\n const shape = new AmmoLib.btSphereShape(radius);\n shape.setMargin(0.05);\n return shape;\n }\n return null;\n }\n const meshes = [];\n const meshMap = /* @__PURE__ */ new WeakMap();\n function addMesh(mesh, mass = 0) {\n const shape = getShape(mesh.geometry);\n if (shape !== null) {\n if (mesh.isInstancedMesh) {\n handleInstancedMesh(mesh, mass, shape);\n } else if (mesh.isMesh) {\n handleMesh(mesh, mass, shape);\n }\n }\n }\n function handleMesh(mesh, mass, shape) {\n const position = mesh.position;\n const quaternion = mesh.quaternion;\n const transform = new AmmoLib.btTransform();\n transform.setIdentity();\n transform.setOrigin(new AmmoLib.btVector3(position.x, position.y, position.z));\n transform.setRotation(new AmmoLib.btQuaternion(quaternion.x, quaternion.y, quaternion.z, quaternion.w));\n const motionState = new AmmoLib.btDefaultMotionState(transform);\n const localInertia = new AmmoLib.btVector3(0, 0, 0);\n shape.calculateLocalInertia(mass, localInertia);\n const rbInfo = new AmmoLib.btRigidBodyConstructionInfo(mass, motionState, shape, localInertia);\n const body = new AmmoLib.btRigidBody(rbInfo);\n world2.addRigidBody(body);\n if (mass > 0) {\n meshes.push(mesh);\n meshMap.set(mesh, body);\n }\n }\n function handleInstancedMesh(mesh, mass, shape) {\n const array = mesh.instanceMatrix.array;\n const bodies = [];\n for (let i2 = 0; i2 < mesh.count; i2++) {\n const index = i2 * 16;\n const transform = new AmmoLib.btTransform();\n transform.setFromOpenGLMatrix(array.slice(index, index + 16));\n const motionState = new AmmoLib.btDefaultMotionState(transform);\n const localInertia = new AmmoLib.btVector3(0, 0, 0);\n shape.calculateLocalInertia(mass, localInertia);\n const rbInfo = new AmmoLib.btRigidBodyConstructionInfo(mass, motionState, shape, localInertia);\n const body = new AmmoLib.btRigidBody(rbInfo);\n world2.addRigidBody(body);\n bodies.push(body);\n }\n if (mass > 0) {\n mesh.instanceMatrix.setUsage(35048);\n meshes.push(mesh);\n meshMap.set(mesh, bodies);\n }\n }\n function setMeshPosition(mesh, position, index = 0) {\n if (mesh.isInstancedMesh) {\n const bodies = meshMap.get(mesh);\n const body = bodies[index];\n body.setAngularVelocity(new AmmoLib.btVector3(0, 0, 0));\n body.setLinearVelocity(new AmmoLib.btVector3(0, 0, 0));\n worldTransform.setIdentity();\n worldTransform.setOrigin(new AmmoLib.btVector3(position.x, position.y, position.z));\n body.setWorldTransform(worldTransform);\n } else if (mesh.isMesh) {\n const body = meshMap.get(mesh);\n body.setAngularVelocity(new AmmoLib.btVector3(0, 0, 0));\n body.setLinearVelocity(new AmmoLib.btVector3(0, 0, 0));\n worldTransform.setIdentity();\n worldTransform.setOrigin(new AmmoLib.btVector3(position.x, position.y, position.z));\n body.setWorldTransform(worldTransform);\n }\n }\n let lastTime = 0;\n function step() {\n const time = performance.now();\n if (lastTime > 0) {\n const delta = (time - lastTime) / 1e3;\n world2.stepSimulation(delta, 10);\n }\n lastTime = time;\n for (let i2 = 0, l = meshes.length; i2 < l; i2++) {\n const mesh = meshes[i2];\n if (mesh.isInstancedMesh) {\n const array = mesh.instanceMatrix.array;\n const bodies = meshMap.get(mesh);\n for (let j = 0; j < bodies.length; j++) {\n const body = bodies[j];\n const motionState = body.getMotionState();\n motionState.getWorldTransform(worldTransform);\n const position = worldTransform.getOrigin();\n const quaternion = worldTransform.getRotation();\n compose(position, quaternion, array, j * 16);\n }\n mesh.instanceMatrix.needsUpdate = true;\n } else if (mesh.isMesh) {\n const body = meshMap.get(mesh);\n const motionState = body.getMotionState();\n motionState.getWorldTransform(worldTransform);\n const position = worldTransform.getOrigin();\n const quaternion = worldTransform.getRotation();\n mesh.position.set(position.x(), position.y(), position.z());\n mesh.quaternion.set(quaternion.x(), quaternion.y(), quaternion.z(), quaternion.w());\n }\n }\n }\n setInterval(step, 1e3 / frameRate);\n return {\n addMesh,\n setMeshPosition\n // addCompoundMesh\n };\n}\nfunction compose(position, quaternion, array, index) {\n const x = quaternion.x(), y = quaternion.y(), z = quaternion.z(), w = quaternion.w();\n const x2 = x + x, y2 = y + y, z2 = z + z;\n const xx = x * x2, xy = x * y2, xz = x * z2;\n const yy = y * y2, yz = y * z2, zz = z * z2;\n const wx = w * x2, wy = w * y2, wz = w * z2;\n array[index + 0] = 1 - (yy + zz);\n array[index + 1] = xy + wz;\n array[index + 2] = xz - wy;\n array[index + 3] = 0;\n array[index + 4] = xy - wz;\n array[index + 5] = 1 - (xx + zz);\n array[index + 6] = yz + wx;\n array[index + 7] = 0;\n array[index + 8] = xz + wy;\n array[index + 9] = yz - wx;\n array[index + 10] = 1 - (xx + yy);\n array[index + 11] = 0;\n array[index + 12] = position.x();\n array[index + 13] = position.y();\n array[index + 14] = position.z();\n array[index + 15] = 1;\n}\nclass ParallaxBarrierEffect {\n constructor(renderer) {\n const _camera = new three__WEBPACK_IMPORTED_MODULE_42__.OrthographicCamera(-1, 1, 1, -1, 0, 1);\n const _scene = new three__WEBPACK_IMPORTED_MODULE_42__.Scene();\n const _stereo = new three__WEBPACK_IMPORTED_MODULE_42__.StereoCamera();\n const _params = { minFilter: three__WEBPACK_IMPORTED_MODULE_42__.LinearFilter, magFilter: three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter, format: three__WEBPACK_IMPORTED_MODULE_42__.RGBAFormat };\n const _renderTargetL = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(512, 512, _params);\n const _renderTargetR = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(512, 512, _params);\n const _material = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: {\n mapLeft: { value: _renderTargetL.texture },\n mapRight: { value: _renderTargetR.texture }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = vec2( uv.x, uv.y );\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform sampler2D mapLeft;\",\n \"uniform sampler2D mapRight;\",\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvec2 uv = vUv;\",\n \"\tif ( ( mod( gl_FragCoord.y, 2.0 ) ) > 1.00 ) {\",\n \"\t\tgl_FragColor = texture2D( mapLeft, uv );\",\n \"\t} else {\",\n \"\t\tgl_FragColor = texture2D( mapRight, uv );\",\n \"\t}\",\n \"\t#include \",\n `\t#include <${parseInt(three__WEBPACK_IMPORTED_MODULE_42__.REVISION.replace(/\\D+/g, \"\")) >= 154 ? \"colorspace_fragment\" : \"encodings_fragment\"}>`,\n \"}\"\n ].join(\"\\n\")\n });\n const mesh = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.PlaneGeometry(2, 2), _material);\n _scene.add(mesh);\n this.setSize = function(width, height) {\n renderer.setSize(width, height);\n const pixelRatio = renderer.getPixelRatio();\n _renderTargetL.setSize(width * pixelRatio, height * pixelRatio);\n _renderTargetR.setSize(width * pixelRatio, height * pixelRatio);\n };\n this.render = function(scene, camera) {\n if (scene.matrixWorldAutoUpdate === true)\n scene.updateMatrixWorld();\n if (camera.parent === null && camera.matrixWorldAutoUpdate === true)\n camera.updateMatrixWorld();\n _stereo.update(camera);\n renderer.setRenderTarget(_renderTargetL);\n renderer.clear();\n renderer.render(scene, _stereo.cameraL);\n renderer.setRenderTarget(_renderTargetR);\n renderer.clear();\n renderer.render(scene, _stereo.cameraR);\n renderer.setRenderTarget(null);\n renderer.render(_scene, _camera);\n };\n }\n}\nclass PeppersGhostEffect {\n constructor(renderer) {\n const scope = this;\n scope.cameraDistance = 15;\n scope.reflectFromAbove = false;\n let _halfWidth, _width, _height;\n const _cameraF = new three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera();\n const _cameraB = new three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera();\n const _cameraL = new three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera();\n const _cameraR = new three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera();\n const _position2 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const _quaternion2 = new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion();\n const _scale2 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n renderer.autoClear = false;\n this.setSize = function(width, height) {\n _halfWidth = width / 2;\n if (width < height) {\n _width = width / 3;\n _height = width / 3;\n } else {\n _width = height / 3;\n _height = height / 3;\n }\n renderer.setSize(width, height);\n };\n this.render = function(scene, camera) {\n if (scene.matrixWorldAutoUpdate === true)\n scene.updateMatrixWorld();\n if (camera.parent === null && camera.matrixWorldAutoUpdate === true)\n camera.updateMatrixWorld();\n camera.matrixWorld.decompose(_position2, _quaternion2, _scale2);\n _cameraF.position.copy(_position2);\n _cameraF.quaternion.copy(_quaternion2);\n _cameraF.translateZ(scope.cameraDistance);\n _cameraF.lookAt(scene.position);\n _cameraB.position.copy(_position2);\n _cameraB.quaternion.copy(_quaternion2);\n _cameraB.translateZ(-scope.cameraDistance);\n _cameraB.lookAt(scene.position);\n _cameraB.rotation.z += 180 * (Math.PI / 180);\n _cameraL.position.copy(_position2);\n _cameraL.quaternion.copy(_quaternion2);\n _cameraL.translateX(-scope.cameraDistance);\n _cameraL.lookAt(scene.position);\n _cameraL.rotation.x += 90 * (Math.PI / 180);\n _cameraR.position.copy(_position2);\n _cameraR.quaternion.copy(_quaternion2);\n _cameraR.translateX(scope.cameraDistance);\n _cameraR.lookAt(scene.position);\n _cameraR.rotation.x += 90 * (Math.PI / 180);\n renderer.clear();\n renderer.setScissorTest(true);\n renderer.setScissor(_halfWidth - _width / 2, _height * 2, _width, _height);\n renderer.setViewport(_halfWidth - _width / 2, _height * 2, _width, _height);\n if (scope.reflectFromAbove) {\n renderer.render(scene, _cameraB);\n } else {\n renderer.render(scene, _cameraF);\n }\n renderer.setScissor(_halfWidth - _width / 2, 0, _width, _height);\n renderer.setViewport(_halfWidth - _width / 2, 0, _width, _height);\n if (scope.reflectFromAbove) {\n renderer.render(scene, _cameraF);\n } else {\n renderer.render(scene, _cameraB);\n }\n renderer.setScissor(_halfWidth - _width / 2 - _width, _height, _width, _height);\n renderer.setViewport(_halfWidth - _width / 2 - _width, _height, _width, _height);\n if (scope.reflectFromAbove) {\n renderer.render(scene, _cameraR);\n } else {\n renderer.render(scene, _cameraL);\n }\n renderer.setScissor(_halfWidth + _width / 2, _height, _width, _height);\n renderer.setViewport(_halfWidth + _width / 2, _height, _width, _height);\n if (scope.reflectFromAbove) {\n renderer.render(scene, _cameraL);\n } else {\n renderer.render(scene, _cameraR);\n }\n renderer.setScissorTest(false);\n };\n }\n}\nclass OutlineEffect {\n constructor(renderer, parameters = {}) {\n this.enabled = true;\n const defaultThickness = parameters.defaultThickness !== void 0 ? parameters.defaultThickness : 3e-3;\n const defaultColor = new three__WEBPACK_IMPORTED_MODULE_42__.Color().fromArray(\n parameters.defaultColor !== void 0 ? parameters.defaultColor : [0, 0, 0]\n );\n const defaultAlpha = parameters.defaultAlpha !== void 0 ? parameters.defaultAlpha : 1;\n const defaultKeepAlive = parameters.defaultKeepAlive !== void 0 ? parameters.defaultKeepAlive : false;\n const cache = {};\n const removeThresholdCount = 60;\n const originalMaterials = {};\n const originalOnBeforeRenders = {};\n const uniformsOutline = {\n outlineThickness: { value: defaultThickness },\n outlineColor: { value: defaultColor },\n outlineAlpha: { value: defaultAlpha }\n };\n const vertexShader = [\n \"#include \",\n \"#include \",\n \"#include \",\n \"#include \",\n \"#include \",\n \"#include \",\n \"#include \",\n \"#include \",\n \"uniform float outlineThickness;\",\n \"vec4 calculateOutline( vec4 pos, vec3 normal, vec4 skinned ) {\",\n \"\tfloat thickness = outlineThickness;\",\n \"\tconst float ratio = 1.0;\",\n // TODO: support outline thickness ratio for each vertex\n \"\tvec4 pos2 = projectionMatrix * modelViewMatrix * vec4( skinned.xyz + normal, 1.0 );\",\n // NOTE: subtract pos2 from pos because BackSide objectNormal is negative\n \"\tvec4 norm = normalize( pos - pos2 );\",\n \"\treturn pos + norm * thickness * pos.w * ratio;\",\n \"}\",\n \"void main() {\",\n \"\t#include \",\n \"\t#include \",\n \"\t#include \",\n \"\t#include \",\n \"\t#include \",\n \"\t#include \",\n \"\t#include \",\n \"\t#include \",\n \"\t#include \",\n \"\t#include \",\n \"\tvec3 outlineNormal = - objectNormal;\",\n // the outline material is always rendered with BackSide\n \"\tgl_Position = calculateOutline( gl_Position, outlineNormal, vec4( transformed, 1.0 ) );\",\n \"\t#include \",\n \"\t#include \",\n \"\t#include \",\n \"}\"\n ].join(\"\\n\");\n const fragmentShader = [\n \"#include \",\n \"#include \",\n \"#include \",\n \"#include \",\n \"uniform vec3 outlineColor;\",\n \"uniform float outlineAlpha;\",\n \"void main() {\",\n \"\t#include \",\n \"\t#include \",\n \"\tgl_FragColor = vec4( outlineColor, outlineAlpha );\",\n \"\t#include \",\n `\t#include <${parseInt(three__WEBPACK_IMPORTED_MODULE_42__.REVISION.replace(/\\D+/g, \"\")) >= 154 ? \"colorspace_fragment\" : \"encodings_fragment\"}>`,\n \"\t#include \",\n \"\t#include \",\n \"}\"\n ].join(\"\\n\");\n function createMaterial() {\n return new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n type: \"OutlineEffect\",\n uniforms: three__WEBPACK_IMPORTED_MODULE_42__.UniformsUtils.merge([three__WEBPACK_IMPORTED_MODULE_42__.UniformsLib[\"fog\"], three__WEBPACK_IMPORTED_MODULE_42__.UniformsLib[\"displacementmap\"], uniformsOutline]),\n vertexShader,\n fragmentShader,\n side: three__WEBPACK_IMPORTED_MODULE_42__.BackSide\n });\n }\n function getOutlineMaterialFromCache(originalMaterial) {\n let data = cache[originalMaterial.uuid];\n if (data === void 0) {\n data = {\n material: createMaterial(),\n used: true,\n keepAlive: defaultKeepAlive,\n count: 0\n };\n cache[originalMaterial.uuid] = data;\n }\n data.used = true;\n return data.material;\n }\n function getOutlineMaterial(originalMaterial) {\n const outlineMaterial = getOutlineMaterialFromCache(originalMaterial);\n originalMaterials[outlineMaterial.uuid] = originalMaterial;\n updateOutlineMaterial(outlineMaterial, originalMaterial);\n return outlineMaterial;\n }\n function isCompatible(object) {\n const geometry2 = object.geometry;\n const hasNormals = geometry2 !== void 0 && geometry2.attributes.normal !== void 0;\n return object.isMesh === true && object.material !== void 0 && hasNormals === true;\n }\n function setOutlineMaterial(object) {\n if (isCompatible(object) === false)\n return;\n if (Array.isArray(object.material)) {\n for (let i2 = 0, il = object.material.length; i2 < il; i2++) {\n object.material[i2] = getOutlineMaterial(object.material[i2]);\n }\n } else {\n object.material = getOutlineMaterial(object.material);\n }\n originalOnBeforeRenders[object.uuid] = object.onBeforeRender;\n object.onBeforeRender = onBeforeRender;\n }\n function restoreOriginalMaterial(object) {\n if (isCompatible(object) === false)\n return;\n if (Array.isArray(object.material)) {\n for (let i2 = 0, il = object.material.length; i2 < il; i2++) {\n object.material[i2] = originalMaterials[object.material[i2].uuid];\n }\n } else {\n object.material = originalMaterials[object.material.uuid];\n }\n object.onBeforeRender = originalOnBeforeRenders[object.uuid];\n }\n function onBeforeRender(renderer2, scene, camera, geometry2, material2) {\n const originalMaterial = originalMaterials[material2.uuid];\n if (originalMaterial === void 0)\n return;\n updateUniforms(material2, originalMaterial);\n }\n function updateUniforms(material2, originalMaterial) {\n const outlineParameters = originalMaterial.userData.outlineParameters;\n material2.uniforms.outlineAlpha.value = originalMaterial.opacity;\n if (outlineParameters !== void 0) {\n if (outlineParameters.thickness !== void 0)\n material2.uniforms.outlineThickness.value = outlineParameters.thickness;\n if (outlineParameters.color !== void 0)\n material2.uniforms.outlineColor.value.fromArray(outlineParameters.color);\n if (outlineParameters.alpha !== void 0)\n material2.uniforms.outlineAlpha.value = outlineParameters.alpha;\n }\n if (originalMaterial.displacementMap) {\n material2.uniforms.displacementMap.value = originalMaterial.displacementMap;\n material2.uniforms.displacementScale.value = originalMaterial.displacementScale;\n material2.uniforms.displacementBias.value = originalMaterial.displacementBias;\n }\n }\n function updateOutlineMaterial(material2, originalMaterial) {\n if (material2.name === \"invisible\")\n return;\n const outlineParameters = originalMaterial.userData.outlineParameters;\n material2.fog = originalMaterial.fog;\n material2.toneMapped = originalMaterial.toneMapped;\n material2.premultipliedAlpha = originalMaterial.premultipliedAlpha;\n material2.displacementMap = originalMaterial.displacementMap;\n if (outlineParameters !== void 0) {\n if (originalMaterial.visible === false) {\n material2.visible = false;\n } else {\n material2.visible = outlineParameters.visible !== void 0 ? outlineParameters.visible : true;\n }\n material2.transparent = outlineParameters.alpha !== void 0 && outlineParameters.alpha < 1 ? true : originalMaterial.transparent;\n if (outlineParameters.keepAlive !== void 0)\n cache[originalMaterial.uuid].keepAlive = outlineParameters.keepAlive;\n } else {\n material2.transparent = originalMaterial.transparent;\n material2.visible = originalMaterial.visible;\n }\n if (originalMaterial.wireframe === true || originalMaterial.depthTest === false)\n material2.visible = false;\n if (originalMaterial.clippingPlanes) {\n material2.clipping = true;\n material2.clippingPlanes = originalMaterial.clippingPlanes;\n material2.clipIntersection = originalMaterial.clipIntersection;\n material2.clipShadows = originalMaterial.clipShadows;\n }\n material2.version = originalMaterial.version;\n }\n function cleanupCache() {\n let keys2;\n keys2 = Object.keys(originalMaterials);\n for (let i2 = 0, il = keys2.length; i2 < il; i2++) {\n originalMaterials[keys2[i2]] = void 0;\n }\n keys2 = Object.keys(originalOnBeforeRenders);\n for (let i2 = 0, il = keys2.length; i2 < il; i2++) {\n originalOnBeforeRenders[keys2[i2]] = void 0;\n }\n keys2 = Object.keys(cache);\n for (let i2 = 0, il = keys2.length; i2 < il; i2++) {\n const key = keys2[i2];\n if (cache[key].used === false) {\n cache[key].count++;\n if (cache[key].keepAlive === false && cache[key].count > removeThresholdCount) {\n delete cache[key];\n }\n } else {\n cache[key].used = false;\n cache[key].count = 0;\n }\n }\n }\n this.render = function(scene, camera) {\n if (this.enabled === false) {\n renderer.render(scene, camera);\n return;\n }\n const currentAutoClear = renderer.autoClear;\n renderer.autoClear = this.autoClear;\n renderer.render(scene, camera);\n renderer.autoClear = currentAutoClear;\n this.renderOutline(scene, camera);\n };\n this.renderOutline = function(scene, camera) {\n const currentAutoClear = renderer.autoClear;\n const currentSceneAutoUpdate = scene.matrixWorldAutoUpdate;\n const currentSceneBackground = scene.background;\n const currentShadowMapEnabled = renderer.shadowMap.enabled;\n scene.matrixWorldAutoUpdate = false;\n scene.background = null;\n renderer.autoClear = false;\n renderer.shadowMap.enabled = false;\n scene.traverse(setOutlineMaterial);\n renderer.render(scene, camera);\n scene.traverse(restoreOriginalMaterial);\n cleanupCache();\n scene.matrixWorldAutoUpdate = currentSceneAutoUpdate;\n scene.background = currentSceneBackground;\n renderer.autoClear = currentAutoClear;\n renderer.shadowMap.enabled = currentShadowMapEnabled;\n };\n this.autoClear = renderer.autoClear;\n this.domElement = renderer.domElement;\n this.shadowMap = renderer.shadowMap;\n this.clear = function(color, depth, stencil) {\n renderer.clear(color, depth, stencil);\n };\n this.getPixelRatio = function() {\n return renderer.getPixelRatio();\n };\n this.setPixelRatio = function(value) {\n renderer.setPixelRatio(value);\n };\n this.getSize = function(target) {\n return renderer.getSize(target);\n };\n this.setSize = function(width, height, updateStyle) {\n renderer.setSize(width, height, updateStyle);\n };\n this.setViewport = function(x, y, width, height) {\n renderer.setViewport(x, y, width, height);\n };\n this.setScissor = function(x, y, width, height) {\n renderer.setScissor(x, y, width, height);\n };\n this.setScissorTest = function(boolean) {\n renderer.setScissorTest(boolean);\n };\n this.setRenderTarget = function(renderTarget) {\n renderer.setRenderTarget(renderTarget);\n };\n }\n}\nclass AnaglyphEffect {\n constructor(renderer, width = 512, height = 512) {\n this.colorMatrixLeft = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix3().fromArray([\n 0.4561,\n -0.0400822,\n -0.0152161,\n 0.500484,\n -0.0378246,\n -0.0205971,\n 0.176381,\n -0.0157589,\n -546856e-8\n ]);\n this.colorMatrixRight = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix3().fromArray([\n -0.0434706,\n 0.378476,\n -0.0721527,\n -0.0879388,\n 0.73364,\n -0.112961,\n -155529e-8,\n -0.0184503,\n 1.2264\n ]);\n const _camera = new three__WEBPACK_IMPORTED_MODULE_42__.OrthographicCamera(-1, 1, 1, -1, 0, 1);\n const _scene = new three__WEBPACK_IMPORTED_MODULE_42__.Scene();\n const _stereo = new three__WEBPACK_IMPORTED_MODULE_42__.StereoCamera();\n const _params = { minFilter: three__WEBPACK_IMPORTED_MODULE_42__.LinearFilter, magFilter: three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter, format: three__WEBPACK_IMPORTED_MODULE_42__.RGBAFormat };\n const _renderTargetL = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(width, height, _params);\n const _renderTargetR = new three__WEBPACK_IMPORTED_MODULE_42__.WebGLRenderTarget(width, height, _params);\n const _material = new three__WEBPACK_IMPORTED_MODULE_42__.ShaderMaterial({\n uniforms: {\n mapLeft: { value: _renderTargetL.texture },\n mapRight: { value: _renderTargetR.texture },\n colorMatrixLeft: { value: this.colorMatrixLeft },\n colorMatrixRight: { value: this.colorMatrixRight }\n },\n vertexShader: [\n \"varying vec2 vUv;\",\n \"void main() {\",\n \"\tvUv = vec2( uv.x, uv.y );\",\n \"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n \"}\"\n ].join(\"\\n\"),\n fragmentShader: [\n \"uniform sampler2D mapLeft;\",\n \"uniform sampler2D mapRight;\",\n \"varying vec2 vUv;\",\n \"uniform mat3 colorMatrixLeft;\",\n \"uniform mat3 colorMatrixRight;\",\n \"void main() {\",\n \"\tvec2 uv = vUv;\",\n \"\tvec4 colorL = texture2D( mapLeft, uv );\",\n \"\tvec4 colorR = texture2D( mapRight, uv );\",\n \"\tvec3 color = clamp(\",\n \"\t\t\tcolorMatrixLeft * colorL.rgb +\",\n \"\t\t\tcolorMatrixRight * colorR.rgb, 0., 1. );\",\n \"\tgl_FragColor = vec4(\",\n \"\t\t\tcolor.r, color.g, color.b,\",\n \"\t\t\tmax( colorL.a, colorR.a ) );\",\n \"\t#include \",\n `\t#include <${parseInt(three__WEBPACK_IMPORTED_MODULE_42__.REVISION.replace(/\\D+/g, \"\")) >= 154 ? \"colorspace_fragment\" : \"encodings_fragment\"}>`,\n \"}\"\n ].join(\"\\n\")\n });\n const _mesh2 = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(new three__WEBPACK_IMPORTED_MODULE_42__.PlaneGeometry(2, 2), _material);\n _scene.add(_mesh2);\n this.setSize = function(width2, height2) {\n renderer.setSize(width2, height2);\n const pixelRatio = renderer.getPixelRatio();\n _renderTargetL.setSize(width2 * pixelRatio, height2 * pixelRatio);\n _renderTargetR.setSize(width2 * pixelRatio, height2 * pixelRatio);\n };\n this.render = function(scene, camera) {\n const currentRenderTarget = renderer.getRenderTarget();\n if (scene.matrixWorldAutoUpdate === true)\n scene.updateMatrixWorld();\n if (camera.parent === null && camera.matrixWorldAutoUpdate === true)\n camera.updateMatrixWorld();\n _stereo.update(camera);\n renderer.setRenderTarget(_renderTargetL);\n renderer.clear();\n renderer.render(scene, _stereo.cameraL);\n renderer.setRenderTarget(_renderTargetR);\n renderer.clear();\n renderer.render(scene, _stereo.cameraR);\n renderer.setRenderTarget(null);\n renderer.render(_scene, _camera);\n renderer.setRenderTarget(currentRenderTarget);\n };\n this.dispose = function() {\n _renderTargetL.dispose();\n _renderTargetR.dispose();\n _mesh2.geometry.dispose();\n _mesh2.material.dispose();\n };\n }\n}\nclass AsciiEffect {\n constructor(renderer, charSet = \" .:-=+*#%@\", options = {}) {\n const fResolution = options[\"resolution\"] || 0.15;\n const iScale = options[\"scale\"] || 1;\n const bColor = options[\"color\"] || false;\n const bAlpha = options[\"alpha\"] || false;\n const bBlock = options[\"block\"] || false;\n const bInvert = options[\"invert\"] || false;\n const strResolution = options[\"strResolution\"] || \"low\";\n let width, height;\n const domElement = document.createElement(\"div\");\n domElement.style.cursor = \"default\";\n const oAscii = document.createElement(\"table\");\n domElement.appendChild(oAscii);\n let iWidth, iHeight;\n let oImg;\n this.setSize = function(w, h) {\n width = w;\n height = h;\n renderer.setSize(w, h);\n initAsciiSize();\n };\n this.render = function(scene, camera) {\n renderer.render(scene, camera);\n asciifyImage(oAscii);\n };\n this.domElement = domElement;\n function initAsciiSize() {\n iWidth = Math.floor(width * fResolution);\n iHeight = Math.floor(height * fResolution);\n oCanvas.width = iWidth;\n oCanvas.height = iHeight;\n oImg = renderer.domElement;\n if (oImg.style.backgroundColor) {\n oAscii.rows[0].cells[0].style.backgroundColor = oImg.style.backgroundColor;\n oAscii.rows[0].cells[0].style.color = oImg.style.color;\n }\n oAscii.cellSpacing = 0;\n oAscii.cellPadding = 0;\n const oStyle = oAscii.style;\n oStyle.whiteSpace = \"pre\";\n oStyle.margin = \"0px\";\n oStyle.padding = \"0px\";\n oStyle.letterSpacing = fLetterSpacing + \"px\";\n oStyle.fontFamily = strFont;\n oStyle.fontSize = fFontSize + \"px\";\n oStyle.lineHeight = fLineHeight + \"px\";\n oStyle.textAlign = \"left\";\n oStyle.textDecoration = \"none\";\n }\n const aDefaultCharList = \" .,:;i1tfLCG08@\".split(\"\");\n const aDefaultColorCharList = \" CGO08@\".split(\"\");\n const strFont = \"courier new, monospace\";\n const oCanvasImg = renderer.domElement;\n const oCanvas = document.createElement(\"canvas\");\n if (!oCanvas.getContext) {\n return;\n }\n const oCtx = oCanvas.getContext(\"2d\");\n if (!oCtx.getImageData) {\n return;\n }\n let aCharList = bColor ? aDefaultColorCharList : aDefaultCharList;\n if (charSet)\n aCharList = charSet;\n const fFontSize = 2 / fResolution * iScale;\n const fLineHeight = 2 / fResolution * iScale;\n let fLetterSpacing = 0;\n if (strResolution == \"low\") {\n switch (iScale) {\n case 1:\n fLetterSpacing = -1;\n break;\n case 2:\n case 3:\n fLetterSpacing = -2.1;\n break;\n case 4:\n fLetterSpacing = -3.1;\n break;\n case 5:\n fLetterSpacing = -4.15;\n break;\n }\n }\n if (strResolution == \"medium\") {\n switch (iScale) {\n case 1:\n fLetterSpacing = 0;\n break;\n case 2:\n fLetterSpacing = -1;\n break;\n case 3:\n fLetterSpacing = -1.04;\n break;\n case 4:\n case 5:\n fLetterSpacing = -2.1;\n break;\n }\n }\n if (strResolution == \"high\") {\n switch (iScale) {\n case 1:\n case 2:\n fLetterSpacing = 0;\n break;\n case 3:\n case 4:\n case 5:\n fLetterSpacing = -1;\n break;\n }\n }\n function asciifyImage(oAscii2) {\n oCtx.clearRect(0, 0, iWidth, iHeight);\n oCtx.drawImage(oCanvasImg, 0, 0, iWidth, iHeight);\n const oImgData = oCtx.getImageData(0, 0, iWidth, iHeight).data;\n let strChars = \"\";\n for (let y = 0; y < iHeight; y += 2) {\n for (let x = 0; x < iWidth; x++) {\n const iOffset = (y * iWidth + x) * 4;\n const iRed = oImgData[iOffset];\n const iGreen = oImgData[iOffset + 1];\n const iBlue = oImgData[iOffset + 2];\n const iAlpha = oImgData[iOffset + 3];\n let iCharIdx;\n let fBrightness;\n fBrightness = (0.3 * iRed + 0.59 * iGreen + 0.11 * iBlue) / 255;\n if (iAlpha == 0) {\n fBrightness = 1;\n }\n iCharIdx = Math.floor((1 - fBrightness) * (aCharList.length - 1));\n if (bInvert) {\n iCharIdx = aCharList.length - iCharIdx - 1;\n }\n let strThisChar = aCharList[iCharIdx];\n if (strThisChar === void 0 || strThisChar == \" \")\n strThisChar = \" \";\n if (bColor) {\n strChars += \"\" + strThisChar + \"\";\n } else {\n strChars += strThisChar;\n }\n }\n strChars += \"
\";\n }\n oAscii2.innerHTML = `
`;\n }\n }\n}\nclass StereoEffect {\n constructor(renderer) {\n const _stereo = new three__WEBPACK_IMPORTED_MODULE_42__.StereoCamera();\n _stereo.aspect = 0.5;\n const size2 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2();\n this.setEyeSeparation = function(eyeSep) {\n _stereo.eyeSep = eyeSep;\n };\n this.setSize = function(width, height) {\n renderer.setSize(width, height);\n };\n this.render = function(scene, camera) {\n if (scene.matrixWorldAutoUpdate === true)\n scene.updateMatrixWorld();\n if (camera.parent === null && camera.matrixWorldAutoUpdate === true)\n camera.updateMatrixWorld();\n _stereo.update(camera);\n renderer.getSize(size2);\n if (renderer.autoClear)\n renderer.clear();\n renderer.setScissorTest(true);\n renderer.setScissor(0, 0, size2.width / 2, size2.height);\n renderer.setViewport(0, 0, size2.width / 2, size2.height);\n renderer.render(scene, _stereo.cameraL);\n renderer.setScissor(size2.width / 2, 0, size2.width / 2, size2.height);\n renderer.setViewport(size2.width / 2, 0, size2.width / 2, size2.height);\n renderer.render(scene, _stereo.cameraR);\n renderer.setScissorTest(false);\n };\n }\n}\nfunction findSpan(p, u, U) {\n const n = U.length - p - 1;\n if (u >= U[n]) {\n return n - 1;\n }\n if (u <= U[p]) {\n return p;\n }\n let low = p;\n let high = n;\n let mid = Math.floor((low + high) / 2);\n while (u < U[mid] || u >= U[mid + 1]) {\n if (u < U[mid]) {\n high = mid;\n } else {\n low = mid;\n }\n mid = Math.floor((low + high) / 2);\n }\n return mid;\n}\nfunction calcBasisFunctions(span, u, p, U) {\n const N = [];\n const left = [];\n const right = [];\n N[0] = 1;\n for (let j = 1; j <= p; ++j) {\n left[j] = u - U[span + 1 - j];\n right[j] = U[span + j] - u;\n let saved = 0;\n for (let r = 0; r < j; ++r) {\n const rv = right[r + 1];\n const lv = left[j - r];\n const temp = N[r] / (rv + lv);\n N[r] = saved + rv * temp;\n saved = lv * temp;\n }\n N[j] = saved;\n }\n return N;\n}\nfunction calcBSplinePoint(p, U, P, u) {\n const span = findSpan(p, u, U);\n const N = calcBasisFunctions(span, u, p, U);\n const C = new three__WEBPACK_IMPORTED_MODULE_42__.Vector4(0, 0, 0, 0);\n for (let j = 0; j <= p; ++j) {\n const point = P[span - p + j];\n const Nj = N[j];\n const wNj = point.w * Nj;\n C.x += point.x * wNj;\n C.y += point.y * wNj;\n C.z += point.z * wNj;\n C.w += point.w * Nj;\n }\n return C;\n}\nfunction calcBasisFunctionDerivatives(span, u, p, n, U) {\n const zeroArr = [];\n for (let i2 = 0; i2 <= p; ++i2)\n zeroArr[i2] = 0;\n const ders = [];\n for (let i2 = 0; i2 <= n; ++i2)\n ders[i2] = zeroArr.slice(0);\n const ndu = [];\n for (let i2 = 0; i2 <= p; ++i2)\n ndu[i2] = zeroArr.slice(0);\n ndu[0][0] = 1;\n const left = zeroArr.slice(0);\n const right = zeroArr.slice(0);\n for (let j = 1; j <= p; ++j) {\n left[j] = u - U[span + 1 - j];\n right[j] = U[span + j] - u;\n let saved = 0;\n for (let r2 = 0; r2 < j; ++r2) {\n const rv = right[r2 + 1];\n const lv = left[j - r2];\n ndu[j][r2] = rv + lv;\n const temp = ndu[r2][j - 1] / ndu[j][r2];\n ndu[r2][j] = saved + rv * temp;\n saved = lv * temp;\n }\n ndu[j][j] = saved;\n }\n for (let j = 0; j <= p; ++j) {\n ders[0][j] = ndu[j][p];\n }\n for (let r2 = 0; r2 <= p; ++r2) {\n let s1 = 0;\n let s2 = 1;\n const a2 = [];\n for (let i2 = 0; i2 <= p; ++i2) {\n a2[i2] = zeroArr.slice(0);\n }\n a2[0][0] = 1;\n for (let k = 1; k <= n; ++k) {\n let d = 0;\n const rk = r2 - k;\n const pk = p - k;\n if (r2 >= k) {\n a2[s2][0] = a2[s1][0] / ndu[pk + 1][rk];\n d = a2[s2][0] * ndu[rk][pk];\n }\n const j1 = rk >= -1 ? 1 : -rk;\n const j2 = r2 - 1 <= pk ? k - 1 : p - r2;\n for (let j3 = j1; j3 <= j2; ++j3) {\n a2[s2][j3] = (a2[s1][j3] - a2[s1][j3 - 1]) / ndu[pk + 1][rk + j3];\n d += a2[s2][j3] * ndu[rk + j3][pk];\n }\n if (r2 <= pk) {\n a2[s2][k] = -a2[s1][k - 1] / ndu[pk + 1][r2];\n d += a2[s2][k] * ndu[r2][pk];\n }\n ders[k][r2] = d;\n const j = s1;\n s1 = s2;\n s2 = j;\n }\n }\n let r = p;\n for (let k = 1; k <= n; ++k) {\n for (let j = 0; j <= p; ++j) {\n ders[k][j] *= r;\n }\n r *= p - k;\n }\n return ders;\n}\nfunction calcBSplineDerivatives(p, U, P, u, nd) {\n const du = nd < p ? nd : p;\n const CK = [];\n const span = findSpan(p, u, U);\n const nders = calcBasisFunctionDerivatives(span, u, p, du, U);\n const Pw = [];\n for (let i2 = 0; i2 < P.length; ++i2) {\n const point = P[i2].clone();\n const w = point.w;\n point.x *= w;\n point.y *= w;\n point.z *= w;\n Pw[i2] = point;\n }\n for (let k = 0; k <= du; ++k) {\n const point = Pw[span - p].clone().multiplyScalar(nders[k][0]);\n for (let j = 1; j <= p; ++j) {\n point.add(Pw[span - p + j].clone().multiplyScalar(nders[k][j]));\n }\n CK[k] = point;\n }\n for (let k = du + 1; k <= nd + 1; ++k) {\n CK[k] = new three__WEBPACK_IMPORTED_MODULE_42__.Vector4(0, 0, 0);\n }\n return CK;\n}\nfunction calcKoverI(k, i2) {\n let nom = 1;\n for (let j = 2; j <= k; ++j) {\n nom *= j;\n }\n let denom = 1;\n for (let j = 2; j <= i2; ++j) {\n denom *= j;\n }\n for (let j = 2; j <= k - i2; ++j) {\n denom *= j;\n }\n return nom / denom;\n}\nfunction calcRationalCurveDerivatives(Pders) {\n const nd = Pders.length;\n const Aders = [];\n const wders = [];\n for (let i2 = 0; i2 < nd; ++i2) {\n const point = Pders[i2];\n Aders[i2] = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(point.x, point.y, point.z);\n wders[i2] = point.w;\n }\n const CK = [];\n for (let k = 0; k < nd; ++k) {\n const v = Aders[k].clone();\n for (let i2 = 1; i2 <= k; ++i2) {\n v.sub(CK[k - i2].clone().multiplyScalar(calcKoverI(k, i2) * wders[i2]));\n }\n CK[k] = v.divideScalar(wders[0]);\n }\n return CK;\n}\nfunction calcNURBSDerivatives(p, U, P, u, nd) {\n const Pders = calcBSplineDerivatives(p, U, P, u, nd);\n return calcRationalCurveDerivatives(Pders);\n}\nfunction calcSurfacePoint(p, q, U, V, P, u, v, target) {\n const uspan = findSpan(p, u, U);\n const vspan = findSpan(q, v, V);\n const Nu = calcBasisFunctions(uspan, u, p, U);\n const Nv = calcBasisFunctions(vspan, v, q, V);\n const temp = [];\n for (let l = 0; l <= q; ++l) {\n temp[l] = new three__WEBPACK_IMPORTED_MODULE_42__.Vector4(0, 0, 0, 0);\n for (let k = 0; k <= p; ++k) {\n const point = P[uspan - p + k][vspan - q + l].clone();\n const w = point.w;\n point.x *= w;\n point.y *= w;\n point.z *= w;\n temp[l].add(point.multiplyScalar(Nu[k]));\n }\n }\n const Sw = new three__WEBPACK_IMPORTED_MODULE_42__.Vector4(0, 0, 0, 0);\n for (let l = 0; l <= q; ++l) {\n Sw.add(temp[l].multiplyScalar(Nv[l]));\n }\n Sw.divideScalar(Sw.w);\n target.set(Sw.x, Sw.y, Sw.z);\n}\nclass NURBSCurve extends three__WEBPACK_IMPORTED_MODULE_42__.Curve {\n constructor(degree, knots, controlPoints, startKnot, endKnot) {\n super();\n this.degree = degree;\n this.knots = knots;\n this.controlPoints = [];\n this.startKnot = startKnot || 0;\n this.endKnot = endKnot || this.knots.length - 1;\n for (let i2 = 0; i2 < controlPoints.length; ++i2) {\n const point = controlPoints[i2];\n this.controlPoints[i2] = new three__WEBPACK_IMPORTED_MODULE_42__.Vector4(point.x, point.y, point.z, point.w);\n }\n }\n getPoint(t2, optionalTarget) {\n const point = optionalTarget || new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const u = this.knots[this.startKnot] + t2 * (this.knots[this.endKnot] - this.knots[this.startKnot]);\n const hpoint = calcBSplinePoint(this.degree, this.knots, this.controlPoints, u);\n if (hpoint.w != 1) {\n hpoint.divideScalar(hpoint.w);\n }\n return point.set(hpoint.x, hpoint.y, hpoint.z);\n }\n getTangent(t2, optionalTarget) {\n const tangent = optionalTarget || new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const u = this.knots[0] + t2 * (this.knots[this.knots.length - 1] - this.knots[0]);\n const ders = calcNURBSDerivatives(this.degree, this.knots, this.controlPoints, u, 1);\n tangent.copy(ders[1]).normalize();\n return tangent;\n }\n}\nlet fbxTree;\nlet connections;\nlet sceneGraph;\nclass FBXLoader extends three__WEBPACK_IMPORTED_MODULE_42__.Loader {\n constructor(manager) {\n super(manager);\n }\n load(url, onLoad, onProgress, onError) {\n const scope = this;\n const path = scope.path === \"\" ? three__WEBPACK_IMPORTED_MODULE_42__.LoaderUtils.extractUrlBase(url) : scope.path;\n const loader = new three__WEBPACK_IMPORTED_MODULE_42__.FileLoader(this.manager);\n loader.setPath(scope.path);\n loader.setResponseType(\"arraybuffer\");\n loader.setRequestHeader(scope.requestHeader);\n loader.setWithCredentials(scope.withCredentials);\n loader.load(\n url,\n function(buffer) {\n try {\n onLoad(scope.parse(buffer, path));\n } catch (e) {\n if (onError) {\n onError(e);\n } else {\n console.error(e);\n }\n scope.manager.itemError(url);\n }\n },\n onProgress,\n onError\n );\n }\n parse(FBXBuffer, path) {\n if (isFbxFormatBinary(FBXBuffer)) {\n fbxTree = new BinaryParser().parse(FBXBuffer);\n } else {\n const FBXText = convertArrayBufferToString(FBXBuffer);\n if (!isFbxFormatASCII(FBXText)) {\n throw new Error(\"THREE.FBXLoader: Unknown format.\");\n }\n if (getFbxVersion(FBXText) < 7e3) {\n throw new Error(\"THREE.FBXLoader: FBX version not supported, FileVersion: \" + getFbxVersion(FBXText));\n }\n fbxTree = new TextParser().parse(FBXText);\n }\n const textureLoader = new three__WEBPACK_IMPORTED_MODULE_42__.TextureLoader(this.manager).setPath(this.resourcePath || path).setCrossOrigin(this.crossOrigin);\n return new FBXTreeParser(textureLoader, this.manager).parse(fbxTree);\n }\n}\nclass FBXTreeParser {\n constructor(textureLoader, manager) {\n this.textureLoader = textureLoader;\n this.manager = manager;\n }\n parse() {\n connections = this.parseConnections();\n const images = this.parseImages();\n const textures = this.parseTextures(images);\n const materials = this.parseMaterials(textures);\n const deformers = this.parseDeformers();\n const geometryMap = new GeometryParser$1().parse(deformers);\n this.parseScene(deformers, geometryMap, materials);\n return sceneGraph;\n }\n // Parses FBXTree.Connections which holds parent-child connections between objects (e.g. material -> texture, model->geometry )\n // and details the connection type\n parseConnections() {\n const connectionMap = /* @__PURE__ */ new Map();\n if (\"Connections\" in fbxTree) {\n const rawConnections = fbxTree.Connections.connections;\n rawConnections.forEach(function(rawConnection) {\n const fromID = rawConnection[0];\n const toID = rawConnection[1];\n const relationship = rawConnection[2];\n if (!connectionMap.has(fromID)) {\n connectionMap.set(fromID, {\n parents: [],\n children: []\n });\n }\n const parentRelationship = { ID: toID, relationship };\n connectionMap.get(fromID).parents.push(parentRelationship);\n if (!connectionMap.has(toID)) {\n connectionMap.set(toID, {\n parents: [],\n children: []\n });\n }\n const childRelationship = { ID: fromID, relationship };\n connectionMap.get(toID).children.push(childRelationship);\n });\n }\n return connectionMap;\n }\n // Parse FBXTree.Objects.Video for embedded image data\n // These images are connected to textures in FBXTree.Objects.Textures\n // via FBXTree.Connections.\n parseImages() {\n const images = {};\n const blobs = {};\n if (\"Video\" in fbxTree.Objects) {\n const videoNodes = fbxTree.Objects.Video;\n for (const nodeID in videoNodes) {\n const videoNode = videoNodes[nodeID];\n const id = parseInt(nodeID);\n images[id] = videoNode.RelativeFilename || videoNode.Filename;\n if (\"Content\" in videoNode) {\n const arrayBufferContent = videoNode.Content instanceof ArrayBuffer && videoNode.Content.byteLength > 0;\n const base64Content = typeof videoNode.Content === \"string\" && videoNode.Content !== \"\";\n if (arrayBufferContent || base64Content) {\n const image = this.parseImage(videoNodes[nodeID]);\n blobs[videoNode.RelativeFilename || videoNode.Filename] = image;\n }\n }\n }\n }\n for (const id in images) {\n const filename = images[id];\n if (blobs[filename] !== void 0)\n images[id] = blobs[filename];\n else\n images[id] = images[id].split(\"\\\\\").pop();\n }\n return images;\n }\n // Parse embedded image data in FBXTree.Video.Content\n parseImage(videoNode) {\n const content = videoNode.Content;\n const fileName = videoNode.RelativeFilename || videoNode.Filename;\n const extension = fileName.slice(fileName.lastIndexOf(\".\") + 1).toLowerCase();\n let type;\n switch (extension) {\n case \"bmp\":\n type = \"image/bmp\";\n break;\n case \"jpg\":\n case \"jpeg\":\n type = \"image/jpeg\";\n break;\n case \"png\":\n type = \"image/png\";\n break;\n case \"tif\":\n type = \"image/tiff\";\n break;\n case \"tga\":\n if (this.manager.getHandler(\".tga\") === null) {\n console.warn(\"FBXLoader: TGA loader not found, skipping \", fileName);\n }\n type = \"image/tga\";\n break;\n default:\n console.warn('FBXLoader: Image type \"' + extension + '\" is not supported.');\n return;\n }\n if (typeof content === \"string\") {\n return \"data:\" + type + \";base64,\" + content;\n } else {\n const array = new Uint8Array(content);\n return window.URL.createObjectURL(new Blob([array], { type }));\n }\n }\n // Parse nodes in FBXTree.Objects.Texture\n // These contain details such as UV scaling, cropping, rotation etc and are connected\n // to images in FBXTree.Objects.Video\n parseTextures(images) {\n const textureMap = /* @__PURE__ */ new Map();\n if (\"Texture\" in fbxTree.Objects) {\n const textureNodes = fbxTree.Objects.Texture;\n for (const nodeID in textureNodes) {\n const texture = this.parseTexture(textureNodes[nodeID], images);\n textureMap.set(parseInt(nodeID), texture);\n }\n }\n return textureMap;\n }\n // Parse individual node in FBXTree.Objects.Texture\n parseTexture(textureNode, images) {\n const texture = this.loadTexture(textureNode, images);\n texture.ID = textureNode.id;\n texture.name = textureNode.attrName;\n const wrapModeU = textureNode.WrapModeU;\n const wrapModeV = textureNode.WrapModeV;\n const valueU = wrapModeU !== void 0 ? wrapModeU.value : 0;\n const valueV = wrapModeV !== void 0 ? wrapModeV.value : 0;\n texture.wrapS = valueU === 0 ? three__WEBPACK_IMPORTED_MODULE_42__.RepeatWrapping : three__WEBPACK_IMPORTED_MODULE_42__.ClampToEdgeWrapping;\n texture.wrapT = valueV === 0 ? three__WEBPACK_IMPORTED_MODULE_42__.RepeatWrapping : three__WEBPACK_IMPORTED_MODULE_42__.ClampToEdgeWrapping;\n if (\"Scaling\" in textureNode) {\n const values = textureNode.Scaling.value;\n texture.repeat.x = values[0];\n texture.repeat.y = values[1];\n }\n return texture;\n }\n // load a texture specified as a blob or data URI, or via an external URL using TextureLoader\n loadTexture(textureNode, images) {\n let fileName;\n const currentPath = this.textureLoader.path;\n const children = connections.get(textureNode.id).children;\n if (children !== void 0 && children.length > 0 && images[children[0].ID] !== void 0) {\n fileName = images[children[0].ID];\n if (fileName.indexOf(\"blob:\") === 0 || fileName.indexOf(\"data:\") === 0) {\n this.textureLoader.setPath(void 0);\n }\n }\n let texture;\n const extension = textureNode.FileName.slice(-3).toLowerCase();\n if (extension === \"tga\") {\n const loader = this.manager.getHandler(\".tga\");\n if (loader === null) {\n console.warn(\"FBXLoader: TGA loader not found, creating placeholder texture for\", textureNode.RelativeFilename);\n texture = new three__WEBPACK_IMPORTED_MODULE_42__.Texture();\n } else {\n loader.setPath(this.textureLoader.path);\n texture = loader.load(fileName);\n }\n } else if (extension === \"psd\") {\n console.warn(\n \"FBXLoader: PSD textures are not supported, creating placeholder texture for\",\n textureNode.RelativeFilename\n );\n texture = new three__WEBPACK_IMPORTED_MODULE_42__.Texture();\n } else {\n texture = this.textureLoader.load(fileName);\n }\n this.textureLoader.setPath(currentPath);\n return texture;\n }\n // Parse nodes in FBXTree.Objects.Material\n parseMaterials(textureMap) {\n const materialMap = /* @__PURE__ */ new Map();\n if (\"Material\" in fbxTree.Objects) {\n const materialNodes = fbxTree.Objects.Material;\n for (const nodeID in materialNodes) {\n const material2 = this.parseMaterial(materialNodes[nodeID], textureMap);\n if (material2 !== null)\n materialMap.set(parseInt(nodeID), material2);\n }\n }\n return materialMap;\n }\n // Parse single node in FBXTree.Objects.Material\n // Materials are connected to texture maps in FBXTree.Objects.Textures\n // FBX format currently only supports Lambert and Phong shading models\n parseMaterial(materialNode, textureMap) {\n const ID = materialNode.id;\n const name = materialNode.attrName;\n let type = materialNode.ShadingModel;\n if (typeof type === \"object\") {\n type = type.value;\n }\n if (!connections.has(ID))\n return null;\n const parameters = this.parseParameters(materialNode, textureMap, ID);\n let material2;\n switch (type.toLowerCase()) {\n case \"phong\":\n material2 = new three__WEBPACK_IMPORTED_MODULE_42__.MeshPhongMaterial();\n break;\n case \"lambert\":\n material2 = new three__WEBPACK_IMPORTED_MODULE_42__.MeshLambertMaterial();\n break;\n default:\n console.warn('THREE.FBXLoader: unknown material type \"%s\". Defaulting to MeshPhongMaterial.', type);\n material2 = new three__WEBPACK_IMPORTED_MODULE_42__.MeshPhongMaterial();\n break;\n }\n material2.setValues(parameters);\n material2.name = name;\n return material2;\n }\n // Parse FBX material and return parameters suitable for a three.js material\n // Also parse the texture map and return any textures associated with the material\n parseParameters(materialNode, textureMap, ID) {\n const parameters = {};\n if (materialNode.BumpFactor) {\n parameters.bumpScale = materialNode.BumpFactor.value;\n }\n if (materialNode.Diffuse) {\n parameters.color = new three__WEBPACK_IMPORTED_MODULE_42__.Color().fromArray(materialNode.Diffuse.value);\n } else if (materialNode.DiffuseColor && (materialNode.DiffuseColor.type === \"Color\" || materialNode.DiffuseColor.type === \"ColorRGB\")) {\n parameters.color = new three__WEBPACK_IMPORTED_MODULE_42__.Color().fromArray(materialNode.DiffuseColor.value);\n }\n if (materialNode.DisplacementFactor) {\n parameters.displacementScale = materialNode.DisplacementFactor.value;\n }\n if (materialNode.Emissive) {\n parameters.emissive = new three__WEBPACK_IMPORTED_MODULE_42__.Color().fromArray(materialNode.Emissive.value);\n } else if (materialNode.EmissiveColor && (materialNode.EmissiveColor.type === \"Color\" || materialNode.EmissiveColor.type === \"ColorRGB\")) {\n parameters.emissive = new three__WEBPACK_IMPORTED_MODULE_42__.Color().fromArray(materialNode.EmissiveColor.value);\n }\n if (materialNode.EmissiveFactor) {\n parameters.emissiveIntensity = parseFloat(materialNode.EmissiveFactor.value);\n }\n if (materialNode.Opacity) {\n parameters.opacity = parseFloat(materialNode.Opacity.value);\n }\n if (parameters.opacity < 1) {\n parameters.transparent = true;\n }\n if (materialNode.ReflectionFactor) {\n parameters.reflectivity = materialNode.ReflectionFactor.value;\n }\n if (materialNode.Shininess) {\n parameters.shininess = materialNode.Shininess.value;\n }\n if (materialNode.Specular) {\n parameters.specular = new three__WEBPACK_IMPORTED_MODULE_42__.Color().fromArray(materialNode.Specular.value);\n } else if (materialNode.SpecularColor && materialNode.SpecularColor.type === \"Color\") {\n parameters.specular = new three__WEBPACK_IMPORTED_MODULE_42__.Color().fromArray(materialNode.SpecularColor.value);\n }\n const scope = this;\n connections.get(ID).children.forEach(function(child) {\n const type = child.relationship;\n switch (type) {\n case \"Bump\":\n parameters.bumpMap = scope.getTexture(textureMap, child.ID);\n break;\n case \"Maya|TEX_ao_map\":\n parameters.aoMap = scope.getTexture(textureMap, child.ID);\n break;\n case \"DiffuseColor\":\n case \"Maya|TEX_color_map\":\n parameters.map = scope.getTexture(textureMap, child.ID);\n if (parameters.map !== void 0) {\n if (\"colorSpace\" in parameters.map)\n parameters.map.colorSpace = \"srgb\";\n else\n parameters.map.encoding = 3001;\n }\n break;\n case \"DisplacementColor\":\n parameters.displacementMap = scope.getTexture(textureMap, child.ID);\n break;\n case \"EmissiveColor\":\n parameters.emissiveMap = scope.getTexture(textureMap, child.ID);\n if (parameters.emissiveMap !== void 0) {\n if (\"colorSpace\" in parameters.emissiveMap)\n parameters.emissiveMap.colorSpace = \"srgb\";\n else\n parameters.emissiveMap.encoding = 3001;\n }\n break;\n case \"NormalMap\":\n case \"Maya|TEX_normal_map\":\n parameters.normalMap = scope.getTexture(textureMap, child.ID);\n break;\n case \"ReflectionColor\":\n parameters.envMap = scope.getTexture(textureMap, child.ID);\n if (parameters.envMap !== void 0) {\n parameters.envMap.mapping = three__WEBPACK_IMPORTED_MODULE_42__.EquirectangularReflectionMapping;\n if (\"colorSpace\" in parameters.envMap)\n parameters.envMap.colorSpace = \"srgb\";\n else\n parameters.envMap.encoding = 3001;\n }\n break;\n case \"SpecularColor\":\n parameters.specularMap = scope.getTexture(textureMap, child.ID);\n if (parameters.specularMap !== void 0) {\n if (\"colorSpace\" in parameters.specularMap)\n parameters.specularMap.colorSpace = \"srgb\";\n else\n parameters.specularMap.encoding = 3001;\n }\n break;\n case \"TransparentColor\":\n case \"TransparencyFactor\":\n parameters.alphaMap = scope.getTexture(textureMap, child.ID);\n parameters.transparent = true;\n break;\n case \"AmbientColor\":\n case \"ShininessExponent\":\n case \"SpecularFactor\":\n case \"VectorDisplacementColor\":\n default:\n console.warn(\"THREE.FBXLoader: %s map is not supported in three.js, skipping texture.\", type);\n break;\n }\n });\n return parameters;\n }\n // get a texture from the textureMap for use by a material.\n getTexture(textureMap, id) {\n if (\"LayeredTexture\" in fbxTree.Objects && id in fbxTree.Objects.LayeredTexture) {\n console.warn(\"THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer.\");\n id = connections.get(id).children[0].ID;\n }\n return textureMap.get(id);\n }\n // Parse nodes in FBXTree.Objects.Deformer\n // Deformer node can contain skinning or Vertex Cache animation data, however only skinning is supported here\n // Generates map of Skeleton-like objects for use later when generating and binding skeletons.\n parseDeformers() {\n const skeletons = {};\n const morphTargets = {};\n if (\"Deformer\" in fbxTree.Objects) {\n const DeformerNodes = fbxTree.Objects.Deformer;\n for (const nodeID in DeformerNodes) {\n const deformerNode = DeformerNodes[nodeID];\n const relationships = connections.get(parseInt(nodeID));\n if (deformerNode.attrType === \"Skin\") {\n const skeleton = this.parseSkeleton(relationships, DeformerNodes);\n skeleton.ID = nodeID;\n if (relationships.parents.length > 1) {\n console.warn(\"THREE.FBXLoader: skeleton attached to more than one geometry is not supported.\");\n }\n skeleton.geometryID = relationships.parents[0].ID;\n skeletons[nodeID] = skeleton;\n } else if (deformerNode.attrType === \"BlendShape\") {\n const morphTarget = {\n id: nodeID\n };\n morphTarget.rawTargets = this.parseMorphTargets(relationships, DeformerNodes);\n morphTarget.id = nodeID;\n if (relationships.parents.length > 1) {\n console.warn(\"THREE.FBXLoader: morph target attached to more than one geometry is not supported.\");\n }\n morphTargets[nodeID] = morphTarget;\n }\n }\n }\n return {\n skeletons,\n morphTargets\n };\n }\n // Parse single nodes in FBXTree.Objects.Deformer\n // The top level skeleton node has type 'Skin' and sub nodes have type 'Cluster'\n // Each skin node represents a skeleton and each cluster node represents a bone\n parseSkeleton(relationships, deformerNodes) {\n const rawBones = [];\n relationships.children.forEach(function(child) {\n const boneNode = deformerNodes[child.ID];\n if (boneNode.attrType !== \"Cluster\")\n return;\n const rawBone = {\n ID: child.ID,\n indices: [],\n weights: [],\n transformLink: new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4().fromArray(boneNode.TransformLink.a)\n // transform: new Matrix4().fromArray( boneNode.Transform.a ),\n // linkMode: boneNode.Mode,\n };\n if (\"Indexes\" in boneNode) {\n rawBone.indices = boneNode.Indexes.a;\n rawBone.weights = boneNode.Weights.a;\n }\n rawBones.push(rawBone);\n });\n return {\n rawBones,\n bones: []\n };\n }\n // The top level morph deformer node has type \"BlendShape\" and sub nodes have type \"BlendShapeChannel\"\n parseMorphTargets(relationships, deformerNodes) {\n const rawMorphTargets = [];\n for (let i2 = 0; i2 < relationships.children.length; i2++) {\n const child = relationships.children[i2];\n const morphTargetNode = deformerNodes[child.ID];\n const rawMorphTarget = {\n name: morphTargetNode.attrName,\n initialWeight: morphTargetNode.DeformPercent,\n id: morphTargetNode.id,\n fullWeights: morphTargetNode.FullWeights.a\n };\n if (morphTargetNode.attrType !== \"BlendShapeChannel\")\n return;\n rawMorphTarget.geoID = connections.get(parseInt(child.ID)).children.filter(function(child2) {\n return child2.relationship === void 0;\n })[0].ID;\n rawMorphTargets.push(rawMorphTarget);\n }\n return rawMorphTargets;\n }\n // create the main Group() to be returned by the loader\n parseScene(deformers, geometryMap, materialMap) {\n sceneGraph = new three__WEBPACK_IMPORTED_MODULE_42__.Group();\n const modelMap = this.parseModels(deformers.skeletons, geometryMap, materialMap);\n const modelNodes = fbxTree.Objects.Model;\n const scope = this;\n modelMap.forEach(function(model2) {\n const modelNode = modelNodes[model2.ID];\n scope.setLookAtProperties(model2, modelNode);\n const parentConnections = connections.get(model2.ID).parents;\n parentConnections.forEach(function(connection) {\n const parent = modelMap.get(connection.ID);\n if (parent !== void 0)\n parent.add(model2);\n });\n if (model2.parent === null) {\n sceneGraph.add(model2);\n }\n });\n this.bindSkeleton(deformers.skeletons, geometryMap, modelMap);\n this.createAmbientLight();\n sceneGraph.traverse(function(node) {\n if (node.userData.transformData) {\n if (node.parent) {\n node.userData.transformData.parentMatrix = node.parent.matrix;\n node.userData.transformData.parentMatrixWorld = node.parent.matrixWorld;\n }\n const transform = generateTransform(node.userData.transformData);\n node.applyMatrix4(transform);\n node.updateWorldMatrix();\n }\n });\n const animations = new AnimationParser().parse();\n if (sceneGraph.children.length === 1 && sceneGraph.children[0].isGroup) {\n sceneGraph.children[0].animations = animations;\n sceneGraph = sceneGraph.children[0];\n }\n sceneGraph.animations = animations;\n }\n // parse nodes in FBXTree.Objects.Model\n parseModels(skeletons, geometryMap, materialMap) {\n const modelMap = /* @__PURE__ */ new Map();\n const modelNodes = fbxTree.Objects.Model;\n for (const nodeID in modelNodes) {\n const id = parseInt(nodeID);\n const node = modelNodes[nodeID];\n const relationships = connections.get(id);\n let model2 = this.buildSkeleton(relationships, skeletons, id, node.attrName);\n if (!model2) {\n switch (node.attrType) {\n case \"Camera\":\n model2 = this.createCamera(relationships);\n break;\n case \"Light\":\n model2 = this.createLight(relationships);\n break;\n case \"Mesh\":\n model2 = this.createMesh(relationships, geometryMap, materialMap);\n break;\n case \"NurbsCurve\":\n model2 = this.createCurve(relationships, geometryMap);\n break;\n case \"LimbNode\":\n case \"Root\":\n model2 = new three__WEBPACK_IMPORTED_MODULE_42__.Bone();\n break;\n case \"Null\":\n default:\n model2 = new three__WEBPACK_IMPORTED_MODULE_42__.Group();\n break;\n }\n model2.name = node.attrName ? three__WEBPACK_IMPORTED_MODULE_42__.PropertyBinding.sanitizeNodeName(node.attrName) : \"\";\n model2.ID = id;\n }\n this.getTransformData(model2, node);\n modelMap.set(id, model2);\n }\n return modelMap;\n }\n buildSkeleton(relationships, skeletons, id, name) {\n let bone = null;\n relationships.parents.forEach(function(parent) {\n for (const ID in skeletons) {\n const skeleton = skeletons[ID];\n skeleton.rawBones.forEach(function(rawBone, i2) {\n if (rawBone.ID === parent.ID) {\n const subBone = bone;\n bone = new three__WEBPACK_IMPORTED_MODULE_42__.Bone();\n bone.matrixWorld.copy(rawBone.transformLink);\n bone.name = name ? three__WEBPACK_IMPORTED_MODULE_42__.PropertyBinding.sanitizeNodeName(name) : \"\";\n bone.ID = id;\n skeleton.bones[i2] = bone;\n if (subBone !== null) {\n bone.add(subBone);\n }\n }\n });\n }\n });\n return bone;\n }\n // create a PerspectiveCamera or OrthographicCamera\n createCamera(relationships) {\n let model2;\n let cameraAttribute;\n relationships.children.forEach(function(child) {\n const attr = fbxTree.Objects.NodeAttribute[child.ID];\n if (attr !== void 0) {\n cameraAttribute = attr;\n }\n });\n if (cameraAttribute === void 0) {\n model2 = new three__WEBPACK_IMPORTED_MODULE_42__.Object3D();\n } else {\n let type = 0;\n if (cameraAttribute.CameraProjectionType !== void 0 && cameraAttribute.CameraProjectionType.value === 1) {\n type = 1;\n }\n let nearClippingPlane = 1;\n if (cameraAttribute.NearPlane !== void 0) {\n nearClippingPlane = cameraAttribute.NearPlane.value / 1e3;\n }\n let farClippingPlane = 1e3;\n if (cameraAttribute.FarPlane !== void 0) {\n farClippingPlane = cameraAttribute.FarPlane.value / 1e3;\n }\n let width = window.innerWidth;\n let height = window.innerHeight;\n if (cameraAttribute.AspectWidth !== void 0 && cameraAttribute.AspectHeight !== void 0) {\n width = cameraAttribute.AspectWidth.value;\n height = cameraAttribute.AspectHeight.value;\n }\n const aspect = width / height;\n let fov = 45;\n if (cameraAttribute.FieldOfView !== void 0) {\n fov = cameraAttribute.FieldOfView.value;\n }\n const focalLength = cameraAttribute.FocalLength ? cameraAttribute.FocalLength.value : null;\n switch (type) {\n case 0:\n model2 = new three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera(fov, aspect, nearClippingPlane, farClippingPlane);\n if (focalLength !== null)\n model2.setFocalLength(focalLength);\n break;\n case 1:\n model2 = new three__WEBPACK_IMPORTED_MODULE_42__.OrthographicCamera(\n -width / 2,\n width / 2,\n height / 2,\n -height / 2,\n nearClippingPlane,\n farClippingPlane\n );\n break;\n default:\n console.warn(\"THREE.FBXLoader: Unknown camera type \" + type + \".\");\n model2 = new three__WEBPACK_IMPORTED_MODULE_42__.Object3D();\n break;\n }\n }\n return model2;\n }\n // Create a DirectionalLight, PointLight or SpotLight\n createLight(relationships) {\n let model2;\n let lightAttribute;\n relationships.children.forEach(function(child) {\n const attr = fbxTree.Objects.NodeAttribute[child.ID];\n if (attr !== void 0) {\n lightAttribute = attr;\n }\n });\n if (lightAttribute === void 0) {\n model2 = new three__WEBPACK_IMPORTED_MODULE_42__.Object3D();\n } else {\n let type;\n if (lightAttribute.LightType === void 0) {\n type = 0;\n } else {\n type = lightAttribute.LightType.value;\n }\n let color = 16777215;\n if (lightAttribute.Color !== void 0) {\n color = new three__WEBPACK_IMPORTED_MODULE_42__.Color().fromArray(lightAttribute.Color.value);\n }\n let intensity = lightAttribute.Intensity === void 0 ? 1 : lightAttribute.Intensity.value / 100;\n if (lightAttribute.CastLightOnObject !== void 0 && lightAttribute.CastLightOnObject.value === 0) {\n intensity = 0;\n }\n let distance = 0;\n if (lightAttribute.FarAttenuationEnd !== void 0) {\n if (lightAttribute.EnableFarAttenuation !== void 0 && lightAttribute.EnableFarAttenuation.value === 0) {\n distance = 0;\n } else {\n distance = lightAttribute.FarAttenuationEnd.value;\n }\n }\n const decay = 1;\n switch (type) {\n case 0:\n model2 = new three__WEBPACK_IMPORTED_MODULE_42__.PointLight(color, intensity, distance, decay);\n break;\n case 1:\n model2 = new three__WEBPACK_IMPORTED_MODULE_42__.DirectionalLight(color, intensity);\n break;\n case 2:\n let angle = Math.PI / 3;\n if (lightAttribute.InnerAngle !== void 0) {\n angle = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.degToRad(lightAttribute.InnerAngle.value);\n }\n let penumbra = 0;\n if (lightAttribute.OuterAngle !== void 0) {\n penumbra = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.degToRad(lightAttribute.OuterAngle.value);\n penumbra = Math.max(penumbra, 1);\n }\n model2 = new three__WEBPACK_IMPORTED_MODULE_42__.SpotLight(color, intensity, distance, angle, penumbra, decay);\n break;\n default:\n console.warn(\n \"THREE.FBXLoader: Unknown light type \" + lightAttribute.LightType.value + \", defaulting to a PointLight.\"\n );\n model2 = new three__WEBPACK_IMPORTED_MODULE_42__.PointLight(color, intensity);\n break;\n }\n if (lightAttribute.CastShadows !== void 0 && lightAttribute.CastShadows.value === 1) {\n model2.castShadow = true;\n }\n }\n return model2;\n }\n createMesh(relationships, geometryMap, materialMap) {\n let model2;\n let geometry2 = null;\n let material2 = null;\n const materials = [];\n relationships.children.forEach(function(child) {\n if (geometryMap.has(child.ID)) {\n geometry2 = geometryMap.get(child.ID);\n }\n if (materialMap.has(child.ID)) {\n materials.push(materialMap.get(child.ID));\n }\n });\n if (materials.length > 1) {\n material2 = materials;\n } else if (materials.length > 0) {\n material2 = materials[0];\n } else {\n material2 = new three__WEBPACK_IMPORTED_MODULE_42__.MeshPhongMaterial({ color: 13421772 });\n materials.push(material2);\n }\n if (\"color\" in geometry2.attributes) {\n materials.forEach(function(material3) {\n material3.vertexColors = true;\n });\n }\n if (geometry2.FBX_Deformer) {\n model2 = new three__WEBPACK_IMPORTED_MODULE_42__.SkinnedMesh(geometry2, material2);\n model2.normalizeSkinWeights();\n } else {\n model2 = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(geometry2, material2);\n }\n return model2;\n }\n createCurve(relationships, geometryMap) {\n const geometry2 = relationships.children.reduce(function(geo, child) {\n if (geometryMap.has(child.ID))\n geo = geometryMap.get(child.ID);\n return geo;\n }, null);\n const material2 = new three__WEBPACK_IMPORTED_MODULE_42__.LineBasicMaterial({ color: 3342591, linewidth: 1 });\n return new three__WEBPACK_IMPORTED_MODULE_42__.Line(geometry2, material2);\n }\n // parse the model node for transform data\n getTransformData(model2, modelNode) {\n const transformData = {};\n if (\"InheritType\" in modelNode)\n transformData.inheritType = parseInt(modelNode.InheritType.value);\n if (\"RotationOrder\" in modelNode)\n transformData.eulerOrder = getEulerOrder(modelNode.RotationOrder.value);\n else\n transformData.eulerOrder = \"ZYX\";\n if (\"Lcl_Translation\" in modelNode)\n transformData.translation = modelNode.Lcl_Translation.value;\n if (\"PreRotation\" in modelNode)\n transformData.preRotation = modelNode.PreRotation.value;\n if (\"Lcl_Rotation\" in modelNode)\n transformData.rotation = modelNode.Lcl_Rotation.value;\n if (\"PostRotation\" in modelNode)\n transformData.postRotation = modelNode.PostRotation.value;\n if (\"Lcl_Scaling\" in modelNode)\n transformData.scale = modelNode.Lcl_Scaling.value;\n if (\"ScalingOffset\" in modelNode)\n transformData.scalingOffset = modelNode.ScalingOffset.value;\n if (\"ScalingPivot\" in modelNode)\n transformData.scalingPivot = modelNode.ScalingPivot.value;\n if (\"RotationOffset\" in modelNode)\n transformData.rotationOffset = modelNode.RotationOffset.value;\n if (\"RotationPivot\" in modelNode)\n transformData.rotationPivot = modelNode.RotationPivot.value;\n model2.userData.transformData = transformData;\n }\n setLookAtProperties(model2, modelNode) {\n if (\"LookAtProperty\" in modelNode) {\n const children = connections.get(model2.ID).children;\n children.forEach(function(child) {\n if (child.relationship === \"LookAtProperty\") {\n const lookAtTarget = fbxTree.Objects.Model[child.ID];\n if (\"Lcl_Translation\" in lookAtTarget) {\n const pos = lookAtTarget.Lcl_Translation.value;\n if (model2.target !== void 0) {\n model2.target.position.fromArray(pos);\n sceneGraph.add(model2.target);\n } else {\n model2.lookAt(new three__WEBPACK_IMPORTED_MODULE_42__.Vector3().fromArray(pos));\n }\n }\n }\n });\n }\n }\n bindSkeleton(skeletons, geometryMap, modelMap) {\n const bindMatrices = this.parsePoseNodes();\n for (const ID in skeletons) {\n const skeleton = skeletons[ID];\n const parents = connections.get(parseInt(skeleton.ID)).parents;\n parents.forEach(function(parent) {\n if (geometryMap.has(parent.ID)) {\n const geoID = parent.ID;\n const geoRelationships = connections.get(geoID);\n geoRelationships.parents.forEach(function(geoConnParent) {\n if (modelMap.has(geoConnParent.ID)) {\n const model2 = modelMap.get(geoConnParent.ID);\n model2.bind(new three__WEBPACK_IMPORTED_MODULE_42__.Skeleton(skeleton.bones), bindMatrices[geoConnParent.ID]);\n }\n });\n }\n });\n }\n }\n parsePoseNodes() {\n const bindMatrices = {};\n if (\"Pose\" in fbxTree.Objects) {\n const BindPoseNode = fbxTree.Objects.Pose;\n for (const nodeID in BindPoseNode) {\n if (BindPoseNode[nodeID].attrType === \"BindPose\" && BindPoseNode[nodeID].NbPoseNodes > 0) {\n const poseNodes = BindPoseNode[nodeID].PoseNode;\n if (Array.isArray(poseNodes)) {\n poseNodes.forEach(function(poseNode) {\n bindMatrices[poseNode.Node] = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4().fromArray(poseNode.Matrix.a);\n });\n } else {\n bindMatrices[poseNodes.Node] = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4().fromArray(poseNodes.Matrix.a);\n }\n }\n }\n }\n return bindMatrices;\n }\n // Parse ambient color in FBXTree.GlobalSettings - if it's not set to black (default), create an ambient light\n createAmbientLight() {\n if (\"GlobalSettings\" in fbxTree && \"AmbientColor\" in fbxTree.GlobalSettings) {\n const ambientColor = fbxTree.GlobalSettings.AmbientColor.value;\n const r = ambientColor[0];\n const g = ambientColor[1];\n const b2 = ambientColor[2];\n if (r !== 0 || g !== 0 || b2 !== 0) {\n const color = new three__WEBPACK_IMPORTED_MODULE_42__.Color(r, g, b2);\n sceneGraph.add(new three__WEBPACK_IMPORTED_MODULE_42__.AmbientLight(color, 1));\n }\n }\n }\n}\nlet GeometryParser$1 = class GeometryParser {\n // Parse nodes in FBXTree.Objects.Geometry\n parse(deformers) {\n const geometryMap = /* @__PURE__ */ new Map();\n if (\"Geometry\" in fbxTree.Objects) {\n const geoNodes = fbxTree.Objects.Geometry;\n for (const nodeID in geoNodes) {\n const relationships = connections.get(parseInt(nodeID));\n const geo = this.parseGeometry(relationships, geoNodes[nodeID], deformers);\n geometryMap.set(parseInt(nodeID), geo);\n }\n }\n return geometryMap;\n }\n // Parse single node in FBXTree.Objects.Geometry\n parseGeometry(relationships, geoNode, deformers) {\n switch (geoNode.attrType) {\n case \"Mesh\":\n return this.parseMeshGeometry(relationships, geoNode, deformers);\n case \"NurbsCurve\":\n return this.parseNurbsGeometry(geoNode);\n }\n }\n // Parse single node mesh geometry in FBXTree.Objects.Geometry\n parseMeshGeometry(relationships, geoNode, deformers) {\n const skeletons = deformers.skeletons;\n const morphTargets = [];\n const modelNodes = relationships.parents.map(function(parent) {\n return fbxTree.Objects.Model[parent.ID];\n });\n if (modelNodes.length === 0)\n return;\n const skeleton = relationships.children.reduce(function(skeleton2, child) {\n if (skeletons[child.ID] !== void 0)\n skeleton2 = skeletons[child.ID];\n return skeleton2;\n }, null);\n relationships.children.forEach(function(child) {\n if (deformers.morphTargets[child.ID] !== void 0) {\n morphTargets.push(deformers.morphTargets[child.ID]);\n }\n });\n const modelNode = modelNodes[0];\n const transformData = {};\n if (\"RotationOrder\" in modelNode)\n transformData.eulerOrder = getEulerOrder(modelNode.RotationOrder.value);\n if (\"InheritType\" in modelNode)\n transformData.inheritType = parseInt(modelNode.InheritType.value);\n if (\"GeometricTranslation\" in modelNode)\n transformData.translation = modelNode.GeometricTranslation.value;\n if (\"GeometricRotation\" in modelNode)\n transformData.rotation = modelNode.GeometricRotation.value;\n if (\"GeometricScaling\" in modelNode)\n transformData.scale = modelNode.GeometricScaling.value;\n const transform = generateTransform(transformData);\n return this.genGeometry(geoNode, skeleton, morphTargets, transform);\n }\n // Generate a BufferGeometry from a node in FBXTree.Objects.Geometry\n genGeometry(geoNode, skeleton, morphTargets, preTransform) {\n const geo = new three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry();\n if (geoNode.attrName)\n geo.name = geoNode.attrName;\n const geoInfo = this.parseGeoNode(geoNode, skeleton);\n const buffers = this.genBuffers(geoInfo);\n const positionAttribute = new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(buffers.vertex, 3);\n positionAttribute.applyMatrix4(preTransform);\n geo.setAttribute(\"position\", positionAttribute);\n if (buffers.colors.length > 0) {\n geo.setAttribute(\"color\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(buffers.colors, 3));\n }\n if (skeleton) {\n geo.setAttribute(\"skinIndex\", new three__WEBPACK_IMPORTED_MODULE_42__.Uint16BufferAttribute(buffers.weightsIndices, 4));\n geo.setAttribute(\"skinWeight\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(buffers.vertexWeights, 4));\n geo.FBX_Deformer = skeleton;\n }\n if (buffers.normal.length > 0) {\n const normalMatrix = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix3().getNormalMatrix(preTransform);\n const normalAttribute = new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(buffers.normal, 3);\n normalAttribute.applyNormalMatrix(normalMatrix);\n geo.setAttribute(\"normal\", normalAttribute);\n }\n buffers.uvs.forEach(function(uvBuffer, i2) {\n let name = \"uv\" + (i2 + 1).toString();\n if (i2 === 0) {\n name = \"uv\";\n }\n geo.setAttribute(name, new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(buffers.uvs[i2], 2));\n });\n if (geoInfo.material && geoInfo.material.mappingType !== \"AllSame\") {\n let prevMaterialIndex = buffers.materialIndex[0];\n let startIndex = 0;\n buffers.materialIndex.forEach(function(currentIndex, i2) {\n if (currentIndex !== prevMaterialIndex) {\n geo.addGroup(startIndex, i2 - startIndex, prevMaterialIndex);\n prevMaterialIndex = currentIndex;\n startIndex = i2;\n }\n });\n if (geo.groups.length > 0) {\n const lastGroup = geo.groups[geo.groups.length - 1];\n const lastIndex = lastGroup.start + lastGroup.count;\n if (lastIndex !== buffers.materialIndex.length) {\n geo.addGroup(lastIndex, buffers.materialIndex.length - lastIndex, prevMaterialIndex);\n }\n }\n if (geo.groups.length === 0) {\n geo.addGroup(0, buffers.materialIndex.length, buffers.materialIndex[0]);\n }\n }\n this.addMorphTargets(geo, geoNode, morphTargets, preTransform);\n return geo;\n }\n parseGeoNode(geoNode, skeleton) {\n const geoInfo = {};\n geoInfo.vertexPositions = geoNode.Vertices !== void 0 ? geoNode.Vertices.a : [];\n geoInfo.vertexIndices = geoNode.PolygonVertexIndex !== void 0 ? geoNode.PolygonVertexIndex.a : [];\n if (geoNode.LayerElementColor) {\n geoInfo.color = this.parseVertexColors(geoNode.LayerElementColor[0]);\n }\n if (geoNode.LayerElementMaterial) {\n geoInfo.material = this.parseMaterialIndices(geoNode.LayerElementMaterial[0]);\n }\n if (geoNode.LayerElementNormal) {\n geoInfo.normal = this.parseNormals(geoNode.LayerElementNormal[0]);\n }\n if (geoNode.LayerElementUV) {\n geoInfo.uv = [];\n let i2 = 0;\n while (geoNode.LayerElementUV[i2]) {\n if (geoNode.LayerElementUV[i2].UV) {\n geoInfo.uv.push(this.parseUVs(geoNode.LayerElementUV[i2]));\n }\n i2++;\n }\n }\n geoInfo.weightTable = {};\n if (skeleton !== null) {\n geoInfo.skeleton = skeleton;\n skeleton.rawBones.forEach(function(rawBone, i2) {\n rawBone.indices.forEach(function(index, j) {\n if (geoInfo.weightTable[index] === void 0)\n geoInfo.weightTable[index] = [];\n geoInfo.weightTable[index].push({\n id: i2,\n weight: rawBone.weights[j]\n });\n });\n });\n }\n return geoInfo;\n }\n genBuffers(geoInfo) {\n const buffers = {\n vertex: [],\n normal: [],\n colors: [],\n uvs: [],\n materialIndex: [],\n vertexWeights: [],\n weightsIndices: []\n };\n let polygonIndex = 0;\n let faceLength = 0;\n let displayedWeightsWarning = false;\n let facePositionIndexes = [];\n let faceNormals = [];\n let faceColors = [];\n let faceUVs = [];\n let faceWeights = [];\n let faceWeightIndices = [];\n const scope = this;\n geoInfo.vertexIndices.forEach(function(vertexIndex, polygonVertexIndex) {\n let materialIndex;\n let endOfFace = false;\n if (vertexIndex < 0) {\n vertexIndex = vertexIndex ^ -1;\n endOfFace = true;\n }\n let weightIndices = [];\n let weights = [];\n facePositionIndexes.push(vertexIndex * 3, vertexIndex * 3 + 1, vertexIndex * 3 + 2);\n if (geoInfo.color) {\n const data = getData(polygonVertexIndex, polygonIndex, vertexIndex, geoInfo.color);\n faceColors.push(data[0], data[1], data[2]);\n }\n if (geoInfo.skeleton) {\n if (geoInfo.weightTable[vertexIndex] !== void 0) {\n geoInfo.weightTable[vertexIndex].forEach(function(wt) {\n weights.push(wt.weight);\n weightIndices.push(wt.id);\n });\n }\n if (weights.length > 4) {\n if (!displayedWeightsWarning) {\n console.warn(\n \"THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights.\"\n );\n displayedWeightsWarning = true;\n }\n const wIndex = [0, 0, 0, 0];\n const Weight = [0, 0, 0, 0];\n weights.forEach(function(weight, weightIndex) {\n let currentWeight = weight;\n let currentIndex = weightIndices[weightIndex];\n Weight.forEach(function(comparedWeight, comparedWeightIndex, comparedWeightArray) {\n if (currentWeight > comparedWeight) {\n comparedWeightArray[comparedWeightIndex] = currentWeight;\n currentWeight = comparedWeight;\n const tmp = wIndex[comparedWeightIndex];\n wIndex[comparedWeightIndex] = currentIndex;\n currentIndex = tmp;\n }\n });\n });\n weightIndices = wIndex;\n weights = Weight;\n }\n while (weights.length < 4) {\n weights.push(0);\n weightIndices.push(0);\n }\n for (let i2 = 0; i2 < 4; ++i2) {\n faceWeights.push(weights[i2]);\n faceWeightIndices.push(weightIndices[i2]);\n }\n }\n if (geoInfo.normal) {\n const data = getData(polygonVertexIndex, polygonIndex, vertexIndex, geoInfo.normal);\n faceNormals.push(data[0], data[1], data[2]);\n }\n if (geoInfo.material && geoInfo.material.mappingType !== \"AllSame\") {\n materialIndex = getData(polygonVertexIndex, polygonIndex, vertexIndex, geoInfo.material)[0];\n }\n if (geoInfo.uv) {\n geoInfo.uv.forEach(function(uv, i2) {\n const data = getData(polygonVertexIndex, polygonIndex, vertexIndex, uv);\n if (faceUVs[i2] === void 0) {\n faceUVs[i2] = [];\n }\n faceUVs[i2].push(data[0]);\n faceUVs[i2].push(data[1]);\n });\n }\n faceLength++;\n if (endOfFace) {\n scope.genFace(\n buffers,\n geoInfo,\n facePositionIndexes,\n materialIndex,\n faceNormals,\n faceColors,\n faceUVs,\n faceWeights,\n faceWeightIndices,\n faceLength\n );\n polygonIndex++;\n faceLength = 0;\n facePositionIndexes = [];\n faceNormals = [];\n faceColors = [];\n faceUVs = [];\n faceWeights = [];\n faceWeightIndices = [];\n }\n });\n return buffers;\n }\n // Generate data for a single face in a geometry. If the face is a quad then split it into 2 tris\n genFace(buffers, geoInfo, facePositionIndexes, materialIndex, faceNormals, faceColors, faceUVs, faceWeights, faceWeightIndices, faceLength) {\n for (let i2 = 2; i2 < faceLength; i2++) {\n buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[0]]);\n buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[1]]);\n buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[2]]);\n buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[(i2 - 1) * 3]]);\n buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[(i2 - 1) * 3 + 1]]);\n buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[(i2 - 1) * 3 + 2]]);\n buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[i2 * 3]]);\n buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[i2 * 3 + 1]]);\n buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[i2 * 3 + 2]]);\n if (geoInfo.skeleton) {\n buffers.vertexWeights.push(faceWeights[0]);\n buffers.vertexWeights.push(faceWeights[1]);\n buffers.vertexWeights.push(faceWeights[2]);\n buffers.vertexWeights.push(faceWeights[3]);\n buffers.vertexWeights.push(faceWeights[(i2 - 1) * 4]);\n buffers.vertexWeights.push(faceWeights[(i2 - 1) * 4 + 1]);\n buffers.vertexWeights.push(faceWeights[(i2 - 1) * 4 + 2]);\n buffers.vertexWeights.push(faceWeights[(i2 - 1) * 4 + 3]);\n buffers.vertexWeights.push(faceWeights[i2 * 4]);\n buffers.vertexWeights.push(faceWeights[i2 * 4 + 1]);\n buffers.vertexWeights.push(faceWeights[i2 * 4 + 2]);\n buffers.vertexWeights.push(faceWeights[i2 * 4 + 3]);\n buffers.weightsIndices.push(faceWeightIndices[0]);\n buffers.weightsIndices.push(faceWeightIndices[1]);\n buffers.weightsIndices.push(faceWeightIndices[2]);\n buffers.weightsIndices.push(faceWeightIndices[3]);\n buffers.weightsIndices.push(faceWeightIndices[(i2 - 1) * 4]);\n buffers.weightsIndices.push(faceWeightIndices[(i2 - 1) * 4 + 1]);\n buffers.weightsIndices.push(faceWeightIndices[(i2 - 1) * 4 + 2]);\n buffers.weightsIndices.push(faceWeightIndices[(i2 - 1) * 4 + 3]);\n buffers.weightsIndices.push(faceWeightIndices[i2 * 4]);\n buffers.weightsIndices.push(faceWeightIndices[i2 * 4 + 1]);\n buffers.weightsIndices.push(faceWeightIndices[i2 * 4 + 2]);\n buffers.weightsIndices.push(faceWeightIndices[i2 * 4 + 3]);\n }\n if (geoInfo.color) {\n buffers.colors.push(faceColors[0]);\n buffers.colors.push(faceColors[1]);\n buffers.colors.push(faceColors[2]);\n buffers.colors.push(faceColors[(i2 - 1) * 3]);\n buffers.colors.push(faceColors[(i2 - 1) * 3 + 1]);\n buffers.colors.push(faceColors[(i2 - 1) * 3 + 2]);\n buffers.colors.push(faceColors[i2 * 3]);\n buffers.colors.push(faceColors[i2 * 3 + 1]);\n buffers.colors.push(faceColors[i2 * 3 + 2]);\n }\n if (geoInfo.material && geoInfo.material.mappingType !== \"AllSame\") {\n buffers.materialIndex.push(materialIndex);\n buffers.materialIndex.push(materialIndex);\n buffers.materialIndex.push(materialIndex);\n }\n if (geoInfo.normal) {\n buffers.normal.push(faceNormals[0]);\n buffers.normal.push(faceNormals[1]);\n buffers.normal.push(faceNormals[2]);\n buffers.normal.push(faceNormals[(i2 - 1) * 3]);\n buffers.normal.push(faceNormals[(i2 - 1) * 3 + 1]);\n buffers.normal.push(faceNormals[(i2 - 1) * 3 + 2]);\n buffers.normal.push(faceNormals[i2 * 3]);\n buffers.normal.push(faceNormals[i2 * 3 + 1]);\n buffers.normal.push(faceNormals[i2 * 3 + 2]);\n }\n if (geoInfo.uv) {\n geoInfo.uv.forEach(function(uv, j) {\n if (buffers.uvs[j] === void 0)\n buffers.uvs[j] = [];\n buffers.uvs[j].push(faceUVs[j][0]);\n buffers.uvs[j].push(faceUVs[j][1]);\n buffers.uvs[j].push(faceUVs[j][(i2 - 1) * 2]);\n buffers.uvs[j].push(faceUVs[j][(i2 - 1) * 2 + 1]);\n buffers.uvs[j].push(faceUVs[j][i2 * 2]);\n buffers.uvs[j].push(faceUVs[j][i2 * 2 + 1]);\n });\n }\n }\n }\n addMorphTargets(parentGeo, parentGeoNode, morphTargets, preTransform) {\n if (morphTargets.length === 0)\n return;\n parentGeo.morphTargetsRelative = true;\n parentGeo.morphAttributes.position = [];\n const scope = this;\n morphTargets.forEach(function(morphTarget) {\n morphTarget.rawTargets.forEach(function(rawTarget) {\n const morphGeoNode = fbxTree.Objects.Geometry[rawTarget.geoID];\n if (morphGeoNode !== void 0) {\n scope.genMorphGeometry(parentGeo, parentGeoNode, morphGeoNode, preTransform, rawTarget.name);\n }\n });\n });\n }\n // a morph geometry node is similar to a standard node, and the node is also contained\n // in FBXTree.Objects.Geometry, however it can only have attributes for position, normal\n // and a special attribute Index defining which vertices of the original geometry are affected\n // Normal and position attributes only have data for the vertices that are affected by the morph\n genMorphGeometry(parentGeo, parentGeoNode, morphGeoNode, preTransform, name) {\n const vertexIndices = parentGeoNode.PolygonVertexIndex !== void 0 ? parentGeoNode.PolygonVertexIndex.a : [];\n const morphPositionsSparse = morphGeoNode.Vertices !== void 0 ? morphGeoNode.Vertices.a : [];\n const indices = morphGeoNode.Indexes !== void 0 ? morphGeoNode.Indexes.a : [];\n const length = parentGeo.attributes.position.count * 3;\n const morphPositions = new Float32Array(length);\n for (let i2 = 0; i2 < indices.length; i2++) {\n const morphIndex = indices[i2] * 3;\n morphPositions[morphIndex] = morphPositionsSparse[i2 * 3];\n morphPositions[morphIndex + 1] = morphPositionsSparse[i2 * 3 + 1];\n morphPositions[morphIndex + 2] = morphPositionsSparse[i2 * 3 + 2];\n }\n const morphGeoInfo = {\n vertexIndices,\n vertexPositions: morphPositions\n };\n const morphBuffers = this.genBuffers(morphGeoInfo);\n const positionAttribute = new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(morphBuffers.vertex, 3);\n positionAttribute.name = name || morphGeoNode.attrName;\n positionAttribute.applyMatrix4(preTransform);\n parentGeo.morphAttributes.position.push(positionAttribute);\n }\n // Parse normal from FBXTree.Objects.Geometry.LayerElementNormal if it exists\n parseNormals(NormalNode) {\n const mappingType = NormalNode.MappingInformationType;\n const referenceType = NormalNode.ReferenceInformationType;\n const buffer = NormalNode.Normals.a;\n let indexBuffer = [];\n if (referenceType === \"IndexToDirect\") {\n if (\"NormalIndex\" in NormalNode) {\n indexBuffer = NormalNode.NormalIndex.a;\n } else if (\"NormalsIndex\" in NormalNode) {\n indexBuffer = NormalNode.NormalsIndex.a;\n }\n }\n return {\n dataSize: 3,\n buffer,\n indices: indexBuffer,\n mappingType,\n referenceType\n };\n }\n // Parse UVs from FBXTree.Objects.Geometry.LayerElementUV if it exists\n parseUVs(UVNode) {\n const mappingType = UVNode.MappingInformationType;\n const referenceType = UVNode.ReferenceInformationType;\n const buffer = UVNode.UV.a;\n let indexBuffer = [];\n if (referenceType === \"IndexToDirect\") {\n indexBuffer = UVNode.UVIndex.a;\n }\n return {\n dataSize: 2,\n buffer,\n indices: indexBuffer,\n mappingType,\n referenceType\n };\n }\n // Parse Vertex Colors from FBXTree.Objects.Geometry.LayerElementColor if it exists\n parseVertexColors(ColorNode) {\n const mappingType = ColorNode.MappingInformationType;\n const referenceType = ColorNode.ReferenceInformationType;\n const buffer = ColorNode.Colors.a;\n let indexBuffer = [];\n if (referenceType === \"IndexToDirect\") {\n indexBuffer = ColorNode.ColorIndex.a;\n }\n return {\n dataSize: 4,\n buffer,\n indices: indexBuffer,\n mappingType,\n referenceType\n };\n }\n // Parse mapping and material data in FBXTree.Objects.Geometry.LayerElementMaterial if it exists\n parseMaterialIndices(MaterialNode) {\n const mappingType = MaterialNode.MappingInformationType;\n const referenceType = MaterialNode.ReferenceInformationType;\n if (mappingType === \"NoMappingInformation\") {\n return {\n dataSize: 1,\n buffer: [0],\n indices: [0],\n mappingType: \"AllSame\",\n referenceType\n };\n }\n const materialIndexBuffer = MaterialNode.Materials.a;\n const materialIndices = [];\n for (let i2 = 0; i2 < materialIndexBuffer.length; ++i2) {\n materialIndices.push(i2);\n }\n return {\n dataSize: 1,\n buffer: materialIndexBuffer,\n indices: materialIndices,\n mappingType,\n referenceType\n };\n }\n // Generate a NurbGeometry from a node in FBXTree.Objects.Geometry\n parseNurbsGeometry(geoNode) {\n if (NURBSCurve === void 0) {\n console.error(\n \"THREE.FBXLoader: The loader relies on NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry.\"\n );\n return new three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry();\n }\n const order = parseInt(geoNode.Order);\n if (isNaN(order)) {\n console.error(\"THREE.FBXLoader: Invalid Order %s given for geometry ID: %s\", geoNode.Order, geoNode.id);\n return new three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry();\n }\n const degree = order - 1;\n const knots = geoNode.KnotVector.a;\n const controlPoints = [];\n const pointsValues = geoNode.Points.a;\n for (let i2 = 0, l = pointsValues.length; i2 < l; i2 += 4) {\n controlPoints.push(new three__WEBPACK_IMPORTED_MODULE_42__.Vector4().fromArray(pointsValues, i2));\n }\n let startKnot, endKnot;\n if (geoNode.Form === \"Closed\") {\n controlPoints.push(controlPoints[0]);\n } else if (geoNode.Form === \"Periodic\") {\n startKnot = degree;\n endKnot = knots.length - 1 - startKnot;\n for (let i2 = 0; i2 < degree; ++i2) {\n controlPoints.push(controlPoints[i2]);\n }\n }\n const curve = new NURBSCurve(degree, knots, controlPoints, startKnot, endKnot);\n const points = curve.getPoints(controlPoints.length * 12);\n return new three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry().setFromPoints(points);\n }\n};\nclass AnimationParser {\n // take raw animation clips and turn them into three.js animation clips\n parse() {\n const animationClips = [];\n const rawClips = this.parseClips();\n if (rawClips !== void 0) {\n for (const key in rawClips) {\n const rawClip = rawClips[key];\n const clip = this.addClip(rawClip);\n animationClips.push(clip);\n }\n }\n return animationClips;\n }\n parseClips() {\n if (fbxTree.Objects.AnimationCurve === void 0)\n return void 0;\n const curveNodesMap = this.parseAnimationCurveNodes();\n this.parseAnimationCurves(curveNodesMap);\n const layersMap = this.parseAnimationLayers(curveNodesMap);\n const rawClips = this.parseAnimStacks(layersMap);\n return rawClips;\n }\n // parse nodes in FBXTree.Objects.AnimationCurveNode\n // each AnimationCurveNode holds data for an animation transform for a model (e.g. left arm rotation )\n // and is referenced by an AnimationLayer\n parseAnimationCurveNodes() {\n const rawCurveNodes = fbxTree.Objects.AnimationCurveNode;\n const curveNodesMap = /* @__PURE__ */ new Map();\n for (const nodeID in rawCurveNodes) {\n const rawCurveNode = rawCurveNodes[nodeID];\n if (rawCurveNode.attrName.match(/S|R|T|DeformPercent/) !== null) {\n const curveNode = {\n id: rawCurveNode.id,\n attr: rawCurveNode.attrName,\n curves: {}\n };\n curveNodesMap.set(curveNode.id, curveNode);\n }\n }\n return curveNodesMap;\n }\n // parse nodes in FBXTree.Objects.AnimationCurve and connect them up to\n // previously parsed AnimationCurveNodes. Each AnimationCurve holds data for a single animated\n // axis ( e.g. times and values of x rotation)\n parseAnimationCurves(curveNodesMap) {\n const rawCurves = fbxTree.Objects.AnimationCurve;\n for (const nodeID in rawCurves) {\n const animationCurve = {\n id: rawCurves[nodeID].id,\n times: rawCurves[nodeID].KeyTime.a.map(convertFBXTimeToSeconds),\n values: rawCurves[nodeID].KeyValueFloat.a\n };\n const relationships = connections.get(animationCurve.id);\n if (relationships !== void 0) {\n const animationCurveID = relationships.parents[0].ID;\n const animationCurveRelationship = relationships.parents[0].relationship;\n if (animationCurveRelationship.match(/X/)) {\n curveNodesMap.get(animationCurveID).curves[\"x\"] = animationCurve;\n } else if (animationCurveRelationship.match(/Y/)) {\n curveNodesMap.get(animationCurveID).curves[\"y\"] = animationCurve;\n } else if (animationCurveRelationship.match(/Z/)) {\n curveNodesMap.get(animationCurveID).curves[\"z\"] = animationCurve;\n } else if (animationCurveRelationship.match(/d|DeformPercent/) && curveNodesMap.has(animationCurveID)) {\n curveNodesMap.get(animationCurveID).curves[\"morph\"] = animationCurve;\n }\n }\n }\n }\n // parse nodes in FBXTree.Objects.AnimationLayer. Each layers holds references\n // to various AnimationCurveNodes and is referenced by an AnimationStack node\n // note: theoretically a stack can have multiple layers, however in practice there always seems to be one per stack\n parseAnimationLayers(curveNodesMap) {\n const rawLayers = fbxTree.Objects.AnimationLayer;\n const layersMap = /* @__PURE__ */ new Map();\n for (const nodeID in rawLayers) {\n const layerCurveNodes = [];\n const connection = connections.get(parseInt(nodeID));\n if (connection !== void 0) {\n const children = connection.children;\n children.forEach(function(child, i2) {\n if (curveNodesMap.has(child.ID)) {\n const curveNode = curveNodesMap.get(child.ID);\n if (curveNode.curves.x !== void 0 || curveNode.curves.y !== void 0 || curveNode.curves.z !== void 0) {\n if (layerCurveNodes[i2] === void 0) {\n const modelID = connections.get(child.ID).parents.filter(function(parent) {\n return parent.relationship !== void 0;\n })[0].ID;\n if (modelID !== void 0) {\n const rawModel = fbxTree.Objects.Model[modelID.toString()];\n if (rawModel === void 0) {\n console.warn(\"THREE.FBXLoader: Encountered a unused curve.\", child);\n return;\n }\n const node = {\n modelName: rawModel.attrName ? three__WEBPACK_IMPORTED_MODULE_42__.PropertyBinding.sanitizeNodeName(rawModel.attrName) : \"\",\n ID: rawModel.id,\n initialPosition: [0, 0, 0],\n initialRotation: [0, 0, 0],\n initialScale: [1, 1, 1]\n };\n sceneGraph.traverse(function(child2) {\n if (child2.ID === rawModel.id) {\n node.transform = child2.matrix;\n if (child2.userData.transformData)\n node.eulerOrder = child2.userData.transformData.eulerOrder;\n }\n });\n if (!node.transform)\n node.transform = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n if (\"PreRotation\" in rawModel)\n node.preRotation = rawModel.PreRotation.value;\n if (\"PostRotation\" in rawModel)\n node.postRotation = rawModel.PostRotation.value;\n layerCurveNodes[i2] = node;\n }\n }\n if (layerCurveNodes[i2])\n layerCurveNodes[i2][curveNode.attr] = curveNode;\n } else if (curveNode.curves.morph !== void 0) {\n if (layerCurveNodes[i2] === void 0) {\n const deformerID = connections.get(child.ID).parents.filter(function(parent) {\n return parent.relationship !== void 0;\n })[0].ID;\n const morpherID = connections.get(deformerID).parents[0].ID;\n const geoID = connections.get(morpherID).parents[0].ID;\n const modelID = connections.get(geoID).parents[0].ID;\n const rawModel = fbxTree.Objects.Model[modelID];\n const node = {\n modelName: rawModel.attrName ? three__WEBPACK_IMPORTED_MODULE_42__.PropertyBinding.sanitizeNodeName(rawModel.attrName) : \"\",\n morphName: fbxTree.Objects.Deformer[deformerID].attrName\n };\n layerCurveNodes[i2] = node;\n }\n layerCurveNodes[i2][curveNode.attr] = curveNode;\n }\n }\n });\n layersMap.set(parseInt(nodeID), layerCurveNodes);\n }\n }\n return layersMap;\n }\n // parse nodes in FBXTree.Objects.AnimationStack. These are the top level node in the animation\n // hierarchy. Each Stack node will be used to create a AnimationClip\n parseAnimStacks(layersMap) {\n const rawStacks = fbxTree.Objects.AnimationStack;\n const rawClips = {};\n for (const nodeID in rawStacks) {\n const children = connections.get(parseInt(nodeID)).children;\n if (children.length > 1) {\n console.warn(\n \"THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.\"\n );\n }\n const layer = layersMap.get(children[0].ID);\n rawClips[nodeID] = {\n name: rawStacks[nodeID].attrName,\n layer\n };\n }\n return rawClips;\n }\n addClip(rawClip) {\n let tracks = [];\n const scope = this;\n rawClip.layer.forEach(function(rawTracks) {\n tracks = tracks.concat(scope.generateTracks(rawTracks));\n });\n return new three__WEBPACK_IMPORTED_MODULE_42__.AnimationClip(rawClip.name, -1, tracks);\n }\n generateTracks(rawTracks) {\n const tracks = [];\n let initialPosition = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n let initialRotation = new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion();\n let initialScale = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n if (rawTracks.transform)\n rawTracks.transform.decompose(initialPosition, initialRotation, initialScale);\n initialPosition = initialPosition.toArray();\n initialRotation = new three__WEBPACK_IMPORTED_MODULE_42__.Euler().setFromQuaternion(initialRotation, rawTracks.eulerOrder).toArray();\n initialScale = initialScale.toArray();\n if (rawTracks.T !== void 0 && Object.keys(rawTracks.T.curves).length > 0) {\n const positionTrack = this.generateVectorTrack(\n rawTracks.modelName,\n rawTracks.T.curves,\n initialPosition,\n \"position\"\n );\n if (positionTrack !== void 0)\n tracks.push(positionTrack);\n }\n if (rawTracks.R !== void 0 && Object.keys(rawTracks.R.curves).length > 0) {\n const rotationTrack = this.generateRotationTrack(\n rawTracks.modelName,\n rawTracks.R.curves,\n initialRotation,\n rawTracks.preRotation,\n rawTracks.postRotation,\n rawTracks.eulerOrder\n );\n if (rotationTrack !== void 0)\n tracks.push(rotationTrack);\n }\n if (rawTracks.S !== void 0 && Object.keys(rawTracks.S.curves).length > 0) {\n const scaleTrack = this.generateVectorTrack(rawTracks.modelName, rawTracks.S.curves, initialScale, \"scale\");\n if (scaleTrack !== void 0)\n tracks.push(scaleTrack);\n }\n if (rawTracks.DeformPercent !== void 0) {\n const morphTrack = this.generateMorphTrack(rawTracks);\n if (morphTrack !== void 0)\n tracks.push(morphTrack);\n }\n return tracks;\n }\n generateVectorTrack(modelName, curves, initialValue, type) {\n const times = this.getTimesForAllAxes(curves);\n const values = this.getKeyframeTrackValues(times, curves, initialValue);\n return new three__WEBPACK_IMPORTED_MODULE_42__.VectorKeyframeTrack(modelName + \".\" + type, times, values);\n }\n generateRotationTrack(modelName, curves, initialValue, preRotation, postRotation, eulerOrder) {\n if (curves.x !== void 0) {\n this.interpolateRotations(curves.x);\n curves.x.values = curves.x.values.map(three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.degToRad);\n }\n if (curves.y !== void 0) {\n this.interpolateRotations(curves.y);\n curves.y.values = curves.y.values.map(three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.degToRad);\n }\n if (curves.z !== void 0) {\n this.interpolateRotations(curves.z);\n curves.z.values = curves.z.values.map(three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.degToRad);\n }\n const times = this.getTimesForAllAxes(curves);\n const values = this.getKeyframeTrackValues(times, curves, initialValue);\n if (preRotation !== void 0) {\n preRotation = preRotation.map(three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.degToRad);\n preRotation.push(eulerOrder);\n preRotation = new three__WEBPACK_IMPORTED_MODULE_42__.Euler().fromArray(preRotation);\n preRotation = new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion().setFromEuler(preRotation);\n }\n if (postRotation !== void 0) {\n postRotation = postRotation.map(three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.degToRad);\n postRotation.push(eulerOrder);\n postRotation = new three__WEBPACK_IMPORTED_MODULE_42__.Euler().fromArray(postRotation);\n postRotation = new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion().setFromEuler(postRotation).invert();\n }\n const quaternion = new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion();\n const euler = new three__WEBPACK_IMPORTED_MODULE_42__.Euler();\n const quaternionValues = [];\n for (let i2 = 0; i2 < values.length; i2 += 3) {\n euler.set(values[i2], values[i2 + 1], values[i2 + 2], eulerOrder);\n quaternion.setFromEuler(euler);\n if (preRotation !== void 0)\n quaternion.premultiply(preRotation);\n if (postRotation !== void 0)\n quaternion.multiply(postRotation);\n quaternion.toArray(quaternionValues, i2 / 3 * 4);\n }\n return new three__WEBPACK_IMPORTED_MODULE_42__.QuaternionKeyframeTrack(modelName + \".quaternion\", times, quaternionValues);\n }\n generateMorphTrack(rawTracks) {\n const curves = rawTracks.DeformPercent.curves.morph;\n const values = curves.values.map(function(val) {\n return val / 100;\n });\n const morphNum = sceneGraph.getObjectByName(rawTracks.modelName).morphTargetDictionary[rawTracks.morphName];\n return new three__WEBPACK_IMPORTED_MODULE_42__.NumberKeyframeTrack(\n rawTracks.modelName + \".morphTargetInfluences[\" + morphNum + \"]\",\n curves.times,\n values\n );\n }\n // For all animated objects, times are defined separately for each axis\n // Here we'll combine the times into one sorted array without duplicates\n getTimesForAllAxes(curves) {\n let times = [];\n if (curves.x !== void 0)\n times = times.concat(curves.x.times);\n if (curves.y !== void 0)\n times = times.concat(curves.y.times);\n if (curves.z !== void 0)\n times = times.concat(curves.z.times);\n times = times.sort(function(a2, b2) {\n return a2 - b2;\n });\n if (times.length > 1) {\n let targetIndex = 1;\n let lastValue = times[0];\n for (let i2 = 1; i2 < times.length; i2++) {\n const currentValue = times[i2];\n if (currentValue !== lastValue) {\n times[targetIndex] = currentValue;\n lastValue = currentValue;\n targetIndex++;\n }\n }\n times = times.slice(0, targetIndex);\n }\n return times;\n }\n getKeyframeTrackValues(times, curves, initialValue) {\n const prevValue = initialValue;\n const values = [];\n let xIndex = -1;\n let yIndex = -1;\n let zIndex = -1;\n times.forEach(function(time) {\n if (curves.x)\n xIndex = curves.x.times.indexOf(time);\n if (curves.y)\n yIndex = curves.y.times.indexOf(time);\n if (curves.z)\n zIndex = curves.z.times.indexOf(time);\n if (xIndex !== -1) {\n const xValue = curves.x.values[xIndex];\n values.push(xValue);\n prevValue[0] = xValue;\n } else {\n values.push(prevValue[0]);\n }\n if (yIndex !== -1) {\n const yValue = curves.y.values[yIndex];\n values.push(yValue);\n prevValue[1] = yValue;\n } else {\n values.push(prevValue[1]);\n }\n if (zIndex !== -1) {\n const zValue = curves.z.values[zIndex];\n values.push(zValue);\n prevValue[2] = zValue;\n } else {\n values.push(prevValue[2]);\n }\n });\n return values;\n }\n // Rotations are defined as Euler angles which can have values of any size\n // These will be converted to quaternions which don't support values greater than\n // PI, so we'll interpolate large rotations\n interpolateRotations(curve) {\n for (let i2 = 1; i2 < curve.values.length; i2++) {\n const initialValue = curve.values[i2 - 1];\n const valuesSpan = curve.values[i2] - initialValue;\n const absoluteSpan = Math.abs(valuesSpan);\n if (absoluteSpan >= 180) {\n const numSubIntervals = absoluteSpan / 180;\n const step = valuesSpan / numSubIntervals;\n let nextValue = initialValue + step;\n const initialTime = curve.times[i2 - 1];\n const timeSpan = curve.times[i2] - initialTime;\n const interval = timeSpan / numSubIntervals;\n let nextTime = initialTime + interval;\n const interpolatedTimes = [];\n const interpolatedValues = [];\n while (nextTime < curve.times[i2]) {\n interpolatedTimes.push(nextTime);\n nextTime += interval;\n interpolatedValues.push(nextValue);\n nextValue += step;\n }\n curve.times = inject(curve.times, i2, interpolatedTimes);\n curve.values = inject(curve.values, i2, interpolatedValues);\n }\n }\n }\n}\nclass TextParser {\n getPrevNode() {\n return this.nodeStack[this.currentIndent - 2];\n }\n getCurrentNode() {\n return this.nodeStack[this.currentIndent - 1];\n }\n getCurrentProp() {\n return this.currentProp;\n }\n pushStack(node) {\n this.nodeStack.push(node);\n this.currentIndent += 1;\n }\n popStack() {\n this.nodeStack.pop();\n this.currentIndent -= 1;\n }\n setCurrentProp(val, name) {\n this.currentProp = val;\n this.currentPropName = name;\n }\n parse(text) {\n this.currentIndent = 0;\n this.allNodes = new FBXTree();\n this.nodeStack = [];\n this.currentProp = [];\n this.currentPropName = \"\";\n const scope = this;\n const split = text.split(/[\\r\\n]+/);\n split.forEach(function(line, i2) {\n const matchComment = line.match(/^[\\s\\t]*;/);\n const matchEmpty = line.match(/^[\\s\\t]*$/);\n if (matchComment || matchEmpty)\n return;\n const matchBeginning = line.match(\"^\\\\t{\" + scope.currentIndent + \"}(\\\\w+):(.*){\", \"\");\n const matchProperty = line.match(\"^\\\\t{\" + scope.currentIndent + \"}(\\\\w+):[\\\\s\\\\t\\\\r\\\\n](.*)\");\n const matchEnd = line.match(\"^\\\\t{\" + (scope.currentIndent - 1) + \"}}\");\n if (matchBeginning) {\n scope.parseNodeBegin(line, matchBeginning);\n } else if (matchProperty) {\n scope.parseNodeProperty(line, matchProperty, split[++i2]);\n } else if (matchEnd) {\n scope.popStack();\n } else if (line.match(/^[^\\s\\t}]/)) {\n scope.parseNodePropertyContinued(line);\n }\n });\n return this.allNodes;\n }\n parseNodeBegin(line, property) {\n const nodeName = property[1].trim().replace(/^\"/, \"\").replace(/\"$/, \"\");\n const nodeAttrs = property[2].split(\",\").map(function(attr) {\n return attr.trim().replace(/^\"/, \"\").replace(/\"$/, \"\");\n });\n const node = { name: nodeName };\n const attrs = this.parseNodeAttr(nodeAttrs);\n const currentNode = this.getCurrentNode();\n if (this.currentIndent === 0) {\n this.allNodes.add(nodeName, node);\n } else {\n if (nodeName in currentNode) {\n if (nodeName === \"PoseNode\") {\n currentNode.PoseNode.push(node);\n } else if (currentNode[nodeName].id !== void 0) {\n currentNode[nodeName] = {};\n currentNode[nodeName][currentNode[nodeName].id] = currentNode[nodeName];\n }\n if (attrs.id !== \"\")\n currentNode[nodeName][attrs.id] = node;\n } else if (typeof attrs.id === \"number\") {\n currentNode[nodeName] = {};\n currentNode[nodeName][attrs.id] = node;\n } else if (nodeName !== \"Properties70\") {\n if (nodeName === \"PoseNode\")\n currentNode[nodeName] = [node];\n else\n currentNode[nodeName] = node;\n }\n }\n if (typeof attrs.id === \"number\")\n node.id = attrs.id;\n if (attrs.name !== \"\")\n node.attrName = attrs.name;\n if (attrs.type !== \"\")\n node.attrType = attrs.type;\n this.pushStack(node);\n }\n parseNodeAttr(attrs) {\n let id = attrs[0];\n if (attrs[0] !== \"\") {\n id = parseInt(attrs[0]);\n if (isNaN(id)) {\n id = attrs[0];\n }\n }\n let name = \"\", type = \"\";\n if (attrs.length > 1) {\n name = attrs[1].replace(/^(\\w+)::/, \"\");\n type = attrs[2];\n }\n return { id, name, type };\n }\n parseNodeProperty(line, property, contentLine) {\n let propName = property[1].replace(/^\"/, \"\").replace(/\"$/, \"\").trim();\n let propValue = property[2].replace(/^\"/, \"\").replace(/\"$/, \"\").trim();\n if (propName === \"Content\" && propValue === \",\") {\n propValue = contentLine.replace(/\"/g, \"\").replace(/,$/, \"\").trim();\n }\n const currentNode = this.getCurrentNode();\n const parentName = currentNode.name;\n if (parentName === \"Properties70\") {\n this.parseNodeSpecialProperty(line, propName, propValue);\n return;\n }\n if (propName === \"C\") {\n const connProps = propValue.split(\",\").slice(1);\n const from = parseInt(connProps[0]);\n const to = parseInt(connProps[1]);\n let rest2 = propValue.split(\",\").slice(3);\n rest2 = rest2.map(function(elem) {\n return elem.trim().replace(/^\"/, \"\");\n });\n propName = \"connections\";\n propValue = [from, to];\n append(propValue, rest2);\n if (currentNode[propName] === void 0) {\n currentNode[propName] = [];\n }\n }\n if (propName === \"Node\")\n currentNode.id = propValue;\n if (propName in currentNode && Array.isArray(currentNode[propName])) {\n currentNode[propName].push(propValue);\n } else {\n if (propName !== \"a\")\n currentNode[propName] = propValue;\n else\n currentNode.a = propValue;\n }\n this.setCurrentProp(currentNode, propName);\n if (propName === \"a\" && propValue.slice(-1) !== \",\") {\n currentNode.a = parseNumberArray(propValue);\n }\n }\n parseNodePropertyContinued(line) {\n const currentNode = this.getCurrentNode();\n currentNode.a += line;\n if (line.slice(-1) !== \",\") {\n currentNode.a = parseNumberArray(currentNode.a);\n }\n }\n // parse \"Property70\"\n parseNodeSpecialProperty(line, propName, propValue) {\n const props = propValue.split('\",').map(function(prop) {\n return prop.trim().replace(/^\\\"/, \"\").replace(/\\s/, \"_\");\n });\n const innerPropName = props[0];\n const innerPropType1 = props[1];\n const innerPropType2 = props[2];\n const innerPropFlag = props[3];\n let innerPropValue = props[4];\n switch (innerPropType1) {\n case \"int\":\n case \"enum\":\n case \"bool\":\n case \"ULongLong\":\n case \"double\":\n case \"Number\":\n case \"FieldOfView\":\n innerPropValue = parseFloat(innerPropValue);\n break;\n case \"Color\":\n case \"ColorRGB\":\n case \"Vector3D\":\n case \"Lcl_Translation\":\n case \"Lcl_Rotation\":\n case \"Lcl_Scaling\":\n innerPropValue = parseNumberArray(innerPropValue);\n break;\n }\n this.getPrevNode()[innerPropName] = {\n type: innerPropType1,\n type2: innerPropType2,\n flag: innerPropFlag,\n value: innerPropValue\n };\n this.setCurrentProp(this.getPrevNode(), innerPropName);\n }\n}\nclass BinaryParser {\n parse(buffer) {\n const reader = new BinaryReader(buffer);\n reader.skip(23);\n const version2 = reader.getUint32();\n if (version2 < 6400) {\n throw new Error(\"THREE.FBXLoader: FBX version not supported, FileVersion: \" + version2);\n }\n const allNodes = new FBXTree();\n while (!this.endOfContent(reader)) {\n const node = this.parseNode(reader, version2);\n if (node !== null)\n allNodes.add(node.name, node);\n }\n return allNodes;\n }\n // Check if reader has reached the end of content.\n endOfContent(reader) {\n if (reader.size() % 16 === 0) {\n return (reader.getOffset() + 160 + 16 & ~15) >= reader.size();\n } else {\n return reader.getOffset() + 160 + 16 >= reader.size();\n }\n }\n // recursively parse nodes until the end of the file is reached\n parseNode(reader, version2) {\n const node = {};\n const endOffset = version2 >= 7500 ? reader.getUint64() : reader.getUint32();\n const numProperties = version2 >= 7500 ? reader.getUint64() : reader.getUint32();\n version2 >= 7500 ? reader.getUint64() : reader.getUint32();\n const nameLen = reader.getUint8();\n const name = reader.getString(nameLen);\n if (endOffset === 0)\n return null;\n const propertyList = [];\n for (let i2 = 0; i2 < numProperties; i2++) {\n propertyList.push(this.parseProperty(reader));\n }\n const id = propertyList.length > 0 ? propertyList[0] : \"\";\n const attrName = propertyList.length > 1 ? propertyList[1] : \"\";\n const attrType = propertyList.length > 2 ? propertyList[2] : \"\";\n node.singleProperty = numProperties === 1 && reader.getOffset() === endOffset ? true : false;\n while (endOffset > reader.getOffset()) {\n const subNode = this.parseNode(reader, version2);\n if (subNode !== null)\n this.parseSubNode(name, node, subNode);\n }\n node.propertyList = propertyList;\n if (typeof id === \"number\")\n node.id = id;\n if (attrName !== \"\")\n node.attrName = attrName;\n if (attrType !== \"\")\n node.attrType = attrType;\n if (name !== \"\")\n node.name = name;\n return node;\n }\n parseSubNode(name, node, subNode) {\n if (subNode.singleProperty === true) {\n const value = subNode.propertyList[0];\n if (Array.isArray(value)) {\n node[subNode.name] = subNode;\n subNode.a = value;\n } else {\n node[subNode.name] = value;\n }\n } else if (name === \"Connections\" && subNode.name === \"C\") {\n const array = [];\n subNode.propertyList.forEach(function(property, i2) {\n if (i2 !== 0)\n array.push(property);\n });\n if (node.connections === void 0) {\n node.connections = [];\n }\n node.connections.push(array);\n } else if (subNode.name === \"Properties70\") {\n const keys2 = Object.keys(subNode);\n keys2.forEach(function(key) {\n node[key] = subNode[key];\n });\n } else if (name === \"Properties70\" && subNode.name === \"P\") {\n let innerPropName = subNode.propertyList[0];\n let innerPropType1 = subNode.propertyList[1];\n const innerPropType2 = subNode.propertyList[2];\n const innerPropFlag = subNode.propertyList[3];\n let innerPropValue;\n if (innerPropName.indexOf(\"Lcl \") === 0)\n innerPropName = innerPropName.replace(\"Lcl \", \"Lcl_\");\n if (innerPropType1.indexOf(\"Lcl \") === 0)\n innerPropType1 = innerPropType1.replace(\"Lcl \", \"Lcl_\");\n if (innerPropType1 === \"Color\" || innerPropType1 === \"ColorRGB\" || innerPropType1 === \"Vector\" || innerPropType1 === \"Vector3D\" || innerPropType1.indexOf(\"Lcl_\") === 0) {\n innerPropValue = [subNode.propertyList[4], subNode.propertyList[5], subNode.propertyList[6]];\n } else {\n innerPropValue = subNode.propertyList[4];\n }\n node[innerPropName] = {\n type: innerPropType1,\n type2: innerPropType2,\n flag: innerPropFlag,\n value: innerPropValue\n };\n } else if (node[subNode.name] === void 0) {\n if (typeof subNode.id === \"number\") {\n node[subNode.name] = {};\n node[subNode.name][subNode.id] = subNode;\n } else {\n node[subNode.name] = subNode;\n }\n } else {\n if (subNode.name === \"PoseNode\") {\n if (!Array.isArray(node[subNode.name])) {\n node[subNode.name] = [node[subNode.name]];\n }\n node[subNode.name].push(subNode);\n } else if (node[subNode.name][subNode.id] === void 0) {\n node[subNode.name][subNode.id] = subNode;\n }\n }\n }\n parseProperty(reader) {\n const type = reader.getString(1);\n let length;\n switch (type) {\n case \"C\":\n return reader.getBoolean();\n case \"D\":\n return reader.getFloat64();\n case \"F\":\n return reader.getFloat32();\n case \"I\":\n return reader.getInt32();\n case \"L\":\n return reader.getInt64();\n case \"R\":\n length = reader.getUint32();\n return reader.getArrayBuffer(length);\n case \"S\":\n length = reader.getUint32();\n return reader.getString(length);\n case \"Y\":\n return reader.getInt16();\n case \"b\":\n case \"c\":\n case \"d\":\n case \"f\":\n case \"i\":\n case \"l\":\n const arrayLength = reader.getUint32();\n const encoding = reader.getUint32();\n const compressedLength = reader.getUint32();\n if (encoding === 0) {\n switch (type) {\n case \"b\":\n case \"c\":\n return reader.getBooleanArray(arrayLength);\n case \"d\":\n return reader.getFloat64Array(arrayLength);\n case \"f\":\n return reader.getFloat32Array(arrayLength);\n case \"i\":\n return reader.getInt32Array(arrayLength);\n case \"l\":\n return reader.getInt64Array(arrayLength);\n }\n }\n const data = (0,fflate__WEBPACK_IMPORTED_MODULE_43__.unzlibSync)(new Uint8Array(reader.getArrayBuffer(compressedLength)));\n const reader2 = new BinaryReader(data.buffer);\n switch (type) {\n case \"b\":\n case \"c\":\n return reader2.getBooleanArray(arrayLength);\n case \"d\":\n return reader2.getFloat64Array(arrayLength);\n case \"f\":\n return reader2.getFloat32Array(arrayLength);\n case \"i\":\n return reader2.getInt32Array(arrayLength);\n case \"l\":\n return reader2.getInt64Array(arrayLength);\n }\n default:\n throw new Error(\"THREE.FBXLoader: Unknown property type \" + type);\n }\n }\n}\nclass BinaryReader {\n constructor(buffer, littleEndian) {\n this.dv = new DataView(buffer);\n this.offset = 0;\n this.littleEndian = littleEndian !== void 0 ? littleEndian : true;\n }\n getOffset() {\n return this.offset;\n }\n size() {\n return this.dv.buffer.byteLength;\n }\n skip(length) {\n this.offset += length;\n }\n // seems like true/false representation depends on exporter.\n // true: 1 or 'Y'(=0x59), false: 0 or 'T'(=0x54)\n // then sees LSB.\n getBoolean() {\n return (this.getUint8() & 1) === 1;\n }\n getBooleanArray(size2) {\n const a2 = [];\n for (let i2 = 0; i2 < size2; i2++) {\n a2.push(this.getBoolean());\n }\n return a2;\n }\n getUint8() {\n const value = this.dv.getUint8(this.offset);\n this.offset += 1;\n return value;\n }\n getInt16() {\n const value = this.dv.getInt16(this.offset, this.littleEndian);\n this.offset += 2;\n return value;\n }\n getInt32() {\n const value = this.dv.getInt32(this.offset, this.littleEndian);\n this.offset += 4;\n return value;\n }\n getInt32Array(size2) {\n const a2 = [];\n for (let i2 = 0; i2 < size2; i2++) {\n a2.push(this.getInt32());\n }\n return a2;\n }\n getUint32() {\n const value = this.dv.getUint32(this.offset, this.littleEndian);\n this.offset += 4;\n return value;\n }\n // JavaScript doesn't support 64-bit integer so calculate this here\n // 1 << 32 will return 1 so using multiply operation instead here.\n // There's a possibility that this method returns wrong value if the value\n // is out of the range between Number.MAX_SAFE_INTEGER and Number.MIN_SAFE_INTEGER.\n // TODO: safely handle 64-bit integer\n getInt64() {\n let low, high;\n if (this.littleEndian) {\n low = this.getUint32();\n high = this.getUint32();\n } else {\n high = this.getUint32();\n low = this.getUint32();\n }\n if (high & 2147483648) {\n high = ~high & 4294967295;\n low = ~low & 4294967295;\n if (low === 4294967295)\n high = high + 1 & 4294967295;\n low = low + 1 & 4294967295;\n return -(high * 4294967296 + low);\n }\n return high * 4294967296 + low;\n }\n getInt64Array(size2) {\n const a2 = [];\n for (let i2 = 0; i2 < size2; i2++) {\n a2.push(this.getInt64());\n }\n return a2;\n }\n // Note: see getInt64() comment\n getUint64() {\n let low, high;\n if (this.littleEndian) {\n low = this.getUint32();\n high = this.getUint32();\n } else {\n high = this.getUint32();\n low = this.getUint32();\n }\n return high * 4294967296 + low;\n }\n getFloat32() {\n const value = this.dv.getFloat32(this.offset, this.littleEndian);\n this.offset += 4;\n return value;\n }\n getFloat32Array(size2) {\n const a2 = [];\n for (let i2 = 0; i2 < size2; i2++) {\n a2.push(this.getFloat32());\n }\n return a2;\n }\n getFloat64() {\n const value = this.dv.getFloat64(this.offset, this.littleEndian);\n this.offset += 8;\n return value;\n }\n getFloat64Array(size2) {\n const a2 = [];\n for (let i2 = 0; i2 < size2; i2++) {\n a2.push(this.getFloat64());\n }\n return a2;\n }\n getArrayBuffer(size2) {\n const value = this.dv.buffer.slice(this.offset, this.offset + size2);\n this.offset += size2;\n return value;\n }\n getString(size2) {\n let a2 = [];\n for (let i2 = 0; i2 < size2; i2++) {\n a2[i2] = this.getUint8();\n }\n const nullByte = a2.indexOf(0);\n if (nullByte >= 0)\n a2 = a2.slice(0, nullByte);\n return three__WEBPACK_IMPORTED_MODULE_42__.LoaderUtils.decodeText(new Uint8Array(a2));\n }\n}\nclass FBXTree {\n add(key, val) {\n this[key] = val;\n }\n}\nfunction isFbxFormatBinary(buffer) {\n const CORRECT = \"Kaydara FBX Binary \\0\";\n return buffer.byteLength >= CORRECT.length && CORRECT === convertArrayBufferToString(buffer, 0, CORRECT.length);\n}\nfunction isFbxFormatASCII(text) {\n const CORRECT = [\n \"K\",\n \"a\",\n \"y\",\n \"d\",\n \"a\",\n \"r\",\n \"a\",\n \"\\\\\",\n \"F\",\n \"B\",\n \"X\",\n \"\\\\\",\n \"B\",\n \"i\",\n \"n\",\n \"a\",\n \"r\",\n \"y\",\n \"\\\\\",\n \"\\\\\"\n ];\n let cursor = 0;\n function read2(offset) {\n const result = text[offset - 1];\n text = text.slice(cursor + offset);\n cursor++;\n return result;\n }\n for (let i2 = 0; i2 < CORRECT.length; ++i2) {\n const num = read2(1);\n if (num === CORRECT[i2]) {\n return false;\n }\n }\n return true;\n}\nfunction getFbxVersion(text) {\n const versionRegExp = /FBXVersion: (\\d+)/;\n const match = text.match(versionRegExp);\n if (match) {\n const version2 = parseInt(match[1]);\n return version2;\n }\n throw new Error(\"THREE.FBXLoader: Cannot find the version number for the file given.\");\n}\nfunction convertFBXTimeToSeconds(time) {\n return time / 46186158e3;\n}\nconst dataArray = [];\nfunction getData(polygonVertexIndex, polygonIndex, vertexIndex, infoObject) {\n let index;\n switch (infoObject.mappingType) {\n case \"ByPolygonVertex\":\n index = polygonVertexIndex;\n break;\n case \"ByPolygon\":\n index = polygonIndex;\n break;\n case \"ByVertice\":\n index = vertexIndex;\n break;\n case \"AllSame\":\n index = infoObject.indices[0];\n break;\n default:\n console.warn(\"THREE.FBXLoader: unknown attribute mapping type \" + infoObject.mappingType);\n }\n if (infoObject.referenceType === \"IndexToDirect\")\n index = infoObject.indices[index];\n const from = index * infoObject.dataSize;\n const to = from + infoObject.dataSize;\n return slice(dataArray, infoObject.buffer, from, to);\n}\nconst tempEuler = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Euler();\nconst tempVec = /* @__PURE__ */ new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\nfunction generateTransform(transformData) {\n const lTranslationM = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n const lPreRotationM = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n const lRotationM = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n const lPostRotationM = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n const lScalingM = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n const lScalingPivotM = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n const lScalingOffsetM = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n const lRotationOffsetM = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n const lRotationPivotM = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n const lParentGX = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n const lParentLX = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n const lGlobalT = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n const inheritType = transformData.inheritType ? transformData.inheritType : 0;\n if (transformData.translation)\n lTranslationM.setPosition(tempVec.fromArray(transformData.translation));\n if (transformData.preRotation) {\n const array = transformData.preRotation.map(three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.degToRad);\n array.push(transformData.eulerOrder);\n lPreRotationM.makeRotationFromEuler(tempEuler.fromArray(array));\n }\n if (transformData.rotation) {\n const array = transformData.rotation.map(three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.degToRad);\n array.push(transformData.eulerOrder);\n lRotationM.makeRotationFromEuler(tempEuler.fromArray(array));\n }\n if (transformData.postRotation) {\n const array = transformData.postRotation.map(three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.degToRad);\n array.push(transformData.eulerOrder);\n lPostRotationM.makeRotationFromEuler(tempEuler.fromArray(array));\n lPostRotationM.invert();\n }\n if (transformData.scale)\n lScalingM.scale(tempVec.fromArray(transformData.scale));\n if (transformData.scalingOffset)\n lScalingOffsetM.setPosition(tempVec.fromArray(transformData.scalingOffset));\n if (transformData.scalingPivot)\n lScalingPivotM.setPosition(tempVec.fromArray(transformData.scalingPivot));\n if (transformData.rotationOffset)\n lRotationOffsetM.setPosition(tempVec.fromArray(transformData.rotationOffset));\n if (transformData.rotationPivot)\n lRotationPivotM.setPosition(tempVec.fromArray(transformData.rotationPivot));\n if (transformData.parentMatrixWorld) {\n lParentLX.copy(transformData.parentMatrix);\n lParentGX.copy(transformData.parentMatrixWorld);\n }\n const lLRM = lPreRotationM.clone().multiply(lRotationM).multiply(lPostRotationM);\n const lParentGRM = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n lParentGRM.extractRotation(lParentGX);\n const lParentTM = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n lParentTM.copyPosition(lParentGX);\n const lParentGRSM = lParentTM.clone().invert().multiply(lParentGX);\n const lParentGSM = lParentGRM.clone().invert().multiply(lParentGRSM);\n const lLSM = lScalingM;\n const lGlobalRS = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n if (inheritType === 0) {\n lGlobalRS.copy(lParentGRM).multiply(lLRM).multiply(lParentGSM).multiply(lLSM);\n } else if (inheritType === 1) {\n lGlobalRS.copy(lParentGRM).multiply(lParentGSM).multiply(lLRM).multiply(lLSM);\n } else {\n const lParentLSM = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4().scale(new three__WEBPACK_IMPORTED_MODULE_42__.Vector3().setFromMatrixScale(lParentLX));\n const lParentLSM_inv = lParentLSM.clone().invert();\n const lParentGSM_noLocal = lParentGSM.clone().multiply(lParentLSM_inv);\n lGlobalRS.copy(lParentGRM).multiply(lLRM).multiply(lParentGSM_noLocal).multiply(lLSM);\n }\n const lRotationPivotM_inv = lRotationPivotM.clone().invert();\n const lScalingPivotM_inv = lScalingPivotM.clone().invert();\n let lTransform = lTranslationM.clone().multiply(lRotationOffsetM).multiply(lRotationPivotM).multiply(lPreRotationM).multiply(lRotationM).multiply(lPostRotationM).multiply(lRotationPivotM_inv).multiply(lScalingOffsetM).multiply(lScalingPivotM).multiply(lScalingM).multiply(lScalingPivotM_inv);\n const lLocalTWithAllPivotAndOffsetInfo = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4().copyPosition(lTransform);\n const lGlobalTranslation = lParentGX.clone().multiply(lLocalTWithAllPivotAndOffsetInfo);\n lGlobalT.copyPosition(lGlobalTranslation);\n lTransform = lGlobalT.clone().multiply(lGlobalRS);\n lTransform.premultiply(lParentGX.invert());\n return lTransform;\n}\nfunction getEulerOrder(order) {\n order = order || 0;\n const enums = [\n \"ZYX\",\n // -> XYZ extrinsic\n \"YZX\",\n // -> XZY extrinsic\n \"XZY\",\n // -> YZX extrinsic\n \"ZXY\",\n // -> YXZ extrinsic\n \"YXZ\",\n // -> ZXY extrinsic\n \"XYZ\"\n // -> ZYX extrinsic\n //'SphericXYZ', // not possible to support\n ];\n if (order === 6) {\n console.warn(\"THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect.\");\n return enums[0];\n }\n return enums[order];\n}\nfunction parseNumberArray(value) {\n const array = value.split(\",\").map(function(val) {\n return parseFloat(val);\n });\n return array;\n}\nfunction convertArrayBufferToString(buffer, from, to) {\n if (from === void 0)\n from = 0;\n if (to === void 0)\n to = buffer.byteLength;\n return three__WEBPACK_IMPORTED_MODULE_42__.LoaderUtils.decodeText(new Uint8Array(buffer, from, to));\n}\nfunction append(a2, b2) {\n for (let i2 = 0, j = a2.length, l = b2.length; i2 < l; i2++, j++) {\n a2[j] = b2[i2];\n }\n}\nfunction slice(a2, b2, from, to) {\n for (let i2 = from, j = 0; i2 < to; i2++, j++) {\n a2[j] = b2[i2];\n }\n return a2;\n}\nfunction inject(a1, index, a2) {\n return a1.slice(0, index).concat(a2).concat(a1.slice(index));\n}\nclass FontLoader extends three__WEBPACK_IMPORTED_MODULE_42__.Loader {\n constructor(manager) {\n super(manager);\n }\n load(url, onLoad, onProgress, onError) {\n const loader = new three__WEBPACK_IMPORTED_MODULE_42__.FileLoader(this.manager);\n loader.setPath(this.path);\n loader.setRequestHeader(this.requestHeader);\n loader.setWithCredentials(this.withCredentials);\n loader.load(\n url,\n (response) => {\n if (typeof response !== \"string\")\n throw new Error(\"unsupported data type\");\n const json = JSON.parse(response);\n const font = this.parse(json);\n if (onLoad)\n onLoad(font);\n },\n onProgress,\n onError\n );\n }\n loadAsync(url, onProgress) {\n return super.loadAsync(url, onProgress);\n }\n parse(json) {\n return new Font(json);\n }\n}\nclass Font {\n constructor(data) {\n __publicField(this, \"data\");\n this.data = data;\n }\n generateShapes(text, size2 = 100, _options) {\n const shapes = [];\n const options = { letterSpacing: 0, lineHeight: 1, ..._options };\n const paths = createPaths(text, size2, this.data, options);\n for (let p = 0, pl = paths.length; p < pl; p++) {\n Array.prototype.push.apply(shapes, paths[p].toShapes(false));\n }\n return shapes;\n }\n}\n__publicField(Font, \"isFont\");\n__publicField(Font, \"type\");\nfunction createPaths(text, size2, data, options) {\n const chars = Array.from(text);\n const scale = size2 / data.resolution;\n const line_height = (data.boundingBox.yMax - data.boundingBox.yMin + data.underlineThickness) * scale;\n const paths = [];\n let offsetX = 0, offsetY = 0;\n for (let i2 = 0; i2 < chars.length; i2++) {\n const char = chars[i2];\n if (char === \"\\n\") {\n offsetX = 0;\n offsetY -= line_height * options.lineHeight;\n } else {\n const ret = createPath(char, scale, offsetX, offsetY, data);\n if (ret) {\n offsetX += ret.offsetX + options.letterSpacing;\n paths.push(ret.path);\n }\n }\n }\n return paths;\n}\nfunction createPath(char, scale, offsetX, offsetY, data) {\n const glyph = data.glyphs[char] || data.glyphs[\"?\"];\n if (!glyph) {\n console.error('THREE.Font: character \"' + char + '\" does not exists in font family ' + data.familyName + \".\");\n return;\n }\n const path = new three__WEBPACK_IMPORTED_MODULE_42__.ShapePath();\n let x, y, cpx, cpy, cpx1, cpy1, cpx2, cpy2;\n if (glyph.o) {\n const outline = glyph._cachedOutline || (glyph._cachedOutline = glyph.o.split(\" \"));\n for (let i2 = 0, l = outline.length; i2 < l; ) {\n const action = outline[i2++];\n switch (action) {\n case \"m\":\n x = parseInt(outline[i2++]) * scale + offsetX;\n y = parseInt(outline[i2++]) * scale + offsetY;\n path.moveTo(x, y);\n break;\n case \"l\":\n x = parseInt(outline[i2++]) * scale + offsetX;\n y = parseInt(outline[i2++]) * scale + offsetY;\n path.lineTo(x, y);\n break;\n case \"q\":\n cpx = parseInt(outline[i2++]) * scale + offsetX;\n cpy = parseInt(outline[i2++]) * scale + offsetY;\n cpx1 = parseInt(outline[i2++]) * scale + offsetX;\n cpy1 = parseInt(outline[i2++]) * scale + offsetY;\n path.quadraticCurveTo(cpx1, cpy1, cpx, cpy);\n break;\n case \"b\":\n cpx = parseInt(outline[i2++]) * scale + offsetX;\n cpy = parseInt(outline[i2++]) * scale + offsetY;\n cpx1 = parseInt(outline[i2++]) * scale + offsetX;\n cpy1 = parseInt(outline[i2++]) * scale + offsetY;\n cpx2 = parseInt(outline[i2++]) * scale + offsetX;\n cpy2 = parseInt(outline[i2++]) * scale + offsetY;\n path.bezierCurveTo(cpx1, cpy1, cpx2, cpy2, cpx, cpy);\n break;\n }\n }\n }\n return { offsetX: glyph.ha * scale, path };\n}\nclass TGALoader extends three__WEBPACK_IMPORTED_MODULE_42__.DataTextureLoader {\n constructor(manager) {\n super(manager);\n }\n parse(buffer) {\n function tgaCheckHeader(header2) {\n switch (header2.image_type) {\n case TGA_TYPE_INDEXED:\n case TGA_TYPE_RLE_INDEXED:\n if (header2.colormap_length > 256 || header2.colormap_size !== 24 || header2.colormap_type !== 1) {\n console.error(\"THREE.TGALoader: Invalid type colormap data for indexed type.\");\n }\n break;\n case TGA_TYPE_RGB:\n case TGA_TYPE_GREY:\n case TGA_TYPE_RLE_RGB:\n case TGA_TYPE_RLE_GREY:\n if (header2.colormap_type) {\n console.error(\"THREE.TGALoader: Invalid type colormap data for colormap type.\");\n }\n break;\n case TGA_TYPE_NO_DATA:\n console.error(\"THREE.TGALoader: No data.\");\n default:\n console.error('THREE.TGALoader: Invalid type \"%s\".', header2.image_type);\n }\n if (header2.width <= 0 || header2.height <= 0) {\n console.error(\"THREE.TGALoader: Invalid image size.\");\n }\n if (header2.pixel_size !== 8 && header2.pixel_size !== 16 && header2.pixel_size !== 24 && header2.pixel_size !== 32) {\n console.error('THREE.TGALoader: Invalid pixel size \"%s\".', header2.pixel_size);\n }\n }\n function tgaParse(use_rle2, use_pal2, header2, offset2, data) {\n let pixel_data, palettes;\n const pixel_size = header2.pixel_size >> 3;\n const pixel_total = header2.width * header2.height * pixel_size;\n if (use_pal2) {\n palettes = data.subarray(offset2, offset2 += header2.colormap_length * (header2.colormap_size >> 3));\n }\n if (use_rle2) {\n pixel_data = new Uint8Array(pixel_total);\n let c, count, i2;\n let shift = 0;\n const pixels = new Uint8Array(pixel_size);\n while (shift < pixel_total) {\n c = data[offset2++];\n count = (c & 127) + 1;\n if (c & 128) {\n for (i2 = 0; i2 < pixel_size; ++i2) {\n pixels[i2] = data[offset2++];\n }\n for (i2 = 0; i2 < count; ++i2) {\n pixel_data.set(pixels, shift + i2 * pixel_size);\n }\n shift += pixel_size * count;\n } else {\n count *= pixel_size;\n for (i2 = 0; i2 < count; ++i2) {\n pixel_data[shift + i2] = data[offset2++];\n }\n shift += count;\n }\n }\n } else {\n pixel_data = data.subarray(offset2, offset2 += use_pal2 ? header2.width * header2.height : pixel_total);\n }\n return {\n pixel_data,\n palettes\n };\n }\n function tgaGetImageData8bits(imageData2, y_start, y_step, y_end, x_start, x_step, x_end, image, palettes) {\n const colormap = palettes;\n let color, i2 = 0, x, y;\n const width = header.width;\n for (y = y_start; y !== y_end; y += y_step) {\n for (x = x_start; x !== x_end; x += x_step, i2++) {\n color = image[i2];\n imageData2[(x + width * y) * 4 + 3] = 255;\n imageData2[(x + width * y) * 4 + 2] = colormap[color * 3 + 0];\n imageData2[(x + width * y) * 4 + 1] = colormap[color * 3 + 1];\n imageData2[(x + width * y) * 4 + 0] = colormap[color * 3 + 2];\n }\n }\n return imageData2;\n }\n function tgaGetImageData16bits(imageData2, y_start, y_step, y_end, x_start, x_step, x_end, image) {\n let color, i2 = 0, x, y;\n const width = header.width;\n for (y = y_start; y !== y_end; y += y_step) {\n for (x = x_start; x !== x_end; x += x_step, i2 += 2) {\n color = image[i2 + 0] + (image[i2 + 1] << 8);\n imageData2[(x + width * y) * 4 + 0] = (color & 31744) >> 7;\n imageData2[(x + width * y) * 4 + 1] = (color & 992) >> 2;\n imageData2[(x + width * y) * 4 + 2] = (color & 31) >> 3;\n imageData2[(x + width * y) * 4 + 3] = color & 32768 ? 0 : 255;\n }\n }\n return imageData2;\n }\n function tgaGetImageData24bits(imageData2, y_start, y_step, y_end, x_start, x_step, x_end, image) {\n let i2 = 0, x, y;\n const width = header.width;\n for (y = y_start; y !== y_end; y += y_step) {\n for (x = x_start; x !== x_end; x += x_step, i2 += 3) {\n imageData2[(x + width * y) * 4 + 3] = 255;\n imageData2[(x + width * y) * 4 + 2] = image[i2 + 0];\n imageData2[(x + width * y) * 4 + 1] = image[i2 + 1];\n imageData2[(x + width * y) * 4 + 0] = image[i2 + 2];\n }\n }\n return imageData2;\n }\n function tgaGetImageData32bits(imageData2, y_start, y_step, y_end, x_start, x_step, x_end, image) {\n let i2 = 0, x, y;\n const width = header.width;\n for (y = y_start; y !== y_end; y += y_step) {\n for (x = x_start; x !== x_end; x += x_step, i2 += 4) {\n imageData2[(x + width * y) * 4 + 2] = image[i2 + 0];\n imageData2[(x + width * y) * 4 + 1] = image[i2 + 1];\n imageData2[(x + width * y) * 4 + 0] = image[i2 + 2];\n imageData2[(x + width * y) * 4 + 3] = image[i2 + 3];\n }\n }\n return imageData2;\n }\n function tgaGetImageDataGrey8bits(imageData2, y_start, y_step, y_end, x_start, x_step, x_end, image) {\n let color, i2 = 0, x, y;\n const width = header.width;\n for (y = y_start; y !== y_end; y += y_step) {\n for (x = x_start; x !== x_end; x += x_step, i2++) {\n color = image[i2];\n imageData2[(x + width * y) * 4 + 0] = color;\n imageData2[(x + width * y) * 4 + 1] = color;\n imageData2[(x + width * y) * 4 + 2] = color;\n imageData2[(x + width * y) * 4 + 3] = 255;\n }\n }\n return imageData2;\n }\n function tgaGetImageDataGrey16bits(imageData2, y_start, y_step, y_end, x_start, x_step, x_end, image) {\n let i2 = 0, x, y;\n const width = header.width;\n for (y = y_start; y !== y_end; y += y_step) {\n for (x = x_start; x !== x_end; x += x_step, i2 += 2) {\n imageData2[(x + width * y) * 4 + 0] = image[i2 + 0];\n imageData2[(x + width * y) * 4 + 1] = image[i2 + 0];\n imageData2[(x + width * y) * 4 + 2] = image[i2 + 0];\n imageData2[(x + width * y) * 4 + 3] = image[i2 + 1];\n }\n }\n return imageData2;\n }\n function getTgaRGBA(data, width, height, image, palette) {\n let x_start, y_start, x_step, y_step, x_end, y_end;\n switch ((header.flags & TGA_ORIGIN_MASK) >> TGA_ORIGIN_SHIFT) {\n default:\n case TGA_ORIGIN_UL:\n x_start = 0;\n x_step = 1;\n x_end = width;\n y_start = 0;\n y_step = 1;\n y_end = height;\n break;\n case TGA_ORIGIN_BL:\n x_start = 0;\n x_step = 1;\n x_end = width;\n y_start = height - 1;\n y_step = -1;\n y_end = -1;\n break;\n case TGA_ORIGIN_UR:\n x_start = width - 1;\n x_step = -1;\n x_end = -1;\n y_start = 0;\n y_step = 1;\n y_end = height;\n break;\n case TGA_ORIGIN_BR:\n x_start = width - 1;\n x_step = -1;\n x_end = -1;\n y_start = height - 1;\n y_step = -1;\n y_end = -1;\n break;\n }\n if (use_grey) {\n switch (header.pixel_size) {\n case 8:\n tgaGetImageDataGrey8bits(data, y_start, y_step, y_end, x_start, x_step, x_end, image);\n break;\n case 16:\n tgaGetImageDataGrey16bits(data, y_start, y_step, y_end, x_start, x_step, x_end, image);\n break;\n default:\n console.error(\"THREE.TGALoader: Format not supported.\");\n break;\n }\n } else {\n switch (header.pixel_size) {\n case 8:\n tgaGetImageData8bits(data, y_start, y_step, y_end, x_start, x_step, x_end, image, palette);\n break;\n case 16:\n tgaGetImageData16bits(data, y_start, y_step, y_end, x_start, x_step, x_end, image);\n break;\n case 24:\n tgaGetImageData24bits(data, y_start, y_step, y_end, x_start, x_step, x_end, image);\n break;\n case 32:\n tgaGetImageData32bits(data, y_start, y_step, y_end, x_start, x_step, x_end, image);\n break;\n default:\n console.error(\"THREE.TGALoader: Format not supported.\");\n break;\n }\n }\n return data;\n }\n const TGA_TYPE_NO_DATA = 0, TGA_TYPE_INDEXED = 1, TGA_TYPE_RGB = 2, TGA_TYPE_GREY = 3, TGA_TYPE_RLE_INDEXED = 9, TGA_TYPE_RLE_RGB = 10, TGA_TYPE_RLE_GREY = 11, TGA_ORIGIN_MASK = 48, TGA_ORIGIN_SHIFT = 4, TGA_ORIGIN_BL = 0, TGA_ORIGIN_BR = 1, TGA_ORIGIN_UL = 2, TGA_ORIGIN_UR = 3;\n if (buffer.length < 19)\n console.error(\"THREE.TGALoader: Not enough data to contain header.\");\n let offset = 0;\n const content = new Uint8Array(buffer), header = {\n id_length: content[offset++],\n colormap_type: content[offset++],\n image_type: content[offset++],\n colormap_index: content[offset++] | content[offset++] << 8,\n colormap_length: content[offset++] | content[offset++] << 8,\n colormap_size: content[offset++],\n origin: [content[offset++] | content[offset++] << 8, content[offset++] | content[offset++] << 8],\n width: content[offset++] | content[offset++] << 8,\n height: content[offset++] | content[offset++] << 8,\n pixel_size: content[offset++],\n flags: content[offset++]\n };\n tgaCheckHeader(header);\n if (header.id_length + offset > buffer.length) {\n console.error(\"THREE.TGALoader: No data.\");\n }\n offset += header.id_length;\n let use_rle = false, use_pal = false, use_grey = false;\n switch (header.image_type) {\n case TGA_TYPE_RLE_INDEXED:\n use_rle = true;\n use_pal = true;\n break;\n case TGA_TYPE_INDEXED:\n use_pal = true;\n break;\n case TGA_TYPE_RLE_RGB:\n use_rle = true;\n break;\n case TGA_TYPE_RGB:\n break;\n case TGA_TYPE_RLE_GREY:\n use_rle = true;\n use_grey = true;\n break;\n case TGA_TYPE_GREY:\n use_grey = true;\n break;\n }\n const imageData = new Uint8Array(header.width * header.height * 4);\n const result = tgaParse(use_rle, use_pal, header, offset, content);\n getTgaRGBA(imageData, header.width, header.height, result.pixel_data, result.palettes);\n return {\n data: imageData,\n width: header.width,\n height: header.height,\n flipY: true,\n generateMipmaps: true,\n minFilter: three__WEBPACK_IMPORTED_MODULE_42__.LinearMipmapLinearFilter\n };\n }\n}\nclass Data3DTexture extends three__WEBPACK_IMPORTED_MODULE_42__.Texture {\n constructor(data = null, width = 1, height = 1, depth = 1) {\n super(null);\n this.isData3DTexture = true;\n this.image = { data, width, height, depth };\n this.magFilter = three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter;\n this.minFilter = three__WEBPACK_IMPORTED_MODULE_42__.NearestFilter;\n this.wrapR = three__WEBPACK_IMPORTED_MODULE_42__.ClampToEdgeWrapping;\n this.generateMipmaps = false;\n this.flipY = false;\n this.unpackAlignment = 1;\n }\n}\nclass LUTCubeLoader extends three__WEBPACK_IMPORTED_MODULE_42__.Loader {\n load(url, onLoad, onProgress, onError) {\n const loader = new three__WEBPACK_IMPORTED_MODULE_42__.FileLoader(this.manager);\n loader.setPath(this.path);\n loader.setResponseType(\"text\");\n loader.load(\n url,\n (text) => {\n try {\n onLoad(this.parse(text));\n } catch (e) {\n if (onError) {\n onError(e);\n } else {\n console.error(e);\n }\n this.manager.itemError(url);\n }\n },\n onProgress,\n onError\n );\n }\n parse(str) {\n str = str.replace(/^#.*?(\\n|\\r)/gm, \"\").replace(/^\\s*?(\\n|\\r)/gm, \"\").trim();\n let title = null;\n let size2 = null;\n const domainMin = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 0, 0);\n const domainMax = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(1, 1, 1);\n const lines = str.split(/[\\n\\r]+/g);\n let data = null;\n let currIndex = 0;\n for (let i2 = 0, l = lines.length; i2 < l; i2++) {\n const line = lines[i2].trim();\n const split = line.split(/\\s/g);\n switch (split[0]) {\n case \"TITLE\":\n title = line.substring(7, line.length - 1);\n break;\n case \"LUT_3D_SIZE\":\n const sizeToken = split[1];\n size2 = parseFloat(sizeToken);\n data = new Uint8Array(size2 * size2 * size2 * 4);\n break;\n case \"DOMAIN_MIN\":\n domainMin.x = parseFloat(split[1]);\n domainMin.y = parseFloat(split[2]);\n domainMin.z = parseFloat(split[3]);\n break;\n case \"DOMAIN_MAX\":\n domainMax.x = parseFloat(split[1]);\n domainMax.y = parseFloat(split[2]);\n domainMax.z = parseFloat(split[3]);\n break;\n default:\n const r = parseFloat(split[0]);\n const g = parseFloat(split[1]);\n const b2 = parseFloat(split[2]);\n if (r > 1 || r < 0 || g > 1 || g < 0 || b2 > 1 || b2 < 0) {\n throw new Error(\"LUTCubeLoader : Non normalized values not supported.\");\n }\n data[currIndex + 0] = r * 255;\n data[currIndex + 1] = g * 255;\n data[currIndex + 2] = b2 * 255;\n data[currIndex + 3] = 255;\n currIndex += 4;\n }\n }\n const texture = new three__WEBPACK_IMPORTED_MODULE_42__.DataTexture();\n texture.image.data = data;\n texture.image.width = size2;\n texture.image.height = size2 * size2;\n texture.type = three__WEBPACK_IMPORTED_MODULE_42__.UnsignedByteType;\n texture.magFilter = three__WEBPACK_IMPORTED_MODULE_42__.LinearFilter;\n texture.minFilter = three__WEBPACK_IMPORTED_MODULE_42__.LinearFilter;\n texture.wrapS = three__WEBPACK_IMPORTED_MODULE_42__.ClampToEdgeWrapping;\n texture.wrapT = three__WEBPACK_IMPORTED_MODULE_42__.ClampToEdgeWrapping;\n texture.generateMipmaps = false;\n texture.needsUpdate = true;\n const texture3D = new Data3DTexture();\n texture3D.image.data = data;\n texture3D.image.width = size2;\n texture3D.image.height = size2;\n texture3D.image.depth = size2;\n texture3D.type = three__WEBPACK_IMPORTED_MODULE_42__.UnsignedByteType;\n texture3D.magFilter = three__WEBPACK_IMPORTED_MODULE_42__.LinearFilter;\n texture3D.minFilter = three__WEBPACK_IMPORTED_MODULE_42__.LinearFilter;\n texture3D.wrapS = three__WEBPACK_IMPORTED_MODULE_42__.ClampToEdgeWrapping;\n texture3D.wrapT = three__WEBPACK_IMPORTED_MODULE_42__.ClampToEdgeWrapping;\n texture3D.wrapR = three__WEBPACK_IMPORTED_MODULE_42__.ClampToEdgeWrapping;\n texture3D.generateMipmaps = false;\n texture3D.needsUpdate = true;\n return {\n title,\n size: size2,\n domainMin,\n domainMax,\n texture,\n texture3D\n };\n }\n}\nclass NRRDLoader extends three__WEBPACK_IMPORTED_MODULE_42__.Loader {\n constructor(manager) {\n super(manager);\n }\n load(url, onLoad, onProgress, onError) {\n const scope = this;\n const loader = new three__WEBPACK_IMPORTED_MODULE_42__.FileLoader(scope.manager);\n loader.setPath(scope.path);\n loader.setResponseType(\"arraybuffer\");\n loader.setRequestHeader(scope.requestHeader);\n loader.setWithCredentials(scope.withCredentials);\n loader.load(\n url,\n function(data) {\n try {\n onLoad(scope.parse(data));\n } catch (e) {\n if (onError) {\n onError(e);\n } else {\n console.error(e);\n }\n scope.manager.itemError(url);\n }\n },\n onProgress,\n onError\n );\n }\n parse(data) {\n let _data = data;\n let _dataPointer = 0;\n const _nativeLittleEndian = new Int8Array(new Int16Array([1]).buffer)[0] > 0;\n const _littleEndian = true;\n const headerObject = {};\n function scan(type, chunks) {\n if (chunks === void 0 || chunks === null) {\n chunks = 1;\n }\n let _chunkSize = 1;\n let _array_type = Uint8Array;\n switch (type) {\n case \"uchar\":\n break;\n case \"schar\":\n _array_type = Int8Array;\n break;\n case \"ushort\":\n _array_type = Uint16Array;\n _chunkSize = 2;\n break;\n case \"sshort\":\n _array_type = Int16Array;\n _chunkSize = 2;\n break;\n case \"uint\":\n _array_type = Uint32Array;\n _chunkSize = 4;\n break;\n case \"sint\":\n _array_type = Int32Array;\n _chunkSize = 4;\n break;\n case \"float\":\n _array_type = Float32Array;\n _chunkSize = 4;\n break;\n case \"complex\":\n _array_type = Float64Array;\n _chunkSize = 8;\n break;\n case \"double\":\n _array_type = Float64Array;\n _chunkSize = 8;\n break;\n }\n let _bytes2 = new _array_type(_data.slice(_dataPointer, _dataPointer += chunks * _chunkSize));\n if (_nativeLittleEndian != _littleEndian) {\n _bytes2 = flipEndianness(_bytes2, _chunkSize);\n }\n if (chunks == 1) {\n return _bytes2[0];\n }\n return _bytes2;\n }\n function flipEndianness(array, chunkSize) {\n const u8 = new Uint8Array(array.buffer, array.byteOffset, array.byteLength);\n for (let i3 = 0; i3 < array.byteLength; i3 += chunkSize) {\n for (let j = i3 + chunkSize - 1, k = i3; j > k; j--, k++) {\n const tmp = u8[k];\n u8[k] = u8[j];\n u8[j] = tmp;\n }\n }\n return array;\n }\n function parseHeader(header) {\n let data2, field, fn, i3, l, m, _i, _len;\n const lines = header.split(/\\r?\\n/);\n for (_i = 0, _len = lines.length; _i < _len; _i++) {\n l = lines[_i];\n if (l.match(/NRRD\\d+/)) {\n headerObject.isNrrd = true;\n } else if (l.match(/^#/))\n ;\n else if (m = l.match(/(.*):(.*)/)) {\n field = m[1].trim();\n data2 = m[2].trim();\n fn = _fieldFunctions[field];\n if (fn) {\n fn.call(headerObject, data2);\n } else {\n headerObject[field] = data2;\n }\n }\n }\n if (!headerObject.isNrrd) {\n throw new Error(\"Not an NRRD file\");\n }\n if (headerObject.encoding === \"bz2\" || headerObject.encoding === \"bzip2\") {\n throw new Error(\"Bzip is not supported\");\n }\n if (!headerObject.vectors) {\n headerObject.vectors = [new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(1, 0, 0), new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 1, 0), new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 0, 1)];\n if (headerObject.spacings) {\n for (i3 = 0; i3 <= 2; i3++) {\n if (!isNaN(headerObject.spacings[i3])) {\n headerObject.vectors[i3].multiplyScalar(headerObject.spacings[i3]);\n }\n }\n }\n }\n }\n function parseDataAsText(data2, start, end) {\n let number = \"\";\n start = start || 0;\n end = end || data2.length;\n let value;\n const lengthOfTheResult = headerObject.sizes.reduce(function(previous, current) {\n return previous * current;\n }, 1);\n let base = 10;\n if (headerObject.encoding === \"hex\") {\n base = 16;\n }\n const result = new headerObject.__array(lengthOfTheResult);\n let resultIndex = 0;\n let parsingFunction = parseInt;\n if (headerObject.__array === Float32Array || headerObject.__array === Float64Array) {\n parsingFunction = parseFloat;\n }\n for (let i3 = start; i3 < end; i3++) {\n value = data2[i3];\n if ((value < 9 || value > 13) && value !== 32) {\n number += String.fromCharCode(value);\n } else {\n if (number !== \"\") {\n result[resultIndex] = parsingFunction(number, base);\n resultIndex++;\n }\n number = \"\";\n }\n }\n if (number !== \"\") {\n result[resultIndex] = parsingFunction(number, base);\n resultIndex++;\n }\n return result;\n }\n const _bytes = scan(\"uchar\", data.byteLength);\n const _length = _bytes.length;\n let _header = null;\n let _data_start = 0;\n let i2;\n for (i2 = 1; i2 < _length; i2++) {\n if (_bytes[i2 - 1] == 10 && _bytes[i2] == 10) {\n _header = this.parseChars(_bytes, 0, i2 - 2);\n _data_start = i2 + 1;\n break;\n }\n }\n parseHeader(_header);\n _data = _bytes.subarray(_data_start);\n if (headerObject.encoding.substring(0, 2) === \"gz\") {\n _data = (0,fflate__WEBPACK_IMPORTED_MODULE_43__.gunzipSync)(new Uint8Array(_data));\n } else if (headerObject.encoding === \"ascii\" || headerObject.encoding === \"text\" || headerObject.encoding === \"txt\" || headerObject.encoding === \"hex\") {\n _data = parseDataAsText(_data);\n } else if (headerObject.encoding === \"raw\") {\n const _copy = new Uint8Array(_data.length);\n for (let i3 = 0; i3 < _data.length; i3++) {\n _copy[i3] = _data[i3];\n }\n _data = _copy;\n }\n _data = _data.buffer;\n const volume = new Volume();\n volume.header = headerObject;\n volume.data = new headerObject.__array(_data);\n const min_max = volume.computeMinMax();\n const min = min_max[0];\n const max = min_max[1];\n volume.windowLow = min;\n volume.windowHigh = max;\n volume.dimensions = [headerObject.sizes[0], headerObject.sizes[1], headerObject.sizes[2]];\n volume.xLength = volume.dimensions[0];\n volume.yLength = volume.dimensions[1];\n volume.zLength = volume.dimensions[2];\n const spacingX = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(\n headerObject.vectors[0][0],\n headerObject.vectors[0][1],\n headerObject.vectors[0][2]\n ).length();\n const spacingY = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(\n headerObject.vectors[1][0],\n headerObject.vectors[1][1],\n headerObject.vectors[1][2]\n ).length();\n const spacingZ = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(\n headerObject.vectors[2][0],\n headerObject.vectors[2][1],\n headerObject.vectors[2][2]\n ).length();\n volume.spacing = [spacingX, spacingY, spacingZ];\n volume.matrix = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n let _spaceX = 1;\n let _spaceY = 1;\n const _spaceZ = 1;\n if (headerObject.space == \"left-posterior-superior\") {\n _spaceX = -1;\n _spaceY = -1;\n } else if (headerObject.space === \"left-anterior-superior\") {\n _spaceX = -1;\n }\n if (!headerObject.vectors) {\n volume.matrix.set(_spaceX, 0, 0, 0, 0, _spaceY, 0, 0, 0, 0, _spaceZ, 0, 0, 0, 0, 1);\n } else {\n const v = headerObject.vectors;\n volume.matrix.set(\n _spaceX * v[0][0],\n _spaceX * v[1][0],\n _spaceX * v[2][0],\n 0,\n _spaceY * v[0][1],\n _spaceY * v[1][1],\n _spaceY * v[2][1],\n 0,\n _spaceZ * v[0][2],\n _spaceZ * v[1][2],\n _spaceZ * v[2][2],\n 0,\n 0,\n 0,\n 0,\n 1\n );\n }\n volume.inverseMatrix = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n volume.inverseMatrix.copy(volume.matrix).invert();\n volume.RASDimensions = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(volume.xLength, volume.yLength, volume.zLength).applyMatrix4(volume.matrix).round().toArray().map(Math.abs);\n if (volume.lowerThreshold === -Infinity) {\n volume.lowerThreshold = min;\n }\n if (volume.upperThreshold === Infinity) {\n volume.upperThreshold = max;\n }\n return volume;\n }\n parseChars(array, start, end) {\n if (start === void 0) {\n start = 0;\n }\n if (end === void 0) {\n end = array.length;\n }\n let output = \"\";\n let i2 = 0;\n for (i2 = start; i2 < end; ++i2) {\n output += String.fromCharCode(array[i2]);\n }\n return output;\n }\n}\nconst _fieldFunctions = {\n type: function(data) {\n switch (data) {\n case \"uchar\":\n case \"unsigned char\":\n case \"uint8\":\n case \"uint8_t\":\n this.__array = Uint8Array;\n break;\n case \"signed char\":\n case \"int8\":\n case \"int8_t\":\n this.__array = Int8Array;\n break;\n case \"short\":\n case \"short int\":\n case \"signed short\":\n case \"signed short int\":\n case \"int16\":\n case \"int16_t\":\n this.__array = Int16Array;\n break;\n case \"ushort\":\n case \"unsigned short\":\n case \"unsigned short int\":\n case \"uint16\":\n case \"uint16_t\":\n this.__array = Uint16Array;\n break;\n case \"int\":\n case \"signed int\":\n case \"int32\":\n case \"int32_t\":\n this.__array = Int32Array;\n break;\n case \"uint\":\n case \"unsigned int\":\n case \"uint32\":\n case \"uint32_t\":\n this.__array = Uint32Array;\n break;\n case \"float\":\n this.__array = Float32Array;\n break;\n case \"double\":\n this.__array = Float64Array;\n break;\n default:\n throw new Error(\"Unsupported NRRD data type: \" + data);\n }\n return this.type = data;\n },\n endian: function(data) {\n return this.endian = data;\n },\n encoding: function(data) {\n return this.encoding = data;\n },\n dimension: function(data) {\n return this.dim = parseInt(data, 10);\n },\n sizes: function(data) {\n let i2;\n return this.sizes = function() {\n const _ref = data.split(/\\s+/);\n const _results = [];\n for (let _i = 0, _len = _ref.length; _i < _len; _i++) {\n i2 = _ref[_i];\n _results.push(parseInt(i2, 10));\n }\n return _results;\n }();\n },\n space: function(data) {\n return this.space = data;\n },\n \"space origin\": function(data) {\n return this.space_origin = data.split(\"(\")[1].split(\")\")[0].split(\",\");\n },\n \"space directions\": function(data) {\n let f, v;\n const parts = data.match(/\\(.*?\\)/g);\n return this.vectors = function() {\n const _results = [];\n for (let _i = 0, _len = parts.length; _i < _len; _i++) {\n v = parts[_i];\n _results.push(\n function() {\n const _ref = v.slice(1, -1).split(/,/);\n const _results2 = [];\n for (let _j = 0, _len2 = _ref.length; _j < _len2; _j++) {\n f = _ref[_j];\n _results2.push(parseFloat(f));\n }\n return _results2;\n }()\n );\n }\n return _results;\n }();\n },\n spacings: function(data) {\n let f;\n const parts = data.split(/\\s+/);\n return this.spacings = function() {\n const _results = [];\n for (let _i = 0, _len = parts.length; _i < _len; _i++) {\n f = parts[_i];\n _results.push(parseFloat(f));\n }\n return _results;\n }();\n }\n};\nclass STLLoader extends three__WEBPACK_IMPORTED_MODULE_42__.Loader {\n constructor(manager) {\n super(manager);\n }\n load(url, onLoad, onProgress, onError) {\n const scope = this;\n const loader = new three__WEBPACK_IMPORTED_MODULE_42__.FileLoader(this.manager);\n loader.setPath(this.path);\n loader.setResponseType(\"arraybuffer\");\n loader.setRequestHeader(this.requestHeader);\n loader.setWithCredentials(this.withCredentials);\n loader.load(\n url,\n function(text) {\n try {\n onLoad(scope.parse(text));\n } catch (e) {\n if (onError) {\n onError(e);\n } else {\n console.error(e);\n }\n scope.manager.itemError(url);\n }\n },\n onProgress,\n onError\n );\n }\n parse(data) {\n function isBinary(data2) {\n const reader = new DataView(data2);\n const face_size = 32 / 8 * 3 + 32 / 8 * 3 * 3 + 16 / 8;\n const n_faces = reader.getUint32(80, true);\n const expect = 80 + 32 / 8 + n_faces * face_size;\n if (expect === reader.byteLength) {\n return true;\n }\n const solid = [115, 111, 108, 105, 100];\n for (let off = 0; off < 5; off++) {\n if (matchDataViewAt(solid, reader, off))\n return false;\n }\n return true;\n }\n function matchDataViewAt(query, reader, offset) {\n for (let i2 = 0, il = query.length; i2 < il; i2++) {\n if (query[i2] !== reader.getUint8(offset + i2, false))\n return false;\n }\n return true;\n }\n function parseBinary(data2) {\n const reader = new DataView(data2);\n const faces = reader.getUint32(80, true);\n let r, g, b2, hasColors = false, colors;\n let defaultR, defaultG, defaultB, alpha;\n for (let index = 0; index < 80 - 10; index++) {\n if (reader.getUint32(index, false) == 1129270351 && reader.getUint8(index + 4) == 82 && reader.getUint8(index + 5) == 61) {\n hasColors = true;\n colors = new Float32Array(faces * 3 * 3);\n defaultR = reader.getUint8(index + 6) / 255;\n defaultG = reader.getUint8(index + 7) / 255;\n defaultB = reader.getUint8(index + 8) / 255;\n alpha = reader.getUint8(index + 9) / 255;\n }\n }\n const dataOffset = 84;\n const faceLength = 12 * 4 + 2;\n const geometry2 = new three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry();\n const vertices = new Float32Array(faces * 3 * 3);\n const normals = new Float32Array(faces * 3 * 3);\n for (let face = 0; face < faces; face++) {\n const start = dataOffset + face * faceLength;\n const normalX = reader.getFloat32(start, true);\n const normalY = reader.getFloat32(start + 4, true);\n const normalZ = reader.getFloat32(start + 8, true);\n if (hasColors) {\n const packedColor = reader.getUint16(start + 48, true);\n if ((packedColor & 32768) === 0) {\n r = (packedColor & 31) / 31;\n g = (packedColor >> 5 & 31) / 31;\n b2 = (packedColor >> 10 & 31) / 31;\n } else {\n r = defaultR;\n g = defaultG;\n b2 = defaultB;\n }\n }\n for (let i2 = 1; i2 <= 3; i2++) {\n const vertexstart = start + i2 * 12;\n const componentIdx = face * 3 * 3 + (i2 - 1) * 3;\n vertices[componentIdx] = reader.getFloat32(vertexstart, true);\n vertices[componentIdx + 1] = reader.getFloat32(vertexstart + 4, true);\n vertices[componentIdx + 2] = reader.getFloat32(vertexstart + 8, true);\n normals[componentIdx] = normalX;\n normals[componentIdx + 1] = normalY;\n normals[componentIdx + 2] = normalZ;\n if (hasColors) {\n colors[componentIdx] = r;\n colors[componentIdx + 1] = g;\n colors[componentIdx + 2] = b2;\n }\n }\n }\n geometry2.setAttribute(\"position\", new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(vertices, 3));\n geometry2.setAttribute(\"normal\", new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(normals, 3));\n if (hasColors) {\n geometry2.setAttribute(\"color\", new three__WEBPACK_IMPORTED_MODULE_42__.BufferAttribute(colors, 3));\n geometry2.hasColors = true;\n geometry2.alpha = alpha;\n }\n return geometry2;\n }\n function parseASCII(data2) {\n const geometry2 = new three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry();\n const patternSolid = /solid([\\s\\S]*?)endsolid/g;\n const patternFace = /facet([\\s\\S]*?)endfacet/g;\n let faceCounter = 0;\n const patternFloat = /[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)/.source;\n const patternVertex = new RegExp(\"vertex\" + patternFloat + patternFloat + patternFloat, \"g\");\n const patternNormal = new RegExp(\"normal\" + patternFloat + patternFloat + patternFloat, \"g\");\n const vertices = [];\n const normals = [];\n const normal = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n let result;\n let groupCount = 0;\n let startVertex = 0;\n let endVertex = 0;\n while ((result = patternSolid.exec(data2)) !== null) {\n startVertex = endVertex;\n const solid = result[0];\n while ((result = patternFace.exec(solid)) !== null) {\n let vertexCountPerFace = 0;\n let normalCountPerFace = 0;\n const text = result[0];\n while ((result = patternNormal.exec(text)) !== null) {\n normal.x = parseFloat(result[1]);\n normal.y = parseFloat(result[2]);\n normal.z = parseFloat(result[3]);\n normalCountPerFace++;\n }\n while ((result = patternVertex.exec(text)) !== null) {\n vertices.push(parseFloat(result[1]), parseFloat(result[2]), parseFloat(result[3]));\n normals.push(normal.x, normal.y, normal.z);\n vertexCountPerFace++;\n endVertex++;\n }\n if (normalCountPerFace !== 1) {\n console.error(\"THREE.STLLoader: Something isn't right with the normal of face number \" + faceCounter);\n }\n if (vertexCountPerFace !== 3) {\n console.error(\"THREE.STLLoader: Something isn't right with the vertices of face number \" + faceCounter);\n }\n faceCounter++;\n }\n const start = startVertex;\n const count = endVertex - startVertex;\n geometry2.addGroup(start, count, groupCount);\n groupCount++;\n }\n geometry2.setAttribute(\"position\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(vertices, 3));\n geometry2.setAttribute(\"normal\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(normals, 3));\n return geometry2;\n }\n function ensureString(buffer) {\n if (typeof buffer !== \"string\") {\n return three__WEBPACK_IMPORTED_MODULE_42__.LoaderUtils.decodeText(new Uint8Array(buffer));\n }\n return buffer;\n }\n function ensureBinary(buffer) {\n if (typeof buffer === \"string\") {\n const array_buffer = new Uint8Array(buffer.length);\n for (let i2 = 0; i2 < buffer.length; i2++) {\n array_buffer[i2] = buffer.charCodeAt(i2) & 255;\n }\n return array_buffer.buffer || array_buffer;\n } else {\n return buffer;\n }\n }\n const binData = ensureBinary(data);\n return isBinary(binData) ? parseBinary(binData) : parseASCII(ensureString(data));\n }\n}\nclass MTLLoader extends three__WEBPACK_IMPORTED_MODULE_42__.Loader {\n constructor(manager) {\n super(manager);\n }\n /**\n * Loads and parses a MTL asset from a URL.\n *\n * @param {String} url - URL to the MTL file.\n * @param {Function} [onLoad] - Callback invoked with the loaded object.\n * @param {Function} [onProgress] - Callback for download progress.\n * @param {Function} [onError] - Callback for download errors.\n *\n * @see setPath setResourcePath\n *\n * @note In order for relative texture references to resolve correctly\n * you must call setResourcePath() explicitly prior to load.\n */\n load(url, onLoad, onProgress, onError) {\n const scope = this;\n const path = this.path === \"\" ? three__WEBPACK_IMPORTED_MODULE_42__.LoaderUtils.extractUrlBase(url) : this.path;\n const loader = new three__WEBPACK_IMPORTED_MODULE_42__.FileLoader(this.manager);\n loader.setPath(this.path);\n loader.setRequestHeader(this.requestHeader);\n loader.setWithCredentials(this.withCredentials);\n loader.load(\n url,\n function(text) {\n try {\n onLoad(scope.parse(text, path));\n } catch (e) {\n if (onError) {\n onError(e);\n } else {\n console.error(e);\n }\n scope.manager.itemError(url);\n }\n },\n onProgress,\n onError\n );\n }\n setMaterialOptions(value) {\n this.materialOptions = value;\n return this;\n }\n /**\n * Parses a MTL file.\n *\n * @param {String} text - Content of MTL file\n * @return {MaterialCreator}\n *\n * @see setPath setResourcePath\n *\n * @note In order for relative texture references to resolve correctly\n * you must call setResourcePath() explicitly prior to parse.\n */\n parse(text, path) {\n const lines = text.split(\"\\n\");\n let info = {};\n const delimiter_pattern = /\\s+/;\n const materialsInfo = {};\n for (let i2 = 0; i2 < lines.length; i2++) {\n let line = lines[i2];\n line = line.trim();\n if (line.length === 0 || line.charAt(0) === \"#\") {\n continue;\n }\n const pos = line.indexOf(\" \");\n let key = pos >= 0 ? line.substring(0, pos) : line;\n key = key.toLowerCase();\n let value = pos >= 0 ? line.substring(pos + 1) : \"\";\n value = value.trim();\n if (key === \"newmtl\") {\n info = { name: value };\n materialsInfo[value] = info;\n } else {\n if (key === \"ka\" || key === \"kd\" || key === \"ks\" || key === \"ke\") {\n const ss = value.split(delimiter_pattern, 3);\n info[key] = [parseFloat(ss[0]), parseFloat(ss[1]), parseFloat(ss[2])];\n } else {\n info[key] = value;\n }\n }\n }\n const materialCreator = new MaterialCreator(this.resourcePath || path, this.materialOptions);\n materialCreator.setCrossOrigin(this.crossOrigin);\n materialCreator.setManager(this.manager);\n materialCreator.setMaterials(materialsInfo);\n return materialCreator;\n }\n}\nclass MaterialCreator {\n constructor(baseUrl = \"\", options = {}) {\n this.baseUrl = baseUrl;\n this.options = options;\n this.materialsInfo = {};\n this.materials = {};\n this.materialsArray = [];\n this.nameLookup = {};\n this.crossOrigin = \"anonymous\";\n this.side = this.options.side !== void 0 ? this.options.side : three__WEBPACK_IMPORTED_MODULE_42__.FrontSide;\n this.wrap = this.options.wrap !== void 0 ? this.options.wrap : three__WEBPACK_IMPORTED_MODULE_42__.RepeatWrapping;\n }\n setCrossOrigin(value) {\n this.crossOrigin = value;\n return this;\n }\n setManager(value) {\n this.manager = value;\n }\n setMaterials(materialsInfo) {\n this.materialsInfo = this.convert(materialsInfo);\n this.materials = {};\n this.materialsArray = [];\n this.nameLookup = {};\n }\n convert(materialsInfo) {\n if (!this.options)\n return materialsInfo;\n const converted = {};\n for (const mn in materialsInfo) {\n const mat = materialsInfo[mn];\n const covmat = {};\n converted[mn] = covmat;\n for (const prop in mat) {\n let save = true;\n let value = mat[prop];\n const lprop = prop.toLowerCase();\n switch (lprop) {\n case \"kd\":\n case \"ka\":\n case \"ks\":\n if (this.options && this.options.normalizeRGB) {\n value = [value[0] / 255, value[1] / 255, value[2] / 255];\n }\n if (this.options && this.options.ignoreZeroRGBs) {\n if (value[0] === 0 && value[1] === 0 && value[2] === 0) {\n save = false;\n }\n }\n break;\n }\n if (save) {\n covmat[lprop] = value;\n }\n }\n }\n return converted;\n }\n preload() {\n for (const mn in this.materialsInfo) {\n this.create(mn);\n }\n }\n getIndex(materialName) {\n return this.nameLookup[materialName];\n }\n getAsArray() {\n let index = 0;\n for (const mn in this.materialsInfo) {\n this.materialsArray[index] = this.create(mn);\n this.nameLookup[mn] = index;\n index++;\n }\n return this.materialsArray;\n }\n create(materialName) {\n if (this.materials[materialName] === void 0) {\n this.createMaterial_(materialName);\n }\n return this.materials[materialName];\n }\n createMaterial_(materialName) {\n const scope = this;\n const mat = this.materialsInfo[materialName];\n const params = {\n name: materialName,\n side: this.side\n };\n function resolveURL(baseUrl, url) {\n if (typeof url !== \"string\" || url === \"\")\n return \"\";\n if (/^https?:\\/\\//i.test(url))\n return url;\n return baseUrl + url;\n }\n function setMapForType(mapType, value) {\n if (params[mapType])\n return;\n const texParams = scope.getTextureParams(value, params);\n const map = scope.loadTexture(resolveURL(scope.baseUrl, texParams.url));\n map.repeat.copy(texParams.scale);\n map.offset.copy(texParams.offset);\n map.wrapS = scope.wrap;\n map.wrapT = scope.wrap;\n params[mapType] = map;\n }\n for (const prop in mat) {\n const value = mat[prop];\n let n;\n if (value === \"\")\n continue;\n switch (prop.toLowerCase()) {\n case \"kd\":\n params.color = new three__WEBPACK_IMPORTED_MODULE_42__.Color().fromArray(value);\n break;\n case \"ks\":\n params.specular = new three__WEBPACK_IMPORTED_MODULE_42__.Color().fromArray(value);\n break;\n case \"ke\":\n params.emissive = new three__WEBPACK_IMPORTED_MODULE_42__.Color().fromArray(value);\n break;\n case \"map_kd\":\n setMapForType(\"map\", value);\n break;\n case \"map_ks\":\n setMapForType(\"specularMap\", value);\n break;\n case \"map_ke\":\n setMapForType(\"emissiveMap\", value);\n break;\n case \"norm\":\n setMapForType(\"normalMap\", value);\n break;\n case \"map_bump\":\n case \"bump\":\n setMapForType(\"bumpMap\", value);\n break;\n case \"map_d\":\n setMapForType(\"alphaMap\", value);\n params.transparent = true;\n break;\n case \"ns\":\n params.shininess = parseFloat(value);\n break;\n case \"d\":\n n = parseFloat(value);\n if (n < 1) {\n params.opacity = n;\n params.transparent = true;\n }\n break;\n case \"tr\":\n n = parseFloat(value);\n if (this.options && this.options.invertTrProperty)\n n = 1 - n;\n if (n > 0) {\n params.opacity = 1 - n;\n params.transparent = true;\n }\n break;\n }\n }\n this.materials[materialName] = new three__WEBPACK_IMPORTED_MODULE_42__.MeshPhongMaterial(params);\n return this.materials[materialName];\n }\n getTextureParams(value, matParams) {\n const texParams = {\n scale: new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(1, 1),\n offset: new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(0, 0)\n };\n const items = value.split(/\\s+/);\n let pos;\n pos = items.indexOf(\"-bm\");\n if (pos >= 0) {\n matParams.bumpScale = parseFloat(items[pos + 1]);\n items.splice(pos, 2);\n }\n pos = items.indexOf(\"-s\");\n if (pos >= 0) {\n texParams.scale.set(parseFloat(items[pos + 1]), parseFloat(items[pos + 2]));\n items.splice(pos, 4);\n }\n pos = items.indexOf(\"-o\");\n if (pos >= 0) {\n texParams.offset.set(parseFloat(items[pos + 1]), parseFloat(items[pos + 2]));\n items.splice(pos, 4);\n }\n texParams.url = items.join(\" \").trim();\n return texParams;\n }\n loadTexture(url, mapping, onLoad, onProgress, onError) {\n const manager = this.manager !== void 0 ? this.manager : three__WEBPACK_IMPORTED_MODULE_42__.DefaultLoadingManager;\n let loader = manager.getHandler(url);\n if (loader === null) {\n loader = new three__WEBPACK_IMPORTED_MODULE_42__.TextureLoader(manager);\n }\n if (loader.setCrossOrigin)\n loader.setCrossOrigin(this.crossOrigin);\n const texture = loader.load(url, onLoad, onProgress, onError);\n if (mapping !== void 0)\n texture.mapping = mapping;\n return texture;\n }\n}\nvar XLoader = /* @__PURE__ */ function() {\n var classCallCheck = function(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n };\n var createClass = function() {\n function defineProperties(target, props) {\n for (let i2 = 0; i2 < props.length; i2++) {\n var descriptor = props[i2];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor)\n descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n return function(Constructor, protoProps, staticProps) {\n if (protoProps)\n defineProperties(Constructor.prototype, protoProps);\n if (staticProps)\n defineProperties(Constructor, staticProps);\n return Constructor;\n };\n }();\n var XboneInf = function XboneInf2() {\n classCallCheck(this, XboneInf2);\n this.boneName = \"\";\n this.BoneIndex = 0;\n this.Indeces = [];\n this.Weights = [];\n this.initMatrix = null;\n this.OffsetMatrix = null;\n };\n var XAnimationInfo = function XAnimationInfo2() {\n classCallCheck(this, XAnimationInfo2);\n this.animeName = \"\";\n this.boneName = \"\";\n this.targetBone = null;\n this.keyType = 4;\n this.frameStartLv = 0;\n this.keyFrames = [];\n this.InverseMx = null;\n };\n var XAnimationObj = function() {\n function XAnimationObj2(_flags) {\n classCallCheck(this, XAnimationObj2);\n this.fps = 30;\n this.name = \"xanimation\";\n this.length = 0;\n this.hierarchy = [];\n this.putFlags = _flags;\n if (this.putFlags.putPos === void 0) {\n this.putFlags.putPos = true;\n }\n if (this.putFlags.putRot === void 0) {\n this.putFlags.putRot = true;\n }\n if (this.putFlags.putScl === void 0) {\n this.putFlags.putScl = true;\n }\n }\n createClass(XAnimationObj2, [\n {\n key: \"make\",\n value: function make(XAnimationInfoArray) {\n for (let i2 = 0; i2 < XAnimationInfoArray.length; i2++) {\n this.hierarchy.push(this.makeBonekeys(XAnimationInfoArray[i2]));\n }\n this.length = this.hierarchy[0].keys[this.hierarchy[0].keys.length - 1].time;\n }\n },\n {\n key: \"clone\",\n value: function clone2() {\n return Object.assign({}, this);\n }\n },\n {\n key: \"makeBonekeys\",\n value: function makeBonekeys(XAnimationInfo2) {\n var refObj = {};\n refObj.name = XAnimationInfo2.boneName;\n refObj.parent = \"\";\n refObj.keys = this.keyFrameRefactor(XAnimationInfo2);\n refObj.copy = function() {\n return Object.assign({}, this);\n };\n return refObj;\n }\n },\n {\n key: \"keyFrameRefactor\",\n value: function keyFrameRefactor(XAnimationInfo2) {\n var keys2 = [];\n for (let i2 = 0; i2 < XAnimationInfo2.keyFrames.length; i2++) {\n var keyframe = {};\n keyframe.time = XAnimationInfo2.keyFrames[i2].time * this.fps;\n if (XAnimationInfo2.keyFrames[i2].pos && this.putFlags.putPos) {\n keyframe.pos = XAnimationInfo2.keyFrames[i2].pos;\n }\n if (XAnimationInfo2.keyFrames[i2].rot && this.putFlags.putRot) {\n keyframe.rot = XAnimationInfo2.keyFrames[i2].rot;\n }\n if (XAnimationInfo2.keyFrames[i2].scl && this.putFlags.putScl) {\n keyframe.scl = XAnimationInfo2.keyFrames[i2].scl;\n }\n if (XAnimationInfo2.keyFrames[i2].matrix) {\n keyframe.matrix = XAnimationInfo2.keyFrames[i2].matrix;\n if (this.putFlags.putPos) {\n keyframe.pos = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3().setFromMatrixPosition(keyframe.matrix);\n }\n if (this.putFlags.putRot) {\n keyframe.rot = new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion().setFromRotationMatrix(keyframe.matrix);\n }\n if (this.putFlags.putScl) {\n keyframe.scl = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3().setFromMatrixScale(keyframe.matrix);\n }\n }\n keys2.push(keyframe);\n }\n return keys2;\n }\n }\n ]);\n return XAnimationObj2;\n }();\n var XKeyFrameInfo = function XKeyFrameInfo2() {\n classCallCheck(this, XKeyFrameInfo2);\n this.index = 0;\n this.Frame = 0;\n this.time = 0;\n this.matrix = null;\n };\n var XLoader2 = function() {\n function XLoader3(manager) {\n three__WEBPACK_IMPORTED_MODULE_42__.Loader.call(this, manager);\n classCallCheck(this, XLoader3);\n this.debug = false;\n this.texloader = new three__WEBPACK_IMPORTED_MODULE_42__.TextureLoader(this.manager);\n this.url = \"\";\n this._putMatLength = 0;\n this._nowMat = null;\n this._nowFrameName = \"\";\n this.frameHierarchie = [];\n this.Hierarchies = {};\n this.HieStack = [];\n this._currentObject = {};\n this._currentFrame = {};\n this._data = null;\n this.onLoad = null;\n this.IsUvYReverse = true;\n this.Meshes = [];\n this.animations = [];\n this.animTicksPerSecond = 30;\n this._currentGeo = null;\n this._currentAnime = null;\n this._currentAnimeFrames = null;\n }\n createClass(XLoader3, [\n {\n key: \"_setArgOption\",\n value: function _setArgOption(_arg) {\n var _start2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;\n if (!_arg) {\n return;\n }\n for (let i2 = _start2; i2 < _arg.length; i2++) {\n switch (i2) {\n case 0:\n this.url = _arg[i2];\n break;\n case 1:\n this.options = _arg[i2];\n break;\n }\n }\n if (this.options === void 0) {\n this.options = {};\n }\n }\n },\n {\n key: \"load\",\n value: function load(_arg, onLoad, onProgress, onError) {\n var _this = this;\n this._setArgOption(_arg);\n var loader = new three__WEBPACK_IMPORTED_MODULE_42__.FileLoader(this.manager);\n loader.setPath(this.path);\n loader.setResponseType(\"arraybuffer\");\n loader.setRequestHeader(this.requestHeader);\n loader.setWithCredentials(this.withCredentials);\n loader.load(\n this.url,\n function(response) {\n try {\n _this.parse(response, onLoad);\n } catch (e) {\n if (onError) {\n onError(e);\n } else {\n console.error(e);\n }\n _this.manager.itemError(_this.url);\n }\n },\n onProgress,\n onError\n );\n }\n },\n {\n key: \"_readLine\",\n value: function _readLine(line) {\n var readed = 0;\n while (true) {\n var find = -1;\n find = line.indexOf(\"//\", readed);\n if (find === -1) {\n find = line.indexOf(\"#\", readed);\n }\n if (find > -1 && find < 2) {\n var foundNewLine = -1;\n foundNewLine = line.indexOf(\"\\r\\n\", readed);\n if (foundNewLine > 0) {\n readed = foundNewLine + 2;\n } else {\n foundNewLine = line.indexOf(\"\\r\", readed);\n if (foundNewLine > 0) {\n readed = foundNewLine + 1;\n } else {\n readed = line.indexOf(\"\\n\", readed) + 1;\n }\n }\n } else {\n break;\n }\n }\n return line.substr(readed);\n }\n },\n {\n key: \"_readLine\",\n value: function _readLine(line) {\n var readed = 0;\n while (true) {\n var find = -1;\n find = line.indexOf(\"//\", readed);\n if (find === -1) {\n find = line.indexOf(\"#\", readed);\n }\n if (find > -1 && find < 2) {\n var foundNewLine = -1;\n foundNewLine = line.indexOf(\"\\r\\n\", readed);\n if (foundNewLine > 0) {\n readed = foundNewLine + 2;\n } else {\n foundNewLine = line.indexOf(\"\\r\", readed);\n if (foundNewLine > 0) {\n readed = foundNewLine + 1;\n } else {\n readed = line.indexOf(\"\\n\", readed) + 1;\n }\n }\n } else {\n break;\n }\n }\n return line.substr(readed);\n }\n },\n {\n key: \"_isBinary\",\n value: function _isBinary(binData) {\n var reader = new DataView(binData);\n var face_size = 32 / 8 * 3 + 32 / 8 * 3 * 3 + 16 / 8;\n var n_faces = reader.getUint32(80, true);\n var expect = 80 + 32 / 8 + n_faces * face_size;\n if (expect === reader.byteLength) {\n return true;\n }\n var fileLength = reader.byteLength;\n for (let index = 0; index < fileLength; index++) {\n if (reader.getUint8(index, false) > 127) {\n return true;\n }\n }\n return false;\n }\n },\n {\n key: \"_ensureBinary\",\n value: function _ensureBinary(buf) {\n if (typeof buf === \"string\") {\n var array_buffer = new Uint8Array(buf.length);\n for (let i2 = 0; i2 < buf.length; i2++) {\n array_buffer[i2] = buf.charCodeAt(i2) & 255;\n }\n return array_buffer.buffer || array_buffer;\n } else {\n return buf;\n }\n }\n },\n {\n key: \"_ensureString\",\n value: function _ensureString(buf) {\n if (typeof buf !== \"string\") {\n return three__WEBPACK_IMPORTED_MODULE_42__.LoaderUtils.decodeText(new Uint8Array(buf));\n } else {\n return buf;\n }\n }\n },\n {\n key: \"parse\",\n value: function _parse(data, onLoad) {\n var binData = this._ensureBinary(data);\n this._data = this._ensureString(data);\n this.onLoad = onLoad;\n return this._isBinary(binData) ? this._parseBinary(binData) : this._parseASCII();\n }\n },\n {\n key: \"_parseBinary\",\n value: function _parseBinary(data) {\n return this._parseASCII(three__WEBPACK_IMPORTED_MODULE_42__.LoaderUtils.decodeText(new Uint8Array(data)));\n }\n },\n {\n key: \"_parseASCII\",\n value: function _parseASCII() {\n var path;\n if (this.resourcePath !== \"\") {\n path = this.resourcePath;\n } else if (this.path !== \"\") {\n path = this.path;\n } else {\n path = three__WEBPACK_IMPORTED_MODULE_42__.LoaderUtils.extractUrlBase(this.url);\n }\n this.texloader.setPath(path).setCrossOrigin(this.crossOrigin);\n var endRead = 16;\n this.Hierarchies.children = [];\n this._hierarchieParse(this.Hierarchies, endRead);\n this._changeRoot();\n this._currentObject = this.Hierarchies.children.shift();\n this._mainloop();\n }\n },\n {\n key: \"_hierarchieParse\",\n value: function _hierarchieParse(_parent, _end2) {\n var endRead = _end2;\n while (true) {\n var find1 = this._data.indexOf(\"{\", endRead) + 1;\n var findEnd = this._data.indexOf(\"}\", endRead);\n var findNext = this._data.indexOf(\"{\", find1) + 1;\n if (find1 > 0 && findEnd > find1) {\n var _currentObject = {};\n _currentObject.children = [];\n var nameData = this._readLine(this._data.substr(endRead, find1 - endRead - 1)).trim();\n var word = nameData.split(/ /g);\n if (word.length > 0) {\n _currentObject.type = word[0];\n if (word.length >= 2) {\n _currentObject.name = word[1];\n } else {\n _currentObject.name = word[0] + this.Hierarchies.children.length;\n }\n } else {\n _currentObject.name = nameData;\n _currentObject.type = \"\";\n }\n if (_currentObject.type === \"Animation\") {\n _currentObject.data = this._data.substr(findNext, findEnd - findNext).trim();\n var refs = this._hierarchieParse(_currentObject, findEnd + 1);\n endRead = refs.end;\n _currentObject.children = refs.parent.children;\n } else {\n var DataEnder = this._data.lastIndexOf(\";\", findNext > 0 ? Math.min(findNext, findEnd) : findEnd);\n _currentObject.data = this._data.substr(find1, DataEnder - find1).trim();\n if (findNext <= 0 || findEnd < findNext) {\n endRead = findEnd + 1;\n } else {\n var nextStart = Math.max(DataEnder + 1, find1);\n var _refs = this._hierarchieParse(_currentObject, nextStart);\n endRead = _refs.end;\n _currentObject.children = _refs.parent.children;\n }\n }\n _currentObject.parent = _parent;\n if (_currentObject.type != \"template\") {\n _parent.children.push(_currentObject);\n }\n } else {\n endRead = find1 === -1 ? this._data.length : findEnd + 1;\n break;\n }\n }\n return {\n parent: _parent,\n end: endRead\n };\n }\n },\n {\n key: \"_mainloop\",\n value: function _mainloop() {\n var _this2 = this;\n this._mainProc();\n if (this._currentObject.parent || this._currentObject.children.length > 0 || !this._currentObject.worked) {\n setTimeout(function() {\n _this2._mainloop();\n }, 1);\n } else {\n setTimeout(function() {\n _this2.onLoad({\n models: _this2.Meshes,\n animations: _this2.animations\n });\n }, 1);\n }\n }\n },\n {\n key: \"_mainProc\",\n value: function _mainProc() {\n var breakFlag = false;\n while (true) {\n if (!this._currentObject.worked) {\n switch (this._currentObject.type) {\n case \"template\":\n break;\n case \"AnimTicksPerSecond\":\n this.animTicksPerSecond = parseInt(this._currentObject.data);\n break;\n case \"Frame\":\n this._setFrame();\n break;\n case \"FrameTransformMatrix\":\n this._setFrameTransformMatrix();\n break;\n case \"Mesh\":\n this._changeRoot();\n this._currentGeo = {};\n this._currentGeo.name = this._currentObject.name.trim();\n this._currentGeo.parentName = this._getParentName(this._currentObject).trim();\n this._currentGeo.VertexSetedBoneCount = [];\n this._currentGeo.GeometryData = {\n vertices: [],\n normals: [],\n uvs: [],\n skinIndices: [],\n skinWeights: [],\n indices: [],\n materialIndices: []\n };\n this._currentGeo.Materials = [];\n this._currentGeo.normalVectors = [];\n this._currentGeo.BoneInfs = [];\n this._currentGeo.baseFrame = this._currentFrame;\n this._makeBoneFrom_CurrentFrame();\n this._readVertexDatas();\n breakFlag = true;\n break;\n case \"MeshNormals\":\n this._readVertexDatas();\n break;\n case \"MeshTextureCoords\":\n this._setMeshTextureCoords();\n break;\n case \"VertexDuplicationIndices\":\n break;\n case \"MeshMaterialList\":\n this._setMeshMaterialList();\n break;\n case \"Material\":\n this._setMaterial();\n break;\n case \"SkinWeights\":\n this._setSkinWeights();\n break;\n case \"AnimationSet\":\n this._changeRoot();\n this._currentAnime = {};\n this._currentAnime.name = this._currentObject.name.trim();\n this._currentAnime.AnimeFrames = [];\n break;\n case \"Animation\":\n if (this._currentAnimeFrames) {\n this._currentAnime.AnimeFrames.push(this._currentAnimeFrames);\n }\n this._currentAnimeFrames = new XAnimationInfo();\n this._currentAnimeFrames.boneName = this._currentObject.data.trim();\n break;\n case \"AnimationKey\":\n this._readAnimationKey();\n breakFlag = true;\n break;\n }\n this._currentObject.worked = true;\n }\n if (this._currentObject.children.length > 0) {\n this._currentObject = this._currentObject.children.shift();\n if (this.debug) {\n console.log(\"processing \" + this._currentObject.name);\n }\n if (breakFlag)\n break;\n } else {\n if (this._currentObject.worked) {\n if (this._currentObject.parent && !this._currentObject.parent.parent) {\n this._changeRoot();\n }\n }\n if (this._currentObject.parent) {\n this._currentObject = this._currentObject.parent;\n } else {\n breakFlag = true;\n }\n if (breakFlag)\n break;\n }\n }\n return;\n }\n },\n {\n key: \"_changeRoot\",\n value: function _changeRoot() {\n if (this._currentGeo != null && this._currentGeo.name) {\n this._makeOutputGeometry();\n }\n this._currentGeo = {};\n if (this._currentAnime != null && this._currentAnime.name) {\n if (this._currentAnimeFrames) {\n this._currentAnime.AnimeFrames.push(this._currentAnimeFrames);\n this._currentAnimeFrames = null;\n }\n this._makeOutputAnimation();\n }\n this._currentAnime = {};\n }\n },\n {\n key: \"_getParentName\",\n value: function _getParentName(_obj2) {\n if (_obj2.parent) {\n if (_obj2.parent.name) {\n return _obj2.parent.name;\n } else {\n return this._getParentName(_obj2.parent);\n }\n } else {\n return \"\";\n }\n }\n },\n {\n key: \"_setFrame\",\n value: function _setFrame() {\n this._nowFrameName = this._currentObject.name.trim();\n this._currentFrame = {};\n this._currentFrame.name = this._nowFrameName;\n this._currentFrame.children = [];\n if (this._currentObject.parent && this._currentObject.parent.name) {\n this._currentFrame.parentName = this._currentObject.parent.name;\n }\n this.frameHierarchie.push(this._nowFrameName);\n this.HieStack[this._nowFrameName] = this._currentFrame;\n }\n },\n {\n key: \"_setFrameTransformMatrix\",\n value: function _setFrameTransformMatrix() {\n this._currentFrame.FrameTransformMatrix = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n var data = this._currentObject.data.split(\",\");\n this._ParseMatrixData(this._currentFrame.FrameTransformMatrix, data);\n this._makeBoneFrom_CurrentFrame();\n }\n },\n {\n key: \"_makeBoneFrom_CurrentFrame\",\n value: function _makeBoneFrom_CurrentFrame() {\n if (!this._currentFrame.FrameTransformMatrix) {\n return;\n }\n var b2 = new three__WEBPACK_IMPORTED_MODULE_42__.Bone();\n b2.name = this._currentFrame.name;\n b2.applyMatrix4(this._currentFrame.FrameTransformMatrix);\n b2.matrixWorld = b2.matrix;\n b2.FrameTransformMatrix = this._currentFrame.FrameTransformMatrix;\n this._currentFrame.putBone = b2;\n if (this._currentFrame.parentName) {\n for (let frame in this.HieStack) {\n if (this.HieStack[frame].name === this._currentFrame.parentName) {\n this.HieStack[frame].putBone.add(this._currentFrame.putBone);\n }\n }\n }\n }\n },\n {\n key: \"_readVertexDatas\",\n value: function _readVertexDatas() {\n var endRead = 0;\n var mode = 0;\n var mode_local = 0;\n var maxLength = 0;\n while (true) {\n var changeMode = false;\n if (mode_local === 0) {\n var refO = this._readInt1(endRead);\n endRead = refO.endRead;\n mode_local = 1;\n maxLength = this._currentObject.data.indexOf(\";;\", endRead) + 1;\n if (maxLength <= 0) {\n maxLength = this._currentObject.data.length;\n }\n } else {\n var find = 0;\n switch (mode) {\n case 0:\n find = this._currentObject.data.indexOf(\",\", endRead) + 1;\n break;\n case 1:\n find = this._currentObject.data.indexOf(\";,\", endRead) + 1;\n break;\n }\n if (find === 0 || find > maxLength) {\n find = maxLength;\n mode_local = 0;\n changeMode = true;\n }\n switch (this._currentObject.type) {\n case \"Mesh\":\n switch (mode) {\n case 0:\n this._readVertex1(this._currentObject.data.substr(endRead, find - endRead));\n break;\n case 1:\n this._readFace1(this._currentObject.data.substr(endRead, find - endRead));\n break;\n }\n break;\n case \"MeshNormals\":\n switch (mode) {\n case 0:\n this._readNormalVector1(this._currentObject.data.substr(endRead, find - endRead));\n break;\n }\n break;\n }\n endRead = find + 1;\n if (changeMode) {\n mode++;\n }\n }\n if (endRead >= this._currentObject.data.length) {\n break;\n }\n }\n }\n },\n {\n key: \"_readInt1\",\n value: function _readInt1(start) {\n var find = this._currentObject.data.indexOf(\";\", start);\n return {\n refI: parseInt(this._currentObject.data.substr(start, find - start)),\n endRead: find + 1\n };\n }\n },\n {\n key: \"_readVertex1\",\n value: function _readVertex1(line) {\n var data = this._readLine(line.trim()).substr(0, line.length - 2).split(\";\");\n this._currentGeo.GeometryData.vertices.push(parseFloat(data[0]), parseFloat(data[1]), parseFloat(data[2]));\n this._currentGeo.GeometryData.skinIndices.push(0, 0, 0, 0);\n this._currentGeo.GeometryData.skinWeights.push(1, 0, 0, 0);\n this._currentGeo.VertexSetedBoneCount.push(0);\n }\n },\n {\n key: \"_readFace1\",\n value: function _readFace1(line) {\n var data = this._readLine(line.trim()).substr(2, line.length - 4).split(\",\");\n this._currentGeo.GeometryData.indices.push(\n parseInt(data[0], 10),\n parseInt(data[1], 10),\n parseInt(data[2], 10)\n );\n }\n },\n {\n key: \"_readNormalVector1\",\n value: function _readNormalVector1(line) {\n var data = this._readLine(line.trim()).substr(0, line.length - 2).split(\";\");\n this._currentGeo.GeometryData.normals.push(parseFloat(data[0]), parseFloat(data[1]), parseFloat(data[2]));\n }\n },\n {\n key: \"_buildGeometry\",\n value: function _buildGeometry() {\n var bufferGeometry = new three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry();\n var position = [];\n var normals = [];\n var uvs = [];\n var skinIndices = [];\n var skinWeights = [];\n var data = this._currentGeo.GeometryData;\n for (let i2 = 0, l = data.indices.length; i2 < l; i2++) {\n var stride2 = data.indices[i2] * 2;\n var stride3 = data.indices[i2] * 3;\n var stride4 = data.indices[i2] * 4;\n position.push(data.vertices[stride3], data.vertices[stride3 + 1], data.vertices[stride3 + 2]);\n normals.push(data.normals[stride3], data.normals[stride3 + 1], data.normals[stride3 + 2]);\n skinIndices.push(\n data.skinIndices[stride4],\n data.skinIndices[stride4 + 1],\n data.skinIndices[stride4 + 2],\n data.skinIndices[stride4 + 3]\n );\n skinWeights.push(\n data.skinWeights[stride4],\n data.skinWeights[stride4 + 1],\n data.skinWeights[stride4 + 2],\n data.skinWeights[stride4 + 3]\n );\n uvs.push(data.uvs[stride2], data.uvs[stride2 + 1]);\n }\n bufferGeometry.setAttribute(\"position\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(position, 3));\n bufferGeometry.setAttribute(\"normal\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(normals, 3));\n bufferGeometry.setAttribute(\"uv\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(uvs, 2));\n bufferGeometry.setAttribute(\"skinIndex\", new three__WEBPACK_IMPORTED_MODULE_42__.Uint16BufferAttribute(skinIndices, 4));\n bufferGeometry.setAttribute(\"skinWeight\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(skinWeights, 4));\n this._computeGroups(bufferGeometry, data.materialIndices);\n return bufferGeometry;\n }\n },\n {\n key: \"_computeGroups\",\n value: function _computeGroups(bufferGeometry, materialIndices) {\n var group;\n var groups = [];\n var materialIndex = void 0;\n for (let i2 = 0; i2 < materialIndices.length; i2++) {\n var currentMaterialIndex = materialIndices[i2];\n if (currentMaterialIndex !== materialIndex) {\n materialIndex = currentMaterialIndex;\n if (group !== void 0) {\n group.count = i2 * 3 - group.start;\n groups.push(group);\n }\n group = {\n start: i2 * 3,\n materialIndex\n };\n }\n }\n if (group !== void 0) {\n group.count = i * 3 - group.start;\n groups.push(group);\n }\n bufferGeometry.groups = groups;\n }\n },\n {\n key: \"_setMeshTextureCoords\",\n value: function _setMeshTextureCoords() {\n var endRead = 0;\n var mode = 0;\n var mode_local = 0;\n while (true) {\n switch (mode) {\n case 0:\n if (mode_local === 0) {\n var refO = this._readInt1(0);\n endRead = refO.endRead;\n mode_local = 1;\n } else {\n var find = this._currentObject.data.indexOf(\",\", endRead) + 1;\n if (find === 0) {\n find = this._currentObject.data.length;\n mode = 2;\n mode_local = 0;\n }\n var line = this._currentObject.data.substr(endRead, find - endRead);\n var data = this._readLine(line.trim()).split(\";\");\n if (this.IsUvYReverse) {\n this._currentGeo.GeometryData.uvs.push(parseFloat(data[0]), 1 - parseFloat(data[1]));\n } else {\n this._currentGeo.GeometryData.uvs.push(parseFloat(data[0]), parseFloat(data[1]));\n }\n endRead = find + 1;\n }\n break;\n }\n if (endRead >= this._currentObject.data.length) {\n break;\n }\n }\n }\n },\n {\n key: \"_setMeshMaterialList\",\n value: function _setMeshMaterialList() {\n var endRead = 0;\n var mode = 0;\n var mode_local = 0;\n while (true) {\n if (mode_local < 2) {\n var refO = this._readInt1(endRead);\n endRead = refO.endRead;\n mode_local++;\n } else {\n var find = this._currentObject.data.indexOf(\";\", endRead);\n if (find === -1) {\n find = this._currentObject.data.length;\n mode = 3;\n mode_local = 0;\n }\n var line = this._currentObject.data.substr(endRead, find - endRead);\n var data = this._readLine(line.trim()).split(\",\");\n for (let i2 = 0; i2 < data.length; i2++) {\n this._currentGeo.GeometryData.materialIndices[i2] = parseInt(data[i2]);\n }\n endRead = this._currentObject.data.length;\n }\n if (endRead >= this._currentObject.data.length || mode >= 3) {\n break;\n }\n }\n }\n },\n {\n key: \"_setMaterial\",\n value: function _setMaterial() {\n var _nowMat = new three__WEBPACK_IMPORTED_MODULE_42__.MeshPhongMaterial({\n color: Math.random() * 16777215\n });\n _nowMat.side = three__WEBPACK_IMPORTED_MODULE_42__.FrontSide;\n _nowMat.name = this._currentObject.name;\n var endRead = 0;\n var find = this._currentObject.data.indexOf(\";;\", endRead);\n var line = this._currentObject.data.substr(endRead, find - endRead);\n var data = this._readLine(line.trim()).split(\";\");\n _nowMat.color.r = parseFloat(data[0]);\n _nowMat.color.g = parseFloat(data[1]);\n _nowMat.color.b = parseFloat(data[2]);\n endRead = find + 2;\n find = this._currentObject.data.indexOf(\";\", endRead);\n line = this._currentObject.data.substr(endRead, find - endRead);\n _nowMat.shininess = parseFloat(this._readLine(line));\n endRead = find + 1;\n find = this._currentObject.data.indexOf(\";;\", endRead);\n line = this._currentObject.data.substr(endRead, find - endRead);\n var data2 = this._readLine(line.trim()).split(\";\");\n _nowMat.specular.r = parseFloat(data2[0]);\n _nowMat.specular.g = parseFloat(data2[1]);\n _nowMat.specular.b = parseFloat(data2[2]);\n endRead = find + 2;\n find = this._currentObject.data.indexOf(\";;\", endRead);\n if (find === -1) {\n find = this._currentObject.data.length;\n }\n line = this._currentObject.data.substr(endRead, find - endRead);\n var data3 = this._readLine(line.trim()).split(\";\");\n _nowMat.emissive.r = parseFloat(data3[0]);\n _nowMat.emissive.g = parseFloat(data3[1]);\n _nowMat.emissive.b = parseFloat(data3[2]);\n var localObject = null;\n while (true) {\n if (this._currentObject.children.length > 0) {\n localObject = this._currentObject.children.shift();\n if (this.debug) {\n console.log(\"processing \" + localObject.name);\n }\n var fileName = localObject.data.substr(1, localObject.data.length - 2);\n switch (localObject.type) {\n case \"TextureFilename\":\n _nowMat.map = this.texloader.load(fileName);\n break;\n case \"BumpMapFilename\":\n _nowMat.bumpMap = this.texloader.load(fileName);\n _nowMat.bumpScale = 0.05;\n break;\n case \"NormalMapFilename\":\n _nowMat.normalMap = this.texloader.load(fileName);\n _nowMat.normalScale = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(2, 2);\n break;\n case \"EmissiveMapFilename\":\n _nowMat.emissiveMap = this.texloader.load(fileName);\n break;\n case \"LightMapFilename\":\n _nowMat.lightMap = this.texloader.load(fileName);\n break;\n }\n } else {\n break;\n }\n }\n this._currentGeo.Materials.push(_nowMat);\n }\n },\n {\n key: \"_setSkinWeights\",\n value: function _setSkinWeights() {\n var boneInf = new XboneInf();\n var endRead = 0;\n var find = this._currentObject.data.indexOf(\";\", endRead);\n var line = this._currentObject.data.substr(endRead, find - endRead);\n endRead = find + 1;\n boneInf.boneName = line.substr(1, line.length - 2);\n boneInf.BoneIndex = this._currentGeo.BoneInfs.length;\n find = this._currentObject.data.indexOf(\";\", endRead);\n endRead = find + 1;\n find = this._currentObject.data.indexOf(\";\", endRead);\n line = this._currentObject.data.substr(endRead, find - endRead);\n var data = this._readLine(line.trim()).split(\",\");\n for (let i2 = 0; i2 < data.length; i2++) {\n boneInf.Indeces.push(parseInt(data[i2]));\n }\n endRead = find + 1;\n find = this._currentObject.data.indexOf(\";\", endRead);\n line = this._currentObject.data.substr(endRead, find - endRead);\n var data2 = this._readLine(line.trim()).split(\",\");\n for (let _i = 0; _i < data2.length; _i++) {\n boneInf.Weights.push(parseFloat(data2[_i]));\n }\n endRead = find + 1;\n find = this._currentObject.data.indexOf(\";\", endRead);\n if (find <= 0) {\n find = this._currentObject.data.length;\n }\n line = this._currentObject.data.substr(endRead, find - endRead);\n var data3 = this._readLine(line.trim()).split(\",\");\n boneInf.OffsetMatrix = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n this._ParseMatrixData(boneInf.OffsetMatrix, data3);\n this._currentGeo.BoneInfs.push(boneInf);\n }\n },\n {\n key: \"_makePutBoneList\",\n value: function _makePutBoneList(_RootName, _bones) {\n var putting = false;\n for (let frame in this.HieStack) {\n if (this.HieStack[frame].name === _RootName || putting) {\n putting = true;\n var b2 = new three__WEBPACK_IMPORTED_MODULE_42__.Bone();\n b2.name = this.HieStack[frame].name;\n b2.applyMatrix4(this.HieStack[frame].FrameTransformMatrix);\n b2.matrixWorld = b2.matrix;\n b2.FrameTransformMatrix = this.HieStack[frame].FrameTransformMatrix;\n b2.pos = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3().setFromMatrixPosition(b2.FrameTransformMatrix).toArray();\n b2.rotq = new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion().setFromRotationMatrix(b2.FrameTransformMatrix).toArray();\n b2.scl = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3().setFromMatrixScale(b2.FrameTransformMatrix).toArray();\n if (this.HieStack[frame].parentName && this.HieStack[frame].parentName.length > 0) {\n for (let i2 = 0; i2 < _bones.length; i2++) {\n if (this.HieStack[frame].parentName === _bones[i2].name) {\n _bones[i2].add(b2);\n b2.parent = i2;\n break;\n }\n }\n }\n _bones.push(b2);\n }\n }\n }\n },\n {\n key: \"_makeOutputGeometry\",\n value: function _makeOutputGeometry() {\n var mesh = null;\n if (this._currentGeo.BoneInfs.length > 0) {\n var putBones = [];\n this._makePutBoneList(this._currentGeo.baseFrame.parentName, putBones);\n for (let bi = 0; bi < this._currentGeo.BoneInfs.length; bi++) {\n var boneIndex = 0;\n for (let bb = 0; bb < putBones.length; bb++) {\n if (putBones[bb].name === this._currentGeo.BoneInfs[bi].boneName) {\n boneIndex = bb;\n putBones[bb].OffsetMatrix = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n putBones[bb].OffsetMatrix.copy(this._currentGeo.BoneInfs[bi].OffsetMatrix);\n break;\n }\n }\n for (let vi = 0; vi < this._currentGeo.BoneInfs[bi].Indeces.length; vi++) {\n var nowVertexID = this._currentGeo.BoneInfs[bi].Indeces[vi];\n var nowVal = this._currentGeo.BoneInfs[bi].Weights[vi];\n var stride = nowVertexID * 4;\n switch (this._currentGeo.VertexSetedBoneCount[nowVertexID]) {\n case 0:\n this._currentGeo.GeometryData.skinIndices[stride] = boneIndex;\n this._currentGeo.GeometryData.skinWeights[stride] = nowVal;\n break;\n case 1:\n this._currentGeo.GeometryData.skinIndices[stride + 1] = boneIndex;\n this._currentGeo.GeometryData.skinWeights[stride + 1] = nowVal;\n break;\n case 2:\n this._currentGeo.GeometryData.skinIndices[stride + 2] = boneIndex;\n this._currentGeo.GeometryData.skinWeights[stride + 2] = nowVal;\n break;\n case 3:\n this._currentGeo.GeometryData.skinIndices[stride + 3] = boneIndex;\n this._currentGeo.GeometryData.skinWeights[stride + 3] = nowVal;\n break;\n }\n this._currentGeo.VertexSetedBoneCount[nowVertexID]++;\n if (this._currentGeo.VertexSetedBoneCount[nowVertexID] > 4) {\n console.log(\"warn! over 4 bone weight! :\" + nowVertexID);\n }\n }\n }\n for (let sk = 0; sk < this._currentGeo.Materials.length; sk++) {\n this._currentGeo.Materials[sk].skinning = true;\n }\n var offsetList = [];\n for (let _bi = 0; _bi < putBones.length; _bi++) {\n if (putBones[_bi].OffsetMatrix) {\n offsetList.push(putBones[_bi].OffsetMatrix);\n } else {\n offsetList.push(new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4());\n }\n }\n var bufferGeometry = this._buildGeometry();\n mesh = new three__WEBPACK_IMPORTED_MODULE_42__.SkinnedMesh(\n bufferGeometry,\n this._currentGeo.Materials.length === 1 ? this._currentGeo.Materials[0] : this._currentGeo.Materials\n );\n this._initSkeleton(mesh, putBones, offsetList);\n } else {\n var _bufferGeometry = this._buildGeometry();\n mesh = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(\n _bufferGeometry,\n this._currentGeo.Materials.length === 1 ? this._currentGeo.Materials[0] : this._currentGeo.Materials\n );\n }\n mesh.name = this._currentGeo.name;\n var worldBaseMx = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n var currentMxFrame = this._currentGeo.baseFrame.putBone;\n if (currentMxFrame && currentMxFrame.parent) {\n while (true) {\n currentMxFrame = currentMxFrame.parent;\n if (currentMxFrame) {\n worldBaseMx.multiply(currentMxFrame.FrameTransformMatrix);\n } else {\n break;\n }\n }\n mesh.applyMatrix4(worldBaseMx);\n }\n this.Meshes.push(mesh);\n }\n },\n {\n key: \"_initSkeleton\",\n value: function _initSkeleton(mesh, boneList, boneInverses) {\n var bones = [], bone, gbone;\n var i2, il;\n for (i2 = 0, il = boneList.length; i2 < il; i2++) {\n gbone = boneList[i2];\n bone = new three__WEBPACK_IMPORTED_MODULE_42__.Bone();\n bones.push(bone);\n bone.name = gbone.name;\n bone.position.fromArray(gbone.pos);\n bone.quaternion.fromArray(gbone.rotq);\n if (gbone.scl !== void 0)\n bone.scale.fromArray(gbone.scl);\n }\n for (i2 = 0, il = boneList.length; i2 < il; i2++) {\n gbone = boneList[i2];\n if (gbone.parent !== -1 && gbone.parent !== null && bones[gbone.parent] !== void 0) {\n bones[gbone.parent].add(bones[i2]);\n } else {\n mesh.add(bones[i2]);\n }\n }\n mesh.updateMatrixWorld(true);\n var skeleton = new three__WEBPACK_IMPORTED_MODULE_42__.Skeleton(bones, boneInverses);\n mesh.bind(skeleton, mesh.matrixWorld);\n }\n },\n {\n key: \"_readAnimationKey\",\n value: function _readAnimationKey() {\n var endRead = 0;\n var find = this._currentObject.data.indexOf(\";\", endRead);\n var line = this._currentObject.data.substr(endRead, find - endRead);\n endRead = find + 1;\n var nowKeyType = parseInt(this._readLine(line));\n find = this._currentObject.data.indexOf(\";\", endRead);\n endRead = find + 1;\n line = this._currentObject.data.substr(endRead);\n var data = this._readLine(line.trim()).split(\";;,\");\n for (let i2 = 0; i2 < data.length; i2++) {\n var data2 = data[i2].split(\";\");\n var keyInfo = new XKeyFrameInfo();\n keyInfo.type = nowKeyType;\n keyInfo.Frame = parseInt(data2[0]);\n keyInfo.index = this._currentAnimeFrames.keyFrames.length;\n keyInfo.time = keyInfo.Frame;\n if (nowKeyType != 4) {\n var frameFound = false;\n for (let mm = 0; mm < this._currentAnimeFrames.keyFrames.length; mm++) {\n if (this._currentAnimeFrames.keyFrames[mm].Frame === keyInfo.Frame) {\n keyInfo = this._currentAnimeFrames.keyFrames[mm];\n frameFound = true;\n break;\n }\n }\n var frameValue = data2[2].split(\",\");\n switch (nowKeyType) {\n case 0:\n keyInfo.rot = new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion(\n parseFloat(frameValue[1]),\n parseFloat(frameValue[2]),\n parseFloat(frameValue[3]),\n parseFloat(frameValue[0]) * -1\n );\n break;\n case 1:\n keyInfo.scl = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(\n parseFloat(frameValue[0]),\n parseFloat(frameValue[1]),\n parseFloat(frameValue[2])\n );\n break;\n case 2:\n keyInfo.pos = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(\n parseFloat(frameValue[0]),\n parseFloat(frameValue[1]),\n parseFloat(frameValue[2])\n );\n break;\n }\n if (!frameFound) {\n this._currentAnimeFrames.keyFrames.push(keyInfo);\n }\n } else {\n keyInfo.matrix = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n this._ParseMatrixData(keyInfo.matrix, data2[2].split(\",\"));\n this._currentAnimeFrames.keyFrames.push(keyInfo);\n }\n }\n }\n },\n {\n key: \"_makeOutputAnimation\",\n value: function _makeOutputAnimation() {\n var animationObj = new XAnimationObj(this.options);\n animationObj.fps = this.animTicksPerSecond;\n animationObj.name = this._currentAnime.name;\n animationObj.make(this._currentAnime.AnimeFrames);\n this.animations.push(animationObj);\n }\n },\n {\n key: \"assignAnimation\",\n value: function assignAnimation(_model, _animation) {\n var model2 = _model;\n var animation = _animation;\n if (!model2) {\n model2 = this.Meshes[0];\n }\n if (!animation) {\n animation = this.animations[0];\n }\n if (!model2 || !animation) {\n return null;\n }\n var put = {};\n put.fps = animation.fps;\n put.name = animation.name;\n put.length = animation.length;\n put.hierarchy = [];\n for (let b2 = 0; b2 < model2.skeleton.bones.length; b2++) {\n var findAnimation = false;\n for (let i2 = 0; i2 < animation.hierarchy.length; i2++) {\n if (model2.skeleton.bones[b2].name === animation.hierarchy[i2].name) {\n findAnimation = true;\n var c_key = animation.hierarchy[i2].copy();\n c_key.parent = -1;\n if (model2.skeleton.bones[b2].parent && model2.skeleton.bones[b2].parent.type === \"Bone\") {\n for (let bb = 0; bb < put.hierarchy.length; bb++) {\n if (put.hierarchy[bb].name === model2.skeleton.bones[b2].parent.name) {\n c_key.parent = bb;\n c_key.parentName = model2.skeleton.bones[b2].parent.name;\n }\n }\n }\n put.hierarchy.push(c_key);\n break;\n }\n }\n if (!findAnimation) {\n var _c_key = animation.hierarchy[0].copy();\n _c_key.name = model2.skeleton.bones[b2].name;\n _c_key.parent = -1;\n for (let k = 0; k < _c_key.keys.length; k++) {\n if (_c_key.keys[k].pos) {\n _c_key.keys[k].pos.set(0, 0, 0);\n }\n if (_c_key.keys[k].scl) {\n _c_key.keys[k].scl.set(1, 1, 1);\n }\n if (_c_key.keys[k].rot) {\n _c_key.keys[k].rot.set(0, 0, 0, 1);\n }\n }\n put.hierarchy.push(_c_key);\n }\n }\n if (!model2.geometry.animations) {\n model2.geometry.animations = [];\n }\n model2.geometry.animations.push(three__WEBPACK_IMPORTED_MODULE_42__.AnimationClip.parseAnimation(put, model2.skeleton.bones));\n if (!model2.animationMixer) {\n model2.animationMixer = new three__WEBPACK_IMPORTED_MODULE_42__.AnimationMixer(model2);\n }\n return put;\n }\n },\n {\n key: \"_ParseMatrixData\",\n value: function _ParseMatrixData(targetMatrix, data) {\n targetMatrix.set(\n parseFloat(data[0]),\n parseFloat(data[4]),\n parseFloat(data[8]),\n parseFloat(data[12]),\n parseFloat(data[1]),\n parseFloat(data[5]),\n parseFloat(data[9]),\n parseFloat(data[13]),\n parseFloat(data[2]),\n parseFloat(data[6]),\n parseFloat(data[10]),\n parseFloat(data[14]),\n parseFloat(data[3]),\n parseFloat(data[7]),\n parseFloat(data[11]),\n parseFloat(data[15])\n );\n }\n }\n ]);\n return XLoader3;\n }();\n return XLoader2;\n}();\nclass BVHLoader extends three__WEBPACK_IMPORTED_MODULE_42__.Loader {\n constructor(manager) {\n super(manager);\n this.animateBonePositions = true;\n this.animateBoneRotations = true;\n }\n load(url, onLoad, onProgress, onError) {\n const scope = this;\n const loader = new three__WEBPACK_IMPORTED_MODULE_42__.FileLoader(scope.manager);\n loader.setPath(scope.path);\n loader.setRequestHeader(scope.requestHeader);\n loader.setWithCredentials(scope.withCredentials);\n loader.load(\n url,\n function(text) {\n try {\n onLoad(scope.parse(text));\n } catch (e) {\n if (onError) {\n onError(e);\n } else {\n console.error(e);\n }\n scope.manager.itemError(url);\n }\n },\n onProgress,\n onError\n );\n }\n parse(text) {\n function readBvh(lines2) {\n if (nextLine(lines2) !== \"HIERARCHY\") {\n console.error(\"THREE.BVHLoader: HIERARCHY expected.\");\n }\n const list = [];\n const root = readNode(lines2, nextLine(lines2), list);\n if (nextLine(lines2) !== \"MOTION\") {\n console.error(\"THREE.BVHLoader: MOTION expected.\");\n }\n let tokens2 = nextLine(lines2).split(/[\\s]+/);\n const numFrames = parseInt(tokens2[1]);\n if (isNaN(numFrames)) {\n console.error(\"THREE.BVHLoader: Failed to read number of frames.\");\n }\n tokens2 = nextLine(lines2).split(/[\\s]+/);\n const frameTime = parseFloat(tokens2[2]);\n if (isNaN(frameTime)) {\n console.error(\"THREE.BVHLoader: Failed to read frame time.\");\n }\n for (let i2 = 0; i2 < numFrames; i2++) {\n tokens2 = nextLine(lines2).split(/[\\s]+/);\n readFrameData(tokens2, i2 * frameTime, root);\n }\n return list;\n }\n function readFrameData(data, frameTime, bone) {\n if (bone.type === \"ENDSITE\")\n return;\n const keyframe = {\n time: frameTime,\n position: new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(),\n rotation: new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion()\n };\n bone.frames.push(keyframe);\n const quat = new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion();\n const vx = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(1, 0, 0);\n const vy = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 1, 0);\n const vz = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(0, 0, 1);\n for (let i2 = 0; i2 < bone.channels.length; i2++) {\n switch (bone.channels[i2]) {\n case \"Xposition\":\n keyframe.position.x = parseFloat(data.shift().trim());\n break;\n case \"Yposition\":\n keyframe.position.y = parseFloat(data.shift().trim());\n break;\n case \"Zposition\":\n keyframe.position.z = parseFloat(data.shift().trim());\n break;\n case \"Xrotation\":\n quat.setFromAxisAngle(vx, parseFloat(data.shift().trim()) * Math.PI / 180);\n keyframe.rotation.multiply(quat);\n break;\n case \"Yrotation\":\n quat.setFromAxisAngle(vy, parseFloat(data.shift().trim()) * Math.PI / 180);\n keyframe.rotation.multiply(quat);\n break;\n case \"Zrotation\":\n quat.setFromAxisAngle(vz, parseFloat(data.shift().trim()) * Math.PI / 180);\n keyframe.rotation.multiply(quat);\n break;\n default:\n console.warn(\"THREE.BVHLoader: Invalid channel type.\");\n }\n }\n for (let i2 = 0; i2 < bone.children.length; i2++) {\n readFrameData(data, frameTime, bone.children[i2]);\n }\n }\n function readNode(lines2, firstline, list) {\n const node = { name: \"\", type: \"\", frames: [] };\n list.push(node);\n let tokens2 = firstline.split(/[\\s]+/);\n if (tokens2[0].toUpperCase() === \"END\" && tokens2[1].toUpperCase() === \"SITE\") {\n node.type = \"ENDSITE\";\n node.name = \"ENDSITE\";\n } else {\n node.name = tokens2[1];\n node.type = tokens2[0].toUpperCase();\n }\n if (nextLine(lines2) !== \"{\") {\n console.error(\"THREE.BVHLoader: Expected opening { after type & name\");\n }\n tokens2 = nextLine(lines2).split(/[\\s]+/);\n if (tokens2[0] !== \"OFFSET\") {\n console.error(\"THREE.BVHLoader: Expected OFFSET but got: \" + tokens2[0]);\n }\n if (tokens2.length !== 4) {\n console.error(\"THREE.BVHLoader: Invalid number of values for OFFSET.\");\n }\n const offset = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(parseFloat(tokens2[1]), parseFloat(tokens2[2]), parseFloat(tokens2[3]));\n if (isNaN(offset.x) || isNaN(offset.y) || isNaN(offset.z)) {\n console.error(\"THREE.BVHLoader: Invalid values of OFFSET.\");\n }\n node.offset = offset;\n if (node.type !== \"ENDSITE\") {\n tokens2 = nextLine(lines2).split(/[\\s]+/);\n if (tokens2[0] !== \"CHANNELS\") {\n console.error(\"THREE.BVHLoader: Expected CHANNELS definition.\");\n }\n const numChannels = parseInt(tokens2[1]);\n node.channels = tokens2.splice(2, numChannels);\n node.children = [];\n }\n while (true) {\n const line = nextLine(lines2);\n if (line === \"}\") {\n return node;\n } else {\n node.children.push(readNode(lines2, line, list));\n }\n }\n }\n function toTHREEBone(source, list) {\n const bone = new three__WEBPACK_IMPORTED_MODULE_42__.Bone();\n list.push(bone);\n bone.position.add(source.offset);\n bone.name = source.name;\n if (source.type !== \"ENDSITE\") {\n for (let i2 = 0; i2 < source.children.length; i2++) {\n bone.add(toTHREEBone(source.children[i2], list));\n }\n }\n return bone;\n }\n function toTHREEAnimation(bones2) {\n const tracks = [];\n for (let i2 = 0; i2 < bones2.length; i2++) {\n const bone = bones2[i2];\n if (bone.type === \"ENDSITE\")\n continue;\n const times = [];\n const positions = [];\n const rotations = [];\n for (let j = 0; j < bone.frames.length; j++) {\n const frame = bone.frames[j];\n times.push(frame.time);\n positions.push(frame.position.x + bone.offset.x);\n positions.push(frame.position.y + bone.offset.y);\n positions.push(frame.position.z + bone.offset.z);\n rotations.push(frame.rotation.x);\n rotations.push(frame.rotation.y);\n rotations.push(frame.rotation.z);\n rotations.push(frame.rotation.w);\n }\n if (scope.animateBonePositions) {\n tracks.push(new three__WEBPACK_IMPORTED_MODULE_42__.VectorKeyframeTrack(\".bones[\" + bone.name + \"].position\", times, positions));\n }\n if (scope.animateBoneRotations) {\n tracks.push(new three__WEBPACK_IMPORTED_MODULE_42__.QuaternionKeyframeTrack(\".bones[\" + bone.name + \"].quaternion\", times, rotations));\n }\n }\n return new three__WEBPACK_IMPORTED_MODULE_42__.AnimationClip(\"animation\", -1, tracks);\n }\n function nextLine(lines2) {\n let line;\n while ((line = lines2.shift().trim()).length === 0) {\n }\n return line;\n }\n const scope = this;\n const lines = text.split(/[\\r\\n]+/g);\n const bones = readBvh(lines);\n const threeBones = [];\n toTHREEBone(bones[0], threeBones);\n const threeClip = toTHREEAnimation(bones);\n return {\n skeleton: new three__WEBPACK_IMPORTED_MODULE_42__.Skeleton(threeBones),\n clip: threeClip\n };\n }\n}\nclass ColladaLoader extends three__WEBPACK_IMPORTED_MODULE_42__.Loader {\n constructor(manager) {\n super(manager);\n }\n load(url, onLoad, onProgress, onError) {\n const scope = this;\n const path = scope.path === \"\" ? three__WEBPACK_IMPORTED_MODULE_42__.LoaderUtils.extractUrlBase(url) : scope.path;\n const loader = new three__WEBPACK_IMPORTED_MODULE_42__.FileLoader(scope.manager);\n loader.setPath(scope.path);\n loader.setRequestHeader(scope.requestHeader);\n loader.setWithCredentials(scope.withCredentials);\n loader.load(\n url,\n function(text) {\n try {\n onLoad(scope.parse(text, path));\n } catch (e) {\n if (onError) {\n onError(e);\n } else {\n console.error(e);\n }\n scope.manager.itemError(url);\n }\n },\n onProgress,\n onError\n );\n }\n parse(text, path) {\n function getElementsByTagName(xml2, name) {\n const array = [];\n const childNodes = xml2.childNodes;\n for (let i2 = 0, l = childNodes.length; i2 < l; i2++) {\n const child = childNodes[i2];\n if (child.nodeName === name) {\n array.push(child);\n }\n }\n return array;\n }\n function parseStrings(text2) {\n if (text2.length === 0)\n return [];\n const parts = text2.trim().split(/\\s+/);\n const array = new Array(parts.length);\n for (let i2 = 0, l = parts.length; i2 < l; i2++) {\n array[i2] = parts[i2];\n }\n return array;\n }\n function parseFloats(text2) {\n if (text2.length === 0)\n return [];\n const parts = text2.trim().split(/\\s+/);\n const array = new Array(parts.length);\n for (let i2 = 0, l = parts.length; i2 < l; i2++) {\n array[i2] = parseFloat(parts[i2]);\n }\n return array;\n }\n function parseInts(text2) {\n if (text2.length === 0)\n return [];\n const parts = text2.trim().split(/\\s+/);\n const array = new Array(parts.length);\n for (let i2 = 0, l = parts.length; i2 < l; i2++) {\n array[i2] = parseInt(parts[i2]);\n }\n return array;\n }\n function parseId(text2) {\n return text2.substring(1);\n }\n function generateId() {\n return \"three_default_\" + count++;\n }\n function isEmpty(object) {\n return Object.keys(object).length === 0;\n }\n function parseAsset(xml2) {\n return {\n unit: parseAssetUnit(getElementsByTagName(xml2, \"unit\")[0]),\n upAxis: parseAssetUpAxis(getElementsByTagName(xml2, \"up_axis\")[0])\n };\n }\n function parseAssetUnit(xml2) {\n if (xml2 !== void 0 && xml2.hasAttribute(\"meter\") === true) {\n return parseFloat(xml2.getAttribute(\"meter\"));\n } else {\n return 1;\n }\n }\n function parseAssetUpAxis(xml2) {\n return xml2 !== void 0 ? xml2.textContent : \"Y_UP\";\n }\n function parseLibrary(xml2, libraryName, nodeName, parser2) {\n const library2 = getElementsByTagName(xml2, libraryName)[0];\n if (library2 !== void 0) {\n const elements = getElementsByTagName(library2, nodeName);\n for (let i2 = 0; i2 < elements.length; i2++) {\n parser2(elements[i2]);\n }\n }\n }\n function buildLibrary(data, builder) {\n for (const name in data) {\n const object = data[name];\n object.build = builder(data[name]);\n }\n }\n function getBuild(data, builder) {\n if (data.build !== void 0)\n return data.build;\n data.build = builder(data);\n return data.build;\n }\n function parseAnimation(xml2) {\n const data = {\n sources: {},\n samplers: {},\n channels: {}\n };\n let hasChildren = false;\n for (let i2 = 0, l = xml2.childNodes.length; i2 < l; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n let id;\n switch (child.nodeName) {\n case \"source\":\n id = child.getAttribute(\"id\");\n data.sources[id] = parseSource(child);\n break;\n case \"sampler\":\n id = child.getAttribute(\"id\");\n data.samplers[id] = parseAnimationSampler(child);\n break;\n case \"channel\":\n id = child.getAttribute(\"target\");\n data.channels[id] = parseAnimationChannel(child);\n break;\n case \"animation\":\n parseAnimation(child);\n hasChildren = true;\n break;\n default:\n console.log(child);\n }\n }\n if (hasChildren === false) {\n library.animations[xml2.getAttribute(\"id\") || three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.generateUUID()] = data;\n }\n }\n function parseAnimationSampler(xml2) {\n const data = {\n inputs: {}\n };\n for (let i2 = 0, l = xml2.childNodes.length; i2 < l; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"input\":\n const id = parseId(child.getAttribute(\"source\"));\n const semantic = child.getAttribute(\"semantic\");\n data.inputs[semantic] = id;\n break;\n }\n }\n return data;\n }\n function parseAnimationChannel(xml2) {\n const data = {};\n const target = xml2.getAttribute(\"target\");\n let parts = target.split(\"/\");\n const id = parts.shift();\n let sid = parts.shift();\n const arraySyntax = sid.indexOf(\"(\") !== -1;\n const memberSyntax = sid.indexOf(\".\") !== -1;\n if (memberSyntax) {\n parts = sid.split(\".\");\n sid = parts.shift();\n data.member = parts.shift();\n } else if (arraySyntax) {\n const indices = sid.split(\"(\");\n sid = indices.shift();\n for (let i2 = 0; i2 < indices.length; i2++) {\n indices[i2] = parseInt(indices[i2].replace(/\\)/, \"\"));\n }\n data.indices = indices;\n }\n data.id = id;\n data.sid = sid;\n data.arraySyntax = arraySyntax;\n data.memberSyntax = memberSyntax;\n data.sampler = parseId(xml2.getAttribute(\"source\"));\n return data;\n }\n function buildAnimation(data) {\n const tracks = [];\n const channels = data.channels;\n const samplers = data.samplers;\n const sources = data.sources;\n for (const target in channels) {\n if (channels.hasOwnProperty(target)) {\n const channel = channels[target];\n const sampler = samplers[channel.sampler];\n const inputId = sampler.inputs.INPUT;\n const outputId = sampler.inputs.OUTPUT;\n const inputSource = sources[inputId];\n const outputSource = sources[outputId];\n const animation = buildAnimationChannel(channel, inputSource, outputSource);\n createKeyframeTracks(animation, tracks);\n }\n }\n return tracks;\n }\n function getAnimation(id) {\n return getBuild(library.animations[id], buildAnimation);\n }\n function buildAnimationChannel(channel, inputSource, outputSource) {\n const node = library.nodes[channel.id];\n const object3D = getNode(node.id);\n const transform = node.transforms[channel.sid];\n const defaultMatrix = node.matrix.clone().transpose();\n let time, stride;\n let i2, il, j, jl;\n const data = {};\n switch (transform) {\n case \"matrix\":\n for (i2 = 0, il = inputSource.array.length; i2 < il; i2++) {\n time = inputSource.array[i2];\n stride = i2 * outputSource.stride;\n if (data[time] === void 0)\n data[time] = {};\n if (channel.arraySyntax === true) {\n const value = outputSource.array[stride];\n const index = channel.indices[0] + 4 * channel.indices[1];\n data[time][index] = value;\n } else {\n for (j = 0, jl = outputSource.stride; j < jl; j++) {\n data[time][j] = outputSource.array[stride + j];\n }\n }\n }\n break;\n case \"translate\":\n console.warn('THREE.ColladaLoader: Animation transform type \"%s\" not yet implemented.', transform);\n break;\n case \"rotate\":\n console.warn('THREE.ColladaLoader: Animation transform type \"%s\" not yet implemented.', transform);\n break;\n case \"scale\":\n console.warn('THREE.ColladaLoader: Animation transform type \"%s\" not yet implemented.', transform);\n break;\n }\n const keyframes = prepareAnimationData(data, defaultMatrix);\n const animation = {\n name: object3D.uuid,\n keyframes\n };\n return animation;\n }\n function prepareAnimationData(data, defaultMatrix) {\n const keyframes = [];\n for (const time in data) {\n keyframes.push({ time: parseFloat(time), value: data[time] });\n }\n keyframes.sort(ascending);\n for (let i2 = 0; i2 < 16; i2++) {\n transformAnimationData(keyframes, i2, defaultMatrix.elements[i2]);\n }\n return keyframes;\n function ascending(a2, b2) {\n return a2.time - b2.time;\n }\n }\n const position = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const scale = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n const quaternion = new three__WEBPACK_IMPORTED_MODULE_42__.Quaternion();\n function createKeyframeTracks(animation, tracks) {\n const keyframes = animation.keyframes;\n const name = animation.name;\n const times = [];\n const positionData = [];\n const quaternionData = [];\n const scaleData = [];\n for (let i2 = 0, l = keyframes.length; i2 < l; i2++) {\n const keyframe = keyframes[i2];\n const time = keyframe.time;\n const value = keyframe.value;\n matrix2.fromArray(value).transpose();\n matrix2.decompose(position, quaternion, scale);\n times.push(time);\n positionData.push(position.x, position.y, position.z);\n quaternionData.push(quaternion.x, quaternion.y, quaternion.z, quaternion.w);\n scaleData.push(scale.x, scale.y, scale.z);\n }\n if (positionData.length > 0)\n tracks.push(new three__WEBPACK_IMPORTED_MODULE_42__.VectorKeyframeTrack(name + \".position\", times, positionData));\n if (quaternionData.length > 0) {\n tracks.push(new three__WEBPACK_IMPORTED_MODULE_42__.QuaternionKeyframeTrack(name + \".quaternion\", times, quaternionData));\n }\n if (scaleData.length > 0)\n tracks.push(new three__WEBPACK_IMPORTED_MODULE_42__.VectorKeyframeTrack(name + \".scale\", times, scaleData));\n return tracks;\n }\n function transformAnimationData(keyframes, property, defaultValue) {\n let keyframe;\n let empty = true;\n let i2, l;\n for (i2 = 0, l = keyframes.length; i2 < l; i2++) {\n keyframe = keyframes[i2];\n if (keyframe.value[property] === void 0) {\n keyframe.value[property] = null;\n } else {\n empty = false;\n }\n }\n if (empty === true) {\n for (i2 = 0, l = keyframes.length; i2 < l; i2++) {\n keyframe = keyframes[i2];\n keyframe.value[property] = defaultValue;\n }\n } else {\n createMissingKeyframes(keyframes, property);\n }\n }\n function createMissingKeyframes(keyframes, property) {\n let prev, next;\n for (let i2 = 0, l = keyframes.length; i2 < l; i2++) {\n const keyframe = keyframes[i2];\n if (keyframe.value[property] === null) {\n prev = getPrev(keyframes, i2, property);\n next = getNext(keyframes, i2, property);\n if (prev === null) {\n keyframe.value[property] = next.value[property];\n continue;\n }\n if (next === null) {\n keyframe.value[property] = prev.value[property];\n continue;\n }\n interpolate(keyframe, prev, next, property);\n }\n }\n }\n function getPrev(keyframes, i2, property) {\n while (i2 >= 0) {\n const keyframe = keyframes[i2];\n if (keyframe.value[property] !== null)\n return keyframe;\n i2--;\n }\n return null;\n }\n function getNext(keyframes, i2, property) {\n while (i2 < keyframes.length) {\n const keyframe = keyframes[i2];\n if (keyframe.value[property] !== null)\n return keyframe;\n i2++;\n }\n return null;\n }\n function interpolate(key, prev, next, property) {\n if (next.time - prev.time === 0) {\n key.value[property] = prev.value[property];\n return;\n }\n key.value[property] = (key.time - prev.time) * (next.value[property] - prev.value[property]) / (next.time - prev.time) + prev.value[property];\n }\n function parseAnimationClip(xml2) {\n const data = {\n name: xml2.getAttribute(\"id\") || \"default\",\n start: parseFloat(xml2.getAttribute(\"start\") || 0),\n end: parseFloat(xml2.getAttribute(\"end\") || 0),\n animations: []\n };\n for (let i2 = 0, l = xml2.childNodes.length; i2 < l; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"instance_animation\":\n data.animations.push(parseId(child.getAttribute(\"url\")));\n break;\n }\n }\n library.clips[xml2.getAttribute(\"id\")] = data;\n }\n function buildAnimationClip(data) {\n const tracks = [];\n const name = data.name;\n const duration = data.end - data.start || -1;\n const animations2 = data.animations;\n for (let i2 = 0, il = animations2.length; i2 < il; i2++) {\n const animationTracks = getAnimation(animations2[i2]);\n for (let j = 0, jl = animationTracks.length; j < jl; j++) {\n tracks.push(animationTracks[j]);\n }\n }\n return new three__WEBPACK_IMPORTED_MODULE_42__.AnimationClip(name, duration, tracks);\n }\n function getAnimationClip(id) {\n return getBuild(library.clips[id], buildAnimationClip);\n }\n function parseController(xml2) {\n const data = {};\n for (let i2 = 0, l = xml2.childNodes.length; i2 < l; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"skin\":\n data.id = parseId(child.getAttribute(\"source\"));\n data.skin = parseSkin(child);\n break;\n case \"morph\":\n data.id = parseId(child.getAttribute(\"source\"));\n console.warn(\"THREE.ColladaLoader: Morph target animation not supported yet.\");\n break;\n }\n }\n library.controllers[xml2.getAttribute(\"id\")] = data;\n }\n function parseSkin(xml2) {\n const data = {\n sources: {}\n };\n for (let i2 = 0, l = xml2.childNodes.length; i2 < l; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"bind_shape_matrix\":\n data.bindShapeMatrix = parseFloats(child.textContent);\n break;\n case \"source\":\n const id = child.getAttribute(\"id\");\n data.sources[id] = parseSource(child);\n break;\n case \"joints\":\n data.joints = parseJoints(child);\n break;\n case \"vertex_weights\":\n data.vertexWeights = parseVertexWeights(child);\n break;\n }\n }\n return data;\n }\n function parseJoints(xml2) {\n const data = {\n inputs: {}\n };\n for (let i2 = 0, l = xml2.childNodes.length; i2 < l; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"input\":\n const semantic = child.getAttribute(\"semantic\");\n const id = parseId(child.getAttribute(\"source\"));\n data.inputs[semantic] = id;\n break;\n }\n }\n return data;\n }\n function parseVertexWeights(xml2) {\n const data = {\n inputs: {}\n };\n for (let i2 = 0, l = xml2.childNodes.length; i2 < l; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"input\":\n const semantic = child.getAttribute(\"semantic\");\n const id = parseId(child.getAttribute(\"source\"));\n const offset = parseInt(child.getAttribute(\"offset\"));\n data.inputs[semantic] = { id, offset };\n break;\n case \"vcount\":\n data.vcount = parseInts(child.textContent);\n break;\n case \"v\":\n data.v = parseInts(child.textContent);\n break;\n }\n }\n return data;\n }\n function buildController(data) {\n const build = {\n id: data.id\n };\n const geometry2 = library.geometries[build.id];\n if (data.skin !== void 0) {\n build.skin = buildSkin(data.skin);\n geometry2.sources.skinIndices = build.skin.indices;\n geometry2.sources.skinWeights = build.skin.weights;\n }\n return build;\n }\n function buildSkin(data) {\n const BONE_LIMIT = 4;\n const build = {\n joints: [],\n // this must be an array to preserve the joint order\n indices: {\n array: [],\n stride: BONE_LIMIT\n },\n weights: {\n array: [],\n stride: BONE_LIMIT\n }\n };\n const sources = data.sources;\n const vertexWeights = data.vertexWeights;\n const vcount = vertexWeights.vcount;\n const v = vertexWeights.v;\n const jointOffset = vertexWeights.inputs.JOINT.offset;\n const weightOffset = vertexWeights.inputs.WEIGHT.offset;\n const jointSource = data.sources[data.joints.inputs.JOINT];\n const inverseSource = data.sources[data.joints.inputs.INV_BIND_MATRIX];\n const weights = sources[vertexWeights.inputs.WEIGHT.id].array;\n let stride = 0;\n let i2, j, l;\n for (i2 = 0, l = vcount.length; i2 < l; i2++) {\n const jointCount = vcount[i2];\n const vertexSkinData = [];\n for (j = 0; j < jointCount; j++) {\n const skinIndex = v[stride + jointOffset];\n const weightId = v[stride + weightOffset];\n const skinWeight = weights[weightId];\n vertexSkinData.push({ index: skinIndex, weight: skinWeight });\n stride += 2;\n }\n vertexSkinData.sort(descending);\n for (j = 0; j < BONE_LIMIT; j++) {\n const d = vertexSkinData[j];\n if (d !== void 0) {\n build.indices.array.push(d.index);\n build.weights.array.push(d.weight);\n } else {\n build.indices.array.push(0);\n build.weights.array.push(0);\n }\n }\n }\n if (data.bindShapeMatrix) {\n build.bindMatrix = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4().fromArray(data.bindShapeMatrix).transpose();\n } else {\n build.bindMatrix = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4().identity();\n }\n for (i2 = 0, l = jointSource.array.length; i2 < l; i2++) {\n const name = jointSource.array[i2];\n const boneInverse = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4().fromArray(inverseSource.array, i2 * inverseSource.stride).transpose();\n build.joints.push({ name, boneInverse });\n }\n return build;\n function descending(a2, b2) {\n return b2.weight - a2.weight;\n }\n }\n function getController(id) {\n return getBuild(library.controllers[id], buildController);\n }\n function parseImage(xml2) {\n const data = {\n init_from: getElementsByTagName(xml2, \"init_from\")[0].textContent\n };\n library.images[xml2.getAttribute(\"id\")] = data;\n }\n function buildImage(data) {\n if (data.build !== void 0)\n return data.build;\n return data.init_from;\n }\n function getImage(id) {\n const data = library.images[id];\n if (data !== void 0) {\n return getBuild(data, buildImage);\n }\n console.warn(\"THREE.ColladaLoader: Couldn't find image with ID:\", id);\n return null;\n }\n function parseEffect(xml2) {\n const data = {};\n for (let i2 = 0, l = xml2.childNodes.length; i2 < l; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"profile_COMMON\":\n data.profile = parseEffectProfileCOMMON(child);\n break;\n }\n }\n library.effects[xml2.getAttribute(\"id\")] = data;\n }\n function parseEffectProfileCOMMON(xml2) {\n const data = {\n surfaces: {},\n samplers: {}\n };\n for (let i2 = 0, l = xml2.childNodes.length; i2 < l; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"newparam\":\n parseEffectNewparam(child, data);\n break;\n case \"technique\":\n data.technique = parseEffectTechnique(child);\n break;\n case \"extra\":\n data.extra = parseEffectExtra(child);\n break;\n }\n }\n return data;\n }\n function parseEffectNewparam(xml2, data) {\n const sid = xml2.getAttribute(\"sid\");\n for (let i2 = 0, l = xml2.childNodes.length; i2 < l; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"surface\":\n data.surfaces[sid] = parseEffectSurface(child);\n break;\n case \"sampler2D\":\n data.samplers[sid] = parseEffectSampler(child);\n break;\n }\n }\n }\n function parseEffectSurface(xml2) {\n const data = {};\n for (let i2 = 0, l = xml2.childNodes.length; i2 < l; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"init_from\":\n data.init_from = child.textContent;\n break;\n }\n }\n return data;\n }\n function parseEffectSampler(xml2) {\n const data = {};\n for (let i2 = 0, l = xml2.childNodes.length; i2 < l; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"source\":\n data.source = child.textContent;\n break;\n }\n }\n return data;\n }\n function parseEffectTechnique(xml2) {\n const data = {};\n for (let i2 = 0, l = xml2.childNodes.length; i2 < l; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"constant\":\n case \"lambert\":\n case \"blinn\":\n case \"phong\":\n data.type = child.nodeName;\n data.parameters = parseEffectParameters(child);\n break;\n case \"extra\":\n data.extra = parseEffectExtra(child);\n break;\n }\n }\n return data;\n }\n function parseEffectParameters(xml2) {\n const data = {};\n for (let i2 = 0, l = xml2.childNodes.length; i2 < l; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"emission\":\n case \"diffuse\":\n case \"specular\":\n case \"bump\":\n case \"ambient\":\n case \"shininess\":\n case \"transparency\":\n data[child.nodeName] = parseEffectParameter(child);\n break;\n case \"transparent\":\n data[child.nodeName] = {\n opaque: child.hasAttribute(\"opaque\") ? child.getAttribute(\"opaque\") : \"A_ONE\",\n data: parseEffectParameter(child)\n };\n break;\n }\n }\n return data;\n }\n function parseEffectParameter(xml2) {\n const data = {};\n for (let i2 = 0, l = xml2.childNodes.length; i2 < l; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"color\":\n data[child.nodeName] = parseFloats(child.textContent);\n break;\n case \"float\":\n data[child.nodeName] = parseFloat(child.textContent);\n break;\n case \"texture\":\n data[child.nodeName] = { id: child.getAttribute(\"texture\"), extra: parseEffectParameterTexture(child) };\n break;\n }\n }\n return data;\n }\n function parseEffectParameterTexture(xml2) {\n const data = {\n technique: {}\n };\n for (let i2 = 0, l = xml2.childNodes.length; i2 < l; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"extra\":\n parseEffectParameterTextureExtra(child, data);\n break;\n }\n }\n return data;\n }\n function parseEffectParameterTextureExtra(xml2, data) {\n for (let i2 = 0, l = xml2.childNodes.length; i2 < l; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"technique\":\n parseEffectParameterTextureExtraTechnique(child, data);\n break;\n }\n }\n }\n function parseEffectParameterTextureExtraTechnique(xml2, data) {\n for (let i2 = 0, l = xml2.childNodes.length; i2 < l; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"repeatU\":\n case \"repeatV\":\n case \"offsetU\":\n case \"offsetV\":\n data.technique[child.nodeName] = parseFloat(child.textContent);\n break;\n case \"wrapU\":\n case \"wrapV\":\n if (child.textContent.toUpperCase() === \"TRUE\") {\n data.technique[child.nodeName] = 1;\n } else if (child.textContent.toUpperCase() === \"FALSE\") {\n data.technique[child.nodeName] = 0;\n } else {\n data.technique[child.nodeName] = parseInt(child.textContent);\n }\n break;\n case \"bump\":\n data[child.nodeName] = parseEffectExtraTechniqueBump(child);\n break;\n }\n }\n }\n function parseEffectExtra(xml2) {\n const data = {};\n for (let i2 = 0, l = xml2.childNodes.length; i2 < l; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"technique\":\n data.technique = parseEffectExtraTechnique(child);\n break;\n }\n }\n return data;\n }\n function parseEffectExtraTechnique(xml2) {\n const data = {};\n for (let i2 = 0, l = xml2.childNodes.length; i2 < l; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"double_sided\":\n data[child.nodeName] = parseInt(child.textContent);\n break;\n case \"bump\":\n data[child.nodeName] = parseEffectExtraTechniqueBump(child);\n break;\n }\n }\n return data;\n }\n function parseEffectExtraTechniqueBump(xml2) {\n var data = {};\n for (var i2 = 0, l = xml2.childNodes.length; i2 < l; i2++) {\n var child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"texture\":\n data[child.nodeName] = {\n id: child.getAttribute(\"texture\"),\n texcoord: child.getAttribute(\"texcoord\"),\n extra: parseEffectParameterTexture(child)\n };\n break;\n }\n }\n return data;\n }\n function buildEffect(data) {\n return data;\n }\n function getEffect(id) {\n return getBuild(library.effects[id], buildEffect);\n }\n function parseMaterial(xml2) {\n const data = {\n name: xml2.getAttribute(\"name\")\n };\n for (let i2 = 0, l = xml2.childNodes.length; i2 < l; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"instance_effect\":\n data.url = parseId(child.getAttribute(\"url\"));\n break;\n }\n }\n library.materials[xml2.getAttribute(\"id\")] = data;\n }\n function getTextureLoader(image) {\n let loader;\n let extension = image.slice((image.lastIndexOf(\".\") - 1 >>> 0) + 2);\n extension = extension.toLowerCase();\n switch (extension) {\n case \"tga\":\n loader = tgaLoader;\n break;\n default:\n loader = textureLoader;\n }\n return loader;\n }\n function buildMaterial(data) {\n const effect = getEffect(data.url);\n const technique = effect.profile.technique;\n let material2;\n switch (technique.type) {\n case \"phong\":\n case \"blinn\":\n material2 = new three__WEBPACK_IMPORTED_MODULE_42__.MeshPhongMaterial();\n break;\n case \"lambert\":\n material2 = new three__WEBPACK_IMPORTED_MODULE_42__.MeshLambertMaterial();\n break;\n default:\n material2 = new three__WEBPACK_IMPORTED_MODULE_42__.MeshBasicMaterial();\n break;\n }\n material2.name = data.name || \"\";\n function getTexture(textureObject) {\n const sampler = effect.profile.samplers[textureObject.id];\n let image = null;\n if (sampler !== void 0) {\n const surface = effect.profile.surfaces[sampler.source];\n image = getImage(surface.init_from);\n } else {\n console.warn(\"THREE.ColladaLoader: Undefined sampler. Access image directly (see #12530).\");\n image = getImage(textureObject.id);\n }\n if (image !== null) {\n const loader = getTextureLoader(image);\n if (loader !== void 0) {\n const texture = loader.load(image);\n const extra = textureObject.extra;\n if (extra !== void 0 && extra.technique !== void 0 && isEmpty(extra.technique) === false) {\n const technique2 = extra.technique;\n texture.wrapS = technique2.wrapU ? three__WEBPACK_IMPORTED_MODULE_42__.RepeatWrapping : three__WEBPACK_IMPORTED_MODULE_42__.ClampToEdgeWrapping;\n texture.wrapT = technique2.wrapV ? three__WEBPACK_IMPORTED_MODULE_42__.RepeatWrapping : three__WEBPACK_IMPORTED_MODULE_42__.ClampToEdgeWrapping;\n texture.offset.set(technique2.offsetU || 0, technique2.offsetV || 0);\n texture.repeat.set(technique2.repeatU || 1, technique2.repeatV || 1);\n } else {\n texture.wrapS = three__WEBPACK_IMPORTED_MODULE_42__.RepeatWrapping;\n texture.wrapT = three__WEBPACK_IMPORTED_MODULE_42__.RepeatWrapping;\n }\n return texture;\n } else {\n console.warn(\"THREE.ColladaLoader: Loader for texture %s not found.\", image);\n return null;\n }\n } else {\n console.warn(\"THREE.ColladaLoader: Couldn't create texture with ID:\", textureObject.id);\n return null;\n }\n }\n const parameters = technique.parameters;\n for (const key in parameters) {\n const parameter = parameters[key];\n switch (key) {\n case \"diffuse\":\n if (parameter.color)\n material2.color.fromArray(parameter.color);\n if (parameter.texture)\n material2.map = getTexture(parameter.texture);\n break;\n case \"specular\":\n if (parameter.color && material2.specular)\n material2.specular.fromArray(parameter.color);\n if (parameter.texture)\n material2.specularMap = getTexture(parameter.texture);\n break;\n case \"bump\":\n if (parameter.texture)\n material2.normalMap = getTexture(parameter.texture);\n break;\n case \"ambient\":\n if (parameter.texture)\n material2.lightMap = getTexture(parameter.texture);\n break;\n case \"shininess\":\n if (parameter.float && material2.shininess)\n material2.shininess = parameter.float;\n break;\n case \"emission\":\n if (parameter.color && material2.emissive)\n material2.emissive.fromArray(parameter.color);\n if (parameter.texture)\n material2.emissiveMap = getTexture(parameter.texture);\n break;\n }\n }\n let transparent = parameters[\"transparent\"];\n let transparency = parameters[\"transparency\"];\n if (transparency === void 0 && transparent) {\n transparency = {\n float: 1\n };\n }\n if (transparent === void 0 && transparency) {\n transparent = {\n opaque: \"A_ONE\",\n data: {\n color: [1, 1, 1, 1]\n }\n };\n }\n if (transparent && transparency) {\n if (transparent.data.texture) {\n material2.transparent = true;\n } else {\n const color = transparent.data.color;\n switch (transparent.opaque) {\n case \"A_ONE\":\n material2.opacity = color[3] * transparency.float;\n break;\n case \"RGB_ZERO\":\n material2.opacity = 1 - color[0] * transparency.float;\n break;\n case \"A_ZERO\":\n material2.opacity = 1 - color[3] * transparency.float;\n break;\n case \"RGB_ONE\":\n material2.opacity = color[0] * transparency.float;\n break;\n default:\n console.warn('THREE.ColladaLoader: Invalid opaque type \"%s\" of transparent tag.', transparent.opaque);\n }\n if (material2.opacity < 1)\n material2.transparent = true;\n }\n }\n if (technique.extra !== void 0 && technique.extra.technique !== void 0) {\n const techniques = technique.extra.technique;\n for (const k in techniques) {\n const v = techniques[k];\n switch (k) {\n case \"double_sided\":\n material2.side = v === 1 ? three__WEBPACK_IMPORTED_MODULE_42__.DoubleSide : three__WEBPACK_IMPORTED_MODULE_42__.FrontSide;\n break;\n case \"bump\":\n material2.normalMap = getTexture(v.texture);\n material2.normalScale = new three__WEBPACK_IMPORTED_MODULE_42__.Vector2(1, 1);\n break;\n }\n }\n }\n return material2;\n }\n function getMaterial2(id) {\n return getBuild(library.materials[id], buildMaterial);\n }\n function parseCamera(xml2) {\n const data = {\n name: xml2.getAttribute(\"name\")\n };\n for (let i2 = 0, l = xml2.childNodes.length; i2 < l; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"optics\":\n data.optics = parseCameraOptics(child);\n break;\n }\n }\n library.cameras[xml2.getAttribute(\"id\")] = data;\n }\n function parseCameraOptics(xml2) {\n for (let i2 = 0; i2 < xml2.childNodes.length; i2++) {\n const child = xml2.childNodes[i2];\n switch (child.nodeName) {\n case \"technique_common\":\n return parseCameraTechnique(child);\n }\n }\n return {};\n }\n function parseCameraTechnique(xml2) {\n const data = {};\n for (let i2 = 0; i2 < xml2.childNodes.length; i2++) {\n const child = xml2.childNodes[i2];\n switch (child.nodeName) {\n case \"perspective\":\n case \"orthographic\":\n data.technique = child.nodeName;\n data.parameters = parseCameraParameters(child);\n break;\n }\n }\n return data;\n }\n function parseCameraParameters(xml2) {\n const data = {};\n for (let i2 = 0; i2 < xml2.childNodes.length; i2++) {\n const child = xml2.childNodes[i2];\n switch (child.nodeName) {\n case \"xfov\":\n case \"yfov\":\n case \"xmag\":\n case \"ymag\":\n case \"znear\":\n case \"zfar\":\n case \"aspect_ratio\":\n data[child.nodeName] = parseFloat(child.textContent);\n break;\n }\n }\n return data;\n }\n function buildCamera(data) {\n let camera;\n switch (data.optics.technique) {\n case \"perspective\":\n camera = new three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera(\n data.optics.parameters.yfov,\n data.optics.parameters.aspect_ratio,\n data.optics.parameters.znear,\n data.optics.parameters.zfar\n );\n break;\n case \"orthographic\":\n let ymag = data.optics.parameters.ymag;\n let xmag = data.optics.parameters.xmag;\n const aspectRatio = data.optics.parameters.aspect_ratio;\n xmag = xmag === void 0 ? ymag * aspectRatio : xmag;\n ymag = ymag === void 0 ? xmag / aspectRatio : ymag;\n xmag *= 0.5;\n ymag *= 0.5;\n camera = new three__WEBPACK_IMPORTED_MODULE_42__.OrthographicCamera(\n -xmag,\n xmag,\n ymag,\n -ymag,\n // left, right, top, bottom\n data.optics.parameters.znear,\n data.optics.parameters.zfar\n );\n break;\n default:\n camera = new three__WEBPACK_IMPORTED_MODULE_42__.PerspectiveCamera();\n break;\n }\n camera.name = data.name || \"\";\n return camera;\n }\n function getCamera(id) {\n const data = library.cameras[id];\n if (data !== void 0) {\n return getBuild(data, buildCamera);\n }\n console.warn(\"THREE.ColladaLoader: Couldn't find camera with ID:\", id);\n return null;\n }\n function parseLight(xml2) {\n let data = {};\n for (let i2 = 0, l = xml2.childNodes.length; i2 < l; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"technique_common\":\n data = parseLightTechnique(child);\n break;\n }\n }\n library.lights[xml2.getAttribute(\"id\")] = data;\n }\n function parseLightTechnique(xml2) {\n const data = {};\n for (let i2 = 0, l = xml2.childNodes.length; i2 < l; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"directional\":\n case \"point\":\n case \"spot\":\n case \"ambient\":\n data.technique = child.nodeName;\n data.parameters = parseLightParameters(child);\n }\n }\n return data;\n }\n function parseLightParameters(xml2) {\n const data = {};\n for (let i2 = 0, l = xml2.childNodes.length; i2 < l; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"color\":\n const array = parseFloats(child.textContent);\n data.color = new three__WEBPACK_IMPORTED_MODULE_42__.Color().fromArray(array);\n break;\n case \"falloff_angle\":\n data.falloffAngle = parseFloat(child.textContent);\n break;\n case \"quadratic_attenuation\":\n const f = parseFloat(child.textContent);\n data.distance = f ? Math.sqrt(1 / f) : 0;\n break;\n }\n }\n return data;\n }\n function buildLight(data) {\n let light;\n switch (data.technique) {\n case \"directional\":\n light = new three__WEBPACK_IMPORTED_MODULE_42__.DirectionalLight();\n break;\n case \"point\":\n light = new three__WEBPACK_IMPORTED_MODULE_42__.PointLight();\n break;\n case \"spot\":\n light = new three__WEBPACK_IMPORTED_MODULE_42__.SpotLight();\n break;\n case \"ambient\":\n light = new three__WEBPACK_IMPORTED_MODULE_42__.AmbientLight();\n break;\n }\n if (data.parameters.color)\n light.color.copy(data.parameters.color);\n if (data.parameters.distance)\n light.distance = data.parameters.distance;\n return light;\n }\n function getLight(id) {\n const data = library.lights[id];\n if (data !== void 0) {\n return getBuild(data, buildLight);\n }\n console.warn(\"THREE.ColladaLoader: Couldn't find light with ID:\", id);\n return null;\n }\n function parseGeometry(xml2) {\n const data = {\n name: xml2.getAttribute(\"name\"),\n sources: {},\n vertices: {},\n primitives: []\n };\n const mesh = getElementsByTagName(xml2, \"mesh\")[0];\n if (mesh === void 0)\n return;\n for (let i2 = 0; i2 < mesh.childNodes.length; i2++) {\n const child = mesh.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n const id = child.getAttribute(\"id\");\n switch (child.nodeName) {\n case \"source\":\n data.sources[id] = parseSource(child);\n break;\n case \"vertices\":\n data.vertices = parseGeometryVertices(child);\n break;\n case \"polygons\":\n console.warn(\"THREE.ColladaLoader: Unsupported primitive type: \", child.nodeName);\n break;\n case \"lines\":\n case \"linestrips\":\n case \"polylist\":\n case \"triangles\":\n data.primitives.push(parseGeometryPrimitive(child));\n break;\n default:\n console.log(child);\n }\n }\n library.geometries[xml2.getAttribute(\"id\")] = data;\n }\n function parseSource(xml2) {\n const data = {\n array: [],\n stride: 3\n };\n for (let i2 = 0; i2 < xml2.childNodes.length; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"float_array\":\n data.array = parseFloats(child.textContent);\n break;\n case \"Name_array\":\n data.array = parseStrings(child.textContent);\n break;\n case \"technique_common\":\n const accessor = getElementsByTagName(child, \"accessor\")[0];\n if (accessor !== void 0) {\n data.stride = parseInt(accessor.getAttribute(\"stride\"));\n }\n break;\n }\n }\n return data;\n }\n function parseGeometryVertices(xml2) {\n const data = {};\n for (let i2 = 0; i2 < xml2.childNodes.length; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n data[child.getAttribute(\"semantic\")] = parseId(child.getAttribute(\"source\"));\n }\n return data;\n }\n function parseGeometryPrimitive(xml2) {\n const primitive = {\n type: xml2.nodeName,\n material: xml2.getAttribute(\"material\"),\n count: parseInt(xml2.getAttribute(\"count\")),\n inputs: {},\n stride: 0,\n hasUV: false\n };\n for (let i2 = 0, l = xml2.childNodes.length; i2 < l; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"input\":\n const id = parseId(child.getAttribute(\"source\"));\n const semantic = child.getAttribute(\"semantic\");\n const offset = parseInt(child.getAttribute(\"offset\"));\n const set = parseInt(child.getAttribute(\"set\"));\n const inputname = set > 0 ? semantic + set : semantic;\n primitive.inputs[inputname] = { id, offset };\n primitive.stride = Math.max(primitive.stride, offset + 1);\n if (semantic === \"TEXCOORD\")\n primitive.hasUV = true;\n break;\n case \"vcount\":\n primitive.vcount = parseInts(child.textContent);\n break;\n case \"p\":\n primitive.p = parseInts(child.textContent);\n break;\n }\n }\n return primitive;\n }\n function groupPrimitives(primitives) {\n const build = {};\n for (let i2 = 0; i2 < primitives.length; i2++) {\n const primitive = primitives[i2];\n if (build[primitive.type] === void 0)\n build[primitive.type] = [];\n build[primitive.type].push(primitive);\n }\n return build;\n }\n function checkUVCoordinates(primitives) {\n let count2 = 0;\n for (let i2 = 0, l = primitives.length; i2 < l; i2++) {\n const primitive = primitives[i2];\n if (primitive.hasUV === true) {\n count2++;\n }\n }\n if (count2 > 0 && count2 < primitives.length) {\n primitives.uvsNeedsFix = true;\n }\n }\n function buildGeometry(data) {\n const build = {};\n const sources = data.sources;\n const vertices = data.vertices;\n const primitives = data.primitives;\n if (primitives.length === 0)\n return {};\n const groupedPrimitives = groupPrimitives(primitives);\n for (const type in groupedPrimitives) {\n const primitiveType = groupedPrimitives[type];\n checkUVCoordinates(primitiveType);\n build[type] = buildGeometryType(primitiveType, sources, vertices);\n }\n return build;\n }\n function buildGeometryType(primitives, sources, vertices) {\n const build = {};\n const position2 = { array: [], stride: 0 };\n const normal = { array: [], stride: 0 };\n const uv = { array: [], stride: 0 };\n const uv2 = { array: [], stride: 0 };\n const color = { array: [], stride: 0 };\n const skinIndex = { array: [], stride: 4 };\n const skinWeight = { array: [], stride: 4 };\n const geometry2 = new three__WEBPACK_IMPORTED_MODULE_42__.BufferGeometry();\n const materialKeys = [];\n let start = 0;\n for (let p = 0; p < primitives.length; p++) {\n const primitive = primitives[p];\n const inputs = primitive.inputs;\n let count2 = 0;\n switch (primitive.type) {\n case \"lines\":\n case \"linestrips\":\n count2 = primitive.count * 2;\n break;\n case \"triangles\":\n count2 = primitive.count * 3;\n break;\n case \"polylist\":\n for (let g = 0; g < primitive.count; g++) {\n const vc = primitive.vcount[g];\n switch (vc) {\n case 3:\n count2 += 3;\n break;\n case 4:\n count2 += 6;\n break;\n default:\n count2 += (vc - 2) * 3;\n break;\n }\n }\n break;\n default:\n console.warn(\"THREE.ColladaLoader: Unknow primitive type:\", primitive.type);\n }\n geometry2.addGroup(start, count2, p);\n start += count2;\n if (primitive.material) {\n materialKeys.push(primitive.material);\n }\n for (const name in inputs) {\n const input = inputs[name];\n switch (name) {\n case \"VERTEX\":\n for (const key in vertices) {\n const id = vertices[key];\n switch (key) {\n case \"POSITION\":\n const prevLength = position2.array.length;\n buildGeometryData(primitive, sources[id], input.offset, position2.array);\n position2.stride = sources[id].stride;\n if (sources.skinWeights && sources.skinIndices) {\n buildGeometryData(primitive, sources.skinIndices, input.offset, skinIndex.array);\n buildGeometryData(primitive, sources.skinWeights, input.offset, skinWeight.array);\n }\n if (primitive.hasUV === false && primitives.uvsNeedsFix === true) {\n const count3 = (position2.array.length - prevLength) / position2.stride;\n for (let i2 = 0; i2 < count3; i2++) {\n uv.array.push(0, 0);\n }\n }\n break;\n case \"NORMAL\":\n buildGeometryData(primitive, sources[id], input.offset, normal.array);\n normal.stride = sources[id].stride;\n break;\n case \"COLOR\":\n buildGeometryData(primitive, sources[id], input.offset, color.array);\n color.stride = sources[id].stride;\n break;\n case \"TEXCOORD\":\n buildGeometryData(primitive, sources[id], input.offset, uv.array);\n uv.stride = sources[id].stride;\n break;\n case \"TEXCOORD1\":\n buildGeometryData(primitive, sources[id], input.offset, uv2.array);\n uv.stride = sources[id].stride;\n break;\n default:\n console.warn('THREE.ColladaLoader: Semantic \"%s\" not handled in geometry build process.', key);\n }\n }\n break;\n case \"NORMAL\":\n buildGeometryData(primitive, sources[input.id], input.offset, normal.array);\n normal.stride = sources[input.id].stride;\n break;\n case \"COLOR\":\n buildGeometryData(primitive, sources[input.id], input.offset, color.array);\n color.stride = sources[input.id].stride;\n break;\n case \"TEXCOORD\":\n buildGeometryData(primitive, sources[input.id], input.offset, uv.array);\n uv.stride = sources[input.id].stride;\n break;\n case \"TEXCOORD1\":\n buildGeometryData(primitive, sources[input.id], input.offset, uv2.array);\n uv2.stride = sources[input.id].stride;\n break;\n }\n }\n }\n if (position2.array.length > 0) {\n geometry2.setAttribute(\"position\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(position2.array, position2.stride));\n }\n if (normal.array.length > 0) {\n geometry2.setAttribute(\"normal\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(normal.array, normal.stride));\n }\n if (color.array.length > 0)\n geometry2.setAttribute(\"color\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(color.array, color.stride));\n if (uv.array.length > 0)\n geometry2.setAttribute(\"uv\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(uv.array, uv.stride));\n if (uv2.array.length > 0)\n geometry2.setAttribute(\"uv2\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(uv2.array, uv2.stride));\n if (skinIndex.array.length > 0) {\n geometry2.setAttribute(\"skinIndex\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(skinIndex.array, skinIndex.stride));\n }\n if (skinWeight.array.length > 0) {\n geometry2.setAttribute(\"skinWeight\", new three__WEBPACK_IMPORTED_MODULE_42__.Float32BufferAttribute(skinWeight.array, skinWeight.stride));\n }\n build.data = geometry2;\n build.type = primitives[0].type;\n build.materialKeys = materialKeys;\n return build;\n }\n function buildGeometryData(primitive, source, offset, array) {\n const indices = primitive.p;\n const stride = primitive.stride;\n const vcount = primitive.vcount;\n function pushVector(i2) {\n let index = indices[i2 + offset] * sourceStride;\n const length = index + sourceStride;\n for (; index < length; index++) {\n array.push(sourceArray[index]);\n }\n }\n const sourceArray = source.array;\n const sourceStride = source.stride;\n if (primitive.vcount !== void 0) {\n let index = 0;\n for (let i2 = 0, l = vcount.length; i2 < l; i2++) {\n const count2 = vcount[i2];\n if (count2 === 4) {\n const a2 = index + stride * 0;\n const b2 = index + stride * 1;\n const c = index + stride * 2;\n const d = index + stride * 3;\n pushVector(a2);\n pushVector(b2);\n pushVector(d);\n pushVector(b2);\n pushVector(c);\n pushVector(d);\n } else if (count2 === 3) {\n const a2 = index + stride * 0;\n const b2 = index + stride * 1;\n const c = index + stride * 2;\n pushVector(a2);\n pushVector(b2);\n pushVector(c);\n } else if (count2 > 4) {\n for (let k = 1, kl = count2 - 2; k <= kl; k++) {\n const a2 = index + stride * 0;\n const b2 = index + stride * k;\n const c = index + stride * (k + 1);\n pushVector(a2);\n pushVector(b2);\n pushVector(c);\n }\n }\n index += stride * count2;\n }\n } else {\n for (let i2 = 0, l = indices.length; i2 < l; i2 += stride) {\n pushVector(i2);\n }\n }\n }\n function getGeometry(id) {\n return getBuild(library.geometries[id], buildGeometry);\n }\n function parseKinematicsModel(xml2) {\n const data = {\n name: xml2.getAttribute(\"name\") || \"\",\n joints: {},\n links: []\n };\n for (let i2 = 0; i2 < xml2.childNodes.length; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"technique_common\":\n parseKinematicsTechniqueCommon(child, data);\n break;\n }\n }\n library.kinematicsModels[xml2.getAttribute(\"id\")] = data;\n }\n function buildKinematicsModel(data) {\n if (data.build !== void 0)\n return data.build;\n return data;\n }\n function getKinematicsModel(id) {\n return getBuild(library.kinematicsModels[id], buildKinematicsModel);\n }\n function parseKinematicsTechniqueCommon(xml2, data) {\n for (let i2 = 0; i2 < xml2.childNodes.length; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"joint\":\n data.joints[child.getAttribute(\"sid\")] = parseKinematicsJoint(child);\n break;\n case \"link\":\n data.links.push(parseKinematicsLink(child));\n break;\n }\n }\n }\n function parseKinematicsJoint(xml2) {\n let data;\n for (let i2 = 0; i2 < xml2.childNodes.length; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"prismatic\":\n case \"revolute\":\n data = parseKinematicsJointParameter(child);\n break;\n }\n }\n return data;\n }\n function parseKinematicsJointParameter(xml2) {\n const data = {\n sid: xml2.getAttribute(\"sid\"),\n name: xml2.getAttribute(\"name\") || \"\",\n axis: new three__WEBPACK_IMPORTED_MODULE_42__.Vector3(),\n limits: {\n min: 0,\n max: 0\n },\n type: xml2.nodeName,\n static: false,\n zeroPosition: 0,\n middlePosition: 0\n };\n for (let i2 = 0; i2 < xml2.childNodes.length; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"axis\":\n const array = parseFloats(child.textContent);\n data.axis.fromArray(array);\n break;\n case \"limits\":\n const max = child.getElementsByTagName(\"max\")[0];\n const min = child.getElementsByTagName(\"min\")[0];\n data.limits.max = parseFloat(max.textContent);\n data.limits.min = parseFloat(min.textContent);\n break;\n }\n }\n if (data.limits.min >= data.limits.max) {\n data.static = true;\n }\n data.middlePosition = (data.limits.min + data.limits.max) / 2;\n return data;\n }\n function parseKinematicsLink(xml2) {\n const data = {\n sid: xml2.getAttribute(\"sid\"),\n name: xml2.getAttribute(\"name\") || \"\",\n attachments: [],\n transforms: []\n };\n for (let i2 = 0; i2 < xml2.childNodes.length; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"attachment_full\":\n data.attachments.push(parseKinematicsAttachment(child));\n break;\n case \"matrix\":\n case \"translate\":\n case \"rotate\":\n data.transforms.push(parseKinematicsTransform(child));\n break;\n }\n }\n return data;\n }\n function parseKinematicsAttachment(xml2) {\n const data = {\n joint: xml2.getAttribute(\"joint\").split(\"/\").pop(),\n transforms: [],\n links: []\n };\n for (let i2 = 0; i2 < xml2.childNodes.length; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"link\":\n data.links.push(parseKinematicsLink(child));\n break;\n case \"matrix\":\n case \"translate\":\n case \"rotate\":\n data.transforms.push(parseKinematicsTransform(child));\n break;\n }\n }\n return data;\n }\n function parseKinematicsTransform(xml2) {\n const data = {\n type: xml2.nodeName\n };\n const array = parseFloats(xml2.textContent);\n switch (data.type) {\n case \"matrix\":\n data.obj = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n data.obj.fromArray(array).transpose();\n break;\n case \"translate\":\n data.obj = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n data.obj.fromArray(array);\n break;\n case \"rotate\":\n data.obj = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n data.obj.fromArray(array);\n data.angle = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.degToRad(array[3]);\n break;\n }\n return data;\n }\n function parsePhysicsModel(xml2) {\n const data = {\n name: xml2.getAttribute(\"name\") || \"\",\n rigidBodies: {}\n };\n for (let i2 = 0; i2 < xml2.childNodes.length; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"rigid_body\":\n data.rigidBodies[child.getAttribute(\"name\")] = {};\n parsePhysicsRigidBody(child, data.rigidBodies[child.getAttribute(\"name\")]);\n break;\n }\n }\n library.physicsModels[xml2.getAttribute(\"id\")] = data;\n }\n function parsePhysicsRigidBody(xml2, data) {\n for (let i2 = 0; i2 < xml2.childNodes.length; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"technique_common\":\n parsePhysicsTechniqueCommon(child, data);\n break;\n }\n }\n }\n function parsePhysicsTechniqueCommon(xml2, data) {\n for (let i2 = 0; i2 < xml2.childNodes.length; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"inertia\":\n data.inertia = parseFloats(child.textContent);\n break;\n case \"mass\":\n data.mass = parseFloats(child.textContent)[0];\n break;\n }\n }\n }\n function parseKinematicsScene(xml2) {\n const data = {\n bindJointAxis: []\n };\n for (let i2 = 0; i2 < xml2.childNodes.length; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"bind_joint_axis\":\n data.bindJointAxis.push(parseKinematicsBindJointAxis(child));\n break;\n }\n }\n library.kinematicsScenes[parseId(xml2.getAttribute(\"url\"))] = data;\n }\n function parseKinematicsBindJointAxis(xml2) {\n const data = {\n target: xml2.getAttribute(\"target\").split(\"/\").pop()\n };\n for (let i2 = 0; i2 < xml2.childNodes.length; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n switch (child.nodeName) {\n case \"axis\":\n const param = child.getElementsByTagName(\"param\")[0];\n data.axis = param.textContent;\n const tmpJointIndex = data.axis.split(\"inst_\").pop().split(\"axis\")[0];\n data.jointIndex = tmpJointIndex.substr(0, tmpJointIndex.length - 1);\n break;\n }\n }\n return data;\n }\n function buildKinematicsScene(data) {\n if (data.build !== void 0)\n return data.build;\n return data;\n }\n function getKinematicsScene(id) {\n return getBuild(library.kinematicsScenes[id], buildKinematicsScene);\n }\n function setupKinematics() {\n const kinematicsModelId = Object.keys(library.kinematicsModels)[0];\n const kinematicsSceneId = Object.keys(library.kinematicsScenes)[0];\n const visualSceneId = Object.keys(library.visualScenes)[0];\n if (kinematicsModelId === void 0 || kinematicsSceneId === void 0)\n return;\n const kinematicsModel = getKinematicsModel(kinematicsModelId);\n const kinematicsScene = getKinematicsScene(kinematicsSceneId);\n const visualScene = getVisualScene(visualSceneId);\n const bindJointAxis = kinematicsScene.bindJointAxis;\n const jointMap = {};\n for (let i2 = 0, l = bindJointAxis.length; i2 < l; i2++) {\n const axis = bindJointAxis[i2];\n const targetElement = collada.querySelector('[sid=\"' + axis.target + '\"]');\n if (targetElement) {\n const parentVisualElement = targetElement.parentElement;\n connect(axis.jointIndex, parentVisualElement);\n }\n }\n function connect(jointIndex, visualElement) {\n const visualElementName = visualElement.getAttribute(\"name\");\n const joint = kinematicsModel.joints[jointIndex];\n visualScene.traverse(function(object) {\n if (object.name === visualElementName) {\n jointMap[jointIndex] = {\n object,\n transforms: buildTransformList(visualElement),\n joint,\n position: joint.zeroPosition\n };\n }\n });\n }\n const m0 = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n kinematics = {\n joints: kinematicsModel && kinematicsModel.joints,\n getJointValue: function(jointIndex) {\n const jointData = jointMap[jointIndex];\n if (jointData) {\n return jointData.position;\n } else {\n console.warn(\"THREE.ColladaLoader: Joint \" + jointIndex + \" doesn't exist.\");\n }\n },\n setJointValue: function(jointIndex, value) {\n const jointData = jointMap[jointIndex];\n if (jointData) {\n const joint = jointData.joint;\n if (value > joint.limits.max || value < joint.limits.min) {\n console.warn(\n \"THREE.ColladaLoader: Joint \" + jointIndex + \" value \" + value + \" outside of limits (min: \" + joint.limits.min + \", max: \" + joint.limits.max + \").\"\n );\n } else if (joint.static) {\n console.warn(\"THREE.ColladaLoader: Joint \" + jointIndex + \" is static.\");\n } else {\n const object = jointData.object;\n const axis = joint.axis;\n const transforms = jointData.transforms;\n matrix2.identity();\n for (let i2 = 0; i2 < transforms.length; i2++) {\n const transform = transforms[i2];\n if (transform.sid && transform.sid.indexOf(jointIndex) !== -1) {\n switch (joint.type) {\n case \"revolute\":\n matrix2.multiply(m0.makeRotationAxis(axis, three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.degToRad(value)));\n break;\n case \"prismatic\":\n matrix2.multiply(m0.makeTranslation(axis.x * value, axis.y * value, axis.z * value));\n break;\n default:\n console.warn(\"THREE.ColladaLoader: Unknown joint type: \" + joint.type);\n break;\n }\n } else {\n switch (transform.type) {\n case \"matrix\":\n matrix2.multiply(transform.obj);\n break;\n case \"translate\":\n matrix2.multiply(m0.makeTranslation(transform.obj.x, transform.obj.y, transform.obj.z));\n break;\n case \"scale\":\n matrix2.scale(transform.obj);\n break;\n case \"rotate\":\n matrix2.multiply(m0.makeRotationAxis(transform.obj, transform.angle));\n break;\n }\n }\n }\n object.matrix.copy(matrix2);\n object.matrix.decompose(object.position, object.quaternion, object.scale);\n jointMap[jointIndex].position = value;\n }\n } else {\n console.log(\"THREE.ColladaLoader: \" + jointIndex + \" does not exist.\");\n }\n }\n };\n }\n function buildTransformList(node) {\n const transforms = [];\n const xml2 = collada.querySelector('[id=\"' + node.id + '\"]');\n for (let i2 = 0; i2 < xml2.childNodes.length; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n let array, vector2;\n switch (child.nodeName) {\n case \"matrix\":\n array = parseFloats(child.textContent);\n const matrix3 = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4().fromArray(array).transpose();\n transforms.push({\n sid: child.getAttribute(\"sid\"),\n type: child.nodeName,\n obj: matrix3\n });\n break;\n case \"translate\":\n case \"scale\":\n array = parseFloats(child.textContent);\n vector2 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3().fromArray(array);\n transforms.push({\n sid: child.getAttribute(\"sid\"),\n type: child.nodeName,\n obj: vector2\n });\n break;\n case \"rotate\":\n array = parseFloats(child.textContent);\n vector2 = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3().fromArray(array);\n const angle = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.degToRad(array[3]);\n transforms.push({\n sid: child.getAttribute(\"sid\"),\n type: child.nodeName,\n obj: vector2,\n angle\n });\n break;\n }\n }\n return transforms;\n }\n function prepareNodes(xml2) {\n const elements = xml2.getElementsByTagName(\"node\");\n for (let i2 = 0; i2 < elements.length; i2++) {\n const element = elements[i2];\n if (element.hasAttribute(\"id\") === false) {\n element.setAttribute(\"id\", generateId());\n }\n }\n }\n const matrix2 = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n const vector = new three__WEBPACK_IMPORTED_MODULE_42__.Vector3();\n function parseNode(xml2) {\n const data = {\n name: xml2.getAttribute(\"name\") || \"\",\n type: xml2.getAttribute(\"type\"),\n id: xml2.getAttribute(\"id\"),\n sid: xml2.getAttribute(\"sid\"),\n matrix: new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4(),\n nodes: [],\n instanceCameras: [],\n instanceControllers: [],\n instanceLights: [],\n instanceGeometries: [],\n instanceNodes: [],\n transforms: {}\n };\n for (let i2 = 0; i2 < xml2.childNodes.length; i2++) {\n const child = xml2.childNodes[i2];\n if (child.nodeType !== 1)\n continue;\n let array;\n switch (child.nodeName) {\n case \"node\":\n data.nodes.push(child.getAttribute(\"id\"));\n parseNode(child);\n break;\n case \"instance_camera\":\n data.instanceCameras.push(parseId(child.getAttribute(\"url\")));\n break;\n case \"instance_controller\":\n data.instanceControllers.push(parseNodeInstance(child));\n break;\n case \"instance_light\":\n data.instanceLights.push(parseId(child.getAttribute(\"url\")));\n break;\n case \"instance_geometry\":\n data.instanceGeometries.push(parseNodeInstance(child));\n break;\n case \"instance_node\":\n data.instanceNodes.push(parseId(child.getAttribute(\"url\")));\n break;\n case \"matrix\":\n array = parseFloats(child.textContent);\n data.matrix.multiply(matrix2.fromArray(array).transpose());\n data.transforms[child.getAttribute(\"sid\")] = child.nodeName;\n break;\n case \"translate\":\n array = parseFloats(child.textContent);\n vector.fromArray(array);\n data.matrix.multiply(matrix2.makeTranslation(vector.x, vector.y, vector.z));\n data.transforms[child.getAttribute(\"sid\")] = child.nodeName;\n break;\n case \"rotate\":\n array = parseFloats(child.textContent);\n const angle = three__WEBPACK_IMPORTED_MODULE_42__.MathUtils.degToRad(array[3]);\n data.matrix.multiply(matrix2.makeRotationAxis(vector.fromArray(array), angle));\n data.transforms[child.getAttribute(\"sid\")] = child.nodeName;\n break;\n case \"scale\":\n array = parseFloats(child.textContent);\n data.matrix.scale(vector.fromArray(array));\n data.transforms[child.getAttribute(\"sid\")] = child.nodeName;\n break;\n case \"extra\":\n break;\n default:\n console.log(child);\n }\n }\n if (hasNode(data.id)) {\n console.warn(\n \"THREE.ColladaLoader: There is already a node with ID %s. Exclude current node from further processing.\",\n data.id\n );\n } else {\n library.nodes[data.id] = data;\n }\n return data;\n }\n function parseNodeInstance(xml2) {\n const data = {\n id: parseId(xml2.getAttribute(\"url\")),\n materials: {},\n skeletons: []\n };\n for (let i2 = 0; i2 < xml2.childNodes.length; i2++) {\n const child = xml2.childNodes[i2];\n switch (child.nodeName) {\n case \"bind_material\":\n const instances = child.getElementsByTagName(\"instance_material\");\n for (let j = 0; j < instances.length; j++) {\n const instance = instances[j];\n const symbol = instance.getAttribute(\"symbol\");\n const target = instance.getAttribute(\"target\");\n data.materials[symbol] = parseId(target);\n }\n break;\n case \"skeleton\":\n data.skeletons.push(parseId(child.textContent));\n break;\n }\n }\n return data;\n }\n function buildSkeleton(skeletons, joints) {\n const boneData = [];\n const sortedBoneData = [];\n let i2, j, data;\n for (i2 = 0; i2 < skeletons.length; i2++) {\n const skeleton = skeletons[i2];\n let root;\n if (hasNode(skeleton)) {\n root = getNode(skeleton);\n buildBoneHierarchy(root, joints, boneData);\n } else if (hasVisualScene(skeleton)) {\n const visualScene = library.visualScenes[skeleton];\n const children = visualScene.children;\n for (let j2 = 0; j2 < children.length; j2++) {\n const child = children[j2];\n if (child.type === \"JOINT\") {\n const root2 = getNode(child.id);\n buildBoneHierarchy(root2, joints, boneData);\n }\n }\n } else {\n console.error(\"THREE.ColladaLoader: Unable to find root bone of skeleton with ID:\", skeleton);\n }\n }\n for (i2 = 0; i2 < joints.length; i2++) {\n for (j = 0; j < boneData.length; j++) {\n data = boneData[j];\n if (data.bone.name === joints[i2].name) {\n sortedBoneData[i2] = data;\n data.processed = true;\n break;\n }\n }\n }\n for (i2 = 0; i2 < boneData.length; i2++) {\n data = boneData[i2];\n if (data.processed === false) {\n sortedBoneData.push(data);\n data.processed = true;\n }\n }\n const bones = [];\n const boneInverses = [];\n for (i2 = 0; i2 < sortedBoneData.length; i2++) {\n data = sortedBoneData[i2];\n bones.push(data.bone);\n boneInverses.push(data.boneInverse);\n }\n return new three__WEBPACK_IMPORTED_MODULE_42__.Skeleton(bones, boneInverses);\n }\n function buildBoneHierarchy(root, joints, boneData) {\n root.traverse(function(object) {\n if (object.isBone === true) {\n let boneInverse;\n for (let i2 = 0; i2 < joints.length; i2++) {\n const joint = joints[i2];\n if (joint.name === object.name) {\n boneInverse = joint.boneInverse;\n break;\n }\n }\n if (boneInverse === void 0) {\n boneInverse = new three__WEBPACK_IMPORTED_MODULE_42__.Matrix4();\n }\n boneData.push({ bone: object, boneInverse, processed: false });\n }\n });\n }\n function buildNode(data) {\n const objects = [];\n const matrix3 = data.matrix;\n const nodes = data.nodes;\n const type = data.type;\n const instanceCameras = data.instanceCameras;\n const instanceControllers = data.instanceControllers;\n const instanceLights = data.instanceLights;\n const instanceGeometries = data.instanceGeometries;\n const instanceNodes = data.instanceNodes;\n for (let i2 = 0, l = nodes.length; i2 < l; i2++) {\n objects.push(getNode(nodes[i2]));\n }\n for (let i2 = 0, l = instanceCameras.length; i2 < l; i2++) {\n const instanceCamera = getCamera(instanceCameras[i2]);\n if (instanceCamera !== null) {\n objects.push(instanceCamera.clone());\n }\n }\n for (let i2 = 0, l = instanceControllers.length; i2 < l; i2++) {\n const instance = instanceControllers[i2];\n const controller = getController(instance.id);\n const geometries = getGeometry(controller.id);\n const newObjects = buildObjects(geometries, instance.materials);\n const skeletons = instance.skeletons;\n const joints = controller.skin.joints;\n const skeleton = buildSkeleton(skeletons, joints);\n for (let j = 0, jl = newObjects.length; j < jl; j++) {\n const object2 = newObjects[j];\n if (object2.isSkinnedMesh) {\n object2.bind(skeleton, controller.skin.bindMatrix);\n object2.normalizeSkinWeights();\n }\n objects.push(object2);\n }\n }\n for (let i2 = 0, l = instanceLights.length; i2 < l; i2++) {\n const instanceLight = getLight(instanceLights[i2]);\n if (instanceLight !== null) {\n objects.push(instanceLight.clone());\n }\n }\n for (let i2 = 0, l = instanceGeometries.length; i2 < l; i2++) {\n const instance = instanceGeometries[i2];\n const geometries = getGeometry(instance.id);\n const newObjects = buildObjects(geometries, instance.materials);\n for (let j = 0, jl = newObjects.length; j < jl; j++) {\n objects.push(newObjects[j]);\n }\n }\n for (let i2 = 0, l = instanceNodes.length; i2 < l; i2++) {\n objects.push(getNode(instanceNodes[i2]).clone());\n }\n let object;\n if (nodes.length === 0 && objects.length === 1) {\n object = objects[0];\n } else {\n object = type === \"JOINT\" ? new three__WEBPACK_IMPORTED_MODULE_42__.Bone() : new three__WEBPACK_IMPORTED_MODULE_42__.Group();\n for (let i2 = 0; i2 < objects.length; i2++) {\n object.add(objects[i2]);\n }\n }\n object.name = type === \"JOINT\" ? data.sid : data.name;\n object.matrix.copy(matrix3);\n object.matrix.decompose(object.position, object.quaternion, object.scale);\n return object;\n }\n const fallbackMaterial = new three__WEBPACK_IMPORTED_MODULE_42__.MeshBasicMaterial({ color: 16711935 });\n function resolveMaterialBinding(keys2, instanceMaterials) {\n const materials = [];\n for (let i2 = 0, l = keys2.length; i2 < l; i2++) {\n const id = instanceMaterials[keys2[i2]];\n if (id === void 0) {\n console.warn(\"THREE.ColladaLoader: Material with key %s not found. Apply fallback material.\", keys2[i2]);\n materials.push(fallbackMaterial);\n } else {\n materials.push(getMaterial2(id));\n }\n }\n return materials;\n }\n function buildObjects(geometries, instanceMaterials) {\n const objects = [];\n for (const type in geometries) {\n const geometry2 = geometries[type];\n const materials = resolveMaterialBinding(geometry2.materialKeys, instanceMaterials);\n if (materials.length === 0) {\n if (type === \"lines\" || type === \"linestrips\") {\n materials.push(new three__WEBPACK_IMPORTED_MODULE_42__.LineBasicMaterial());\n } else {\n materials.push(new three__WEBPACK_IMPORTED_MODULE_42__.MeshPhongMaterial());\n }\n }\n const skinning = geometry2.data.attributes.skinIndex !== void 0;\n const material2 = materials.length === 1 ? materials[0] : materials;\n let object;\n switch (type) {\n case \"lines\":\n object = new three__WEBPACK_IMPORTED_MODULE_42__.LineSegments(geometry2.data, material2);\n break;\n case \"linestrips\":\n object = new three__WEBPACK_IMPORTED_MODULE_42__.Line(geometry2.data, material2);\n break;\n case \"triangles\":\n case \"polylist\":\n if (skinning) {\n object = new three__WEBPACK_IMPORTED_MODULE_42__.SkinnedMesh(geometry2.data, material2);\n } else {\n object = new three__WEBPACK_IMPORTED_MODULE_42__.Mesh(geometry2.data, material2);\n }\n break;\n }\n objects.push(object);\n }\n return objects;\n }\n function hasNode(id) {\n return library.nodes[id] !== void 0;\n }\n function getNode(id) {\n return getBuild(library.nodes[id], buildNode);\n }\n function parseVisualScene(xml2) {\n const data = {\n name: xml2.getAttribute(\"name\"),\n children: []\n };\n prepareNodes(xml2);\n const elements = getElementsByTagName(xml2, \"node\");\n for (let i2 = 0; i2 < elements.length; i2++) {\n data.children.push(parseNode(elements[i2]));\n }\n library.visualScenes[xml2.getAttribute(\"id\")] = data;\n }\n function buildVisualScene(data) {\n const group = new three__WEBPACK_IMPORTED_MODULE_42__.Group();\n group.name = data.name;\n const children = data.children;\n for (let i2 = 0; i2 < children.length; i2++) {\n const child = children[i2];\n group.add(getNode(child.id));\n }\n return group;\n }\n function hasVisualScene(id) {\n return library.visualScenes[id] !== void 0;\n }\n function getVisualScene(id) {\n return getBuild(library.visualScenes[id], buildVisualScene);\n }\n function parseScene(xml2) {\n const instance = getElementsByTagName(xml2, \"instance_visual_scene\")[0];\n return getVisualScene(parseId(instance.getAttribute(\"url\")));\n }\n function setupAnimations() {\n const clips = library.clips;\n if (isEmpty(clips) === true) {\n if (isEmpty(library.animations) === false) {\n const tracks = [];\n for (const id in library.animations) {\n const animationTracks = getAnimation(id);\n for (let i2 = 0, l = animationTracks.length; i2 < l; i2++) {\n tracks.push(animationTracks[i2]);\n }\n }\n animations.push(new three__WEBPACK_IMPORTED_MODULE_42__.AnimationClip(\"default\", -1, tracks));\n }\n } else {\n for (const id in clips) {\n animations.push(getAnimationClip(id));\n }\n }\n }\n function parserErrorToText(parserError2) {\n let result = \"\";\n const stack = [parserError2];\n while (stack.length) {\n const node = stack.shift();\n if (node.nodeType === Node.TEXT_NODE) {\n result += node.textContent;\n } else {\n result += \"\\n\";\n stack.push.apply(stack, node.childNodes);\n }\n }\n return result.trim();\n }\n if (text.length === 0) {\n return { scene: new three__WEBPACK_IMPORTED_MODULE_42__.Scene() };\n }\n const xml = new DOMParser().parseFromString(text, \"application/xml\");\n const collada = getElementsByTagName(xml, \"COLLADA\")[0];\n const parserError = xml.getElementsByTagName(\"parsererror\")[0];\n if (parserError !== void 0) {\n const errorElement = getElementsByTagName(parserError, \"div\")[0];\n let errorText;\n if (errorElement) {\n errorText = errorElement.textContent;\n } else {\n errorText = parserErrorToText(parserError);\n }\n console.error(\"THREE.ColladaLoader: Failed to parse collada file.\\n\", errorText);\n return null;\n }\n const version2 = collada.getAttribute(\"version\");\n console.log(\"THREE.ColladaLoader: File version\", version2);\n const asset = parseAsset(getElementsByTagName(collada, \"asset\")[0]);\n const textureLoader = new three__WEBPACK_IMPORTED_MODULE_42__.TextureLoader(this.manager);\n textureLoader.setPath(this.resourcePath || path).setCrossOrigin(this.crossOrigin);\n let tgaLoader;\n if (TGALoader) {\n tgaLoader = new TGALoader(this.manager);\n tgaLoader.setPath(this.resourcePath || path);\n }\n const animations = [];\n let kinematics = {};\n let count = 0;\n const library = {\n animations: {},\n clips: {},\n controllers: {},\n images: {},\n effects: {},\n materials: {},\n cameras: {},\n lights: {},\n geometries: {},\n nodes: {},\n visualScenes: {},\n kinematicsModels: {},\n physicsModels: {},\n kinematicsScenes: {}\n };\n parseLibrary(collada, \"library_animations\", \"animation\", parseAnimation);\n parseLibrary(collada, \"library_animation_clips\", \"animation_clip\", parseAnimationClip);\n parseLibrary(collada, \"library_controllers\", \"controller\", parseController);\n parseLibrary(collada, \"library_images\", \"image\", parseImage);\n parseLibrary(collada, \"library_effects\", \"effect\", parseEffect);\n parseLibrary(collada, \"library_materials\", \"material\", parseMaterial);\n parseLibrary(collada, \"library_cameras\", \"camera\", parseCamera);\n parseLibrary(collada, \"library_lights\", \"light\", parseLight);\n parseLibrary(collada, \"library_geometries\", \"geometry\", parseGeometry);\n parseLibrary(collada, \"library_nodes\", \"node\", parseNode);\n parseLibrary(collada, \"library_visual_scenes\", \"visual_scene\", parseVisualScene);\n parseLibrary(collada, \"library_kinematics_models\", \"kinematics_model\", parseKinematicsModel);\n parseLibrary(collada, \"library_physics_models\", \"physics_model\", parsePhysicsModel);\n parseLibrary(collada, \"scene\", \"instance_kinematics_scene\", parseKinematicsScene);\n buildLibrary(library.animations, buildAnimation);\n buildLibrary(library.clips, buildAnimationClip);\n buildLibrary(library.controllers, buildController);\n buildLibrary(library.images, buildImage);\n buildLibrary(library.effects, buildEffect);\n buildLibrary(library.materials, buildMaterial);\n buildLibrary(library.cameras, buildCamera);\n buildLibrary(library.lights, buildLight);\n buildLibrary(library.geometries, buildGeometry);\n buildLibrary(library.visualScenes, buildVisualScene);\n setupAnimations();\n setupKinematics();\n const scene = parseScene(getElementsByTagName(collada, \"scene\")[0]);\n scene.animations = animations;\n if (asset.upAxis === \"Z_UP\") {\n scene.quaternion.setFromEuler(new three__WEBPACK_IMPORTED_MODULE_42__.Euler(-Math.PI / 2, 0, 0));\n }\n scene.scale.multiplyScalar(asset.unit);\n return {\n get animations() {\n console.warn(\"THREE.ColladaLoader: Please access animations over scene.animations now.\");\n return animations;\n },\n kinematics,\n library,\n scene\n };\n }\n}\nclass KMZLoader extends three__WEBPACK_IMPORTED_MODULE_42__.Loader {\n constructor(manager) {\n super(manager);\n }\n load(url, onLoad, onProgress, onError) {\n const scope = this;\n const loader = new three__WEBPACK_IMPORTED_MODULE_42__.FileLoader(scope.manager);\n loader.setPath(scope.path);\n loader.setResponseType(\"arraybuffer\");\n loader.setRequestHeader(scope.requestHeader);\n loader.setWithCredentials(scope.withCredentials);\n loader.load(\n url,\n function(text) {\n try {\n onLoad(scope.parse(text));\n } catch (e) {\n if (onError) {\n onError(e);\n } else {\n console.error(e);\n }\n scope.manager.itemError(url);\n }\n },\n onProgress,\n onError\n );\n }\n parse(data) {\n function findFile(url) {\n for (const path in zip) {\n if (path.substr(-url.length) === url) {\n return zip[path];\n }\n }\n }\n const manager = new three__WEBPACK_IMPORTED_MODULE_42__.LoadingManager();\n manager.setURLModifier(function(url) {\n const image = findFile(url);\n if (image) {\n console.log(\"Loading\", url);\n const blob = new Blob([image.buffer], { type: \"application/octet-stream\" });\n return URL.createObjectURL(blob);\n }\n return url;\n });\n const zip = (0,fflate__WEBPACK_IMPORTED_MODULE_43__.unzipSync)(new Uint8Array(data));\n if (zip[\"doc.kml\"]) {\n const xml = new DOMParser().parseFromString(fflate.strFromU8(zip[\"doc.kml\"]), \"application/xml\");\n const model2 = xml.querySelector(\"Placemark Model Link href\");\n if (model2) {\n const loader = new ColladaLoader(manager);\n return loader.parse(fflate.strFromU8(zip[model2.textContent]));\n }\n } else {\n console.warn(\"KMZLoader: Missing doc.kml file.\");\n for (const path in zip) {\n const extension = path.split(\".\").pop().toLowerCase();\n if (extension === \"dae\") {\n const loader = new ColladaLoader(manager);\n return loader.parse(fflate.strFromU8(zip[path]));\n }\n }\n }\n console.error(\"KMZLoader: Couldn't find .dae file.\");\n return { scene: new three__WEBPACK_IMPORTED_MODULE_42__.Group() };\n }\n}\nclass VRMLoader extends three__WEBPACK_IMPORTED_MODULE_42__.Loader {\n constructor(manager) {\n super(manager);\n this.gltfLoader = new GLTFLoader(manager);\n }\n load(url, onLoad, onProgress, onError) {\n const scope = this;\n this.gltfLoader.load(\n url,\n function(gltf) {\n try {\n scope.parse(gltf, onLoad);\n } catch (e) {\n if (onError) {\n onError(e);\n } else {\n console.error(e);\n }\n scope.manager.itemError(url);\n }\n },\n onProgress,\n onError\n );\n }\n setDRACOLoader(dracoLoader) {\n this.gltfLoader.setDRACOLoader(dracoLoader);\n return this;\n }\n parse(gltf, onLoad) {\n onLoad(gltf);\n }\n}\nvar commonjsGlobal = typeof globalThis !== \"undefined\" ? globalThis : typeof window !== \"undefined\" ? window : typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : {};\nfunction getDefaultExportFromCjs(x) {\n return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, \"default\") ? x[\"default\"] : x;\n}\nvar api$3 = {};\nvar version = {};\nObject.defineProperty(version, \"__esModule\", { value: true });\nversion.VERSION = void 0;\nversion.VERSION = \"10.5.0\";\nvar parser = {};\nvar api$2 = {};\nvar print = {};\nObject.defineProperty(print, \"__esModule\", { value: true });\nprint.PRINT_WARNING = print.PRINT_ERROR = void 0;\nfunction PRINT_ERROR(msg) {\n if (console && console.error) {\n console.error(\"Error: \".concat(msg));\n }\n}\nprint.PRINT_ERROR = PRINT_ERROR;\nfunction PRINT_WARNING(msg) {\n if (console && console.warn) {\n console.warn(\"Warning: \".concat(msg));\n }\n}\nprint.PRINT_WARNING = PRINT_WARNING;\nvar timer$1 = {};\nObject.defineProperty(timer$1, \"__esModule\", { value: true });\ntimer$1.timer = void 0;\nfunction timer(func) {\n var start = (/* @__PURE__ */ new Date()).getTime();\n var val = func();\n var end = (/* @__PURE__ */ new Date()).getTime();\n var total = end - start;\n return { time: total, value: val };\n}\ntimer$1.timer = timer;\nvar toFastProperties$1 = {};\nObject.defineProperty(toFastProperties$1, \"__esModule\", { value: true });\ntoFastProperties$1.toFastProperties = void 0;\nfunction toFastProperties(toBecomeFast) {\n function FakeConstructor() {\n }\n FakeConstructor.prototype = toBecomeFast;\n var fakeInstance = new FakeConstructor();\n function fakeAccess() {\n return typeof fakeInstance.bar;\n }\n fakeAccess();\n fakeAccess();\n return toBecomeFast;\n}\ntoFastProperties$1.toFastProperties = toFastProperties;\n(function(exports) {\n Object.defineProperty(exports, \"__esModule\", { value: true });\n exports.toFastProperties = exports.timer = exports.PRINT_ERROR = exports.PRINT_WARNING = void 0;\n var print_1 = print;\n Object.defineProperty(exports, \"PRINT_WARNING\", { enumerable: true, get: function() {\n return print_1.PRINT_WARNING;\n } });\n Object.defineProperty(exports, \"PRINT_ERROR\", { enumerable: true, get: function() {\n return print_1.PRINT_ERROR;\n } });\n var timer_1 = timer$1;\n Object.defineProperty(exports, \"timer\", { enumerable: true, get: function() {\n return timer_1.timer;\n } });\n var to_fast_properties_1 = toFastProperties$1;\n Object.defineProperty(exports, \"toFastProperties\", { enumerable: true, get: function() {\n return to_fast_properties_1.toFastProperties;\n } });\n})(api$2);\nvar follow = {};\nvar rest = {};\nvar api$1 = {};\nvar model$1 = {};\nvar __extends$4 = commonjsGlobal && commonjsGlobal.__extends || function() {\n var extendStatics = function(d, b2) {\n extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b3) {\n d2.__proto__ = b3;\n } || function(d2, b3) {\n for (var p in b3)\n if (Object.prototype.hasOwnProperty.call(b3, p))\n d2[p] = b3[p];\n };\n return extendStatics(d, b2);\n };\n return function(d, b2) {\n if (typeof b2 !== \"function\" && b2 !== null)\n throw new TypeError(\"Class extends value \" + String(b2) + \" is not a constructor or null\");\n extendStatics(d, b2);\n function __() {\n this.constructor = d;\n }\n d.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());\n };\n}();\nvar __importDefault$9 = commonjsGlobal && commonjsGlobal.__importDefault || function(mod2) {\n return mod2 && mod2.__esModule ? mod2 : { \"default\": mod2 };\n};\nObject.defineProperty(model$1, \"__esModule\", { value: true });\nmodel$1.serializeProduction = model$1.serializeGrammar = model$1.Terminal = model$1.Alternation = model$1.RepetitionWithSeparator = model$1.Repetition = model$1.RepetitionMandatoryWithSeparator = model$1.RepetitionMandatory = model$1.Option = model$1.Alternative = model$1.Rule = model$1.NonTerminal = model$1.AbstractProduction = void 0;\nvar map_1$3 = __importDefault$9(lodash_map__WEBPACK_IMPORTED_MODULE_3__);\nvar forEach_1$3 = __importDefault$9(lodash_forEach__WEBPACK_IMPORTED_MODULE_4__);\nvar isString_1 = __importDefault$9(lodash_isString__WEBPACK_IMPORTED_MODULE_9__);\nvar isRegExp_1 = __importDefault$9(lodash_isRegExp__WEBPACK_IMPORTED_MODULE_10__);\nvar pickBy_1 = __importDefault$9(lodash_pickBy__WEBPACK_IMPORTED_MODULE_11__);\nvar assign_1$2 = __importDefault$9(lodash_assign__WEBPACK_IMPORTED_MODULE_12__);\nfunction tokenLabel(tokType) {\n if (hasTokenLabel(tokType)) {\n return tokType.LABEL;\n } else {\n return tokType.name;\n }\n}\nfunction hasTokenLabel(obj) {\n return (0, isString_1.default)(obj.LABEL) && obj.LABEL !== \"\";\n}\nvar AbstractProduction = (\n /** @class */\n function() {\n function AbstractProduction2(_definition) {\n this._definition = _definition;\n }\n Object.defineProperty(AbstractProduction2.prototype, \"definition\", {\n get: function() {\n return this._definition;\n },\n set: function(value) {\n this._definition = value;\n },\n enumerable: false,\n configurable: true\n });\n AbstractProduction2.prototype.accept = function(visitor2) {\n visitor2.visit(this);\n (0, forEach_1$3.default)(this.definition, function(prod) {\n prod.accept(visitor2);\n });\n };\n return AbstractProduction2;\n }()\n);\nmodel$1.AbstractProduction = AbstractProduction;\nvar NonTerminal = (\n /** @class */\n function(_super) {\n __extends$4(NonTerminal2, _super);\n function NonTerminal2(options) {\n var _this = _super.call(this, []) || this;\n _this.idx = 1;\n (0, assign_1$2.default)(_this, (0, pickBy_1.default)(options, function(v) {\n return v !== void 0;\n }));\n return _this;\n }\n Object.defineProperty(NonTerminal2.prototype, \"definition\", {\n get: function() {\n if (this.referencedRule !== void 0) {\n return this.referencedRule.definition;\n }\n return [];\n },\n set: function(definition) {\n },\n enumerable: false,\n configurable: true\n });\n NonTerminal2.prototype.accept = function(visitor2) {\n visitor2.visit(this);\n };\n return NonTerminal2;\n }(AbstractProduction)\n);\nmodel$1.NonTerminal = NonTerminal;\nvar Rule = (\n /** @class */\n function(_super) {\n __extends$4(Rule2, _super);\n function Rule2(options) {\n var _this = _super.call(this, options.definition) || this;\n _this.orgText = \"\";\n (0, assign_1$2.default)(_this, (0, pickBy_1.default)(options, function(v) {\n return v !== void 0;\n }));\n return _this;\n }\n return Rule2;\n }(AbstractProduction)\n);\nmodel$1.Rule = Rule;\nvar Alternative = (\n /** @class */\n function(_super) {\n __extends$4(Alternative2, _super);\n function Alternative2(options) {\n var _this = _super.call(this, options.definition) || this;\n _this.ignoreAmbiguities = false;\n (0, assign_1$2.default)(_this, (0, pickBy_1.default)(options, function(v) {\n return v !== void 0;\n }));\n return _this;\n }\n return Alternative2;\n }(AbstractProduction)\n);\nmodel$1.Alternative = Alternative;\nvar Option = (\n /** @class */\n function(_super) {\n __extends$4(Option2, _super);\n function Option2(options) {\n var _this = _super.call(this, options.definition) || this;\n _this.idx = 1;\n (0, assign_1$2.default)(_this, (0, pickBy_1.default)(options, function(v) {\n return v !== void 0;\n }));\n return _this;\n }\n return Option2;\n }(AbstractProduction)\n);\nmodel$1.Option = Option;\nvar RepetitionMandatory = (\n /** @class */\n function(_super) {\n __extends$4(RepetitionMandatory2, _super);\n function RepetitionMandatory2(options) {\n var _this = _super.call(this, options.definition) || this;\n _this.idx = 1;\n (0, assign_1$2.default)(_this, (0, pickBy_1.default)(options, function(v) {\n return v !== void 0;\n }));\n return _this;\n }\n return RepetitionMandatory2;\n }(AbstractProduction)\n);\nmodel$1.RepetitionMandatory = RepetitionMandatory;\nvar RepetitionMandatoryWithSeparator = (\n /** @class */\n function(_super) {\n __extends$4(RepetitionMandatoryWithSeparator2, _super);\n function RepetitionMandatoryWithSeparator2(options) {\n var _this = _super.call(this, options.definition) || this;\n _this.idx = 1;\n (0, assign_1$2.default)(_this, (0, pickBy_1.default)(options, function(v) {\n return v !== void 0;\n }));\n return _this;\n }\n return RepetitionMandatoryWithSeparator2;\n }(AbstractProduction)\n);\nmodel$1.RepetitionMandatoryWithSeparator = RepetitionMandatoryWithSeparator;\nvar Repetition = (\n /** @class */\n function(_super) {\n __extends$4(Repetition2, _super);\n function Repetition2(options) {\n var _this = _super.call(this, options.definition) || this;\n _this.idx = 1;\n (0, assign_1$2.default)(_this, (0, pickBy_1.default)(options, function(v) {\n return v !== void 0;\n }));\n return _this;\n }\n return Repetition2;\n }(AbstractProduction)\n);\nmodel$1.Repetition = Repetition;\nvar RepetitionWithSeparator = (\n /** @class */\n function(_super) {\n __extends$4(RepetitionWithSeparator2, _super);\n function RepetitionWithSeparator2(options) {\n var _this = _super.call(this, options.definition) || this;\n _this.idx = 1;\n (0, assign_1$2.default)(_this, (0, pickBy_1.default)(options, function(v) {\n return v !== void 0;\n }));\n return _this;\n }\n return RepetitionWithSeparator2;\n }(AbstractProduction)\n);\nmodel$1.RepetitionWithSeparator = RepetitionWithSeparator;\nvar Alternation = (\n /** @class */\n function(_super) {\n __extends$4(Alternation2, _super);\n function Alternation2(options) {\n var _this = _super.call(this, options.definition) || this;\n _this.idx = 1;\n _this.ignoreAmbiguities = false;\n _this.hasPredicates = false;\n (0, assign_1$2.default)(_this, (0, pickBy_1.default)(options, function(v) {\n return v !== void 0;\n }));\n return _this;\n }\n Object.defineProperty(Alternation2.prototype, \"definition\", {\n get: function() {\n return this._definition;\n },\n set: function(value) {\n this._definition = value;\n },\n enumerable: false,\n configurable: true\n });\n return Alternation2;\n }(AbstractProduction)\n);\nmodel$1.Alternation = Alternation;\nvar Terminal = (\n /** @class */\n function() {\n function Terminal2(options) {\n this.idx = 1;\n (0, assign_1$2.default)(this, (0, pickBy_1.default)(options, function(v) {\n return v !== void 0;\n }));\n }\n Terminal2.prototype.accept = function(visitor2) {\n visitor2.visit(this);\n };\n return Terminal2;\n }()\n);\nmodel$1.Terminal = Terminal;\nfunction serializeGrammar(topRules) {\n return (0, map_1$3.default)(topRules, serializeProduction);\n}\nmodel$1.serializeGrammar = serializeGrammar;\nfunction serializeProduction(node) {\n function convertDefinition(definition) {\n return (0, map_1$3.default)(definition, serializeProduction);\n }\n if (node instanceof NonTerminal) {\n var serializedNonTerminal = {\n type: \"NonTerminal\",\n name: node.nonTerminalName,\n idx: node.idx\n };\n if ((0, isString_1.default)(node.label)) {\n serializedNonTerminal.label = node.label;\n }\n return serializedNonTerminal;\n } else if (node instanceof Alternative) {\n return {\n type: \"Alternative\",\n definition: convertDefinition(node.definition)\n };\n } else if (node instanceof Option) {\n return {\n type: \"Option\",\n idx: node.idx,\n definition: convertDefinition(node.definition)\n };\n } else if (node instanceof RepetitionMandatory) {\n return {\n type: \"RepetitionMandatory\",\n idx: node.idx,\n definition: convertDefinition(node.definition)\n };\n } else if (node instanceof RepetitionMandatoryWithSeparator) {\n return {\n type: \"RepetitionMandatoryWithSeparator\",\n idx: node.idx,\n separator: serializeProduction(new Terminal({ terminalType: node.separator })),\n definition: convertDefinition(node.definition)\n };\n } else if (node instanceof RepetitionWithSeparator) {\n return {\n type: \"RepetitionWithSeparator\",\n idx: node.idx,\n separator: serializeProduction(new Terminal({ terminalType: node.separator })),\n definition: convertDefinition(node.definition)\n };\n } else if (node instanceof Repetition) {\n return {\n type: \"Repetition\",\n idx: node.idx,\n definition: convertDefinition(node.definition)\n };\n } else if (node instanceof Alternation) {\n return {\n type: \"Alternation\",\n idx: node.idx,\n definition: convertDefinition(node.definition)\n };\n } else if (node instanceof Terminal) {\n var serializedTerminal = {\n type: \"Terminal\",\n name: node.terminalType.name,\n label: tokenLabel(node.terminalType),\n idx: node.idx\n };\n if ((0, isString_1.default)(node.label)) {\n serializedTerminal.terminalLabel = node.label;\n }\n var pattern = node.terminalType.PATTERN;\n if (node.terminalType.PATTERN) {\n serializedTerminal.pattern = (0, isRegExp_1.default)(pattern) ? pattern.source : pattern;\n }\n return serializedTerminal;\n } else if (node instanceof Rule) {\n return {\n type: \"Rule\",\n name: node.name,\n orgText: node.orgText,\n definition: convertDefinition(node.definition)\n };\n } else {\n throw Error(\"non exhaustive match\");\n }\n}\nmodel$1.serializeProduction = serializeProduction;\nvar visitor = {};\nObject.defineProperty(visitor, \"__esModule\", { value: true });\nvisitor.GAstVisitor = void 0;\nvar model_1$2 = model$1;\nvar GAstVisitor = (\n /** @class */\n function() {\n function GAstVisitor2() {\n }\n GAstVisitor2.prototype.visit = function(node) {\n var nodeAny = node;\n switch (nodeAny.constructor) {\n case model_1$2.NonTerminal:\n return this.visitNonTerminal(nodeAny);\n case model_1$2.Alternative:\n return this.visitAlternative(nodeAny);\n case model_1$2.Option:\n return this.visitOption(nodeAny);\n case model_1$2.RepetitionMandatory:\n return this.visitRepetitionMandatory(nodeAny);\n case model_1$2.RepetitionMandatoryWithSeparator:\n return this.visitRepetitionMandatoryWithSeparator(nodeAny);\n case model_1$2.RepetitionWithSeparator:\n return this.visitRepetitionWithSeparator(nodeAny);\n case model_1$2.Repetition:\n return this.visitRepetition(nodeAny);\n case model_1$2.Alternation:\n return this.visitAlternation(nodeAny);\n case model_1$2.Terminal:\n return this.visitTerminal(nodeAny);\n case model_1$2.Rule:\n return this.visitRule(nodeAny);\n default:\n throw Error(\"non exhaustive match\");\n }\n };\n GAstVisitor2.prototype.visitNonTerminal = function(node) {\n };\n GAstVisitor2.prototype.visitAlternative = function(node) {\n };\n GAstVisitor2.prototype.visitOption = function(node) {\n };\n GAstVisitor2.prototype.visitRepetition = function(node) {\n };\n GAstVisitor2.prototype.visitRepetitionMandatory = function(node) {\n };\n GAstVisitor2.prototype.visitRepetitionMandatoryWithSeparator = function(node) {\n };\n GAstVisitor2.prototype.visitRepetitionWithSeparator = function(node) {\n };\n GAstVisitor2.prototype.visitAlternation = function(node) {\n };\n GAstVisitor2.prototype.visitTerminal = function(node) {\n };\n GAstVisitor2.prototype.visitRule = function(node) {\n };\n return GAstVisitor2;\n }()\n);\nvisitor.GAstVisitor = GAstVisitor;\nvar helpers = {};\nvar __importDefault$8 = commonjsGlobal && commonjsGlobal.__importDefault || function(mod2) {\n return mod2 && mod2.__esModule ? mod2 : { \"default\": mod2 };\n};\nObject.defineProperty(helpers, \"__esModule\", { value: true });\nhelpers.getProductionDslName = helpers.isBranchingProd = helpers.isOptionalProd = helpers.isSequenceProd = void 0;\nvar some_1$1 = __importDefault$8(lodash_some__WEBPACK_IMPORTED_MODULE_13__);\nvar every_1 = __importDefault$8(lodash_every__WEBPACK_IMPORTED_MODULE_14__);\nvar includes_1$1 = __importDefault$8(lodash_includes__WEBPACK_IMPORTED_MODULE_15__);\nvar model_1$1 = model$1;\nfunction isSequenceProd(prod) {\n return prod instanceof model_1$1.Alternative || prod instanceof model_1$1.Option || prod instanceof model_1$1.Repetition || prod instanceof model_1$1.RepetitionMandatory || prod instanceof model_1$1.RepetitionMandatoryWithSeparator || prod instanceof model_1$1.RepetitionWithSeparator || prod instanceof model_1$1.Terminal || prod instanceof model_1$1.Rule;\n}\nhelpers.isSequenceProd = isSequenceProd;\nfunction isOptionalProd(prod, alreadyVisited) {\n if (alreadyVisited === void 0) {\n alreadyVisited = [];\n }\n var isDirectlyOptional = prod instanceof model_1$1.Option || prod instanceof model_1$1.Repetition || prod instanceof model_1$1.RepetitionWithSeparator;\n if (isDirectlyOptional) {\n return true;\n }\n if (prod instanceof model_1$1.Alternation) {\n return (0, some_1$1.default)(prod.definition, function(subProd) {\n return isOptionalProd(subProd, alreadyVisited);\n });\n } else if (prod instanceof model_1$1.NonTerminal && (0, includes_1$1.default)(alreadyVisited, prod)) {\n return false;\n } else if (prod instanceof model_1$1.AbstractProduction) {\n if (prod instanceof model_1$1.NonTerminal) {\n alreadyVisited.push(prod);\n }\n return (0, every_1.default)(prod.definition, function(subProd) {\n return isOptionalProd(subProd, alreadyVisited);\n });\n } else {\n return false;\n }\n}\nhelpers.isOptionalProd = isOptionalProd;\nfunction isBranchingProd(prod) {\n return prod instanceof model_1$1.Alternation;\n}\nhelpers.isBranchingProd = isBranchingProd;\nfunction getProductionDslName(prod) {\n if (prod instanceof model_1$1.NonTerminal) {\n return \"SUBRULE\";\n } else if (prod instanceof model_1$1.Option) {\n return \"OPTION\";\n } else if (prod instanceof model_1$1.Alternation) {\n return \"OR\";\n } else if (prod instanceof model_1$1.RepetitionMandatory) {\n return \"AT_LEAST_ONE\";\n } else if (prod instanceof model_1$1.RepetitionMandatoryWithSeparator) {\n return \"AT_LEAST_ONE_SEP\";\n } else if (prod instanceof model_1$1.RepetitionWithSeparator) {\n return \"MANY_SEP\";\n } else if (prod instanceof model_1$1.Repetition) {\n return \"MANY\";\n } else if (prod instanceof model_1$1.Terminal) {\n return \"CONSUME\";\n } else {\n throw Error(\"non exhaustive match\");\n }\n}\nhelpers.getProductionDslName = getProductionDslName;\n(function(exports) {\n Object.defineProperty(exports, \"__esModule\", { value: true });\n exports.isSequenceProd = exports.isBranchingProd = exports.isOptionalProd = exports.getProductionDslName = exports.GAstVisitor = exports.serializeProduction = exports.serializeGrammar = exports.Alternative = exports.Alternation = exports.RepetitionWithSeparator = exports.RepetitionMandatoryWithSeparator = exports.RepetitionMandatory = exports.Repetition = exports.Option = exports.NonTerminal = exports.Terminal = exports.Rule = void 0;\n var model_12 = model$1;\n Object.defineProperty(exports, \"Rule\", { enumerable: true, get: function() {\n return model_12.Rule;\n } });\n Object.defineProperty(exports, \"Terminal\", { enumerable: true, get: function() {\n return model_12.Terminal;\n } });\n Object.defineProperty(exports, \"NonTerminal\", { enumerable: true, get: function() {\n return model_12.NonTerminal;\n } });\n Object.defineProperty(exports, \"Option\", { enumerable: true, get: function() {\n return model_12.Option;\n } });\n Object.defineProperty(exports, \"Repetition\", { enumerable: true, get: function() {\n return model_12.Repetition;\n } });\n Object.defineProperty(exports, \"RepetitionMandatory\", { enumerable: true, get: function() {\n return model_12.RepetitionMandatory;\n } });\n Object.defineProperty(exports, \"RepetitionMandatoryWithSeparator\", { enumerable: true, get: function() {\n return model_12.RepetitionMandatoryWithSeparator;\n } });\n Object.defineProperty(exports, \"RepetitionWithSeparator\", { enumerable: true, get: function() {\n return model_12.RepetitionWithSeparator;\n } });\n Object.defineProperty(exports, \"Alternation\", { enumerable: true, get: function() {\n return model_12.Alternation;\n } });\n Object.defineProperty(exports, \"Alternative\", { enumerable: true, get: function() {\n return model_12.Alternative;\n } });\n Object.defineProperty(exports, \"serializeGrammar\", { enumerable: true, get: function() {\n return model_12.serializeGrammar;\n } });\n Object.defineProperty(exports, \"serializeProduction\", { enumerable: true, get: function() {\n return model_12.serializeProduction;\n } });\n var visitor_1 = visitor;\n Object.defineProperty(exports, \"GAstVisitor\", { enumerable: true, get: function() {\n return visitor_1.GAstVisitor;\n } });\n var helpers_1 = helpers;\n Object.defineProperty(exports, \"getProductionDslName\", { enumerable: true, get: function() {\n return helpers_1.getProductionDslName;\n } });\n Object.defineProperty(exports, \"isOptionalProd\", { enumerable: true, get: function() {\n return helpers_1.isOptionalProd;\n } });\n Object.defineProperty(exports, \"isBranchingProd\", { enumerable: true, get: function() {\n return helpers_1.isBranchingProd;\n } });\n Object.defineProperty(exports, \"isSequenceProd\", { enumerable: true, get: function() {\n return helpers_1.isSequenceProd;\n } });\n})(api$1);\nvar __importDefault$7 = commonjsGlobal && commonjsGlobal.__importDefault || function(mod2) {\n return mod2 && mod2.__esModule ? mod2 : { \"default\": mod2 };\n};\nObject.defineProperty(rest, \"__esModule\", { value: true });\nrest.RestWalker = void 0;\nvar drop_1$1 = __importDefault$7(lodash_drop__WEBPACK_IMPORTED_MODULE_8__);\nvar forEach_1$2 = __importDefault$7(lodash_forEach__WEBPACK_IMPORTED_MODULE_4__);\nvar gast_1$4 = api$1;\nvar RestWalker = (\n /** @class */\n function() {\n function RestWalker2() {\n }\n RestWalker2.prototype.walk = function(prod, prevRest) {\n var _this = this;\n if (prevRest === void 0) {\n prevRest = [];\n }\n (0, forEach_1$2.default)(prod.definition, function(subProd, index) {\n var currRest = (0, drop_1$1.default)(prod.definition, index + 1);\n if (subProd instanceof gast_1$4.NonTerminal) {\n _this.walkProdRef(subProd, currRest, prevRest);\n } else if (subProd instanceof gast_1$4.Terminal) {\n _this.walkTerminal(subProd, currRest, prevRest);\n } else if (subProd instanceof gast_1$4.Alternative) {\n _this.walkFlat(subProd, currRest, prevRest);\n } else if (subProd instanceof gast_1$4.Option) {\n _this.walkOption(subProd, currRest, prevRest);\n } else if (subProd instanceof gast_1$4.RepetitionMandatory) {\n _this.walkAtLeastOne(subProd, currRest, prevRest);\n } else if (subProd instanceof gast_1$4.RepetitionMandatoryWithSeparator) {\n _this.walkAtLeastOneSep(subProd, currRest, prevRest);\n } else if (subProd instanceof gast_1$4.RepetitionWithSeparator) {\n _this.walkManySep(subProd, currRest, prevRest);\n } else if (subProd instanceof gast_1$4.Repetition) {\n _this.walkMany(subProd, currRest, prevRest);\n } else if (subProd instanceof gast_1$4.Alternation) {\n _this.walkOr(subProd, currRest, prevRest);\n } else {\n throw Error(\"non exhaustive match\");\n }\n });\n };\n RestWalker2.prototype.walkTerminal = function(terminal, currRest, prevRest) {\n };\n RestWalker2.prototype.walkProdRef = function(refProd, currRest, prevRest) {\n };\n RestWalker2.prototype.walkFlat = function(flatProd, currRest, prevRest) {\n var fullOrRest = currRest.concat(prevRest);\n this.walk(flatProd, fullOrRest);\n };\n RestWalker2.prototype.walkOption = function(optionProd, currRest, prevRest) {\n var fullOrRest = currRest.concat(prevRest);\n this.walk(optionProd, fullOrRest);\n };\n RestWalker2.prototype.walkAtLeastOne = function(atLeastOneProd, currRest, prevRest) {\n var fullAtLeastOneRest = [\n new gast_1$4.Option({ definition: atLeastOneProd.definition })\n ].concat(currRest, prevRest);\n this.walk(atLeastOneProd, fullAtLeastOneRest);\n };\n RestWalker2.prototype.walkAtLeastOneSep = function(atLeastOneSepProd, currRest, prevRest) {\n var fullAtLeastOneSepRest = restForRepetitionWithSeparator(atLeastOneSepProd, currRest, prevRest);\n this.walk(atLeastOneSepProd, fullAtLeastOneSepRest);\n };\n RestWalker2.prototype.walkMany = function(manyProd, currRest, prevRest) {\n var fullManyRest = [\n new gast_1$4.Option({ definition: manyProd.definition })\n ].concat(currRest, prevRest);\n this.walk(manyProd, fullManyRest);\n };\n RestWalker2.prototype.walkManySep = function(manySepProd, currRest, prevRest) {\n var fullManySepRest = restForRepetitionWithSeparator(manySepProd, currRest, prevRest);\n this.walk(manySepProd, fullManySepRest);\n };\n RestWalker2.prototype.walkOr = function(orProd, currRest, prevRest) {\n var _this = this;\n var fullOrRest = currRest.concat(prevRest);\n (0, forEach_1$2.default)(orProd.definition, function(alt) {\n var prodWrapper = new gast_1$4.Alternative({ definition: [alt] });\n _this.walk(prodWrapper, fullOrRest);\n });\n };\n return RestWalker2;\n }()\n);\nrest.RestWalker = RestWalker;\nfunction restForRepetitionWithSeparator(repSepProd, currRest, prevRest) {\n var repSepRest = [\n new gast_1$4.Option({\n definition: [\n new gast_1$4.Terminal({ terminalType: repSepProd.separator })\n ].concat(repSepProd.definition)\n })\n ];\n var fullRepSepRest = repSepRest.concat(currRest, prevRest);\n return fullRepSepRest;\n}\nvar first$1 = {};\nvar __importDefault$6 = commonjsGlobal && commonjsGlobal.__importDefault || function(mod2) {\n return mod2 && mod2.__esModule ? mod2 : { \"default\": mod2 };\n};\nObject.defineProperty(first$1, \"__esModule\", { value: true });\nfirst$1.firstForTerminal = first$1.firstForBranching = first$1.firstForSequence = first$1.first = void 0;\nvar flatten_1$2 = __importDefault$6(lodash_flatten__WEBPACK_IMPORTED_MODULE_16__);\nvar uniq_1$1 = __importDefault$6(lodash_uniq__WEBPACK_IMPORTED_MODULE_17__);\nvar map_1$2 = __importDefault$6(lodash_map__WEBPACK_IMPORTED_MODULE_3__);\nvar gast_1$3 = api$1;\nvar gast_2 = api$1;\nfunction first(prod) {\n if (prod instanceof gast_1$3.NonTerminal) {\n return first(prod.referencedRule);\n } else if (prod instanceof gast_1$3.Terminal) {\n return firstForTerminal(prod);\n } else if ((0, gast_2.isSequenceProd)(prod)) {\n return firstForSequence(prod);\n } else if ((0, gast_2.isBranchingProd)(prod)) {\n return firstForBranching(prod);\n } else {\n throw Error(\"non exhaustive match\");\n }\n}\nfirst$1.first = first;\nfunction firstForSequence(prod) {\n var firstSet = [];\n var seq = prod.definition;\n var nextSubProdIdx = 0;\n var hasInnerProdsRemaining = seq.length > nextSubProdIdx;\n var currSubProd;\n var isLastInnerProdOptional = true;\n while (hasInnerProdsRemaining && isLastInnerProdOptional) {\n currSubProd = seq[nextSubProdIdx];\n isLastInnerProdOptional = (0, gast_2.isOptionalProd)(currSubProd);\n firstSet = firstSet.concat(first(currSubProd));\n nextSubProdIdx = nextSubProdIdx + 1;\n hasInnerProdsRemaining = seq.length > nextSubProdIdx;\n }\n return (0, uniq_1$1.default)(firstSet);\n}\nfirst$1.firstForSequence = firstForSequence;\nfunction firstForBranching(prod) {\n var allAlternativesFirsts = (0, map_1$2.default)(prod.definition, function(innerProd) {\n return first(innerProd);\n });\n return (0, uniq_1$1.default)((0, flatten_1$2.default)(allAlternativesFirsts));\n}\nfirst$1.firstForBranching = firstForBranching;\nfunction firstForTerminal(terminal) {\n return [terminal.terminalType];\n}\nfirst$1.firstForTerminal = firstForTerminal;\nvar constants = {};\nObject.defineProperty(constants, \"__esModule\", { value: true });\nconstants.IN = void 0;\nconstants.IN = \"_~IN~_\";\nvar __extends$3 = commonjsGlobal && commonjsGlobal.__extends || function() {\n var extendStatics = function(d, b2) {\n extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b3) {\n d2.__proto__ = b3;\n } || function(d2, b3) {\n for (var p in b3)\n if (Object.prototype.hasOwnProperty.call(b3, p))\n d2[p] = b3[p];\n };\n return extendStatics(d, b2);\n };\n return function(d, b2) {\n if (typeof b2 !== \"function\" && b2 !== null)\n throw new TypeError(\"Class extends value \" + String(b2) + \" is not a constructor or null\");\n extendStatics(d, b2);\n function __() {\n this.constructor = d;\n }\n d.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());\n };\n}();\nvar __importDefault$5 = commonjsGlobal && commonjsGlobal.__importDefault || function(mod2) {\n return mod2 && mod2.__esModule ? mod2 : { \"default\": mod2 };\n};\nObject.defineProperty(follow, \"__esModule\", { value: true });\nfollow.buildInProdFollowPrefix = follow.buildBetweenProdsFollowPrefix = follow.computeAllProdsFollows = follow.ResyncFollowsWalker = void 0;\nvar rest_1$1 = rest;\nvar first_1$2 = first$1;\nvar forEach_1$1 = __importDefault$5(lodash_forEach__WEBPACK_IMPORTED_MODULE_4__);\nvar assign_1$1 = __importDefault$5(lodash_assign__WEBPACK_IMPORTED_MODULE_12__);\nvar constants_1 = constants;\nvar gast_1$2 = api$1;\nvar ResyncFollowsWalker = (\n /** @class */\n function(_super) {\n __extends$3(ResyncFollowsWalker2, _super);\n function ResyncFollowsWalker2(topProd) {\n var _this = _super.call(this) || this;\n _this.topProd = topProd;\n _this.follows = {};\n return _this;\n }\n ResyncFollowsWalker2.prototype.startWalking = function() {\n this.walk(this.topProd);\n return this.follows;\n };\n ResyncFollowsWalker2.prototype.walkTerminal = function(terminal, currRest, prevRest) {\n };\n ResyncFollowsWalker2.prototype.walkProdRef = function(refProd, currRest, prevRest) {\n var followName = buildBetweenProdsFollowPrefix(refProd.referencedRule, refProd.idx) + this.topProd.name;\n var fullRest = currRest.concat(prevRest);\n var restProd = new gast_1$2.Alternative({ definition: fullRest });\n var t_in_topProd_follows = (0, first_1$2.first)(restProd);\n this.follows[followName] = t_in_topProd_follows;\n };\n return ResyncFollowsWalker2;\n }(rest_1$1.RestWalker)\n);\nfollow.ResyncFollowsWalker = ResyncFollowsWalker;\nfunction computeAllProdsFollows(topProductions) {\n var reSyncFollows = {};\n (0, forEach_1$1.default)(topProductions, function(topProd) {\n var currRefsFollow = new ResyncFollowsWalker(topProd).startWalking();\n (0, assign_1$1.default)(reSyncFollows, currRefsFollow);\n });\n return reSyncFollows;\n}\nfollow.computeAllProdsFollows = computeAllProdsFollows;\nfunction buildBetweenProdsFollowPrefix(inner, occurenceInParent) {\n return inner.name + occurenceInParent + constants_1.IN;\n}\nfollow.buildBetweenProdsFollowPrefix = buildBetweenProdsFollowPrefix;\nfunction buildInProdFollowPrefix(terminal) {\n var terminalName = terminal.terminalType.name;\n return terminalName + terminal.idx + constants_1.IN;\n}\nfollow.buildInProdFollowPrefix = buildInProdFollowPrefix;\nvar tokens_public = {};\nvar lexer_public = {};\nvar lexer = {};\nvar reg_exp = {};\nvar reg_exp_parser = {};\nObject.defineProperty(reg_exp_parser, \"__esModule\", { value: true });\nreg_exp_parser.clearRegExpParserCache = reg_exp_parser.getRegExpAst = void 0;\nvar regexp_to_ast_1 = regexp_to_ast__WEBPACK_IMPORTED_MODULE_19__;\nvar regExpAstCache = {};\nvar regExpParser = new regexp_to_ast_1.RegExpParser();\nfunction getRegExpAst(regExp) {\n var regExpStr = regExp.toString();\n if (regExpAstCache.hasOwnProperty(regExpStr)) {\n return regExpAstCache[regExpStr];\n } else {\n var regExpAst = regExpParser.pattern(regExpStr);\n regExpAstCache[regExpStr] = regExpAst;\n return regExpAst;\n }\n}\nreg_exp_parser.getRegExpAst = getRegExpAst;\nfunction clearRegExpParserCache() {\n regExpAstCache = {};\n}\nreg_exp_parser.clearRegExpParserCache = clearRegExpParserCache;\nvar hasRequiredReg_exp;\nfunction requireReg_exp() {\n if (hasRequiredReg_exp)\n return reg_exp;\n hasRequiredReg_exp = 1;\n (function(exports) {\n var __extends2 = commonjsGlobal && commonjsGlobal.__extends || function() {\n var extendStatics = function(d, b2) {\n extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b3) {\n d2.__proto__ = b3;\n } || function(d2, b3) {\n for (var p in b3)\n if (Object.prototype.hasOwnProperty.call(b3, p))\n d2[p] = b3[p];\n };\n return extendStatics(d, b2);\n };\n return function(d, b2) {\n if (typeof b2 !== \"function\" && b2 !== null)\n throw new TypeError(\"Class extends value \" + String(b2) + \" is not a constructor or null\");\n extendStatics(d, b2);\n function __() {\n this.constructor = d;\n }\n d.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());\n };\n }();\n var __importDefault2 = commonjsGlobal && commonjsGlobal.__importDefault || function(mod2) {\n return mod2 && mod2.__esModule ? mod2 : { \"default\": mod2 };\n };\n Object.defineProperty(exports, \"__esModule\", { value: true });\n exports.canMatchCharCode = exports.firstCharOptimizedIndices = exports.getOptimizedStartCodesIndices = exports.failedOptimizationPrefixMsg = void 0;\n var regexp_to_ast_12 = regexp_to_ast__WEBPACK_IMPORTED_MODULE_19__;\n var isArray_12 = __importDefault2(lodash_isArray__WEBPACK_IMPORTED_MODULE_22__);\n var every_12 = __importDefault2(lodash_every__WEBPACK_IMPORTED_MODULE_14__);\n var forEach_12 = __importDefault2(lodash_forEach__WEBPACK_IMPORTED_MODULE_4__);\n var find_1 = __importDefault2(lodash_find__WEBPACK_IMPORTED_MODULE_27__);\n var values_12 = __importDefault2(lodash_values__WEBPACK_IMPORTED_MODULE_5__);\n var includes_12 = __importDefault2(lodash_includes__WEBPACK_IMPORTED_MODULE_15__);\n var utils_1 = api$2;\n var reg_exp_parser_1 = reg_exp_parser;\n var lexer_1 = requireLexer();\n var complementErrorMessage = \"Complement Sets are not supported for first char optimization\";\n exports.failedOptimizationPrefixMsg = 'Unable to use \"first char\" lexer optimizations:\\n';\n function getOptimizedStartCodesIndices(regExp, ensureOptimizations) {\n if (ensureOptimizations === void 0) {\n ensureOptimizations = false;\n }\n try {\n var ast = (0, reg_exp_parser_1.getRegExpAst)(regExp);\n var firstChars = firstCharOptimizedIndices(ast.value, {}, ast.flags.ignoreCase);\n return firstChars;\n } catch (e) {\n if (e.message === complementErrorMessage) {\n if (ensureOptimizations) {\n (0, utils_1.PRINT_WARNING)(\"\".concat(exports.failedOptimizationPrefixMsg) + \"\tUnable to optimize: < \".concat(regExp.toString(), \" >\\n\") + \"\tComplement Sets cannot be automatically optimized.\\n\tThis will disable the lexer's first char optimizations.\\n\tSee: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.\");\n }\n } else {\n var msgSuffix = \"\";\n if (ensureOptimizations) {\n msgSuffix = \"\\n\tThis will disable the lexer's first char optimizations.\\n\tSee: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.\";\n }\n (0, utils_1.PRINT_ERROR)(\"\".concat(exports.failedOptimizationPrefixMsg, \"\\n\") + \"\tFailed parsing: < \".concat(regExp.toString(), \" >\\n\") + \"\tUsing the regexp-to-ast library version: \".concat(regexp_to_ast_12.VERSION, \"\\n\") + \"\tPlease open an issue at: https://github.com/bd82/regexp-to-ast/issues\" + msgSuffix);\n }\n }\n return [];\n }\n exports.getOptimizedStartCodesIndices = getOptimizedStartCodesIndices;\n function firstCharOptimizedIndices(ast, result, ignoreCase) {\n switch (ast.type) {\n case \"Disjunction\":\n for (var i2 = 0; i2 < ast.value.length; i2++) {\n firstCharOptimizedIndices(ast.value[i2], result, ignoreCase);\n }\n break;\n case \"Alternative\":\n var terms = ast.value;\n for (var i2 = 0; i2 < terms.length; i2++) {\n var term = terms[i2];\n switch (term.type) {\n case \"EndAnchor\":\n case \"GroupBackReference\":\n case \"Lookahead\":\n case \"NegativeLookahead\":\n case \"StartAnchor\":\n case \"WordBoundary\":\n case \"NonWordBoundary\":\n continue;\n }\n var atom = term;\n switch (atom.type) {\n case \"Character\":\n addOptimizedIdxToResult(atom.value, result, ignoreCase);\n break;\n case \"Set\":\n if (atom.complement === true) {\n throw Error(complementErrorMessage);\n }\n (0, forEach_12.default)(atom.value, function(code) {\n if (typeof code === \"number\") {\n addOptimizedIdxToResult(code, result, ignoreCase);\n } else {\n var range = code;\n if (ignoreCase === true) {\n for (var rangeCode = range.from; rangeCode <= range.to; rangeCode++) {\n addOptimizedIdxToResult(rangeCode, result, ignoreCase);\n }\n } else {\n for (var rangeCode = range.from; rangeCode <= range.to && rangeCode < lexer_1.minOptimizationVal; rangeCode++) {\n addOptimizedIdxToResult(rangeCode, result, ignoreCase);\n }\n if (range.to >= lexer_1.minOptimizationVal) {\n var minUnOptVal = range.from >= lexer_1.minOptimizationVal ? range.from : lexer_1.minOptimizationVal;\n var maxUnOptVal = range.to;\n var minOptIdx = (0, lexer_1.charCodeToOptimizedIndex)(minUnOptVal);\n var maxOptIdx = (0, lexer_1.charCodeToOptimizedIndex)(maxUnOptVal);\n for (var currOptIdx = minOptIdx; currOptIdx <= maxOptIdx; currOptIdx++) {\n result[currOptIdx] = currOptIdx;\n }\n }\n }\n }\n });\n break;\n case \"Group\":\n firstCharOptimizedIndices(atom.value, result, ignoreCase);\n break;\n default:\n throw Error(\"Non Exhaustive Match\");\n }\n var isOptionalQuantifier = atom.quantifier !== void 0 && atom.quantifier.atLeast === 0;\n if (\n // A group may be optional due to empty contents /(?:)/\n // or if everything inside it is optional /((a)?)/\n atom.type === \"Group\" && isWholeOptional(atom) === false || // If this term is not a group it may only be optional if it has an optional quantifier\n atom.type !== \"Group\" && isOptionalQuantifier === false\n ) {\n break;\n }\n }\n break;\n default:\n throw Error(\"non exhaustive match!\");\n }\n return (0, values_12.default)(result);\n }\n exports.firstCharOptimizedIndices = firstCharOptimizedIndices;\n function addOptimizedIdxToResult(code, result, ignoreCase) {\n var optimizedCharIdx = (0, lexer_1.charCodeToOptimizedIndex)(code);\n result[optimizedCharIdx] = optimizedCharIdx;\n if (ignoreCase === true) {\n handleIgnoreCase(code, result);\n }\n }\n function handleIgnoreCase(code, result) {\n var char = String.fromCharCode(code);\n var upperChar = char.toUpperCase();\n if (upperChar !== char) {\n var optimizedCharIdx = (0, lexer_1.charCodeToOptimizedIndex)(upperChar.charCodeAt(0));\n result[optimizedCharIdx] = optimizedCharIdx;\n } else {\n var lowerChar = char.toLowerCase();\n if (lowerChar !== char) {\n var optimizedCharIdx = (0, lexer_1.charCodeToOptimizedIndex)(lowerChar.charCodeAt(0));\n result[optimizedCharIdx] = optimizedCharIdx;\n }\n }\n }\n function findCode(setNode, targetCharCodes) {\n return (0, find_1.default)(setNode.value, function(codeOrRange) {\n if (typeof codeOrRange === \"number\") {\n return (0, includes_12.default)(targetCharCodes, codeOrRange);\n } else {\n var range_1 = codeOrRange;\n return (0, find_1.default)(targetCharCodes, function(targetCode) {\n return range_1.from <= targetCode && targetCode <= range_1.to;\n }) !== void 0;\n }\n });\n }\n function isWholeOptional(ast) {\n var quantifier = ast.quantifier;\n if (quantifier && quantifier.atLeast === 0) {\n return true;\n }\n if (!ast.value) {\n return false;\n }\n return (0, isArray_12.default)(ast.value) ? (0, every_12.default)(ast.value, isWholeOptional) : isWholeOptional(ast.value);\n }\n var CharCodeFinder = (\n /** @class */\n function(_super) {\n __extends2(CharCodeFinder2, _super);\n function CharCodeFinder2(targetCharCodes) {\n var _this = _super.call(this) || this;\n _this.targetCharCodes = targetCharCodes;\n _this.found = false;\n return _this;\n }\n CharCodeFinder2.prototype.visitChildren = function(node) {\n if (this.found === true) {\n return;\n }\n switch (node.type) {\n case \"Lookahead\":\n this.visitLookahead(node);\n return;\n case \"NegativeLookahead\":\n this.visitNegativeLookahead(node);\n return;\n }\n _super.prototype.visitChildren.call(this, node);\n };\n CharCodeFinder2.prototype.visitCharacter = function(node) {\n if ((0, includes_12.default)(this.targetCharCodes, node.value)) {\n this.found = true;\n }\n };\n CharCodeFinder2.prototype.visitSet = function(node) {\n if (node.complement) {\n if (findCode(node, this.targetCharCodes) === void 0) {\n this.found = true;\n }\n } else {\n if (findCode(node, this.targetCharCodes) !== void 0) {\n this.found = true;\n }\n }\n };\n return CharCodeFinder2;\n }(regexp_to_ast_12.BaseRegExpVisitor)\n );\n function canMatchCharCode(charCodes, pattern) {\n if (pattern instanceof RegExp) {\n var ast = (0, reg_exp_parser_1.getRegExpAst)(pattern);\n var charCodeFinder = new CharCodeFinder(charCodes);\n charCodeFinder.visit(ast);\n return charCodeFinder.found;\n } else {\n return (0, find_1.default)(pattern, function(char) {\n return (0, includes_12.default)(charCodes, char.charCodeAt(0));\n }) !== void 0;\n }\n }\n exports.canMatchCharCode = canMatchCharCode;\n })(reg_exp);\n return reg_exp;\n}\nvar hasRequiredLexer;\nfunction requireLexer() {\n if (hasRequiredLexer)\n return lexer;\n hasRequiredLexer = 1;\n (function(exports) {\n var __extends2 = commonjsGlobal && commonjsGlobal.__extends || function() {\n var extendStatics = function(d, b2) {\n extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b3) {\n d2.__proto__ = b3;\n } || function(d2, b3) {\n for (var p in b3)\n if (Object.prototype.hasOwnProperty.call(b3, p))\n d2[p] = b3[p];\n };\n return extendStatics(d, b2);\n };\n return function(d, b2) {\n if (typeof b2 !== \"function\" && b2 !== null)\n throw new TypeError(\"Class extends value \" + String(b2) + \" is not a constructor or null\");\n extendStatics(d, b2);\n function __() {\n this.constructor = d;\n }\n d.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());\n };\n }();\n var __importDefault2 = commonjsGlobal && commonjsGlobal.__importDefault || function(mod2) {\n return mod2 && mod2.__esModule ? mod2 : { \"default\": mod2 };\n };\n Object.defineProperty(exports, \"__esModule\", { value: true });\n exports.charCodeToOptimizedIndex = exports.minOptimizationVal = exports.buildLineBreakIssueMessage = exports.LineTerminatorOptimizedTester = exports.isShortPattern = exports.isCustomPattern = exports.cloneEmptyGroups = exports.performWarningRuntimeChecks = exports.performRuntimeChecks = exports.addStickyFlag = exports.addStartOfInput = exports.findUnreachablePatterns = exports.findModesThatDoNotExist = exports.findInvalidGroupType = exports.findDuplicatePatterns = exports.findUnsupportedFlags = exports.findStartOfInputAnchor = exports.findEmptyMatchRegExps = exports.findEndOfInputAnchor = exports.findInvalidPatterns = exports.findMissingPatterns = exports.validatePatterns = exports.analyzeTokenTypes = exports.enableSticky = exports.disableSticky = exports.SUPPORT_STICKY = exports.MODES = exports.DEFAULT_MODE = void 0;\n var regexp_to_ast_12 = regexp_to_ast__WEBPACK_IMPORTED_MODULE_19__;\n var lexer_public_1 = requireLexer_public();\n var first_12 = __importDefault2(lodash_first__WEBPACK_IMPORTED_MODULE_20__);\n var isEmpty_12 = __importDefault2(lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2__);\n var compact_1 = __importDefault2(lodash_compact__WEBPACK_IMPORTED_MODULE_21__);\n var isArray_12 = __importDefault2(lodash_isArray__WEBPACK_IMPORTED_MODULE_22__);\n var values_12 = __importDefault2(lodash_values__WEBPACK_IMPORTED_MODULE_5__);\n var flatten_12 = __importDefault2(lodash_flatten__WEBPACK_IMPORTED_MODULE_16__);\n var reject_1 = __importDefault2(lodash_reject__WEBPACK_IMPORTED_MODULE_23__);\n var difference_1 = __importDefault2(lodash_difference__WEBPACK_IMPORTED_MODULE_24__);\n var indexOf_1 = __importDefault2(lodash_indexOf__WEBPACK_IMPORTED_MODULE_25__);\n var map_12 = __importDefault2(lodash_map__WEBPACK_IMPORTED_MODULE_3__);\n var forEach_12 = __importDefault2(lodash_forEach__WEBPACK_IMPORTED_MODULE_4__);\n var isString_12 = __importDefault2(lodash_isString__WEBPACK_IMPORTED_MODULE_9__);\n var isFunction_1 = __importDefault2(lodash_isFunction__WEBPACK_IMPORTED_MODULE_26__);\n var isUndefined_12 = __importDefault2(lodash_isUndefined__WEBPACK_IMPORTED_MODULE_18__);\n var find_1 = __importDefault2(lodash_find__WEBPACK_IMPORTED_MODULE_27__);\n var has_1 = __importDefault2(lodash_has__WEBPACK_IMPORTED_MODULE_6__);\n var keys_1 = __importDefault2(lodash_keys__WEBPACK_IMPORTED_MODULE_28__);\n var isRegExp_12 = __importDefault2(lodash_isRegExp__WEBPACK_IMPORTED_MODULE_10__);\n var filter_1 = __importDefault2(lodash_filter__WEBPACK_IMPORTED_MODULE_29__);\n var defaults_1 = __importDefault2(lodash_defaults__WEBPACK_IMPORTED_MODULE_30__);\n var reduce_12 = __importDefault2(lodash_reduce__WEBPACK_IMPORTED_MODULE_31__);\n var includes_12 = __importDefault2(lodash_includes__WEBPACK_IMPORTED_MODULE_15__);\n var utils_1 = api$2;\n var reg_exp_1 = requireReg_exp();\n var reg_exp_parser_1 = reg_exp_parser;\n var PATTERN = \"PATTERN\";\n exports.DEFAULT_MODE = \"defaultMode\";\n exports.MODES = \"modes\";\n exports.SUPPORT_STICKY = typeof new RegExp(\"(?:)\").sticky === \"boolean\";\n function disableSticky() {\n exports.SUPPORT_STICKY = false;\n }\n exports.disableSticky = disableSticky;\n function enableSticky() {\n exports.SUPPORT_STICKY = true;\n }\n exports.enableSticky = enableSticky;\n function analyzeTokenTypes(tokenTypes, options) {\n options = (0, defaults_1.default)(options, {\n useSticky: exports.SUPPORT_STICKY,\n debug: false,\n safeMode: false,\n positionTracking: \"full\",\n lineTerminatorCharacters: [\"\\r\", \"\\n\"],\n tracer: function(msg, action) {\n return action();\n }\n });\n var tracer = options.tracer;\n tracer(\"initCharCodeToOptimizedIndexMap\", function() {\n initCharCodeToOptimizedIndexMap();\n });\n var onlyRelevantTypes;\n tracer(\"Reject Lexer.NA\", function() {\n onlyRelevantTypes = (0, reject_1.default)(tokenTypes, function(currType) {\n return currType[PATTERN] === lexer_public_1.Lexer.NA;\n });\n });\n var hasCustom = false;\n var allTransformedPatterns;\n tracer(\"Transform Patterns\", function() {\n hasCustom = false;\n allTransformedPatterns = (0, map_12.default)(onlyRelevantTypes, function(currType) {\n var currPattern = currType[PATTERN];\n if ((0, isRegExp_12.default)(currPattern)) {\n var regExpSource = currPattern.source;\n if (regExpSource.length === 1 && // only these regExp meta characters which can appear in a length one regExp\n regExpSource !== \"^\" && regExpSource !== \"$\" && regExpSource !== \".\" && !currPattern.ignoreCase) {\n return regExpSource;\n } else if (regExpSource.length === 2 && regExpSource[0] === \"\\\\\" && // not a meta character\n !(0, includes_12.default)([\n \"d\",\n \"D\",\n \"s\",\n \"S\",\n \"t\",\n \"r\",\n \"n\",\n \"t\",\n \"0\",\n \"c\",\n \"b\",\n \"B\",\n \"f\",\n \"v\",\n \"w\",\n \"W\"\n ], regExpSource[1])) {\n return regExpSource[1];\n } else {\n return options.useSticky ? addStickyFlag(currPattern) : addStartOfInput(currPattern);\n }\n } else if ((0, isFunction_1.default)(currPattern)) {\n hasCustom = true;\n return { exec: currPattern };\n } else if (typeof currPattern === \"object\") {\n hasCustom = true;\n return currPattern;\n } else if (typeof currPattern === \"string\") {\n if (currPattern.length === 1) {\n return currPattern;\n } else {\n var escapedRegExpString = currPattern.replace(/[\\\\^$.*+?()[\\]{}|]/g, \"\\\\$&\");\n var wrappedRegExp = new RegExp(escapedRegExpString);\n return options.useSticky ? addStickyFlag(wrappedRegExp) : addStartOfInput(wrappedRegExp);\n }\n } else {\n throw Error(\"non exhaustive match\");\n }\n });\n });\n var patternIdxToType;\n var patternIdxToGroup;\n var patternIdxToLongerAltIdxArr;\n var patternIdxToPushMode;\n var patternIdxToPopMode;\n tracer(\"misc mapping\", function() {\n patternIdxToType = (0, map_12.default)(onlyRelevantTypes, function(currType) {\n return currType.tokenTypeIdx;\n });\n patternIdxToGroup = (0, map_12.default)(onlyRelevantTypes, function(clazz) {\n var groupName = clazz.GROUP;\n if (groupName === lexer_public_1.Lexer.SKIPPED) {\n return void 0;\n } else if ((0, isString_12.default)(groupName)) {\n return groupName;\n } else if ((0, isUndefined_12.default)(groupName)) {\n return false;\n } else {\n throw Error(\"non exhaustive match\");\n }\n });\n patternIdxToLongerAltIdxArr = (0, map_12.default)(onlyRelevantTypes, function(clazz) {\n var longerAltType = clazz.LONGER_ALT;\n if (longerAltType) {\n var longerAltIdxArr = (0, isArray_12.default)(longerAltType) ? (0, map_12.default)(longerAltType, function(type) {\n return (0, indexOf_1.default)(onlyRelevantTypes, type);\n }) : [(0, indexOf_1.default)(onlyRelevantTypes, longerAltType)];\n return longerAltIdxArr;\n }\n });\n patternIdxToPushMode = (0, map_12.default)(onlyRelevantTypes, function(clazz) {\n return clazz.PUSH_MODE;\n });\n patternIdxToPopMode = (0, map_12.default)(onlyRelevantTypes, function(clazz) {\n return (0, has_1.default)(clazz, \"POP_MODE\");\n });\n });\n var patternIdxToCanLineTerminator;\n tracer(\"Line Terminator Handling\", function() {\n var lineTerminatorCharCodes = getCharCodes(options.lineTerminatorCharacters);\n patternIdxToCanLineTerminator = (0, map_12.default)(onlyRelevantTypes, function(tokType) {\n return false;\n });\n if (options.positionTracking !== \"onlyOffset\") {\n patternIdxToCanLineTerminator = (0, map_12.default)(onlyRelevantTypes, function(tokType) {\n if ((0, has_1.default)(tokType, \"LINE_BREAKS\")) {\n return !!tokType.LINE_BREAKS;\n } else {\n return checkLineBreaksIssues(tokType, lineTerminatorCharCodes) === false && (0, reg_exp_1.canMatchCharCode)(lineTerminatorCharCodes, tokType.PATTERN);\n }\n });\n }\n });\n var patternIdxToIsCustom;\n var patternIdxToShort;\n var emptyGroups;\n var patternIdxToConfig;\n tracer(\"Misc Mapping #2\", function() {\n patternIdxToIsCustom = (0, map_12.default)(onlyRelevantTypes, isCustomPattern);\n patternIdxToShort = (0, map_12.default)(allTransformedPatterns, isShortPattern);\n emptyGroups = (0, reduce_12.default)(onlyRelevantTypes, function(acc, clazz) {\n var groupName = clazz.GROUP;\n if ((0, isString_12.default)(groupName) && !(groupName === lexer_public_1.Lexer.SKIPPED)) {\n acc[groupName] = [];\n }\n return acc;\n }, {});\n patternIdxToConfig = (0, map_12.default)(allTransformedPatterns, function(x, idx) {\n return {\n pattern: allTransformedPatterns[idx],\n longerAlt: patternIdxToLongerAltIdxArr[idx],\n canLineTerminator: patternIdxToCanLineTerminator[idx],\n isCustom: patternIdxToIsCustom[idx],\n short: patternIdxToShort[idx],\n group: patternIdxToGroup[idx],\n push: patternIdxToPushMode[idx],\n pop: patternIdxToPopMode[idx],\n tokenTypeIdx: patternIdxToType[idx],\n tokenType: onlyRelevantTypes[idx]\n };\n });\n });\n var canBeOptimized = true;\n var charCodeToPatternIdxToConfig = [];\n if (!options.safeMode) {\n tracer(\"First Char Optimization\", function() {\n charCodeToPatternIdxToConfig = (0, reduce_12.default)(onlyRelevantTypes, function(result, currTokType, idx) {\n if (typeof currTokType.PATTERN === \"string\") {\n var charCode = currTokType.PATTERN.charCodeAt(0);\n var optimizedIdx = charCodeToOptimizedIndex(charCode);\n addToMapOfArrays(result, optimizedIdx, patternIdxToConfig[idx]);\n } else if ((0, isArray_12.default)(currTokType.START_CHARS_HINT)) {\n var lastOptimizedIdx_1;\n (0, forEach_12.default)(currTokType.START_CHARS_HINT, function(charOrInt) {\n var charCode2 = typeof charOrInt === \"string\" ? charOrInt.charCodeAt(0) : charOrInt;\n var currOptimizedIdx = charCodeToOptimizedIndex(charCode2);\n if (lastOptimizedIdx_1 !== currOptimizedIdx) {\n lastOptimizedIdx_1 = currOptimizedIdx;\n addToMapOfArrays(result, currOptimizedIdx, patternIdxToConfig[idx]);\n }\n });\n } else if ((0, isRegExp_12.default)(currTokType.PATTERN)) {\n if (currTokType.PATTERN.unicode) {\n canBeOptimized = false;\n if (options.ensureOptimizations) {\n (0, utils_1.PRINT_ERROR)(\"\".concat(reg_exp_1.failedOptimizationPrefixMsg) + \"\tUnable to analyze < \".concat(currTokType.PATTERN.toString(), \" > pattern.\\n\") + \"\tThe regexp unicode flag is not currently supported by the regexp-to-ast library.\\n\tThis will disable the lexer's first char optimizations.\\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE\");\n }\n } else {\n var optimizedCodes = (0, reg_exp_1.getOptimizedStartCodesIndices)(currTokType.PATTERN, options.ensureOptimizations);\n if ((0, isEmpty_12.default)(optimizedCodes)) {\n canBeOptimized = false;\n }\n (0, forEach_12.default)(optimizedCodes, function(code) {\n addToMapOfArrays(result, code, patternIdxToConfig[idx]);\n });\n }\n } else {\n if (options.ensureOptimizations) {\n (0, utils_1.PRINT_ERROR)(\"\".concat(reg_exp_1.failedOptimizationPrefixMsg) + \"\tTokenType: <\".concat(currTokType.name, \"> is using a custom token pattern without providing parameter.\\n\") + \"\tThis will disable the lexer's first char optimizations.\\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE\");\n }\n canBeOptimized = false;\n }\n return result;\n }, []);\n });\n }\n return {\n emptyGroups,\n patternIdxToConfig,\n charCodeToPatternIdxToConfig,\n hasCustom,\n canBeOptimized\n };\n }\n exports.analyzeTokenTypes = analyzeTokenTypes;\n function validatePatterns(tokenTypes, validModesNames) {\n var errors = [];\n var missingResult = findMissingPatterns(tokenTypes);\n errors = errors.concat(missingResult.errors);\n var invalidResult = findInvalidPatterns(missingResult.valid);\n var validTokenTypes = invalidResult.valid;\n errors = errors.concat(invalidResult.errors);\n errors = errors.concat(validateRegExpPattern(validTokenTypes));\n errors = errors.concat(findInvalidGroupType(validTokenTypes));\n errors = errors.concat(findModesThatDoNotExist(validTokenTypes, validModesNames));\n errors = errors.concat(findUnreachablePatterns(validTokenTypes));\n return errors;\n }\n exports.validatePatterns = validatePatterns;\n function validateRegExpPattern(tokenTypes) {\n var errors = [];\n var withRegExpPatterns = (0, filter_1.default)(tokenTypes, function(currTokType) {\n return (0, isRegExp_12.default)(currTokType[PATTERN]);\n });\n errors = errors.concat(findEndOfInputAnchor(withRegExpPatterns));\n errors = errors.concat(findStartOfInputAnchor(withRegExpPatterns));\n errors = errors.concat(findUnsupportedFlags(withRegExpPatterns));\n errors = errors.concat(findDuplicatePatterns(withRegExpPatterns));\n errors = errors.concat(findEmptyMatchRegExps(withRegExpPatterns));\n return errors;\n }\n function findMissingPatterns(tokenTypes) {\n var tokenTypesWithMissingPattern = (0, filter_1.default)(tokenTypes, function(currType) {\n return !(0, has_1.default)(currType, PATTERN);\n });\n var errors = (0, map_12.default)(tokenTypesWithMissingPattern, function(currType) {\n return {\n message: \"Token Type: ->\" + currType.name + \"<- missing static 'PATTERN' property\",\n type: lexer_public_1.LexerDefinitionErrorType.MISSING_PATTERN,\n tokenTypes: [currType]\n };\n });\n var valid = (0, difference_1.default)(tokenTypes, tokenTypesWithMissingPattern);\n return { errors, valid };\n }\n exports.findMissingPatterns = findMissingPatterns;\n function findInvalidPatterns(tokenTypes) {\n var tokenTypesWithInvalidPattern = (0, filter_1.default)(tokenTypes, function(currType) {\n var pattern = currType[PATTERN];\n return !(0, isRegExp_12.default)(pattern) && !(0, isFunction_1.default)(pattern) && !(0, has_1.default)(pattern, \"exec\") && !(0, isString_12.default)(pattern);\n });\n var errors = (0, map_12.default)(tokenTypesWithInvalidPattern, function(currType) {\n return {\n message: \"Token Type: ->\" + currType.name + \"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.\",\n type: lexer_public_1.LexerDefinitionErrorType.INVALID_PATTERN,\n tokenTypes: [currType]\n };\n });\n var valid = (0, difference_1.default)(tokenTypes, tokenTypesWithInvalidPattern);\n return { errors, valid };\n }\n exports.findInvalidPatterns = findInvalidPatterns;\n var end_of_input = /[^\\\\][$]/;\n function findEndOfInputAnchor(tokenTypes) {\n var EndAnchorFinder = (\n /** @class */\n function(_super) {\n __extends2(EndAnchorFinder2, _super);\n function EndAnchorFinder2() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.found = false;\n return _this;\n }\n EndAnchorFinder2.prototype.visitEndAnchor = function(node) {\n this.found = true;\n };\n return EndAnchorFinder2;\n }(regexp_to_ast_12.BaseRegExpVisitor)\n );\n var invalidRegex = (0, filter_1.default)(tokenTypes, function(currType) {\n var pattern = currType.PATTERN;\n try {\n var regexpAst = (0, reg_exp_parser_1.getRegExpAst)(pattern);\n var endAnchorVisitor = new EndAnchorFinder();\n endAnchorVisitor.visit(regexpAst);\n return endAnchorVisitor.found;\n } catch (e) {\n return end_of_input.test(pattern.source);\n }\n });\n var errors = (0, map_12.default)(invalidRegex, function(currType) {\n return {\n message: \"Unexpected RegExp Anchor Error:\\n\tToken Type: ->\" + currType.name + \"<- static 'PATTERN' cannot contain end of input anchor '$'\\n\tSee chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS\tfor details.\",\n type: lexer_public_1.LexerDefinitionErrorType.EOI_ANCHOR_FOUND,\n tokenTypes: [currType]\n };\n });\n return errors;\n }\n exports.findEndOfInputAnchor = findEndOfInputAnchor;\n function findEmptyMatchRegExps(tokenTypes) {\n var matchesEmptyString = (0, filter_1.default)(tokenTypes, function(currType) {\n var pattern = currType.PATTERN;\n return pattern.test(\"\");\n });\n var errors = (0, map_12.default)(matchesEmptyString, function(currType) {\n return {\n message: \"Token Type: ->\" + currType.name + \"<- static 'PATTERN' must not match an empty string\",\n type: lexer_public_1.LexerDefinitionErrorType.EMPTY_MATCH_PATTERN,\n tokenTypes: [currType]\n };\n });\n return errors;\n }\n exports.findEmptyMatchRegExps = findEmptyMatchRegExps;\n var start_of_input = /[^\\\\[][\\^]|^\\^/;\n function findStartOfInputAnchor(tokenTypes) {\n var StartAnchorFinder = (\n /** @class */\n function(_super) {\n __extends2(StartAnchorFinder2, _super);\n function StartAnchorFinder2() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.found = false;\n return _this;\n }\n StartAnchorFinder2.prototype.visitStartAnchor = function(node) {\n this.found = true;\n };\n return StartAnchorFinder2;\n }(regexp_to_ast_12.BaseRegExpVisitor)\n );\n var invalidRegex = (0, filter_1.default)(tokenTypes, function(currType) {\n var pattern = currType.PATTERN;\n try {\n var regexpAst = (0, reg_exp_parser_1.getRegExpAst)(pattern);\n var startAnchorVisitor = new StartAnchorFinder();\n startAnchorVisitor.visit(regexpAst);\n return startAnchorVisitor.found;\n } catch (e) {\n return start_of_input.test(pattern.source);\n }\n });\n var errors = (0, map_12.default)(invalidRegex, function(currType) {\n return {\n message: \"Unexpected RegExp Anchor Error:\\n\tToken Type: ->\" + currType.name + \"<- static 'PATTERN' cannot contain start of input anchor '^'\\n\tSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS\tfor details.\",\n type: lexer_public_1.LexerDefinitionErrorType.SOI_ANCHOR_FOUND,\n tokenTypes: [currType]\n };\n });\n return errors;\n }\n exports.findStartOfInputAnchor = findStartOfInputAnchor;\n function findUnsupportedFlags(tokenTypes) {\n var invalidFlags = (0, filter_1.default)(tokenTypes, function(currType) {\n var pattern = currType[PATTERN];\n return pattern instanceof RegExp && (pattern.multiline || pattern.global);\n });\n var errors = (0, map_12.default)(invalidFlags, function(currType) {\n return {\n message: \"Token Type: ->\" + currType.name + \"<- static 'PATTERN' may NOT contain global('g') or multiline('m')\",\n type: lexer_public_1.LexerDefinitionErrorType.UNSUPPORTED_FLAGS_FOUND,\n tokenTypes: [currType]\n };\n });\n return errors;\n }\n exports.findUnsupportedFlags = findUnsupportedFlags;\n function findDuplicatePatterns(tokenTypes) {\n var found = [];\n var identicalPatterns = (0, map_12.default)(tokenTypes, function(outerType) {\n return (0, reduce_12.default)(tokenTypes, function(result, innerType) {\n if (outerType.PATTERN.source === innerType.PATTERN.source && !(0, includes_12.default)(found, innerType) && innerType.PATTERN !== lexer_public_1.Lexer.NA) {\n found.push(innerType);\n result.push(innerType);\n return result;\n }\n return result;\n }, []);\n });\n identicalPatterns = (0, compact_1.default)(identicalPatterns);\n var duplicatePatterns = (0, filter_1.default)(identicalPatterns, function(currIdenticalSet) {\n return currIdenticalSet.length > 1;\n });\n var errors = (0, map_12.default)(duplicatePatterns, function(setOfIdentical) {\n var tokenTypeNames = (0, map_12.default)(setOfIdentical, function(currType) {\n return currType.name;\n });\n var dupPatternSrc = (0, first_12.default)(setOfIdentical).PATTERN;\n return {\n message: \"The same RegExp pattern ->\".concat(dupPatternSrc, \"<-\") + \"has been used in all of the following Token Types: \".concat(tokenTypeNames.join(\", \"), \" <-\"),\n type: lexer_public_1.LexerDefinitionErrorType.DUPLICATE_PATTERNS_FOUND,\n tokenTypes: setOfIdentical\n };\n });\n return errors;\n }\n exports.findDuplicatePatterns = findDuplicatePatterns;\n function findInvalidGroupType(tokenTypes) {\n var invalidTypes = (0, filter_1.default)(tokenTypes, function(clazz) {\n if (!(0, has_1.default)(clazz, \"GROUP\")) {\n return false;\n }\n var group = clazz.GROUP;\n return group !== lexer_public_1.Lexer.SKIPPED && group !== lexer_public_1.Lexer.NA && !(0, isString_12.default)(group);\n });\n var errors = (0, map_12.default)(invalidTypes, function(currType) {\n return {\n message: \"Token Type: ->\" + currType.name + \"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String\",\n type: lexer_public_1.LexerDefinitionErrorType.INVALID_GROUP_TYPE_FOUND,\n tokenTypes: [currType]\n };\n });\n return errors;\n }\n exports.findInvalidGroupType = findInvalidGroupType;\n function findModesThatDoNotExist(tokenTypes, validModes) {\n var invalidModes = (0, filter_1.default)(tokenTypes, function(clazz) {\n return clazz.PUSH_MODE !== void 0 && !(0, includes_12.default)(validModes, clazz.PUSH_MODE);\n });\n var errors = (0, map_12.default)(invalidModes, function(tokType) {\n var msg = \"Token Type: ->\".concat(tokType.name, \"<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->\").concat(tokType.PUSH_MODE, \"<-\") + \"which does not exist\";\n return {\n message: msg,\n type: lexer_public_1.LexerDefinitionErrorType.PUSH_MODE_DOES_NOT_EXIST,\n tokenTypes: [tokType]\n };\n });\n return errors;\n }\n exports.findModesThatDoNotExist = findModesThatDoNotExist;\n function findUnreachablePatterns(tokenTypes) {\n var errors = [];\n var canBeTested = (0, reduce_12.default)(tokenTypes, function(result, tokType, idx) {\n var pattern = tokType.PATTERN;\n if (pattern === lexer_public_1.Lexer.NA) {\n return result;\n }\n if ((0, isString_12.default)(pattern)) {\n result.push({ str: pattern, idx, tokenType: tokType });\n } else if ((0, isRegExp_12.default)(pattern) && noMetaChar(pattern)) {\n result.push({ str: pattern.source, idx, tokenType: tokType });\n }\n return result;\n }, []);\n (0, forEach_12.default)(tokenTypes, function(tokType, testIdx) {\n (0, forEach_12.default)(canBeTested, function(_a2) {\n var str = _a2.str, idx = _a2.idx, tokenType = _a2.tokenType;\n if (testIdx < idx && testTokenType(str, tokType.PATTERN)) {\n var msg = \"Token: ->\".concat(tokenType.name, \"<- can never be matched.\\n\") + \"Because it appears AFTER the Token Type ->\".concat(tokType.name, \"<-\") + \"in the lexer's definition.\\nSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE\";\n errors.push({\n message: msg,\n type: lexer_public_1.LexerDefinitionErrorType.UNREACHABLE_PATTERN,\n tokenTypes: [tokType, tokenType]\n });\n }\n });\n });\n return errors;\n }\n exports.findUnreachablePatterns = findUnreachablePatterns;\n function testTokenType(str, pattern) {\n if ((0, isRegExp_12.default)(pattern)) {\n var regExpArray = pattern.exec(str);\n return regExpArray !== null && regExpArray.index === 0;\n } else if ((0, isFunction_1.default)(pattern)) {\n return pattern(str, 0, [], {});\n } else if ((0, has_1.default)(pattern, \"exec\")) {\n return pattern.exec(str, 0, [], {});\n } else if (typeof pattern === \"string\") {\n return pattern === str;\n } else {\n throw Error(\"non exhaustive match\");\n }\n }\n function noMetaChar(regExp) {\n var metaChars = [\n \".\",\n \"\\\\\",\n \"[\",\n \"]\",\n \"|\",\n \"^\",\n \"$\",\n \"(\",\n \")\",\n \"?\",\n \"*\",\n \"+\",\n \"{\"\n ];\n return (0, find_1.default)(metaChars, function(char) {\n return regExp.source.indexOf(char) !== -1;\n }) === void 0;\n }\n function addStartOfInput(pattern) {\n var flags = pattern.ignoreCase ? \"i\" : \"\";\n return new RegExp(\"^(?:\".concat(pattern.source, \")\"), flags);\n }\n exports.addStartOfInput = addStartOfInput;\n function addStickyFlag(pattern) {\n var flags = pattern.ignoreCase ? \"iy\" : \"y\";\n return new RegExp(\"\".concat(pattern.source), flags);\n }\n exports.addStickyFlag = addStickyFlag;\n function performRuntimeChecks(lexerDefinition, trackLines, lineTerminatorCharacters) {\n var errors = [];\n if (!(0, has_1.default)(lexerDefinition, exports.DEFAULT_MODE)) {\n errors.push({\n message: \"A MultiMode Lexer cannot be initialized without a <\" + exports.DEFAULT_MODE + \"> property in its definition\\n\",\n type: lexer_public_1.LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE\n });\n }\n if (!(0, has_1.default)(lexerDefinition, exports.MODES)) {\n errors.push({\n message: \"A MultiMode Lexer cannot be initialized without a <\" + exports.MODES + \"> property in its definition\\n\",\n type: lexer_public_1.LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY\n });\n }\n if ((0, has_1.default)(lexerDefinition, exports.MODES) && (0, has_1.default)(lexerDefinition, exports.DEFAULT_MODE) && !(0, has_1.default)(lexerDefinition.modes, lexerDefinition.defaultMode)) {\n errors.push({\n message: \"A MultiMode Lexer cannot be initialized with a \".concat(exports.DEFAULT_MODE, \": <\").concat(lexerDefinition.defaultMode, \">\") + \"which does not exist\\n\",\n type: lexer_public_1.LexerDefinitionErrorType.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST\n });\n }\n if ((0, has_1.default)(lexerDefinition, exports.MODES)) {\n (0, forEach_12.default)(lexerDefinition.modes, function(currModeValue, currModeName) {\n (0, forEach_12.default)(currModeValue, function(currTokType, currIdx) {\n if ((0, isUndefined_12.default)(currTokType)) {\n errors.push({\n message: \"A Lexer cannot be initialized using an undefined Token Type. Mode:\" + \"<\".concat(currModeName, \"> at index: <\").concat(currIdx, \">\\n\"),\n type: lexer_public_1.LexerDefinitionErrorType.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED\n });\n } else if ((0, has_1.default)(currTokType, \"LONGER_ALT\")) {\n var longerAlt = (0, isArray_12.default)(currTokType.LONGER_ALT) ? currTokType.LONGER_ALT : [currTokType.LONGER_ALT];\n (0, forEach_12.default)(longerAlt, function(currLongerAlt) {\n if (!(0, isUndefined_12.default)(currLongerAlt) && !(0, includes_12.default)(currModeValue, currLongerAlt)) {\n errors.push({\n message: \"A MultiMode Lexer cannot be initialized with a longer_alt <\".concat(currLongerAlt.name, \"> on token <\").concat(currTokType.name, \"> outside of mode <\").concat(currModeName, \">\\n\"),\n type: lexer_public_1.LexerDefinitionErrorType.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE\n });\n }\n });\n }\n });\n });\n }\n return errors;\n }\n exports.performRuntimeChecks = performRuntimeChecks;\n function performWarningRuntimeChecks(lexerDefinition, trackLines, lineTerminatorCharacters) {\n var warnings = [];\n var hasAnyLineBreak = false;\n var allTokenTypes = (0, compact_1.default)((0, flatten_12.default)((0, values_12.default)(lexerDefinition.modes)));\n var concreteTokenTypes = (0, reject_1.default)(allTokenTypes, function(currType) {\n return currType[PATTERN] === lexer_public_1.Lexer.NA;\n });\n var terminatorCharCodes = getCharCodes(lineTerminatorCharacters);\n if (trackLines) {\n (0, forEach_12.default)(concreteTokenTypes, function(tokType) {\n var currIssue = checkLineBreaksIssues(tokType, terminatorCharCodes);\n if (currIssue !== false) {\n var message = buildLineBreakIssueMessage(tokType, currIssue);\n var warningDescriptor = {\n message,\n type: currIssue.issue,\n tokenType: tokType\n };\n warnings.push(warningDescriptor);\n } else {\n if ((0, has_1.default)(tokType, \"LINE_BREAKS\")) {\n if (tokType.LINE_BREAKS === true) {\n hasAnyLineBreak = true;\n }\n } else {\n if ((0, reg_exp_1.canMatchCharCode)(terminatorCharCodes, tokType.PATTERN)) {\n hasAnyLineBreak = true;\n }\n }\n }\n });\n }\n if (trackLines && !hasAnyLineBreak) {\n warnings.push({\n message: \"Warning: No LINE_BREAKS Found.\\n\tThis Lexer has been defined to track line and column information,\\n\tBut none of the Token Types can be identified as matching a line terminator.\\n\tSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS \\n\tfor details.\",\n type: lexer_public_1.LexerDefinitionErrorType.NO_LINE_BREAKS_FLAGS\n });\n }\n return warnings;\n }\n exports.performWarningRuntimeChecks = performWarningRuntimeChecks;\n function cloneEmptyGroups(emptyGroups) {\n var clonedResult = {};\n var groupKeys = (0, keys_1.default)(emptyGroups);\n (0, forEach_12.default)(groupKeys, function(currKey) {\n var currGroupValue = emptyGroups[currKey];\n if ((0, isArray_12.default)(currGroupValue)) {\n clonedResult[currKey] = [];\n } else {\n throw Error(\"non exhaustive match\");\n }\n });\n return clonedResult;\n }\n exports.cloneEmptyGroups = cloneEmptyGroups;\n function isCustomPattern(tokenType) {\n var pattern = tokenType.PATTERN;\n if ((0, isRegExp_12.default)(pattern)) {\n return false;\n } else if ((0, isFunction_1.default)(pattern)) {\n return true;\n } else if ((0, has_1.default)(pattern, \"exec\")) {\n return true;\n } else if ((0, isString_12.default)(pattern)) {\n return false;\n } else {\n throw Error(\"non exhaustive match\");\n }\n }\n exports.isCustomPattern = isCustomPattern;\n function isShortPattern(pattern) {\n if ((0, isString_12.default)(pattern) && pattern.length === 1) {\n return pattern.charCodeAt(0);\n } else {\n return false;\n }\n }\n exports.isShortPattern = isShortPattern;\n exports.LineTerminatorOptimizedTester = {\n // implements /\\n|\\r\\n?/g.test\n test: function(text) {\n var len = text.length;\n for (var i2 = this.lastIndex; i2 < len; i2++) {\n var c = text.charCodeAt(i2);\n if (c === 10) {\n this.lastIndex = i2 + 1;\n return true;\n } else if (c === 13) {\n if (text.charCodeAt(i2 + 1) === 10) {\n this.lastIndex = i2 + 2;\n } else {\n this.lastIndex = i2 + 1;\n }\n return true;\n }\n }\n return false;\n },\n lastIndex: 0\n };\n function checkLineBreaksIssues(tokType, lineTerminatorCharCodes) {\n if ((0, has_1.default)(tokType, \"LINE_BREAKS\")) {\n return false;\n } else {\n if ((0, isRegExp_12.default)(tokType.PATTERN)) {\n try {\n (0, reg_exp_1.canMatchCharCode)(lineTerminatorCharCodes, tokType.PATTERN);\n } catch (e) {\n return {\n issue: lexer_public_1.LexerDefinitionErrorType.IDENTIFY_TERMINATOR,\n errMsg: e.message\n };\n }\n return false;\n } else if ((0, isString_12.default)(tokType.PATTERN)) {\n return false;\n } else if (isCustomPattern(tokType)) {\n return { issue: lexer_public_1.LexerDefinitionErrorType.CUSTOM_LINE_BREAK };\n } else {\n throw Error(\"non exhaustive match\");\n }\n }\n }\n function buildLineBreakIssueMessage(tokType, details) {\n if (details.issue === lexer_public_1.LexerDefinitionErrorType.IDENTIFY_TERMINATOR) {\n return \"Warning: unable to identify line terminator usage in pattern.\\n\" + \"\tThe problem is in the <\".concat(tokType.name, \"> Token Type\\n\") + \"\t Root cause: \".concat(details.errMsg, \".\\n\") + \"\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR\";\n } else if (details.issue === lexer_public_1.LexerDefinitionErrorType.CUSTOM_LINE_BREAK) {\n return \"Warning: A Custom Token Pattern should specify the option.\\n\" + \"\tThe problem is in the <\".concat(tokType.name, \"> Token Type\\n\") + \"\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK\";\n } else {\n throw Error(\"non exhaustive match\");\n }\n }\n exports.buildLineBreakIssueMessage = buildLineBreakIssueMessage;\n function getCharCodes(charsOrCodes) {\n var charCodes = (0, map_12.default)(charsOrCodes, function(numOrString) {\n if ((0, isString_12.default)(numOrString)) {\n return numOrString.charCodeAt(0);\n } else {\n return numOrString;\n }\n });\n return charCodes;\n }\n function addToMapOfArrays(map, key, value) {\n if (map[key] === void 0) {\n map[key] = [value];\n } else {\n map[key].push(value);\n }\n }\n exports.minOptimizationVal = 256;\n var charCodeToOptimizedIdxMap = [];\n function charCodeToOptimizedIndex(charCode) {\n return charCode < exports.minOptimizationVal ? charCode : charCodeToOptimizedIdxMap[charCode];\n }\n exports.charCodeToOptimizedIndex = charCodeToOptimizedIndex;\n function initCharCodeToOptimizedIndexMap() {\n if ((0, isEmpty_12.default)(charCodeToOptimizedIdxMap)) {\n charCodeToOptimizedIdxMap = new Array(65536);\n for (var i2 = 0; i2 < 65536; i2++) {\n charCodeToOptimizedIdxMap[i2] = i2 > 255 ? 255 + ~~(i2 / 255) : i2;\n }\n }\n }\n })(lexer);\n return lexer;\n}\nvar tokens = {};\n(function(exports) {\n var __importDefault2 = commonjsGlobal && commonjsGlobal.__importDefault || function(mod2) {\n return mod2 && mod2.__esModule ? mod2 : { \"default\": mod2 };\n };\n Object.defineProperty(exports, \"__esModule\", { value: true });\n exports.isTokenType = exports.hasExtendingTokensTypesMapProperty = exports.hasExtendingTokensTypesProperty = exports.hasCategoriesProperty = exports.hasShortKeyProperty = exports.singleAssignCategoriesToksMap = exports.assignCategoriesMapProp = exports.assignCategoriesTokensProp = exports.assignTokenDefaultProps = exports.expandCategories = exports.augmentTokenTypes = exports.tokenIdxToClass = exports.tokenShortNameIdx = exports.tokenStructuredMatcherNoCategories = exports.tokenStructuredMatcher = void 0;\n var isEmpty_12 = __importDefault2(lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2__);\n var compact_1 = __importDefault2(lodash_compact__WEBPACK_IMPORTED_MODULE_21__);\n var isArray_12 = __importDefault2(lodash_isArray__WEBPACK_IMPORTED_MODULE_22__);\n var flatten_12 = __importDefault2(lodash_flatten__WEBPACK_IMPORTED_MODULE_16__);\n var difference_1 = __importDefault2(lodash_difference__WEBPACK_IMPORTED_MODULE_24__);\n var map_12 = __importDefault2(lodash_map__WEBPACK_IMPORTED_MODULE_3__);\n var forEach_12 = __importDefault2(lodash_forEach__WEBPACK_IMPORTED_MODULE_4__);\n var has_1 = __importDefault2(lodash_has__WEBPACK_IMPORTED_MODULE_6__);\n var includes_12 = __importDefault2(lodash_includes__WEBPACK_IMPORTED_MODULE_15__);\n var clone_12 = __importDefault2(lodash_clone__WEBPACK_IMPORTED_MODULE_7__);\n function tokenStructuredMatcher(tokInstance, tokConstructor) {\n var instanceType = tokInstance.tokenTypeIdx;\n if (instanceType === tokConstructor.tokenTypeIdx) {\n return true;\n } else {\n return tokConstructor.isParent === true && tokConstructor.categoryMatchesMap[instanceType] === true;\n }\n }\n exports.tokenStructuredMatcher = tokenStructuredMatcher;\n function tokenStructuredMatcherNoCategories(token, tokType) {\n return token.tokenTypeIdx === tokType.tokenTypeIdx;\n }\n exports.tokenStructuredMatcherNoCategories = tokenStructuredMatcherNoCategories;\n exports.tokenShortNameIdx = 1;\n exports.tokenIdxToClass = {};\n function augmentTokenTypes(tokenTypes) {\n var tokenTypesAndParents = expandCategories(tokenTypes);\n assignTokenDefaultProps(tokenTypesAndParents);\n assignCategoriesMapProp(tokenTypesAndParents);\n assignCategoriesTokensProp(tokenTypesAndParents);\n (0, forEach_12.default)(tokenTypesAndParents, function(tokType) {\n tokType.isParent = tokType.categoryMatches.length > 0;\n });\n }\n exports.augmentTokenTypes = augmentTokenTypes;\n function expandCategories(tokenTypes) {\n var result = (0, clone_12.default)(tokenTypes);\n var categories = tokenTypes;\n var searching = true;\n while (searching) {\n categories = (0, compact_1.default)((0, flatten_12.default)((0, map_12.default)(categories, function(currTokType) {\n return currTokType.CATEGORIES;\n })));\n var newCategories = (0, difference_1.default)(categories, result);\n result = result.concat(newCategories);\n if ((0, isEmpty_12.default)(newCategories)) {\n searching = false;\n } else {\n categories = newCategories;\n }\n }\n return result;\n }\n exports.expandCategories = expandCategories;\n function assignTokenDefaultProps(tokenTypes) {\n (0, forEach_12.default)(tokenTypes, function(currTokType) {\n if (!hasShortKeyProperty(currTokType)) {\n exports.tokenIdxToClass[exports.tokenShortNameIdx] = currTokType;\n currTokType.tokenTypeIdx = exports.tokenShortNameIdx++;\n }\n if (hasCategoriesProperty(currTokType) && !(0, isArray_12.default)(currTokType.CATEGORIES)) {\n currTokType.CATEGORIES = [currTokType.CATEGORIES];\n }\n if (!hasCategoriesProperty(currTokType)) {\n currTokType.CATEGORIES = [];\n }\n if (!hasExtendingTokensTypesProperty(currTokType)) {\n currTokType.categoryMatches = [];\n }\n if (!hasExtendingTokensTypesMapProperty(currTokType)) {\n currTokType.categoryMatchesMap = {};\n }\n });\n }\n exports.assignTokenDefaultProps = assignTokenDefaultProps;\n function assignCategoriesTokensProp(tokenTypes) {\n (0, forEach_12.default)(tokenTypes, function(currTokType) {\n currTokType.categoryMatches = [];\n (0, forEach_12.default)(currTokType.categoryMatchesMap, function(val, key) {\n currTokType.categoryMatches.push(exports.tokenIdxToClass[key].tokenTypeIdx);\n });\n });\n }\n exports.assignCategoriesTokensProp = assignCategoriesTokensProp;\n function assignCategoriesMapProp(tokenTypes) {\n (0, forEach_12.default)(tokenTypes, function(currTokType) {\n singleAssignCategoriesToksMap([], currTokType);\n });\n }\n exports.assignCategoriesMapProp = assignCategoriesMapProp;\n function singleAssignCategoriesToksMap(path, nextNode) {\n (0, forEach_12.default)(path, function(pathNode) {\n nextNode.categoryMatchesMap[pathNode.tokenTypeIdx] = true;\n });\n (0, forEach_12.default)(nextNode.CATEGORIES, function(nextCategory) {\n var newPath = path.concat(nextNode);\n if (!(0, includes_12.default)(newPath, nextCategory)) {\n singleAssignCategoriesToksMap(newPath, nextCategory);\n }\n });\n }\n exports.singleAssignCategoriesToksMap = singleAssignCategoriesToksMap;\n function hasShortKeyProperty(tokType) {\n return (0, has_1.default)(tokType, \"tokenTypeIdx\");\n }\n exports.hasShortKeyProperty = hasShortKeyProperty;\n function hasCategoriesProperty(tokType) {\n return (0, has_1.default)(tokType, \"CATEGORIES\");\n }\n exports.hasCategoriesProperty = hasCategoriesProperty;\n function hasExtendingTokensTypesProperty(tokType) {\n return (0, has_1.default)(tokType, \"categoryMatches\");\n }\n exports.hasExtendingTokensTypesProperty = hasExtendingTokensTypesProperty;\n function hasExtendingTokensTypesMapProperty(tokType) {\n return (0, has_1.default)(tokType, \"categoryMatchesMap\");\n }\n exports.hasExtendingTokensTypesMapProperty = hasExtendingTokensTypesMapProperty;\n function isTokenType(tokType) {\n return (0, has_1.default)(tokType, \"tokenTypeIdx\");\n }\n exports.isTokenType = isTokenType;\n})(tokens);\nvar lexer_errors_public = {};\nObject.defineProperty(lexer_errors_public, \"__esModule\", { value: true });\nlexer_errors_public.defaultLexerErrorProvider = void 0;\nlexer_errors_public.defaultLexerErrorProvider = {\n buildUnableToPopLexerModeMessage: function(token) {\n return \"Unable to pop Lexer Mode after encountering Token ->\".concat(token.image, \"<- The Mode Stack is empty\");\n },\n buildUnexpectedCharactersMessage: function(fullText, startOffset, length, line, column) {\n return \"unexpected character: ->\".concat(fullText.charAt(startOffset), \"<- at offset: \").concat(startOffset, \",\") + \" skipped \".concat(length, \" characters.\");\n }\n};\nvar hasRequiredLexer_public;\nfunction requireLexer_public() {\n if (hasRequiredLexer_public)\n return lexer_public;\n hasRequiredLexer_public = 1;\n (function(exports) {\n var __importDefault2 = commonjsGlobal && commonjsGlobal.__importDefault || function(mod2) {\n return mod2 && mod2.__esModule ? mod2 : { \"default\": mod2 };\n };\n Object.defineProperty(exports, \"__esModule\", { value: true });\n exports.Lexer = exports.LexerDefinitionErrorType = void 0;\n var lexer_1 = requireLexer();\n var noop_1 = __importDefault2(lodash_noop__WEBPACK_IMPORTED_MODULE_32__);\n var isEmpty_12 = __importDefault2(lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2__);\n var isArray_12 = __importDefault2(lodash_isArray__WEBPACK_IMPORTED_MODULE_22__);\n var last_12 = __importDefault2(lodash_last__WEBPACK_IMPORTED_MODULE_33__);\n var reject_1 = __importDefault2(lodash_reject__WEBPACK_IMPORTED_MODULE_23__);\n var map_12 = __importDefault2(lodash_map__WEBPACK_IMPORTED_MODULE_3__);\n var forEach_12 = __importDefault2(lodash_forEach__WEBPACK_IMPORTED_MODULE_4__);\n var keys_1 = __importDefault2(lodash_keys__WEBPACK_IMPORTED_MODULE_28__);\n var isUndefined_12 = __importDefault2(lodash_isUndefined__WEBPACK_IMPORTED_MODULE_18__);\n var identity_1 = __importDefault2(lodash_identity__WEBPACK_IMPORTED_MODULE_34__);\n var assign_12 = __importDefault2(lodash_assign__WEBPACK_IMPORTED_MODULE_12__);\n var reduce_12 = __importDefault2(lodash_reduce__WEBPACK_IMPORTED_MODULE_31__);\n var clone_12 = __importDefault2(lodash_clone__WEBPACK_IMPORTED_MODULE_7__);\n var utils_1 = api$2;\n var tokens_1 = tokens;\n var lexer_errors_public_1 = lexer_errors_public;\n var reg_exp_parser_1 = reg_exp_parser;\n (function(LexerDefinitionErrorType) {\n LexerDefinitionErrorType[LexerDefinitionErrorType[\"MISSING_PATTERN\"] = 0] = \"MISSING_PATTERN\";\n LexerDefinitionErrorType[LexerDefinitionErrorType[\"INVALID_PATTERN\"] = 1] = \"INVALID_PATTERN\";\n LexerDefinitionErrorType[LexerDefinitionErrorType[\"EOI_ANCHOR_FOUND\"] = 2] = \"EOI_ANCHOR_FOUND\";\n LexerDefinitionErrorType[LexerDefinitionErrorType[\"UNSUPPORTED_FLAGS_FOUND\"] = 3] = \"UNSUPPORTED_FLAGS_FOUND\";\n LexerDefinitionErrorType[LexerDefinitionErrorType[\"DUPLICATE_PATTERNS_FOUND\"] = 4] = \"DUPLICATE_PATTERNS_FOUND\";\n LexerDefinitionErrorType[LexerDefinitionErrorType[\"INVALID_GROUP_TYPE_FOUND\"] = 5] = \"INVALID_GROUP_TYPE_FOUND\";\n LexerDefinitionErrorType[LexerDefinitionErrorType[\"PUSH_MODE_DOES_NOT_EXIST\"] = 6] = \"PUSH_MODE_DOES_NOT_EXIST\";\n LexerDefinitionErrorType[LexerDefinitionErrorType[\"MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE\"] = 7] = \"MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE\";\n LexerDefinitionErrorType[LexerDefinitionErrorType[\"MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY\"] = 8] = \"MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY\";\n LexerDefinitionErrorType[LexerDefinitionErrorType[\"MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST\"] = 9] = \"MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST\";\n LexerDefinitionErrorType[LexerDefinitionErrorType[\"LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED\"] = 10] = \"LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED\";\n LexerDefinitionErrorType[LexerDefinitionErrorType[\"SOI_ANCHOR_FOUND\"] = 11] = \"SOI_ANCHOR_FOUND\";\n LexerDefinitionErrorType[LexerDefinitionErrorType[\"EMPTY_MATCH_PATTERN\"] = 12] = \"EMPTY_MATCH_PATTERN\";\n LexerDefinitionErrorType[LexerDefinitionErrorType[\"NO_LINE_BREAKS_FLAGS\"] = 13] = \"NO_LINE_BREAKS_FLAGS\";\n LexerDefinitionErrorType[LexerDefinitionErrorType[\"UNREACHABLE_PATTERN\"] = 14] = \"UNREACHABLE_PATTERN\";\n LexerDefinitionErrorType[LexerDefinitionErrorType[\"IDENTIFY_TERMINATOR\"] = 15] = \"IDENTIFY_TERMINATOR\";\n LexerDefinitionErrorType[LexerDefinitionErrorType[\"CUSTOM_LINE_BREAK\"] = 16] = \"CUSTOM_LINE_BREAK\";\n LexerDefinitionErrorType[LexerDefinitionErrorType[\"MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE\"] = 17] = \"MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE\";\n })(exports.LexerDefinitionErrorType || (exports.LexerDefinitionErrorType = {}));\n var DEFAULT_LEXER_CONFIG = {\n deferDefinitionErrorsHandling: false,\n positionTracking: \"full\",\n lineTerminatorsPattern: /\\n|\\r\\n?/g,\n lineTerminatorCharacters: [\"\\n\", \"\\r\"],\n ensureOptimizations: false,\n safeMode: false,\n errorMessageProvider: lexer_errors_public_1.defaultLexerErrorProvider,\n traceInitPerf: false,\n skipValidations: false,\n recoveryEnabled: true\n };\n Object.freeze(DEFAULT_LEXER_CONFIG);\n var Lexer2 = (\n /** @class */\n function() {\n function Lexer3(lexerDefinition, config) {\n if (config === void 0) {\n config = DEFAULT_LEXER_CONFIG;\n }\n var _this = this;\n this.lexerDefinition = lexerDefinition;\n this.lexerDefinitionErrors = [];\n this.lexerDefinitionWarning = [];\n this.patternIdxToConfig = {};\n this.charCodeToPatternIdxToConfig = {};\n this.modes = [];\n this.emptyGroups = {};\n this.trackStartLines = true;\n this.trackEndLines = true;\n this.hasCustom = false;\n this.canModeBeOptimized = {};\n this.TRACE_INIT = function(phaseDesc, phaseImpl) {\n if (_this.traceInitPerf === true) {\n _this.traceInitIndent++;\n var indent = new Array(_this.traceInitIndent + 1).join(\"\t\");\n if (_this.traceInitIndent < _this.traceInitMaxIdent) {\n console.log(\"\".concat(indent, \"--> <\").concat(phaseDesc, \">\"));\n }\n var _a2 = (0, utils_1.timer)(phaseImpl), time = _a2.time, value = _a2.value;\n var traceMethod = time > 10 ? console.warn : console.log;\n if (_this.traceInitIndent < _this.traceInitMaxIdent) {\n traceMethod(\"\".concat(indent, \"<-- <\").concat(phaseDesc, \"> time: \").concat(time, \"ms\"));\n }\n _this.traceInitIndent--;\n return value;\n } else {\n return phaseImpl();\n }\n };\n if (typeof config === \"boolean\") {\n throw Error(\"The second argument to the Lexer constructor is now an ILexerConfig Object.\\na boolean 2nd argument is no longer supported\");\n }\n this.config = (0, assign_12.default)({}, DEFAULT_LEXER_CONFIG, config);\n var traceInitVal = this.config.traceInitPerf;\n if (traceInitVal === true) {\n this.traceInitMaxIdent = Infinity;\n this.traceInitPerf = true;\n } else if (typeof traceInitVal === \"number\") {\n this.traceInitMaxIdent = traceInitVal;\n this.traceInitPerf = true;\n }\n this.traceInitIndent = -1;\n this.TRACE_INIT(\"Lexer Constructor\", function() {\n var actualDefinition;\n var hasOnlySingleMode = true;\n _this.TRACE_INIT(\"Lexer Config handling\", function() {\n if (_this.config.lineTerminatorsPattern === DEFAULT_LEXER_CONFIG.lineTerminatorsPattern) {\n _this.config.lineTerminatorsPattern = lexer_1.LineTerminatorOptimizedTester;\n } else {\n if (_this.config.lineTerminatorCharacters === DEFAULT_LEXER_CONFIG.lineTerminatorCharacters) {\n throw Error(\"Error: Missing property on the Lexer config.\\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS\");\n }\n }\n if (config.safeMode && config.ensureOptimizations) {\n throw Error('\"safeMode\" and \"ensureOptimizations\" flags are mutually exclusive.');\n }\n _this.trackStartLines = /full|onlyStart/i.test(_this.config.positionTracking);\n _this.trackEndLines = /full/i.test(_this.config.positionTracking);\n if ((0, isArray_12.default)(lexerDefinition)) {\n actualDefinition = {\n modes: { defaultMode: (0, clone_12.default)(lexerDefinition) },\n defaultMode: lexer_1.DEFAULT_MODE\n };\n } else {\n hasOnlySingleMode = false;\n actualDefinition = (0, clone_12.default)(lexerDefinition);\n }\n });\n if (_this.config.skipValidations === false) {\n _this.TRACE_INIT(\"performRuntimeChecks\", function() {\n _this.lexerDefinitionErrors = _this.lexerDefinitionErrors.concat((0, lexer_1.performRuntimeChecks)(actualDefinition, _this.trackStartLines, _this.config.lineTerminatorCharacters));\n });\n _this.TRACE_INIT(\"performWarningRuntimeChecks\", function() {\n _this.lexerDefinitionWarning = _this.lexerDefinitionWarning.concat((0, lexer_1.performWarningRuntimeChecks)(actualDefinition, _this.trackStartLines, _this.config.lineTerminatorCharacters));\n });\n }\n actualDefinition.modes = actualDefinition.modes ? actualDefinition.modes : {};\n (0, forEach_12.default)(actualDefinition.modes, function(currModeValue, currModeName) {\n actualDefinition.modes[currModeName] = (0, reject_1.default)(currModeValue, function(currTokType) {\n return (0, isUndefined_12.default)(currTokType);\n });\n });\n var allModeNames = (0, keys_1.default)(actualDefinition.modes);\n (0, forEach_12.default)(actualDefinition.modes, function(currModDef, currModName) {\n _this.TRACE_INIT(\"Mode: <\".concat(currModName, \"> processing\"), function() {\n _this.modes.push(currModName);\n if (_this.config.skipValidations === false) {\n _this.TRACE_INIT(\"validatePatterns\", function() {\n _this.lexerDefinitionErrors = _this.lexerDefinitionErrors.concat((0, lexer_1.validatePatterns)(currModDef, allModeNames));\n });\n }\n if ((0, isEmpty_12.default)(_this.lexerDefinitionErrors)) {\n (0, tokens_1.augmentTokenTypes)(currModDef);\n var currAnalyzeResult_1;\n _this.TRACE_INIT(\"analyzeTokenTypes\", function() {\n currAnalyzeResult_1 = (0, lexer_1.analyzeTokenTypes)(currModDef, {\n lineTerminatorCharacters: _this.config.lineTerminatorCharacters,\n positionTracking: config.positionTracking,\n ensureOptimizations: config.ensureOptimizations,\n safeMode: config.safeMode,\n tracer: _this.TRACE_INIT\n });\n });\n _this.patternIdxToConfig[currModName] = currAnalyzeResult_1.patternIdxToConfig;\n _this.charCodeToPatternIdxToConfig[currModName] = currAnalyzeResult_1.charCodeToPatternIdxToConfig;\n _this.emptyGroups = (0, assign_12.default)({}, _this.emptyGroups, currAnalyzeResult_1.emptyGroups);\n _this.hasCustom = currAnalyzeResult_1.hasCustom || _this.hasCustom;\n _this.canModeBeOptimized[currModName] = currAnalyzeResult_1.canBeOptimized;\n }\n });\n });\n _this.defaultMode = actualDefinition.defaultMode;\n if (!(0, isEmpty_12.default)(_this.lexerDefinitionErrors) && !_this.config.deferDefinitionErrorsHandling) {\n var allErrMessages = (0, map_12.default)(_this.lexerDefinitionErrors, function(error) {\n return error.message;\n });\n var allErrMessagesString = allErrMessages.join(\"-----------------------\\n\");\n throw new Error(\"Errors detected in definition of Lexer:\\n\" + allErrMessagesString);\n }\n (0, forEach_12.default)(_this.lexerDefinitionWarning, function(warningDescriptor) {\n (0, utils_1.PRINT_WARNING)(warningDescriptor.message);\n });\n _this.TRACE_INIT(\"Choosing sub-methods implementations\", function() {\n if (lexer_1.SUPPORT_STICKY) {\n _this.chopInput = identity_1.default;\n _this.match = _this.matchWithTest;\n } else {\n _this.updateLastIndex = noop_1.default;\n _this.match = _this.matchWithExec;\n }\n if (hasOnlySingleMode) {\n _this.handleModes = noop_1.default;\n }\n if (_this.trackStartLines === false) {\n _this.computeNewColumn = identity_1.default;\n }\n if (_this.trackEndLines === false) {\n _this.updateTokenEndLineColumnLocation = noop_1.default;\n }\n if (/full/i.test(_this.config.positionTracking)) {\n _this.createTokenInstance = _this.createFullToken;\n } else if (/onlyStart/i.test(_this.config.positionTracking)) {\n _this.createTokenInstance = _this.createStartOnlyToken;\n } else if (/onlyOffset/i.test(_this.config.positionTracking)) {\n _this.createTokenInstance = _this.createOffsetOnlyToken;\n } else {\n throw Error('Invalid config option: \"'.concat(_this.config.positionTracking, '\"'));\n }\n if (_this.hasCustom) {\n _this.addToken = _this.addTokenUsingPush;\n _this.handlePayload = _this.handlePayloadWithCustom;\n } else {\n _this.addToken = _this.addTokenUsingMemberAccess;\n _this.handlePayload = _this.handlePayloadNoCustom;\n }\n });\n _this.TRACE_INIT(\"Failed Optimization Warnings\", function() {\n var unOptimizedModes = (0, reduce_12.default)(_this.canModeBeOptimized, function(cannotBeOptimized, canBeOptimized, modeName) {\n if (canBeOptimized === false) {\n cannotBeOptimized.push(modeName);\n }\n return cannotBeOptimized;\n }, []);\n if (config.ensureOptimizations && !(0, isEmpty_12.default)(unOptimizedModes)) {\n throw Error(\"Lexer Modes: < \".concat(unOptimizedModes.join(\", \"), \" > cannot be optimized.\\n\") + '\t Disable the \"ensureOptimizations\" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.\\n\t Or inspect the console log for details on how to resolve these issues.');\n }\n });\n _this.TRACE_INIT(\"clearRegExpParserCache\", function() {\n (0, reg_exp_parser_1.clearRegExpParserCache)();\n });\n _this.TRACE_INIT(\"toFastProperties\", function() {\n (0, utils_1.toFastProperties)(_this);\n });\n });\n }\n Lexer3.prototype.tokenize = function(text, initialMode) {\n if (initialMode === void 0) {\n initialMode = this.defaultMode;\n }\n if (!(0, isEmpty_12.default)(this.lexerDefinitionErrors)) {\n var allErrMessages = (0, map_12.default)(this.lexerDefinitionErrors, function(error) {\n return error.message;\n });\n var allErrMessagesString = allErrMessages.join(\"-----------------------\\n\");\n throw new Error(\"Unable to Tokenize because Errors detected in definition of Lexer:\\n\" + allErrMessagesString);\n }\n return this.tokenizeInternal(text, initialMode);\n };\n Lexer3.prototype.tokenizeInternal = function(text, initialMode) {\n var _this = this;\n var i2, j, k, matchAltImage, longerAlt, matchedImage, payload, altPayload, imageLength, group, tokType, newToken, errLength, msg, match;\n var orgText = text;\n var orgLength = orgText.length;\n var offset = 0;\n var matchedTokensIndex = 0;\n var guessedNumberOfTokens = this.hasCustom ? 0 : Math.floor(text.length / 10);\n var matchedTokens = new Array(guessedNumberOfTokens);\n var errors = [];\n var line = this.trackStartLines ? 1 : void 0;\n var column = this.trackStartLines ? 1 : void 0;\n var groups = (0, lexer_1.cloneEmptyGroups)(this.emptyGroups);\n var trackLines = this.trackStartLines;\n var lineTerminatorPattern = this.config.lineTerminatorsPattern;\n var currModePatternsLength = 0;\n var patternIdxToConfig = [];\n var currCharCodeToPatternIdxToConfig = [];\n var modeStack = [];\n var emptyArray = [];\n Object.freeze(emptyArray);\n var getPossiblePatterns;\n function getPossiblePatternsSlow() {\n return patternIdxToConfig;\n }\n function getPossiblePatternsOptimized(charCode) {\n var optimizedCharIdx = (0, lexer_1.charCodeToOptimizedIndex)(charCode);\n var possiblePatterns = currCharCodeToPatternIdxToConfig[optimizedCharIdx];\n if (possiblePatterns === void 0) {\n return emptyArray;\n } else {\n return possiblePatterns;\n }\n }\n var pop_mode = function(popToken) {\n if (modeStack.length === 1 && // if we have both a POP_MODE and a PUSH_MODE this is in-fact a \"transition\"\n // So no error should occur.\n popToken.tokenType.PUSH_MODE === void 0) {\n var msg_1 = _this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(popToken);\n errors.push({\n offset: popToken.startOffset,\n line: popToken.startLine,\n column: popToken.startColumn,\n length: popToken.image.length,\n message: msg_1\n });\n } else {\n modeStack.pop();\n var newMode = (0, last_12.default)(modeStack);\n patternIdxToConfig = _this.patternIdxToConfig[newMode];\n currCharCodeToPatternIdxToConfig = _this.charCodeToPatternIdxToConfig[newMode];\n currModePatternsLength = patternIdxToConfig.length;\n var modeCanBeOptimized = _this.canModeBeOptimized[newMode] && _this.config.safeMode === false;\n if (currCharCodeToPatternIdxToConfig && modeCanBeOptimized) {\n getPossiblePatterns = getPossiblePatternsOptimized;\n } else {\n getPossiblePatterns = getPossiblePatternsSlow;\n }\n }\n };\n function push_mode(newMode) {\n modeStack.push(newMode);\n currCharCodeToPatternIdxToConfig = this.charCodeToPatternIdxToConfig[newMode];\n patternIdxToConfig = this.patternIdxToConfig[newMode];\n currModePatternsLength = patternIdxToConfig.length;\n currModePatternsLength = patternIdxToConfig.length;\n var modeCanBeOptimized = this.canModeBeOptimized[newMode] && this.config.safeMode === false;\n if (currCharCodeToPatternIdxToConfig && modeCanBeOptimized) {\n getPossiblePatterns = getPossiblePatternsOptimized;\n } else {\n getPossiblePatterns = getPossiblePatternsSlow;\n }\n }\n push_mode.call(this, initialMode);\n var currConfig;\n var recoveryEnabled = this.config.recoveryEnabled;\n while (offset < orgLength) {\n matchedImage = null;\n var nextCharCode = orgText.charCodeAt(offset);\n var chosenPatternIdxToConfig = getPossiblePatterns(nextCharCode);\n var chosenPatternsLength = chosenPatternIdxToConfig.length;\n for (i2 = 0; i2 < chosenPatternsLength; i2++) {\n currConfig = chosenPatternIdxToConfig[i2];\n var currPattern = currConfig.pattern;\n payload = null;\n var singleCharCode = currConfig.short;\n if (singleCharCode !== false) {\n if (nextCharCode === singleCharCode) {\n matchedImage = currPattern;\n }\n } else if (currConfig.isCustom === true) {\n match = currPattern.exec(orgText, offset, matchedTokens, groups);\n if (match !== null) {\n matchedImage = match[0];\n if (match.payload !== void 0) {\n payload = match.payload;\n }\n } else {\n matchedImage = null;\n }\n } else {\n this.updateLastIndex(currPattern, offset);\n matchedImage = this.match(currPattern, text, offset);\n }\n if (matchedImage !== null) {\n longerAlt = currConfig.longerAlt;\n if (longerAlt !== void 0) {\n var longerAltLength = longerAlt.length;\n for (k = 0; k < longerAltLength; k++) {\n var longerAltConfig = patternIdxToConfig[longerAlt[k]];\n var longerAltPattern = longerAltConfig.pattern;\n altPayload = null;\n if (longerAltConfig.isCustom === true) {\n match = longerAltPattern.exec(orgText, offset, matchedTokens, groups);\n if (match !== null) {\n matchAltImage = match[0];\n if (match.payload !== void 0) {\n altPayload = match.payload;\n }\n } else {\n matchAltImage = null;\n }\n } else {\n this.updateLastIndex(longerAltPattern, offset);\n matchAltImage = this.match(longerAltPattern, text, offset);\n }\n if (matchAltImage && matchAltImage.length > matchedImage.length) {\n matchedImage = matchAltImage;\n payload = altPayload;\n currConfig = longerAltConfig;\n break;\n }\n }\n }\n break;\n }\n }\n if (matchedImage !== null) {\n imageLength = matchedImage.length;\n group = currConfig.group;\n if (group !== void 0) {\n tokType = currConfig.tokenTypeIdx;\n newToken = this.createTokenInstance(matchedImage, offset, tokType, currConfig.tokenType, line, column, imageLength);\n this.handlePayload(newToken, payload);\n if (group === false) {\n matchedTokensIndex = this.addToken(matchedTokens, matchedTokensIndex, newToken);\n } else {\n groups[group].push(newToken);\n }\n }\n text = this.chopInput(text, imageLength);\n offset = offset + imageLength;\n column = this.computeNewColumn(column, imageLength);\n if (trackLines === true && currConfig.canLineTerminator === true) {\n var numOfLTsInMatch = 0;\n var foundTerminator = void 0;\n var lastLTEndOffset = void 0;\n lineTerminatorPattern.lastIndex = 0;\n do {\n foundTerminator = lineTerminatorPattern.test(matchedImage);\n if (foundTerminator === true) {\n lastLTEndOffset = lineTerminatorPattern.lastIndex - 1;\n numOfLTsInMatch++;\n }\n } while (foundTerminator === true);\n if (numOfLTsInMatch !== 0) {\n line = line + numOfLTsInMatch;\n column = imageLength - lastLTEndOffset;\n this.updateTokenEndLineColumnLocation(newToken, group, lastLTEndOffset, numOfLTsInMatch, line, column, imageLength);\n }\n }\n this.handleModes(currConfig, pop_mode, push_mode, newToken);\n } else {\n var errorStartOffset = offset;\n var errorLine = line;\n var errorColumn = column;\n var foundResyncPoint = recoveryEnabled === false;\n while (foundResyncPoint === false && offset < orgLength) {\n text = this.chopInput(text, 1);\n offset++;\n for (j = 0; j < currModePatternsLength; j++) {\n var currConfig_1 = patternIdxToConfig[j];\n var currPattern = currConfig_1.pattern;\n var singleCharCode = currConfig_1.short;\n if (singleCharCode !== false) {\n if (orgText.charCodeAt(offset) === singleCharCode) {\n foundResyncPoint = true;\n }\n } else if (currConfig_1.isCustom === true) {\n foundResyncPoint = currPattern.exec(orgText, offset, matchedTokens, groups) !== null;\n } else {\n this.updateLastIndex(currPattern, offset);\n foundResyncPoint = currPattern.exec(text) !== null;\n }\n if (foundResyncPoint === true) {\n break;\n }\n }\n }\n errLength = offset - errorStartOffset;\n msg = this.config.errorMessageProvider.buildUnexpectedCharactersMessage(orgText, errorStartOffset, errLength, errorLine, errorColumn);\n errors.push({\n offset: errorStartOffset,\n line: errorLine,\n column: errorColumn,\n length: errLength,\n message: msg\n });\n if (recoveryEnabled === false) {\n break;\n }\n }\n }\n if (!this.hasCustom) {\n matchedTokens.length = matchedTokensIndex;\n }\n return {\n tokens: matchedTokens,\n groups,\n errors\n };\n };\n Lexer3.prototype.handleModes = function(config, pop_mode, push_mode, newToken) {\n if (config.pop === true) {\n var pushMode = config.push;\n pop_mode(newToken);\n if (pushMode !== void 0) {\n push_mode.call(this, pushMode);\n }\n } else if (config.push !== void 0) {\n push_mode.call(this, config.push);\n }\n };\n Lexer3.prototype.chopInput = function(text, length) {\n return text.substring(length);\n };\n Lexer3.prototype.updateLastIndex = function(regExp, newLastIndex) {\n regExp.lastIndex = newLastIndex;\n };\n Lexer3.prototype.updateTokenEndLineColumnLocation = function(newToken, group, lastLTIdx, numOfLTsInMatch, line, column, imageLength) {\n var lastCharIsLT, fixForEndingInLT;\n if (group !== void 0) {\n lastCharIsLT = lastLTIdx === imageLength - 1;\n fixForEndingInLT = lastCharIsLT ? -1 : 0;\n if (!(numOfLTsInMatch === 1 && lastCharIsLT === true)) {\n newToken.endLine = line + fixForEndingInLT;\n newToken.endColumn = column - 1 + -fixForEndingInLT;\n }\n }\n };\n Lexer3.prototype.computeNewColumn = function(oldColumn, imageLength) {\n return oldColumn + imageLength;\n };\n Lexer3.prototype.createOffsetOnlyToken = function(image, startOffset, tokenTypeIdx, tokenType) {\n return {\n image,\n startOffset,\n tokenTypeIdx,\n tokenType\n };\n };\n Lexer3.prototype.createStartOnlyToken = function(image, startOffset, tokenTypeIdx, tokenType, startLine, startColumn) {\n return {\n image,\n startOffset,\n startLine,\n startColumn,\n tokenTypeIdx,\n tokenType\n };\n };\n Lexer3.prototype.createFullToken = function(image, startOffset, tokenTypeIdx, tokenType, startLine, startColumn, imageLength) {\n return {\n image,\n startOffset,\n endOffset: startOffset + imageLength - 1,\n startLine,\n endLine: startLine,\n startColumn,\n endColumn: startColumn + imageLength - 1,\n tokenTypeIdx,\n tokenType\n };\n };\n Lexer3.prototype.addTokenUsingPush = function(tokenVector, index, tokenToAdd) {\n tokenVector.push(tokenToAdd);\n return index;\n };\n Lexer3.prototype.addTokenUsingMemberAccess = function(tokenVector, index, tokenToAdd) {\n tokenVector[index] = tokenToAdd;\n index++;\n return index;\n };\n Lexer3.prototype.handlePayloadNoCustom = function(token, payload) {\n };\n Lexer3.prototype.handlePayloadWithCustom = function(token, payload) {\n if (payload !== null) {\n token.payload = payload;\n }\n };\n Lexer3.prototype.matchWithTest = function(pattern, text, offset) {\n var found = pattern.test(text);\n if (found === true) {\n return text.substring(offset, pattern.lastIndex);\n }\n return null;\n };\n Lexer3.prototype.matchWithExec = function(pattern, text) {\n var regExpArray = pattern.exec(text);\n return regExpArray !== null ? regExpArray[0] : null;\n };\n Lexer3.SKIPPED = \"This marks a skipped Token pattern, this means each token identified by it willbe consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.\";\n Lexer3.NA = /NOT_APPLICABLE/;\n return Lexer3;\n }()\n );\n exports.Lexer = Lexer2;\n })(lexer_public);\n return lexer_public;\n}\n(function(exports) {\n var __importDefault2 = commonjsGlobal && commonjsGlobal.__importDefault || function(mod2) {\n return mod2 && mod2.__esModule ? mod2 : { \"default\": mod2 };\n };\n Object.defineProperty(exports, \"__esModule\", { value: true });\n exports.tokenMatcher = exports.createTokenInstance = exports.EOF = exports.createToken = exports.hasTokenLabel = exports.tokenName = exports.tokenLabel = void 0;\n var isString_12 = __importDefault2(lodash_isString__WEBPACK_IMPORTED_MODULE_9__);\n var has_1 = __importDefault2(lodash_has__WEBPACK_IMPORTED_MODULE_6__);\n var isUndefined_12 = __importDefault2(lodash_isUndefined__WEBPACK_IMPORTED_MODULE_18__);\n var lexer_public_1 = requireLexer_public();\n var tokens_1 = tokens;\n function tokenLabel2(tokType) {\n if (hasTokenLabel2(tokType)) {\n return tokType.LABEL;\n } else {\n return tokType.name;\n }\n }\n exports.tokenLabel = tokenLabel2;\n function tokenName(tokType) {\n return tokType.name;\n }\n exports.tokenName = tokenName;\n function hasTokenLabel2(obj) {\n return (0, isString_12.default)(obj.LABEL) && obj.LABEL !== \"\";\n }\n exports.hasTokenLabel = hasTokenLabel2;\n var PARENT = \"parent\";\n var CATEGORIES = \"categories\";\n var LABEL = \"label\";\n var GROUP = \"group\";\n var PUSH_MODE = \"push_mode\";\n var POP_MODE = \"pop_mode\";\n var LONGER_ALT = \"longer_alt\";\n var LINE_BREAKS = \"line_breaks\";\n var START_CHARS_HINT = \"start_chars_hint\";\n function createToken2(config) {\n return createTokenInternal(config);\n }\n exports.createToken = createToken2;\n function createTokenInternal(config) {\n var pattern = config.pattern;\n var tokenType = {};\n tokenType.name = config.name;\n if (!(0, isUndefined_12.default)(pattern)) {\n tokenType.PATTERN = pattern;\n }\n if ((0, has_1.default)(config, PARENT)) {\n throw \"The parent property is no longer supported.\\nSee: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.\";\n }\n if ((0, has_1.default)(config, CATEGORIES)) {\n tokenType.CATEGORIES = config[CATEGORIES];\n }\n (0, tokens_1.augmentTokenTypes)([tokenType]);\n if ((0, has_1.default)(config, LABEL)) {\n tokenType.LABEL = config[LABEL];\n }\n if ((0, has_1.default)(config, GROUP)) {\n tokenType.GROUP = config[GROUP];\n }\n if ((0, has_1.default)(config, POP_MODE)) {\n tokenType.POP_MODE = config[POP_MODE];\n }\n if ((0, has_1.default)(config, PUSH_MODE)) {\n tokenType.PUSH_MODE = config[PUSH_MODE];\n }\n if ((0, has_1.default)(config, LONGER_ALT)) {\n tokenType.LONGER_ALT = config[LONGER_ALT];\n }\n if ((0, has_1.default)(config, LINE_BREAKS)) {\n tokenType.LINE_BREAKS = config[LINE_BREAKS];\n }\n if ((0, has_1.default)(config, START_CHARS_HINT)) {\n tokenType.START_CHARS_HINT = config[START_CHARS_HINT];\n }\n return tokenType;\n }\n exports.EOF = createToken2({ name: \"EOF\", pattern: lexer_public_1.Lexer.NA });\n (0, tokens_1.augmentTokenTypes)([exports.EOF]);\n function createTokenInstance(tokType, image, startOffset, endOffset, startLine, endLine, startColumn, endColumn) {\n return {\n image,\n startOffset,\n endOffset,\n startLine,\n endLine,\n startColumn,\n endColumn,\n tokenTypeIdx: tokType.tokenTypeIdx,\n tokenType: tokType\n };\n }\n exports.createTokenInstance = createTokenInstance;\n function tokenMatcher(token, tokType) {\n return (0, tokens_1.tokenStructuredMatcher)(token, tokType);\n }\n exports.tokenMatcher = tokenMatcher;\n})(tokens_public);\nvar errors_public = {};\n(function(exports) {\n var __importDefault2 = commonjsGlobal && commonjsGlobal.__importDefault || function(mod2) {\n return mod2 && mod2.__esModule ? mod2 : { \"default\": mod2 };\n };\n Object.defineProperty(exports, \"__esModule\", { value: true });\n exports.defaultGrammarValidatorErrorProvider = exports.defaultGrammarResolverErrorProvider = exports.defaultParserErrorProvider = void 0;\n var tokens_public_1 = tokens_public;\n var first_12 = __importDefault2(lodash_first__WEBPACK_IMPORTED_MODULE_20__);\n var map_12 = __importDefault2(lodash_map__WEBPACK_IMPORTED_MODULE_3__);\n var reduce_12 = __importDefault2(lodash_reduce__WEBPACK_IMPORTED_MODULE_31__);\n var gast_12 = api$1;\n var gast_22 = api$1;\n exports.defaultParserErrorProvider = {\n buildMismatchTokenMessage: function(_a2) {\n var expected = _a2.expected, actual = _a2.actual;\n _a2.previous;\n _a2.ruleName;\n var hasLabel = (0, tokens_public_1.hasTokenLabel)(expected);\n var expectedMsg = hasLabel ? \"--> \".concat((0, tokens_public_1.tokenLabel)(expected), \" <--\") : \"token of type --> \".concat(expected.name, \" <--\");\n var msg = \"Expecting \".concat(expectedMsg, \" but found --> '\").concat(actual.image, \"' <--\");\n return msg;\n },\n buildNotAllInputParsedMessage: function(_a2) {\n var firstRedundant = _a2.firstRedundant;\n _a2.ruleName;\n return \"Redundant input, expecting EOF but found: \" + firstRedundant.image;\n },\n buildNoViableAltMessage: function(_a2) {\n var expectedPathsPerAlt = _a2.expectedPathsPerAlt, actual = _a2.actual;\n _a2.previous;\n var customUserDescription = _a2.customUserDescription;\n _a2.ruleName;\n var errPrefix = \"Expecting: \";\n var actualText = (0, first_12.default)(actual).image;\n var errSuffix = \"\\nbut found: '\" + actualText + \"'\";\n if (customUserDescription) {\n return errPrefix + customUserDescription + errSuffix;\n } else {\n var allLookAheadPaths = (0, reduce_12.default)(expectedPathsPerAlt, function(result, currAltPaths) {\n return result.concat(currAltPaths);\n }, []);\n var nextValidTokenSequences = (0, map_12.default)(allLookAheadPaths, function(currPath) {\n return \"[\".concat((0, map_12.default)(currPath, function(currTokenType) {\n return (0, tokens_public_1.tokenLabel)(currTokenType);\n }).join(\", \"), \"]\");\n });\n var nextValidSequenceItems = (0, map_12.default)(nextValidTokenSequences, function(itemMsg, idx) {\n return \" \".concat(idx + 1, \". \").concat(itemMsg);\n });\n var calculatedDescription = \"one of these possible Token sequences:\\n\".concat(nextValidSequenceItems.join(\"\\n\"));\n return errPrefix + calculatedDescription + errSuffix;\n }\n },\n buildEarlyExitMessage: function(_a2) {\n var expectedIterationPaths = _a2.expectedIterationPaths, actual = _a2.actual, customUserDescription = _a2.customUserDescription;\n _a2.ruleName;\n var errPrefix = \"Expecting: \";\n var actualText = (0, first_12.default)(actual).image;\n var errSuffix = \"\\nbut found: '\" + actualText + \"'\";\n if (customUserDescription) {\n return errPrefix + customUserDescription + errSuffix;\n } else {\n var nextValidTokenSequences = (0, map_12.default)(expectedIterationPaths, function(currPath) {\n return \"[\".concat((0, map_12.default)(currPath, function(currTokenType) {\n return (0, tokens_public_1.tokenLabel)(currTokenType);\n }).join(\",\"), \"]\");\n });\n var calculatedDescription = \"expecting at least one iteration which starts with one of these possible Token sequences::\\n \" + \"<\".concat(nextValidTokenSequences.join(\" ,\"), \">\");\n return errPrefix + calculatedDescription + errSuffix;\n }\n }\n };\n Object.freeze(exports.defaultParserErrorProvider);\n exports.defaultGrammarResolverErrorProvider = {\n buildRuleNotFoundError: function(topLevelRule, undefinedRule) {\n var msg = \"Invalid grammar, reference to a rule which is not defined: ->\" + undefinedRule.nonTerminalName + \"<-\\ninside top level rule: ->\" + topLevelRule.name + \"<-\";\n return msg;\n }\n };\n exports.defaultGrammarValidatorErrorProvider = {\n buildDuplicateFoundError: function(topLevelRule, duplicateProds) {\n function getExtraProductionArgument(prod) {\n if (prod instanceof gast_12.Terminal) {\n return prod.terminalType.name;\n } else if (prod instanceof gast_12.NonTerminal) {\n return prod.nonTerminalName;\n } else {\n return \"\";\n }\n }\n var topLevelName = topLevelRule.name;\n var duplicateProd = (0, first_12.default)(duplicateProds);\n var index = duplicateProd.idx;\n var dslName = (0, gast_22.getProductionDslName)(duplicateProd);\n var extraArgument = getExtraProductionArgument(duplicateProd);\n var hasExplicitIndex = index > 0;\n var msg = \"->\".concat(dslName).concat(hasExplicitIndex ? index : \"\", \"<- \").concat(extraArgument ? \"with argument: ->\".concat(extraArgument, \"<-\") : \"\", \"\\n appears more than once (\").concat(duplicateProds.length, \" times) in the top level rule: ->\").concat(topLevelName, \"<-. \\n For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES \\n \");\n msg = msg.replace(/[ \\t]+/g, \" \");\n msg = msg.replace(/\\s\\s+/g, \"\\n\");\n return msg;\n },\n buildNamespaceConflictError: function(rule) {\n var errMsg = \"Namespace conflict found in grammar.\\n\" + \"The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <\".concat(rule.name, \">.\\n\") + \"To resolve this make sure each Terminal and Non-Terminal names are unique\\nThis is easy to accomplish by using the convention that Terminal names start with an uppercase letter\\nand Non-Terminal names start with a lower case letter.\";\n return errMsg;\n },\n buildAlternationPrefixAmbiguityError: function(options) {\n var pathMsg = (0, map_12.default)(options.prefixPath, function(currTok) {\n return (0, tokens_public_1.tokenLabel)(currTok);\n }).join(\", \");\n var occurrence = options.alternation.idx === 0 ? \"\" : options.alternation.idx;\n var errMsg = \"Ambiguous alternatives: <\".concat(options.ambiguityIndices.join(\" ,\"), \"> due to common lookahead prefix\\n\") + \"in inside <\").concat(options.topLevelRule.name, \"> Rule,\\n\") + \"<\".concat(pathMsg, \"> may appears as a prefix path in all these alternatives.\\n\") + \"See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX\\nFor Further details.\";\n return errMsg;\n },\n buildAlternationAmbiguityError: function(options) {\n var pathMsg = (0, map_12.default)(options.prefixPath, function(currtok) {\n return (0, tokens_public_1.tokenLabel)(currtok);\n }).join(\", \");\n var occurrence = options.alternation.idx === 0 ? \"\" : options.alternation.idx;\n var currMessage = \"Ambiguous Alternatives Detected: <\".concat(options.ambiguityIndices.join(\" ,\"), \"> in \") + \" inside <\".concat(options.topLevelRule.name, \"> Rule,\\n\") + \"<\".concat(pathMsg, \"> may appears as a prefix path in all these alternatives.\\n\");\n currMessage = currMessage + \"See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES\\nFor Further details.\";\n return currMessage;\n },\n buildEmptyRepetitionError: function(options) {\n var dslName = (0, gast_22.getProductionDslName)(options.repetition);\n if (options.repetition.idx !== 0) {\n dslName += options.repetition.idx;\n }\n var errMsg = \"The repetition <\".concat(dslName, \"> within Rule <\").concat(options.topLevelRule.name, \"> can never consume any tokens.\\n\") + \"This could lead to an infinite loop.\";\n return errMsg;\n },\n // TODO: remove - `errors_public` from nyc.config.js exclude\n // once this method is fully removed from this file\n buildTokenNameError: function(options) {\n return \"deprecated\";\n },\n buildEmptyAlternationError: function(options) {\n var errMsg = \"Ambiguous empty alternative: <\".concat(options.emptyChoiceIdx + 1, \">\") + \" in inside <\").concat(options.topLevelRule.name, \"> Rule.\\n\") + \"Only the last alternative may be an empty alternative.\";\n return errMsg;\n },\n buildTooManyAlternativesError: function(options) {\n var errMsg = \"An Alternation cannot have more than 256 alternatives:\\n\" + \" inside <\").concat(options.topLevelRule.name, \"> Rule.\\n has \").concat(options.alternation.definition.length + 1, \" alternatives.\");\n return errMsg;\n },\n buildLeftRecursionError: function(options) {\n var ruleName = options.topLevelRule.name;\n var pathNames = (0, map_12.default)(options.leftRecursionPath, function(currRule) {\n return currRule.name;\n });\n var leftRecursivePath = \"\".concat(ruleName, \" --> \").concat(pathNames.concat([ruleName]).join(\" --> \"));\n var errMsg = \"Left Recursion found in grammar.\\n\" + \"rule: <\".concat(ruleName, \"> can be invoked from itself (directly or indirectly)\\n\") + \"without consuming any Tokens. The grammar path that causes this is: \\n \".concat(leftRecursivePath, \"\\n\") + \" To fix this refactor your grammar to remove the left recursion.\\nsee: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.\";\n return errMsg;\n },\n // TODO: remove - `errors_public` from nyc.config.js exclude\n // once this method is fully removed from this file\n buildInvalidRuleNameError: function(options) {\n return \"deprecated\";\n },\n buildDuplicateRuleNameError: function(options) {\n var ruleName;\n if (options.topLevelRule instanceof gast_12.Rule) {\n ruleName = options.topLevelRule.name;\n } else {\n ruleName = options.topLevelRule;\n }\n var errMsg = \"Duplicate definition, rule: ->\".concat(ruleName, \"<- is already defined in the grammar: ->\").concat(options.grammarName, \"<-\");\n return errMsg;\n }\n };\n})(errors_public);\nvar gast_resolver_public = {};\nvar resolver = {};\nvar hasRequiredResolver;\nfunction requireResolver() {\n if (hasRequiredResolver)\n return resolver;\n hasRequiredResolver = 1;\n var __extends2 = commonjsGlobal && commonjsGlobal.__extends || function() {\n var extendStatics = function(d, b2) {\n extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b3) {\n d2.__proto__ = b3;\n } || function(d2, b3) {\n for (var p in b3)\n if (Object.prototype.hasOwnProperty.call(b3, p))\n d2[p] = b3[p];\n };\n return extendStatics(d, b2);\n };\n return function(d, b2) {\n if (typeof b2 !== \"function\" && b2 !== null)\n throw new TypeError(\"Class extends value \" + String(b2) + \" is not a constructor or null\");\n extendStatics(d, b2);\n function __() {\n this.constructor = d;\n }\n d.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());\n };\n }();\n var __importDefault2 = commonjsGlobal && commonjsGlobal.__importDefault || function(mod2) {\n return mod2 && mod2.__esModule ? mod2 : { \"default\": mod2 };\n };\n Object.defineProperty(resolver, \"__esModule\", { value: true });\n resolver.GastRefResolverVisitor = resolver.resolveGrammar = void 0;\n var parser_1 = requireParser();\n var forEach_12 = __importDefault2(lodash_forEach__WEBPACK_IMPORTED_MODULE_4__);\n var values_12 = __importDefault2(lodash_values__WEBPACK_IMPORTED_MODULE_5__);\n var gast_12 = api$1;\n function resolveGrammar(topLevels, errMsgProvider) {\n var refResolver = new GastRefResolverVisitor(topLevels, errMsgProvider);\n refResolver.resolveRefs();\n return refResolver.errors;\n }\n resolver.resolveGrammar = resolveGrammar;\n var GastRefResolverVisitor = (\n /** @class */\n function(_super) {\n __extends2(GastRefResolverVisitor2, _super);\n function GastRefResolverVisitor2(nameToTopRule, errMsgProvider) {\n var _this = _super.call(this) || this;\n _this.nameToTopRule = nameToTopRule;\n _this.errMsgProvider = errMsgProvider;\n _this.errors = [];\n return _this;\n }\n GastRefResolverVisitor2.prototype.resolveRefs = function() {\n var _this = this;\n (0, forEach_12.default)((0, values_12.default)(this.nameToTopRule), function(prod) {\n _this.currTopLevel = prod;\n prod.accept(_this);\n });\n };\n GastRefResolverVisitor2.prototype.visitNonTerminal = function(node) {\n var ref = this.nameToTopRule[node.nonTerminalName];\n if (!ref) {\n var msg = this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel, node);\n this.errors.push({\n message: msg,\n type: parser_1.ParserDefinitionErrorType.UNRESOLVED_SUBRULE_REF,\n ruleName: this.currTopLevel.name,\n unresolvedRefName: node.nonTerminalName\n });\n } else {\n node.referencedRule = ref;\n }\n };\n return GastRefResolverVisitor2;\n }(gast_12.GAstVisitor)\n );\n resolver.GastRefResolverVisitor = GastRefResolverVisitor;\n return resolver;\n}\nvar checks = {};\nvar lookahead = {};\nvar interpreter = {};\nvar __extends$2 = commonjsGlobal && commonjsGlobal.__extends || function() {\n var extendStatics = function(d, b2) {\n extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b3) {\n d2.__proto__ = b3;\n } || function(d2, b3) {\n for (var p in b3)\n if (Object.prototype.hasOwnProperty.call(b3, p))\n d2[p] = b3[p];\n };\n return extendStatics(d, b2);\n };\n return function(d, b2) {\n if (typeof b2 !== \"function\" && b2 !== null)\n throw new TypeError(\"Class extends value \" + String(b2) + \" is not a constructor or null\");\n extendStatics(d, b2);\n function __() {\n this.constructor = d;\n }\n d.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());\n };\n}();\nvar __importDefault$4 = commonjsGlobal && commonjsGlobal.__importDefault || function(mod2) {\n return mod2 && mod2.__esModule ? mod2 : { \"default\": mod2 };\n};\nObject.defineProperty(interpreter, \"__esModule\", { value: true });\ninterpreter.nextPossibleTokensAfter = interpreter.possiblePathsFrom = interpreter.NextTerminalAfterAtLeastOneSepWalker = interpreter.NextTerminalAfterAtLeastOneWalker = interpreter.NextTerminalAfterManySepWalker = interpreter.NextTerminalAfterManyWalker = interpreter.AbstractNextTerminalAfterProductionWalker = interpreter.NextAfterTokenWalker = interpreter.AbstractNextPossibleTokensWalker = void 0;\nvar rest_1 = rest;\nvar first_1$1 = __importDefault$4(lodash_first__WEBPACK_IMPORTED_MODULE_20__);\nvar isEmpty_1 = __importDefault$4(lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2__);\nvar dropRight_1 = __importDefault$4(lodash_dropRight__WEBPACK_IMPORTED_MODULE_37__);\nvar drop_1 = __importDefault$4(lodash_drop__WEBPACK_IMPORTED_MODULE_8__);\nvar last_1 = __importDefault$4(lodash_last__WEBPACK_IMPORTED_MODULE_33__);\nvar forEach_1 = __importDefault$4(lodash_forEach__WEBPACK_IMPORTED_MODULE_4__);\nvar clone_1 = __importDefault$4(lodash_clone__WEBPACK_IMPORTED_MODULE_7__);\nvar first_2 = first$1;\nvar gast_1$1 = api$1;\nvar AbstractNextPossibleTokensWalker = (\n /** @class */\n function(_super) {\n __extends$2(AbstractNextPossibleTokensWalker2, _super);\n function AbstractNextPossibleTokensWalker2(topProd, path) {\n var _this = _super.call(this) || this;\n _this.topProd = topProd;\n _this.path = path;\n _this.possibleTokTypes = [];\n _this.nextProductionName = \"\";\n _this.nextProductionOccurrence = 0;\n _this.found = false;\n _this.isAtEndOfPath = false;\n return _this;\n }\n AbstractNextPossibleTokensWalker2.prototype.startWalking = function() {\n this.found = false;\n if (this.path.ruleStack[0] !== this.topProd.name) {\n throw Error(\"The path does not start with the walker's top Rule!\");\n }\n this.ruleStack = (0, clone_1.default)(this.path.ruleStack).reverse();\n this.occurrenceStack = (0, clone_1.default)(this.path.occurrenceStack).reverse();\n this.ruleStack.pop();\n this.occurrenceStack.pop();\n this.updateExpectedNext();\n this.walk(this.topProd);\n return this.possibleTokTypes;\n };\n AbstractNextPossibleTokensWalker2.prototype.walk = function(prod, prevRest) {\n if (prevRest === void 0) {\n prevRest = [];\n }\n if (!this.found) {\n _super.prototype.walk.call(this, prod, prevRest);\n }\n };\n AbstractNextPossibleTokensWalker2.prototype.walkProdRef = function(refProd, currRest, prevRest) {\n if (refProd.referencedRule.name === this.nextProductionName && refProd.idx === this.nextProductionOccurrence) {\n var fullRest = currRest.concat(prevRest);\n this.updateExpectedNext();\n this.walk(refProd.referencedRule, fullRest);\n }\n };\n AbstractNextPossibleTokensWalker2.prototype.updateExpectedNext = function() {\n if ((0, isEmpty_1.default)(this.ruleStack)) {\n this.nextProductionName = \"\";\n this.nextProductionOccurrence = 0;\n this.isAtEndOfPath = true;\n } else {\n this.nextProductionName = this.ruleStack.pop();\n this.nextProductionOccurrence = this.occurrenceStack.pop();\n }\n };\n return AbstractNextPossibleTokensWalker2;\n }(rest_1.RestWalker)\n);\ninterpreter.AbstractNextPossibleTokensWalker = AbstractNextPossibleTokensWalker;\nvar NextAfterTokenWalker = (\n /** @class */\n function(_super) {\n __extends$2(NextAfterTokenWalker2, _super);\n function NextAfterTokenWalker2(topProd, path) {\n var _this = _super.call(this, topProd, path) || this;\n _this.path = path;\n _this.nextTerminalName = \"\";\n _this.nextTerminalOccurrence = 0;\n _this.nextTerminalName = _this.path.lastTok.name;\n _this.nextTerminalOccurrence = _this.path.lastTokOccurrence;\n return _this;\n }\n NextAfterTokenWalker2.prototype.walkTerminal = function(terminal, currRest, prevRest) {\n if (this.isAtEndOfPath && terminal.terminalType.name === this.nextTerminalName && terminal.idx === this.nextTerminalOccurrence && !this.found) {\n var fullRest = currRest.concat(prevRest);\n var restProd = new gast_1$1.Alternative({ definition: fullRest });\n this.possibleTokTypes = (0, first_2.first)(restProd);\n this.found = true;\n }\n };\n return NextAfterTokenWalker2;\n }(AbstractNextPossibleTokensWalker)\n);\ninterpreter.NextAfterTokenWalker = NextAfterTokenWalker;\nvar AbstractNextTerminalAfterProductionWalker = (\n /** @class */\n function(_super) {\n __extends$2(AbstractNextTerminalAfterProductionWalker2, _super);\n function AbstractNextTerminalAfterProductionWalker2(topRule, occurrence) {\n var _this = _super.call(this) || this;\n _this.topRule = topRule;\n _this.occurrence = occurrence;\n _this.result = {\n token: void 0,\n occurrence: void 0,\n isEndOfRule: void 0\n };\n return _this;\n }\n AbstractNextTerminalAfterProductionWalker2.prototype.startWalking = function() {\n this.walk(this.topRule);\n return this.result;\n };\n return AbstractNextTerminalAfterProductionWalker2;\n }(rest_1.RestWalker)\n);\ninterpreter.AbstractNextTerminalAfterProductionWalker = AbstractNextTerminalAfterProductionWalker;\nvar NextTerminalAfterManyWalker = (\n /** @class */\n function(_super) {\n __extends$2(NextTerminalAfterManyWalker2, _super);\n function NextTerminalAfterManyWalker2() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n NextTerminalAfterManyWalker2.prototype.walkMany = function(manyProd, currRest, prevRest) {\n if (manyProd.idx === this.occurrence) {\n var firstAfterMany = (0, first_1$1.default)(currRest.concat(prevRest));\n this.result.isEndOfRule = firstAfterMany === void 0;\n if (firstAfterMany instanceof gast_1$1.Terminal) {\n this.result.token = firstAfterMany.terminalType;\n this.result.occurrence = firstAfterMany.idx;\n }\n } else {\n _super.prototype.walkMany.call(this, manyProd, currRest, prevRest);\n }\n };\n return NextTerminalAfterManyWalker2;\n }(AbstractNextTerminalAfterProductionWalker)\n);\ninterpreter.NextTerminalAfterManyWalker = NextTerminalAfterManyWalker;\nvar NextTerminalAfterManySepWalker = (\n /** @class */\n function(_super) {\n __extends$2(NextTerminalAfterManySepWalker2, _super);\n function NextTerminalAfterManySepWalker2() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n NextTerminalAfterManySepWalker2.prototype.walkManySep = function(manySepProd, currRest, prevRest) {\n if (manySepProd.idx === this.occurrence) {\n var firstAfterManySep = (0, first_1$1.default)(currRest.concat(prevRest));\n this.result.isEndOfRule = firstAfterManySep === void 0;\n if (firstAfterManySep instanceof gast_1$1.Terminal) {\n this.result.token = firstAfterManySep.terminalType;\n this.result.occurrence = firstAfterManySep.idx;\n }\n } else {\n _super.prototype.walkManySep.call(this, manySepProd, currRest, prevRest);\n }\n };\n return NextTerminalAfterManySepWalker2;\n }(AbstractNextTerminalAfterProductionWalker)\n);\ninterpreter.NextTerminalAfterManySepWalker = NextTerminalAfterManySepWalker;\nvar NextTerminalAfterAtLeastOneWalker = (\n /** @class */\n function(_super) {\n __extends$2(NextTerminalAfterAtLeastOneWalker2, _super);\n function NextTerminalAfterAtLeastOneWalker2() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n NextTerminalAfterAtLeastOneWalker2.prototype.walkAtLeastOne = function(atLeastOneProd, currRest, prevRest) {\n if (atLeastOneProd.idx === this.occurrence) {\n var firstAfterAtLeastOne = (0, first_1$1.default)(currRest.concat(prevRest));\n this.result.isEndOfRule = firstAfterAtLeastOne === void 0;\n if (firstAfterAtLeastOne instanceof gast_1$1.Terminal) {\n this.result.token = firstAfterAtLeastOne.terminalType;\n this.result.occurrence = firstAfterAtLeastOne.idx;\n }\n } else {\n _super.prototype.walkAtLeastOne.call(this, atLeastOneProd, currRest, prevRest);\n }\n };\n return NextTerminalAfterAtLeastOneWalker2;\n }(AbstractNextTerminalAfterProductionWalker)\n);\ninterpreter.NextTerminalAfterAtLeastOneWalker = NextTerminalAfterAtLeastOneWalker;\nvar NextTerminalAfterAtLeastOneSepWalker = (\n /** @class */\n function(_super) {\n __extends$2(NextTerminalAfterAtLeastOneSepWalker2, _super);\n function NextTerminalAfterAtLeastOneSepWalker2() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n NextTerminalAfterAtLeastOneSepWalker2.prototype.walkAtLeastOneSep = function(atleastOneSepProd, currRest, prevRest) {\n if (atleastOneSepProd.idx === this.occurrence) {\n var firstAfterfirstAfterAtLeastOneSep = (0, first_1$1.default)(currRest.concat(prevRest));\n this.result.isEndOfRule = firstAfterfirstAfterAtLeastOneSep === void 0;\n if (firstAfterfirstAfterAtLeastOneSep instanceof gast_1$1.Terminal) {\n this.result.token = firstAfterfirstAfterAtLeastOneSep.terminalType;\n this.result.occurrence = firstAfterfirstAfterAtLeastOneSep.idx;\n }\n } else {\n _super.prototype.walkAtLeastOneSep.call(this, atleastOneSepProd, currRest, prevRest);\n }\n };\n return NextTerminalAfterAtLeastOneSepWalker2;\n }(AbstractNextTerminalAfterProductionWalker)\n);\ninterpreter.NextTerminalAfterAtLeastOneSepWalker = NextTerminalAfterAtLeastOneSepWalker;\nfunction possiblePathsFrom(targetDef, maxLength, currPath) {\n if (currPath === void 0) {\n currPath = [];\n }\n currPath = (0, clone_1.default)(currPath);\n var result = [];\n var i2 = 0;\n function remainingPathWith(nextDef) {\n return nextDef.concat((0, drop_1.default)(targetDef, i2 + 1));\n }\n function getAlternativesForProd(definition) {\n var alternatives = possiblePathsFrom(remainingPathWith(definition), maxLength, currPath);\n return result.concat(alternatives);\n }\n while (currPath.length < maxLength && i2 < targetDef.length) {\n var prod = targetDef[i2];\n if (prod instanceof gast_1$1.Alternative) {\n return getAlternativesForProd(prod.definition);\n } else if (prod instanceof gast_1$1.NonTerminal) {\n return getAlternativesForProd(prod.definition);\n } else if (prod instanceof gast_1$1.Option) {\n result = getAlternativesForProd(prod.definition);\n } else if (prod instanceof gast_1$1.RepetitionMandatory) {\n var newDef = prod.definition.concat([\n new gast_1$1.Repetition({\n definition: prod.definition\n })\n ]);\n return getAlternativesForProd(newDef);\n } else if (prod instanceof gast_1$1.RepetitionMandatoryWithSeparator) {\n var newDef = [\n new gast_1$1.Alternative({ definition: prod.definition }),\n new gast_1$1.Repetition({\n definition: [new gast_1$1.Terminal({ terminalType: prod.separator })].concat(prod.definition)\n })\n ];\n return getAlternativesForProd(newDef);\n } else if (prod instanceof gast_1$1.RepetitionWithSeparator) {\n var newDef = prod.definition.concat([\n new gast_1$1.Repetition({\n definition: [new gast_1$1.Terminal({ terminalType: prod.separator })].concat(prod.definition)\n })\n ]);\n result = getAlternativesForProd(newDef);\n } else if (prod instanceof gast_1$1.Repetition) {\n var newDef = prod.definition.concat([\n new gast_1$1.Repetition({\n definition: prod.definition\n })\n ]);\n result = getAlternativesForProd(newDef);\n } else if (prod instanceof gast_1$1.Alternation) {\n (0, forEach_1.default)(prod.definition, function(currAlt) {\n if ((0, isEmpty_1.default)(currAlt.definition) === false) {\n result = getAlternativesForProd(currAlt.definition);\n }\n });\n return result;\n } else if (prod instanceof gast_1$1.Terminal) {\n currPath.push(prod.terminalType);\n } else {\n throw Error(\"non exhaustive match\");\n }\n i2++;\n }\n result.push({\n partialPath: currPath,\n suffixDef: (0, drop_1.default)(targetDef, i2)\n });\n return result;\n}\ninterpreter.possiblePathsFrom = possiblePathsFrom;\nfunction nextPossibleTokensAfter(initialDef, tokenVector, tokMatcher, maxLookAhead) {\n var EXIT_NON_TERMINAL = \"EXIT_NONE_TERMINAL\";\n var EXIT_NON_TERMINAL_ARR = [EXIT_NON_TERMINAL];\n var EXIT_ALTERNATIVE = \"EXIT_ALTERNATIVE\";\n var foundCompletePath = false;\n var tokenVectorLength = tokenVector.length;\n var minimalAlternativesIndex = tokenVectorLength - maxLookAhead - 1;\n var result = [];\n var possiblePaths = [];\n possiblePaths.push({\n idx: -1,\n def: initialDef,\n ruleStack: [],\n occurrenceStack: []\n });\n while (!(0, isEmpty_1.default)(possiblePaths)) {\n var currPath = possiblePaths.pop();\n if (currPath === EXIT_ALTERNATIVE) {\n if (foundCompletePath && (0, last_1.default)(possiblePaths).idx <= minimalAlternativesIndex) {\n possiblePaths.pop();\n }\n continue;\n }\n var currDef = currPath.def;\n var currIdx = currPath.idx;\n var currRuleStack = currPath.ruleStack;\n var currOccurrenceStack = currPath.occurrenceStack;\n if ((0, isEmpty_1.default)(currDef)) {\n continue;\n }\n var prod = currDef[0];\n if (prod === EXIT_NON_TERMINAL) {\n var nextPath = {\n idx: currIdx,\n def: (0, drop_1.default)(currDef),\n ruleStack: (0, dropRight_1.default)(currRuleStack),\n occurrenceStack: (0, dropRight_1.default)(currOccurrenceStack)\n };\n possiblePaths.push(nextPath);\n } else if (prod instanceof gast_1$1.Terminal) {\n if (currIdx < tokenVectorLength - 1) {\n var nextIdx = currIdx + 1;\n var actualToken = tokenVector[nextIdx];\n if (tokMatcher(actualToken, prod.terminalType)) {\n var nextPath = {\n idx: nextIdx,\n def: (0, drop_1.default)(currDef),\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack\n };\n possiblePaths.push(nextPath);\n }\n } else if (currIdx === tokenVectorLength - 1) {\n result.push({\n nextTokenType: prod.terminalType,\n nextTokenOccurrence: prod.idx,\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack\n });\n foundCompletePath = true;\n } else {\n throw Error(\"non exhaustive match\");\n }\n } else if (prod instanceof gast_1$1.NonTerminal) {\n var newRuleStack = (0, clone_1.default)(currRuleStack);\n newRuleStack.push(prod.nonTerminalName);\n var newOccurrenceStack = (0, clone_1.default)(currOccurrenceStack);\n newOccurrenceStack.push(prod.idx);\n var nextPath = {\n idx: currIdx,\n def: prod.definition.concat(EXIT_NON_TERMINAL_ARR, (0, drop_1.default)(currDef)),\n ruleStack: newRuleStack,\n occurrenceStack: newOccurrenceStack\n };\n possiblePaths.push(nextPath);\n } else if (prod instanceof gast_1$1.Option) {\n var nextPathWithout = {\n idx: currIdx,\n def: (0, drop_1.default)(currDef),\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack\n };\n possiblePaths.push(nextPathWithout);\n possiblePaths.push(EXIT_ALTERNATIVE);\n var nextPathWith = {\n idx: currIdx,\n def: prod.definition.concat((0, drop_1.default)(currDef)),\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack\n };\n possiblePaths.push(nextPathWith);\n } else if (prod instanceof gast_1$1.RepetitionMandatory) {\n var secondIteration = new gast_1$1.Repetition({\n definition: prod.definition,\n idx: prod.idx\n });\n var nextDef = prod.definition.concat([secondIteration], (0, drop_1.default)(currDef));\n var nextPath = {\n idx: currIdx,\n def: nextDef,\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack\n };\n possiblePaths.push(nextPath);\n } else if (prod instanceof gast_1$1.RepetitionMandatoryWithSeparator) {\n var separatorGast = new gast_1$1.Terminal({\n terminalType: prod.separator\n });\n var secondIteration = new gast_1$1.Repetition({\n definition: [separatorGast].concat(prod.definition),\n idx: prod.idx\n });\n var nextDef = prod.definition.concat([secondIteration], (0, drop_1.default)(currDef));\n var nextPath = {\n idx: currIdx,\n def: nextDef,\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack\n };\n possiblePaths.push(nextPath);\n } else if (prod instanceof gast_1$1.RepetitionWithSeparator) {\n var nextPathWithout = {\n idx: currIdx,\n def: (0, drop_1.default)(currDef),\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack\n };\n possiblePaths.push(nextPathWithout);\n possiblePaths.push(EXIT_ALTERNATIVE);\n var separatorGast = new gast_1$1.Terminal({\n terminalType: prod.separator\n });\n var nthRepetition = new gast_1$1.Repetition({\n definition: [separatorGast].concat(prod.definition),\n idx: prod.idx\n });\n var nextDef = prod.definition.concat([nthRepetition], (0, drop_1.default)(currDef));\n var nextPathWith = {\n idx: currIdx,\n def: nextDef,\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack\n };\n possiblePaths.push(nextPathWith);\n } else if (prod instanceof gast_1$1.Repetition) {\n var nextPathWithout = {\n idx: currIdx,\n def: (0, drop_1.default)(currDef),\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack\n };\n possiblePaths.push(nextPathWithout);\n possiblePaths.push(EXIT_ALTERNATIVE);\n var nthRepetition = new gast_1$1.Repetition({\n definition: prod.definition,\n idx: prod.idx\n });\n var nextDef = prod.definition.concat([nthRepetition], (0, drop_1.default)(currDef));\n var nextPathWith = {\n idx: currIdx,\n def: nextDef,\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack\n };\n possiblePaths.push(nextPathWith);\n } else if (prod instanceof gast_1$1.Alternation) {\n for (var i2 = prod.definition.length - 1; i2 >= 0; i2--) {\n var currAlt = prod.definition[i2];\n var currAltPath = {\n idx: currIdx,\n def: currAlt.definition.concat((0, drop_1.default)(currDef)),\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack\n };\n possiblePaths.push(currAltPath);\n possiblePaths.push(EXIT_ALTERNATIVE);\n }\n } else if (prod instanceof gast_1$1.Alternative) {\n possiblePaths.push({\n idx: currIdx,\n def: prod.definition.concat((0, drop_1.default)(currDef)),\n ruleStack: currRuleStack,\n occurrenceStack: currOccurrenceStack\n });\n } else if (prod instanceof gast_1$1.Rule) {\n possiblePaths.push(expandTopLevelRule(prod, currIdx, currRuleStack, currOccurrenceStack));\n } else {\n throw Error(\"non exhaustive match\");\n }\n }\n return result;\n}\ninterpreter.nextPossibleTokensAfter = nextPossibleTokensAfter;\nfunction expandTopLevelRule(topRule, currIdx, currRuleStack, currOccurrenceStack) {\n var newRuleStack = (0, clone_1.default)(currRuleStack);\n newRuleStack.push(topRule.name);\n var newCurrOccurrenceStack = (0, clone_1.default)(currOccurrenceStack);\n newCurrOccurrenceStack.push(1);\n return {\n idx: currIdx,\n def: topRule.definition,\n ruleStack: newRuleStack,\n occurrenceStack: newCurrOccurrenceStack\n };\n}\n(function(exports) {\n var __extends2 = commonjsGlobal && commonjsGlobal.__extends || function() {\n var extendStatics = function(d, b2) {\n extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b3) {\n d2.__proto__ = b3;\n } || function(d2, b3) {\n for (var p in b3)\n if (Object.prototype.hasOwnProperty.call(b3, p))\n d2[p] = b3[p];\n };\n return extendStatics(d, b2);\n };\n return function(d, b2) {\n if (typeof b2 !== \"function\" && b2 !== null)\n throw new TypeError(\"Class extends value \" + String(b2) + \" is not a constructor or null\");\n extendStatics(d, b2);\n function __() {\n this.constructor = d;\n }\n d.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());\n };\n }();\n var __importDefault2 = commonjsGlobal && commonjsGlobal.__importDefault || function(mod2) {\n return mod2 && mod2.__esModule ? mod2 : { \"default\": mod2 };\n };\n Object.defineProperty(exports, \"__esModule\", { value: true });\n exports.areTokenCategoriesNotUsed = exports.isStrictPrefixOfPath = exports.containsPath = exports.getLookaheadPathsForOptionalProd = exports.getLookaheadPathsForOr = exports.lookAheadSequenceFromAlternatives = exports.buildSingleAlternativeLookaheadFunction = exports.buildAlternativesLookAheadFunc = exports.buildLookaheadFuncForOptionalProd = exports.buildLookaheadFuncForOr = exports.getLookaheadPaths = exports.getProdType = exports.PROD_TYPE = void 0;\n var isEmpty_12 = __importDefault2(lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2__);\n var flatten_12 = __importDefault2(lodash_flatten__WEBPACK_IMPORTED_MODULE_16__);\n var every_12 = __importDefault2(lodash_every__WEBPACK_IMPORTED_MODULE_14__);\n var map_12 = __importDefault2(lodash_map__WEBPACK_IMPORTED_MODULE_3__);\n var forEach_12 = __importDefault2(lodash_forEach__WEBPACK_IMPORTED_MODULE_4__);\n var has_1 = __importDefault2(lodash_has__WEBPACK_IMPORTED_MODULE_6__);\n var reduce_12 = __importDefault2(lodash_reduce__WEBPACK_IMPORTED_MODULE_31__);\n var interpreter_12 = interpreter;\n var rest_12 = rest;\n var tokens_1 = tokens;\n var gast_12 = api$1;\n var gast_22 = api$1;\n var PROD_TYPE;\n (function(PROD_TYPE2) {\n PROD_TYPE2[PROD_TYPE2[\"OPTION\"] = 0] = \"OPTION\";\n PROD_TYPE2[PROD_TYPE2[\"REPETITION\"] = 1] = \"REPETITION\";\n PROD_TYPE2[PROD_TYPE2[\"REPETITION_MANDATORY\"] = 2] = \"REPETITION_MANDATORY\";\n PROD_TYPE2[PROD_TYPE2[\"REPETITION_MANDATORY_WITH_SEPARATOR\"] = 3] = \"REPETITION_MANDATORY_WITH_SEPARATOR\";\n PROD_TYPE2[PROD_TYPE2[\"REPETITION_WITH_SEPARATOR\"] = 4] = \"REPETITION_WITH_SEPARATOR\";\n PROD_TYPE2[PROD_TYPE2[\"ALTERNATION\"] = 5] = \"ALTERNATION\";\n })(PROD_TYPE = exports.PROD_TYPE || (exports.PROD_TYPE = {}));\n function getProdType(prod) {\n if (prod instanceof gast_12.Option || prod === \"Option\") {\n return PROD_TYPE.OPTION;\n } else if (prod instanceof gast_12.Repetition || prod === \"Repetition\") {\n return PROD_TYPE.REPETITION;\n } else if (prod instanceof gast_12.RepetitionMandatory || prod === \"RepetitionMandatory\") {\n return PROD_TYPE.REPETITION_MANDATORY;\n } else if (prod instanceof gast_12.RepetitionMandatoryWithSeparator || prod === \"RepetitionMandatoryWithSeparator\") {\n return PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR;\n } else if (prod instanceof gast_12.RepetitionWithSeparator || prod === \"RepetitionWithSeparator\") {\n return PROD_TYPE.REPETITION_WITH_SEPARATOR;\n } else if (prod instanceof gast_12.Alternation || prod === \"Alternation\") {\n return PROD_TYPE.ALTERNATION;\n } else {\n throw Error(\"non exhaustive match\");\n }\n }\n exports.getProdType = getProdType;\n function getLookaheadPaths(options) {\n var occurrence = options.occurrence, rule = options.rule, prodType = options.prodType, maxLookahead = options.maxLookahead;\n var type = getProdType(prodType);\n if (type === PROD_TYPE.ALTERNATION) {\n return getLookaheadPathsForOr(occurrence, rule, maxLookahead);\n } else {\n return getLookaheadPathsForOptionalProd(occurrence, rule, type, maxLookahead);\n }\n }\n exports.getLookaheadPaths = getLookaheadPaths;\n function buildLookaheadFuncForOr(occurrence, ruleGrammar, maxLookahead, hasPredicates, dynamicTokensEnabled, laFuncBuilder) {\n var lookAheadPaths = getLookaheadPathsForOr(occurrence, ruleGrammar, maxLookahead);\n var tokenMatcher = areTokenCategoriesNotUsed(lookAheadPaths) ? tokens_1.tokenStructuredMatcherNoCategories : tokens_1.tokenStructuredMatcher;\n return laFuncBuilder(lookAheadPaths, hasPredicates, tokenMatcher, dynamicTokensEnabled);\n }\n exports.buildLookaheadFuncForOr = buildLookaheadFuncForOr;\n function buildLookaheadFuncForOptionalProd(occurrence, ruleGrammar, k, dynamicTokensEnabled, prodType, lookaheadBuilder) {\n var lookAheadPaths = getLookaheadPathsForOptionalProd(occurrence, ruleGrammar, prodType, k);\n var tokenMatcher = areTokenCategoriesNotUsed(lookAheadPaths) ? tokens_1.tokenStructuredMatcherNoCategories : tokens_1.tokenStructuredMatcher;\n return lookaheadBuilder(lookAheadPaths[0], tokenMatcher, dynamicTokensEnabled);\n }\n exports.buildLookaheadFuncForOptionalProd = buildLookaheadFuncForOptionalProd;\n function buildAlternativesLookAheadFunc(alts, hasPredicates, tokenMatcher, dynamicTokensEnabled) {\n var numOfAlts = alts.length;\n var areAllOneTokenLookahead = (0, every_12.default)(alts, function(currAlt) {\n return (0, every_12.default)(currAlt, function(currPath) {\n return currPath.length === 1;\n });\n });\n if (hasPredicates) {\n return function(orAlts) {\n var predicates = (0, map_12.default)(orAlts, function(currAlt2) {\n return currAlt2.GATE;\n });\n for (var t2 = 0; t2 < numOfAlts; t2++) {\n var currAlt = alts[t2];\n var currNumOfPaths = currAlt.length;\n var currPredicate = predicates[t2];\n if (currPredicate !== void 0 && currPredicate.call(this) === false) {\n continue;\n }\n nextPath:\n for (var j = 0; j < currNumOfPaths; j++) {\n var currPath = currAlt[j];\n var currPathLength = currPath.length;\n for (var i2 = 0; i2 < currPathLength; i2++) {\n var nextToken = this.LA(i2 + 1);\n if (tokenMatcher(nextToken, currPath[i2]) === false) {\n continue nextPath;\n }\n }\n return t2;\n }\n }\n return void 0;\n };\n } else if (areAllOneTokenLookahead && !dynamicTokensEnabled) {\n var singleTokenAlts = (0, map_12.default)(alts, function(currAlt) {\n return (0, flatten_12.default)(currAlt);\n });\n var choiceToAlt_1 = (0, reduce_12.default)(singleTokenAlts, function(result, currAlt, idx) {\n (0, forEach_12.default)(currAlt, function(currTokType) {\n if (!(0, has_1.default)(result, currTokType.tokenTypeIdx)) {\n result[currTokType.tokenTypeIdx] = idx;\n }\n (0, forEach_12.default)(currTokType.categoryMatches, function(currExtendingType) {\n if (!(0, has_1.default)(result, currExtendingType)) {\n result[currExtendingType] = idx;\n }\n });\n });\n return result;\n }, {});\n return function() {\n var nextToken = this.LA(1);\n return choiceToAlt_1[nextToken.tokenTypeIdx];\n };\n } else {\n return function() {\n for (var t2 = 0; t2 < numOfAlts; t2++) {\n var currAlt = alts[t2];\n var currNumOfPaths = currAlt.length;\n nextPath:\n for (var j = 0; j < currNumOfPaths; j++) {\n var currPath = currAlt[j];\n var currPathLength = currPath.length;\n for (var i2 = 0; i2 < currPathLength; i2++) {\n var nextToken = this.LA(i2 + 1);\n if (tokenMatcher(nextToken, currPath[i2]) === false) {\n continue nextPath;\n }\n }\n return t2;\n }\n }\n return void 0;\n };\n }\n }\n exports.buildAlternativesLookAheadFunc = buildAlternativesLookAheadFunc;\n function buildSingleAlternativeLookaheadFunction(alt, tokenMatcher, dynamicTokensEnabled) {\n var areAllOneTokenLookahead = (0, every_12.default)(alt, function(currPath) {\n return currPath.length === 1;\n });\n var numOfPaths = alt.length;\n if (areAllOneTokenLookahead && !dynamicTokensEnabled) {\n var singleTokensTypes = (0, flatten_12.default)(alt);\n if (singleTokensTypes.length === 1 && (0, isEmpty_12.default)(singleTokensTypes[0].categoryMatches)) {\n var expectedTokenType = singleTokensTypes[0];\n var expectedTokenUniqueKey_1 = expectedTokenType.tokenTypeIdx;\n return function() {\n return this.LA(1).tokenTypeIdx === expectedTokenUniqueKey_1;\n };\n } else {\n var choiceToAlt_2 = (0, reduce_12.default)(singleTokensTypes, function(result, currTokType, idx) {\n result[currTokType.tokenTypeIdx] = true;\n (0, forEach_12.default)(currTokType.categoryMatches, function(currExtendingType) {\n result[currExtendingType] = true;\n });\n return result;\n }, []);\n return function() {\n var nextToken = this.LA(1);\n return choiceToAlt_2[nextToken.tokenTypeIdx] === true;\n };\n }\n } else {\n return function() {\n nextPath:\n for (var j = 0; j < numOfPaths; j++) {\n var currPath = alt[j];\n var currPathLength = currPath.length;\n for (var i2 = 0; i2 < currPathLength; i2++) {\n var nextToken = this.LA(i2 + 1);\n if (tokenMatcher(nextToken, currPath[i2]) === false) {\n continue nextPath;\n }\n }\n return true;\n }\n return false;\n };\n }\n }\n exports.buildSingleAlternativeLookaheadFunction = buildSingleAlternativeLookaheadFunction;\n var RestDefinitionFinderWalker = (\n /** @class */\n function(_super) {\n __extends2(RestDefinitionFinderWalker2, _super);\n function RestDefinitionFinderWalker2(topProd, targetOccurrence, targetProdType) {\n var _this = _super.call(this) || this;\n _this.topProd = topProd;\n _this.targetOccurrence = targetOccurrence;\n _this.targetProdType = targetProdType;\n return _this;\n }\n RestDefinitionFinderWalker2.prototype.startWalking = function() {\n this.walk(this.topProd);\n return this.restDef;\n };\n RestDefinitionFinderWalker2.prototype.checkIsTarget = function(node, expectedProdType, currRest, prevRest) {\n if (node.idx === this.targetOccurrence && this.targetProdType === expectedProdType) {\n this.restDef = currRest.concat(prevRest);\n return true;\n }\n return false;\n };\n RestDefinitionFinderWalker2.prototype.walkOption = function(optionProd, currRest, prevRest) {\n if (!this.checkIsTarget(optionProd, PROD_TYPE.OPTION, currRest, prevRest)) {\n _super.prototype.walkOption.call(this, optionProd, currRest, prevRest);\n }\n };\n RestDefinitionFinderWalker2.prototype.walkAtLeastOne = function(atLeastOneProd, currRest, prevRest) {\n if (!this.checkIsTarget(atLeastOneProd, PROD_TYPE.REPETITION_MANDATORY, currRest, prevRest)) {\n _super.prototype.walkOption.call(this, atLeastOneProd, currRest, prevRest);\n }\n };\n RestDefinitionFinderWalker2.prototype.walkAtLeastOneSep = function(atLeastOneSepProd, currRest, prevRest) {\n if (!this.checkIsTarget(atLeastOneSepProd, PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR, currRest, prevRest)) {\n _super.prototype.walkOption.call(this, atLeastOneSepProd, currRest, prevRest);\n }\n };\n RestDefinitionFinderWalker2.prototype.walkMany = function(manyProd, currRest, prevRest) {\n if (!this.checkIsTarget(manyProd, PROD_TYPE.REPETITION, currRest, prevRest)) {\n _super.prototype.walkOption.call(this, manyProd, currRest, prevRest);\n }\n };\n RestDefinitionFinderWalker2.prototype.walkManySep = function(manySepProd, currRest, prevRest) {\n if (!this.checkIsTarget(manySepProd, PROD_TYPE.REPETITION_WITH_SEPARATOR, currRest, prevRest)) {\n _super.prototype.walkOption.call(this, manySepProd, currRest, prevRest);\n }\n };\n return RestDefinitionFinderWalker2;\n }(rest_12.RestWalker)\n );\n var InsideDefinitionFinderVisitor = (\n /** @class */\n function(_super) {\n __extends2(InsideDefinitionFinderVisitor2, _super);\n function InsideDefinitionFinderVisitor2(targetOccurrence, targetProdType, targetRef) {\n var _this = _super.call(this) || this;\n _this.targetOccurrence = targetOccurrence;\n _this.targetProdType = targetProdType;\n _this.targetRef = targetRef;\n _this.result = [];\n return _this;\n }\n InsideDefinitionFinderVisitor2.prototype.checkIsTarget = function(node, expectedProdName) {\n if (node.idx === this.targetOccurrence && this.targetProdType === expectedProdName && (this.targetRef === void 0 || node === this.targetRef)) {\n this.result = node.definition;\n }\n };\n InsideDefinitionFinderVisitor2.prototype.visitOption = function(node) {\n this.checkIsTarget(node, PROD_TYPE.OPTION);\n };\n InsideDefinitionFinderVisitor2.prototype.visitRepetition = function(node) {\n this.checkIsTarget(node, PROD_TYPE.REPETITION);\n };\n InsideDefinitionFinderVisitor2.prototype.visitRepetitionMandatory = function(node) {\n this.checkIsTarget(node, PROD_TYPE.REPETITION_MANDATORY);\n };\n InsideDefinitionFinderVisitor2.prototype.visitRepetitionMandatoryWithSeparator = function(node) {\n this.checkIsTarget(node, PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR);\n };\n InsideDefinitionFinderVisitor2.prototype.visitRepetitionWithSeparator = function(node) {\n this.checkIsTarget(node, PROD_TYPE.REPETITION_WITH_SEPARATOR);\n };\n InsideDefinitionFinderVisitor2.prototype.visitAlternation = function(node) {\n this.checkIsTarget(node, PROD_TYPE.ALTERNATION);\n };\n return InsideDefinitionFinderVisitor2;\n }(gast_22.GAstVisitor)\n );\n function initializeArrayOfArrays(size2) {\n var result = new Array(size2);\n for (var i2 = 0; i2 < size2; i2++) {\n result[i2] = [];\n }\n return result;\n }\n function pathToHashKeys(path) {\n var keys2 = [\"\"];\n for (var i2 = 0; i2 < path.length; i2++) {\n var tokType = path[i2];\n var longerKeys = [];\n for (var j = 0; j < keys2.length; j++) {\n var currShorterKey = keys2[j];\n longerKeys.push(currShorterKey + \"_\" + tokType.tokenTypeIdx);\n for (var t2 = 0; t2 < tokType.categoryMatches.length; t2++) {\n var categoriesKeySuffix = \"_\" + tokType.categoryMatches[t2];\n longerKeys.push(currShorterKey + categoriesKeySuffix);\n }\n }\n keys2 = longerKeys;\n }\n return keys2;\n }\n function isUniquePrefixHash(altKnownPathsKeys, searchPathKeys, idx) {\n for (var currAltIdx = 0; currAltIdx < altKnownPathsKeys.length; currAltIdx++) {\n if (currAltIdx === idx) {\n continue;\n }\n var otherAltKnownPathsKeys = altKnownPathsKeys[currAltIdx];\n for (var searchIdx = 0; searchIdx < searchPathKeys.length; searchIdx++) {\n var searchKey = searchPathKeys[searchIdx];\n if (otherAltKnownPathsKeys[searchKey] === true) {\n return false;\n }\n }\n }\n return true;\n }\n function lookAheadSequenceFromAlternatives(altsDefs, k) {\n var partialAlts = (0, map_12.default)(altsDefs, function(currAlt) {\n return (0, interpreter_12.possiblePathsFrom)([currAlt], 1);\n });\n var finalResult = initializeArrayOfArrays(partialAlts.length);\n var altsHashes = (0, map_12.default)(partialAlts, function(currAltPaths) {\n var dict = {};\n (0, forEach_12.default)(currAltPaths, function(item) {\n var keys2 = pathToHashKeys(item.partialPath);\n (0, forEach_12.default)(keys2, function(currKey) {\n dict[currKey] = true;\n });\n });\n return dict;\n });\n var newData = partialAlts;\n for (var pathLength = 1; pathLength <= k; pathLength++) {\n var currDataset = newData;\n newData = initializeArrayOfArrays(currDataset.length);\n var _loop_1 = function(altIdx2) {\n var currAltPathsAndSuffixes = currDataset[altIdx2];\n for (var currPathIdx = 0; currPathIdx < currAltPathsAndSuffixes.length; currPathIdx++) {\n var currPathPrefix = currAltPathsAndSuffixes[currPathIdx].partialPath;\n var suffixDef = currAltPathsAndSuffixes[currPathIdx].suffixDef;\n var prefixKeys = pathToHashKeys(currPathPrefix);\n var isUnique = isUniquePrefixHash(altsHashes, prefixKeys, altIdx2);\n if (isUnique || (0, isEmpty_12.default)(suffixDef) || currPathPrefix.length === k) {\n var currAltResult = finalResult[altIdx2];\n if (containsPath(currAltResult, currPathPrefix) === false) {\n currAltResult.push(currPathPrefix);\n for (var j = 0; j < prefixKeys.length; j++) {\n var currKey = prefixKeys[j];\n altsHashes[altIdx2][currKey] = true;\n }\n }\n } else {\n var newPartialPathsAndSuffixes = (0, interpreter_12.possiblePathsFrom)(suffixDef, pathLength + 1, currPathPrefix);\n newData[altIdx2] = newData[altIdx2].concat(newPartialPathsAndSuffixes);\n (0, forEach_12.default)(newPartialPathsAndSuffixes, function(item) {\n var prefixKeys2 = pathToHashKeys(item.partialPath);\n (0, forEach_12.default)(prefixKeys2, function(key) {\n altsHashes[altIdx2][key] = true;\n });\n });\n }\n }\n };\n for (var altIdx = 0; altIdx < currDataset.length; altIdx++) {\n _loop_1(altIdx);\n }\n }\n return finalResult;\n }\n exports.lookAheadSequenceFromAlternatives = lookAheadSequenceFromAlternatives;\n function getLookaheadPathsForOr(occurrence, ruleGrammar, k, orProd) {\n var visitor2 = new InsideDefinitionFinderVisitor(occurrence, PROD_TYPE.ALTERNATION, orProd);\n ruleGrammar.accept(visitor2);\n return lookAheadSequenceFromAlternatives(visitor2.result, k);\n }\n exports.getLookaheadPathsForOr = getLookaheadPathsForOr;\n function getLookaheadPathsForOptionalProd(occurrence, ruleGrammar, prodType, k) {\n var insideDefVisitor = new InsideDefinitionFinderVisitor(occurrence, prodType);\n ruleGrammar.accept(insideDefVisitor);\n var insideDef = insideDefVisitor.result;\n var afterDefWalker = new RestDefinitionFinderWalker(ruleGrammar, occurrence, prodType);\n var afterDef = afterDefWalker.startWalking();\n var insideFlat = new gast_12.Alternative({ definition: insideDef });\n var afterFlat = new gast_12.Alternative({ definition: afterDef });\n return lookAheadSequenceFromAlternatives([insideFlat, afterFlat], k);\n }\n exports.getLookaheadPathsForOptionalProd = getLookaheadPathsForOptionalProd;\n function containsPath(alternative, searchPath) {\n compareOtherPath:\n for (var i2 = 0; i2 < alternative.length; i2++) {\n var otherPath = alternative[i2];\n if (otherPath.length !== searchPath.length) {\n continue;\n }\n for (var j = 0; j < otherPath.length; j++) {\n var searchTok = searchPath[j];\n var otherTok = otherPath[j];\n var matchingTokens = searchTok === otherTok || otherTok.categoryMatchesMap[searchTok.tokenTypeIdx] !== void 0;\n if (matchingTokens === false) {\n continue compareOtherPath;\n }\n }\n return true;\n }\n return false;\n }\n exports.containsPath = containsPath;\n function isStrictPrefixOfPath(prefix, other) {\n return prefix.length < other.length && (0, every_12.default)(prefix, function(tokType, idx) {\n var otherTokType = other[idx];\n return tokType === otherTokType || otherTokType.categoryMatchesMap[tokType.tokenTypeIdx];\n });\n }\n exports.isStrictPrefixOfPath = isStrictPrefixOfPath;\n function areTokenCategoriesNotUsed(lookAheadPaths) {\n return (0, every_12.default)(lookAheadPaths, function(singleAltPaths) {\n return (0, every_12.default)(singleAltPaths, function(singlePath) {\n return (0, every_12.default)(singlePath, function(token) {\n return (0, isEmpty_12.default)(token.categoryMatches);\n });\n });\n });\n }\n exports.areTokenCategoriesNotUsed = areTokenCategoriesNotUsed;\n})(lookahead);\nvar hasRequiredChecks;\nfunction requireChecks() {\n if (hasRequiredChecks)\n return checks;\n hasRequiredChecks = 1;\n var __extends2 = commonjsGlobal && commonjsGlobal.__extends || function() {\n var extendStatics = function(d, b2) {\n extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b3) {\n d2.__proto__ = b3;\n } || function(d2, b3) {\n for (var p in b3)\n if (Object.prototype.hasOwnProperty.call(b3, p))\n d2[p] = b3[p];\n };\n return extendStatics(d, b2);\n };\n return function(d, b2) {\n if (typeof b2 !== \"function\" && b2 !== null)\n throw new TypeError(\"Class extends value \" + String(b2) + \" is not a constructor or null\");\n extendStatics(d, b2);\n function __() {\n this.constructor = d;\n }\n d.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());\n };\n }();\n var __assign2 = commonjsGlobal && commonjsGlobal.__assign || function() {\n __assign2 = Object.assign || function(t2) {\n for (var s, i2 = 1, n = arguments.length; i2 < n; i2++) {\n s = arguments[i2];\n for (var p in s)\n if (Object.prototype.hasOwnProperty.call(s, p))\n t2[p] = s[p];\n }\n return t2;\n };\n return __assign2.apply(this, arguments);\n };\n var __importDefault2 = commonjsGlobal && commonjsGlobal.__importDefault || function(mod2) {\n return mod2 && mod2.__esModule ? mod2 : { \"default\": mod2 };\n };\n Object.defineProperty(checks, \"__esModule\", { value: true });\n checks.checkPrefixAlternativesAmbiguities = checks.validateSomeNonEmptyLookaheadPath = checks.validateTooManyAlts = checks.RepetitionCollector = checks.validateAmbiguousAlternationAlternatives = checks.validateEmptyOrAlternative = checks.getFirstNoneTerminal = checks.validateNoLeftRecursion = checks.validateRuleIsOverridden = checks.validateRuleDoesNotAlreadyExist = checks.OccurrenceValidationCollector = checks.identifyProductionForDuplicates = checks.validateGrammar = checks.validateLookahead = void 0;\n var first_12 = __importDefault2(lodash_first__WEBPACK_IMPORTED_MODULE_20__);\n var isEmpty_12 = __importDefault2(lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2__);\n var drop_12 = __importDefault2(lodash_drop__WEBPACK_IMPORTED_MODULE_8__);\n var flatten_12 = __importDefault2(lodash_flatten__WEBPACK_IMPORTED_MODULE_16__);\n var filter_1 = __importDefault2(lodash_filter__WEBPACK_IMPORTED_MODULE_29__);\n var reject_1 = __importDefault2(lodash_reject__WEBPACK_IMPORTED_MODULE_23__);\n var difference_1 = __importDefault2(lodash_difference__WEBPACK_IMPORTED_MODULE_24__);\n var map_12 = __importDefault2(lodash_map__WEBPACK_IMPORTED_MODULE_3__);\n var forEach_12 = __importDefault2(lodash_forEach__WEBPACK_IMPORTED_MODULE_4__);\n var groupBy_12 = __importDefault2(lodash_groupBy__WEBPACK_IMPORTED_MODULE_35__);\n var reduce_12 = __importDefault2(lodash_reduce__WEBPACK_IMPORTED_MODULE_31__);\n var pickBy_12 = __importDefault2(lodash_pickBy__WEBPACK_IMPORTED_MODULE_11__);\n var values_12 = __importDefault2(lodash_values__WEBPACK_IMPORTED_MODULE_5__);\n var includes_12 = __importDefault2(lodash_includes__WEBPACK_IMPORTED_MODULE_15__);\n var flatMap_1 = __importDefault2(lodash_flatMap__WEBPACK_IMPORTED_MODULE_36__);\n var clone_12 = __importDefault2(lodash_clone__WEBPACK_IMPORTED_MODULE_7__);\n var parser_1 = requireParser();\n var gast_12 = api$1;\n var lookahead_1 = lookahead;\n var interpreter_12 = interpreter;\n var gast_22 = api$1;\n var gast_3 = api$1;\n var dropRight_12 = __importDefault2(lodash_dropRight__WEBPACK_IMPORTED_MODULE_37__);\n var compact_1 = __importDefault2(lodash_compact__WEBPACK_IMPORTED_MODULE_21__);\n var tokens_1 = tokens;\n function validateLookahead(options) {\n var lookaheadValidationErrorMessages = options.lookaheadStrategy.validate({\n rules: options.rules,\n tokenTypes: options.tokenTypes,\n grammarName: options.grammarName\n });\n return (0, map_12.default)(lookaheadValidationErrorMessages, function(errorMessage) {\n return __assign2({ type: parser_1.ParserDefinitionErrorType.CUSTOM_LOOKAHEAD_VALIDATION }, errorMessage);\n });\n }\n checks.validateLookahead = validateLookahead;\n function validateGrammar(topLevels, tokenTypes, errMsgProvider, grammarName) {\n var duplicateErrors = (0, flatMap_1.default)(topLevels, function(currTopLevel) {\n return validateDuplicateProductions(currTopLevel, errMsgProvider);\n });\n var termsNamespaceConflictErrors = checkTerminalAndNoneTerminalsNameSpace(topLevels, tokenTypes, errMsgProvider);\n var tooManyAltsErrors = (0, flatMap_1.default)(topLevels, function(curRule) {\n return validateTooManyAlts(curRule, errMsgProvider);\n });\n var duplicateRulesError = (0, flatMap_1.default)(topLevels, function(curRule) {\n return validateRuleDoesNotAlreadyExist(curRule, topLevels, grammarName, errMsgProvider);\n });\n return duplicateErrors.concat(termsNamespaceConflictErrors, tooManyAltsErrors, duplicateRulesError);\n }\n checks.validateGrammar = validateGrammar;\n function validateDuplicateProductions(topLevelRule, errMsgProvider) {\n var collectorVisitor = new OccurrenceValidationCollector();\n topLevelRule.accept(collectorVisitor);\n var allRuleProductions = collectorVisitor.allProductions;\n var productionGroups = (0, groupBy_12.default)(allRuleProductions, identifyProductionForDuplicates);\n var duplicates = (0, pickBy_12.default)(productionGroups, function(currGroup) {\n return currGroup.length > 1;\n });\n var errors = (0, map_12.default)((0, values_12.default)(duplicates), function(currDuplicates) {\n var firstProd = (0, first_12.default)(currDuplicates);\n var msg = errMsgProvider.buildDuplicateFoundError(topLevelRule, currDuplicates);\n var dslName = (0, gast_12.getProductionDslName)(firstProd);\n var defError = {\n message: msg,\n type: parser_1.ParserDefinitionErrorType.DUPLICATE_PRODUCTIONS,\n ruleName: topLevelRule.name,\n dslName,\n occurrence: firstProd.idx\n };\n var param = getExtraProductionArgument(firstProd);\n if (param) {\n defError.parameter = param;\n }\n return defError;\n });\n return errors;\n }\n function identifyProductionForDuplicates(prod) {\n return \"\".concat((0, gast_12.getProductionDslName)(prod), \"_#_\").concat(prod.idx, \"_#_\").concat(getExtraProductionArgument(prod));\n }\n checks.identifyProductionForDuplicates = identifyProductionForDuplicates;\n function getExtraProductionArgument(prod) {\n if (prod instanceof gast_22.Terminal) {\n return prod.terminalType.name;\n } else if (prod instanceof gast_22.NonTerminal) {\n return prod.nonTerminalName;\n } else {\n return \"\";\n }\n }\n var OccurrenceValidationCollector = (\n /** @class */\n function(_super) {\n __extends2(OccurrenceValidationCollector2, _super);\n function OccurrenceValidationCollector2() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.allProductions = [];\n return _this;\n }\n OccurrenceValidationCollector2.prototype.visitNonTerminal = function(subrule) {\n this.allProductions.push(subrule);\n };\n OccurrenceValidationCollector2.prototype.visitOption = function(option) {\n this.allProductions.push(option);\n };\n OccurrenceValidationCollector2.prototype.visitRepetitionWithSeparator = function(manySep) {\n this.allProductions.push(manySep);\n };\n OccurrenceValidationCollector2.prototype.visitRepetitionMandatory = function(atLeastOne) {\n this.allProductions.push(atLeastOne);\n };\n OccurrenceValidationCollector2.prototype.visitRepetitionMandatoryWithSeparator = function(atLeastOneSep) {\n this.allProductions.push(atLeastOneSep);\n };\n OccurrenceValidationCollector2.prototype.visitRepetition = function(many) {\n this.allProductions.push(many);\n };\n OccurrenceValidationCollector2.prototype.visitAlternation = function(or) {\n this.allProductions.push(or);\n };\n OccurrenceValidationCollector2.prototype.visitTerminal = function(terminal) {\n this.allProductions.push(terminal);\n };\n return OccurrenceValidationCollector2;\n }(gast_3.GAstVisitor)\n );\n checks.OccurrenceValidationCollector = OccurrenceValidationCollector;\n function validateRuleDoesNotAlreadyExist(rule, allRules, className, errMsgProvider) {\n var errors = [];\n var occurrences = (0, reduce_12.default)(allRules, function(result, curRule) {\n if (curRule.name === rule.name) {\n return result + 1;\n }\n return result;\n }, 0);\n if (occurrences > 1) {\n var errMsg = errMsgProvider.buildDuplicateRuleNameError({\n topLevelRule: rule,\n grammarName: className\n });\n errors.push({\n message: errMsg,\n type: parser_1.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,\n ruleName: rule.name\n });\n }\n return errors;\n }\n checks.validateRuleDoesNotAlreadyExist = validateRuleDoesNotAlreadyExist;\n function validateRuleIsOverridden(ruleName, definedRulesNames, className) {\n var errors = [];\n var errMsg;\n if (!(0, includes_12.default)(definedRulesNames, ruleName)) {\n errMsg = \"Invalid rule override, rule: ->\".concat(ruleName, \"<- cannot be overridden in the grammar: ->\").concat(className, \"<-\") + \"as it is not defined in any of the super grammars \";\n errors.push({\n message: errMsg,\n type: parser_1.ParserDefinitionErrorType.INVALID_RULE_OVERRIDE,\n ruleName\n });\n }\n return errors;\n }\n checks.validateRuleIsOverridden = validateRuleIsOverridden;\n function validateNoLeftRecursion(topRule, currRule, errMsgProvider, path) {\n if (path === void 0) {\n path = [];\n }\n var errors = [];\n var nextNonTerminals = getFirstNoneTerminal(currRule.definition);\n if ((0, isEmpty_12.default)(nextNonTerminals)) {\n return [];\n } else {\n var ruleName = topRule.name;\n var foundLeftRecursion = (0, includes_12.default)(nextNonTerminals, topRule);\n if (foundLeftRecursion) {\n errors.push({\n message: errMsgProvider.buildLeftRecursionError({\n topLevelRule: topRule,\n leftRecursionPath: path\n }),\n type: parser_1.ParserDefinitionErrorType.LEFT_RECURSION,\n ruleName\n });\n }\n var validNextSteps = (0, difference_1.default)(nextNonTerminals, path.concat([topRule]));\n var errorsFromNextSteps = (0, flatMap_1.default)(validNextSteps, function(currRefRule) {\n var newPath = (0, clone_12.default)(path);\n newPath.push(currRefRule);\n return validateNoLeftRecursion(topRule, currRefRule, errMsgProvider, newPath);\n });\n return errors.concat(errorsFromNextSteps);\n }\n }\n checks.validateNoLeftRecursion = validateNoLeftRecursion;\n function getFirstNoneTerminal(definition) {\n var result = [];\n if ((0, isEmpty_12.default)(definition)) {\n return result;\n }\n var firstProd = (0, first_12.default)(definition);\n if (firstProd instanceof gast_22.NonTerminal) {\n result.push(firstProd.referencedRule);\n } else if (firstProd instanceof gast_22.Alternative || firstProd instanceof gast_22.Option || firstProd instanceof gast_22.RepetitionMandatory || firstProd instanceof gast_22.RepetitionMandatoryWithSeparator || firstProd instanceof gast_22.RepetitionWithSeparator || firstProd instanceof gast_22.Repetition) {\n result = result.concat(getFirstNoneTerminal(firstProd.definition));\n } else if (firstProd instanceof gast_22.Alternation) {\n result = (0, flatten_12.default)((0, map_12.default)(firstProd.definition, function(currSubDef) {\n return getFirstNoneTerminal(currSubDef.definition);\n }));\n } else if (firstProd instanceof gast_22.Terminal)\n ;\n else {\n throw Error(\"non exhaustive match\");\n }\n var isFirstOptional = (0, gast_12.isOptionalProd)(firstProd);\n var hasMore = definition.length > 1;\n if (isFirstOptional && hasMore) {\n var rest2 = (0, drop_12.default)(definition);\n return result.concat(getFirstNoneTerminal(rest2));\n } else {\n return result;\n }\n }\n checks.getFirstNoneTerminal = getFirstNoneTerminal;\n var OrCollector = (\n /** @class */\n function(_super) {\n __extends2(OrCollector2, _super);\n function OrCollector2() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.alternations = [];\n return _this;\n }\n OrCollector2.prototype.visitAlternation = function(node) {\n this.alternations.push(node);\n };\n return OrCollector2;\n }(gast_3.GAstVisitor)\n );\n function validateEmptyOrAlternative(topLevelRule, errMsgProvider) {\n var orCollector = new OrCollector();\n topLevelRule.accept(orCollector);\n var ors = orCollector.alternations;\n var errors = (0, flatMap_1.default)(ors, function(currOr) {\n var exceptLast = (0, dropRight_12.default)(currOr.definition);\n return (0, flatMap_1.default)(exceptLast, function(currAlternative, currAltIdx) {\n var possibleFirstInAlt = (0, interpreter_12.nextPossibleTokensAfter)([currAlternative], [], tokens_1.tokenStructuredMatcher, 1);\n if ((0, isEmpty_12.default)(possibleFirstInAlt)) {\n return [\n {\n message: errMsgProvider.buildEmptyAlternationError({\n topLevelRule,\n alternation: currOr,\n emptyChoiceIdx: currAltIdx\n }),\n type: parser_1.ParserDefinitionErrorType.NONE_LAST_EMPTY_ALT,\n ruleName: topLevelRule.name,\n occurrence: currOr.idx,\n alternative: currAltIdx + 1\n }\n ];\n } else {\n return [];\n }\n });\n });\n return errors;\n }\n checks.validateEmptyOrAlternative = validateEmptyOrAlternative;\n function validateAmbiguousAlternationAlternatives(topLevelRule, globalMaxLookahead, errMsgProvider) {\n var orCollector = new OrCollector();\n topLevelRule.accept(orCollector);\n var ors = orCollector.alternations;\n ors = (0, reject_1.default)(ors, function(currOr) {\n return currOr.ignoreAmbiguities === true;\n });\n var errors = (0, flatMap_1.default)(ors, function(currOr) {\n var currOccurrence = currOr.idx;\n var actualMaxLookahead = currOr.maxLookahead || globalMaxLookahead;\n var alternatives = (0, lookahead_1.getLookaheadPathsForOr)(currOccurrence, topLevelRule, actualMaxLookahead, currOr);\n var altsAmbiguityErrors = checkAlternativesAmbiguities(alternatives, currOr, topLevelRule, errMsgProvider);\n var altsPrefixAmbiguityErrors = checkPrefixAlternativesAmbiguities(alternatives, currOr, topLevelRule, errMsgProvider);\n return altsAmbiguityErrors.concat(altsPrefixAmbiguityErrors);\n });\n return errors;\n }\n checks.validateAmbiguousAlternationAlternatives = validateAmbiguousAlternationAlternatives;\n var RepetitionCollector = (\n /** @class */\n function(_super) {\n __extends2(RepetitionCollector2, _super);\n function RepetitionCollector2() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.allProductions = [];\n return _this;\n }\n RepetitionCollector2.prototype.visitRepetitionWithSeparator = function(manySep) {\n this.allProductions.push(manySep);\n };\n RepetitionCollector2.prototype.visitRepetitionMandatory = function(atLeastOne) {\n this.allProductions.push(atLeastOne);\n };\n RepetitionCollector2.prototype.visitRepetitionMandatoryWithSeparator = function(atLeastOneSep) {\n this.allProductions.push(atLeastOneSep);\n };\n RepetitionCollector2.prototype.visitRepetition = function(many) {\n this.allProductions.push(many);\n };\n return RepetitionCollector2;\n }(gast_3.GAstVisitor)\n );\n checks.RepetitionCollector = RepetitionCollector;\n function validateTooManyAlts(topLevelRule, errMsgProvider) {\n var orCollector = new OrCollector();\n topLevelRule.accept(orCollector);\n var ors = orCollector.alternations;\n var errors = (0, flatMap_1.default)(ors, function(currOr) {\n if (currOr.definition.length > 255) {\n return [\n {\n message: errMsgProvider.buildTooManyAlternativesError({\n topLevelRule,\n alternation: currOr\n }),\n type: parser_1.ParserDefinitionErrorType.TOO_MANY_ALTS,\n ruleName: topLevelRule.name,\n occurrence: currOr.idx\n }\n ];\n } else {\n return [];\n }\n });\n return errors;\n }\n checks.validateTooManyAlts = validateTooManyAlts;\n function validateSomeNonEmptyLookaheadPath(topLevelRules, maxLookahead, errMsgProvider) {\n var errors = [];\n (0, forEach_12.default)(topLevelRules, function(currTopRule) {\n var collectorVisitor = new RepetitionCollector();\n currTopRule.accept(collectorVisitor);\n var allRuleProductions = collectorVisitor.allProductions;\n (0, forEach_12.default)(allRuleProductions, function(currProd) {\n var prodType = (0, lookahead_1.getProdType)(currProd);\n var actualMaxLookahead = currProd.maxLookahead || maxLookahead;\n var currOccurrence = currProd.idx;\n var paths = (0, lookahead_1.getLookaheadPathsForOptionalProd)(currOccurrence, currTopRule, prodType, actualMaxLookahead);\n var pathsInsideProduction = paths[0];\n if ((0, isEmpty_12.default)((0, flatten_12.default)(pathsInsideProduction))) {\n var errMsg = errMsgProvider.buildEmptyRepetitionError({\n topLevelRule: currTopRule,\n repetition: currProd\n });\n errors.push({\n message: errMsg,\n type: parser_1.ParserDefinitionErrorType.NO_NON_EMPTY_LOOKAHEAD,\n ruleName: currTopRule.name\n });\n }\n });\n });\n return errors;\n }\n checks.validateSomeNonEmptyLookaheadPath = validateSomeNonEmptyLookaheadPath;\n function checkAlternativesAmbiguities(alternatives, alternation, rule, errMsgProvider) {\n var foundAmbiguousPaths = [];\n var identicalAmbiguities = (0, reduce_12.default)(alternatives, function(result, currAlt, currAltIdx) {\n if (alternation.definition[currAltIdx].ignoreAmbiguities === true) {\n return result;\n }\n (0, forEach_12.default)(currAlt, function(currPath) {\n var altsCurrPathAppearsIn = [currAltIdx];\n (0, forEach_12.default)(alternatives, function(currOtherAlt, currOtherAltIdx) {\n if (currAltIdx !== currOtherAltIdx && (0, lookahead_1.containsPath)(currOtherAlt, currPath) && // ignore (skip) ambiguities with this \"other\" alternative\n alternation.definition[currOtherAltIdx].ignoreAmbiguities !== true) {\n altsCurrPathAppearsIn.push(currOtherAltIdx);\n }\n });\n if (altsCurrPathAppearsIn.length > 1 && !(0, lookahead_1.containsPath)(foundAmbiguousPaths, currPath)) {\n foundAmbiguousPaths.push(currPath);\n result.push({\n alts: altsCurrPathAppearsIn,\n path: currPath\n });\n }\n });\n return result;\n }, []);\n var currErrors = (0, map_12.default)(identicalAmbiguities, function(currAmbDescriptor) {\n var ambgIndices = (0, map_12.default)(currAmbDescriptor.alts, function(currAltIdx) {\n return currAltIdx + 1;\n });\n var currMessage = errMsgProvider.buildAlternationAmbiguityError({\n topLevelRule: rule,\n alternation,\n ambiguityIndices: ambgIndices,\n prefixPath: currAmbDescriptor.path\n });\n return {\n message: currMessage,\n type: parser_1.ParserDefinitionErrorType.AMBIGUOUS_ALTS,\n ruleName: rule.name,\n occurrence: alternation.idx,\n alternatives: currAmbDescriptor.alts\n };\n });\n return currErrors;\n }\n function checkPrefixAlternativesAmbiguities(alternatives, alternation, rule, errMsgProvider) {\n var pathsAndIndices = (0, reduce_12.default)(alternatives, function(result, currAlt, idx) {\n var currPathsAndIdx = (0, map_12.default)(currAlt, function(currPath) {\n return { idx, path: currPath };\n });\n return result.concat(currPathsAndIdx);\n }, []);\n var errors = (0, compact_1.default)((0, flatMap_1.default)(pathsAndIndices, function(currPathAndIdx) {\n var alternativeGast = alternation.definition[currPathAndIdx.idx];\n if (alternativeGast.ignoreAmbiguities === true) {\n return [];\n }\n var targetIdx = currPathAndIdx.idx;\n var targetPath = currPathAndIdx.path;\n var prefixAmbiguitiesPathsAndIndices = (0, filter_1.default)(pathsAndIndices, function(searchPathAndIdx) {\n return (\n // ignore (skip) ambiguities with this \"other\" alternative\n alternation.definition[searchPathAndIdx.idx].ignoreAmbiguities !== true && searchPathAndIdx.idx < targetIdx && // checking for strict prefix because identical lookaheads\n // will be be detected using a different validation.\n (0, lookahead_1.isStrictPrefixOfPath)(searchPathAndIdx.path, targetPath)\n );\n });\n var currPathPrefixErrors = (0, map_12.default)(prefixAmbiguitiesPathsAndIndices, function(currAmbPathAndIdx) {\n var ambgIndices = [currAmbPathAndIdx.idx + 1, targetIdx + 1];\n var occurrence = alternation.idx === 0 ? \"\" : alternation.idx;\n var message = errMsgProvider.buildAlternationPrefixAmbiguityError({\n topLevelRule: rule,\n alternation,\n ambiguityIndices: ambgIndices,\n prefixPath: currAmbPathAndIdx.path\n });\n return {\n message,\n type: parser_1.ParserDefinitionErrorType.AMBIGUOUS_PREFIX_ALTS,\n ruleName: rule.name,\n occurrence,\n alternatives: ambgIndices\n };\n });\n return currPathPrefixErrors;\n }));\n return errors;\n }\n checks.checkPrefixAlternativesAmbiguities = checkPrefixAlternativesAmbiguities;\n function checkTerminalAndNoneTerminalsNameSpace(topLevels, tokenTypes, errMsgProvider) {\n var errors = [];\n var tokenNames = (0, map_12.default)(tokenTypes, function(currToken) {\n return currToken.name;\n });\n (0, forEach_12.default)(topLevels, function(currRule) {\n var currRuleName = currRule.name;\n if ((0, includes_12.default)(tokenNames, currRuleName)) {\n var errMsg = errMsgProvider.buildNamespaceConflictError(currRule);\n errors.push({\n message: errMsg,\n type: parser_1.ParserDefinitionErrorType.CONFLICT_TOKENS_RULES_NAMESPACE,\n ruleName: currRuleName\n });\n }\n });\n return errors;\n }\n return checks;\n}\nvar hasRequiredGast_resolver_public;\nfunction requireGast_resolver_public() {\n if (hasRequiredGast_resolver_public)\n return gast_resolver_public;\n hasRequiredGast_resolver_public = 1;\n var __importDefault2 = commonjsGlobal && commonjsGlobal.__importDefault || function(mod2) {\n return mod2 && mod2.__esModule ? mod2 : { \"default\": mod2 };\n };\n Object.defineProperty(gast_resolver_public, \"__esModule\", { value: true });\n gast_resolver_public.validateGrammar = gast_resolver_public.resolveGrammar = void 0;\n var forEach_12 = __importDefault2(lodash_forEach__WEBPACK_IMPORTED_MODULE_4__);\n var defaults_1 = __importDefault2(lodash_defaults__WEBPACK_IMPORTED_MODULE_30__);\n var resolver_1 = requireResolver();\n var checks_1 = requireChecks();\n var errors_public_1 = errors_public;\n function resolveGrammar(options) {\n var actualOptions = (0, defaults_1.default)(options, {\n errMsgProvider: errors_public_1.defaultGrammarResolverErrorProvider\n });\n var topRulesTable = {};\n (0, forEach_12.default)(options.rules, function(rule) {\n topRulesTable[rule.name] = rule;\n });\n return (0, resolver_1.resolveGrammar)(topRulesTable, actualOptions.errMsgProvider);\n }\n gast_resolver_public.resolveGrammar = resolveGrammar;\n function validateGrammar(options) {\n options = (0, defaults_1.default)(options, {\n errMsgProvider: errors_public_1.defaultGrammarValidatorErrorProvider\n });\n return (0, checks_1.validateGrammar)(options.rules, options.tokenTypes, options.errMsgProvider, options.grammarName);\n }\n gast_resolver_public.validateGrammar = validateGrammar;\n return gast_resolver_public;\n}\nvar recoverable = {};\nvar exceptions_public = {};\nvar __extends$1 = commonjsGlobal && commonjsGlobal.__extends || function() {\n var extendStatics = function(d, b2) {\n extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b3) {\n d2.__proto__ = b3;\n } || function(d2, b3) {\n for (var p in b3)\n if (Object.prototype.hasOwnProperty.call(b3, p))\n d2[p] = b3[p];\n };\n return extendStatics(d, b2);\n };\n return function(d, b2) {\n if (typeof b2 !== \"function\" && b2 !== null)\n throw new TypeError(\"Class extends value \" + String(b2) + \" is not a constructor or null\");\n extendStatics(d, b2);\n function __() {\n this.constructor = d;\n }\n d.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());\n };\n}();\nvar __importDefault$3 = commonjsGlobal && commonjsGlobal.__importDefault || function(mod2) {\n return mod2 && mod2.__esModule ? mod2 : { \"default\": mod2 };\n};\nObject.defineProperty(exceptions_public, \"__esModule\", { value: true });\nexceptions_public.EarlyExitException = exceptions_public.NotAllInputParsedException = exceptions_public.NoViableAltException = exceptions_public.MismatchedTokenException = exceptions_public.isRecognitionException = void 0;\nvar includes_1 = __importDefault$3(lodash_includes__WEBPACK_IMPORTED_MODULE_15__);\nvar MISMATCHED_TOKEN_EXCEPTION = \"MismatchedTokenException\";\nvar NO_VIABLE_ALT_EXCEPTION = \"NoViableAltException\";\nvar EARLY_EXIT_EXCEPTION = \"EarlyExitException\";\nvar NOT_ALL_INPUT_PARSED_EXCEPTION = \"NotAllInputParsedException\";\nvar RECOGNITION_EXCEPTION_NAMES = [\n MISMATCHED_TOKEN_EXCEPTION,\n NO_VIABLE_ALT_EXCEPTION,\n EARLY_EXIT_EXCEPTION,\n NOT_ALL_INPUT_PARSED_EXCEPTION\n];\nObject.freeze(RECOGNITION_EXCEPTION_NAMES);\nfunction isRecognitionException(error) {\n return (0, includes_1.default)(RECOGNITION_EXCEPTION_NAMES, error.name);\n}\nexceptions_public.isRecognitionException = isRecognitionException;\nvar RecognitionException = (\n /** @class */\n function(_super) {\n __extends$1(RecognitionException2, _super);\n function RecognitionException2(message, token) {\n var _newTarget = this.constructor;\n var _this = _super.call(this, message) || this;\n _this.token = token;\n _this.resyncedTokens = [];\n Object.setPrototypeOf(_this, _newTarget.prototype);\n if (Error.captureStackTrace) {\n Error.captureStackTrace(_this, _this.constructor);\n }\n return _this;\n }\n return RecognitionException2;\n }(Error)\n);\nvar MismatchedTokenException = (\n /** @class */\n function(_super) {\n __extends$1(MismatchedTokenException2, _super);\n function MismatchedTokenException2(message, token, previousToken) {\n var _this = _super.call(this, message, token) || this;\n _this.previousToken = previousToken;\n _this.name = MISMATCHED_TOKEN_EXCEPTION;\n return _this;\n }\n return MismatchedTokenException2;\n }(RecognitionException)\n);\nexceptions_public.MismatchedTokenException = MismatchedTokenException;\nvar NoViableAltException = (\n /** @class */\n function(_super) {\n __extends$1(NoViableAltException2, _super);\n function NoViableAltException2(message, token, previousToken) {\n var _this = _super.call(this, message, token) || this;\n _this.previousToken = previousToken;\n _this.name = NO_VIABLE_ALT_EXCEPTION;\n return _this;\n }\n return NoViableAltException2;\n }(RecognitionException)\n);\nexceptions_public.NoViableAltException = NoViableAltException;\nvar NotAllInputParsedException = (\n /** @class */\n function(_super) {\n __extends$1(NotAllInputParsedException2, _super);\n function NotAllInputParsedException2(message, token) {\n var _this = _super.call(this, message, token) || this;\n _this.name = NOT_ALL_INPUT_PARSED_EXCEPTION;\n return _this;\n }\n return NotAllInputParsedException2;\n }(RecognitionException)\n);\nexceptions_public.NotAllInputParsedException = NotAllInputParsedException;\nvar EarlyExitException = (\n /** @class */\n function(_super) {\n __extends$1(EarlyExitException2, _super);\n function EarlyExitException2(message, token, previousToken) {\n var _this = _super.call(this, message, token) || this;\n _this.previousToken = previousToken;\n _this.name = EARLY_EXIT_EXCEPTION;\n return _this;\n }\n return EarlyExitException2;\n }(RecognitionException)\n);\nexceptions_public.EarlyExitException = EarlyExitException;\nvar hasRequiredRecoverable;\nfunction requireRecoverable() {\n if (hasRequiredRecoverable)\n return recoverable;\n hasRequiredRecoverable = 1;\n (function(exports) {\n var __extends2 = commonjsGlobal && commonjsGlobal.__extends || function() {\n var extendStatics = function(d, b2) {\n extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b3) {\n d2.__proto__ = b3;\n } || function(d2, b3) {\n for (var p in b3)\n if (Object.prototype.hasOwnProperty.call(b3, p))\n d2[p] = b3[p];\n };\n return extendStatics(d, b2);\n };\n return function(d, b2) {\n if (typeof b2 !== \"function\" && b2 !== null)\n throw new TypeError(\"Class extends value \" + String(b2) + \" is not a constructor or null\");\n extendStatics(d, b2);\n function __() {\n this.constructor = d;\n }\n d.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());\n };\n }();\n var __importDefault2 = commonjsGlobal && commonjsGlobal.__importDefault || function(mod2) {\n return mod2 && mod2.__esModule ? mod2 : { \"default\": mod2 };\n };\n Object.defineProperty(exports, \"__esModule\", { value: true });\n exports.attemptInRepetitionRecovery = exports.Recoverable = exports.InRuleRecoveryException = exports.IN_RULE_RECOVERY_EXCEPTION = exports.EOF_FOLLOW_KEY = void 0;\n var tokens_public_1 = tokens_public;\n var isEmpty_12 = __importDefault2(lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2__);\n var dropRight_12 = __importDefault2(lodash_dropRight__WEBPACK_IMPORTED_MODULE_37__);\n var flatten_12 = __importDefault2(lodash_flatten__WEBPACK_IMPORTED_MODULE_16__);\n var map_12 = __importDefault2(lodash_map__WEBPACK_IMPORTED_MODULE_3__);\n var find_1 = __importDefault2(lodash_find__WEBPACK_IMPORTED_MODULE_27__);\n var has_1 = __importDefault2(lodash_has__WEBPACK_IMPORTED_MODULE_6__);\n var includes_12 = __importDefault2(lodash_includes__WEBPACK_IMPORTED_MODULE_15__);\n var clone_12 = __importDefault2(lodash_clone__WEBPACK_IMPORTED_MODULE_7__);\n var exceptions_public_1 = exceptions_public;\n var constants_12 = constants;\n var parser_1 = requireParser();\n exports.EOF_FOLLOW_KEY = {};\n exports.IN_RULE_RECOVERY_EXCEPTION = \"InRuleRecoveryException\";\n var InRuleRecoveryException = (\n /** @class */\n function(_super) {\n __extends2(InRuleRecoveryException2, _super);\n function InRuleRecoveryException2(message) {\n var _this = _super.call(this, message) || this;\n _this.name = exports.IN_RULE_RECOVERY_EXCEPTION;\n return _this;\n }\n return InRuleRecoveryException2;\n }(Error)\n );\n exports.InRuleRecoveryException = InRuleRecoveryException;\n var Recoverable = (\n /** @class */\n function() {\n function Recoverable2() {\n }\n Recoverable2.prototype.initRecoverable = function(config) {\n this.firstAfterRepMap = {};\n this.resyncFollows = {};\n this.recoveryEnabled = (0, has_1.default)(config, \"recoveryEnabled\") ? config.recoveryEnabled : parser_1.DEFAULT_PARSER_CONFIG.recoveryEnabled;\n if (this.recoveryEnabled) {\n this.attemptInRepetitionRecovery = attemptInRepetitionRecovery;\n }\n };\n Recoverable2.prototype.getTokenToInsert = function(tokType) {\n var tokToInsert = (0, tokens_public_1.createTokenInstance)(tokType, \"\", NaN, NaN, NaN, NaN, NaN, NaN);\n tokToInsert.isInsertedInRecovery = true;\n return tokToInsert;\n };\n Recoverable2.prototype.canTokenTypeBeInsertedInRecovery = function(tokType) {\n return true;\n };\n Recoverable2.prototype.canTokenTypeBeDeletedInRecovery = function(tokType) {\n return true;\n };\n Recoverable2.prototype.tryInRepetitionRecovery = function(grammarRule, grammarRuleArgs, lookAheadFunc, expectedTokType) {\n var _this = this;\n var reSyncTokType = this.findReSyncTokenType();\n var savedLexerState = this.exportLexerState();\n var resyncedTokens = [];\n var passedResyncPoint = false;\n var nextTokenWithoutResync = this.LA(1);\n var currToken = this.LA(1);\n var generateErrorMessage = function() {\n var previousToken = _this.LA(0);\n var msg = _this.errorMessageProvider.buildMismatchTokenMessage({\n expected: expectedTokType,\n actual: nextTokenWithoutResync,\n previous: previousToken,\n ruleName: _this.getCurrRuleFullName()\n });\n var error = new exceptions_public_1.MismatchedTokenException(msg, nextTokenWithoutResync, _this.LA(0));\n error.resyncedTokens = (0, dropRight_12.default)(resyncedTokens);\n _this.SAVE_ERROR(error);\n };\n while (!passedResyncPoint) {\n if (this.tokenMatcher(currToken, expectedTokType)) {\n generateErrorMessage();\n return;\n } else if (lookAheadFunc.call(this)) {\n generateErrorMessage();\n grammarRule.apply(this, grammarRuleArgs);\n return;\n } else if (this.tokenMatcher(currToken, reSyncTokType)) {\n passedResyncPoint = true;\n } else {\n currToken = this.SKIP_TOKEN();\n this.addToResyncTokens(currToken, resyncedTokens);\n }\n }\n this.importLexerState(savedLexerState);\n };\n Recoverable2.prototype.shouldInRepetitionRecoveryBeTried = function(expectTokAfterLastMatch, nextTokIdx, notStuck) {\n if (notStuck === false) {\n return false;\n }\n if (this.tokenMatcher(this.LA(1), expectTokAfterLastMatch)) {\n return false;\n }\n if (this.isBackTracking()) {\n return false;\n }\n if (this.canPerformInRuleRecovery(expectTokAfterLastMatch, this.getFollowsForInRuleRecovery(expectTokAfterLastMatch, nextTokIdx))) {\n return false;\n }\n return true;\n };\n Recoverable2.prototype.getFollowsForInRuleRecovery = function(tokType, tokIdxInRule) {\n var grammarPath = this.getCurrentGrammarPath(tokType, tokIdxInRule);\n var follows = this.getNextPossibleTokenTypes(grammarPath);\n return follows;\n };\n Recoverable2.prototype.tryInRuleRecovery = function(expectedTokType, follows) {\n if (this.canRecoverWithSingleTokenInsertion(expectedTokType, follows)) {\n var tokToInsert = this.getTokenToInsert(expectedTokType);\n return tokToInsert;\n }\n if (this.canRecoverWithSingleTokenDeletion(expectedTokType)) {\n var nextTok = this.SKIP_TOKEN();\n this.consumeToken();\n return nextTok;\n }\n throw new InRuleRecoveryException(\"sad sad panda\");\n };\n Recoverable2.prototype.canPerformInRuleRecovery = function(expectedToken, follows) {\n return this.canRecoverWithSingleTokenInsertion(expectedToken, follows) || this.canRecoverWithSingleTokenDeletion(expectedToken);\n };\n Recoverable2.prototype.canRecoverWithSingleTokenInsertion = function(expectedTokType, follows) {\n var _this = this;\n if (!this.canTokenTypeBeInsertedInRecovery(expectedTokType)) {\n return false;\n }\n if ((0, isEmpty_12.default)(follows)) {\n return false;\n }\n var mismatchedTok = this.LA(1);\n var isMisMatchedTokInFollows = (0, find_1.default)(follows, function(possibleFollowsTokType) {\n return _this.tokenMatcher(mismatchedTok, possibleFollowsTokType);\n }) !== void 0;\n return isMisMatchedTokInFollows;\n };\n Recoverable2.prototype.canRecoverWithSingleTokenDeletion = function(expectedTokType) {\n if (!this.canTokenTypeBeDeletedInRecovery(expectedTokType)) {\n return false;\n }\n var isNextTokenWhatIsExpected = this.tokenMatcher(this.LA(2), expectedTokType);\n return isNextTokenWhatIsExpected;\n };\n Recoverable2.prototype.isInCurrentRuleReSyncSet = function(tokenTypeIdx) {\n var followKey = this.getCurrFollowKey();\n var currentRuleReSyncSet = this.getFollowSetFromFollowKey(followKey);\n return (0, includes_12.default)(currentRuleReSyncSet, tokenTypeIdx);\n };\n Recoverable2.prototype.findReSyncTokenType = function() {\n var allPossibleReSyncTokTypes = this.flattenFollowSet();\n var nextToken = this.LA(1);\n var k = 2;\n while (true) {\n var foundMatch = (0, find_1.default)(allPossibleReSyncTokTypes, function(resyncTokType) {\n var canMatch = (0, tokens_public_1.tokenMatcher)(nextToken, resyncTokType);\n return canMatch;\n });\n if (foundMatch !== void 0) {\n return foundMatch;\n }\n nextToken = this.LA(k);\n k++;\n }\n };\n Recoverable2.prototype.getCurrFollowKey = function() {\n if (this.RULE_STACK.length === 1) {\n return exports.EOF_FOLLOW_KEY;\n }\n var currRuleShortName = this.getLastExplicitRuleShortName();\n var currRuleIdx = this.getLastExplicitRuleOccurrenceIndex();\n var prevRuleShortName = this.getPreviousExplicitRuleShortName();\n return {\n ruleName: this.shortRuleNameToFullName(currRuleShortName),\n idxInCallingRule: currRuleIdx,\n inRule: this.shortRuleNameToFullName(prevRuleShortName)\n };\n };\n Recoverable2.prototype.buildFullFollowKeyStack = function() {\n var _this = this;\n var explicitRuleStack = this.RULE_STACK;\n var explicitOccurrenceStack = this.RULE_OCCURRENCE_STACK;\n return (0, map_12.default)(explicitRuleStack, function(ruleName, idx) {\n if (idx === 0) {\n return exports.EOF_FOLLOW_KEY;\n }\n return {\n ruleName: _this.shortRuleNameToFullName(ruleName),\n idxInCallingRule: explicitOccurrenceStack[idx],\n inRule: _this.shortRuleNameToFullName(explicitRuleStack[idx - 1])\n };\n });\n };\n Recoverable2.prototype.flattenFollowSet = function() {\n var _this = this;\n var followStack = (0, map_12.default)(this.buildFullFollowKeyStack(), function(currKey) {\n return _this.getFollowSetFromFollowKey(currKey);\n });\n return (0, flatten_12.default)(followStack);\n };\n Recoverable2.prototype.getFollowSetFromFollowKey = function(followKey) {\n if (followKey === exports.EOF_FOLLOW_KEY) {\n return [tokens_public_1.EOF];\n }\n var followName = followKey.ruleName + followKey.idxInCallingRule + constants_12.IN + followKey.inRule;\n return this.resyncFollows[followName];\n };\n Recoverable2.prototype.addToResyncTokens = function(token, resyncTokens) {\n if (!this.tokenMatcher(token, tokens_public_1.EOF)) {\n resyncTokens.push(token);\n }\n return resyncTokens;\n };\n Recoverable2.prototype.reSyncTo = function(tokType) {\n var resyncedTokens = [];\n var nextTok = this.LA(1);\n while (this.tokenMatcher(nextTok, tokType) === false) {\n nextTok = this.SKIP_TOKEN();\n this.addToResyncTokens(nextTok, resyncedTokens);\n }\n return (0, dropRight_12.default)(resyncedTokens);\n };\n Recoverable2.prototype.attemptInRepetitionRecovery = function(prodFunc, args, lookaheadFunc, dslMethodIdx, prodOccurrence, nextToksWalker, notStuck) {\n };\n Recoverable2.prototype.getCurrentGrammarPath = function(tokType, tokIdxInRule) {\n var pathRuleStack = this.getHumanReadableRuleStack();\n var pathOccurrenceStack = (0, clone_12.default)(this.RULE_OCCURRENCE_STACK);\n var grammarPath = {\n ruleStack: pathRuleStack,\n occurrenceStack: pathOccurrenceStack,\n lastTok: tokType,\n lastTokOccurrence: tokIdxInRule\n };\n return grammarPath;\n };\n Recoverable2.prototype.getHumanReadableRuleStack = function() {\n var _this = this;\n return (0, map_12.default)(this.RULE_STACK, function(currShortName) {\n return _this.shortRuleNameToFullName(currShortName);\n });\n };\n return Recoverable2;\n }()\n );\n exports.Recoverable = Recoverable;\n function attemptInRepetitionRecovery(prodFunc, args, lookaheadFunc, dslMethodIdx, prodOccurrence, nextToksWalker, notStuck) {\n var key = this.getKeyForAutomaticLookahead(dslMethodIdx, prodOccurrence);\n var firstAfterRepInfo = this.firstAfterRepMap[key];\n if (firstAfterRepInfo === void 0) {\n var currRuleName = this.getCurrRuleFullName();\n var ruleGrammar = this.getGAstProductions()[currRuleName];\n var walker = new nextToksWalker(ruleGrammar, prodOccurrence);\n firstAfterRepInfo = walker.startWalking();\n this.firstAfterRepMap[key] = firstAfterRepInfo;\n }\n var expectTokAfterLastMatch = firstAfterRepInfo.token;\n var nextTokIdx = firstAfterRepInfo.occurrence;\n var isEndOfRule = firstAfterRepInfo.isEndOfRule;\n if (this.RULE_STACK.length === 1 && isEndOfRule && expectTokAfterLastMatch === void 0) {\n expectTokAfterLastMatch = tokens_public_1.EOF;\n nextTokIdx = 1;\n }\n if (expectTokAfterLastMatch === void 0 || nextTokIdx === void 0) {\n return;\n }\n if (this.shouldInRepetitionRecoveryBeTried(expectTokAfterLastMatch, nextTokIdx, notStuck)) {\n this.tryInRepetitionRecovery(prodFunc, args, lookaheadFunc, expectTokAfterLastMatch);\n }\n }\n exports.attemptInRepetitionRecovery = attemptInRepetitionRecovery;\n })(recoverable);\n return recoverable;\n}\nvar looksahead = {};\nvar keys = {};\n(function(exports) {\n Object.defineProperty(exports, \"__esModule\", { value: true });\n exports.getKeyForAutomaticLookahead = exports.AT_LEAST_ONE_SEP_IDX = exports.MANY_SEP_IDX = exports.AT_LEAST_ONE_IDX = exports.MANY_IDX = exports.OPTION_IDX = exports.OR_IDX = exports.BITS_FOR_ALT_IDX = exports.BITS_FOR_RULE_IDX = exports.BITS_FOR_OCCURRENCE_IDX = exports.BITS_FOR_METHOD_TYPE = void 0;\n exports.BITS_FOR_METHOD_TYPE = 4;\n exports.BITS_FOR_OCCURRENCE_IDX = 8;\n exports.BITS_FOR_RULE_IDX = 12;\n exports.BITS_FOR_ALT_IDX = 8;\n exports.OR_IDX = 1 << exports.BITS_FOR_OCCURRENCE_IDX;\n exports.OPTION_IDX = 2 << exports.BITS_FOR_OCCURRENCE_IDX;\n exports.MANY_IDX = 3 << exports.BITS_FOR_OCCURRENCE_IDX;\n exports.AT_LEAST_ONE_IDX = 4 << exports.BITS_FOR_OCCURRENCE_IDX;\n exports.MANY_SEP_IDX = 5 << exports.BITS_FOR_OCCURRENCE_IDX;\n exports.AT_LEAST_ONE_SEP_IDX = 6 << exports.BITS_FOR_OCCURRENCE_IDX;\n function getKeyForAutomaticLookahead(ruleIdx, dslMethodIdx, occurrence) {\n return occurrence | dslMethodIdx | ruleIdx;\n }\n exports.getKeyForAutomaticLookahead = getKeyForAutomaticLookahead;\n 32 - exports.BITS_FOR_ALT_IDX;\n})(keys);\nvar llk_lookahead = {};\nvar hasRequiredLlk_lookahead;\nfunction requireLlk_lookahead() {\n if (hasRequiredLlk_lookahead)\n return llk_lookahead;\n hasRequiredLlk_lookahead = 1;\n var __spreadArray = commonjsGlobal && commonjsGlobal.__spreadArray || function(to, from, pack) {\n if (pack || arguments.length === 2)\n for (var i2 = 0, l = from.length, ar; i2 < l; i2++) {\n if (ar || !(i2 in from)) {\n if (!ar)\n ar = Array.prototype.slice.call(from, 0, i2);\n ar[i2] = from[i2];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n };\n var __importDefault2 = commonjsGlobal && commonjsGlobal.__importDefault || function(mod2) {\n return mod2 && mod2.__esModule ? mod2 : { \"default\": mod2 };\n };\n Object.defineProperty(llk_lookahead, \"__esModule\", { value: true });\n llk_lookahead.LLkLookaheadStrategy = void 0;\n var flatMap_1 = __importDefault2(lodash_flatMap__WEBPACK_IMPORTED_MODULE_36__);\n var isEmpty_12 = __importDefault2(lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2__);\n var errors_public_1 = errors_public;\n var parser_1 = requireParser();\n var checks_1 = requireChecks();\n var lookahead_1 = lookahead;\n var LLkLookaheadStrategy = (\n /** @class */\n function() {\n function LLkLookaheadStrategy2(options) {\n var _a2;\n this.maxLookahead = (_a2 = options === null || options === void 0 ? void 0 : options.maxLookahead) !== null && _a2 !== void 0 ? _a2 : parser_1.DEFAULT_PARSER_CONFIG.maxLookahead;\n }\n LLkLookaheadStrategy2.prototype.validate = function(options) {\n var leftRecursionErrors = this.validateNoLeftRecursion(options.rules);\n if ((0, isEmpty_12.default)(leftRecursionErrors)) {\n var emptyAltErrors = this.validateEmptyOrAlternatives(options.rules);\n var ambiguousAltsErrors = this.validateAmbiguousAlternationAlternatives(options.rules, this.maxLookahead);\n var emptyRepetitionErrors = this.validateSomeNonEmptyLookaheadPath(options.rules, this.maxLookahead);\n var allErrors = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], leftRecursionErrors, true), emptyAltErrors, true), ambiguousAltsErrors, true), emptyRepetitionErrors, true);\n return allErrors;\n }\n return leftRecursionErrors;\n };\n LLkLookaheadStrategy2.prototype.validateNoLeftRecursion = function(rules) {\n return (0, flatMap_1.default)(rules, function(currTopRule) {\n return (0, checks_1.validateNoLeftRecursion)(currTopRule, currTopRule, errors_public_1.defaultGrammarValidatorErrorProvider);\n });\n };\n LLkLookaheadStrategy2.prototype.validateEmptyOrAlternatives = function(rules) {\n return (0, flatMap_1.default)(rules, function(currTopRule) {\n return (0, checks_1.validateEmptyOrAlternative)(currTopRule, errors_public_1.defaultGrammarValidatorErrorProvider);\n });\n };\n LLkLookaheadStrategy2.prototype.validateAmbiguousAlternationAlternatives = function(rules, maxLookahead) {\n return (0, flatMap_1.default)(rules, function(currTopRule) {\n return (0, checks_1.validateAmbiguousAlternationAlternatives)(currTopRule, maxLookahead, errors_public_1.defaultGrammarValidatorErrorProvider);\n });\n };\n LLkLookaheadStrategy2.prototype.validateSomeNonEmptyLookaheadPath = function(rules, maxLookahead) {\n return (0, checks_1.validateSomeNonEmptyLookaheadPath)(rules, maxLookahead, errors_public_1.defaultGrammarValidatorErrorProvider);\n };\n LLkLookaheadStrategy2.prototype.buildLookaheadForAlternation = function(options) {\n return (0, lookahead_1.buildLookaheadFuncForOr)(options.prodOccurrence, options.rule, options.maxLookahead, options.hasPredicates, options.dynamicTokensEnabled, lookahead_1.buildAlternativesLookAheadFunc);\n };\n LLkLookaheadStrategy2.prototype.buildLookaheadForOptional = function(options) {\n return (0, lookahead_1.buildLookaheadFuncForOptionalProd)(options.prodOccurrence, options.rule, options.maxLookahead, options.dynamicTokensEnabled, (0, lookahead_1.getProdType)(options.prodType), lookahead_1.buildSingleAlternativeLookaheadFunction);\n };\n return LLkLookaheadStrategy2;\n }()\n );\n llk_lookahead.LLkLookaheadStrategy = LLkLookaheadStrategy;\n return llk_lookahead;\n}\nvar hasRequiredLooksahead;\nfunction requireLooksahead() {\n if (hasRequiredLooksahead)\n return looksahead;\n hasRequiredLooksahead = 1;\n var __extends2 = commonjsGlobal && commonjsGlobal.__extends || function() {\n var extendStatics = function(d, b2) {\n extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b3) {\n d2.__proto__ = b3;\n } || function(d2, b3) {\n for (var p in b3)\n if (Object.prototype.hasOwnProperty.call(b3, p))\n d2[p] = b3[p];\n };\n return extendStatics(d, b2);\n };\n return function(d, b2) {\n if (typeof b2 !== \"function\" && b2 !== null)\n throw new TypeError(\"Class extends value \" + String(b2) + \" is not a constructor or null\");\n extendStatics(d, b2);\n function __() {\n this.constructor = d;\n }\n d.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());\n };\n }();\n var __importDefault2 = commonjsGlobal && commonjsGlobal.__importDefault || function(mod2) {\n return mod2 && mod2.__esModule ? mod2 : { \"default\": mod2 };\n };\n Object.defineProperty(looksahead, \"__esModule\", { value: true });\n looksahead.collectMethods = looksahead.LooksAhead = void 0;\n var forEach_12 = __importDefault2(lodash_forEach__WEBPACK_IMPORTED_MODULE_4__);\n var has_1 = __importDefault2(lodash_has__WEBPACK_IMPORTED_MODULE_6__);\n var parser_1 = requireParser();\n var keys_1 = keys;\n var gast_12 = api$1;\n var gast_22 = api$1;\n var llk_lookahead_1 = requireLlk_lookahead();\n var LooksAhead = (\n /** @class */\n function() {\n function LooksAhead2() {\n }\n LooksAhead2.prototype.initLooksAhead = function(config) {\n this.dynamicTokensEnabled = (0, has_1.default)(config, \"dynamicTokensEnabled\") ? config.dynamicTokensEnabled : parser_1.DEFAULT_PARSER_CONFIG.dynamicTokensEnabled;\n this.maxLookahead = (0, has_1.default)(config, \"maxLookahead\") ? config.maxLookahead : parser_1.DEFAULT_PARSER_CONFIG.maxLookahead;\n this.lookaheadStrategy = (0, has_1.default)(config, \"lookaheadStrategy\") ? config.lookaheadStrategy : new llk_lookahead_1.LLkLookaheadStrategy({ maxLookahead: this.maxLookahead });\n this.lookAheadFuncsCache = /* @__PURE__ */ new Map();\n };\n LooksAhead2.prototype.preComputeLookaheadFunctions = function(rules) {\n var _this = this;\n (0, forEach_12.default)(rules, function(currRule) {\n _this.TRACE_INIT(\"\".concat(currRule.name, \" Rule Lookahead\"), function() {\n var _a2 = collectMethods(currRule), alternation = _a2.alternation, repetition = _a2.repetition, option = _a2.option, repetitionMandatory = _a2.repetitionMandatory, repetitionMandatoryWithSeparator = _a2.repetitionMandatoryWithSeparator, repetitionWithSeparator = _a2.repetitionWithSeparator;\n (0, forEach_12.default)(alternation, function(currProd) {\n var prodIdx = currProd.idx === 0 ? \"\" : currProd.idx;\n _this.TRACE_INIT(\"\".concat((0, gast_22.getProductionDslName)(currProd)).concat(prodIdx), function() {\n var laFunc = _this.lookaheadStrategy.buildLookaheadForAlternation({\n prodOccurrence: currProd.idx,\n rule: currRule,\n maxLookahead: currProd.maxLookahead || _this.maxLookahead,\n hasPredicates: currProd.hasPredicates,\n dynamicTokensEnabled: _this.dynamicTokensEnabled\n });\n var key = (0, keys_1.getKeyForAutomaticLookahead)(_this.fullRuleNameToShort[currRule.name], keys_1.OR_IDX, currProd.idx);\n _this.setLaFuncCache(key, laFunc);\n });\n });\n (0, forEach_12.default)(repetition, function(currProd) {\n _this.computeLookaheadFunc(currRule, currProd.idx, keys_1.MANY_IDX, \"Repetition\", currProd.maxLookahead, (0, gast_22.getProductionDslName)(currProd));\n });\n (0, forEach_12.default)(option, function(currProd) {\n _this.computeLookaheadFunc(currRule, currProd.idx, keys_1.OPTION_IDX, \"Option\", currProd.maxLookahead, (0, gast_22.getProductionDslName)(currProd));\n });\n (0, forEach_12.default)(repetitionMandatory, function(currProd) {\n _this.computeLookaheadFunc(currRule, currProd.idx, keys_1.AT_LEAST_ONE_IDX, \"RepetitionMandatory\", currProd.maxLookahead, (0, gast_22.getProductionDslName)(currProd));\n });\n (0, forEach_12.default)(repetitionMandatoryWithSeparator, function(currProd) {\n _this.computeLookaheadFunc(currRule, currProd.idx, keys_1.AT_LEAST_ONE_SEP_IDX, \"RepetitionMandatoryWithSeparator\", currProd.maxLookahead, (0, gast_22.getProductionDslName)(currProd));\n });\n (0, forEach_12.default)(repetitionWithSeparator, function(currProd) {\n _this.computeLookaheadFunc(currRule, currProd.idx, keys_1.MANY_SEP_IDX, \"RepetitionWithSeparator\", currProd.maxLookahead, (0, gast_22.getProductionDslName)(currProd));\n });\n });\n });\n };\n LooksAhead2.prototype.computeLookaheadFunc = function(rule, prodOccurrence, prodKey, prodType, prodMaxLookahead, dslMethodName) {\n var _this = this;\n this.TRACE_INIT(\"\".concat(dslMethodName).concat(prodOccurrence === 0 ? \"\" : prodOccurrence), function() {\n var laFunc = _this.lookaheadStrategy.buildLookaheadForOptional({\n prodOccurrence,\n rule,\n maxLookahead: prodMaxLookahead || _this.maxLookahead,\n dynamicTokensEnabled: _this.dynamicTokensEnabled,\n prodType\n });\n var key = (0, keys_1.getKeyForAutomaticLookahead)(_this.fullRuleNameToShort[rule.name], prodKey, prodOccurrence);\n _this.setLaFuncCache(key, laFunc);\n });\n };\n LooksAhead2.prototype.getKeyForAutomaticLookahead = function(dslMethodIdx, occurrence) {\n var currRuleShortName = this.getLastExplicitRuleShortName();\n return (0, keys_1.getKeyForAutomaticLookahead)(currRuleShortName, dslMethodIdx, occurrence);\n };\n LooksAhead2.prototype.getLaFuncFromCache = function(key) {\n return this.lookAheadFuncsCache.get(key);\n };\n LooksAhead2.prototype.setLaFuncCache = function(key, value) {\n this.lookAheadFuncsCache.set(key, value);\n };\n return LooksAhead2;\n }()\n );\n looksahead.LooksAhead = LooksAhead;\n var DslMethodsCollectorVisitor = (\n /** @class */\n function(_super) {\n __extends2(DslMethodsCollectorVisitor2, _super);\n function DslMethodsCollectorVisitor2() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.dslMethods = {\n option: [],\n alternation: [],\n repetition: [],\n repetitionWithSeparator: [],\n repetitionMandatory: [],\n repetitionMandatoryWithSeparator: []\n };\n return _this;\n }\n DslMethodsCollectorVisitor2.prototype.reset = function() {\n this.dslMethods = {\n option: [],\n alternation: [],\n repetition: [],\n repetitionWithSeparator: [],\n repetitionMandatory: [],\n repetitionMandatoryWithSeparator: []\n };\n };\n DslMethodsCollectorVisitor2.prototype.visitOption = function(option) {\n this.dslMethods.option.push(option);\n };\n DslMethodsCollectorVisitor2.prototype.visitRepetitionWithSeparator = function(manySep) {\n this.dslMethods.repetitionWithSeparator.push(manySep);\n };\n DslMethodsCollectorVisitor2.prototype.visitRepetitionMandatory = function(atLeastOne) {\n this.dslMethods.repetitionMandatory.push(atLeastOne);\n };\n DslMethodsCollectorVisitor2.prototype.visitRepetitionMandatoryWithSeparator = function(atLeastOneSep) {\n this.dslMethods.repetitionMandatoryWithSeparator.push(atLeastOneSep);\n };\n DslMethodsCollectorVisitor2.prototype.visitRepetition = function(many) {\n this.dslMethods.repetition.push(many);\n };\n DslMethodsCollectorVisitor2.prototype.visitAlternation = function(or) {\n this.dslMethods.alternation.push(or);\n };\n return DslMethodsCollectorVisitor2;\n }(gast_12.GAstVisitor)\n );\n var collectorVisitor = new DslMethodsCollectorVisitor();\n function collectMethods(rule) {\n collectorVisitor.reset();\n rule.accept(collectorVisitor);\n var dslMethods = collectorVisitor.dslMethods;\n collectorVisitor.reset();\n return dslMethods;\n }\n looksahead.collectMethods = collectMethods;\n return looksahead;\n}\nvar tree_builder = {};\nvar cst = {};\nObject.defineProperty(cst, \"__esModule\", { value: true });\ncst.addNoneTerminalToCst = cst.addTerminalToCst = cst.setNodeLocationFull = cst.setNodeLocationOnlyOffset = void 0;\nfunction setNodeLocationOnlyOffset(currNodeLocation, newLocationInfo) {\n if (isNaN(currNodeLocation.startOffset) === true) {\n currNodeLocation.startOffset = newLocationInfo.startOffset;\n currNodeLocation.endOffset = newLocationInfo.endOffset;\n } else if (currNodeLocation.endOffset < newLocationInfo.endOffset === true) {\n currNodeLocation.endOffset = newLocationInfo.endOffset;\n }\n}\ncst.setNodeLocationOnlyOffset = setNodeLocationOnlyOffset;\nfunction setNodeLocationFull(currNodeLocation, newLocationInfo) {\n if (isNaN(currNodeLocation.startOffset) === true) {\n currNodeLocation.startOffset = newLocationInfo.startOffset;\n currNodeLocation.startColumn = newLocationInfo.startColumn;\n currNodeLocation.startLine = newLocationInfo.startLine;\n currNodeLocation.endOffset = newLocationInfo.endOffset;\n currNodeLocation.endColumn = newLocationInfo.endColumn;\n currNodeLocation.endLine = newLocationInfo.endLine;\n } else if (currNodeLocation.endOffset < newLocationInfo.endOffset === true) {\n currNodeLocation.endOffset = newLocationInfo.endOffset;\n currNodeLocation.endColumn = newLocationInfo.endColumn;\n currNodeLocation.endLine = newLocationInfo.endLine;\n }\n}\ncst.setNodeLocationFull = setNodeLocationFull;\nfunction addTerminalToCst(node, token, tokenTypeName) {\n if (node.children[tokenTypeName] === void 0) {\n node.children[tokenTypeName] = [token];\n } else {\n node.children[tokenTypeName].push(token);\n }\n}\ncst.addTerminalToCst = addTerminalToCst;\nfunction addNoneTerminalToCst(node, ruleName, ruleResult) {\n if (node.children[ruleName] === void 0) {\n node.children[ruleName] = [ruleResult];\n } else {\n node.children[ruleName].push(ruleResult);\n }\n}\ncst.addNoneTerminalToCst = addNoneTerminalToCst;\nvar cst_visitor = {};\nvar lang_extensions = {};\nObject.defineProperty(lang_extensions, \"__esModule\", { value: true });\nlang_extensions.defineNameProp = void 0;\nvar NAME = \"name\";\nfunction defineNameProp(obj, nameValue) {\n Object.defineProperty(obj, NAME, {\n enumerable: false,\n configurable: true,\n writable: false,\n value: nameValue\n });\n}\nlang_extensions.defineNameProp = defineNameProp;\n(function(exports) {\n var __importDefault2 = commonjsGlobal && commonjsGlobal.__importDefault || function(mod2) {\n return mod2 && mod2.__esModule ? mod2 : { \"default\": mod2 };\n };\n Object.defineProperty(exports, \"__esModule\", { value: true });\n exports.validateMissingCstMethods = exports.validateVisitor = exports.CstVisitorDefinitionError = exports.createBaseVisitorConstructorWithDefaults = exports.createBaseSemanticVisitorConstructor = exports.defaultVisit = void 0;\n var isEmpty_12 = __importDefault2(lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2__);\n var compact_1 = __importDefault2(lodash_compact__WEBPACK_IMPORTED_MODULE_21__);\n var isArray_12 = __importDefault2(lodash_isArray__WEBPACK_IMPORTED_MODULE_22__);\n var map_12 = __importDefault2(lodash_map__WEBPACK_IMPORTED_MODULE_3__);\n var forEach_12 = __importDefault2(lodash_forEach__WEBPACK_IMPORTED_MODULE_4__);\n var filter_1 = __importDefault2(lodash_filter__WEBPACK_IMPORTED_MODULE_29__);\n var keys_1 = __importDefault2(lodash_keys__WEBPACK_IMPORTED_MODULE_28__);\n var isFunction_1 = __importDefault2(lodash_isFunction__WEBPACK_IMPORTED_MODULE_26__);\n var isUndefined_12 = __importDefault2(lodash_isUndefined__WEBPACK_IMPORTED_MODULE_18__);\n var lang_extensions_1 = lang_extensions;\n function defaultVisit(ctx, param) {\n var childrenNames = (0, keys_1.default)(ctx);\n var childrenNamesLength = childrenNames.length;\n for (var i2 = 0; i2 < childrenNamesLength; i2++) {\n var currChildName = childrenNames[i2];\n var currChildArray = ctx[currChildName];\n var currChildArrayLength = currChildArray.length;\n for (var j = 0; j < currChildArrayLength; j++) {\n var currChild = currChildArray[j];\n if (currChild.tokenTypeIdx === void 0) {\n this[currChild.name](currChild.children, param);\n }\n }\n }\n }\n exports.defaultVisit = defaultVisit;\n function createBaseSemanticVisitorConstructor(grammarName, ruleNames) {\n var derivedConstructor = function() {\n };\n (0, lang_extensions_1.defineNameProp)(derivedConstructor, grammarName + \"BaseSemantics\");\n var semanticProto = {\n visit: function(cstNode, param) {\n if ((0, isArray_12.default)(cstNode)) {\n cstNode = cstNode[0];\n }\n if ((0, isUndefined_12.default)(cstNode)) {\n return void 0;\n }\n return this[cstNode.name](cstNode.children, param);\n },\n validateVisitor: function() {\n var semanticDefinitionErrors = validateVisitor(this, ruleNames);\n if (!(0, isEmpty_12.default)(semanticDefinitionErrors)) {\n var errorMessages = (0, map_12.default)(semanticDefinitionErrors, function(currDefError) {\n return currDefError.msg;\n });\n throw Error(\"Errors Detected in CST Visitor <\".concat(this.constructor.name, \">:\\n\t\") + \"\".concat(errorMessages.join(\"\\n\\n\").replace(/\\n/g, \"\\n\t\")));\n }\n }\n };\n derivedConstructor.prototype = semanticProto;\n derivedConstructor.prototype.constructor = derivedConstructor;\n derivedConstructor._RULE_NAMES = ruleNames;\n return derivedConstructor;\n }\n exports.createBaseSemanticVisitorConstructor = createBaseSemanticVisitorConstructor;\n function createBaseVisitorConstructorWithDefaults(grammarName, ruleNames, baseConstructor) {\n var derivedConstructor = function() {\n };\n (0, lang_extensions_1.defineNameProp)(derivedConstructor, grammarName + \"BaseSemanticsWithDefaults\");\n var withDefaultsProto = Object.create(baseConstructor.prototype);\n (0, forEach_12.default)(ruleNames, function(ruleName) {\n withDefaultsProto[ruleName] = defaultVisit;\n });\n derivedConstructor.prototype = withDefaultsProto;\n derivedConstructor.prototype.constructor = derivedConstructor;\n return derivedConstructor;\n }\n exports.createBaseVisitorConstructorWithDefaults = createBaseVisitorConstructorWithDefaults;\n var CstVisitorDefinitionError;\n (function(CstVisitorDefinitionError2) {\n CstVisitorDefinitionError2[CstVisitorDefinitionError2[\"REDUNDANT_METHOD\"] = 0] = \"REDUNDANT_METHOD\";\n CstVisitorDefinitionError2[CstVisitorDefinitionError2[\"MISSING_METHOD\"] = 1] = \"MISSING_METHOD\";\n })(CstVisitorDefinitionError = exports.CstVisitorDefinitionError || (exports.CstVisitorDefinitionError = {}));\n function validateVisitor(visitorInstance, ruleNames) {\n var missingErrors = validateMissingCstMethods(visitorInstance, ruleNames);\n return missingErrors;\n }\n exports.validateVisitor = validateVisitor;\n function validateMissingCstMethods(visitorInstance, ruleNames) {\n var missingRuleNames = (0, filter_1.default)(ruleNames, function(currRuleName) {\n return (0, isFunction_1.default)(visitorInstance[currRuleName]) === false;\n });\n var errors = (0, map_12.default)(missingRuleNames, function(currRuleName) {\n return {\n msg: \"Missing visitor method: <\".concat(currRuleName, \"> on \").concat(visitorInstance.constructor.name, \" CST Visitor.\"),\n type: CstVisitorDefinitionError.MISSING_METHOD,\n methodName: currRuleName\n };\n });\n return (0, compact_1.default)(errors);\n }\n exports.validateMissingCstMethods = validateMissingCstMethods;\n})(cst_visitor);\nvar hasRequiredTree_builder;\nfunction requireTree_builder() {\n if (hasRequiredTree_builder)\n return tree_builder;\n hasRequiredTree_builder = 1;\n var __importDefault2 = commonjsGlobal && commonjsGlobal.__importDefault || function(mod2) {\n return mod2 && mod2.__esModule ? mod2 : { \"default\": mod2 };\n };\n Object.defineProperty(tree_builder, \"__esModule\", { value: true });\n tree_builder.TreeBuilder = void 0;\n var cst_1 = cst;\n var noop_1 = __importDefault2(lodash_noop__WEBPACK_IMPORTED_MODULE_32__);\n var has_1 = __importDefault2(lodash_has__WEBPACK_IMPORTED_MODULE_6__);\n var keys_1 = __importDefault2(lodash_keys__WEBPACK_IMPORTED_MODULE_28__);\n var isUndefined_12 = __importDefault2(lodash_isUndefined__WEBPACK_IMPORTED_MODULE_18__);\n var cst_visitor_1 = cst_visitor;\n var parser_1 = requireParser();\n var TreeBuilder = (\n /** @class */\n function() {\n function TreeBuilder2() {\n }\n TreeBuilder2.prototype.initTreeBuilder = function(config) {\n this.CST_STACK = [];\n this.outputCst = config.outputCst;\n this.nodeLocationTracking = (0, has_1.default)(config, \"nodeLocationTracking\") ? config.nodeLocationTracking : parser_1.DEFAULT_PARSER_CONFIG.nodeLocationTracking;\n if (!this.outputCst) {\n this.cstInvocationStateUpdate = noop_1.default;\n this.cstFinallyStateUpdate = noop_1.default;\n this.cstPostTerminal = noop_1.default;\n this.cstPostNonTerminal = noop_1.default;\n this.cstPostRule = noop_1.default;\n } else {\n if (/full/i.test(this.nodeLocationTracking)) {\n if (this.recoveryEnabled) {\n this.setNodeLocationFromToken = cst_1.setNodeLocationFull;\n this.setNodeLocationFromNode = cst_1.setNodeLocationFull;\n this.cstPostRule = noop_1.default;\n this.setInitialNodeLocation = this.setInitialNodeLocationFullRecovery;\n } else {\n this.setNodeLocationFromToken = noop_1.default;\n this.setNodeLocationFromNode = noop_1.default;\n this.cstPostRule = this.cstPostRuleFull;\n this.setInitialNodeLocation = this.setInitialNodeLocationFullRegular;\n }\n } else if (/onlyOffset/i.test(this.nodeLocationTracking)) {\n if (this.recoveryEnabled) {\n this.setNodeLocationFromToken = cst_1.setNodeLocationOnlyOffset;\n this.setNodeLocationFromNode = cst_1.setNodeLocationOnlyOffset;\n this.cstPostRule = noop_1.default;\n this.setInitialNodeLocation = this.setInitialNodeLocationOnlyOffsetRecovery;\n } else {\n this.setNodeLocationFromToken = noop_1.default;\n this.setNodeLocationFromNode = noop_1.default;\n this.cstPostRule = this.cstPostRuleOnlyOffset;\n this.setInitialNodeLocation = this.setInitialNodeLocationOnlyOffsetRegular;\n }\n } else if (/none/i.test(this.nodeLocationTracking)) {\n this.setNodeLocationFromToken = noop_1.default;\n this.setNodeLocationFromNode = noop_1.default;\n this.cstPostRule = noop_1.default;\n this.setInitialNodeLocation = noop_1.default;\n } else {\n throw Error('Invalid config option: \"'.concat(config.nodeLocationTracking, '\"'));\n }\n }\n };\n TreeBuilder2.prototype.setInitialNodeLocationOnlyOffsetRecovery = function(cstNode) {\n cstNode.location = {\n startOffset: NaN,\n endOffset: NaN\n };\n };\n TreeBuilder2.prototype.setInitialNodeLocationOnlyOffsetRegular = function(cstNode) {\n cstNode.location = {\n // without error recovery the starting Location of a new CstNode is guaranteed\n // To be the next Token's startOffset (for valid inputs).\n // For invalid inputs there won't be any CSTOutput so this potential\n // inaccuracy does not matter\n startOffset: this.LA(1).startOffset,\n endOffset: NaN\n };\n };\n TreeBuilder2.prototype.setInitialNodeLocationFullRecovery = function(cstNode) {\n cstNode.location = {\n startOffset: NaN,\n startLine: NaN,\n startColumn: NaN,\n endOffset: NaN,\n endLine: NaN,\n endColumn: NaN\n };\n };\n TreeBuilder2.prototype.setInitialNodeLocationFullRegular = function(cstNode) {\n var nextToken = this.LA(1);\n cstNode.location = {\n startOffset: nextToken.startOffset,\n startLine: nextToken.startLine,\n startColumn: nextToken.startColumn,\n endOffset: NaN,\n endLine: NaN,\n endColumn: NaN\n };\n };\n TreeBuilder2.prototype.cstInvocationStateUpdate = function(fullRuleName) {\n var cstNode = {\n name: fullRuleName,\n children: /* @__PURE__ */ Object.create(null)\n };\n this.setInitialNodeLocation(cstNode);\n this.CST_STACK.push(cstNode);\n };\n TreeBuilder2.prototype.cstFinallyStateUpdate = function() {\n this.CST_STACK.pop();\n };\n TreeBuilder2.prototype.cstPostRuleFull = function(ruleCstNode) {\n var prevToken = this.LA(0);\n var loc = ruleCstNode.location;\n if (loc.startOffset <= prevToken.startOffset === true) {\n loc.endOffset = prevToken.endOffset;\n loc.endLine = prevToken.endLine;\n loc.endColumn = prevToken.endColumn;\n } else {\n loc.startOffset = NaN;\n loc.startLine = NaN;\n loc.startColumn = NaN;\n }\n };\n TreeBuilder2.prototype.cstPostRuleOnlyOffset = function(ruleCstNode) {\n var prevToken = this.LA(0);\n var loc = ruleCstNode.location;\n if (loc.startOffset <= prevToken.startOffset === true) {\n loc.endOffset = prevToken.endOffset;\n } else {\n loc.startOffset = NaN;\n }\n };\n TreeBuilder2.prototype.cstPostTerminal = function(key, consumedToken) {\n var rootCst = this.CST_STACK[this.CST_STACK.length - 1];\n (0, cst_1.addTerminalToCst)(rootCst, consumedToken, key);\n this.setNodeLocationFromToken(rootCst.location, consumedToken);\n };\n TreeBuilder2.prototype.cstPostNonTerminal = function(ruleCstResult, ruleName) {\n var preCstNode = this.CST_STACK[this.CST_STACK.length - 1];\n (0, cst_1.addNoneTerminalToCst)(preCstNode, ruleName, ruleCstResult);\n this.setNodeLocationFromNode(preCstNode.location, ruleCstResult.location);\n };\n TreeBuilder2.prototype.getBaseCstVisitorConstructor = function() {\n if ((0, isUndefined_12.default)(this.baseCstVisitorConstructor)) {\n var newBaseCstVisitorConstructor = (0, cst_visitor_1.createBaseSemanticVisitorConstructor)(this.className, (0, keys_1.default)(this.gastProductionsCache));\n this.baseCstVisitorConstructor = newBaseCstVisitorConstructor;\n return newBaseCstVisitorConstructor;\n }\n return this.baseCstVisitorConstructor;\n };\n TreeBuilder2.prototype.getBaseCstVisitorConstructorWithDefaults = function() {\n if ((0, isUndefined_12.default)(this.baseCstVisitorWithDefaultsConstructor)) {\n var newConstructor = (0, cst_visitor_1.createBaseVisitorConstructorWithDefaults)(this.className, (0, keys_1.default)(this.gastProductionsCache), this.getBaseCstVisitorConstructor());\n this.baseCstVisitorWithDefaultsConstructor = newConstructor;\n return newConstructor;\n }\n return this.baseCstVisitorWithDefaultsConstructor;\n };\n TreeBuilder2.prototype.getLastExplicitRuleShortName = function() {\n var ruleStack = this.RULE_STACK;\n return ruleStack[ruleStack.length - 1];\n };\n TreeBuilder2.prototype.getPreviousExplicitRuleShortName = function() {\n var ruleStack = this.RULE_STACK;\n return ruleStack[ruleStack.length - 2];\n };\n TreeBuilder2.prototype.getLastExplicitRuleOccurrenceIndex = function() {\n var occurrenceStack = this.RULE_OCCURRENCE_STACK;\n return occurrenceStack[occurrenceStack.length - 1];\n };\n return TreeBuilder2;\n }()\n );\n tree_builder.TreeBuilder = TreeBuilder;\n return tree_builder;\n}\nvar lexer_adapter = {};\nvar hasRequiredLexer_adapter;\nfunction requireLexer_adapter() {\n if (hasRequiredLexer_adapter)\n return lexer_adapter;\n hasRequiredLexer_adapter = 1;\n Object.defineProperty(lexer_adapter, \"__esModule\", { value: true });\n lexer_adapter.LexerAdapter = void 0;\n var parser_1 = requireParser();\n var LexerAdapter = (\n /** @class */\n function() {\n function LexerAdapter2() {\n }\n LexerAdapter2.prototype.initLexerAdapter = function() {\n this.tokVector = [];\n this.tokVectorLength = 0;\n this.currIdx = -1;\n };\n Object.defineProperty(LexerAdapter2.prototype, \"input\", {\n get: function() {\n return this.tokVector;\n },\n set: function(newInput) {\n if (this.selfAnalysisDone !== true) {\n throw Error(\"Missing invocation at the end of the Parser's constructor.\");\n }\n this.reset();\n this.tokVector = newInput;\n this.tokVectorLength = newInput.length;\n },\n enumerable: false,\n configurable: true\n });\n LexerAdapter2.prototype.SKIP_TOKEN = function() {\n if (this.currIdx <= this.tokVector.length - 2) {\n this.consumeToken();\n return this.LA(1);\n } else {\n return parser_1.END_OF_FILE;\n }\n };\n LexerAdapter2.prototype.LA = function(howMuch) {\n var soughtIdx = this.currIdx + howMuch;\n if (soughtIdx < 0 || this.tokVectorLength <= soughtIdx) {\n return parser_1.END_OF_FILE;\n } else {\n return this.tokVector[soughtIdx];\n }\n };\n LexerAdapter2.prototype.consumeToken = function() {\n this.currIdx++;\n };\n LexerAdapter2.prototype.exportLexerState = function() {\n return this.currIdx;\n };\n LexerAdapter2.prototype.importLexerState = function(newState) {\n this.currIdx = newState;\n };\n LexerAdapter2.prototype.resetLexerState = function() {\n this.currIdx = -1;\n };\n LexerAdapter2.prototype.moveToTerminatedState = function() {\n this.currIdx = this.tokVector.length - 1;\n };\n LexerAdapter2.prototype.getLexerPosition = function() {\n return this.exportLexerState();\n };\n return LexerAdapter2;\n }()\n );\n lexer_adapter.LexerAdapter = LexerAdapter;\n return lexer_adapter;\n}\nvar recognizer_api = {};\nvar hasRequiredRecognizer_api;\nfunction requireRecognizer_api() {\n if (hasRequiredRecognizer_api)\n return recognizer_api;\n hasRequiredRecognizer_api = 1;\n var __importDefault2 = commonjsGlobal && commonjsGlobal.__importDefault || function(mod2) {\n return mod2 && mod2.__esModule ? mod2 : { \"default\": mod2 };\n };\n Object.defineProperty(recognizer_api, \"__esModule\", { value: true });\n recognizer_api.RecognizerApi = void 0;\n var values_12 = __importDefault2(lodash_values__WEBPACK_IMPORTED_MODULE_5__);\n var includes_12 = __importDefault2(lodash_includes__WEBPACK_IMPORTED_MODULE_15__);\n var exceptions_public_1 = exceptions_public;\n var parser_1 = requireParser();\n var errors_public_1 = errors_public;\n var checks_1 = requireChecks();\n var gast_12 = api$1;\n var RecognizerApi = (\n /** @class */\n function() {\n function RecognizerApi2() {\n }\n RecognizerApi2.prototype.ACTION = function(impl) {\n return impl.call(this);\n };\n RecognizerApi2.prototype.consume = function(idx, tokType, options) {\n return this.consumeInternal(tokType, idx, options);\n };\n RecognizerApi2.prototype.subrule = function(idx, ruleToCall, options) {\n return this.subruleInternal(ruleToCall, idx, options);\n };\n RecognizerApi2.prototype.option = function(idx, actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, idx);\n };\n RecognizerApi2.prototype.or = function(idx, altsOrOpts) {\n return this.orInternal(altsOrOpts, idx);\n };\n RecognizerApi2.prototype.many = function(idx, actionORMethodDef) {\n return this.manyInternal(idx, actionORMethodDef);\n };\n RecognizerApi2.prototype.atLeastOne = function(idx, actionORMethodDef) {\n return this.atLeastOneInternal(idx, actionORMethodDef);\n };\n RecognizerApi2.prototype.CONSUME = function(tokType, options) {\n return this.consumeInternal(tokType, 0, options);\n };\n RecognizerApi2.prototype.CONSUME1 = function(tokType, options) {\n return this.consumeInternal(tokType, 1, options);\n };\n RecognizerApi2.prototype.CONSUME2 = function(tokType, options) {\n return this.consumeInternal(tokType, 2, options);\n };\n RecognizerApi2.prototype.CONSUME3 = function(tokType, options) {\n return this.consumeInternal(tokType, 3, options);\n };\n RecognizerApi2.prototype.CONSUME4 = function(tokType, options) {\n return this.consumeInternal(tokType, 4, options);\n };\n RecognizerApi2.prototype.CONSUME5 = function(tokType, options) {\n return this.consumeInternal(tokType, 5, options);\n };\n RecognizerApi2.prototype.CONSUME6 = function(tokType, options) {\n return this.consumeInternal(tokType, 6, options);\n };\n RecognizerApi2.prototype.CONSUME7 = function(tokType, options) {\n return this.consumeInternal(tokType, 7, options);\n };\n RecognizerApi2.prototype.CONSUME8 = function(tokType, options) {\n return this.consumeInternal(tokType, 8, options);\n };\n RecognizerApi2.prototype.CONSUME9 = function(tokType, options) {\n return this.consumeInternal(tokType, 9, options);\n };\n RecognizerApi2.prototype.SUBRULE = function(ruleToCall, options) {\n return this.subruleInternal(ruleToCall, 0, options);\n };\n RecognizerApi2.prototype.SUBRULE1 = function(ruleToCall, options) {\n return this.subruleInternal(ruleToCall, 1, options);\n };\n RecognizerApi2.prototype.SUBRULE2 = function(ruleToCall, options) {\n return this.subruleInternal(ruleToCall, 2, options);\n };\n RecognizerApi2.prototype.SUBRULE3 = function(ruleToCall, options) {\n return this.subruleInternal(ruleToCall, 3, options);\n };\n RecognizerApi2.prototype.SUBRULE4 = function(ruleToCall, options) {\n return this.subruleInternal(ruleToCall, 4, options);\n };\n RecognizerApi2.prototype.SUBRULE5 = function(ruleToCall, options) {\n return this.subruleInternal(ruleToCall, 5, options);\n };\n RecognizerApi2.prototype.SUBRULE6 = function(ruleToCall, options) {\n return this.subruleInternal(ruleToCall, 6, options);\n };\n RecognizerApi2.prototype.SUBRULE7 = function(ruleToCall, options) {\n return this.subruleInternal(ruleToCall, 7, options);\n };\n RecognizerApi2.prototype.SUBRULE8 = function(ruleToCall, options) {\n return this.subruleInternal(ruleToCall, 8, options);\n };\n RecognizerApi2.prototype.SUBRULE9 = function(ruleToCall, options) {\n return this.subruleInternal(ruleToCall, 9, options);\n };\n RecognizerApi2.prototype.OPTION = function(actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, 0);\n };\n RecognizerApi2.prototype.OPTION1 = function(actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, 1);\n };\n RecognizerApi2.prototype.OPTION2 = function(actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, 2);\n };\n RecognizerApi2.prototype.OPTION3 = function(actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, 3);\n };\n RecognizerApi2.prototype.OPTION4 = function(actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, 4);\n };\n RecognizerApi2.prototype.OPTION5 = function(actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, 5);\n };\n RecognizerApi2.prototype.OPTION6 = function(actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, 6);\n };\n RecognizerApi2.prototype.OPTION7 = function(actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, 7);\n };\n RecognizerApi2.prototype.OPTION8 = function(actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, 8);\n };\n RecognizerApi2.prototype.OPTION9 = function(actionORMethodDef) {\n return this.optionInternal(actionORMethodDef, 9);\n };\n RecognizerApi2.prototype.OR = function(altsOrOpts) {\n return this.orInternal(altsOrOpts, 0);\n };\n RecognizerApi2.prototype.OR1 = function(altsOrOpts) {\n return this.orInternal(altsOrOpts, 1);\n };\n RecognizerApi2.prototype.OR2 = function(altsOrOpts) {\n return this.orInternal(altsOrOpts, 2);\n };\n RecognizerApi2.prototype.OR3 = function(altsOrOpts) {\n return this.orInternal(altsOrOpts, 3);\n };\n RecognizerApi2.prototype.OR4 = function(altsOrOpts) {\n return this.orInternal(altsOrOpts, 4);\n };\n RecognizerApi2.prototype.OR5 = function(altsOrOpts) {\n return this.orInternal(altsOrOpts, 5);\n };\n RecognizerApi2.prototype.OR6 = function(altsOrOpts) {\n return this.orInternal(altsOrOpts, 6);\n };\n RecognizerApi2.prototype.OR7 = function(altsOrOpts) {\n return this.orInternal(altsOrOpts, 7);\n };\n RecognizerApi2.prototype.OR8 = function(altsOrOpts) {\n return this.orInternal(altsOrOpts, 8);\n };\n RecognizerApi2.prototype.OR9 = function(altsOrOpts) {\n return this.orInternal(altsOrOpts, 9);\n };\n RecognizerApi2.prototype.MANY = function(actionORMethodDef) {\n this.manyInternal(0, actionORMethodDef);\n };\n RecognizerApi2.prototype.MANY1 = function(actionORMethodDef) {\n this.manyInternal(1, actionORMethodDef);\n };\n RecognizerApi2.prototype.MANY2 = function(actionORMethodDef) {\n this.manyInternal(2, actionORMethodDef);\n };\n RecognizerApi2.prototype.MANY3 = function(actionORMethodDef) {\n this.manyInternal(3, actionORMethodDef);\n };\n RecognizerApi2.prototype.MANY4 = function(actionORMethodDef) {\n this.manyInternal(4, actionORMethodDef);\n };\n RecognizerApi2.prototype.MANY5 = function(actionORMethodDef) {\n this.manyInternal(5, actionORMethodDef);\n };\n RecognizerApi2.prototype.MANY6 = function(actionORMethodDef) {\n this.manyInternal(6, actionORMethodDef);\n };\n RecognizerApi2.prototype.MANY7 = function(actionORMethodDef) {\n this.manyInternal(7, actionORMethodDef);\n };\n RecognizerApi2.prototype.MANY8 = function(actionORMethodDef) {\n this.manyInternal(8, actionORMethodDef);\n };\n RecognizerApi2.prototype.MANY9 = function(actionORMethodDef) {\n this.manyInternal(9, actionORMethodDef);\n };\n RecognizerApi2.prototype.MANY_SEP = function(options) {\n this.manySepFirstInternal(0, options);\n };\n RecognizerApi2.prototype.MANY_SEP1 = function(options) {\n this.manySepFirstInternal(1, options);\n };\n RecognizerApi2.prototype.MANY_SEP2 = function(options) {\n this.manySepFirstInternal(2, options);\n };\n RecognizerApi2.prototype.MANY_SEP3 = function(options) {\n this.manySepFirstInternal(3, options);\n };\n RecognizerApi2.prototype.MANY_SEP4 = function(options) {\n this.manySepFirstInternal(4, options);\n };\n RecognizerApi2.prototype.MANY_SEP5 = function(options) {\n this.manySepFirstInternal(5, options);\n };\n RecognizerApi2.prototype.MANY_SEP6 = function(options) {\n this.manySepFirstInternal(6, options);\n };\n RecognizerApi2.prototype.MANY_SEP7 = function(options) {\n this.manySepFirstInternal(7, options);\n };\n RecognizerApi2.prototype.MANY_SEP8 = function(options) {\n this.manySepFirstInternal(8, options);\n };\n RecognizerApi2.prototype.MANY_SEP9 = function(options) {\n this.manySepFirstInternal(9, options);\n };\n RecognizerApi2.prototype.AT_LEAST_ONE = function(actionORMethodDef) {\n this.atLeastOneInternal(0, actionORMethodDef);\n };\n RecognizerApi2.prototype.AT_LEAST_ONE1 = function(actionORMethodDef) {\n return this.atLeastOneInternal(1, actionORMethodDef);\n };\n RecognizerApi2.prototype.AT_LEAST_ONE2 = function(actionORMethodDef) {\n this.atLeastOneInternal(2, actionORMethodDef);\n };\n RecognizerApi2.prototype.AT_LEAST_ONE3 = function(actionORMethodDef) {\n this.atLeastOneInternal(3, actionORMethodDef);\n };\n RecognizerApi2.prototype.AT_LEAST_ONE4 = function(actionORMethodDef) {\n this.atLeastOneInternal(4, actionORMethodDef);\n };\n RecognizerApi2.prototype.AT_LEAST_ONE5 = function(actionORMethodDef) {\n this.atLeastOneInternal(5, actionORMethodDef);\n };\n RecognizerApi2.prototype.AT_LEAST_ONE6 = function(actionORMethodDef) {\n this.atLeastOneInternal(6, actionORMethodDef);\n };\n RecognizerApi2.prototype.AT_LEAST_ONE7 = function(actionORMethodDef) {\n this.atLeastOneInternal(7, actionORMethodDef);\n };\n RecognizerApi2.prototype.AT_LEAST_ONE8 = function(actionORMethodDef) {\n this.atLeastOneInternal(8, actionORMethodDef);\n };\n RecognizerApi2.prototype.AT_LEAST_ONE9 = function(actionORMethodDef) {\n this.atLeastOneInternal(9, actionORMethodDef);\n };\n RecognizerApi2.prototype.AT_LEAST_ONE_SEP = function(options) {\n this.atLeastOneSepFirstInternal(0, options);\n };\n RecognizerApi2.prototype.AT_LEAST_ONE_SEP1 = function(options) {\n this.atLeastOneSepFirstInternal(1, options);\n };\n RecognizerApi2.prototype.AT_LEAST_ONE_SEP2 = function(options) {\n this.atLeastOneSepFirstInternal(2, options);\n };\n RecognizerApi2.prototype.AT_LEAST_ONE_SEP3 = function(options) {\n this.atLeastOneSepFirstInternal(3, options);\n };\n RecognizerApi2.prototype.AT_LEAST_ONE_SEP4 = function(options) {\n this.atLeastOneSepFirstInternal(4, options);\n };\n RecognizerApi2.prototype.AT_LEAST_ONE_SEP5 = function(options) {\n this.atLeastOneSepFirstInternal(5, options);\n };\n RecognizerApi2.prototype.AT_LEAST_ONE_SEP6 = function(options) {\n this.atLeastOneSepFirstInternal(6, options);\n };\n RecognizerApi2.prototype.AT_LEAST_ONE_SEP7 = function(options) {\n this.atLeastOneSepFirstInternal(7, options);\n };\n RecognizerApi2.prototype.AT_LEAST_ONE_SEP8 = function(options) {\n this.atLeastOneSepFirstInternal(8, options);\n };\n RecognizerApi2.prototype.AT_LEAST_ONE_SEP9 = function(options) {\n this.atLeastOneSepFirstInternal(9, options);\n };\n RecognizerApi2.prototype.RULE = function(name, implementation, config) {\n if (config === void 0) {\n config = parser_1.DEFAULT_RULE_CONFIG;\n }\n if ((0, includes_12.default)(this.definedRulesNames, name)) {\n var errMsg = errors_public_1.defaultGrammarValidatorErrorProvider.buildDuplicateRuleNameError({\n topLevelRule: name,\n grammarName: this.className\n });\n var error = {\n message: errMsg,\n type: parser_1.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,\n ruleName: name\n };\n this.definitionErrors.push(error);\n }\n this.definedRulesNames.push(name);\n var ruleImplementation = this.defineRule(name, implementation, config);\n this[name] = ruleImplementation;\n return ruleImplementation;\n };\n RecognizerApi2.prototype.OVERRIDE_RULE = function(name, impl, config) {\n if (config === void 0) {\n config = parser_1.DEFAULT_RULE_CONFIG;\n }\n var ruleErrors = (0, checks_1.validateRuleIsOverridden)(name, this.definedRulesNames, this.className);\n this.definitionErrors = this.definitionErrors.concat(ruleErrors);\n var ruleImplementation = this.defineRule(name, impl, config);\n this[name] = ruleImplementation;\n return ruleImplementation;\n };\n RecognizerApi2.prototype.BACKTRACK = function(grammarRule, args) {\n return function() {\n this.isBackTrackingStack.push(1);\n var orgState = this.saveRecogState();\n try {\n grammarRule.apply(this, args);\n return true;\n } catch (e) {\n if ((0, exceptions_public_1.isRecognitionException)(e)) {\n return false;\n } else {\n throw e;\n }\n } finally {\n this.reloadRecogState(orgState);\n this.isBackTrackingStack.pop();\n }\n };\n };\n RecognizerApi2.prototype.getGAstProductions = function() {\n return this.gastProductionsCache;\n };\n RecognizerApi2.prototype.getSerializedGastProductions = function() {\n return (0, gast_12.serializeGrammar)((0, values_12.default)(this.gastProductionsCache));\n };\n return RecognizerApi2;\n }()\n );\n recognizer_api.RecognizerApi = RecognizerApi;\n return recognizer_api;\n}\nvar recognizer_engine = {};\nvar hasRequiredRecognizer_engine;\nfunction requireRecognizer_engine() {\n if (hasRequiredRecognizer_engine)\n return recognizer_engine;\n hasRequiredRecognizer_engine = 1;\n var __importDefault2 = commonjsGlobal && commonjsGlobal.__importDefault || function(mod2) {\n return mod2 && mod2.__esModule ? mod2 : { \"default\": mod2 };\n };\n Object.defineProperty(recognizer_engine, \"__esModule\", { value: true });\n recognizer_engine.RecognizerEngine = void 0;\n var isEmpty_12 = __importDefault2(lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2__);\n var isArray_12 = __importDefault2(lodash_isArray__WEBPACK_IMPORTED_MODULE_22__);\n var flatten_12 = __importDefault2(lodash_flatten__WEBPACK_IMPORTED_MODULE_16__);\n var every_12 = __importDefault2(lodash_every__WEBPACK_IMPORTED_MODULE_14__);\n var uniq_12 = __importDefault2(lodash_uniq__WEBPACK_IMPORTED_MODULE_17__);\n var isObject_1 = __importDefault2(lodash_isObject__WEBPACK_IMPORTED_MODULE_38__);\n var has_1 = __importDefault2(lodash_has__WEBPACK_IMPORTED_MODULE_6__);\n var values_12 = __importDefault2(lodash_values__WEBPACK_IMPORTED_MODULE_5__);\n var reduce_12 = __importDefault2(lodash_reduce__WEBPACK_IMPORTED_MODULE_31__);\n var clone_12 = __importDefault2(lodash_clone__WEBPACK_IMPORTED_MODULE_7__);\n var keys_1 = keys;\n var exceptions_public_1 = exceptions_public;\n var lookahead_1 = lookahead;\n var interpreter_12 = interpreter;\n var parser_1 = requireParser();\n var recoverable_1 = requireRecoverable();\n var tokens_public_1 = tokens_public;\n var tokens_1 = tokens;\n var RecognizerEngine = (\n /** @class */\n function() {\n function RecognizerEngine2() {\n }\n RecognizerEngine2.prototype.initRecognizerEngine = function(tokenVocabulary, config) {\n this.className = this.constructor.name;\n this.shortRuleNameToFull = {};\n this.fullRuleNameToShort = {};\n this.ruleShortNameIdx = 256;\n this.tokenMatcher = tokens_1.tokenStructuredMatcherNoCategories;\n this.subruleIdx = 0;\n this.definedRulesNames = [];\n this.tokensMap = {};\n this.isBackTrackingStack = [];\n this.RULE_STACK = [];\n this.RULE_OCCURRENCE_STACK = [];\n this.gastProductionsCache = {};\n if ((0, has_1.default)(config, \"serializedGrammar\")) {\n throw Error(\"The Parser's configuration can no longer contain a property.\\n\tSee: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0\\n\tFor Further details.\");\n }\n if ((0, isArray_12.default)(tokenVocabulary)) {\n if ((0, isEmpty_12.default)(tokenVocabulary)) {\n throw Error(\"A Token Vocabulary cannot be empty.\\n\tNote that the first argument for the parser constructor\\n\tis no longer a Token vector (since v4.0).\");\n }\n if (typeof tokenVocabulary[0].startOffset === \"number\") {\n throw Error(\"The Parser constructor no longer accepts a token vector as the first argument.\\n\tSee: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0\\n\tFor Further details.\");\n }\n }\n if ((0, isArray_12.default)(tokenVocabulary)) {\n this.tokensMap = (0, reduce_12.default)(tokenVocabulary, function(acc, tokType) {\n acc[tokType.name] = tokType;\n return acc;\n }, {});\n } else if ((0, has_1.default)(tokenVocabulary, \"modes\") && (0, every_12.default)((0, flatten_12.default)((0, values_12.default)(tokenVocabulary.modes)), tokens_1.isTokenType)) {\n var allTokenTypes_1 = (0, flatten_12.default)((0, values_12.default)(tokenVocabulary.modes));\n var uniqueTokens = (0, uniq_12.default)(allTokenTypes_1);\n this.tokensMap = (0, reduce_12.default)(uniqueTokens, function(acc, tokType) {\n acc[tokType.name] = tokType;\n return acc;\n }, {});\n } else if ((0, isObject_1.default)(tokenVocabulary)) {\n this.tokensMap = (0, clone_12.default)(tokenVocabulary);\n } else {\n throw new Error(\" argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition\");\n }\n this.tokensMap[\"EOF\"] = tokens_public_1.EOF;\n var allTokenTypes = (0, has_1.default)(tokenVocabulary, \"modes\") ? (0, flatten_12.default)((0, values_12.default)(tokenVocabulary.modes)) : (0, values_12.default)(tokenVocabulary);\n var noTokenCategoriesUsed = (0, every_12.default)(allTokenTypes, function(tokenConstructor) {\n return (0, isEmpty_12.default)(tokenConstructor.categoryMatches);\n });\n this.tokenMatcher = noTokenCategoriesUsed ? tokens_1.tokenStructuredMatcherNoCategories : tokens_1.tokenStructuredMatcher;\n (0, tokens_1.augmentTokenTypes)((0, values_12.default)(this.tokensMap));\n };\n RecognizerEngine2.prototype.defineRule = function(ruleName, impl, config) {\n if (this.selfAnalysisDone) {\n throw Error(\"Grammar rule <\".concat(ruleName, \"> may not be defined after the 'performSelfAnalysis' method has been called'\\n\") + \"Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.\");\n }\n var resyncEnabled = (0, has_1.default)(config, \"resyncEnabled\") ? config.resyncEnabled : parser_1.DEFAULT_RULE_CONFIG.resyncEnabled;\n var recoveryValueFunc = (0, has_1.default)(config, \"recoveryValueFunc\") ? config.recoveryValueFunc : parser_1.DEFAULT_RULE_CONFIG.recoveryValueFunc;\n var shortName = this.ruleShortNameIdx << keys_1.BITS_FOR_METHOD_TYPE + keys_1.BITS_FOR_OCCURRENCE_IDX;\n this.ruleShortNameIdx++;\n this.shortRuleNameToFull[shortName] = ruleName;\n this.fullRuleNameToShort[ruleName] = shortName;\n var invokeRuleWithTry;\n if (this.outputCst === true) {\n invokeRuleWithTry = function invokeRuleWithTry2() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n try {\n this.ruleInvocationStateUpdate(shortName, ruleName, this.subruleIdx);\n impl.apply(this, args);\n var cst2 = this.CST_STACK[this.CST_STACK.length - 1];\n this.cstPostRule(cst2);\n return cst2;\n } catch (e) {\n return this.invokeRuleCatch(e, resyncEnabled, recoveryValueFunc);\n } finally {\n this.ruleFinallyStateUpdate();\n }\n };\n } else {\n invokeRuleWithTry = function invokeRuleWithTryCst() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n try {\n this.ruleInvocationStateUpdate(shortName, ruleName, this.subruleIdx);\n return impl.apply(this, args);\n } catch (e) {\n return this.invokeRuleCatch(e, resyncEnabled, recoveryValueFunc);\n } finally {\n this.ruleFinallyStateUpdate();\n }\n };\n }\n var wrappedGrammarRule = Object.assign(invokeRuleWithTry, { ruleName, originalGrammarAction: impl });\n return wrappedGrammarRule;\n };\n RecognizerEngine2.prototype.invokeRuleCatch = function(e, resyncEnabledConfig, recoveryValueFunc) {\n var isFirstInvokedRule = this.RULE_STACK.length === 1;\n var reSyncEnabled = resyncEnabledConfig && !this.isBackTracking() && this.recoveryEnabled;\n if ((0, exceptions_public_1.isRecognitionException)(e)) {\n var recogError = e;\n if (reSyncEnabled) {\n var reSyncTokType = this.findReSyncTokenType();\n if (this.isInCurrentRuleReSyncSet(reSyncTokType)) {\n recogError.resyncedTokens = this.reSyncTo(reSyncTokType);\n if (this.outputCst) {\n var partialCstResult = this.CST_STACK[this.CST_STACK.length - 1];\n partialCstResult.recoveredNode = true;\n return partialCstResult;\n } else {\n return recoveryValueFunc(e);\n }\n } else {\n if (this.outputCst) {\n var partialCstResult = this.CST_STACK[this.CST_STACK.length - 1];\n partialCstResult.recoveredNode = true;\n recogError.partialCstResult = partialCstResult;\n }\n throw recogError;\n }\n } else if (isFirstInvokedRule) {\n this.moveToTerminatedState();\n return recoveryValueFunc(e);\n } else {\n throw recogError;\n }\n } else {\n throw e;\n }\n };\n RecognizerEngine2.prototype.optionInternal = function(actionORMethodDef, occurrence) {\n var key = this.getKeyForAutomaticLookahead(keys_1.OPTION_IDX, occurrence);\n return this.optionInternalLogic(actionORMethodDef, occurrence, key);\n };\n RecognizerEngine2.prototype.optionInternalLogic = function(actionORMethodDef, occurrence, key) {\n var _this = this;\n var lookAheadFunc = this.getLaFuncFromCache(key);\n var action;\n if (typeof actionORMethodDef !== \"function\") {\n action = actionORMethodDef.DEF;\n var predicate_1 = actionORMethodDef.GATE;\n if (predicate_1 !== void 0) {\n var orgLookaheadFunction_1 = lookAheadFunc;\n lookAheadFunc = function() {\n return predicate_1.call(_this) && orgLookaheadFunction_1.call(_this);\n };\n }\n } else {\n action = actionORMethodDef;\n }\n if (lookAheadFunc.call(this) === true) {\n return action.call(this);\n }\n return void 0;\n };\n RecognizerEngine2.prototype.atLeastOneInternal = function(prodOccurrence, actionORMethodDef) {\n var laKey = this.getKeyForAutomaticLookahead(keys_1.AT_LEAST_ONE_IDX, prodOccurrence);\n return this.atLeastOneInternalLogic(prodOccurrence, actionORMethodDef, laKey);\n };\n RecognizerEngine2.prototype.atLeastOneInternalLogic = function(prodOccurrence, actionORMethodDef, key) {\n var _this = this;\n var lookAheadFunc = this.getLaFuncFromCache(key);\n var action;\n if (typeof actionORMethodDef !== \"function\") {\n action = actionORMethodDef.DEF;\n var predicate_2 = actionORMethodDef.GATE;\n if (predicate_2 !== void 0) {\n var orgLookaheadFunction_2 = lookAheadFunc;\n lookAheadFunc = function() {\n return predicate_2.call(_this) && orgLookaheadFunction_2.call(_this);\n };\n }\n } else {\n action = actionORMethodDef;\n }\n if (lookAheadFunc.call(this) === true) {\n var notStuck = this.doSingleRepetition(action);\n while (lookAheadFunc.call(this) === true && notStuck === true) {\n notStuck = this.doSingleRepetition(action);\n }\n } else {\n throw this.raiseEarlyExitException(prodOccurrence, lookahead_1.PROD_TYPE.REPETITION_MANDATORY, actionORMethodDef.ERR_MSG);\n }\n this.attemptInRepetitionRecovery(this.atLeastOneInternal, [prodOccurrence, actionORMethodDef], lookAheadFunc, keys_1.AT_LEAST_ONE_IDX, prodOccurrence, interpreter_12.NextTerminalAfterAtLeastOneWalker);\n };\n RecognizerEngine2.prototype.atLeastOneSepFirstInternal = function(prodOccurrence, options) {\n var laKey = this.getKeyForAutomaticLookahead(keys_1.AT_LEAST_ONE_SEP_IDX, prodOccurrence);\n this.atLeastOneSepFirstInternalLogic(prodOccurrence, options, laKey);\n };\n RecognizerEngine2.prototype.atLeastOneSepFirstInternalLogic = function(prodOccurrence, options, key) {\n var _this = this;\n var action = options.DEF;\n var separator = options.SEP;\n var firstIterationLookaheadFunc = this.getLaFuncFromCache(key);\n if (firstIterationLookaheadFunc.call(this) === true) {\n action.call(this);\n var separatorLookAheadFunc = function() {\n return _this.tokenMatcher(_this.LA(1), separator);\n };\n while (this.tokenMatcher(this.LA(1), separator) === true) {\n this.CONSUME(separator);\n action.call(this);\n }\n this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal, [\n prodOccurrence,\n separator,\n separatorLookAheadFunc,\n action,\n interpreter_12.NextTerminalAfterAtLeastOneSepWalker\n ], separatorLookAheadFunc, keys_1.AT_LEAST_ONE_SEP_IDX, prodOccurrence, interpreter_12.NextTerminalAfterAtLeastOneSepWalker);\n } else {\n throw this.raiseEarlyExitException(prodOccurrence, lookahead_1.PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR, options.ERR_MSG);\n }\n };\n RecognizerEngine2.prototype.manyInternal = function(prodOccurrence, actionORMethodDef) {\n var laKey = this.getKeyForAutomaticLookahead(keys_1.MANY_IDX, prodOccurrence);\n return this.manyInternalLogic(prodOccurrence, actionORMethodDef, laKey);\n };\n RecognizerEngine2.prototype.manyInternalLogic = function(prodOccurrence, actionORMethodDef, key) {\n var _this = this;\n var lookaheadFunction = this.getLaFuncFromCache(key);\n var action;\n if (typeof actionORMethodDef !== \"function\") {\n action = actionORMethodDef.DEF;\n var predicate_3 = actionORMethodDef.GATE;\n if (predicate_3 !== void 0) {\n var orgLookaheadFunction_3 = lookaheadFunction;\n lookaheadFunction = function() {\n return predicate_3.call(_this) && orgLookaheadFunction_3.call(_this);\n };\n }\n } else {\n action = actionORMethodDef;\n }\n var notStuck = true;\n while (lookaheadFunction.call(this) === true && notStuck === true) {\n notStuck = this.doSingleRepetition(action);\n }\n this.attemptInRepetitionRecovery(\n this.manyInternal,\n [prodOccurrence, actionORMethodDef],\n lookaheadFunction,\n keys_1.MANY_IDX,\n prodOccurrence,\n interpreter_12.NextTerminalAfterManyWalker,\n // The notStuck parameter is only relevant when \"attemptInRepetitionRecovery\"\n // is invoked from manyInternal, in the MANY_SEP case and AT_LEAST_ONE[_SEP]\n // An infinite loop cannot occur as:\n // - Either the lookahead is guaranteed to consume something (Single Token Separator)\n // - AT_LEAST_ONE by definition is guaranteed to consume something (or error out).\n notStuck\n );\n };\n RecognizerEngine2.prototype.manySepFirstInternal = function(prodOccurrence, options) {\n var laKey = this.getKeyForAutomaticLookahead(keys_1.MANY_SEP_IDX, prodOccurrence);\n this.manySepFirstInternalLogic(prodOccurrence, options, laKey);\n };\n RecognizerEngine2.prototype.manySepFirstInternalLogic = function(prodOccurrence, options, key) {\n var _this = this;\n var action = options.DEF;\n var separator = options.SEP;\n var firstIterationLaFunc = this.getLaFuncFromCache(key);\n if (firstIterationLaFunc.call(this) === true) {\n action.call(this);\n var separatorLookAheadFunc = function() {\n return _this.tokenMatcher(_this.LA(1), separator);\n };\n while (this.tokenMatcher(this.LA(1), separator) === true) {\n this.CONSUME(separator);\n action.call(this);\n }\n this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal, [\n prodOccurrence,\n separator,\n separatorLookAheadFunc,\n action,\n interpreter_12.NextTerminalAfterManySepWalker\n ], separatorLookAheadFunc, keys_1.MANY_SEP_IDX, prodOccurrence, interpreter_12.NextTerminalAfterManySepWalker);\n }\n };\n RecognizerEngine2.prototype.repetitionSepSecondInternal = function(prodOccurrence, separator, separatorLookAheadFunc, action, nextTerminalAfterWalker) {\n while (separatorLookAheadFunc()) {\n this.CONSUME(separator);\n action.call(this);\n }\n this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal, [\n prodOccurrence,\n separator,\n separatorLookAheadFunc,\n action,\n nextTerminalAfterWalker\n ], separatorLookAheadFunc, keys_1.AT_LEAST_ONE_SEP_IDX, prodOccurrence, nextTerminalAfterWalker);\n };\n RecognizerEngine2.prototype.doSingleRepetition = function(action) {\n var beforeIteration = this.getLexerPosition();\n action.call(this);\n var afterIteration = this.getLexerPosition();\n return afterIteration > beforeIteration;\n };\n RecognizerEngine2.prototype.orInternal = function(altsOrOpts, occurrence) {\n var laKey = this.getKeyForAutomaticLookahead(keys_1.OR_IDX, occurrence);\n var alts = (0, isArray_12.default)(altsOrOpts) ? altsOrOpts : altsOrOpts.DEF;\n var laFunc = this.getLaFuncFromCache(laKey);\n var altIdxToTake = laFunc.call(this, alts);\n if (altIdxToTake !== void 0) {\n var chosenAlternative = alts[altIdxToTake];\n return chosenAlternative.ALT.call(this);\n }\n this.raiseNoAltException(occurrence, altsOrOpts.ERR_MSG);\n };\n RecognizerEngine2.prototype.ruleFinallyStateUpdate = function() {\n this.RULE_STACK.pop();\n this.RULE_OCCURRENCE_STACK.pop();\n this.cstFinallyStateUpdate();\n if (this.RULE_STACK.length === 0 && this.isAtEndOfInput() === false) {\n var firstRedundantTok = this.LA(1);\n var errMsg = this.errorMessageProvider.buildNotAllInputParsedMessage({\n firstRedundant: firstRedundantTok,\n ruleName: this.getCurrRuleFullName()\n });\n this.SAVE_ERROR(new exceptions_public_1.NotAllInputParsedException(errMsg, firstRedundantTok));\n }\n };\n RecognizerEngine2.prototype.subruleInternal = function(ruleToCall, idx, options) {\n var ruleResult;\n try {\n var args = options !== void 0 ? options.ARGS : void 0;\n this.subruleIdx = idx;\n ruleResult = ruleToCall.apply(this, args);\n this.cstPostNonTerminal(ruleResult, options !== void 0 && options.LABEL !== void 0 ? options.LABEL : ruleToCall.ruleName);\n return ruleResult;\n } catch (e) {\n throw this.subruleInternalError(e, options, ruleToCall.ruleName);\n }\n };\n RecognizerEngine2.prototype.subruleInternalError = function(e, options, ruleName) {\n if ((0, exceptions_public_1.isRecognitionException)(e) && e.partialCstResult !== void 0) {\n this.cstPostNonTerminal(e.partialCstResult, options !== void 0 && options.LABEL !== void 0 ? options.LABEL : ruleName);\n delete e.partialCstResult;\n }\n throw e;\n };\n RecognizerEngine2.prototype.consumeInternal = function(tokType, idx, options) {\n var consumedToken;\n try {\n var nextToken = this.LA(1);\n if (this.tokenMatcher(nextToken, tokType) === true) {\n this.consumeToken();\n consumedToken = nextToken;\n } else {\n this.consumeInternalError(tokType, nextToken, options);\n }\n } catch (eFromConsumption) {\n consumedToken = this.consumeInternalRecovery(tokType, idx, eFromConsumption);\n }\n this.cstPostTerminal(options !== void 0 && options.LABEL !== void 0 ? options.LABEL : tokType.name, consumedToken);\n return consumedToken;\n };\n RecognizerEngine2.prototype.consumeInternalError = function(tokType, nextToken, options) {\n var msg;\n var previousToken = this.LA(0);\n if (options !== void 0 && options.ERR_MSG) {\n msg = options.ERR_MSG;\n } else {\n msg = this.errorMessageProvider.buildMismatchTokenMessage({\n expected: tokType,\n actual: nextToken,\n previous: previousToken,\n ruleName: this.getCurrRuleFullName()\n });\n }\n throw this.SAVE_ERROR(new exceptions_public_1.MismatchedTokenException(msg, nextToken, previousToken));\n };\n RecognizerEngine2.prototype.consumeInternalRecovery = function(tokType, idx, eFromConsumption) {\n if (this.recoveryEnabled && // TODO: more robust checking of the exception type. Perhaps Typescript extending expressions?\n eFromConsumption.name === \"MismatchedTokenException\" && !this.isBackTracking()) {\n var follows = this.getFollowsForInRuleRecovery(tokType, idx);\n try {\n return this.tryInRuleRecovery(tokType, follows);\n } catch (eFromInRuleRecovery) {\n if (eFromInRuleRecovery.name === recoverable_1.IN_RULE_RECOVERY_EXCEPTION) {\n throw eFromConsumption;\n } else {\n throw eFromInRuleRecovery;\n }\n }\n } else {\n throw eFromConsumption;\n }\n };\n RecognizerEngine2.prototype.saveRecogState = function() {\n var savedErrors = this.errors;\n var savedRuleStack = (0, clone_12.default)(this.RULE_STACK);\n return {\n errors: savedErrors,\n lexerState: this.exportLexerState(),\n RULE_STACK: savedRuleStack,\n CST_STACK: this.CST_STACK\n };\n };\n RecognizerEngine2.prototype.reloadRecogState = function(newState) {\n this.errors = newState.errors;\n this.importLexerState(newState.lexerState);\n this.RULE_STACK = newState.RULE_STACK;\n };\n RecognizerEngine2.prototype.ruleInvocationStateUpdate = function(shortName, fullName, idxInCallingRule) {\n this.RULE_OCCURRENCE_STACK.push(idxInCallingRule);\n this.RULE_STACK.push(shortName);\n this.cstInvocationStateUpdate(fullName);\n };\n RecognizerEngine2.prototype.isBackTracking = function() {\n return this.isBackTrackingStack.length !== 0;\n };\n RecognizerEngine2.prototype.getCurrRuleFullName = function() {\n var shortName = this.getLastExplicitRuleShortName();\n return this.shortRuleNameToFull[shortName];\n };\n RecognizerEngine2.prototype.shortRuleNameToFullName = function(shortName) {\n return this.shortRuleNameToFull[shortName];\n };\n RecognizerEngine2.prototype.isAtEndOfInput = function() {\n return this.tokenMatcher(this.LA(1), tokens_public_1.EOF);\n };\n RecognizerEngine2.prototype.reset = function() {\n this.resetLexerState();\n this.subruleIdx = 0;\n this.isBackTrackingStack = [];\n this.errors = [];\n this.RULE_STACK = [];\n this.CST_STACK = [];\n this.RULE_OCCURRENCE_STACK = [];\n };\n return RecognizerEngine2;\n }()\n );\n recognizer_engine.RecognizerEngine = RecognizerEngine;\n return recognizer_engine;\n}\nvar error_handler = {};\nvar hasRequiredError_handler;\nfunction requireError_handler() {\n if (hasRequiredError_handler)\n return error_handler;\n hasRequiredError_handler = 1;\n var __importDefault2 = commonjsGlobal && commonjsGlobal.__importDefault || function(mod2) {\n return mod2 && mod2.__esModule ? mod2 : { \"default\": mod2 };\n };\n Object.defineProperty(error_handler, \"__esModule\", { value: true });\n error_handler.ErrorHandler = void 0;\n var exceptions_public_1 = exceptions_public;\n var has_1 = __importDefault2(lodash_has__WEBPACK_IMPORTED_MODULE_6__);\n var clone_12 = __importDefault2(lodash_clone__WEBPACK_IMPORTED_MODULE_7__);\n var lookahead_1 = lookahead;\n var parser_1 = requireParser();\n var ErrorHandler = (\n /** @class */\n function() {\n function ErrorHandler2() {\n }\n ErrorHandler2.prototype.initErrorHandler = function(config) {\n this._errors = [];\n this.errorMessageProvider = (0, has_1.default)(config, \"errorMessageProvider\") ? config.errorMessageProvider : parser_1.DEFAULT_PARSER_CONFIG.errorMessageProvider;\n };\n ErrorHandler2.prototype.SAVE_ERROR = function(error) {\n if ((0, exceptions_public_1.isRecognitionException)(error)) {\n error.context = {\n ruleStack: this.getHumanReadableRuleStack(),\n ruleOccurrenceStack: (0, clone_12.default)(this.RULE_OCCURRENCE_STACK)\n };\n this._errors.push(error);\n return error;\n } else {\n throw Error(\"Trying to save an Error which is not a RecognitionException\");\n }\n };\n Object.defineProperty(ErrorHandler2.prototype, \"errors\", {\n get: function() {\n return (0, clone_12.default)(this._errors);\n },\n set: function(newErrors) {\n this._errors = newErrors;\n },\n enumerable: false,\n configurable: true\n });\n ErrorHandler2.prototype.raiseEarlyExitException = function(occurrence, prodType, userDefinedErrMsg) {\n var ruleName = this.getCurrRuleFullName();\n var ruleGrammar = this.getGAstProductions()[ruleName];\n var lookAheadPathsPerAlternative = (0, lookahead_1.getLookaheadPathsForOptionalProd)(occurrence, ruleGrammar, prodType, this.maxLookahead);\n var insideProdPaths = lookAheadPathsPerAlternative[0];\n var actualTokens = [];\n for (var i2 = 1; i2 <= this.maxLookahead; i2++) {\n actualTokens.push(this.LA(i2));\n }\n var msg = this.errorMessageProvider.buildEarlyExitMessage({\n expectedIterationPaths: insideProdPaths,\n actual: actualTokens,\n previous: this.LA(0),\n customUserDescription: userDefinedErrMsg,\n ruleName\n });\n throw this.SAVE_ERROR(new exceptions_public_1.EarlyExitException(msg, this.LA(1), this.LA(0)));\n };\n ErrorHandler2.prototype.raiseNoAltException = function(occurrence, errMsgTypes) {\n var ruleName = this.getCurrRuleFullName();\n var ruleGrammar = this.getGAstProductions()[ruleName];\n var lookAheadPathsPerAlternative = (0, lookahead_1.getLookaheadPathsForOr)(occurrence, ruleGrammar, this.maxLookahead);\n var actualTokens = [];\n for (var i2 = 1; i2 <= this.maxLookahead; i2++) {\n actualTokens.push(this.LA(i2));\n }\n var previousToken = this.LA(0);\n var errMsg = this.errorMessageProvider.buildNoViableAltMessage({\n expectedPathsPerAlt: lookAheadPathsPerAlternative,\n actual: actualTokens,\n previous: previousToken,\n customUserDescription: errMsgTypes,\n ruleName: this.getCurrRuleFullName()\n });\n throw this.SAVE_ERROR(new exceptions_public_1.NoViableAltException(errMsg, this.LA(1), previousToken));\n };\n return ErrorHandler2;\n }()\n );\n error_handler.ErrorHandler = ErrorHandler;\n return error_handler;\n}\nvar context_assist = {};\nvar __importDefault$2 = commonjsGlobal && commonjsGlobal.__importDefault || function(mod2) {\n return mod2 && mod2.__esModule ? mod2 : { \"default\": mod2 };\n};\nObject.defineProperty(context_assist, \"__esModule\", { value: true });\ncontext_assist.ContentAssist = void 0;\nvar interpreter_1 = interpreter;\nvar first_1 = __importDefault$2(lodash_first__WEBPACK_IMPORTED_MODULE_20__);\nvar isUndefined_1 = __importDefault$2(lodash_isUndefined__WEBPACK_IMPORTED_MODULE_18__);\nvar ContentAssist = (\n /** @class */\n function() {\n function ContentAssist2() {\n }\n ContentAssist2.prototype.initContentAssist = function() {\n };\n ContentAssist2.prototype.computeContentAssist = function(startRuleName, precedingInput) {\n var startRuleGast = this.gastProductionsCache[startRuleName];\n if ((0, isUndefined_1.default)(startRuleGast)) {\n throw Error(\"Rule ->\".concat(startRuleName, \"<- does not exist in this grammar.\"));\n }\n return (0, interpreter_1.nextPossibleTokensAfter)([startRuleGast], precedingInput, this.tokenMatcher, this.maxLookahead);\n };\n ContentAssist2.prototype.getNextPossibleTokenTypes = function(grammarPath) {\n var topRuleName = (0, first_1.default)(grammarPath.ruleStack);\n var gastProductions = this.getGAstProductions();\n var topProduction = gastProductions[topRuleName];\n var nextPossibleTokenTypes = new interpreter_1.NextAfterTokenWalker(topProduction, grammarPath).startWalking();\n return nextPossibleTokenTypes;\n };\n return ContentAssist2;\n }()\n);\ncontext_assist.ContentAssist = ContentAssist;\nvar gast_recorder = {};\nvar hasRequiredGast_recorder;\nfunction requireGast_recorder() {\n if (hasRequiredGast_recorder)\n return gast_recorder;\n hasRequiredGast_recorder = 1;\n var __importDefault2 = commonjsGlobal && commonjsGlobal.__importDefault || function(mod2) {\n return mod2 && mod2.__esModule ? mod2 : { \"default\": mod2 };\n };\n Object.defineProperty(gast_recorder, \"__esModule\", { value: true });\n gast_recorder.GastRecorder = void 0;\n var last_12 = __importDefault2(lodash_last__WEBPACK_IMPORTED_MODULE_33__);\n var isArray_12 = __importDefault2(lodash_isArray__WEBPACK_IMPORTED_MODULE_22__);\n var some_12 = __importDefault2(lodash_some__WEBPACK_IMPORTED_MODULE_13__);\n var forEach_12 = __importDefault2(lodash_forEach__WEBPACK_IMPORTED_MODULE_4__);\n var isFunction_1 = __importDefault2(lodash_isFunction__WEBPACK_IMPORTED_MODULE_26__);\n var has_1 = __importDefault2(lodash_has__WEBPACK_IMPORTED_MODULE_6__);\n var gast_12 = api$1;\n var lexer_public_1 = requireLexer_public();\n var tokens_1 = tokens;\n var tokens_public_1 = tokens_public;\n var parser_1 = requireParser();\n var keys_1 = keys;\n var RECORDING_NULL_OBJECT = {\n description: \"This Object indicates the Parser is during Recording Phase\"\n };\n Object.freeze(RECORDING_NULL_OBJECT);\n var HANDLE_SEPARATOR = true;\n var MAX_METHOD_IDX = Math.pow(2, keys_1.BITS_FOR_OCCURRENCE_IDX) - 1;\n var RFT = (0, tokens_public_1.createToken)({ name: \"RECORDING_PHASE_TOKEN\", pattern: lexer_public_1.Lexer.NA });\n (0, tokens_1.augmentTokenTypes)([RFT]);\n var RECORDING_PHASE_TOKEN = (0, tokens_public_1.createTokenInstance)(\n RFT,\n \"This IToken indicates the Parser is in Recording Phase\\n\tSee: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details\",\n // Using \"-1\" instead of NaN (as in EOF) because an actual number is less likely to\n // cause errors if the output of LA or CONSUME would be (incorrectly) used during the recording phase.\n -1,\n -1,\n -1,\n -1,\n -1,\n -1\n );\n Object.freeze(RECORDING_PHASE_TOKEN);\n var RECORDING_PHASE_CSTNODE = {\n name: \"This CSTNode indicates the Parser is in Recording Phase\\n\tSee: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details\",\n children: {}\n };\n var GastRecorder = (\n /** @class */\n function() {\n function GastRecorder2() {\n }\n GastRecorder2.prototype.initGastRecorder = function(config) {\n this.recordingProdStack = [];\n this.RECORDING_PHASE = false;\n };\n GastRecorder2.prototype.enableRecording = function() {\n var _this = this;\n this.RECORDING_PHASE = true;\n this.TRACE_INIT(\"Enable Recording\", function() {\n var _loop_1 = function(i3) {\n var idx = i3 > 0 ? i3 : \"\";\n _this[\"CONSUME\".concat(idx)] = function(arg1, arg2) {\n return this.consumeInternalRecord(arg1, i3, arg2);\n };\n _this[\"SUBRULE\".concat(idx)] = function(arg1, arg2) {\n return this.subruleInternalRecord(arg1, i3, arg2);\n };\n _this[\"OPTION\".concat(idx)] = function(arg1) {\n return this.optionInternalRecord(arg1, i3);\n };\n _this[\"OR\".concat(idx)] = function(arg1) {\n return this.orInternalRecord(arg1, i3);\n };\n _this[\"MANY\".concat(idx)] = function(arg1) {\n this.manyInternalRecord(i3, arg1);\n };\n _this[\"MANY_SEP\".concat(idx)] = function(arg1) {\n this.manySepFirstInternalRecord(i3, arg1);\n };\n _this[\"AT_LEAST_ONE\".concat(idx)] = function(arg1) {\n this.atLeastOneInternalRecord(i3, arg1);\n };\n _this[\"AT_LEAST_ONE_SEP\".concat(idx)] = function(arg1) {\n this.atLeastOneSepFirstInternalRecord(i3, arg1);\n };\n };\n for (var i2 = 0; i2 < 10; i2++) {\n _loop_1(i2);\n }\n _this[\"consume\"] = function(idx, arg1, arg2) {\n return this.consumeInternalRecord(arg1, idx, arg2);\n };\n _this[\"subrule\"] = function(idx, arg1, arg2) {\n return this.subruleInternalRecord(arg1, idx, arg2);\n };\n _this[\"option\"] = function(idx, arg1) {\n return this.optionInternalRecord(arg1, idx);\n };\n _this[\"or\"] = function(idx, arg1) {\n return this.orInternalRecord(arg1, idx);\n };\n _this[\"many\"] = function(idx, arg1) {\n this.manyInternalRecord(idx, arg1);\n };\n _this[\"atLeastOne\"] = function(idx, arg1) {\n this.atLeastOneInternalRecord(idx, arg1);\n };\n _this.ACTION = _this.ACTION_RECORD;\n _this.BACKTRACK = _this.BACKTRACK_RECORD;\n _this.LA = _this.LA_RECORD;\n });\n };\n GastRecorder2.prototype.disableRecording = function() {\n var _this = this;\n this.RECORDING_PHASE = false;\n this.TRACE_INIT(\"Deleting Recording methods\", function() {\n var that = _this;\n for (var i2 = 0; i2 < 10; i2++) {\n var idx = i2 > 0 ? i2 : \"\";\n delete that[\"CONSUME\".concat(idx)];\n delete that[\"SUBRULE\".concat(idx)];\n delete that[\"OPTION\".concat(idx)];\n delete that[\"OR\".concat(idx)];\n delete that[\"MANY\".concat(idx)];\n delete that[\"MANY_SEP\".concat(idx)];\n delete that[\"AT_LEAST_ONE\".concat(idx)];\n delete that[\"AT_LEAST_ONE_SEP\".concat(idx)];\n }\n delete that[\"consume\"];\n delete that[\"subrule\"];\n delete that[\"option\"];\n delete that[\"or\"];\n delete that[\"many\"];\n delete that[\"atLeastOne\"];\n delete that.ACTION;\n delete that.BACKTRACK;\n delete that.LA;\n });\n };\n GastRecorder2.prototype.ACTION_RECORD = function(impl) {\n };\n GastRecorder2.prototype.BACKTRACK_RECORD = function(grammarRule, args) {\n return function() {\n return true;\n };\n };\n GastRecorder2.prototype.LA_RECORD = function(howMuch) {\n return parser_1.END_OF_FILE;\n };\n GastRecorder2.prototype.topLevelRuleRecord = function(name, def) {\n try {\n var newTopLevelRule = new gast_12.Rule({ definition: [], name });\n newTopLevelRule.name = name;\n this.recordingProdStack.push(newTopLevelRule);\n def.call(this);\n this.recordingProdStack.pop();\n return newTopLevelRule;\n } catch (originalError) {\n if (originalError.KNOWN_RECORDER_ERROR !== true) {\n try {\n originalError.message = originalError.message + '\\n\t This error was thrown during the \"grammar recording phase\" For more info see:\\n\thttps://chevrotain.io/docs/guide/internals.html#grammar-recording';\n } catch (mutabilityError) {\n throw originalError;\n }\n }\n throw originalError;\n }\n };\n GastRecorder2.prototype.optionInternalRecord = function(actionORMethodDef, occurrence) {\n return recordProd.call(this, gast_12.Option, actionORMethodDef, occurrence);\n };\n GastRecorder2.prototype.atLeastOneInternalRecord = function(occurrence, actionORMethodDef) {\n recordProd.call(this, gast_12.RepetitionMandatory, actionORMethodDef, occurrence);\n };\n GastRecorder2.prototype.atLeastOneSepFirstInternalRecord = function(occurrence, options) {\n recordProd.call(this, gast_12.RepetitionMandatoryWithSeparator, options, occurrence, HANDLE_SEPARATOR);\n };\n GastRecorder2.prototype.manyInternalRecord = function(occurrence, actionORMethodDef) {\n recordProd.call(this, gast_12.Repetition, actionORMethodDef, occurrence);\n };\n GastRecorder2.prototype.manySepFirstInternalRecord = function(occurrence, options) {\n recordProd.call(this, gast_12.RepetitionWithSeparator, options, occurrence, HANDLE_SEPARATOR);\n };\n GastRecorder2.prototype.orInternalRecord = function(altsOrOpts, occurrence) {\n return recordOrProd.call(this, altsOrOpts, occurrence);\n };\n GastRecorder2.prototype.subruleInternalRecord = function(ruleToCall, occurrence, options) {\n assertMethodIdxIsValid(occurrence);\n if (!ruleToCall || (0, has_1.default)(ruleToCall, \"ruleName\") === false) {\n var error = new Error(\" argument is invalid\") + \" expecting a Parser method reference but got: <\".concat(JSON.stringify(ruleToCall), \">\") + \"\\n inside top level rule: <\".concat(this.recordingProdStack[0].name, \">\"));\n error.KNOWN_RECORDER_ERROR = true;\n throw error;\n }\n var prevProd = (0, last_12.default)(this.recordingProdStack);\n var ruleName = ruleToCall.ruleName;\n var newNoneTerminal = new gast_12.NonTerminal({\n idx: occurrence,\n nonTerminalName: ruleName,\n label: options === null || options === void 0 ? void 0 : options.LABEL,\n // The resolving of the `referencedRule` property will be done once all the Rule's GASTs have been created\n referencedRule: void 0\n });\n prevProd.definition.push(newNoneTerminal);\n return this.outputCst ? RECORDING_PHASE_CSTNODE : RECORDING_NULL_OBJECT;\n };\n GastRecorder2.prototype.consumeInternalRecord = function(tokType, occurrence, options) {\n assertMethodIdxIsValid(occurrence);\n if (!(0, tokens_1.hasShortKeyProperty)(tokType)) {\n var error = new Error(\" argument is invalid\") + \" expecting a TokenType reference but got: <\".concat(JSON.stringify(tokType), \">\") + \"\\n inside top level rule: <\".concat(this.recordingProdStack[0].name, \">\"));\n error.KNOWN_RECORDER_ERROR = true;\n throw error;\n }\n var prevProd = (0, last_12.default)(this.recordingProdStack);\n var newNoneTerminal = new gast_12.Terminal({\n idx: occurrence,\n terminalType: tokType,\n label: options === null || options === void 0 ? void 0 : options.LABEL\n });\n prevProd.definition.push(newNoneTerminal);\n return RECORDING_PHASE_TOKEN;\n };\n return GastRecorder2;\n }()\n );\n gast_recorder.GastRecorder = GastRecorder;\n function recordProd(prodConstructor, mainProdArg, occurrence, handleSep) {\n if (handleSep === void 0) {\n handleSep = false;\n }\n assertMethodIdxIsValid(occurrence);\n var prevProd = (0, last_12.default)(this.recordingProdStack);\n var grammarAction = (0, isFunction_1.default)(mainProdArg) ? mainProdArg : mainProdArg.DEF;\n var newProd = new prodConstructor({ definition: [], idx: occurrence });\n if (handleSep) {\n newProd.separator = mainProdArg.SEP;\n }\n if ((0, has_1.default)(mainProdArg, \"MAX_LOOKAHEAD\")) {\n newProd.maxLookahead = mainProdArg.MAX_LOOKAHEAD;\n }\n this.recordingProdStack.push(newProd);\n grammarAction.call(this);\n prevProd.definition.push(newProd);\n this.recordingProdStack.pop();\n return RECORDING_NULL_OBJECT;\n }\n function recordOrProd(mainProdArg, occurrence) {\n var _this = this;\n assertMethodIdxIsValid(occurrence);\n var prevProd = (0, last_12.default)(this.recordingProdStack);\n var hasOptions = (0, isArray_12.default)(mainProdArg) === false;\n var alts = hasOptions === false ? mainProdArg : mainProdArg.DEF;\n var newOrProd = new gast_12.Alternation({\n definition: [],\n idx: occurrence,\n ignoreAmbiguities: hasOptions && mainProdArg.IGNORE_AMBIGUITIES === true\n });\n if ((0, has_1.default)(mainProdArg, \"MAX_LOOKAHEAD\")) {\n newOrProd.maxLookahead = mainProdArg.MAX_LOOKAHEAD;\n }\n var hasPredicates = (0, some_12.default)(alts, function(currAlt) {\n return (0, isFunction_1.default)(currAlt.GATE);\n });\n newOrProd.hasPredicates = hasPredicates;\n prevProd.definition.push(newOrProd);\n (0, forEach_12.default)(alts, function(currAlt) {\n var currAltFlat = new gast_12.Alternative({ definition: [] });\n newOrProd.definition.push(currAltFlat);\n if ((0, has_1.default)(currAlt, \"IGNORE_AMBIGUITIES\")) {\n currAltFlat.ignoreAmbiguities = currAlt.IGNORE_AMBIGUITIES;\n } else if ((0, has_1.default)(currAlt, \"GATE\")) {\n currAltFlat.ignoreAmbiguities = true;\n }\n _this.recordingProdStack.push(currAltFlat);\n currAlt.ALT.call(_this);\n _this.recordingProdStack.pop();\n });\n return RECORDING_NULL_OBJECT;\n }\n function getIdxSuffix(idx) {\n return idx === 0 ? \"\" : \"\".concat(idx);\n }\n function assertMethodIdxIsValid(idx) {\n if (idx < 0 || idx > MAX_METHOD_IDX) {\n var error = new Error(\n // The stack trace will contain all the needed details\n \"Invalid DSL Method idx value: <\".concat(idx, \">\\n\t\") + \"Idx value must be a none negative value smaller than \".concat(MAX_METHOD_IDX + 1)\n );\n error.KNOWN_RECORDER_ERROR = true;\n throw error;\n }\n }\n return gast_recorder;\n}\nvar perf_tracer = {};\nvar hasRequiredPerf_tracer;\nfunction requirePerf_tracer() {\n if (hasRequiredPerf_tracer)\n return perf_tracer;\n hasRequiredPerf_tracer = 1;\n var __importDefault2 = commonjsGlobal && commonjsGlobal.__importDefault || function(mod2) {\n return mod2 && mod2.__esModule ? mod2 : { \"default\": mod2 };\n };\n Object.defineProperty(perf_tracer, \"__esModule\", { value: true });\n perf_tracer.PerformanceTracer = void 0;\n var has_1 = __importDefault2(lodash_has__WEBPACK_IMPORTED_MODULE_6__);\n var utils_1 = api$2;\n var parser_1 = requireParser();\n var PerformanceTracer = (\n /** @class */\n function() {\n function PerformanceTracer2() {\n }\n PerformanceTracer2.prototype.initPerformanceTracer = function(config) {\n if ((0, has_1.default)(config, \"traceInitPerf\")) {\n var userTraceInitPerf = config.traceInitPerf;\n var traceIsNumber = typeof userTraceInitPerf === \"number\";\n this.traceInitMaxIdent = traceIsNumber ? userTraceInitPerf : Infinity;\n this.traceInitPerf = traceIsNumber ? userTraceInitPerf > 0 : userTraceInitPerf;\n } else {\n this.traceInitMaxIdent = 0;\n this.traceInitPerf = parser_1.DEFAULT_PARSER_CONFIG.traceInitPerf;\n }\n this.traceInitIndent = -1;\n };\n PerformanceTracer2.prototype.TRACE_INIT = function(phaseDesc, phaseImpl) {\n if (this.traceInitPerf === true) {\n this.traceInitIndent++;\n var indent = new Array(this.traceInitIndent + 1).join(\"\t\");\n if (this.traceInitIndent < this.traceInitMaxIdent) {\n console.log(\"\".concat(indent, \"--> <\").concat(phaseDesc, \">\"));\n }\n var _a2 = (0, utils_1.timer)(phaseImpl), time = _a2.time, value = _a2.value;\n var traceMethod = time > 10 ? console.warn : console.log;\n if (this.traceInitIndent < this.traceInitMaxIdent) {\n traceMethod(\"\".concat(indent, \"<-- <\").concat(phaseDesc, \"> time: \").concat(time, \"ms\"));\n }\n this.traceInitIndent--;\n return value;\n } else {\n return phaseImpl();\n }\n };\n return PerformanceTracer2;\n }()\n );\n perf_tracer.PerformanceTracer = PerformanceTracer;\n return perf_tracer;\n}\nvar apply_mixins = {};\nObject.defineProperty(apply_mixins, \"__esModule\", { value: true });\napply_mixins.applyMixins = void 0;\nfunction applyMixins(derivedCtor, baseCtors) {\n baseCtors.forEach(function(baseCtor) {\n var baseProto = baseCtor.prototype;\n Object.getOwnPropertyNames(baseProto).forEach(function(propName) {\n if (propName === \"constructor\") {\n return;\n }\n var basePropDescriptor = Object.getOwnPropertyDescriptor(baseProto, propName);\n if (basePropDescriptor && (basePropDescriptor.get || basePropDescriptor.set)) {\n Object.defineProperty(derivedCtor.prototype, propName, basePropDescriptor);\n } else {\n derivedCtor.prototype[propName] = baseCtor.prototype[propName];\n }\n });\n });\n}\napply_mixins.applyMixins = applyMixins;\nvar hasRequiredParser;\nfunction requireParser() {\n if (hasRequiredParser)\n return parser;\n hasRequiredParser = 1;\n (function(exports) {\n var __extends2 = commonjsGlobal && commonjsGlobal.__extends || function() {\n var extendStatics = function(d, b2) {\n extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b3) {\n d2.__proto__ = b3;\n } || function(d2, b3) {\n for (var p in b3)\n if (Object.prototype.hasOwnProperty.call(b3, p))\n d2[p] = b3[p];\n };\n return extendStatics(d, b2);\n };\n return function(d, b2) {\n if (typeof b2 !== \"function\" && b2 !== null)\n throw new TypeError(\"Class extends value \" + String(b2) + \" is not a constructor or null\");\n extendStatics(d, b2);\n function __() {\n this.constructor = d;\n }\n d.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());\n };\n }();\n var __importDefault2 = commonjsGlobal && commonjsGlobal.__importDefault || function(mod2) {\n return mod2 && mod2.__esModule ? mod2 : { \"default\": mod2 };\n };\n Object.defineProperty(exports, \"__esModule\", { value: true });\n exports.EmbeddedActionsParser = exports.CstParser = exports.Parser = exports.EMPTY_ALT = exports.ParserDefinitionErrorType = exports.DEFAULT_RULE_CONFIG = exports.DEFAULT_PARSER_CONFIG = exports.END_OF_FILE = void 0;\n var isEmpty_12 = __importDefault2(lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2__);\n var map_12 = __importDefault2(lodash_map__WEBPACK_IMPORTED_MODULE_3__);\n var forEach_12 = __importDefault2(lodash_forEach__WEBPACK_IMPORTED_MODULE_4__);\n var values_12 = __importDefault2(lodash_values__WEBPACK_IMPORTED_MODULE_5__);\n var has_1 = __importDefault2(lodash_has__WEBPACK_IMPORTED_MODULE_6__);\n var clone_12 = __importDefault2(lodash_clone__WEBPACK_IMPORTED_MODULE_7__);\n var utils_1 = api$2;\n var follow_1 = follow;\n var tokens_public_1 = tokens_public;\n var errors_public_1 = errors_public;\n var gast_resolver_public_1 = requireGast_resolver_public();\n var recoverable_1 = requireRecoverable();\n var looksahead_1 = requireLooksahead();\n var tree_builder_1 = requireTree_builder();\n var lexer_adapter_1 = requireLexer_adapter();\n var recognizer_api_1 = requireRecognizer_api();\n var recognizer_engine_1 = requireRecognizer_engine();\n var error_handler_1 = requireError_handler();\n var context_assist_1 = context_assist;\n var gast_recorder_1 = requireGast_recorder();\n var perf_tracer_1 = requirePerf_tracer();\n var apply_mixins_1 = apply_mixins;\n var checks_1 = requireChecks();\n exports.END_OF_FILE = (0, tokens_public_1.createTokenInstance)(tokens_public_1.EOF, \"\", NaN, NaN, NaN, NaN, NaN, NaN);\n Object.freeze(exports.END_OF_FILE);\n exports.DEFAULT_PARSER_CONFIG = Object.freeze({\n recoveryEnabled: false,\n maxLookahead: 3,\n dynamicTokensEnabled: false,\n outputCst: true,\n errorMessageProvider: errors_public_1.defaultParserErrorProvider,\n nodeLocationTracking: \"none\",\n traceInitPerf: false,\n skipValidations: false\n });\n exports.DEFAULT_RULE_CONFIG = Object.freeze({\n recoveryValueFunc: function() {\n return void 0;\n },\n resyncEnabled: true\n });\n (function(ParserDefinitionErrorType) {\n ParserDefinitionErrorType[ParserDefinitionErrorType[\"INVALID_RULE_NAME\"] = 0] = \"INVALID_RULE_NAME\";\n ParserDefinitionErrorType[ParserDefinitionErrorType[\"DUPLICATE_RULE_NAME\"] = 1] = \"DUPLICATE_RULE_NAME\";\n ParserDefinitionErrorType[ParserDefinitionErrorType[\"INVALID_RULE_OVERRIDE\"] = 2] = \"INVALID_RULE_OVERRIDE\";\n ParserDefinitionErrorType[ParserDefinitionErrorType[\"DUPLICATE_PRODUCTIONS\"] = 3] = \"DUPLICATE_PRODUCTIONS\";\n ParserDefinitionErrorType[ParserDefinitionErrorType[\"UNRESOLVED_SUBRULE_REF\"] = 4] = \"UNRESOLVED_SUBRULE_REF\";\n ParserDefinitionErrorType[ParserDefinitionErrorType[\"LEFT_RECURSION\"] = 5] = \"LEFT_RECURSION\";\n ParserDefinitionErrorType[ParserDefinitionErrorType[\"NONE_LAST_EMPTY_ALT\"] = 6] = \"NONE_LAST_EMPTY_ALT\";\n ParserDefinitionErrorType[ParserDefinitionErrorType[\"AMBIGUOUS_ALTS\"] = 7] = \"AMBIGUOUS_ALTS\";\n ParserDefinitionErrorType[ParserDefinitionErrorType[\"CONFLICT_TOKENS_RULES_NAMESPACE\"] = 8] = \"CONFLICT_TOKENS_RULES_NAMESPACE\";\n ParserDefinitionErrorType[ParserDefinitionErrorType[\"INVALID_TOKEN_NAME\"] = 9] = \"INVALID_TOKEN_NAME\";\n ParserDefinitionErrorType[ParserDefinitionErrorType[\"NO_NON_EMPTY_LOOKAHEAD\"] = 10] = \"NO_NON_EMPTY_LOOKAHEAD\";\n ParserDefinitionErrorType[ParserDefinitionErrorType[\"AMBIGUOUS_PREFIX_ALTS\"] = 11] = \"AMBIGUOUS_PREFIX_ALTS\";\n ParserDefinitionErrorType[ParserDefinitionErrorType[\"TOO_MANY_ALTS\"] = 12] = \"TOO_MANY_ALTS\";\n ParserDefinitionErrorType[ParserDefinitionErrorType[\"CUSTOM_LOOKAHEAD_VALIDATION\"] = 13] = \"CUSTOM_LOOKAHEAD_VALIDATION\";\n })(exports.ParserDefinitionErrorType || (exports.ParserDefinitionErrorType = {}));\n function EMPTY_ALT(value) {\n if (value === void 0) {\n value = void 0;\n }\n return function() {\n return value;\n };\n }\n exports.EMPTY_ALT = EMPTY_ALT;\n var Parser2 = (\n /** @class */\n function() {\n function Parser3(tokenVocabulary, config) {\n this.definitionErrors = [];\n this.selfAnalysisDone = false;\n var that = this;\n that.initErrorHandler(config);\n that.initLexerAdapter();\n that.initLooksAhead(config);\n that.initRecognizerEngine(tokenVocabulary, config);\n that.initRecoverable(config);\n that.initTreeBuilder(config);\n that.initContentAssist();\n that.initGastRecorder(config);\n that.initPerformanceTracer(config);\n if ((0, has_1.default)(config, \"ignoredIssues\")) {\n throw new Error(\"The IParserConfig property has been deprecated.\\n\tPlease use the flag on the relevant DSL method instead.\\n\tSee: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES\\n\tFor further details.\");\n }\n this.skipValidations = (0, has_1.default)(config, \"skipValidations\") ? config.skipValidations : exports.DEFAULT_PARSER_CONFIG.skipValidations;\n }\n Parser3.performSelfAnalysis = function(parserInstance) {\n throw Error(\"The **static** `performSelfAnalysis` method has been deprecated.\t\\nUse the **instance** method with the same name instead.\");\n };\n Parser3.prototype.performSelfAnalysis = function() {\n var _this = this;\n this.TRACE_INIT(\"performSelfAnalysis\", function() {\n var defErrorsMsgs;\n _this.selfAnalysisDone = true;\n var className = _this.className;\n _this.TRACE_INIT(\"toFastProps\", function() {\n (0, utils_1.toFastProperties)(_this);\n });\n _this.TRACE_INIT(\"Grammar Recording\", function() {\n try {\n _this.enableRecording();\n (0, forEach_12.default)(_this.definedRulesNames, function(currRuleName) {\n var wrappedRule = _this[currRuleName];\n var originalGrammarAction = wrappedRule[\"originalGrammarAction\"];\n var recordedRuleGast;\n _this.TRACE_INIT(\"\".concat(currRuleName, \" Rule\"), function() {\n recordedRuleGast = _this.topLevelRuleRecord(currRuleName, originalGrammarAction);\n });\n _this.gastProductionsCache[currRuleName] = recordedRuleGast;\n });\n } finally {\n _this.disableRecording();\n }\n });\n var resolverErrors = [];\n _this.TRACE_INIT(\"Grammar Resolving\", function() {\n resolverErrors = (0, gast_resolver_public_1.resolveGrammar)({\n rules: (0, values_12.default)(_this.gastProductionsCache)\n });\n _this.definitionErrors = _this.definitionErrors.concat(resolverErrors);\n });\n _this.TRACE_INIT(\"Grammar Validations\", function() {\n if ((0, isEmpty_12.default)(resolverErrors) && _this.skipValidations === false) {\n var validationErrors = (0, gast_resolver_public_1.validateGrammar)({\n rules: (0, values_12.default)(_this.gastProductionsCache),\n tokenTypes: (0, values_12.default)(_this.tokensMap),\n errMsgProvider: errors_public_1.defaultGrammarValidatorErrorProvider,\n grammarName: className\n });\n var lookaheadValidationErrors = (0, checks_1.validateLookahead)({\n lookaheadStrategy: _this.lookaheadStrategy,\n rules: (0, values_12.default)(_this.gastProductionsCache),\n tokenTypes: (0, values_12.default)(_this.tokensMap),\n grammarName: className\n });\n _this.definitionErrors = _this.definitionErrors.concat(validationErrors, lookaheadValidationErrors);\n }\n });\n if ((0, isEmpty_12.default)(_this.definitionErrors)) {\n if (_this.recoveryEnabled) {\n _this.TRACE_INIT(\"computeAllProdsFollows\", function() {\n var allFollows = (0, follow_1.computeAllProdsFollows)((0, values_12.default)(_this.gastProductionsCache));\n _this.resyncFollows = allFollows;\n });\n }\n _this.TRACE_INIT(\"ComputeLookaheadFunctions\", function() {\n var _a2, _b2;\n (_b2 = (_a2 = _this.lookaheadStrategy).initialize) === null || _b2 === void 0 ? void 0 : _b2.call(_a2, {\n rules: (0, values_12.default)(_this.gastProductionsCache)\n });\n _this.preComputeLookaheadFunctions((0, values_12.default)(_this.gastProductionsCache));\n });\n }\n if (!Parser3.DEFER_DEFINITION_ERRORS_HANDLING && !(0, isEmpty_12.default)(_this.definitionErrors)) {\n defErrorsMsgs = (0, map_12.default)(_this.definitionErrors, function(defError) {\n return defError.message;\n });\n throw new Error(\"Parser Definition Errors detected:\\n \".concat(defErrorsMsgs.join(\"\\n-------------------------------\\n\")));\n }\n });\n };\n Parser3.DEFER_DEFINITION_ERRORS_HANDLING = false;\n return Parser3;\n }()\n );\n exports.Parser = Parser2;\n (0, apply_mixins_1.applyMixins)(Parser2, [\n recoverable_1.Recoverable,\n looksahead_1.LooksAhead,\n tree_builder_1.TreeBuilder,\n lexer_adapter_1.LexerAdapter,\n recognizer_engine_1.RecognizerEngine,\n recognizer_api_1.RecognizerApi,\n error_handler_1.ErrorHandler,\n context_assist_1.ContentAssist,\n gast_recorder_1.GastRecorder,\n perf_tracer_1.PerformanceTracer\n ]);\n var CstParser2 = (\n /** @class */\n function(_super) {\n __extends2(CstParser3, _super);\n function CstParser3(tokenVocabulary, config) {\n if (config === void 0) {\n config = exports.DEFAULT_PARSER_CONFIG;\n }\n var configClone = (0, clone_12.default)(config);\n configClone.outputCst = true;\n return _super.call(this, tokenVocabulary, configClone) || this;\n }\n return CstParser3;\n }(Parser2)\n );\n exports.CstParser = CstParser2;\n var EmbeddedActionsParser = (\n /** @class */\n function(_super) {\n __extends2(EmbeddedActionsParser2, _super);\n function EmbeddedActionsParser2(tokenVocabulary, config) {\n if (config === void 0) {\n config = exports.DEFAULT_PARSER_CONFIG;\n }\n var configClone = (0, clone_12.default)(config);\n configClone.outputCst = false;\n return _super.call(this, tokenVocabulary, configClone) || this;\n }\n return EmbeddedActionsParser2;\n }(Parser2)\n );\n exports.EmbeddedActionsParser = EmbeddedActionsParser;\n })(parser);\n return parser;\n}\nvar api = {};\nvar model = {};\nvar __extends = commonjsGlobal && commonjsGlobal.__extends || function() {\n var extendStatics = function(d, b2) {\n extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b3) {\n d2.__proto__ = b3;\n } || function(d2, b3) {\n for (var p in b3)\n if (Object.prototype.hasOwnProperty.call(b3, p))\n d2[p] = b3[p];\n };\n return extendStatics(d, b2);\n };\n return function(d, b2) {\n if (typeof b2 !== \"function\" && b2 !== null)\n throw new TypeError(\"Class extends value \" + String(b2) + \" is not a constructor or null\");\n extendStatics(d, b2);\n function __() {\n this.constructor = d;\n }\n d.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());\n };\n}();\nvar __importDefault$1 = commonjsGlobal && commonjsGlobal.__importDefault || function(mod2) {\n return mod2 && mod2.__esModule ? mod2 : { \"default\": mod2 };\n};\nObject.defineProperty(model, \"__esModule\", { value: true });\nmodel.buildModel = void 0;\nvar gast_1 = api$1;\nvar map_1$1 = __importDefault$1(lodash_map__WEBPACK_IMPORTED_MODULE_3__);\nvar flatten_1$1 = __importDefault$1(lodash_flatten__WEBPACK_IMPORTED_MODULE_16__);\nvar values_1 = __importDefault$1(lodash_values__WEBPACK_IMPORTED_MODULE_5__);\nvar some_1 = __importDefault$1(lodash_some__WEBPACK_IMPORTED_MODULE_13__);\nvar groupBy_1 = __importDefault$1(lodash_groupBy__WEBPACK_IMPORTED_MODULE_35__);\nvar assign_1 = __importDefault$1(lodash_assign__WEBPACK_IMPORTED_MODULE_12__);\nfunction buildModel(productions) {\n var generator = new CstNodeDefinitionGenerator();\n var allRules = (0, values_1.default)(productions);\n return (0, map_1$1.default)(allRules, function(rule) {\n return generator.visitRule(rule);\n });\n}\nmodel.buildModel = buildModel;\nvar CstNodeDefinitionGenerator = (\n /** @class */\n function(_super) {\n __extends(CstNodeDefinitionGenerator2, _super);\n function CstNodeDefinitionGenerator2() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n CstNodeDefinitionGenerator2.prototype.visitRule = function(node) {\n var rawElements = this.visitEach(node.definition);\n var grouped = (0, groupBy_1.default)(rawElements, function(el) {\n return el.propertyName;\n });\n var properties = (0, map_1$1.default)(grouped, function(group, propertyName) {\n var allNullable = !(0, some_1.default)(group, function(el) {\n return !el.canBeNull;\n });\n var propertyType = group[0].type;\n if (group.length > 1) {\n propertyType = (0, map_1$1.default)(group, function(g) {\n return g.type;\n });\n }\n return {\n name: propertyName,\n type: propertyType,\n optional: allNullable\n };\n });\n return {\n name: node.name,\n properties\n };\n };\n CstNodeDefinitionGenerator2.prototype.visitAlternative = function(node) {\n return this.visitEachAndOverrideWith(node.definition, { canBeNull: true });\n };\n CstNodeDefinitionGenerator2.prototype.visitOption = function(node) {\n return this.visitEachAndOverrideWith(node.definition, { canBeNull: true });\n };\n CstNodeDefinitionGenerator2.prototype.visitRepetition = function(node) {\n return this.visitEachAndOverrideWith(node.definition, { canBeNull: true });\n };\n CstNodeDefinitionGenerator2.prototype.visitRepetitionMandatory = function(node) {\n return this.visitEach(node.definition);\n };\n CstNodeDefinitionGenerator2.prototype.visitRepetitionMandatoryWithSeparator = function(node) {\n return this.visitEach(node.definition).concat({\n propertyName: node.separator.name,\n canBeNull: true,\n type: getType(node.separator)\n });\n };\n CstNodeDefinitionGenerator2.prototype.visitRepetitionWithSeparator = function(node) {\n return this.visitEachAndOverrideWith(node.definition, {\n canBeNull: true\n }).concat({\n propertyName: node.separator.name,\n canBeNull: true,\n type: getType(node.separator)\n });\n };\n CstNodeDefinitionGenerator2.prototype.visitAlternation = function(node) {\n return this.visitEachAndOverrideWith(node.definition, { canBeNull: true });\n };\n CstNodeDefinitionGenerator2.prototype.visitTerminal = function(node) {\n return [\n {\n propertyName: node.label || node.terminalType.name,\n canBeNull: false,\n type: getType(node)\n }\n ];\n };\n CstNodeDefinitionGenerator2.prototype.visitNonTerminal = function(node) {\n return [\n {\n propertyName: node.label || node.nonTerminalName,\n canBeNull: false,\n type: getType(node)\n }\n ];\n };\n CstNodeDefinitionGenerator2.prototype.visitEachAndOverrideWith = function(definition, override) {\n return (0, map_1$1.default)(this.visitEach(definition), function(definition2) {\n return (0, assign_1.default)({}, definition2, override);\n });\n };\n CstNodeDefinitionGenerator2.prototype.visitEach = function(definition) {\n var _this = this;\n return (0, flatten_1$1.default)((0, map_1$1.default)(definition, function(definition2) {\n return _this.visit(definition2);\n }));\n };\n return CstNodeDefinitionGenerator2;\n }(gast_1.GAstVisitor)\n);\nfunction getType(production) {\n if (production instanceof gast_1.NonTerminal) {\n return {\n kind: \"rule\",\n name: production.referencedRule.name\n };\n }\n return { kind: \"token\" };\n}\nvar generate = {};\nvar __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod2) {\n return mod2 && mod2.__esModule ? mod2 : { \"default\": mod2 };\n};\nObject.defineProperty(generate, \"__esModule\", { value: true });\ngenerate.genDts = void 0;\nvar flatten_1 = __importDefault(lodash_flatten__WEBPACK_IMPORTED_MODULE_16__);\nvar isArray_1 = __importDefault(lodash_isArray__WEBPACK_IMPORTED_MODULE_22__);\nvar map_1 = __importDefault(lodash_map__WEBPACK_IMPORTED_MODULE_3__);\nvar reduce_1 = __importDefault(lodash_reduce__WEBPACK_IMPORTED_MODULE_31__);\nvar uniq_1 = __importDefault(lodash_uniq__WEBPACK_IMPORTED_MODULE_17__);\nvar upperFirst_1 = __importDefault(lodash_upperFirst__WEBPACK_IMPORTED_MODULE_39__);\nfunction genDts(model2, options) {\n var contentParts = [];\n contentParts = contentParts.concat('import type { CstNode, ICstVisitor, IToken } from \"chevrotain\";');\n contentParts = contentParts.concat((0, flatten_1.default)((0, map_1.default)(model2, function(node) {\n return genCstNodeTypes(node);\n })));\n if (options.includeVisitorInterface) {\n contentParts = contentParts.concat(genVisitor(options.visitorInterfaceName, model2));\n }\n return contentParts.join(\"\\n\\n\") + \"\\n\";\n}\ngenerate.genDts = genDts;\nfunction genCstNodeTypes(node) {\n var nodeCstInterface = genNodeInterface(node);\n var nodeChildrenInterface = genNodeChildrenType(node);\n return [nodeCstInterface, nodeChildrenInterface];\n}\nfunction genNodeInterface(node) {\n var nodeInterfaceName = getNodeInterfaceName(node.name);\n var childrenTypeName = getNodeChildrenTypeName(node.name);\n return \"export interface \".concat(nodeInterfaceName, ' extends CstNode {\\n name: \"').concat(node.name, '\";\\n children: ').concat(childrenTypeName, \";\\n}\");\n}\nfunction genNodeChildrenType(node) {\n var typeName = getNodeChildrenTypeName(node.name);\n return \"export type \".concat(typeName, \" = {\\n \").concat((0, map_1.default)(node.properties, function(property) {\n return genChildProperty(property);\n }).join(\"\\n \"), \"\\n};\");\n}\nfunction genChildProperty(prop) {\n var typeName = buildTypeString(prop.type);\n return \"\".concat(prop.name).concat(prop.optional ? \"?\" : \"\", \": \").concat(typeName, \"[];\");\n}\nfunction genVisitor(name, nodes) {\n return \"export interface \".concat(name, \" extends ICstVisitor {\\n \").concat((0, map_1.default)(nodes, function(node) {\n return genVisitorFunction(node);\n }).join(\"\\n \"), \"\\n}\");\n}\nfunction genVisitorFunction(node) {\n var childrenTypeName = getNodeChildrenTypeName(node.name);\n return \"\".concat(node.name, \"(children: \").concat(childrenTypeName, \", param?: IN): OUT;\");\n}\nfunction buildTypeString(type) {\n if ((0, isArray_1.default)(type)) {\n var typeNames = (0, uniq_1.default)((0, map_1.default)(type, function(t2) {\n return getTypeString(t2);\n }));\n var typeString = (0, reduce_1.default)(typeNames, function(sum, t2) {\n return sum + \" | \" + t2;\n });\n return \"(\" + typeString + \")\";\n } else {\n return getTypeString(type);\n }\n}\nfunction getTypeString(type) {\n if (type.kind === \"token\") {\n return \"IToken\";\n }\n return getNodeInterfaceName(type.name);\n}\nfunction getNodeInterfaceName(ruleName) {\n return (0, upperFirst_1.default)(ruleName) + \"CstNode\";\n}\nfunction getNodeChildrenTypeName(ruleName) {\n return (0, upperFirst_1.default)(ruleName) + \"CstChildren\";\n}\nvar __assign = commonjsGlobal && commonjsGlobal.__assign || function() {\n __assign = Object.assign || function(t2) {\n for (var s, i2 = 1, n = arguments.length; i2 < n; i2++) {\n s = arguments[i2];\n for (var p in s)\n if (Object.prototype.hasOwnProperty.call(s, p))\n t2[p] = s[p];\n }\n return t2;\n };\n return __assign.apply(this, arguments);\n};\nObject.defineProperty(api, \"__esModule\", { value: true });\napi.generateCstDts = void 0;\nvar model_1 = model;\nvar generate_1 = generate;\nvar defaultOptions = {\n includeVisitorInterface: true,\n visitorInterfaceName: \"ICstNodeVisitor\"\n};\nfunction generateCstDts(productions, options) {\n var effectiveOptions = __assign(__assign({}, defaultOptions), options);\n var model2 = (0, model_1.buildModel)(productions);\n return (0, generate_1.genDts)(model2, effectiveOptions);\n}\napi.generateCstDts = generateCstDts;\nvar render_public = {};\nObject.defineProperty(render_public, \"__esModule\", { value: true });\nrender_public.createSyntaxDiagramsCode = void 0;\nvar version_1 = version;\nfunction createSyntaxDiagramsCode(grammar, _a2) {\n var _b2 = _a2 === void 0 ? {} : _a2, _c = _b2.resourceBase, resourceBase = _c === void 0 ? \"https://unpkg.com/chevrotain@\".concat(version_1.VERSION, \"/diagrams/\") : _c, _d = _b2.css, css = _d === void 0 ? \"https://unpkg.com/chevrotain@\".concat(version_1.VERSION, \"/diagrams/diagrams.css\") : _d;\n var header = '\\n\\n\\n\\n\\n\\n';\n var cssHtml = \"\\n\\n\");\n var scripts = \"\\n
${strChars}