{"version":3,"sources":["node_modules\\react-dom\\lib\\SelectEventPlugin.js"],"names":["EventPropagators","require","ExecutionEnvironment","ReactDOMComponentTree","ReactInputSelection","SyntheticEvent","getActiveElement","isTextInputElement","shallowEqual","skipSelectionChangeEvent","canUseDOM","document","documentMode","eventTypes","select","phasedRegistrationNames","bubbled","captured","dependencies","activeElement","activeElementInst","lastSelection","mouseDown","hasListener","getSelection","node","hasSelectionCapabilities","start","selectionStart","end","selectionEnd","window","selection","anchorNode","anchorOffset","focusNode","focusOffset","range","createRange","parentElement","text","top","boundingTop","left","boundingLeft","constructSelectEvent","nativeEvent","nativeEventTarget","currentSelection","syntheticEvent","getPooled","type","target","accumulateTwoPhaseDispatches","SelectEventPlugin","extractEvents","topLevelType","targetInst","targetNode","getNodeFromInstance","contentEditable","didPutListener","inst","registrationName","listener","module","exports"],"mappings":";;;;;;;;;;AAUA;;AAEA,GAAIA,kBAAmBC,QAAQ,oBAAR,CAAvB;AACA,GAAIC,sBAAuBD,QAAQ,+BAAR,CAA3B;AACA,GAAIE,uBAAwBF,QAAQ,yBAAR,CAA5B;AACA,GAAIG,qBAAsBH,QAAQ,uBAAR,CAA1B;AACA,GAAII,gBAAiBJ,QAAQ,kBAAR,CAArB;;AAEA,GAAIK,kBAAmBL,QAAQ,2BAAR,CAAvB;AACA,GAAIM,oBAAqBN,QAAQ,sBAAR,CAAzB;AACA,GAAIO,cAAeP,QAAQ,uBAAR,CAAnB;;AAEA,GAAIQ,0BAA2BP,qBAAqBQ,SAArB,EAAkC,gBAAkBC,SAApD,EAAgEA,SAASC,YAAT,EAAyB,EAAxH;;AAEA,GAAIC,YAAa;AACfC,OAAQ;AACNC,wBAAyB;AACvBC,QAAS,UADc;AAEvBC,SAAU,iBAFa,CADnB;;AAKNC,aAAc,CAAC,SAAD,CAAY,gBAAZ,CAA8B,UAA9B,CAA0C,YAA1C,CAAwD,UAAxD,CAAoE,cAApE,CAAoF,YAApF,CAAkG,oBAAlG,CALR,CADO,CAAjB;;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;AACD;AACF,CA3DqB,CAAxB;;;AA8DA0C,OAAOC,OAAP,CAAiBZ,iBAAjB","file":"SelectEventPlugin.js","sourceRoot":"D:/Work/Office/react-native-on-web/cli/tmpl/project","sourcesContent":["/**\n * Copyright 2013-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n */\n\n'use strict';\n\nvar EventPropagators = require('./EventPropagators');\nvar ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');\nvar ReactDOMComponentTree = require('./ReactDOMComponentTree');\nvar ReactInputSelection = require('./ReactInputSelection');\nvar SyntheticEvent = require('./SyntheticEvent');\n\nvar getActiveElement = require('fbjs/lib/getActiveElement');\nvar isTextInputElement = require('./isTextInputElement');\nvar shallowEqual = require('fbjs/lib/shallowEqual');\n\nvar skipSelectionChangeEvent = ExecutionEnvironment.canUseDOM && 'documentMode' in document && document.documentMode <= 11;\n\nvar eventTypes = {\n  select: {\n    phasedRegistrationNames: {\n      bubbled: 'onSelect',\n      captured: 'onSelectCapture'\n    },\n    dependencies: ['topBlur', 'topContextMenu', 'topFocus', 'topKeyDown', 'topKeyUp', 'topMouseDown', 'topMouseUp', 'topSelectionChange']\n  }\n};\n\nvar activeElement = null;\nvar activeElementInst = null;\nvar lastSelection = null;\nvar mouseDown = false;\n\n// Track whether a listener exists for this plugin. If none exist, we do\n// not extract events. See #3639.\nvar hasListener = false;\n\n/**\n * Get an object which is a unique representation of the current selection.\n *\n * The return value will not be consistent across nodes or browsers, but\n * two identical selections on the same node will return identical objects.\n *\n * @param {DOMElement} node\n * @return {object}\n */\nfunction getSelection(node) {\n  if ('selectionStart' in node && ReactInputSelection.hasSelectionCapabilities(node)) {\n    return {\n      start: node.selectionStart,\n      end: node.selectionEnd\n    };\n  } else if (window.getSelection) {\n    var selection = window.getSelection();\n    return {\n      anchorNode: selection.anchorNode,\n      anchorOffset: selection.anchorOffset,\n      focusNode: selection.focusNode,\n      focusOffset: selection.focusOffset\n    };\n  } else if (document.selection) {\n    var range = document.selection.createRange();\n    return {\n      parentElement: range.parentElement(),\n      text: range.text,\n      top: range.boundingTop,\n      left: range.boundingLeft\n    };\n  }\n}\n\n/**\n * Poll selection to see whether it's changed.\n *\n * @param {object} nativeEvent\n * @return {?SyntheticEvent}\n */\nfunction constructSelectEvent(nativeEvent, nativeEventTarget) {\n  // Ensure we have the right element, and that the user is not dragging a\n  // selection (this matches native `select` event behavior). In HTML5, select\n  // fires only on input and textarea thus if there's no focused element we\n  // won't dispatch.\n  if (mouseDown || activeElement == null || activeElement !== getActiveElement()) {\n    return null;\n  }\n\n  // Only fire when selection has actually changed.\n  var currentSelection = getSelection(activeElement);\n  if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {\n    lastSelection = currentSelection;\n\n    var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementInst, nativeEvent, nativeEventTarget);\n\n    syntheticEvent.type = 'select';\n    syntheticEvent.target = activeElement;\n\n    EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent);\n\n    return syntheticEvent;\n  }\n\n  return null;\n}\n\n/**\n * This plugin creates an `onSelect` event that normalizes select events\n * across form elements.\n *\n * Supported elements are:\n * - input (see `isTextInputElement`)\n * - textarea\n * - contentEditable\n *\n * This differs from native browser implementations in the following ways:\n * - Fires on contentEditable fields as well as inputs.\n * - Fires for collapsed selection.\n * - Fires after user input.\n */\nvar SelectEventPlugin = {\n  eventTypes: eventTypes,\n\n  extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {\n    if (!hasListener) {\n      return null;\n    }\n\n    var targetNode = targetInst ? ReactDOMComponentTree.getNodeFromInstance(targetInst) : window;\n\n    switch (topLevelType) {\n      // Track the input node that has focus.\n      case 'topFocus':\n        if (isTextInputElement(targetNode) || targetNode.contentEditable === 'true') {\n          activeElement = targetNode;\n          activeElementInst = targetInst;\n          lastSelection = null;\n        }\n        break;\n      case 'topBlur':\n        activeElement = null;\n        activeElementInst = null;\n        lastSelection = null;\n        break;\n      // Don't fire the event while the user is dragging. This matches the\n      // semantics of the native select event.\n      case 'topMouseDown':\n        mouseDown = true;\n        break;\n      case 'topContextMenu':\n      case 'topMouseUp':\n        mouseDown = false;\n        return constructSelectEvent(nativeEvent, nativeEventTarget);\n      // Chrome and IE fire non-standard event when selection is changed (and\n      // sometimes when it hasn't). IE's event fires out of order with respect\n      // to key and input events on deletion, so we discard it.\n      //\n      // Firefox doesn't support selectionchange, so check selection status\n      // after each key entry. The selection changes after keydown and before\n      // keyup, but we check on keydown as well in the case of holding down a\n      // key, when multiple keydown events are fired but only one keyup is.\n      // This is also our approach for IE handling, for the reason above.\n      case 'topSelectionChange':\n        if (skipSelectionChangeEvent) {\n          break;\n        }\n      // falls through\n      case 'topKeyDown':\n      case 'topKeyUp':\n        return constructSelectEvent(nativeEvent, nativeEventTarget);\n    }\n\n    return null;\n  },\n\n  didPutListener: function (inst, registrationName, listener) {\n    if (registrationName === 'onSelect') {\n      hasListener = true;\n    }\n  }\n};\n\nmodule.exports = SelectEventPlugin;"]}