@osamash/floor-planner 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/README.md +1 -0
  2. package/dist/floor-planner.css +1 -0
  3. package/dist/floor-planner.es.js +33222 -0
  4. package/dist/floor-planner.umd.js +87 -0
  5. package/dist/types/helpers/default-plan.d.ts +53 -0
  6. package/dist/types/helpers/index.d.ts +2 -0
  7. package/dist/types/index.d.ts +6 -0
  8. package/dist/types/react-planner/ReactPlanner.d.ts +10 -0
  9. package/dist/types/react-planner/ReactPlannerLoader.d.ts +2 -0
  10. package/dist/types/react-planner/catalog/catalog.d.ts +62 -0
  11. package/dist/types/react-planner/catalog/factories/AreaFactory.d.ts +24 -0
  12. package/dist/types/react-planner/catalog/factories/WallFactory.d.ts +26 -0
  13. package/dist/types/react-planner/catalog/factories/area-factory-3d.d.ts +3 -0
  14. package/dist/types/react-planner/catalog/factories/index.d.ts +8 -0
  15. package/dist/types/react-planner/catalog/factories/wall-factory-3d.d.ts +3 -0
  16. package/dist/types/react-planner/catalog/index.d.ts +3 -0
  17. package/dist/types/react-planner/catalog/properties/PropertyCheckbox.d.ts +9 -0
  18. package/dist/types/react-planner/catalog/properties/PropertyColor.d.ts +9 -0
  19. package/dist/types/react-planner/catalog/properties/PropertyEnum.d.ts +9 -0
  20. package/dist/types/react-planner/catalog/properties/PropertyHidden.d.ts +1 -0
  21. package/dist/types/react-planner/catalog/properties/PropertyLengthMeasure.d.ts +11 -0
  22. package/dist/types/react-planner/catalog/properties/PropertyNumber.d.ts +10 -0
  23. package/dist/types/react-planner/catalog/properties/PropertyReadOnly.d.ts +9 -0
  24. package/dist/types/react-planner/catalog/properties/PropertyString.d.ts +9 -0
  25. package/dist/types/react-planner/catalog/properties/PropertyToggle.d.ts +9 -0
  26. package/dist/types/react-planner/catalog/properties/index.d.ts +22 -0
  27. package/dist/types/react-planner/catalog/properties/shared-property-style.d.ts +6 -0
  28. package/dist/types/react-planner/catalog-view/CatalogBreadcrumb.d.ts +5 -0
  29. package/dist/types/react-planner/catalog-view/CatalogItem.d.ts +5 -0
  30. package/dist/types/react-planner/catalog-view/CatalogList.d.ts +10 -0
  31. package/dist/types/react-planner/catalog-view/CatalogPageItem.d.ts +6 -0
  32. package/dist/types/react-planner/catalog-view/CatalogTurnBackPageItem.d.ts +5 -0
  33. package/dist/types/react-planner/class/area.d.ts +31 -0
  34. package/dist/types/react-planner/class/group.d.ts +45 -0
  35. package/dist/types/react-planner/class/guide.d.ts +25 -0
  36. package/dist/types/react-planner/class/hole.d.ts +47 -0
  37. package/dist/types/react-planner/class/index.d.ts +23 -0
  38. package/dist/types/react-planner/class/item.d.ts +61 -0
  39. package/dist/types/react-planner/class/layer.d.ts +45 -0
  40. package/dist/types/react-planner/class/line.d.ts +76 -0
  41. package/dist/types/react-planner/class/project.d.ts +105 -0
  42. package/dist/types/react-planner/class/vertex.d.ts +34 -0
  43. package/dist/types/react-planner/components/Button.d.ts +7 -0
  44. package/dist/types/react-planner/components/ContainerDimensions.d.ts +14 -0
  45. package/dist/types/react-planner/components/Content.d.ts +8 -0
  46. package/dist/types/react-planner/components/ContentContainer.d.ts +9 -0
  47. package/dist/types/react-planner/components/ContentTitle.d.ts +7 -0
  48. package/dist/types/react-planner/components/FormColorInput.d.ts +2 -0
  49. package/dist/types/react-planner/components/FormLabel.d.ts +6 -0
  50. package/dist/types/react-planner/components/FormNumberInput.d.ts +14 -0
  51. package/dist/types/react-planner/components/FormSelect.d.ts +6 -0
  52. package/dist/types/react-planner/components/FormTextInput.d.ts +6 -0
  53. package/dist/types/react-planner/components/PropertyLengthMeasure.d.ts +11 -0
  54. package/dist/types/react-planner/components/PropertyString.d.ts +10 -0
  55. package/dist/types/react-planner/components/SearchInput.d.ts +11 -0
  56. package/dist/types/react-planner/constants.d.ts +237 -0
  57. package/dist/types/react-planner/footer-bar/FooterContentButton.d.ts +11 -0
  58. package/dist/types/react-planner/footer-bar/FooterToggleButton.d.ts +9 -0
  59. package/dist/types/react-planner/footer-bar/Footerbar.d.ts +2 -0
  60. package/dist/types/react-planner/footer-bar/index.d.ts +4 -0
  61. package/dist/types/react-planner/header-bar/Headerbar.d.ts +6 -0
  62. package/dist/types/react-planner/hooks/useScreenshotBeforeUnload.d.ts +4 -0
  63. package/dist/types/react-planner/models.d.ts +214 -0
  64. package/dist/types/react-planner/plugins/autosave.d.ts +2 -0
  65. package/dist/types/react-planner/plugins/index.d.ts +8 -0
  66. package/dist/types/react-planner/plugins/keyboard.d.ts +2 -0
  67. package/dist/types/react-planner/sidebar/Panel.d.ts +8 -0
  68. package/dist/types/react-planner/sidebar/PanelElementEditor.d.ts +6 -0
  69. package/dist/types/react-planner/sidebar/PanelGroupEditor.d.ts +5 -0
  70. package/dist/types/react-planner/sidebar/Sidebar.d.ts +6 -0
  71. package/dist/types/react-planner/sidebar/panel-element-editor/AttributesEditor.d.ts +8 -0
  72. package/dist/types/react-planner/sidebar/panel-element-editor/ElementEditor.d.ts +8 -0
  73. package/dist/types/react-planner/sidebar/panel-element-editor/HoleAttributesEditor.d.ts +8 -0
  74. package/dist/types/react-planner/sidebar/panel-element-editor/ItemAttributesEditor.d.ts +8 -0
  75. package/dist/types/react-planner/sidebar/panel-element-editor/LineAttributesEditor.d.ts +8 -0
  76. package/dist/types/react-planner/sidebar/panel-element-editor/PanelElementEditorEmpty.d.ts +2 -0
  77. package/dist/types/react-planner/toolbar/Popup.d.ts +11 -0
  78. package/dist/types/react-planner/toolbar/Toolbar.d.ts +6 -0
  79. package/dist/types/react-planner/toolbar/ToolbarButton.d.ts +10 -0
  80. package/dist/types/react-planner/toolbar/ToolbarScreenshotButton.d.ts +5 -0
  81. package/dist/types/react-planner/translator/en.d.ts +80 -0
  82. package/dist/types/react-planner/translator/translator.d.ts +10 -0
  83. package/dist/types/react-planner/utils/area-polygon.d.ts +5 -0
  84. package/dist/types/react-planner/utils/browser.d.ts +2 -0
  85. package/dist/types/react-planner/utils/convert-units/convert.d.ts +40 -0
  86. package/dist/types/react-planner/utils/convert-units/definitions/apparentPower.d.ts +46 -0
  87. package/dist/types/react-planner/utils/convert-units/definitions/area.d.ts +87 -0
  88. package/dist/types/react-planner/utils/convert-units/definitions/current.d.ts +32 -0
  89. package/dist/types/react-planner/utils/convert-units/definitions/digital.d.ts +87 -0
  90. package/dist/types/react-planner/utils/convert-units/definitions/each.d.ts +26 -0
  91. package/dist/types/react-planner/utils/convert-units/definitions/energy.d.ts +60 -0
  92. package/dist/types/react-planner/utils/convert-units/definitions/frequency.d.ts +74 -0
  93. package/dist/types/react-planner/utils/convert-units/definitions/illuminance.d.ts +31 -0
  94. package/dist/types/react-planner/utils/convert-units/definitions/length.d.ts +80 -0
  95. package/dist/types/react-planner/utils/convert-units/definitions/mass.d.ts +73 -0
  96. package/dist/types/react-planner/utils/convert-units/definitions/partsPer.d.ts +40 -0
  97. package/dist/types/react-planner/utils/convert-units/definitions/power.d.ts +46 -0
  98. package/dist/types/react-planner/utils/convert-units/definitions/pressure.d.ts +73 -0
  99. package/dist/types/react-planner/utils/convert-units/definitions/reactiveEnergy.d.ts +46 -0
  100. package/dist/types/react-planner/utils/convert-units/definitions/reactivePower.d.ts +46 -0
  101. package/dist/types/react-planner/utils/convert-units/definitions/speed.d.ts +52 -0
  102. package/dist/types/react-planner/utils/convert-units/definitions/temperature.d.ts +48 -0
  103. package/dist/types/react-planner/utils/convert-units/definitions/time.d.ts +81 -0
  104. package/dist/types/react-planner/utils/convert-units/definitions/voltage.d.ts +32 -0
  105. package/dist/types/react-planner/utils/convert-units/definitions/volume.d.ts +192 -0
  106. package/dist/types/react-planner/utils/convert-units/definitions/volumeFlowRate.d.ts +276 -0
  107. package/dist/types/react-planner/utils/convert-units/index.d.ts +26 -0
  108. package/dist/types/react-planner/utils/convert-units/percentError.d.ts +1 -0
  109. package/dist/types/react-planner/utils/geometry.d.ts +161 -0
  110. package/dist/types/react-planner/utils/get-edges-of-subgraphs.d.ts +3 -0
  111. package/dist/types/react-planner/utils/graph-cycles.d.ts +9 -0
  112. package/dist/types/react-planner/utils/graph-inner-cycles.d.ts +6 -0
  113. package/dist/types/react-planner/utils/graph.d.ts +19 -0
  114. package/dist/types/react-planner/utils/history.d.ts +4 -0
  115. package/dist/types/react-planner/utils/id-broker.d.ts +4 -0
  116. package/dist/types/react-planner/utils/immutable-diff-patch.d.ts +8 -0
  117. package/dist/types/react-planner/utils/index.d.ts +22 -0
  118. package/dist/types/react-planner/utils/math.d.ts +3 -0
  119. package/dist/types/react-planner/utils/name-generator.d.ts +3 -0
  120. package/dist/types/react-planner/utils/objects-utils.d.ts +2 -0
  121. package/dist/types/react-planner/utils/screenshot.d.ts +1 -0
  122. package/dist/types/react-planner/utils/snap-scene.d.ts +2 -0
  123. package/dist/types/react-planner/utils/snap.d.ts +17 -0
  124. package/dist/types/react-planner/utils/threeCSG.es6.d.ts +41 -0
  125. package/dist/types/react-planner/utils/zoom.d.ts +8 -0
  126. package/dist/types/react-planner/viewer2d/Area.d.ts +8 -0
  127. package/dist/types/react-planner/viewer2d/GridHorizontalStreak.d.ts +7 -0
  128. package/dist/types/react-planner/viewer2d/GridVerticalStreak.d.ts +7 -0
  129. package/dist/types/react-planner/viewer2d/Grids.d.ts +5 -0
  130. package/dist/types/react-planner/viewer2d/Group.d.ts +9 -0
  131. package/dist/types/react-planner/viewer2d/Item.d.ts +9 -0
  132. package/dist/types/react-planner/viewer2d/Layer.d.ts +9 -0
  133. package/dist/types/react-planner/viewer2d/Line.d.ts +10 -0
  134. package/dist/types/react-planner/viewer2d/Ruler.d.ts +7 -0
  135. package/dist/types/react-planner/viewer2d/Scene.d.ts +9 -0
  136. package/dist/types/react-planner/viewer2d/Snap.d.ts +7 -0
  137. package/dist/types/react-planner/viewer2d/State.d.ts +6 -0
  138. package/dist/types/react-planner/viewer2d/Vertex.d.ts +6 -0
  139. package/dist/types/react-planner/viewer2d/Viewer2D.d.ts +8 -0
  140. package/dist/types/shared-style.d.ts +105 -0
  141. package/dist/types/store/ReactPlannerStore.d.ts +111 -0
  142. package/package.json +92 -0
@@ -0,0 +1,87 @@
1
+ (function(ze,N){typeof exports=="object"&&typeof module<"u"?N(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],N):(ze=typeof globalThis<"u"?globalThis:ze||self,N(ze.FloorPlanner={},ze.React))})(this,function(ze,N){"use strict";var TE=Object.defineProperty;var CE=(ze,N,rn)=>N in ze?TE(ze,N,{enumerable:!0,configurable:!0,writable:!0,value:rn}):ze[N]=rn;var Vt=(ze,N,rn)=>CE(ze,typeof N!="symbol"?N+"":N,rn);function rn(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function Wh(n){if(Object.prototype.hasOwnProperty.call(n,"__esModule"))return n;var t=n.default;if(typeof t=="function"){var e=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}),e}var Yo={exports:{}},$s={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var Uh;function s0(){if(Uh)return $s;Uh=1;var n=N,t=Symbol.for("react.element"),e=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,l,c){var h,f={},g=null,p=null;c!==void 0&&(g=""+c),l.key!==void 0&&(g=""+l.key),l.ref!==void 0&&(p=l.ref);for(h in l)r.call(l,h)&&!s.hasOwnProperty(h)&&(f[h]=l[h]);if(a&&a.defaultProps)for(h in l=a.defaultProps,l)f[h]===void 0&&(f[h]=l[h]);return{$$typeof:t,type:a,key:g,ref:p,props:f,_owner:i.current}}return $s.Fragment=e,$s.jsx=o,$s.jsxs=o,$s}var Hs={};/**
10
+ * @license React
11
+ * react-jsx-runtime.development.js
12
+ *
13
+ * Copyright (c) Facebook, Inc. and its affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var Yh;function o0(){return Yh||(Yh=1,process.env.NODE_ENV!=="production"&&function(){var n=N,t=Symbol.for("react.element"),e=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),a=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),m=Symbol.iterator,v="@@iterator";function _(I){if(I===null||typeof I!="object")return null;var G=m&&I[m]||I[v];return typeof G=="function"?G:null}var S=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function M(I){{for(var G=arguments.length,ot=new Array(G>1?G-1:0),Mt=1;Mt<G;Mt++)ot[Mt-1]=arguments[Mt];T("error",I,ot)}}function T(I,G,ot){{var Mt=S.ReactDebugCurrentFrame,jt=Mt.getStackAddendum();jt!==""&&(G+="%s",ot=ot.concat([jt]));var qt=ot.map(function(At){return String(At)});qt.unshift("Warning: "+G),Function.prototype.apply.call(console[I],console,qt)}}var C=!1,E=!1,z=!1,R=!1,k=!1,L;L=Symbol.for("react.module.reference");function X(I){return!!(typeof I=="string"||typeof I=="function"||I===r||I===s||k||I===i||I===c||I===h||R||I===p||C||E||z||typeof I=="object"&&I!==null&&(I.$$typeof===g||I.$$typeof===f||I.$$typeof===o||I.$$typeof===a||I.$$typeof===l||I.$$typeof===L||I.getModuleId!==void 0))}function J(I,G,ot){var Mt=I.displayName;if(Mt)return Mt;var jt=G.displayName||G.name||"";return jt!==""?ot+"("+jt+")":ot}function at(I){return I.displayName||"Context"}function tt(I){if(I==null)return null;if(typeof I.tag=="number"&&M("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof I=="function")return I.displayName||I.name||null;if(typeof I=="string")return I;switch(I){case r:return"Fragment";case e:return"Portal";case s:return"Profiler";case i:return"StrictMode";case c:return"Suspense";case h:return"SuspenseList"}if(typeof I=="object")switch(I.$$typeof){case a:var G=I;return at(G)+".Consumer";case o:var ot=I;return at(ot._context)+".Provider";case l:return J(I,I.render,"ForwardRef");case f:var Mt=I.displayName||null;return Mt!==null?Mt:tt(I.type)||"Memo";case g:{var jt=I,qt=jt._payload,At=jt._init;try{return tt(At(qt))}catch{return null}}}return null}var bt=Object.assign,xt=0,yt,ht,Y,St,j,W,ft;function et(){}et.__reactDisabledLog=!0;function rt(){{if(xt===0){yt=console.log,ht=console.info,Y=console.warn,St=console.error,j=console.group,W=console.groupCollapsed,ft=console.groupEnd;var I={configurable:!0,enumerable:!0,value:et,writable:!0};Object.defineProperties(console,{info:I,log:I,warn:I,error:I,group:I,groupCollapsed:I,groupEnd:I})}xt++}}function Z(){{if(xt--,xt===0){var I={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:bt({},I,{value:yt}),info:bt({},I,{value:ht}),warn:bt({},I,{value:Y}),error:bt({},I,{value:St}),group:bt({},I,{value:j}),groupCollapsed:bt({},I,{value:W}),groupEnd:bt({},I,{value:ft})})}xt<0&&M("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Q=S.ReactCurrentDispatcher,U;function st(I,G,ot){{if(U===void 0)try{throw Error()}catch(jt){var Mt=jt.stack.trim().match(/\n( *(at )?)/);U=Mt&&Mt[1]||""}return`
18
+ `+U+I}}var vt=!1,B;{var pt=typeof WeakMap=="function"?WeakMap:Map;B=new pt}function H(I,G){if(!I||vt)return"";{var ot=B.get(I);if(ot!==void 0)return ot}var Mt;vt=!0;var jt=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var qt;qt=Q.current,Q.current=null,rt();try{if(G){var At=function(){throw Error()};if(Object.defineProperty(At.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(At,[])}catch(me){Mt=me}Reflect.construct(I,[],At)}else{try{At.call()}catch(me){Mt=me}I.call(At.prototype)}}else{try{throw Error()}catch(me){Mt=me}I()}}catch(me){if(me&&Mt&&typeof me.stack=="string"){for(var nt=me.stack.split(`
19
+ `),Oe=Mt.stack.split(`
20
+ `),ue=nt.length-1,mt=Oe.length-1;ue>=1&&mt>=0&&nt[ue]!==Oe[mt];)mt--;for(;ue>=1&&mt>=0;ue--,mt--)if(nt[ue]!==Oe[mt]){if(ue!==1||mt!==1)do if(ue--,mt--,mt<0||nt[ue]!==Oe[mt]){var Pe=`
21
+ `+nt[ue].replace(" at new "," at ");return I.displayName&&Pe.includes("<anonymous>")&&(Pe=Pe.replace("<anonymous>",I.displayName)),typeof I=="function"&&B.set(I,Pe),Pe}while(ue>=1&&mt>=0);break}}}finally{vt=!1,Q.current=qt,Z(),Error.prepareStackTrace=jt}var pr=I?I.displayName||I.name:"",gr=pr?st(pr):"";return typeof I=="function"&&B.set(I,gr),gr}function Ot(I,G,ot){return H(I,!1)}function Bt(I){var G=I.prototype;return!!(G&&G.isReactComponent)}function kt(I,G,ot){if(I==null)return"";if(typeof I=="function")return H(I,Bt(I));if(typeof I=="string")return st(I);switch(I){case c:return st("Suspense");case h:return st("SuspenseList")}if(typeof I=="object")switch(I.$$typeof){case l:return Ot(I.render);case f:return kt(I.type,G,ot);case g:{var Mt=I,jt=Mt._payload,qt=Mt._init;try{return kt(qt(jt),G,ot)}catch{}}}return""}var Ct=Object.prototype.hasOwnProperty,Gt={},gt=S.ReactDebugCurrentFrame;function _t(I){if(I){var G=I._owner,ot=kt(I.type,I._source,G?G.type:null);gt.setExtraStackFrame(ot)}else gt.setExtraStackFrame(null)}function Dt(I,G,ot,Mt,jt){{var qt=Function.call.bind(Ct);for(var At in I)if(qt(I,At)){var nt=void 0;try{if(typeof I[At]!="function"){var Oe=Error((Mt||"React class")+": "+ot+" type `"+At+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof I[At]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Oe.name="Invariant Violation",Oe}nt=I[At](G,At,Mt,ot,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(ue){nt=ue}nt&&!(nt instanceof Error)&&(_t(jt),M("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",Mt||"React class",ot,At,typeof nt),_t(null)),nt instanceof Error&&!(nt.message in Gt)&&(Gt[nt.message]=!0,_t(jt),M("Failed %s type: %s",ot,nt.message),_t(null))}}}var zt=Array.isArray;function Le(I){return zt(I)}function Qr(I){{var G=typeof Symbol=="function"&&Symbol.toStringTag,ot=G&&I[Symbol.toStringTag]||I.constructor.name||"Object";return ot}}function Dn(I){try{return _n(I),!1}catch{return!0}}function _n(I){return""+I}function Bn(I){if(Dn(I))return M("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Qr(I)),_n(I)}var Ci=S.ReactCurrentOwner,Ii={key:!0,ref:!0,__self:!0,__source:!0},se,Ye;function Cr(I){if(Ct.call(I,"ref")){var G=Object.getOwnPropertyDescriptor(I,"ref").get;if(G&&G.isReactWarning)return!1}return I.ref!==void 0}function dr(I){if(Ct.call(I,"key")){var G=Object.getOwnPropertyDescriptor(I,"key").get;if(G&&G.isReactWarning)return!1}return I.key!==void 0}function ki(I,G){typeof I.ref=="string"&&Ci.current}function qn(I,G){{var ot=function(){se||(se=!0,M("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",G))};ot.isReactWarning=!0,Object.defineProperty(I,"key",{get:ot,configurable:!0})}}function oe(I,G){{var ot=function(){Ye||(Ye=!0,M("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",G))};ot.isReactWarning=!0,Object.defineProperty(I,"ref",{get:ot,configurable:!0})}}var $n=function(I,G,ot,Mt,jt,qt,At){var nt={$$typeof:t,type:I,key:G,ref:ot,props:At,_owner:qt};return nt._store={},Object.defineProperty(nt._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(nt,"_self",{configurable:!1,enumerable:!1,writable:!1,value:Mt}),Object.defineProperty(nt,"_source",{configurable:!1,enumerable:!1,writable:!1,value:jt}),Object.freeze&&(Object.freeze(nt.props),Object.freeze(nt)),nt};function we(I,G,ot,Mt,jt){{var qt,At={},nt=null,Oe=null;ot!==void 0&&(Bn(ot),nt=""+ot),dr(G)&&(Bn(G.key),nt=""+G.key),Cr(G)&&(Oe=G.ref,ki(G,jt));for(qt in G)Ct.call(G,qt)&&!Ii.hasOwnProperty(qt)&&(At[qt]=G[qt]);if(I&&I.defaultProps){var ue=I.defaultProps;for(qt in ue)At[qt]===void 0&&(At[qt]=ue[qt])}if(nt||Oe){var mt=typeof I=="function"?I.displayName||I.name||"Unknown":I;nt&&qn(At,mt),Oe&&oe(At,mt)}return $n(I,nt,Oe,jt,Mt,Ci.current,At)}}var Pi=S.ReactCurrentOwner,Ri=S.ReactDebugCurrentFrame;function ae(I){if(I){var G=I._owner,ot=kt(I.type,I._source,G?G.type:null);Ri.setExtraStackFrame(ot)}else Ri.setExtraStackFrame(null)}var Li;Li=!1;function Ir(I){return typeof I=="object"&&I!==null&&I.$$typeof===t}function oi(){{if(Pi.current){var I=tt(Pi.current.type);if(I)return`
22
+
23
+ Check the render method of \``+I+"`."}return""}}function ai(I){return""}var Fi={};function Ni(I){{var G=oi();if(!G){var ot=typeof I=="string"?I:I.displayName||I.name;ot&&(G=`
24
+
25
+ Check the top-level render call using <`+ot+">.")}return G}}function Fs(I,G){{if(!I._store||I._store.validated||I.key!=null)return;I._store.validated=!0;var ot=Ni(G);if(Fi[ot])return;Fi[ot]=!0;var Mt="";I&&I._owner&&I._owner!==Pi.current&&(Mt=" It was passed a child from "+tt(I._owner.type)+"."),ae(I),M('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',ot,Mt),ae(null)}}function $e(I,G){{if(typeof I!="object")return;if(Le(I))for(var ot=0;ot<I.length;ot++){var Mt=I[ot];Ir(Mt)&&Fs(Mt,G)}else if(Ir(I))I._store&&(I._store.validated=!0);else if(I){var jt=_(I);if(typeof jt=="function"&&jt!==I.entries)for(var qt=jt.call(I),At;!(At=qt.next()).done;)Ir(At.value)&&Fs(At.value,G)}}}function Th(I){{var G=I.type;if(G==null||typeof G=="string")return;var ot;if(typeof G=="function")ot=G.propTypes;else if(typeof G=="object"&&(G.$$typeof===l||G.$$typeof===f))ot=G.propTypes;else return;if(ot){var Mt=tt(G);Dt(ot,I.props,"prop",Mt,I)}else if(G.PropTypes!==void 0&&!Li){Li=!0;var jt=tt(G);M("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",jt||"Unknown")}typeof G.getDefaultProps=="function"&&!G.getDefaultProps.isReactClassApproved&&M("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function jo(I){{for(var G=Object.keys(I.props),ot=0;ot<G.length;ot++){var Mt=G[ot];if(Mt!=="children"&&Mt!=="key"){ae(I),M("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",Mt),ae(null);break}}I.ref!==null&&(ae(I),M("Invalid attribute `ref` supplied to `React.Fragment`."),ae(null))}}var _u={};function Vo(I,G,ot,Mt,jt,qt){{var At=X(I);if(!At){var nt="";(I===void 0||typeof I=="object"&&I!==null&&Object.keys(I).length===0)&&(nt+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Oe=ai();Oe?nt+=Oe:nt+=oi();var ue;I===null?ue="null":Le(I)?ue="array":I!==void 0&&I.$$typeof===t?(ue="<"+(tt(I.type)||"Unknown")+" />",nt=" Did you accidentally export a JSX literal instead of a component?"):ue=typeof I,M("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",ue,nt)}var mt=we(I,G,ot,jt,qt);if(mt==null)return mt;if(At){var Pe=G.children;if(Pe!==void 0)if(Mt)if(Le(Pe)){for(var pr=0;pr<Pe.length;pr++)$e(Pe[pr],I);Object.freeze&&Object.freeze(Pe)}else M("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else $e(Pe,I)}if(Ct.call(G,"key")){var gr=tt(I),me=Object.keys(G).filter(function($o){return $o!=="key"}),mr=me.length>0?"{key: someKey, "+me.join(": ..., ")+": ...}":"{key: someKey}";if(!_u[gr+mr]){var qo=me.length>0?"{"+me.join(": ..., ")+": ...}":"{}";M(`A props object containing a "key" prop is being spread into JSX:
26
+ let props = %s;
27
+ <%s {...props} />
28
+ React keys must be passed directly to JSX without using spread:
29
+ let props = %s;
30
+ <%s key={someKey} {...props} />`,mr,gr,qo,gr),_u[gr+mr]=!0}}return I===r?jo(mt):Th(mt),mt}}function bu(I,G,ot){return Vo(I,G,ot,!0)}function Ch(I,G,ot){return Vo(I,G,ot,!1)}var Do=Ch,Bo=bu;Hs.Fragment=r,Hs.jsx=Do,Hs.jsxs=Bo}()),Hs}var Xh;function a0(){return Xh||(Xh=1,process.env.NODE_ENV==="production"?Yo.exports=s0():Yo.exports=o0()),Yo.exports}var w=a0();const Jh=n=>{let t;const e=new Set,r=(c,h)=>{const f=typeof c=="function"?c(t):c;if(!Object.is(f,t)){const g=t;t=h??(typeof f!="object"||f===null)?f:Object.assign({},t,f),e.forEach(p=>p(t,g))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>l,subscribe:c=>(e.add(c),()=>e.delete(c))},l=t=n(r,i,a);return a},u0=n=>n?Jh(n):Jh,l0=n=>n;function c0(n,t=l0){const e=N.useSyncExternalStore(n.subscribe,N.useCallback(()=>t(n.getState()),[n,t]),N.useCallback(()=>t(n.getInitialState()),[n,t]));return N.useDebugValue(e),e}const Zh=n=>{const t=u0(n),e=r=>c0(t,r);return Object.assign(e,t),e},h0=n=>n?Zh(n):Zh;/**
31
+ * @license
32
+ * MIT License
33
+ *
34
+ * Copyright (c) 2014-present, Lee Byron and other contributors.
35
+ *
36
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
37
+ * of this software and associated documentation files (the "Software"), to deal
38
+ * in the Software without restriction, including without limitation the rights
39
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
40
+ * copies of the Software, and to permit persons to whom the Software is
41
+ * furnished to do so, subject to the following conditions:
42
+ *
43
+ * The above copyright notice and this permission notice shall be included in all
44
+ * copies or substantial portions of the Software.
45
+ *
46
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
47
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
48
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
49
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
50
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
51
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
52
+ * SOFTWARE.
53
+ */var Gs="delete",Ut=5,rr=1<<Ut,He=rr-1,Ft={};function ku(){return{value:!1}}function xr(n){n&&(n.value=!0)}function Pu(){}function ji(n){return n.size===void 0&&(n.size=n.__iterate(Kh)),n.size}function Hn(n,t){if(typeof t!="number"){var e=t>>>0;if(""+e!==t||e===4294967295)return NaN;t=e}return t<0?ji(n)+t:t}function Kh(){return!0}function Ws(n,t,e){return(n===0&&!tf(n)||e!==void 0&&n<=-e)&&(t===void 0||e!==void 0&&t>=e)}function Vi(n,t){return Qh(n,t,0)}function Us(n,t){return Qh(n,t,t)}function Qh(n,t,e){return n===void 0?e:tf(n)?t===1/0?t:Math.max(0,t+n)|0:t===void 0||t===n?n:Math.min(t,n)|0}function tf(n){return n<0||n===0&&1/n===-1/0}var ef="@@__IMMUTABLE_ITERABLE__@@";function Ze(n){return!!(n&&n[ef])}var Xo="@@__IMMUTABLE_KEYED__@@";function Kt(n){return!!(n&&n[Xo])}var Jo="@@__IMMUTABLE_INDEXED__@@";function Ke(n){return!!(n&&n[Jo])}function Zo(n){return Kt(n)||Ke(n)}var Te=function(t){return Ze(t)?t:Ee(t)},_r=function(n){function t(e){return Kt(e)?e:Un(e)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t}(Te),ci=function(n){function t(e){return Ke(e)?e:wr(e)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t}(Te),Di=function(n){function t(e){return Ze(e)&&!Zo(e)?e:$i(e)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t}(Te);Te.Keyed=_r,Te.Indexed=ci,Te.Set=Di;var rf="@@__IMMUTABLE_SEQ__@@";function Ko(n){return!!(n&&n[rf])}var nf="@@__IMMUTABLE_RECORD__@@";function Gn(n){return!!(n&&n[nf])}function br(n){return Ze(n)||Gn(n)}var Wn="@@__IMMUTABLE_ORDERED__@@";function Rr(n){return!!(n&&n[Wn])}var Bi=0,nr=1,ir=2,Ru=typeof Symbol=="function"&&Symbol.iterator,sf="@@iterator",Qo=Ru||sf,Nt=function(t){this.next=t};Nt.prototype.toString=function(){return"[Iterator]"},Nt.KEYS=Bi,Nt.VALUES=nr,Nt.ENTRIES=ir,Nt.prototype.inspect=Nt.prototype.toSource=function(){return this.toString()},Nt.prototype[Qo]=function(){return this};function ee(n,t,e,r){var i=n===Bi?t:n===nr?e:[t,e];return r?r.value=i:r={value:i,done:!1},r}function Ne(){return{value:void 0,done:!0}}function Lu(n){return Array.isArray(n)?!0:!!ta(n)}function of(n){return n&&typeof n.next=="function"}function Fu(n){var t=ta(n);return t&&t.call(n)}function ta(n){var t=n&&(Ru&&n[Ru]||n[sf]);if(typeof t=="function")return t}function f0(n){var t=ta(n);return t&&t===n.entries}function d0(n){var t=ta(n);return t&&t===n.keys}var qi=Object.prototype.hasOwnProperty;function Nu(n){return Array.isArray(n)||typeof n=="string"?!0:n&&typeof n=="object"&&Number.isInteger(n.length)&&n.length>=0&&(n.length===0?Object.keys(n).length===1:n.hasOwnProperty(n.length-1))}var Ee=function(n){function t(e){return e==null?Vu():br(e)?e.toSeq():g0(e)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.toSeq=function(){return this},t.prototype.toString=function(){return this.__toString("Seq {","}")},t.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},t.prototype.__iterate=function(r,i){var s=this._cache;if(s){for(var o=s.length,a=0;a!==o;){var l=s[i?o-++a:a++];if(r(l[1],l[0],this)===!1)break}return a}return this.__iterateUncached(r,i)},t.prototype.__iterator=function(r,i){var s=this._cache;if(s){var o=s.length,a=0;return new Nt(function(){if(a===o)return Ne();var l=s[i?o-++a:a++];return ee(r,l[0],l[1])})}return this.__iteratorUncached(r,i)},t}(Te),Un=function(n){function t(e){return e==null?Vu().toKeyedSeq():Ze(e)?Kt(e)?e.toSeq():e.fromEntrySeq():Gn(e)?e.toSeq():Du(e)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.toKeyedSeq=function(){return this},t}(Ee),wr=function(n){function t(e){return e==null?Vu():Ze(e)?Kt(e)?e.entrySeq():e.toIndexedSeq():Gn(e)?e.toSeq().entrySeq():uf(e)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.of=function(){return t(arguments)},t.prototype.toIndexedSeq=function(){return this},t.prototype.toString=function(){return this.__toString("Seq [","]")},t}(Ee),$i=function(n){function t(e){return(Ze(e)&&!Zo(e)?e:wr(e)).toSetSeq()}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.of=function(){return t(arguments)},t.prototype.toSetSeq=function(){return this},t}(Ee);Ee.isSeq=Ko,Ee.Keyed=Un,Ee.Set=$i,Ee.Indexed=wr,Ee.prototype[rf]=!0;var Hi=function(n){function t(e){this._array=e,this.size=e.length}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.get=function(r,i){return this.has(r)?this._array[Hn(this,r)]:i},t.prototype.__iterate=function(r,i){for(var s=this._array,o=s.length,a=0;a!==o;){var l=i?o-++a:a++;if(r(s[l],l,this)===!1)break}return a},t.prototype.__iterator=function(r,i){var s=this._array,o=s.length,a=0;return new Nt(function(){if(a===o)return Ne();var l=i?o-++a:a++;return ee(r,l,s[l])})},t}(wr),ju=function(n){function t(e){var r=Object.keys(e).concat(Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[]);this._object=e,this._keys=r,this.size=r.length}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.get=function(r,i){return i!==void 0&&!this.has(r)?i:this._object[r]},t.prototype.has=function(r){return qi.call(this._object,r)},t.prototype.__iterate=function(r,i){for(var s=this._object,o=this._keys,a=o.length,l=0;l!==a;){var c=o[i?a-++l:l++];if(r(s[c],c,this)===!1)break}return l},t.prototype.__iterator=function(r,i){var s=this._object,o=this._keys,a=o.length,l=0;return new Nt(function(){if(l===a)return Ne();var c=o[i?a-++l:l++];return ee(r,c,s[c])})},t}(Un);ju.prototype[Wn]=!0;var p0=function(n){function t(e){this._collection=e,this.size=e.length||e.size}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.__iterateUncached=function(r,i){if(i)return this.cacheResult().__iterate(r,i);var s=this._collection,o=Fu(s),a=0;if(of(o))for(var l;!(l=o.next()).done&&r(l.value,a++,this)!==!1;);return a},t.prototype.__iteratorUncached=function(r,i){if(i)return this.cacheResult().__iterator(r,i);var s=this._collection,o=Fu(s);if(!of(o))return new Nt(Ne);var a=0;return new Nt(function(){var l=o.next();return l.done?l:ee(r,a++,l.value)})},t}(wr),af;function Vu(){return af||(af=new Hi([]))}function Du(n){var t=Bu(n);if(t)return t.fromEntrySeq();if(typeof n=="object")return new ju(n);throw new TypeError("Expected Array or collection object of [k, v] entries, or keyed object: "+n)}function uf(n){var t=Bu(n);if(t)return t;throw new TypeError("Expected Array or collection object of values: "+n)}function g0(n){var t=Bu(n);if(t)return f0(n)?t.fromEntrySeq():d0(n)?t.toSetSeq():t;if(typeof n=="object")return new ju(n);throw new TypeError("Expected Array or collection object of values, or keyed object: "+n)}function Bu(n){return Nu(n)?new Hi(n):Lu(n)?new p0(n):void 0}var lf="@@__IMMUTABLE_MAP__@@";function ea(n){return!!(n&&n[lf])}function qu(n){return ea(n)&&Rr(n)}function $u(n){return!!(n&&typeof n.equals=="function"&&typeof n.hashCode=="function")}function Ce(n,t){if(n===t||n!==n&&t!==t)return!0;if(!n||!t)return!1;if(typeof n.valueOf=="function"&&typeof t.valueOf=="function"){if(n=n.valueOf(),t=t.valueOf(),n===t||n!==n&&t!==t)return!0;if(!n||!t)return!1}return!!($u(n)&&$u(t)&&n.equals(t))}var Ys=typeof Math.imul=="function"&&Math.imul(4294967295,2)===-2?Math.imul:function(t,e){t|=0,e|=0;var r=t&65535,i=e&65535;return r*i+((t>>>16)*i+r*(e>>>16)<<16>>>0)|0};function ra(n){return n>>>1&1073741824|n&3221225471}var m0=Object.prototype.valueOf;function Qe(n){if(n==null)return cf(n);if(typeof n.hashCode=="function")return ra(n.hashCode(n));var t=w0(n);if(t==null)return cf(t);switch(typeof t){case"boolean":return t?1108378657:1108378656;case"number":return y0(t);case"string":return t.length>S0?v0(t):Hu(t);case"object":case"function":return _0(t);case"symbol":return x0(t);default:if(typeof t.toString=="function")return Hu(t.toString());throw new Error("Value type "+typeof t+" cannot be hashed.")}}function cf(n){return n===null?1108378658:1108378659}function y0(n){if(n!==n||n===1/0)return 0;var t=n|0;for(t!==n&&(t^=n*4294967295);n>4294967295;)n/=4294967295,t^=n;return ra(t)}function v0(n){var t=Xu[n];return t===void 0&&(t=Hu(n),Yu===E0&&(Yu=0,Xu={}),Yu++,Xu[n]=t),t}function Hu(n){for(var t=0,e=0;e<n.length;e++)t=31*t+n.charCodeAt(e)|0;return ra(t)}function x0(n){var t=pf[n];return t!==void 0||(t=df(),pf[n]=t),t}function _0(n){var t;if(Gu&&(t=Wu.get(n),t!==void 0)||(t=n[hi],t!==void 0)||!ff&&(t=n.propertyIsEnumerable&&n.propertyIsEnumerable[hi],t!==void 0||(t=b0(n),t!==void 0)))return t;if(t=df(),Gu)Wu.set(n,t);else{if(hf!==void 0&&hf(n)===!1)throw new Error("Non-extensible objects are not allowed as keys.");if(ff)Object.defineProperty(n,hi,{enumerable:!1,configurable:!1,writable:!1,value:t});else if(n.propertyIsEnumerable!==void 0&&n.propertyIsEnumerable===n.constructor.prototype.propertyIsEnumerable)n.propertyIsEnumerable=function(){return this.constructor.prototype.propertyIsEnumerable.apply(this,arguments)},n.propertyIsEnumerable[hi]=t;else if(n.nodeType!==void 0)n[hi]=t;else throw new Error("Unable to set a non-enumerable property on object.")}return t}var hf=Object.isExtensible,ff=function(){try{return Object.defineProperty({},"@",{}),!0}catch{return!1}}();function b0(n){if(n&&n.nodeType>0)switch(n.nodeType){case 1:return n.uniqueID;case 9:return n.documentElement&&n.documentElement.uniqueID}}function w0(n){return n.valueOf!==m0&&typeof n.valueOf=="function"?n.valueOf(n):n}function df(){var n=++Uu;return Uu&1073741824&&(Uu=0),n}var Gu=typeof WeakMap=="function",Wu;Gu&&(Wu=new WeakMap);var pf=Object.create(null),Uu=0,hi="__immutablehash__";typeof Symbol=="function"&&(hi=Symbol(hi));var S0=16,E0=255,Yu=0,Xu={},na=function(n){function t(e,r){this._iter=e,this._useKeys=r,this.size=e.size}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.get=function(r,i){return this._iter.get(r,i)},t.prototype.has=function(r){return this._iter.has(r)},t.prototype.valueSeq=function(){return this._iter.valueSeq()},t.prototype.reverse=function(){var r=this,i=Ju(this,!0);return this._useKeys||(i.valueSeq=function(){return r._iter.toSeq().reverse()}),i},t.prototype.map=function(r,i){var s=this,o=xf(this,r,i);return this._useKeys||(o.valueSeq=function(){return s._iter.toSeq().map(r,i)}),o},t.prototype.__iterate=function(r,i){var s=this;return this._iter.__iterate(function(o,a){return r(o,a,s)},i)},t.prototype.__iterator=function(r,i){return this._iter.__iterator(r,i)},t}(Un);na.prototype[Wn]=!0;var gf=function(n){function t(e){this._iter=e,this.size=e.size}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.includes=function(r){return this._iter.includes(r)},t.prototype.__iterate=function(r,i){var s=this,o=0;return i&&ji(this),this._iter.__iterate(function(a){return r(a,i?s.size-++o:o++,s)},i)},t.prototype.__iterator=function(r,i){var s=this,o=this._iter.__iterator(nr,i),a=0;return i&&ji(this),new Nt(function(){var l=o.next();return l.done?l:ee(r,i?s.size-++a:a++,l.value,l)})},t}(wr),mf=function(n){function t(e){this._iter=e,this.size=e.size}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.has=function(r){return this._iter.includes(r)},t.prototype.__iterate=function(r,i){var s=this;return this._iter.__iterate(function(o){return r(o,o,s)},i)},t.prototype.__iterator=function(r,i){var s=this._iter.__iterator(nr,i);return new Nt(function(){var o=s.next();return o.done?o:ee(r,o.value,o.value,o)})},t}($i),yf=function(n){function t(e){this._iter=e,this.size=e.size}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.entrySeq=function(){return this._iter.toSeq()},t.prototype.__iterate=function(r,i){var s=this;return this._iter.__iterate(function(o){if(o){Ef(o);var a=Ze(o);return r(a?o.get(1):o[1],a?o.get(0):o[0],s)}},i)},t.prototype.__iterator=function(r,i){var s=this._iter.__iterator(nr,i);return new Nt(function(){for(;;){var o=s.next();if(o.done)return o;var a=o.value;if(a){Ef(a);var l=Ze(a);return ee(r,l?a.get(0):a[0],l?a.get(1):a[1],o)}}})},t}(Un);gf.prototype.cacheResult=na.prototype.cacheResult=mf.prototype.cacheResult=yf.prototype.cacheResult=Qu;function vf(n){var t=nn(n);return t._iter=n,t.size=n.size,t.flip=function(){return n},t.reverse=function(){var e=n.reverse.apply(this);return e.flip=function(){return n.reverse()},e},t.has=function(e){return n.includes(e)},t.includes=function(e){return n.has(e)},t.cacheResult=Qu,t.__iterateUncached=function(e,r){var i=this;return n.__iterate(function(s,o){return e(o,s,i)!==!1},r)},t.__iteratorUncached=function(e,r){if(e===ir){var i=n.__iterator(e,r);return new Nt(function(){var s=i.next();if(!s.done){var o=s.value[0];s.value[0]=s.value[1],s.value[1]=o}return s})}return n.__iterator(e===nr?Bi:nr,r)},t}function xf(n,t,e){var r=nn(n);return r.size=n.size,r.has=function(i){return n.has(i)},r.get=function(i,s){var o=n.get(i,Ft);return o===Ft?s:t.call(e,o,i,n)},r.__iterateUncached=function(i,s){var o=this;return n.__iterate(function(a,l,c){return i(t.call(e,a,l,c),l,o)!==!1},s)},r.__iteratorUncached=function(i,s){var o=n.__iterator(ir,s);return new Nt(function(){var a=o.next();if(a.done)return a;var l=a.value,c=l[0];return ee(i,c,t.call(e,l[1],c,n),a)})},r}function Ju(n,t){var e=this,r=nn(n);return r._iter=n,r.size=n.size,r.reverse=function(){return n},n.flip&&(r.flip=function(){var i=vf(n);return i.reverse=function(){return n.flip()},i}),r.get=function(i,s){return n.get(t?i:-1-i,s)},r.has=function(i){return n.has(t?i:-1-i)},r.includes=function(i){return n.includes(i)},r.cacheResult=Qu,r.__iterate=function(i,s){var o=this,a=0;return s&&ji(n),n.__iterate(function(l,c){return i(l,t?c:s?o.size-++a:a++,o)},!s)},r.__iterator=function(i,s){var o=0;s&&ji(n);var a=n.__iterator(ir,!s);return new Nt(function(){var l=a.next();if(l.done)return l;var c=l.value;return ee(i,t?c[0]:s?e.size-++o:o++,c[1],l)})},r}function _f(n,t,e,r){var i=nn(n);return r&&(i.has=function(s){var o=n.get(s,Ft);return o!==Ft&&!!t.call(e,o,s,n)},i.get=function(s,o){var a=n.get(s,Ft);return a!==Ft&&t.call(e,a,s,n)?a:o}),i.__iterateUncached=function(s,o){var a=this,l=0;return n.__iterate(function(c,h,f){if(t.call(e,c,h,f))return l++,s(c,r?h:l-1,a)},o),l},i.__iteratorUncached=function(s,o){var a=n.__iterator(ir,o),l=0;return new Nt(function(){for(;;){var c=a.next();if(c.done)return c;var h=c.value,f=h[0],g=h[1];if(t.call(e,g,f,n))return ee(s,r?f:l++,g,c)}})},i}function M0(n,t,e){var r=K().asMutable();return n.__iterate(function(i,s){r.update(t.call(e,i,s,n),0,function(o){return o+1})}),r.asImmutable()}function A0(n,t,e){var r=Kt(n),i=(Rr(n)?an():K()).asMutable();n.__iterate(function(o,a){i.update(t.call(e,o,a,n),function(l){return l=l||[],l.push(r?[a,o]:o),l})});var s=Ku(n);return i.map(function(o){return Yt(n,s(o))}).asImmutable()}function O0(n,t,e){var r=Kt(n),i=[[],[]];n.__iterate(function(o,a){i[t.call(e,o,a,n)?1:0].push(r?[a,o]:o)});var s=Ku(n);return i.map(function(o){return Yt(n,s(o))})}function Zu(n,t,e,r){var i=n.size;if(Ws(t,e,i))return n;if(typeof i>"u"&&(t<0||e<0))return Zu(n.toSeq().cacheResult(),t,e,r);var s=Vi(t,i),o=Us(e,i),a=o-s,l;a===a&&(l=a<0?0:a);var c=nn(n);return c.size=l===0?l:n.size&&l||void 0,!r&&Ko(n)&&l>=0&&(c.get=function(h,f){return h=Hn(this,h),h>=0&&h<l?n.get(h+s,f):f}),c.__iterateUncached=function(h,f){var g=this;if(l===0)return 0;if(f)return this.cacheResult().__iterate(h,f);var p=0,m=!0,v=0;return n.__iterate(function(_,S){if(!(m&&(m=p++<s)))return v++,h(_,r?S:v-1,g)!==!1&&v!==l}),v},c.__iteratorUncached=function(h,f){if(l!==0&&f)return this.cacheResult().__iterator(h,f);if(l===0)return new Nt(Ne);var g=n.__iterator(h,f),p=0,m=0;return new Nt(function(){for(;p++<s;)g.next();if(++m>l)return Ne();var v=g.next();return r||h===nr||v.done?v:h===Bi?ee(h,m-1,void 0,v):ee(h,m-1,v.value[1],v)})},c}function z0(n,t,e){var r=nn(n);return r.__iterateUncached=function(i,s){var o=this;if(s)return this.cacheResult().__iterate(i,s);var a=0;return n.__iterate(function(l,c,h){return t.call(e,l,c,h)&&++a&&i(l,c,o)}),a},r.__iteratorUncached=function(i,s){var o=this;if(s)return this.cacheResult().__iterator(i,s);var a=n.__iterator(ir,s),l=!0;return new Nt(function(){if(!l)return Ne();var c=a.next();if(c.done)return c;var h=c.value,f=h[0],g=h[1];return t.call(e,g,f,o)?i===ir?c:ee(i,f,g,c):(l=!1,Ne())})},r}function bf(n,t,e,r){var i=nn(n);return i.__iterateUncached=function(s,o){var a=this;if(o)return this.cacheResult().__iterate(s,o);var l=!0,c=0;return n.__iterate(function(h,f,g){if(!(l&&(l=t.call(e,h,f,g))))return c++,s(h,r?f:c-1,a)}),c},i.__iteratorUncached=function(s,o){var a=this;if(o)return this.cacheResult().__iterator(s,o);var l=n.__iterator(ir,o),c=!0,h=0;return new Nt(function(){var f,g,p;do{if(f=l.next(),f.done)return r||s===nr?f:s===Bi?ee(s,h++,void 0,f):ee(s,h++,f.value[1],f);var m=f.value;g=m[0],p=m[1],c&&(c=t.call(e,p,g,a))}while(c);return s===ir?f:ee(s,g,p,f)})},i}var T0=function(n){function t(e){this._wrappedIterables=e.flatMap(function(r){return r._wrappedIterables?r._wrappedIterables:[r]}),this.size=this._wrappedIterables.reduce(function(r,i){if(r!==void 0){var s=i.size;if(s!==void 0)return r+s}},0),this[Xo]=this._wrappedIterables[0][Xo],this[Jo]=this._wrappedIterables[0][Jo],this[Wn]=this._wrappedIterables[0][Wn]}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.__iterateUncached=function(r,i){if(this._wrappedIterables.length!==0){if(i)return this.cacheResult().__iterate(r,i);for(var s=0,o=Kt(this),a=o?ir:nr,l=this._wrappedIterables[s].__iterator(a,i),c=!0,h=0;c;){for(var f=l.next();f.done;){if(s++,s===this._wrappedIterables.length)return h;l=this._wrappedIterables[s].__iterator(a,i),f=l.next()}var g=o?r(f.value[1],f.value[0],this):r(f.value,h,this);c=g!==!1,h++}return h}},t.prototype.__iteratorUncached=function(r,i){var s=this;if(this._wrappedIterables.length===0)return new Nt(Ne);if(i)return this.cacheResult().__iterator(r,i);var o=0,a=this._wrappedIterables[o].__iterator(r,i);return new Nt(function(){for(var l=a.next();l.done;){if(o++,o===s._wrappedIterables.length)return l;a=s._wrappedIterables[o].__iterator(r,i),l=a.next()}return l})},t}(Ee);function C0(n,t){var e=Kt(n),r=[n].concat(t).map(function(s){return Ze(s)?e&&(s=_r(s)):s=e?Du(s):uf(Array.isArray(s)?s:[s]),s}).filter(function(s){return s.size!==0});if(r.length===0)return n;if(r.length===1){var i=r[0];if(i===n||e&&Kt(i)||Ke(n)&&Ke(i))return i}return new T0(r)}function wf(n,t,e){var r=nn(n);return r.__iterateUncached=function(i,s){if(s)return this.cacheResult().__iterate(i,s);var o=0,a=!1;function l(c,h){c.__iterate(function(f,g){return(!t||h<t)&&Ze(f)?l(f,h+1):(o++,i(f,e?g:o-1,r)===!1&&(a=!0)),!a},s)}return l(n,0),o},r.__iteratorUncached=function(i,s){if(s)return this.cacheResult().__iterator(i,s);var o=n.__iterator(i,s),a=[],l=0;return new Nt(function(){for(;o;){var c=o.next();if(c.done!==!1){o=a.pop();continue}var h=c.value;if(i===ir&&(h=h[1]),(!t||a.length<t)&&Ze(h))a.push(o),o=h.__iterator(i,s);else return e?c:ee(i,l++,h,c)}return Ne()})},r}function I0(n,t,e){var r=Ku(n);return n.toSeq().map(function(i,s){return r(t.call(e,i,s,n))}).flatten(!0)}function k0(n,t){var e=nn(n);return e.size=n.size&&n.size*2-1,e.__iterateUncached=function(r,i){var s=this,o=0;return n.__iterate(function(a){return(!o||r(t,o++,s)!==!1)&&r(a,o++,s)!==!1},i),o},e.__iteratorUncached=function(r,i){var s=n.__iterator(nr,i),o=0,a;return new Nt(function(){return(!a||o%2)&&(a=s.next(),a.done)?a:o%2?ee(r,o++,t):ee(r,o++,a.value,a)})},e}function Gi(n,t,e){t||(t=Mf);var r=Kt(n),i=0,s=n.toSeq().map(function(o,a){return[a,o,i++,e?e(o,a,n):o]}).valueSeq().toArray();return s.sort(function(o,a){return t(o[3],a[3])||o[2]-a[2]}).forEach(r?function(o,a){s[a].length=2}:function(o,a){s[a]=o[1]}),r?Un(s):Ke(n)?wr(s):$i(s)}function ia(n,t,e){if(t||(t=Mf),e){var r=n.toSeq().map(function(i,s){return[i,e(i,s,n)]}).reduce(function(i,s){return Sf(t,i[1],s[1])?s:i});return r&&r[0]}return n.reduce(function(i,s){return Sf(t,i,s)?s:i})}function Sf(n,t,e){var r=n(e,t);return r===0&&e!==t&&(e==null||e!==e)||r>0}function sa(n,t,e,r){var i=nn(n),s=new Hi(e).map(function(o){return o.size});return i.size=r?s.max():s.min(),i.__iterate=function(o,a){for(var l=this.__iterator(nr,a),c,h=0;!(c=l.next()).done&&o(c.value,h++,this)!==!1;);return h},i.__iteratorUncached=function(o,a){var l=e.map(function(f){return f=Te(f),Fu(a?f.reverse():f)}),c=0,h=!1;return new Nt(function(){var f;return h||(f=l.map(function(g){return g.next()}),h=r?f.every(function(g){return g.done}):f.some(function(g){return g.done})),h?Ne():ee(o,c++,t.apply(null,f.map(function(g){return g.value})))})},i}function Yt(n,t){return n===t?n:Ko(n)?t:n.constructor(t)}function Ef(n){if(n!==Object(n))throw new TypeError("Expected [K, V] tuple: "+n)}function Ku(n){return Kt(n)?_r:Ke(n)?ci:Di}function nn(n){return Object.create((Kt(n)?Un:Ke(n)?wr:$i).prototype)}function Qu(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):Ee.prototype.cacheResult.call(this)}function Mf(n,t){return n===void 0&&t===void 0?0:n===void 0?1:t===void 0?-1:n>t?1:n<t?-1:0}function sn(n,t){t=t||0;for(var e=Math.max(0,n.length-t),r=new Array(e),i=0;i<e;i++)r[i]=n[i+t];return r}function Xs(n,t){if(!n)throw new Error(t)}function sr(n){Xs(n!==1/0,"Cannot perform this action with an infinite size.")}function Af(n){if(Nu(n)&&typeof n!="string")return n;if(Rr(n))return n.toArray();throw new TypeError("Invalid keyPath: expected Ordered Collection or Array: "+n)}var P0=Object.prototype.toString;function tl(n){if(!n||typeof n!="object"||P0.call(n)!=="[object Object]")return!1;var t=Object.getPrototypeOf(n);if(t===null)return!0;for(var e=t,r=Object.getPrototypeOf(t);r!==null;)e=r,r=Object.getPrototypeOf(e);return e===t}function Yn(n){return typeof n=="object"&&(br(n)||Array.isArray(n)||tl(n))}function Js(n){try{return typeof n=="string"?JSON.stringify(n):String(n)}catch{return JSON.stringify(n)}}function Of(n,t){return br(n)?n.has(t):Yn(n)&&qi.call(n,t)}function el(n,t,e){return br(n)?n.get(t,e):Of(n,t)?typeof n.get=="function"?n.get(t):n[t]:e}function oa(n){if(Array.isArray(n))return sn(n);var t={};for(var e in n)qi.call(n,e)&&(t[e]=n[e]);return t}function zf(n,t){if(!Yn(n))throw new TypeError("Cannot update non-data-structure value: "+n);if(br(n)){if(!n.remove)throw new TypeError("Cannot update immutable value without .remove() method: "+n);return n.remove(t)}if(!qi.call(n,t))return n;var e=oa(n);return Array.isArray(e)?e.splice(t,1):delete e[t],e}function Tf(n,t,e){if(!Yn(n))throw new TypeError("Cannot update non-data-structure value: "+n);if(br(n)){if(!n.set)throw new TypeError("Cannot update immutable value without .set() method: "+n);return n.set(t,e)}if(qi.call(n,t)&&e===n[t])return n;var r=oa(n);return r[t]=e,r}function fi(n,t,e,r){r||(r=e,e=void 0);var i=Cf(br(n),n,Af(t),0,e,r);return i===Ft?e:i}function Cf(n,t,e,r,i,s){var o=t===Ft;if(r===e.length){var a=o?i:t,l=s(a);return l===a?t:l}if(!o&&!Yn(t))throw new TypeError("Cannot update within non-data-structure value in path ["+Array.from(e).slice(0,r).map(Js)+"]: "+t);var c=e[r],h=o?Ft:el(t,c,Ft),f=Cf(h===Ft?n:br(h),h,e,r+1,i,s);return f===h?t:f===Ft?zf(t,c):Tf(o?n?on():{}:t,c,f)}function If(n,t,e){return fi(n,t,Ft,function(){return e})}function rl(n,t){return If(this,n,t)}function kf(n,t){return fi(n,t,function(){return Ft})}function nl(n){return kf(this,n)}function il(n,t,e,r){return fi(n,[t],e,r)}function sl(n,t,e){return arguments.length===1?n(this):il(this,n,t,e)}function ol(n,t,e){return fi(this,n,t,e)}function Pf(){for(var n=[],t=arguments.length;t--;)n[t]=arguments[t];return Lf(this,n)}function Rf(n){for(var t=[],e=arguments.length-1;e-- >0;)t[e]=arguments[e+1];if(typeof n!="function")throw new TypeError("Invalid merger function: "+n);return Lf(this,t,n)}function Lf(n,t,e){for(var r=[],i=0;i<t.length;i++){var s=_r(t[i]);s.size!==0&&r.push(s)}return r.length===0?n:n.toSeq().size===0&&!n.__ownerID&&r.length===1?Gn(n)?n:n.constructor(r[0]):n.withMutations(function(o){for(var a=e?function(c,h){il(o,h,Ft,function(f){return f===Ft?c:e(f,c,h)})}:function(c,h){o.set(h,c)},l=0;l<r.length;l++)r[l].forEach(a)})}function R0(n){for(var t=[],e=arguments.length-1;e-- >0;)t[e]=arguments[e+1];return Ks(n,t)}function L0(n,t){for(var e=[],r=arguments.length-2;r-- >0;)e[r]=arguments[r+2];return Ks(t,e,n)}function F0(n){for(var t=[],e=arguments.length-1;e-- >0;)t[e]=arguments[e+1];return Zs(n,t)}function N0(n,t){for(var e=[],r=arguments.length-2;r-- >0;)e[r]=arguments[r+2];return Zs(t,e,n)}function Zs(n,t,e){return Ks(n,t,j0(e))}function Ks(n,t,e){if(!Yn(n))throw new TypeError("Cannot merge into non-data-structure value: "+n);if(br(n))return typeof e=="function"&&n.mergeWith?n.mergeWith.apply(n,[e].concat(t)):n.merge?n.merge.apply(n,t):n.concat.apply(n,t);for(var r=Array.isArray(n),i=n,s=r?ci:_r,o=r?function(l){i===n&&(i=oa(i)),i.push(l)}:function(l,c){var h=qi.call(i,c),f=h&&e?e(i[c],l,c):l;(!h||f!==i[c])&&(i===n&&(i=oa(i)),i[c]=f)},a=0;a<t.length;a++)s(t[a]).forEach(o);return i}function j0(n){function t(e,r,i){return Yn(e)&&Yn(r)&&V0(e,r)?Ks(e,[r],t):n?n(e,r,i):r}return t}function V0(n,t){var e=Ee(n),r=Ee(t);return Ke(e)===Ke(r)&&Kt(e)===Kt(r)}function Ff(){for(var n=[],t=arguments.length;t--;)n[t]=arguments[t];return Zs(this,n)}function Nf(n){for(var t=[],e=arguments.length-1;e-- >0;)t[e]=arguments[e+1];return Zs(this,t,n)}function al(n){for(var t=[],e=arguments.length-1;e-- >0;)t[e]=arguments[e+1];return fi(this,n,on(),function(r){return Ks(r,t)})}function ul(n){for(var t=[],e=arguments.length-1;e-- >0;)t[e]=arguments[e+1];return fi(this,n,on(),function(r){return Zs(r,t)})}function Qs(n){var t=this.asMutable();return n(t),t.wasAltered()?t.__ensureOwner(this.__ownerID):this}function to(){return this.__ownerID?this:this.__ensureOwner(new Pu)}function eo(){return this.__ensureOwner()}function ll(){return this.__altered}var K=function(n){function t(e){return e==null?on():ea(e)&&!Rr(e)?e:on().withMutations(function(r){var i=n(e);sr(i.size),i.forEach(function(s,o){return r.set(o,s)})})}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return this.__toString("Map {","}")},t.prototype.get=function(r,i){return this._root?this._root.get(0,void 0,r,i):i},t.prototype.set=function(r,i){return Df(this,r,i)},t.prototype.remove=function(r){return Df(this,r,Ft)},t.prototype.deleteAll=function(r){var i=Te(r);return i.size===0?this:this.withMutations(function(s){i.forEach(function(o){return s.remove(o)})})},t.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):on()},t.prototype.sort=function(r){return an(Gi(this,r))},t.prototype.sortBy=function(r,i){return an(Gi(this,i,r))},t.prototype.map=function(r,i){var s=this;return this.withMutations(function(o){o.forEach(function(a,l){o.set(l,r.call(i,a,l,s))})})},t.prototype.__iterator=function(r,i){return new D0(this,r,i)},t.prototype.__iterate=function(r,i){var s=this,o=0;return this._root&&this._root.iterate(function(a){return o++,r(a[1],a[0],s)},i),o},t.prototype.__ensureOwner=function(r){return r===this.__ownerID?this:r?hl(this.size,this._root,r,this.__hash):this.size===0?on():(this.__ownerID=r,this.__altered=!1,this)},t}(_r);K.isMap=ea;var re=K.prototype;re[lf]=!0,re[Gs]=re.remove,re.removeAll=re.deleteAll,re.setIn=rl,re.removeIn=re.deleteIn=nl,re.update=sl,re.updateIn=ol,re.merge=re.concat=Pf,re.mergeWith=Rf,re.mergeDeep=Ff,re.mergeDeepWith=Nf,re.mergeIn=al,re.mergeDeepIn=ul,re.withMutations=Qs,re.wasAltered=ll,re.asImmutable=eo,re["@@transducer/init"]=re.asMutable=to,re["@@transducer/step"]=function(n,t){return n.set(t[0],t[1])},re["@@transducer/result"]=function(n){return n.asImmutable()};var ro=function(t,e){this.ownerID=t,this.entries=e};ro.prototype.get=function(t,e,r,i){for(var s=this.entries,o=0,a=s.length;o<a;o++)if(Ce(r,s[o][0]))return s[o][1];return i},ro.prototype.update=function(t,e,r,i,s,o,a){for(var l=s===Ft,c=this.entries,h=0,f=c.length;h<f&&!Ce(i,c[h][0]);h++);var g=h<f;if(g?c[h][1]===s:l)return this;if(xr(a),(l||!g)&&xr(o),!(l&&c.length===1)){if(!g&&!l&&c.length>=W0)return B0(t,c,i,s);var p=t&&t===this.ownerID,m=p?c:sn(c);return g?l?h===f-1?m.pop():m[h]=m.pop():m[h]=[i,s]:m.push([i,s]),p?(this.entries=m,this):new ro(t,m)}};var Wi=function(t,e,r){this.ownerID=t,this.bitmap=e,this.nodes=r};Wi.prototype.get=function(t,e,r,i){e===void 0&&(e=Qe(r));var s=1<<((t===0?e:e>>>t)&He),o=this.bitmap;return(o&s)===0?i:this.nodes[qf(o&s-1)].get(t+Ut,e,r,i)},Wi.prototype.update=function(t,e,r,i,s,o,a){r===void 0&&(r=Qe(i));var l=(e===0?r:r>>>e)&He,c=1<<l,h=this.bitmap,f=(h&c)!==0;if(!f&&s===Ft)return this;var g=qf(h&c-1),p=this.nodes,m=f?p[g]:void 0,v=fl(m,t,e+Ut,r,i,s,o,a);if(v===m)return this;if(!f&&v&&p.length>=U0)return $0(t,p,h,l,v);if(f&&!v&&p.length===2&&Bf(p[g^1]))return p[g^1];if(f&&v&&p.length===1&&Bf(v))return v;var _=t&&t===this.ownerID,S=f?v?h:h^c:h|c,M=f?v?$f(p,g,v,_):G0(p,g,_):H0(p,g,v,_);return _?(this.bitmap=S,this.nodes=M,this):new Wi(t,S,M)};var no=function(t,e,r){this.ownerID=t,this.count=e,this.nodes=r};no.prototype.get=function(t,e,r,i){e===void 0&&(e=Qe(r));var s=(t===0?e:e>>>t)&He,o=this.nodes[s];return o?o.get(t+Ut,e,r,i):i},no.prototype.update=function(t,e,r,i,s,o,a){r===void 0&&(r=Qe(i));var l=(e===0?r:r>>>e)&He,c=s===Ft,h=this.nodes,f=h[l];if(c&&!f)return this;var g=fl(f,t,e+Ut,r,i,s,o,a);if(g===f)return this;var p=this.count;if(!f)p++;else if(!g&&(p--,p<Y0))return q0(t,h,p,l);var m=t&&t===this.ownerID,v=$f(h,l,g,m);return m?(this.count=p,this.nodes=v,this):new no(t,p,v)};var Ui=function(t,e,r){this.ownerID=t,this.keyHash=e,this.entries=r};Ui.prototype.get=function(t,e,r,i){for(var s=this.entries,o=0,a=s.length;o<a;o++)if(Ce(r,s[o][0]))return s[o][1];return i},Ui.prototype.update=function(t,e,r,i,s,o,a){r===void 0&&(r=Qe(i));var l=s===Ft;if(r!==this.keyHash)return l?this:(xr(a),xr(o),dl(this,t,e,r,[i,s]));for(var c=this.entries,h=0,f=c.length;h<f&&!Ce(i,c[h][0]);h++);var g=h<f;if(g?c[h][1]===s:l)return this;if(xr(a),(l||!g)&&xr(o),l&&f===2)return new Mn(t,this.keyHash,c[h^1]);var p=t&&t===this.ownerID,m=p?c:sn(c);return g?l?h===f-1?m.pop():m[h]=m.pop():m[h]=[i,s]:m.push([i,s]),p?(this.entries=m,this):new Ui(t,this.keyHash,m)};var Mn=function(t,e,r){this.ownerID=t,this.keyHash=e,this.entry=r};Mn.prototype.get=function(t,e,r,i){return Ce(r,this.entry[0])?this.entry[1]:i},Mn.prototype.update=function(t,e,r,i,s,o,a){var l=s===Ft,c=Ce(i,this.entry[0]);if(c?s===this.entry[1]:l)return this;if(xr(a),l){xr(o);return}return c?t&&t===this.ownerID?(this.entry[1]=s,this):new Mn(t,this.keyHash,[i,s]):(xr(o),dl(this,t,e,Qe(i),[i,s]))},ro.prototype.iterate=Ui.prototype.iterate=function(n,t){for(var e=this.entries,r=0,i=e.length-1;r<=i;r++)if(n(e[t?i-r:r])===!1)return!1},Wi.prototype.iterate=no.prototype.iterate=function(n,t){for(var e=this.nodes,r=0,i=e.length-1;r<=i;r++){var s=e[t?i-r:r];if(s&&s.iterate(n,t)===!1)return!1}},Mn.prototype.iterate=function(n,t){return n(this.entry)};var D0=function(n){function t(e,r,i){this._type=r,this._reverse=i,this._stack=e._root&&jf(e._root)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.next=function(){for(var r=this._type,i=this._stack;i;){var s=i.node,o=i.index++,a=void 0;if(s.entry){if(o===0)return cl(r,s.entry)}else if(s.entries){if(a=s.entries.length-1,o<=a)return cl(r,s.entries[this._reverse?a-o:o])}else if(a=s.nodes.length-1,o<=a){var l=s.nodes[this._reverse?a-o:o];if(l){if(l.entry)return cl(r,l.entry);i=this._stack=jf(l,i)}continue}i=this._stack=this._stack.__prev}return Ne()},t}(Nt);function cl(n,t){return ee(n,t[0],t[1])}function jf(n,t){return{node:n,index:0,__prev:t}}function hl(n,t,e,r){var i=Object.create(re);return i.size=n,i._root=t,i.__ownerID=e,i.__hash=r,i.__altered=!1,i}var Vf;function on(){return Vf||(Vf=hl(0))}function Df(n,t,e){var r,i;if(n._root){var s=ku(),o=ku();if(r=fl(n._root,n.__ownerID,0,void 0,t,e,s,o),!o.value)return n;i=n.size+(s.value?e===Ft?-1:1:0)}else{if(e===Ft)return n;i=1,r=new ro(n.__ownerID,[[t,e]])}return n.__ownerID?(n.size=i,n._root=r,n.__hash=void 0,n.__altered=!0,n):r?hl(i,r):on()}function fl(n,t,e,r,i,s,o,a){return n?n.update(t,e,r,i,s,o,a):s===Ft?n:(xr(a),xr(o),new Mn(t,r,[i,s]))}function Bf(n){return n.constructor===Mn||n.constructor===Ui}function dl(n,t,e,r,i){if(n.keyHash===r)return new Ui(t,r,[n.entry,i]);var s=(e===0?n.keyHash:n.keyHash>>>e)&He,o=(e===0?r:r>>>e)&He,a,l=s===o?[dl(n,t,e+Ut,r,i)]:(a=new Mn(t,r,i),s<o?[n,a]:[a,n]);return new Wi(t,1<<s|1<<o,l)}function B0(n,t,e,r){n||(n=new Pu);for(var i=new Mn(n,Qe(e),[e,r]),s=0;s<t.length;s++){var o=t[s];i=i.update(n,0,void 0,o[0],o[1])}return i}function q0(n,t,e,r){for(var i=0,s=0,o=new Array(e),a=0,l=1,c=t.length;a<c;a++,l<<=1){var h=t[a];h!==void 0&&a!==r&&(i|=l,o[s++]=h)}return new Wi(n,i,o)}function $0(n,t,e,r,i){for(var s=0,o=new Array(rr),a=0;e!==0;a++,e>>>=1)o[a]=e&1?t[s++]:void 0;return o[r]=i,new no(n,s+1,o)}function qf(n){return n-=n>>1&1431655765,n=(n&858993459)+(n>>2&858993459),n=n+(n>>4)&252645135,n+=n>>8,n+=n>>16,n&127}function $f(n,t,e,r){var i=r?n:sn(n);return i[t]=e,i}function H0(n,t,e,r){var i=n.length+1;if(r&&t+1===i)return n[t]=e,n;for(var s=new Array(i),o=0,a=0;a<i;a++)a===t?(s[a]=e,o=-1):s[a]=n[a+o];return s}function G0(n,t,e){var r=n.length-1;if(e&&t===r)return n.pop(),n;for(var i=new Array(r),s=0,o=0;o<r;o++)o===t&&(s=1),i[o]=n[o+s];return i}var W0=rr/4,U0=rr/2,Y0=rr/4,Hf="@@__IMMUTABLE_LIST__@@";function pl(n){return!!(n&&n[Hf])}var ut=function(n){function t(e){var r=aa();if(e==null)return r;if(pl(e))return e;var i=n(e),s=i.size;return s===0?r:(sr(s),s>0&&s<rr?so(0,s,Ut,null,new Xn(i.toArray())):r.withMutations(function(o){o.setSize(s),i.forEach(function(a,l){return o.set(l,a)})}))}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.prototype.toString=function(){return this.__toString("List [","]")},t.prototype.get=function(r,i){if(r=Hn(this,r),r>=0&&r<this.size){r+=this._origin;var s=Wf(this,r);return s&&s.array[r&He]}return i},t.prototype.set=function(r,i){return X0(this,r,i)},t.prototype.remove=function(r){return this.has(r)?r===0?this.shift():r===this.size-1?this.pop():this.splice(r,1):this},t.prototype.insert=function(r,i){return this.splice(r,0,i)},t.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=Ut,this._root=this._tail=this.__hash=void 0,this.__altered=!0,this):aa()},t.prototype.push=function(){var r=arguments,i=this.size;return this.withMutations(function(s){Jn(s,0,i+r.length);for(var o=0;o<r.length;o++)s.set(i+o,r[o])})},t.prototype.pop=function(){return Jn(this,0,-1)},t.prototype.unshift=function(){var r=arguments;return this.withMutations(function(i){Jn(i,-r.length);for(var s=0;s<r.length;s++)i.set(s,r[s])})},t.prototype.shift=function(){return Jn(this,1)},t.prototype.shuffle=function(r){return r===void 0&&(r=Math.random),this.withMutations(function(i){for(var s=i.size,o,a;s;)o=Math.floor(r()*s--),a=i.get(o),i.set(o,i.get(s)),i.set(s,a)})},t.prototype.concat=function(){for(var r=arguments,i=[],s=0;s<arguments.length;s++){var o=r[s],a=n(typeof o!="string"&&Lu(o)?o:[o]);a.size!==0&&i.push(a)}return i.length===0?this:this.size===0&&!this.__ownerID&&i.length===1?this.constructor(i[0]):this.withMutations(function(l){i.forEach(function(c){return c.forEach(function(h){return l.push(h)})})})},t.prototype.setSize=function(r){return Jn(this,0,r)},t.prototype.map=function(r,i){var s=this;return this.withMutations(function(o){for(var a=0;a<s.size;a++)o.set(a,r.call(i,o.get(a),a,s))})},t.prototype.slice=function(r,i){var s=this.size;return Ws(r,i,s)?this:Jn(this,Vi(r,s),Us(i,s))},t.prototype.__iterator=function(r,i){var s=i?this.size:0,o=Gf(this,i);return new Nt(function(){var a=o();return a===io?Ne():ee(r,i?--s:s++,a)})},t.prototype.__iterate=function(r,i){for(var s=i?this.size:0,o=Gf(this,i),a;(a=o())!==io&&r(a,i?--s:s++,this)!==!1;);return s},t.prototype.__ensureOwner=function(r){return r===this.__ownerID?this:r?so(this._origin,this._capacity,this._level,this._root,this._tail,r,this.__hash):this.size===0?aa():(this.__ownerID=r,this.__altered=!1,this)},t}(ci);ut.isList=pl;var ve=ut.prototype;ve[Hf]=!0,ve[Gs]=ve.remove,ve.merge=ve.concat,ve.setIn=rl,ve.deleteIn=ve.removeIn=nl,ve.update=sl,ve.updateIn=ol,ve.mergeIn=al,ve.mergeDeepIn=ul,ve.withMutations=Qs,ve.wasAltered=ll,ve.asImmutable=eo,ve["@@transducer/init"]=ve.asMutable=to,ve["@@transducer/step"]=function(n,t){return n.push(t)},ve["@@transducer/result"]=function(n){return n.asImmutable()};var Xn=function(t,e){this.array=t,this.ownerID=e};Xn.prototype.removeBefore=function(t,e,r){if((r&(1<<e+Ut)-1)===0||this.array.length===0)return this;var i=r>>>e&He;if(i>=this.array.length)return new Xn([],t);var s=i===0,o;if(e>0){var a=this.array[i];if(o=a&&a.removeBefore(t,e-Ut,r),o===a&&s)return this}if(s&&!o)return this;var l=Yi(this,t);if(!s)for(var c=0;c<i;c++)l.array[c]=void 0;return o&&(l.array[i]=o),l},Xn.prototype.removeAfter=function(t,e,r){if(r===(e?1<<e+Ut:rr)||this.array.length===0)return this;var i=r-1>>>e&He;if(i>=this.array.length)return this;var s;if(e>0){var o=this.array[i];if(s=o&&o.removeAfter(t,e-Ut,r),s===o&&i===this.array.length-1)return this}var a=Yi(this,t);return a.array.splice(i+1),s&&(a.array[i]=s),a};var io={};function Gf(n,t){var e=n._origin,r=n._capacity,i=oo(r),s=n._tail;return o(n._root,n._level,0);function o(c,h,f){return h===0?a(c,f):l(c,h,f)}function a(c,h){var f=h===i?s&&s.array:c&&c.array,g=h>e?0:e-h,p=r-h;return p>rr&&(p=rr),function(){if(g===p)return io;var m=t?--p:g++;return f&&f[m]}}function l(c,h,f){var g,p=c&&c.array,m=f>e?0:e-f>>h,v=(r-f>>h)+1;return v>rr&&(v=rr),function(){for(;;){if(g){var _=g();if(_!==io)return _;g=null}if(m===v)return io;var S=t?--v:m++;g=o(p&&p[S],h-Ut,f+(S<<h))}}}}function so(n,t,e,r,i,s,o){var a=Object.create(ve);return a.size=t-n,a._origin=n,a._capacity=t,a._level=e,a._root=r,a._tail=i,a.__ownerID=s,a.__hash=o,a.__altered=!1,a}function aa(){return so(0,0,Ut)}function X0(n,t,e){if(t=Hn(n,t),t!==t)return n;if(t>=n.size||t<0)return n.withMutations(function(o){t<0?Jn(o,t).set(0,e):Jn(o,0,t+1).set(t,e)});t+=n._origin;var r=n._tail,i=n._root,s=ku();return t>=oo(n._capacity)?r=gl(r,n.__ownerID,0,t,e,s):i=gl(i,n.__ownerID,n._level,t,e,s),s.value?n.__ownerID?(n._root=i,n._tail=r,n.__hash=void 0,n.__altered=!0,n):so(n._origin,n._capacity,n._level,i,r):n}function gl(n,t,e,r,i,s){var o=r>>>e&He,a=n&&o<n.array.length;if(!a&&i===void 0)return n;var l;if(e>0){var c=n&&n.array[o],h=gl(c,t,e-Ut,r,i,s);return h===c?n:(l=Yi(n,t),l.array[o]=h,l)}return a&&n.array[o]===i?n:(s&&xr(s),l=Yi(n,t),i===void 0&&o===l.array.length-1?l.array.pop():l.array[o]=i,l)}function Yi(n,t){return t&&n&&t===n.ownerID?n:new Xn(n?n.array.slice():[],t)}function Wf(n,t){if(t>=oo(n._capacity))return n._tail;if(t<1<<n._level+Ut){for(var e=n._root,r=n._level;e&&r>0;)e=e.array[t>>>r&He],r-=Ut;return e}}function Jn(n,t,e){t!==void 0&&(t|=0),e!==void 0&&(e|=0);var r=n.__ownerID||new Pu,i=n._origin,s=n._capacity,o=i+t,a=e===void 0?s:e<0?s+e:i+e;if(o===i&&a===s)return n;if(o>=a)return n.clear();for(var l=n._level,c=n._root,h=0;o+h<0;)c=new Xn(c&&c.array.length?[void 0,c]:[],r),l+=Ut,h+=1<<l;h&&(o+=h,i+=h,a+=h,s+=h);for(var f=oo(s),g=oo(a);g>=1<<l+Ut;)c=new Xn(c&&c.array.length?[c]:[],r),l+=Ut;var p=n._tail,m=g<f?Wf(n,a-1):g>f?new Xn([],r):p;if(p&&g>f&&o<s&&p.array.length){c=Yi(c,r);for(var v=c,_=l;_>Ut;_-=Ut){var S=f>>>_&He;v=v.array[S]=Yi(v.array[S],r)}v.array[f>>>Ut&He]=p}if(a<s&&(m=m&&m.removeAfter(r,0,a)),o>=g)o-=g,a-=g,l=Ut,c=null,m=m&&m.removeBefore(r,0,o);else if(o>i||g<f){for(h=0;c;){var M=o>>>l&He;if(M!==g>>>l&He)break;M&&(h+=(1<<l)*M),l-=Ut,c=c.array[M]}c&&o>i&&(c=c.removeBefore(r,l,o-h)),c&&g<f&&(c=c.removeAfter(r,l,g-h)),h&&(o-=h,a-=h)}return n.__ownerID?(n.size=a-o,n._origin=o,n._capacity=a,n._level=l,n._root=c,n._tail=m,n.__hash=void 0,n.__altered=!0,n):so(o,a,l,c,m)}function oo(n){return n<rr?0:n-1>>>Ut<<Ut}var an=function(n){function t(e){return e==null?ao():qu(e)?e:ao().withMutations(function(r){var i=_r(e);sr(i.size),i.forEach(function(s,o){return r.set(o,s)})})}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.prototype.toString=function(){return this.__toString("OrderedMap {","}")},t.prototype.get=function(r,i){var s=this._map.get(r);return s!==void 0?this._list.get(s)[1]:i},t.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this.__altered=!0,this):ao()},t.prototype.set=function(r,i){return Yf(this,r,i)},t.prototype.remove=function(r){return Yf(this,r,Ft)},t.prototype.__iterate=function(r,i){var s=this;return this._list.__iterate(function(o){return o&&r(o[1],o[0],s)},i)},t.prototype.__iterator=function(r,i){return this._list.fromEntrySeq().__iterator(r,i)},t.prototype.__ensureOwner=function(r){if(r===this.__ownerID)return this;var i=this._map.__ensureOwner(r),s=this._list.__ensureOwner(r);return r?ml(i,s,r,this.__hash):this.size===0?ao():(this.__ownerID=r,this.__altered=!1,this._map=i,this._list=s,this)},t}(K);an.isOrderedMap=qu,an.prototype[Wn]=!0,an.prototype[Gs]=an.prototype.remove;function ml(n,t,e,r){var i=Object.create(an.prototype);return i.size=n?n.size:0,i._map=n,i._list=t,i.__ownerID=e,i.__hash=r,i.__altered=!1,i}var Uf;function ao(){return Uf||(Uf=ml(on(),aa()))}function Yf(n,t,e){var r=n._map,i=n._list,s=r.get(t),o=s!==void 0,a,l;if(e===Ft){if(!o)return n;i.size>=rr&&i.size>=r.size*2?(l=i.filter(function(c,h){return c!==void 0&&s!==h}),a=l.toKeyedSeq().map(function(c){return c[0]}).flip().toMap(),n.__ownerID&&(a.__ownerID=l.__ownerID=n.__ownerID)):(a=r.remove(t),l=s===i.size-1?i.pop():i.set(s,void 0))}else if(o){if(e===i.get(s)[1])return n;a=r,l=i.set(s,[t,e])}else a=r.set(t,i.size),l=i.set(i.size,[t,e]);return n.__ownerID?(n.size=a.size,n._map=a,n._list=l,n.__hash=void 0,n.__altered=!0,n):ml(a,l)}var Xf="@@__IMMUTABLE_STACK__@@";function ua(n){return!!(n&&n[Xf])}var la=function(n){function t(e){return e==null?ca():ua(e)?e:ca().pushAll(e)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.prototype.toString=function(){return this.__toString("Stack [","]")},t.prototype.get=function(r,i){var s=this._head;for(r=Hn(this,r);s&&r--;)s=s.next;return s?s.value:i},t.prototype.peek=function(){return this._head&&this._head.value},t.prototype.push=function(){var r=arguments;if(arguments.length===0)return this;for(var i=this.size+arguments.length,s=this._head,o=arguments.length-1;o>=0;o--)s={value:r[o],next:s};return this.__ownerID?(this.size=i,this._head=s,this.__hash=void 0,this.__altered=!0,this):uo(i,s)},t.prototype.pushAll=function(r){if(r=n(r),r.size===0)return this;if(this.size===0&&ua(r))return r;sr(r.size);var i=this.size,s=this._head;return r.__iterate(function(o){i++,s={value:o,next:s}},!0),this.__ownerID?(this.size=i,this._head=s,this.__hash=void 0,this.__altered=!0,this):uo(i,s)},t.prototype.pop=function(){return this.slice(1)},t.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):ca()},t.prototype.slice=function(r,i){if(Ws(r,i,this.size))return this;var s=Vi(r,this.size),o=Us(i,this.size);if(o!==this.size)return n.prototype.slice.call(this,r,i);for(var a=this.size-s,l=this._head;s--;)l=l.next;return this.__ownerID?(this.size=a,this._head=l,this.__hash=void 0,this.__altered=!0,this):uo(a,l)},t.prototype.__ensureOwner=function(r){return r===this.__ownerID?this:r?uo(this.size,this._head,r,this.__hash):this.size===0?ca():(this.__ownerID=r,this.__altered=!1,this)},t.prototype.__iterate=function(r,i){var s=this;if(i)return new Hi(this.toArray()).__iterate(function(l,c){return r(l,c,s)},i);for(var o=0,a=this._head;a&&r(a.value,o++,this)!==!1;)a=a.next;return o},t.prototype.__iterator=function(r,i){if(i)return new Hi(this.toArray()).__iterator(r,i);var s=0,o=this._head;return new Nt(function(){if(o){var a=o.value;return o=o.next,ee(r,s++,a)}return Ne()})},t}(ci);la.isStack=ua;var Ge=la.prototype;Ge[Xf]=!0,Ge.shift=Ge.pop,Ge.unshift=Ge.push,Ge.unshiftAll=Ge.pushAll,Ge.withMutations=Qs,Ge.wasAltered=ll,Ge.asImmutable=eo,Ge["@@transducer/init"]=Ge.asMutable=to,Ge["@@transducer/step"]=function(n,t){return n.unshift(t)},Ge["@@transducer/result"]=function(n){return n.asImmutable()};function uo(n,t,e,r){var i=Object.create(Ge);return i.size=n,i._head=t,i.__ownerID=e,i.__hash=r,i.__altered=!1,i}var Jf;function ca(){return Jf||(Jf=uo(0))}var Zf="@@__IMMUTABLE_SET__@@";function ha(n){return!!(n&&n[Zf])}function yl(n){return ha(n)&&Rr(n)}function vl(n,t){if(n===t)return!0;if(!Ze(t)||n.size!==void 0&&t.size!==void 0&&n.size!==t.size||n.__hash!==void 0&&t.__hash!==void 0&&n.__hash!==t.__hash||Kt(n)!==Kt(t)||Ke(n)!==Ke(t)||Rr(n)!==Rr(t))return!1;if(n.size===0&&t.size===0)return!0;var e=!Zo(n);if(Rr(n)){var r=n.entries();return t.every(function(l,c){var h=r.next().value;return h&&Ce(h[1],l)&&(e||Ce(h[0],c))})&&r.next().done}var i=!1;if(n.size===void 0)if(t.size===void 0)typeof n.cacheResult=="function"&&n.cacheResult();else{i=!0;var s=n;n=t,t=s}var o=!0,a=t.__iterate(function(l,c){if(e?!n.has(l):i?!Ce(l,n.get(c,Ft)):!Ce(n.get(c,Ft),l))return o=!1,!1});return o&&n.size===a}function di(n,t){var e=function(r){n.prototype[r]=t[r]};return Object.keys(t).forEach(e),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach(e),n}function fa(n){if(!n||typeof n!="object")return n;if(!Ze(n)){if(!Yn(n))return n;n=Ee(n)}if(Kt(n)){var t={};return n.__iterate(function(r,i){t[i]=fa(r)}),t}var e=[];return n.__iterate(function(r){e.push(fa(r))}),e}var lo=function(n){function t(e){return e==null?co():ha(e)&&!Rr(e)?e:co().withMutations(function(r){var i=n(e);sr(i.size),i.forEach(function(s){return r.add(s)})})}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.fromKeys=function(r){return this(_r(r).keySeq())},t.intersect=function(r){return r=Te(r).toArray(),r.length?Re.intersect.apply(t(r.pop()),r):co()},t.union=function(r){return r=Te(r).toArray(),r.length?Re.union.apply(t(r.pop()),r):co()},t.prototype.toString=function(){return this.__toString("Set {","}")},t.prototype.has=function(r){return this._map.has(r)},t.prototype.add=function(r){return da(this,this._map.set(r,r))},t.prototype.remove=function(r){return da(this,this._map.remove(r))},t.prototype.clear=function(){return da(this,this._map.clear())},t.prototype.map=function(r,i){var s=this,o=!1,a=da(this,this._map.mapEntries(function(l){var c=l[1],h=r.call(i,c,c,s);return h!==c&&(o=!0),[h,h]},i));return o?a:this},t.prototype.union=function(){for(var r=[],i=arguments.length;i--;)r[i]=arguments[i];return r=r.filter(function(s){return s.size!==0}),r.length===0?this:this.size===0&&!this.__ownerID&&r.length===1?this.constructor(r[0]):this.withMutations(function(s){for(var o=0;o<r.length;o++)typeof r[o]=="string"?s.add(r[o]):n(r[o]).forEach(function(a){return s.add(a)})})},t.prototype.intersect=function(){for(var r=[],i=arguments.length;i--;)r[i]=arguments[i];if(r.length===0)return this;r=r.map(function(o){return n(o)});var s=[];return this.forEach(function(o){r.every(function(a){return a.includes(o)})||s.push(o)}),this.withMutations(function(o){s.forEach(function(a){o.remove(a)})})},t.prototype.subtract=function(){for(var r=[],i=arguments.length;i--;)r[i]=arguments[i];if(r.length===0)return this;r=r.map(function(o){return n(o)});var s=[];return this.forEach(function(o){r.some(function(a){return a.includes(o)})&&s.push(o)}),this.withMutations(function(o){s.forEach(function(a){o.remove(a)})})},t.prototype.sort=function(r){return Zi(Gi(this,r))},t.prototype.sortBy=function(r,i){return Zi(Gi(this,i,r))},t.prototype.wasAltered=function(){return this._map.wasAltered()},t.prototype.__iterate=function(r,i){var s=this;return this._map.__iterate(function(o){return r(o,o,s)},i)},t.prototype.__iterator=function(r,i){return this._map.__iterator(r,i)},t.prototype.__ensureOwner=function(r){if(r===this.__ownerID)return this;var i=this._map.__ensureOwner(r);return r?this.__make(i,r):this.size===0?this.__empty():(this.__ownerID=r,this._map=i,this)},t}(Di);lo.isSet=ha;var Re=lo.prototype;Re[Zf]=!0,Re[Gs]=Re.remove,Re.merge=Re.concat=Re.union,Re.withMutations=Qs,Re.asImmutable=eo,Re["@@transducer/init"]=Re.asMutable=to,Re["@@transducer/step"]=function(n,t){return n.add(t)},Re["@@transducer/result"]=function(n){return n.asImmutable()},Re.__empty=co,Re.__make=Kf;function da(n,t){return n.__ownerID?(n.size=t.size,n._map=t,n):t===n._map?n:t.size===0?n.__empty():n.__make(t)}function Kf(n,t){var e=Object.create(Re);return e.size=n?n.size:0,e._map=n,e.__ownerID=t,e}var Qf;function co(){return Qf||(Qf=Kf(on()))}var td=function(n){function t(e,r,i){if(i===void 0&&(i=1),!(this instanceof t))return new t(e,r,i);if(Xs(i!==0,"Cannot step a Range by 0"),Xs(e!==void 0,"You must define a start value when using Range"),Xs(r!==void 0,"You must define an end value when using Range"),i=Math.abs(i),r<e&&(i=-i),this._start=e,this._end=r,this._step=i,this.size=Math.max(0,Math.ceil((r-e)/i-1)+1),this.size===0){if(xl)return xl;xl=this}}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return this.size===0?"Range []":"Range [ "+this._start+"..."+this._end+(this._step!==1?" by "+this._step:"")+" ]"},t.prototype.get=function(r,i){return this.has(r)?this._start+Hn(this,r)*this._step:i},t.prototype.includes=function(r){var i=(r-this._start)/this._step;return i>=0&&i<this.size&&i===Math.floor(i)},t.prototype.slice=function(r,i){return Ws(r,i,this.size)?this:(r=Vi(r,this.size),i=Us(i,this.size),i<=r?new t(0,0):new t(this.get(r,this._end),this.get(i,this._end),this._step))},t.prototype.indexOf=function(r){var i=r-this._start;if(i%this._step===0){var s=i/this._step;if(s>=0&&s<this.size)return s}return-1},t.prototype.lastIndexOf=function(r){return this.indexOf(r)},t.prototype.__iterate=function(r,i){for(var s=this.size,o=this._step,a=i?this._start+(s-1)*o:this._start,l=0;l!==s&&r(a,i?s-++l:l++,this)!==!1;)a+=i?-o:o;return l},t.prototype.__iterator=function(r,i){var s=this.size,o=this._step,a=i?this._start+(s-1)*o:this._start,l=0;return new Nt(function(){if(l===s)return Ne();var c=a;return a+=i?-o:o,ee(r,i?s-++l:l++,c)})},t.prototype.equals=function(r){return r instanceof t?this._start===r._start&&this._end===r._end&&this._step===r._step:vl(this,r)},t}(wr),xl;function _l(n,t,e){for(var r=Af(t),i=0;i!==r.length;)if(n=el(n,r[i++],Ft),n===Ft)return e;return n}function ed(n,t){return _l(this,n,t)}function rd(n,t){return _l(n,t,Ft)!==Ft}function J0(n){return rd(this,n)}function nd(){sr(this.size);var n={};return this.__iterate(function(t,e){n[e]=t}),n}Te.Iterator=Nt,di(Te,{toArray:function(){sr(this.size);var t=new Array(this.size||0),e=Kt(this),r=0;return this.__iterate(function(i,s){t[r++]=e?[s,i]:i}),t},toIndexedSeq:function(){return new gf(this)},toJS:function(){return fa(this)},toKeyedSeq:function(){return new na(this,!0)},toMap:function(){return K(this.toKeyedSeq())},toObject:nd,toOrderedMap:function(){return an(this.toKeyedSeq())},toOrderedSet:function(){return Zi(Kt(this)?this.valueSeq():this)},toSet:function(){return lo(Kt(this)?this.valueSeq():this)},toSetSeq:function(){return new mf(this)},toSeq:function(){return Ke(this)?this.toIndexedSeq():Kt(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return la(Kt(this)?this.valueSeq():this)},toList:function(){return ut(Kt(this)?this.valueSeq():this)},toString:function(){return"[Collection]"},__toString:function(t,e){return this.size===0?t+e:t+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+e},concat:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return Yt(this,C0(this,t))},includes:function(t){return this.some(function(e){return Ce(e,t)})},entries:function(){return this.__iterator(ir)},every:function(t,e){sr(this.size);var r=!0;return this.__iterate(function(i,s,o){if(!t.call(e,i,s,o))return r=!1,!1}),r},filter:function(t,e){return Yt(this,_f(this,t,e,!0))},partition:function(t,e){return O0(this,t,e)},find:function(t,e,r){var i=this.findEntry(t,e);return i?i[1]:r},forEach:function(t,e){return sr(this.size),this.__iterate(e?t.bind(e):t)},join:function(t){sr(this.size),t=t!==void 0?""+t:",";var e="",r=!0;return this.__iterate(function(i){r?r=!1:e+=t,e+=i!=null?i.toString():""}),e},keys:function(){return this.__iterator(Bi)},map:function(t,e){return Yt(this,xf(this,t,e))},reduce:function(t,e,r){return id(this,t,e,r,arguments.length<2,!1)},reduceRight:function(t,e,r){return id(this,t,e,r,arguments.length<2,!0)},reverse:function(){return Yt(this,Ju(this,!0))},slice:function(t,e){return Yt(this,Zu(this,t,e,!0))},some:function(t,e){sr(this.size);var r=!1;return this.__iterate(function(i,s,o){if(t.call(e,i,s,o))return r=!0,!1}),r},sort:function(t){return Yt(this,Gi(this,t))},values:function(){return this.__iterator(nr)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return this.size!==void 0?this.size===0:!this.some(function(){return!0})},count:function(t,e){return ji(t?this.toSeq().filter(t,e):this)},countBy:function(t,e){return M0(this,t,e)},equals:function(t){return vl(this,t)},entrySeq:function(){var t=this;if(t._cache)return new Hi(t._cache);var e=t.toSeq().map(K0).toIndexedSeq();return e.fromEntrySeq=function(){return t.toSeq()},e},filterNot:function(t,e){return this.filter(bl(t),e)},findEntry:function(t,e,r){var i=r;return this.__iterate(function(s,o,a){if(t.call(e,s,o,a))return i=[o,s],!1}),i},findKey:function(t,e){var r=this.findEntry(t,e);return r&&r[0]},findLast:function(t,e,r){return this.toKeyedSeq().reverse().find(t,e,r)},findLastEntry:function(t,e,r){return this.toKeyedSeq().reverse().findEntry(t,e,r)},findLastKey:function(t,e){return this.toKeyedSeq().reverse().findKey(t,e)},first:function(t){return this.find(Kh,null,t)},flatMap:function(t,e){return Yt(this,I0(this,t,e))},flatten:function(t){return Yt(this,wf(this,t,!0))},fromEntrySeq:function(){return new yf(this)},get:function(t,e){return this.find(function(r,i){return Ce(i,t)},void 0,e)},getIn:ed,groupBy:function(t,e){return A0(this,t,e)},has:function(t){return this.get(t,Ft)!==Ft},hasIn:J0,isSubset:function(t){return t=typeof t.includes=="function"?t:Te(t),this.every(function(e){return t.includes(e)})},isSuperset:function(t){return t=typeof t.isSubset=="function"?t:Te(t),t.isSubset(this)},keyOf:function(t){return this.findKey(function(e){return Ce(e,t)})},keySeq:function(){return this.toSeq().map(Z0).toIndexedSeq()},last:function(t){return this.toSeq().reverse().first(t)},lastKeyOf:function(t){return this.toKeyedSeq().reverse().keyOf(t)},max:function(t){return ia(this,t)},maxBy:function(t,e){return ia(this,e,t)},min:function(t){return ia(this,t?sd(t):ad)},minBy:function(t,e){return ia(this,e?sd(e):ad,t)},rest:function(){return this.slice(1)},skip:function(t){return t===0?this:this.slice(Math.max(0,t))},skipLast:function(t){return t===0?this:this.slice(0,-Math.max(0,t))},skipWhile:function(t,e){return Yt(this,bf(this,t,e,!0))},skipUntil:function(t,e){return this.skipWhile(bl(t),e)},sortBy:function(t,e){return Yt(this,Gi(this,e,t))},take:function(t){return this.slice(0,Math.max(0,t))},takeLast:function(t){return this.slice(-Math.max(0,t))},takeWhile:function(t,e){return Yt(this,z0(this,t,e))},takeUntil:function(t,e){return this.takeWhile(bl(t),e)},update:function(t){return t(this)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=Q0(this))}});var je=Te.prototype;je[ef]=!0,je[Qo]=je.values,je.toJSON=je.toArray,je.__toStringMapper=Js,je.inspect=je.toSource=function(){return this.toString()},je.chain=je.flatMap,je.contains=je.includes,di(_r,{flip:function(){return Yt(this,vf(this))},mapEntries:function(t,e){var r=this,i=0;return Yt(this,this.toSeq().map(function(s,o){return t.call(e,[o,s],i++,r)}).fromEntrySeq())},mapKeys:function(t,e){var r=this;return Yt(this,this.toSeq().flip().map(function(i,s){return t.call(e,i,s,r)}).flip())}});var ho=_r.prototype;ho[Xo]=!0,ho[Qo]=je.entries,ho.toJSON=nd,ho.__toStringMapper=function(n,t){return Js(t)+": "+Js(n)},di(ci,{toKeyedSeq:function(){return new na(this,!1)},filter:function(t,e){return Yt(this,_f(this,t,e,!1))},findIndex:function(t,e){var r=this.findEntry(t,e);return r?r[0]:-1},indexOf:function(t){var e=this.keyOf(t);return e===void 0?-1:e},lastIndexOf:function(t){var e=this.lastKeyOf(t);return e===void 0?-1:e},reverse:function(){return Yt(this,Ju(this,!1))},slice:function(t,e){return Yt(this,Zu(this,t,e,!1))},splice:function(t,e){var r=arguments.length;if(e=Math.max(e||0,0),r===0||r===2&&!e)return this;t=Vi(t,t<0?this.count():this.size);var i=this.slice(0,t);return Yt(this,r===1?i:i.concat(sn(arguments,2),this.slice(t+e)))},findLastIndex:function(t,e){var r=this.findLastEntry(t,e);return r?r[0]:-1},first:function(t){return this.get(0,t)},flatten:function(t){return Yt(this,wf(this,t,!1))},get:function(t,e){return t=Hn(this,t),t<0||this.size===1/0||this.size!==void 0&&t>this.size?e:this.find(function(r,i){return i===t},void 0,e)},has:function(t){return t=Hn(this,t),t>=0&&(this.size!==void 0?this.size===1/0||t<this.size:this.indexOf(t)!==-1)},interpose:function(t){return Yt(this,k0(this,t))},interleave:function(){var t=[this].concat(sn(arguments)),e=sa(this.toSeq(),wr.of,t),r=e.flatten(!0);return e.size&&(r.size=e.size*t.length),Yt(this,r)},keySeq:function(){return td(0,this.size)},last:function(t){return this.get(-1,t)},skipWhile:function(t,e){return Yt(this,bf(this,t,e,!1))},zip:function(){var t=[this].concat(sn(arguments));return Yt(this,sa(this,od,t))},zipAll:function(){var t=[this].concat(sn(arguments));return Yt(this,sa(this,od,t,!0))},zipWith:function(t){var e=sn(arguments);return e[0]=this,Yt(this,sa(this,t,e))}});var Xi=ci.prototype;Xi[Jo]=!0,Xi[Wn]=!0,di(Di,{get:function(t,e){return this.has(t)?t:e},includes:function(t){return this.has(t)},keySeq:function(){return this.valueSeq()}});var Ji=Di.prototype;Ji.has=je.includes,Ji.contains=Ji.includes,Ji.keys=Ji.values,di(Un,ho),di(wr,Xi),di($i,Ji);function id(n,t,e,r,i,s){return sr(n.size),n.__iterate(function(o,a,l){i?(i=!1,e=o):e=t.call(r,e,o,a,l)},s),e}function Z0(n,t){return t}function K0(n,t){return[t,n]}function bl(n){return function(){return!n.apply(this,arguments)}}function sd(n){return function(){return-n.apply(this,arguments)}}function od(){return sn(arguments)}function ad(n,t){return n<t?1:n>t?-1:0}function Q0(n){if(n.size===1/0)return 0;var t=Rr(n),e=Kt(n),r=t?1:0;return n.__iterate(e?t?function(i,s){r=31*r+ud(Qe(i),Qe(s))|0}:function(i,s){r=r+ud(Qe(i),Qe(s))|0}:t?function(i){r=31*r+Qe(i)|0}:function(i){r=r+Qe(i)|0}),tv(n.size,r)}function tv(n,t){return t=Ys(t,3432918353),t=Ys(t<<15|t>>>-15,461845907),t=Ys(t<<13|t>>>-13,5),t=(t+3864292196|0)^n,t=Ys(t^t>>>16,2246822507),t=Ys(t^t>>>13,3266489909),t=ra(t^t>>>16),t}function ud(n,t){return n^t+2654435769+(n<<6)+(n>>2)|0}var Zi=function(n){function t(e){return e==null?wl():yl(e)?e:wl().withMutations(function(r){var i=Di(e);sr(i.size),i.forEach(function(s){return r.add(s)})})}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.fromKeys=function(r){return this(_r(r).keySeq())},t.prototype.toString=function(){return this.__toString("OrderedSet {","}")},t}(lo);Zi.isOrderedSet=yl;var pi=Zi.prototype;pi[Wn]=!0,pi.zip=Xi.zip,pi.zipWith=Xi.zipWith,pi.zipAll=Xi.zipAll,pi.__empty=wl,pi.__make=ld;function ld(n,t){var e=Object.create(pi);return e.size=n?n.size:0,e._map=n,e.__ownerID=t,e}var cd;function wl(){return cd||(cd=ld(ao()))}var ev={LeftThenRight:-1,RightThenLeft:1};function rv(n){if(Gn(n))throw new Error("Can not call `Record` with an immutable Record as default values. Use a plain javascript object instead.");if(br(n))throw new Error("Can not call `Record` with an immutable Collection as default values. Use a plain javascript object instead.");if(n===null||typeof n!="object")throw new Error("Can not call `Record` with a non-object as default values. Use a plain javascript object instead.")}var Rt=function(t,e){var r;rv(t);var i=function(a){var l=this;if(a instanceof i)return a;if(!(this instanceof i))return new i(a);if(!r){r=!0;var c=Object.keys(t),h=s._indices={};s._name=e,s._keys=c,s._defaultValues=t;for(var f=0;f<c.length;f++){var g=c[f];h[g]=f,s[g]?typeof console=="object"&&console.warn&&console.warn("Cannot define "+El(this)+' with property "'+g+'" since that property name is part of the Record API.'):nv(s,g)}}return this.__ownerID=void 0,this._values=ut().withMutations(function(p){p.setSize(l._keys.length),_r(a).forEach(function(m,v){p.set(l._indices[v],m===l._defaultValues[v]?void 0:m)})}),this},s=i.prototype=Object.create(Qt);return s.constructor=i,e&&(i.displayName=e),i};Rt.prototype.toString=function(){for(var t=El(this)+" { ",e=this._keys,r,i=0,s=e.length;i!==s;i++)r=e[i],t+=(i?", ":"")+r+": "+Js(this.get(r));return t+" }"},Rt.prototype.equals=function(t){return this===t||Gn(t)&&Ki(this).equals(Ki(t))},Rt.prototype.hashCode=function(){return Ki(this).hashCode()},Rt.prototype.has=function(t){return this._indices.hasOwnProperty(t)},Rt.prototype.get=function(t,e){if(!this.has(t))return e;var r=this._indices[t],i=this._values.get(r);return i===void 0?this._defaultValues[t]:i},Rt.prototype.set=function(t,e){if(this.has(t)){var r=this._values.set(this._indices[t],e===this._defaultValues[t]?void 0:e);if(r!==this._values&&!this.__ownerID)return Sl(this,r)}return this},Rt.prototype.remove=function(t){return this.set(t)},Rt.prototype.clear=function(){var t=this._values.clear().setSize(this._keys.length);return this.__ownerID?this:Sl(this,t)},Rt.prototype.wasAltered=function(){return this._values.wasAltered()},Rt.prototype.toSeq=function(){return Ki(this)},Rt.prototype.toJS=function(){return fa(this)},Rt.prototype.entries=function(){return this.__iterator(ir)},Rt.prototype.__iterator=function(t,e){return Ki(this).__iterator(t,e)},Rt.prototype.__iterate=function(t,e){return Ki(this).__iterate(t,e)},Rt.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this;var e=this._values.__ensureOwner(t);return t?Sl(this,e,t):(this.__ownerID=t,this._values=e,this)},Rt.isRecord=Gn,Rt.getDescriptiveName=El;var Qt=Rt.prototype;Qt[nf]=!0,Qt[Gs]=Qt.remove,Qt.deleteIn=Qt.removeIn=nl,Qt.getIn=ed,Qt.hasIn=je.hasIn,Qt.merge=Pf,Qt.mergeWith=Rf,Qt.mergeIn=al,Qt.mergeDeep=Ff,Qt.mergeDeepWith=Nf,Qt.mergeDeepIn=ul,Qt.setIn=rl,Qt.update=sl,Qt.updateIn=ol,Qt.withMutations=Qs,Qt.asMutable=to,Qt.asImmutable=eo,Qt[Qo]=Qt.entries,Qt.toJSON=Qt.toObject=je.toObject,Qt.inspect=Qt.toSource=function(){return this.toString()};function Sl(n,t,e){var r=Object.create(Object.getPrototypeOf(n));return r._values=t,r.__ownerID=e,r}function El(n){return n.constructor.displayName||n.constructor.name||"Record"}function Ki(n){return Du(n._keys.map(function(t){return[t,n.get(t)]}))}function nv(n,t){try{Object.defineProperty(n,t,{get:function(){return this.get(t)},set:function(e){Xs(this.__ownerID,"Cannot set on an immutable record."),this.set(t,e)}})}catch{}}var iv=function(n){function t(e,r){if(!(this instanceof t))return new t(e,r);if(this._value=e,this.size=r===void 0?1/0:Math.max(0,r),this.size===0){if(Ml)return Ml;Ml=this}}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return this.size===0?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},t.prototype.get=function(r,i){return this.has(r)?this._value:i},t.prototype.includes=function(r){return Ce(this._value,r)},t.prototype.slice=function(r,i){var s=this.size;return Ws(r,i,s)?this:new t(this._value,Us(i,s)-Vi(r,s))},t.prototype.reverse=function(){return this},t.prototype.indexOf=function(r){return Ce(this._value,r)?0:-1},t.prototype.lastIndexOf=function(r){return Ce(this._value,r)?this.size:-1},t.prototype.__iterate=function(r,i){for(var s=this.size,o=0;o!==s&&r(this._value,i?s-++o:o++,this)!==!1;);return o},t.prototype.__iterator=function(r,i){var s=this,o=this.size,a=0;return new Nt(function(){return a===o?Ne():ee(r,i?o-++a:a++,s._value)})},t.prototype.equals=function(r){return r instanceof t?Ce(this._value,r._value):vl(this,r)},t}(wr),Ml;function Xt(n,t){return hd([],t||sv,n,"",t&&t.length>2?[]:void 0,{"":n})}function hd(n,t,e,r,i,s){if(typeof e!="string"&&!br(e)&&(Nu(e)||Lu(e)||tl(e))){if(~n.indexOf(e))throw new TypeError("Cannot convert circular structure to Immutable");n.push(e),i&&r!==""&&i.push(r);var o=t.call(s,r,Ee(e).map(function(a,l){return hd(n,t,a,l,i,e)}),i&&i.slice());return n.pop(),i&&i.pop(),o}return e}function sv(n,t){return Ke(t)?t.toList():Kt(t)?t.toMap():t.toSet()}var ov="5.1.3",av=Te;const uv=Object.freeze(Object.defineProperty({__proto__:null,Collection:Te,Iterable:av,List:ut,Map:K,OrderedMap:an,OrderedSet:Zi,PairSorting:ev,Range:td,Record:Rt,Repeat:iv,Seq:Ee,Set:lo,Stack:la,fromJS:Xt,get:el,getIn:_l,has:Of,hasIn:rd,hash:Qe,is:Ce,isAssociative:Zo,isCollection:Ze,isImmutable:br,isIndexed:Ke,isKeyed:Kt,isList:pl,isMap:ea,isOrdered:Rr,isOrderedMap:qu,isOrderedSet:yl,isPlainObject:tl,isRecord:Gn,isSeq:Ko,isSet:ha,isStack:ua,isValueObject:$u,merge:R0,mergeDeep:F0,mergeDeepWith:N0,mergeWith:L0,remove:zf,removeIn:kf,set:Tf,setIn:If,update:il,updateIn:fi,version:ov},Symbol.toStringTag,{value:"Module"})),fe="MODE_IDLE",gi="MODE_2D_ZOOM_IN",mi="MODE_2D_ZOOM_OUT",yi="MODE_2D_PAN",vi="MODE_3D_VIEW",Qi="MODE_3D_FIRST_PERSON",Lr="MODE_WAITING_DRAWING_LINE",Fr="MODE_DRAGGING_LINE",Nr="MODE_DRAGGING_VERTEX",jr="MODE_DRAGGING_ITEM",Vr="MODE_DRAGGING_HOLE",or="MODE_DRAWING_LINE",ar="MODE_DRAWING_HOLE",Sr="MODE_DRAWING_ITEM",An="MODE_ROTATING_ITEM",Al="MODE_UPLOADING_IMAGE",Ol="MODE_FITTING_IMAGE",zl="MODE_VIEWING_CATALOG",fd="MODE_CONFIGURING_PROJECT",Tl=[fe,gi,mi,yi,Lr,or,ar,Sr,Fr,Nr,jr,Vr,Ol,Al,An],lv="mm",un="cm",dd=[lv,un,"m","in","ft","mi"],ln=1e-6,Er={DELETE:46,BACKSPACE:8,ESC:27,Z:90,ALT:18,C:67,V:86,CTRL:17,ENTER:13,TAB:9},tr=(n,t=6)=>n&&t?parseFloat(parseFloat(n.toString()).toFixed(t)):0,ts=n=>{let t=n;return t<0&&(t=~t+1),t};function Cl(n,t){return n.x===t.x?n.y-t.y:n.x-t.x}function pa(n,t){return Cl(n,t)>0?t:n}function Il(n,t){return Cl(n,t)>0?n:t}function fo(n){return n.sort(Cl)}function Ve(n,t,e,r){let i=n-e,s=t-r;return Math.sqrt(i*i+s*s)}function ga(n,t){let{x:e,y:r}=n,{x:i,y:s}=t;return Ve(e,r,i,s)}function ma(n){return{a:0,b:1,c:-n}}function ya(n){return{a:1,b:0,c:-n}}function cv(n,t,e,r,i){return ts(n*r+t*i+e)/Math.sqrt(n*n+t*t)}function hv(n,t,e,r,i){let s=n*n+t*t;return{x:(t*(t*r-n*i)-n*e)/s,y:(n*-t*r+n*i-t*e)/s}}function po(n,t,e,r,i,s){let o=t*r-n*i;if(o===0)return;let a=(n*s-e*r)/o;return{x:(e*i-t*s)/o,y:a}}function fv(n,t,e,r){let{x:i,y:s}=n,{x:o,y:a}=t,{x:l,y:c}=e,{x:h,y:f}=r,g=(f-c)*(o-i)-(h-l)*(a-s),p=(h-l)*(s-c)-(f-c)*(i-l),m=(o-i)*(s-c)-(a-s)*(i-l);if(ts(g)<=ln){if(ts(p)<=ln&&ts(m)<=ln){let S=(z,R)=>z.x===R.x?z.y-R.y:z.x-R.x,M=[n,t].sort(S),T=[e.toJS(),r.toJS()].sort(S),[C,E]=[M,T].sort((z,R)=>S(z[0],R[0]));return C[1].x===E[0].x?{type:E[0].y<=C[1].y?"colinear":"none"}:{type:E[0].x<=C[1].x?"colinear":"none"}}return{type:"parallel"}}let v=p/g,_=m/g;return v>=0-ln&&v<=1+ln&&_>=0-ln&&_<=1+ln?{type:"intersecting",point:{x:i+v*(o-i),y:s+v*(a-s)}}:{type:"none"}}function pd(n,t,e,r,i,s){let o=i-n,a=s-t,l=e-n,c=r-t,h=o*l+a*c,f=l*l+c*c,g=-1;f!=0&&(g=h/f);let p,m;g<0?(p=n,m=t):g>1?(p=e,m=r):(p=n+g*l,m=t+g*c);let v=i-p,_=s-m;return Math.sqrt(v*v+_*_)}function dv(n,t,e,r,i,s,o=ln){return pd(n,t,e,r,i,s)<=o}function pv(n,t,e,r,i,s){if(n===e)return{x:n,y:s};if(t===r)return{x:i,y:t};let o=(r-t)/(e-n),a=t-o*n,l=-1/o,h=(s-l*i-a)/(o-l),f=o*h+a;return{x:h,y:f}}function De(n,t,e,r,i,s){let o=Ve(n,t,e,r),l=Ve(n,t,i,s)/o;return n>e&&(l=gv(l,0,1,1,0)),l}function gv(n,t,e,r,i){return r+(i-r)*(n-t)/(e-t)}function mv(n,t,e,r){return-Math.atan2(t-r,e-n)*180/Math.PI}function kl(n,t,e,r){return Math.atan2(r-t,e-n)}function yv(n,t,e,r){return Math.atan2(Math.abs(r-t),Math.abs(e-n))}function Dr({x:n,y:t},{x:e,y:r}){return ts(n-e)<=ln&&ts(t-r)<=ln}function va(n,t,e,r,i,s=6){let o=kl(n,t,e,r);return{x:tr(n+Math.cos(o)*i,s),y:tr(t+Math.sin(o)*i,s)}}function vv(n,t,e){let r=n.length>>1,i,s,o=n[2*r-3]-e,a=n[2*r-2]-t,l=n[2*r-1]-e;if(a===0&&l===0)return!1;for(let h=0;h<r;h++){if(i=a,o=l,a=n[2*h]-t,l=n[2*h+1]-e,a===0&&l===0)return!1;o!==l&&(s=l>o)}let c=0;for(let h=0;h<r;h++){if(i=a,o=l,a=n[2*h]-t,l=n[2*h+1]-e,o<0&&l<0||o>0&&l>0||i<0&&a<0)continue;if(o===l&&Math.min(i,a)<0)return!0;if(o===l)continue;let f=i+(a-i)*-o/(l-o);if(f===0)return!1;f>0&&c++,o===0&&s&&l>o&&c--,o===0&&!s&&l<o&&c--,s=l>o}return(c&1)===1}function xv(n,t){let e=Math.cos(n);return e<t?0:e}function _v(n,t){let e=Math.sin(n);return e<t?0:e}function bv(n,t,e,r){return{x:(n+e)/2,y:(t+r)/2}}function wv(n){let t=n.reduce((e,r)=>({x:e.x+r.x,y:e.y+r.y}),{x:0,y:0});return{x:t.x/n.length,y:t.y/n.length}}function gd(n,t,e,r,i){let s=i*Math.PI/180,o=Math.cos(s),a=Math.sin(s),l=n-e,c=t-r;return{x:o*l-a*c+e,y:a*l+o*c+r}}const Pl="SNAP_POINT",Rl="SNAP_LINE",Ll="SNAP_SEGMENT",Fl="SNAP_GRID",md="SNAP_GUIDE",Sv=K({SNAP_POINT:!0,SNAP_LINE:!0,SNAP_SEGMENT:!0,SNAP_GRID:!1,SNAP_GUIDE:!0});class Ev extends Rt({type:"point",x:-1,y:-1,radius:1,priority:1,related:ut()}){nearestPoint(t,e){return{x:this.x,y:this.y,distance:Ve(this.x,this.y,t,e)}}isNear(t,e,r){return~(this.x-t)+1<r&&~(this.y-e)+1<r}}class Mv extends Rt({type:"line",a:-1,b:-1,c:-1,radius:1,priority:1,related:ut()}){nearestPoint(t,e){return{...hv(this.a,this.b,this.c,t,e),distance:cv(this.a,this.b,this.c,t,e)}}isNear(t,e,r){return!0}}class Av extends Rt({type:"line-segment",x1:-1,y1:-1,x2:-1,y2:-1,radius:1,priority:1,related:ut()}){nearestPoint(t,e){return{...pv(this.x1,this.y1,this.x2,this.y2,t,e),distance:pd(this.x1,this.y1,this.x2,this.y2,t,e)}}isNear(t,e,r){return!0}}class Ov extends Rt({type:"grid",x:-1,y:-1,radius:1,priority:1,related:ut()}){nearestPoint(t,e){return{x:this.x,y:this.y,distance:Ve(this.x,this.y,t,e)}}isNear(t,e,r){return~(this.x-t)+1<r&&~(this.y-e)+1<r}}function cn(n,t,e,r){let i={point:r.get(Pl),line:r.get(Rl),"line-segment":r.get(Ll),grid:r.get(Fl)};return n.valueSeq().filter(s=>i[s.type]&&s.isNear(t,e,s.radius)).map(s=>({snap:s,point:s.nearestPoint(t,e)})).filter(({snap:{radius:s},point:{distance:o}})=>o<s).min(({snap:{priority:s},point:{distance:o}},{snap:{priority:a},point:{distance:l}})=>s===a?o<l?-1:1:s>a?-1:1)}function Nl(n,t,e,r,i,s){return s=ut([s]),n.push(new Ev({x:t,y:e,radius:r,priority:i,related:s}))}function xa(n,t,e,r,i,s,o){return o=ut([o]),n.withMutations(a=>{if(a.some(c=>c.type==="line"&&t===c.a&&e===c.b&&r===c.c))return a;a.valueSeq().filter(c=>c.type==="line").map(c=>po(c.a,c.b,c.c,t,e,r)).filter(c=>c!==void 0).forEach(({x:c,y:h})=>Nl(a,c,h,20,40)),a.push(new Mv({a:t,b:e,c:r,radius:i,priority:s,related:o}))})}function go(n,t,e,r,i,s,o,a){return a=ut([a]),n.push(new Av({x1:t,y1:e,x2:r,y2:i,radius:s,priority:o,related:a}))}function zv(n,t,e,r,i,s){return s=ut([s]),n.push(new Ov({x:t,y:e,radius:r,priority:i,related:s}))}let On=(n,t,e)=>n?K(n).map(r=>new t(r)).toMap():e||K();class jl extends Rt({id:"",type:"",properties:K()},"Grid"){constructor(t={}){super({...t,properties:Xt(t.properties||{})})}}const Tv=K({h1:new jl({id:"h1",type:"horizontal-streak",properties:{step:20,colors:["#808080","#ddd","#ddd","#ddd","#ddd"]}}),v1:new jl({id:"v1",type:"vertical-streak",properties:{step:20,colors:["#808080","#ddd","#ddd","#ddd","#ddd"]}})});class yd extends Rt({vertices:ut(),lines:ut(),holes:ut(),areas:ut(),items:ut()},"ElementsSet"){constructor(t={}){super({vertices:ut(t.vertices||[]),lines:ut(t.lines||[]),holes:ut(t.holes||[]),areas:ut(t.areas||[]),items:ut(t.items||[])})}}const es={id:"",type:"",prototype:"",name:"",misc:K(),selected:!1,properties:K(),visible:!0};let vd=class extends Rt({...es,x:-1,y:-1,prototype:"vertices",lines:ut(),areas:ut()},"Vertex"){constructor(t={}){super({...t,lines:ut(t.lines||[]),areas:ut(t.areas||[])})}},xd=class extends Rt({...es,prototype:"lines",vertices:ut(),holes:ut()},"Line"){constructor(t={}){super({...t,properties:Xt(t.properties||{}),vertices:ut(t.vertices||[]),holes:ut(t.holes||[])})}},_d=class extends Rt({...es,prototype:"holes",offset:-1,line:""},"Hole"){constructor(t={}){super({...t,properties:Xt(t.properties||{})})}},bd=class extends Rt({...es,prototype:"areas",vertices:ut(),holes:ut()},"Area"){constructor(t={}){super({...t,properties:Xt(t.properties||{}),vertices:ut(t.vertices||[])})}},wd=class extends Rt({...es,prototype:"items",x:0,y:0,rotation:0},"Item"){constructor(t={}){super({...t,properties:Xt(t.properties||{})})}},Vl=class extends Rt({id:"",altitude:0,order:0,opacity:1,name:"",visible:!0,vertices:K(),lines:K(),holes:K(),areas:K(),items:K(),selected:new yd},"Layer"){constructor(t={}){super({...t,vertices:On(t.vertices,vd),lines:On(t.lines,xd),holes:On(t.holes,_d),areas:On(t.areas,bd),items:On(t.items,wd),selected:new yd(t.selected)})}},Dl=class extends Rt({...es,prototype:"groups",x:0,y:0,rotation:0,elements:K()},"Group"){constructor(t={}){super({...t,properties:Xt(t.properties||{}),elements:Xt(t.elements||{})})}};const Cv=K({"layer-1":new Vl({id:"layer-1",name:"default"})});let _a=class extends Rt({unit:"cm",layers:K(),grids:K(),selectedLayer:null,groups:K(),width:3e3,height:2e3,meta:K(),guides:K()},"Scene"){constructor(t={}){let e=On(t.layers,Vl,Cv);super({...t,grids:On(t.grids,jl,Tv),layers:e,selectedLayer:e.first().id,groups:On(t.groups||{},Dl),meta:t.meta?Xt(t.meta):K(),guides:t.guides?Xt(t.guides):K({horizontal:K(),vertical:K(),circular:K()})})}};class Iv extends Rt({name:"",prototype:"",info:K(),properties:K()},"CatalogElement"){constructor(t={}){super({...t,info:Xt(t.info),properties:Xt(t.properties)})}}let Bl=class extends Rt({ready:!1,page:"root",path:ut(),elements:K()},"Catalog"){constructor(t={}){let e=On(t.elements,Iv);super({elements:e,ready:!e.isEmpty()})}factoryElement(t,e,r){if(!this.elements.has(t)){let o=this.elements.map(a=>a.name).toArray();throw new Error(`Element ${t} does not exist in catalog ${o}`)}const i=this.elements.get(t),s=i.properties.map((o,a)=>r&&r.has(a)?r.get(a):o.get("defaultValue"));switch(i.prototype){case"lines":return new xd(e).merge({properties:s});case"holes":return new _d(e).merge({properties:s});case"areas":return new bd(e).merge({properties:s});case"items":return new wd(e).merge({properties:s});default:throw new Error("prototype not valid")}}};class Sd extends Rt({list:ut(),first:null,last:null,redoList:ut()},"HistoryStructure"){constructor(t={}){super({list:Xt(t.list||[]),first:new _a(t.scene),last:new _a(t.last||t.scene)})}}let ba=class extends Rt({mode:fe,scene:new _a,sceneHistory:new Sd,catalog:new Bl,viewer2D:K(),mouse:K({x:0,y:0}),zoom:0,snapMask:Sv,snapElements:ut(),activeSnapElement:null,drawingSupport:K(),draggingSupport:K(),rotatingSupport:K(),errors:ut(),warnings:ut(),clipboardProperties:K(),selectedElementsHistory:ut(),misc:K(),alterate:!1},"State"){constructor(t={}){super({...t,scene:new _a(t.scene),sceneHistory:new Sd(t),catalog:new Bl(t.catalog||{}),viewer2D:K(t.viewer2D||{}),drawingSupport:K(t.drawingSupport||{}),draggingSupport:K(t.draggingSupport||{}),rotatingSupport:K(t.rotatingSupport||{}),misc:t.misc?Xt(t.misc):K()})}};function wa(n){let t=[];for(let e=0;e<n;++e)t.push([]);return t}class Ed{constructor(t,e){Vt(this,"u");Vt(this,"v");this.u=t,this.v=e}}class kv{constructor(t){Vt(this,"count");Vt(this,"subgraphs");Vt(this,"time");Vt(this,"V");Vt(this,"E");Vt(this,"adj");Vt(this,"children");this.count=0,this.subgraphs=[],this.time=0,this.children=0,this.V=t,this.E=0,this.adj=[],this.adj=wa(t)}addEdge(t,e){this.adj[t].push(e),this.E++}_BCCUtil(t,e,r,i,s){e[t]=r[t]=++this.time,this.children=0,this.adj[t].forEach(o=>{if(e[o]==-1){if(this.children++,s[o]=t,i.push(new Ed(t,o)),this._BCCUtil(o,e,r,i,s),r[t]>r[o]&&(r[t]=r[o]),e[t]==1&&this.children>1||e[t]>1&&r[o]>=e[t]){let a=[];for(;i[i.length-1].u!=t||i[i.length-1].v!=o;)a.push(i[i.length-1]),i.splice(i.length-1,1);a.push(i[i.length-1]),this.subgraphs.push(a),a=[],i.splice(i.length-1,1),this.count++}}else o!=s[t]&&e[o]<r[t]&&(r[t]>e[o]&&(r[t]=e[o]),i.push(new Ed(t,o)))})}BCC(){let t=this.V,e=wa(t),r=wa(t),i=wa(t),s=[];for(let o=0;o<t;o++)e[o]=-1,r[o]=-1,i[o]=-1;for(let o=0;o<t;o++){e[o]==-1&&this._BCCUtil(o,e,r,s,i);let a=0,l=[];for(;s.length>0;)a=1,l.push(s[s.length-1]),s.splice(s.length-1,1);a==1&&(this.subgraphs.push(l),l=[],this.count++)}}}const Pv=(n,t)=>{let e=[];return n.forEach(r=>{e.push([]);let i=Rv(r);i.forEach(s=>{t.adj[s].forEach(a=>{s<=a&&i.has(a)&&e[e.length-1].push([s,a])})})}),e},Rv=n=>{let t=new Set;return n.forEach(e=>{t.add(e.u),t.add(e.v)}),t};function Lv(n,t){return[n[0]-t[0],n[1]-t[1]]}function Md(n,t){return(n%t+t)%t}function Fv(n){return n.map(function(e){return{ev:e,color:0,direction:-1}})}function Nv(n,t){let e=Lv(t,n);return Math.atan2(e[1],e[0])}function jv(n,t){return n.map(function(e,r){let i=[];return t.forEach(function(s,o){let a,l;s[0]===r&&(a=s[1],l=1),s[1]===r&&(a=s[0],l=0),a!==void 0&&i.push({index:o,endpoint:a,angle:Nv(e,n[a]),edge:s,position:l})}),i.sort(function(s,o){return o.angle-s.angle}),i})}function Ad(n,t){let e,r;for(e=0;e<t.length;e+=1)if(t[e].color<2)return r=-1*t[e].direction,zd(t,e,r),{edge:e,direction:r,position:r===-1?0:1}}function Od(n,t,e,r){let i=n[r[t][e]],s=i.length,o,a,l;for(l=0;l<s;l+=1)if(o=i[l],o.index===t)return a=i[Md(l+1,i.length)],{edge:a.index,vertex:a.endpoint,position:a.position,direction:a.position?1:-1}}function zd(n,t,e){n[t].color+=1,n[t].direction=e}function Vv(n,t){let e=Fv(t),r=jv(n,t),i=[],s=[],o=[],a,l,c,h,f=Ad(r,e);for(;f!==void 0;){for(a=[t[f.edge][Md(f.position+1,2)],t[f.edge][f.position]],l=[f.edge],c=[f.direction],h=Od(r,f.edge,f.position,t);h.edge!==f.edge;)a.push(h.vertex),l.push(h.edge),c.push(h.direction),zd(e,h.edge,h.direction),h=Od(r,h.edge,h.position,t);s.push(l),i.push(a),o.push(c),f=Ad(r,e)}return{v_cycles:i,e_cycles:s,dir_e_cycles:o,ev_mapping:e}}function Dv(n,t){let e=[],r,i,s;for(s=0;s<t.length;s+=1)r=t[s],i=n[s],(r.length<3||i[0]!==i[i.length-1])&&e.push(s);return e}function Bv(n,t){let e=Vv(n,t),r=e.v_cycles,i=e.e_cycles;Dv(r,i).forEach(g=>{r.splice(g,1),i.splice(g,1)});let o=e.dir_e_cycles,l=e.e_cycles.map((g,p)=>g.map(function(m,v){let _,S;return o[p][v]>0?(_=t[m][0],S=t[m][1]):(_=t[m][1],S=t[m][0]),(n[S][0]-n[_][0])*(n[S][1]+n[_][1])})).map(g=>g.reduce((p,m)=>p+m)),c=l.filter(g=>g>0).length,h=l.length-c,f=c>=h?1:-1;return{v_cycles:e.v_cycles.filter((g,p)=>f*l[p]>0),e_cycles:e.e_cycles.filter((g,p)=>f*l[p]>0),ev_mapping:e.ev_mapping}}function qv(n,t){let e=ut();const r=new kv(n.length);t.forEach(([l,c])=>{r.addEdge(l,c),r.addEdge(c,l)}),r.BCC();const i=r.subgraphs.filter(l=>l.length>=3),s=Pv(i,r),o=[];return s.forEach(l=>{l.forEach(c=>o.push(c))}),Bv(n,o).v_cycles.forEach(l=>{l.shift(),e=e.push(l)}),e}function $v(n){let t=0,e=0,r=n.size;for(t=0;t<r;t++){let{x:i,y:s}=n.get(t)||{x:0,y:0},{x:o,y:a}=n.get((t+1)%r)||{x:0,y:0};e+=(o-i)*(a+s)}return e>0}function ql(n,t=ut(),e=K()){let{width:r,height:i}=n,s,o,a;return t.withMutations(l=>{if(n.layers.forEach(c=>{let{lines:h,vertices:f}=c;f.forEach(({id:g,x:p,y:m})=>{e.get(Pl)&&Nl(l,p,m,10,10,g),e.get(Rl)&&({a:s,b:o,c:a}=ma(m),xa(l,s,o,a,10,1,g),{a:s,b:o,c:a}=ya(p),xa(l,s,o,a,10,1,g))}),e.get(Ll)&&h.forEach(({id:g,vertices:[p,m]})=>{let{x:v,y:_}=f.get(p),{x:S,y:M}=f.get(m);go(l,v,_,S,M,20,1,g)})}),e.get(Fl)){let c=5,h=100/c,f=r/h,g=i/h;for(let p=0;p<f;p++){let m=p*h;for(let v=0;v<g;v++){let _=v*h,S=!(p%c),M=!(v%c);zv(l,m,_,10,S&&M?15:10,null)}}}if(e.get(md)){let c=n.getIn(["guides","horizontal"]),h=n.getIn(["guides","vertical"]),f=c.valueSeq(),g=h.valueSeq();f.forEach(p=>{g.forEach(m=>{Nl(l,m,p,10,10)})}),f.forEach(p=>go(l,0,p,r,p,20,1)),g.forEach(p=>go(l,p,0,p,i,20,1))}})}var Sa={exports:{}},Hv=Sa.exports,Td;function $l(){return Td||(Td=1,function(n,t){(function(e,r){n.exports=r()})(Hv,function(){var e=Array.prototype.slice;function r(u,d){d&&(u.prototype=Object.create(d.prototype)),u.prototype.constructor=u}function i(u){return l(u)?u:Ot(u)}r(s,i);function s(u){return c(u)?u:Bt(u)}r(o,i);function o(u){return h(u)?u:kt(u)}r(a,i);function a(u){return l(u)&&!f(u)?u:Ct(u)}function l(u){return!!(u&&u[p])}function c(u){return!!(u&&u[m])}function h(u){return!!(u&&u[v])}function f(u){return c(u)||h(u)}function g(u){return!!(u&&u[_])}i.isIterable=l,i.isKeyed=c,i.isIndexed=h,i.isAssociative=f,i.isOrdered=g,i.Keyed=s,i.Indexed=o,i.Set=a;var p="@@__IMMUTABLE_ITERABLE__@@",m="@@__IMMUTABLE_KEYED__@@",v="@@__IMMUTABLE_INDEXED__@@",_="@@__IMMUTABLE_ORDERED__@@",S="delete",M=5,T=1<<M,C=T-1,E={},z={value:!1},R={value:!1};function k(u){return u.value=!1,u}function L(u){u&&(u.value=!0)}function X(){}function J(u,d){d=d||0;for(var y=Math.max(0,u.length-d),x=new Array(y),b=0;b<y;b++)x[b]=u[b+d];return x}function at(u){return u.size===void 0&&(u.size=u.__iterate(bt)),u.size}function tt(u,d){if(typeof d!="number"){var y=d>>>0;if(""+y!==d||y===4294967295)return NaN;d=y}return d<0?at(u)+d:d}function bt(){return!0}function xt(u,d,y){return(u===0||y!==void 0&&u<=-y)&&(d===void 0||y!==void 0&&d>=y)}function yt(u,d){return Y(u,d,0)}function ht(u,d){return Y(u,d,d)}function Y(u,d,y){return u===void 0?y:u<0?Math.max(0,d+u):d===void 0?u:Math.min(d,u)}var St=0,j=1,W=2,ft=typeof Symbol=="function"&&Symbol.iterator,et="@@iterator",rt=ft||et;function Z(u){this.next=u}Z.prototype.toString=function(){return"[Iterator]"},Z.KEYS=St,Z.VALUES=j,Z.ENTRIES=W,Z.prototype.inspect=Z.prototype.toSource=function(){return this.toString()},Z.prototype[rt]=function(){return this};function Q(u,d,y,x){var b=u===0?d:u===1?y:[d,y];return x?x.value=b:x={value:b,done:!1},x}function U(){return{value:void 0,done:!0}}function st(u){return!!pt(u)}function vt(u){return u&&typeof u.next=="function"}function B(u){var d=pt(u);return d&&d.call(u)}function pt(u){var d=u&&(ft&&u[ft]||u[et]);if(typeof d=="function")return d}function H(u){return u&&typeof u.length=="number"}r(Ot,i);function Ot(u){return u==null?Dn():l(u)?u.toSeq():Ci(u)}Ot.of=function(){return Ot(arguments)},Ot.prototype.toSeq=function(){return this},Ot.prototype.toString=function(){return this.__toString("Seq {","}")},Ot.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},Ot.prototype.__iterate=function(u,d){return se(this,u,d,!0)},Ot.prototype.__iterator=function(u,d){return Ye(this,u,d,!0)},r(Bt,Ot);function Bt(u){return u==null?Dn().toKeyedSeq():l(u)?c(u)?u.toSeq():u.fromEntrySeq():_n(u)}Bt.prototype.toKeyedSeq=function(){return this},r(kt,Ot);function kt(u){return u==null?Dn():l(u)?c(u)?u.entrySeq():u.toIndexedSeq():Bn(u)}kt.of=function(){return kt(arguments)},kt.prototype.toIndexedSeq=function(){return this},kt.prototype.toString=function(){return this.__toString("Seq [","]")},kt.prototype.__iterate=function(u,d){return se(this,u,d,!1)},kt.prototype.__iterator=function(u,d){return Ye(this,u,d,!1)},r(Ct,Ot);function Ct(u){return(u==null?Dn():l(u)?c(u)?u.entrySeq():u:Bn(u)).toSetSeq()}Ct.of=function(){return Ct(arguments)},Ct.prototype.toSetSeq=function(){return this},Ot.isSeq=Le,Ot.Keyed=Bt,Ot.Set=Ct,Ot.Indexed=kt;var Gt="@@__IMMUTABLE_SEQ__@@";Ot.prototype[Gt]=!0,r(gt,kt);function gt(u){this._array=u,this.size=u.length}gt.prototype.get=function(u,d){return this.has(u)?this._array[tt(this,u)]:d},gt.prototype.__iterate=function(u,d){for(var y=this._array,x=y.length-1,b=0;b<=x;b++)if(u(y[d?x-b:b],b,this)===!1)return b+1;return b},gt.prototype.__iterator=function(u,d){var y=this._array,x=y.length-1,b=0;return new Z(function(){return b>x?U():Q(u,b,y[d?x-b++:b++])})},r(_t,Bt);function _t(u){var d=Object.keys(u);this._object=u,this._keys=d,this.size=d.length}_t.prototype.get=function(u,d){return d!==void 0&&!this.has(u)?d:this._object[u]},_t.prototype.has=function(u){return this._object.hasOwnProperty(u)},_t.prototype.__iterate=function(u,d){for(var y=this._object,x=this._keys,b=x.length-1,A=0;A<=b;A++){var O=x[d?b-A:A];if(u(y[O],O,this)===!1)return A+1}return A},_t.prototype.__iterator=function(u,d){var y=this._object,x=this._keys,b=x.length-1,A=0;return new Z(function(){var O=x[d?b-A:A];return A++>b?U():Q(u,O,y[O])})},_t.prototype[_]=!0,r(Dt,kt);function Dt(u){this._iterable=u,this.size=u.length||u.size}Dt.prototype.__iterateUncached=function(u,d){if(d)return this.cacheResult().__iterate(u,d);var y=this._iterable,x=B(y),b=0;if(vt(x))for(var A;!(A=x.next()).done&&u(A.value,b++,this)!==!1;);return b},Dt.prototype.__iteratorUncached=function(u,d){if(d)return this.cacheResult().__iterator(u,d);var y=this._iterable,x=B(y);if(!vt(x))return new Z(U);var b=0;return new Z(function(){var A=x.next();return A.done?A:Q(u,b++,A.value)})},r(zt,kt);function zt(u){this._iterator=u,this._iteratorCache=[]}zt.prototype.__iterateUncached=function(u,d){if(d)return this.cacheResult().__iterate(u,d);for(var y=this._iterator,x=this._iteratorCache,b=0;b<x.length;)if(u(x[b],b++,this)===!1)return b;for(var A;!(A=y.next()).done;){var O=A.value;if(x[b]=O,u(O,b++,this)===!1)break}return b},zt.prototype.__iteratorUncached=function(u,d){if(d)return this.cacheResult().__iterator(u,d);var y=this._iterator,x=this._iteratorCache,b=0;return new Z(function(){if(b>=x.length){var A=y.next();if(A.done)return A;x[b]=A.value}return Q(u,b,x[b++])})};function Le(u){return!!(u&&u[Gt])}var Qr;function Dn(){return Qr||(Qr=new gt([]))}function _n(u){var d=Array.isArray(u)?new gt(u).fromEntrySeq():vt(u)?new zt(u).fromEntrySeq():st(u)?new Dt(u).fromEntrySeq():typeof u=="object"?new _t(u):void 0;if(!d)throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+u);return d}function Bn(u){var d=Ii(u);if(!d)throw new TypeError("Expected Array or iterable object of values: "+u);return d}function Ci(u){var d=Ii(u)||typeof u=="object"&&new _t(u);if(!d)throw new TypeError("Expected Array or iterable object of values, or keyed object: "+u);return d}function Ii(u){return H(u)?new gt(u):vt(u)?new zt(u):st(u)?new Dt(u):void 0}function se(u,d,y,x){var b=u._cache;if(b){for(var A=b.length-1,O=0;O<=A;O++){var P=b[y?A-O:O];if(d(P[1],x?P[0]:O,u)===!1)return O+1}return O}return u.__iterateUncached(d,y)}function Ye(u,d,y,x){var b=u._cache;if(b){var A=b.length-1,O=0;return new Z(function(){var P=b[y?A-O:O];return O++>A?U():Q(d,x?P[0]:O-1,P[1])})}return u.__iteratorUncached(d,y)}function Cr(u,d){return d?dr(d,u,"",{"":u}):ki(u)}function dr(u,d,y,x){return Array.isArray(d)?u.call(x,y,kt(d).map(function(b,A){return dr(u,b,A,d)})):qn(d)?u.call(x,y,Bt(d).map(function(b,A){return dr(u,b,A,d)})):d}function ki(u){return Array.isArray(u)?kt(u).map(ki).toList():qn(u)?Bt(u).map(ki).toMap():u}function qn(u){return u&&(u.constructor===Object||u.constructor===void 0)}function oe(u,d){if(u===d||u!==u&&d!==d)return!0;if(!u||!d)return!1;if(typeof u.valueOf=="function"&&typeof d.valueOf=="function"){if(u=u.valueOf(),d=d.valueOf(),u===d||u!==u&&d!==d)return!0;if(!u||!d)return!1}return!!(typeof u.equals=="function"&&typeof d.equals=="function"&&u.equals(d))}function $n(u,d){if(u===d)return!0;if(!l(d)||u.size!==void 0&&d.size!==void 0&&u.size!==d.size||u.__hash!==void 0&&d.__hash!==void 0&&u.__hash!==d.__hash||c(u)!==c(d)||h(u)!==h(d)||g(u)!==g(d))return!1;if(u.size===0&&d.size===0)return!0;var y=!f(u);if(g(u)){var x=u.entries();return d.every(function(F,V){var q=x.next().value;return q&&oe(q[1],F)&&(y||oe(q[0],V))})&&x.next().done}var b=!1;if(u.size===void 0)if(d.size===void 0)typeof u.cacheResult=="function"&&u.cacheResult();else{b=!0;var A=u;u=d,d=A}var O=!0,P=d.__iterate(function(F,V){if(y?!u.has(F):b?!oe(F,u.get(V,E)):!oe(u.get(V,E),F))return O=!1,!1});return O&&u.size===P}r(we,kt);function we(u,d){if(!(this instanceof we))return new we(u,d);if(this._value=u,this.size=d===void 0?1/0:Math.max(0,d),this.size===0){if(Pi)return Pi;Pi=this}}we.prototype.toString=function(){return this.size===0?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},we.prototype.get=function(u,d){return this.has(u)?this._value:d},we.prototype.includes=function(u){return oe(this._value,u)},we.prototype.slice=function(u,d){var y=this.size;return xt(u,d,y)?this:new we(this._value,ht(d,y)-yt(u,y))},we.prototype.reverse=function(){return this},we.prototype.indexOf=function(u){return oe(this._value,u)?0:-1},we.prototype.lastIndexOf=function(u){return oe(this._value,u)?this.size:-1},we.prototype.__iterate=function(u,d){for(var y=0;y<this.size;y++)if(u(this._value,y,this)===!1)return y+1;return y},we.prototype.__iterator=function(u,d){var y=this,x=0;return new Z(function(){return x<y.size?Q(u,x++,y._value):U()})},we.prototype.equals=function(u){return u instanceof we?oe(this._value,u._value):$n(u)};var Pi;function Ri(u,d){if(!u)throw new Error(d)}r(ae,kt);function ae(u,d,y){if(!(this instanceof ae))return new ae(u,d,y);if(Ri(y!==0,"Cannot step a Range by 0"),u=u||0,d===void 0&&(d=1/0),y=y===void 0?1:Math.abs(y),d<u&&(y=-y),this._start=u,this._end=d,this._step=y,this.size=Math.max(0,Math.ceil((d-u)/y-1)+1),this.size===0){if(Li)return Li;Li=this}}ae.prototype.toString=function(){return this.size===0?"Range []":"Range [ "+this._start+"..."+this._end+(this._step!==1?" by "+this._step:"")+" ]"},ae.prototype.get=function(u,d){return this.has(u)?this._start+tt(this,u)*this._step:d},ae.prototype.includes=function(u){var d=(u-this._start)/this._step;return d>=0&&d<this.size&&d===Math.floor(d)},ae.prototype.slice=function(u,d){return xt(u,d,this.size)?this:(u=yt(u,this.size),d=ht(d,this.size),d<=u?new ae(0,0):new ae(this.get(u,this._end),this.get(d,this._end),this._step))},ae.prototype.indexOf=function(u){var d=u-this._start;if(d%this._step===0){var y=d/this._step;if(y>=0&&y<this.size)return y}return-1},ae.prototype.lastIndexOf=function(u){return this.indexOf(u)},ae.prototype.__iterate=function(u,d){for(var y=this.size-1,x=this._step,b=d?this._start+y*x:this._start,A=0;A<=y;A++){if(u(b,A,this)===!1)return A+1;b+=d?-x:x}return A},ae.prototype.__iterator=function(u,d){var y=this.size-1,x=this._step,b=d?this._start+y*x:this._start,A=0;return new Z(function(){var O=b;return b+=d?-x:x,A>y?U():Q(u,A++,O)})},ae.prototype.equals=function(u){return u instanceof ae?this._start===u._start&&this._end===u._end&&this._step===u._step:$n(this,u)};var Li;r(Ir,i);function Ir(){throw TypeError("Abstract")}r(oi,Ir);function oi(){}r(ai,Ir);function ai(){}r(Fi,Ir);function Fi(){}Ir.Keyed=oi,Ir.Indexed=ai,Ir.Set=Fi;var Ni=typeof Math.imul=="function"&&Math.imul(4294967295,2)===-2?Math.imul:function(d,y){d=d|0,y=y|0;var x=d&65535,b=y&65535;return x*b+((d>>>16)*b+x*(y>>>16)<<16>>>0)|0};function Fs(u){return u>>>1&1073741824|u&3221225471}function $e(u){if(u===!1||u===null||u===void 0||typeof u.valueOf=="function"&&(u=u.valueOf(),u===!1||u===null||u===void 0))return 0;if(u===!0)return 1;var d=typeof u;if(d==="number"){if(u!==u||u===1/0)return 0;var y=u|0;for(y!==u&&(y^=u*4294967295);u>4294967295;)u/=4294967295,y^=u;return Fs(y)}if(d==="string")return u.length>ot?Th(u):jo(u);if(typeof u.hashCode=="function")return u.hashCode();if(d==="object")return _u(u);if(typeof u.toString=="function")return jo(u.toString());throw new Error("Value type "+d+" cannot be hashed.")}function Th(u){var d=qt[u];return d===void 0&&(d=jo(u),jt===Mt&&(jt=0,qt={}),jt++,qt[u]=d),d}function jo(u){for(var d=0,y=0;y<u.length;y++)d=31*d+u.charCodeAt(y)|0;return Fs(d)}function _u(u){var d;if(Do&&(d=Bo.get(u),d!==void 0)||(d=u[G],d!==void 0)||!bu&&(d=u.propertyIsEnumerable&&u.propertyIsEnumerable[G],d!==void 0||(d=Ch(u),d!==void 0)))return d;if(d=++I,I&1073741824&&(I=0),Do)Bo.set(u,d);else{if(Vo!==void 0&&Vo(u)===!1)throw new Error("Non-extensible objects are not allowed as keys.");if(bu)Object.defineProperty(u,G,{enumerable:!1,configurable:!1,writable:!1,value:d});else if(u.propertyIsEnumerable!==void 0&&u.propertyIsEnumerable===u.constructor.prototype.propertyIsEnumerable)u.propertyIsEnumerable=function(){return this.constructor.prototype.propertyIsEnumerable.apply(this,arguments)},u.propertyIsEnumerable[G]=d;else if(u.nodeType!==void 0)u[G]=d;else throw new Error("Unable to set a non-enumerable property on object.")}return d}var Vo=Object.isExtensible,bu=function(){try{return Object.defineProperty({},"@",{}),!0}catch{return!1}}();function Ch(u){if(u&&u.nodeType>0)switch(u.nodeType){case 1:return u.uniqueID;case 9:return u.documentElement&&u.documentElement.uniqueID}}var Do=typeof WeakMap=="function",Bo;Do&&(Bo=new WeakMap);var I=0,G="__immutablehash__";typeof Symbol=="function"&&(G=Symbol(G));var ot=16,Mt=255,jt=0,qt={};function At(u){Ri(u!==1/0,"Cannot perform this action with an infinite size.")}r(nt,oi);function nt(u){return u==null?tn():Oe(u)&&!g(u)?u:tn().withMutations(function(d){var y=s(u);At(y.size),y.forEach(function(x,b){return d.set(b,x)})})}nt.of=function(){var u=e.call(arguments,0);return tn().withMutations(function(d){for(var y=0;y<u.length;y+=2){if(y+1>=u.length)throw new Error("Missing value for key: "+u[y]);d.set(u[y],u[y+1])}})},nt.prototype.toString=function(){return this.__toString("Map {","}")},nt.prototype.get=function(u,d){return this._root?this._root.get(0,void 0,u,d):d},nt.prototype.set=function(u,d){return yy(this,u,d)},nt.prototype.setIn=function(u,d){return this.updateIn(u,E,function(){return d})},nt.prototype.remove=function(u){return yy(this,u,E)},nt.prototype.deleteIn=function(u){return this.updateIn(u,function(){return E})},nt.prototype.update=function(u,d,y){return arguments.length===1?u(this):this.updateIn([u],d,y)},nt.prototype.updateIn=function(u,d,y){y||(y=d,d=void 0);var x=wy(this,$y(u),d,y);return x===E?void 0:x},nt.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):tn()},nt.prototype.merge=function(){return wu(this,void 0,arguments)},nt.prototype.mergeWith=function(u){var d=e.call(arguments,1);return wu(this,u,d)},nt.prototype.mergeIn=function(u){var d=e.call(arguments,1);return this.updateIn(u,tn(),function(y){return typeof y.merge=="function"?y.merge.apply(y,d):d[d.length-1]})},nt.prototype.mergeDeep=function(){return wu(this,xy,arguments)},nt.prototype.mergeDeepWith=function(u){var d=e.call(arguments,1);return wu(this,_y(u),d)},nt.prototype.mergeDeepIn=function(u){var d=e.call(arguments,1);return this.updateIn(u,tn(),function(y){return typeof y.mergeDeep=="function"?y.mergeDeep.apply(y,d):d[d.length-1]})},nt.prototype.sort=function(u){return ye(Bs(this,u))},nt.prototype.sortBy=function(u,d){return ye(Bs(this,d,u))},nt.prototype.withMutations=function(u){var d=this.asMutable();return u(d),d.wasAltered()?d.__ensureOwner(this.__ownerID):this},nt.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new X)},nt.prototype.asImmutable=function(){return this.__ensureOwner()},nt.prototype.wasAltered=function(){return this.__altered},nt.prototype.__iterator=function(u,d){return new qo(this,u,d)},nt.prototype.__iterate=function(u,d){var y=this,x=0;return this._root&&this._root.iterate(function(b){return x++,u(b[1],b[0],y)},d),x},nt.prototype.__ensureOwner=function(u){return u===this.__ownerID?this:u?Ih(this.size,this._root,u,this.__hash):(this.__ownerID=u,this.__altered=!1,this)};function Oe(u){return!!(u&&u[ue])}nt.isMap=Oe;var ue="@@__IMMUTABLE_MAP__@@",mt=nt.prototype;mt[ue]=!0,mt[S]=mt.remove,mt.removeIn=mt.deleteIn;function Pe(u,d){this.ownerID=u,this.entries=d}Pe.prototype.get=function(u,d,y,x){for(var b=this.entries,A=0,O=b.length;A<O;A++)if(oe(y,b[A][0]))return b[A][1];return x},Pe.prototype.update=function(u,d,y,x,b,A,O){for(var P=b===E,F=this.entries,V=0,q=F.length;V<q&&!oe(x,F[V][0]);V++);var it=V<q;if(it?F[V][1]===b:P)return this;if(L(O),(P||!it)&&L(A),!(P&&F.length===1)){if(!it&&!P&&F.length>=hE)return oE(u,F,x,b);var dt=u&&u===this.ownerID,Tt=dt?F:J(F);return it?P?V===q-1?Tt.pop():Tt[V]=Tt.pop():Tt[V]=[x,b]:Tt.push([x,b]),dt?(this.entries=Tt,this):new Pe(u,Tt)}};function pr(u,d,y){this.ownerID=u,this.bitmap=d,this.nodes=y}pr.prototype.get=function(u,d,y,x){d===void 0&&(d=$e(y));var b=1<<((u===0?d:d>>>u)&C),A=this.bitmap;return(A&b)===0?x:this.nodes[Sy(A&b-1)].get(u+M,d,y,x)},pr.prototype.update=function(u,d,y,x,b,A,O){y===void 0&&(y=$e(x));var P=(d===0?y:y>>>d)&C,F=1<<P,V=this.bitmap,q=(V&F)!==0;if(!q&&b===E)return this;var it=Sy(V&F-1),dt=this.nodes,Tt=q?dt[it]:void 0,Pt=kh(Tt,u,d+M,y,x,b,A,O);if(Pt===Tt)return this;if(!q&&Pt&&dt.length>=fE)return uE(u,dt,V,P,Pt);if(q&&!Pt&&dt.length===2&&vy(dt[it^1]))return dt[it^1];if(q&&Pt&&dt.length===1&&vy(Pt))return Pt;var ce=u&&u===this.ownerID,en=q?Pt?V:V^F:V|F,En=q?Pt?Ey(dt,it,Pt,ce):cE(dt,it,ce):lE(dt,it,Pt,ce);return ce?(this.bitmap=en,this.nodes=En,this):new pr(u,en,En)};function gr(u,d,y){this.ownerID=u,this.count=d,this.nodes=y}gr.prototype.get=function(u,d,y,x){d===void 0&&(d=$e(y));var b=(u===0?d:d>>>u)&C,A=this.nodes[b];return A?A.get(u+M,d,y,x):x},gr.prototype.update=function(u,d,y,x,b,A,O){y===void 0&&(y=$e(x));var P=(d===0?y:y>>>d)&C,F=b===E,V=this.nodes,q=V[P];if(F&&!q)return this;var it=kh(q,u,d+M,y,x,b,A,O);if(it===q)return this;var dt=this.count;if(!q)dt++;else if(!it&&(dt--,dt<dE))return aE(u,V,dt,P);var Tt=u&&u===this.ownerID,Pt=Ey(V,P,it,Tt);return Tt?(this.count=dt,this.nodes=Pt,this):new gr(u,dt,Pt)};function me(u,d,y){this.ownerID=u,this.keyHash=d,this.entries=y}me.prototype.get=function(u,d,y,x){for(var b=this.entries,A=0,O=b.length;A<O;A++)if(oe(y,b[A][0]))return b[A][1];return x},me.prototype.update=function(u,d,y,x,b,A,O){y===void 0&&(y=$e(x));var P=b===E;if(y!==this.keyHash)return P?this:(L(O),L(A),Ph(this,u,d,y,[x,b]));for(var F=this.entries,V=0,q=F.length;V<q&&!oe(x,F[V][0]);V++);var it=V<q;if(it?F[V][1]===b:P)return this;if(L(O),(P||!it)&&L(A),P&&q===2)return new mr(u,this.keyHash,F[V^1]);var dt=u&&u===this.ownerID,Tt=dt?F:J(F);return it?P?V===q-1?Tt.pop():Tt[V]=Tt.pop():Tt[V]=[x,b]:Tt.push([x,b]),dt?(this.entries=Tt,this):new me(u,this.keyHash,Tt)};function mr(u,d,y){this.ownerID=u,this.keyHash=d,this.entry=y}mr.prototype.get=function(u,d,y,x){return oe(y,this.entry[0])?this.entry[1]:x},mr.prototype.update=function(u,d,y,x,b,A,O){var P=b===E,F=oe(x,this.entry[0]);if(F?b===this.entry[1]:P)return this;if(L(O),P){L(A);return}return F?u&&u===this.ownerID?(this.entry[1]=b,this):new mr(u,this.keyHash,[x,b]):(L(A),Ph(this,u,d,$e(x),[x,b]))},Pe.prototype.iterate=me.prototype.iterate=function(u,d){for(var y=this.entries,x=0,b=y.length-1;x<=b;x++)if(u(y[d?b-x:x])===!1)return!1},pr.prototype.iterate=gr.prototype.iterate=function(u,d){for(var y=this.nodes,x=0,b=y.length-1;x<=b;x++){var A=y[d?b-x:x];if(A&&A.iterate(u,d)===!1)return!1}},mr.prototype.iterate=function(u,d){return u(this.entry)},r(qo,Z);function qo(u,d,y){this._type=d,this._reverse=y,this._stack=u._root&&gy(u._root)}qo.prototype.next=function(){for(var u=this._type,d=this._stack;d;){var y=d.node,x=d.index++,b;if(y.entry){if(x===0)return $o(u,y.entry)}else if(y.entries){if(b=y.entries.length-1,x<=b)return $o(u,y.entries[this._reverse?b-x:x])}else if(b=y.nodes.length-1,x<=b){var A=y.nodes[this._reverse?b-x:x];if(A){if(A.entry)return $o(u,A.entry);d=this._stack=gy(A,d)}continue}d=this._stack=this._stack.__prev}return U()};function $o(u,d){return Q(u,d[0],d[1])}function gy(u,d){return{node:u,index:0,__prev:d}}function Ih(u,d,y,x){var b=Object.create(mt);return b.size=u,b._root=d,b.__ownerID=y,b.__hash=x,b.__altered=!1,b}var my;function tn(){return my||(my=Ih(0))}function yy(u,d,y){var x,b;if(u._root){var A=k(z),O=k(R);if(x=kh(u._root,u.__ownerID,0,void 0,d,y,A,O),!O.value)return u;b=u.size+(A.value?y===E?-1:1:0)}else{if(y===E)return u;b=1,x=new Pe(u.__ownerID,[[d,y]])}return u.__ownerID?(u.size=b,u._root=x,u.__hash=void 0,u.__altered=!0,u):x?Ih(b,x):tn()}function kh(u,d,y,x,b,A,O,P){return u?u.update(d,y,x,b,A,O,P):A===E?u:(L(P),L(O),new mr(d,x,[b,A]))}function vy(u){return u.constructor===mr||u.constructor===me}function Ph(u,d,y,x,b){if(u.keyHash===x)return new me(d,x,[u.entry,b]);var A=(y===0?u.keyHash:u.keyHash>>>y)&C,O=(y===0?x:x>>>y)&C,P,F=A===O?[Ph(u,d,y+M,x,b)]:(P=new mr(d,x,b),A<O?[u,P]:[P,u]);return new pr(d,1<<A|1<<O,F)}function oE(u,d,y,x){u||(u=new X);for(var b=new mr(u,$e(y),[y,x]),A=0;A<d.length;A++){var O=d[A];b=b.update(u,0,void 0,O[0],O[1])}return b}function aE(u,d,y,x){for(var b=0,A=0,O=new Array(y),P=0,F=1,V=d.length;P<V;P++,F<<=1){var q=d[P];q!==void 0&&P!==x&&(b|=F,O[A++]=q)}return new pr(u,b,O)}function uE(u,d,y,x,b){for(var A=0,O=new Array(T),P=0;y!==0;P++,y>>>=1)O[P]=y&1?d[A++]:void 0;return O[x]=b,new gr(u,A+1,O)}function wu(u,d,y){for(var x=[],b=0;b<y.length;b++){var A=y[b],O=s(A);l(A)||(O=O.map(function(P){return Cr(P)})),x.push(O)}return by(u,d,x)}function xy(u,d,y){return u&&u.mergeDeep&&l(d)?u.mergeDeep(d):oe(u,d)?u:d}function _y(u){return function(d,y,x){if(d&&d.mergeDeepWith&&l(y))return d.mergeDeepWith(u,y);var b=u(d,y,x);return oe(d,b)?d:b}}function by(u,d,y){return y=y.filter(function(x){return x.size!==0}),y.length===0?u:u.size===0&&!u.__ownerID&&y.length===1?u.constructor(y[0]):u.withMutations(function(x){for(var b=d?function(O,P){x.update(P,E,function(F){return F===E?O:d(F,O,P)})}:function(O,P){x.set(P,O)},A=0;A<y.length;A++)y[A].forEach(b)})}function wy(u,d,y,x){var b=u===E,A=d.next();if(A.done){var O=b?y:u,P=x(O);return P===O?u:P}Ri(b||u&&u.set,"invalid keyPath");var F=A.value,V=b?E:u.get(F,E),q=wy(V,d,y,x);return q===V?u:q===E?u.remove(F):(b?tn():u).set(F,q)}function Sy(u){return u=u-(u>>1&1431655765),u=(u&858993459)+(u>>2&858993459),u=u+(u>>4)&252645135,u=u+(u>>8),u=u+(u>>16),u&127}function Ey(u,d,y,x){var b=x?u:J(u);return b[d]=y,b}function lE(u,d,y,x){var b=u.length+1;if(x&&d+1===b)return u[d]=y,u;for(var A=new Array(b),O=0,P=0;P<b;P++)P===d?(A[P]=y,O=-1):A[P]=u[P+O];return A}function cE(u,d,y){var x=u.length-1;if(y&&d===x)return u.pop(),u;for(var b=new Array(x),A=0,O=0;O<x;O++)O===d&&(A=1),b[O]=u[O+A];return b}var hE=T/4,fE=T/2,dE=T/4;r(ie,ai);function ie(u){var d=Rh();if(u==null)return d;if(My(u))return u;var y=o(u),x=y.size;return x===0?d:(At(x),x>0&&x<T?Go(0,x,M,null,new ui(y.toArray())):d.withMutations(function(b){b.setSize(x),y.forEach(function(A,O){return b.set(O,A)})}))}ie.of=function(){return this(arguments)},ie.prototype.toString=function(){return this.__toString("List [","]")},ie.prototype.get=function(u,d){if(u=tt(this,u),u>=0&&u<this.size){u+=this._origin;var y=Ty(this,u);return y&&y.array[u&C]}return d},ie.prototype.set=function(u,d){return pE(this,u,d)},ie.prototype.remove=function(u){return this.has(u)?u===0?this.shift():u===this.size-1?this.pop():this.splice(u,1):this},ie.prototype.insert=function(u,d){return this.splice(u,0,d)},ie.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=M,this._root=this._tail=null,this.__hash=void 0,this.__altered=!0,this):Rh()},ie.prototype.push=function(){var u=arguments,d=this.size;return this.withMutations(function(y){li(y,0,d+u.length);for(var x=0;x<u.length;x++)y.set(d+x,u[x])})},ie.prototype.pop=function(){return li(this,0,-1)},ie.prototype.unshift=function(){var u=arguments;return this.withMutations(function(d){li(d,-u.length);for(var y=0;y<u.length;y++)d.set(y,u[y])})},ie.prototype.shift=function(){return li(this,1)},ie.prototype.merge=function(){return Su(this,void 0,arguments)},ie.prototype.mergeWith=function(u){var d=e.call(arguments,1);return Su(this,u,d)},ie.prototype.mergeDeep=function(){return Su(this,xy,arguments)},ie.prototype.mergeDeepWith=function(u){var d=e.call(arguments,1);return Su(this,_y(u),d)},ie.prototype.setSize=function(u){return li(this,0,u)},ie.prototype.slice=function(u,d){var y=this.size;return xt(u,d,y)?this:li(this,yt(u,y),ht(d,y))},ie.prototype.__iterator=function(u,d){var y=0,x=Oy(this,d);return new Z(function(){var b=x();return b===Ho?U():Q(u,y++,b)})},ie.prototype.__iterate=function(u,d){for(var y=0,x=Oy(this,d),b;(b=x())!==Ho&&u(b,y++,this)!==!1;);return y},ie.prototype.__ensureOwner=function(u){return u===this.__ownerID?this:u?Go(this._origin,this._capacity,this._level,this._root,this._tail,u,this.__hash):(this.__ownerID=u,this)};function My(u){return!!(u&&u[Ay])}ie.isList=My;var Ay="@@__IMMUTABLE_LIST__@@",Xe=ie.prototype;Xe[Ay]=!0,Xe[S]=Xe.remove,Xe.setIn=mt.setIn,Xe.deleteIn=Xe.removeIn=mt.removeIn,Xe.update=mt.update,Xe.updateIn=mt.updateIn,Xe.mergeIn=mt.mergeIn,Xe.mergeDeepIn=mt.mergeDeepIn,Xe.withMutations=mt.withMutations,Xe.asMutable=mt.asMutable,Xe.asImmutable=mt.asImmutable,Xe.wasAltered=mt.wasAltered;function ui(u,d){this.array=u,this.ownerID=d}ui.prototype.removeBefore=function(u,d,y){if(y===d?1<<d:this.array.length===0)return this;var x=y>>>d&C;if(x>=this.array.length)return new ui([],u);var b=x===0,A;if(d>0){var O=this.array[x];if(A=O&&O.removeBefore(u,d-M,y),A===O&&b)return this}if(b&&!A)return this;var P=Ns(this,u);if(!b)for(var F=0;F<x;F++)P.array[F]=void 0;return A&&(P.array[x]=A),P},ui.prototype.removeAfter=function(u,d,y){if(y===(d?1<<d:0)||this.array.length===0)return this;var x=y-1>>>d&C;if(x>=this.array.length)return this;var b;if(d>0){var A=this.array[x];if(b=A&&A.removeAfter(u,d-M,y),b===A&&x===this.array.length-1)return this}var O=Ns(this,u);return O.array.splice(x+1),b&&(O.array[x]=b),O};var Ho={};function Oy(u,d){var y=u._origin,x=u._capacity,b=Wo(x),A=u._tail;return O(u._root,u._level,0);function O(V,q,it){return q===0?P(V,it):F(V,q,it)}function P(V,q){var it=q===b?A&&A.array:V&&V.array,dt=q>y?0:y-q,Tt=x-q;return Tt>T&&(Tt=T),function(){if(dt===Tt)return Ho;var Pt=d?--Tt:dt++;return it&&it[Pt]}}function F(V,q,it){var dt,Tt=V&&V.array,Pt=it>y?0:y-it>>q,ce=(x-it>>q)+1;return ce>T&&(ce=T),function(){do{if(dt){var en=dt();if(en!==Ho)return en;dt=null}if(Pt===ce)return Ho;var En=d?--ce:Pt++;dt=O(Tt&&Tt[En],q-M,it+(En<<q))}while(!0)}}}function Go(u,d,y,x,b,A,O){var P=Object.create(Xe);return P.size=d-u,P._origin=u,P._capacity=d,P._level=y,P._root=x,P._tail=b,P.__ownerID=A,P.__hash=O,P.__altered=!1,P}var zy;function Rh(){return zy||(zy=Go(0,0,M))}function pE(u,d,y){if(d=tt(u,d),d!==d)return u;if(d>=u.size||d<0)return u.withMutations(function(O){d<0?li(O,d).set(0,y):li(O,0,d+1).set(d,y)});d+=u._origin;var x=u._tail,b=u._root,A=k(R);return d>=Wo(u._capacity)?x=Lh(x,u.__ownerID,0,d,y,A):b=Lh(b,u.__ownerID,u._level,d,y,A),A.value?u.__ownerID?(u._root=b,u._tail=x,u.__hash=void 0,u.__altered=!0,u):Go(u._origin,u._capacity,u._level,b,x):u}function Lh(u,d,y,x,b,A){var O=x>>>y&C,P=u&&O<u.array.length;if(!P&&b===void 0)return u;var F;if(y>0){var V=u&&u.array[O],q=Lh(V,d,y-M,x,b,A);return q===V?u:(F=Ns(u,d),F.array[O]=q,F)}return P&&u.array[O]===b?u:(L(A),F=Ns(u,d),b===void 0&&O===F.array.length-1?F.array.pop():F.array[O]=b,F)}function Ns(u,d){return d&&u&&d===u.ownerID?u:new ui(u?u.array.slice():[],d)}function Ty(u,d){if(d>=Wo(u._capacity))return u._tail;if(d<1<<u._level+M){for(var y=u._root,x=u._level;y&&x>0;)y=y.array[d>>>x&C],x-=M;return y}}function li(u,d,y){d!==void 0&&(d=d|0),y!==void 0&&(y=y|0);var x=u.__ownerID||new X,b=u._origin,A=u._capacity,O=b+d,P=y===void 0?A:y<0?A+y:b+y;if(O===b&&P===A)return u;if(O>=P)return u.clear();for(var F=u._level,V=u._root,q=0;O+q<0;)V=new ui(V&&V.array.length?[void 0,V]:[],x),F+=M,q+=1<<F;q&&(O+=q,b+=q,P+=q,A+=q);for(var it=Wo(A),dt=Wo(P);dt>=1<<F+M;)V=new ui(V&&V.array.length?[V]:[],x),F+=M;var Tt=u._tail,Pt=dt<it?Ty(u,P-1):dt>it?new ui([],x):Tt;if(Tt&&dt>it&&O<A&&Tt.array.length){V=Ns(V,x);for(var ce=V,en=F;en>M;en-=M){var En=it>>>en&C;ce=ce.array[En]=Ns(ce.array[En],x)}ce.array[it>>>M&C]=Tt}if(P<A&&(Pt=Pt&&Pt.removeAfter(x,0,P)),O>=dt)O-=dt,P-=dt,F=M,V=null,Pt=Pt&&Pt.removeBefore(x,0,O);else if(O>b||dt<it){for(q=0;V;){var Cu=O>>>F&C;if(Cu!==dt>>>F&C)break;Cu&&(q+=(1<<F)*Cu),F-=M,V=V.array[Cu]}V&&O>b&&(V=V.removeBefore(x,F,O-q)),V&&dt<it&&(V=V.removeAfter(x,F,dt-q)),q&&(O-=q,P-=q)}return u.__ownerID?(u.size=P-O,u._origin=O,u._capacity=P,u._level=F,u._root=V,u._tail=Pt,u.__hash=void 0,u.__altered=!0,u):Go(O,P,F,V,Pt)}function Su(u,d,y){for(var x=[],b=0,A=0;A<y.length;A++){var O=y[A],P=o(O);P.size>b&&(b=P.size),l(O)||(P=P.map(function(F){return Cr(F)})),x.push(P)}return b>u.size&&(u=u.setSize(b)),by(u,d,x)}function Wo(u){return u<T?0:u-1>>>M<<M}r(ye,nt);function ye(u){return u==null?Eu():Cy(u)?u:Eu().withMutations(function(d){var y=s(u);At(y.size),y.forEach(function(x,b){return d.set(b,x)})})}ye.of=function(){return this(arguments)},ye.prototype.toString=function(){return this.__toString("OrderedMap {","}")},ye.prototype.get=function(u,d){var y=this._map.get(u);return y!==void 0?this._list.get(y)[1]:d},ye.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this):Eu()},ye.prototype.set=function(u,d){return ky(this,u,d)},ye.prototype.remove=function(u){return ky(this,u,E)},ye.prototype.wasAltered=function(){return this._map.wasAltered()||this._list.wasAltered()},ye.prototype.__iterate=function(u,d){var y=this;return this._list.__iterate(function(x){return x&&u(x[1],x[0],y)},d)},ye.prototype.__iterator=function(u,d){return this._list.fromEntrySeq().__iterator(u,d)},ye.prototype.__ensureOwner=function(u){if(u===this.__ownerID)return this;var d=this._map.__ensureOwner(u),y=this._list.__ensureOwner(u);return u?Fh(d,y,u,this.__hash):(this.__ownerID=u,this._map=d,this._list=y,this)};function Cy(u){return Oe(u)&&g(u)}ye.isOrderedMap=Cy,ye.prototype[_]=!0,ye.prototype[S]=ye.prototype.remove;function Fh(u,d,y,x){var b=Object.create(ye.prototype);return b.size=u?u.size:0,b._map=u,b._list=d,b.__ownerID=y,b.__hash=x,b}var Iy;function Eu(){return Iy||(Iy=Fh(tn(),Rh()))}function ky(u,d,y){var x=u._map,b=u._list,A=x.get(d),O=A!==void 0,P,F;if(y===E){if(!O)return u;b.size>=T&&b.size>=x.size*2?(F=b.filter(function(V,q){return V!==void 0&&A!==q}),P=F.toKeyedSeq().map(function(V){return V[0]}).flip().toMap(),u.__ownerID&&(P.__ownerID=F.__ownerID=u.__ownerID)):(P=x.remove(d),F=A===b.size-1?b.pop():b.set(A,void 0))}else if(O){if(y===b.get(A)[1])return u;P=x,F=b.set(A,[d,y])}else P=x.set(d,b.size),F=b.set(b.size,[d,y]);return u.__ownerID?(u.size=P.size,u._map=P,u._list=F,u.__hash=void 0,u):Fh(P,F)}r(kr,Bt);function kr(u,d){this._iter=u,this._useKeys=d,this.size=u.size}kr.prototype.get=function(u,d){return this._iter.get(u,d)},kr.prototype.has=function(u){return this._iter.has(u)},kr.prototype.valueSeq=function(){return this._iter.valueSeq()},kr.prototype.reverse=function(){var u=this,d=Nh(this,!0);return this._useKeys||(d.valueSeq=function(){return u._iter.toSeq().reverse()}),d},kr.prototype.map=function(u,d){var y=this,x=Ry(this,u,d);return this._useKeys||(x.valueSeq=function(){return y._iter.toSeq().map(u,d)}),x},kr.prototype.__iterate=function(u,d){var y=this,x;return this._iter.__iterate(this._useKeys?function(b,A){return u(b,A,y)}:(x=d?Dy(this):0,function(b){return u(b,d?--x:x++,y)}),d)},kr.prototype.__iterator=function(u,d){if(this._useKeys)return this._iter.__iterator(u,d);var y=this._iter.__iterator(j,d),x=d?Dy(this):0;return new Z(function(){var b=y.next();return b.done?b:Q(u,d?--x:x++,b.value,b)})},kr.prototype[_]=!0,r(js,kt);function js(u){this._iter=u,this.size=u.size}js.prototype.includes=function(u){return this._iter.includes(u)},js.prototype.__iterate=function(u,d){var y=this,x=0;return this._iter.__iterate(function(b){return u(b,x++,y)},d)},js.prototype.__iterator=function(u,d){var y=this._iter.__iterator(j,d),x=0;return new Z(function(){var b=y.next();return b.done?b:Q(u,x++,b.value,b)})},r(Vs,Ct);function Vs(u){this._iter=u,this.size=u.size}Vs.prototype.has=function(u){return this._iter.includes(u)},Vs.prototype.__iterate=function(u,d){var y=this;return this._iter.__iterate(function(x){return u(x,x,y)},d)},Vs.prototype.__iterator=function(u,d){var y=this._iter.__iterator(j,d);return new Z(function(){var x=y.next();return x.done?x:Q(u,x.value,x.value,x)})},r(Ds,Bt);function Ds(u){this._iter=u,this.size=u.size}Ds.prototype.entrySeq=function(){return this._iter.toSeq()},Ds.prototype.__iterate=function(u,d){var y=this;return this._iter.__iterate(function(x){if(x){Vy(x);var b=l(x);return u(b?x.get(1):x[1],b?x.get(0):x[0],y)}},d)},Ds.prototype.__iterator=function(u,d){var y=this._iter.__iterator(j,d);return new Z(function(){for(;;){var x=y.next();if(x.done)return x;var b=x.value;if(b){Vy(b);var A=l(b);return Q(u,A?b.get(0):b[0],A?b.get(1):b[1],x)}}})},js.prototype.cacheResult=kr.prototype.cacheResult=Vs.prototype.cacheResult=Ds.prototype.cacheResult=Dh;function Py(u){var d=bn(u);return d._iter=u,d.size=u.size,d.flip=function(){return u},d.reverse=function(){var y=u.reverse.apply(this);return y.flip=function(){return u.reverse()},y},d.has=function(y){return u.includes(y)},d.includes=function(y){return u.has(y)},d.cacheResult=Dh,d.__iterateUncached=function(y,x){var b=this;return u.__iterate(function(A,O){return y(O,A,b)!==!1},x)},d.__iteratorUncached=function(y,x){if(y===W){var b=u.__iterator(y,x);return new Z(function(){var A=b.next();if(!A.done){var O=A.value[0];A.value[0]=A.value[1],A.value[1]=O}return A})}return u.__iterator(y===j?St:j,x)},d}function Ry(u,d,y){var x=bn(u);return x.size=u.size,x.has=function(b){return u.has(b)},x.get=function(b,A){var O=u.get(b,E);return O===E?A:d.call(y,O,b,u)},x.__iterateUncached=function(b,A){var O=this;return u.__iterate(function(P,F,V){return b(d.call(y,P,F,V),F,O)!==!1},A)},x.__iteratorUncached=function(b,A){var O=u.__iterator(W,A);return new Z(function(){var P=O.next();if(P.done)return P;var F=P.value,V=F[0];return Q(b,V,d.call(y,F[1],V,u),P)})},x}function Nh(u,d){var y=bn(u);return y._iter=u,y.size=u.size,y.reverse=function(){return u},u.flip&&(y.flip=function(){var x=Py(u);return x.reverse=function(){return u.flip()},x}),y.get=function(x,b){return u.get(d?x:-1-x,b)},y.has=function(x){return u.has(d?x:-1-x)},y.includes=function(x){return u.includes(x)},y.cacheResult=Dh,y.__iterate=function(x,b){var A=this;return u.__iterate(function(O,P){return x(O,P,A)},!b)},y.__iterator=function(x,b){return u.__iterator(x,!b)},y}function Ly(u,d,y,x){var b=bn(u);return x&&(b.has=function(A){var O=u.get(A,E);return O!==E&&!!d.call(y,O,A,u)},b.get=function(A,O){var P=u.get(A,E);return P!==E&&d.call(y,P,A,u)?P:O}),b.__iterateUncached=function(A,O){var P=this,F=0;return u.__iterate(function(V,q,it){if(d.call(y,V,q,it))return F++,A(V,x?q:F-1,P)},O),F},b.__iteratorUncached=function(A,O){var P=u.__iterator(W,O),F=0;return new Z(function(){for(;;){var V=P.next();if(V.done)return V;var q=V.value,it=q[0],dt=q[1];if(d.call(y,dt,it,u))return Q(A,x?it:F++,dt,V)}})},b}function gE(u,d,y){var x=nt().asMutable();return u.__iterate(function(b,A){x.update(d.call(y,b,A,u),0,function(O){return O+1})}),x.asImmutable()}function mE(u,d,y){var x=c(u),b=(g(u)?ye():nt()).asMutable();u.__iterate(function(O,P){b.update(d.call(y,O,P,u),function(F){return F=F||[],F.push(x?[P,O]:O),F})});var A=By(u);return b.map(function(O){return Zt(u,A(O))})}function jh(u,d,y,x){var b=u.size;if(d!==void 0&&(d=d|0),y!==void 0&&(y===1/0?y=b:y=y|0),xt(d,y,b))return u;var A=yt(d,b),O=ht(y,b);if(A!==A||O!==O)return jh(u.toSeq().cacheResult(),d,y,x);var P=O-A,F;P===P&&(F=P<0?0:P);var V=bn(u);return V.size=F===0?F:u.size&&F||void 0,!x&&Le(u)&&F>=0&&(V.get=function(q,it){return q=tt(this,q),q>=0&&q<F?u.get(q+A,it):it}),V.__iterateUncached=function(q,it){var dt=this;if(F===0)return 0;if(it)return this.cacheResult().__iterate(q,it);var Tt=0,Pt=!0,ce=0;return u.__iterate(function(en,En){if(!(Pt&&(Pt=Tt++<A)))return ce++,q(en,x?En:ce-1,dt)!==!1&&ce!==F}),ce},V.__iteratorUncached=function(q,it){if(F!==0&&it)return this.cacheResult().__iterator(q,it);var dt=F!==0&&u.__iterator(q,it),Tt=0,Pt=0;return new Z(function(){for(;Tt++<A;)dt.next();if(++Pt>F)return U();var ce=dt.next();return x||q===j?ce:q===St?Q(q,Pt-1,void 0,ce):Q(q,Pt-1,ce.value[1],ce)})},V}function yE(u,d,y){var x=bn(u);return x.__iterateUncached=function(b,A){var O=this;if(A)return this.cacheResult().__iterate(b,A);var P=0;return u.__iterate(function(F,V,q){return d.call(y,F,V,q)&&++P&&b(F,V,O)}),P},x.__iteratorUncached=function(b,A){var O=this;if(A)return this.cacheResult().__iterator(b,A);var P=u.__iterator(W,A),F=!0;return new Z(function(){if(!F)return U();var V=P.next();if(V.done)return V;var q=V.value,it=q[0],dt=q[1];return d.call(y,dt,it,O)?b===W?V:Q(b,it,dt,V):(F=!1,U())})},x}function Fy(u,d,y,x){var b=bn(u);return b.__iterateUncached=function(A,O){var P=this;if(O)return this.cacheResult().__iterate(A,O);var F=!0,V=0;return u.__iterate(function(q,it,dt){if(!(F&&(F=d.call(y,q,it,dt))))return V++,A(q,x?it:V-1,P)}),V},b.__iteratorUncached=function(A,O){var P=this;if(O)return this.cacheResult().__iterator(A,O);var F=u.__iterator(W,O),V=!0,q=0;return new Z(function(){var it,dt,Tt;do{if(it=F.next(),it.done)return x||A===j?it:A===St?Q(A,q++,void 0,it):Q(A,q++,it.value[1],it);var Pt=it.value;dt=Pt[0],Tt=Pt[1],V&&(V=d.call(y,Tt,dt,P))}while(V);return A===W?it:Q(A,dt,Tt,it)})},b}function vE(u,d){var y=c(u),x=[u].concat(d).map(function(O){return l(O)?y&&(O=s(O)):O=y?_n(O):Bn(Array.isArray(O)?O:[O]),O}).filter(function(O){return O.size!==0});if(x.length===0)return u;if(x.length===1){var b=x[0];if(b===u||y&&c(b)||h(u)&&h(b))return b}var A=new gt(x);return y?A=A.toKeyedSeq():h(u)||(A=A.toSetSeq()),A=A.flatten(!0),A.size=x.reduce(function(O,P){if(O!==void 0){var F=P.size;if(F!==void 0)return O+F}},0),A}function Ny(u,d,y){var x=bn(u);return x.__iterateUncached=function(b,A){var O=0,P=!1;function F(V,q){var it=this;V.__iterate(function(dt,Tt){return(!d||q<d)&&l(dt)?F(dt,q+1):b(dt,y?Tt:O++,it)===!1&&(P=!0),!P},A)}return F(u,0),O},x.__iteratorUncached=function(b,A){var O=u.__iterator(b,A),P=[],F=0;return new Z(function(){for(;O;){var V=O.next();if(V.done!==!1){O=P.pop();continue}var q=V.value;if(b===W&&(q=q[1]),(!d||P.length<d)&&l(q))P.push(O),O=q.__iterator(b,A);else return y?V:Q(b,F++,q,V)}return U()})},x}function xE(u,d,y){var x=By(u);return u.toSeq().map(function(b,A){return x(d.call(y,b,A,u))}).flatten(!0)}function _E(u,d){var y=bn(u);return y.size=u.size&&u.size*2-1,y.__iterateUncached=function(x,b){var A=this,O=0;return u.__iterate(function(P,F){return(!O||x(d,O++,A)!==!1)&&x(P,O++,A)!==!1},b),O},y.__iteratorUncached=function(x,b){var A=u.__iterator(j,b),O=0,P;return new Z(function(){return(!P||O%2)&&(P=A.next(),P.done)?P:O%2?Q(x,O++,d):Q(x,O++,P.value,P)})},y}function Bs(u,d,y){d||(d=qy);var x=c(u),b=0,A=u.toSeq().map(function(O,P){return[P,O,b++,y?y(O,P,u):O]}).toArray();return A.sort(function(O,P){return d(O[3],P[3])||O[2]-P[2]}).forEach(x?function(O,P){A[P].length=2}:function(O,P){A[P]=O[1]}),x?Bt(A):h(u)?kt(A):Ct(A)}function Mu(u,d,y){if(d||(d=qy),y){var x=u.toSeq().map(function(b,A){return[b,y(b,A,u)]}).reduce(function(b,A){return jy(d,b[1],A[1])?A:b});return x&&x[0]}else return u.reduce(function(b,A){return jy(d,b,A)?A:b})}function jy(u,d,y){var x=u(y,d);return x===0&&y!==d&&(y==null||y!==y)||x>0}function Vh(u,d,y){var x=bn(u);return x.size=new gt(y).map(function(b){return b.size}).min(),x.__iterate=function(b,A){for(var O=this.__iterator(j,A),P,F=0;!(P=O.next()).done&&b(P.value,F++,this)!==!1;);return F},x.__iteratorUncached=function(b,A){var O=y.map(function(V){return V=i(V),B(A?V.reverse():V)}),P=0,F=!1;return new Z(function(){var V;return F||(V=O.map(function(q){return q.next()}),F=V.some(function(q){return q.done})),F?U():Q(b,P++,d.apply(null,V.map(function(q){return q.value})))})},x}function Zt(u,d){return Le(u)?d:u.constructor(d)}function Vy(u){if(u!==Object(u))throw new TypeError("Expected [K, V] tuple: "+u)}function Dy(u){return At(u.size),at(u)}function By(u){return c(u)?s:h(u)?o:a}function bn(u){return Object.create((c(u)?Bt:h(u)?kt:Ct).prototype)}function Dh(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):Ot.prototype.cacheResult.call(this)}function qy(u,d){return u>d?1:u<d?-1:0}function $y(u){var d=B(u);if(!d){if(!H(u))throw new TypeError("Expected iterable or array-like: "+u);d=B(i(u))}return d}r(yr,oi);function yr(u,d){var y,x=function(O){if(O instanceof x)return O;if(!(this instanceof x))return new x(O);if(!y){y=!0;var P=Object.keys(u);bE(b,P),b.size=P.length,b._name=d,b._keys=P,b._defaultValues=u}this._map=nt(O)},b=x.prototype=Object.create(Fe);return b.constructor=x,x}yr.prototype.toString=function(){return this.__toString(Hy(this)+" {","}")},yr.prototype.has=function(u){return this._defaultValues.hasOwnProperty(u)},yr.prototype.get=function(u,d){if(!this.has(u))return d;var y=this._defaultValues[u];return this._map?this._map.get(u,y):y},yr.prototype.clear=function(){if(this.__ownerID)return this._map&&this._map.clear(),this;var u=this.constructor;return u._empty||(u._empty=Au(this,tn()))},yr.prototype.set=function(u,d){if(!this.has(u))throw new Error('Cannot set unknown key "'+u+'" on '+Hy(this));if(this._map&&!this._map.has(u)){var y=this._defaultValues[u];if(d===y)return this}var x=this._map&&this._map.set(u,d);return this.__ownerID||x===this._map?this:Au(this,x)},yr.prototype.remove=function(u){if(!this.has(u))return this;var d=this._map&&this._map.remove(u);return this.__ownerID||d===this._map?this:Au(this,d)},yr.prototype.wasAltered=function(){return this._map.wasAltered()},yr.prototype.__iterator=function(u,d){var y=this;return s(this._defaultValues).map(function(x,b){return y.get(b)}).__iterator(u,d)},yr.prototype.__iterate=function(u,d){var y=this;return s(this._defaultValues).map(function(x,b){return y.get(b)}).__iterate(u,d)},yr.prototype.__ensureOwner=function(u){if(u===this.__ownerID)return this;var d=this._map&&this._map.__ensureOwner(u);return u?Au(this,d,u):(this.__ownerID=u,this._map=d,this)};var Fe=yr.prototype;Fe[S]=Fe.remove,Fe.deleteIn=Fe.removeIn=mt.removeIn,Fe.merge=mt.merge,Fe.mergeWith=mt.mergeWith,Fe.mergeIn=mt.mergeIn,Fe.mergeDeep=mt.mergeDeep,Fe.mergeDeepWith=mt.mergeDeepWith,Fe.mergeDeepIn=mt.mergeDeepIn,Fe.setIn=mt.setIn,Fe.update=mt.update,Fe.updateIn=mt.updateIn,Fe.withMutations=mt.withMutations,Fe.asMutable=mt.asMutable,Fe.asImmutable=mt.asImmutable;function Au(u,d,y){var x=Object.create(Object.getPrototypeOf(u));return x._map=d,x.__ownerID=y,x}function Hy(u){return u._name||u.constructor.name||"Record"}function bE(u,d){try{d.forEach(wE.bind(void 0,u))}catch{}}function wE(u,d){Object.defineProperty(u,d,{get:function(){return this.get(d)},set:function(y){Ri(this.__ownerID,"Cannot set on an immutable record."),this.set(d,y)}})}r(le,Fi);function le(u){return u==null?$h():Bh(u)&&!g(u)?u:$h().withMutations(function(d){var y=a(u);At(y.size),y.forEach(function(x){return d.add(x)})})}le.of=function(){return this(arguments)},le.fromKeys=function(u){return this(s(u).keySeq())},le.prototype.toString=function(){return this.__toString("Set {","}")},le.prototype.has=function(u){return this._map.has(u)},le.prototype.add=function(u){return qh(this,this._map.set(u,!0))},le.prototype.remove=function(u){return qh(this,this._map.remove(u))},le.prototype.clear=function(){return qh(this,this._map.clear())},le.prototype.union=function(){var u=e.call(arguments,0);return u=u.filter(function(d){return d.size!==0}),u.length===0?this:this.size===0&&!this.__ownerID&&u.length===1?this.constructor(u[0]):this.withMutations(function(d){for(var y=0;y<u.length;y++)a(u[y]).forEach(function(x){return d.add(x)})})},le.prototype.intersect=function(){var u=e.call(arguments,0);if(u.length===0)return this;u=u.map(function(y){return a(y)});var d=this;return this.withMutations(function(y){d.forEach(function(x){u.every(function(b){return b.includes(x)})||y.remove(x)})})},le.prototype.subtract=function(){var u=e.call(arguments,0);if(u.length===0)return this;u=u.map(function(y){return a(y)});var d=this;return this.withMutations(function(y){d.forEach(function(x){u.some(function(b){return b.includes(x)})&&y.remove(x)})})},le.prototype.merge=function(){return this.union.apply(this,arguments)},le.prototype.mergeWith=function(u){var d=e.call(arguments,1);return this.union.apply(this,d)},le.prototype.sort=function(u){return wn(Bs(this,u))},le.prototype.sortBy=function(u,d){return wn(Bs(this,d,u))},le.prototype.wasAltered=function(){return this._map.wasAltered()},le.prototype.__iterate=function(u,d){var y=this;return this._map.__iterate(function(x,b){return u(b,b,y)},d)},le.prototype.__iterator=function(u,d){return this._map.map(function(y,x){return x}).__iterator(u,d)},le.prototype.__ensureOwner=function(u){if(u===this.__ownerID)return this;var d=this._map.__ensureOwner(u);return u?this.__make(d,u):(this.__ownerID=u,this._map=d,this)};function Bh(u){return!!(u&&u[Gy])}le.isSet=Bh;var Gy="@@__IMMUTABLE_SET__@@",vr=le.prototype;vr[Gy]=!0,vr[S]=vr.remove,vr.mergeDeep=vr.merge,vr.mergeDeepWith=vr.mergeWith,vr.withMutations=mt.withMutations,vr.asMutable=mt.asMutable,vr.asImmutable=mt.asImmutable,vr.__empty=$h,vr.__make=Wy;function qh(u,d){return u.__ownerID?(u.size=d.size,u._map=d,u):d===u._map?u:d.size===0?u.__empty():u.__make(d)}function Wy(u,d){var y=Object.create(vr);return y.size=u?u.size:0,y._map=u,y.__ownerID=d,y}var Uy;function $h(){return Uy||(Uy=Wy(tn()))}r(wn,le);function wn(u){return u==null?Hh():Yy(u)?u:Hh().withMutations(function(d){var y=a(u);At(y.size),y.forEach(function(x){return d.add(x)})})}wn.of=function(){return this(arguments)},wn.fromKeys=function(u){return this(s(u).keySeq())},wn.prototype.toString=function(){return this.__toString("OrderedSet {","}")};function Yy(u){return Bh(u)&&g(u)}wn.isOrderedSet=Yy;var Ou=wn.prototype;Ou[_]=!0,Ou.__empty=Hh,Ou.__make=Xy;function Xy(u,d){var y=Object.create(Ou);return y.size=u?u.size:0,y._map=u,y.__ownerID=d,y}var Jy;function Hh(){return Jy||(Jy=Xy(Eu()))}r(Se,ai);function Se(u){return u==null?Gh():Zy(u)?u:Gh().unshiftAll(u)}Se.of=function(){return this(arguments)},Se.prototype.toString=function(){return this.__toString("Stack [","]")},Se.prototype.get=function(u,d){var y=this._head;for(u=tt(this,u);y&&u--;)y=y.next;return y?y.value:d},Se.prototype.peek=function(){return this._head&&this._head.value},Se.prototype.push=function(){if(arguments.length===0)return this;for(var u=this.size+arguments.length,d=this._head,y=arguments.length-1;y>=0;y--)d={value:arguments[y],next:d};return this.__ownerID?(this.size=u,this._head=d,this.__hash=void 0,this.__altered=!0,this):Uo(u,d)},Se.prototype.pushAll=function(u){if(u=o(u),u.size===0)return this;At(u.size);var d=this.size,y=this._head;return u.reverse().forEach(function(x){d++,y={value:x,next:y}}),this.__ownerID?(this.size=d,this._head=y,this.__hash=void 0,this.__altered=!0,this):Uo(d,y)},Se.prototype.pop=function(){return this.slice(1)},Se.prototype.unshift=function(){return this.push.apply(this,arguments)},Se.prototype.unshiftAll=function(u){return this.pushAll(u)},Se.prototype.shift=function(){return this.pop.apply(this,arguments)},Se.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):Gh()},Se.prototype.slice=function(u,d){if(xt(u,d,this.size))return this;var y=yt(u,this.size),x=ht(d,this.size);if(x!==this.size)return ai.prototype.slice.call(this,u,d);for(var b=this.size-y,A=this._head;y--;)A=A.next;return this.__ownerID?(this.size=b,this._head=A,this.__hash=void 0,this.__altered=!0,this):Uo(b,A)},Se.prototype.__ensureOwner=function(u){return u===this.__ownerID?this:u?Uo(this.size,this._head,u,this.__hash):(this.__ownerID=u,this.__altered=!1,this)},Se.prototype.__iterate=function(u,d){if(d)return this.reverse().__iterate(u);for(var y=0,x=this._head;x&&u(x.value,y++,this)!==!1;)x=x.next;return y},Se.prototype.__iterator=function(u,d){if(d)return this.reverse().__iterator(u);var y=0,x=this._head;return new Z(function(){if(x){var b=x.value;return x=x.next,Q(u,y++,b)}return U()})};function Zy(u){return!!(u&&u[Ky])}Se.isStack=Zy;var Ky="@@__IMMUTABLE_STACK__@@",qs=Se.prototype;qs[Ky]=!0,qs.withMutations=mt.withMutations,qs.asMutable=mt.asMutable,qs.asImmutable=mt.asImmutable,qs.wasAltered=mt.wasAltered;function Uo(u,d,y,x){var b=Object.create(qs);return b.size=u,b._head=d,b.__ownerID=y,b.__hash=x,b.__altered=!1,b}var Qy;function Gh(){return Qy||(Qy=Uo(0))}function Sn(u,d){var y=function(x){u.prototype[x]=d[x]};return Object.keys(d).forEach(y),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(d).forEach(y),u}i.Iterator=Z,Sn(i,{toArray:function(){At(this.size);var u=new Array(this.size||0);return this.valueSeq().__iterate(function(d,y){u[y]=d}),u},toIndexedSeq:function(){return new js(this)},toJS:function(){return this.toSeq().map(function(u){return u&&typeof u.toJS=="function"?u.toJS():u}).__toJS()},toJSON:function(){return this.toSeq().map(function(u){return u&&typeof u.toJSON=="function"?u.toJSON():u}).__toJS()},toKeyedSeq:function(){return new kr(this,!0)},toMap:function(){return nt(this.toKeyedSeq())},toObject:function(){At(this.size);var u={};return this.__iterate(function(d,y){u[y]=d}),u},toOrderedMap:function(){return ye(this.toKeyedSeq())},toOrderedSet:function(){return wn(c(this)?this.valueSeq():this)},toSet:function(){return le(c(this)?this.valueSeq():this)},toSetSeq:function(){return new Vs(this)},toSeq:function(){return h(this)?this.toIndexedSeq():c(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return Se(c(this)?this.valueSeq():this)},toList:function(){return ie(c(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(u,d){return this.size===0?u+d:u+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+d},concat:function(){var u=e.call(arguments,0);return Zt(this,vE(this,u))},includes:function(u){return this.some(function(d){return oe(d,u)})},entries:function(){return this.__iterator(W)},every:function(u,d){At(this.size);var y=!0;return this.__iterate(function(x,b,A){if(!u.call(d,x,b,A))return y=!1,!1}),y},filter:function(u,d){return Zt(this,Ly(this,u,d,!0))},find:function(u,d,y){var x=this.findEntry(u,d);return x?x[1]:y},forEach:function(u,d){return At(this.size),this.__iterate(d?u.bind(d):u)},join:function(u){At(this.size),u=u!==void 0?""+u:",";var d="",y=!0;return this.__iterate(function(x){y?y=!1:d+=u,d+=x!=null?x.toString():""}),d},keys:function(){return this.__iterator(St)},map:function(u,d){return Zt(this,Ry(this,u,d))},reduce:function(u,d,y){At(this.size);var x,b;return arguments.length<2?b=!0:x=d,this.__iterate(function(A,O,P){b?(b=!1,x=A):x=u.call(y,x,A,O,P)}),x},reduceRight:function(u,d,y){var x=this.toKeyedSeq().reverse();return x.reduce.apply(x,arguments)},reverse:function(){return Zt(this,Nh(this,!0))},slice:function(u,d){return Zt(this,jh(this,u,d,!0))},some:function(u,d){return!this.every(Tu(u),d)},sort:function(u){return Zt(this,Bs(this,u))},values:function(){return this.__iterator(j)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return this.size!==void 0?this.size===0:!this.some(function(){return!0})},count:function(u,d){return at(u?this.toSeq().filter(u,d):this)},countBy:function(u,d){return gE(this,u,d)},equals:function(u){return $n(this,u)},entrySeq:function(){var u=this;if(u._cache)return new gt(u._cache);var d=u.toSeq().map(EE).toIndexedSeq();return d.fromEntrySeq=function(){return u.toSeq()},d},filterNot:function(u,d){return this.filter(Tu(u),d)},findEntry:function(u,d,y){var x=y;return this.__iterate(function(b,A,O){if(u.call(d,b,A,O))return x=[A,b],!1}),x},findKey:function(u,d){var y=this.findEntry(u,d);return y&&y[0]},findLast:function(u,d,y){return this.toKeyedSeq().reverse().find(u,d,y)},findLastEntry:function(u,d,y){return this.toKeyedSeq().reverse().findEntry(u,d,y)},findLastKey:function(u,d){return this.toKeyedSeq().reverse().findKey(u,d)},first:function(){return this.find(bt)},flatMap:function(u,d){return Zt(this,xE(this,u,d))},flatten:function(u){return Zt(this,Ny(this,u,!0))},fromEntrySeq:function(){return new Ds(this)},get:function(u,d){return this.find(function(y,x){return oe(x,u)},void 0,d)},getIn:function(u,d){for(var y=this,x=$y(u),b;!(b=x.next()).done;){var A=b.value;if(y=y&&y.get?y.get(A,E):E,y===E)return d}return y},groupBy:function(u,d){return mE(this,u,d)},has:function(u){return this.get(u,E)!==E},hasIn:function(u){return this.getIn(u,E)!==E},isSubset:function(u){return u=typeof u.includes=="function"?u:i(u),this.every(function(d){return u.includes(d)})},isSuperset:function(u){return u=typeof u.isSubset=="function"?u:i(u),u.isSubset(this)},keyOf:function(u){return this.findKey(function(d){return oe(d,u)})},keySeq:function(){return this.toSeq().map(SE).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},lastKeyOf:function(u){return this.toKeyedSeq().reverse().keyOf(u)},max:function(u){return Mu(this,u)},maxBy:function(u,d){return Mu(this,d,u)},min:function(u){return Mu(this,u?t0(u):r0)},minBy:function(u,d){return Mu(this,d?t0(d):r0,u)},rest:function(){return this.slice(1)},skip:function(u){return this.slice(Math.max(0,u))},skipLast:function(u){return Zt(this,this.toSeq().reverse().skip(u).reverse())},skipWhile:function(u,d){return Zt(this,Fy(this,u,d,!0))},skipUntil:function(u,d){return this.skipWhile(Tu(u),d)},sortBy:function(u,d){return Zt(this,Bs(this,d,u))},take:function(u){return this.slice(0,Math.max(0,u))},takeLast:function(u){return Zt(this,this.toSeq().reverse().take(u).reverse())},takeWhile:function(u,d){return Zt(this,yE(this,u,d))},takeUntil:function(u,d){return this.takeWhile(Tu(u),d)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=AE(this))}});var Je=i.prototype;Je[p]=!0,Je[rt]=Je.values,Je.__toJS=Je.toArray,Je.__toStringMapper=e0,Je.inspect=Je.toSource=function(){return this.toString()},Je.chain=Je.flatMap,Je.contains=Je.includes,Sn(s,{flip:function(){return Zt(this,Py(this))},mapEntries:function(u,d){var y=this,x=0;return Zt(this,this.toSeq().map(function(b,A){return u.call(d,[A,b],x++,y)}).fromEntrySeq())},mapKeys:function(u,d){var y=this;return Zt(this,this.toSeq().flip().map(function(x,b){return u.call(d,x,b,y)}).flip())}});var zu=s.prototype;zu[m]=!0,zu[rt]=Je.entries,zu.__toJS=Je.toObject,zu.__toStringMapper=function(u,d){return JSON.stringify(d)+": "+e0(u)},Sn(o,{toKeyedSeq:function(){return new kr(this,!1)},filter:function(u,d){return Zt(this,Ly(this,u,d,!1))},findIndex:function(u,d){var y=this.findEntry(u,d);return y?y[0]:-1},indexOf:function(u){var d=this.keyOf(u);return d===void 0?-1:d},lastIndexOf:function(u){var d=this.lastKeyOf(u);return d===void 0?-1:d},reverse:function(){return Zt(this,Nh(this,!1))},slice:function(u,d){return Zt(this,jh(this,u,d,!1))},splice:function(u,d){var y=arguments.length;if(d=Math.max(d|0,0),y===0||y===2&&!d)return this;u=yt(u,u<0?this.count():this.size);var x=this.slice(0,u);return Zt(this,y===1?x:x.concat(J(arguments,2),this.slice(u+d)))},findLastIndex:function(u,d){var y=this.findLastEntry(u,d);return y?y[0]:-1},first:function(){return this.get(0)},flatten:function(u){return Zt(this,Ny(this,u,!1))},get:function(u,d){return u=tt(this,u),u<0||this.size===1/0||this.size!==void 0&&u>this.size?d:this.find(function(y,x){return x===u},void 0,d)},has:function(u){return u=tt(this,u),u>=0&&(this.size!==void 0?this.size===1/0||u<this.size:this.indexOf(u)!==-1)},interpose:function(u){return Zt(this,_E(this,u))},interleave:function(){var u=[this].concat(J(arguments)),d=Vh(this.toSeq(),kt.of,u),y=d.flatten(!0);return d.size&&(y.size=d.size*u.length),Zt(this,y)},keySeq:function(){return ae(0,this.size)},last:function(){return this.get(-1)},skipWhile:function(u,d){return Zt(this,Fy(this,u,d,!1))},zip:function(){var u=[this].concat(J(arguments));return Zt(this,Vh(this,ME,u))},zipWith:function(u){var d=J(arguments);return d[0]=this,Zt(this,Vh(this,u,d))}}),o.prototype[v]=!0,o.prototype[_]=!0,Sn(a,{get:function(u,d){return this.has(u)?u:d},includes:function(u){return this.has(u)},keySeq:function(){return this.valueSeq()}}),a.prototype.has=Je.includes,a.prototype.contains=a.prototype.includes,Sn(Bt,s.prototype),Sn(kt,o.prototype),Sn(Ct,a.prototype),Sn(oi,s.prototype),Sn(ai,o.prototype),Sn(Fi,a.prototype);function SE(u,d){return d}function EE(u,d){return[d,u]}function Tu(u){return function(){return!u.apply(this,arguments)}}function t0(u){return function(){return-u.apply(this,arguments)}}function e0(u){return typeof u=="string"?JSON.stringify(u):String(u)}function ME(){return J(arguments)}function r0(u,d){return u<d?1:u>d?-1:0}function AE(u){if(u.size===1/0)return 0;var d=g(u),y=c(u),x=d?1:0,b=u.__iterate(y?d?function(A,O){x=31*x+n0($e(A),$e(O))|0}:function(A,O){x=x+n0($e(A),$e(O))|0}:d?function(A){x=31*x+$e(A)|0}:function(A){x=x+$e(A)|0});return OE(b,x)}function OE(u,d){return d=Ni(d,3432918353),d=Ni(d<<15|d>>>-15,461845907),d=Ni(d<<13|d>>>-13,5),d=(d+3864292196|0)^u,d=Ni(d^d>>>16,2246822507),d=Ni(d^d>>>13,3266489909),d=Fs(d^d>>>16),d}function n0(u,d){return u^d+2654435769+(u<<6)+(u>>2)|0}var zE={Iterable:i,Seq:Ot,Collection:Ir,Map:nt,OrderedMap:ye,List:ie,Stack:Se,Set:le,OrderedSet:wn,Record:yr,Range:ae,Repeat:we,is:oe,fromJS:Cr};return zE})}(Sa)),Sa.exports}var Hl,Cd;function Gv(){if(Cd)return Hl;Cd=1;var n=$l(),t=function(i){return n.Iterable.isKeyed(i)},e=function(i){return n.Iterable.isIndexed(i)},r=function(i,s,o){return i==="remove"?{op:i,path:s}:{op:i,path:s,value:o}};return Hl={isMap:t,isIndexed:e,op:r},Hl}var Gl,Id;function Wv(){if(Id)return Gl;Id=1;var n=$l(),t=function(c,h,f){for(var g=[],p=0;p<c;p++){g[p]=new Array(h);for(var m=0;m<h;m++)g[p][m]=f}return g},e=function(c,h){var f=a(c,h);return l(c,h,f)},r=n.Record({op:"=",val:null}),i=n.Record({op:"!=",val:null,newVal:null}),s=function(c,h){var f=a(c,h);return o(f,c,h,c.size||0,h.size||0)},o=function(c,h,f,g,p){for(var m=[],v=g-1,_=p-1;v>=0||_>=0;)v>=0&&_>=0&&n.is(h.get(v),f.get(_))?(m.push(new r({op:"=",val:h.get(v)})),v-=1,_-=1):v>=0&&_>=0&&v===_&&!n.is(h.get(v),f.get(_))?(m.push(new i({val:h.get(v),newVal:f.get(v)})),v-=1,_-=1):_>=0&&(v===-1||c[v+1][_]>=c[v][_+1])?(m.push(new r({op:"+",val:f.get(_)})),_-=1):v>=0&&(_===-1||c[v+1][_]<c[v][_+1])&&(m.push(new r({op:"-",val:h.get(v)})),v-=1);return m.reverse()};function a(c,h){for(var f=c.size||0,g=h.size||0,p=t(f+1,g+1,0),m=0;m<f;m++)for(var v=0;v<g;v++)n.is(c.get(m),h.get(v))?p[m+1][v+1]=p[m][v]+1:p[m+1][v+1]=Math.max(p[m+1][v],p[m][v+1]);return p}var l=function(c,h,f){for(var g=[],p=c.size,m=h.size;p!==0&&m!==0;)f[p][m]===f[p-1][m]?p--:f[p][m]===f[p][m-1]?m--:n.is(c.get(p-1),h.get(m-1))&&(g.push(c.get(p-1)),p--,m--);return g.reverse()};return Gl={lcs:e,computeLcsMatrix:a,diff:s},Gl}var Wl,kd;function Uv(){if(kd)return Wl;kd=1;var n=new RegExp("/","g"),t=new RegExp("~1","g"),e=/~/g,r=/~0/g,i={escape:function(s){if(typeof s=="number")return s.toString();if(typeof s!="string")throw"param str ("+s+") is not a string";return s.replace(e,"~0").replace(n,"~1")},unescape:function(s){return typeof s=="string"?s.replace(t,"/").replace(r,"~"):s},concat:function(s,o){return s+"/"+o}};return Wl=i,Wl}var Ul,Pd;function Yv(){if(Pd)return Ul;Pd=1;var n=$l(),t=Gv(),e=Wv(),r=Uv(),i=r.concat,s=r.escape,o=t.op,a=t.isMap,l=t.isIndexed,c=function(p,m,v){var _=[],S=v||"";if(n.is(p,m)||p==m==null)return _;var M=l(p)&&l(m),T=null,C=null;return p.forEach&&p.forEach(function(E,z){if(m.has(z))if(a(E)&&a(m.get(z)))_=_.concat(c(E,m.get(z),i(S,s(z))));else if(l(m.get(z))&&l(E))_=_.concat(h(E,m.get(z),i(S,s(z))));else{var R=m.get?m.get(z):m,k=E!==R;k&&_.push(o("replace",i(S,s(z)),R))}else M?(C=T!=null&&T+1===z?C:z,_.push(o("remove",i(S,s(C)))),T=z):_.push(o("remove",i(S,s(z))))}),m.forEach(function(E,z){p.has&&!p.has(z)&&_.push(o("add",i(S,s(z)),E))}),_},h=function(p,m,v){var _=[],S=v||"";if(n.is(p,m)||p==m==null)return _;if((p.count()+1)*(m.count()+1)>=1e4)return c(p,m,v);var M=e.diff(p,m),T=0;return M.forEach(function(C){if(C.op==="=")T++;else if(C.op==="!="){if(a(C.val)&&a(C.newVal)){var E=c(C.val,C.newVal,i(S,T));_=_.concat(E)}else _.push(o("replace",i(S,T),C.newVal));T++}else C.op==="+"?(_.push(o("add",i(S,T),C.val)),T++):C.op==="-"&&_.push(o("remove",i(S,T)))}),_},f=function(p,m,v){var _=v||"";return p===m?[]:[o("replace",i(_,""),m)]},g=function(p,m,v){return n.is(p,m)?n.List():p!=m&&(p==null||m==null)?n.fromJS([o("replace","/",m)]):l(p)&&l(m)?n.fromJS(h(p,m)):a(p)&&a(m)?n.fromJS(c(p,m)):n.fromJS(f(p,m,v))};return Ul=g,Ul}var Xv=Yv();const Jv=rn(Xv),Zv=Wh(uv);var Yl,Rd;function Kv(){if(Rd)return Yl;Rd=1;var n=new RegExp("/","g"),t=new RegExp("~1","g"),e=/~/g,r=/~0/g,i={escape:function(s){if(typeof s!="string")throw"param str ("+s+") is not a string";return s.replace(e,"~0").replace(n,"~1")},unescape:function(s){return typeof s=="string"?s.replace(t,"/").replace(r,"~"):s}};return Yl=i,Yl}var Xl,Ld;function Qv(){if(Ld)return Xl;Ld=1;var n=Zv,t=Kv(),e=function(h){var f=parseInt(h);return isNaN(f)?h:f},r=function(h,f){if(h==="add"||h==="replace")return f;if(h==="remove")return null},i=function(h,f,g,p,m){if(p==="add")if(g.length>0&&h.get(f)===void 0){var v=g[0].match(/^\d+$/)?n.List():n.Map();return h.set(f,a(v,g,p,m))}else return h.set(f,a(h.get(f),g,p,m));else{if(p==="replace")return g.length>0?h.set(f,a(h.get(f),g,p,m)):h.set(f,m);if(p==="remove")return g.length>0?h.set(f,a(h.get(f),g,p,m)):h.remove(f);throw new Error("map patch Error, unknown op: "+p)}},s=function(h,f,g,p,m){if(f=e(f),p==="add")if(h.get(f)===void 0)if(g.length>0){var v=g[0].match(/^\d+$/)?n.List():n.Map();return h.set(f,a(v,g,p,m))}else return f==="-"?h.splice(h.size,0,m):h.splice(f,0,m);else return g.length>0?h.set(f,a(h.get(f),g,p,m)):h.splice(f,0,m);else{if(p==="replace")return g.length>0?h.set(f,a(h.get(f),g,p,m)):h.set(f,m);if(p==="remove")return g.length>0?h.set(f,a(h.get(f),g,p,m)):h.remove(f);throw new Error("sequence patch Error, unknown op: "+p)}},o=function(h){return h!=null&&typeof h.updateIn=="function"&&typeof h.set=="function"},a=function(h,f,g,p){var m,v;return n.Iterable.isIndexed(h)?f.length===0?h:(m=f[0],v=f.slice(1),s(h,m,v,g,p)):n.Iterable.isKeyed(h)||o(h)?f.length===0?h:(m=f[0],v=f.slice(1),i(h,m,v,g,p)):f.length===0?p:r(g,p)},l=function(h,f){for(;f.size;){var g=f.get(0),f=f.slice(1),p=g.get("path").split("/").slice(1).map(t.unescape);h=a(h,p,g.get("op"),g.get("value"))}return h},c=function(h,f){if(f.size===1){var g=f.get(0);if(g.get("op")==="replace"&&g.get("path")==="/")return g.get("value")}return l(h,f)};return c.default=c,Xl=c,Xl}var tx=Qv();const Fd=rn(tx),de=(n,t)=>{if(n.last){if(n.last.hashCode()!==t.hashCode()){let e=K({time:Date.now(),diff:Jv(n.last,t)});n=n.set("last",t).set("list",n.list.push(e)).set("redoList",n.redoList.clear())}}else n=n.set("last",t);return n},ex=n=>{if(n.last&&n.redoList.size){const t=n.redoList.last(),e=Fd(n.last,t.get("diff"));n=n.set("last",e).set("list",n.list.push(t)).set("redoList",n.redoList.pop())}return n},Nd=n=>{var t;if(n.last&&n.list.size){const e=n.list.last();let r=n.first;for(let i=0;i<n.list.size-1;i++)r=Fd(r,(t=n.list.get(i))==null?void 0:t.get("diff"));n=n.set("last",r).set("list",n.list.pop()).set("redoList",n.redoList.push(e))}return n};var Jl={exports:{}},Zl,jd;function rx(){if(jd)return Zl;jd=1;var n=1;function t(){return n=(n*9301+49297)%233280,n/233280}function e(r){n=r}return Zl={nextValue:t,seed:e},Zl}var Kl,Vd;function Ea(){if(Vd)return Kl;Vd=1;var n=rx(),t="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-",e,r,i;function s(){i=!1}function o(p){if(!p){e!==t&&(e=t,s());return}if(p!==e){if(p.length!==t.length)throw new Error("Custom alphabet for shortid must be "+t.length+" unique characters. You submitted "+p.length+" characters: "+p);var m=p.split("").filter(function(v,_,S){return _!==S.lastIndexOf(v)});if(m.length)throw new Error("Custom alphabet for shortid must be "+t.length+" unique characters. These characters were not unique: "+m.join(", "));e=p,s()}}function a(p){return o(p),e}function l(p){n.seed(p),r!==p&&(s(),r=p)}function c(){e||o(t);for(var p=e.split(""),m=[],v=n.nextValue(),_;p.length>0;)v=n.nextValue(),_=Math.floor(v*p.length),m.push(p.splice(_,1)[0]);return m.join("")}function h(){return i||(i=c(),i)}function f(p){var m=h();return m[p]}function g(){return e||t}return Kl={get:g,characters:a,seed:l,lookup:f,shuffled:h},Kl}var Ql,Dd;function nx(){if(Dd)return Ql;Dd=1;var n=typeof window=="object"&&(window.crypto||window.msCrypto),t;return!n||!n.getRandomValues?t=function(e){for(var r=[],i=0;i<e;i++)r.push(Math.floor(Math.random()*256));return r}:t=function(e){return n.getRandomValues(new Uint8Array(e))},Ql=t,Ql}let ix="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",Bd=n=>crypto.getRandomValues(new Uint8Array(n)),qd=(n,t,e)=>{let r=(2<<Math.log(n.length-1)/Math.LN2)-1,i=-~(1.6*r*t/n.length);return(s=t)=>{let o="";for(;;){let a=e(i),l=i|0;for(;l--;)if(o+=n[a[l]&r]||"",o.length===s)return o}}};const sx=Wh(Object.freeze(Object.defineProperty({__proto__:null,customAlphabet:(n,t=21)=>qd(n,t,Bd),customRandom:qd,nanoid:(n=21)=>crypto.getRandomValues(new Uint8Array(n)).reduce((t,e)=>(e&=63,e<36?t+=e.toString(36):e<62?t+=(e-26).toString(36).toUpperCase():e>62?t+="-":t+="_",t),""),random:Bd,urlAlphabet:ix},Symbol.toStringTag,{value:"Module"})));var tc,$d;function ox(){if($d)return tc;$d=1;var n=Ea(),t=nx(),e=sx.customRandom;function r(i){for(var s=0,o,a="";!o;)a=a+e(n.get(),1,t)(),o=i<Math.pow(16,s+1),s++;return a}return tc=r,tc}var ec,Hd;function ax(){if(Hd)return ec;Hd=1;var n=ox();Ea();var t=1567752802062,e=7,r,i;function s(o){var a="",l=Math.floor((Date.now()-t)*.001);return l===i?r++:(r=0,i=l),a=a+n(e),a=a+n(o),r>0&&(a=a+n(r)),a=a+n(l),a}return ec=s,ec}var rc,Gd;function ux(){if(Gd)return rc;Gd=1;var n=Ea();function t(e){if(!e||typeof e!="string"||e.length<6)return!1;var r=new RegExp("[^"+n.get().replace(/[|\\{}()[\]^$+*?.-]/g,"\\$&")+"]");return!r.test(e)}return rc=t,rc}var nc,Wd;function lx(){return Wd||(Wd=1,nc=0),nc}var Ud;function cx(){return Ud||(Ud=1,function(n){var t=Ea(),e=ax(),r=ux(),i=lx()||0;function s(c){return t.seed(c),n.exports}function o(c){return i=c,n.exports}function a(c){return c!==void 0&&t.characters(c),t.shuffled()}function l(){return e(i)}n.exports=l,n.exports.generate=l,n.exports.seed=s,n.exports.worker=o,n.exports.characters=a,n.exports.isValid=r}(Jl)),Jl.exports}var ic,Yd;function hx(){return Yd||(Yd=1,ic=cx()),ic}var fx=hx();const dx=rn(fx);class hn{static acquireID(){return dx.generate()}}class Ma{static generateName(t,e){return e.charAt(0).toUpperCase()+e.slice(1)}}class xe{static create(t,e,r,i,s,o){let a=hn.acquireID(),l=t.catalog.factoryElement(r,{id:a,name:Ma.generateName("holes",t.catalog.getIn(["elements",r,"info","title"])),type:r,offset:s,line:i},o);return t=t.setIn(["scene","layers",e,"holes",a],l),t=t.updateIn(["scene","layers",e,"lines",i,"holes"],c=>c.push(a)),{updatedState:t,hole:l}}static select(t,e,r){return t=wt.select(t,e).updatedState,t=wt.selectElement(t,e,"holes",r).updatedState,{updatedState:t}}static remove(t,e,r){let i=t.getIn(["scene","layers",e,"holes",r]);return t=this.unselect(t,e,r).updatedState,t=wt.removeElement(t,e,"holes",r).updatedState,t=t.updateIn(["scene","layers",e,"lines",i.line,"holes"],s=>{let o=s.findIndex(a=>r===a);return o!==-1?s.remove(o):s}),t.getIn(["scene","groups"]).forEach(s=>t=_e.removeElement(t,s.id,e,"holes",r).updatedState),{updatedState:t}}static unselect(t,e,r){return t=wt.unselect(t,e,"holes",r).updatedState,{updatedState:t}}static selectToolDrawingHole(t,e){let r=ut().withMutations(i=>{let{lines:s,vertices:o}=t.getIn(["scene","layers",t.scene.selectedLayer]);s.forEach(a=>{let{x:l,y:c}=o.get(a.vertices.get(0)),{x:h,y:f}=o.get(a.vertices.get(1));go(i,l,c,h,f,20,1,a.id)})});return t=t.merge({mode:ar,snapElements:r,drawingSupport:K({type:e})}),{updatedState:t}}static updateDrawingHole(t,e,r,i){let s=t.catalog,o=cn(t.snapElements,r,i,t.snapMask.merge({SNAP_SEGMENT:!0}));o&&({x:r,y:i}=o.point);let a=t.getIn(["scene","layers",e,"selected","holes"]).first();if(o){let l=o.snap.related.get(0),c=t.getIn(["scene","layers",e,"lines",l,"vertices"]),{x:h,y:f}=t.getIn(["scene","layers",e,"vertices",c.get(0)]),{x:g,y:p}=t.getIn(["scene","layers",e,"vertices",c.get(1)]),m=pa({x:h,y:f},{x:g,y:p}),v=Il({x:h,y:f},{x:g,y:p}),_=s.factoryElement(t.drawingSupport.get("type")).properties.getIn(["width","length"]),S=Ve(h,f,g,p),M=yv(h,f,g,p),T=xv(M,1e-7),C=_v(M,1e-7),E={x:m.x+_/2*T,y:m.y+_/2*C},z={x:m.x+S*T-_/2*T,y:m.y+S*C-_/2*C},R;if(r<E.x?R=De(m.x,m.y,v.x,v.y,E.x,E.y):r>z.x?R=De(m.x,m.y,v.x,v.y,z.x,z.y):r===E.x&&r===z.x?i<E.y?(R=De(m.x,m.y,v.x,v.y,E.x,E.y),R=m.x===h&&m.y===f?R:1-R):i>z.y?(R=De(m.x,m.y,v.x,v.y,z.x,z.y),R=m.x===h&&m.y===f?R:1-R):R=De(h,f,g,p,r,i):R=De(h,f,g,p,r,i),a&&o){t=t.mergeIn(["scene","layers",e,"holes",a],{offset:R,line:l});let k=t.getIn(["scene","layers",e,"lines"]).findEntry(X=>X.id!==l&&X.get("holes").contains(a));if(k){let X=k[1].get("holes").filter(J=>J!==a);t=t.setIn(["scene","layers",e,"lines",k[0],"holes"],X)}let L=t.getIn(["scene","layers",e,"lines",l,"holes"]);L.contains(a)||(t=t.setIn(["scene","layers",e,"lines",l,"holes"],L.push(a)))}else if(!a&&o){let{updatedState:k,hole:L}=this.create(t,e,t.drawingSupport.get("type"),l,R);t=xe.select(k,e,L.id).updatedState}}return{updatedState:t}}static endDrawingHole(t,e,r,i){return t=this.updateDrawingHole(t,e,r,i).updatedState,t=wt.unselectAll(t,e).updatedState,{updatedState:t}}static beginDraggingHole(t,e,r,i,s){let o=t.getIn(["scene","layers",e]),a=o.getIn(["holes",r]),l=o.getIn(["lines",a.line]),c=o.getIn(["vertices",l.vertices.get(0)]),h=o.getIn(["vertices",l.vertices.get(1)]),f=go(ut(),c.x,c.y,h.x,h.y,9999999,1,null);return t=t.merge({mode:Vr,snapElements:f,draggingSupport:K({layerID:e,holeID:r,startPointX:i,startPointY:s})}),{updatedState:t}}static updateDraggingHole(t,e,r){let i=cn(t.snapElements,e,r,t.snapMask.merge({SNAP_SEGMENT:!0}));if(!i)return t;let{draggingSupport:s,scene:o}=t,a=s.get("layerID"),l=s.get("holeID"),c=t.getIn(["scene","layers",a]),h=c.getIn(["holes",l]),f=c.getIn(["lines",h.line]),g=c.getIn(["vertices",f.vertices.get(0)]),p=c.getIn(["vertices",f.vertices.get(1)]);({x:e,y:r}=i.point);let m=pa(g,p),v=Il(g,p),_=h.properties.get("width").get("length"),S=Ve(g.x,g.y,p.x,p.y),M=Math.atan2(Math.abs(p.y-g.y),Math.abs(p.x-g.x)),T=X=>{let J=Math.cos(X);return J<1e-7?0:J},C=X=>{let J=Math.sin(X);return J<1e-7?0:J},E=T(M),z=C(M),R={x:m.x+_/2*E,y:m.y+_/2*z},k={x:m.x+S*E-_/2*E,y:m.y+S*z-_/2*z},L;return e<R.x?L=De(m.x,m.y,v.x,v.y,R.x,R.y):e>k.x?L=De(m.x,m.y,v.x,v.y,k.x,k.y):e===R.x&&e===k.x?r<R.y?(L=De(m.x,m.y,v.x,v.y,R.x,R.y),L=m===g?L:1-L):r>k.y?(L=De(m.x,m.y,v.x,v.y,k.x,k.y),L=m===g?L:1-L):(L=De(m.x,m.y,v.x,v.y,e,r),L=m===g?L:1-L):L=De(m.x,m.y,v.x,v.y,e,r),h=h.set("offset",L),t=t.merge({scene:o.mergeIn(["layers",a,"holes",l],h)}),{updatedState:t}}static endDraggingHole(t,e,r){return t=this.updateDraggingHole(t,e,r).updatedState,t=t.merge({mode:fe}),{updatedState:t}}static setProperties(t,e,r,i){return t=t.setIn(["scene","layers",e,"holes",r,"properties"],i),{updatedState:t}}static setJsProperties(t,e,r,i){return this.setProperties(t,e,r,Xt(i))}static updateProperties(t,e,r,i){return i.forEach((s,o)=>{t.hasIn(["scene","layers",e,"holes",r,"properties",o])&&(t=t.mergeIn(["scene","layers",e,"holes",r,"properties",o],s))}),{updatedState:t}}static updateJsProperties(t,e,r,i){return this.updateProperties(t,e,r,Xt(i))}static setAttributes(t,e,r,i){let s=i.toJS(),{offsetA:o,offsetB:a,offset:l}=s;delete s.offsetA,delete s.offsetB,delete s.offset;let c=K({_unitA:o._unit,_unitB:a._unit});return t=t.mergeIn(["scene","layers",e,"holes",r],Xt(s)).mergeDeepIn(["scene","layers",e,"holes",r],K({offset:l,misc:c})),{updatedState:t}}}let Me=class i0{static create(t,e,r,i,s,o,a,l){let c=hn.acquireID(),h=t.catalog.factoryElement(r,{id:c,name:Ma.generateName("items",t.catalog.getIn(["elements",r,"info","title"])),type:r,height:a,width:o,x:i,y:s,rotation:l});return t=t.setIn(["scene","layers",e,"items",c],h),{updatedState:t,item:h}}static select(t,e,r){return t=wt.select(t,e).updatedState,t=wt.selectElement(t,e,"items",r).updatedState,{updatedState:t}}static remove(t,e,r){return t=this.unselect(t,e,r).updatedState,t=wt.removeElement(t,e,"items",r).updatedState,t.getIn(["scene","groups"]).forEach(i=>t=_e.removeElement(t,i.id,e,"items",r).updatedState),{updatedState:t}}static unselect(t,e,r){return t=wt.unselect(t,e,"items",r).updatedState,{updatedState:t}}static selectToolDrawingItem(t,e){return t=t.merge({mode:Sr,drawingSupport:K({type:e})}),{updatedState:t}}static updateDrawingItem(t,e,r,i){if(t.hasIn(["drawingSupport","currentID"]))t=t.updateIn(["scene","layers",e,"items",t.getIn(["drawingSupport","currentID"])],s=>s.merge({x:r,y:i}));else{let{updatedState:s,item:o}=this.create(t,e,t.getIn(["drawingSupport","type"]),r,i,200,100,0);t=i0.select(s,e,o.id).updatedState,t=t.setIn(["drawingSupport","currentID"],o.id)}return{updatedState:t}}static endDrawingItem(t,e,r,i){return t=this.updateDrawingItem(t,e,r,i).updatedState,t=wt.unselectAll(t,e).updatedState,t=t.merge({drawingSupport:K({type:t.drawingSupport.get("type")})}),{updatedState:t}}static beginDraggingItem(t,e,r,i,s){let o=t.getIn(["scene","layers",e,"items",r]);return t=t.merge({mode:jr,draggingSupport:K({layerID:e,itemID:r,startPointX:i,startPointY:s,originalX:o.x,originalY:o.y})}),{updatedState:t}}static updateDraggingItem(t,e,r){let{draggingSupport:i,scene:s}=t,o=i.get("layerID"),a=i.get("itemID"),l=i.get("startPointX"),c=i.get("startPointY"),h=i.get("originalX"),f=i.get("originalY"),g=l-e,p=c-r,m=s.getIn(["layers",o,"items",a]);return m=m.merge({x:h-g,y:f-p}),t=t.merge({scene:s.mergeIn(["layers",o,"items",a],m)}),{updatedState:t}}static endDraggingItem(t,e,r){return t=this.updateDraggingItem(t,e,r).updatedState,t=t.merge({mode:fe}),{updatedState:t}}static beginRotatingItem(t,e,r,i,s){return t=t.merge({mode:An,rotatingSupport:K({layerID:e,itemID:r})}),{updatedState:t}}static updateRotatingItem(t,e,r){let{rotatingSupport:i,scene:s}=t,o=i.get("layerID"),a=i.get("itemID"),l=t.getIn(["scene","layers",o,"items",a]),c=e-l.x,h=r-l.y,f=Math.atan2(h,c)*180/Math.PI-90;return-5<f&&f<5&&(f=0),-95<f&&f<-85&&(f=-90),-185<f&&f<-175&&(f=-180),85<f&&f<90&&(f=90),-270<f&&f<-265&&(f=90),l=l.merge({rotation:f}),t=t.merge({scene:s.mergeIn(["layers",o,"items",a],l)}),{updatedState:t}}static endRotatingItem(t,e,r){return t=this.updateRotatingItem(t,e,r).updatedState,t=t.merge({mode:fe}),{updatedState:t}}static setProperties(t,e,r,i){return t=t.mergeIn(["scene","layers",e,"items",r,"properties"],i),{updatedState:t}}static setJsProperties(t,e,r,i){return this.setProperties(t,e,r,Xt(i))}static updateProperties(t,e,r,i){return i.forEach((s,o)=>{t.hasIn(["scene","layers",e,"items",r,"properties",o])&&(t=t.mergeIn(["scene","layers",e,"items",r,"properties",o],s))}),{updatedState:t}}static updateJsProperties(t,e,r,i){return this.updateProperties(t,e,r,Xt(i))}static setAttributes(t,e,r,i){return t=t.mergeIn(["scene","layers",e,"items",r],i),{updatedState:t}}static setJsAttributes(t,e,r,i){return i=Xt(i),this.setAttributes(t,e,r,i)}},_e=class Iu{static select(t,e){let r=t.getIn(["scene","groups",e,"elements"]);t=Jt.setAlterate(t).updatedState,r.entrySeq().forEach(([s,o])=>{t=wt.unselectAll(t,s).updatedState;let a=o.get("lines"),l=o.get("holes"),c=o.get("items"),h=o.get("areas");a&&a.forEach(f=>{t=Ie.select(t,s,f).updatedState}),l&&l.forEach(f=>{t=xe.select(t,s,f).updatedState}),c&&c.forEach(f=>{t=Me.select(t,s,f).updatedState}),h&&h.forEach(f=>{t=xi.select(t,s,f).updatedState})}),t=Jt.setAlterate(t).updatedState;let i=t.getIn(["scene","groups"]).map(s=>s.set("selected",!1));return t=t.setIn(["scene","groups"],i).setIn(["scene","groups",e,"selected"],!0),{updatedState:t}}static unselect(t,e){return t=t.getIn(["scene","groups",e,"elements"]).reduce((s,o,a)=>wt.unselectAll(s,a).updatedState,t).setIn(["scene","groups",e,"selected"],!1),{updatedState:t}}static create(t){let e=hn.acquireID();return t=t.setIn(["scene","groups",e],new Dl({id:e,name:e})),{updatedState:t}}static createFromSelectedElements(t){let e=hn.acquireID();return t=t.setIn(["scene","groups",e],new Dl({id:e,name:e})),t.getIn(["scene","layers"]).forEach(r=>{let i=r.get("id"),s={lines:r.get("lines").filter(o=>o.get("selected")),items:r.get("items").filter(o=>o.get("selected")),holes:r.get("holes").filter(o=>o.get("selected")),areas:r.get("areas").filter(o=>o.get("selected"))};for(let o in s)s[o].forEach(a=>t=this.addElement(t,e,i,o,a.get("id")).updatedState)}),{updatedState:t}}static addElement(t,e,r,i,s){let o=t.getIn(["scene","groups",e,"elements",r,i])||ut();return o.contains(s)||(t=t.setIn(["scene","groups",e,"elements",r,i],o.push(s)),t=this.reloadBaricenter(t,e).updatedState),{updatedState:t}}static setBarycenter(t,e,r,i){return typeof r<"u"&&(t=t.setIn(["scene","groups",e,"x"],r)),typeof i<"u"&&(t=t.setIn(["scene","groups",e,"y"],i)),{updatedState:t}}static reloadBaricenter(t,e){let r=t.getIn(["scene","groups",e,"elements"]),i=0,s=0,o=0;return r.entrySeq().forEach(([a,l])=>{t=wt.unselectAll(t,a).updatedState;let c=l.get("lines"),h=l.get("holes"),f=l.get("items"),g=l.get("areas");c&&c.forEach(p=>{let m=t.getIn(["scene","layers",a,"lines",p,"vertices"]).map(E=>t.getIn(["scene","layers",a,"vertices",E])),{x:v,y:_}=m.get(0),{x:S,y:M}=m.get(1),{x:T,y:C}=bv(v,_,S,M);i+=T,s+=C,o++}),h&&h.forEach(p=>{let m=t.getIn(["scene","layers",a,"holes",p]),v=t.getIn(["scene","layers",a,"lines",m.line,"vertices"]).map(z=>t.getIn(["scene","layers",a,"vertices",z])),{x:_,y:S}=v.get(0),{x:M,y:T}=v.get(1),{x:C,y:E}=va(_,S,M,T,m.offset*Ve(_,S,M,T));i+=C,s+=E,o++}),f&&f.forEach(p=>{let{x:m,y:v}=t.getIn(["scene","layers",a,"items",p]);i+=m,s+=v,o++}),g&&g.forEach(p=>{let m=t.getIn(["scene","layers",a,"areas",p,"vertices"]).map(S=>t.getIn(["scene","layers",a,"vertices",S])).toJS(),{x:v,y:_}=wv(m);i+=v,s+=_,o++})}),o&&(t=this.setBarycenter(t,e,i/o,s/o).updatedState),{updatedState:t}}static removeElement(t,e,r,i,s){let o=t.getIn(["scene","groups",e,"elements",r,i]);return!o||!o.contains(s)?{updatedState:t}:(t=t.setIn(["scene","groups",e,"elements",r,i],o.filterNot(a=>a===s)),{updatedState:t})}static setAttributes(t,e,r){return t=t.mergeIn(["scene","groups",e],r),{updatedState:t}}static setProperties(t,e,r){return t=t.mergeIn(["scene","groups",e,"properties"],r),{updatedState:t}}static remove(t,e){return t=t.removeIn(["scene","groups",e]),{updatedState:t}}static removeAndDeleteElements(t,e){return t.getIn(["scene","groups",e,"elements"]).entrySeq().forEach(([i,s])=>{t=wt.unselectAll(t,i).updatedState;let o=s.get("lines"),a=s.get("holes"),l=s.get("items");s.get("areas"),o&&o.forEach(c=>{t=Ie.remove(t,i,c).updatedState,t=wt.detectAndUpdateAreas(t,i).updatedState}),a&&a.forEach(c=>{t=xe.remove(t,i,c).updatedState}),l&&l.forEach(c=>{t=Me.remove(t,i,c).updatedState})}),t=t.deleteIn(["scene","groups",e]),{updatedState:t}}static translate(t,e,r,i){let s=r-t.getIn(["scene","groups",e,"x"]),o=i-t.getIn(["scene","groups",e,"y"]);return t.getIn(["scene","groups",e,"elements"]).entrySeq().forEach(([l,c])=>{let h=c.get("lines"),f=c.get("items");if(h){let g={};h.forEach(p=>{let m=t.getIn(["scene","layers",l,"lines",p]);g[m.vertices.get(0)]||(g[m.vertices.get(0)]=t.getIn(["scene","layers",l,"vertices",m.vertices.get(0)])),g[m.vertices.get(1)]||(g[m.vertices.get(1)]=t.getIn(["scene","layers",l,"vertices",m.vertices.get(1)]))});for(let p in g){let{x:m,y:v}=g[p];t=pe.setAttributes(t,l,p,K({x:m+s,y:v+o})).updatedState}for(let p in g)t=pe.beginDraggingVertex(t,l,p).updatedState,t=pe.endDraggingVertex(t).updatedState}f&&(t=f.map(g=>t.getIn(["scene","layers",l,"items",g])).reduce((g,p)=>{let{x:m,y:v}=p;return Me.setAttributes(g,l,p.id,K({x:m+s,y:v+o})).updatedState},t)),t=wt.detectAndUpdateAreas(t,l).updatedState}),t=this.setBarycenter(t,e,r,i).updatedState,t=Iu.select(t,e).updatedState,{updatedState:t}}static rotate(t,e,r){let{x:i,y:s,rotation:o}=t.getIn(["scene","groups",e]),a=r-o;return t=Iu.setAttributes(t,e,K({rotation:r})).updatedState,t.getIn(["scene","groups",e,"elements"]).entrySeq().forEach(([c,h])=>{let f=h.get("lines"),g=h.get("items");if(f){let p={};f.forEach(m=>{let v=t.getIn(["scene","layers",c,"lines",m]);p[v.vertices.get(0)]||(p[v.vertices.get(0)]=t.getIn(["scene","layers",c,"vertices",v.vertices.get(0)])),p[v.vertices.get(1)]||(p[v.vertices.get(1)]=t.getIn(["scene","layers",c,"vertices",v.vertices.get(1)]))});for(let m in p){let{x:v,y:_}=p[m],{x:S,y:M}=gd(v,_,i,s,a);t=pe.setAttributes(t,c,m,K({x:S,y:M})).updatedState}for(let m in p)t=pe.beginDraggingVertex(t,c,m).updatedState,t=pe.endDraggingVertex(t).updatedState}g&&(t=g.map(p=>t.getIn(["scene","layers",c,"items",p])).reduce((p,m)=>{let{x:v,y:_,rotation:S}=m,{x:M,y:T}=gd(v,_,i,s,a);return Me.setAttributes(p,c,m.id,K({x:M,y:T,rotation:S+a})).updatedState},t)),t=wt.detectAndUpdateAreas(t,c).updatedState}),t=Iu.select(t,e).updatedState,{updatedState:t}}},Ie=class Pr{static create(t,e,r,i,s,o,a,l){let c=hn.acquireID(),{updatedState:h,vertex:f}=pe.add(t,e,i,s,"lines",c),{updatedState:g,vertex:p}=pe.add(h,e,o,a,"lines",c);t=g;let m=t.catalog.factoryElement(r,{id:c,name:Ma.generateName("lines",t.catalog.getIn(["elements",r,"info","title"])),vertices:ut([f.id,p.id]),type:r},l);return t=t.setIn(["scene","layers",e,"lines",c],m),{updatedState:t,line:m}}static select(t,e,r){t=wt.select(t,e).updatedState;let i=t.getIn(["scene","layers",e,"lines",r]);return t=wt.selectElement(t,e,"lines",r).updatedState,t=wt.selectElement(t,e,"vertices",i.vertices.get(0)).updatedState,t=wt.selectElement(t,e,"vertices",i.vertices.get(1)).updatedState,{updatedState:t}}static remove(t,e,r){let i=t.getIn(["scene","layers",e,"lines",r]);return i&&(t=this.unselect(t,e,r).updatedState,i.holes.forEach(s=>t=xe.remove(t,e,s).updatedState),t=wt.removeElement(t,e,"lines",r).updatedState,i.vertices.forEach(s=>t=pe.remove(t,e,s,"lines",r).updatedState),t.getIn(["scene","groups"]).forEach(s=>t=_e.removeElement(t,s.id,e,"lines",r).updatedState)),{updatedState:t}}static unselect(t,e,r){let i=t.getIn(["scene","layers",e,"lines",r]);return i&&(t=wt.unselect(t,e,"vertices",i.vertices.get(0)).updatedState,t=wt.unselect(t,e,"vertices",i.vertices.get(1)).updatedState,t=wt.unselect(t,e,"lines",r).updatedState),{updatedState:t}}static split(t,e,r,i,s){let o=t.getIn(["scene","layers",e,"lines",r]),a=t.getIn(["scene","layers",e,"vertices",o.vertices.get(0)]),l=t.getIn(["scene","layers",e,"vertices",o.vertices.get(1)]),{x:c,y:h}=a,{x:f,y:g}=l,{updatedState:p,line:m}=Pr.create(t,e,o.type,c,h,i,s,o.get("properties")),{updatedState:v,line:_}=Pr.create(p,e,o.type,f,g,i,s,o.get("properties"));t=v;let S=De(c,h,f,g,i,s),M=pa(a,l);return o.holes.forEach(C=>{let E=t.getIn(["scene","layers",e,"holes",C]),z=E.offset;if(M.x===f&&M.y===g&&(S=1-S,z=1-E.offset),z<S){let R=z/S;M.x===f&&M.y===g&&(R=1-R),t=xe.create(t,e,E.type,m.id,R,E.properties).updatedState}else{let R=(z-S)/(1-S);M.x===f&&M.y===g&&(R=1-R),t=xe.create(t,e,E.type,_.id,R,E.properties).updatedState}}),t.getIn(["scene","groups"]).filter(C=>{const E=C.getIn(["elements",e,"lines"]);return E&&E.contains(r)}).forEach(C=>{t=_e.addElement(t,C.id,e,"lines",m.id).updatedState,t=_e.addElement(t,C.id,e,"lines",_.id).updatedState}),t=Pr.remove(t,e,r).updatedState,{updatedState:t,lines:ut([m,_])}}static addFromPoints(t,e,r,i,s,o){i=ut(i).sort(({x:c,y:h},{x:f,y:g})=>c===f?h-g:c-f);let a=i.zip(i.skip(1)).filterNot(([{x:c,y:h},{x:f,y:g}])=>c===f&&h===g),l=[];return a.forEach(([{x:c,y:h},{x:f,y:g}])=>{let{updatedState:p,line:m}=this.create(t,e,r,c,h,f,g,s);t=p,o&&o.forEach(v=>{let{x:_,y:S}=v.offsetPosition;if(dv(c,h,f,g,_,S)){let M=De(c,h,f,g,_,S);M>=0&&M<=1&&(t=xe.create(t,e,v.hole.type,m.id,M,v.hole.properties).updatedState)}}),l.push(m)}),{updatedState:t,lines:ut(l)}}static createAvoidingIntersections(t,e,r,i,s,o,a,l,c){let h=[{x:i,y:s},{x:o,y:a}];t=t.getIn(["scene","layers",e,"lines"]).reduce((p,m)=>{var T,C;let[v,_]=m.vertices.map(E=>p.getIn(["scene","layers",e,"vertices"]).get(E)).toArray(),S=Dr(v,h[0])||Dr(v,h[1])||Dr(_,h[0])||Dr(_,h[1]),M=fv(h[0],h[1],v,_);if(M.type==="colinear"){c||(c=[]);const E=fo(h);p.getIn(["scene","layers",e,"lines",m.id,"holes"]).forEach(z=>{let R=p.getIn(["scene","layers",e,"holes",z]),k=Ve(v.x,v.y,_.x,_.y),L=Dr(E[1],m.vertices.get(1))?1-R.offset:R.offset,X=va(v.x,v.y,_.x,_.y,k*L);c.push({hole:R,offsetPosition:X})}),p=this.remove(p,e,m.id).updatedState,h.push(v,_)}return M.type==="intersecting"&&!S&&(p=this.split(p,e,m.id,((T=M.point)==null?void 0:T.x)??0,((C=M.point)==null?void 0:C.y)??0).updatedState,h.push(M.point??{x:0,y:0})),p},t);let{updatedState:f,lines:g}=Pr.addFromPoints(t,e,r,h,l,c);return{updatedState:f,lines:g}}static replaceVertex(t,e,r,i,s,o){let a=t.getIn(["scene","layers",e,"lines",r,"vertices",i]);t=pe.remove(t,e,a,"lines",r).updatedState;let{updatedState:l,vertex:c}=pe.add(t,e,s,o,"lines",r);return t=l,t=t.setIn(["scene","layers",e,"lines",r,"vertices",i],c.id),t=t.setIn(["scene","layers",e,"lines",r],t.getIn(["scene","layers",e,"lines",r])),{updatedState:t,line:t.getIn(["scene","layers",e,"lines",r]),vertex:c}}static selectToolDrawingLine(t,e){return t=t.merge({mode:Lr,drawingSupport:K({type:e})}),{updatedState:t}}static beginDrawingLine(t,e,r,i){let s=ql(t.scene,ut(),t.snapMask),o=null;t.snapMask&&!t.snapMask.isEmpty()&&(o=cn(s,r,i,t.snapMask),o&&({x:r,y:i}=o.point),s=s.withMutations(h=>{let f,g,p;({a:f,b:g,c:p}=ma(i)),xa(h,f,g,p,10,3,null),{a:f,b:g,c:p}=ya(r),xa(h,f,g,p,10,3,null)}));let a=t.get("drawingSupport").set("layerID",e);t=wt.unselectAll(t,e).updatedState;let{updatedState:l,line:c}=Pr.create(t,e,a.get("type"),r,i,r,i);return t=Pr.select(l,e,c.id).updatedState,t=t.merge({mode:or,snapElements:s,activeSnapElement:o?o.snap:null,drawingSupport:a}),{updatedState:t}}static updateDrawingLine(t,e,r){let i=null;t.snapMask&&!t.snapMask.isEmpty()&&(i=cn(t.snapElements,e,r,t.snapMask),i&&({x:e,y:r}=i.point));let s=t.getIn(["drawingSupport","layerID"]),o=t.getIn(["scene","layers",s,"selected","lines"]).first(),{updatedState:a}=Pr.replaceVertex(t,s,o,1,e,r);return t=a,t=this.select(t,s,o).updatedState,t=t.merge({activeSnapElement:i?i.snap:null}),{updatedState:t}}static endDrawingLine(t,e,r){if(t.snapMask&&!t.snapMask.isEmpty()){let c=cn(t.snapElements,e,r,t.snapMask);c&&({x:e,y:r}=c.point)}const i=t.getIn(["drawingSupport","layerID"]),s=t.getIn(["scene","layers",i]),o=t.getIn(["scene","layers",i,"selected","lines"]).first(),a=t.getIn(["scene","layers",i,"lines",o]),l=s.vertices.get(a.vertices.get(0));return t=Pr.remove(t,i,o).updatedState,t=Pr.createAvoidingIntersections(t,i,a.type,l.x,l.y,e,r).updatedState,t=wt.detectAndUpdateAreas(t,i).updatedState,t=t.merge({mode:Lr,snapElements:ut(),activeSnapElement:null}),{updatedState:t}}static beginDraggingLine(t,e,r,i,s){let o=ql(t.scene,ut(),t.snapMask),a=t.scene.layers.get(e),l=a.lines.get(r),c=a.vertices.get(l.vertices.get(0)),h=a.vertices.get(l.vertices.get(1));return t=t.merge({mode:Fr,snapElements:o,draggingSupport:K({layerID:e,lineID:r,startPointX:i,startPointY:s,startVertex0X:c.x,startVertex0Y:c.y,startVertex1X:h.x,startVertex1Y:h.y})}),{updatedState:t}}static updateDraggingLine(t,e,r){let i=t.draggingSupport,s=t.snapElements,o=i.get("layerID"),a=i.get("lineID"),l=e-i.get("startPointX"),c=r-i.get("startPointY"),h=i.get("startVertex0X")+l,f=i.get("startVertex0Y")+c,g=i.get("startVertex1X")+l,p=i.get("startVertex1Y")+c,m=null,v=null,_=null;t.snapMask&&!t.snapMask.isEmpty()&&(v=cn(s,h,f,t.snapMask),_=cn(s,g,p,t.snapMask));let S=0,M=0;return v&&_?v.point.distance<_.point.distance?(S=v.point.x-h,M=v.point.y-f,m=v.snap):(S=_.point.x-g,M=_.point.y-p,m=_.snap):(v&&(S=v.point.x-h,M=v.point.y-f,m=v.snap),_&&(S=_.point.x-g,M=_.point.y-p,m=_.snap)),h+=S,f+=M,g+=S,p+=M,t=t.merge({activeSnapElement:m,scene:t.scene.updateIn(["layers",o],T=>T.withMutations(C=>{let E=C.getIn(["lines",a,"vertices"]);return C.updateIn(["vertices",E.get(0)],z=>z.merge({x:h,y:f})),C.updateIn(["vertices",E.get(1)],z=>z.merge({x:g,y:p})),C}))}),{updatedState:t}}static endDraggingLine(t,e,r){let{draggingSupport:i}=t,s=i.get("layerID"),o=t.scene.layers.get(s),a=i.get("lineID"),l=o.lines.get(a),c=o.vertices.get(l.vertices.get(0)),h=o.vertices.get(l.vertices.get(1)),f=Il(c,h),g=pa(c,h),p=ga(g,f),m=Math.atan2(f.y-g.y,f.x-g.x),v=[];o.lines.get(a).holes.forEach(R=>{let k=o.holes.get(R),L=p*k.offset,X={x:L*Math.cos(m)+g.x,y:L*Math.sin(m)+g.y};v.push({hole:k,offsetPosition:X})});let _=e-i.get("startPointX"),S=r-i.get("startPointY"),M=i.get("startVertex0X")+_,T=i.get("startVertex0Y")+S,C=i.get("startVertex1X")+_,E=i.get("startVertex1Y")+S;if(t.snapMask&&!t.snapMask.isEmpty()){let R=cn(t.snapElements,M,T,t.snapMask),k=cn(t.snapElements,C,E,t.snapMask),L=0,X=0;R&&k?R.point.distance<k.point.distance?(L=R.point.x-M,X=R.point.y-T):(L=k.point.x-C,X=k.point.y-E):(R&&(L=R.point.x-M,X=R.point.y-T),k&&(L=k.point.x-C,X=k.point.y-E)),M+=L,T+=X,C+=L,E+=X}let z=t.getIn(["scene","groups"]).filter(R=>{const k=R.getIn(["elements",s,"lines"]);return k&&k.contains(a)});if(t=wt.mergeEqualsVertices(t,s,l.vertices.get(0)).updatedState,t=wt.mergeEqualsVertices(t,s,l.vertices.get(1)).updatedState,t=Pr.remove(t,s,a).updatedState,!Dr({x:M,y:T},{x:C,y:E})){let R=Pr.createAvoidingIntersections(t,s,l.type,M,T,C,E,l.properties,v);t=R.updatedState,R.lines.forEach(k=>{z.forEach(L=>{t=_e.addElement(t,L.id,s,"lines",k.id).updatedState})})}return t=wt.detectAndUpdateAreas(t,s).updatedState,t=t.merge({mode:fe,draggingSupport:null,activeSnapElement:null,snapElements:ut()}),{updatedState:t}}static setProperties(t,e,r,i){return t=t.mergeIn(["scene","layers",e,"lines",r,"properties"],i),{updatedState:t}}static setJsProperties(t,e,r,i){return this.setProperties(t,e,r,Xt(i))}static updateProperties(t,e,r,i){return i.forEach((s,o)=>{t.hasIn(["scene","layers",e,"lines",r,"properties",o])&&(t=t.mergeIn(["scene","layers",e,"lines",r,"properties",o],s))}),{updatedState:t}}static updateJsProperties(t,e,r,i){return this.updateProperties(t,e,r,Xt(i))}static setAttributes(t,e,r,i){let s=i.toJS(),{vertexOne:o,vertexTwo:a,lineLength:l}=s;return delete s.vertexOne,delete s.vertexTwo,delete s.lineLength,t=t.mergeIn(["scene","layers",e,"lines",r],Xt(s)).mergeIn(["scene","layers",e,"vertices",o.id],{x:o.x,y:o.y}).mergeIn(["scene","layers",e,"vertices",a.id],{x:a.x,y:a.y}).mergeIn(["scene","layers",e,"lines",r,"misc"],K({_unitLength:l._unit})),t=wt.mergeEqualsVertices(t,e,o.id).updatedState,o.x!=a.x&&o.y!=a.y&&(t=wt.mergeEqualsVertices(t,e,a.id).updatedState),t=wt.detectAndUpdateAreas(t,e).updatedState,{updatedState:t}}static setVerticesCoords(t,e,r,i,s,o,a){let l=t.getIn(["scene","layers",e,"lines",r]);return t=pe.setAttributes(t,e,l.vertices.get(0),K({x:i,y:s})).updatedState,t=pe.setAttributes(t,e,l.vertices.get(1),K({x:o,y:a})).updatedState,{updatedState:t}}},pe=class{static add(t,e,r,i,s,o){let a=t.getIn(["scene","layers",e,"vertices"]).find(l=>Dr(l,{x:r,y:i}));return a?a=a.update(s,l=>l.push(o)):a=new vd({id:hn.acquireID(),name:"Vertex",x:r,y:i,[s]:ut([o])}),t=t.setIn(["scene","layers",e,"vertices",a.id],a),{updatedState:t,vertex:a}}static setAttributes(t,e,r,i){return t=t.mergeIn(["scene","layers",e,"vertices",r],i),{updatedState:t}}static addElement(t,e,r,i,s){return t=t.updateIn(["scene","layers",e,"vertices",r,i],o=>o.push(s)),{updatedState:t}}static removeElement(t,e,r,i,s){let o=t.getIn(["scene","layers",e,"vertices",r,i]).findIndex(a=>a===s);return o!==-1&&(t=t.updateIn(["scene","layers",e,"vertices",r,i],a=>a.remove(o))),{updatedState:t}}static select(t,e,r){return t=t.setIn(["scene","layers",e,"vertices",r,"selected"],!0),t=t.updateIn(["scene","layers",e,"selected","vertices"],i=>i.push(r)),{updatedState:t}}static unselect(t,e,r){return t=t.setIn(["scene","layers",e,"vertices",r,"selected"],!1),t=t.updateIn(["scene","layers",e,"selected","vertices"],i=>i.filter(s=>s.id!==r)),{updatedState:t}}static remove(t,e,r,i,s,o){let a=t.getIn(["scene","layers",e,"vertices",r]);return a&&(i&&s&&(a=a.update(i,c=>{let h=c.findIndex(f=>s===f);return c.delete(h)})),(a.areas.size||a.lines.size)&&!o?t=t.setIn(["scene","layers",e,"vertices",r],a):t=t.deleteIn(["scene","layers",e,"vertices",r])),{updatedState:t}}static beginDraggingVertex(t,e,r){let i=ql(t.scene,ut(),t.snapMask);return t=t.merge({mode:Nr,snapElements:i,draggingSupport:K({layerID:e,vertexID:r,previousMode:t.get("mode")})}),{updatedState:t}}static updateDraggingVertex(t,e,r){let{draggingSupport:i,snapElements:s,scene:o}=t,a=null;t.snapMask&&!t.snapMask.isEmpty()&&(a=cn(s,e,r,t.snapMask),a&&({x:e,y:r}=a.point));let l=i.get("layerID"),c=i.get("vertexID");return t=t.merge({activeSnapElement:a?a.snap:null,scene:o.mergeIn(["layers",l,"vertices",c],{x:e,y:r})}),{updatedState:t}}static endDraggingVertex(t){let{draggingSupport:e}=t,r=e.get("layerID"),i=e.get("vertexID"),s=t.getIn(["scene","layers",r,"vertices",i,"lines"]);return s&&(t=s.reduce((o,a)=>{if(!o.getIn(["scene","layers",r,"lines",a]))return o;let l=o.getIn(["scene","layers",r,"lines",a,"vertices",0]),c=o.getIn(["scene","layers",r,"lines",a,"vertices",1]),h=l===i?c:l,f=o.getIn(["scene","layers",r,"vertices",h]),g=o.getIn(["scene","layers",r,"vertices",i]),p=[],m=fo([f,g]);o.getIn(["scene","layers",r,"lines",a,"holes"]).forEach(M=>{let T=o.getIn(["scene","layers",r,"holes",M]),C=Ve(f.x,f.y,g.x,g.y),E=Dr(m[1],o.getIn(["scene","layers",r,"lines",a,"vertices",1]))?1-T.offset:T.offset,z=va(f.x,f.y,g.x,g.y,C*E);p.push({hole:T,offsetPosition:z})});let v=o.getIn(["scene","layers",r,"lines",a,"type"]),_=o.getIn(["scene","layers",r,"lines",a,"properties"]),S=o.getIn(["scene","groups"]).filter(M=>{const T=M.getIn(["elements",r,"lines"]);return T&&T.contains(a)});if(o=wt.removeZeroLengthLines(o,r).updatedState,o=wt.mergeEqualsVertices(o,r,i).updatedState,o=Ie.remove(o,r,a).updatedState,!Dr(f,g)){let M=Ie.createAvoidingIntersections(o,r,v,f.x,f.y,g.x,g.y,_,p);o=M.updatedState,M.lines.forEach(T=>{S.forEach(C=>{o=_e.addElement(o,C.id,r,"lines",T.id).updatedState})})}return o},t)),t=wt.detectAndUpdateAreas(t,r).updatedState,t=t.merge({mode:e.get("previousMode"),draggingSupport:null,activeSnapElement:null,snapElements:ut()}),{updatedState:t}}},xi=class{static add(t,e,r,i,s){let o,a=t.getIn(["scene","layers",e]);return a=a.withMutations(l=>{const c=hn.acquireID(),h=i.map(f=>pe.add(t,e,f.x,f.y,"areas",c).vertex.id);o=s.factoryElement(r,{id:c,name:Ma.generateName("areas",s.getIn(["elements",r,"info","title"])),type:r,prototype:"areas",vertices:h}),l.setIn(["areas",c],o)}),t=t.setIn(["scene","layers",e],a),{updatedState:t,area:o}}static select(t,e,r){return t=wt.select(t,e).updatedState,t=wt.selectElement(t,e,"areas",r).updatedState,{updatedState:t}}static remove(t,e,r){let i=t.getIn(["scene","layers",e,"areas",r]);return i.get("selected")===!0&&(t=this.unselect(t,e,r).updatedState),i.vertices.forEach(s=>{t=pe.remove(t,e,s,"areas",r).updatedState}),t=t.deleteIn(["scene","layers",e,"areas",r]),t.getIn(["scene","groups"]).forEach(s=>t=_e.removeElement(t,s.id,e,"areas",r).updatedState),{updatedState:t}}static unselect(t,e,r){return t=wt.unselect(t,e,"areas",r).updatedState,{updatedState:t}}static setProperties(t,e,r,i){return t=t.mergeIn(["scene","layers",e,"areas",r,"properties"],i),{updatedState:t}}static setJsProperties(t,e,r,i){return this.setProperties(t,e,r,Xt(i))}static updateProperties(t,e,r,i){return i.forEach((s,o)=>{t.hasIn(["scene","layers",e,"areas",r,"properties",o])&&(t=t.mergeIn(["scene","layers",e,"areas",r,"properties",o],s))}),{updatedState:t}}static updateJsProperties(t,e,r,i){return this.updateProperties(t,e,r,Xt(i))}static setAttributes(t){return{updatedState:t}}};const Xd=(n,t)=>n.size===t.size&&n.isSuperset(t)&&n.isSubset(t);let wt=class{static create(t,e,r){let i=hn.acquireID();e=e||`layer ${i}`,r=r||0;let s=new Vl({id:i,name:e,altitude:r});return t=t.setIn(["scene","selectedLayer"],i),t=t.setIn(["scene","layers",i],s),{updatedState:t}}static select(t,e){return t.get("alterate")||(t=Jt.unselectAll(t).updatedState),t=t.setIn(["scene","selectedLayer"],e),{updatedState:t}}static selectElement(t,e,r,i){return t=t.setIn(["scene","layers",e,r,i,"selected"],!0),t=t.updateIn(["scene","layers",e,"selected",r],s=>s.push(i)),{updatedState:t}}static unselect(t,e,r,i){return t=t.setIn(["scene","layers",e,r,i,"selected"],!1),t=t.updateIn(["scene","layers",e,"selected",r],s=>s.filter(o=>o.id===i)),{updatedState:t}}static unselectAll(t,e){let{lines:r,holes:i,items:s,areas:o}=t.getIn(["scene","layers",e]);return r&&r.forEach(a=>{t=Ie.unselect(t,e,a.id).updatedState}),i&&i.forEach(a=>{t=xe.unselect(t,e,a.id).updatedState}),s&&s.forEach(a=>{t=Me.unselect(t,e,a.id).updatedState}),o&&o.forEach(a=>{t=xi.unselect(t,e,a.id).updatedState}),{updatedState:t}}static setProperties(t,e,r){return t=t.mergeIn(["scene","layers",e],r),t=t.updateIn(["scene","layers"],i=>i.sort((s,o)=>s.altitude!==o.altitude?s.altitude-o.altitude:s.order-o.order)),{updatedState:t}}static remove(t,e){return t=t.removeIn(["scene","layers",e]),t=t.setIn(["scene","selectedLayer"],t.scene.selectedLayer!==e?t.scene.selectedLayer:t.scene.layers.first().id),{updatedState:t}}static removeElement(t,e,r,i){return t=t.deleteIn(["scene","layers",e,r,i]),{updatedState:t}}static detectAndUpdateAreas(t,e){let r=[],i,s={},o={};t.getIn(["scene","layers",e,"vertices"]).forEach(p=>{let v=r.push([p.x,p.y])-1;s[p.id]=v,o[v]=p.id}),i=t.getIn(["scene","layers",e,"lines"]).map(p=>p.vertices.map(m=>s[m]).toArray());const a=qv(r,i);let l=ut(a).map(p=>ut(p.map(m=>o[m])));l=l.map(p=>$v(p.map(m=>t.getIn(["scene","layers",e,"vertices",m])))?p.reverse():p);const c=[];t.getIn(["scene","layers",e,"areas"]).forEach(p=>{l.some(v=>Xd(v,p.vertices))||(t=xi.remove(t,e,p.id).updatedState)}),l.forEach((p,m)=>{const v=t.getIn(["scene","layers",e,"areas"]).find(_=>Xd(_.vertices,p));if(v)c[m]=v.id,t=t.setIn(["scene","layers",e,"areas",c[m],"holes"],ut());else{const _=p.map(M=>t.getIn(["scene","layers",e,"vertices",M])),S=xi.add(t,e,"area",_,t.catalog);c[m]=S.area.id,t=S.updatedState}});let h=c.map(p=>{let m=t.getIn(["scene","layers",e,"areas",p]).vertices.map(v=>{let{x:_,y:S}=t.getIn(["scene","layers",e,"vertices",v]);return ut([_,S])});return{id:p,vertices:m}}),f,g;for(f=0;f<h.length;f++){let p=ut(),m=h[f].vertices.flatten().toArray();for(g=0;g<h.length;g++)f!==g&&vv(m,h[g].vertices.get(0).get(0),h[g].vertices.get(0).get(1))&&(p=p.push(h[g].id));t=t.setIn(["scene","layers",e,"areas",h[f].id,"holes"],p)}return c.forEach(p=>{let m=new Set,v=t.getIn(["scene","layers",e,"areas",p,"holes"]);v.forEach(_=>{t.getIn(["scene","layers",e,"areas",_,"holes"]).forEach(M=>{v.indexOf(M)!==-1&&m.add(M)})}),m.forEach(_=>{v=v.remove(v.indexOf(_))}),t=t.setIn(["scene","layers",e,"areas",p,"holes"],v)}),{updatedState:t}}static removeZeroLengthLines(t,e){return{updatedState:t.getIn(["scene","layers",e,"lines"]).reduce((i,s)=>{let o=s.getIn(["vertices",0]),a=s.getIn(["vertices",1]),l=i.getIn(["scene","layers",e,"vertices",o]),c=i.getIn(["scene","layers",e,"vertices",a]);return ga(l,c)===0&&(i=Ie.remove(i,e,s.id).updatedState),i},t)}}static mergeEqualsVertices(t,e,r){let i=t.getIn(["scene","layers",e,"vertices",r]),s=t.getIn(["scene","layers",e,"vertices"]).filter(o=>o.id!==r&&Dr(i,o));return s.isEmpty()?{updatedState:t}:(s.forEach(o=>{let a=o.lines.reduce((c,h)=>(c=c.updateIn(["scene","layers",e,"lines",h,"vertices"],f=>{if(f)return f.map(g=>g===o.id?r:g)}),c=pe.addElement(c,e,r,"lines",h).updatedState,c),t),l=o.areas.reduce((c,h)=>(c=c.updateIn(["scene","layers",e,"areas",h,"vertices"],f=>{if(f)return f.map(g=>g===o.id?r:g)}),c=pe.addElement(c,e,r,"areas",h).updatedState,c),a);t=pe.remove(l,e,o.id,null,null,!0).updatedState}),{updatedState:t})}static setPropertiesOnSelected(t,e,r){let i=t.getIn(["scene","layers",e,"selected"]);return i.lines.forEach(s=>t=Ie.setProperties(t,e,s,r).updatedState),i.holes.forEach(s=>t=xe.setProperties(t,e,s,r).updatedState),i.areas.forEach(s=>t=xi.setProperties(t,e,s,r).updatedState),i.items.forEach(s=>t=Me.setProperties(t,e,s,r).updatedState),{updatedState:t}}static updatePropertiesOnSelected(t,e,r){let i=t.getIn(["scene","layers",e,"selected"]);return i.lines.forEach(s=>t=Ie.updateProperties(t,e,s,r).updatedState),i.holes.forEach(s=>t=xe.updateProperties(t,e,s,r).updatedState),i.areas.forEach(s=>t=xi.updateProperties(t,e,s,r).updatedState),i.items.forEach(s=>t=Me.updateProperties(t,e,s,r).updatedState),{updatedState:t}}static setAttributesOnSelected(t,e,r){let i=t.getIn(["scene","layers",e,"selected"]);return i.lines.forEach(s=>t=Ie.setAttributes(t,e,s,r).updatedState),i.holes.forEach(s=>t=xe.setAttributes(t,e,s,r).updatedState),i.items.forEach(s=>t=Me.setAttributes(t,e,s,r).updatedState),{updatedState:t}}};class Aa{static create(t,e){let r=hn.acquireID();return t=t.setIn(["scene","guides","horizontal",r],e),{updatedState:t}}static remove(t,e){return t=t.deleteIn(["scene","guides","horizontal",e]),{updatedState:t}}}class Oa{static create(t,e){let r=hn.acquireID();return t=t.setIn(["scene","guides","vertical",r],e),{updatedState:t}}static remove(t,e){return t=t.deleteIn(["scene","guides","vertical",e]),{updatedState:t}}}class Jt{static setAlterate(t){return{updatedState:t.set("alterate",!t.alterate)}}static openCatalog(t){return t=this.setMode(t,zl).updatedState,{updatedState:t}}static newProject(t){return t=new ba({viewer2D:t.get("viewer2D")}),{updatedState:t}}static loadProject(t,e){return t=new ba({scene:e,catalog:t.catalog.toJS()}),{updatedState:t}}static setProperties(t,e,r){return t=wt.setPropertiesOnSelected(t,e,r).updatedState,{updatedState:t}}static updateProperties(t,e,r){return t=wt.updatePropertiesOnSelected(t,e,r).updatedState,{updatedState:t}}static setItemsAttributes(t,e){return t.getIn(["scene","layers"]).forEach(r=>{t=wt.setAttributesOnSelected(t,r.id,e).updatedState}),{updatedState:t}}static setLinesAttributes(t,e){return t.getIn(["scene","layers"]).forEach(r=>{t=wt.setAttributesOnSelected(t,r.id,e).updatedState}),{updatedState:t}}static setHolesAttributes(t,e){return t.getIn(["scene","layers"]).forEach(r=>{t=wt.setAttributesOnSelected(t,r.id,e).updatedState}),{updatedState:t}}static unselectAll(t){return t.getIn(["scene","layers"]).forEach(({id:e})=>{t=wt.unselectAll(t,e).updatedState}),t.getIn(["scene","groups"]).forEach(e=>{t=_e.unselect(t,e.get("id")).updatedState}),{updatedState:t}}static remove(t){let e=t.getIn(["scene","selectedLayer"]),{lines:r,holes:i,items:s}=t.getIn(["scene","layers",e,"selected"]);return t=wt.unselectAll(t,e).updatedState,r.forEach(o=>{t=Ie.remove(t,e,o).updatedState}),i.forEach(o=>{t=xe.remove(t,e,o).updatedState}),s.forEach(o=>{t=Me.remove(t,e,o).updatedState}),t=wt.detectAndUpdateAreas(t,e).updatedState,{updatedState:t}}static undo(t){let e=t.sceneHistory;return t.scene===e.last&&e.list.size>1&&(e=Nd(e)),t=t.merge({mode:fe,scene:e.last,sceneHistory:Nd(e)}),{updatedState:t}}static redo(t){let e=t.sceneHistory;return t.scene===e.last&&e.redoList.size>0&&(e=ex(e)),t=t.merge({mode:fe,scene:e.last,sceneHistory:e}),{updatedState:t}}static rollback(t){let e=t.sceneHistory;return!e.last&&e.list.isEmpty()?{updatedState:t}:(t=this.unselectAll(t).updatedState,t=t.merge({mode:fe,scene:e.last,sceneHistory:de(e,e.last),snapElements:ut(),activeSnapElement:null,drawingSupport:K(),draggingSupport:K(),rotatingSupport:K()}),{updatedState:t})}static setProjectProperties(t,e){let r=t.scene.merge(e);return t=t.merge({mode:fe,scene:r}),{updatedState:t}}static openProjectConfigurator(t){return t=t.merge({mode:fd}),{updatedState:t}}static initCatalog(t,e){return t=t.set("catalog",new Bl(e)),{updatedState:t}}static updateMouseCoord(t,e){return t=t.set("mouse",K(e)),{updatedState:t}}static updateZoomScale(t,e){return t=t.set("zoom",e),{updatedState:t}}static toggleSnap(t,e){return t=t.set("snapMask",e),{updatedState:t}}static throwError(t,e){return t=t.set("errors",t.get("errors").push({date:Date.now(),error:e})),{updatedState:t}}static throwWarning(t,e){return t=t.set("warnings",t.get("warnings").push({date:Date.now(),warning:e})),{updatedState:t}}static copyProperties(t,e){return t=t.set("clipboardProperties",e),{updatedState:t}}static pasteProperties(t){return t=this.updateProperties(t,t.getIn(["scene","selectedLayer"]),t.get("clipboardProperties")).updatedState,{updatedState:t}}static pushLastSelectedCatalogElementToHistory(t,e){let r=t.selectedElementsHistory,i=r.findIndex(s=>s.name===e.name);return i!==-1&&(r=r.splice(i,1)),r=r.splice(0,0,e),t=t.set("selectedElementsHistory",r),{updatedState:t}}static changeCatalogPage(t,e,r){return t=t.setIn(["catalog","page"],r).updateIn(["catalog","path"],i=>i.push(e)),{updatedState:t}}static goBackToCatalogPage(t,e){let r=t.catalog.path.findIndex(i=>i===e);return t=t.setIn(["catalog","page"],e).updateIn(["catalog","path"],i=>i.take(r)),{updatedState:t}}static setMode(t,e){return t=t.set("mode",e),{updatedState:t}}static addHorizontalGuide(t,e){return t=Aa.create(t,e).updatedState,{updatedState:t}}static addVerticalGuide(t,e){return t=Oa.create(t,e).updatedState,{updatedState:t}}static addCircularGuide(t,e,r,i){return console.log("adding horizontal guide at",e,r,i),{updatedState:t}}static removeHorizontalGuide(t,e){return t=Aa.remove(t,e).updatedState,{updatedState:t}}static removeVerticalGuide(t,e){return t=Oa.remove(t,e).updatedState,{updatedState:t}}static removeCircularGuide(t,e){return console.log("removeing horizontal guide ",e),{updatedState:t}}}var za={exports:{}},Ta={exports:{}},$t={};/** @license React v16.13.1
54
+ * react-is.production.min.js
55
+ *
56
+ * Copyright (c) Facebook, Inc. and its affiliates.
57
+ *
58
+ * This source code is licensed under the MIT license found in the
59
+ * LICENSE file in the root directory of this source tree.
60
+ */var Jd;function px(){if(Jd)return $t;Jd=1;var n=typeof Symbol=="function"&&Symbol.for,t=n?Symbol.for("react.element"):60103,e=n?Symbol.for("react.portal"):60106,r=n?Symbol.for("react.fragment"):60107,i=n?Symbol.for("react.strict_mode"):60108,s=n?Symbol.for("react.profiler"):60114,o=n?Symbol.for("react.provider"):60109,a=n?Symbol.for("react.context"):60110,l=n?Symbol.for("react.async_mode"):60111,c=n?Symbol.for("react.concurrent_mode"):60111,h=n?Symbol.for("react.forward_ref"):60112,f=n?Symbol.for("react.suspense"):60113,g=n?Symbol.for("react.suspense_list"):60120,p=n?Symbol.for("react.memo"):60115,m=n?Symbol.for("react.lazy"):60116,v=n?Symbol.for("react.block"):60121,_=n?Symbol.for("react.fundamental"):60117,S=n?Symbol.for("react.responder"):60118,M=n?Symbol.for("react.scope"):60119;function T(E){if(typeof E=="object"&&E!==null){var z=E.$$typeof;switch(z){case t:switch(E=E.type,E){case l:case c:case r:case s:case i:case f:return E;default:switch(E=E&&E.$$typeof,E){case a:case h:case m:case p:case o:return E;default:return z}}case e:return z}}}function C(E){return T(E)===c}return $t.AsyncMode=l,$t.ConcurrentMode=c,$t.ContextConsumer=a,$t.ContextProvider=o,$t.Element=t,$t.ForwardRef=h,$t.Fragment=r,$t.Lazy=m,$t.Memo=p,$t.Portal=e,$t.Profiler=s,$t.StrictMode=i,$t.Suspense=f,$t.isAsyncMode=function(E){return C(E)||T(E)===l},$t.isConcurrentMode=C,$t.isContextConsumer=function(E){return T(E)===a},$t.isContextProvider=function(E){return T(E)===o},$t.isElement=function(E){return typeof E=="object"&&E!==null&&E.$$typeof===t},$t.isForwardRef=function(E){return T(E)===h},$t.isFragment=function(E){return T(E)===r},$t.isLazy=function(E){return T(E)===m},$t.isMemo=function(E){return T(E)===p},$t.isPortal=function(E){return T(E)===e},$t.isProfiler=function(E){return T(E)===s},$t.isStrictMode=function(E){return T(E)===i},$t.isSuspense=function(E){return T(E)===f},$t.isValidElementType=function(E){return typeof E=="string"||typeof E=="function"||E===r||E===c||E===s||E===i||E===f||E===g||typeof E=="object"&&E!==null&&(E.$$typeof===m||E.$$typeof===p||E.$$typeof===o||E.$$typeof===a||E.$$typeof===h||E.$$typeof===_||E.$$typeof===S||E.$$typeof===M||E.$$typeof===v)},$t.typeOf=T,$t}var Ht={};/** @license React v16.13.1
61
+ * react-is.development.js
62
+ *
63
+ * Copyright (c) Facebook, Inc. and its affiliates.
64
+ *
65
+ * This source code is licensed under the MIT license found in the
66
+ * LICENSE file in the root directory of this source tree.
67
+ */var Zd;function gx(){return Zd||(Zd=1,process.env.NODE_ENV!=="production"&&function(){var n=typeof Symbol=="function"&&Symbol.for,t=n?Symbol.for("react.element"):60103,e=n?Symbol.for("react.portal"):60106,r=n?Symbol.for("react.fragment"):60107,i=n?Symbol.for("react.strict_mode"):60108,s=n?Symbol.for("react.profiler"):60114,o=n?Symbol.for("react.provider"):60109,a=n?Symbol.for("react.context"):60110,l=n?Symbol.for("react.async_mode"):60111,c=n?Symbol.for("react.concurrent_mode"):60111,h=n?Symbol.for("react.forward_ref"):60112,f=n?Symbol.for("react.suspense"):60113,g=n?Symbol.for("react.suspense_list"):60120,p=n?Symbol.for("react.memo"):60115,m=n?Symbol.for("react.lazy"):60116,v=n?Symbol.for("react.block"):60121,_=n?Symbol.for("react.fundamental"):60117,S=n?Symbol.for("react.responder"):60118,M=n?Symbol.for("react.scope"):60119;function T(H){return typeof H=="string"||typeof H=="function"||H===r||H===c||H===s||H===i||H===f||H===g||typeof H=="object"&&H!==null&&(H.$$typeof===m||H.$$typeof===p||H.$$typeof===o||H.$$typeof===a||H.$$typeof===h||H.$$typeof===_||H.$$typeof===S||H.$$typeof===M||H.$$typeof===v)}function C(H){if(typeof H=="object"&&H!==null){var Ot=H.$$typeof;switch(Ot){case t:var Bt=H.type;switch(Bt){case l:case c:case r:case s:case i:case f:return Bt;default:var kt=Bt&&Bt.$$typeof;switch(kt){case a:case h:case m:case p:case o:return kt;default:return Ot}}case e:return Ot}}}var E=l,z=c,R=a,k=o,L=t,X=h,J=r,at=m,tt=p,bt=e,xt=s,yt=i,ht=f,Y=!1;function St(H){return Y||(Y=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),j(H)||C(H)===l}function j(H){return C(H)===c}function W(H){return C(H)===a}function ft(H){return C(H)===o}function et(H){return typeof H=="object"&&H!==null&&H.$$typeof===t}function rt(H){return C(H)===h}function Z(H){return C(H)===r}function Q(H){return C(H)===m}function U(H){return C(H)===p}function st(H){return C(H)===e}function vt(H){return C(H)===s}function B(H){return C(H)===i}function pt(H){return C(H)===f}Ht.AsyncMode=E,Ht.ConcurrentMode=z,Ht.ContextConsumer=R,Ht.ContextProvider=k,Ht.Element=L,Ht.ForwardRef=X,Ht.Fragment=J,Ht.Lazy=at,Ht.Memo=tt,Ht.Portal=bt,Ht.Profiler=xt,Ht.StrictMode=yt,Ht.Suspense=ht,Ht.isAsyncMode=St,Ht.isConcurrentMode=j,Ht.isContextConsumer=W,Ht.isContextProvider=ft,Ht.isElement=et,Ht.isForwardRef=rt,Ht.isFragment=Z,Ht.isLazy=Q,Ht.isMemo=U,Ht.isPortal=st,Ht.isProfiler=vt,Ht.isStrictMode=B,Ht.isSuspense=pt,Ht.isValidElementType=T,Ht.typeOf=C}()),Ht}var Kd;function Qd(){return Kd||(Kd=1,process.env.NODE_ENV==="production"?Ta.exports=px():Ta.exports=gx()),Ta.exports}/*
68
+ object-assign
69
+ (c) Sindre Sorhus
70
+ @license MIT
71
+ */var sc,tp;function mx(){if(tp)return sc;tp=1;var n=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,e=Object.prototype.propertyIsEnumerable;function r(s){if(s==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(s)}function i(){try{if(!Object.assign)return!1;var s=new String("abc");if(s[5]="de",Object.getOwnPropertyNames(s)[0]==="5")return!1;for(var o={},a=0;a<10;a++)o["_"+String.fromCharCode(a)]=a;var l=Object.getOwnPropertyNames(o).map(function(h){return o[h]});if(l.join("")!=="0123456789")return!1;var c={};return"abcdefghijklmnopqrst".split("").forEach(function(h){c[h]=h}),Object.keys(Object.assign({},c)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return sc=i()?Object.assign:function(s,o){for(var a,l=r(s),c,h=1;h<arguments.length;h++){a=Object(arguments[h]);for(var f in a)t.call(a,f)&&(l[f]=a[f]);if(n){c=n(a);for(var g=0;g<c.length;g++)e.call(a,c[g])&&(l[c[g]]=a[c[g]])}}return l},sc}var oc,ep;function ac(){if(ep)return oc;ep=1;var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return oc=n,oc}var uc,rp;function np(){return rp||(rp=1,uc=Function.call.bind(Object.prototype.hasOwnProperty)),uc}var lc,ip;function yx(){if(ip)return lc;ip=1;var n=function(){};if(process.env.NODE_ENV!=="production"){var t=ac(),e={},r=np();n=function(s){var o="Warning: "+s;typeof console<"u"&&console.error(o);try{throw new Error(o)}catch{}}}function i(s,o,a,l,c){if(process.env.NODE_ENV!=="production"){for(var h in s)if(r(s,h)){var f;try{if(typeof s[h]!="function"){var g=Error((l||"React class")+": "+a+" type `"+h+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof s[h]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw g.name="Invariant Violation",g}f=s[h](o,h,l,a,null,t)}catch(m){f=m}if(f&&!(f instanceof Error)&&n((l||"React class")+": type specification of "+a+" `"+h+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof f+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),f instanceof Error&&!(f.message in e)){e[f.message]=!0;var p=c?c():"";n("Failed "+a+" type: "+f.message+(p??""))}}}}return i.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(e={})},lc=i,lc}var cc,sp;function vx(){if(sp)return cc;sp=1;var n=Qd(),t=mx(),e=ac(),r=np(),i=yx(),s=function(){};process.env.NODE_ENV!=="production"&&(s=function(a){var l="Warning: "+a;typeof console<"u"&&console.error(l);try{throw new Error(l)}catch{}});function o(){return null}return cc=function(a,l){var c=typeof Symbol=="function"&&Symbol.iterator,h="@@iterator";function f(j){var W=j&&(c&&j[c]||j[h]);if(typeof W=="function")return W}var g="<<anonymous>>",p={array:S("array"),bigint:S("bigint"),bool:S("boolean"),func:S("function"),number:S("number"),object:S("object"),string:S("string"),symbol:S("symbol"),any:M(),arrayOf:T,element:C(),elementType:E(),instanceOf:z,node:X(),objectOf:k,oneOf:R,oneOfType:L,shape:at,exact:tt};function m(j,W){return j===W?j!==0||1/j===1/W:j!==j&&W!==W}function v(j,W){this.message=j,this.data=W&&typeof W=="object"?W:{},this.stack=""}v.prototype=Error.prototype;function _(j){if(process.env.NODE_ENV!=="production")var W={},ft=0;function et(Z,Q,U,st,vt,B,pt){if(st=st||g,B=B||U,pt!==e){if(l){var H=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw H.name="Invariant Violation",H}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var Ot=st+":"+U;!W[Ot]&&ft<3&&(s("You are manually calling a React.PropTypes validation function for the `"+B+"` prop on `"+st+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),W[Ot]=!0,ft++)}}return Q[U]==null?Z?Q[U]===null?new v("The "+vt+" `"+B+"` is marked as required "+("in `"+st+"`, but its value is `null`.")):new v("The "+vt+" `"+B+"` is marked as required in "+("`"+st+"`, but its value is `undefined`.")):null:j(Q,U,st,vt,B)}var rt=et.bind(null,!1);return rt.isRequired=et.bind(null,!0),rt}function S(j){function W(ft,et,rt,Z,Q,U){var st=ft[et],vt=yt(st);if(vt!==j){var B=ht(st);return new v("Invalid "+Z+" `"+Q+"` of type "+("`"+B+"` supplied to `"+rt+"`, expected ")+("`"+j+"`."),{expectedType:j})}return null}return _(W)}function M(){return _(o)}function T(j){function W(ft,et,rt,Z,Q){if(typeof j!="function")return new v("Property `"+Q+"` of component `"+rt+"` has invalid PropType notation inside arrayOf.");var U=ft[et];if(!Array.isArray(U)){var st=yt(U);return new v("Invalid "+Z+" `"+Q+"` of type "+("`"+st+"` supplied to `"+rt+"`, expected an array."))}for(var vt=0;vt<U.length;vt++){var B=j(U,vt,rt,Z,Q+"["+vt+"]",e);if(B instanceof Error)return B}return null}return _(W)}function C(){function j(W,ft,et,rt,Z){var Q=W[ft];if(!a(Q)){var U=yt(Q);return new v("Invalid "+rt+" `"+Z+"` of type "+("`"+U+"` supplied to `"+et+"`, expected a single ReactElement."))}return null}return _(j)}function E(){function j(W,ft,et,rt,Z){var Q=W[ft];if(!n.isValidElementType(Q)){var U=yt(Q);return new v("Invalid "+rt+" `"+Z+"` of type "+("`"+U+"` supplied to `"+et+"`, expected a single ReactElement type."))}return null}return _(j)}function z(j){function W(ft,et,rt,Z,Q){if(!(ft[et]instanceof j)){var U=j.name||g,st=St(ft[et]);return new v("Invalid "+Z+" `"+Q+"` of type "+("`"+st+"` supplied to `"+rt+"`, expected ")+("instance of `"+U+"`."))}return null}return _(W)}function R(j){if(!Array.isArray(j))return process.env.NODE_ENV!=="production"&&(arguments.length>1?s("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):s("Invalid argument supplied to oneOf, expected an array.")),o;function W(ft,et,rt,Z,Q){for(var U=ft[et],st=0;st<j.length;st++)if(m(U,j[st]))return null;var vt=JSON.stringify(j,function(pt,H){var Ot=ht(H);return Ot==="symbol"?String(H):H});return new v("Invalid "+Z+" `"+Q+"` of value `"+String(U)+"` "+("supplied to `"+rt+"`, expected one of "+vt+"."))}return _(W)}function k(j){function W(ft,et,rt,Z,Q){if(typeof j!="function")return new v("Property `"+Q+"` of component `"+rt+"` has invalid PropType notation inside objectOf.");var U=ft[et],st=yt(U);if(st!=="object")return new v("Invalid "+Z+" `"+Q+"` of type "+("`"+st+"` supplied to `"+rt+"`, expected an object."));for(var vt in U)if(r(U,vt)){var B=j(U,vt,rt,Z,Q+"."+vt,e);if(B instanceof Error)return B}return null}return _(W)}function L(j){if(!Array.isArray(j))return process.env.NODE_ENV!=="production"&&s("Invalid argument supplied to oneOfType, expected an instance of array."),o;for(var W=0;W<j.length;W++){var ft=j[W];if(typeof ft!="function")return s("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+Y(ft)+" at index "+W+"."),o}function et(rt,Z,Q,U,st){for(var vt=[],B=0;B<j.length;B++){var pt=j[B],H=pt(rt,Z,Q,U,st,e);if(H==null)return null;H.data&&r(H.data,"expectedType")&&vt.push(H.data.expectedType)}var Ot=vt.length>0?", expected one of type ["+vt.join(", ")+"]":"";return new v("Invalid "+U+" `"+st+"` supplied to "+("`"+Q+"`"+Ot+"."))}return _(et)}function X(){function j(W,ft,et,rt,Z){return bt(W[ft])?null:new v("Invalid "+rt+" `"+Z+"` supplied to "+("`"+et+"`, expected a ReactNode."))}return _(j)}function J(j,W,ft,et,rt){return new v((j||"React class")+": "+W+" type `"+ft+"."+et+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+rt+"`.")}function at(j){function W(ft,et,rt,Z,Q){var U=ft[et],st=yt(U);if(st!=="object")return new v("Invalid "+Z+" `"+Q+"` of type `"+st+"` "+("supplied to `"+rt+"`, expected `object`."));for(var vt in j){var B=j[vt];if(typeof B!="function")return J(rt,Z,Q,vt,ht(B));var pt=B(U,vt,rt,Z,Q+"."+vt,e);if(pt)return pt}return null}return _(W)}function tt(j){function W(ft,et,rt,Z,Q){var U=ft[et],st=yt(U);if(st!=="object")return new v("Invalid "+Z+" `"+Q+"` of type `"+st+"` "+("supplied to `"+rt+"`, expected `object`."));var vt=t({},ft[et],j);for(var B in vt){var pt=j[B];if(r(j,B)&&typeof pt!="function")return J(rt,Z,Q,B,ht(pt));if(!pt)return new v("Invalid "+Z+" `"+Q+"` key `"+B+"` supplied to `"+rt+"`.\nBad object: "+JSON.stringify(ft[et],null," ")+`
72
+ Valid keys: `+JSON.stringify(Object.keys(j),null," "));var H=pt(U,B,rt,Z,Q+"."+B,e);if(H)return H}return null}return _(W)}function bt(j){switch(typeof j){case"number":case"string":case"undefined":return!0;case"boolean":return!j;case"object":if(Array.isArray(j))return j.every(bt);if(j===null||a(j))return!0;var W=f(j);if(W){var ft=W.call(j),et;if(W!==j.entries){for(;!(et=ft.next()).done;)if(!bt(et.value))return!1}else for(;!(et=ft.next()).done;){var rt=et.value;if(rt&&!bt(rt[1]))return!1}}else return!1;return!0;default:return!1}}function xt(j,W){return j==="symbol"?!0:W?W["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&W instanceof Symbol:!1}function yt(j){var W=typeof j;return Array.isArray(j)?"array":j instanceof RegExp?"object":xt(W,j)?"symbol":W}function ht(j){if(typeof j>"u"||j===null)return""+j;var W=yt(j);if(W==="object"){if(j instanceof Date)return"date";if(j instanceof RegExp)return"regexp"}return W}function Y(j){var W=ht(j);switch(W){case"array":case"object":return"an "+W;case"boolean":case"date":case"regexp":return"a "+W;default:return W}}function St(j){return!j.constructor||!j.constructor.name?g:j.constructor.name}return p.checkPropTypes=i,p.resetWarningCache=i.resetWarningCache,p.PropTypes=p,p},cc}var hc,op;function xx(){if(op)return hc;op=1;var n=ac();function t(){}function e(){}return e.resetWarningCache=t,hc=function(){function r(o,a,l,c,h,f){if(f!==n){var g=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw g.name="Invariant Violation",g}}r.isRequired=r;function i(){return r}var s={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:i,element:r,elementType:r,instanceOf:i,node:r,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:e,resetWarningCache:t};return s.PropTypes=s,s},hc}var ap;function _x(){if(ap)return za.exports;if(ap=1,process.env.NODE_ENV!=="production"){var n=Qd(),t=!0;za.exports=vx()(n.isElement,t)}else za.exports=xx()();return za.exports}var bx=_x();const $=rn(bx);function up(n,t){return Array.isArray(t)?[n.a*t[0]+n.c*t[1]+n.e,n.b*t[0]+n.d*t[1]+n.f]:{x:n.a*t.x+n.c*t.y+n.e,y:n.b*t.x+n.d*t.y+n.f}}function lp(n,t){return t.map(e=>up(n,e))}function mo(n){return{a:parseFloat(n.a),b:parseFloat(n.b),c:parseFloat(n.c),d:parseFloat(n.d),e:parseFloat(n.e),f:parseFloat(n.f)}}function cp(){return{a:1,c:0,e:0,b:0,d:1,f:0}}function hp(n){const{a:t,b:e,c:r,d:i,e:s,f:o}=n,a=t*i-e*r;return{a:i/a,b:e/-a,c:r/-a,d:t/a,e:(i*s-r*o)/-a,f:(e*s-t*o)/a}}function fc(n){return typeof n>"u"}function ur(n,t=0){return{a:1,c:0,e:n,b:0,d:1,f:t}}function zn(...n){n=Array.isArray(n[0])?n[0]:n;const t=(e,r)=>({a:e.a*r.a+e.c*r.b,c:e.a*r.c+e.c*r.d,e:e.a*r.e+e.c*r.f+e.e,b:e.b*r.a+e.d*r.b,d:e.b*r.c+e.d*r.d,f:e.b*r.e+e.d*r.f+e.f});switch(n.length){case 0:throw new Error("no matrices provided");case 1:return n[0];case 2:return t(n[0],n[1]);default:{const[e,r,...i]=n,s=t(e,r);return zn(s,...i)}}}function _i(n,t=void 0,e=void 0,r=void 0){fc(t)&&(t=n);const i={a:n,c:0,e:0,b:0,d:t,f:0};return fc(e)||fc(r)?i:zn([ur(e,r),i,ur(-e,-r)])}function wx(n){return Sx(n)}function Sx(n){return`matrix(${n.a},${n.b},${n.c},${n.d},${n.e},${n.f})`}function Ex(n,t){function e(){this.constructor=n}e.prototype=t.prototype,n.prototype=new e}function Ca(n,t,e,r){var i=Error.call(this,n);return Object.setPrototypeOf&&Object.setPrototypeOf(i,Ca.prototype),i.expected=t,i.found=e,i.location=r,i.name="SyntaxError",i}Ex(Ca,Error);function dc(n,t,e){return e=e||" ",n.length>t?n:(t-=n.length,e+=e.repeat(t),n+e.slice(0,t))}Ca.prototype.format=function(n){var t="Error: "+this.message;if(this.location){var e=null,r;for(r=0;r<n.length;r++)if(n[r].source===this.location.source){e=n[r].text.split(/\r\n|\n|\r/g);break}var i=this.location.start,s=this.location.source&&typeof this.location.source.offset=="function"?this.location.source.offset(i):i,o=this.location.source+":"+s.line+":"+s.column;if(e){var a=this.location.end,l=dc("",s.line.toString().length," "),c=e[i.line-1],h=i.line===a.line?a.column:c.length+1,f=h-i.column||1;t+=`
73
+ --> `+o+`
74
+ `+l+` |
75
+ `+s.line+" | "+c+`
76
+ `+l+" | "+dc("",i.column-1," ")+dc("",f,"^")}else t+=`
77
+ at `+o}return t},Ca.buildMessage=function(n,t){var e={literal:function(c){return'"'+i(c.text)+'"'},class:function(c){var h=c.parts.map(function(f){return Array.isArray(f)?s(f[0])+"-"+s(f[1]):s(f)});return"["+(c.inverted?"^":"")+h.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(c){return c.description}};function r(c){return c.charCodeAt(0).toString(16).toUpperCase()}function i(c){return c.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(h){return"\\x0"+r(h)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(h){return"\\x"+r(h)})}function s(c){return c.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(h){return"\\x0"+r(h)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(h){return"\\x"+r(h)})}function o(c){return e[c.type](c)}function a(c){var h=c.map(o),f,g;if(h.sort(),h.length>0){for(f=1,g=1;f<h.length;f++)h[f-1]!==h[f]&&(h[g]=h[f],g++);h.length=g}switch(h.length){case 1:return h[0];case 2:return h[0]+" or "+h[1];default:return h.slice(0,-1).join(", ")+", or "+h[h.length-1]}}function l(c){return c?'"'+i(c)+'"':"end of input"}return"Expected "+a(n)+" but "+l(t)+" found."};const lr="idle",Br="panning",qr="zooming",Mr="auto",fn="none",Ar="pan",$r="zoom-in",dn="zoom-out",Ia="none",pn="top",cr="right",gn="bottom",We="left",ka="zoom",yo="pan",rs="center",ns="left",pc="right",is="top",gc="bottom",fp="cover";function dp(n,t){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),e.push.apply(e,r)}return e}function Pa(n){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?dp(Object(e),!0).forEach(function(r){Mx(n,r,e[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):dp(Object(e)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(e,r))})}return n}function Mx(n,t,e){return(t=Ax(t))in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}function Ax(n){var t=Ox(n,"string");return typeof t=="symbol"?t:t+""}function Ox(n,t){if(typeof n!="object"||!n)return n;var e=n[Symbol.toPrimitive];if(e!==void 0){var r=e.call(n,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(n)}const pp=3,gp=lr;function mp(n,t,e,r,i,s){let o=arguments.length>6&&arguments[6]!==void 0?arguments[6]:null,a=arguments.length>7&&arguments[7]!==void 0?arguments[7]:null;return te({},Pa(Pa({},cp()),{},{version:pp,mode:gp,focus:!1,pinchPointDistance:null,prePinchMode:null,viewerWidth:n,viewerHeight:t,SVGMinX:e,SVGMinY:r,SVGWidth:i,SVGHeight:s,scaleFactorMin:o,scaleFactorMax:a,startX:null,startY:null,endX:null,endY:null,miniatureOpen:!0,lastAction:null}))}function te(n,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;return n=Object.assign({},n,t,{lastAction:e}),Object.freeze(n)}function zx(n){return n!==null&&typeof n=="object"&&n.hasOwnProperty("version")&&n.version===pp}function Or(n,t,e){let r=mo(n),i=hp(r);return up(i,{x:t,y:e})}function Ra(n){let t=mo(n);return{scaleFactor:t.a,translationX:t.e,translationY:t.f}}function Tx(n,t){return te(n,{focus:t})}function Cx(n,t,e){return te(n,{viewerWidth:t,viewerHeight:e})}function yp(n,t,e,r,i){return te(n,{SVGMinX:t,SVGMinY:e,SVGWidth:r,SVGHeight:i})}function Ix(n,t,e){return te(n,{scaleFactorMin:t,scaleFactorMax:e})}function kx(n,t,e,r){let{viewerWidth:i,viewerHeight:s}=n,o=zn(ur(-t+i/2,-e+s/2),ur(t,e),_i(r,r),ur(-t,-e));return te(n,Pa({mode:lr},o))}function Px(n){return te(n,Pa({mode:lr},cp()))}function vp(n){return te(n,{mode:gp,startX:null,startY:null,endX:null,endY:null})}class xp{constructor(t,e,r){this.originalEvent=t,this.value=e,this.SVGViewer=r}get scaleFactor(){return this._cacheDecomposedValue=this._cacheDecomposedValue||Ra(this.value),this._cacheDecomposedValue.scaleFactor}get translationX(){return this._cacheDecomposedValue=this._cacheDecomposedValue||Ra(this.value),this._cacheDecomposedValue.translationX}get translationY(){return this._cacheDecomposedValue=this._cacheDecomposedValue||Ra(this.value),this._cacheDecomposedValue.translationY}preventDefault(){this.originalEvent.preventDefault()}stopPropagation(){this.originalEvent.stopPropagation()}}function _p(n,t){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),e.push.apply(e,r)}return e}function Rx(n){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?_p(Object(e),!0).forEach(function(r){Lx(n,r,e[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):_p(Object(e)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(e,r))})}return n}function Lx(n,t,e){return(t=Fx(t))in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}function Fx(n){var t=Nx(n,"string");return typeof t=="symbol"?t:t+""}function Nx(n,t){if(typeof n!="object"||!n)return n;var e=n[Symbol.toPrimitive];if(e!==void 0){var r=e.call(n,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(n)}function mc(n,t,e){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:void 0,i=zn(mo(n),ur(t,e));if(r){let[{x:s,y:o},{x:a,y:l}]=lp(i,[{x:n.SVGMinX+r,y:n.SVGMinY+r},{x:n.SVGMinX+n.SVGWidth-r,y:n.SVGMinY+n.SVGHeight-r}]),c=0;n.viewerWidth-s<0?c=n.viewerWidth-s:a<0&&(c=-a);let h=0;n.viewerHeight-o<0?h=n.viewerHeight-o:l<0&&(h=-l),i=zn(ur(c,h),i)}return te(n,Rx({mode:lr},i),yo)}function jx(n,t,e){return te(n,{mode:Br,startX:t,startY:e,endX:t,endY:e},yo)}function Vx(n,t,e,r){if(n.mode!==Br)throw new Error("update pan not allowed in this mode "+n.mode);let{endX:i,endY:s}=n,o=Or(n,i,s),a=Or(n,t,e),l=a.x-o.x,c=a.y-o.y,h=mc(n,l,c,r);return te(h,{mode:Br,endX:t,endY:e},yo)}function bp(n){return te(n,{mode:lr,startX:null,startY:null,endX:null,endY:null},yo)}function Dx(n,t,e){let r=0,i=0;return e<=20&&(i=2),n.viewerWidth-t<=20&&(r=-2),n.viewerHeight-e<=20&&(i=-2),t<=20&&(r=2),r=r/n.d,i=i/n.d,r===0&&i===0?n:mc(n,r,i)}function wp(n,t){if(n.x<=t.x&&n.y<=t.y)return{x:n.x,y:n.y,width:t.x-n.x,height:t.y-n.y};if(n.x>=t.x&&n.y<=t.y)return{x:t.x,y:n.y,width:n.x-t.x,height:t.y-n.y};if(n.x>=t.x&&n.y>=t.y)return{x:t.x,y:t.y,width:n.x-t.x,height:n.y-t.y};if(n.x<=t.x&&n.y>=t.y)return{x:n.x,y:t.y,width:t.x-n.x,height:n.y-t.y}}function Sp(n,t){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),e.push.apply(e,r)}return e}function ss(n){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?Sp(Object(e),!0).forEach(function(r){Bx(n,r,e[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):Sp(Object(e)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(e,r))})}return n}function Bx(n,t,e){return(t=qx(t))in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}function qx(n){var t=$x(n,"string");return typeof t=="symbol"?t:t+""}function $x(n,t){if(typeof n!="object"||!n)return n;var e=n[Symbol.toPrimitive];if(e!==void 0){var r=e.call(n,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(n)}function La(n,t){const{scaleFactor:e}=Ra(n),r=n.scaleFactorMin&&e*t<n.scaleFactorMin,i=n.scaleFactorMax&&e*t>n.scaleFactorMax;return r&&t<1||i&&t>1}function yc(n,t){let e=t.a;return n.scaleFactorMin!=null&&(e=Math.max(e,n.scaleFactorMin)),n.scaleFactorMax!=null&&(e=Math.min(e,n.scaleFactorMax)),te(t,{a:e,d:e})}function os(n,t,e,r){if(La(n,r))return n;const i=zn(mo(n),ur(t,e),_i(r,r),ur(-t,-e));return te(n,ss(ss({mode:lr},i),{},{startX:null,startY:null,endX:null,endY:null}),ka)}function Ep(n,t,e,r,i){let{viewerWidth:s,viewerHeight:o}=n,a=s/r,l=o/i,c=Math.min(a,l);const h=zn(_i(c,c),ur(-t,-e));return La(n,c/n.d)?te(n,{mode:lr,startX:null,startY:null,endX:null,endY:null}):te(n,ss(ss({mode:lr},yc(n,h)),{},{startX:null,startY:null,endX:null,endY:null}),ka)}function Mp(n){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ns,e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:is,{viewerWidth:r,viewerHeight:i,SVGMinX:s,SVGMinY:o,SVGWidth:a,SVGHeight:l}=n,c=r/a,h=i/l,f=Math.min(c,h),g=_i(f,f),p=-s*c,m=-o*h;if(c<h){let S=i-c*l;switch(e){case is:m=-o*f;break;case rs:m=Math.round(S/2)-o*f;break;case gc:m=S-o*f;break;case fp:g=_i(h,h);let M=r-h*a;p=s+Math.round(M/2);break}}else{let S=r-h*a;switch(t){case ns:p=-s*f;break;case rs:p=Math.round(S/2)-s*f;break;case pc:p=S-s*f;break;case fp:g=_i(c,c);let M=i-c*l;m=o+Math.round(M/2);break}}const v=ur(p,m),_=zn(v,g);return La(n,f/n.d)?te(n,{mode:lr,startX:null,startY:null,endX:null,endY:null}):te(n,ss(ss({mode:lr},yc(n,_)),{},{startX:null,startY:null,endX:null,endY:null}),ka)}function Hx(n,t){let{viewerWidth:e,viewerHeight:r}=n,i=Or(n,e/2,r/2);return os(n,i.x,i.y,t)}function Gx(n,t,e){return te(n,{mode:qr,startX:t,startY:e,endX:t,endY:e})}function Wx(n,t,e){if(n.mode!==qr)throw new Error("update selection not allowed in this mode "+n.mode);return te(n,{endX:t,endY:e})}function vc(n,t,e,r){let{startX:s,startY:o}=n,a=Or(n,s,o),l=Or(n,t,e);if(Math.abs(s-t)>7&&Math.abs(o-e)>7){let c=wp(a,l);return Ep(n,c.x,c.y,c.width,c.height)}else{let c=Or(n,t,e);return os(n,c.x,c.y,r)}}function Ux(n,t,e,r,i){return r+(i-r)*(n-t)/(e-t)}function as(n,t){let{left:e,top:r}=t.getBoundingClientRect(),i=n.clientX-Math.round(e),s=n.clientY-Math.round(r);return{x:i,y:s}}function Ap(n,t,e,r,i){let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null;const{x:o,y:a}=s||as(n,t);let l=r;switch(e){case dn:let c=Or(r,o,a);l=os(r,c.x,c.y,1/i.scaleFactor);break;case $r:l=Gx(r,o,a);break;case Mr:case Ar:l=jx(r,o,a);break;default:return r}return n.preventDefault(),l}function Op(n,t,e,r,i){let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null;const{x:o,y:a}=s||as(n,t);let l=n.buttons===0,c=r;switch(e){case $r:r.mode===qr&&(c=l?vc(r,o,a,i.scaleFactor):Wx(r,o,a));break;case Mr:case Ar:r.mode===Br&&(c=l?bp(r):Vx(r,o,a,i.preventPanOutside?20:void 0));break;default:return r}return n.preventDefault(),c}function zp(n,t,e,r,i){let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null;const{x:o,y:a}=s||as(n,t);let l=r;switch(e){case dn:r.mode===qr&&(l=vc(r,o,a,1/i.scaleFactor));break;case $r:r.mode===qr&&(l=vc(r,o,a,i.scaleFactor));break;case Mr:case Ar:r.mode===Br&&(l=bp(r));break;default:return r}return n.preventDefault(),l}function Yx(n,t,e,r,i){let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null;const{x:o,y:a}=s||as(n,t);let l=r;if(e===Mr&&!i.disableDoubleClickZoomWithToolAuto){const{modifierKeys:c=[]}=i;let h=Or(r,o,a),f=(m,v)=>m||n.getModifierState(v),p=c.reduce(f,!1)?1/i.scaleFactor:i.scaleFactor;l=os(r,h.x,h.y,p)}return n.preventDefault(),l}function Xx(n,t,e,r,i){let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null;const{x:o,y:a}=s||as(n,t);if(!i.detectWheel)return r;let l=Math.max(-1,Math.min(1,n.deltaY)),c=Ux(l,-1,1,i.scaleFactorOnWheel,1/i.scaleFactorOnWheel),h=Or(r,o,a),f=os(r,h.x,h.y,c);return n.preventDefault(),f}function Tp(n,t,e,r,i){let s=Tx(r,n.type==="mouseenter");return n.preventDefault(),s}function Jx(n,t,e,r,i){let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null,{x:o,y:a}=s;return!([fn,Mr].indexOf(e)>=0)||!i.detectAutoPan||!r.focus?r:Dx(r,o,a)}class Zx extends xp{get point(){if(!this._cachePoint){const{originalEvent:t,SVGViewer:e,value:r}=this,i=as(t,e);this._cachePoint=Or(r,i.x,i.y)}return this._cachePoint}get x(){return this.point.x}get y(){return this.point.y}}function Cp(n,t){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),e.push.apply(e,r)}return e}function Ip(n){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?Cp(Object(e),!0).forEach(function(r){Kx(n,r,e[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):Cp(Object(e)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(e,r))})}return n}function Kx(n,t,e){return(t=Qx(t))in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}function Qx(n){var t=t_(n,"string");return typeof t=="symbol"?t:t+""}function t_(n,t){if(typeof n!="object"||!n)return n;var e=n[Symbol.toPrimitive];if(e!==void 0){var r=e.call(n,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(n)}class Fa extends xp{get points(){return this._cachePoints||(this._cachePoints=Fa.touchesToPoints(this.originalEvent.touches,this.SVGViewer,this.value)),this._cachePoints}get changedPoints(){return this._cacheChangedPoints||(this._cacheChangedPoints=Fa.touchesToPoints(this.originalEvent.changedTouches,this.SVGViewer,this.value)),this._cacheChangedPoints}static touchesToPoints(t,e,r){let i=[];for(let s=0;s<t.length;s++){let o=t[s],a=e.getBoundingClientRect(),l=o.clientX-Math.round(a.left),c=o.clientY-Math.round(a.top),h=Or(r,l,c);i.push(Ip(Ip({},h),{},{identifier:o.identifier}))}return i}}function e_(n,t,e){let r=n.type;switch(r){case"mousemove":case"mouseup":case"mousedown":case"click":case"dblclick":return new Zx(n,t,e);case"touchstart":case"touchmove":case"touchend":case"touchcancel":return new Fa(n,t,e);default:throw new Error(`${r} not supported`)}}function kp(n){return n.split(/[ ,]/).filter(Boolean).map(Number)}function Pp(n,t){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),e.push.apply(e,r)}return e}function Rp(n){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?Pp(Object(e),!0).forEach(function(r){r_(n,r,e[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):Pp(Object(e)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(e,r))})}return n}function r_(n,t,e){return(t=n_(t))in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}function n_(n){var t=i_(n,"string");return typeof t=="symbol"?t:t+""}function i_(n,t){if(typeof n!="object"||!n)return n;var e=n[Symbol.toPrimitive];if(e!==void 0){var r=e.call(n,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(n)}function s_(n,t){let{left:e,top:r}=t.getBoundingClientRect(),i=n.clientX-Math.round(e),s=n.clientY-Math.round(r);return{x:i,y:s}}function o_(n,t,e,r,i){if(Fp(n,i))return Np(n,t,e,r);if(n.touches.length!==1){if([Br,qr].indexOf(r.mode)>=0)return vp(r);if([lr].indexOf(r.mode)>=0)return r}return xc(n,t,e,r,i,Ap)}function a_(n,t,e,r,i){return Fp(n,i)?Np(n,t,e,r):[Br,qr].indexOf(r.mode)>=0?xc(n,t,e,r,i,Op):r}function u_(n,t,e,r,i){if(!([Br,qr].indexOf(r.mode)>=0))return r;let s=c_(n,r,i)?te(r,{pinchPointDistance:null}):r;return n.touches.length>0?s:xc(n,t,e,s,i,zp)}function l_(n,t,e,r,i){return n.stopPropagation(),n.preventDefault(),vp(r)}function Lp(n){return typeof n.pinchPointDistance=="number"}function c_(n,t,e){return e.detectPinchGesture&&Lp(t)&&n.touches.length<2}function Fp(n,t){return t.detectPinchGesture&&n.touches.length>1}function xc(n,t,e,r,i,s){let o=n.touches.length===0?te(r,{mode:r.prePinchMode?lr:r.mode,prePinchMode:null}):r,a=n.touches.length>0?n.touches[0]:n.changedTouches[0],l=s_(a,t);switch(e){case dn:case $r:case Mr:case Ar:return n.stopPropagation(),n.preventDefault(),s(n,t,e,o,i,l);default:return o}}function Np(n,t,e,r,i){const{left:s,top:o}=t.getBoundingClientRect(),a=n.touches[0].clientX-Math.round(s),l=n.touches[0].clientY-Math.round(o),c=n.touches[1].clientX-Math.round(s),h=n.touches[1].clientY-Math.round(o),f=Math.sqrt(Math.pow(c-a,2)+Math.pow(h-l,2)),g=Lp(r)?r.pinchPointDistance:f,p=Or(r,(a+c)/2,(l+h)/2);let m=f/g;if(La(r,m))return r;n.cancelable&&n.preventDefault();let v=zn(mo(r),ur(p.x,p.y),_i(m,m),ur(-p.x,-p.y));return te(r,te(Rp(Rp({mode:qr},yc(r,v)),{},{startX:null,startY:null,endX:null,endY:null,prePinchMode:r.prePinchMode?r.prePinchMode:r.mode,pinchPointDistance:f})))}function jp(n){return te(n,{miniatureOpen:!0})}function Vp(n){return te(n,{miniatureOpen:!1})}let h_=n=>["zoom-in","zoom-out","grab","grabbing"].indexOf(n)>-1,Dp=()=>navigator.userAgent.toLowerCase(),f_=()=>Dp().indexOf("firefox")>-1,d_=()=>Dp().indexOf("webkit")>-1;function Na(n){if(!h_(n))return n;if(f_())return`-moz-${n}`;if(d_())return`-webkit-${n}`}function p_(n){return n.displayName||n.name||"Component"}function _c(){return _c=Object.assign?Object.assign.bind():function(n){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var r in e)({}).hasOwnProperty.call(e,r)&&(n[r]=e[r])}return n},_c.apply(null,arguments)}let g_=1;const m_=()=>`uid${g_++}`;function Bp(n){class t extends N.Component{constructor(r){super(r),this.state={uid:m_()}}render(){return N.createElement(n,_c({_uid:this.state.uid},this.props))}}return t.displayName=`RandomUID(${p_(n)})`,t}const qp="react-svg-pan-zoom_border_gradient";function $p(n){let{direction:t,width:e,height:r,_uid:i}=n,s;switch(t){case pn:s=`translate(${e}, 0) rotate(90)`;break;case cr:s=`translate(${e}, ${r}) rotate(180)`;break;case gn:s=`translate(0, ${r}) rotate(270)`;break;case We:default:s=" ";break}let o=`${qp}_gradient_${i}`,a=`${qp}_mask_${i}`;return N.createElement("g",null,N.createElement("defs",null,N.createElement("linearGradient",{id:o,x1:"0%",y1:"0%",x2:"100%",y2:"0%",spreadMethod:"pad"},N.createElement("stop",{offset:"0%",stopColor:"#fff",stopOpacity:"0.8"}),N.createElement("stop",{offset:"100%",stopColor:"#000",stopOpacity:"0.5"})),N.createElement("mask",{id:a,x:"0",y:"0",width:"20",height:Math.max(e,r)},N.createElement("rect",{x:"0",y:"0",width:"20",height:Math.max(e,r),style:{stroke:"none",fill:`url(#${o})`}}))),N.createElement("rect",{x:"0",y:"0",width:"20",height:Math.max(e,r),style:{stroke:"none",fill:"#000",mask:`url(#${a})`},transform:s}))}$p.propTypes={direction:$.oneOf([pn,cr,gn,We]).isRequired,width:$.number.isRequired,height:$.number.isRequired};const ja=Bp($p);function Hp(n){let{startX:t,startY:e,endX:r,endY:i}=n;if(!t||!e||!r||!i)return null;let s=wp({x:t,y:e},{x:r,y:i});return N.createElement("rect",{stroke:"#969FFF",strokeOpacity:.7,fill:"#F3F4FF",fillOpacity:.7,x:s.x,y:s.y,width:s.width,height:s.height,style:{pointerEvents:"none"}})}Hp.propTypes={startX:$.number,startY:$.number,endX:$.number,endY:$.number};function y_(){return N.createElement("svg",{width:24,height:24,stroke:"currentColor"},N.createElement("path",{d:"M10.07,14.27C10.57,14.03 11.16,14.25 11.4,14.75L13.7,19.74L15.5,18.89L13.19,13.91C12.95,13.41 13.17,12.81 13.67,12.58L13.95,12.5L16.25,12.05L8,5.12V15.9L9.82,14.43L10.07,14.27M13.64,21.97C13.14,22.21 12.54,22 12.31,21.5L10.13,16.76L7.62,18.78C7.45,18.92 7.24,19 7,19A1,1 0 0,1 6,18V3A1,1 0 0,1 7,2C7.24,2 7.47,2.09 7.64,2.23L7.65,2.22L19.14,11.86C19.57,12.22 19.62,12.85 19.27,13.27C19.12,13.45 18.91,13.57 18.7,13.61L15.54,14.23L17.74,18.96C18,19.46 17.76,20.05 17.26,20.28L13.64,21.97Z"}))}function v_(){return N.createElement("svg",{width:24,height:24,stroke:"currentColor"},N.createElement("path",{d:"M13,6V11H18V7.75L22.25,12L18,16.25V13H13V18H16.25L12,22.25L7.75,18H11V13H6V16.25L1.75,12L6,7.75V11H11V6H7.75L12,1.75L16.25,6H13Z"}))}function x_(){return N.createElement("svg",{width:24,height:24,stroke:"currentColor"},N.createElement("g",null,N.createElement("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}),N.createElement("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z"})))}function __(){return N.createElement("svg",{width:24,height:24,stroke:"currentColor"},N.createElement("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zM7 9h5v1H7z"}))}function b_(){return N.createElement("svg",{width:24,height:24,stroke:"currentColor"},N.createElement("path",{d:"M15 3l2.3 2.3-2.89 2.87 1.42 1.42L18.7 6.7 21 9V3zM3 9l2.3-2.3 2.87 2.89 1.42-1.42L6.7 5.3 9 3H3zm6 12l-2.3-2.3 2.89-2.87-1.42-1.42L5.3 17.3 3 15v6zm12-6l-2.3 2.3-2.87-2.89-1.42 1.42 2.89 2.87L15 21h6z"}))}let us=class extends N.Component{constructor(t){super(t),this.state={hover:!1}}change(t){switch(t.preventDefault(),t.stopPropagation(),t.type){case"mouseenter":case"touchstart":this.setState({hover:!0});break;case"mouseleave":case"touchend":case"touchcancel":this.setState({hover:!1});break}}render(){let t={display:"block",width:"24px",height:"24px",margin:[pn,gn].indexOf(this.props.toolbarPosition)>=0?"2px 1px":"1px 2px",color:this.props.active||this.state.hover?this.props.activeColor:"#FFF",transition:"color 200ms ease",background:"none",padding:"0px",border:"0px",outline:"0px",cursor:"pointer"};return N.createElement("button",{onMouseEnter:e=>this.change(e),onMouseLeave:e=>this.change(e),onTouchStart:e=>{this.change(e),this.props.onClick(e)},onTouchEnd:e=>this.change(e),onTouchCancel:e=>this.change(e),onClick:this.props.onClick,style:t,title:this.props.title,name:this.props.name,type:"button"},this.props.children)}};us.propTypes={title:$.string.isRequired,name:$.string.isRequired,toolbarPosition:$.string.isRequired,activeColor:$.string.isRequired,onClick:$.func.isRequired,active:$.bool.isRequired};const w_="#1CA6FC";function Gp(n){let{tool:t,value:e,onChangeValue:r,onChangeTool:i,activeToolColor:s=w_,position:o=cr,SVGAlignX:a=ns,SVGAlignY:l=is}=n,c=(p,m)=>{i(m),p.stopPropagation(),p.preventDefault()},h=p=>{r(Mp(e,a,l)),p.stopPropagation(),p.preventDefault()},f=[pn,gn].indexOf(o)>=0,g={position:"absolute",transform:[pn,gn].indexOf(o)>=0?"translate(-50%, 0px)":"none",top:[We,cr,pn].indexOf(o)>=0?"5px":"unset",left:[pn,gn].indexOf(o)>=0?"50%":We===o?"5px":"unset",right:[cr].indexOf(o)>=0?"5px":"unset",bottom:[gn].indexOf(o)>=0?"5px":"unset",backgroundColor:"rgba(19, 20, 22, 0.90)",borderRadius:"2px",display:"flex",flexDirection:f?"row":"column",padding:f?"1px 2px":"2px 1px"};return N.createElement("div",{style:g,role:"toolbar"},N.createElement(us,{toolbarPosition:o,active:t===fn,activeColor:s,name:"unselect-tools",title:"Selection",onClick:p=>c(p,fn)},N.createElement(y_,null)),N.createElement(us,{toolbarPosition:o,active:t===Ar,activeColor:s,name:"select-tool-pan",title:"Pan",onClick:p=>c(p,Ar)},N.createElement(v_,null)),N.createElement(us,{toolbarPosition:o,active:t===$r,activeColor:s,name:"select-tool-zoom-in",title:"Zoom in",onClick:p=>c(p,$r)},N.createElement(x_,null)),N.createElement(us,{toolbarPosition:o,active:t===dn,activeColor:s,name:"select-tool-zoom-out",title:"Zoom out",onClick:p=>c(p,dn)},N.createElement(__,null)),N.createElement(us,{toolbarPosition:o,active:!1,activeColor:s,name:"fit-to-viewer",title:"Fit to viewer",onClick:p=>h(p)},N.createElement(b_,null)))}Gp.propTypes={tool:$.string.isRequired,onChangeTool:$.func.isRequired,value:$.object.isRequired,onChangeValue:$.func.isRequired,position:$.oneOf([pn,cr,gn,We]),SVGAlignX:$.oneOf([rs,ns,pc]),SVGAlignY:$.oneOf([rs,is,gc]),activeToolColor:$.string};function S_(){return"ontouchstart"in window||navigator.maxTouchPoints}function Wp(n){let{open:t,position:e}=n,r=0;switch(e){case We:r=t?"rotate(225, 12, 13)":"rotate(45, 12, 13)";break;case cr:r=r=t?"rotate(135, 12, 13)":"rotate(-45, 12, 13)";break}return N.createElement("svg",{width:24,height:24,stroke:"currentColor"},N.createElement("g",{transform:r},N.createElement("path",{fill:"#000000",d:"M7.41,15.41L12,10.83L16.59,15.41L18,14L12,8L6,14L7.41,15.41Z"})))}Wp.propTypes={open:$.bool.isRequired,position:$.oneOf([cr,We]).isRequired};function Up(n){let{value:t,onChangeValue:e,position:r}=n,i={width:"24px",height:"24px",display:"block",position:"absolute",bottom:0,[r===We?"left":"right"]:"0px",background:"rgba(19, 20, 22, 0.901961)",border:0,padding:0,outline:0,color:"#fff"},s=t.miniatureOpen?Vp:jp;return N.createElement("button",{type:"button",style:i,onClick:()=>e(s(t))},N.createElement(Wp,{open:t.miniatureOpen,position:r}))}Up.propTypes={value:$.object.isRequired,onChangeValue:$.func.isRequired,position:$.oneOf([cr,We]).isRequired};const E_="react-svg-pan-zoom_miniature";function Yp(n){let{SVGMinX:t,SVGMinY:e,SVGWidth:r,SVGHeight:i,x1:s,y1:o,x2:a,y2:l,zoomToFit:c,_uid:h}=n;const f=`${E_}_mask_${h}`;return N.createElement("g",null,N.createElement("defs",null,N.createElement("mask",{id:f},N.createElement("rect",{x:t,y:e,width:r,height:i,fill:"#ffffff"}),N.createElement("rect",{x:s,y:o,width:a-s,height:l-o}))),N.createElement("rect",{x:t,y:e,width:r,height:i,style:{stroke:"none",fill:"#000",mask:`url(#${f})`,opacity:.4}}))}Yp.propTypes={SVGWidth:$.number.isRequired,SVGHeight:$.number.isRequired,SVGMinX:$.number.isRequired,SVGMinY:$.number.isRequired,x1:$.number.isRequired,y1:$.number.isRequired,x2:$.number.isRequired,y2:$.number.isRequired,zoomToFit:$.number.isRequired};const M_=Bp(Yp),A_="#616264";function Xp(n){let{value:t,onChangeValue:e,children:r,SVGBackground:i,background:s=A_,position:o=We,width:a=100,height:l=80}=n,{SVGMinX:c,SVGMinY:h,SVGWidth:f,SVGHeight:g,viewerWidth:p,viewerHeight:m}=t,v=g/f,_=v>=1?l/g:a/f,[{x:S,y:M},{x:T,y:C}]=lp(hp(t),[{x:0,y:0},{x:p,y:m}]),E,z;t.miniatureOpen?(E=a,z=l):(E=24,z=24);let R={position:"absolute",overflow:"hidden",outline:"1px solid rgba(19, 20, 22, 0.90)",transition:"width 200ms ease, height 200ms ease, bottom 200ms ease",width:E+"px",height:z+"px",bottom:"6px",[o===We?"left":"right"]:"6px",background:s},k=v>=1?`translate(${(a-f*_)/2-c*_}, ${-h*_})`:`translate(${-c*_}, ${(l-g*_)/2-h*_})`;return N.createElement("div",{role:"navigation",style:R},N.createElement("svg",{width:a,height:l,style:{pointerEvents:"none"}},N.createElement("g",{transform:k},N.createElement("g",{transform:`scale(${_}, ${_})`},N.createElement("rect",{fill:i,x:c,y:h,width:f,height:g}),r,N.createElement(M_,{SVGWidth:f,SVGHeight:g,SVGMinX:c,SVGMinY:h,x1:S,y1:M,x2:T,y2:C,zoomToFit:_})))),N.createElement(Up,{value:t,onChangeValue:e,position:o}))}Xp.propTypes={value:$.object.isRequired,onChangeValue:$.func.isRequired,SVGBackground:$.string.isRequired,position:$.oneOf([cr,We]),background:$.string,width:$.number,height:$.number};function bi(n){return typeof n>"u"||n===null}const bc="https://github.com/chrvadala/react-svg-pan-zoom/blob/main"+"/docs/migrate-from-v2-to-v3.md";function O_(){console.error(`HEY! With ReactSVGPanZoom >= 3 you MUST specify value and tool props. Please read here ${bc}`)}function z_(){console.error(`HEY! With ReactSVGPanZoom >= 3 the props miniaturePosition, miniatureBackground, miniatureWidth, miniatureHeight can be specified as key in the miniatureProps object. Please read here ${bc}`)}function T_(){console.error(`HEY! With ReactSVGPanZoom >= 3 the prop toolbarPosition can be specified as key in the toolbarProps object. Please read here ${bc}`)}function Jp(n){(bi(n.tool)||bi(n.value))&&O_(),(!bi(n.miniaturePosition)||!bi(n.miniatureBackground)||!bi(n.miniatureWidth)||!bi(n.miniatureHeight))&&z_(),bi(n.toolbarPosition)||T_()}function Va(){return Va=Object.assign?Object.assign.bind():function(n){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var r in e)({}).hasOwnProperty.call(e,r)&&(n[r]=e[r])}return n},Va.apply(null,arguments)}function Zp(n,t){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),e.push.apply(e,r)}return e}function C_(n){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?Zp(Object(e),!0).forEach(function(r){I_(n,r,e[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):Zp(Object(e)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(e,r))})}return n}function I_(n,t,e){return(t=k_(t))in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}function k_(n){var t=P_(n,"string");return typeof t=="symbol"?t:t+""}function P_(n,t){if(typeof n!="object"||!n)return n;var e=n[Symbol.toPrimitive];if(e!==void 0){var r=e.call(n,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(n)}class Da extends N.Component{constructor(t,e){const{width:r,height:i,scaleFactorMin:s,scaleFactorMax:o,children:a}=t,{viewBox:l}=a.props;let c;if(l){const[h,f,g,p]=kp(l);c=mp(r,i,h,f,g,p,s,o)}else{const{width:h,height:f}=a.props;c=mp(r,i,0,0,h,f,s,o)}super(t,e),this.ViewerDOM=null,this.state={pointerX:null,pointerY:null,defaultValue:c},this.autoPanLoop=this.autoPanLoop.bind(this),this.onWheel=this.onWheel.bind(this),process.env.NODE_ENV!=="production"&&Jp(t)}componentDidUpdate(t){const e=this.getValue(),r=this.props;let i=e,s=!1;process.env.NODE_ENV!=="production"&&Jp(r);const{viewBox:o}=r.children.props;if(o){const[a,l,c,h]=kp(o);(e.SVGMinX!==a||e.SVGMinY!==l||e.SVGWidth!==c||e.SVGHeight!==h)&&(i=yp(i,a,l,c,h),s=!0)}else{const{width:a,height:l}=r.children.props;(e.SVGWidth!==a||e.SVGHeight!==l)&&(i=yp(i,0,0,a,l),s=!0)}(t.width!==r.width||t.height!==r.height)&&(i=Cx(i,r.width,r.height),s=!0),(t.scaleFactorMin!==r.scaleFactorMin||t.scaleFactorMax!==r.scaleFactorMax)&&(i=Ix(i,r.scaleFactorMin,r.scaleFactorMax),s=!0),s&&this.setValue(i)}componentDidMount(){this.autoPanIsRunning=!0,requestAnimationFrame(this.autoPanLoop),this.ViewerDOM.addEventListener("wheel",this.onWheel,!1)}componentWillUnmount(){this.autoPanIsRunning=!1,this.ViewerDOM.removeEventListener("wheel",this.onWheel)}getValue(){return zx(this.props.value)?this.props.value:this.state.defaultValue}getTool(){return this.props.tool?this.props.tool:fn}setValue(t){let{onChangeValue:e,onZoom:r,onPan:i}=this.props;e&&e(t),t.lastAction&&(r&&t.lastAction===ka&&r(t),i&&t.lastAction===yo&&i(t))}pan(t,e){let r=mc(this.getValue(),t,e);this.setValue(r)}zoom(t,e,r){let i=os(this.getValue(),t,e,r);this.setValue(i)}fitSelection(t,e,r,i){let s=Ep(this.getValue(),t,e,r,i);this.setValue(s)}fitToViewer(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ns,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:is,r=Mp(this.getValue(),t,e);this.setValue(r)}zoomOnViewerCenter(t){let e=Hx(this.getValue(),t);this.setValue(e)}setPointOnViewerCenter(t,e,r){let i=kx(this.getValue(),t,e,r);this.setValue(i)}reset(){let t=Px(this.getValue());this.setValue(t)}openMiniature(){let t=jp(this.getValue());this.setValue(t)}closeMiniature(){let t=Vp(this.getValue());this.setValue(t)}handleViewerEvent(t){let{props:e,ViewerDOM:r}=this;if(!([fn,Mr].indexOf(this.getTool())>=0)||t.target===r)return;let s={click:e.onClick,dblclick:e.onDoubleClick,mousemove:e.onMouseMove,mouseup:e.onMouseUp,mousedown:e.onMouseDown,touchstart:e.onTouchStart,touchmove:e.onTouchMove,touchend:e.onTouchEnd,touchcancel:e.onTouchCancel}[t.type];s&&s(e_(t,e.value,r))}autoPanLoop(){let t={x:this.state.pointerX,y:this.state.pointerY},e=Jx(null,this.ViewerDOM,this.getTool(),this.getValue(),this.props,t);this.getValue()!==e&&this.setValue(e),this.autoPanIsRunning&&requestAnimationFrame(this.autoPanLoop)}onWheel(t){let e=Xx(t,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==e&&this.setValue(e)}render(){let{props:t,state:{pointerX:e,pointerY:r}}=this,i=this.getTool(),s=this.getValue(),{customToolbar:o=Gp,customMiniature:a=Xp}=t,l=i===Mr&&s.mode===Br&&s.startX!==s.endX&&s.startY!==s.endY,c;i===Ar&&(c=Na(s.mode===Br?"grabbing":"grab")),i===$r&&(c=Na("zoom-in")),i===dn&&(c=Na("zoom-out")),l&&(c=Na("grabbing"));let h=[Ar,$r,dn].indexOf(i)>=0;h=h||l;const f=this.props.detectPinchGesture||[Ar,Mr].indexOf(this.getTool())!==-1?"none":void 0,g={display:"block",cursor:c,touchAction:f};return N.createElement("div",{style:C_({position:"relative",width:s.viewerWidth,height:s.viewerHeight},t.style),className:this.props.className},N.createElement("svg",{ref:p=>this.ViewerDOM=p,width:s.viewerWidth,height:s.viewerHeight,style:g,onMouseDown:p=>{let m=Ap(p,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m),this.handleViewerEvent(p)},onMouseMove:p=>{let{left:m,top:v}=this.ViewerDOM.getBoundingClientRect(),_=p.clientX-Math.round(m),S=p.clientY-Math.round(v),M=Op(p,this.ViewerDOM,this.getTool(),this.getValue(),this.props,{x:_,y:S});this.getValue()!==M&&this.setValue(M),this.setState({pointerX:_,pointerY:S}),this.handleViewerEvent(p)},onMouseUp:p=>{let m=zp(p,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m),this.handleViewerEvent(p)},onClick:p=>{this.handleViewerEvent(p)},onDoubleClick:p=>{let m=Yx(p,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m),this.handleViewerEvent(p)},onMouseEnter:p=>{if(S_())return;let m=Tp(p,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m)},onMouseLeave:p=>{let m=Tp(p,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m)},onTouchStart:p=>{let m=o_(p,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m),this.handleViewerEvent(p)},onTouchMove:p=>{let m=a_(p,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m),this.handleViewerEvent(p)},onTouchEnd:p=>{let m=u_(p,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m),this.handleViewerEvent(p)},onTouchCancel:p=>{let m=l_(p,this.ViewerDOM,this.getTool(),this.getValue(),this.props);this.getValue()!==m&&this.setValue(m),this.handleViewerEvent(p)}},N.createElement("rect",{fill:t.background,x:0,y:0,width:s.viewerWidth,height:s.viewerHeight,style:{pointerEvents:"none"}}),N.createElement("g",{transform:wx(s),style:h?{pointerEvents:"none"}:{}},N.createElement("rect",{fill:this.props.SVGBackground,style:this.props.SVGStyle,x:s.SVGMinX||0,y:s.SVGMinY||0,width:s.SVGWidth,height:s.SVGHeight}),N.createElement("g",null,t.children.props.children)),[fn,Mr].indexOf(i)>=0&&t.detectAutoPan&&s.focus?N.createElement("g",{style:{pointerEvents:"none"}},r<=20?N.createElement(ja,{direction:pn,width:s.viewerWidth,height:s.viewerHeight}):null,s.viewerWidth-e<=20?N.createElement(ja,{direction:cr,width:s.viewerWidth,height:s.viewerHeight}):null,s.viewerHeight-r<=20?N.createElement(ja,{direction:gn,width:s.viewerWidth,height:s.viewerHeight}):null,s.focus&&e<=20?N.createElement(ja,{direction:We,width:s.viewerWidth,height:s.viewerHeight}):null):null,s.mode!==qr?null:N.createElement(Hp,{startX:s.startX,startY:s.startY,endX:s.endX,endY:s.endY})),t.toolbarProps.position===Ia?null:N.createElement(o,Va({},this.props.toolbarProps,{value:s,onChangeValue:p=>this.setValue(p),tool:i,onChangeTool:p=>this.props.onChangeTool(p)})),t.miniatureProps.position===Ia?null:N.createElement(a,Va({},this.props.miniatureProps,{value:s,onChangeValue:p=>this.setValue(p),SVGBackground:this.props.SVGBackground}),t.children.props.children))}}Da.propTypes={width:$.number.isRequired,height:$.number.isRequired,value:$.oneOfType([$.object,$.shape({version:$.oneOf([2]).isRequired,mode:$.oneOf([lr,Br,qr]).isRequired,focus:$.bool.isRequired,a:$.number.isRequired,b:$.number.isRequired,c:$.number.isRequired,d:$.number.isRequired,e:$.number.isRequired,f:$.number.isRequired,viewerWidth:$.number.isRequired,viewerHeight:$.number.isRequired,SVGMinX:$.number.isRequired,SVGMinY:$.number.isRequired,SVGWidth:$.number.isRequired,SVGHeight:$.number.isRequired,startX:$.number,startY:$.number,endX:$.number,endY:$.number,miniatureOpen:$.bool.isRequired})]).isRequired,onChangeValue:$.func.isRequired,tool:$.oneOf([Mr,fn,Ar,$r,dn]).isRequired,onChangeTool:$.func.isRequired,background:$.string,SVGBackground:$.string,SVGStyle:$.object,style:$.object,className:$.string,detectWheel:$.bool,detectAutoPan:$.bool,detectPinchGesture:$.bool,onZoom:$.func,onPan:$.func,onClick:$.func,onDoubleClick:$.func,onMouseUp:$.func,onMouseMove:$.func,onMouseDown:$.func,preventPanOutside:$.bool,scaleFactor:$.number,scaleFactorOnWheel:$.number,scaleFactorMax:$.number,scaleFactorMin:$.number,modifierKeys:$.array,disableDoubleClickZoomWithToolAuto:$.bool,customMiniature:$.oneOfType([$.element,$.func]),miniatureProps:$.shape({position:$.oneOf([Ia,cr,We]),background:$.string,width:$.number,height:$.number}),customToolbar:$.oneOfType([$.element,$.func]),toolbarProps:$.shape({position:$.oneOf([Ia,pn,cr,gn,We]),SVGAlignX:$.oneOf([rs,ns,pc]),SVGAlignY:$.oneOf([rs,is,gc]),activeToolColor:$.string}),children:function(n,t,e){let r=n[t],i=["svg"];if(N.Children.count(r)!==1||i.indexOf(r.type)===-1)return new Error("`"+e+"` should have a single child of the following types: `"+i.join("`, `")+"`.");if((!r.props.hasOwnProperty("width")||!r.props.hasOwnProperty("height"))&&!r.props.hasOwnProperty("viewBox"))return new Error("SVG should have props `width` and `height` or `viewBox`")}},Da.defaultProps={style:{},background:"#616264",SVGBackground:"#fff",SVGStyle:{},detectWheel:!0,detectAutoPan:!0,detectPinchGesture:!0,modifierKeys:["Alt","Shift","Control"],preventPanOutside:!0,scaleFactor:1.1,scaleFactorOnWheel:1.06,disableZoomWithToolAuto:!1,onZoom:null,onPan:null,toolbarProps:{},miniatureProps:{}};const R_=["width","height","onChangeTool","onChangeValue"];function wc(){return wc=Object.assign?Object.assign.bind():function(n){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var r in e)({}).hasOwnProperty.call(e,r)&&(n[r]=e[r])}return n},wc.apply(null,arguments)}function L_(n,t){if(n==null)return{};var e,r,i=F_(n,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(r=0;r<s.length;r++)e=s[r],t.includes(e)||{}.propertyIsEnumerable.call(n,e)&&(i[e]=n[e])}return i}function F_(n,t){if(n==null)return{};var e={};for(var r in n)if({}.hasOwnProperty.call(n,r)){if(t.includes(r))continue;e[r]=n[r]}return e}class N_ extends N.Component{constructor(t){super(t),this.state={value:t.defaultValue||{},tool:t.defaultTool||fn},this.Viewer=null,this.changeTool=this.changeTool.bind(this),this.changeValue=this.changeValue.bind(this)}changeTool(t){this.setState({tool:t})}changeValue(t){this.setState({value:t})}pan(t,e){this.Viewer.pan(t,e)}zoom(t,e,r){this.Viewer.zoom(t,e,r)}fitSelection(t,e,r,i){this.Viewer.fitSelection(t,e,r,i)}fitToViewer(t,e){this.Viewer.fitToViewer(t,e)}zoomOnViewerCenter(t){this.Viewer.zoomOnViewerCenter(t)}setPointOnViewerCenter(t,e,r){this.Viewer.setPointOnViewerCenter(t,e,r)}reset(){this.Viewer.reset()}openMiniature(){this.Viewer.openMiniature()}closeMiniature(){this.Viewer.closeMiniature()}render(){const t=this.props,{width:e,height:r,onChangeTool:i,onChangeValue:s}=t,o=L_(t,R_),{tool:a,value:l}=this.state;return N.createElement(Da,wc({width:e,height:r,tool:a,onChangeTool:this.changeTool,value:l,onChangeValue:this.changeValue,ref:c=>this.Viewer=c},o))}}N_.propTypes={width:$.number.isRequired,height:$.number.isRequired,defaultValue:$.object,defaultTool:$.string};const ne=h0(n=>({planner:new ba,viewer:null,plan:null,activeFloor:0,setViewer:t=>{n(e=>({...e,viewer:t}))},setActiveFloor:t=>{n(e=>({...e,activeFloor:t}))},newProject:()=>{n(t=>({...t,planner:Jt.newProject(t.planner).updatedState}))},selectTool3DView:()=>{n(t=>{const e=Jt.rollback(t.planner).updatedState;return e.set("mode",vi),{...t,planner:e}})},selectTool3DFirstPerson:()=>{n(t=>{const e=Jt.rollback(t.planner).updatedState;return e.set("mode",Qi),{...t,planner:e}})},loadProject:t=>{n(e=>{const r=new ba({scene:t,catalog:e.planner.catalog.toJS()});return{...e,planner:r}})},undo:()=>{n(t=>{const e=Jt.undo(t.planner).updatedState;return{...t,planner:e}})},redo:()=>{n(t=>{const e=Jt.redo(t.planner).updatedState;return{...t,planner:e}})},addLayer:(t,e)=>{n(r=>{const i=wt.create(r.planner,t,e).updatedState;return{...r,planner:i}})},removeLayer:t=>{n(e=>{const r=wt.remove(e.planner,t).updatedState;return{...e,planner:r}})},addGroup:()=>{n(t=>{const e=_e.create(t.planner).updatedState;return{...t,planner:e}})},selectGroup:t=>{n(e=>{const r=_e.select(e.planner,t).updatedState;return{...e,planner:r}})},setGroupProperties:(t,e)=>{n(r=>{const i=_e.setProperties(r.planner,t,e).updatedState;return{...r,planner:i}})},addToGroup:(t,e,r,i)=>{n(s=>{const o=_e.addElement(s.planner,t,e,r,i).updatedState;return{...s,planner:o}})},removeGroup:t=>{n(e=>{const r=_e.remove(e.planner,t).updatedState;return{...e,planner:r}})},setGroupAttributes:(t,e)=>{n(r=>{const i=_e.setAttributes(r.planner,t,e).updatedState;return{...r,planner:i}})},groupTranslate:(t,e,r)=>{n(i=>{const s=_e.translate(i.planner,t,e,r).updatedState;return{...i,planner:s}})},removeFromGroup:(t,e,r,i)=>{n(s=>{const o=_e.removeElement(s.planner,t,e,r,i).updatedState;return{...s,planner:o}})},groupRotate:(t,e)=>{n(r=>{const i=_e.rotate(r.planner,t,e).updatedState;return{...r,planner:i}})},removeGroupAndDeleteElements:t=>{n(e=>{const r=_e.removeAndDeleteElements(e.planner,t).updatedState;return{...e,planner:r}})},addGroupFromSelected:()=>{n(t=>{const e=_e.createFromSelectedElements(t.planner).updatedState;return{...t,planner:e}})},copyProperties:t=>{n(e=>({...e,planner:Jt.copyProperties(e.planner,t).updatedState}))},pasteProperties:()=>{n(t=>{const e=t.planner.merge({sceneHistory:de(t.planner.sceneHistory,t.planner.scene)});return{...t,planner:Jt.pasteProperties(e).updatedState}})},setProperties:t=>{n(e=>{const r=e.planner.merge({sceneHistory:de(e.planner.sceneHistory,e.planner.scene)});return{...e,planner:Jt.setProperties(r,r.getIn(["scene","selectedLayer"]),t).updatedState}})},setHolesAttributes:t=>{n(e=>{const r=t.set("offset",parseFloat(t.get("offset"))),i=e.planner.merge({sceneHistory:de(e.planner.sceneHistory,e.planner.scene)});return{...e,planner:Jt.setHolesAttributes(i,r).updatedState}})},setLinesAttributes:t=>{n(e=>{const r=t.withMutations(s=>{s.setIn(["vertexOne","x"],parseFloat(t.getIn(["vertexOne","x"]))),s.setIn(["vertexOne","y"],parseFloat(t.getIn(["vertexOne","y"]))),s.setIn(["vertexTwo","x"],parseFloat(t.getIn(["vertexTwo","x"]))),s.setIn(["vertexTwo","y"],parseFloat(t.getIn(["vertexTwo","y"])))}),i=e.planner.merge({sceneHistory:de(e.planner.sceneHistory,e.planner.scene)});return{...e,planner:Jt.setLinesAttributes(i,r).updatedState}})},setItemsAttributes:t=>{n(e=>{const r=t.set("rotation",parseFloat(t.get("rotation"))),i=e.planner.merge({sceneHistory:de(e.planner.sceneHistory,e.planner.scene)});return{...e,planner:Jt.setItemsAttributes(i,r).updatedState}})},selectLine:(t,e)=>{n(r=>{const i=Ie.select(r.planner,t,e).updatedState;return{...r,planner:i}})},selectHole:(t,e)=>{n(r=>{const i=xe.select(r.planner,t,e).updatedState;return{...r,planner:i}})},selectItem:(t,e)=>{n(r=>{const i=Me.select(r.planner,t,e).updatedState;return{...r,planner:i}})},selectLayer:t=>{n(e=>{const r=wt.select(e.planner,t).updatedState;return{...e,planner:r}})},setLayerProperties:(t,e)=>{n(r=>{const i=wt.setProperties(r.planner,t,e).updatedState;return{...r,planner:i}})},addVerticalGuide:t=>{n(e=>{const r=Oa.create(e.planner,t).updatedState;return{...e,planner:r}})},addHorizontalGuide:t=>{n(e=>{const r=Aa.create(e.planner,t).updatedState;return{...e,planner:r}})},removeVerticalGuide:t=>{n(e=>{const r=Oa.remove(e.planner,t).updatedState;return{...e,planner:r}})},removeHorizontalGuide:t=>{n(e=>{const r=Aa.remove(e.planner,t).updatedState;return{...e,planner:r}})},toggleSnap:t=>{n(e=>{const r=Jt.toggleSnap(e.planner,t).updatedState;return{...e,planner:r}})},openProjectConfigurator:()=>{n(t=>{const e=Jt.openProjectConfigurator(t.planner).updatedState;return{...t,planner:e}})},setMode:t=>{n(e=>{const r=e.planner.set("mode",t);return{...e,planner:r}})},updateZoomScale:t=>{n(e=>({...e,planner:Jt.updateZoomScale(e.planner,t).updatedState}))},updateCameraView:t=>{n(e=>{const r=e.planner.update("viewer2D",i=>i.merge(Xt(t)));return{...e,planner:r}})},selectToolPan:()=>{n(t=>{const e=t.planner.set("mode",yi);return{...t,planner:e}})},selectToolEdit:()=>{n(t=>({...t,planner:Jt.setMode(t.planner,fe).updatedState}))},selectToolZoomIn:()=>{n(t=>{const e=t.planner.set("mode",gi);return{...t,planner:e}})},selectToolZoomOut:()=>{n(t=>{const e=t.planner.set("mode",mi);return{...t,planner:e}})},updateDrawingLine:(t,e)=>{n(r=>({...r,planner:Ie.updateDrawingLine(r.planner,t,e).updatedState}))},updateMouseCoord:t=>{n(e=>({...e,planner:Jt.updateMouseCoord(e.planner,t).updatedState}))},openCatalog:()=>{n(t=>{const e=t.planner.set("mode",zl);return{...t,planner:e}})},updateDrawingHole:(t,e,r)=>{n(i=>({...i,planner:xe.updateDrawingHole(i.planner,t,e,r).updatedState}))},updateDrawingItem:(t,e,r)=>{n(i=>({...i,planner:Me.updateDrawingItem(i.planner,t,e,r).updatedState}))},blur:()=>{n(t=>{const e=t.planner.merge({mode:fe,activeSnapElement:null});return{...t,planner:e}})},updateDraggingHole:(t,e)=>{n(r=>({...r,planner:xe.updateDraggingHole(r.planner,t,e).updatedState}))},updateDraggingLine:(t,e)=>{n(r=>({...r,planner:Ie.updateDraggingLine(r.planner,t,e).updatedState}))},updateDraggingVertex:(t,e)=>{n(r=>({...r,planner:pe.updateDraggingVertex(r.planner,t,e).updatedState}))},updateDraggingItem:(t,e)=>{n(r=>({...r,planner:Me.updateDraggingItem(r.planner,t,e).updatedState}))},updateRotatingItem:(t,e)=>{n(r=>({...r,planner:Me.updateRotatingItem(r.planner,t,e).updatedState}))},beginDraggingLine:(t,e,r,i)=>{n(s=>{const o=s.planner.merge({sceneHistory:de(s.planner.sceneHistory,s.planner.scene)});return{...s,planner:Ie.beginDraggingLine(o,t,e,r,i).updatedState}})},endDraggingLine:(t,e)=>{n(r=>{const i=r.planner.merge({sceneHistory:de(r.planner.sceneHistory,r.planner.scene)});return{...r,planner:Ie.endDraggingLine(i,t,e).updatedState}})},beginDraggingVertex:(t,e)=>{n(r=>({...r,planner:pe.beginDraggingVertex(r.planner,t,e).updatedState}))},endDraggingVertex:()=>{n(t=>({...t,planner:pe.endDraggingVertex(t.planner).updatedState}))},beginRotatingItem:(t,e,r,i)=>{n(s=>{const o=s.planner.merge({sceneHistory:de(s.planner.sceneHistory,s.planner.scene)});return{...s,planner:Me.beginRotatingItem(o,t,e,r,i).updatedState}})},endRotatingItem:(t,e)=>{n(r=>{const i=r.planner.merge({sceneHistory:de(r.planner.sceneHistory,r.planner.scene)});return{...r,planner:Me.endRotatingItem(i,t,e).updatedState}})},beginDraggingItem:(t,e,r,i)=>{n(s=>{const o=s.planner.merge({sceneHistory:de(s.planner.sceneHistory,s.planner.scene)});return{...s,planner:Me.beginDraggingItem(o,t,e,r,i).updatedState}})},endDraggingItem:(t,e)=>{n(r=>{const i=r.planner.merge({sceneHistory:de(r.planner.sceneHistory,r.planner.scene)});return{...r,planner:Me.endDraggingItem(i,t,e).updatedState}})},beginDraggingHole:(t,e,r,i)=>{n(s=>{const o=s.planner.merge({sceneHistory:de(s.planner.sceneHistory,s.planner.scene)});return{...s,planner:xe.beginDraggingHole(o,t,e,r,i).updatedState}})},endDraggingHole:(t,e)=>{n(r=>{const i=r.planner.merge({sceneHistory:de(r.planner.sceneHistory,r.planner.scene)});return{...r,planner:xe.endDraggingHole(i,t,e).updatedState}})},beginDrawingLine:(t,e,r)=>{n(i=>{const s=i.planner.merge({sceneHistory:de(i.planner.sceneHistory,i.planner.scene)});return{...i,planner:Ie.beginDrawingLine(s,t,e,r).updatedState}})},endDrawingLine:(t,e)=>{n(r=>{const i=r.planner.merge({sceneHistory:de(r.planner.sceneHistory,r.planner.scene)});return{...r,planner:Ie.endDrawingLine(i,t,e).updatedState}})},endDrawingHole:(t,e,r)=>{n(i=>{const s=i.planner.merge({sceneHistory:de(i.planner.sceneHistory,i.planner.scene)});return{...i,planner:xe.endDrawingHole(s,t,e,r).updatedState}})},endDrawingItem:(t,e,r)=>{n(i=>{const s=i.planner.merge({sceneHistory:de(i.planner.sceneHistory,i.planner.scene)});return{...i,planner:Me.endDrawingItem(s,t,e,r).updatedState}})},selectArea:(t,e)=>{n(r=>({...r,planner:xi.select(r.planner,t,e).updatedState}))},initCatalog:t=>{n(e=>({...e,planner:Jt.initCatalog(e.planner,t).updatedState}))},goBackToCatalogPage:t=>{n(e=>({...e,planner:Jt.goBackToCatalogPage(e.planner,t).updatedState}))},pushLastSelectedCatalogElementToHistory:t=>{n(e=>({...e,planner:Jt.pushLastSelectedCatalogElementToHistory(e.planner,t).updatedState}))},selectToolDrawingLine:t=>{n(e=>({...e,planner:Ie.selectToolDrawingLine(e.planner,t).updatedState}))},selectToolDrawingItem:t=>{n(e=>{const r=e.planner.merge({sceneHistory:de(e.planner.sceneHistory,e.planner.scene)});return{...e,planner:Me.selectToolDrawingItem(r,t).updatedState}})},selectToolDrawingHole:t=>{n(e=>{const r=e.planner.merge({sceneHistory:de(e.planner.sceneHistory,e.planner.scene)});return{...e,planner:xe.selectToolDrawingHole(r,t).updatedState}})},changeCatalogPage:(t,e)=>{n(r=>({...r,planner:Jt.changeCatalogPage(r.planner,e,t).updatedState}))},remove:()=>{n(t=>{const e=t.planner.merge({sceneHistory:de(t.planner.sceneHistory,t.planner.scene)});return{...t,planner:Jt.remove(e).updatedState}})},rollback:()=>{n(t=>({...t,planner:Jt.rollback(t.planner).updatedState}))},setAlterateState:()=>{n(t=>({...t,planner:Jt.setAlterate(t.planner).updatedState}))},setPlan:t=>{n(e=>({...e,plan:t}))},unselectAll:()=>{n(t=>({...t,planner:Jt.unselectAll(t.planner).updatedState}))}})),vo={stroke:"#D32F2F",strokeWidth:"1px"};function j_({snap:n,width:t,height:e}){switch(n.type){case"point":return w.jsxs("g",{transform:`translate(${n.x} ${n.y})`,children:[w.jsx("line",{x1:"0",y1:"-70",x2:"0",y2:"70",style:vo}),w.jsx("line",{x1:"-70",y1:"0",x2:"70",y2:"0",style:vo})]});case"line":let r=ma(0),i=ma(e),s=po(n.a,n.b,n.c,r.a,r.b,r.c),o=po(n.a,n.b,n.c,i.a,i.b,i.c),a=ya(0),l=ya(t),c=po(n.a,n.b,n.c,a.a,a.b,a.c),h=po(n.a,n.b,n.c,l.a,l.b,l.c);return s&&o?w.jsx("line",{x1:s.x,y1:s.y,x2:o.x,y2:o.y,style:vo}):c&&h?w.jsx("line",{x1:c.x,y1:c.y,x2:h.x,y2:h.y,style:vo}):null;case"line-segment":return w.jsx("line",{x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,style:vo});default:return null}}const Kp={white:"#FFF",black:"#000"},Qp={500:{orange:"#FF9800"}},V_={alt:"#2E2F33",text_main:Kp.white},D_={main:"#1CA6FC"},Sc="#99C3FB",Wt={COLORS:Kp,PRIMARY_COLOR:V_,SECONDARY_COLOR:D_,MESH_SELECTED:Sc,AREA_MESH_COLOR:{selected:Sc,unselected:"#F5F4F4"},LINE_MESH_COLOR:{selected:Sc}};function B_({width:n,height:t,grid:e}){let r=e.properties.get("step"),i;e.properties.has("color")?i=ut([e.properties.get("color")]):i=e.properties.get("colors");let s=[],o=0;for(let a=0;a<=t;a+=r){let l=i.get(o%i.size);o++,s.push(w.jsx("line",{x1:"0",y1:a,x2:n,y2:a,strokeWidth:"1",stroke:l},a))}return w.jsx("g",{children:s})}function q_({width:n,height:t,grid:e}){let r=e.properties.get("step"),i;e.properties.has("color")?i=ut([e.properties.get("color")]):i=e.properties.get("colors");let s=[],o=0;for(let a=0;a<=n;a+=r){let l=i.get(o%i.size);o++,s.push(w.jsx("line",{x1:a,y1:"0",x2:a,y2:t,strokeWidth:"1",stroke:l},a))}return w.jsx("g",{children:s})}function $_({scene:n}){let{width:t,height:e,grids:r}=n,i=r.entrySeq().map(([s,o])=>{switch(o.type){case"horizontal-streak":return w.jsx(B_,{width:t,height:e,grid:o},s);case"vertical-streak":return w.jsx(q_,{width:t,height:e,grid:o},s);default:console.warn(`grid ${o.type} not allowed`)}}).toList();return w.jsx("g",{children:i})}class H_{constructor(t=[],e=(r,i)=>r<i?-1:r>i?1:0){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;const t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:r}=this,i=e[t];for(;t>0;){const s=t-1>>1,o=e[s];if(r(i,o)>=0)break;e[t]=o,t=s}e[t]=i}_down(t){const{data:e,compare:r}=this,i=this.length>>1,s=e[t];for(;t<i;){let o=(t<<1)+1;const a=o+1;if(a<this.length&&r(e[a],e[o])<0&&(o=a),r(e[o],s)>=0)break;e[t]=e[o],t=o}e[t]=s}}function G_(n,t=1,e=!1){let r=1/0,i=1/0,s=-1/0,o=-1/0;for(const[S,M]of n[0])S<r&&(r=S),M<i&&(i=M),S>s&&(s=S),M>o&&(o=M);const a=s-r,l=o-i,c=Math.max(t,Math.min(a,l));if(c===t){const S=[r,i];return S.distance=0,S}const h=new H_([],(S,M)=>M.max-S.max);let f=U_(n);const g=new Ba(r+a/2,i+l/2,0,n);g.d>f.d&&(f=g);let p=2;function m(S,M,T){const C=new Ba(S,M,T,n);p++,C.max>f.d+t&&h.push(C),C.d>f.d&&(f=C,e&&console.log(`found best ${Math.round(1e4*C.d)/1e4} after ${p} probes`))}let v=c/2;for(let S=r;S<s;S+=c)for(let M=i;M<o;M+=c)m(S+v,M+v,v);for(;h.length;){const{max:S,x:M,y:T,h:C}=h.pop();if(S-f.d<=t)break;v=C/2,m(M-v,T-v,v),m(M+v,T-v,v),m(M-v,T+v,v),m(M+v,T+v,v)}e&&console.log(`num probes: ${p}
78
+ best distance: ${f.d}`);const _=[f.x,f.y];return _.distance=f.d,_}function Ba(n,t,e,r){this.x=n,this.y=t,this.h=e,this.d=W_(n,t,r),this.max=this.d+this.h*Math.SQRT2}function W_(n,t,e){let r=!1,i=1/0;for(const s of e)for(let o=0,a=s.length,l=a-1;o<a;l=o++){const c=s[o],h=s[l];c[1]>t!=h[1]>t&&n<(h[0]-c[0])*(t-c[1])/(h[1]-c[1])+c[0]&&(r=!r),i=Math.min(i,Y_(n,t,c,h))}return i===0?0:(r?1:-1)*Math.sqrt(i)}function U_(n){let t=0,e=0,r=0;const i=n[0];for(let o=0,a=i.length,l=a-1;o<a;l=o++){const c=i[o],h=i[l],f=c[0]*h[1]-h[0]*c[1];e+=(c[0]+h[0])*f,r+=(c[1]+h[1])*f,t+=f*3}const s=new Ba(e/t,r/t,0,n);return t===0||s.d<0?new Ba(i[0][0],i[0][1],0,n):s}function Y_(n,t,e,r){let i=e[0],s=e[1],o=r[0]-i,a=r[1]-s;if(o!==0||a!==0){const l=((n-i)*o+(t-s)*a)/(o*o+a*a);l>1?(i=r[0],s=r[1]):l>0&&(i+=o*l,s+=a*l)}return o=n-i,a=t-s,o*o+a*a}function tg(n,t){var e=n.length,r=0;n=n.map(X_),n[0]!=n[n.length-1]&&(n=n.concat(n[0]));for(var i=0;i<e;i++)r+=n[i].x*n[i+1].y-n[i].y*n[i+1].x;return Math.abs(r)/2}function X_(n){return Array.isArray(n)?{x:n[0],y:n[1]}:n}const J_={textAnchor:"middle",fontSize:"12px",fontFamily:'"Courier New", Courier, monospace',pointerEvents:"none",fontWeight:"bold",WebkitTouchCallout:"none",WebkitUserSelect:"none",MozUserSelect:"none",userSelect:"none"};function Z_({layer:n,area:t,catalog:e}){let r=e.getElement(t.type).render2D(t,n),i=null;if(t.selected){let s=t.vertices.toArray().map(c=>{let{x:h,y:f}=n.vertices.get(c);return[h,f]}),o=s;t.holes.forEach(c=>{let h=n.areas.get(c).vertices.toArray().map(f=>{let{x:g,y:p}=n.vertices.get(f);return[g,p]});o=o.concat(h.reverse())});let a=G_([o],1),l=tg(s);t.holes.forEach(c=>{let f=n.areas.get(c).vertices.toArray().map(g=>{let{x:p,y:m}=n.vertices.get(g);return[p,m]});l-=tg(f)}),i=w.jsxs("text",{x:"0",y:"0",transform:`translate(${a[0]} ${a[1]}) scale(1, -1)`,style:J_,children:[(l/1e4).toFixed(2)," m","²"]})}return w.jsxs("g",{"data-element-root":!0,"data-prototype":t.prototype,"data-id":t.id,"data-selected":t.selected,"data-layer":n.id,children:[r,i]})}const K_=0,Q_=0,t1=5,e1={fill:Qp[500].orange,stroke:Qp[500].orange,cursor:"default"};function r1({layer:n,group:t}){return w.jsx("g",{"data-element-root":!0,"data-prototype":t.prototype,"data-id":t.id,"data-selected":t.selected,"data-layer":n.id,style:t.selected?{cursor:"move"}:{},transform:`translate(${t.x},${t.y}) rotate(${t.rotation})`,children:t.selected&&w.jsx("g",{"data-element-root":!0,"data-prototype":t.prototype,"data-id":t.id,"data-selected":t.selected,"data-layer":n.id,"data-part":"rotation-anchor",children:w.jsx("circle",{cx:K_,cy:Q_,r:t1,style:e1,children:w.jsx("title",{children:"Group's Barycenter"})})})})}const n1={fill:"#0096fd",stroke:"#0096fd",cursor:"ew-resize"},i1={fill:"none",stroke:"#0096fd",cursor:"ew-resize"};function s1({layer:n,item:t,scene:e,catalog:r}){let{x:i,y:s,rotation:o}=t,a=r.getElement(t.type).render2D(t,n,e);return w.jsxs("g",{"data-element-root":!0,"data-prototype":t.prototype,"data-id":t.id,"data-selected":t.selected,"data-layer":n.id,style:t.selected?{cursor:"move"}:{},transform:`translate(${i},${s}) rotate(${o})`,children:[a,t.selected&&w.jsxs("g",{"data-element-root":!0,"data-prototype":t.prototype,"data-id":t.id,"data-selected":t.selected,"data-layer":n.id,"data-part":"rotation-anchor",children:[w.jsx("circle",{cx:"0",cy:"150",r:"10",style:n1}),w.jsx("circle",{cx:"0",cy:"0",r:"150",style:i1})]})]})}const Ec={stroke:"#0096fd",strokeWidth:"1px"},o1={textAnchor:"middle",fontSize:"12px",fontFamily:"'Courier New', Courier, monospace",pointerEvents:"none",fontWeight:"bold",WebkitTouchCallout:"none",WebkitUserSelect:"none",MozUserSelect:"none",userSelect:"none"};function a1({length:n,unit:t,transform:e}){let r=`${n.toFixed(2)} ${t}`;return w.jsxs("g",{transform:e,children:[w.jsx("text",{x:n/2,y:"-3",transform:"scale(1, -1)",style:o1,children:r}),w.jsx("line",{x1:"0",y1:"-5",x2:"0",y2:"5",style:Ec}),w.jsx("line",{x1:n,y1:"-5",x2:n,y2:"5",style:Ec}),w.jsx("line",{x1:"0",y1:"0",x2:n,y2:"0",style:Ec})]})}const u1=({line:n,layer:t,scene:e,catalog:r})=>{let i=t.vertices.get(n.vertices.get(0)),s=t.vertices.get(n.vertices.get(1));if(i.id===s.id||Dr(i,s))return null;let{x:o,y:a}=i,{x:l,y:c}=s;o>l&&({x:o,y:a}=s,{x:l,y:c}=i);let h=Ve(o,a,l,c),f=mv(o,a,l,c),g=n.holes.map(S=>{let M=t.holes.get(S),T=h*M.offset,C=r.getElement(M.type).render2D(M,t,e);return w.jsx("g",{transform:`translate(${T}, 0)`,"data-element-root":!0,"data-prototype":M.prototype,"data-id":M.id,"data-selected":M.selected,"data-layer":t.id,children:C},S)}),m=n.getIn(["properties","thickness","length"])/2,v=r.getElement(n.type).render2D(n,t),_=n.selected?w.jsx(a1,{unit:e.unit,length:h,transform:`translate(0, ${m+10} )`}):null;return w.jsxs("g",{transform:`translate(${o}, ${a}) rotate(${f}, 0, 0)`,"data-element-root":!0,"data-prototype":n.prototype,"data-id":n.id,"data-selected":n.selected,"data-layer":t.id,style:n.selected?{cursor:"move"}:{},children:[_,v,g]})},l1={fill:"#0096fd",stroke:Wt.COLORS.white,cursor:"move"},c1=({vertex:n,layer:t})=>w.jsx("g",{transform:`translate(${n.x}, ${n.y})`,"data-element-root":!0,"data-prototype":n.prototype,"data-id":n.id,"data-selected":n.selected,"data-layer":t.id,children:w.jsx("circle",{cx:"0",cy:"0",r:"7",style:l1})});function eg({layer:n,scene:t,catalog:e}){const{groups:r}=t,{lines:i,areas:s,vertices:o,id:a,items:l,opacity:c}=n;return w.jsxs("g",{opacity:c,children:[s.valueSeq().map(h=>w.jsx(Z_,{layer:n,area:h,catalog:e},h.id)),i.valueSeq().map(h=>w.jsx(u1,{layer:n,line:h,scene:t,catalog:e},h.id)),l.valueSeq().map(h=>w.jsx(s1,{layer:n,item:h,scene:t,catalog:e},h.id)),o.valueSeq().filter(h=>h.selected).map(h=>w.jsx(c1,{layer:n,vertex:h},h.id)),r.valueSeq().filter(h=>h.hasIn(["elements",a])&&h.get("selected")).map(h=>w.jsx(r1,{layer:n,group:h,scene:t,catalog:e},h.get("id")))]})}const h1=({scene:n,catalog:t})=>{const{layers:e}=n,r=e.get(n.selectedLayer);return w.jsxs("g",{children:[w.jsx($_,{scene:n}),w.jsx("g",{style:{pointerEvents:"none"},children:e.entrySeq().filter(([i,s])=>i!==n.selectedLayer&&s.visible).map(([i,s])=>w.jsx(eg,{layer:s,scene:n,catalog:t},i))}),w.jsx(eg,{layer:r,scene:n,catalog:t},r.id)]})},f1=N.memo(h1,(n,t)=>n.scene.hashCode()===t.scene.hashCode()),rg={stroke:Wt.SECONDARY_COLOR.main,strokeWidth:"2.5px"},d1=({catalog:n})=>{const{planner:t}=ne(),{activeSnapElement:e,snapElements:r,scene:i}=t,{width:s,height:o}=i;return w.jsxs("g",{children:[w.jsx("rect",{x:"0",y:"0",width:s,height:o,fill:Wt.COLORS.white}),w.jsxs("g",{transform:`translate(0, ${i.height}) scale(1, -1)`,id:"svg-drawing-paper",children:[w.jsx(f1,{scene:i,catalog:n}),i.getIn(["guides","horizontal"]).entrySeq().map(([a,l])=>w.jsx("line",{id:"hGuide"+a,x1:0,y1:l,x2:s,y2:l,style:rg},a)),i.getIn(["guides","vertical"]).entrySeq().map(([a,l])=>w.jsx("line",{x1:l,y1:0,x2:l,y2:o,style:rg},a)),e?w.jsx(j_,{snap:e,width:i.width,height:i.height}):null,r?null:w.jsx(w.Fragment,{})]})]})},Mc=.25,ng=5,p1=.25,g1=5.25;function ig(n){return(Math.min(Math.max(n,Mc),ng)-Mc)/(ng-Mc)*100}function m1(n){switch(n){case yi:return Ar;case gi:return $r;case mi:return dn;case fe:return Mr;default:return fn}}function y1(n){switch(n){case or:case ar:case Sr:case Vr:case jr:case Fr:case Nr:return{pointerEvents:"none"};default:return{}}}function v1(n){switch(n){case Vr:case Fr:case Nr:case jr:return{cursor:"move"};case An:return{cursor:"ew-resize"};case Lr:case or:return{cursor:"crosshair"};default:return{cursor:"default"}}}function x1(n){switch(n){case or:case Fr:case Nr:case Vr:case jr:case ar:case Sr:return!0;default:return!1}}function sg(n){for(;!n.attributes.getNamedItem("data-element-root")&&n.tagName!=="svg";)n=n.parentNode;return n.tagName==="svg"?null:{part:n.attributes.getNamedItem("data-part")?n.attributes.getNamedItem("data-part").value:void 0,layer:n.attributes.getNamedItem("data-layer").value,prototype:n.attributes.getNamedItem("data-prototype").value,selected:n.attributes.getNamedItem("data-selected").value==="true",id:n.attributes.getNamedItem("data-id").value}}const _1=({width:n,height:t,catalog:e})=>{const r=N.useRef(null),{planner:i,selectToolZoomOut:s,selectToolZoomIn:o,selectToolPan:a,selectToolEdit:l,updateCameraView:c,updateZoomScale:h,updateMouseCoord:f,updateDrawingLine:g,updateDrawingHole:p,updateDrawingItem:m,updateDraggingHole:v,updateDraggingLine:_,updateDraggingVertex:S,updateDraggingItem:M,updateRotatingItem:T,beginDraggingLine:C,beginDraggingVertex:E,beginRotatingItem:z,beginDraggingItem:R,beginDraggingHole:k,selectArea:L,unselectAll:X,beginDrawingLine:J,endDrawingLine:at,endDrawingHole:tt,endDrawingItem:bt,endDraggingLine:xt,endDraggingVertex:yt,endDraggingItem:ht,endDraggingHole:Y,endRotatingItem:St,selectLine:j,selectHole:W,selectItem:ft,rollback:et,setViewer:rt}=ne(),{viewer2D:Z,scene:Q,mode:U}=i,st=Q.selectedLayer??"";N.useEffect(()=>{r.current&&(rt(r.current),r.current.fitToViewer())},[]);const vt=({x:Ct,y:Gt})=>({x:Ct,y:-Gt+Q.height}),B=Ct=>{const Gt=new Event("mousemove-planner-event");Gt.viewerEvent=Ct,document.dispatchEvent(Gt);let{x:gt,y:_t}=vt(Ct);switch(f({x:gt,y:_t}),U){case or:g(gt,_t,i.snapMask);break;case ar:p(st,gt,_t);break;case Sr:m(st,gt,_t);break;case Vr:v(gt,_t);break;case Fr:_(gt,_t,i.snapMask);break;case Nr:S(gt,_t,i.snapMask);break;case jr:M(gt,_t);break;case An:T(gt,_t);break}Ct.originalEvent.stopPropagation()},pt=Ct=>{const Gt=Ct.originalEvent,gt=new Event("mousedown-planner-event");gt.viewerEvent=Ct,document.dispatchEvent(gt);let{x:_t,y:Dt}=vt(Ct);if(U===fe){let zt=sg(Gt.target);if(!zt||!zt.selected)return;switch(zt.prototype){case"lines":C(zt.layer,zt.id,_t,Dt,i.snapMask);break;case"vertices":E(zt.layer,zt.id,_t,Dt,i.snapMask);break;case"items":zt.part==="rotation-anchor"?z(zt.layer,zt.id,_t,Dt):R(zt.layer,zt.id,_t,Dt);break;case"holes":k(zt.layer,zt.id,_t,Dt);break}}Gt.stopPropagation()},H=Ct=>{const Gt=Ct.originalEvent,gt=new Event("mouseup-planner-event");gt.viewerEvent=Ct,document.dispatchEvent(gt);const{x:_t,y:Dt}=vt(Ct);switch(U){case fe:const zt=sg(Gt.target);if(zt&&zt.selected)return;switch(zt?zt.prototype:"none"){case"areas":L(zt.layer,zt.id);break;case"lines":j(zt.layer,zt.id);break;case"holes":W(zt.layer,zt.id);break;case"items":ft(zt.layer,zt.id);break;case"none":X();break}break;case Lr:J(st,_t,Dt,i.snapMask);break;case or:at(_t,Dt,i.snapMask),J(st,_t,Dt,i.snapMask);break;case ar:tt(st,_t,Dt);break;case Sr:bt(st,_t,Dt);break;case Fr:xt(_t,Dt,i.snapMask);break;case Nr:yt(_t,Dt,i.snapMask);break;case jr:ht(_t,Dt);break;case Vr:Y(_t,Dt);break;case An:St(_t,Dt);break}Gt.stopPropagation()},Ot=()=>{[Lr,or,ar,Sr].includes(U)&&et()},Bt=Ct=>{h(Ct.a),c(Ct)},kt=Ct=>{switch(Ct){case fn:l();break;case Ar:a();break;case $r:o();break;case dn:s();break}};return w.jsx("div",{className:"m-0 p-0 relative",children:w.jsx(Da,{className:"floor_planner-svgPanZoom",ref:r,style:{gridColumn:2,gridRow:2},width:n,height:t,scaleFactorMin:p1,scaleFactorMax:g1,value:Z.isEmpty()?{}:Z.toJS(),onChangeValue:Bt,tool:m1(U),onChangeTool:kt,detectAutoPan:x1(U),onMouseDown:pt,onMouseMove:B,onMouseUp:H,onDoubleClick:Ot,miniatureProps:{position:"none",width:0,height:0,background:""},toolbarProps:{position:"none"},children:w.jsxs("svg",{width:Q.width,height:Q.height,children:[w.jsx("defs",{children:w.jsxs("pattern",{id:"diagonalFill",patternUnits:"userSpaceOnUse",width:"4",height:"4",fill:"#FFF",children:[w.jsx("rect",{x:"0",y:"0",width:"4",height:"4",fill:"#FFF"}),w.jsx("path",{d:"M-1,1 l2,-2 M0,4 l4,-4 M3,5 l2,-2",style:{stroke:"#8E9BA2",strokeWidth:1}})]})}),w.jsx("g",{style:Object.assign(v1(U),y1(U)),children:w.jsx(d1,{catalog:e})})]})})})},b1={color:Wt.PRIMARY_COLOR.alt,fontWeight:300};function w1({children:n,style:t={},...e}){return w.jsx("h1",{style:{...b1,...t},...e,children:n})}const S1={padding:"0 20px",overflowY:"auto"};function E1({children:n,width:t,height:e,style:r={}}){return w.jsx("div",{style:{width:t,height:e,...S1,...r},onWheel:i=>i.stopPropagation(),children:n})}var og={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},ag=N.createContext&&N.createContext(og),M1=["attr","size","title"];function A1(n,t){if(n==null)return{};var e=O1(n,t),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(e[r]=n[r])}return e}function O1(n,t){if(n==null)return{};var e={};for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){if(t.indexOf(r)>=0)continue;e[r]=n[r]}return e}function qa(){return qa=Object.assign?Object.assign.bind():function(n){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r])}return n},qa.apply(this,arguments)}function ug(n,t){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),e.push.apply(e,r)}return e}function $a(n){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?ug(Object(e),!0).forEach(function(r){z1(n,r,e[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):ug(Object(e)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(e,r))})}return n}function z1(n,t,e){return t=T1(t),t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}function T1(n){var t=C1(n,"string");return typeof t=="symbol"?t:t+""}function C1(n,t){if(typeof n!="object"||!n)return n;var e=n[Symbol.toPrimitive];if(e!==void 0){var r=e.call(n,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(n)}function lg(n){return n&&n.map((t,e)=>N.createElement(t.tag,$a({key:e},t.attr),lg(t.child)))}function ge(n){return t=>N.createElement(I1,qa({attr:$a({},n.attr)},t),lg(n.child))}function I1(n){var t=e=>{var{attr:r,size:i,title:s}=n,o=A1(n,M1),a=i||e.size||"1em",l;return e.className&&(l=e.className),n.className&&(l=(l?l+" ":"")+n.className),N.createElement("svg",qa({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},e.attr,r,o,{className:l,style:$a($a({color:n.color||e.color},e.style),n.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),s&&N.createElement("title",null,s),n.children)};return ag!==void 0?N.createElement(ag.Consumer,null,e=>t(e)):t(og)}function k1(n){return ge({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"},child:[]}]})(n)}function P1(n){return ge({attr:{viewBox:"0 0 192 512"},child:[{tag:"path",attr:{d:"M0 384.662V127.338c0-17.818 21.543-26.741 34.142-14.142l128.662 128.662c7.81 7.81 7.81 20.474 0 28.284L34.142 398.804C21.543 411.404 0 402.48 0 384.662z"},child:[]}]})(n)}function R1(n){return ge({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm144 276c0 6.6-5.4 12-12 12h-92v92c0 6.6-5.4 12-12 12h-56c-6.6 0-12-5.4-12-12v-92h-92c-6.6 0-12-5.4-12-12v-56c0-6.6 5.4-12 12-12h92v-92c0-6.6 5.4-12 12-12h56c6.6 0 12 5.4 12 12v92h92c6.6 0 12 5.4 12 12v56z"},child:[]}]})(n)}function L1(n){return ge({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M41 288h238c21.4 0 32.1 25.9 17 41L177 448c-9.4 9.4-24.6 9.4-33.9 0L24 329c-15.1-15.1-4.4-41 17-41z"},child:[]}]})(n)}function F1(n){return ge({attr:{viewBox:"0 0 352 512"},child:[{tag:"path",attr:{d:"M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"},child:[]}]})(n)}function N1(n){return ge({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M304.083 405.907c4.686 4.686 4.686 12.284 0 16.971l-44.674 44.674c-59.263 59.262-155.693 59.266-214.961 0-59.264-59.265-59.264-155.696 0-214.96l44.675-44.675c4.686-4.686 12.284-4.686 16.971 0l39.598 39.598c4.686 4.686 4.686 12.284 0 16.971l-44.675 44.674c-28.072 28.073-28.072 73.75 0 101.823 28.072 28.072 73.75 28.073 101.824 0l44.674-44.674c4.686-4.686 12.284-4.686 16.971 0l39.597 39.598zm-56.568-260.216c4.686 4.686 12.284 4.686 16.971 0l44.674-44.674c28.072-28.075 73.75-28.073 101.824 0 28.072 28.073 28.072 73.75 0 101.823l-44.675 44.674c-4.686 4.686-4.686 12.284 0 16.971l39.598 39.598c4.686 4.686 12.284 4.686 16.971 0l44.675-44.675c59.265-59.265 59.265-155.695 0-214.96-59.266-59.264-155.695-59.264-214.961 0l-44.674 44.674c-4.686 4.686-4.686 12.284 0 16.971l39.597 39.598zm234.828 359.28l22.627-22.627c9.373-9.373 9.373-24.569 0-33.941L63.598 7.029c-9.373-9.373-24.569-9.373-33.941 0L7.029 29.657c-9.373 9.373-9.373 24.569 0 33.941l441.373 441.373c9.373 9.372 24.569 9.372 33.941 0z"},child:[]}]})(n)}const cg={width:"14em",height:"14em",padding:"0.625em",background:"#f7f7f9",border:"1px solid #e1e1e8",cursor:"pointer",position:"relative",boxShadow:"0 1px 6px 0 rgba(0, 0, 0, 0.11), 0 1px 4px 0 rgba(0, 0, 0, 0.11)",borderRadius:"2px",transition:"all .15s ease-in-out",WebkitTransition:"all .15s ease-in-out",alignSelf:"center",justifySelf:"center"},j1={...cg,background:Wt.SECONDARY_COLOR.main},hg={width:"100%",textAlign:"center",display:"block",marginBottom:".5em",textTransform:"capitalize"},V1={...hg,color:Wt.COLORS.white},D1={width:"100%",height:"8em",position:"relative",overflow:"hidden",border:"solid 1px #e6e6e6",padding:0,margin:0,marginBottom:"5px"},fg={position:"absolute",background:"#222",width:"100%",height:"100%",backgroundSize:"contain",backgroundPosition:"50% 50%",backgroundColor:Wt.COLORS.white,backgroundRepeat:"no-repeat",transition:"all .2s ease-in-out"},B1={...fg,transform:"scale(1.2)"},q1={marginTop:"1.5em",color:Wt.SECONDARY_COLOR.main,fontSize:"2em",opacity:"0.7",width:"100%"},$1={display:"block",height:"2em",margin:"0 auto",fontSize:"0.75em",fontStyle:"italic",lineHeight:"1em",WebkitLineClamp:"2",WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis"},H1={listStyle:"none",margin:"0px",padding:"0px",fontSize:"11px",marginBottom:"3px"},G1={display:"inline-block",background:"#337ab7",color:Wt.COLORS.white,padding:"1px 4px",marginRight:"3px",borderRadius:"3px"},dg=({element:n})=>{const[t,e]=N.useState(!1),{selectToolDrawingLine:r,selectToolDrawingItem:i,selectToolDrawingHole:s,pushLastSelectedCatalogElementToHistory:o}=ne(),a=()=>{switch(n.prototype){case"lines":r(n.name);break;case"items":i(n.name);break;case"holes":s(n.name);break}o(n)};return w.jsxs("div",{style:t?j1:cg,onClick:a,onMouseEnter:()=>e(!0),onMouseLeave:()=>e(!1),children:[w.jsx("b",{style:t?V1:hg,children:n.info.title}),w.jsx("div",{style:D1,children:w.jsx("div",{style:{...t?B1:fg,backgroundImage:"url("+n.info.image+")"},children:t?w.jsx(R1,{style:q1}):null})}),w.jsx("ul",{style:H1,children:n.info.tag.map((l,c)=>w.jsx("li",{style:G1,children:l},c))}),w.jsx("div",{style:$1,children:n.info.description})]})};function W1(n){return ge({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M21 10.12h-6.78l2.74-2.82c-2.73-2.7-7.15-2.8-9.88-.1-2.73 2.71-2.73 7.08 0 9.79s7.15 2.71 9.88 0C18.32 15.65 19 14.08 19 12.1h2c0 1.98-.88 4.55-2.64 6.29-3.51 3.48-9.21 3.48-12.72 0-3.5-3.47-3.53-9.11-.02-12.58s9.14-3.47 12.65 0L21 3v7.12zM12.5 8v4.25l3.5 2.08-.72 1.21L11 13V8h1.5z"},child:[]}]})(n)}function U1(n){return ge({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"},child:[]}]})(n)}function Y1(n){return ge({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm5 11h-4v4h-2v-4H7v-2h4V7h2v4h4v2z"},child:[]}]})(n)}function X1(n){return ge({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16a8.002 8.002 0 0 1 7.6-5.5c1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"},child:[]}]})(n)}function J1(n){return ge({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"},child:[]}]})(n)}function Z1(n){return ge({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z"},child:[]}]})(n)}function pg(n){return ge({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"},child:[]}]})(n)}function K1(n){return ge({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 8h-6V5h6v6zm-8-6v6H5V5h6zm-6 8h6v6H5v-6zm8 6v-6h6v6h-6z"},child:[]}]})(n)}const Q1={margin:"1.5em",display:"flex"},gg={fontSize:"20px",cursor:"pointer"},tb={...gg,fontWeight:"bolder",color:Wt.SECONDARY_COLOR.main},eb={fill:Wt.COLORS.black,fontSize:"24px",marginLeft:"10px",marginRight:"10px"},rb=({names:n})=>{let t=n.map((e,r)=>{let i=r===n.length-1;return w.jsxs("div",{style:{display:"flex"},children:[w.jsx("div",{style:i?tb:gg,onClick:e.action||null,children:e.name}),i?null:w.jsx(pg,{style:eb})]},r)});return w.jsx("div",{style:Q1,children:t})},mg={width:"14em",height:"14em",padding:"0.625em",background:"#f7f7f9",border:"1px solid #e1e1e8",margin:"0.3em",cursor:"pointer",position:"relative",boxShadow:"0 1px 6px 0 rgba(0, 0, 0, 0.11), 0 1px 4px 0 rgba(0, 0, 0, 0.11)",borderRadius:"2px",transition:"all .2s ease-in-out",WebkitTransition:"all .2s ease-in-out"},nb={...mg,background:Wt.SECONDARY_COLOR.main},yg={position:"absolute",color:Wt.COLORS.black,fontSize:"5em",width:"100%"},ib={...yg,color:Wt.SECONDARY_COLOR.main},sb={background:Wt.COLORS.white,marginBottom:"5px",border:"solid 1px #e6e6e6",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},ob=({page:n})=>{const[t,e]=N.useState(!1),{goBackToCatalogPage:r}=ne(),i=s=>{r(s)};return w.jsx("div",{style:t?nb:mg,onClick:()=>i(n.name),onMouseEnter:()=>e(!0),onMouseLeave:()=>e(!1),children:w.jsx("div",{style:sb,children:w.jsx(Z1,{style:t?ib:yg})})})},ab={position:"fixed",width:"calc( 100% - 51px)",height:"calc( 100% - 20px)",backgroundColor:"#FFF",padding:"1em",left:50,overflowY:"auto",overflowX:"hidden",zIndex:10},ub={display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(14em, 1fr))",gridGap:"10px",marginTop:"1em"},vg={width:"100%",height:"3em",padding:"0.625em",background:"#f7f7f9",border:"1px solid #e1e1e8",cursor:"pointer",position:"relative",boxShadow:"0 1px 6px 0 rgba(0, 0, 0, 0.11), 0 1px 4px 0 rgba(0, 0, 0, 0.11)",borderRadius:"2px",transition:"all .2s ease-in-out",WebkitTransition:"all .2s ease-in-out",marginBottom:"1em"},lb={width:"8em",display:"inline-block"},cb={width:"calc( 100% - 10em )",height:"2em",margin:"0",padding:"0 1em",border:"1px solid #EEE"},hb={...vg,padding:"0.2em 0.625em"},fb={width:"auto",height:"2em",lineHeight:"2em",textAlign:"center",borderRadius:"1em",display:"inline-block",cursor:"pointer",backgroundColor:Wt.PRIMARY_COLOR.alt,color:Wt.PRIMARY_COLOR.text_main,textTransform:"capitalize",margin:"0.25em",padding:"0 1em"},db=({width:n,height:t,style:e,catalog:r})=>{const{planner:i,goBackToCatalogPage:s,selectToolDrawingHole:o,selectToolDrawingItem:a,selectToolDrawingLine:l,pushLastSelectedCatalogElementToHistory:c}=ne();let h=i.catalog.page;const f=r.getCategory(h);let g=f.elements.filter(L=>L.info.visibility?L.info.visibility.catalog:!0);const[p,m]=N.useState(""),[v,_]=N.useState([]);let S=null;if(h!=="root"){let L=[];i.catalog.path.forEach(X=>{L.push({name:r.getCategory(X).label,action:()=>s(X)})}),L.push({name:f.label,action:""}),S=w.jsx(rb,{names:L})}let M=i.catalog.path.size,T=M>0?w.jsx(ob,{page:r.categories[i.catalog.path.get(M-1)]},M):null,C=i.get("selectedElementsHistory"),E=C.map((L,X)=>w.jsx("div",{style:fb,title:L.name,onClick:()=>k(L),children:L.name},X));const z=L=>{let X=[];for(let J=0;J<L.length;J++){let at=L[J];X=X.concat(at.elements),at.categories.length&&(X=X.concat(z(at.categories)))}return X},R=L=>{let X=g.concat(z(f.categories)),J=[];if(L!=""){let at=new RegExp(L,"i");for(let tt=0;tt<X.length;tt++)at.test(X[tt].info.title)&&J.push(X[tt])}m(L),_(J)},k=L=>{switch(L.prototype){case"lines":l(L.name);break;case"items":a(L.name);break;case"holes":o(L.name);break}c(L)};return w.jsxs(E1,{width:n,height:t,style:{...ab,...e},children:[w.jsx(w1,{children:"Catalog"}),S,w.jsxs("div",{style:vg,children:[w.jsx("span",{style:lb,children:"Search Element"}),w.jsx("input",{type:"text",style:cb,onChange:L=>{R(L.target.value)}})]}),C.size?w.jsxs("div",{style:hb,children:[w.jsx("span",{children:"Last Selected"}),E]}):null,w.jsx("div",{style:ub,children:p===""?[T,g.map(L=>w.jsx(dg,{element:L},L.name))]:v.map(L=>w.jsx(dg,{element:L},L.name))})]})},pb={MODE_IDLE:fe,MODE_2D_ZOOM_IN:gi,MODE_2D_ZOOM_OUT:mi,MODE_2D_PAN:yi,MODE_WAITING_DRAWING_LINE:Lr,MODE_DRAGGING_LINE:Fr,MODE_DRAGGING_VERTEX:Nr,MODE_DRAGGING_ITEM:jr,MODE_DRAWING_LINE:or,MODE_DRAWING_HOLE:ar,MODE_DRAWING_ITEM:Sr,MODE_DRAGGING_HOLE:Vr,MODE_ROTATING_ITEM:An};function gb({width:n,height:t,catalog:e}){const{planner:r}=ne(),{mode:i}=r;return i===vi?w.jsx(w.Fragment,{}):i===Qi?w.jsx(w.Fragment,{}):i===zl?w.jsx(db,{width:n,height:t,catalog:e}):pb[i]?w.jsx(_1,{width:n,height:t,catalog:e}):i===fd?w.jsx(w.Fragment,{}):null}function xg(n){var t,e,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var i=n.length;for(t=0;t<i;t++)n[t]&&(e=xg(n[t]))&&(r&&(r+=" "),r+=e)}else for(e in n)n[e]&&(r&&(r+=" "),r+=e);return r}function mb(){for(var n,t,e=0,r="",i=arguments.length;e<i;e++)(n=arguments[e])&&(t=xg(n))&&(r&&(r+=" "),r+=t);return r}const Ac="-",yb=n=>{const t=xb(n),{conflictingClassGroups:e,conflictingClassGroupModifiers:r}=n;return{getClassGroupId:o=>{const a=o.split(Ac);return a[0]===""&&a.length!==1&&a.shift(),_g(a,t)||vb(o)},getConflictingClassGroupIds:(o,a)=>{const l=e[o]||[];return a&&r[o]?[...l,...r[o]]:l}}},_g=(n,t)=>{var o;if(n.length===0)return t.classGroupId;const e=n[0],r=t.nextPart.get(e),i=r?_g(n.slice(1),r):void 0;if(i)return i;if(t.validators.length===0)return;const s=n.join(Ac);return(o=t.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},bg=/^\[(.+)\]$/,vb=n=>{if(bg.test(n)){const t=bg.exec(n)[1],e=t==null?void 0:t.substring(0,t.indexOf(":"));if(e)return"arbitrary.."+e}},xb=n=>{const{theme:t,classGroups:e}=n,r={nextPart:new Map,validators:[]};for(const i in e)Oc(e[i],r,i,t);return r},Oc=(n,t,e,r)=>{n.forEach(i=>{if(typeof i=="string"){const s=i===""?t:wg(t,i);s.classGroupId=e;return}if(typeof i=="function"){if(_b(i)){Oc(i(r),t,e,r);return}t.validators.push({validator:i,classGroupId:e});return}Object.entries(i).forEach(([s,o])=>{Oc(o,wg(t,s),e,r)})})},wg=(n,t)=>{let e=n;return t.split(Ac).forEach(r=>{e.nextPart.has(r)||e.nextPart.set(r,{nextPart:new Map,validators:[]}),e=e.nextPart.get(r)}),e},_b=n=>n.isThemeGetter,bb=n=>{if(n<1)return{get:()=>{},set:()=>{}};let t=0,e=new Map,r=new Map;const i=(s,o)=>{e.set(s,o),t++,t>n&&(t=0,r=e,e=new Map)};return{get(s){let o=e.get(s);if(o!==void 0)return o;if((o=r.get(s))!==void 0)return i(s,o),o},set(s,o){e.has(s)?e.set(s,o):i(s,o)}}},zc="!",Tc=":",wb=Tc.length,Sb=n=>{const{prefix:t,experimentalParseClassName:e}=n;let r=i=>{const s=[];let o=0,a=0,l=0,c;for(let m=0;m<i.length;m++){let v=i[m];if(o===0&&a===0){if(v===Tc){s.push(i.slice(l,m)),l=m+wb;continue}if(v==="/"){c=m;continue}}v==="["?o++:v==="]"?o--:v==="("?a++:v===")"&&a--}const h=s.length===0?i:i.substring(l),f=Eb(h),g=f!==h,p=c&&c>l?c-l:void 0;return{modifiers:s,hasImportantModifier:g,baseClassName:f,maybePostfixModifierPosition:p}};if(t){const i=t+Tc,s=r;r=o=>o.startsWith(i)?s(o.substring(i.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(e){const i=r;r=s=>e({className:s,parseClassName:i})}return r},Eb=n=>n.endsWith(zc)?n.substring(0,n.length-1):n.startsWith(zc)?n.substring(1):n,Mb=n=>{const t=Object.fromEntries(n.orderSensitiveModifiers.map(r=>[r,!0]));return r=>{if(r.length<=1)return r;const i=[];let s=[];return r.forEach(o=>{o[0]==="["||t[o]?(i.push(...s.sort(),o),s=[]):s.push(o)}),i.push(...s.sort()),i}},Ab=n=>({cache:bb(n.cacheSize),parseClassName:Sb(n),sortModifiers:Mb(n),...yb(n)}),Ob=/\s+/,zb=(n,t)=>{const{parseClassName:e,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:s}=t,o=[],a=n.trim().split(Ob);let l="";for(let c=a.length-1;c>=0;c-=1){const h=a[c],{isExternal:f,modifiers:g,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:v}=e(h);if(f){l=h+(l.length>0?" "+l:l);continue}let _=!!v,S=r(_?m.substring(0,v):m);if(!S){if(!_){l=h+(l.length>0?" "+l:l);continue}if(S=r(m),!S){l=h+(l.length>0?" "+l:l);continue}_=!1}const M=s(g).join(":"),T=p?M+zc:M,C=T+S;if(o.includes(C))continue;o.push(C);const E=i(S,_);for(let z=0;z<E.length;++z){const R=E[z];o.push(T+R)}l=h+(l.length>0?" "+l:l)}return l};function Tb(){let n=0,t,e,r="";for(;n<arguments.length;)(t=arguments[n++])&&(e=Sg(t))&&(r&&(r+=" "),r+=e);return r}const Sg=n=>{if(typeof n=="string")return n;let t,e="";for(let r=0;r<n.length;r++)n[r]&&(t=Sg(n[r]))&&(e&&(e+=" "),e+=t);return e};function Cb(n,...t){let e,r,i,s=o;function o(l){const c=t.reduce((h,f)=>f(h),n());return e=Ab(c),r=e.cache.get,i=e.cache.set,s=a,a(l)}function a(l){const c=r(l);if(c)return c;const h=zb(l,e);return i(l,h),h}return function(){return s(Tb.apply(null,arguments))}}const Ae=n=>{const t=e=>e[n]||[];return t.isThemeGetter=!0,t},Eg=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Mg=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Ib=/^\d+\/\d+$/,kb=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Pb=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Rb=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Lb=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Fb=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ls=n=>Ib.test(n),It=n=>!!n&&!Number.isNaN(Number(n)),Zn=n=>!!n&&Number.isInteger(Number(n)),Cc=n=>n.endsWith("%")&&It(n.slice(0,-1)),Tn=n=>kb.test(n),Nb=()=>!0,jb=n=>Pb.test(n)&&!Rb.test(n),Ag=()=>!1,Vb=n=>Lb.test(n),Db=n=>Fb.test(n),Bb=n=>!lt(n)&&!ct(n),qb=n=>cs(n,Ig,Ag),lt=n=>Eg.test(n),wi=n=>cs(n,kg,jb),Ic=n=>cs(n,Ub,It),Og=n=>cs(n,Tg,Ag),$b=n=>cs(n,Cg,Db),Ha=n=>cs(n,Pg,Vb),ct=n=>Mg.test(n),xo=n=>hs(n,kg),Hb=n=>hs(n,Yb),zg=n=>hs(n,Tg),Gb=n=>hs(n,Ig),Wb=n=>hs(n,Cg),Ga=n=>hs(n,Pg,!0),cs=(n,t,e)=>{const r=Eg.exec(n);return r?r[1]?t(r[1]):e(r[2]):!1},hs=(n,t,e=!1)=>{const r=Mg.exec(n);return r?r[1]?t(r[1]):e:!1},Tg=n=>n==="position"||n==="percentage",Cg=n=>n==="image"||n==="url",Ig=n=>n==="length"||n==="size"||n==="bg-size",kg=n=>n==="length",Ub=n=>n==="number",Yb=n=>n==="family-name",Pg=n=>n==="shadow",Xb=Cb(()=>{const n=Ae("color"),t=Ae("font"),e=Ae("text"),r=Ae("font-weight"),i=Ae("tracking"),s=Ae("leading"),o=Ae("breakpoint"),a=Ae("container"),l=Ae("spacing"),c=Ae("radius"),h=Ae("shadow"),f=Ae("inset-shadow"),g=Ae("text-shadow"),p=Ae("drop-shadow"),m=Ae("blur"),v=Ae("perspective"),_=Ae("aspect"),S=Ae("ease"),M=Ae("animate"),T=()=>["auto","avoid","all","avoid-page","page","left","right","column"],C=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],E=()=>[...C(),ct,lt],z=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto","contain","none"],k=()=>[ct,lt,l],L=()=>[ls,"full","auto",...k()],X=()=>[Zn,"none","subgrid",ct,lt],J=()=>["auto",{span:["full",Zn,ct,lt]},Zn,ct,lt],at=()=>[Zn,"auto",ct,lt],tt=()=>["auto","min","max","fr",ct,lt],bt=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],xt=()=>["start","end","center","stretch","center-safe","end-safe"],yt=()=>["auto",...k()],ht=()=>[ls,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...k()],Y=()=>[n,ct,lt],St=()=>[...C(),zg,Og,{position:[ct,lt]}],j=()=>["no-repeat",{repeat:["","x","y","space","round"]}],W=()=>["auto","cover","contain",Gb,qb,{size:[ct,lt]}],ft=()=>[Cc,xo,wi],et=()=>["","none","full",c,ct,lt],rt=()=>["",It,xo,wi],Z=()=>["solid","dashed","dotted","double"],Q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],U=()=>[It,Cc,zg,Og],st=()=>["","none",m,ct,lt],vt=()=>["none",It,ct,lt],B=()=>["none",It,ct,lt],pt=()=>[It,ct,lt],H=()=>[ls,"full",...k()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Tn],breakpoint:[Tn],color:[Nb],container:[Tn],"drop-shadow":[Tn],ease:["in","out","in-out"],font:[Bb],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Tn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Tn],shadow:[Tn],spacing:["px",It],text:[Tn],"text-shadow":[Tn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ls,lt,ct,_]}],container:["container"],columns:[{columns:[It,lt,ct,a]}],"break-after":[{"break-after":T()}],"break-before":[{"break-before":T()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:E()}],overflow:[{overflow:z()}],"overflow-x":[{"overflow-x":z()}],"overflow-y":[{"overflow-y":z()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:L()}],"inset-x":[{"inset-x":L()}],"inset-y":[{"inset-y":L()}],start:[{start:L()}],end:[{end:L()}],top:[{top:L()}],right:[{right:L()}],bottom:[{bottom:L()}],left:[{left:L()}],visibility:["visible","invisible","collapse"],z:[{z:[Zn,"auto",ct,lt]}],basis:[{basis:[ls,"full","auto",a,...k()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[It,ls,"auto","initial","none",lt]}],grow:[{grow:["",It,ct,lt]}],shrink:[{shrink:["",It,ct,lt]}],order:[{order:[Zn,"first","last","none",ct,lt]}],"grid-cols":[{"grid-cols":X()}],"col-start-end":[{col:J()}],"col-start":[{"col-start":at()}],"col-end":[{"col-end":at()}],"grid-rows":[{"grid-rows":X()}],"row-start-end":[{row:J()}],"row-start":[{"row-start":at()}],"row-end":[{"row-end":at()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":tt()}],"auto-rows":[{"auto-rows":tt()}],gap:[{gap:k()}],"gap-x":[{"gap-x":k()}],"gap-y":[{"gap-y":k()}],"justify-content":[{justify:[...bt(),"normal"]}],"justify-items":[{"justify-items":[...xt(),"normal"]}],"justify-self":[{"justify-self":["auto",...xt()]}],"align-content":[{content:["normal",...bt()]}],"align-items":[{items:[...xt(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...xt(),{baseline:["","last"]}]}],"place-content":[{"place-content":bt()}],"place-items":[{"place-items":[...xt(),"baseline"]}],"place-self":[{"place-self":["auto",...xt()]}],p:[{p:k()}],px:[{px:k()}],py:[{py:k()}],ps:[{ps:k()}],pe:[{pe:k()}],pt:[{pt:k()}],pr:[{pr:k()}],pb:[{pb:k()}],pl:[{pl:k()}],m:[{m:yt()}],mx:[{mx:yt()}],my:[{my:yt()}],ms:[{ms:yt()}],me:[{me:yt()}],mt:[{mt:yt()}],mr:[{mr:yt()}],mb:[{mb:yt()}],ml:[{ml:yt()}],"space-x":[{"space-x":k()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":k()}],"space-y-reverse":["space-y-reverse"],size:[{size:ht()}],w:[{w:[a,"screen",...ht()]}],"min-w":[{"min-w":[a,"screen","none",...ht()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...ht()]}],h:[{h:["screen","lh",...ht()]}],"min-h":[{"min-h":["screen","lh","none",...ht()]}],"max-h":[{"max-h":["screen","lh",...ht()]}],"font-size":[{text:["base",e,xo,wi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,ct,Ic]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Cc,lt]}],"font-family":[{font:[Hb,lt,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,ct,lt]}],"line-clamp":[{"line-clamp":[It,"none",ct,Ic]}],leading:[{leading:[s,...k()]}],"list-image":[{"list-image":["none",ct,lt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ct,lt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:Y()}],"text-color":[{text:Y()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Z(),"wavy"]}],"text-decoration-thickness":[{decoration:[It,"from-font","auto",ct,wi]}],"text-decoration-color":[{decoration:Y()}],"underline-offset":[{"underline-offset":[It,"auto",ct,lt]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ct,lt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ct,lt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:St()}],"bg-repeat":[{bg:j()}],"bg-size":[{bg:W()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Zn,ct,lt],radial:["",ct,lt],conic:[Zn,ct,lt]},Wb,$b]}],"bg-color":[{bg:Y()}],"gradient-from-pos":[{from:ft()}],"gradient-via-pos":[{via:ft()}],"gradient-to-pos":[{to:ft()}],"gradient-from":[{from:Y()}],"gradient-via":[{via:Y()}],"gradient-to":[{to:Y()}],rounded:[{rounded:et()}],"rounded-s":[{"rounded-s":et()}],"rounded-e":[{"rounded-e":et()}],"rounded-t":[{"rounded-t":et()}],"rounded-r":[{"rounded-r":et()}],"rounded-b":[{"rounded-b":et()}],"rounded-l":[{"rounded-l":et()}],"rounded-ss":[{"rounded-ss":et()}],"rounded-se":[{"rounded-se":et()}],"rounded-ee":[{"rounded-ee":et()}],"rounded-es":[{"rounded-es":et()}],"rounded-tl":[{"rounded-tl":et()}],"rounded-tr":[{"rounded-tr":et()}],"rounded-br":[{"rounded-br":et()}],"rounded-bl":[{"rounded-bl":et()}],"border-w":[{border:rt()}],"border-w-x":[{"border-x":rt()}],"border-w-y":[{"border-y":rt()}],"border-w-s":[{"border-s":rt()}],"border-w-e":[{"border-e":rt()}],"border-w-t":[{"border-t":rt()}],"border-w-r":[{"border-r":rt()}],"border-w-b":[{"border-b":rt()}],"border-w-l":[{"border-l":rt()}],"divide-x":[{"divide-x":rt()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":rt()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Z(),"hidden","none"]}],"divide-style":[{divide:[...Z(),"hidden","none"]}],"border-color":[{border:Y()}],"border-color-x":[{"border-x":Y()}],"border-color-y":[{"border-y":Y()}],"border-color-s":[{"border-s":Y()}],"border-color-e":[{"border-e":Y()}],"border-color-t":[{"border-t":Y()}],"border-color-r":[{"border-r":Y()}],"border-color-b":[{"border-b":Y()}],"border-color-l":[{"border-l":Y()}],"divide-color":[{divide:Y()}],"outline-style":[{outline:[...Z(),"none","hidden"]}],"outline-offset":[{"outline-offset":[It,ct,lt]}],"outline-w":[{outline:["",It,xo,wi]}],"outline-color":[{outline:Y()}],shadow:[{shadow:["","none",h,Ga,Ha]}],"shadow-color":[{shadow:Y()}],"inset-shadow":[{"inset-shadow":["none",f,Ga,Ha]}],"inset-shadow-color":[{"inset-shadow":Y()}],"ring-w":[{ring:rt()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:Y()}],"ring-offset-w":[{"ring-offset":[It,wi]}],"ring-offset-color":[{"ring-offset":Y()}],"inset-ring-w":[{"inset-ring":rt()}],"inset-ring-color":[{"inset-ring":Y()}],"text-shadow":[{"text-shadow":["none",g,Ga,Ha]}],"text-shadow-color":[{"text-shadow":Y()}],opacity:[{opacity:[It,ct,lt]}],"mix-blend":[{"mix-blend":[...Q(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Q()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[It]}],"mask-image-linear-from-pos":[{"mask-linear-from":U()}],"mask-image-linear-to-pos":[{"mask-linear-to":U()}],"mask-image-linear-from-color":[{"mask-linear-from":Y()}],"mask-image-linear-to-color":[{"mask-linear-to":Y()}],"mask-image-t-from-pos":[{"mask-t-from":U()}],"mask-image-t-to-pos":[{"mask-t-to":U()}],"mask-image-t-from-color":[{"mask-t-from":Y()}],"mask-image-t-to-color":[{"mask-t-to":Y()}],"mask-image-r-from-pos":[{"mask-r-from":U()}],"mask-image-r-to-pos":[{"mask-r-to":U()}],"mask-image-r-from-color":[{"mask-r-from":Y()}],"mask-image-r-to-color":[{"mask-r-to":Y()}],"mask-image-b-from-pos":[{"mask-b-from":U()}],"mask-image-b-to-pos":[{"mask-b-to":U()}],"mask-image-b-from-color":[{"mask-b-from":Y()}],"mask-image-b-to-color":[{"mask-b-to":Y()}],"mask-image-l-from-pos":[{"mask-l-from":U()}],"mask-image-l-to-pos":[{"mask-l-to":U()}],"mask-image-l-from-color":[{"mask-l-from":Y()}],"mask-image-l-to-color":[{"mask-l-to":Y()}],"mask-image-x-from-pos":[{"mask-x-from":U()}],"mask-image-x-to-pos":[{"mask-x-to":U()}],"mask-image-x-from-color":[{"mask-x-from":Y()}],"mask-image-x-to-color":[{"mask-x-to":Y()}],"mask-image-y-from-pos":[{"mask-y-from":U()}],"mask-image-y-to-pos":[{"mask-y-to":U()}],"mask-image-y-from-color":[{"mask-y-from":Y()}],"mask-image-y-to-color":[{"mask-y-to":Y()}],"mask-image-radial":[{"mask-radial":[ct,lt]}],"mask-image-radial-from-pos":[{"mask-radial-from":U()}],"mask-image-radial-to-pos":[{"mask-radial-to":U()}],"mask-image-radial-from-color":[{"mask-radial-from":Y()}],"mask-image-radial-to-color":[{"mask-radial-to":Y()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":C()}],"mask-image-conic-pos":[{"mask-conic":[It]}],"mask-image-conic-from-pos":[{"mask-conic-from":U()}],"mask-image-conic-to-pos":[{"mask-conic-to":U()}],"mask-image-conic-from-color":[{"mask-conic-from":Y()}],"mask-image-conic-to-color":[{"mask-conic-to":Y()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:St()}],"mask-repeat":[{mask:j()}],"mask-size":[{mask:W()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ct,lt]}],filter:[{filter:["","none",ct,lt]}],blur:[{blur:st()}],brightness:[{brightness:[It,ct,lt]}],contrast:[{contrast:[It,ct,lt]}],"drop-shadow":[{"drop-shadow":["","none",p,Ga,Ha]}],"drop-shadow-color":[{"drop-shadow":Y()}],grayscale:[{grayscale:["",It,ct,lt]}],"hue-rotate":[{"hue-rotate":[It,ct,lt]}],invert:[{invert:["",It,ct,lt]}],saturate:[{saturate:[It,ct,lt]}],sepia:[{sepia:["",It,ct,lt]}],"backdrop-filter":[{"backdrop-filter":["","none",ct,lt]}],"backdrop-blur":[{"backdrop-blur":st()}],"backdrop-brightness":[{"backdrop-brightness":[It,ct,lt]}],"backdrop-contrast":[{"backdrop-contrast":[It,ct,lt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",It,ct,lt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[It,ct,lt]}],"backdrop-invert":[{"backdrop-invert":["",It,ct,lt]}],"backdrop-opacity":[{"backdrop-opacity":[It,ct,lt]}],"backdrop-saturate":[{"backdrop-saturate":[It,ct,lt]}],"backdrop-sepia":[{"backdrop-sepia":["",It,ct,lt]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":k()}],"border-spacing-x":[{"border-spacing-x":k()}],"border-spacing-y":[{"border-spacing-y":k()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ct,lt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[It,"initial",ct,lt]}],ease:[{ease:["linear","initial",S,ct,lt]}],delay:[{delay:[It,ct,lt]}],animate:[{animate:["none",M,ct,lt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,ct,lt]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:vt()}],"rotate-x":[{"rotate-x":vt()}],"rotate-y":[{"rotate-y":vt()}],"rotate-z":[{"rotate-z":vt()}],scale:[{scale:B()}],"scale-x":[{"scale-x":B()}],"scale-y":[{"scale-y":B()}],"scale-z":[{"scale-z":B()}],"scale-3d":["scale-3d"],skew:[{skew:pt()}],"skew-x":[{"skew-x":pt()}],"skew-y":[{"skew-y":pt()}],transform:[{transform:[ct,lt,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:H()}],"translate-x":[{"translate-x":H()}],"translate-y":[{"translate-y":H()}],"translate-z":[{"translate-z":H()}],"translate-none":["translate-none"],accent:[{accent:Y()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:Y()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ct,lt]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ct,lt]}],fill:[{fill:["none",...Y()]}],"stroke-w":[{stroke:[It,xo,wi,Ic]}],stroke:[{stroke:["none",...Y()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function mn(...n){return Xb(mb(n))}const _o=({text:n,title:t,toggleState:e,toggleOn:r,toggleOff:i})=>{const[s,o]=N.useState(!1),[a,l]=N.useState(e||!1),c=()=>{l(!a),a?i():r()};return w.jsx("div",{className:mn("w-[5.5em] text-center cursor-pointer select-none rounded-sm - mt-px mr-[5px] mb-0 ml-[5px] inline-block",s||a?"bg-[#5e5e5e] text-white border border-[#FFFFFF]":"text-[#CCCCCC] border border-[transparent]"),onMouseOver:()=>o(!0),onMouseOut:()=>o(!1),onClick:c,title:t,children:n})},Rg=({title:n,icon:t,textStyle:e,text:r,titleStyle:i,content:s})=>{const[o,a]=N.useState(!1),[l,c]=N.useState(!1);return w.jsxs("div",{className:"w-auto inline-block m-0 pr-1.5",children:[w.jsxs("div",{className:mn("flex items-center cursor-pointer text-center select-none",o?"text-white":"text-[#CCCCCC]"),onClick:()=>a(!o),title:n,children:[t&&t(),w.jsx("span",{className:"relative",style:e,children:r})]}),w.jsxs("div",{className:mn("fixed left-0 w-[calc(100%_-_2px)] transition-all duration-300 ease-in-out z-0 bottom-5 p-0 m-0 bg-[#2E2F33] border-t border-t-[#555]",o?"h-[40%]":"invisible h-0"),children:[w.jsxs("div",{className:"relative w-full h-[2em] top-0 left-0 border-b border-b-[#555]",children:[w.jsx("b",{className:"relative h-[2em] ml-[1em] leading-[2em]",style:i,children:n}),w.jsx(F1,{className:mn("absolute w-[2em] h-[2em] right-0 top-0 cursor-pointer p-2 border-l border-l-[#555]",l?"text-white bg-[#005FAF]":""),onMouseOver:()=>c(!0),onMouseOut:()=>c(!1),onClick:()=>a(!o)})]}),w.jsx("div",{className:"relative w-full p-[1em] overflow-y-auto h-[calc(100%_-_2em)]",children:s})]})]})};function Jb(n){return ge({attr:{fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607ZM13.5 10.5h-6"},child:[]}]})(n)}function Zb(n){return ge({attr:{fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607ZM10.5 7.5v6m3-3h-6"},child:[]}]})(n)}function Kb(n,t,e,r,i){return r+(i-r)*(n-t)/(e-t)}const Qb=()=>{const{planner:n,toggleSnap:t,viewer:e}=ne(),{mode:r,mouse:i,zoom:s,snapMask:o}=n,a=n.get("warnings").toArray(),l=n.get("errors").toArray(),c=f=>t(o.merge(f)),h=f=>{const g=parseInt(ig(s).toFixed());if(g===0&&f==="out"||g===100&&f==="in"||!e)return;const p=e==null?void 0:e.getValue(),m=p.viewerWidth/2,v=p.viewerHeight/2,_=f==="in"?-1:1,S=1.06,M=Math.max(-1,Math.min(1,_)),T=Kb(M,-1,1,S,1/S);e.zoom(m,v,T)};return w.jsxs("div",{className:"floor_planner-footerbar absolute z-[9001] py-[3px] px-[1em] text-xs bg-[#424242] h-5 w-full select-none cursor-default bottom-0 leading-[14px] text-white m-0",children:[Tl.includes(r)&&w.jsxs(w.Fragment,{children:[w.jsx("div",{className:"relative float-left px-[1em] inline-block border-r border-r-white",title:"Scene Zoom Level",children:w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx("span",{children:"Zoom:"})," ",w.jsx(Jb,{className:"inline-block cursor-pointer",size:16,onClick:()=>h("out")})," ",w.jsxs("span",{children:[ig(s).toFixed(),"%"]})," ",w.jsx(Zb,{className:"inline-block cursor-pointer",size:16,onClick:()=>h("in")})]})}),w.jsxs("div",{className:"relative float-left px-[1em] inline-block border-r border-r-white",children:[w.jsx(_o,{toggleOn:()=>{c({SNAP_POINT:!0})},toggleOff:()=>{c({SNAP_POINT:!1})},text:"Snap PT",toggleState:o.get(Pl),title:"Snap to Point"}),w.jsx(_o,{toggleOn:()=>{c({SNAP_LINE:!0})},toggleOff:()=>{c({SNAP_LINE:!1})},text:"Snap LN",toggleState:o.get(Rl),title:"Snap to Line"}),w.jsx(_o,{toggleOn:()=>{c({SNAP_SEGMENT:!0})},toggleOff:()=>{c({SNAP_SEGMENT:!1})},text:"Snap SEG",toggleState:o.get(Ll),title:"Snap to Segment"}),w.jsx(_o,{toggleOn:()=>{c({SNAP_GRID:!0})},toggleOff:()=>{c({SNAP_GRID:!1})},text:"Snap GRD",toggleState:o.get(Fl),title:"Snap to Grid"}),w.jsx(_o,{toggleOn:()=>{c({SNAP_GUIDE:!0})},toggleOff:()=>{c({SNAP_GUIDE:!1})},text:"Snap GDE",toggleState:o.get(md),title:"Snap to Guide"})]})]}),w.jsxs("div",{className:"relative float-right inline-block px-[1em] border-l border-l-white",children:[w.jsx(Rg,{icon:()=>w.jsx(Y1,{style:{width:"15px",height:"15px",marginTop:"-2px",marginRight:"2px",...l.length?{transform:"rotate(45deg)",color:"#F44336"}:{transform:"rotate(45deg)"}}}),text:l.length.toString(),textStyle:l.length?{color:"#F44336"}:{},title:`Errors [ ${l.length} ]`,titleStyle:l.length?{color:"#F44336"}:{},content:w.jsx(w.Fragment,{children:l.map((f,g)=>w.jsxs("div",{style:{borderBottom:"1px solid #555",lineHeight:"1.5em"},children:["[ ",new Date(f.date).toLocaleString()," ] ",f.error]},g))})}),w.jsx(Rg,{icon:()=>w.jsx(U1,{style:{width:"15px",height:"15px",marginTop:"-2px",marginRight:"2px",...a.length?{color:"#FFEB3B"}:{}}}),text:a.length.toString(),textStyle:a.length?{color:"#FFEB3B"}:{},title:`Warnings [ ${a.length} ]`,titleStyle:a.length?{color:"#FFEB3B"}:{},content:w.jsx(w.Fragment,{children:a.map((f,g)=>w.jsxs("div",{className:"leading-6 border-b border-b-[#555555]",children:["[ ",new Date(f.date).toLocaleString()," ] ",f.warning]},g))})})]})]})},Lg=({children:n,name:t,...e})=>{const[r,i]=N.useState(e.opened||!1);return w.jsxs("div",{className:"select-none",style:{borderBottom:"1px solid #5e5e5e"},children:[w.jsxs("div",{className:"flex px-4 pt-2.5 pb-3 items-center gap-1 bg-[#2b2b2b] text-white cursor-pointer",onClick:()=>i(!r),children:[r?w.jsx(k1,{size:16}):w.jsx(P1,{size:16}),w.jsx("span",{className:"text-sm leading-none",children:t})]}),w.jsx("div",{className:mn("text-[11px] text-[#EBEBEB] border border-[#222222] bg-[#424242]",r?"block":"hidden"),children:n})]})};function Hr({children:n,style:t,className:e,...r}){return w.jsx("label",{className:mn("mb-1 text-xs capitalize font-bold text-white block",e),style:t,...r,children:n})}const Cn=({value:n,min:t,max:e,precision:r,onChange:i,onValid:s,onInvalid:o,style:a,placeholder:l})=>{const[c,h]=N.useState(!0),[f,g]=N.useState(n);let p=new RegExp(`^-?([0-9]+)?\\.?([0-9]{0,${r}})?$`);N.useEffect(()=>{t!==void 0&&!isNaN(t)&&isFinite(t)&&Number(f)<t&&g(t),e&&!isNaN(e)&&isFinite(e)&&Number(f)>e&&g(e)},[t,e,f]);const m=N.useMemo(()=>parseFloat(String(n)).toFixed(r)!==parseFloat(String(f)).toFixed(r),[n,f,r]),v=_=>{if(_.stopPropagation(),c){let S=f!==""&&f!=="-"?parseFloat(String(f)):0;g(S),i({target:{value:S}})}};return w.jsxs("div",{className:"relative w-full",children:[w.jsx("input",{type:"text",value:p.test(String(f))?f:parseFloat(String(f)).toFixed(r),className:"block text-[13px] text-white h-[35px] w-full px-2 leading-5 rounded border border-[#5e5e5e] bg-[#2b2b2b] outline-none focus:outline-none",style:{...a},onChange:_=>{let S=p.test(_.target.value);S?(g(_.target.value),s&&s(_.nativeEvent)):o&&o(_.nativeEvent),h(S)},onKeyDown:_=>{var S=_.keyCode||_.which;(S==Er.ENTER||S==Er.TAB)&&m&&v(_)},placeholder:l}),w.jsx("div",{onClick:_=>{m&&v(_)},title:"Confirm",className:"absolute cursor-pointer w-[2em] h-[2em] text-white top-[0.35em] right-[0.35em] bg-[#1CA6FC]",style:{transition:"all 0.1s linear",visibility:m?"visible":"hidden",opacity:m?"1":"0"},children:w.jsx(W1,{style:{width:"100%",height:"100%",padding:"0.2em",color:"#FFF"}})})]})},tw={mm:{name:{singular:"Millimeter",plural:"Millimeters"},to_anchor:1/1e3},cm:{name:{singular:"Centimeter",plural:"Centimeters"},to_anchor:1/100},m:{name:{singular:"Meter",plural:"Meters"},to_anchor:1},km:{name:{singular:"Kilometer",plural:"Kilometers"},to_anchor:1e3}},ew={in:{name:{singular:"Inch",plural:"Inches"},to_anchor:1/12},yd:{name:{singular:"Yard",plural:"Yards"},to_anchor:3},"ft-us":{name:{singular:"US Survey Foot",plural:"US Survey Feet"},to_anchor:1.000002},ft:{name:{singular:"Foot",plural:"Feet"},to_anchor:1},mi:{name:{singular:"Mile",plural:"Miles"},to_anchor:5280}},rw={metric:tw,imperial:ew,_anchors:{metric:{unit:"m",ratio:3.28084},imperial:{unit:"ft",ratio:1/3.28084}}},nw={mm2:{name:{singular:"Square Millimeter",plural:"Square Millimeters"},to_anchor:1/1e6},cm2:{name:{singular:"Centimeter",plural:"Centimeters"},to_anchor:1/1e4},m2:{name:{singular:"Square Meter",plural:"Square Meters"},to_anchor:1},ha:{name:{singular:"Hectare",plural:"Hectares"},to_anchor:1e4},km2:{name:{singular:"Square Kilometer",plural:"Square Kilometers"},to_anchor:1e6}},iw={in2:{name:{singular:"Square Inch",plural:"Square Inches"},to_anchor:1/144},yd2:{name:{singular:"Square Yard",plural:"Square Yards"},to_anchor:9},ft2:{name:{singular:"Square Foot",plural:"Square Feet"},to_anchor:1},ac:{name:{singular:"Acre",plural:"Acres"},to_anchor:43560},mi2:{name:{singular:"Square Mile",plural:"Square Miles"},to_anchor:27878400}},sw={metric:nw,imperial:iw,_anchors:{metric:{unit:"m2",ratio:10.7639},imperial:{unit:"ft2",ratio:1/10.7639}}},ow={mcg:{name:{singular:"Microgram",plural:"Micrograms"},to_anchor:1/1e6},mg:{name:{singular:"Milligram",plural:"Milligrams"},to_anchor:1/1e3},g:{name:{singular:"Gram",plural:"Grams"},to_anchor:1},kg:{name:{singular:"Kilogram",plural:"Kilograms"},to_anchor:1e3},mt:{name:{singular:"Metric Tonne",plural:"Metric Tonnes"},to_anchor:1e6}},aw={oz:{name:{singular:"Ounce",plural:"Ounces"},to_anchor:1/16},lb:{name:{singular:"Pound",plural:"Pounds"},to_anchor:1},t:{name:{singular:"Ton",plural:"Tons"},to_anchor:2e3}},uw={metric:ow,imperial:aw,_anchors:{metric:{unit:"g",ratio:1/453.592},imperial:{unit:"lb",ratio:453.592}}},lw={mm3:{name:{singular:"Cubic Millimeter",plural:"Cubic Millimeters"},to_anchor:1/1e6},cm3:{name:{singular:"Cubic Centimeter",plural:"Cubic Centimeters"},to_anchor:1/1e3},ml:{name:{singular:"Millilitre",plural:"Millilitres"},to_anchor:1/1e3},cl:{name:{singular:"Centilitre",plural:"Centilitres"},to_anchor:1/100},dl:{name:{singular:"Decilitre",plural:"Decilitres"},to_anchor:1/10},l:{name:{singular:"Litre",plural:"Litres"},to_anchor:1},kl:{name:{singular:"Kilolitre",plural:"Kilolitres"},to_anchor:1e3},m3:{name:{singular:"Cubic meter",plural:"Cubic meters"},to_anchor:1e3},km3:{name:{singular:"Cubic kilometer",plural:"Cubic kilometers"},to_anchor:1e12},krm:{name:{singular:"Matsked",plural:"Matskedar"},to_anchor:1/1e3},tsk:{name:{singular:"Tesked",plural:"Teskedar"},to_anchor:5/1e3},msk:{name:{singular:"Matsked",plural:"Matskedar"},to_anchor:15/1e3},kkp:{name:{singular:"Kaffekopp",plural:"Kaffekoppar"},to_anchor:150/1e3},glas:{name:{singular:"Glas",plural:"Glas"},to_anchor:200/1e3},kanna:{name:{singular:"Kanna",plural:"Kannor"},to_anchor:2.617}},cw={tsp:{name:{singular:"Teaspoon",plural:"Teaspoons"},to_anchor:1/6},Tbs:{name:{singular:"Tablespoon",plural:"Tablespoons"},to_anchor:1/2},in3:{name:{singular:"Cubic inch",plural:"Cubic inches"},to_anchor:.55411},"fl-oz":{name:{singular:"Fluid Ounce",plural:"Fluid Ounces"},to_anchor:1},cup:{name:{singular:"Cup",plural:"Cups"},to_anchor:8},pnt:{name:{singular:"Pint",plural:"Pints"},to_anchor:16},qt:{name:{singular:"Quart",plural:"Quarts"},to_anchor:32},gal:{name:{singular:"Gallon",plural:"Gallons"},to_anchor:128},ft3:{name:{singular:"Cubic foot",plural:"Cubic feet"},to_anchor:957.506},yd3:{name:{singular:"Cubic yard",plural:"Cubic yards"},to_anchor:25852.7}},hw={metric:lw,imperial:cw,_anchors:{metric:{unit:"l",ratio:33.8140226},imperial:{unit:"fl-oz",ratio:1/33.8140226}}},fw={metric:{ea:{name:{singular:"Each",plural:"Each"},to_anchor:1},dz:{name:{singular:"Dozen",plural:"Dozens"},to_anchor:12}},imperial:{},_anchors:{metric:{unit:"ea",ratio:1}}},dw={metric:{C:{name:{singular:"degree Celsius",plural:"degrees Celsius"},to_anchor:1,anchor_shift:0},K:{name:{singular:"degree Kelvin",plural:"degrees Kelvin"},to_anchor:1,anchor_shift:273.15}},imperial:{F:{name:{singular:"degree Fahrenheit",plural:"degrees Fahrenheit"},to_anchor:1},R:{name:{singular:"degree Rankine",plural:"degrees Rankine"},to_anchor:1,anchor_shift:459.67}},_anchors:{metric:{unit:"C",transform:function(n){return n/(5/9)+32}},imperial:{unit:"F",transform:function(n){return(n-32)*(5/9)}}}},Fg=365.25,pw={metric:{ns:{name:{singular:"Nanosecond",plural:"Nanoseconds"},to_anchor:1/1e9},mu:{name:{singular:"Microsecond",plural:"Microseconds"},to_anchor:1/1e6},ms:{name:{singular:"Millisecond",plural:"Milliseconds"},to_anchor:1/1e3},s:{name:{singular:"Second",plural:"Seconds"},to_anchor:1},min:{name:{singular:"Minute",plural:"Minutes"},to_anchor:60},h:{name:{singular:"Hour",plural:"Hours"},to_anchor:3600},d:{name:{singular:"Day",plural:"Days"},to_anchor:3600*24},week:{name:{singular:"Week",plural:"Weeks"},to_anchor:3600*24*7},month:{name:{singular:"Month",plural:"Months"},to_anchor:3600*24*Fg/12},year:{name:{singular:"Year",plural:"Years"},to_anchor:3600*24*Fg}},_anchors:{metric:{unit:"s",ratio:1}}},gw={bits:{b:{name:{singular:"Bit",plural:"Bits"},to_anchor:1},Kb:{name:{singular:"Kilobit",plural:"Kilobits"},to_anchor:1024},Mb:{name:{singular:"Megabit",plural:"Megabits"},to_anchor:1048576},Gb:{name:{singular:"Gigabit",plural:"Gigabits"},to_anchor:1073741824},Tb:{name:{singular:"Terabit",plural:"Terabits"},to_anchor:1099511627776}},bytes:{B:{name:{singular:"Byte",plural:"Bytes"},to_anchor:1},KB:{name:{singular:"Kilobyte",plural:"Kilobytes"},to_anchor:1024},MB:{name:{singular:"Megabyte",plural:"Megabytes"},to_anchor:1048576},GB:{name:{singular:"Gigabyte",plural:"Gigabytes"},to_anchor:1073741824},TB:{name:{singular:"Terabyte",plural:"Terabytes"},to_anchor:1099511627776}},_anchors:{bits:{unit:"b",ratio:1/8},bytes:{unit:"B",ratio:8}}},mw={metric:{ppm:{name:{singular:"Part-per Million",plural:"Parts-per Million"},to_anchor:1},ppb:{name:{singular:"Part-per Billion",plural:"Parts-per Billion"},to_anchor:.001},ppt:{name:{singular:"Part-per Trillion",plural:"Parts-per Trillion"},to_anchor:1e-6},ppq:{name:{singular:"Part-per Quadrillion",plural:"Parts-per Quadrillion"},to_anchor:1e-9}},imperial:{},_anchors:{metric:{unit:"ppm",ratio:1e-6}}},yw={metric:{"m/s":{name:{singular:"Metre per second",plural:"Metres per second"},to_anchor:3.6},"km/h":{name:{singular:"Kilometre per hour",plural:"Kilometres per hour"},to_anchor:1}},imperial:{"m/h":{name:{singular:"Mile per hour",plural:"Miles per hour"},to_anchor:1},knot:{name:{singular:"Knot",plural:"Knots"},to_anchor:1.150779},"ft/s":{name:{singular:"Foot per second",plural:"Feet per second"},to_anchor:.681818}},_anchors:{metric:{unit:"km/h",ratio:1/1.609344},imperial:{unit:"m/h",ratio:1.609344}}},vw={Pa:{name:{singular:"pascal",plural:"pascals"},to_anchor:1/1e3},kPa:{name:{singular:"kilopascal",plural:"kilopascals"},to_anchor:1},MPa:{name:{singular:"megapascal",plural:"megapascals"},to_anchor:1e3},hPa:{name:{singular:"hectopascal",plural:"hectopascals"},to_anchor:1/10},bar:{name:{singular:"bar",plural:"bar"},to_anchor:100},torr:{name:{singular:"torr",plural:"torr"},to_anchor:101325/76e4}},xw={psi:{name:{singular:"pound per square inch",plural:"pounds per square inch"},to_anchor:1/1e3},ksi:{name:{singular:"kilopound per square inch",plural:"kilopound per square inch"},to_anchor:1}},_w={metric:vw,imperial:xw,_anchors:{metric:{unit:"kPa",ratio:.00014503768078},imperial:{unit:"psi",ratio:1/.00014503768078}}},bw={metric:{A:{name:{singular:"Ampere",plural:"Amperes"},to_anchor:1},mA:{name:{singular:"Milliampere",plural:"Milliamperes"},to_anchor:.001},kA:{name:{singular:"Kiloampere",plural:"Kiloamperes"},to_anchor:1e3}},_anchors:{metric:{unit:"A",ratio:1}}},ww={metric:{V:{name:{singular:"Volt",plural:"Volts"},to_anchor:1},mV:{name:{singular:"Millivolt",plural:"Millivolts"},to_anchor:.001},kV:{name:{singular:"Kilovolt",plural:"Kilovolts"},to_anchor:1e3}},_anchors:{metric:{unit:"V",ratio:1}}},Sw={metric:{W:{name:{singular:"Watt",plural:"Watts"},to_anchor:1},mW:{name:{singular:"Milliwatt",plural:"Milliwatts"},to_anchor:.001},kW:{name:{singular:"Kilowatt",plural:"Kilowatts"},to_anchor:1e3},MW:{name:{singular:"Megawatt",plural:"Megawatts"},to_anchor:1e6},GW:{name:{singular:"Gigawatt",plural:"Gigawatts"},to_anchor:1e9}},_anchors:{metric:{unit:"W",ratio:1}}},Ew={metric:{VAR:{name:{singular:"Volt-Ampere Reactive",plural:"Volt-Amperes Reactive"},to_anchor:1},mVAR:{name:{singular:"Millivolt-Ampere Reactive",plural:"Millivolt-Amperes Reactive"},to_anchor:.001},kVAR:{name:{singular:"Kilovolt-Ampere Reactive",plural:"Kilovolt-Amperes Reactive"},to_anchor:1e3},MVAR:{name:{singular:"Megavolt-Ampere Reactive",plural:"Megavolt-Amperes Reactive"},to_anchor:1e6},GVAR:{name:{singular:"Gigavolt-Ampere Reactive",plural:"Gigavolt-Amperes Reactive"},to_anchor:1e9}},_anchors:{metric:{unit:"VAR",ratio:1}}},Mw={metric:{VA:{name:{singular:"Volt-Ampere",plural:"Volt-Amperes"},to_anchor:1},mVA:{name:{singular:"Millivolt-Ampere",plural:"Millivolt-Amperes"},to_anchor:.001},kVA:{name:{singular:"Kilovolt-Ampere",plural:"Kilovolt-Amperes"},to_anchor:1e3},MVA:{name:{singular:"Megavolt-Ampere",plural:"Megavolt-Amperes"},to_anchor:1e6},GVA:{name:{singular:"Gigavolt-Ampere",plural:"Gigavolt-Amperes"},to_anchor:1e9}},_anchors:{metric:{unit:"VA",ratio:1}}},Aw={metric:{Wh:{name:{singular:"Watt-hour",plural:"Watt-hours"},to_anchor:3600},mWh:{name:{singular:"Milliwatt-hour",plural:"Milliwatt-hours"},to_anchor:3.6},kWh:{name:{singular:"Kilowatt-hour",plural:"Kilowatt-hours"},to_anchor:36e5},MWh:{name:{singular:"Megawatt-hour",plural:"Megawatt-hours"},to_anchor:36e8},GWh:{name:{singular:"Gigawatt-hour",plural:"Gigawatt-hours"},to_anchor:36e11},J:{name:{singular:"Joule",plural:"Joules"},to_anchor:1},kJ:{name:{singular:"Kilojoule",plural:"Kilojoules"},to_anchor:1e3}},_anchors:{metric:{unit:"J",ratio:1}}},Ow={metric:{VARh:{name:{singular:"Volt-Ampere Reactive Hour",plural:"Volt-Amperes Reactive Hour"},to_anchor:1},mVARh:{name:{singular:"Millivolt-Ampere Reactive Hour",plural:"Millivolt-Amperes Reactive Hour"},to_anchor:.001},kVARh:{name:{singular:"Kilovolt-Ampere Reactive Hour",plural:"Kilovolt-Amperes Reactive Hour"},to_anchor:1e3},MVARh:{name:{singular:"Megavolt-Ampere Reactive Hour",plural:"Megavolt-Amperes Reactive Hour"},to_anchor:1e6},GVARh:{name:{singular:"Gigavolt-Ampere Reactive Hour",plural:"Gigavolt-Amperes Reactive Hour"},to_anchor:1e9}},_anchors:{metric:{unit:"VARh",ratio:1}}},zw={"mm3/s":{name:{singular:"Cubic Millimeter per second",plural:"Cubic Millimeters per second"},to_anchor:1/1e6},"cm3/s":{name:{singular:"Cubic Centimeter per second",plural:"Cubic Centimeters per second"},to_anchor:1/1e3},"ml/s":{name:{singular:"Millilitre per second",plural:"Millilitres per second"},to_anchor:1/1e3},"cl/s":{name:{singular:"Centilitre per second",plural:"Centilitres per second"},to_anchor:1/100},"dl/s":{name:{singular:"Decilitre per second",plural:"Decilitres per second"},to_anchor:1/10},"l/s":{name:{singular:"Litre per second",plural:"Litres per second"},to_anchor:1},"l/min":{name:{singular:"Litre per minute",plural:"Litres per minute"},to_anchor:1/60},"l/h":{name:{singular:"Litre per hour",plural:"Litres per hour"},to_anchor:1/3600},"kl/s":{name:{singular:"Kilolitre per second",plural:"Kilolitres per second"},to_anchor:1e3},"kl/min":{name:{singular:"Kilolitre per minute",plural:"Kilolitres per minute"},to_anchor:50/3},"kl/h":{name:{singular:"Kilolitre per hour",plural:"Kilolitres per hour"},to_anchor:5/18},"m3/s":{name:{singular:"Cubic meter per second",plural:"Cubic meters per second"},to_anchor:1e3},"m3/min":{name:{singular:"Cubic meter per minute",plural:"Cubic meters per minute"},to_anchor:50/3},"m3/h":{name:{singular:"Cubic meter per hour",plural:"Cubic meters per hour"},to_anchor:5/18},"km3/s":{name:{singular:"Cubic kilometer per second",plural:"Cubic kilometers per second"},to_anchor:1e12}},Tw={"tsp/s":{name:{singular:"Teaspoon per second",plural:"Teaspoons per second"},to_anchor:1/6},"Tbs/s":{name:{singular:"Tablespoon per second",plural:"Tablespoons per second"},to_anchor:1/2},"in3/s":{name:{singular:"Cubic inch per second",plural:"Cubic inches per second"},to_anchor:.55411},"in3/min":{name:{singular:"Cubic inch per minute",plural:"Cubic inches per minute"},to_anchor:.55411/60},"in3/h":{name:{singular:"Cubic inch per hour",plural:"Cubic inches per hour"},to_anchor:.55411/3600},"fl-oz/s":{name:{singular:"Fluid Ounce per second",plural:"Fluid Ounces per second"},to_anchor:1},"fl-oz/min":{name:{singular:"Fluid Ounce per minute",plural:"Fluid Ounces per minute"},to_anchor:1/60},"fl-oz/h":{name:{singular:"Fluid Ounce per hour",plural:"Fluid Ounces per hour"},to_anchor:1/3600},"cup/s":{name:{singular:"Cup per second",plural:"Cups per second"},to_anchor:8},"pnt/s":{name:{singular:"Pint per second",plural:"Pints per second"},to_anchor:16},"pnt/min":{name:{singular:"Pint per minute",plural:"Pints per minute"},to_anchor:4/15},"pnt/h":{name:{singular:"Pint per hour",plural:"Pints per hour"},to_anchor:1/225},"qt/s":{name:{singular:"Quart per second",plural:"Quarts per second"},to_anchor:32},"gal/s":{name:{singular:"Gallon per second",plural:"Gallons per second"},to_anchor:128},"gal/min":{name:{singular:"Gallon per minute",plural:"Gallons per minute"},to_anchor:32/15},"gal/h":{name:{singular:"Gallon per hour",plural:"Gallons per hour"},to_anchor:8/225},"ft3/s":{name:{singular:"Cubic foot per second",plural:"Cubic feet per second"},to_anchor:957.506},"ft3/min":{name:{singular:"Cubic foot per minute",plural:"Cubic feet per minute"},to_anchor:957.506/60},"ft3/h":{name:{singular:"Cubic foot per hour",plural:"Cubic feet per hour"},to_anchor:957.506/3600},"yd3/s":{name:{singular:"Cubic yard per second",plural:"Cubic yards per second"},to_anchor:25852.7},"yd3/min":{name:{singular:"Cubic yard per minute",plural:"Cubic yards per minute"},to_anchor:25852.7/60},"yd3/h":{name:{singular:"Cubic yard per hour",plural:"Cubic yards per hour"},to_anchor:25852.7/3600}},Cw={metric:zw,imperial:Tw,_anchors:{metric:{unit:"l/s",ratio:33.8140227},imperial:{unit:"fl-oz/s",ratio:1/33.8140227}}},Iw={metric:{lx:{name:{singular:"Lux",plural:"Lux"},to_anchor:1}},imperial:{"ft-cd":{name:{singular:"Foot-candle",plural:"Foot-candles"},to_anchor:1}},_anchors:{metric:{unit:"lx",ratio:1/10.76391},imperial:{unit:"ft-cd",ratio:10.76391}}},kw={metric:{mHz:{name:{singular:"millihertz",plural:"millihertz"},to_anchor:1/1e3},Hz:{name:{singular:"hertz",plural:"hertz"},to_anchor:1},kHz:{name:{singular:"kilohertz",plural:"kilohertz"},to_anchor:1e3},MHz:{name:{singular:"megahertz",plural:"megahertz"},to_anchor:1e3*1e3},GHz:{name:{singular:"gigahertz",plural:"gigahertz"},to_anchor:1e3*1e3*1e3},THz:{name:{singular:"terahertz",plural:"terahertz"},to_anchor:1e3*1e3*1e3*1e3},rpm:{name:{singular:"rotation per minute",plural:"rotations per minute"},to_anchor:1/60},"deg/s":{name:{singular:"degree per second",plural:"degrees per second"},to_anchor:1/360},"rad/s":{name:{singular:"radian per second",plural:"radians per second"},to_anchor:1/(Math.PI*2)}},_anchors:{frequency:{unit:"hz",ratio:1}}},Kn={length:rw,area:sw,mass:uw,volume:hw,each:fw,temperature:dw,time:pw,digital:gw,partsPer:mw,speed:yw,pressure:_w,current:bw,voltage:ww,power:Sw,reactivePower:Ew,apparentPower:Mw,energy:Aw,reactiveEnergy:Ow,volumeFlowRate:Cw,illuminance:Iw,frequency:kw};function bo(n){return Object.keys(n)}function Ng(n){return{abbr:n.abbr,measure:n.measure,system:n.system,singular:n.unit.name.singular,plural:n.unit.name.plural}}function zr(n,t){if(Array.isArray(n))for(let e=0;e<n.length;e++)t(n[e],e,n);else if(n&&typeof n=="object")for(let e in n)Object.prototype.hasOwnProperty.call(n,e)&&t(n[e],e,n)}class Pw{constructor(t,e){Vt(this,"val");Vt(this,"destination");Vt(this,"origin");this.val=e?t/e:t}from(t){if(this.destination)throw new Error(".from must be called before .to");return this.origin=this.getUnit(t),this.origin||this.throwUnsupportedUnitError(t),this}to(t){if(!this.origin)throw new Error(".to must be called after .from");if(this.destination=this.getUnit(t),this.destination||this.throwUnsupportedUnitError(t),this.origin.abbr===this.destination.abbr)return this.val;if(this.destination.measure!==this.origin.measure)throw new Error(`Cannot convert incompatible measures of ${this.destination.measure} and ${this.origin.measure}`);let e=this.val*this.origin.unit.to_anchor;if(this.origin.unit.anchor_shift&&(e-=this.origin.unit.anchor_shift),this.origin.system!==this.destination.system){const r=Kn[this.origin.measure]._anchors[this.origin.system];e=typeof r.transform=="function"?r.transform(e):e*r.ratio}return this.destination.unit.anchor_shift&&(e+=this.destination.unit.anchor_shift),e/this.destination.unit.to_anchor}toBest(t){if(!this.origin)throw new Error(".toBest must be called after .from");const e={exclude:[],cutOffNumber:1,...t};let r=null;return zr(this.possibilities(),i=>{if(e.exclude.includes(i))return;const s=this.describe(i);if(s.system!==this.origin.system)return;const o=this.to(i);(!r||o>=e.cutOffNumber&&o<r.val)&&(r={val:o,unit:i,singular:s.singular,plural:s.plural})}),r}getUnit(t){let e=null;return zr(Kn,(r,i)=>{zr(r,(s,o)=>{o!=="_anchors"&&zr(s,(a,l)=>{l===t&&(e={abbr:t,measure:i,system:o,unit:a})})})}),e}describe(t){const e=this.getUnit(t);return e||this.throwUnsupportedUnitError(t),Ng(e)}list(t){const e=[];return zr(Kn,(r,i)=>{t&&t!==i||zr(r,(s,o)=>{o!=="_anchors"&&zr(s,(a,l)=>{e.push(Ng({abbr:l,measure:i,system:o,unit:a}))})})}),e}throwUnsupportedUnitError(t){const e=[];throw zr(Kn,r=>{zr(r,(i,s)=>{s!=="_anchors"&&e.push(...bo(i))})}),new Error(`Unsupported unit ${t}, use one of: ${e.join(", ")}`)}possibilities(t){const e=[];if(!this.origin&&!t)zr(bo(Kn),r=>{zr(Kn[r],(i,s)=>{s!=="_anchors"&&e.push(...bo(i))})});else{const r=t||this.origin.measure;zr(Kn[r],(i,s)=>{s!=="_anchors"&&e.push(...bo(i))})}return e}measures(){return bo(Kn)}}function Gr(n){return new Pw(n)}const Rw={fontSize:"13px",WebkitAppearance:"none"};function kc({children:n,style:t,...e}){return w.jsx("select",{className:"w-full cursor-pointer block px-2 outline-none rounded h-[35px] text-white bg-[#5e5e5e]",style:{...Rw,...t},...e,children:n})}const Pc=({value:n,onUpdate:t,onValid:e,configs:r,sourceElement:i,internalState:s})=>{const{planner:o}=ne(),a=n.get("length")||0,l=n.get("_length")||a,c=n.get("_unit")||un,{hook:h,label:f,...g}=r,p=(m,v)=>{let _=tr(m),S=n.merge({length:v!==un?Gr(_).from(v).to(un):_,_length:m,_unit:v});return h?h(S,i,s,o).then(M=>t(M)):t(S)};return w.jsxs("div",{className:"PropertyLengthMeasure w-full mb-2",children:[w.jsx(Hr,{children:f}),w.jsxs("div",{className:"w-full flex",children:[w.jsx(Cn,{value:l,style:{borderTopRightRadius:0,borderBottomRightRadius:0,borderRightWidth:0},onChange:m=>p(m.target.value,c),onValid:e,...g}),w.jsx("div",{className:"w-1/4 [&>*:first-child]:text-center",children:w.jsx(kc,{style:{borderTopLeftRadius:"0px",borderBottomLeftRadius:"0px"},value:c,onChange:m=>p(l,m.target.value),children:dd.map(m=>w.jsx("option",{value:m,children:m},m))})})]})]})},wo=({style:n,...t})=>w.jsx("input",{className:"block w-full px-2 text-sm leading-5 bg-[#2b2b2b] rounded border border-[#5e5e5e] outline-none h-[35px] text-white",style:{...n},type:"text",...t}),Lw=({value:n,onUpdate:t,configs:e,sourceElement:r,internalState:i})=>{const{planner:s}=ne(),o=a=>e.hook?e.hook(a,r,i,s).then(l=>t(l)):t(a);return w.jsxs("div",{className:"PropertyString w-full mb-2",children:[w.jsx(Hr,{children:e.label}),w.jsx(wo,{value:n,onChange:a=>o(a.target.value)})]})},Fw=({element:n,attributeFormData:t,onUpdate:e,...r})=>{let i=t.has("name")?t.get("name"):n.name,s=t.has("offsetA")?t.get("offsetA"):n.offsetA,o=t.has("offsetB")?t.get("offsetB"):n.offsetA;return w.jsxs("div",{children:[w.jsx(Lw,{value:i,onUpdate:a=>e("name",a),configs:{label:"Nome"},...r}),w.jsx(Pc,{value:s,onUpdate:a=>e("offsetA",a),configs:{label:"Offset 1",min:0,max:1/0,precision:2},...r}),w.jsx(Pc,{value:o,onUpdate:a=>e("offsetB",a),configs:{label:"Offset 2",min:0,max:1/0,precision:2},...r})]})},Nw=({element:n,onUpdate:t,attributeFormData:e,...r})=>{let i=e.has("name")?e.get("name"):n.name,s=e.has("x")?e.get("x"):n.x,o=e.has("y")?e.get("y"):n.y,a=e.has("rotation")?e.get("rotation"):n.rotation;return w.jsx("table",{className:"w-full",children:w.jsxs("tbody",{children:[w.jsxs("tr",{children:[w.jsx("td",{className:"w-[6em]",children:"Name"}),w.jsx("td",{children:w.jsx(wo,{value:i,onChange:l=>t("name",l.target.value),style:{textAlign:"left"}})})]}),w.jsxs("tr",{children:[w.jsx("td",{className:"w-[6em]",children:"X"}),w.jsx("td",{children:w.jsx(Cn,{value:s,onChange:l=>t("x",l.target.value),style:{textAlign:"left"},precision:2,...r})})]}),w.jsxs("tr",{children:[w.jsx("td",{className:"w-[6em]",children:"Y"}),w.jsx("td",{children:w.jsx(Cn,{value:o,onChange:l=>t("y",l.target.value),style:{textAlign:"left"},precision:2,...r})})]}),w.jsxs("tr",{children:[w.jsx("td",{className:"w-[6em]",children:"Rotation"}),w.jsx("td",{children:w.jsx(Cn,{value:a,onChange:l=>t("rotation",l.target.value),style:{textAlign:"left"},precision:2,...r})})]})]})})},jw=({element:n,onUpdate:t,attributeFormData:e})=>{let r=e.has("name")?e.get("name"):n.name,i=e.has("lineLength")?e.get("lineLength"):null;return w.jsxs("div",{children:[w.jsxs("div",{className:"w-full mb-2",children:[w.jsx(Hr,{children:"Name"}),w.jsx(wo,{value:r,onChange:s=>t("name",s.target.value),style:{textAlign:"left"}})]}),w.jsx(Pc,{value:i,onUpdate:s=>t("lineLength",s),configs:{label:"Length",min:0,max:1/0,precision:2}})]})},Vw=({element:n,onUpdate:t,onValid:e,attributeFormData:r,...i})=>n.prototype==="items"?w.jsx(Nw,{element:n,onUpdate:t,onValid:e,attributeFormData:r,...i}):n.prototype==="lines"?w.jsx(jw,{element:n,onUpdate:t,onValid:e,attributeFormData:r,...i}):n.prototype==="holes"?w.jsx(Fw,{element:n,onUpdate:t,onValid:e,attributeFormData:r,...i}):null,Wr=2,Dw=(n,t,e)=>{switch(n=typeof n.misc=="object"?n.set("misc",K(n.misc)):n,n.prototype){case"items":return K(n);case"lines":{let r=t.vertices.get(n.vertices.get(0)),i=t.vertices.get(n.vertices.get(1)),s=Ve(r.x,r.y,i.x,i.y),o=n.misc.get("_unitLength")||e.unit,a=Gr(s).from(e.unit).to(o);return K({vertexOne:r,vertexTwo:i,lineLength:K({length:s,_length:a,_unit:o})})}case"holes":{let r=t.lines.get(n.line),{x:i,y:s}=t.vertices.get(r.vertices.get(0)),{x:o,y:a}=t.vertices.get(r.vertices.get(1)),l=Ve(i,s,o,a),c=l*n.offset-n.properties.get("width").get("length")/2,h=n.misc.get("_unitA")||e.unit,f=Gr(c).from(e.unit).to(h),g=l-l*n.offset-n.properties.get("width").get("length")/2,p=n.misc.get("_unitB")||e.unit,m=Gr(g).from(e.unit).to(p);return K({offset:n.offset,offsetA:K({length:tr(c,Wr),_length:tr(f,Wr),_unit:h}),offsetB:K({length:tr(g,Wr),_length:tr(m,Wr),_unit:p})})}case"areas":return K({});default:return null}},Bw=(n,t)=>{const e=t.getElement(n.type),r={};for(const i in e.properties)r[i]=K({currentValue:n.properties.has(i)?n.properties.get(i):Xt(e.properties[i].defaultValue),configs:e.properties[i]});return K(r)},qw=({element:n,layer:t,catalog:e})=>{const{planner:r,setItemsAttributes:i,setProperties:s,setLinesAttributes:o,setHolesAttributes:a}=ne(),[l,c]=N.useState(Dw(n,t,e)),[h,f]=N.useState(Bw(n,e)),g=({propertiesFormData:v,attributesFormData:_})=>{if(v){let S=v.map(M=>M.get("currentValue"));s(S)}if(_)switch(n.prototype){case"items":{i(_);break}case"lines":{o(_);break}case"holes":{a(_);break}}},p=(v,_)=>{if(!l)return;let S;switch(n.prototype){case"items":{S=l.set(v,_);break}case"lines":{switch(v){case"lineLength":{let M=l.get("vertexOne"),T=l.get("vertexTwo"),[C,E]=fo([M,T]),z=va(C.x,C.y,E.x,E.y,_.get("length"),Wr);S=l.withMutations(R=>{R.set(M===C?"vertexTwo":"vertexOne",E.merge(z)),R.set("lineLength",_)});break}case"vertexOne":case"vertexTwo":{S=l.withMutations(M=>{M.set(v,M.get(v).merge(_));let T=ga(M.get("vertexOne"),M.get("vertexTwo"));M.mergeIn(["lineLength"],M.get("lineLength").merge({length:T,_length:Gr(T).from(e.unit).to(M.get("lineLength").get("_unit"))}))});break}default:{S=l.set(v,_);break}}break}case"holes":{switch(v){case"offsetA":{let M=t.lines.get(n.line),T=fo([t.vertices.get(M.vertices.get(0)),t.vertices.get(M.vertices.get(1))]),[{x:C,y:E},{x:z,y:R}]=T,k=kl(C,E,z,R),L=Ve(C,E,z,R),X=n.properties.get("width").get("length"),J=X/2,at=_.get("length");at=Math.max(at,0),at=Math.min(at,L-X);let tt=(at+J)*Math.cos(k)+C,bt=(at+J)*Math.sin(k)+E,xt=De(C,E,z,R,tt,bt),yt=tr(L-L*xt-J,Wr),ht=l.getIn(["offsetB","_unit"]),Y=K({length:yt,_length:Gr(yt).from(e.unit).to(ht),_unit:ht});S=l.set("offsetB",Y).set("offset",xt);let St=K({length:tr(at,Wr),_unit:_.get("_unit"),_length:tr(Gr(at).from(e.unit).to(_.get("_unit")),Wr)});S=l.set(v,St);break}case"offsetB":{let M=t.lines.get(n.line),T=fo([t.vertices.get(M.vertices.get(0)),t.vertices.get(M.vertices.get(1))]),[{x:C,y:E},{x:z,y:R}]=T,k=kl(C,E,z,R),L=Ve(C,E,z,R),X=n.properties.get("width").get("length"),J=X/2,at=_.get("length");at=Math.max(at,0),at=Math.min(at,L-X);let tt=z-(at+J)*Math.cos(k),bt=R-(at+J)*Math.sin(k),xt=De(C,E,z,R,tt,bt),yt=tr(L*xt-J,Wr),ht=l.getIn(["offsetA","_unit"]),Y=K({length:yt,_length:Gr(yt).from(e.unit).to(ht),_unit:ht});S=l.set("offsetA",Y).set("offset",xt);let St=K({length:tr(at,Wr),_unit:_.get("_unit"),_length:tr(Gr(at).from(e.unit).to(_.get("_unit")),Wr)});S=l.set(v,St);break}default:{S=l.set(v,_);break}}break}}S&&(c(S),g({attributesFormData:S,propertiesFormData:h}))},m=(v,_)=>{const S=h.setIn([v,"currentValue"],_);f(S),g({propertiesFormData:S,attributesFormData:l})};return w.jsxs("div",{children:[w.jsx(Vw,{element:n,onValid:()=>{},onUpdate:p,attributeFormData:l}),h.entrySeq().map(([v,_])=>{let S=_.get("currentValue"),M=_.get("configs"),{Editor:T}=e.getPropertyType(M.type);return w.jsx(T,{propertyName:v,value:S,configs:M,onUpdate:C=>m(v,C),state:r,sourceElement:n,internalState:{attributesFormData:l,propertiesFormData:h}},v)})]})},$w=()=>w.jsxs("div",{className:"h-full flex flex-col gap-4 justify-center items-center",children:[w.jsx("div",{className:"text-3xl text-white",children:w.jsx("img",{src:"/assets/icons/bullseye-arrow.svg",alt:"bullseye-arrow",width:34,height:34})}),w.jsx("p",{className:"mx-4 text-white text-sm text-center",children:"Select an element on the canvas to edit its properties."})]}),Hw=[fe,gi,mi,yi,vi,Qi,Lr,or,ar,Sr,Fr,Nr,jr,Vr,An,Al,Ol],Gw=({catalog:n})=>{const{planner:t}=ne(),{scene:e,mode:r}=t;return Hw.includes(r)?e.layers.valueSeq().flatMap(s=>Ee().concat(s.lines,s.holes,s.areas,s.items).filter(o=>o.selected).map(o=>({element:o,layer:s}))).toArray().length===0?w.jsx($w,{}):w.jsx("div",{children:e.layers.valueSeq().map(s=>Ee().concat(s.lines,s.holes,s.areas,s.items).filter(o=>o.selected).map(o=>w.jsx(Lg,{name:"Properties",opened:!0,children:w.jsx("div",{style:{padding:"5px 15px"},children:w.jsx(qw,{element:o,layer:s,catalog:n})})},o.id)).valueSeq())}):null},Ww={MODE_IDLE:fe,MODE_2D_ZOOM_IN:gi,MODE_2D_ZOOM_OUT:mi,MODE_2D_PAN:yi,MODE_3D_VIEW:vi,MODE_3D_FIRST_PERSON:Qi,MODE_WAITING_DRAWING_LINE:Lr,MODE_DRAWING_LINE:or,MODE_DRAWING_HOLE:ar,MODE_DRAWING_ITEM:Sr,MODE_DRAGGING_LINE:Fr,MODE_DRAGGING_VERTEX:Nr,MODE_DRAGGING_ITEM:jr,MODE_DRAGGING_HOLE:Vr,MODE_FITTING_IMAGE:Ol,MODE_UPLOADING_IMAGE:Al,MODE_ROTATING_ITEM:An},Uw={width:"100%"},Wa={width:"6em"},Ua={textAlign:"left"},Yw={marginLeft:"5px",border:"0px",background:"none",color:"#FFFFFF",fontSize:"14px",outline:"0px"},Xw={width:"100%",cursor:"pointer",maxHeight:"20em",marginLeft:"1px",marginTop:"1em"},jg={width:"2em"},Jw=({groupID:n})=>{const{planner:t,setGroupAttributes:e,groupTranslate:r,groupRotate:i,removeFromGroup:s}=ne(),{mode:o}=t;if(!n||!Ww[o])return null;const a=t.getIn(["scene","groups",n]),l=a.get("elements");return w.jsx(Lg,{name:`Group [${a.get("name")}]`,opened:!0,children:w.jsxs("div",{style:{padding:"5px 15px"},children:[w.jsx("table",{style:Uw,children:w.jsxs("tbody",{children:[w.jsxs("tr",{children:[w.jsx("td",{style:Wa,children:"Name"}),w.jsx("td",{children:w.jsx(wo,{value:a.get("name"),onChange:c=>e(n,K({name:c.target.value})),style:Ua})})]}),w.jsxs("tr",{children:[w.jsx("td",{style:Wa,children:"X"}),w.jsx("td",{children:w.jsx(Cn,{value:a.get("x"),onChange:c=>r(n,c.target.value,a.get("y")),style:Ua,precision:2})})]}),w.jsxs("tr",{children:[w.jsx("td",{style:Wa,children:"Y"}),w.jsx("td",{children:w.jsx(Cn,{value:a.get("y"),onChange:c=>r(n,a.get("x"),c.target.value),style:Ua,precision:2})})]}),w.jsxs("tr",{children:[w.jsx("td",{style:Wa,children:"Rotation"}),w.jsx("td",{children:w.jsx(Cn,{value:a.get("rotation"),onChange:c=>i(n,c.target.value),style:Ua,precision:2})})]})]})}),l.size?w.jsxs("div",{children:[w.jsx("p",{style:{textAlign:"center",borderBottom:"1px solid #555",paddingBottom:"1em"},children:"Group's Elements"}),w.jsxs("table",{style:Xw,children:[w.jsx("thead",{children:w.jsxs("tr",{children:[w.jsx("th",{style:jg}),w.jsx("th",{children:"Layer"}),w.jsx("th",{children:"Prototype"}),w.jsx("th",{children:"Name"})]})}),w.jsx("tbody",{children:l.entrySeq().map(([c,h])=>h.entrySeq().map(([f,g])=>g.valueSeq().map(p=>{let m=t.getIn(["scene","layers",c,f,p]);return w.jsxs("tr",{children:[w.jsx("td",{style:jg,title:"Un-chain Element from Group",children:w.jsx(N1,{onClick:()=>s(n,c,f,p),style:Yw})}),w.jsx("td",{style:{textAlign:"center"},children:c}),w.jsx("td",{style:{textAlign:"center",textTransform:"capitalize"},children:f}),w.jsx("td",{style:{textAlign:"center"},children:m.name})]},p)})))})]})]}):null]})})},Zw=({catalog:n})=>{const{planner:t}=ne(),e=t.getIn(["scene","selectedLayer"]),r=t.getIn(["scene","layers",e,"selected"]),i=t.getIn(["scene","groups"]).findEntry(o=>o.get("selected")),s=r.lines.size>1||r.items.size>1||r.holes.size>1||r.areas.size>1||r.lines.size+r.items.size+r.holes.size+r.areas.size>1;return w.jsxs("aside",{onKeyDown:o=>o.stopPropagation(),onKeyUp:o=>o.stopPropagation(),className:"floor_planner-sidebar w-[300px] bg-[#424242] h-[calc(100%_-_20px)] block overflow-y-auto overflow-x-hidden pb-5",children:[!s&&w.jsx(Gw,{catalog:n}),!!i&&w.jsx(Jw,{groupID:i?i[0]:null})]})},In=({active:n,tooltip:t,onClick:e,children:r,className:i})=>{const[s,o]=N.useState(!1),a=n||s?"text-[#1CA6FC]":"text-[#C2C2C2]";return w.jsxs("div",{className:mn("w-[30px] h-[30px] flex items-center justify-center text-[25px] relative cursor-pointer",i),onMouseOver:()=>o(!0),onMouseOut:()=>o(!1),children:[w.jsx("div",{className:a,onClick:e,children:r}),s&&w.jsxs("div",{className:"absolute w-[140px] text-white bg-black h-[30px] leading-[30px] text-center rounded-md opacity-80 left-full top-1/2 -mt-[15px] ml-[15px] z-[999] text-[12px]",children:[w.jsx("span",{className:"absolute top-1/2 right-full -mt-[8px] w-0 h-0 border-r-[8px] border-r-black border-t-[8px] border-t-transparent border-b-[8px] border-b-transparent"}),t]})]})},Vg=()=>new Promise(async n=>{const t=document.getElementsByTagName("svg");if(!t.length)return;let e=t[0];for(let g=1;g<t.length;g++)t[g].width.baseVal.value>e.width.baseVal.value&&(e=t[g]);const r=e.cloneNode(!0),i=r.querySelectorAll("image");await Promise.all(Array.from(i).map(async g=>{const p=g.getAttribute("href")||g.getAttribute("xlink:href");if(p)try{const v=await(await fetch(p)).blob(),_=new FileReader;await new Promise(S=>{_.onloadend=()=>{g.setAttribute("href",_.result),S()},_.readAsDataURL(v)})}catch(m){console.warn("⚠️ Could not inline image:",p,m)}}));const o=new XMLSerializer().serializeToString(r),a=e.width.baseVal.value,l=e.height.baseVal.value,c=document.createElement("canvas");c.width=a,c.height=l;const h=c.getContext("2d");h.fillStyle="white",h.fillRect(0,0,a,l);const f=new Image;f.src=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(o)))}`,f.onload=()=>{h.drawImage(f,0,0,a,l),n(c.toDataURL("image/png"))}});function Dg(n){return ge({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M7 19a2 2 0 0 1 -2 -2"},child:[]},{tag:"path",attr:{d:"M5 13v-2"},child:[]},{tag:"path",attr:{d:"M5 7a2 2 0 0 1 2 -2"},child:[]},{tag:"path",attr:{d:"M11 5h2"},child:[]},{tag:"path",attr:{d:"M17 5a2 2 0 0 1 2 2"},child:[]},{tag:"path",attr:{d:"M19 11v2"},child:[]},{tag:"path",attr:{d:"M19 17v4"},child:[]},{tag:"path",attr:{d:"M21 19h-4"},child:[]},{tag:"path",attr:{d:"M13 19h-2"},child:[]}]})(n)}const Bg=n=>{let t=document.createElement("a"),e="output"+Date.now()+".png";e=window.prompt("Insert output filename",e),e&&(t.setAttribute("download",e),t.href=n,t.style.display="none",document.body.appendChild(t),t.click(),document.body.removeChild(t))};function Kw({mode:n}){const t=r=>{r.preventDefault();const i=document.getElementsByTagName("canvas")[0];Bg(i.toDataURL())},e=async r=>{r.preventDefault(),Vg().then(Bg)};return[Qi,vi].includes(n)?w.jsx(In,{active:!1,tooltip:"Get Screenshot",onClick:t,children:w.jsx(Dg,{size:28})}):[fe,gi,mi,yi,Lr,Fr,Nr,jr,or,ar,Sr,Vr,An].includes(n)?w.jsx(In,{active:!1,tooltip:"Get Screenshot",onClick:e,children:w.jsx(Dg,{size:28})}):null}function Qw(n){return ge({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{width:"18",height:"18",x:"3",y:"3",rx:"2"},child:[]},{tag:"path",attr:{d:"M12 9v6"},child:[]},{tag:"path",attr:{d:"M16 15v6"},child:[]},{tag:"path",attr:{d:"M16 3v6"},child:[]},{tag:"path",attr:{d:"M3 15h18"},child:[]},{tag:"path",attr:{d:"M3 9h18"},child:[]},{tag:"path",attr:{d:"M8 15v6"},child:[]},{tag:"path",attr:{d:"M8 3v6"},child:[]}]})(n)}const tS=/^.*$/;function eS({onChange:n,...t}){const[e,r]=N.useState(""),i=N.useRef(null);N.useEffect(()=>{r(t.value)},[t.value]);const s=a=>{if(!a)return;const l=a.target.value;tS.test(l)&&n&&n(a)},o=a=>{(!a.key||a.key==="Enter")&&s({target:{value:e}})};return w.jsxs("div",{className:"color-field flex-1 flex pr-3 mt-1 cursor-pointer",children:[w.jsx("div",{className:"colorBox relative w-[22px] h-[22px]",style:{background:t.value},onClick:()=>{i.current&&i.current.click()},children:w.jsx("input",{ref:i,type:"color",onChange:s,value:t.value,className:"absolute invisible h-full w-full"})}),w.jsx("div",{className:"flex-1 pl-2",children:w.jsx("input",{className:"colorFieldInput min-w-[90px] cursor-pointer",type:"text",value:e,onKeyDown:o,onChange:a=>r(a.target.value),onBlur:o})})]})}function qg({value:n,onUpdate:t,configs:e,sourceElement:r,internalState:i}){const{planner:s}=ne(),o=a=>e.hook?e.hook(a,r,i,s).then(l=>t(l)):t(a);return w.jsxs("div",{className:"PropertyColor w-full mb-2",children:[w.jsx(Hr,{children:e.label}),w.jsx(eS,{value:n,onChange:a=>o(a.target.value)})]})}function $g({value:n,onUpdate:t,configs:e,sourceElement:r,internalState:i}){const{planner:s}=ne(),o=a=>e.hook?e.hook(a,r,i,s).then(l=>t(l)):t(a);return w.jsxs("div",{className:"PropertyEnum w-full mb-2",children:[w.jsx(Hr,{children:e.label}),w.jsx(kc,{value:n,onChange:a=>o(a.target.value),children:Ee(e.values).entrySeq().map(([a,l])=>w.jsx("option",{value:a,children:l},a))})]})}function Hg({value:n,onUpdate:t,configs:e,sourceElement:r,internalState:i}){const{planner:s}=ne();let o=a=>e.hook?e.hook(a,r,i,s).then(l=>t(l)):t(a);return w.jsxs("div",{className:"PropertyString w-full mb-2",children:[w.jsx(Hr,{children:e.label}),w.jsx(wo,{value:n,onChange:a=>o(a.target.value)})]})}function Gg({value:n,onUpdate:t,onValid:e,configs:r,sourceElement:i,internalState:s}){const{planner:o}=ne(),a=l=>{let c=parseFloat(l);return isNaN(c)&&(c=0),r.hook?r.hook(c,i,s,o).then(h=>t(h)):t(c)};return w.jsxs("div",{className:"PropertyNumber w-full mb-2",children:[w.jsx(Hr,{children:r.label}),w.jsx(Cn,{value:n,onChange:l=>a(l.target.value),onValid:e,min:r.min,max:r.max})]})}function Wg({value:n,onUpdate:t,onValid:e,configs:r,sourceElement:i,internalState:s}){const{planner:o}=ne();let a=n.get("length")||0,l=n.get("_length")||a,c=n.get("_unit")||un,{hook:h,label:f,...g}=r;const p=(m,v)=>{let _=tr(m),S=n.merge({length:v!==un?Gr(_).from(v).to(un):_,_length:m,_unit:v});return h?h(S,i,s,o).then(M=>t(M)):t(S)};return w.jsxs("div",{className:"PropertyLengthMeasure w-full mb-2",children:[w.jsx(Hr,{children:f}),w.jsxs("div",{className:"w-full flex",children:[w.jsx(Cn,{value:l,onChange:m=>p(m.target.value,c),onValid:e,style:{borderTopRightRadius:0,borderBottomRightRadius:0,borderRightWidth:0},...g}),w.jsx("div",{className:"w-1/4 [&>*:first-child]:text-center",children:w.jsx(kc,{style:{borderTopLeftRadius:"0px",borderBottomLeftRadius:"0px"},value:c,onChange:m=>p(l,m.target.value),children:dd.map(m=>w.jsx("option",{value:m,children:m},m))})})]})]})}function rS({type:n="button",size:t="normal",style:e,styleHover:r,children:i,...s}){const[o,a]=N.useState(!1),l="inline-block font-normal leading-[1.25] text-center whitespace-nowrap align-middle cursor-pointer select-none outline-none border border-solid w-full transition-colors duration-175 ease-linear rounded-[2px]",c=t==="small"?"text-[12px] px-2 py-[3px]":t==="large"?"px-5 py-2":"text-[14px] px-3 py-[5px]",h={backgroundColor:"#e6e6e6",borderColor:"#adadad"},f={backgroundColor:"#d4d4d4",borderColor:"#8c8c8c"};return w.jsx("button",{type:n,className:`${l} ${c}`,style:{...o?{...f,...r}:{...h,...e}},onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),...s,children:i})}const Ya={tableStyle:{width:"100%",borderSpacing:"2px 0",marginBottom:"2px"},firstTdStyle:{width:"6em",textTransform:"capitalize"}};function Ug({value:n,onUpdate:t,configs:e,sourceElement:r,internalState:i}){const{planner:s}=ne(),o=a=>e.hook?e.hook(a,r,i,s).then(l=>t(l)):t(a);return w.jsx("table",{className:"PropertyToggle",style:Ya.tableStyle,children:w.jsx("tbody",{children:w.jsxs("tr",{children:[w.jsx("td",{style:Ya.firstTdStyle,children:w.jsx(Hr,{children:e.label})}),w.jsx("td",{children:w.jsx(rS,{onClick:()=>o(!n),size:"small",children:e.actionName})})]})})})}function Yg({value:n,onUpdate:t,configs:e,sourceElement:r,internalState:i}){const{planner:s}=ne(),o=a=>e.hook?e.hook(a,r,i,s).then(l=>t(l)):t(a);return w.jsxs("div",{className:"PropertyCheckbox w-full flex items-center gap-2 mb-2",children:[w.jsx("input",{className:"m-0 mt-0.5",type:"checkbox",checked:n,onChange:()=>o(!n)}),w.jsx(Hr,{className:"mb-0",children:e.label})]})}function Xg(){return null}function Jg({value:n,configs:t}){return w.jsx("table",{className:"PropertyReadOnly",style:Ya.tableStyle,children:w.jsx("tbody",{children:w.jsxs("tr",{children:[w.jsx("td",{style:Ya.firstTdStyle,children:w.jsx(Hr,{children:t.label})}),w.jsx("td",{children:w.jsx("div",{children:n})})]})})})}/**
79
+ * @license
80
+ * Copyright 2010-2025 Three.js Authors
81
+ * SPDX-License-Identifier: MIT
82
+ */const Zg="179",Rc=0,nS=1,iS=2,Kg=1,Qg=100,tm=204,em=205,rm=3,nm=0,im=300,yn=1e3,Xa=1001,sm=1002,sS=1006,oS=1008,aS=1009,uS=1015,lS=1023,cS=0,om="",Ur="srgb",am="srgb-linear",um="linear",Lc="srgb",fs=7680,lm=519,cm=35044,Ja=2e3,hm=2001;class Za{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[t]===void 0&&(r[t]=[]),r[t].indexOf(e)===-1&&r[t].push(e)}hasEventListener(t,e){const r=this._listeners;return r===void 0?!1:r[t]!==void 0&&r[t].indexOf(e)!==-1}removeEventListener(t,e){const r=this._listeners;if(r===void 0)return;const i=r[t];if(i!==void 0){const s=i.indexOf(e);s!==-1&&i.splice(s,1)}}dispatchEvent(t){const e=this._listeners;if(e===void 0)return;const r=e[t.type];if(r!==void 0){t.target=this;const i=r.slice(0);for(let s=0,o=i.length;s<o;s++)i[s].call(this,t);t.target=null}}}const Be=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];function ds(){const n=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(Be[n&255]+Be[n>>8&255]+Be[n>>16&255]+Be[n>>24&255]+"-"+Be[t&255]+Be[t>>8&255]+"-"+Be[t>>16&15|64]+Be[t>>24&255]+"-"+Be[e&63|128]+Be[e>>8&255]+"-"+Be[e>>16&255]+Be[e>>24&255]+Be[r&255]+Be[r>>8&255]+Be[r>>16&255]+Be[r>>24&255]).toLowerCase()}function Lt(n,t,e){return Math.max(t,Math.min(e,n))}function hS(n,t){return(n%t+t)%t}function Fc(n,t,e){return(1-e)*n+e*t}function So(n,t){switch(t.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function er(n,t){switch(t.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}class Et{constructor(t=0,e=0){Et.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,r=this.y,i=t.elements;return this.x=i[0]*e+i[3]*r+i[6],this.y=i[1]*e+i[4]*r+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Lt(this.x,t.x,e.x),this.y=Lt(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=Lt(this.x,t,e),this.y=Lt(this.y,t,e),this}clampLength(t,e){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Lt(r,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const r=this.dot(t)/e;return Math.acos(Lt(r,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,r=this.y-t.y;return e*e+r*r}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const r=Math.cos(e),i=Math.sin(e),s=this.x-t.x,o=this.y-t.y;return this.x=s*r-o*i+t.x,this.y=s*i+o*r+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class ps{constructor(t=0,e=0,r=0,i=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=r,this._w=i}static slerpFlat(t,e,r,i,s,o,a){let l=r[i+0],c=r[i+1],h=r[i+2],f=r[i+3];const g=s[o+0],p=s[o+1],m=s[o+2],v=s[o+3];if(a===0){t[e+0]=l,t[e+1]=c,t[e+2]=h,t[e+3]=f;return}if(a===1){t[e+0]=g,t[e+1]=p,t[e+2]=m,t[e+3]=v;return}if(f!==v||l!==g||c!==p||h!==m){let _=1-a;const S=l*g+c*p+h*m+f*v,M=S>=0?1:-1,T=1-S*S;if(T>Number.EPSILON){const E=Math.sqrt(T),z=Math.atan2(E,S*M);_=Math.sin(_*z)/E,a=Math.sin(a*z)/E}const C=a*M;if(l=l*_+g*C,c=c*_+p*C,h=h*_+m*C,f=f*_+v*C,_===1-a){const E=1/Math.sqrt(l*l+c*c+h*h+f*f);l*=E,c*=E,h*=E,f*=E}}t[e]=l,t[e+1]=c,t[e+2]=h,t[e+3]=f}static multiplyQuaternionsFlat(t,e,r,i,s,o){const a=r[i],l=r[i+1],c=r[i+2],h=r[i+3],f=s[o],g=s[o+1],p=s[o+2],m=s[o+3];return t[e]=a*m+h*f+l*p-c*g,t[e+1]=l*m+h*g+c*f-a*p,t[e+2]=c*m+h*p+a*g-l*f,t[e+3]=h*m-a*f-l*g-c*p,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,r,i){return this._x=t,this._y=e,this._z=r,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const r=t._x,i=t._y,s=t._z,o=t._order,a=Math.cos,l=Math.sin,c=a(r/2),h=a(i/2),f=a(s/2),g=l(r/2),p=l(i/2),m=l(s/2);switch(o){case"XYZ":this._x=g*h*f+c*p*m,this._y=c*p*f-g*h*m,this._z=c*h*m+g*p*f,this._w=c*h*f-g*p*m;break;case"YXZ":this._x=g*h*f+c*p*m,this._y=c*p*f-g*h*m,this._z=c*h*m-g*p*f,this._w=c*h*f+g*p*m;break;case"ZXY":this._x=g*h*f-c*p*m,this._y=c*p*f+g*h*m,this._z=c*h*m+g*p*f,this._w=c*h*f-g*p*m;break;case"ZYX":this._x=g*h*f-c*p*m,this._y=c*p*f+g*h*m,this._z=c*h*m-g*p*f,this._w=c*h*f+g*p*m;break;case"YZX":this._x=g*h*f+c*p*m,this._y=c*p*f+g*h*m,this._z=c*h*m-g*p*f,this._w=c*h*f-g*p*m;break;case"XZY":this._x=g*h*f-c*p*m,this._y=c*p*f-g*h*m,this._z=c*h*m+g*p*f,this._w=c*h*f+g*p*m;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const r=e/2,i=Math.sin(r);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,r=e[0],i=e[4],s=e[8],o=e[1],a=e[5],l=e[9],c=e[2],h=e[6],f=e[10],g=r+a+f;if(g>0){const p=.5/Math.sqrt(g+1);this._w=.25/p,this._x=(h-l)*p,this._y=(s-c)*p,this._z=(o-i)*p}else if(r>a&&r>f){const p=2*Math.sqrt(1+r-a-f);this._w=(h-l)/p,this._x=.25*p,this._y=(i+o)/p,this._z=(s+c)/p}else if(a>f){const p=2*Math.sqrt(1+a-r-f);this._w=(s-c)/p,this._x=(i+o)/p,this._y=.25*p,this._z=(l+h)/p}else{const p=2*Math.sqrt(1+f-r-a);this._w=(o-i)/p,this._x=(s+c)/p,this._y=(l+h)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let r=t.dot(e)+1;return r<1e-8?(r=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=r):(this._x=0,this._y=-t.z,this._z=t.y,this._w=r)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=r),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Lt(this.dot(t),-1,1)))}rotateTowards(t,e){const r=this.angleTo(t);if(r===0)return this;const i=Math.min(1,e/r);return this.slerp(t,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const r=t._x,i=t._y,s=t._z,o=t._w,a=e._x,l=e._y,c=e._z,h=e._w;return this._x=r*h+o*a+i*c-s*l,this._y=i*h+o*l+s*a-r*c,this._z=s*h+o*c+r*l-i*a,this._w=o*h-r*a-i*l-s*c,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);const r=this._x,i=this._y,s=this._z,o=this._w;let a=o*t._w+r*t._x+i*t._y+s*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=o,this._x=r,this._y=i,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const p=1-e;return this._w=p*o+e*this._w,this._x=p*r+e*this._x,this._y=p*i+e*this._y,this._z=p*s+e*this._z,this.normalize(),this}const c=Math.sqrt(l),h=Math.atan2(c,a),f=Math.sin((1-e)*h)/c,g=Math.sin(e*h)/c;return this._w=o*f+this._w*g,this._x=r*f+this._x*g,this._y=i*f+this._y*g,this._z=s*f+this._z*g,this._onChangeCallback(),this}slerpQuaternions(t,e,r){return this.copy(t).slerp(e,r)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),r=Math.random(),i=Math.sqrt(1-r),s=Math.sqrt(r);return this.set(i*Math.sin(t),i*Math.cos(t),s*Math.sin(e),s*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class D{constructor(t=0,e=0,r=0){D.prototype.isVector3=!0,this.x=t,this.y=e,this.z=r}set(t,e,r){return r===void 0&&(r=this.z),this.x=t,this.y=e,this.z=r,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(fm.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(fm.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,r=this.y,i=this.z,s=t.elements;return this.x=s[0]*e+s[3]*r+s[6]*i,this.y=s[1]*e+s[4]*r+s[7]*i,this.z=s[2]*e+s[5]*r+s[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,r=this.y,i=this.z,s=t.elements,o=1/(s[3]*e+s[7]*r+s[11]*i+s[15]);return this.x=(s[0]*e+s[4]*r+s[8]*i+s[12])*o,this.y=(s[1]*e+s[5]*r+s[9]*i+s[13])*o,this.z=(s[2]*e+s[6]*r+s[10]*i+s[14])*o,this}applyQuaternion(t){const e=this.x,r=this.y,i=this.z,s=t.x,o=t.y,a=t.z,l=t.w,c=2*(o*i-a*r),h=2*(a*e-s*i),f=2*(s*r-o*e);return this.x=e+l*c+o*f-a*h,this.y=r+l*h+a*c-s*f,this.z=i+l*f+s*h-o*c,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,r=this.y,i=this.z,s=t.elements;return this.x=s[0]*e+s[4]*r+s[8]*i,this.y=s[1]*e+s[5]*r+s[9]*i,this.z=s[2]*e+s[6]*r+s[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Lt(this.x,t.x,e.x),this.y=Lt(this.y,t.y,e.y),this.z=Lt(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=Lt(this.x,t,e),this.y=Lt(this.y,t,e),this.z=Lt(this.z,t,e),this}clampLength(t,e){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Lt(r,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this.z=t.z+(e.z-t.z)*r,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const r=t.x,i=t.y,s=t.z,o=e.x,a=e.y,l=e.z;return this.x=i*l-s*a,this.y=s*o-r*l,this.z=r*a-i*o,this}projectOnVector(t){const e=t.lengthSq();if(e===0)return this.set(0,0,0);const r=t.dot(this)/e;return this.copy(t).multiplyScalar(r)}projectOnPlane(t){return Nc.copy(this).projectOnVector(t),this.sub(Nc)}reflect(t){return this.sub(Nc.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const r=this.dot(t)/e;return Math.acos(Lt(r,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,r=this.y-t.y,i=this.z-t.z;return e*e+r*r+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,r){const i=Math.sin(e)*t;return this.x=i*Math.sin(r),this.y=Math.cos(e)*t,this.z=i*Math.cos(r),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,r){return this.x=t*Math.sin(e),this.y=r,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),r=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=r,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=Math.random()*2-1,r=Math.sqrt(1-e*e);return this.x=r*Math.cos(t),this.y=e,this.z=r*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Nc=new D,fm=new ps;class Qn{constructor(t,e,r,i,s,o,a,l,c){Qn.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,r,i,s,o,a,l,c)}set(t,e,r,i,s,o,a,l,c){const h=this.elements;return h[0]=t,h[1]=i,h[2]=a,h[3]=e,h[4]=s,h[5]=l,h[6]=r,h[7]=o,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,r=t.elements;return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],this}extractBasis(t,e,r){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const r=t.elements,i=e.elements,s=this.elements,o=r[0],a=r[3],l=r[6],c=r[1],h=r[4],f=r[7],g=r[2],p=r[5],m=r[8],v=i[0],_=i[3],S=i[6],M=i[1],T=i[4],C=i[7],E=i[2],z=i[5],R=i[8];return s[0]=o*v+a*M+l*E,s[3]=o*_+a*T+l*z,s[6]=o*S+a*C+l*R,s[1]=c*v+h*M+f*E,s[4]=c*_+h*T+f*z,s[7]=c*S+h*C+f*R,s[2]=g*v+p*M+m*E,s[5]=g*_+p*T+m*z,s[8]=g*S+p*C+m*R,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],r=t[1],i=t[2],s=t[3],o=t[4],a=t[5],l=t[6],c=t[7],h=t[8];return e*o*h-e*a*c-r*s*h+r*a*l+i*s*c-i*o*l}invert(){const t=this.elements,e=t[0],r=t[1],i=t[2],s=t[3],o=t[4],a=t[5],l=t[6],c=t[7],h=t[8],f=h*o-a*c,g=a*l-h*s,p=c*s-o*l,m=e*f+r*g+i*p;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const v=1/m;return t[0]=f*v,t[1]=(i*c-h*r)*v,t[2]=(a*r-i*o)*v,t[3]=g*v,t[4]=(h*e-i*l)*v,t[5]=(i*s-a*e)*v,t[6]=p*v,t[7]=(r*l-c*e)*v,t[8]=(o*e-r*s)*v,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,r,i,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(r*l,r*c,-r*(l*o+c*a)+o+t,-i*c,i*l,-i*(-c*o+l*a)+a+e,0,0,1),this}scale(t,e){return this.premultiply(jc.makeScale(t,e)),this}rotate(t){return this.premultiply(jc.makeRotation(-t)),this}translate(t,e){return this.premultiply(jc.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),r=Math.sin(t);return this.set(e,-r,0,r,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,r=t.elements;for(let i=0;i<9;i++)if(e[i]!==r[i])return!1;return!0}fromArray(t,e=0){for(let r=0;r<9;r++)this.elements[r]=t[r+e];return this}toArray(t=[],e=0){const r=this.elements;return t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t}clone(){return new this.constructor().fromArray(this.elements)}}const jc=new Qn;function fS(n){for(let t=n.length-1;t>=0;--t)if(n[t]>=65535)return!0;return!1}function Vc(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}const dm={};function pm(n){n in dm||(dm[n]=!0,console.warn(n))}const gm=new Qn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),mm=new Qn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function dS(){const n={enabled:!0,workingColorSpace:am,spaces:{},convert:function(i,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===Lc&&(i.r=kn(i.r),i.g=kn(i.g),i.b=kn(i.b)),this.spaces[s].primaries!==this.spaces[o].primaries&&(i.applyMatrix3(this.spaces[s].toXYZ),i.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===Lc&&(i.r=gs(i.r),i.g=gs(i.g),i.b=gs(i.b))),i},workingToColorSpace:function(i,s){return this.convert(i,this.workingColorSpace,s)},colorSpaceToWorking:function(i,s){return this.convert(i,s,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===om?um:this.spaces[i].transfer},getLuminanceCoefficients:function(i,s=this.workingColorSpace){return i.fromArray(this.spaces[s].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,s,o){return i.copy(this.spaces[s].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,s){return pm("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),n.workingToColorSpace(i,s)},toWorkingColorSpace:function(i,s){return pm("THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),n.colorSpaceToWorking(i,s)}},t=[.64,.33,.3,.6,.15,.06],e=[.2126,.7152,.0722],r=[.3127,.329];return n.define({[am]:{primaries:t,whitePoint:r,transfer:um,toXYZ:gm,fromXYZ:mm,luminanceCoefficients:e,workingColorSpaceConfig:{unpackColorSpace:Ur},outputColorSpaceConfig:{drawingBufferColorSpace:Ur}},[Ur]:{primaries:t,whitePoint:r,transfer:Lc,toXYZ:gm,fromXYZ:mm,luminanceCoefficients:e,outputColorSpaceConfig:{drawingBufferColorSpace:Ur}}}),n}const Yr=dS();function kn(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function gs(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let ms;class pS{static getDataURL(t,e="image/png"){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let r;if(t instanceof HTMLCanvasElement)r=t;else{ms===void 0&&(ms=Vc("canvas")),ms.width=t.width,ms.height=t.height;const i=ms.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),r=ms}return r.toDataURL(e)}static sRGBToLinear(t){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){const e=Vc("canvas");e.width=t.width,e.height=t.height;const r=e.getContext("2d");r.drawImage(t,0,0,t.width,t.height);const i=r.getImageData(0,0,t.width,t.height),s=i.data;for(let o=0;o<s.length;o++)s[o]=kn(s[o]/255)*255;return r.putImageData(i,0,0),e}else if(t.data){const e=t.data.slice(0);for(let r=0;r<e.length;r++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[r]=Math.floor(kn(e[r]/255)*255):e[r]=kn(e[r]);return{data:e,width:t.width,height:t.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}}let gS=0;class mS{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:gS++}),this.uuid=ds(),this.data=t,this.dataReady=!0,this.version=0}getSize(t){const e=this.data;return e instanceof HTMLVideoElement?t.set(e.videoWidth,e.videoHeight,0):e instanceof VideoFrame?t.set(e.displayHeight,e.displayWidth,0):e!==null?t.set(e.width,e.height,e.depth||0):t.set(0,0,0),t}set needsUpdate(t){t===!0&&this.version++}toJSON(t){const e=t===void 0||typeof t=="string";if(!e&&t.images[this.uuid]!==void 0)return t.images[this.uuid];const r={uuid:this.uuid,url:""},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let o=0,a=i.length;o<a;o++)i[o].isDataTexture?s.push(Dc(i[o].image)):s.push(Dc(i[o]))}else s=Dc(i);r.url=s}return e||(t.images[this.uuid]=r),r}}function Dc(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?pS.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let yS=0;const Bc=new D;class ti extends Za{constructor(t=ti.DEFAULT_IMAGE,e=ti.DEFAULT_MAPPING,r=Xa,i=Xa,s=sS,o=oS,a=lS,l=aS,c=ti.DEFAULT_ANISOTROPY,h=om){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:yS++}),this.uuid=ds(),this.name="",this.source=new mS(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=r,this.wrapT=i,this.magFilter=s,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new Et(0,0),this.repeat=new Et(1,1),this.center=new Et(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Qn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(t&&t.depth&&t.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(Bc).x}get height(){return this.source.getSize(Bc).y}get depth(){return this.source.getSize(Bc).z}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isArrayTexture=t.isArrayTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}setValues(t){for(const e in t){const r=t[e];if(r===void 0){console.warn(`THREE.Texture.setValues(): parameter '${e}' has value of undefined.`);continue}const i=this[e];if(i===void 0){console.warn(`THREE.Texture.setValues(): property '${e}' does not exist.`);continue}i&&r&&i.isVector2&&r.isVector2||i&&r&&i.isVector3&&r.isVector3||i&&r&&i.isMatrix3&&r.isMatrix3?i.copy(r):this[e]=r}}toJSON(t){const e=t===void 0||typeof t=="string";if(!e&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];const r={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(r.userData=this.userData),e||(t.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==im)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case yn:t.x=t.x-Math.floor(t.x);break;case Xa:t.x=t.x<0?0:1;break;case sm:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case yn:t.y=t.y-Math.floor(t.y);break;case Xa:t.y=t.y<0?0:1;break;case sm:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){t===!0&&this.pmremVersion++}}ti.DEFAULT_IMAGE=null,ti.DEFAULT_MAPPING=im,ti.DEFAULT_ANISOTROPY=1;class Eo{constructor(t=0,e=0,r=0,i=1){Eo.prototype.isVector4=!0,this.x=t,this.y=e,this.z=r,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,r,i){return this.x=t,this.y=e,this.z=r,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,r=this.y,i=this.z,s=this.w,o=t.elements;return this.x=o[0]*e+o[4]*r+o[8]*i+o[12]*s,this.y=o[1]*e+o[5]*r+o[9]*i+o[13]*s,this.z=o[2]*e+o[6]*r+o[10]*i+o[14]*s,this.w=o[3]*e+o[7]*r+o[11]*i+o[15]*s,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,r,i,s;const l=t.elements,c=l[0],h=l[4],f=l[8],g=l[1],p=l[5],m=l[9],v=l[2],_=l[6],S=l[10];if(Math.abs(h-g)<.01&&Math.abs(f-v)<.01&&Math.abs(m-_)<.01){if(Math.abs(h+g)<.1&&Math.abs(f+v)<.1&&Math.abs(m+_)<.1&&Math.abs(c+p+S-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const T=(c+1)/2,C=(p+1)/2,E=(S+1)/2,z=(h+g)/4,R=(f+v)/4,k=(m+_)/4;return T>C&&T>E?T<.01?(r=0,i=.707106781,s=.707106781):(r=Math.sqrt(T),i=z/r,s=R/r):C>E?C<.01?(r=.707106781,i=0,s=.707106781):(i=Math.sqrt(C),r=z/i,s=k/i):E<.01?(r=.707106781,i=.707106781,s=0):(s=Math.sqrt(E),r=R/s,i=k/s),this.set(r,i,s,e),this}let M=Math.sqrt((_-m)*(_-m)+(f-v)*(f-v)+(g-h)*(g-h));return Math.abs(M)<.001&&(M=1),this.x=(_-m)/M,this.y=(f-v)/M,this.z=(g-h)/M,this.w=Math.acos((c+p+S-1)/2),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Lt(this.x,t.x,e.x),this.y=Lt(this.y,t.y,e.y),this.z=Lt(this.z,t.z,e.z),this.w=Lt(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=Lt(this.x,t,e),this.y=Lt(this.y,t,e),this.z=Lt(this.z,t,e),this.w=Lt(this.w,t,e),this}clampLength(t,e){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Lt(r,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this.z=t.z+(e.z-t.z)*r,this.w=t.w+(e.w-t.w)*r,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class ys{constructor(t=new D(1/0,1/0,1/0),e=new D(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,r=t.length;e<r;e+=3)this.expandByPoint(Xr.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,r=t.count;e<r;e++)this.expandByPoint(Xr.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,r=t.length;e<r;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const r=Xr.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(r),this.max.copy(t).add(r),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);const r=t.geometry;if(r!==void 0){const s=r.getAttribute("position");if(e===!0&&s!==void 0&&t.isInstancedMesh!==!0)for(let o=0,a=s.count;o<a;o++)t.isMesh===!0?t.getVertexPosition(o,Xr):Xr.fromBufferAttribute(s,o),Xr.applyMatrix4(t.matrixWorld),this.expandByPoint(Xr);else t.boundingBox!==void 0?(t.boundingBox===null&&t.computeBoundingBox(),Ka.copy(t.boundingBox)):(r.boundingBox===null&&r.computeBoundingBox(),Ka.copy(r.boundingBox)),Ka.applyMatrix4(t.matrixWorld),this.union(Ka)}const i=t.children;for(let s=0,o=i.length;s<o;s++)this.expandByObject(i[s],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,Xr),Xr.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,r;return t.normal.x>0?(e=t.normal.x*this.min.x,r=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,r=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,r+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,r+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,r+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,r+=t.normal.z*this.min.z),e<=-t.constant&&r>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Mo),Qa.subVectors(this.max,Mo),vs.subVectors(t.a,Mo),xs.subVectors(t.b,Mo),_s.subVectors(t.c,Mo),ei.subVectors(xs,vs),ri.subVectors(_s,xs),Si.subVectors(vs,_s);let e=[0,-ei.z,ei.y,0,-ri.z,ri.y,0,-Si.z,Si.y,ei.z,0,-ei.x,ri.z,0,-ri.x,Si.z,0,-Si.x,-ei.y,ei.x,0,-ri.y,ri.x,0,-Si.y,Si.x,0];return!qc(e,vs,xs,_s,Qa)||(e=[1,0,0,0,1,0,0,0,1],!qc(e,vs,xs,_s,Qa))?!1:(tu.crossVectors(ei,ri),e=[tu.x,tu.y,tu.z],qc(e,vs,xs,_s,Qa))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Xr).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(Xr).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(Pn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Pn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Pn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Pn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Pn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Pn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Pn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Pn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Pn),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(t){return this.min.fromArray(t.min),this.max.fromArray(t.max),this}}const Pn=[new D,new D,new D,new D,new D,new D,new D,new D],Xr=new D,Ka=new ys,vs=new D,xs=new D,_s=new D,ei=new D,ri=new D,Si=new D,Mo=new D,Qa=new D,tu=new D,Ei=new D;function qc(n,t,e,r,i){for(let s=0,o=n.length-3;s<=o;s+=3){Ei.fromArray(n,s);const a=i.x*Math.abs(Ei.x)+i.y*Math.abs(Ei.y)+i.z*Math.abs(Ei.z),l=t.dot(Ei),c=e.dot(Ei),h=r.dot(Ei);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>a)return!1}return!0}const vS=new ys,Ao=new D,$c=new D;class ym{constructor(t=new D,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const r=this.center;e!==void 0?r.copy(e):vS.setFromPoints(t).getCenter(r);let i=0;for(let s=0,o=t.length;s<o;s++)i=Math.max(i,r.distanceToSquared(t[s]));return this.radius=Math.sqrt(i),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const r=this.center.distanceToSquared(t);return e.copy(t),r>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;Ao.subVectors(t,this.center);const e=Ao.lengthSq();if(e>this.radius*this.radius){const r=Math.sqrt(e),i=(r-this.radius)*.5;this.center.addScaledVector(Ao,i/r),this.radius+=i}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):($c.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Ao.copy(t.center).add($c)),this.expandByPoint(Ao.copy(t.center).sub($c))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(t){return this.radius=t.radius,this.center.fromArray(t.center),this}}const Rn=new D,Hc=new D,eu=new D,ni=new D,Gc=new D,ru=new D,Wc=new D;class xS{constructor(t=new D,e=new D(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,Rn)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const r=e.dot(this.direction);return r<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=Rn.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Rn.copy(this.origin).addScaledVector(this.direction,e),Rn.distanceToSquared(t))}distanceSqToSegment(t,e,r,i){Hc.copy(t).add(e).multiplyScalar(.5),eu.copy(e).sub(t).normalize(),ni.copy(this.origin).sub(Hc);const s=t.distanceTo(e)*.5,o=-this.direction.dot(eu),a=ni.dot(this.direction),l=-ni.dot(eu),c=ni.lengthSq(),h=Math.abs(1-o*o);let f,g,p,m;if(h>0)if(f=o*l-a,g=o*a-l,m=s*h,f>=0)if(g>=-m)if(g<=m){const v=1/h;f*=v,g*=v,p=f*(f+o*g+2*a)+g*(o*f+g+2*l)+c}else g=s,f=Math.max(0,-(o*g+a)),p=-f*f+g*(g+2*l)+c;else g=-s,f=Math.max(0,-(o*g+a)),p=-f*f+g*(g+2*l)+c;else g<=-m?(f=Math.max(0,-(-o*s+a)),g=f>0?-s:Math.min(Math.max(-s,-l),s),p=-f*f+g*(g+2*l)+c):g<=m?(f=0,g=Math.min(Math.max(-s,-l),s),p=g*(g+2*l)+c):(f=Math.max(0,-(o*s+a)),g=f>0?s:Math.min(Math.max(-s,-l),s),p=-f*f+g*(g+2*l)+c);else g=o>0?-s:s,f=Math.max(0,-(o*g+a)),p=-f*f+g*(g+2*l)+c;return r&&r.copy(this.origin).addScaledVector(this.direction,f),i&&i.copy(Hc).addScaledVector(eu,g),p}intersectSphere(t,e){Rn.subVectors(t.center,this.origin);const r=Rn.dot(this.direction),i=Rn.dot(Rn)-r*r,s=t.radius*t.radius;if(i>s)return null;const o=Math.sqrt(s-i),a=r-o,l=r+o;return l<0?null:a<0?this.at(l,e):this.at(a,e)}intersectsSphere(t){return t.radius<0?!1:this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(e===0)return t.distanceToPoint(this.origin)===0?0:null;const r=-(this.origin.dot(t.normal)+t.constant)/e;return r>=0?r:null}intersectPlane(t,e){const r=this.distanceToPlane(t);return r===null?null:this.at(r,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return e===0||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let r,i,s,o,a,l;const c=1/this.direction.x,h=1/this.direction.y,f=1/this.direction.z,g=this.origin;return c>=0?(r=(t.min.x-g.x)*c,i=(t.max.x-g.x)*c):(r=(t.max.x-g.x)*c,i=(t.min.x-g.x)*c),h>=0?(s=(t.min.y-g.y)*h,o=(t.max.y-g.y)*h):(s=(t.max.y-g.y)*h,o=(t.min.y-g.y)*h),r>o||s>i||((s>r||isNaN(r))&&(r=s),(o<i||isNaN(i))&&(i=o),f>=0?(a=(t.min.z-g.z)*f,l=(t.max.z-g.z)*f):(a=(t.max.z-g.z)*f,l=(t.min.z-g.z)*f),r>l||a>i)||((a>r||r!==r)&&(r=a),(l<i||i!==i)&&(i=l),i<0)?null:this.at(r>=0?r:i,e)}intersectsBox(t){return this.intersectBox(t,Rn)!==null}intersectTriangle(t,e,r,i,s){Gc.subVectors(e,t),ru.subVectors(r,t),Wc.crossVectors(Gc,ru);let o=this.direction.dot(Wc),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;ni.subVectors(this.origin,t);const l=a*this.direction.dot(ru.crossVectors(ni,ru));if(l<0)return null;const c=a*this.direction.dot(Gc.cross(ni));if(c<0||l+c>o)return null;const h=-a*ni.dot(Wc);return h<0?null:this.at(h/o,s)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Ue{constructor(t,e,r,i,s,o,a,l,c,h,f,g,p,m,v,_){Ue.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,r,i,s,o,a,l,c,h,f,g,p,m,v,_)}set(t,e,r,i,s,o,a,l,c,h,f,g,p,m,v,_){const S=this.elements;return S[0]=t,S[4]=e,S[8]=r,S[12]=i,S[1]=s,S[5]=o,S[9]=a,S[13]=l,S[2]=c,S[6]=h,S[10]=f,S[14]=g,S[3]=p,S[7]=m,S[11]=v,S[15]=_,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Ue().fromArray(this.elements)}copy(t){const e=this.elements,r=t.elements;return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],this}copyPosition(t){const e=this.elements,r=t.elements;return e[12]=r[12],e[13]=r[13],e[14]=r[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,r){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this}makeBasis(t,e,r){return this.set(t.x,e.x,r.x,0,t.y,e.y,r.y,0,t.z,e.z,r.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,r=t.elements,i=1/bs.setFromMatrixColumn(t,0).length(),s=1/bs.setFromMatrixColumn(t,1).length(),o=1/bs.setFromMatrixColumn(t,2).length();return e[0]=r[0]*i,e[1]=r[1]*i,e[2]=r[2]*i,e[3]=0,e[4]=r[4]*s,e[5]=r[5]*s,e[6]=r[6]*s,e[7]=0,e[8]=r[8]*o,e[9]=r[9]*o,e[10]=r[10]*o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,r=t.x,i=t.y,s=t.z,o=Math.cos(r),a=Math.sin(r),l=Math.cos(i),c=Math.sin(i),h=Math.cos(s),f=Math.sin(s);if(t.order==="XYZ"){const g=o*h,p=o*f,m=a*h,v=a*f;e[0]=l*h,e[4]=-l*f,e[8]=c,e[1]=p+m*c,e[5]=g-v*c,e[9]=-a*l,e[2]=v-g*c,e[6]=m+p*c,e[10]=o*l}else if(t.order==="YXZ"){const g=l*h,p=l*f,m=c*h,v=c*f;e[0]=g+v*a,e[4]=m*a-p,e[8]=o*c,e[1]=o*f,e[5]=o*h,e[9]=-a,e[2]=p*a-m,e[6]=v+g*a,e[10]=o*l}else if(t.order==="ZXY"){const g=l*h,p=l*f,m=c*h,v=c*f;e[0]=g-v*a,e[4]=-o*f,e[8]=m+p*a,e[1]=p+m*a,e[5]=o*h,e[9]=v-g*a,e[2]=-o*c,e[6]=a,e[10]=o*l}else if(t.order==="ZYX"){const g=o*h,p=o*f,m=a*h,v=a*f;e[0]=l*h,e[4]=m*c-p,e[8]=g*c+v,e[1]=l*f,e[5]=v*c+g,e[9]=p*c-m,e[2]=-c,e[6]=a*l,e[10]=o*l}else if(t.order==="YZX"){const g=o*l,p=o*c,m=a*l,v=a*c;e[0]=l*h,e[4]=v-g*f,e[8]=m*f+p,e[1]=f,e[5]=o*h,e[9]=-a*h,e[2]=-c*h,e[6]=p*f+m,e[10]=g-v*f}else if(t.order==="XZY"){const g=o*l,p=o*c,m=a*l,v=a*c;e[0]=l*h,e[4]=-f,e[8]=c*h,e[1]=g*f+v,e[5]=o*h,e[9]=p*f-m,e[2]=m*f-p,e[6]=a*h,e[10]=v*f+g}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(_S,t,bS)}lookAt(t,e,r){const i=this.elements;return hr.subVectors(t,e),hr.lengthSq()===0&&(hr.z=1),hr.normalize(),ii.crossVectors(r,hr),ii.lengthSq()===0&&(Math.abs(r.z)===1?hr.x+=1e-4:hr.z+=1e-4,hr.normalize(),ii.crossVectors(r,hr)),ii.normalize(),nu.crossVectors(hr,ii),i[0]=ii.x,i[4]=nu.x,i[8]=hr.x,i[1]=ii.y,i[5]=nu.y,i[9]=hr.y,i[2]=ii.z,i[6]=nu.z,i[10]=hr.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const r=t.elements,i=e.elements,s=this.elements,o=r[0],a=r[4],l=r[8],c=r[12],h=r[1],f=r[5],g=r[9],p=r[13],m=r[2],v=r[6],_=r[10],S=r[14],M=r[3],T=r[7],C=r[11],E=r[15],z=i[0],R=i[4],k=i[8],L=i[12],X=i[1],J=i[5],at=i[9],tt=i[13],bt=i[2],xt=i[6],yt=i[10],ht=i[14],Y=i[3],St=i[7],j=i[11],W=i[15];return s[0]=o*z+a*X+l*bt+c*Y,s[4]=o*R+a*J+l*xt+c*St,s[8]=o*k+a*at+l*yt+c*j,s[12]=o*L+a*tt+l*ht+c*W,s[1]=h*z+f*X+g*bt+p*Y,s[5]=h*R+f*J+g*xt+p*St,s[9]=h*k+f*at+g*yt+p*j,s[13]=h*L+f*tt+g*ht+p*W,s[2]=m*z+v*X+_*bt+S*Y,s[6]=m*R+v*J+_*xt+S*St,s[10]=m*k+v*at+_*yt+S*j,s[14]=m*L+v*tt+_*ht+S*W,s[3]=M*z+T*X+C*bt+E*Y,s[7]=M*R+T*J+C*xt+E*St,s[11]=M*k+T*at+C*yt+E*j,s[15]=M*L+T*tt+C*ht+E*W,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],r=t[4],i=t[8],s=t[12],o=t[1],a=t[5],l=t[9],c=t[13],h=t[2],f=t[6],g=t[10],p=t[14],m=t[3],v=t[7],_=t[11],S=t[15];return m*(+s*l*f-i*c*f-s*a*g+r*c*g+i*a*p-r*l*p)+v*(+e*l*p-e*c*g+s*o*g-i*o*p+i*c*h-s*l*h)+_*(+e*c*f-e*a*p-s*o*f+r*o*p+s*a*h-r*c*h)+S*(-i*a*h-e*l*f+e*a*g+i*o*f-r*o*g+r*l*h)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,r){const i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=r),this}invert(){const t=this.elements,e=t[0],r=t[1],i=t[2],s=t[3],o=t[4],a=t[5],l=t[6],c=t[7],h=t[8],f=t[9],g=t[10],p=t[11],m=t[12],v=t[13],_=t[14],S=t[15],M=f*_*c-v*g*c+v*l*p-a*_*p-f*l*S+a*g*S,T=m*g*c-h*_*c-m*l*p+o*_*p+h*l*S-o*g*S,C=h*v*c-m*f*c+m*a*p-o*v*p-h*a*S+o*f*S,E=m*f*l-h*v*l-m*a*g+o*v*g+h*a*_-o*f*_,z=e*M+r*T+i*C+s*E;if(z===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const R=1/z;return t[0]=M*R,t[1]=(v*g*s-f*_*s-v*i*p+r*_*p+f*i*S-r*g*S)*R,t[2]=(a*_*s-v*l*s+v*i*c-r*_*c-a*i*S+r*l*S)*R,t[3]=(f*l*s-a*g*s-f*i*c+r*g*c+a*i*p-r*l*p)*R,t[4]=T*R,t[5]=(h*_*s-m*g*s+m*i*p-e*_*p-h*i*S+e*g*S)*R,t[6]=(m*l*s-o*_*s-m*i*c+e*_*c+o*i*S-e*l*S)*R,t[7]=(o*g*s-h*l*s+h*i*c-e*g*c-o*i*p+e*l*p)*R,t[8]=C*R,t[9]=(m*f*s-h*v*s-m*r*p+e*v*p+h*r*S-e*f*S)*R,t[10]=(o*v*s-m*a*s+m*r*c-e*v*c-o*r*S+e*a*S)*R,t[11]=(h*a*s-o*f*s-h*r*c+e*f*c+o*r*p-e*a*p)*R,t[12]=E*R,t[13]=(h*v*i-m*f*i+m*r*g-e*v*g-h*r*_+e*f*_)*R,t[14]=(m*a*i-o*v*i-m*r*l+e*v*l+o*r*_-e*a*_)*R,t[15]=(o*f*i-h*a*i+h*r*l-e*f*l-o*r*g+e*a*g)*R,this}scale(t){const e=this.elements,r=t.x,i=t.y,s=t.z;return e[0]*=r,e[4]*=i,e[8]*=s,e[1]*=r,e[5]*=i,e[9]*=s,e[2]*=r,e[6]*=i,e[10]*=s,e[3]*=r,e[7]*=i,e[11]*=s,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],r=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,r,i))}makeTranslation(t,e,r){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,r,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),r=Math.sin(t);return this.set(1,0,0,0,0,e,-r,0,0,r,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),r=Math.sin(t);return this.set(e,0,r,0,0,1,0,0,-r,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),r=Math.sin(t);return this.set(e,-r,0,0,r,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const r=Math.cos(e),i=Math.sin(e),s=1-r,o=t.x,a=t.y,l=t.z,c=s*o,h=s*a;return this.set(c*o+r,c*a-i*l,c*l+i*a,0,c*a+i*l,h*a+r,h*l-i*o,0,c*l-i*a,h*l+i*o,s*l*l+r,0,0,0,0,1),this}makeScale(t,e,r){return this.set(t,0,0,0,0,e,0,0,0,0,r,0,0,0,0,1),this}makeShear(t,e,r,i,s,o){return this.set(1,r,s,0,t,1,o,0,e,i,1,0,0,0,0,1),this}compose(t,e,r){const i=this.elements,s=e._x,o=e._y,a=e._z,l=e._w,c=s+s,h=o+o,f=a+a,g=s*c,p=s*h,m=s*f,v=o*h,_=o*f,S=a*f,M=l*c,T=l*h,C=l*f,E=r.x,z=r.y,R=r.z;return i[0]=(1-(v+S))*E,i[1]=(p+C)*E,i[2]=(m-T)*E,i[3]=0,i[4]=(p-C)*z,i[5]=(1-(g+S))*z,i[6]=(_+M)*z,i[7]=0,i[8]=(m+T)*R,i[9]=(_-M)*R,i[10]=(1-(g+v))*R,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,r){const i=this.elements;let s=bs.set(i[0],i[1],i[2]).length();const o=bs.set(i[4],i[5],i[6]).length(),a=bs.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),t.x=i[12],t.y=i[13],t.z=i[14],Jr.copy(this);const c=1/s,h=1/o,f=1/a;return Jr.elements[0]*=c,Jr.elements[1]*=c,Jr.elements[2]*=c,Jr.elements[4]*=h,Jr.elements[5]*=h,Jr.elements[6]*=h,Jr.elements[8]*=f,Jr.elements[9]*=f,Jr.elements[10]*=f,e.setFromRotationMatrix(Jr),r.x=s,r.y=o,r.z=a,this}makePerspective(t,e,r,i,s,o,a=Ja,l=!1){const c=this.elements,h=2*s/(e-t),f=2*s/(r-i),g=(e+t)/(e-t),p=(r+i)/(r-i);let m,v;if(l)m=s/(o-s),v=o*s/(o-s);else if(a===Ja)m=-(o+s)/(o-s),v=-2*o*s/(o-s);else if(a===hm)m=-o/(o-s),v=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return c[0]=h,c[4]=0,c[8]=g,c[12]=0,c[1]=0,c[5]=f,c[9]=p,c[13]=0,c[2]=0,c[6]=0,c[10]=m,c[14]=v,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(t,e,r,i,s,o,a=Ja,l=!1){const c=this.elements,h=2/(e-t),f=2/(r-i),g=-(e+t)/(e-t),p=-(r+i)/(r-i);let m,v;if(l)m=1/(o-s),v=o/(o-s);else if(a===Ja)m=-2/(o-s),v=-(o+s)/(o-s);else if(a===hm)m=-1/(o-s),v=-s/(o-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return c[0]=h,c[4]=0,c[8]=0,c[12]=g,c[1]=0,c[5]=f,c[9]=0,c[13]=p,c[2]=0,c[6]=0,c[10]=m,c[14]=v,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(t){const e=this.elements,r=t.elements;for(let i=0;i<16;i++)if(e[i]!==r[i])return!1;return!0}fromArray(t,e=0){for(let r=0;r<16;r++)this.elements[r]=t[r+e];return this}toArray(t=[],e=0){const r=this.elements;return t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t[e+9]=r[9],t[e+10]=r[10],t[e+11]=r[11],t[e+12]=r[12],t[e+13]=r[13],t[e+14]=r[14],t[e+15]=r[15],t}}const bs=new D,Jr=new Ue,_S=new D(0,0,0),bS=new D(1,1,1),ii=new D,nu=new D,hr=new D,vm=new Ue,xm=new ps;class ws{constructor(t=0,e=0,r=0,i=ws.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=r,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,r,i=this._order){return this._x=t,this._y=e,this._z=r,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,r=!0){const i=t.elements,s=i[0],o=i[4],a=i[8],l=i[1],c=i[5],h=i[9],f=i[2],g=i[6],p=i[10];switch(e){case"XYZ":this._y=Math.asin(Lt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,p),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(g,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Lt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(a,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(Lt(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(-f,p),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Lt(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(g,p),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(Lt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(a,p));break;case"XZY":this._z=Math.asin(-Lt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(g,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-h,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,r===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,r){return vm.makeRotationFromQuaternion(t),this.setFromRotationMatrix(vm,e,r)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return xm.setFromEuler(this),this.setFromQuaternion(xm,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}ws.DEFAULT_ORDER="XYZ";class wS{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return(this.mask&t.mask)!==0}isEnabled(t){return(this.mask&(1<<t|0))!==0}}let SS=0;const _m=new D,Ss=new ps,Ln=new Ue,iu=new D,Oo=new D,ES=new D,MS=new ps,bm=new D(1,0,0),wm=new D(0,1,0),Sm=new D(0,0,1),Em={type:"added"},AS={type:"removed"},Es={type:"childadded",child:null},Uc={type:"childremoved",child:null};class vn extends Za{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:SS++}),this.uuid=ds(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=vn.DEFAULT_UP.clone();const t=new D,e=new ws,r=new ps,i=new D(1,1,1);function s(){r.setFromEuler(e,!1)}function o(){e.setFromQuaternion(r,void 0,!1)}e._onChange(s),r._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Ue},normalMatrix:{value:new Qn}}),this.matrix=new Ue,this.matrixWorld=new Ue,this.matrixAutoUpdate=vn.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=vn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new wS,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return Ss.setFromAxisAngle(t,e),this.quaternion.multiply(Ss),this}rotateOnWorldAxis(t,e){return Ss.setFromAxisAngle(t,e),this.quaternion.premultiply(Ss),this}rotateX(t){return this.rotateOnAxis(bm,t)}rotateY(t){return this.rotateOnAxis(wm,t)}rotateZ(t){return this.rotateOnAxis(Sm,t)}translateOnAxis(t,e){return _m.copy(t).applyQuaternion(this.quaternion),this.position.add(_m.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(bm,t)}translateY(t){return this.translateOnAxis(wm,t)}translateZ(t){return this.translateOnAxis(Sm,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Ln.copy(this.matrixWorld).invert())}lookAt(t,e,r){t.isVector3?iu.copy(t):iu.set(t,e,r);const i=this.parent;this.updateWorldMatrix(!0,!1),Oo.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ln.lookAt(Oo,iu,this.up):Ln.lookAt(iu,Oo,this.up),this.quaternion.setFromRotationMatrix(Ln),i&&(Ln.extractRotation(i.matrixWorld),Ss.setFromRotationMatrix(Ln),this.quaternion.premultiply(Ss.invert()))}add(t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(Em),Es.child=t,this.dispatchEvent(Es),Es.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let r=0;r<arguments.length;r++)this.remove(arguments[r]);return this}const e=this.children.indexOf(t);return e!==-1&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(AS),Uc.child=t,this.dispatchEvent(Uc),Uc.child=null),this}removeFromParent(){const t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),Ln.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),Ln.multiply(t.parent.matrixWorld)),t.applyMatrix4(Ln),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(Em),Es.child=t,this.dispatchEvent(Es),Es.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let r=0,i=this.children.length;r<i;r++){const o=this.children[r].getObjectByProperty(t,e);if(o!==void 0)return o}}getObjectsByProperty(t,e,r=[]){this[t]===e&&r.push(this);const i=this.children;for(let s=0,o=i.length;s<o;s++)i[s].getObjectsByProperty(t,e,r);return r}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Oo,t,ES),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Oo,MS,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let r=0,i=e.length;r<i;r++)e[r].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);const e=this.children;for(let r=0,i=e.length;r<i;r++)e[r].traverseVisible(t)}traverseAncestors(t){const e=this.parent;e!==null&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let r=0,i=e.length;r<i;r++)e[r].updateMatrixWorld(t)}updateWorldMatrix(t,e){const r=this.parent;if(t===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),e===!0){const i=this.children;for(let s=0,o=i.length;s<o;s++)i[s].updateWorldMatrix(!1,!0)}}toJSON(t){const e=t===void 0||typeof t=="string",r={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},r.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(a=>({...a})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(t),i.indirectTexture=this._indirectTexture.toJSON(t),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(t)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(t)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(t.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c<h;c++){const f=l[c];s(t.shapes,f)}else s(t.shapes,l)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(t.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(s(t.materials,this.material[l]));i.material=a}else i.material=s(t.materials,this.material);if(this.children.length>0){i.children=[];for(let a=0;a<this.children.length;a++)i.children.push(this.children[a].toJSON(t).object)}if(this.animations.length>0){i.animations=[];for(let a=0;a<this.animations.length;a++){const l=this.animations[a];i.animations.push(s(t.animations,l))}}if(e){const a=o(t.geometries),l=o(t.materials),c=o(t.textures),h=o(t.images),f=o(t.shapes),g=o(t.skeletons),p=o(t.animations),m=o(t.nodes);a.length>0&&(r.geometries=a),l.length>0&&(r.materials=l),c.length>0&&(r.textures=c),h.length>0&&(r.images=h),f.length>0&&(r.shapes=f),g.length>0&&(r.skeletons=g),p.length>0&&(r.animations=p),m.length>0&&(r.nodes=m)}return r.object=i,r;function o(a){const l=[];for(const c in a){const h=a[c];delete h.metadata,l.push(h)}return l}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let r=0;r<t.children.length;r++){const i=t.children[r];this.add(i.clone())}return this}}vn.DEFAULT_UP=new D(0,1,0),vn.DEFAULT_MATRIX_AUTO_UPDATE=!0,vn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Zr=new D,Fn=new D,Yc=new D,Nn=new D,Ms=new D,As=new D,Mm=new D,Xc=new D,Jc=new D,Zc=new D,Kc=new Eo,Qc=new Eo,th=new Eo;class Kr{constructor(t=new D,e=new D,r=new D){this.a=t,this.b=e,this.c=r}static getNormal(t,e,r,i){i.subVectors(r,e),Zr.subVectors(t,e),i.cross(Zr);const s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(t,e,r,i,s){Zr.subVectors(i,e),Fn.subVectors(r,e),Yc.subVectors(t,e);const o=Zr.dot(Zr),a=Zr.dot(Fn),l=Zr.dot(Yc),c=Fn.dot(Fn),h=Fn.dot(Yc),f=o*c-a*a;if(f===0)return s.set(0,0,0),null;const g=1/f,p=(c*l-a*h)*g,m=(o*h-a*l)*g;return s.set(1-p-m,m,p)}static containsPoint(t,e,r,i){return this.getBarycoord(t,e,r,i,Nn)===null?!1:Nn.x>=0&&Nn.y>=0&&Nn.x+Nn.y<=1}static getInterpolation(t,e,r,i,s,o,a,l){return this.getBarycoord(t,e,r,i,Nn)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Nn.x),l.addScaledVector(o,Nn.y),l.addScaledVector(a,Nn.z),l)}static getInterpolatedAttribute(t,e,r,i,s,o){return Kc.setScalar(0),Qc.setScalar(0),th.setScalar(0),Kc.fromBufferAttribute(t,e),Qc.fromBufferAttribute(t,r),th.fromBufferAttribute(t,i),o.setScalar(0),o.addScaledVector(Kc,s.x),o.addScaledVector(Qc,s.y),o.addScaledVector(th,s.z),o}static isFrontFacing(t,e,r,i){return Zr.subVectors(r,e),Fn.subVectors(t,e),Zr.cross(Fn).dot(i)<0}set(t,e,r){return this.a.copy(t),this.b.copy(e),this.c.copy(r),this}setFromPointsAndIndices(t,e,r,i){return this.a.copy(t[e]),this.b.copy(t[r]),this.c.copy(t[i]),this}setFromAttributeAndIndices(t,e,r,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,r),this.c.fromBufferAttribute(t,i),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Zr.subVectors(this.c,this.b),Fn.subVectors(this.a,this.b),Zr.cross(Fn).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return Kr.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return Kr.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,r,i,s){return Kr.getInterpolation(t,this.a,this.b,this.c,e,r,i,s)}containsPoint(t){return Kr.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return Kr.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const r=this.a,i=this.b,s=this.c;let o,a;Ms.subVectors(i,r),As.subVectors(s,r),Xc.subVectors(t,r);const l=Ms.dot(Xc),c=As.dot(Xc);if(l<=0&&c<=0)return e.copy(r);Jc.subVectors(t,i);const h=Ms.dot(Jc),f=As.dot(Jc);if(h>=0&&f<=h)return e.copy(i);const g=l*f-h*c;if(g<=0&&l>=0&&h<=0)return o=l/(l-h),e.copy(r).addScaledVector(Ms,o);Zc.subVectors(t,s);const p=Ms.dot(Zc),m=As.dot(Zc);if(m>=0&&p<=m)return e.copy(s);const v=p*c-l*m;if(v<=0&&c>=0&&m<=0)return a=c/(c-m),e.copy(r).addScaledVector(As,a);const _=h*m-p*f;if(_<=0&&f-h>=0&&p-m>=0)return Mm.subVectors(s,i),a=(f-h)/(f-h+(p-m)),e.copy(i).addScaledVector(Mm,a);const S=1/(_+v+g);return o=v*S,a=g*S,e.copy(r).addScaledVector(Ms,o).addScaledVector(As,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const Am={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},si={h:0,s:0,l:0},su={h:0,s:0,l:0};function eh(n,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?n+(t-n)*6*e:e<1/2?t:e<2/3?n+(t-n)*6*(2/3-e):n}class Mi{constructor(t,e,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,r)}set(t,e,r){if(e===void 0&&r===void 0){const i=t;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(t,e,r);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=Ur){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,Yr.colorSpaceToWorking(this,e),this}setRGB(t,e,r,i=Yr.workingColorSpace){return this.r=t,this.g=e,this.b=r,Yr.colorSpaceToWorking(this,i),this}setHSL(t,e,r,i=Yr.workingColorSpace){if(t=hS(t,1),e=Lt(e,0,1),r=Lt(r,0,1),e===0)this.r=this.g=this.b=r;else{const s=r<=.5?r*(1+e):r+e-r*e,o=2*r-s;this.r=eh(o,s,t+1/3),this.g=eh(o,s,t),this.b=eh(o,s,t-1/3)}return Yr.colorSpaceToWorking(this,i),this}setStyle(t,e=Ur){function r(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(t)){let s;const o=i[1],a=i[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,e);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,e);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){const s=i[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,e);if(o===6)return this.setHex(parseInt(s,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=Ur){const r=Am[t.toLowerCase()];return r!==void 0?this.setHex(r,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=kn(t.r),this.g=kn(t.g),this.b=kn(t.b),this}copyLinearToSRGB(t){return this.r=gs(t.r),this.g=gs(t.g),this.b=gs(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Ur){return Yr.workingToColorSpace(qe.copy(this),t),Math.round(Lt(qe.r*255,0,255))*65536+Math.round(Lt(qe.g*255,0,255))*256+Math.round(Lt(qe.b*255,0,255))}getHexString(t=Ur){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Yr.workingColorSpace){Yr.workingToColorSpace(qe.copy(this),e);const r=qe.r,i=qe.g,s=qe.b,o=Math.max(r,i,s),a=Math.min(r,i,s);let l,c;const h=(a+o)/2;if(a===o)l=0,c=0;else{const f=o-a;switch(c=h<=.5?f/(o+a):f/(2-o-a),o){case r:l=(i-s)/f+(i<s?6:0);break;case i:l=(s-r)/f+2;break;case s:l=(r-i)/f+4;break}l/=6}return t.h=l,t.s=c,t.l=h,t}getRGB(t,e=Yr.workingColorSpace){return Yr.workingToColorSpace(qe.copy(this),e),t.r=qe.r,t.g=qe.g,t.b=qe.b,t}getStyle(t=Ur){Yr.workingToColorSpace(qe.copy(this),t);const e=qe.r,r=qe.g,i=qe.b;return t!==Ur?`color(${t} ${e.toFixed(3)} ${r.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(e*255)},${Math.round(r*255)},${Math.round(i*255)})`}offsetHSL(t,e,r){return this.getHSL(si),this.setHSL(si.h+t,si.s+e,si.l+r)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,r){return this.r=t.r+(e.r-t.r)*r,this.g=t.g+(e.g-t.g)*r,this.b=t.b+(e.b-t.b)*r,this}lerpHSL(t,e){this.getHSL(si),t.getHSL(su);const r=Fc(si.h,su.h,e),i=Fc(si.s,su.s,e),s=Fc(si.l,su.l,e);return this.setHSL(r,i,s),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){const e=this.r,r=this.g,i=this.b,s=t.elements;return this.r=s[0]*e+s[3]*r+s[6]*i,this.g=s[1]*e+s[4]*r+s[7]*i,this.b=s[2]*e+s[5]*r+s[8]*i,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const qe=new Mi;Mi.NAMES=Am;let OS=0;class Om extends Za{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:OS++}),this.uuid=ds(),this.name="",this.type="Material",this.blending=Kg,this.side=Rc,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=tm,this.blendDst=em,this.blendEquation=Qg,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Mi(0,0,0),this.blendAlpha=0,this.depthFunc=rm,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=lm,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=fs,this.stencilZFail=fs,this.stencilZPass=fs,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(t!==void 0)for(const e in t){const r=t[e];if(r===void 0){console.warn(`THREE.Material: parameter '${e}' has value of undefined.`);continue}const i=this[e];if(i===void 0){console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(r):i&&i.isVector3&&r&&r.isVector3?i.copy(r):this[e]=r}}toJSON(t){const e=t===void 0||typeof t=="string";e&&(t={textures:{},images:{}});const r={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),this.roughness!==void 0&&(r.roughness=this.roughness),this.metalness!==void 0&&(r.metalness=this.metalness),this.sheen!==void 0&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(r.shininess=this.shininess),this.clearcoat!==void 0&&(r.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(r.dispersion=this.dispersion),this.iridescence!==void 0&&(r.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(r.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.anisotropy!==void 0&&(r.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(r.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(r.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(t).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(t).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(t).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(t).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(t).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(t).uuid,this.combine!==void 0&&(r.combine=this.combine)),this.envMapRotation!==void 0&&(r.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(r.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(r.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(t).uuid),this.transmission!==void 0&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(t).uuid),this.thickness!==void 0&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(t).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(r.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(r.size=this.size),this.shadowSide!==null&&(r.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==Kg&&(r.blending=this.blending),this.side!==Rc&&(r.side=this.side),this.vertexColors===!0&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=!0),this.blendSrc!==tm&&(r.blendSrc=this.blendSrc),this.blendDst!==em&&(r.blendDst=this.blendDst),this.blendEquation!==Qg&&(r.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(r.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(r.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(r.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(r.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(r.blendAlpha=this.blendAlpha),this.depthFunc!==rm&&(r.depthFunc=this.depthFunc),this.depthTest===!1&&(r.depthTest=this.depthTest),this.depthWrite===!1&&(r.depthWrite=this.depthWrite),this.colorWrite===!1&&(r.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(r.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==lm&&(r.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(r.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==fs&&(r.stencilFail=this.stencilFail),this.stencilZFail!==fs&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==fs&&(r.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(r.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaHash===!0&&(r.alphaHash=!0),this.alphaToCoverage===!0&&(r.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=!0),this.forceSinglePass===!0&&(r.forceSinglePass=!0),this.wireframe===!0&&(r.wireframe=!0),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=!0),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),this.fog===!1&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData);function i(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(e){const s=i(t.textures),o=i(t.images);s.length>0&&(r.textures=s),o.length>0&&(r.images=o)}return r}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let r=null;if(e!==null){const i=e.length;r=new Array(i);for(let s=0;s!==i;++s)r[s]=e[s].clone()}return this.clippingPlanes=r,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){t===!0&&this.version++}}class Os extends Om{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Mi(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ws,this.combine=nm,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}const be=new D,ou=new Et;let zS=0;class zs{constructor(t,e,r=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:zS++}),this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=r,this.usage=cm,this.updateRanges=[],this.gpuType=uS,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,r){t*=this.itemSize,r*=e.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[t+i]=e.array[r+i];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(this.itemSize===2)for(let e=0,r=this.count;e<r;e++)ou.fromBufferAttribute(this,e),ou.applyMatrix3(t),this.setXY(e,ou.x,ou.y);else if(this.itemSize===3)for(let e=0,r=this.count;e<r;e++)be.fromBufferAttribute(this,e),be.applyMatrix3(t),this.setXYZ(e,be.x,be.y,be.z);return this}applyMatrix4(t){for(let e=0,r=this.count;e<r;e++)be.fromBufferAttribute(this,e),be.applyMatrix4(t),this.setXYZ(e,be.x,be.y,be.z);return this}applyNormalMatrix(t){for(let e=0,r=this.count;e<r;e++)be.fromBufferAttribute(this,e),be.applyNormalMatrix(t),this.setXYZ(e,be.x,be.y,be.z);return this}transformDirection(t){for(let e=0,r=this.count;e<r;e++)be.fromBufferAttribute(this,e),be.transformDirection(t),this.setXYZ(e,be.x,be.y,be.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let r=this.array[t*this.itemSize+e];return this.normalized&&(r=So(r,this.array)),r}setComponent(t,e,r){return this.normalized&&(r=er(r,this.array)),this.array[t*this.itemSize+e]=r,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=So(e,this.array)),e}setX(t,e){return this.normalized&&(e=er(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=So(e,this.array)),e}setY(t,e){return this.normalized&&(e=er(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=So(e,this.array)),e}setZ(t,e){return this.normalized&&(e=er(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=So(e,this.array)),e}setW(t,e){return this.normalized&&(e=er(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,r){return t*=this.itemSize,this.normalized&&(e=er(e,this.array),r=er(r,this.array)),this.array[t+0]=e,this.array[t+1]=r,this}setXYZ(t,e,r,i){return t*=this.itemSize,this.normalized&&(e=er(e,this.array),r=er(r,this.array),i=er(i,this.array)),this.array[t+0]=e,this.array[t+1]=r,this.array[t+2]=i,this}setXYZW(t,e,r,i,s){return t*=this.itemSize,this.normalized&&(e=er(e,this.array),r=er(r,this.array),i=er(i,this.array),s=er(s,this.array)),this.array[t+0]=e,this.array[t+1]=r,this.array[t+2]=i,this.array[t+3]=s,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(t.name=this.name),this.usage!==cm&&(t.usage=this.usage),t}}class TS extends zs{constructor(t,e,r){super(new Uint16Array(t),e,r)}}class CS extends zs{constructor(t,e,r){super(new Uint32Array(t),e,r)}}class jn extends zs{constructor(t,e,r){super(new Float32Array(t),e,r)}}let IS=0;const Tr=new Ue,rh=new vn,Ts=new D,fr=new ys,zo=new ys,ke=new D;class Ai extends Za{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:IS++}),this.uuid=ds(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(fS(t)?CS:TS)(t,1):this.index=t,this}setIndirect(t){return this.indirect=t,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,e,r=0){this.groups.push({start:t,count:e,materialIndex:r})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;e!==void 0&&(e.applyMatrix4(t),e.needsUpdate=!0);const r=this.attributes.normal;if(r!==void 0){const s=new Qn().getNormalMatrix(t);r.applyNormalMatrix(s),r.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(t),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(t){return Tr.makeRotationFromQuaternion(t),this.applyMatrix4(Tr),this}rotateX(t){return Tr.makeRotationX(t),this.applyMatrix4(Tr),this}rotateY(t){return Tr.makeRotationY(t),this.applyMatrix4(Tr),this}rotateZ(t){return Tr.makeRotationZ(t),this.applyMatrix4(Tr),this}translate(t,e,r){return Tr.makeTranslation(t,e,r),this.applyMatrix4(Tr),this}scale(t,e,r){return Tr.makeScale(t,e,r),this.applyMatrix4(Tr),this}lookAt(t){return rh.lookAt(t),rh.updateMatrix(),this.applyMatrix4(rh.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ts).negate(),this.translate(Ts.x,Ts.y,Ts.z),this}setFromPoints(t){const e=this.getAttribute("position");if(e===void 0){const r=[];for(let i=0,s=t.length;i<s;i++){const o=t[i];r.push(o.x,o.y,o.z||0)}this.setAttribute("position",new jn(r,3))}else{const r=Math.min(t.length,e.count);for(let i=0;i<r;i++){const s=t[i];e.setXYZ(i,s.x,s.y,s.z||0)}t.length>e.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ys);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new D(-1/0,-1/0,-1/0),new D(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let r=0,i=e.length;r<i;r++){const s=e[r];fr.setFromBufferAttribute(s),this.morphTargetsRelative?(ke.addVectors(this.boundingBox.min,fr.min),this.boundingBox.expandByPoint(ke),ke.addVectors(this.boundingBox.max,fr.max),this.boundingBox.expandByPoint(ke)):(this.boundingBox.expandByPoint(fr.min),this.boundingBox.expandByPoint(fr.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new ym);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new D,1/0);return}if(t){const r=this.boundingSphere.center;if(fr.setFromBufferAttribute(t),e)for(let s=0,o=e.length;s<o;s++){const a=e[s];zo.setFromBufferAttribute(a),this.morphTargetsRelative?(ke.addVectors(fr.min,zo.min),fr.expandByPoint(ke),ke.addVectors(fr.max,zo.max),fr.expandByPoint(ke)):(fr.expandByPoint(zo.min),fr.expandByPoint(zo.max))}fr.getCenter(r);let i=0;for(let s=0,o=t.count;s<o;s++)ke.fromBufferAttribute(t,s),i=Math.max(i,r.distanceToSquared(ke));if(e)for(let s=0,o=e.length;s<o;s++){const a=e[s],l=this.morphTargetsRelative;for(let c=0,h=a.count;c<h;c++)ke.fromBufferAttribute(a,c),l&&(Ts.fromBufferAttribute(t,c),ke.add(Ts)),i=Math.max(i,r.distanceToSquared(ke))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const t=this.index,e=this.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const r=e.position,i=e.normal,s=e.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new zs(new Float32Array(4*r.count),4));const o=this.getAttribute("tangent"),a=[],l=[];for(let k=0;k<r.count;k++)a[k]=new D,l[k]=new D;const c=new D,h=new D,f=new D,g=new Et,p=new Et,m=new Et,v=new D,_=new D;function S(k,L,X){c.fromBufferAttribute(r,k),h.fromBufferAttribute(r,L),f.fromBufferAttribute(r,X),g.fromBufferAttribute(s,k),p.fromBufferAttribute(s,L),m.fromBufferAttribute(s,X),h.sub(c),f.sub(c),p.sub(g),m.sub(g);const J=1/(p.x*m.y-m.x*p.y);isFinite(J)&&(v.copy(h).multiplyScalar(m.y).addScaledVector(f,-p.y).multiplyScalar(J),_.copy(f).multiplyScalar(p.x).addScaledVector(h,-m.x).multiplyScalar(J),a[k].add(v),a[L].add(v),a[X].add(v),l[k].add(_),l[L].add(_),l[X].add(_))}let M=this.groups;M.length===0&&(M=[{start:0,count:t.count}]);for(let k=0,L=M.length;k<L;++k){const X=M[k],J=X.start,at=X.count;for(let tt=J,bt=J+at;tt<bt;tt+=3)S(t.getX(tt+0),t.getX(tt+1),t.getX(tt+2))}const T=new D,C=new D,E=new D,z=new D;function R(k){E.fromBufferAttribute(i,k),z.copy(E);const L=a[k];T.copy(L),T.sub(E.multiplyScalar(E.dot(L))).normalize(),C.crossVectors(z,L);const J=C.dot(l[k])<0?-1:1;o.setXYZW(k,T.x,T.y,T.z,J)}for(let k=0,L=M.length;k<L;++k){const X=M[k],J=X.start,at=X.count;for(let tt=J,bt=J+at;tt<bt;tt+=3)R(t.getX(tt+0)),R(t.getX(tt+1)),R(t.getX(tt+2))}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(e!==void 0){let r=this.getAttribute("normal");if(r===void 0)r=new zs(new Float32Array(e.count*3),3),this.setAttribute("normal",r);else for(let g=0,p=r.count;g<p;g++)r.setXYZ(g,0,0,0);const i=new D,s=new D,o=new D,a=new D,l=new D,c=new D,h=new D,f=new D;if(t)for(let g=0,p=t.count;g<p;g+=3){const m=t.getX(g+0),v=t.getX(g+1),_=t.getX(g+2);i.fromBufferAttribute(e,m),s.fromBufferAttribute(e,v),o.fromBufferAttribute(e,_),h.subVectors(o,s),f.subVectors(i,s),h.cross(f),a.fromBufferAttribute(r,m),l.fromBufferAttribute(r,v),c.fromBufferAttribute(r,_),a.add(h),l.add(h),c.add(h),r.setXYZ(m,a.x,a.y,a.z),r.setXYZ(v,l.x,l.y,l.z),r.setXYZ(_,c.x,c.y,c.z)}else for(let g=0,p=e.count;g<p;g+=3)i.fromBufferAttribute(e,g+0),s.fromBufferAttribute(e,g+1),o.fromBufferAttribute(e,g+2),h.subVectors(o,s),f.subVectors(i,s),h.cross(f),r.setXYZ(g+0,h.x,h.y,h.z),r.setXYZ(g+1,h.x,h.y,h.z),r.setXYZ(g+2,h.x,h.y,h.z);this.normalizeNormals(),r.needsUpdate=!0}}normalizeNormals(){const t=this.attributes.normal;for(let e=0,r=t.count;e<r;e++)ke.fromBufferAttribute(t,e),ke.normalize(),t.setXYZ(e,ke.x,ke.y,ke.z)}toNonIndexed(){function t(a,l){const c=a.array,h=a.itemSize,f=a.normalized,g=new c.constructor(l.length*h);let p=0,m=0;for(let v=0,_=l.length;v<_;v++){a.isInterleavedBufferAttribute?p=l[v]*a.data.stride+a.offset:p=l[v]*h;for(let S=0;S<h;S++)g[m++]=c[p++]}return new zs(g,h,f)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new Ai,r=this.index.array,i=this.attributes;for(const a in i){const l=i[a],c=t(l,r);e.setAttribute(a,c)}const s=this.morphAttributes;for(const a in s){const l=[],c=s[a];for(let h=0,f=c.length;h<f;h++){const g=c[h],p=t(g,r);l.push(p)}e.morphAttributes[a]=l}e.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,l=o.length;a<l;a++){const c=o[a];e.addGroup(c.start,c.count,c.materialIndex)}return e}toJSON(){const t={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(t[c]=l[c]);return t}t.data={attributes:{}};const e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const r=this.attributes;for(const l in r){const c=r[l];t.data.attributes[l]=c.toJSON(t.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],h=[];for(let f=0,g=c.length;f<g;f++){const p=c[f];h.push(p.toJSON(t.data))}h.length>0&&(i[l]=h,s=!0)}s&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(t.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(t.data.boundingSphere=a.toJSON()),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const r=t.index;r!==null&&this.setIndex(r.clone());const i=t.attributes;for(const c in i){const h=i[c];this.setAttribute(c,h.clone(e))}const s=t.morphAttributes;for(const c in s){const h=[],f=s[c];for(let g=0,p=f.length;g<p;g++)h.push(f[g].clone(e));this.morphAttributes[c]=h}this.morphTargetsRelative=t.morphTargetsRelative;const o=t.groups;for(let c=0,h=o.length;c<h;c++){const f=o[c];this.addGroup(f.start,f.count,f.materialIndex)}const a=t.boundingBox;a!==null&&(this.boundingBox=a.clone());const l=t.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const zm=new Ue,Oi=new xS,au=new ym,Tm=new D,uu=new D,lu=new D,cu=new D,nh=new D,hu=new D,Cm=new D,fu=new D;class Cs extends vn{constructor(t=new Ai,e=new Os){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),t.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),t.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){const e=this.geometry.morphAttributes,r=Object.keys(e);if(r.length>0){const i=e[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(t,e){const r=this.geometry,i=r.attributes.position,s=r.morphAttributes.position,o=r.morphTargetsRelative;e.fromBufferAttribute(i,t);const a=this.morphTargetInfluences;if(s&&a){hu.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const h=a[l],f=s[l];h!==0&&(nh.fromBufferAttribute(f,t),o?hu.addScaledVector(nh,h):hu.addScaledVector(nh.sub(e),h))}e.add(hu)}return e}raycast(t,e){const r=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(r.boundingSphere===null&&r.computeBoundingSphere(),au.copy(r.boundingSphere),au.applyMatrix4(s),Oi.copy(t.ray).recast(t.near),!(au.containsPoint(Oi.origin)===!1&&(Oi.intersectSphere(au,Tm)===null||Oi.origin.distanceToSquared(Tm)>(t.far-t.near)**2))&&(zm.copy(s).invert(),Oi.copy(t.ray).applyMatrix4(zm),!(r.boundingBox!==null&&Oi.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(t,e,Oi)))}_computeIntersections(t,e,r){let i;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,h=s.attributes.uv1,f=s.attributes.normal,g=s.groups,p=s.drawRange;if(a!==null)if(Array.isArray(o))for(let m=0,v=g.length;m<v;m++){const _=g[m],S=o[_.materialIndex],M=Math.max(_.start,p.start),T=Math.min(a.count,Math.min(_.start+_.count,p.start+p.count));for(let C=M,E=T;C<E;C+=3){const z=a.getX(C),R=a.getX(C+1),k=a.getX(C+2);i=du(this,S,t,r,c,h,f,z,R,k),i&&(i.faceIndex=Math.floor(C/3),i.face.materialIndex=_.materialIndex,e.push(i))}}else{const m=Math.max(0,p.start),v=Math.min(a.count,p.start+p.count);for(let _=m,S=v;_<S;_+=3){const M=a.getX(_),T=a.getX(_+1),C=a.getX(_+2);i=du(this,o,t,r,c,h,f,M,T,C),i&&(i.faceIndex=Math.floor(_/3),e.push(i))}}else if(l!==void 0)if(Array.isArray(o))for(let m=0,v=g.length;m<v;m++){const _=g[m],S=o[_.materialIndex],M=Math.max(_.start,p.start),T=Math.min(l.count,Math.min(_.start+_.count,p.start+p.count));for(let C=M,E=T;C<E;C+=3){const z=C,R=C+1,k=C+2;i=du(this,S,t,r,c,h,f,z,R,k),i&&(i.faceIndex=Math.floor(C/3),i.face.materialIndex=_.materialIndex,e.push(i))}}else{const m=Math.max(0,p.start),v=Math.min(l.count,p.start+p.count);for(let _=m,S=v;_<S;_+=3){const M=_,T=_+1,C=_+2;i=du(this,o,t,r,c,h,f,M,T,C),i&&(i.faceIndex=Math.floor(_/3),e.push(i))}}}}function kS(n,t,e,r,i,s,o,a){let l;if(t.side===nS?l=r.intersectTriangle(o,s,i,!0,a):l=r.intersectTriangle(i,s,o,t.side===Rc,a),l===null)return null;fu.copy(a),fu.applyMatrix4(n.matrixWorld);const c=e.ray.origin.distanceTo(fu);return c<e.near||c>e.far?null:{distance:c,point:fu.clone(),object:n}}function du(n,t,e,r,i,s,o,a,l,c){n.getVertexPosition(a,uu),n.getVertexPosition(l,lu),n.getVertexPosition(c,cu);const h=kS(n,t,e,r,uu,lu,cu,Cm);if(h){const f=new D;Kr.getBarycoord(Cm,uu,lu,cu,f),i&&(h.uv=Kr.getInterpolatedAttribute(i,a,l,c,f,new Et)),s&&(h.uv1=Kr.getInterpolatedAttribute(s,a,l,c,f,new Et)),o&&(h.normal=Kr.getInterpolatedAttribute(o,a,l,c,f,new D),h.normal.dot(r.direction)>0&&h.normal.multiplyScalar(-1));const g={a,b:l,c,normal:new D,materialIndex:0};Kr.getNormal(uu,lu,cu,g.normal),h.face=g,h.barycoord=f}return h}class pu extends Ai{constructor(t=1,e=1,r=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:r,widthSegments:i,heightSegments:s,depthSegments:o};const a=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],h=[],f=[];let g=0,p=0;m("z","y","x",-1,-1,r,e,t,o,s,0),m("z","y","x",1,-1,r,e,-t,o,s,1),m("x","z","y",1,1,t,r,e,i,o,2),m("x","z","y",1,-1,t,r,-e,i,o,3),m("x","y","z",1,-1,t,e,r,i,s,4),m("x","y","z",-1,-1,t,e,-r,i,s,5),this.setIndex(l),this.setAttribute("position",new jn(c,3)),this.setAttribute("normal",new jn(h,3)),this.setAttribute("uv",new jn(f,2));function m(v,_,S,M,T,C,E,z,R,k,L){const X=C/R,J=E/k,at=C/2,tt=E/2,bt=z/2,xt=R+1,yt=k+1;let ht=0,Y=0;const St=new D;for(let j=0;j<yt;j++){const W=j*J-tt;for(let ft=0;ft<xt;ft++){const et=ft*X-at;St[v]=et*M,St[_]=W*T,St[S]=bt,c.push(St.x,St.y,St.z),St[v]=0,St[_]=0,St[S]=z>0?1:-1,h.push(St.x,St.y,St.z),f.push(ft/R),f.push(1-j/k),ht+=1}}for(let j=0;j<k;j++)for(let W=0;W<R;W++){const ft=g+W+xt*j,et=g+W+xt*(j+1),rt=g+(W+1)+xt*(j+1),Z=g+(W+1)+xt*j;l.push(ft,et,Z),l.push(et,rt,Z),Y+=6}a.addGroup(p,Y,L),p+=Y,g+=ht}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new pu(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}class PS extends vn{constructor(){super(),this.isGroup=!0,this.type="Group"}}class xn{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){console.warn("THREE.Curve: .getPoint() not implemented.")}getPointAt(t,e){const r=this.getUtoTmapping(t);return this.getPoint(r,e)}getPoints(t=5){const e=[];for(let r=0;r<=t;r++)e.push(this.getPoint(r/t));return e}getSpacedPoints(t=5){const e=[];for(let r=0;r<=t;r++)e.push(this.getPointAt(r/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let r,i=this.getPoint(0),s=0;e.push(0);for(let o=1;o<=t;o++)r=this.getPoint(o/t),s+=r.distanceTo(i),e.push(s),i=r;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e=null){const r=this.getLengths();let i=0;const s=r.length;let o;e?o=e:o=t*r[s-1];let a=0,l=s-1,c;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),c=r[i]-o,c<0)a=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,r[i]===o)return i/(s-1);const h=r[i],g=r[i+1]-h,p=(o-h)/g;return(i+p)/(s-1)}getTangent(t,e){let i=t-1e-4,s=t+1e-4;i<0&&(i=0),s>1&&(s=1);const o=this.getPoint(i),a=this.getPoint(s),l=e||(o.isVector2?new Et:new D);return l.copy(a).sub(o).normalize(),l}getTangentAt(t,e){const r=this.getUtoTmapping(t);return this.getTangent(r,e)}computeFrenetFrames(t,e=!1){const r=new D,i=[],s=[],o=[],a=new D,l=new Ue;for(let p=0;p<=t;p++){const m=p/t;i[p]=this.getTangentAt(m,new D)}s[0]=new D,o[0]=new D;let c=Number.MAX_VALUE;const h=Math.abs(i[0].x),f=Math.abs(i[0].y),g=Math.abs(i[0].z);h<=c&&(c=h,r.set(1,0,0)),f<=c&&(c=f,r.set(0,1,0)),g<=c&&r.set(0,0,1),a.crossVectors(i[0],r).normalize(),s[0].crossVectors(i[0],a),o[0].crossVectors(i[0],s[0]);for(let p=1;p<=t;p++){if(s[p]=s[p-1].clone(),o[p]=o[p-1].clone(),a.crossVectors(i[p-1],i[p]),a.length()>Number.EPSILON){a.normalize();const m=Math.acos(Lt(i[p-1].dot(i[p]),-1,1));s[p].applyMatrix4(l.makeRotationAxis(a,m))}o[p].crossVectors(i[p],s[p])}if(e===!0){let p=Math.acos(Lt(s[0].dot(s[t]),-1,1));p/=t,i[0].dot(a.crossVectors(s[0],s[t]))>0&&(p=-p);for(let m=1;m<=t;m++)s[m].applyMatrix4(l.makeRotationAxis(i[m],p*m)),o[m].crossVectors(i[m],s[m])}return{tangents:i,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class ih extends xn{constructor(t=0,e=0,r=1,i=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=r,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(t,e=new Et){const r=e,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=i;for(;s>i;)s-=i;s<Number.EPSILON&&(o?s=0:s=i),this.aClockwise===!0&&!o&&(s===i?s=-i:s=s-i);const a=this.aStartAngle+t*s;let l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){const h=Math.cos(this.aRotation),f=Math.sin(this.aRotation),g=l-this.aX,p=c-this.aY;l=g*h-p*f+this.aX,c=g*f+p*h+this.aY}return r.set(l,c)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}class RS extends ih{constructor(t,e,r,i,s,o){super(t,e,r,r,i,s,o),this.isArcCurve=!0,this.type="ArcCurve"}}function sh(){let n=0,t=0,e=0,r=0;function i(s,o,a,l){n=s,t=a,e=-3*s+3*o-2*a-l,r=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){i(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,h,f){let g=(o-s)/c-(a-s)/(c+h)+(a-o)/h,p=(a-o)/h-(l-o)/(h+f)+(l-a)/f;g*=h,p*=h,i(o,a,g,p)},calc:function(s){const o=s*s,a=o*s;return n+t*s+e*o+r*a}}}const gu=new D,oh=new sh,ah=new sh,uh=new sh;class LS extends xn{constructor(t=[],e=!1,r="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=r,this.tension=i}getPoint(t,e=new D){const r=e,i=this.points,s=i.length,o=(s-(this.closed?0:1))*t;let a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,h;this.closed||a>0?c=i[(a-1)%s]:(gu.subVectors(i[0],i[1]).add(i[0]),c=gu);const f=i[a%s],g=i[(a+1)%s];if(this.closed||a+2<s?h=i[(a+2)%s]:(gu.subVectors(i[s-1],i[s-2]).add(i[s-1]),h=gu),this.curveType==="centripetal"||this.curveType==="chordal"){const p=this.curveType==="chordal"?.5:.25;let m=Math.pow(c.distanceToSquared(f),p),v=Math.pow(f.distanceToSquared(g),p),_=Math.pow(g.distanceToSquared(h),p);v<1e-4&&(v=1),m<1e-4&&(m=v),_<1e-4&&(_=v),oh.initNonuniformCatmullRom(c.x,f.x,g.x,h.x,m,v,_),ah.initNonuniformCatmullRom(c.y,f.y,g.y,h.y,m,v,_),uh.initNonuniformCatmullRom(c.z,f.z,g.z,h.z,m,v,_)}else this.curveType==="catmullrom"&&(oh.initCatmullRom(c.x,f.x,g.x,h.x,this.tension),ah.initCatmullRom(c.y,f.y,g.y,h.y,this.tension),uh.initCatmullRom(c.z,f.z,g.z,h.z,this.tension));return r.set(oh.calc(l),ah.calc(l),uh.calc(l)),r}copy(t){super.copy(t),this.points=[];for(let e=0,r=t.points.length;e<r;e++){const i=t.points[e];this.points.push(i.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,r=this.points.length;e<r;e++){const i=this.points[e];t.points.push(i.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,r=t.points.length;e<r;e++){const i=t.points[e];this.points.push(new D().fromArray(i))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}function Im(n,t,e,r,i){const s=(r-t)*.5,o=(i-e)*.5,a=n*n,l=n*a;return(2*e-2*r+s+o)*l+(-3*e+3*r-2*s-o)*a+s*n+e}function FS(n,t){const e=1-n;return e*e*t}function NS(n,t){return 2*(1-n)*n*t}function jS(n,t){return n*n*t}function To(n,t,e,r){return FS(n,t)+NS(n,e)+jS(n,r)}function VS(n,t){const e=1-n;return e*e*e*t}function DS(n,t){const e=1-n;return 3*e*e*n*t}function BS(n,t){return 3*(1-n)*n*n*t}function qS(n,t){return n*n*n*t}function Co(n,t,e,r,i){return VS(n,t)+DS(n,e)+BS(n,r)+qS(n,i)}class km extends xn{constructor(t=new Et,e=new Et,r=new Et,i=new Et){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=r,this.v3=i}getPoint(t,e=new Et){const r=e,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return r.set(Co(t,i.x,s.x,o.x,a.x),Co(t,i.y,s.y,o.y,a.y)),r}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class $S extends xn{constructor(t=new D,e=new D,r=new D,i=new D){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=r,this.v3=i}getPoint(t,e=new D){const r=e,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return r.set(Co(t,i.x,s.x,o.x,a.x),Co(t,i.y,s.y,o.y,a.y),Co(t,i.z,s.z,o.z,a.z)),r}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class Pm extends xn{constructor(t=new Et,e=new Et){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new Et){const r=e;return t===1?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(t).add(this.v1)),r}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new Et){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class HS extends xn{constructor(t=new D,e=new D){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new D){const r=e;return t===1?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(t).add(this.v1)),r}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new D){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class Rm extends xn{constructor(t=new Et,e=new Et,r=new Et){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=r}getPoint(t,e=new Et){const r=e,i=this.v0,s=this.v1,o=this.v2;return r.set(To(t,i.x,s.x,o.x),To(t,i.y,s.y,o.y)),r}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class GS extends xn{constructor(t=new D,e=new D,r=new D){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=r}getPoint(t,e=new D){const r=e,i=this.v0,s=this.v1,o=this.v2;return r.set(To(t,i.x,s.x,o.x),To(t,i.y,s.y,o.y),To(t,i.z,s.z,o.z)),r}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class Lm extends xn{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new Et){const r=e,i=this.points,s=(i.length-1)*t,o=Math.floor(s),a=s-o,l=i[o===0?o:o-1],c=i[o],h=i[o>i.length-2?i.length-1:o+1],f=i[o>i.length-3?i.length-1:o+2];return r.set(Im(a,l.x,c.x,h.x,f.x),Im(a,l.y,c.y,h.y,f.y)),r}copy(t){super.copy(t),this.points=[];for(let e=0,r=t.points.length;e<r;e++){const i=t.points[e];this.points.push(i.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,r=this.points.length;e<r;e++){const i=this.points[e];t.points.push(i.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,r=t.points.length;e<r;e++){const i=t.points[e];this.points.push(new Et().fromArray(i))}return this}}var Fm=Object.freeze({__proto__:null,ArcCurve:RS,CatmullRomCurve3:LS,CubicBezierCurve:km,CubicBezierCurve3:$S,EllipseCurve:ih,LineCurve:Pm,LineCurve3:HS,QuadraticBezierCurve:Rm,QuadraticBezierCurve3:GS,SplineCurve:Lm});class WS extends xn{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);if(!t.equals(e)){const r=t.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new Fm[r](e,t))}return this}getPoint(t,e){const r=t*this.getLength(),i=this.getCurveLengths();let s=0;for(;s<i.length;){if(i[s]>=r){const o=i[s]-r,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,e)}s++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let r=0,i=this.curves.length;r<i;r++)e+=this.curves[r].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let r=0;r<=t;r++)e.push(this.getPoint(r/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let r;for(let i=0,s=this.curves;i<s.length;i++){const o=s[i],a=o.isEllipseCurve?t*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?t*o.points.length:t,l=o.getPoints(a);for(let c=0;c<l.length;c++){const h=l[c];r&&r.equals(h)||(e.push(h),r=h)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,r=t.curves.length;e<r;e++){const i=t.curves[e];this.curves.push(i.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,r=this.curves.length;e<r;e++){const i=this.curves[e];t.curves.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,r=t.curves.length;e<r;e++){const i=t.curves[e];this.curves.push(new Fm[i.type]().fromJSON(i))}return this}}class Nm extends WS{constructor(t){super(),this.type="Path",this.currentPoint=new Et,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,r=t.length;e<r;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const r=new Pm(this.currentPoint.clone(),new Et(t,e));return this.curves.push(r),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,r,i){const s=new Rm(this.currentPoint.clone(),new Et(t,e),new Et(r,i));return this.curves.push(s),this.currentPoint.set(r,i),this}bezierCurveTo(t,e,r,i,s,o){const a=new km(this.currentPoint.clone(),new Et(t,e),new Et(r,i),new Et(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),r=new Lm(e);return this.curves.push(r),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,r,i,s,o){const a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(t+a,e+l,r,i,s,o),this}absarc(t,e,r,i,s,o){return this.absellipse(t,e,r,r,i,s,o),this}ellipse(t,e,r,i,s,o,a,l){const c=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(t+c,e+h,r,i,s,o,a,l),this}absellipse(t,e,r,i,s,o,a,l){const c=new ih(t,e,r,i,s,o,a,l);if(this.curves.length>0){const f=c.getPoint(0);f.equals(this.currentPoint)||this.lineTo(f.x,f.y)}this.curves.push(c);const h=c.getPoint(1);return this.currentPoint.copy(h),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class lh extends Nm{constructor(t){super(t),this.uuid=ds(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let r=0,i=this.holes.length;r<i;r++)e[r]=this.holes[r].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,r=t.holes.length;e<r;e++){const i=t.holes[e];this.holes.push(i.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,r=this.holes.length;e<r;e++){const i=this.holes[e];t.holes.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,r=t.holes.length;e<r;e++){const i=t.holes[e];this.holes.push(new Nm().fromJSON(i))}return this}}function US(n,t,e=2){const r=t&&t.length,i=r?t[0]*e:n.length;let s=jm(n,0,i,e,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,c;if(r&&(s=KS(n,t,s,e)),n.length>80*e){a=1/0,l=1/0;let h=-1/0,f=-1/0;for(let g=e;g<i;g+=e){const p=n[g],m=n[g+1];p<a&&(a=p),m<l&&(l=m),p>h&&(h=p),m>f&&(f=m)}c=Math.max(h-a,f-l),c=c!==0?32767/c:0}return Io(s,o,e,a,l,c,0),o}function jm(n,t,e,r,i){let s;if(i===l2(n,t,e,r)>0)for(let o=t;o<e;o+=r)s=qm(o/r|0,n[o],n[o+1],s);else for(let o=e-r;o>=t;o-=r)s=qm(o/r|0,n[o],n[o+1],s);return s&&Is(s,s.next)&&(Ro(s),s=s.next),s}function zi(n,t){if(!n)return n;t||(t=n);let e=n,r;do if(r=!1,!e.steiner&&(Is(e,e.next)||he(e.prev,e,e.next)===0)){if(Ro(e),e=t=e.prev,e===e.next)break;r=!0}else e=e.next;while(r||e!==t);return t}function Io(n,t,e,r,i,s,o){if(!n)return;!o&&s&&n2(n,r,i,s);let a=n;for(;n.prev!==n.next;){const l=n.prev,c=n.next;if(s?XS(n,r,i,s):YS(n)){t.push(l.i,n.i,c.i),Ro(n),n=c.next,a=c.next;continue}if(n=c,n===a){o?o===1?(n=JS(zi(n),t),Io(n,t,e,r,i,s,2)):o===2&&ZS(n,t,e,r,i,s):Io(zi(n),t,e,r,i,s,1);break}}}function YS(n){const t=n.prev,e=n,r=n.next;if(he(t,e,r)>=0)return!1;const i=t.x,s=e.x,o=r.x,a=t.y,l=e.y,c=r.y,h=Math.min(i,s,o),f=Math.min(a,l,c),g=Math.max(i,s,o),p=Math.max(a,l,c);let m=r.next;for(;m!==t;){if(m.x>=h&&m.x<=g&&m.y>=f&&m.y<=p&&ko(i,a,s,l,o,c,m.x,m.y)&&he(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function XS(n,t,e,r){const i=n.prev,s=n,o=n.next;if(he(i,s,o)>=0)return!1;const a=i.x,l=s.x,c=o.x,h=i.y,f=s.y,g=o.y,p=Math.min(a,l,c),m=Math.min(h,f,g),v=Math.max(a,l,c),_=Math.max(h,f,g),S=ch(p,m,t,e,r),M=ch(v,_,t,e,r);let T=n.prevZ,C=n.nextZ;for(;T&&T.z>=S&&C&&C.z<=M;){if(T.x>=p&&T.x<=v&&T.y>=m&&T.y<=_&&T!==i&&T!==o&&ko(a,h,l,f,c,g,T.x,T.y)&&he(T.prev,T,T.next)>=0||(T=T.prevZ,C.x>=p&&C.x<=v&&C.y>=m&&C.y<=_&&C!==i&&C!==o&&ko(a,h,l,f,c,g,C.x,C.y)&&he(C.prev,C,C.next)>=0))return!1;C=C.nextZ}for(;T&&T.z>=S;){if(T.x>=p&&T.x<=v&&T.y>=m&&T.y<=_&&T!==i&&T!==o&&ko(a,h,l,f,c,g,T.x,T.y)&&he(T.prev,T,T.next)>=0)return!1;T=T.prevZ}for(;C&&C.z<=M;){if(C.x>=p&&C.x<=v&&C.y>=m&&C.y<=_&&C!==i&&C!==o&&ko(a,h,l,f,c,g,C.x,C.y)&&he(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function JS(n,t){let e=n;do{const r=e.prev,i=e.next.next;!Is(r,i)&&Dm(r,e,e.next,i)&&Po(r,i)&&Po(i,r)&&(t.push(r.i,e.i,i.i),Ro(e),Ro(e.next),e=n=i),e=e.next}while(e!==n);return zi(e)}function ZS(n,t,e,r,i,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&o2(o,a)){let l=Bm(o,a);o=zi(o,o.next),l=zi(l,l.next),Io(o,t,e,r,i,s,0),Io(l,t,e,r,i,s,0);return}a=a.next}o=o.next}while(o!==n)}function KS(n,t,e,r){const i=[];for(let s=0,o=t.length;s<o;s++){const a=t[s]*r,l=s<o-1?t[s+1]*r:n.length,c=jm(n,a,l,r,!1);c===c.next&&(c.steiner=!0),i.push(s2(c))}i.sort(QS);for(let s=0;s<i.length;s++)e=t2(i[s],e);return e}function QS(n,t){let e=n.x-t.x;if(e===0&&(e=n.y-t.y,e===0)){const r=(n.next.y-n.y)/(n.next.x-n.x),i=(t.next.y-t.y)/(t.next.x-t.x);e=r-i}return e}function t2(n,t){const e=e2(n,t);if(!e)return t;const r=Bm(e,n);return zi(r,r.next),zi(e,e.next)}function e2(n,t){let e=t;const r=n.x,i=n.y;let s=-1/0,o;if(Is(n,e))return e;do{if(Is(n,e.next))return e.next;if(i<=e.y&&i>=e.next.y&&e.next.y!==e.y){const f=e.x+(i-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(f<=r&&f>s&&(s=f,o=e.x<e.next.x?e:e.next,f===r))return o}e=e.next}while(e!==t);if(!o)return null;const a=o,l=o.x,c=o.y;let h=1/0;e=o;do{if(r>=e.x&&e.x>=l&&r!==e.x&&Vm(i<c?r:s,i,l,c,i<c?s:r,i,e.x,e.y)){const f=Math.abs(i-e.y)/(r-e.x);Po(e,n)&&(f<h||f===h&&(e.x>o.x||e.x===o.x&&r2(o,e)))&&(o=e,h=f)}e=e.next}while(e!==a);return o}function r2(n,t){return he(n.prev,n,t.prev)<0&&he(t.next,n,n.next)<0}function n2(n,t,e,r){let i=n;do i.z===0&&(i.z=ch(i.x,i.y,t,e,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==n);i.prevZ.nextZ=null,i.prevZ=null,i2(i)}function i2(n){let t,e=1;do{let r=n,i;n=null;let s=null;for(t=0;r;){t++;let o=r,a=0;for(let c=0;c<e&&(a++,o=o.nextZ,!!o);c++);let l=e;for(;a>0||l>0&&o;)a!==0&&(l===0||!o||r.z<=o.z)?(i=r,r=r.nextZ,a--):(i=o,o=o.nextZ,l--),s?s.nextZ=i:n=i,i.prevZ=s,s=i;r=o}s.nextZ=null,e*=2}while(t>1);return n}function ch(n,t,e,r,i){return n=(n-e)*i|0,t=(t-r)*i|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,n|t<<1}function s2(n){let t=n,e=n;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==n);return e}function Vm(n,t,e,r,i,s,o,a){return(i-o)*(t-a)>=(n-o)*(s-a)&&(n-o)*(r-a)>=(e-o)*(t-a)&&(e-o)*(s-a)>=(i-o)*(r-a)}function ko(n,t,e,r,i,s,o,a){return!(n===o&&t===a)&&Vm(n,t,e,r,i,s,o,a)}function o2(n,t){return n.next.i!==t.i&&n.prev.i!==t.i&&!a2(n,t)&&(Po(n,t)&&Po(t,n)&&u2(n,t)&&(he(n.prev,n,t.prev)||he(n,t.prev,t))||Is(n,t)&&he(n.prev,n,n.next)>0&&he(t.prev,t,t.next)>0)}function he(n,t,e){return(t.y-n.y)*(e.x-t.x)-(t.x-n.x)*(e.y-t.y)}function Is(n,t){return n.x===t.x&&n.y===t.y}function Dm(n,t,e,r){const i=yu(he(n,t,e)),s=yu(he(n,t,r)),o=yu(he(e,r,n)),a=yu(he(e,r,t));return!!(i!==s&&o!==a||i===0&&mu(n,e,t)||s===0&&mu(n,r,t)||o===0&&mu(e,n,r)||a===0&&mu(e,t,r))}function mu(n,t,e){return t.x<=Math.max(n.x,e.x)&&t.x>=Math.min(n.x,e.x)&&t.y<=Math.max(n.y,e.y)&&t.y>=Math.min(n.y,e.y)}function yu(n){return n>0?1:n<0?-1:0}function a2(n,t){let e=n;do{if(e.i!==n.i&&e.next.i!==n.i&&e.i!==t.i&&e.next.i!==t.i&&Dm(e,e.next,n,t))return!0;e=e.next}while(e!==n);return!1}function Po(n,t){return he(n.prev,n,n.next)<0?he(n,t,n.next)>=0&&he(n,n.prev,t)>=0:he(n,t,n.prev)<0||he(n,n.next,t)<0}function u2(n,t){let e=n,r=!1;const i=(n.x+t.x)/2,s=(n.y+t.y)/2;do e.y>s!=e.next.y>s&&e.next.y!==e.y&&i<(e.next.x-e.x)*(s-e.y)/(e.next.y-e.y)+e.x&&(r=!r),e=e.next;while(e!==n);return r}function Bm(n,t){const e=hh(n.i,n.x,n.y),r=hh(t.i,t.x,t.y),i=n.next,s=t.prev;return n.next=t,t.prev=n,e.next=i,i.prev=e,r.next=e,e.prev=r,s.next=r,r.prev=s,r}function qm(n,t,e,r){const i=hh(n,t,e);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Ro(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function hh(n,t,e){return{i:n,x:t,y:e,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function l2(n,t,e,r){let i=0;for(let s=t,o=e-r;s<e;s+=r)i+=(n[o]-n[s])*(n[s+1]+n[o+1]),o=s;return i}class c2{static triangulate(t,e,r=2){return US(t,e,r)}}class Lo{static area(t){const e=t.length;let r=0;for(let i=e-1,s=0;s<e;i=s++)r+=t[i].x*t[s].y-t[s].x*t[i].y;return r*.5}static isClockWise(t){return Lo.area(t)<0}static triangulateShape(t,e){const r=[],i=[],s=[];$m(t),Hm(r,t);let o=t.length;e.forEach($m);for(let l=0;l<e.length;l++)i.push(o),o+=e[l].length,Hm(r,e[l]);const a=c2.triangulate(r,i);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}}function $m(n){const t=n.length;t>2&&n[t-1].equals(n[0])&&n.pop()}function Hm(n,t){for(let e=0;e<t.length;e++)n.push(t[e].x),n.push(t[e].y)}class fh extends Ai{constructor(t=new lh([new Et(0,.5),new Et(-.5,-.5),new Et(.5,-.5)]),e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};const r=[],i=[],s=[],o=[];let a=0,l=0;if(Array.isArray(t)===!1)c(t);else for(let h=0;h<t.length;h++)c(t[h]),this.addGroup(a,l,h),a+=l,l=0;this.setIndex(r),this.setAttribute("position",new jn(i,3)),this.setAttribute("normal",new jn(s,3)),this.setAttribute("uv",new jn(o,2));function c(h){const f=i.length/3,g=h.extractPoints(e);let p=g.shape;const m=g.holes;Lo.isClockWise(p)===!1&&(p=p.reverse());for(let _=0,S=m.length;_<S;_++){const M=m[_];Lo.isClockWise(M)===!0&&(m[_]=M.reverse())}const v=Lo.triangulateShape(p,m);for(let _=0,S=m.length;_<S;_++){const M=m[_];p=p.concat(M)}for(let _=0,S=p.length;_<S;_++){const M=p[_];i.push(M.x,M.y,0),s.push(0,0,1),o.push(M.x,M.y)}for(let _=0,S=v.length;_<S;_++){const M=v[_],T=M[0]+f,C=M[1]+f,E=M[2]+f;r.push(T,C,E),l+=3}}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON(),e=this.parameters.shapes;return h2(e,t)}static fromJSON(t,e){const r=[];for(let i=0,s=t.shapes.length;i<s;i++){const o=e[t.shapes[i]];r.push(o)}return new fh(r,t.curveSegments)}}function h2(n,t){if(t.shapes=[],Array.isArray(n))for(let e=0,r=n.length;e<r;e++){const i=n[e];t.shapes.push(i.uuid)}else t.shapes.push(n.uuid);return t}class f2 extends Om{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Mi(16777215),this.specular=new Mi(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Mi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=cS,this.normalScale=new Et(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ws,this.combine=nm,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}const dh={enabled:!1,files:{},add:function(n,t){this.enabled!==!1&&(this.files[n]=t)},get:function(n){if(this.enabled!==!1)return this.files[n]},remove:function(n){delete this.files[n]},clear:function(){this.files={}}};class d2{constructor(t,e,r){const i=this;let s=!1,o=0,a=0,l;const c=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=r,this.abortController=new AbortController,this.itemStart=function(h){a++,s===!1&&i.onStart!==void 0&&i.onStart(h,o,a),s=!0},this.itemEnd=function(h){o++,i.onProgress!==void 0&&i.onProgress(h,o,a),o===a&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(h){i.onError!==void 0&&i.onError(h)},this.resolveURL=function(h){return l?l(h):h},this.setURLModifier=function(h){return l=h,this},this.addHandler=function(h,f){return c.push(h,f),this},this.removeHandler=function(h){const f=c.indexOf(h);return f!==-1&&c.splice(f,2),this},this.getHandler=function(h){for(let f=0,g=c.length;f<g;f+=2){const p=c[f],m=c[f+1];if(p.global&&(p.lastIndex=0),p.test(h))return m}return null},this.abort=function(){return this.abortController.abort(),this.abortController=new AbortController,this}}}const p2=new d2;class ph{constructor(t){this.manager=t!==void 0?t:p2,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const r=this;return new Promise(function(i,s){r.load(t,i,e,s)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}abort(){return this}}ph.DEFAULT_MATERIAL_NAME="__DEFAULT";const ks=new WeakMap;class g2 extends ph{constructor(t){super(t)}load(t,e,r,i){this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const s=this,o=dh.get(`image:${t}`);if(o!==void 0){if(o.complete===!0)s.manager.itemStart(t),setTimeout(function(){e&&e(o),s.manager.itemEnd(t)},0);else{let f=ks.get(o);f===void 0&&(f=[],ks.set(o,f)),f.push({onLoad:e,onError:i})}return o}const a=Vc("img");function l(){h(),e&&e(this);const f=ks.get(this)||[];for(let g=0;g<f.length;g++){const p=f[g];p.onLoad&&p.onLoad(this)}ks.delete(this),s.manager.itemEnd(t)}function c(f){h(),i&&i(f),dh.remove(`image:${t}`);const g=ks.get(this)||[];for(let p=0;p<g.length;p++){const m=g[p];m.onError&&m.onError(f)}ks.delete(this),s.manager.itemError(t),s.manager.itemEnd(t)}function h(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),t.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),dh.add(`image:${t}`,a),s.manager.itemStart(t),a.src=t,a}}class Gm extends ph{constructor(t){super(t)}load(t,e,r,i){const s=new ti,o=new g2(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(t,function(a){s.image=a,s.needsUpdate=!0,e!==void 0&&e(s)},r,i),s}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Zg}})),typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Zg);class m2{constructor(t=un){Vt(this,"elements");Vt(this,"categories");Vt(this,"propertyTypes");Vt(this,"unit");this.elements={},this.categories={root:{name:"root",label:"/",elements:[],categories:[]}},this.propertyTypes={},this.unit=t,this.registerMultiplePropertyType([["color",qg,qg],["enum",$g,$g],["string",Hg,Hg],["number",Gg,Gg],["length-measure",Wg,Wg],["toggle",Ug,Ug],["checkbox",Yg,Yg],["hidden",Xg,Xg],["read-only",Jg,Jg]])}getElement(t){if(this.hasElement(t))return this.elements[t];throw new Error(`Element ${t} does not exist in catalog`)}getCategory(t){if(this.hasCategory(t))return this.categories[t];throw new Error(`Category ${t} does not exist in catalog`)}getPropertyType(t){if(this.propertyTypes.hasOwnProperty(t))return this.propertyTypes[t];throw new Error(`Element ${t} does not exist in catalog`)}registerElement(t){t.properties=t.properties||{},this.validateElement(t)&&(this.elements[t.name]=t,this.categories.root.elements.push(this.elements[t.name]))}registerMultipleElements(t){t.forEach(e=>this.registerElement(e))}registerPropertyType(t,e,r){this.propertyTypes[t]={type:t,Viewer:e,Editor:r}}registerMultiplePropertyType(t){t.forEach(e=>this.registerPropertyType(...e))}validateElement(t){if(!t.hasOwnProperty("name"))throw new Error("Element not valid");let e=t.name;if(!t.hasOwnProperty("prototype"))throw new Error(`Element ${e} doesn't have prototype`);if(!t.hasOwnProperty("info"))throw new Error(`Element ${e} doesn't have info`);if(!t.info.hasOwnProperty("tag"))throw new Error(`Element ${e} doesn't have tag`);if(!t.info.hasOwnProperty("description"))throw new Error(`Element ${e} doesn't have description`);if(!t.info.hasOwnProperty("image"))throw new Error(`Element ${e} doesn't have image`);if(!t.hasOwnProperty("render2D"))throw new Error(`Element ${e} doesn't have render2D handler`);if(!t.hasOwnProperty("render3D"))throw new Error(`Element ${e} doesn't have render3D handler`);if(!t.hasOwnProperty("properties"))throw new Error(`Element ${e} doesn't have properties`);for(let r in t.properties){let i=t.properties[r];if(!i.hasOwnProperty("type"))throw new Error(`Element ${e}, Property ${r} doesn't have type`);if(!i.hasOwnProperty("defaultValue"))throw new Error(`Element ${e}, Property ${r} doesn't have defaultValue`)}return!0}hasElement(t){return this.elements.hasOwnProperty(t)}registerCategory(t,e,r){return this.validateCategory(t,e)?(this.categories[t]={name:t,label:e,categories:[],elements:[]},this.categories.root.categories.push(this.categories[t]),r&&r.length&&r.forEach(i=>this.addToCategory(t,i)),this.categories[t]):null}addToCategory(t,e){if(this.hasElement(e.name))this.categories[t].elements.push(e),this.categories.root.elements.splice(this.categories.root.elements.indexOf(e),1);else if(this.hasCategory(e.name))this.categories[t].categories.push(e),this.categories.root.categories.splice(this.categories.root.categories.indexOf(e),1);else throw new Error(`child ${e} is either category nor element`)}categoryHasElement(t,e){return this.hasCategory(t)&&this.categories[t].elements.some(r=>r.name===e)}validateCategory(t,e){if(!t)throw new Error("Category has undefined name");if(t==="")throw new Error("Category has empty name");if(this.hasCategory(t))throw new Error("Category has already been registered");return!0}hasCategory(t){return this.categories.hasOwnProperty(t)}}function y2(n){return ge({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M10 18a7.952 7.952 0 0 0 4.897-1.688l4.396 4.396 1.414-1.414-4.396-4.396A7.952 7.952 0 0 0 18 10c0-4.411-3.589-8-8-8s-8 3.589-8 8 3.589 8 8 8zm0-14c3.309 0 6 2.691 6 6s-2.691 6-6 6-6-2.691-6-6 2.691-6 6-6z"},child:[]}]})(n)}const v2=({term:n="",placeholder:t="Search",noSpacing:e=!1,onClick:r=()=>!1,isStatic:i=!1,hasDropDown:s=!1,onSearch:o})=>{const[a,l]=N.useState("");return w.jsxs("div",{className:`relative w-full ${e?"mt-1":"mt-2"}`,onClick:r??(()=>!1),children:[w.jsx("span",{className:`absolute left-0 top-2 text-[#637381] ${e?"":"ml-2"}`,style:{zIndex:2},children:w.jsx(y2,{size:18})}),i?w.jsx("div",{className:"w-full rounded border border-gray-300 bg-white px-3 py-1.5 text-xs font-normal cursor-pointer",style:{marginTop:3},children:n}):w.jsx("input",{className:"w-full rounded pl-[30px] focus:outline-none border border-gray-300 bg-white pr-3 py-1.5 text-sm text-gray-900",type:"text",placeholder:t,onChange:c=>{o(c.target.value,c),l(c.target.value)},value:a,onClick:r??(()=>!1)}),r!==null&&s&&w.jsx("span",{className:`absolute right-2 top-1/2 -translate-y-1/2 ${e?"":"ml-2"}`,style:{zIndex:1},children:w.jsx(L1,{className:"-mb-1"})})]})},Wm=8,Um=40,x2=({catalog:n,popupEvent:t,onClose:e})=>{const{selectToolDrawingLine:r,selectToolDrawingItem:i,selectToolDrawingHole:s,pushLastSelectedCatalogElementToHistory:o}=ne(),[a,l]=N.useState([]),[c,h]=N.useState(""),f=N.useRef(null),g=N.useRef(null);N.useEffect(()=>{if(t){const _=n.getCategory(t.page).elements.filter(T=>T.info.visibility?T.info.visibility.catalog:!0);f.current=t.page,l(_);const{x:S,y:M}=t.rect;g.current={top:M+Wm,left:S+Um}}},[t]);const p=()=>{e()},m=v=>{p(),setTimeout(()=>{switch(v.prototype){case"lines":r(v.name);break;case"items":i(v.name);break;case"holes":s(v.name);break}o(v)},0)};return w.jsxs(w.Fragment,{children:[t&&w.jsx("div",{className:"fixed inset-0 bg-black/30 z-10",onClick:p}),w.jsxs("div",{style:t&&t.rect?{top:t.rect.y+Wm,left:t.rect.x+Um}:g.current?g.current:{},className:mn("fixed select-none z-10 shadow-md !gap-0 rounded-lg pt-5 fp_side-bar !min-h-[250px] !max-h-[510px] transition-all duration-200 ease-out transform",t?"opacity-100 scale-100":"opacity-0 scale-95 pointer-events-none"),children:[w.jsxs("header",{className:"px-[18px] sticky top-0 left-0 gap-3 flex flex-col",children:[w.jsx("div",{className:"flex items-center gap-1",children:w.jsx("span",{className:mn("flex flex-col gap-0.5"),children:w.jsx("span",{className:"fp-sidebar-label capitalize",children:(t==null?void 0:t.page)??f.current})})}),w.jsx("div",{className:mn("fp-highlight"),children:w.jsx(v2,{placeholder:"Search",onSearch:(v,_)=>{_.preventDefault(),_.stopPropagation(),h(v)}})})]}),w.jsx("div",{className:"grid grid-cols-2 gap-x-4 gap-y-6 pb-5 overflow-auto w-full pt-[18px] px-4",onWheel:v=>v.stopPropagation(),children:a.filter(v=>v.info.title.toLowerCase().includes(c.toLowerCase())).length>0?a.filter(v=>v.info.title.toLowerCase().includes(c.toLowerCase())).map(v=>w.jsxs("div",{className:"w-full space-y-1.5",children:[w.jsx("div",{className:"fp-aspect-ratio-container",children:w.jsx("div",{className:"fp-aspect-ratio-content",onMouseDown:()=>m(v),children:w.jsx("img",{draggable:!1,className:"fp-item-image",alt:v.info.title,src:v.info.image})})}),w.jsx("p",{className:"text-xs font-semibold capitalize",children:v.info.description})]},v.name.replace(/\s+/g,"_"))):w.jsx("div",{className:"h-full w-full flex items-center justify-center",children:w.jsx("p",{className:"absolute left-1/2 translate-x-[-50%] top-40 text-sm font-medium text-gray-400 text-center",children:"No records found"})})})]})]})};function _2(n){return ge({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M320 32c0-9.9-4.5-19.2-12.3-25.2S289.8-1.4 280.2 1l-179.9 45C79 51.3 64 70.5 64 92.5L64 448l-32 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l64 0 192 0 32 0 0-32 0-448zM256 256c0 17.7-10.7 32-24 32s-24-14.3-24-32s10.7-32 24-32s24 14.3 24 32zm96-128l96 0 0 352c0 17.7 14.3 32 32 32l64 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-32 0 0-320c0-35.3-28.7-64-64-64l-96 0 0 64z"},child:[]}]})(n)}function b2(n){return ge({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M112 73c-13.75 0-24.214 4.87-33.047 13.271-8.832 8.402-15.755 20.6-20.414 34.575-5.887 17.661-7.953 38.064-6.887 56.111a57.246 57.246 0 0 1 2.461-.187c8.38-.405 16.317 1.094 23.494 4.234 14.355 6.28 25.436 18.27 34.057 32.28 15.104 24.543 23.187 55.746 24.96 80.585 114.097-14.223 124.655-14.223 238.753 0 1.772-24.84 9.855-56.042 24.959-80.586 8.62-14.009 19.702-25.999 34.057-32.28 7.875-3.444 16.67-4.898 25.955-4.046 1.066-18.047-1-38.45-6.887-56.111-4.659-13.976-11.582-26.173-20.414-34.575C424.214 77.87 413.75 73 400 73zM56.969 194.502c-.686-.008-1.38.006-2.082.04-5.621.284-11.8 1.978-18.862 5.509-23.413 11.707-26.349 65.687 14.82 79.41l4.505 1.502L86.79 391h338.42l31.44-110.037 4.504-1.502c41.17-13.723 38.234-67.703 14.82-79.41-14.121-7.061-24.722-6.775-34.367-2.555-9.645 4.22-18.564 13.23-25.943 25.22C400.906 246.7 393 282 393 304v10.195l-10.117-1.265c-128-16-125.766-16-253.766 0L119 314.195V304c0-22-7.906-57.3-22.664-81.283-7.38-11.991-16.298-21.001-25.943-25.22-4.22-1.847-8.624-2.94-13.424-2.995zM83.727 409l-23.272 23.271c11.994 3.239 33.75 3.763 42.545-1.666 3.272-4.695 6.903-14.536 10.438-21.605zm314.836 0c1.494 6.017 6.952 19.12 10.437 21.605 13.2 5.463 29.904 5.774 42.545 1.666L428.273 409z"},child:[]}]})(n)}function w2({catalog:n}){const{planner:t,selectTool3DView:e,setMode:r,selectTool3DFirstPerson:i,selectToolDrawingLine:s}=ne(),{mode:o,alterate:a}=t,[l,c]=N.useState(null);return w.jsxs(w.Fragment,{children:[w.jsxs("aside",{className:"floor_planner-toolbar max-h-full max-w-[50px] p-2.5 space-y-4 bg-[#2b2b2b]",children:[w.jsx(In,{active:[Lr,or].includes(o),tooltip:"Draw wall",onClick:()=>s("wall"),children:w.jsx(Qw,{})}),w.jsx(In,{active:!!([ar].includes(o)&&l&&l.page==="windows"),tooltip:"Place windows",onClick:h=>{c({rect:h.currentTarget.getBoundingClientRect(),page:"windows"})},children:w.jsx(K1,{size:26})}),w.jsx(In,{active:!!([ar].includes(o)&&l&&l.page==="doors"),tooltip:"Place doors",onClick:h=>{c({rect:h.currentTarget.getBoundingClientRect(),page:"doors"})},children:w.jsx(_2,{size:26})}),w.jsx(In,{active:!!([Sr].includes(o)&&l&&l.page==="objects"),tooltip:"Place objects",onClick:h=>{c({rect:h.currentTarget.getBoundingClientRect(),page:"objects"})},children:w.jsx(b2,{size:26})}),w.jsx(Kw,{mode:o})]}),w.jsx(x2,{catalog:n,popupEvent:l,onClose:()=>c(null)})]})}const Fo=window.hasOwnProperty("localStorage")?window.localStorage:!1,S2=500;let gh=null;function E2(n,t){return(e,r,i)=>{let s;if(t=t||S2,!!n&&Fo){if(r){e.setPlan(r);const o=r.floors[0].floorDesign;s=JSON.parse(o)}else if(Fo.getItem(n)!==null){const o=Fo.getItem(n);s=JSON.parse(o)}s&&e.loadProject(s),ne.subscribe(o=>{gh&&clearTimeout(gh),gh=setTimeout(()=>{const a=Fo.getItem(n),l=JSON.stringify(o.planner.scene.toJS());if(a!==l&&(Fo.setItem(n,l),o.plan))try{const c=o.plan.floors[o.activeFloor];i&&i({floor:{floorID:c.floorID,title:c.floorTitle,description:c.floorDescription,design:l}})}catch{}},t)})}}}function M2(){return n=>{window.addEventListener("keydown",t=>{const e=n.planner,r=e.get("mode");switch(t.keyCode){case Er.BACKSPACE:case Er.DELETE:{[fe,Qi,vi].includes(r)&&n.remove();break}case Er.ESC:{n.rollback();break}case Er.Z:{(t.getModifierState("Control")||t.getModifierState("Meta"))&&(t.getModifierState("Shift")?n.redo():n.undo());break}case Er.ALT:{Tl.includes(r)&&n.toggleSnap(e.snapMask.merge({SNAP_POINT:!1,SNAP_LINE:!1,SNAP_SEGMENT:!1,SNAP_GRID:!1,SNAP_GUIDE:!1,tempSnapConfiguartion:e.snapMask.toJS()}));break}case Er.C:{let i=e.getIn(["scene","selectedLayer"]),s=e.getIn(["scene","layers",i,"selected"]);if((r===fe||r===vi)&&(s.holes.size||s.areas.size||s.items.size||s.lines.size)){if(s.holes.size){let o=e.getIn(["scene","layers",i,"holes",s.holes.get(0)]);n.copyProperties(o.get("properties"))}else if(s.areas.size){const o=e.getIn(["scene","layers",i,"areas",s.areas.get(0)]);n.copyProperties(o.properties)}else if(s.items.size){const o=e.getIn(["scene","layers",i,"items",s.items.get(0)]);n.copyProperties(o.properties)}else if(s.lines.size){const o=e.getIn(["scene","layers",i,"lines",s.lines.get(0)]);n.copyProperties(o.properties)}}break}case Er.V:{n.pasteProperties();break}case Er.CTRL:{n.setAlterateState();break}}}),window.addEventListener("keyup",t=>{const e=n.planner,r=e.get("mode");switch(t.keyCode){case Er.ALT:{Tl.includes(r)&&n.toggleSnap(e.snapMask.merge(e.snapMask.get("tempSnapConfiguartion")));break}case Er.CTRL:{n.setAlterateState();break}}})}}const A2=({onBack:n,onSave:t})=>{const{undo:e,redo:r,plan:i,setPlan:s}=ne(),[o,a]=N.useState(!1),l=()=>{a(!0)},c=h=>{if(!i)return;a(!1);const f=h.target.value.trim();if(f&&f!==(i==null?void 0:i.planTitle)){s({...i,planTitle:f});try{t&&t({title:f,description:""})}catch{}}};return w.jsxs("div",{className:"floor_planner-headerbar border-b border-b-[#5e5e5e] absolute flex items-center justify-between z-[9001] py-[3px] px-[1em] text-xs bg-[#2b2b2b] w-full select-none cursor-default top-0 leading-[14px] text-white m-0",children:[w.jsx(In,{className:"border border-white rounded -ml-1",active:!1,tooltip:"Go Back",onClick:()=>{n&&n()},children:w.jsx(pg,{})}),w.jsx("div",{className:"flex flex-col items-center justify-center",children:o?w.jsx("input",{autoFocus:!0,type:"text",defaultValue:i==null?void 0:i.planTitle,onBlur:c,onKeyDown:h=>{(h.key==="Enter"||h.key==="Escape")&&c(h)},className:"bg-transparent border-b border-gray-400 outline-none text-lg text-center"}):w.jsx("span",{onDoubleClick:l,className:"projectName__fp text-lg",title:(i==null?void 0:i.planTitle)??"Example House",children:(i==null?void 0:i.planTitle)??"Example House"})}),w.jsxs("div",{className:"flex items-center gap-2 relative right-40",children:[w.jsx(In,{active:!1,tooltip:"Undo (CTRL-Z)",onClick:e,children:w.jsx(J1,{})}),w.jsx(In,{active:!1,tooltip:"Redo (CTRL-SHIFT-Z)",onClick:r,children:w.jsx(X1,{})})]})]})};var mh={exports:{}},Ym;function Xm(){if(Ym)return mh.exports;Ym=1;var n=mh.exports={};return n.forEach=function(t,e){for(var r=0;r<t.length;r++){var i=e(t[r]);if(i)return i}},mh.exports}var yh,Jm;function O2(){return Jm||(Jm=1,yh=function(n){var t=n.stateHandler.getState;function e(o){var a=t(o);return a&&!!a.isDetectable}function r(o){t(o).isDetectable=!0}function i(o){return!!t(o).busy}function s(o,a){t(o).busy=!!a}return{isDetectable:e,markAsDetectable:r,isBusy:i,markBusy:s}}),yh}var vh,Zm;function z2(){return Zm||(Zm=1,vh=function(n){var t={};function e(o){var a=n.get(o);return a===void 0?[]:t[a]||[]}function r(o,a){var l=n.get(o);t[l]||(t[l]=[]),t[l].push(a)}function i(o,a){for(var l=e(o),c=0,h=l.length;c<h;++c)if(l[c]===a){l.splice(c,1);break}}function s(o){var a=e(o);a&&(a.length=0)}return{get:e,add:r,removeListener:i,removeAllListeners:s}}),vh}var xh,Km;function T2(){return Km||(Km=1,xh=function(){var n=1;function t(){return n++}return{generate:t}}),xh}var _h,Qm;function C2(){return Qm||(Qm=1,_h=function(n){var t=n.idGenerator,e=n.stateHandler.getState;function r(s){var o=e(s);return o&&o.id!==void 0?o.id:null}function i(s){var o=e(s);if(!o)throw new Error("setId required the element to have a resize detection state.");var a=t.generate();return o.id=a,a}return{get:r,set:i}}),_h}var bh,ty;function I2(){return ty||(ty=1,bh=function(n){function t(){}var e={log:t,warn:t,error:t};if(!n&&window.console){var r=function(i,s){i[s]=function(){var a=console[s];if(a.apply)a.apply(console,arguments);else for(var l=0;l<arguments.length;l++)a(arguments[l])}};r(e,"log"),r(e,"warn"),r(e,"error")}return e}),bh}var wh={exports:{}},ey;function ry(){if(ey)return wh.exports;ey=1;var n=wh.exports={};return n.isIE=function(t){function e(){var i=navigator.userAgent.toLowerCase();return i.indexOf("msie")!==-1||i.indexOf("trident")!==-1||i.indexOf(" edge/")!==-1}if(!e())return!1;if(!t)return!0;var r=function(){var i,s=3,o=document.createElement("div"),a=o.getElementsByTagName("i");do o.innerHTML="<!--[if gt IE "+ ++s+"]><i></i><![endif]-->";while(a[0]);return s>4?s:i}();return t===r},n.isLegacyOpera=function(){return!!window.opera},wh.exports}var Sh={exports:{}},ny;function k2(){if(ny)return Sh.exports;ny=1;var n=Sh.exports={};n.getOption=t;function t(e,r,i){var s=e[r];return s==null&&i!==void 0?i:s}return Sh.exports}var Eh,iy;function P2(){if(iy)return Eh;iy=1;var n=k2();Eh=function(r){r=r||{};var i=r.reporter,s=n.getOption(r,"async",!0),o=n.getOption(r,"auto",!0);o&&!s&&(i&&i.warn("Invalid options combination. auto=true and async=false is invalid. Setting async=true."),s=!0);var a=t(),l,c=!1;function h(_,S){!c&&o&&s&&a.size()===0&&p(),a.add(_,S)}function f(){for(c=!0;a.size();){var _=a;a=t(),_.process()}c=!1}function g(_){c||(_===void 0&&(_=s),l&&(m(l),l=null),_?p():f())}function p(){l=v(f)}function m(_){var S=clearTimeout;return S(_)}function v(_){var S=function(M){return setTimeout(M,0)};return S(_)}return{add:h,force:g}};function t(){var e={},r=0,i=0,s=0;function o(c,h){h||(h=c,c=0),c>i?i=c:c<s&&(s=c),e[c]||(e[c]=[]),e[c].push(h),r++}function a(){for(var c=s;c<=i;c++)for(var h=e[c],f=0;f<h.length;f++){var g=h[f];g()}}function l(){return r}return{add:o,process:a,size:l}}return Eh}var Mh,sy;function R2(){if(sy)return Mh;sy=1;var n="_erd";function t(i){return i[n]={},e(i)}function e(i){return i[n]}function r(i){delete i[n]}return Mh={initState:t,getState:e,cleanState:r},Mh}var Ah,oy;function L2(){if(oy)return Ah;oy=1;var n=ry();return Ah=function(t){t=t||{};var e=t.reporter,r=t.batchProcessor,i=t.stateHandler.getState;if(!e)throw new Error("Missing required dependency: reporter.");function s(h,f){function g(){f(h)}if(n.isIE(8))i(h).object={proxy:g},h.attachEvent("onresize",g);else{var p=l(h);if(!p)throw new Error("Element is not detectable by this strategy.");p.contentDocument.defaultView.addEventListener("resize",g)}}function o(h){var f=t.important?" !important; ":"; ";return(h.join(f)+f).trim()}function a(h,f,g){g||(g=f,f=h,h=null),h=h||{},h.debug;function p(m,v){var _=o(["display: block","position: absolute","top: 0","left: 0","width: 100%","height: 100%","border: none","padding: 0","margin: 0","opacity: 0","z-index: -1000","pointer-events: none"]),S=!1,M=window.getComputedStyle(m),T=m.offsetWidth,C=m.offsetHeight;i(m).startSize={width:T,height:C};function E(){function z(){if(M.position==="static"){m.style.setProperty("position","relative",h.important?"important":"");var L=function(X,J,at,tt){function bt(yt){return yt.replace(/[^-\d\.]/g,"")}var xt=at[tt];xt!=="auto"&&bt(xt)!=="0"&&(X.warn("An element that is positioned static has style."+tt+"="+xt+" which is ignored due to the static positioning. The element will need to be positioned relative, so the style."+tt+" will be set to 0. Element: ",J),J.style.setProperty(tt,"0",h.important?"important":""))};L(e,m,M,"top"),L(e,m,M,"right"),L(e,m,M,"bottom"),L(e,m,M,"left")}}function R(){S||z();function L(J,at){if(!J.contentDocument){var tt=i(J);tt.checkForObjectDocumentTimeoutId&&window.clearTimeout(tt.checkForObjectDocumentTimeoutId),tt.checkForObjectDocumentTimeoutId=setTimeout(function(){tt.checkForObjectDocumentTimeoutId=0,L(J,at)},100);return}at(J.contentDocument)}var X=this;L(X,function(at){v(m)})}M.position!==""&&(z(),S=!0);var k=document.createElement("object");k.style.cssText=_,k.tabIndex=-1,k.type="text/html",k.setAttribute("aria-hidden","true"),k.onload=R,n.isIE()||(k.data="about:blank"),i(m)&&(m.appendChild(k),i(m).object=k,n.isIE()&&(k.data="about:blank"))}r?r.add(E):E()}n.isIE(8)?g(f):p(f,g)}function l(h){return i(h).object}function c(h){if(i(h)){var f=l(h);f&&(n.isIE(8)?h.detachEvent("onresize",f.proxy):h.removeChild(f),i(h).checkForObjectDocumentTimeoutId&&window.clearTimeout(i(h).checkForObjectDocumentTimeoutId),delete i(h).object)}}return{makeDetectable:a,addListener:s,uninstall:c}},Ah}var Oh,ay;function F2(){if(ay)return Oh;ay=1;var n=Xm().forEach;return Oh=function(t){t=t||{};var e=t.reporter,r=t.batchProcessor,i=t.stateHandler.getState;t.stateHandler.hasState;var s=t.idHandler;if(!r)throw new Error("Missing required dependency: batchProcessor");if(!e)throw new Error("Missing required dependency: reporter.");var o=f(),a="erd_scroll_detection_scrollbar_style",l="erd_scroll_detection_container";function c(E){g(E,a,l)}c(window.document);function h(E){var z=t.important?" !important; ":"; ";return(E.join(z)+z).trim()}function f(){var E=500,z=500,R=document.createElement("div");R.style.cssText=h(["position: absolute","width: "+E*2+"px","height: "+z*2+"px","visibility: hidden","margin: 0","padding: 0"]);var k=document.createElement("div");k.style.cssText=h(["position: absolute","width: "+E+"px","height: "+z+"px","overflow: scroll","visibility: none","top: "+-E*3+"px","left: "+-z*3+"px","visibility: hidden","margin: 0","padding: 0"]),k.appendChild(R),document.body.insertBefore(k,document.body.firstChild);var L=E-k.clientWidth,X=z-k.clientHeight;return document.body.removeChild(k),{width:L,height:X}}function g(E,z,R){function k(at,tt){tt=tt||function(xt){E.head.appendChild(xt)};var bt=E.createElement("style");return bt.innerHTML=at,bt.id=z,tt(bt),bt}if(!E.getElementById(z)){var L=R+"_animation",X=R+"_animation_active",J=`/* Created by the element-resize-detector library. */
83
+ `;J+="."+R+" > div::-webkit-scrollbar { "+h(["display: none"])+` }
84
+
85
+ `,J+="."+X+" { "+h(["-webkit-animation-duration: 0.1s","animation-duration: 0.1s","-webkit-animation-name: "+L,"animation-name: "+L])+` }
86
+ `,J+="@-webkit-keyframes "+L+` { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }
87
+ `,J+="@keyframes "+L+" { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }",k(J)}}function p(E){E.className+=" "+l+"_animation_active"}function m(E,z,R){if(E.addEventListener)E.addEventListener(z,R);else if(E.attachEvent)E.attachEvent("on"+z,R);else return e.error("[scroll] Don't know how to add event listeners.")}function v(E,z,R){if(E.removeEventListener)E.removeEventListener(z,R);else if(E.detachEvent)E.detachEvent("on"+z,R);else return e.error("[scroll] Don't know how to remove event listeners.")}function _(E){return i(E).container.childNodes[0].childNodes[0].childNodes[0]}function S(E){return i(E).container.childNodes[0].childNodes[0].childNodes[1]}function M(E,z){var R=i(E).listeners;if(!R.push)throw new Error("Cannot add listener to an element that is not detectable.");i(E).listeners.push(z)}function T(E,z,R){R||(R=z,z=E,E=null),E=E||{};function k(){if(E.debug){var B=Array.prototype.slice.call(arguments);if(B.unshift(s.get(z),"Scroll: "),e.log.apply)e.log.apply(null,B);else for(var pt=0;pt<B.length;pt++)e.log(B[pt])}}function L(B){function pt(H){var Ot=H.getRootNode&&H.getRootNode().contains(H);return H===H.ownerDocument.body||H.ownerDocument.body.contains(H)||Ot}return!pt(B)||window.getComputedStyle(B)===null}function X(B){var pt=i(B).container.childNodes[0],H=window.getComputedStyle(pt);return!H.width||H.width.indexOf("px")===-1}function J(){var B=window.getComputedStyle(z),pt={};return pt.position=B.position,pt.width=z.offsetWidth,pt.height=z.offsetHeight,pt.top=B.top,pt.right=B.right,pt.bottom=B.bottom,pt.left=B.left,pt.widthCSS=B.width,pt.heightCSS=B.height,pt}function at(){var B=J();i(z).startSize={width:B.width,height:B.height},k("Element start size",i(z).startSize)}function tt(){i(z).listeners=[]}function bt(){if(k("storeStyle invoked."),!i(z)){k("Aborting because element has been uninstalled");return}var B=J();i(z).style=B}function xt(B,pt,H){i(B).lastWidth=pt,i(B).lastHeight=H}function yt(B){return _(B).childNodes[0]}function ht(){return 2*o.width+1}function Y(){return 2*o.height+1}function St(B){return B+10+ht()}function j(B){return B+10+Y()}function W(B){return B*2+ht()}function ft(B){return B*2+Y()}function et(B,pt,H){var Ot=_(B),Bt=S(B),kt=St(pt),Ct=j(H),Gt=W(pt),gt=ft(H);Ot.scrollLeft=kt,Ot.scrollTop=Ct,Bt.scrollLeft=Gt,Bt.scrollTop=gt}function rt(){var B=i(z).container;if(!B){B=document.createElement("div"),B.className=l,B.style.cssText=h(["visibility: hidden","display: inline","width: 0px","height: 0px","z-index: -1","overflow: hidden","margin: 0","padding: 0"]),i(z).container=B,p(B),z.appendChild(B);var pt=function(){i(z).onRendered&&i(z).onRendered()};m(B,"animationstart",pt),i(z).onAnimationStart=pt}return B}function Z(){function B(){var se=i(z).style;if(se.position==="static"){z.style.setProperty("position","relative",E.important?"important":"");var Ye=function(Cr,dr,ki,qn){function oe(we){return we.replace(/[^-\d\.]/g,"")}var $n=ki[qn];$n!=="auto"&&oe($n)!=="0"&&(Cr.warn("An element that is positioned static has style."+qn+"="+$n+" which is ignored due to the static positioning. The element will need to be positioned relative, so the style."+qn+" will be set to 0. Element: ",dr),dr.style[qn]=0)};Ye(e,z,se,"top"),Ye(e,z,se,"right"),Ye(e,z,se,"bottom"),Ye(e,z,se,"left")}}function pt(se,Ye,Cr,dr){return se=se?se+"px":"0",Ye=Ye?Ye+"px":"0",Cr=Cr?Cr+"px":"0",dr=dr?dr+"px":"0",["left: "+se,"top: "+Ye,"right: "+dr,"bottom: "+Cr]}if(k("Injecting elements"),!i(z)){k("Aborting because element has been uninstalled");return}B();var H=i(z).container;H||(H=rt());var Ot=o.width,Bt=o.height,kt=h(["position: absolute","flex: none","overflow: hidden","z-index: -1","visibility: hidden","width: 100%","height: 100%","left: 0px","top: 0px"]),Ct=h(["position: absolute","flex: none","overflow: hidden","z-index: -1","visibility: hidden"].concat(pt(-(1+Ot),-(1+Bt),-Bt,-Ot))),Gt=h(["position: absolute","flex: none","overflow: scroll","z-index: -1","visibility: hidden","width: 100%","height: 100%"]),gt=h(["position: absolute","flex: none","overflow: scroll","z-index: -1","visibility: hidden","width: 100%","height: 100%"]),_t=h(["position: absolute","left: 0","top: 0"]),Dt=h(["position: absolute","width: 200%","height: 200%"]),zt=document.createElement("div"),Le=document.createElement("div"),Qr=document.createElement("div"),Dn=document.createElement("div"),_n=document.createElement("div"),Bn=document.createElement("div");zt.dir="ltr",zt.style.cssText=kt,zt.className=l,Le.className=l,Le.style.cssText=Ct,Qr.style.cssText=Gt,Dn.style.cssText=_t,_n.style.cssText=gt,Bn.style.cssText=Dt,Qr.appendChild(Dn),_n.appendChild(Bn),Le.appendChild(Qr),Le.appendChild(_n),zt.appendChild(Le),H.appendChild(zt);function Ci(){var se=i(z);se&&se.onExpand?se.onExpand():k("Aborting expand scroll handler: element has been uninstalled")}function Ii(){var se=i(z);se&&se.onShrink?se.onShrink():k("Aborting shrink scroll handler: element has been uninstalled")}m(Qr,"scroll",Ci),m(_n,"scroll",Ii),i(z).onExpandScroll=Ci,i(z).onShrinkScroll=Ii}function Q(){function B(Gt,gt,_t){var Dt=yt(Gt),zt=St(gt),Le=j(_t);Dt.style.setProperty("width",zt+"px",E.important?"important":""),Dt.style.setProperty("height",Le+"px",E.important?"important":"")}function pt(Gt){var gt=z.offsetWidth,_t=z.offsetHeight,Dt=gt!==i(z).lastWidth||_t!==i(z).lastHeight;k("Storing current size",gt,_t),xt(z,gt,_t),r.add(0,function(){if(Dt){if(!i(z)){k("Aborting because element has been uninstalled");return}if(!H()){k("Aborting because element container has not been initialized");return}if(E.debug){var Le=z.offsetWidth,Qr=z.offsetHeight;(Le!==gt||Qr!==_t)&&e.warn(s.get(z),"Scroll: Size changed before updating detector elements.")}B(z,gt,_t)}}),r.add(1,function(){if(!i(z)){k("Aborting because element has been uninstalled");return}if(!H()){k("Aborting because element container has not been initialized");return}et(z,gt,_t)}),Dt&&Gt&&r.add(2,function(){if(!i(z)){k("Aborting because element has been uninstalled");return}if(!H()){k("Aborting because element container has not been initialized");return}Gt()})}function H(){return!!i(z).container}function Ot(){function Gt(){return i(z).lastNotifiedWidth===void 0}k("notifyListenersIfNeeded invoked");var gt=i(z);if(Gt()&&gt.lastWidth===gt.startSize.width&&gt.lastHeight===gt.startSize.height)return k("Not notifying: Size is the same as the start size, and there has been no notification yet.");if(gt.lastWidth===gt.lastNotifiedWidth&&gt.lastHeight===gt.lastNotifiedHeight)return k("Not notifying: Size already notified");k("Current size not notified, notifying..."),gt.lastNotifiedWidth=gt.lastWidth,gt.lastNotifiedHeight=gt.lastHeight,n(i(z).listeners,function(_t){_t(z)})}function Bt(){if(k("startanimation triggered."),X(z)){k("Ignoring since element is still unrendered...");return}k("Element rendered.");var Gt=_(z),gt=S(z);(Gt.scrollLeft===0||Gt.scrollTop===0||gt.scrollLeft===0||gt.scrollTop===0)&&(k("Scrollbars out of sync. Updating detector elements..."),pt(Ot))}function kt(){if(k("Scroll detected."),X(z)){k("Scroll event fired while unrendered. Ignoring...");return}pt(Ot)}if(k("registerListenersAndPositionElements invoked."),!i(z)){k("Aborting because element has been uninstalled");return}i(z).onRendered=Bt,i(z).onExpand=kt,i(z).onShrink=kt;var Ct=i(z).style;B(z,Ct.width,Ct.height)}function U(){if(k("finalizeDomMutation invoked."),!i(z)){k("Aborting because element has been uninstalled");return}var B=i(z).style;xt(z,B.width,B.height),et(z,B.width,B.height)}function st(){R(z)}function vt(){k("Installing..."),tt(),at(),r.add(0,bt),r.add(1,Z),r.add(2,Q),r.add(3,U),r.add(4,st)}k("Making detectable..."),L(z)?(k("Element is detached"),rt(),k("Waiting until element is attached..."),i(z).onRendered=function(){k("Element is now attached"),vt()}):vt()}function C(E){var z=i(E);z&&(z.onExpandScroll&&v(_(E),"scroll",z.onExpandScroll),z.onShrinkScroll&&v(S(E),"scroll",z.onShrinkScroll),z.onAnimationStart&&v(z.container,"animationstart",z.onAnimationStart),z.container&&E.removeChild(z.container))}return{makeDetectable:T,addListener:M,uninstall:C,initDocument:c}},Oh}var zh,uy;function N2(){if(uy)return zh;uy=1;var n=Xm().forEach,t=O2(),e=z2(),r=T2(),i=C2(),s=I2(),o=ry(),a=P2(),l=R2(),c=L2(),h=F2();function f(v){return Array.isArray(v)||v.length!==void 0}function g(v){if(Array.isArray(v))return v;var _=[];return n(v,function(S){_.push(S)}),_}function p(v){return v&&v.nodeType===1}zh=function(v){v=v||{};var _;if(v.idHandler)_={get:function(ht){return v.idHandler.get(ht,!0)},set:v.idHandler.set};else{var S=r(),M=i({idGenerator:S,stateHandler:l});_=M}var T=v.reporter;if(!T){var C=T===!1;T=s(C)}var E=m(v,"batchProcessor",a({reporter:T})),z={};z.callOnAdd=!!m(v,"callOnAdd",!0),z.debug=!!m(v,"debug",!1);var R=e(_),k=t({stateHandler:l}),L,X=m(v,"strategy","object"),J=m(v,"important",!1),at={reporter:T,batchProcessor:E,stateHandler:l,idHandler:_,important:J};if(X==="scroll"&&(o.isLegacyOpera()?(T.warn("Scroll strategy is not supported on legacy Opera. Changing to object strategy."),X="object"):o.isIE(9)&&(T.warn("Scroll strategy is not supported on IE9. Changing to object strategy."),X="object")),X==="scroll")L=h(at);else if(X==="object")L=c(at);else throw new Error("Invalid strategy name: "+X);var tt={};function bt(ht,Y,St){function j(Q){var U=R.get(Q);n(U,function(vt){vt(Q)})}function W(Q,U,st){R.add(U,st),Q&&st(U)}if(St||(St=Y,Y=ht,ht={}),!Y)throw new Error("At least one element required.");if(!St)throw new Error("Listener required.");if(p(Y))Y=[Y];else if(f(Y))Y=g(Y);else return T.error("Invalid arguments. Must be a DOM element or a collection of DOM elements.");var ft=0,et=m(ht,"callOnAdd",z.callOnAdd),rt=m(ht,"onReady",function(){}),Z=m(ht,"debug",z.debug);n(Y,function(U){l.getState(U)||(l.initState(U),_.set(U));var st=_.get(U);if(Z&&T.log("Attaching listener to element",st,U),!k.isDetectable(U)){if(Z&&T.log(st,"Not detectable."),k.isBusy(U)){Z&&T.log(st,"System busy making it detectable"),W(et,U,St),tt[st]=tt[st]||[],tt[st].push(function(){ft++,ft===Y.length&&rt()});return}return Z&&T.log(st,"Making detectable..."),k.markBusy(U,!0),L.makeDetectable({debug:Z,important:J},U,function(B){if(Z&&T.log(st,"onElementDetectable"),l.getState(B)){k.markAsDetectable(B),k.markBusy(B,!1),L.addListener(B,j),W(et,B,St);var pt=l.getState(B);if(pt&&pt.startSize){var H=B.offsetWidth,Ot=B.offsetHeight;(pt.startSize.width!==H||pt.startSize.height!==Ot)&&j(B)}tt[st]&&n(tt[st],function(Bt){Bt()})}else Z&&T.log(st,"Element uninstalled before being detectable.");delete tt[st],ft++,ft===Y.length&&rt()})}Z&&T.log(st,"Already detecable, adding listener."),W(et,U,St),ft++}),ft===Y.length&&rt()}function xt(ht){if(!ht)return T.error("At least one element is required.");if(p(ht))ht=[ht];else if(f(ht))ht=g(ht);else return T.error("Invalid arguments. Must be a DOM element or a collection of DOM elements.");n(ht,function(Y){R.removeAllListeners(Y),L.uninstall(Y),l.cleanState(Y)})}function yt(ht){L.initDocument&&L.initDocument(ht)}return{listenTo:bt,removeListener:R.removeListener,removeAllListeners:R.removeAllListeners,uninstall:xt,initDocument:yt}};function m(v,_,S){var M=v[_];return M==null&&S!==void 0?S:M}return zh}var j2=N2();const V2=rn(j2);function D2(n){const{top:t,right:e,bottom:r,left:i,width:s,height:o}=n.getBoundingClientRect();return{top:t,right:e,bottom:r,left:i,width:s,height:o}}const B2=({children:n})=>{const[t,e]=N.useState(null),r=N.useRef(null),i=N.useRef(null);return N.useEffect(()=>{if(!r.current)return;const s=r.current.parentElement;if(!s)return;i.current=V2({strategy:"scroll",callOnAdd:!1});const o=()=>{const a=D2(s);e(a)};return i.current.listenTo(s,o),o(),()=>{i.current&&s&&i.current.uninstall(s)}},[]),t?typeof n=="function"?n(t):N.cloneElement(n,t):w.jsx("div",{ref:r})};function q2(n){const t=N.useRef(!1),e=N.useRef(!1),r=N.useCallback(async()=>{if(!(e.current||t.current)){e.current=!0;try{const i=await Vg();t.current=!0,n&&n(i)}catch{}finally{e.current=!1}}},[n]);return N.useEffect(()=>{const i=s=>{if(!t.current)return r(),s.preventDefault(),s.returnValue="",""};return window.addEventListener("beforeunload",i),()=>{window.removeEventListener("beforeunload",i)}},[r]),{ensureScreenshot:r,screenshotDone:t}}const $2=50,H2=300,G2=20,W2=[E2("pub_planner_v0"),M2()],U2=({plan:n,catalog:t,onSave:e,onBack:r})=>{const i=ne();return N.useEffect(()=>{i.initCatalog(t),W2.forEach(s=>s(i,n,e))},[]),N.useEffect(()=>{i.planner.getIn(["catalog","ready"])||i.initCatalog(t)},[t]),q2(s=>{e&&e({imageURI:s})}),w.jsx(B2,{children:({width:s,height:o})=>{const a=s-$2-H2,l=o-G2;return w.jsxs("div",{className:"flex flex-nowrap flex-row h-full floor_planner",children:[w.jsx(A2,{onSave:e,onBack:r}),w.jsx(w2,{catalog:t}),w.jsx(gb,{width:a,height:l,catalog:t}),w.jsx(Zw,{catalog:t}),w.jsx(Qb,{})]})}})},Y2=()=>w.jsxs("div",{className:"fixed inset-0 z-[100] flex flex-col bg-[#2b2d35] overflow-hidden",children:[w.jsxs("div",{className:"flex h-[45px] items-center justify-between border border-[#424242] bg-[#2b2d35] px-2",children:[w.jsx("div",{className:"flex flex-1 items-center",children:w.jsx("div",{className:"h-[30px] w-[30px] rounded bg-[#424242] animate-pulse"})}),w.jsx("div",{className:"flex items-center",children:w.jsx("div",{className:"h-[18px] w-[175px] bg-[#424242] animate-pulse"})}),w.jsx("div",{className:"flex flex-1 items-center justify-end",children:w.jsx("div",{className:"mr-40 flex flex-row gap-3",children:[...Array(2)].map((n,t)=>w.jsx("div",{className:"h-[24px] w-[24px] rounded bg-[#424242] animate-pulse"},`${t}`))})})]}),w.jsxs("div",{className:"flex flex-1",children:[w.jsx("div",{className:"block w-[50px] border-r border-[#424242] bg-[#2b2d35]"}),w.jsx("div",{className:"flex flex-1 items-center justify-center bg-[#2b2d35]",children:w.jsx("div",{className:"h-[90%] w-[90%] bg-[#424242] animate-pulse"})}),w.jsx("div",{className:"w-[300px] border-l border-[#424242] bg-[#2b2d35] flex justify-center items-center",children:w.jsxs("div",{className:"flex w-full flex-col gap-2 justify-center items-center p-6",children:[w.jsx("div",{className:"h-[15px] w-[200px] bg-[#424242] animate-pulse"}),w.jsx("div",{className:"h-[15px] w-[150px] bg-[#424242] animate-pulse"})]})})]}),w.jsxs("div",{className:"py-[3px] px-[1em] text-xs border-t border-[#424242] bg-[#2b2d35] h-5 w-full select-none cursor-default bottom-0 leading-[14px] text-white m-0",children:[w.jsx("div",{className:"relative float-left px-[1em] inline-block border-r border-r-white",children:w.jsx("div",{className:"flex items-center gap-2",children:w.jsx("div",{className:"h-[13px] w-[110px] rounded-sm bg-[#424242] animate-pulse"})})}),w.jsxs("div",{className:"flex flex-1 items-center",children:[[...Array(5)].map((n,t)=>w.jsx("div",{className:"ml-5 h-[13px] w-[30px] rounded-sm bg-[#424242] animate-pulse"},t)),w.jsx("div",{className:"flex flex-1 items-center justify-end",children:w.jsx("div",{className:"mr-5 flex flex-row gap-3",children:[...Array(2)].map((n,t)=>w.jsx("div",{className:"h-[13px] w-[13px] rounded-full bg-[#424242] animate-pulse"},`${t}`))})})]})]})]}),ly=1e-5,vu=0,No=1,Ps=2,cy=3;class Ti{constructor(t){Vt(this,"Polygon");Vt(this,"Vertex");Vt(this,"Node");Vt(this,"matrix");Vt(this,"tree");if(this.Polygon=Rs,this.Vertex=xu,this.Node=Vn,t instanceof Cs)t.updateMatrixWorld(),this.matrix=t.matrixWorld.clone(),t=t.geometry;else if(t instanceof Ai)this.matrix=new Ue;else{if(t instanceof Vn)return this.tree=t,this.matrix=new Ue,this;throw new Error("ThreeBSP: Given geometry is unsupported")}const e=[],r=t.getAttribute("position"),i=t.getAttribute("uv"),s=t.getIndex(),o=l=>{const c=r.getX(l),h=r.getY(l),f=r.getZ(l),g=i?new Et(i.getX(l),i.getY(l)):null,p=new xu(c,h,f,new D,g);return p.applyMatrix4(this.matrix),p},a=s?s.array:[...Array(r.count).keys()];for(let l=0;l<a.length;l+=3){const c=o(a[l]),h=o(a[l+1]),f=o(a[l+2]),g=new Rs([c,h,f]);g.calculateProperties(),e.push(g)}this.tree=new Vn(e)}subtract(t){let e=this.tree.clone(),r=t.tree.clone();return e.invert(),e.clipTo(r),r.clipTo(e),r.invert(),r.clipTo(e),r.invert(),e.build(r.allPolygons()),e.invert(),e=new Ti(e),e.matrix=this.matrix,e}union(t){let e=this.tree.clone(),r=t.tree.clone();return e.clipTo(r),r.clipTo(e),r.invert(),r.clipTo(e),r.invert(),e.build(r.allPolygons()),e=new Ti(e),e.matrix=this.matrix,e}intersect(t){let e=this.tree.clone(),r=t.tree.clone();return e.invert(),r.clipTo(e),r.invert(),e.clipTo(r),r.clipTo(e),e.build(r.allPolygons()),e.invert(),e=new Ti(e),e.matrix=this.matrix,e}toGeometry(){const t=new Ue().copy(this.matrix).invert(),e=[],r=[];this.tree.allPolygons().forEach(o=>{for(let a=2;a<o.vertices.length;a++)[o.vertices[0],o.vertices[a-1],o.vertices[a]].forEach(c=>{const h=new D(c.x,c.y,c.z).applyMatrix4(t);e.push(h.x,h.y,h.z),c.uv?r.push(c.uv.x,c.uv.y):r.push(0,0)})});const s=new Ai;return s.setAttribute("position",new jn(e,3)),s.setAttribute("uv",new jn(r,2)),s.computeVertexNormals(),s}toMesh(t){const e=this.toGeometry(),r=new Cs(e,t),i=new D,s=new ps,o=new D;return this.matrix.decompose(i,s,o),r.position.copy(i),r.quaternion.copy(s),r.scale.copy(o),r}}class Rs{constructor(t,e,r){Vt(this,"vertices");Vt(this,"normal");Vt(this,"w");t instanceof Array||(t=[]),this.vertices=t,t.length>0?this.calculateProperties():this.normal=this.w=void 0}calculateProperties(){var t=this.vertices[0],e=this.vertices[1],r=this.vertices[2];return this.normal=e.clone().subtract(t).cross(r.clone().subtract(t)).normalize(),this.normal&&(this.w=this.normal.clone().dot(t)),this}clone(){var t,e,r=new Rs;for(t=0,e=this.vertices.length;t<e;t++)r.vertices.push(this.vertices[t].clone());return r.calculateProperties(),r}flip(){var t,e=[];for(this.normal&&this.normal.multiplyScalar(-1),this.w&&(this.w*=-1),t=this.vertices.length-1;t>=0;t--)e.push(this.vertices[t]);return this.vertices=e,this}classifyVertex(t){if(!this.normal||!this.w)return vu;var e=this.normal.dot(t)-this.w;return e<-ly?Ps:e>ly?No:vu}classifySide(t){var e,r,i,s=0,o=0,a=t.vertices.length;for(e=0;e<a;e++)r=t.vertices[e],i=this.classifyVertex(r),i===No?s++:i===Ps&&o++;return s>0&&o===0?No:s===0&&o>0?Ps:s===0&&o===0?vu:cy}splitPolygon(t,e,r,i,s){var o=this.classifySide(t);if(o===vu)(this.normal&&t.normal&&this.normal.dot(t.normal)>0?e:r).push(t);else if(o===No)i.push(t);else if(o===Ps)s.push(t);else{var a,l,c,h,f,g,p,m,v,_=[],S=[];for(l=0,a=t.vertices.length;l<a;l++)c=(l+1)%a,g=t.vertices[l],p=t.vertices[c],h=this.classifyVertex(g),f=this.classifyVertex(p),h!=Ps&&_.push(g),h!=No&&S.push(g),(h|f)===cy&&this.w&&this.normal&&(m=(this.w-this.normal.dot(g))/this.normal.dot(p.clone().subtract(g)),v=g.interpolate(p,m),_.push(v),S.push(v));_.length>=3&&i.push(new Rs(_).calculateProperties()),S.length>=3&&s.push(new Rs(S).calculateProperties())}}}class xu{constructor(t,e,r,i,s){Vt(this,"x");Vt(this,"y");Vt(this,"z");Vt(this,"normal");Vt(this,"uv");this.x=t,this.y=e,this.z=r,this.normal=i||new D,this.uv=s||new Et}clone(){return new xu(this.x,this.y,this.z,this.normal.clone(),this.uv?this.uv.clone():null)}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}subtract(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}cross(t){var e=this.x,r=this.y,i=this.z;return this.x=r*t.z-i*t.y,this.y=i*t.x-e*t.z,this.z=e*t.y-r*t.x,this}normalize(){var t=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);return this.x/=t,this.y/=t,this.z/=t,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lerp(t,e){return this.add(t.clone().subtract(this).multiplyScalar(e)),this.normal.add(t.normal.clone().sub(this.normal).multiplyScalar(e)),this.uv&&t.uv&&this.uv.add(t.uv.clone().sub(this.uv).multiplyScalar(e)),this}interpolate(t,e){return this.clone().lerp(t,e)}applyMatrix4(t){var e=this.x,r=this.y,i=this.z,s=t.elements;return this.x=s[0]*e+s[4]*r+s[8]*i+s[12],this.y=s[1]*e+s[5]*r+s[9]*i+s[13],this.z=s[2]*e+s[6]*r+s[10]*i+s[14],this}}class Vn{constructor(t){Vt(this,"polygons");Vt(this,"front");Vt(this,"back");Vt(this,"divider");var e,r,i=[],s=[];if(this.polygons=[],this.front=this.back=void 0,!(!(t instanceof Array)||t.length===0)){for(this.divider=t[0].clone(),e=0,r=t.length;e<r;e++)this.divider.splitPolygon(t[e],this.polygons,this.polygons,i,s);i.length>0&&(this.front=new Vn(i)),s.length>0&&(this.back=new Vn(s))}}isConvex(t){var e,r;for(e=0;e<t.length;e++)for(r=0;r<t.length;r++)if(e!==r&&t[e].classifySide(t[r])!==Ps)return!1;return!0}build(t){var e,r,i=[],s=[];for(this.divider||(this.divider=t[0].clone()),e=0,r=t.length;e<r;e++)this.divider.splitPolygon(t[e],this.polygons,this.polygons,i,s);i.length>0&&(this.front||(this.front=new Vn),this.front.build(i)),s.length>0&&(this.back||(this.back=new Vn),this.back.build(s))}allPolygons(){var t=this.polygons.slice();return this.front&&(t=t.concat(this.front.allPolygons())),this.back&&(t=t.concat(this.back.allPolygons())),t}clone(){var t=new Vn;return t.divider=this.divider?this.divider.clone():void 0,t.polygons=this.polygons.map(function(e){return e.clone()}),t.front=this.front&&this.front.clone(),t.back=this.back&&this.back.clone(),t}invert(){var t,e,r;for(t=0,e=this.polygons.length;t<e;t++)this.polygons[t].flip();return this.divider&&this.divider.flip(),this.front&&this.front.invert(),this.back&&this.back.invert(),r=this.front,this.front=this.back,this.back=r,this}clipPolygons(t){var e,r,i,s;if(!this.divider)return t.slice();for(i=[],s=[],e=0,r=t.length;e<r;e++)this.divider.splitPolygon(t[e],i,s,i,s);return this.front&&(i=this.front.clipPolygons(i)),this.back?s=this.back.clipPolygons(s):s=[],i.concat(s)}clipTo(t){this.polygons=t.clipPolygons(this.polygons),this.front&&this.front.clipTo(t),this.back&&this.back.clipTo(t)}}window.ThreeBSP=Ti;const Ls=Math.PI/2,hy=(n,t,e,r)=>{let i=new Gm;t&&(n.map=i.load(t.uri),n.needsUpdate=!0,n.map.wrapS=yn,n.map.wrapT=yn,n.map.repeat.set(e*t.lengthRepeatScale,r*t.heightRepeatScale),t.normal&&(n.normalMap=i.load(t.normal.uri),n.normalScale=new Et(t.normal.normalScaleX,t.normal.normalScaleY),n.normalMap.wrapS=yn,n.normalMap.wrapT=yn,n.normalMap.repeat.set(e*t.normal.lengthRepeatScale,r*t.normal.heightRepeatScale)))};function X2(n,t,e,r){let i=t.vertices.get(n.vertices.get(0)),s=t.vertices.get(n.vertices.get(1)),o=!1;if(i.x>s.x){let X=i;i=s,s=X,o=!0}let a=n.properties.getIn(["height","length"]),l=n.properties.getIn(["thickness","length"]),c=l/2,h=.2,f=1,g=ga(i,s),p=g/2,m=new Os({color:n.selected?Wt.MESH_SELECTED:13882323}),v=new Cs(new pu(g,a,l),m),_=Math.asin((s.y-i.y)/g),S=Math.sin(_),M=Math.cos(_);v.position.y+=a/2,v.position.x+=p*M,v.position.z-=p*S,v.rotation.y=_,n.holes.forEach(X=>{let J=t.holes.get(X),at=J.properties.getIn(["width","length"]),tt=J.properties.getIn(["height","length"]),bt=J.properties.getIn(["altitude","length"]),yt=(o?1-J.offset:J.offset)*g,ht=new pu(at,tt,l),Y=new Cs(ht);Y.position.y+=tt/2+bt,Y.position.x+=yt*M,Y.position.z-=yt*S,Y.rotation.y=_;let St=new Ti(v),j=new Ti(Y);v=St.subtract(j).toMesh(m)}),v.name="soul";let T=new Os,C=new Os;hy(T,r[n.properties.get("textureB")],g,a),hy(C,r[n.properties.get("textureA")],g,a);let E=h/l,z=c+f,R=v.clone();R.material=T,R.scale.set(1,1,E),R.position.x+=z*Math.cos(_-Ls),R.position.z-=z*Math.sin(_-Ls),R.name="frontFace";let k=v.clone();k.material=C,k.scale.set(1,1,E),k.position.x+=z*Math.cos(_+Ls),k.position.z-=z*Math.sin(_+Ls),k.name="backFace";let L=new PS;return L.add(v,R,k),Promise.resolve(L)}function J2(n,t,e,r,i,s,o,a,l){let c=()=>(a(),l()),h=i.getObjectByName("soul"),f=i.getObjectByName("frontFace"),g=i.getObjectByName("backFace");if(o[0]=="selected")h.material=new Os({color:n.selected?Wt.MESH_SELECTED:13882323});else if(o[0]=="properties")if(o[1]=="thickness"){let p=n.getIn(["properties","thickness","length"]),m=s.getIn(["properties","thickness","length"]),_=p/2+1,S=m/h.scale.z,M=h.rotation.y,T=_*Math.cos(M-Ls),C=_*Math.sin(M-Ls);h.scale.set(1,1,p/S),f.position.x=h.position.x+T,f.position.z=h.position.z+C,g.position.x=h.position.x-T,g.position.z=h.position.z-C}else return c();else return c();return Promise.resolve(i)}const fy=20,dy={textAnchor:"middle"},Z2={stroke:Wt.LINE_MESH_COLOR.selected},py={strokeWidth:1,stroke:Wt.COLORS.black},K2={...py,stroke:Wt.LINE_MESH_COLOR.selected};function Q2(n,t,e){let r={name:n,prototype:"lines",info:t,properties:{height:{label:"height",type:"length-measure",defaultValue:{length:300}},thickness:{label:"thickness",type:"length-measure",defaultValue:{length:15,_length:15,_unit:un}}},render2D:function(i,s,o){let{x:a,y:l}=s.vertices.get(i.vertices.get(0)),{x:c,y:h}=s.vertices.get(i.vertices.get(1)),f=Ve(a,l,c,h),g=f/5,p=i.getIn(["properties","thickness","length"]),m=p/2,v=m+fy,_=11,M=m+fy+5;return i.selected?w.jsxs("g",{children:[w.jsx("rect",{x:"0",y:-m,width:f,height:p,style:K2}),w.jsx("line",{x1:g,y1:-v,x2:g,y2:v,style:Z2}),w.jsx("text",{x:g,y:M+_,style:dy,children:"A"}),w.jsx("text",{x:g,y:-M,style:dy,children:"B"})]}):w.jsx("rect",{x:"0",y:-m,width:f,height:p,style:py})},render3D:function(i,s,o){return X2(i,s,o,e)},updateRender3D:(i,s,o,a,l,c,h,f)=>J2(i,s,o,e,a,l,c,h,f)};if(e&&Object.keys(e).length>0){let i={none:"None"};for(let s in e)i[s]=e[s].name;r.properties.textureA={label:"texture A",type:"enum",defaultValue:i.bricks?"bricks":"none",values:i},r.properties.textureB={label:"texture B",type:"enum",defaultValue:i.bricks?"bricks":"none",values:i}}return r}const tE=(n,t,e,r)=>{let i=new Gm;t&&(n.map=i.load(t.uri),n.needsUpdate=!0,n.map.wrapS=yn,n.map.wrapT=yn,n.map.repeat.set(e*t.lengthRepeatScale,r*t.heightRepeatScale),t.normal&&(n.normalMap=i.load(t.normal.uri),n.normalScale=new Et(t.normal.normalScaleX,t.normal.normalScaleY),n.normalMap.wrapS=yn,n.normalMap.wrapT=yn,n.normalMap.repeat.set(e*t.normal.lengthRepeatScale,r*t.normal.heightRepeatScale)))},eE=n=>{n.computeBoundingBox();let{min:t,max:e}=n.boundingBox,r=new Et(0-t.x,0-t.y),i=new Et(e.x-t.x,e.y-t.y);n.faceVertexUvs[0]=n.faces.map(s=>{let o=n.vertices[s.a],a=n.vertices[s.b],l=n.vertices[s.c];return[new Et((o.x+r.x)/i.x,(o.y+r.y)/i.y),new Et((a.x+r.x)/i.x,(a.y+r.y)/i.y),new Et((l.x+r.x)/i.x,(l.y+r.y)/i.y)]}),n.uvsNeedUpdate=!0};function rE(n,t,e,r){let i=[];n.vertices.forEach(v=>{i.push(t.vertices.get(v))});let s=n.properties.get("texture"),o=n.properties.get("patternColor");n.selected?o=Wt.AREA_MESH_COLOR.selected:s&&s!=="none"&&(o=Wt.AREA_MESH_COLOR.unselected);let a=new lh;a.moveTo(i[0].x,i[0].y);for(let v=1;v<i.length;v++)a.lineTo(i[v].x,i[v].y);let l=new f2({side:iS,color:o});n.holes.forEach(v=>{let _=[];t.getIn(["areas",v,"vertices"]).forEach(M=>{let{x:T,y:C}=t.getIn(["vertices",M]);_.push([T,C])}),_=_.reverse();let S=iE(_);a.holes.push(S)});let c=new fh(a);eE(c);let h=new ys().setFromObject(new Cs(c,new Os)),f=h.max.x-h.min.x,g=h.max.y-h.min.y,p=r[s];tE(l,p,f,g);let m=new Cs(c,l);return m.rotation.x-=Math.PI/2,m.name="floor",Promise.resolve(m)}function nE(n,t,e,r,i,s,o,a,l){let c=()=>(a(),l()),h=i.getObjectByName("floor");if(o[0]=="selected"){let f=n.selected?Wt.AREA_MESH_COLOR.selected:n.properties.get("patternColor")||Wt.AREA_MESH_COLOR.unselected;h.material.color.set(f)}else if(o[0]=="properties"){if(o[1]==="texture")return c()}else return c();return Promise.resolve(i)}const iE=n=>{let t=new lh;t.moveTo(n[0][0],n[0][1]);for(let e=1;e<n.length;e++)t.lineTo(n[e][0],n[e][1]);return t};function sE(n,t,e){let r={name:n,prototype:"areas",info:{...t,visibility:{catalog:!1,layerElementsVisible:!1}},properties:{patternColor:{label:"color",type:"color",defaultValue:Wt.AREA_MESH_COLOR.unselected},thickness:{label:"thickness",type:"length-measure",defaultValue:{length:0,_length:0,_unit:un}}},render2D:function(i,s,o){let a="";const l=i.properties.get("texture"),c=e[l],h=[];i.vertices.forEach((T,C)=>{const E=s.vertices.get(T);h.push(E),a+=(C?"L":"M")+E.x+" "+E.y+" "}),i.holes.forEach(T=>{s.areas.get(T).vertices.reverse().forEach((E,z)=>{const R=s.vertices.get(E);a+=(z?"L":"M")+R.x+" "+R.y+" "})});const f=Math.min(...h.map(T=>T.x)),g=Math.max(...h.map(T=>T.x)),p=Math.min(...h.map(T=>T.y)),m=Math.max(...h.map(T=>T.y)),v=g-f,_=m-p;i.properties.get("patternColor"),i.selected;const S=i.selected?Wt.AREA_MESH_COLOR.selected:i.properties.get("patternColor"),M=`pattern-${i.id}`;return w.jsxs("g",{children:[w.jsx("defs",{children:c&&w.jsx("pattern",{id:M,patternUnits:"userSpaceOnUse",width:v/(v*c.lengthRepeatScale),height:_/(_*c.heightRepeatScale),x:f,y:p,children:w.jsx("image",{href:c.uri,width:v,height:_,preserveAspectRatio:"none"})})}),w.jsx("path",{d:a,fill:c?`url(#${M})`:S,stroke:i.selected?"#0096fd":"#000",strokeWidth:"2"})]})},render3D:function(i,s,o){return rE(i,s,o,e)},updateRender3D:(i,s,o,a,l,c,h,f)=>nE(i,s,o,e,a,l,c,h,f)};if(e&&Object.keys(e).length>0){let i={none:"None"};for(let s in e)i[s]=e[s].name;r.properties.texture={label:"texture",type:"enum",defaultValue:"none",values:i}}return r}ze.AreaFactory=sE,ze.Catalog=m2,ze.ReactPlannerLoader=Y2,ze.WallFactory=Q2,ze.convertUnits=Gr,ze.default=U2,Object.defineProperties(ze,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});