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DZ,EAAoBK,UAAU3I,KAAI,KAC9B,MAAM,MAAEmJ,EAAK,OAAEC,GAAWd,EAAoBe,cAC9C5K,KAAKiF,QAAQT,WAAWqG,QAAQF,EAAQD,EAAM,IAElDb,EAAoBjE,WAAW2E,MAAMG,MAAQ,QAC7Cb,EAAoBjE,WAAW2E,MAAMI,OAAS,QAC9Cd,EAAoBiB,UAAUvJ,KAAI,KAC1BsI,EAAoBE,SACpB/J,KAAKiF,QAAQT,WAAW2F,KAAKC,YACjC,IAEJ,MAAMW,EAAoB,IAAI,KAAO/K,KAAK6B,YAC1C7B,KAAK6B,WAAWiI,GAAGvI,IAAIwJ,GACvBA,EAAkBnC,UAAY,MAC9BmC,EAAkBD,UAAUvJ,KAAI,KAC5BvB,KAAKiF,QAAQC,SAASiF,KAAKC,YAAY,IAE3CW,EAAkBhB,SAAU,EAC5BgB,EAAkBV,MAAMC,QAAQ1E,WAAW2E,MAAMC,QAAU,IAC3DO,EAAkBV,MAAMC,QAAQ1E,WAAW2E,MAAME,SAAW,SAC5D,MAAM,YAAEO,EAAW,aAAEC,GAAiBF,EAAkBnF,WACxD5F,KAAKiF,QAAQC,SAAS2F,QAAQI,EAAcD,GAC5C,MAAME,EAAalL,KAAKiF,QAAQC,SAASb,UAAUrD,IAAI,aACvD+J,EAAkBd,SAASiB,GACvBlL,KAAK6B,WAAW4D,SAASzD,gBACzBhC,KAAK6B,WAAW4D,SAAS0F,cAAc5J,KAAIjB,UACnCuJ,EAAoBE,eACd/J,KAAKiF,QAAQT,WAAW4G,SAE9BL,EAAkBhB,eACZ/J,KAAKiF,QAAQC,SAASkG,QAChC,IAGRpL,KAAKqE,UAAUL,IAAI,CACf6F,sBACAkB,qBAER,EAGJ5G,EAAca,KAAO,uCACrB,sBAA+Bb,EAAca,K","sources":["webpack://client-app/./node_modules/openbim-components/src/base-types/base-raycaster.js","webpack://client-app/./node_modules/openbim-components/src/base-types/base-renderer.js","webpack://client-app/./node_modules/openbim-components/src/base-types/base-types.js","webpack://client-app/./node_modules/openbim-components/src/base-types/component.js","webpack://client-app/./node_modules/openbim-components/src/base-types/mouse.js","webpack://client-app/./node_modules/openbim-components/src/base-types/ui-element.js","webpack://client-app/./node_modules/openbim-components/src/civil/RoadNavigator/index.js"],"sourcesContent":["import { Component } from \"./component\";\r\nimport { Event } from \"./base-types\";\r\n/**\r\n * A base component for other components whose main mission is to cast rays,\r\n * generally to pick objects with the mouse.\r\n */\r\nexport class BaseRaycaster extends Component {\r\n constructor() {\r\n super(...arguments);\r\n /** {@link Disposable.onDisposed} */\r\n this.onDisposed = new Event();\r\n }\r\n}\r\n//# sourceMappingURL=base-raycaster.js.map","import { Component } from \"./component\";\r\nimport { Event } from \"./base-types\";\r\n/**\r\n * A base component for other components whose main mission is to render a\r\n * [scene](https://threejs.org/docs/#api/en/scenes/Scene).\r\n * @noInheritDoc\r\n */\r\nexport class BaseRenderer extends Component {\r\n constructor() {\r\n super(...arguments);\r\n /** {@link Resizeable.onResize} */\r\n this.onResize = new Event();\r\n /**\r\n * Event that fires when there has been a change to the list of clipping\r\n * planes used by the active renderer.\r\n */\r\n this.onClippingPlanesUpdated = new Event();\r\n /**\r\n * The list of [clipping planes](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes) used by this\r\n * instance of the renderer.\r\n */\r\n this.clippingPlanes = [];\r\n }\r\n /**\r\n * Forces the update of the clipping planes and all components that depend\r\n * on them that are subscribed to `onClippingPlanesUpdated`.\r\n */\r\n async updateClippingPlanes() {\r\n await this.onClippingPlanesUpdated.trigger();\r\n }\r\n /**\r\n * Adds or removes a\r\n * [clipping plane](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes)\r\n * to the renderer.\r\n */\r\n togglePlane(active, plane, isLocal) {\r\n plane.isLocal = isLocal;\r\n const index = this.clippingPlanes.indexOf(plane);\r\n if (active && index === -1) {\r\n this.clippingPlanes.push(plane);\r\n }\r\n else if (!active && index > -1) {\r\n this.clippingPlanes.splice(index, 1);\r\n }\r\n const renderer = this.get();\r\n renderer.clippingPlanes = this.clippingPlanes.filter((plane) => !plane.isLocal);\r\n }\r\n}\r\n//# sourceMappingURL=base-renderer.js.map","/**\r\n * Simple event handler by\r\n * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).\r\n * Keep in mind that:\r\n * - If you want to remove it later, you might want to declare the callback as\r\n * an object.\r\n * - If you want to maintain the reference to `this`, you will need to declare\r\n * the callback as an arrow function.\r\n */\r\nexport class Event {\r\n constructor() {\r\n /** Triggers all the callbacks assigned to this event. */\r\n this.trigger = async (data) => {\r\n const handlers = this.handlers.slice(0);\r\n for (const handler of handlers) {\r\n await handler(data);\r\n }\r\n };\r\n this.handlers = [];\r\n }\r\n /**\r\n * Add a callback to this event instance.\r\n * @param handler - the callback to be added to this event.\r\n */\r\n add(handler) {\r\n this.handlers.push(handler);\r\n }\r\n /**\r\n * Removes a callback from this event instance.\r\n * @param handler - the callback to be removed from this event.\r\n */\r\n remove(handler) {\r\n this.handlers = this.handlers.filter((h) => h !== handler);\r\n }\r\n /** Gets rid of all the suscribed events. */\r\n reset() {\r\n this.handlers.length = 0;\r\n }\r\n}\r\n//# sourceMappingURL=base-types.js.map","/**\r\n * Components are the building blocks of this library. Everything is a\r\n * component: tools, scenes, objects, cameras, etc.\r\n * All components must inherit from this class. The `Type` parameter defines\r\n * the type of the core of this component. For instance, a component containing a\r\n */\r\nexport class Component {\r\n constructor(components) {\r\n this.components = components;\r\n /** Whether is component is {@link Disposable}. */\r\n this.isDisposeable = () => {\r\n return \"dispose\" in this;\r\n };\r\n /** Whether is component is {@link Resizeable}. */\r\n this.isResizeable = () => {\r\n return \"resize\" in this && \"getSize\" in this;\r\n };\r\n /** Whether is component is {@link Updateable}. */\r\n this.isUpdateable = () => {\r\n return (\"onAfterUpdate\" in this && \"onBeforeUpdate\" in this && \"update\" in this);\r\n };\r\n /** Whether is component is {@link Hideable}. */\r\n this.isHideable = () => {\r\n return \"visible\" in this;\r\n };\r\n /** Whether is component is {@link Configurable}. */\r\n this.isConfigurable = () => {\r\n return \"setup\" in this && \"config\" in this && \"onSetup\" in this;\r\n };\r\n /** Whether is component implements any kind of {@link UI}. */\r\n this.hasUI = () => {\r\n return \"uiElement\" in this;\r\n };\r\n }\r\n}\r\n//# sourceMappingURL=component.js.map","import * as THREE from \"three\";\r\nimport { Event } from \"./base-types\";\r\n/**\r\n * A helper to easily get the real position of the mouse in the Three.js canvas\r\n * to work with tools like the\r\n * [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has\r\n * been transformed through CSS or doesn't occupy the whole screen.\r\n */\r\nexport class Mouse {\r\n constructor(dom) {\r\n this.dom = dom;\r\n this._position = new THREE.Vector2();\r\n /** {@link Disposable.onDisposed} */\r\n this.onDisposed = new Event();\r\n this.updateMouseInfo = (event) => {\r\n this._event = event;\r\n };\r\n this.setupEvents(true);\r\n }\r\n /**\r\n * The real position of the mouse of the Three.js canvas.\r\n */\r\n get position() {\r\n if (this._event) {\r\n const bounds = this.dom.getBoundingClientRect();\r\n this._position.x = this.getPositionX(bounds, this._event);\r\n this._position.y = this.getPositionY(bounds, this._event);\r\n }\r\n return this._position;\r\n }\r\n /** {@link Disposable.dispose} */\r\n async dispose() {\r\n this.setupEvents(false);\r\n await this.onDisposed.trigger();\r\n this.onDisposed.reset();\r\n }\r\n getPositionY(bound, event) {\r\n return -((event.clientY - bound.top) / (bound.bottom - bound.top)) * 2 + 1;\r\n }\r\n getPositionX(bound, event) {\r\n return ((event.clientX - bound.left) / (bound.right - bound.left)) * 2 - 1;\r\n }\r\n setupEvents(active) {\r\n if (active) {\r\n this.dom.addEventListener(\"mousemove\", this.updateMouseInfo);\r\n }\r\n else {\r\n this.dom.removeEventListener(\"mousemove\", this.updateMouseInfo);\r\n }\r\n }\r\n}\r\n//# sourceMappingURL=mouse.js.map","/**\r\n * A simple object to handle UI components. You can use the generic constructor\r\n * to specify the types of your UI components.\r\n */\r\nexport class UIElement {\r\n constructor() {\r\n this._data = null;\r\n this.initError = \"UI Components not initialized.\";\r\n }\r\n /**\r\n * Gets the UI Component with the given name. If it doesn't exist, it will\r\n * throw an error.\r\n *\r\n * @param name the identifier of the UI component.\r\n */\r\n get(name) {\r\n if (!this._data) {\r\n throw new Error(this.initError);\r\n }\r\n return this._data[name];\r\n }\r\n /**\r\n * Sets all the UI components of this instance.\r\n *\r\n * @param data all the UI components sorted by name in an object.\r\n */\r\n set(data) {\r\n this._data = data;\r\n }\r\n /**\r\n * Release all the memory used by this instance deleting all the UI components\r\n * inside.\r\n */\r\n async dispose() {\r\n if (!this._data)\r\n return;\r\n for (const name in this._data) {\r\n const uiComponent = this._data[name];\r\n await uiComponent.dispose();\r\n }\r\n this._data = null;\r\n }\r\n}\r\n//# sourceMappingURL=ui-element.js.map","import * as THREE from \"three\";\r\nimport { Simple2DScene, ToolComponent } from \"../../core\";\r\nimport { Component, UIElement } from \"../../base-types\";\r\nimport { Drawer, FloatingWindow } from \"../../ui\";\r\nexport class RoadNavigator extends Component {\r\n constructor(components) {\r\n super(components);\r\n this.enabled = true;\r\n this.uiElement = new UIElement();\r\n this._selected = null;\r\n this._anchors = {\r\n horizontal: new THREE.Vector2(),\r\n horizontalIndex: 0,\r\n real: new THREE.Vector3(),\r\n };\r\n this._caster = new THREE.Raycaster();\r\n const threshold = 5;\r\n this._caster.params.Line = { threshold };\r\n this.components.tools.add(RoadNavigator.uuid, this);\r\n this._scenes = {\r\n horizontal: new Simple2DScene(this.components, false),\r\n vertical: new Simple2DScene(this.components, false),\r\n };\r\n this._points = {\r\n horizontal: new THREE.Points(new THREE.BufferGeometry(), new THREE.PointsMaterial({\r\n size: 10,\r\n })),\r\n };\r\n this._points.horizontal.frustumCulled = false;\r\n this._scenes.horizontal.scene.add(this._points.horizontal);\r\n this._alignments = {\r\n horizontal: new THREE.LineSegments(new THREE.BufferGeometry(), new THREE.LineBasicMaterial()),\r\n vertical: new THREE.LineSegments(new THREE.BufferGeometry(), new THREE.LineBasicMaterial()),\r\n real: new THREE.LineSegments(new THREE.BufferGeometry(), new THREE.LineBasicMaterial()),\r\n };\r\n this._alignments.real.frustumCulled = false;\r\n this._scenes.vertical.get().add(this._alignments.vertical);\r\n this._scenes.horizontal.get().add(this._alignments.horizontal);\r\n const scene = this.components.scene.get();\r\n scene.add(this._alignments.real);\r\n const hRenderer = this._scenes.horizontal.renderer.get();\r\n const hCamera = this._scenes.horizontal.camera;\r\n hRenderer.domElement.addEventListener(\"click\", (event) => {\r\n if (!this._selected || !this._selected.ifcCivil)\r\n return;\r\n const lim = hRenderer.domElement.getBoundingClientRect();\r\n const y = -((event.clientY - lim.top) / (lim.bottom - lim.top)) * 2 + 1;\r\n const x = ((event.clientX - lim.left) / (lim.right - lim.left)) * 2 - 1;\r\n const position = new THREE.Vector2(x, y);\r\n this._caster.setFromCamera(position, hCamera);\r\n const result = this._caster.intersectObject(this._alignments.horizontal);\r\n if (result.length) {\r\n const { index, point } = result[0];\r\n if (index === undefined)\r\n return;\r\n const geom = this._alignments.horizontal.geometry;\r\n if (!geom.index)\r\n return;\r\n const pos = geom.attributes.position;\r\n const pointIndex1 = geom.index.array[index];\r\n const pointIndex2 = geom.index.array[index + 1];\r\n const x1 = pos.getX(pointIndex1);\r\n const y1 = pos.getY(pointIndex1);\r\n const x2 = pos.getX(pointIndex2);\r\n const y2 = pos.getY(pointIndex2);\r\n const dist1 = new THREE.Vector3(x1, y1, 0).distanceTo(point);\r\n const dist2 = new THREE.Vector3(x2, y2, 0).distanceTo(point);\r\n const isFirst = dist1 < dist2;\r\n const x = isFirst ? x1 : x2;\r\n const y = isFirst ? y1 : y2;\r\n this._anchors.horizontal.set(x, y);\r\n this._anchors.horizontalIndex = isFirst ? pointIndex1 : pointIndex2;\r\n const { horizontal } = this._points;\r\n const coordsBuffer = new Float32Array([x, y, 0]);\r\n const coordsAttr = new THREE.BufferAttribute(coordsBuffer, 3);\r\n horizontal.geometry.setAttribute(\"position\", coordsAttr);\r\n let verticalIndex = -1;\r\n const alignmentIndex = this._selected.ifcCivil.horizontalAlignments.alignmentIndex;\r\n if (pointIndex1 >= alignmentIndex[alignmentIndex.length - 1]) {\r\n verticalIndex = alignmentIndex.length - 1;\r\n }\r\n else {\r\n for (let i = 0; i < alignmentIndex.length - 1; i++) {\r\n const start = alignmentIndex[i];\r\n const end = alignmentIndex[i + 1];\r\n if (pointIndex1 >= start && pointIndex1 < end) {\r\n verticalIndex = i;\r\n }\r\n }\r\n }\r\n this.getAlignmentGeometry(this._selected.ifcCivil.verticalAlignments, this._alignments.vertical.geometry, false, verticalIndex);\r\n // const { alignmentIndex } = this._selected.ifcCivil.horizontalAlignments;\r\n // let counter = 0;\r\n // for (let i = 0; i < alignmentIndex.length; i++) {\r\n // const currentAlignment = alignmentIndex[i];\r\n // if (currentAlignment > index) {\r\n // console.log(`Selected alignment: ${counter - 1}`);\r\n // break;\r\n // }\r\n // counter++;\r\n // }\r\n }\r\n });\r\n if (this.components.uiEnabled) {\r\n this.setUI();\r\n }\r\n }\r\n get() { }\r\n select(model) {\r\n if (!model.ifcCivil) {\r\n console.warn(\"The provided model doesn't have civil data!\");\r\n return;\r\n }\r\n this._selected = model;\r\n this.getAlignmentGeometry(model.ifcCivil.horizontalAlignments, this._alignments.horizontal.geometry, false);\r\n this.getAlignmentGeometry(model.ifcCivil.realAlignments, this._alignments.real.geometry, true);\r\n }\r\n setAnchor() {\r\n if (!this._selected || !this._selected.ifcCivil)\r\n return;\r\n const result = this.components.raycaster.castRay([this._selected]);\r\n if (result === null)\r\n return;\r\n this._anchors.real.copy(result.point);\r\n const { horizontal, real, horizontalIndex } = this._anchors;\r\n const position = this._alignments.real.position;\r\n const geom = this._alignments.real.geometry;\r\n const yPosition3D = geom.attributes.position.getY(horizontalIndex);\r\n position.x = real.x - horizontal.x;\r\n position.z = real.z + horizontal.y;\r\n position.y = real.y - yPosition3D;\r\n }\r\n getAlignmentGeometry(alignment, geometry, is3D, selectedIndex = -1) {\r\n const data = this.getAlignmentData(alignment, is3D, selectedIndex);\r\n const coordsBuffer = new Float32Array(data.coords);\r\n const coordsAttr = new THREE.BufferAttribute(coordsBuffer, 3);\r\n geometry.setAttribute(\"position\", coordsAttr);\r\n geometry.setIndex(data.index);\r\n }\r\n getAlignmentData(alignment, is3D, selectedIndex = -1) {\r\n const coords = [];\r\n const index = [];\r\n const { coordinates, curveIndex } = alignment;\r\n const offsetX = coordinates[0];\r\n const offsetY = coordinates[1];\r\n const offsetZ = is3D ? coordinates[2] : 0;\r\n let isSegmentStart = true;\r\n const factor = is3D ? 3 : 2;\r\n const last = coordinates.length / factor - 1;\r\n if (selectedIndex === -1) {\r\n for (let i = 0; i < curveIndex.length; i++) {\r\n const start = curveIndex[i];\r\n const isLast = i === curveIndex.length - 1;\r\n const end = isLast ? last : curveIndex[i + 1];\r\n isSegmentStart = true;\r\n for (let j = start; j < end; j++) {\r\n const x = coordinates[j * factor] - offsetX;\r\n const y = coordinates[j * factor + 1] - offsetY;\r\n const z = is3D ? coordinates[j * factor + 2] - offsetZ : 0;\r\n coords.push(x, y, z);\r\n if (isSegmentStart) {\r\n isSegmentStart = false;\r\n }\r\n else {\r\n index.push(j - 1, j);\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n let counter = 0;\r\n for (let i = 0; i < curveIndex.length; i++) {\r\n if (selectedIndex === this.currentAlignment(alignment, curveIndex[i])) {\r\n const start = curveIndex[i];\r\n const isLast = i === curveIndex.length - 1;\r\n const end = isLast ? last : curveIndex[i + 1];\r\n isSegmentStart = true;\r\n for (let j = start; j < end; j++) {\r\n const x = coordinates[j * factor] - offsetX;\r\n const y = coordinates[j * factor + 1] - offsetY;\r\n const z = is3D ? coordinates[j * factor + 2] - offsetZ : 0;\r\n coords.push(x, y, z);\r\n if (isSegmentStart) {\r\n isSegmentStart = false;\r\n }\r\n else {\r\n index.push(counter - 1, counter);\r\n }\r\n counter++;\r\n }\r\n }\r\n }\r\n }\r\n return { coords, index };\r\n }\r\n currentAlignment(alignment, curveIndex) {\r\n const last = alignment.alignmentIndex.length - 1;\r\n if (curveIndex >= alignment.alignmentIndex[last]) {\r\n return last;\r\n }\r\n for (let i = 0; i < alignment.alignmentIndex.length - 1; i++) {\r\n const start = alignment.alignmentIndex[i];\r\n const end = alignment.alignmentIndex[i + 1];\r\n if (curveIndex >= start && curveIndex < end) {\r\n return i;\r\n }\r\n }\r\n return -1;\r\n }\r\n setUI() {\r\n const horizontalAlignment = new FloatingWindow(this.components);\r\n this.components.ui.add(horizontalAlignment);\r\n horizontalAlignment.visible = false;\r\n const hContainer = this._scenes.horizontal.uiElement.get(\"container\");\r\n horizontalAlignment.addChild(hContainer);\r\n horizontalAlignment.onResized.add(() => this._scenes.horizontal.grid.regenerate());\r\n horizontalAlignment.slots.content.domElement.style.padding = \"0\";\r\n horizontalAlignment.slots.content.domElement.style.overflow = \"hidden\";\r\n horizontalAlignment.onResized.add(() => {\r\n const { width, height } = horizontalAlignment.containerSize;\r\n this._scenes.horizontal.setSize(height, width);\r\n });\r\n horizontalAlignment.domElement.style.width = \"20rem\";\r\n horizontalAlignment.domElement.style.height = \"20rem\";\r\n horizontalAlignment.onVisible.add(() => {\r\n if (horizontalAlignment.visible) {\r\n this._scenes.horizontal.grid.regenerate();\r\n }\r\n });\r\n const verticalAlignment = new Drawer(this.components);\r\n this.components.ui.add(verticalAlignment);\r\n verticalAlignment.alignment = \"top\";\r\n verticalAlignment.onVisible.add(() => {\r\n this._scenes.vertical.grid.regenerate();\r\n });\r\n verticalAlignment.visible = false;\r\n verticalAlignment.slots.content.domElement.style.padding = \"0\";\r\n verticalAlignment.slots.content.domElement.style.overflow = \"hidden\";\r\n const { clientWidth, clientHeight } = verticalAlignment.domElement;\r\n this._scenes.vertical.setSize(clientHeight, clientWidth);\r\n const vContainer = this._scenes.vertical.uiElement.get(\"container\");\r\n verticalAlignment.addChild(vContainer);\r\n if (this.components.renderer.isUpdateable()) {\r\n this.components.renderer.onAfterUpdate.add(async () => {\r\n if (horizontalAlignment.visible) {\r\n await this._scenes.horizontal.update();\r\n }\r\n if (verticalAlignment.visible) {\r\n await this._scenes.vertical.update();\r\n }\r\n });\r\n }\r\n this.uiElement.set({\r\n horizontalAlignment,\r\n verticalAlignment,\r\n });\r\n }\r\n}\r\n/** {@link Component.uuid} */\r\nRoadNavigator.uuid = \"85f2c89c-4c6b-4c7d-bc20-5b675874b228\";\r\nToolComponent.libraryUUIDs.add(RoadNavigator.uuid);\r\n//# sourceMappingURL=index.js.map"],"names":["BaseRaycaster","constructor","super","arguments","this","onDisposed","BaseRenderer","onResize","onClippingPlanesUpdated","clippingPlanes","async","trigger","togglePlane","active","plane","isLocal","index","indexOf","push","splice","get","filter","Event","data","handlers","slice","handler","add","remove","h","reset","length","Component","components","isDisposeable","isResizeable","isUpdateable","isHideable","isConfigurable","hasUI","Mouse","dom","_position","updateMouseInfo","event","_event","setupEvents","position","bounds","getBoundingClientRect","x","getPositionX","y","getPositionY","bound","clientY","top","bottom","clientX","left","right","addEventListener","removeEventListener","UIElement","_data","initError","name","Error","set","uiComponent","dispose","RoadNavigator","enabled","uiElement","_selected","_anchors","horizontal","horizontalIndex","real","_caster","params","Line","threshold","tools","uuid","_scenes","vertical","_points","size","frustumCulled","scene","_alignments","hRenderer","renderer","hCamera","camera","domElement","ifcCivil","lim","setFromCamera","result","intersectObject","point","undefined","geom","geometry","pos","attributes","pointIndex1","array","pointIndex2","x1","getX","y1","getY","x2","y2","isFirst","distanceTo","coordsBuffer","Float32Array","coordsAttr","setAttribute","verticalIndex","alignmentIndex","horizontalAlignments","i","start","end","getAlignmentGeometry","verticalAlignments","uiEnabled","setUI","select","model","realAlignments","console","warn","setAnchor","raycaster","castRay","copy","yPosition3D","z","alignment","is3D","selectedIndex","getAlignmentData","coords","setIndex","coordinates","curveIndex","offsetX","offsetY","offsetZ","isSegmentStart","factor","last","j","counter","currentAlignment","horizontalAlignment","ui","visible","hContainer","addChild","onResized","grid","regenerate","slots","content","style","padding","overflow","width","height","containerSize","setSize","onVisible","verticalAlignment","clientWidth","clientHeight","vContainer","onAfterUpdate","update"],"sourceRoot":""}