"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.nativeAnchorStyles = exports.isCSSAttrAnchorSupported = exports.isCSSAnchorSupported = exports.ANCHOR_VARIABLE_NAME = void 0;
var _react = require("@emotion/react");
var _memoizeOne = _interopRequireDefault(require("memoize-one"));
/* eslint-disable @atlaskit/ui-styling-standard/use-compiled -- Pre-existing lint debt surfaced by this mechanical type-import-only PR. */
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766

var ANCHOR_VARIABLE_NAME = exports.ANCHOR_VARIABLE_NAME = '--ed-pm-node-anchor';
var hasCssSupport = (0, _memoizeOne.default)(function () {
  if (typeof window !== 'undefined' && window.CSS && typeof window.CSS.supports === 'function') {
    return true;
  }
  return false;
});
var isCSSAttrAnchorSupported = exports.isCSSAttrAnchorSupported = (0, _memoizeOne.default)(function () {
  if (hasCssSupport()) {
    return CSS.supports('anchor-name', 'attr(data-anchor-name type(<custom-ident>))');
  }
  return false;
});
var isCSSAnchorSupported = exports.isCSSAnchorSupported = (0, _memoizeOne.default)(function () {
  if (hasCssSupport()) {
    return CSS.supports('anchor-name', '--anchor');
  }
});

// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles
var nativeAnchorStyles = exports.nativeAnchorStyles = (0, _react.css)({
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
  '.ProseMirror': {
    // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
    '[data-node-anchor]': {
      anchorName: "var(".concat(ANCHOR_VARIABLE_NAME, ", attr(data-node-anchor type(<custom-ident>)))")
    }
  }
});