shadow$provide.module$node_modules$earcut$src$earcut = function(global, require, module, exports) {
  function earcut(data, holeIndices, dim = 2) {
    var hasHoles = holeIndices && holeIndices.length;
    const outerLen = hasHoles ? holeIndices[0] * dim : data.length;
    var outerNode = linkedList(data, 0, outerLen, dim, !0);
    const triangles = [];
    if (!outerNode || outerNode.next === outerNode.prev) {
      return triangles;
    }
    let minX, minY;
    if (hasHoles) {
      hasHoles = outerNode;
      outerNode = [];
      for (let i = 0, len = holeIndices.length; i < len; i++) {
        const list = linkedList(data, holeIndices[i] * dim, i < len - 1 ? holeIndices[i + 1] * dim : data.length, dim, !1);
        list === list.next && (list.steiner = !0);
        var JSCompiler_temp_const = outerNode, JSCompiler_temp_const$jscomp$0 = JSCompiler_temp_const.push;
        let p = list, leftmost = list;
        do {
          if (p.x < leftmost.x || p.x === leftmost.x && p.y < leftmost.y) {
            leftmost = p;
          }
          p = p.next;
        } while (p !== list);
        JSCompiler_temp_const$jscomp$0.call(JSCompiler_temp_const, leftmost);
      }
      outerNode.sort(compareXYSlope);
      for (holeIndices = 0; holeIndices < outerNode.length; holeIndices++) {
        JSCompiler_temp_const = outerNode[holeIndices], JSCompiler_temp_const$jscomp$0 = hasHoles, (hasHoles = findHoleBridge(JSCompiler_temp_const, JSCompiler_temp_const$jscomp$0)) ? (JSCompiler_temp_const = splitPolygon(hasHoles, JSCompiler_temp_const), filterPoints(JSCompiler_temp_const, JSCompiler_temp_const.next), hasHoles = filterPoints(hasHoles, hasHoles.next)) : hasHoles = JSCompiler_temp_const$jscomp$0;
      }
      outerNode = hasHoles;
    }
    if (data.length > 80 * dim) {
      minX = data[0];
      minY = data[1];
      var invSize = minX;
      holeIndices = minY;
      for (hasHoles = dim; hasHoles < outerLen; hasHoles += dim) {
        JSCompiler_temp_const = data[hasHoles], JSCompiler_temp_const$jscomp$0 = data[hasHoles + 1], JSCompiler_temp_const < minX && (minX = JSCompiler_temp_const), JSCompiler_temp_const$jscomp$0 < minY && (minY = JSCompiler_temp_const$jscomp$0), JSCompiler_temp_const > invSize && (invSize = JSCompiler_temp_const), JSCompiler_temp_const$jscomp$0 > holeIndices && (holeIndices = JSCompiler_temp_const$jscomp$0);
      }
      invSize = Math.max(invSize - minX, holeIndices - minY);
      invSize = 0 !== invSize ? 32767 / invSize : 0;
    }
    earcutLinked(outerNode, triangles, dim, minX, minY, invSize, 0);
    return triangles;
  }
  function linkedList(data, start, end, dim, clockwise) {
    let last;
    if (clockwise === 0 < signedArea(data, start, end, dim)) {
      for (; start < end; start += dim) {
        last = insertNode(start / dim | 0, data[start], data[start + 1], last);
      }
    } else {
      for (end -= dim; end >= start; end -= dim) {
        last = insertNode(end / dim | 0, data[end], data[end + 1], last);
      }
    }
    last && equals(last, last.next) && (removeNode(last), last = last.next);
    return last;
  }
  function filterPoints(start, end) {
    if (!start) {
      return start;
    }
    end || (end = start);
    let again;
    do {
      if (again = !1, start.steiner || !equals(start, start.next) && 0 !== area(start.prev, start, start.next)) {
        start = start.next;
      } else {
        removeNode(start);
        start = end = start.prev;
        if (start === start.next) {
          break;
        }
        again = !0;
      }
    } while (again || start !== end);
    return end;
  }
  function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {
    if (ear) {
      if (!pass && invSize) {
        var start = ear, p = start;
        do {
          0 === p.z && (p.z = zOrder(p.x, p.y, minX, minY, invSize)), p.prevZ = p.prev, p = p.nextZ = p.next;
        } while (p !== start);
        p.prevZ.nextZ = null;
        p.prevZ = null;
        start = p;
        var inSize = 1;
        do {
          var p$jscomp$0 = start, e = void 0, tail = start = null;
          for (p = 0; p$jscomp$0;) {
            p++;
            var q = p$jscomp$0, pSize = 0;
            for (e = 0; e < inSize && (pSize++, q = q.nextZ, q); e++) {
            }
            for (var qSize = inSize; 0 < pSize || 0 < qSize && q;) {
              0 !== pSize && (0 === qSize || !q || p$jscomp$0.z <= q.z) ? (e = p$jscomp$0, p$jscomp$0 = p$jscomp$0.nextZ, pSize--) : (e = q, q = q.nextZ, qSize--), tail ? tail.nextZ = e : start = e, e.prevZ = tail, tail = e;
            }
            p$jscomp$0 = q;
          }
          tail.nextZ = null;
          inSize *= 2;
        } while (1 < p);
      }
      for (start = ear; ear.prev !== ear.next;) {
        p = ear.prev;
        inSize = ear.next;
        if (invSize) {
          p$jscomp$0 = isEarHashed(ear, minX, minY, invSize);
        } else {
          a: {
            p$jscomp$0 = ear.prev;
            var b = ear;
            qSize = ear.next;
            if (0 <= area(p$jscomp$0, b, qSize)) {
              p$jscomp$0 = !1;
              break a;
            }
            tail = p$jscomp$0.x;
            q = b.x;
            pSize = qSize.x;
            e = p$jscomp$0.y;
            b = b.y;
            const cy = qSize.y, x0 = Math.min(tail, q, pSize), y0 = Math.min(e, b, cy), x1 = Math.max(tail, q, pSize), y1 = Math.max(e, b, cy);
            for (qSize = qSize.next; qSize !== p$jscomp$0;) {
              if (qSize.x >= x0 && qSize.x <= x1 && qSize.y >= y0 && qSize.y <= y1 && pointInTriangleExceptFirst(tail, e, q, b, pSize, cy, qSize.x, qSize.y) && 0 <= area(qSize.prev, qSize, qSize.next)) {
                p$jscomp$0 = !1;
                break a;
              }
              qSize = qSize.next;
            }
            p$jscomp$0 = !0;
          }
        }
        if (p$jscomp$0) {
          triangles.push(p.i, ear.i, inSize.i), removeNode(ear), start = ear = inSize.next;
        } else {
          if (ear = inSize, ear === start) {
            if (!pass) {
              earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);
            } else if (1 === pass) {
              ear = filterPoints(ear);
              pass = triangles;
              start = ear;
              do {
                p = start.prev, inSize = start.next.next, !equals(p, inSize) && intersects(p, start, start.next, inSize) && locallyInside(p, inSize) && locallyInside(inSize, p) && (pass.push(p.i, start.i, inSize.i), removeNode(start), removeNode(start.next), start = ear = inSize), start = start.next;
              } while (start !== ear);
              ear = filterPoints(start);
              earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);
            } else if (2 === pass) {
              a: {
                pass = ear;
                do {
                  for (start = pass.next.next; start !== pass.prev;) {
                    if (p = pass.i !== start.i) {
                      p = pass;
                      inSize = start;
                      if (p$jscomp$0 = p.next.i !== inSize.i && p.prev.i !== inSize.i) {
                        b: {
                          p$jscomp$0 = p;
                          do {
                            if (p$jscomp$0.i !== p.i && p$jscomp$0.next.i !== p.i && p$jscomp$0.i !== inSize.i && p$jscomp$0.next.i !== inSize.i && intersects(p$jscomp$0, p$jscomp$0.next, p, inSize)) {
                              p$jscomp$0 = !0;
                              break b;
                            }
                            p$jscomp$0 = p$jscomp$0.next;
                          } while (p$jscomp$0 !== p);
                          p$jscomp$0 = !1;
                        }
                        p$jscomp$0 = !p$jscomp$0;
                      }
                      if (p$jscomp$0) {
                        if (p$jscomp$0 = locallyInside(p, inSize) && locallyInside(inSize, p)) {
                          p$jscomp$0 = p;
                          tail = !1;
                          q = (p.x + inSize.x) / 2;
                          pSize = (p.y + inSize.y) / 2;
                          do {
                            p$jscomp$0.y > pSize !== p$jscomp$0.next.y > pSize && p$jscomp$0.next.y !== p$jscomp$0.y && q < (p$jscomp$0.next.x - p$jscomp$0.x) * (pSize - p$jscomp$0.y) / (p$jscomp$0.next.y - p$jscomp$0.y) + p$jscomp$0.x && (tail = !tail), p$jscomp$0 = p$jscomp$0.next;
                          } while (p$jscomp$0 !== p);
                          p$jscomp$0 = tail;
                        }
                        p$jscomp$0 = p$jscomp$0 && (area(p.prev, p, inSize.prev) || area(p, inSize.prev, inSize)) || equals(p, inSize) && 0 < area(p.prev, p, p.next) && 0 < area(inSize.prev, inSize, inSize.next);
                      }
                      p = p$jscomp$0;
                    }
                    if (p) {
                      ear = splitPolygon(pass, start);
                      pass = filterPoints(pass, pass.next);
                      ear = filterPoints(ear, ear.next);
                      earcutLinked(pass, triangles, dim, minX, minY, invSize, 0);
                      earcutLinked(ear, triangles, dim, minX, minY, invSize, 0);
                      break a;
                    }
                    start = start.next;
                  }
                  pass = pass.next;
                } while (pass !== ear);
              }
            }
            break;
          }
        }
      }
    }
  }
  function isEarHashed(ear, minX, minY, invSize) {
    const a = ear.prev, c = ear.next;
    if (0 <= area(a, ear, c)) {
      return !1;
    }
    const ax = a.x, bx = ear.x, cx = c.x, ay = a.y, by = ear.y, cy = c.y, x0 = Math.min(ax, bx, cx), y0 = Math.min(ay, by, cy), x1 = Math.max(ax, bx, cx), y1 = Math.max(ay, by, cy), minZ = zOrder(x0, y0, minX, minY, invSize);
    minX = zOrder(x1, y1, minX, minY, invSize);
    minY = ear.prevZ;
    for (ear = ear.nextZ; minY && minY.z >= minZ && ear && ear.z <= minX;) {
      if (minY.x >= x0 && minY.x <= x1 && minY.y >= y0 && minY.y <= y1 && minY !== a && minY !== c && pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, minY.x, minY.y) && 0 <= area(minY.prev, minY, minY.next)) {
        return !1;
      }
      minY = minY.prevZ;
      if (ear.x >= x0 && ear.x <= x1 && ear.y >= y0 && ear.y <= y1 && ear !== a && ear !== c && pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, ear.x, ear.y) && 0 <= area(ear.prev, ear, ear.next)) {
        return !1;
      }
      ear = ear.nextZ;
    }
    for (; minY && minY.z >= minZ;) {
      if (minY.x >= x0 && minY.x <= x1 && minY.y >= y0 && minY.y <= y1 && minY !== a && minY !== c && pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, minY.x, minY.y) && 0 <= area(minY.prev, minY, minY.next)) {
        return !1;
      }
      minY = minY.prevZ;
    }
    for (; ear && ear.z <= minX;) {
      if (ear.x >= x0 && ear.x <= x1 && ear.y >= y0 && ear.y <= y1 && ear !== a && ear !== c && pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, ear.x, ear.y) && 0 <= area(ear.prev, ear, ear.next)) {
        return !1;
      }
      ear = ear.nextZ;
    }
    return !0;
  }
  function compareXYSlope(a, b) {
    let result = a.x - b.x;
    0 === result && (result = a.y - b.y, 0 === result && (result = (a.next.y - a.y) / (a.next.x - a.x) - (b.next.y - b.y) / (b.next.x - b.x)));
    return result;
  }
  function findHoleBridge(hole, outerNode) {
    let p = outerNode;
    const hx = hole.x, hy = hole.y;
    let qx = -Infinity, m;
    if (equals(hole, p)) {
      return p;
    }
    do {
      if (equals(hole, p.next)) {
        return p.next;
      }
      if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {
        var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);
        if (x <= hx && x > qx && (qx = x, m = p.x < p.next.x ? p : p.next, x === hx)) {
          return m;
        }
      }
      p = p.next;
    } while (p !== outerNode);
    if (!m) {
      return null;
    }
    outerNode = m;
    x = m.x;
    const my = m.y;
    let tanMin = Infinity;
    p = m;
    do {
      if (hx >= p.x && p.x >= x && hx !== p.x && pointInTriangle(hy < my ? hx : qx, hy, x, my, hy < my ? qx : hx, hy, p.x, p.y)) {
        const tan = Math.abs(hy - p.y) / (hx - p.x);
        var JSCompiler_temp;
        if ((JSCompiler_temp = locallyInside(p, hole)) && !(JSCompiler_temp = tan < tanMin) && (JSCompiler_temp = tan === tanMin) && !(JSCompiler_temp = p.x > m.x) && (JSCompiler_temp = p.x === m.x)) {
          JSCompiler_temp = m;
          var p$jscomp$0 = p;
          JSCompiler_temp = 0 > area(JSCompiler_temp.prev, JSCompiler_temp, p$jscomp$0.prev) && 0 > area(p$jscomp$0.next, JSCompiler_temp, JSCompiler_temp.next);
        }
        JSCompiler_temp && (m = p, tanMin = tan);
      }
      p = p.next;
    } while (p !== outerNode);
    return m;
  }
  function zOrder(x, y, minX, minY, invSize) {
    x = (x - minX) * invSize | 0;
    y = (y - minY) * invSize | 0;
    x = (x | x << 8) & 16711935;
    x = (x | x << 4) & 252645135;
    x = (x | x << 2) & 858993459;
    y = (y | y << 8) & 16711935;
    y = (y | y << 4) & 252645135;
    y = (y | y << 2) & 858993459;
    return (x | x << 1) & 1431655765 | ((y | y << 1) & 1431655765) << 1;
  }
  function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {
    return (cx - px) * (ay - py) >= (ax - px) * (cy - py) && (ax - px) * (by - py) >= (bx - px) * (ay - py) && (bx - px) * (cy - py) >= (cx - px) * (by - py);
  }
  function pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, px, py) {
    return !(ax === px && ay === py) && pointInTriangle(ax, ay, bx, by, cx, cy, px, py);
  }
  function area(p, q, r) {
    return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
  }
  function equals(p1, p2) {
    return p1.x === p2.x && p1.y === p2.y;
  }
  function intersects(p1, q1, p2, q2) {
    const o1 = sign(area(p1, q1, p2)), o2 = sign(area(p1, q1, q2)), o3 = sign(area(p2, q2, p1)), o4 = sign(area(p2, q2, q1));
    return o1 !== o2 && o3 !== o4 || 0 === o1 && onSegment(p1, p2, q1) || 0 === o2 && onSegment(p1, q2, q1) || 0 === o3 && onSegment(p2, p1, q2) || 0 === o4 && onSegment(p2, q1, q2) ? !0 : !1;
  }
  function onSegment(p, q, r) {
    return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);
  }
  function sign(num) {
    return 0 < num ? 1 : 0 > num ? -1 : 0;
  }
  function locallyInside(a, b) {
    return 0 > area(a.prev, a, a.next) ? 0 <= area(a, b, a.next) && 0 <= area(a, a.prev, b) : 0 > area(a, b, a.prev) || 0 > area(a, a.next, b);
  }
  function splitPolygon(a, b) {
    const a2 = createNode(a.i, a.x, a.y), b2 = createNode(b.i, b.x, b.y), an = a.next, bp = b.prev;
    a.next = b;
    b.prev = a;
    a2.next = an;
    an.prev = a2;
    b2.next = a2;
    a2.prev = b2;
    bp.next = b2;
    b2.prev = bp;
    return b2;
  }
  function insertNode(i, x, y, last) {
    i = createNode(i, x, y);
    last ? (i.next = last.next, i.prev = last, last.next.prev = i, last.next = i) : (i.prev = i, i.next = i);
    return i;
  }
  function removeNode(p) {
    p.next.prev = p.prev;
    p.prev.next = p.next;
    p.prevZ && (p.prevZ.nextZ = p.nextZ);
    p.nextZ && (p.nextZ.prevZ = p.prevZ);
  }
  function createNode(i, x, y) {
    return {i, x, y, prev:null, next:null, z:0, prevZ:null, nextZ:null, steiner:!1};
  }
  function deviation(data, holeIndices, dim, triangles) {
    var hasHoles = holeIndices && holeIndices.length;
    let polygonArea = Math.abs(signedArea(data, 0, hasHoles ? holeIndices[0] * dim : data.length, dim));
    if (hasHoles) {
      for (let i = 0, len = holeIndices.length; i < len; i++) {
        polygonArea -= Math.abs(signedArea(data, holeIndices[i] * dim, i < len - 1 ? holeIndices[i + 1] * dim : data.length, dim));
      }
    }
    holeIndices = 0;
    for (hasHoles = 0; hasHoles < triangles.length; hasHoles += 3) {
      const a = triangles[hasHoles] * dim, b = triangles[hasHoles + 1] * dim, c = triangles[hasHoles + 2] * dim;
      holeIndices += Math.abs((data[a] - data[c]) * (data[b + 1] - data[a + 1]) - (data[a] - data[b]) * (data[c + 1] - data[a + 1]));
    }
    return 0 === polygonArea && 0 === holeIndices ? 0 : Math.abs((holeIndices - polygonArea) / polygonArea);
  }
  function signedArea(data, start, end, dim) {
    let sum = 0;
    for (let i = start, j = end - dim; i < end; i += dim) {
      sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]), j = i;
    }
    return sum;
  }
  function flatten(data) {
    const vertices = [], holes = [], dimensions = data[0][0].length;
    let holeIndex = 0, prevLen = 0;
    for (const ring of data) {
      for (const p of ring) {
        for (data = 0; data < dimensions; data++) {
          vertices.push(p[data]);
        }
      }
      prevLen && (holeIndex += prevLen, holes.push(holeIndex));
      prevLen = ring.length;
    }
    return {vertices, holes, dimensions};
  }
  Object.defineProperties(exports, {__esModule:{enumerable:!0, value:!0}, default:{enumerable:!0, get:function() {
    return earcut;
  }}, deviation:{enumerable:!0, get:function() {
    return deviation;
  }}, flatten:{enumerable:!0, get:function() {
    return flatten;
  }}});
};

//# sourceMappingURL=module$node_modules$earcut$src$earcut.js.map
