{"version":3,"sources":["node_modules/browser-pack/_prelude.js","lib/Modeler.js","lib/NavigatedViewer.js","lib/Viewer.js","lib/core/index.js","lib/draw/BpmnRenderer.js","lib/draw/PathMap.js","lib/draw/index.js","lib/features/auto-resize/BpmnAutoResize.js","lib/features/auto-resize/BpmnAutoResizeProvider.js","lib/features/auto-resize/index.js","lib/features/context-pad/ContextPadProvider.js","lib/features/context-pad/index.js","lib/features/copy-paste/BpmnCopyPaste.js","lib/features/copy-paste/index.js","lib/features/distribute-elements/BpmnDistributeElements.js","lib/features/distribute-elements/index.js","lib/features/editor-actions/BpmnEditorActions.js","lib/features/editor-actions/index.js","lib/features/global-connect/BpmnGlobalConnect.js","lib/features/global-connect/index.js","lib/features/keyboard/BpmnKeyBindings.js","lib/features/keyboard/index.js","lib/features/label-editing/LabelEditingPreview.js","lib/features/label-editing/LabelEditingProvider.js","lib/features/label-editing/LabelUtil.js","lib/features/label-editing/cmd/UpdateLabelHandler.js","lib/features/label-editing/index.js","lib/features/modeling/BpmnFactory.js","lib/features/modeling/BpmnLayouter.js","lib/features/modeling/BpmnUpdater.js","lib/features/modeling/ElementFactory.js","lib/features/modeling/Modeling.js","lib/features/modeling/behavior/AppendBehavior.js","lib/features/modeling/behavior/CopyPasteBehavior.js","lib/features/modeling/behavior/CreateBoundaryEventBehavior.js","lib/features/modeling/behavior/CreateDataObjectBehavior.js","lib/features/modeling/behavior/CreateParticipantBehavior.js","lib/features/modeling/behavior/DataInputAssociationBehavior.js","lib/features/modeling/behavior/DeleteLaneBehavior.js","lib/features/modeling/behavior/DropOnFlowBehavior.js","lib/features/modeling/behavior/ImportDockingFix.js","lib/features/modeling/behavior/LabelBehavior.js","lib/features/modeling/behavior/ModelingFeedback.js","lib/features/modeling/behavior/RemoveElementBehavior.js","lib/features/modeling/behavior/RemoveParticipantBehavior.js","lib/features/modeling/behavior/ReplaceConnectionBehavior.js","lib/features/modeling/behavior/ReplaceElementBehaviour.js","lib/features/modeling/behavior/ResizeLaneBehavior.js","lib/features/modeling/behavior/ToggleElementCollapseBehaviour.js","lib/features/modeling/behavior/UnclaimIdBehavior.js","lib/features/modeling/behavior/UnsetDefaultFlowBehavior.js","lib/features/modeling/behavior/UpdateFlowNodeRefsBehavior.js","lib/features/modeling/behavior/index.js","lib/features/modeling/behavior/util/GeometricUtil.js","lib/features/modeling/behavior/util/LabelLayoutUtil.js","lib/features/modeling/behavior/util/LineAttachmentUtil.js","lib/features/modeling/behavior/util/LineIntersect.js","lib/features/modeling/cmd/AddLaneHandler.js","lib/features/modeling/cmd/IdClaimHandler.js","lib/features/modeling/cmd/ResizeLaneHandler.js","lib/features/modeling/cmd/SetColorHandler.js","lib/features/modeling/cmd/SplitLaneHandler.js","lib/features/modeling/cmd/UpdateCanvasRootHandler.js","lib/features/modeling/cmd/UpdateFlowNodeRefsHandler.js","lib/features/modeling/cmd/UpdatePropertiesHandler.js","lib/features/modeling/index.js","lib/features/modeling/util/LaneUtil.js","lib/features/modeling/util/ModelingUtil.js","lib/features/ordering/BpmnOrderingProvider.js","lib/features/ordering/index.js","lib/features/palette/PaletteProvider.js","lib/features/palette/index.js","lib/features/popup-menu/ReplaceMenuProvider.js","lib/features/popup-menu/index.js","lib/features/popup-menu/util/TypeUtil.js","lib/features/replace-preview/BpmnReplacePreview.js","lib/features/replace-preview/index.js","lib/features/replace/BpmnReplace.js","lib/features/replace/ReplaceOptions.js","lib/features/replace/index.js","lib/features/rules/BpmnRules.js","lib/features/rules/index.js","lib/features/search/BpmnSearchProvider.js","lib/features/search/index.js","lib/features/snapping/BpmnSnapping.js","lib/features/snapping/BpmnSnappingUtil.js","lib/features/snapping/index.js","lib/import/BpmnImporter.js","lib/import/BpmnTreeWalker.js","lib/import/Importer.js","lib/import/Util.js","lib/import/index.js","lib/util/DiUtil.js","lib/util/LabelUtil.js","lib/util/ModelUtil.js","lib/util/PoweredByUtil.js","lib/util/model/ModelCloneHelper.js","lib/util/model/ModelCloneUtils.js","node_modules/bpmn-moddle/index.js","node_modules/bpmn-moddle/lib/bpmn-moddle.js","node_modules/bpmn-moddle/lib/simple.js","node_modules/bpmn-moddle/resources/bpmn-io/json/bioc.json","node_modules/bpmn-moddle/resources/bpmn/json/bpmn.json","node_modules/bpmn-moddle/resources/bpmn/json/bpmndi.json","node_modules/bpmn-moddle/resources/bpmn/json/dc.json","node_modules/bpmn-moddle/resources/bpmn/json/di.json","node_modules/component-classes/index.js","node_modules/component-closest/index.js","node_modules/component-delegate/index.js","node_modules/component-event/index.js","node_modules/component-indexof/index.js","node_modules/component-matches-selector/index.js","node_modules/component-query/index.js","node_modules/diagram-js-direct-editing/index.js","node_modules/diagram-js-direct-editing/lib/DirectEditing.js","node_modules/diagram-js-direct-editing/lib/TextBox.js","node_modules/diagram-js/index.js","node_modules/diagram-js/lib/Diagram.js","node_modules/diagram-js/lib/command/CommandInterceptor.js","node_modules/diagram-js/lib/command/CommandStack.js","node_modules/diagram-js/lib/command/index.js","node_modules/diagram-js/lib/core/Canvas.js","node_modules/diagram-js/lib/core/ElementFactory.js","node_modules/diagram-js/lib/core/ElementRegistry.js","node_modules/diagram-js/lib/core/EventBus.js","node_modules/diagram-js/lib/core/GraphicsFactory.js","node_modules/diagram-js/lib/core/index.js","node_modules/diagram-js/lib/draw/BaseRenderer.js","node_modules/diagram-js/lib/draw/DefaultRenderer.js","node_modules/diagram-js/lib/draw/Styles.js","node_modules/diagram-js/lib/draw/index.js","node_modules/diagram-js/lib/features/align-elements/AlignElements.js","node_modules/diagram-js/lib/features/align-elements/index.js","node_modules/diagram-js/lib/features/attach-support/AttachSupport.js","node_modules/diagram-js/lib/features/attach-support/index.js","node_modules/diagram-js/lib/features/auto-resize/AutoResize.js","node_modules/diagram-js/lib/features/auto-resize/AutoResizeProvider.js","node_modules/diagram-js/lib/features/auto-scroll/AutoScroll.js","node_modules/diagram-js/lib/features/auto-scroll/index.js","node_modules/diagram-js/lib/features/bendpoints/BendpointMove.js","node_modules/diagram-js/lib/features/bendpoints/BendpointSnapping.js","node_modules/diagram-js/lib/features/bendpoints/BendpointUtil.js","node_modules/diagram-js/lib/features/bendpoints/Bendpoints.js","node_modules/diagram-js/lib/features/bendpoints/ConnectionSegmentMove.js","node_modules/diagram-js/lib/features/bendpoints/index.js","node_modules/diagram-js/lib/features/change-support/ChangeSupport.js","node_modules/diagram-js/lib/features/change-support/index.js","node_modules/diagram-js/lib/features/clipboard/Clipboard.js","node_modules/diagram-js/lib/features/clipboard/index.js","node_modules/diagram-js/lib/features/connect/Connect.js","node_modules/diagram-js/lib/features/connect/index.js","node_modules/diagram-js/lib/features/context-pad/ContextPad.js","node_modules/diagram-js/lib/features/context-pad/index.js","node_modules/diagram-js/lib/features/copy-paste/CopyPaste.js","node_modules/diagram-js/lib/features/copy-paste/index.js","node_modules/diagram-js/lib/features/create/Create.js","node_modules/diagram-js/lib/features/create/index.js","node_modules/diagram-js/lib/features/distribute-elements/DistributeElements.js","node_modules/diagram-js/lib/features/distribute-elements/index.js","node_modules/diagram-js/lib/features/dragging/Dragging.js","node_modules/diagram-js/lib/features/dragging/HoverFix.js","node_modules/diagram-js/lib/features/dragging/index.js","node_modules/diagram-js/lib/features/editor-actions/EditorActions.js","node_modules/diagram-js/lib/features/editor-actions/index.js","node_modules/diagram-js/lib/features/global-connect/GlobalConnect.js","node_modules/diagram-js/lib/features/global-connect/index.js","node_modules/diagram-js/lib/features/hand-tool/HandTool.js","node_modules/diagram-js/lib/features/hand-tool/index.js","node_modules/diagram-js/lib/features/interaction-events/InteractionEvents.js","node_modules/diagram-js/lib/features/interaction-events/index.js","node_modules/diagram-js/lib/features/keyboard/Keyboard.js","node_modules/diagram-js/lib/features/keyboard/index.js","node_modules/diagram-js/lib/features/label-support/LabelSupport.js","node_modules/diagram-js/lib/features/label-support/index.js","node_modules/diagram-js/lib/features/lasso-tool/LassoTool.js","node_modules/diagram-js/lib/features/lasso-tool/index.js","node_modules/diagram-js/lib/features/modeling/Modeling.js","node_modules/diagram-js/lib/features/modeling/cmd/AlignElementsHandler.js","node_modules/diagram-js/lib/features/modeling/cmd/AppendShapeHandler.js","node_modules/diagram-js/lib/features/modeling/cmd/CreateConnectionHandler.js","node_modules/diagram-js/lib/features/modeling/cmd/CreateLabelHandler.js","node_modules/diagram-js/lib/features/modeling/cmd/CreateShapeHandler.js","node_modules/diagram-js/lib/features/modeling/cmd/DeleteConnectionHandler.js","node_modules/diagram-js/lib/features/modeling/cmd/DeleteElementsHandler.js","node_modules/diagram-js/lib/features/modeling/cmd/DeleteShapeHandler.js","node_modules/diagram-js/lib/features/modeling/cmd/DistributeElementsHandler.js","node_modules/diagram-js/lib/features/modeling/cmd/LayoutConnectionHandler.js","node_modules/diagram-js/lib/features/modeling/cmd/MoveConnectionHandler.js","node_modules/diagram-js/lib/features/modeling/cmd/MoveElementsHandler.js","node_modules/diagram-js/lib/features/modeling/cmd/MoveShapeHandler.js","node_modules/diagram-js/lib/features/modeling/cmd/NoopHandler.js","node_modules/diagram-js/lib/features/modeling/cmd/PasteHandler.js","node_modules/diagram-js/lib/features/modeling/cmd/ReconnectConnectionHandler.js","node_modules/diagram-js/lib/features/modeling/cmd/ReplaceShapeHandler.js","node_modules/diagram-js/lib/features/modeling/cmd/ResizeShapeHandler.js","node_modules/diagram-js/lib/features/modeling/cmd/SpaceToolHandler.js","node_modules/diagram-js/lib/features/modeling/cmd/ToggleShapeCollapseHandler.js","node_modules/diagram-js/lib/features/modeling/cmd/UpdateAttachmentHandler.js","node_modules/diagram-js/lib/features/modeling/cmd/UpdateWaypointsHandler.js","node_modules/diagram-js/lib/features/modeling/cmd/helper/AnchorsHelper.js","node_modules/diagram-js/lib/features/modeling/cmd/helper/MoveHelper.js","node_modules/diagram-js/lib/features/mouse-tracking/MouseTracking.js","node_modules/diagram-js/lib/features/mouse-tracking/index.js","node_modules/diagram-js/lib/features/move/Move.js","node_modules/diagram-js/lib/features/move/MovePreview.js","node_modules/diagram-js/lib/features/move/index.js","node_modules/diagram-js/lib/features/ordering/OrderingProvider.js","node_modules/diagram-js/lib/features/outline/Outline.js","node_modules/diagram-js/lib/features/outline/index.js","node_modules/diagram-js/lib/features/overlays/Overlays.js","node_modules/diagram-js/lib/features/overlays/index.js","node_modules/diagram-js/lib/features/palette/Palette.js","node_modules/diagram-js/lib/features/palette/index.js","node_modules/diagram-js/lib/features/popup-menu/PopupMenu.js","node_modules/diagram-js/lib/features/popup-menu/index.js","node_modules/diagram-js/lib/features/preview-support/PreviewSupport.js","node_modules/diagram-js/lib/features/preview-support/index.js","node_modules/diagram-js/lib/features/replace/Replace.js","node_modules/diagram-js/lib/features/replace/index.js","node_modules/diagram-js/lib/features/resize/Resize.js","node_modules/diagram-js/lib/features/resize/ResizeHandles.js","node_modules/diagram-js/lib/features/resize/ResizePreview.js","node_modules/diagram-js/lib/features/resize/ResizeUtil.js","node_modules/diagram-js/lib/features/resize/index.js","node_modules/diagram-js/lib/features/rules/RuleProvider.js","node_modules/diagram-js/lib/features/rules/Rules.js","node_modules/diagram-js/lib/features/rules/index.js","node_modules/diagram-js/lib/features/search-pad/SearchPad.js","node_modules/diagram-js/lib/features/search-pad/index.js","node_modules/diagram-js/lib/features/selection/Selection.js","node_modules/diagram-js/lib/features/selection/SelectionBehavior.js","node_modules/diagram-js/lib/features/selection/SelectionVisuals.js","node_modules/diagram-js/lib/features/selection/index.js","node_modules/diagram-js/lib/features/snapping/SnapContext.js","node_modules/diagram-js/lib/features/snapping/SnapUtil.js","node_modules/diagram-js/lib/features/snapping/Snapping.js","node_modules/diagram-js/lib/features/space-tool/SpaceTool.js","node_modules/diagram-js/lib/features/space-tool/SpaceToolPreview.js","node_modules/diagram-js/lib/features/space-tool/SpaceUtil.js","node_modules/diagram-js/lib/features/space-tool/index.js","node_modules/diagram-js/lib/features/tool-manager/ToolManager.js","node_modules/diagram-js/lib/features/tool-manager/index.js","node_modules/diagram-js/lib/features/tooltips/Tooltips.js","node_modules/diagram-js/lib/features/tooltips/index.js","node_modules/diagram-js/lib/features/touch/TouchFix.js","node_modules/diagram-js/lib/features/touch/TouchInteractionEvents.js","node_modules/diagram-js/lib/features/touch/index.js","node_modules/diagram-js/lib/i18n/translate/index.js","node_modules/diagram-js/lib/i18n/translate/translate.js","node_modules/diagram-js/lib/layout/BaseLayouter.js","node_modules/diagram-js/lib/layout/CroppingConnectionDocking.js","node_modules/diagram-js/lib/layout/LayoutUtil.js","node_modules/diagram-js/lib/layout/ManhattanLayout.js","node_modules/diagram-js/lib/model/index.js","node_modules/diagram-js/lib/navigation/movecanvas/MoveCanvas.js","node_modules/diagram-js/lib/navigation/movecanvas/index.js","node_modules/diagram-js/lib/navigation/touch/index.js","node_modules/diagram-js/lib/navigation/zoomscroll/ZoomScroll.js","node_modules/diagram-js/lib/navigation/zoomscroll/ZoomUtil.js","node_modules/diagram-js/lib/navigation/zoomscroll/index.js","node_modules/diagram-js/lib/util/AttachUtil.js","node_modules/diagram-js/lib/util/ClickTrap.js","node_modules/diagram-js/lib/util/Collections.js","node_modules/diagram-js/lib/util/CopyPasteUtil.js","node_modules/diagram-js/lib/util/Cursor.js","node_modules/diagram-js/lib/util/Elements.js","node_modules/diagram-js/lib/util/Event.js","node_modules/diagram-js/lib/util/Geometry.js","node_modules/diagram-js/lib/util/GraphicsUtil.js","node_modules/diagram-js/lib/util/IdGenerator.js","node_modules/diagram-js/lib/util/Intersection.js","node_modules/diagram-js/lib/util/LineIntersection.js","node_modules/diagram-js/lib/util/Math.js","node_modules/diagram-js/lib/util/Mouse.js","node_modules/diagram-js/lib/util/Platform.js","node_modules/diagram-js/lib/util/PositionUtil.js","node_modules/diagram-js/lib/util/Removal.js","node_modules/diagram-js/lib/util/RenderUtil.js","node_modules/diagram-js/lib/util/SvgTransformUtil.js","node_modules/diagram-js/lib/util/Text.js","node_modules/didi/lib/annotation.js","node_modules/didi/lib/index.js","node_modules/didi/lib/injector.js","node_modules/didi/lib/module.js","node_modules/domify/index.js","node_modules/hammerjs/hammer.js","node_modules/hat/index.js","node_modules/ids/index.js","node_modules/inherits/inherits_browser.js","node_modules/lodash/array/findIndex.js","node_modules/lodash/array/flatten.js","node_modules/lodash/array/intersection.js","node_modules/lodash/array/last.js","node_modules/lodash/array/union.js","node_modules/lodash/array/uniq.js","node_modules/lodash/array/unique.js","node_modules/lodash/array/without.js","node_modules/lodash/chain/lodash.js","node_modules/lodash/collection/any.js","node_modules/lodash/collection/every.js","node_modules/lodash/collection/filter.js","node_modules/lodash/collection/find.js","node_modules/lodash/collection/forEach.js","node_modules/lodash/collection/groupBy.js","node_modules/lodash/collection/map.js","node_modules/lodash/collection/reduce.js","node_modules/lodash/collection/reject.js","node_modules/lodash/collection/size.js","node_modules/lodash/collection/some.js","node_modules/lodash/collection/sortBy.js","node_modules/lodash/date/now.js","node_modules/lodash/function/bind.js","node_modules/lodash/function/debounce.js","node_modules/lodash/function/defer.js","node_modules/lodash/function/restParam.js","node_modules/lodash/internal/LazyWrapper.js","node_modules/lodash/internal/LodashWrapper.js","node_modules/lodash/internal/SetCache.js","node_modules/lodash/internal/arrayCopy.js","node_modules/lodash/internal/arrayEach.js","node_modules/lodash/internal/arrayEvery.js","node_modules/lodash/internal/arrayFilter.js","node_modules/lodash/internal/arrayMap.js","node_modules/lodash/internal/arrayPush.js","node_modules/lodash/internal/arrayReduce.js","node_modules/lodash/internal/arraySome.js","node_modules/lodash/internal/assignWith.js","node_modules/lodash/internal/baseAssign.js","node_modules/lodash/internal/baseCallback.js","node_modules/lodash/internal/baseClone.js","node_modules/lodash/internal/baseCompareAscending.js","node_modules/lodash/internal/baseCopy.js","node_modules/lodash/internal/baseCreate.js","node_modules/lodash/internal/baseDelay.js","node_modules/lodash/internal/baseDifference.js","node_modules/lodash/internal/baseEach.js","node_modules/lodash/internal/baseEvery.js","node_modules/lodash/internal/baseFilter.js","node_modules/lodash/internal/baseFind.js","node_modules/lodash/internal/baseFindIndex.js","node_modules/lodash/internal/baseFlatten.js","node_modules/lodash/internal/baseFor.js","node_modules/lodash/internal/baseForIn.js","node_modules/lodash/internal/baseForOwn.js","node_modules/lodash/internal/baseGet.js","node_modules/lodash/internal/baseIndexOf.js","node_modules/lodash/internal/baseIsEqual.js","node_modules/lodash/internal/baseIsEqualDeep.js","node_modules/lodash/internal/baseIsMatch.js","node_modules/lodash/internal/baseLodash.js","node_modules/lodash/internal/baseMap.js","node_modules/lodash/internal/baseMatches.js","node_modules/lodash/internal/baseMatchesProperty.js","node_modules/lodash/internal/baseMerge.js","node_modules/lodash/internal/baseMergeDeep.js","node_modules/lodash/internal/baseProperty.js","node_modules/lodash/internal/basePropertyDeep.js","node_modules/lodash/internal/baseReduce.js","node_modules/lodash/internal/baseSetData.js","node_modules/lodash/internal/baseSlice.js","node_modules/lodash/internal/baseSome.js","node_modules/lodash/internal/baseSortBy.js","node_modules/lodash/internal/baseToString.js","node_modules/lodash/internal/baseUniq.js","node_modules/lodash/internal/baseValues.js","node_modules/lodash/internal/bindCallback.js","node_modules/lodash/internal/bufferClone.js","node_modules/lodash/internal/cacheIndexOf.js","node_modules/lodash/internal/cachePush.js","node_modules/lodash/internal/compareAscending.js","node_modules/lodash/internal/composeArgs.js","node_modules/lodash/internal/composeArgsRight.js","node_modules/lodash/internal/createAggregator.js","node_modules/lodash/internal/createAssigner.js","node_modules/lodash/internal/createBaseEach.js","node_modules/lodash/internal/createBaseFor.js","node_modules/lodash/internal/createBindWrapper.js","node_modules/lodash/internal/createCache.js","node_modules/lodash/internal/createCtorWrapper.js","node_modules/lodash/internal/createFind.js","node_modules/lodash/internal/createFindIndex.js","node_modules/lodash/internal/createForEach.js","node_modules/lodash/internal/createHybridWrapper.js","node_modules/lodash/internal/createPartialWrapper.js","node_modules/lodash/internal/createReduce.js","node_modules/lodash/internal/createWrapper.js","node_modules/lodash/internal/equalArrays.js","node_modules/lodash/internal/equalByTag.js","node_modules/lodash/internal/equalObjects.js","node_modules/lodash/internal/getData.js","node_modules/lodash/internal/getFuncName.js","node_modules/lodash/internal/getLength.js","node_modules/lodash/internal/getMatchData.js","node_modules/lodash/internal/getNative.js","node_modules/lodash/internal/indexOfNaN.js","node_modules/lodash/internal/initCloneArray.js","node_modules/lodash/internal/initCloneByTag.js","node_modules/lodash/internal/initCloneObject.js","node_modules/lodash/internal/isArrayLike.js","node_modules/lodash/internal/isIndex.js","node_modules/lodash/internal/isIterateeCall.js","node_modules/lodash/internal/isKey.js","node_modules/lodash/internal/isLaziable.js","node_modules/lodash/internal/isLength.js","node_modules/lodash/internal/isObjectLike.js","node_modules/lodash/internal/isStrictComparable.js","node_modules/lodash/internal/mergeData.js","node_modules/lodash/internal/metaMap.js","node_modules/lodash/internal/pickByArray.js","node_modules/lodash/internal/pickByCallback.js","node_modules/lodash/internal/realNames.js","node_modules/lodash/internal/reorder.js","node_modules/lodash/internal/replaceHolders.js","node_modules/lodash/internal/setData.js","node_modules/lodash/internal/shimKeys.js","node_modules/lodash/internal/sortedUniq.js","node_modules/lodash/internal/toObject.js","node_modules/lodash/internal/toPath.js","node_modules/lodash/internal/wrapperClone.js","node_modules/lodash/lang/clone.js","node_modules/lodash/lang/isArguments.js","node_modules/lodash/lang/isArray.js","node_modules/lodash/lang/isFunction.js","node_modules/lodash/lang/isNative.js","node_modules/lodash/lang/isNumber.js","node_modules/lodash/lang/isObject.js","node_modules/lodash/lang/isPlainObject.js","node_modules/lodash/lang/isString.js","node_modules/lodash/lang/isTypedArray.js","node_modules/lodash/lang/toPlainObject.js","node_modules/lodash/object/assign.js","node_modules/lodash/object/has.js","node_modules/lodash/object/keys.js","node_modules/lodash/object/keysIn.js","node_modules/lodash/object/merge.js","node_modules/lodash/object/omit.js","node_modules/lodash/object/pairs.js","node_modules/lodash/object/pick.js","node_modules/lodash/object/transform.js","node_modules/lodash/object/values.js","node_modules/lodash/utility/identity.js","node_modules/lodash/utility/noop.js","node_modules/lodash/utility/property.js","node_modules/min-dom/lib/attr.js","node_modules/min-dom/lib/classes.js","node_modules/min-dom/lib/clear.js","node_modules/min-dom/lib/closest.js","node_modules/min-dom/lib/delegate.js","node_modules/min-dom/lib/domify.js","node_modules/min-dom/lib/event.js","node_modules/min-dom/lib/matches.js","node_modules/min-dom/lib/query.js","node_modules/min-dom/lib/remove.js","node_modules/moddle-xml/lib/common.js","node_modules/moddle-xml/lib/reader.js","node_modules/moddle-xml/lib/writer.js","node_modules/moddle/index.js","node_modules/moddle/lib/base.js","node_modules/moddle/lib/descriptor-builder.js","node_modules/moddle/lib/factory.js","node_modules/moddle/lib/moddle.js","node_modules/moddle/lib/ns.js","node_modules/moddle/lib/properties.js","node_modules/moddle/lib/registry.js","node_modules/moddle/lib/types.js","node_modules/object-refs/index.js","node_modules/object-refs/lib/collection.js","node_modules/object-refs/lib/refs.js","node_modules/saxen/decode.js","node_modules/saxen/parser.js","node_modules/tiny-stack/lib/tiny-stack.js","node_modules/tiny-svg/lib/append.js","node_modules/tiny-svg/lib/appendTo.js","node_modules/tiny-svg/lib/attr.js","node_modules/tiny-svg/lib/classes.js","node_modules/tiny-svg/lib/clear.js","node_modules/tiny-svg/lib/clone.js","node_modules/tiny-svg/lib/create.js","node_modules/tiny-svg/lib/geometry.js","node_modules/tiny-svg/lib/innerSVG.js","node_modules/tiny-svg/lib/remove.js","node_modules/tiny-svg/lib/transform.js","node_modules/tiny-svg/lib/util/ensureImported.js","node_modules/tiny-svg/lib/util/ns.js","node_modules/tiny-svg/lib/util/parse.js","node_modules/tiny-svg/lib/util/serialize.js"],"names":[],"mappings":";;;;;;;;;;;;AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpfA;AACA;AACA;AACA;AACA;AACA;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACx5DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9dA;AACA;AACA;AACA;AACA;AACA;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnDA;AACA;AACA;AACA;AACA;AACA;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7JA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpSA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/LA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACprBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1NA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9NA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1IA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5JA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1NA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7JA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnJA;AACA;AACA;AACA;AACA;AACA;AACA;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9JA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/dA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjHA;AACA;AACA;AACA;AACA;AACA;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvyBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/fA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/JA;AACA;AACA;AACA;;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9SA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7bA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACRA;AACA;AACA;AACA;AACA;AACA;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3IA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnCA;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACx4FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7OA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/LA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClCA;AACA;AACA;AACA;AACA;AACA;AACA;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrBA;AACA;AACA;AACA;AACA;;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzbA;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtfA;AACA;AACA;AACA;;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1gCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3EA;AACA;AACA;AACA;AACA;AACA;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5KA;AACA;AACA;AACA;AACA;AACA;AACA;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnSA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9IA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1QA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7RA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7DA;AACA;AACA;AACA;;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5BA;AACA;AACA;AACA;;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7SA;AACA;AACA;AACA;AACA;AACA;AACA;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5cA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzNA;AACA;AACA;AACA;AACA;AACA;AACA;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5fA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1SA;AACA;AACA;AACA;;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzTA;AACA;AACA;AACA;AACA;;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5PA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/aA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3JA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3RA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5JA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3DA;AACA;AACA;AACA;AACA;AACA;AACA;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9NA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1NA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzHA;AACA;AACA;AACA;AACA;AACA;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7nBA;AACA;AACA;AACA;;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClbA;AACA;AACA;AACA;AACA;AACA;AACA;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtHA;AACA;AACA;AACA;AACA;AACA;AACA;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/CA;AACA;AACA;AACA;AACA;AACA;AACA;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7LA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7KA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjDA;AACA;AACA;AACA;AACA;;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpiBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5RA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9QA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3WA;AACA;AACA;AACA;;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzUA;AACA;AACA;AACA;AACA;AACA;;ACLA;AACA;AACA;;ACFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5LA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/eA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/FA;AACA;AACA;AACA;;ACHA;AACA;AACA;;ACFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzBA;AACA;AACA;AACA;;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxSA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACh3CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrCA;AACA;AACA;AACA;AACA;;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5UA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChDA;AACA;AACA;AACA;AACA;AACA;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnlFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvEA;AACA;;ACDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7HA;AACA;;ACDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACrBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AC7BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACvCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACrBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AC/GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AC3CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACzFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtBA;AACA;AACA;AACA;AACA;;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxBA;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACVA;;ACAA;;ACAA;;ACAA;;ACAA;;ACAA;;ACAA;AACA;AACA;;ACFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtyBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACntBA;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/NA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3MA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjDA;AACA;AACA;;ACFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9LA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC13BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7MA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvBA;AACA;AACA;AACA;AACA;;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACdA;AACA;AACA;AACA;AACA;;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o' +\n '' +\n '' +\n '' +\n '' +\n '' +\n '' +\n '' +\n '' +\n '' +\n '' +\n '' +\n '';\n\n\n/**\n * A modeler for BPMN 2.0 diagrams.\n *\n *\n * ## Extending the Modeler\n *\n * In order to extend the viewer pass extension modules to bootstrap via the\n * `additionalModules` option. An extension module is an object that exposes\n * named services.\n *\n * The following example depicts the integration of a simple\n * logging component that integrates with interaction events:\n *\n *\n * ```javascript\n *\n * // logging component\n * function InteractionLogger(eventBus) {\n * eventBus.on('element.hover', function(event) {\n * console.log()\n * })\n * }\n *\n * InteractionLogger.$inject = [ 'eventBus' ]; // minification save\n *\n * // extension module\n * var extensionModule = {\n * __init__: [ 'interactionLogger' ],\n * interactionLogger: [ 'type', InteractionLogger ]\n * };\n *\n * // extend the viewer\n * var bpmnModeler = new Modeler({ additionalModules: [ extensionModule ] });\n * bpmnModeler.importXML(...);\n * ```\n *\n *\n * ## Customizing / Replacing Components\n *\n * You can replace individual diagram components by redefining them in override modules.\n * This works for all components, including those defined in the core.\n *\n * Pass in override modules via the `options.additionalModules` flag like this:\n *\n * ```javascript\n * function CustomContextPadProvider(contextPad) {\n *\n * contextPad.registerProvider(this);\n *\n * this.getContextPadEntries = function(element) {\n * // no entries, effectively disable the context pad\n * return {};\n * };\n * }\n *\n * CustomContextPadProvider.$inject = [ 'contextPad' ];\n *\n * var overrideModule = {\n * contextPadProvider: [ 'type', CustomContextPadProvider ]\n * };\n *\n * var bpmnModeler = new Modeler({ additionalModules: [ overrideModule ]});\n * ```\n *\n * @param {Object} [options] configuration options to pass to the viewer\n * @param {DOMElement} [options.container] the container to render the viewer in, defaults to body.\n * @param {String|Number} [options.width] the width of the viewer\n * @param {String|Number} [options.height] the height of the viewer\n * @param {Object} [options.moddleExtensions] extension packages to provide\n * @param {Array} [options.modules] a list of modules to override the default modules\n * @param {Array} [options.additionalModules] a list of modules to use with the default modules\n */\nfunction Modeler(options) {\n Viewer.call(this, options);\n\n // hook ID collection into the modeler\n this.on('import.parse.complete', function(event) {\n if (!event.error) {\n this._collectIds(event.definitions, event.context);\n }\n }, this);\n\n this.on('diagram.destroy', function() {\n this.get('moddle').ids.clear();\n }, this);\n}\n\ninherits(Modeler, Viewer);\n\nmodule.exports = Modeler;\n\nmodule.exports.Viewer = Viewer;\n\nmodule.exports.NavigatedViewer = NavigatedViewer;\n\n/**\n * Create a new diagram to start modeling.\n *\n * @param {Function} [done]\n */\nModeler.prototype.createDiagram = function(done) {\n return this.importXML(initialDiagram, done);\n};\n\n/**\n * Create a moddle instance, attaching ids to it.\n *\n * @param {Object} options\n */\nModeler.prototype._createModdle = function(options) {\n var moddle = Viewer.prototype._createModdle.call(this, options);\n\n // attach ids to moddle to be able to track\n // and validated ids in the BPMN 2.0 XML document\n // tree\n moddle.ids = new Ids([ 32, 36, 1 ]);\n\n return moddle;\n};\n\n/**\n * Collect ids processed during parsing of the\n * definitions object.\n *\n * @param {ModdleElement} definitions\n * @param {Context} context\n */\nModeler.prototype._collectIds = function(definitions, context) {\n\n var moddle = definitions.$model,\n ids = moddle.ids,\n id;\n\n // remove references from previous import\n ids.clear();\n\n for (id in context.elementsById) {\n ids.claim(id, context.elementsById[id]);\n }\n};\n\n\nModeler.prototype._interactionModules = [\n // non-modeling components\n require(256),\n require(257),\n require(260)\n];\n\nModeler.prototype._modelingModules = [\n // modeling components\n require(139),\n require(145),\n require(206),\n require(224),\n require(10),\n require(18),\n require(12),\n require(22),\n require(27),\n require(66),\n require(72),\n require(77),\n require(87)\n];\n\n\n// modules the modeler is composed of\n//\n// - viewer modules\n// - interaction modules\n// - modeling modules\n\nModeler.prototype._modules = [].concat(\n Modeler.prototype._modules,\n Modeler.prototype._interactionModules,\n Modeler.prototype._modelingModules);\n","'use strict';\n\nvar inherits = require(289);\n\nvar Viewer = require(3);\n\n\n/**\n * A viewer that includes mouse navigation facilities\n *\n * @param {Object} options\n */\nfunction NavigatedViewer(options) {\n Viewer.call(this, options);\n}\n\ninherits(NavigatedViewer, Viewer);\n\nmodule.exports = NavigatedViewer;\n\nNavigatedViewer.prototype._navigationModules = [\n require(260),\n require(256)\n];\n\nNavigatedViewer.prototype._modules = [].concat(\n NavigatedViewer.prototype._modules,\n NavigatedViewer.prototype._navigationModules);","/**\n * The code in the area\n * must not be changed.\n *\n * @see http://bpmn.io/license for more information.\n */\n'use strict';\n\nvar assign = require(431),\n omit = require(436),\n isNumber = require(425);\n\nvar domify = require(449),\n domQuery = require(452),\n domRemove = require(453);\n\nvar innerSVG = require(480);\n\nvar Diagram = require(117),\n BpmnModdle = require(99);\n\n\nvar inherits = require(289);\n\nvar Importer = require(90);\n\n\nfunction checkValidationError(err) {\n\n // check if we can help the user by indicating wrong BPMN 2.0 xml\n // (in case he or the exporting tool did not get that right)\n\n var pattern = /unparsable content <([^>]+)> detected([/s/S]*)$/;\n var match = pattern.exec(err.message);\n\n if (match) {\n err.message =\n 'unparsable content <' + match[1] + '> detected; ' +\n 'this may indicate an invalid BPMN 2.0 diagram file' + match[2];\n }\n\n return err;\n}\n\nvar DEFAULT_OPTIONS = {\n width: '100%',\n height: '100%',\n position: 'relative'\n};\n\n\n/**\n * Ensure the passed argument is a proper unit (defaulting to px)\n */\nfunction ensureUnit(val) {\n return val + (isNumber(val) ? 'px' : '');\n}\n\n/**\n * A viewer for BPMN 2.0 diagrams.\n *\n * Have a look at {@link NavigatedViewer} or {@link Modeler} for bundles that include\n * additional features.\n *\n *\n * ## Extending the Viewer\n *\n * In order to extend the viewer pass extension modules to bootstrap via the\n * `additionalModules` option. An extension module is an object that exposes\n * named services.\n *\n * The following example depicts the integration of a simple\n * logging component that integrates with interaction events:\n *\n *\n * ```javascript\n *\n * // logging component\n * function InteractionLogger(eventBus) {\n * eventBus.on('element.hover', function(event) {\n * console.log()\n * })\n * }\n *\n * InteractionLogger.$inject = [ 'eventBus' ]; // minification save\n *\n * // extension module\n * var extensionModule = {\n * __init__: [ 'interactionLogger' ],\n * interactionLogger: [ 'type', InteractionLogger ]\n * };\n *\n * // extend the viewer\n * var bpmnViewer = new Viewer({ additionalModules: [ extensionModule ] });\n * bpmnViewer.importXML(...);\n * ```\n *\n * @param {Object} [options] configuration options to pass to the viewer\n * @param {DOMElement} [options.container] the container to render the viewer in, defaults to body.\n * @param {String|Number} [options.width] the width of the viewer\n * @param {String|Number} [options.height] the height of the viewer\n * @param {Object} [options.moddleExtensions] extension packages to provide\n * @param {Array} [options.modules] a list of modules to override the default modules\n * @param {Array} [options.additionalModules] a list of modules to use with the default modules\n */\nfunction Viewer(options) {\n\n options = assign({}, DEFAULT_OPTIONS, options);\n\n this._moddle = this._createModdle(options);\n\n this._container = this._createContainer(options);\n\n /* */\n\n addProjectLogo(this._container);\n\n /* */\n\n this._init(this._container, this._moddle, options);\n}\n\ninherits(Viewer, Diagram);\n\nmodule.exports = Viewer;\n\n\n/**\n * Parse and render a BPMN 2.0 diagram.\n *\n * Once finished the viewer reports back the result to the\n * provided callback function with (err, warnings).\n *\n * ## Life-Cycle Events\n *\n * During import the viewer will fire life-cycle events:\n *\n * * import.parse.start (about to read model from xml)\n * * import.parse.complete (model read; may have worked or not)\n * * import.render.start (graphical import start)\n * * import.render.complete (graphical import finished)\n * * import.done (everything done)\n *\n * You can use these events to hook into the life-cycle.\n *\n * @param {String} xml the BPMN 2.0 xml\n * @param {Function} [done] invoked with (err, warnings=[])\n */\nViewer.prototype.importXML = function(xml, done) {\n\n // done is optional\n done = done || function() {};\n\n var self = this;\n\n // hook in pre-parse listeners +\n // allow xml manipulation\n xml = this._emit('import.parse.start', { xml: xml }) || xml;\n\n this._moddle.fromXML(xml, 'bpmn:Definitions', function(err, definitions, context) {\n\n // hook in post parse listeners +\n // allow definitions manipulation\n definitions = self._emit('import.parse.complete', {\n error: err,\n definitions: definitions,\n context: context\n }) || definitions;\n\n var parseWarnings = context.warnings;\n\n if (err) {\n err = checkValidationError(err);\n\n self._emit('import.done', { error: err, warnings: parseWarnings });\n\n return done(err, parseWarnings);\n }\n\n self.importDefinitions(definitions, function(err, importWarnings) {\n var allWarnings = [].concat(parseWarnings, importWarnings || []);\n\n self._emit('import.done', { error: err, warnings: allWarnings });\n\n done(err, allWarnings);\n });\n });\n};\n\n/**\n * Export the currently displayed BPMN 2.0 diagram as\n * a BPMN 2.0 XML document.\n *\n * @param {Object} [options] export options\n * @param {Boolean} [options.format=false] output formated XML\n * @param {Boolean} [options.preamble=true] output preamble\n *\n * @param {Function} done invoked with (err, xml)\n */\nViewer.prototype.saveXML = function(options, done) {\n\n if (!done) {\n done = options;\n options = {};\n }\n\n var definitions = this._definitions;\n\n if (!definitions) {\n return done(new Error('no definitions loaded'));\n }\n\n this._moddle.toXML(definitions, options, done);\n};\n\n/**\n * Export the currently displayed BPMN 2.0 diagram as\n * an SVG image.\n *\n * @param {Object} [options]\n * @param {Function} done invoked with (err, svgStr)\n */\nViewer.prototype.saveSVG = function(options, done) {\n\n if (!done) {\n done = options;\n options = {};\n }\n\n var canvas = this.get('canvas');\n\n var contentNode = canvas.getDefaultLayer(),\n defsNode = domQuery('defs', canvas._svg);\n\n var contents = innerSVG(contentNode),\n defs = defsNode ? '' + innerSVG(defsNode) + '' : '';\n\n var bbox = contentNode.getBBox();\n\n var svg =\n '/n' +\n '/n' +\n '/n' +\n '' +\n defs + contents +\n '';\n\n done(null, svg);\n};\n\n/**\n * Get a named diagram service.\n *\n * @example\n *\n * var elementRegistry = viewer.get('elementRegistry');\n * var startEventShape = elementRegistry.get('StartEvent_1');\n *\n * @param {String} name\n *\n * @return {Object} diagram service instance\n *\n * @method Viewer#get\n */\n\n/**\n * Invoke a function in the context of this viewer.\n *\n * @example\n *\n * viewer.invoke(function(elementRegistry) {\n * var startEventShape = elementRegistry.get('StartEvent_1');\n * });\n *\n * @param {Function} fn to be invoked\n *\n * @return {Object} the functions return value\n *\n * @method Viewer#invoke\n */\n\n/**\n * Remove all drawn elements from the viewer.\n *\n * After calling this method the viewer can still\n * be reused for opening another diagram.\n *\n * @method Viewer#clear\n */\n\nViewer.prototype.importDefinitions = function(definitions, done) {\n\n // use try/catch to not swallow synchronous exceptions\n // that may be raised during model parsing\n try {\n\n if (this._definitions) {\n // clear existing rendered diagram\n this.clear();\n }\n\n // update definitions\n this._definitions = definitions;\n\n // perform graphical import\n Importer.importBpmnDiagram(this, definitions, done);\n } catch (e) {\n\n // handle synchronous errors\n done(e);\n }\n};\n\nViewer.prototype.getModules = function() {\n return this._modules;\n};\n\n/**\n * Destroy the viewer instance and remove all its\n * remainders from the document tree.\n */\nViewer.prototype.destroy = function() {\n\n // diagram destroy\n Diagram.prototype.destroy.call(this);\n\n // dom detach\n domRemove(this._container);\n};\n\n/**\n * Register an event listener\n *\n * Remove a previously added listener via {@link #off(event, callback)}.\n *\n * @param {String} event\n * @param {Number} [priority]\n * @param {Function} callback\n * @param {Object} [that]\n */\nViewer.prototype.on = function(event, priority, callback, target) {\n return this.get('eventBus').on(event, priority, callback, target);\n};\n\n/**\n * De-register an event listener\n *\n * @param {String} event\n * @param {Function} callback\n */\nViewer.prototype.off = function(event, callback) {\n this.get('eventBus').off(event, callback);\n};\n\nViewer.prototype.attachTo = function(parentNode) {\n\n if (!parentNode) {\n throw new Error('parentNode required');\n }\n\n // ensure we detach from the\n // previous, old parent\n this.detach();\n\n // unwrap jQuery if provided\n if (parentNode.get && parentNode.constructor.prototype.jquery) {\n parentNode = parentNode.get(0);\n }\n\n if (typeof parentNode === 'string') {\n parentNode = domQuery(parentNode);\n }\n\n parentNode.appendChild(this._container);\n\n this._emit('attach', {});\n};\n\nViewer.prototype.detach = function() {\n\n var container = this._container,\n parentNode = container.parentNode;\n\n if (!parentNode) {\n return;\n }\n\n this._emit('detach', {});\n\n parentNode.removeChild(container);\n};\n\nViewer.prototype._init = function(container, moddle, options) {\n\n var baseModules = options.modules || this.getModules(),\n additionalModules = options.additionalModules || [],\n staticModules = [\n {\n bpmnjs: [ 'value', this ],\n moddle: [ 'value', moddle ]\n }\n ];\n\n var diagramModules = [].concat(staticModules, baseModules, additionalModules);\n\n var diagramOptions = assign(omit(options, 'additionalModules'), {\n canvas: assign({}, options.canvas, { container: container }),\n modules: diagramModules\n });\n\n // invoke diagram constructor\n Diagram.call(this, diagramOptions);\n\n if (options && options.container) {\n this.attachTo(options.container);\n }\n};\n\n/**\n * Emit an event on the underlying {@link EventBus}\n *\n * @param {String} type\n * @param {Object} event\n *\n * @return {Object} event processing result (if any)\n */\nViewer.prototype._emit = function(type, event) {\n return this.get('eventBus').fire(type, event);\n};\n\nViewer.prototype._createContainer = function(options) {\n\n var container = domify('
');\n\n assign(container.style, {\n width: ensureUnit(options.width),\n height: ensureUnit(options.height),\n position: options.position\n });\n\n return container;\n};\n\nViewer.prototype._createModdle = function(options) {\n var moddleOptions = assign({}, this._moddleExtensions, options.moddleExtensions);\n\n return new BpmnModdle(moddleOptions);\n};\n\n\n// modules the viewer is composed of\nViewer.prototype._modules = [\n require(4),\n require(248),\n require(233),\n require(211)\n];\n\n// default moddle extensions the viewer is composed of\nViewer.prototype._moddleExtensions = {};\n\n/* */\n\nvar PoweredBy = require(96),\n domEvent = require(450);\n\n/**\n * Adds the project logo to the diagram container as\n * required by the bpmn.io license.\n *\n * @see http://bpmn.io/license\n *\n * @param {Element} container\n */\nfunction addProjectLogo(container) {\n var logoData = PoweredBy.BPMNIO_LOGO;\n\n var linkMarkup =\n '' +\n '' +\n '';\n\n var linkElement = domify(linkMarkup);\n\n container.appendChild(linkElement);\n\n domEvent.bind(linkElement, 'click', function(event) {\n PoweredBy.open();\n\n event.preventDefault();\n });\n}\n\n/* */\n","module.exports = {\n __depends__: [\n require(7),\n require(92)\n ]\n};","'use strict';\n\nvar inherits = require(289),\n isObject = require(426),\n assign = require(431),\n forEach = require(303),\n every = require(300),\n some = require(309);\n\nvar BaseRenderer = require(128),\n TextUtil = require(280),\n DiUtil = require(93);\n\nvar getBusinessObject = require(95).getBusinessObject,\n is = require(95).is;\n\nvar RenderUtil = require(278);\n\nvar componentsToPath = RenderUtil.componentsToPath,\n createLine = RenderUtil.createLine;\n\nvar domQuery = require(452);\n\nvar svgAppend = require(472),\n svgAttr = require(474),\n svgCreate = require(478),\n svgClasses = require(475);\n\nvar rotate = require(279).rotate,\n transform = require(279).transform,\n translate = require(279).translate;\n\nvar Ids = require(288),\n RENDERER_IDS = new Ids();\n\nvar TASK_BORDER_RADIUS = 10;\nvar INNER_OUTER_DIST = 3;\n\nvar LABEL_STYLE = {\n fontFamily: 'Arial, sans-serif',\n fontSize: 12\n};\n\n\nfunction BpmnRenderer(eventBus, styles, pathMap, canvas, priority) {\n\n BaseRenderer.call(this, eventBus, priority);\n\n var rendererId = RENDERER_IDS.next();\n\n var textUtil = new TextUtil({\n style: LABEL_STYLE,\n size: { width: 100 }\n });\n\n var markers = {};\n\n var computeStyle = styles.computeStyle;\n\n function addMarker(id, options) {\n var attrs = assign({\n fill: 'black',\n strokeWidth: 1,\n strokeLinecap: 'round',\n strokeDasharray: 'none'\n }, options.attrs);\n\n var ref = options.ref || { x: 0, y: 0 };\n\n var scale = options.scale || 1;\n\n // fix for safari / chrome / firefox bug not correctly\n // resetting stroke dash array\n if (attrs.strokeDasharray === 'none') {\n attrs.strokeDasharray = [10000, 1];\n }\n\n var marker = svgCreate('marker');\n\n svgAttr(options.element, attrs);\n\n svgAppend(marker, options.element);\n\n svgAttr(marker, {\n id: id,\n viewBox: '0 0 20 20',\n refX: ref.x,\n refY: ref.y,\n markerWidth: 20 * scale,\n markerHeight: 20 * scale,\n orient: 'auto'\n });\n\n var defs = domQuery('defs', canvas._svg);\n\n if (!defs) {\n defs = svgCreate('defs');\n\n svgAppend(canvas._svg, defs);\n }\n\n svgAppend(defs, marker);\n\n markers[id] = marker;\n }\n\n function marker(type, fill, stroke) {\n var id = type + '-' + fill + '-' + stroke + '-' + rendererId;\n\n if (!markers[id]) {\n createMarker(type, fill, stroke);\n }\n\n return 'url(#' + id + ')';\n }\n\n function createMarker(type, fill, stroke) {\n var id = type + '-' + fill + '-' + stroke + '-' + rendererId;\n\n if (type === 'sequenceflow-end') {\n var sequenceflowEnd = svgCreate('path');\n svgAttr(sequenceflowEnd, { d: 'M 1 5 L 11 10 L 1 15 Z' });\n\n addMarker(id, {\n element: sequenceflowEnd,\n ref: { x: 11, y: 10 },\n scale: 0.5,\n attrs: {\n fill: stroke,\n stroke: stroke\n }\n });\n }\n\n if (type === 'messageflow-start') {\n var messageflowStart = svgCreate('circle');\n svgAttr(messageflowStart, { cx: 6, cy: 6, r: 3.5 });\n\n addMarker(id, {\n element: messageflowStart,\n attrs: {\n fill: fill,\n stroke: stroke\n },\n ref: { x: 6, y: 6 }\n });\n }\n\n if (type === 'messageflow-end') {\n var messageflowEnd = svgCreate('path');\n svgAttr(messageflowEnd, { d: 'm 1 5 l 0 -3 l 7 3 l -7 3 z' });\n\n addMarker(id, {\n element: messageflowEnd,\n attrs: {\n fill: fill,\n stroke: stroke,\n strokeLinecap: 'butt'\n },\n ref: { x: 8.5, y: 5 }\n });\n }\n\n if (type === 'association-start') {\n var associationStart = svgCreate('path');\n svgAttr(associationStart, { d: 'M 11 5 L 1 10 L 11 15' });\n\n addMarker(id, {\n element: associationStart,\n attrs: {\n fill: 'none',\n stroke: stroke,\n strokeWidth: 1.5\n },\n ref: { x: 1, y: 10 },\n scale: 0.5\n });\n }\n\n if (type === 'association-end') {\n var associationEnd = svgCreate('path');\n svgAttr(associationEnd, { d: 'M 1 5 L 11 10 L 1 15' });\n\n addMarker(id, {\n element: associationEnd,\n attrs: {\n fill: 'none',\n stroke: stroke,\n strokeWidth: 1.5\n },\n ref: { x: 12, y: 10 },\n scale: 0.5\n });\n }\n\n if (type === 'conditional-flow-marker') {\n var conditionalflowMarker = svgCreate('path');\n svgAttr(conditionalflowMarker, { d: 'M 0 10 L 8 6 L 16 10 L 8 14 Z' });\n\n addMarker(id, {\n element: conditionalflowMarker,\n attrs: {\n fill: fill,\n stroke: stroke\n },\n ref: { x: -1, y: 10 },\n scale: 0.5\n });\n }\n\n if (type === 'conditional-default-flow-marker') {\n var conditionaldefaultflowMarker = svgCreate('path');\n svgAttr(conditionaldefaultflowMarker, { d: 'M 6 4 L 10 16' });\n\n addMarker(id, {\n element: conditionaldefaultflowMarker,\n attrs: {\n stroke: stroke\n },\n ref: { x: 0, y: 10 },\n scale: 0.5\n });\n }\n }\n\n function drawCircle(parentGfx, width, height, offset, attrs) {\n\n if (isObject(offset)) {\n attrs = offset;\n offset = 0;\n }\n\n offset = offset || 0;\n\n attrs = computeStyle(attrs, {\n stroke: 'black',\n strokeWidth: 2,\n fill: 'white'\n });\n\n var cx = width / 2,\n cy = height / 2;\n\n var circle = svgCreate('circle');\n svgAttr(circle, {\n cx: cx,\n cy: cy,\n r: Math.round((width + height) / 4 - offset)\n });\n svgAttr(circle, attrs);\n\n svgAppend(parentGfx, circle);\n\n return circle;\n }\n\n function drawRect(parentGfx, width, height, r, offset, attrs) {\n\n if (isObject(offset)) {\n attrs = offset;\n offset = 0;\n }\n\n offset = offset || 0;\n\n attrs = computeStyle(attrs, {\n stroke: 'black',\n strokeWidth: 2,\n fill: 'white'\n });\n\n var rect = svgCreate('rect');\n svgAttr(rect, {\n x: offset,\n y: offset,\n width: width - offset * 2,\n height: height - offset * 2,\n rx: r,\n ry: r\n });\n svgAttr(rect, attrs);\n\n svgAppend(parentGfx, rect);\n\n return rect;\n }\n\n function drawDiamond(parentGfx, width, height, attrs) {\n\n var x_2 = width / 2;\n var y_2 = height / 2;\n\n var points = [{ x: x_2, y: 0 }, { x: width, y: y_2 }, { x: x_2, y: height }, { x: 0, y: y_2 }];\n\n var pointsString = points.map(function(point) {\n return point.x + ',' + point.y;\n }).join(' ');\n\n attrs = computeStyle(attrs, {\n stroke: 'black',\n strokeWidth: 2,\n fill: 'white'\n });\n\n var polygon = svgCreate('polygon');\n svgAttr(polygon, {\n points: pointsString\n });\n svgAttr(polygon, attrs);\n\n svgAppend(parentGfx, polygon);\n\n return polygon;\n }\n\n function drawLine(parentGfx, waypoints, attrs) {\n attrs = computeStyle(attrs, [ 'no-fill' ], {\n stroke: 'black',\n strokeWidth: 2,\n fill: 'none'\n });\n\n var line = createLine(waypoints, attrs);\n\n svgAppend(parentGfx, line);\n\n return line;\n }\n\n function drawPath(parentGfx, d, attrs) {\n\n attrs = computeStyle(attrs, [ 'no-fill' ], {\n strokeWidth: 2,\n stroke: 'black'\n });\n\n var path = svgCreate('path');\n svgAttr(path, { d: d });\n svgAttr(path, attrs);\n\n svgAppend(parentGfx, path);\n\n return path;\n }\n\n function drawMarker(type, parentGfx, path, attrs) {\n return drawPath(parentGfx, path, assign({ 'data-marker': type }, attrs));\n }\n\n function as(type) {\n return function(parentGfx, element) {\n return handlers[type](parentGfx, element);\n };\n }\n\n function renderer(type) {\n return handlers[type];\n }\n\n function renderEventContent(element, parentGfx) {\n\n var event = getSemantic(element);\n var isThrowing = isThrowEvent(event);\n\n if (isTypedEvent(event, 'bpmn:MessageEventDefinition')) {\n return renderer('bpmn:MessageEventDefinition')(parentGfx, element, isThrowing);\n }\n\n if (isTypedEvent(event, 'bpmn:TimerEventDefinition')) {\n return renderer('bpmn:TimerEventDefinition')(parentGfx, element, isThrowing);\n }\n\n if (isTypedEvent(event, 'bpmn:ConditionalEventDefinition')) {\n return renderer('bpmn:ConditionalEventDefinition')(parentGfx, element);\n }\n\n if (isTypedEvent(event, 'bpmn:SignalEventDefinition')) {\n return renderer('bpmn:SignalEventDefinition')(parentGfx, element, isThrowing);\n }\n\n if (isTypedEvent(event, 'bpmn:CancelEventDefinition') &&\n isTypedEvent(event, 'bpmn:TerminateEventDefinition', { parallelMultiple: false })) {\n return renderer('bpmn:MultipleEventDefinition')(parentGfx, element, isThrowing);\n }\n\n if (isTypedEvent(event, 'bpmn:CancelEventDefinition') &&\n isTypedEvent(event, 'bpmn:TerminateEventDefinition', { parallelMultiple: true })) {\n return renderer('bpmn:ParallelMultipleEventDefinition')(parentGfx, element, isThrowing);\n }\n\n if (isTypedEvent(event, 'bpmn:EscalationEventDefinition')) {\n return renderer('bpmn:EscalationEventDefinition')(parentGfx, element, isThrowing);\n }\n\n if (isTypedEvent(event, 'bpmn:LinkEventDefinition')) {\n return renderer('bpmn:LinkEventDefinition')(parentGfx, element, isThrowing);\n }\n\n if (isTypedEvent(event, 'bpmn:ErrorEventDefinition')) {\n return renderer('bpmn:ErrorEventDefinition')(parentGfx, element, isThrowing);\n }\n\n if (isTypedEvent(event, 'bpmn:CancelEventDefinition')) {\n return renderer('bpmn:CancelEventDefinition')(parentGfx, element, isThrowing);\n }\n\n if (isTypedEvent(event, 'bpmn:CompensateEventDefinition')) {\n return renderer('bpmn:CompensateEventDefinition')(parentGfx, element, isThrowing);\n }\n\n if (isTypedEvent(event, 'bpmn:TerminateEventDefinition')) {\n return renderer('bpmn:TerminateEventDefinition')(parentGfx, element, isThrowing);\n }\n\n return null;\n }\n\n function renderLabel(parentGfx, label, options) {\n var text = textUtil.createText(label || '', options);\n svgClasses(text).add('djs-label');\n svgAppend(parentGfx, text);\n\n return text;\n }\n\n function renderEmbeddedLabel(parentGfx, element, align) {\n var semantic = getSemantic(element);\n\n return renderLabel(parentGfx, semantic.name, {\n box: element,\n align: align,\n padding: 5,\n style: {\n fill: getStrokeColor(element)\n }\n });\n }\n\n function renderExternalLabel(parentGfx, element) {\n var semantic = getSemantic(element);\n var box = {\n width: 90,\n height: 30,\n x: element.width / 2 + element.x,\n y: element.height / 2 + element.y\n };\n\n return renderLabel(parentGfx, semantic.name, {\n box: box,\n fitBox: true,\n style: { fontSize: '11px' }\n });\n }\n\n function renderLaneLabel(parentGfx, text, element) {\n var textBox = renderLabel(parentGfx, text, {\n box: { height: 30, width: element.height },\n align: 'center-middle',\n style: {\n fill: getStrokeColor(element)\n }\n });\n\n var top = -1 * element.height;\n\n transform(textBox, 0, -top, 270);\n }\n\n function createPathFromConnection(connection) {\n var waypoints = connection.waypoints;\n\n var pathData = 'm ' + waypoints[0].x + ',' + waypoints[0].y;\n for (var i = 1; i < waypoints.length; i++) {\n pathData += 'L' + waypoints[i].x + ',' + waypoints[i].y + ' ';\n }\n return pathData;\n }\n\n var handlers = this.handlers = {\n 'bpmn:Event': function(parentGfx, element, attrs) {\n return drawCircle(parentGfx, element.width, element.height, attrs);\n },\n 'bpmn:StartEvent': function(parentGfx, element) {\n var attrs = {\n fill: getFillColor(element),\n stroke: getStrokeColor(element)\n };\n\n var semantic = getSemantic(element);\n\n if (!semantic.isInterrupting) {\n attrs = {\n strokeDasharray: '6',\n strokeLinecap: 'round'\n };\n }\n\n var circle = renderer('bpmn:Event')(parentGfx, element, attrs);\n\n renderEventContent(element, parentGfx);\n\n return circle;\n },\n 'bpmn:MessageEventDefinition': function(parentGfx, element, isThrowing) {\n var pathData = pathMap.getScaledPath('EVENT_MESSAGE', {\n xScaleFactor: 0.9,\n yScaleFactor: 0.9,\n containerWidth: element.width,\n containerHeight: element.height,\n position: {\n mx: 0.235,\n my: 0.315\n }\n });\n\n var fill = isThrowing ? getStrokeColor(element) : getFillColor(element);\n var stroke = isThrowing ? getFillColor(element) : getStrokeColor(element);\n\n var messagePath = drawPath(parentGfx, pathData, {\n strokeWidth: 1,\n fill: fill,\n stroke: stroke\n });\n\n return messagePath;\n },\n 'bpmn:TimerEventDefinition': function(parentGfx, element) {\n var circle = drawCircle(parentGfx, element.width, element.height, 0.2 * element.height, {\n strokeWidth: 2,\n fill: getFillColor(element),\n stroke: getStrokeColor(element)\n });\n\n var pathData = pathMap.getScaledPath('EVENT_TIMER_WH', {\n xScaleFactor: 0.75,\n yScaleFactor: 0.75,\n containerWidth: element.width,\n containerHeight: element.height,\n position: {\n mx: 0.5,\n my: 0.5\n }\n });\n\n drawPath(parentGfx, pathData, {\n strokeWidth: 2,\n strokeLinecap: 'square',\n stroke: getStrokeColor(element)\n });\n\n for (var i = 0;i < 12;i++) {\n\n var linePathData = pathMap.getScaledPath('EVENT_TIMER_LINE', {\n xScaleFactor: 0.75,\n yScaleFactor: 0.75,\n containerWidth: element.width,\n containerHeight: element.height,\n position: {\n mx: 0.5,\n my: 0.5\n }\n });\n\n var width = element.width / 2;\n var height = element.height / 2;\n\n drawPath(parentGfx, linePathData, {\n strokeWidth: 1,\n strokeLinecap: 'square',\n transform: 'rotate(' + (i * 30) + ',' + height + ',' + width + ')',\n stroke: getStrokeColor(element)\n });\n }\n\n return circle;\n },\n 'bpmn:EscalationEventDefinition': function(parentGfx, event, isThrowing) {\n var pathData = pathMap.getScaledPath('EVENT_ESCALATION', {\n xScaleFactor: 1,\n yScaleFactor: 1,\n containerWidth: event.width,\n containerHeight: event.height,\n position: {\n mx: 0.5,\n my: 0.2\n }\n });\n\n var fill = isThrowing ? getStrokeColor(event) : 'none';\n\n return drawPath(parentGfx, pathData, {\n strokeWidth: 1,\n fill: fill,\n stroke: getStrokeColor(event)\n });\n },\n 'bpmn:ConditionalEventDefinition': function(parentGfx, event) {\n var pathData = pathMap.getScaledPath('EVENT_CONDITIONAL', {\n xScaleFactor: 1,\n yScaleFactor: 1,\n containerWidth: event.width,\n containerHeight: event.height,\n position: {\n mx: 0.5,\n my: 0.222\n }\n });\n\n return drawPath(parentGfx, pathData, {\n strokeWidth: 1,\n stroke: getStrokeColor(event)\n });\n },\n 'bpmn:LinkEventDefinition': function(parentGfx, event, isThrowing) {\n var pathData = pathMap.getScaledPath('EVENT_LINK', {\n xScaleFactor: 1,\n yScaleFactor: 1,\n containerWidth: event.width,\n containerHeight: event.height,\n position: {\n mx: 0.57,\n my: 0.263\n }\n });\n\n var fill = isThrowing ? getStrokeColor(event) : 'none';\n\n return drawPath(parentGfx, pathData, {\n strokeWidth: 1,\n fill: fill,\n stroke: getStrokeColor(event)\n });\n },\n 'bpmn:ErrorEventDefinition': function(parentGfx, event, isThrowing) {\n var pathData = pathMap.getScaledPath('EVENT_ERROR', {\n xScaleFactor: 1.1,\n yScaleFactor: 1.1,\n containerWidth: event.width,\n containerHeight: event.height,\n position: {\n mx: 0.2,\n my: 0.722\n }\n });\n\n var fill = isThrowing ? getStrokeColor(event) : 'none';\n\n return drawPath(parentGfx, pathData, {\n strokeWidth: 1,\n fill: fill,\n stroke: getStrokeColor(event)\n });\n },\n 'bpmn:CancelEventDefinition': function(parentGfx, event, isThrowing) {\n var pathData = pathMap.getScaledPath('EVENT_CANCEL_45', {\n xScaleFactor: 1.0,\n yScaleFactor: 1.0,\n containerWidth: event.width,\n containerHeight: event.height,\n position: {\n mx: 0.638,\n my: -0.055\n }\n });\n\n var fill = isThrowing ? 'black' : 'none';\n\n var path = drawPath(parentGfx, pathData, {\n strokeWidth: 1,\n fill: fill\n });\n\n rotate(path, 45);\n\n return path;\n },\n 'bpmn:CompensateEventDefinition': function(parentGfx, event, isThrowing) {\n var pathData = pathMap.getScaledPath('EVENT_COMPENSATION', {\n xScaleFactor: 1,\n yScaleFactor: 1,\n containerWidth: event.width,\n containerHeight: event.height,\n position: {\n mx: 0.22,\n my: 0.5\n }\n });\n\n var fill = isThrowing ? getStrokeColor(event) : 'none';\n\n return drawPath(parentGfx, pathData, {\n strokeWidth: 1,\n fill: fill,\n stroke: getStrokeColor(event)\n });\n },\n 'bpmn:SignalEventDefinition': function(parentGfx, event, isThrowing) {\n var pathData = pathMap.getScaledPath('EVENT_SIGNAL', {\n xScaleFactor: 0.9,\n yScaleFactor: 0.9,\n containerWidth: event.width,\n containerHeight: event.height,\n position: {\n mx: 0.5,\n my: 0.2\n }\n });\n\n var fill = isThrowing ? getStrokeColor(event) : 'none';\n\n return drawPath(parentGfx, pathData, {\n strokeWidth: 1,\n fill: fill,\n stroke: getStrokeColor(event)\n });\n },\n 'bpmn:MultipleEventDefinition': function(parentGfx, event, isThrowing) {\n var pathData = pathMap.getScaledPath('EVENT_MULTIPLE', {\n xScaleFactor: 1.1,\n yScaleFactor: 1.1,\n containerWidth: event.width,\n containerHeight: event.height,\n position: {\n mx: 0.222,\n my: 0.36\n }\n });\n\n var fill = isThrowing ? 'black' : 'none';\n\n return drawPath(parentGfx, pathData, {\n strokeWidth: 1,\n fill: fill\n });\n },\n 'bpmn:ParallelMultipleEventDefinition': function(parentGfx, event) {\n var pathData = pathMap.getScaledPath('EVENT_PARALLEL_MULTIPLE', {\n xScaleFactor: 1.2,\n yScaleFactor: 1.2,\n containerWidth: event.width,\n containerHeight: event.height,\n position: {\n mx: 0.458,\n my: 0.194\n }\n });\n\n return drawPath(parentGfx, pathData, {\n strokeWidth: 1,\n fill: getStrokeColor(event),\n stroke: getStrokeColor(event)\n });\n },\n 'bpmn:EndEvent': function(parentGfx, element) {\n var circle = renderer('bpmn:Event')(parentGfx, element, {\n strokeWidth: 4,\n fill: getFillColor(element),\n stroke: getStrokeColor(element)\n });\n\n renderEventContent(element, parentGfx, true);\n\n return circle;\n },\n 'bpmn:TerminateEventDefinition': function(parentGfx, element) {\n var circle = drawCircle(parentGfx, element.width, element.height, 8, {\n strokeWidth: 4,\n fill: getStrokeColor(element),\n stroke: getStrokeColor(element)\n });\n\n return circle;\n },\n 'bpmn:IntermediateEvent': function(parentGfx, element) {\n var outer = renderer('bpmn:Event')(parentGfx, element, {\n strokeWidth: 1,\n fill: getFillColor(element),\n stroke: getStrokeColor(element)\n });\n\n /* inner */ drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {\n strokeWidth: 1,\n fill: getFillColor(element, 'none'),\n stroke: getStrokeColor(element)\n });\n\n renderEventContent(element, parentGfx);\n\n return outer;\n },\n 'bpmn:IntermediateCatchEvent': as('bpmn:IntermediateEvent'),\n 'bpmn:IntermediateThrowEvent': as('bpmn:IntermediateEvent'),\n\n 'bpmn:Activity': function(parentGfx, element, attrs) {\n return drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, attrs);\n },\n\n 'bpmn:Task': function(parentGfx, element) {\n var attrs = {\n fill: getFillColor(element),\n stroke: getStrokeColor(element)\n };\n\n var rect = renderer('bpmn:Activity')(parentGfx, element, attrs);\n\n renderEmbeddedLabel(parentGfx, element, 'center-middle');\n attachTaskMarkers(parentGfx, element);\n\n return rect;\n },\n 'bpmn:ServiceTask': function(parentGfx, element) {\n var task = renderer('bpmn:Task')(parentGfx, element);\n\n var pathDataBG = pathMap.getScaledPath('TASK_TYPE_SERVICE', {\n abspos: {\n x: 12,\n y: 18\n }\n });\n\n /* service bg */ drawPath(parentGfx, pathDataBG, {\n strokeWidth: 1,\n fill: getFillColor(element),\n stroke: getStrokeColor(element)\n });\n\n var fillPathData = pathMap.getScaledPath('TASK_TYPE_SERVICE_FILL', {\n abspos: {\n x: 17.2,\n y: 18\n }\n });\n\n /* service fill */ drawPath(parentGfx, fillPathData, {\n strokeWidth: 0,\n fill: getFillColor(element)\n });\n\n var pathData = pathMap.getScaledPath('TASK_TYPE_SERVICE', {\n abspos: {\n x: 17,\n y: 22\n }\n });\n\n /* service */ drawPath(parentGfx, pathData, {\n strokeWidth: 1,\n fill: getFillColor(element),\n stroke: getStrokeColor(element)\n });\n\n return task;\n },\n 'bpmn:UserTask': function(parentGfx, element) {\n var task = renderer('bpmn:Task')(parentGfx, element);\n\n var x = 15;\n var y = 12;\n\n var pathData = pathMap.getScaledPath('TASK_TYPE_USER_1', {\n abspos: {\n x: x,\n y: y\n }\n });\n\n /* user path */ drawPath(parentGfx, pathData, {\n strokeWidth: 0.5,\n fill: getFillColor(element),\n stroke: getStrokeColor(element)\n });\n\n var pathData2 = pathMap.getScaledPath('TASK_TYPE_USER_2', {\n abspos: {\n x: x,\n y: y\n }\n });\n\n /* user2 path */ drawPath(parentGfx, pathData2, {\n strokeWidth: 0.5,\n fill: getFillColor(element),\n stroke: getStrokeColor(element)\n });\n\n var pathData3 = pathMap.getScaledPath('TASK_TYPE_USER_3', {\n abspos: {\n x: x,\n y: y\n }\n });\n\n /* user3 path */ drawPath(parentGfx, pathData3, {\n strokeWidth: 0.5,\n fill: getStrokeColor(element),\n stroke: getStrokeColor(element)\n });\n\n return task;\n },\n 'bpmn:ManualTask': function(parentGfx, element) {\n var task = renderer('bpmn:Task')(parentGfx, element);\n\n var pathData = pathMap.getScaledPath('TASK_TYPE_MANUAL', {\n abspos: {\n x: 17,\n y: 15\n }\n });\n\n /* manual path */ drawPath(parentGfx, pathData, {\n strokeWidth: 0.5, // 0.25,\n fill: getFillColor(element),\n stroke: getStrokeColor(element)\n });\n\n return task;\n },\n 'bpmn:SendTask': function(parentGfx, element) {\n var task = renderer('bpmn:Task')(parentGfx, element);\n\n var pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {\n xScaleFactor: 1,\n yScaleFactor: 1,\n containerWidth: 21,\n containerHeight: 14,\n position: {\n mx: 0.285,\n my: 0.357\n }\n });\n\n /* send path */ drawPath(parentGfx, pathData, {\n strokeWidth: 1,\n fill: getStrokeColor(element),\n stroke: getFillColor(element)\n });\n\n return task;\n },\n 'bpmn:ReceiveTask' : function(parentGfx, element) {\n var semantic = getSemantic(element);\n\n var task = renderer('bpmn:Task')(parentGfx, element);\n var pathData;\n\n if (semantic.instantiate) {\n drawCircle(parentGfx, 28, 28, 20 * 0.22, { strokeWidth: 1 });\n\n pathData = pathMap.getScaledPath('TASK_TYPE_INSTANTIATING_SEND', {\n abspos: {\n x: 7.77,\n y: 9.52\n }\n });\n } else {\n\n pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {\n xScaleFactor: 0.9,\n yScaleFactor: 0.9,\n containerWidth: 21,\n containerHeight: 14,\n position: {\n mx: 0.3,\n my: 0.4\n }\n });\n }\n\n /* receive path */ drawPath(parentGfx, pathData, {\n strokeWidth: 1,\n fill: getFillColor(element),\n stroke: getStrokeColor(element)\n });\n\n return task;\n },\n 'bpmn:ScriptTask': function(parentGfx, element) {\n var task = renderer('bpmn:Task')(parentGfx, element);\n\n var pathData = pathMap.getScaledPath('TASK_TYPE_SCRIPT', {\n abspos: {\n x: 15,\n y: 20\n }\n });\n\n /* script path */ drawPath(parentGfx, pathData, {\n strokeWidth: 1,\n stroke: getStrokeColor(element)\n });\n\n return task;\n },\n 'bpmn:BusinessRuleTask': function(parentGfx, element) {\n var task = renderer('bpmn:Task')(parentGfx, element);\n\n var headerPathData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_HEADER', {\n abspos: {\n x: 8,\n y: 8\n }\n });\n\n var businessHeaderPath = drawPath(parentGfx, headerPathData);\n svgAttr(businessHeaderPath, {\n strokeWidth: 1,\n fill: getFillColor(element, '#aaaaaa'),\n stroke: getStrokeColor(element)\n });\n\n var headerData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_MAIN', {\n abspos: {\n x: 8,\n y: 8\n }\n });\n\n var businessPath = drawPath(parentGfx, headerData);\n svgAttr(businessPath, {\n strokeWidth: 1,\n stroke: getStrokeColor(element)\n });\n\n return task;\n },\n 'bpmn:SubProcess': function(parentGfx, element, attrs) {\n attrs = assign({\n fillOpacity: 0.95,\n fill: getFillColor(element),\n stroke: getStrokeColor(element)\n }, attrs);\n\n var rect = renderer('bpmn:Activity')(parentGfx, element, attrs);\n\n var expanded = DiUtil.isExpanded(element);\n\n var isEventSubProcess = DiUtil.isEventSubProcess(element);\n\n if (isEventSubProcess) {\n svgAttr(rect, {\n strokeDasharray: '1,2'\n });\n }\n\n renderEmbeddedLabel(parentGfx, element, expanded ? 'center-top' : 'center-middle');\n\n if (expanded) {\n attachTaskMarkers(parentGfx, element);\n } else {\n attachTaskMarkers(parentGfx, element, ['SubProcessMarker']);\n }\n\n return rect;\n },\n 'bpmn:AdHocSubProcess': function(parentGfx, element) {\n return renderer('bpmn:SubProcess')(parentGfx, element);\n },\n 'bpmn:Transaction': function(parentGfx, element) {\n var outer = renderer('bpmn:SubProcess')(parentGfx, element);\n\n var innerAttrs = styles.style([ 'no-fill', 'no-events' ], {\n stroke: getStrokeColor(element)\n });\n\n /* inner path */ drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS - 2, INNER_OUTER_DIST, innerAttrs);\n\n return outer;\n },\n 'bpmn:CallActivity': function(parentGfx, element) {\n return renderer('bpmn:SubProcess')(parentGfx, element, {\n strokeWidth: 5\n });\n },\n 'bpmn:Participant': function(parentGfx, element) {\n\n var attrs = {\n fillOpacity: 0.95,\n fill: getFillColor(element),\n stroke: getStrokeColor(element)\n };\n\n var lane = renderer('bpmn:Lane')(parentGfx, element, attrs);\n\n var expandedPool = DiUtil.isExpanded(element);\n\n if (expandedPool) {\n drawLine(parentGfx, [\n { x: 30, y: 0 },\n { x: 30, y: element.height }\n ], {\n stroke: getStrokeColor(element)\n });\n var text = getSemantic(element).name;\n renderLaneLabel(parentGfx, text, element);\n } else {\n // Collapsed pool draw text inline\n var text2 = getSemantic(element).name;\n renderLabel(parentGfx, text2, {\n box: element, align: 'center-middle',\n style: {\n fill: getStrokeColor(element)\n }\n });\n }\n\n var participantMultiplicity = !!(getSemantic(element).participantMultiplicity);\n\n if (participantMultiplicity) {\n renderer('ParticipantMultiplicityMarker')(parentGfx, element);\n }\n\n return lane;\n },\n 'bpmn:Lane': function(parentGfx, element, attrs) {\n var rect = drawRect(parentGfx, element.width, element.height, 0, assign({\n fill: getFillColor(element),\n stroke: getStrokeColor(element)\n }, attrs));\n\n var semantic = getSemantic(element);\n\n if (semantic.$type === 'bpmn:Lane') {\n var text = semantic.name;\n renderLaneLabel(parentGfx, text, element);\n }\n\n return rect;\n },\n 'bpmn:InclusiveGateway': function(parentGfx, element) {\n var attrs = {\n fill: getFillColor(element),\n stroke: getStrokeColor(element)\n };\n\n var diamond = drawDiamond(parentGfx, element.width, element.height, attrs);\n\n /* circle path */\n drawCircle(parentGfx, element.width, element.height, element.height * 0.24, {\n strokeWidth: 2.5,\n fill: getFillColor(element),\n stroke: getStrokeColor(element)\n });\n\n return diamond;\n },\n 'bpmn:ExclusiveGateway': function(parentGfx, element) {\n var attrs = {\n fill: getFillColor(element),\n stroke: getStrokeColor(element)\n };\n\n var diamond = drawDiamond(parentGfx, element.width, element.height, attrs);\n\n var pathData = pathMap.getScaledPath('GATEWAY_EXCLUSIVE', {\n xScaleFactor: 0.4,\n yScaleFactor: 0.4,\n containerWidth: element.width,\n containerHeight: element.height,\n position: {\n mx: 0.32,\n my: 0.3\n }\n });\n\n if ((getDi(element).isMarkerVisible)) {\n drawPath(parentGfx, pathData, {\n strokeWidth: 1,\n fill: getStrokeColor(element),\n stroke: getStrokeColor(element)\n });\n }\n\n return diamond;\n },\n 'bpmn:ComplexGateway': function(parentGfx, element) {\n var attrs = {\n fill: getFillColor(element),\n stroke: getStrokeColor(element)\n };\n\n var diamond = drawDiamond(parentGfx, element.width, element.height, attrs);\n\n var pathData = pathMap.getScaledPath('GATEWAY_COMPLEX', {\n xScaleFactor: 0.5,\n yScaleFactor:0.5,\n containerWidth: element.width,\n containerHeight: element.height,\n position: {\n mx: 0.46,\n my: 0.26\n }\n });\n\n /* complex path */ drawPath(parentGfx, pathData, {\n strokeWidth: 1,\n fill: getStrokeColor(element),\n stroke: getStrokeColor(element)\n });\n\n return diamond;\n },\n 'bpmn:ParallelGateway': function(parentGfx, element) {\n var attrs = {\n fill: getFillColor(element),\n stroke: getStrokeColor(element)\n };\n\n var diamond = drawDiamond(parentGfx, element.width, element.height, attrs);\n\n var pathData = pathMap.getScaledPath('GATEWAY_PARALLEL', {\n xScaleFactor: 0.6,\n yScaleFactor:0.6,\n containerWidth: element.width,\n containerHeight: element.height,\n position: {\n mx: 0.46,\n my: 0.2\n }\n });\n\n /* parallel path */ drawPath(parentGfx, pathData, {\n strokeWidth: 1,\n fill: getStrokeColor(element),\n stroke: getStrokeColor(element)\n });\n\n return diamond;\n },\n 'bpmn:EventBasedGateway': function(parentGfx, element) {\n\n var semantic = getSemantic(element);\n\n var attrs = {\n fill: getFillColor(element),\n stroke: getStrokeColor(element)\n };\n\n var diamond = drawDiamond(parentGfx, element.width, element.height, attrs);\n\n /* outer circle path */ drawCircle(parentGfx, element.width, element.height, element.height * 0.20, {\n strokeWidth: 1,\n fill: 'none',\n stroke: getStrokeColor(element)\n });\n\n var type = semantic.eventGatewayType;\n var instantiate = !!semantic.instantiate;\n\n function drawEvent() {\n\n var pathData = pathMap.getScaledPath('GATEWAY_EVENT_BASED', {\n xScaleFactor: 0.18,\n yScaleFactor: 0.18,\n containerWidth: element.width,\n containerHeight: element.height,\n position: {\n mx: 0.36,\n my: 0.44\n }\n });\n\n var attrs = {\n strokeWidth: 2,\n fill: getFillColor(element, 'none'),\n stroke: getStrokeColor(element)\n };\n\n /* event path */ drawPath(parentGfx, pathData, attrs);\n }\n\n if (type === 'Parallel') {\n\n var pathData = pathMap.getScaledPath('GATEWAY_PARALLEL', {\n xScaleFactor: 0.4,\n yScaleFactor:0.4,\n containerWidth: element.width,\n containerHeight: element.height,\n position: {\n mx: 0.474,\n my: 0.296\n }\n });\n\n var parallelPath = drawPath(parentGfx, pathData);\n svgAttr(parallelPath, {\n strokeWidth: 1,\n fill: 'none'\n });\n } else if (type === 'Exclusive') {\n\n if (!instantiate) {\n var innerCircle = drawCircle(parentGfx, element.width, element.height, element.height * 0.26);\n svgAttr(innerCircle, {\n strokeWidth: 1,\n fill: 'none',\n stroke: getStrokeColor(element)\n });\n }\n\n drawEvent();\n }\n\n\n return diamond;\n },\n 'bpmn:Gateway': function(parentGfx, element) {\n return drawDiamond(parentGfx, element.width, element.height);\n },\n 'bpmn:SequenceFlow': function(parentGfx, element) {\n var pathData = createPathFromConnection(element);\n\n var fill = getFillColor(element),\n stroke = getStrokeColor(element);\n\n var attrs = {\n strokeLinejoin: 'round',\n markerEnd: marker('sequenceflow-end', fill, stroke),\n stroke: getStrokeColor(element)\n };\n\n var path = drawPath(parentGfx, pathData, attrs);\n\n var sequenceFlow = getSemantic(element);\n var source = element.source.businessObject;\n\n // conditional flow marker\n if (sequenceFlow.conditionExpression && source.$instanceOf('bpmn:Activity')) {\n svgAttr(path, {\n markerStart: marker('conditional-flow-marker', fill, stroke)\n });\n }\n\n // default marker\n if (source.default && (source.$instanceOf('bpmn:Gateway') || source.$instanceOf('bpmn:Activity')) &&\n source.default === sequenceFlow) {\n svgAttr(path, {\n markerStart: marker('conditional-default-flow-marker', fill, stroke)\n });\n }\n\n return path;\n },\n 'bpmn:Association': function(parentGfx, element, attrs) {\n\n var semantic = getSemantic(element);\n\n var fill = getFillColor(element),\n stroke = getStrokeColor(element);\n\n attrs = assign({\n strokeDasharray: '0.5, 5',\n strokeLinecap: 'round',\n strokeLinejoin: 'round',\n stroke: getStrokeColor(element)\n }, attrs || {});\n\n if (semantic.associationDirection === 'One' ||\n semantic.associationDirection === 'Both') {\n attrs.markerEnd = marker('association-end', fill, stroke);\n }\n\n if (semantic.associationDirection === 'Both') {\n attrs.markerStart = marker('association-start', fill, stroke);\n }\n\n return drawLine(parentGfx, element.waypoints, attrs);\n },\n 'bpmn:DataInputAssociation': function(parentGfx, element) {\n var fill = getFillColor(element),\n stroke = getStrokeColor(element);\n\n return renderer('bpmn:Association')(parentGfx, element, {\n markerEnd: marker('association-end', fill, stroke)\n });\n },\n 'bpmn:DataOutputAssociation': function(parentGfx, element) {\n var fill = getFillColor(element),\n stroke = getStrokeColor(element);\n\n return renderer('bpmn:Association')(parentGfx, element, {\n markerEnd: marker('association-end', fill, stroke)\n });\n },\n 'bpmn:MessageFlow': function(parentGfx, element) {\n\n var semantic = getSemantic(element),\n di = getDi(element);\n\n var fill = getFillColor(element),\n stroke = getStrokeColor(element);\n\n var pathData = createPathFromConnection(element);\n\n var attrs = {\n markerEnd: marker('messageflow-end', fill, stroke),\n markerStart: marker('messageflow-start', fill, stroke),\n strokeDasharray: '10, 12',\n strokeLinecap: 'round',\n strokeLinejoin: 'round',\n strokeWidth: '1.5px',\n stroke: getStrokeColor(element)\n };\n\n var path = drawPath(parentGfx, pathData, attrs);\n\n if (semantic.messageRef) {\n var midPoint = path.getPointAtLength(path.getTotalLength() / 2);\n\n var markerPathData = pathMap.getScaledPath('MESSAGE_FLOW_MARKER', {\n abspos: {\n x: midPoint.x,\n y: midPoint.y\n }\n });\n\n var messageAttrs = { strokeWidth: 1 };\n\n if (di.messageVisibleKind === 'initiating') {\n messageAttrs.fill = 'white';\n messageAttrs.stroke = 'black';\n } else {\n messageAttrs.fill = '#888';\n messageAttrs.stroke = 'white';\n }\n\n drawPath(parentGfx, markerPathData, messageAttrs);\n }\n\n return path;\n },\n 'bpmn:DataObject': function(parentGfx, element) {\n var pathData = pathMap.getScaledPath('DATA_OBJECT_PATH', {\n xScaleFactor: 1,\n yScaleFactor: 1,\n containerWidth: element.width,\n containerHeight: element.height,\n position: {\n mx: 0.474,\n my: 0.296\n }\n });\n\n var elementObject = drawPath(parentGfx, pathData, {\n fill: getFillColor(element),\n stroke: getStrokeColor(element)\n });\n\n var semantic = getSemantic(element);\n\n if (isCollection(semantic)) {\n renderDataItemCollection(parentGfx, element);\n }\n\n return elementObject;\n },\n 'bpmn:DataObjectReference': as('bpmn:DataObject'),\n 'bpmn:DataInput': function(parentGfx, element) {\n\n var arrowPathData = pathMap.getRawPath('DATA_ARROW');\n\n // page\n var elementObject = renderer('bpmn:DataObject')(parentGfx, element);\n\n /* input arrow path */ drawPath(parentGfx, arrowPathData, { strokeWidth: 1 });\n\n return elementObject;\n },\n 'bpmn:DataOutput': function(parentGfx, element) {\n var arrowPathData = pathMap.getRawPath('DATA_ARROW');\n\n // page\n var elementObject = renderer('bpmn:DataObject')(parentGfx, element);\n\n /* output arrow path */ drawPath(parentGfx, arrowPathData, {\n strokeWidth: 1,\n fill: 'black'\n });\n\n return elementObject;\n },\n 'bpmn:DataStoreReference': function(parentGfx, element) {\n var DATA_STORE_PATH = pathMap.getScaledPath('DATA_STORE', {\n xScaleFactor: 1,\n yScaleFactor: 1,\n containerWidth: element.width,\n containerHeight: element.height,\n position: {\n mx: 0,\n my: 0.133\n }\n });\n\n var elementStore = drawPath(parentGfx, DATA_STORE_PATH, {\n strokeWidth: 2,\n fill: getFillColor(element),\n stroke: getStrokeColor(element)\n });\n\n return elementStore;\n },\n 'bpmn:BoundaryEvent': function(parentGfx, element) {\n\n var semantic = getSemantic(element),\n cancel = semantic.cancelActivity;\n\n var attrs = {\n strokeWidth: 1,\n fill: getFillColor(element),\n stroke: getStrokeColor(element)\n };\n\n if (!cancel) {\n attrs.strokeDasharray = '6';\n attrs.strokeLinecap = 'round';\n }\n\n var outer = renderer('bpmn:Event')(parentGfx, element, attrs);\n /* inner path */ drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, assign(attrs, { fill: 'none' }));\n\n renderEventContent(element, parentGfx);\n\n return outer;\n },\n 'bpmn:Group': function(parentGfx, element) {\n return drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, {\n strokeWidth: 1,\n strokeDasharray: '8,3,1,3',\n fill: 'none',\n pointerEvents: 'none'\n });\n },\n 'label': function(parentGfx, element) {\n return renderExternalLabel(parentGfx, element);\n },\n 'bpmn:TextAnnotation': function(parentGfx, element) {\n var style = {\n 'fill': 'none',\n 'stroke': 'none'\n };\n\n var textElement = drawRect(parentGfx, element.width, element.height, 0, 0, style);\n\n var textPathData = pathMap.getScaledPath('TEXT_ANNOTATION', {\n xScaleFactor: 1,\n yScaleFactor: 1,\n containerWidth: element.width,\n containerHeight: element.height,\n position: {\n mx: 0.0,\n my: 0.0\n }\n });\n drawPath(parentGfx, textPathData, {\n stroke: getStrokeColor(element)\n });\n\n var text = getSemantic(element).text || '';\n renderLabel(parentGfx, text, { box: element, align: 'left-top', padding: 5 });\n\n return textElement;\n },\n 'ParticipantMultiplicityMarker': function(parentGfx, element) {\n var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {\n xScaleFactor: 1,\n yScaleFactor: 1,\n containerWidth: element.width,\n containerHeight: element.height,\n position: {\n mx: ((element.width / 2) / element.width),\n my: (element.height - 15) / element.height\n }\n });\n\n drawMarker('participant-multiplicity', parentGfx, markerPath);\n },\n 'SubProcessMarker': function(parentGfx, element) {\n var markerRect = drawRect(parentGfx, 14, 14, 0, {\n strokeWidth: 1,\n fill: getFillColor(element),\n stroke: getStrokeColor(element)\n });\n\n // Process marker is placed in the middle of the box\n // therefore fixed values can be used here\n translate(markerRect, element.width / 2 - 7.5, element.height - 20);\n\n var markerPath = pathMap.getScaledPath('MARKER_SUB_PROCESS', {\n xScaleFactor: 1.5,\n yScaleFactor: 1.5,\n containerWidth: element.width,\n containerHeight: element.height,\n position: {\n mx: (element.width / 2 - 7.5) / element.width,\n my: (element.height - 20) / element.height\n }\n });\n\n drawMarker('sub-process', parentGfx, markerPath, {\n fill: getFillColor(element),\n stroke: getStrokeColor(element)\n });\n },\n 'ParallelMarker': function(parentGfx, element, position) {\n var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {\n xScaleFactor: 1,\n yScaleFactor: 1,\n containerWidth: element.width,\n containerHeight: element.height,\n position: {\n mx: ((element.width / 2 + position.parallel) / element.width),\n my: (element.height - 20) / element.height\n }\n });\n\n drawMarker('parallel', parentGfx, markerPath);\n },\n 'SequentialMarker': function(parentGfx, element, position) {\n var markerPath = pathMap.getScaledPath('MARKER_SEQUENTIAL', {\n xScaleFactor: 1,\n yScaleFactor: 1,\n containerWidth: element.width,\n containerHeight: element.height,\n position: {\n mx: ((element.width / 2 + position.seq) / element.width),\n my: (element.height - 19) / element.height\n }\n });\n\n drawMarker('sequential', parentGfx, markerPath);\n },\n 'CompensationMarker': function(parentGfx, element, position) {\n var markerMath = pathMap.getScaledPath('MARKER_COMPENSATION', {\n xScaleFactor: 1,\n yScaleFactor: 1,\n containerWidth: element.width,\n containerHeight: element.height,\n position: {\n mx: ((element.width / 2 + position.compensation) / element.width),\n my: (element.height - 13) / element.height\n }\n });\n\n drawMarker('compensation', parentGfx, markerMath, { strokeWidth: 1 });\n },\n 'LoopMarker': function(parentGfx, element, position) {\n var markerPath = pathMap.getScaledPath('MARKER_LOOP', {\n xScaleFactor: 1,\n yScaleFactor: 1,\n containerWidth: element.width,\n containerHeight: element.height,\n position: {\n mx: ((element.width / 2 + position.loop) / element.width),\n my: (element.height - 7) / element.height\n }\n });\n\n drawMarker('loop', parentGfx, markerPath, {\n strokeWidth: 1,\n fill: 'none',\n strokeLinecap: 'round',\n strokeMiterlimit: 0.5\n });\n },\n 'AdhocMarker': function(parentGfx, element, position) {\n var markerPath = pathMap.getScaledPath('MARKER_ADHOC', {\n xScaleFactor: 1,\n yScaleFactor: 1,\n containerWidth: element.width,\n containerHeight: element.height,\n position: {\n mx: ((element.width / 2 + position.adhoc) / element.width),\n my: (element.height - 15) / element.height\n }\n });\n\n drawMarker('adhoc', parentGfx, markerPath, {\n strokeWidth: 1,\n fill: 'black'\n });\n }\n };\n\n function attachTaskMarkers(parentGfx, element, taskMarkers) {\n var obj = getSemantic(element);\n\n var subprocess = taskMarkers && taskMarkers.indexOf('SubProcessMarker') !== -1;\n var position;\n\n if (subprocess) {\n position = {\n seq: -21,\n parallel: -22,\n compensation: -42,\n loop: -18,\n adhoc: 10\n };\n } else {\n position = {\n seq: -3,\n parallel: -6,\n compensation: -27,\n loop: 0,\n adhoc: 10\n };\n }\n\n forEach(taskMarkers, function(marker) {\n renderer(marker)(parentGfx, element, position);\n });\n\n if (obj.isForCompensation) {\n renderer('CompensationMarker')(parentGfx, element, position);\n }\n\n if (obj.$type === 'bpmn:AdHocSubProcess') {\n renderer('AdhocMarker')(parentGfx, element, position);\n }\n\n var loopCharacteristics = obj.loopCharacteristics,\n isSequential = loopCharacteristics && loopCharacteristics.isSequential;\n\n if (loopCharacteristics) {\n\n if (isSequential === undefined) {\n renderer('LoopMarker')(parentGfx, element, position);\n }\n\n if (isSequential === false) {\n renderer('ParallelMarker')(parentGfx, element, position);\n }\n\n if (isSequential === true) {\n renderer('SequentialMarker')(parentGfx, element, position);\n }\n }\n }\n\n function renderDataItemCollection(parentGfx, element) {\n\n var yPosition = (element.height - 16) / element.height;\n\n var pathData = pathMap.getScaledPath('DATA_OBJECT_COLLECTION_PATH', {\n xScaleFactor: 1,\n yScaleFactor: 1,\n containerWidth: element.width,\n containerHeight: element.height,\n position: {\n mx: 0.451,\n my: yPosition\n }\n });\n\n /* collection path */ drawPath(parentGfx, pathData, {\n strokeWidth: 2\n });\n }\n\n\n // extension API, use at your own risk\n this._drawPath = drawPath;\n\n}\n\n\ninherits(BpmnRenderer, BaseRenderer);\n\nBpmnRenderer.$inject = [ 'eventBus', 'styles', 'pathMap', 'canvas' ];\n\nmodule.exports = BpmnRenderer;\n\n\nBpmnRenderer.prototype.canRender = function(element) {\n return is(element, 'bpmn:BaseElement');\n};\n\nBpmnRenderer.prototype.drawShape = function(parentGfx, element) {\n var type = element.type;\n var h = this.handlers[type];\n\n /* jshint -W040 */\n return h(parentGfx, element);\n};\n\nBpmnRenderer.prototype.drawConnection = function(parentGfx, element) {\n var type = element.type;\n var h = this.handlers[type];\n\n /* jshint -W040 */\n return h(parentGfx, element);\n};\n\nBpmnRenderer.prototype.getShapePath = function(element) {\n\n if (is(element, 'bpmn:Event')) {\n return getCirclePath(element);\n }\n\n if (is(element, 'bpmn:Activity')) {\n return getRoundRectPath(element, TASK_BORDER_RADIUS);\n }\n\n if (is(element, 'bpmn:Gateway')) {\n return getDiamondPath(element);\n }\n\n return getRectPath(element);\n};\n\n\n///////// helper functions /////////////////////////////\n\n/**\n * Checks if eventDefinition of the given element matches with semantic type.\n *\n * @return {boolean} true if element is of the given semantic type\n */\nfunction isTypedEvent(event, eventDefinitionType, filter) {\n\n function matches(definition, filter) {\n return every(filter, function(val, key) {\n\n // we want a == conversion here, to be able to catch\n // undefined == false and friends\n /* jshint -W116 */\n return definition[key] == val;\n });\n }\n\n return some(event.eventDefinitions, function(definition) {\n return definition.$type === eventDefinitionType && matches(event, filter);\n });\n}\n\nfunction isThrowEvent(event) {\n return (event.$type === 'bpmn:IntermediateThrowEvent') || (event.$type === 'bpmn:EndEvent');\n}\n\nfunction isCollection(element) {\n var dataObject = element.dataObjectRef;\n\n return element.isCollection || (dataObject && dataObject.isCollection);\n}\n\nfunction getDi(element) {\n return element.businessObject.di;\n}\n\nfunction getSemantic(element) {\n return element.businessObject;\n}\n\n\n\n/////// cropping path customizations /////////////////////////\n\nfunction getCirclePath(shape) {\n\n var cx = shape.x + shape.width / 2,\n cy = shape.y + shape.height / 2,\n radius = shape.width / 2;\n\n var circlePath = [\n ['M', cx, cy],\n ['m', 0, -radius],\n ['a', radius, radius, 0, 1, 1, 0, 2 * radius],\n ['a', radius, radius, 0, 1, 1, 0, -2 * radius],\n ['z']\n ];\n\n return componentsToPath(circlePath);\n}\n\nfunction getRoundRectPath(shape, borderRadius) {\n\n var x = shape.x,\n y = shape.y,\n width = shape.width,\n height = shape.height;\n\n var roundRectPath = [\n ['M', x + borderRadius, y],\n ['l', width - borderRadius * 2, 0],\n ['a', borderRadius, borderRadius, 0, 0, 1, borderRadius, borderRadius],\n ['l', 0, height - borderRadius * 2],\n ['a', borderRadius, borderRadius, 0, 0, 1, -borderRadius, borderRadius],\n ['l', borderRadius * 2 - width, 0],\n ['a', borderRadius, borderRadius, 0, 0, 1, -borderRadius, -borderRadius],\n ['l', 0, borderRadius * 2 - height],\n ['a', borderRadius, borderRadius, 0, 0, 1, borderRadius, -borderRadius],\n ['z']\n ];\n\n return componentsToPath(roundRectPath);\n}\n\nfunction getDiamondPath(shape) {\n\n var width = shape.width,\n height = shape.height,\n x = shape.x,\n y = shape.y,\n halfWidth = width / 2,\n halfHeight = height / 2;\n\n var diamondPath = [\n ['M', x + halfWidth, y],\n ['l', halfWidth, halfHeight],\n ['l', -halfWidth, halfHeight],\n ['l', -halfWidth, -halfHeight],\n ['z']\n ];\n\n return componentsToPath(diamondPath);\n}\n\nfunction getRectPath(shape) {\n var x = shape.x,\n y = shape.y,\n width = shape.width,\n height = shape.height;\n\n var rectPath = [\n ['M', x, y],\n ['l', width, 0],\n ['l', 0, height],\n ['l', -width, 0],\n ['z']\n ];\n\n return componentsToPath(rectPath);\n}\n\nfunction getFillColor(element, defaultColor) {\n var bo = getBusinessObject(element);\n\n return bo.di.get('fill') || defaultColor || 'white';\n}\n\nfunction getStrokeColor(element, defaultColor) {\n var bo = getBusinessObject(element);\n\n return bo.di.get('stroke') || defaultColor || 'black';\n}\n","'use strict';\n\n/**\n * Map containing SVG paths needed by BpmnRenderer.\n */\n\nfunction PathMap() {\n\n /**\n * Contains a map of path elements\n *\n *

Path definition

\n * A parameterized path is defined like this:\n *
\n   * 'GATEWAY_PARALLEL': {\n   *   d: 'm {mx},{my} {e.x0},0 0,{e.x1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} ' +\n          '-{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z',\n   *   height: 17.5,\n   *   width:  17.5,\n   *   heightElements: [2.5, 7.5],\n   *   widthElements: [2.5, 7.5]\n   * }\n   * 
\n *

It's important to specify a correct height and width for the path as the scaling\n * is based on the ratio between the specified height and width in this object and the\n * height and width that is set as scale target (Note x,y coordinates will be scaled with\n * individual ratios).

\n *

The 'heightElements' and 'widthElements' array must contain the values that will be scaled.\n * The scaling is based on the computed ratios.\n * Coordinates on the y axis should be in the heightElement's array, they will be scaled using\n * the computed ratio coefficient.\n * In the parameterized path the scaled values can be accessed through the 'e' object in {} brackets.\n *

    \n *
  • The values for the y axis can be accessed in the path string using {e.y0}, {e.y1}, ....
  • \n *
  • The values for the x axis can be accessed in the path string using {e.x0}, {e.x1}, ....
  • \n *
\n * The numbers x0, x1 respectively y0, y1, ... map to the corresponding array index.\n *

\n */\n this.pathMap = {\n 'EVENT_MESSAGE': {\n d: 'm {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}',\n height: 36,\n width: 36,\n heightElements: [6, 14],\n widthElements: [10.5, 21]\n },\n 'EVENT_SIGNAL': {\n d: 'M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z',\n height: 36,\n width: 36,\n heightElements: [18],\n widthElements: [10, 20]\n },\n 'EVENT_ESCALATION': {\n d: 'M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z',\n height: 36,\n width: 36,\n heightElements: [20, 7],\n widthElements: [8]\n },\n 'EVENT_CONDITIONAL': {\n d: 'M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z ' +\n 'M {e.x2},{e.y3} l {e.x0},0 ' +\n 'M {e.x2},{e.y4} l {e.x0},0 ' +\n 'M {e.x2},{e.y5} l {e.x0},0 ' +\n 'M {e.x2},{e.y6} l {e.x0},0 ' +\n 'M {e.x2},{e.y7} l {e.x0},0 ' +\n 'M {e.x2},{e.y8} l {e.x0},0 ',\n height: 36,\n width: 36,\n heightElements: [8.5, 14.5, 18, 11.5, 14.5, 17.5, 20.5, 23.5, 26.5],\n widthElements: [10.5, 14.5, 12.5]\n },\n 'EVENT_LINK': {\n d: 'm {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z',\n height: 36,\n width: 36,\n heightElements: [4.4375, 6.75, 7.8125],\n widthElements: [9.84375, 13.5]\n },\n 'EVENT_ERROR': {\n d: 'm {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z',\n height: 36,\n width: 36,\n heightElements: [0.023, 8.737, 8.151, 16.564, 10.591, 8.714],\n widthElements: [0.085, 6.672, 6.97, 4.273, 5.337, 6.636]\n },\n 'EVENT_CANCEL_45': {\n d: 'm {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 ' +\n '0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z',\n height: 36,\n width: 36,\n heightElements: [4.75, 8.5],\n widthElements: [4.75, 8.5]\n },\n 'EVENT_COMPENSATION': {\n d: 'm {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z',\n height: 36,\n width: 36,\n heightElements: [6.5, 13, 0.4, 6.1],\n widthElements: [9, 9.3, 8.7]\n },\n 'EVENT_TIMER_WH': {\n d: 'M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ',\n height: 36,\n width: 36,\n heightElements: [10, 2],\n widthElements: [3, 7]\n },\n 'EVENT_TIMER_LINE': {\n d: 'M {mx},{my} ' +\n 'm {e.x0},{e.y0} l -{e.x1},{e.y1} ',\n height: 36,\n width: 36,\n heightElements: [10, 3],\n widthElements: [0, 0]\n },\n 'EVENT_MULTIPLE': {\n d:'m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z',\n height: 36,\n width: 36,\n heightElements: [6.28099, 12.56199],\n widthElements: [3.1405, 9.42149, 12.56198]\n },\n 'EVENT_PARALLEL_MULTIPLE': {\n d:'m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} ' +\n '-{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z',\n height: 36,\n width: 36,\n heightElements: [2.56228, 7.68683],\n widthElements: [2.56228, 7.68683]\n },\n 'GATEWAY_EXCLUSIVE': {\n d:'m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} ' +\n '{e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} ' +\n '{e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z',\n height: 17.5,\n width: 17.5,\n heightElements: [8.5, 6.5312, -6.5312, -8.5],\n widthElements: [6.5, -6.5, 3, -3, 5, -5]\n },\n 'GATEWAY_PARALLEL': {\n d:'m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 ' +\n '0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z',\n height: 30,\n width: 30,\n heightElements: [5, 12.5],\n widthElements: [5, 12.5]\n },\n 'GATEWAY_EVENT_BASED': {\n d:'m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z',\n height: 11,\n width: 11,\n heightElements: [-6, 6, 12, -12],\n widthElements: [9, -3, -12]\n },\n 'GATEWAY_COMPLEX': {\n d:'m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} ' +\n '{e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} ' +\n '{e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} ' +\n '-{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z',\n height: 17.125,\n width: 17.125,\n heightElements: [4.875, 3.4375, 2.125, 3],\n widthElements: [3.4375, 2.125, 4.875, 3]\n },\n 'DATA_OBJECT_PATH': {\n d:'m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0',\n height: 61,\n width: 51,\n heightElements: [10, 50, 60],\n widthElements: [10, 40, 50, 60]\n },\n 'DATA_OBJECT_COLLECTION_PATH': {\n d:'m {mx}, {my} ' +\n 'm 0 15 l 0 -15 ' +\n 'm 4 15 l 0 -15 ' +\n 'm 4 15 l 0 -15 ',\n height: 61,\n width: 51,\n heightElements: [12],\n widthElements: [1, 6, 12, 15]\n },\n 'DATA_ARROW': {\n d:'m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z',\n height: 61,\n width: 51,\n heightElements: [],\n widthElements: []\n },\n 'DATA_STORE': {\n d:'m {mx},{my} ' +\n 'l 0,{e.y2} ' +\n 'c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 ' +\n 'l 0,-{e.y2} ' +\n 'c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0' +\n 'c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 ' +\n 'm -{e.x2},{e.y0}' +\n 'c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0' +\n 'm -{e.x2},{e.y0}' +\n 'c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0',\n height: 61,\n width: 61,\n heightElements: [7, 10, 45],\n widthElements: [2, 58, 60]\n },\n 'TEXT_ANNOTATION': {\n d: 'm {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0',\n height: 30,\n width: 10,\n heightElements: [30],\n widthElements: [10]\n },\n 'MARKER_SUB_PROCESS': {\n d: 'm{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0',\n height: 10,\n width: 10,\n heightElements: [],\n widthElements: []\n },\n 'MARKER_PARALLEL': {\n d: 'm{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10',\n height: 10,\n width: 10,\n heightElements: [],\n widthElements: []\n },\n 'MARKER_SEQUENTIAL': {\n d: 'm{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0',\n height: 10,\n width: 10,\n heightElements: [],\n widthElements: []\n },\n 'MARKER_COMPENSATION': {\n d: 'm {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z',\n height: 10,\n width: 21,\n heightElements: [],\n widthElements: []\n },\n 'MARKER_LOOP': {\n d: 'm {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 ' +\n '-6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 ' +\n '0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 ' +\n 'l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902',\n height: 13.9,\n width: 13.7,\n heightElements: [],\n widthElements: []\n },\n 'MARKER_ADHOC': {\n d: 'm {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 ' +\n '3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 ' +\n '1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 ' +\n '-3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 ' +\n '-2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z',\n height: 4,\n width: 15,\n heightElements: [],\n widthElements: []\n },\n 'TASK_TYPE_SEND': {\n d: 'm {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}',\n height: 14,\n width: 21,\n heightElements: [6, 14],\n widthElements: [10.5, 21]\n },\n 'TASK_TYPE_SCRIPT': {\n d: 'm {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 ' +\n 'c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z ' +\n 'm -7,-12 l 5,0 ' +\n 'm -4.5,3 l 4.5,0 ' +\n 'm -3,3 l 5,0' +\n 'm -4,3 l 5,0',\n height: 15,\n width: 12.6,\n heightElements: [6, 14],\n widthElements: [10.5, 21]\n },\n 'TASK_TYPE_USER_1': {\n d: 'm {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 ' +\n '-4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 ' +\n '0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 ' +\n 'h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 z' +\n 'm -8,6 l 0,5.5 m 11,0 l 0,-5'\n },\n 'TASK_TYPE_USER_2': {\n d: 'm {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 ' +\n '-2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 '\n },\n 'TASK_TYPE_USER_3': {\n d: 'm {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 ' +\n '4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 ' +\n '-4.20799998,3.36699999 -4.20699998,4.34799999 z'\n },\n 'TASK_TYPE_MANUAL': {\n d: 'm {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 ' +\n '-0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 ' +\n '0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 ' +\n '-1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 ' +\n '0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 ' +\n '-10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 ' +\n '2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 ' +\n '-0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 ' +\n '-1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 ' +\n '-0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 ' +\n '0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 ' +\n '-5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z'\n },\n 'TASK_TYPE_INSTANTIATING_SEND': {\n d: 'm {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6'\n },\n 'TASK_TYPE_SERVICE': {\n d: 'm {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 ' +\n '0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 ' +\n '-1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 ' +\n 'v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 ' +\n '-0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 ' +\n '-1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 ' +\n 'h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 ' +\n '-0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 ' +\n 'c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 ' +\n 'l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 ' +\n '0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 ' +\n 'c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z ' +\n 'm 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 ' +\n '0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 ' +\n '0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z'\n },\n 'TASK_TYPE_SERVICE_FILL': {\n d: 'm {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 ' +\n '0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 ' +\n '0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z'\n },\n 'TASK_TYPE_BUSINESS_RULE_HEADER': {\n d: 'm {mx},{my} 0,4 20,0 0,-4 z'\n },\n 'TASK_TYPE_BUSINESS_RULE_MAIN': {\n d: 'm {mx},{my} 0,12 20,0 0,-12 z' +\n 'm 0,8 l 20,0 ' +\n 'm -13,-4 l 0,8'\n },\n 'MESSAGE_FLOW_MARKER': {\n d: 'm {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6'\n }\n };\n\n this.getRawPath = function getRawPath(pathId) {\n return this.pathMap[pathId].d;\n };\n\n /**\n * Scales the path to the given height and width.\n *

Use case

\n *

Use case is to scale the content of elements (event, gateways) based\n * on the element bounding box's size.\n *

\n *

Why not transform

\n *

Scaling a path with transform() will also scale the stroke and IE does not support\n * the option 'non-scaling-stroke' to prevent this.\n * Also there are use cases where only some parts of a path should be\n * scaled.

\n *\n * @param {String} pathId The ID of the path.\n * @param {Object} param

\n * Example param object scales the path to 60% size of the container (data.width, data.height).\n *

\n   *   {\n   *     xScaleFactor: 0.6,\n   *     yScaleFactor:0.6,\n   *     containerWidth: data.width,\n   *     containerHeight: data.height,\n   *     position: {\n   *       mx: 0.46,\n   *       my: 0.2,\n   *     }\n   *   }\n   *   
\n *
    \n *
  • targetpathwidth = xScaleFactor * containerWidth
  • \n *
  • targetpathheight = yScaleFactor * containerHeight
  • \n *
  • Position is used to set the starting coordinate of the path. M is computed:\n *
      \n *
    • position.x * containerWidth
    • \n *
    • position.y * containerHeight
    • \n *
    \n * Center of the container
     position: {\n   *       mx: 0.5,\n   *       my: 0.5,\n   *     }
    \n * Upper left corner of the container\n *
     position: {\n   *       mx: 0.0,\n   *       my: 0.0,\n   *     }
    \n *
  • \n *
\n *

\n *\n */\n this.getScaledPath = function getScaledPath(pathId, param) {\n var rawPath = this.pathMap[pathId];\n\n // positioning\n // compute the start point of the path\n var mx, my;\n\n if (param.abspos) {\n mx = param.abspos.x;\n my = param.abspos.y;\n } else {\n mx = param.containerWidth * param.position.mx;\n my = param.containerHeight * param.position.my;\n }\n\n var coordinates = {}; //map for the scaled coordinates\n if (param.position) {\n\n // path\n var heightRatio = (param.containerHeight / rawPath.height) * param.yScaleFactor;\n var widthRatio = (param.containerWidth / rawPath.width) * param.xScaleFactor;\n\n\n //Apply height ratio\n for (var heightIndex = 0; heightIndex < rawPath.heightElements.length; heightIndex++) {\n coordinates['y' + heightIndex] = rawPath.heightElements[heightIndex] * heightRatio;\n }\n\n //Apply width ratio\n for (var widthIndex = 0; widthIndex < rawPath.widthElements.length; widthIndex++) {\n coordinates['x' + widthIndex] = rawPath.widthElements[widthIndex] * widthRatio;\n }\n }\n\n //Apply value to raw path\n var path = format(\n rawPath.d, {\n mx: mx,\n my: my,\n e: coordinates\n }\n );\n return path;\n };\n}\n\nmodule.exports = PathMap;\n\n////////// helpers //////////\n\n// copied from https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js\nvar tokenRegex = //{([^/}]+)/}/g,\n objNotationRegex = /(?:(?:^|/.)(.+?)(?=/[|/.|$|/()|/[('|\")(.+?)/2/])(/(/))?/g; // matches .xxxxx or [\"xxxxx\"] to run over object properties\n\nfunction replacer(all, key, obj) {\n var res = obj;\n key.replace(objNotationRegex, function(all, name, quote, quotedName, isFunc) {\n name = name || quotedName;\n if (res) {\n if (name in res) {\n res = res[name];\n }\n typeof res == 'function' && isFunc && (res = res());\n }\n });\n res = (res == null || res == obj ? all : res) + '';\n\n return res;\n}\n\nfunction format(str, obj) {\n return String(str).replace(tokenRegex, function(all, key) {\n return replacer(all, key, obj);\n });\n}\n","module.exports = {\n __init__: [ 'bpmnRenderer' ],\n bpmnRenderer: [ 'type', require(5) ],\n pathMap: [ 'type', require(6) ]\n};\n","var AutoResize = require(136);\n\nvar inherits = require(289);\n\nvar is = require(95).is;\n\n/**\n * Sub class of the AutoResize module which implements a BPMN\n * specific resize function.\n */\nfunction BpmnAutoResize(eventBus, elementRegistry, modeling, rules) {\n AutoResize.call(this, eventBus, elementRegistry, modeling, rules);\n}\n\nBpmnAutoResize.$inject = [ 'eventBus', 'elementRegistry', 'modeling', 'rules' ];\n\ninherits(BpmnAutoResize, AutoResize);\n\nmodule.exports = BpmnAutoResize;\n\n\n/**\n * Resize shapes and lanes\n *\n * @param {djs.model.Shape} target\n * @param {Object} newBounds\n */\nBpmnAutoResize.prototype.resize = function(target, newBounds) {\n\n if (is(target, 'bpmn:Participant')) {\n this._modeling.resizeLane(target, newBounds);\n } else {\n this._modeling.resizeShape(target, newBounds);\n }\n};","'use strict';\n\nvar is = require(95).is;\n\nvar inherits = require(289);\n\nvar forEach = require(303);\n\nvar AutoResizeProvider = require(137);\n\n/**\n * This module is a provider for automatically resizing parent BPMN elements\n */\nfunction BpmnAutoResizeProvider(eventBus, modeling) {\n AutoResizeProvider.call(this, eventBus);\n\n this._modeling = modeling;\n}\n\ninherits(BpmnAutoResizeProvider, AutoResizeProvider);\n\nBpmnAutoResizeProvider.$inject = [ 'eventBus', 'modeling' ];\n\nmodule.exports = BpmnAutoResizeProvider;\n\n\n/**\n * Check if the given target can be expanded\n *\n * @param {djs.model.Shape} target\n *\n * @return {boolean}\n */\nBpmnAutoResizeProvider.prototype.canResize = function(elements, target) {\n\n if (!is(target, 'bpmn:Participant') && !is(target, 'bpmn:Lane') && !(is(target, 'bpmn:SubProcess'))) {\n return false;\n }\n\n var canResize = true;\n\n forEach(elements, function(element) {\n\n if (is(element, 'bpmn:Lane') || element.labelTarget) {\n canResize = false;\n return;\n }\n });\n\n return canResize;\n};\n","module.exports = {\n __init__: [ 'bpmnAutoResize', 'bpmnAutoResizeProvider' ],\n bpmnAutoResize: [ 'type', require(8) ],\n bpmnAutoResizeProvider: [ 'type', require(9) ]\n};\n","'use strict';\n\n\nvar assign = require(431),\n forEach = require(303),\n isArray = require(422),\n is = require(95).is,\n isExpanded = require(93).isExpanded,\n isAny = require(68).isAny,\n getChildLanes = require(67).getChildLanes,\n isEventSubProcess = require(93).isEventSubProcess,\n hasPrimaryModifier = require(274).hasPrimaryModifier;\n\n/**\n * A provider for BPMN 2.0 elements context pad\n */\nfunction ContextPadProvider(eventBus, contextPad, modeling, elementFactory,\n connect, create, popupMenu,\n canvas, rules, translate) {\n\n contextPad.registerProvider(this);\n\n this._contextPad = contextPad;\n\n this._modeling = modeling;\n\n this._elementFactory = elementFactory;\n this._connect = connect;\n this._create = create;\n this._popupMenu = popupMenu;\n this._canvas = canvas;\n this._rules = rules;\n this._translate = translate;\n\n\n eventBus.on('create.end', 250, function(event) {\n var shape = event.context.shape;\n\n if (!hasPrimaryModifier(event)) {\n return;\n }\n\n var entries = contextPad.getEntries(shape);\n\n if (entries.replace) {\n entries.replace.action.click(event, shape);\n }\n });\n}\n\nContextPadProvider.$inject = [\n 'eventBus',\n 'contextPad',\n 'modeling',\n 'elementFactory',\n 'connect',\n 'create',\n 'popupMenu',\n 'canvas',\n 'rules',\n 'translate'\n];\n\nmodule.exports = ContextPadProvider;\n\n\nContextPadProvider.prototype.getContextPadEntries = function(element) {\n\n var contextPad = this._contextPad,\n modeling = this._modeling,\n\n elementFactory = this._elementFactory,\n connect = this._connect,\n create = this._create,\n popupMenu = this._popupMenu,\n canvas = this._canvas,\n rules = this._rules,\n\n translate = this._translate;\n\n var actions = {};\n\n if (element.type === 'label') {\n return actions;\n }\n\n var businessObject = element.businessObject;\n\n function startConnect(event, element, autoActivate) {\n connect.start(event, element, autoActivate);\n }\n\n function removeElement(e) {\n modeling.removeElements([ element ]);\n }\n\n function getReplaceMenuPosition(element) {\n\n var Y_OFFSET = 5;\n\n var diagramContainer = canvas.getContainer(),\n pad = contextPad.getPad(element).html;\n\n var diagramRect = diagramContainer.getBoundingClientRect(),\n padRect = pad.getBoundingClientRect();\n\n var top = padRect.top - diagramRect.top;\n var left = padRect.left - diagramRect.left;\n\n var pos = {\n x: left,\n y: top + padRect.height + Y_OFFSET\n };\n\n return pos;\n }\n\n\n /**\n * Create an append action\n *\n * @param {String} type\n * @param {String} className\n * @param {String} [title]\n * @param {Object} [options]\n *\n * @return {Object} descriptor\n */\n function appendAction(type, className, title, options) {\n\n if (typeof title !== 'string') {\n options = title;\n title = translate('Append {type}', { type: type.replace(/^bpmn/:/, '') });\n }\n\n function appendListener(event, element) {\n\n var shape = elementFactory.createShape(assign({ type: type }, options));\n create.start(event, shape, element);\n }\n\n return {\n group: 'model',\n className: className,\n title: title,\n action: {\n dragstart: appendListener,\n click: appendListener\n }\n };\n }\n\n function splitLaneHandler(count) {\n\n return function(event, element) {\n // actual split\n modeling.splitLane(element, count);\n\n // refresh context pad after split to\n // get rid of split icons\n contextPad.open(element, true);\n };\n }\n\n\n if (isAny(businessObject, [ 'bpmn:Lane', 'bpmn:Participant' ]) && isExpanded(businessObject)) {\n\n var childLanes = getChildLanes(element);\n\n assign(actions, {\n 'lane-insert-above': {\n group: 'lane-insert-above',\n className: 'bpmn-icon-lane-insert-above',\n title: translate('Add Lane above'),\n action: {\n click: function(event, element) {\n modeling.addLane(element, 'top');\n }\n }\n }\n });\n\n if (childLanes.length < 2) {\n\n if (element.height >= 120) {\n assign(actions, {\n 'lane-divide-two': {\n group: 'lane-divide',\n className: 'bpmn-icon-lane-divide-two',\n title: translate('Divide into two Lanes'),\n action: {\n click: splitLaneHandler(2)\n }\n }\n });\n }\n\n if (element.height >= 180) {\n assign(actions, {\n 'lane-divide-three': {\n group: 'lane-divide',\n className: 'bpmn-icon-lane-divide-three',\n title: translate('Divide into three Lanes'),\n action: {\n click: splitLaneHandler(3)\n }\n }\n });\n }\n }\n\n assign(actions, {\n 'lane-insert-below': {\n group: 'lane-insert-below',\n className: 'bpmn-icon-lane-insert-below',\n title: translate('Add Lane below'),\n action: {\n click: function(event, element) {\n modeling.addLane(element, 'bottom');\n }\n }\n }\n });\n\n }\n\n if (is(businessObject, 'bpmn:FlowNode')) {\n\n if (is(businessObject, 'bpmn:EventBasedGateway')) {\n\n assign(actions, {\n 'append.receive-task': appendAction('bpmn:ReceiveTask', 'bpmn-icon-receive-task'),\n 'append.message-intermediate-event': appendAction('bpmn:IntermediateCatchEvent',\n 'bpmn-icon-intermediate-event-catch-message',\n { eventDefinitionType: 'bpmn:MessageEventDefinition' }),\n 'append.timer-intermediate-event': appendAction('bpmn:IntermediateCatchEvent',\n 'bpmn-icon-intermediate-event-catch-timer',\n { eventDefinitionType: 'bpmn:TimerEventDefinition' }),\n 'append.condtion-intermediate-event': appendAction('bpmn:IntermediateCatchEvent',\n 'bpmn-icon-intermediate-event-catch-condition',\n { eventDefinitionType: 'bpmn:ConditionalEventDefinition' }),\n 'append.signal-intermediate-event': appendAction('bpmn:IntermediateCatchEvent',\n 'bpmn-icon-intermediate-event-catch-signal',\n { eventDefinitionType: 'bpmn:SignalEventDefinition' })\n });\n } else\n\n if (isEventType(businessObject, 'bpmn:BoundaryEvent', 'bpmn:CompensateEventDefinition')) {\n\n assign(actions, {\n 'append.compensation-activity':\n appendAction('bpmn:Task', 'bpmn-icon-task', translate('Append compensation activity'), {\n isForCompensation: true\n })\n });\n } else\n\n if (!is(businessObject, 'bpmn:EndEvent') &&\n !businessObject.isForCompensation &&\n !isEventType(businessObject, 'bpmn:IntermediateThrowEvent', 'bpmn:LinkEventDefinition') &&\n !isEventSubProcess(businessObject)) {\n\n assign(actions, {\n 'append.end-event': appendAction('bpmn:EndEvent', 'bpmn-icon-end-event-none'),\n 'append.gateway': appendAction('bpmn:ExclusiveGateway', 'bpmn-icon-gateway-xor'),\n 'append.append-task': appendAction('bpmn:Task', 'bpmn-icon-task'),\n 'append.intermediate-event': appendAction('bpmn:IntermediateThrowEvent',\n 'bpmn-icon-intermediate-event-none')\n });\n }\n }\n\n var replaceMenu;\n\n if (popupMenu._providers['bpmn-replace']) {\n replaceMenu = popupMenu.create('bpmn-replace', element);\n }\n\n if (replaceMenu && !replaceMenu.isEmpty()) {\n\n // Replace menu entry\n assign(actions, {\n 'replace': {\n group: 'edit',\n className: 'bpmn-icon-screw-wrench',\n title: translate('Change type'),\n action: {\n click: function(event, element) {\n replaceMenu.open(assign(getReplaceMenuPosition(element), {\n cursor: { x: event.x, y: event.y }\n }), element);\n }\n }\n }\n });\n }\n\n if (isAny(businessObject, [\n 'bpmn:FlowNode',\n 'bpmn:InteractionNode',\n 'bpmn:DataObjectReference',\n 'bpmn:DataStoreReference'\n ]) ) {\n\n assign(actions, {\n 'append.text-annotation': appendAction('bpmn:TextAnnotation', 'bpmn-icon-text-annotation'),\n\n 'connect': {\n group: 'connect',\n className: 'bpmn-icon-connection-multi',\n title: translate('Connect using ' +\n (businessObject.isForCompensation ? '' : 'Sequence/MessageFlow or ') +\n 'Association'),\n action: {\n click: startConnect,\n dragstart: startConnect\n }\n }\n });\n }\n\n if (isAny(businessObject, [ 'bpmn:DataObjectReference', 'bpmn:DataStoreReference' ])) {\n assign(actions, {\n 'connect': {\n group: 'connect',\n className: 'bpmn-icon-connection-multi',\n title: translate('Connect using DataInputAssociation'),\n action: {\n click: startConnect,\n dragstart: startConnect\n }\n }\n });\n }\n\n // delete element entry, only show if allowed by rules\n var deleteAllowed = rules.allowed('elements.delete', { elements: [ element ] });\n\n if (isArray(deleteAllowed)) {\n // was the element returned as a deletion candidate?\n deleteAllowed = deleteAllowed[0] === element;\n }\n\n if (deleteAllowed) {\n assign(actions, {\n 'delete': {\n group: 'edit',\n className: 'bpmn-icon-trash',\n title: translate('Remove'),\n action: {\n click: removeElement,\n dragstart: removeElement\n }\n }\n });\n }\n\n return actions;\n};\n\nfunction isEventType(eventBo, type, definition) {\n\n var isType = eventBo.$instanceOf(type);\n var isDefinition = false;\n\n var definitions = eventBo.eventDefinitions || [];\n forEach(definitions, function(def) {\n if (def.$type === definition) {\n isDefinition = true;\n }\n });\n\n return isType && isDefinition;\n}\n","module.exports = {\n __depends__: [\n require(114),\n require(153),\n require(233),\n require(151),\n require(157),\n require(74)\n ],\n __init__: [ 'contextPadProvider' ],\n contextPadProvider: [ 'type', require(11) ]\n};","'use strict';\n\nvar ModelUtil = require(95),\n getBusinessObject = ModelUtil.getBusinessObject,\n is = ModelUtil.is;\n\nvar ModelCloneHelper = require(97);\n\nvar ModelCloneUtils = require(98),\n getProperties = ModelCloneUtils.getProperties;\n\nvar IGNORED_PROPERTIES = ModelCloneUtils.IGNORED_PROPERTIES;\n\nvar filter = require(301),\n forEach = require(303);\n\nfunction setProperties(descriptor, data, properties) {\n forEach(properties, function(property) {\n if (data[property] !== undefined) {\n descriptor[property] = data[property];\n }\n });\n}\n\nfunction removeProperties(element, properties) {\n forEach(properties, function(prop) {\n if (element[prop]) {\n delete element[prop];\n }\n });\n}\n\nfunction BpmnCopyPaste(\n bpmnFactory, eventBus, copyPaste,\n clipboard, canvas, bpmnRules) {\n\n var helper = new ModelCloneHelper(eventBus);\n\n copyPaste.registerDescriptor(function(element, descriptor) {\n var businessObject = descriptor.oldBusinessObject = getBusinessObject(element);\n\n var colors = {};\n\n descriptor.type = element.type;\n\n setProperties(descriptor, businessObject.di, [ 'isExpanded' ]);\n\n setProperties(colors, businessObject.di, [ 'fill', 'stroke' ]);\n\n descriptor.colors = colors;\n\n if (element.type === 'label') {\n return descriptor;\n }\n\n setProperties(descriptor, businessObject, [\n 'type',\n 'processRef',\n 'triggeredByEvent'\n ]);\n\n if (businessObject.default) {\n descriptor.default = businessObject.default.id;\n }\n\n return descriptor;\n });\n\n eventBus.on('element.paste', function(context) {\n var descriptor = context.descriptor,\n createdElements = context.createdElements,\n parent = descriptor.parent,\n rootElement = canvas.getRootElement(),\n oldBusinessObject = descriptor.oldBusinessObject,\n newBusinessObject,\n source,\n target,\n canConnect;\n\n newBusinessObject = bpmnFactory.create(oldBusinessObject.$type);\n\n var properties = getProperties(oldBusinessObject.$descriptor);\n\n properties = filter(properties, function(property) {\n return IGNORED_PROPERTIES.indexOf(property.replace(/bpmn:/, '')) === -1;\n });\n\n descriptor.businessObject = helper.clone(oldBusinessObject, newBusinessObject, properties);\n\n if (descriptor.type === 'label') {\n return;\n }\n\n if (is(parent, 'bpmn:Process')) {\n descriptor.parent = is(rootElement, 'bpmn:Collaboration') ? rootElement : parent;\n }\n\n if (descriptor.type === 'bpmn:DataOutputAssociation' ||\n descriptor.type === 'bpmn:DataInputAssociation' ||\n descriptor.type === 'bpmn:MessageFlow') {\n descriptor.parent = rootElement;\n }\n\n if (is(parent, 'bpmn:Lane')) {\n descriptor.parent = parent.parent;\n }\n\n // make sure that the correct type of connection is created\n if (descriptor.waypoints) {\n source = createdElements[descriptor.source];\n target = createdElements[descriptor.target];\n\n if (source && target) {\n source = source.element;\n target = target.element;\n }\n\n canConnect = bpmnRules.canConnect(source, target);\n\n if (canConnect) {\n descriptor.type = canConnect.type;\n }\n }\n\n // remove the id or else we cannot paste multiple times\n delete newBusinessObject.id;\n\n // assign an ID\n bpmnFactory._ensureId(newBusinessObject);\n\n if (descriptor.type === 'bpmn:Participant' && descriptor.processRef) {\n descriptor.processRef = newBusinessObject.processRef = bpmnFactory.create('bpmn:Process');\n }\n\n setProperties(newBusinessObject, descriptor, [\n 'isExpanded',\n 'triggeredByEvent'\n ]);\n\n removeProperties(descriptor, [\n 'triggeredByEvent'\n ]);\n });\n\n}\n\n\nBpmnCopyPaste.$inject = [\n 'bpmnFactory',\n 'eventBus',\n 'copyPaste',\n 'clipboard',\n 'canvas',\n 'bpmnRules'\n];\n\nmodule.exports = BpmnCopyPaste;\n","module.exports = {\n __depends__: [\n require(155)\n ],\n __init__: [ 'bpmnCopyPaste' ],\n bpmnCopyPaste: [ 'type', require(13) ]\n};\n","'use strict';\n\nvar filter = require(301);\n\nvar isAny = require(68).isAny;\n\n/**\n * Registers element exclude filters for elements that currently do \n * not support distribution.\n */\nfunction BpmnDistributeElements(distributeElements) {\n\n distributeElements.registerFilter(function(elements) {\n return filter(elements, function(element) {\n var cannotDistribute = isAny(element, [\n 'bpmn:Association',\n 'bpmn:BoundaryEvent',\n 'bpmn:DataInputAssociation',\n 'bpmn:DataOutputAssociation',\n 'bpmn:Lane',\n 'bpmn:MessageFlow',\n 'bpmn:Participant',\n 'bpmn:SequenceFlow',\n 'bpmn:TextAnnotation'\n ]);\n\n return !(element.labelTarget || cannotDistribute);\n });\n });\n}\n\nBpmnDistributeElements.$inject = [ 'distributeElements' ];\n\nmodule.exports = BpmnDistributeElements;\n","module.exports = {\n __depends__: [\n require(159)\n ],\n __init__: [ 'bpmnDistributeElements' ],\n bpmnDistributeElements: [ 'type', require(15) ]\n};\n","'use strict';\n\nvar inherits = require(289);\n\nvar EditorActions = require(163);\n\nvar filter = require(301);\n\nvar is = require(95).is;\n\nvar getBBox = require(266).getBBox;\n\nfunction BpmnEditorActions(\n injector,\n canvas, elementRegistry, selection,\n spaceTool,\n lassoTool,\n handTool,\n globalConnect,\n distributeElements,\n alignElements,\n directEditing,\n searchPad,\n modeling) {\n\n injector.invoke(EditorActions, this);\n\n this.register({\n selectElements: function() {\n // select all elements except for the invisible\n // root element\n var rootElement = canvas.getRootElement();\n\n var elements = elementRegistry.filter(function(element) {\n return element !== rootElement;\n });\n\n selection.select(elements);\n\n return elements;\n },\n spaceTool: function() {\n spaceTool.toggle();\n },\n lassoTool: function() {\n lassoTool.toggle();\n },\n handTool: function() {\n handTool.toggle();\n },\n globalConnectTool: function() {\n globalConnect.toggle();\n },\n distributeElements: function(opts) {\n var currentSelection = selection.get(),\n type = opts.type;\n\n if (currentSelection.length) {\n distributeElements.trigger(currentSelection, type);\n }\n },\n alignElements: function(opts) {\n var currentSelection = selection.get(),\n aligneableElements = [],\n type = opts.type;\n\n if (currentSelection.length) {\n aligneableElements = filter(currentSelection, function(element) {\n return !is(element, 'bpmn:Lane');\n });\n\n alignElements.trigger(aligneableElements, type);\n }\n },\n setColor: function(opts) {\n var currentSelection = selection.get();\n\n if (currentSelection.length) {\n modeling.setColor(currentSelection, opts);\n }\n },\n directEditing: function() {\n var currentSelection = selection.get();\n\n if (currentSelection.length) {\n directEditing.activate(currentSelection[0]);\n }\n },\n find: function() {\n searchPad.toggle();\n },\n moveToOrigin: function() {\n var rootElement = canvas.getRootElement(),\n boundingBox,\n elements;\n\n if (is(rootElement, 'bpmn:Collaboration')) {\n elements = elementRegistry.filter(function(element) {\n return is(element.parent, 'bpmn:Collaboration');\n });\n } else {\n elements = elementRegistry.filter(function(element) {\n return element !== rootElement && !is(element.parent, 'bpmn:SubProcess');\n });\n }\n\n boundingBox = getBBox(elements);\n\n modeling.moveElements(elements, { x: -boundingBox.x, y: -boundingBox.y }, rootElement);\n }\n });\n}\n\ninherits(BpmnEditorActions, EditorActions);\n\nBpmnEditorActions.$inject = [\n 'injector',\n 'canvas', 'elementRegistry', 'selection',\n 'spaceTool',\n 'lassoTool',\n 'handTool',\n 'globalConnect',\n 'distributeElements',\n 'alignElements',\n 'directEditing',\n 'searchPad',\n 'modeling'\n];\n\nmodule.exports = BpmnEditorActions;\n","module.exports = {\n __depends__: [\n require(133),\n require(164),\n require(168),\n require(176),\n require(240),\n require(20),\n require(14),\n require(16),\n require(84),\n require(66)\n ],\n editorActions: [ 'type', require(17) ]\n};\n","'use strict';\n\nvar isAny = require(68).isAny;\n\n/**\n * Extention of GlobalConnect tool that implements BPMN specific rules about\n * connection start elements.\n */\nfunction BpmnGlobalConnect(globalConnect) {\n globalConnect.registerProvider(this);\n}\n\nBpmnGlobalConnect.$inject = [ 'globalConnect' ];\n\nmodule.exports = BpmnGlobalConnect;\n\n\n/**\n * Checks if given element can be used for starting connection.\n *\n * @param {Element} source\n * @return {Boolean}\n */\nBpmnGlobalConnect.prototype.canStartConnect = function(source) {\n\n if (nonExistantOrLabel(source)) {\n return null;\n }\n\n var businessObject = source.businessObject;\n\n return isAny(businessObject, [\n 'bpmn:FlowNode',\n 'bpmn:InteractionNode',\n 'bpmn:DataObjectReference',\n 'bpmn:DataStoreReference'\n ]);\n};\n\n\nfunction nonExistantOrLabel(element) {\n return !element || isLabel(element);\n}\n\nfunction isLabel(element) {\n return element.labelTarget;\n}\n\n\n","module.exports = {\n __depends__: [\n require(166)\n ],\n __init__: [ 'bpmnGlobalConnect' ],\n bpmnGlobalConnect: [ 'type', require(19) ]\n};\n","'use strict';\n\n/**\n * BPMN 2.0 specific key bindings.\n *\n * @param {Keyboard} keyboard\n * @param {EditorActions} editorActions\n */\nfunction BpmnKeyBindings(keyboard, editorActions) {\n\n keyboard.addListener(function(key, modifiers) {\n\n // ctrl + a -> select all elements\n if (key === 65 && keyboard.isCmd(modifiers)) {\n editorActions.trigger('selectElements');\n\n return true;\n }\n\n // ctrl + f -> search labels\n if (key === 70 && keyboard.isCmd(modifiers)) {\n editorActions.trigger('find');\n\n return true;\n }\n\n if (keyboard.hasModifier(modifiers)) {\n return;\n }\n\n // s -> activate space tool\n if (key === 83) {\n editorActions.trigger('spaceTool');\n\n return true;\n }\n\n // l -> activate lasso tool\n if (key === 76) {\n editorActions.trigger('lassoTool');\n\n return true;\n }\n\n // h -> activate hand tool\n if (key === 72) {\n editorActions.trigger('handTool');\n\n return true;\n }\n\n // c -> activate global connect tool\n if (key === 67) {\n editorActions.trigger('globalConnectTool');\n\n return true;\n }\n\n // e -> activate direct editing\n if (key === 69) {\n editorActions.trigger('directEditing');\n\n return true;\n }\n });\n}\n\nBpmnKeyBindings.$inject = [\n 'keyboard',\n 'editorActions'\n];\n\nmodule.exports = BpmnKeyBindings;","module.exports = {\n __depends__: [\n require(172)\n ],\n __init__: [ 'bpmnKeyBindings' ],\n bpmnKeyBindings: [ 'type', require(21) ]\n};\n","var svgAppend = require(472),\n svgAttr = require(474),\n svgCreate = require(478),\n svgRemove = require(481);\n\nvar getBusinessObject = require(95).getBusinessObject,\n is = require(95).is;\n\nvar translate = require(279).translate;\n\nvar MARKER_HIDDEN = 'djs-element-hidden',\n MARKER_LABEL_HIDDEN = 'djs-label-hidden';\n\nfunction getStrokeColor(element, defaultColor) {\n var bo = getBusinessObject(element);\n\n return bo.di.get('stroke') || defaultColor || 'black';\n}\n\nfunction LabelEditingPreview(eventBus, canvas, elementRegistry, pathMap) {\n var self = this;\n\n var defaultLayer = canvas.getDefaultLayer();\n\n var element, absoluteElementBBox, gfx;\n\n eventBus.on('directEditing.activate', function(context) {\n var activeProvider = context.active;\n\n element = activeProvider.element.label || activeProvider.element;\n\n // text annotation\n if (is(element, 'bpmn:TextAnnotation')) {\n absoluteElementBBox = canvas.getAbsoluteBBox(element);\n\n gfx = svgCreate('g');\n\n var textPathData = pathMap.getScaledPath('TEXT_ANNOTATION', {\n xScaleFactor: 1,\n yScaleFactor: 1,\n containerWidth: element.width,\n containerHeight: element.height,\n position: {\n mx: 0.0,\n my: 0.0\n }\n });\n\n var path = self.path = svgCreate('path');\n\n svgAttr(path, {\n d: textPathData,\n strokeWidth: 2,\n stroke: getStrokeColor(element)\n });\n\n svgAppend(gfx, path);\n\n svgAppend(defaultLayer, gfx);\n\n translate(gfx, element.x, element.y);\n }\n\n if (is(element, 'bpmn:TextAnnotation') ||\n element.labelTarget) {\n canvas.addMarker(element, MARKER_HIDDEN);\n } else if (is(element, 'bpmn:Task') ||\n is(element, 'bpmn:CallActivity') ||\n is(element, 'bpmn:SubProcess') ||\n is(element, 'bpmn:Participant')) {\n canvas.addMarker(element, MARKER_LABEL_HIDDEN);\n }\n });\n\n eventBus.on('directEditing.resize', function(context) {\n\n // text annotation\n if (is(element, 'bpmn:TextAnnotation')) {\n var height = context.height,\n dy = context.dy;\n\n var newElementHeight = Math.max(element.height / absoluteElementBBox.height * (height + dy), 0);\n\n var textPathData = pathMap.getScaledPath('TEXT_ANNOTATION', {\n xScaleFactor: 1,\n yScaleFactor: 1,\n containerWidth: element.width,\n containerHeight: newElementHeight,\n position: {\n mx: 0.0,\n my: 0.0\n }\n });\n\n svgAttr(self.path, {\n d: textPathData\n });\n }\n });\n\n eventBus.on([ 'directEditing.complete', 'directEditing.cancel' ], function(context) {\n var activeProvider = context.active;\n\n if (activeProvider) {\n canvas.removeMarker(activeProvider.element.label || activeProvider.element, MARKER_HIDDEN);\n canvas.removeMarker(element, MARKER_LABEL_HIDDEN);\n }\n\n element = undefined;\n absoluteElementBBox = undefined;\n\n if (gfx) {\n svgRemove(gfx);\n\n gfx = undefined;\n }\n });\n}\n\nLabelEditingPreview.$inject = [ 'eventBus', 'canvas', 'elementRegistry', 'pathMap' ];\n\nmodule.exports = LabelEditingPreview;\n","'use strict';\n\nvar assign = require(431);\n\nvar UpdateLabelHandler = require(26);\n\nvar LabelUtil = require(25);\n\nvar is = require(95).is,\n isExpanded = require(93).isExpanded;\n\nvar SMALL_FONT_SIZE = 11,\n SMALL_LINE_HEIGHT = 13,\n MEDIUM_FONT_SIZE = 12,\n MEDIUM_LINE_HEIGHT = 14;\n\nfunction LabelEditingProvider(eventBus, canvas, directEditing, commandStack, resizeHandles) {\n\n this._canvas = canvas;\n this._commandStack = commandStack;\n\n directEditing.registerProvider(this);\n\n commandStack.registerHandler('element.updateLabel', UpdateLabelHandler);\n\n // listen to dblclick on non-root elements\n eventBus.on('element.dblclick', function(event) {\n directEditing.activate(event.element);\n\n resizeHandles.removeResizers();\n });\n\n // complete on followup canvas operation\n eventBus.on([ 'element.mousedown', 'drag.init', 'canvas.viewbox.changing' ], function(event) {\n directEditing.complete();\n });\n\n // cancel on command stack changes\n eventBus.on([ 'commandStack.changed' ], function(e) {\n directEditing.cancel();\n });\n\n if ('ontouchstart' in document.documentElement) {\n // we deactivate automatic label editing on mobile devices\n // as it breaks the user interaction workflow\n\n // TODO(nre): we should temporarily focus the edited element here\n // and release the focused viewport after the direct edit operation is finished\n } else {\n eventBus.on('create.end', 500, function(event) {\n var element = event.shape,\n canExecute = event.context.canExecute;\n\n if (!canExecute) {\n return;\n }\n\n if (is(element, 'bpmn:Task') || is(element, 'bpmn:TextAnnotation') ||\n (is(element, 'bpmn:SubProcess') && !isExpanded(element))) {\n directEditing.activate(element);\n\n resizeHandles.removeResizers();\n }\n });\n }\n}\n\nLabelEditingProvider.$inject = [ 'eventBus', 'canvas', 'directEditing', 'commandStack', 'resizeHandles' ];\n\nmodule.exports = LabelEditingProvider;\n\n\n/**\n * Activate direct editing for activities and text annotations.\n *\n * @param {djs.model.Base} element\n *\n * @return {Object} an object with properties bounds (position and size), text and options\n */\nLabelEditingProvider.prototype.activate = function(element) {\n\n // text\n var text = LabelUtil.getLabel(element);\n\n if (text === undefined) {\n return;\n }\n\n var context = {\n text: text\n };\n\n // bounds\n var bounds = this.getEditingBBox(element);\n\n assign(context, bounds);\n\n // options\n var target = element.label || element;\n\n var options = {};\n\n // tasks\n if (is(element, 'bpmn:Task') ||\n is(element, 'bpmn:Participant') ||\n is(element, 'bpmn:Lane') ||\n (is(element, 'bpmn:CallActivity') && !isExpanded(element)) ||\n (is(element, 'bpmn:SubProcess') && !isExpanded(element))) {\n assign(options, {\n centerVertically: true\n });\n }\n\n // external labels\n if (target.labelTarget) {\n assign(options, {\n autoResize: true\n });\n }\n\n // text annotations\n if (is(element, 'bpmn:TextAnnotation')) {\n assign(options, {\n resizable: true,\n autoResize: true\n });\n }\n\n assign(context, {\n options: options\n });\n\n return context;\n};\n\n\n/**\n * Get the editing bounding box based on the element's size and position\n *\n * @param {djs.model.Base} element\n *\n * @return {Object} an object containing information about position and size (fixed or minimum and/or maximum)\n */\nLabelEditingProvider.prototype.getEditingBBox = function(element) {\n var canvas = this._canvas;\n\n var target = element.label || element;\n\n var bbox = canvas.getAbsoluteBBox(target);\n\n var mid = {\n x: bbox.x + bbox.width / 2,\n y: bbox.y + bbox.height / 2\n };\n\n // default position\n var bounds = { x: bbox.x, y: bbox.y };\n\n var zoom = canvas.zoom();\n\n // take zoom into account\n var smallFontSize = SMALL_FONT_SIZE * zoom,\n smallLineHeight = SMALL_LINE_HEIGHT * zoom,\n mediumFontSize = MEDIUM_FONT_SIZE * zoom,\n mediumLineHeight = MEDIUM_LINE_HEIGHT * zoom;\n\n var style = {};\n\n // adjust for expanded pools AND lanes\n if ((is(element, 'bpmn:Participant') && isExpanded(element))\n || is(element, 'bpmn:Lane')) {\n\n assign(bounds, {\n width: bbox.height,\n height: 30 * zoom,\n x: bbox.x - bbox.height / 2 + (15 * zoom),\n y: mid.y - (30 * zoom) / 2\n });\n\n assign(style, {\n fontSize: mediumFontSize + 'px',\n lineHeight: mediumLineHeight + 'px',\n paddingTop: (7 * zoom) + 'px',\n paddingBottom: (7 * zoom) + 'px',\n paddingLeft: (5 * zoom) + 'px',\n paddingRight: (5 * zoom) + 'px',\n transform: 'rotate(-90deg)'\n });\n }\n\n\n // internal labels for tasks and collapsed call activities, sub processes and participants\n if (\n is(element, 'bpmn:Task') ||\n (is(element, 'bpmn:CallActivity') && !isExpanded(element)) ||\n (is(element, 'bpmn:SubProcess') && !isExpanded(element)) ||\n (is(element, 'bpmn:Participant') && !isExpanded(element))\n ) {\n assign(bounds, {\n width: bbox.width,\n height: bbox.height\n });\n\n assign(style, {\n fontSize: mediumFontSize + 'px',\n lineHeight: mediumLineHeight + 'px',\n paddingTop: (7 * zoom) + 'px',\n paddingBottom: (7 * zoom) + 'px',\n paddingLeft: (5 * zoom) + 'px',\n paddingRight: (5 * zoom) + 'px'\n });\n }\n\n\n // internal labels for expanded sub processes\n if (is(element, 'bpmn:SubProcess') && isExpanded(element)) {\n assign(bounds, {\n width: bbox.width,\n x: bbox.x\n });\n\n assign(style, {\n fontSize: mediumFontSize + 'px',\n lineHeight: mediumLineHeight + 'px',\n paddingTop: (7 * zoom) + 'px',\n paddingBottom: (7 * zoom) + 'px',\n paddingLeft: (5 * zoom) + 'px',\n paddingRight: (5 * zoom) + 'px'\n });\n }\n\n\n // external labels for events, data elements, gateways and connections\n if (target.labelTarget) {\n var width = 90 * zoom,\n paddingTop = 7 * zoom,\n paddingBottom = 4 * zoom;\n\n assign(bounds, {\n width: width,\n height: bbox.height + paddingTop + paddingBottom,\n x: mid.x - width / 2,\n y: bbox.y - paddingTop\n });\n\n assign(style, {\n fontSize: smallFontSize + 'px',\n lineHeight: smallLineHeight + 'px',\n paddingTop: paddingTop + 'px',\n paddingBottom: paddingBottom + 'px'\n });\n }\n\n\n // text annotations\n if (is(element, 'bpmn:TextAnnotation')) {\n assign(bounds, {\n width: bbox.width,\n height: bbox.height,\n minWidth: 30 * zoom,\n minHeight: 10 * zoom\n });\n\n assign(style, {\n textAlign: 'left',\n paddingTop: (7 * zoom) + 'px',\n paddingBottom: (7 * zoom) + 'px',\n paddingLeft: (5 * zoom) + 'px',\n paddingRight: (5 * zoom) + 'px',\n fontSize: mediumFontSize + 'px',\n lineHeight: mediumLineHeight + 'px'\n });\n }\n\n return { bounds: bounds, style: style };\n};\n\n\nLabelEditingProvider.prototype.update = function(element, newLabel, activeContextText, bounds) {\n var absoluteElementBBox = this._canvas.getAbsoluteBBox(element);\n\n this._commandStack.execute('element.updateLabel', {\n element: element,\n newLabel: newLabel,\n bounds: {\n x: element.x,\n y: element.y,\n width: element.width / absoluteElementBBox.width * bounds.width,\n height: element.height / absoluteElementBBox.height * bounds.height\n }\n });\n};\n","'use strict';\n\nvar is = require(95).is;\n\nfunction getLabelAttr(semantic) {\n if (is(semantic, 'bpmn:FlowElement') ||\n is(semantic, 'bpmn:Participant') ||\n is(semantic, 'bpmn:Lane') ||\n is(semantic, 'bpmn:SequenceFlow') ||\n is(semantic, 'bpmn:MessageFlow')) {\n\n return 'name';\n }\n\n if (is(semantic, 'bpmn:TextAnnotation')) {\n return 'text';\n }\n}\n\nmodule.exports.getLabel = function(element) {\n var semantic = element.businessObject,\n attr = getLabelAttr(semantic);\n\n if (attr) {\n return semantic[attr] || '';\n }\n};\n\n\nmodule.exports.setLabel = function(element, text, isExternal) {\n var semantic = element.businessObject,\n attr = getLabelAttr(semantic);\n\n if (attr) {\n semantic[attr] = text;\n }\n\n // show external label if not empty\n if (isExternal) {\n element.hidden = !text;\n }\n\n return element;\n};","'use strict';\n\nvar LabelUtil = require(25);\n\nvar TextUtil = require(280);\n\nvar hasExternalLabel = require(94).hasExternalLabel;\n\nvar getBusinessObject = require(95).getBusinessObject,\n is = require(95).is;\n\nvar NULL_DIMENSIONS = {\n width: 0,\n height: 0\n};\n\n\n/**\n * A handler that updates the text of a BPMN element.\n */\nfunction UpdateLabelHandler(modeling) {\n\n var textUtil = new TextUtil();\n\n /**\n * Set the label and return the changed elements.\n *\n * Element parameter can be label itself or connection (i.e. sequence flow).\n *\n * @param {djs.model.Base} element\n * @param {String} text\n */\n function setText(element, text) {\n\n // external label if present\n var label = element.label || element;\n\n var labelTarget = element.labelTarget || element;\n\n LabelUtil.setLabel(label, text, labelTarget !== label);\n\n return [ label, labelTarget ];\n }\n\n function execute(ctx) {\n ctx.oldLabel = LabelUtil.getLabel(ctx.element);\n return setText(ctx.element, ctx.newLabel);\n }\n\n function revert(ctx) {\n return setText(ctx.element, ctx.oldLabel);\n }\n\n function postExecute(ctx) {\n var element = ctx.element,\n label = element.label || element,\n bounds = ctx.bounds;\n\n // ignore internal labels for elements except text annotations\n if (!hasExternalLabel(element) && !is(element, 'bpmn:TextAnnotation')) {\n return;\n }\n\n var bo = getBusinessObject(label);\n\n var text = bo.name || bo.text;\n\n if (!text) {\n return;\n }\n\n // get layouted text bounds and resize external\n // external label accordingly\n var newBounds = is(element, 'bpmn:TextAnnotation') ? bounds : getLayoutedBounds(label, text, textUtil);\n\n modeling.resizeShape(label, newBounds, NULL_DIMENSIONS);\n }\n\n // API\n\n this.execute = execute;\n this.revert = revert;\n this.postExecute = postExecute;\n}\n\nUpdateLabelHandler.$inject = [ 'modeling' ];\n\nmodule.exports = UpdateLabelHandler;\n\n\n// TODO(nikku): repeating code (search for )\n\nvar EXTERNAL_LABEL_STYLE = {\n fontFamily: 'Arial, sans-serif',\n fontSize: '11px'\n};\n\nfunction getLayoutedBounds(bounds, text, textUtil) {\n\n var layoutedLabelDimensions = textUtil.getDimensions(text, {\n box: {\n width: 90,\n height: 30,\n x: bounds.width / 2 + bounds.x,\n y: bounds.height / 2 + bounds.y\n },\n style: EXTERNAL_LABEL_STYLE\n });\n\n // resize label shape to fit label text\n return {\n x: Math.round(bounds.x + bounds.width / 2 - layoutedLabelDimensions.width / 2),\n y: Math.round(bounds.y),\n width: Math.ceil(layoutedLabelDimensions.width),\n height: Math.ceil(layoutedLabelDimensions.height)\n };\n}","module.exports = {\n __depends__: [\n require(121),\n require(147),\n require(224),\n require(114)\n ],\n __init__: [\n 'labelEditingProvider',\n 'labelEditingPreview'\n ],\n labelEditingProvider: [ 'type', require(24) ],\n labelEditingPreview: [ 'type', require(23) ]\n};\n","'use strict';\n\nvar map = require(305),\n assign = require(431),\n pick = require(438);\n\n\nfunction BpmnFactory(moddle) {\n this._model = moddle;\n}\n\nBpmnFactory.$inject = [ 'moddle' ];\n\n\nBpmnFactory.prototype._needsId = function(element) {\n return element.$instanceOf('bpmn:RootElement') ||\n element.$instanceOf('bpmn:FlowElement') ||\n element.$instanceOf('bpmn:MessageFlow') ||\n element.$instanceOf('bpmn:DataAssociation') ||\n element.$instanceOf('bpmn:Artifact') ||\n element.$instanceOf('bpmn:Participant') ||\n element.$instanceOf('bpmn:Lane') ||\n element.$instanceOf('bpmn:Process') ||\n element.$instanceOf('bpmn:Collaboration') ||\n element.$instanceOf('bpmndi:BPMNShape') ||\n element.$instanceOf('bpmndi:BPMNEdge') ||\n element.$instanceOf('bpmndi:BPMNDiagram') ||\n element.$instanceOf('bpmndi:BPMNPlane') ||\n element.$instanceOf('bpmn:Property');\n};\n\nBpmnFactory.prototype._ensureId = function(element) {\n\n // generate semantic ids for elements\n // bpmn:SequenceFlow -> SequenceFlow_ID\n var prefix = (element.$type || '').replace(/^[^:]*:/g, '') + '_';\n\n if (!element.id && this._needsId(element)) {\n element.id = this._model.ids.nextPrefixed(prefix, element);\n }\n};\n\n\nBpmnFactory.prototype.create = function(type, attrs) {\n var element = this._model.create(type, attrs || {});\n\n this._ensureId(element);\n\n return element;\n};\n\n\nBpmnFactory.prototype.createDiLabel = function() {\n return this.create('bpmndi:BPMNLabel', {\n bounds: this.createDiBounds()\n });\n};\n\n\nBpmnFactory.prototype.createDiShape = function(semantic, bounds, attrs) {\n\n return this.create('bpmndi:BPMNShape', assign({\n bpmnElement: semantic,\n bounds: this.createDiBounds(bounds)\n }, attrs));\n};\n\n\nBpmnFactory.prototype.createDiBounds = function(bounds) {\n return this.create('dc:Bounds', bounds);\n};\n\n\nBpmnFactory.prototype.createDiWaypoints = function(waypoints) {\n return map(waypoints, function(pos) {\n return this.createDiWaypoint(pos);\n }, this);\n};\n\nBpmnFactory.prototype.createDiWaypoint = function(point) {\n return this.create('dc:Point', pick(point, [ 'x', 'y' ]));\n};\n\n\nBpmnFactory.prototype.createDiEdge = function(semantic, waypoints, attrs) {\n return this.create('bpmndi:BPMNEdge', assign({\n bpmnElement: semantic\n }, attrs));\n};\n\nBpmnFactory.prototype.createDiPlane = function(semantic) {\n return this.create('bpmndi:BPMNPlane', {\n bpmnElement: semantic\n });\n};\n\nmodule.exports = BpmnFactory;\n","'use strict';\n\nvar inherits = require(289);\n\nvar assign = require(431);\n\nvar BaseLayouter = require(250),\n ManhattanLayout = require(253);\n\nvar LayoutUtil = require(252);\n\nvar isExpanded = require(93).isExpanded;\n\nvar getMid = LayoutUtil.getMid,\n getOrientation = LayoutUtil.getOrientation;\n\nvar is = require(95).is;\n\n\nfunction BpmnLayouter() {}\n\ninherits(BpmnLayouter, BaseLayouter);\n\nmodule.exports = BpmnLayouter;\n\n\nBpmnLayouter.prototype.layoutConnection = function(connection, hints) {\n\n hints = hints || {};\n\n var source = connection.source,\n target = connection.target,\n waypoints = connection.waypoints,\n start = hints.connectionStart,\n end = hints.connectionEnd;\n\n var manhattanOptions,\n updatedWaypoints;\n\n if (!start) {\n start = getConnectionDocking(waypoints && waypoints[0], source);\n }\n\n if (!end) {\n end = getConnectionDocking(waypoints && waypoints[waypoints.length - 1], target);\n }\n\n // TODO(nikku): support vertical modeling\n // and invert preferredLayouts accordingly\n\n if (is(connection, 'bpmn:Association') ||\n is(connection, 'bpmn:DataAssociation')) {\n\n if (waypoints && !isCompensationAssociation(connection)) {\n return [].concat([ start ], waypoints.slice(1, -1), [ end ]);\n }\n }\n\n // manhattan layout sequence / message flows\n if (is(connection, 'bpmn:MessageFlow')) {\n manhattanOptions = {\n preferredLayouts: [ 'v:v' ]\n };\n\n if (is(target, 'bpmn:Participant')) {\n manhattanOptions = {\n preferredLayouts: [ 'straight', 'v:v' ]\n };\n }\n\n if (isExpandedSubProcess(target)) {\n manhattanOptions = {\n preferredLayouts: [ 'straight', 'v:v' ]\n };\n }\n\n if (isExpandedSubProcess(source) && is(target, 'bpmn:FlowNode')) {\n manhattanOptions = {\n preferredLayouts: [ 'straight', 'v:v' ],\n preserveDocking: isExpandedSubProcess(target) ? 'source' : 'target'\n };\n }\n\n if (is(source, 'bpmn:Participant') && is(target, 'bpmn:FlowNode')) {\n manhattanOptions = {\n preferredLayouts: [ 'straight', 'v:v' ],\n preserveDocking: 'target'\n };\n }\n\n if (is(target, 'bpmn:Event')) {\n manhattanOptions = {\n preferredLayouts: [ 'v:v' ]\n };\n }\n } else\n\n\n // layout all connection between flow elements h:h,\n //\n // except for\n //\n // (1) outgoing of BoundaryEvents -> layout h:v or v:h based on attach orientation\n // (2) incoming / outgoing of Gateway -> v:h (outgoing), h:v (incoming)\n //\n if (is(connection, 'bpmn:SequenceFlow') ||\n isCompensationAssociation(connection)) {\n\n // make sure boundary event connections do\n // not look ugly =:>\n if (is(source, 'bpmn:BoundaryEvent')) {\n\n var orientation = getAttachOrientation(source);\n\n if (/left|right/.test(orientation)) {\n manhattanOptions = {\n preferredLayouts: [ 'h:v' ]\n };\n } else\n\n if (/top|bottom/.test(orientation)) {\n manhattanOptions = {\n preferredLayouts: [ 'v:h' ]\n };\n }\n } else\n\n if (is(source, 'bpmn:Gateway')) {\n\n manhattanOptions = {\n preferredLayouts: [ 'v:h' ]\n };\n } else\n\n if (is(target, 'bpmn:Gateway')) {\n\n manhattanOptions = {\n preferredLayouts: [ 'h:v' ]\n };\n }\n\n // apply horizontal love <3\n else {\n manhattanOptions = {\n preferredLayouts: [ 'h:h' ]\n };\n }\n }\n\n if (manhattanOptions) {\n\n manhattanOptions = assign(manhattanOptions, hints);\n\n updatedWaypoints =\n ManhattanLayout.repairConnection(\n source, target,\n start, end,\n waypoints,\n manhattanOptions);\n }\n\n return updatedWaypoints || [ start, end ];\n};\n\n\nfunction getAttachOrientation(attachedElement) {\n\n var hostElement = attachedElement.host,\n padding = -10;\n\n return getOrientation(getMid(attachedElement), hostElement, padding);\n}\n\n\nfunction getConnectionDocking(point, shape) {\n return point ? (point.original || point) : getMid(shape);\n}\n\nfunction isCompensationAssociation(connection) {\n\n var source = connection.source,\n target = connection.target;\n\n return is(target, 'bpmn:Activity') &&\n is(source, 'bpmn:BoundaryEvent') &&\n target.businessObject.isForCompensation;\n}\n\n\nfunction isExpandedSubProcess(element) {\n return is(element, 'bpmn:SubProcess') && isExpanded(element);\n}","'use strict';\n\nvar assign = require(431),\n forEach = require(303),\n inherits = require(289);\n\nvar Collections = require(263),\n Model = require(254);\n\nvar getBusinessObject = require(95).getBusinessObject,\n is = require(95).is;\n\nvar CommandInterceptor = require(119);\n\n/**\n * A handler responsible for updating the underlying BPMN 2.0 XML + DI\n * once changes on the diagram happen\n */\nfunction BpmnUpdater(eventBus, bpmnFactory, connectionDocking, translate) {\n\n CommandInterceptor.call(this, eventBus);\n\n this._bpmnFactory = bpmnFactory;\n this._translate = translate;\n\n var self = this;\n\n\n\n ////// connection cropping /////////////////////////\n\n // crop connection ends during create/update\n function cropConnection(e) {\n var context = e.context,\n connection;\n\n if (!context.cropped) {\n connection = context.connection;\n connection.waypoints = connectionDocking.getCroppedWaypoints(connection);\n context.cropped = true;\n }\n }\n\n this.executed([\n 'connection.layout',\n 'connection.create',\n 'connection.reconnectEnd',\n 'connection.reconnectStart'\n ], cropConnection);\n\n this.reverted([ 'connection.layout' ], function(e) {\n delete e.context.cropped;\n });\n\n\n\n ////// BPMN + DI update /////////////////////////\n\n\n // update parent\n function updateParent(e) {\n var context = e.context;\n\n self.updateParent(context.shape || context.connection, context.oldParent);\n }\n\n function reverseUpdateParent(e) {\n var context = e.context;\n\n var element = context.shape || context.connection,\n // oldParent is the (old) new parent, because we are undoing\n oldParent = context.parent || context.newParent;\n\n self.updateParent(element, oldParent);\n }\n\n this.executed([\n 'shape.move',\n 'shape.create',\n 'shape.delete',\n 'connection.create',\n 'connection.move',\n 'connection.delete'\n ], ifBpmn(updateParent));\n\n this.reverted([\n 'shape.move',\n 'shape.create',\n 'shape.delete',\n 'connection.create',\n 'connection.move',\n 'connection.delete'\n ], ifBpmn(reverseUpdateParent));\n\n /*\n * ## Updating Parent\n *\n * When morphing a Process into a Collaboration or vice-versa,\n * make sure that both the *semantic* and *di* parent of each element\n * is updated.\n *\n */\n function updateRoot(event) {\n var context = event.context,\n oldRoot = context.oldRoot,\n children = oldRoot.children;\n\n forEach(children, function(child) {\n if (is(child, 'bpmn:BaseElement')) {\n self.updateParent(child);\n }\n });\n }\n\n this.executed([ 'canvas.updateRoot' ], updateRoot);\n this.reverted([ 'canvas.updateRoot' ], updateRoot);\n\n\n // update bounds\n function updateBounds(e) {\n var shape = e.context.shape;\n\n if (!is(shape, 'bpmn:BaseElement')) {\n return;\n }\n\n self.updateBounds(shape);\n }\n\n this.executed([ 'shape.move', 'shape.create', 'shape.resize' ], ifBpmn(function(event) {\n\n // exclude labels because they're handled separately during shape.changed\n if (event.context.shape.type === 'label') {\n return;\n }\n\n updateBounds(event);\n }));\n\n this.reverted([ 'shape.move', 'shape.create', 'shape.resize' ], ifBpmn(function(event) {\n\n // exclude labels because they're handled separately during shape.changed\n if (event.context.shape.type === 'label') {\n return;\n }\n\n updateBounds(event);\n }));\n\n // Handle labels separately. This is necessary, because the label bounds have to be updated\n // every time its shape changes, not only on move, create and resize.\n eventBus.on('shape.changed', function(event) {\n if (event.element.type === 'label') {\n updateBounds({ context: { shape: event.element } });\n }\n });\n\n // attach / detach connection\n function updateConnection(e) {\n self.updateConnection(e.context);\n }\n\n this.executed([\n 'connection.create',\n 'connection.move',\n 'connection.delete',\n 'connection.reconnectEnd',\n 'connection.reconnectStart'\n ], ifBpmn(updateConnection));\n\n this.reverted([\n 'connection.create',\n 'connection.move',\n 'connection.delete',\n 'connection.reconnectEnd',\n 'connection.reconnectStart'\n ], ifBpmn(updateConnection));\n\n\n // update waypoints\n function updateConnectionWaypoints(e) {\n self.updateConnectionWaypoints(e.context.connection);\n }\n\n this.executed([\n 'connection.layout',\n 'connection.move',\n 'connection.updateWaypoints',\n 'connection.reconnectEnd',\n 'connection.reconnectStart'\n ], ifBpmn(updateConnectionWaypoints));\n\n this.reverted([\n 'connection.layout',\n 'connection.move',\n 'connection.updateWaypoints',\n 'connection.reconnectEnd',\n 'connection.reconnectStart'\n ], ifBpmn(updateConnectionWaypoints));\n\n\n // update Default & Conditional flows\n this.executed([\n 'connection.reconnectEnd',\n 'connection.reconnectStart'\n ], ifBpmn(function(e) {\n var context = e.context,\n connection = context.connection,\n businessObject = getBusinessObject(connection),\n oldSource = getBusinessObject(context.oldSource),\n oldTarget = getBusinessObject(context.oldTarget),\n newSource = getBusinessObject(connection.source),\n newTarget = getBusinessObject(connection.target);\n\n if (oldSource === newSource || oldTarget === newTarget) {\n return;\n }\n\n // on reconnectStart -> default flow\n if (oldSource && oldSource.default === businessObject) {\n context.default = oldSource.default;\n oldSource.default = undefined;\n }\n\n // on reconnectEnd -> default flow\n if ((businessObject.sourceRef && businessObject.sourceRef.default) &&\n !(is(newTarget, 'bpmn:Activity') ||\n is(newTarget, 'bpmn:EndEvent') ||\n is(newTarget, 'bpmn:Gateway') ||\n is(newTarget, 'bpmn:IntermediateThrowEvent')) ) {\n context.default = businessObject.sourceRef.default;\n businessObject.sourceRef.default = undefined;\n }\n\n // on reconnectStart -> conditional flow\n if (oldSource && (businessObject.conditionExpression) &&\n !(is(newSource, 'bpmn:Activity') ||\n is(newSource, 'bpmn:Gateway')) ) {\n context.conditionExpression = businessObject.conditionExpression;\n businessObject.conditionExpression = undefined;\n }\n\n // on reconnectEnd -> conditional flow\n if (oldTarget && (businessObject.conditionExpression) &&\n !(is(newTarget, 'bpmn:Activity') ||\n is(newTarget, 'bpmn:EndEvent') ||\n is(newTarget, 'bpmn:Gateway') ||\n is(newTarget, 'bpmn:IntermediateThrowEvent')) ) {\n context.conditionExpression = businessObject.conditionExpression;\n businessObject.conditionExpression = undefined;\n }\n }));\n\n this.reverted([\n 'connection.reconnectEnd',\n 'connection.reconnectStart'\n ], ifBpmn(function(e) {\n var context = e.context,\n connection = context.connection,\n businessObject = getBusinessObject(connection),\n newSource = getBusinessObject(connection.source);\n\n // default flow\n if (context.default) {\n if (is(newSource, 'bpmn:ExclusiveGateway') || is(newSource, 'bpmn:InclusiveGateway') ||\n is(newSource, 'bpmn:Activity')) {\n newSource.default = context.default;\n }\n }\n\n // conditional flow\n if (context.conditionExpression && is(newSource, 'bpmn:Activity')) {\n businessObject.conditionExpression = context.conditionExpression;\n }\n }));\n\n // update attachments\n function updateAttachment(e) {\n self.updateAttachment(e.context);\n }\n\n this.executed([ 'element.updateAttachment' ], ifBpmn(updateAttachment));\n this.reverted([ 'element.updateAttachment' ], ifBpmn(updateAttachment));\n}\n\ninherits(BpmnUpdater, CommandInterceptor);\n\nmodule.exports = BpmnUpdater;\n\nBpmnUpdater.$inject = [ 'eventBus', 'bpmnFactory', 'connectionDocking', 'translate' ];\n\n\n/////// implementation //////////////////////////////////\n\nBpmnUpdater.prototype.updateAttachment = function(context) {\n\n var shape = context.shape,\n businessObject = shape.businessObject,\n host = shape.host;\n\n businessObject.attachedToRef = host && host.businessObject;\n};\n\nBpmnUpdater.prototype.updateParent = function(element, oldParent) {\n // do not update BPMN 2.0 label parent\n if (element instanceof Model.Label) {\n return;\n }\n\n var parentShape = element.parent;\n\n var businessObject = element.businessObject,\n parentBusinessObject = parentShape && parentShape.businessObject,\n parentDi = parentBusinessObject && parentBusinessObject.di;\n\n if (is(element, 'bpmn:FlowNode')) {\n this.updateFlowNodeRefs(businessObject, parentBusinessObject, oldParent && oldParent.businessObject);\n }\n\n if (is(element, 'bpmn:DataOutputAssociation')) {\n if (element.source) {\n parentBusinessObject = element.source.businessObject;\n } else {\n parentBusinessObject = null;\n }\n }\n\n if (is(element, 'bpmn:DataInputAssociation')) {\n if (element.target) {\n parentBusinessObject = element.target.businessObject;\n } else {\n parentBusinessObject = null;\n }\n }\n\n this.updateSemanticParent(businessObject, parentBusinessObject);\n\n if (is(element, 'bpmn:DataObjectReference') && businessObject.dataObjectRef) {\n this.updateSemanticParent(businessObject.dataObjectRef, parentBusinessObject);\n }\n\n this.updateDiParent(businessObject.di, parentDi);\n};\n\n\nBpmnUpdater.prototype.updateBounds = function(shape) {\n\n var di = shape.businessObject.di;\n\n var bounds = (shape instanceof Model.Label) ? this._getLabel(di).bounds : di.bounds;\n\n assign(bounds, {\n x: shape.x,\n y: shape.y,\n width: shape.width,\n height: shape.height\n });\n};\n\nBpmnUpdater.prototype.updateFlowNodeRefs = function(businessObject, newContainment, oldContainment) {\n\n if (oldContainment === newContainment) {\n return;\n }\n\n var oldRefs, newRefs;\n\n if (is (oldContainment, 'bpmn:Lane')) {\n oldRefs = oldContainment.get('flowNodeRef');\n Collections.remove(oldRefs, businessObject);\n }\n\n if (is(newContainment, 'bpmn:Lane')) {\n newRefs = newContainment.get('flowNodeRef');\n Collections.add(newRefs, businessObject);\n }\n};\n\n\n// update existing sourceElement and targetElement di information\nBpmnUpdater.prototype.updateDiConnection = function(di, newSource, newTarget) {\n\n if (di.sourceElement && di.sourceElement.bpmnElement !== newSource) {\n di.sourceElement = newSource && newSource.di;\n }\n\n if (di.targetElement && di.targetElement.bpmnElement !== newTarget) {\n di.targetElement = newTarget && newTarget.di;\n }\n\n};\n\n\nBpmnUpdater.prototype.updateDiParent = function(di, parentDi) {\n\n if (parentDi && !is(parentDi, 'bpmndi:BPMNPlane')) {\n parentDi = parentDi.$parent;\n }\n\n if (di.$parent === parentDi) {\n return;\n }\n\n var planeElements = (parentDi || di.$parent).get('planeElement');\n\n if (parentDi) {\n planeElements.push(di);\n di.$parent = parentDi;\n } else {\n Collections.remove(planeElements, di);\n di.$parent = null;\n }\n};\n\nfunction getDefinitions(element) {\n while (element && !is(element, 'bpmn:Definitions')) {\n element = element.$parent;\n }\n\n return element;\n}\n\nBpmnUpdater.prototype.getLaneSet = function(container) {\n\n var laneSet, laneSets;\n\n // bpmn:Lane\n if (is(container, 'bpmn:Lane')) {\n laneSet = container.childLaneSet;\n\n if (!laneSet) {\n laneSet = this._bpmnFactory.create('bpmn:LaneSet');\n container.childLaneSet = laneSet;\n laneSet.$parent = container;\n }\n\n return laneSet;\n }\n\n // bpmn:Participant\n if (is(container, 'bpmn:Participant')) {\n container = container.processRef;\n }\n\n // bpmn:FlowElementsContainer\n laneSets = container.get('laneSets');\n laneSet = laneSets[0];\n\n if (!laneSet) {\n laneSet = this._bpmnFactory.create('bpmn:LaneSet');\n laneSet.$parent = container;\n laneSets.push(laneSet);\n }\n\n return laneSet;\n};\n\nBpmnUpdater.prototype.updateSemanticParent = function(businessObject, newParent, visualParent) {\n\n var containment,\n translate = this._translate;\n\n if (businessObject.$parent === newParent) {\n return;\n }\n\n if (is(businessObject, 'bpmn:Lane')) {\n\n if (newParent) {\n newParent = this.getLaneSet(newParent);\n }\n\n containment = 'lanes';\n } else\n\n if (is(businessObject, 'bpmn:FlowElement')) {\n\n if (newParent) {\n\n if (is(newParent, 'bpmn:Participant')) {\n newParent = newParent.processRef;\n } else\n\n if (is(newParent, 'bpmn:Lane')) {\n do {\n // unwrap Lane -> LaneSet -> (Lane | FlowElementsContainer)\n newParent = newParent.$parent.$parent;\n } while (is(newParent, 'bpmn:Lane'));\n\n }\n }\n\n containment = 'flowElements';\n\n } else\n\n if (is(businessObject, 'bpmn:Artifact')) {\n\n while (newParent &&\n !is(newParent, 'bpmn:Process') &&\n !is(newParent, 'bpmn:SubProcess') &&\n !is(newParent, 'bpmn:Collaboration')) {\n\n if (is(newParent, 'bpmn:Participant')) {\n newParent = newParent.processRef;\n break;\n } else {\n newParent = newParent.$parent;\n }\n }\n\n containment = 'artifacts';\n } else\n\n if (is(businessObject, 'bpmn:MessageFlow')) {\n containment = 'messageFlows';\n\n } else\n\n if (is(businessObject, 'bpmn:Participant')) {\n containment = 'participants';\n\n // make sure the participants process is properly attached / detached\n // from the XML document\n\n var process = businessObject.processRef,\n definitions;\n\n if (process) {\n definitions = getDefinitions(businessObject.$parent || newParent);\n\n if (businessObject.$parent) {\n Collections.remove(definitions.get('rootElements'), process);\n process.$parent = null;\n }\n\n if (newParent) {\n Collections.add(definitions.get('rootElements'), process);\n process.$parent = definitions;\n }\n }\n } else\n\n if (is(businessObject, 'bpmn:DataOutputAssociation')) {\n containment = 'dataOutputAssociations';\n } else\n\n if (is(businessObject, 'bpmn:DataInputAssociation')) {\n containment = 'dataInputAssociations';\n }\n\n if (!containment) {\n throw new Error(translate(\n 'no parent for {element} in {parent}',\n {\n element: businessObject.id,\n parent: newParent.id\n }\n ));\n }\n\n var children;\n\n if (businessObject.$parent) {\n // remove from old parent\n children = businessObject.$parent.get(containment);\n Collections.remove(children, businessObject);\n }\n\n if (!newParent) {\n businessObject.$parent = null;\n } else {\n // add to new parent\n children = newParent.get(containment);\n children.push(businessObject);\n businessObject.$parent = newParent;\n }\n\n if (visualParent) {\n var diChildren = visualParent.get(containment);\n\n Collections.remove(children, businessObject);\n\n if (newParent) {\n\n if (!diChildren) {\n diChildren = [];\n newParent.set(containment, diChildren);\n }\n\n diChildren.push(businessObject);\n }\n }\n};\n\n\nBpmnUpdater.prototype.updateConnectionWaypoints = function(connection) {\n connection.businessObject.di.set('waypoint', this._bpmnFactory.createDiWaypoints(connection.waypoints));\n};\n\n\nBpmnUpdater.prototype.updateConnection = function(context) {\n\n var connection = context.connection,\n businessObject = getBusinessObject(connection),\n newSource = getBusinessObject(connection.source),\n newTarget = getBusinessObject(connection.target),\n visualParent;\n\n if (!is(businessObject, 'bpmn:DataAssociation')) {\n\n var inverseSet = is(businessObject, 'bpmn:SequenceFlow');\n\n if (businessObject.sourceRef !== newSource) {\n if (inverseSet) {\n Collections.remove(businessObject.sourceRef && businessObject.sourceRef.get('outgoing'), businessObject);\n\n if (newSource && newSource.get('outgoing')) {\n newSource.get('outgoing').push(businessObject);\n }\n }\n\n businessObject.sourceRef = newSource;\n }\n\n if (businessObject.targetRef !== newTarget) {\n if (inverseSet) {\n Collections.remove(businessObject.targetRef && businessObject.targetRef.get('incoming'), businessObject);\n\n if (newTarget && newTarget.get('incoming')) {\n newTarget.get('incoming').push(businessObject);\n }\n }\n\n businessObject.targetRef = newTarget;\n }\n } else\n\n if (is(businessObject, 'bpmn:DataInputAssociation')) {\n // handle obnoxious isMany sourceRef\n businessObject.get('sourceRef')[0] = newSource;\n\n visualParent = context.parent || context.newParent || newTarget;\n\n this.updateSemanticParent(businessObject, newTarget, parent.businessObject);\n } else\n\n if (is(businessObject, 'bpmn:DataOutputAssociation')) {\n visualParent = context.parent || context.newParent || newSource;\n\n this.updateSemanticParent(businessObject, newSource, visualParent);\n\n // targetRef = new target\n businessObject.targetRef = newTarget;\n }\n\n this.updateConnectionWaypoints(connection);\n\n this.updateDiConnection(businessObject.di, newSource, newTarget);\n};\n\n\n/////// helpers /////////////////////////////////////////\n\nBpmnUpdater.prototype._getLabel = function(di) {\n if (!di.label) {\n di.label = this._bpmnFactory.createDiLabel();\n }\n\n return di.label;\n};\n\n\n/**\n * Make sure the event listener is only called\n * if the touched element is a BPMN element.\n *\n * @param {Function} fn\n * @return {Function} guarded function\n */\nfunction ifBpmn(fn) {\n\n return function(event) {\n\n var context = event.context,\n element = context.shape || context.connection;\n\n if (is(element, 'bpmn:BaseElement')) {\n fn(event);\n }\n };\n}\n","'use strict';\n\nvar assign = require(431),\n forEach = require(303),\n inherits = require(289);\n\nvar is = require(95).is;\n\nvar isExpanded = require(93).isExpanded;\n\nvar BaseElementFactory = require(123),\n LabelUtil = require(94);\n\n/**\n * A bpmn-aware factory for diagram-js shapes\n */\nfunction ElementFactory(bpmnFactory, moddle, translate) {\n BaseElementFactory.call(this);\n\n this._bpmnFactory = bpmnFactory;\n this._moddle = moddle;\n this._translate = translate;\n}\n\ninherits(ElementFactory, BaseElementFactory);\n\n\nElementFactory.$inject = [ 'bpmnFactory', 'moddle', 'translate' ];\n\nmodule.exports = ElementFactory;\n\nElementFactory.prototype.baseCreate = BaseElementFactory.prototype.create;\n\nElementFactory.prototype.create = function(elementType, attrs) {\n // no special magic for labels,\n // we assume their businessObjects have already been created\n // and wired via attrs\n if (elementType === 'label') {\n return this.baseCreate(elementType, assign({ type: 'label' }, LabelUtil.DEFAULT_LABEL_SIZE, attrs));\n }\n\n return this.createBpmnElement(elementType, attrs);\n};\n\nElementFactory.prototype.createBpmnElement = function(elementType, attrs) {\n var size,\n translate = this._translate;\n\n attrs = attrs || {};\n\n var businessObject = attrs.businessObject;\n\n if (!businessObject) {\n if (!attrs.type) {\n throw new Error(translate('no shape type specified'));\n }\n\n businessObject = this._bpmnFactory.create(attrs.type);\n }\n\n if (!businessObject.di) {\n if (elementType === 'root') {\n businessObject.di = this._bpmnFactory.createDiPlane(businessObject, [], {\n id: businessObject.id + '_di'\n });\n } else\n if (elementType === 'connection') {\n businessObject.di = this._bpmnFactory.createDiEdge(businessObject, [], {\n id: businessObject.id + '_di'\n });\n } else {\n businessObject.di = this._bpmnFactory.createDiShape(businessObject, {}, {\n id: businessObject.id + '_di'\n });\n }\n }\n\n if (attrs.colors) {\n assign(businessObject.di, attrs.colors);\n\n delete attrs.colors;\n }\n\n applyAttributes(businessObject, attrs, [\n 'processRef',\n 'isInterrupting',\n 'associationDirection',\n 'isForCompensation'\n ]);\n\n if (attrs.isExpanded) {\n applyAttribute(businessObject.di, attrs, 'isExpanded');\n }\n\n if (is(businessObject, 'bpmn:ExclusiveGateway')) {\n businessObject.di.isMarkerVisible = true;\n }\n\n var eventDefinitions,\n newEventDefinition;\n\n if (attrs.eventDefinitionType) {\n eventDefinitions = businessObject.get('eventDefinitions') || [];\n newEventDefinition = this._moddle.create(attrs.eventDefinitionType);\n\n eventDefinitions.push(newEventDefinition);\n\n newEventDefinition.$parent = businessObject;\n businessObject.eventDefinitions = eventDefinitions;\n\n delete attrs.eventDefinitionType;\n }\n\n size = this._getDefaultSize(businessObject);\n\n attrs = assign({\n businessObject: businessObject,\n id: businessObject.id\n }, size, attrs);\n\n return this.baseCreate(elementType, attrs);\n};\n\n\nElementFactory.prototype._getDefaultSize = function(semantic) {\n\n if (is(semantic, 'bpmn:SubProcess')) {\n\n if (isExpanded(semantic)) {\n return { width: 350, height: 200 };\n } else {\n return { width: 100, height: 80 };\n }\n }\n\n if (is(semantic, 'bpmn:Task')) {\n return { width: 100, height: 80 };\n }\n\n if (is(semantic, 'bpmn:Gateway')) {\n return { width: 50, height: 50 };\n }\n\n if (is(semantic, 'bpmn:Event')) {\n return { width: 36, height: 36 };\n }\n\n if (is(semantic, 'bpmn:Participant')) {\n if (!isExpanded(semantic)) {\n return { width: 400, height: 100 };\n } else {\n return { width: 600, height: 250 };\n }\n }\n\n if (is(semantic, 'bpmn:Lane')) {\n return { width: 400, height: 100 };\n }\n\n if (is(semantic, 'bpmn:DataObjectReference')) {\n return { width: 36, height: 50 };\n }\n\n if (is(semantic, 'bpmn:DataStoreReference')) {\n return { width: 50, height: 50 };\n }\n\n if (is(semantic, 'bpmn:TextAnnotation')) {\n return { width: 100, height: 30 };\n }\n\n return { width: 100, height: 80 };\n};\n\n\nElementFactory.prototype.createParticipantShape = function(collapsed) {\n\n var attrs = { type: 'bpmn:Participant' };\n\n if (!collapsed) {\n attrs.processRef = this._bpmnFactory.create('bpmn:Process');\n }\n\n return this.createShape(attrs);\n};\n\n\n//////////// helpers ////////////////////////////////////\n\n/**\n * Apply attributes from a map to the given element,\n * remove attribute from the map on application.\n *\n * @param {Base} element\n * @param {Object} attrs (in/out map of attributes)\n * @param {Array} attributeNames name of attributes to apply\n */\nfunction applyAttributes(element, attrs, attributeNames) {\n\n forEach(attributeNames, function(property) {\n if (attrs[property] !== undefined) {\n applyAttribute(element, attrs, property);\n }\n });\n}\n\n/**\n * Apply named property to element and drain it from the attrs\n * collection.\n *\n * @param {Base} element\n * @param {Object} attrs (in/out map of attributes)\n * @param {String} attributeName to apply\n */\nfunction applyAttribute(element, attrs, attributeName) {\n element[attributeName] = attrs[attributeName];\n\n delete attrs[attributeName];\n}","'use strict';\n\nvar inherits = require(289);\n\nvar BaseModeling = require(177);\n\nvar UpdatePropertiesHandler = require(65),\n UpdateCanvasRootHandler = require(63),\n AddLaneHandler = require(58),\n SplitLaneHandler = require(62),\n ResizeLaneHandler = require(60),\n UpdateFlowNodeRefsHandler = require(64),\n IdClaimHandler = require(59),\n SetColorHandler = require(61);\n\n\n/**\n * BPMN 2.0 modeling features activator\n *\n * @param {EventBus} eventBus\n * @param {ElementFactory} elementFactory\n * @param {CommandStack} commandStack\n * @param {BpmnRules} bpmnRules\n */\nfunction Modeling(eventBus, elementFactory, commandStack, bpmnRules) {\n BaseModeling.call(this, eventBus, elementFactory, commandStack);\n\n this._bpmnRules = bpmnRules;\n}\n\ninherits(Modeling, BaseModeling);\n\nModeling.$inject = [ 'eventBus', 'elementFactory', 'commandStack', 'bpmnRules' ];\n\nmodule.exports = Modeling;\n\n\nModeling.prototype.getHandlers = function() {\n var handlers = BaseModeling.prototype.getHandlers.call(this);\n\n handlers['element.updateProperties'] = UpdatePropertiesHandler;\n handlers['canvas.updateRoot'] = UpdateCanvasRootHandler;\n handlers['lane.add'] = AddLaneHandler;\n handlers['lane.resize'] = ResizeLaneHandler;\n handlers['lane.split'] = SplitLaneHandler;\n handlers['lane.updateRefs'] = UpdateFlowNodeRefsHandler;\n handlers['id.updateClaim'] = IdClaimHandler;\n handlers['element.setColor'] = SetColorHandler;\n\n return handlers;\n};\n\n\nModeling.prototype.updateLabel = function(element, newLabel) {\n this._commandStack.execute('element.updateLabel', {\n element: element,\n newLabel: newLabel\n });\n};\n\n\nModeling.prototype.connect = function(source, target, attrs, hints) {\n\n var bpmnRules = this._bpmnRules;\n\n if (!attrs) {\n attrs = bpmnRules.canConnect(source, target);\n }\n\n if (!attrs) {\n return;\n }\n\n return this.createConnection(source, target, attrs, source.parent, hints);\n};\n\n\nModeling.prototype.updateProperties = function(element, properties) {\n this._commandStack.execute('element.updateProperties', {\n element: element,\n properties: properties\n });\n};\n\nModeling.prototype.resizeLane = function(laneShape, newBounds, balanced) {\n this._commandStack.execute('lane.resize', {\n shape: laneShape,\n newBounds: newBounds,\n balanced: balanced\n });\n};\n\nModeling.prototype.addLane = function(targetLaneShape, location) {\n var context = {\n shape: targetLaneShape,\n location: location\n };\n\n this._commandStack.execute('lane.add', context);\n\n return context.newLane;\n};\n\nModeling.prototype.splitLane = function(targetLane, count) {\n this._commandStack.execute('lane.split', {\n shape: targetLane,\n count: count\n });\n};\n\n/**\n * Transform the current diagram into a collaboration.\n *\n * @return {djs.model.Root} the new root element\n */\nModeling.prototype.makeCollaboration = function() {\n\n var collaborationElement = this._create('root', {\n type: 'bpmn:Collaboration'\n });\n\n var context = {\n newRoot: collaborationElement\n };\n\n this._commandStack.execute('canvas.updateRoot', context);\n\n return collaborationElement;\n};\n\nModeling.prototype.updateLaneRefs = function(flowNodeShapes, laneShapes) {\n\n this._commandStack.execute('lane.updateRefs', {\n flowNodeShapes: flowNodeShapes,\n laneShapes: laneShapes\n });\n};\n\n/**\n * Transform the current diagram into a process.\n *\n * @return {djs.model.Root} the new root element\n */\nModeling.prototype.makeProcess = function() {\n\n var processElement = this._create('root', {\n type: 'bpmn:Process'\n });\n\n var context = {\n newRoot: processElement\n };\n\n this._commandStack.execute('canvas.updateRoot', context);\n};\n\n\nModeling.prototype.claimId = function(id, moddleElement) {\n this._commandStack.execute('id.updateClaim', {\n id: id,\n element: moddleElement,\n claiming: true\n });\n};\n\n\nModeling.prototype.unclaimId = function(id, moddleElement) {\n this._commandStack.execute('id.updateClaim', {\n id: id,\n element: moddleElement\n });\n};\n\nModeling.prototype.setColor = function(elements, colors) {\n if (!elements.length) {\n elements = [ elements ];\n }\n\n this._commandStack.execute('element.setColor', {\n elements: elements,\n colors: colors\n });\n};\n","'use strict';\n\nvar inherits = require(289);\n\nvar is = require(95).is;\n\nvar CommandInterceptor = require(119);\n\n\nfunction AppendBehavior(eventBus, elementFactory, bpmnRules) {\n\n CommandInterceptor.call(this, eventBus);\n\n // assign correct shape position unless already set\n\n this.preExecute('shape.append', function(context) {\n\n var source = context.source,\n shape = context.shape;\n\n if (!context.position) {\n\n if (is(shape, 'bpmn:TextAnnotation')) {\n context.position = {\n x: source.x + source.width / 2 + 75,\n y: source.y - (50) - shape.height / 2\n };\n } else {\n context.position = {\n x: source.x + source.width + 80 + shape.width / 2,\n y: source.y + source.height / 2\n };\n }\n }\n }, true);\n}\n\n\nAppendBehavior.$inject = [ 'eventBus', 'elementFactory', 'bpmnRules' ];\n\ninherits(AppendBehavior, CommandInterceptor);\n\nmodule.exports = AppendBehavior;","'use strict';\n\nvar inherits = require(289);\n\nvar forEach = require(303);\n\nvar is = require(95).is;\n\nvar CommandInterceptor = require(119);\n\n\nfunction CopyPasteBehavior(eventBus, modeling, canvas) {\n\n CommandInterceptor.call(this, eventBus);\n\n this.preExecute('elements.paste', 1500, function(context) {\n var topParent = context.topParent;\n\n // always grab the latest root\n if (!topParent.parent) {\n context.topParent = canvas.getRootElement();\n }\n\n if (is(topParent, 'bpmn:Lane')) {\n do {\n // unwrap Lane -> LaneSet -> (Lane | FlowElementsContainer)\n topParent = context.topParent = topParent.parent;\n\n } while (is(topParent, 'bpmn:Lane') || !is(topParent, 'bpmn:Participant'));\n }\n }, true);\n\n this.postExecute('elements.paste', function(context) {\n\n var tree = context.tree,\n createdElements = tree.createdElements;\n\n forEach(createdElements, function(data) {\n var element = data.element,\n businessObject = element.businessObject,\n descriptor = data.descriptor,\n defaultFlow;\n\n if ((is(businessObject, 'bpmn:ExclusiveGateway') || is(businessObject, 'bpmn:InclusiveGateway') ||\n is(businessObject, 'bpmn:Activity')) && descriptor.default) {\n\n defaultFlow = createdElements[descriptor.default];\n\n // if the default flow wasn't created, means that it wasn't copied\n if (defaultFlow) {\n defaultFlow = defaultFlow.element;\n } else {\n defaultFlow = undefined;\n }\n\n delete element.default;\n\n modeling.updateProperties(element, { default: defaultFlow });\n }\n });\n }, true);\n}\n\n\nCopyPasteBehavior.$inject = [ 'eventBus', 'modeling', 'canvas' ];\n\ninherits(CopyPasteBehavior, CommandInterceptor);\n\nmodule.exports = CopyPasteBehavior;\n","'use strict';\n\nvar inherits = require(289);\n\nvar CommandInterceptor = require(119);\n\nvar is = require(95).is;\n\n\n/**\n * BPMN specific create boundary event behavior\n */\nfunction CreateBoundaryEventBehavior(eventBus, modeling, elementFactory, bpmnFactory) {\n\n CommandInterceptor.call(this, eventBus);\n\n /**\n * replace intermediate event with boundary event when\n * attaching it to a shape\n */\n\n this.preExecute('shape.create', function(context) {\n var shape = context.shape,\n host = context.host,\n businessObject,\n boundaryEvent;\n\n var attrs = {\n cancelActivity: true\n };\n\n if (host && is(shape, 'bpmn:IntermediateThrowEvent')) {\n attrs.attachedToRef = host.businessObject;\n\n businessObject = bpmnFactory.create('bpmn:BoundaryEvent', attrs);\n\n boundaryEvent = {\n type: 'bpmn:BoundaryEvent',\n businessObject: businessObject\n };\n\n context.shape = elementFactory.createShape(boundaryEvent);\n }\n }, true);\n}\n\nCreateBoundaryEventBehavior.$inject = [ 'eventBus', 'modeling', 'elementFactory', 'bpmnFactory' ];\n\ninherits(CreateBoundaryEventBehavior, CommandInterceptor);\n\nmodule.exports = CreateBoundaryEventBehavior;\n","'use strict';\n\nvar inherits = require(289);\n\nvar CommandInterceptor = require(119);\n\nvar is = require(95).is;\n\n/**\n * BPMN specific create data object behavior\n */\nfunction CreateDataObjectBehavior(eventBus, bpmnFactory, moddle) {\n\n CommandInterceptor.call(this, eventBus);\n\n this.preExecute('shape.create', function(event) {\n\n var context = event.context,\n shape = context.shape;\n\n if (is(shape, 'bpmn:DataObjectReference') && shape.type !== 'label') {\n\n // create a DataObject every time a DataObjectReference is created\n var dataObject = bpmnFactory.create('bpmn:DataObject');\n\n // set the reference to the DataObject\n shape.businessObject.dataObjectRef = dataObject;\n }\n });\n\n}\n\nCreateDataObjectBehavior.$inject = [ 'eventBus', 'bpmnFactory', 'moddle' ];\n\ninherits(CreateDataObjectBehavior, CommandInterceptor);\n\nmodule.exports = CreateDataObjectBehavior;\n","'use strict';\n\nvar inherits = require(289);\n\nvar CommandInterceptor = require(119);\n\nvar is = require(95).is;\n\n/**\n * BPMN specific create participant behavior\n */\nfunction CreateParticipantBehavior(eventBus, modeling, elementFactory, bpmnFactory, canvas) {\n\n CommandInterceptor.call(this, eventBus);\n\n /**\n * morph process into collaboration before adding\n * participant onto collaboration\n */\n\n this.preExecute('shape.create', function(context) {\n\n var parent = context.parent,\n shape = context.shape,\n position = context.position;\n\n var rootElement = canvas.getRootElement();\n\n if (is(parent, 'bpmn:Process') && is(shape, 'bpmn:Participant') && !is(rootElement, 'bpmn:Collaboration')) {\n\n // this is going to detach the process root\n // and set the returned collaboration element\n // as the new root element\n var collaborationElement = modeling.makeCollaboration();\n\n // monkey patch the create context\n // so that the participant is being dropped\n // onto the new collaboration root instead\n context.position = position;\n context.parent = collaborationElement;\n\n context.processRoot = parent;\n }\n }, true);\n\n\n this.execute('shape.create', function(context) {\n\n var processRoot = context.processRoot,\n shape = context.shape;\n\n if (processRoot) {\n context.oldProcessRef = shape.businessObject.processRef;\n\n // assign the participant processRef\n shape.businessObject.processRef = processRoot.businessObject;\n }\n }, true);\n\n\n this.revert('shape.create', function(context) {\n var processRoot = context.processRoot,\n shape = context.shape;\n\n if (processRoot) {\n // assign the participant processRef\n shape.businessObject.processRef = context.oldProcessRef;\n }\n }, true);\n\n\n this.postExecute('shape.create', function(context) {\n\n var processRoot = context.processRoot,\n shape = context.shape;\n\n if (processRoot) {\n // process root is already detached at this point\n var processChildren = processRoot.children.slice();\n modeling.moveElements(processChildren, { x: 0, y: 0 }, shape);\n }\n\n }, true);\n\n}\n\nCreateParticipantBehavior.$inject = [ 'eventBus', 'modeling', 'elementFactory', 'bpmnFactory', 'canvas' ];\n\ninherits(CreateParticipantBehavior, CommandInterceptor);\n\nmodule.exports = CreateParticipantBehavior;\n","'use strict';\n\nvar inherits = require(289);\n\nvar CommandInterceptor = require(119);\n\nvar Collections = require(263);\n\nvar find = require(302);\n\nvar is = require(95).is;\n\nvar TARGET_REF_PLACEHOLDER_NAME = '__targetRef_placeholder';\n\n\n/**\n * This behavior makes sure we always set a fake\n * DataInputAssociation#targetRef as demanded by the BPMN 2.0\n * XSD schema.\n *\n * The reference is set to a bpmn:Property{ name: '__targetRef_placeholder' }\n * which is created on the fly and cleaned up afterwards if not needed\n * anymore.\n *\n * @param {EventBus} eventBus\n * @param {BpmnFactory} bpmnFactory\n */\nfunction DataInputAssociationBehavior(eventBus, bpmnFactory) {\n\n CommandInterceptor.call(this, eventBus);\n\n\n this.executed([\n 'connection.create',\n 'connection.delete',\n 'connection.move',\n 'connection.reconnectEnd'\n ], ifDataInputAssociation(fixTargetRef));\n\n this.reverted([\n 'connection.create',\n 'connection.delete',\n 'connection.move',\n 'connection.reconnectEnd'\n ], ifDataInputAssociation(fixTargetRef));\n\n\n function usesTargetRef(element, targetRef, removedConnection) {\n\n var inputAssociations = element.get('dataInputAssociations');\n\n return find(inputAssociations, function(association) {\n return association !== removedConnection &&\n association.targetRef === targetRef;\n });\n }\n\n function getTargetRef(element, create) {\n\n var properties = element.get('properties');\n\n var targetRefProp = find(properties, function(p) {\n return p.name === TARGET_REF_PLACEHOLDER_NAME;\n });\n\n if (!targetRefProp && create) {\n targetRefProp = bpmnFactory.create('bpmn:Property', {\n name: TARGET_REF_PLACEHOLDER_NAME\n });\n\n Collections.add(properties, targetRefProp);\n }\n\n return targetRefProp;\n }\n\n function cleanupTargetRef(element, connection) {\n\n var targetRefProp = getTargetRef(element);\n\n if (!targetRefProp) {\n return;\n }\n\n if (!usesTargetRef(element, targetRefProp, connection)) {\n Collections.remove(element.get('properties'), targetRefProp);\n }\n }\n\n /**\n * Make sure targetRef is set to a valid property or\n * `null` if the connection is detached.\n *\n * @param {Event} event\n */\n function fixTargetRef(event) {\n\n var context = event.context,\n connection = context.connection,\n connectionBo = connection.businessObject,\n target = connection.target,\n targetBo = target && target.businessObject,\n newTarget = context.newTarget,\n newTargetBo = newTarget && newTarget.businessObject,\n oldTarget = context.oldTarget || context.target,\n oldTargetBo = oldTarget && oldTarget.businessObject;\n\n var dataAssociation = connection.businessObject,\n targetRefProp;\n\n if (oldTargetBo && oldTargetBo !== targetBo) {\n cleanupTargetRef(oldTargetBo, connectionBo);\n }\n\n if (newTargetBo && newTargetBo !== targetBo) {\n cleanupTargetRef(newTargetBo, connectionBo);\n }\n\n if (targetBo) {\n targetRefProp = getTargetRef(targetBo, true);\n dataAssociation.targetRef = targetRefProp;\n } else {\n dataAssociation.targetRef = null;\n }\n }\n}\n\nDataInputAssociationBehavior.$inject = [ 'eventBus', 'bpmnFactory' ];\n\ninherits(DataInputAssociationBehavior, CommandInterceptor);\n\nmodule.exports = DataInputAssociationBehavior;\n\n\n/**\n * Only call the given function when the event\n * touches a bpmn:DataInputAssociation.\n *\n * @param {Function} fn\n * @return {Function}\n */\nfunction ifDataInputAssociation(fn) {\n\n return function(event) {\n var context = event.context,\n connection = context.connection;\n\n if (is(connection, 'bpmn:DataInputAssociation')) {\n return fn(event);\n }\n };\n}","'use strict';\n\nvar inherits = require(289);\n\nvar CommandInterceptor = require(119);\n\nvar is = require(95).is;\n\nvar getChildLanes = require(67).getChildLanes;\n\nvar eachElement = require(266).eachElement;\n\n\nvar LOW_PRIORITY = 500;\n\n\n/**\n * BPMN specific delete lane behavior\n */\nfunction DeleteLaneBehavior(eventBus, modeling, spaceTool) {\n\n CommandInterceptor.call(this, eventBus);\n\n\n function compensateLaneDelete(shape, oldParent) {\n\n var siblings = getChildLanes(oldParent);\n\n var topAffected = [];\n var bottomAffected = [];\n\n eachElement(siblings, function(element) {\n\n if (element.y > shape.y) {\n bottomAffected.push(element);\n } else {\n topAffected.push(element);\n }\n\n return element.children;\n });\n\n if (!siblings.length) {\n return;\n }\n\n var offset;\n\n if (bottomAffected.length && topAffected.length) {\n offset = shape.height / 2;\n } else {\n offset = shape.height;\n }\n\n var topAdjustments,\n bottomAdjustments;\n\n if (topAffected.length) {\n topAdjustments = spaceTool.calculateAdjustments(\n topAffected, 'y', offset, shape.y - 10);\n\n spaceTool.makeSpace(\n topAdjustments.movingShapes,\n topAdjustments.resizingShapes,\n { x: 0, y: offset }, 's');\n }\n\n if (bottomAffected.length) {\n bottomAdjustments = spaceTool.calculateAdjustments(\n bottomAffected, 'y', -offset, shape.y + shape.height + 10);\n\n spaceTool.makeSpace(\n bottomAdjustments.movingShapes,\n bottomAdjustments.resizingShapes,\n { x: 0, y: -offset }, 'n');\n }\n }\n\n\n /**\n * Adjust sizes of other lanes after lane deletion\n */\n this.postExecuted('shape.delete', LOW_PRIORITY, function(event) {\n\n var context = event.context,\n hints = context.hints,\n shape = context.shape,\n oldParent = context.oldParent;\n\n // only compensate lane deletes\n if (!is(shape, 'bpmn:Lane')) {\n return;\n }\n\n // compensate root deletes only\n if (hints && hints.nested) {\n return;\n }\n\n compensateLaneDelete(shape, oldParent);\n });\n}\n\nDeleteLaneBehavior.$inject = [ 'eventBus', 'modeling', 'spaceTool' ];\n\ninherits(DeleteLaneBehavior, CommandInterceptor);\n\nmodule.exports = DeleteLaneBehavior;","'use strict';\n\nvar inherits = require(289);\n\nvar assign = require(431),\n find = require(302);\n\nvar CommandInterceptor = require(119);\n\nvar getApproxIntersection = require(272).getApproxIntersection;\n\nfunction isPointInsideBBox(bbox, point) {\n var x = point.x,\n y = point.y;\n\n return x >= bbox.x &&\n x <= bbox.x + bbox.width &&\n y >= bbox.y &&\n y <= bbox.y + bbox.height;\n}\n\nfunction copy(obj) {\n return assign({}, obj);\n}\n\nfunction getMid(bounds) {\n\n return {\n x: Math.round(bounds.x + bounds.width / 2),\n y: Math.round(bounds.y + bounds.height / 2)\n };\n}\n\nfunction DropOnFlow(eventBus, bpmnRules, modeling) {\n\n CommandInterceptor.call(this, eventBus);\n\n /**\n * Reconnect start / end of a connection after\n * dropping an element on a flow.\n */\n\n function insertShape(shape, targetFlow, position) {\n var waypoints = targetFlow.waypoints,\n waypointsBefore, waypointsAfter, dockingPoint, source, target, reconnected;\n\n var intersection = getApproxIntersection(waypoints, position);\n\n if (intersection) {\n waypointsBefore = waypoints.slice(0, intersection.index);\n waypointsAfter = waypoints.slice(intersection.index + (intersection.bendpoint ? 1 : 0));\n\n dockingPoint = intersection.bendpoint ? waypoints[intersection.index] : position;\n\n // if last waypointBefore is inside shape's bounds, ignore docking point\n if (!isPointInsideBBox(shape, waypointsBefore[waypointsBefore.length-1])) {\n waypointsBefore.push(copy(dockingPoint));\n }\n\n // if first waypointAfter is inside shape's bounds, ignore docking point\n if (!isPointInsideBBox(shape, waypointsAfter[0])) {\n waypointsAfter.unshift(copy(dockingPoint));\n }\n }\n\n source = targetFlow.source;\n target = targetFlow.target;\n\n if (bpmnRules.canConnect(source, shape, targetFlow)) {\n // reconnect source -> inserted shape\n modeling.reconnectEnd(targetFlow, shape, waypointsBefore || position);\n\n reconnected = true;\n }\n\n if (bpmnRules.canConnect(shape, target, targetFlow)) {\n\n if (!reconnected) {\n // reconnect inserted shape -> end\n modeling.reconnectStart(targetFlow, shape, waypointsAfter || position);\n } else {\n modeling.connect(shape, target, { type: targetFlow.type, waypoints: waypointsAfter });\n }\n }\n }\n\n this.preExecute('elements.move', function(context) {\n\n var newParent = context.newParent,\n shapes = context.shapes,\n delta = context.delta,\n shape = shapes[0];\n\n if (!shape || !newParent) {\n return;\n }\n\n // if the new parent is a connection,\n // change it to the new parent's parent\n if (newParent && newParent.waypoints) {\n context.newParent = newParent = newParent.parent;\n }\n\n var shapeMid = getMid(shape);\n var newShapeMid = {\n x: shapeMid.x + delta.x,\n y: shapeMid.y + delta.y\n };\n\n // find a connection which intersects with the\n // element's mid point\n var connection = find(newParent.children, function(element) {\n var canInsert = bpmnRules.canInsert(shapes, element);\n\n return canInsert && getApproxIntersection(element.waypoints, newShapeMid);\n });\n\n if (connection) {\n context.targetFlow = connection;\n context.position = newShapeMid;\n }\n\n }, true);\n\n this.postExecuted('elements.move', function(context) {\n\n var shapes = context.shapes,\n targetFlow = context.targetFlow,\n position = context.position;\n\n if (targetFlow) {\n insertShape(shapes[0], targetFlow, position);\n }\n\n }, true);\n\n this.preExecute('shape.create', function(context) {\n\n var parent = context.parent,\n shape = context.shape;\n\n if (bpmnRules.canInsert(shape, parent)) {\n context.targetFlow = parent;\n context.parent = parent.parent;\n }\n }, true);\n\n\n this.postExecute('shape.create', function(context) {\n\n var shape = context.shape,\n targetFlow = context.targetFlow,\n position = context.position;\n\n if (targetFlow) {\n insertShape(shape, targetFlow, position);\n }\n }, true);\n}\n\ninherits(DropOnFlow, CommandInterceptor);\n\nDropOnFlow.$inject = [ 'eventBus', 'bpmnRules', 'modeling' ];\n\nmodule.exports = DropOnFlow;\n","'use strict';\n\nvar getMid = require(252).getMid;\n\nvar lineIntersect = require(57);\n\n\n/**\n * Fix broken dockings after DI imports.\n *\n * @param {EventBus} eventBus\n */\nfunction ImportDockingFix(eventBus) {\n\n function adjustDocking(startPoint, nextPoint, elementMid) {\n\n var elementTop = {\n x: elementMid.x,\n y: elementMid.y - 50\n };\n\n var elementLeft = {\n x: elementMid.x - 50,\n y: elementMid.y\n };\n\n var verticalIntersect = lineIntersect(startPoint, nextPoint, elementMid, elementTop),\n horizontalIntersect = lineIntersect(startPoint, nextPoint, elementMid, elementLeft);\n\n // original is horizontal or vertical center cross intersection\n var centerIntersect;\n\n if (verticalIntersect && horizontalIntersect) {\n if (getDistance(verticalIntersect, elementMid) > getDistance(horizontalIntersect, elementMid)) {\n centerIntersect = horizontalIntersect;\n } else {\n centerIntersect = verticalIntersect;\n }\n } else {\n centerIntersect = verticalIntersect || horizontalIntersect;\n }\n\n startPoint.original = centerIntersect;\n }\n\n function fixDockings(connection) {\n var waypoints = connection.waypoints;\n\n adjustDocking(\n waypoints[0],\n waypoints[1],\n getMid(connection.source)\n );\n\n adjustDocking(\n waypoints[waypoints.length - 1],\n waypoints[waypoints.length - 2],\n getMid(connection.target)\n );\n }\n\n eventBus.on('bpmnElement.added', function(e) {\n\n var element = e.element;\n\n if (element.waypoints) {\n fixDockings(element);\n }\n });\n}\n\nImportDockingFix.$inject = [ 'eventBus' ];\n\nmodule.exports = ImportDockingFix;\n\n\n/////// helpers //////////////////////////////////\n\nfunction getDistance(p1, p2) {\n return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));\n}","'use strict';\n\nvar assign = require(431),\n inherits = require(289);\n\nvar LabelUtil = require(94),\n LabelLayoutUtil = require(55),\n ModelUtil = require(95),\n is = ModelUtil.is,\n getBusinessObject = ModelUtil.getBusinessObject;\n\nvar hasExternalLabel = LabelUtil.hasExternalLabel,\n getExternalLabelMid = LabelUtil.getExternalLabelMid,\n getLabelAdjustment = LabelLayoutUtil.getLabelAdjustment;\n\nvar CommandInterceptor = require(119);\n\nvar TextUtil = require(280);\n\nvar DEFAULT_LABEL_DIMENSIONS = {\n width: 90,\n height: 20\n};\n\n\n/**\n * A component that makes sure that external labels are added\n * together with respective elements and properly updated (DI wise)\n * during move.\n *\n * @param {EventBus} eventBus\n * @param {Modeling} modeling\n * @param {BpmnFactory} bpmnFactory\n */\nfunction LabelSupport(eventBus, modeling, bpmnFactory) {\n\n CommandInterceptor.call(this, eventBus);\n\n var textUtil = new TextUtil();\n\n\n ///// create external labels on shape creation\n\n this.postExecute([ 'shape.create', 'connection.create' ], function(e) {\n var context = e.context;\n\n var element = context.shape || context.connection,\n businessObject = element.businessObject;\n\n if (!hasExternalLabel(businessObject)) {\n return;\n }\n\n var labelCenter = getExternalLabelMid(element);\n\n // we don't care about x and y\n var labelDimensions = getLayoutedBounds(\n DEFAULT_LABEL_DIMENSIONS,\n businessObject.name || '',\n textUtil\n );\n\n modeling.createLabel(element, labelCenter, {\n id: businessObject.id + '_label',\n hidden: !businessObject.name,\n businessObject: businessObject,\n width: labelDimensions.width,\n height: labelDimensions.height\n });\n });\n\n\n ///// update di information on label creation\n\n this.executed([ 'label.create' ], function(event) {\n\n var element = event.context.shape,\n businessObject,\n di;\n\n // we want to trigger on real labels only\n if (!element.labelTarget) {\n return;\n }\n\n // we want to trigger on BPMN elements only\n if (!is(element.labelTarget || element, 'bpmn:BaseElement')) {\n return;\n }\n\n businessObject = element.businessObject,\n di = businessObject.di;\n\n\n if (!di.label) {\n di.label = bpmnFactory.create('bpmndi:BPMNLabel', {\n bounds: bpmnFactory.create('dc:Bounds')\n });\n }\n\n assign(di.label.bounds, {\n x: element.x,\n y: element.y,\n width: element.width,\n height: element.height\n });\n });\n\n\n ///// update label position on connection change\n\n function getHiddenLabelAdjustment(event) {\n\n var context = event.context,\n connection = context.connection,\n label = connection.label;\n\n var labelPosition = getExternalLabelMid(connection);\n\n return {\n x: labelPosition.x - label.x - label.width / 2,\n y: labelPosition.y - label.y - label.height / 2\n };\n }\n\n function getVisibleLabelAdjustment(event) {\n\n var command = event.command,\n context = event.context,\n connection = context.connection,\n label = connection.label,\n hints = assign({}, context.hints),\n newWaypoints = context.newWaypoints || connection.waypoints,\n oldWaypoints = context.oldWaypoints;\n\n\n if (typeof hints.startChanged === 'undefined') {\n hints.startChanged = (command === 'connection.reconnectStart');\n }\n\n if (typeof hints.endChanged === 'undefined') {\n hints.endChanged = (command === 'connection.reconnectEnd');\n }\n\n return getLabelAdjustment(label, newWaypoints, oldWaypoints, hints);\n }\n\n this.postExecute([\n 'connection.layout',\n 'connection.reconnectEnd',\n 'connection.reconnectStart',\n 'connection.updateWaypoints'\n ], function(event) {\n\n var label = event.context.connection.label,\n labelAdjustment;\n\n if (!label) {\n return;\n }\n\n if (label.hidden) {\n labelAdjustment = getHiddenLabelAdjustment(event);\n } else {\n labelAdjustment = getVisibleLabelAdjustment(event);\n }\n\n modeling.moveShape(label, labelAdjustment);\n });\n\n\n ////// keep label position on shape replace\n\n this.postExecute([ 'shape.replace' ], function(event) {\n var context = event.context,\n newShape = context.newShape,\n oldShape = context.oldShape;\n\n var businessObject = getBusinessObject(newShape);\n\n if (businessObject && hasExternalLabel(businessObject)) {\n newShape.label.x = oldShape.label.x;\n newShape.label.y = oldShape.label.y;\n }\n });\n\n}\n\ninherits(LabelSupport, CommandInterceptor);\n\nLabelSupport.$inject = [ 'eventBus', 'modeling', 'bpmnFactory' ];\n\nmodule.exports = LabelSupport;\n\n\n// TODO(nikku): repeating code (search for )\n\nvar EXTERNAL_LABEL_STYLE = {\n fontFamily: 'Arial, sans-serif',\n fontSize: '11px'\n};\n\nfunction getLayoutedBounds(bounds, text, textUtil) {\n\n var layoutedLabelDimensions = textUtil.getDimensions(text, {\n box: {\n width: 90,\n height: 30,\n x: bounds.width / 2 + bounds.x,\n y: bounds.height / 2 + bounds.y\n },\n style: EXTERNAL_LABEL_STYLE\n });\n\n // resize label shape to fit label text\n return {\n x: Math.round(bounds.x + bounds.width / 2 - layoutedLabelDimensions.width / 2),\n y: Math.round(bounds.y),\n width: Math.ceil(layoutedLabelDimensions.width),\n height: Math.ceil(layoutedLabelDimensions.height)\n };\n}\n","'use strict';\n\nvar is = require(95).is;\n\nvar COLLAB_ERR_MSG = 'flow elements must be children of pools/participants',\n PROCESS_ERR_MSG = 'participants cannot be pasted onto a non-empty process diagram';\n\nfunction ModelingFeedback(eventBus, tooltips, translate) {\n\n function showError(position, message, timeout) {\n tooltips.add({\n position: {\n x: position.x + 5,\n y: position.y + 5\n },\n type: 'error',\n timeout: timeout || 2000,\n html: '
' + message + '
'\n });\n }\n\n eventBus.on([ 'shape.move.rejected', 'create.rejected' ], function(event) {\n var context = event.context,\n shape = context.shape,\n target = context.target;\n\n if (is(target, 'bpmn:Collaboration') && is(shape, 'bpmn:FlowNode')) {\n showError(event, translate(COLLAB_ERR_MSG));\n }\n });\n\n eventBus.on([ 'elements.paste.rejected' ], function(event) {\n var context = event.context,\n position = context.position,\n target = context.target;\n\n if (is(target, 'bpmn:Collaboration')) {\n showError(position, translate(COLLAB_ERR_MSG));\n }\n\n if (is(target, 'bpmn:Process')) {\n showError(position, translate(PROCESS_ERR_MSG), 3000);\n }\n });\n}\n\n\nModelingFeedback.$inject = [ 'eventBus', 'tooltips', 'translate' ];\n\nmodule.exports = ModelingFeedback;\n","'use strict';\n\nvar inherits = require(289);\n\nvar CommandInterceptor = require(119);\n\nvar lineIntersect = require(57);\n\n\nfunction RemoveElementBehavior(eventBus, bpmnRules, modeling) {\n\n CommandInterceptor.call(this, eventBus);\n\n /**\n * Combine sequence flows when deleting an element\n * if there is one incoming and one outgoing\n * sequence flow\n */\n this.preExecute('shape.delete', function(e) {\n\n var shape = e.context.shape;\n\n if (shape.incoming.length == 1 && shape.outgoing.length == 1) {\n\n var inConnection = shape.incoming[0],\n outConnection = shape.outgoing[0];\n\n\n if (bpmnRules.canConnect(inConnection.source, outConnection.target, inConnection)) {\n\n // compute new, combined waypoints\n var newWaypoints = getNewWaypoints(inConnection.waypoints, outConnection.waypoints);\n\n modeling.reconnectEnd(inConnection, outConnection.target, newWaypoints);\n }\n }\n });\n\n}\n\ninherits(RemoveElementBehavior, CommandInterceptor);\n\nRemoveElementBehavior.$inject = [ 'eventBus', 'bpmnRules', 'modeling' ];\n\nmodule.exports = RemoveElementBehavior;\n\n\n///////// helpers //////////////////////////////\n\nfunction getDocking(point) {\n return point.original || point;\n}\n\n\nfunction getNewWaypoints(inWaypoints, outWaypoints) {\n\n var intersection = lineIntersect(\n getDocking(inWaypoints[inWaypoints.length - 2]),\n getDocking(inWaypoints[inWaypoints.length - 1]),\n getDocking(outWaypoints[1]),\n getDocking(outWaypoints[0]));\n\n if (intersection) {\n return [].concat(\n inWaypoints.slice(0, inWaypoints.length - 1),\n [ intersection ],\n outWaypoints.slice(1));\n } else {\n return [\n getDocking(inWaypoints[0]),\n getDocking(outWaypoints[outWaypoints.length - 1])\n ];\n }\n}","'use strict';\n\nvar inherits = require(289);\n\nvar CommandInterceptor = require(119);\n\nvar is = require(95).is;\n\n\n/**\n * BPMN specific remove behavior\n */\nfunction RemoveParticipantBehavior(eventBus, modeling) {\n\n CommandInterceptor.call(this, eventBus);\n\n\n /**\n * morph collaboration diagram into process diagram\n * after the last participant has been removed\n */\n\n this.preExecute('shape.delete', function(context) {\n\n var shape = context.shape,\n parent = shape.parent;\n\n // activate the behavior if the shape to be removed\n // is a participant\n if (is(shape, 'bpmn:Participant')) {\n context.collaborationRoot = parent;\n }\n }, true);\n\n this.postExecute('shape.delete', function(context) {\n\n var collaborationRoot = context.collaborationRoot;\n\n if (collaborationRoot && !collaborationRoot.businessObject.participants.length) {\n // replace empty collaboration with process diagram\n modeling.makeProcess();\n }\n }, true);\n\n}\n\nRemoveParticipantBehavior.$inject = [ 'eventBus', 'modeling' ];\n\ninherits(RemoveParticipantBehavior, CommandInterceptor);\n\nmodule.exports = RemoveParticipantBehavior;","'use strict';\n\nvar forEach = require(303),\n find = require(302),\n inherits = require(289);\n\nvar CommandInterceptor = require(119);\n\nvar is = require(95).is;\n\nfunction ReplaceConnectionBehavior(eventBus, modeling, bpmnRules) {\n\n CommandInterceptor.call(this, eventBus);\n\n function fixConnection(connection) {\n\n var source = connection.source,\n target = connection.target,\n parent = connection.parent;\n\n // do not do anything if connection\n // is already deleted (may happen due to other\n // behaviors plugged-in before)\n if (!parent) {\n return;\n }\n\n var replacementType,\n remove;\n\n /**\n * Check if incoming or outgoing connections\n * can stay or could be substituted with an\n * appropriate replacement.\n *\n * This holds true for SequenceFlow <> MessageFlow.\n */\n\n if (is(connection, 'bpmn:SequenceFlow')) {\n if (!bpmnRules.canConnectSequenceFlow(source, target)) {\n remove = true;\n }\n\n if (bpmnRules.canConnectMessageFlow(source, target)) {\n replacementType = 'bpmn:MessageFlow';\n }\n }\n\n // transform message flows into sequence flows, if possible\n\n if (is(connection, 'bpmn:MessageFlow')) {\n\n if (!bpmnRules.canConnectMessageFlow(source, target)) {\n remove = true;\n }\n\n if (bpmnRules.canConnectSequenceFlow(source, target)) {\n replacementType = 'bpmn:SequenceFlow';\n }\n }\n\n if (is(connection, 'bpmn:Association') && !bpmnRules.canConnectAssociation(source, target)) {\n remove = true;\n }\n\n\n // remove invalid connection,\n // unless it has been removed already\n if (remove) {\n modeling.removeConnection(connection);\n }\n\n // replace SequenceFlow <> MessageFlow\n\n if (replacementType) {\n modeling.connect(source, target, {\n type: replacementType,\n waypoints: connection.waypoints.slice()\n });\n }\n }\n\n this.postExecuted('elements.move', function(context) {\n\n var closure = context.closure,\n allConnections = closure.allConnections;\n\n forEach(allConnections, fixConnection);\n }, true);\n\n this.postExecuted([\n 'connection.reconnectStart',\n 'connection.reconnectEnd'\n ], function(event) {\n\n var connection = event.context.connection;\n\n fixConnection(connection);\n });\n\n this.postExecuted('element.updateProperties', function(event) {\n var context = event.context,\n properties = context.properties,\n element = context.element,\n businessObject = element.businessObject,\n connection;\n\n // remove condition expression when morphing to default flow\n if (properties.default) {\n connection = find(element.outgoing, { id: element.businessObject.default.id });\n\n if (connection) {\n modeling.updateProperties(connection, { conditionExpression: undefined });\n }\n }\n\n // remove default property from source when morphing to conditional flow\n if (properties.conditionExpression && businessObject.sourceRef.default === businessObject) {\n modeling.updateProperties(element.source, { default: undefined });\n }\n });\n}\n\ninherits(ReplaceConnectionBehavior, CommandInterceptor);\n\nReplaceConnectionBehavior.$inject = [ 'eventBus', 'modeling', 'bpmnRules' ];\n\nmodule.exports = ReplaceConnectionBehavior;\n","'use strict';\n\nvar inherits = require(289);\n\nvar CommandInterceptor = require(119);\n\nvar forEach = require(303);\n\nvar isEventSubProcess = require(93).isEventSubProcess;\nvar is = require(95).is;\n\n/**\n * Defines the behaviour of what happens to the elements inside a container\n * that morphs into another BPMN element\n */\nfunction ReplaceElementBehaviour(eventBus, bpmnReplace, bpmnRules, elementRegistry, selection, modeling) {\n CommandInterceptor.call(this, eventBus);\n\n this._bpmnReplace = bpmnReplace;\n this._elementRegistry = elementRegistry;\n this._selection = selection;\n this._modeling = modeling;\n\n this.postExecuted([ 'elements.move' ], 500, function(event) {\n\n var context = event.context,\n target = context.newParent,\n newHost = context.newHost,\n elements = [];\n\n forEach(context.closure.topLevel, function(topLevelElements) {\n if (isEventSubProcess(topLevelElements)) {\n elements = elements.concat(topLevelElements.children);\n } else {\n elements = elements.concat(topLevelElements);\n }\n });\n\n // Change target to host when the moving element is a `bpmn:BoundaryEvent`\n if (elements.length === 1 && newHost) {\n target = newHost;\n }\n\n var canReplace = bpmnRules.canReplace(elements, target);\n\n if (canReplace) {\n this.replaceElements(elements, canReplace.replacements, newHost);\n }\n }, this);\n\n // update attachments if the host is replaced\n this.postExecute([ 'shape.replace' ], 1500, function(e) {\n\n var context = e.context,\n oldShape = context.oldShape,\n newShape = context.newShape,\n attachers = oldShape.attachers,\n canReplace;\n\n if (attachers && attachers.length) {\n canReplace = bpmnRules.canReplace(attachers, newShape);\n\n this.replaceElements(attachers, canReplace.replacements);\n }\n\n }, this);\n\n this.postExecuted( [ 'shape.replace' ], 1500, function(e) {\n var context = e.context,\n oldShape = context.oldShape,\n newShape = context.newShape;\n\n modeling.unclaimId(oldShape.businessObject.id, oldShape.businessObject);\n modeling.updateProperties(newShape, { id: oldShape.id });\n });\n}\n\ninherits(ReplaceElementBehaviour, CommandInterceptor);\n\n\nReplaceElementBehaviour.prototype.replaceElements = function(elements, newElements, newHost) {\n var elementRegistry = this._elementRegistry,\n bpmnReplace = this._bpmnReplace,\n selection = this._selection,\n modeling = this._modeling;\n\n forEach(newElements, function(replacement) {\n\n var newElement = {\n type: replacement.newElementType\n };\n\n var oldElement = elementRegistry.get(replacement.oldElementId);\n\n if (newHost && is(oldElement, 'bpmn:BoundaryEvent')) {\n modeling.updateAttachment(oldElement, null);\n }\n\n var idx = elements.indexOf(oldElement);\n\n elements[idx] = bpmnReplace.replaceElement(oldElement, newElement, { select: false });\n\n if (newHost && is(elements[idx], 'bpmn:BoundaryEvent')) {\n modeling.updateAttachment(elements[idx], newHost);\n }\n });\n\n if (newElements) {\n selection.select(elements);\n }\n};\n\nReplaceElementBehaviour.$inject = [\n 'eventBus', 'bpmnReplace', 'bpmnRules',\n 'elementRegistry', 'selection', 'modeling'\n];\n\nmodule.exports = ReplaceElementBehaviour;\n","'use strict';\n\nvar is = require(95).is;\n\nvar roundBounds = require(252).roundBounds;\n\nvar hasPrimaryModifier = require(274).hasPrimaryModifier;\n\nvar SLIGHTLY_HIGHER_PRIORITY = 1001;\n\n\n/**\n * Invoke {@link Modeling#resizeLane} instead of\n * {@link Modeling#resizeShape} when resizing a Lane\n * or Participant shape.\n */\nfunction ResizeLaneBehavior(eventBus, modeling) {\n\n eventBus.on('resize.start', SLIGHTLY_HIGHER_PRIORITY + 500, function(event) {\n var context = event.context,\n shape = context.shape;\n\n if (is(shape, 'bpmn:Lane') || is(shape, 'bpmn:Participant')) {\n\n // should we resize the opposite lane(s) in\n // order to compensate for the resize operation?\n context.balanced = !hasPrimaryModifier(event);\n }\n });\n\n /**\n * Intercept resize end and call resize lane function instead.\n */\n eventBus.on('resize.end', SLIGHTLY_HIGHER_PRIORITY, function(event) {\n var context = event.context,\n shape = context.shape,\n canExecute = context.canExecute,\n newBounds = context.newBounds;\n\n if (is(shape, 'bpmn:Lane') || is(shape, 'bpmn:Participant')) {\n\n if (canExecute) {\n // ensure we have actual pixel values for new bounds\n // (important when zoom level was > 1 during move)\n newBounds = roundBounds(newBounds);\n\n // perform the actual resize\n modeling.resizeLane(shape, newBounds, context.balanced);\n }\n\n // stop propagation\n return false;\n }\n });\n}\n\nResizeLaneBehavior.$inject = [ 'eventBus', 'modeling' ];\n\nmodule.exports = ResizeLaneBehavior;\n","'use strict';\n\nvar inherits = require(289);\n\nvar CommandInterceptor = require(119),\n getBusinessObject = require(95).getBusinessObject,\n is = require(95).is,\n computeChildrenBBox = require(223).computeChildrenBBox;\n\n\nvar LOW_PRIORITY = 500;\n\n\nfunction ToggleElementCollapseBehaviour(eventBus, elementFactory, modeling, resize) {\n CommandInterceptor.call(this, eventBus);\n\n\n function hideEmptyLables(children) {\n if (children.length) {\n children.forEach(function(child) {\n if (child.type === 'label' && !child.businessObject.name) {\n child.hidden = true;\n }\n });\n }\n }\n\n function expandedBounds(shape, defaultSize) {\n var children = shape.children,\n newBounds = defaultSize,\n visibleElements,\n visibleBBox;\n\n visibleElements = filterVisible(children).concat([ shape ]);\n\n visibleBBox = computeChildrenBBox(visibleElements);\n\n if (visibleBBox) {\n // center to visibleBBox with max(defaultSize, childrenBounds)\n newBounds.width = Math.max(visibleBBox.width, newBounds.width);\n newBounds.height = Math.max(visibleBBox.height, newBounds.height);\n\n newBounds.x = visibleBBox.x + (visibleBBox.width - newBounds.width) / 2;\n newBounds.y = visibleBBox.y + (visibleBBox.height - newBounds.height) / 2;\n } else {\n // center to collapsed shape with defaultSize\n newBounds.x = shape.x + (shape.width - newBounds.width) / 2;\n newBounds.y = shape.y + (shape.height - newBounds.height) / 2;\n }\n\n return newBounds;\n }\n\n function collapsedBounds(shape, defaultSize) {\n\n return {\n x: shape.x + (shape.width - defaultSize.width) / 2,\n y: shape.y + (shape.height - defaultSize.height) / 2,\n width: defaultSize.width,\n height: defaultSize.height\n };\n }\n\n this.executed([ 'shape.toggleCollapse' ], LOW_PRIORITY, function(e) {\n\n var context = e.context,\n shape = context.shape;\n\n if (!is(shape, 'bpmn:SubProcess')) {\n return;\n }\n\n if (!shape.collapsed) {\n // all children got made visible through djs, hide empty labels\n hideEmptyLables(shape.children);\n\n // remove collapsed marker\n getBusinessObject(shape).di.isExpanded = true;\n } else {\n // place collapsed marker\n getBusinessObject(shape).di.isExpanded = false;\n }\n });\n\n this.reverted([ 'shape.toggleCollapse' ], LOW_PRIORITY, function(e) {\n\n var context = e.context;\n var shape = context.shape;\n\n\n // revert removing/placing collapsed marker\n if (!shape.collapsed) {\n getBusinessObject(shape).di.isExpanded = true;\n\n } else {\n getBusinessObject(shape).di.isExpanded = false;\n }\n });\n\n this.postExecuted([ 'shape.toggleCollapse' ], LOW_PRIORITY, function(e) {\n var shape = e.context.shape,\n defaultSize = elementFactory._getDefaultSize(shape),\n newBounds;\n\n if (shape.collapsed) {\n\n // resize to default size of collapsed shapes\n newBounds = collapsedBounds(shape, defaultSize);\n } else {\n\n // resize to bounds of max(visible children, defaultSize)\n newBounds = expandedBounds(shape, defaultSize);\n }\n\n modeling.resizeShape(shape, newBounds);\n });\n\n}\n\n\ninherits(ToggleElementCollapseBehaviour, CommandInterceptor);\n\nToggleElementCollapseBehaviour.$inject = [\n 'eventBus',\n 'elementFactory',\n 'modeling'\n];\n\nmodule.exports = ToggleElementCollapseBehaviour;\n\n\n\n/////// helpers ///////////////////////////\n\nfunction filterVisible(elements) {\n return elements.filter(function(e) {\n return !e.hidden;\n });\n}","'use strict';\n\nvar forEach = require(303);\n\nvar inherits = require(289);\n\nvar CommandInterceptor = require(119);\n\nfunction UnclaimIdBehavior(eventBus, modeling) {\n\n CommandInterceptor.call(this, eventBus);\n\n this.preExecute('elements.delete', function(event) {\n var context = event.context,\n elements = context.elements;\n\n forEach(elements, function(element) {\n modeling.unclaimId(element.businessObject.id, element.businessObject);\n });\n\n });\n}\n\ninherits(UnclaimIdBehavior, CommandInterceptor);\n\nUnclaimIdBehavior.$inject = [ 'eventBus', 'modeling' ];\n\nmodule.exports = UnclaimIdBehavior;","'use strict';\n\nvar inherits = require(289);\n\nvar CommandInterceptor = require(119);\n\nvar is = require(95).is,\n getBusinessObject = require(95).getBusinessObject;\n\n/**\n * A behavior that unsets the Default property of\n * sequence flow source on element delete, if the\n * removed element is the Gateway or Task's default flow.\n *\n * @param {EventBus} eventBus\n * @param {Modeling} modeling\n */\nfunction DeleteSequenceFlowBehavior(eventBus, modeling) {\n\n CommandInterceptor.call(this, eventBus);\n\n\n this.preExecute('connection.delete', function(event) {\n var context = event.context,\n connection = context.connection,\n source = connection.source;\n\n if (isDefaultFlow(connection, source)) {\n modeling.updateProperties(source, {\n 'default': null\n });\n }\n });\n}\n\ninherits(DeleteSequenceFlowBehavior, CommandInterceptor);\n\nDeleteSequenceFlowBehavior.$inject = [ 'eventBus', 'modeling' ];\n\nmodule.exports = DeleteSequenceFlowBehavior;\n\n\n/////// helpers ///////////////////////////\n\nfunction isDefaultFlow(connection, source) {\n\n if (!is(connection, 'bpmn:SequenceFlow')) {\n return false;\n }\n\n var sourceBo = getBusinessObject(source),\n sequenceFlow = getBusinessObject(connection);\n\n return sourceBo.get('default') === sequenceFlow;\n}","'use strict';\n\n\nvar inherits = require(289);\n\nvar CommandInterceptor = require(119);\n\nvar is = require(95).is;\n\nvar LOW_PRIORITY = 500,\n HIGH_PRIORITY = 5000;\n\n\n/**\n * BPMN specific delete lane behavior\n */\nfunction UpdateFlowNodeRefsBehavior(eventBus, modeling, translate) {\n\n CommandInterceptor.call(this, eventBus);\n\n /**\n * Ok, this is it:\n *\n * We have to update the Lane#flowNodeRefs _and_\n * FlowNode#lanes with every FlowNode move/resize and\n * Lane move/resize.\n *\n * We want to group that stuff to recompute containments\n * as efficient as possible.\n *\n * Yea!\n */\n\n // the update context\n var context;\n\n\n function initContext() {\n context = context || new UpdateContext();\n context.enter();\n\n return context;\n }\n\n function getContext() {\n if (!context) {\n throw new Error(translate('out of bounds release'));\n }\n\n return context;\n }\n\n function releaseContext() {\n\n if (!context) {\n throw new Error(translate('out of bounds release'));\n }\n\n var triggerUpdate = context.leave();\n\n if (triggerUpdate) {\n modeling.updateLaneRefs(context.flowNodes, context.lanes);\n\n context = null;\n }\n\n return triggerUpdate;\n }\n\n\n var laneRefUpdateEvents = [\n 'spaceTool',\n 'lane.add',\n 'lane.resize',\n 'lane.split',\n 'elements.move',\n 'elements.delete',\n 'shape.create',\n 'shape.delete',\n 'shape.move',\n 'shape.resize'\n ];\n\n\n // listen to a lot of stuff to group lane updates\n\n this.preExecute(laneRefUpdateEvents, HIGH_PRIORITY, function(event) {\n initContext();\n });\n\n this.postExecuted(laneRefUpdateEvents, LOW_PRIORITY, function(event) {\n releaseContext();\n });\n\n\n // Mark flow nodes + lanes that need an update\n\n this.preExecute([\n 'shape.create',\n 'shape.move',\n 'shape.delete',\n 'shape.resize'\n ], function(event) {\n\n var context = event.context,\n shape = context.shape;\n\n var updateContext = getContext();\n\n // no need to update labels\n if (shape.labelTarget) {\n return;\n }\n\n if (is(shape, 'bpmn:Lane')) {\n updateContext.addLane(shape);\n }\n\n if (is(shape, 'bpmn:FlowNode')) {\n updateContext.addFlowNode(shape);\n }\n });\n}\n\nUpdateFlowNodeRefsBehavior.$inject = [ 'eventBus', 'modeling' , 'translate'];\n\ninherits(UpdateFlowNodeRefsBehavior, CommandInterceptor);\n\nmodule.exports = UpdateFlowNodeRefsBehavior;\n\n\n\nfunction UpdateContext() {\n\n this.flowNodes = [];\n this.lanes = [];\n\n this.counter = 0;\n\n this.addLane = function(lane) {\n this.lanes.push(lane);\n };\n\n this.addFlowNode = function(flowNode) {\n this.flowNodes.push(flowNode);\n };\n\n this.enter = function() {\n this.counter++;\n };\n\n this.leave = function() {\n this.counter--;\n\n return !this.counter;\n };\n}","module.exports = {\n __init__: [\n 'appendBehavior',\n 'copyPasteBehavior',\n 'createBoundaryEventBehavior',\n 'createDataObjectBehavior',\n 'dropOnFlowBehavior',\n 'createParticipantBehavior',\n 'dataInputAssociationBehavior',\n 'deleteLaneBehavior',\n 'importDockingFix',\n 'labelBehavior',\n 'modelingFeedback',\n 'removeParticipantBehavior',\n 'replaceConnectionBehavior',\n 'replaceElementBehaviour',\n 'resizeLaneBehavior',\n 'unsetDefaultFlowBehavior',\n 'updateFlowNodeRefsBehavior',\n 'removeElementBehavior',\n 'unclaimIdBehavior',\n 'toggleElementCollapseBehaviour'\n ],\n appendBehavior: [ 'type', require(33) ],\n copyPasteBehavior: [ 'type', require(34) ],\n createBoundaryEventBehavior: [ 'type', require(35) ],\n createDataObjectBehavior: [ 'type', require(36) ],\n dropOnFlowBehavior: [ 'type', require(40) ],\n createParticipantBehavior: [ 'type', require(37) ],\n dataInputAssociationBehavior: [ 'type', require(38) ],\n deleteLaneBehavior: [ 'type', require(39) ],\n importDockingFix: [ 'type', require(41) ],\n labelBehavior: [ 'type', require(42) ],\n modelingFeedback: [ 'type', require(43) ],\n removeParticipantBehavior: [ 'type', require(45) ],\n replaceConnectionBehavior: [ 'type', require(46) ],\n replaceElementBehaviour: [ 'type', require(47) ],\n resizeLaneBehavior: [ 'type', require(48) ],\n unsetDefaultFlowBehavior: [ 'type', require(51) ],\n updateFlowNodeRefsBehavior: [ 'type', require(52) ],\n removeElementBehavior: [ 'type', require(44) ],\n unclaimIdBehavior: [ 'type', require(50) ],\n toggleElementCollapseBehaviour : [ 'type', require(49) ]\n};\n","'use strict';\n\n/**\n * Returns the length of a vector\n *\n * @param {Vector}\n * @return {Float}\n */\nfunction vectorLength(v) {\n return Math.sqrt( Math.pow(v.x, 2) + Math.pow(v.y, 2) );\n}\n\nmodule.exports.vectorLength = vectorLength;\n\n/**\n * Calculates the angle between a line a the yAxis\n *\n * @param {Array}\n * @return {Float}\n */\nfunction getAngle(line) {\n // return value is between 0, 180 and -180, -0\n // @janstuemmel: maybe replace return a/b with b/a\n return Math.atan( (line[1].y - line[0].y) / (line[1].x - line[0].x) );\n}\n\nmodule.exports.getAngle = getAngle;\n\n/**\n * Rotates a vector by a given angle\n *\n * @param {Vector}\n * @param {Float} Angle in radians\n * @return {Vector}\n */\nfunction rotateVector(vector, angle) {\n return (!angle) ? vector : {\n x: Math.cos(angle) * vector.x - Math.sin(angle) * vector.y,\n y: Math.sin(angle) * vector.x + Math.cos(angle) * vector.y\n };\n}\n\nmodule.exports.rotateVector = rotateVector;\n\n/**\n * Solves a 2D equation system\n * a + r*b = c, where a,b,c are 2D vectors\n *\n * @param {Vector}\n * @param {Vector}\n * @param {Vector}\n * @return {Float}\n */\nfunction solveLambaSystem(a, b, c) {\n\n // the 2d system\n var system = [\n { n: a[0] - c[0], lambda: b[0] },\n { n: a[1] - c[1], lambda: b[1] }\n ];\n\n // solve\n var n = system[0].n * b[0] + system[1].n * b[1],\n l = system[0].lambda * b[0] + system[1].lambda * b[1];\n\n return -n/l;\n}\n\n/**\n * Position of perpendicular foot\n *\n * @param {Point}\n * @param [ {Point}, {Point} ] line defined throug two points\n * @return {Point} the perpendicular foot position\n */\nfunction perpendicularFoot(point, line) {\n\n var a = line[0], b = line[1];\n\n // relative position of b from a\n var bd = { x: b.x - a.x, y: b.y - a.y };\n\n // solve equation system to the parametrized vectors param real value\n var r = solveLambaSystem( [ a.x, a.y ], [ bd.x, bd.y ], [ point.x, point.y ] );\n\n return { x: a.x + r*bd.x, y: a.y + r*bd.y };\n\n}\n\nmodule.exports.perpendicularFoot = perpendicularFoot;\n\n/**\n * Calculates the distance between a point and a line\n *\n * @param {Point}\n * @param [ {Point}, {Point} ] line defined throug two points\n * @return {Float} distance\n */\nfunction getDistancePointLine(point, line) {\n\n var pfPoint = perpendicularFoot(point, line);\n\n // distance vector\n var connectionVector = {\n x: pfPoint.x - point.x,\n y: pfPoint.y - point.y\n };\n\n return vectorLength(connectionVector);\n}\n\nmodule.exports.getDistancePointLine = getDistancePointLine;\n\n/**\n * Calculates the distance between two points\n *\n * @param {Point}\n * @param {Point}\n * @return {Float} distance\n */\nfunction getDistancePointPoint(point1, point2) {\n\n return vectorLength({\n x: point1.x - point2.x,\n y: point1.y - point2.y\n });\n}\n\nmodule.exports.getDistancePointPoint = getDistancePointPoint;\n","'use strict';\n\nvar GeometricUtil = require(54);\n\nvar getDistancePointPoint = require(54).getDistancePointPoint;\n\nvar getAttachment = require(56).getAttachment;\n\n\nfunction findNewLabelLineStartIndex(oldWaypoints, newWaypoints, attachment, hints) {\n\n var index = attachment.segmentIndex;\n\n var offset = newWaypoints.length - oldWaypoints.length;\n\n // segmentMove happend\n if (hints.segmentMove) {\n\n var oldSegmentStartIndex = hints.segmentMove.segmentStartIndex,\n newSegmentStartIndex = hints.segmentMove.newSegmentStartIndex;\n\n // if label was on moved segment return new segment index\n if (index === oldSegmentStartIndex) {\n return newSegmentStartIndex;\n }\n\n // label is after new segment index\n if (index >= newSegmentStartIndex) {\n return (index+offset < newSegmentStartIndex) ? newSegmentStartIndex : index+offset;\n }\n\n // if label is before new segment index\n return index;\n }\n\n // bendpointMove happend\n if (hints.bendpointMove) {\n\n var insert = hints.bendpointMove.insert,\n bendpointIndex = hints.bendpointMove.bendpointIndex,\n newIndex;\n\n // waypoints length didnt change\n if (offset === 0) {\n return index;\n }\n\n // label behind new/removed bendpoint\n if (index >= bendpointIndex) {\n newIndex = insert ? index + 1 : index - 1;\n }\n\n // label before new/removed bendpoint\n if (index < bendpointIndex) {\n\n newIndex = index;\n\n // decide label should take right or left segment\n if (insert && attachment.type !== 'bendpoint' && bendpointIndex-1 === index) {\n\n var rel = relativePositionMidWaypoint(newWaypoints, bendpointIndex);\n\n if (rel < attachment.relativeLocation) {\n newIndex++;\n }\n }\n }\n\n return newIndex;\n }\n\n // start/end changed\n if (offset === 0) {\n return index;\n }\n\n if (hints.connectionStart) {\n return (index === 0) ? 0 : null;\n }\n\n if (hints.connectionEnd) {\n return (index === oldWaypoints.length - 2) ? newWaypoints.length - 2 : null;\n }\n\n // if nothing fits, return null\n return null;\n}\n\nmodule.exports.findNewLabelLineStartIndex = findNewLabelLineStartIndex;\n\n\n/**\n * Calculate the required adjustment (move delta) for the given label\n * after the connection waypoints got updated.\n *\n * @param {djs.model.Label} label\n * @param {Array} newWaypoints\n * @param {Array} oldWaypoints\n * @param {Object} hints\n *\n * @return {Point} delta\n */\nfunction getLabelAdjustment(label, newWaypoints, oldWaypoints, hints) {\n\n var x = 0,\n y = 0;\n\n var labelPosition = getLabelMid(label);\n\n // get closest attachment\n var attachment = getAttachment(labelPosition, oldWaypoints),\n oldLabelLineIndex = attachment.segmentIndex,\n newLabelLineIndex = findNewLabelLineStartIndex(oldWaypoints, newWaypoints, attachment, hints);\n\n if (newLabelLineIndex === null) {\n return { x: x, y: y };\n }\n\n // should never happen\n // TODO(@janstuemmel): throw an error here when connectionSegmentMove is refactored\n if (newLabelLineIndex < 0 ||\n newLabelLineIndex > newWaypoints.length - 2) {\n return { x: x, y: y };\n }\n\n var oldLabelLine = getLine(oldWaypoints, oldLabelLineIndex),\n newLabelLine = getLine(newWaypoints, newLabelLineIndex),\n oldFoot = attachment.position;\n\n var relativeFootPosition = getRelativeFootPosition(oldLabelLine, oldFoot),\n angleDelta = getAngleDelta(oldLabelLine, newLabelLine);\n\n // special rule if label on bendpoint\n if (attachment.type === 'bendpoint') {\n\n var offset = newWaypoints.length - oldWaypoints.length,\n oldBendpointIndex = attachment.bendpointIndex,\n oldBendpoint = oldWaypoints[oldBendpointIndex];\n\n // bendpoint position hasnt changed, return same position\n if (newWaypoints.indexOf(oldBendpoint) !== -1) {\n return { x: x, y: y };\n }\n\n // new bendpoint and old bendpoint have same index, then just return the offset\n if (offset === 0) {\n var newBendpoint = newWaypoints[oldBendpointIndex];\n\n return {\n x: newBendpoint.x - attachment.position.x,\n y: newBendpoint.y - attachment.position.y\n };\n }\n\n // if bendpoints get removed\n if (offset < 0 && oldBendpointIndex !== 0 && oldBendpointIndex < oldWaypoints.length - 1) {\n relativeFootPosition = relativePositionMidWaypoint(oldWaypoints, oldBendpointIndex);\n }\n }\n\n var newFoot = {\n x: (newLabelLine[1].x - newLabelLine[0].x) * relativeFootPosition + newLabelLine[0].x,\n y: (newLabelLine[1].y - newLabelLine[0].y) * relativeFootPosition + newLabelLine[0].y\n };\n\n // the rotated vector to label\n var newLabelVector = GeometricUtil.rotateVector({\n x: labelPosition.x - oldFoot.x,\n y: labelPosition.y - oldFoot.y\n }, angleDelta);\n\n // the new relative position\n x = newFoot.x + newLabelVector.x - labelPosition.x;\n y = newFoot.y + newLabelVector.y - labelPosition.y;\n\n return { x: x, y: y };\n}\n\nmodule.exports.getLabelAdjustment = getLabelAdjustment;\n\n\n//// HELPERS ///////\n\nfunction relativePositionMidWaypoint(waypoints, idx) {\n\n var distanceSegment1 = getDistancePointPoint(waypoints[idx-1], waypoints[idx]),\n distanceSegment2 = getDistancePointPoint(waypoints[idx], waypoints[idx+1]);\n\n var relativePosition = distanceSegment1 / ( distanceSegment1 + distanceSegment2 );\n\n return relativePosition;\n\n}\n\nfunction getLabelMid(label) {\n return {\n x: label.x + label.width / 2,\n y: label.y + label.height / 2\n };\n}\n\nfunction getAngleDelta(l1, l2) {\n var a1 = GeometricUtil.getAngle(l1),\n a2 = GeometricUtil.getAngle(l2);\n return a2 - a1;\n}\n\nfunction getLine(waypoints, idx) {\n return [ waypoints[idx], waypoints[idx+1] ];\n}\n\nfunction getRelativeFootPosition(line, foot) {\n\n var length = getDistancePointPoint(line[0], line[1]),\n lengthToFoot = getDistancePointPoint(line[0], foot);\n\n return length === 0 ? 0 : lengthToFoot / length;\n}\n","'use strict';\n\nvar sqrt = Math.sqrt,\n min = Math.min,\n max = Math.max,\n abs = Math.abs;\n\n/**\n * Calculate the square (power to two) of a number.\n *\n * @param {Number} n\n *\n * @return {Number}\n */\nfunction sq(n) {\n return Math.pow(n, 2);\n}\n\n/**\n * Get distance between two points.\n *\n * @param {Point} p1\n * @param {Point} p2\n *\n * @return {Number}\n */\nfunction getDistance(p1, p2) {\n return sqrt(sq(p1.x - p2.x) + sq(p1.y - p2.y));\n}\n\n/**\n * Return the attachment of the given point on the specified line.\n *\n * The attachment is either a bendpoint (attached to the given point)\n * or segment (attached to a location on a line segment) attachment:\n *\n * ```javascript\n * var pointAttachment = {\n * type: 'bendpoint',\n * bendpointIndex: 3,\n * position: { x: 10, y: 10 } // the attach point on the line\n * };\n *\n * var segmentAttachment = {\n * type: 'segment',\n * segmentIndex: 2,\n * relativeLocation: 0.31, // attach point location between 0 (at start) and 1 (at end)\n * position: { x: 10, y: 10 } // the attach point on the line\n * };\n * ```\n *\n * @param {Point} point\n * @param {Array} line\n *\n * @return {Object} attachment\n */\nfunction getAttachment(point, line) {\n\n var idx = 0,\n segmentStart,\n segmentEnd,\n segmentStartDistance,\n segmentEndDistance,\n attachmentPosition,\n minDistance,\n intersections,\n attachment,\n attachmentDistance,\n closestAttachmentDistance,\n closestAttachment;\n\n for (idx = 0; idx < line.length - 1; idx++) {\n\n segmentStart = line[idx];\n segmentEnd = line[idx + 1];\n\n if (pointsEqual(segmentStart, segmentEnd)) {\n intersections = [ segmentStart ];\n } else {\n segmentStartDistance = getDistance(point, segmentStart);\n segmentEndDistance = getDistance(point, segmentEnd);\n\n minDistance = min(segmentStartDistance, segmentEndDistance);\n\n intersections = getCircleSegmentIntersections(segmentStart, segmentEnd, point, minDistance);\n }\n\n if (intersections.length < 1) {\n throw new Error('expected between [1, 2] circle -> line intersections');\n }\n\n // one intersection -> bendpoint attachment\n if (intersections.length === 1) {\n attachment = {\n type: 'bendpoint',\n position: intersections[0],\n segmentIndex: idx,\n bendpointIndex: pointsEqual(segmentStart, intersections[0]) ? idx : idx + 1\n };\n }\n\n // two intersections -> segment attachment\n if (intersections.length === 2) {\n\n attachmentPosition = mid(intersections[0], intersections[1]);\n\n attachment = {\n type: 'segment',\n position: attachmentPosition,\n segmentIndex: idx,\n relativeLocation: getDistance(segmentStart, attachmentPosition) / getDistance(segmentStart, segmentEnd)\n };\n }\n\n attachmentDistance = getDistance(attachment.position, point);\n\n if (!closestAttachment || closestAttachmentDistance > attachmentDistance) {\n closestAttachment = attachment;\n closestAttachmentDistance = attachmentDistance;\n }\n }\n\n return closestAttachment;\n}\n\nmodule.exports.getAttachment = getAttachment;\n\n/**\n * Gets the intersection between a circle and a line segment.\n *\n * @param {Point} s1 segment start\n * @param {Point} s2 segment end\n * @param {Point} cc circle center\n * @param {Number} cr circle radius\n *\n * @return {Array} intersections\n */\nfunction getCircleSegmentIntersections(s1, s2, cc, cr) {\n\n var baX = s2.x - s1.x;\n var baY = s2.y - s1.y;\n var caX = cc.x - s1.x;\n var caY = cc.y - s1.y;\n\n var a = baX * baX + baY * baY;\n var bBy2 = baX * caX + baY * caY;\n var c = caX * caX + caY * caY - cr * cr;\n\n var pBy2 = bBy2 / a;\n var q = c / a;\n\n var disc = pBy2 * pBy2 - q;\n\n // check against negative value to work around\n // negative, very close to zero results (-4e-15)\n // being produced in some environments\n if (disc < 0 && disc > -0.000001) {\n disc = 0;\n }\n\n if (disc < 0) {\n return [];\n }\n\n // if disc == 0 ... dealt with later\n var tmpSqrt = sqrt(disc);\n var abScalingFactor1 = -pBy2 + tmpSqrt;\n var abScalingFactor2 = -pBy2 - tmpSqrt;\n\n var i1 = {\n x: s1.x - baX * abScalingFactor1,\n y: s1.y - baY * abScalingFactor1\n };\n\n if (disc === 0) { // abScalingFactor1 == abScalingFactor2\n return [ i1 ];\n }\n\n var i2 = {\n x: s1.x - baX * abScalingFactor2,\n y: s1.y - baY * abScalingFactor2\n };\n\n // return only points on line segment\n return [ i1, i2 ].filter(function(p) {\n return isPointInSegment(p, s1, s2);\n });\n}\n\n\nfunction isPointInSegment(p, segmentStart, segmentEnd) {\n return (\n fenced(p.x, segmentStart.x, segmentEnd.x) &&\n fenced(p.y, segmentStart.y, segmentEnd.y)\n );\n}\n\nfunction fenced(n, rangeStart, rangeEnd) {\n\n // use matching threshold to work around\n // precisison errors in intersection computation\n\n return (\n n >= min(rangeStart, rangeEnd) - EQUAL_THRESHOLD &&\n n <= max(rangeStart, rangeEnd) + EQUAL_THRESHOLD\n );\n}\n\n/**\n * Calculate mid of two points.\n *\n * @param {Point} p1\n * @param {Point} p2\n *\n * @return {Point}\n */\nfunction mid(p1, p2) {\n\n return {\n x: (p1.x + p2.x) / 2,\n y: (p1.y + p2.y) / 2\n };\n}\n\nvar EQUAL_THRESHOLD = 0.1;\n\nfunction pointsEqual(p1, p2) {\n\n return (\n abs(p1.x - p2.x) <= EQUAL_THRESHOLD &&\n abs(p1.y - p2.y) <= EQUAL_THRESHOLD\n );\n}\n","'use strict';\n\n/**\n * Returns the intersection between two line segments a and b.\n *\n * @param {Point} l1s\n * @param {Point} l1e\n * @param {Point} l2s\n * @param {Point} l2e\n *\n * @return {Point}\n */\nmodule.exports = function lineIntersect(l1s, l1e, l2s, l2e) {\n // if the lines intersect, the result contains the x and y of the\n // intersection (treating the lines as infinite) and booleans for\n // whether line segment 1 or line segment 2 contain the point\n var denominator, a, b, c, numerator;\n\n denominator = ((l2e.y - l2s.y) * (l1e.x - l1s.x)) - ((l2e.x - l2s.x) * (l1e.y - l1s.y));\n\n if (denominator == 0) {\n return null;\n }\n\n a = l1s.y - l2s.y;\n b = l1s.x - l2s.x;\n numerator = ((l2e.x - l2s.x) * a) - ((l2e.y - l2s.y) * b);\n\n c = numerator / denominator;\n\n // if we cast these lines infinitely in\n // both directions, they intersect here\n return {\n x: Math.round(l1s.x + (c * (l1e.x - l1s.x))),\n y: Math.round(l1s.y + (c * (l1e.y - l1s.y)))\n };\n};","'use strict';\n\nvar filter = require(301);\n\nvar Elements = require(266);\n\nvar getLanesRoot = require(67).getLanesRoot,\n getChildLanes = require(67).getChildLanes,\n LANE_INDENTATION = require(67).LANE_INDENTATION;\n\n/**\n * A handler that allows us to add a new lane\n * above or below an existing one.\n *\n * @param {Modeling} modeling\n */\nfunction AddLaneHandler(modeling, spaceTool) {\n this._modeling = modeling;\n this._spaceTool = spaceTool;\n}\n\nAddLaneHandler.$inject = [ 'modeling', 'spaceTool' ];\n\nmodule.exports = AddLaneHandler;\n\n\nAddLaneHandler.prototype.preExecute = function(context) {\n\n var spaceTool = this._spaceTool,\n modeling = this._modeling;\n\n var shape = context.shape,\n location = context.location;\n\n var lanesRoot = getLanesRoot(shape);\n\n var isRoot = lanesRoot === shape,\n laneParent = isRoot ? shape : shape.parent;\n\n var existingChildLanes = getChildLanes(laneParent);\n\n // (0) add a lane if we currently got none and are adding to root\n if (!existingChildLanes.length) {\n modeling.createShape({ type: 'bpmn:Lane' }, {\n x: shape.x + LANE_INDENTATION,\n y: shape.y,\n width: shape.width - LANE_INDENTATION,\n height: shape.height\n }, laneParent);\n }\n\n // (1) collect affected elements to create necessary space\n var allAffected = [];\n\n Elements.eachElement(lanesRoot, function(element) {\n allAffected.push(element);\n\n if (element === shape) {\n return [];\n }\n\n return filter(element.children, function(c) {\n return c !== shape;\n });\n });\n\n var offset = location === 'top' ? -120 : 120,\n lanePosition = location === 'top' ? shape.y : shape.y + shape.height,\n spacePos = lanePosition + (location === 'top' ? 10 : -10),\n direction = location === 'top' ? 'n' : 's';\n\n var adjustments = spaceTool.calculateAdjustments(allAffected, 'y', offset, spacePos);\n\n spaceTool.makeSpace(adjustments.movingShapes, adjustments.resizingShapes, { x: 0, y: offset }, direction);\n\n // (2) create new lane at open space\n context.newLane = modeling.createShape({ type: 'bpmn:Lane' }, {\n x: shape.x + (isRoot ? LANE_INDENTATION : 0),\n y: lanePosition - (location === 'top' ? 120 : 0),\n width: shape.width - (isRoot ? LANE_INDENTATION : 0),\n height: 120\n }, laneParent);\n};\n","'use strict';\n\n\nfunction IdClaimHandler(moddle) {\n this._moddle = moddle;\n}\n\nIdClaimHandler.$inject = [ 'moddle' ];\n\nmodule.exports = IdClaimHandler;\n\n\nIdClaimHandler.prototype.execute = function(context) {\n var ids = this._moddle.ids,\n id = context.id,\n element = context.element,\n claiming = context.claiming;\n\n if (claiming) {\n ids.claim(id, element);\n } else {\n ids.unclaim(id);\n }\n};\n\n/**\n * Command revert implementation.\n */\nIdClaimHandler.prototype.revert = function(context) {\n var ids = this._moddle.ids,\n id = context.id,\n element = context.element,\n claiming = context.claiming;\n\n if (claiming) {\n ids.unclaim(id);\n } else {\n ids.claim(id, element);\n }\n};\n\n","'use strict';\n\nvar is = require(95).is;\n\nvar getLanesRoot = require(67).getLanesRoot,\n computeLanesResize = require(67).computeLanesResize;\n\nvar eachElement = require(266).eachElement;\n\nvar asTRBL = require(252).asTRBL,\n substractTRBL = require(223).substractTRBL;\n\n\n/**\n * A handler that resizes a lane.\n *\n * @param {Modeling} modeling\n */\nfunction ResizeLaneHandler(modeling, spaceTool) {\n this._modeling = modeling;\n this._spaceTool = spaceTool;\n}\n\nResizeLaneHandler.$inject = [ 'modeling', 'spaceTool' ];\n\nmodule.exports = ResizeLaneHandler;\n\n\nResizeLaneHandler.prototype.preExecute = function(context) {\n\n var shape = context.shape,\n newBounds = context.newBounds,\n balanced = context.balanced;\n\n if (balanced !== false) {\n this.resizeBalanced(shape, newBounds);\n } else {\n this.resizeSpace(shape, newBounds);\n }\n};\n\n\n/**\n * Resize balanced, adjusting next / previous lane sizes.\n *\n * @param {djs.model.Shape} shape\n * @param {Bounds} newBounds\n */\nResizeLaneHandler.prototype.resizeBalanced = function(shape, newBounds) {\n\n var modeling = this._modeling;\n\n var resizeNeeded = computeLanesResize(shape, newBounds);\n\n // resize the lane\n modeling.resizeShape(shape, newBounds);\n\n // resize other lanes as needed\n resizeNeeded.forEach(function(r) {\n modeling.resizeShape(r.shape, r.newBounds);\n });\n};\n\n\n/**\n * Resize, making actual space and moving below / above elements.\n *\n * @param {djs.model.Shape} shape\n * @param {Bounds} newBounds\n */\nResizeLaneHandler.prototype.resizeSpace = function(shape, newBounds) {\n var spaceTool = this._spaceTool;\n\n var shapeTrbl = asTRBL(shape),\n newTrbl = asTRBL(newBounds);\n\n var trblDiff = substractTRBL(newTrbl, shapeTrbl);\n\n var lanesRoot = getLanesRoot(shape);\n\n var allAffected = [],\n allLanes = [];\n\n eachElement(lanesRoot, function(element) {\n allAffected.push(element);\n\n if (is(element, 'bpmn:Lane') || is(element, 'bpmn:Participant')) {\n allLanes.push(element);\n }\n\n return element.children;\n });\n\n var change,\n spacePos,\n direction,\n offset,\n adjustments;\n\n if (trblDiff.bottom || trblDiff.top) {\n\n change = trblDiff.bottom || trblDiff.top;\n spacePos = shape.y + (trblDiff.bottom ? shape.height : 0) + (trblDiff.bottom ? -10 : 10);\n direction = trblDiff.bottom ? 's' : 'n';\n\n offset = trblDiff.top > 0 || trblDiff.bottom < 0 ? -change : change;\n\n adjustments = spaceTool.calculateAdjustments(allAffected, 'y', offset, spacePos);\n\n spaceTool.makeSpace(adjustments.movingShapes, adjustments.resizingShapes, { x: 0, y: change }, direction);\n }\n\n\n if (trblDiff.left || trblDiff.right) {\n\n change = trblDiff.right || trblDiff.left;\n spacePos = shape.x + (trblDiff.right ? shape.width : 0) + (trblDiff.right ? -10 : 100);\n direction = trblDiff.right ? 'e' : 'w';\n\n offset = trblDiff.left > 0 || trblDiff.right < 0 ? -change : change;\n\n adjustments = spaceTool.calculateAdjustments(allLanes, 'x', offset, spacePos);\n\n spaceTool.makeSpace(adjustments.movingShapes, adjustments.resizingShapes, { x: change, y: 0 }, direction);\n }\n};","'use strict';\r\n\r\nvar assign = require(431),\r\n forEach = require(303);\r\n\r\nfunction SetColorHandler(commandStack) {\r\n this._commandStack = commandStack;\r\n}\r\n\r\nSetColorHandler.$inject = [ 'commandStack' ];\r\n\r\nmodule.exports = SetColorHandler;\r\n\r\nSetColorHandler.prototype.postExecute = function(context) {\r\n var elements = context.elements,\r\n colors = context.colors || { fill: undefined, stroke: undefined };\r\n\r\n var that = this;\r\n\r\n var di = {};\r\n\r\n if ('fill' in colors) {\r\n assign(di, { fill: colors.fill });\r\n }\r\n\r\n if ('stroke' in colors) {\r\n assign(di, { stroke: colors.stroke });\r\n }\r\n\r\n forEach(elements, function(element) {\r\n that._commandStack.execute('element.updateProperties', {\r\n element: element,\r\n properties: {\r\n di: di\r\n }\r\n });\r\n });\r\n\r\n};\r\n\r\nSetColorHandler.prototype.execute = function(context) {};\r\n\r\nSetColorHandler.prototype.revert = function(context) {};\r\n","'use strict';\n\nvar getChildLanes = require(67).getChildLanes;\n\nvar LANE_INDENTATION = require(67).LANE_INDENTATION;\n\n/**\n * A handler that splits a lane into a number of sub-lanes,\n * creating new sub lanes, if neccessary.\n *\n * @param {Modeling} modeling\n */\nfunction SplitLaneHandler(modeling, translate) {\n this._modeling = modeling;\n this._translate = translate;\n}\n\nSplitLaneHandler.$inject = [ 'modeling', 'translate'];\n\nmodule.exports = SplitLaneHandler;\n\n\nSplitLaneHandler.prototype.preExecute = function(context) {\n\n var modeling = this._modeling,\n translate = this._translate;\n\n var shape = context.shape,\n newLanesCount = context.count;\n\n var childLanes = getChildLanes(shape),\n existingLanesCount = childLanes.length;\n\n if (existingLanesCount > newLanesCount) {\n throw new Error(translate('more than {count} child lanes', { count: newLanesCount }));\n }\n\n var newLanesHeight = Math.round(shape.height / newLanesCount);\n\n // Iterate from top to bottom in child lane order,\n // resizing existing lanes and creating new ones\n // so that they split the parent proportionally.\n //\n // Due to rounding related errors, the bottom lane\n // needs to take up all the remaining space.\n var laneY,\n laneHeight,\n laneBounds,\n newLaneAttrs,\n idx;\n\n for (idx = 0; idx < newLanesCount; idx++) {\n\n laneY = shape.y + idx * newLanesHeight;\n\n // if bottom lane\n if (idx === newLanesCount - 1) {\n laneHeight = shape.height - (newLanesHeight * idx);\n } else {\n laneHeight = newLanesHeight;\n }\n\n laneBounds = {\n x: shape.x + LANE_INDENTATION,\n y: laneY,\n width: shape.width - LANE_INDENTATION,\n height: laneHeight\n };\n\n if (idx < existingLanesCount) {\n // resize existing lane\n modeling.resizeShape(childLanes[idx], laneBounds);\n } else {\n // create a new lane at position\n newLaneAttrs = {\n type: 'bpmn:Lane'\n };\n\n modeling.createShape(newLaneAttrs, laneBounds, shape);\n }\n }\n};\n","'use strict';\n\nvar Collections = require(263);\n\n\nfunction UpdateCanvasRootHandler(canvas, modeling) {\n this._canvas = canvas;\n this._modeling = modeling;\n}\n\nUpdateCanvasRootHandler.$inject = [ 'canvas', 'modeling' ];\n\nmodule.exports = UpdateCanvasRootHandler;\n\n\nUpdateCanvasRootHandler.prototype.execute = function(context) {\n\n var canvas = this._canvas;\n\n var newRoot = context.newRoot,\n newRootBusinessObject = newRoot.businessObject,\n oldRoot = canvas.getRootElement(),\n oldRootBusinessObject = oldRoot.businessObject,\n bpmnDefinitions = oldRootBusinessObject.$parent,\n diPlane = oldRootBusinessObject.di;\n\n // (1) replace process old <> new root\n canvas.setRootElement(newRoot, true);\n\n // (2) update root elements\n Collections.add(bpmnDefinitions.rootElements, newRootBusinessObject);\n newRootBusinessObject.$parent = bpmnDefinitions;\n\n Collections.remove(bpmnDefinitions.rootElements, oldRootBusinessObject);\n oldRootBusinessObject.$parent = null;\n\n // (3) wire di\n oldRootBusinessObject.di = null;\n\n diPlane.bpmnElement = newRootBusinessObject;\n newRootBusinessObject.di = diPlane;\n\n context.oldRoot = oldRoot;\n\n // TODO(nikku): return changed elements?\n // return [ newRoot, oldRoot ];\n};\n\n\nUpdateCanvasRootHandler.prototype.revert = function(context) {\n\n var canvas = this._canvas;\n\n var newRoot = context.newRoot,\n newRootBusinessObject = newRoot.businessObject,\n oldRoot = context.oldRoot,\n oldRootBusinessObject = oldRoot.businessObject,\n bpmnDefinitions = newRootBusinessObject.$parent,\n diPlane = newRootBusinessObject.di;\n\n // (1) replace process old <> new root\n canvas.setRootElement(oldRoot, true);\n\n // (2) update root elements\n Collections.remove(bpmnDefinitions.rootElements, newRootBusinessObject);\n newRootBusinessObject.$parent = null;\n\n Collections.add(bpmnDefinitions.rootElements, oldRootBusinessObject);\n oldRootBusinessObject.$parent = bpmnDefinitions;\n\n // (3) wire di\n newRootBusinessObject.di = null;\n\n diPlane.bpmnElement = oldRootBusinessObject;\n oldRootBusinessObject.di = diPlane;\n\n // TODO(nikku): return changed elements?\n // return [ newRoot, oldRoot ];\n};","'use strict';\n\nvar collectLanes = require(67).collectLanes;\n\nvar getLanesRoot = require(67).getLanesRoot;\n\nvar is = require(95).is;\n\nvar Collections = require(263);\n\nvar asTRBL = require(252).asTRBL;\n\nvar FLOW_NODE_REFS_ATTR = 'flowNodeRef',\n LANES_ATTR = 'lanes';\n\n/**\n * A handler that updates lane refs on changed elements\n */\nfunction UpdateFlowNodeRefsHandler(elementRegistry) {\n this._elementRegistry = elementRegistry;\n}\n\nUpdateFlowNodeRefsHandler.$inject = [ 'elementRegistry' ];\n\nmodule.exports = UpdateFlowNodeRefsHandler;\n\n\nUpdateFlowNodeRefsHandler.prototype.computeUpdates = function(flowNodeShapes, laneShapes) {\n\n var handledNodes = {};\n\n var updates = [];\n\n var participantCache = {};\n\n var allFlowNodeShapes = [];\n\n function isInLaneShape(element, laneShape) {\n\n var laneTrbl = asTRBL(laneShape);\n\n var elementMid = {\n x: element.x + element.width / 2,\n y: element.y + element.height / 2\n };\n\n return elementMid.x > laneTrbl.left &&\n elementMid.x < laneTrbl.right &&\n elementMid.y > laneTrbl.top &&\n elementMid.y < laneTrbl.bottom;\n }\n\n function addFlowNodeShape(flowNodeShape) {\n if (!handledNodes[flowNodeShape.id]) {\n allFlowNodeShapes.push(flowNodeShape);\n handledNodes[flowNodeShape.id] = flowNodeShape;\n }\n }\n\n function getAllLaneShapes(flowNodeShape) {\n\n var root = getLanesRoot(flowNodeShape);\n\n if (!participantCache[root.id]) {\n participantCache[root.id] = collectLanes(root);\n }\n\n return participantCache[root.id];\n }\n\n function getNewLanes(flowNodeShape) {\n if (!flowNodeShape.parent) {\n return [];\n }\n\n var allLaneShapes = getAllLaneShapes(flowNodeShape);\n\n return allLaneShapes.filter(function(l) {\n return isInLaneShape(flowNodeShape, l);\n }).map(function(shape) {\n return shape.businessObject;\n });\n }\n\n laneShapes.forEach(function(laneShape) {\n var root = getLanesRoot(laneShape);\n\n if (!root || handledNodes[root.id]) {\n return;\n }\n\n var children = root.children.filter(function(c) {\n return is(c, 'bpmn:FlowNode');\n });\n\n children.forEach(addFlowNodeShape);\n\n handledNodes[root.id] = root;\n });\n\n flowNodeShapes.forEach(addFlowNodeShape);\n\n\n allFlowNodeShapes.forEach(function(flowNodeShape) {\n\n var flowNode = flowNodeShape.businessObject;\n\n var lanes = flowNode.get(LANES_ATTR),\n remove = lanes.slice(),\n add = getNewLanes(flowNodeShape);\n\n updates.push({ flowNode: flowNode, remove: remove, add: add });\n });\n\n laneShapes.forEach(function(laneShape) {\n\n var lane = laneShape.businessObject;\n\n // lane got removed XX-)\n if (!laneShape.parent) {\n lane.get(FLOW_NODE_REFS_ATTR).forEach(function(flowNode) {\n updates.push({ flowNode: flowNode, remove: [ lane ], add: [] });\n });\n }\n });\n\n return updates;\n};\n\nUpdateFlowNodeRefsHandler.prototype.execute = function(context) {\n\n var updates = context.updates;\n\n if (!updates) {\n updates = context.updates = this.computeUpdates(context.flowNodeShapes, context.laneShapes);\n }\n\n\n updates.forEach(function(update) {\n\n var flowNode = update.flowNode,\n lanes = flowNode.get(LANES_ATTR);\n\n // unwire old\n update.remove.forEach(function(oldLane) {\n Collections.remove(lanes, oldLane);\n Collections.remove(oldLane.get(FLOW_NODE_REFS_ATTR), flowNode);\n });\n\n // wire new\n update.add.forEach(function(newLane) {\n Collections.add(lanes, newLane);\n Collections.add(newLane.get(FLOW_NODE_REFS_ATTR), flowNode);\n });\n });\n\n // TODO(nikku): return changed elements\n // return [ ... ];\n};\n\n\nUpdateFlowNodeRefsHandler.prototype.revert = function(context) {\n\n var updates = context.updates;\n\n updates.forEach(function(update) {\n\n var flowNode = update.flowNode,\n lanes = flowNode.get(LANES_ATTR);\n\n // unwire new\n update.add.forEach(function(newLane) {\n Collections.remove(lanes, newLane);\n Collections.remove(newLane.get(FLOW_NODE_REFS_ATTR), flowNode);\n });\n\n // wire old\n update.remove.forEach(function(oldLane) {\n Collections.add(lanes, oldLane);\n Collections.add(oldLane.get(FLOW_NODE_REFS_ATTR), flowNode);\n });\n });\n\n // TODO(nikku): return changed elements\n // return [ ... ];\n};","'use strict';\n\nvar reduce = require(439),\n keys = require(433),\n forEach = require(303),\n assign = require(431);\n\nvar getBusinessObject = require(95).getBusinessObject;\n\nvar TextUtil = require(280);\n\nvar DEFAULT_FLOW = 'default',\n NAME = 'name',\n ID = 'id',\n DI = 'di';\n\nvar NULL_DIMENSIONS = {\n width: 0,\n height: 0\n};\n\n/**\n * A handler that implements a BPMN 2.0 property update.\n *\n * This should be used to set simple properties on elements with\n * an underlying BPMN business object.\n *\n * Use respective diagram-js provided handlers if you would\n * like to perform automated modeling.\n */\nfunction UpdatePropertiesHandler(elementRegistry, moddle, translate, modeling) {\n this._elementRegistry = elementRegistry;\n this._moddle = moddle;\n this._translate = translate;\n this._modeling = modeling;\n\n this._textUtil = new TextUtil();\n}\n\nUpdatePropertiesHandler.$inject = [ 'elementRegistry', 'moddle', 'translate', 'modeling' ];\n\nmodule.exports = UpdatePropertiesHandler;\n\n\n////// api /////////////////////////////////////////////\n\n/**\n * Updates a BPMN element with a list of new properties\n *\n * @param {Object} context\n * @param {djs.model.Base} context.element the element to update\n * @param {Object} context.properties a list of properties to set on the element's\n * businessObject (the BPMN model element)\n *\n * @return {Array} the updated element\n */\nUpdatePropertiesHandler.prototype.execute = function(context) {\n\n var element = context.element,\n changed = [ element ],\n translate = this._translate;\n\n if (!element) {\n throw new Error(translate('element required'));\n }\n\n var elementRegistry = this._elementRegistry,\n ids = this._moddle.ids;\n\n var businessObject = element.businessObject,\n properties = unwrapBusinessObjects(context.properties),\n oldProperties = context.oldProperties || getProperties(businessObject, properties);\n\n if (isIdChange(properties, businessObject)) {\n ids.unclaim(businessObject[ID]);\n\n elementRegistry.updateId(element, properties[ID]);\n\n ids.claim(properties[ID], businessObject);\n }\n\n // correctly indicate visual changes on default flow updates\n if (DEFAULT_FLOW in properties) {\n\n if (properties[DEFAULT_FLOW]) {\n changed.push(elementRegistry.get(properties[DEFAULT_FLOW].id));\n }\n\n if (businessObject[DEFAULT_FLOW]) {\n changed.push(elementRegistry.get(businessObject[DEFAULT_FLOW].id));\n }\n }\n\n if (NAME in properties && element.label) {\n changed.push(element.label);\n\n // show the label\n element.label.hidden = !properties[NAME];\n }\n\n if (DI in properties && businessObject.di) {\n setDiProperties(businessObject.di, properties.di);\n }\n\n // update properties\n setProperties(businessObject, properties);\n\n // store old values\n context.oldProperties = oldProperties;\n context.changed = changed;\n\n // indicate changed on objects affected by the update\n return changed;\n};\n\n\nUpdatePropertiesHandler.prototype.postExecute = function(context) {\n var element = context.element,\n label = element.label;\n\n var text = label && getBusinessObject(label).name;\n\n if (!text) {\n return;\n }\n\n // get layouted text bounds and resize external\n // external label accordingly\n var newLabelBounds = getLayoutedBounds(label, text, this._textUtil);\n\n this._modeling.resizeShape(label, newLabelBounds, NULL_DIMENSIONS);\n};\n\n/**\n * Reverts the update on a BPMN elements properties.\n *\n * @param {Object} context\n *\n * @return {djs.model.Base} the updated element\n */\nUpdatePropertiesHandler.prototype.revert = function(context) {\n\n var element = context.element,\n properties = context.properties,\n oldProperties = context.oldProperties,\n businessObject = element.businessObject,\n elementRegistry = this._elementRegistry,\n ids = this._moddle.ids;\n\n if (DI in oldProperties && businessObject.di) {\n setDiProperties(businessObject.di, oldProperties.di);\n }\n\n // update properties\n setProperties(businessObject, oldProperties);\n\n if (isIdChange(properties, businessObject)) {\n ids.unclaim(properties[ID]);\n\n elementRegistry.updateId(element, oldProperties[ID]);\n\n ids.claim(oldProperties[ID], businessObject);\n }\n\n return context.changed;\n};\n\n\nfunction isIdChange(properties, businessObject) {\n return ID in properties && properties[ID] !== businessObject[ID];\n}\n\n\nfunction getProperties(businessObject, properties) {\n var propertyNames = keys(properties);\n\n return reduce(propertyNames, function(result, key) {\n\n // handle DI seperately\n if (key !== DI) {\n result[key] = businessObject.get(key);\n } else {\n result[key] = getDiProperties(businessObject.di, keys(properties.di));\n }\n\n return result;\n }, {});\n}\n\n\nfunction getDiProperties(di, propertyNames) {\n return reduce(propertyNames, function(result, key) {\n result[key] = di.get(key);\n\n return result;\n }, {});\n}\n\n\nfunction setProperties(businessObject, properties) {\n forEach(properties, function(value, key) {\n businessObject.set(key, value);\n });\n}\n\n\nfunction setDiProperties(di, properties) {\n forEach(properties, function(value, key) {\n di.set(key, value);\n });\n}\n\n\nvar referencePropertyNames = [ 'default' ];\n\n/**\n * Make sure we unwrap the actual business object\n * behind diagram element that may have been\n * passed as arguments.\n *\n * @param {Object} properties\n *\n * @return {Object} unwrappedProps\n */\nfunction unwrapBusinessObjects(properties) {\n\n var unwrappedProps = assign({}, properties);\n\n referencePropertyNames.forEach(function(name) {\n if (name in properties) {\n unwrappedProps[name] = getBusinessObject(unwrappedProps[name]);\n }\n });\n\n return unwrappedProps;\n}\n\n\n// TODO(nikku): repeating code (search for )\n\nvar EXTERNAL_LABEL_STYLE = {\n fontFamily: 'Arial, sans-serif',\n fontSize: '11px'\n};\n\nfunction getLayoutedBounds(bounds, text, textUtil) {\n\n var layoutedLabelDimensions = textUtil.getDimensions(text, {\n box: {\n width: 90,\n height: 30,\n x: bounds.width / 2 + bounds.x,\n y: bounds.height / 2 + bounds.y\n },\n style: EXTERNAL_LABEL_STYLE\n });\n\n // resize label shape to fit label text\n return {\n x: Math.round(bounds.x + bounds.width / 2 - layoutedLabelDimensions.width / 2),\n y: Math.round(bounds.y),\n width: Math.ceil(layoutedLabelDimensions.width),\n height: Math.ceil(layoutedLabelDimensions.height)\n };\n}","module.exports = {\n __init__: [ 'modeling', 'bpmnUpdater' ],\n __depends__: [\n require(53),\n require(27),\n require(82),\n require(70),\n require(80),\n require(121),\n require(244),\n require(174),\n require(135),\n require(233),\n require(147),\n require(240)\n ],\n bpmnFactory: [ 'type', require(28) ],\n bpmnUpdater: [ 'type', require(30) ],\n elementFactory: [ 'type', require(31) ],\n modeling: [ 'type', require(32) ],\n layouter: [ 'type', require(29) ],\n connectionDocking: [ 'type', require(251) ]\n};\n","'use strict';\n\nvar is = require(95).is;\n\nvar getParent = require(68).getParent;\n\nvar asTRBL = require(252).asTRBL,\n substractTRBL = require(223).substractTRBL,\n resizeTRBL = require(223).resizeTRBL;\n\nvar abs = Math.abs;\n\n\nfunction getTRBLResize(oldBounds, newBounds) {\n return substractTRBL(asTRBL(newBounds), asTRBL(oldBounds));\n}\n\n\nvar LANE_PARENTS = [\n 'bpmn:Participant',\n 'bpmn:Process',\n 'bpmn:SubProcess'\n];\n\nvar LANE_INDENTATION = 30;\n\nmodule.exports.LANE_INDENTATION = LANE_INDENTATION;\n\n\n/**\n * Collect all lane shapes in the given paren\n *\n * @param {djs.model.Shape} shape\n * @param {Array} [collectedShapes]\n *\n * @return {Array}\n */\nfunction collectLanes(shape, collectedShapes) {\n\n collectedShapes = collectedShapes || [];\n\n shape.children.filter(function(s) {\n if (is(s, 'bpmn:Lane')) {\n collectLanes(s, collectedShapes);\n\n collectedShapes.push(s);\n }\n });\n\n return collectedShapes;\n}\n\nmodule.exports.collectLanes = collectLanes;\n\n/**\n * Return the lane children of the given element.\n *\n * @param {djs.model.Shape} shape\n *\n * @return {Array}\n */\nfunction getChildLanes(shape) {\n return shape.children.filter(function(c) {\n return is(c, 'bpmn:Lane');\n });\n}\n\nmodule.exports.getChildLanes = getChildLanes;\n\n/**\n * Return the root element containing the given lane shape\n *\n * @param {djs.model.Shape} shape\n *\n * @return {djs.model.Shape}\n */\nfunction getLanesRoot(shape) {\n return getParent(shape, LANE_PARENTS) || shape;\n}\n\nmodule.exports.getLanesRoot = getLanesRoot;\n\n\n/**\n * Compute the required resize operations for lanes\n * adjacent to the given shape, assuming it will be\n * resized to the given new bounds.\n *\n * @param {djs.model.Shape} shape\n * @param {Bounds} newBounds\n *\n * @return {Array}\n */\nfunction computeLanesResize(shape, newBounds) {\n\n var rootElement = getLanesRoot(shape);\n\n var initialShapes = is(rootElement, 'bpmn:Process') ? [] : [ rootElement ];\n\n var allLanes = collectLanes(rootElement, initialShapes),\n shapeTrbl = asTRBL(shape),\n shapeNewTrbl = asTRBL(newBounds),\n trblResize = getTRBLResize(shape, newBounds),\n resizeNeeded = [];\n\n allLanes.forEach(function(other) {\n\n if (other === shape) {\n return;\n }\n\n var topResize = 0,\n rightResize = trblResize.right,\n bottomResize = 0,\n leftResize = trblResize.left;\n\n var otherTrbl = asTRBL(other);\n\n if (trblResize.top) {\n if (abs(otherTrbl.bottom - shapeTrbl.top) < 10) {\n bottomResize = shapeNewTrbl.top - otherTrbl.bottom;\n }\n\n if (abs(otherTrbl.top - shapeTrbl.top) < 5) {\n topResize = shapeNewTrbl.top - otherTrbl.top;\n }\n }\n\n if (trblResize.bottom) {\n if (abs(otherTrbl.top - shapeTrbl.bottom) < 10) {\n topResize = shapeNewTrbl.bottom - otherTrbl.top;\n }\n\n if (abs(otherTrbl.bottom - shapeTrbl.bottom) < 5) {\n bottomResize = shapeNewTrbl.bottom - otherTrbl.bottom;\n }\n }\n\n if (topResize || rightResize || bottomResize || leftResize) {\n\n resizeNeeded.push({\n shape: other,\n newBounds: resizeTRBL(other, {\n top: topResize,\n right: rightResize,\n bottom: bottomResize,\n left: leftResize\n })\n });\n }\n\n });\n\n return resizeNeeded;\n}\n\nmodule.exports.computeLanesResize = computeLanesResize;\n","'use strict';\n\nvar any = require(299);\n\nvar is = require(95).is;\n\n\n/**\n * Return true if element has any of the given types.\n *\n * @param {djs.model.Base} element\n * @param {Array} types\n *\n * @return {Boolean}\n */\nfunction isAny(element, types) {\n return any(types, function(t) {\n return is(element, t);\n });\n}\n\nmodule.exports.isAny = isAny;\n\n\n/**\n * Return the parent of the element with any of the given types.\n *\n * @param {djs.model.Base} element\n * @param {String|Array} anyType\n *\n * @return {djs.model.Base}\n */\nfunction getParent(element, anyType) {\n\n if (typeof anyType === 'string') {\n anyType = [ anyType ];\n }\n\n while ((element = element.parent)) {\n if (isAny(element, anyType)) {\n return element;\n }\n }\n\n return null;\n}\n\nmodule.exports.getParent = getParent;\n","'use strict';\n\nvar inherits = require(289);\n\nvar OrderingProvider = require(207);\n\nvar isAny = require(68).isAny;\n\nvar findIndex = require(290);\n\nvar find = require(302);\n\n\n/**\n * a simple ordering provider that makes sure:\n *\n * (1) elements are ordered by a {level} property\n * (2) elements with {alwaysOnTop} are always added to the root\n */\nfunction BpmnOrderingProvider(eventBus, translate) {\n\n OrderingProvider.call(this, eventBus);\n\n var orders = [\n { type: 'bpmn:SubProcess', order: { level: 6 } },\n {\n type: 'bpmn:SequenceFlow',\n order: {\n level: 5,\n containers: [\n 'bpmn:Participant',\n 'bpmn:FlowElementsContainer'\n ]\n }\n },\n // handle DataAssociation(s) like message flows and render them always on top\n { type: 'bpmn:DataAssociation', order: { level: 9, containers: [ 'bpmn:Collaboration', 'bpmn:Process' ] } },\n { type: 'bpmn:MessageFlow', order: { level: 9, containers: [ 'bpmn:Collaboration' ] } },\n {\n type: 'bpmn:Association',\n order: {\n level: 6,\n containers: [\n 'bpmn:Participant',\n 'bpmn:FlowElementsContainer',\n 'bpmn:Collaboration'\n ]\n }\n },\n { type: 'bpmn:BoundaryEvent', order: { level: 8 } },\n { type: 'bpmn:Participant', order: { level: -2 } },\n { type: 'bpmn:Lane', order: { level: -1 } }\n ];\n\n function computeOrder(element) {\n if (element.labelTarget) {\n return { level: 10 };\n }\n\n var entry = find(orders, function(o) {\n return isAny(element, [ o.type ]);\n });\n\n return entry && entry.order || { level: 1 };\n }\n\n function getOrder(element) {\n\n var order = element.order;\n\n if (!order) {\n element.order = order = computeOrder(element);\n }\n\n return order;\n }\n\n function findActualParent(element, newParent, containers) {\n\n var actualParent = newParent;\n\n while (actualParent) {\n\n if (isAny(actualParent, containers)) {\n break;\n }\n\n actualParent = actualParent.parent;\n }\n\n if (!actualParent) {\n throw new Error(translate('no parent for {element} in {parent}', {\n element: element.id,\n parent: newParent.id\n }));\n }\n\n return actualParent;\n }\n\n this.getOrdering = function(element, newParent) {\n\n var elementOrder = getOrder(element);\n\n\n if (elementOrder.containers) {\n newParent = findActualParent(element, newParent, elementOrder.containers);\n }\n\n\n var currentIndex = newParent.children.indexOf(element);\n\n var insertIndex = findIndex(newParent.children, function(child) {\n\n // do not compare with labels, they are created\n // in the wrong order (right after elements) during import and\n // mess up the positioning.\n if (!element.labelTarget && child.labelTarget) {\n return false;\n }\n\n return elementOrder.level < getOrder(child).level;\n });\n\n\n // if the element is already in the child list at\n // a smaller index, we need to adjust the inser index.\n // this takes into account that the element is being removed\n // before being re-inserted\n if (insertIndex !== -1) {\n if (currentIndex !== -1 && currentIndex < insertIndex) {\n insertIndex -= 1;\n }\n }\n\n return {\n index: insertIndex,\n parent: newParent\n };\n };\n}\n\nBpmnOrderingProvider.$inject = [ 'eventBus', 'translate' ];\n\ninherits(BpmnOrderingProvider, OrderingProvider);\n\nmodule.exports = BpmnOrderingProvider;\n","module.exports = {\n __init__: [ 'bpmnOrderingProvider' ],\n __depends__: [\n require(248)\n ],\n bpmnOrderingProvider: [ 'type', require(69) ]\n};","'use strict';\n\nvar assign = require(431);\n\n/**\n * A palette provider for BPMN 2.0 elements.\n */\nfunction PaletteProvider(palette, create, elementFactory, spaceTool, lassoTool, handTool, globalConnect, translate) {\n\n this._palette = palette;\n this._create = create;\n this._elementFactory = elementFactory;\n this._spaceTool = spaceTool;\n this._lassoTool = lassoTool;\n this._handTool = handTool;\n this._globalConnect = globalConnect;\n this._translate = translate;\n\n palette.registerProvider(this);\n}\n\nmodule.exports = PaletteProvider;\n\nPaletteProvider.$inject = [\n 'palette',\n 'create',\n 'elementFactory',\n 'spaceTool',\n 'lassoTool',\n 'handTool',\n 'globalConnect',\n 'translate'\n];\n\n\nPaletteProvider.prototype.getPaletteEntries = function(element) {\n\n var actions = {},\n create = this._create,\n elementFactory = this._elementFactory,\n spaceTool = this._spaceTool,\n lassoTool = this._lassoTool,\n handTool = this._handTool,\n globalConnect = this._globalConnect,\n translate = this._translate;\n\n function createAction(type, group, className, title, options) {\n\n function createListener(event) {\n var shape = elementFactory.createShape(assign({ type: type }, options));\n\n if (options) {\n shape.businessObject.di.isExpanded = options.isExpanded;\n }\n\n create.start(event, shape);\n }\n\n var shortType = type.replace(/^bpmn/:/, '');\n\n return {\n group: group,\n className: className,\n title: title || translate('Create {type}', { type: shortType }),\n action: {\n dragstart: createListener,\n click: createListener\n }\n };\n }\n\n function createParticipant(event, collapsed) {\n create.start(event, elementFactory.createParticipantShape(collapsed));\n }\n\n assign(actions, {\n 'hand-tool': {\n group: 'tools',\n className: 'bpmn-icon-hand-tool',\n title: translate('Activate the hand tool'),\n action: {\n click: function(event) {\n handTool.activateHand(event);\n }\n }\n },\n 'lasso-tool': {\n group: 'tools',\n className: 'bpmn-icon-lasso-tool',\n title: translate('Activate the lasso tool'),\n action: {\n click: function(event) {\n lassoTool.activateSelection(event);\n }\n }\n },\n 'space-tool': {\n group: 'tools',\n className: 'bpmn-icon-space-tool',\n title: translate('Activate the create/remove space tool'),\n action: {\n click: function(event) {\n spaceTool.activateSelection(event);\n }\n }\n },\n 'global-connect-tool': {\n group: 'tools',\n className: 'bpmn-icon-connection-multi',\n title: translate('Activate the global connect tool'),\n action: {\n click: function(event) {\n globalConnect.toggle(event);\n }\n }\n },\n 'tool-separator': {\n group: 'tools',\n separator: true\n },\n 'create.start-event': createAction(\n 'bpmn:StartEvent', 'event', 'bpmn-icon-start-event-none'\n ),\n 'create.intermediate-event': createAction('bpmn:IntermediateThrowEvent', 'event',\n 'bpmn-icon-intermediate-event-none', translate('Create IntermediateThrowEvent/BoundaryEvent')\n ),\n 'create.end-event': createAction(\n 'bpmn:EndEvent', 'event', 'bpmn-icon-end-event-none'\n ),\n 'create.exclusive-gateway': createAction(\n 'bpmn:ExclusiveGateway', 'gateway', 'bpmn-icon-gateway-xor'\n ),\n 'create.task': createAction(\n 'bpmn:Task', 'activity', 'bpmn-icon-task'\n ),\n 'create.data-object': createAction(\n 'bpmn:DataObjectReference', 'data-object', 'bpmn-icon-data-object'\n ),\n 'create.data-store': createAction(\n 'bpmn:DataStoreReference', 'data-store', 'bpmn-icon-data-store'\n ),\n 'create.subprocess-expanded': createAction(\n 'bpmn:SubProcess', 'activity', 'bpmn-icon-subprocess-expanded', translate('Create expanded SubProcess'),\n { isExpanded: true }\n ),\n 'create.participant-expanded': {\n group: 'collaboration',\n className: 'bpmn-icon-participant',\n title: translate('Create Pool/Participant'),\n action: {\n dragstart: createParticipant,\n click: createParticipant\n }\n }\n });\n\n return actions;\n};\n","module.exports = {\n __depends__: [\n require(213),\n require(157),\n require(240),\n require(176),\n require(168),\n require(248),\n require(20)\n ],\n __init__: [ 'paletteProvider' ],\n paletteProvider: [ 'type', require(71) ]\n};\n","'use strict';\n\nvar is = require(95).is,\n isEventSubProcess = require(93).isEventSubProcess,\n getBusinessObject = require(95).getBusinessObject,\n isExpanded = require(93).isExpanded,\n isDifferentType = require(75).isDifferentType;\n\nvar forEach = require(303),\n filter = require(301),\n reject = require(307);\n\nvar replaceOptions = require(79);\n\n\n/**\n * This module is an element agnostic replace menu provider for the popup menu.\n */\nfunction ReplaceMenuProvider(popupMenu, modeling, moddle, bpmnReplace, rules, translate) {\n\n this._popupMenu = popupMenu;\n this._modeling = modeling;\n this._moddle = moddle;\n this._bpmnReplace = bpmnReplace;\n this._rules = rules;\n this._translate = translate;\n\n this.register();\n}\n\nReplaceMenuProvider.$inject = [ 'popupMenu', 'modeling', 'moddle', 'bpmnReplace', 'rules', 'translate' ];\n\n\n/**\n * Register replace menu provider in the popup menu\n */\nReplaceMenuProvider.prototype.register = function() {\n this._popupMenu.registerProvider('bpmn-replace', this);\n};\n\n\n/**\n * Get all entries from replaceOptions for the given element and apply filters\n * on them. Get for example only elements, which are different from the current one.\n *\n * @param {djs.model.Base} element\n *\n * @return {Array} a list of menu entry items\n */\nReplaceMenuProvider.prototype.getEntries = function(element) {\n\n var businessObject = element.businessObject;\n\n var rules = this._rules;\n\n var entries;\n\n if (!rules.allowed('shape.replace', { element: element })) {\n return [];\n }\n\n var differentType = isDifferentType(element);\n\n // start events outside event sub processes\n if (is(businessObject, 'bpmn:StartEvent') && !isEventSubProcess(businessObject.$parent)) {\n\n entries = filter(replaceOptions.START_EVENT, differentType);\n\n return this._createEntries(element, entries);\n }\n\n // expanded/collapsed pools\n if (is(businessObject, 'bpmn:Participant')) {\n\n entries = filter(replaceOptions.PARTICIPANT, function(entry) {\n return isExpanded(businessObject) !== entry.target.isExpanded;\n });\n\n return this._createEntries(element, entries);\n }\n\n // start events inside event sub processes\n if (is(businessObject, 'bpmn:StartEvent') && isEventSubProcess(businessObject.$parent)) {\n\n entries = filter(replaceOptions.EVENT_SUB_PROCESS_START_EVENT, function(entry) {\n\n var target = entry.target;\n\n var isInterrupting = target.isInterrupting !== false;\n\n var isInterruptingEqual = getBusinessObject(element).isInterrupting === isInterrupting;\n\n // filters elements which types and event definition are equal but have have different interrupting types\n return differentType(entry) || !differentType(entry) && !isInterruptingEqual;\n\n });\n\n return this._createEntries(element, entries);\n }\n\n // end events\n if (is(businessObject, 'bpmn:EndEvent')) {\n\n entries = filter(replaceOptions.END_EVENT, function(entry) {\n var target = entry.target;\n\n // hide cancel end events outside transactions\n if (target.eventDefinitionType == 'bpmn:CancelEventDefinition' && !is(businessObject.$parent, 'bpmn:Transaction')) {\n return false;\n }\n\n return differentType(entry);\n });\n\n return this._createEntries(element, entries);\n }\n\n // boundary events\n if (is(businessObject, 'bpmn:BoundaryEvent')) {\n\n entries = filter(replaceOptions.BOUNDARY_EVENT, function(entry) {\n\n var target = entry.target;\n\n if (target.eventDefinition == 'bpmn:CancelEventDefinition' &&\n !is(businessObject.attachedToRef, 'bpmn:Transaction')) {\n return false;\n }\n var cancelActivity = target.cancelActivity !== false;\n\n var isCancelActivityEqual = businessObject.cancelActivity == cancelActivity;\n\n return differentType(entry) || !differentType(entry) && !isCancelActivityEqual;\n });\n\n return this._createEntries(element, entries);\n }\n\n // intermediate events\n if (is(businessObject, 'bpmn:IntermediateCatchEvent') ||\n is(businessObject, 'bpmn:IntermediateThrowEvent')) {\n\n entries = filter(replaceOptions.INTERMEDIATE_EVENT, differentType);\n\n return this._createEntries(element, entries);\n }\n\n // gateways\n if (is(businessObject, 'bpmn:Gateway')) {\n\n entries = filter(replaceOptions.GATEWAY, differentType);\n\n return this._createEntries(element, entries);\n }\n\n // transactions\n if (is(businessObject, 'bpmn:Transaction')) {\n\n entries = filter(replaceOptions.TRANSACTION, differentType);\n\n return this._createEntries(element, entries);\n }\n\n // expanded event sub processes\n if (isEventSubProcess(businessObject) && isExpanded(businessObject)) {\n\n entries = filter(replaceOptions.EVENT_SUB_PROCESS, differentType);\n\n return this._createEntries(element, entries);\n }\n\n // expanded sub processes\n if (is(businessObject, 'bpmn:SubProcess') && isExpanded(businessObject)) {\n\n entries = filter(replaceOptions.SUBPROCESS_EXPANDED, differentType);\n\n return this._createEntries(element, entries);\n }\n\n // collapsed ad hoc sub processes\n if (is(businessObject, 'bpmn:AdHocSubProcess') && !isExpanded(businessObject)) {\n\n entries = filter(replaceOptions.TASK, function(entry) {\n\n var target = entry.target;\n\n var isTargetSubProcess = target.type === 'bpmn:SubProcess';\n\n var isTargetExpanded = target.isExpanded === true;\n\n return isDifferentType(element, target) && ( !isTargetSubProcess || isTargetExpanded );\n });\n\n return this._createEntries(element, entries);\n }\n\n // sequence flows\n if (is(businessObject, 'bpmn:SequenceFlow')) {\n return this._createSequenceFlowEntries(element, replaceOptions.SEQUENCE_FLOW);\n }\n\n // flow nodes\n if (is(businessObject, 'bpmn:FlowNode')) {\n entries = filter(replaceOptions.TASK, differentType);\n\n // collapsed SubProcess can not be replaced with itself\n if (is(businessObject, 'bpmn:SubProcess') && !isExpanded(businessObject)) {\n entries = reject(entries, function(entry) {\n return entry.label === 'Sub Process (collapsed)';\n });\n }\n\n return this._createEntries(element, entries);\n }\n\n return [];\n};\n\n\n/**\n * Get a list of header items for the given element. This includes buttons\n * for multi instance markers and for the ad hoc marker.\n *\n * @param {djs.model.Base} element\n *\n * @return {Array} a list of menu entry items\n */\nReplaceMenuProvider.prototype.getHeaderEntries = function(element) {\n\n var headerEntries = [];\n\n if (is(element, 'bpmn:Activity') && !isEventSubProcess(element)) {\n headerEntries = headerEntries.concat(this._getLoopEntries(element));\n }\n\n if (is(element, 'bpmn:SubProcess') &&\n !is(element, 'bpmn:Transaction') &&\n !isEventSubProcess(element)) {\n headerEntries.push(this._getAdHocEntry(element));\n }\n\n return headerEntries;\n};\n\n\n/**\n * Creates an array of menu entry objects for a given element and filters the replaceOptions\n * according to a filter function.\n *\n * @param {djs.model.Base} element\n * @param {Object} replaceOptions\n *\n * @return {Array} a list of menu items\n */\nReplaceMenuProvider.prototype._createEntries = function(element, replaceOptions) {\n var menuEntries = [];\n\n var self = this;\n\n forEach(replaceOptions, function(definition) {\n var entry = self._createMenuEntry(definition, element);\n\n menuEntries.push(entry);\n });\n\n return menuEntries;\n};\n\n/**\n * Creates an array of menu entry objects for a given sequence flow.\n *\n * @param {djs.model.Base} element\n * @param {Object} replaceOptions\n\n * @return {Array} a list of menu items\n */\nReplaceMenuProvider.prototype._createSequenceFlowEntries = function(element, replaceOptions) {\n\n var businessObject = getBusinessObject(element);\n\n var menuEntries = [];\n\n var modeling = this._modeling,\n moddle = this._moddle;\n\n var self = this;\n\n forEach(replaceOptions, function(entry) {\n\n switch (entry.actionName) {\n case 'replace-with-default-flow':\n if (businessObject.sourceRef.default !== businessObject &&\n (is(businessObject.sourceRef, 'bpmn:ExclusiveGateway') ||\n is(businessObject.sourceRef, 'bpmn:InclusiveGateway') ||\n is(businessObject.sourceRef, 'bpmn:ComplexGateway') ||\n is(businessObject.sourceRef, 'bpmn:Activity'))) {\n\n menuEntries.push(self._createMenuEntry(entry, element, function() {\n modeling.updateProperties(element.source, { default: businessObject });\n }));\n }\n break;\n case 'replace-with-conditional-flow':\n if (!businessObject.conditionExpression && is(businessObject.sourceRef, 'bpmn:Activity')) {\n\n menuEntries.push(self._createMenuEntry(entry, element, function() {\n var conditionExpression = moddle.create('bpmn:FormalExpression', { body: '' });\n\n modeling.updateProperties(element, { conditionExpression: conditionExpression });\n }));\n }\n break;\n default:\n // default flows\n if (is(businessObject.sourceRef, 'bpmn:Activity') && businessObject.conditionExpression) {\n return menuEntries.push(self._createMenuEntry(entry, element, function() {\n modeling.updateProperties(element, { conditionExpression: undefined });\n }));\n }\n // conditional flows\n if ((is(businessObject.sourceRef, 'bpmn:ExclusiveGateway') ||\n is(businessObject.sourceRef, 'bpmn:InclusiveGateway') ||\n is(businessObject.sourceRef, 'bpmn:ComplexGateway') ||\n is(businessObject.sourceRef, 'bpmn:Activity')) &&\n businessObject.sourceRef.default === businessObject) {\n\n return menuEntries.push(self._createMenuEntry(entry, element, function() {\n modeling.updateProperties(element.source, { default: undefined });\n }));\n }\n }\n });\n\n return menuEntries;\n};\n\n\n/**\n * Creates and returns a single menu entry item.\n *\n * @param {Object} definition a single replace options definition object\n * @param {djs.model.Base} element\n * @param {Function} [action] an action callback function which gets called when\n * the menu entry is being triggered.\n *\n * @return {Object} menu entry item\n */\nReplaceMenuProvider.prototype._createMenuEntry = function(definition, element, action) {\n var translate = this._translate;\n var replaceElement = this._bpmnReplace.replaceElement;\n\n var replaceAction = function() {\n return replaceElement(element, definition.target);\n };\n\n action = action || replaceAction;\n\n var menuEntry = {\n label: translate(definition.label),\n className: definition.className,\n id: definition.actionName,\n action: action\n };\n\n return menuEntry;\n};\n\n/**\n * Get a list of menu items containing buttons for multi instance markers\n *\n * @param {djs.model.Base} element\n *\n * @return {Array} a list of menu items\n */\nReplaceMenuProvider.prototype._getLoopEntries = function(element) {\n\n var self = this;\n var translate = this._translate;\n\n function toggleLoopEntry(event, entry) {\n var loopCharacteristics;\n\n if (entry.active) {\n loopCharacteristics = undefined;\n } else {\n loopCharacteristics = self._moddle.create(entry.options.loopCharacteristics);\n\n if (entry.options.isSequential) {\n loopCharacteristics.isSequential = entry.options.isSequential;\n }\n }\n self._modeling.updateProperties(element, { loopCharacteristics: loopCharacteristics });\n }\n\n var businessObject = getBusinessObject(element),\n loopCharacteristics = businessObject.loopCharacteristics;\n\n var isSequential,\n isLoop,\n isParallel;\n\n if (loopCharacteristics) {\n isSequential = loopCharacteristics.isSequential;\n isLoop = loopCharacteristics.isSequential === undefined;\n isParallel = loopCharacteristics.isSequential !== undefined && !loopCharacteristics.isSequential;\n }\n\n\n var loopEntries = [\n {\n id: 'toggle-parallel-mi',\n className: 'bpmn-icon-parallel-mi-marker',\n title: translate('Parallel Multi Instance'),\n active: isParallel,\n action: toggleLoopEntry,\n options: {\n loopCharacteristics: 'bpmn:MultiInstanceLoopCharacteristics',\n isSequential: false\n }\n },\n {\n id: 'toggle-sequential-mi',\n className: 'bpmn-icon-sequential-mi-marker',\n title: translate('Sequential Multi Instance'),\n active: isSequential,\n action: toggleLoopEntry,\n options: {\n loopCharacteristics: 'bpmn:MultiInstanceLoopCharacteristics',\n isSequential: true\n }\n },\n {\n id: 'toggle-loop',\n className: 'bpmn-icon-loop-marker',\n title: translate('Loop'),\n active: isLoop,\n action: toggleLoopEntry,\n options: {\n loopCharacteristics: 'bpmn:StandardLoopCharacteristics'\n }\n }\n ];\n return loopEntries;\n};\n\n\n/**\n * Get the menu items containing a button for the ad hoc marker\n *\n * @param {djs.model.Base} element\n *\n * @return {Object} a menu item\n */\nReplaceMenuProvider.prototype._getAdHocEntry = function(element) {\n var translate = this._translate;\n var businessObject = getBusinessObject(element);\n\n var isAdHoc = is(businessObject, 'bpmn:AdHocSubProcess');\n\n var replaceElement = this._bpmnReplace.replaceElement;\n\n var adHocEntry = {\n id: 'toggle-adhoc',\n className: 'bpmn-icon-ad-hoc-marker',\n title: translate('Ad-hoc'),\n active: isAdHoc,\n action: function(event, entry) {\n if (isAdHoc) {\n return replaceElement(element, { type: 'bpmn:SubProcess' });\n } else {\n return replaceElement(element, { type: 'bpmn:AdHocSubProcess' });\n }\n }\n };\n\n return adHocEntry;\n};\n\nmodule.exports = ReplaceMenuProvider;\n","module.exports = {\n __depends__: [\n require(215),\n require(80)\n ],\n __init__: [ 'replaceMenuProvider' ],\n replaceMenuProvider: [ 'type', require(73) ]\n};","'use strict';\n\nvar getBusinessObject = require(95).getBusinessObject;\nvar isExpanded = require(93).isExpanded;\n\n/**\n * Returns true, if an element is from a different type\n * than a target definition. Takes into account the type,\n * event definition type and triggeredByEvent property.\n *\n * @param {djs.model.Base} element\n *\n * @return {Boolean}\n */\nfunction isDifferentType(element) {\n\n return function(entry) {\n var target = entry.target;\n\n var businessObject = getBusinessObject(element),\n eventDefinition = businessObject.eventDefinitions && businessObject.eventDefinitions[0];\n\n var isTypeEqual = businessObject.$type === target.type;\n\n var isEventDefinitionEqual = (\n (eventDefinition && eventDefinition.$type) === target.eventDefinitionType\n );\n\n var isTriggeredByEventEqual = (\n businessObject.triggeredByEvent === target.triggeredByEvent\n );\n\n var isExpandedEqual = (\n target.isExpanded === undefined ||\n target.isExpanded === isExpanded(businessObject)\n );\n\n return !isTypeEqual || !isEventDefinitionEqual || !isTriggeredByEventEqual || !isExpandedEqual;\n };\n}\n\nmodule.exports.isDifferentType = isDifferentType;","'use strict';\n\nvar CommandInterceptor = require(119);\n\nvar inherits = require(289);\n\nvar assign = require(431),\n forEach = require(303);\n\nvar domQuery = require(452);\n\nvar svgAttr = require(474);\n\nvar LOW_PRIORITY = 250;\n\nfunction BpmnReplacePreview(eventBus, elementRegistry, elementFactory, canvas, previewSupport) {\n\n CommandInterceptor.call(this, eventBus);\n\n /**\n * Replace the visuals of all elements in the context which can be replaced\n *\n * @param {Object} context\n */\n function replaceVisual(context) {\n\n var replacements = context.canExecute.replacements;\n\n forEach(replacements, function(replacement) {\n\n var id = replacement.oldElementId;\n\n var newElement = {\n type: replacement.newElementType\n };\n\n // if the visual of the element is already replaced\n if (context.visualReplacements[id]) {\n return;\n }\n\n var element = elementRegistry.get(id);\n\n assign(newElement, { x: element.x, y: element.y });\n\n // create a temporary shape\n var tempShape = elementFactory.createShape(newElement);\n\n canvas.addShape(tempShape, element.parent);\n\n // select the original SVG element related to the element and hide it\n var gfx = domQuery('[data-element-id=' + element.id + ']', context.dragGroup);\n\n if (gfx) {\n svgAttr(gfx, { display: 'none' });\n }\n\n // clone the gfx of the temporary shape and add it to the drag group\n var dragger = previewSupport.addDragger(tempShape, context.dragGroup);\n\n context.visualReplacements[id] = dragger;\n\n canvas.removeShape(tempShape);\n });\n }\n\n /**\n * Restore the original visuals of the previously replaced elements\n *\n * @param {Object} context\n */\n function restoreVisual(context) {\n\n var visualReplacements = context.visualReplacements;\n\n forEach(visualReplacements, function(dragger, id) {\n\n var originalGfx = domQuery('[data-element-id=' + id + ']', context.dragGroup);\n\n if (originalGfx) {\n svgAttr(originalGfx, { display: 'inline' });\n }\n\n dragger.remove();\n\n if (visualReplacements[id]) {\n delete visualReplacements[id];\n }\n });\n }\n\n eventBus.on('shape.move.move', LOW_PRIORITY, function(event) {\n\n var context = event.context,\n canExecute = context.canExecute;\n\n if (!context.visualReplacements) {\n context.visualReplacements = {};\n }\n\n if (canExecute.replacements) {\n replaceVisual(context);\n } else {\n restoreVisual(context);\n }\n });\n}\n\nBpmnReplacePreview.$inject = [ 'eventBus', 'elementRegistry', 'elementFactory', 'canvas', 'previewSupport' ];\n\ninherits(BpmnReplacePreview, CommandInterceptor);\n\nmodule.exports = BpmnReplacePreview;\n","module.exports = {\n __depends__: [ require(217) ],\n __init__: [ 'bpmnReplacePreview' ],\n bpmnReplacePreview: [ 'type', require(76) ]\n};\n","'use strict';\n\nvar pick = require(438),\n assign = require(431),\n intersection = require(292),\n filter = require(301),\n has = require(432);\n\nvar is = require(95).is,\n isExpanded = require(93).isExpanded,\n isEventSubProcess = require(93).isEventSubProcess,\n ModelCloneUtils = require(98),\n getProperties = ModelCloneUtils.getProperties;\n\nvar IGNORED_PROPERTIES = ModelCloneUtils.IGNORED_PROPERTIES;\n\nvar ModelCloneHelper = require(97);\n\nvar CUSTOM_PROPERTIES = [\n 'cancelActivity',\n 'instantiate',\n 'eventGatewayType',\n 'triggeredByEvent',\n 'isInterrupting'\n];\n\n\nfunction toggeling(element, target) {\n\n var oldCollapsed = has(element, 'collapsed') ?\n element.collapsed : !isExpanded(element);\n\n var targetCollapsed;\n\n if (has(target, 'collapsed') || has(target, 'isExpanded')) {\n // property is explicitly set so use it\n targetCollapsed = has(target, 'collapsed') ?\n target.collapsed : !target.isExpanded;\n } else {\n // keep old state\n targetCollapsed = oldCollapsed;\n }\n\n if (oldCollapsed !== targetCollapsed) {\n element.collapsed = oldCollapsed;\n return true;\n }\n\n return false;\n}\n\n\n\n/**\n * This module takes care of replacing BPMN elements\n */\nfunction BpmnReplace(bpmnFactory, replace, selection, modeling, eventBus) {\n\n var helper = new ModelCloneHelper(eventBus);\n\n /**\n * Prepares a new business object for the replacement element\n * and triggers the replace operation.\n *\n * @param {djs.model.Base} element\n * @param {Object} target\n * @param {Object} [hints]\n *\n * @return {djs.model.Base} the newly created element\n */\n function replaceElement(element, target, hints) {\n\n hints = hints || {};\n\n var type = target.type,\n oldBusinessObject = element.businessObject;\n\n if (is(oldBusinessObject, 'bpmn:SubProcess')) {\n if (type === 'bpmn:SubProcess') {\n if (toggeling(element, target)) {\n // expanding or collapsing process\n modeling.toggleCollapse(element);\n\n return element;\n }\n }\n }\n\n var newBusinessObject = bpmnFactory.create(type);\n\n var newElement = {\n type: type,\n businessObject: newBusinessObject\n };\n\n var elementProps = getProperties(oldBusinessObject.$descriptor),\n newElementProps = getProperties(newBusinessObject.$descriptor, true),\n properties = intersection(elementProps, newElementProps);\n\n // initialize special properties defined in target definition\n assign(newBusinessObject, pick(target, CUSTOM_PROPERTIES));\n\n properties = filter(properties, function(property) {\n var propName = property.replace(/bpmn:/, '');\n\n // so the applied properties from 'target' don't get lost\n if (newBusinessObject[property] !== undefined) {\n return false;\n }\n\n // retain loop characteristics if the target element is not an event sub process\n if (propName === 'loopCharacteristics') {\n return !isEventSubProcess(newBusinessObject);\n }\n\n if ((propName === 'processRef' && target.isExpanded === false) ||\n propName === 'triggeredByEvent' ||\n propName === 'eventDefinitions') {\n return false;\n }\n\n return IGNORED_PROPERTIES.indexOf(propName) === -1;\n });\n\n newBusinessObject = helper.clone(oldBusinessObject, newBusinessObject, properties);\n\n // initialize custom BPMN extensions\n if (target.eventDefinitionType) {\n newElement.eventDefinitionType = target.eventDefinitionType;\n }\n\n if (is(oldBusinessObject, 'bpmn:Activity')) {\n\n if (is(oldBusinessObject, 'bpmn:SubProcess')) {\n // no toggeling, so keep old state\n newElement.isExpanded = isExpanded(oldBusinessObject);\n }\n // else if property is explicitly set, use it\n else if (has(target, 'isExpanded')) {\n newElement.isExpanded = target.isExpanded;\n }\n\n // TODO: need also to respect min/max Size\n // copy size, from an expanded subprocess to an expanded alternative subprocess\n // except bpmn:Task, because Task is always expanded\n if ((isExpanded(oldBusinessObject) && !is(oldBusinessObject, 'bpmn:Task')) && newElement.isExpanded) {\n newElement.width = element.width;\n newElement.height = element.height;\n }\n }\n\n // transform collapsed/expanded pools\n if (is(oldBusinessObject, 'bpmn:Participant')) {\n\n // create expanded pool\n if (target.isExpanded === true) {\n newBusinessObject.processRef = bpmnFactory.create('bpmn:Process');\n } else {\n // remove children when transforming to collapsed pool\n hints.moveChildren = false;\n }\n\n // apply same size\n newElement.width = element.width;\n newElement.height = element.height;\n }\n\n newBusinessObject.name = oldBusinessObject.name;\n\n // retain default flow's reference between inclusive <-> exclusive gateways and activities\n if ((is(oldBusinessObject, 'bpmn:ExclusiveGateway') || is(oldBusinessObject, 'bpmn:InclusiveGateway') ||\n is(oldBusinessObject, 'bpmn:Activity')) &&\n (is(newBusinessObject, 'bpmn:ExclusiveGateway') || is(newBusinessObject, 'bpmn:InclusiveGateway') ||\n is(newBusinessObject, 'bpmn:Activity')))\n {\n newBusinessObject.default = oldBusinessObject.default;\n }\n\n if ('fill' in oldBusinessObject.di || 'stroke' in oldBusinessObject.di) {\n assign(newElement, { colors: pick(oldBusinessObject.di, [ 'fill', 'stroke' ]) });\n }\n\n newElement = replace.replaceElement(element, newElement, hints);\n\n if (hints.select !== false) {\n selection.select(newElement);\n }\n\n return newElement;\n }\n\n this.replaceElement = replaceElement;\n}\n\nBpmnReplace.$inject = [ 'bpmnFactory', 'replace', 'selection', 'modeling', 'eventBus' ];\n\nmodule.exports = BpmnReplace;\n","'use strict';\n\nmodule.exports.START_EVENT = [\n {\n label: 'Start Event',\n actionName: 'replace-with-none-start',\n className: 'bpmn-icon-start-event-none',\n target: {\n type: 'bpmn:StartEvent'\n }\n },\n {\n label: 'Intermediate Throw Event',\n actionName: 'replace-with-none-intermediate-throwing',\n className: 'bpmn-icon-intermediate-event-none',\n target: {\n type: 'bpmn:IntermediateThrowEvent'\n }\n },\n {\n label: 'End Event',\n actionName: 'replace-with-none-end',\n className: 'bpmn-icon-end-event-none',\n target: {\n type: 'bpmn:EndEvent'\n }\n },\n {\n label: 'Message Start Event',\n actionName: 'replace-with-message-start',\n className: 'bpmn-icon-start-event-message',\n target: {\n type: 'bpmn:StartEvent',\n eventDefinitionType: 'bpmn:MessageEventDefinition'\n }\n },\n {\n label: 'Timer Start Event',\n actionName: 'replace-with-timer-start',\n className: 'bpmn-icon-start-event-timer',\n target: {\n type: 'bpmn:StartEvent',\n eventDefinitionType: 'bpmn:TimerEventDefinition'\n }\n },\n {\n label: 'Conditional Start Event',\n actionName: 'replace-with-conditional-start',\n className: 'bpmn-icon-start-event-condition',\n target: {\n type: 'bpmn:StartEvent',\n eventDefinitionType: 'bpmn:ConditionalEventDefinition'\n }\n },\n {\n label: 'Signal Start Event',\n actionName: 'replace-with-signal-start',\n className: 'bpmn-icon-start-event-signal',\n target: {\n type: 'bpmn:StartEvent',\n eventDefinitionType: 'bpmn:SignalEventDefinition'\n }\n }\n];\n\nmodule.exports.INTERMEDIATE_EVENT = [\n {\n label: 'Start Event',\n actionName: 'replace-with-none-start',\n className: 'bpmn-icon-start-event-none',\n target: {\n type: 'bpmn:StartEvent'\n }\n },\n {\n label: 'Intermediate Throw Event',\n actionName: 'replace-with-none-intermediate-throw',\n className: 'bpmn-icon-intermediate-event-none',\n target: {\n type: 'bpmn:IntermediateThrowEvent'\n }\n },\n {\n label: 'End Event',\n actionName: 'replace-with-none-end',\n className: 'bpmn-icon-end-event-none',\n target: {\n type: 'bpmn:EndEvent'\n }\n },\n {\n label: 'Message Intermediate Catch Event',\n actionName: 'replace-with-message-intermediate-catch',\n className: 'bpmn-icon-intermediate-event-catch-message',\n target: {\n type: 'bpmn:IntermediateCatchEvent',\n eventDefinitionType: 'bpmn:MessageEventDefinition'\n }\n },\n {\n label: 'Message Intermediate Throw Event',\n actionName: 'replace-with-message-intermediate-throw',\n className: 'bpmn-icon-intermediate-event-throw-message',\n target: {\n type: 'bpmn:IntermediateThrowEvent',\n eventDefinitionType: 'bpmn:MessageEventDefinition'\n }\n },\n {\n label: 'Timer Intermediate Catch Event',\n actionName: 'replace-with-timer-intermediate-catch',\n className: 'bpmn-icon-intermediate-event-catch-timer',\n target: {\n type: 'bpmn:IntermediateCatchEvent',\n eventDefinitionType: 'bpmn:TimerEventDefinition'\n }\n },\n {\n label: 'Escalation Intermediate Throw Event',\n actionName: 'replace-with-escalation-intermediate-throw',\n className: 'bpmn-icon-intermediate-event-throw-escalation',\n target: {\n type: 'bpmn:IntermediateThrowEvent',\n eventDefinitionType: 'bpmn:EscalationEventDefinition'\n }\n },\n {\n label: 'Conditional Intermediate Catch Event',\n actionName: 'replace-with-conditional-intermediate-catch',\n className: 'bpmn-icon-intermediate-event-catch-condition',\n target: {\n type: 'bpmn:IntermediateCatchEvent',\n eventDefinitionType: 'bpmn:ConditionalEventDefinition'\n }\n },\n {\n label: 'Link Intermediate Catch Event',\n actionName: 'replace-with-link-intermediate-catch',\n className: 'bpmn-icon-intermediate-event-catch-link',\n target: {\n type: 'bpmn:IntermediateCatchEvent',\n eventDefinitionType: 'bpmn:LinkEventDefinition'\n }\n },\n {\n label: 'Link Intermediate Throw Event',\n actionName: 'replace-with-link-intermediate-throw',\n className: 'bpmn-icon-intermediate-event-throw-link',\n target: {\n type: 'bpmn:IntermediateThrowEvent',\n eventDefinitionType: 'bpmn:LinkEventDefinition'\n }\n },\n {\n label: 'Compensation Intermediate Throw Event',\n actionName: 'replace-with-compensation-intermediate-throw',\n className: 'bpmn-icon-intermediate-event-throw-compensation',\n target: {\n type: 'bpmn:IntermediateThrowEvent',\n eventDefinitionType: 'bpmn:CompensateEventDefinition'\n }\n },\n {\n label: 'Signal Intermediate Catch Event',\n actionName: 'replace-with-signal-intermediate-catch',\n className: 'bpmn-icon-intermediate-event-catch-signal',\n target: {\n type: 'bpmn:IntermediateCatchEvent',\n eventDefinitionType: 'bpmn:SignalEventDefinition'\n }\n },\n {\n label: 'Signal Intermediate Throw Event',\n actionName: 'replace-with-signal-intermediate-throw',\n className: 'bpmn-icon-intermediate-event-throw-signal',\n target: {\n type: 'bpmn:IntermediateThrowEvent',\n eventDefinitionType: 'bpmn:SignalEventDefinition'\n }\n }\n];\n\nmodule.exports.END_EVENT = [\n {\n label: 'Start Event',\n actionName: 'replace-with-none-start',\n className: 'bpmn-icon-start-event-none',\n target: {\n type: 'bpmn:StartEvent'\n }\n },\n {\n label: 'Intermediate Throw Event',\n actionName: 'replace-with-none-intermediate-throw',\n className: 'bpmn-icon-intermediate-event-none',\n target: {\n type: 'bpmn:IntermediateThrowEvent'\n }\n },\n {\n label: 'End Event',\n actionName: 'replace-with-none-end',\n className: 'bpmn-icon-end-event-none',\n target: {\n type: 'bpmn:EndEvent'\n }\n },\n {\n label: 'Message End Event',\n actionName: 'replace-with-message-end',\n className: 'bpmn-icon-end-event-message',\n target: {\n type: 'bpmn:EndEvent',\n eventDefinitionType: 'bpmn:MessageEventDefinition'\n }\n },\n {\n label: 'Escalation End Event',\n actionName: 'replace-with-escalation-end',\n className: 'bpmn-icon-end-event-escalation',\n target: {\n type: 'bpmn:EndEvent',\n eventDefinitionType: 'bpmn:EscalationEventDefinition'\n }\n },\n {\n label: 'Error End Event',\n actionName: 'replace-with-error-end',\n className: 'bpmn-icon-end-event-error',\n target: {\n type: 'bpmn:EndEvent',\n eventDefinitionType: 'bpmn:ErrorEventDefinition'\n }\n },\n {\n label: 'Cancel End Event',\n actionName: 'replace-with-cancel-end',\n className: 'bpmn-icon-end-event-cancel',\n target: {\n type: 'bpmn:EndEvent',\n eventDefinitionType: 'bpmn:CancelEventDefinition'\n }\n },\n {\n label: 'Compensation End Event',\n actionName: 'replace-with-compensation-end',\n className: 'bpmn-icon-end-event-compensation',\n target: {\n type: 'bpmn:EndEvent',\n eventDefinitionType: 'bpmn:CompensateEventDefinition'\n }\n },\n {\n label: 'Signal End Event',\n actionName: 'replace-with-signal-end',\n className: 'bpmn-icon-end-event-signal',\n target: {\n type: 'bpmn:EndEvent',\n eventDefinitionType: 'bpmn:SignalEventDefinition'\n }\n },\n {\n label: 'Terminate End Event',\n actionName: 'replace-with-terminate-end',\n className: 'bpmn-icon-end-event-terminate',\n target: {\n type: 'bpmn:EndEvent',\n eventDefinitionType: 'bpmn:TerminateEventDefinition'\n }\n }\n];\n\nmodule.exports.GATEWAY = [\n {\n label: 'Exclusive Gateway',\n actionName: 'replace-with-exclusive-gateway',\n className: 'bpmn-icon-gateway-xor',\n target: {\n type: 'bpmn:ExclusiveGateway'\n }\n },\n {\n label: 'Parallel Gateway',\n actionName: 'replace-with-parallel-gateway',\n className: 'bpmn-icon-gateway-parallel',\n target: {\n type: 'bpmn:ParallelGateway'\n }\n },\n {\n label: 'Inclusive Gateway',\n actionName: 'replace-with-inclusive-gateway',\n className: 'bpmn-icon-gateway-or',\n target: {\n type: 'bpmn:InclusiveGateway'\n }\n },\n {\n label: 'Complex Gateway',\n actionName: 'replace-with-complex-gateway',\n className: 'bpmn-icon-gateway-complex',\n target: {\n type: 'bpmn:ComplexGateway'\n }\n },\n {\n label: 'Event based Gateway',\n actionName: 'replace-with-event-based-gateway',\n className: 'bpmn-icon-gateway-eventbased',\n target: {\n type: 'bpmn:EventBasedGateway',\n instantiate: false,\n eventGatewayType: 'Exclusive'\n }\n }\n // Gateways deactivated until https://github.com/bpmn-io/bpmn-js/issues/194\n // {\n // label: 'Event based instantiating Gateway',\n // actionName: 'replace-with-exclusive-event-based-gateway',\n // className: 'bpmn-icon-exclusive-event-based',\n // target: {\n // type: 'bpmn:EventBasedGateway'\n // },\n // options: {\n // businessObject: { instantiate: true, eventGatewayType: 'Exclusive' }\n // }\n // },\n // {\n // label: 'Parallel Event based instantiating Gateway',\n // actionName: 'replace-with-parallel-event-based-instantiate-gateway',\n // className: 'bpmn-icon-parallel-event-based-instantiate-gateway',\n // target: {\n // type: 'bpmn:EventBasedGateway'\n // },\n // options: {\n // businessObject: { instantiate: true, eventGatewayType: 'Parallel' }\n // }\n // }\n];\n\nmodule.exports.SUBPROCESS_EXPANDED = [\n {\n label: 'Transaction',\n actionName: 'replace-with-transaction',\n className: 'bpmn-icon-transaction',\n target: {\n type: 'bpmn:Transaction',\n isExpanded: true\n }\n },\n {\n label: 'Event Sub Process',\n actionName: 'replace-with-event-subprocess',\n className: 'bpmn-icon-event-subprocess-expanded',\n target: {\n type: 'bpmn:SubProcess',\n triggeredByEvent: true,\n isExpanded: true\n }\n },\n {\n label: 'Sub Process (collapsed)',\n actionName: 'replace-with-collapsed-subprocess',\n className: 'bpmn-icon-subprocess-collapsed',\n target: {\n type: 'bpmn:SubProcess',\n isExpanded: false\n }\n }\n];\n\nmodule.exports.TRANSACTION = [\n {\n label: 'Sub Process',\n actionName: 'replace-with-subprocess',\n className: 'bpmn-icon-subprocess-expanded',\n target: {\n type: 'bpmn:SubProcess',\n isExpanded: true\n }\n },\n {\n label: 'Event Sub Process',\n actionName: 'replace-with-event-subprocess',\n className: 'bpmn-icon-event-subprocess-expanded',\n target: {\n type: 'bpmn:SubProcess',\n triggeredByEvent: true,\n isExpanded: true\n }\n }\n];\n\nmodule.exports.EVENT_SUB_PROCESS = [\n {\n label: 'Sub Process',\n actionName: 'replace-with-subprocess',\n className: 'bpmn-icon-subprocess-expanded',\n target: {\n type: 'bpmn:SubProcess',\n isExpanded: true\n }\n },\n {\n label: 'Transaction',\n actionName: 'replace-with-transaction',\n className: 'bpmn-icon-transaction',\n target: {\n type: 'bpmn:Transaction',\n isExpanded: true\n }\n }\n];\n\nmodule.exports.TASK = [\n {\n label: 'Task',\n actionName: 'replace-with-task',\n className: 'bpmn-icon-task',\n target: {\n type: 'bpmn:Task'\n }\n },\n {\n label: 'Send Task',\n actionName: 'replace-with-send-task',\n className: 'bpmn-icon-send',\n target: {\n type: 'bpmn:SendTask'\n }\n },\n {\n label: 'Receive Task',\n actionName: 'replace-with-receive-task',\n className: 'bpmn-icon-receive',\n target: {\n type: 'bpmn:ReceiveTask'\n }\n },\n {\n label: 'User Task',\n actionName: 'replace-with-user-task',\n className: 'bpmn-icon-user',\n target: {\n type: 'bpmn:UserTask'\n }\n },\n {\n label: 'Manual Task',\n actionName: 'replace-with-manual-task',\n className: 'bpmn-icon-manual',\n target: {\n type: 'bpmn:ManualTask'\n }\n },\n {\n label: 'Business Rule Task',\n actionName: 'replace-with-rule-task',\n className: 'bpmn-icon-business-rule',\n target: {\n type: 'bpmn:BusinessRuleTask'\n }\n },\n {\n label: 'Service Task',\n actionName: 'replace-with-service-task',\n className: 'bpmn-icon-service',\n target: {\n type: 'bpmn:ServiceTask'\n }\n },\n {\n label: 'Script Task',\n actionName: 'replace-with-script-task',\n className: 'bpmn-icon-script',\n target: {\n type: 'bpmn:ScriptTask'\n }\n },\n {\n label: 'Call Activity',\n actionName: 'replace-with-call-activity',\n className: 'bpmn-icon-call-activity',\n target: {\n type: 'bpmn:CallActivity'\n }\n },\n {\n label: 'Sub Process (collapsed)',\n actionName: 'replace-with-collapsed-subprocess',\n className: 'bpmn-icon-subprocess-collapsed',\n target: {\n type: 'bpmn:SubProcess',\n isExpanded: false\n }\n },\n {\n label: 'Sub Process (expanded)',\n actionName: 'replace-with-expanded-subprocess',\n className: 'bpmn-icon-subprocess-expanded',\n target: {\n type: 'bpmn:SubProcess',\n isExpanded: true\n }\n }\n];\n\nmodule.exports.BOUNDARY_EVENT = [\n {\n label: 'Message Boundary Event',\n actionName: 'replace-with-message-boundary',\n className: 'bpmn-icon-intermediate-event-catch-message',\n target: {\n type: 'bpmn:BoundaryEvent',\n eventDefinitionType: 'bpmn:MessageEventDefinition'\n }\n },\n {\n label: 'Timer Boundary Event',\n actionName: 'replace-with-timer-boundary',\n className: 'bpmn-icon-intermediate-event-catch-timer',\n target: {\n type: 'bpmn:BoundaryEvent',\n eventDefinitionType: 'bpmn:TimerEventDefinition'\n }\n },\n {\n label: 'Escalation Boundary Event',\n actionName: 'replace-with-escalation-boundary',\n className: 'bpmn-icon-intermediate-event-catch-escalation',\n target: {\n type: 'bpmn:BoundaryEvent',\n eventDefinitionType: 'bpmn:EscalationEventDefinition'\n }\n },\n {\n label: 'Conditional Boundary Event',\n actionName: 'replace-with-conditional-boundary',\n className: 'bpmn-icon-intermediate-event-catch-condition',\n target: {\n type: 'bpmn:BoundaryEvent',\n eventDefinitionType: 'bpmn:ConditionalEventDefinition'\n }\n },\n {\n label: 'Error Boundary Event',\n actionName: 'replace-with-error-boundary',\n className: 'bpmn-icon-intermediate-event-catch-error',\n target: {\n type: 'bpmn:BoundaryEvent',\n eventDefinitionType: 'bpmn:ErrorEventDefinition'\n }\n },\n {\n label: 'Cancel Boundary Event',\n actionName: 'replace-with-cancel-boundary',\n className: 'bpmn-icon-intermediate-event-catch-cancel',\n target: {\n type: 'bpmn:BoundaryEvent',\n eventDefinitionType: 'bpmn:CancelEventDefinition'\n }\n },\n {\n label: 'Signal Boundary Event',\n actionName: 'replace-with-signal-boundary',\n className: 'bpmn-icon-intermediate-event-catch-signal',\n target: {\n type: 'bpmn:BoundaryEvent',\n eventDefinitionType: 'bpmn:SignalEventDefinition'\n }\n },\n {\n label: 'Compensation Boundary Event',\n actionName: 'replace-with-compensation-boundary',\n className: 'bpmn-icon-intermediate-event-catch-compensation',\n target: {\n type: 'bpmn:BoundaryEvent',\n eventDefinitionType: 'bpmn:CompensateEventDefinition'\n }\n },\n {\n label: 'Message Boundary Event (non-interrupting)',\n actionName: 'replace-with-non-interrupting-message-boundary',\n className: 'bpmn-icon-intermediate-event-catch-non-interrupting-message',\n target: {\n type: 'bpmn:BoundaryEvent',\n eventDefinitionType: 'bpmn:MessageEventDefinition',\n cancelActivity: false\n }\n },\n {\n label: 'Timer Boundary Event (non-interrupting)',\n actionName: 'replace-with-non-interrupting-timer-boundary',\n className: 'bpmn-icon-intermediate-event-catch-non-interrupting-timer',\n target: {\n type: 'bpmn:BoundaryEvent',\n eventDefinitionType: 'bpmn:TimerEventDefinition',\n cancelActivity: false\n }\n },\n {\n label: 'Escalation Boundary Event (non-interrupting)',\n actionName: 'replace-with-non-interrupting-escalation-boundary',\n className: 'bpmn-icon-intermediate-event-catch-non-interrupting-escalation',\n target: {\n type: 'bpmn:BoundaryEvent',\n eventDefinitionType: 'bpmn:EscalationEventDefinition',\n cancelActivity: false\n }\n },\n {\n label: 'Conditional Boundary Event (non-interrupting)',\n actionName: 'replace-with-non-interrupting-conditional-boundary',\n className: 'bpmn-icon-intermediate-event-catch-non-interrupting-condition',\n target: {\n type: 'bpmn:BoundaryEvent',\n eventDefinitionType: 'bpmn:ConditionalEventDefinition',\n cancelActivity: false\n }\n },\n {\n label: 'Signal Boundary Event (non-interrupting)',\n actionName: 'replace-with-non-interrupting-signal-boundary',\n className: 'bpmn-icon-intermediate-event-catch-non-interrupting-signal',\n target: {\n type: 'bpmn:BoundaryEvent',\n eventDefinitionType: 'bpmn:SignalEventDefinition',\n cancelActivity: false\n }\n }\n];\n\nmodule.exports.EVENT_SUB_PROCESS_START_EVENT = [\n {\n label: 'Message Start Event',\n actionName: 'replace-with-message-start',\n className: 'bpmn-icon-start-event-message',\n target: {\n type: 'bpmn:StartEvent',\n eventDefinitionType: 'bpmn:MessageEventDefinition'\n }\n },\n {\n label: 'Timer Start Event',\n actionName: 'replace-with-timer-start',\n className: 'bpmn-icon-start-event-timer',\n target: {\n type: 'bpmn:StartEvent',\n eventDefinitionType: 'bpmn:TimerEventDefinition'\n }\n },\n {\n label: 'Conditional Start Event',\n actionName: 'replace-with-conditional-start',\n className: 'bpmn-icon-start-event-condition',\n target: {\n type: 'bpmn:StartEvent',\n eventDefinitionType: 'bpmn:ConditionalEventDefinition'\n }\n },\n {\n label: 'Signal Start Event',\n actionName: 'replace-with-signal-start',\n className: 'bpmn-icon-start-event-signal',\n target: {\n type: 'bpmn:StartEvent',\n eventDefinitionType: 'bpmn:SignalEventDefinition'\n }\n },\n {\n label: 'Error Start Event',\n actionName: 'replace-with-error-start',\n className: 'bpmn-icon-start-event-error',\n target: {\n type: 'bpmn:StartEvent',\n eventDefinitionType: 'bpmn:ErrorEventDefinition'\n }\n },\n {\n label: 'Escalation Start Event',\n actionName: 'replace-with-escalation-start',\n className: 'bpmn-icon-start-event-escalation',\n target: {\n type: 'bpmn:StartEvent',\n eventDefinitionType: 'bpmn:EscalationEventDefinition'\n }\n },\n {\n label: 'Compensation Start Event',\n actionName: 'replace-with-compensation-start',\n className: 'bpmn-icon-start-event-compensation',\n target: {\n type: 'bpmn:StartEvent',\n eventDefinitionType: 'bpmn:CompensateEventDefinition'\n }\n },\n {\n label: 'Message Start Event (non-interrupting)',\n actionName: 'replace-with-non-interrupting-message-start',\n className: 'bpmn-icon-start-event-non-interrupting-message',\n target: {\n type: 'bpmn:StartEvent',\n eventDefinitionType: 'bpmn:MessageEventDefinition',\n isInterrupting: false\n }\n },\n {\n label: 'Timer Start Event (non-interrupting)',\n actionName: 'replace-with-non-interrupting-timer-start',\n className: 'bpmn-icon-start-event-non-interrupting-timer',\n target: {\n type: 'bpmn:StartEvent',\n eventDefinitionType: 'bpmn:TimerEventDefinition',\n isInterrupting: false\n }\n },\n {\n label: 'Conditional Start Event (non-interrupting)',\n actionName: 'replace-with-non-interrupting-conditional-start',\n className: 'bpmn-icon-start-event-non-interrupting-condition',\n target: {\n type: 'bpmn:StartEvent',\n eventDefinitionType: 'bpmn:ConditionalEventDefinition',\n isInterrupting: false\n }\n },\n {\n label: 'Signal Start Event (non-interrupting)',\n actionName: 'replace-with-non-interrupting-signal-start',\n className: 'bpmn-icon-start-event-non-interrupting-signal',\n target: {\n type: 'bpmn:StartEvent',\n eventDefinitionType: 'bpmn:SignalEventDefinition',\n isInterrupting: false\n }\n },\n {\n label: 'Escalation Start Event (non-interrupting)',\n actionName: 'replace-with-non-interrupting-escalation-start',\n className: 'bpmn-icon-start-event-non-interrupting-escalation',\n target: {\n type: 'bpmn:StartEvent',\n eventDefinitionType: 'bpmn:EscalationEventDefinition',\n isInterrupting: false\n }\n }\n];\n\nmodule.exports.SEQUENCE_FLOW = [\n {\n label: 'Sequence Flow',\n actionName: 'replace-with-sequence-flow',\n className: 'bpmn-icon-connection'\n },\n {\n label: 'Default Flow',\n actionName: 'replace-with-default-flow',\n className: 'bpmn-icon-default-flow'\n },\n {\n label: 'Conditional Flow',\n actionName: 'replace-with-conditional-flow',\n className: 'bpmn-icon-conditional-flow'\n }\n];\n\nmodule.exports.PARTICIPANT = [\n {\n label: 'Expanded Pool',\n actionName: 'replace-with-expanded-pool',\n className: 'bpmn-icon-participant',\n target: {\n type: 'bpmn:Participant',\n isExpanded: true\n }\n },\n {\n label: 'Collapsed Pool',\n actionName: 'replace-with-collapsed-pool',\n // TODO(@janstuemmel): maybe design new icon\n className: 'bpmn-icon-lane',\n target: {\n type: 'bpmn:Participant',\n isExpanded: false\n }\n }\n];\n","module.exports = {\n __depends__: [\n require(219),\n require(233)\n ],\n bpmnReplace: [ 'type', require(78) ]\n};\n","'use strict';\n\nvar find = require(302),\n any = require(299),\n every = require(300),\n filter = require(301),\n forEach = require(303),\n inherits = require(289);\n\nvar is = require(95).is,\n isAny = require(68).isAny,\n getBusinessObject = require(95).getBusinessObject,\n isExpanded = require(93).isExpanded,\n isEventSubProcess = require(93).isEventSubProcess,\n isInterrupting = require(93).isInterrupting,\n hasErrorEventDefinition = require(93).hasErrorEventDefinition,\n hasEscalationEventDefinition = require(93).hasEscalationEventDefinition,\n hasCompensateEventDefinition = require(93).hasCompensateEventDefinition;\n\n\nvar RuleProvider = require(225);\n\nvar isBoundaryAttachment = require(86).getBoundaryAttachment;\n\n/**\n * BPMN specific modeling rule\n */\nfunction BpmnRules(eventBus) {\n RuleProvider.call(this, eventBus);\n}\n\ninherits(BpmnRules, RuleProvider);\n\nBpmnRules.$inject = [ 'eventBus' ];\n\nmodule.exports = BpmnRules;\n\nBpmnRules.prototype.init = function() {\n\n this.addRule('connection.create', function(context) {\n var source = context.source,\n target = context.target;\n\n return canConnect(source, target);\n });\n\n this.addRule('connection.reconnectStart', function(context) {\n\n var connection = context.connection,\n source = context.hover || context.source,\n target = connection.target;\n\n return canConnect(source, target, connection);\n });\n\n this.addRule('connection.reconnectEnd', function(context) {\n\n var connection = context.connection,\n source = connection.source,\n target = context.hover || context.target;\n\n return canConnect(source, target, connection);\n });\n\n this.addRule('connection.updateWaypoints', function(context) {\n // OK! but visually ignore\n return null;\n });\n\n this.addRule('shape.resize', function(context) {\n\n var shape = context.shape,\n newBounds = context.newBounds;\n\n return canResize(shape, newBounds);\n });\n\n this.addRule('elements.move', function(context) {\n\n var target = context.target,\n shapes = context.shapes,\n position = context.position;\n\n return canAttach(shapes, target, null, position) ||\n canReplace(shapes, target, position) ||\n canMove(shapes, target, position) ||\n canInsert(shapes, target, position);\n });\n\n this.addRule([ 'shape.create', 'shape.append' ], function(context) {\n var target = context.target,\n shape = context.shape,\n source = context.source,\n position = context.position;\n\n return canAttach([ shape ], target, source, position) || canCreate(shape, target, source, position);\n });\n\n this.addRule('element.copy', function(context) {\n var collection = context.collection,\n element = context.element;\n\n return canCopy(collection, element);\n });\n\n this.addRule('element.paste', function(context) {\n var parent = context.parent,\n element = context.element,\n position = context.position,\n source = context.source,\n target = context.target;\n\n if (source || target) {\n return canConnect(source, target);\n }\n\n return canAttach([ element ], parent, null, position) || canCreate(element, parent, null, position);\n });\n\n this.addRule('elements.paste', function(context) {\n var tree = context.tree,\n target = context.target;\n\n return canPaste(tree, target);\n });\n\n this.addRule([ 'elements.delete' ], function(context) {\n\n // do not allow deletion of labels\n return filter(context.elements, function(e) {\n return !isLabel(e);\n });\n });\n};\n\nBpmnRules.prototype.canConnectMessageFlow = canConnectMessageFlow;\n\nBpmnRules.prototype.canConnectSequenceFlow = canConnectSequenceFlow;\n\nBpmnRules.prototype.canConnectDataAssociation = canConnectDataAssociation;\n\nBpmnRules.prototype.canConnectAssociation = canConnectAssociation;\n\nBpmnRules.prototype.canMove = canMove;\n\nBpmnRules.prototype.canAttach = canAttach;\n\nBpmnRules.prototype.canReplace = canReplace;\n\nBpmnRules.prototype.canDrop = canDrop;\n\nBpmnRules.prototype.canInsert = canInsert;\n\nBpmnRules.prototype.canCreate = canCreate;\n\nBpmnRules.prototype.canConnect = canConnect;\n\nBpmnRules.prototype.canResize = canResize;\n\nBpmnRules.prototype.canCopy = canCopy;\n\n/**\n * Utility functions for rule checking\n */\n\nfunction nonExistantOrLabel(element) {\n return !element || isLabel(element);\n}\n\nfunction isSame(a, b) {\n return a === b;\n}\n\nfunction getOrganizationalParent(element) {\n\n var bo = getBusinessObject(element);\n\n while (bo && !is(bo, 'bpmn:Process')) {\n if (is(bo, 'bpmn:Participant')) {\n return bo.processRef || bo;\n }\n\n bo = bo.$parent;\n }\n\n return bo;\n}\n\nfunction isTextAnnotation(element) {\n return is(element, 'bpmn:TextAnnotation');\n}\n\nfunction isCompensationBoundary(element) {\n return is(element, 'bpmn:BoundaryEvent') &&\n hasEventDefinition(element, 'bpmn:CompensateEventDefinition');\n}\n\nfunction isForCompensation(e) {\n return getBusinessObject(e).isForCompensation;\n}\n\nfunction isSameOrganization(a, b) {\n var parentA = getOrganizationalParent(a),\n parentB = getOrganizationalParent(b);\n\n return parentA === parentB;\n}\n\nfunction isMessageFlowSource(element) {\n return is(element, 'bpmn:InteractionNode') &&\n !isForCompensation(element) && (\n !is(element, 'bpmn:Event') || (\n is(element, 'bpmn:ThrowEvent') &&\n hasEventDefinitionOrNone(element, 'bpmn:MessageEventDefinition')\n )\n );\n}\n\nfunction isMessageFlowTarget(element) {\n return is(element, 'bpmn:InteractionNode') &&\n !isForCompensation(element) && (\n !is(element, 'bpmn:Event') || (\n is(element, 'bpmn:CatchEvent') &&\n hasEventDefinitionOrNone(element, 'bpmn:MessageEventDefinition')\n )\n );\n}\n\nfunction getScopeParent(element) {\n\n var bo = getBusinessObject(element);\n\n if (is(bo, 'bpmn:Participant')) {\n return null;\n }\n\n while (bo) {\n bo = bo.$parent;\n\n if (is(bo, 'bpmn:FlowElementsContainer')) {\n return bo;\n }\n }\n\n return bo;\n}\n\nfunction isSameScope(a, b) {\n var scopeParentA = getScopeParent(a),\n scopeParentB = getScopeParent(b);\n\n return scopeParentA && (scopeParentA === scopeParentB);\n}\n\nfunction hasEventDefinition(element, eventDefinition) {\n var bo = getBusinessObject(element);\n\n return !!find(bo.eventDefinitions || [], function(definition) {\n return is(definition, eventDefinition);\n });\n}\n\nfunction hasEventDefinitionOrNone(element, eventDefinition) {\n var bo = getBusinessObject(element);\n\n return (bo.eventDefinitions || []).every(function(definition) {\n return is(definition, eventDefinition);\n });\n}\n\nfunction isSequenceFlowSource(element) {\n return is(element, 'bpmn:FlowNode') &&\n !is(element, 'bpmn:EndEvent') &&\n !isEventSubProcess(element) &&\n !(is(element, 'bpmn:IntermediateThrowEvent') &&\n hasEventDefinition(element, 'bpmn:LinkEventDefinition')\n ) &&\n !isCompensationBoundary(element) &&\n !isForCompensation(element);\n}\n\nfunction isSequenceFlowTarget(element) {\n return is(element, 'bpmn:FlowNode') &&\n !is(element, 'bpmn:StartEvent') &&\n !is(element, 'bpmn:BoundaryEvent') &&\n !isEventSubProcess(element) &&\n !(is(element, 'bpmn:IntermediateCatchEvent') &&\n hasEventDefinition(element, 'bpmn:LinkEventDefinition')\n ) &&\n !isForCompensation(element);\n\n}\n\nfunction isEventBasedTarget(element) {\n return is(element, 'bpmn:ReceiveTask') || (\n is(element, 'bpmn:IntermediateCatchEvent') && (\n hasEventDefinition(element, 'bpmn:MessageEventDefinition') ||\n hasEventDefinition(element, 'bpmn:TimerEventDefinition') ||\n hasEventDefinition(element, 'bpmn:ConditionalEventDefinition') ||\n hasEventDefinition(element, 'bpmn:SignalEventDefinition')\n )\n );\n}\n\nfunction isLabel(element) {\n return element.labelTarget;\n}\n\nfunction isConnection(element) {\n return element.waypoints;\n}\n\nfunction getParents(element) {\n\n var parents = [];\n\n while (element) {\n element = element.parent;\n\n if (element) {\n parents.push(element);\n }\n }\n\n return parents;\n}\n\nfunction isParent(possibleParent, element) {\n var allParents = getParents(element);\n return allParents.indexOf(possibleParent) !== -1;\n}\n\nfunction canConnect(source, target, connection) {\n\n if (nonExistantOrLabel(source) || nonExistantOrLabel(target)) {\n return null;\n }\n\n // See https://github.com/bpmn-io/bpmn-js/issues/178\n // as a workround we disallow connections with same\n // target and source element.\n // This rule must be removed if a auto layout for this\n // connections is implemented.\n if (isSame(source, target)) {\n return false;\n }\n\n if (!is(connection, 'bpmn:DataAssociation')) {\n\n if (canConnectMessageFlow(source, target)) {\n return { type: 'bpmn:MessageFlow' };\n }\n\n if (canConnectSequenceFlow(source, target)) {\n return { type: 'bpmn:SequenceFlow' };\n }\n }\n\n var connectDataAssociation = canConnectDataAssociation(source, target);\n\n if (connectDataAssociation) {\n return connectDataAssociation;\n }\n\n if (isCompensationBoundary(source) && isForCompensation(target)) {\n return {\n type: 'bpmn:Association',\n associationDirection: 'One'\n };\n }\n\n if (canConnectAssociation(source, target)) {\n\n return {\n type: 'bpmn:Association'\n };\n }\n\n return false;\n}\n\n/**\n * Can an element be dropped into the target element\n *\n * @return {Boolean}\n */\nfunction canDrop(element, target, position) {\n\n // can move labels everywhere\n if (isLabel(element) && !isConnection(target)) {\n return true;\n }\n\n // disallow to create elements on collapsed pools\n if (is(target, 'bpmn:Participant') && !isExpanded(target)) {\n return false;\n }\n\n // allow to create new participants on\n // on existing collaboration and process diagrams\n if (is(element, 'bpmn:Participant')) {\n return is(target, 'bpmn:Process') || is(target, 'bpmn:Collaboration');\n }\n\n // allow creating lanes on participants and other lanes only\n if (is(element, 'bpmn:Lane')) {\n return is(target, 'bpmn:Participant') || is(target, 'bpmn:Lane');\n }\n\n if (is(element, 'bpmn:BoundaryEvent')) {\n return false;\n }\n\n // drop flow elements onto flow element containers\n // and participants\n if (is(element, 'bpmn:FlowElement')) {\n if (is(target, 'bpmn:FlowElementsContainer')) {\n return isExpanded(target);\n }\n\n return isAny(target, [ 'bpmn:Participant', 'bpmn:Lane' ]);\n }\n\n // account for the fact that data associations are always\n // rendered and moved to top (Process or Collaboration level)\n //\n // artifacts may be placed wherever, too\n if (isAny(element, [ 'bpmn:Artifact', 'bpmn:DataAssociation' ])) {\n return isAny(target, [\n 'bpmn:Collaboration',\n 'bpmn:Lane',\n 'bpmn:Participant',\n 'bpmn:Process',\n 'bpmn:SubProcess' ]);\n }\n\n if (is(element, 'bpmn:MessageFlow')) {\n return is(target, 'bpmn:Collaboration')\n || element.source.parent == target\n || element.target.parent == target;\n }\n\n return false;\n}\n\nfunction canPaste(tree, target) {\n var topLevel = tree[0],\n participants;\n\n if (is(target, 'bpmn:Collaboration')) {\n return every(topLevel, function(e) {\n return e.type === 'bpmn:Participant';\n });\n }\n\n if (is(target, 'bpmn:Process')) {\n participants = any(topLevel, function(e) {\n return e.type === 'bpmn:Participant';\n });\n\n return !(participants && target.children.length > 0);\n }\n\n // disallow to create elements on collapsed pools\n if (is(target, 'bpmn:Participant') && !isExpanded(target)) {\n return false;\n }\n\n if (is(target, 'bpmn:FlowElementsContainer')) {\n return isExpanded(target);\n }\n\n return isAny(target, [\n 'bpmn:Collaboration',\n 'bpmn:Lane',\n 'bpmn:Participant',\n 'bpmn:Process',\n 'bpmn:SubProcess' ]);\n}\n\nfunction isBoundaryEvent(element) {\n return !isLabel(element) && is(element, 'bpmn:BoundaryEvent');\n}\n\nfunction isLane(element) {\n return is(element, 'bpmn:Lane');\n}\n\n/**\n * We treat IntermediateThrowEvents as boundary events during create,\n * this must be reflected in the rules.\n */\nfunction isBoundaryCandidate(element) {\n return isBoundaryEvent(element) ||\n (is(element, 'bpmn:IntermediateThrowEvent') && !element.parent);\n}\n\n\nfunction canAttach(elements, target, source, position) {\n\n if (!Array.isArray(elements)) {\n elements = [ elements ];\n }\n\n // disallow appending as boundary event\n if (source) {\n return false;\n }\n\n // only (re-)attach one element at a time\n if (elements.length !== 1) {\n return false;\n }\n\n var element = elements[0];\n\n // do not attach labels\n if (isLabel(element)) {\n return false;\n }\n\n // only handle boundary events\n if (!isBoundaryCandidate(element)) {\n return false;\n }\n\n // allow default move operation\n if (!target) {\n return true;\n }\n\n // disallow drop on event sub processes\n if (isEventSubProcess(target)) {\n return false;\n }\n\n // only allow drop on non compensation activities\n if (!is(target, 'bpmn:Activity') || isForCompensation(target)) {\n return false;\n }\n\n // only attach to subprocess border\n if (position && !isBoundaryAttachment(position, target)) {\n return false;\n }\n\n return 'attach';\n}\n\n\n/**\n * Defines how to replace elements for a given target.\n *\n * Returns an array containing all elements which will be replaced.\n *\n * @example\n *\n * [{ id: 'IntermediateEvent_2',\n * type: 'bpmn:StartEvent'\n * },\n * { id: 'IntermediateEvent_5',\n * type: 'bpmn:EndEvent'\n * }]\n *\n * @param {Array} elements\n * @param {Object} target\n *\n * @return {Object} an object containing all elements which have to be replaced\n */\nfunction canReplace(elements, target, position) {\n\n if (!target) {\n return false;\n }\n\n var canExecute = {\n replacements: []\n };\n\n forEach(elements, function(element) {\n\n if (!isEventSubProcess(target)) {\n\n if (is(element, 'bpmn:StartEvent') &&\n element.type !== 'label' &&\n canDrop(element, target)) {\n\n // replace a non-interrupting start event by a blank interrupting start event\n // when the target is not an event sub process\n if (!isInterrupting(element)) {\n canExecute.replacements.push({\n oldElementId: element.id,\n newElementType: 'bpmn:StartEvent'\n });\n }\n\n // replace an error/escalation/compansate start event by a blank interrupting start event\n // when the target is not an event sub process\n if (hasErrorEventDefinition(element) ||\n hasEscalationEventDefinition(element) ||\n hasCompensateEventDefinition(element)) {\n canExecute.replacements.push({\n oldElementId: element.id,\n newElementType: 'bpmn:StartEvent'\n });\n }\n }\n }\n\n if (!is(target, 'bpmn:Transaction')) {\n if (hasEventDefinition(element, 'bpmn:CancelEventDefinition') &&\n element.type !== 'label') {\n\n if (is(element, 'bpmn:EndEvent') && canDrop(element, target)) {\n canExecute.replacements.push({\n oldElementId: element.id,\n newElementType: 'bpmn:EndEvent'\n });\n }\n\n if (is(element, 'bpmn:BoundaryEvent') && canAttach(element, target, null, position)) {\n canExecute.replacements.push({\n oldElementId: element.id,\n newElementType: 'bpmn:BoundaryEvent'\n });\n }\n }\n }\n });\n\n return canExecute.replacements.length ? canExecute : false;\n}\n\nfunction canMove(elements, target) {\n\n // do not move selection containing boundary events\n if (any(elements, isBoundaryEvent)) {\n return false;\n }\n\n // do not move selection containing lanes\n if (any(elements, isLane)) {\n return false;\n }\n\n // allow default move check to start move operation\n if (!target) {\n return true;\n }\n\n return elements.every(function(element) {\n return canDrop(element, target);\n });\n}\n\nfunction canCreate(shape, target, source, position) {\n\n if (!target) {\n return false;\n }\n\n if (isLabel(target)) {\n return null;\n }\n\n if (isSame(source, target)) {\n return false;\n }\n\n // ensure we do not drop the element\n // into source\n if (source && isParent(source, target)) {\n return false;\n }\n\n return canDrop(shape, target, position) || canInsert(shape, target, position);\n}\n\nfunction canResize(shape, newBounds) {\n if (is(shape, 'bpmn:SubProcess')) {\n return (!!isExpanded(shape)) && (\n !newBounds || (newBounds.width >= 100 && newBounds.height >= 80)\n );\n }\n\n if (is(shape, 'bpmn:Lane')) {\n return !newBounds || (newBounds.width >= 130 && newBounds.height >= 60);\n }\n\n if (is(shape, 'bpmn:Participant')) {\n return !newBounds || (newBounds.width >= 250 && newBounds.height >= 50);\n }\n\n if (isTextAnnotation(shape)) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Check, whether one side of the relationship\n * is a text annotation.\n */\nfunction isOneTextAnnotation(source, target) {\n\n var sourceTextAnnotation = isTextAnnotation(source),\n targetTextAnnotation = isTextAnnotation(target);\n\n return (\n (sourceTextAnnotation || targetTextAnnotation) &&\n (sourceTextAnnotation !== targetTextAnnotation)\n );\n}\n\n\nfunction canConnectAssociation(source, target) {\n\n // do not connect connections\n if (isConnection(source) || isConnection(target)) {\n return false;\n }\n\n // compensation boundary events are exception\n if (isCompensationBoundary(source) && isForCompensation(target)) {\n return true;\n }\n\n // don't connect parent <-> child\n if (isParent(target, source) || isParent(source, target)) {\n return false;\n }\n\n // allow connection of associations between and \n return isOneTextAnnotation(source, target);\n}\n\nfunction canConnectMessageFlow(source, target) {\n\n return isMessageFlowSource(source) &&\n isMessageFlowTarget(target) &&\n !isSameOrganization(source, target);\n}\n\nfunction canConnectSequenceFlow(source, target) {\n\n return isSequenceFlowSource(source) &&\n isSequenceFlowTarget(target) &&\n isSameScope(source, target) &&\n !(is(source, 'bpmn:EventBasedGateway') && !isEventBasedTarget(target));\n}\n\n\nfunction canConnectDataAssociation(source, target) {\n\n if (isAny(source, [ 'bpmn:DataObjectReference', 'bpmn:DataStoreReference' ]) &&\n isAny(target, [ 'bpmn:Activity', 'bpmn:ThrowEvent' ])) {\n return { type: 'bpmn:DataInputAssociation' };\n }\n\n if (isAny(target, [ 'bpmn:DataObjectReference', 'bpmn:DataStoreReference' ]) &&\n isAny(source, [ 'bpmn:Activity', 'bpmn:CatchEvent' ])) {\n return { type: 'bpmn:DataOutputAssociation' };\n }\n\n return false;\n}\n\nfunction canInsert(shape, flow, position) {\n\n if (Array.isArray(shape)) {\n if (shape.length !== 1) {\n return false;\n }\n\n shape = shape[0];\n }\n\n // return true if we can drop on the\n // underlying flow parent\n //\n // at this point we are not really able to talk\n // about connection rules (yet)\n\n return (\n isAny(flow, [ 'bpmn:SequenceFlow', 'bpmn:MessageFlow' ]) &&\n !isLabel(flow) &&\n is(shape, 'bpmn:FlowNode') &&\n !is(shape, 'bpmn:BoundaryEvent') &&\n canDrop(shape, flow.parent, position));\n}\n\nfunction contains(collection, element) {\n return (collection && element) && collection.indexOf(element) !== -1;\n}\n\nfunction canCopy(collection, element) {\n if (is(element, 'bpmn:Lane') && !contains(collection, element.parent)) {\n return false;\n }\n\n if (is(element, 'bpmn:BoundaryEvent') && !contains(collection, element.host)) {\n return false;\n }\n\n return true;\n}\n","module.exports = {\n __depends__: [\n require(227)\n ],\n __init__: [ 'bpmnRules' ],\n bpmnRules: [ 'type', require(81) ]\n};\n","'use strict';\n\nvar map = require(305),\n filter = require(301),\n sortBy = require(310);\n\nvar labelUtil = require(25);\n\n\n/**\n * Provides ability to search through BPMN elements\n */\nfunction BpmnSearchProvider(elementRegistry, searchPad, canvas) {\n\n this._elementRegistry = elementRegistry;\n this._canvas = canvas;\n\n searchPad.registerProvider(this);\n}\n\nmodule.exports = BpmnSearchProvider;\n\nBpmnSearchProvider.$inject = [\n 'elementRegistry',\n 'searchPad',\n 'canvas'\n];\n\n\n/**\n * Finds all elements that match given pattern\n *\n * :\n * {\n * primaryTokens: >,\n * secondaryTokens: >,\n * element: \n * }\n *\n * :\n * {\n * normal|matched: \n * }\n *\n * @param {String} pattern\n * @return {Array}\n */\nBpmnSearchProvider.prototype.find = function(pattern) {\n var rootElement = this._canvas.getRootElement();\n\n var elements = this._elementRegistry.filter(function(element) {\n if (element.labelTarget) {\n return false;\n }\n return true;\n });\n\n // do not include root element\n elements = filter(elements, function(element) {\n return element !== rootElement;\n });\n\n elements = map(elements, function(element) {\n return {\n primaryTokens: matchAndSplit(labelUtil.getLabel(element), pattern),\n secondaryTokens: matchAndSplit(element.id, pattern),\n element: element\n };\n });\n\n // exclude non-matched elements\n elements = filter(elements, function(element) {\n return hasMatched(element.primaryTokens) || hasMatched(element.secondaryTokens);\n });\n\n elements = sortBy(elements, function(element) {\n return labelUtil.getLabel(element.element) + element.element.id;\n });\n\n return elements;\n};\n\n\nfunction hasMatched(tokens) {\n var matched = filter(tokens, function(t) {\n return !!t.matched;\n });\n\n return matched.length > 0;\n}\n\n\nfunction matchAndSplit(text, pattern) {\n var tokens = [],\n originalText = text;\n\n if (!text) {\n return tokens;\n }\n\n text = text.toLowerCase();\n pattern = pattern.toLowerCase();\n\n var i = text.indexOf(pattern);\n\n if (i > -1) {\n if (i !== 0) {\n tokens.push({\n normal: originalText.substr(0, i)\n });\n }\n\n tokens.push({\n matched: originalText.substr(i, pattern.length)\n });\n\n if (pattern.length + i < text.length) {\n tokens.push({\n normal: originalText.substr(pattern.length + i, text.length)\n });\n }\n } else {\n tokens.push({\n normal: originalText\n });\n }\n\n return tokens;\n}","module.exports = {\n __depends__: [\n require(229)\n ],\n __init__: [ 'bpmnSearch'],\n bpmnSearch: [ 'type', require(83) ]\n};\n","'use strict';\n\nvar inherits = require(289);\n\nvar abs = Math.abs;\n\nvar forEach = require(303),\n filter = require(301),\n assign = require(431);\n\nvar getBoundingBox = require(266).getBBox;\n\nvar is = require(95).is,\n isAny = require(68).isAny,\n isExpanded = require(93).isExpanded;\n\nvar Snapping = require(236),\n SnapUtil = require(235);\n\nvar asTRBL = require(252).asTRBL;\n\nvar round = Math.round;\n\nvar mid = SnapUtil.mid,\n topLeft = SnapUtil.topLeft,\n bottomRight = SnapUtil.bottomRight,\n isSnapped = SnapUtil.isSnapped,\n setSnapped = SnapUtil.setSnapped;\n\nvar getBoundaryAttachment = require(86).getBoundaryAttachment,\n getParticipantSizeConstraints = require(86).getParticipantSizeConstraints,\n getLanesRoot = require(67).getLanesRoot;\n\nvar HIGH_PRIORITY = 1500;\n\n\n/**\n * BPMN specific snapping functionality\n *\n * * snap on process elements if a pool is created inside a\n * process diagram\n *\n * @param {EventBus} eventBus\n * @param {Canvas} canvas\n */\nfunction BpmnSnapping(eventBus, canvas, bpmnRules, elementRegistry) {\n\n // instantiate super\n Snapping.call(this, eventBus, canvas);\n\n\n /**\n * Drop participant on process <> process elements snapping\n */\n eventBus.on('create.start', function(event) {\n\n var context = event.context,\n shape = context.shape,\n rootElement = canvas.getRootElement();\n\n // snap participant around existing elements (if any)\n if (is(shape, 'bpmn:Participant') && is(rootElement, 'bpmn:Process')) {\n initParticipantSnapping(context, shape, rootElement.children);\n }\n });\n\n eventBus.on([ 'create.move', 'create.end' ], HIGH_PRIORITY, function(event) {\n\n var context = event.context,\n shape = context.shape,\n participantSnapBox = context.participantSnapBox;\n\n if (!isSnapped(event) && participantSnapBox) {\n snapParticipant(participantSnapBox, shape, event);\n }\n });\n\n eventBus.on('shape.move.start', function(event) {\n\n var context = event.context,\n shape = context.shape,\n rootElement = canvas.getRootElement();\n\n // snap participant around existing elements (if any)\n if (is(shape, 'bpmn:Participant') && is(rootElement, 'bpmn:Process')) {\n initParticipantSnapping(context, shape, rootElement.children);\n }\n });\n\n\n function canAttach(shape, target, position) {\n return bpmnRules.canAttach([ shape ], target, null, position) === 'attach';\n }\n\n function canConnect(source, target) {\n return bpmnRules.canConnect(source, target);\n }\n\n /**\n * Snap boundary events to elements border\n */\n eventBus.on([\n 'create.move',\n 'create.end',\n 'shape.move.move',\n 'shape.move.end'\n ], HIGH_PRIORITY, function(event) {\n\n var context = event.context,\n target = context.target,\n shape = context.shape;\n\n if (target && !isSnapped(event) && canAttach(shape, target, event)) {\n snapBoundaryEvent(event, shape, target);\n }\n });\n\n /**\n * Adjust parent for flowElements to the target participant\n * when droping onto lanes.\n */\n eventBus.on([\n 'shape.move.hover',\n 'shape.move.move',\n 'shape.move.end',\n 'create.hover',\n 'create.move',\n 'create.end'\n ], HIGH_PRIORITY, function(event) {\n var context = event.context,\n shape = context.shape,\n hover = event.hover;\n\n if (is(hover, 'bpmn:Lane') && !isAny(shape, [ 'bpmn:Lane', 'bpmn:Participant' ])) {\n event.hover = getLanesRoot(hover);\n event.hoverGfx = elementRegistry.getGraphics(event.hover);\n }\n });\n\n /**\n * Snap sequence flows.\n */\n eventBus.on([\n 'connect.move',\n 'connect.hover',\n 'connect.end'\n ], HIGH_PRIORITY, function(event) {\n var context = event.context,\n source = context.source,\n target = context.target;\n\n var connection = canConnect(source, target) || {};\n\n if (!context.initialSourcePosition) {\n context.initialSourcePosition = context.sourcePosition;\n }\n\n if (target && connection.type === 'bpmn:SequenceFlow') {\n\n // snap source\n context.sourcePosition = mid(source);\n\n // snap target\n assign(event, mid(target));\n } else {\n\n // otherwise reset source snap\n context.sourcePosition = context.initialSourcePosition;\n }\n\n });\n\n\n eventBus.on([\n 'create.move',\n 'shape.move.move'\n ], function(event) {\n\n var context = event.context,\n shape = context.shape,\n target = context.target;\n\n var threshold = 30;\n\n if (is(shape, 'bpmn:Lane')) {\n if (isAny(target, [ 'bpmn:Lane', 'bpmn:Participant' ])) {\n\n var childLanes = filter(target.children, function(c) {\n return is(c, 'bpmn:Lane');\n });\n\n var y = event.y,\n targetTrbl;\n\n var insert = childLanes.reduce(function(insert, l) {\n\n var laneTrbl = asTRBL(l);\n\n if (abs(laneTrbl.top - y) < threshold) {\n insert = assign(insert || {}, { before: { element: l, y: laneTrbl.top } });\n } else\n if (abs(laneTrbl.bottom - y) < threshold) {\n insert = assign(insert || {}, { after: { element: l, y: laneTrbl.bottom } });\n } else\n if (laneTrbl.top < y && laneTrbl.bottom > y) {\n if (abs(laneTrbl.top - y) > abs(laneTrbl.bottom - y)) {\n insert = assign(insert || {}, { after: { element: l, y: laneTrbl.bottom } });\n } else {\n insert = assign(insert || {}, { before: { element: l, y: laneTrbl.top } });\n }\n\n }\n\n return insert;\n }, false);\n\n\n if (!insert) {\n targetTrbl = asTRBL(target);\n\n if (abs(targetTrbl.top - y) < threshold) {\n insert = { before: { element: target, y: targetTrbl.top } };\n } else\n if (abs(targetTrbl.bottom - y) < threshold) {\n insert = { after: { element: target, y: targetTrbl.bottom } };\n } else {\n insert = { into: { element: target, y: (targetTrbl.top + targetTrbl.bottom) / 2 } };\n }\n\n }\n\n if (insert.before && insert.after) {\n console.log('insert between', insert.before.element.id, 'and', insert.after.element.id);\n setSnapped(event, 'x', insert.before.element.x + insert.before.element.width / 2);\n setSnapped(event, 'y', insert.before.y);\n } else\n if (insert.after) {\n console.log('insert after', insert.after.element.id);\n setSnapped(event, 'x', insert.after.element.x + insert.after.element.width / 2);\n setSnapped(event, 'y', insert.after.y);\n } else\n if (insert.before) {\n console.log('insert before', insert.before.element.id);\n setSnapped(event, 'x', insert.before.element.x + insert.before.element.width / 2);\n setSnapped(event, 'y', insert.before.y);\n } else\n if (insert.into) {\n console.log('insert into', insert.into.element.id);\n setSnapped(event, 'x', insert.into.element.x + insert.into.element.width / 2);\n setSnapped(event, 'y', insert.into.y);\n }\n }\n }\n\n });\n\n eventBus.on('resize.start', HIGH_PRIORITY, function(event) {\n var context = event.context,\n shape = context.shape;\n\n if (is(shape, 'bpmn:SubProcess') && isExpanded(shape)) {\n context.minDimensions = { width: 140, height: 120 };\n }\n\n if (is(shape, 'bpmn:Participant')) {\n context.minDimensions = { width: 300, height: 150 };\n }\n\n if (is(shape, 'bpmn:Lane') || is(shape, 'bpmn:Participant')) {\n context.resizeConstraints = getParticipantSizeConstraints(shape, context.direction, context.balanced);\n }\n\n if (is(shape, 'bpmn:TextAnnotation')) {\n context.minDimensions = { width: 50, height: 30 };\n }\n });\n\n}\n\ninherits(BpmnSnapping, Snapping);\n\nBpmnSnapping.$inject = [ 'eventBus', 'canvas', 'bpmnRules', 'elementRegistry' ];\n\nmodule.exports = BpmnSnapping;\n\n\nBpmnSnapping.prototype.initSnap = function(event) {\n\n var context = event.context,\n shape = event.shape,\n shapeMid,\n shapeBounds,\n shapeTopLeft,\n shapeBottomRight,\n snapContext;\n\n\n snapContext = Snapping.prototype.initSnap.call(this, event);\n\n if (is(shape, 'bpmn:Participant')) {\n // assign higher priority for outer snaps on participants\n snapContext.setSnapLocations([ 'top-left', 'bottom-right', 'mid' ]);\n }\n\n\n if (shape) {\n\n shapeMid = mid(shape, event);\n\n shapeBounds = {\n width: shape.width,\n height: shape.height,\n x: isNaN(shape.x) ? round(shapeMid.x - shape.width / 2) : shape.x,\n y: isNaN(shape.y) ? round(shapeMid.y - shape.height / 2) : shape.y\n };\n\n shapeTopLeft = topLeft(shapeBounds);\n shapeBottomRight = bottomRight(shapeBounds);\n\n snapContext.setSnapOrigin('top-left', {\n x: shapeTopLeft.x - event.x,\n y: shapeTopLeft.y - event.y\n });\n\n snapContext.setSnapOrigin('bottom-right', {\n x: shapeBottomRight.x - event.x,\n y: shapeBottomRight.y - event.y\n });\n\n forEach(shape.outgoing, function(c) {\n var docking = c.waypoints[0];\n\n docking = docking.original || docking;\n\n snapContext.setSnapOrigin(c.id + '-docking', {\n x: docking.x - event.x,\n y: docking.y - event.y\n });\n });\n\n forEach(shape.incoming, function(c) {\n var docking = c.waypoints[c.waypoints.length - 1];\n\n docking = docking.original || docking;\n\n snapContext.setSnapOrigin(c.id + '-docking', {\n x: docking.x - event.x,\n y: docking.y - event.y\n });\n });\n\n }\n\n var source = context.source;\n\n if (source) {\n snapContext.addDefaultSnap('mid', mid(source));\n }\n};\n\n\nBpmnSnapping.prototype.addTargetSnaps = function(snapPoints, shape, target) {\n\n // use target parent as snap target\n if (is(shape, 'bpmn:BoundaryEvent') && shape.type !== 'label') {\n target = target.parent;\n }\n\n // add sequence flow parents as snap targets\n if (is(target, 'bpmn:SequenceFlow')) {\n this.addTargetSnaps(snapPoints, shape, target.parent);\n }\n\n var siblings = this.getSiblings(shape, target) || [];\n\n forEach(siblings, function(sibling) {\n\n // do not snap to lanes\n if (is(sibling, 'bpmn:Lane')) {\n return;\n }\n\n if (sibling.waypoints) {\n forEach(sibling.waypoints, function(waypoint, i) {\n var nextWaypoint = sibling.waypoints[i+1];\n\n if (!nextWaypoint) {\n return;\n }\n\n if (nextWaypoint.x === waypoint.x || nextWaypoint.y === waypoint.y) {\n snapPoints.add('mid', waypoint);\n }\n });\n\n return;\n }\n\n snapPoints.add('mid', mid(sibling));\n\n if (is(sibling, 'bpmn:Participant')) {\n snapPoints.add('top-left', topLeft(sibling));\n snapPoints.add('bottom-right', bottomRight(sibling));\n }\n });\n\n\n forEach(shape.incoming, function(c) {\n\n if (siblings.indexOf(c.source) === -1) {\n snapPoints.add('mid', mid(c.source));\n }\n\n var docking = c.waypoints[0];\n snapPoints.add(c.id + '-docking', docking.original || docking);\n });\n\n\n forEach(shape.outgoing, function(c) {\n\n if (siblings.indexOf(c.target) === -1) {\n snapPoints.add('mid', mid(c.target));\n }\n\n var docking = c.waypoints[c.waypoints.length - 1];\n snapPoints.add(c.id + '-docking', docking.original || docking);\n });\n};\n\n\n/////// participant snapping //////////////////\n\nfunction initParticipantSnapping(context, shape, elements) {\n\n if (!elements.length) {\n return;\n }\n\n var snapBox = getBoundingBox(elements.filter(function(e) {\n return !e.labelTarget && !e.waypoints;\n }));\n\n snapBox.x -= 50;\n snapBox.y -= 20;\n snapBox.width += 70;\n snapBox.height += 40;\n\n // adjust shape height to include bounding box\n shape.width = Math.max(shape.width, snapBox.width);\n shape.height = Math.max(shape.height, snapBox.height);\n\n context.participantSnapBox = snapBox;\n}\n\nfunction snapParticipant(snapBox, shape, event, offset) {\n offset = offset || 0;\n\n var shapeHalfWidth = shape.width / 2 - offset,\n shapeHalfHeight = shape.height / 2;\n\n var currentTopLeft = {\n x: event.x - shapeHalfWidth - offset,\n y: event.y - shapeHalfHeight\n };\n\n var currentBottomRight = {\n x: event.x + shapeHalfWidth + offset,\n y: event.y + shapeHalfHeight\n };\n\n var snapTopLeft = snapBox,\n snapBottomRight = bottomRight(snapBox);\n\n if (currentTopLeft.x >= snapTopLeft.x) {\n setSnapped(event, 'x', snapTopLeft.x + offset + shapeHalfWidth);\n } else\n if (currentBottomRight.x <= snapBottomRight.x) {\n setSnapped(event, 'x', snapBottomRight.x - offset - shapeHalfWidth);\n }\n\n if (currentTopLeft.y >= snapTopLeft.y) {\n setSnapped(event, 'y', snapTopLeft.y + shapeHalfHeight);\n } else\n if (currentBottomRight.y <= snapBottomRight.y) {\n setSnapped(event, 'y', snapBottomRight.y - shapeHalfHeight);\n }\n}\n\n\n/////// boundary event snapping /////////////////////////\n\n\nfunction snapBoundaryEvent(event, shape, target) {\n var targetTRBL = asTRBL(target);\n\n var direction = getBoundaryAttachment(event, target);\n\n if (/top/.test(direction)) {\n setSnapped(event, 'y', targetTRBL.top);\n } else\n if (/bottom/.test(direction)) {\n setSnapped(event, 'y', targetTRBL.bottom);\n }\n\n if (/left/.test(direction)) {\n setSnapped(event, 'x', targetTRBL.left);\n } else\n if (/right/.test(direction)) {\n setSnapped(event, 'x', targetTRBL.right);\n }\n}\n","'use strict';\n\nvar getOrientation = require(252).getOrientation;\n\n\nfunction getBoundaryAttachment(position, targetBounds) {\n\n var orientation = getOrientation(position, targetBounds, -15);\n\n if (orientation !== 'intersect') {\n return orientation;\n } else {\n return null;\n }\n}\n\nmodule.exports.getBoundaryAttachment = getBoundaryAttachment;\n\n\n\n// participant snapping box implementation /////////////////\n\nvar is = require(95).is;\n\nvar asTRBL = require(252).asTRBL;\n\nvar collectLanes = require(67).collectLanes,\n getLanesRoot = require(67).getLanesRoot;\n\nvar abs = Math.abs,\n min = Math.min,\n max = Math.max;\n\n\nfunction addToTrbl(trbl, attr, value, choice) {\n\n var current = trbl[attr];\n\n // make sure to set the value if it does not exist\n // or apply the correct value by comparing against\n // choice(value, currentValue)\n trbl[attr] = current === undefined ? value : choice(value, current);\n}\n\nfunction addMin(trbl, attr, value) {\n return addToTrbl(trbl, attr, value, min);\n}\n\nfunction addMax(trbl, attr, value) {\n return addToTrbl(trbl, attr, value, max);\n}\n\n\nvar LANE_MIN_HEIGHT = 60,\n LANE_MIN_WIDTH = 300,\n LANE_RIGHT_PADDING = 20,\n LANE_LEFT_PADDING = 50,\n LANE_TOP_PADDING = 20,\n LANE_BOTTOM_PADDING = 20;\n\n\nfunction getParticipantSizeConstraints(laneShape, resizeDirection, balanced) {\n\n var lanesRoot = getLanesRoot(laneShape);\n\n var isFirst = true,\n isLast = true;\n\n ///// max top/bottom size for lanes\n\n var allLanes = collectLanes(lanesRoot, [ lanesRoot ]);\n\n var laneTrbl = asTRBL(laneShape);\n\n var maxTrbl = {},\n minTrbl = {};\n\n if (/e/.test(resizeDirection)) {\n minTrbl.right = laneTrbl.left + LANE_MIN_WIDTH;\n } else\n if (/w/.test(resizeDirection)) {\n minTrbl.left = laneTrbl.right - LANE_MIN_WIDTH;\n }\n\n allLanes.forEach(function(other) {\n\n var otherTrbl = asTRBL(other);\n\n if (/n/.test(resizeDirection)) {\n\n if (otherTrbl.top < (laneTrbl.top - 10)) {\n isFirst = false;\n }\n\n // max top size (based on next element)\n if (balanced && abs(laneTrbl.top - otherTrbl.bottom) < 10) {\n addMax(maxTrbl, 'top', otherTrbl.top + LANE_MIN_HEIGHT);\n }\n\n // min top size (based on self or nested element)\n if (abs(laneTrbl.top - otherTrbl.top) < 5) {\n addMin(minTrbl, 'top', otherTrbl.bottom - LANE_MIN_HEIGHT);\n }\n }\n\n if (/s/.test(resizeDirection)) {\n\n if (otherTrbl.bottom > (laneTrbl.bottom + 10)) {\n isLast = false;\n }\n\n // max bottom size (based on previous element)\n if (balanced && abs(laneTrbl.bottom - otherTrbl.top) < 10) {\n addMin(maxTrbl, 'bottom', otherTrbl.bottom - LANE_MIN_HEIGHT);\n }\n\n // min bottom size (based on self or nested element)\n if (abs(laneTrbl.bottom - otherTrbl.bottom) < 5) {\n addMax(minTrbl, 'bottom', otherTrbl.top + LANE_MIN_HEIGHT);\n }\n }\n });\n\n\n ///// max top/bottom/left/right size based on flow nodes\n\n var flowElements = lanesRoot.children.filter(function(s) {\n return !s.hidden && !s.waypoints && (is(s, 'bpmn:FlowElement') || is(s, 'bpmn:Artifact'));\n });\n\n flowElements.forEach(function(flowElement) {\n\n var flowElementTrbl = asTRBL(flowElement);\n\n if (isFirst && /n/.test(resizeDirection)) {\n addMin(minTrbl, 'top', flowElementTrbl.top - LANE_TOP_PADDING);\n }\n\n if (/e/.test(resizeDirection)) {\n addMax(minTrbl, 'right', flowElementTrbl.right + LANE_RIGHT_PADDING);\n }\n\n if (isLast && /s/.test(resizeDirection)) {\n addMax(minTrbl, 'bottom', flowElementTrbl.bottom + LANE_BOTTOM_PADDING);\n }\n\n if (/w/.test(resizeDirection)) {\n addMin(minTrbl, 'left', flowElementTrbl.left - LANE_LEFT_PADDING);\n }\n });\n\n\n return {\n min: minTrbl,\n max: maxTrbl\n };\n}\n\n\nmodule.exports.getParticipantSizeConstraints = getParticipantSizeConstraints;","module.exports = {\n __init__: [ 'snapping' ],\n snapping: [ 'type', require(85) ]\n};","'use strict';\n\nvar assign = require(431),\n map = require(305);\n\nvar LabelUtil = require(94);\n\nvar TextUtil = require(280);\n\nvar is = require(95).is;\n\nvar hasExternalLabel = LabelUtil.hasExternalLabel,\n getExternalLabelBounds = LabelUtil.getExternalLabelBounds,\n isExpanded = require(93).isExpanded,\n elementToString = require(91).elementToString;\n\n\nfunction elementData(semantic, attrs) {\n return assign({\n id: semantic.id,\n type: semantic.$type,\n businessObject: semantic\n }, attrs);\n}\n\nfunction collectWaypoints(waypoints) {\n return map(waypoints, function(p) {\n return { x: p.x, y: p.y };\n });\n}\n\nfunction notYetDrawn(translate, semantic, refSemantic, property) {\n return new Error(translate('element {element} referenced by {referenced}#{property} not yet drawn', {\n element: elementToString(refSemantic),\n referenced: elementToString(semantic),\n property: property\n }));\n}\n\n\n/**\n * An importer that adds bpmn elements to the canvas\n *\n * @param {EventBus} eventBus\n * @param {Canvas} canvas\n * @param {ElementFactory} elementFactory\n * @param {ElementRegistry} elementRegistry\n */\nfunction BpmnImporter(eventBus, canvas, elementFactory, elementRegistry, translate) {\n this._eventBus = eventBus;\n this._canvas = canvas;\n\n this._elementFactory = elementFactory;\n this._elementRegistry = elementRegistry;\n this._translate = translate;\n\n this._textUtil = new TextUtil();\n}\n\nBpmnImporter.$inject = [ 'eventBus', 'canvas', 'elementFactory', 'elementRegistry', 'translate' ];\n\nmodule.exports = BpmnImporter;\n\n\n/**\n * Add bpmn element (semantic) to the canvas onto the\n * specified parent shape.\n */\nBpmnImporter.prototype.add = function(semantic, parentElement) {\n\n var di = semantic.di,\n element,\n translate = this._translate,\n hidden;\n\n // ROOT ELEMENT\n // handle the special case that we deal with a\n // invisible root element (process or collaboration)\n if (is(di, 'bpmndi:BPMNPlane')) {\n\n // add a virtual element (not being drawn)\n element = this._elementFactory.createRoot(elementData(semantic));\n\n this._canvas.setRootElement(element);\n }\n\n // SHAPE\n else if (is(di, 'bpmndi:BPMNShape')) {\n\n var collapsed = !isExpanded(semantic);\n hidden = parentElement && (parentElement.hidden || parentElement.collapsed);\n\n var bounds = semantic.di.bounds;\n\n element = this._elementFactory.createShape(elementData(semantic, {\n collapsed: collapsed,\n hidden: hidden,\n x: Math.round(bounds.x),\n y: Math.round(bounds.y),\n width: Math.round(bounds.width),\n height: Math.round(bounds.height)\n }));\n\n if (is(semantic, 'bpmn:BoundaryEvent')) {\n this._attachBoundary(semantic, element);\n }\n\n this._canvas.addShape(element, parentElement);\n }\n\n // CONNECTION\n else if (is(di, 'bpmndi:BPMNEdge')) {\n\n var source = this._getSource(semantic),\n target = this._getTarget(semantic);\n\n hidden = parentElement && (parentElement.hidden || parentElement.collapsed);\n\n element = this._elementFactory.createConnection(elementData(semantic, {\n hidden: hidden,\n source: source,\n target: target,\n waypoints: collectWaypoints(semantic.di.waypoint)\n }));\n\n if (is(semantic, 'bpmn:DataAssociation')) {\n\n // render always on top; this ensures DataAssociations\n // are rendered correctly across different \"hacks\" people\n // love to model such as cross participant / sub process\n // associations\n parentElement = null;\n }\n\n this._canvas.addConnection(element, parentElement);\n } else {\n throw new Error(translate('unknown di {di} for element {semantic}', {\n di: elementToString(di),\n semantic: elementToString(semantic)\n }));\n }\n // (optional) LABEL\n if (hasExternalLabel(semantic)) {\n this.addLabel(semantic, element);\n }\n\n\n this._eventBus.fire('bpmnElement.added', { element: element });\n\n return element;\n};\n\n\n/**\n * Attach the boundary element to the given host\n *\n * @param {ModdleElement} boundarySemantic\n * @param {djs.model.Base} boundaryElement\n */\nBpmnImporter.prototype._attachBoundary = function(boundarySemantic, boundaryElement) {\n var translate = this._translate;\n var hostSemantic = boundarySemantic.attachedToRef;\n\n if (!hostSemantic) {\n throw new Error(translate('missing {semantic}#attachedToRef', {\n semantic: elementToString(boundarySemantic)\n }));\n }\n\n var host = this._elementRegistry.get(hostSemantic.id),\n attachers = host && host.attachers;\n\n if (!host) {\n throw notYetDrawn(translate, boundarySemantic, hostSemantic, 'attachedToRef');\n }\n\n // wire element.host <> host.attachers\n boundaryElement.host = host;\n\n if (!attachers) {\n host.attachers = attachers = [];\n }\n\n if (attachers.indexOf(boundaryElement) === -1) {\n attachers.push(boundaryElement);\n }\n};\n\n\n/**\n * add label for an element\n */\nBpmnImporter.prototype.addLabel = function(semantic, element) {\n var bounds,\n text,\n label;\n\n bounds = getExternalLabelBounds(semantic, element);\n\n text = semantic.name;\n\n if (text) {\n // get corrected bounds from actual layouted text\n bounds = getLayoutedBounds(bounds, text, this._textUtil);\n }\n\n label = this._elementFactory.createLabel(elementData(semantic, {\n id: semantic.id + '_label',\n labelTarget: element,\n type: 'label',\n hidden: element.hidden || !semantic.name,\n x: Math.round(bounds.x),\n y: Math.round(bounds.y),\n width: Math.round(bounds.width),\n height: Math.round(bounds.height)\n }));\n\n return this._canvas.addShape(label, element.parent);\n};\n\n/**\n * Return the drawn connection end based on the given side.\n *\n * @throws {Error} if the end is not yet drawn\n */\nBpmnImporter.prototype._getEnd = function(semantic, side) {\n\n var element,\n refSemantic,\n type = semantic.$type,\n translate = this._translate;\n\n refSemantic = semantic[side + 'Ref'];\n\n // handle mysterious isMany DataAssociation#sourceRef\n if (side === 'source' && type === 'bpmn:DataInputAssociation') {\n refSemantic = refSemantic && refSemantic[0];\n }\n\n // fix source / target for DataInputAssociation / DataOutputAssociation\n if (side === 'source' && type === 'bpmn:DataOutputAssociation' ||\n side === 'target' && type === 'bpmn:DataInputAssociation') {\n\n refSemantic = semantic.$parent;\n }\n\n element = refSemantic && this._getElement(refSemantic);\n\n if (element) {\n return element;\n }\n\n if (refSemantic) {\n throw notYetDrawn(translate, semantic, refSemantic, side + 'Ref');\n } else {\n throw new Error(translate('{semantic}#{side} Ref not specified', {\n semantic: elementToString(semantic),\n side: side\n }));\n }\n};\n\nBpmnImporter.prototype._getSource = function(semantic) {\n return this._getEnd(semantic, 'source');\n};\n\nBpmnImporter.prototype._getTarget = function(semantic) {\n return this._getEnd(semantic, 'target');\n};\n\n\nBpmnImporter.prototype._getElement = function(semantic) {\n return this._elementRegistry.get(semantic.id);\n};\n\n\n// TODO(nikku): repeating code (search for )\n\nvar EXTERNAL_LABEL_STYLE = {\n fontFamily: 'Arial, sans-serif',\n fontSize: '11px'\n};\n\nfunction getLayoutedBounds(bounds, text, textUtil) {\n\n var layoutedLabelDimensions = textUtil.getDimensions(text, {\n box: {\n width: 90,\n height: 30,\n x: bounds.width / 2 + bounds.x,\n y: bounds.height / 2 + bounds.y\n },\n style: EXTERNAL_LABEL_STYLE\n });\n\n // resize label shape to fit label text\n return {\n x: Math.round(bounds.x + bounds.width / 2 - layoutedLabelDimensions.width / 2),\n y: Math.round(bounds.y),\n width: Math.ceil(layoutedLabelDimensions.width),\n height: Math.ceil(layoutedLabelDimensions.height)\n };\n}","'use strict';\n\nvar filter = require(301),\n find = require(302),\n forEach = require(303);\n\nvar Refs = require(466);\n\nvar elementToString = require(91).elementToString;\n\nvar diRefs = new Refs({ name: 'bpmnElement', enumerable: true }, { name: 'di' });\n\n/**\n * Returns true if an element has the given meta-model type\n *\n * @param {ModdleElement} element\n * @param {String} type\n *\n * @return {Boolean}\n */\nfunction is(element, type) {\n return element.$instanceOf(type);\n}\n\n\n/**\n * Find a suitable display candidate for definitions where the DI does not\n * correctly specify one.\n */\nfunction findDisplayCandidate(definitions) {\n return find(definitions.rootElements, function(e) {\n return is(e, 'bpmn:Process') || is(e, 'bpmn:Collaboration');\n });\n}\n\n\nfunction BpmnTreeWalker(handler, translate) {\n\n // list of containers already walked\n var handledElements = {};\n\n // list of elements to handle deferred to ensure\n // prerequisites are drawn\n var deferred = [];\n\n ///// Helpers /////////////////////////////////\n\n function contextual(fn, ctx) {\n return function(e) {\n fn(e, ctx);\n };\n }\n\n function handled(element) {\n handledElements[element.id] = element;\n }\n\n function isHandled(element) {\n return handledElements[element.id];\n }\n\n function visit(element, ctx) {\n\n var gfx = element.gfx;\n\n // avoid multiple rendering of elements\n if (gfx) {\n throw new Error(\n translate('already rendered {element}', { element: elementToString(element) })\n );\n }\n\n // call handler\n return handler.element(element, ctx);\n }\n\n function visitRoot(element, diagram) {\n return handler.root(element, diagram);\n }\n\n function visitIfDi(element, ctx) {\n\n try {\n var gfx = element.di && visit(element, ctx);\n\n handled(element);\n\n return gfx;\n } catch (e) {\n logError(e.message, { element: element, error: e });\n\n console.error(translate('failed to import {element}', { element: elementToString(element) }));\n console.error(e);\n }\n }\n\n function logError(message, context) {\n handler.error(message, context);\n }\n\n ////// DI handling ////////////////////////////\n\n function registerDi(di) {\n var bpmnElement = di.bpmnElement;\n\n if (bpmnElement) {\n if (bpmnElement.di) {\n logError(\n translate('multiple DI elements defined for {element}', {\n element: elementToString(bpmnElement)\n }),\n { element: bpmnElement }\n );\n } else {\n diRefs.bind(bpmnElement, 'di');\n bpmnElement.di = di;\n }\n } else {\n logError(\n translate('no bpmnElement referenced in {element}', {\n element: elementToString(di)\n }),\n { element: di }\n );\n }\n }\n\n function handleDiagram(diagram) {\n handlePlane(diagram.plane);\n }\n\n function handlePlane(plane) {\n registerDi(plane);\n\n forEach(plane.planeElement, handlePlaneElement);\n }\n\n function handlePlaneElement(planeElement) {\n registerDi(planeElement);\n }\n\n\n ////// Semantic handling //////////////////////\n\n /**\n * Handle definitions and return the rendered diagram (if any)\n *\n * @param {ModdleElement} definitions to walk and import\n * @param {ModdleElement} [diagram] specific diagram to import and display\n *\n * @throws {Error} if no diagram to display could be found\n */\n function handleDefinitions(definitions, diagram) {\n // make sure we walk the correct bpmnElement\n\n var diagrams = definitions.diagrams;\n\n if (diagram && diagrams.indexOf(diagram) === -1) {\n throw new Error(translate('diagram not part of bpmn:Definitions'));\n }\n\n if (!diagram && diagrams && diagrams.length) {\n diagram = diagrams[0];\n }\n\n // no diagram -> nothing to import\n if (!diagram) {\n throw new Error(translate('no diagram to display'));\n }\n\n // load DI from selected diagram only\n handleDiagram(diagram);\n\n\n var plane = diagram.plane;\n\n if (!plane) {\n throw new Error(translate(\n 'no plane for {element}',\n { element: elementToString(diagram) }\n ));\n }\n\n var rootElement = plane.bpmnElement;\n\n // ensure we default to a suitable display candidate (process or collaboration),\n // even if non is specified in DI\n if (!rootElement) {\n rootElement = findDisplayCandidate(definitions);\n\n if (!rootElement) {\n throw new Error(translate('no process or collaboration to display'));\n } else {\n\n logError(\n translate('correcting missing bpmnElement on {plane} to {rootElement}', {\n plane: elementToString(plane),\n rootElement: elementToString(rootElement)\n })\n );\n\n // correct DI on the fly\n plane.bpmnElement = rootElement;\n registerDi(plane);\n }\n }\n\n\n var ctx = visitRoot(rootElement, plane);\n\n if (is(rootElement, 'bpmn:Process')) {\n handleProcess(rootElement, ctx);\n } else if (is(rootElement, 'bpmn:Collaboration')) {\n handleCollaboration(rootElement, ctx);\n\n // force drawing of everything not yet drawn that is part of the target DI\n handleUnhandledProcesses(definitions.rootElements, ctx);\n } else {\n throw new Error(\n translate('unsupported bpmnElement for {plane}: {rootElement}', {\n plane: elementToString(plane),\n rootElement: elementToString(rootElement)\n })\n );\n }\n\n // handle all deferred elements\n handleDeferred(deferred);\n }\n\n function handleDeferred(deferred) {\n forEach(deferred, function(d) { d(); });\n }\n\n function handleProcess(process, context) {\n handleFlowElementsContainer(process, context);\n handleIoSpecification(process.ioSpecification, context);\n\n handleArtifacts(process.artifacts, context);\n\n // log process handled\n handled(process);\n }\n\n function handleUnhandledProcesses(rootElements) {\n\n // walk through all processes that have not yet been drawn and draw them\n // if they contain lanes with DI information.\n // we do this to pass the free-floating lane test cases in the MIWG test suite\n var processes = filter(rootElements, function(e) {\n return !isHandled(e) && is(e, 'bpmn:Process') && e.laneSets;\n });\n\n processes.forEach(contextual(handleProcess));\n }\n\n function handleMessageFlow(messageFlow, context) {\n visitIfDi(messageFlow, context);\n }\n\n function handleMessageFlows(messageFlows, context) {\n forEach(messageFlows, contextual(handleMessageFlow, context));\n }\n\n function handleDataAssociation(association, context) {\n visitIfDi(association, context);\n }\n\n function handleDataInput(dataInput, context) {\n visitIfDi(dataInput, context);\n }\n\n function handleDataOutput(dataOutput, context) {\n visitIfDi(dataOutput, context);\n }\n\n function handleArtifact(artifact, context) {\n\n // bpmn:TextAnnotation\n // bpmn:Group\n // bpmn:Association\n\n visitIfDi(artifact, context);\n }\n\n function handleArtifacts(artifacts, context) {\n\n forEach(artifacts, function(e) {\n if (is(e, 'bpmn:Association')) {\n deferred.push(function() {\n handleArtifact(e, context);\n });\n } else {\n handleArtifact(e, context);\n }\n });\n }\n\n function handleIoSpecification(ioSpecification, context) {\n\n if (!ioSpecification) {\n return;\n }\n\n forEach(ioSpecification.dataInputs, contextual(handleDataInput, context));\n forEach(ioSpecification.dataOutputs, contextual(handleDataOutput, context));\n }\n\n function handleSubProcess(subProcess, context) {\n handleFlowElementsContainer(subProcess, context);\n handleArtifacts(subProcess.artifacts, context);\n }\n\n function handleFlowNode(flowNode, context) {\n var childCtx = visitIfDi(flowNode, context);\n\n if (is(flowNode, 'bpmn:SubProcess')) {\n handleSubProcess(flowNode, childCtx || context);\n }\n\n if (is(flowNode, 'bpmn:Activity')) {\n handleIoSpecification(flowNode.ioSpecification, context);\n }\n\n // defer handling of associations\n // affected types:\n //\n // * bpmn:Activity\n // * bpmn:ThrowEvent\n // * bpmn:CatchEvent\n //\n deferred.push(function() {\n forEach(flowNode.dataInputAssociations, contextual(handleDataAssociation, context));\n forEach(flowNode.dataOutputAssociations, contextual(handleDataAssociation, context));\n });\n }\n\n function handleSequenceFlow(sequenceFlow, context) {\n visitIfDi(sequenceFlow, context);\n }\n\n function handleDataElement(dataObject, context) {\n visitIfDi(dataObject, context);\n }\n\n function handleBoundaryEvent(dataObject, context) {\n visitIfDi(dataObject, context);\n }\n\n function handleLane(lane, context) {\n var newContext = visitIfDi(lane, context);\n\n if (lane.childLaneSet) {\n handleLaneSet(lane.childLaneSet, newContext || context);\n }\n\n wireFlowNodeRefs(lane);\n }\n\n function handleLaneSet(laneSet, context) {\n forEach(laneSet.lanes, contextual(handleLane, context));\n }\n\n function handleLaneSets(laneSets, context) {\n forEach(laneSets, contextual(handleLaneSet, context));\n }\n\n function handleFlowElementsContainer(container, context) {\n if (container.laneSets) {\n handleLaneSets(container.laneSets, context);\n }\n\n handleFlowElements(container.flowElements, context);\n }\n\n function handleFlowElements(flowElements, context) {\n forEach(flowElements, function(e) {\n if (is(e, 'bpmn:SequenceFlow')) {\n deferred.push(function() {\n handleSequenceFlow(e, context);\n });\n } else if (is(e, 'bpmn:BoundaryEvent')) {\n deferred.unshift(function() {\n handleBoundaryEvent(e, context);\n });\n } else if (is(e, 'bpmn:FlowNode')) {\n handleFlowNode(e, context);\n } else if (is(e, 'bpmn:DataObject')) {\n // SKIP (assume correct referencing via DataObjectReference)\n } else if (is(e, 'bpmn:DataStoreReference')) {\n handleDataElement(e, context);\n } else if (is(e, 'bpmn:DataObjectReference')) {\n handleDataElement(e, context);\n } else {\n logError(\n translate('unrecognized flowElement {element} in context {context}', {\n element: elementToString(e),\n context: (context ? elementToString(context.businessObject) : 'null')\n }),\n { element: e, context: context }\n );\n }\n });\n }\n\n function handleParticipant(participant, context) {\n var newCtx = visitIfDi(participant, context);\n\n var process = participant.processRef;\n if (process) {\n handleProcess(process, newCtx || context);\n }\n }\n\n function handleCollaboration(collaboration) {\n\n forEach(collaboration.participants, contextual(handleParticipant));\n\n handleArtifacts(collaboration.artifacts);\n\n // handle message flows latest in the process\n deferred.push(function() {\n handleMessageFlows(collaboration.messageFlows);\n });\n }\n\n\n function wireFlowNodeRefs(lane) {\n // wire the virtual flowNodeRefs <-> relationship\n forEach(lane.flowNodeRef, function(flowNode) {\n var lanes = flowNode.get('lanes');\n\n if (lanes) {\n lanes.push(lane);\n }\n });\n }\n\n ///// API ////////////////////////////////\n\n return {\n handleDefinitions: handleDefinitions\n };\n}\n\nmodule.exports = BpmnTreeWalker;","'use strict';\n\nvar BpmnTreeWalker = require(89);\n\n\n/**\n * Import the definitions into a diagram.\n *\n * Errors and warnings are reported through the specified callback.\n *\n * @param {Diagram} diagram\n * @param {ModdleElement} definitions\n * @param {Function} done the callback, invoked with (err, [ warning ]) once the import is done\n */\nfunction importBpmnDiagram(diagram, definitions, done) {\n\n var importer = diagram.get('bpmnImporter'),\n eventBus = diagram.get('eventBus'),\n translate = diagram.get('translate');\n\n var error,\n warnings = [];\n\n /**\n * Walk the diagram semantically, importing (=drawing)\n * all elements you encounter.\n *\n * @param {ModdleElement} definitions\n */\n function render(definitions) {\n\n var visitor = {\n\n root: function(element) {\n return importer.add(element);\n },\n\n element: function(element, parentShape) {\n return importer.add(element, parentShape);\n },\n\n error: function(message, context) {\n warnings.push({ message: message, context: context });\n }\n };\n\n var walker = new BpmnTreeWalker(visitor, translate);\n\n // traverse BPMN 2.0 document model,\n // starting at definitions\n walker.handleDefinitions(definitions);\n }\n\n eventBus.fire('import.render.start', { definitions: definitions });\n\n try {\n render(definitions);\n } catch (e) {\n error = e;\n }\n\n eventBus.fire('import.render.complete', {\n error: error,\n warnings: warnings\n });\n\n done(error, warnings);\n}\n\nmodule.exports.importBpmnDiagram = importBpmnDiagram;","'use strict';\n\nmodule.exports.elementToString = function(e) {\n if (!e) {\n return '';\n }\n\n return '<' + e.$type + (e.id ? ' id=\"' + e.id : '') + '\" />';\n};","module.exports = {\n __depends__: [\n require(248)\n ],\n bpmnImporter: [ 'type', require(88) ]\n};","'use strict';\n\nvar is = require(95).is,\n getBusinessObject = require(95).getBusinessObject;\n\nvar forEach = require(303);\n\nmodule.exports.isExpanded = function(element) {\n\n if (is(element, 'bpmn:CallActivity')) {\n return false;\n }\n\n if (is(element, 'bpmn:SubProcess')) {\n return !!getBusinessObject(element).di.isExpanded;\n }\n\n if (is(element, 'bpmn:Participant')) {\n return !!getBusinessObject(element).processRef;\n }\n\n return true;\n};\n\nmodule.exports.isInterrupting = function(element) {\n return element && getBusinessObject(element).isInterrupting !== false;\n};\n\nmodule.exports.isEventSubProcess = function(element) {\n return element && !!getBusinessObject(element).triggeredByEvent;\n};\n\nfunction hasEventDefinition(element, eventType) {\n var bo = getBusinessObject(element),\n hasEventDefinition = false;\n\n if (bo.eventDefinitions) {\n forEach(bo.eventDefinitions, function(event) {\n if (is(event, eventType)) {\n hasEventDefinition = true;\n }\n });\n }\n\n return hasEventDefinition;\n}\n\nmodule.exports.hasEventDefinition = hasEventDefinition;\n\nmodule.exports.hasErrorEventDefinition = function(element) {\n return hasEventDefinition(element, 'bpmn:ErrorEventDefinition');\n};\n\nmodule.exports.hasEscalationEventDefinition = function(element) {\n return hasEventDefinition(element, 'bpmn:EscalationEventDefinition');\n};\n\nmodule.exports.hasCompensateEventDefinition = function(element) {\n return hasEventDefinition(element, 'bpmn:CompensateEventDefinition');\n};\n","'use strict';\n\nvar assign = require(431);\n\nvar is = require(95).is;\n\nvar DEFAULT_LABEL_SIZE = module.exports.DEFAULT_LABEL_SIZE = {\n width: 90,\n height: 20\n};\n\nvar FLOW_LABEL_INDENT = module.exports.FLOW_LABEL_INDENT = 15;\n\n\n/**\n * Returns true if the given semantic has an external label\n *\n * @param {BpmnElement} semantic\n * @return {Boolean} true if has label\n */\nmodule.exports.hasExternalLabel = function(semantic) {\n return is(semantic, 'bpmn:Event') ||\n is(semantic, 'bpmn:Gateway') ||\n is(semantic, 'bpmn:DataStoreReference') ||\n is(semantic, 'bpmn:DataObjectReference') ||\n is(semantic, 'bpmn:SequenceFlow') ||\n is(semantic, 'bpmn:MessageFlow');\n};\n\n/**\n * Get the position for sequence flow labels\n *\n * @param {Array} waypoints\n * @return {Point} the label position\n */\nfunction getFlowLabelPosition(waypoints) {\n\n // get the waypoints mid\n var mid = waypoints.length / 2 - 1;\n\n var first = waypoints[Math.floor(mid)];\n var second = waypoints[Math.ceil(mid + 0.01)];\n\n // get position\n var position = getWaypointsMid(waypoints);\n\n // calculate angle\n var angle = Math.atan( (second.y - first.y) / (second.x - first.x) );\n\n var x = position.x,\n y = position.y;\n\n if ( Math.abs(angle) < Math.PI / 2 ) {\n y -= FLOW_LABEL_INDENT;\n } else {\n x += FLOW_LABEL_INDENT;\n }\n\n return { x: x, y: y };\n}\n\nmodule.exports.getFlowLabelPosition = getFlowLabelPosition;\n\n/**\n * Get the middle of a number of waypoints\n *\n * @param {Array} waypoints\n * @return {Point} the mid point\n */\nfunction getWaypointsMid(waypoints) {\n\n var mid = waypoints.length / 2 - 1;\n\n var first = waypoints[Math.floor(mid)];\n var second = waypoints[Math.ceil(mid + 0.01)];\n\n return {\n x: first.x + (second.x - first.x) / 2,\n y: first.y + (second.y - first.y) / 2\n };\n}\n\nmodule.exports.getWaypointsMid = getWaypointsMid;\n\n\nfunction getExternalLabelMid(element) {\n\n if (element.waypoints) {\n return getFlowLabelPosition(element.waypoints);\n } else {\n return {\n x: element.x + element.width / 2,\n y: element.y + element.height + DEFAULT_LABEL_SIZE.height / 2\n };\n }\n}\n\nmodule.exports.getExternalLabelMid = getExternalLabelMid;\n\n\n/**\n * Returns the bounds of an elements label, parsed from the elements DI or\n * generated from its bounds.\n *\n * @param {BpmnElement} semantic\n * @param {djs.model.Base} element\n */\nmodule.exports.getExternalLabelBounds = function(semantic, element) {\n\n var mid,\n size,\n bounds,\n di = semantic.di,\n label = di.label;\n\n if (label && label.bounds) {\n bounds = label.bounds;\n\n size = {\n width: Math.max(DEFAULT_LABEL_SIZE.width, bounds.width),\n height: bounds.height\n };\n\n mid = {\n x: bounds.x + bounds.width / 2,\n y: bounds.y + bounds.height / 2\n };\n } else {\n\n mid = getExternalLabelMid(element);\n\n size = DEFAULT_LABEL_SIZE;\n }\n\n return assign({\n x: mid.x - size.width / 2,\n y: mid.y - size.height / 2\n }, size);\n};\n","'use strict';\n\n/**\n * Is an element of the given BPMN type?\n *\n * @param {djs.model.Base|ModdleElement} element\n * @param {String} type\n *\n * @return {Boolean}\n */\nfunction is(element, type) {\n var bo = getBusinessObject(element);\n\n return bo && (typeof bo.$instanceOf === 'function') && bo.$instanceOf(type);\n}\n\nmodule.exports.is = is;\n\n\n/**\n * Return the business object for a given element.\n *\n * @param {djs.model.Base|ModdleElement} element\n *\n * @return {ModdleElement}\n */\nfunction getBusinessObject(element) {\n return (element && element.businessObject) || element;\n}\n\nmodule.exports.getBusinessObject = getBusinessObject;\n","/**\n * This file must not be changed or exchanged.\n *\n * @see http://bpmn.io/license for more information.\n */\n\n'use strict';\n\nvar domify = require(449);\n\nvar domDelegate = require(448);\n\n/* jshint -W101 */\n\n// inlined ../resources/bpmnjs.png\nvar logoData = module.exports.BPMNIO_LOGO = 'iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAMAAADypuvZAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADBQTFRFiMte9PrwldFwfcZPqtqN0+zEyOe1XLgjvuKncsJAZ70y6fXh3vDT////UrQV////G2zN+AAAABB0Uk5T////////////////////AOAjXRkAAAHDSURBVHjavJZJkoUgDEBJmAX8979tM8u3E6x20VlYJfFFMoL4vBDxATxZcakIOJTWSmxvKWVIkJ8jHvlRv1F2LFrVISCZI+tCtQx+XfewgVTfyY3plPiQEAzI3zWy+kR6NBhFBYeBuscJLOUuA2WVLpCjVIaFzrNQZArxAZKUQm6gsj37L9Cb7dnIBUKxENaaMJQqMpDXvSL+ktxdGRm2IsKgJGGPg7atwUG5CcFUEuSv+CwQqizTrvDTNXdMU2bMiDWZd8d7QIySWVRsb2vBBioxOFt4OinPBapL+neAb5KL5IJ8szOza2/DYoipUCx+CjO0Bpsv0V6mktNZ+k8rlABlWG0FrOpKYVo8DT3dBeLEjUBAj7moDogVii7nSS9QzZnFcOVBp1g2PyBQ3Vr5aIapN91VJy33HTJLC1iX2FY6F8gRdaAeIEfVONgtFCzZTmoLEdOjBDfsIOA6128gw3eu1shAajdZNAORxuQDJN5A5PbEG6gNIu24QJD5iNyRMZIr6bsHbCtCU/OaOaSvgkUyDMdDa1BXGf5HJ1To+/Ym6mCKT02Y+/Sa126ZKyd3jxhzpc1r8zVL6YM1Qy/kR4ABAFJ6iQUnivhAAAAAAElFTkSuQmCC';\n\n/* jshint +W101 */\n\n\nfunction css(attrs) {\n return attrs.join(';');\n}\n\nvar LIGHTBOX_STYLES = css([\n 'z-index: 1001',\n 'position: fixed',\n 'top: 0',\n 'left: 0',\n 'right: 0',\n 'bottom: 0'\n]);\n\nvar BACKDROP_STYLES = css([\n 'width: 100%',\n 'height: 100%',\n 'background: rgba(0,0,0,0.2)'\n]);\n\nvar NOTICE_STYLES = css([\n 'position: absolute',\n 'left: 50%',\n 'top: 40%',\n 'margin: 0 -130px',\n 'width: 260px',\n 'padding: 10px',\n 'background: white',\n 'border: solid 1px #AAA',\n 'border-radius: 3px',\n 'font-family: Helvetica, Arial, sans-serif',\n 'font-size: 14px',\n 'line-height: 1.2em'\n]);\n\nvar LIGHTBOX_MARKUP =\n '
' +\n '
' +\n '
' +\n '' +\n '' +\n '' +\n 'Web-based tooling for BPMN, DMN and CMMN diagrams ' +\n 'powered by bpmn.io.' +\n '
' +\n '
';\n\n\nvar lightbox;\n\nfunction open() {\n\n if (!lightbox) {\n lightbox = domify(LIGHTBOX_MARKUP);\n\n domDelegate.bind(lightbox, '.backdrop', 'click', function(event) {\n document.body.removeChild(lightbox);\n });\n }\n\n document.body.appendChild(lightbox);\n}\n\nmodule.exports.open = open;","'use strict';\n\nvar forEach = require(303),\n filter = require(301),\n any = require(299),\n sort = require(310),\n isArray = require(422);\n\nvar IGNORED_PROPERTIES = require(98).IGNORED_PROPERTIES;\n\nfunction isAllowedIn(extProp, type) {\n var allowedIn = extProp.meta.allowedIn;\n\n // '*' is a wildcard, which means any element is allowed to use this property\n if (allowedIn.length === 1 && allowedIn[0] === '*') {\n return true;\n }\n\n return allowedIn.indexOf(type) !== -1;\n}\n\nfunction isType(element, types) {\n return any(types, function(type) {\n return typeof element === type;\n });\n}\n\n/**\n * A bpmn properties cloning interface\n *\n */\nfunction ModelCloneHelper(eventBus) {\n this._eventBus = eventBus;\n}\n\nmodule.exports = ModelCloneHelper;\n\n\nModelCloneHelper.prototype.clone = function(refElement, newElement, properties) {\n // hasNestedProperty: property allows us to avoid ending up with empty (xml) tags\n // f.ex: if extensionElements.values is empty, don't set it\n var context = {\n newElement: newElement,\n hasNestedProperty: false\n };\n\n // we want the extensionElements to be cloned last\n // so that they can check certain properties\n properties = sort(properties, function(prop) {\n return prop === 'bpmn:extensionElements';\n });\n\n forEach(properties, function(propName) {\n var refElementProp = refElement.get(propName),\n newElementProp = newElement.get(propName),\n propDescriptor = newElement.$model.getPropertyDescriptor(newElement, propName),\n newProperty, name;\n\n // we're not interested in cloning:\n // - same values from simple types\n // - cloning id's\n // - cloning reference elements\n if (newElementProp === refElementProp ||\n (propDescriptor && (propDescriptor.isId || propDescriptor.isReference))) {\n return;\n }\n\n // if the property is of type 'boolean', 'string', 'number' or 'null', just set it\n if (isType(refElementProp, [ 'boolean', 'string', 'number' ]) || refElementProp === null) {\n newElement.set(propName, refElementProp);\n\n return;\n }\n\n if (isArray(refElementProp)) {\n\n forEach(refElementProp, function(extElement) {\n var newProp;\n\n context.refTopLevelProperty = extElement;\n\n newProp = this._deepClone(extElement, context);\n\n if (context.hasNestedProperty) {\n newProp.$parent = newElement;\n\n newElementProp.push(newProp);\n }\n\n context.hasNestedProperty = false;\n }, this);\n\n } else {\n name = propName.replace(/bpmn:/, '');\n\n context.refTopLevelProperty = refElementProp;\n\n newProperty = this._deepClone(refElementProp, context);\n\n if (context.hasNestedProperty) {\n newElement[name] = newProperty;\n }\n\n context.hasNestedProperty = false;\n }\n }, this);\n\n return newElement;\n};\n\nModelCloneHelper.prototype._deepClone = function _deepClone(propertyElement, context) {\n var eventBus = this._eventBus;\n\n var newProp = propertyElement.$model.create(propertyElement.$type);\n\n var properties = filter(Object.keys(propertyElement), function(prop) {\n var descriptor = newProp.$model.getPropertyDescriptor(newProp, prop);\n\n if (descriptor && (descriptor.isId || descriptor.isReference)) {\n return false;\n }\n\n // we need to make sure we don't clone certain properties\n // which we cannot easily know if they hold references or not\n if (IGNORED_PROPERTIES.indexOf(prop) !== -1) {\n return false;\n }\n\n // make sure we don't copy the type\n return prop !== '$type';\n });\n\n if (!properties.length) {\n context.hasNestedProperty = true;\n }\n\n forEach(properties, function(propName) {\n // check if the propertyElement has this property defined\n if (propertyElement[propName] !== undefined &&\n (propertyElement[propName].$type || isArray(propertyElement[propName]))) {\n\n if (isArray(propertyElement[propName])) {\n newProp[propName] = [];\n\n forEach(propertyElement[propName], function(property) {\n var extProp = propertyElement.$model.getTypeDescriptor(property.$type),\n newDeepProp;\n\n // we're not going to copy undefined types\n if (!extProp) {\n return;\n }\n\n var canClone = eventBus.fire('property.clone', {\n newElement: context.newElement,\n refTopLevelProperty: context.refTopLevelProperty,\n propertyDescriptor: extProp\n });\n\n if (!canClone) {\n // if can clone is 'undefined' or 'false'\n // check for the meta information if it is allowed\n if (propertyElement.$type === 'bpmn:ExtensionElements' &&\n extProp.meta && extProp.meta.allowedIn &&\n !isAllowedIn(extProp, context.newElement.$type)) {\n return false;\n }\n }\n\n newDeepProp = this._deepClone(property, context);\n\n newDeepProp.$parent = newProp;\n\n if (!newProp[propName]) {\n newProp[propName] = [];\n }\n\n context.hasNestedProperty = true;\n\n newProp[propName].push(newDeepProp);\n }, this);\n\n } else if (propertyElement[propName].$type) {\n newProp[propName] = this._deepClone(propertyElement[propName], context);\n\n if (newProp[propName]) {\n context.hasNestedProperty = true;\n\n newProp[propName].$parent = newProp;\n }\n }\n } else {\n context.hasNestedProperty = true;\n\n // just assign directly if it's a value\n newProp[propName] = propertyElement[propName];\n }\n }, this);\n\n return newProp;\n};\n","'use strict';\n\nvar forEach = require(303);\n\n/**\n * These are the properties that should be ignored when cloning elements.\n *\n * @type {Array}\n */\nmodule.exports.IGNORED_PROPERTIES = [\n 'lanes',\n 'incoming',\n 'outgoing',\n 'artifacts',\n 'default',\n 'flowElements'\n];\n\n\nfunction getProperties(descriptor, keepDefault) {\n var properties = [];\n\n forEach(descriptor.properties, function(property) {\n\n if (keepDefault && property.default) {\n return;\n }\n\n properties.push(property.ns.name);\n });\n\n return properties;\n}\n\nmodule.exports.getProperties = getProperties;\n","module.exports = require(101);","'use strict';\n\nvar isString = require(428),\n isFunction = require(423),\n assign = require(431);\n\nvar Moddle = require(457),\n XmlReader = require(455),\n XmlWriter = require(456);\n\n/**\n * A sub class of {@link Moddle} with support for import and export of BPMN 2.0 xml files.\n *\n * @class BpmnModdle\n * @extends Moddle\n *\n * @param {Object|Array} packages to use for instantiating the model\n * @param {Object} [options] additional options to pass over\n */\nfunction BpmnModdle(packages, options) {\n Moddle.call(this, packages, options);\n}\n\nBpmnModdle.prototype = Object.create(Moddle.prototype);\n\nmodule.exports = BpmnModdle;\n\n\n/**\n * Instantiates a BPMN model tree from a given xml string.\n *\n * @param {String} xmlStr\n * @param {String} [typeName='bpmn:Definitions'] name of the root element\n * @param {Object} [options] options to pass to the underlying reader\n * @param {Function} done callback that is invoked with (err, result, parseContext)\n * once the import completes\n */\nBpmnModdle.prototype.fromXML = function(xmlStr, typeName, options, done) {\n\n if (!isString(typeName)) {\n done = options;\n options = typeName;\n typeName = 'bpmn:Definitions';\n }\n\n if (isFunction(options)) {\n done = options;\n options = {};\n }\n\n var reader = new XmlReader(assign({ model: this, lax: true }, options));\n var rootHandler = reader.handler(typeName);\n\n reader.fromXML(xmlStr, rootHandler, done);\n};\n\n\n/**\n * Serializes a BPMN 2.0 object tree to XML.\n *\n * @param {String} element the root element, typically an instance of `bpmn:Definitions`\n * @param {Object} [options] to pass to the underlying writer\n * @param {Function} done callback invoked with (err, xmlStr) once the import completes\n */\nBpmnModdle.prototype.toXML = function(element, options, done) {\n\n if (isFunction(options)) {\n done = options;\n options = {};\n }\n\n var writer = new XmlWriter(options);\n try {\n var result = writer.toXML(element);\n done(null, result);\n } catch (e) {\n done(e);\n }\n};\n","'use strict';\n\nvar assign = require(431);\n\nvar BpmnModdle = require(100);\n\nvar packages = {\n bpmn: require(103),\n bpmndi: require(104),\n dc: require(105),\n di: require(106),\n bioc: require(102)\n};\n\nmodule.exports = function(additionalPackages, options) {\n return new BpmnModdle(assign({}, packages, additionalPackages), options);\n};\n","module.exports={\r\n \"name\": \"bpmn.io colors for BPMN\",\r\n \"uri\": \"http://bpmn.io/schema/bpmn/biocolor/1.0\",\r\n \"prefix\": \"bioc\",\r\n \"types\": [\r\n {\r\n \"name\": \"ColoredShape\",\r\n \"extends\": [ \"bpmndi:BPMNShape\" ],\r\n \"properties\": [\r\n {\r\n \"name\": \"stroke\",\r\n \"isAttr\": true,\r\n \"type\": \"String\"\r\n },\r\n {\r\n \"name\": \"fill\",\r\n \"isAttr\": true,\r\n \"type\": \"String\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"ColoredEdge\",\r\n \"extends\": [ \"bpmndi:BPMNEdge\" ],\r\n \"properties\": [\r\n {\r\n \"name\": \"stroke\",\r\n \"isAttr\": true,\r\n \"type\": \"String\"\r\n },\r\n {\r\n \"name\": \"fill\",\r\n \"isAttr\": true,\r\n \"type\": \"String\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"enumerations\": [],\r\n \"associations\": []\r\n}\r\n","module.exports={\n \"name\": \"BPMN20\",\n \"uri\": \"http://www.omg.org/spec/BPMN/20100524/MODEL\",\n \"associations\": [],\n \"types\": [\n {\n \"name\": \"Interface\",\n \"superClass\": [\n \"RootElement\"\n ],\n \"properties\": [\n {\n \"name\": \"name\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"operations\",\n \"type\": \"Operation\",\n \"isMany\": true\n },\n {\n \"name\": \"implementationRef\",\n \"type\": \"String\",\n \"isAttr\": true\n }\n ]\n },\n {\n \"name\": \"Operation\",\n \"superClass\": [\n \"BaseElement\"\n ],\n \"properties\": [\n {\n \"name\": \"name\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"inMessageRef\",\n \"type\": \"Message\",\n \"isReference\": true\n },\n {\n \"name\": \"outMessageRef\",\n \"type\": \"Message\",\n \"isReference\": true\n },\n {\n \"name\": \"errorRef\",\n \"type\": \"Error\",\n \"isMany\": true,\n \"isReference\": true\n },\n {\n \"name\": \"implementationRef\",\n \"type\": \"String\",\n \"isAttr\": true\n }\n ]\n },\n {\n \"name\": \"EndPoint\",\n \"superClass\": [\n \"RootElement\"\n ]\n },\n {\n \"name\": \"Auditing\",\n \"superClass\": [\n \"BaseElement\"\n ]\n },\n {\n \"name\": \"GlobalTask\",\n \"superClass\": [\n \"CallableElement\"\n ],\n \"properties\": [\n {\n \"name\": \"resources\",\n \"type\": \"ResourceRole\",\n \"isMany\": true\n }\n ]\n },\n {\n \"name\": \"Monitoring\",\n \"superClass\": [\n \"BaseElement\"\n ]\n },\n {\n \"name\": \"Performer\",\n \"superClass\": [\n \"ResourceRole\"\n ]\n },\n {\n \"name\": \"Process\",\n \"superClass\": [\n \"FlowElementsContainer\",\n \"CallableElement\"\n ],\n \"properties\": [\n {\n \"name\": \"processType\",\n \"type\": \"ProcessType\",\n \"isAttr\": true\n },\n {\n \"name\": \"isClosed\",\n \"isAttr\": true,\n \"type\": \"Boolean\"\n },\n {\n \"name\": \"auditing\",\n \"type\": \"Auditing\"\n },\n {\n \"name\": \"monitoring\",\n \"type\": \"Monitoring\"\n },\n {\n \"name\": \"properties\",\n \"type\": \"Property\",\n \"isMany\": true\n },\n {\n \"name\": \"laneSets\",\n \"type\": \"LaneSet\",\n \"isMany\": true,\n \"replaces\": \"FlowElementsContainer#laneSets\"\n },\n {\n \"name\": \"flowElements\",\n \"type\": \"FlowElement\",\n \"isMany\": true,\n \"replaces\": \"FlowElementsContainer#flowElements\"\n },\n {\n \"name\": \"artifacts\",\n \"type\": \"Artifact\",\n \"isMany\": true\n },\n {\n \"name\": \"resources\",\n \"type\": \"ResourceRole\",\n \"isMany\": true\n },\n {\n \"name\": \"correlationSubscriptions\",\n \"type\": \"CorrelationSubscription\",\n \"isMany\": true\n },\n {\n \"name\": \"supports\",\n \"type\": \"Process\",\n \"isMany\": true,\n \"isReference\": true\n },\n {\n \"name\": \"definitionalCollaborationRef\",\n \"type\": \"Collaboration\",\n \"isAttr\": true,\n \"isReference\": true\n },\n {\n \"name\": \"isExecutable\",\n \"isAttr\": true,\n \"type\": \"Boolean\"\n }\n ]\n },\n {\n \"name\": \"LaneSet\",\n \"superClass\": [\n \"BaseElement\"\n ],\n \"properties\": [\n {\n \"name\": \"lanes\",\n \"type\": \"Lane\",\n \"isMany\": true\n },\n {\n \"name\": \"name\",\n \"isAttr\": true,\n \"type\": \"String\"\n }\n ]\n },\n {\n \"name\": \"Lane\",\n \"superClass\": [\n \"BaseElement\"\n ],\n \"properties\": [\n {\n \"name\": \"name\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"partitionElementRef\",\n \"type\": \"BaseElement\",\n \"isAttr\": true,\n \"isReference\": true\n },\n {\n \"name\": \"partitionElement\",\n \"type\": \"BaseElement\"\n },\n {\n \"name\": \"flowNodeRef\",\n \"type\": \"FlowNode\",\n \"isMany\": true,\n \"isReference\": true\n },\n {\n \"name\": \"childLaneSet\",\n \"type\": \"LaneSet\",\n \"xml\": {\n \"serialize\": \"xsi:type\"\n }\n }\n ]\n },\n {\n \"name\": \"GlobalManualTask\",\n \"superClass\": [\n \"GlobalTask\"\n ]\n },\n {\n \"name\": \"ManualTask\",\n \"superClass\": [\n \"Task\"\n ]\n },\n {\n \"name\": \"UserTask\",\n \"superClass\": [\n \"Task\"\n ],\n \"properties\": [\n {\n \"name\": \"renderings\",\n \"type\": \"Rendering\",\n \"isMany\": true\n },\n {\n \"name\": \"implementation\",\n \"isAttr\": true,\n \"type\": \"String\"\n }\n ]\n },\n {\n \"name\": \"Rendering\",\n \"superClass\": [\n \"BaseElement\"\n ]\n },\n {\n \"name\": \"HumanPerformer\",\n \"superClass\": [\n \"Performer\"\n ]\n },\n {\n \"name\": \"PotentialOwner\",\n \"superClass\": [\n \"HumanPerformer\"\n ]\n },\n {\n \"name\": \"GlobalUserTask\",\n \"superClass\": [\n \"GlobalTask\"\n ],\n \"properties\": [\n {\n \"name\": \"implementation\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"renderings\",\n \"type\": \"Rendering\",\n \"isMany\": true\n }\n ]\n },\n {\n \"name\": \"Gateway\",\n \"isAbstract\": true,\n \"superClass\": [\n \"FlowNode\"\n ],\n \"properties\": [\n {\n \"name\": \"gatewayDirection\",\n \"type\": \"GatewayDirection\",\n \"default\": \"Unspecified\",\n \"isAttr\": true\n }\n ]\n },\n {\n \"name\": \"EventBasedGateway\",\n \"superClass\": [\n \"Gateway\"\n ],\n \"properties\": [\n {\n \"name\": \"instantiate\",\n \"default\": false,\n \"isAttr\": true,\n \"type\": \"Boolean\"\n },\n {\n \"name\": \"eventGatewayType\",\n \"type\": \"EventBasedGatewayType\",\n \"isAttr\": true,\n \"default\": \"Exclusive\"\n }\n ]\n },\n {\n \"name\": \"ComplexGateway\",\n \"superClass\": [\n \"Gateway\"\n ],\n \"properties\": [\n {\n \"name\": \"activationCondition\",\n \"type\": \"Expression\",\n \"xml\": {\n \"serialize\": \"xsi:type\"\n }\n },\n {\n \"name\": \"default\",\n \"type\": \"SequenceFlow\",\n \"isAttr\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"ExclusiveGateway\",\n \"superClass\": [\n \"Gateway\"\n ],\n \"properties\": [\n {\n \"name\": \"default\",\n \"type\": \"SequenceFlow\",\n \"isAttr\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"InclusiveGateway\",\n \"superClass\": [\n \"Gateway\"\n ],\n \"properties\": [\n {\n \"name\": \"default\",\n \"type\": \"SequenceFlow\",\n \"isAttr\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"ParallelGateway\",\n \"superClass\": [\n \"Gateway\"\n ]\n },\n {\n \"name\": \"RootElement\",\n \"isAbstract\": true,\n \"superClass\": [\n \"BaseElement\"\n ]\n },\n {\n \"name\": \"Relationship\",\n \"superClass\": [\n \"BaseElement\"\n ],\n \"properties\": [\n {\n \"name\": \"type\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"direction\",\n \"type\": \"RelationshipDirection\",\n \"isAttr\": true\n },\n {\n \"name\": \"source\",\n \"isMany\": true,\n \"isReference\": true,\n \"type\": \"Element\"\n },\n {\n \"name\": \"target\",\n \"isMany\": true,\n \"isReference\": true,\n \"type\": \"Element\"\n }\n ]\n },\n {\n \"name\": \"BaseElement\",\n \"isAbstract\": true,\n \"properties\": [\n {\n \"name\": \"id\",\n \"isAttr\": true,\n \"type\": \"String\",\n \"isId\": true\n },\n {\n \"name\": \"documentation\",\n \"type\": \"Documentation\",\n \"isMany\": true\n },\n {\n \"name\": \"extensionDefinitions\",\n \"type\": \"ExtensionDefinition\",\n \"isMany\": true,\n \"isReference\": true\n },\n {\n \"name\": \"extensionElements\",\n \"type\": \"ExtensionElements\"\n }\n ]\n },\n {\n \"name\": \"Extension\",\n \"properties\": [\n {\n \"name\": \"mustUnderstand\",\n \"default\": false,\n \"isAttr\": true,\n \"type\": \"Boolean\"\n },\n {\n \"name\": \"definition\",\n \"type\": \"ExtensionDefinition\",\n \"isAttr\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"ExtensionDefinition\",\n \"properties\": [\n {\n \"name\": \"name\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"extensionAttributeDefinitions\",\n \"type\": \"ExtensionAttributeDefinition\",\n \"isMany\": true\n }\n ]\n },\n {\n \"name\": \"ExtensionAttributeDefinition\",\n \"properties\": [\n {\n \"name\": \"name\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"type\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"isReference\",\n \"default\": false,\n \"isAttr\": true,\n \"type\": \"Boolean\"\n },\n {\n \"name\": \"extensionDefinition\",\n \"type\": \"ExtensionDefinition\",\n \"isAttr\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"ExtensionElements\",\n \"properties\": [\n {\n \"name\": \"valueRef\",\n \"isAttr\": true,\n \"isReference\": true,\n \"type\": \"Element\"\n },\n {\n \"name\": \"values\",\n \"type\": \"Element\",\n \"isMany\": true\n },\n {\n \"name\": \"extensionAttributeDefinition\",\n \"type\": \"ExtensionAttributeDefinition\",\n \"isAttr\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"Documentation\",\n \"superClass\": [\n \"BaseElement\"\n ],\n \"properties\": [\n {\n \"name\": \"text\",\n \"type\": \"String\",\n \"isBody\": true\n },\n {\n \"name\": \"textFormat\",\n \"default\": \"text/plain\",\n \"isAttr\": true,\n \"type\": \"String\"\n }\n ]\n },\n {\n \"name\": \"Event\",\n \"isAbstract\": true,\n \"superClass\": [\n \"FlowNode\",\n \"InteractionNode\"\n ],\n \"properties\": [\n {\n \"name\": \"properties\",\n \"type\": \"Property\",\n \"isMany\": true\n }\n ]\n },\n {\n \"name\": \"IntermediateCatchEvent\",\n \"superClass\": [\n \"CatchEvent\"\n ]\n },\n {\n \"name\": \"IntermediateThrowEvent\",\n \"superClass\": [\n \"ThrowEvent\"\n ]\n },\n {\n \"name\": \"EndEvent\",\n \"superClass\": [\n \"ThrowEvent\"\n ]\n },\n {\n \"name\": \"StartEvent\",\n \"superClass\": [\n \"CatchEvent\"\n ],\n \"properties\": [\n {\n \"name\": \"isInterrupting\",\n \"default\": true,\n \"isAttr\": true,\n \"type\": \"Boolean\"\n }\n ]\n },\n {\n \"name\": \"ThrowEvent\",\n \"isAbstract\": true,\n \"superClass\": [\n \"Event\"\n ],\n \"properties\": [\n {\n \"name\": \"dataInputs\",\n \"type\": \"DataInput\",\n \"isMany\": true\n },\n {\n \"name\": \"dataInputAssociations\",\n \"type\": \"DataInputAssociation\",\n \"isMany\": true\n },\n {\n \"name\": \"inputSet\",\n \"type\": \"InputSet\"\n },\n {\n \"name\": \"eventDefinitions\",\n \"type\": \"EventDefinition\",\n \"isMany\": true\n },\n {\n \"name\": \"eventDefinitionRef\",\n \"type\": \"EventDefinition\",\n \"isMany\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"CatchEvent\",\n \"isAbstract\": true,\n \"superClass\": [\n \"Event\"\n ],\n \"properties\": [\n {\n \"name\": \"parallelMultiple\",\n \"isAttr\": true,\n \"type\": \"Boolean\",\n \"default\": false\n },\n {\n \"name\": \"dataOutputs\",\n \"type\": \"DataOutput\",\n \"isMany\": true\n },\n {\n \"name\": \"dataOutputAssociations\",\n \"type\": \"DataOutputAssociation\",\n \"isMany\": true\n },\n {\n \"name\": \"outputSet\",\n \"type\": \"OutputSet\"\n },\n {\n \"name\": \"eventDefinitions\",\n \"type\": \"EventDefinition\",\n \"isMany\": true\n },\n {\n \"name\": \"eventDefinitionRef\",\n \"type\": \"EventDefinition\",\n \"isMany\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"BoundaryEvent\",\n \"superClass\": [\n \"CatchEvent\"\n ],\n \"properties\": [\n {\n \"name\": \"cancelActivity\",\n \"default\": true,\n \"isAttr\": true,\n \"type\": \"Boolean\"\n },\n {\n \"name\": \"attachedToRef\",\n \"type\": \"Activity\",\n \"isAttr\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"EventDefinition\",\n \"isAbstract\": true,\n \"superClass\": [\n \"RootElement\"\n ]\n },\n {\n \"name\": \"CancelEventDefinition\",\n \"superClass\": [\n \"EventDefinition\"\n ]\n },\n {\n \"name\": \"ErrorEventDefinition\",\n \"superClass\": [\n \"EventDefinition\"\n ],\n \"properties\": [\n {\n \"name\": \"errorRef\",\n \"type\": \"Error\",\n \"isAttr\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"TerminateEventDefinition\",\n \"superClass\": [\n \"EventDefinition\"\n ]\n },\n {\n \"name\": \"EscalationEventDefinition\",\n \"superClass\": [\n \"EventDefinition\"\n ],\n \"properties\": [\n {\n \"name\": \"escalationRef\",\n \"type\": \"Escalation\",\n \"isAttr\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"Escalation\",\n \"properties\": [\n {\n \"name\": \"structureRef\",\n \"type\": \"ItemDefinition\",\n \"isAttr\": true,\n \"isReference\": true\n },\n {\n \"name\": \"name\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"escalationCode\",\n \"isAttr\": true,\n \"type\": \"String\"\n }\n ],\n \"superClass\": [\n \"RootElement\"\n ]\n },\n {\n \"name\": \"CompensateEventDefinition\",\n \"superClass\": [\n \"EventDefinition\"\n ],\n \"properties\": [\n {\n \"name\": \"waitForCompletion\",\n \"isAttr\": true,\n \"type\": \"Boolean\"\n },\n {\n \"name\": \"activityRef\",\n \"type\": \"Activity\",\n \"isAttr\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"TimerEventDefinition\",\n \"superClass\": [\n \"EventDefinition\"\n ],\n \"properties\": [\n {\n \"name\": \"timeDate\",\n \"type\": \"Expression\",\n \"xml\": {\n \"serialize\": \"xsi:type\"\n }\n },\n {\n \"name\": \"timeCycle\",\n \"type\": \"Expression\",\n \"xml\": {\n \"serialize\": \"xsi:type\"\n }\n },\n {\n \"name\": \"timeDuration\",\n \"type\": \"Expression\",\n \"xml\": {\n \"serialize\": \"xsi:type\"\n }\n }\n ]\n },\n {\n \"name\": \"LinkEventDefinition\",\n \"superClass\": [\n \"EventDefinition\"\n ],\n \"properties\": [\n {\n \"name\": \"name\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"target\",\n \"type\": \"LinkEventDefinition\",\n \"isAttr\": true,\n \"isReference\": true\n },\n {\n \"name\": \"source\",\n \"type\": \"LinkEventDefinition\",\n \"isMany\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"MessageEventDefinition\",\n \"superClass\": [\n \"EventDefinition\"\n ],\n \"properties\": [\n {\n \"name\": \"messageRef\",\n \"type\": \"Message\",\n \"isAttr\": true,\n \"isReference\": true\n },\n {\n \"name\": \"operationRef\",\n \"type\": \"Operation\",\n \"isAttr\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"ConditionalEventDefinition\",\n \"superClass\": [\n \"EventDefinition\"\n ],\n \"properties\": [\n {\n \"name\": \"condition\",\n \"type\": \"Expression\",\n \"xml\": {\n \"serialize\": \"xsi:type\"\n }\n }\n ]\n },\n {\n \"name\": \"SignalEventDefinition\",\n \"superClass\": [\n \"EventDefinition\"\n ],\n \"properties\": [\n {\n \"name\": \"signalRef\",\n \"type\": \"Signal\",\n \"isAttr\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"Signal\",\n \"superClass\": [\n \"RootElement\"\n ],\n \"properties\": [\n {\n \"name\": \"structureRef\",\n \"type\": \"ItemDefinition\",\n \"isAttr\": true,\n \"isReference\": true\n },\n {\n \"name\": \"name\",\n \"isAttr\": true,\n \"type\": \"String\"\n }\n ]\n },\n {\n \"name\": \"ImplicitThrowEvent\",\n \"superClass\": [\n \"ThrowEvent\"\n ]\n },\n {\n \"name\": \"DataState\",\n \"superClass\": [\n \"BaseElement\"\n ],\n \"properties\": [\n {\n \"name\": \"name\",\n \"isAttr\": true,\n \"type\": \"String\"\n }\n ]\n },\n {\n \"name\": \"ItemAwareElement\",\n \"superClass\": [\n \"BaseElement\"\n ],\n \"properties\": [\n {\n \"name\": \"itemSubjectRef\",\n \"type\": \"ItemDefinition\",\n \"isAttr\": true,\n \"isReference\": true\n },\n {\n \"name\": \"dataState\",\n \"type\": \"DataState\"\n }\n ]\n },\n {\n \"name\": \"DataAssociation\",\n \"superClass\": [\n \"BaseElement\"\n ],\n \"properties\": [\n {\n \"name\": \"assignment\",\n \"type\": \"Assignment\",\n \"isMany\": true\n },\n {\n \"name\": \"sourceRef\",\n \"type\": \"ItemAwareElement\",\n \"isMany\": true,\n \"isReference\": true\n },\n {\n \"name\": \"targetRef\",\n \"type\": \"ItemAwareElement\",\n \"isReference\": true\n },\n {\n \"name\": \"transformation\",\n \"type\": \"FormalExpression\",\n \"xml\": {\n \"serialize\": \"property\"\n }\n }\n ]\n },\n {\n \"name\": \"DataInput\",\n \"superClass\": [\n \"ItemAwareElement\"\n ],\n \"properties\": [\n {\n \"name\": \"name\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"isCollection\",\n \"default\": false,\n \"isAttr\": true,\n \"type\": \"Boolean\"\n },\n {\n \"name\": \"inputSetRef\",\n \"type\": \"InputSet\",\n \"isVirtual\": true,\n \"isMany\": true,\n \"isReference\": true\n },\n {\n \"name\": \"inputSetWithOptional\",\n \"type\": \"InputSet\",\n \"isVirtual\": true,\n \"isMany\": true,\n \"isReference\": true\n },\n {\n \"name\": \"inputSetWithWhileExecuting\",\n \"type\": \"InputSet\",\n \"isVirtual\": true,\n \"isMany\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"DataOutput\",\n \"superClass\": [\n \"ItemAwareElement\"\n ],\n \"properties\": [\n {\n \"name\": \"name\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"isCollection\",\n \"default\": false,\n \"isAttr\": true,\n \"type\": \"Boolean\"\n },\n {\n \"name\": \"outputSetRef\",\n \"type\": \"OutputSet\",\n \"isVirtual\": true,\n \"isMany\": true,\n \"isReference\": true\n },\n {\n \"name\": \"outputSetWithOptional\",\n \"type\": \"OutputSet\",\n \"isVirtual\": true,\n \"isMany\": true,\n \"isReference\": true\n },\n {\n \"name\": \"outputSetWithWhileExecuting\",\n \"type\": \"OutputSet\",\n \"isVirtual\": true,\n \"isMany\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"InputSet\",\n \"superClass\": [\n \"BaseElement\"\n ],\n \"properties\": [\n {\n \"name\": \"name\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"dataInputRefs\",\n \"type\": \"DataInput\",\n \"isMany\": true,\n \"isReference\": true\n },\n {\n \"name\": \"optionalInputRefs\",\n \"type\": \"DataInput\",\n \"isMany\": true,\n \"isReference\": true\n },\n {\n \"name\": \"whileExecutingInputRefs\",\n \"type\": \"DataInput\",\n \"isMany\": true,\n \"isReference\": true\n },\n {\n \"name\": \"outputSetRefs\",\n \"type\": \"OutputSet\",\n \"isMany\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"OutputSet\",\n \"superClass\": [\n \"BaseElement\"\n ],\n \"properties\": [\n {\n \"name\": \"dataOutputRefs\",\n \"type\": \"DataOutput\",\n \"isMany\": true,\n \"isReference\": true\n },\n {\n \"name\": \"name\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"inputSetRefs\",\n \"type\": \"InputSet\",\n \"isMany\": true,\n \"isReference\": true\n },\n {\n \"name\": \"optionalOutputRefs\",\n \"type\": \"DataOutput\",\n \"isMany\": true,\n \"isReference\": true\n },\n {\n \"name\": \"whileExecutingOutputRefs\",\n \"type\": \"DataOutput\",\n \"isMany\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"Property\",\n \"superClass\": [\n \"ItemAwareElement\"\n ],\n \"properties\": [\n {\n \"name\": \"name\",\n \"isAttr\": true,\n \"type\": \"String\"\n }\n ]\n },\n {\n \"name\": \"DataInputAssociation\",\n \"superClass\": [\n \"DataAssociation\"\n ]\n },\n {\n \"name\": \"DataOutputAssociation\",\n \"superClass\": [\n \"DataAssociation\"\n ]\n },\n {\n \"name\": \"InputOutputSpecification\",\n \"superClass\": [\n \"BaseElement\"\n ],\n \"properties\": [\n {\n \"name\": \"dataInputs\",\n \"type\": \"DataInput\",\n \"isMany\": true\n },\n {\n \"name\": \"dataOutputs\",\n \"type\": \"DataOutput\",\n \"isMany\": true\n },\n {\n \"name\": \"inputSets\",\n \"type\": \"InputSet\",\n \"isMany\": true\n },\n {\n \"name\": \"outputSets\",\n \"type\": \"OutputSet\",\n \"isMany\": true\n }\n ]\n },\n {\n \"name\": \"DataObject\",\n \"superClass\": [\n \"FlowElement\",\n \"ItemAwareElement\"\n ],\n \"properties\": [\n {\n \"name\": \"isCollection\",\n \"default\": false,\n \"isAttr\": true,\n \"type\": \"Boolean\"\n }\n ]\n },\n {\n \"name\": \"InputOutputBinding\",\n \"properties\": [\n {\n \"name\": \"inputDataRef\",\n \"type\": \"InputSet\",\n \"isAttr\": true,\n \"isReference\": true\n },\n {\n \"name\": \"outputDataRef\",\n \"type\": \"OutputSet\",\n \"isAttr\": true,\n \"isReference\": true\n },\n {\n \"name\": \"operationRef\",\n \"type\": \"Operation\",\n \"isAttr\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"Assignment\",\n \"superClass\": [\n \"BaseElement\"\n ],\n \"properties\": [\n {\n \"name\": \"from\",\n \"type\": \"Expression\",\n \"xml\": {\n \"serialize\": \"xsi:type\"\n }\n },\n {\n \"name\": \"to\",\n \"type\": \"Expression\",\n \"xml\": {\n \"serialize\": \"xsi:type\"\n }\n }\n ]\n },\n {\n \"name\": \"DataStore\",\n \"superClass\": [\n \"RootElement\",\n \"ItemAwareElement\"\n ],\n \"properties\": [\n {\n \"name\": \"name\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"capacity\",\n \"isAttr\": true,\n \"type\": \"Integer\"\n },\n {\n \"name\": \"isUnlimited\",\n \"default\": true,\n \"isAttr\": true,\n \"type\": \"Boolean\"\n }\n ]\n },\n {\n \"name\": \"DataStoreReference\",\n \"superClass\": [\n \"ItemAwareElement\",\n \"FlowElement\"\n ],\n \"properties\": [\n {\n \"name\": \"dataStoreRef\",\n \"type\": \"DataStore\",\n \"isAttr\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"DataObjectReference\",\n \"superClass\": [\n \"ItemAwareElement\",\n \"FlowElement\"\n ],\n \"properties\": [\n {\n \"name\": \"dataObjectRef\",\n \"type\": \"DataObject\",\n \"isAttr\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"ConversationLink\",\n \"superClass\": [\n \"BaseElement\"\n ],\n \"properties\": [\n {\n \"name\": \"sourceRef\",\n \"type\": \"InteractionNode\",\n \"isAttr\": true,\n \"isReference\": true\n },\n {\n \"name\": \"targetRef\",\n \"type\": \"InteractionNode\",\n \"isAttr\": true,\n \"isReference\": true\n },\n {\n \"name\": \"name\",\n \"isAttr\": true,\n \"type\": \"String\"\n }\n ]\n },\n {\n \"name\": \"ConversationAssociation\",\n \"superClass\": [\n \"BaseElement\"\n ],\n \"properties\": [\n {\n \"name\": \"innerConversationNodeRef\",\n \"type\": \"ConversationNode\",\n \"isAttr\": true,\n \"isReference\": true\n },\n {\n \"name\": \"outerConversationNodeRef\",\n \"type\": \"ConversationNode\",\n \"isAttr\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"CallConversation\",\n \"superClass\": [\n \"ConversationNode\"\n ],\n \"properties\": [\n {\n \"name\": \"calledCollaborationRef\",\n \"type\": \"Collaboration\",\n \"isAttr\": true,\n \"isReference\": true\n },\n {\n \"name\": \"participantAssociations\",\n \"type\": \"ParticipantAssociation\",\n \"isMany\": true\n }\n ]\n },\n {\n \"name\": \"Conversation\",\n \"superClass\": [\n \"ConversationNode\"\n ]\n },\n {\n \"name\": \"SubConversation\",\n \"superClass\": [\n \"ConversationNode\"\n ],\n \"properties\": [\n {\n \"name\": \"conversationNodes\",\n \"type\": \"ConversationNode\",\n \"isMany\": true\n }\n ]\n },\n {\n \"name\": \"ConversationNode\",\n \"isAbstract\": true,\n \"superClass\": [\n \"InteractionNode\",\n \"BaseElement\"\n ],\n \"properties\": [\n {\n \"name\": \"name\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"participantRefs\",\n \"type\": \"Participant\",\n \"isMany\": true,\n \"isReference\": true\n },\n {\n \"name\": \"messageFlowRefs\",\n \"type\": \"MessageFlow\",\n \"isMany\": true,\n \"isReference\": true\n },\n {\n \"name\": \"correlationKeys\",\n \"type\": \"CorrelationKey\",\n \"isMany\": true\n }\n ]\n },\n {\n \"name\": \"GlobalConversation\",\n \"superClass\": [\n \"Collaboration\"\n ]\n },\n {\n \"name\": \"PartnerEntity\",\n \"superClass\": [\n \"RootElement\"\n ],\n \"properties\": [\n {\n \"name\": \"name\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"participantRef\",\n \"type\": \"Participant\",\n \"isMany\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"PartnerRole\",\n \"superClass\": [\n \"RootElement\"\n ],\n \"properties\": [\n {\n \"name\": \"name\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"participantRef\",\n \"type\": \"Participant\",\n \"isMany\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"CorrelationProperty\",\n \"superClass\": [\n \"RootElement\"\n ],\n \"properties\": [\n {\n \"name\": \"correlationPropertyRetrievalExpression\",\n \"type\": \"CorrelationPropertyRetrievalExpression\",\n \"isMany\": true\n },\n {\n \"name\": \"name\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"type\",\n \"type\": \"ItemDefinition\",\n \"isAttr\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"Error\",\n \"superClass\": [\n \"RootElement\"\n ],\n \"properties\": [\n {\n \"name\": \"structureRef\",\n \"type\": \"ItemDefinition\",\n \"isAttr\": true,\n \"isReference\": true\n },\n {\n \"name\": \"name\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"errorCode\",\n \"isAttr\": true,\n \"type\": \"String\"\n }\n ]\n },\n {\n \"name\": \"CorrelationKey\",\n \"superClass\": [\n \"BaseElement\"\n ],\n \"properties\": [\n {\n \"name\": \"correlationPropertyRef\",\n \"type\": \"CorrelationProperty\",\n \"isMany\": true,\n \"isReference\": true\n },\n {\n \"name\": \"name\",\n \"isAttr\": true,\n \"type\": \"String\"\n }\n ]\n },\n {\n \"name\": \"Expression\",\n \"superClass\": [\n \"BaseElement\"\n ],\n \"isAbstract\": false,\n \"properties\": [\n {\n \"name\": \"body\",\n \"type\": \"String\",\n \"isBody\": true\n }\n ]\n },\n {\n \"name\": \"FormalExpression\",\n \"superClass\": [\n \"Expression\"\n ],\n \"properties\": [\n {\n \"name\": \"language\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"evaluatesToTypeRef\",\n \"type\": \"ItemDefinition\",\n \"isAttr\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"Message\",\n \"superClass\": [\n \"RootElement\"\n ],\n \"properties\": [\n {\n \"name\": \"name\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"itemRef\",\n \"type\": \"ItemDefinition\",\n \"isAttr\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"ItemDefinition\",\n \"superClass\": [\n \"RootElement\"\n ],\n \"properties\": [\n {\n \"name\": \"itemKind\",\n \"type\": \"ItemKind\",\n \"isAttr\": true\n },\n {\n \"name\": \"structureRef\",\n \"type\": \"String\",\n \"isAttr\": true\n },\n {\n \"name\": \"isCollection\",\n \"default\": false,\n \"isAttr\": true,\n \"type\": \"Boolean\"\n },\n {\n \"name\": \"import\",\n \"type\": \"Import\",\n \"isAttr\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"FlowElement\",\n \"isAbstract\": true,\n \"superClass\": [\n \"BaseElement\"\n ],\n \"properties\": [\n {\n \"name\": \"name\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"auditing\",\n \"type\": \"Auditing\"\n },\n {\n \"name\": \"monitoring\",\n \"type\": \"Monitoring\"\n },\n {\n \"name\": \"categoryValueRef\",\n \"type\": \"CategoryValue\",\n \"isMany\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"SequenceFlow\",\n \"superClass\": [\n \"FlowElement\"\n ],\n \"properties\": [\n {\n \"name\": \"isImmediate\",\n \"isAttr\": true,\n \"type\": \"Boolean\"\n },\n {\n \"name\": \"conditionExpression\",\n \"type\": \"Expression\",\n \"xml\": {\n \"serialize\": \"xsi:type\"\n }\n },\n {\n \"name\": \"sourceRef\",\n \"type\": \"FlowNode\",\n \"isAttr\": true,\n \"isReference\": true\n },\n {\n \"name\": \"targetRef\",\n \"type\": \"FlowNode\",\n \"isAttr\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"FlowElementsContainer\",\n \"isAbstract\": true,\n \"superClass\": [\n \"BaseElement\"\n ],\n \"properties\": [\n {\n \"name\": \"laneSets\",\n \"type\": \"LaneSet\",\n \"isMany\": true\n },\n {\n \"name\": \"flowElements\",\n \"type\": \"FlowElement\",\n \"isMany\": true\n }\n ]\n },\n {\n \"name\": \"CallableElement\",\n \"isAbstract\": true,\n \"superClass\": [\n \"RootElement\"\n ],\n \"properties\": [\n {\n \"name\": \"name\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"ioSpecification\",\n \"type\": \"InputOutputSpecification\",\n \"xml\": {\n \"serialize\": \"property\"\n }\n },\n {\n \"name\": \"supportedInterfaceRef\",\n \"type\": \"Interface\",\n \"isMany\": true,\n \"isReference\": true\n },\n {\n \"name\": \"ioBinding\",\n \"type\": \"InputOutputBinding\",\n \"isMany\": true,\n \"xml\": {\n \"serialize\": \"property\"\n }\n }\n ]\n },\n {\n \"name\": \"FlowNode\",\n \"isAbstract\": true,\n \"superClass\": [\n \"FlowElement\"\n ],\n \"properties\": [\n {\n \"name\": \"incoming\",\n \"type\": \"SequenceFlow\",\n \"isMany\": true,\n \"isReference\": true\n },\n {\n \"name\": \"outgoing\",\n \"type\": \"SequenceFlow\",\n \"isMany\": true,\n \"isReference\": true\n },\n {\n \"name\": \"lanes\",\n \"type\": \"Lane\",\n \"isVirtual\": true,\n \"isMany\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"CorrelationPropertyRetrievalExpression\",\n \"superClass\": [\n \"BaseElement\"\n ],\n \"properties\": [\n {\n \"name\": \"messagePath\",\n \"type\": \"FormalExpression\"\n },\n {\n \"name\": \"messageRef\",\n \"type\": \"Message\",\n \"isAttr\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"CorrelationPropertyBinding\",\n \"superClass\": [\n \"BaseElement\"\n ],\n \"properties\": [\n {\n \"name\": \"dataPath\",\n \"type\": \"FormalExpression\"\n },\n {\n \"name\": \"correlationPropertyRef\",\n \"type\": \"CorrelationProperty\",\n \"isAttr\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"Resource\",\n \"superClass\": [\n \"RootElement\"\n ],\n \"properties\": [\n {\n \"name\": \"name\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"resourceParameters\",\n \"type\": \"ResourceParameter\",\n \"isMany\": true\n }\n ]\n },\n {\n \"name\": \"ResourceParameter\",\n \"superClass\": [\n \"BaseElement\"\n ],\n \"properties\": [\n {\n \"name\": \"name\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"isRequired\",\n \"isAttr\": true,\n \"type\": \"Boolean\"\n },\n {\n \"name\": \"type\",\n \"type\": \"ItemDefinition\",\n \"isAttr\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"CorrelationSubscription\",\n \"superClass\": [\n \"BaseElement\"\n ],\n \"properties\": [\n {\n \"name\": \"correlationKeyRef\",\n \"type\": \"CorrelationKey\",\n \"isAttr\": true,\n \"isReference\": true\n },\n {\n \"name\": \"correlationPropertyBinding\",\n \"type\": \"CorrelationPropertyBinding\",\n \"isMany\": true\n }\n ]\n },\n {\n \"name\": \"MessageFlow\",\n \"superClass\": [\n \"BaseElement\"\n ],\n \"properties\": [\n {\n \"name\": \"name\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"sourceRef\",\n \"type\": \"InteractionNode\",\n \"isAttr\": true,\n \"isReference\": true\n },\n {\n \"name\": \"targetRef\",\n \"type\": \"InteractionNode\",\n \"isAttr\": true,\n \"isReference\": true\n },\n {\n \"name\": \"messageRef\",\n \"type\": \"Message\",\n \"isAttr\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"MessageFlowAssociation\",\n \"superClass\": [\n \"BaseElement\"\n ],\n \"properties\": [\n {\n \"name\": \"innerMessageFlowRef\",\n \"type\": \"MessageFlow\",\n \"isAttr\": true,\n \"isReference\": true\n },\n {\n \"name\": \"outerMessageFlowRef\",\n \"type\": \"MessageFlow\",\n \"isAttr\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"InteractionNode\",\n \"isAbstract\": true,\n \"properties\": [\n {\n \"name\": \"incomingConversationLinks\",\n \"type\": \"ConversationLink\",\n \"isVirtual\": true,\n \"isMany\": true,\n \"isReference\": true\n },\n {\n \"name\": \"outgoingConversationLinks\",\n \"type\": \"ConversationLink\",\n \"isVirtual\": true,\n \"isMany\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"Participant\",\n \"superClass\": [\n \"InteractionNode\",\n \"BaseElement\"\n ],\n \"properties\": [\n {\n \"name\": \"name\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"interfaceRef\",\n \"type\": \"Interface\",\n \"isMany\": true,\n \"isReference\": true\n },\n {\n \"name\": \"participantMultiplicity\",\n \"type\": \"ParticipantMultiplicity\"\n },\n {\n \"name\": \"endPointRefs\",\n \"type\": \"EndPoint\",\n \"isMany\": true,\n \"isReference\": true\n },\n {\n \"name\": \"processRef\",\n \"type\": \"Process\",\n \"isAttr\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"ParticipantAssociation\",\n \"superClass\": [\n \"BaseElement\"\n ],\n \"properties\": [\n {\n \"name\": \"innerParticipantRef\",\n \"type\": \"Participant\",\n \"isAttr\": true,\n \"isReference\": true\n },\n {\n \"name\": \"outerParticipantRef\",\n \"type\": \"Participant\",\n \"isAttr\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"ParticipantMultiplicity\",\n \"properties\": [\n {\n \"name\": \"minimum\",\n \"default\": 0,\n \"isAttr\": true,\n \"type\": \"Integer\"\n },\n {\n \"name\": \"maximum\",\n \"default\": 1,\n \"isAttr\": true,\n \"type\": \"Integer\"\n }\n ]\n },\n {\n \"name\": \"Collaboration\",\n \"superClass\": [\n \"RootElement\"\n ],\n \"properties\": [\n {\n \"name\": \"name\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"isClosed\",\n \"isAttr\": true,\n \"type\": \"Boolean\"\n },\n {\n \"name\": \"participants\",\n \"type\": \"Participant\",\n \"isMany\": true\n },\n {\n \"name\": \"messageFlows\",\n \"type\": \"MessageFlow\",\n \"isMany\": true\n },\n {\n \"name\": \"artifacts\",\n \"type\": \"Artifact\",\n \"isMany\": true\n },\n {\n \"name\": \"conversations\",\n \"type\": \"ConversationNode\",\n \"isMany\": true\n },\n {\n \"name\": \"conversationAssociations\",\n \"type\": \"ConversationAssociation\"\n },\n {\n \"name\": \"participantAssociations\",\n \"type\": \"ParticipantAssociation\",\n \"isMany\": true\n },\n {\n \"name\": \"messageFlowAssociations\",\n \"type\": \"MessageFlowAssociation\",\n \"isMany\": true\n },\n {\n \"name\": \"correlationKeys\",\n \"type\": \"CorrelationKey\",\n \"isMany\": true\n },\n {\n \"name\": \"choreographyRef\",\n \"type\": \"Choreography\",\n \"isMany\": true,\n \"isReference\": true\n },\n {\n \"name\": \"conversationLinks\",\n \"type\": \"ConversationLink\",\n \"isMany\": true\n }\n ]\n },\n {\n \"name\": \"ChoreographyActivity\",\n \"isAbstract\": true,\n \"superClass\": [\n \"FlowNode\"\n ],\n \"properties\": [\n {\n \"name\": \"participantRefs\",\n \"type\": \"Participant\",\n \"isMany\": true,\n \"isReference\": true\n },\n {\n \"name\": \"initiatingParticipantRef\",\n \"type\": \"Participant\",\n \"isAttr\": true,\n \"isReference\": true\n },\n {\n \"name\": \"correlationKeys\",\n \"type\": \"CorrelationKey\",\n \"isMany\": true\n },\n {\n \"name\": \"loopType\",\n \"type\": \"ChoreographyLoopType\",\n \"default\": \"None\",\n \"isAttr\": true\n }\n ]\n },\n {\n \"name\": \"CallChoreography\",\n \"superClass\": [\n \"ChoreographyActivity\"\n ],\n \"properties\": [\n {\n \"name\": \"calledChoreographyRef\",\n \"type\": \"Choreography\",\n \"isAttr\": true,\n \"isReference\": true\n },\n {\n \"name\": \"participantAssociations\",\n \"type\": \"ParticipantAssociation\",\n \"isMany\": true\n }\n ]\n },\n {\n \"name\": \"SubChoreography\",\n \"superClass\": [\n \"ChoreographyActivity\",\n \"FlowElementsContainer\"\n ],\n \"properties\": [\n {\n \"name\": \"artifacts\",\n \"type\": \"Artifact\",\n \"isMany\": true\n }\n ]\n },\n {\n \"name\": \"ChoreographyTask\",\n \"superClass\": [\n \"ChoreographyActivity\"\n ],\n \"properties\": [\n {\n \"name\": \"messageFlowRef\",\n \"type\": \"MessageFlow\",\n \"isMany\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"Choreography\",\n \"superClass\": [\n \"FlowElementsContainer\",\n \"Collaboration\"\n ]\n },\n {\n \"name\": \"GlobalChoreographyTask\",\n \"superClass\": [\n \"Choreography\"\n ],\n \"properties\": [\n {\n \"name\": \"initiatingParticipantRef\",\n \"type\": \"Participant\",\n \"isAttr\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"TextAnnotation\",\n \"superClass\": [\n \"Artifact\"\n ],\n \"properties\": [\n {\n \"name\": \"text\",\n \"type\": \"String\"\n },\n {\n \"name\": \"textFormat\",\n \"default\": \"text/plain\",\n \"isAttr\": true,\n \"type\": \"String\"\n }\n ]\n },\n {\n \"name\": \"Group\",\n \"superClass\": [\n \"Artifact\"\n ],\n \"properties\": [\n {\n \"name\": \"categoryValueRef\",\n \"type\": \"CategoryValue\",\n \"isAttr\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"Association\",\n \"superClass\": [\n \"Artifact\"\n ],\n \"properties\": [\n {\n \"name\": \"associationDirection\",\n \"type\": \"AssociationDirection\",\n \"isAttr\": true\n },\n {\n \"name\": \"sourceRef\",\n \"type\": \"BaseElement\",\n \"isAttr\": true,\n \"isReference\": true\n },\n {\n \"name\": \"targetRef\",\n \"type\": \"BaseElement\",\n \"isAttr\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"Category\",\n \"superClass\": [\n \"RootElement\"\n ],\n \"properties\": [\n {\n \"name\": \"categoryValue\",\n \"type\": \"CategoryValue\",\n \"isMany\": true\n },\n {\n \"name\": \"name\",\n \"isAttr\": true,\n \"type\": \"String\"\n }\n ]\n },\n {\n \"name\": \"Artifact\",\n \"isAbstract\": true,\n \"superClass\": [\n \"BaseElement\"\n ]\n },\n {\n \"name\": \"CategoryValue\",\n \"superClass\": [\n \"BaseElement\"\n ],\n \"properties\": [\n {\n \"name\": \"categorizedFlowElements\",\n \"type\": \"FlowElement\",\n \"isVirtual\": true,\n \"isMany\": true,\n \"isReference\": true\n },\n {\n \"name\": \"value\",\n \"isAttr\": true,\n \"type\": \"String\"\n }\n ]\n },\n {\n \"name\": \"Activity\",\n \"isAbstract\": true,\n \"superClass\": [\n \"FlowNode\"\n ],\n \"properties\": [\n {\n \"name\": \"isForCompensation\",\n \"default\": false,\n \"isAttr\": true,\n \"type\": \"Boolean\"\n },\n {\n \"name\": \"default\",\n \"type\": \"SequenceFlow\",\n \"isAttr\": true,\n \"isReference\": true\n },\n {\n \"name\": \"ioSpecification\",\n \"type\": \"InputOutputSpecification\",\n \"xml\": {\n \"serialize\": \"property\"\n }\n },\n {\n \"name\": \"boundaryEventRefs\",\n \"type\": \"BoundaryEvent\",\n \"isMany\": true,\n \"isReference\": true\n },\n {\n \"name\": \"properties\",\n \"type\": \"Property\",\n \"isMany\": true\n },\n {\n \"name\": \"dataInputAssociations\",\n \"type\": \"DataInputAssociation\",\n \"isMany\": true\n },\n {\n \"name\": \"dataOutputAssociations\",\n \"type\": \"DataOutputAssociation\",\n \"isMany\": true\n },\n {\n \"name\": \"startQuantity\",\n \"default\": 1,\n \"isAttr\": true,\n \"type\": \"Integer\"\n },\n {\n \"name\": \"resources\",\n \"type\": \"ResourceRole\",\n \"isMany\": true\n },\n {\n \"name\": \"completionQuantity\",\n \"default\": 1,\n \"isAttr\": true,\n \"type\": \"Integer\"\n },\n {\n \"name\": \"loopCharacteristics\",\n \"type\": \"LoopCharacteristics\"\n }\n ]\n },\n {\n \"name\": \"ServiceTask\",\n \"superClass\": [\n \"Task\"\n ],\n \"properties\": [\n {\n \"name\": \"implementation\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"operationRef\",\n \"type\": \"Operation\",\n \"isAttr\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"SubProcess\",\n \"superClass\": [\n \"Activity\",\n \"FlowElementsContainer\",\n \"InteractionNode\"\n ],\n \"properties\": [\n {\n \"name\": \"triggeredByEvent\",\n \"default\": false,\n \"isAttr\": true,\n \"type\": \"Boolean\"\n },\n {\n \"name\": \"artifacts\",\n \"type\": \"Artifact\",\n \"isMany\": true\n }\n ]\n },\n {\n \"name\": \"LoopCharacteristics\",\n \"isAbstract\": true,\n \"superClass\": [\n \"BaseElement\"\n ]\n },\n {\n \"name\": \"MultiInstanceLoopCharacteristics\",\n \"superClass\": [\n \"LoopCharacteristics\"\n ],\n \"properties\": [\n {\n \"name\": \"isSequential\",\n \"default\": false,\n \"isAttr\": true,\n \"type\": \"Boolean\"\n },\n {\n \"name\": \"behavior\",\n \"type\": \"MultiInstanceBehavior\",\n \"default\": \"All\",\n \"isAttr\": true\n },\n {\n \"name\": \"loopCardinality\",\n \"type\": \"Expression\",\n \"xml\": {\n \"serialize\": \"xsi:type\"\n }\n },\n {\n \"name\": \"loopDataInputRef\",\n \"type\": \"ItemAwareElement\",\n \"isReference\": true\n },\n {\n \"name\": \"loopDataOutputRef\",\n \"type\": \"ItemAwareElement\",\n \"isReference\": true\n },\n {\n \"name\": \"inputDataItem\",\n \"type\": \"DataInput\",\n \"xml\": {\n \"serialize\": \"property\"\n }\n },\n {\n \"name\": \"outputDataItem\",\n \"type\": \"DataOutput\",\n \"xml\": {\n \"serialize\": \"property\"\n }\n },\n {\n \"name\": \"complexBehaviorDefinition\",\n \"type\": \"ComplexBehaviorDefinition\",\n \"isMany\": true\n },\n {\n \"name\": \"completionCondition\",\n \"type\": \"Expression\",\n \"xml\": {\n \"serialize\": \"xsi:type\"\n }\n },\n {\n \"name\": \"oneBehaviorEventRef\",\n \"type\": \"EventDefinition\",\n \"isAttr\": true,\n \"isReference\": true\n },\n {\n \"name\": \"noneBehaviorEventRef\",\n \"type\": \"EventDefinition\",\n \"isAttr\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"StandardLoopCharacteristics\",\n \"superClass\": [\n \"LoopCharacteristics\"\n ],\n \"properties\": [\n {\n \"name\": \"testBefore\",\n \"default\": false,\n \"isAttr\": true,\n \"type\": \"Boolean\"\n },\n {\n \"name\": \"loopCondition\",\n \"type\": \"Expression\",\n \"xml\": {\n \"serialize\": \"xsi:type\"\n }\n },\n {\n \"name\": \"loopMaximum\",\n \"type\": \"Expression\",\n \"xml\": {\n \"serialize\": \"xsi:type\"\n }\n }\n ]\n },\n {\n \"name\": \"CallActivity\",\n \"superClass\": [\n \"Activity\"\n ],\n \"properties\": [\n {\n \"name\": \"calledElement\",\n \"type\": \"String\",\n \"isAttr\": true\n }\n ]\n },\n {\n \"name\": \"Task\",\n \"superClass\": [\n \"Activity\",\n \"InteractionNode\"\n ]\n },\n {\n \"name\": \"SendTask\",\n \"superClass\": [\n \"Task\"\n ],\n \"properties\": [\n {\n \"name\": \"implementation\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"operationRef\",\n \"type\": \"Operation\",\n \"isAttr\": true,\n \"isReference\": true\n },\n {\n \"name\": \"messageRef\",\n \"type\": \"Message\",\n \"isAttr\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"ReceiveTask\",\n \"superClass\": [\n \"Task\"\n ],\n \"properties\": [\n {\n \"name\": \"implementation\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"instantiate\",\n \"default\": false,\n \"isAttr\": true,\n \"type\": \"Boolean\"\n },\n {\n \"name\": \"operationRef\",\n \"type\": \"Operation\",\n \"isAttr\": true,\n \"isReference\": true\n },\n {\n \"name\": \"messageRef\",\n \"type\": \"Message\",\n \"isAttr\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"ScriptTask\",\n \"superClass\": [\n \"Task\"\n ],\n \"properties\": [\n {\n \"name\": \"scriptFormat\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"script\",\n \"type\": \"String\"\n }\n ]\n },\n {\n \"name\": \"BusinessRuleTask\",\n \"superClass\": [\n \"Task\"\n ],\n \"properties\": [\n {\n \"name\": \"implementation\",\n \"isAttr\": true,\n \"type\": \"String\"\n }\n ]\n },\n {\n \"name\": \"AdHocSubProcess\",\n \"superClass\": [\n \"SubProcess\"\n ],\n \"properties\": [\n {\n \"name\": \"completionCondition\",\n \"type\": \"Expression\",\n \"xml\": {\n \"serialize\": \"xsi:type\"\n }\n },\n {\n \"name\": \"ordering\",\n \"type\": \"AdHocOrdering\",\n \"isAttr\": true\n },\n {\n \"name\": \"cancelRemainingInstances\",\n \"default\": true,\n \"isAttr\": true,\n \"type\": \"Boolean\"\n }\n ]\n },\n {\n \"name\": \"Transaction\",\n \"superClass\": [\n \"SubProcess\"\n ],\n \"properties\": [\n {\n \"name\": \"protocol\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"method\",\n \"isAttr\": true,\n \"type\": \"String\"\n }\n ]\n },\n {\n \"name\": \"GlobalScriptTask\",\n \"superClass\": [\n \"GlobalTask\"\n ],\n \"properties\": [\n {\n \"name\": \"scriptLanguage\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"script\",\n \"isAttr\": true,\n \"type\": \"String\"\n }\n ]\n },\n {\n \"name\": \"GlobalBusinessRuleTask\",\n \"superClass\": [\n \"GlobalTask\"\n ],\n \"properties\": [\n {\n \"name\": \"implementation\",\n \"isAttr\": true,\n \"type\": \"String\"\n }\n ]\n },\n {\n \"name\": \"ComplexBehaviorDefinition\",\n \"superClass\": [\n \"BaseElement\"\n ],\n \"properties\": [\n {\n \"name\": \"condition\",\n \"type\": \"FormalExpression\"\n },\n {\n \"name\": \"event\",\n \"type\": \"ImplicitThrowEvent\"\n }\n ]\n },\n {\n \"name\": \"ResourceRole\",\n \"superClass\": [\n \"BaseElement\"\n ],\n \"properties\": [\n {\n \"name\": \"resourceRef\",\n \"type\": \"Resource\",\n \"isReference\": true\n },\n {\n \"name\": \"resourceParameterBindings\",\n \"type\": \"ResourceParameterBinding\",\n \"isMany\": true\n },\n {\n \"name\": \"resourceAssignmentExpression\",\n \"type\": \"ResourceAssignmentExpression\"\n },\n {\n \"name\": \"name\",\n \"isAttr\": true,\n \"type\": \"String\"\n }\n ]\n },\n {\n \"name\": \"ResourceParameterBinding\",\n \"properties\": [\n {\n \"name\": \"expression\",\n \"type\": \"Expression\",\n \"xml\": {\n \"serialize\": \"xsi:type\"\n }\n },\n {\n \"name\": \"parameterRef\",\n \"type\": \"ResourceParameter\",\n \"isAttr\": true,\n \"isReference\": true\n }\n ]\n },\n {\n \"name\": \"ResourceAssignmentExpression\",\n \"properties\": [\n {\n \"name\": \"expression\",\n \"type\": \"Expression\",\n \"xml\": {\n \"serialize\": \"xsi:type\"\n }\n }\n ],\n \"superClass\": [\n \"BaseElement\"\n ]\n },\n {\n \"name\": \"Import\",\n \"properties\": [\n {\n \"name\": \"importType\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"location\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"namespace\",\n \"isAttr\": true,\n \"type\": \"String\"\n }\n ]\n },\n {\n \"name\": \"Definitions\",\n \"superClass\": [\n \"BaseElement\"\n ],\n \"properties\": [\n {\n \"name\": \"name\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"targetNamespace\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"expressionLanguage\",\n \"default\": \"http://www.w3.org/1999/XPath\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"typeLanguage\",\n \"default\": \"http://www.w3.org/2001/XMLSchema\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"imports\",\n \"type\": \"Import\",\n \"isMany\": true\n },\n {\n \"name\": \"extensions\",\n \"type\": \"Extension\",\n \"isMany\": true\n },\n {\n \"name\": \"rootElements\",\n \"type\": \"RootElement\",\n \"isMany\": true\n },\n {\n \"name\": \"diagrams\",\n \"isMany\": true,\n \"type\": \"bpmndi:BPMNDiagram\"\n },\n {\n \"name\": \"exporter\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"relationships\",\n \"type\": \"Relationship\",\n \"isMany\": true\n },\n {\n \"name\": \"exporterVersion\",\n \"isAttr\": true,\n \"type\": \"String\"\n }\n ]\n }\n ],\n \"enumerations\": [\n {\n \"name\": \"ProcessType\",\n \"literalValues\": [\n {\n \"name\": \"None\"\n },\n {\n \"name\": \"Public\"\n },\n {\n \"name\": \"Private\"\n }\n ]\n },\n {\n \"name\": \"GatewayDirection\",\n \"literalValues\": [\n {\n \"name\": \"Unspecified\"\n },\n {\n \"name\": \"Converging\"\n },\n {\n \"name\": \"Diverging\"\n },\n {\n \"name\": \"Mixed\"\n }\n ]\n },\n {\n \"name\": \"EventBasedGatewayType\",\n \"literalValues\": [\n {\n \"name\": \"Parallel\"\n },\n {\n \"name\": \"Exclusive\"\n }\n ]\n },\n {\n \"name\": \"RelationshipDirection\",\n \"literalValues\": [\n {\n \"name\": \"None\"\n },\n {\n \"name\": \"Forward\"\n },\n {\n \"name\": \"Backward\"\n },\n {\n \"name\": \"Both\"\n }\n ]\n },\n {\n \"name\": \"ItemKind\",\n \"literalValues\": [\n {\n \"name\": \"Physical\"\n },\n {\n \"name\": \"Information\"\n }\n ]\n },\n {\n \"name\": \"ChoreographyLoopType\",\n \"literalValues\": [\n {\n \"name\": \"None\"\n },\n {\n \"name\": \"Standard\"\n },\n {\n \"name\": \"MultiInstanceSequential\"\n },\n {\n \"name\": \"MultiInstanceParallel\"\n }\n ]\n },\n {\n \"name\": \"AssociationDirection\",\n \"literalValues\": [\n {\n \"name\": \"None\"\n },\n {\n \"name\": \"One\"\n },\n {\n \"name\": \"Both\"\n }\n ]\n },\n {\n \"name\": \"MultiInstanceBehavior\",\n \"literalValues\": [\n {\n \"name\": \"None\"\n },\n {\n \"name\": \"One\"\n },\n {\n \"name\": \"All\"\n },\n {\n \"name\": \"Complex\"\n }\n ]\n },\n {\n \"name\": \"AdHocOrdering\",\n \"literalValues\": [\n {\n \"name\": \"Parallel\"\n },\n {\n \"name\": \"Sequential\"\n }\n ]\n }\n ],\n \"prefix\": \"bpmn\",\n \"xml\": {\n \"tagAlias\": \"lowerCase\",\n \"typePrefix\": \"t\"\n }\n}","module.exports={\n \"name\": \"BPMNDI\",\n \"uri\": \"http://www.omg.org/spec/BPMN/20100524/DI\",\n \"types\": [\n {\n \"name\": \"BPMNDiagram\",\n \"properties\": [\n {\n \"name\": \"plane\",\n \"type\": \"BPMNPlane\",\n \"redefines\": \"di:Diagram#rootElement\"\n },\n {\n \"name\": \"labelStyle\",\n \"type\": \"BPMNLabelStyle\",\n \"isMany\": true\n }\n ],\n \"superClass\": [\n \"di:Diagram\"\n ]\n },\n {\n \"name\": \"BPMNPlane\",\n \"properties\": [\n {\n \"name\": \"bpmnElement\",\n \"isAttr\": true,\n \"isReference\": true,\n \"type\": \"bpmn:BaseElement\",\n \"redefines\": \"di:DiagramElement#modelElement\"\n }\n ],\n \"superClass\": [\n \"di:Plane\"\n ]\n },\n {\n \"name\": \"BPMNShape\",\n \"properties\": [\n {\n \"name\": \"bpmnElement\",\n \"isAttr\": true,\n \"isReference\": true,\n \"type\": \"bpmn:BaseElement\",\n \"redefines\": \"di:DiagramElement#modelElement\"\n },\n {\n \"name\": \"isHorizontal\",\n \"isAttr\": true,\n \"type\": \"Boolean\"\n },\n {\n \"name\": \"isExpanded\",\n \"isAttr\": true,\n \"type\": \"Boolean\"\n },\n {\n \"name\": \"isMarkerVisible\",\n \"isAttr\": true,\n \"type\": \"Boolean\"\n },\n {\n \"name\": \"label\",\n \"type\": \"BPMNLabel\"\n },\n {\n \"name\": \"isMessageVisible\",\n \"isAttr\": true,\n \"type\": \"Boolean\"\n },\n {\n \"name\": \"participantBandKind\",\n \"type\": \"ParticipantBandKind\",\n \"isAttr\": true\n },\n {\n \"name\": \"choreographyActivityShape\",\n \"type\": \"BPMNShape\",\n \"isAttr\": true,\n \"isReference\": true\n }\n ],\n \"superClass\": [\n \"di:LabeledShape\"\n ]\n },\n {\n \"name\": \"BPMNEdge\",\n \"properties\": [\n {\n \"name\": \"label\",\n \"type\": \"BPMNLabel\"\n },\n {\n \"name\": \"bpmnElement\",\n \"isAttr\": true,\n \"isReference\": true,\n \"type\": \"bpmn:BaseElement\",\n \"redefines\": \"di:DiagramElement#modelElement\"\n },\n {\n \"name\": \"sourceElement\",\n \"isAttr\": true,\n \"isReference\": true,\n \"type\": \"di:DiagramElement\",\n \"redefines\": \"di:Edge#source\"\n },\n {\n \"name\": \"targetElement\",\n \"isAttr\": true,\n \"isReference\": true,\n \"type\": \"di:DiagramElement\",\n \"redefines\": \"di:Edge#target\"\n },\n {\n \"name\": \"messageVisibleKind\",\n \"type\": \"MessageVisibleKind\",\n \"isAttr\": true,\n \"default\": \"initiating\"\n }\n ],\n \"superClass\": [\n \"di:LabeledEdge\"\n ]\n },\n {\n \"name\": \"BPMNLabel\",\n \"properties\": [\n {\n \"name\": \"labelStyle\",\n \"type\": \"BPMNLabelStyle\",\n \"isAttr\": true,\n \"isReference\": true,\n \"redefines\": \"di:DiagramElement#style\"\n }\n ],\n \"superClass\": [\n \"di:Label\"\n ]\n },\n {\n \"name\": \"BPMNLabelStyle\",\n \"properties\": [\n {\n \"name\": \"font\",\n \"type\": \"dc:Font\"\n }\n ],\n \"superClass\": [\n \"di:Style\"\n ]\n }\n ],\n \"enumerations\": [\n {\n \"name\": \"ParticipantBandKind\",\n \"literalValues\": [\n {\n \"name\": \"top_initiating\"\n },\n {\n \"name\": \"middle_initiating\"\n },\n {\n \"name\": \"bottom_initiating\"\n },\n {\n \"name\": \"top_non_initiating\"\n },\n {\n \"name\": \"middle_non_initiating\"\n },\n {\n \"name\": \"bottom_non_initiating\"\n }\n ]\n },\n {\n \"name\": \"MessageVisibleKind\",\n \"literalValues\": [\n {\n \"name\": \"initiating\"\n },\n {\n \"name\": \"non_initiating\"\n }\n ]\n }\n ],\n \"associations\": [],\n \"prefix\": \"bpmndi\"\n}","module.exports={\n \"name\": \"DC\",\n \"uri\": \"http://www.omg.org/spec/DD/20100524/DC\",\n \"types\": [\n {\n \"name\": \"Boolean\"\n },\n {\n \"name\": \"Integer\"\n },\n {\n \"name\": \"Real\"\n },\n {\n \"name\": \"String\"\n },\n {\n \"name\": \"Font\",\n \"properties\": [\n {\n \"name\": \"name\",\n \"type\": \"String\",\n \"isAttr\": true\n },\n {\n \"name\": \"size\",\n \"type\": \"Real\",\n \"isAttr\": true\n },\n {\n \"name\": \"isBold\",\n \"type\": \"Boolean\",\n \"isAttr\": true\n },\n {\n \"name\": \"isItalic\",\n \"type\": \"Boolean\",\n \"isAttr\": true\n },\n {\n \"name\": \"isUnderline\",\n \"type\": \"Boolean\",\n \"isAttr\": true\n },\n {\n \"name\": \"isStrikeThrough\",\n \"type\": \"Boolean\",\n \"isAttr\": true\n }\n ]\n },\n {\n \"name\": \"Point\",\n \"properties\": [\n {\n \"name\": \"x\",\n \"type\": \"Real\",\n \"default\": \"0\",\n \"isAttr\": true\n },\n {\n \"name\": \"y\",\n \"type\": \"Real\",\n \"default\": \"0\",\n \"isAttr\": true\n }\n ]\n },\n {\n \"name\": \"Bounds\",\n \"properties\": [\n {\n \"name\": \"x\",\n \"type\": \"Real\",\n \"default\": \"0\",\n \"isAttr\": true\n },\n {\n \"name\": \"y\",\n \"type\": \"Real\",\n \"default\": \"0\",\n \"isAttr\": true\n },\n {\n \"name\": \"width\",\n \"type\": \"Real\",\n \"isAttr\": true\n },\n {\n \"name\": \"height\",\n \"type\": \"Real\",\n \"isAttr\": true\n }\n ]\n }\n ],\n \"prefix\": \"dc\",\n \"associations\": []\n}","module.exports={\n \"name\": \"DI\",\n \"uri\": \"http://www.omg.org/spec/DD/20100524/DI\",\n \"types\": [\n {\n \"name\": \"DiagramElement\",\n \"isAbstract\": true,\n \"properties\": [\n {\n \"name\": \"id\",\n \"type\": \"String\",\n \"isAttr\": true,\n \"isId\": true\n },\n {\n \"name\": \"extension\",\n \"type\": \"Extension\"\n },\n {\n \"name\": \"owningDiagram\",\n \"type\": \"Diagram\",\n \"isReadOnly\": true,\n \"isVirtual\": true,\n \"isReference\": true\n },\n {\n \"name\": \"owningElement\",\n \"type\": \"DiagramElement\",\n \"isReadOnly\": true,\n \"isVirtual\": true,\n \"isReference\": true\n },\n {\n \"name\": \"modelElement\",\n \"isReadOnly\": true,\n \"isVirtual\": true,\n \"isReference\": true,\n \"type\": \"Element\"\n },\n {\n \"name\": \"style\",\n \"type\": \"Style\",\n \"isReadOnly\": true,\n \"isVirtual\": true,\n \"isReference\": true\n },\n {\n \"name\": \"ownedElement\",\n \"type\": \"DiagramElement\",\n \"isReadOnly\": true,\n \"isVirtual\": true,\n \"isMany\": true\n }\n ]\n },\n {\n \"name\": \"Node\",\n \"isAbstract\": true,\n \"superClass\": [\n \"DiagramElement\"\n ]\n },\n {\n \"name\": \"Edge\",\n \"isAbstract\": true,\n \"superClass\": [\n \"DiagramElement\"\n ],\n \"properties\": [\n {\n \"name\": \"source\",\n \"type\": \"DiagramElement\",\n \"isReadOnly\": true,\n \"isVirtual\": true,\n \"isReference\": true\n },\n {\n \"name\": \"target\",\n \"type\": \"DiagramElement\",\n \"isReadOnly\": true,\n \"isVirtual\": true,\n \"isReference\": true\n },\n {\n \"name\": \"waypoint\",\n \"isUnique\": false,\n \"isMany\": true,\n \"type\": \"dc:Point\",\n \"xml\": {\n \"serialize\": \"xsi:type\"\n }\n }\n ]\n },\n {\n \"name\": \"Diagram\",\n \"isAbstract\": true,\n \"properties\": [\n {\n \"name\": \"id\",\n \"type\": \"String\",\n \"isAttr\": true,\n \"isId\": true\n },\n {\n \"name\": \"rootElement\",\n \"type\": \"DiagramElement\",\n \"isReadOnly\": true,\n \"isVirtual\": true\n },\n {\n \"name\": \"name\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"documentation\",\n \"isAttr\": true,\n \"type\": \"String\"\n },\n {\n \"name\": \"resolution\",\n \"isAttr\": true,\n \"type\": \"Real\"\n },\n {\n \"name\": \"ownedStyle\",\n \"type\": \"Style\",\n \"isReadOnly\": true,\n \"isVirtual\": true,\n \"isMany\": true\n }\n ]\n },\n {\n \"name\": \"Shape\",\n \"isAbstract\": true,\n \"superClass\": [\n \"Node\"\n ],\n \"properties\": [\n {\n \"name\": \"bounds\",\n \"type\": \"dc:Bounds\"\n }\n ]\n },\n {\n \"name\": \"Plane\",\n \"isAbstract\": true,\n \"superClass\": [\n \"Node\"\n ],\n \"properties\": [\n {\n \"name\": \"planeElement\",\n \"type\": \"DiagramElement\",\n \"subsettedProperty\": \"DiagramElement-ownedElement\",\n \"isMany\": true\n }\n ]\n },\n {\n \"name\": \"LabeledEdge\",\n \"isAbstract\": true,\n \"superClass\": [\n \"Edge\"\n ],\n \"properties\": [\n {\n \"name\": \"ownedLabel\",\n \"type\": \"Label\",\n \"isReadOnly\": true,\n \"subsettedProperty\": \"DiagramElement-ownedElement\",\n \"isVirtual\": true,\n \"isMany\": true\n }\n ]\n },\n {\n \"name\": \"LabeledShape\",\n \"isAbstract\": true,\n \"superClass\": [\n \"Shape\"\n ],\n \"properties\": [\n {\n \"name\": \"ownedLabel\",\n \"type\": \"Label\",\n \"isReadOnly\": true,\n \"subsettedProperty\": \"DiagramElement-ownedElement\",\n \"isVirtual\": true,\n \"isMany\": true\n }\n ]\n },\n {\n \"name\": \"Label\",\n \"isAbstract\": true,\n \"superClass\": [\n \"Node\"\n ],\n \"properties\": [\n {\n \"name\": \"bounds\",\n \"type\": \"dc:Bounds\"\n }\n ]\n },\n {\n \"name\": \"Style\",\n \"isAbstract\": true,\n \"properties\": [\n {\n \"name\": \"id\",\n \"type\": \"String\",\n \"isAttr\": true,\n \"isId\": true\n }\n ]\n },\n {\n \"name\": \"Extension\",\n \"properties\": [\n {\n \"name\": \"values\",\n \"type\": \"Element\",\n \"isMany\": true\n }\n ]\n }\n ],\n \"associations\": [],\n \"prefix\": \"di\",\n \"xml\": {\n \"tagAlias\": \"lowerCase\"\n }\n}","/**\n * Module dependencies.\n */\n\ntry {\n var index = require(111);\n} catch (err) {\n var index = require(111);\n}\n\n/**\n * Whitespace regexp.\n */\n\nvar re = //s+/;\n\n/**\n * toString reference.\n */\n\nvar toString = Object.prototype.toString;\n\n/**\n * Wrap `el` in a `ClassList`.\n *\n * @param {Element} el\n * @return {ClassList}\n * @api public\n */\n\nmodule.exports = function(el){\n return new ClassList(el);\n};\n\n/**\n * Initialize a new ClassList for `el`.\n *\n * @param {Element} el\n * @api private\n */\n\nfunction ClassList(el) {\n if (!el || !el.nodeType) {\n throw new Error('A DOM element reference is required');\n }\n this.el = el;\n this.list = el.classList;\n}\n\n/**\n * Add class `name` if not already present.\n *\n * @param {String} name\n * @return {ClassList}\n * @api public\n */\n\nClassList.prototype.add = function(name){\n // classList\n if (this.list) {\n this.list.add(name);\n return this;\n }\n\n // fallback\n var arr = this.array();\n var i = index(arr, name);\n if (!~i) arr.push(name);\n this.el.className = arr.join(' ');\n return this;\n};\n\n/**\n * Remove class `name` when present, or\n * pass a regular expression to remove\n * any which match.\n *\n * @param {String|RegExp} name\n * @return {ClassList}\n * @api public\n */\n\nClassList.prototype.remove = function(name){\n if ('[object RegExp]' == toString.call(name)) {\n return this.removeMatching(name);\n }\n\n // classList\n if (this.list) {\n this.list.remove(name);\n return this;\n }\n\n // fallback\n var arr = this.array();\n var i = index(arr, name);\n if (~i) arr.splice(i, 1);\n this.el.className = arr.join(' ');\n return this;\n};\n\n/**\n * Remove all classes matching `re`.\n *\n * @param {RegExp} re\n * @return {ClassList}\n * @api private\n */\n\nClassList.prototype.removeMatching = function(re){\n var arr = this.array();\n for (var i = 0; i < arr.length; i++) {\n if (re.test(arr[i])) {\n this.remove(arr[i]);\n }\n }\n return this;\n};\n\n/**\n * Toggle class `name`, can force state via `force`.\n *\n * For browsers that support classList, but do not support `force` yet,\n * the mistake will be detected and corrected.\n *\n * @param {String} name\n * @param {Boolean} force\n * @return {ClassList}\n * @api public\n */\n\nClassList.prototype.toggle = function(name, force){\n // classList\n if (this.list) {\n if (\"undefined\" !== typeof force) {\n if (force !== this.list.toggle(name, force)) {\n this.list.toggle(name); // toggle again to correct\n }\n } else {\n this.list.toggle(name);\n }\n return this;\n }\n\n // fallback\n if (\"undefined\" !== typeof force) {\n if (!force) {\n this.remove(name);\n } else {\n this.add(name);\n }\n } else {\n if (this.has(name)) {\n this.remove(name);\n } else {\n this.add(name);\n }\n }\n\n return this;\n};\n\n/**\n * Return an array of classes.\n *\n * @return {Array}\n * @api public\n */\n\nClassList.prototype.array = function(){\n var className = this.el.getAttribute('class') || '';\n var str = className.replace(/^/s+|/s+$/g, '');\n var arr = str.split(re);\n if ('' === arr[0]) arr.shift();\n return arr;\n};\n\n/**\n * Check if class `name` is present.\n *\n * @param {String} name\n * @return {ClassList}\n * @api public\n */\n\nClassList.prototype.has =\nClassList.prototype.contains = function(name){\n return this.list\n ? this.list.contains(name)\n : !! ~index(this.array(), name);\n};\n","var matches = require(112)\n\nmodule.exports = function (element, selector, checkYoSelf, root) {\n element = checkYoSelf ? {parentNode: element} : element\n\n root = root || document\n\n // Make sure `element !== document` and `element != null`\n // otherwise we get an illegal invocation\n while ((element = element.parentNode) && element !== document) {\n if (matches(element, selector))\n return element\n // After `matches` on the edge case that\n // the selector matches the root\n // (when the root is not the document)\n if (element === root)\n return\n }\n}\n","/**\n * Module dependencies.\n */\n\ntry {\n var closest = require(108);\n} catch(err) {\n var closest = require(108);\n}\n\ntry {\n var event = require(110);\n} catch(err) {\n var event = require(110);\n}\n\n/**\n * Delegate event `type` to `selector`\n * and invoke `fn(e)`. A callback function\n * is returned which may be passed to `.unbind()`.\n *\n * @param {Element} el\n * @param {String} selector\n * @param {String} type\n * @param {Function} fn\n * @param {Boolean} capture\n * @return {Function}\n * @api public\n */\n\nexports.bind = function(el, selector, type, fn, capture){\n return event.bind(el, type, function(e){\n var target = e.target || e.srcElement;\n e.delegateTarget = closest(target, selector, true, el);\n if (e.delegateTarget) fn.call(el, e);\n }, capture);\n};\n\n/**\n * Unbind event `type`'s callback `fn`.\n *\n * @param {Element} el\n * @param {String} type\n * @param {Function} fn\n * @param {Boolean} capture\n * @api public\n */\n\nexports.unbind = function(el, type, fn, capture){\n event.unbind(el, type, fn, capture);\n};\n","var bind = window.addEventListener ? 'addEventListener' : 'attachEvent',\n unbind = window.removeEventListener ? 'removeEventListener' : 'detachEvent',\n prefix = bind !== 'addEventListener' ? 'on' : '';\n\n/**\n * Bind `el` event `type` to `fn`.\n *\n * @param {Element} el\n * @param {String} type\n * @param {Function} fn\n * @param {Boolean} capture\n * @return {Function}\n * @api public\n */\n\nexports.bind = function(el, type, fn, capture){\n el[bind](prefix + type, fn, capture || false);\n return fn;\n};\n\n/**\n * Unbind `el` event `type`'s callback `fn`.\n *\n * @param {Element} el\n * @param {String} type\n * @param {Function} fn\n * @param {Boolean} capture\n * @return {Function}\n * @api public\n */\n\nexports.unbind = function(el, type, fn, capture){\n el[unbind](prefix + type, fn, capture || false);\n return fn;\n};","module.exports = function(arr, obj){\n if (arr.indexOf) return arr.indexOf(obj);\n for (var i = 0; i < arr.length; ++i) {\n if (arr[i] === obj) return i;\n }\n return -1;\n};","/**\n * Module dependencies.\n */\n\ntry {\n var query = require(113);\n} catch (err) {\n var query = require(113);\n}\n\n/**\n * Element prototype.\n */\n\nvar proto = Element.prototype;\n\n/**\n * Vendor function.\n */\n\nvar vendor = proto.matches\n || proto.webkitMatchesSelector\n || proto.mozMatchesSelector\n || proto.msMatchesSelector\n || proto.oMatchesSelector;\n\n/**\n * Expose `match()`.\n */\n\nmodule.exports = match;\n\n/**\n * Match `el` to `selector`.\n *\n * @param {Element} el\n * @param {String} selector\n * @return {Boolean}\n * @api public\n */\n\nfunction match(el, selector) {\n if (!el || el.nodeType !== 1) return false;\n if (vendor) return vendor.call(el, selector);\n var nodes = query.all(selector, el.parentNode);\n for (var i = 0; i < nodes.length; ++i) {\n if (nodes[i] == el) return true;\n }\n return false;\n}\n","function one(selector, el) {\n return el.querySelector(selector);\n}\n\nexports = module.exports = function(selector, el){\n el = el || document;\n return one(selector, el);\n};\n\nexports.all = function(selector, el){\n el = el || document;\n return el.querySelectorAll(selector);\n};\n\nexports.engine = function(obj){\n if (!obj.one) throw new Error('.one callback required');\n if (!obj.all) throw new Error('.all callback required');\n one = obj.one;\n exports.all = obj.all;\n return exports;\n};\n","module.exports = {\r\n __depends__: [ require(170) ],\r\n __init__: [ 'directEditing' ],\r\n directEditing: [ 'type', require(115) ]\r\n};","'use strict';\r\n\r\nvar bind = require(312),\r\n find = require(302);\r\n\r\nvar TextBox = require(116);\r\n\r\n\r\n/**\r\n * A direct editing component that allows users\r\n * to edit an elements text directly in the diagram\r\n *\r\n * @param {EventBus} eventBus the event bus\r\n */\r\nfunction DirectEditing(eventBus, canvas) {\r\n\r\n this._eventBus = eventBus;\r\n\r\n this._providers = [];\r\n this._textbox = new TextBox({\r\n container: canvas.getContainer(),\r\n keyHandler: bind(this._handleKey, this),\r\n resizeHandler: bind(this._handleResize, this)\r\n });\r\n}\r\n\r\nDirectEditing.$inject = [ 'eventBus', 'canvas' ];\r\n\r\n\r\n/**\r\n * Register a direct editing provider\r\n\r\n * @param {Object} provider the provider, must expose an #activate(element) method that returns\r\n * an activation context ({ bounds: {x, y, width, height }, text }) if\r\n * direct editing is available for the given element.\r\n * Additionally the provider must expose a #update(element, value) method\r\n * to receive direct editing updates.\r\n */\r\nDirectEditing.prototype.registerProvider = function(provider) {\r\n this._providers.push(provider);\r\n};\r\n\r\n\r\n/**\r\n * Returns true if direct editing is currently active\r\n *\r\n * @return {Boolean}\r\n */\r\nDirectEditing.prototype.isActive = function() {\r\n return !!this._active;\r\n};\r\n\r\n\r\n/**\r\n * Cancel direct editing, if it is currently active\r\n */\r\nDirectEditing.prototype.cancel = function() {\r\n if (!this._active) {\r\n return;\r\n }\r\n\r\n this._fire('cancel');\r\n this.close();\r\n};\r\n\r\n\r\nDirectEditing.prototype._fire = function(event, context) {\r\n this._eventBus.fire('directEditing.' + event, context || { active: this._active });\r\n};\r\n\r\nDirectEditing.prototype.close = function() {\r\n this._textbox.destroy();\r\n\r\n this._fire('deactivate');\r\n\r\n this._active = null;\r\n\r\n this.resizable = undefined;\r\n};\r\n\r\n\r\nDirectEditing.prototype.complete = function() {\r\n\r\n var active = this._active;\r\n\r\n if (!active) {\r\n return;\r\n }\r\n\r\n var text = this.getValue();\r\n\r\n var bounds = this.$textbox.getBoundingClientRect();\r\n\r\n if (text !== active.context.text || this.resizable) {\r\n active.provider.update(active.element, text, active.context.text, {\r\n x: bounds.top,\r\n y: bounds.left,\r\n width: bounds.width,\r\n height: bounds.height\r\n });\r\n }\r\n\r\n this._fire('complete');\r\n\r\n this.close();\r\n};\r\n\r\n\r\nDirectEditing.prototype.getValue = function() {\r\n return this._textbox.getValue();\r\n};\r\n\r\n\r\nDirectEditing.prototype._handleKey = function(e) {\r\n\r\n // stop bubble\r\n e.stopPropagation();\r\n\r\n var key = e.keyCode || e.charCode;\r\n\r\n // ESC\r\n if (key === 27) {\r\n e.preventDefault();\r\n return this.cancel();\r\n }\r\n\r\n // Enter\r\n if (key === 13 && !e.shiftKey) {\r\n e.preventDefault();\r\n return this.complete();\r\n }\r\n};\r\n\r\n\r\nDirectEditing.prototype._handleResize = function(event) {\r\n this._fire('resize', event);\r\n};\r\n\r\n\r\n/**\r\n * Activate direct editing on the given element\r\n *\r\n * @param {Object} ElementDescriptor the descriptor for a shape or connection\r\n * @return {Boolean} true if the activation was possible\r\n */\r\nDirectEditing.prototype.activate = function(element) {\r\n if (this.isActive()) {\r\n this.cancel();\r\n }\r\n\r\n // the direct editing context\r\n var context;\r\n\r\n var provider = find(this._providers, function(p) {\r\n return (context = p.activate(element)) ? p : null;\r\n });\r\n\r\n // check if activation took place\r\n if (context) {\r\n this.$textbox = this._textbox.create(\r\n context.bounds,\r\n context.style,\r\n context.text,\r\n context.options\r\n );\r\n\r\n this._active = {\r\n element: element,\r\n context: context,\r\n provider: provider\r\n };\r\n\r\n if (context.options && context.options.resizable) {\r\n this.resizable = true;\r\n }\r\n\r\n this._fire('activate');\r\n }\r\n\r\n return !!context;\r\n};\r\n\r\n\r\nmodule.exports = DirectEditing;","'use strict';\r\n\r\nvar assign = require(431),\r\n bind = require(312),\r\n pick = require(438);\r\n\r\nvar domAttr = require(444),\r\n domClasses = require(445),\r\n domEvent = require(450),\r\n domRemove = require(453);\r\n\r\nvar min = Math.min,\r\n max = Math.max;\r\n\r\nfunction preventDefault(e) {\r\n e.preventDefault();\r\n}\r\n\r\nfunction stopPropagation(e) {\r\n e.stopPropagation();\r\n}\r\n\r\nfunction isTextNode(node) {\r\n return node.nodeType === Node.TEXT_NODE;\r\n}\r\n\r\nfunction toArray(nodeList) {\r\n return [].slice.call(nodeList);\r\n}\r\n\r\n/**\r\n * Initializes a container for a content editable div.\r\n *\r\n * Structure:\r\n *\r\n * container\r\n * parent\r\n * content\r\n * handle\r\n *\r\n * @param {object} options\r\n * @param {DOMElement} options.container The DOM element to append the contentContainer to\r\n * @param {Function} options.keyHandler Handler for key events\r\n * @param {Function} options.resizeHandler Handler for resize events\r\n */\r\nfunction TextBox(options) {\r\n this.container = options.container;\r\n\r\n this.parent = document.createElement('div');\r\n\r\n this.content = document.createElement('div');\r\n\r\n this.parent.appendChild(this.content);\r\n\r\n domAttr(this.content, 'contentEditable', 'true');\r\n\r\n this.keyHandler = options.keyHandler || function() {};\r\n this.resizeHandler = options.resizeHandler || function() {};\r\n\r\n this.autoResize = bind(this.autoResize, this);\r\n this.handlePaste = bind(this.handlePaste, this);\r\n}\r\n\r\nmodule.exports = TextBox;\r\n\r\n\r\n/**\r\n * Create a text box with the given position, size, style and text content\r\n *\r\n * @param {Object} bounds\r\n * @param {Number} bounds.x absolute x position\r\n * @param {Number} bounds.y absolute y position\r\n * @param {Number} [bounds.width] fixed width value\r\n * @param {Number} [bounds.height] fixed height value\r\n * @param {Number} [bounds.maxWidth] maximum width value\r\n * @param {Number} [bounds.maxHeight] maximum height value\r\n * @param {Number} [bounds.minWidth] minimum width value\r\n * @param {Number} [bounds.minHeight] minimum height value\r\n * @param {Object} [style]\r\n * @param {String} value text content\r\n *\r\n * @return {DOMElement} The created content DOM element\r\n */\r\nTextBox.prototype.create = function(bounds, style, value, options) {\r\n var self = this;\r\n\r\n var parent = this.parent,\r\n content = this.content,\r\n container = this.container;\r\n\r\n options = this.options = options || {};\r\n\r\n style = this.style = style || {};\r\n\r\n var parentStyle = pick(style, [\r\n 'width',\r\n 'height',\r\n 'maxWidth',\r\n 'maxHeight',\r\n 'minWidth',\r\n 'minHeight',\r\n 'left',\r\n 'top',\r\n 'backgroundColor',\r\n 'position',\r\n 'overflow',\r\n 'border',\r\n 'wordWrap',\r\n 'textAlign',\r\n 'outline',\r\n 'transform'\r\n ]);\r\n\r\n assign(parent.style, {\r\n width: bounds.width + 'px',\r\n height: bounds.height + 'px',\r\n maxWidth: bounds.maxWidth + 'px',\r\n maxHeight: bounds.maxHeight + 'px',\r\n minWidth: bounds.minWidth + 'px',\r\n minHeight: bounds.minHeight + 'px',\r\n left: bounds.x + 'px',\r\n top: bounds.y + 'px',\r\n backgroundColor: '#ffffff',\r\n position: 'absolute',\r\n overflow: 'visible',\r\n border: '1px solid #ccc',\r\n wordWrap: 'normal',\r\n textAlign: 'center',\r\n outline: 'none'\r\n }, parentStyle);\r\n\r\n var contentStyle = pick(style, [\r\n 'fontSize',\r\n 'lineHeight',\r\n 'padding',\r\n 'paddingTop',\r\n 'paddingRight',\r\n 'paddingBottom',\r\n 'paddingLeft'\r\n ]);\r\n\r\n assign(content.style, {\r\n boxSizing: 'border-box',\r\n width: '100%',\r\n outline: 'none'\r\n }, contentStyle);\r\n\r\n if (options.centerVertically) {\r\n assign(content.style, {\r\n position: 'absolute',\r\n top: '50%',\r\n transform: 'translate(0, -50%)'\r\n }, contentStyle);\r\n }\r\n\r\n content.innerText = value;\r\n\r\n domEvent.bind(content, 'keydown', this.keyHandler);\r\n domEvent.bind(content, 'mousedown', stopPropagation);\r\n domEvent.bind(content, 'paste', self.handlePaste);\r\n\r\n if (options.autoResize) {\r\n domEvent.bind(content, 'input', this.autoResize);\r\n }\r\n\r\n if (options.resizable) {\r\n this.resizable(style);\r\n }\r\n\r\n container.appendChild(parent);\r\n\r\n // set selection to end of text\r\n this.setSelection(content.lastChild, content.lastChild && content.lastChild.length);\r\n\r\n return parent;\r\n};\r\n\r\n/**\r\n * Intercept paste events to remove formatting from pasted text.\r\n */\r\nTextBox.prototype.handlePaste = function(e) {\r\n var self = this;\r\n\r\n var options = this.options,\r\n style = this.style;\r\n\r\n e.preventDefault();\r\n\r\n var text;\r\n\r\n if (e.clipboardData) {\r\n\r\n // Chrome, Firefox, Safari\r\n text = e.clipboardData.getData('text/plain');\r\n } else {\r\n\r\n // Internet Explorer\r\n text = window.clipboardData.getData('Text');\r\n }\r\n\r\n // insertHTML command not supported by Internet Explorer\r\n var success = document.execCommand('insertHTML', false, text);\r\n\r\n if (!success) {\r\n\r\n // Internet Explorer\r\n var range = this.getSelection(),\r\n startContainer = range.startContainer,\r\n endContainer = range.endContainer,\r\n startOffset = range.startOffset,\r\n endOffset = range.endOffset,\r\n commonAncestorContainer = range.commonAncestorContainer;\r\n\r\n var childNodesArray = toArray(commonAncestorContainer.childNodes);\r\n\r\n var container,\r\n offset;\r\n\r\n if (isTextNode(commonAncestorContainer)) {\r\n var containerTextContent = startContainer.textContent;\r\n\r\n startContainer.textContent =\r\n containerTextContent.substring(0, startOffset)\r\n + text\r\n + containerTextContent.substring(endOffset);\r\n\r\n container = startContainer;\r\n offset = startOffset + text.length;\r\n\r\n } else if (startContainer === this.content && endContainer === this.content) {\r\n var textNode = document.createTextNode(text);\r\n\r\n this.content.insertBefore(textNode, childNodesArray[startOffset]);\r\n\r\n container = textNode;\r\n offset = textNode.textContent.length;\r\n } else {\r\n var startContainerChildIndex = childNodesArray.indexOf(startContainer),\r\n endContainerChildIndex = childNodesArray.indexOf(endContainer);\r\n\r\n childNodesArray.forEach(function(childNode, index) {\r\n\r\n if (index === startContainerChildIndex) {\r\n childNode.textContent =\r\n startContainer.textContent.substring(0, startOffset) +\r\n text +\r\n endContainer.textContent.substring(endOffset);\r\n } else if (index > startContainerChildIndex && index <= endContainerChildIndex) {\r\n domRemove(childNode);\r\n }\r\n });\r\n\r\n container = startContainer;\r\n offset = startOffset + text.length;\r\n }\r\n\r\n if (container && offset !== undefined) {\r\n\r\n // is necessary in Internet Explorer\r\n setTimeout(function() {\r\n self.setSelection(container, offset);\r\n });\r\n }\r\n }\r\n\r\n if (options.autoResize) {\r\n var hasResized = this.autoResize(style);\r\n\r\n if (hasResized) {\r\n this.resizeHandler(hasResized);\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Automatically resize element vertically to fit its content.\r\n */\r\nTextBox.prototype.autoResize = function() {\r\n var parent = this.parent,\r\n content = this.content;\r\n\r\n var fontSize = parseInt(this.style.fontSize) || 12;\r\n\r\n if (content.scrollHeight > parent.offsetHeight ||\r\n content.scrollHeight < parent.offsetHeight - fontSize) {\r\n var bounds = parent.getBoundingClientRect();\r\n\r\n var height = content.scrollHeight;\r\n parent.style.height = height + 'px';\r\n\r\n this.resizeHandler({\r\n width: bounds.width,\r\n height: bounds.height,\r\n dx: 0,\r\n dy: height - bounds.height\r\n });\r\n }\r\n};\r\n\r\n/**\r\n * Make an element resizable by adding a resize handle.\r\n */\r\nTextBox.prototype.resizable = function() {\r\n var self = this;\r\n\r\n var parent = this.parent,\r\n resizeHandle = this.resizeHandle;\r\n\r\n var minWidth = parseInt(this.style.minWidth) || 0,\r\n minHeight = parseInt(this.style.minHeight) || 0,\r\n maxWidth = parseInt(this.style.maxWidth) || Infinity,\r\n maxHeight = parseInt(this.style.maxHeight) || Infinity;\r\n\r\n if (!resizeHandle) {\r\n resizeHandle = this.resizeHandle = document.createElement('div');\r\n\r\n domClasses(resizeHandle).add('djs-direct-editing-resize-handle');\r\n\r\n var startX, startY, startWidth, startHeight;\r\n\r\n var onMouseDown = function(e) {\r\n preventDefault(e);\r\n stopPropagation(e);\r\n\r\n startX = e.clientX;\r\n startY = e.clientY;\r\n\r\n var bounds = parent.getBoundingClientRect();\r\n\r\n startWidth = bounds.width;\r\n startHeight = bounds.height;\r\n\r\n domEvent.bind(document, 'mousemove', onMouseMove);\r\n domEvent.bind(document, 'mouseup', onMouseUp);\r\n };\r\n\r\n var onMouseMove = function(e) {\r\n preventDefault(e);\r\n stopPropagation(e);\r\n\r\n var newWidth = min(max(startWidth + e.clientX - startX, minWidth), maxWidth);\r\n var newHeight = min(max(startHeight + e.clientY - startY, minHeight), maxHeight);\r\n\r\n parent.style.width = newWidth + 'px';\r\n parent.style.height = newHeight + 'px';\r\n\r\n self.resizeHandler({\r\n width: startWidth,\r\n height: startHeight,\r\n dx: e.clientX - startX,\r\n dy: e.clientY - startY\r\n });\r\n };\r\n\r\n var onMouseUp = function(e) {\r\n preventDefault(e);\r\n stopPropagation(e);\r\n\r\n domEvent.unbind(document,'mousemove', onMouseMove, false);\r\n domEvent.unbind(document, 'mouseup', onMouseUp, false);\r\n };\r\n\r\n domEvent.bind(resizeHandle, 'mousedown', onMouseDown);\r\n }\r\n\r\n assign(resizeHandle.style, {\r\n position: 'absolute',\r\n bottom: '0px',\r\n right: '0px',\r\n cursor: 'nwse-resize',\r\n width: '0',\r\n height: '0',\r\n borderTop: (parseInt(this.style.fontSize) / 4 || 3) + 'px solid transparent',\r\n borderRight: (parseInt(this.style.fontSize) / 4 || 3) + 'px solid #ccc',\r\n borderBottom: (parseInt(this.style.fontSize) / 4 || 3) + 'px solid #ccc',\r\n borderLeft: (parseInt(this.style.fontSize) / 4 || 3) + 'px solid transparent'\r\n });\r\n\r\n parent.appendChild(resizeHandle);\r\n};\r\n\r\n\r\n/**\r\n * Clear content and style of the textbox, unbind listeners and\r\n * reset CSS style.\r\n */\r\nTextBox.prototype.destroy = function() {\r\n var parent = this.parent,\r\n content = this.content,\r\n resizeHandle = this.resizeHandle;\r\n\r\n // clear content\r\n content.innerText = '';\r\n\r\n // clear styles\r\n parent.removeAttribute('style');\r\n content.removeAttribute('style');\r\n\r\n domEvent.unbind(content, 'keydown', this.keyHandler);\r\n domEvent.unbind(content, 'mousedown', stopPropagation);\r\n domEvent.unbind(content, 'input', this.autoResize);\r\n domEvent.unbind(content, 'paste', this.handlePaste);\r\n\r\n if (resizeHandle) {\r\n resizeHandle.removeAttribute('style');\r\n\r\n domRemove(resizeHandle);\r\n }\r\n\r\n domRemove(parent);\r\n};\r\n\r\n\r\nTextBox.prototype.getValue = function() {\r\n return this.content.innerText;\r\n};\r\n\r\n\r\nTextBox.prototype.getSelection = function() {\r\n var selection = window.getSelection(),\r\n range = selection.getRangeAt(0);\r\n\r\n return range;\r\n};\r\n\r\n\r\nTextBox.prototype.setSelection = function(container, offset) {\r\n var range = document.createRange();\r\n\r\n if (container === null) {\r\n range.selectNodeContents(this.content);\r\n } else {\r\n range.setStart(container, offset);\r\n range.setEnd(container, offset);\r\n }\r\n\r\n var selection = window.getSelection();\r\n\r\n selection.removeAllRanges();\r\n selection.addRange(range);\r\n};\r\n","module.exports = require(118);","'use strict';\n\nvar di = require(282);\n\n\n/**\n * Bootstrap an injector from a list of modules, instantiating a number of default components\n *\n * @ignore\n * @param {Array} bootstrapModules\n *\n * @return {didi.Injector} a injector to use to access the components\n */\nfunction bootstrap(bootstrapModules) {\n\n var modules = [],\n components = [];\n\n function hasModule(m) {\n return modules.indexOf(m) >= 0;\n }\n\n function addModule(m) {\n modules.push(m);\n }\n\n function visit(m) {\n if (hasModule(m)) {\n return;\n }\n\n (m.__depends__ || []).forEach(visit);\n\n if (hasModule(m)) {\n return;\n }\n\n addModule(m);\n\n (m.__init__ || []).forEach(function(c) {\n components.push(c);\n });\n }\n\n bootstrapModules.forEach(visit);\n\n var injector = new di.Injector(modules);\n\n components.forEach(function(c) {\n\n try {\n // eagerly resolve component (fn or string)\n injector[typeof c === 'string' ? 'get' : 'invoke'](c);\n } catch (e) {\n console.error('Failed to instantiate component');\n console.error(e.stack);\n\n throw e;\n }\n });\n\n return injector;\n}\n\n/**\n * Creates an injector from passed options.\n *\n * @ignore\n * @param {Object} options\n * @return {didi.Injector}\n */\nfunction createInjector(options) {\n\n options = options || {};\n\n var configModule = {\n 'config': ['value', options]\n };\n\n var coreModule = require(127);\n\n var modules = [ configModule, coreModule ].concat(options.modules || []);\n\n return bootstrap(modules);\n}\n\n\n/**\n * The main diagram-js entry point that bootstraps the diagram with the given\n * configuration.\n *\n * To register extensions with the diagram, pass them as Array to the constructor.\n *\n * @class djs.Diagram\n * @memberOf djs\n * @constructor\n *\n * @example\n *\n * Creating a plug-in that logs whenever a shape is added to the canvas.\n *\n * // plug-in implemenentation\n * function MyLoggingPlugin(eventBus) {\n * eventBus.on('shape.added', function(event) {\n * console.log('shape ', event.shape, ' was added to the diagram');\n * });\n * }\n *\n * // export as module\n * module.exports = {\n * __init__: [ 'myLoggingPlugin' ],\n * myLoggingPlugin: [ 'type', MyLoggingPlugin ]\n * };\n *\n *\n * // instantiate the diagram with the new plug-in\n *\n * var diagram = new Diagram({ modules: [ require('path-to-my-logging-plugin') ] });\n *\n * diagram.invoke([ 'canvas', function(canvas) {\n * // add shape to drawing canvas\n * canvas.addShape({ x: 10, y: 10 });\n * });\n *\n * // 'shape ... was added to the diagram' logged to console\n *\n * @param {Object} options\n * @param {Array} [options.modules] external modules to instantiate with the diagram\n * @param {didi.Injector} [injector] an (optional) injector to bootstrap the diagram with\n */\nfunction Diagram(options, injector) {\n\n // create injector unless explicitly specified\n this.injector = injector = injector || createInjector(options);\n\n // API\n\n /**\n * Resolves a diagram service\n *\n * @method Diagram#get\n *\n * @param {String} name the name of the diagram service to be retrieved\n * @param {Boolean} [strict=true] if false, resolve missing services to null\n */\n this.get = injector.get;\n\n /**\n * Executes a function into which diagram services are injected\n *\n * @method Diagram#invoke\n *\n * @param {Function|Object[]} fn the function to resolve\n * @param {Object} locals a number of locals to use to resolve certain dependencies\n */\n this.invoke = injector.invoke;\n\n // init\n\n // indicate via event\n\n\n /**\n * An event indicating that all plug-ins are loaded.\n *\n * Use this event to fire other events to interested plug-ins\n *\n * @memberOf Diagram\n *\n * @event diagram.init\n *\n * @example\n *\n * eventBus.on('diagram.init', function() {\n * eventBus.fire('my-custom-event', { foo: 'BAR' });\n * });\n *\n * @type {Object}\n */\n this.get('eventBus').fire('diagram.init');\n}\n\nmodule.exports = Diagram;\n\n\n/**\n * Destroys the diagram\n *\n * @method Diagram#destroy\n */\nDiagram.prototype.destroy = function() {\n this.get('eventBus').fire('diagram.destroy');\n};\n\n/**\n * Clear the diagram, removing all contents.\n */\nDiagram.prototype.clear = function() {\n this.get('eventBus').fire('diagram.clear');\n};\n","'use strict';\n\nvar forEach = require(303),\n isFunction = require(423),\n isArray = require(422),\n isNumber = require(425);\n\n\nvar DEFAULT_PRIORITY = 1000;\n\n\nfunction isObject(element) {\n return typeof element === 'object';\n}\n\n/**\n * A utility that can be used to plug-in into the command execution for\n * extension and/or validation.\n *\n * @param {EventBus} eventBus\n *\n * @example\n *\n * var inherits = require('inherits');\n *\n * var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor');\n *\n * function CommandLogger(eventBus) {\n * CommandInterceptor.call(this, eventBus);\n *\n * this.preExecute(function(event) {\n * console.log('command pre-execute', event);\n * });\n * }\n *\n * inherits(CommandLogger, CommandInterceptor);\n *\n */\nfunction CommandInterceptor(eventBus) {\n this._eventBus = eventBus;\n}\n\nCommandInterceptor.$inject = [ 'eventBus' ];\n\nmodule.exports = CommandInterceptor;\n\nfunction unwrapEvent(fn, that) {\n return function(event) {\n return fn.call(that || null, event.context, event.command, event);\n };\n}\n\n/**\n * Register an interceptor for a command execution\n *\n * @param {String|Array} [events] list of commands to register on\n * @param {String} [hook] command hook, i.e. preExecute, executed to listen on\n * @param {Number} [priority] the priority on which to hook into the execution\n * @param {Function} handlerFn interceptor to be invoked with (event)\n * @param {Boolean} unwrap if true, unwrap the event and pass (context, command, event) to the\n * listener instead\n * @param {Object} [that] Pass context (`this`) to the handler function\n */\nCommandInterceptor.prototype.on = function(events, hook, priority, handlerFn, unwrap, that) {\n\n if (isFunction(hook) || isNumber(hook)) {\n that = unwrap;\n unwrap = handlerFn;\n handlerFn = priority;\n priority = hook;\n hook = null;\n }\n\n if (isFunction(priority)) {\n that = unwrap;\n unwrap = handlerFn;\n handlerFn = priority;\n priority = DEFAULT_PRIORITY;\n }\n\n if (isObject(unwrap)) {\n that = unwrap;\n unwrap = false;\n }\n\n if (!isFunction(handlerFn)) {\n throw new Error('handlerFn must be a function');\n }\n\n if (!isArray(events)) {\n events = [ events ];\n }\n\n var eventBus = this._eventBus;\n\n forEach(events, function(event) {\n // concat commandStack(.event)?(.hook)?\n var fullEvent = [ 'commandStack', event, hook ].filter(function(e) { return e; }).join('.');\n\n eventBus.on(fullEvent, priority, unwrap ? unwrapEvent(handlerFn, that) : handlerFn, that);\n });\n};\n\n\nvar hooks = [\n 'canExecute',\n 'preExecute',\n 'preExecuted',\n 'execute',\n 'executed',\n 'postExecute',\n 'postExecuted',\n 'revert',\n 'reverted'\n];\n\n/*\n * Install hook shortcuts\n *\n * This will generate the CommandInterceptor#(preExecute|...|reverted) methods\n * which will in term forward to CommandInterceptor#on.\n */\nforEach(hooks, function(hook) {\n\n /**\n * {canExecute|preExecute|preExecuted|execute|executed|postExecute|postExecuted|revert|reverted}\n *\n * A named hook for plugging into the command execution\n *\n * @param {String|Array} [events] list of commands to register on\n * @param {Number} [priority] the priority on which to hook into the execution\n * @param {Function} handlerFn interceptor to be invoked with (event)\n * @param {Boolean} [unwrap=false] if true, unwrap the event and pass (context, command, event) to the\n * listener instead\n * @param {Object} [that] Pass context (`this`) to the handler function\n */\n CommandInterceptor.prototype[hook] = function(events, priority, handlerFn, unwrap, that) {\n\n if (isFunction(events) || isNumber(events)) {\n that = unwrap;\n unwrap = handlerFn;\n handlerFn = priority;\n priority = events;\n events = null;\n }\n\n this.on(events, hook, priority, handlerFn, unwrap, that);\n };\n});\n","'use strict';\n\nvar unique = require(296),\n isArray = require(422),\n assign = require(431);\n\nvar InternalEvent = require(125).Event;\n\n\n/**\n * A service that offers un- and redoable execution of commands.\n *\n * The command stack is responsible for executing modeling actions\n * in a un- and redoable manner. To do this it delegates the actual\n * command execution to {@link CommandHandler}s.\n *\n * Command handlers provide {@link CommandHandler#execute(ctx)} and\n * {@link CommandHandler#revert(ctx)} methods to un- and redo a command\n * identified by a command context.\n *\n *\n * ## Life-Cycle events\n *\n * In the process the command stack fires a number of life-cycle events\n * that other components to participate in the command execution.\n *\n * * preExecute\n * * preExecuted\n * * execute\n * * executed\n * * postExecute\n * * postExecuted\n * * revert\n * * reverted\n *\n * A special event is used for validating, whether a command can be\n * performed prior to its execution.\n *\n * * canExecute\n *\n * Each of the events is fired as `commandStack.{eventName}` and\n * `commandStack.{commandName}.{eventName}`, respectively. This gives\n * components fine grained control on where to hook into.\n *\n * The event object fired transports `command`, the name of the\n * command and `context`, the command context.\n *\n *\n * ## Creating Command Handlers\n *\n * Command handlers should provide the {@link CommandHandler#execute(ctx)}\n * and {@link CommandHandler#revert(ctx)} methods to implement\n * redoing and undoing of a command.\n *\n * A command handler _must_ ensure undo is performed properly in order\n * not to break the undo chain. It must also return the shapes that\n * got changed during the `execute` and `revert` operations.\n *\n * Command handlers may execute other modeling operations (and thus\n * commands) in their `preExecute` and `postExecute` phases. The command\n * stack will properly group all commands together into a logical unit\n * that may be re- and undone atomically.\n *\n * Command handlers must not execute other commands from within their\n * core implementation (`execute`, `revert`).\n *\n *\n * ## Change Tracking\n *\n * During the execution of the CommandStack it will keep track of all\n * elements that have been touched during the command's execution.\n *\n * At the end of the CommandStack execution it will notify interested\n * components via an 'elements.changed' event with all the dirty\n * elements.\n *\n * The event can be picked up by components that are interested in the fact\n * that elements have been changed. One use case for this is updating\n * their graphical representation after moving / resizing or deletion.\n *\n * @see CommandHandler\n *\n * @param {EventBus} eventBus\n * @param {Injector} injector\n */\nfunction CommandStack(eventBus, injector) {\n\n /**\n * A map of all registered command handlers.\n *\n * @type {Object}\n */\n this._handlerMap = {};\n\n /**\n * A stack containing all re/undoable actions on the diagram\n *\n * @type {Array}\n */\n this._stack = [];\n\n /**\n * The current index on the stack\n *\n * @type {Number}\n */\n this._stackIdx = -1;\n\n /**\n * Current active commandStack execution\n *\n * @type {Object}\n */\n this._currentExecution = {\n actions: [],\n dirty: []\n };\n\n\n this._injector = injector;\n this._eventBus = eventBus;\n\n this._uid = 1;\n\n eventBus.on([ 'diagram.destroy', 'diagram.clear' ], this.clear, this);\n}\n\nCommandStack.$inject = [ 'eventBus', 'injector' ];\n\nmodule.exports = CommandStack;\n\n\n/**\n * Execute a command\n *\n * @param {String} command the command to execute\n * @param {Object} context the environment to execute the command in\n */\nCommandStack.prototype.execute = function(command, context) {\n if (!command) {\n throw new Error('command required');\n }\n\n var action = { command: command, context: context };\n\n this._pushAction(action);\n this._internalExecute(action);\n this._popAction(action);\n};\n\n\n/**\n * Ask whether a given command can be executed.\n *\n * Implementors may hook into the mechanism on two ways:\n *\n * * in event listeners:\n *\n * Users may prevent the execution via an event listener.\n * It must prevent the default action for `commandStack.(.)canExecute` events.\n *\n * * in command handlers:\n *\n * If the method {@link CommandHandler#canExecute} is implemented in a handler\n * it will be called to figure out whether the execution is allowed.\n *\n * @param {String} command the command to execute\n * @param {Object} context the environment to execute the command in\n *\n * @return {Boolean} true if the command can be executed\n */\nCommandStack.prototype.canExecute = function(command, context) {\n\n var action = { command: command, context: context };\n\n var handler = this._getHandler(command);\n\n var result = this._fire(command, 'canExecute', action);\n\n // handler#canExecute will only be called if no listener\n // decided on a result already\n if (result === undefined) {\n if (!handler) {\n return false;\n }\n\n if (handler.canExecute) {\n result = handler.canExecute(context);\n }\n }\n\n return result;\n};\n\n\n/**\n * Clear the command stack, erasing all undo / redo history\n */\nCommandStack.prototype.clear = function() {\n this._stack.length = 0;\n this._stackIdx = -1;\n\n this._fire('changed');\n};\n\n\n/**\n * Undo last command(s)\n */\nCommandStack.prototype.undo = function() {\n var action = this._getUndoAction(),\n next;\n\n if (action) {\n this._pushAction(action);\n\n while (action) {\n this._internalUndo(action);\n next = this._getUndoAction();\n\n if (!next || next.id !== action.id) {\n break;\n }\n\n action = next;\n }\n\n this._popAction();\n }\n};\n\n\n/**\n * Redo last command(s)\n */\nCommandStack.prototype.redo = function() {\n var action = this._getRedoAction(),\n next;\n\n if (action) {\n this._pushAction(action);\n\n while (action) {\n this._internalExecute(action, true);\n next = this._getRedoAction();\n\n if (!next || next.id !== action.id) {\n break;\n }\n\n action = next;\n }\n\n this._popAction();\n }\n};\n\n\n/**\n * Register a handler instance with the command stack\n *\n * @param {String} command\n * @param {CommandHandler} handler\n */\nCommandStack.prototype.register = function(command, handler) {\n this._setHandler(command, handler);\n};\n\n\n/**\n * Register a handler type with the command stack\n * by instantiating it and injecting its dependencies.\n *\n * @param {String} command\n * @param {Function} a constructor for a {@link CommandHandler}\n */\nCommandStack.prototype.registerHandler = function(command, handlerCls) {\n\n if (!command || !handlerCls) {\n throw new Error('command and handlerCls must be defined');\n }\n\n var handler = this._injector.instantiate(handlerCls);\n this.register(command, handler);\n};\n\nCommandStack.prototype.canUndo = function() {\n return !!this._getUndoAction();\n};\n\nCommandStack.prototype.canRedo = function() {\n return !!this._getRedoAction();\n};\n\n////// stack access //////////////////////////////////////\n\nCommandStack.prototype._getRedoAction = function() {\n return this._stack[this._stackIdx + 1];\n};\n\n\nCommandStack.prototype._getUndoAction = function() {\n return this._stack[this._stackIdx];\n};\n\n\n////// internal functionality /////////////////////////////\n\nCommandStack.prototype._internalUndo = function(action) {\n var self = this;\n\n var command = action.command,\n context = action.context;\n\n var handler = this._getHandler(command);\n\n // guard against illegal nested command stack invocations\n this._atomicDo(function() {\n self._fire(command, 'revert', action);\n\n if (handler.revert) {\n self._markDirty(handler.revert(context));\n }\n\n self._revertedAction(action);\n\n self._fire(command, 'reverted', action);\n });\n};\n\n\nCommandStack.prototype._fire = function(command, qualifier, event) {\n if (arguments.length < 3) {\n event = qualifier;\n qualifier = null;\n }\n\n var names = qualifier ? [ command + '.' + qualifier, qualifier ] : [ command ],\n i, name, result;\n\n event = assign(new InternalEvent(), event);\n\n for (i = 0; (name = names[i]); i++) {\n result = this._eventBus.fire('commandStack.' + name, event);\n\n if (event.cancelBubble) {\n break;\n }\n }\n\n return result;\n};\n\nCommandStack.prototype._createId = function() {\n return this._uid++;\n};\n\nCommandStack.prototype._atomicDo = function(fn) {\n\n var execution = this._currentExecution;\n\n execution.atomic = true;\n\n try {\n fn();\n } finally {\n execution.atomic = false;\n }\n};\n\nCommandStack.prototype._internalExecute = function(action, redo) {\n var self = this;\n\n var command = action.command,\n context = action.context;\n\n var handler = this._getHandler(command);\n\n if (!handler) {\n throw new Error('no command handler registered for <' + command + '>');\n }\n\n this._pushAction(action);\n\n if (!redo) {\n this._fire(command, 'preExecute', action);\n\n if (handler.preExecute) {\n handler.preExecute(context);\n }\n\n this._fire(command, 'preExecuted', action);\n }\n\n // guard against illegal nested command stack invocations\n this._atomicDo(function() {\n\n self._fire(command, 'execute', action);\n\n if (handler.execute) {\n // actual execute + mark return results as dirty\n self._markDirty(handler.execute(context));\n }\n\n // log to stack\n self._executedAction(action, redo);\n\n self._fire(command, 'executed', action);\n });\n\n if (!redo) {\n this._fire(command, 'postExecute', action);\n\n if (handler.postExecute) {\n handler.postExecute(context);\n }\n\n this._fire(command, 'postExecuted', action);\n }\n\n this._popAction(action);\n};\n\n\nCommandStack.prototype._pushAction = function(action) {\n\n var execution = this._currentExecution,\n actions = execution.actions;\n\n var baseAction = actions[0];\n\n if (execution.atomic) {\n throw new Error('illegal invocation in or phase (action: ' + action.command + ')');\n }\n\n if (!action.id) {\n action.id = (baseAction && baseAction.id) || this._createId();\n }\n\n actions.push(action);\n};\n\n\nCommandStack.prototype._popAction = function() {\n var execution = this._currentExecution,\n actions = execution.actions,\n dirty = execution.dirty;\n\n actions.pop();\n\n if (!actions.length) {\n this._eventBus.fire('elements.changed', { elements: unique(dirty) });\n\n dirty.length = 0;\n\n this._fire('changed');\n }\n};\n\n\nCommandStack.prototype._markDirty = function(elements) {\n var execution = this._currentExecution;\n\n if (!elements) {\n return;\n }\n\n elements = isArray(elements) ? elements : [ elements ];\n\n execution.dirty = execution.dirty.concat(elements);\n};\n\n\nCommandStack.prototype._executedAction = function(action, redo) {\n var stackIdx = ++this._stackIdx;\n\n if (!redo) {\n this._stack.splice(stackIdx, this._stack.length, action);\n }\n};\n\n\nCommandStack.prototype._revertedAction = function(action) {\n this._stackIdx--;\n};\n\n\nCommandStack.prototype._getHandler = function(command) {\n return this._handlerMap[command];\n};\n\nCommandStack.prototype._setHandler = function(command, handler) {\n if (!command || !handler) {\n throw new Error('command and handler required');\n }\n\n if (this._handlerMap[command]) {\n throw new Error('overriding handler for command <' + command + '>');\n }\n\n this._handlerMap[command] = handler;\n};\n","module.exports = {\n commandStack: [ 'type', require(120) ]\n};\n","'use strict';\n\nvar isNumber = require(425),\n assign = require(431),\n forEach = require(303),\n every = require(300),\n debounce = require(313),\n reduce = require(306);\n\nvar Collections = require(263),\n Elements = require(266);\n\nvar svgAppend = require(472),\n svgAttr = require(474),\n svgClasses = require(475),\n svgCreate = require(478),\n svgTransform = require(482);\n\nvar createMatrix = require(479).createMatrix;\n\n\nfunction round(number, resolution) {\n return Math.round(number * resolution) / resolution;\n}\n\nfunction ensurePx(number) {\n return isNumber(number) ? number + 'px' : number;\n}\n\n/**\n * Creates a HTML container element for a SVG element with\n * the given configuration\n *\n * @param {Object} options\n * @return {HTMLElement} the container element\n */\nfunction createContainer(options) {\n\n options = assign({}, { width: '100%', height: '100%' }, options);\n\n var container = options.container || document.body;\n\n // create a
around the svg element with the respective size\n // this way we can always get the correct container size\n // (this is impossible for elements at the moment)\n var parent = document.createElement('div');\n parent.setAttribute('class', 'djs-container');\n\n assign(parent.style, {\n position: 'relative',\n overflow: 'hidden',\n width: ensurePx(options.width),\n height: ensurePx(options.height)\n });\n\n container.appendChild(parent);\n\n return parent;\n}\n\nfunction createGroup(parent, cls, childIndex) {\n var group = svgCreate('g');\n svgClasses(group).add(cls);\n\n var index = childIndex !== undefined ? childIndex : parent.childNodes.length - 1;\n\n parent.insertBefore(group, parent.childNodes[index]);\n\n return group;\n}\n\nvar BASE_LAYER = 'base';\n\n\nvar REQUIRED_MODEL_ATTRS = {\n shape: [ 'x', 'y', 'width', 'height' ],\n connection: [ 'waypoints' ]\n};\n\n/**\n * The main drawing canvas.\n *\n * @class\n * @constructor\n *\n * @emits Canvas#canvas.init\n *\n * @param {Object} config\n * @param {EventBus} eventBus\n * @param {GraphicsFactory} graphicsFactory\n * @param {ElementRegistry} elementRegistry\n */\nfunction Canvas(config, eventBus, graphicsFactory, elementRegistry) {\n\n this._eventBus = eventBus;\n this._elementRegistry = elementRegistry;\n this._graphicsFactory = graphicsFactory;\n\n this._init(config || {});\n}\n\nCanvas.$inject = [ 'config.canvas', 'eventBus', 'graphicsFactory', 'elementRegistry' ];\n\nmodule.exports = Canvas;\n\n\nCanvas.prototype._init = function(config) {\n\n var eventBus = this._eventBus;\n\n // Creates a element that is wrapped into a
.\n // This way we are always able to correctly figure out the size of the svg element\n // by querying the parent node.\n //\n // (It is not possible to get the size of a svg element cross browser @ 2014-04-01)\n //\n //
\n // \n // ...\n // \n //
\n\n // html container\n var container = this._container = createContainer(config);\n\n var svg = this._svg = svgCreate('svg');\n svgAttr(svg, { width: '100%', height: '100%' });\n\n svgAppend(container, svg);\n\n var viewport = this._viewport = createGroup(svg, 'viewport');\n\n this._layers = {};\n\n // debounce canvas.viewbox.changed events\n // for smoother diagram interaction\n if (config.deferUpdate !== false) {\n this._viewboxChanged = debounce(this._viewboxChanged, 300);\n }\n\n eventBus.on('diagram.init', function() {\n\n /**\n * An event indicating that the canvas is ready to be drawn on.\n *\n * @memberOf Canvas\n *\n * @event canvas.init\n *\n * @type {Object}\n * @property {SVGElement} svg the created svg element\n * @property {SVGElement} viewport the direct parent of diagram elements and shapes\n */\n eventBus.fire('canvas.init', {\n svg: svg,\n viewport: viewport\n });\n\n // fire this in order for certain components to check\n // if they need to be adjusted due the canvas size\n this.resized();\n\n }, this);\n\n eventBus.on('diagram.destroy', 500, this._destroy, this);\n eventBus.on('diagram.clear', 500, this._clear, this);\n};\n\nCanvas.prototype._destroy = function(emit) {\n this._eventBus.fire('canvas.destroy', {\n svg: this._svg,\n viewport: this._viewport\n });\n\n var parent = this._container.parentNode;\n\n if (parent) {\n parent.removeChild(this._container);\n }\n\n delete this._svg;\n delete this._container;\n delete this._layers;\n delete this._rootElement;\n delete this._viewport;\n};\n\nCanvas.prototype._clear = function() {\n\n var self = this;\n\n var allElements = this._elementRegistry.getAll();\n\n // remove all elements\n allElements.forEach(function(element) {\n var type = Elements.getType(element);\n\n if (type === 'root') {\n self.setRootElement(null, true);\n } else {\n self._removeElement(element, type);\n }\n });\n\n // force recomputation of view box\n delete this._cachedViewbox;\n};\n\n/**\n * Returns the default layer on which\n * all elements are drawn.\n *\n * @returns {SVGElement}\n */\nCanvas.prototype.getDefaultLayer = function() {\n return this.getLayer(BASE_LAYER, 0);\n};\n\n/**\n * Returns a layer that is used to draw elements\n * or annotations on it.\n *\n * Non-existing layers retrieved through this method\n * will be created. During creation, the optional index\n * may be used to create layers below or above existing layers.\n * A layer with a certain index is always created above all\n * existing layers with the same index.\n *\n * @param {String} name\n * @param {Number} index\n *\n * @returns {SVGElement}\n */\nCanvas.prototype.getLayer = function(name, index) {\n\n if (!name) {\n throw new Error('must specify a name');\n }\n\n var layer = this._layers[name];\n\n if (!layer) {\n layer = this._layers[name] = this._createLayer(name, index);\n }\n\n // throw an error if layer creation / retrival is\n // requested on different index\n if (typeof index !== 'undefined' && layer.index !== index) {\n throw new Error('layer <' + name + '> already created at index <' + index + '>');\n }\n\n return layer.group;\n};\n\n/**\n * Creates a given layer and returns it.\n *\n * @param {String} name\n * @param {Number} [index=0]\n *\n * @return {Object} layer descriptor with { index, group: SVGGroup }\n */\nCanvas.prototype._createLayer = function(name, index) {\n\n if (!index) {\n index = 0;\n }\n\n var childIndex = reduce(this._layers, function(childIndex, layer) {\n if (index >= layer.index) {\n childIndex++;\n }\n\n return childIndex;\n }, 0);\n\n return {\n group: createGroup(this._viewport, 'layer-' + name, childIndex),\n index: index\n };\n\n};\n\n/**\n * Returns the html element that encloses the\n * drawing canvas.\n *\n * @return {DOMNode}\n */\nCanvas.prototype.getContainer = function() {\n return this._container;\n};\n\n\n/////////////// markers ///////////////////////////////////\n\nCanvas.prototype._updateMarker = function(element, marker, add) {\n var container;\n\n if (!element.id) {\n element = this._elementRegistry.get(element);\n }\n\n // we need to access all\n container = this._elementRegistry._elements[element.id];\n\n if (!container) {\n return;\n }\n\n forEach([ container.gfx, container.secondaryGfx ], function(gfx) {\n if (gfx) {\n // invoke either addClass or removeClass based on mode\n if (add) {\n svgClasses(gfx).add(marker);\n } else {\n svgClasses(gfx).remove(marker);\n }\n }\n });\n\n /**\n * An event indicating that a marker has been updated for an element\n *\n * @event element.marker.update\n * @type {Object}\n * @property {djs.model.Element} element the shape\n * @property {Object} gfx the graphical representation of the shape\n * @property {String} marker\n * @property {Boolean} add true if the marker was added, false if it got removed\n */\n this._eventBus.fire('element.marker.update', { element: element, gfx: container.gfx, marker: marker, add: !!add });\n};\n\n\n/**\n * Adds a marker to an element (basically a css class).\n *\n * Fires the element.marker.update event, making it possible to\n * integrate extension into the marker life-cycle, too.\n *\n * @example\n * canvas.addMarker('foo', 'some-marker');\n *\n * var fooGfx = canvas.getGraphics('foo');\n *\n * fooGfx; // ... \n *\n * @param {String|djs.model.Base} element\n * @param {String} marker\n */\nCanvas.prototype.addMarker = function(element, marker) {\n this._updateMarker(element, marker, true);\n};\n\n\n/**\n * Remove a marker from an element.\n *\n * Fires the element.marker.update event, making it possible to\n * integrate extension into the marker life-cycle, too.\n *\n * @param {String|djs.model.Base} element\n * @param {String} marker\n */\nCanvas.prototype.removeMarker = function(element, marker) {\n this._updateMarker(element, marker, false);\n};\n\n/**\n * Check the existence of a marker on element.\n *\n * @param {String|djs.model.Base} element\n * @param {String} marker\n */\nCanvas.prototype.hasMarker = function(element, marker) {\n if (!element.id) {\n element = this._elementRegistry.get(element);\n }\n\n var gfx = this.getGraphics(element);\n\n return svgClasses(gfx).has(marker);\n};\n\n/**\n * Toggles a marker on an element.\n *\n * Fires the element.marker.update event, making it possible to\n * integrate extension into the marker life-cycle, too.\n *\n * @param {String|djs.model.Base} element\n * @param {String} marker\n */\nCanvas.prototype.toggleMarker = function(element, marker) {\n if (this.hasMarker(element, marker)) {\n this.removeMarker(element, marker);\n } else {\n this.addMarker(element, marker);\n }\n};\n\nCanvas.prototype.getRootElement = function() {\n if (!this._rootElement) {\n this.setRootElement({ id: '__implicitroot', children: [] });\n }\n\n return this._rootElement;\n};\n\n\n\n//////////////// root element handling ///////////////////////////\n\n/**\n * Sets a given element as the new root element for the canvas\n * and returns the new root element.\n *\n * @param {Object|djs.model.Root} element\n * @param {Boolean} [override] whether to override the current root element, if any\n *\n * @return {Object|djs.model.Root} new root element\n */\nCanvas.prototype.setRootElement = function(element, override) {\n\n if (element) {\n this._ensureValid('root', element);\n }\n\n var currentRoot = this._rootElement,\n elementRegistry = this._elementRegistry,\n eventBus = this._eventBus;\n\n if (currentRoot) {\n if (!override) {\n throw new Error('rootElement already set, need to specify override');\n }\n\n // simulate element remove event sequence\n eventBus.fire('root.remove', { element: currentRoot });\n eventBus.fire('root.removed', { element: currentRoot });\n\n elementRegistry.remove(currentRoot);\n }\n\n if (element) {\n var gfx = this.getDefaultLayer();\n\n // resemble element add event sequence\n eventBus.fire('root.add', { element: element });\n\n elementRegistry.add(element, gfx, this._svg);\n\n eventBus.fire('root.added', { element: element, gfx: gfx });\n }\n\n this._rootElement = element;\n\n return element;\n};\n\n\n\n///////////// add functionality ///////////////////////////////\n\nCanvas.prototype._ensureValid = function(type, element) {\n if (!element.id) {\n throw new Error('element must have an id');\n }\n\n if (this._elementRegistry.get(element.id)) {\n throw new Error('element with id ' + element.id + ' already exists');\n }\n\n var requiredAttrs = REQUIRED_MODEL_ATTRS[type];\n\n var valid = every(requiredAttrs, function(attr) {\n return typeof element[attr] !== 'undefined';\n });\n\n if (!valid) {\n throw new Error(\n 'must supply { ' + requiredAttrs.join(', ') + ' } with ' + type);\n }\n};\n\nCanvas.prototype._setParent = function(element, parent, parentIndex) {\n Collections.add(parent.children, element, parentIndex);\n element.parent = parent;\n};\n\n/**\n * Adds an element to the canvas.\n *\n * This wires the parent <-> child relationship between the element and\n * a explicitly specified parent or an implicit root element.\n *\n * During add it emits the events\n *\n * * <{type}.add> (element, parent)\n * * <{type}.added> (element, gfx)\n *\n * Extensions may hook into these events to perform their magic.\n *\n * @param {String} type\n * @param {Object|djs.model.Base} element\n * @param {Object|djs.model.Base} [parent]\n * @param {Number} [parentIndex]\n *\n * @return {Object|djs.model.Base} the added element\n */\nCanvas.prototype._addElement = function(type, element, parent, parentIndex) {\n\n parent = parent || this.getRootElement();\n\n var eventBus = this._eventBus,\n graphicsFactory = this._graphicsFactory;\n\n this._ensureValid(type, element);\n\n eventBus.fire(type + '.add', { element: element, parent: parent });\n\n this._setParent(element, parent, parentIndex);\n\n // create graphics\n var gfx = graphicsFactory.create(type, element);\n\n this._elementRegistry.add(element, gfx);\n\n // update its visual\n graphicsFactory.update(type, element, gfx);\n\n eventBus.fire(type + '.added', { element: element, gfx: gfx });\n\n return element;\n};\n\n/**\n * Adds a shape to the canvas\n *\n * @param {Object|djs.model.Shape} shape to add to the diagram\n * @param {djs.model.Base} [parent]\n * @param {Number} [parentIndex]\n *\n * @return {djs.model.Shape} the added shape\n */\nCanvas.prototype.addShape = function(shape, parent, parentIndex) {\n return this._addElement('shape', shape, parent, parentIndex);\n};\n\n/**\n * Adds a connection to the canvas\n *\n * @param {Object|djs.model.Connection} connection to add to the diagram\n * @param {djs.model.Base} [parent]\n * @param {Number} [parentIndex]\n *\n * @return {djs.model.Connection} the added connection\n */\nCanvas.prototype.addConnection = function(connection, parent, parentIndex) {\n return this._addElement('connection', connection, parent, parentIndex);\n};\n\n\n/**\n * Internal remove element\n */\nCanvas.prototype._removeElement = function(element, type) {\n\n var elementRegistry = this._elementRegistry,\n graphicsFactory = this._graphicsFactory,\n eventBus = this._eventBus;\n\n element = elementRegistry.get(element.id || element);\n\n if (!element) {\n // element was removed already\n return;\n }\n\n eventBus.fire(type + '.remove', { element: element });\n\n graphicsFactory.remove(element);\n\n // unset parent <-> child relationship\n Collections.remove(element.parent && element.parent.children, element);\n element.parent = null;\n\n eventBus.fire(type + '.removed', { element: element });\n\n elementRegistry.remove(element);\n\n return element;\n};\n\n\n/**\n * Removes a shape from the canvas\n *\n * @param {String|djs.model.Shape} shape or shape id to be removed\n *\n * @return {djs.model.Shape} the removed shape\n */\nCanvas.prototype.removeShape = function(shape) {\n\n /**\n * An event indicating that a shape is about to be removed from the canvas.\n *\n * @memberOf Canvas\n *\n * @event shape.remove\n * @type {Object}\n * @property {djs.model.Shape} element the shape descriptor\n * @property {Object} gfx the graphical representation of the shape\n */\n\n /**\n * An event indicating that a shape has been removed from the canvas.\n *\n * @memberOf Canvas\n *\n * @event shape.removed\n * @type {Object}\n * @property {djs.model.Shape} element the shape descriptor\n * @property {Object} gfx the graphical representation of the shape\n */\n return this._removeElement(shape, 'shape');\n};\n\n\n/**\n * Removes a connection from the canvas\n *\n * @param {String|djs.model.Connection} connection or connection id to be removed\n *\n * @return {djs.model.Connection} the removed connection\n */\nCanvas.prototype.removeConnection = function(connection) {\n\n /**\n * An event indicating that a connection is about to be removed from the canvas.\n *\n * @memberOf Canvas\n *\n * @event connection.remove\n * @type {Object}\n * @property {djs.model.Connection} element the connection descriptor\n * @property {Object} gfx the graphical representation of the connection\n */\n\n /**\n * An event indicating that a connection has been removed from the canvas.\n *\n * @memberOf Canvas\n *\n * @event connection.removed\n * @type {Object}\n * @property {djs.model.Connection} element the connection descriptor\n * @property {Object} gfx the graphical representation of the connection\n */\n return this._removeElement(connection, 'connection');\n};\n\n\n/**\n * Return the graphical object underlaying a certain diagram element\n *\n * @param {String|djs.model.Base} element descriptor of the element\n * @param {Boolean} [secondary=false] whether to return the secondary connected element\n *\n * @return {SVGElement}\n */\nCanvas.prototype.getGraphics = function(element, secondary) {\n return this._elementRegistry.getGraphics(element, secondary);\n};\n\n\n/**\n * Perform a viewbox update via a given change function.\n *\n * @param {Function} changeFn\n */\nCanvas.prototype._changeViewbox = function(changeFn) {\n\n // notify others of the upcoming viewbox change\n this._eventBus.fire('canvas.viewbox.changing');\n\n // perform actual change\n changeFn.apply(this);\n\n // reset the cached viewbox so that\n // a new get operation on viewbox or zoom\n // triggers a viewbox re-computation\n this._cachedViewbox = null;\n\n // notify others of the change; this step\n // may or may not be debounced\n this._viewboxChanged();\n};\n\nCanvas.prototype._viewboxChanged = function() {\n this._eventBus.fire('canvas.viewbox.changed', { viewbox: this.viewbox() });\n};\n\n\n/**\n * Gets or sets the view box of the canvas, i.e. the\n * area that is currently displayed.\n *\n * The getter may return a cached viewbox (if it is currently\n * changing). To force a recomputation, pass `false` as the first argument.\n *\n * @example\n *\n * canvas.viewbox({ x: 100, y: 100, width: 500, height: 500 })\n *\n * // sets the visible area of the diagram to (100|100) -> (600|100)\n * // and and scales it according to the diagram width\n *\n * var viewbox = canvas.viewbox(); // pass `false` to force recomputing the box.\n *\n * console.log(viewbox);\n * // {\n * // inner: Dimensions,\n * // outer: Dimensions,\n * // scale,\n * // x, y,\n * // width, height\n * // }\n *\n * // if the current diagram is zoomed and scrolled, you may reset it to the\n * // default zoom via this method, too:\n *\n * var zoomedAndScrolledViewbox = canvas.viewbox();\n *\n * canvas.viewbox({\n * x: 0,\n * y: 0,\n * width: zoomedAndScrolledViewbox.outer.width,\n * height: zoomedAndScrolledViewbox.outer.height\n * });\n *\n * @param {Object} [box] the new view box to set\n * @param {Number} box.x the top left X coordinate of the canvas visible in view box\n * @param {Number} box.y the top left Y coordinate of the canvas visible in view box\n * @param {Number} box.width the visible width\n * @param {Number} box.height\n *\n * @return {Object} the current view box\n */\nCanvas.prototype.viewbox = function(box) {\n\n if (box === undefined && this._cachedViewbox) {\n return this._cachedViewbox;\n }\n\n var viewport = this._viewport,\n innerBox,\n outerBox = this.getSize(),\n matrix,\n scale,\n x, y;\n\n if (!box) {\n // compute the inner box based on the\n // diagrams default layer. This allows us to exclude\n // external components, such as overlays\n innerBox = this.getDefaultLayer().getBBox();\n\n var transform = svgTransform(viewport);\n matrix = transform ? transform.matrix : createMatrix();\n scale = round(matrix.a, 1000);\n\n x = round(-matrix.e || 0, 1000);\n y = round(-matrix.f || 0, 1000);\n\n box = this._cachedViewbox = {\n x: x ? x / scale : 0,\n y: y ? y / scale : 0,\n width: outerBox.width / scale,\n height: outerBox.height / scale,\n scale: scale,\n inner: {\n width: innerBox.width,\n height: innerBox.height,\n x: innerBox.x,\n y: innerBox.y\n },\n outer: outerBox\n };\n\n return box;\n } else {\n\n this._changeViewbox(function() {\n scale = Math.min(outerBox.width / box.width, outerBox.height / box.height);\n\n var matrix = this._svg.createSVGMatrix()\n .scale(scale)\n .translate(-box.x, -box.y);\n\n svgTransform(viewport, matrix);\n });\n }\n\n return box;\n};\n\n\n/**\n * Gets or sets the scroll of the canvas.\n *\n * @param {Object} [delta] the new scroll to apply.\n *\n * @param {Number} [delta.dx]\n * @param {Number} [delta.dy]\n */\nCanvas.prototype.scroll = function(delta) {\n\n var node = this._viewport;\n var matrix = node.getCTM();\n\n if (delta) {\n this._changeViewbox(function() {\n delta = assign({ dx: 0, dy: 0 }, delta || {});\n\n matrix = this._svg.createSVGMatrix().translate(delta.dx, delta.dy).multiply(matrix);\n\n setCTM(node, matrix);\n });\n }\n\n return { x: matrix.e, y: matrix.f };\n};\n\n\n/**\n * Gets or sets the current zoom of the canvas, optionally zooming\n * to the specified position.\n *\n * The getter may return a cached zoom level. Call it with `false` as\n * the first argument to force recomputation of the current level.\n *\n * @param {String|Number} [newScale] the new zoom level, either a number, i.e. 0.9,\n * or `fit-viewport` to adjust the size to fit the current viewport\n * @param {String|Point} [center] the reference point { x: .., y: ..} to zoom to, 'auto' to zoom into mid or null\n *\n * @return {Number} the current scale\n */\nCanvas.prototype.zoom = function(newScale, center) {\n\n if (!newScale) {\n return this.viewbox(newScale).scale;\n }\n\n if (newScale === 'fit-viewport') {\n return this._fitViewport(center);\n }\n\n var outer,\n matrix;\n\n this._changeViewbox(function() {\n\n if (typeof center !== 'object') {\n outer = this.viewbox().outer;\n\n center = {\n x: outer.width / 2,\n y: outer.height / 2\n };\n }\n\n matrix = this._setZoom(newScale, center);\n });\n\n return round(matrix.a, 1000);\n};\n\nfunction setCTM(node, m) {\n var mstr = 'matrix(' + m.a + ',' + m.b + ',' + m.c + ',' + m.d + ',' + m.e + ',' + m.f + ')';\n node.setAttribute('transform', mstr);\n}\n\nCanvas.prototype._fitViewport = function(center) {\n\n var vbox = this.viewbox(),\n outer = vbox.outer,\n inner = vbox.inner,\n newScale,\n newViewbox;\n\n // display the complete diagram without zooming in.\n // instead of relying on internal zoom, we perform a\n // hard reset on the canvas viewbox to realize this\n //\n // if diagram does not need to be zoomed in, we focus it around\n // the diagram origin instead\n\n if (inner.x >= 0 &&\n inner.y >= 0 &&\n inner.x + inner.width <= outer.width &&\n inner.y + inner.height <= outer.height &&\n !center) {\n\n newViewbox = {\n x: 0,\n y: 0,\n width: Math.max(inner.width + inner.x, outer.width),\n height: Math.max(inner.height + inner.y, outer.height)\n };\n } else {\n\n newScale = Math.min(1, outer.width / inner.width, outer.height / inner.height);\n newViewbox = {\n x: inner.x + (center ? inner.width / 2 - outer.width / newScale / 2 : 0),\n y: inner.y + (center ? inner.height / 2 - outer.height / newScale / 2 : 0),\n width: outer.width / newScale,\n height: outer.height / newScale\n };\n }\n\n this.viewbox(newViewbox);\n\n return this.viewbox(false).scale;\n};\n\n\nCanvas.prototype._setZoom = function(scale, center) {\n\n var svg = this._svg,\n viewport = this._viewport;\n\n var matrix = svg.createSVGMatrix();\n var point = svg.createSVGPoint();\n\n var centerPoint,\n originalPoint,\n currentMatrix,\n scaleMatrix,\n newMatrix;\n\n currentMatrix = viewport.getCTM();\n\n var currentScale = currentMatrix.a;\n\n if (center) {\n centerPoint = assign(point, center);\n\n // revert applied viewport transformations\n originalPoint = centerPoint.matrixTransform(currentMatrix.inverse());\n\n // create scale matrix\n scaleMatrix = matrix\n .translate(originalPoint.x, originalPoint.y)\n .scale(1 / currentScale * scale)\n .translate(-originalPoint.x, -originalPoint.y);\n\n newMatrix = currentMatrix.multiply(scaleMatrix);\n } else {\n newMatrix = matrix.scale(scale);\n }\n\n setCTM(this._viewport, newMatrix);\n\n return newMatrix;\n};\n\n\n/**\n * Returns the size of the canvas\n *\n * @return {Dimensions}\n */\nCanvas.prototype.getSize = function() {\n return {\n width: this._container.clientWidth,\n height: this._container.clientHeight\n };\n};\n\n\n/**\n * Return the absolute bounding box for the given element\n *\n * The absolute bounding box may be used to display overlays in the\n * callers (browser) coordinate system rather than the zoomed in/out\n * canvas coordinates.\n *\n * @param {ElementDescriptor} element\n * @return {Bounds} the absolute bounding box\n */\nCanvas.prototype.getAbsoluteBBox = function(element) {\n var vbox = this.viewbox();\n var bbox;\n\n // connection\n // use svg bbox\n if (element.waypoints) {\n var gfx = this.getGraphics(element);\n\n bbox = gfx.getBBox();\n }\n // shapes\n // use data\n else {\n bbox = element;\n }\n\n var x = bbox.x * vbox.scale - vbox.x * vbox.scale;\n var y = bbox.y * vbox.scale - vbox.y * vbox.scale;\n\n var width = bbox.width * vbox.scale;\n var height = bbox.height * vbox.scale;\n\n return {\n x: x,\n y: y,\n width: width,\n height: height\n };\n};\n\n/**\n * Fires an event in order other modules can react to the\n * canvas resizing\n */\nCanvas.prototype.resized = function() {\n\n // force recomputation of view box\n delete this._cachedViewbox;\n\n this._eventBus.fire('canvas.resized');\n};\n","'use strict';\n\nvar Model = require(254);\n\nvar assign = require(431);\n\n/**\n * A factory for diagram-js shapes\n */\nfunction ElementFactory() {\n this._uid = 12;\n}\n\nmodule.exports = ElementFactory;\n\n\nElementFactory.prototype.createRoot = function(attrs) {\n return this.create('root', attrs);\n};\n\nElementFactory.prototype.createLabel = function(attrs) {\n return this.create('label', attrs);\n};\n\nElementFactory.prototype.createShape = function(attrs) {\n return this.create('shape', attrs);\n};\n\nElementFactory.prototype.createConnection = function(attrs) {\n return this.create('connection', attrs);\n};\n\n/**\n * Create a model element with the given type and\n * a number of pre-set attributes.\n *\n * @param {String} type\n * @param {Object} attrs\n * @return {djs.model.Base} the newly created model instance\n */\nElementFactory.prototype.create = function(type, attrs) {\n\n attrs = assign({}, attrs || {});\n\n if (!attrs.id) {\n attrs.id = type + '_' + (this._uid++);\n }\n\n return Model.create(type, attrs);\n};","'use strict';\n\nvar ELEMENT_ID = 'data-element-id';\n\nvar svgAttr = require(474);\n\n\n/**\n * @class\n *\n * A registry that keeps track of all shapes in the diagram.\n */\nfunction ElementRegistry(eventBus) {\n this._elements = {};\n\n this._eventBus = eventBus;\n}\n\nElementRegistry.$inject = [ 'eventBus' ];\n\nmodule.exports = ElementRegistry;\n\n/**\n * Register a pair of (element, gfx, (secondaryGfx)).\n *\n * @param {djs.model.Base} element\n * @param {SVGElement} gfx\n * @param {SVGElement} [secondaryGfx] optional other element to register, too\n */\nElementRegistry.prototype.add = function(element, gfx, secondaryGfx) {\n\n var id = element.id;\n\n this._validateId(id);\n\n // associate dom node with element\n svgAttr(gfx, ELEMENT_ID, id);\n\n if (secondaryGfx) {\n svgAttr(secondaryGfx, ELEMENT_ID, id);\n }\n\n this._elements[id] = { element: element, gfx: gfx, secondaryGfx: secondaryGfx };\n};\n\n/**\n * Removes an element from the registry.\n *\n * @param {djs.model.Base} element\n */\nElementRegistry.prototype.remove = function(element) {\n var elements = this._elements,\n id = element.id || element,\n container = id && elements[id];\n\n if (container) {\n\n // unset element id on gfx\n svgAttr(container.gfx, ELEMENT_ID, '');\n\n if (container.secondaryGfx) {\n svgAttr(container.secondaryGfx, ELEMENT_ID, '');\n }\n\n delete elements[id];\n }\n};\n\n/**\n * Update the id of an element\n *\n * @param {djs.model.Base} element\n * @param {String} newId\n */\nElementRegistry.prototype.updateId = function(element, newId) {\n\n this._validateId(newId);\n\n if (typeof element === 'string') {\n element = this.get(element);\n }\n\n this._eventBus.fire('element.updateId', {\n element: element,\n newId: newId\n });\n\n var gfx = this.getGraphics(element),\n secondaryGfx = this.getGraphics(element, true);\n\n this.remove(element);\n\n element.id = newId;\n\n this.add(element, gfx, secondaryGfx);\n};\n\n/**\n * Return the model element for a given id or graphics.\n *\n * @example\n *\n * elementRegistry.get('SomeElementId_1');\n * elementRegistry.get(gfx);\n *\n *\n * @param {String|SVGElement} filter for selecting the element\n *\n * @return {djs.model.Base}\n */\nElementRegistry.prototype.get = function(filter) {\n var id;\n\n if (typeof filter === 'string') {\n id = filter;\n } else {\n id = filter && svgAttr(filter, ELEMENT_ID);\n }\n\n var container = this._elements[id];\n return container && container.element;\n};\n\n/**\n * Return all elements that match a given filter function.\n *\n * @param {Function} fn\n *\n * @return {Array}\n */\nElementRegistry.prototype.filter = function(fn) {\n\n var filtered = [];\n\n this.forEach(function(element, gfx) {\n if (fn(element, gfx)) {\n filtered.push(element);\n }\n });\n\n return filtered;\n};\n\n/**\n * Return all rendered model elements.\n *\n * @return {Array}\n */\nElementRegistry.prototype.getAll = function() {\n return this.filter(function(e) { return e; });\n};\n\n/**\n * Iterate over all diagram elements.\n *\n * @param {Function} fn\n */\nElementRegistry.prototype.forEach = function(fn) {\n\n var map = this._elements;\n\n Object.keys(map).forEach(function(id) {\n var container = map[id],\n element = container.element,\n gfx = container.gfx;\n\n return fn(element, gfx);\n });\n};\n\n/**\n * Return the graphical representation of an element or its id.\n *\n * @example\n * elementRegistry.getGraphics('SomeElementId_1');\n * elementRegistry.getGraphics(rootElement); // \n *\n * elementRegistry.getGraphics(rootElement, true); // \n *\n *\n * @param {String|djs.model.Base} filter\n * @param {Boolean} [secondary=false] whether to return the secondary connected element\n *\n * @return {SVGElement}\n */\nElementRegistry.prototype.getGraphics = function(filter, secondary) {\n var id = filter.id || filter;\n\n var container = this._elements[id];\n return container && (secondary ? container.secondaryGfx : container.gfx);\n};\n\n/**\n * Validate the suitability of the given id and signals a problem\n * with an exception.\n *\n * @param {String} id\n *\n * @throws {Error} if id is empty or already assigned\n */\nElementRegistry.prototype._validateId = function(id) {\n if (!id) {\n throw new Error('element must have an id');\n }\n\n if (this._elements[id]) {\n throw new Error('element with id ' + id + ' already added');\n }\n};\n","'use strict';\n\nvar isFunction = require(423),\n isArray = require(422),\n isNumber = require(425),\n bind = require(312),\n assign = require(431);\n\nvar FN_REF = '__fn';\n\nvar DEFAULT_PRIORITY = 1000;\n\nvar slice = Array.prototype.slice;\n\n/**\n * A general purpose event bus.\n *\n * This component is used to communicate across a diagram instance.\n * Other parts of a diagram can use it to listen to and broadcast events.\n *\n *\n * ## Registering for Events\n *\n * The event bus provides the {@link EventBus#on} and {@link EventBus#once}\n * methods to register for events. {@link EventBus#off} can be used to\n * remove event registrations. Listeners receive an instance of {@link Event}\n * as the first argument. It allows them to hook into the event execution.\n *\n * ```javascript\n *\n * // listen for event\n * eventBus.on('foo', function(event) {\n *\n * // access event type\n * event.type; // 'foo'\n *\n * // stop propagation to other listeners\n * event.stopPropagation();\n *\n * // prevent event default\n * event.preventDefault();\n * });\n *\n * // listen for event with custom payload\n * eventBus.on('bar', function(event, payload) {\n * console.log(payload);\n * });\n *\n * // listen for event returning value\n * eventBus.on('foobar', function(event) {\n *\n * // stop event propagation + prevent default\n * return false;\n *\n * // stop event propagation + return custom result\n * return {\n * complex: 'listening result'\n * };\n * });\n *\n *\n * // listen with custom priority (default=1000, higher is better)\n * eventBus.on('priorityfoo', 1500, function(event) {\n * console.log('invoked first!');\n * });\n *\n *\n * // listen for event and pass the context (`this`)\n * eventBus.on('foobar', function(event) {\n * this.foo();\n * }, this);\n * ```\n *\n *\n * ## Emitting Events\n *\n * Events can be emitted via the event bus using {@link EventBus#fire}.\n *\n * ```javascript\n *\n * // false indicates that the default action\n * // was prevented by listeners\n * if (eventBus.fire('foo') === false) {\n * console.log('default has been prevented!');\n * };\n *\n *\n * // custom args + return value listener\n * eventBus.on('sum', function(event, a, b) {\n * return a + b;\n * });\n *\n * // you can pass custom arguments + retrieve result values.\n * var sum = eventBus.fire('sum', 1, 2);\n * console.log(sum); // 3\n * ```\n */\nfunction EventBus() {\n this._listeners = {};\n\n // cleanup on destroy on lowest priority to allow\n // message passing until the bitter end\n this.on('diagram.destroy', 1, this._destroy, this);\n}\n\nmodule.exports = EventBus;\n\n\n/**\n * Register an event listener for events with the given name.\n *\n * The callback will be invoked with `event, ...additionalArguments`\n * that have been passed to {@link EventBus#fire}.\n *\n * Returning false from a listener will prevent the events default action\n * (if any is specified). To stop an event from being processed further in\n * other listeners execute {@link Event#stopPropagation}.\n *\n * Returning anything but `undefined` from a listener will stop the listener propagation.\n *\n * @param {String|Array} events\n * @param {Number} [priority=1000] the priority in which this listener is called, larger is higher\n * @param {Function} callback\n * @param {Object} [that] Pass context (`this`) to the callback\n */\nEventBus.prototype.on = function(events, priority, callback, that) {\n\n events = isArray(events) ? events : [ events ];\n\n if (isFunction(priority)) {\n that = callback;\n callback = priority;\n priority = DEFAULT_PRIORITY;\n }\n\n if (!isNumber(priority)) {\n throw new Error('priority must be a number');\n }\n\n var actualCallback = callback;\n\n if (that) {\n actualCallback = bind(callback, that);\n\n // make sure we remember and are able to remove\n // bound callbacks via {@link #off} using the original\n // callback\n actualCallback[FN_REF] = callback[FN_REF] || callback;\n }\n\n var self = this,\n listener = { priority: priority, callback: actualCallback };\n\n events.forEach(function(e) {\n self._addListener(e, listener);\n });\n};\n\n\n/**\n * Register an event listener that is executed only once.\n *\n * @param {String} event the event name to register for\n * @param {Function} callback the callback to execute\n * @param {Object} [that] Pass context (`this`) to the callback\n */\nEventBus.prototype.once = function(event, priority, callback, that) {\n var self = this;\n\n if (isFunction(priority)) {\n that = callback;\n callback = priority;\n priority = DEFAULT_PRIORITY;\n }\n\n if (!isNumber(priority)) {\n throw new Error('priority must be a number');\n }\n\n function wrappedCallback() {\n self.off(event, wrappedCallback);\n return callback.apply(that, arguments);\n }\n\n // make sure we remember and are able to remove\n // bound callbacks via {@link #off} using the original\n // callback\n wrappedCallback[FN_REF] = callback;\n\n this.on(event, priority, wrappedCallback);\n};\n\n\n/**\n * Removes event listeners by event and callback.\n *\n * If no callback is given, all listeners for a given event name are being removed.\n *\n * @param {String} event\n * @param {Function} [callback]\n */\nEventBus.prototype.off = function(event, callback) {\n var listeners = this._getListeners(event),\n listener,\n listenerCallback,\n idx;\n\n if (callback) {\n\n // move through listeners from back to front\n // and remove matching listeners\n for (idx = listeners.length - 1; (listener = listeners[idx]); idx--) {\n listenerCallback = listener.callback;\n\n if (listenerCallback === callback || listenerCallback[FN_REF] === callback) {\n listeners.splice(idx, 1);\n }\n }\n } else {\n // clear listeners\n listeners.length = 0;\n }\n};\n\n\n/**\n * Fires a named event.\n *\n * @example\n *\n * // fire event by name\n * events.fire('foo');\n *\n * // fire event object with nested type\n * var event = { type: 'foo' };\n * events.fire(event);\n *\n * // fire event with explicit type\n * var event = { x: 10, y: 20 };\n * events.fire('element.moved', event);\n *\n * // pass additional arguments to the event\n * events.on('foo', function(event, bar) {\n * alert(bar);\n * });\n *\n * events.fire({ type: 'foo' }, 'I am bar!');\n *\n * @param {String} [name] the optional event name\n * @param {Object} [event] the event object\n * @param {...Object} additional arguments to be passed to the callback functions\n *\n * @return {Boolean} the events return value, if specified or false if the\n * default action was prevented by listeners\n */\nEventBus.prototype.fire = function(type, data) {\n\n var event,\n listeners,\n returnValue,\n args;\n\n args = slice.call(arguments);\n\n if (typeof type === 'object') {\n event = type;\n type = event.type;\n }\n\n if (!type) {\n throw new Error('no event type specified');\n }\n\n listeners = this._listeners[type];\n\n if (!listeners) {\n return;\n }\n\n // we make sure we fire instances of our home made\n // events here. We wrap them only once, though\n if (data instanceof Event) {\n // we are fine, we alread have an event\n event = data;\n } else {\n event = new Event();\n event.init(data);\n }\n\n // ensure we pass the event as the first parameter\n args[0] = event;\n\n // original event type (in case we delegate)\n var originalType = event.type;\n\n // update event type before delegation\n if (type !== originalType) {\n event.type = type;\n }\n\n try {\n returnValue = this._invokeListeners(event, args, listeners);\n } finally {\n // reset event type after delegation\n if (type !== originalType) {\n event.type = originalType;\n }\n }\n\n // set the return value to false if the event default\n // got prevented and no other return value exists\n if (returnValue === undefined && event.defaultPrevented) {\n returnValue = false;\n }\n\n return returnValue;\n};\n\n\nEventBus.prototype.handleError = function(error) {\n return this.fire('error', { error: error }) === false;\n};\n\n\nEventBus.prototype._destroy = function() {\n this._listeners = {};\n};\n\nEventBus.prototype._invokeListeners = function(event, args, listeners) {\n\n var idx,\n listener,\n returnValue;\n\n for (idx = 0; (listener = listeners[idx]); idx++) {\n\n // handle stopped propagation\n if (event.cancelBubble) {\n break;\n }\n\n returnValue = this._invokeListener(event, args, listener);\n }\n\n return returnValue;\n};\n\nEventBus.prototype._invokeListener = function(event, args, listener) {\n\n var returnValue;\n\n try {\n // returning false prevents the default action\n returnValue = invokeFunction(listener.callback, args);\n\n // stop propagation on return value\n if (returnValue !== undefined) {\n event.returnValue = returnValue;\n event.stopPropagation();\n }\n\n // prevent default on return false\n if (returnValue === false) {\n event.preventDefault();\n }\n } catch (e) {\n if (!this.handleError(e)) {\n console.error('unhandled error in event listener');\n console.error(e.stack);\n\n throw e;\n }\n }\n\n return returnValue;\n};\n\n/*\n * Add new listener with a certain priority to the list\n * of listeners (for the given event).\n *\n * The semantics of listener registration / listener execution are\n * first register, first serve: New listeners will always be inserted\n * after existing listeners with the same priority.\n *\n * Example: Inserting two listeners with priority 1000 and 1300\n *\n * * before: [ 1500, 1500, 1000, 1000 ]\n * * after: [ 1500, 1500, (new=1300), 1000, 1000, (new=1000) ]\n *\n * @param {String} event\n * @param {Object} listener { priority, callback }\n */\nEventBus.prototype._addListener = function(event, newListener) {\n\n var listeners = this._getListeners(event),\n existingListener,\n idx;\n\n // ensure we order listeners by priority from\n // 0 (high) to n > 0 (low)\n for (idx = 0; (existingListener = listeners[idx]); idx++) {\n if (existingListener.priority < newListener.priority) {\n\n // prepend newListener at before existingListener\n listeners.splice(idx, 0, newListener);\n return;\n }\n }\n\n listeners.push(newListener);\n};\n\n\nEventBus.prototype._getListeners = function(name) {\n var listeners = this._listeners[name];\n\n if (!listeners) {\n this._listeners[name] = listeners = [];\n }\n\n return listeners;\n};\n\n\n/**\n * A event that is emitted via the event bus.\n */\nfunction Event() { }\n\nmodule.exports.Event = Event;\n\nEvent.prototype.stopPropagation = function() {\n this.cancelBubble = true;\n};\n\nEvent.prototype.preventDefault = function() {\n this.defaultPrevented = true;\n};\n\nEvent.prototype.init = function(data) {\n assign(this, data || {});\n};\n\n\n/**\n * Invoke function. Be fast...\n *\n * @param {Function} fn\n * @param {Array} args\n *\n * @return {Any}\n */\nfunction invokeFunction(fn, args) {\n return fn.apply(null, args);\n}\n","'use strict';\n\nvar forEach = require(303),\n reduce = require(306);\n\nvar GraphicsUtil = require(269);\n\nvar translate = require(279).translate;\n\nvar domClear = require(446);\n\nvar svgAppend = require(472),\n svgAttr = require(474),\n svgClasses = require(475),\n svgCreate = require(478),\n svgRemove = require(481);\n\n\n/**\n * A factory that creates graphical elements\n *\n * @param {EventBus} eventBus\n * @param {ElementRegistry} elementRegistry\n */\nfunction GraphicsFactory(eventBus, elementRegistry) {\n this._eventBus = eventBus;\n this._elementRegistry = elementRegistry;\n}\n\nGraphicsFactory.$inject = [ 'eventBus' , 'elementRegistry' ];\n\nmodule.exports = GraphicsFactory;\n\n\nGraphicsFactory.prototype._getChildren = function(element) {\n\n var gfx = this._elementRegistry.getGraphics(element);\n\n var childrenGfx;\n\n // root element\n if (!element.parent) {\n childrenGfx = gfx;\n } else {\n childrenGfx = GraphicsUtil.getChildren(gfx);\n if (!childrenGfx) {\n childrenGfx = svgCreate('g');\n svgClasses(childrenGfx).add('djs-children');\n\n svgAppend(gfx.parentNode, childrenGfx);\n }\n }\n\n return childrenGfx;\n};\n\n/**\n * Clears the graphical representation of the element and returns the\n * cleared visual (the element).\n */\nGraphicsFactory.prototype._clear = function(gfx) {\n var visual = GraphicsUtil.getVisual(gfx);\n\n domClear(visual);\n\n return visual;\n};\n\n/**\n * Creates a gfx container for shapes and connections\n *\n * The layout is as follows:\n *\n * \n *\n * \n * \n * \n * \n * \n *\n * \n * \n * \n *\n * @param {Object} parent\n * @param {String} type the type of the element, i.e. shape | connection\n */\nGraphicsFactory.prototype._createContainer = function(type, parentGfx) {\n var outerGfx = svgCreate('g');\n svgClasses(outerGfx).add('djs-group');\n\n svgAppend(parentGfx, outerGfx);\n\n var gfx = svgCreate('g');\n svgClasses(gfx).add('djs-element');\n svgClasses(gfx).add('djs-' + type);\n\n svgAppend(outerGfx, gfx);\n\n // create visual\n var visual = svgCreate('g');\n svgClasses(visual).add('djs-visual');\n\n svgAppend(gfx, visual);\n\n return gfx;\n};\n\nGraphicsFactory.prototype.create = function(type, element) {\n var childrenGfx = this._getChildren(element.parent);\n return this._createContainer(type, childrenGfx);\n};\n\nGraphicsFactory.prototype.updateContainments = function(elements) {\n\n var self = this,\n elementRegistry = this._elementRegistry,\n parents;\n\n parents = reduce(elements, function(map, e) {\n\n if (e.parent) {\n map[e.parent.id] = e.parent;\n }\n\n return map;\n }, {});\n\n // update all parents of changed and reorganized their children\n // in the correct order (as indicated in our model)\n forEach(parents, function(parent) {\n\n var childGfx = self._getChildren(parent),\n children = parent.children;\n\n if (!children) {\n return;\n }\n\n forEach(children.slice().reverse(), function(c) {\n var gfx = elementRegistry.getGraphics(c);\n\n prependTo(gfx.parentNode, childGfx);\n });\n });\n};\n\nGraphicsFactory.prototype.drawShape = function(visual, element) {\n var eventBus = this._eventBus;\n\n return eventBus.fire('render.shape', { gfx: visual, element: element });\n};\n\nGraphicsFactory.prototype.getShapePath = function(element) {\n var eventBus = this._eventBus;\n\n return eventBus.fire('render.getShapePath', element);\n};\n\nGraphicsFactory.prototype.drawConnection = function(visual, element) {\n var eventBus = this._eventBus;\n\n return eventBus.fire('render.connection', { gfx: visual, element: element });\n};\n\nGraphicsFactory.prototype.getConnectionPath = function(waypoints) {\n var eventBus = this._eventBus;\n\n return eventBus.fire('render.getConnectionPath', waypoints);\n};\n\nGraphicsFactory.prototype.update = function(type, element, gfx) {\n // Do not update root element\n if (!element.parent) {\n return;\n }\n\n var visual = this._clear(gfx);\n\n // redraw\n if (type === 'shape') {\n this.drawShape(visual, element);\n\n // update positioning\n translate(gfx, element.x, element.y);\n } else\n if (type === 'connection') {\n this.drawConnection(visual, element);\n } else {\n throw new Error('unknown type: ' + type);\n }\n\n if (element.hidden) {\n svgAttr(gfx, 'display', 'none');\n } else {\n svgAttr(gfx, 'display', 'block');\n }\n};\n\nGraphicsFactory.prototype.remove = function(element) {\n var gfx = this._elementRegistry.getGraphics(element);\n\n // remove\n svgRemove(gfx.parentNode);\n};\n\n////////// helpers ///////////\n\nfunction prependTo(newNode, parentNode) {\n parentNode.insertBefore(newNode, parentNode.firstChild);\n}\n","module.exports = {\n __depends__: [ require(131) ],\n __init__: [ 'canvas' ],\n canvas: [ 'type', require(122) ],\n elementRegistry: [ 'type', require(124) ],\n elementFactory: [ 'type', require(123) ],\n eventBus: [ 'type', require(125) ],\n graphicsFactory: [ 'type', require(126) ]\n};","'use strict';\n\nvar DEFAULT_RENDER_PRIORITY = 1000;\n\n/**\n * The base implementation of shape and connection renderers.\n *\n * @param {EventBus} eventBus\n * @param {Number} [renderPriority=1000]\n */\nfunction BaseRenderer(eventBus, renderPriority) {\n var self = this;\n\n renderPriority = renderPriority || DEFAULT_RENDER_PRIORITY;\n\n eventBus.on([ 'render.shape', 'render.connection' ], renderPriority, function(evt, context) {\n var type = evt.type,\n element = context.element,\n visuals = context.gfx;\n\n if (self.canRender(element)) {\n if (type === 'render.shape') {\n return self.drawShape(visuals, element);\n } else {\n return self.drawConnection(visuals, element);\n }\n }\n });\n\n eventBus.on([ 'render.getShapePath', 'render.getConnectionPath'], renderPriority, function(evt, element) {\n if (self.canRender(element)) {\n if (evt.type === 'render.getShapePath') {\n return self.getShapePath(element);\n } else {\n return self.getConnectionPath(element);\n }\n }\n });\n}\n\n/**\n * Should check whether *this* renderer can render\n * the element/connection.\n *\n * @param {element} element\n *\n * @returns {Boolean}\n */\nBaseRenderer.prototype.canRender = function() {};\n\n/**\n * Provides the shape's snap svg element to be drawn on the `canvas`.\n *\n * @param {djs.Graphics} visuals\n * @param {Shape} shape\n *\n * @returns {Snap.svg} [returns a Snap.svg paper element ]\n */\nBaseRenderer.prototype.drawShape = function() {};\n\n/**\n * Provides the shape's snap svg element to be drawn on the `canvas`.\n *\n * @param {djs.Graphics} visuals\n * @param {Connection} connection\n *\n * @returns {Snap.svg} [returns a Snap.svg paper element ]\n */\nBaseRenderer.prototype.drawConnection = function() {};\n\n/**\n * Gets the SVG path of a shape that represents it's visual bounds.\n *\n * @param {Shape} shape\n *\n * @return {string} svg path\n */\nBaseRenderer.prototype.getShapePath = function() {};\n\n/**\n * Gets the SVG path of a connection that represents it's visual bounds.\n *\n * @param {Connection} connection\n *\n * @return {string} svg path\n */\nBaseRenderer.prototype.getConnectionPath = function() {};\n\nmodule.exports = BaseRenderer;\n","'use strict';\n\nvar inherits = require(289);\n\nvar BaseRenderer = require(128);\n\nvar renderUtil = require(278);\n\nvar componentsToPath = renderUtil.componentsToPath,\n createLine = renderUtil.createLine;\n\nvar svgAppend = require(472),\n svgAttr = require(474),\n svgCreate = require(478);\n\n// apply default renderer with lowest possible priority\n// so that it only kicks in if noone else could render\nvar DEFAULT_RENDER_PRIORITY = 1;\n\n/**\n * The default renderer used for shapes and connections.\n *\n * @param {EventBus} eventBus\n * @param {Styles} styles\n */\nfunction DefaultRenderer(eventBus, styles) {\n //\n BaseRenderer.call(this, eventBus, DEFAULT_RENDER_PRIORITY);\n\n this.CONNECTION_STYLE = styles.style([ 'no-fill' ], { strokeWidth: 5, stroke: 'fuchsia' });\n this.SHAPE_STYLE = styles.style({ fill: 'white', stroke: 'fuchsia', strokeWidth: 2 });\n}\n\ninherits(DefaultRenderer, BaseRenderer);\n\n\nDefaultRenderer.prototype.canRender = function() {\n return true;\n};\n\nDefaultRenderer.prototype.drawShape = function drawShape(visuals, element) {\n\n var rect = svgCreate('rect');\n svgAttr(rect, {\n x: 0,\n y: 0,\n width: element.width || 0,\n height: element.height || 0\n });\n svgAttr(rect, this.SHAPE_STYLE);\n\n svgAppend(visuals, rect);\n\n return rect;\n};\n\nDefaultRenderer.prototype.drawConnection = function drawConnection(visuals, connection) {\n\n var line = createLine(connection.waypoints, this.CONNECTION_STYLE);\n svgAppend(visuals, line);\n\n return line;\n};\n\nDefaultRenderer.prototype.getShapePath = function getShapePath(shape) {\n\n var x = shape.x,\n y = shape.y,\n width = shape.width,\n height = shape.height;\n\n var shapePath = [\n ['M', x, y],\n ['l', width, 0],\n ['l', 0, height],\n ['l', -width, 0],\n ['z']\n ];\n\n return componentsToPath(shapePath);\n};\n\nDefaultRenderer.prototype.getConnectionPath = function getConnectionPath(connection) {\n var waypoints = connection.waypoints;\n\n var idx, point, connectionPath = [];\n\n for (idx = 0; (point = waypoints[idx]); idx++) {\n\n // take invisible docking into account\n // when creating the path\n point = point.original || point;\n\n connectionPath.push([ idx === 0 ? 'M' : 'L', point.x, point.y ]);\n }\n\n return componentsToPath(connectionPath);\n};\n\n\nDefaultRenderer.$inject = [ 'eventBus', 'styles' ];\n\nmodule.exports = DefaultRenderer;\n","'use strict';\n\nvar isArray = require(422),\n assign = require(431),\n reduce = require(306);\n\n\n/**\n * A component that manages shape styles\n */\nfunction Styles() {\n\n var defaultTraits = {\n\n 'no-fill': {\n fill: 'none'\n },\n 'no-border': {\n strokeOpacity: 0.0\n },\n 'no-events': {\n pointerEvents: 'none'\n }\n };\n\n var self = this;\n\n /**\n * Builds a style definition from a className, a list of traits and an object of additional attributes.\n *\n * @param {String} className\n * @param {Array} traits\n * @param {Object} additionalAttrs\n *\n * @return {Object} the style defintion\n */\n this.cls = function(className, traits, additionalAttrs) {\n var attrs = this.style(traits, additionalAttrs);\n\n return assign(attrs, { 'class': className });\n };\n\n /**\n * Builds a style definition from a list of traits and an object of additional attributes.\n *\n * @param {Array} traits\n * @param {Object} additionalAttrs\n *\n * @return {Object} the style defintion\n */\n this.style = function(traits, additionalAttrs) {\n\n if (!isArray(traits) && !additionalAttrs) {\n additionalAttrs = traits;\n traits = [];\n }\n\n var attrs = reduce(traits, function(attrs, t) {\n return assign(attrs, defaultTraits[t] || {});\n }, {});\n\n return additionalAttrs ? assign(attrs, additionalAttrs) : attrs;\n };\n\n this.computeStyle = function(custom, traits, defaultStyles) {\n if (!isArray(traits)) {\n defaultStyles = traits;\n traits = [];\n }\n\n return self.style(traits || [], assign({}, defaultStyles, custom || {}));\n };\n}\n\nmodule.exports = Styles;\n","module.exports = {\n __init__: [ 'defaultRenderer' ],\n defaultRenderer: [ 'type', require(129) ],\n styles: [ 'type', require(130) ]\n};\n","'use strict';\n\nvar filter = require(301),\n forEach = require(303),\n sortBy = require(310);\n\nfunction last(arr) {\n return arr && arr[arr.length - 1];\n}\n\nfunction sortTopOrMiddle(element) {\n return element.y;\n}\n\nfunction sortLeftOrCenter(element) {\n return element.x;\n}\n\n/**\n * Sorting functions for different types of alignment\n *\n * @type {Object}\n *\n * @return {Function}\n */\nvar ALIGNMENT_SORTING = {\n left: sortLeftOrCenter,\n center: sortLeftOrCenter,\n right: function(element) {\n return element.x + element.width;\n },\n top: sortTopOrMiddle,\n middle: sortTopOrMiddle,\n bottom: function(element) {\n return element.y + element.height;\n }\n};\n\n\nfunction AlignElements(modeling) {\n this._modeling = modeling;\n}\n\nmodule.exports = AlignElements;\n\nAlignElements.$inject = [ 'modeling' ];\n\n\n/**\n * Get the relevant \"axis\" and \"dimension\" related to the current type of alignment\n *\n * @param {String} type left|right|center|top|bottom|middle\n *\n * @return {Object} { axis, dimension }\n */\nAlignElements.prototype._getOrientationDetails = function(type) {\n var vertical = [ 'top', 'bottom', 'middle' ],\n axis = 'x',\n dimension = 'width';\n\n if (vertical.indexOf(type) !== -1) {\n axis = 'y';\n dimension = 'height';\n }\n\n return {\n axis: axis,\n dimension: dimension\n };\n};\n\nAlignElements.prototype._isType = function(type, types) {\n return types.indexOf(type) !== -1;\n};\n\n/**\n * Get a point on the relevant axis where elements should align to\n *\n * @param {String} type left|right|center|top|bottom|middle\n * @param {Array} sortedElements\n *\n * @return {Object}\n */\nAlignElements.prototype._alignmentPosition = function(type, sortedElements) {\n var orientation = this._getOrientationDetails(type),\n axis = orientation.axis,\n dimension = orientation.dimension,\n alignment = {},\n centers = {},\n hasSharedCenters = false,\n centeredElements,\n firstElement,\n lastElement;\n\n function getMiddleOrTop(first, last) {\n return Math.round((first[axis] + last[axis] + last[dimension]) / 2);\n }\n\n if (this._isType(type, [ 'left', 'top' ])) {\n alignment[type] = sortedElements[0][axis];\n\n } else if (this._isType(type, [ 'right', 'bottom' ])) {\n lastElement = last(sortedElements);\n\n alignment[type] = lastElement[axis] + lastElement[dimension];\n\n } else if (this._isType(type, [ 'center', 'middle' ])) {\n\n // check if there is a center shared by more than one shape\n // if not, just take the middle of the range\n forEach(sortedElements, function(element) {\n var center = element[axis] + Math.round(element[dimension] / 2);\n\n if (centers[center]) {\n centers[center].elements.push(element);\n } else {\n centers[center] = {\n elements: [ element ],\n center: center\n };\n }\n });\n\n centeredElements = sortBy(centers, function(center) {\n if (center.elements.length > 1) {\n hasSharedCenters = true;\n }\n\n return center.elements.length;\n });\n\n if (hasSharedCenters) {\n alignment[type] = last(centeredElements).center;\n\n return alignment;\n }\n\n firstElement = sortedElements[0];\n\n sortedElements = sortBy(sortedElements, function(element) {\n return element[axis] + element[dimension];\n });\n\n lastElement = last(sortedElements);\n\n alignment[type] = getMiddleOrTop(firstElement, lastElement);\n }\n\n return alignment;\n};\n\n/**\n * Executes the alignment of a selection of elements\n *\n * @param {Array} elements [description]\n * @param {String} type left|right|center|top|bottom|middle\n */\nAlignElements.prototype.trigger = function(elements, type) {\n var modeling = this._modeling;\n\n var filteredElements = filter(elements, function(element) {\n return !(element.waypoints || element.host || element.labelTarget);\n });\n\n var sortFn = ALIGNMENT_SORTING[type];\n\n var sortedElements = sortBy(filteredElements, sortFn);\n\n var alignment = this._alignmentPosition(type, sortedElements);\n\n modeling.alignElements(sortedElements, alignment);\n};\n","'use strict';\n\nmodule.exports = {\n __init__: [ 'alignElements' ],\n alignElements: [ 'type', require(132) ]\n};\n","'use strict';\n\nvar forEach = require(303),\n flatten = require(291),\n union = require(294),\n filter = require(301),\n groupBy = require(304),\n map = require(305);\n\nvar saveClear = require(277).saveClear,\n Collections = require(263);\n\nvar getNewAttachShapeDelta = require(261).getNewAttachShapeDelta;\n\nvar inherits = require(289);\n\nvar HIGH_PRIORITY = 1500;\n\nvar CommandInterceptor = require(119);\n\n\nfunction AttachSupport(eventBus, modeling, movePreview, rules) {\n\n CommandInterceptor.call(this, eventBus);\n\n\n // remove all the attached elements from the shapes to be validated\n // add all the attached shapes to the overall list of moved shapes\n eventBus.on('shape.move.start', HIGH_PRIORITY, function(e) {\n\n var context = e.context,\n shapes = context.shapes,\n validatedShapes = context.validatedShapes;\n\n context.shapes = addAttached(shapes);\n\n context.validatedShapes = removeAttached(validatedShapes);\n });\n\n\n // move all attachments after the other shapes are done moving\n this.postExecuted([ 'elements.move' ], function(event) {\n\n var context = event.context,\n delta = context.delta,\n newParent = context.newParent,\n closure = context.closure,\n enclosedElements = closure.enclosedElements,\n attachers = getAttachers(enclosedElements);\n\n // ensure we move all attachers with their hosts\n // if they have not been moved already\n forEach(attachers, function(attacher) {\n if (!enclosedElements[attacher.id]) {\n modeling.moveShape(attacher, delta, newParent);\n\n if (attacher.label) {\n modeling.moveShape(attacher.label, delta, newParent);\n }\n }\n });\n });\n\n // perform the attaching after shapes are done moving\n this.postExecuted([ 'elements.move' ], function(e) {\n\n var context = e.context,\n shapes = context.shapes,\n newHost = context.newHost,\n attachers;\n\n // we only support attachment / detachment of one element\n if (shapes.length > 1) {\n return;\n }\n\n if (newHost) {\n\n attachers = shapes;\n } else {\n\n attachers = filter(shapes, function(s) {\n return !!s.host;\n });\n }\n\n forEach(attachers, function(attacher) {\n modeling.updateAttachment(attacher, newHost);\n });\n });\n\n // ensure invalid attachment connections are removed\n this.postExecuted([ 'elements.move' ], function(e) {\n\n var shapes = e.context.shapes;\n\n forEach(shapes, function(shape) {\n\n forEach(shape.attachers, function(attacher) {\n\n // remove invalid outgoing connections\n forEach(attacher.outgoing.slice(), function(connection) {\n var allowed = rules.allowed('connection.reconnectStart', {\n connection: connection,\n source: connection.source,\n target: connection.target\n });\n\n if (!allowed) {\n modeling.removeConnection(connection);\n }\n });\n\n // remove invalid incoming connections\n forEach(attacher.incoming.slice(), function(connection) {\n var allowed = rules.allowed('connection.reconnectEnd', {\n connection: connection,\n source: connection.source,\n target: connection.target\n });\n\n if (!allowed) {\n modeling.removeConnection(connection);\n }\n });\n });\n });\n });\n\n this.postExecute([ 'shape.create' ], function(e) {\n var context = e.context,\n shape = context.shape,\n host = context.host;\n\n if (host) {\n modeling.updateAttachment(shape, host);\n }\n });\n\n // update attachments if the host is replaced\n this.postExecute([ 'shape.replace' ], function(e) {\n\n var context = e.context,\n oldShape = context.oldShape,\n newShape = context.newShape;\n\n // move the attachers to the new host\n saveClear(oldShape.attachers, function(attacher) {\n var allowed = rules.allowed('elements.move', {\n target: newShape,\n shapes: [attacher]\n });\n\n if (allowed === 'attach') {\n modeling.updateAttachment(attacher, newShape);\n } else {\n modeling.removeShape(attacher);\n }\n });\n\n // move attachers if new host has different size\n if (newShape.attachers.length) {\n\n forEach(newShape.attachers, function(attacher) {\n var delta = getNewAttachShapeDelta(attacher, oldShape, newShape);\n modeling.moveShape(attacher, delta, attacher.parent);\n });\n }\n\n });\n\n // move shape on host resize\n this.postExecute([ 'shape.resize' ], function(event) {\n var context = event.context,\n shape = context.shape,\n oldBounds = context.oldBounds,\n newBounds = context.newBounds,\n attachers = shape.attachers;\n\n if (!attachers.length) {\n return;\n }\n\n forEach(attachers, function(attacher) {\n var delta = getNewAttachShapeDelta(attacher, oldBounds, newBounds);\n\n modeling.moveShape(attacher, delta, attacher.parent);\n\n if (attacher.label) {\n modeling.moveShape(attacher.label, delta, attacher.label.parent);\n }\n });\n });\n\n // remove attachments\n this.preExecute([ 'shape.delete' ], function(event) {\n\n var shape = event.context.shape;\n\n saveClear(shape.attachers, function(attacher) {\n modeling.removeShape(attacher);\n });\n\n if (shape.host) {\n modeling.updateAttachment(shape, null);\n }\n });\n\n\n // Prevent attachers and their labels from moving, when the space tool is performed.\n // Otherwise the attachers and their labels would be moved twice.\n eventBus.on('spaceTool.move', function(event) {\n\n var movingShapes = event.context.movingShapes;\n\n // Collect all attachers which would be moved using the space tool\n var movingAttachers = filter(movingShapes, function(shape) {\n return shape.host && shape.host.id;\n });\n\n forEach(movingAttachers, function(shape) {\n // Remove all attachers and their labels from the movingShapes, because they\n // already will be moved along with the host.\n Collections.remove(movingShapes, shape);\n if (shape.label) {\n Collections.remove(movingShapes, shape.label);\n }\n });\n\n });\n}\n\ninherits(AttachSupport, CommandInterceptor);\n\nAttachSupport.$inject = [ 'eventBus', 'modeling', 'movePreview', 'rules' ];\n\nmodule.exports = AttachSupport;\n\n\n/**\n * Return attachers of the given shapes\n *\n * @param {Array} shapes\n * @return {Array}\n */\nfunction getAttachers(shapes) {\n return flatten(map(shapes, function(s) {\n return s.attachers || [];\n }));\n}\n\n/**\n * Return a combined list of elements and\n * attachers.\n *\n * @param {Array} elements\n * @return {Array} filtered\n */\nfunction addAttached(elements) {\n var attachers = getAttachers(elements);\n\n return union(elements, attachers);\n}\n\n/**\n * Return a filtered list of elements that do not\n * contain attached elements with hosts being part\n * of the selection.\n *\n * @param {Array} elements\n *\n * @return {Array} filtered\n */\nfunction removeAttached(elements) {\n\n var ids = groupBy(elements, 'id');\n\n return filter(elements, function(element) {\n while (element) {\n\n // host in selection\n if (element.host && ids[element.host.id]) {\n return false;\n }\n\n element = element.parent;\n }\n\n return true;\n });\n}\n","module.exports = {\n __depends__: [\n require(206),\n require(174)\n ],\n __init__: [ 'attachSupport'],\n attachSupport: [ 'type', require(134) ]\n};\n","'use strict';\n\nvar inherits = require(289);\n\nvar getBoundingBox = require(266).getBBox;\n\nvar asTRBL = require(252).asTRBL,\n asBounds = require(252).asBounds;\n\nvar assign = require(431),\n forEach = require(303),\n values = require(440),\n flatten = require(291),\n groupBy = require(304);\n\nvar CommandInterceptor = require(119);\n\n\n/**\n * An auto resize component that takes care of expanding a parent element\n * if child elements are created or moved close the parents edge.\n *\n * @param {EventBus} eventBus\n * @param {ElementRegistry} elementRegistry\n * @param {Modeling} modeling\n * @param {Rules} rules\n */\nfunction AutoResize(eventBus, elementRegistry, modeling, rules) {\n\n CommandInterceptor.call(this, eventBus);\n\n this._elementRegistry = elementRegistry;\n this._modeling = modeling;\n this._rules = rules;\n\n var self = this;\n\n this.postExecuted([ 'shape.create' ], function(event) {\n\n var context = event.context,\n hints = context.hints,\n shape = context.shape,\n parent = context.parent || context.newParent;\n\n if (hints && hints.root === false) {\n return;\n }\n\n self._expand([ shape ], parent);\n });\n\n this.postExecuted([ 'elements.move' ], function(event) {\n\n var context = event.context,\n elements = flatten(values(context.closure.topLevel)),\n hints = context.hints;\n\n if (hints && hints.autoResize === false) {\n return;\n }\n\n var expandings = groupBy(elements, function(element) {\n return element.parent.id;\n });\n\n forEach(expandings, function(elements, parentId) {\n self._expand(elements, parentId);\n });\n });\n}\n\nAutoResize.$inject = [ 'eventBus', 'elementRegistry', 'modeling', 'rules' ];\n\ninherits(AutoResize, CommandInterceptor);\n\nmodule.exports = AutoResize;\n\n\n/**\n * Calculate the new bounds of the target shape, given\n * a number of elements have been moved or added into the parent.\n *\n * This method considers the current size, the added elements as well as\n * the provided padding for the new bounds.\n *\n * @param {Array} elements\n * @param {djs.model.Shape} target\n */\nAutoResize.prototype._getOptimalBounds = function(elements, target) {\n\n var offset = this.getOffset(target),\n padding = this.getPadding(target);\n\n var elementsTrbl = asTRBL(getBoundingBox(elements)),\n targetTrbl = asTRBL(target);\n\n var newTrbl = {};\n\n if (elementsTrbl.top - targetTrbl.top < padding.top) {\n newTrbl.top = elementsTrbl.top - offset.top;\n }\n\n if (elementsTrbl.left - targetTrbl.left < padding.left) {\n newTrbl.left = elementsTrbl.left - offset.left;\n }\n\n if (targetTrbl.right - elementsTrbl.right < padding.right) {\n newTrbl.right = elementsTrbl.right + offset.right;\n }\n\n if (targetTrbl.bottom - elementsTrbl.bottom < padding.bottom) {\n newTrbl.bottom = elementsTrbl.bottom + offset.bottom;\n }\n\n return asBounds(assign({}, targetTrbl, newTrbl));\n};\n\n\n/**\n * Expand the target shape respecting rules, offset and padding\n *\n * @param {Array} elements\n * @param {djs.model.Shape|String} target|targetId\n */\nAutoResize.prototype._expand = function(elements, target) {\n\n if (typeof target === 'string') {\n target = this._elementRegistry.get(target);\n }\n\n var allowed = this._rules.allowed('element.autoResize', {\n elements: elements,\n target: target\n });\n\n if (!allowed) {\n return;\n }\n\n // calculate the new bounds\n var newBounds = this._getOptimalBounds(elements, target);\n\n if (!boundsChanged(newBounds, target)) {\n return;\n }\n\n // resize the parent shape\n this.resize(target, newBounds);\n\n var parent = target.parent;\n\n // recursively expand parent elements\n if (parent) {\n this._expand([ target ], parent);\n }\n};\n\n\n/**\n * Get the amount to expand the given shape in each direction.\n *\n * @param {djs.model.Shape} shape\n *\n * @return {Object} {top, bottom, left, right}\n */\nAutoResize.prototype.getOffset = function(shape) {\n return { top: 60, bottom: 60, left: 100, right: 100 };\n};\n\n\n/**\n * Get the activation threshold for each side for which\n * resize triggers.\n *\n * @param {djs.model.Shape} shape\n *\n * @return {Object} {top, bottom, left, right}\n */\nAutoResize.prototype.getPadding = function(shape) {\n return { top: 2, bottom: 2, left: 15, right: 15 };\n};\n\n\n/**\n * Perform the actual resize operation.\n *\n * @param {djs.model.Shape} target\n * @param {Object} newBounds\n */\nAutoResize.prototype.resize = function(target, newBounds) {\n this._modeling.resizeShape(target, newBounds);\n};\n\n\nfunction boundsChanged(newBounds, oldBounds) {\n return (\n newBounds.x !== oldBounds.x ||\n newBounds.y !== oldBounds.y ||\n newBounds.width !== oldBounds.width ||\n newBounds.height !== oldBounds.height\n );\n}","var RuleProvider = require(225);\n\nvar inherits = require(289);\n\n/**\n * This is a base rule provider for the element.autoResize rule.\n */\nfunction AutoResizeProvider(eventBus) {\n\n RuleProvider.call(this, eventBus);\n\n var self = this;\n\n this.addRule('element.autoResize', function(context) {\n return self.canResize(context.elements, context.target);\n });\n}\n\nAutoResizeProvider.$inject = [ 'eventBus' ];\n\ninherits(AutoResizeProvider, RuleProvider);\n\nmodule.exports = AutoResizeProvider;\n\n/**\n * Needs to be implemented by sub classes to allow actual auto resize\n *\n * @param {Array} elements\n * @param {djs.model.Shape} target\n *\n * @return {Boolean}\n */\nAutoResizeProvider.prototype.canResize = function(elements, target) {\n return false;\n};","'use strict';\n\nvar assign = require(431);\n\nvar EventUtil = require(267);\n\n\n/**\n * Initiates canvas scrolling if current cursor point is close to a border.\n * Cancelled when current point moves back inside the scrolling borders\n * or cancelled manually.\n *\n * Default options :\n * scrollThresholdIn: [ 20, 20, 20, 20 ],\n * scrollThresholdOut: [ 0, 0, 0, 0 ],\n * scrollRepeatTimeout: 15,\n * scrollStep: 10\n *\n * Threshold order:\n * [ left, top, right, bottom ]\n */\nfunction AutoScroll(config, eventBus, canvas, mouseTracking) {\n\n this._canvas = canvas;\n this._mouseTracking = mouseTracking;\n\n this._opts = assign({\n scrollThresholdIn: [ 20, 20, 20, 20 ],\n scrollThresholdOut: [ 0, 0, 0, 0 ],\n scrollRepeatTimeout: 15,\n scrollStep: 10\n }, config);\n\n var self = this;\n\n eventBus.on('drag.move', function(e) {\n var point = self._toBorderPoint(e);\n\n self.startScroll(point);\n });\n\n eventBus.on([ 'drag.cleanup' ], function() {\n self.stopScroll();\n });\n}\n\nAutoScroll.$inject = [ 'config.autoScroll', 'eventBus', 'canvas', 'mouseTracking'];\n\nmodule.exports = AutoScroll;\n\n\n/**\n * Starts scrolling loop.\n * Point is given in global scale in canvas container box plane.\n *\n * @param {Object} point { x: X, y: Y }\n */\nAutoScroll.prototype.startScroll = function(point) {\n\n var canvas = this._canvas;\n var opts = this._opts;\n var self = this;\n\n var clientRect = canvas.getContainer().getBoundingClientRect();\n\n var diff = [\n point.x,\n point.y,\n clientRect.width - point.x,\n clientRect.height - point.y\n ];\n\n this.stopScroll();\n\n var dx = 0,\n dy = 0;\n\n for (var i = 0; i < 4; i++) {\n if (between(diff[i], opts.scrollThresholdOut[i], opts.scrollThresholdIn[i])) {\n if (i === 0) {\n dx = opts.scrollStep;\n } else if (i == 1) {\n dy = opts.scrollStep;\n } else if (i == 2) {\n dx = -opts.scrollStep;\n } else if (i == 3) {\n dy = -opts.scrollStep;\n }\n }\n }\n\n if (dx !== 0 || dy !== 0) {\n canvas.scroll({ dx: dx, dy: dy });\n\n this._scrolling = setTimeout(function() {\n self.startScroll(point);\n }, opts.scrollRepeatTimeout);\n }\n};\n\nfunction between(val, start, end) {\n if (start < val && val < end) {\n return true;\n }\n\n return false;\n}\n\n\n/**\n * Stops scrolling loop.\n */\nAutoScroll.prototype.stopScroll = function() {\n clearTimeout(this._scrolling);\n};\n\n\n/**\n * Overrides defaults options.\n *\n * @param {Object} options\n */\nAutoScroll.prototype.setOptions = function(options) {\n this._opts = assign({}, this._opts, options);\n};\n\n\n/**\n * Converts event to a point in canvas container plane in global scale.\n *\n * @param {Event} event\n * @return {Point}\n */\nAutoScroll.prototype._toBorderPoint = function(event) {\n var clientRect = this._canvas._container.getBoundingClientRect();\n\n var globalPosition = EventUtil.toPoint(event.originalEvent);\n\n return {\n x: globalPosition.x - clientRect.left,\n y: globalPosition.y - clientRect.top\n };\n};","module.exports = {\n __depends__: [\n require(162),\n require(203)\n ],\n __init__: [ 'autoScroll' ],\n autoScroll: [ 'type', require(138) ]\n};","'use strict';\n\nvar Geometry = require(268),\n BendpointUtil = require(142);\n\nvar MARKER_OK = 'connect-ok',\n MARKER_NOT_OK = 'connect-not-ok',\n MARKER_CONNECT_HOVER = 'connect-hover',\n MARKER_CONNECT_UPDATING = 'djs-updating';\n\nvar COMMAND_BENDPOINT_UPDATE = 'connection.updateWaypoints',\n COMMAND_RECONNECT_START = 'connection.reconnectStart',\n COMMAND_RECONNECT_END = 'connection.reconnectEnd';\n\nvar round = Math.round;\n\nvar svgClasses = require(475),\n svgRemove = require(481);\n\nvar translate = require(279).translate;\n\n\n/**\n * A component that implements moving of bendpoints\n */\nfunction BendpointMove(injector, eventBus, canvas, dragging, graphicsFactory, rules, modeling) {\n\n // optional connection docking integration\n var connectionDocking = injector.get('connectionDocking', false);\n\n\n // API\n\n this.start = function(event, connection, bendpointIndex, insert) {\n\n var type,\n context,\n waypoints = connection.waypoints,\n gfx = canvas.getGraphics(connection);\n\n if (!insert && bendpointIndex === 0) {\n type = COMMAND_RECONNECT_START;\n } else\n if (!insert && bendpointIndex === waypoints.length - 1) {\n type = COMMAND_RECONNECT_END;\n } else {\n type = COMMAND_BENDPOINT_UPDATE;\n }\n\n context = {\n connection: connection,\n bendpointIndex: bendpointIndex,\n insert: insert,\n type: type\n };\n\n dragging.init(event, 'bendpoint.move', {\n data: {\n connection: connection,\n connectionGfx: gfx,\n context: context\n }\n });\n };\n\n\n // DRAGGING IMPLEMENTATION\n\n\n function redrawConnection(data) {\n graphicsFactory.update('connection', data.connection, data.connectionGfx);\n }\n\n function filterRedundantWaypoints(waypoints) {\n\n // alter copy of waypoints, not original\n waypoints = waypoints.slice();\n\n var idx = 0,\n point,\n previousPoint,\n nextPoint;\n\n while (waypoints[idx]) {\n point = waypoints[idx];\n previousPoint = waypoints[idx - 1];\n nextPoint = waypoints[idx + 1];\n\n if (Geometry.pointDistance(point, nextPoint) === 0 ||\n Geometry.pointsOnLine(previousPoint, nextPoint, point)) {\n\n // remove point, if overlapping with {nextPoint}\n // or on line with {previousPoint} -> {point} -> {nextPoint}\n waypoints.splice(idx, 1);\n } else {\n idx++;\n }\n }\n\n return waypoints;\n }\n\n eventBus.on('bendpoint.move.start', function(e) {\n\n var context = e.context,\n connection = context.connection,\n originalWaypoints = connection.waypoints,\n waypoints = originalWaypoints.slice(),\n insert = context.insert,\n idx = context.bendpointIndex;\n\n context.originalWaypoints = originalWaypoints;\n\n if (insert) {\n // insert placeholder for bendpoint to-be-added\n waypoints.splice(idx, 0, null);\n }\n\n connection.waypoints = waypoints;\n\n // add dragger gfx\n context.draggerGfx = BendpointUtil.addBendpoint(canvas.getLayer('overlays'));\n svgClasses(context.draggerGfx).add('djs-dragging');\n\n canvas.addMarker(connection, MARKER_CONNECT_UPDATING);\n });\n\n eventBus.on('bendpoint.move.hover', function(e) {\n var context = e.context;\n \n context.hover = e.hover;\n\n if (e.hover) {\n canvas.addMarker(e.hover, MARKER_CONNECT_HOVER);\n\n // asks whether reconnect / bendpoint move / bendpoint add\n // is allowed at the given position\n var allowed = context.allowed = rules.allowed(context.type, context);\n\n if (allowed) {\n canvas.removeMarker(context.hover, MARKER_NOT_OK);\n canvas.addMarker(context.hover, MARKER_OK);\n\n context.target = context.hover;\n } else if (allowed === false) {\n canvas.removeMarker(context.hover, MARKER_OK);\n canvas.addMarker(context.hover, MARKER_NOT_OK);\n\n context.target = null;\n }\n }\n });\n\n eventBus.on([\n 'bendpoint.move.out',\n 'bendpoint.move.cleanup'\n ], function(e) {\n\n // remove connect marker\n // if it was added\n var hover = e.context.hover;\n\n if (hover) {\n canvas.removeMarker(hover, MARKER_CONNECT_HOVER);\n canvas.removeMarker(hover, e.context.target ? MARKER_OK : MARKER_NOT_OK);\n }\n });\n\n eventBus.on('bendpoint.move.move', function(e) {\n\n var context = e.context,\n moveType = context.type,\n connection = e.connection,\n source, target;\n\n connection.waypoints[context.bendpointIndex] = { x: e.x, y: e.y };\n\n if (connectionDocking) {\n\n if (context.hover) {\n if (moveType === COMMAND_RECONNECT_START) {\n source = context.hover;\n }\n\n if (moveType === COMMAND_RECONNECT_END) {\n target = context.hover;\n }\n }\n\n connection.waypoints = connectionDocking.getCroppedWaypoints(connection, source, target);\n }\n\n // add dragger gfx\n translate(context.draggerGfx, e.x, e.y);\n\n redrawConnection(e);\n });\n\n eventBus.on([\n 'bendpoint.move.end',\n 'bendpoint.move.cancel'\n ], function(e) {\n\n var context = e.context,\n hover = context.hover,\n connection = context.connection;\n\n // remove dragger gfx\n svgRemove(context.draggerGfx);\n context.newWaypoints = connection.waypoints.slice();\n connection.waypoints = context.originalWaypoints;\n canvas.removeMarker(connection, MARKER_CONNECT_UPDATING);\n\n if (hover) {\n canvas.removeMarker(hover, MARKER_OK);\n canvas.removeMarker(hover, MARKER_NOT_OK);\n }\n });\n\n eventBus.on('bendpoint.move.end', function(e) {\n\n var context = e.context,\n waypoints = context.newWaypoints,\n bendpointIndex = context.bendpointIndex,\n bendpoint = waypoints[bendpointIndex],\n allowed = context.allowed,\n hints;\n\n // ensure we have actual pixel values bendpoint\n // coordinates (important when zoom level was > 1 during move)\n bendpoint.x = round(bendpoint.x);\n bendpoint.y = round(bendpoint.y);\n\n if (allowed && context.type === COMMAND_RECONNECT_START) {\n modeling.reconnectStart(context.connection, context.target, bendpoint);\n } else\n if (allowed && context.type === COMMAND_RECONNECT_END) {\n modeling.reconnectEnd(context.connection, context.target, bendpoint);\n } else\n if (allowed !== false && context.type === COMMAND_BENDPOINT_UPDATE) {\n\n // pass hints on the actual moved bendpoint\n // this is useful for connection and label layouting\n hints = {\n bendpointMove: {\n insert: e.context.insert,\n bendpointIndex: bendpointIndex\n }\n };\n\n modeling.updateWaypoints(context.connection, filterRedundantWaypoints(waypoints), hints);\n } else {\n redrawConnection(e);\n\n return false;\n }\n });\n\n eventBus.on('bendpoint.move.cancel', function(e) {\n redrawConnection(e);\n });\n}\n\nBendpointMove.$inject = [ 'injector', 'eventBus', 'canvas', 'dragging', 'graphicsFactory', 'rules', 'modeling' ];\n\nmodule.exports = BendpointMove;\n","'use strict';\n\nvar assign = require(431),\n forEach = require(303),\n isArray = require(422);\n\nvar abs= Math.abs,\n round = Math.round;\n\nvar TOLERANCE = 10;\n\n\nfunction BendpointSnapping(eventBus) {\n\n function snapTo(values, value) {\n\n if (isArray(values)) {\n var i = values.length;\n\n while (i--) if (abs(values[i] - value) <= TOLERANCE) {\n return values[i];\n }\n } else {\n values = +values;\n var rem = value % values;\n\n if (rem < TOLERANCE) {\n return value - rem;\n }\n\n if (rem > values - TOLERANCE) {\n return value - rem + values;\n }\n }\n\n return value;\n }\n\n function mid(element) {\n if (element.width) {\n return {\n x: round(element.width / 2 + element.x),\n y: round(element.height / 2 + element.y)\n };\n }\n }\n\n ////////// connection segment snapping //////////////////////////////////////\n\n function getConnectionSegmentSnaps(context) {\n\n var snapPoints = context.snapPoints,\n connection = context.connection,\n waypoints = connection.waypoints,\n segmentStart = context.segmentStart,\n segmentStartIndex = context.segmentStartIndex,\n segmentEnd = context.segmentEnd,\n segmentEndIndex = context.segmentEndIndex,\n axis = context.axis;\n\n if (snapPoints) {\n return snapPoints;\n }\n\n var referenceWaypoints = [\n waypoints[segmentStartIndex - 1],\n segmentStart,\n segmentEnd,\n waypoints[segmentEndIndex + 1]\n ];\n\n if (segmentStartIndex < 2) {\n referenceWaypoints.unshift(mid(connection.source));\n }\n\n if (segmentEndIndex > waypoints.length - 3) {\n referenceWaypoints.unshift(mid(connection.target));\n }\n\n context.snapPoints = snapPoints = { horizontal: [] , vertical: [] };\n\n forEach(referenceWaypoints, function(p) {\n // we snap on existing bendpoints only,\n // not placeholders that are inserted during add\n if (p) {\n p = p.original || p;\n\n if (axis === 'y') {\n snapPoints.horizontal.push(p.y);\n }\n\n if (axis === 'x') {\n snapPoints.vertical.push(p.x);\n }\n }\n });\n\n return snapPoints;\n }\n\n eventBus.on('connectionSegment.move.move', 1500, function(event) {\n var context = event.context,\n snapPoints = getConnectionSegmentSnaps(context),\n x = event.x,\n y = event.y,\n sx, sy;\n\n if (!snapPoints) {\n return;\n }\n\n // snap\n sx = snapTo(snapPoints.vertical, x);\n sy = snapTo(snapPoints.horizontal, y);\n\n\n // correction x/y\n var cx = (x - sx),\n cy = (y - sy);\n\n // update delta\n assign(event, {\n dx: event.dx - cx,\n dy: event.dy - cy,\n x: sx,\n y: sy\n });\n });\n\n\n ///////// bendpoint snapping /////////////////////////////\n\n function getBendpointSnaps(context) {\n\n var snapPoints = context.snapPoints,\n waypoints = context.connection.waypoints,\n bendpointIndex = context.bendpointIndex;\n\n if (snapPoints) {\n return snapPoints;\n }\n\n var referenceWaypoints = [ waypoints[bendpointIndex - 1], waypoints[bendpointIndex + 1] ];\n\n context.snapPoints = snapPoints = { horizontal: [] , vertical: [] };\n\n forEach(referenceWaypoints, function(p) {\n // we snap on existing bendpoints only,\n // not placeholders that are inserted during add\n if (p) {\n p = p.original || p;\n\n snapPoints.horizontal.push(p.y);\n snapPoints.vertical.push(p.x);\n }\n });\n\n return snapPoints;\n }\n\n\n eventBus.on('bendpoint.move.move', 1500, function(event) {\n\n var context = event.context,\n snapPoints = getBendpointSnaps(context),\n target = context.target,\n targetMid = target && mid(target),\n x = event.x,\n y = event.y,\n sx, sy;\n\n if (!snapPoints) {\n return;\n }\n\n // snap\n sx = snapTo(targetMid ? snapPoints.vertical.concat([ targetMid.x ]) : snapPoints.vertical, x);\n sy = snapTo(targetMid ? snapPoints.horizontal.concat([ targetMid.y ]) : snapPoints.horizontal, y);\n\n\n // correction x/y\n var cx = (x - sx),\n cy = (y - sy);\n\n // update delta\n assign(event, {\n dx: event.dx - cx,\n dy: event.dy - cy,\n x: event.x - cx,\n y: event.y - cy\n });\n });\n}\n\n\nBendpointSnapping.$inject = [ 'eventBus' ];\n\nmodule.exports = BendpointSnapping;\n","'use strict';\n\nvar Events = require(267),\n Geometry = require(268);\n\nvar BENDPOINT_CLS = module.exports.BENDPOINT_CLS = 'djs-bendpoint';\nvar SEGMENT_DRAGGER_CLS = module.exports.SEGMENT_DRAGGER_CLS = 'djs-segment-dragger';\n\nvar svgAppend = require(472),\n svgAttr = require(474),\n svgClasses = require(475),\n svgCreate = require(478);\n\nvar rotate = require(279).rotate,\n translate = require(279).translate;\n\n\nmodule.exports.toCanvasCoordinates = function(canvas, event) {\n\n var position = Events.toPoint(event),\n clientRect = canvas._container.getBoundingClientRect(),\n offset;\n\n // canvas relative position\n\n offset = {\n x: clientRect.left,\n y: clientRect.top\n };\n\n // update actual event payload with canvas relative measures\n\n var viewbox = canvas.viewbox();\n\n return {\n x: viewbox.x + (position.x - offset.x) / viewbox.scale,\n y: viewbox.y + (position.y - offset.y) / viewbox.scale\n };\n};\n\nmodule.exports.addBendpoint = function(parentGfx, cls) {\n var groupGfx = svgCreate('g');\n svgClasses(groupGfx).add(BENDPOINT_CLS);\n\n svgAppend(parentGfx, groupGfx);\n\n var visual = svgCreate('circle');\n svgAttr(visual, {\n cx: 0,\n cy: 0,\n r: 4\n });\n svgClasses(visual).add('djs-visual');\n\n svgAppend(groupGfx, visual);\n\n var hit = svgCreate('circle');\n svgAttr(hit, {\n cx: 0,\n cy: 0,\n r: 10\n });\n svgClasses(hit).add('djs-hit');\n\n svgAppend(groupGfx, hit);\n\n if (cls) {\n svgClasses(groupGfx).add(cls);\n }\n\n return groupGfx;\n};\n\nfunction createParallelDragger(parentGfx, position, alignment) {\n var draggerGfx = svgCreate('g');\n\n svgAppend(parentGfx, draggerGfx);\n\n var width = 14,\n height = 3,\n padding = 6,\n hitWidth = width + padding,\n hitHeight = height + padding;\n\n var visual = svgCreate('rect');\n svgAttr(visual, {\n x: -width / 2,\n y: -height / 2,\n width: width,\n height: height\n });\n svgClasses(visual).add('djs-visual');\n\n svgAppend(draggerGfx, visual);\n\n var hit = svgCreate('rect');\n svgAttr(hit, {\n x: -hitWidth / 2,\n y: -hitHeight / 2,\n width: hitWidth,\n height: hitHeight\n });\n svgClasses(hit).add('djs-hit');\n\n svgAppend(draggerGfx, hit);\n\n rotate(draggerGfx, alignment === 'h' ? 90 : 0, 0, 0);\n\n return draggerGfx;\n}\n\n\nmodule.exports.addSegmentDragger = function(parentGfx, segmentStart, segmentEnd) {\n\n var groupGfx = svgCreate('g'),\n mid = Geometry.getMidPoint(segmentStart, segmentEnd),\n alignment = Geometry.pointsAligned(segmentStart, segmentEnd);\n\n svgAppend(parentGfx, groupGfx);\n\n createParallelDragger(groupGfx, mid, alignment);\n\n svgClasses(groupGfx).add(SEGMENT_DRAGGER_CLS);\n svgClasses(groupGfx).add(alignment === 'h' ? 'vertical' : 'horizontal');\n\n translate(groupGfx, mid.x, mid.y);\n\n return groupGfx;\n};\n","'use strict';\n\nvar forEach = require(303);\n\nvar domEvent = require(450),\n domQuery = require(452),\n BendpointUtil = require(142);\n\nvar pointsAligned = require(268).pointsAligned,\n getMidPoint = require(268).getMidPoint;\n\nvar BENDPOINT_CLS = BendpointUtil.BENDPOINT_CLS,\n SEGMENT_DRAGGER_CLS = BendpointUtil.SEGMENT_DRAGGER_CLS;\n\nvar getApproxIntersection = require(272).getApproxIntersection;\n\nvar svgAppend = require(472),\n svgAttr = require(474),\n svgClasses = require(475),\n svgCreate = require(478),\n svgRemove = require(481);\n\nvar translate = require(279).translate;\n\n\n/**\n * A service that adds editable bendpoints to connections.\n */\nfunction Bendpoints(eventBus, canvas, interactionEvents,\n bendpointMove, connectionSegmentMove) {\n\n function getConnectionIntersection(waypoints, event) {\n var localPosition = BendpointUtil.toCanvasCoordinates(canvas, event),\n intersection = getApproxIntersection(waypoints, localPosition);\n\n return intersection;\n }\n\n function isIntersectionMiddle(intersection, waypoints, treshold) {\n var idx = intersection.index,\n p = intersection.point,\n p0, p1, mid, aligned, xDelta, yDelta;\n\n if (idx <= 0 || intersection.bendpoint) {\n return false;\n }\n\n p0 = waypoints[idx - 1];\n p1 = waypoints[idx];\n mid = getMidPoint(p0, p1),\n aligned = pointsAligned(p0, p1);\n xDelta = Math.abs(p.x - mid.x);\n yDelta = Math.abs(p.y - mid.y);\n\n return aligned && xDelta <= treshold && yDelta <= treshold;\n }\n\n function activateBendpointMove(event, connection) {\n var waypoints = connection.waypoints,\n intersection = getConnectionIntersection(waypoints, event);\n\n if (!intersection) {\n return;\n }\n\n if (isIntersectionMiddle(intersection, waypoints, 10)) {\n connectionSegmentMove.start(event, connection, intersection.index);\n } else {\n bendpointMove.start(event, connection, intersection.index, !intersection.bendpoint);\n }\n }\n\n function bindInteractionEvents(node, eventName, element) {\n\n domEvent.bind(node, eventName, function(event) {\n interactionEvents.triggerMouseEvent(eventName, event, element);\n event.stopPropagation();\n });\n }\n\n function getBendpointsContainer(element, create) {\n\n var layer = canvas.getLayer('overlays'),\n gfx = domQuery('.djs-bendpoints[data-element-id=' + element.id + ']', layer);\n\n if (!gfx && create) {\n gfx = svgCreate('g');\n svgAttr(gfx, { 'data-element-id': element.id });\n svgClasses(gfx).add('djs-bendpoints');\n\n svgAppend(layer, gfx);\n\n bindInteractionEvents(gfx, 'mousedown', element);\n bindInteractionEvents(gfx, 'click', element);\n bindInteractionEvents(gfx, 'dblclick', element);\n }\n\n return gfx;\n }\n\n function createBendpoints(gfx, connection) {\n connection.waypoints.forEach(function(p, idx) {\n var bendpoint = BendpointUtil.addBendpoint(gfx);\n\n svgAppend(gfx, bendpoint);\n\n translate(bendpoint, p.x, p.y);\n });\n\n // add floating bendpoint\n BendpointUtil.addBendpoint(gfx, 'floating');\n }\n\n function createSegmentDraggers(gfx, connection) {\n\n var waypoints = connection.waypoints;\n\n var segmentStart,\n segmentEnd;\n\n for (var i = 1; i < waypoints.length; i++) {\n\n segmentStart = waypoints[i - 1];\n segmentEnd = waypoints[i];\n\n if (pointsAligned(segmentStart, segmentEnd)) {\n BendpointUtil.addSegmentDragger(gfx, segmentStart, segmentEnd);\n }\n }\n }\n\n function clearBendpoints(gfx) {\n forEach(domQuery.all('.' + BENDPOINT_CLS, gfx), function(node) {\n svgRemove(node);\n });\n }\n\n function clearSegmentDraggers(gfx) {\n forEach(domQuery.all('.' + SEGMENT_DRAGGER_CLS, gfx), function(node) {\n svgRemove(node);\n });\n }\n\n function addHandles(connection) {\n\n var gfx = getBendpointsContainer(connection);\n\n if (!gfx) {\n gfx = getBendpointsContainer(connection, true);\n\n createBendpoints(gfx, connection);\n createSegmentDraggers(gfx, connection);\n }\n\n return gfx;\n }\n\n function updateHandles(connection) {\n\n var gfx = getBendpointsContainer(connection);\n\n if (gfx) {\n clearSegmentDraggers(gfx);\n clearBendpoints(gfx);\n createSegmentDraggers(gfx, connection);\n createBendpoints(gfx, connection);\n }\n }\n\n eventBus.on('connection.changed', function(event) {\n updateHandles(event.element);\n });\n\n eventBus.on('connection.remove', function(event) {\n var gfx = getBendpointsContainer(event.element);\n\n if (gfx) {\n svgRemove(gfx);\n }\n });\n\n eventBus.on('element.marker.update', function(event) {\n\n var element = event.element,\n bendpointsGfx;\n\n if (!element.waypoints) {\n return;\n }\n\n bendpointsGfx = addHandles(element);\n\n if (event.add) {\n svgClasses(bendpointsGfx).add(event.marker);\n } else {\n svgClasses(bendpointsGfx).remove(event.marker);\n }\n });\n\n eventBus.on('element.mousemove', function(event) {\n\n var element = event.element,\n waypoints = element.waypoints,\n bendpointsGfx,\n floating,\n intersection;\n\n if (waypoints) {\n bendpointsGfx = getBendpointsContainer(element, true);\n floating = domQuery('.floating', bendpointsGfx);\n\n if (!floating) {\n return;\n }\n\n intersection = getConnectionIntersection(waypoints, event.originalEvent);\n\n if (intersection) {\n translate(floating, intersection.point.x, intersection.point.y);\n }\n }\n });\n\n eventBus.on('element.mousedown', function(event) {\n\n var originalEvent = event.originalEvent,\n element = event.element,\n waypoints = element.waypoints;\n\n if (!waypoints) {\n return;\n }\n\n activateBendpointMove(originalEvent, element, waypoints);\n });\n\n eventBus.on('selection.changed', function(event) {\n var newSelection = event.newSelection,\n primary = newSelection[0];\n\n if (primary && primary.waypoints) {\n addHandles(primary);\n }\n });\n\n eventBus.on('element.hover', function(event) {\n var element = event.element;\n\n if (element.waypoints) {\n addHandles(element);\n interactionEvents.registerEvent(event.gfx, 'mousemove', 'element.mousemove');\n }\n });\n\n eventBus.on('element.out', function(event) {\n interactionEvents.unregisterEvent(event.gfx, 'mousemove', 'element.mousemove');\n });\n\n // update bendpoint container data attribute on element ID change\n eventBus.on('element.updateId', function(context) {\n var element = context.element,\n newId = context.newId;\n\n if (element.waypoints) {\n var bendpointContainer = getBendpointsContainer(element);\n\n if (bendpointContainer) {\n svgAttr(bendpointContainer, { 'data-element-id': newId });\n }\n }\n });\n\n // API\n\n this.addHandles = addHandles;\n this.updateHandles = updateHandles;\n this.getBendpointsContainer = getBendpointsContainer;\n}\n\nBendpoints.$inject = [\n 'eventBus', 'canvas', 'interactionEvents',\n 'bendpointMove', 'connectionSegmentMove'\n];\n\nmodule.exports = Bendpoints;\n","'use strict';\n\nvar Geometry = require(268),\n BendpointUtil = require(142),\n LayoutUtil = require(252);\n\nvar MARKER_CONNECT_HOVER = 'connect-hover',\n MARKER_CONNECT_UPDATING = 'djs-updating';\n\nvar svgClasses = require(475),\n svgRemove = require(481);\n\nvar translate = require(279).translate;\n\n\nfunction axisAdd(point, axis, delta) {\n return axisSet(point, axis, point[axis] + delta);\n}\n\nfunction axisSet(point, axis, value) {\n return {\n x: (axis === 'x' ? value : point.x),\n y: (axis === 'y' ? value : point.y)\n };\n}\n\nfunction axisFenced(position, segmentStart, segmentEnd, axis) {\n\n var maxValue = Math.max(segmentStart[axis], segmentEnd[axis]),\n minValue = Math.min(segmentStart[axis], segmentEnd[axis]);\n\n var padding = 20;\n\n var fencedValue = Math.min(Math.max(minValue + padding, position[axis]), maxValue - padding);\n\n return axisSet(segmentStart, axis, fencedValue);\n}\n\nfunction flipAxis(axis) {\n return axis === 'x' ? 'y' : 'x';\n}\n\n/**\n * Get the docking point on the given element.\n *\n * Compute a reasonable docking, if non exists.\n *\n * @param {Point} point\n * @param {djs.model.Shape} referenceElement\n * @param {String} moveAxis (x|y)\n *\n * @return {Point}\n */\nfunction getDocking(point, referenceElement, moveAxis) {\n\n var referenceMid,\n inverseAxis;\n\n if (point.original) {\n return point.original;\n } else {\n referenceMid = LayoutUtil.getMid(referenceElement);\n inverseAxis = flipAxis(moveAxis);\n\n return axisSet(point, inverseAxis, referenceMid[inverseAxis]);\n }\n}\n\n/**\n * A component that implements moving of bendpoints\n */\nfunction ConnectionSegmentMove(injector, eventBus, canvas, dragging, graphicsFactory, rules, modeling) {\n\n // optional connection docking integration\n var connectionDocking = injector.get('connectionDocking', false);\n\n\n // API\n\n this.start = function(event, connection, idx) {\n\n var context,\n gfx = canvas.getGraphics(connection),\n segmentStartIndex = idx - 1,\n segmentEndIndex = idx,\n waypoints = connection.waypoints,\n segmentStart = waypoints[segmentStartIndex],\n segmentEnd = waypoints[segmentEndIndex],\n direction,\n axis;\n\n direction = Geometry.pointsAligned(segmentStart, segmentEnd);\n\n // do not move diagonal connection\n if (!direction) {\n return;\n }\n\n // the axis where we are going to move things\n axis = direction === 'v' ? 'y' : 'x';\n\n if (segmentStartIndex === 0) {\n segmentStart = getDocking(segmentStart, connection.source, axis);\n }\n\n if (segmentEndIndex === waypoints.length - 1) {\n segmentEnd = getDocking(segmentEnd, connection.target, axis);\n }\n\n context = {\n connection: connection,\n segmentStartIndex: segmentStartIndex,\n segmentEndIndex: segmentEndIndex,\n segmentStart: segmentStart,\n segmentEnd: segmentEnd,\n axis: axis\n };\n\n dragging.init(event, {\n x: (segmentStart.x + segmentEnd.x)/2,\n y: (segmentStart.y + segmentEnd.y)/2\n }, 'connectionSegment.move', {\n cursor: axis === 'x' ? 'resize-ew' : 'resize-ns',\n data: {\n connection: connection,\n connectionGfx: gfx,\n context: context\n }\n });\n };\n\n /**\n * Crop connection if connection cropping is provided.\n *\n * @param {Connection} connection\n * @param {Array} newWaypoints\n *\n * @return {Array} cropped connection waypoints\n */\n function cropConnection(connection, newWaypoints) {\n\n // crop connection, if docking service is provided only\n if (!connectionDocking) {\n return newWaypoints;\n }\n\n var oldWaypoints = connection.waypoints,\n croppedWaypoints;\n\n // temporary set new waypoints\n connection.waypoints = newWaypoints;\n\n croppedWaypoints = connectionDocking.getCroppedWaypoints(connection);\n\n // restore old waypoints\n connection.waypoints = oldWaypoints;\n\n return croppedWaypoints;\n }\n\n // DRAGGING IMPLEMENTATION\n\n function redrawConnection(data) {\n graphicsFactory.update('connection', data.connection, data.connectionGfx);\n }\n\n function updateDragger(context, segmentOffset, event) {\n\n var newWaypoints = context.newWaypoints,\n segmentStartIndex = context.segmentStartIndex + segmentOffset,\n segmentStart = newWaypoints[segmentStartIndex],\n segmentEndIndex = context.segmentEndIndex + segmentOffset,\n segmentEnd = newWaypoints[segmentEndIndex],\n axis = flipAxis(context.axis);\n\n // make sure the dragger does not move\n // outside the connection\n var draggerPosition = axisFenced(event, segmentStart, segmentEnd, axis);\n\n // update dragger\n translate(context.draggerGfx, draggerPosition.x, draggerPosition.y);\n }\n\n /**\n * Filter waypoints for redundant ones (i.e. on the same axis).\n * Returns the filtered waypoints and the offset related to the segment move.\n *\n * @param {Array} waypoints\n * @param {Integer} segmentStartIndex of moved segment start\n *\n * @return {Object} { filteredWaypoints, segmentOffset }\n */\n function filterRedundantWaypoints(waypoints, segmentStartIndex) {\n\n var segmentOffset = 0;\n\n var filteredWaypoints = waypoints.filter(function(r, idx) {\n if (Geometry.pointsOnLine(waypoints[idx - 1], waypoints[idx + 1], r)) {\n\n // remove point and increment offset\n segmentOffset = idx <= segmentStartIndex ? segmentOffset - 1 : segmentOffset;\n return false;\n }\n\n // dont remove point\n return true;\n });\n\n return {\n waypoints: filteredWaypoints,\n segmentOffset: segmentOffset\n };\n }\n\n eventBus.on('connectionSegment.move.start', function(e) {\n\n var context = e.context,\n connection = e.connection,\n layer = canvas.getLayer('overlays');\n\n context.originalWaypoints = connection.waypoints.slice();\n\n // add dragger gfx\n context.draggerGfx = BendpointUtil.addSegmentDragger(layer, context.segmentStart, context.segmentEnd);\n svgClasses(context.draggerGfx).add('djs-dragging');\n\n canvas.addMarker(connection, MARKER_CONNECT_UPDATING);\n });\n\n eventBus.on('connectionSegment.move.move', function(e) {\n\n var context = e.context,\n connection = context.connection,\n segmentStartIndex = context.segmentStartIndex,\n segmentEndIndex = context.segmentEndIndex,\n segmentStart = context.segmentStart,\n segmentEnd = context.segmentEnd,\n axis = context.axis;\n\n var newWaypoints = context.originalWaypoints.slice(),\n newSegmentStart = axisAdd(segmentStart, axis, e['d' + axis]),\n newSegmentEnd = axisAdd(segmentEnd, axis, e['d' + axis]);\n\n // original waypoint count and added / removed\n // from start waypoint delta. We use the later\n // to retrieve the updated segmentStartIndex / segmentEndIndex\n var waypointCount = newWaypoints.length,\n segmentOffset = 0;\n\n // move segment start / end by axis delta\n newWaypoints[segmentStartIndex] = newSegmentStart;\n newWaypoints[segmentEndIndex] = newSegmentEnd;\n\n var sourceToSegmentOrientation,\n targetToSegmentOrientation;\n\n // handle first segment\n if (segmentStartIndex < 2) {\n sourceToSegmentOrientation = LayoutUtil.getOrientation(connection.source, newSegmentStart);\n\n // first bendpoint, remove first segment if intersecting\n if (segmentStartIndex === 1) {\n\n if (sourceToSegmentOrientation === 'intersect') {\n newWaypoints.shift();\n newWaypoints[0] = newSegmentStart;\n segmentOffset--;\n }\n }\n\n // docking point, add segment if not intersecting anymore\n else {\n if (sourceToSegmentOrientation !== 'intersect') {\n newWaypoints.unshift(segmentStart);\n segmentOffset++;\n }\n }\n }\n\n // handle last segment\n if (segmentEndIndex > waypointCount - 3) {\n targetToSegmentOrientation = LayoutUtil.getOrientation(connection.target, newSegmentEnd);\n\n // last bendpoint, remove last segment if intersecting\n if (segmentEndIndex === waypointCount - 2) {\n\n if (targetToSegmentOrientation === 'intersect') {\n newWaypoints.pop();\n newWaypoints[newWaypoints.length - 1] = newSegmentEnd;\n }\n }\n\n // last bendpoint, remove last segment if intersecting\n else {\n if (targetToSegmentOrientation !== 'intersect') {\n newWaypoints.push(segmentEnd);\n }\n }\n }\n\n // update connection waypoints\n context.newWaypoints = connection.waypoints = cropConnection(connection, newWaypoints);\n\n // update dragger position\n updateDragger(context, segmentOffset, e);\n\n // save segmentOffset in context\n context.newSegmentStartIndex = segmentStartIndex + segmentOffset;\n\n // redraw connection\n redrawConnection(e);\n });\n\n eventBus.on('connectionSegment.move.hover', function(e) {\n\n e.context.hover = e.hover;\n canvas.addMarker(e.hover, MARKER_CONNECT_HOVER);\n });\n\n eventBus.on([\n 'connectionSegment.move.out',\n 'connectionSegment.move.cleanup'\n ], function(e) {\n\n // remove connect marker\n // if it was added\n var hover = e.context.hover;\n\n if (hover) {\n canvas.removeMarker(hover, MARKER_CONNECT_HOVER);\n }\n });\n\n eventBus.on('connectionSegment.move.cleanup', function(e) {\n\n var context = e.context,\n connection = context.connection;\n\n // remove dragger gfx\n if (context.draggerGfx) {\n svgRemove(context.draggerGfx);\n }\n\n canvas.removeMarker(connection, MARKER_CONNECT_UPDATING);\n });\n\n eventBus.on([\n 'connectionSegment.move.cancel',\n 'connectionSegment.move.end'\n ], function(e) {\n var context = e.context,\n connection = context.connection;\n\n connection.waypoints = context.originalWaypoints;\n\n redrawConnection(e);\n });\n\n eventBus.on('connectionSegment.move.end', function(e) {\n\n var context = e.context,\n connection = context.connection,\n newWaypoints = context.newWaypoints,\n newSegmentStartIndex = context.newSegmentStartIndex;\n\n // ensure we have actual pixel values bendpoint\n // coordinates (important when zoom level was > 1 during move)\n newWaypoints = newWaypoints.map(function(p) {\n return {\n original: p.original,\n x: Math.round(p.x),\n y: Math.round(p.y)\n };\n });\n\n // apply filter redunant waypoints\n var filtered = filterRedundantWaypoints(newWaypoints, newSegmentStartIndex);\n\n // get filtered waypoints\n var filteredWaypoints = filtered.waypoints,\n croppedWaypoints = cropConnection(connection, filteredWaypoints),\n segmentOffset = filtered.segmentOffset;\n\n var hints = {\n segmentMove: {\n segmentStartIndex: context.segmentStartIndex,\n newSegmentStartIndex: newSegmentStartIndex + segmentOffset\n }\n };\n\n modeling.updateWaypoints(connection, croppedWaypoints, hints);\n });\n}\n\nConnectionSegmentMove.$inject = [\n 'injector', 'eventBus', 'canvas',\n 'dragging', 'graphicsFactory', 'rules',\n 'modeling'\n];\n\nmodule.exports = ConnectionSegmentMove;\n","module.exports = {\n __depends__: [ require(162), require(227) ],\n __init__: [ 'bendpoints', 'bendpointSnapping' ],\n bendpoints: [ 'type', require(143) ],\n bendpointMove: [ 'type', require(140) ],\n connectionSegmentMove: [ 'type', require(144) ],\n bendpointSnapping: [ 'type', require(141) ]\n};\n","'use strict';\n\nvar getElementType = require(266).getType;\n\n/**\n * Adds change support to the diagram, including\n *\n *
    \n *
  • redrawing shapes and connections on change
  • \n *
\n *\n * @param {EventBus} eventBus\n * @param {Canvas} canvas\n * @param {ElementRegistry} elementRegistry\n * @param {GraphicsFactory} graphicsFactory\n */\nfunction ChangeSupport(eventBus, canvas, elementRegistry, graphicsFactory) {\n\n // redraw shapes / connections on change\n\n eventBus.on('element.changed', function(event) {\n\n var element = event.element;\n\n // element might have been deleted and replaced by new element with same ID\n // thus check for parent of element except for root element\n if (element.parent || element === canvas.getRootElement()) {\n event.gfx = elementRegistry.getGraphics(element);\n }\n\n // shape + gfx may have been deleted\n if (!event.gfx) {\n return;\n }\n\n eventBus.fire(getElementType(element) + '.changed', event);\n });\n\n eventBus.on('elements.changed', function(event) {\n\n var elements = event.elements;\n\n elements.forEach(function(e) {\n eventBus.fire('element.changed', { element: e });\n });\n\n graphicsFactory.updateContainments(elements);\n });\n\n eventBus.on('shape.changed', function(event) {\n graphicsFactory.update('shape', event.element, event.gfx);\n });\n\n eventBus.on('connection.changed', function(event) {\n graphicsFactory.update('connection', event.element, event.gfx);\n });\n}\n\nChangeSupport.$inject = [ 'eventBus', 'canvas', 'elementRegistry', 'graphicsFactory' ];\n\nmodule.exports = ChangeSupport;\n","module.exports = {\n __init__: [ 'changeSupport'],\n changeSupport: [ 'type', require(146) ]\n};","'use strict';\n\n/**\n * A clip board stub\n */\nfunction Clipboard() {}\n\nmodule.exports = Clipboard;\n\n\nClipboard.prototype.get = function() {\n return this._data;\n};\n\nClipboard.prototype.set = function(data) {\n this._data = data;\n};\n\nClipboard.prototype.clear = function() {\n var data = this._data;\n\n delete this._data;\n\n return data;\n};\n\nClipboard.prototype.isEmpty = function() {\n return !this._data;\n};","module.exports = {\n clipboard: [ 'type', require(148) ]\n};\n","'use strict';\n\nvar LayoutUtil = require(252);\n\nvar MARKER_OK = 'connect-ok',\n MARKER_NOT_OK = 'connect-not-ok';\n\nvar svgAppend = require(472),\n svgAttr = require(474),\n svgCreate = require(478),\n svgRemove = require(481);\n\n\nfunction Connect(eventBus, dragging, modeling, rules, canvas, graphicsFactory) {\n\n // TODO(nre): separate UI and events\n\n // rules\n\n function canConnect(source, target) {\n return rules.allowed('connection.create', {\n source: source,\n target: target\n });\n }\n\n\n // layouting\n\n function crop(start, end, source, target) {\n\n var sourcePath = graphicsFactory.getShapePath(source),\n targetPath = target && graphicsFactory.getShapePath(target),\n connectionPath = graphicsFactory.getConnectionPath({ waypoints: [ start, end ] });\n\n start = LayoutUtil.getElementLineIntersection(sourcePath, connectionPath, true) || start;\n end = (target && LayoutUtil.getElementLineIntersection(targetPath, connectionPath, false)) || end;\n\n return [ start, end ];\n }\n\n\n // event handlers\n\n eventBus.on('connect.move', function(event) {\n\n var context = event.context,\n source = context.source,\n target = context.target,\n visual = context.visual,\n sourcePosition = context.sourcePosition,\n endPosition,\n waypoints;\n\n // update connection visuals during drag\n\n endPosition = {\n x: event.x,\n y: event.y\n };\n\n waypoints = crop(sourcePosition, endPosition, source, target);\n\n svgAttr(visual, { 'points': [ waypoints[0].x, waypoints[0].y, waypoints[1].x, waypoints[1].y ] });\n });\n\n eventBus.on('connect.hover', function(event) {\n var context = event.context,\n source = context.source,\n hover = event.hover,\n canExecute;\n\n canExecute = context.canExecute = canConnect(source, hover);\n\n // simply ignore hover\n if (canExecute === null) {\n return;\n }\n\n context.target = hover;\n\n canvas.addMarker(hover, canExecute ? MARKER_OK : MARKER_NOT_OK);\n });\n\n eventBus.on([ 'connect.out', 'connect.cleanup' ], function(event) {\n var context = event.context;\n\n if (context.target) {\n canvas.removeMarker(context.target, context.canExecute ? MARKER_OK : MARKER_NOT_OK);\n }\n\n context.target = null;\n });\n\n eventBus.on('connect.cleanup', function(event) {\n var context = event.context;\n\n if (context.visual) {\n svgRemove(context.visual);\n }\n });\n\n eventBus.on('connect.start', function(event) {\n var context = event.context,\n visual;\n\n visual = svgCreate('polyline');\n svgAttr(visual, {\n 'stroke': '#333',\n 'strokeDasharray': [ 1 ],\n 'strokeWidth': 2,\n 'pointer-events': 'none'\n });\n\n svgAppend(canvas.getDefaultLayer(), visual);\n\n context.visual = visual;\n });\n\n eventBus.on('connect.end', function(event) {\n\n var context = event.context,\n source = context.source,\n sourcePosition = context.sourcePosition,\n target = context.target,\n targetPosition = {\n x: event.x,\n y: event.y\n },\n canExecute = context.canExecute || canConnect(source, target);\n\n if (!canExecute) {\n return false;\n }\n\n var attrs = null,\n hints = {\n connectionStart: sourcePosition,\n connectionEnd: targetPosition\n };\n\n if (typeof canExecute === 'object') {\n attrs = canExecute;\n }\n\n modeling.connect(source, target, attrs, hints);\n });\n\n\n // API\n\n /**\n * Start connect operation.\n *\n * @param {DOMEvent} event\n * @param {djs.model.Base} source\n * @param {Point} [sourcePosition]\n * @param {Boolean} [autoActivate=false]\n */\n this.start = function(event, source, sourcePosition, autoActivate) {\n\n if (typeof sourcePosition !== 'object') {\n autoActivate = sourcePosition;\n sourcePosition = LayoutUtil.getMid(source);\n }\n\n dragging.init(event, 'connect', {\n autoActivate: autoActivate,\n data: {\n shape: source,\n context: {\n source: source,\n sourcePosition: sourcePosition\n }\n }\n });\n };\n}\n\nConnect.$inject = [ 'eventBus', 'dragging', 'modeling', 'rules', 'canvas', 'graphicsFactory' ];\n\nmodule.exports = Connect;\n","module.exports = {\n __depends__: [\n require(233),\n require(227),\n require(162)\n ],\n connect: [ 'type', require(150) ]\n};\n","'use strict';\n\nvar isFunction = require(423),\n isArray = require(422),\n forEach = require(303),\n\n domDelegate = require(448),\n domEvent = require(450),\n domAttr = require(444),\n domQuery = require(452),\n domClasses = require(445),\n domify = require(449);\n\n\nvar entrySelector = '.entry';\n\n\n/**\n * A context pad that displays element specific, contextual actions next\n * to a diagram element.\n *\n * @param {EventBus} eventBus\n * @param {Overlays} overlays\n */\nfunction ContextPad(eventBus, overlays) {\n\n this._providers = [];\n\n this._eventBus = eventBus;\n this._overlays = overlays;\n\n this._current = null;\n\n this._init();\n}\n\nContextPad.$inject = [ 'eventBus', 'overlays' ];\n\nmodule.exports = ContextPad;\n\n\n/**\n * Registers events needed for interaction with other components\n */\nContextPad.prototype._init = function() {\n\n var eventBus = this._eventBus;\n\n var self = this;\n\n eventBus.on('selection.changed', function(e) {\n\n var selection = e.newSelection;\n\n if (selection.length === 1) {\n self.open(selection[0]);\n } else {\n self.close();\n }\n });\n\n eventBus.on('elements.delete', function(event) {\n var elements = event.elements;\n\n forEach(elements, function(e) {\n if (self.isOpen(e)) {\n self.close();\n }\n });\n });\n\n eventBus.on('element.changed', function(event) {\n var element = event.element,\n current = self._current;\n\n // force reopen if element for which we are currently opened changed\n if (current && current.element === element) {\n self.open(element, true);\n }\n });\n};\n\n\n/**\n * Register a provider with the context pad\n *\n * @param {ContextPadProvider} provider\n */\nContextPad.prototype.registerProvider = function(provider) {\n this._providers.push(provider);\n};\n\n\n/**\n * Returns the context pad entries for a given element\n *\n * @param {djs.element.Base} element\n *\n * @return {Array} list of entries\n */\nContextPad.prototype.getEntries = function(element) {\n var entries = {};\n\n // loop through all providers and their entries.\n // group entries by id so that overriding an entry is possible\n forEach(this._providers, function(provider) {\n var e = provider.getContextPadEntries(element);\n\n forEach(e, function(entry, id) {\n entries[id] = entry;\n });\n });\n\n return entries;\n};\n\n\n/**\n * Trigger an action available on the opened context pad\n *\n * @param {String} action\n * @param {Event} event\n * @param {Boolean} [autoActivate=false]\n */\nContextPad.prototype.trigger = function(action, event, autoActivate) {\n\n var element = this._current.element,\n entries = this._current.entries,\n entry,\n handler,\n originalEvent,\n button = event.delegateTarget || event.target;\n\n if (!button) {\n return event.preventDefault();\n }\n\n entry = entries[domAttr(button, 'data-action')];\n handler = entry.action;\n\n originalEvent = event.originalEvent || event;\n\n // simple action (via callback function)\n if (isFunction(handler)) {\n if (action === 'click') {\n return handler(originalEvent, element, autoActivate);\n }\n } else {\n if (handler[action]) {\n return handler[action](originalEvent, element, autoActivate);\n }\n }\n\n // silence other actions\n event.preventDefault();\n};\n\n\n/**\n * Open the context pad for the given element\n *\n * @param {djs.model.Base} element\n * @param {Boolean} force if true, force reopening the context pad\n */\nContextPad.prototype.open = function(element, force) {\n if (!force && this.isOpen(element)) {\n return;\n }\n\n this.close();\n this._updateAndOpen(element);\n};\n\n\nContextPad.prototype._updateAndOpen = function(element) {\n\n var entries = this.getEntries(element),\n pad = this.getPad(element),\n html = pad.html;\n\n forEach(entries, function(entry, id) {\n var grouping = entry.group || 'default',\n control = domify(entry.html || '
'),\n container;\n\n domAttr(control, 'data-action', id);\n\n container = domQuery('[data-group=' + grouping + ']', html);\n if (!container) {\n container = domify('
');\n html.appendChild(container);\n }\n\n container.appendChild(control);\n\n if (entry.className) {\n addClasses(control, entry.className);\n }\n\n if (entry.title) {\n domAttr(control, 'title', entry.title);\n }\n\n if (entry.imageUrl) {\n control.appendChild(domify(''));\n }\n });\n\n domClasses(html).add('open');\n\n this._current = {\n element: element,\n pad: pad,\n entries: entries\n };\n\n this._eventBus.fire('contextPad.open', { current: this._current });\n};\n\n\nContextPad.prototype.getPad = function(element) {\n if (this.isOpen()) {\n return this._current.pad;\n }\n\n var self = this;\n\n var overlays = this._overlays;\n\n var html = domify('
');\n\n domDelegate.bind(html, entrySelector, 'click', function(event) {\n self.trigger('click', event);\n });\n\n domDelegate.bind(html, entrySelector, 'dragstart', function(event) {\n self.trigger('dragstart', event);\n });\n\n // stop propagation of mouse events\n domEvent.bind(html, 'mousedown', function(event) {\n event.stopPropagation();\n });\n\n this._overlayId = overlays.add(element, 'context-pad', {\n position: {\n right: -9,\n top: -6\n },\n html: html\n });\n\n var pad = overlays.get(this._overlayId);\n\n this._eventBus.fire('contextPad.create', { element: element, pad: pad });\n\n return pad;\n};\n\n\n/**\n * Close the context pad\n */\nContextPad.prototype.close = function() {\n if (!this.isOpen()) {\n return;\n }\n\n this._overlays.remove(this._overlayId);\n\n this._overlayId = null;\n\n this._eventBus.fire('contextPad.close', { current: this._current });\n\n this._current = null;\n};\n\n/**\n * Check if pad is open. If element is given, will check\n * if pad is opened with given element.\n *\n * @param {Element} element\n * @return {Boolean}\n */\nContextPad.prototype.isOpen = function(element) {\n return !!this._current && (!element ? true : this._current.element === element);\n};\n\n\n\n\n////////// helpers /////////////////////////////\n\nfunction addClasses(element, classNames) {\n\n var classes = domClasses(element);\n\n var actualClassNames = isArray(classNames) ? classNames : classNames.split(//s+/g);\n actualClassNames.forEach(function(cls) {\n classes.add(cls);\n });\n}","module.exports = {\n __depends__: [\n require(170),\n require(211)\n ],\n contextPad: [ 'type', require(152) ]\n};","'use strict';\n\nvar isArray = require(422),\n forEach = require(303),\n map = require(305),\n find = require(302),\n findIndex = require(290),\n sortBy = require(310),\n reduce = require(306);\n\nvar getBBox = require(266).getBBox;\n\nvar PositionUtil = require(276);\n\nvar CopyPasteUtil = require(264),\n ElementsUtil = require(266);\n\n\n\nfunction CopyPaste(eventBus, modeling, elementFactory, rules, clipboard, canvas) {\n this._eventBus = eventBus;\n this._modeling = modeling;\n this._elementFactory = elementFactory;\n this._rules = rules;\n this._canvas = canvas;\n\n this._clipboard = clipboard;\n\n this._descriptors = [];\n\n\n // Element creation priorities:\n // - 1: Independent shapes\n // - 2: Attached shapes\n // - 3: Connections\n // - 4: labels\n this.registerDescriptor(function(element, descriptor) {\n // Base priority\n descriptor.priority = 1;\n\n descriptor.id = element.id;\n\n if (element.parent) {\n descriptor.parent = element.parent.id;\n }\n\n if (element.labelTarget) {\n // Labels priority\n descriptor.priority = 4;\n descriptor.labelTarget = element.labelTarget.id;\n }\n\n if (element.host) {\n // Attached shapes priority\n descriptor.priority = 2;\n descriptor.host = element.host.id;\n }\n\n if (typeof element.x === 'number') {\n descriptor.x = element.x;\n descriptor.y = element.y;\n }\n\n if (element.width) {\n descriptor.width = element.width;\n descriptor.height = element.height;\n }\n\n if (element.waypoints) {\n // Connections priority\n descriptor.priority = 3;\n descriptor.waypoints = [];\n\n forEach(element.waypoints, function(waypoint) {\n var wp = {\n x: waypoint.x,\n y: waypoint.y\n };\n\n if (waypoint.original) {\n wp.original = {\n x: waypoint.original.x,\n y: waypoint.original.y\n };\n }\n\n descriptor.waypoints.push(wp);\n });\n }\n\n if (element.source && element.target) {\n descriptor.source = element.source.id;\n descriptor.target = element.target.id;\n }\n\n return descriptor;\n });\n}\n\nCopyPaste.$inject = [\n 'eventBus',\n 'modeling',\n 'elementFactory',\n 'rules',\n 'clipboard',\n 'canvas'\n];\n\nmodule.exports = CopyPaste;\n\n/**\n * Copy a number of elements.\n *\n * @param {djs.model.Base} selectedElements\n *\n * @return {Object} the copied tree\n */\nCopyPaste.prototype.copy = function(selectedElements) {\n var clipboard = this._clipboard,\n tree, bbox;\n\n if (!isArray(selectedElements)) {\n selectedElements = selectedElements ? [ selectedElements ] : [];\n }\n\n if (!selectedElements.length) {\n return;\n }\n\n tree = this.createTree(selectedElements);\n\n bbox = this._bbox = PositionUtil.center(getBBox(tree.allShapes));\n\n // not needed after computing the center position of the copied elements\n delete tree.allShapes;\n\n forEach(tree, function(elements) {\n\n forEach(elements, function(element) {\n var delta, labelTarget;\n\n // set label's relative position to their label target\n if (element.labelTarget) {\n labelTarget = find(elements, { id: element.labelTarget });\n\n // just grab the delta from the first waypoint\n if (labelTarget.waypoints) {\n delta = PositionUtil.delta(element, labelTarget.waypoints[0]);\n } else {\n delta = PositionUtil.delta(element, labelTarget);\n }\n\n } else\n if (element.priority === 3) {\n // connections have priority 3\n delta = [];\n\n forEach(element.waypoints, function(waypoint) {\n var waypointDelta = PositionUtil.delta(waypoint, bbox);\n\n delta.push(waypointDelta);\n }, this);\n } else {\n delta = PositionUtil.delta(element, bbox);\n }\n\n element.delta = delta;\n });\n });\n\n this._eventBus.fire('elements.copy', { context: { tree: tree } });\n\n // if tree is empty, means that nothing can be or is allowed to be copied\n if (Object.keys(tree).length === 0) {\n clipboard.clear();\n } else {\n clipboard.set(tree);\n }\n\n this._eventBus.fire('elements.copied', { context: { tree: tree } });\n\n return tree;\n};\n\n\n// Allow pasting under the cursor\nCopyPaste.prototype.paste = function(context) {\n var clipboard = this._clipboard,\n modeling = this._modeling,\n eventBus = this._eventBus,\n rules = this._rules;\n\n var tree = clipboard.get(),\n topParent = context.element,\n position = context.point,\n newTree, canPaste;\n\n if (clipboard.isEmpty()) {\n return;\n }\n\n newTree = reduce(tree, function(pasteTree, elements, depthStr) {\n var depth = parseInt(depthStr, 10);\n\n if (isNaN(depth)) {\n return pasteTree;\n }\n\n pasteTree[depth] = elements;\n\n return pasteTree;\n }, {}, this);\n\n\n canPaste = rules.allowed('elements.paste', {\n tree: newTree,\n target: topParent\n });\n\n if (!canPaste) {\n eventBus.fire('elements.paste.rejected', {\n context: {\n tree: newTree,\n position: position,\n target: topParent\n }\n });\n\n return;\n }\n\n modeling.pasteElements(newTree, topParent, position);\n};\n\n\nCopyPaste.prototype._computeDelta = function(elements, element) {\n var bbox = this._bbox,\n delta = {};\n\n // set label's relative position to their label target\n if (element.labelTarget) {\n return PositionUtil.delta(element, element.labelTarget);\n }\n\n // connections have prority 3\n if (element.priority === 3) {\n delta = [];\n\n forEach(element.waypoints, function(waypoint) {\n var waypointDelta = PositionUtil.delta(waypoint, bbox);\n\n delta.push(waypointDelta);\n }, this);\n } else {\n delta = PositionUtil.delta(element, bbox);\n }\n\n return delta;\n};\n\n\n/**\n * Checks if the element in question has a relations to other elements.\n * Possible dependants: connections, labels, attachers\n *\n * @param {Array} elements\n * @param {Object} element\n *\n * @return {Boolean}\n */\nCopyPaste.prototype.hasRelations = function(elements, element) {\n var source, target, labelTarget;\n\n if (element.waypoints) {\n source = find(elements, { id: element.source.id });\n target = find(elements, { id: element.target.id });\n\n if (!source || !target) {\n return false;\n }\n }\n\n if (element.labelTarget) {\n labelTarget = find(elements, { id: element.labelTarget.id });\n\n if (!labelTarget) {\n return false;\n }\n }\n\n return true;\n};\n\n\nCopyPaste.prototype.registerDescriptor = function(descriptor) {\n if (typeof descriptor !== 'function') {\n throw new Error('the descriptor must be a function');\n }\n\n if (this._descriptors.indexOf(descriptor) !== -1) {\n throw new Error('this descriptor is already registered');\n }\n\n this._descriptors.push(descriptor);\n};\n\n\nCopyPaste.prototype._executeDescriptors = function(data) {\n if (!data.descriptor) {\n data.descriptor = {};\n }\n\n forEach(this._descriptors, function(descriptor) {\n data.descriptor = descriptor(data.element, data.descriptor);\n });\n\n return data;\n};\n\n/**\n * Creates a tree like structure from an arbitrary collection of elements\n *\n * @example\n * tree: {\n *\t0: [\n *\t\t{ id: 'shape_12da', priority: 1, ... },\n *\t\t{ id: 'shape_01bj', priority: 1, ... },\n *\t\t{ id: 'connection_79fa', source: 'shape_12da', target: 'shape_01bj', priority: 3, ... },\n *\t],\n *\t1: [ ... ]\n * };\n *\n * @param {Array} elements\n * @return {Object}\n */\nCopyPaste.prototype.createTree = function(elements) {\n var rules = this._rules;\n\n var tree = {},\n includedElements = [],\n _elements;\n\n var topLevel = CopyPasteUtil.getTopLevel(elements);\n\n tree.allShapes = [];\n\n function canCopy(collection, element) {\n return rules.allowed('element.copy', {\n collection: collection,\n element: element\n });\n }\n\n function includeElement(data) {\n var idx = findIndex(includedElements, { element: data.element }),\n element;\n\n if (idx !== -1) {\n element = includedElements[idx];\n } else {\n return includedElements.push(data);\n }\n\n // makes sure that it has the correct depth\n if (element.depth < data.depth) {\n includedElements.splice(idx, 1);\n\n includedElements.push(data);\n }\n }\n\n\n ElementsUtil.eachElement(topLevel, function(element, i, depth) {\n var nestedChildren = element.children;\n\n // don't add labels directly\n if (element.labelTarget) {\n return;\n }\n\n function getNested(lists) {\n forEach(lists, function(list) {\n if (list && list.length) {\n\n forEach(list, function(elem) {\n // fetch element's label\n if (elem.label) {\n includeElement({\n element: elem.label,\n depth: depth\n });\n }\n\n includeElement({\n element: elem,\n depth: depth\n });\n });\n }\n });\n }\n\n // fetch element's label\n if (element.label) {\n includeElement({\n element: element.label,\n depth: depth\n });\n }\n\n getNested([ element.attachers, element.incoming, element.outgoing ]);\n\n includeElement({\n element: element,\n depth: depth\n });\n\n if (nestedChildren) {\n return nestedChildren;\n }\n });\n\n includedElements = map(includedElements, function(data) {\n // this is where other registered descriptors hook in\n return this._executeDescriptors(data);\n }, this);\n\n // order the elements to check if the ones dependant on others (by relationship)\n // can be copied. f.ex: label needs it's label target\n includedElements = sortBy(includedElements, function(data) {\n return data.descriptor.priority;\n });\n\n _elements = map(includedElements, function(data) {\n return data.element;\n });\n\n forEach(includedElements, function(data) {\n var depth = data.depth;\n\n if (!this.hasRelations(tree.allShapes, data.element)) {\n return;\n }\n\n if (!canCopy(_elements, data.element)) {\n return;\n }\n\n tree.allShapes.push(data.element);\n\n // create depth branches\n if (!tree[depth]) {\n tree[depth] = [];\n }\n\n tree[depth].push(data.descriptor);\n }, this);\n\n return tree;\n};\n","module.exports = {\n __depends__: [\n require(149),\n require(227),\n require(203)\n ],\n __init__: [ 'copyPaste' ],\n copyPaste: [ 'type', require(154) ]\n};\n","'use strict';\n\nvar LOW_PRIORITY = 750;\n\nvar MARKER_OK = 'drop-ok',\n MARKER_NOT_OK = 'drop-not-ok',\n MARKER_ATTACH = 'attach-ok',\n MARKER_NEW_PARENT = 'new-parent';\n\nvar svgAppend = require(472),\n svgAttr = require(474),\n svgClasses = require(475),\n svgCreate = require(478),\n svgRemove = require(481);\n\nvar translate = require(279).translate;\n\n\nfunction Create(eventBus, dragging, rules, modeling, canvas, styles, graphicsFactory) {\n\n // rules\n\n function canCreate(shape, target, source, position) {\n\n if (source) {\n return rules.allowed('shape.append', {\n source: source,\n shape: shape,\n target: target,\n position: position\n });\n } else {\n return rules.allowed('shape.create', {\n shape: shape,\n target: target,\n position: position\n });\n }\n }\n\n\n /** set drop marker on an element */\n function setMarker(element, marker) {\n\n [ MARKER_ATTACH, MARKER_OK, MARKER_NOT_OK, MARKER_NEW_PARENT ].forEach(function(m) {\n\n if (m === marker) {\n canvas.addMarker(element, m);\n } else {\n canvas.removeMarker(element, m);\n }\n });\n }\n\n\n // visual helpers\n\n function createVisual(shape) {\n var group, preview, visual;\n\n group = svgCreate('g');\n svgAttr(group, styles.cls('djs-drag-group', [ 'no-events' ]));\n\n svgAppend(canvas.getDefaultLayer(), group);\n\n preview = svgCreate('g');\n svgClasses(preview).add('djs-dragger');\n\n svgAppend(group, preview);\n\n translate(preview, shape.width / -2, shape.height / -2);\n\n var visualGroup = svgCreate('g');\n svgClasses(visualGroup).add('djs-visual');\n\n svgAppend(preview, visualGroup);\n\n visual = visualGroup;\n\n // hijack renderer to draw preview\n graphicsFactory.drawShape(visual, shape);\n\n return group;\n }\n\n\n // event handlers\n\n eventBus.on('create.move', function(event) {\n\n var context = event.context,\n hover = event.hover,\n canExecute;\n\n var position = {\n x: event.x,\n y: event.y\n };\n\n canExecute = context.canExecute = hover && canCreate(context.shape, hover, context.source, position);\n\n // ignore hover visually if canExecute is null\n if (hover && canExecute !== null) {\n context.target = hover;\n\n if (canExecute === 'attach') {\n setMarker(hover, MARKER_ATTACH);\n } else {\n setMarker(hover, context.canExecute ? MARKER_NEW_PARENT : MARKER_NOT_OK);\n }\n }\n });\n\n eventBus.on('create.move', LOW_PRIORITY, function(event) {\n\n var context = event.context,\n shape = context.shape,\n visual = context.visual;\n\n // lazy init drag visual once we received the first real\n // drag move event (this allows us to get the proper canvas local coordinates)\n if (!visual) {\n visual = context.visual = createVisual(shape);\n }\n\n translate(visual, event.x, event.y);\n });\n\n\n eventBus.on([ 'create.end', 'create.out', 'create.cleanup' ], function(event) {\n var context = event.context,\n target = context.target;\n\n if (target) {\n setMarker(target, null);\n }\n });\n\n eventBus.on('create.end', function(event) {\n var context = event.context,\n source = context.source,\n shape = context.shape,\n target = context.target,\n canExecute = context.canExecute,\n isAttach,\n position = {\n x: event.x,\n y: event.y\n };\n\n if (!canExecute) {\n return false;\n }\n\n if (source) {\n shape = modeling.appendShape(source, shape, position, target);\n } else {\n isAttach = canExecute === 'attach';\n\n shape = modeling.createShape(shape, position, target, isAttach);\n }\n\n // make sure we provide the actual attached\n // shape with the context so that selection and\n // other components can use it right after the create\n // operation ends\n context.shape = shape;\n });\n\n\n eventBus.on('create.cleanup', function(event) {\n var context = event.context;\n\n if (context.visual) {\n svgRemove(context.visual);\n }\n });\n\n // API\n\n this.start = function(event, shape, source) {\n\n dragging.init(event, 'create', {\n cursor: 'grabbing',\n autoActivate: true,\n data: {\n shape: shape,\n context: {\n shape: shape,\n source: source\n }\n }\n });\n };\n}\n\nCreate.$inject = [ 'eventBus', 'dragging', 'rules', 'modeling', 'canvas', 'styles', 'graphicsFactory' ];\n\nmodule.exports = Create;\n","module.exports = {\n __depends__: [\n require(162),\n require(233),\n require(227)\n ],\n create: [ 'type', require(156) ]\n};\n","'use strict';\n\nvar sortBy = require(310),\n forEach = require(303),\n filter = require(301);\n\nvar AXIS_DIMENSIONS = {\n horizontal: [ 'x', 'width' ],\n vertical: [ 'y', 'height' ]\n};\n\nvar THRESHOLD = 5;\n\n/**\n * Groups and filters elements and then trigger even distribution.\n */\nfunction DistributeElements(modeling) {\n this._modeling = modeling;\n\n this._filters = [];\n\n // register filter for filtering big elements\n this.registerFilter(function(elements, axis, dimension) {\n var elementsSize = 0,\n numOfShapes = 0,\n avgDimension;\n\n forEach(elements, function(element) {\n if (element.waypoints || element.labelTarget) {\n return;\n }\n\n elementsSize += element[dimension];\n\n numOfShapes += 1;\n });\n\n avgDimension = Math.round(elementsSize / numOfShapes);\n\n return filter(elements, function(element) {\n return element[dimension] < (avgDimension + 50);\n });\n });\n\n}\n\nmodule.exports = DistributeElements;\n\nDistributeElements.$inject = [ 'modeling' ];\n\n\n/**\n * Registers filter functions that allow external parties to filter\n * out certain elements.\n *\n * @param {Function} filterFn\n */\nDistributeElements.prototype.registerFilter = function(filterFn) {\n if (typeof filterFn !== 'function') {\n throw new Error('the filter has to be a function');\n }\n\n this._filters.push(filterFn);\n};\n\n/**\n * Distributes the elements with a given orientation\n *\n * @param {Array} elements [description]\n * @param {String} orientation [description]\n */\nDistributeElements.prototype.trigger = function(elements, orientation) {\n var modeling = this._modeling;\n\n var groups,\n distributableElements;\n\n if (elements.length < 3) {\n return;\n }\n\n this._setOrientation(orientation);\n\n distributableElements = this._filterElements(elements);\n\n groups = this._createGroups(distributableElements);\n\n // nothing to distribute\n if (groups.length <= 2) {\n return;\n }\n\n modeling.distributeElements(groups, this._axis, this._dimension);\n\n return groups;\n};\n\n/**\n * Filters the elements with provided filters by external parties\n *\n * @param {Array[Elements]} elements\n *\n * @return {Array[Elements]}\n */\nDistributeElements.prototype._filterElements = function(elements) {\n var filters = this._filters,\n axis = this._axis,\n dimension = this._dimension,\n distributableElements = [].concat(elements);\n\n if (!filters.length) {\n return elements;\n }\n\n forEach(filters, function(filterFn) {\n distributableElements = filterFn(distributableElements, axis, dimension);\n });\n\n return distributableElements;\n};\n\n\n/**\n * Create range (min, max) groups. Also tries to group elements\n * together that share the same range.\n *\n * @example\n * \tvar distributableElements = [\n * \t\t{\n * \t\t\trange: {\n * \t\t\t\tmin: 100,\n * \t\t\t\tmax: 200\n * \t\t\t},\n * \t\t\telements: [ { id: 'shape1', .. }]\n * \t\t}\n * \t]\n *\n * @param {Array} elements\n *\n * @return {Array[Objects]}\n */\nDistributeElements.prototype._createGroups = function(elements) {\n var rangeGroups = [],\n axis = this._axis,\n dimension = this._dimension;\n\n if (!axis) {\n throw new Error('must have a defined \"axis\" and \"dimension\"');\n }\n\n // sort by 'left->right' or 'top->bottom'\n var sortedElements = sortBy(elements, axis);\n\n forEach(sortedElements, function(element, idx) {\n var elementRange = this._findRange(element, axis, dimension),\n range;\n\n var previous = rangeGroups[rangeGroups.length - 1];\n\n if (previous && this._hasIntersection(previous.range, elementRange)) {\n rangeGroups[rangeGroups.length - 1].elements.push(element);\n } else {\n range = { range: elementRange, elements: [ element ] };\n\n rangeGroups.push(range);\n }\n }, this);\n\n return rangeGroups;\n};\n\n\n/**\n * Maps a direction to the according axis and dimension\n *\n * @param {String} direction 'horizontal' or 'vertical'\n */\nDistributeElements.prototype._setOrientation = function(direction) {\n var orientation = AXIS_DIMENSIONS[direction];\n\n this._axis = orientation[0];\n this._dimension = orientation[1];\n};\n\n\n/**\n * Checks if the two ranges intercept each other\n *\n * @param {Object} rangeA {min, max}\n * @param {Object} rangeB {min, max}\n *\n * @return {Boolean}\n */\nDistributeElements.prototype._hasIntersection = function(rangeA, rangeB) {\n return Math.max(rangeA.min, rangeA.max) >= Math.min(rangeB.min, rangeB.max) &&\n Math.min(rangeA.min, rangeA.max) <= Math.max(rangeB.min, rangeB.max);\n};\n\n\n/**\n * Returns the min and max values for an element\n *\n * @param {[type]} element [description]\n * @param {[type]} axis [description]\n * @param {[type]} dimension [description]\n *\n * @return {[type]} [description]\n */\nDistributeElements.prototype._findRange = function(element) {\n var axis = element[this._axis],\n dimension = element[this._dimension];\n\n return {\n min: axis + THRESHOLD,\n max: axis + dimension - THRESHOLD\n };\n};\n","'use strict';\n\nmodule.exports = {\n __init__: [ 'distributeElements' ],\n distributeElements: [ 'type', require(158) ]\n};\n","'use strict';\n\n/* global TouchEvent */\n\nvar round = Math.round;\n\nvar assign = require(431);\n\nvar domEvent = require(450),\n Event = require(267),\n ClickTrap = require(262),\n Cursor = require(265);\n\nvar EventBusEvent = require(125).Event;\n\nvar DRAG_ACTIVE_CLS = 'djs-drag-active';\n\n\nfunction suppressEvent(event) {\n if (event instanceof MouseEvent) {\n Event.stopEvent(event, true);\n } else {\n Event.preventDefault(event);\n }\n}\n\nfunction getLength(point) {\n return Math.sqrt(Math.pow(point.x, 2) + Math.pow(point.y, 2));\n}\n\nfunction substract(p1, p2) {\n return {\n x: p1.x - p2.x,\n y: p1.y - p2.y\n };\n}\n\n/**\n * A helper that fires canvas localized drag events and realizes\n * the general \"drag-and-drop\" look and feel.\n *\n * Calling {@link Dragging#activate} activates dragging on a canvas.\n *\n * It provides the following:\n *\n * * emits life cycle events, namespaced with a prefix assigned\n * during dragging activation\n * * sets and restores the cursor\n * * sets and restores the selection\n * * ensures there can be only one drag operation active at a time\n *\n * Dragging may be canceled manually by calling {@link Dragging#cancel}\n * or by pressing ESC.\n *\n *\n * ## Life-cycle events\n *\n * Dragging can be in three different states, off, initialized\n * and active.\n *\n * (1) off: no dragging operation is in progress\n * (2) initialized: a new drag operation got initialized but not yet\n * started (i.e. because of no initial move)\n * (3) started: dragging is in progress\n *\n * Eventually dragging will be off again after a drag operation has\n * been ended or canceled via user click or ESC key press.\n *\n * To indicate transitions between these states dragging emits generic\n * life-cycle events with the `drag.` prefix _and_ events namespaced\n * to a prefix choosen by a user during drag initialization.\n *\n * The following events are emitted (appropriately prefixed) via\n * the {@link EventBus}.\n *\n * * `init`\n * * `start`\n * * `move`\n * * `end`\n * * `ended` (dragging already in off state)\n * * `cancel` (only if previously started)\n * * `canceled` (dragging already in off state, only if previously started)\n * * `cleanup`\n *\n *\n * @example\n *\n * function MyDragComponent(eventBus, dragging) {\n *\n * eventBus.on('mydrag.start', function(event) {\n * console.log('yes, we start dragging');\n * });\n *\n * eventBus.on('mydrag.move', function(event) {\n * console.log('canvas local coordinates', event.x, event.y, event.dx, event.dy);\n *\n * // local drag data is passed with the event\n * event.context.foo; // \"BAR\"\n *\n * // the original mouse event, too\n * event.originalEvent; // MouseEvent(...)\n * });\n *\n * eventBus.on('element.click', function(event) {\n * dragging.init(event, 'mydrag', {\n * cursor: 'grabbing',\n * data: {\n * context: {\n * foo: \"BAR\"\n * }\n * }\n * });\n * });\n * }\n */\nfunction Dragging(eventBus, canvas, selection) {\n\n var defaultOptions = {\n threshold: 5,\n trapClick: true\n };\n\n // the currently active drag operation\n // dragging is active as soon as this context exists.\n //\n // it is visually _active_ only when a context.active flag is set to true.\n var context;\n\n /* convert a global event into local coordinates */\n function toLocalPoint(globalPosition) {\n\n var viewbox = canvas.viewbox();\n\n var clientRect = canvas._container.getBoundingClientRect();\n\n return {\n x: viewbox.x + round((globalPosition.x - clientRect.left) / viewbox.scale),\n y: viewbox.y + round((globalPosition.y - clientRect.top) / viewbox.scale)\n };\n }\n\n // helpers\n\n function fire(type, dragContext) {\n dragContext = dragContext || context;\n\n var event = assign(new EventBusEvent(), dragContext.payload, dragContext.data);\n\n // default integration\n if (eventBus.fire('drag.' + type, event) === false) {\n return false;\n }\n\n return eventBus.fire(dragContext.prefix + '.' + type, event);\n }\n\n // event listeners\n\n function move(event, activate) {\n var payload = context.payload,\n displacement = context.displacement;\n\n var globalStart = context.globalStart,\n globalCurrent = Event.toPoint(event),\n globalDelta = substract(globalCurrent, globalStart);\n\n var localStart = context.localStart,\n localCurrent = toLocalPoint(globalCurrent),\n localDelta = substract(localCurrent, localStart);\n\n // activate context explicitly or once threshold is reached\n if (!context.active && (activate || getLength(globalDelta) > context.threshold)) {\n\n // fire start event with original\n // starting coordinates\n\n assign(payload, {\n x: localStart.x + displacement.x,\n y: localStart.y + displacement.y,\n dx: 0,\n dy: 0\n }, { originalEvent: event });\n\n if (false === fire('start')) {\n return cancel();\n }\n\n context.active = true;\n\n // unset selection and remember old selection\n // the previous (old) selection will always passed\n // with the event via the event.previousSelection property\n if (!context.keepSelection) {\n payload.previousSelection = selection.get();\n selection.select(null);\n }\n\n // allow custom cursor\n if (context.cursor) {\n Cursor.set(context.cursor);\n }\n\n // indicate dragging via marker on root element\n canvas.addMarker(canvas.getRootElement(), DRAG_ACTIVE_CLS);\n }\n\n suppressEvent(event);\n\n if (context.active) {\n\n // update payload with actual coordinates\n assign(payload, {\n x: localCurrent.x + displacement.x,\n y: localCurrent.y + displacement.y,\n dx: localDelta.x,\n dy: localDelta.y\n }, { originalEvent: event });\n\n // emit move event\n fire('move');\n }\n }\n\n function end(event) {\n var previousContext,\n returnValue = true;\n\n if (context.active) {\n\n if (event) {\n context.payload.originalEvent = event;\n\n // suppress original event (click, ...)\n // because we just ended a drag operation\n suppressEvent(event);\n }\n\n // implementations may stop restoring the\n // original state (selections, ...) by preventing the\n // end events default action\n returnValue = fire('end');\n }\n\n if (returnValue === false) {\n fire('rejected');\n }\n\n previousContext = cleanup(returnValue !== true);\n\n // last event to be fired when all drag operations are done\n // at this point in time no drag operation is in progress anymore\n fire('ended', previousContext);\n }\n\n\n // cancel active drag operation if the user presses\n // the ESC key on the keyboard\n\n function checkCancel(event) {\n\n if (event.which === 27) {\n event.preventDefault();\n\n cancel();\n }\n }\n\n\n // prevent ghost click that might occur after a finished\n // drag and drop session\n\n function trapClickAndEnd(event) {\n\n var untrap;\n\n // trap the click in case we are part of an active\n // drag operation. This will effectively prevent\n // the ghost click that cannot be canceled otherwise.\n if (context.active) {\n untrap = ClickTrap.install();\n setTimeout(untrap, 400);\n }\n\n end(event);\n }\n\n function trapTouch(event) {\n move(event);\n }\n\n // update the drag events hover (djs.model.Base) and hoverGfx (Snap)\n // properties during hover and out and fire {prefix}.hover and {prefix}.out properties\n // respectively\n\n function hover(event) {\n var payload = context.payload;\n\n payload.hoverGfx = event.gfx;\n payload.hover = event.element;\n\n fire('hover');\n }\n\n function out(event) {\n fire('out');\n\n var payload = context.payload;\n\n payload.hoverGfx = null;\n payload.hover = null;\n }\n\n\n // life-cycle methods\n\n function cancel(restore) {\n var previousContext;\n\n if (!context) {\n return;\n }\n\n var wasActive = context.active;\n\n if (wasActive) {\n fire('cancel');\n }\n\n previousContext = cleanup(restore);\n\n if (wasActive) {\n // last event to be fired when all drag operations are done\n // at this point in time no drag operation is in progress anymore\n fire('canceled', previousContext);\n }\n }\n\n function cleanup(restore) {\n var previousContext,\n endDrag;\n\n fire('cleanup');\n\n // reset cursor\n Cursor.unset();\n\n if (context.trapClick) {\n endDrag = trapClickAndEnd;\n } else {\n endDrag = end;\n }\n\n // reset dom listeners\n domEvent.unbind(document, 'mousemove', move);\n\n domEvent.unbind(document, 'mousedown', endDrag, true);\n domEvent.unbind(document, 'mouseup', endDrag, true);\n\n domEvent.unbind(document, 'keyup', checkCancel);\n\n domEvent.unbind(document, 'touchstart', trapTouch, true);\n domEvent.unbind(document, 'touchcancel', cancel, true);\n domEvent.unbind(document, 'touchmove', move, true);\n domEvent.unbind(document, 'touchend', end, true);\n\n eventBus.off('element.hover', hover);\n eventBus.off('element.out', out);\n\n // remove drag marker on root element\n canvas.removeMarker(canvas.getRootElement(), DRAG_ACTIVE_CLS);\n\n // restore selection, unless it has changed\n var previousSelection = context.payload.previousSelection;\n\n if (restore !== false && previousSelection && !selection.get().length) {\n selection.select(previousSelection);\n }\n\n previousContext = context;\n\n context = null;\n\n return previousContext;\n }\n\n /**\n * Initialize a drag operation.\n *\n * If `localPosition` is given, drag events will be emitted\n * relative to it.\n *\n * @param {MouseEvent|TouchEvent} [event]\n * @param {Point} [localPosition] actual diagram local position this drag operation should start at\n * @param {String} prefix\n * @param {Object} [options]\n */\n function init(event, relativeTo, prefix, options) {\n\n // only one drag operation may be active, at a time\n if (context) {\n cancel(false);\n }\n\n if (typeof relativeTo === 'string') {\n options = prefix;\n prefix = relativeTo;\n relativeTo = null;\n }\n\n options = assign({}, defaultOptions, options || {});\n\n var data = options.data || {},\n originalEvent,\n globalStart,\n endDrag;\n\n if (options.trapClick) {\n endDrag = trapClickAndEnd;\n } else {\n endDrag = end;\n }\n\n if (event) {\n originalEvent = Event.getOriginal(event) || event;\n globalStart = Event.toPoint(event);\n\n suppressEvent(event);\n } else {\n originalEvent = null;\n globalStart = { x: 0, y: 0 };\n }\n\n var localStart = toLocalPoint(globalStart);\n\n if (!relativeTo) {\n relativeTo = localStart;\n }\n\n context = assign({\n prefix: prefix,\n data: data,\n payload: {},\n globalStart: globalStart,\n displacement: substract(relativeTo, localStart),\n localStart: localStart\n }, options);\n\n // skip dom registration if trigger\n // is set to manual (during testing)\n if (!options.manual) {\n\n // add dom listeners\n\n // fixes TouchEvent not being available on desktop Firefox\n if (typeof TouchEvent !== 'undefined' && originalEvent instanceof TouchEvent) {\n domEvent.bind(document, 'touchstart', trapTouch, true);\n domEvent.bind(document, 'touchcancel', cancel, true);\n domEvent.bind(document, 'touchmove', move, true);\n domEvent.bind(document, 'touchend', end, true);\n } else {\n // assume we use the mouse to interact per default\n domEvent.bind(document, 'mousemove', move);\n\n domEvent.bind(document, 'mousedown', endDrag, true);\n domEvent.bind(document, 'mouseup', endDrag, true);\n }\n\n domEvent.bind(document, 'keyup', checkCancel);\n\n eventBus.on('element.hover', hover);\n eventBus.on('element.out', out);\n }\n\n fire('init');\n\n if (options.autoActivate) {\n move(event, true);\n }\n }\n\n // cancel on diagram destruction\n eventBus.on('diagram.destroy', cancel);\n\n\n // API\n\n this.init = init;\n this.move = move;\n this.hover = hover;\n this.out = out;\n this.end = end;\n\n this.cancel = cancel;\n\n // for introspection\n\n this.context = function() {\n return context;\n };\n\n this.setOptions = function(options) {\n assign(defaultOptions, options);\n };\n}\n\nDragging.$inject = [ 'eventBus', 'canvas', 'selection' ];\n\nmodule.exports = Dragging;\n","'use strict';\n\nvar domClosest = require(447);\n\nvar Event = require(267);\n\nfunction getGfx(target) {\n var node = domClosest(target, 'svg, .djs-element', true);\n return node;\n}\n\n\n/**\n * Browsers may swallow the hover event if users are to\n * fast with the mouse.\n *\n * @see http://stackoverflow.com/questions/7448468/why-cant-i-reliably-capture-a-mouseout-event\n *\n * The fix implemented in this component ensure that we\n * have a hover state after a successive drag.move event.\n *\n * @param {EventBus} eventBus\n * @param {Dragging} dragging\n * @param {ElementRegistry} elementRegistry\n */\nfunction HoverFix(eventBus, dragging, elementRegistry) {\n\n var self = this;\n\n // we wait for a specific sequence of events before\n // emitting a fake drag.hover event.\n //\n // Event Sequence:\n //\n // drag.start\n // drag.move\n // drag.move >> ensure we are hovering\n //\n eventBus.on('drag.start', function(event) {\n\n eventBus.once('drag.move', function() {\n\n eventBus.once('drag.move', function(event) {\n\n self.ensureHover(event);\n });\n });\n });\n\n /**\n * Make sure we are god damn hovering!\n *\n * @param {Event} dragging event\n */\n this.ensureHover = function(event) {\n\n if (event.hover) {\n return;\n }\n\n var originalEvent = event.originalEvent,\n position,\n target,\n element,\n gfx;\n\n if (!(originalEvent instanceof MouseEvent)) {\n return;\n }\n\n position = Event.toPoint(originalEvent);\n\n // damn expensive operation, ouch!\n target = document.elementFromPoint(position.x, position.y);\n\n gfx = getGfx(target);\n\n if (gfx) {\n element = elementRegistry.get(gfx);\n\n dragging.hover({ element: element, gfx: gfx });\n }\n };\n\n}\n\nHoverFix.$inject = [ 'eventBus', 'dragging', 'elementRegistry' ];\n\nmodule.exports = HoverFix;\n","module.exports = {\n __init__: [\n 'hoverFix'\n ],\n __depends__: [\n require(233)\n ],\n dragging: [ 'type', require(160) ],\n hoverFix: [ 'type', require(161) ]\n};","'use strict';\n\nvar forEach = require(303),\n isArray = require(422);\n\nvar NOT_REGISTERED_ERROR = 'is not a registered action',\n IS_REGISTERED_ERROR = 'is already registered';\n\n\n/**\n * An interface that provides access to modeling actions by decoupling\n * the one who requests the action to be triggered and the trigger itself.\n *\n * It's possible to add new actions by registering them with ´registerAction´ and likewise\n * unregister existing ones with ´unregisterAction´.\n *\n */\nfunction EditorActions(eventBus, commandStack, modeling, selection,\n zoomScroll, copyPaste, canvas, rules, mouseTracking) {\n\n this._actions = {\n undo: function() {\n commandStack.undo();\n },\n redo: function() {\n commandStack.redo();\n },\n copy: function() {\n var selectedElements = selection.get();\n\n copyPaste.copy(selectedElements);\n },\n paste: function() {\n var context = mouseTracking.getHoverContext();\n\n copyPaste.paste(context);\n },\n stepZoom: function(opts) {\n zoomScroll.stepZoom(opts.value);\n },\n zoom: function(opts) {\n canvas.zoom(opts.value);\n },\n removeSelection: function() {\n var selectedElements = selection.get();\n\n if (selectedElements.length) {\n var allowed = rules.allowed('elements.delete', { elements: selectedElements }),\n removableElements;\n\n if (allowed === false) {\n return;\n }\n else if (isArray(allowed)) {\n removableElements = allowed;\n }\n else {\n removableElements = selectedElements;\n }\n\n if (removableElements.length) {\n modeling.removeElements(removableElements.slice());\n }\n }\n },\n moveCanvas: function(opts) {\n var dx = 0,\n dy = 0,\n invertY = opts.invertY,\n speed = opts.speed;\n\n var actualSpeed = speed / Math.min(Math.sqrt(canvas.viewbox().scale), 1);\n\n switch (opts.direction) {\n case 'left': // Left\n dx = actualSpeed;\n break;\n case 'up': // Up\n dy = actualSpeed;\n break;\n case 'right': // Right\n dx = -actualSpeed;\n break;\n case 'down': // Down\n dy = -actualSpeed;\n break;\n }\n\n if (dy && invertY) {\n dy = -dy;\n }\n\n canvas.scroll({ dx: dx, dy: dy });\n }\n };\n}\n\nEditorActions.$inject = [\n 'eventBus',\n 'commandStack',\n 'modeling',\n 'selection',\n 'zoomScroll',\n 'copyPaste',\n 'canvas',\n 'rules',\n 'mouseTracking'\n];\n\nmodule.exports = EditorActions;\n\n\n/**\n * Triggers a registered action\n *\n * @param {String} action\n * @param {Object} opts\n *\n * @return {Unknown} Returns what the registered listener returns\n */\nEditorActions.prototype.trigger = function(action, opts) {\n if (!this._actions[action]) {\n throw error(action, NOT_REGISTERED_ERROR);\n }\n\n return this._actions[action](opts);\n};\n\n\n/**\n * Registers a collections of actions.\n * The key of the object will be the name of the action.\n *\n * @example\n * ´´´\n * var actions = {\n * spaceTool: function() {\n * spaceTool.activateSelection();\n * },\n * lassoTool: function() {\n * lassoTool.activateSelection();\n * }\n * ];\n *\n * editorActions.register(actions);\n *\n * editorActions.isRegistered('spaceTool'); // true\n * ´´´\n *\n * @param {Object} actions\n */\nEditorActions.prototype.register = function(actions, listener) {\n if (typeof actions === 'string') {\n return this._registerAction(actions, listener);\n }\n\n forEach(actions, function(listener, action) {\n this._registerAction(action, listener);\n }, this);\n};\n\n/**\n * Registers a listener to an action key\n *\n * @param {String} action\n * @param {Function} listener\n */\nEditorActions.prototype._registerAction = function(action, listener) {\n if (this.isRegistered(action)) {\n throw error(action, IS_REGISTERED_ERROR);\n }\n\n this._actions[action] = listener;\n};\n\n/**\n * Unregister an existing action\n *\n * @param {String} action\n */\nEditorActions.prototype.unregister = function(action) {\n if (!this.isRegistered(action)) {\n throw error(action, NOT_REGISTERED_ERROR);\n }\n\n this._actions[action] = undefined;\n};\n\n/**\n * Returns the number of actions that are currently registered\n *\n * @return {Number}\n */\nEditorActions.prototype.length = function() {\n return Object.keys(this._actions).length;\n};\n\n/**\n * Checks wether the given action is registered\n *\n * @param {String} action\n *\n * @return {Boolean}\n */\nEditorActions.prototype.isRegistered = function(action) {\n return !!this._actions[action];\n};\n\n\nfunction error(action, message) {\n return new Error(action + ' ' + message);\n}\n","module.exports = {\n __depends__: [\n require(233),\n require(155),\n require(260)\n ],\n __init__: [ 'editorActions' ],\n editorActions: [ 'type', require(163) ]\n};\n","'use strict';\n\nvar MARKER_OK = 'connect-ok',\n MARKER_NOT_OK = 'connect-not-ok';\n\n\nfunction GlobalConnect(eventBus, dragging, connect, canvas, toolManager) {\n var self = this;\n\n this._dragging = dragging;\n\n toolManager.registerTool('global-connect', {\n tool: 'global-connect',\n dragging: 'global-connect.drag'\n });\n\n eventBus.on('global-connect.hover', function(event) {\n var context = event.context,\n startTarget = event.hover;\n\n var canStartConnect = context.canStartConnect = self.canStartConnect(startTarget);\n\n // simply ignore hover\n if (canStartConnect === null) {\n return;\n }\n\n context.startTarget = startTarget;\n\n canvas.addMarker(startTarget, canStartConnect ? MARKER_OK : MARKER_NOT_OK);\n });\n\n\n eventBus.on([ 'global-connect.out', 'global-connect.cleanup' ], function(event) {\n var startTarget = event.context.startTarget,\n canStartConnect = event.context.canStartConnect;\n\n if (startTarget) {\n canvas.removeMarker(startTarget, canStartConnect ? MARKER_OK : MARKER_NOT_OK);\n }\n });\n\n\n eventBus.on([ 'global-connect.ended' ], function(event) {\n var context = event.context,\n startTarget = context.startTarget,\n startPosition = {\n x: event.x,\n y: event.y\n };\n\n var canStartConnect = self.canStartConnect(startTarget);\n\n if (!canStartConnect) {\n return;\n }\n\n eventBus.once('element.out', function() {\n eventBus.once([ 'connect.ended', 'connect.canceled' ], function() {\n eventBus.fire('global-connect.drag.ended');\n });\n\n connect.start(null, startTarget, startPosition);\n });\n\n return false;\n });\n}\n\nGlobalConnect.$inject = [ 'eventBus', 'dragging', 'connect', 'canvas', 'toolManager' ];\n\nmodule.exports = GlobalConnect;\n\n\n/**\n * Initiates tool activity.\n */\nGlobalConnect.prototype.start = function(event) {\n this._dragging.init(event, 'global-connect', {\n trapClick: false,\n data: {\n context: {}\n }\n });\n};\n\n\nGlobalConnect.prototype.toggle = function() {\n if (this.isActive()) {\n this._dragging.cancel();\n } else {\n this.start();\n }\n};\n\nGlobalConnect.prototype.isActive = function() {\n var context = this._dragging.context();\n\n return context && /^global-connect/.test(context.prefix);\n};\n\n\nGlobalConnect.prototype.registerProvider = function(provider) {\n this._provider = provider;\n};\n\n\n/**\n * Check if source shape can initiate connection.\n *\n * @param {Shape} startTarget\n * @return {Boolean}\n */\nGlobalConnect.prototype.canStartConnect = function(startTarget) {\n return this._provider.canStartConnect(startTarget);\n};\n","module.exports = {\n __depends__: [\n require(151),\n require(227),\n require(162),\n require(242)\n ],\n globalConnect: [ 'type', require(165) ]\n};\n","'use strict';\n\nvar hasPrimaryModifier = require(274).hasPrimaryModifier;\n\n\nvar HIGH_PRIORITY = 1500;\nvar HAND_CURSOR = 'grab';\n\nfunction HandTool(eventBus, canvas, dragging, toolManager) {\n this._dragging = dragging;\n\n\n toolManager.registerTool('hand', {\n tool: 'hand',\n dragging: 'hand.move'\n });\n\n eventBus.on('element.mousedown', HIGH_PRIORITY, function(event) {\n if (hasPrimaryModifier(event)) {\n this.activateMove(event.originalEvent);\n\n return false;\n }\n }, this);\n\n\n eventBus.on('hand.end', function(event) {\n var target = event.originalEvent.target;\n\n // only reactive on diagram click\n // on some occasions, event.hover is not set and we have to check if the target is an svg\n if (!event.hover && !(target instanceof SVGElement)) {\n return false;\n }\n\n eventBus.once('hand.ended', function() {\n this.activateMove(event.originalEvent, { reactivate: true });\n }, this);\n\n }, this);\n\n\n eventBus.on('hand.move.move', function(event) {\n var scale = canvas.viewbox().scale;\n\n canvas.scroll({\n dx: event.dx * scale,\n dy: event.dy * scale\n });\n });\n\n eventBus.on('hand.move.end', function(event) {\n var context = event.context,\n reactivate = context.reactivate;\n\n // Don't reactivate if the user is using the keyboard keybinding\n if (!hasPrimaryModifier(event) && reactivate) {\n\n eventBus.once('hand.move.ended', function(event) {\n this.activateHand(event.originalEvent, true, true);\n }, this);\n\n }\n\n return false;\n }, this);\n\n}\n\nHandTool.$inject = [\n 'eventBus',\n 'canvas',\n 'dragging',\n 'toolManager'\n];\n\nmodule.exports = HandTool;\n\n\nHandTool.prototype.activateMove = function(event, autoActivate, context) {\n if (typeof autoActivate === 'object') {\n context = autoActivate;\n autoActivate = false;\n }\n\n this._dragging.init(event, 'hand.move', {\n autoActivate: autoActivate,\n cursor: HAND_CURSOR,\n data: {\n context: context || {}\n }\n });\n};\n\nHandTool.prototype.activateHand = function(event, autoActivate, reactivate) {\n this._dragging.init(event, 'hand', {\n trapClick: false,\n autoActivate: autoActivate,\n cursor: HAND_CURSOR,\n data: {\n context: {\n reactivate: reactivate\n }\n }\n });\n};\n\nHandTool.prototype.toggle = function() {\n if (this.isActive()) {\n this._dragging.cancel();\n } else {\n this.activateHand();\n }\n};\n\nHandTool.prototype.isActive = function() {\n var context = this._dragging.context();\n\n return context && /^hand/.test(context.prefix);\n};\n","'use strict';\n\nmodule.exports = {\n __depends__: [ require(242) ],\n __init__: [ 'handTool' ],\n handTool: [ 'type', require(167) ]\n};\n","'use strict';\n\nvar forEach = require(303),\n domDelegate = require(448);\n\nvar isPrimaryButton = require(274).isPrimaryButton;\n\nvar svgAppend = require(472),\n svgAttr = require(474),\n svgCreate = require(478);\n\nvar domQuery = require(452);\n\nvar renderUtil = require(278);\n\nvar createLine = renderUtil.createLine,\n updateLine = renderUtil.updateLine;\n\nvar LOW_PRIORITY = 500;\n\n/**\n * A plugin that provides interaction events for diagram elements.\n *\n * It emits the following events:\n *\n * * element.hover\n * * element.out\n * * element.click\n * * element.dblclick\n * * element.mousedown\n *\n * Each event is a tuple { element, gfx, originalEvent }.\n *\n * Canceling the event via Event#preventDefault() prevents the original DOM operation.\n *\n * @param {EventBus} eventBus\n */\nfunction InteractionEvents(eventBus, elementRegistry, styles) {\n\n var HIT_STYLE = styles.cls('djs-hit', [ 'no-fill', 'no-border' ], {\n stroke: 'white',\n strokeWidth: 15\n });\n\n /**\n * Fire an interaction event.\n *\n * @param {String} type local event name, e.g. element.click.\n * @param {DOMEvent} event native event\n * @param {djs.model.Base} [element] the diagram element to emit the event on;\n * defaults to the event target\n */\n function fire(type, event, element) {\n\n // only react on left mouse button interactions\n // for interaction events\n if (!isPrimaryButton(event)) {\n return;\n }\n\n var target, gfx, returnValue;\n\n if (!element) {\n target = event.delegateTarget || event.target;\n\n if (target) {\n gfx = target;\n element = elementRegistry.get(gfx);\n }\n } else {\n gfx = elementRegistry.getGraphics(element);\n }\n\n if (!gfx || !element) {\n return;\n }\n\n returnValue = eventBus.fire(type, { element: element, gfx: gfx, originalEvent: event });\n\n if (returnValue === false) {\n event.stopPropagation();\n event.preventDefault();\n }\n }\n\n // TODO(nikku): document this\n var handlers = {};\n\n function mouseHandler(type) {\n\n var fn = handlers[type];\n\n if (!fn) {\n fn = handlers[type] = function(event) {\n fire(type, event);\n };\n }\n\n return fn;\n }\n\n var bindings = {\n mouseover: 'element.hover',\n mouseout: 'element.out',\n click: 'element.click',\n dblclick: 'element.dblclick',\n mousedown: 'element.mousedown',\n mouseup: 'element.mouseup'\n };\n\n\n ///// manual event trigger\n\n /**\n * Trigger an interaction event (based on a native dom event)\n * on the target shape or connection.\n *\n * @param {String} eventName the name of the triggered DOM event\n * @param {MouseEvent} event\n * @param {djs.model.Base} targetElement\n */\n function triggerMouseEvent(eventName, event, targetElement) {\n\n // i.e. element.mousedown...\n var localEventName = bindings[eventName];\n\n if (!localEventName) {\n throw new Error('unmapped DOM event name <' + eventName + '>');\n }\n\n return fire(localEventName, event, targetElement);\n }\n\n\n var elementSelector = 'svg, .djs-element';\n\n ///// event registration\n\n function registerEvent(node, event, localEvent) {\n var handler = mouseHandler(localEvent);\n handler.$delegate = domDelegate.bind(node, elementSelector, event, handler);\n }\n\n function unregisterEvent(node, event, localEvent) {\n domDelegate.unbind(node, event, mouseHandler(localEvent).$delegate);\n }\n\n function registerEvents(svg) {\n forEach(bindings, function(val, key) {\n registerEvent(svg, key, val);\n });\n }\n\n function unregisterEvents(svg) {\n forEach(bindings, function(val, key) {\n unregisterEvent(svg, key, val);\n });\n }\n\n eventBus.on('canvas.destroy', function(event) {\n unregisterEvents(event.svg);\n });\n\n eventBus.on('canvas.init', function(event) {\n registerEvents(event.svg);\n });\n\n\n eventBus.on([ 'shape.added', 'connection.added' ], function(event) {\n var element = event.element,\n gfx = event.gfx,\n hit;\n\n if (element.waypoints) {\n hit = createLine(element.waypoints);\n } else {\n hit = svgCreate('rect');\n svgAttr(hit, {\n x: 0,\n y: 0,\n width: element.width,\n height: element.height\n });\n }\n\n svgAttr(hit, HIT_STYLE);\n\n svgAppend(gfx, hit);\n });\n\n // Update djs-hit on change.\n // A low priortity is necessary, because djs-hit of labels has to be updated\n // after the label bounds have been updated in the renderer.\n eventBus.on('shape.changed', LOW_PRIORITY, function(event) {\n\n var element = event.element,\n gfx = event.gfx,\n hit = domQuery('.djs-hit', gfx);\n\n svgAttr(hit, {\n width: element.width,\n height: element.height\n });\n });\n\n eventBus.on('connection.changed', function(event) {\n\n var element = event.element,\n gfx = event.gfx,\n hit = domQuery('.djs-hit', gfx);\n\n updateLine(hit, element.waypoints);\n });\n\n\n // API\n\n this.fire = fire;\n\n this.triggerMouseEvent = triggerMouseEvent;\n\n this.mouseHandler = mouseHandler;\n\n this.registerEvent = registerEvent;\n this.unregisterEvent = unregisterEvent;\n}\n\n\nInteractionEvents.$inject = [ 'eventBus', 'elementRegistry', 'styles' ];\n\nmodule.exports = InteractionEvents;\n\n\n/**\n * An event indicating that the mouse hovered over an element\n *\n * @event element.hover\n *\n * @type {Object}\n * @property {djs.model.Base} element\n * @property {SVGElement} gfx\n * @property {Event} originalEvent\n */\n\n/**\n * An event indicating that the mouse has left an element\n *\n * @event element.out\n *\n * @type {Object}\n * @property {djs.model.Base} element\n * @property {SVGElement} gfx\n * @property {Event} originalEvent\n */\n\n/**\n * An event indicating that the mouse has clicked an element\n *\n * @event element.click\n *\n * @type {Object}\n * @property {djs.model.Base} element\n * @property {SVGElement} gfx\n * @property {Event} originalEvent\n */\n\n/**\n * An event indicating that the mouse has double clicked an element\n *\n * @event element.dblclick\n *\n * @type {Object}\n * @property {djs.model.Base} element\n * @property {SVGElement} gfx\n * @property {Event} originalEvent\n */\n\n/**\n * An event indicating that the mouse has gone down on an element.\n *\n * @event element.mousedown\n *\n * @type {Object}\n * @property {djs.model.Base} element\n * @property {SVGElement} gfx\n * @property {Event} originalEvent\n */\n\n/**\n * An event indicating that the mouse has gone up on an element.\n *\n * @event element.mouseup\n *\n * @type {Object}\n * @property {djs.model.Base} element\n * @property {SVGElement} gfx\n * @property {Event} originalEvent\n */\n","module.exports = {\n __init__: [ 'interactionEvents' ],\n interactionEvents: [ 'type', require(169) ]\n};","'use strict';\n\nvar domEvent = require(450),\n domMatches = require(451);\n\n/**\n * A keyboard abstraction that may be activated and\n * deactivated by users at will, consuming key events\n * and triggering diagram actions.\n *\n * The implementation fires the following key events that allow\n * other components to hook into key handling:\n *\n * - keyboard.bind\n * - keyboard.unbind\n * - keyboard.init\n * - keyboard.destroy\n *\n * All events contain the fields (node, listeners).\n *\n * A default binding for the keyboard may be specified via the\n * `keyboard.bindTo` configuration option.\n *\n * @param {Config} config\n * @param {EventBus} eventBus\n * @param {EditorActions} editorActions\n */\nfunction Keyboard(config, eventBus, editorActions) {\n var self = this;\n\n this._config = config || {};\n this._eventBus = eventBus;\n this._editorActions = editorActions;\n\n this._listeners = [];\n\n // our key handler is a singleton that passes\n // (keycode, modifiers) to each listener.\n //\n // listeners must indicate that they handled a key event\n // by returning true. This stops the event propagation.\n //\n this._keyHandler = function(event) {\n\n var i, l,\n target = event.target,\n listeners = self._listeners,\n code = event.keyCode || event.charCode || -1;\n\n if (target && (domMatches(target, 'input, textarea') || target.contentEditable === 'true')) {\n return;\n }\n\n for (i = 0; (l = listeners[i]); i++) {\n if (l(code, event)) {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n };\n\n // properly clean dom registrations\n eventBus.on('diagram.destroy', function() {\n self._fire('destroy');\n\n self.unbind();\n self._listeners = null;\n });\n\n eventBus.on('diagram.init', function() {\n self._fire('init');\n\n if (config && config.bindTo) {\n self.bind(config.bindTo);\n }\n });\n\n this._init();\n}\n\nKeyboard.$inject = [\n 'config.keyboard',\n 'eventBus',\n 'editorActions'\n];\n\nmodule.exports = Keyboard;\n\n\nKeyboard.prototype.bind = function(node) {\n // make sure that the keyboard is only bound once to the DOM\n this.unbind();\n\n this._node = node;\n\n // bind key events\n domEvent.bind(node, 'keydown', this._keyHandler, true);\n\n this._fire('bind');\n};\n\nKeyboard.prototype.getBinding = function() {\n return this._node;\n};\n\nKeyboard.prototype.unbind = function() {\n var node = this._node;\n\n if (node) {\n this._fire('unbind');\n\n // unbind key events\n domEvent.unbind(node, 'keydown', this._keyHandler, true);\n }\n\n this._node = null;\n};\n\nKeyboard.prototype._fire = function(event) {\n this._eventBus.fire('keyboard.' + event, { node: this._node, listeners: this._listeners });\n};\n\nKeyboard.prototype._init = function() {\n\n var listeners = this._listeners;\n\n var editorActions = this._editorActions,\n config = this._config;\n\n // init default listeners\n\n // undo\n // (CTRL|CMD) + Z\n function undo(key, modifiers) {\n\n if (isCmd(modifiers) && !isShift(modifiers) && key === 90) {\n editorActions.trigger('undo');\n\n return true;\n }\n }\n\n // redo\n // CTRL + Y\n // CMD + SHIFT + Z\n function redo(key, modifiers) {\n\n if (isCmd(modifiers) && (key === 89 || (key === 90 && isShift(modifiers)))) {\n editorActions.trigger('redo');\n\n return true;\n }\n }\n\n // copy\n // CTRL/CMD + C\n function copy(key, modifiers) {\n\n if (isCmd(modifiers) && (key === 67)) {\n editorActions.trigger('copy');\n\n return true;\n }\n }\n\n // paste\n // CTRL/CMD + V\n function paste(key, modifiers) {\n\n if (isCmd(modifiers) && (key === 86)) {\n editorActions.trigger('paste');\n\n return true;\n }\n }\n\n /**\n * zoom in one step\n * CTRL + +\n *\n * 107 = numpad plus\n * 187 = regular plus\n * 171 = regular plus in Firefox (german keyboard layout)\n * 61 = regular plus in Firefox (US keyboard layout)\n */\n function zoomIn(key, modifiers) {\n\n if ((key === 107 || key === 187 || key === 171 || key === 61) && isCmd(modifiers)) {\n editorActions.trigger('stepZoom', { value: 1 });\n\n return true;\n }\n }\n\n /**\n * zoom out one step\n * CTRL + -\n *\n * 109 = numpad minus\n * 189 = regular minus\n * 173 = regular minus in Firefox (US and german keyboard layout)\n */\n function zoomOut(key, modifiers) {\n\n if ((key === 109 || key === 189 || key === 173) && isCmd(modifiers)) {\n editorActions.trigger('stepZoom', { value: -1 });\n\n return true;\n }\n }\n\n /**\n * zoom to the default level\n * CTRL + 0\n *\n * 96 = numpad zero\n * 48 = regular zero\n */\n function zoomDefault(key, modifiers) {\n\n if ((key === 96 || key === 48) && isCmd(modifiers)) {\n editorActions.trigger('zoom', { value: 1 });\n\n return true;\n }\n }\n\n // delete selected element\n // DEL\n function removeSelection(key, modifiers) {\n\n if (key === 46) {\n editorActions.trigger('removeSelection');\n\n return true;\n }\n }\n\n // move canvas left\n // left arrow\n //\n // 37 = Left\n // 38 = Up\n // 39 = Right\n // 40 = Down\n function moveCanvas(key, modifiers) {\n\n if ([37, 38, 39, 40].indexOf(key) >= 0) {\n\n var opts = {\n invertY: config.invertY,\n speed: (config.speed || 50)\n };\n\n switch (key) {\n case 37: // Left\n opts.direction = 'left';\n break;\n case 38: // Up\n opts.direction = 'up';\n break;\n case 39: // Right\n opts.direction = 'right';\n break;\n case 40: // Down\n opts.direction = 'down';\n break;\n }\n\n editorActions.trigger('moveCanvas', opts);\n\n return true;\n }\n }\n\n listeners.push(undo);\n listeners.push(redo);\n listeners.push(copy);\n listeners.push(paste);\n listeners.push(removeSelection);\n listeners.push(zoomIn);\n listeners.push(zoomOut);\n listeners.push(zoomDefault);\n listeners.push(moveCanvas);\n};\n\n\n/**\n * Add a listener function that is notified with (key, modifiers) whenever\n * the keyboard is bound and the user presses a key.\n *\n * @param {Function} listenerFn\n */\nKeyboard.prototype.addListener = function(listenerFn) {\n this._listeners.push(listenerFn);\n};\n\nKeyboard.prototype.hasModifier = hasModifier;\nKeyboard.prototype.isCmd = isCmd;\nKeyboard.prototype.isShift = isShift;\n\n\nfunction hasModifier(modifiers) {\n return (modifiers.ctrlKey || modifiers.metaKey || modifiers.shiftKey || modifiers.altKey);\n}\n\nfunction isCmd(modifiers) {\n return modifiers.ctrlKey || modifiers.metaKey;\n}\n\nfunction isShift(modifiers) {\n return modifiers.shiftKey;\n}\n","module.exports = {\n __init__: [ 'keyboard' ],\n keyboard: [ 'type', require(171) ]\n};\n","'use strict';\n\nvar forEach = require(303),\n filter = require(301),\n inherits = require(289);\n\nvar LOW_PRIORITY = 250,\n HIGH_PRIORITY = 1400;\n\nvar CommandInterceptor = require(119);\n\n\n/**\n * A handler that makes sure labels are properly moved with\n * their label targets.\n */\nfunction LabelSupport(eventBus, modeling, movePreview) {\n\n CommandInterceptor.call(this, eventBus);\n\n // remove labels from the collection that are being\n // moved with other elements anyway\n eventBus.on('shape.move.start', HIGH_PRIORITY, function(e) {\n\n var context = e.context,\n shapes = context.shapes,\n validatedShapes = context.validatedShapes;\n\n context.shapes = removeLabels(shapes);\n context.validatedShapes = removeLabels(validatedShapes);\n });\n\n\n // add labels to visual's group\n eventBus.on('shape.move.start', LOW_PRIORITY, function(e) {\n\n var context = e.context,\n shapes = context.shapes;\n\n var labels = [];\n\n forEach(shapes, function(element) {\n var label = element.label;\n\n if (label && !label.hidden && context.shapes.indexOf(label) === -1) {\n labels.push(label);\n }\n\n if (element.labelTarget) {\n labels.push(element);\n }\n });\n\n forEach(labels, function(label) {\n movePreview.makeDraggable(context, label, true);\n });\n\n });\n\n // move labels after the other shapes are done moving\n this.postExecuted([ 'elements.move' ], function(e) {\n var context = e.context,\n closure = context.closure,\n enclosedElements = closure.enclosedElements;\n\n // ensure we move all labels with their respective elements\n // if they have not been moved already\n forEach(enclosedElements, function(element) {\n if (element.label && !enclosedElements[element.label.id]) {\n modeling.moveShape(element.label, context.delta, element.parent);\n }\n });\n\n });\n\n}\n\ninherits(LabelSupport, CommandInterceptor);\n\nLabelSupport.$inject = [ 'eventBus', 'modeling', 'movePreview' ];\n\nmodule.exports = LabelSupport;\n\n\n/**\n * Return a filtered list of elements that do not\n * contain attached elements with hosts being part\n * of the selection.\n *\n * @param {Array} elements\n *\n * @return {Array} filtered\n */\nfunction removeLabels(elements) {\n\n return filter(elements, function(element) {\n\n // filter out labels that are move together\n // with their label targets\n return elements.indexOf(element.labelTarget) === -1;\n });\n}\n","module.exports = {\n __depends__: [\n require(206)\n ],\n __init__: [ 'labelSupport'],\n labelSupport: [ 'type', require(173) ]\n};\n","'use strict';\n\nvar values = require(440);\n\nvar getEnclosedElements = require(266).getEnclosedElements;\n\nvar hasSecondaryModifier = require(274).hasSecondaryModifier;\n\nvar svgAppend = require(472),\n svgAttr = require(474),\n svgCreate = require(478),\n svgRemove = require(481);\n\nvar LASSO_TOOL_CURSOR = 'crosshair';\n\n\nfunction LassoTool(eventBus, canvas, dragging, elementRegistry, selection, toolManager) {\n\n this._selection = selection;\n this._dragging = dragging;\n\n var self = this;\n\n // lasso visuals implementation\n\n /**\n * A helper that realizes the selection box visual\n */\n var visuals = {\n\n create: function(context) {\n var container = canvas.getDefaultLayer(),\n frame;\n\n frame = context.frame = svgCreate('rect');\n svgAttr(frame, {\n class: 'djs-lasso-overlay',\n width: 1,\n height: 1,\n x: 0,\n y: 0\n });\n\n svgAppend(container, frame);\n },\n\n update: function(context) {\n var frame = context.frame,\n bbox = context.bbox;\n\n svgAttr(frame, {\n x: bbox.x,\n y: bbox.y,\n width: bbox.width,\n height: bbox.height\n });\n },\n\n remove: function(context) {\n\n if (context.frame) {\n svgRemove(context.frame);\n }\n }\n };\n\n toolManager.registerTool('lasso', {\n tool: 'lasso.selection',\n dragging: 'lasso'\n });\n\n eventBus.on('lasso.selection.end', function(event) {\n var target = event.originalEvent.target;\n\n // only reactive on diagram click\n // on some occasions, event.hover is not set and we have to check if the target is an svg\n if (!event.hover && !(target instanceof SVGElement)) {\n return;\n }\n\n eventBus.once('lasso.selection.ended', function() {\n self.activateLasso(event.originalEvent, true);\n });\n });\n\n // lasso interaction implementation\n\n eventBus.on('lasso.end', function(event) {\n\n var bbox = toBBox(event);\n\n var elements = elementRegistry.filter(function(element) {\n return element;\n });\n\n self.select(elements, bbox);\n });\n\n eventBus.on('lasso.start', function(event) {\n\n var context = event.context;\n\n context.bbox = toBBox(event);\n visuals.create(context);\n });\n\n eventBus.on('lasso.move', function(event) {\n\n var context = event.context;\n\n context.bbox = toBBox(event);\n visuals.update(context);\n });\n\n eventBus.on('lasso.cleanup', function(event) {\n\n var context = event.context;\n\n visuals.remove(context);\n });\n\n\n // event integration\n\n eventBus.on('element.mousedown', 1500, function(event) {\n\n if (hasSecondaryModifier(event)) {\n self.activateLasso(event.originalEvent);\n\n event.stopPropagation();\n }\n });\n}\n\nLassoTool.$inject = [\n 'eventBus',\n 'canvas',\n 'dragging',\n 'elementRegistry',\n 'selection',\n 'toolManager'\n];\n\nmodule.exports = LassoTool;\n\n\nLassoTool.prototype.activateLasso = function(event, autoActivate) {\n\n this._dragging.init(event, 'lasso', {\n autoActivate: autoActivate,\n cursor: LASSO_TOOL_CURSOR,\n data: {\n context: {}\n }\n });\n};\n\nLassoTool.prototype.activateSelection = function(event) {\n\n this._dragging.init(event, 'lasso.selection', {\n trapClick: false,\n cursor: LASSO_TOOL_CURSOR,\n data: {\n context: {}\n }\n });\n};\n\nLassoTool.prototype.select = function(elements, bbox) {\n var selectedElements = getEnclosedElements(elements, bbox);\n\n this._selection.select(values(selectedElements));\n};\n\nLassoTool.prototype.toggle = function() {\n if (this.isActive()) {\n this._dragging.cancel();\n } else {\n this.activateSelection();\n }\n};\n\nLassoTool.prototype.isActive = function() {\n var context = this._dragging.context();\n\n return context && /^lasso/.test(context.prefix);\n};\n\n\n\nfunction toBBox(event) {\n\n var start = {\n\n x: event.x - event.dx,\n y: event.y - event.dy\n };\n\n var end = {\n x: event.x,\n y: event.y\n };\n\n var bbox;\n\n if ((start.x <= end.x && start.y < end.y) ||\n (start.x < end.x && start.y <= end.y)) {\n\n bbox = {\n x: start.x,\n y: start.y,\n width: end.x - start.x,\n height: end.y - start.y\n };\n } else if ((start.x >= end.x && start.y < end.y) ||\n (start.x > end.x && start.y <= end.y)) {\n\n bbox = {\n x: end.x,\n y: start.y,\n width: start.x - end.x,\n height: end.y - start.y\n };\n } else if ((start.x <= end.x && start.y > end.y) ||\n (start.x < end.x && start.y >= end.y)) {\n\n bbox = {\n x: start.x,\n y: end.y,\n width: end.x - start.x,\n height: start.y - end.y\n };\n } else if ((start.x >= end.x && start.y > end.y) ||\n (start.x > end.x && start.y >= end.y)) {\n\n bbox = {\n x: end.x,\n y: end.y,\n width: start.x - end.x,\n height: start.y - end.y\n };\n } else {\n\n bbox = {\n x: end.x,\n y: end.y,\n width: 0,\n height: 0\n };\n }\n return bbox;\n}\n","'use strict';\n\nmodule.exports = {\n __depends__: [ require(242) ],\n __init__: [ 'lassoTool' ],\n lassoTool: [ 'type', require(175) ]\n};\n","'use strict';\n\nvar forEach = require(303);\n\nvar model = require(254);\n\n\n/**\n * The basic modeling entry point.\n *\n * @param {EventBus} eventBus\n * @param {ElementFactory} elementFactory\n * @param {CommandStack} commandStack\n */\nfunction Modeling(eventBus, elementFactory, commandStack) {\n this._eventBus = eventBus;\n this._elementFactory = elementFactory;\n this._commandStack = commandStack;\n\n var self = this;\n\n eventBus.on('diagram.init', function() {\n // register modeling handlers\n self.registerHandlers(commandStack);\n });\n}\n\nModeling.$inject = [ 'eventBus', 'elementFactory', 'commandStack' ];\n\nmodule.exports = Modeling;\n\n\nModeling.prototype.getHandlers = function() {\n return {\n 'shape.append': require(179),\n 'shape.create': require(182),\n 'shape.delete': require(185),\n 'shape.move': require(190),\n 'shape.resize': require(195),\n 'shape.replace': require(194),\n 'shape.toggleCollapse': require(197),\n\n 'spaceTool': require(196),\n\n 'label.create': require(181),\n\n 'connection.create': require(180),\n 'connection.delete': require(183),\n 'connection.move': require(188),\n 'connection.layout': require(187),\n\n 'connection.updateWaypoints': require(199),\n\n 'connection.reconnectStart': require(193),\n 'connection.reconnectEnd': require(193),\n\n 'elements.move': require(189),\n 'elements.delete': require(184),\n\n 'elements.distribute': require(186),\n 'elements.align': require(178),\n\n 'element.updateAttachment': require(198),\n\n 'elements.paste': require(192)\n };\n};\n\n/**\n * Register handlers with the command stack\n *\n * @param {CommandStack} commandStack\n */\nModeling.prototype.registerHandlers = function(commandStack) {\n forEach(this.getHandlers(), function(handler, id) {\n commandStack.registerHandler(id, handler);\n });\n};\n\n\n///// modeling helpers /////////////////////////////////////////\n\nModeling.prototype.moveShape = function(shape, delta, newParent, newParentIndex, hints) {\n\n if (typeof newParentIndex === 'object') {\n hints = newParentIndex;\n newParentIndex = null;\n }\n\n var context = {\n shape: shape,\n delta: delta,\n newParent: newParent,\n newParentIndex: newParentIndex,\n hints: hints || {}\n };\n\n this._commandStack.execute('shape.move', context);\n};\n\n\n/**\n * Update the attachment of the given shape.\n *\n * @param {djs.mode.Base} shape\n * @param {djs.model.Base} [newHost]\n */\nModeling.prototype.updateAttachment = function(shape, newHost) {\n var context = {\n shape: shape,\n newHost: newHost\n };\n\n this._commandStack.execute('element.updateAttachment', context);\n};\n\n/**\n * Move a number of shapes to a new target, either setting it as\n * the new parent or attaching it.\n *\n * @param {Array} shapes\n * @param {Point} delta\n * @param {djs.model.Base} [target]\n * @param {Boolean} [isAttach=false]\n * @param {Object} [hints]\n */\nModeling.prototype.moveElements = function(shapes, delta, target, isAttach, hints) {\n if (typeof isAttach === 'object') {\n hints = isAttach;\n isAttach = undefined;\n }\n\n var newParent = target,\n newHost;\n\n if (isAttach === true) {\n newHost = target;\n newParent = target.parent;\n }\n\n if (isAttach === false) {\n newHost = null;\n }\n\n var context = {\n shapes: shapes,\n delta: delta,\n newParent: newParent,\n newHost: newHost,\n hints: hints || {}\n };\n\n this._commandStack.execute('elements.move', context);\n};\n\nModeling.prototype.moveConnection = function(connection, delta, newParent, newParentIndex, hints) {\n\n if (typeof newParentIndex === 'object') {\n hints = newParentIndex;\n newParentIndex = undefined;\n }\n\n var context = {\n connection: connection,\n delta: delta,\n newParent: newParent,\n newParentIndex: newParentIndex,\n hints: hints || {}\n };\n\n this._commandStack.execute('connection.move', context);\n};\n\n\nModeling.prototype.layoutConnection = function(connection, hints) {\n var context = {\n connection: connection,\n hints: hints || {}\n };\n\n this._commandStack.execute('connection.layout', context);\n};\n\n/**\n * Create connection.\n *\n * @param {djs.model.Base} source\n * @param {djs.model.Base} target\n * @param {Number} [targetIndex]\n * @param {Object|djs.model.Connection} connection\n * @param {djs.model.Base} parent\n * @param {Object} hints\n *\n * @return {djs.model.Connection} the created connection.\n */\nModeling.prototype.createConnection = function(source, target, parentIndex, connection, parent, hints) {\n\n if (typeof parentIndex === 'object') {\n hints = parent;\n parent = connection;\n connection = parentIndex;\n parentIndex = undefined;\n }\n\n connection = this._create('connection', connection);\n\n var context = {\n source: source,\n target: target,\n parent: parent,\n parentIndex: parentIndex,\n connection: connection,\n hints: hints\n };\n\n this._commandStack.execute('connection.create', context);\n\n return context.connection;\n};\n\nModeling.prototype.createShape = function(shape, position, parent, parentIndex, isAttach, hints) {\n\n if (typeof parentIndex !== 'number') {\n hints = isAttach;\n isAttach = parentIndex;\n }\n\n if (typeof isAttach !== 'boolean') {\n hints = isAttach;\n isAttach = false;\n }\n\n shape = this._create('shape', shape);\n\n var context = {\n position: position,\n shape: shape,\n parent: parent,\n parentIndex: parentIndex,\n host: shape.host,\n hints: hints || {}\n };\n\n if (isAttach) {\n context.parent = parent.parent;\n context.host = parent;\n }\n\n this._commandStack.execute('shape.create', context);\n\n return context.shape;\n};\n\n\nModeling.prototype.createLabel = function(labelTarget, position, label, parent) {\n\n label = this._create('label', label);\n\n var context = {\n labelTarget: labelTarget,\n position: position,\n parent: parent || labelTarget.parent,\n shape: label\n };\n\n this._commandStack.execute('label.create', context);\n\n return context.shape;\n};\n\n\nModeling.prototype.appendShape = function(source, shape, position, parent, connection, connectionParent) {\n\n shape = this._create('shape', shape);\n\n var context = {\n source: source,\n position: position,\n parent: parent,\n shape: shape,\n connection: connection,\n connectionParent: connectionParent\n };\n\n this._commandStack.execute('shape.append', context);\n\n return context.shape;\n};\n\n\nModeling.prototype.removeElements = function(elements) {\n var context = {\n elements: elements\n };\n\n this._commandStack.execute('elements.delete', context);\n};\n\n\nModeling.prototype.distributeElements = function(groups, axis, dimension) {\n var context = {\n groups: groups,\n axis: axis,\n dimension: dimension\n };\n\n this._commandStack.execute('elements.distribute', context);\n};\n\n\nModeling.prototype.removeShape = function(shape, hints) {\n var context = {\n shape: shape,\n hints: hints || {}\n };\n\n this._commandStack.execute('shape.delete', context);\n};\n\n\nModeling.prototype.removeConnection = function(connection, hints) {\n var context = {\n connection: connection,\n hints: hints || {}\n };\n\n this._commandStack.execute('connection.delete', context);\n};\n\nModeling.prototype.replaceShape = function(oldShape, newShape, hints) {\n var context = {\n oldShape: oldShape,\n newData: newShape,\n hints: hints || {}\n };\n\n this._commandStack.execute('shape.replace', context);\n\n return context.newShape;\n};\n\nModeling.prototype.pasteElements = function(tree, topParent, position) {\n var context = {\n tree: tree,\n topParent: topParent,\n position: position\n };\n\n this._commandStack.execute('elements.paste', context);\n};\n\nModeling.prototype.alignElements = function(elements, alignment) {\n var context = {\n elements: elements,\n alignment: alignment\n };\n\n this._commandStack.execute('elements.align', context);\n};\n\nModeling.prototype.resizeShape = function(shape, newBounds, minBounds) {\n var context = {\n shape: shape,\n newBounds: newBounds,\n minBounds: minBounds\n };\n\n this._commandStack.execute('shape.resize', context);\n};\n\nModeling.prototype.createSpace = function(movingShapes, resizingShapes, delta, direction) {\n var context = {\n movingShapes: movingShapes,\n resizingShapes: resizingShapes,\n delta: delta,\n direction: direction\n };\n\n this._commandStack.execute('spaceTool', context);\n};\n\nModeling.prototype.updateWaypoints = function(connection, newWaypoints, hints) {\n var context = {\n connection: connection,\n newWaypoints: newWaypoints,\n hints: hints || {}\n };\n\n this._commandStack.execute('connection.updateWaypoints', context);\n};\n\nModeling.prototype.reconnectStart = function(connection, newSource, dockingOrPoints) {\n var context = {\n connection: connection,\n newSource: newSource,\n dockingOrPoints: dockingOrPoints\n };\n\n this._commandStack.execute('connection.reconnectStart', context);\n};\n\nModeling.prototype.reconnectEnd = function(connection, newTarget, dockingOrPoints) {\n var context = {\n connection: connection,\n newTarget: newTarget,\n dockingOrPoints: dockingOrPoints\n };\n\n this._commandStack.execute('connection.reconnectEnd', context);\n};\n\nModeling.prototype.connect = function(source, target, attrs, hints) {\n return this.createConnection(source, target, attrs || {}, source.parent, hints);\n};\n\nModeling.prototype._create = function(type, attrs) {\n if (attrs instanceof model.Base) {\n return attrs;\n } else {\n return this._elementFactory.create(type, attrs);\n }\n};\n\nModeling.prototype.toggleCollapse = function(shape, hints) {\n var context = {\n shape: shape,\n hints: hints || {}\n };\n\n this._commandStack.execute('shape.toggleCollapse', context);\n};\n","'use strict';\n\nvar forEach = require(303);\n\n/**\n * A handler that align elements in a certain way.\n *\n */\nfunction AlignElements(modeling, canvas) {\n this._modeling = modeling;\n this._canvas = canvas;\n}\n\nAlignElements.$inject = [ 'modeling', 'canvas' ];\n\nmodule.exports = AlignElements;\n\n\nAlignElements.prototype.preExecute = function(context) {\n var modeling = this._modeling;\n\n var elements = context.elements,\n alignment = context.alignment;\n\n\n forEach(elements, function(element) {\n var delta = {\n x: 0,\n y: 0\n };\n\n if (alignment.left) {\n delta.x = alignment.left - element.x;\n\n } else if (alignment.right) {\n delta.x = (alignment.right - element.width) - element.x;\n\n } else if (alignment.center) {\n delta.x = (alignment.center - Math.round(element.width / 2)) - element.x;\n\n } else if (alignment.top) {\n delta.y = alignment.top - element.y;\n\n } else if (alignment.bottom) {\n delta.y = (alignment.bottom - element.height) - element.y;\n\n } else if (alignment.middle) {\n delta.y = (alignment.middle - Math.round(element.height / 2)) - element.y;\n }\n\n modeling.moveElements([ element ], delta, element.parent);\n });\n};\n\nAlignElements.prototype.postExecute = function(context) {\n\n};\n","'use strict';\n\nvar any = require(299);\n\nvar inherits = require(289);\n\n\n/**\n * A handler that implements reversible appending of shapes\n * to a source shape.\n *\n * @param {canvas} Canvas\n * @param {elementFactory} ElementFactory\n * @param {modeling} Modeling\n */\nfunction AppendShapeHandler(modeling) {\n this._modeling = modeling;\n}\n\ninherits(AppendShapeHandler, require(191));\n\n\nAppendShapeHandler.$inject = [ 'modeling' ];\n\nmodule.exports = AppendShapeHandler;\n\n\n////// api /////////////////////////////////////////////\n\n/**\n * Creates a new shape\n *\n * @param {Object} context\n * @param {ElementDescriptor} context.shape the new shape\n * @param {ElementDescriptor} context.source the source object\n * @param {ElementDescriptor} context.parent the parent object\n * @param {Point} context.position position of the new element\n */\nAppendShapeHandler.prototype.preExecute = function(context) {\n\n if (!context.source) {\n throw new Error('source required');\n }\n\n var parent = context.parent || context.source.parent,\n shape = this._modeling.createShape(context.shape, context.position, parent);\n\n context.shape = shape;\n};\n\nAppendShapeHandler.prototype.postExecute = function(context) {\n var parent = context.connectionParent || context.shape.parent;\n\n if (!existsConnection(context.source, context.shape)) {\n\n // create connection\n this._modeling.connect(context.source, context.shape, context.connection, parent);\n }\n};\n\n\nfunction existsConnection(source, target) {\n return any(source.outgoing, function(c) {\n return c.target === target;\n });\n}","'use strict';\n\n\nfunction CreateConnectionHandler(canvas, layouter) {\n this._canvas = canvas;\n this._layouter = layouter;\n}\n\nCreateConnectionHandler.$inject = [ 'canvas', 'layouter' ];\n\nmodule.exports = CreateConnectionHandler;\n\n\n\n////// api /////////////////////////////////////////\n\n/**\n * Appends a shape to a target shape\n *\n * @param {Object} context\n * @param {djs.element.Base} context.source the source object\n * @param {djs.element.Base} context.target the parent object\n * @param {Point} context.position position of the new element\n */\nCreateConnectionHandler.prototype.execute = function(context) {\n\n var connection = context.connection,\n source = context.source,\n target = context.target,\n parent = context.parent,\n parentIndex = context.parentIndex,\n hints = context.hints;\n\n if (!source || !target) {\n throw new Error('source and target required');\n }\n\n if (!parent) {\n throw new Error('parent required');\n }\n\n connection.source = source;\n connection.target = target;\n\n if (!connection.waypoints) {\n connection.waypoints = this._layouter.layoutConnection(connection, hints);\n }\n\n // add connection\n this._canvas.addConnection(connection, parent, parentIndex);\n\n return connection;\n};\n\nCreateConnectionHandler.prototype.revert = function(context) {\n var connection = context.connection;\n\n this._canvas.removeConnection(connection);\n\n connection.source = null;\n connection.target = null;\n};","'use strict';\n\nvar inherits = require(289);\n\nvar CreateShapeHandler = require(182);\n\n\n/**\n * A handler that attaches a label to a given target shape.\n *\n * @param {canvas} Canvas\n */\nfunction CreateLabelHandler(canvas) {\n CreateShapeHandler.call(this, canvas);\n}\n\ninherits(CreateLabelHandler, CreateShapeHandler);\n\nCreateLabelHandler.$inject = [ 'canvas' ];\n\nmodule.exports = CreateLabelHandler;\n\n\n\n////// api /////////////////////////////////////////\n\n\nvar originalExecute = CreateShapeHandler.prototype.execute;\n\n/**\n * Appends a label to a target shape.\n *\n * @method CreateLabelHandler#execute\n *\n * @param {Object} context\n * @param {ElementDescriptor} context.target the element the label is attached to\n * @param {ElementDescriptor} context.parent the parent object\n * @param {Point} context.position position of the new element\n */\nCreateLabelHandler.prototype.execute = function(context) {\n\n var label = context.shape;\n\n ensureValidDimensions(label);\n\n label.labelTarget = context.labelTarget;\n\n return originalExecute.call(this, context);\n};\n\nvar originalRevert = CreateShapeHandler.prototype.revert;\n\n/**\n * Undo append by removing the shape\n */\nCreateLabelHandler.prototype.revert = function(context) {\n context.shape.labelTarget = null;\n\n return originalRevert.call(this, context);\n};\n\n\n////// helpers /////////////////////////////////////////\n\nfunction ensureValidDimensions(label) {\n // make sure a label has valid { width, height } dimensions\n [ 'width', 'height' ].forEach(function(prop) {\n if (typeof label[prop] === 'undefined') {\n label[prop] = 0;\n }\n });\n}","'use strict';\n\nvar assign = require(431);\n\nvar round = Math.round;\n\n\n/**\n * A handler that implements reversible addition of shapes.\n *\n * @param {canvas} Canvas\n */\nfunction CreateShapeHandler(canvas) {\n this._canvas = canvas;\n}\n\nCreateShapeHandler.$inject = [ 'canvas' ];\n\nmodule.exports = CreateShapeHandler;\n\n\n\n////// api /////////////////////////////////////////\n\n\n/**\n * Appends a shape to a target shape\n *\n * @param {Object} context\n * @param {djs.model.Base} context.parent the parent object\n * @param {Point} context.position position of the new element\n */\nCreateShapeHandler.prototype.execute = function(context) {\n\n var shape = context.shape,\n positionOrBounds = context.position,\n parent = context.parent,\n parentIndex = context.parentIndex;\n\n if (!parent) {\n throw new Error('parent required');\n }\n\n if (!positionOrBounds) {\n throw new Error('position required');\n }\n\n // (1) add at event center position _or_ at given bounds\n if (positionOrBounds.width !== undefined) {\n assign(shape, positionOrBounds);\n } else {\n assign(shape, {\n x: positionOrBounds.x - round(shape.width / 2),\n y: positionOrBounds.y - round(shape.height / 2)\n });\n }\n\n // (2) add to canvas\n this._canvas.addShape(shape, parent, parentIndex);\n\n return shape;\n};\n\n\n/**\n * Undo append by removing the shape\n */\nCreateShapeHandler.prototype.revert = function(context) {\n\n // (3) remove form canvas\n this._canvas.removeShape(context.shape);\n};","'use strict';\n\nvar Collections = require(263);\n\n\n/**\n * A handler that implements reversible deletion of Connections.\n *\n */\nfunction DeleteConnectionHandler(canvas, modeling) {\n this._canvas = canvas;\n this._modeling = modeling;\n}\n\nDeleteConnectionHandler.$inject = [ 'canvas', 'modeling' ];\n\nmodule.exports = DeleteConnectionHandler;\n\n\n/**\n * - Remove attached label\n */\nDeleteConnectionHandler.prototype.preExecute = function(context) {\n\n var connection = context.connection;\n\n // Remove label\n if (connection.label) {\n this._modeling.removeShape(connection.label);\n }\n};\n\nDeleteConnectionHandler.prototype.execute = function(context) {\n\n var connection = context.connection,\n parent = connection.parent;\n\n context.parent = parent;\n context.parentIndex = Collections.indexOf(parent.children, connection);\n\n context.source = connection.source;\n context.target = connection.target;\n\n this._canvas.removeConnection(connection);\n\n connection.source = null;\n connection.target = null;\n connection.label = null;\n\n return connection;\n};\n\n/**\n * Command revert implementation.\n */\nDeleteConnectionHandler.prototype.revert = function(context) {\n\n var connection = context.connection,\n parent = context.parent,\n parentIndex = context.parentIndex;\n\n connection.source = context.source;\n connection.target = context.target;\n\n // restore previous location in old parent\n Collections.add(parent.children, connection, parentIndex);\n\n this._canvas.addConnection(connection, parent);\n\n return connection;\n};\n","'use strict';\n\nvar forEach = require(303),\n inherits = require(289);\n\n\nfunction DeleteElementsHandler(modeling, elementRegistry) {\n this._modeling = modeling;\n this._elementRegistry = elementRegistry;\n}\n\ninherits(DeleteElementsHandler, require(191));\n\nDeleteElementsHandler.$inject = [ 'modeling', 'elementRegistry' ];\n\nmodule.exports = DeleteElementsHandler;\n\n\nDeleteElementsHandler.prototype.postExecute = function(context) {\n\n var modeling = this._modeling,\n elementRegistry = this._elementRegistry,\n elements = context.elements;\n\n forEach(elements, function(element) {\n\n // element may have been removed with previous\n // remove operations already (e.g. in case of nesting)\n if (!elementRegistry.get(element.id)) {\n return;\n }\n\n if (element.waypoints) {\n modeling.removeConnection(element);\n } else {\n modeling.removeShape(element);\n }\n });\n};","'use strict';\n\nvar Collections = require(263);\n\nvar saveClear = require(277).saveClear;\n\n\n/**\n * A handler that implements reversible deletion of shapes.\n *\n */\nfunction DeleteShapeHandler(canvas, modeling) {\n this._canvas = canvas;\n this._modeling = modeling;\n}\n\nDeleteShapeHandler.$inject = [ 'canvas', 'modeling' ];\n\nmodule.exports = DeleteShapeHandler;\n\n\n/**\n * - Remove connections\n * - Remove all direct children\n */\nDeleteShapeHandler.prototype.preExecute = function(context) {\n\n var modeling = this._modeling;\n\n var shape = context.shape,\n label = shape.label;\n\n // Clean up on removeShape(label)\n if (shape.labelTarget) {\n context.labelTarget = shape.labelTarget;\n shape.labelTarget = null;\n }\n\n // Remove label\n if (label) {\n this._modeling.removeShape(label, { nested: true });\n }\n\n // remove connections\n saveClear(shape.incoming, function(connection) {\n // To make sure that the connection isn't removed twice\n // For example if a container is removed\n modeling.removeConnection(connection, { nested: true });\n });\n\n saveClear(shape.outgoing, function(connection) {\n modeling.removeConnection(connection, { nested: true });\n });\n\n // remove child shapes and connections\n saveClear(shape.children, function(child) {\n if (isConnection(child)) {\n modeling.removeConnection(child, { nested: true });\n } else {\n modeling.removeShape(child, { nested: true });\n }\n });\n};\n\n/**\n * Remove shape and remember the parent\n */\nDeleteShapeHandler.prototype.execute = function(context) {\n var canvas = this._canvas;\n\n var shape = context.shape,\n oldParent = shape.parent;\n\n context.oldParent = oldParent;\n context.oldParentIndex = Collections.indexOf(oldParent.children, shape);\n\n shape.label = null;\n\n canvas.removeShape(shape);\n\n return shape;\n};\n\n\n/**\n * Command revert implementation\n */\nDeleteShapeHandler.prototype.revert = function(context) {\n\n var canvas = this._canvas;\n\n var shape = context.shape,\n oldParent = context.oldParent,\n oldParentIndex = context.oldParentIndex,\n labelTarget = context.labelTarget;\n\n // restore previous location in old oldParent\n Collections.add(oldParent.children, shape, oldParentIndex);\n\n if (labelTarget) {\n labelTarget.label = shape;\n }\n\n canvas.addShape(shape, oldParent);\n\n return shape;\n};\n\nfunction isConnection(element) {\n return element.waypoints;\n}\n","'use strict';\n\nvar forEach = require(303),\n sortBy = require(310);\n\n/**\n * A handler that distributes elements evenly.\n */\nfunction DistributeElements(modeling) {\n this._modeling = modeling;\n}\n\nDistributeElements.$inject = [ 'modeling' ];\n\nmodule.exports = DistributeElements;\n\nvar OFF_AXIS = {\n x: 'y',\n y: 'x'\n};\n\nDistributeElements.prototype.preExecute = function(context) {\n var modeling = this._modeling;\n\n var groups = context.groups,\n axis = context.axis,\n dimension = context.dimension;\n\n function updateRange(group, element) {\n group.range.min = Math.min(element[axis], group.range.min);\n group.range.max = Math.max(element[axis] + element[dimension], group.range.max);\n }\n\n function center(element) {\n return element[axis] + element[dimension] / 2;\n }\n\n function lastIdx(arr) {\n return arr.length - 1;\n }\n\n function rangeDiff(range) {\n return range.max - range.min;\n }\n\n function centerElement(refCenter, element) {\n var delta = { y: 0 };\n\n delta[axis] = refCenter - center(element);\n\n if (delta[axis]) {\n\n delta[OFF_AXIS[axis]] = 0;\n\n modeling.moveElements([ element ], delta, element.parent);\n }\n }\n\n var firstGroup = groups[0],\n lastGroupIdx = lastIdx(groups),\n lastGroup = groups[ lastGroupIdx ];\n\n var margin,\n spaceInBetween,\n groupsSize = 0; // the size of each range\n\n forEach(groups, function(group, idx) {\n var sortedElements,\n refElem,\n refCenter;\n\n if (group.elements.length < 2) {\n if (idx && idx !== groups.length - 1) {\n updateRange(group, group.elements[0]);\n\n groupsSize += rangeDiff(group.range);\n }\n return;\n }\n\n sortedElements = sortBy(group.elements, axis);\n\n refElem = sortedElements[0];\n\n if (idx === lastGroupIdx) {\n refElem = sortedElements[lastIdx(sortedElements)];\n }\n\n refCenter = center(refElem);\n\n // wanna update the ranges after the shapes have been centered\n group.range = null;\n\n forEach(sortedElements, function(element) {\n\n centerElement(refCenter, element);\n\n if (group.range === null) {\n group.range = {\n min: element[axis],\n max: element[axis] + element[dimension]\n };\n\n return;\n }\n\n // update group's range after centering the range elements\n updateRange(group, element);\n });\n\n if (idx && idx !== groups.length - 1) {\n groupsSize += rangeDiff(group.range);\n }\n });\n\n spaceInBetween = Math.abs(lastGroup.range.min - firstGroup.range.max);\n\n margin = Math.round((spaceInBetween - groupsSize) / (groups.length - 1));\n\n if (margin < groups.length - 1) {\n return;\n }\n\n forEach(groups, function(group, groupIdx) {\n var delta = {},\n prevGroup;\n\n if (group === firstGroup || group === lastGroup) {\n return;\n }\n\n prevGroup = groups[groupIdx - 1];\n\n group.range.max = 0;\n\n forEach(group.elements, function(element, idx) {\n delta[OFF_AXIS[axis]] = 0;\n delta[axis] = (prevGroup.range.max - element[axis]) + margin;\n\n if (group.range.min !== element[axis]) {\n delta[axis] += element[axis] - group.range.min;\n }\n\n if (delta[axis]) {\n modeling.moveElements([ element ], delta, element.parent);\n }\n\n group.range.max = Math.max(element[axis] + element[dimension], idx ? group.range.max : 0);\n });\n });\n};\n\nDistributeElements.prototype.postExecute = function(context) {\n\n};\n","'use strict';\n\nvar assign = require(431);\n\n\n/**\n * A handler that implements reversible moving of shapes.\n */\nfunction LayoutConnectionHandler(layouter, canvas) {\n this._layouter = layouter;\n this._canvas = canvas;\n}\n\nLayoutConnectionHandler.$inject = [ 'layouter', 'canvas' ];\n\nmodule.exports = LayoutConnectionHandler;\n\nLayoutConnectionHandler.prototype.execute = function(context) {\n\n var connection = context.connection;\n\n var oldWaypoints = connection.waypoints;\n\n assign(context, {\n oldWaypoints: oldWaypoints\n });\n\n connection.waypoints = this._layouter.layoutConnection(connection, context.hints);\n\n return connection;\n};\n\nLayoutConnectionHandler.prototype.revert = function(context) {\n\n var connection = context.connection;\n\n connection.waypoints = context.oldWaypoints;\n\n return connection;\n};\n","'use strict';\n\nvar forEach = require(303);\n\nvar Collections = require(263);\n\n\n/**\n * A handler that implements reversible moving of connections.\n *\n * The handler differs from the layout connection handler in a sense\n * that it preserves the connection layout.\n */\nfunction MoveConnectionHandler() { }\n\nmodule.exports = MoveConnectionHandler;\n\n\nMoveConnectionHandler.prototype.execute = function(context) {\n\n var connection = context.connection,\n delta = context.delta;\n\n var newParent = context.newParent || connection.parent,\n newParentIndex = context.newParentIndex,\n oldParent = connection.parent;\n\n // save old parent in context\n context.oldParent = oldParent;\n context.oldParentIndex = Collections.remove(oldParent.children, connection);\n\n // add to new parent at position\n Collections.add(newParent.children, connection, newParentIndex);\n\n // update parent\n connection.parent = newParent;\n\n // update waypoint positions\n forEach(connection.waypoints, function(p) {\n p.x += delta.x;\n p.y += delta.y;\n\n if (p.original) {\n p.original.x += delta.x;\n p.original.y += delta.y;\n }\n });\n\n return connection;\n};\n\nMoveConnectionHandler.prototype.revert = function(context) {\n\n var connection = context.connection,\n newParent = connection.parent,\n oldParent = context.oldParent,\n oldParentIndex = context.oldParentIndex,\n delta = context.delta;\n\n // remove from newParent\n Collections.remove(newParent.children, connection);\n\n // restore previous location in old parent\n Collections.add(oldParent.children, connection, oldParentIndex);\n\n // restore parent\n connection.parent = oldParent;\n\n // revert to old waypoint positions\n forEach(connection.waypoints, function(p) {\n p.x -= delta.x;\n p.y -= delta.y;\n\n if (p.original) {\n p.original.x -= delta.x;\n p.original.y -= delta.y;\n }\n });\n\n return connection;\n};","'use strict';\n\nvar MoveHelper = require(201);\n\n\n/**\n * A handler that implements reversible moving of shapes.\n */\nfunction MoveElementsHandler(modeling) {\n this._helper = new MoveHelper(modeling);\n}\n\nMoveElementsHandler.$inject = [ 'modeling' ];\n\nmodule.exports = MoveElementsHandler;\n\nMoveElementsHandler.prototype.preExecute = function(context) {\n context.closure = this._helper.getClosure(context.shapes);\n};\n\nMoveElementsHandler.prototype.postExecute = function(context) {\n\n var hints = context.hints,\n primaryShape;\n\n if (hints && hints.primaryShape) {\n primaryShape = hints.primaryShape;\n hints.oldParent = primaryShape.parent;\n }\n\n this._helper.moveClosure(context.closure, context.delta, context.newParent, context.newHost, primaryShape);\n};\n\n\nMoveElementsHandler.prototype.execute = function(context) { };\nMoveElementsHandler.prototype.revert = function(context) { };\n","'use strict';\n\nvar assign = require(431),\n forEach = require(303),\n pick = require(438);\n\nvar MoveHelper = require(201),\n Collections = require(263);\n\nvar getMovedSourceAnchor = require(200).getMovedSourceAnchor,\n getMovedTargetAnchor = require(200).getMovedTargetAnchor;\n\n\n/**\n * A handler that implements reversible moving of shapes.\n */\nfunction MoveShapeHandler(modeling) {\n this._modeling = modeling;\n\n this._helper = new MoveHelper(modeling);\n}\n\nMoveShapeHandler.$inject = [ 'modeling' ];\n\nmodule.exports = MoveShapeHandler;\n\n\nMoveShapeHandler.prototype.execute = function(context) {\n\n var shape = context.shape,\n delta = context.delta,\n newParent = context.newParent || shape.parent,\n newParentIndex = context.newParentIndex,\n oldParent = shape.parent;\n\n context.oldBounds = pick(shape, [ 'x', 'y', 'width', 'height']);\n\n // save old parent in context\n context.oldParent = oldParent;\n context.oldParentIndex = Collections.remove(oldParent.children, shape);\n\n // add to new parent at position\n Collections.add(newParent.children, shape, newParentIndex);\n\n // update shape parent + position\n assign(shape, {\n parent: newParent,\n x: shape.x + delta.x,\n y: shape.y + delta.y\n });\n\n return shape;\n};\n\nMoveShapeHandler.prototype.postExecute = function(context) {\n\n var shape = context.shape,\n delta = context.delta,\n hints = context.hints;\n\n var modeling = this._modeling;\n\n if (hints.layout !== false) {\n\n forEach(shape.incoming, function(c) {\n modeling.layoutConnection(c, {\n connectionEnd: getMovedTargetAnchor(c, shape, delta)\n });\n });\n\n forEach(shape.outgoing, function(c) {\n modeling.layoutConnection(c, {\n connectionStart: getMovedSourceAnchor(c, shape, delta)\n });\n });\n }\n\n if (hints.recurse !== false) {\n this.moveChildren(context);\n }\n};\n\nMoveShapeHandler.prototype.revert = function(context) {\n\n var shape = context.shape,\n oldParent = context.oldParent,\n oldParentIndex = context.oldParentIndex,\n delta = context.delta;\n\n // restore previous location in old parent\n Collections.add(oldParent.children, shape, oldParentIndex);\n\n // revert to old position and parent\n assign(shape, {\n parent: oldParent,\n x: shape.x - delta.x,\n y: shape.y - delta.y\n });\n\n return shape;\n};\n\nMoveShapeHandler.prototype.moveChildren = function(context) {\n\n var delta = context.delta,\n shape = context.shape;\n\n this._helper.moveRecursive(shape.children, delta, null);\n};\n\nMoveShapeHandler.prototype.getNewParent = function(context) {\n return context.newParent || context.shape.parent;\n};\n","'use strict';\n\nfunction NoopHandler() {}\n\nmodule.exports = NoopHandler;\n\nNoopHandler.prototype.execute = function() {};\nNoopHandler.prototype.revert = function() {};","'use strict';\n\nvar forEach = require(303),\n map = require(305),\n sortBy = require(310),\n clone = require(420);\n\nvar inherits = require(289);\n\n\n\nfunction removeProperties(element, properties) {\n forEach(properties, function(prop) {\n if (element[prop]) {\n delete element[prop];\n }\n });\n}\n\n/**\n * A handler that implements pasting of elements onto the diagram.\n *\n * @param {eventBus} EventBus\n * @param {canvas} Canvas\n * @param {selection} Selection\n * @param {elementFactory} ElementFactory\n * @param {modeling} Modeling\n * @param {rules} Rules\n */\nfunction PasteHandler(eventBus, canvas, selection, elementFactory, modeling, rules) {\n this._eventBus = eventBus;\n this._canvas = canvas;\n this._selection = selection;\n this._elementFactory = elementFactory;\n this._modeling = modeling;\n this._rules = rules;\n}\n\ninherits(PasteHandler, require(191));\n\n\nPasteHandler.$inject = [\n 'eventBus',\n 'canvas',\n 'selection',\n 'elementFactory',\n 'modeling',\n 'rules'\n];\n\nmodule.exports = PasteHandler;\n\n\n////// api /////////////////////////////////////////////\n\n/**\n * Creates a new shape\n *\n * @param {Object} context\n * @param {Object} context.tree the new shape\n * @param {Element} context.topParent the paste target\n */\nPasteHandler.prototype.preExecute = function(context) {\n var eventBus = this._eventBus;\n\n var tree = context.tree,\n topParent = context.topParent,\n position = context.position;\n\n tree.createdElements = {};\n\n tree.labels = [];\n\n forEach(tree, function(elements, depthStr) {\n var depth = parseInt(depthStr, 10);\n\n if (isNaN(depth)) {\n return;\n }\n\n // set the parent on the top level elements\n if (!depth) {\n elements = map(elements, function(descriptor) {\n descriptor.parent = topParent;\n\n return descriptor;\n });\n }\n\n // Order by priority for element creation\n elements = sortBy(elements, 'priority');\n\n forEach(elements, function(descriptor) {\n var id = descriptor.id,\n parent = descriptor.parent,\n isAttach = false,\n hints,\n newPosition;\n\n var element = clone(descriptor);\n\n if (depth) {\n element.parent = this._getCreatedElement(parent, tree);\n }\n\n // this happens when shapes have not been created due to rules\n if (!parent) {\n return;\n }\n\n eventBus.fire('element.paste', {\n createdElements: tree.createdElements,\n descriptor: element\n });\n\n // in case the parent changed during 'element.paste'\n parent = element.parent;\n\n if (element.waypoints) {\n element = this._createConnection(element, parent, position, tree);\n\n if (element) {\n tree.createdElements[id] = {\n element: element,\n descriptor: descriptor\n };\n }\n\n return;\n }\n\n // supply not-root information as hint\n if (element.parent !== topParent) {\n hints = { root: false };\n }\n\n // set host\n if (element.host) {\n isAttach = true;\n\n parent = this._getCreatedElement(element.host, tree);\n }\n\n // handle labels\n if (element.labelTarget) {\n return tree.labels.push(element);\n }\n\n newPosition = {\n x: Math.round(position.x + element.delta.x + (element.width / 2)),\n y: Math.round(position.y + element.delta.y + (element.height / 2))\n };\n\n removeProperties(element, [ 'id', 'parent', 'delta', 'host', 'priority' ]);\n\n element = this._createShape(element, parent, newPosition, isAttach, hints);\n\n if (element) {\n tree.createdElements[id] = {\n element: element,\n descriptor: descriptor\n };\n }\n }, this);\n }, this);\n};\n\n// move label's to their relative position\nPasteHandler.prototype.postExecute = function(context) {\n var modeling = this._modeling,\n selection = this._selection;\n\n var tree = context.tree,\n labels = tree.labels,\n topLevelElements = [];\n\n forEach(labels, function(labelDescriptor) {\n var labelTarget = this._getCreatedElement(labelDescriptor.labelTarget, tree),\n label, labelTargetPos, newPosition;\n\n if (!labelTarget) {\n return;\n }\n\n label = labelTarget.label;\n\n if (!label) {\n return;\n }\n\n labelTargetPos = {\n x: labelTarget.x,\n y: labelTarget.y\n };\n\n if (labelTarget.waypoints) {\n labelTargetPos = labelTarget.waypoints[0];\n }\n\n newPosition = {\n x: Math.round((labelTargetPos.x - label.x) + labelDescriptor.delta.x),\n y: Math.round((labelTargetPos.y - label.y) + labelDescriptor.delta.y)\n };\n\n modeling.moveShape(label, newPosition, labelTarget.parent);\n }, this);\n\n forEach(tree[0], function(descriptor) {\n var id = descriptor.id,\n toplevel = tree.createdElements[id];\n\n if (toplevel) {\n topLevelElements.push(toplevel.element);\n }\n });\n\n selection.select(topLevelElements);\n};\n\n\nPasteHandler.prototype._createConnection = function(element, parent, parentCenter, tree) {\n var modeling = this._modeling,\n rules = this._rules;\n\n var connection, source, target, canPaste;\n\n element.waypoints = map(element.waypoints, function(waypoint, idx) {\n return {\n x: Math.round(parentCenter.x + element.delta[idx].x),\n y: Math.round(parentCenter.y + element.delta[idx].y)\n };\n });\n\n source = this._getCreatedElement(element.source, tree);\n target = this._getCreatedElement(element.target, tree);\n\n if (!source || !target) {\n return null;\n }\n\n canPaste = rules.allowed('element.paste', {\n source: source,\n target: target\n });\n\n if (!canPaste) {\n return null;\n }\n\n removeProperties(element, [ 'id', 'parent', 'delta', 'source', 'target', 'width', 'height', 'priority' ]);\n\n connection = modeling.createConnection(source, target, element, parent);\n\n return connection;\n};\n\n\nPasteHandler.prototype._createShape = function(element, parent, position, isAttach, hints) {\n var modeling = this._modeling,\n elementFactory = this._elementFactory,\n rules = this._rules;\n\n var canPaste = rules.allowed('element.paste', {\n element: element,\n position: position,\n parent: parent\n });\n\n if (!canPaste) {\n return null;\n }\n\n var shape = elementFactory.createShape(element);\n\n modeling.createShape(shape, position, parent, isAttach, hints);\n\n return shape;\n};\n\n\nPasteHandler.prototype._getCreatedElement = function(id, tree) {\n return tree.createdElements[id] && tree.createdElements[id].element;\n};\n","'use strict';\n\nvar isArray = require(422);\n\n\n/**\n * Reconnect connection handler\n */\nfunction ReconnectConnectionHandler() { }\n\nReconnectConnectionHandler.$inject = [ ];\n\nmodule.exports = ReconnectConnectionHandler;\n\nReconnectConnectionHandler.prototype.execute = function(context) {\n\n var newSource = context.newSource,\n newTarget = context.newTarget,\n connection = context.connection,\n dockingOrPoints = context.dockingOrPoints,\n oldWaypoints = connection.waypoints,\n newWaypoints;\n\n if (!newSource && !newTarget) {\n throw new Error('newSource or newTarget are required');\n }\n\n if (newSource && newTarget) {\n throw new Error('must specify either newSource or newTarget');\n }\n\n context.oldWaypoints = oldWaypoints;\n\n if (isArray(dockingOrPoints)) {\n newWaypoints = dockingOrPoints;\n } else {\n newWaypoints = oldWaypoints.slice();\n\n newWaypoints.splice(newSource ? 0 : -1, 1, dockingOrPoints);\n }\n\n if (newSource) {\n context.oldSource = connection.source;\n connection.source = newSource;\n }\n\n if (newTarget) {\n context.oldTarget = connection.target;\n connection.target = newTarget;\n }\n\n connection.waypoints = newWaypoints;\n\n return connection;\n};\n\nReconnectConnectionHandler.prototype.revert = function(context) {\n\n var newSource = context.newSource,\n newTarget = context.newTarget,\n connection = context.connection;\n\n if (newSource) {\n connection.source = context.oldSource;\n }\n\n if (newTarget) {\n connection.target = context.oldTarget;\n }\n\n connection.waypoints = context.oldWaypoints;\n\n return connection;\n};","'use strict';\n\nvar forEach = require(303);\n\n\n/**\n * A handler that implements reversible replacing of shapes.\n * Internally the old shape will be removed and the new shape will be added.\n *\n *\n * @class\n * @constructor\n *\n * @param {canvas} Canvas\n */\nfunction ReplaceShapeHandler(modeling, rules) {\n this._modeling = modeling;\n this._rules = rules;\n}\n\nReplaceShapeHandler.$inject = [ 'modeling', 'rules' ];\n\nmodule.exports = ReplaceShapeHandler;\n\n\n\n////// api /////////////////////////////////////////\n\n\n/**\n * Replaces a shape with an replacement Element.\n *\n * The newData object should contain type, x, y.\n *\n * If possible also the incoming/outgoing connection\n * will be restored.\n *\n * @param {Object} context\n */\nReplaceShapeHandler.prototype.preExecute = function(context) {\n\n var self = this,\n modeling = this._modeling,\n rules = this._rules;\n\n var oldShape = context.oldShape,\n newData = context.newData,\n hints = context.hints,\n newShape;\n\n function canReconnect(type, source, target, connection) {\n return rules.allowed(type, {\n source: source,\n target: target,\n connection: connection\n });\n }\n\n\n // (1) place a new shape at the given position\n\n var position = {\n x: newData.x,\n y: newData.y\n };\n\n newShape = context.newShape = context.newShape || self.createShape(newData, position, oldShape.parent);\n\n\n // (2) update the host\n\n if (oldShape.host) {\n modeling.updateAttachment(newShape, oldShape.host);\n }\n\n\n // (3) adopt all children from the old shape\n\n var children;\n\n if (hints.moveChildren !== false) {\n children = oldShape.children.slice();\n\n modeling.moveElements(children, { x: 0, y: 0 }, newShape);\n }\n\n // (4) reconnect connections to the new shape (where allowed)\n\n var incoming = oldShape.incoming.slice(),\n outgoing = oldShape.outgoing.slice();\n\n forEach(incoming, function(connection) {\n var waypoints = connection.waypoints,\n docking = waypoints[waypoints.length - 1],\n source = connection.source,\n allowed = canReconnect('connection.reconnectEnd', source, newShape, connection);\n\n if (allowed) {\n self.reconnectEnd(connection, newShape, docking);\n }\n });\n\n forEach(outgoing, function(connection) {\n var waypoints = connection.waypoints,\n docking = waypoints[0],\n target = connection.target,\n allowed = canReconnect('connection.reconnectStart', newShape, target, connection);\n\n if (allowed) {\n self.reconnectStart(connection, newShape, docking);\n }\n\n });\n};\n\n\nReplaceShapeHandler.prototype.postExecute = function(context) {\n var modeling = this._modeling;\n\n var oldShape = context.oldShape,\n newShape = context.newShape;\n\n // if an element gets resized on replace, layout the connection again\n forEach(newShape.incoming, function(c) {\n modeling.layoutConnection(c, { endChanged: true });\n });\n\n forEach(newShape.outgoing, function(c) {\n modeling.layoutConnection(c, { startChanged: true });\n });\n\n modeling.removeShape(oldShape);\n};\n\n\nReplaceShapeHandler.prototype.execute = function(context) {};\n\nReplaceShapeHandler.prototype.revert = function(context) {};\n\n\nReplaceShapeHandler.prototype.createShape = function(shape, position, target) {\n var modeling = this._modeling;\n return modeling.createShape(shape, position, target);\n};\n\n\nReplaceShapeHandler.prototype.reconnectStart = function(connection, newSource, dockingPoint) {\n var modeling = this._modeling;\n modeling.reconnectStart(connection, newSource, dockingPoint);\n};\n\n\nReplaceShapeHandler.prototype.reconnectEnd = function(connection, newTarget, dockingPoint) {\n var modeling = this._modeling;\n modeling.reconnectEnd(connection, newTarget, dockingPoint);\n};\n","'use strict';\n\nvar assign = require(431),\n forEach = require(303);\n\nvar getResizedSourceAnchor = require(200).getResizedSourceAnchor,\n getResizedTargetAnchor = require(200).getResizedTargetAnchor;\n\n/**\n * A handler that implements reversible resizing of shapes.\n *\n * @param {Modeling} modeling\n */\nfunction ResizeShapeHandler(modeling) {\n this._modeling = modeling;\n}\n\nResizeShapeHandler.$inject = [ 'modeling' ];\n\nmodule.exports = ResizeShapeHandler;\n\n/**\n * {\n * shape: {....}\n * newBounds: {\n * width: 20,\n * height: 40,\n * x: 5,\n * y: 10\n * }\n *\n * }\n */\nResizeShapeHandler.prototype.execute = function(context) {\n var shape = context.shape,\n newBounds = context.newBounds,\n minBounds = context.minBounds;\n\n if (newBounds.x === undefined || newBounds.y === undefined ||\n newBounds.width === undefined || newBounds.height === undefined) {\n throw new Error('newBounds must have {x, y, width, height} properties');\n }\n\n if (minBounds && (newBounds.width < minBounds.width\n || newBounds.height < minBounds.height)) {\n throw new Error('width and height cannot be less than minimum height and width');\n } else if (!minBounds\n && newBounds.width < 10 || newBounds.height < 10) {\n throw new Error('width and height cannot be less than 10px');\n }\n\n // save old bbox in context\n context.oldBounds = {\n width: shape.width,\n height: shape.height,\n x: shape.x,\n y: shape.y\n };\n\n // update shape\n assign(shape, {\n width: newBounds.width,\n height: newBounds.height,\n x: newBounds.x,\n y: newBounds.y\n });\n\n return shape;\n};\n\nResizeShapeHandler.prototype.postExecute = function(context) {\n\n var shape = context.shape,\n oldBounds = context.oldBounds;\n\n var modeling = this._modeling;\n\n forEach(shape.incoming, function(c) {\n modeling.layoutConnection(c, {\n connectionEnd: getResizedTargetAnchor(c, shape, oldBounds)\n });\n });\n\n forEach(shape.outgoing, function(c) {\n modeling.layoutConnection(c, {\n connectionStart: getResizedSourceAnchor(c, shape, oldBounds)\n });\n });\n\n};\n\nResizeShapeHandler.prototype.revert = function(context) {\n\n var shape = context.shape,\n oldBounds = context.oldBounds;\n\n // restore previous bbox\n assign(shape, {\n width: oldBounds.width,\n height: oldBounds.height,\n x: oldBounds.x,\n y: oldBounds.y\n });\n\n return shape;\n};\n","'use strict';\n\nvar forEach = require(303);\n\nvar SpaceUtil = require(239);\n\n/**\n * A handler that implements reversible creating and removing of space.\n *\n * It executes in two phases:\n *\n * (1) resize all affected resizeShapes\n * (2) move all affected moveElements\n */\nfunction SpaceToolHandler(modeling) {\n this._modeling = modeling;\n}\n\nSpaceToolHandler.$inject = [ 'modeling' ];\n\nmodule.exports = SpaceToolHandler;\n\n\nSpaceToolHandler.prototype.preExecute = function(context) {\n\n // resize\n var modeling = this._modeling,\n resizingShapes = context.resizingShapes,\n delta = context.delta,\n direction = context.direction;\n\n forEach(resizingShapes, function(shape) {\n var newBounds = SpaceUtil.resizeBounds(shape, direction, delta);\n\n modeling.resizeShape(shape, newBounds);\n });\n};\n\nSpaceToolHandler.prototype.postExecute = function(context) {\n // move\n var modeling = this._modeling,\n movingShapes = context.movingShapes,\n delta = context.delta;\n\n modeling.moveElements(movingShapes, delta, undefined, false, { autoResize: false });\n};\n\nSpaceToolHandler.prototype.execute = function(context) {};\nSpaceToolHandler.prototype.revert = function(context) {};\n","'use strict';\n\n/**\n * A handler that toggles the collapsed state of an element\n * and the visibility of all its children.\n *\n * @param {Modeling} modeling\n */\nfunction ToggleShapeCollapseHandler(modeling) {\n this._modeling = modeling;\n}\n\nToggleShapeCollapseHandler.$inject = [ 'modeling' ];\n\nmodule.exports = ToggleShapeCollapseHandler;\n\n\nToggleShapeCollapseHandler.prototype.execute = function(context) {\n\n var shape = context.shape,\n children = shape.children;\n\n // remember previous visibility of children\n context.oldChildrenVisibility = getElementsVisibility(children);\n\n // toggle state\n shape.collapsed = !shape.collapsed;\n\n // hide/show children\n setHidden(children, shape.collapsed);\n\n return [shape].concat(children);\n};\n\n\nToggleShapeCollapseHandler.prototype.revert = function(context) {\n\n var shape = context.shape,\n oldChildrenVisibility = context.oldChildrenVisibility;\n\n var children = shape.children;\n\n // set old visability of children\n restoreVisibility(children, oldChildrenVisibility);\n\n // retoggle state\n shape.collapsed = !shape.collapsed;\n\n return [shape].concat(children);\n};\n\n\n/////// helpers ///////////////////////////////\n\n/**\n * Return a map { elementId -> hiddenState}.\n *\n * @param {Array} elements\n *\n * @return {Object}\n */\nfunction getElementsVisibility(elements) {\n\n var result = {};\n\n elements.forEach(function(e) {\n result[e.id] = e.hidden;\n });\n\n return result;\n}\n\n\nfunction setHidden(elements, newHidden) {\n elements.forEach(function(element) {\n element.hidden = newHidden;\n });\n}\n\nfunction restoreVisibility(elements, lastState) {\n elements.forEach(function(e) {\n e.hidden = lastState[e.id];\n });\n}\n","'use strict';\n\nvar Collections = require(263);\n\n/**\n * A handler that implements reversible attaching/detaching of shapes.\n */\nfunction UpdateAttachmentHandler(modeling) {\n this._modeling = modeling;\n}\n\nmodule.exports = UpdateAttachmentHandler;\n\nUpdateAttachmentHandler.$inject = [ 'modeling' ];\n\n\nUpdateAttachmentHandler.prototype.execute = function(context) {\n var shape = context.shape,\n newHost = context.newHost,\n oldHost = shape.host;\n\n // (0) detach from old host\n context.oldHost = oldHost;\n context.attacherIdx = removeAttacher(oldHost, shape);\n\n // (1) attach to new host\n addAttacher(newHost, shape);\n\n // (2) update host\n shape.host = newHost;\n\n return shape;\n};\n\nUpdateAttachmentHandler.prototype.revert = function(context) {\n var shape = context.shape,\n newHost = context.newHost,\n oldHost = context.oldHost,\n attacherIdx = context.attacherIdx;\n\n // (2) update host\n shape.host = oldHost;\n\n // (1) attach to new host\n removeAttacher(newHost, shape);\n\n // (0) detach from old host\n addAttacher(oldHost, shape, attacherIdx);\n\n return shape;\n};\n\n\nfunction removeAttacher(host, attacher) {\n // remove attacher from host\n return Collections.remove(host && host.attachers, attacher);\n}\n\nfunction addAttacher(host, attacher, idx) {\n\n if (!host) {\n return;\n }\n\n var attachers = host.attachers;\n\n if (!attachers) {\n host.attachers = attachers = [];\n }\n\n Collections.add(attachers, attacher, idx);\n}\n","'use strict';\n\nfunction UpdateWaypointsHandler() { }\n\nmodule.exports = UpdateWaypointsHandler;\n\nUpdateWaypointsHandler.prototype.execute = function(context) {\n\n var connection = context.connection,\n newWaypoints = context.newWaypoints;\n\n context.oldWaypoints = connection.waypoints;\n\n connection.waypoints = newWaypoints;\n\n return connection;\n};\n\nUpdateWaypointsHandler.prototype.revert = function(context) {\n\n var connection = context.connection,\n oldWaypoints = context.oldWaypoints;\n\n connection.waypoints = oldWaypoints;\n\n return connection;\n};","'use strict';\n\nvar getNewAttachPoint = require(261).getNewAttachPoint;\n\nfunction getResizedSourceAnchor(connection, shape, oldBounds) {\n\n var waypoints = safeGetWaypoints(connection),\n oldAnchor = waypoints[0];\n\n return getNewAttachPoint(oldAnchor.original || oldAnchor, oldBounds, shape);\n}\n\nmodule.exports.getResizedSourceAnchor = getResizedSourceAnchor;\n\n\nfunction getResizedTargetAnchor(connection, shape, oldBounds) {\n\n var waypoints = safeGetWaypoints(connection),\n oldAnchor = waypoints[waypoints.length - 1];\n\n return getNewAttachPoint(oldAnchor.original || oldAnchor, oldBounds, shape);\n}\n\nmodule.exports.getResizedTargetAnchor = getResizedTargetAnchor;\n\n\nfunction getMovedSourceAnchor(connection, source, moveDelta) {\n return getResizedSourceAnchor(connection, source, substractPosition(source, moveDelta));\n}\n\nmodule.exports.getMovedSourceAnchor = getMovedSourceAnchor;\n\n\nfunction getMovedTargetAnchor(connection, target, moveDelta) {\n return getResizedTargetAnchor(connection, target, substractPosition(target, moveDelta));\n}\n\nmodule.exports.getMovedTargetAnchor = getMovedTargetAnchor;\n\n\n//////// helpers ////////////////////////////////////\n\nfunction substractPosition(bounds, delta) {\n return {\n x: bounds.x - delta.x,\n y: bounds.y - delta.y,\n width: bounds.width,\n height: bounds.height\n };\n}\n\n\n/**\n * Return waypoints of given connection; throw if non exists (should not happen!!).\n *\n * @param {Connection} connection\n *\n * @return {Array}\n */\nfunction safeGetWaypoints(connection) {\n\n var waypoints = connection.waypoints;\n\n if (!waypoints.length) {\n throw new Error('connection#' + connection.id + ': no waypoints');\n }\n\n return waypoints;\n}\n","'use strict';\n\nvar forEach = require(303);\n\nvar Elements = require(266);\n\nvar getMovedSourceAnchor = require(200).getMovedSourceAnchor,\n getMovedTargetAnchor = require(200).getMovedTargetAnchor;\n\n/**\n * A helper that is able to carry out serialized move operations on multiple elements.\n *\n * @param {Modeling} modeling\n */\nfunction MoveHelper(modeling) {\n this._modeling = modeling;\n}\n\nmodule.exports = MoveHelper;\n\n/**\n * Move the specified elements and all children by the given delta.\n *\n * This moves all enclosed connections, too and layouts all affected\n * external connections.\n *\n * @param {Array} elements\n * @param {Point} delta\n * @param {djs.model.Base} newParent applied to the first level of shapes\n *\n * @return {Array} list of touched elements\n */\nMoveHelper.prototype.moveRecursive = function(elements, delta, newParent) {\n if (!elements) {\n return [];\n } else {\n return this.moveClosure(this.getClosure(elements), delta, newParent);\n }\n};\n\n/**\n * Move the given closure of elmements.\n *\n * @param {Object} closure\n * @param {Point} delta\n * @param {djs.model.Base} [newParent]\n * @param {djs.model.Base} [newHost]\n */\nMoveHelper.prototype.moveClosure = function(closure, delta, newParent, newHost, primaryShape) {\n var modeling = this._modeling;\n\n var allShapes = closure.allShapes,\n allConnections = closure.allConnections,\n enclosedConnections = closure.enclosedConnections,\n topLevel = closure.topLevel,\n keepParent = false;\n\n if (primaryShape && primaryShape.parent === newParent) {\n keepParent = true;\n }\n\n // move all shapes\n forEach(allShapes, function(shape) {\n\n // move the element according to the given delta\n modeling.moveShape(shape, delta, topLevel[shape.id] && !keepParent && newParent, {\n recurse: false,\n layout: false\n });\n });\n\n // move all child connections / layout external connections\n forEach(allConnections, function(c) {\n\n var sourceMoved = !!allShapes[c.source.id],\n targetMoved = !!allShapes[c.target.id];\n\n if (enclosedConnections[c.id] && sourceMoved && targetMoved) {\n modeling.moveConnection(c, delta, topLevel[c.id] && !keepParent && newParent);\n } else {\n modeling.layoutConnection(c, {\n connectionStart: sourceMoved && getMovedSourceAnchor(c, c.source, delta),\n connectionEnd: targetMoved && getMovedTargetAnchor(c, c.target, delta)\n });\n }\n });\n};\n\n/**\n * Returns the closure for the selected elements\n *\n * @param {Array} elements\n * @return {Object} closure\n */\nMoveHelper.prototype.getClosure = function(elements) {\n return Elements.getClosure(elements);\n};\n","'use strict';\n\nvar bind = require(312);\n\n\nfunction MouseTracking(eventBus, canvas) {\n this._eventBus = eventBus;\n this._canvas = canvas;\n\n this._init();\n}\n\nMouseTracking.$inject = [\n 'eventBus',\n 'canvas'\n];\n\nmodule.exports = MouseTracking;\n\n\nMouseTracking.prototype.getHoverContext = function() {\n var viewbox = this._canvas.viewbox();\n\n return {\n element: this._hoverElement,\n point: {\n x: viewbox.x + Math.round(this._mouseX / viewbox.scale),\n y: viewbox.y + Math.round(this._mouseY / viewbox.scale)\n }\n };\n};\n\nMouseTracking.prototype._init = function() {\n var eventBus = this._eventBus,\n canvas = this._canvas;\n\n var container = canvas.getContainer();\n\n this._setMousePosition = bind(this._setMousePosition, this);\n\n container.addEventListener('mousemove', this._setMousePosition);\n\n eventBus.on('diagram.destroy', function() {\n container.removeEventListener('mousemove', this._setMousePosition);\n }, this);\n\n eventBus.on('element.hover', this._setHoverElement, this);\n};\n\n\nMouseTracking.prototype._setHoverElement = function(event) {\n this._hoverElement = event.element;\n};\n\n\nMouseTracking.prototype._setMousePosition = function(event) {\n this._mouseX = event.layerX;\n this._mouseY = event.layerY;\n};\n","'use strict';\n\nmodule.exports = {\n __init__: [ 'mouseTracking' ],\n mouseTracking: [ 'type', require(202) ]\n};\n","'use strict';\n\nvar assign = require(431),\n filter = require(301),\n groupBy = require(304);\n\nvar LOW_PRIORITY = 500,\n MEDIUM_PRIORITY = 1250,\n HIGH_PRIORITY = 1500;\n\nvar getOriginalEvent = require(267).getOriginal;\n\nvar round = Math.round;\n\nfunction mid(element) {\n return {\n x: element.x + round(element.width / 2),\n y: element.y + round(element.height / 2)\n };\n}\n\n/**\n * A plugin that makes shapes draggable / droppable.\n *\n * @param {EventBus} eventBus\n * @param {Dragging} dragging\n * @param {Modeling} modeling\n * @param {Selection} selection\n * @param {Rules} rules\n */\nfunction MoveEvents(eventBus, dragging, modeling, selection, rules) {\n\n // rules\n\n function canMove(shapes, delta, position, target) {\n\n return rules.allowed('elements.move', {\n shapes: shapes,\n delta: delta,\n position: position,\n target: target\n });\n }\n\n\n // move events\n\n // assign a high priority to this handler to setup the environment\n // others may hook up later, e.g. at default priority and modify\n // the move environment.\n //\n // This sets up the context with\n //\n // * shape: the primary shape being moved\n // * shapes: a list of shapes to be moved\n // * validatedShapes: a list of shapes that are being checked\n // against the rules before and during move\n //\n eventBus.on('shape.move.start', HIGH_PRIORITY, function(event) {\n\n var context = event.context,\n shape = event.shape,\n shapes = selection.get().slice();\n\n // move only single shape if the dragged element\n // is not part of the current selection\n if (shapes.indexOf(shape) === -1) {\n shapes = [ shape ];\n }\n\n // ensure we remove nested elements in the collection\n // and add attachers for a proper dragger\n shapes = removeNested(shapes);\n\n // attach shapes to drag context\n assign(context, {\n shapes: shapes,\n validatedShapes: shapes,\n shape: shape\n });\n });\n\n\n // assign a high priority to this handler to setup the environment\n // others may hook up later, e.g. at default priority and modify\n // the move environment\n //\n eventBus.on('shape.move.start', MEDIUM_PRIORITY, function(event) {\n\n var context = event.context,\n validatedShapes = context.validatedShapes,\n canExecute;\n\n canExecute = context.canExecute = canMove(validatedShapes);\n\n // check if we can move the elements\n if (!canExecute) {\n // suppress move operation\n event.stopPropagation();\n\n return false;\n }\n });\n\n // assign a low priority to this handler\n // to let others modify the move event before we update\n // the context\n //\n eventBus.on('shape.move.move', LOW_PRIORITY, function(event) {\n\n var context = event.context,\n validatedShapes = context.validatedShapes,\n hover = event.hover,\n delta = { x: event.dx, y: event.dy },\n position = { x: event.x, y: event.y },\n canExecute;\n\n // check if we can move the elements\n canExecute = canMove(validatedShapes, delta, position, hover);\n\n context.delta = delta;\n context.canExecute = canExecute;\n\n // simply ignore move over\n if (canExecute === null) {\n context.target = null;\n\n return;\n }\n\n context.target = hover;\n });\n\n eventBus.on('shape.move.end', function(event) {\n\n var context = event.context;\n\n var delta = context.delta,\n canExecute = context.canExecute,\n isAttach = canExecute === 'attach',\n shapes = context.shapes;\n\n if (!canExecute) {\n return false;\n }\n\n // ensure we have actual pixel values deltas\n // (important when zoom level was > 1 during move)\n delta.x = round(delta.x);\n delta.y = round(delta.y);\n\n modeling.moveElements(shapes, delta, context.target, isAttach, { primaryShape: context.shape });\n });\n\n\n // move activation\n\n eventBus.on('element.mousedown', function(event) {\n\n var originalEvent = getOriginalEvent(event);\n\n if (!originalEvent) {\n throw new Error('must supply DOM mousedown event');\n }\n\n start(originalEvent, event.element);\n });\n\n\n function start(event, element, activate) {\n\n // do not move connections or the root element\n if (element.waypoints || !element.parent) {\n return;\n }\n\n var referencePoint = mid(element);\n\n dragging.init(event, referencePoint, 'shape.move', {\n cursor: 'grabbing',\n autoActivate: activate,\n data: {\n shape: element,\n context: {}\n }\n });\n }\n\n // API\n\n this.start = start;\n}\n\nMoveEvents.$inject = [ 'eventBus', 'dragging', 'modeling', 'selection', 'rules' ];\n\nmodule.exports = MoveEvents;\n\n\n/**\n * Return a filtered list of elements that do not contain\n * those nested into others.\n *\n * @param {Array} elements\n *\n * @return {Array} filtered\n */\nfunction removeNested(elements) {\n\n var ids = groupBy(elements, 'id');\n\n return filter(elements, function(element) {\n while ((element = element.parent)) {\n\n // parent in selection\n if (ids[element.id]) {\n return false;\n }\n }\n\n return true;\n });\n}\n","'use strict';\n\nvar flatten = require(291),\n forEach = require(303),\n filter = require(301),\n find = require(302),\n size = require(308),\n groupBy = require(304),\n map = require(305);\n\nvar Elements = require(266);\n\nvar svgAppend = require(472),\n svgAttr = require(474),\n svgClear = require(476),\n svgCreate = require(478);\n\nvar translate = require(279).translate;\n\nvar LOW_PRIORITY = 500;\n\nvar MARKER_DRAGGING = 'djs-dragging',\n MARKER_OK = 'drop-ok',\n MARKER_NOT_OK = 'drop-not-ok',\n MARKER_NEW_PARENT = 'new-parent',\n MARKER_ATTACH = 'attach-ok';\n\n/**\n * Provides previews for moving shapes when moving.\n *\n * @param {EventBus} eventBus\n * @param {ElementRegistry} elementRegistry\n * @param {Canvas} canvas\n * @param {Styles} styles\n */\nfunction MovePreview(eventBus, elementRegistry, canvas, styles, previewSupport) {\n\n function getVisualDragShapes(shapes) {\n var elements = getAllDraggedElements(shapes);\n\n var filteredElements = removeEdges(elements);\n\n return filteredElements;\n }\n\n function getAllDraggedElements(shapes) {\n var allShapes = Elements.selfAndAllChildren(shapes, true);\n\n var allConnections = map(allShapes, function(shape) {\n return (shape.incoming || []).concat(shape.outgoing || []);\n });\n\n return flatten(allShapes.concat(allConnections), true);\n }\n\n /**\n * Sets drop marker on an element.\n */\n function setMarker(element, marker) {\n\n [ MARKER_ATTACH, MARKER_OK, MARKER_NOT_OK, MARKER_NEW_PARENT ].forEach(function(m) {\n\n if (m === marker) {\n canvas.addMarker(element, m);\n } else {\n canvas.removeMarker(element, m);\n }\n });\n }\n\n function makeDraggable(context, element, addMarker) {\n\n previewSupport.addDragger(element, context.dragGroup);\n\n if (addMarker) {\n canvas.addMarker(element, MARKER_DRAGGING);\n }\n\n if (context.allDraggedElements) {\n context.allDraggedElements.push(element);\n } else {\n context.allDraggedElements = [ element ];\n }\n }\n\n // expose to other components\n // that plug into the drag behavior\n this.makeDraggable = makeDraggable;\n\n // add previews\n eventBus.on('shape.move.start', LOW_PRIORITY, function(event) {\n\n var context = event.context,\n dragShapes = context.shapes,\n allDraggedElements = context.allDraggedElements;\n\n var visuallyDraggedShapes = getVisualDragShapes(dragShapes);\n\n if (!context.dragGroup) {\n var dragGroup = svgCreate('g');\n svgAttr(dragGroup, styles.cls('djs-drag-group', [ 'no-events' ]));\n\n var defaultLayer = canvas.getDefaultLayer();\n\n svgAppend(defaultLayer, dragGroup);\n\n context.dragGroup = dragGroup;\n }\n\n // add previews\n visuallyDraggedShapes.forEach(function(shape) {\n previewSupport.addDragger(shape, context.dragGroup);\n });\n\n // cache all dragged elements / gfx\n // so that we can quickly undo their state changes later\n if (!allDraggedElements) {\n allDraggedElements = getAllDraggedElements(dragShapes);\n } else {\n allDraggedElements = flatten(allDraggedElements, getAllDraggedElements(dragShapes));\n }\n\n // add dragging marker\n forEach(allDraggedElements, function(e) {\n canvas.addMarker(e, MARKER_DRAGGING);\n });\n\n context.allDraggedElements = allDraggedElements;\n\n // determine, if any of the dragged elements have different parents\n context.differentParents = haveDifferentParents(dragShapes);\n });\n\n // update previews\n eventBus.on('shape.move.move', LOW_PRIORITY, function(event) {\n\n var context = event.context,\n dragGroup = context.dragGroup,\n target = context.target,\n parent = context.shape.parent,\n canExecute = context.canExecute;\n\n if (target) {\n if (canExecute === 'attach') {\n setMarker(target, MARKER_ATTACH);\n } else if (context.canExecute && target && target.id !== parent.id) {\n setMarker(target, MARKER_NEW_PARENT);\n } else {\n setMarker(target, context.canExecute ? MARKER_OK : MARKER_NOT_OK);\n }\n }\n\n translate(dragGroup, event.dx, event.dy);\n });\n\n eventBus.on([ 'shape.move.out', 'shape.move.cleanup' ], function(event) {\n var context = event.context,\n target = context.target;\n\n if (target) {\n setMarker(target, null);\n }\n });\n\n // remove previews\n eventBus.on('shape.move.cleanup', function(event) {\n\n var context = event.context,\n allDraggedElements = context.allDraggedElements,\n dragGroup = context.dragGroup;\n\n\n // remove dragging marker\n forEach(allDraggedElements, function(e) {\n canvas.removeMarker(e, MARKER_DRAGGING);\n });\n\n if (dragGroup) {\n svgClear(dragGroup);\n }\n });\n}\n\nMovePreview.$inject = [ 'eventBus', 'elementRegistry', 'canvas', 'styles', 'previewSupport' ];\n\nmodule.exports = MovePreview;\n\n////////// helpers //////////\n\n// returns elements minus all connections\n// where source or target is not elements\nfunction removeEdges(elements) {\n\n var filteredElements = filter(elements, function(element) {\n\n if (!isConnection(element)) {\n return true;\n } else {\n var srcFound = find(elements, element.source);\n var targetFound = find(elements, element.target);\n\n return srcFound && targetFound;\n }\n });\n\n return filteredElements;\n}\n\nfunction haveDifferentParents(elements) {\n return size(groupBy(elements, function(e) { return e.parent && e.parent.id; })) !== 1;\n}\n\n/**\n * Checks if an element is a connection.\n */\nfunction isConnection(element) {\n return element.waypoints;\n}\n","module.exports = {\n __depends__: [\n require(170),\n require(233),\n require(209),\n require(227),\n require(162),\n require(217)\n ],\n __init__: [ 'move', 'movePreview' ],\n move: [ 'type', require(204) ],\n movePreview: [ 'type', require(205) ]\n};\n","'use strict';\n\nvar inherits = require(289);\n\nvar CommandInterceptor = require(119);\n\n\n/**\n * An abstract provider that allows modelers to implement a custom\n * ordering of diagram elements on the canvas.\n *\n * It makes sure that the order is always preserved during element\n * creation and move operations.\n *\n * In order to use this behavior, inherit from it and override\n * the method {@link OrderingProvider#getOrdering}.\n *\n * @example\n *\n * ```javascript\n * function CustomOrderingProvider(eventBus) {\n * OrderingProvider.call(this, eventBus);\n *\n * this.getOrdering = function(element, newParent) {\n * // always insert elements at the front\n * // when moving\n * return {\n * index: 0,\n * parent: newParent\n * };\n * };\n * }\n * ```\n *\n * @param {EventBus} eventBus\n */\nfunction OrderingProvider(eventBus) {\n\n CommandInterceptor.call(this, eventBus);\n\n\n var self = this;\n\n this.preExecute([ 'shape.create', 'connection.create' ], function(event) {\n\n var context = event.context,\n element = context.shape || context.connection,\n parent = context.parent;\n\n var ordering = self.getOrdering(element, parent);\n\n if (ordering) {\n\n if (ordering.parent !== undefined) {\n context.parent = ordering.parent;\n }\n\n context.parentIndex = ordering.index;\n }\n });\n\n this.preExecute([ 'shape.move', 'connection.move' ], function(event) {\n\n var context = event.context,\n element = context.shape || context.connection,\n parent = context.newParent || element.parent;\n\n var ordering = self.getOrdering(element, parent);\n\n if (ordering) {\n\n if (ordering.parent !== undefined) {\n context.newParent = ordering.parent;\n }\n\n context.newParentIndex = ordering.index;\n }\n });\n}\n\n/**\n * Return a custom ordering of the element, both in terms\n * of parent element and index in the new parent.\n *\n * Implementors of this method must return an object with\n * `parent` _and_ `index` in it.\n *\n * @param {djs.model.Base} element\n * @param {djs.model.Shape} newParent\n *\n * @return {Object} ordering descriptor\n */\nOrderingProvider.prototype.getOrdering = function(element, newParent) {\n return null;\n};\n\ninherits(OrderingProvider, CommandInterceptor);\n\nmodule.exports = OrderingProvider;","'use strict';\n\nvar getBBox = require(266).getBBox;\n\nvar LOW_PRIORITY = 500;\n\nvar svgAppend = require(472),\n svgAttr = require(474),\n svgCreate = require(478);\n\nvar domQuery = require(452);\n\nvar assign = require(431);\n\n\n/**\n * @class\n *\n * A plugin that adds an outline to shapes and connections that may be activated and styled\n * via CSS classes.\n *\n * @param {EventBus} eventBus\n * @param {Styles} styles\n * @param {ElementRegistry} elementRegistry\n */\nfunction Outline(eventBus, styles, elementRegistry) {\n\n this.offset = 6;\n\n var OUTLINE_STYLE = styles.cls('djs-outline', [ 'no-fill' ]);\n\n var self = this;\n\n function createOutline(gfx, bounds) {\n var outline = svgCreate('rect');\n\n svgAttr(outline, assign({\n x: 10,\n y: 10,\n width: 100,\n height: 100\n }, OUTLINE_STYLE));\n\n svgAppend(gfx, outline);\n\n return outline;\n }\n\n // A low priortity is necessary, because outlines of labels have to be updated\n // after the label bounds have been updated in the renderer.\n eventBus.on([ 'shape.added', 'shape.changed' ], LOW_PRIORITY, function(event) {\n var element = event.element,\n gfx = event.gfx;\n\n var outline = domQuery('.djs-outline', gfx);\n\n if (!outline) {\n outline = createOutline(gfx, element);\n }\n\n self.updateShapeOutline(outline, element);\n });\n\n eventBus.on([ 'connection.added', 'connection.changed' ], function(event) {\n var element = event.element,\n gfx = event.gfx;\n\n var outline = domQuery('.djs-outline', gfx);\n\n if (!outline) {\n outline = createOutline(gfx, element);\n }\n\n self.updateConnectionOutline(outline, element);\n });\n}\n\n\n/**\n * Updates the outline of a shape respecting the dimension of the\n * element and an outline offset.\n *\n * @param {SVGElement} outline\n * @param {djs.model.Base} element\n */\nOutline.prototype.updateShapeOutline = function(outline, element) {\n\n svgAttr(outline, {\n x: -this.offset,\n y: -this.offset,\n width: element.width + this.offset * 2,\n height: element.height + this.offset * 2\n });\n\n};\n\n\n/**\n * Updates the outline of a connection respecting the bounding box of\n * the connection and an outline offset.\n *\n * @param {SVGElement} outline\n * @param {djs.model.Base} element\n */\nOutline.prototype.updateConnectionOutline = function(outline, connection) {\n\n var bbox = getBBox(connection);\n\n svgAttr(outline, {\n x: bbox.x - this.offset,\n y: bbox.y - this.offset,\n width: bbox.width + this.offset * 2,\n height: bbox.height + this.offset * 2\n });\n\n};\n\n\nOutline.$inject = ['eventBus', 'styles', 'elementRegistry'];\n\nmodule.exports = Outline;\n","'use strict';\n\nmodule.exports = {\n __init__: [ 'outline' ],\n outline: [ 'type', require(208) ]\n};","'use strict';\n\nvar isArray = require(422),\n isString = require(428),\n isObject = require(426),\n assign = require(431),\n forEach = require(303),\n find = require(302),\n filter = require(301);\n\nvar domify = require(449),\n domClasses = require(445),\n domAttr = require(444),\n domRemove = require(453),\n domClear = require(446);\n\nvar getBBox = require(266).getBBox;\n\n// document wide unique overlay ids\nvar ids = new (require(270))('ov');\n\nvar LOW_PRIORITY = 500;\n\n\nfunction createRoot(parent) {\n var root = domify('
');\n parent.insertBefore(root, parent.firstChild);\n\n return root;\n}\n\n\nfunction setPosition(el, x, y) {\n assign(el.style, { left: x + 'px', top: y + 'px' });\n}\n\nfunction setVisible(el, visible) {\n el.style.display = visible === false ? 'none' : '';\n}\n\nfunction setTransform(el, transform) {\n\n el.style['transform-origin'] = 'top left';\n\n [ '', '-ms-', '-webkit-' ].forEach(function(prefix) {\n el.style[prefix + 'transform'] = transform;\n });\n}\n\nfunction isDef(o) {\n return typeof o !== 'undefined';\n}\n\n/**\n * A service that allows users to attach overlays to diagram elements.\n *\n * The overlay service will take care of overlay positioning during updates.\n *\n * @example\n *\n * // add a pink badge on the top left of the shape\n * overlays.add(someShape, {\n * position: {\n * top: -5,\n * left: -5\n * },\n * html: '
0
'\n * });\n *\n * // or add via shape id\n *\n * overlays.add('some-element-id', {\n * position: {\n * top: -5,\n * left: -5\n * }\n * html: '
0
'\n * });\n *\n * // or add with optional type\n *\n * overlays.add(someShape, 'badge', {\n * position: {\n * top: -5,\n * left: -5\n * }\n * html: '
0
'\n * });\n *\n *\n * // remove an overlay\n *\n * var id = overlays.add(...);\n * overlays.remove(id);\n *\n *\n * You may configure overlay defaults during tool by providing a `config` module\n * with `overlays.defaults` as an entry:\n *\n * {\n * overlays: {\n * defaults: {\n * show: {\n * minZoom: 0.7,\n * maxZoom: 5.0\n * },\n * scale: {\n * min: 1\n * }\n * }\n * }\n *\n * @param {Object} config\n * @param {EventBus} eventBus\n * @param {Canvas} canvas\n * @param {ElementRegistry} elementRegistry\n */\nfunction Overlays(config, eventBus, canvas, elementRegistry) {\n\n this._eventBus = eventBus;\n this._canvas = canvas;\n this._elementRegistry = elementRegistry;\n\n this._ids = ids;\n\n this._overlayDefaults = assign({\n // no show constraints\n show: null,\n\n // always scale\n scale: true\n }, config && config.defaults);\n\n /**\n * Mapping overlayId -> overlay\n */\n this._overlays = {};\n\n /**\n * Mapping elementId -> overlay container\n */\n this._overlayContainers = [];\n\n // root html element for all overlays\n this._overlayRoot = createRoot(canvas.getContainer());\n\n this._init();\n}\n\n\nOverlays.$inject = [\n 'config.overlays',\n 'eventBus',\n 'canvas',\n 'elementRegistry'\n];\n\nmodule.exports = Overlays;\n\n\n/**\n * Returns the overlay with the specified id or a list of overlays\n * for an element with a given type.\n *\n * @example\n *\n * // return the single overlay with the given id\n * overlays.get('some-id');\n *\n * // return all overlays for the shape\n * overlays.get({ element: someShape });\n *\n * // return all overlays on shape with type 'badge'\n * overlays.get({ element: someShape, type: 'badge' });\n *\n * // shape can also be specified as id\n * overlays.get({ element: 'element-id', type: 'badge' });\n *\n *\n * @param {Object} search\n * @param {String} [search.id]\n * @param {String|djs.model.Base} [search.element]\n * @param {String} [search.type]\n *\n * @return {Object|Array} the overlay(s)\n */\nOverlays.prototype.get = function(search) {\n\n if (isString(search)) {\n search = { id: search };\n }\n\n if (isString(search.element)) {\n search.element = this._elementRegistry.get(search.element);\n }\n\n if (search.element) {\n var container = this._getOverlayContainer(search.element, true);\n\n // return a list of overlays when searching by element (+type)\n if (container) {\n return search.type ? filter(container.overlays, { type: search.type }) : container.overlays.slice();\n } else {\n return [];\n }\n } else\n if (search.type) {\n return filter(this._overlays, { type: search.type });\n } else {\n // return single element when searching by id\n return search.id ? this._overlays[search.id] : null;\n }\n};\n\n/**\n * Adds a HTML overlay to an element.\n *\n * @param {String|djs.model.Base} element attach overlay to this shape\n * @param {String} [type] optional type to assign to the overlay\n * @param {Object} overlay the overlay configuration\n *\n * @param {String|DOMElement} overlay.html html element to use as an overlay\n * @param {Object} [overlay.show] show configuration\n * @param {Number} [overlay.show.minZoom] minimal zoom level to show the overlay\n * @param {Number} [overlay.show.maxZoom] maximum zoom level to show the overlay\n * @param {Object} overlay.position where to attach the overlay\n * @param {Number} [overlay.position.left] relative to element bbox left attachment\n * @param {Number} [overlay.position.top] relative to element bbox top attachment\n * @param {Number} [overlay.position.bottom] relative to element bbox bottom attachment\n * @param {Number} [overlay.position.right] relative to element bbox right attachment\n * @param {Boolean|Object} [overlay.scale=true] false to preserve the same size regardless of\n * diagram zoom\n * @param {Number} [overlay.scale.min]\n * @param {Number} [overlay.scale.max]\n *\n * @return {String} id that may be used to reference the overlay for update or removal\n */\nOverlays.prototype.add = function(element, type, overlay) {\n\n if (isObject(type)) {\n overlay = type;\n type = null;\n }\n\n if (!element.id) {\n element = this._elementRegistry.get(element);\n }\n\n if (!overlay.position) {\n throw new Error('must specifiy overlay position');\n }\n\n if (!overlay.html) {\n throw new Error('must specifiy overlay html');\n }\n\n if (!element) {\n throw new Error('invalid element specified');\n }\n\n var id = this._ids.next();\n\n overlay = assign({}, this._overlayDefaults, overlay, {\n id: id,\n type: type,\n element: element,\n html: overlay.html\n });\n\n this._addOverlay(overlay);\n\n return id;\n};\n\n\n/**\n * Remove an overlay with the given id or all overlays matching the given filter.\n *\n * @see Overlays#get for filter options.\n *\n * @param {String} [id]\n * @param {Object} [filter]\n */\nOverlays.prototype.remove = function(filter) {\n\n var overlays = this.get(filter) || [];\n\n if (!isArray(overlays)) {\n overlays = [ overlays ];\n }\n\n var self = this;\n\n forEach(overlays, function(overlay) {\n\n var container = self._getOverlayContainer(overlay.element, true);\n\n if (overlay) {\n domRemove(overlay.html);\n domRemove(overlay.htmlContainer);\n\n delete overlay.htmlContainer;\n delete overlay.element;\n\n delete self._overlays[overlay.id];\n }\n\n if (container) {\n var idx = container.overlays.indexOf(overlay);\n if (idx !== -1) {\n container.overlays.splice(idx, 1);\n }\n }\n });\n\n};\n\n\nOverlays.prototype.show = function() {\n setVisible(this._overlayRoot);\n};\n\n\nOverlays.prototype.hide = function() {\n setVisible(this._overlayRoot, false);\n};\n\nOverlays.prototype.clear = function() {\n this._overlays = {};\n\n this._overlayContainers = [];\n\n domClear(this._overlayRoot);\n};\n\nOverlays.prototype._updateOverlayContainer = function(container) {\n var element = container.element,\n html = container.html;\n\n // update container left,top according to the elements x,y coordinates\n // this ensures we can attach child elements relative to this container\n\n var x = element.x,\n y = element.y;\n\n if (element.waypoints) {\n var bbox = getBBox(element);\n x = bbox.x;\n y = bbox.y;\n }\n\n setPosition(html, x, y);\n\n domAttr(container.html, 'data-container-id', element.id);\n};\n\n\nOverlays.prototype._updateOverlay = function(overlay) {\n\n var position = overlay.position,\n htmlContainer = overlay.htmlContainer,\n element = overlay.element;\n\n // update overlay html relative to shape because\n // it is already positioned on the element\n\n // update relative\n var left = position.left,\n top = position.top;\n\n if (position.right !== undefined) {\n\n var width;\n\n if (element.waypoints) {\n width = getBBox(element).width;\n } else {\n width = element.width;\n }\n\n left = position.right * -1 + width;\n }\n\n if (position.bottom !== undefined) {\n\n var height;\n\n if (element.waypoints) {\n height = getBBox(element).height;\n } else {\n height = element.height;\n }\n\n top = position.bottom * -1 + height;\n }\n\n setPosition(htmlContainer, left || 0, top || 0);\n};\n\n\nOverlays.prototype._createOverlayContainer = function(element) {\n var html = domify('
');\n\n this._overlayRoot.appendChild(html);\n\n var container = {\n html: html,\n element: element,\n overlays: []\n };\n\n this._updateOverlayContainer(container);\n\n this._overlayContainers.push(container);\n\n return container;\n};\n\n\nOverlays.prototype._updateRoot = function(viewbox) {\n var scale = viewbox.scale || 1;\n\n var matrix = 'matrix(' +\n [\n scale,\n 0,\n 0,\n scale,\n -1 * viewbox.x * scale,\n -1 * viewbox.y * scale\n ].join(',') +\n ')';\n\n setTransform(this._overlayRoot, matrix);\n};\n\n\nOverlays.prototype._getOverlayContainer = function(element, raw) {\n var container = find(this._overlayContainers, function(c) {\n return c.element === element;\n });\n\n\n if (!container && !raw) {\n return this._createOverlayContainer(element);\n }\n\n return container;\n};\n\n\nOverlays.prototype._addOverlay = function(overlay) {\n\n var id = overlay.id,\n element = overlay.element,\n html = overlay.html,\n htmlContainer,\n overlayContainer;\n\n // unwrap jquery (for those who need it)\n if (html.get && html.constructor.prototype.jquery) {\n html = html.get(0);\n }\n\n // create proper html elements from\n // overlay HTML strings\n if (isString(html)) {\n html = domify(html);\n }\n\n overlayContainer = this._getOverlayContainer(element);\n\n htmlContainer = domify('
');\n\n htmlContainer.appendChild(html);\n\n if (overlay.type) {\n domClasses(htmlContainer).add('djs-overlay-' + overlay.type);\n }\n\n overlay.htmlContainer = htmlContainer;\n\n overlayContainer.overlays.push(overlay);\n overlayContainer.html.appendChild(htmlContainer);\n\n this._overlays[id] = overlay;\n\n this._updateOverlay(overlay);\n this._updateOverlayVisibilty(overlay, this._canvas.viewbox());\n};\n\n\nOverlays.prototype._updateOverlayVisibilty = function(overlay, viewbox) {\n var show = overlay.show,\n minZoom = show && show.minZoom,\n maxZoom = show && show.maxZoom,\n htmlContainer = overlay.htmlContainer,\n visible = true;\n\n if (show) {\n if (\n (isDef(minZoom) && minZoom > viewbox.scale) ||\n (isDef(maxZoom) && maxZoom < viewbox.scale)\n ) {\n visible = false;\n }\n\n setVisible(htmlContainer, visible);\n }\n\n this._updateOverlayScale(overlay, viewbox);\n};\n\n\nOverlays.prototype._updateOverlayScale = function(overlay, viewbox) {\n var shouldScale = overlay.scale,\n minScale,\n maxScale,\n htmlContainer = overlay.htmlContainer;\n\n var scale, transform = '';\n\n if (shouldScale !== true) {\n\n if (shouldScale === false) {\n minScale = 1;\n maxScale = 1;\n } else {\n minScale = shouldScale.min;\n maxScale = shouldScale.max;\n }\n\n if (isDef(minScale) && viewbox.scale < minScale) {\n scale = (1 / viewbox.scale || 1) * minScale;\n }\n\n if (isDef(maxScale) && viewbox.scale > maxScale) {\n scale = (1 / viewbox.scale || 1) * maxScale;\n }\n }\n\n if (isDef(scale)) {\n transform = 'scale(' + scale + ',' + scale + ')';\n }\n\n setTransform(htmlContainer, transform);\n};\n\n\nOverlays.prototype._updateOverlaysVisibilty = function(viewbox) {\n\n var self = this;\n\n forEach(this._overlays, function(overlay) {\n self._updateOverlayVisibilty(overlay, viewbox);\n });\n};\n\n\nOverlays.prototype._init = function() {\n\n var eventBus = this._eventBus;\n\n var self = this;\n\n\n // scroll/zoom integration\n\n function updateViewbox(viewbox) {\n self._updateRoot(viewbox);\n self._updateOverlaysVisibilty(viewbox);\n\n self.show();\n }\n\n eventBus.on('canvas.viewbox.changing', function(event) {\n self.hide();\n });\n\n eventBus.on('canvas.viewbox.changed', function(event) {\n updateViewbox(event.viewbox);\n });\n\n\n // remove integration\n\n eventBus.on([ 'shape.remove', 'connection.remove' ], function(e) {\n var element = e.element;\n var overlays = self.get({ element: element });\n\n forEach(overlays, function(o) {\n self.remove(o.id);\n });\n\n var container = self._getOverlayContainer(element);\n\n if (container) {\n domRemove(container.html);\n var i = self._overlayContainers.indexOf(container);\n if (i !== -1) {\n self._overlayContainers.splice(i, 1);\n }\n }\n });\n\n\n // move integration\n\n eventBus.on('element.changed', LOW_PRIORITY, function(e) {\n var element = e.element;\n\n var container = self._getOverlayContainer(element, true);\n\n if (container) {\n forEach(container.overlays, function(overlay) {\n self._updateOverlay(overlay);\n });\n\n self._updateOverlayContainer(container);\n }\n });\n\n\n // marker integration, simply add them on the overlays as classes, too.\n\n eventBus.on('element.marker.update', function(e) {\n var container = self._getOverlayContainer(e.element, true);\n if (container) {\n domClasses(container.html)[e.add ? 'add' : 'remove'](e.marker);\n }\n });\n\n\n // clear overlays with diagram\n\n eventBus.on('diagram.clear', this.clear, this);\n};\n","module.exports = {\n __init__: [ 'overlays' ],\n overlays: [ 'type', require(210) ]\n};","'use strict';\n\nvar isFunction = require(423),\n isArray = require(422),\n forEach = require(303);\n\nvar domify = require(449),\n domQuery = require(452),\n domAttr = require(444),\n domClear = require(446),\n domClasses = require(445),\n domMatches = require(451),\n domDelegate = require(448),\n domEvent = require(450);\n\n\nvar toggleSelector = '.djs-palette-toggle',\n entrySelector = '.entry',\n elementSelector = toggleSelector + ', ' + entrySelector;\n\n\n/**\n * A palette containing modeling elements.\n */\nfunction Palette(eventBus, canvas, dragging) {\n\n this._eventBus = eventBus;\n this._canvas = canvas;\n this._dragging = dragging;\n\n this._providers = [];\n\n var self = this;\n\n eventBus.on('tool-manager.update', function(event) {\n var tool = event.tool;\n\n self.updateToolHighlight(tool);\n });\n\n eventBus.on('i18n.changed', function() {\n self._update();\n });\n}\n\nPalette.$inject = [ 'eventBus', 'canvas', 'dragging' ];\n\nmodule.exports = Palette;\n\n\n/**\n * Register a provider with the palette\n *\n * @param {PaletteProvider} provider\n */\nPalette.prototype.registerProvider = function(provider) {\n this._providers.push(provider);\n\n if (!this._container) {\n this._init();\n }\n\n this._update();\n};\n\n\n/**\n * Returns the palette entries for a given element\n *\n * @return {Array} list of entries\n */\nPalette.prototype.getEntries = function() {\n\n var entries = {};\n\n // loop through all providers and their entries.\n // group entries by id so that overriding an entry is possible\n forEach(this._providers, function(provider) {\n var e = provider.getPaletteEntries();\n\n forEach(e, function(entry, id) {\n entries[id] = entry;\n });\n });\n\n return entries;\n};\n\n\n/**\n * Initialize\n */\nPalette.prototype._init = function() {\n var canvas = this._canvas,\n eventBus = this._eventBus;\n\n var parent = canvas.getContainer(),\n container = this._container = domify(Palette.HTML_MARKUP),\n self = this;\n\n parent.appendChild(container);\n\n domDelegate.bind(container, elementSelector, 'click', function(event) {\n\n var target = event.delegateTarget;\n\n if (domMatches(target, toggleSelector)) {\n return self.toggle();\n }\n\n self.trigger('click', event);\n });\n\n // prevent drag propagation\n domEvent.bind(container, 'mousedown', function(event) {\n event.stopPropagation();\n });\n\n // prevent drag propagation\n domDelegate.bind(container, entrySelector, 'dragstart', function(event) {\n self.trigger('dragstart', event);\n });\n\n eventBus.fire('palette.create', {\n html: container\n });\n\n eventBus.on('canvas.resized', this.triggerTwoColumn, this);\n};\n\n\nPalette.prototype._update = function() {\n\n var entriesContainer = domQuery('.djs-palette-entries', this._container),\n entries = this._entries = this.getEntries();\n\n domClear(entriesContainer);\n\n forEach(entries, function(entry, id) {\n\n var grouping = entry.group || 'default';\n\n var container = domQuery('[data-group=' + grouping + ']', entriesContainer);\n if (!container) {\n container = domify('
');\n entriesContainer.appendChild(container);\n }\n\n var html = entry.html || (\n entry.separator ?\n '
' :\n '
');\n\n\n var control = domify(html);\n container.appendChild(control);\n\n if (!entry.separator) {\n domAttr(control, 'data-action', id);\n\n if (entry.title) {\n domAttr(control, 'title', entry.title);\n }\n\n if (entry.className) {\n addClasses(control, entry.className);\n }\n\n if (entry.imageUrl) {\n control.appendChild(domify(''));\n }\n }\n });\n\n // open after update\n this.open(true);\n};\n\n\n/**\n * Trigger an action available on the palette\n *\n * @param {String} action\n * @param {Event} event\n */\nPalette.prototype.trigger = function(action, event, autoActivate) {\n var entries = this._entries,\n entry,\n handler,\n originalEvent,\n button = event.delegateTarget || event.target;\n\n if (!button) {\n return event.preventDefault();\n }\n\n entry = entries[domAttr(button, 'data-action')];\n\n // when user clicks on the palette and not on an action\n if (!entry) {\n return;\n }\n\n handler = entry.action;\n\n originalEvent = event.originalEvent || event;\n\n // simple action (via callback function)\n if (isFunction(handler)) {\n if (action === 'click') {\n handler(originalEvent, autoActivate);\n }\n } else {\n if (handler[action]) {\n handler[action](originalEvent, autoActivate);\n }\n }\n\n // silence other actions\n event.preventDefault();\n};\n\nPalette.prototype.triggerTwoColumn = function() {\n var canvas = this._canvas;\n\n var parent = canvas.getContainer();\n\n if (parent.clientHeight < 650) {\n domClasses(parent).add('two-column');\n } else {\n domClasses(parent).remove('two-column');\n }\n};\n\n\n/**\n * Close the palette\n */\nPalette.prototype.close = function() {\n var canvas = this._canvas;\n\n var parent = canvas.getContainer();\n\n domClasses(this._container).remove('open');\n\n domClasses(parent).remove('two-column');\n};\n\n\n/**\n * Open the palette\n */\nPalette.prototype.open = function() {\n domClasses(this._container).add('open');\n\n this.triggerTwoColumn();\n};\n\n\nPalette.prototype.toggle = function(open) {\n if (this.isOpen()) {\n this.close();\n } else {\n this.open();\n }\n};\n\nPalette.prototype.isActiveTool = function(tool) {\n return tool && this._activeTool === tool;\n};\n\nPalette.prototype.updateToolHighlight = function(name) {\n var entriesContainer,\n toolsContainer;\n\n if (!this._toolsContainer) {\n entriesContainer = domQuery('.djs-palette-entries', this._container);\n\n this._toolsContainer = domQuery('[data-group=tools]', entriesContainer);\n }\n\n toolsContainer = this._toolsContainer;\n\n forEach(toolsContainer.children, function(tool) {\n var actionName = tool.getAttribute('data-action');\n\n if (!actionName) {\n return;\n }\n\n actionName = actionName.replace('-tool', '');\n\n if (tool.classList.contains('entry') && actionName === name) {\n domClasses(tool).add('highlighted-entry');\n } else {\n domClasses(tool).remove('highlighted-entry');\n }\n });\n};\n\n\n/**\n * Return true if the palette is opened.\n *\n * @example\n *\n * palette.open();\n *\n * if (palette.isOpen()) {\n * // yes, we are open\n * }\n *\n * @return {boolean} true if palette is opened\n */\nPalette.prototype.isOpen = function() {\n return this._container && domClasses(this._container).has('open');\n};\n\n\n/* markup definition */\n\nPalette.HTML_MARKUP =\n '
' +\n '
' +\n '
' +\n '
';\n\n\n////////// helpers /////////////////////////////\n\nfunction addClasses(element, classNames) {\n\n var classes = domClasses(element);\n\n var actualClassNames = isArray(classNames) ? classNames : classNames.split(//s+/g);\n actualClassNames.forEach(function(cls) {\n classes.add(cls);\n });\n}\n","'use strict';\n\nmodule.exports = {\n __depends__: [ require(242) ],\n __init__: [ 'palette' ],\n palette: [ 'type', require(212) ]\n};\n","'use strict';\n\nvar forEach = require(303),\n assign = require(431),\n find = require(302);\n\nvar domDelegate = require(448),\n domify = require(449),\n domClasses = require(445),\n domAttr = require(444),\n domRemove = require(453);\n\nvar DATA_REF = 'data-id';\n\n/**\n * A popup menu that can be used to display a list of actions anywhere in the canvas.\n *\n * @param {EventBus} eventBus\n * @param {Canvas} canvas\n *\n * @class\n * @constructor\n */\nfunction PopupMenu(eventBus, canvas) {\n\n this._eventBus = eventBus;\n this._canvas = canvas;\n this._providers = {};\n}\n\nPopupMenu.$inject = [ 'eventBus', 'canvas' ];\n\n/**\n * Registers a popup menu provider\n *\n * @param {String} id\n * @param {Object} provider\n *\n * @example\n * popupMenu.registerProvider('myMenuID', {\n * getEntries: function(element) {\n * return [\n * {\n * id: 'entry-1',\n * label: 'My Entry',\n * action: 'alert(\"I have been clicked!\")'\n * }\n * ];\n * }\n * });\n * })\n */\nPopupMenu.prototype.registerProvider = function(id, provider) {\n this._providers[id] = provider;\n};\n\n\n/**\n * Create a popup menu according to a given element. The id refers to the ID\n * of the provider that must be registered before.\n *\n * @param {String} id provider id\n * @param {Object} element\n *\n * @return {PopupMenu} popup menu instance\n */\nPopupMenu.prototype.create = function(id, element) {\n\n var provider = this._providers[id];\n\n if (!provider) {\n throw new Error('Provider is not registered: ' + id);\n }\n\n if (!element) {\n throw new Error('Element is missing');\n }\n\n var current = this._current = {\n provider: provider,\n className: id,\n element: element\n };\n\n if (provider.getHeaderEntries) {\n current.headerEntries = provider.getHeaderEntries(element);\n }\n\n current.entries = provider.getEntries(element);\n\n return this;\n};\n\n\n/**\n * Determine if the popup menu has entries.\n *\n * @return {Boolean} true if empty\n */\nPopupMenu.prototype.isEmpty = function() {\n\n var current = this._current;\n\n return current.entries.length === 0 && current.headerEntries && current.headerEntries.length === 0;\n};\n\n\n/**\n * Open popup menu at given position\n *\n * @param {Object} position\n *\n * @return {Object} popup menu instance\n */\nPopupMenu.prototype.open = function(position) {\n\n if (!position) {\n throw new Error('the position argument is missing');\n }\n\n // make sure, only one popup menu is open at a time\n if (this.isOpen()) {\n this.close();\n }\n\n var current = this._current,\n canvas = this._canvas,\n parent = canvas.getContainer();\n\n current.position = position;\n\n current.container = this._createContainer();\n\n if (current.headerEntries) {\n var headerEntriesContainer = this._createEntries(current.headerEntries, 'djs-popup-header');\n\n current.container.appendChild(headerEntriesContainer);\n }\n\n if (current.entries) {\n var entriesContainer = this._createEntries(current.entries, 'djs-popup-body');\n\n current.container.appendChild(entriesContainer);\n }\n\n this._attachContainer(current.container, parent, position.cursor);\n\n return this;\n};\n\n\n/**\n * Removes the popup menu and unbinds the event handlers.\n */\nPopupMenu.prototype.close = function() {\n\n if (!this.isOpen()) {\n return;\n }\n\n this._unbindHandlers();\n domRemove(this._current.container);\n this._current.container = null;\n};\n\n\n/**\n * Determine if an open popup menu exist.\n *\n * @return {Boolean} true if open\n */\nPopupMenu.prototype.isOpen = function() {\n return !!this._current.container;\n};\n\n\n/**\n * Trigger an action associated with an entry.\n *\n * @param {Object} event\n *\n * @return the result of the action callback, if any\n */\nPopupMenu.prototype.trigger = function(event) {\n\n // silence other actions\n event.preventDefault();\n\n var element = event.delegateTarget || event.target,\n entryId = domAttr(element, DATA_REF);\n\n var entry = this._getEntry(entryId);\n\n if (entry.action) {\n return entry.action.call(null, event, entry);\n }\n};\n\n/**\n * Gets an entry instance (either entry or headerEntry) by id.\n *\n * @param {String} entryId\n *\n * @return {Object} entry instance\n */\nPopupMenu.prototype._getEntry = function(entryId) {\n\n var search = { id: entryId };\n\n var entry = find(this._current.entries, search) || find(this._current.headerEntries, search);\n\n if (!entry) {\n throw new Error('entry not found');\n }\n\n return entry;\n};\n\n\n/**\n * Creates the popup menu container.\n *\n * @return {Object} a DOM container\n */\nPopupMenu.prototype._createContainer = function() {\n var container = domify('
'),\n position = this._current.position,\n className = this._current.className;\n\n assign(container.style, {\n position: 'absolute',\n left: position.x + 'px',\n top: position.y + 'px',\n visibility: 'hidden'\n });\n\n domClasses(container).add(className);\n\n return container;\n};\n\n\n/**\n * Attaches the container to the DOM and binds the event handlers.\n *\n * @param {Object} container\n * @param {Object} parent\n */\nPopupMenu.prototype._attachContainer = function(container, parent, cursor) {\n var self = this;\n\n // Event handler\n domDelegate.bind(container, '.entry' ,'click', function(event) {\n self.trigger(event);\n });\n\n // apply canvas zoom level\n var zoom = this._canvas.zoom();\n\n container.style.transformOrigin = 'top left';\n container.style.transform = 'scale(' + zoom + ')';\n\n // Attach to DOM\n parent.appendChild(container);\n\n if (cursor) {\n this._assureIsInbounds(container, cursor);\n }\n\n // Add Handler\n this._bindHandlers();\n};\n\n\n/**\n * Make sure that the menu is always fully shown\n *\n * @method function\n *\n * @param {Object} container\n * @param {Position} cursor {x, y}\n */\nPopupMenu.prototype._assureIsInbounds = function(container, cursor) {\n var canvas = this._canvas,\n clientRect = canvas._container.getBoundingClientRect();\n\n var containerX = container.offsetLeft,\n containerY = container.offsetTop,\n containerWidth = container.scrollWidth,\n containerHeight = container.scrollHeight,\n overAxis = {},\n left, top;\n\n var cursorPosition = {\n x: cursor.x - clientRect.left,\n y: cursor.y - clientRect.top\n };\n\n if (containerX + containerWidth > clientRect.width) {\n overAxis.x = true;\n }\n\n if (containerY + containerHeight > clientRect.height) {\n overAxis.y = true;\n }\n\n if (overAxis.x && overAxis.y) {\n left = cursorPosition.x - containerWidth + 'px';\n top = cursorPosition.y - containerHeight + 'px';\n } else if (overAxis.x) {\n left = cursorPosition.x - containerWidth + 'px';\n top = cursorPosition.y + 'px';\n } else if (overAxis.y && cursorPosition.y < containerHeight) {\n left = cursorPosition.x + 'px';\n top = 10 + 'px';\n } else if (overAxis.y) {\n left = cursorPosition.x + 'px';\n top = cursorPosition.y - containerHeight + 'px';\n }\n\n assign(container.style, { left: left, top: top }, { visibility: 'visible', 'z-index': 1000 });\n};\n\n\n/**\n * Creates a list of entries and returns them as a DOM container.\n *\n * @param {Array} entries an array of entry objects\n * @param {String} className the class name of the entry container\n *\n * @return {Object} a DOM container\n */\nPopupMenu.prototype._createEntries = function(entries, className) {\n\n var entriesContainer = domify('
'),\n self = this;\n\n domClasses(entriesContainer).add(className);\n\n forEach(entries, function(entry) {\n var entryContainer = self._createEntry(entry, entriesContainer);\n entriesContainer.appendChild(entryContainer);\n });\n\n return entriesContainer;\n};\n\n\n/**\n * Creates a single entry and returns it as a DOM container.\n *\n * @param {Object} entry\n *\n * @return {Object} a DOM container\n */\nPopupMenu.prototype._createEntry = function(entry) {\n\n if (!entry.id) {\n throw new Error ('every entry must have the id property set');\n }\n\n var entryContainer = domify('
'),\n entryClasses = domClasses(entryContainer);\n\n entryClasses.add('entry');\n\n if (entry.className) {\n entryClasses.add(entry.className);\n }\n\n domAttr(entryContainer, DATA_REF, entry.id);\n\n if (entry.label) {\n var label = domify('');\n label.textContent = entry.label;\n entryContainer.appendChild(label);\n }\n\n if (entry.imageUrl) {\n entryContainer.appendChild(domify(''));\n }\n\n if (entry.active === true) {\n entryClasses.add('active');\n }\n\n if (entry.disabled === true) {\n entryClasses.add('disabled');\n }\n\n if (entry.title) {\n entryContainer.title = entry.title;\n }\n\n return entryContainer;\n};\n\n\n/**\n * Binds the `close` method to 'contextPad.close' & 'canvas.viewbox.changed'.\n */\nPopupMenu.prototype._bindHandlers = function() {\n\n var eventBus = this._eventBus,\n self = this;\n\n function close() {\n self.close();\n }\n\n eventBus.once('contextPad.close', close);\n eventBus.once('canvas.viewbox.changing', close);\n eventBus.once('commandStack.changed', close);\n};\n\n\n/**\n * Unbinds the `close` method to 'contextPad.close' & 'canvas.viewbox.changing'.\n */\nPopupMenu.prototype._unbindHandlers = function() {\n\n var eventBus = this._eventBus,\n self = this;\n\n function close() {\n self.close();\n }\n\n eventBus.off('contextPad.close', close);\n eventBus.off('canvas.viewbox.changed', close);\n eventBus.off('commandStack.changed', close);\n};\n\nmodule.exports = PopupMenu;\n","'use strict';\n\nmodule.exports = {\n __init__: [ 'popupMenu' ],\n popupMenu: [ 'type', require(214) ]\n};\n","'use strict';\r\n\r\nvar forEach = require(303);\r\n\r\nvar svgAppend = require(472),\r\n svgAttr = require(474),\r\n svgClone = require(477),\r\n svgCreate = require(478);\r\n\r\n/**\r\n * Adds support for previews of moving/resizing elements.\r\n */\r\nfunction PreviewSupport(elementRegistry, canvas, styles) {\r\n this._elementRegistry = elementRegistry;\r\n this._canvas = canvas;\r\n this._styles = styles;\r\n}\r\n\r\nmodule.exports = PreviewSupport;\r\n\r\nPreviewSupport.$inject = [ 'elementRegistry', 'canvas', 'styles' ];\r\n\r\n\r\n/**\r\n * Returns graphics of an element.\r\n *\r\n * @param {djs.model.Base} element\r\n *\r\n * @return {SVGElement}\r\n */\r\nPreviewSupport.prototype.getGfx = function(element) {\r\n return this._elementRegistry.getGraphics(element);\r\n};\r\n\r\n/**\r\n * Adds a move preview of a given shape to a given svg group.\r\n *\r\n * @param {djs.model.Base} element\r\n * @param {SVGElement} group\r\n *\r\n * @return {SVGElement} dragger\r\n */\r\nPreviewSupport.prototype.addDragger = function(shape, group) {\r\n var gfx = this.getGfx(shape);\r\n\r\n // clone is not included in tsvg for some reason\r\n var dragger = svgClone(gfx);\r\n var bbox = gfx.getBoundingClientRect();\r\n\r\n // remove markers from connections\r\n if (isConnection(shape)) {\r\n removeMarkers(dragger);\r\n }\r\n\r\n svgAttr(dragger, this._styles.cls('djs-dragger', [], {\r\n x: bbox.top,\r\n y: bbox.left\r\n }));\r\n\r\n svgAppend(group, dragger);\r\n\r\n return dragger;\r\n};\r\n\r\n/**\r\n * Adds a resize preview of a given shape to a given svg group.\r\n *\r\n * @param {djs.model.Base} element\r\n * @param {SVGElement} group\r\n *\r\n * @return {SVGElement} frame\r\n */\r\nPreviewSupport.prototype.addFrame = function(shape, group) {\r\n\r\n var frame = svgCreate('rect', {\r\n class: 'djs-resize-overlay',\r\n width: shape.width,\r\n height: shape.height,\r\n x: shape.x,\r\n y: shape.y\r\n });\r\n\r\n svgAppend(group, frame);\r\n\r\n return frame;\r\n};\r\n\r\n////////// helpers //////////\r\n\r\n/**\r\n * Removes all svg marker references from an SVG.\r\n *\r\n * @param {SVGElement} gfx\r\n */\r\nfunction removeMarkers(gfx) {\r\n\r\n if (gfx.children) {\r\n\r\n forEach(gfx.children, function(child) {\r\n\r\n // recursion\r\n removeMarkers(child);\r\n\r\n });\r\n\r\n }\r\n\r\n gfx.style.markerStart = '';\r\n gfx.style.markerEnd = '';\r\n\r\n}\r\n\r\n/**\r\n * Checks if an element is a connection.\r\n */\r\nfunction isConnection(element) {\r\n return element.waypoints;\r\n}\r\n","'use strict';\n\nmodule.exports = {\n __init__: [ 'previewSupport' ],\n previewSupport: [ 'type', require(216) ]\n};\n","'use strict';\n\n\n/**\n * Service that allow replacing of elements.\n *\n *\n * @class\n * @constructor\n */\nfunction Replace(modeling) {\n\n this._modeling = modeling;\n}\n\nmodule.exports = Replace;\n\nReplace.$inject = [ 'modeling' ];\n\n/**\n * @param {Element} oldElement - Element to be replaced\n * @param {Object} newElementData - Containing information about the new Element, for example height, width, type.\n * @param {Object} options - Custom options that will be attached to the context. It can be used to inject data\n * that is needed in the command chain. For example it could be used in\n * eventbus.on('commandStack.shape.replace.postExecute') to change shape attributes after\n * shape creation.\n */\nReplace.prototype.replaceElement = function(oldElement, newElementData, options) {\n\n var modeling = this._modeling;\n\n var newElement = null;\n\n if (oldElement.waypoints) {\n // TODO\n // modeling.replaceConnection\n } else {\n // set center of element for modeling API\n // if no new width / height is given use old elements size\n newElementData.x = Math.ceil(oldElement.x + (newElementData.width || oldElement.width) / 2);\n newElementData.y = Math.ceil(oldElement.y + (newElementData.height || oldElement.height) / 2);\n\n newElement = modeling.replaceShape(oldElement, newElementData, options);\n }\n\n return newElement;\n};\n","'use strict';\n\nmodule.exports = {\n __init__: [ 'replace' ],\n replace: [ 'type', require(218) ]\n};\n","'use strict';\n\nvar pick = require(438),\n assign = require(431);\n\nvar ResizeUtil = require(223);\n\nvar asTRBL = require(252).asTRBL,\n roundBounds = require(252).roundBounds;\n\nvar DEFAULT_MIN_WIDTH = 10;\n\n\n/**\n * A component that provides resizing of shapes on the canvas.\n *\n * The following components are part of shape resize:\n *\n * * adding resize handles,\n * * creating a visual during resize\n * * checking resize rules\n * * committing a change once finished\n *\n *\n * ## Customizing\n *\n * It's possible to customize the resizing behaviour by intercepting 'resize.start'\n * and providing the following parameters through the 'context':\n *\n * * minDimensions ({ width, height }): minimum shape dimensions\n *\n * * childrenBoxPadding ({ left, top, bottom, right } || number):\n * gap between the minimum bounding box and the container\n *\n * f.ex:\n *\n * ```javascript\n * eventBus.on('resize.start', 1500, function(event) {\n * var context = event.context,\n *\n * context.minDimensions = { width: 140, height: 120 };\n *\n * // Passing general padding\n * context.childrenBoxPadding = 30;\n *\n * // Passing padding to a specific side\n * context.childrenBoxPadding.left = 20;\n * });\n * ```\n */\nfunction Resize(eventBus, rules, modeling, dragging) {\n\n this._dragging = dragging;\n this._rules = rules;\n\n var self = this;\n\n eventBus.on('resize.start', function(event) {\n\n var context = event.context,\n resizeConstraints = context.resizeConstraints,\n // evaluate minBounds for backwards compatibility\n minBounds = context.minBounds;\n\n if (resizeConstraints === undefined) {\n\n if (minBounds === undefined) {\n minBounds = self.computeMinResizeBox(context);\n }\n\n context.resizeConstraints = {\n min: asTRBL(minBounds)\n };\n }\n });\n\n eventBus.on('resize.move', function(event) {\n\n var context = event.context,\n shape = context.shape,\n direction = context.direction,\n resizeConstraints = context.resizeConstraints,\n delta,\n newBounds;\n\n delta = {\n x: event.dx,\n y: event.dy\n };\n\n context.delta = delta;\n\n newBounds = ResizeUtil.resizeBounds(shape, direction, delta);\n\n // ensure constraints during resize\n context.newBounds = ResizeUtil.ensureConstraints(newBounds, resizeConstraints);\n\n // update + cache executable state\n context.canExecute = self.canResize(context);\n });\n\n eventBus.on('resize.end', function(event) {\n var context = event.context,\n shape = context.shape,\n canExecute = context.canExecute,\n newBounds = context.newBounds;\n\n if (canExecute) {\n // ensure we have actual pixel values for new bounds\n // (important when zoom level was > 1 during move)\n newBounds = roundBounds(newBounds);\n\n // perform the actual resize\n modeling.resizeShape(shape, newBounds);\n }\n });\n}\n\n\nResize.prototype.canResize = function(context) {\n var rules = this._rules;\n\n var ctx = pick(context, [ 'newBounds', 'shape', 'delta', 'direction' ]);\n\n return rules.allowed('shape.resize', ctx);\n};\n\n/**\n * Activate a resize operation\n *\n * You may specify additional contextual information and must specify a\n * resize direction during activation of the resize event.\n *\n * @param {MouseEvent} event\n * @param {djs.model.Shape} shape\n * @param {Object|String} contextOrDirection\n */\nResize.prototype.activate = function(event, shape, contextOrDirection) {\n var dragging = this._dragging,\n context,\n direction;\n\n if (typeof contextOrDirection === 'string') {\n contextOrDirection = {\n direction: contextOrDirection\n };\n }\n\n context = assign({ shape: shape }, contextOrDirection);\n\n direction = context.direction;\n\n if (!direction) {\n throw new Error('must provide a direction (nw|se|ne|sw)');\n }\n\n dragging.init(event, 'resize', {\n autoActivate: true,\n cursor: 'resize-' + (/nw|se/.test(direction) ? 'nwse' : 'nesw'),\n data: {\n shape: shape,\n context: context\n }\n });\n};\n\nResize.prototype.computeMinResizeBox = function(context) {\n var shape = context.shape,\n direction = context.direction,\n minDimensions,\n childrenBounds;\n\n minDimensions = context.minDimensions || {\n width: DEFAULT_MIN_WIDTH,\n height: DEFAULT_MIN_WIDTH\n };\n\n // get children bounds\n childrenBounds = ResizeUtil.computeChildrenBBox(shape, context.childrenBoxPadding);\n\n // get correct minimum bounds from given resize direction\n // basically ensures that the minBounds is max(childrenBounds, minDimensions)\n return ResizeUtil.getMinResizeBounds(direction, shape, minDimensions, childrenBounds);\n};\n\n\nResize.$inject = [ 'eventBus', 'rules', 'modeling', 'dragging' ];\n\nmodule.exports = Resize;\n","'use strict';\n\nvar forEach = require(303);\n\nvar HANDLE_OFFSET = -2,\n HANDLE_SIZE = 5,\n HANDLE_HIT_SIZE = 20;\n\nvar CLS_RESIZER = 'djs-resizer';\n\nvar svgAppend = require(472),\n svgAttr = require(474),\n svgClasses = require(475),\n svgClear = require(476),\n svgCreate = require(478);\n\nvar domEvent = require(450);\n\nvar isPrimaryButton = require(274).isPrimaryButton;\n\nvar asTRBL = require(252).asTRBL;\n\nvar transform = require(279).transform;\n\n\n/**\n * This component is responsible for adding resize handles.\n *\n * @param {EventBus} eventBus\n * @param {Canvas} canvas\n * @param {Selection} selection\n * @param {Resize} resize\n */\nfunction ResizeHandles(eventBus, canvas, selection, resize) {\n\n this._resize = resize;\n this._canvas = canvas;\n\n var self = this;\n\n eventBus.on('selection.changed', function(e) {\n var newSelection = e.newSelection;\n\n // remove old selection markers\n self.removeResizers();\n\n // add new selection markers ONLY if single selection\n if (newSelection.length === 1) {\n forEach(newSelection, self.addResizer, self);\n }\n });\n\n eventBus.on('shape.changed', function(e) {\n var shape = e.element;\n\n if (selection.isSelected(shape)) {\n self.removeResizers();\n\n self.addResizer(shape);\n }\n });\n}\n\n\nResizeHandles.prototype.makeDraggable = function(element, gfx, direction) {\n var resize = this._resize;\n\n function startResize(event) {\n // only trigger on left mouse button\n if (isPrimaryButton(event)) {\n resize.activate(event, element, direction);\n }\n }\n\n domEvent.bind(gfx, 'mousedown', startResize);\n domEvent.bind(gfx, 'touchstart', startResize);\n};\n\n\nResizeHandles.prototype._createResizer = function(element, x, y, rotation, direction) {\n var resizersParent = this._getResizersParent();\n\n var group = svgCreate('g');\n svgClasses(group).add(CLS_RESIZER);\n svgClasses(group).add(CLS_RESIZER + '-' + element.id);\n svgClasses(group).add(CLS_RESIZER + '-' + direction);\n\n svgAppend(resizersParent, group);\n\n var origin = -HANDLE_SIZE + HANDLE_OFFSET;\n\n // Create four drag indicators on the outline\n var visual = svgCreate('rect');\n svgAttr(visual, {\n x: origin,\n y: origin,\n width: HANDLE_SIZE,\n height: HANDLE_SIZE\n });\n svgClasses(visual).add(CLS_RESIZER + '-visual');\n\n svgAppend(group, visual);\n\n var hit = svgCreate('rect');\n svgAttr(hit, {\n x: origin,\n y: origin,\n width: HANDLE_HIT_SIZE,\n height: HANDLE_HIT_SIZE\n });\n svgClasses(hit).add(CLS_RESIZER + '-hit');\n\n svgAppend(group, hit);\n\n transform(group, x, y, rotation);\n\n return group;\n};\n\nResizeHandles.prototype.createResizer = function(element, direction) {\n var resizer;\n\n var trbl = asTRBL(element);\n\n if (direction === 'nw') {\n resizer = this._createResizer(element, trbl.left, trbl.top, 0, direction);\n } else if (direction === 'ne') {\n resizer = this._createResizer(element, trbl.right, trbl.top, 90, direction);\n } else if (direction === 'se') {\n resizer = this._createResizer(element, trbl.right, trbl.bottom, 180, direction);\n } else {\n resizer = this._createResizer(element, trbl.left, trbl.bottom, 270, direction);\n }\n\n this.makeDraggable(element, resizer, direction);\n};\n\n// resize handles implementation ///////////////////////////////\n\n/**\n * Add resizers for a given element.\n *\n * @param {djs.model.Shape} shape\n */\nResizeHandles.prototype.addResizer = function(shape) {\n var resize = this._resize;\n\n if (!resize.canResize({ shape: shape })) {\n return;\n }\n\n this.createResizer(shape, 'nw');\n this.createResizer(shape, 'ne');\n this.createResizer(shape, 'se');\n this.createResizer(shape, 'sw');\n};\n\n/**\n * Remove all resizers\n */\nResizeHandles.prototype.removeResizers = function() {\n var resizersParent = this._getResizersParent();\n\n svgClear(resizersParent);\n};\n\nResizeHandles.prototype._getResizersParent = function() {\n return this._canvas.getLayer('resizers');\n};\n\nResizeHandles.$inject = [ 'eventBus', 'canvas', 'selection', 'resize' ];\n\nmodule.exports = ResizeHandles;\n","'use strict';\n\nvar MARKER_RESIZING = 'djs-resizing',\n MARKER_RESIZE_NOT_OK = 'resize-not-ok';\n\nvar LOW_PRIORITY = 500;\n\nvar svgAttr = require(474),\n svgRemove = require(481);\n\nvar svgClasses = require(475);\n\n\n/**\n * Provides previews for resizing shapes when resizing.\n *\n * @param {EventBus} eventBus\n * @param {ElementRegistry} elementRegistry\n * @param {Canvas} canvas\n * @param {Styles} styles\n */\nfunction ResizePreview(eventBus, elementRegistry, canvas, styles, previewSupport) {\n\n // add and update previews\n eventBus.on('resize.move', LOW_PRIORITY, function(event) {\n var context = event.context,\n shape = context.shape,\n bounds = context.newBounds,\n frame = context.frame;\n\n if (!frame) {\n frame = context.frame = previewSupport.addFrame(shape, canvas.getDefaultLayer());\n\n canvas.addMarker(shape, MARKER_RESIZING);\n }\n\n if (bounds.width > 5) {\n svgAttr(frame, { x: bounds.x, width: bounds.width });\n }\n\n if (bounds.height > 5) {\n svgAttr(frame, { y: bounds.y, height: bounds.height });\n }\n\n if (context.canExecute) {\n svgClasses(frame).remove(MARKER_RESIZE_NOT_OK);\n } else {\n svgClasses(frame).add(MARKER_RESIZE_NOT_OK);\n }\n\n });\n\n // remove previews\n eventBus.on('resize.cleanup', function(event) {\n var context = event.context,\n shape = context.shape,\n frame = context.frame;\n\n if (frame) {\n svgRemove(context.frame);\n }\n\n canvas.removeMarker(shape, MARKER_RESIZING);\n });\n}\n\nResizePreview.$inject = [ 'eventBus', 'elementRegistry', 'canvas', 'styles', 'previewSupport'];\n\nmodule.exports = ResizePreview;\n","'use strict';\n\nvar filter = require(301);\n\nvar max = Math.max,\n min = Math.min;\n\nvar DEFAULT_CHILD_BOX_PADDING = 20;\n\nvar getBBox = require(266).getBBox;\n\n\nvar asTRBL = require(252).asTRBL,\n asBounds = require(252).asBounds;\n\nfunction isNumber(a) {\n return typeof a === 'number';\n}\n\n/**\n * Substract a TRBL from another\n *\n * @param {TRBL} trblA\n * @param {TRBL} trblB\n *\n * @return {TRBL}\n */\nmodule.exports.substractTRBL = function(trblA, trblB) {\n return {\n top: trblA.top - trblB.top,\n right: trblA.right - trblB.right,\n bottom: trblA.bottom - trblB.bottom,\n left: trblA.left - trblB.left\n };\n};\n\n/**\n * Resize the given bounds by the specified delta from a given anchor point.\n *\n * @param {Bounds} bounds the bounding box that should be resized\n * @param {String} direction in which the element is resized (nw, ne, se, sw)\n * @param {Point} delta of the resize operation\n *\n * @return {Bounds} resized bounding box\n */\nmodule.exports.resizeBounds = function(bounds, direction, delta) {\n\n var dx = delta.x,\n dy = delta.y;\n\n switch (direction) {\n\n case 'nw':\n return {\n x: bounds.x + dx,\n y: bounds.y + dy,\n width: bounds.width - dx,\n height: bounds.height - dy\n };\n\n case 'sw':\n return {\n x: bounds.x + dx,\n y: bounds.y,\n width: bounds.width - dx,\n height: bounds.height + dy\n };\n\n case 'ne':\n return {\n x: bounds.x,\n y: bounds.y + dy,\n width: bounds.width + dx,\n height: bounds.height - dy\n };\n\n case 'se':\n return {\n x: bounds.x,\n y: bounds.y,\n width: bounds.width + dx,\n height: bounds.height + dy\n };\n\n default:\n throw new Error('unrecognized direction: ' + direction);\n }\n};\n\n\n/**\n * Resize the given bounds by applying the passed\n * { top, right, bottom, left } delta.\n *\n * @param {Bounds} bounds\n * @param {TRBL} trblResize\n *\n * @return {Bounds}\n */\nmodule.exports.resizeTRBL = function(bounds, resize) {\n return {\n x: bounds.x + (resize.left || 0),\n y: bounds.y + (resize.top || 0),\n width: bounds.width - (resize.left || 0) + (resize.right || 0),\n height: bounds.height - (resize.top || 0) + (resize.bottom || 0)\n };\n};\n\n\nmodule.exports.reattachPoint = function(bounds, newBounds, point) {\n\n var sx = bounds.width / newBounds.width,\n sy = bounds.height / newBounds.height;\n\n return {\n x: Math.round((newBounds.x + newBounds.width / 2)) - Math.floor(((bounds.x + bounds.width / 2) - point.x) / sx),\n y: Math.round((newBounds.y + newBounds.height / 2)) - Math.floor(((bounds.y + bounds.height / 2) - point.y) / sy)\n };\n};\n\n\nfunction applyConstraints(attr, trbl, resizeConstraints) {\n\n var value = trbl[attr],\n minValue = resizeConstraints.min && resizeConstraints.min[attr],\n maxValue = resizeConstraints.max && resizeConstraints.max[attr];\n\n if (isNumber(minValue)) {\n value = (/top|left/.test(attr) ? min : max)(value, minValue);\n }\n\n if (isNumber(maxValue)) {\n value = (/top|left/.test(attr) ? max : min)(value, maxValue);\n }\n\n return value;\n}\n\nmodule.exports.ensureConstraints = function(currentBounds, resizeConstraints) {\n\n if (!resizeConstraints) {\n return currentBounds;\n }\n\n var currentTrbl = asTRBL(currentBounds);\n\n return asBounds({\n top: applyConstraints('top', currentTrbl, resizeConstraints),\n right: applyConstraints('right', currentTrbl, resizeConstraints),\n bottom: applyConstraints('bottom', currentTrbl, resizeConstraints),\n left: applyConstraints('left', currentTrbl, resizeConstraints)\n });\n};\n\n\nmodule.exports.getMinResizeBounds = function(direction, currentBounds, minDimensions, childrenBounds) {\n\n var currentBox = asTRBL(currentBounds);\n\n var minBox = {\n top: /n/.test(direction) ? currentBox.bottom - minDimensions.height : currentBox.top,\n left: /w/.test(direction) ? currentBox.right - minDimensions.width : currentBox.left,\n bottom: /s/.test(direction) ? currentBox.top + minDimensions.height : currentBox.bottom,\n right: /e/.test(direction) ? currentBox.left + minDimensions.width : currentBox.right\n };\n\n var childrenBox = childrenBounds ? asTRBL(childrenBounds) : minBox;\n\n var combinedBox = {\n top: min(minBox.top, childrenBox.top),\n left: min(minBox.left, childrenBox.left),\n bottom: max(minBox.bottom, childrenBox.bottom),\n right: max(minBox.right, childrenBox.right)\n };\n\n return asBounds(combinedBox);\n};\n\nfunction asPadding(mayBePadding, defaultValue) {\n if (typeof mayBePadding !== 'undefined') {\n return mayBePadding;\n } else {\n return DEFAULT_CHILD_BOX_PADDING;\n }\n}\n\nfunction addPadding(bbox, padding) {\n var left, right, top, bottom;\n\n if (typeof padding === 'object') {\n left = asPadding(padding.left);\n right = asPadding(padding.right);\n top = asPadding(padding.top);\n bottom = asPadding(padding.bottom);\n } else {\n left = right = top = bottom = asPadding(padding);\n }\n\n return {\n x: bbox.x - left,\n y: bbox.y - top,\n width: bbox.width + left + right,\n height: bbox.height + top + bottom\n };\n}\n\nmodule.exports.addPadding = addPadding;\n\n\n/**\n * Is the given element part of the resize\n * targets min boundary box?\n *\n * This is the default implementation which excludes\n * connections and labels.\n *\n * @param {djs.model.Base} element\n */\nfunction isBBoxChild(element) {\n\n // exclude connections\n if (element.waypoints) {\n return false;\n }\n\n // exclude labels\n if (element.type === 'label') {\n return false;\n }\n\n return true;\n}\n\n/**\n * Return children bounding computed from a shapes children\n * or a list of prefiltered children.\n *\n * @param {djs.model.Shape|Array} shapeOrChildren\n * @param {Number|Object} padding\n *\n * @return {Bounds}\n */\nfunction computeChildrenBBox(shapeOrChildren, padding) {\n\n var elements;\n\n // compute based on shape\n if (shapeOrChildren.length === undefined) {\n // grab all the children that are part of the\n // parents children box\n elements = filter(shapeOrChildren.children, isBBoxChild);\n\n } else {\n elements = shapeOrChildren;\n }\n\n if (elements.length) {\n return addPadding(getBBox(elements), padding);\n }\n}\n\nmodule.exports.computeChildrenBBox = computeChildrenBBox;\n","module.exports = {\n __depends__: [\n require(227),\n require(162),\n require(217)\n ],\n __init__: [ 'resize', 'resizePreview', 'resizeHandles' ],\n resize: [ 'type', require(220) ],\n resizePreview: [ 'type', require(222) ],\n resizeHandles: [ 'type', require(221) ]\n};\n","\n'use strict';\n\nvar inherits = require(289);\n\nvar CommandInterceptor = require(119);\n\n/**\n * A basic provider that may be extended to implement modeling rules.\n *\n * Extensions should implement the init method to actually add their custom\n * modeling checks. Checks may be added via the #addRule(action, fn) method.\n *\n * @param {EventBus} eventBus\n */\nfunction RuleProvider(eventBus) {\n CommandInterceptor.call(this, eventBus);\n\n this.init();\n}\n\nRuleProvider.$inject = [ 'eventBus' ];\n\ninherits(RuleProvider, CommandInterceptor);\n\nmodule.exports = RuleProvider;\n\n\n/**\n * Adds a modeling rule for the given action, implemented through\n * a callback function.\n *\n * The function will receive the modeling specific action context\n * to perform its check. It must return `false` to disallow the\n * action from happening or `true` to allow the action.\n *\n * A rule provider may pass over the evaluation to lower priority\n * rules by returning return nothing (or undefined).\n *\n * @example\n *\n * ResizableRules.prototype.init = function() {\n *\n * //**\n * * Return `true`, `false` or nothing to denote\n * * _allowed_, _not allowed_ and _continue evaluating_.\n * *//\n * this.addRule('shape.resize', function(context) {\n *\n * var shape = context.shape;\n *\n * if (!context.newBounds) {\n * // check general resizability\n * if (!shape.resizable) {\n * return false;\n * }\n *\n * // not returning anything (read: undefined)\n * // will continue the evaluation of other rules\n * // (with lower priority)\n * return;\n * } else {\n * // element must have minimum size of 10*10 points\n * return context.newBounds.width > 10 && context.newBounds.height > 10;\n * }\n * });\n * };\n *\n * @param {String|Array} actions the identifier for the modeling action to check\n * @param {Number} [priority] the priority at which this rule is being applied\n * @param {Function} fn the callback function that performs the actual check\n */\nRuleProvider.prototype.addRule = function(actions, priority, fn) {\n\n var self = this;\n\n if (typeof actions === 'string') {\n actions = [ actions ];\n }\n\n actions.forEach(function(action) {\n\n self.canExecute(action, priority, function(context, action, event) {\n return fn(context);\n }, true);\n });\n};\n\n/**\n * Implement this method to add new rules during provider initialization.\n */\nRuleProvider.prototype.init = function() {};","'use strict';\n\n/**\n * A service that provides rules for certain diagram actions.\n *\n * The default implementation will hook into the {@link CommandStack}\n * to perform the actual rule evaluation. Make sure to provide the\n * `commandStack` service with this module if you plan to use it.\n *\n * Together with this implementation you may use the {@link RuleProvider}\n * to implement your own rule checkers.\n *\n * This module is ment to be easily replaced, thus the tiny foot print.\n *\n * @param {Injector} injector\n */\nfunction Rules(injector) {\n this._commandStack = injector.get('commandStack', false);\n}\n\nRules.$inject = [ 'injector' ];\n\nmodule.exports = Rules;\n\n\n/**\n * Returns whether or not a given modeling action can be executed\n * in the specified context.\n *\n * This implementation will respond with allow unless anyone\n * objects.\n *\n * @param {String} action the action to be checked\n * @param {Object} [context] the context to check the action in\n *\n * @return {Boolean} returns true, false or null depending on whether the\n * operation is allowed, not allowed or should be ignored.\n */\nRules.prototype.allowed = function(action, context) {\n var allowed = true;\n\n var commandStack = this._commandStack;\n\n if (commandStack) {\n allowed = commandStack.canExecute(action, context);\n }\n\n // map undefined to true, i.e. no rules\n return allowed === undefined ? true : allowed;\n};","module.exports = {\n __init__: [ 'rules' ],\n rules: [ 'type', require(226) ]\n};\n","'use strict';\n\nvar domClear = require(446),\n domDelegate = require(448),\n domQuery = require(452),\n domClasses = require(445),\n domAttr = require(444),\n domify = require(449);\n\nvar getBoundingBox = require(266).getBBox;\n\n\n/**\n * Provides searching infrastructure\n */\nfunction SearchPad(canvas, eventBus, overlays, selection) {\n this._open = false;\n this._results = [];\n this._eventMaps = [];\n\n this._canvas = canvas;\n this._eventBus = eventBus;\n this._overlays = overlays;\n this._selection = selection;\n\n // setup elements\n this._container = domify(SearchPad.BOX_HTML);\n this._searchInput = domQuery(SearchPad.INPUT_SELECTOR, this._container);\n this._resultsContainer = domQuery(SearchPad.RESULTS_CONTAINER_SELECTOR, this._container);\n\n // attach search pad\n this._canvas.getContainer().appendChild(this._container);\n\n // cleanup on destroy\n eventBus.on([ 'canvas.destroy', 'diagram.destroy' ], this.close, this);\n}\n\n\nSearchPad.$inject = [\n 'canvas',\n 'eventBus',\n 'overlays',\n 'selection'\n];\n\n\n/**\n * Binds and keeps track of all event listereners\n */\nSearchPad.prototype._bindEvents = function() {\n var self = this;\n\n function listen(el, selector, type, fn) {\n self._eventMaps.push({\n el: el,\n type: type,\n listener: domDelegate.bind(el, selector, type, fn)\n });\n }\n\n // close search on clicking anywhere outside\n listen(document, 'html', 'click', function(e) {\n self.close();\n }, true);\n\n // stop event from propagating and closing search\n // focus on input\n listen(this._container, SearchPad.INPUT_SELECTOR, 'click', function(e) {\n e.stopPropagation();\n e.delegateTarget.focus();\n });\n\n // preselect result on hover\n listen(this._container, SearchPad.RESULT_SELECTOR, 'mouseover', function(e) {\n e.stopPropagation();\n self._scrollToNode(e.delegateTarget);\n self._preselect(e.delegateTarget);\n });\n\n // selects desired result on mouse click\n listen(this._container, SearchPad.RESULT_SELECTOR, 'click', function(e) {\n e.stopPropagation();\n self._select(e.delegateTarget);\n });\n\n // prevent cursor in input from going left and right when using up/down to\n // navigate results\n listen(this._container, SearchPad.INPUT_SELECTOR, 'keydown', function(e) {\n // up\n if (e.keyCode === 38) {\n e.preventDefault();\n }\n\n // down\n if (e.keyCode === 40) {\n e.preventDefault();\n }\n });\n\n // handle keyboard input\n listen(this._container, SearchPad.INPUT_SELECTOR, 'keyup', function(e) {\n // escape\n if (e.keyCode === 27) {\n return self.close();\n }\n\n // enter\n if (e.keyCode === 13) {\n var selected = self._getCurrentResult();\n\n return selected ? self._select(selected) : self.close();\n }\n\n // up\n if (e.keyCode === 38) {\n return self._scrollToDirection(true);\n }\n\n // down\n if (e.keyCode === 40) {\n return self._scrollToDirection();\n }\n\n // left && right\n // do not search while navigating text input\n if (e.keyCode === 37 || e.keyCode === 39) {\n return;\n }\n\n // anything else\n self._search(e.delegateTarget.value);\n });\n};\n\n\n/**\n * Unbinds all previously established listeners\n */\nSearchPad.prototype._unbindEvents = function() {\n this._eventMaps.forEach(function(m) {\n domDelegate.unbind(m.el, m.type, m.listener);\n });\n};\n\n\n/**\n * Performs a search for the given pattern.\n *\n * @param {String} pattern\n */\nSearchPad.prototype._search = function(pattern) {\n var self = this;\n\n this._clearResults();\n\n // do not search on empty query\n if (!pattern || pattern === '') {\n return;\n }\n\n var searchResults = this._searchProvider.find(pattern);\n\n if (!searchResults.length) {\n return;\n }\n\n // append new results\n searchResults.forEach(function(result) {\n var id = result.element.id;\n var node = self._createResultNode(result, id);\n self._results[id] = {\n element: result.element,\n node: node\n };\n });\n\n // preselect first result\n var node = domQuery(SearchPad.RESULT_SELECTOR, this._resultsContainer);\n this._scrollToNode(node);\n this._preselect(node);\n};\n\n\n/**\n * Navigate to the previous/next result. Defaults to next result.\n * @param {Boolean} previous\n */\nSearchPad.prototype._scrollToDirection = function(previous) {\n var selected = this._getCurrentResult();\n if (!selected) {\n return;\n }\n\n var node = previous ? selected.previousElementSibling : selected.nextElementSibling;\n if (node) {\n this._scrollToNode(node);\n this._preselect(node);\n }\n};\n\n\n/**\n * Scroll to the node if it is not visible.\n *\n * @param {Element} node\n */\nSearchPad.prototype._scrollToNode = function(node) {\n if (!node || node === this._getCurrentResult()) {\n return;\n }\n\n var nodeOffset = node.offsetTop;\n var containerScroll = this._resultsContainer.scrollTop;\n\n var bottomScroll = nodeOffset - this._resultsContainer.clientHeight + node.clientHeight;\n\n if (nodeOffset < containerScroll) {\n this._resultsContainer.scrollTop = nodeOffset;\n } else if (containerScroll < bottomScroll) {\n this._resultsContainer.scrollTop = bottomScroll;\n }\n};\n\n\n/**\n * Clears all results data.\n */\nSearchPad.prototype._clearResults = function() {\n domClear(this._resultsContainer);\n\n this._results = [];\n\n this._resetOverlay();\n\n this._eventBus.fire('searchPad.cleared');\n};\n\n\n/**\n * Get currently selected result.\n *\n * @return {Element}\n */\nSearchPad.prototype._getCurrentResult = function() {\n return domQuery(SearchPad.RESULT_SELECTED_SELECTOR, this._resultsContainer);\n};\n\n\n/**\n * Create result DOM element within results container\n * that corresponds to a search result.\n *\n * 'result' : one of the elements returned by SearchProvider\n * 'id' : id attribute value to assign to the new DOM node\n * return : created DOM element\n *\n * @param {SearchResult} result\n * @param {String} id\n * @return {Element}\n */\nSearchPad.prototype._createResultNode = function(result, id) {\n var node = domify(SearchPad.RESULT_HTML);\n\n // create only if available\n if (result.primaryTokens.length > 0) {\n createInnerTextNode(node, result.primaryTokens, SearchPad.RESULT_PRIMARY_HTML);\n }\n\n // secondary tokens (represent element ID) are allways available\n createInnerTextNode(node, result.secondaryTokens, SearchPad.RESULT_SECONDARY_HTML);\n\n domAttr(node, SearchPad.RESULT_ID_ATTRIBUTE, id);\n\n this._resultsContainer.appendChild(node);\n\n return node;\n};\n\n\n/**\n * Register search element provider.\n *\n * SearchProvider.find - provides search function over own elements\n * (pattern) => [{ text: , element: }, ...]\n *\n * @param {SearchProvider} provider\n */\nSearchPad.prototype.registerProvider = function(provider) {\n this._searchProvider = provider;\n};\n\n\n/**\n * Open search pad.\n */\nSearchPad.prototype.open = function() {\n if (!this._searchProvider) {\n throw new Error('no search provider registered');\n }\n\n if (this.isOpen()) {\n return;\n }\n\n this._bindEvents();\n\n this._open = true;\n\n domClasses(this._container).add('open');\n\n this._searchInput.focus();\n\n this._eventBus.fire('searchPad.opened');\n};\n\n\n/**\n * Close search pad.\n */\nSearchPad.prototype.close = function() {\n if (!this.isOpen()) {\n return;\n }\n\n this._unbindEvents();\n\n this._open = false;\n\n domClasses(this._container).remove('open');\n\n this._clearResults();\n\n this._searchInput.value = '';\n this._searchInput.blur();\n\n this._resetOverlay();\n\n this._eventBus.fire('searchPad.closed');\n};\n\n\n/**\n * Toggles search pad on/off.\n */\nSearchPad.prototype.toggle = function() {\n this.isOpen() ? this.close() : this.open();\n};\n\n\n/**\n * Report state of search pad.\n */\nSearchPad.prototype.isOpen = function() {\n return this._open;\n};\n\n\n/**\n * Preselect result entry.\n *\n * @param {Element} element\n */\nSearchPad.prototype._preselect = function(node) {\n var selectedNode = this._getCurrentResult();\n\n // already selected\n if (node === selectedNode) {\n return;\n }\n\n // removing preselection from current node\n if (selectedNode) {\n domClasses(selectedNode).remove(SearchPad.RESULT_SELECTED_CLASS);\n }\n\n var id = domAttr(node, SearchPad.RESULT_ID_ATTRIBUTE);\n var element = this._results[id].element;\n\n domClasses(node).add(SearchPad.RESULT_SELECTED_CLASS);\n\n this._resetOverlay(element);\n\n this._centerViewbox(element);\n\n this._selection.select(element);\n\n this._eventBus.fire('searchPad.preselected', element);\n};\n\n\n/**\n * Select result node.\n *\n * @param {Element} element\n */\nSearchPad.prototype._select = function(node) {\n var id = domAttr(node, SearchPad.RESULT_ID_ATTRIBUTE);\n var element = this._results[id].element;\n\n this.close();\n\n this._resetOverlay();\n\n this._centerViewbox(element);\n\n this._selection.select(element);\n\n this._eventBus.fire('searchPad.selected', element);\n};\n\n\n/**\n * Center viewbox on the element middle point.\n *\n * @param {Element} element\n */\nSearchPad.prototype._centerViewbox = function(element) {\n var viewbox = this._canvas.viewbox();\n\n var box = getBoundingBox(element);\n\n var newViewbox = {\n x: (box.x + box.width/2) - viewbox.outer.width/2,\n y: (box.y + box.height/2) - viewbox.outer.height/2,\n width: viewbox.outer.width,\n height: viewbox.outer.height\n };\n\n this._canvas.viewbox(newViewbox);\n\n this._canvas.zoom(viewbox.scale);\n};\n\n\n/**\n * Reset overlay removes and, optionally, set\n * overlay to a new element.\n *\n * @param {Element} element\n */\nSearchPad.prototype._resetOverlay = function(element) {\n if (this._overlayId) {\n this._overlays.remove(this._overlayId);\n }\n\n if (element) {\n var box = getBoundingBox(element);\n var overlay = constructOverlay(box);\n this._overlayId = this._overlays.add(element, overlay);\n }\n};\n\n\nmodule.exports = SearchPad;\n\n/**\n * Construct overlay object for the given bounding box.\n *\n * @param {BoundingBox} box\n * @return {Object}\n */\nfunction constructOverlay(box) {\n\n var offset = 6;\n var w = box.width + offset * 2;\n var h = box.height + offset * 2;\n\n var styles = [\n 'width: '+ w +'px',\n 'height: '+ h + 'px'\n ].join('; ');\n\n return {\n position: {\n bottom: h - offset,\n right: w - offset\n },\n show: true,\n html: '
'\n };\n}\n\n\n/**\n * Creates and appends child node from result tokens and HTML template.\n *\n * @param {Element} node\n * @param {Array} tokens\n * @param {String} template\n */\nfunction createInnerTextNode(parentNode, tokens, template) {\n var text = createHtmlText(tokens);\n var childNode = domify(template);\n childNode.innerHTML = text;\n parentNode.appendChild(childNode);\n}\n\n/**\n * Create internal HTML markup from result tokens.\n * Caters for highlighting pattern matched tokens.\n *\n * @param {Array} tokens\n * @return {String}\n */\nfunction createHtmlText(tokens) {\n var htmlText = '';\n\n tokens.forEach(function(t) {\n if (t.matched) {\n htmlText += '' + t.matched + '';\n } else {\n htmlText += t.normal;\n }\n });\n\n return htmlText !== '' ? htmlText : null;\n}\n\n\n/**\n * CONSTANTS\n */\nSearchPad.CONTAINER_SELECTOR = '.djs-search-container';\nSearchPad.INPUT_SELECTOR = '.djs-search-input input';\nSearchPad.RESULTS_CONTAINER_SELECTOR = '.djs-search-results';\nSearchPad.RESULT_SELECTOR = '.djs-search-result';\nSearchPad.RESULT_SELECTED_CLASS = 'djs-search-result-selected';\nSearchPad.RESULT_SELECTED_SELECTOR = '.' + SearchPad.RESULT_SELECTED_CLASS;\nSearchPad.RESULT_ID_ATTRIBUTE = 'data-result-id';\nSearchPad.RESULT_HIGHLIGHT_CLASS = 'djs-search-highlight';\nSearchPad.OVERLAY_CLASS = 'djs-search-overlay';\n\nSearchPad.BOX_HTML =\n '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '
';\n\nSearchPad.RESULT_HTML =\n '
';\n\nSearchPad.RESULT_PRIMARY_HTML =\n '
';\n\nSearchPad.RESULT_SECONDARY_HTML =\n '

';\n","module.exports = {\n __depends__: [\n require(211),\n require(233)\n ],\n searchPad: [ 'type', require(228) ]\n};\n","'use strict';\n\nvar isArray = require(422),\n forEach = require(303);\n\n\n/**\n * A service that offers the current selection in a diagram.\n * Offers the api to control the selection, too.\n *\n * @class\n *\n * @param {EventBus} eventBus the event bus\n */\nfunction Selection(eventBus) {\n\n this._eventBus = eventBus;\n\n this._selectedElements = [];\n\n var self = this;\n\n eventBus.on([ 'shape.remove', 'connection.remove' ], function(e) {\n var element = e.element;\n self.deselect(element);\n });\n\n eventBus.on([ 'diagram.clear' ], function(e) {\n self.select(null);\n });\n}\n\nSelection.$inject = [ 'eventBus' ];\n\nmodule.exports = Selection;\n\n\nSelection.prototype.deselect = function(element) {\n var selectedElements = this._selectedElements;\n\n var idx = selectedElements.indexOf(element);\n\n if (idx !== -1) {\n var oldSelection = selectedElements.slice();\n\n selectedElements.splice(idx, 1);\n\n this._eventBus.fire('selection.changed', { oldSelection: oldSelection, newSelection: selectedElements });\n }\n};\n\n\nSelection.prototype.get = function() {\n return this._selectedElements;\n};\n\nSelection.prototype.isSelected = function(element) {\n return this._selectedElements.indexOf(element) !== -1;\n};\n\n\n/**\n * This method selects one or more elements on the diagram.\n *\n * By passing an additional add parameter you can decide whether or not the element(s)\n * should be added to the already existing selection or not.\n *\n * @method Selection#select\n *\n * @param {Object|Object[]} elements element or array of elements to be selected\n * @param {boolean} [add] whether the element(s) should be appended to the current selection, defaults to false\n */\nSelection.prototype.select = function(elements, add) {\n var selectedElements = this._selectedElements,\n oldSelection = selectedElements.slice();\n\n if (!isArray(elements)) {\n elements = elements ? [ elements ] : [];\n }\n\n // selection may be cleared by passing an empty array or null\n // to the method\n if (add) {\n forEach(elements, function(element) {\n if (selectedElements.indexOf(element) !== -1) {\n // already selected\n return;\n } else {\n selectedElements.push(element);\n }\n });\n } else {\n this._selectedElements = selectedElements = elements.slice();\n }\n\n this._eventBus.fire('selection.changed', { oldSelection: oldSelection, newSelection: selectedElements });\n};\n","'use strict';\n\nvar hasPrimaryModifier = require(274).hasPrimaryModifier;\n\nvar find = require(302);\n\n\nfunction SelectionBehavior(eventBus, selection, canvas, elementRegistry) {\n\n eventBus.on('create.end', 500, function(e) {\n\n // select the created shape after a\n // successful create operation\n if (e.context.canExecute) {\n selection.select(e.context.shape);\n }\n });\n\n eventBus.on('connect.end', 500, function(e) {\n\n // select the connect end target\n // after a connect operation\n if (e.context.canExecute && e.context.target) {\n selection.select(e.context.target);\n }\n });\n\n eventBus.on('shape.move.end', 500, function(e) {\n var previousSelection = e.previousSelection || [];\n\n var shape = elementRegistry.get(e.context.shape.id);\n\n // make sure at least the main moved element is being\n // selected after a move operation\n var inSelection = find(previousSelection, function(selectedShape) {\n return shape.id === selectedShape.id;\n });\n\n if (!inSelection) {\n selection.select(shape);\n }\n });\n\n // Shift + click selection\n eventBus.on('element.click', function(event) {\n\n var element = event.element;\n\n // do not select the root element\n // or connections\n if (element === canvas.getRootElement()) {\n element = null;\n }\n\n var isSelected = selection.isSelected(element),\n isMultiSelect = selection.get().length > 1;\n\n // mouse-event: SELECTION_KEY\n var add = hasPrimaryModifier(event);\n\n // select OR deselect element in multi selection\n if (isSelected && isMultiSelect) {\n if (add) {\n return selection.deselect(element);\n } else {\n return selection.select(element);\n }\n } else\n if (!isSelected) {\n selection.select(element, add);\n } else {\n selection.deselect(element);\n }\n });\n}\n\nSelectionBehavior.$inject = [ 'eventBus', 'selection', 'canvas', 'elementRegistry' ];\nmodule.exports = SelectionBehavior;\n","'use strict';\n\nvar forEach = require(303);\n\nvar MARKER_HOVER = 'hover',\n MARKER_SELECTED = 'selected';\n\n\n/**\n * A plugin that adds a visible selection UI to shapes and connections\n * by appending the hover and selected classes to them.\n *\n * @class\n *\n * Makes elements selectable, too.\n *\n * @param {EventBus} events\n * @param {SelectionService} selection\n * @param {Canvas} canvas\n */\nfunction SelectionVisuals(events, canvas, selection, styles) {\n\n this._multiSelectionBox = null;\n\n function addMarker(e, cls) {\n canvas.addMarker(e, cls);\n }\n\n function removeMarker(e, cls) {\n canvas.removeMarker(e, cls);\n }\n\n events.on('element.hover', function(event) {\n addMarker(event.element, MARKER_HOVER);\n });\n\n events.on('element.out', function(event) {\n removeMarker(event.element, MARKER_HOVER);\n });\n\n events.on('selection.changed', function(event) {\n\n function deselect(s) {\n removeMarker(s, MARKER_SELECTED);\n }\n\n function select(s) {\n addMarker(s, MARKER_SELECTED);\n }\n\n var oldSelection = event.oldSelection,\n newSelection = event.newSelection;\n\n forEach(oldSelection, function(e) {\n if (newSelection.indexOf(e) === -1) {\n deselect(e);\n }\n });\n\n forEach(newSelection, function(e) {\n if (oldSelection.indexOf(e) === -1) {\n select(e);\n }\n });\n });\n}\n\nSelectionVisuals.$inject = [\n 'eventBus',\n 'canvas',\n 'selection',\n 'styles'\n];\n\nmodule.exports = SelectionVisuals;\n","module.exports = {\n __init__: [ 'selectionVisuals', 'selectionBehavior' ],\n __depends__: [\n require(170),\n require(209)\n ],\n selection: [ 'type', require(230) ],\n selectionVisuals: [ 'type', require(232) ],\n selectionBehavior: [ 'type', require(231) ]\n};\n","'use strict';\n\nvar forEach = require(303);\n\nvar snapTo = require(235).snapTo;\n\n\n/**\n * A snap context, containing the (possibly incomplete)\n * mappings of drop targets (to identify the snapping)\n * to computed snap points.\n */\nfunction SnapContext() {\n\n /**\n * Map mapping drop targets to\n * a list of possible snappings.\n *\n * @type {Object}\n */\n this._targets = {};\n\n /**\n * Map initial positioning of element\n * regarding various snap directions.\n *\n * @type {Object}\n */\n this._snapOrigins = {};\n\n /**\n * List of snap locations\n *\n * @type {Array}\n */\n this._snapLocations = [];\n\n /**\n * Map> of default snapping locations\n *\n * @type {Object}\n */\n this._defaultSnaps = {};\n}\n\n\nSnapContext.prototype.getSnapOrigin = function(snapLocation) {\n return this._snapOrigins[snapLocation];\n};\n\n\nSnapContext.prototype.setSnapOrigin = function(snapLocation, initialValue) {\n this._snapOrigins[snapLocation] = initialValue;\n\n if (this._snapLocations.indexOf(snapLocation) === -1) {\n this._snapLocations.push(snapLocation);\n }\n};\n\n\nSnapContext.prototype.addDefaultSnap = function(type, point) {\n\n var snapValues = this._defaultSnaps[type];\n\n if (!snapValues) {\n snapValues = this._defaultSnaps[type] = [];\n }\n\n snapValues.push(point);\n};\n\n/**\n * Return a number of initialized snaps, i.e. snap locations such as\n * top-left, mid, bottom-right and so forth.\n *\n * @return {Array} snapLocations\n */\nSnapContext.prototype.getSnapLocations = function() {\n return this._snapLocations;\n};\n\n/**\n * Set the snap locations for this context.\n *\n * The order of locations determines precedence.\n *\n * @param {Array} snapLocations\n */\nSnapContext.prototype.setSnapLocations = function(snapLocations) {\n this._snapLocations = snapLocations;\n};\n\n/**\n * Get snap points for a given target\n *\n * @param {Element|String} target\n */\nSnapContext.prototype.pointsForTarget = function(target) {\n\n var targetId = target.id || target;\n\n var snapPoints = this._targets[targetId];\n\n if (!snapPoints) {\n snapPoints = this._targets[targetId] = new SnapPoints();\n snapPoints.initDefaults(this._defaultSnaps);\n }\n\n return snapPoints;\n};\n\nmodule.exports = SnapContext;\n\n\n/**\n * Creates the snap points and initializes them with the\n * given default values.\n *\n * @param {Object>} [defaultPoints]\n */\nfunction SnapPoints(defaultSnaps) {\n\n /**\n * Map>> mapping snap locations,\n * i.e. top-left, bottom-right, center to actual snap values.\n *\n * @type {Object}\n */\n this._snapValues = {};\n}\n\nSnapPoints.prototype.add = function(snapLocation, point) {\n\n var snapValues = this._snapValues[snapLocation];\n\n if (!snapValues) {\n snapValues = this._snapValues[snapLocation] = { x: [], y: [] };\n }\n\n if (snapValues.x.indexOf(point.x) === -1) {\n snapValues.x.push(point.x);\n }\n\n if (snapValues.y.indexOf(point.y) === -1) {\n snapValues.y.push(point.y);\n }\n};\n\n\nSnapPoints.prototype.snap = function(point, snapLocation, axis, tolerance) {\n var snappingValues = this._snapValues[snapLocation];\n \n return snappingValues && snapTo(point[axis], snappingValues[axis], tolerance);\n};\n\n/**\n * Initialize a number of default snapping points.\n *\n * @param {Object} defaultSnaps\n */\nSnapPoints.prototype.initDefaults = function(defaultSnaps) {\n\n var self = this;\n\n forEach(defaultSnaps || {}, function(snapPoints, snapLocation) {\n forEach(snapPoints, function(point) {\n self.add(snapLocation, point);\n });\n });\n};","'use strict';\n\nvar abs = Math.abs,\n round = Math.round;\n\n\n/**\n * Snap value to a collection of reference values.\n *\n * @param {Number} value\n * @param {Array} values\n * @param {Number} [tolerance=10]\n *\n * @return {Number} the value we snapped to or null, if none snapped\n */\nfunction snapTo(value, values, tolerance) {\n tolerance = tolerance === undefined ? 10 : tolerance;\n\n var idx, snapValue;\n\n for (idx = 0; idx < values.length; idx++) {\n snapValue = values[idx];\n\n if (abs(snapValue - value) <= tolerance) {\n return snapValue;\n }\n }\n}\n\nmodule.exports.snapTo = snapTo;\n\n\nfunction topLeft(bounds) {\n return {\n x: bounds.x,\n y: bounds.y\n };\n}\n\nmodule.exports.topLeft = topLeft;\n\n\nfunction mid(bounds, defaultValue) {\n\n if (!bounds || isNaN(bounds.x) || isNaN(bounds.y)) {\n return defaultValue;\n }\n\n return {\n x: round(bounds.x + bounds.width / 2),\n y: round(bounds.y + bounds.height / 2)\n };\n}\n\nmodule.exports.mid = mid;\n\n\nfunction bottomRight(bounds) {\n return {\n x: bounds.x + bounds.width,\n y: bounds.y + bounds.height\n };\n}\n\nmodule.exports.bottomRight = bottomRight;\n\n\n/**\n * Retrieve the snap state of the given event.\n *\n * @param {Event} event\n * @param {String} axis\n *\n * @return {Boolean} the snapped state\n *\n */\nmodule.exports.isSnapped = function(event, axis) {\n var snapped = event.snapped;\n\n if (!snapped) {\n return false;\n }\n\n if (typeof axis === 'string') {\n return snapped[axis];\n }\n\n return snapped.x && snapped.y;\n};\n\n/**\n * Set the given event as snapped.\n *\n * This method may change the x and/or y position of the shape\n * from the given event!\n *\n * @param {Event} event\n * @param {String} axis\n * @param {Number|Boolean} value\n *\n * @return {Number} old value\n */\nmodule.exports.setSnapped = function(event, axis, value) {\n if (typeof axis !== 'string') {\n throw new Error('axis must be in [x, y]');\n }\n\n if (typeof value !== 'number' && value !== false) {\n throw new Error('value must be Number or false');\n }\n\n var delta,\n previousValue = event[axis];\n\n var snapped = event.snapped = (event.snapped || {});\n\n\n if (value === false) {\n snapped[axis] = false;\n } else {\n snapped[axis] = true;\n\n delta = value - previousValue;\n\n event[axis] += delta;\n event['d' + axis] += delta;\n }\n\n return previousValue;\n};","'use strict';\n\nvar filter = require(301),\n forEach = require(303),\n debounce = require(313);\n\nvar mid = require(235).mid;\n\nvar SnapContext = require(234);\n\nvar SnapUtil = require(235);\n\nvar HIGHER_PRIORITY = 1250;\n\nvar isSnapped = SnapUtil.isSnapped,\n setSnapped = SnapUtil.setSnapped;\n\nvar svgAppend = require(472),\n svgAttr = require(474),\n svgClasses = require(475),\n svgCreate = require(478);\n\n\n/**\n * A general purpose snapping component for diagram elements.\n *\n * @param {EventBus} eventBus\n * @param {Canvas} canvas\n */\nfunction Snapping(eventBus, canvas) {\n\n this._canvas = canvas;\n\n var self = this;\n\n eventBus.on([ 'shape.move.start', 'create.start' ], function(event) {\n self.initSnap(event);\n });\n\n eventBus.on([ 'shape.move.move', 'shape.move.end', 'create.move', 'create.end' ], HIGHER_PRIORITY, function(event) {\n\n if (event.originalEvent && event.originalEvent.ctrlKey) {\n return;\n }\n\n if (isSnapped(event)) {\n return;\n }\n\n self.snap(event);\n });\n\n eventBus.on([ 'shape.move.cleanup', 'create.cleanup' ], function(event) {\n self.hide();\n });\n\n // delay hide by 1000 seconds since last match\n this._asyncHide = debounce(this.hide, 1000);\n}\n\nSnapping.$inject = [ 'eventBus', 'canvas' ];\n\nmodule.exports = Snapping;\n\n\nSnapping.prototype.initSnap = function(event) {\n\n var context = event.context,\n shape = context.shape,\n snapContext = context.snapContext;\n\n if (!snapContext) {\n snapContext = context.snapContext = new SnapContext();\n }\n\n var snapMid = mid(shape, event);\n\n snapContext.setSnapOrigin('mid', {\n x: snapMid.x - event.x,\n y: snapMid.y - event.y\n });\n\n return snapContext;\n};\n\n\nSnapping.prototype.snap = function(event) {\n\n var context = event.context,\n snapContext = context.snapContext,\n shape = context.shape,\n target = context.target,\n snapLocations = snapContext.getSnapLocations();\n\n if (!target) {\n return;\n }\n\n var snapPoints = snapContext.pointsForTarget(target);\n\n if (!snapPoints.initialized) {\n this.addTargetSnaps(snapPoints, shape, target);\n\n snapPoints.initialized = true;\n }\n\n\n var snapping = {\n x: isSnapped(event, 'x'),\n y: isSnapped(event, 'y')\n };\n\n\n forEach(snapLocations, function(location) {\n\n var snapOrigin = snapContext.getSnapOrigin(location);\n\n var snapCurrent = {\n x: event.x + snapOrigin.x,\n y: event.y + snapOrigin.y\n };\n\n // snap on both axis, if not snapped already\n forEach([ 'x', 'y' ], function(axis) {\n var locationSnapping;\n\n if (!snapping[axis]) {\n locationSnapping = snapPoints.snap(snapCurrent, location, axis, 7);\n\n if (locationSnapping !== undefined) {\n snapping[axis] = {\n value: locationSnapping,\n originValue: locationSnapping - snapOrigin[axis]\n };\n }\n }\n });\n\n // no more need to snap, drop out of interation\n if (snapping.x && snapping.y) {\n return false;\n }\n });\n\n\n // show snap visuals\n\n this.showSnapLine('vertical', snapping.x && snapping.x.value);\n this.showSnapLine('horizontal', snapping.y && snapping.y.value);\n\n\n // adjust event { x, y, dx, dy } and mark as snapping\n forEach([ 'x', 'y' ], function(axis) {\n\n var axisSnapping = snapping[axis];\n\n if (typeof axisSnapping === 'object') {\n // set as snapped and adjust the x and/or y position of the event\n setSnapped(event, axis, axisSnapping.originValue);\n }\n });\n};\n\n\nSnapping.prototype._createLine = function(orientation) {\n\n var root = this._canvas.getLayer('snap');\n\n // var line = root.path('M0,0 L0,0').addClass('djs-snap-line');\n\n var line = svgCreate('path');\n svgAttr(line, { d: 'M0,0 L0,0' });\n svgClasses(line).add('djs-snap-line');\n\n svgAppend(root, line);\n\n return {\n update: function(position) {\n\n if (typeof position !== 'number') {\n svgAttr(line, { display: 'none' });\n } else {\n if (orientation === 'horizontal') {\n svgAttr(line, {\n d: 'M-100000,' + position + ' L+100000,' + position,\n display: ''\n });\n } else {\n svgAttr(line, {\n d: 'M ' + position + ',-100000 L ' + position + ', +100000',\n display: ''\n });\n }\n }\n }\n };\n};\n\n\nSnapping.prototype._createSnapLines = function() {\n\n this._snapLines = {\n horizontal: this._createLine('horizontal'),\n vertical: this._createLine('vertical')\n };\n};\n\nSnapping.prototype.showSnapLine = function(orientation, position) {\n\n var line = this.getSnapLine(orientation);\n\n if (line) {\n line.update(position);\n }\n\n this._asyncHide();\n};\n\nSnapping.prototype.getSnapLine = function(orientation) {\n if (!this._snapLines) {\n this._createSnapLines();\n }\n\n return this._snapLines[orientation];\n};\n\nSnapping.prototype.hide = function() {\n forEach(this._snapLines, function(l) {\n l.update();\n });\n};\n\nSnapping.prototype.addTargetSnaps = function(snapPoints, shape, target) {\n\n var siblings = this.getSiblings(shape, target);\n\n forEach(siblings, function(s) {\n snapPoints.add('mid', mid(s));\n });\n\n};\n\nSnapping.prototype.getSiblings = function(element, target) {\n\n // snap to all siblings that are not hidden, labels, attached to element or element itself\n return target && filter(target.children, function(e) {\n return !e.hidden && !e.labelTarget && e.host !== element && e !== element;\n });\n};\n","'use strict';\n\nvar SpaceUtil = require(239);\n\nvar Cursor = require(265);\n\nvar hasPrimaryModifier = require(274).hasPrimaryModifier;\n\nvar abs = Math.abs,\n round = Math.round;\n\nvar HIGH_PRIORITY = 1500,\n SPACE_TOOL_CURSOR = 'crosshair';\n\nvar AXIS_TO_DIMENSION = { x: 'width', y: 'height' },\n AXIS_INVERTED = { x: 'y', y: 'x' };\n\nvar getAllChildren = require(266).selfAndAllChildren;\n\nvar assign = require(431),\n forEach = require(303);\n\n\n/**\n * A tool that allows users to create and remove space in a diagram.\n *\n * The tool needs to be activated manually via {@link SpaceTool#activate(MouseEvent)}.\n */\nfunction SpaceTool(eventBus, dragging, canvas, modeling, rules, toolManager) {\n\n this._canvas = canvas;\n this._dragging = dragging;\n this._modeling = modeling;\n this._rules = rules;\n this._toolManager = toolManager;\n\n var self = this;\n\n toolManager.registerTool('space', {\n tool: 'spaceTool.selection',\n dragging: 'spaceTool'\n });\n\n eventBus.on('spaceTool.selection.end', function(event) {\n var target = event.originalEvent.target;\n\n // only reactive on diagram click\n // on some occasions, event.hover is not set and we have to check if the target is an svg\n if (!event.hover && !(target instanceof SVGElement)) {\n return;\n }\n\n eventBus.once('spaceTool.selection.ended', function() {\n self.activateMakeSpace(event.originalEvent);\n });\n });\n\n\n eventBus.on('spaceTool.move', HIGH_PRIORITY , function(event) {\n\n var context = event.context;\n\n if (!context.initialized) {\n context.initialized = self.initializeMakeSpace(event, context);\n }\n });\n\n\n eventBus.on('spaceTool.end', function(event) {\n\n var context = event.context,\n axis = context.axis,\n direction = context.direction,\n movingShapes = context.movingShapes,\n resizingShapes = context.resizingShapes;\n\n // skip if create space has not been initialized yet\n if (!context.initialized) {\n return;\n }\n\n var delta = { x: round(event.dx), y: round(event.dy) };\n delta[ AXIS_INVERTED[ axis ] ] = 0;\n\n var insideBounds = true;\n\n // check if the space tool cursor is inside of bounds of\n // any of the shapes that would be resized.\n forEach(resizingShapes, function(shape) {\n\n if ((direction === 'w' && event.x > shape.x + shape.width) ||\n (direction === 'e' && event.x < shape.x) ||\n (direction === 'n' && event.y > shape.y + shape.height) ||\n (direction === 's' && event.y < shape.y)) {\n\n insideBounds = false;\n return;\n }\n });\n\n if (insideBounds) {\n // make space only if the cursor is inside bounds\n self.makeSpace(movingShapes, resizingShapes, delta, direction);\n }\n\n eventBus.once('spaceTool.ended', function(event) {\n // reactivate space tool after usage\n self.activateSelection(event.originalEvent, true, true);\n });\n\n });\n}\n\nSpaceTool.$inject = [ 'eventBus', 'dragging', 'canvas', 'modeling', 'rules', 'toolManager' ];\n\nmodule.exports = SpaceTool;\n\n\n/**\n * Activate space tool selection\n *\n * @param {MouseEvent} event\n * @param {Boolean} autoActivate\n */\nSpaceTool.prototype.activateSelection = function(event, autoActivate, reactivate) {\n this._dragging.init(event, 'spaceTool.selection', {\n trapClick: false,\n cursor: SPACE_TOOL_CURSOR,\n autoActivate: autoActivate,\n data: {\n context: {\n reactivate: reactivate\n }\n }\n });\n};\n\n/**\n * Activate make space\n *\n * @param {MouseEvent} event\n */\nSpaceTool.prototype.activateMakeSpace = function(event) {\n this._dragging.init(event, 'spaceTool', {\n autoActivate: true,\n cursor: SPACE_TOOL_CURSOR,\n data: {\n context: {}\n }\n });\n};\n\n/**\n * Actually make space on the diagram\n *\n * @param {Array} movingShapes\n * @param {Array} resizingShapes\n * @param {Point} delta\n * @param {String} direction\n */\nSpaceTool.prototype.makeSpace = function(movingShapes, resizingShapes, delta, direction) {\n return this._modeling.createSpace(movingShapes, resizingShapes, delta, direction);\n};\n\n/**\n * Initialize make space and return true if that was successful.\n *\n * @param {Event} event\n * @param {Object} context\n *\n * @return {Boolean} true, if successful\n */\nSpaceTool.prototype.initializeMakeSpace = function(event, context) {\n\n var axis = abs(event.dx) > abs(event.dy) ? 'x' : 'y',\n offset = event['d' + axis],\n // start point of create space operation\n spacePos = event[axis] - offset;\n\n if (abs(offset) < 5) {\n return false;\n }\n\n // invert the offset in order to remove space when moving left\n if (offset < 0) {\n offset *= -1;\n }\n\n // inverts the offset to choose the shapes\n // on the opposite side of the resizer if\n // a key modifier is pressed\n if (hasPrimaryModifier(event)) {\n offset *= -1;\n }\n\n var rootShape = this._canvas.getRootElement();\n\n var allShapes = getAllChildren(rootShape, true);\n\n var adjustments = this.calculateAdjustments(allShapes, axis, offset, spacePos);\n\n // store data in context\n assign(context, adjustments, {\n axis: axis,\n direction: SpaceUtil.getDirection(axis, offset)\n });\n\n Cursor.set('resize-' + (axis === 'x' ? 'ew' : 'ns'));\n\n return true;\n};\n\n/**\n * Calculate adjustments needed when making space\n *\n * @param {Array} elements\n * @param {String} axis\n * @param {Number} offset\n * @param {Number} spacePos\n *\n * @return {Object}\n */\nSpaceTool.prototype.calculateAdjustments = function(elements, axis, offset, spacePos) {\n\n var movingShapes = [],\n resizingShapes = [];\n\n var rules = this._rules;\n\n // collect all elements that need to be moved _AND_\n // resized given on the initial create space position\n elements.forEach(function(shape) {\n\n var shapeStart = shape[axis],\n shapeEnd = shapeStart + shape[AXIS_TO_DIMENSION[axis]];\n\n // checking if it's root\n if (!shape.parent) {\n return;\n }\n\n // checking if it's a shape\n if (shape.waypoints) {\n return;\n }\n\n // shape after spacePos\n if (offset > 0 && shapeStart > spacePos) {\n return movingShapes.push(shape);\n }\n\n // shape before spacePos\n if (offset < 0 && shapeEnd < spacePos) {\n return movingShapes.push(shape);\n }\n\n // shape on top of spacePos, resize only if allowed\n if (shapeStart < spacePos &&\n shapeEnd > spacePos &&\n rules.allowed('shape.resize', { shape: shape })) {\n\n return resizingShapes.push(shape);\n }\n });\n\n return {\n movingShapes: movingShapes,\n resizingShapes: resizingShapes\n };\n};\n\nSpaceTool.prototype.toggle = function() {\n if (this.isActive()) {\n this._dragging.cancel();\n } else {\n this.activateSelection();\n }\n};\n\nSpaceTool.prototype.isActive = function() {\n var context = this._dragging.context();\n\n return context && /^spaceTool/.test(context.prefix);\n};\n","'use strict';\n\nvar forEach = require(303);\n\nvar MARKER_DRAGGING = 'djs-dragging',\n MARKER_RESIZING = 'djs-resizing';\n\nvar LOW_PRIORITY = 250;\n\nvar svgAppend = require(472),\n svgAttr = require(474),\n svgClasses = require(475),\n svgCreate = require(478),\n svgRemove = require(481);\n\nvar translate = require(279).translate;\n\n\n/**\n * Provides previews for selecting/moving/resizing shapes when creating/removing space.\n *\n * @param {EventBus} eventBus\n * @param {ElementRegistry} elementRegistry\n * @param {Canvas} canvas\n * @param {Styles} styles\n */\n\nfunction SpaceToolPreview(eventBus, elementRegistry, canvas, styles, previewSupport) {\n\n function addPreviewGfx(collection, dragGroup) {\n forEach(collection, function(element) {\n previewSupport.addDragger(element, dragGroup);\n\n canvas.addMarker(element, MARKER_DRAGGING);\n });\n }\n\n // add crosshair\n eventBus.on('spaceTool.selection.start', function(event) {\n var space = canvas.getLayer('space'),\n context = event.context;\n\n var orientation = {\n x: 'M 0,-10000 L 0,10000',\n y: 'M -10000,0 L 10000,0'\n };\n\n var crosshairGroup = svgCreate('g');\n svgAttr(crosshairGroup, styles.cls('djs-crosshair-group', [ 'no-events' ]));\n\n svgAppend(space, crosshairGroup);\n\n // horizontal path\n var pathX = svgCreate('path');\n svgAttr(pathX, 'd', orientation.x);\n svgClasses(pathX).add('djs-crosshair');\n\n svgAppend(crosshairGroup, pathX);\n\n // vertical path\n var pathY = svgCreate('path');\n svgAttr(pathY, 'd', orientation.y);\n svgClasses(pathY).add('djs-crosshair');\n\n svgAppend(crosshairGroup, pathY);\n\n context.crosshairGroup = crosshairGroup;\n });\n\n // update crosshair\n eventBus.on('spaceTool.selection.move', function(event) {\n var crosshairGroup = event.context.crosshairGroup;\n\n translate(crosshairGroup, event.x, event.y);\n });\n\n // remove crosshair\n eventBus.on('spaceTool.selection.cleanup', function(event) {\n var context = event.context,\n crosshairGroup = context.crosshairGroup;\n\n if (crosshairGroup) {\n svgRemove(crosshairGroup);\n }\n });\n\n // add and update move/resize previews\n eventBus.on('spaceTool.move', LOW_PRIORITY, function(event) {\n\n var context = event.context,\n line = context.line,\n axis = context.axis,\n movingShapes = context.movingShapes,\n resizingShapes = context.resizingShapes;\n\n if (!context.initialized) {\n return;\n }\n\n if (!context.dragGroup) {\n var spaceLayer = canvas.getLayer('space');\n\n line = svgCreate('path');\n svgAttr(line, 'd', 'M0,0 L0,0');\n svgClasses(line).add('djs-crosshair');\n\n svgAppend(spaceLayer, line);\n\n context.line = line;\n\n var dragGroup = svgCreate('g');\n svgAttr(dragGroup, styles.cls('djs-drag-group', [ 'no-events' ]));\n\n svgAppend(canvas.getDefaultLayer(), dragGroup);\n\n // shapes\n addPreviewGfx(movingShapes, dragGroup);\n\n // connections\n var movingConnections = context.movingConnections = elementRegistry.filter(function(element) {\n var sourceIsMoving = false;\n\n forEach(movingShapes, function(shape) {\n forEach(shape.outgoing, function(connection) {\n if (element === connection) {\n sourceIsMoving = true;\n }\n });\n });\n\n var targetIsMoving = false;\n\n forEach(movingShapes, function(shape) {\n forEach(shape.incoming, function(connection) {\n if (element === connection) {\n targetIsMoving = true;\n }\n });\n });\n\n var sourceIsResizing = false;\n\n forEach(resizingShapes, function(shape) {\n forEach(shape.outgoing, function(connection) {\n if (element === connection) {\n sourceIsResizing = true;\n }\n });\n });\n\n var targetIsResizing = false;\n\n forEach(resizingShapes, function(shape) {\n forEach(shape.incoming, function(connection) {\n if (element === connection) {\n targetIsResizing = true;\n }\n });\n });\n\n return isConnection(element)\n && (sourceIsMoving || sourceIsResizing)\n && (targetIsMoving || targetIsResizing);\n });\n\n\n addPreviewGfx(movingConnections, dragGroup);\n\n context.dragGroup = dragGroup;\n }\n\n if (!context.frameGroup) {\n var frameGroup = svgCreate('g');\n svgAttr(frameGroup, styles.cls('djs-frame-group', [ 'no-events' ]));\n\n svgAppend(canvas.getDefaultLayer(), frameGroup);\n\n var frames = [];\n\n forEach(resizingShapes, function(shape) {\n var frame = previewSupport.addFrame(shape, frameGroup);\n\n frames.push({\n element: frame,\n initialWidth: frame.getBBox().width,\n initialHeight: frame.getBBox().height\n });\n\n canvas.addMarker(shape, MARKER_RESIZING);\n });\n\n context.frameGroup = frameGroup;\n context.frames = frames;\n }\n\n var orientation = {\n x: 'M' + event.x + ', -10000 L' + event.x + ', 10000',\n y: 'M -10000, ' + event.y + ' L 10000, ' + event.y\n };\n\n svgAttr(line, { path: orientation[ axis ], display: '' });\n\n var opposite = { x: 'y', y: 'x' };\n var delta = { x: event.dx, y: event.dy };\n delta[ opposite[ context.axis ] ] = 0;\n\n // update move previews\n translate(context.dragGroup, delta.x, delta.y);\n\n // update resize previews\n forEach(context.frames, function(frame) {\n if (frame.initialWidth + delta.x > 5) {\n svgAttr(frame.element, { width: frame.initialWidth + delta.x });\n }\n\n if (frame.initialHeight + delta.y > 5) {\n svgAttr(frame.element, { height: frame.initialHeight + delta.y });\n }\n });\n\n });\n\n // remove move/resize previews\n eventBus.on('spaceTool.cleanup', function(event) {\n\n var context = event.context,\n movingShapes = context.movingShapes,\n movingConnections = context.movingConnections,\n resizingShapes = context.resizingShapes,\n line = context.line,\n dragGroup = context.dragGroup,\n frameGroup = context.frameGroup;\n\n // moving shapes\n forEach(movingShapes, function(shape) {\n canvas.removeMarker(shape, MARKER_DRAGGING);\n });\n\n // moving connections\n forEach(movingConnections, function(connection) {\n canvas.removeMarker(connection, MARKER_DRAGGING);\n });\n\n if (dragGroup) {\n svgRemove(line);\n svgRemove(dragGroup);\n }\n\n forEach(resizingShapes, function(shape) {\n canvas.removeMarker(shape, MARKER_RESIZING);\n });\n\n if (frameGroup) {\n svgRemove(frameGroup);\n }\n });\n}\n\nSpaceToolPreview.$inject = [ 'eventBus', 'elementRegistry', 'canvas', 'styles', 'previewSupport' ];\n\nmodule.exports = SpaceToolPreview;\n\n////////// helpers //////////\n\n/**\n * Checks if an element is a connection.\n */\nfunction isConnection(element) {\n return element.waypoints;\n}\n","'use strict';\n\n/**\n * Get Resize direction given axis + offset\n *\n * @param {String} axis (x|y)\n * @param {Number} offset\n *\n * @return {String} (e|w|n|s)\n */\nfunction getDirection(axis, offset) {\n\n if (axis === 'x') {\n if (offset > 0) {\n return 'e';\n }\n\n if (offset < 0) {\n return 'w';\n }\n }\n\n if (axis === 'y') {\n if (offset > 0) {\n return 's';\n }\n\n if (offset < 0) {\n return 'n';\n }\n }\n\n return null;\n}\n\nmodule.exports.getDirection = getDirection;\n\n/**\n * Resize the given bounds by the specified delta from a given anchor point.\n *\n * @param {Bounds} bounds the bounding box that should be resized\n * @param {String} direction in which the element is resized (n, s, e, w)\n * @param {Point} delta of the resize operation\n *\n * @return {Bounds} resized bounding box\n */\nmodule.exports.resizeBounds = function(bounds, direction, delta) {\n\n var dx = delta.x,\n dy = delta.y;\n\n switch (direction) {\n\n case 'n':\n return {\n x: bounds.x,\n y: bounds.y + dy,\n width: bounds.width,\n height: bounds.height - dy\n };\n\n case 's':\n return {\n x: bounds.x,\n y: bounds.y,\n width: bounds.width,\n height: bounds.height + dy\n };\n\n case 'w':\n return {\n x: bounds.x + dx,\n y: bounds.y,\n width: bounds.width - dx,\n height: bounds.height\n };\n\n case 'e':\n return {\n x: bounds.x,\n y: bounds.y,\n width: bounds.width + dx,\n height: bounds.height\n };\n\n default:\n throw new Error('unrecognized direction: ' + direction);\n }\n};","'use strict';\n\nmodule.exports = {\n __init__: ['spaceToolPreview'],\n __depends__: [\n require(162),\n require(227),\n require(242),\n require(217)\n ],\n spaceTool: ['type', require(237)],\n spaceToolPreview: ['type', require(238) ]\n};\n","'use strict';\n\nvar forEach = require(303);\n\nvar LOW_PRIORITY = 250;\n\n/**\n * The tool manager acts as middle-man between the available tool's and the Palette,\n * it takes care of making sure that the correct active state is set.\n *\n * @param {Object} eventBus\n * @param {Object} dragging\n */\nfunction ToolManager(eventBus, dragging) {\n this._eventBus = eventBus;\n this._dragging = dragging;\n\n this._tools = [];\n this._active = null;\n}\n\nToolManager.$inject = [ 'eventBus', 'dragging' ];\n\nmodule.exports = ToolManager;\n\nToolManager.prototype.registerTool = function(name, events) {\n var tools = this._tools;\n\n if (!events) {\n throw new Error('A tool has to be registered with it/'s \"events\"');\n }\n\n tools.push(name);\n\n this.bindEvents(name, events);\n};\n\nToolManager.prototype.isActive = function(tool) {\n return tool && this._active === tool;\n};\n\nToolManager.prototype.length = function(tool) {\n return this._tools.length;\n};\n\nToolManager.prototype.setActive = function(tool) {\n var eventBus = this._eventBus;\n\n if (this._active !== tool) {\n this._active = tool;\n\n eventBus.fire('tool-manager.update', { tool: tool });\n }\n};\n\nToolManager.prototype.bindEvents = function(name, events) {\n var eventBus = this._eventBus,\n dragging = this._dragging;\n\n var eventsToRegister = [];\n\n eventBus.on(events.tool + '.init', function(event) {\n var context = event.context;\n\n // Active tools that want to reactivate themselves must do this explicitly\n if (!context.reactivate && this.isActive(name)) {\n this.setActive(null);\n\n dragging.cancel();\n return;\n }\n\n this.setActive(name);\n\n }, this);\n\n // Todo[ricardo]: add test cases\n forEach(events, function(event) {\n eventsToRegister.push(event + '.ended');\n eventsToRegister.push(event + '.canceled');\n });\n\n eventBus.on(eventsToRegister, LOW_PRIORITY, function(event) {\n var originalEvent = event.originalEvent;\n\n // We defer the de-activation of the tool to the .activate phase,\n // so we're able to check if we want to toggle off the current active tool or switch to a new one\n if (!this._active ||\n (originalEvent && originalEvent.target.parentNode.getAttribute('data-group') === 'tools')) {\n return;\n }\n\n this.setActive(null);\n }, this);\n};\n","'use strict';\n\nmodule.exports = {\n __depends__: [ require(162) ],\n __init__: [ 'toolManager' ],\n toolManager: [ 'type', require(241) ]\n};\n","'use strict';\n\nvar isString = require(428),\n assign = require(431),\n forEach = require(303);\n\nvar domify = require(449),\n domAttr = require(444),\n domClasses = require(445),\n domRemove = require(453),\n domDelegate = require(448);\n\n\n// document wide unique tooltip ids\nvar ids = new (require(270))('tt');\n\n\nfunction createRoot(parent) {\n var root = domify('
');\n parent.insertBefore(root, parent.firstChild);\n\n return root;\n}\n\n\nfunction setPosition(el, x, y) {\n assign(el.style, { left: x + 'px', top: y + 'px' });\n}\n\nfunction setVisible(el, visible) {\n el.style.display = visible === false ? 'none' : '';\n}\n\n\nvar tooltipClass = 'djs-tooltip',\n tooltipSelector = '.' + tooltipClass;\n\n/**\n * A service that allows users to render tool tips on the diagram.\n *\n * The tooltip service will take care of updating the tooltip positioning\n * during navigation + zooming.\n *\n * @example\n *\n * ```javascript\n *\n * // add a pink badge on the top left of the shape\n * tooltips.add({\n * position: {\n * x: 50,\n * y: 100\n * },\n * html: '
0
'\n * });\n *\n * // or with optional life span\n * tooltips.add({\n * position: {\n * top: -5,\n * left: -5\n * },\n * html: '
0
',\n * ttl: 2000\n * });\n *\n * // remove a tool tip\n * var id = tooltips.add(...);\n * tooltips.remove(id);\n * ```\n *\n * @param {EventBus} eventBus\n * @param {Canvas} canvas\n */\nfunction Tooltips(eventBus, canvas) {\n\n this._eventBus = eventBus;\n this._canvas = canvas;\n\n this._ids = ids;\n\n this._tooltipDefaults = {\n show: {\n minZoom: 0.7,\n maxZoom: 5.0\n }\n };\n\n /**\n * Mapping tooltipId -> tooltip\n */\n this._tooltips = {};\n\n // root html element for all tooltips\n this._tooltipRoot = createRoot(canvas.getContainer());\n\n\n var self = this;\n\n domDelegate.bind(this._tooltipRoot, tooltipSelector, 'mousedown', function(event) {\n event.stopPropagation();\n });\n\n domDelegate.bind(this._tooltipRoot, tooltipSelector, 'mouseover', function(event) {\n self.trigger('mouseover', event);\n });\n\n domDelegate.bind(this._tooltipRoot, tooltipSelector, 'mouseout', function(event) {\n self.trigger('mouseout', event);\n });\n\n this._init();\n}\n\n\nTooltips.$inject = [ 'eventBus', 'canvas' ];\n\nmodule.exports = Tooltips;\n\n\n/**\n * Adds a HTML tooltip to the diagram\n *\n * @param {Object} tooltip the tooltip configuration\n *\n * @param {String|DOMElement} tooltip.html html element to use as an tooltip\n * @param {Object} [tooltip.show] show configuration\n * @param {Number} [tooltip.show.minZoom] minimal zoom level to show the tooltip\n * @param {Number} [tooltip.show.maxZoom] maximum zoom level to show the tooltip\n * @param {Object} tooltip.position where to attach the tooltip\n * @param {Number} [tooltip.position.left] relative to element bbox left attachment\n * @param {Number} [tooltip.position.top] relative to element bbox top attachment\n * @param {Number} [tooltip.position.bottom] relative to element bbox bottom attachment\n * @param {Number} [tooltip.position.right] relative to element bbox right attachment\n * @param {Number} [tooltip.timeout=-1]\n *\n * @return {String} id that may be used to reference the tooltip for update or removal\n */\nTooltips.prototype.add = function(tooltip) {\n\n if (!tooltip.position) {\n throw new Error('must specifiy tooltip position');\n }\n\n if (!tooltip.html) {\n throw new Error('must specifiy tooltip html');\n }\n\n var id = this._ids.next();\n\n tooltip = assign({}, this._tooltipDefaults, tooltip, {\n id: id\n });\n\n this._addTooltip(tooltip);\n\n if (tooltip.timeout) {\n this.setTimeout(tooltip);\n }\n\n return id;\n};\n\nTooltips.prototype.trigger = function(action, event) {\n\n var node = event.delegateTarget || event.target;\n\n var tooltip = this.get(domAttr(node, 'data-tooltip-id'));\n\n if (!tooltip) {\n return;\n }\n\n if (action === 'mouseover' && tooltip.timeout) {\n this.clearTimeout(tooltip);\n }\n\n if (action === 'mouseout' && tooltip.timeout) {\n // cut timeout after mouse out\n tooltip.timeout = 1000;\n\n this.setTimeout(tooltip);\n }\n};\n\n/**\n * Get a tooltip with the given id\n *\n * @param {String} id\n */\nTooltips.prototype.get = function(id) {\n\n if (typeof id !== 'string') {\n id = id.id;\n }\n\n return this._tooltips[id];\n};\n\nTooltips.prototype.clearTimeout = function(tooltip) {\n\n tooltip = this.get(tooltip);\n\n if (!tooltip) {\n return;\n }\n\n var removeTimer = tooltip.removeTimer;\n\n if (removeTimer) {\n clearTimeout(removeTimer);\n tooltip.removeTimer = null;\n }\n};\n\nTooltips.prototype.setTimeout = function(tooltip) {\n\n tooltip = this.get(tooltip);\n\n if (!tooltip) {\n return;\n }\n\n this.clearTimeout(tooltip);\n\n var self = this;\n\n tooltip.removeTimer = setTimeout(function() {\n self.remove(tooltip);\n }, tooltip.timeout);\n};\n\n/**\n * Remove an tooltip with the given id\n *\n * @param {String} id\n */\nTooltips.prototype.remove = function(id) {\n\n var tooltip = this.get(id);\n\n if (tooltip) {\n domRemove(tooltip.html);\n domRemove(tooltip.htmlContainer);\n\n delete tooltip.htmlContainer;\n\n delete this._tooltips[tooltip.id];\n }\n};\n\n\nTooltips.prototype.show = function() {\n setVisible(this._tooltipRoot);\n};\n\n\nTooltips.prototype.hide = function() {\n setVisible(this._tooltipRoot, false);\n};\n\n\nTooltips.prototype._updateRoot = function(viewbox) {\n var a = viewbox.scale || 1;\n var d = viewbox.scale || 1;\n\n var matrix = 'matrix(' + a + ',0,0,' + d + ',' + (-1 * viewbox.x * a) + ',' + (-1 * viewbox.y * d) + ')';\n\n this._tooltipRoot.style.transform = matrix;\n this._tooltipRoot.style['-ms-transform'] = matrix;\n};\n\n\nTooltips.prototype._addTooltip = function(tooltip) {\n\n var id = tooltip.id,\n html = tooltip.html,\n htmlContainer,\n tooltipRoot = this._tooltipRoot;\n\n // unwrap jquery (for those who need it)\n if (html.get && html.constructor.prototype.jquery) {\n html = html.get(0);\n }\n\n // create proper html elements from\n // tooltip HTML strings\n if (isString(html)) {\n html = domify(html);\n }\n\n htmlContainer = domify('
');\n\n htmlContainer.appendChild(html);\n\n if (tooltip.type) {\n domClasses(htmlContainer).add('djs-tooltip-' + tooltip.type);\n }\n\n if (tooltip.className) {\n domClasses(htmlContainer).add(tooltip.className);\n }\n\n tooltip.htmlContainer = htmlContainer;\n\n tooltipRoot.appendChild(htmlContainer);\n\n this._tooltips[id] = tooltip;\n\n this._updateTooltip(tooltip);\n};\n\n\nTooltips.prototype._updateTooltip = function(tooltip) {\n\n var position = tooltip.position,\n htmlContainer = tooltip.htmlContainer;\n\n // update overlay html based on tooltip x, y\n\n setPosition(htmlContainer, position.x, position.y);\n};\n\n\nTooltips.prototype._updateTooltipVisibilty = function(viewbox) {\n\n forEach(this._tooltips, function(tooltip) {\n var show = tooltip.show,\n htmlContainer = tooltip.htmlContainer,\n visible = true;\n\n if (show) {\n if (show.minZoom > viewbox.scale ||\n show.maxZoom < viewbox.scale) {\n visible = false;\n }\n\n setVisible(htmlContainer, visible);\n }\n });\n};\n\nTooltips.prototype._init = function() {\n\n var self = this;\n\n // scroll/zoom integration\n\n function updateViewbox(viewbox) {\n self._updateRoot(viewbox);\n self._updateTooltipVisibilty(viewbox);\n\n self.show();\n }\n\n this._eventBus.on('canvas.viewbox.changing', function(event) {\n self.hide();\n });\n\n this._eventBus.on('canvas.viewbox.changed', function(event) {\n updateViewbox(event.viewbox);\n });\n};\n","module.exports = {\n __init__: [ 'tooltips' ],\n tooltips: [ 'type', require(243) ]\n};","'use strict';\n\nvar svgAppend = require(472),\n svgAttr = require(474),\n svgCreate = require(478);\n\n\nfunction TouchFix(canvas, eventBus) {\n\n var self = this;\n\n eventBus.on('canvas.init', function(e) {\n self.addBBoxMarker(e.svg);\n });\n}\n\nTouchFix.$inject = [ 'canvas', 'eventBus' ];\n\nmodule.exports = TouchFix;\n\n\n/**\n * Safari mobile (iOS 7) does not fire touchstart event in element\n * if there is no shape between 0,0 and viewport elements origin.\n *\n * So touchstart event is only fired when the element was hit.\n * Putting an element over and below the 'viewport' fixes that behavior.\n */\nTouchFix.prototype.addBBoxMarker = function(svg) {\n\n var markerStyle = {\n fill: 'none',\n class: 'outer-bound-marker'\n };\n\n var rect1 = svgCreate('rect');\n svgAttr(rect1, {\n x: -10000,\n y: 10000,\n width: 10,\n height: 10\n });\n svgAttr(rect1, markerStyle);\n\n svgAppend(svg, rect1);\n\n var rect2 = svgCreate('rect');\n svgAttr(rect2, {\n x: 10000,\n y: 10000,\n width: 10,\n height: 10\n });\n svgAttr(rect2, markerStyle);\n\n svgAppend(svg, rect2);\n};\n","'use strict';\n\nvar forEach = require(303),\n domEvent = require(450),\n domClosest = require(447),\n Hammer = require(286),\n Event = require(267);\n\nvar MIN_ZOOM = 0.2,\n MAX_ZOOM = 4;\n\nvar mouseEvents = [\n 'mousedown',\n 'mouseup',\n 'mouseover',\n 'mouseout',\n 'click',\n 'dblclick'\n];\n\nfunction log() {\n // console.log.apply(console, arguments);\n}\n\nfunction get(service, injector) {\n return injector.get(service, false);\n}\n\nfunction createTouchRecognizer(node) {\n\n function stopEvent(event) {\n Event.stopEvent(event, true);\n }\n\n function stopMouse(event) {\n\n forEach(mouseEvents, function(e) {\n domEvent.bind(node, e, stopEvent, true);\n });\n }\n\n function allowMouse(event) {\n setTimeout(function() {\n forEach(mouseEvents, function(e) {\n domEvent.unbind(node, e, stopEvent, true);\n });\n }, 500);\n }\n\n domEvent.bind(node, 'touchstart', stopMouse, true);\n domEvent.bind(node, 'touchend', allowMouse, true);\n domEvent.bind(node, 'touchcancel', allowMouse, true);\n\n // A touch event recognizer that handles\n // touch events only (we know, we can already handle\n // mouse events out of the box)\n\n var recognizer = new Hammer.Manager(node, {\n inputClass: Hammer.TouchInput,\n recognizers: []\n });\n\n\n var tap = new Hammer.Tap();\n var pan = new Hammer.Pan({ threshold: 10 });\n var press = new Hammer.Press();\n var pinch = new Hammer.Pinch();\n\n var doubleTap = new Hammer.Tap({ event: 'doubletap', taps: 2 });\n\n pinch.requireFailure(pan);\n pinch.requireFailure(press);\n\n recognizer.add([ pan, press, pinch, doubleTap, tap ]);\n\n recognizer.reset = function(force) {\n var recognizers = this.recognizers,\n session = this.session;\n\n if (session.stopped) {\n return;\n }\n\n log('recognizer', 'stop');\n\n recognizer.stop(force);\n\n setTimeout(function() {\n var i, r;\n\n log('recognizer', 'reset');\n for (i = 0; (r = recognizers[i]); i++) {\n r.reset();\n r.state = 8; // FAILED STATE\n }\n\n session.curRecognizer = null;\n }, 0);\n };\n\n recognizer.on('hammer.input', function(event) {\n if (event.srcEvent.defaultPrevented) {\n recognizer.reset(true);\n }\n });\n\n return recognizer;\n}\n\n/**\n * A plugin that provides touch events for elements.\n *\n * @param {EventBus} eventBus\n * @param {InteractionEvents} interactionEvents\n */\nfunction TouchInteractionEvents(injector, canvas, eventBus, elementRegistry, interactionEvents) {\n\n // optional integrations\n var dragging = get('dragging', injector),\n move = get('move', injector),\n contextPad = get('contextPad', injector),\n palette = get('palette', injector);\n\n // the touch recognizer\n var recognizer;\n\n function handler(type) {\n\n return function(event) {\n log('element', type, event);\n\n interactionEvents.fire(type, event);\n };\n }\n\n function getGfx(target) {\n var node = domClosest(target, 'svg, .djs-element', true);\n return node;\n }\n\n function initEvents(svg) {\n\n // touch recognizer\n recognizer = createTouchRecognizer(svg);\n\n recognizer.on('doubletap', handler('element.dblclick'));\n\n recognizer.on('tap', handler('element.click'));\n\n function startGrabCanvas(event) {\n\n log('canvas', 'grab start');\n\n var lx = 0, ly = 0;\n\n function update(e) {\n\n var dx = e.deltaX - lx,\n dy = e.deltaY - ly;\n\n canvas.scroll({ dx: dx, dy: dy });\n\n lx = e.deltaX;\n ly = e.deltaY;\n }\n\n function end(e) {\n recognizer.off('panmove', update);\n recognizer.off('panend', end);\n recognizer.off('pancancel', end);\n\n log('canvas', 'grab end');\n }\n\n recognizer.on('panmove', update);\n recognizer.on('panend', end);\n recognizer.on('pancancel', end);\n }\n\n function startGrab(event) {\n\n var gfx = getGfx(event.target),\n element = gfx && elementRegistry.get(gfx);\n\n // recognizer\n if (move && canvas.getRootElement() !== element) {\n log('element', 'move start', element, event, true);\n return move.start(event, element, true);\n } else {\n startGrabCanvas(event);\n }\n }\n\n function startZoom(e) {\n\n log('canvas', 'zoom start');\n\n var zoom = canvas.zoom(),\n mid = e.center;\n\n function update(e) {\n\n var ratio = 1 - (1 - e.scale) / 1.50,\n newZoom = Math.max(MIN_ZOOM, Math.min(MAX_ZOOM, ratio * zoom));\n\n canvas.zoom(newZoom, mid);\n\n Event.stopEvent(e, true);\n }\n\n function end(e) {\n recognizer.off('pinchmove', update);\n recognizer.off('pinchend', end);\n recognizer.off('pinchcancel', end);\n\n recognizer.reset(true);\n\n log('canvas', 'zoom end');\n }\n\n recognizer.on('pinchmove', update);\n recognizer.on('pinchend', end);\n recognizer.on('pinchcancel', end);\n }\n\n recognizer.on('panstart', startGrab);\n recognizer.on('press', startGrab);\n\n recognizer.on('pinchstart', startZoom);\n }\n\n if (dragging) {\n\n // simulate hover during dragging\n eventBus.on('drag.move', function(event) {\n\n var originalEvent = event.originalEvent;\n\n if (!originalEvent || originalEvent instanceof MouseEvent) {\n return;\n }\n\n var position = Event.toPoint(originalEvent);\n\n // this gets really expensive ...\n var node = document.elementFromPoint(position.x, position.y),\n gfx = getGfx(node),\n element = gfx && elementRegistry.get(gfx);\n\n if (element !== event.hover) {\n if (event.hover) {\n dragging.out(event);\n }\n\n if (element) {\n dragging.hover({ element: element, gfx: gfx });\n\n event.hover = element;\n event.hoverGfx = gfx;\n }\n }\n });\n }\n\n if (contextPad) {\n\n eventBus.on('contextPad.create', function(event) {\n var node = event.pad.html;\n\n // touch recognizer\n var padRecognizer = createTouchRecognizer(node);\n\n padRecognizer.on('panstart', function(event) {\n log('context-pad', 'panstart', event);\n contextPad.trigger('dragstart', event, true);\n });\n\n padRecognizer.on('press', function(event) {\n log('context-pad', 'press', event);\n contextPad.trigger('dragstart', event, true);\n });\n\n padRecognizer.on('tap', function(event) {\n log('context-pad', 'tap', event);\n contextPad.trigger('click', event);\n });\n });\n }\n\n if (palette) {\n eventBus.on('palette.create', function(event) {\n var node = event.html;\n\n // touch recognizer\n var padRecognizer = createTouchRecognizer(node);\n\n padRecognizer.on('panstart', function(event) {\n log('palette', 'panstart', event);\n palette.trigger('dragstart', event, true);\n });\n\n padRecognizer.on('press', function(event) {\n log('palette', 'press', event);\n palette.trigger('dragstart', event, true);\n });\n\n padRecognizer.on('tap', function(event) {\n log('palette', 'tap', event);\n palette.trigger('click', event);\n });\n });\n }\n\n eventBus.on('canvas.init', function(event) {\n initEvents(event.svg);\n });\n}\n\n\nTouchInteractionEvents.$inject = [\n 'injector',\n 'canvas',\n 'eventBus',\n 'elementRegistry',\n 'interactionEvents',\n 'touchFix'\n];\n\nmodule.exports = TouchInteractionEvents;\n","module.exports = {\n __depends__: [ require(170) ],\n __init__: [ 'touchInteractionEvents' ],\n touchInteractionEvents: [ 'type', require(246) ],\n touchFix: [ 'type', require(245) ]\n};","module.exports = {\n translate: [ 'value', require(249) ]\n};","'use strict';\n\n/**\n * A simple translation stub to be used for multi-language support\n * in diagrams. Can be easily replaced with a more sophisticated\n * solution.\n *\n * @example\n *\n * // use it inside any diagram component by injecting `translate`.\n *\n * function MyService(translate) {\n * alert(translate('HELLO {you}', { you: 'You!' }));\n * }\n *\n * @param {String} template to interpolate\n * @param {Object} [replacements] a map with substitutes\n *\n * @return {String} the translated string\n */\nmodule.exports = function translate(template, replacements) {\n\n replacements = replacements || {};\n\n return template.replace(/{([^}]+)}/g, function(_, key) {\n return replacements[key] || '{' + key + '}';\n });\n};","'use strict';\n\nvar getMid = require(252).getMid;\n\n\n/**\n * A base connection layouter implementation\n * that layouts the connection by directly connecting\n * mid(source) + mid(target).\n */\nfunction BaseLayouter() {}\n\nmodule.exports = BaseLayouter;\n\n\n/**\n * Return the new layouted waypoints for the given connection.\n *\n * The connection passed is still unchanged; you may figure out about\n * the new connection start / end via the layout hints provided.\n *\n * @param {djs.model.Connection} connection\n * @param {Object} [hints]\n * @param {Point} [hints.connectionStart]\n * @param {Point} [hints.connectionEnd]\n *\n * @return {Array} the layouted connection waypoints\n */\nBaseLayouter.prototype.layoutConnection = function(connection, hints) {\n\n hints = hints || {};\n\n return [\n hints.connectionStart || getMid(connection.source),\n hints.connectionEnd || getMid(connection.target)\n ];\n};\n","'use strict';\n\nvar assign = require(431);\n\nvar LayoutUtil = require(252);\n\n\nfunction dockingToPoint(docking) {\n // use the dockings actual point and\n // retain the original docking\n return assign({ original: docking.point.original || docking.point }, docking.actual);\n}\n\n\n/**\n * A {@link ConnectionDocking} that crops connection waypoints based on\n * the path(s) of the connection source and target.\n *\n * @param {djs.core.ElementRegistry} elementRegistry\n */\nfunction CroppingConnectionDocking(elementRegistry, graphicsFactory) {\n this._elementRegistry = elementRegistry;\n this._graphicsFactory = graphicsFactory;\n}\n\nCroppingConnectionDocking.$inject = [ 'elementRegistry', 'graphicsFactory' ];\n\nmodule.exports = CroppingConnectionDocking;\n\n\n/**\n * @inheritDoc ConnectionDocking#getCroppedWaypoints\n */\nCroppingConnectionDocking.prototype.getCroppedWaypoints = function(connection, source, target) {\n\n source = source || connection.source;\n target = target || connection.target;\n\n var sourceDocking = this.getDockingPoint(connection, source, true),\n targetDocking = this.getDockingPoint(connection, target);\n\n var croppedWaypoints = connection.waypoints.slice(sourceDocking.idx + 1, targetDocking.idx);\n\n croppedWaypoints.unshift(dockingToPoint(sourceDocking));\n croppedWaypoints.push(dockingToPoint(targetDocking));\n\n return croppedWaypoints;\n};\n\n/**\n * Return the connection docking point on the specified shape\n *\n * @inheritDoc ConnectionDocking#getDockingPoint\n */\nCroppingConnectionDocking.prototype.getDockingPoint = function(connection, shape, dockStart) {\n\n var waypoints = connection.waypoints,\n dockingIdx,\n dockingPoint,\n croppedPoint;\n\n dockingIdx = dockStart ? 0 : waypoints.length - 1;\n dockingPoint = waypoints[dockingIdx];\n\n croppedPoint = this._getIntersection(shape, connection, dockStart);\n\n return {\n point: dockingPoint,\n actual: croppedPoint || dockingPoint,\n idx: dockingIdx\n };\n};\n\n\n////// helper methods ///////////////////////////////////////////////////\n\nCroppingConnectionDocking.prototype._getIntersection = function(shape, connection, takeFirst) {\n\n var shapePath = this._getShapePath(shape),\n connectionPath = this._getConnectionPath(connection);\n\n return LayoutUtil.getElementLineIntersection(shapePath, connectionPath, takeFirst);\n};\n\nCroppingConnectionDocking.prototype._getConnectionPath = function(connection) {\n return this._graphicsFactory.getConnectionPath(connection);\n};\n\nCroppingConnectionDocking.prototype._getShapePath = function(shape) {\n return this._graphicsFactory.getShapePath(shape);\n};\n\nCroppingConnectionDocking.prototype._getGfx = function(element) {\n return this._elementRegistry.getGraphics(element);\n};\n","'use strict';\n\nvar isObject = require(426),\n sortBy = require(310),\n pointDistance = require(268).pointDistance;\n\nvar intersection = require(271).intersection;\n\n\nfunction roundBounds(bounds) {\n return {\n x: Math.round(bounds.x),\n y: Math.round(bounds.y),\n width: Math.round(bounds.width),\n height: Math.round(bounds.height)\n };\n}\n\nmodule.exports.roundBounds = roundBounds;\n\n\nfunction roundPoint(point) {\n\n return {\n x: Math.round(point.x),\n y: Math.round(point.y)\n };\n}\n\nmodule.exports.roundPoint = roundPoint;\n\n\n/**\n * Convert the given bounds to a { top, left, bottom, right } descriptor.\n *\n * @param {Bounds|Point} bounds\n *\n * @return {Object}\n */\nfunction asTRBL(bounds) {\n return {\n top: bounds.y,\n right: bounds.x + (bounds.width || 0),\n bottom: bounds.y + (bounds.height || 0),\n left: bounds.x\n };\n}\n\nmodule.exports.asTRBL = asTRBL;\n\n/**\n * Convert a { top, left, bottom, right } to an objects bounds.\n *\n * @param {Object} trbl\n *\n * @return {Bounds}\n */\nfunction asBounds(trbl) {\n return {\n x: trbl.left,\n y: trbl.top,\n width: trbl.right - trbl.left,\n height: trbl.bottom - trbl.top\n };\n}\n\nmodule.exports.asBounds = asBounds;\n\n\n/**\n * Get the mid of the given bounds or point.\n *\n * @param {Bounds|Point} bounds\n *\n * @return {Point}\n */\nfunction getMid(bounds) {\n return roundPoint({\n x: bounds.x + (bounds.width || 0) / 2,\n y: bounds.y + (bounds.height || 0) / 2\n });\n}\n\nmodule.exports.getMid = getMid;\n\n\n////// orientation utils //////////////////////////////\n\n/**\n * Get orientation of the given rectangle with respect to\n * the reference rectangle.\n *\n * A padding (positive or negative) may be passed to influence\n * horizontal / vertical orientation and intersection.\n *\n * @param {Bounds} rect\n * @param {Bounds} reference\n * @param {Point|Number} padding\n *\n * @return {String} the orientation; one of top, top-left, left, ..., bottom, right or intersect.\n */\nfunction getOrientation(rect, reference, padding) {\n\n padding = padding || 0;\n\n // make sure we can use an object, too\n // for individual { x, y } padding\n if (!isObject(padding)) {\n padding = { x: padding, y: padding };\n }\n\n\n var rectOrientation = asTRBL(rect),\n referenceOrientation = asTRBL(reference);\n\n var top = rectOrientation.bottom + padding.y <= referenceOrientation.top,\n right = rectOrientation.left - padding.x >= referenceOrientation.right,\n bottom = rectOrientation.top - padding.y >= referenceOrientation.bottom,\n left = rectOrientation.right + padding.x <= referenceOrientation.left;\n\n var vertical = top ? 'top' : (bottom ? 'bottom' : null),\n horizontal = left ? 'left' : (right ? 'right' : null);\n\n if (horizontal && vertical) {\n return vertical + '-' + horizontal;\n } else {\n return horizontal || vertical || 'intersect';\n }\n}\n\nmodule.exports.getOrientation = getOrientation;\n\n\n////// intersection utils //////////////////////////////\n\n/**\n * Get intersection between an element and a line path.\n *\n * @param {PathDef} elementPath\n * @param {PathDef} linePath\n * @param {Boolean} cropStart crop from start or end\n *\n * @return {Point}\n */\nfunction getElementLineIntersection(elementPath, linePath, cropStart) {\n\n var intersections = getIntersections(elementPath, linePath);\n\n // recognize intersections\n // only one -> choose\n // two close together -> choose first\n // two or more distinct -> pull out appropriate one\n // none -> ok (fallback to point itself)\n if (intersections.length === 1) {\n return roundPoint(intersections[0]);\n } else if (intersections.length === 2 && pointDistance(intersections[0], intersections[1]) < 1) {\n return roundPoint(intersections[0]);\n } else if (intersections.length > 1) {\n\n // sort by intersections based on connection segment +\n // distance from start\n intersections = sortBy(intersections, function(i) {\n var distance = Math.floor(i.t2 * 100) || 1;\n\n distance = 100 - distance;\n\n distance = (distance < 10 ? '0' : '') + distance;\n\n // create a sort string that makes sure we sort\n // line segment ASC + line segment position DESC (for cropStart)\n // line segment ASC + line segment position ASC (for cropEnd)\n return i.segment2 + '#' + distance;\n });\n\n return roundPoint(intersections[cropStart ? 0 : intersections.length - 1]);\n }\n\n return null;\n}\n\nmodule.exports.getElementLineIntersection = getElementLineIntersection;\n\n\nfunction getIntersections(a, b) {\n return intersection(a, b);\n}\n\nmodule.exports.getIntersections = getIntersections;\n","'use strict';\n\nvar isArray = require(422),\n find = require(302),\n without = require(297),\n assign = require(431);\n\nvar LayoutUtil = require(252),\n Geometry = require(268);\n\nvar getOrientation = LayoutUtil.getOrientation,\n getMid = LayoutUtil.getMid,\n pointsAligned = Geometry.pointsAligned;\n\nvar pointInRect = Geometry.pointInRect,\n pointDistance = Geometry.pointDistance;\n\nvar INTERSECTION_THRESHOLD = 20,\n ORIENTATION_THRESHOLD = {\n 'h:h': 20,\n 'v:v': 20,\n 'h:v': -10,\n 'v:h': -10\n };\n\n\n/**\n * Returns the mid points for a manhattan connection between two points.\n *\n * @example\n *\n * [a]----[x]\n * |\n * [x]----[b]\n *\n * @example\n *\n * [a]----[x]\n * |\n * [b]\n *\n * @param {Point} a\n * @param {Point} b\n * @param {String} directions\n *\n * @return {Array}\n */\nfunction getBendpoints(a, b, directions) {\n\n directions = directions || 'h:h';\n\n var xmid, ymid;\n\n // one point, next to a\n if (directions === 'h:v') {\n return [ { x: b.x, y: a.y } ];\n } else\n // one point, above a\n if (directions === 'v:h') {\n return [ { x: a.x, y: b.y } ];\n } else\n // vertical edge xmid\n if (directions === 'h:h') {\n xmid = Math.round((b.x - a.x) / 2 + a.x);\n\n return [\n { x: xmid, y: a.y },\n { x: xmid, y: b.y }\n ];\n } else\n // horizontal edge ymid\n if (directions === 'v:v') {\n ymid = Math.round((b.y - a.y) / 2 + a.y);\n\n return [\n { x: a.x, y: ymid },\n { x: b.x, y: ymid }\n ];\n } else {\n throw new Error(\n 'unknown directions: <' + directions + '>: ' +\n 'directions must be specified as {a direction}:{b direction} (direction in h|v)');\n }\n}\n\nmodule.exports.getBendpoints = getBendpoints;\n\n\n/**\n * Create a connection between the two points according\n * to the manhattan layout (only horizontal and vertical) edges.\n *\n * @param {Point} a\n * @param {Point} b\n *\n * @param {String} [directions='h:h'] specifies manhattan directions for each point as {adirection}:{bdirection}.\n A directionfor a point is either `h` (horizontal) or `v` (vertical)\n *\n * @return {Array}\n */\nfunction connectPoints(a, b, directions) {\n\n var points = [];\n\n if (!pointsAligned(a, b)) {\n points = getBendpoints(a, b, directions);\n }\n\n points.unshift(a);\n points.push(b);\n\n return points;\n}\n\nmodule.exports.connectPoints = connectPoints;\n\n\n/**\n * Connect two rectangles using a manhattan layouted connection.\n *\n * @param {Bounds} source source rectangle\n * @param {Bounds} target target rectangle\n * @param {Point} [start] source docking\n * @param {Point} [end] target docking\n *\n * @param {Object} [hints]\n * @param {String} [hints.preserveDocking=source] preserve docking on selected side\n * @param {Array} [hints.preferredLayouts]\n * @param {Point|Boolean} [hints.connectionStart] whether the start changed\n * @param {Point|Boolean} [hints.connectionEnd] whether the end changed\n *\n * @return {Array} connection points\n */\nfunction connectRectangles(source, target, start, end, hints) {\n\n var preferredLayouts = hints && hints.preferredLayouts || [];\n\n var preferredLayout = without(preferredLayouts, 'straight')[0] || 'h:h';\n\n var threshold = ORIENTATION_THRESHOLD[preferredLayout] || 0;\n\n var orientation = getOrientation(source, target, threshold);\n\n var directions = getDirections(orientation, preferredLayout);\n\n start = start || getMid(source);\n end = end || getMid(target);\n\n // overlapping elements\n if (!directions) {\n return;\n }\n\n if (directions === 'h:h') {\n\n switch (orientation) {\n case 'top-right':\n case 'right':\n case 'bottom-right':\n start = { original: start, x: source.x, y: start.y };\n end = { original: end, x: target.x + target.width, y: end.y };\n break;\n case 'top-left':\n case 'left':\n case 'bottom-left':\n start = { original: start, x: source.x + source.width, y: start.y };\n end = { original: end, x: target.x, y: end.y };\n break;\n }\n }\n\n if (directions === 'v:v') {\n\n switch (orientation) {\n case 'top-left':\n case 'top':\n case 'top-right':\n start = { original: start, x: start.x, y: source.y + source.height };\n end = { original: end, x: end.x, y: target.y };\n break;\n case 'bottom-left':\n case 'bottom':\n case 'bottom-right':\n start = { original: start, x: start.x, y: source.y };\n end = { original: end, x: end.x, y: target.y + target.height };\n break;\n }\n }\n\n return connectPoints(start, end, directions);\n}\n\nmodule.exports.connectRectangles = connectRectangles;\n\n\n/**\n * Repair the connection between two rectangles, of which one has been updated.\n *\n * @param {Bounds} source\n * @param {Bounds} target\n * @param {Point} [start]\n * @param {Point} [end]\n * @param {Array} waypoints\n * @param {Object} [hints]\n * @param {Array} [hints.preferredLayouts] list of preferred layouts\n * @param {Boolean} [hints.connectionStart]\n * @param {Boolean} [hints.connectionEnd]\n *\n * @return {Array} repaired waypoints\n */\nfunction repairConnection(source, target, start, end, waypoints, hints) {\n\n if (isArray(start)) {\n waypoints = start;\n hints = end;\n\n start = getMid(source);\n end = getMid(target);\n }\n\n hints = assign({ preferredLayouts: [] }, hints);\n waypoints = waypoints || [];\n\n var preferredLayouts = hints.preferredLayouts,\n preferStraight = preferredLayouts.indexOf('straight') !== -1,\n repairedWaypoints;\n\n // just layout non-existing or simple connections\n // attempt to render straight lines, if required\n\n if (preferStraight) {\n // attempt to layout a straight line\n repairedWaypoints = layoutStraight(source, target, start, end, hints);\n }\n\n if (!repairedWaypoints) {\n // check if we layout from start or end\n if (hints.connectionEnd) {\n repairedWaypoints = _repairConnectionSide(target, source, end, waypoints.slice().reverse());\n repairedWaypoints = repairedWaypoints && repairedWaypoints.reverse();\n } else\n if (hints.connectionStart) {\n repairedWaypoints = _repairConnectionSide(source, target, start, waypoints);\n } else\n // or whether nothing seems to have changed\n if (waypoints && waypoints.length) {\n repairedWaypoints = waypoints;\n }\n }\n\n // simply reconnect if nothing else worked\n if (!repairedWaypoints) {\n repairedWaypoints = connectRectangles(source, target, start, end, hints);\n }\n\n return repairedWaypoints;\n}\n\nmodule.exports.repairConnection = repairConnection;\n\n\nfunction inRange(a, start, end) {\n return a >= start && a <= end;\n}\n\nfunction isInRange(axis, a, b) {\n var size = {\n x: 'width',\n y: 'height'\n };\n\n return inRange(a[axis], b[axis], b[axis] + b[size[axis]]);\n}\n\n/**\n * Layout a straight connection\n *\n * @param {Bounds} source\n * @param {Bounds} target\n * @param {Point} start\n * @param {Point} end\n * @param {Object} [hints]\n *\n * @return {Array} waypoints if straight layout worked\n */\nfunction layoutStraight(source, target, start, end, hints) {\n var axis = {},\n primaryAxis,\n orientation;\n\n orientation = getOrientation(source, target);\n\n // We're only interested in layouting a straight connection\n // if the shapes are horizontally or vertically aligned\n if (!/^(top|bottom|left|right)$/.test(orientation)) {\n return null;\n }\n\n if (/top|bottom/.test(orientation)) {\n primaryAxis = 'x';\n }\n\n if (/left|right/.test(orientation)) {\n primaryAxis = 'y';\n }\n\n if (hints.preserveDocking === 'target') {\n\n if (!isInRange(primaryAxis, end, source)) {\n return null;\n }\n\n axis[primaryAxis] = end[primaryAxis];\n\n return [\n {\n x: axis.x !== undefined ? axis.x : start.x,\n y: axis.y !== undefined ? axis.y : start.y,\n original: {\n x: axis.x !== undefined ? axis.x : start.x,\n y: axis.y !== undefined ? axis.y : start.y\n }\n },\n {\n x: end.x,\n y: end.y\n }\n ];\n\n } else {\n\n if (!isInRange(primaryAxis, start, target)) {\n return null;\n }\n\n axis[primaryAxis] = start[primaryAxis];\n\n return [\n {\n x: start.x,\n y: start.y\n },\n {\n x: axis.x !== undefined ? axis.x : end.x,\n y: axis.y !== undefined ? axis.y : end.y,\n original: {\n x: axis.x !== undefined ? axis.x : end.x,\n y: axis.y !== undefined ? axis.y : end.y\n }\n }\n ];\n }\n\n}\n\nmodule.exports.layoutStraight = layoutStraight;\n\n\n/**\n * Repair a connection from one side that moved.\n *\n * @param {Bounds} moved\n * @param {Bounds} other\n * @param {Point} newDocking\n * @param {Array} points originalPoints from moved to other\n *\n * @return {Array} the repaired points between the two rectangles\n */\nfunction _repairConnectionSide(moved, other, newDocking, points) {\n\n function needsRelayout(moved, other, points) {\n\n if (points.length < 3) {\n return true;\n }\n\n if (points.length > 4) {\n return false;\n }\n\n // relayout if two points overlap\n // this is most likely due to\n return !!find(points, function(p, idx) {\n var q = points[idx - 1];\n\n return q && pointDistance(p, q) < 3;\n });\n }\n\n function repairBendpoint(candidate, oldPeer, newPeer) {\n\n var alignment = pointsAligned(oldPeer, candidate);\n\n switch (alignment) {\n case 'v':\n // repair vertical alignment\n return { x: candidate.x, y: newPeer.y };\n case 'h':\n // repair horizontal alignment\n return { x: newPeer.x, y: candidate.y };\n }\n\n return { x: candidate.x, y: candidate. y };\n }\n\n function removeOverlapping(points, a, b) {\n var i;\n\n for (i = points.length - 2; i !== 0; i--) {\n\n // intersects (?) break, remove all bendpoints up to this one and relayout\n if (pointInRect(points[i], a, INTERSECTION_THRESHOLD) ||\n pointInRect(points[i], b, INTERSECTION_THRESHOLD)) {\n\n // return sliced old connection\n return points.slice(i);\n }\n }\n\n return points;\n }\n\n\n // (0) only repair what has layoutable bendpoints\n\n // (1) if only one bendpoint and on shape moved onto other shapes axis\n // (horizontally / vertically), relayout\n\n if (needsRelayout(moved, other, points)) {\n return null;\n }\n\n var oldDocking = points[0],\n newPoints = points.slice(),\n slicedPoints;\n\n // (2) repair only last line segment and only if it was layouted before\n\n newPoints[0] = newDocking;\n newPoints[1] = repairBendpoint(newPoints[1], oldDocking, newDocking);\n\n\n // (3) if shape intersects with any bendpoint after repair,\n // remove all segments up to this bendpoint and repair from there\n\n slicedPoints = removeOverlapping(newPoints, moved, other);\n\n if (slicedPoints !== newPoints) {\n return _repairConnectionSide(moved, other, newDocking, slicedPoints);\n }\n\n return newPoints;\n}\n\nmodule.exports._repairConnectionSide = _repairConnectionSide;\n\n/**\n * Returns the manhattan directions connecting two rectangles\n * with the given orientation.\n *\n * @example\n *\n * getDirections('top'); // -> 'v:v'\n *\n * getDirections('top-right', 'v:h'); // -> 'v:h'\n * getDirections('top-right', 'h:h'); // -> 'h:h'\n *\n *\n * @param {String} orientation\n * @param {String} defaultLayout\n *\n * @return {String}\n */\nfunction getDirections(orientation, defaultLayout) {\n\n switch (orientation) {\n case 'intersect':\n return null;\n\n case 'top':\n case 'bottom':\n return 'v:v';\n\n case 'left':\n case 'right':\n return 'h:h';\n\n // 'top-left'\n // 'top-right'\n // 'bottom-left'\n // 'bottom-right'\n default:\n return defaultLayout;\n }\n}\n","'use strict';\n\nvar assign = require(431),\n inherits = require(289);\n\nvar Refs = require(466);\n\nvar parentRefs = new Refs({ name: 'children', enumerable: true, collection: true }, { name: 'parent' }),\n labelRefs = new Refs({ name: 'label', enumerable: true }, { name: 'labelTarget' }),\n attacherRefs = new Refs({ name: 'attachers', collection: true }, { name: 'host' }),\n outgoingRefs = new Refs({ name: 'outgoing', collection: true }, { name: 'source' }),\n incomingRefs = new Refs({ name: 'incoming', collection: true }, { name: 'target' });\n\n/**\n * @namespace djs.model\n */\n\n/**\n * @memberOf djs.model\n */\n\n/**\n * The basic graphical representation\n *\n * @class\n *\n * @abstract\n */\nfunction Base() {\n\n /**\n * The object that backs up the shape\n *\n * @name Base#businessObject\n * @type Object\n */\n Object.defineProperty(this, 'businessObject', {\n writable: true\n });\n\n /**\n * The parent shape\n *\n * @name Base#parent\n * @type Shape\n */\n parentRefs.bind(this, 'parent');\n\n /**\n * @name Base#label\n * @type Label\n */\n labelRefs.bind(this, 'label');\n\n /**\n * The list of outgoing connections\n *\n * @name Base#outgoing\n * @type Array\n */\n outgoingRefs.bind(this, 'outgoing');\n\n /**\n * The list of incoming connections\n *\n * @name Base#incoming\n * @type Array\n */\n incomingRefs.bind(this, 'incoming');\n}\n\n\n/**\n * A graphical object\n *\n * @class\n * @constructor\n *\n * @extends Base\n */\nfunction Shape() {\n Base.call(this);\n\n /**\n * The list of children\n *\n * @name Shape#children\n * @type Array\n */\n parentRefs.bind(this, 'children');\n\n /**\n * @name Shape#host\n * @type Shape\n */\n attacherRefs.bind(this, 'host');\n\n /**\n * @name Shape#attachers\n * @type Shape\n */\n attacherRefs.bind(this, 'attachers');\n}\n\ninherits(Shape, Base);\n\n\n/**\n * A root graphical object\n *\n * @class\n * @constructor\n *\n * @extends Shape\n */\nfunction Root() {\n Shape.call(this);\n}\n\ninherits(Root, Shape);\n\n\n/**\n * A label for an element\n *\n * @class\n * @constructor\n *\n * @extends Shape\n */\nfunction Label() {\n Shape.call(this);\n\n /**\n * The labeled element\n *\n * @name Label#labelTarget\n * @type Base\n */\n labelRefs.bind(this, 'labelTarget');\n}\n\ninherits(Label, Shape);\n\n\n/**\n * A connection between two elements\n *\n * @class\n * @constructor\n *\n * @extends Base\n */\nfunction Connection() {\n Base.call(this);\n\n /**\n * The element this connection originates from\n *\n * @name Connection#source\n * @type Base\n */\n outgoingRefs.bind(this, 'source');\n\n /**\n * The element this connection points to\n *\n * @name Connection#target\n * @type Base\n */\n incomingRefs.bind(this, 'target');\n}\n\ninherits(Connection, Base);\n\n\nvar types = {\n connection: Connection,\n shape: Shape,\n label: Label,\n root: Root\n};\n\n/**\n * Creates a new model element of the specified type\n *\n * @method create\n *\n * @example\n *\n * var shape1 = Model.create('shape', { x: 10, y: 10, width: 100, height: 100 });\n * var shape2 = Model.create('shape', { x: 210, y: 210, width: 100, height: 100 });\n *\n * var connection = Model.create('connection', { waypoints: [ { x: 110, y: 55 }, {x: 210, y: 55 } ] });\n *\n * @param {String} type lower-cased model name\n * @param {Object} attrs attributes to initialize the new model instance with\n *\n * @return {Base} the new model instance\n */\nmodule.exports.create = function(type, attrs) {\n var Type = types[type];\n if (!Type) {\n throw new Error('unknown type: <' + type + '>');\n }\n return assign(new Type(), attrs);\n};\n\n\nmodule.exports.Base = Base;\nmodule.exports.Root = Root;\nmodule.exports.Shape = Shape;\nmodule.exports.Connection = Connection;\nmodule.exports.Label = Label;\n","'use strict';\n\nvar Cursor = require(265),\n ClickTrap = require(262),\n substract = require(273).substract,\n domEvent = require(450),\n domClosest = require(447),\n EventUtil = require(267);\n\n\nfunction length(point) {\n return Math.sqrt(Math.pow(point.x, 2) + Math.pow(point.y, 2));\n}\n\n\nvar THRESHOLD = 15;\n\n\nfunction MoveCanvas(eventBus, canvas) {\n\n var container = canvas._container,\n context;\n\n\n function handleMove(event) {\n\n var start = context.start,\n position = EventUtil.toPoint(event),\n delta = substract(position, start);\n\n if (!context.dragging && length(delta) > THRESHOLD) {\n context.dragging = true;\n\n // prevent mouse click in this\n // interaction sequence\n ClickTrap.install();\n\n Cursor.set('grab');\n }\n\n if (context.dragging) {\n\n var lastPosition = context.last || context.start;\n\n delta = substract(position, lastPosition);\n\n canvas.scroll({\n dx: delta.x,\n dy: delta.y\n });\n\n context.last = position;\n }\n\n // prevent select\n event.preventDefault();\n }\n\n\n function handleEnd(event) {\n domEvent.unbind(document, 'mousemove', handleMove);\n domEvent.unbind(document, 'mouseup', handleEnd);\n\n context = null;\n\n Cursor.unset();\n }\n\n function handleStart(event) {\n // event is already handled by '.djs-draggable'\n if (domClosest(event.target, '.djs-draggable')) {\n return;\n }\n\n\n // reject non-left left mouse button or modifier key\n if (event.button || event.ctrlKey || event.shiftKey || event.altKey) {\n return;\n }\n\n context = {\n start: EventUtil.toPoint(event)\n };\n\n domEvent.bind(document, 'mousemove', handleMove);\n domEvent.bind(document, 'mouseup', handleEnd);\n }\n\n domEvent.bind(container, 'mousedown', handleStart);\n}\n\n\nMoveCanvas.$inject = [ 'eventBus', 'canvas' ];\n\nmodule.exports = MoveCanvas;\n","module.exports = {\n __init__: [ 'moveCanvas' ],\n moveCanvas: [ 'type', require(255) ]\n};","module.exports = {\n __depends__: [ require(247) ]\n};","'use strict';\n\nvar domEvent = require(450),\n domClosest = require(447);\n\nvar hasPrimaryModifier = require(274).hasPrimaryModifier,\n hasSecondaryModifier = require(274).hasSecondaryModifier;\n\nvar isMac = require(275).isMac;\n\nvar getStepSize = require(259).getStepSize,\n cap = require(259).cap;\n\nvar log10 = require(273).log10;\n\nvar bind = require(312);\n\nvar RANGE = { min: 0.2, max: 4 },\n NUM_STEPS = 10;\n\nvar DELTA_THRESHOLD = 0.1;\n\n\n/**\n * An implementation of zooming and scrolling within the\n * {@link Canvas} via the mouse wheel.\n *\n * Mouse wheel zooming / scrolling may be disabled using\n * the {@link toggle(enabled)} method.\n *\n * Additionally users can define the initial enabled state\n * by passing `{ zoomScroll: { enabled: false } }` at diagram\n * initialization.\n *\n * @param {EventBus} eventBus\n * @param {Canvas} canvas\n * @param {Object} config\n */\nfunction ZoomScroll(eventBus, canvas, config) {\n\n this._enabled = false;\n\n this._canvas = canvas;\n this._container = canvas._container;\n\n this._handleWheel = bind(this._handleWheel, this);\n\n var newEnabled = !config || config.enabled !== false;\n\n this.totalDelta = 0;\n\n var self = this;\n\n eventBus.on('canvas.init', function(e) {\n self._init(newEnabled);\n });\n}\n\nZoomScroll.$inject = [ 'eventBus', 'canvas', 'config.zoomScroll' ];\n\nmodule.exports = ZoomScroll;\n\nZoomScroll.prototype.scroll = function scroll(delta) {\n this._canvas.scroll(delta);\n};\n\n\nZoomScroll.prototype.reset = function reset() {\n this._canvas.zoom('fit-viewport');\n};\n\n/**\n * Zoom depending on delta.\n * \n * @param {number} delta - Zoom delta.\n * @param {Object} position - Zoom position.\n */\nZoomScroll.prototype.zoom = function zoom(delta, position) {\n\n // zoom with half the step size of stepZoom\n var stepSize = getStepSize(RANGE, NUM_STEPS * 2);\n\n // add until threshold reached\n this.totalDelta += delta;\n\n if (Math.abs(this.totalDelta) > DELTA_THRESHOLD) {\n this._zoom(delta, position, stepSize);\n\n // reset\n this.totalDelta = 0;\n }\n};\n\n\nZoomScroll.prototype._handleWheel = function handleWheel(event) {\n // event is already handled by '.djs-scrollable'\n if (domClosest(event.target, '.djs-scrollable', true)) {\n return;\n }\n\n var element = this._container;\n\n event.preventDefault();\n\n // mouse-event: SELECTION_KEY\n // mouse-event: AND_KEY\n var isVerticalScroll = hasPrimaryModifier(event),\n isHorizontalScroll = hasSecondaryModifier(event);\n\n var factor;\n\n if (isVerticalScroll || isHorizontalScroll) {\n\n if (isMac) {\n factor = event.deltaMode === 0 ? 1.25 : 50;\n } else {\n factor = event.deltaMode === 0 ? 1/40 : 1/2;\n }\n\n var delta = {};\n\n if (isHorizontalScroll) {\n delta.dx = (factor * (event.deltaX || event.deltaY));\n } else {\n delta.dy = (factor * event.deltaY);\n }\n this.scroll(delta);\n } else {\n factor = (event.deltaMode === 0 ? 1/40 : 1/2);\n\n var elementRect = element.getBoundingClientRect();\n\n var offset = {\n x: event.clientX - elementRect.left,\n y: event.clientY - elementRect.top\n };\n\n // zoom in relative to diagram {x,y} coordinates\n this.zoom(event.deltaY * factor / (-5), offset);\n }\n};\n\n/**\n * Zoom with fixed step size.\n *\n * @param {number} delta - Zoom delta (1 for zooming in, -1 for out).\n * @param {Object} position - Zoom position.\n */\nZoomScroll.prototype.stepZoom = function stepZoom(delta, position) {\n\n var stepSize = getStepSize(RANGE, NUM_STEPS);\n\n this._zoom(delta, position, stepSize);\n};\n\n\n/**\n * Zoom in/out given a step size.\n * \n * @param {number} delta - Zoom delta. Can be positive or negative.\n * @param {Object} position - Zoom position.\n * @param {number} stepSize - Step size.\n */\nZoomScroll.prototype._zoom = function(delta, position, stepSize) {\n var canvas = this._canvas;\n\n var direction = delta > 0 ? 1 : -1;\n\n var currentLinearZoomLevel = log10(canvas.zoom());\n\n // snap to a proximate zoom step\n var newLinearZoomLevel = Math.round(currentLinearZoomLevel / stepSize) * stepSize;\n\n // increase or decrease one zoom step in the given direction\n newLinearZoomLevel += stepSize * direction;\n\n // calculate the absolute logarithmic zoom level based on the linear zoom level\n // (e.g. 2 for an absolute x2 zoom)\n var newLogZoomLevel = Math.pow(10, newLinearZoomLevel);\n\n canvas.zoom(cap(RANGE, newLogZoomLevel), position);\n};\n\n\n/**\n * Toggle the zoom scroll ability via mouse wheel.\n *\n * @param {Boolean} [newEnabled] new enabled state\n */\nZoomScroll.prototype.toggle = function toggle(newEnabled) {\n\n var element = this._container;\n var handleWheel = this._handleWheel;\n\n var oldEnabled = this._enabled;\n\n if (typeof newEnabled === 'undefined') {\n newEnabled = !oldEnabled;\n }\n\n // only react on actual changes\n if (oldEnabled !== newEnabled) {\n\n // add or remove wheel listener based on\n // changed enabled state\n domEvent[newEnabled ? 'bind' : 'unbind'](element, 'wheel', handleWheel, false);\n }\n\n this._enabled = newEnabled;\n\n return newEnabled;\n};\n\n\nZoomScroll.prototype._init = function(newEnabled) {\n this.toggle(newEnabled);\n};\n","'use strict';\n\n\nvar log10 = require(273).log10;\n\n/**\n * Get step size for given range and number of steps.\n * \n * @param {Object} range - Range.\n * @param {number} range.min - Range minimum.\n * @param {number} range.max - Range maximum.\n */\nmodule.exports.getStepSize = function(range, steps) {\n\n var minLinearRange = log10(range.min),\n maxLinearRange = log10(range.max);\n\n var absoluteLinearRange = Math.abs(minLinearRange) + Math.abs(maxLinearRange);\n\n return absoluteLinearRange / steps;\n};\n\nmodule.exports.cap = function(range, scale) {\n return Math.max(range.min, Math.min(range.max, scale));\n};\n","module.exports = {\n __init__: [ 'zoomScroll' ],\n zoomScroll: [ 'type', require(258) ]\n};","'use strict';\n\nvar roundPoint = require(252).roundPoint;\n\nvar center = require(276).center,\n delta = require(276).delta;\n\n\n/**\n * Calculates the absolute point relative to the new element's position\n *\n * @param {point} point [absolute]\n * @param {bounds} oldBounds\n * @param {bounds} newBounds\n *\n * @return {point} point [absolute]\n */\nfunction getNewAttachPoint(point, oldBounds, newBounds) {\n var oldCenter = center(oldBounds),\n newCenter = center(newBounds),\n oldDelta = delta(point, oldCenter);\n\n var newDelta = {\n x: oldDelta.x * (newBounds.width / oldBounds.width),\n y: oldDelta.y * (newBounds.height / oldBounds.height)\n };\n\n return roundPoint({\n x: newCenter.x + newDelta.x,\n y: newCenter.y + newDelta.y\n });\n}\n\nmodule.exports.getNewAttachPoint = getNewAttachPoint;\n\n\n/**\n * Calculates the shape's delta relative to a new position\n * of a certain element's bounds\n *\n * @param {djs.model.Shape} point [absolute]\n * @param {bounds} oldBounds\n * @param {bounds} newBounds\n *\n * @return {delta} delta\n */\nfunction getNewAttachShapeDelta(shape, oldBounds, newBounds) {\n var shapeCenter = center(shape),\n oldCenter = center(oldBounds),\n newCenter = center(newBounds),\n shapeDelta = delta(shape, shapeCenter),\n oldCenterDelta = delta(shapeCenter, oldCenter);\n\n var newCenterDelta = {\n x: oldCenterDelta.x * (newBounds.width / oldBounds.width),\n y: oldCenterDelta.y * (newBounds.height / oldBounds.height)\n };\n\n var newShapeCenter = {\n x: newCenter.x + newCenterDelta.x,\n y: newCenter.y + newCenterDelta.y\n };\n\n return roundPoint({\n x: newShapeCenter.x + shapeDelta.x - shape.x,\n y: newShapeCenter.y + shapeDelta.y - shape.y\n });\n}\n\nmodule.exports.getNewAttachShapeDelta = getNewAttachShapeDelta;\n","'use strict';\n\nvar domEvent = require(450),\n stopEvent = require(267).stopEvent;\n\nfunction trap(event) {\n stopEvent(event);\n\n toggle(false);\n}\n\nfunction toggle(active) {\n domEvent[active ? 'bind' : 'unbind'](document.body, 'click', trap, true);\n}\n\n/**\n * Installs a click trap that prevents a ghost click following a dragging operation.\n *\n * @return {Function} a function to immediately remove the installed trap.\n */\nfunction install() {\n\n toggle(true);\n\n return function() {\n toggle(false);\n };\n}\n\nmodule.exports.install = install;","'use strict';\n\n/**\n * Failsafe remove an element from a collection\n *\n * @param {Array} [collection]\n * @param {Object} [element]\n *\n * @return {Number} the previous index of the element\n */\nmodule.exports.remove = function(collection, element) {\n\n if (!collection || !element) {\n return -1;\n }\n\n var idx = collection.indexOf(element);\n\n if (idx !== -1) {\n collection.splice(idx, 1);\n }\n\n return idx;\n};\n\n/**\n * Fail save add an element to the given connection, ensuring\n * it does not yet exist.\n *\n * @param {Array} collection\n * @param {Object} element\n * @param {Number} idx\n */\nmodule.exports.add = function(collection, element, idx) {\n\n if (!collection || !element) {\n return;\n }\n\n if (typeof idx !== 'number') {\n idx = -1;\n }\n\n var currentIdx = collection.indexOf(element);\n\n if (currentIdx !== -1) {\n\n if (currentIdx === idx) {\n // nothing to do, position has not changed\n return;\n } else {\n\n if (idx !== -1) {\n // remove from current position\n collection.splice(currentIdx, 1);\n } else {\n // already exists in collection\n return;\n }\n }\n }\n\n if (idx !== -1) {\n // insert at specified position\n collection.splice(idx, 0, element);\n } else {\n // push to end\n collection.push(element);\n }\n};\n\n\n/**\n * Fail save get the index of an element in a collection.\n *\n * @param {Array} collection\n * @param {Object} element\n *\n * @return {Number} the index or -1 if collection or element do\n * not exist or the element is not contained.\n */\nmodule.exports.indexOf = function(collection, element) {\n\n if (!collection || !element) {\n return -1;\n }\n\n return collection.indexOf(element);\n};\n","'use strict';\n\nvar forEach = require(303);\n\nfunction getTopLevel(elements) {\n var topLevel = {},\n parents = [],\n result = [],\n clearedParents = [];\n\n forEach(elements, function(element) {\n var parent = element.parent;\n\n if (!topLevel[parent.id]) {\n topLevel[parent.id] = [];\n }\n\n if (parents.indexOf(parent.id) === -1) {\n parents.push(parent.id);\n }\n\n topLevel[parent.id].push(element);\n });\n\n forEach(parents, function(parent) {\n forEach(topLevel[parent], function(element) {\n if (topLevel[element.id]) {\n clearedParents.push(element.id);\n }\n });\n });\n\n forEach(parents, function(parent) {\n var idx = clearedParents.indexOf(parent);\n\n if (idx === -1) {\n result = result.concat(topLevel[parent]);\n }\n });\n\n return result;\n}\n\nmodule.exports.getTopLevel = getTopLevel;\n","'use strict';\n\nvar domClasses = require(445);\n\nvar CURSOR_CLS_PATTERN = /^djs-cursor-.*$/;\n\n\nmodule.exports.set = function(mode) {\n var classes = domClasses(document.body);\n\n classes.removeMatching(CURSOR_CLS_PATTERN);\n\n if (mode) {\n classes.add('djs-cursor-' + mode);\n }\n};\n\nmodule.exports.unset = function() {\n this.set(null);\n};\n\nmodule.exports.has = function(mode) {\n var classes = domClasses(document.body);\n\n return classes.has('djs-cursor-' + mode);\n};\n","'use strict';\n\nvar isArray = require(422),\n isNumber = require(425),\n groupBy = require(304),\n forEach = require(303);\n\n/**\n * Adds an element to a collection and returns true if the\n * element was added.\n *\n * @param {Array} elements\n * @param {Object} e\n * @param {Boolean} unique\n */\nfunction add(elements, e, unique) {\n var canAdd = !unique || elements.indexOf(e) === -1;\n\n if (canAdd) {\n elements.push(e);\n }\n\n return canAdd;\n}\n\n/**\n * Iterate over each element in a collection, calling the iterator function `fn`\n * with (element, index, recursionDepth).\n *\n * Recurse into all elements that are returned by `fn`.\n *\n * @param {Object|Array} elements\n * @param {Function} fn iterator function called with (element, index, recursionDepth)\n * @param {Number} [depth] maximum recursion depth\n */\nfunction eachElement(elements, fn, depth) {\n\n depth = depth || 0;\n\n if (!isArray(elements)) {\n elements = [ elements ];\n }\n\n forEach(elements, function(s, i) {\n var filter = fn(s, i, depth);\n\n if (isArray(filter) && filter.length) {\n eachElement(filter, fn, depth + 1);\n }\n });\n}\n\n/**\n * Collects self + child elements up to a given depth from a list of elements.\n *\n * @param {djs.model.Base|Array} elements the elements to select the children from\n * @param {Boolean} unique whether to return a unique result set (no duplicates)\n * @param {Number} maxDepth the depth to search through or -1 for infinite\n *\n * @return {Array} found elements\n */\nfunction selfAndChildren(elements, unique, maxDepth) {\n var result = [],\n processedChildren = [];\n\n eachElement(elements, function(element, i, depth) {\n add(result, element, unique);\n\n var children = element.children;\n\n // max traversal depth not reached yet\n if (maxDepth === -1 || depth < maxDepth) {\n\n // children exist && children not yet processed\n if (children && add(processedChildren, children, unique)) {\n return children;\n }\n }\n });\n\n return result;\n}\n\n/**\n * Return self + direct children for a number of elements\n *\n * @param {Array} elements to query\n * @param {Boolean} allowDuplicates to allow duplicates in the result set\n *\n * @return {Array} the collected elements\n */\nfunction selfAndDirectChildren(elements, allowDuplicates) {\n return selfAndChildren(elements, !allowDuplicates, 1);\n}\n\n/**\n * Return self + ALL children for a number of elements\n *\n * @param {Array} elements to query\n * @param {Boolean} allowDuplicates to allow duplicates in the result set\n *\n * @return {Array} the collected elements\n */\nfunction selfAndAllChildren(elements, allowDuplicates) {\n return selfAndChildren(elements, !allowDuplicates, -1);\n}\n\n/**\n * Gets the the closure for all selected elements,\n * their connections and their attachment's connections\n *\n * @param {Array} elements\n * @return {Object} enclosure\n */\nfunction getClosure(elements) {\n\n // original elements passed to this function\n var topLevel = groupBy(elements, function(e) { return e.id; });\n\n var allShapes = {},\n allConnections = {},\n enclosedElements = {},\n enclosedConnections = {};\n\n function handleConnection(c) {\n if (topLevel[c.source.id] && topLevel[c.target.id]) {\n topLevel[c.id] = [ c ];\n }\n\n // not enclosed as a child, but maybe logically\n // (connecting two moved elements?)\n if (allShapes[c.source.id] && allShapes[c.target.id]) {\n enclosedConnections[c.id] = enclosedElements[c.id] = c;\n }\n\n allConnections[c.id] = c;\n }\n\n function handleElement(element) {\n\n enclosedElements[element.id] = element;\n\n if (element.waypoints) {\n // remember connection\n enclosedConnections[element.id] = allConnections[element.id] = element;\n } else {\n // remember shape\n allShapes[element.id] = element;\n\n // remember all connections\n forEach(element.incoming, handleConnection);\n\n forEach(element.outgoing, handleConnection);\n\n // recurse into children\n return element.children;\n }\n }\n\n eachElement(elements, handleElement);\n\n return {\n allShapes: allShapes,\n allConnections: allConnections,\n topLevel: topLevel,\n enclosedConnections: enclosedConnections,\n enclosedElements: enclosedElements\n };\n}\n\n/**\n * Returns the surrounding bbox for all elements in\n * the array or the element primitive.\n *\n * @param {Array|djs.model.Shape} elements\n * @param {Boolean} stopRecursion\n */\nfunction getBBox(elements, stopRecursion) {\n\n stopRecursion = !!stopRecursion;\n if (!isArray(elements)) {\n elements = [elements];\n }\n\n var minX,\n minY,\n maxX,\n maxY;\n\n forEach(elements, function(element) {\n\n // If element is a connection the bbox must be computed first\n var bbox = element;\n if (element.waypoints && !stopRecursion) {\n bbox = getBBox(element.waypoints, true);\n }\n\n var x = bbox.x,\n y = bbox.y,\n height = bbox.height || 0,\n width = bbox.width || 0;\n\n if (x < minX || minX === undefined) {\n minX = x;\n }\n if (y < minY || minY === undefined) {\n minY = y;\n }\n\n if ((x + width) > maxX || maxX === undefined) {\n maxX = x + width;\n }\n if ((y + height) > maxY || maxY === undefined) {\n maxY = y + height;\n }\n });\n\n return {\n x: minX,\n y: minY,\n height: maxY - minY,\n width: maxX - minX\n };\n}\n\n\n/**\n * Returns all elements that are enclosed from the bounding box.\n *\n * * If bbox.(width|height) is not specified the method returns\n * all elements with element.x/y > bbox.x/y\n * * If only bbox.x or bbox.y is specified, method return all elements with\n * e.x > bbox.x or e.y > bbox.y\n *\n * @param {Array} elements List of Elements to search through\n * @param {djs.model.Shape} bbox the enclosing bbox.\n *\n * @return {Array} enclosed elements\n */\nfunction getEnclosedElements(elements, bbox) {\n\n var filteredElements = {};\n\n forEach(elements, function(element) {\n\n var e = element;\n\n if (e.waypoints) {\n e = getBBox(e);\n }\n\n if (!isNumber(bbox.y) && (e.x > bbox.x)) {\n filteredElements[element.id] = element;\n }\n if (!isNumber(bbox.x) && (e.y > bbox.y)) {\n filteredElements[element.id] = element;\n }\n if (e.x > bbox.x && e.y > bbox.y) {\n if (isNumber(bbox.width) && isNumber(bbox.height) &&\n e.width + e.x < bbox.width + bbox.x &&\n e.height + e.y < bbox.height + bbox.y) {\n\n filteredElements[element.id] = element;\n } else if (!isNumber(bbox.width) || !isNumber(bbox.height)) {\n filteredElements[element.id] = element;\n }\n }\n });\n\n return filteredElements;\n}\n\n\nmodule.exports.add = add;\nmodule.exports.eachElement = eachElement;\nmodule.exports.selfAndDirectChildren = selfAndDirectChildren;\nmodule.exports.selfAndAllChildren = selfAndAllChildren;\nmodule.exports.getBBox = getBBox;\nmodule.exports.getEnclosedElements = getEnclosedElements;\n\nmodule.exports.getClosure = getClosure;\n\n\nfunction getElementType(element) {\n\n if ('waypoints' in element) {\n return 'connection';\n }\n\n if ('x' in element) {\n return 'shape';\n }\n\n return 'root';\n}\n\nmodule.exports.getType = getElementType;","'use strict';\n\nfunction __preventDefault(event) {\n return event && event.preventDefault();\n}\n\nfunction __stopPropagation(event, immediate) {\n if (!event) {\n return;\n }\n\n if (event.stopPropagation) {\n event.stopPropagation();\n }\n\n if (immediate && event.stopImmediatePropagation) {\n event.stopImmediatePropagation();\n }\n}\n\n\nfunction getOriginal(event) {\n return event.originalEvent || event.srcEvent;\n}\n\nmodule.exports.getOriginal = getOriginal;\n\n\nfunction stopEvent(event, immediate) {\n stopPropagation(event, immediate);\n preventDefault(event);\n}\n\nmodule.exports.stopEvent = stopEvent;\n\n\nfunction preventDefault(event) {\n __preventDefault(event);\n __preventDefault(getOriginal(event));\n}\n\nmodule.exports.preventDefault = preventDefault;\n\n\nfunction stopPropagation(event, immediate) {\n __stopPropagation(event, immediate);\n __stopPropagation(getOriginal(event), immediate);\n}\n\nmodule.exports.stopPropagation = stopPropagation;\n\n\nfunction toPoint(event) {\n\n if (event.pointers && event.pointers.length) {\n event = event.pointers[0];\n }\n\n if (event.touches && event.touches.length) {\n event = event.touches[0];\n }\n\n return event ? {\n x: event.clientX,\n y: event.clientY\n } : null;\n}\n\nmodule.exports.toPoint = toPoint;\n","'use strict';\n\n/**\n * Computes the distance between two points\n *\n * @param {Point} p\n * @param {Point} q\n *\n * @return {Number} distance\n */\nfunction pointDistance(a, b) {\n if (!a || !b) {\n return -1;\n }\n\n return Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2));\n}\n\nmodule.exports.pointDistance = pointDistance;\n\n\n/**\n * Returns true if the point r is on the line between p and y\n *\n * @param {Point} p\n * @param {Point} q\n * @param {Point} r\n *\n * @return {Boolean}\n */\nmodule.exports.pointsOnLine = function(p, q, r) {\n\n if (!p || !q || !r) {\n return false;\n }\n\n var val = (q.x - p.x) * (r.y - p.y) - (q.y - p.y) * (r.x - p.x),\n dist = pointDistance(p, q);\n\n // @see http://stackoverflow.com/a/907491/412190\n return Math.abs(val / dist) < 5;\n};\n\n\nvar ALIGNED_THRESHOLD = 2;\n\n/**\n * Returns whether two points are in a horizontal or vertical line.\n *\n * @param {Point} a\n * @param {Point} b\n *\n * @return {String|Boolean} returns false if the points are not\n * aligned or 'h|v' if they are aligned\n * horizontally / vertically.\n */\nfunction pointsAligned(a, b) {\n if (Math.abs(a.x - b.x) <= ALIGNED_THRESHOLD) {\n return 'h';\n }\n\n if (Math.abs(a.y - b.y) <= ALIGNED_THRESHOLD) {\n return 'v';\n }\n\n return false;\n}\n\nmodule.exports.pointsAligned = pointsAligned;\n\n\n/**\n * Returns true if the point p is inside the rectangle rect\n *\n * @param {Point} p\n * @param {Rect} rect\n * @param {Number} tolerance\n *\n * @return {Boolean}\n */\nmodule.exports.pointInRect = function(p, rect, tolerance) {\n tolerance = tolerance || 0;\n\n return p.x > rect.x - tolerance &&\n p.y > rect.y - tolerance &&\n p.x < rect.x + rect.width + tolerance &&\n p.y < rect.y + rect.height + tolerance;\n};\n\n/**\n * Returns a point in the middle of points p and q\n *\n * @param {Point} p\n * @param {Point} q\n *\n * @return {Point} middle point\n */\nmodule.exports.getMidPoint = function(p, q) {\n return {\n x: Math.round(p.x + ((q.x - p.x) / 2.0)),\n y: Math.round(p.y + ((q.y - p.y) / 2.0))\n };\n};\n","'use strict';\n\nvar domQuery = require(452);\n\n/**\n * SVGs for elements are generated by the {@link GraphicsFactory}.\n *\n * This utility gives quick access to the important semantic\n * parts of an element.\n */\n\n/**\n * Returns the visual part of a diagram element\n *\n * @param {Snap} gfx\n *\n * @return {Snap}\n */\nfunction getVisual(gfx) {\n return domQuery('.djs-visual', gfx);\n}\n\n/**\n * Returns the children for a given diagram element.\n *\n * @param {Snap} gfx\n * @return {Snap}\n */\nfunction getChildren(gfx) {\n return gfx.parentNode.childNodes[1];\n}\n\nmodule.exports.getVisual = getVisual;\nmodule.exports.getChildren = getChildren;\n","'use strict';\n\n/**\n * Util that provides unique IDs.\n *\n * @class djs.util.IdGenerator\n * @constructor\n * @memberOf djs.util\n *\n * The ids can be customized via a given prefix and contain a random value to avoid collisions.\n *\n * @param {String} prefix a prefix to prepend to generated ids (for better readability)\n */\nfunction IdGenerator(prefix) {\n\n this._counter = 0;\n this._prefix = (prefix ? prefix + '-' : '') + Math.floor(Math.random() * 1000000000) + '-';\n}\n\nmodule.exports = IdGenerator;\n\n/**\n * Returns a next unique ID.\n *\n * @method djs.util.IdGenerator#next\n *\n * @returns {String} the id\n */\nIdGenerator.prototype.next = function() {\n return this._prefix + (++this._counter);\n};\n","/* eslint no-fallthrough: \"off\" */\r\n\r\n'use strict';\r\n\r\nvar has = 'hasOwnProperty',\r\n p2s = /,?([a-z]),?/gi,\r\n toFloat = parseFloat,\r\n math = Math,\r\n PI = math.PI,\r\n mmin = math.min,\r\n mmax = math.max,\r\n pow = math.pow,\r\n abs = math.abs,\r\n pathCommand = /([a-z])[/s,]*((-?/d*/.?/d*(?:e[/-+]?/d+)?[/s]*,?[/s]*)+)/ig,\r\n pathValues = /(-?/d*/.?/d*(?:e[/-+]?//d+)?)[/s]*,?[/s]*/ig;\r\n\r\nfunction is(o, type) {\r\n type = String.prototype.toLowerCase.call(type);\r\n\r\n if (type == 'finite') {\r\n return isFinite(o);\r\n }\r\n\r\n if (type == 'array' && (o instanceof Array || Array.isArray && Array.isArray(o))) {\r\n return true;\r\n }\r\n\r\n return (type == 'null' && o === null) ||\r\n (type == typeof o && o !== null) ||\r\n (type == 'object' && o === Object(o)) ||\r\n Object.prototype.toString.call(o).slice(8, -1).toLowerCase() == type;\r\n}\r\n\r\nfunction clone(obj) {\r\n\r\n if (typeof obj == 'function' || Object(obj) !== obj) {\r\n return obj;\r\n }\r\n\r\n var res = new obj.constructor;\r\n\r\n for (var key in obj) if (obj[has](key)) {\r\n res[key] = clone(obj[key]);\r\n }\r\n\r\n return res;\r\n}\r\n\r\nfunction repush(array, item) {\r\n for (var i = 0, ii = array.length; i < ii; i++) if (array[i] === item) {\r\n return array.push(array.splice(i, 1)[0]);\r\n }\r\n}\r\n\r\nfunction cacher(f, scope, postprocessor) {\r\n\r\n function newf() {\r\n\r\n var arg = Array.prototype.slice.call(arguments, 0),\r\n args = arg.join('/u2400'),\r\n cache = newf.cache = newf.cache || {},\r\n count = newf.count = newf.count || [];\r\n\r\n if (cache[has](args)) {\r\n repush(count, args);\r\n return postprocessor ? postprocessor(cache[args]) : cache[args];\r\n }\r\n\r\n count.length >= 1e3 && delete cache[count.shift()];\r\n count.push(args);\r\n cache[args] = f.apply(scope, arg);\r\n\r\n return postprocessor ? postprocessor(cache[args]) : cache[args];\r\n }\r\n return newf;\r\n}\r\n\r\nfunction parsePathString(pathString) {\r\n\r\n if (!pathString) {\r\n return null;\r\n }\r\n\r\n var pth = paths(pathString);\r\n\r\n if (pth.arr) {\r\n return clone(pth.arr);\r\n }\r\n\r\n var paramCounts = { a: 7, c: 6, o: 2, h: 1, l: 2, m: 2, r: 4, q: 4, s: 4, t: 2, v: 1, u: 3, z: 0 },\r\n data = [];\r\n\r\n if (is(pathString, 'array') && is(pathString[0], 'array')) { // rough assumption\r\n data = clone(pathString);\r\n }\r\n\r\n if (!data.length) {\r\n\r\n String(pathString).replace(pathCommand, function(a, b, c) {\r\n var params = [],\r\n name = b.toLowerCase();\r\n\r\n c.replace(pathValues, function(a, b) {\r\n b && params.push(+b);\r\n });\r\n\r\n if (name == 'm' && params.length > 2) {\r\n data.push([b].concat(params.splice(0, 2)));\r\n name = 'l';\r\n b = b == 'm' ? 'l' : 'L';\r\n }\r\n\r\n if (name == 'o' && params.length == 1) {\r\n data.push([b, params[0]]);\r\n }\r\n\r\n if (name == 'r') {\r\n data.push([b].concat(params));\r\n } else while (params.length >= paramCounts[name]) {\r\n data.push([b].concat(params.splice(0, paramCounts[name])));\r\n if (!paramCounts[name]) {\r\n break;\r\n }\r\n }\r\n });\r\n }\r\n\r\n data.toString = paths.toString;\r\n pth.arr = clone(data);\r\n\r\n return data;\r\n}\r\n\r\nfunction paths(ps) {\r\n var p = paths.ps = paths.ps || {};\r\n\r\n if (p[ps]) {\r\n p[ps].sleep = 100;\r\n } else {\r\n p[ps] = {\r\n sleep: 100\r\n };\r\n }\r\n\r\n setTimeout(function() {\r\n for (var key in p) if (p[has](key) && key != ps) {\r\n p[key].sleep--;\r\n !p[key].sleep && delete p[key];\r\n }\r\n });\r\n\r\n return p[ps];\r\n}\r\n\r\nfunction box(x, y, width, height) {\r\n if (x == null) {\r\n x = y = width = height = 0;\r\n }\r\n\r\n if (y == null) {\r\n y = x.y;\r\n width = x.width;\r\n height = x.height;\r\n x = x.x;\r\n }\r\n\r\n return {\r\n x: x,\r\n y: y,\r\n width: width,\r\n w: width,\r\n height: height,\r\n h: height,\r\n x2: x + width,\r\n y2: y + height,\r\n cx: x + width / 2,\r\n cy: y + height / 2,\r\n r1: math.min(width, height) / 2,\r\n r2: math.max(width, height) / 2,\r\n r0: math.sqrt(width * width + height * height) / 2,\r\n path: rectPath(x, y, width, height),\r\n vb: [x, y, width, height].join(' ')\r\n };\r\n}\r\n\r\nfunction toString() {\r\n return this.join(',').replace(p2s, '$1');\r\n}\r\n\r\nfunction pathClone(pathArray) {\r\n var res = clone(pathArray);\r\n res.toString = toString;\r\n return res;\r\n}\r\n\r\nfunction getPointAtSegmentLength(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, length) {\r\n if (length == null) {\r\n return bezlen(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y);\r\n } else {\r\n return findDotsAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y,\r\n getTotLen(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, length));\r\n }\r\n}\r\n\r\nfunction getLengthFactory(istotal, subpath) {\r\n function O(val) {\r\n return +(+val).toFixed(3);\r\n }\r\n\r\n return cacher(function(path, length, onlystart) {\r\n\r\n if (path instanceof Element) {\r\n path = path.attr('d');\r\n }\r\n\r\n path = path2curve(path);\r\n\r\n var x, y, p, l, sp = '', subpaths = {}, point,\r\n len = 0;\r\n\r\n for (var i = 0, ii = path.length; i < ii; i++) {\r\n p = path[i];\r\n\r\n if (p[0] == 'M') {\r\n x = +p[1];\r\n y = +p[2];\r\n } else {\r\n l = getPointAtSegmentLength(x, y, p[1], p[2], p[3], p[4], p[5], p[6]);\r\n\r\n if (len + l > length) {\r\n\r\n if (subpath && !subpaths.start) {\r\n point = getPointAtSegmentLength(x, y, p[1], p[2], p[3], p[4], p[5], p[6], length - len);\r\n\r\n sp += [\r\n 'C' + O(point.start.x),\r\n O(point.start.y),\r\n O(point.m.x),\r\n O(point.m.y),\r\n O(point.x),\r\n O(point.y)\r\n ];\r\n\r\n if (onlystart) {\r\n return sp;\r\n }\r\n\r\n subpaths.start = sp;\r\n sp = [\r\n 'M' + O(point.x),\r\n O(point.y) + 'C' + O(point.n.x),\r\n O(point.n.y),\r\n O(point.end.x),\r\n O(point.end.y),\r\n O(p[5]),\r\n O(p[6])\r\n ].join();\r\n len += l;\r\n x = +p[5];\r\n y = +p[6];\r\n continue;\r\n }\r\n\r\n if (!istotal && !subpath) {\r\n point = getPointAtSegmentLength(x, y, p[1], p[2], p[3], p[4], p[5], p[6], length - len);\r\n return point;\r\n }\r\n }\r\n\r\n len += l;\r\n x = +p[5];\r\n y = +p[6];\r\n }\r\n\r\n sp += p.shift() + p;\r\n }\r\n\r\n subpaths.end = sp;\r\n point = istotal ? len : subpath ? subpaths : findDotsAtSegment(x, y, p[0], p[1], p[2], p[3], p[4], p[5], 1);\r\n return point;\r\n }, null, clone);\r\n}\r\n\r\nvar getTotalLength = getLengthFactory(1),\r\n getPointAtLength = getLengthFactory();\r\n\r\nfunction findDotsAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t) {\r\n var t1 = 1 - t,\r\n t13 = pow(t1, 3),\r\n t12 = pow(t1, 2),\r\n t2 = t * t,\r\n t3 = t2 * t,\r\n x = t13 * p1x + t12 * 3 * t * c1x + t1 * 3 * t * t * c2x + t3 * p2x,\r\n y = t13 * p1y + t12 * 3 * t * c1y + t1 * 3 * t * t * c2y + t3 * p2y,\r\n mx = p1x + 2 * t * (c1x - p1x) + t2 * (c2x - 2 * c1x + p1x),\r\n my = p1y + 2 * t * (c1y - p1y) + t2 * (c2y - 2 * c1y + p1y),\r\n nx = c1x + 2 * t * (c2x - c1x) + t2 * (p2x - 2 * c2x + c1x),\r\n ny = c1y + 2 * t * (c2y - c1y) + t2 * (p2y - 2 * c2y + c1y),\r\n ax = t1 * p1x + t * c1x,\r\n ay = t1 * p1y + t * c1y,\r\n cx = t1 * c2x + t * p2x,\r\n cy = t1 * c2y + t * p2y,\r\n alpha = (90 - math.atan2(mx - nx, my - ny) * 180 / PI);\r\n\r\n // (mx > nx || my < ny) && (alpha += 180);\r\n\r\n return {\r\n x: x,\r\n y: y,\r\n m: { x: mx, y: my },\r\n n: { x: nx, y: ny },\r\n start: { x: ax, y: ay },\r\n end: { x: cx, y: cy },\r\n alpha: alpha\r\n };\r\n}\r\n\r\nfunction bezierBBox(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y) {\r\n\r\n if (!is(p1x, 'array')) {\r\n p1x = [p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y];\r\n }\r\n\r\n var bbox = curveDim.apply(null, p1x);\r\n\r\n return box(\r\n bbox.min.x,\r\n bbox.min.y,\r\n bbox.max.x - bbox.min.x,\r\n bbox.max.y - bbox.min.y\r\n );\r\n}\r\n\r\nfunction isPointInsideBBox(bbox, x, y) {\r\n return x >= bbox.x &&\r\n x <= bbox.x + bbox.width &&\r\n y >= bbox.y &&\r\n y <= bbox.y + bbox.height;\r\n}\r\n\r\nfunction isBBoxIntersect(bbox1, bbox2) {\r\n bbox1 = box(bbox1);\r\n bbox2 = box(bbox2);\r\n return isPointInsideBBox(bbox2, bbox1.x, bbox1.y)\r\n || isPointInsideBBox(bbox2, bbox1.x2, bbox1.y)\r\n || isPointInsideBBox(bbox2, bbox1.x, bbox1.y2)\r\n || isPointInsideBBox(bbox2, bbox1.x2, bbox1.y2)\r\n || isPointInsideBBox(bbox1, bbox2.x, bbox2.y)\r\n || isPointInsideBBox(bbox1, bbox2.x2, bbox2.y)\r\n || isPointInsideBBox(bbox1, bbox2.x, bbox2.y2)\r\n || isPointInsideBBox(bbox1, bbox2.x2, bbox2.y2)\r\n || (bbox1.x < bbox2.x2 && bbox1.x > bbox2.x\r\n || bbox2.x < bbox1.x2 && bbox2.x > bbox1.x)\r\n && (bbox1.y < bbox2.y2 && bbox1.y > bbox2.y\r\n || bbox2.y < bbox1.y2 && bbox2.y > bbox1.y);\r\n}\r\n\r\nfunction base3(t, p1, p2, p3, p4) {\r\n var t1 = -3 * p1 + 9 * p2 - 9 * p3 + 3 * p4,\r\n t2 = t * t1 + 6 * p1 - 12 * p2 + 6 * p3;\r\n return t * t2 - 3 * p1 + 3 * p2;\r\n}\r\n\r\nfunction bezlen(x1, y1, x2, y2, x3, y3, x4, y4, z) {\r\n\r\n if (z == null) {\r\n z = 1;\r\n }\r\n\r\n z = z > 1 ? 1 : z < 0 ? 0 : z;\r\n\r\n var z2 = z / 2,\r\n n = 12,\r\n Tvalues = [-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],\r\n Cvalues = [0.2491,0.2491,0.2335,0.2335,0.2032,0.2032,0.1601,0.1601,0.1069,0.1069,0.0472,0.0472],\r\n sum = 0;\r\n\r\n for (var i = 0; i < n; i++) {\r\n var ct = z2 * Tvalues[i] + z2,\r\n xbase = base3(ct, x1, x2, x3, x4),\r\n ybase = base3(ct, y1, y2, y3, y4),\r\n comb = xbase * xbase + ybase * ybase;\r\n\r\n sum += Cvalues[i] * math.sqrt(comb);\r\n }\r\n\r\n return z2 * sum;\r\n}\r\n\r\nfunction getTotLen(x1, y1, x2, y2, x3, y3, x4, y4, ll) {\r\n\r\n if (ll < 0 || bezlen(x1, y1, x2, y2, x3, y3, x4, y4) < ll) {\r\n return;\r\n }\r\n\r\n var t = 1,\r\n step = t / 2,\r\n t2 = t - step,\r\n l,\r\n e = .01;\r\n\r\n l = bezlen(x1, y1, x2, y2, x3, y3, x4, y4, t2);\r\n\r\n while (abs(l - ll) > e) {\r\n step /= 2;\r\n t2 += (l < ll ? 1 : -1) * step;\r\n l = bezlen(x1, y1, x2, y2, x3, y3, x4, y4, t2);\r\n }\r\n\r\n return t2;\r\n}\r\n\r\nfunction intersect(x1, y1, x2, y2, x3, y3, x4, y4) {\r\n\r\n if (\r\n mmax(x1, x2) < mmin(x3, x4) ||\r\n mmin(x1, x2) > mmax(x3, x4) ||\r\n mmax(y1, y2) < mmin(y3, y4) ||\r\n mmin(y1, y2) > mmax(y3, y4)\r\n ) {\r\n return;\r\n }\r\n\r\n var nx = (x1 * y2 - y1 * x2) * (x3 - x4) - (x1 - x2) * (x3 * y4 - y3 * x4),\r\n ny = (x1 * y2 - y1 * x2) * (y3 - y4) - (y1 - y2) * (x3 * y4 - y3 * x4),\r\n denominator = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4);\r\n\r\n if (!denominator) {\r\n return;\r\n }\r\n\r\n var px = nx / denominator,\r\n py = ny / denominator,\r\n px2 = +px.toFixed(2),\r\n py2 = +py.toFixed(2);\r\n\r\n if (\r\n px2 < +mmin(x1, x2).toFixed(2) ||\r\n px2 > +mmax(x1, x2).toFixed(2) ||\r\n px2 < +mmin(x3, x4).toFixed(2) ||\r\n px2 > +mmax(x3, x4).toFixed(2) ||\r\n py2 < +mmin(y1, y2).toFixed(2) ||\r\n py2 > +mmax(y1, y2).toFixed(2) ||\r\n py2 < +mmin(y3, y4).toFixed(2) ||\r\n py2 > +mmax(y3, y4).toFixed(2)\r\n ) {\r\n return;\r\n }\r\n\r\n return { x: px, y: py };\r\n}\r\n\r\nfunction interHelper(bez1, bez2, justCount) {\r\n var bbox1 = bezierBBox(bez1),\r\n bbox2 = bezierBBox(bez2);\r\n\r\n if (!isBBoxIntersect(bbox1, bbox2)) {\r\n return justCount ? 0 : [];\r\n }\r\n\r\n var l1 = bezlen.apply(0, bez1),\r\n l2 = bezlen.apply(0, bez2),\r\n n1 = ~~(l1 / 8),\r\n n2 = ~~(l2 / 8),\r\n dots1 = [],\r\n dots2 = [],\r\n xy = {},\r\n res = justCount ? 0 : [];\r\n\r\n for (var i = 0; i < n1 + 1; i++) {\r\n var p = findDotsAtSegment.apply(0, bez1.concat(i / n1));\r\n dots1.push({ x: p.x, y: p.y, t: i / n1 });\r\n }\r\n\r\n for (i = 0; i < n2 + 1; i++) {\r\n p = findDotsAtSegment.apply(0, bez2.concat(i / n2));\r\n dots2.push({ x: p.x, y: p.y, t: i / n2 });\r\n }\r\n\r\n for (i = 0; i < n1; i++) {\r\n\r\n for (var j = 0; j < n2; j++) {\r\n var di = dots1[i],\r\n di1 = dots1[i + 1],\r\n dj = dots2[j],\r\n dj1 = dots2[j + 1],\r\n ci = abs(di1.x - di.x) < .001 ? 'y' : 'x',\r\n cj = abs(dj1.x - dj.x) < .001 ? 'y' : 'x',\r\n is = intersect(di.x, di.y, di1.x, di1.y, dj.x, dj.y, dj1.x, dj1.y);\r\n\r\n if (is) {\r\n\r\n if (xy[is.x.toFixed(4)] == is.y.toFixed(4)) {\r\n continue;\r\n }\r\n\r\n xy[is.x.toFixed(4)] = is.y.toFixed(4);\r\n\r\n var t1 = di.t + abs((is[ci] - di[ci]) / (di1[ci] - di[ci])) * (di1.t - di.t),\r\n t2 = dj.t + abs((is[cj] - dj[cj]) / (dj1[cj] - dj[cj])) * (dj1.t - dj.t);\r\n\r\n if (t1 >= 0 && t1 <= 1 && t2 >= 0 && t2 <= 1) {\r\n\r\n if (justCount) {\r\n res++;\r\n } else {\r\n res.push({\r\n x: is.x,\r\n y: is.y,\r\n t1: t1,\r\n t2: t2\r\n });\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n return res;\r\n}\r\n\r\nfunction pathIntersection(path1, path2) {\r\n return interPathHelper(path1, path2);\r\n}\r\n\r\nfunction pathIntersectionNumber(path1, path2) {\r\n return interPathHelper(path1, path2, 1);\r\n}\r\n\r\nfunction interPathHelper(path1, path2, justCount) {\r\n path1 = path2curve(path1);\r\n path2 = path2curve(path2);\r\n\r\n var x1, y1, x2, y2, x1m, y1m, x2m, y2m, bez1, bez2,\r\n res = justCount ? 0 : [];\r\n\r\n for (var i = 0, ii = path1.length; i < ii; i++) {\r\n var pi = path1[i];\r\n\r\n if (pi[0] == 'M') {\r\n x1 = x1m = pi[1];\r\n y1 = y1m = pi[2];\r\n } else {\r\n\r\n if (pi[0] == 'C') {\r\n bez1 = [x1, y1].concat(pi.slice(1));\r\n x1 = bez1[6];\r\n y1 = bez1[7];\r\n } else {\r\n bez1 = [x1, y1, x1, y1, x1m, y1m, x1m, y1m];\r\n x1 = x1m;\r\n y1 = y1m;\r\n }\r\n\r\n for (var j = 0, jj = path2.length; j < jj; j++) {\r\n var pj = path2[j];\r\n\r\n if (pj[0] == 'M') {\r\n x2 = x2m = pj[1];\r\n y2 = y2m = pj[2];\r\n } else {\r\n\r\n if (pj[0] == 'C') {\r\n bez2 = [x2, y2].concat(pj.slice(1));\r\n x2 = bez2[6];\r\n y2 = bez2[7];\r\n } else {\r\n bez2 = [x2, y2, x2, y2, x2m, y2m, x2m, y2m];\r\n x2 = x2m;\r\n y2 = y2m;\r\n }\r\n\r\n var intr = interHelper(bez1, bez2, justCount);\r\n\r\n if (justCount) {\r\n res += intr;\r\n } else {\r\n\r\n for (var k = 0, kk = intr.length; k < kk; k++) {\r\n intr[k].segment1 = i;\r\n intr[k].segment2 = j;\r\n intr[k].bez1 = bez1;\r\n intr[k].bez2 = bez2;\r\n }\r\n\r\n res = res.concat(intr);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n return res;\r\n}\r\n\r\nfunction isPointInsidePath(path, x, y) {\r\n var bbox = pathBBox(path);\r\n\r\n return isPointInsideBBox(bbox, x, y) &&\r\n interPathHelper(path, [['M', x, y], ['H', bbox.x2 + 10]], 1) % 2 == 1;\r\n}\r\n\r\nfunction pathBBox(path) {\r\n var pth = paths(path);\r\n\r\n if (pth.bbox) {\r\n return clone(pth.bbox);\r\n }\r\n\r\n if (!path) {\r\n return box();\r\n }\r\n\r\n path = path2curve(path);\r\n\r\n var x = 0,\r\n y = 0,\r\n X = [],\r\n Y = [],\r\n p;\r\n\r\n for (var i = 0, ii = path.length; i < ii; i++) {\r\n p = path[i];\r\n\r\n if (p[0] == 'M') {\r\n x = p[1];\r\n y = p[2];\r\n X.push(x);\r\n Y.push(y);\r\n } else {\r\n var dim = curveDim(x, y, p[1], p[2], p[3], p[4], p[5], p[6]);\r\n X = X.concat(dim.min.x, dim.max.x);\r\n Y = Y.concat(dim.min.y, dim.max.y);\r\n x = p[5];\r\n y = p[6];\r\n }\r\n }\r\n\r\n var xmin = mmin.apply(0, X),\r\n ymin = mmin.apply(0, Y),\r\n xmax = mmax.apply(0, X),\r\n ymax = mmax.apply(0, Y),\r\n bb = box(xmin, ymin, xmax - xmin, ymax - ymin);\r\n\r\n pth.bbox = clone(bb);\r\n\r\n return bb;\r\n}\r\n\r\nfunction rectPath(x, y, w, h, r) {\r\n if (r) {\r\n return [\r\n ['M', +x + (+r), y],\r\n ['l', w - r * 2, 0],\r\n ['a', r, r, 0, 0, 1, r, r],\r\n ['l', 0, h - r * 2],\r\n ['a', r, r, 0, 0, 1, -r, r],\r\n ['l', r * 2 - w, 0],\r\n ['a', r, r, 0, 0, 1, -r, -r],\r\n ['l', 0, r * 2 - h],\r\n ['a', r, r, 0, 0, 1, r, -r],\r\n ['z']\r\n ];\r\n }\r\n\r\n var res = [['M', x, y], ['l', w, 0], ['l', 0, h], ['l', -w, 0], ['z']];\r\n res.toString = toString;\r\n\r\n return res;\r\n}\r\n\r\nfunction ellipsePath(x, y, rx, ry, a) {\r\n if (a == null && ry == null) {\r\n ry = rx;\r\n }\r\n\r\n x = +x;\r\n y = +y;\r\n rx = +rx;\r\n ry = +ry;\r\n\r\n if (a != null) {\r\n var rad = Math.PI / 180,\r\n x1 = x + rx * Math.cos(-ry * rad),\r\n x2 = x + rx * Math.cos(-a * rad),\r\n y1 = y + rx * Math.sin(-ry * rad),\r\n y2 = y + rx * Math.sin(-a * rad),\r\n res = [['M', x1, y1], ['A', rx, rx, 0, +(a - ry > 180), 0, x2, y2]];\r\n } else {\r\n res = [\r\n ['M', x, y],\r\n ['m', 0, -ry],\r\n ['a', rx, ry, 0, 1, 1, 0, 2 * ry],\r\n ['a', rx, ry, 0, 1, 1, 0, -2 * ry],\r\n ['z']\r\n ];\r\n }\r\n\r\n res.toString = toString;\r\n\r\n return res;\r\n}\r\n\r\nfunction pathToRelative(pathArray) {\r\n var pth = paths(pathArray),\r\n lowerCase = String.prototype.toLowerCase;\r\n\r\n if (pth.rel) {\r\n return pathClone(pth.rel);\r\n }\r\n\r\n if (!is(pathArray, 'array') || !is(pathArray && pathArray[0], 'array')) {\r\n pathArray = parsePathString(pathArray);\r\n }\r\n\r\n var res = [],\r\n x = 0,\r\n y = 0,\r\n mx = 0,\r\n my = 0,\r\n start = 0;\r\n\r\n if (pathArray[0][0] == 'M') {\r\n x = pathArray[0][1];\r\n y = pathArray[0][2];\r\n mx = x;\r\n my = y;\r\n start++;\r\n res.push(['M', x, y]);\r\n }\r\n\r\n for (var i = start, ii = pathArray.length; i < ii; i++) {\r\n var r = res[i] = [],\r\n pa = pathArray[i];\r\n\r\n if (pa[0] != lowerCase.call(pa[0])) {\r\n r[0] = lowerCase.call(pa[0]);\r\n\r\n switch (r[0]) {\r\n case 'a':\r\n r[1] = pa[1];\r\n r[2] = pa[2];\r\n r[3] = pa[3];\r\n r[4] = pa[4];\r\n r[5] = pa[5];\r\n r[6] = +(pa[6] - x).toFixed(3);\r\n r[7] = +(pa[7] - y).toFixed(3);\r\n break;\r\n case 'v':\r\n r[1] = +(pa[1] - y).toFixed(3);\r\n break;\r\n case 'm':\r\n mx = pa[1];\r\n my = pa[2];\r\n default:\r\n for (var j = 1, jj = pa.length; j < jj; j++) {\r\n r[j] = +(pa[j] - ((j % 2) ? x : y)).toFixed(3);\r\n }\r\n }\r\n } else {\r\n r = res[i] = [];\r\n\r\n if (pa[0] == 'm') {\r\n mx = pa[1] + x;\r\n my = pa[2] + y;\r\n }\r\n\r\n for (var k = 0, kk = pa.length; k < kk; k++) {\r\n res[i][k] = pa[k];\r\n }\r\n }\r\n\r\n var len = res[i].length;\r\n\r\n switch (res[i][0]) {\r\n case 'z':\r\n x = mx;\r\n y = my;\r\n break;\r\n case 'h':\r\n x += +res[i][len - 1];\r\n break;\r\n case 'v':\r\n y += +res[i][len - 1];\r\n break;\r\n default:\r\n x += +res[i][len - 2];\r\n y += +res[i][len - 1];\r\n }\r\n }\r\n\r\n res.toString = toString;\r\n pth.rel = pathClone(res);\r\n\r\n return res;\r\n}\r\n\r\nfunction pathToAbsolute(pathArray) {\r\n var pth = paths(pathArray);\r\n\r\n if (pth.abs) {\r\n return pathClone(pth.abs);\r\n }\r\n\r\n if (!is(pathArray, 'array') || !is(pathArray && pathArray[0], 'array')) { // rough assumption\r\n pathArray = parsePathString(pathArray);\r\n }\r\n\r\n if (!pathArray || !pathArray.length) {\r\n return [['M', 0, 0]];\r\n }\r\n\r\n var res = [],\r\n x = 0,\r\n y = 0,\r\n mx = 0,\r\n my = 0,\r\n start = 0,\r\n pa0;\r\n\r\n if (pathArray[0][0] == 'M') {\r\n x = +pathArray[0][1];\r\n y = +pathArray[0][2];\r\n mx = x;\r\n my = y;\r\n start++;\r\n res[0] = ['M', x, y];\r\n }\r\n\r\n var crz = pathArray.length == 3 &&\r\n pathArray[0][0] == 'M' &&\r\n pathArray[1][0].toUpperCase() == 'R' &&\r\n pathArray[2][0].toUpperCase() == 'Z';\r\n\r\n for (var r, pa, i = start, ii = pathArray.length; i < ii; i++) {\r\n res.push(r = []);\r\n pa = pathArray[i];\r\n pa0 = pa[0];\r\n\r\n if (pa0 != pa0.toUpperCase()) {\r\n r[0] = pa0.toUpperCase();\r\n\r\n switch (r[0]) {\r\n case 'A':\r\n r[1] = pa[1];\r\n r[2] = pa[2];\r\n r[3] = pa[3];\r\n r[4] = pa[4];\r\n r[5] = pa[5];\r\n r[6] = +pa[6] + x;\r\n r[7] = +pa[7] + y;\r\n break;\r\n case 'V':\r\n r[1] = +pa[1] + y;\r\n break;\r\n case 'H':\r\n r[1] = +pa[1] + x;\r\n break;\r\n case 'R':\r\n var dots = [x, y].concat(pa.slice(1));\r\n\r\n for (var j = 2, jj = dots.length; j < jj; j++) {\r\n dots[j] = +dots[j] + x;\r\n dots[++j] = +dots[j] + y;\r\n }\r\n\r\n res.pop();\r\n res = res.concat(catmullRom2bezier(dots, crz));\r\n break;\r\n case 'O':\r\n res.pop();\r\n dots = ellipsePath(x, y, pa[1], pa[2]);\r\n dots.push(dots[0]);\r\n res = res.concat(dots);\r\n break;\r\n case 'U':\r\n res.pop();\r\n res = res.concat(ellipsePath(x, y, pa[1], pa[2], pa[3]));\r\n r = ['U'].concat(res[res.length - 1].slice(-2));\r\n break;\r\n case 'M':\r\n mx = +pa[1] + x;\r\n my = +pa[2] + y;\r\n default:\r\n\r\n for (j = 1, jj = pa.length; j < jj; j++) {\r\n r[j] = +pa[j] + ((j % 2) ? x : y);\r\n }\r\n }\r\n } else if (pa0 == 'R') {\r\n dots = [x, y].concat(pa.slice(1));\r\n res.pop();\r\n res = res.concat(catmullRom2bezier(dots, crz));\r\n r = ['R'].concat(pa.slice(-2));\r\n } else if (pa0 == 'O') {\r\n res.pop();\r\n dots = ellipsePath(x, y, pa[1], pa[2]);\r\n dots.push(dots[0]);\r\n res = res.concat(dots);\r\n } else if (pa0 == 'U') {\r\n res.pop();\r\n res = res.concat(ellipsePath(x, y, pa[1], pa[2], pa[3]));\r\n r = ['U'].concat(res[res.length - 1].slice(-2));\r\n } else {\r\n\r\n for (var k = 0, kk = pa.length; k < kk; k++) {\r\n r[k] = pa[k];\r\n }\r\n }\r\n pa0 = pa0.toUpperCase();\r\n\r\n if (pa0 != 'O') {\r\n switch (r[0]) {\r\n case 'Z':\r\n x = +mx;\r\n y = +my;\r\n break;\r\n case 'H':\r\n x = r[1];\r\n break;\r\n case 'V':\r\n y = r[1];\r\n break;\r\n case 'M':\r\n mx = r[r.length - 2];\r\n my = r[r.length - 1];\r\n default:\r\n x = r[r.length - 2];\r\n y = r[r.length - 1];\r\n }\r\n }\r\n }\r\n\r\n res.toString = toString;\r\n pth.abs = pathClone(res);\r\n\r\n return res;\r\n}\r\n\r\nfunction l2c(x1, y1, x2, y2) {\r\n return [x1, y1, x2, y2, x2, y2];\r\n}\r\n\r\nfunction q2c(x1, y1, ax, ay, x2, y2) {\r\n var _13 = 1 / 3,\r\n _23 = 2 / 3;\r\n\r\n return [\r\n _13 * x1 + _23 * ax,\r\n _13 * y1 + _23 * ay,\r\n _13 * x2 + _23 * ax,\r\n _13 * y2 + _23 * ay,\r\n x2,\r\n y2\r\n ];\r\n}\r\n\r\nfunction a2c(x1, y1, rx, ry, angle, large_arc_flag, sweep_flag, x2, y2, recursive) {\r\n\r\n // for more information of where this math came from visit:\r\n // http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes\r\n var _120 = PI * 120 / 180,\r\n rad = PI / 180 * (+angle || 0),\r\n res = [],\r\n xy,\r\n rotate = cacher(function(x, y, rad) {\r\n var X = x * math.cos(rad) - y * math.sin(rad),\r\n Y = x * math.sin(rad) + y * math.cos(rad);\r\n\r\n return { x: X, y: Y };\r\n });\r\n\r\n if (!recursive) {\r\n xy = rotate(x1, y1, -rad);\r\n x1 = xy.x;\r\n y1 = xy.y;\r\n xy = rotate(x2, y2, -rad);\r\n x2 = xy.x;\r\n y2 = xy.y;\r\n\r\n var x = (x1 - x2) / 2,\r\n y = (y1 - y2) / 2;\r\n\r\n var h = (x * x) / (rx * rx) + (y * y) / (ry * ry);\r\n\r\n if (h > 1) {\r\n h = math.sqrt(h);\r\n rx = h * rx;\r\n ry = h * ry;\r\n }\r\n\r\n var rx2 = rx * rx,\r\n ry2 = ry * ry,\r\n k = (large_arc_flag == sweep_flag ? -1 : 1) *\r\n math.sqrt(abs((rx2 * ry2 - rx2 * y * y - ry2 * x * x) / (rx2 * y * y + ry2 * x * x))),\r\n cx = k * rx * y / ry + (x1 + x2) / 2,\r\n cy = k * -ry * x / rx + (y1 + y2) / 2,\r\n f1 = math.asin(((y1 - cy) / ry).toFixed(9)),\r\n f2 = math.asin(((y2 - cy) / ry).toFixed(9));\r\n\r\n f1 = x1 < cx ? PI - f1 : f1;\r\n f2 = x2 < cx ? PI - f2 : f2;\r\n f1 < 0 && (f1 = PI * 2 + f1);\r\n f2 < 0 && (f2 = PI * 2 + f2);\r\n\r\n if (sweep_flag && f1 > f2) {\r\n f1 = f1 - PI * 2;\r\n }\r\n if (!sweep_flag && f2 > f1) {\r\n f2 = f2 - PI * 2;\r\n }\r\n } else {\r\n f1 = recursive[0];\r\n f2 = recursive[1];\r\n cx = recursive[2];\r\n cy = recursive[3];\r\n }\r\n\r\n var df = f2 - f1;\r\n\r\n if (abs(df) > _120) {\r\n var f2old = f2,\r\n x2old = x2,\r\n y2old = y2;\r\n\r\n f2 = f1 + _120 * (sweep_flag && f2 > f1 ? 1 : -1);\r\n x2 = cx + rx * math.cos(f2);\r\n y2 = cy + ry * math.sin(f2);\r\n res = a2c(x2, y2, rx, ry, angle, 0, sweep_flag, x2old, y2old, [f2, f2old, cx, cy]);\r\n }\r\n\r\n df = f2 - f1;\r\n\r\n var c1 = math.cos(f1),\r\n s1 = math.sin(f1),\r\n c2 = math.cos(f2),\r\n s2 = math.sin(f2),\r\n t = math.tan(df / 4),\r\n hx = 4 / 3 * rx * t,\r\n hy = 4 / 3 * ry * t,\r\n m1 = [x1, y1],\r\n m2 = [x1 + hx * s1, y1 - hy * c1],\r\n m3 = [x2 + hx * s2, y2 - hy * c2],\r\n m4 = [x2, y2];\r\n\r\n m2[0] = 2 * m1[0] - m2[0];\r\n m2[1] = 2 * m1[1] - m2[1];\r\n\r\n if (recursive) {\r\n return [m2, m3, m4].concat(res);\r\n } else {\r\n res = [m2, m3, m4].concat(res).join().split(',');\r\n var newres = [];\r\n\r\n for (var i = 0, ii = res.length; i < ii; i++) {\r\n newres[i] = i % 2 ? rotate(res[i - 1], res[i], rad).y : rotate(res[i], res[i + 1], rad).x;\r\n }\r\n\r\n return newres;\r\n }\r\n}\r\n\r\n// Returns bounding box of cubic bezier curve.\r\n// Source: http://blog.hackers-cafe.net/2009/06/how-to-calculate-bezier-curves-bounding.html\r\n// Original version: NISHIO Hirokazu\r\n// Modifications: https://github.com/timo22345\r\nfunction curveDim(x0, y0, x1, y1, x2, y2, x3, y3) {\r\n var tvalues = [],\r\n bounds = [[], []],\r\n a, b, c, t, t1, t2, b2ac, sqrtb2ac;\r\n\r\n for (var i = 0; i < 2; ++i) {\r\n\r\n if (i == 0) {\r\n b = 6 * x0 - 12 * x1 + 6 * x2;\r\n a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;\r\n c = 3 * x1 - 3 * x0;\r\n } else {\r\n b = 6 * y0 - 12 * y1 + 6 * y2;\r\n a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;\r\n c = 3 * y1 - 3 * y0;\r\n }\r\n\r\n if (abs(a) < 1e-12) {\r\n\r\n if (abs(b) < 1e-12) {\r\n continue;\r\n }\r\n\r\n t = -c / b;\r\n\r\n if (0 < t && t < 1) {\r\n tvalues.push(t);\r\n }\r\n\r\n continue;\r\n }\r\n\r\n b2ac = b * b - 4 * c * a;\r\n sqrtb2ac = math.sqrt(b2ac);\r\n\r\n if (b2ac < 0) {\r\n continue;\r\n }\r\n\r\n t1 = (-b + sqrtb2ac) / (2 * a);\r\n\r\n if (0 < t1 && t1 < 1) {\r\n tvalues.push(t1);\r\n }\r\n\r\n t2 = (-b - sqrtb2ac) / (2 * a);\r\n\r\n if (0 < t2 && t2 < 1) {\r\n tvalues.push(t2);\r\n }\r\n }\r\n\r\n var j = tvalues.length,\r\n jlen = j,\r\n mt;\r\n\r\n while (j--) {\r\n t = tvalues[j];\r\n mt = 1 - t;\r\n bounds[0][j] = (mt * mt * mt * x0) + (3 * mt * mt * t * x1) + (3 * mt * t * t * x2) + (t * t * t * x3);\r\n bounds[1][j] = (mt * mt * mt * y0) + (3 * mt * mt * t * y1) + (3 * mt * t * t * y2) + (t * t * t * y3);\r\n }\r\n\r\n bounds[0][jlen] = x0;\r\n bounds[1][jlen] = y0;\r\n bounds[0][jlen + 1] = x3;\r\n bounds[1][jlen + 1] = y3;\r\n bounds[0].length = bounds[1].length = jlen + 2;\r\n\r\n return {\r\n min: { x: mmin.apply(0, bounds[0]), y: mmin.apply(0, bounds[1]) },\r\n max: { x: mmax.apply(0, bounds[0]), y: mmax.apply(0, bounds[1]) }\r\n };\r\n}\r\n\r\nfunction path2curve(path, path2) {\r\n var pth = !path2 && paths(path);\r\n\r\n if (!path2 && pth.curve) {\r\n return pathClone(pth.curve);\r\n }\r\n\r\n var p = pathToAbsolute(path),\r\n p2 = path2 && pathToAbsolute(path2),\r\n attrs = { x: 0, y: 0, bx: 0, by: 0, X: 0, Y: 0, qx: null, qy: null },\r\n attrs2 = { x: 0, y: 0, bx: 0, by: 0, X: 0, Y: 0, qx: null, qy: null },\r\n processPath = function(path, d, pcom) {\r\n var nx, ny;\r\n\r\n if (!path) {\r\n return ['C', d.x, d.y, d.x, d.y, d.x, d.y];\r\n }\r\n\r\n !(path[0] in { T: 1, Q: 1 }) && (d.qx = d.qy = null);\r\n\r\n switch (path[0]) {\r\n case 'M':\r\n d.X = path[1];\r\n d.Y = path[2];\r\n break;\r\n case 'A':\r\n path = ['C'].concat(a2c.apply(0, [d.x, d.y].concat(path.slice(1))));\r\n break;\r\n case 'S':\r\n if (pcom == 'C' || pcom == 'S') { // In 'S' case we have to take into account, if the previous command is C/S.\r\n nx = d.x * 2 - d.bx; // And reflect the previous\r\n ny = d.y * 2 - d.by; // command's control point relative to the current point.\r\n }\r\n else { // or some else or nothing\r\n nx = d.x;\r\n ny = d.y;\r\n }\r\n path = ['C', nx, ny].concat(path.slice(1));\r\n break;\r\n case 'T':\r\n if (pcom == 'Q' || pcom == 'T') { // In 'T' case we have to take into account, if the previous command is Q/T.\r\n d.qx = d.x * 2 - d.qx; // And make a reflection similar\r\n d.qy = d.y * 2 - d.qy; // to case 'S'.\r\n }\r\n else { // or something else or nothing\r\n d.qx = d.x;\r\n d.qy = d.y;\r\n }\r\n path = ['C'].concat(q2c(d.x, d.y, d.qx, d.qy, path[1], path[2]));\r\n break;\r\n case 'Q':\r\n d.qx = path[1];\r\n d.qy = path[2];\r\n path = ['C'].concat(q2c(d.x, d.y, path[1], path[2], path[3], path[4]));\r\n break;\r\n case 'L':\r\n path = ['C'].concat(l2c(d.x, d.y, path[1], path[2]));\r\n break;\r\n case 'H':\r\n path = ['C'].concat(l2c(d.x, d.y, path[1], d.y));\r\n break;\r\n case 'V':\r\n path = ['C'].concat(l2c(d.x, d.y, d.x, path[1]));\r\n break;\r\n case 'Z':\r\n path = ['C'].concat(l2c(d.x, d.y, d.X, d.Y));\r\n break;\r\n }\r\n\r\n return path;\r\n },\r\n\r\n fixArc = function(pp, i) {\r\n\r\n if (pp[i].length > 7) {\r\n pp[i].shift();\r\n var pi = pp[i];\r\n\r\n while (pi.length) {\r\n pcoms1[i] = 'A'; // if created multiple C:s, their original seg is saved\r\n p2 && (pcoms2[i] = 'A'); // the same as above\r\n pp.splice(i++, 0, ['C'].concat(pi.splice(0, 6)));\r\n }\r\n\r\n pp.splice(i, 1);\r\n ii = mmax(p.length, p2 && p2.length || 0);\r\n }\r\n },\r\n\r\n fixM = function(path1, path2, a1, a2, i) {\r\n\r\n if (path1 && path2 && path1[i][0] == 'M' && path2[i][0] != 'M') {\r\n path2.splice(i, 0, ['M', a2.x, a2.y]);\r\n a1.bx = 0;\r\n a1.by = 0;\r\n a1.x = path1[i][1];\r\n a1.y = path1[i][2];\r\n ii = mmax(p.length, p2 && p2.length || 0);\r\n }\r\n },\r\n\r\n pcoms1 = [], // path commands of original path p\r\n pcoms2 = [], // path commands of original path p2\r\n pfirst = '', // temporary holder for original path command\r\n pcom = ''; // holder for previous path command of original path\r\n\r\n for (var i = 0, ii = mmax(p.length, p2 && p2.length || 0); i < ii; i++) {\r\n p[i] && (pfirst = p[i][0]); // save current path command\r\n\r\n if (pfirst != 'C') // C is not saved yet, because it may be result of conversion\r\n {\r\n pcoms1[i] = pfirst; // Save current path command\r\n i && ( pcom = pcoms1[i - 1]); // Get previous path command pcom\r\n }\r\n p[i] = processPath(p[i], attrs, pcom); // Previous path command is inputted to processPath\r\n\r\n if (pcoms1[i] != 'A' && pfirst == 'C') pcoms1[i] = 'C'; // A is the only command\r\n // which may produce multiple C:s\r\n // so we have to make sure that C is also C in original path\r\n\r\n fixArc(p, i); // fixArc adds also the right amount of A:s to pcoms1\r\n\r\n if (p2) { // the same procedures is done to p2\r\n p2[i] && (pfirst = p2[i][0]);\r\n\r\n if (pfirst != 'C') {\r\n pcoms2[i] = pfirst;\r\n i && (pcom = pcoms2[i - 1]);\r\n }\r\n\r\n p2[i] = processPath(p2[i], attrs2, pcom);\r\n\r\n if (pcoms2[i] != 'A' && pfirst == 'C') {\r\n pcoms2[i] = 'C';\r\n }\r\n\r\n fixArc(p2, i);\r\n }\r\n\r\n fixM(p, p2, attrs, attrs2, i);\r\n fixM(p2, p, attrs2, attrs, i);\r\n\r\n var seg = p[i],\r\n seg2 = p2 && p2[i],\r\n seglen = seg.length,\r\n seg2len = p2 && seg2.length;\r\n\r\n attrs.x = seg[seglen - 2];\r\n attrs.y = seg[seglen - 1];\r\n attrs.bx = toFloat(seg[seglen - 4]) || attrs.x;\r\n attrs.by = toFloat(seg[seglen - 3]) || attrs.y;\r\n attrs2.bx = p2 && (toFloat(seg2[seg2len - 4]) || attrs2.x);\r\n attrs2.by = p2 && (toFloat(seg2[seg2len - 3]) || attrs2.y);\r\n attrs2.x = p2 && seg2[seg2len - 2];\r\n attrs2.y = p2 && seg2[seg2len - 1];\r\n }\r\n\r\n if (!p2) {\r\n pth.curve = pathClone(p);\r\n }\r\n\r\n return p2 ? [p, p2] : p;\r\n}\r\n\r\nfunction mapPath(path, matrix) {\r\n\r\n if (!matrix) {\r\n return path;\r\n }\r\n\r\n var x, y, i, j, ii, jj, pathi;\r\n path = path2curve(path);\r\n\r\n for (i = 0, ii = path.length; i < ii; i++) {\r\n pathi = path[i];\r\n\r\n for (j = 1, jj = pathi.length; j < jj; j += 2) {\r\n x = matrix.x(pathi[j], pathi[j + 1]);\r\n y = matrix.y(pathi[j], pathi[j + 1]);\r\n pathi[j] = x;\r\n pathi[j + 1] = y;\r\n }\r\n }\r\n\r\n return path;\r\n}\r\n\r\n// http://schepers.cc/getting-to-the-point\r\nfunction catmullRom2bezier(crp, z) {\r\n var d = [];\r\n\r\n for (var i = 0, iLen = crp.length; iLen - 2 * !z > i; i += 2) {\r\n var p = [\r\n { x: +crp[i - 2], y: +crp[i - 1] },\r\n { x: +crp[i], y: +crp[i + 1] },\r\n { x: +crp[i + 2], y: +crp[i + 3] },\r\n { x: +crp[i + 4], y: +crp[i + 5] }\r\n ];\r\n\r\n if (z) {\r\n\r\n if (!i) {\r\n p[0] = { x: +crp[iLen - 2], y: +crp[iLen - 1] };\r\n } else if (iLen - 4 == i) {\r\n p[3] = { x: +crp[0], y: +crp[1] };\r\n } else if (iLen - 2 == i) {\r\n p[2] = { x: +crp[0], y: +crp[1] };\r\n p[3] = { x: +crp[2], y: +crp[3] };\r\n }\r\n\r\n } else {\r\n\r\n if (iLen - 4 == i) {\r\n p[3] = p[2];\r\n } else if (!i) {\r\n p[0] = { x: +crp[i], y: +crp[i + 1] };\r\n }\r\n\r\n }\r\n\r\n d.push(['C',\r\n (-p[0].x + 6 * p[1].x + p[2].x) / 6,\r\n (-p[0].y + 6 * p[1].y + p[2].y) / 6,\r\n (p[1].x + 6 * p[2].x - p[3].x) / 6,\r\n (p[1].y + 6*p[2].y - p[3].y) / 6,\r\n p[2].x,\r\n p[2].y\r\n ]);\r\n }\r\n\r\n return d;\r\n}\r\n\r\npaths.getTotalLength = getTotalLength;\r\npaths.getPointAtLength = getPointAtLength;\r\npaths.findDotsAtSegment = findDotsAtSegment;\r\npaths.bezierBBox = bezierBBox;\r\npaths.isPointInsideBBox = isPointInsideBBox;\r\npaths.isBBoxIntersect = isBBoxIntersect;\r\npaths.intersection = pathIntersection;\r\npaths.intersectionNumber = pathIntersectionNumber;\r\npaths.isPointInside = isPointInsidePath;\r\npaths.getBBox = pathBBox;\r\npaths.toRelative = pathToRelative;\r\npaths.toAbsolute = pathToAbsolute;\r\npaths.toCubic = path2curve;\r\npaths.map = mapPath;\r\npaths.toString = toString;\r\npaths.clone = pathClone;\r\n\r\nmodule.exports.intersection = pathIntersection;\r\n","'use strict';\n\nvar pointDistance = require(268).pointDistance;\n\nvar intersection = require(271).intersection;\n\nvar round = Math.round,\n max = Math.max;\n\n\nfunction circlePath(center, r) {\n var x = center.x,\n y = center.y;\n\n return [\n ['M', x, y],\n ['m', 0, -r],\n ['a', r, r, 0, 1, 1, 0, 2 * r],\n ['a', r, r, 0, 1, 1, 0, -2 * r],\n ['z']\n ];\n}\n\nfunction linePath(points) {\n var segments = [];\n\n points.forEach(function(p, idx) {\n segments.push([ idx === 0 ? 'M' : 'L', p.x, p.y ]);\n });\n\n return segments;\n}\n\n\nvar INTERSECTION_THRESHOLD = 10;\n\nfunction getBendpointIntersection(waypoints, reference) {\n\n var i, w;\n\n for (i = 0; (w = waypoints[i]); i++) {\n\n if (pointDistance(w, reference) <= INTERSECTION_THRESHOLD) {\n return {\n point: waypoints[i],\n bendpoint: true,\n index: i\n };\n }\n }\n\n return null;\n}\n\nfunction getPathIntersection(waypoints, reference) {\n\n var intersections = intersection(circlePath(reference, INTERSECTION_THRESHOLD), linePath(waypoints));\n\n var a = intersections[0],\n b = intersections[intersections.length - 1],\n idx;\n\n if (!a) {\n // no intersection\n return null;\n }\n\n if (a !== b) {\n\n if (a.segment2 !== b.segment2) {\n // we use the bendpoint in between both segments\n // as the intersection point\n\n idx = max(a.segment2, b.segment2) - 1;\n\n return {\n point: waypoints[idx],\n bendpoint: true,\n index: idx\n };\n }\n\n return {\n point: {\n x: (round(a.x + b.x) / 2),\n y: (round(a.y + b.y) / 2)\n },\n index: a.segment2\n };\n }\n\n return {\n point: {\n x: round(a.x),\n y: round(a.y)\n },\n index: a.segment2\n };\n}\n\n/**\n * Returns the closest point on the connection towards a given reference point.\n *\n * @param {Array} waypoints\n * @param {Point} reference\n *\n * @return {Object} intersection data (segment, point)\n */\nmodule.exports.getApproxIntersection = function(waypoints, reference) {\n return getBendpointIntersection(waypoints, reference) || getPathIntersection(waypoints, reference);\n};\n","'use strict';\n\n/**\n * Get the logarithm of x with base 10\n * @param {Integer} value\n */\nfunction log10(x) {\n return Math.log(x) / Math.log(10);\n}\n\nmodule.exports.log10 = log10;\n\n\nfunction substract(p1, p2) {\n return {\n x: p1.x - p2.x,\n y: p1.y - p2.y\n };\n}\n\nmodule.exports.substract = substract;\n","'use strict';\n\nvar getOriginalEvent = require(267).getOriginal;\n\nvar isMac = require(275).isMac;\n\n\nfunction isPrimaryButton(event) {\n // button === 0 -> left áka primary mouse button\n return !(getOriginalEvent(event) || event).button;\n}\n\nmodule.exports.isPrimaryButton = isPrimaryButton;\n\nmodule.exports.isMac = isMac;\n\nmodule.exports.hasPrimaryModifier = function(event) {\n var originalEvent = getOriginalEvent(event) || event;\n\n if (!isPrimaryButton(event)) {\n return false;\n }\n\n // Use alt as primary modifier key for mac OS\n if (isMac()) {\n return originalEvent.metaKey;\n } else {\n return originalEvent.ctrlKey;\n }\n};\n\n\nmodule.exports.hasSecondaryModifier = function(event) {\n var originalEvent = getOriginalEvent(event) || event;\n\n return isPrimaryButton(event) && originalEvent.shiftKey;\n};\n","'use strict';\n\nmodule.exports.isMac = function isMac() {\n return (/mac/i).test(navigator.platform);\n};","'use strict';\n\nfunction center(bounds) {\n return {\n x: bounds.x + (bounds.width / 2),\n y: bounds.y + (bounds.height / 2)\n };\n}\n\nmodule.exports.center = center;\n\n\nfunction delta(a, b) {\n return {\n x: a.x - b.x,\n y: a.y - b.y\n };\n}\n\nmodule.exports.delta = delta;\n","'use strict';\n\n\n/**\n * Remove from the beginning of a collection until it is empty.\n *\n * This is a null-safe operation that ensures elements\n * are being removed from the given collection until the\n * collection is empty.\n *\n * The implementation deals with the fact that a remove operation\n * may touch, i.e. remove multiple elements in the collection\n * at a time.\n *\n * @param {Array} [collection]\n * @param {Function} removeFn\n *\n * @return {Array} the cleared collection\n */\nmodule.exports.saveClear = function(collection, removeFn) {\n\n if (typeof removeFn !== 'function') {\n throw new Error('removeFn iterator must be a function');\n }\n\n if (!collection) {\n return;\n }\n\n var e;\n\n while ((e = collection[0])) {\n removeFn(e);\n }\n\n return collection;\n};\n","'use strict';\n\nvar svgAttr = require(474),\n svgCreate = require(478);\n\n\nmodule.exports.componentsToPath = function(elements) {\n return elements.join(',').replace(/,?([A-z]),?/g, '$1');\n};\n\nfunction toSVGPoints(points) {\n var result = '';\n\n for (var i = 0, p; (p = points[i]); i++) {\n result += p.x + ',' + p.y + ' ';\n }\n\n return result;\n}\n\nmodule.exports.toSVGPoints = toSVGPoints;\n\nmodule.exports.createLine = function(points, attrs) {\n\n var line = svgCreate('polyline');\n svgAttr(line, { points: toSVGPoints(points) });\n\n if (attrs) {\n svgAttr(line, attrs);\n }\n\n return line;\n};\n\nmodule.exports.updateLine = function(gfx, points) {\n svgAttr(gfx, { points: toSVGPoints(points) });\n\n return gfx;\n};\n","'use strict';\r\n\r\nvar svgTransform = require(482);\r\n\r\nvar createTransform = require(479).createTransform;\r\n\r\n\r\n/**\r\n * @param {} element\r\n * @param {Number} x\r\n * @param {Number} y\r\n * @param {Number} angle\r\n * @param {Number} amount\r\n */\r\nmodule.exports.transform = function(gfx, x, y, angle, amount) {\r\n var translate = createTransform();\r\n translate.setTranslate(x, y);\r\n\r\n var rotate = createTransform();\r\n rotate.setRotate(angle, 0, 0);\r\n\r\n var scale = createTransform();\r\n scale.setScale(amount || 1, amount || 1);\r\n\r\n svgTransform(gfx, [ translate, rotate, scale ]);\r\n};\r\n\r\n\r\n/**\r\n * @param {SVGElement} element\r\n * @param {Number} x\r\n * @param {Number} y\r\n */\r\nmodule.exports.translate = function(gfx, x, y) {\r\n var translate = createTransform();\r\n translate.setTranslate(x, y);\r\n\r\n svgTransform(gfx, translate);\r\n};\r\n\r\n\r\n/**\r\n * @param {SVGElement} element\r\n * @param {Number} angle\r\n */\r\nmodule.exports.rotate = function(gfx, angle) {\r\n var rotate = createTransform();\r\n rotate.setRotate(angle, 0, 0);\r\n\r\n svgTransform(gfx, rotate);\r\n};\r\n\r\n\r\n/**\r\n * @param {SVGElement} element\r\n * @param {Number} amount\r\n */\r\nmodule.exports.scale = function(gfx, amount) {\r\n var scale = createTransform();\r\n scale.setScale(amount, amount);\r\n\r\n svgTransform(gfx, scale);\r\n};\r\n","'use strict';\n\nvar isObject = require(426),\n assign = require(431),\n pick = require(438),\n forEach = require(303),\n reduce = require(306),\n merge = require(435);\n\nvar svgAppend = require(472),\n svgAttr = require(474),\n svgCreate = require(478),\n svgRemove = require(481);\n\nvar DEFAULT_BOX_PADDING = 0;\n\nvar DEFAULT_LABEL_SIZE = {\n width: 150,\n height: 50\n};\n\n\nfunction parseAlign(align) {\n\n var parts = align.split('-');\n\n return {\n horizontal: parts[0] || 'center',\n vertical: parts[1] || 'top'\n };\n}\n\nfunction parsePadding(padding) {\n\n if (isObject(padding)) {\n return assign({ top: 0, left: 0, right: 0, bottom: 0 }, padding);\n } else {\n return {\n top: padding,\n left: padding,\n right: padding,\n bottom: padding\n };\n }\n}\n\nfunction getTextBBox(text, fakeText) {\n\n fakeText.textContent = text;\n\n try {\n var bbox,\n emptyLine = text === '';\n\n // add dummy text, when line is empty to determine correct height\n fakeText.textContent = emptyLine ? 'dummy' : text;\n\n bbox = pick(fakeText.getBBox(), [ 'width', 'height' ]);\n\n if (emptyLine) {\n // correct width\n bbox.width = 0;\n }\n\n return bbox;\n } catch (e) {\n return { width: 0, height: 0 };\n }\n}\n\n\n/**\n * Layout the next line and return the layouted element.\n *\n * Alters the lines passed.\n *\n * @param {Array} lines\n * @return {Object} the line descriptor, an object { width, height, text }\n */\nfunction layoutNext(lines, maxWidth, fakeText) {\n\n var originalLine = lines.shift(),\n fitLine = originalLine;\n\n var textBBox;\n\n for (;;) {\n textBBox = getTextBBox(fitLine, fakeText);\n\n textBBox.width = fitLine ? textBBox.width : 0;\n\n // try to fit\n if (fitLine === ' ' || fitLine === '' || textBBox.width < Math.round(maxWidth) || fitLine.length < 2) {\n return fit(lines, fitLine, originalLine, textBBox);\n }\n\n fitLine = shortenLine(fitLine, textBBox.width, maxWidth);\n }\n}\n\nfunction fit(lines, fitLine, originalLine, textBBox) {\n if (fitLine.length < originalLine.length) {\n var remainder = originalLine.slice(fitLine.length).trim();\n\n lines.unshift(remainder);\n }\n return { width: textBBox.width, height: textBBox.height, text: fitLine };\n}\n\n\n/**\n * Shortens a line based on spacing and hyphens.\n * Returns the shortened result on success.\n *\n * @param {String} line\n * @param {Number} maxLength the maximum characters of the string\n * @return {String} the shortened string\n */\nfunction semanticShorten(line, maxLength) {\n var parts = line.split(/(/s|-)/g),\n part,\n shortenedParts = [],\n length = 0;\n\n // try to shorten via spaces + hyphens\n if (parts.length > 1) {\n while ((part = parts.shift())) {\n if (part.length + length < maxLength) {\n shortenedParts.push(part);\n length += part.length;\n } else {\n // remove previous part, too if hyphen does not fit anymore\n if (part === '-') {\n shortenedParts.pop();\n }\n\n break;\n }\n }\n }\n\n return shortenedParts.join('');\n}\n\n\nfunction shortenLine(line, width, maxWidth) {\n var length = Math.max(line.length * (maxWidth / width), 1);\n\n // try to shorten semantically (i.e. based on spaces and hyphens)\n var shortenedLine = semanticShorten(line, length);\n\n if (!shortenedLine) {\n\n // force shorten by cutting the long word\n shortenedLine = line.slice(0, Math.max(Math.round(length - 1), 1));\n }\n\n return shortenedLine;\n}\n\n\nfunction getHelperSvg() {\n var helperSvg = document.getElementById('helper-svg');\n\n if (!helperSvg) {\n helperSvg = svgCreate('svg');\n\n svgAttr(helperSvg, {\n id: 'helper-svg',\n width: 0,\n height: 0,\n style: 'visibility: hidden; position: fixed'\n });\n\n document.body.appendChild(helperSvg);\n }\n\n return helperSvg;\n}\n\n\n/**\n * Creates a new label utility\n *\n * @param {Object} config\n * @param {Dimensions} config.size\n * @param {Number} config.padding\n * @param {Object} config.style\n * @param {String} config.align\n */\nfunction Text(config) {\n\n this._config = assign({}, {\n size: DEFAULT_LABEL_SIZE,\n padding: DEFAULT_BOX_PADDING,\n style: {},\n align: 'center-top'\n }, config || {});\n}\n\n/**\n * Returns the layouted text as an SVG element.\n *\n * @param {String} text\n * @param {Object} options\n *\n * @return {SVGElement}\n */\nText.prototype.createText = function(text, options) {\n return this.layoutText(text, options).element;\n};\n\n/**\n * Returns a labels layouted dimensions.\n *\n * @param {String} text to layout\n * @param {Object} options\n *\n * @return {Dimensions}\n */\nText.prototype.getDimensions = function(text, options) {\n return this.layoutText(text, options).dimensions;\n};\n\n/**\n * Creates and returns a label and its bounding box.\n *\n * @method Text#createText\n *\n * @param {String} text the text to render on the label\n * @param {Object} options\n * @param {String} options.align how to align in the bounding box.\n * Any of { 'center-middle', 'center-top' },\n * defaults to 'center-top'.\n * @param {String} options.style style to be applied to the text\n * @param {boolean} options.fitBox indicates if box will be recalculated to\n * fit text\n *\n * @return {Object} { element, dimensions }\n */\nText.prototype.layoutText = function(text, options) {\n var box = merge({}, this._config.size, options.box || {}),\n style = merge({}, this._config.style, options.style || {}),\n align = parseAlign(options.align || this._config.align),\n padding = parsePadding(options.padding !== undefined ? options.padding : this._config.padding),\n fitBox = options.fitBox || false;\n\n var lines = text.split(//r?/n/g),\n layouted = [];\n\n var maxWidth = box.width - padding.left - padding.right;\n\n // ensure correct rendering by attaching helper text node to invisible SVG\n var helperText = svgCreate('text');\n svgAttr(helperText, { x: 0, y: 0 });\n svgAttr(helperText, style);\n\n var helperSvg = getHelperSvg();\n\n svgAppend(helperSvg, helperText);\n\n while (lines.length) {\n layouted.push(layoutNext(lines, maxWidth, helperText));\n }\n\n var totalHeight = reduce(layouted, function(sum, line, idx) {\n return sum + line.height;\n }, 0);\n\n var maxLineWidth = reduce(layouted, function(sum, line, idx) {\n return line.width > sum ? line.width : sum;\n }, 0);\n\n // the y position of the next line\n var y, x;\n\n switch (align.vertical) {\n case 'middle':\n y = (box.height - totalHeight) / 2 - layouted[0].height / 4;\n break;\n\n default:\n y = padding.top;\n }\n\n var textElement = svgCreate('text');\n\n svgAttr(textElement, style);\n\n // layout each line taking into account that parent\n // shape might resize to fit text size\n forEach(layouted, function(line) {\n y += line.height;\n\n switch (align.horizontal) {\n case 'left':\n x = padding.left;\n break;\n\n case 'right':\n x = ((fitBox ? maxLineWidth : maxWidth)\n - padding.right - line.width);\n break;\n\n default:\n // aka center\n x = Math.max((((fitBox ? maxLineWidth : maxWidth)\n - line.width) / 2 + padding.left), 0);\n }\n\n var tspan = svgCreate('tspan');\n svgAttr(tspan, { x: x, y: y });\n\n tspan.textContent = line.text;\n\n svgAppend(textElement, tspan);\n });\n\n svgRemove(helperText);\n\n var dimensions = {\n width: maxLineWidth,\n height: totalHeight\n };\n\n return {\n dimensions: dimensions,\n element: textElement\n };\n};\n\nmodule.exports = Text;\n","\nvar isArray = function(obj) {\n return Object.prototype.toString.call(obj) === '[object Array]';\n};\n\nvar annotate = function() {\n var args = Array.prototype.slice.call(arguments);\n \n if (args.length === 1 && isArray(args[0])) {\n args = args[0];\n }\n\n var fn = args.pop();\n\n fn.$inject = args;\n\n return fn;\n};\n\n\n// Current limitations:\n// - can't put into \"function arg\" comments\n// function /* (no parenthesis like this) */ (){}\n// function abc( /* xx (no parenthesis like this) */ a, b) {}\n//\n// Just put the comment before function or inside:\n// /* (((this is fine))) */ function(a, b) {}\n// function abc(a) { /* (((this is fine))) */}\n\nvar FN_ARGS = /^function/s*[^/(]*/(/s*([^/)]*)/)/m;\nvar FN_ARG = ////*([^/*]*)/*///m;\n\nvar parse = function(fn) {\n if (typeof fn !== 'function') {\n throw new Error('Cannot annotate \"' + fn + '\". Expected a function!');\n }\n\n var match = fn.toString().match(FN_ARGS);\n return match[1] && match[1].split(',').map(function(arg) {\n match = arg.match(FN_ARG);\n return match ? match[1].trim() : arg.trim();\n }) || [];\n};\n\n\nexports.annotate = annotate;\nexports.parse = parse;\nexports.isArray = isArray;\n","module.exports = {\n annotate: require(281).annotate,\n Module: require(284),\n Injector: require(283)\n};\n","var Module = require(284);\nvar autoAnnotate = require(281).parse;\nvar annotate = require(281).annotate;\nvar isArray = require(281).isArray;\n\n\nvar Injector = function(modules, parent) {\n parent = parent || {\n get: function(name, strict) {\n currentlyResolving.push(name);\n\n if (strict === false) {\n return null;\n } else {\n throw error('No provider for \"' + name + '\"!');\n }\n }\n };\n\n var currentlyResolving = [];\n var providers = this._providers = Object.create(parent._providers || null);\n var instances = this._instances = Object.create(null);\n\n var self = instances.injector = this;\n\n var error = function(msg) {\n var stack = currentlyResolving.join(' -> ');\n currentlyResolving.length = 0;\n return new Error(stack ? msg + ' (Resolving: ' + stack + ')' : msg);\n };\n\n /**\n * Return a named service.\n *\n * @param {String} name\n * @param {Boolean} [strict=true] if false, resolve missing services to null\n *\n * @return {Object}\n */\n var get = function(name, strict) {\n if (!providers[name] && name.indexOf('.') !== -1) {\n var parts = name.split('.');\n var pivot = get(parts.shift());\n\n while(parts.length) {\n pivot = pivot[parts.shift()];\n }\n\n return pivot;\n }\n\n if (Object.hasOwnProperty.call(instances, name)) {\n return instances[name];\n }\n\n if (Object.hasOwnProperty.call(providers, name)) {\n if (currentlyResolving.indexOf(name) !== -1) {\n currentlyResolving.push(name);\n throw error('Cannot resolve circular dependency!');\n }\n\n currentlyResolving.push(name);\n instances[name] = providers[name][0](providers[name][1]);\n currentlyResolving.pop();\n\n return instances[name];\n }\n\n return parent.get(name, strict);\n };\n\n var instantiate = function(Type) {\n var instance = Object.create(Type.prototype);\n var returned = invoke(Type, instance);\n\n return typeof returned === 'object' ? returned : instance;\n };\n\n var invoke = function(fn, context) {\n if (typeof fn !== 'function') {\n if (isArray(fn)) {\n fn = annotate(fn.slice());\n } else {\n throw new Error('Cannot invoke \"' + fn + '\". Expected a function!');\n }\n }\n\n var inject = fn.$inject && fn.$inject || autoAnnotate(fn);\n var dependencies = inject.map(function(dep) {\n return get(dep);\n });\n\n // TODO(vojta): optimize without apply\n return fn.apply(context, dependencies);\n };\n\n\n var createPrivateInjectorFactory = function(privateChildInjector) {\n return annotate(function(key) {\n return privateChildInjector.get(key);\n });\n };\n\n var createChild = function(modules, forceNewInstances) {\n if (forceNewInstances && forceNewInstances.length) {\n var fromParentModule = Object.create(null);\n var matchedScopes = Object.create(null);\n\n var privateInjectorsCache = [];\n var privateChildInjectors = [];\n var privateChildFactories = [];\n\n var provider;\n var cacheIdx;\n var privateChildInjector;\n var privateChildInjectorFactory;\n for (var name in providers) {\n provider = providers[name];\n\n if (forceNewInstances.indexOf(name) !== -1) {\n if (provider[2] === 'private') {\n cacheIdx = privateInjectorsCache.indexOf(provider[3]);\n if (cacheIdx === -1) {\n privateChildInjector = provider[3].createChild([], forceNewInstances);\n privateChildInjectorFactory = createPrivateInjectorFactory(privateChildInjector);\n privateInjectorsCache.push(provider[3]);\n privateChildInjectors.push(privateChildInjector);\n privateChildFactories.push(privateChildInjectorFactory);\n fromParentModule[name] = [privateChildInjectorFactory, name, 'private', privateChildInjector];\n } else {\n fromParentModule[name] = [privateChildFactories[cacheIdx], name, 'private', privateChildInjectors[cacheIdx]];\n }\n } else {\n fromParentModule[name] = [provider[2], provider[1]];\n }\n matchedScopes[name] = true;\n }\n\n if ((provider[2] === 'factory' || provider[2] === 'type') && provider[1].$scope) {\n /*jshint -W083 */\n forceNewInstances.forEach(function(scope) {\n if (provider[1].$scope.indexOf(scope) !== -1) {\n fromParentModule[name] = [provider[2], provider[1]];\n matchedScopes[scope] = true;\n }\n });\n }\n }\n\n forceNewInstances.forEach(function(scope) {\n if (!matchedScopes[scope]) {\n throw new Error('No provider for \"' + scope + '\". Cannot use provider from the parent!');\n }\n });\n\n modules.unshift(fromParentModule);\n }\n\n return new Injector(modules, self);\n };\n\n var factoryMap = {\n factory: invoke,\n type: instantiate,\n value: function(value) {\n return value;\n }\n };\n\n modules.forEach(function(module) {\n\n function arrayUnwrap(type, value) {\n if (type !== 'value' && isArray(value)) {\n value = annotate(value.slice());\n }\n\n return value;\n }\n\n // TODO(vojta): handle wrong inputs (modules)\n if (module instanceof Module) {\n module.forEach(function(provider) {\n var name = provider[0];\n var type = provider[1];\n var value = provider[2];\n\n providers[name] = [factoryMap[type], arrayUnwrap(type, value), type];\n });\n } else if (typeof module === 'object') {\n if (module.__exports__) {\n var clonedModule = Object.keys(module).reduce(function(m, key) {\n if (key.substring(0, 2) !== '__') {\n m[key] = module[key];\n }\n return m;\n }, Object.create(null));\n\n var privateInjector = new Injector((module.__modules__ || []).concat([clonedModule]), self);\n var getFromPrivateInjector = annotate(function(key) {\n return privateInjector.get(key);\n });\n module.__exports__.forEach(function(key) {\n providers[key] = [getFromPrivateInjector, key, 'private', privateInjector];\n });\n } else {\n Object.keys(module).forEach(function(name) {\n if (module[name][2] === 'private') {\n providers[name] = module[name];\n return;\n }\n\n var type = module[name][0];\n var value = module[name][1];\n\n providers[name] = [factoryMap[type], arrayUnwrap(type, value), type];\n });\n }\n }\n });\n\n // public API\n this.get = get;\n this.invoke = invoke;\n this.instantiate = instantiate;\n this.createChild = createChild;\n};\n\nmodule.exports = Injector;\n","var Module = function() {\n var providers = [];\n\n this.factory = function(name, factory) {\n providers.push([name, 'factory', factory]);\n return this;\n };\n\n this.value = function(name, value) {\n providers.push([name, 'value', value]);\n return this;\n };\n\n this.type = function(name, type) {\n providers.push([name, 'type', type]);\n return this;\n };\n\n this.forEach = function(iterator) {\n providers.forEach(iterator);\n };\n};\n\nmodule.exports = Module;\n","\n/**\n * Expose `parse`.\n */\n\nmodule.exports = parse;\n\n/**\n * Tests for browser support.\n */\n\nvar innerHTMLBug = false;\nvar bugTestDiv;\nif (typeof document !== 'undefined') {\n bugTestDiv = document.createElement('div');\n // Setup\n bugTestDiv.innerHTML = '
a';\n // Make sure that link elements get serialized correctly by innerHTML\n // This requires a wrapper element in IE\n innerHTMLBug = !bugTestDiv.getElementsByTagName('link').length;\n bugTestDiv = undefined;\n}\n\n/**\n * Wrap map from jquery.\n */\n\nvar map = {\n legend: [1, '
', '
'],\n tr: [2, '', '
'],\n col: [2, '', '
'],\n // for script/link/style tags to work in IE6-8, you have to wrap\n // in a div with a non-whitespace character in front, ha!\n _default: innerHTMLBug ? [1, 'X
', '
'] : [0, '', '']\n};\n\nmap.td =\nmap.th = [3, '', '
'];\n\nmap.option =\nmap.optgroup = [1, ''];\n\nmap.thead =\nmap.tbody =\nmap.colgroup =\nmap.caption =\nmap.tfoot = [1, '', '
'];\n\nmap.polyline =\nmap.ellipse =\nmap.polygon =\nmap.circle =\nmap.text =\nmap.line =\nmap.path =\nmap.rect =\nmap.g = [1, '',''];\n\n/**\n * Parse `html` and return a DOM Node instance, which could be a TextNode,\n * HTML DOM Node of some kind (
for example), or a DocumentFragment\n * instance, depending on the contents of the `html` string.\n *\n * @param {String} html - HTML string to \"domify\"\n * @param {Document} doc - The `document` instance to create the Node for\n * @return {DOMNode} the TextNode, DOM Node, or DocumentFragment instance\n * @api private\n */\n\nfunction parse(html, doc) {\n if ('string' != typeof html) throw new TypeError('String expected');\n\n // default to the global `document` object\n if (!doc) doc = document;\n\n // tag name\n var m = /<([/w:]+)/.exec(html);\n if (!m) return doc.createTextNode(html);\n\n html = html.replace(/^/s+|/s+$/g, ''); // Remove leading/trailing whitespace\n\n var tag = m[1];\n\n // body support\n if (tag == 'body') {\n var el = doc.createElement('html');\n el.innerHTML = html;\n return el.removeChild(el.lastChild);\n }\n\n // wrap map\n var wrap = map[tag] || map._default;\n var depth = wrap[0];\n var prefix = wrap[1];\n var suffix = wrap[2];\n var el = doc.createElement('div');\n el.innerHTML = prefix + html + suffix;\n while (depth--) el = el.lastChild;\n\n // one element\n if (el.firstChild == el.lastChild) {\n return el.removeChild(el.firstChild);\n }\n\n // several elements\n var fragment = doc.createDocumentFragment();\n while (el.firstChild) {\n fragment.appendChild(el.removeChild(el.firstChild));\n }\n\n return fragment;\n}\n","/*! Hammer.JS - v2.0.7 - 2016-04-22\n * http://hammerjs.github.io/\n *\n * Copyright (c) 2016 Jorik Tangelder;\n * Licensed under the MIT license */\n(function(window, document, exportName, undefined) {\n 'use strict';\n\nvar VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];\nvar TEST_ELEMENT = document.createElement('div');\n\nvar TYPE_FUNCTION = 'function';\n\nvar round = Math.round;\nvar abs = Math.abs;\nvar now = Date.now;\n\n/**\n * set a timeout with a given scope\n * @param {Function} fn\n * @param {Number} timeout\n * @param {Object} context\n * @returns {number}\n */\nfunction setTimeoutContext(fn, timeout, context) {\n return setTimeout(bindFn(fn, context), timeout);\n}\n\n/**\n * if the argument is an array, we want to execute the fn on each entry\n * if it aint an array we don't want to do a thing.\n * this is used by all the methods that accept a single and array argument.\n * @param {*|Array} arg\n * @param {String} fn\n * @param {Object} [context]\n * @returns {Boolean}\n */\nfunction invokeArrayArg(arg, fn, context) {\n if (Array.isArray(arg)) {\n each(arg, context[fn], context);\n return true;\n }\n return false;\n}\n\n/**\n * walk objects and arrays\n * @param {Object} obj\n * @param {Function} iterator\n * @param {Object} context\n */\nfunction each(obj, iterator, context) {\n var i;\n\n if (!obj) {\n return;\n }\n\n if (obj.forEach) {\n obj.forEach(iterator, context);\n } else if (obj.length !== undefined) {\n i = 0;\n while (i < obj.length) {\n iterator.call(context, obj[i], i, obj);\n i++;\n }\n } else {\n for (i in obj) {\n obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);\n }\n }\n}\n\n/**\n * wrap a method with a deprecation warning and stack trace\n * @param {Function} method\n * @param {String} name\n * @param {String} message\n * @returns {Function} A new function wrapping the supplied method.\n */\nfunction deprecate(method, name, message) {\n var deprecationMessage = 'DEPRECATED METHOD: ' + name + '/n' + message + ' AT /n';\n return function() {\n var e = new Error('get-stack-trace');\n var stack = e && e.stack ? e.stack.replace(/^[^/(]+?[/n$]/gm, '')\n .replace(/^/s+at/s+/gm, '')\n .replace(/^Object./s*/(/gm, '{anonymous}()@') : 'Unknown Stack Trace';\n\n var log = window.console && (window.console.warn || window.console.log);\n if (log) {\n log.call(window.console, deprecationMessage, stack);\n }\n return method.apply(this, arguments);\n };\n}\n\n/**\n * extend object.\n * means that properties in dest will be overwritten by the ones in src.\n * @param {Object} target\n * @param {...Object} objects_to_assign\n * @returns {Object} target\n */\nvar assign;\nif (typeof Object.assign !== 'function') {\n assign = function assign(target) {\n if (target === undefined || target === null) {\n throw new TypeError('Cannot convert undefined or null to object');\n }\n\n var output = Object(target);\n for (var index = 1; index < arguments.length; index++) {\n var source = arguments[index];\n if (source !== undefined && source !== null) {\n for (var nextKey in source) {\n if (source.hasOwnProperty(nextKey)) {\n output[nextKey] = source[nextKey];\n }\n }\n }\n }\n return output;\n };\n} else {\n assign = Object.assign;\n}\n\n/**\n * extend object.\n * means that properties in dest will be overwritten by the ones in src.\n * @param {Object} dest\n * @param {Object} src\n * @param {Boolean} [merge=false]\n * @returns {Object} dest\n */\nvar extend = deprecate(function extend(dest, src, merge) {\n var keys = Object.keys(src);\n var i = 0;\n while (i < keys.length) {\n if (!merge || (merge && dest[keys[i]] === undefined)) {\n dest[keys[i]] = src[keys[i]];\n }\n i++;\n }\n return dest;\n}, 'extend', 'Use `assign`.');\n\n/**\n * merge the values from src in the dest.\n * means that properties that exist in dest will not be overwritten by src\n * @param {Object} dest\n * @param {Object} src\n * @returns {Object} dest\n */\nvar merge = deprecate(function merge(dest, src) {\n return extend(dest, src, true);\n}, 'merge', 'Use `assign`.');\n\n/**\n * simple class inheritance\n * @param {Function} child\n * @param {Function} base\n * @param {Object} [properties]\n */\nfunction inherit(child, base, properties) {\n var baseP = base.prototype,\n childP;\n\n childP = child.prototype = Object.create(baseP);\n childP.constructor = child;\n childP._super = baseP;\n\n if (properties) {\n assign(childP, properties);\n }\n}\n\n/**\n * simple function bind\n * @param {Function} fn\n * @param {Object} context\n * @returns {Function}\n */\nfunction bindFn(fn, context) {\n return function boundFn() {\n return fn.apply(context, arguments);\n };\n}\n\n/**\n * let a boolean value also be a function that must return a boolean\n * this first item in args will be used as the context\n * @param {Boolean|Function} val\n * @param {Array} [args]\n * @returns {Boolean}\n */\nfunction boolOrFn(val, args) {\n if (typeof val == TYPE_FUNCTION) {\n return val.apply(args ? args[0] || undefined : undefined, args);\n }\n return val;\n}\n\n/**\n * use the val2 when val1 is undefined\n * @param {*} val1\n * @param {*} val2\n * @returns {*}\n */\nfunction ifUndefined(val1, val2) {\n return (val1 === undefined) ? val2 : val1;\n}\n\n/**\n * addEventListener with multiple events at once\n * @param {EventTarget} target\n * @param {String} types\n * @param {Function} handler\n */\nfunction addEventListeners(target, types, handler) {\n each(splitStr(types), function(type) {\n target.addEventListener(type, handler, false);\n });\n}\n\n/**\n * removeEventListener with multiple events at once\n * @param {EventTarget} target\n * @param {String} types\n * @param {Function} handler\n */\nfunction removeEventListeners(target, types, handler) {\n each(splitStr(types), function(type) {\n target.removeEventListener(type, handler, false);\n });\n}\n\n/**\n * find if a node is in the given parent\n * @method hasParent\n * @param {HTMLElement} node\n * @param {HTMLElement} parent\n * @return {Boolean} found\n */\nfunction hasParent(node, parent) {\n while (node) {\n if (node == parent) {\n return true;\n }\n node = node.parentNode;\n }\n return false;\n}\n\n/**\n * small indexOf wrapper\n * @param {String} str\n * @param {String} find\n * @returns {Boolean} found\n */\nfunction inStr(str, find) {\n return str.indexOf(find) > -1;\n}\n\n/**\n * split string on whitespace\n * @param {String} str\n * @returns {Array} words\n */\nfunction splitStr(str) {\n return str.trim().split(//s+/g);\n}\n\n/**\n * find if a array contains the object using indexOf or a simple polyFill\n * @param {Array} src\n * @param {String} find\n * @param {String} [findByKey]\n * @return {Boolean|Number} false when not found, or the index\n */\nfunction inArray(src, find, findByKey) {\n if (src.indexOf && !findByKey) {\n return src.indexOf(find);\n } else {\n var i = 0;\n while (i < src.length) {\n if ((findByKey && src[i][findByKey] == find) || (!findByKey && src[i] === find)) {\n return i;\n }\n i++;\n }\n return -1;\n }\n}\n\n/**\n * convert array-like objects to real arrays\n * @param {Object} obj\n * @returns {Array}\n */\nfunction toArray(obj) {\n return Array.prototype.slice.call(obj, 0);\n}\n\n/**\n * unique array with objects based on a key (like 'id') or just by the array's value\n * @param {Array} src [{id:1},{id:2},{id:1}]\n * @param {String} [key]\n * @param {Boolean} [sort=False]\n * @returns {Array} [{id:1},{id:2}]\n */\nfunction uniqueArray(src, key, sort) {\n var results = [];\n var values = [];\n var i = 0;\n\n while (i < src.length) {\n var val = key ? src[i][key] : src[i];\n if (inArray(values, val) < 0) {\n results.push(src[i]);\n }\n values[i] = val;\n i++;\n }\n\n if (sort) {\n if (!key) {\n results = results.sort();\n } else {\n results = results.sort(function sortUniqueArray(a, b) {\n return a[key] > b[key];\n });\n }\n }\n\n return results;\n}\n\n/**\n * get the prefixed property\n * @param {Object} obj\n * @param {String} property\n * @returns {String|Undefined} prefixed\n */\nfunction prefixed(obj, property) {\n var prefix, prop;\n var camelProp = property[0].toUpperCase() + property.slice(1);\n\n var i = 0;\n while (i < VENDOR_PREFIXES.length) {\n prefix = VENDOR_PREFIXES[i];\n prop = (prefix) ? prefix + camelProp : property;\n\n if (prop in obj) {\n return prop;\n }\n i++;\n }\n return undefined;\n}\n\n/**\n * get a unique id\n * @returns {number} uniqueId\n */\nvar _uniqueId = 1;\nfunction uniqueId() {\n return _uniqueId++;\n}\n\n/**\n * get the window object of an element\n * @param {HTMLElement} element\n * @returns {DocumentView|Window}\n */\nfunction getWindowForElement(element) {\n var doc = element.ownerDocument || element;\n return (doc.defaultView || doc.parentWindow || window);\n}\n\nvar MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;\n\nvar SUPPORT_TOUCH = ('ontouchstart' in window);\nvar SUPPORT_POINTER_EVENTS = prefixed(window, 'PointerEvent') !== undefined;\nvar SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);\n\nvar INPUT_TYPE_TOUCH = 'touch';\nvar INPUT_TYPE_PEN = 'pen';\nvar INPUT_TYPE_MOUSE = 'mouse';\nvar INPUT_TYPE_KINECT = 'kinect';\n\nvar COMPUTE_INTERVAL = 25;\n\nvar INPUT_START = 1;\nvar INPUT_MOVE = 2;\nvar INPUT_END = 4;\nvar INPUT_CANCEL = 8;\n\nvar DIRECTION_NONE = 1;\nvar DIRECTION_LEFT = 2;\nvar DIRECTION_RIGHT = 4;\nvar DIRECTION_UP = 8;\nvar DIRECTION_DOWN = 16;\n\nvar DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;\nvar DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;\nvar DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;\n\nvar PROPS_XY = ['x', 'y'];\nvar PROPS_CLIENT_XY = ['clientX', 'clientY'];\n\n/**\n * create new input type manager\n * @param {Manager} manager\n * @param {Function} callback\n * @returns {Input}\n * @constructor\n */\nfunction Input(manager, callback) {\n var self = this;\n this.manager = manager;\n this.callback = callback;\n this.element = manager.element;\n this.target = manager.options.inputTarget;\n\n // smaller wrapper around the handler, for the scope and the enabled state of the manager,\n // so when disabled the input events are completely bypassed.\n this.domHandler = function(ev) {\n if (boolOrFn(manager.options.enable, [manager])) {\n self.handler(ev);\n }\n };\n\n this.init();\n\n}\n\nInput.prototype = {\n /**\n * should handle the inputEvent data and trigger the callback\n * @virtual\n */\n handler: function() { },\n\n /**\n * bind the events\n */\n init: function() {\n this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);\n this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);\n this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n },\n\n /**\n * unbind the events\n */\n destroy: function() {\n this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);\n this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);\n this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n }\n};\n\n/**\n * create new input type manager\n * called by the Manager constructor\n * @param {Hammer} manager\n * @returns {Input}\n */\nfunction createInputInstance(manager) {\n var Type;\n var inputClass = manager.options.inputClass;\n\n if (inputClass) {\n Type = inputClass;\n } else if (SUPPORT_POINTER_EVENTS) {\n Type = PointerEventInput;\n } else if (SUPPORT_ONLY_TOUCH) {\n Type = TouchInput;\n } else if (!SUPPORT_TOUCH) {\n Type = MouseInput;\n } else {\n Type = TouchMouseInput;\n }\n return new (Type)(manager, inputHandler);\n}\n\n/**\n * handle input events\n * @param {Manager} manager\n * @param {String} eventType\n * @param {Object} input\n */\nfunction inputHandler(manager, eventType, input) {\n var pointersLen = input.pointers.length;\n var changedPointersLen = input.changedPointers.length;\n var isFirst = (eventType & INPUT_START && (pointersLen - changedPointersLen === 0));\n var isFinal = (eventType & (INPUT_END | INPUT_CANCEL) && (pointersLen - changedPointersLen === 0));\n\n input.isFirst = !!isFirst;\n input.isFinal = !!isFinal;\n\n if (isFirst) {\n manager.session = {};\n }\n\n // source event is the normalized value of the domEvents\n // like 'touchstart, mouseup, pointerdown'\n input.eventType = eventType;\n\n // compute scale, rotation etc\n computeInputData(manager, input);\n\n // emit secret event\n manager.emit('hammer.input', input);\n\n manager.recognize(input);\n manager.session.prevInput = input;\n}\n\n/**\n * extend the data with some usable properties like scale, rotate, velocity etc\n * @param {Object} manager\n * @param {Object} input\n */\nfunction computeInputData(manager, input) {\n var session = manager.session;\n var pointers = input.pointers;\n var pointersLength = pointers.length;\n\n // store the first input to calculate the distance and direction\n if (!session.firstInput) {\n session.firstInput = simpleCloneInputData(input);\n }\n\n // to compute scale and rotation we need to store the multiple touches\n if (pointersLength > 1 && !session.firstMultiple) {\n session.firstMultiple = simpleCloneInputData(input);\n } else if (pointersLength === 1) {\n session.firstMultiple = false;\n }\n\n var firstInput = session.firstInput;\n var firstMultiple = session.firstMultiple;\n var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;\n\n var center = input.center = getCenter(pointers);\n input.timeStamp = now();\n input.deltaTime = input.timeStamp - firstInput.timeStamp;\n\n input.angle = getAngle(offsetCenter, center);\n input.distance = getDistance(offsetCenter, center);\n\n computeDeltaXY(session, input);\n input.offsetDirection = getDirection(input.deltaX, input.deltaY);\n\n var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);\n input.overallVelocityX = overallVelocity.x;\n input.overallVelocityY = overallVelocity.y;\n input.overallVelocity = (abs(overallVelocity.x) > abs(overallVelocity.y)) ? overallVelocity.x : overallVelocity.y;\n\n input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;\n input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;\n\n input.maxPointers = !session.prevInput ? input.pointers.length : ((input.pointers.length >\n session.prevInput.maxPointers) ? input.pointers.length : session.prevInput.maxPointers);\n\n computeIntervalInputData(session, input);\n\n // find the correct target\n var target = manager.element;\n if (hasParent(input.srcEvent.target, target)) {\n target = input.srcEvent.target;\n }\n input.target = target;\n}\n\nfunction computeDeltaXY(session, input) {\n var center = input.center;\n var offset = session.offsetDelta || {};\n var prevDelta = session.prevDelta || {};\n var prevInput = session.prevInput || {};\n\n if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {\n prevDelta = session.prevDelta = {\n x: prevInput.deltaX || 0,\n y: prevInput.deltaY || 0\n };\n\n offset = session.offsetDelta = {\n x: center.x,\n y: center.y\n };\n }\n\n input.deltaX = prevDelta.x + (center.x - offset.x);\n input.deltaY = prevDelta.y + (center.y - offset.y);\n}\n\n/**\n * velocity is calculated every x ms\n * @param {Object} session\n * @param {Object} input\n */\nfunction computeIntervalInputData(session, input) {\n var last = session.lastInterval || input,\n deltaTime = input.timeStamp - last.timeStamp,\n velocity, velocityX, velocityY, direction;\n\n if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {\n var deltaX = input.deltaX - last.deltaX;\n var deltaY = input.deltaY - last.deltaY;\n\n var v = getVelocity(deltaTime, deltaX, deltaY);\n velocityX = v.x;\n velocityY = v.y;\n velocity = (abs(v.x) > abs(v.y)) ? v.x : v.y;\n direction = getDirection(deltaX, deltaY);\n\n session.lastInterval = input;\n } else {\n // use latest velocity info if it doesn't overtake a minimum period\n velocity = last.velocity;\n velocityX = last.velocityX;\n velocityY = last.velocityY;\n direction = last.direction;\n }\n\n input.velocity = velocity;\n input.velocityX = velocityX;\n input.velocityY = velocityY;\n input.direction = direction;\n}\n\n/**\n * create a simple clone from the input used for storage of firstInput and firstMultiple\n * @param {Object} input\n * @returns {Object} clonedInputData\n */\nfunction simpleCloneInputData(input) {\n // make a simple copy of the pointers because we will get a reference if we don't\n // we only need clientXY for the calculations\n var pointers = [];\n var i = 0;\n while (i < input.pointers.length) {\n pointers[i] = {\n clientX: round(input.pointers[i].clientX),\n clientY: round(input.pointers[i].clientY)\n };\n i++;\n }\n\n return {\n timeStamp: now(),\n pointers: pointers,\n center: getCenter(pointers),\n deltaX: input.deltaX,\n deltaY: input.deltaY\n };\n}\n\n/**\n * get the center of all the pointers\n * @param {Array} pointers\n * @return {Object} center contains `x` and `y` properties\n */\nfunction getCenter(pointers) {\n var pointersLength = pointers.length;\n\n // no need to loop when only one touch\n if (pointersLength === 1) {\n return {\n x: round(pointers[0].clientX),\n y: round(pointers[0].clientY)\n };\n }\n\n var x = 0, y = 0, i = 0;\n while (i < pointersLength) {\n x += pointers[i].clientX;\n y += pointers[i].clientY;\n i++;\n }\n\n return {\n x: round(x / pointersLength),\n y: round(y / pointersLength)\n };\n}\n\n/**\n * calculate the velocity between two points. unit is in px per ms.\n * @param {Number} deltaTime\n * @param {Number} x\n * @param {Number} y\n * @return {Object} velocity `x` and `y`\n */\nfunction getVelocity(deltaTime, x, y) {\n return {\n x: x / deltaTime || 0,\n y: y / deltaTime || 0\n };\n}\n\n/**\n * get the direction between two points\n * @param {Number} x\n * @param {Number} y\n * @return {Number} direction\n */\nfunction getDirection(x, y) {\n if (x === y) {\n return DIRECTION_NONE;\n }\n\n if (abs(x) >= abs(y)) {\n return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;\n }\n return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;\n}\n\n/**\n * calculate the absolute distance between two points\n * @param {Object} p1 {x, y}\n * @param {Object} p2 {x, y}\n * @param {Array} [props] containing x and y keys\n * @return {Number} distance\n */\nfunction getDistance(p1, p2, props) {\n if (!props) {\n props = PROPS_XY;\n }\n var x = p2[props[0]] - p1[props[0]],\n y = p2[props[1]] - p1[props[1]];\n\n return Math.sqrt((x * x) + (y * y));\n}\n\n/**\n * calculate the angle between two coordinates\n * @param {Object} p1\n * @param {Object} p2\n * @param {Array} [props] containing x and y keys\n * @return {Number} angle\n */\nfunction getAngle(p1, p2, props) {\n if (!props) {\n props = PROPS_XY;\n }\n var x = p2[props[0]] - p1[props[0]],\n y = p2[props[1]] - p1[props[1]];\n return Math.atan2(y, x) * 180 / Math.PI;\n}\n\n/**\n * calculate the rotation degrees between two pointersets\n * @param {Array} start array of pointers\n * @param {Array} end array of pointers\n * @return {Number} rotation\n */\nfunction getRotation(start, end) {\n return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);\n}\n\n/**\n * calculate the scale factor between two pointersets\n * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out\n * @param {Array} start array of pointers\n * @param {Array} end array of pointers\n * @return {Number} scale\n */\nfunction getScale(start, end) {\n return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);\n}\n\nvar MOUSE_INPUT_MAP = {\n mousedown: INPUT_START,\n mousemove: INPUT_MOVE,\n mouseup: INPUT_END\n};\n\nvar MOUSE_ELEMENT_EVENTS = 'mousedown';\nvar MOUSE_WINDOW_EVENTS = 'mousemove mouseup';\n\n/**\n * Mouse events input\n * @constructor\n * @extends Input\n */\nfunction MouseInput() {\n this.evEl = MOUSE_ELEMENT_EVENTS;\n this.evWin = MOUSE_WINDOW_EVENTS;\n\n this.pressed = false; // mousedown state\n\n Input.apply(this, arguments);\n}\n\ninherit(MouseInput, Input, {\n /**\n * handle mouse events\n * @param {Object} ev\n */\n handler: function MEhandler(ev) {\n var eventType = MOUSE_INPUT_MAP[ev.type];\n\n // on start we want to have the left mouse button down\n if (eventType & INPUT_START && ev.button === 0) {\n this.pressed = true;\n }\n\n if (eventType & INPUT_MOVE && ev.which !== 1) {\n eventType = INPUT_END;\n }\n\n // mouse must be down\n if (!this.pressed) {\n return;\n }\n\n if (eventType & INPUT_END) {\n this.pressed = false;\n }\n\n this.callback(this.manager, eventType, {\n pointers: [ev],\n changedPointers: [ev],\n pointerType: INPUT_TYPE_MOUSE,\n srcEvent: ev\n });\n }\n});\n\nvar POINTER_INPUT_MAP = {\n pointerdown: INPUT_START,\n pointermove: INPUT_MOVE,\n pointerup: INPUT_END,\n pointercancel: INPUT_CANCEL,\n pointerout: INPUT_CANCEL\n};\n\n// in IE10 the pointer types is defined as an enum\nvar IE10_POINTER_TYPE_ENUM = {\n 2: INPUT_TYPE_TOUCH,\n 3: INPUT_TYPE_PEN,\n 4: INPUT_TYPE_MOUSE,\n 5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816\n};\n\nvar POINTER_ELEMENT_EVENTS = 'pointerdown';\nvar POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel';\n\n// IE10 has prefixed support, and case-sensitive\nif (window.MSPointerEvent && !window.PointerEvent) {\n POINTER_ELEMENT_EVENTS = 'MSPointerDown';\n POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';\n}\n\n/**\n * Pointer events input\n * @constructor\n * @extends Input\n */\nfunction PointerEventInput() {\n this.evEl = POINTER_ELEMENT_EVENTS;\n this.evWin = POINTER_WINDOW_EVENTS;\n\n Input.apply(this, arguments);\n\n this.store = (this.manager.session.pointerEvents = []);\n}\n\ninherit(PointerEventInput, Input, {\n /**\n * handle mouse events\n * @param {Object} ev\n */\n handler: function PEhandler(ev) {\n var store = this.store;\n var removePointer = false;\n\n var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');\n var eventType = POINTER_INPUT_MAP[eventTypeNormalized];\n var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;\n\n var isTouch = (pointerType == INPUT_TYPE_TOUCH);\n\n // get index of the event in the store\n var storeIndex = inArray(store, ev.pointerId, 'pointerId');\n\n // start and mouse must be down\n if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {\n if (storeIndex < 0) {\n store.push(ev);\n storeIndex = store.length - 1;\n }\n } else if (eventType & (INPUT_END | INPUT_CANCEL)) {\n removePointer = true;\n }\n\n // it not found, so the pointer hasn't been down (so it's probably a hover)\n if (storeIndex < 0) {\n return;\n }\n\n // update the event in the store\n store[storeIndex] = ev;\n\n this.callback(this.manager, eventType, {\n pointers: store,\n changedPointers: [ev],\n pointerType: pointerType,\n srcEvent: ev\n });\n\n if (removePointer) {\n // remove from the store\n store.splice(storeIndex, 1);\n }\n }\n});\n\nvar SINGLE_TOUCH_INPUT_MAP = {\n touchstart: INPUT_START,\n touchmove: INPUT_MOVE,\n touchend: INPUT_END,\n touchcancel: INPUT_CANCEL\n};\n\nvar SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';\nvar SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';\n\n/**\n * Touch events input\n * @constructor\n * @extends Input\n */\nfunction SingleTouchInput() {\n this.evTarget = SINGLE_TOUCH_TARGET_EVENTS;\n this.evWin = SINGLE_TOUCH_WINDOW_EVENTS;\n this.started = false;\n\n Input.apply(this, arguments);\n}\n\ninherit(SingleTouchInput, Input, {\n handler: function TEhandler(ev) {\n var type = SINGLE_TOUCH_INPUT_MAP[ev.type];\n\n // should we handle the touch events?\n if (type === INPUT_START) {\n this.started = true;\n }\n\n if (!this.started) {\n return;\n }\n\n var touches = normalizeSingleTouches.call(this, ev, type);\n\n // when done, reset the started state\n if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {\n this.started = false;\n }\n\n this.callback(this.manager, type, {\n pointers: touches[0],\n changedPointers: touches[1],\n pointerType: INPUT_TYPE_TOUCH,\n srcEvent: ev\n });\n }\n});\n\n/**\n * @this {TouchInput}\n * @param {Object} ev\n * @param {Number} type flag\n * @returns {undefined|Array} [all, changed]\n */\nfunction normalizeSingleTouches(ev, type) {\n var all = toArray(ev.touches);\n var changed = toArray(ev.changedTouches);\n\n if (type & (INPUT_END | INPUT_CANCEL)) {\n all = uniqueArray(all.concat(changed), 'identifier', true);\n }\n\n return [all, changed];\n}\n\nvar TOUCH_INPUT_MAP = {\n touchstart: INPUT_START,\n touchmove: INPUT_MOVE,\n touchend: INPUT_END,\n touchcancel: INPUT_CANCEL\n};\n\nvar TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';\n\n/**\n * Multi-user touch events input\n * @constructor\n * @extends Input\n */\nfunction TouchInput() {\n this.evTarget = TOUCH_TARGET_EVENTS;\n this.targetIds = {};\n\n Input.apply(this, arguments);\n}\n\ninherit(TouchInput, Input, {\n handler: function MTEhandler(ev) {\n var type = TOUCH_INPUT_MAP[ev.type];\n var touches = getTouches.call(this, ev, type);\n if (!touches) {\n return;\n }\n\n this.callback(this.manager, type, {\n pointers: touches[0],\n changedPointers: touches[1],\n pointerType: INPUT_TYPE_TOUCH,\n srcEvent: ev\n });\n }\n});\n\n/**\n * @this {TouchInput}\n * @param {Object} ev\n * @param {Number} type flag\n * @returns {undefined|Array} [all, changed]\n */\nfunction getTouches(ev, type) {\n var allTouches = toArray(ev.touches);\n var targetIds = this.targetIds;\n\n // when there is only one touch, the process can be simplified\n if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {\n targetIds[allTouches[0].identifier] = true;\n return [allTouches, allTouches];\n }\n\n var i,\n targetTouches,\n changedTouches = toArray(ev.changedTouches),\n changedTargetTouches = [],\n target = this.target;\n\n // get target touches from touches\n targetTouches = allTouches.filter(function(touch) {\n return hasParent(touch.target, target);\n });\n\n // collect touches\n if (type === INPUT_START) {\n i = 0;\n while (i < targetTouches.length) {\n targetIds[targetTouches[i].identifier] = true;\n i++;\n }\n }\n\n // filter changed touches to only contain touches that exist in the collected target ids\n i = 0;\n while (i < changedTouches.length) {\n if (targetIds[changedTouches[i].identifier]) {\n changedTargetTouches.push(changedTouches[i]);\n }\n\n // cleanup removed touches\n if (type & (INPUT_END | INPUT_CANCEL)) {\n delete targetIds[changedTouches[i].identifier];\n }\n i++;\n }\n\n if (!changedTargetTouches.length) {\n return;\n }\n\n return [\n // merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'\n uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true),\n changedTargetTouches\n ];\n}\n\n/**\n * Combined touch and mouse input\n *\n * Touch has a higher priority then mouse, and while touching no mouse events are allowed.\n * This because touch devices also emit mouse events while doing a touch.\n *\n * @constructor\n * @extends Input\n */\n\nvar DEDUP_TIMEOUT = 2500;\nvar DEDUP_DISTANCE = 25;\n\nfunction TouchMouseInput() {\n Input.apply(this, arguments);\n\n var handler = bindFn(this.handler, this);\n this.touch = new TouchInput(this.manager, handler);\n this.mouse = new MouseInput(this.manager, handler);\n\n this.primaryTouch = null;\n this.lastTouches = [];\n}\n\ninherit(TouchMouseInput, Input, {\n /**\n * handle mouse and touch events\n * @param {Hammer} manager\n * @param {String} inputEvent\n * @param {Object} inputData\n */\n handler: function TMEhandler(manager, inputEvent, inputData) {\n var isTouch = (inputData.pointerType == INPUT_TYPE_TOUCH),\n isMouse = (inputData.pointerType == INPUT_TYPE_MOUSE);\n\n if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) {\n return;\n }\n\n // when we're in a touch event, record touches to de-dupe synthetic mouse event\n if (isTouch) {\n recordTouches.call(this, inputEvent, inputData);\n } else if (isMouse && isSyntheticEvent.call(this, inputData)) {\n return;\n }\n\n this.callback(manager, inputEvent, inputData);\n },\n\n /**\n * remove the event listeners\n */\n destroy: function destroy() {\n this.touch.destroy();\n this.mouse.destroy();\n }\n});\n\nfunction recordTouches(eventType, eventData) {\n if (eventType & INPUT_START) {\n this.primaryTouch = eventData.changedPointers[0].identifier;\n setLastTouch.call(this, eventData);\n } else if (eventType & (INPUT_END | INPUT_CANCEL)) {\n setLastTouch.call(this, eventData);\n }\n}\n\nfunction setLastTouch(eventData) {\n var touch = eventData.changedPointers[0];\n\n if (touch.identifier === this.primaryTouch) {\n var lastTouch = {x: touch.clientX, y: touch.clientY};\n this.lastTouches.push(lastTouch);\n var lts = this.lastTouches;\n var removeLastTouch = function() {\n var i = lts.indexOf(lastTouch);\n if (i > -1) {\n lts.splice(i, 1);\n }\n };\n setTimeout(removeLastTouch, DEDUP_TIMEOUT);\n }\n}\n\nfunction isSyntheticEvent(eventData) {\n var x = eventData.srcEvent.clientX, y = eventData.srcEvent.clientY;\n for (var i = 0; i < this.lastTouches.length; i++) {\n var t = this.lastTouches[i];\n var dx = Math.abs(x - t.x), dy = Math.abs(y - t.y);\n if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) {\n return true;\n }\n }\n return false;\n}\n\nvar PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');\nvar NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined;\n\n// magical touchAction value\nvar TOUCH_ACTION_COMPUTE = 'compute';\nvar TOUCH_ACTION_AUTO = 'auto';\nvar TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented\nvar TOUCH_ACTION_NONE = 'none';\nvar TOUCH_ACTION_PAN_X = 'pan-x';\nvar TOUCH_ACTION_PAN_Y = 'pan-y';\nvar TOUCH_ACTION_MAP = getTouchActionProps();\n\n/**\n * Touch Action\n * sets the touchAction property or uses the js alternative\n * @param {Manager} manager\n * @param {String} value\n * @constructor\n */\nfunction TouchAction(manager, value) {\n this.manager = manager;\n this.set(value);\n}\n\nTouchAction.prototype = {\n /**\n * set the touchAction value on the element or enable the polyfill\n * @param {String} value\n */\n set: function(value) {\n // find out the touch-action by the event handlers\n if (value == TOUCH_ACTION_COMPUTE) {\n value = this.compute();\n }\n\n if (NATIVE_TOUCH_ACTION && this.manager.element.style && TOUCH_ACTION_MAP[value]) {\n this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;\n }\n this.actions = value.toLowerCase().trim();\n },\n\n /**\n * just re-set the touchAction value\n */\n update: function() {\n this.set(this.manager.options.touchAction);\n },\n\n /**\n * compute the value for the touchAction property based on the recognizer's settings\n * @returns {String} value\n */\n compute: function() {\n var actions = [];\n each(this.manager.recognizers, function(recognizer) {\n if (boolOrFn(recognizer.options.enable, [recognizer])) {\n actions = actions.concat(recognizer.getTouchAction());\n }\n });\n return cleanTouchActions(actions.join(' '));\n },\n\n /**\n * this method is called on each input cycle and provides the preventing of the browser behavior\n * @param {Object} input\n */\n preventDefaults: function(input) {\n var srcEvent = input.srcEvent;\n var direction = input.offsetDirection;\n\n // if the touch action did prevented once this session\n if (this.manager.session.prevented) {\n srcEvent.preventDefault();\n return;\n }\n\n var actions = this.actions;\n var hasNone = inStr(actions, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE];\n var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y];\n var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X];\n\n if (hasNone) {\n //do not prevent defaults if this is a tap gesture\n\n var isTapPointer = input.pointers.length === 1;\n var isTapMovement = input.distance < 2;\n var isTapTouchTime = input.deltaTime < 250;\n\n if (isTapPointer && isTapMovement && isTapTouchTime) {\n return;\n }\n }\n\n if (hasPanX && hasPanY) {\n // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent\n return;\n }\n\n if (hasNone ||\n (hasPanY && direction & DIRECTION_HORIZONTAL) ||\n (hasPanX && direction & DIRECTION_VERTICAL)) {\n return this.preventSrc(srcEvent);\n }\n },\n\n /**\n * call preventDefault to prevent the browser's default behavior (scrolling in most cases)\n * @param {Object} srcEvent\n */\n preventSrc: function(srcEvent) {\n this.manager.session.prevented = true;\n srcEvent.preventDefault();\n }\n};\n\n/**\n * when the touchActions are collected they are not a valid value, so we need to clean things up. *\n * @param {String} actions\n * @returns {*}\n */\nfunction cleanTouchActions(actions) {\n // none\n if (inStr(actions, TOUCH_ACTION_NONE)) {\n return TOUCH_ACTION_NONE;\n }\n\n var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);\n var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);\n\n // if both pan-x and pan-y are set (different recognizers\n // for different directions, e.g. horizontal pan but vertical swipe?)\n // we need none (as otherwise with pan-x pan-y combined none of these\n // recognizers will work, since the browser would handle all panning\n if (hasPanX && hasPanY) {\n return TOUCH_ACTION_NONE;\n }\n\n // pan-x OR pan-y\n if (hasPanX || hasPanY) {\n return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;\n }\n\n // manipulation\n if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {\n return TOUCH_ACTION_MANIPULATION;\n }\n\n return TOUCH_ACTION_AUTO;\n}\n\nfunction getTouchActionProps() {\n if (!NATIVE_TOUCH_ACTION) {\n return false;\n }\n var touchMap = {};\n var cssSupports = window.CSS && window.CSS.supports;\n ['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(function(val) {\n\n // If css.supports is not supported but there is native touch-action assume it supports\n // all values. This is the case for IE 10 and 11.\n touchMap[val] = cssSupports ? window.CSS.supports('touch-action', val) : true;\n });\n return touchMap;\n}\n\n/**\n * Recognizer flow explained; *\n * All recognizers have the initial state of POSSIBLE when a input session starts.\n * The definition of a input session is from the first input until the last input, with all it's movement in it. *\n * Example session for mouse-input: mousedown -> mousemove -> mouseup\n *\n * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed\n * which determines with state it should be.\n *\n * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to\n * POSSIBLE to give it another change on the next cycle.\n *\n * Possible\n * |\n * +-----+---------------+\n * | |\n * +-----+-----+ |\n * | | |\n * Failed Cancelled |\n * +-------+------+\n * | |\n * Recognized Began\n * |\n * Changed\n * |\n * Ended/Recognized\n */\nvar STATE_POSSIBLE = 1;\nvar STATE_BEGAN = 2;\nvar STATE_CHANGED = 4;\nvar STATE_ENDED = 8;\nvar STATE_RECOGNIZED = STATE_ENDED;\nvar STATE_CANCELLED = 16;\nvar STATE_FAILED = 32;\n\n/**\n * Recognizer\n * Every recognizer needs to extend from this class.\n * @constructor\n * @param {Object} options\n */\nfunction Recognizer(options) {\n this.options = assign({}, this.defaults, options || {});\n\n this.id = uniqueId();\n\n this.manager = null;\n\n // default is enable true\n this.options.enable = ifUndefined(this.options.enable, true);\n\n this.state = STATE_POSSIBLE;\n\n this.simultaneous = {};\n this.requireFail = [];\n}\n\nRecognizer.prototype = {\n /**\n * @virtual\n * @type {Object}\n */\n defaults: {},\n\n /**\n * set options\n * @param {Object} options\n * @return {Recognizer}\n */\n set: function(options) {\n assign(this.options, options);\n\n // also update the touchAction, in case something changed about the directions/enabled state\n this.manager && this.manager.touchAction.update();\n return this;\n },\n\n /**\n * recognize simultaneous with an other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n recognizeWith: function(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {\n return this;\n }\n\n var simultaneous = this.simultaneous;\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n if (!simultaneous[otherRecognizer.id]) {\n simultaneous[otherRecognizer.id] = otherRecognizer;\n otherRecognizer.recognizeWith(this);\n }\n return this;\n },\n\n /**\n * drop the simultaneous link. it doesnt remove the link on the other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n dropRecognizeWith: function(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {\n return this;\n }\n\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n delete this.simultaneous[otherRecognizer.id];\n return this;\n },\n\n /**\n * recognizer can only run when an other is failing\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n requireFailure: function(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {\n return this;\n }\n\n var requireFail = this.requireFail;\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n if (inArray(requireFail, otherRecognizer) === -1) {\n requireFail.push(otherRecognizer);\n otherRecognizer.requireFailure(this);\n }\n return this;\n },\n\n /**\n * drop the requireFailure link. it does not remove the link on the other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n dropRequireFailure: function(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {\n return this;\n }\n\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n var index = inArray(this.requireFail, otherRecognizer);\n if (index > -1) {\n this.requireFail.splice(index, 1);\n }\n return this;\n },\n\n /**\n * has require failures boolean\n * @returns {boolean}\n */\n hasRequireFailures: function() {\n return this.requireFail.length > 0;\n },\n\n /**\n * if the recognizer can recognize simultaneous with an other recognizer\n * @param {Recognizer} otherRecognizer\n * @returns {Boolean}\n */\n canRecognizeWith: function(otherRecognizer) {\n return !!this.simultaneous[otherRecognizer.id];\n },\n\n /**\n * You should use `tryEmit` instead of `emit` directly to check\n * that all the needed recognizers has failed before emitting.\n * @param {Object} input\n */\n emit: function(input) {\n var self = this;\n var state = this.state;\n\n function emit(event) {\n self.manager.emit(event, input);\n }\n\n // 'panstart' and 'panmove'\n if (state < STATE_ENDED) {\n emit(self.options.event + stateStr(state));\n }\n\n emit(self.options.event); // simple 'eventName' events\n\n if (input.additionalEvent) { // additional event(panleft, panright, pinchin, pinchout...)\n emit(input.additionalEvent);\n }\n\n // panend and pancancel\n if (state >= STATE_ENDED) {\n emit(self.options.event + stateStr(state));\n }\n },\n\n /**\n * Check that all the require failure recognizers has failed,\n * if true, it emits a gesture event,\n * otherwise, setup the state to FAILED.\n * @param {Object} input\n */\n tryEmit: function(input) {\n if (this.canEmit()) {\n return this.emit(input);\n }\n // it's failing anyway\n this.state = STATE_FAILED;\n },\n\n /**\n * can we emit?\n * @returns {boolean}\n */\n canEmit: function() {\n var i = 0;\n while (i < this.requireFail.length) {\n if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {\n return false;\n }\n i++;\n }\n return true;\n },\n\n /**\n * update the recognizer\n * @param {Object} inputData\n */\n recognize: function(inputData) {\n // make a new copy of the inputData\n // so we can change the inputData without messing up the other recognizers\n var inputDataClone = assign({}, inputData);\n\n // is is enabled and allow recognizing?\n if (!boolOrFn(this.options.enable, [this, inputDataClone])) {\n this.reset();\n this.state = STATE_FAILED;\n return;\n }\n\n // reset when we've reached the end\n if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {\n this.state = STATE_POSSIBLE;\n }\n\n this.state = this.process(inputDataClone);\n\n // the recognizer has recognized a gesture\n // so trigger an event\n if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {\n this.tryEmit(inputDataClone);\n }\n },\n\n /**\n * return the state of the recognizer\n * the actual recognizing happens in this method\n * @virtual\n * @param {Object} inputData\n * @returns {Const} STATE\n */\n process: function(inputData) { }, // jshint ignore:line\n\n /**\n * return the preferred touch-action\n * @virtual\n * @returns {Array}\n */\n getTouchAction: function() { },\n\n /**\n * called when the gesture isn't allowed to recognize\n * like when another is being recognized or it is disabled\n * @virtual\n */\n reset: function() { }\n};\n\n/**\n * get a usable string, used as event postfix\n * @param {Const} state\n * @returns {String} state\n */\nfunction stateStr(state) {\n if (state & STATE_CANCELLED) {\n return 'cancel';\n } else if (state & STATE_ENDED) {\n return 'end';\n } else if (state & STATE_CHANGED) {\n return 'move';\n } else if (state & STATE_BEGAN) {\n return 'start';\n }\n return '';\n}\n\n/**\n * direction cons to string\n * @param {Const} direction\n * @returns {String}\n */\nfunction directionStr(direction) {\n if (direction == DIRECTION_DOWN) {\n return 'down';\n } else if (direction == DIRECTION_UP) {\n return 'up';\n } else if (direction == DIRECTION_LEFT) {\n return 'left';\n } else if (direction == DIRECTION_RIGHT) {\n return 'right';\n }\n return '';\n}\n\n/**\n * get a recognizer by name if it is bound to a manager\n * @param {Recognizer|String} otherRecognizer\n * @param {Recognizer} recognizer\n * @returns {Recognizer}\n */\nfunction getRecognizerByNameIfManager(otherRecognizer, recognizer) {\n var manager = recognizer.manager;\n if (manager) {\n return manager.get(otherRecognizer);\n }\n return otherRecognizer;\n}\n\n/**\n * This recognizer is just used as a base for the simple attribute recognizers.\n * @constructor\n * @extends Recognizer\n */\nfunction AttrRecognizer() {\n Recognizer.apply(this, arguments);\n}\n\ninherit(AttrRecognizer, Recognizer, {\n /**\n * @namespace\n * @memberof AttrRecognizer\n */\n defaults: {\n /**\n * @type {Number}\n * @default 1\n */\n pointers: 1\n },\n\n /**\n * Used to check if it the recognizer receives valid input, like input.distance > 10.\n * @memberof AttrRecognizer\n * @param {Object} input\n * @returns {Boolean} recognized\n */\n attrTest: function(input) {\n var optionPointers = this.options.pointers;\n return optionPointers === 0 || input.pointers.length === optionPointers;\n },\n\n /**\n * Process the input and return the state for the recognizer\n * @memberof AttrRecognizer\n * @param {Object} input\n * @returns {*} State\n */\n process: function(input) {\n var state = this.state;\n var eventType = input.eventType;\n\n var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);\n var isValid = this.attrTest(input);\n\n // on cancel input and we've recognized before, return STATE_CANCELLED\n if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {\n return state | STATE_CANCELLED;\n } else if (isRecognized || isValid) {\n if (eventType & INPUT_END) {\n return state | STATE_ENDED;\n } else if (!(state & STATE_BEGAN)) {\n return STATE_BEGAN;\n }\n return state | STATE_CHANGED;\n }\n return STATE_FAILED;\n }\n});\n\n/**\n * Pan\n * Recognized when the pointer is down and moved in the allowed direction.\n * @constructor\n * @extends AttrRecognizer\n */\nfunction PanRecognizer() {\n AttrRecognizer.apply(this, arguments);\n\n this.pX = null;\n this.pY = null;\n}\n\ninherit(PanRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof PanRecognizer\n */\n defaults: {\n event: 'pan',\n threshold: 10,\n pointers: 1,\n direction: DIRECTION_ALL\n },\n\n getTouchAction: function() {\n var direction = this.options.direction;\n var actions = [];\n if (direction & DIRECTION_HORIZONTAL) {\n actions.push(TOUCH_ACTION_PAN_Y);\n }\n if (direction & DIRECTION_VERTICAL) {\n actions.push(TOUCH_ACTION_PAN_X);\n }\n return actions;\n },\n\n directionTest: function(input) {\n var options = this.options;\n var hasMoved = true;\n var distance = input.distance;\n var direction = input.direction;\n var x = input.deltaX;\n var y = input.deltaY;\n\n // lock to axis?\n if (!(direction & options.direction)) {\n if (options.direction & DIRECTION_HORIZONTAL) {\n direction = (x === 0) ? DIRECTION_NONE : (x < 0) ? DIRECTION_LEFT : DIRECTION_RIGHT;\n hasMoved = x != this.pX;\n distance = Math.abs(input.deltaX);\n } else {\n direction = (y === 0) ? DIRECTION_NONE : (y < 0) ? DIRECTION_UP : DIRECTION_DOWN;\n hasMoved = y != this.pY;\n distance = Math.abs(input.deltaY);\n }\n }\n input.direction = direction;\n return hasMoved && distance > options.threshold && direction & options.direction;\n },\n\n attrTest: function(input) {\n return AttrRecognizer.prototype.attrTest.call(this, input) &&\n (this.state & STATE_BEGAN || (!(this.state & STATE_BEGAN) && this.directionTest(input)));\n },\n\n emit: function(input) {\n\n this.pX = input.deltaX;\n this.pY = input.deltaY;\n\n var direction = directionStr(input.direction);\n\n if (direction) {\n input.additionalEvent = this.options.event + direction;\n }\n this._super.emit.call(this, input);\n }\n});\n\n/**\n * Pinch\n * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out).\n * @constructor\n * @extends AttrRecognizer\n */\nfunction PinchRecognizer() {\n AttrRecognizer.apply(this, arguments);\n}\n\ninherit(PinchRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof PinchRecognizer\n */\n defaults: {\n event: 'pinch',\n threshold: 0,\n pointers: 2\n },\n\n getTouchAction: function() {\n return [TOUCH_ACTION_NONE];\n },\n\n attrTest: function(input) {\n return this._super.attrTest.call(this, input) &&\n (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);\n },\n\n emit: function(input) {\n if (input.scale !== 1) {\n var inOut = input.scale < 1 ? 'in' : 'out';\n input.additionalEvent = this.options.event + inOut;\n }\n this._super.emit.call(this, input);\n }\n});\n\n/**\n * Press\n * Recognized when the pointer is down for x ms without any movement.\n * @constructor\n * @extends Recognizer\n */\nfunction PressRecognizer() {\n Recognizer.apply(this, arguments);\n\n this._timer = null;\n this._input = null;\n}\n\ninherit(PressRecognizer, Recognizer, {\n /**\n * @namespace\n * @memberof PressRecognizer\n */\n defaults: {\n event: 'press',\n pointers: 1,\n time: 251, // minimal time of the pointer to be pressed\n threshold: 9 // a minimal movement is ok, but keep it low\n },\n\n getTouchAction: function() {\n return [TOUCH_ACTION_AUTO];\n },\n\n process: function(input) {\n var options = this.options;\n var validPointers = input.pointers.length === options.pointers;\n var validMovement = input.distance < options.threshold;\n var validTime = input.deltaTime > options.time;\n\n this._input = input;\n\n // we only allow little movement\n // and we've reached an end event, so a tap is possible\n if (!validMovement || !validPointers || (input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime)) {\n this.reset();\n } else if (input.eventType & INPUT_START) {\n this.reset();\n this._timer = setTimeoutContext(function() {\n this.state = STATE_RECOGNIZED;\n this.tryEmit();\n }, options.time, this);\n } else if (input.eventType & INPUT_END) {\n return STATE_RECOGNIZED;\n }\n return STATE_FAILED;\n },\n\n reset: function() {\n clearTimeout(this._timer);\n },\n\n emit: function(input) {\n if (this.state !== STATE_RECOGNIZED) {\n return;\n }\n\n if (input && (input.eventType & INPUT_END)) {\n this.manager.emit(this.options.event + 'up', input);\n } else {\n this._input.timeStamp = now();\n this.manager.emit(this.options.event, this._input);\n }\n }\n});\n\n/**\n * Rotate\n * Recognized when two or more pointer are moving in a circular motion.\n * @constructor\n * @extends AttrRecognizer\n */\nfunction RotateRecognizer() {\n AttrRecognizer.apply(this, arguments);\n}\n\ninherit(RotateRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof RotateRecognizer\n */\n defaults: {\n event: 'rotate',\n threshold: 0,\n pointers: 2\n },\n\n getTouchAction: function() {\n return [TOUCH_ACTION_NONE];\n },\n\n attrTest: function(input) {\n return this._super.attrTest.call(this, input) &&\n (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);\n }\n});\n\n/**\n * Swipe\n * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.\n * @constructor\n * @extends AttrRecognizer\n */\nfunction SwipeRecognizer() {\n AttrRecognizer.apply(this, arguments);\n}\n\ninherit(SwipeRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof SwipeRecognizer\n */\n defaults: {\n event: 'swipe',\n threshold: 10,\n velocity: 0.3,\n direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,\n pointers: 1\n },\n\n getTouchAction: function() {\n return PanRecognizer.prototype.getTouchAction.call(this);\n },\n\n attrTest: function(input) {\n var direction = this.options.direction;\n var velocity;\n\n if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {\n velocity = input.overallVelocity;\n } else if (direction & DIRECTION_HORIZONTAL) {\n velocity = input.overallVelocityX;\n } else if (direction & DIRECTION_VERTICAL) {\n velocity = input.overallVelocityY;\n }\n\n return this._super.attrTest.call(this, input) &&\n direction & input.offsetDirection &&\n input.distance > this.options.threshold &&\n input.maxPointers == this.options.pointers &&\n abs(velocity) > this.options.velocity && input.eventType & INPUT_END;\n },\n\n emit: function(input) {\n var direction = directionStr(input.offsetDirection);\n if (direction) {\n this.manager.emit(this.options.event + direction, input);\n }\n\n this.manager.emit(this.options.event, input);\n }\n});\n\n/**\n * A tap is ecognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur\n * between the given interval and position. The delay option can be used to recognize multi-taps without firing\n * a single tap.\n *\n * The eventData from the emitted event contains the property `tapCount`, which contains the amount of\n * multi-taps being recognized.\n * @constructor\n * @extends Recognizer\n */\nfunction TapRecognizer() {\n Recognizer.apply(this, arguments);\n\n // previous time and center,\n // used for tap counting\n this.pTime = false;\n this.pCenter = false;\n\n this._timer = null;\n this._input = null;\n this.count = 0;\n}\n\ninherit(TapRecognizer, Recognizer, {\n /**\n * @namespace\n * @memberof PinchRecognizer\n */\n defaults: {\n event: 'tap',\n pointers: 1,\n taps: 1,\n interval: 300, // max time between the multi-tap taps\n time: 250, // max time of the pointer to be down (like finger on the screen)\n threshold: 9, // a minimal movement is ok, but keep it low\n posThreshold: 10 // a multi-tap can be a bit off the initial position\n },\n\n getTouchAction: function() {\n return [TOUCH_ACTION_MANIPULATION];\n },\n\n process: function(input) {\n var options = this.options;\n\n var validPointers = input.pointers.length === options.pointers;\n var validMovement = input.distance < options.threshold;\n var validTouchTime = input.deltaTime < options.time;\n\n this.reset();\n\n if ((input.eventType & INPUT_START) && (this.count === 0)) {\n return this.failTimeout();\n }\n\n // we only allow little movement\n // and we've reached an end event, so a tap is possible\n if (validMovement && validTouchTime && validPointers) {\n if (input.eventType != INPUT_END) {\n return this.failTimeout();\n }\n\n var validInterval = this.pTime ? (input.timeStamp - this.pTime < options.interval) : true;\n var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;\n\n this.pTime = input.timeStamp;\n this.pCenter = input.center;\n\n if (!validMultiTap || !validInterval) {\n this.count = 1;\n } else {\n this.count += 1;\n }\n\n this._input = input;\n\n // if tap count matches we have recognized it,\n // else it has began recognizing...\n var tapCount = this.count % options.taps;\n if (tapCount === 0) {\n // no failing requirements, immediately trigger the tap event\n // or wait as long as the multitap interval to trigger\n if (!this.hasRequireFailures()) {\n return STATE_RECOGNIZED;\n } else {\n this._timer = setTimeoutContext(function() {\n this.state = STATE_RECOGNIZED;\n this.tryEmit();\n }, options.interval, this);\n return STATE_BEGAN;\n }\n }\n }\n return STATE_FAILED;\n },\n\n failTimeout: function() {\n this._timer = setTimeoutContext(function() {\n this.state = STATE_FAILED;\n }, this.options.interval, this);\n return STATE_FAILED;\n },\n\n reset: function() {\n clearTimeout(this._timer);\n },\n\n emit: function() {\n if (this.state == STATE_RECOGNIZED) {\n this._input.tapCount = this.count;\n this.manager.emit(this.options.event, this._input);\n }\n }\n});\n\n/**\n * Simple way to create a manager with a default set of recognizers.\n * @param {HTMLElement} element\n * @param {Object} [options]\n * @constructor\n */\nfunction Hammer(element, options) {\n options = options || {};\n options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset);\n return new Manager(element, options);\n}\n\n/**\n * @const {string}\n */\nHammer.VERSION = '2.0.7';\n\n/**\n * default settings\n * @namespace\n */\nHammer.defaults = {\n /**\n * set if DOM events are being triggered.\n * But this is slower and unused by simple implementations, so disabled by default.\n * @type {Boolean}\n * @default false\n */\n domEvents: false,\n\n /**\n * The value for the touchAction property/fallback.\n * When set to `compute` it will magically set the correct value based on the added recognizers.\n * @type {String}\n * @default compute\n */\n touchAction: TOUCH_ACTION_COMPUTE,\n\n /**\n * @type {Boolean}\n * @default true\n */\n enable: true,\n\n /**\n * EXPERIMENTAL FEATURE -- can be removed/changed\n * Change the parent input target element.\n * If Null, then it is being set the to main element.\n * @type {Null|EventTarget}\n * @default null\n */\n inputTarget: null,\n\n /**\n * force an input class\n * @type {Null|Function}\n * @default null\n */\n inputClass: null,\n\n /**\n * Default recognizer setup when calling `Hammer()`\n * When creating a new Manager these will be skipped.\n * @type {Array}\n */\n preset: [\n // RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...]\n [RotateRecognizer, {enable: false}],\n [PinchRecognizer, {enable: false}, ['rotate']],\n [SwipeRecognizer, {direction: DIRECTION_HORIZONTAL}],\n [PanRecognizer, {direction: DIRECTION_HORIZONTAL}, ['swipe']],\n [TapRecognizer],\n [TapRecognizer, {event: 'doubletap', taps: 2}, ['tap']],\n [PressRecognizer]\n ],\n\n /**\n * Some CSS properties can be used to improve the working of Hammer.\n * Add them to this method and they will be set when creating a new Manager.\n * @namespace\n */\n cssProps: {\n /**\n * Disables text selection to improve the dragging gesture. Mainly for desktop browsers.\n * @type {String}\n * @default 'none'\n */\n userSelect: 'none',\n\n /**\n * Disable the Windows Phone grippers when pressing an element.\n * @type {String}\n * @default 'none'\n */\n touchSelect: 'none',\n\n /**\n * Disables the default callout shown when you touch and hold a touch target.\n * On iOS, when you touch and hold a touch target such as a link, Safari displays\n * a callout containing information about the link. This property allows you to disable that callout.\n * @type {String}\n * @default 'none'\n */\n touchCallout: 'none',\n\n /**\n * Specifies whether zooming is enabled. Used by IE10>\n * @type {String}\n * @default 'none'\n */\n contentZooming: 'none',\n\n /**\n * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.\n * @type {String}\n * @default 'none'\n */\n userDrag: 'none',\n\n /**\n * Overrides the highlight color shown when the user taps a link or a JavaScript\n * clickable element in iOS. This property obeys the alpha value, if specified.\n * @type {String}\n * @default 'rgba(0,0,0,0)'\n */\n tapHighlightColor: 'rgba(0,0,0,0)'\n }\n};\n\nvar STOP = 1;\nvar FORCED_STOP = 2;\n\n/**\n * Manager\n * @param {HTMLElement} element\n * @param {Object} [options]\n * @constructor\n */\nfunction Manager(element, options) {\n this.options = assign({}, Hammer.defaults, options || {});\n\n this.options.inputTarget = this.options.inputTarget || element;\n\n this.handlers = {};\n this.session = {};\n this.recognizers = [];\n this.oldCssProps = {};\n\n this.element = element;\n this.input = createInputInstance(this);\n this.touchAction = new TouchAction(this, this.options.touchAction);\n\n toggleCssProps(this, true);\n\n each(this.options.recognizers, function(item) {\n var recognizer = this.add(new (item[0])(item[1]));\n item[2] && recognizer.recognizeWith(item[2]);\n item[3] && recognizer.requireFailure(item[3]);\n }, this);\n}\n\nManager.prototype = {\n /**\n * set options\n * @param {Object} options\n * @returns {Manager}\n */\n set: function(options) {\n assign(this.options, options);\n\n // Options that need a little more setup\n if (options.touchAction) {\n this.touchAction.update();\n }\n if (options.inputTarget) {\n // Clean up existing event listeners and reinitialize\n this.input.destroy();\n this.input.target = options.inputTarget;\n this.input.init();\n }\n return this;\n },\n\n /**\n * stop recognizing for this session.\n * This session will be discarded, when a new [input]start event is fired.\n * When forced, the recognizer cycle is stopped immediately.\n * @param {Boolean} [force]\n */\n stop: function(force) {\n this.session.stopped = force ? FORCED_STOP : STOP;\n },\n\n /**\n * run the recognizers!\n * called by the inputHandler function on every movement of the pointers (touches)\n * it walks through all the recognizers and tries to detect the gesture that is being made\n * @param {Object} inputData\n */\n recognize: function(inputData) {\n var session = this.session;\n if (session.stopped) {\n return;\n }\n\n // run the touch-action polyfill\n this.touchAction.preventDefaults(inputData);\n\n var recognizer;\n var recognizers = this.recognizers;\n\n // this holds the recognizer that is being recognized.\n // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED\n // if no recognizer is detecting a thing, it is set to `null`\n var curRecognizer = session.curRecognizer;\n\n // reset when the last recognizer is recognized\n // or when we're in a new session\n if (!curRecognizer || (curRecognizer && curRecognizer.state & STATE_RECOGNIZED)) {\n curRecognizer = session.curRecognizer = null;\n }\n\n var i = 0;\n while (i < recognizers.length) {\n recognizer = recognizers[i];\n\n // find out if we are allowed try to recognize the input for this one.\n // 1. allow if the session is NOT forced stopped (see the .stop() method)\n // 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one\n // that is being recognized.\n // 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer.\n // this can be setup with the `recognizeWith()` method on the recognizer.\n if (session.stopped !== FORCED_STOP && ( // 1\n !curRecognizer || recognizer == curRecognizer || // 2\n recognizer.canRecognizeWith(curRecognizer))) { // 3\n recognizer.recognize(inputData);\n } else {\n recognizer.reset();\n }\n\n // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the\n // current active recognizer. but only if we don't already have an active recognizer\n if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {\n curRecognizer = session.curRecognizer = recognizer;\n }\n i++;\n }\n },\n\n /**\n * get a recognizer by its event name.\n * @param {Recognizer|String} recognizer\n * @returns {Recognizer|Null}\n */\n get: function(recognizer) {\n if (recognizer instanceof Recognizer) {\n return recognizer;\n }\n\n var recognizers = this.recognizers;\n for (var i = 0; i < recognizers.length; i++) {\n if (recognizers[i].options.event == recognizer) {\n return recognizers[i];\n }\n }\n return null;\n },\n\n /**\n * add a recognizer to the manager\n * existing recognizers with the same event name will be removed\n * @param {Recognizer} recognizer\n * @returns {Recognizer|Manager}\n */\n add: function(recognizer) {\n if (invokeArrayArg(recognizer, 'add', this)) {\n return this;\n }\n\n // remove existing\n var existing = this.get(recognizer.options.event);\n if (existing) {\n this.remove(existing);\n }\n\n this.recognizers.push(recognizer);\n recognizer.manager = this;\n\n this.touchAction.update();\n return recognizer;\n },\n\n /**\n * remove a recognizer by name or instance\n * @param {Recognizer|String} recognizer\n * @returns {Manager}\n */\n remove: function(recognizer) {\n if (invokeArrayArg(recognizer, 'remove', this)) {\n return this;\n }\n\n recognizer = this.get(recognizer);\n\n // let's make sure this recognizer exists\n if (recognizer) {\n var recognizers = this.recognizers;\n var index = inArray(recognizers, recognizer);\n\n if (index !== -1) {\n recognizers.splice(index, 1);\n this.touchAction.update();\n }\n }\n\n return this;\n },\n\n /**\n * bind event\n * @param {String} events\n * @param {Function} handler\n * @returns {EventEmitter} this\n */\n on: function(events, handler) {\n if (events === undefined) {\n return;\n }\n if (handler === undefined) {\n return;\n }\n\n var handlers = this.handlers;\n each(splitStr(events), function(event) {\n handlers[event] = handlers[event] || [];\n handlers[event].push(handler);\n });\n return this;\n },\n\n /**\n * unbind event, leave emit blank to remove all handlers\n * @param {String} events\n * @param {Function} [handler]\n * @returns {EventEmitter} this\n */\n off: function(events, handler) {\n if (events === undefined) {\n return;\n }\n\n var handlers = this.handlers;\n each(splitStr(events), function(event) {\n if (!handler) {\n delete handlers[event];\n } else {\n handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);\n }\n });\n return this;\n },\n\n /**\n * emit event to the listeners\n * @param {String} event\n * @param {Object} data\n */\n emit: function(event, data) {\n // we also want to trigger dom events\n if (this.options.domEvents) {\n triggerDomEvent(event, data);\n }\n\n // no handlers, so skip it all\n var handlers = this.handlers[event] && this.handlers[event].slice();\n if (!handlers || !handlers.length) {\n return;\n }\n\n data.type = event;\n data.preventDefault = function() {\n data.srcEvent.preventDefault();\n };\n\n var i = 0;\n while (i < handlers.length) {\n handlers[i](data);\n i++;\n }\n },\n\n /**\n * destroy the manager and unbinds all events\n * it doesn't unbind dom events, that is the user own responsibility\n */\n destroy: function() {\n this.element && toggleCssProps(this, false);\n\n this.handlers = {};\n this.session = {};\n this.input.destroy();\n this.element = null;\n }\n};\n\n/**\n * add/remove the css properties as defined in manager.options.cssProps\n * @param {Manager} manager\n * @param {Boolean} add\n */\nfunction toggleCssProps(manager, add) {\n var element = manager.element;\n if (!element.style) {\n return;\n }\n var prop;\n each(manager.options.cssProps, function(value, name) {\n prop = prefixed(element.style, name);\n if (add) {\n manager.oldCssProps[prop] = element.style[prop];\n element.style[prop] = value;\n } else {\n element.style[prop] = manager.oldCssProps[prop] || '';\n }\n });\n if (!add) {\n manager.oldCssProps = {};\n }\n}\n\n/**\n * trigger dom event\n * @param {String} event\n * @param {Object} data\n */\nfunction triggerDomEvent(event, data) {\n var gestureEvent = document.createEvent('Event');\n gestureEvent.initEvent(event, true, true);\n gestureEvent.gesture = data;\n data.target.dispatchEvent(gestureEvent);\n}\n\nassign(Hammer, {\n INPUT_START: INPUT_START,\n INPUT_MOVE: INPUT_MOVE,\n INPUT_END: INPUT_END,\n INPUT_CANCEL: INPUT_CANCEL,\n\n STATE_POSSIBLE: STATE_POSSIBLE,\n STATE_BEGAN: STATE_BEGAN,\n STATE_CHANGED: STATE_CHANGED,\n STATE_ENDED: STATE_ENDED,\n STATE_RECOGNIZED: STATE_RECOGNIZED,\n STATE_CANCELLED: STATE_CANCELLED,\n STATE_FAILED: STATE_FAILED,\n\n DIRECTION_NONE: DIRECTION_NONE,\n DIRECTION_LEFT: DIRECTION_LEFT,\n DIRECTION_RIGHT: DIRECTION_RIGHT,\n DIRECTION_UP: DIRECTION_UP,\n DIRECTION_DOWN: DIRECTION_DOWN,\n DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL,\n DIRECTION_VERTICAL: DIRECTION_VERTICAL,\n DIRECTION_ALL: DIRECTION_ALL,\n\n Manager: Manager,\n Input: Input,\n TouchAction: TouchAction,\n\n TouchInput: TouchInput,\n MouseInput: MouseInput,\n PointerEventInput: PointerEventInput,\n TouchMouseInput: TouchMouseInput,\n SingleTouchInput: SingleTouchInput,\n\n Recognizer: Recognizer,\n AttrRecognizer: AttrRecognizer,\n Tap: TapRecognizer,\n Pan: PanRecognizer,\n Swipe: SwipeRecognizer,\n Pinch: PinchRecognizer,\n Rotate: RotateRecognizer,\n Press: PressRecognizer,\n\n on: addEventListeners,\n off: removeEventListeners,\n each: each,\n merge: merge,\n extend: extend,\n assign: assign,\n inherit: inherit,\n bindFn: bindFn,\n prefixed: prefixed\n});\n\n// this prevents errors when Hammer is loaded in the presence of an AMD\n// style loader but by script tag, not by the loader.\nvar freeGlobal = (typeof window !== 'undefined' ? window : (typeof self !== 'undefined' ? self : {})); // jshint ignore:line\nfreeGlobal.Hammer = Hammer;\n\nif (typeof define === 'function' && define.amd) {\n define(function() {\n return Hammer;\n });\n} else if (typeof module != 'undefined' && module.exports) {\n module.exports = Hammer;\n} else {\n window[exportName] = Hammer;\n}\n\n})(window, document, 'Hammer');\n","var hat = module.exports = function (bits, base) {\n if (!base) base = 16;\n if (bits === undefined) bits = 128;\n if (bits <= 0) return '0';\n \n var digits = Math.log(Math.pow(2, bits)) / Math.log(base);\n for (var i = 2; digits === Infinity; i *= 2) {\n digits = Math.log(Math.pow(2, bits / i)) / Math.log(base) * i;\n }\n \n var rem = digits - Math.floor(digits);\n \n var res = '';\n \n for (var i = 0; i < Math.floor(digits); i++) {\n var x = Math.floor(Math.random() * base).toString(base);\n res = x + res;\n }\n \n if (rem) {\n var b = Math.pow(base, rem);\n var x = Math.floor(Math.random() * b).toString(base);\n res = x + res;\n }\n \n var parsed = parseInt(res, base);\n if (parsed !== Infinity && parsed >= Math.pow(2, bits)) {\n return hat(bits, base)\n }\n else return res;\n};\n\nhat.rack = function (bits, base, expandBy) {\n var fn = function (data) {\n var iters = 0;\n do {\n if (iters ++ > 10) {\n if (expandBy) bits += expandBy;\n else throw new Error('too many ID collisions, use more bits')\n }\n \n var id = hat(bits, base);\n } while (Object.hasOwnProperty.call(hats, id));\n \n hats[id] = data;\n return id;\n };\n var hats = fn.hats = {};\n \n fn.get = function (id) {\n return fn.hats[id];\n };\n \n fn.set = function (id, value) {\n fn.hats[id] = value;\n return fn;\n };\n \n fn.bits = bits || 128;\n fn.base = base || 16;\n return fn;\n};\n","'use strict';\n\nvar hat = require(287);\n\n\n/**\n * Create a new id generator / cache instance.\n *\n * You may optionally provide a seed that is used internally.\n *\n * @param {Seed} seed\n */\nfunction Ids(seed) {\n\n if (!(this instanceof Ids)) {\n return new Ids(seed);\n }\n\n seed = seed || [ 128, 36, 1 ];\n this._seed = seed.length ? hat.rack(seed[0], seed[1], seed[2]) : seed;\n}\n\nmodule.exports = Ids;\n\n/**\n * Generate a next id.\n *\n * @param {Object} [element] element to bind the id to\n *\n * @return {String} id\n */\nIds.prototype.next = function(element) {\n return this._seed(element || true);\n};\n\n/**\n * Generate a next id with a given prefix.\n *\n * @param {Object} [element] element to bind the id to\n *\n * @return {String} id\n */\nIds.prototype.nextPrefixed = function(prefix, element) {\n var id;\n\n do {\n id = prefix + this.next(true);\n } while (this.assigned(id));\n\n // claim {prefix}{random}\n this.claim(id, element);\n\n // return\n return id;\n};\n\n/**\n * Manually claim an existing id.\n *\n * @param {String} id\n * @param {String} [element] element the id is claimed by\n */\nIds.prototype.claim = function(id, element) {\n this._seed.set(id, element || true);\n};\n\n/**\n * Returns true if the given id has already been assigned.\n *\n * @param {String} id\n * @return {Boolean}\n */\nIds.prototype.assigned = function(id) {\n return this._seed.get(id) || false;\n};\n\n/**\n * Unclaim an id.\n *\n * @param {String} id the id to unclaim\n */\nIds.prototype.unclaim = function(id) {\n delete this._seed.hats[id];\n};\n\n\n/**\n * Clear all claimed ids.\n */\nIds.prototype.clear = function() {\n\n var hats = this._seed.hats,\n id;\n\n for (id in hats) {\n this.unclaim(id);\n }\n};","if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n}\n","var createFindIndex = require(381);\n\n/**\n * This method is like `_.find` except that it returns the index of the first\n * element `predicate` returns truthy for instead of the element itself.\n *\n * If a property name is provided for `predicate` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `predicate` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to search.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {number} Returns the index of the found element, else `-1`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': false },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': true }\n * ];\n *\n * _.findIndex(users, function(chr) {\n * return chr.user == 'barney';\n * });\n * // => 0\n *\n * // using the `_.matches` callback shorthand\n * _.findIndex(users, { 'user': 'fred', 'active': false });\n * // => 1\n *\n * // using the `_.matchesProperty` callback shorthand\n * _.findIndex(users, 'active', false);\n * // => 0\n *\n * // using the `_.property` callback shorthand\n * _.findIndex(users, 'active');\n * // => 2\n */\nvar findIndex = createFindIndex();\n\nmodule.exports = findIndex;\n","var baseFlatten = require(341),\n isIterateeCall = require(401);\n\n/**\n * Flattens a nested array. If `isDeep` is `true` the array is recursively\n * flattened, otherwise it's only flattened a single level.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to flatten.\n * @param {boolean} [isDeep] Specify a deep flatten.\n * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * _.flatten([1, [2, 3, [4]]]);\n * // => [1, 2, 3, [4]]\n *\n * // using `isDeep`\n * _.flatten([1, [2, 3, [4]]], true);\n * // => [1, 2, 3, 4]\n */\nfunction flatten(array, isDeep, guard) {\n var length = array ? array.length : 0;\n if (guard && isIterateeCall(array, isDeep, guard)) {\n isDeep = false;\n }\n return length ? baseFlatten(array, isDeep) : [];\n}\n\nmodule.exports = flatten;\n","var baseIndexOf = require(346),\n cacheIndexOf = require(368),\n createCache = require(378),\n isArrayLike = require(399),\n restParam = require(315);\n\n/**\n * Creates an array of unique values that are included in all of the provided\n * arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @returns {Array} Returns the new array of shared values.\n * @example\n * _.intersection([1, 2], [4, 2], [2, 1]);\n * // => [2]\n */\nvar intersection = restParam(function(arrays) {\n var othLength = arrays.length,\n othIndex = othLength,\n caches = Array(length),\n indexOf = baseIndexOf,\n isCommon = true,\n result = [];\n\n while (othIndex--) {\n var value = arrays[othIndex] = isArrayLike(value = arrays[othIndex]) ? value : [];\n caches[othIndex] = (isCommon && value.length >= 120) ? createCache(othIndex && value) : null;\n }\n var array = arrays[0],\n index = -1,\n length = array ? array.length : 0,\n seen = caches[0];\n\n outer:\n while (++index < length) {\n value = array[index];\n if ((seen ? cacheIndexOf(seen, value) : indexOf(result, value, 0)) < 0) {\n var othIndex = othLength;\n while (--othIndex) {\n var cache = caches[othIndex];\n if ((cache ? cacheIndexOf(cache, value) : indexOf(arrays[othIndex], value, 0)) < 0) {\n continue outer;\n }\n }\n if (seen) {\n seen.push(value);\n }\n result.push(value);\n }\n }\n return result;\n});\n\nmodule.exports = intersection;\n","/**\n * Gets the last element of `array`.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to query.\n * @returns {*} Returns the last element of `array`.\n * @example\n *\n * _.last([1, 2, 3]);\n * // => 3\n */\nfunction last(array) {\n var length = array ? array.length : 0;\n return length ? array[length - 1] : undefined;\n}\n\nmodule.exports = last;\n","var baseFlatten = require(341),\n baseUniq = require(364),\n restParam = require(315);\n\n/**\n * Creates an array of unique values, in order, from all of the provided arrays\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @returns {Array} Returns the new array of combined values.\n * @example\n *\n * _.union([1, 2], [4, 2], [2, 1]);\n * // => [1, 2, 4]\n */\nvar union = restParam(function(arrays) {\n return baseUniq(baseFlatten(arrays, false, true));\n});\n\nmodule.exports = union;\n","var baseCallback = require(329),\n baseUniq = require(364),\n isIterateeCall = require(401),\n sortedUniq = require(416);\n\n/**\n * Creates a duplicate-free version of an array, using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n * for equality comparisons, in which only the first occurence of each element\n * is kept. Providing `true` for `isSorted` performs a faster search algorithm\n * for sorted arrays. If an iteratee function is provided it's invoked for\n * each element in the array to generate the criterion by which uniqueness\n * is computed. The `iteratee` is bound to `thisArg` and invoked with three\n * arguments: (value, index, array).\n *\n * If a property name is provided for `iteratee` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `iteratee` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @alias unique\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {boolean} [isSorted] Specify the array is sorted.\n * @param {Function|Object|string} [iteratee] The function invoked per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Array} Returns the new duplicate-value-free array.\n * @example\n *\n * _.uniq([2, 1, 2]);\n * // => [2, 1]\n *\n * // using `isSorted`\n * _.uniq([1, 1, 2], true);\n * // => [1, 2]\n *\n * // using an iteratee function\n * _.uniq([1, 2.5, 1.5, 2], function(n) {\n * return this.floor(n);\n * }, Math);\n * // => [1, 2.5]\n *\n * // using the `_.property` callback shorthand\n * _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');\n * // => [{ 'x': 1 }, { 'x': 2 }]\n */\nfunction uniq(array, isSorted, iteratee, thisArg) {\n var length = array ? array.length : 0;\n if (!length) {\n return [];\n }\n if (isSorted != null && typeof isSorted != 'boolean') {\n thisArg = iteratee;\n iteratee = isIterateeCall(array, isSorted, thisArg) ? undefined : isSorted;\n isSorted = false;\n }\n iteratee = iteratee == null ? iteratee : baseCallback(iteratee, thisArg, 3);\n return (isSorted)\n ? sortedUniq(array, iteratee)\n : baseUniq(array, iteratee);\n}\n\nmodule.exports = uniq;\n","module.exports = require(295);\n","var baseDifference = require(335),\n isArrayLike = require(399),\n restParam = require(315);\n\n/**\n * Creates an array excluding all provided values using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to filter.\n * @param {...*} [values] The values to exclude.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * _.without([1, 2, 1, 3], 1, 2);\n * // => [3]\n */\nvar without = restParam(function(array, values) {\n return isArrayLike(array)\n ? baseDifference(array, values)\n : [];\n});\n\nmodule.exports = without;\n","var LazyWrapper = require(316),\n LodashWrapper = require(317),\n baseLodash = require(350),\n isArray = require(422),\n isObjectLike = require(405),\n wrapperClone = require(419);\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Creates a `lodash` object which wraps `value` to enable implicit chaining.\n * Methods that operate on and return arrays, collections, and functions can\n * be chained together. Methods that retrieve a single value or may return a\n * primitive value will automatically end the chain returning the unwrapped\n * value. Explicit chaining may be enabled using `_.chain`. The execution of\n * chained methods is lazy, that is, execution is deferred until `_#value`\n * is implicitly or explicitly called.\n *\n * Lazy evaluation allows several methods to support shortcut fusion. Shortcut\n * fusion is an optimization strategy which merge iteratee calls; this can help\n * to avoid the creation of intermediate data structures and greatly reduce the\n * number of iteratee executions.\n *\n * Chaining is supported in custom builds as long as the `_#value` method is\n * directly or indirectly included in the build.\n *\n * In addition to lodash methods, wrappers have `Array` and `String` methods.\n *\n * The wrapper `Array` methods are:\n * `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`,\n * `splice`, and `unshift`\n *\n * The wrapper `String` methods are:\n * `replace` and `split`\n *\n * The wrapper methods that support shortcut fusion are:\n * `compact`, `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `filter`,\n * `first`, `initial`, `last`, `map`, `pluck`, `reject`, `rest`, `reverse`,\n * `slice`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `toArray`,\n * and `where`\n *\n * The chainable wrapper methods are:\n * `after`, `ary`, `assign`, `at`, `before`, `bind`, `bindAll`, `bindKey`,\n * `callback`, `chain`, `chunk`, `commit`, `compact`, `concat`, `constant`,\n * `countBy`, `create`, `curry`, `debounce`, `defaults`, `defaultsDeep`,\n * `defer`, `delay`, `difference`, `drop`, `dropRight`, `dropRightWhile`,\n * `dropWhile`, `fill`, `filter`, `flatten`, `flattenDeep`, `flow`, `flowRight`,\n * `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`,\n * `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`,\n * `invoke`, `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`,\n * `matchesProperty`, `memoize`, `merge`, `method`, `methodOf`, `mixin`,\n * `modArgs`, `negate`, `omit`, `once`, `pairs`, `partial`, `partialRight`,\n * `partition`, `pick`, `plant`, `pluck`, `property`, `propertyOf`, `pull`,\n * `pullAt`, `push`, `range`, `rearg`, `reject`, `remove`, `rest`, `restParam`,\n * `reverse`, `set`, `shuffle`, `slice`, `sort`, `sortBy`, `sortByAll`,\n * `sortByOrder`, `splice`, `spread`, `take`, `takeRight`, `takeRightWhile`,\n * `takeWhile`, `tap`, `throttle`, `thru`, `times`, `toArray`, `toPlainObject`,\n * `transform`, `union`, `uniq`, `unshift`, `unzip`, `unzipWith`, `values`,\n * `valuesIn`, `where`, `without`, `wrap`, `xor`, `zip`, `zipObject`, `zipWith`\n *\n * The wrapper methods that are **not** chainable by default are:\n * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clone`, `cloneDeep`,\n * `deburr`, `endsWith`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`,\n * `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`,\n * `floor`, `get`, `gt`, `gte`, `has`, `identity`, `includes`, `indexOf`,\n * `inRange`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`,\n * `isEmpty`, `isEqual`, `isError`, `isFinite` `isFunction`, `isMatch`,\n * `isNative`, `isNaN`, `isNull`, `isNumber`, `isObject`, `isPlainObject`,\n * `isRegExp`, `isString`, `isUndefined`, `isTypedArray`, `join`, `kebabCase`,\n * `last`, `lastIndexOf`, `lt`, `lte`, `max`, `min`, `noConflict`, `noop`,\n * `now`, `pad`, `padLeft`, `padRight`, `parseInt`, `pop`, `random`, `reduce`,\n * `reduceRight`, `repeat`, `result`, `round`, `runInContext`, `shift`, `size`,\n * `snakeCase`, `some`, `sortedIndex`, `sortedLastIndex`, `startCase`,\n * `startsWith`, `sum`, `template`, `trim`, `trimLeft`, `trimRight`, `trunc`,\n * `unescape`, `uniqueId`, `value`, and `words`\n *\n * The wrapper method `sample` will return a wrapped value when `n` is provided,\n * otherwise an unwrapped value is returned.\n *\n * @name _\n * @constructor\n * @category Chain\n * @param {*} value The value to wrap in a `lodash` instance.\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * var wrapped = _([1, 2, 3]);\n *\n * // returns an unwrapped value\n * wrapped.reduce(function(total, n) {\n * return total + n;\n * });\n * // => 6\n *\n * // returns a wrapped value\n * var squares = wrapped.map(function(n) {\n * return n * n;\n * });\n *\n * _.isArray(squares);\n * // => false\n *\n * _.isArray(squares.value());\n * // => true\n */\nfunction lodash(value) {\n if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {\n if (value instanceof LodashWrapper) {\n return value;\n }\n if (hasOwnProperty.call(value, '__chain__') && hasOwnProperty.call(value, '__wrapped__')) {\n return wrapperClone(value);\n }\n }\n return new LodashWrapper(value);\n}\n\n// Ensure wrappers are instances of `baseLodash`.\nlodash.prototype = baseLodash.prototype;\n\nmodule.exports = lodash;\n","module.exports = require(309);\n","var arrayEvery = require(321),\n baseCallback = require(329),\n baseEvery = require(337),\n isArray = require(422),\n isIterateeCall = require(401);\n\n/**\n * Checks if `predicate` returns truthy for **all** elements of `collection`.\n * The predicate is bound to `thisArg` and invoked with three arguments:\n * (value, index|key, collection).\n *\n * If a property name is provided for `predicate` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `predicate` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @alias all\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`.\n * @example\n *\n * _.every([true, 1, null, 'yes'], Boolean);\n * // => false\n *\n * var users = [\n * { 'user': 'barney', 'active': false },\n * { 'user': 'fred', 'active': false }\n * ];\n *\n * // using the `_.matches` callback shorthand\n * _.every(users, { 'user': 'barney', 'active': false });\n * // => false\n *\n * // using the `_.matchesProperty` callback shorthand\n * _.every(users, 'active', false);\n * // => true\n *\n * // using the `_.property` callback shorthand\n * _.every(users, 'active');\n * // => false\n */\nfunction every(collection, predicate, thisArg) {\n var func = isArray(collection) ? arrayEvery : baseEvery;\n if (thisArg && isIterateeCall(collection, predicate, thisArg)) {\n predicate = undefined;\n }\n if (typeof predicate != 'function' || thisArg !== undefined) {\n predicate = baseCallback(predicate, thisArg, 3);\n }\n return func(collection, predicate);\n}\n\nmodule.exports = every;\n","var arrayFilter = require(322),\n baseCallback = require(329),\n baseFilter = require(338),\n isArray = require(422);\n\n/**\n * Iterates over elements of `collection`, returning an array of all elements\n * `predicate` returns truthy for. The predicate is bound to `thisArg` and\n * invoked with three arguments: (value, index|key, collection).\n *\n * If a property name is provided for `predicate` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `predicate` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @alias select\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {Array} Returns the new filtered array.\n * @example\n *\n * _.filter([4, 5, 6], function(n) {\n * return n % 2 == 0;\n * });\n * // => [4, 6]\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': true },\n * { 'user': 'fred', 'age': 40, 'active': false }\n * ];\n *\n * // using the `_.matches` callback shorthand\n * _.pluck(_.filter(users, { 'age': 36, 'active': true }), 'user');\n * // => ['barney']\n *\n * // using the `_.matchesProperty` callback shorthand\n * _.pluck(_.filter(users, 'active', false), 'user');\n * // => ['fred']\n *\n * // using the `_.property` callback shorthand\n * _.pluck(_.filter(users, 'active'), 'user');\n * // => ['barney']\n */\nfunction filter(collection, predicate, thisArg) {\n var func = isArray(collection) ? arrayFilter : baseFilter;\n predicate = baseCallback(predicate, thisArg, 3);\n return func(collection, predicate);\n}\n\nmodule.exports = filter;\n","var baseEach = require(336),\n createFind = require(380);\n\n/**\n * Iterates over elements of `collection`, returning the first element\n * `predicate` returns truthy for. The predicate is bound to `thisArg` and\n * invoked with three arguments: (value, index|key, collection).\n *\n * If a property name is provided for `predicate` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `predicate` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @alias detect\n * @category Collection\n * @param {Array|Object|string} collection The collection to search.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {*} Returns the matched element, else `undefined`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': true },\n * { 'user': 'fred', 'age': 40, 'active': false },\n * { 'user': 'pebbles', 'age': 1, 'active': true }\n * ];\n *\n * _.result(_.find(users, function(chr) {\n * return chr.age < 40;\n * }), 'user');\n * // => 'barney'\n *\n * // using the `_.matches` callback shorthand\n * _.result(_.find(users, { 'age': 1, 'active': true }), 'user');\n * // => 'pebbles'\n *\n * // using the `_.matchesProperty` callback shorthand\n * _.result(_.find(users, 'active', false), 'user');\n * // => 'fred'\n *\n * // using the `_.property` callback shorthand\n * _.result(_.find(users, 'active'), 'user');\n * // => 'barney'\n */\nvar find = createFind(baseEach);\n\nmodule.exports = find;\n","var arrayEach = require(320),\n baseEach = require(336),\n createForEach = require(382);\n\n/**\n * Iterates over elements of `collection` invoking `iteratee` for each element.\n * The `iteratee` is bound to `thisArg` and invoked with three arguments:\n * (value, index|key, collection). Iteratee functions may exit iteration early\n * by explicitly returning `false`.\n *\n * **Note:** As with other \"Collections\" methods, objects with a \"length\" property\n * are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn`\n * may be used for object iteration.\n *\n * @static\n * @memberOf _\n * @alias each\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Array|Object|string} Returns `collection`.\n * @example\n *\n * _([1, 2]).forEach(function(n) {\n * console.log(n);\n * }).value();\n * // => logs each value from left to right and returns the array\n *\n * _.forEach({ 'a': 1, 'b': 2 }, function(n, key) {\n * console.log(n, key);\n * });\n * // => logs each value-key pair and returns the object (iteration order is not guaranteed)\n */\nvar forEach = createForEach(arrayEach, baseEach);\n\nmodule.exports = forEach;\n","var createAggregator = require(373);\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Creates an object composed of keys generated from the results of running\n * each element of `collection` through `iteratee`. The corresponding value\n * of each key is an array of the elements responsible for generating the key.\n * The `iteratee` is bound to `thisArg` and invoked with three arguments:\n * (value, index|key, collection).\n *\n * If a property name is provided for `iteratee` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `iteratee` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [iteratee=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Object} Returns the composed aggregate object.\n * @example\n *\n * _.groupBy([4.2, 6.1, 6.4], function(n) {\n * return Math.floor(n);\n * });\n * // => { '4': [4.2], '6': [6.1, 6.4] }\n *\n * _.groupBy([4.2, 6.1, 6.4], function(n) {\n * return this.floor(n);\n * }, Math);\n * // => { '4': [4.2], '6': [6.1, 6.4] }\n *\n * // using the `_.property` callback shorthand\n * _.groupBy(['one', 'two', 'three'], 'length');\n * // => { '3': ['one', 'two'], '5': ['three'] }\n */\nvar groupBy = createAggregator(function(result, value, key) {\n if (hasOwnProperty.call(result, key)) {\n result[key].push(value);\n } else {\n result[key] = [value];\n }\n});\n\nmodule.exports = groupBy;\n","var arrayMap = require(323),\n baseCallback = require(329),\n baseMap = require(351),\n isArray = require(422);\n\n/**\n * Creates an array of values by running each element in `collection` through\n * `iteratee`. The `iteratee` is bound to `thisArg` and invoked with three\n * arguments: (value, index|key, collection).\n *\n * If a property name is provided for `iteratee` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `iteratee` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * Many lodash methods are guarded to work as iteratees for methods like\n * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.\n *\n * The guarded methods are:\n * `ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`,\n * `drop`, `dropRight`, `every`, `fill`, `flatten`, `invert`, `max`, `min`,\n * `parseInt`, `slice`, `sortBy`, `take`, `takeRight`, `template`, `trim`,\n * `trimLeft`, `trimRight`, `trunc`, `random`, `range`, `sample`, `some`,\n * `sum`, `uniq`, and `words`\n *\n * @static\n * @memberOf _\n * @alias collect\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [iteratee=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Array} Returns the new mapped array.\n * @example\n *\n * function timesThree(n) {\n * return n * 3;\n * }\n *\n * _.map([1, 2], timesThree);\n * // => [3, 6]\n *\n * _.map({ 'a': 1, 'b': 2 }, timesThree);\n * // => [3, 6] (iteration order is not guaranteed)\n *\n * var users = [\n * { 'user': 'barney' },\n * { 'user': 'fred' }\n * ];\n *\n * // using the `_.property` callback shorthand\n * _.map(users, 'user');\n * // => ['barney', 'fred']\n */\nfunction map(collection, iteratee, thisArg) {\n var func = isArray(collection) ? arrayMap : baseMap;\n iteratee = baseCallback(iteratee, thisArg, 3);\n return func(collection, iteratee);\n}\n\nmodule.exports = map;\n","var arrayReduce = require(325),\n baseEach = require(336),\n createReduce = require(385);\n\n/**\n * Reduces `collection` to a value which is the accumulated result of running\n * each element in `collection` through `iteratee`, where each successive\n * invocation is supplied the return value of the previous. If `accumulator`\n * is not provided the first element of `collection` is used as the initial\n * value. The `iteratee` is bound to `thisArg` and invoked with four arguments:\n * (accumulator, value, index|key, collection).\n *\n * Many lodash methods are guarded to work as iteratees for methods like\n * `_.reduce`, `_.reduceRight`, and `_.transform`.\n *\n * The guarded methods are:\n * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `sortByAll`,\n * and `sortByOrder`\n *\n * @static\n * @memberOf _\n * @alias foldl, inject\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {*} Returns the accumulated value.\n * @example\n *\n * _.reduce([1, 2], function(total, n) {\n * return total + n;\n * });\n * // => 3\n *\n * _.reduce({ 'a': 1, 'b': 2 }, function(result, n, key) {\n * result[key] = n * 3;\n * return result;\n * }, {});\n * // => { 'a': 3, 'b': 6 } (iteration order is not guaranteed)\n */\nvar reduce = createReduce(arrayReduce, baseEach);\n\nmodule.exports = reduce;\n","var arrayFilter = require(322),\n baseCallback = require(329),\n baseFilter = require(338),\n isArray = require(422);\n\n/**\n * The opposite of `_.filter`; this method returns the elements of `collection`\n * that `predicate` does **not** return truthy for.\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {Array} Returns the new filtered array.\n * @example\n *\n * _.reject([1, 2, 3, 4], function(n) {\n * return n % 2 == 0;\n * });\n * // => [1, 3]\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': false },\n * { 'user': 'fred', 'age': 40, 'active': true }\n * ];\n *\n * // using the `_.matches` callback shorthand\n * _.pluck(_.reject(users, { 'age': 40, 'active': true }), 'user');\n * // => ['barney']\n *\n * // using the `_.matchesProperty` callback shorthand\n * _.pluck(_.reject(users, 'active', false), 'user');\n * // => ['fred']\n *\n * // using the `_.property` callback shorthand\n * _.pluck(_.reject(users, 'active'), 'user');\n * // => ['barney']\n */\nfunction reject(collection, predicate, thisArg) {\n var func = isArray(collection) ? arrayFilter : baseFilter;\n predicate = baseCallback(predicate, thisArg, 3);\n return func(collection, function(value, index, collection) {\n return !predicate(value, index, collection);\n });\n}\n\nmodule.exports = reject;\n","var getLength = require(392),\n isLength = require(404),\n keys = require(433);\n\n/**\n * Gets the size of `collection` by returning its length for array-like\n * values or the number of own enumerable properties for objects.\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to inspect.\n * @returns {number} Returns the size of `collection`.\n * @example\n *\n * _.size([1, 2, 3]);\n * // => 3\n *\n * _.size({ 'a': 1, 'b': 2 });\n * // => 2\n *\n * _.size('pebbles');\n * // => 7\n */\nfunction size(collection) {\n var length = collection ? getLength(collection) : 0;\n return isLength(length) ? length : keys(collection).length;\n}\n\nmodule.exports = size;\n","var arraySome = require(326),\n baseCallback = require(329),\n baseSome = require(361),\n isArray = require(422),\n isIterateeCall = require(401);\n\n/**\n * Checks if `predicate` returns truthy for **any** element of `collection`.\n * The function returns as soon as it finds a passing value and does not iterate\n * over the entire collection. The predicate is bound to `thisArg` and invoked\n * with three arguments: (value, index|key, collection).\n *\n * If a property name is provided for `predicate` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `predicate` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @alias any\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n * @example\n *\n * _.some([null, 0, 'yes', false], Boolean);\n * // => true\n *\n * var users = [\n * { 'user': 'barney', 'active': true },\n * { 'user': 'fred', 'active': false }\n * ];\n *\n * // using the `_.matches` callback shorthand\n * _.some(users, { 'user': 'barney', 'active': false });\n * // => false\n *\n * // using the `_.matchesProperty` callback shorthand\n * _.some(users, 'active', false);\n * // => true\n *\n * // using the `_.property` callback shorthand\n * _.some(users, 'active');\n * // => true\n */\nfunction some(collection, predicate, thisArg) {\n var func = isArray(collection) ? arraySome : baseSome;\n if (thisArg && isIterateeCall(collection, predicate, thisArg)) {\n predicate = undefined;\n }\n if (typeof predicate != 'function' || thisArg !== undefined) {\n predicate = baseCallback(predicate, thisArg, 3);\n }\n return func(collection, predicate);\n}\n\nmodule.exports = some;\n","var baseCallback = require(329),\n baseMap = require(351),\n baseSortBy = require(362),\n compareAscending = require(370),\n isIterateeCall = require(401);\n\n/**\n * Creates an array of elements, sorted in ascending order by the results of\n * running each element in a collection through `iteratee`. This method performs\n * a stable sort, that is, it preserves the original sort order of equal elements.\n * The `iteratee` is bound to `thisArg` and invoked with three arguments:\n * (value, index|key, collection).\n *\n * If a property name is provided for `iteratee` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `iteratee` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [iteratee=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Array} Returns the new sorted array.\n * @example\n *\n * _.sortBy([1, 2, 3], function(n) {\n * return Math.sin(n);\n * });\n * // => [3, 1, 2]\n *\n * _.sortBy([1, 2, 3], function(n) {\n * return this.sin(n);\n * }, Math);\n * // => [3, 1, 2]\n *\n * var users = [\n * { 'user': 'fred' },\n * { 'user': 'pebbles' },\n * { 'user': 'barney' }\n * ];\n *\n * // using the `_.property` callback shorthand\n * _.pluck(_.sortBy(users, 'user'), 'user');\n * // => ['barney', 'fred', 'pebbles']\n */\nfunction sortBy(collection, iteratee, thisArg) {\n if (collection == null) {\n return [];\n }\n if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {\n iteratee = undefined;\n }\n var index = -1;\n iteratee = baseCallback(iteratee, thisArg, 3);\n\n var result = baseMap(collection, function(value, key, collection) {\n return { 'criteria': iteratee(value, key, collection), 'index': ++index, 'value': value };\n });\n return baseSortBy(result, compareAscending);\n}\n\nmodule.exports = sortBy;\n","var getNative = require(394);\n\n/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeNow = getNative(Date, 'now');\n\n/**\n * Gets the number of milliseconds that have elapsed since the Unix epoch\n * (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @category Date\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => logs the number of milliseconds it took for the deferred function to be invoked\n */\nvar now = nativeNow || function() {\n return new Date().getTime();\n};\n\nmodule.exports = now;\n","var createWrapper = require(386),\n replaceHolders = require(413),\n restParam = require(315);\n\n/** Used to compose bitmasks for wrapper metadata. */\nvar BIND_FLAG = 1,\n PARTIAL_FLAG = 32;\n\n/**\n * Creates a function that invokes `func` with the `this` binding of `thisArg`\n * and prepends any additional `_.bind` arguments to those provided to the\n * bound function.\n *\n * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,\n * may be used as a placeholder for partially applied arguments.\n *\n * **Note:** Unlike native `Function#bind` this method does not set the \"length\"\n * property of bound functions.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to bind.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {...*} [partials] The arguments to be partially applied.\n * @returns {Function} Returns the new bound function.\n * @example\n *\n * var greet = function(greeting, punctuation) {\n * return greeting + ' ' + this.user + punctuation;\n * };\n *\n * var object = { 'user': 'fred' };\n *\n * var bound = _.bind(greet, object, 'hi');\n * bound('!');\n * // => 'hi fred!'\n *\n * // using placeholders\n * var bound = _.bind(greet, object, _, '!');\n * bound('hi');\n * // => 'hi fred!'\n */\nvar bind = restParam(function(func, thisArg, partials) {\n var bitmask = BIND_FLAG;\n if (partials.length) {\n var holders = replaceHolders(partials, bind.placeholder);\n bitmask |= PARTIAL_FLAG;\n }\n return createWrapper(func, bitmask, thisArg, partials, holders);\n});\n\n// Assign default placeholders.\nbind.placeholder = {};\n\nmodule.exports = bind;\n","var isObject = require(426),\n now = require(311);\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed invocations. Provide an options object to indicate that `func`\n * should be invoked on the leading and/or trailing edge of the `wait` timeout.\n * Subsequent calls to the debounced function return the result of the last\n * `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked\n * on the trailing edge of the timeout only if the the debounced function is\n * invoked more than once during the `wait` timeout.\n *\n * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options] The options object.\n * @param {boolean} [options.leading=false] Specify invoking on the leading\n * edge of the timeout.\n * @param {number} [options.maxWait] The maximum time `func` is allowed to be\n * delayed before it's invoked.\n * @param {boolean} [options.trailing=true] Specify invoking on the trailing\n * edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // avoid costly calculations while the window size is in flux\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // invoke `sendMail` when the click event is fired, debouncing subsequent calls\n * jQuery('#postbox').on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // ensure `batchLog` is invoked once after 1 second of debounced calls\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', _.debounce(batchLog, 250, {\n * 'maxWait': 1000\n * }));\n *\n * // cancel a debounced call\n * var todoChanges = _.debounce(batchLog, 1000);\n * Object.observe(models.todo, todoChanges);\n *\n * Object.observe(models, function(changes) {\n * if (_.find(changes, { 'user': 'todo', 'type': 'delete'})) {\n * todoChanges.cancel();\n * }\n * }, ['delete']);\n *\n * // ...at some point `models.todo` is changed\n * models.todo.completed = true;\n *\n * // ...before 1 second has passed `models.todo` is deleted\n * // which cancels the debounced `todoChanges` call\n * delete models.todo;\n */\nfunction debounce(func, wait, options) {\n var args,\n maxTimeoutId,\n result,\n stamp,\n thisArg,\n timeoutId,\n trailingCall,\n lastCalled = 0,\n maxWait = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = wait < 0 ? 0 : (+wait || 0);\n if (options === true) {\n var leading = true;\n trailing = false;\n } else if (isObject(options)) {\n leading = !!options.leading;\n maxWait = 'maxWait' in options && nativeMax(+options.maxWait || 0, wait);\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function cancel() {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n if (maxTimeoutId) {\n clearTimeout(maxTimeoutId);\n }\n lastCalled = 0;\n maxTimeoutId = timeoutId = trailingCall = undefined;\n }\n\n function complete(isCalled, id) {\n if (id) {\n clearTimeout(id);\n }\n maxTimeoutId = timeoutId = trailingCall = undefined;\n if (isCalled) {\n lastCalled = now();\n result = func.apply(thisArg, args);\n if (!timeoutId && !maxTimeoutId) {\n args = thisArg = undefined;\n }\n }\n }\n\n function delayed() {\n var remaining = wait - (now() - stamp);\n if (remaining <= 0 || remaining > wait) {\n complete(trailingCall, maxTimeoutId);\n } else {\n timeoutId = setTimeout(delayed, remaining);\n }\n }\n\n function maxDelayed() {\n complete(trailing, timeoutId);\n }\n\n function debounced() {\n args = arguments;\n stamp = now();\n thisArg = this;\n trailingCall = trailing && (timeoutId || !leading);\n\n if (maxWait === false) {\n var leadingCall = leading && !timeoutId;\n } else {\n if (!maxTimeoutId && !leading) {\n lastCalled = stamp;\n }\n var remaining = maxWait - (stamp - lastCalled),\n isCalled = remaining <= 0 || remaining > maxWait;\n\n if (isCalled) {\n if (maxTimeoutId) {\n maxTimeoutId = clearTimeout(maxTimeoutId);\n }\n lastCalled = stamp;\n result = func.apply(thisArg, args);\n }\n else if (!maxTimeoutId) {\n maxTimeoutId = setTimeout(maxDelayed, remaining);\n }\n }\n if (isCalled && timeoutId) {\n timeoutId = clearTimeout(timeoutId);\n }\n else if (!timeoutId && wait !== maxWait) {\n timeoutId = setTimeout(delayed, wait);\n }\n if (leadingCall) {\n isCalled = true;\n result = func.apply(thisArg, args);\n }\n if (isCalled && !timeoutId && !maxTimeoutId) {\n args = thisArg = undefined;\n }\n return result;\n }\n debounced.cancel = cancel;\n return debounced;\n}\n\nmodule.exports = debounce;\n","var baseDelay = require(334),\n restParam = require(315);\n\n/**\n * Defers invoking the `func` until the current call stack has cleared. Any\n * additional arguments are provided to `func` when it's invoked.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to defer.\n * @param {...*} [args] The arguments to invoke the function with.\n * @returns {number} Returns the timer id.\n * @example\n *\n * _.defer(function(text) {\n * console.log(text);\n * }, 'deferred');\n * // logs 'deferred' after one or more milliseconds\n */\nvar defer = restParam(function(func, args) {\n return baseDelay(func, 1, args);\n});\n\nmodule.exports = defer;\n","/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * Creates a function that invokes `func` with the `this` binding of the\n * created function and arguments from `start` and beyond provided as an array.\n *\n * **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/Web/JavaScript/Reference/Functions/rest_parameters).\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var say = _.restParam(function(what, names) {\n * return what + ' ' + _.initial(names).join(', ') +\n * (_.size(names) > 1 ? ', & ' : '') + _.last(names);\n * });\n *\n * say('hello', 'fred', 'barney', 'pebbles');\n * // => 'hello fred, barney, & pebbles'\n */\nfunction restParam(func, start) {\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n rest = Array(length);\n\n while (++index < length) {\n rest[index] = args[start + index];\n }\n switch (start) {\n case 0: return func.call(this, rest);\n case 1: return func.call(this, args[0], rest);\n case 2: return func.call(this, args[0], args[1], rest);\n }\n var otherArgs = Array(start + 1);\n index = -1;\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = rest;\n return func.apply(this, otherArgs);\n };\n}\n\nmodule.exports = restParam;\n","var baseCreate = require(333),\n baseLodash = require(350);\n\n/** Used as references for `-Infinity` and `Infinity`. */\nvar POSITIVE_INFINITY = Number.POSITIVE_INFINITY;\n\n/**\n * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.\n *\n * @private\n * @param {*} value The value to wrap.\n */\nfunction LazyWrapper(value) {\n this.__wrapped__ = value;\n this.__actions__ = [];\n this.__dir__ = 1;\n this.__filtered__ = false;\n this.__iteratees__ = [];\n this.__takeCount__ = POSITIVE_INFINITY;\n this.__views__ = [];\n}\n\nLazyWrapper.prototype = baseCreate(baseLodash.prototype);\nLazyWrapper.prototype.constructor = LazyWrapper;\n\nmodule.exports = LazyWrapper;\n","var baseCreate = require(333),\n baseLodash = require(350);\n\n/**\n * The base constructor for creating `lodash` wrapper objects.\n *\n * @private\n * @param {*} value The value to wrap.\n * @param {boolean} [chainAll] Enable chaining for all wrapper methods.\n * @param {Array} [actions=[]] Actions to peform to resolve the unwrapped value.\n */\nfunction LodashWrapper(value, chainAll, actions) {\n this.__wrapped__ = value;\n this.__actions__ = actions || [];\n this.__chain__ = !!chainAll;\n}\n\nLodashWrapper.prototype = baseCreate(baseLodash.prototype);\nLodashWrapper.prototype.constructor = LodashWrapper;\n\nmodule.exports = LodashWrapper;\n","var cachePush = require('./cachePush'),\n getNative = require('./getNative');\n\n/** Native method references. */\nvar Set = getNative(global, 'Set');\n\n/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeCreate = getNative(Object, 'create');\n\n/**\n *\n * Creates a cache object to store unique values.\n *\n * @private\n * @param {Array} [values] The values to cache.\n */\nfunction SetCache(values) {\n var length = values ? values.length : 0;\n\n this.data = { 'hash': nativeCreate(null), 'set': new Set };\n while (length--) {\n this.push(values[length]);\n }\n}\n\n// Add functions to the `Set` cache.\nSetCache.prototype.push = cachePush;\n\nmodule.exports = SetCache;\n","/**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\nfunction arrayCopy(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n}\n\nmodule.exports = arrayCopy;\n","/**\n * A specialized version of `_.forEach` for arrays without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\nfunction arrayEach(array, iteratee) {\n var index = -1,\n length = array.length;\n\n while (++index < length) {\n if (iteratee(array[index], index, array) === false) {\n break;\n }\n }\n return array;\n}\n\nmodule.exports = arrayEach;\n","/**\n * A specialized version of `_.every` for arrays without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`.\n */\nfunction arrayEvery(array, predicate) {\n var index = -1,\n length = array.length;\n\n while (++index < length) {\n if (!predicate(array[index], index, array)) {\n return false;\n }\n }\n return true;\n}\n\nmodule.exports = arrayEvery;\n","/**\n * A specialized version of `_.filter` for arrays without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\nfunction arrayFilter(array, predicate) {\n var index = -1,\n length = array.length,\n resIndex = -1,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result[++resIndex] = value;\n }\n }\n return result;\n}\n\nmodule.exports = arrayFilter;\n","/**\n * A specialized version of `_.map` for arrays without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction arrayMap(array, iteratee) {\n var index = -1,\n length = array.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array);\n }\n return result;\n}\n\nmodule.exports = arrayMap;\n","/**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\nfunction arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length;\n\n while (++index < length) {\n array[offset + index] = values[index];\n }\n return array;\n}\n\nmodule.exports = arrayPush;\n","/**\n * A specialized version of `_.reduce` for arrays without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @param {boolean} [initFromArray] Specify using the first element of `array`\n * as the initial value.\n * @returns {*} Returns the accumulated value.\n */\nfunction arrayReduce(array, iteratee, accumulator, initFromArray) {\n var index = -1,\n length = array.length;\n\n if (initFromArray && length) {\n accumulator = array[++index];\n }\n while (++index < length) {\n accumulator = iteratee(accumulator, array[index], index, array);\n }\n return accumulator;\n}\n\nmodule.exports = arrayReduce;\n","/**\n * A specialized version of `_.some` for arrays without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\nfunction arraySome(array, predicate) {\n var index = -1,\n length = array.length;\n\n while (++index < length) {\n if (predicate(array[index], index, array)) {\n return true;\n }\n }\n return false;\n}\n\nmodule.exports = arraySome;\n","var keys = require(433);\n\n/**\n * A specialized version of `_.assign` for customizing assigned values without\n * support for argument juggling, multiple sources, and `this` binding `customizer`\n * functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {Function} customizer The function to customize assigned values.\n * @returns {Object} Returns `object`.\n */\nfunction assignWith(object, source, customizer) {\n var index = -1,\n props = keys(source),\n length = props.length;\n\n while (++index < length) {\n var key = props[index],\n value = object[key],\n result = customizer(value, source[key], key, object, source);\n\n if ((result === result ? (result !== value) : (value === value)) ||\n (value === undefined && !(key in object))) {\n object[key] = result;\n }\n }\n return object;\n}\n\nmodule.exports = assignWith;\n","var baseCopy = require(332),\n keys = require(433);\n\n/**\n * The base implementation of `_.assign` without support for argument juggling,\n * multiple sources, and `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\nfunction baseAssign(object, source) {\n return source == null\n ? object\n : baseCopy(source, keys(source), object);\n}\n\nmodule.exports = baseAssign;\n","var baseMatches = require(352),\n baseMatchesProperty = require(353),\n bindCallback = require(366),\n identity = require(441),\n property = require(443);\n\n/**\n * The base implementation of `_.callback` which supports specifying the\n * number of arguments to provide to `func`.\n *\n * @private\n * @param {*} [func=_.identity] The value to convert to a callback.\n * @param {*} [thisArg] The `this` binding of `func`.\n * @param {number} [argCount] The number of arguments to provide to `func`.\n * @returns {Function} Returns the callback.\n */\nfunction baseCallback(func, thisArg, argCount) {\n var type = typeof func;\n if (type == 'function') {\n return thisArg === undefined\n ? func\n : bindCallback(func, thisArg, argCount);\n }\n if (func == null) {\n return identity;\n }\n if (type == 'object') {\n return baseMatches(func);\n }\n return thisArg === undefined\n ? property(func)\n : baseMatchesProperty(func, thisArg);\n}\n\nmodule.exports = baseCallback;\n","var arrayCopy = require(319),\n arrayEach = require(320),\n baseAssign = require(328),\n baseForOwn = require(344),\n initCloneArray = require(396),\n initCloneByTag = require(397),\n initCloneObject = require(398),\n isArray = require(422),\n isObject = require(426);\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values supported by `_.clone`. */\nvar cloneableTags = {};\ncloneableTags[argsTag] = cloneableTags[arrayTag] =\ncloneableTags[arrayBufferTag] = cloneableTags[boolTag] =\ncloneableTags[dateTag] = cloneableTags[float32Tag] =\ncloneableTags[float64Tag] = cloneableTags[int8Tag] =\ncloneableTags[int16Tag] = cloneableTags[int32Tag] =\ncloneableTags[numberTag] = cloneableTags[objectTag] =\ncloneableTags[regexpTag] = cloneableTags[stringTag] =\ncloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =\ncloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;\ncloneableTags[errorTag] = cloneableTags[funcTag] =\ncloneableTags[mapTag] = cloneableTags[setTag] =\ncloneableTags[weakMapTag] = false;\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objToString = objectProto.toString;\n\n/**\n * The base implementation of `_.clone` without support for argument juggling\n * and `this` binding `customizer` functions.\n *\n * @private\n * @param {*} value The value to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @param {Function} [customizer] The function to customize cloning values.\n * @param {string} [key] The key of `value`.\n * @param {Object} [object] The object `value` belongs to.\n * @param {Array} [stackA=[]] Tracks traversed source objects.\n * @param {Array} [stackB=[]] Associates clones with source counterparts.\n * @returns {*} Returns the cloned value.\n */\nfunction baseClone(value, isDeep, customizer, key, object, stackA, stackB) {\n var result;\n if (customizer) {\n result = object ? customizer(value, key, object) : customizer(value);\n }\n if (result !== undefined) {\n return result;\n }\n if (!isObject(value)) {\n return value;\n }\n var isArr = isArray(value);\n if (isArr) {\n result = initCloneArray(value);\n if (!isDeep) {\n return arrayCopy(value, result);\n }\n } else {\n var tag = objToString.call(value),\n isFunc = tag == funcTag;\n\n if (tag == objectTag || tag == argsTag || (isFunc && !object)) {\n result = initCloneObject(isFunc ? {} : value);\n if (!isDeep) {\n return baseAssign(result, value);\n }\n } else {\n return cloneableTags[tag]\n ? initCloneByTag(value, tag, isDeep)\n : (object ? value : {});\n }\n }\n // Check for circular references and return its corresponding clone.\n stackA || (stackA = []);\n stackB || (stackB = []);\n\n var length = stackA.length;\n while (length--) {\n if (stackA[length] == value) {\n return stackB[length];\n }\n }\n // Add the source value to the stack of traversed objects and associate it with its clone.\n stackA.push(value);\n stackB.push(result);\n\n // Recursively populate clone (susceptible to call stack limits).\n (isArr ? arrayEach : baseForOwn)(value, function(subValue, key) {\n result[key] = baseClone(subValue, isDeep, customizer, key, value, stackA, stackB);\n });\n return result;\n}\n\nmodule.exports = baseClone;\n","/**\n * The base implementation of `compareAscending` which compares values and\n * sorts them in ascending order without guaranteeing a stable sort.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {number} Returns the sort order indicator for `value`.\n */\nfunction baseCompareAscending(value, other) {\n if (value !== other) {\n var valIsNull = value === null,\n valIsUndef = value === undefined,\n valIsReflexive = value === value;\n\n var othIsNull = other === null,\n othIsUndef = other === undefined,\n othIsReflexive = other === other;\n\n if ((value > other && !othIsNull) || !valIsReflexive ||\n (valIsNull && !othIsUndef && othIsReflexive) ||\n (valIsUndef && othIsReflexive)) {\n return 1;\n }\n if ((value < other && !valIsNull) || !othIsReflexive ||\n (othIsNull && !valIsUndef && valIsReflexive) ||\n (othIsUndef && valIsReflexive)) {\n return -1;\n }\n }\n return 0;\n}\n\nmodule.exports = baseCompareAscending;\n","/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property names to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @returns {Object} Returns `object`.\n */\nfunction baseCopy(source, props, object) {\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n object[key] = source[key];\n }\n return object;\n}\n\nmodule.exports = baseCopy;\n","var isObject = require(426);\n\n/**\n * The base implementation of `_.create` without support for assigning\n * properties to the created object.\n *\n * @private\n * @param {Object} prototype The object to inherit from.\n * @returns {Object} Returns the new object.\n */\nvar baseCreate = (function() {\n function object() {}\n return function(prototype) {\n if (isObject(prototype)) {\n object.prototype = prototype;\n var result = new object;\n object.prototype = undefined;\n }\n return result || {};\n };\n}());\n\nmodule.exports = baseCreate;\n","/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * The base implementation of `_.delay` and `_.defer` which accepts an index\n * of where to slice the arguments to provide to `func`.\n *\n * @private\n * @param {Function} func The function to delay.\n * @param {number} wait The number of milliseconds to delay invocation.\n * @param {Object} args The arguments provide to `func`.\n * @returns {number} Returns the timer id.\n */\nfunction baseDelay(func, wait, args) {\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n return setTimeout(function() { func.apply(undefined, args); }, wait);\n}\n\nmodule.exports = baseDelay;\n","var baseIndexOf = require(346),\n cacheIndexOf = require(368),\n createCache = require(378);\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/**\n * The base implementation of `_.difference` which accepts a single array\n * of values to exclude.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Array} values The values to exclude.\n * @returns {Array} Returns the new array of filtered values.\n */\nfunction baseDifference(array, values) {\n var length = array ? array.length : 0,\n result = [];\n\n if (!length) {\n return result;\n }\n var index = -1,\n indexOf = baseIndexOf,\n isCommon = true,\n cache = (isCommon && values.length >= LARGE_ARRAY_SIZE) ? createCache(values) : null,\n valuesLength = values.length;\n\n if (cache) {\n indexOf = cacheIndexOf;\n isCommon = false;\n values = cache;\n }\n outer:\n while (++index < length) {\n var value = array[index];\n\n if (isCommon && value === value) {\n var valuesIndex = valuesLength;\n while (valuesIndex--) {\n if (values[valuesIndex] === value) {\n continue outer;\n }\n }\n result.push(value);\n }\n else if (indexOf(values, value, 0) < 0) {\n result.push(value);\n }\n }\n return result;\n}\n\nmodule.exports = baseDifference;\n","var baseForOwn = require(344),\n createBaseEach = require(375);\n\n/**\n * The base implementation of `_.forEach` without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array|Object|string} Returns `collection`.\n */\nvar baseEach = createBaseEach(baseForOwn);\n\nmodule.exports = baseEach;\n","var baseEach = require(336);\n\n/**\n * The base implementation of `_.every` without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`\n */\nfunction baseEvery(collection, predicate) {\n var result = true;\n baseEach(collection, function(value, index, collection) {\n result = !!predicate(value, index, collection);\n return result;\n });\n return result;\n}\n\nmodule.exports = baseEvery;\n","var baseEach = require(336);\n\n/**\n * The base implementation of `_.filter` without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\nfunction baseFilter(collection, predicate) {\n var result = [];\n baseEach(collection, function(value, index, collection) {\n if (predicate(value, index, collection)) {\n result.push(value);\n }\n });\n return result;\n}\n\nmodule.exports = baseFilter;\n","/**\n * The base implementation of `_.find`, `_.findLast`, `_.findKey`, and `_.findLastKey`,\n * without support for callback shorthands and `this` binding, which iterates\n * over `collection` using the provided `eachFunc`.\n *\n * @private\n * @param {Array|Object|string} collection The collection to search.\n * @param {Function} predicate The function invoked per iteration.\n * @param {Function} eachFunc The function to iterate over `collection`.\n * @param {boolean} [retKey] Specify returning the key of the found element\n * instead of the element itself.\n * @returns {*} Returns the found element or its key, else `undefined`.\n */\nfunction baseFind(collection, predicate, eachFunc, retKey) {\n var result;\n eachFunc(collection, function(value, key, collection) {\n if (predicate(value, key, collection)) {\n result = retKey ? key : value;\n return false;\n }\n });\n return result;\n}\n\nmodule.exports = baseFind;\n","/**\n * The base implementation of `_.findIndex` and `_.findLastIndex` without\n * support for callback shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to search.\n * @param {Function} predicate The function invoked per iteration.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction baseFindIndex(array, predicate, fromRight) {\n var length = array.length,\n index = fromRight ? length : -1;\n\n while ((fromRight ? index-- : ++index < length)) {\n if (predicate(array[index], index, array)) {\n return index;\n }\n }\n return -1;\n}\n\nmodule.exports = baseFindIndex;\n","var arrayPush = require(324),\n isArguments = require(421),\n isArray = require(422),\n isArrayLike = require(399),\n isObjectLike = require(405);\n\n/**\n * The base implementation of `_.flatten` with added support for restricting\n * flattening and specifying the start index.\n *\n * @private\n * @param {Array} array The array to flatten.\n * @param {boolean} [isDeep] Specify a deep flatten.\n * @param {boolean} [isStrict] Restrict flattening to arrays-like objects.\n * @param {Array} [result=[]] The initial result value.\n * @returns {Array} Returns the new flattened array.\n */\nfunction baseFlatten(array, isDeep, isStrict, result) {\n result || (result = []);\n\n var index = -1,\n length = array.length;\n\n while (++index < length) {\n var value = array[index];\n if (isObjectLike(value) && isArrayLike(value) &&\n (isStrict || isArray(value) || isArguments(value))) {\n if (isDeep) {\n // Recursively flatten arrays (susceptible to call stack limits).\n baseFlatten(value, isDeep, isStrict, result);\n } else {\n arrayPush(result, value);\n }\n } else if (!isStrict) {\n result[result.length] = value;\n }\n }\n return result;\n}\n\nmodule.exports = baseFlatten;\n","var createBaseFor = require(376);\n\n/**\n * The base implementation of `baseForIn` and `baseForOwn` which iterates\n * over `object` properties returned by `keysFunc` invoking `iteratee` for\n * each property. Iteratee functions may exit iteration early by explicitly\n * returning `false`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\nvar baseFor = createBaseFor();\n\nmodule.exports = baseFor;\n","var baseFor = require(342),\n keysIn = require(434);\n\n/**\n * The base implementation of `_.forIn` without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Object} Returns `object`.\n */\nfunction baseForIn(object, iteratee) {\n return baseFor(object, iteratee, keysIn);\n}\n\nmodule.exports = baseForIn;\n","var baseFor = require(342),\n keys = require(433);\n\n/**\n * The base implementation of `_.forOwn` without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Object} Returns `object`.\n */\nfunction baseForOwn(object, iteratee) {\n return baseFor(object, iteratee, keys);\n}\n\nmodule.exports = baseForOwn;\n","var toObject = require(417);\n\n/**\n * The base implementation of `get` without support for string paths\n * and default values.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} path The path of the property to get.\n * @param {string} [pathKey] The key representation of path.\n * @returns {*} Returns the resolved value.\n */\nfunction baseGet(object, path, pathKey) {\n if (object == null) {\n return;\n }\n if (pathKey !== undefined && pathKey in toObject(object)) {\n path = [pathKey];\n }\n var index = 0,\n length = path.length;\n\n while (object != null && index < length) {\n object = object[path[index++]];\n }\n return (index && index == length) ? object : undefined;\n}\n\nmodule.exports = baseGet;\n","var indexOfNaN = require(395);\n\n/**\n * The base implementation of `_.indexOf` without support for binary searches.\n *\n * @private\n * @param {Array} array The array to search.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction baseIndexOf(array, value, fromIndex) {\n if (value !== value) {\n return indexOfNaN(array, fromIndex);\n }\n var index = fromIndex - 1,\n length = array.length;\n\n while (++index < length) {\n if (array[index] === value) {\n return index;\n }\n }\n return -1;\n}\n\nmodule.exports = baseIndexOf;\n","var baseIsEqualDeep = require(348),\n isObject = require(426),\n isObjectLike = require(405);\n\n/**\n * The base implementation of `_.isEqual` without support for `this` binding\n * `customizer` functions.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @param {Function} [customizer] The function to customize comparing values.\n * @param {boolean} [isLoose] Specify performing partial comparisons.\n * @param {Array} [stackA] Tracks traversed `value` objects.\n * @param {Array} [stackB] Tracks traversed `other` objects.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n */\nfunction baseIsEqual(value, other, customizer, isLoose, stackA, stackB) {\n if (value === other) {\n return true;\n }\n if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {\n return value !== value && other !== other;\n }\n return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB);\n}\n\nmodule.exports = baseIsEqual;\n","var equalArrays = require(387),\n equalByTag = require(388),\n equalObjects = require(389),\n isArray = require(422),\n isTypedArray = require(429);\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n objectTag = '[object Object]';\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objToString = objectProto.toString;\n\n/**\n * A specialized version of `baseIsEqual` for arrays and objects which performs\n * deep comparisons and tracks traversed objects enabling objects with circular\n * references to be compared.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Function} [customizer] The function to customize comparing objects.\n * @param {boolean} [isLoose] Specify performing partial comparisons.\n * @param {Array} [stackA=[]] Tracks traversed `value` objects.\n * @param {Array} [stackB=[]] Tracks traversed `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction baseIsEqualDeep(object, other, equalFunc, customizer, isLoose, stackA, stackB) {\n var objIsArr = isArray(object),\n othIsArr = isArray(other),\n objTag = arrayTag,\n othTag = arrayTag;\n\n if (!objIsArr) {\n objTag = objToString.call(object);\n if (objTag == argsTag) {\n objTag = objectTag;\n } else if (objTag != objectTag) {\n objIsArr = isTypedArray(object);\n }\n }\n if (!othIsArr) {\n othTag = objToString.call(other);\n if (othTag == argsTag) {\n othTag = objectTag;\n } else if (othTag != objectTag) {\n othIsArr = isTypedArray(other);\n }\n }\n var objIsObj = objTag == objectTag,\n othIsObj = othTag == objectTag,\n isSameTag = objTag == othTag;\n\n if (isSameTag && !(objIsArr || objIsObj)) {\n return equalByTag(object, other, objTag);\n }\n if (!isLoose) {\n var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),\n othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');\n\n if (objIsWrapped || othIsWrapped) {\n return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, isLoose, stackA, stackB);\n }\n }\n if (!isSameTag) {\n return false;\n }\n // Assume cyclic values are equal.\n // For more information on detecting circular references see https://es5.github.io/#JO.\n stackA || (stackA = []);\n stackB || (stackB = []);\n\n var length = stackA.length;\n while (length--) {\n if (stackA[length] == object) {\n return stackB[length] == other;\n }\n }\n // Add `object` and `other` to the stack of traversed objects.\n stackA.push(object);\n stackB.push(other);\n\n var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isLoose, stackA, stackB);\n\n stackA.pop();\n stackB.pop();\n\n return result;\n}\n\nmodule.exports = baseIsEqualDeep;\n","var baseIsEqual = require(347),\n toObject = require(417);\n\n/**\n * The base implementation of `_.isMatch` without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Object} object The object to inspect.\n * @param {Array} matchData The propery names, values, and compare flags to match.\n * @param {Function} [customizer] The function to customize comparing objects.\n * @returns {boolean} Returns `true` if `object` is a match, else `false`.\n */\nfunction baseIsMatch(object, matchData, customizer) {\n var index = matchData.length,\n length = index,\n noCustomizer = !customizer;\n\n if (object == null) {\n return !length;\n }\n object = toObject(object);\n while (index--) {\n var data = matchData[index];\n if ((noCustomizer && data[2])\n ? data[1] !== object[data[0]]\n : !(data[0] in object)\n ) {\n return false;\n }\n }\n while (++index < length) {\n data = matchData[index];\n var key = data[0],\n objValue = object[key],\n srcValue = data[1];\n\n if (noCustomizer && data[2]) {\n if (objValue === undefined && !(key in object)) {\n return false;\n }\n } else {\n var result = customizer ? customizer(objValue, srcValue, key) : undefined;\n if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, true) : result)) {\n return false;\n }\n }\n }\n return true;\n}\n\nmodule.exports = baseIsMatch;\n","/**\n * The function whose prototype all chaining wrappers inherit from.\n *\n * @private\n */\nfunction baseLodash() {\n // No operation performed.\n}\n\nmodule.exports = baseLodash;\n","var baseEach = require(336),\n isArrayLike = require(399);\n\n/**\n * The base implementation of `_.map` without support for callback shorthands\n * and `this` binding.\n *\n * @private\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction baseMap(collection, iteratee) {\n var index = -1,\n result = isArrayLike(collection) ? Array(collection.length) : [];\n\n baseEach(collection, function(value, key, collection) {\n result[++index] = iteratee(value, key, collection);\n });\n return result;\n}\n\nmodule.exports = baseMap;\n","var baseIsMatch = require(349),\n getMatchData = require(393),\n toObject = require(417);\n\n/**\n * The base implementation of `_.matches` which does not clone `source`.\n *\n * @private\n * @param {Object} source The object of property values to match.\n * @returns {Function} Returns the new function.\n */\nfunction baseMatches(source) {\n var matchData = getMatchData(source);\n if (matchData.length == 1 && matchData[0][2]) {\n var key = matchData[0][0],\n value = matchData[0][1];\n\n return function(object) {\n if (object == null) {\n return false;\n }\n return object[key] === value && (value !== undefined || (key in toObject(object)));\n };\n }\n return function(object) {\n return baseIsMatch(object, matchData);\n };\n}\n\nmodule.exports = baseMatches;\n","var baseGet = require(345),\n baseIsEqual = require(347),\n baseSlice = require(360),\n isArray = require(422),\n isKey = require(402),\n isStrictComparable = require(406),\n last = require(293),\n toObject = require(417),\n toPath = require(418);\n\n/**\n * The base implementation of `_.matchesProperty` which does not clone `srcValue`.\n *\n * @private\n * @param {string} path The path of the property to get.\n * @param {*} srcValue The value to compare.\n * @returns {Function} Returns the new function.\n */\nfunction baseMatchesProperty(path, srcValue) {\n var isArr = isArray(path),\n isCommon = isKey(path) && isStrictComparable(srcValue),\n pathKey = (path + '');\n\n path = toPath(path);\n return function(object) {\n if (object == null) {\n return false;\n }\n var key = pathKey;\n object = toObject(object);\n if ((isArr || !isCommon) && !(key in object)) {\n object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));\n if (object == null) {\n return false;\n }\n key = last(path);\n object = toObject(object);\n }\n return object[key] === srcValue\n ? (srcValue !== undefined || (key in object))\n : baseIsEqual(srcValue, object[key], undefined, true);\n };\n}\n\nmodule.exports = baseMatchesProperty;\n","var arrayEach = require(320),\n baseMergeDeep = require(355),\n isArray = require(422),\n isArrayLike = require(399),\n isObject = require(426),\n isObjectLike = require(405),\n isTypedArray = require(429),\n keys = require(433);\n\n/**\n * The base implementation of `_.merge` without support for argument juggling,\n * multiple sources, and `this` binding `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {Function} [customizer] The function to customize merged values.\n * @param {Array} [stackA=[]] Tracks traversed source objects.\n * @param {Array} [stackB=[]] Associates values with source counterparts.\n * @returns {Object} Returns `object`.\n */\nfunction baseMerge(object, source, customizer, stackA, stackB) {\n if (!isObject(object)) {\n return object;\n }\n var isSrcArr = isArrayLike(source) && (isArray(source) || isTypedArray(source)),\n props = isSrcArr ? undefined : keys(source);\n\n arrayEach(props || source, function(srcValue, key) {\n if (props) {\n key = srcValue;\n srcValue = source[key];\n }\n if (isObjectLike(srcValue)) {\n stackA || (stackA = []);\n stackB || (stackB = []);\n baseMergeDeep(object, source, key, baseMerge, customizer, stackA, stackB);\n }\n else {\n var value = object[key],\n result = customizer ? customizer(value, srcValue, key, object, source) : undefined,\n isCommon = result === undefined;\n\n if (isCommon) {\n result = srcValue;\n }\n if ((result !== undefined || (isSrcArr && !(key in object))) &&\n (isCommon || (result === result ? (result !== value) : (value === value)))) {\n object[key] = result;\n }\n }\n });\n return object;\n}\n\nmodule.exports = baseMerge;\n","var arrayCopy = require(319),\n isArguments = require(421),\n isArray = require(422),\n isArrayLike = require(399),\n isPlainObject = require(427),\n isTypedArray = require(429),\n toPlainObject = require(430);\n\n/**\n * A specialized version of `baseMerge` for arrays and objects which performs\n * deep merges and tracks traversed objects enabling objects with circular\n * references to be merged.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {string} key The key of the value to merge.\n * @param {Function} mergeFunc The function to merge values.\n * @param {Function} [customizer] The function to customize merged values.\n * @param {Array} [stackA=[]] Tracks traversed source objects.\n * @param {Array} [stackB=[]] Associates values with source counterparts.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction baseMergeDeep(object, source, key, mergeFunc, customizer, stackA, stackB) {\n var length = stackA.length,\n srcValue = source[key];\n\n while (length--) {\n if (stackA[length] == srcValue) {\n object[key] = stackB[length];\n return;\n }\n }\n var value = object[key],\n result = customizer ? customizer(value, srcValue, key, object, source) : undefined,\n isCommon = result === undefined;\n\n if (isCommon) {\n result = srcValue;\n if (isArrayLike(srcValue) && (isArray(srcValue) || isTypedArray(srcValue))) {\n result = isArray(value)\n ? value\n : (isArrayLike(value) ? arrayCopy(value) : []);\n }\n else if (isPlainObject(srcValue) || isArguments(srcValue)) {\n result = isArguments(value)\n ? toPlainObject(value)\n : (isPlainObject(value) ? value : {});\n }\n else {\n isCommon = false;\n }\n }\n // Add the source value to the stack of traversed objects and associate\n // it with its merged value.\n stackA.push(srcValue);\n stackB.push(result);\n\n if (isCommon) {\n // Recursively merge objects and arrays (susceptible to call stack limits).\n object[key] = mergeFunc(result, srcValue, customizer, stackA, stackB);\n } else if (result === result ? (result !== value) : (value === value)) {\n object[key] = result;\n }\n}\n\nmodule.exports = baseMergeDeep;\n","/**\n * The base implementation of `_.property` without support for deep paths.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @returns {Function} Returns the new function.\n */\nfunction baseProperty(key) {\n return function(object) {\n return object == null ? undefined : object[key];\n };\n}\n\nmodule.exports = baseProperty;\n","var baseGet = require(345),\n toPath = require(418);\n\n/**\n * A specialized version of `baseProperty` which supports deep paths.\n *\n * @private\n * @param {Array|string} path The path of the property to get.\n * @returns {Function} Returns the new function.\n */\nfunction basePropertyDeep(path) {\n var pathKey = (path + '');\n path = toPath(path);\n return function(object) {\n return baseGet(object, path, pathKey);\n };\n}\n\nmodule.exports = basePropertyDeep;\n","/**\n * The base implementation of `_.reduce` and `_.reduceRight` without support\n * for callback shorthands and `this` binding, which iterates over `collection`\n * using the provided `eachFunc`.\n *\n * @private\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} accumulator The initial value.\n * @param {boolean} initFromCollection Specify using the first or last element\n * of `collection` as the initial value.\n * @param {Function} eachFunc The function to iterate over `collection`.\n * @returns {*} Returns the accumulated value.\n */\nfunction baseReduce(collection, iteratee, accumulator, initFromCollection, eachFunc) {\n eachFunc(collection, function(value, index, collection) {\n accumulator = initFromCollection\n ? (initFromCollection = false, value)\n : iteratee(accumulator, value, index, collection);\n });\n return accumulator;\n}\n\nmodule.exports = baseReduce;\n","var identity = require(441),\n metaMap = require(408);\n\n/**\n * The base implementation of `setData` without support for hot loop detection.\n *\n * @private\n * @param {Function} func The function to associate metadata with.\n * @param {*} data The metadata.\n * @returns {Function} Returns `func`.\n */\nvar baseSetData = !metaMap ? identity : function(func, data) {\n metaMap.set(func, data);\n return func;\n};\n\nmodule.exports = baseSetData;\n","/**\n * The base implementation of `_.slice` without an iteratee call guard.\n *\n * @private\n * @param {Array} array The array to slice.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the slice of `array`.\n */\nfunction baseSlice(array, start, end) {\n var index = -1,\n length = array.length;\n\n start = start == null ? 0 : (+start || 0);\n if (start < 0) {\n start = -start > length ? 0 : (length + start);\n }\n end = (end === undefined || end > length) ? length : (+end || 0);\n if (end < 0) {\n end += length;\n }\n length = start > end ? 0 : ((end - start) >>> 0);\n start >>>= 0;\n\n var result = Array(length);\n while (++index < length) {\n result[index] = array[index + start];\n }\n return result;\n}\n\nmodule.exports = baseSlice;\n","var baseEach = require(336);\n\n/**\n * The base implementation of `_.some` without support for callback shorthands\n * and `this` binding.\n *\n * @private\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\nfunction baseSome(collection, predicate) {\n var result;\n\n baseEach(collection, function(value, index, collection) {\n result = predicate(value, index, collection);\n return !result;\n });\n return !!result;\n}\n\nmodule.exports = baseSome;\n","/**\n * The base implementation of `_.sortBy` which uses `comparer` to define\n * the sort order of `array` and replaces criteria objects with their\n * corresponding values.\n *\n * @private\n * @param {Array} array The array to sort.\n * @param {Function} comparer The function to define sort order.\n * @returns {Array} Returns `array`.\n */\nfunction baseSortBy(array, comparer) {\n var length = array.length;\n\n array.sort(comparer);\n while (length--) {\n array[length] = array[length].value;\n }\n return array;\n}\n\nmodule.exports = baseSortBy;\n","/**\n * Converts `value` to a string if it's not one. An empty string is returned\n * for `null` or `undefined` values.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\nfunction baseToString(value) {\n return value == null ? '' : (value + '');\n}\n\nmodule.exports = baseToString;\n","var baseIndexOf = require(346),\n cacheIndexOf = require(368),\n createCache = require(378);\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/**\n * The base implementation of `_.uniq` without support for callback shorthands\n * and `this` binding.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee] The function invoked per iteration.\n * @returns {Array} Returns the new duplicate free array.\n */\nfunction baseUniq(array, iteratee) {\n var index = -1,\n indexOf = baseIndexOf,\n length = array.length,\n isCommon = true,\n isLarge = isCommon && length >= LARGE_ARRAY_SIZE,\n seen = isLarge ? createCache() : null,\n result = [];\n\n if (seen) {\n indexOf = cacheIndexOf;\n isCommon = false;\n } else {\n isLarge = false;\n seen = iteratee ? [] : result;\n }\n outer:\n while (++index < length) {\n var value = array[index],\n computed = iteratee ? iteratee(value, index, array) : value;\n\n if (isCommon && value === value) {\n var seenIndex = seen.length;\n while (seenIndex--) {\n if (seen[seenIndex] === computed) {\n continue outer;\n }\n }\n if (iteratee) {\n seen.push(computed);\n }\n result.push(value);\n }\n else if (indexOf(seen, computed, 0) < 0) {\n if (iteratee || isLarge) {\n seen.push(computed);\n }\n result.push(value);\n }\n }\n return result;\n}\n\nmodule.exports = baseUniq;\n","/**\n * The base implementation of `_.values` and `_.valuesIn` which creates an\n * array of `object` property values corresponding to the property names\n * of `props`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} props The property names to get values for.\n * @returns {Object} Returns the array of property values.\n */\nfunction baseValues(object, props) {\n var index = -1,\n length = props.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = object[props[index]];\n }\n return result;\n}\n\nmodule.exports = baseValues;\n","var identity = require(441);\n\n/**\n * A specialized version of `baseCallback` which only supports `this` binding\n * and specifying the number of arguments to provide to `func`.\n *\n * @private\n * @param {Function} func The function to bind.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {number} [argCount] The number of arguments to provide to `func`.\n * @returns {Function} Returns the callback.\n */\nfunction bindCallback(func, thisArg, argCount) {\n if (typeof func != 'function') {\n return identity;\n }\n if (thisArg === undefined) {\n return func;\n }\n switch (argCount) {\n case 1: return function(value) {\n return func.call(thisArg, value);\n };\n case 3: return function(value, index, collection) {\n return func.call(thisArg, value, index, collection);\n };\n case 4: return function(accumulator, value, index, collection) {\n return func.call(thisArg, accumulator, value, index, collection);\n };\n case 5: return function(value, other, key, object, source) {\n return func.call(thisArg, value, other, key, object, source);\n };\n }\n return function() {\n return func.apply(thisArg, arguments);\n };\n}\n\nmodule.exports = bindCallback;\n","/** Native method references. */\nvar ArrayBuffer = global.ArrayBuffer,\n Uint8Array = global.Uint8Array;\n\n/**\n * Creates a clone of the given array buffer.\n *\n * @private\n * @param {ArrayBuffer} buffer The array buffer to clone.\n * @returns {ArrayBuffer} Returns the cloned array buffer.\n */\nfunction bufferClone(buffer) {\n var result = new ArrayBuffer(buffer.byteLength),\n view = new Uint8Array(result);\n\n view.set(new Uint8Array(buffer));\n return result;\n}\n\nmodule.exports = bufferClone;\n","var isObject = require(426);\n\n/**\n * Checks if `value` is in `cache` mimicking the return signature of\n * `_.indexOf` by returning `0` if the value is found, else `-1`.\n *\n * @private\n * @param {Object} cache The cache to search.\n * @param {*} value The value to search for.\n * @returns {number} Returns `0` if `value` is found, else `-1`.\n */\nfunction cacheIndexOf(cache, value) {\n var data = cache.data,\n result = (typeof value == 'string' || isObject(value)) ? data.set.has(value) : data.hash[value];\n\n return result ? 0 : -1;\n}\n\nmodule.exports = cacheIndexOf;\n","var isObject = require(426);\n\n/**\n * Adds `value` to the cache.\n *\n * @private\n * @name push\n * @memberOf SetCache\n * @param {*} value The value to cache.\n */\nfunction cachePush(value) {\n var data = this.data;\n if (typeof value == 'string' || isObject(value)) {\n data.set.add(value);\n } else {\n data.hash[value] = true;\n }\n}\n\nmodule.exports = cachePush;\n","var baseCompareAscending = require(331);\n\n/**\n * Used by `_.sortBy` to compare transformed elements of a collection and stable\n * sort them in ascending order.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @returns {number} Returns the sort order indicator for `object`.\n */\nfunction compareAscending(object, other) {\n return baseCompareAscending(object.criteria, other.criteria) || (object.index - other.index);\n}\n\nmodule.exports = compareAscending;\n","/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * Creates an array that is the composition of partially applied arguments,\n * placeholders, and provided arguments into a single array of arguments.\n *\n * @private\n * @param {Array|Object} args The provided arguments.\n * @param {Array} partials The arguments to prepend to those provided.\n * @param {Array} holders The `partials` placeholder indexes.\n * @returns {Array} Returns the new array of composed arguments.\n */\nfunction composeArgs(args, partials, holders) {\n var holdersLength = holders.length,\n argsIndex = -1,\n argsLength = nativeMax(args.length - holdersLength, 0),\n leftIndex = -1,\n leftLength = partials.length,\n result = Array(leftLength + argsLength);\n\n while (++leftIndex < leftLength) {\n result[leftIndex] = partials[leftIndex];\n }\n while (++argsIndex < holdersLength) {\n result[holders[argsIndex]] = args[argsIndex];\n }\n while (argsLength--) {\n result[leftIndex++] = args[argsIndex++];\n }\n return result;\n}\n\nmodule.exports = composeArgs;\n","/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * This function is like `composeArgs` except that the arguments composition\n * is tailored for `_.partialRight`.\n *\n * @private\n * @param {Array|Object} args The provided arguments.\n * @param {Array} partials The arguments to append to those provided.\n * @param {Array} holders The `partials` placeholder indexes.\n * @returns {Array} Returns the new array of composed arguments.\n */\nfunction composeArgsRight(args, partials, holders) {\n var holdersIndex = -1,\n holdersLength = holders.length,\n argsIndex = -1,\n argsLength = nativeMax(args.length - holdersLength, 0),\n rightIndex = -1,\n rightLength = partials.length,\n result = Array(argsLength + rightLength);\n\n while (++argsIndex < argsLength) {\n result[argsIndex] = args[argsIndex];\n }\n var offset = argsIndex;\n while (++rightIndex < rightLength) {\n result[offset + rightIndex] = partials[rightIndex];\n }\n while (++holdersIndex < holdersLength) {\n result[offset + holders[holdersIndex]] = args[argsIndex++];\n }\n return result;\n}\n\nmodule.exports = composeArgsRight;\n","var baseCallback = require(329),\n baseEach = require(336),\n isArray = require(422);\n\n/**\n * Creates a `_.countBy`, `_.groupBy`, `_.indexBy`, or `_.partition` function.\n *\n * @private\n * @param {Function} setter The function to set keys and values of the accumulator object.\n * @param {Function} [initializer] The function to initialize the accumulator object.\n * @returns {Function} Returns the new aggregator function.\n */\nfunction createAggregator(setter, initializer) {\n return function(collection, iteratee, thisArg) {\n var result = initializer ? initializer() : {};\n iteratee = baseCallback(iteratee, thisArg, 3);\n\n if (isArray(collection)) {\n var index = -1,\n length = collection.length;\n\n while (++index < length) {\n var value = collection[index];\n setter(result, value, iteratee(value, index, collection), collection);\n }\n } else {\n baseEach(collection, function(value, key, collection) {\n setter(result, value, iteratee(value, key, collection), collection);\n });\n }\n return result;\n };\n}\n\nmodule.exports = createAggregator;\n","var bindCallback = require(366),\n isIterateeCall = require(401),\n restParam = require(315);\n\n/**\n * Creates a `_.assign`, `_.defaults`, or `_.merge` function.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\nfunction createAssigner(assigner) {\n return restParam(function(object, sources) {\n var index = -1,\n length = object == null ? 0 : sources.length,\n customizer = length > 2 ? sources[length - 2] : undefined,\n guard = length > 2 ? sources[2] : undefined,\n thisArg = length > 1 ? sources[length - 1] : undefined;\n\n if (typeof customizer == 'function') {\n customizer = bindCallback(customizer, thisArg, 5);\n length -= 2;\n } else {\n customizer = typeof thisArg == 'function' ? thisArg : undefined;\n length -= (customizer ? 1 : 0);\n }\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, customizer);\n }\n }\n return object;\n });\n}\n\nmodule.exports = createAssigner;\n","var getLength = require(392),\n isLength = require(404),\n toObject = require(417);\n\n/**\n * Creates a `baseEach` or `baseEachRight` function.\n *\n * @private\n * @param {Function} eachFunc The function to iterate over a collection.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseEach(eachFunc, fromRight) {\n return function(collection, iteratee) {\n var length = collection ? getLength(collection) : 0;\n if (!isLength(length)) {\n return eachFunc(collection, iteratee);\n }\n var index = fromRight ? length : -1,\n iterable = toObject(collection);\n\n while ((fromRight ? index-- : ++index < length)) {\n if (iteratee(iterable[index], index, iterable) === false) {\n break;\n }\n }\n return collection;\n };\n}\n\nmodule.exports = createBaseEach;\n","var toObject = require(417);\n\n/**\n * Creates a base function for `_.forIn` or `_.forInRight`.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseFor(fromRight) {\n return function(object, iteratee, keysFunc) {\n var iterable = toObject(object),\n props = keysFunc(object),\n length = props.length,\n index = fromRight ? length : -1;\n\n while ((fromRight ? index-- : ++index < length)) {\n var key = props[index];\n if (iteratee(iterable[key], key, iterable) === false) {\n break;\n }\n }\n return object;\n };\n}\n\nmodule.exports = createBaseFor;\n","var createCtorWrapper = require('./createCtorWrapper');\n\n/**\n * Creates a function that wraps `func` and invokes it with the `this`\n * binding of `thisArg`.\n *\n * @private\n * @param {Function} func The function to bind.\n * @param {*} [thisArg] The `this` binding of `func`.\n * @returns {Function} Returns the new bound function.\n */\nfunction createBindWrapper(func, thisArg) {\n var Ctor = createCtorWrapper(func);\n\n function wrapper() {\n var fn = (this && this !== global && this instanceof wrapper) ? Ctor : func;\n return fn.apply(thisArg, arguments);\n }\n return wrapper;\n}\n\nmodule.exports = createBindWrapper;\n","var SetCache = require('./SetCache'),\n getNative = require('./getNative');\n\n/** Native method references. */\nvar Set = getNative(global, 'Set');\n\n/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeCreate = getNative(Object, 'create');\n\n/**\n * Creates a `Set` cache object to optimize linear searches of large arrays.\n *\n * @private\n * @param {Array} [values] The values to cache.\n * @returns {null|Object} Returns the new cache object if `Set` is supported, else `null`.\n */\nfunction createCache(values) {\n return (nativeCreate && Set) ? new SetCache(values) : null;\n}\n\nmodule.exports = createCache;\n","var baseCreate = require(333),\n isObject = require(426);\n\n/**\n * Creates a function that produces an instance of `Ctor` regardless of\n * whether it was invoked as part of a `new` expression or by `call` or `apply`.\n *\n * @private\n * @param {Function} Ctor The constructor to wrap.\n * @returns {Function} Returns the new wrapped function.\n */\nfunction createCtorWrapper(Ctor) {\n return function() {\n // Use a `switch` statement to work with class constructors.\n // See http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist\n // for more details.\n var args = arguments;\n switch (args.length) {\n case 0: return new Ctor;\n case 1: return new Ctor(args[0]);\n case 2: return new Ctor(args[0], args[1]);\n case 3: return new Ctor(args[0], args[1], args[2]);\n case 4: return new Ctor(args[0], args[1], args[2], args[3]);\n case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);\n case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);\n case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);\n }\n var thisBinding = baseCreate(Ctor.prototype),\n result = Ctor.apply(thisBinding, args);\n\n // Mimic the constructor's `return` behavior.\n // See https://es5.github.io/#x13.2.2 for more details.\n return isObject(result) ? result : thisBinding;\n };\n}\n\nmodule.exports = createCtorWrapper;\n","var baseCallback = require(329),\n baseFind = require(339),\n baseFindIndex = require(340),\n isArray = require(422);\n\n/**\n * Creates a `_.find` or `_.findLast` function.\n *\n * @private\n * @param {Function} eachFunc The function to iterate over a collection.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new find function.\n */\nfunction createFind(eachFunc, fromRight) {\n return function(collection, predicate, thisArg) {\n predicate = baseCallback(predicate, thisArg, 3);\n if (isArray(collection)) {\n var index = baseFindIndex(collection, predicate, fromRight);\n return index > -1 ? collection[index] : undefined;\n }\n return baseFind(collection, predicate, eachFunc);\n };\n}\n\nmodule.exports = createFind;\n","var baseCallback = require(329),\n baseFindIndex = require(340);\n\n/**\n * Creates a `_.findIndex` or `_.findLastIndex` function.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new find function.\n */\nfunction createFindIndex(fromRight) {\n return function(array, predicate, thisArg) {\n if (!(array && array.length)) {\n return -1;\n }\n predicate = baseCallback(predicate, thisArg, 3);\n return baseFindIndex(array, predicate, fromRight);\n };\n}\n\nmodule.exports = createFindIndex;\n","var bindCallback = require(366),\n isArray = require(422);\n\n/**\n * Creates a function for `_.forEach` or `_.forEachRight`.\n *\n * @private\n * @param {Function} arrayFunc The function to iterate over an array.\n * @param {Function} eachFunc The function to iterate over a collection.\n * @returns {Function} Returns the new each function.\n */\nfunction createForEach(arrayFunc, eachFunc) {\n return function(collection, iteratee, thisArg) {\n return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection))\n ? arrayFunc(collection, iteratee)\n : eachFunc(collection, bindCallback(iteratee, thisArg, 3));\n };\n}\n\nmodule.exports = createForEach;\n","var arrayCopy = require('./arrayCopy'),\n composeArgs = require('./composeArgs'),\n composeArgsRight = require('./composeArgsRight'),\n createCtorWrapper = require('./createCtorWrapper'),\n isLaziable = require('./isLaziable'),\n reorder = require('./reorder'),\n replaceHolders = require('./replaceHolders'),\n setData = require('./setData');\n\n/** Used to compose bitmasks for wrapper metadata. */\nvar BIND_FLAG = 1,\n BIND_KEY_FLAG = 2,\n CURRY_BOUND_FLAG = 4,\n CURRY_FLAG = 8,\n CURRY_RIGHT_FLAG = 16,\n PARTIAL_FLAG = 32,\n PARTIAL_RIGHT_FLAG = 64,\n ARY_FLAG = 128;\n\n/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * Creates a function that wraps `func` and invokes it with optional `this`\n * binding of, partial application, and currying.\n *\n * @private\n * @param {Function|string} func The function or method name to reference.\n * @param {number} bitmask The bitmask of flags. See `createWrapper` for more details.\n * @param {*} [thisArg] The `this` binding of `func`.\n * @param {Array} [partials] The arguments to prepend to those provided to the new function.\n * @param {Array} [holders] The `partials` placeholder indexes.\n * @param {Array} [partialsRight] The arguments to append to those provided to the new function.\n * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.\n * @param {Array} [argPos] The argument positions of the new function.\n * @param {number} [ary] The arity cap of `func`.\n * @param {number} [arity] The arity of `func`.\n * @returns {Function} Returns the new wrapped function.\n */\nfunction createHybridWrapper(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {\n var isAry = bitmask & ARY_FLAG,\n isBind = bitmask & BIND_FLAG,\n isBindKey = bitmask & BIND_KEY_FLAG,\n isCurry = bitmask & CURRY_FLAG,\n isCurryBound = bitmask & CURRY_BOUND_FLAG,\n isCurryRight = bitmask & CURRY_RIGHT_FLAG,\n Ctor = isBindKey ? undefined : createCtorWrapper(func);\n\n function wrapper() {\n // Avoid `arguments` object use disqualifying optimizations by\n // converting it to an array before providing it to other functions.\n var length = arguments.length,\n index = length,\n args = Array(length);\n\n while (index--) {\n args[index] = arguments[index];\n }\n if (partials) {\n args = composeArgs(args, partials, holders);\n }\n if (partialsRight) {\n args = composeArgsRight(args, partialsRight, holdersRight);\n }\n if (isCurry || isCurryRight) {\n var placeholder = wrapper.placeholder,\n argsHolders = replaceHolders(args, placeholder);\n\n length -= argsHolders.length;\n if (length < arity) {\n var newArgPos = argPos ? arrayCopy(argPos) : undefined,\n newArity = nativeMax(arity - length, 0),\n newsHolders = isCurry ? argsHolders : undefined,\n newHoldersRight = isCurry ? undefined : argsHolders,\n newPartials = isCurry ? args : undefined,\n newPartialsRight = isCurry ? undefined : args;\n\n bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG);\n bitmask &= ~(isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG);\n\n if (!isCurryBound) {\n bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG);\n }\n var newData = [func, bitmask, thisArg, newPartials, newsHolders, newPartialsRight, newHoldersRight, newArgPos, ary, newArity],\n result = createHybridWrapper.apply(undefined, newData);\n\n if (isLaziable(func)) {\n setData(result, newData);\n }\n result.placeholder = placeholder;\n return result;\n }\n }\n var thisBinding = isBind ? thisArg : this,\n fn = isBindKey ? thisBinding[func] : func;\n\n if (argPos) {\n args = reorder(args, argPos);\n }\n if (isAry && ary < args.length) {\n args.length = ary;\n }\n if (this && this !== global && this instanceof wrapper) {\n fn = Ctor || createCtorWrapper(func);\n }\n return fn.apply(thisBinding, args);\n }\n return wrapper;\n}\n\nmodule.exports = createHybridWrapper;\n","var createCtorWrapper = require('./createCtorWrapper');\n\n/** Used to compose bitmasks for wrapper metadata. */\nvar BIND_FLAG = 1;\n\n/**\n * Creates a function that wraps `func` and invokes it with the optional `this`\n * binding of `thisArg` and the `partials` prepended to those provided to\n * the wrapper.\n *\n * @private\n * @param {Function} func The function to partially apply arguments to.\n * @param {number} bitmask The bitmask of flags. See `createWrapper` for more details.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} partials The arguments to prepend to those provided to the new function.\n * @returns {Function} Returns the new bound function.\n */\nfunction createPartialWrapper(func, bitmask, thisArg, partials) {\n var isBind = bitmask & BIND_FLAG,\n Ctor = createCtorWrapper(func);\n\n function wrapper() {\n // Avoid `arguments` object use disqualifying optimizations by\n // converting it to an array before providing it `func`.\n var argsIndex = -1,\n argsLength = arguments.length,\n leftIndex = -1,\n leftLength = partials.length,\n args = Array(leftLength + argsLength);\n\n while (++leftIndex < leftLength) {\n args[leftIndex] = partials[leftIndex];\n }\n while (argsLength--) {\n args[leftIndex++] = arguments[++argsIndex];\n }\n var fn = (this && this !== global && this instanceof wrapper) ? Ctor : func;\n return fn.apply(isBind ? thisArg : this, args);\n }\n return wrapper;\n}\n\nmodule.exports = createPartialWrapper;\n","var baseCallback = require(329),\n baseReduce = require(358),\n isArray = require(422);\n\n/**\n * Creates a function for `_.reduce` or `_.reduceRight`.\n *\n * @private\n * @param {Function} arrayFunc The function to iterate over an array.\n * @param {Function} eachFunc The function to iterate over a collection.\n * @returns {Function} Returns the new each function.\n */\nfunction createReduce(arrayFunc, eachFunc) {\n return function(collection, iteratee, accumulator, thisArg) {\n var initFromArray = arguments.length < 3;\n return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection))\n ? arrayFunc(collection, iteratee, accumulator, initFromArray)\n : baseReduce(collection, baseCallback(iteratee, thisArg, 4), accumulator, initFromArray, eachFunc);\n };\n}\n\nmodule.exports = createReduce;\n","var baseSetData = require(359),\n createBindWrapper = require(377),\n createHybridWrapper = require(383),\n createPartialWrapper = require(384),\n getData = require(390),\n mergeData = require(407),\n setData = require(414);\n\n/** Used to compose bitmasks for wrapper metadata. */\nvar BIND_FLAG = 1,\n BIND_KEY_FLAG = 2,\n PARTIAL_FLAG = 32,\n PARTIAL_RIGHT_FLAG = 64;\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * Creates a function that either curries or invokes `func` with optional\n * `this` binding and partially applied arguments.\n *\n * @private\n * @param {Function|string} func The function or method name to reference.\n * @param {number} bitmask The bitmask of flags.\n * The bitmask may be composed of the following flags:\n * 1 - `_.bind`\n * 2 - `_.bindKey`\n * 4 - `_.curry` or `_.curryRight` of a bound function\n * 8 - `_.curry`\n * 16 - `_.curryRight`\n * 32 - `_.partial`\n * 64 - `_.partialRight`\n * 128 - `_.rearg`\n * 256 - `_.ary`\n * @param {*} [thisArg] The `this` binding of `func`.\n * @param {Array} [partials] The arguments to be partially applied.\n * @param {Array} [holders] The `partials` placeholder indexes.\n * @param {Array} [argPos] The argument positions of the new function.\n * @param {number} [ary] The arity cap of `func`.\n * @param {number} [arity] The arity of `func`.\n * @returns {Function} Returns the new wrapped function.\n */\nfunction createWrapper(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {\n var isBindKey = bitmask & BIND_KEY_FLAG;\n if (!isBindKey && typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n var length = partials ? partials.length : 0;\n if (!length) {\n bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG);\n partials = holders = undefined;\n }\n length -= (holders ? holders.length : 0);\n if (bitmask & PARTIAL_RIGHT_FLAG) {\n var partialsRight = partials,\n holdersRight = holders;\n\n partials = holders = undefined;\n }\n var data = isBindKey ? undefined : getData(func),\n newData = [func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity];\n\n if (data) {\n mergeData(newData, data);\n bitmask = newData[1];\n arity = newData[9];\n }\n newData[9] = arity == null\n ? (isBindKey ? 0 : func.length)\n : (nativeMax(arity - length, 0) || 0);\n\n if (bitmask == BIND_FLAG) {\n var result = createBindWrapper(newData[0], newData[2]);\n } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !newData[4].length) {\n result = createPartialWrapper.apply(undefined, newData);\n } else {\n result = createHybridWrapper.apply(undefined, newData);\n }\n var setter = data ? baseSetData : setData;\n return setter(result, newData);\n}\n\nmodule.exports = createWrapper;\n","var arraySome = require(326);\n\n/**\n * A specialized version of `baseIsEqualDeep` for arrays with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Array} array The array to compare.\n * @param {Array} other The other array to compare.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Function} [customizer] The function to customize comparing arrays.\n * @param {boolean} [isLoose] Specify performing partial comparisons.\n * @param {Array} [stackA] Tracks traversed `value` objects.\n * @param {Array} [stackB] Tracks traversed `other` objects.\n * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.\n */\nfunction equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) {\n var index = -1,\n arrLength = array.length,\n othLength = other.length;\n\n if (arrLength != othLength && !(isLoose && othLength > arrLength)) {\n return false;\n }\n // Ignore non-index properties.\n while (++index < arrLength) {\n var arrValue = array[index],\n othValue = other[index],\n result = customizer ? customizer(isLoose ? othValue : arrValue, isLoose ? arrValue : othValue, index) : undefined;\n\n if (result !== undefined) {\n if (result) {\n continue;\n }\n return false;\n }\n // Recursively compare arrays (susceptible to call stack limits).\n if (isLoose) {\n if (!arraySome(other, function(othValue) {\n return arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB);\n })) {\n return false;\n }\n } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB))) {\n return false;\n }\n }\n return true;\n}\n\nmodule.exports = equalArrays;\n","/** `Object#toString` result references. */\nvar boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n numberTag = '[object Number]',\n regexpTag = '[object RegExp]',\n stringTag = '[object String]';\n\n/**\n * A specialized version of `baseIsEqualDeep` for comparing objects of\n * the same `toStringTag`.\n *\n * **Note:** This function only supports comparing values with tags of\n * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {string} tag The `toStringTag` of the objects to compare.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalByTag(object, other, tag) {\n switch (tag) {\n case boolTag:\n case dateTag:\n // Coerce dates and booleans to numbers, dates to milliseconds and booleans\n // to `1` or `0` treating invalid dates coerced to `NaN` as not equal.\n return +object == +other;\n\n case errorTag:\n return object.name == other.name && object.message == other.message;\n\n case numberTag:\n // Treat `NaN` vs. `NaN` as equal.\n return (object != +object)\n ? other != +other\n : object == +other;\n\n case regexpTag:\n case stringTag:\n // Coerce regexes to strings and treat strings primitives and string\n // objects as equal. See https://es5.github.io/#x15.10.6.4 for more details.\n return object == (other + '');\n }\n return false;\n}\n\nmodule.exports = equalByTag;\n","var keys = require(433);\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * A specialized version of `baseIsEqualDeep` for objects with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Function} [customizer] The function to customize comparing values.\n * @param {boolean} [isLoose] Specify performing partial comparisons.\n * @param {Array} [stackA] Tracks traversed `value` objects.\n * @param {Array} [stackB] Tracks traversed `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalObjects(object, other, equalFunc, customizer, isLoose, stackA, stackB) {\n var objProps = keys(object),\n objLength = objProps.length,\n othProps = keys(other),\n othLength = othProps.length;\n\n if (objLength != othLength && !isLoose) {\n return false;\n }\n var index = objLength;\n while (index--) {\n var key = objProps[index];\n if (!(isLoose ? key in other : hasOwnProperty.call(other, key))) {\n return false;\n }\n }\n var skipCtor = isLoose;\n while (++index < objLength) {\n key = objProps[index];\n var objValue = object[key],\n othValue = other[key],\n result = customizer ? customizer(isLoose ? othValue : objValue, isLoose? objValue : othValue, key) : undefined;\n\n // Recursively compare objects (susceptible to call stack limits).\n if (!(result === undefined ? equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB) : result)) {\n return false;\n }\n skipCtor || (skipCtor = key == 'constructor');\n }\n if (!skipCtor) {\n var objCtor = object.constructor,\n othCtor = other.constructor;\n\n // Non `Object` object instances with different constructors are not equal.\n if (objCtor != othCtor &&\n ('constructor' in object && 'constructor' in other) &&\n !(typeof objCtor == 'function' && objCtor instanceof objCtor &&\n typeof othCtor == 'function' && othCtor instanceof othCtor)) {\n return false;\n }\n }\n return true;\n}\n\nmodule.exports = equalObjects;\n","var metaMap = require(408),\n noop = require(442);\n\n/**\n * Gets metadata for `func`.\n *\n * @private\n * @param {Function} func The function to query.\n * @returns {*} Returns the metadata for `func`.\n */\nvar getData = !metaMap ? noop : function(func) {\n return metaMap.get(func);\n};\n\nmodule.exports = getData;\n","var realNames = require(411);\n\n/**\n * Gets the name of `func`.\n *\n * @private\n * @param {Function} func The function to query.\n * @returns {string} Returns the function name.\n */\nfunction getFuncName(func) {\n var result = (func.name + ''),\n array = realNames[result],\n length = array ? array.length : 0;\n\n while (length--) {\n var data = array[length],\n otherFunc = data.func;\n if (otherFunc == null || otherFunc == func) {\n return data.name;\n }\n }\n return result;\n}\n\nmodule.exports = getFuncName;\n","var baseProperty = require(356);\n\n/**\n * Gets the \"length\" property value of `object`.\n *\n * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)\n * that affects Safari on at least iOS 8.1-8.3 ARM64.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {*} Returns the \"length\" value.\n */\nvar getLength = baseProperty('length');\n\nmodule.exports = getLength;\n","var isStrictComparable = require(406),\n pairs = require(437);\n\n/**\n * Gets the propery names, values, and compare flags of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the match data of `object`.\n */\nfunction getMatchData(object) {\n var result = pairs(object),\n length = result.length;\n\n while (length--) {\n result[length][2] = isStrictComparable(result[length][1]);\n }\n return result;\n}\n\nmodule.exports = getMatchData;\n","var isNative = require(424);\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = object == null ? undefined : object[key];\n return isNative(value) ? value : undefined;\n}\n\nmodule.exports = getNative;\n","/**\n * Gets the index at which the first occurrence of `NaN` is found in `array`.\n *\n * @private\n * @param {Array} array The array to search.\n * @param {number} fromIndex The index to search from.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {number} Returns the index of the matched `NaN`, else `-1`.\n */\nfunction indexOfNaN(array, fromIndex, fromRight) {\n var length = array.length,\n index = fromIndex + (fromRight ? 0 : -1);\n\n while ((fromRight ? index-- : ++index < length)) {\n var other = array[index];\n if (other !== other) {\n return index;\n }\n }\n return -1;\n}\n\nmodule.exports = indexOfNaN;\n","/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Initializes an array clone.\n *\n * @private\n * @param {Array} array The array to clone.\n * @returns {Array} Returns the initialized clone.\n */\nfunction initCloneArray(array) {\n var length = array.length,\n result = new array.constructor(length);\n\n // Add array properties assigned by `RegExp#exec`.\n if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {\n result.index = array.index;\n result.input = array.input;\n }\n return result;\n}\n\nmodule.exports = initCloneArray;\n","var bufferClone = require(367);\n\n/** `Object#toString` result references. */\nvar boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n numberTag = '[object Number]',\n regexpTag = '[object RegExp]',\n stringTag = '[object String]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to match `RegExp` flags from their coerced string values. */\nvar reFlags = //w*$/;\n\n/**\n * Initializes an object clone based on its `toStringTag`.\n *\n * **Note:** This function only supports cloning values with tags of\n * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n *\n * @private\n * @param {Object} object The object to clone.\n * @param {string} tag The `toStringTag` of the object to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneByTag(object, tag, isDeep) {\n var Ctor = object.constructor;\n switch (tag) {\n case arrayBufferTag:\n return bufferClone(object);\n\n case boolTag:\n case dateTag:\n return new Ctor(+object);\n\n case float32Tag: case float64Tag:\n case int8Tag: case int16Tag: case int32Tag:\n case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:\n var buffer = object.buffer;\n return new Ctor(isDeep ? bufferClone(buffer) : buffer, object.byteOffset, object.length);\n\n case numberTag:\n case stringTag:\n return new Ctor(object);\n\n case regexpTag:\n var result = new Ctor(object.source, reFlags.exec(object));\n result.lastIndex = object.lastIndex;\n }\n return result;\n}\n\nmodule.exports = initCloneByTag;\n","/**\n * Initializes an object clone.\n *\n * @private\n * @param {Object} object The object to clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneObject(object) {\n var Ctor = object.constructor;\n if (!(typeof Ctor == 'function' && Ctor instanceof Ctor)) {\n Ctor = Object;\n }\n return new Ctor;\n}\n\nmodule.exports = initCloneObject;\n","var getLength = require(392),\n isLength = require(404);\n\n/**\n * Checks if `value` is array-like.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n */\nfunction isArrayLike(value) {\n return value != null && isLength(getLength(value));\n}\n\nmodule.exports = isArrayLike;\n","/** Used to detect unsigned integer values. */\nvar reIsUint = /^/d+$/;\n\n/**\n * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)\n * of an array-like value.\n */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;\n length = length == null ? MAX_SAFE_INTEGER : length;\n return value > -1 && value % 1 == 0 && value < length;\n}\n\nmodule.exports = isIndex;\n","var isArrayLike = require(399),\n isIndex = require(400),\n isObject = require(426);\n\n/**\n * Checks if the provided arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)) {\n var other = object[index];\n return value === value ? (value === other) : (other !== other);\n }\n return false;\n}\n\nmodule.exports = isIterateeCall;\n","var isArray = require(422),\n toObject = require(417);\n\n/** Used to match property names within property paths. */\nvar reIsDeepProp = //.|/[(?:[^[/]]*|([\"'])(?:(?!/1)[^/n//]|//.)*?/1)/]/,\n reIsPlainProp = /^/w*$/;\n\n/**\n * Checks if `value` is a property name and not a property path.\n *\n * @private\n * @param {*} value The value to check.\n * @param {Object} [object] The object to query keys on.\n * @returns {boolean} Returns `true` if `value` is a property name, else `false`.\n */\nfunction isKey(value, object) {\n var type = typeof value;\n if ((type == 'string' && reIsPlainProp.test(value)) || type == 'number') {\n return true;\n }\n if (isArray(value)) {\n return false;\n }\n var result = !reIsDeepProp.test(value);\n return result || (object != null && value in toObject(object));\n}\n\nmodule.exports = isKey;\n","var LazyWrapper = require(316),\n getData = require(390),\n getFuncName = require(391),\n lodash = require(298);\n\n/**\n * Checks if `func` has a lazy counterpart.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` has a lazy counterpart, else `false`.\n */\nfunction isLaziable(func) {\n var funcName = getFuncName(func),\n other = lodash[funcName];\n\n if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {\n return false;\n }\n if (func === other) {\n return true;\n }\n var data = getData(other);\n return !!data && func === data[0];\n}\n\nmodule.exports = isLaziable;\n","/**\n * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)\n * of an array-like value.\n */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n */\nfunction isLength(value) {\n return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\nmodule.exports = isLength;\n","/**\n * Checks if `value` is object-like.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\nmodule.exports = isObjectLike;\n","var isObject = require(426);\n\n/**\n * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` if suitable for strict\n * equality comparisons, else `false`.\n */\nfunction isStrictComparable(value) {\n return value === value && !isObject(value);\n}\n\nmodule.exports = isStrictComparable;\n","var arrayCopy = require(319),\n composeArgs = require(371),\n composeArgsRight = require(372),\n replaceHolders = require(413);\n\n/** Used to compose bitmasks for wrapper metadata. */\nvar BIND_FLAG = 1,\n CURRY_BOUND_FLAG = 4,\n CURRY_FLAG = 8,\n ARY_FLAG = 128,\n REARG_FLAG = 256;\n\n/** Used as the internal argument placeholder. */\nvar PLACEHOLDER = '__lodash_placeholder__';\n\n/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeMin = Math.min;\n\n/**\n * Merges the function metadata of `source` into `data`.\n *\n * Merging metadata reduces the number of wrappers required to invoke a function.\n * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`\n * may be applied regardless of execution order. Methods like `_.ary` and `_.rearg`\n * augment function arguments, making the order in which they are executed important,\n * preventing the merging of metadata. However, we make an exception for a safe\n * common case where curried functions have `_.ary` and or `_.rearg` applied.\n *\n * @private\n * @param {Array} data The destination metadata.\n * @param {Array} source The source metadata.\n * @returns {Array} Returns `data`.\n */\nfunction mergeData(data, source) {\n var bitmask = data[1],\n srcBitmask = source[1],\n newBitmask = bitmask | srcBitmask,\n isCommon = newBitmask < ARY_FLAG;\n\n var isCombo =\n (srcBitmask == ARY_FLAG && bitmask == CURRY_FLAG) ||\n (srcBitmask == ARY_FLAG && bitmask == REARG_FLAG && data[7].length <= source[8]) ||\n (srcBitmask == (ARY_FLAG | REARG_FLAG) && bitmask == CURRY_FLAG);\n\n // Exit early if metadata can't be merged.\n if (!(isCommon || isCombo)) {\n return data;\n }\n // Use source `thisArg` if available.\n if (srcBitmask & BIND_FLAG) {\n data[2] = source[2];\n // Set when currying a bound function.\n newBitmask |= (bitmask & BIND_FLAG) ? 0 : CURRY_BOUND_FLAG;\n }\n // Compose partial arguments.\n var value = source[3];\n if (value) {\n var partials = data[3];\n data[3] = partials ? composeArgs(partials, value, source[4]) : arrayCopy(value);\n data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : arrayCopy(source[4]);\n }\n // Compose partial right arguments.\n value = source[5];\n if (value) {\n partials = data[5];\n data[5] = partials ? composeArgsRight(partials, value, source[6]) : arrayCopy(value);\n data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : arrayCopy(source[6]);\n }\n // Use source `argPos` if available.\n value = source[7];\n if (value) {\n data[7] = arrayCopy(value);\n }\n // Use source `ary` if it's smaller.\n if (srcBitmask & ARY_FLAG) {\n data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);\n }\n // Use source `arity` if one is not provided.\n if (data[9] == null) {\n data[9] = source[9];\n }\n // Use source `func` and merge bitmasks.\n data[0] = source[0];\n data[1] = newBitmask;\n\n return data;\n}\n\nmodule.exports = mergeData;\n","var getNative = require('./getNative');\n\n/** Native method references. */\nvar WeakMap = getNative(global, 'WeakMap');\n\n/** Used to store function metadata. */\nvar metaMap = WeakMap && new WeakMap;\n\nmodule.exports = metaMap;\n","var toObject = require(417);\n\n/**\n * A specialized version of `_.pick` which picks `object` properties specified\n * by `props`.\n *\n * @private\n * @param {Object} object The source object.\n * @param {string[]} props The property names to pick.\n * @returns {Object} Returns the new object.\n */\nfunction pickByArray(object, props) {\n object = toObject(object);\n\n var index = -1,\n length = props.length,\n result = {};\n\n while (++index < length) {\n var key = props[index];\n if (key in object) {\n result[key] = object[key];\n }\n }\n return result;\n}\n\nmodule.exports = pickByArray;\n","var baseForIn = require(343);\n\n/**\n * A specialized version of `_.pick` which picks `object` properties `predicate`\n * returns truthy for.\n *\n * @private\n * @param {Object} object The source object.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Object} Returns the new object.\n */\nfunction pickByCallback(object, predicate) {\n var result = {};\n baseForIn(object, function(value, key, object) {\n if (predicate(value, key, object)) {\n result[key] = value;\n }\n });\n return result;\n}\n\nmodule.exports = pickByCallback;\n","/** Used to lookup unminified function names. */\nvar realNames = {};\n\nmodule.exports = realNames;\n","var arrayCopy = require(319),\n isIndex = require(400);\n\n/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeMin = Math.min;\n\n/**\n * Reorder `array` according to the specified indexes where the element at\n * the first index is assigned as the first element, the element at\n * the second index is assigned as the second element, and so on.\n *\n * @private\n * @param {Array} array The array to reorder.\n * @param {Array} indexes The arranged array indexes.\n * @returns {Array} Returns `array`.\n */\nfunction reorder(array, indexes) {\n var arrLength = array.length,\n length = nativeMin(indexes.length, arrLength),\n oldArray = arrayCopy(array);\n\n while (length--) {\n var index = indexes[length];\n array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;\n }\n return array;\n}\n\nmodule.exports = reorder;\n","/** Used as the internal argument placeholder. */\nvar PLACEHOLDER = '__lodash_placeholder__';\n\n/**\n * Replaces all `placeholder` elements in `array` with an internal placeholder\n * and returns an array of their indexes.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {*} placeholder The placeholder to replace.\n * @returns {Array} Returns the new array of placeholder indexes.\n */\nfunction replaceHolders(array, placeholder) {\n var index = -1,\n length = array.length,\n resIndex = -1,\n result = [];\n\n while (++index < length) {\n if (array[index] === placeholder) {\n array[index] = PLACEHOLDER;\n result[++resIndex] = index;\n }\n }\n return result;\n}\n\nmodule.exports = replaceHolders;\n","var baseSetData = require(359),\n now = require(311);\n\n/** Used to detect when a function becomes hot. */\nvar HOT_COUNT = 150,\n HOT_SPAN = 16;\n\n/**\n * Sets metadata for `func`.\n *\n * **Note:** If this function becomes hot, i.e. is invoked a lot in a short\n * period of time, it will trip its breaker and transition to an identity function\n * to avoid garbage collection pauses in V8. See [V8 issue 2070](https://code.google.com/p/v8/issues/detail?id=2070)\n * for more details.\n *\n * @private\n * @param {Function} func The function to associate metadata with.\n * @param {*} data The metadata.\n * @returns {Function} Returns `func`.\n */\nvar setData = (function() {\n var count = 0,\n lastCalled = 0;\n\n return function(key, value) {\n var stamp = now(),\n remaining = HOT_SPAN - (stamp - lastCalled);\n\n lastCalled = stamp;\n if (remaining > 0) {\n if (++count >= HOT_COUNT) {\n return key;\n }\n } else {\n count = 0;\n }\n return baseSetData(key, value);\n };\n}());\n\nmodule.exports = setData;\n","var isArguments = require(421),\n isArray = require(422),\n isIndex = require(400),\n isLength = require(404),\n keysIn = require(434);\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * A fallback implementation of `Object.keys` which creates an array of the\n * own enumerable property names of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction shimKeys(object) {\n var props = keysIn(object),\n propsLength = props.length,\n length = propsLength && object.length;\n\n var allowIndexes = !!length && isLength(length) &&\n (isArray(object) || isArguments(object));\n\n var index = -1,\n result = [];\n\n while (++index < propsLength) {\n var key = props[index];\n if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = shimKeys;\n","/**\n * An implementation of `_.uniq` optimized for sorted arrays without support\n * for callback shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee] The function invoked per iteration.\n * @returns {Array} Returns the new duplicate free array.\n */\nfunction sortedUniq(array, iteratee) {\n var seen,\n index = -1,\n length = array.length,\n resIndex = -1,\n result = [];\n\n while (++index < length) {\n var value = array[index],\n computed = iteratee ? iteratee(value, index, array) : value;\n\n if (!index || seen !== computed) {\n seen = computed;\n result[++resIndex] = value;\n }\n }\n return result;\n}\n\nmodule.exports = sortedUniq;\n","var isObject = require(426);\n\n/**\n * Converts `value` to an object if it's not one.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {Object} Returns the object.\n */\nfunction toObject(value) {\n return isObject(value) ? value : Object(value);\n}\n\nmodule.exports = toObject;\n","var baseToString = require(363),\n isArray = require(422);\n\n/** Used to match property names within property paths. */\nvar rePropName = /[^.[/]]+|/[(?:(-?/d+(?:/./d+)?)|([\"'])((?:(?!/2)[^/n//]|//.)*?)/2)/]/g;\n\n/** Used to match backslashes in property paths. */\nvar reEscapeChar = ///(//)?/g;\n\n/**\n * Converts `value` to property path array if it's not one.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {Array} Returns the property path array.\n */\nfunction toPath(value) {\n if (isArray(value)) {\n return value;\n }\n var result = [];\n baseToString(value).replace(rePropName, function(match, number, quote, string) {\n result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));\n });\n return result;\n}\n\nmodule.exports = toPath;\n","var LazyWrapper = require(316),\n LodashWrapper = require(317),\n arrayCopy = require(319);\n\n/**\n * Creates a clone of `wrapper`.\n *\n * @private\n * @param {Object} wrapper The wrapper to clone.\n * @returns {Object} Returns the cloned wrapper.\n */\nfunction wrapperClone(wrapper) {\n return wrapper instanceof LazyWrapper\n ? wrapper.clone()\n : new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__, arrayCopy(wrapper.__actions__));\n}\n\nmodule.exports = wrapperClone;\n","var baseClone = require(330),\n bindCallback = require(366),\n isIterateeCall = require(401);\n\n/**\n * Creates a clone of `value`. If `isDeep` is `true` nested objects are cloned,\n * otherwise they are assigned by reference. If `customizer` is provided it's\n * invoked to produce the cloned values. If `customizer` returns `undefined`\n * cloning is handled by the method instead. The `customizer` is bound to\n * `thisArg` and invoked with up to three argument; (value [, index|key, object]).\n *\n * **Note:** This method is loosely based on the\n * [structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm).\n * The enumerable properties of `arguments` objects and objects created by\n * constructors other than `Object` are cloned to plain `Object` objects. An\n * empty object is returned for uncloneable values such as functions, DOM nodes,\n * Maps, Sets, and WeakMaps.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @param {Function} [customizer] The function to customize cloning values.\n * @param {*} [thisArg] The `this` binding of `customizer`.\n * @returns {*} Returns the cloned value.\n * @example\n *\n * var users = [\n * { 'user': 'barney' },\n * { 'user': 'fred' }\n * ];\n *\n * var shallow = _.clone(users);\n * shallow[0] === users[0];\n * // => true\n *\n * var deep = _.clone(users, true);\n * deep[0] === users[0];\n * // => false\n *\n * // using a customizer callback\n * var el = _.clone(document.body, function(value) {\n * if (_.isElement(value)) {\n * return value.cloneNode(false);\n * }\n * });\n *\n * el === document.body\n * // => false\n * el.nodeName\n * // => BODY\n * el.childNodes.length;\n * // => 0\n */\nfunction clone(value, isDeep, customizer, thisArg) {\n if (isDeep && typeof isDeep != 'boolean' && isIterateeCall(value, isDeep, customizer)) {\n isDeep = false;\n }\n else if (typeof isDeep == 'function') {\n thisArg = customizer;\n customizer = isDeep;\n isDeep = false;\n }\n return typeof customizer == 'function'\n ? baseClone(value, isDeep, bindCallback(customizer, thisArg, 3))\n : baseClone(value, isDeep);\n}\n\nmodule.exports = clone;\n","var isArrayLike = require(399),\n isObjectLike = require(405);\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Native method references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/**\n * Checks if `value` is classified as an `arguments` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nfunction isArguments(value) {\n return isObjectLike(value) && isArrayLike(value) &&\n hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');\n}\n\nmodule.exports = isArguments;\n","var getNative = require(394),\n isLength = require(404),\n isObjectLike = require(405);\n\n/** `Object#toString` result references. */\nvar arrayTag = '[object Array]';\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objToString = objectProto.toString;\n\n/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeIsArray = getNative(Array, 'isArray');\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(function() { return arguments; }());\n * // => false\n */\nvar isArray = nativeIsArray || function(value) {\n return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;\n};\n\nmodule.exports = isArray;\n","var isObject = require(426);\n\n/** `Object#toString` result references. */\nvar funcTag = '[object Function]';\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objToString = objectProto.toString;\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in older versions of Chrome and Safari which return 'function' for regexes\n // and Safari 8 which returns 'object' for typed array constructors.\n return isObject(value) && objToString.call(value) == funcTag;\n}\n\nmodule.exports = isFunction;\n","var isFunction = require(423),\n isObjectLike = require(405);\n\n/** Used to detect host constructors (Safari > 5). */\nvar reIsHostCtor = /^/[object .+?Constructor/]$/;\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar fnToString = Function.prototype.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n fnToString.call(hasOwnProperty).replace(/[//^$.*+?()[/]{}|]/g, '//$&')\n .replace(/hasOwnProperty|(function).*?(?=///()| for .+?(?=///])/g, '$1.*?') + '$'\n);\n\n/**\n * Checks if `value` is a native function.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function, else `false`.\n * @example\n *\n * _.isNative(Array.prototype.push);\n * // => true\n *\n * _.isNative(_);\n * // => false\n */\nfunction isNative(value) {\n if (value == null) {\n return false;\n }\n if (isFunction(value)) {\n return reIsNative.test(fnToString.call(value));\n }\n return isObjectLike(value) && reIsHostCtor.test(value);\n}\n\nmodule.exports = isNative;\n","var isObjectLike = require(405);\n\n/** `Object#toString` result references. */\nvar numberTag = '[object Number]';\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objToString = objectProto.toString;\n\n/**\n * Checks if `value` is classified as a `Number` primitive or object.\n *\n * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are classified\n * as numbers, use the `_.isFinite` method.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isNumber(8.4);\n * // => true\n *\n * _.isNumber(NaN);\n * // => true\n *\n * _.isNumber('8.4');\n * // => false\n */\nfunction isNumber(value) {\n return typeof value == 'number' || (isObjectLike(value) && objToString.call(value) == numberTag);\n}\n\nmodule.exports = isNumber;\n","/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(1);\n * // => false\n */\nfunction isObject(value) {\n // Avoid a V8 JIT bug in Chrome 19-20.\n // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\nmodule.exports = isObject;\n","var baseForIn = require(343),\n isArguments = require(421),\n isObjectLike = require(405);\n\n/** `Object#toString` result references. */\nvar objectTag = '[object Object]';\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objToString = objectProto.toString;\n\n/**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * **Note:** This method assumes objects created by the `Object` constructor\n * have no inherited enumerable properties.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\nfunction isPlainObject(value) {\n var Ctor;\n\n // Exit early for non `Object` objects.\n if (!(isObjectLike(value) && objToString.call(value) == objectTag && !isArguments(value)) ||\n (!hasOwnProperty.call(value, 'constructor') && (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor)))) {\n return false;\n }\n // IE < 9 iterates inherited properties before own properties. If the first\n // iterated property is an object's own property then there are no inherited\n // enumerable properties.\n var result;\n // In most environments an object's own properties are iterated before\n // its inherited properties. If the last iterated property is an object's\n // own property then there are no inherited enumerable properties.\n baseForIn(value, function(subValue, key) {\n result = key;\n });\n return result === undefined || hasOwnProperty.call(value, result);\n}\n\nmodule.exports = isPlainObject;\n","var isObjectLike = require(405);\n\n/** `Object#toString` result references. */\nvar stringTag = '[object String]';\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objToString = objectProto.toString;\n\n/**\n * Checks if `value` is classified as a `String` primitive or object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isString('abc');\n * // => true\n *\n * _.isString(1);\n * // => false\n */\nfunction isString(value) {\n return typeof value == 'string' || (isObjectLike(value) && objToString.call(value) == stringTag);\n}\n\nmodule.exports = isString;\n","var isLength = require(404),\n isObjectLike = require(405);\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dateTag] = typedArrayTags[errorTag] =\ntypedArrayTags[funcTag] = typedArrayTags[mapTag] =\ntypedArrayTags[numberTag] = typedArrayTags[objectTag] =\ntypedArrayTags[regexpTag] = typedArrayTags[setTag] =\ntypedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objToString = objectProto.toString;\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nfunction isTypedArray(value) {\n return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)];\n}\n\nmodule.exports = isTypedArray;\n","var baseCopy = require(332),\n keysIn = require(434);\n\n/**\n * Converts `value` to a plain object flattening inherited enumerable\n * properties of `value` to own properties of the plain object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {Object} Returns the converted plain object.\n * @example\n *\n * function Foo() {\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.assign({ 'a': 1 }, new Foo);\n * // => { 'a': 1, 'b': 2 }\n *\n * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));\n * // => { 'a': 1, 'b': 2, 'c': 3 }\n */\nfunction toPlainObject(value) {\n return baseCopy(value, keysIn(value));\n}\n\nmodule.exports = toPlainObject;\n","var assignWith = require(327),\n baseAssign = require(328),\n createAssigner = require(374);\n\n/**\n * Assigns own enumerable properties of source object(s) to the destination\n * object. Subsequent sources overwrite property assignments of previous sources.\n * If `customizer` is provided it's invoked to produce the assigned values.\n * The `customizer` is bound to `thisArg` and invoked with five arguments:\n * (objectValue, sourceValue, key, object, source).\n *\n * **Note:** This method mutates `object` and is based on\n * [`Object.assign`](http://ecma-international.org/ecma-262/6.0/#sec-object.assign).\n *\n * @static\n * @memberOf _\n * @alias extend\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @param {Function} [customizer] The function to customize assigned values.\n * @param {*} [thisArg] The `this` binding of `customizer`.\n * @returns {Object} Returns `object`.\n * @example\n *\n * _.assign({ 'user': 'barney' }, { 'age': 40 }, { 'user': 'fred' });\n * // => { 'user': 'fred', 'age': 40 }\n *\n * // using a customizer callback\n * var defaults = _.partialRight(_.assign, function(value, other) {\n * return _.isUndefined(value) ? other : value;\n * });\n *\n * defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });\n * // => { 'user': 'barney', 'age': 36 }\n */\nvar assign = createAssigner(function(object, source, customizer) {\n return customizer\n ? assignWith(object, source, customizer)\n : baseAssign(object, source);\n});\n\nmodule.exports = assign;\n","var baseGet = require(345),\n baseSlice = require(360),\n isArguments = require(421),\n isArray = require(422),\n isIndex = require(400),\n isKey = require(402),\n isLength = require(404),\n last = require(293),\n toPath = require(418);\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Checks if `path` is a direct property.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @returns {boolean} Returns `true` if `path` is a direct property, else `false`.\n * @example\n *\n * var object = { 'a': { 'b': { 'c': 3 } } };\n *\n * _.has(object, 'a');\n * // => true\n *\n * _.has(object, 'a.b.c');\n * // => true\n *\n * _.has(object, ['a', 'b', 'c']);\n * // => true\n */\nfunction has(object, path) {\n if (object == null) {\n return false;\n }\n var result = hasOwnProperty.call(object, path);\n if (!result && !isKey(path)) {\n path = toPath(path);\n object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));\n if (object == null) {\n return false;\n }\n path = last(path);\n result = hasOwnProperty.call(object, path);\n }\n return result || (isLength(object.length) && isIndex(path, object.length) &&\n (isArray(object) || isArguments(object)));\n}\n\nmodule.exports = has;\n","var getNative = require(394),\n isArrayLike = require(399),\n isObject = require(426),\n shimKeys = require(415);\n\n/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = getNative(Object, 'keys');\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nvar keys = !nativeKeys ? shimKeys : function(object) {\n var Ctor = object == null ? undefined : object.constructor;\n if ((typeof Ctor == 'function' && Ctor.prototype === object) ||\n (typeof object != 'function' && isArrayLike(object))) {\n return shimKeys(object);\n }\n return isObject(object) ? nativeKeys(object) : [];\n};\n\nmodule.exports = keys;\n","var isArguments = require(421),\n isArray = require(422),\n isIndex = require(400),\n isLength = require(404),\n isObject = require(426);\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\nfunction keysIn(object) {\n if (object == null) {\n return [];\n }\n if (!isObject(object)) {\n object = Object(object);\n }\n var length = object.length;\n length = (length && isLength(length) &&\n (isArray(object) || isArguments(object)) && length) || 0;\n\n var Ctor = object.constructor,\n index = -1,\n isProto = typeof Ctor == 'function' && Ctor.prototype === object,\n result = Array(length),\n skipIndexes = length > 0;\n\n while (++index < length) {\n result[index] = (index + '');\n }\n for (var key in object) {\n if (!(skipIndexes && isIndex(key, length)) &&\n !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = keysIn;\n","var baseMerge = require(354),\n createAssigner = require(374);\n\n/**\n * Recursively merges own enumerable properties of the source object(s), that\n * don't resolve to `undefined` into the destination object. Subsequent sources\n * overwrite property assignments of previous sources. If `customizer` is\n * provided it's invoked to produce the merged values of the destination and\n * source properties. If `customizer` returns `undefined` merging is handled\n * by the method instead. The `customizer` is bound to `thisArg` and invoked\n * with five arguments: (objectValue, sourceValue, key, object, source).\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @param {Function} [customizer] The function to customize assigned values.\n * @param {*} [thisArg] The `this` binding of `customizer`.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var users = {\n * 'data': [{ 'user': 'barney' }, { 'user': 'fred' }]\n * };\n *\n * var ages = {\n * 'data': [{ 'age': 36 }, { 'age': 40 }]\n * };\n *\n * _.merge(users, ages);\n * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] }\n *\n * // using a customizer callback\n * var object = {\n * 'fruits': ['apple'],\n * 'vegetables': ['beet']\n * };\n *\n * var other = {\n * 'fruits': ['banana'],\n * 'vegetables': ['carrot']\n * };\n *\n * _.merge(object, other, function(a, b) {\n * if (_.isArray(a)) {\n * return a.concat(b);\n * }\n * });\n * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] }\n */\nvar merge = createAssigner(baseMerge);\n\nmodule.exports = merge;\n","var arrayMap = require(323),\n baseDifference = require(335),\n baseFlatten = require(341),\n bindCallback = require(366),\n keysIn = require(434),\n pickByArray = require(409),\n pickByCallback = require(410),\n restParam = require(315);\n\n/**\n * The opposite of `_.pick`; this method creates an object composed of the\n * own and inherited enumerable properties of `object` that are not omitted.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The source object.\n * @param {Function|...(string|string[])} [predicate] The function invoked per\n * iteration or property names to omit, specified as individual property\n * names or arrays of property names.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'user': 'fred', 'age': 40 };\n *\n * _.omit(object, 'age');\n * // => { 'user': 'fred' }\n *\n * _.omit(object, _.isNumber);\n * // => { 'user': 'fred' }\n */\nvar omit = restParam(function(object, props) {\n if (object == null) {\n return {};\n }\n if (typeof props[0] != 'function') {\n var props = arrayMap(baseFlatten(props), String);\n return pickByArray(object, baseDifference(keysIn(object), props));\n }\n var predicate = bindCallback(props[0], props[1], 3);\n return pickByCallback(object, function(value, key, object) {\n return !predicate(value, key, object);\n });\n});\n\nmodule.exports = omit;\n","var keys = require(433),\n toObject = require(417);\n\n/**\n * Creates a two dimensional array of the key-value pairs for `object`,\n * e.g. `[[key1, value1], [key2, value2]]`.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the new array of key-value pairs.\n * @example\n *\n * _.pairs({ 'barney': 36, 'fred': 40 });\n * // => [['barney', 36], ['fred', 40]] (iteration order is not guaranteed)\n */\nfunction pairs(object) {\n object = toObject(object);\n\n var index = -1,\n props = keys(object),\n length = props.length,\n result = Array(length);\n\n while (++index < length) {\n var key = props[index];\n result[index] = [key, object[key]];\n }\n return result;\n}\n\nmodule.exports = pairs;\n","var baseFlatten = require(341),\n bindCallback = require(366),\n pickByArray = require(409),\n pickByCallback = require(410),\n restParam = require(315);\n\n/**\n * Creates an object composed of the picked `object` properties. Property\n * names may be specified as individual arguments or as arrays of property\n * names. If `predicate` is provided it's invoked for each property of `object`\n * picking the properties `predicate` returns truthy for. The predicate is\n * bound to `thisArg` and invoked with three arguments: (value, key, object).\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The source object.\n * @param {Function|...(string|string[])} [predicate] The function invoked per\n * iteration or property names to pick, specified as individual property\n * names or arrays of property names.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'user': 'fred', 'age': 40 };\n *\n * _.pick(object, 'user');\n * // => { 'user': 'fred' }\n *\n * _.pick(object, _.isString);\n * // => { 'user': 'fred' }\n */\nvar pick = restParam(function(object, props) {\n if (object == null) {\n return {};\n }\n return typeof props[0] == 'function'\n ? pickByCallback(object, bindCallback(props[0], props[1], 3))\n : pickByArray(object, baseFlatten(props));\n});\n\nmodule.exports = pick;\n","var arrayEach = require(320),\n baseCallback = require(329),\n baseCreate = require(333),\n baseForOwn = require(344),\n isArray = require(422),\n isFunction = require(423),\n isObject = require(426),\n isTypedArray = require(429);\n\n/**\n * An alternative to `_.reduce`; this method transforms `object` to a new\n * `accumulator` object which is the result of running each of its own enumerable\n * properties through `iteratee`, with each invocation potentially mutating\n * the `accumulator` object. The `iteratee` is bound to `thisArg` and invoked\n * with four arguments: (accumulator, value, key, object). Iteratee functions\n * may exit iteration early by explicitly returning `false`.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Array|Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [accumulator] The custom accumulator value.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {*} Returns the accumulated value.\n * @example\n *\n * _.transform([2, 3, 4], function(result, n) {\n * result.push(n *= n);\n * return n % 2 == 0;\n * });\n * // => [4, 9]\n *\n * _.transform({ 'a': 1, 'b': 2 }, function(result, n, key) {\n * result[key] = n * 3;\n * });\n * // => { 'a': 3, 'b': 6 }\n */\nfunction transform(object, iteratee, accumulator, thisArg) {\n var isArr = isArray(object) || isTypedArray(object);\n iteratee = baseCallback(iteratee, thisArg, 4);\n\n if (accumulator == null) {\n if (isArr || isObject(object)) {\n var Ctor = object.constructor;\n if (isArr) {\n accumulator = isArray(object) ? new Ctor : [];\n } else {\n accumulator = baseCreate(isFunction(Ctor) ? Ctor.prototype : undefined);\n }\n } else {\n accumulator = {};\n }\n }\n (isArr ? arrayEach : baseForOwn)(object, function(value, index, object) {\n return iteratee(accumulator, value, index, object);\n });\n return accumulator;\n}\n\nmodule.exports = transform;\n","var baseValues = require(365),\n keys = require(433);\n\n/**\n * Creates an array of the own enumerable property values of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property values.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.values(new Foo);\n * // => [1, 2] (iteration order is not guaranteed)\n *\n * _.values('hi');\n * // => ['h', 'i']\n */\nfunction values(object) {\n return baseValues(object, keys(object));\n}\n\nmodule.exports = values;\n","/**\n * This method returns the first argument provided to it.\n *\n * @static\n * @memberOf _\n * @category Utility\n * @param {*} value Any value.\n * @returns {*} Returns `value`.\n * @example\n *\n * var object = { 'user': 'fred' };\n *\n * _.identity(object) === object;\n * // => true\n */\nfunction identity(value) {\n return value;\n}\n\nmodule.exports = identity;\n","/**\n * A no-operation function that returns `undefined` regardless of the\n * arguments it receives.\n *\n * @static\n * @memberOf _\n * @category Utility\n * @example\n *\n * var object = { 'user': 'fred' };\n *\n * _.noop(object) === undefined;\n * // => true\n */\nfunction noop() {\n // No operation performed.\n}\n\nmodule.exports = noop;\n","var baseProperty = require(356),\n basePropertyDeep = require(357),\n isKey = require(402);\n\n/**\n * Creates a function that returns the property value at `path` on a\n * given object.\n *\n * @static\n * @memberOf _\n * @category Utility\n * @param {Array|string} path The path of the property to get.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var objects = [\n * { 'a': { 'b': { 'c': 2 } } },\n * { 'a': { 'b': { 'c': 1 } } }\n * ];\n *\n * _.map(objects, _.property('a.b.c'));\n * // => [2, 1]\n *\n * _.pluck(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c');\n * // => [1, 2]\n */\nfunction property(path) {\n return isKey(path) ? baseProperty(path) : basePropertyDeep(path);\n}\n\nmodule.exports = property;\n","/**\n * Set attribute `name` to `val`, or get attr `name`.\n *\n * @param {Element} el\n * @param {String} name\n * @param {String} [val]\n * @api public\n */\n\nmodule.exports = function(el, name, val) {\n // get\n if (arguments.length == 2) {\n return el.getAttribute(name);\n }\n\n // remove\n if (val === null) {\n return el.removeAttribute(name);\n }\n\n // set\n el.setAttribute(name, val);\n\n return el;\n};","module.exports = require(107);","module.exports = function(el) {\n\n var c;\n\n while (el.childNodes.length) {\n c = el.childNodes[0];\n el.removeChild(c);\n }\n\n return el;\n};","module.exports = require(108);","module.exports = require(109);","module.exports = require(285);","module.exports = require(110);","module.exports = require(112);","module.exports = require(113);","module.exports = function(el) {\n el.parentNode && el.parentNode.removeChild(el);\n};","'use strict';\n\nfunction hasLowerCaseAlias(pkg) {\n return pkg.xml && pkg.xml.tagAlias === 'lowerCase';\n}\n\nmodule.exports.hasLowerCaseAlias = hasLowerCaseAlias;\n\n\nmodule.exports.DEFAULT_NS_MAP = {\n 'xsi': 'http://www.w3.org/2001/XMLSchema-instance'\n};\n\nvar XSI_TYPE = module.exports.XSI_TYPE = 'xsi:type';\n\nfunction serializeFormat(element) {\n return element.xml && element.xml.serialize;\n}\n\nmodule.exports.serializeAsType = function(element) {\n return serializeFormat(element) === XSI_TYPE;\n};\n\nmodule.exports.serializeAsProperty = function(element) {\n return serializeFormat(element) === 'property';\n};","'use strict';\n\nvar forEach = require(303),\n find = require(302),\n assign = require(431),\n defer = require(314);\n\nvar Stack = require(471),\n SaxParser = require(470),\n Moddle = require(457),\n parseNameNs = require(462).parseName,\n Types = require(465),\n coerceType = Types.coerceType,\n isSimpleType = Types.isSimple,\n common = require(454),\n XSI_TYPE = common.XSI_TYPE,\n serializeAsType = common.serializeAsType,\n hasLowerCaseAlias = common.hasLowerCaseAlias;\n\nfunction capitalize(str) {\n return str.charAt(0).toUpperCase() + str.slice(1);\n}\n\nfunction aliasToName(aliasNs, pkg) {\n\n if (!hasLowerCaseAlias(pkg)) {\n return aliasNs.name;\n }\n\n return aliasNs.prefix + ':' + capitalize(aliasNs.localName);\n}\n\nfunction prefixedToName(nameNs, pkg) {\n\n var name = nameNs.name,\n localName = nameNs.localName;\n\n var typePrefix = pkg.xml && pkg.xml.typePrefix;\n\n if (typePrefix && localName.indexOf(typePrefix) === 0) {\n return nameNs.prefix + ':' + localName.slice(typePrefix.length);\n } else {\n return name;\n }\n}\n\nfunction normalizeXsiTypeName(name, model) {\n\n var nameNs = parseNameNs(name);\n var pkg = model.getPackage(nameNs.prefix);\n\n return prefixedToName(nameNs, pkg);\n}\n\nfunction error(message) {\n return new Error(message);\n}\n\n/**\n * Get the moddle descriptor for a given instance or type.\n *\n * @param {ModdleElement|Function} element\n *\n * @return {Object} the moddle descriptor\n */\nfunction getModdleDescriptor(element) {\n return element.$descriptor;\n}\n\n/**\n * A parse context.\n *\n * @class\n *\n * @param {Object} options\n * @param {ElementHandler} options.rootHandler the root handler for parsing a document\n * @param {boolean} [options.lax=false] whether or not to ignore invalid elements\n */\nfunction Context(options) {\n\n /**\n * @property {ElementHandler} rootHandler\n */\n\n /**\n * @property {Boolean} lax\n */\n\n assign(this, options);\n\n this.elementsById = {};\n this.references = [];\n this.warnings = [];\n\n /**\n * Add an unresolved reference.\n *\n * @param {Object} reference\n */\n this.addReference = function(reference) {\n this.references.push(reference);\n };\n\n /**\n * Add a processed element.\n *\n * @param {ModdleElement} element\n */\n this.addElement = function(element) {\n\n if (!element) {\n throw error('expected element');\n }\n\n var elementsById = this.elementsById;\n\n var descriptor = getModdleDescriptor(element);\n\n var idProperty = descriptor.idProperty,\n id;\n\n if (idProperty) {\n id = element.get(idProperty.name);\n\n if (id) {\n\n if (elementsById[id]) {\n throw error('duplicate ID <' + id + '>');\n }\n\n elementsById[id] = element;\n }\n }\n };\n\n /**\n * Add an import warning.\n *\n * @param {Object} warning\n * @param {String} warning.message\n * @param {Error} [warning.error]\n */\n this.addWarning = function(warning) {\n this.warnings.push(warning);\n };\n}\n\nfunction BaseHandler() {}\n\nBaseHandler.prototype.handleEnd = function() {};\nBaseHandler.prototype.handleText = function() {};\nBaseHandler.prototype.handleNode = function() {};\n\n\n/**\n * A simple pass through handler that does nothing except for\n * ignoring all input it receives.\n *\n * This is used to ignore unknown elements and\n * attributes.\n */\nfunction NoopHandler() { }\n\nNoopHandler.prototype = Object.create(BaseHandler.prototype);\n\nNoopHandler.prototype.handleNode = function() {\n return this;\n};\n\nfunction BodyHandler() {}\n\nBodyHandler.prototype = Object.create(BaseHandler.prototype);\n\nBodyHandler.prototype.handleText = function(text) {\n this.body = (this.body || '') + text;\n};\n\nfunction ReferenceHandler(property, context) {\n this.property = property;\n this.context = context;\n}\n\nReferenceHandler.prototype = Object.create(BodyHandler.prototype);\n\nReferenceHandler.prototype.handleNode = function(node) {\n\n if (this.element) {\n throw error('expected no sub nodes');\n } else {\n this.element = this.createReference(node);\n }\n\n return this;\n};\n\nReferenceHandler.prototype.handleEnd = function() {\n this.element.id = this.body;\n};\n\nReferenceHandler.prototype.createReference = function(node) {\n return {\n property: this.property.ns.name,\n id: ''\n };\n};\n\nfunction ValueHandler(propertyDesc, element) {\n this.element = element;\n this.propertyDesc = propertyDesc;\n}\n\nValueHandler.prototype = Object.create(BodyHandler.prototype);\n\nValueHandler.prototype.handleEnd = function() {\n\n var value = this.body || '',\n element = this.element,\n propertyDesc = this.propertyDesc;\n\n value = coerceType(propertyDesc.type, value);\n\n if (propertyDesc.isMany) {\n element.get(propertyDesc.name).push(value);\n } else {\n element.set(propertyDesc.name, value);\n }\n};\n\n\nfunction BaseElementHandler() {}\n\nBaseElementHandler.prototype = Object.create(BodyHandler.prototype);\n\nBaseElementHandler.prototype.handleNode = function(node) {\n var parser = this,\n element = this.element;\n\n if (!element) {\n element = this.element = this.createElement(node);\n\n this.context.addElement(element);\n } else {\n parser = this.handleChild(node);\n }\n\n return parser;\n};\n\n/**\n * @class XMLReader.ElementHandler\n *\n */\nfunction ElementHandler(model, typeName, context) {\n this.model = model;\n this.type = model.getType(typeName);\n this.context = context;\n}\n\nElementHandler.prototype = Object.create(BaseElementHandler.prototype);\n\nElementHandler.prototype.addReference = function(reference) {\n this.context.addReference(reference);\n};\n\nElementHandler.prototype.handleEnd = function() {\n\n var value = this.body,\n element = this.element,\n descriptor = getModdleDescriptor(element),\n bodyProperty = descriptor.bodyProperty;\n\n if (bodyProperty && value !== undefined) {\n value = coerceType(bodyProperty.type, value);\n element.set(bodyProperty.name, value);\n }\n};\n\n/**\n * Create an instance of the model from the given node.\n *\n * @param {Element} node the xml node\n */\nElementHandler.prototype.createElement = function(node) {\n var attributes = node.attributes,\n Type = this.type,\n descriptor = getModdleDescriptor(Type),\n context = this.context,\n instance = new Type({});\n\n forEach(attributes, function(value, name) {\n\n var prop = descriptor.propertiesByName[name],\n values;\n\n if (prop && prop.isReference) {\n\n if (!prop.isMany) {\n context.addReference({\n element: instance,\n property: prop.ns.name,\n id: value\n });\n } else {\n // IDREFS: parse references as whitespace-separated list\n values = value.split(' ');\n\n forEach(values, function(v) {\n context.addReference({\n element: instance,\n property: prop.ns.name,\n id: v\n });\n });\n }\n\n } else {\n if (prop) {\n value = coerceType(prop.type, value);\n }\n\n instance.set(name, value);\n }\n });\n\n return instance;\n};\n\nElementHandler.prototype.getPropertyForNode = function(node) {\n\n var name = node.name;\n var nameNs = parseNameNs(name);\n\n var type = this.type,\n model = this.model,\n descriptor = getModdleDescriptor(type);\n\n var propertyName = nameNs.name,\n property = descriptor.propertiesByName[propertyName],\n elementTypeName,\n elementType;\n\n // search for properties by name first\n\n if (property) {\n\n if (serializeAsType(property)) {\n elementTypeName = node.attributes[XSI_TYPE];\n\n // xsi type is optional, if it does not exists the\n // default type is assumed\n if (elementTypeName) {\n\n // take possible type prefixes from XML\n // into account, i.e.: xsi:type=\"t{ActualType}\"\n elementTypeName = normalizeXsiTypeName(elementTypeName, model);\n\n elementType = model.getType(elementTypeName);\n\n return assign({}, property, { effectiveType: getModdleDescriptor(elementType).name });\n }\n }\n\n // search for properties by name first\n return property;\n }\n\n var pkg = model.getPackage(nameNs.prefix);\n\n if (pkg) {\n elementTypeName = aliasToName(nameNs, pkg);\n elementType = model.getType(elementTypeName);\n\n // search for collection members later\n property = find(descriptor.properties, function(p) {\n return !p.isVirtual && !p.isReference && !p.isAttribute && elementType.hasType(p.type);\n });\n\n if (property) {\n return assign({}, property, { effectiveType: getModdleDescriptor(elementType).name });\n }\n } else {\n // parse unknown element (maybe extension)\n property = find(descriptor.properties, function(p) {\n return !p.isReference && !p.isAttribute && p.type === 'Element';\n });\n\n if (property) {\n return property;\n }\n }\n\n throw error('unrecognized element <' + nameNs.name + '>');\n};\n\nElementHandler.prototype.toString = function() {\n return 'ElementDescriptor[' + getModdleDescriptor(this.type).name + ']';\n};\n\nElementHandler.prototype.valueHandler = function(propertyDesc, element) {\n return new ValueHandler(propertyDesc, element);\n};\n\nElementHandler.prototype.referenceHandler = function(propertyDesc) {\n return new ReferenceHandler(propertyDesc, this.context);\n};\n\nElementHandler.prototype.handler = function(type) {\n if (type === 'Element') {\n return new GenericElementHandler(this.model, type, this.context);\n } else {\n return new ElementHandler(this.model, type, this.context);\n }\n};\n\n/**\n * Handle the child element parsing\n *\n * @param {Element} node the xml node\n */\nElementHandler.prototype.handleChild = function(node) {\n var propertyDesc, type, element, childHandler;\n\n propertyDesc = this.getPropertyForNode(node);\n element = this.element;\n\n type = propertyDesc.effectiveType || propertyDesc.type;\n\n if (isSimpleType(type)) {\n return this.valueHandler(propertyDesc, element);\n }\n\n if (propertyDesc.isReference) {\n childHandler = this.referenceHandler(propertyDesc).handleNode(node);\n } else {\n childHandler = this.handler(type).handleNode(node);\n }\n\n var newElement = childHandler.element;\n\n // child handles may decide to skip elements\n // by not returning anything\n if (newElement !== undefined) {\n\n if (propertyDesc.isMany) {\n element.get(propertyDesc.name).push(newElement);\n } else {\n element.set(propertyDesc.name, newElement);\n }\n\n if (propertyDesc.isReference) {\n assign(newElement, {\n element: element\n });\n\n this.context.addReference(newElement);\n } else {\n // establish child -> parent relationship\n newElement.$parent = element;\n }\n }\n\n return childHandler;\n};\n\n/**\n * An element handler that performs special validation\n * to ensure the node it gets initialized with matches\n * the handlers type (namespace wise).\n *\n * @param {Moddle} model\n * @param {String} typeName\n * @param {Context} context\n */\nfunction RootElementHandler(model, typeName, context) {\n ElementHandler.call(this, model, typeName, context);\n}\n\nRootElementHandler.prototype = Object.create(ElementHandler.prototype);\n\nRootElementHandler.prototype.createElement = function(node) {\n\n var name = node.name,\n nameNs = parseNameNs(name),\n model = this.model,\n type = this.type,\n pkg = model.getPackage(nameNs.prefix),\n typeName = pkg && aliasToName(nameNs, pkg) || name;\n\n // verify the correct namespace if we parse\n // the first element in the handler tree\n //\n // this ensures we don't mistakenly import wrong namespace elements\n if (!type.hasType(typeName)) {\n throw error('unexpected element <' + node.originalName + '>');\n }\n\n return ElementHandler.prototype.createElement.call(this, node);\n};\n\n\nfunction GenericElementHandler(model, typeName, context) {\n this.model = model;\n this.context = context;\n}\n\nGenericElementHandler.prototype = Object.create(BaseElementHandler.prototype);\n\nGenericElementHandler.prototype.createElement = function(node) {\n\n var name = node.name,\n ns = parseNameNs(name),\n prefix = ns.prefix,\n uri = node.ns[prefix + '$uri'],\n attributes = node.attributes;\n\n return this.model.createAny(name, uri, attributes);\n};\n\nGenericElementHandler.prototype.handleChild = function(node) {\n\n var handler = new GenericElementHandler(this.model, 'Element', this.context).handleNode(node),\n element = this.element;\n\n var newElement = handler.element,\n children;\n\n if (newElement !== undefined) {\n children = element.$children = element.$children || [];\n children.push(newElement);\n\n // establish child -> parent relationship\n newElement.$parent = element;\n }\n\n return handler;\n};\n\nGenericElementHandler.prototype.handleText = function(text) {\n this.body = this.body || '' + text;\n};\n\nGenericElementHandler.prototype.handleEnd = function() {\n if (this.body) {\n this.element.$body = this.body;\n }\n};\n\n/**\n * A reader for a meta-model\n *\n * @param {Object} options\n * @param {Model} options.model used to read xml files\n * @param {Boolean} options.lax whether to make parse errors warnings\n */\nfunction XMLReader(options) {\n\n if (options instanceof Moddle) {\n options = {\n model: options\n };\n }\n\n assign(this, { lax: false }, options);\n}\n\n\n/**\n * Parse the given XML into a moddle document tree.\n *\n * @param {String} xml\n * @param {ElementHandler|Object} options or rootHandler\n * @param {Function} done\n */\nXMLReader.prototype.fromXML = function(xml, options, done) {\n\n var rootHandler = options.rootHandler;\n\n if (options instanceof ElementHandler) {\n // root handler passed via (xml, { rootHandler: ElementHandler }, ...)\n rootHandler = options;\n options = {};\n } else {\n if (typeof options === 'string') {\n // rootHandler passed via (xml, 'someString', ...)\n rootHandler = this.handler(options);\n options = {};\n } else if (typeof rootHandler === 'string') {\n // rootHandler passed via (xml, { rootHandler: 'someString' }, ...)\n rootHandler = this.handler(rootHandler);\n }\n }\n\n var model = this.model,\n lax = this.lax;\n\n var context = new Context(assign({}, options, { rootHandler: rootHandler })),\n parser = new SaxParser({ proxy: true }),\n stack = new Stack();\n\n rootHandler.context = context;\n\n // push root handler\n stack.push(rootHandler);\n\n\n /**\n * Handle error.\n *\n * @param {Error} err\n * @param {Function} getContext\n * @param {boolean} lax\n *\n * @return {boolean} true if handled\n */\n function handleError(err, getContext, lax) {\n\n var ctx = getContext();\n\n var line = ctx.line,\n column = ctx.column,\n data = ctx.data;\n\n // we receive the full context data here,\n // for elements trim down the information\n // to the tag name, only\n if (data.charAt(0) === '<' && data.indexOf(' ') !== -1) {\n data = data.slice(0, data.indexOf(' ')) + '>';\n }\n\n var message =\n 'unparsable content ' + (data ? data + ' ' : '') + 'detected/n/t' +\n 'line: ' + line + '/n/t' +\n 'column: ' + column + '/n/t' +\n 'nested error: ' + err.message;\n\n if (lax) {\n context.addWarning({\n message: message,\n error: err\n });\n\n console.warn('could not parse node');\n console.warn(err);\n\n return true;\n } else {\n console.error('could not parse document');\n console.error(err);\n\n throw error(message);\n }\n }\n\n function handleWarning(err, getContext) {\n // just like handling errors in mode\n return handleError(err, getContext, true);\n }\n\n /**\n * Resolve collected references on parse end.\n */\n function resolveReferences() {\n\n var elementsById = context.elementsById;\n var references = context.references;\n\n var i, r;\n\n for (i = 0; (r = references[i]); i++) {\n var element = r.element;\n var reference = elementsById[r.id];\n var property = getModdleDescriptor(element).propertiesByName[r.property];\n\n if (!reference) {\n context.addWarning({\n message: 'unresolved reference <' + r.id + '>',\n element: r.element,\n property: r.property,\n value: r.id\n });\n }\n\n if (property.isMany) {\n var collection = element.get(property.name),\n idx = collection.indexOf(r);\n\n // we replace an existing place holder (idx != -1) or\n // append to the collection instead\n if (idx === -1) {\n idx = collection.length;\n }\n\n if (!reference) {\n // remove unresolvable reference\n collection.splice(idx, 1);\n } else {\n // add or update reference in collection\n collection[idx] = reference;\n }\n } else {\n element.set(property.name, reference);\n }\n }\n }\n\n function handleClose() {\n stack.pop().handleEnd();\n }\n\n function handleOpen(node, getContext) {\n var handler = stack.peek();\n\n try {\n stack.push(handler.handleNode(node));\n } catch (err) {\n\n if (handleError(err, getContext, lax)) {\n stack.push(new NoopHandler());\n }\n }\n }\n\n function handleCData(text) {\n stack.peek().handleText(text);\n }\n\n function handleText(text) {\n // strip whitespace only nodes, i.e. before\n // sections and in between tags\n text = text.trim();\n\n if (!text) {\n return;\n }\n\n stack.peek().handleText(text);\n }\n\n var uriMap = model.getPackages().reduce(function(uriMap, p) {\n uriMap[p.uri] = p.prefix;\n\n return uriMap;\n }, {});\n\n parser\n .ns(uriMap)\n .on('openTag', function(obj, decodeStr, selfClosing, getContext) {\n\n // gracefully handle unparsable attributes (attrs=false)\n var attrs = obj.attrs || {};\n\n var decodedAttrs = Object.keys(attrs).reduce(function(d, key) {\n var value = decodeStr(attrs[key]);\n\n d[key] = value;\n\n return d;\n }, {});\n\n var node = {\n name: obj.name,\n originalName: obj.originalName,\n attributes: decodedAttrs,\n ns: obj.ns\n };\n\n handleOpen(node, getContext);\n })\n .on('closeTag', handleClose)\n .on('cdata', handleCData)\n .on('text', handleText)\n .on('error', handleError)\n .on('warn', handleWarning);\n\n // deferred parse XML to make loading really ascnchronous\n // this ensures the execution environment (node or browser)\n // is kept responsive and that certain optimization strategies\n // can kick in\n defer(function() {\n var err;\n\n try {\n parser.parse(xml);\n\n resolveReferences();\n } catch (e) {\n err = e;\n }\n\n var element = rootHandler.element;\n\n // handle the situation that we could not extract\n // the desired root element from the document\n if (!err && !element) {\n err = error('failed to parse document as <' + rootHandler.type.$descriptor.name + '>');\n }\n\n done(err, err ? undefined : element, context);\n });\n};\n\nXMLReader.prototype.handler = function(name) {\n return new RootElementHandler(this.model, name);\n};\n\nmodule.exports = XMLReader;\nmodule.exports.ElementHandler = ElementHandler;","'use strict';\n\nvar map = require(305),\n forEach = require(303),\n isString = require(428),\n filter = require(301),\n assign = require(431);\n\nvar Types = require(465),\n parseNameNs = require(462).parseName,\n common = require(454),\n hasLowerCaseAlias = common.hasLowerCaseAlias,\n serializeAsType = common.serializeAsType,\n serializeAsProperty = common.serializeAsProperty;\n\nvar XML_PREAMBLE = '/n',\n ESCAPE_CHARS = /(<|>|'|\"|&|/n/r|/n)/g,\n DEFAULT_NS_MAP = common.DEFAULT_NS_MAP,\n XSI_TYPE = common.XSI_TYPE;\n\n\nfunction lower(string) {\n return string.charAt(0).toLowerCase() + string.slice(1);\n}\n\nfunction nameToAlias(name, pkg) {\n if (hasLowerCaseAlias(pkg)) {\n return lower(name);\n } else {\n return name;\n }\n}\n\nfunction inherits(ctor, superCtor) {\n ctor.super_ = superCtor;\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n}\n\nfunction nsName(ns) {\n if (isString(ns)) {\n return ns;\n } else {\n return (ns.prefix ? ns.prefix + ':' : '') + ns.localName;\n }\n}\n\nfunction getNsAttrs(namespaces) {\n\n function isUsed(ns) {\n return namespaces.used[ns.uri];\n }\n\n function toAttr(ns) {\n var name = 'xmlns' + (ns.prefix ? ':' + ns.prefix : '');\n return { name: name, value: ns.uri };\n }\n\n var allNs = [].concat(namespaces.wellknown, namespaces.custom);\n\n return map(filter(allNs, isUsed), toAttr);\n}\n\nfunction getElementNs(ns, descriptor) {\n if (descriptor.isGeneric) {\n return assign({ localName: descriptor.ns.localName }, ns);\n } else {\n return assign({ localName: nameToAlias(descriptor.ns.localName, descriptor.$pkg) }, ns);\n }\n}\n\nfunction getPropertyNs(ns, descriptor) {\n return assign({ localName: descriptor.ns.localName }, ns);\n}\n\nfunction getSerializableProperties(element) {\n var descriptor = element.$descriptor;\n\n return filter(descriptor.properties, function(p) {\n var name = p.name;\n\n if (p.isVirtual) {\n return false;\n }\n\n // do not serialize defaults\n if (!element.hasOwnProperty(name)) {\n return false;\n }\n\n var value = element[name];\n\n // do not serialize default equals\n if (value === p.default) {\n return false;\n }\n\n // do not serialize null properties\n if (value === null) {\n return false;\n }\n\n return p.isMany ? value.length : true;\n });\n}\n\nvar ESCAPE_MAP = {\n '/n': '10',\n '/n/r': '10',\n '\"': '34',\n '/'': '39',\n '<': '60',\n '>': '62',\n '&': '38'\n};\n\n/**\n * Escape a string attribute to not contain any bad values (line breaks, '\"', ...)\n *\n * @param {String} str the string to escape\n * @return {String} the escaped string\n */\nfunction escapeAttr(str) {\n\n // ensure we are handling strings here\n str = isString(str) ? str : '' + str;\n\n return str.replace(ESCAPE_CHARS, function(str) {\n return '&#' + ESCAPE_MAP[str] + ';';\n });\n}\n\nfunction filterAttributes(props) {\n return filter(props, function(p) { return p.isAttr; });\n}\n\nfunction filterContained(props) {\n return filter(props, function(p) { return !p.isAttr; });\n}\n\n\nfunction ReferenceSerializer(parent, ns) {\n this.ns = ns;\n}\n\nReferenceSerializer.prototype.build = function(element) {\n this.element = element;\n return this;\n};\n\nReferenceSerializer.prototype.serializeTo = function(writer) {\n writer\n .appendIndent()\n .append('<' + nsName(this.ns) + '>' + this.element.id + '')\n .appendNewLine();\n};\n\nfunction BodySerializer() {}\n\nBodySerializer.prototype.serializeValue = BodySerializer.prototype.serializeTo = function(writer) {\n var escape = this.escape;\n\n if (escape) {\n writer.append('');\n }\n};\n\nBodySerializer.prototype.build = function(prop, value) {\n this.value = value;\n\n if (prop.type === 'String' && value.search(ESCAPE_CHARS) !== -1) {\n this.escape = true;\n }\n\n return this;\n};\n\nfunction ValueSerializer(ns) {\n this.ns = ns;\n}\n\ninherits(ValueSerializer, BodySerializer);\n\nValueSerializer.prototype.serializeTo = function(writer) {\n\n writer\n .appendIndent()\n .append('<' + nsName(this.ns) + '>');\n\n this.serializeValue(writer);\n\n writer\n .append('')\n .appendNewLine();\n};\n\nfunction ElementSerializer(parent, ns) {\n this.body = [];\n this.attrs = [];\n\n this.parent = parent;\n this.ns = ns;\n}\n\nElementSerializer.prototype.build = function(element) {\n this.element = element;\n\n var otherAttrs = this.parseNsAttributes(element);\n\n if (!this.ns) {\n this.ns = this.nsTagName(element.$descriptor);\n }\n\n if (element.$descriptor.isGeneric) {\n this.parseGeneric(element);\n } else {\n var properties = getSerializableProperties(element);\n\n this.parseAttributes(filterAttributes(properties));\n this.parseContainments(filterContained(properties));\n\n this.parseGenericAttributes(element, otherAttrs);\n }\n\n return this;\n};\n\nElementSerializer.prototype.nsTagName = function(descriptor) {\n var effectiveNs = this.logNamespaceUsed(descriptor.ns);\n return getElementNs(effectiveNs, descriptor);\n};\n\nElementSerializer.prototype.nsPropertyTagName = function(descriptor) {\n var effectiveNs = this.logNamespaceUsed(descriptor.ns);\n return getPropertyNs(effectiveNs, descriptor);\n};\n\nElementSerializer.prototype.isLocalNs = function(ns) {\n return ns.uri === this.ns.uri;\n};\n\n/**\n * Get the actual ns attribute name for the given element.\n *\n * @param {Object} element\n * @param {Boolean} [inherited=false]\n *\n * @return {Object} nsName\n */\nElementSerializer.prototype.nsAttributeName = function(element) {\n\n var ns;\n\n if (isString(element)) {\n ns = parseNameNs(element);\n } else {\n ns = element.ns;\n }\n\n // return just local name for inherited attributes\n if (element.inherited) {\n return { localName: ns.localName };\n }\n\n // parse + log effective ns\n var effectiveNs = this.logNamespaceUsed(ns);\n\n // strip prefix if same namespace like parent\n if (this.isLocalNs(effectiveNs)) {\n return { localName: ns.localName };\n } else {\n return assign({ localName: ns.localName }, effectiveNs);\n }\n};\n\nElementSerializer.prototype.parseGeneric = function(element) {\n\n var self = this,\n body = this.body,\n attrs = this.attrs;\n\n forEach(element, function(val, key) {\n\n if (key === '$body') {\n body.push(new BodySerializer().build({ type: 'String' }, val));\n } else\n if (key === '$children') {\n forEach(val, function(child) {\n body.push(new ElementSerializer(self).build(child));\n });\n } else\n if (key.indexOf('$') !== 0) {\n attrs.push({ name: key, value: escapeAttr(val) });\n }\n });\n};\n\n/**\n * Parse namespaces and return a list of left over generic attributes\n *\n * @param {Object} element\n * @return {Array}\n */\nElementSerializer.prototype.parseNsAttributes = function(element) {\n var self = this;\n\n var genericAttrs = element.$attrs;\n\n var model = element.$model;\n\n var attributes = [];\n\n // parse namespace attributes first\n // and log them. push non namespace attributes to a list\n // and process them later\n forEach(genericAttrs, function(value, name) {\n var nameNs = parseNameNs(name);\n\n var ns;\n\n // parse xmlns:foo=\"http://foo.bar\"\n if (nameNs.prefix === 'xmlns') {\n ns = { prefix: nameNs.localName, uri: value };\n }\n\n // parse xmlns=\"http://foo.bar\"\n if (!nameNs.prefix && nameNs.localName === 'xmlns') {\n ns = { uri: value };\n }\n\n if (ns) {\n if (model.getPackage(value)) {\n // register well known namespace\n self.logNamespace(ns, true);\n } else {\n // log custom namespace directly as used\n self.logNamespaceUsed(ns);\n }\n } else {\n attributes.push({ name: name, value: value });\n }\n });\n\n return attributes;\n};\n\nElementSerializer.prototype.parseGenericAttributes = function(element, attributes) {\n\n var self = this;\n\n forEach(attributes, function(attr) {\n\n // do not serialize xsi:type attribute\n // it is set manually based on the actual implementation type\n if (attr.name === XSI_TYPE) {\n return;\n }\n\n try {\n self.addAttribute(self.nsAttributeName(attr.name), attr.value);\n } catch (e) {\n console.warn(\n 'missing namespace information for ',\n attr.name, '=', attr.value, 'on', element,\n e);\n }\n });\n};\n\nElementSerializer.prototype.parseContainments = function(properties) {\n\n var self = this,\n body = this.body,\n element = this.element;\n\n forEach(properties, function(p) {\n var value = element.get(p.name),\n isReference = p.isReference,\n isMany = p.isMany;\n\n var ns = self.nsPropertyTagName(p);\n\n if (!isMany) {\n value = [ value ];\n }\n\n if (p.isBody) {\n body.push(new BodySerializer().build(p, value[0]));\n } else\n if (Types.isSimple(p.type)) {\n forEach(value, function(v) {\n body.push(new ValueSerializer(ns).build(p, v));\n });\n } else\n if (isReference) {\n forEach(value, function(v) {\n body.push(new ReferenceSerializer(self, ns).build(v));\n });\n } else {\n // allow serialization via type\n // rather than element name\n var asType = serializeAsType(p),\n asProperty = serializeAsProperty(p);\n\n forEach(value, function(v) {\n var serializer;\n\n if (asType) {\n serializer = new TypeSerializer(self, ns);\n } else\n if (asProperty) {\n serializer = new ElementSerializer(self, ns);\n } else {\n serializer = new ElementSerializer(self);\n }\n\n body.push(serializer.build(v));\n });\n }\n });\n};\n\nElementSerializer.prototype.getNamespaces = function() {\n\n var namespaces = this.namespaces,\n parent = this.parent;\n\n if (!namespaces) {\n namespaces = this.namespaces = parent ? parent.getNamespaces() : {\n prefixMap: {},\n uriMap: {},\n used: {},\n wellknown: [],\n custom: []\n };\n }\n\n return namespaces;\n};\n\nElementSerializer.prototype.logNamespace = function(ns, wellknown) {\n var namespaces = this.getNamespaces();\n\n var nsUri = ns.uri;\n\n var existing = namespaces.uriMap[nsUri];\n\n if (!existing) {\n namespaces.uriMap[nsUri] = ns;\n\n if (wellknown) {\n namespaces.wellknown.push(ns);\n } else {\n namespaces.custom.push(ns);\n }\n }\n\n namespaces.prefixMap[ns.prefix] = nsUri;\n\n return ns;\n};\n\nElementSerializer.prototype.logNamespaceUsed = function(ns) {\n var element = this.element,\n model = element.$model,\n namespaces = this.getNamespaces();\n\n // ns may be\n //\n // * prefix only\n // * prefix:uri\n // * localName only\n\n var prefix = ns.prefix,\n uri = ns.uri,\n newPrefix, idx,\n wellknownUri;\n\n // handle anonymous namespaces (elementForm=unqualified), cf. #23\n if (!prefix && !uri) {\n return { localName: ns.localName };\n }\n\n wellknownUri = DEFAULT_NS_MAP[prefix] || model && (model.getPackage(prefix) || {}).uri;\n\n uri = uri || wellknownUri || namespaces.prefixMap[prefix];\n\n if (!uri) {\n throw new Error('no namespace uri given for prefix <' + prefix + '>');\n }\n\n ns = namespaces.uriMap[uri];\n\n if (!ns) {\n newPrefix = prefix;\n idx = 1;\n\n // find a prefix that is not mapped yet\n while (namespaces.prefixMap[newPrefix]) {\n newPrefix = prefix + '_' + idx++;\n }\n\n ns = this.logNamespace({ prefix: newPrefix, uri: uri }, wellknownUri === uri);\n }\n\n if (!namespaces.used[ns.uri]) {\n namespaces.used[ns.uri] = ns;\n }\n\n return ns;\n};\n\nElementSerializer.prototype.parseAttributes = function(properties) {\n var self = this,\n element = this.element;\n\n forEach(properties, function(p) {\n\n var value = element.get(p.name);\n\n if (p.isReference) {\n\n if (!p.isMany) {\n value = value.id;\n }\n else {\n var values = [];\n forEach(value, function(v) {\n values.push(v.id);\n });\n // IDREFS is a whitespace-separated list of references.\n value = values.join(' ');\n }\n\n }\n\n self.addAttribute(self.nsAttributeName(p), value);\n });\n};\n\nElementSerializer.prototype.addAttribute = function(name, value) {\n var attrs = this.attrs;\n\n if (isString(value)) {\n value = escapeAttr(value);\n }\n\n attrs.push({ name: name, value: value });\n};\n\nElementSerializer.prototype.serializeAttributes = function(writer) {\n var attrs = this.attrs,\n root = !this.parent;\n\n if (root) {\n attrs = getNsAttrs(this.namespaces).concat(attrs);\n }\n\n forEach(attrs, function(a) {\n writer\n .append(' ')\n .append(nsName(a.name)).append('=\"').append(a.value).append('\"');\n });\n};\n\nElementSerializer.prototype.serializeTo = function(writer) {\n var firstBody = this.body[0],\n indent = firstBody && firstBody.constructor !== BodySerializer;\n\n writer\n .appendIndent()\n .append('<' + nsName(this.ns));\n\n this.serializeAttributes(writer);\n\n writer.append(firstBody ? '>' : ' />');\n\n if (firstBody) {\n\n if (indent) {\n writer\n .appendNewLine()\n .indent();\n }\n\n forEach(this.body, function(b) {\n b.serializeTo(writer);\n });\n\n if (indent) {\n writer\n .unindent()\n .appendIndent();\n }\n\n writer.append('');\n }\n\n writer.appendNewLine();\n};\n\n/**\n * A serializer for types that handles serialization of data types\n */\nfunction TypeSerializer(parent, ns) {\n ElementSerializer.call(this, parent, ns);\n}\n\ninherits(TypeSerializer, ElementSerializer);\n\nTypeSerializer.prototype.build = function(element) {\n var descriptor = element.$descriptor;\n\n this.element = element;\n\n this.typeNs = this.nsTagName(descriptor);\n\n // add xsi:type attribute to represent the elements\n // actual type\n\n var typeNs = this.typeNs,\n pkg = element.$model.getPackage(typeNs.uri),\n typePrefix = (pkg.xml && pkg.xml.typePrefix) || '';\n\n this.addAttribute(this.nsAttributeName(XSI_TYPE),\n (typeNs.prefix ? typeNs.prefix + ':' : '') +\n typePrefix + descriptor.ns.localName);\n\n // do the usual stuff\n return ElementSerializer.prototype.build.call(this, element);\n};\n\nTypeSerializer.prototype.isLocalNs = function(ns) {\n return ns.uri === this.typeNs.uri;\n};\n\nfunction SavingWriter() {\n this.value = '';\n\n this.write = function(str) {\n this.value += str;\n };\n}\n\nfunction FormatingWriter(out, format) {\n\n var indent = [''];\n\n this.append = function(str) {\n out.write(str);\n\n return this;\n };\n\n this.appendNewLine = function() {\n if (format) {\n out.write('/n');\n }\n\n return this;\n };\n\n this.appendIndent = function() {\n if (format) {\n out.write(indent.join(' '));\n }\n\n return this;\n };\n\n this.indent = function() {\n indent.push('');\n return this;\n };\n\n this.unindent = function() {\n indent.pop();\n return this;\n };\n}\n\n/**\n * A writer for meta-model backed document trees\n *\n * @param {Object} options output options to pass into the writer\n */\nfunction XMLWriter(options) {\n\n options = assign({ format: false, preamble: true }, options || {});\n\n function toXML(tree, writer) {\n var internalWriter = writer || new SavingWriter();\n var formatingWriter = new FormatingWriter(internalWriter, options.format);\n\n if (options.preamble) {\n formatingWriter.append(XML_PREAMBLE);\n }\n\n new ElementSerializer().build(tree).serializeTo(formatingWriter);\n\n if (!writer) {\n return internalWriter.value;\n }\n }\n\n return {\n toXML: toXML\n };\n}\n\nmodule.exports = XMLWriter;\n","module.exports = require(461);","'use strict';\n\nfunction Base() { }\n\nBase.prototype.get = function(name) {\n return this.$model.properties.get(this, name);\n};\n\nBase.prototype.set = function(name, value) {\n this.$model.properties.set(this, name, value);\n};\n\n\nmodule.exports = Base;","'use strict';\n\nvar pick = require(438),\n assign = require(431),\n forEach = require(303);\n\nvar parseNameNs = require(462).parseName;\n\n\nfunction DescriptorBuilder(nameNs) {\n this.ns = nameNs;\n this.name = nameNs.name;\n this.allTypes = [];\n this.allTypesByName = {};\n this.properties = [];\n this.propertiesByName = {};\n}\n\nmodule.exports = DescriptorBuilder;\n\n\nDescriptorBuilder.prototype.build = function() {\n return pick(this, [\n 'ns',\n 'name',\n 'allTypes',\n 'allTypesByName',\n 'properties',\n 'propertiesByName',\n 'bodyProperty',\n 'idProperty'\n ]);\n};\n\n/**\n * Add property at given index.\n *\n * @param {Object} p\n * @param {Number} [idx]\n * @param {Boolean} [validate=true]\n */\nDescriptorBuilder.prototype.addProperty = function(p, idx, validate) {\n\n if (typeof idx === 'boolean') {\n validate = idx;\n idx = undefined;\n }\n\n this.addNamedProperty(p, validate !== false);\n\n var properties = this.properties;\n\n if (idx !== undefined) {\n properties.splice(idx, 0, p);\n } else {\n properties.push(p);\n }\n};\n\n\nDescriptorBuilder.prototype.replaceProperty = function(oldProperty, newProperty, replace) {\n var oldNameNs = oldProperty.ns;\n\n var props = this.properties,\n propertiesByName = this.propertiesByName,\n rename = oldProperty.name !== newProperty.name;\n\n if (oldProperty.isId) {\n if (!newProperty.isId) {\n throw new Error(\n 'property <' + newProperty.ns.name + '> must be id property ' +\n 'to refine <' + oldProperty.ns.name + '>');\n }\n\n this.setIdProperty(newProperty, false);\n }\n\n if (oldProperty.isBody) {\n\n if (!newProperty.isBody) {\n throw new Error(\n 'property <' + newProperty.ns.name + '> must be body property ' +\n 'to refine <' + oldProperty.ns.name + '>');\n }\n\n // TODO: Check compatibility\n this.setBodyProperty(newProperty, false);\n }\n\n // validate existence and get location of old property\n var idx = props.indexOf(oldProperty);\n if (idx === -1) {\n throw new Error('property <' + oldNameNs.name + '> not found in property list');\n }\n\n // remove old property\n props.splice(idx, 1);\n\n // replacing the named property is intentional\n //\n // * validate only if this is a \"rename\" operation\n // * add at specific index unless we \"replace\"\n //\n this.addProperty(newProperty, replace ? undefined : idx, rename);\n\n // make new property available under old name\n propertiesByName[oldNameNs.name] = propertiesByName[oldNameNs.localName] = newProperty;\n};\n\n\nDescriptorBuilder.prototype.redefineProperty = function(p, targetPropertyName, replace) {\n\n var nsPrefix = p.ns.prefix;\n var parts = targetPropertyName.split('#');\n\n var name = parseNameNs(parts[0], nsPrefix);\n var attrName = parseNameNs(parts[1], name.prefix).name;\n\n var redefinedProperty = this.propertiesByName[attrName];\n if (!redefinedProperty) {\n throw new Error('refined property <' + attrName + '> not found');\n } else {\n this.replaceProperty(redefinedProperty, p, replace);\n }\n\n delete p.redefines;\n};\n\nDescriptorBuilder.prototype.addNamedProperty = function(p, validate) {\n var ns = p.ns,\n propsByName = this.propertiesByName;\n\n if (validate) {\n this.assertNotDefined(p, ns.name);\n this.assertNotDefined(p, ns.localName);\n }\n\n propsByName[ns.name] = propsByName[ns.localName] = p;\n};\n\nDescriptorBuilder.prototype.removeNamedProperty = function(p) {\n var ns = p.ns,\n propsByName = this.propertiesByName;\n\n delete propsByName[ns.name];\n delete propsByName[ns.localName];\n};\n\nDescriptorBuilder.prototype.setBodyProperty = function(p, validate) {\n\n if (validate && this.bodyProperty) {\n throw new Error(\n 'body property defined multiple times ' +\n '(<' + this.bodyProperty.ns.name + '>, <' + p.ns.name + '>)');\n }\n\n this.bodyProperty = p;\n};\n\nDescriptorBuilder.prototype.setIdProperty = function(p, validate) {\n\n if (validate && this.idProperty) {\n throw new Error(\n 'id property defined multiple times ' +\n '(<' + this.idProperty.ns.name + '>, <' + p.ns.name + '>)');\n }\n\n this.idProperty = p;\n};\n\nDescriptorBuilder.prototype.assertNotDefined = function(p, name) {\n var propertyName = p.name,\n definedProperty = this.propertiesByName[propertyName];\n\n if (definedProperty) {\n throw new Error(\n 'property <' + propertyName + '> already defined; ' +\n 'override of <' + definedProperty.definedBy.ns.name + '#' + definedProperty.ns.name + '> by ' +\n '<' + p.definedBy.ns.name + '#' + p.ns.name + '> not allowed without redefines');\n }\n};\n\nDescriptorBuilder.prototype.hasProperty = function(name) {\n return this.propertiesByName[name];\n};\n\nDescriptorBuilder.prototype.addTrait = function(t, inherited) {\n\n var typesByName = this.allTypesByName,\n types = this.allTypes;\n\n var typeName = t.name;\n\n if (typeName in typesByName) {\n return;\n }\n\n forEach(t.properties, function(p) {\n\n // clone property to allow extensions\n p = assign({}, p, {\n name: p.ns.localName,\n inherited: inherited\n });\n\n Object.defineProperty(p, 'definedBy', {\n value: t\n });\n\n var replaces = p.replaces,\n redefines = p.redefines;\n\n // add replace/redefine support\n if (replaces || redefines) {\n this.redefineProperty(p, replaces || redefines, replaces);\n } else {\n if (p.isBody) {\n this.setBodyProperty(p);\n }\n if (p.isId) {\n this.setIdProperty(p);\n }\n this.addProperty(p);\n }\n }, this);\n\n types.push(t);\n typesByName[typeName] = t;\n};\n","'use strict';\n\nvar forEach = require(303);\n\nvar Base = require(458);\n\n\nfunction Factory(model, properties) {\n this.model = model;\n this.properties = properties;\n}\n\nmodule.exports = Factory;\n\n\nFactory.prototype.createType = function(descriptor) {\n\n var model = this.model;\n\n var props = this.properties,\n prototype = Object.create(Base.prototype);\n\n // initialize default values\n forEach(descriptor.properties, function(p) {\n if (!p.isMany && p.default !== undefined) {\n prototype[p.name] = p.default;\n }\n });\n\n props.defineModel(prototype, model);\n props.defineDescriptor(prototype, descriptor);\n\n var name = descriptor.ns.name;\n\n /**\n * The new type constructor\n */\n function ModdleElement(attrs) {\n props.define(this, '$type', { value: name, enumerable: true });\n props.define(this, '$attrs', { value: {} });\n props.define(this, '$parent', { writable: true });\n\n forEach(attrs, function(val, key) {\n this.set(key, val);\n }, this);\n }\n\n ModdleElement.prototype = prototype;\n\n ModdleElement.hasType = prototype.$instanceOf = this.model.hasType;\n\n // static links\n props.defineModel(ModdleElement, model);\n props.defineDescriptor(ModdleElement, descriptor);\n\n return ModdleElement;\n};","'use strict';\n\nvar isString = require(428),\n isObject = require(426),\n forEach = require(303);\n\n\nvar Factory = require(460),\n Registry = require(464),\n Properties = require(463);\n\nvar parseNameNs = require(462).parseName;\n\n\n//// Moddle implementation /////////////////////////////////////////////////\n\n/**\n * @class Moddle\n *\n * A model that can be used to create elements of a specific type.\n *\n * @example\n *\n * var Moddle = require('moddle');\n *\n * var pkg = {\n * name: 'mypackage',\n * prefix: 'my',\n * types: [\n * { name: 'Root' }\n * ]\n * };\n *\n * var moddle = new Moddle([pkg]);\n *\n * @param {Array} packages the packages to contain\n */\nfunction Moddle(packages) {\n\n this.properties = new Properties(this);\n\n this.factory = new Factory(this, this.properties);\n this.registry = new Registry(packages, this.properties);\n\n this.typeCache = {};\n}\n\nmodule.exports = Moddle;\n\n\n/**\n * Create an instance of the specified type.\n *\n * @method Moddle#create\n *\n * @example\n *\n * var foo = moddle.create('my:Foo');\n * var bar = moddle.create('my:Bar', { id: 'BAR_1' });\n *\n * @param {String|Object} descriptor the type descriptor or name know to the model\n * @param {Object} attrs a number of attributes to initialize the model instance with\n * @return {Object} model instance\n */\nModdle.prototype.create = function(descriptor, attrs) {\n var Type = this.getType(descriptor);\n\n if (!Type) {\n throw new Error('unknown type <' + descriptor + '>');\n }\n\n return new Type(attrs);\n};\n\n\n/**\n * Returns the type representing a given descriptor\n *\n * @method Moddle#getType\n *\n * @example\n *\n * var Foo = moddle.getType('my:Foo');\n * var foo = new Foo({ 'id' : 'FOO_1' });\n *\n * @param {String|Object} descriptor the type descriptor or name know to the model\n * @return {Object} the type representing the descriptor\n */\nModdle.prototype.getType = function(descriptor) {\n\n var cache = this.typeCache;\n\n var name = isString(descriptor) ? descriptor : descriptor.ns.name;\n\n var type = cache[name];\n\n if (!type) {\n descriptor = this.registry.getEffectiveDescriptor(name);\n type = cache[name] = this.factory.createType(descriptor);\n }\n\n return type;\n};\n\n\n/**\n * Creates an any-element type to be used within model instances.\n *\n * This can be used to create custom elements that lie outside the meta-model.\n * The created element contains all the meta-data required to serialize it\n * as part of meta-model elements.\n *\n * @method Moddle#createAny\n *\n * @example\n *\n * var foo = moddle.createAny('vendor:Foo', 'http://vendor', {\n * value: 'bar'\n * });\n *\n * var container = moddle.create('my:Container', 'http://my', {\n * any: [ foo ]\n * });\n *\n * // go ahead and serialize the stuff\n *\n *\n * @param {String} name the name of the element\n * @param {String} nsUri the namespace uri of the element\n * @param {Object} [properties] a map of properties to initialize the instance with\n * @return {Object} the any type instance\n */\nModdle.prototype.createAny = function(name, nsUri, properties) {\n\n var nameNs = parseNameNs(name);\n\n var element = {\n $type: name,\n $instanceOf: function(type) {\n return type === this.$type;\n }\n };\n\n var descriptor = {\n name: name,\n isGeneric: true,\n ns: {\n prefix: nameNs.prefix,\n localName: nameNs.localName,\n uri: nsUri\n }\n };\n\n this.properties.defineDescriptor(element, descriptor);\n this.properties.defineModel(element, this);\n this.properties.define(element, '$parent', { enumerable: false, writable: true });\n\n forEach(properties, function(a, key) {\n if (isObject(a) && a.value !== undefined) {\n element[a.name] = a.value;\n } else {\n element[key] = a;\n }\n });\n\n return element;\n};\n\n/**\n * Returns a registered package by uri or prefix\n *\n * @return {Object} the package\n */\nModdle.prototype.getPackage = function(uriOrPrefix) {\n return this.registry.getPackage(uriOrPrefix);\n};\n\n/**\n * Returns a snapshot of all known packages\n *\n * @return {Object} the package\n */\nModdle.prototype.getPackages = function() {\n return this.registry.getPackages();\n};\n\n/**\n * Returns the descriptor for an element\n */\nModdle.prototype.getElementDescriptor = function(element) {\n return element.$descriptor;\n};\n\n/**\n * Returns true if the given descriptor or instance\n * represents the given type.\n *\n * May be applied to this, if element is omitted.\n */\nModdle.prototype.hasType = function(element, type) {\n if (type === undefined) {\n type = element;\n element = this;\n }\n\n var descriptor = element.$model.getElementDescriptor(element);\n\n return (type in descriptor.allTypesByName);\n};\n\n/**\n * Returns the descriptor of an elements named property\n */\nModdle.prototype.getPropertyDescriptor = function(element, property) {\n return this.getElementDescriptor(element).propertiesByName[property];\n};\n\n/**\n * Returns a mapped type's descriptor\n */\nModdle.prototype.getTypeDescriptor = function(type) {\n return this.registry.typeMap[type];\n};\n","'use strict';\n\n/**\n * Parses a namespaced attribute name of the form (ns:)localName to an object,\n * given a default prefix to assume in case no explicit namespace is given.\n *\n * @param {String} name\n * @param {String} [defaultPrefix] the default prefix to take, if none is present.\n *\n * @return {Object} the parsed name\n */\nmodule.exports.parseName = function(name, defaultPrefix) {\n var parts = name.split(/:/),\n localName, prefix;\n\n // no prefix (i.e. only local name)\n if (parts.length === 1) {\n localName = name;\n prefix = defaultPrefix;\n } else\n // prefix + local name\n if (parts.length === 2) {\n localName = parts[1];\n prefix = parts[0];\n } else {\n throw new Error('expected or , got ' + name);\n }\n\n name = (prefix ? prefix + ':' : '') + localName;\n\n return {\n name: name,\n prefix: prefix,\n localName: localName\n };\n};","'use strict';\n\n\n/**\n * A utility that gets and sets properties of model elements.\n *\n * @param {Model} model\n */\nfunction Properties(model) {\n this.model = model;\n}\n\nmodule.exports = Properties;\n\n\n/**\n * Sets a named property on the target element.\n * If the value is undefined, the property gets deleted.\n *\n * @param {Object} target\n * @param {String} name\n * @param {Object} value\n */\nProperties.prototype.set = function(target, name, value) {\n\n var property = this.model.getPropertyDescriptor(target, name);\n\n var propertyName = property && property.name;\n\n if (isUndefined(value)) {\n // unset the property, if the specified value is undefined;\n // delete from $attrs (for extensions) or the target itself\n if (property) {\n delete target[propertyName];\n } else {\n delete target.$attrs[name];\n }\n } else {\n // set the property, defining well defined properties on the fly\n // or simply updating them in target.$attrs (for extensions)\n if (property) {\n if (propertyName in target) {\n target[propertyName] = value;\n } else {\n defineProperty(target, property, value);\n }\n } else {\n target.$attrs[name] = value;\n }\n }\n};\n\n/**\n * Returns the named property of the given element\n *\n * @param {Object} target\n * @param {String} name\n *\n * @return {Object}\n */\nProperties.prototype.get = function(target, name) {\n\n var property = this.model.getPropertyDescriptor(target, name);\n\n if (!property) {\n return target.$attrs[name];\n }\n\n var propertyName = property.name;\n\n // check if access to collection property and lazily initialize it\n if (!target[propertyName] && property.isMany) {\n defineProperty(target, property, []);\n }\n\n return target[propertyName];\n};\n\n\n/**\n * Define a property on the target element\n *\n * @param {Object} target\n * @param {String} name\n * @param {Object} options\n */\nProperties.prototype.define = function(target, name, options) {\n Object.defineProperty(target, name, options);\n};\n\n\n/**\n * Define the descriptor for an element\n */\nProperties.prototype.defineDescriptor = function(target, descriptor) {\n this.define(target, '$descriptor', { value: descriptor });\n};\n\n/**\n * Define the model for an element\n */\nProperties.prototype.defineModel = function(target, model) {\n this.define(target, '$model', { value: model });\n};\n\n\nfunction isUndefined(val) {\n return typeof val === 'undefined';\n}\n\nfunction defineProperty(target, property, value) {\n Object.defineProperty(target, property.name, {\n enumerable: !property.isReference,\n writable: true,\n value: value,\n configurable: true\n });\n}","'use strict';\n\nvar assign = require(431),\n forEach = require(303);\n\nvar Types = require(465),\n DescriptorBuilder = require(459);\n\nvar parseNameNs = require(462).parseName,\n isBuiltInType = Types.isBuiltIn;\n\n\nfunction Registry(packages, properties) {\n this.packageMap = {};\n this.typeMap = {};\n\n this.packages = [];\n\n this.properties = properties;\n\n forEach(packages, this.registerPackage, this);\n}\n\nmodule.exports = Registry;\n\n\nRegistry.prototype.getPackage = function(uriOrPrefix) {\n return this.packageMap[uriOrPrefix];\n};\n\nRegistry.prototype.getPackages = function() {\n return this.packages;\n};\n\n\nRegistry.prototype.registerPackage = function(pkg) {\n\n // copy package\n pkg = assign({}, pkg);\n\n var pkgMap = this.packageMap;\n\n ensureAvailable(pkgMap, pkg, 'prefix');\n ensureAvailable(pkgMap, pkg, 'uri');\n\n // register types\n forEach(pkg.types, function(descriptor) {\n this.registerType(descriptor, pkg);\n }, this);\n\n pkgMap[pkg.uri] = pkgMap[pkg.prefix] = pkg;\n this.packages.push(pkg);\n};\n\n\n/**\n * Register a type from a specific package with us\n */\nRegistry.prototype.registerType = function(type, pkg) {\n\n type = assign({}, type, {\n superClass: (type.superClass || []).slice(),\n extends: (type.extends || []).slice(),\n properties: (type.properties || []).slice(),\n meta: assign(({}, type.meta || {}))\n });\n\n var ns = parseNameNs(type.name, pkg.prefix),\n name = ns.name,\n propertiesByName = {};\n\n // parse properties\n forEach(type.properties, function(p) {\n\n // namespace property names\n var propertyNs = parseNameNs(p.name, ns.prefix),\n propertyName = propertyNs.name;\n\n // namespace property types\n if (!isBuiltInType(p.type)) {\n p.type = parseNameNs(p.type, propertyNs.prefix).name;\n }\n\n assign(p, {\n ns: propertyNs,\n name: propertyName\n });\n\n propertiesByName[propertyName] = p;\n });\n\n // update ns + name\n assign(type, {\n ns: ns,\n name: name,\n propertiesByName: propertiesByName\n });\n\n forEach(type.extends, function(extendsName) {\n var extended = this.typeMap[extendsName];\n\n extended.traits = extended.traits || [];\n extended.traits.push(name);\n }, this);\n\n // link to package\n this.definePackage(type, pkg);\n\n // register\n this.typeMap[name] = type;\n};\n\n\n/**\n * Traverse the type hierarchy from bottom to top,\n * calling iterator with (type, inherited) for all elements in\n * the inheritance chain.\n *\n * @param {Object} nsName\n * @param {Function} iterator\n * @param {Boolean} [trait=false]\n */\nRegistry.prototype.mapTypes = function(nsName, iterator, trait) {\n\n var type = isBuiltInType(nsName.name) ? { name: nsName.name } : this.typeMap[nsName.name];\n\n var self = this;\n\n /**\n * Traverse the selected trait.\n *\n * @param {String} cls\n */\n function traverseTrait(cls) {\n return traverseSuper(cls, true);\n }\n\n /**\n * Traverse the selected super type or trait\n *\n * @param {String} cls\n * @param {Boolean} [trait=false]\n */\n function traverseSuper(cls, trait) {\n var parentNs = parseNameNs(cls, isBuiltInType(cls) ? '' : nsName.prefix);\n self.mapTypes(parentNs, iterator, trait);\n }\n\n if (!type) {\n throw new Error('unknown type <' + nsName.name + '>');\n }\n\n forEach(type.superClass, trait ? traverseTrait : traverseSuper);\n\n // call iterator with (type, inherited=!trait)\n iterator(type, !trait);\n\n forEach(type.traits, traverseTrait);\n};\n\n\n/**\n * Returns the effective descriptor for a type.\n *\n * @param {String} type the namespaced name (ns:localName) of the type\n *\n * @return {Descriptor} the resulting effective descriptor\n */\nRegistry.prototype.getEffectiveDescriptor = function(name) {\n\n var nsName = parseNameNs(name);\n\n var builder = new DescriptorBuilder(nsName);\n\n this.mapTypes(nsName, function(type, inherited) {\n builder.addTrait(type, inherited);\n });\n\n var descriptor = builder.build();\n\n // define package link\n this.definePackage(descriptor, descriptor.allTypes[descriptor.allTypes.length - 1].$pkg);\n\n return descriptor;\n};\n\n\nRegistry.prototype.definePackage = function(target, pkg) {\n this.properties.define(target, '$pkg', { value: pkg });\n};\n\n\n\n///////// helpers ////////////////////////////\n\nfunction ensureAvailable(packageMap, pkg, identifierKey) {\n\n var value = pkg[identifierKey];\n\n if (value in packageMap) {\n throw new Error('package with ' + identifierKey + ' <' + value + '> already defined');\n }\n}\n","'use strict';\n\n/**\n * Built-in moddle types\n */\nvar BUILTINS = {\n String: true,\n Boolean: true,\n Integer: true,\n Real: true,\n Element: true\n};\n\n/**\n * Converters for built in types from string representations\n */\nvar TYPE_CONVERTERS = {\n String: function(s) { return s; },\n Boolean: function(s) { return s === 'true'; },\n Integer: function(s) { return parseInt(s, 10); },\n Real: function(s) { return parseFloat(s, 10); }\n};\n\n/**\n * Convert a type to its real representation\n */\nmodule.exports.coerceType = function(type, value) {\n\n var converter = TYPE_CONVERTERS[type];\n\n if (converter) {\n return converter(value);\n } else {\n return value;\n }\n};\n\n/**\n * Return whether the given type is built-in\n */\nmodule.exports.isBuiltIn = function(type) {\n return !!BUILTINS[type];\n};\n\n/**\n * Return whether the given type is simple\n */\nmodule.exports.isSimple = function(type) {\n return !!TYPE_CONVERTERS[type];\n};","module.exports = require(468);\n\nmodule.exports.Collection = require(467);","'use strict';\n\n/**\n * An empty collection stub. Use {@link RefsCollection.extend} to extend a\n * collection with ref semantics.\n *\n * @class RefsCollection\n */\n\n/**\n * Extends a collection with {@link Refs} aware methods\n *\n * @memberof RefsCollection\n * @static\n *\n * @param {Array} collection\n * @param {Refs} refs instance\n * @param {Object} property represented by the collection\n * @param {Object} target object the collection is attached to\n *\n * @return {RefsCollection} the extended array\n */\nfunction extend(collection, refs, property, target) {\n\n var inverseProperty = property.inverse;\n\n /**\n * Removes the given element from the array and returns it.\n *\n * @method RefsCollection#remove\n *\n * @param {Object} element the element to remove\n */\n Object.defineProperty(collection, 'remove', {\n value: function(element) {\n var idx = this.indexOf(element);\n if (idx !== -1) {\n this.splice(idx, 1);\n\n // unset inverse\n refs.unset(element, inverseProperty, target);\n }\n\n return element;\n }\n });\n\n /**\n * Returns true if the collection contains the given element\n *\n * @method RefsCollection#contains\n *\n * @param {Object} element the element to check for\n */\n Object.defineProperty(collection, 'contains', {\n value: function(element) {\n return this.indexOf(element) !== -1;\n }\n });\n\n /**\n * Adds an element to the array, unless it exists already (set semantics).\n *\n * @method RefsCollection#add\n *\n * @param {Object} element the element to add\n */\n Object.defineProperty(collection, 'add', {\n value: function(element) {\n\n if (!this.contains(element)) {\n this.push(element);\n\n // set inverse\n refs.set(element, inverseProperty, target);\n }\n }\n });\n\n // a simple marker, identifying this element\n // as being a refs collection\n Object.defineProperty(collection, '__refs_collection', {\n value: true\n });\n\n return collection;\n}\n\n\nfunction isExtended(collection) {\n return collection.__refs_collection === true;\n}\n\nmodule.exports.extend = extend;\n\nmodule.exports.isExtended = isExtended;","'use strict';\n\nvar Collection = require(467);\n\nfunction hasOwnProperty(e, property) {\n return Object.prototype.hasOwnProperty.call(e, property.name || property);\n}\n\nfunction defineCollectionProperty(ref, property, target) {\n Object.defineProperty(target, property.name, {\n enumerable: property.enumerable,\n value: Collection.extend(target[property.name] || [], ref, property, target)\n });\n}\n\n\nfunction defineProperty(ref, property, target) {\n\n var inverseProperty = property.inverse;\n\n var _value = target[property.name];\n\n Object.defineProperty(target, property.name, {\n enumerable: property.enumerable,\n\n get: function() {\n return _value;\n },\n\n set: function(value) {\n\n // return if we already performed all changes\n if (value === _value) {\n return;\n }\n\n var old = _value;\n\n // temporary set null\n _value = null;\n\n if (old) {\n ref.unset(old, inverseProperty, target);\n }\n\n // set new value\n _value = value;\n\n // set inverse value\n ref.set(_value, inverseProperty, target);\n }\n });\n\n}\n\n/**\n * Creates a new references object defining two inversly related\n * attribute descriptors a and b.\n *\n *

\n * When bound to an object using {@link Refs#bind} the references\n * get activated and ensure that add and remove operations are applied\n * reversely, too.\n *

\n *\n *

\n * For attributes represented as collections {@link Refs} provides the\n * {@link RefsCollection#add}, {@link RefsCollection#remove} and {@link RefsCollection#contains} extensions\n * that must be used to properly hook into the inverse change mechanism.\n *

\n *\n * @class Refs\n *\n * @classdesc A bi-directional reference between two attributes.\n *\n * @param {Refs.AttributeDescriptor} a property descriptor\n * @param {Refs.AttributeDescriptor} b property descriptor\n *\n * @example\n *\n * var refs = Refs({ name: 'wheels', collection: true, enumerable: true }, { name: 'car' });\n *\n * var car = { name: 'toyota' };\n * var wheels = [{ pos: 'front-left' }, { pos: 'front-right' }];\n *\n * refs.bind(car, 'wheels');\n *\n * car.wheels // []\n * car.wheels.add(wheels[0]);\n * car.wheels.add(wheels[1]);\n *\n * car.wheels // [{ pos: 'front-left' }, { pos: 'front-right' }]\n *\n * wheels[0].car // { name: 'toyota' };\n * car.wheels.remove(wheels[0]);\n *\n * wheels[0].car // undefined\n */\nfunction Refs(a, b) {\n\n if (!(this instanceof Refs)) {\n return new Refs(a, b);\n }\n\n // link\n a.inverse = b;\n b.inverse = a;\n\n this.props = {};\n this.props[a.name] = a;\n this.props[b.name] = b;\n}\n\n/**\n * Binds one side of a bi-directional reference to a\n * target object.\n *\n * @memberOf Refs\n *\n * @param {Object} target\n * @param {String} property\n */\nRefs.prototype.bind = function(target, property) {\n if (typeof property === 'string') {\n if (!this.props[property]) {\n throw new Error('no property <' + property + '> in ref');\n }\n property = this.props[property];\n }\n\n if (property.collection) {\n defineCollectionProperty(this, property, target);\n } else {\n defineProperty(this, property, target);\n }\n};\n\nRefs.prototype.ensureRefsCollection = function(target, property) {\n\n var collection = target[property.name];\n\n if (!Collection.isExtended(collection)) {\n defineCollectionProperty(this, property, target);\n }\n\n return collection;\n};\n\nRefs.prototype.ensureBound = function(target, property) {\n if (!hasOwnProperty(target, property)) {\n this.bind(target, property);\n }\n};\n\nRefs.prototype.unset = function(target, property, value) {\n\n if (target) {\n this.ensureBound(target, property);\n\n if (property.collection) {\n this.ensureRefsCollection(target, property).remove(value);\n } else {\n target[property.name] = undefined;\n }\n }\n};\n\nRefs.prototype.set = function(target, property, value) {\n\n if (target) {\n this.ensureBound(target, property);\n\n if (property.collection) {\n this.ensureRefsCollection(target, property).add(value);\n } else {\n target[property.name] = value;\n }\n }\n};\n\nmodule.exports = Refs;\n\n\n/**\n * An attribute descriptor to be used specify an attribute in a {@link Refs} instance\n *\n * @typedef {Object} Refs.AttributeDescriptor\n * @property {String} name\n * @property {boolean} [collection=false]\n * @property {boolean} [enumerable=false]\n */","'use strict';\n\nmodule['exports'] = decodeEntities;\n\n\nvar fromCharCode = String.fromCharCode;\n\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\nvar ENTITY_PATTERN = /&#(/d+);|&#x([0-9a-f]+);|&(/w+);/ig;\n\nvar ENTITY_MAPPING = {\n 'amp': '&',\n 'apos': '/'',\n 'gt': '>',\n 'lt': '<',\n 'quot': '\"'\n};\n\n// map UPPERCASE variants of supported special chars\nObject.keys(ENTITY_MAPPING).forEach(function(k) {\n ENTITY_MAPPING[k.toUpperCase()] = ENTITY_MAPPING[k];\n});\n\n\nfunction replaceEntities(_, d, x, z) {\n\n // reserved names, i.e.  \n if (z) {\n if (hasOwnProperty.call(ENTITY_MAPPING, z)) {\n return ENTITY_MAPPING[z];\n } else {\n // fall back to original value\n return '&' + z + ';';\n }\n }\n\n // decimal encoded char\n if (d) {\n return fromCharCode(d);\n }\n\n // hex encoded char\n return fromCharCode(parseInt(x, 16));\n}\n\n\n/**\n * A basic entity decoder that can decode a minimal\n * sub-set of reserved names (&) as well as\n * hex (ય) and decimal (ӏ) encoded characters.\n *\n * @param {string} str\n *\n * @return {string} decoded string\n */\nfunction decodeEntities(s) {\n if (s.length > 3 && s.indexOf('&') !== -1) {\n return s.replace(ENTITY_PATTERN, replaceEntities);\n }\n\n return s;\n}","'use strict';\n\nmodule['exports'] = Saxen;\n\nvar decodeEntities = require(469);\n\nvar XSI_URI = 'http://www.w3.org/2001/XMLSchema-instance';\nvar XSI_PREFIX = 'xsi';\nvar XSI_TYPE = 'xsi:type';\n\nfunction error(msg) {\n return new Error(msg);\n}\n\nfunction missingNamespaceForPrefix(prefix) {\n return 'missing namespace for prefix <' + prefix + '>';\n}\n\nfunction getter(getFn) {\n return {\n 'get': getFn,\n 'enumerable': true\n };\n}\n\nfunction cloneNsMatrix(nsMatrix) {\n var clone = {}, key;\n for (key in nsMatrix) {\n clone[key] = nsMatrix[key];\n }\n return clone;\n}\n\nfunction uriPrefix(prefix) {\n return prefix + '$uri';\n}\n\nfunction buildNsMatrix(nsUriToPrefix) {\n var nsMatrix = {},\n uri,\n prefix;\n\n for (uri in nsUriToPrefix) {\n prefix = nsUriToPrefix[uri];\n nsMatrix[prefix] = prefix;\n nsMatrix[uriPrefix(prefix)] = uri;\n }\n\n return nsMatrix;\n}\n\nfunction noopGetContext() {\n return { 'line': 0, 'column': 0 };\n}\n\nfunction throwFunc(err) {\n throw err;\n}\n\n/**\n * Creates a new parser with the given options.\n *\n * @constructor\n *\n * @param {!Object=} options\n */\nfunction Saxen(options) {\n\n if (!this) {\n return new Saxen(options);\n }\n\n var proxy = options && options['proxy'];\n\n var onText,\n onOpenTag,\n onCloseTag,\n onCDATA,\n onError = throwFunc,\n onWarning,\n onComment,\n onQuestion,\n onAttention;\n\n var getContext = noopGetContext;\n\n /**\n * Do we need to parse the current elements attributes for namespaces?\n *\n * @type {boolean}\n */\n var maybeNS = false;\n\n /**\n * Do we process namespaces at all?\n *\n * @type {boolean}\n */\n var isNamespace = false;\n\n /**\n * The caught error returned on parse end\n *\n * @type {Error}\n */\n var returnError = null;\n\n /**\n * Should we stop parsing?\n *\n * @type {boolean}\n */\n var parseStop = false;\n\n /**\n * A map of { uri: prefix } used by the parser.\n *\n * This map will ensure we can normalize prefixes during processing;\n * for each uri, only one prefix will be exposed to the handlers.\n *\n * @type {!Object}}\n */\n var nsUriToPrefix;\n\n /**\n * Handle parse error.\n *\n * @param {string|Error} err\n */\n function handleError(err) {\n if (!(err instanceof Error)) {\n err = error(err);\n }\n\n returnError = err;\n\n onError(err, getContext);\n }\n\n /**\n * Handle parse error.\n *\n * @param {string|Error} err\n */\n function handleWarning(err) {\n\n if (!onWarning) {\n return;\n }\n\n if (!(err instanceof Error)) {\n err = error(err);\n }\n\n onWarning(err, getContext);\n }\n\n /**\n * Register parse listener.\n *\n * @param {string} name\n * @param {Function} cb\n *\n * @return {Saxen}\n */\n this['on'] = function(name, cb) {\n\n if (typeof cb !== 'function') {\n throw error('required args ');\n }\n\n switch (name) {\n case 'openTag': onOpenTag = cb; break;\n case 'text': onText = cb; break;\n case 'closeTag': onCloseTag = cb; break;\n case 'error': onError = cb; break;\n case 'warn': onWarning = cb; break;\n case 'cdata': onCDATA = cb; break;\n case 'attention': onAttention = cb; break; // \n case 'question': onQuestion = cb; break; // \n case 'comment': onComment = cb; break;\n default:\n throw error('unsupported event: ' + name);\n }\n\n return this;\n };\n\n /**\n * Set the namespace to prefix mapping.\n *\n * @example\n *\n * parser.ns({\n * 'http://foo': 'foo',\n * 'http://bar': 'bar'\n * });\n *\n * @param {!Object} nsMap\n *\n * @return {Saxen}\n */\n this['ns'] = function(nsMap) {\n\n if (typeof nsMap === 'undefined') {\n nsMap = {};\n }\n\n if (typeof nsMap !== 'object') {\n throw error('required args ');\n }\n\n var _nsUriToPrefix = {}, k;\n\n for (k in nsMap) {\n _nsUriToPrefix[k] = nsMap[k];\n }\n\n // FORCE default mapping for schema instance\n _nsUriToPrefix[XSI_URI] = XSI_PREFIX;\n\n isNamespace = true;\n nsUriToPrefix = _nsUriToPrefix;\n\n return this;\n };\n\n /**\n * Parse xml string.\n *\n * @param {string} xml\n *\n * @return {Error} returnError, if not thrown\n */\n this['parse'] = function(xml) {\n if (typeof xml !== 'string') {\n throw error('required args ');\n }\n\n returnError = null;\n\n parse(xml);\n\n getContext = noopGetContext;\n parseStop = false;\n\n return returnError;\n };\n\n /**\n * Stop parsing.\n */\n this['stop'] = function() {\n parseStop = true;\n };\n\n /**\n * Parse string, invoking configured listeners on element.\n *\n * @param {string} xml\n */\n function parse(xml) {\n var nsMatrixStack = isNamespace ? [] : null,\n nsMatrix = isNamespace ? buildNsMatrix(nsUriToPrefix) : null,\n _nsMatrix,\n nodeStack = [],\n anonymousNsCount = 0,\n tagStart = false,\n tagEnd = false,\n i = 0, j = 0,\n x, y, q, w,\n xmlns,\n elementName,\n _elementName,\n elementProxy\n ;\n\n var attrsString = '',\n attrsStart = 0,\n cachedAttrs // false = parsed with errors, null = needs parsing\n ;\n\n /**\n * Parse attributes on demand and returns the parsed attributes.\n *\n * Return semantics: (1) `false` on attribute parse error,\n * (2) object hash on extracted attrs.\n *\n * @return {boolean|Object}\n */\n function getAttrs() {\n if (cachedAttrs !== null) {\n return cachedAttrs;\n }\n\n var nsUri,\n nsUriPrefix,\n nsName,\n defaultAlias = isNamespace && nsMatrix['xmlns'],\n attrList = isNamespace && maybeNS ? [] : null,\n i = attrsStart,\n s = attrsString,\n l = s.length,\n hasNewMatrix,\n newalias,\n value,\n alias,\n name,\n attrs = {},\n w,\n j;\n\n\n for (; i < l; i++) {\n w = s.charCodeAt(i);\n\n if (w === 32 || (w < 14 && w > 8) ) { // /f/n/r/t/v\n continue;\n }\n\n // wait for non whitespace character\n if (w < 65 || w > 122 || (w > 90 && w < 97) ) {\n if (w !== 95 && w !== 58) { // char 95\"_\" 58\":\"\n handleWarning('illegal first char attribute name');\n return cachedAttrs = false;\n }\n }\n\n // parse attribute name\n for (j = i + 1; j < l; j++) {\n w = s.charCodeAt(j);\n\n if ( w > 96 && w < 123 || w > 64 && w < 91 || w > 47 && w < 59 || w === 45 || w === 95) {\n continue;\n }\n\n if (w !== 61) { // \"=\" == 61\n // expected \"=\"\n handleWarning('missing attribute value');\n return cachedAttrs = false;\n }\n\n break;\n }\n\n name = s.substring(i, j);\n\n if (name === 'xmlns:xmlns') {\n handleWarning('illegal declaration of xmlns');\n return cachedAttrs = false; // error. invalid name\n }\n\n w = s.charCodeAt(j + 1);\n\n if (w === 34) { // '\"'\n j = s.indexOf('\"', i = j + 2 );\n\n } else {\n if (w !== 39) { // \"'\"\n handleWarning('missing attribute value quotes');\n return cachedAttrs = false; // error. invalid char\n }\n\n j = s.indexOf('/'', i = j + 2 );\n }\n\n if (j === -1) {\n handleWarning('attribute value quote missmatch');\n return cachedAttrs = false; // error. invalid char\n }\n\n if (j + 1 < l) {\n w = s.charCodeAt(j + 1);\n\n if (w > 32 || w < 9 || (w < 32 && w > 13)) {\n // error. invalid char\n handleWarning('illegal character after attribute end');\n return cachedAttrs = false;\n }\n }\n\n\n value = s.substring(i, j);\n\n // advance cursor to next attribute\n i = j + 1;\n\n if (!isNamespace) {\n attrs[name] = value;\n continue;\n }\n\n // try to extract namespace information\n if (maybeNS) {\n newalias = (\n name === 'xmlns'\n ? 'xmlns'\n : (name.charCodeAt(0) === 120 && name.substr(0, 6) === 'xmlns:')\n ? name.substr(6)\n : null\n );\n\n // handle xmlns(:alias) assignment\n if (newalias !== null) {\n nsUri = decodeEntities(value);\n nsUriPrefix = uriPrefix(newalias);\n\n alias = nsUriToPrefix[nsUri];\n\n if (!alias) {\n // no prefix defined or prefix collision\n if (\n (newalias === 'xmlns') ||\n (nsUriPrefix in nsMatrix && nsMatrix[nsUriPrefix] !== nsUri)\n ) {\n // alocate free ns prefix\n do {\n alias = 'ns' + (anonymousNsCount++);\n } while (typeof nsMatrix[alias] !== 'undefined');\n } else {\n alias = newalias;\n }\n\n nsUriToPrefix[nsUri] = alias;\n }\n\n if (nsMatrix[newalias] !== alias) {\n if (!hasNewMatrix) {\n nsMatrix = cloneNsMatrix(nsMatrix);\n hasNewMatrix = true;\n }\n\n nsMatrix[newalias] = alias;\n if (newalias === 'xmlns') {\n nsMatrix[uriPrefix(alias)] = nsUri;\n defaultAlias = alias;\n }\n\n nsMatrix[nsUriPrefix] = nsUri;\n }\n\n // expose xmlns(:asd)=\"...\" in attributes\n attrs[name] = value;\n continue;\n }\n\n // collect attributes until all namespace\n // declarations are processed\n attrList.push(name, value);\n continue;\n\n } /** end if (maybeNs) */\n\n // handle attributes on element without\n // namespace declarations\n w = name.indexOf(':');\n if (w === -1) {\n attrs[name] = value;\n continue;\n }\n\n // normalize ns attribute name\n if (!(nsName = nsMatrix[name.substring(0, w)])) {\n handleWarning(missingNamespaceForPrefix(name.substring(0, w)));\n continue;\n }\n\n name = defaultAlias === nsName\n ? name.substr(w + 1)\n : nsName + name.substr(w);\n // end: normalize ns attribute name\n\n // normalize xsi:type ns attribute value\n if (name === XSI_TYPE) {\n w = value.indexOf(':');\n\n if (w !== -1) {\n nsName = value.substring(0, w);\n // handle default prefixes, i.e. xs:String gracefully\n nsName = nsMatrix[nsName] || nsName;\n value = nsName + value.substring(w);\n } else {\n value = defaultAlias + ':' + value;\n }\n }\n // end: normalize xsi:type ns attribute value\n\n attrs[name] = value;\n }\n\n\n // handle deferred, possibly namespaced attributes\n if (maybeNS) {\n\n // normalize captured attributes\n for (i = 0, l = attrList.length; i < l; i++) {\n\n name = attrList[i++];\n value = attrList[i];\n\n w = name.indexOf(':');\n\n if (w !== -1) {\n // normalize ns attribute name\n if (!(nsName = nsMatrix[name.substring(0, w)])) {\n handleWarning(missingNamespaceForPrefix(name.substring(0, w)));\n continue;\n }\n\n name = defaultAlias === nsName\n ? name.substr(w + 1)\n : nsName + name.substr(w);\n // end: normalize ns attribute name\n\n // normalize xsi:type ns attribute value\n if (name === XSI_TYPE) {\n w = value.indexOf(':');\n\n if (w !== -1) {\n nsName = value.substring(0, w);\n // handle default prefixes, i.e. xs:String gracefully\n nsName = nsMatrix[nsName] || nsName;\n value = nsName + value.substring(w);\n } else {\n value = defaultAlias + ':' + value;\n }\n }\n // end: normalize xsi:type ns attribute value\n }\n\n attrs[name] = value;\n }\n // end: normalize captured attributes\n }\n\n return cachedAttrs = attrs;\n }\n\n /**\n * Extract the parse context { line, column, part }\n * from the current parser position.\n *\n * @return {Object} parse context\n */\n function getParseContext() {\n var splitsRe = /(/r/n|/r|/n)/g;\n\n var line = 0;\n var column = 0;\n var startOfLine = 0;\n var endOfLine = j;\n var match;\n var data;\n\n while (i >= startOfLine) {\n\n match = splitsRe.exec(xml);\n\n if (!match) {\n break;\n }\n\n // end of line = (break idx + break chars)\n endOfLine = match[0].length + match.index;\n\n if (endOfLine > i) {\n break;\n }\n\n // advance to next line\n line += 1;\n\n startOfLine = endOfLine;\n }\n\n // EOF errors\n if (i == -1) {\n column = endOfLine;\n data = '';\n } else {\n column = i - startOfLine;\n data = (j == -1 ? xml.substring(i) : xml.substring(i, j + 1));\n }\n\n return {\n 'data': data,\n 'line': line,\n 'column': column\n };\n }\n\n getContext = getParseContext;\n\n\n if (proxy) {\n elementProxy = Object.create({}, {\n 'name': getter(function() {\n return elementName;\n }),\n 'originalName': getter(function() {\n return _elementName;\n }),\n 'attrs': getter(getAttrs),\n 'ns': getter(function() {\n return nsMatrix;\n })\n });\n }\n\n // actual parse logic\n while (j !== -1) {\n\n if (xml.charCodeAt(j) === 60) { // \"<\"\n i = j;\n } else {\n i = xml.indexOf('<', j);\n }\n\n // parse end\n if (i === -1) {\n if (nodeStack.length) {\n return handleError('unexpected end of file');\n }\n\n if (j === 0) {\n return handleError('missing start tag');\n }\n\n return;\n }\n\n if (j !== i) {\n if (onText) {\n onText(xml.substring(j, i), decodeEntities);\n if (parseStop) {\n return;\n }\n }\n }\n\n w = xml.charCodeAt(i+1);\n\n // parse comments + CDATA\n if (w === 33) { // \"!\"\n w = xml.charCodeAt(i+2);\n if (w === 91 && xml.substr(i + 3, 6) === 'CDATA[') { // 91 == \"[\"\n j = xml.indexOf(']]>', i);\n if (j === -1) {\n return handleError('unclosed cdata');\n }\n\n if (onCDATA) {\n onCDATA(xml.substring(i + 9, j));\n if (parseStop) {\n return;\n }\n }\n\n j += 3;\n continue;\n }\n\n\n if (w === 45 && xml.charCodeAt(i + 3) === 45) { // 45 == \"-\"\n j = xml.indexOf('-->', i);\n if (j === -1) {\n return handleError('unclosed comment');\n }\n\n\n if (onComment) {\n onComment(xml.substring(i + 4, j), decodeEntities);\n if (parseStop) {\n return;\n }\n }\n\n j += 3;\n continue;\n }\n\n j = xml.indexOf('>', i + 1);\n if (j === -1) {\n return handleError('unclosed tag');\n }\n\n if (onAttention) {\n onAttention(xml.substring(i, j + 1), decodeEntities);\n if (parseStop) {\n return;\n }\n }\n\n j += 1;\n continue;\n }\n\n if (w === 63) { // \"?\"\n j = xml.indexOf('?>', i);\n if (j === -1) { // error\n return handleError('unclosed question');\n }\n\n if (onQuestion) {\n onQuestion(xml.substring(i, j + 2));\n if (parseStop) {\n return;\n }\n }\n\n j += 2;\n continue;\n }\n\n j = xml.indexOf('>', i + 1);\n\n if (j == -1) { // error\n return handleError('unclosed tag');\n }\n\n // don't process attributes;\n // there are none\n cachedAttrs = {};\n\n //if (xml.charCodeAt(i+1) === 47) { // close tag match\n x = elementName = nodeStack.pop();\n q = i + 2 + x.length;\n\n if (xml.substring(i + 2, q) !== x) {\n return handleError('closing tag mismatch');\n }\n\n // verify chars in close tag\n for (; q < j; q++) {\n w = xml.charCodeAt(q);\n\n if (w === 32 || (w > 8 && w < 14)) { // /f/n/r/t/v space\n continue;\n }\n\n return handleError('close tag');\n }\n\n } else {\n if (xml.charCodeAt(j - 1) === 47) { // .../>\n x = elementName = xml.substring(i + 1, j - 1);\n\n tagStart = true;\n tagEnd = true;\n\n } else {\n x = elementName = xml.substring(i + 1, j);\n\n tagStart = true;\n tagEnd = false;\n }\n\n if (!(w > 96 && w < 123 || w > 64 && w < 91 || w === 95 || w === 58)) { // char 95\"_\" 58\":\"\n return handleError('illegal first char nodeName');\n }\n\n for (q = 1, y = x.length; q < y; q++) {\n w = x.charCodeAt(q);\n\n if (w > 96 && w < 123 || w > 64 && w < 91 || w > 47 && w < 59 || w === 45 || w === 95) {\n continue;\n }\n\n if (w === 32 || (w < 14 && w > 8)) { // /f/n/r/t/v space\n elementName = x.substring(0, q);\n // maybe there are attributes\n cachedAttrs = null;\n break;\n }\n\n return handleError('invalid nodeName');\n }\n\n if (!tagEnd) {\n nodeStack.push(elementName);\n }\n }\n\n if (isNamespace) {\n\n _nsMatrix = nsMatrix;\n\n if (tagStart) {\n // remember old namespace\n // unless we're self-closing\n if (!tagEnd) {\n nsMatrixStack.push(_nsMatrix);\n }\n\n if (cachedAttrs === null) {\n // quick check, whether there may be namespace\n // declarations on the node; if that is the case\n // we need to eagerly parse the node attributes\n if ((maybeNS = x.indexOf('xmlns', q) !== -1)) {\n attrsStart = q;\n attrsString = x;\n\n getAttrs();\n\n maybeNS = false;\n }\n }\n }\n\n _elementName = elementName;\n\n w = elementName.indexOf(':');\n if (w !== -1) {\n xmlns = nsMatrix[elementName.substring(0, w)];\n\n // prefix given; namespace must exist\n if (!xmlns) {\n return handleError('missing namespace on <' + _elementName + '>');\n }\n\n elementName = elementName.substr(w + 1);\n } else {\n xmlns = nsMatrix['xmlns'];\n\n // if no default namespace is defined,\n // we'll import the element as anonymous.\n //\n // it is up to users to correct that to the document defined\n // targetNamespace, or whatever their undersanding of the\n // XML spec mandates.\n }\n\n // adjust namespace prefixs as configured\n if (xmlns) {\n elementName = xmlns + ':' + elementName;\n }\n\n }\n\n if (tagStart) {\n attrsStart = q;\n attrsString = x;\n\n if (onOpenTag) {\n if (proxy) {\n onOpenTag(elementProxy, decodeEntities, tagEnd, getContext);\n } else {\n onOpenTag(elementName, getAttrs, decodeEntities, tagEnd, getContext);\n }\n\n if (parseStop) {\n return;\n }\n }\n\n }\n\n if (tagEnd) {\n\n if (onCloseTag) {\n onCloseTag(proxy ? elementProxy : elementName, decodeEntities, tagStart, getContext);\n\n if (parseStop) {\n return;\n }\n }\n\n // restore old namespace\n if (isNamespace) {\n if (!tagStart) {\n nsMatrix = nsMatrixStack.pop();\n } else {\n nsMatrix = _nsMatrix;\n }\n }\n }\n\n j += 1;\n }\n } /** end parse */\n\n}","/**\n * Tiny stack for browser or server\n *\n * @author Jason Mulligan \n * @copyright 2014 Jason Mulligan\n * @license BSD-3 \n * @link http://avoidwork.github.io/tiny-stack\n * @module tiny-stack\n * @version 0.1.0\n */\n\n( function ( global ) {\n\n\"use strict\";\n\n/**\n * TinyStack\n *\n * @constructor\n */\nfunction TinyStack () {\n\tthis.data = [null];\n\tthis.top = 0;\n}\n\n/**\n * Clears the stack\n *\n * @method clear\n * @memberOf TinyStack\n * @return {Object} {@link TinyStack}\n */\nTinyStack.prototype.clear = function clear () {\n\tthis.data = [null];\n\tthis.top = 0;\n\n\treturn this;\n};\n\n/**\n * Gets the size of the stack\n *\n * @method length\n * @memberOf TinyStack\n * @return {Number} Size of stack\n */\nTinyStack.prototype.length = function length () {\n\treturn this.top;\n};\n\n/**\n * Gets the item at the top of the stack\n *\n * @method peek\n * @memberOf TinyStack\n * @return {Mixed} Item at the top of the stack\n */\nTinyStack.prototype.peek = function peek () {\n\treturn this.data[this.top];\n};\n\n/**\n * Gets & removes the item at the top of the stack\n *\n * @method pop\n * @memberOf TinyStack\n * @return {Mixed} Item at the top of the stack\n */\nTinyStack.prototype.pop = function pop () {\n\tif ( this.top > 0 ) {\n\t\tthis.top--;\n\n\t\treturn this.data.pop();\n\t}\n\telse {\n\t\treturn undefined;\n\t}\n};\n\n/**\n * Pushes an item onto the stack\n *\n * @method push\n * @memberOf TinyStack\n * @return {Object} {@link TinyStack}\n */\nTinyStack.prototype.push = function push ( arg ) {\n\tthis.data[++this.top] = arg;\n\n\treturn this;\n};\n\n/**\n * TinyStack factory\n *\n * @method factory\n * @return {Object} {@link TinyStack}\n */\nfunction factory () {\n\treturn new TinyStack();\n}\n\n// Node, AMD & window supported\nif ( typeof exports != \"undefined\" ) {\n\tmodule.exports = factory;\n}\nelse if ( typeof define == \"function\" ) {\n\tdefine( function () {\n\t\treturn factory;\n\t} );\n}\nelse {\n\tglobal.stack = factory;\n}\n} )( this );\n","/**\n * append utility\n */\n\nmodule.exports = append;\n\nvar appendTo = require(473);\n\n/**\n * Append a node to an element\n *\n * @param {SVGElement} element\n * @param {SVGElement} node\n *\n * @return {SVGElement} the element\n */\nfunction append(element, node) {\n appendTo(node, element);\n return element;\n}","/**\n * appendTo utility\n */\nmodule.exports = appendTo;\n\nvar ensureImported = require(483);\n\n/**\n * Append a node to a target element and return the appended node.\n *\n * @param {SVGElement} element\n * @param {SVGElement} node\n *\n * @return {SVGElement} the appended node\n */\nfunction appendTo(element, target) {\n target.appendChild(ensureImported(element, target));\n return element;\n}","/**\n * attribute accessor utility\n */\n\nmodule.exports = attr;\n\n\nvar LENGTH_ATTR = 2;\n\nvar CSS_PROPERTIES = {\n 'alignment-baseline': 1,\n 'baseline-shift': 1,\n 'clip': 1,\n 'clip-path': 1,\n 'clip-rule': 1,\n 'color': 1,\n 'color-interpolation': 1,\n 'color-interpolation-filters': 1,\n 'color-profile': 1,\n 'color-rendering': 1,\n 'cursor': 1,\n 'direction': 1,\n 'display': 1,\n 'dominant-baseline': 1,\n 'enable-background': 1,\n 'fill': 1,\n 'fill-opacity': 1,\n 'fill-rule': 1,\n 'filter': 1,\n 'flood-color': 1,\n 'flood-opacity': 1,\n 'font': 1,\n 'font-family': 1,\n 'font-size': LENGTH_ATTR,\n 'font-size-adjust': 1,\n 'font-stretch': 1,\n 'font-style': 1,\n 'font-variant': 1,\n 'font-weight': 1,\n 'glyph-orientation-horizontal': 1,\n 'glyph-orientation-vertical': 1,\n 'image-rendering': 1,\n 'kerning': 1,\n 'letter-spacing': 1,\n 'lighting-color': 1,\n 'marker': 1,\n 'marker-end': 1,\n 'marker-mid': 1,\n 'marker-start': 1,\n 'mask': 1,\n 'opacity': 1,\n 'overflow': 1,\n 'pointer-events': 1,\n 'shape-rendering': 1,\n 'stop-color': 1,\n 'stop-opacity': 1,\n 'stroke': 1,\n 'stroke-dasharray': 1,\n 'stroke-dashoffset': 1,\n 'stroke-linecap': 1,\n 'stroke-linejoin': 1,\n 'stroke-miterlimit': 1,\n 'stroke-opacity': 1,\n 'stroke-width': LENGTH_ATTR,\n 'text-anchor': 1,\n 'text-decoration': 1,\n 'text-rendering': 1,\n 'unicode-bidi': 1,\n 'visibility': 1,\n 'word-spacing': 1,\n 'writing-mode': 1\n};\n\n\nfunction getAttribute(node, name) {\n if (CSS_PROPERTIES[name]) {\n return node.style[name];\n } else {\n return node.getAttributeNS(null, name);\n }\n}\n\nfunction setAttribute(node, name, value) {\n var hyphenated = name.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();\n\n var type = CSS_PROPERTIES[hyphenated];\n\n if (type) {\n // append pixel unit, unless present\n if (type === LENGTH_ATTR && typeof value === 'number') {\n value = String(value) + 'px';\n }\n\n node.style[hyphenated] = value;\n } else {\n node.setAttributeNS(null, name, value);\n }\n}\n\nfunction setAttributes(node, attrs) {\n\n var names = Object.keys(attrs), i, name;\n\n for (i = 0, name; (name = names[i]); i++) {\n setAttribute(node, name, attrs[name]);\n }\n}\n\n/**\n * Gets or sets raw attributes on a node.\n *\n * @param {SVGElement} node\n * @param {Object} [attrs]\n * @param {String} [name]\n * @param {String} [value]\n *\n * @return {String}\n */\nfunction attr(node, name, value) {\n if (typeof name === 'string') {\n if (value !== undefined) {\n setAttribute(node, name, value);\n } else {\n return getAttribute(node, name);\n }\n } else {\n setAttributes(node, name);\n }\n\n return node;\n}\n","/**\r\n * Clear utility\r\n */\r\nmodule.exports = classes;\r\n\r\nvar index = function(arr, obj) {\r\n if (arr.indexOf) {\r\n return arr.indexOf(obj);\r\n }\r\n\r\n\r\n for (var i = 0; i < arr.length; ++i) {\r\n if (arr[i] === obj) {\r\n return i;\r\n }\r\n }\r\n\r\n return -1;\r\n};\r\n\r\nvar re = //s+/;\r\n\r\nvar toString = Object.prototype.toString;\r\n\r\nfunction defined(o) {\r\n return typeof o !== 'undefined';\r\n}\r\n\r\n/**\r\n * Wrap `el` in a `ClassList`.\r\n *\r\n * @param {Element} el\r\n * @return {ClassList}\r\n * @api public\r\n */\r\n\r\nfunction classes(el) {\r\n return new ClassList(el);\r\n}\r\n\r\nfunction ClassList(el) {\r\n if (!el || !el.nodeType) {\r\n throw new Error('A DOM element reference is required');\r\n }\r\n this.el = el;\r\n this.list = el.classList;\r\n}\r\n\r\n/**\r\n * Add class `name` if not already present.\r\n *\r\n * @param {String} name\r\n * @return {ClassList}\r\n * @api public\r\n */\r\n\r\nClassList.prototype.add = function(name) {\r\n\r\n // classList\r\n if (this.list) {\r\n this.list.add(name);\r\n return this;\r\n }\r\n\r\n // fallback\r\n var arr = this.array();\r\n var i = index(arr, name);\r\n if (!~i) {\r\n arr.push(name);\r\n }\r\n\r\n if (defined(this.el.className.baseVal)) {\r\n this.el.className.baseVal = arr.join(' ');\r\n } else {\r\n this.el.className = arr.join(' ');\r\n }\r\n\r\n return this;\r\n};\r\n\r\n/**\r\n * Remove class `name` when present, or\r\n * pass a regular expression to remove\r\n * any which match.\r\n *\r\n * @param {String|RegExp} name\r\n * @return {ClassList}\r\n * @api public\r\n */\r\n\r\nClassList.prototype.remove = function(name) {\r\n if ('[object RegExp]' === toString.call(name)) {\r\n return this.removeMatching(name);\r\n }\r\n\r\n // classList\r\n if (this.list) {\r\n this.list.remove(name);\r\n return this;\r\n }\r\n\r\n // fallback\r\n var arr = this.array();\r\n var i = index(arr, name);\r\n if (~i) {\r\n arr.splice(i, 1);\r\n }\r\n this.el.className.baseVal = arr.join(' ');\r\n return this;\r\n};\r\n\r\n/**\r\n * Remove all classes matching `re`.\r\n *\r\n * @param {RegExp} re\r\n * @return {ClassList}\r\n * @api private\r\n */\r\n\r\nClassList.prototype.removeMatching = function(re) {\r\n var arr = this.array();\r\n for (var i = 0; i < arr.length; i++) {\r\n if (re.test(arr[i])) {\r\n this.remove(arr[i]);\r\n }\r\n }\r\n return this;\r\n};\r\n\r\n/**\r\n * Toggle class `name`, can force state via `force`.\r\n *\r\n * For browsers that support classList, but do not support `force` yet,\r\n * the mistake will be detected and corrected.\r\n *\r\n * @param {String} name\r\n * @param {Boolean} force\r\n * @return {ClassList}\r\n * @api public\r\n */\r\n\r\nClassList.prototype.toggle = function(name, force) {\r\n // classList\r\n if (this.list) {\r\n if (defined(force)) {\r\n if (force !== this.list.toggle(name, force)) {\r\n this.list.toggle(name); // toggle again to correct\r\n }\r\n } else {\r\n this.list.toggle(name);\r\n }\r\n return this;\r\n }\r\n\r\n // fallback\r\n if (defined(force)) {\r\n if (!force) {\r\n this.remove(name);\r\n } else {\r\n this.add(name);\r\n }\r\n } else {\r\n if (this.has(name)) {\r\n this.remove(name);\r\n } else {\r\n this.add(name);\r\n }\r\n }\r\n\r\n return this;\r\n};\r\n\r\n/**\r\n * Return an array of classes.\r\n *\r\n * @return {Array}\r\n * @api public\r\n */\r\n\r\nClassList.prototype.array = function() {\r\n var className = this.el.getAttribute('class') || '';\r\n var str = className.replace(/^/s+|/s+$/g, '');\r\n var arr = str.split(re);\r\n if ('' === arr[0]) {\r\n arr.shift();\r\n }\r\n return arr;\r\n};\r\n\r\n/**\r\n * Check if class `name` is present.\r\n *\r\n * @param {String} name\r\n * @return {ClassList}\r\n * @api public\r\n */\r\n\r\nClassList.prototype.has =\r\nClassList.prototype.contains = function(name) {\r\n return (\r\n this.list ?\r\n this.list.contains(name) :\r\n !! ~index(this.array(), name)\r\n );\r\n};\r\n","/**\n * Clear utility\n */\n\nmodule.exports = clear;\n\n\nvar remove = require(481);\n\n/**\n * Removes all children from the given element\n *\n * @param {DOMElement} element\n * @return {DOMElement} the element (for chaining)\n */\nfunction clear(element) {\n var child;\n\n while ((child = element.firstChild)) {\n remove(child);\n }\n\n return element;\n}","module.exports = clone;\n\nfunction clone(element) {\n return element.cloneNode(true);\n}","/**\n * Create utility for SVG elements\n */\n\nmodule.exports = create;\n\n\nvar attr = require(474);\nvar parse = require(485);\nvar ns = require(484);\n\n\n/**\n * Create a specific type from name or SVG markup.\n *\n * @param {String} name the name or markup of the element\n * @param {Object} [attrs] attributes to set on the element\n *\n * @returns {SVGElement}\n */\nfunction create(name, attrs) {\n var element;\n\n if (name.charAt(0) === '<') {\n element = parse(name).firstChild;\n element = document.importNode(element, true);\n } else {\n element = document.createElementNS(ns.svg, name);\n }\n\n if (attrs) {\n attr(element, attrs);\n }\n\n return element;\n}","/**\n * Geometry helpers\n */\n\n\nvar create = require(478);\n\n// fake node used to instantiate svg geometry elements\nvar node = create('svg');\n\nfunction extend(object, props) {\n var i, k, keys = Object.keys(props);\n\n for (i = 0; (k = keys[i]); i++) {\n object[k] = props[k];\n }\n\n return object;\n}\n\n\nfunction createPoint(x, y) {\n var point = node.createSVGPoint();\n\n switch (arguments.length) {\n case 0:\n return point;\n case 2:\n x = {\n x: x,\n y: y\n };\n break;\n }\n\n return extend(point, x);\n}\n\nfunction createMatrix(a, b, c, d, e, f) {\n var matrix = node.createSVGMatrix();\n\n switch (arguments.length) {\n case 0:\n return matrix;\n case 6:\n a = {\n a: a,\n b: b,\n c: c,\n d: d,\n e: e,\n f: f\n };\n break;\n }\n\n return extend(matrix, a);\n}\n\nfunction createTransform(matrix) {\n if (matrix) {\n return node.createSVGTransformFromMatrix(matrix);\n } else {\n return node.createSVGTransform();\n }\n}\n\n\nmodule.exports.createTransform = createTransform;\nmodule.exports.createMatrix = createMatrix;\nmodule.exports.createPoint = createPoint;","/**\n * innerHTML like functionality for SVG elements.\n * based on innerSVG (https://code.google.com/p/innersvg)\n */\n\nmodule.exports = innerSVG;\n\n\nvar clear = require(476);\nvar appendTo = require(473);\nvar parse = require(485);\nvar serialize = require(486);\n\n\nfunction set(element, svg) {\n\n var node,\n documentElement = parse(svg).documentElement;\n\n // clear element contents\n clear(element);\n\n if (!svg) {\n return;\n }\n\n // import + append each node\n node = documentElement.firstChild;\n\n while (node) {\n appendTo(node, element);\n node = node.nextSibling;\n }\n}\n\nfunction get(element) {\n var child = element.firstChild,\n output = [];\n\n while (child) {\n serialize(child, output);\n child = child.nextSibling;\n }\n\n return output.join('');\n}\n\nfunction innerSVG(element, svg) {\n\n if (svg !== undefined) {\n\n try {\n set(element, svg);\n } catch (e) {\n throw new Error('error parsing SVG: ' + e.message);\n }\n\n return element;\n } else {\n return get(element);\n }\n}","module.exports = remove;\n\nfunction remove(element) {\n var parent = element.parentNode;\n\n if (parent) {\n parent.removeChild(element);\n }\n\n return element;\n}","/**\n * transform accessor utility\n */\n\nmodule.exports = transform;\n\nfunction wrapMatrix(transformList, transform) {\n if (transform instanceof SVGMatrix) {\n return transformList.createSVGTransformFromMatrix(transform);\n } else {\n return transform;\n }\n}\n\nfunction setTransforms(transformList, transforms) {\n var i, t;\n\n transformList.clear();\n\n for (i = 0; (t = transforms[i]); i++) {\n transformList.appendItem(wrapMatrix(transformList, t));\n }\n\n transformList.consolidate();\n}\n\nfunction transform(node, transforms) {\n var transformList = node.transform.baseVal;\n\n if (arguments.length === 1) {\n return transformList.consolidate();\n } else {\n if (transforms.length) {\n setTransforms(transformList, transforms);\n } else {\n transformList.initialize(wrapMatrix(transformList, transforms));\n }\n }\n}","module.exports = ensureImported;\n\nfunction ensureImported(element, target) {\n\n if (element.ownerDocument !== target.ownerDocument) {\n try {\n // may fail on webkit\n return target.ownerDocument.importNode(element, true);\n } catch (e) {\n // ignore\n }\n }\n\n return element;\n}","var ns = {\n svg: 'http://www.w3.org/2000/svg'\n};\n\nmodule.exports = ns;","/**\n * DOM parsing utility\n */\n\nmodule.exports = parse;\n\n\nvar ns = require(484);\n\nvar SVG_START = '' + svg + '';\n }\n\n return parseDocument(svg);\n}\n\nfunction parseDocument(svg) {\n\n var parser;\n\n // parse\n parser = new DOMParser();\n parser.async = false;\n\n return parser.parseFromString(svg, 'text/xml');\n}","/**\n * Serialization util\n */\n\nmodule.exports = serialize;\n\n\nvar TEXT_ENTITIES = /([&<>]{1})/g;\nvar ATTR_ENTITIES = /([/n/r\"]{1})/g;\n\nvar ENTITY_REPLACEMENT = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '/''\n};\n\nfunction escape(str, pattern) {\n\n function replaceFn(match, entity) {\n return ENTITY_REPLACEMENT[entity] || entity;\n }\n\n return str.replace(pattern, replaceFn);\n}\n\nfunction serialize(node, output) {\n\n var i, len, attrMap, attrNode, childNodes;\n\n switch (node.nodeType) {\n // TEXT\n case 3:\n // replace special XML characters\n output.push(escape(node.textContent, TEXT_ENTITIES));\n break;\n\n // ELEMENT\n case 1:\n output.push('<', node.tagName);\n\n if (node.hasAttributes()) {\n attrMap = node.attributes;\n for (i = 0, len = attrMap.length; i < len; ++i) {\n attrNode = attrMap.item(i);\n output.push(' ', attrNode.name, '=\"', escape(attrNode.value, ATTR_ENTITIES), '\"');\n }\n }\n\n if (node.hasChildNodes()) {\n output.push('>');\n childNodes = node.childNodes;\n for (i = 0, len = childNodes.length; i < len; ++i) {\n serialize(childNodes.item(i), output);\n }\n output.push('');\n } else {\n output.push('/>');\n }\n break;\n\n // COMMENT\n case 8:\n output.push('');\n break;\n\n // CDATA\n case 4:\n output.push('');\n break;\n\n default:\n throw new Error('unable to handle node ' + node.nodeType);\n }\n\n return output;\n}"]}