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zQzM5IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkFCOTMyOTdDMDFDQzExRThBNjNBQTcwM0I2RDYzQzM5Ii8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+mn17wgAAABxJREFUeNpivH37NgMpgImBRDCqYVTD0NEAEGAAC3YCsayESVIAAAAASUVORK5CYII=";

.custom-node-popover {
  .ant-popover-inner-content {
    padding: 0 !important;
  }

  .ant-popover-title {
    height: 3rem;
    font-size: 18px;
    line-height: 3rem;
    color: black;
    background: $node-title-color;
  }

  .node-popover-ability {
    &::before {
      position: relative;
      left: -8px;
      border-color: $node-title-color;
      border-style: solid;
      border-width: 2px;
      border-radius: 5px;
      content: "";
    }
  }
}


%element-cell-style {
  width: 50px;
  height: 50px;
}

.amos-plumb-property {
  width: 100%;
  height: 100%;
  color: black;
  border: 1px solid #345FA6;
}

.element-bar {
  float: left;
  margin-left: 3%;
  background: #888;

  .element-bar-tip {
    padding: 1rem;
    text-align: center;
    background: $grey;
  }

  .element-bar-content {
    padding: 1rem;
    text-align: center;
    background: $grey;
  }
}

%node-operator-item {
  width: 2rem;
  height: 2rem;
  padding: 0.1rem;
  line-height: 2rem;
  text-align: center;
  cursor: pointer;
  background-color: rgba(150, 150, 150, 0.7);
  border-radius: 50%;

  &:hover {
    background-color: rgba(200, 200, 200, 0.7);
  }
}

/**
 * make node core
 */
@mixin make-test-core($width: 150px, $height: 100px, $bg: $--default, $border: $--default, $hover: $--default) {
  position: absolute;
  display: inline-block;
  width: $width;
  height: $height;
  cursor: pointer;
  background: $bg;
  border: 1px solid $border;

  &:hover {
    border: 1px solid $hover;
  }
}

// giot 生成node
@mixin make-giot-node($w: 150px, $h: 50px, $img: $default-img) {
  position: absolute;
  display: inline-block;
  width: $w;
  height: $h;
  font-size: 14px;
  color: black;
  cursor: pointer;
  background: url($img) no-repeat;
  background-size: 100% 100%;

  &:hover {
    .node-content-wrapper {
      // border: 2px dashed #888;

      .triger-action,
      .ele-catlog {
        display: block;
      }
    }
  }
}

// giot 生成node
@mixin make-giot-color-node($w: 150px, $h: 50px, $color: transparent) {
  position: absolute;
  display: inline-block;
  width: $w;
  height: $h;
  font-size: 14px;
  color: black;
  cursor: pointer;
  background: $color;
  background-size: 100% 100%;

  &:hover {
    .node-content-wrapper {
      // border: 2px dashed #888;
      .ele-node-action,
      // .plumb-node-wrapped.head-move,
      .triger-action,
      .ele-catlog {
        display: block;
      }
    }
  }
}

.custom-ele {
  @include make-giot-color-node(98px, 66px, transparent);

  top: 250px;
  left: 200px;
  z-index: 20;
  cursor: move;
  border: 2px solid rgba(52, 96, 166, 0.548);

  .node-content-wrapper {
    position: relative;
    display: inline;

    .quota-data {
      position: relative;
      top: 0;
      left: -1px;
      width: 137px;
      height: 26px;

      .quota-dpn-0 {
        &:first-child {
          position: relative;
          top: -4px;
          left: 0px;
          width: 137px;
          height: 26px;
          padding-top: 2px;
          padding-left: 10px;
          background: #F2F2F2;
          border-radius: 9px;
          -webkit-box-shadow: 1px 1px 10px 1px rgba(0, 0, 0, 0.34902);
          box-shadow: 1px 1px 10px 1px rgba(0, 0, 0, 0.34902);
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }

        &:last-child {
          position: relative;
          top: 7px;
          left: 0px;
          width: 137px;
          height: 26px;
          padding-top: 2px;
          padding-left: 10px;
          background: #F2F2F2;
          border-radius: 9px;
          -webkit-box-shadow: 1px 1px 10px 1px rgba(0, 0, 0, 0.34902);
          box-shadow: 1px 1px 10px 1px rgba(0, 0, 0, 0.34902);
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }
      }
    }

    .text-info {
      position: relative;
      top: 13px;
      left: -17px;
      // z-index: 1;
      width: 137px;
      height: 26px;
      background: #F2F2F2;
      border-radius: 9px;
      box-shadow: 1px 1px 10px 1px rgba(0, 0, 0, 0.34902);

      div {
        &:first-child {
          width: 20px;
          height: 20px;
          padding: 3px 0 0 0;

          img {
            width: 16px;
            height: 16px;
          }
        }
      }

      .text-style {
        position: relative;
        top: -19px;
        left: 33px;
        width: 80px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
    }
  }

  .ele-node-action {
    position: absolute;
    top: -115px;
    bottom: -2rem; // old -1.5rem
    left: 80px;
    z-index: 21;
    display: none;
    color: black;

    .action-extra-item {
      @extend %node-operator-item;
    }
  }

  &:focus {
    outline: none;
    box-shadow: 1px 1px 8px 1px #345FA6;
  }

  &:hover {
    border: 5px solid rgba(255, 0, 0, 0);
    box-shadow: 1px 1px 8px 1px #345FA6;
  }
}

.giot-ele {
  @include make-giot-node(100px, 70px, "./../../assets/iot/topo/giot.png");

  top: 250px;
  left: 200px;
  border-radius: 8px;

  .node-content-wrapper {
    @extend %node-container;
  }

  ~ .giot-resource-type {
    position: absolute;
    bottom: 37%;
    left: 30px;
    z-index: 21;
    width: 1em;
    height: 1em;
    cursor: pointer;
    background-color: #345FA6;
    box-shadow: 0 0 2px #345FA6;
    transition: box-shadow 0.25s ease-in;

    &:hover {
      box-shadow: 0 0 6px #345FA6;
    }
  }
}

.node-popover-custom {
  max-width: 600px;
  max-height: 25rem;
  min-width: 400px;
  padding: 8px 16px;
  overflow-y: auto;
}

/*
.ele-node-action {
  position: absolute;
  bottom: -2rem; // old -1.5rem
  left: 0;
  z-index: 21;
  display: none;
  color: black;

  .action-extra-item {
    @extend %node-operator-item;
  }
}
*/

.plumb-node-wrapped.head-move {
  position: absolute;
  top: -30px;
  bottom: -2rem;
  left: -20px;
  width: 20px;
  height: 20px;
  color: transparent;

  .action-extra-item {
    @extend %node-operator-item;
  }

  &:hover {
    color: gray;
  }
}

.text-info {
  position: relative;
  top: 13px;
  left: -17px;
  // z-index: 1;
  width: 137px;
  height: 26px;
  border-radius: 9px;
  background: #F2F2F2;

  &:first-child {
    width: 20px;
    height: 20px;
    padding: 3px 0 0 10px;

    img {
      width: 100%;
      height: 100%;
    }
  }

  .img-style {
    position: relative;
    left: 10px;
  }

  .twinkle-img-style {
    position: relative;
    left: 10px;
    -webkit-animation: twinkling 1s infinite ease-in-out;
  }

  .animated {
    -webkit-animation-duration: 1s;
    animation-duration: 1s;
    -webkit-animation-fill-mode: both;
    animation-fill-mode: both;
  }

  @-webkit-keyframes twinkling {
    0% {
      opacity: 0;
    }

    100% {
      opacity: 1;
    }
  }

  @keyframes twinkling {
    0% {
      opacity: 0;
    }

    100% {
      opacity: 1;
    }
  }

  .text-style {
    position: absolute;
    top: 75px;
    left: 31px;
  }
}

.custom-node-img {
  width: 100%;
  height: 100%;
  text-align: center;

  img {
    max-width: 96px;
    max-height: 64px;
    padding: 5px;
  }
}

.resource-type {
  position: absolute;
  bottom: 37%;
  left: 30px;
  // z-index: 1;
  width: 1em;
  height: 1em;
  cursor: pointer;
  background-color: #345FA6;
  box-shadow: 0 0 2px #345FA6;
  transition: box-shadow 0.25s ease-in;

  &:hover {
    box-shadow: 0 0 6px #345FA6;
  }
}

.target-type {
  position: absolute;
  bottom: 37%;
  left: 30px;
  // z-index: 1;
  width: 1em;
  height: 1em;
  cursor: pointer;
  background-color: #345FA6;
  box-shadow: 0 0 2px #345FA6;
  transition: box-shadow 0.25s ease-in;

  &:hover {
    box-shadow: 0 0 6px #345FA6;
  }

  .node-action {
    position: absolute;
    top: -20px;
    left: 0;
    height: 30px;
    text-align: center;
  }

  .triger-action {
    display: inline-block;
    margin-left: 0.3rem;
    color: black;

    .action-extra-item {
      @extend %node-operator-item;
    }
  }
}
