text: import { S as Selection, r as root, c as creator, e as event } from './common/index-cfc1b340.js';
  export { c as creator, h as customEvent, e as event, m as matcher, n as namespace, a as namespaces, s as selection, b as selector, d as selectorAll, f as style, g as window } from './common/index-cfc1b340.js';
  
  function select(selector) {
    return typeof selector === "string"
        ? new Selection([[document.querySelector(selector)]], [document.documentElement])
        : new Selection([[selector]], root);
  }
  
  function create(name) {
    return select(creator(name).call(document.documentElement));
  }
  
  var nextId = 0;
  
  function local() {
    return new Local;
  }
  
  function Local() {
    this._ = "@" + (++nextId).toString(36);
  }
  
  Local.prototype = local.prototype = {
    constructor: Local,
    get: function(node) {
      var id = this._;
      while (!(id in node)) if (!(node = node.parentNode)) return;
      return node[id];
    },
    set: function(node, value) {
      return node[this._] = value;
    },
    remove: function(node) {
      return this._ in node && delete node[this._];
    },
    toString: function() {
      return this._;
    }
  };
  
  function sourceEvent() {
    var current = event, source;
    while (source = current.sourceEvent) current = source;
    return current;
  }
  
  function point(node, event) {
    var svg = node.ownerSVGElement || node;
  
    if (svg.createSVGPoint) {
      var point = svg.createSVGPoint();
      point.x = event.clientX, point.y = event.clientY;
      point = point.matrixTransform(node.getScreenCTM().inverse());
      return [point.x, point.y];
    }
  
    var rect = node.getBoundingClientRect();
    return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];
  }
  
  function mouse(node) {
    var event = sourceEvent();
    if (event.changedTouches) event = event.changedTouches[0];
    return point(node, event);
  }
  
  function selectAll(selector) {
    return typeof selector === "string"
        ? new Selection([document.querySelectorAll(selector)], [document.documentElement])
        : new Selection([selector == null ? [] : selector], root);
  }
  
  function touch(node, touches, identifier) {
    if (arguments.length < 3) identifier = touches, touches = sourceEvent().changedTouches;
  
    for (var i = 0, n = touches ? touches.length : 0, touch; i < n; ++i) {
      if ((touch = touches[i]).identifier === identifier) {
        return point(node, touch);
      }
    }
  
    return null;
  }
  
  function touches(node, touches) {
    if (touches == null) touches = sourceEvent().touches;
  
    for (var i = 0, n = touches ? touches.length : 0, points = new Array(n); i < n; ++i) {
      points[i] = point(node, touches[i]);
    }
  
    return points;
  }
  
  export { point as clientPoint, create, local, mouse, select, selectAll, touch, touches };
  