Showing preview only (3,148K chars total). Download the full file or copy to clipboard to get everything.
Repository: robbykraft/Origami
Branch: main
Commit: b717948c7123
Files: 632
Total size: 2.9 MB
Directory structure:
gitextract_wpm0yi8j/
├── .eslintrc.json
├── .github/
│ └── workflows/
│ └── main.yml
├── .gitignore
├── .npmignore
├── .travis.yml
├── bundle-shaders.py
├── changelog.md
├── license
├── package.json
├── rabbit-ear.js
├── readme.md
├── rollup.config.js
├── src/
│ ├── axioms/
│ │ ├── axioms.js
│ │ ├── boundary.js
│ │ ├── index.js
│ │ └── validate.js
│ ├── convert/
│ │ ├── foldToObj.js
│ │ ├── foldToSvg.js
│ │ ├── foldToSvg.md
│ │ ├── general/
│ │ │ ├── dom.js
│ │ │ ├── options.js
│ │ │ ├── planarize.js
│ │ │ └── svg.js
│ │ ├── index.js
│ │ ├── objToFold.js
│ │ ├── opxToFold.js
│ │ ├── svg/
│ │ │ ├── color.js
│ │ │ ├── drawBoundaries.js
│ │ │ ├── drawEdges.js
│ │ │ ├── drawFaces.js
│ │ │ ├── drawVertices.js
│ │ │ ├── index.js
│ │ │ ├── parse.js
│ │ │ └── stylesheet.js
│ │ ├── svgToFold.js
│ │ └── svgToFold.md
│ ├── diagrams/
│ │ ├── arrows.js
│ │ ├── axiomArrows.js
│ │ ├── general.js
│ │ ├── index.js
│ │ └── svgArrows.js
│ ├── environment/
│ │ ├── detect.js
│ │ ├── messages.js
│ │ └── window.js
│ ├── fold/
│ │ ├── bases.js
│ │ ├── colors.js
│ │ ├── frames.js
│ │ ├── primitives.js
│ │ ├── rabbitear.js
│ │ └── spec.js
│ ├── general/
│ │ ├── array.js
│ │ ├── clone.js
│ │ ├── cluster.js
│ │ ├── get.js
│ │ ├── hashCode.js
│ │ ├── index.js
│ │ ├── number.js
│ │ ├── sort.js
│ │ └── string.js
│ ├── graph/
│ │ ├── add/
│ │ │ ├── edge.js
│ │ │ └── vertex.js
│ │ ├── boundary.js
│ │ ├── clean.js
│ │ ├── connectedComponents.js
│ │ ├── count.js
│ │ ├── cycles.js
│ │ ├── directedGraph.js
│ │ ├── disjoint.js
│ │ ├── edges/
│ │ │ ├── circular.js
│ │ │ ├── duplicate.js
│ │ │ ├── lines.js
│ │ │ └── overlap.js
│ │ ├── epsilon.js
│ │ ├── explode.js
│ │ ├── faces/
│ │ │ ├── facePoint.js
│ │ │ ├── matrix.js
│ │ │ ├── planes.js
│ │ │ └── winding.js
│ │ ├── flaps.js
│ │ ├── fold/
│ │ │ ├── flatFold.js
│ │ │ ├── flatFoldSplitFace.js
│ │ │ ├── foldGraph.js
│ │ │ ├── foldGraphIntoSegments.js
│ │ │ ├── foldGraphIntoSubgraph.js
│ │ │ └── general.js
│ │ ├── index.js
│ │ ├── intersect.js
│ │ ├── join.js
│ │ ├── make/
│ │ │ ├── edges.js
│ │ │ ├── edgesAssignment.js
│ │ │ ├── edgesEdges.js
│ │ │ ├── edgesFaces.js
│ │ │ ├── edgesFoldAngle.js
│ │ │ ├── edgesVertices.js
│ │ │ ├── faces.js
│ │ │ ├── facesEdges.js
│ │ │ ├── facesFaces.js
│ │ │ ├── facesVertices.js
│ │ │ ├── index.js
│ │ │ ├── lookup.js
│ │ │ ├── vertices.js
│ │ │ ├── verticesEdges.js
│ │ │ ├── verticesFaces.js
│ │ │ └── verticesVertices.js
│ │ ├── maps.js
│ │ ├── nearest.js
│ │ ├── normalize.js
│ │ ├── normals.js
│ │ ├── orders.js
│ │ ├── overlap.js
│ │ ├── planarize/
│ │ │ ├── intersectAllEdges.js
│ │ │ ├── makeFacesMap.js
│ │ │ ├── planarize.js
│ │ │ ├── planarizeCollinearEdges.js
│ │ │ ├── planarizeCollinearVertices.js
│ │ │ ├── planarizeMakeFaces.js
│ │ │ └── planarizeOverlaps.js
│ │ ├── planarize.js
│ │ ├── pleat.js
│ │ ├── populate.js
│ │ ├── raycast.js
│ │ ├── remove.js
│ │ ├── rendering.js
│ │ ├── replace.js
│ │ ├── split/
│ │ │ ├── general.js
│ │ │ ├── splitEdge.js
│ │ │ ├── splitFace.js
│ │ │ ├── splitGraph.js
│ │ │ └── splitLine.js
│ │ ├── subgraph.js
│ │ ├── sweep.js
│ │ ├── symmetry.js
│ │ ├── transfer.js
│ │ ├── transform.js
│ │ ├── trees.js
│ │ ├── triangulate.js
│ │ ├── validate/
│ │ │ ├── validate.js
│ │ │ ├── validateAssignments.js
│ │ │ ├── validateOrders.js
│ │ │ ├── validateReferences.js
│ │ │ ├── validateReflexive.js
│ │ │ ├── validateTypes.js
│ │ │ └── validateWinding.js
│ │ ├── vertices/
│ │ │ ├── clusters.js
│ │ │ ├── collinear.js
│ │ │ ├── duplicate.js
│ │ │ ├── folded.js
│ │ │ ├── isolated.js
│ │ │ └── sort.js
│ │ └── walk.js
│ ├── index.js
│ ├── layer/
│ │ ├── constraints3D.js
│ │ ├── constraints3DEdges.js
│ │ ├── constraints3DFaces.js
│ │ ├── constraintsFlat.js
│ │ ├── facesSide.js
│ │ ├── general.js
│ │ ├── getBranches.js
│ │ ├── index.js
│ │ ├── initialSolutionsFlat.js
│ │ ├── layer.js
│ │ ├── propagate.js
│ │ ├── prototype.js
│ │ ├── prototypeOneDepth.js
│ │ ├── solve.js
│ │ ├── solver.js
│ │ ├── solverOneDepth.js
│ │ ├── table.js
│ │ ├── tacosTortillas.js
│ │ └── transitivity.js
│ ├── libTypes.d.ts
│ ├── math/
│ │ ├── clip.js
│ │ ├── compare.js
│ │ ├── constant.js
│ │ ├── convert.js
│ │ ├── convexHull.js
│ │ ├── encloses.js
│ │ ├── index.js
│ │ ├── intersect.js
│ │ ├── line.js
│ │ ├── matrix2.js
│ │ ├── matrix3.js
│ │ ├── matrix4.js
│ │ ├── nearest.js
│ │ ├── overlap.js
│ │ ├── plane.js
│ │ ├── polygon.js
│ │ ├── polynomial.js
│ │ ├── quaternion.js
│ │ ├── radial.js
│ │ ├── range.js
│ │ ├── straightSkeleton.js
│ │ ├── triangle.js
│ │ └── vector.js
│ ├── prototypes/
│ │ ├── graph.js
│ │ └── index.js
│ ├── singleVertex/
│ │ ├── degree4.js
│ │ ├── flatFoldable.js
│ │ ├── foldable.js
│ │ ├── index.js
│ │ ├── kawasaki.js
│ │ └── maekawa.js
│ ├── svg/
│ │ ├── arguments/
│ │ │ ├── makeCoordinates.js
│ │ │ ├── makeViewBox.js
│ │ │ └── semiFlattenArrays.js
│ │ ├── colors/
│ │ │ ├── convert.js
│ │ │ ├── cssColors.js
│ │ │ ├── index.js
│ │ │ └── parseColor.js
│ │ ├── constructor/
│ │ │ ├── elements.js
│ │ │ ├── extensions/
│ │ │ │ ├── arc/
│ │ │ │ │ └── index.js
│ │ │ │ ├── arrow/
│ │ │ │ │ ├── index.js
│ │ │ │ │ ├── init.js
│ │ │ │ │ ├── makeArrowPaths.js
│ │ │ │ │ ├── methods.js
│ │ │ │ │ └── options.js
│ │ │ │ ├── circle.js
│ │ │ │ ├── curve/
│ │ │ │ │ ├── arguments.js
│ │ │ │ │ ├── getCurveEndpoints.js
│ │ │ │ │ ├── index.js
│ │ │ │ │ ├── makeCurvePath.js
│ │ │ │ │ └── methods.js
│ │ │ │ ├── ellipse.js
│ │ │ │ ├── g.js
│ │ │ │ ├── index.js
│ │ │ │ ├── line.js
│ │ │ │ ├── maskTypes.js
│ │ │ │ ├── origami/
│ │ │ │ │ ├── index.js
│ │ │ │ │ ├── init.js
│ │ │ │ │ └── methods.js
│ │ │ │ ├── path.js
│ │ │ │ ├── polys.js
│ │ │ │ ├── rect.js
│ │ │ │ ├── shared/
│ │ │ │ │ ├── dom.js
│ │ │ │ │ ├── makeArcPath.js
│ │ │ │ │ ├── transforms.js
│ │ │ │ │ └── urls.js
│ │ │ │ ├── style.js
│ │ │ │ ├── svg/
│ │ │ │ │ ├── animation.js
│ │ │ │ │ ├── getSVGFrame.js
│ │ │ │ │ ├── index.js
│ │ │ │ │ ├── makeBackground.js
│ │ │ │ │ ├── methods.js
│ │ │ │ │ └── touch.js
│ │ │ │ ├── text.js
│ │ │ │ └── wedge/
│ │ │ │ └── index.js
│ │ │ └── index.js
│ │ ├── environment/
│ │ │ ├── detect.js
│ │ │ ├── lib.js
│ │ │ ├── messages.js
│ │ │ ├── strings.js
│ │ │ └── window.js
│ │ ├── general/
│ │ │ ├── algebra.js
│ │ │ ├── cdata.js
│ │ │ ├── dom.js
│ │ │ ├── index.js
│ │ │ ├── path.js
│ │ │ ├── string.js
│ │ │ ├── transforms.js
│ │ │ └── viewBox.js
│ │ ├── index.js
│ │ └── spec/
│ │ ├── classes_attributes.js
│ │ ├── classes_nodes.js
│ │ ├── namespace.js
│ │ ├── nodes.js
│ │ ├── nodes_attributes.js
│ │ └── nodes_children.js
│ ├── text/
│ │ ├── axioms.json
│ │ ├── edge_assignments.json
│ │ ├── index.js
│ │ └── instructions.json
│ ├── types.js
│ └── webgl/
│ ├── creasePattern/
│ │ ├── arrays.js
│ │ ├── data.js
│ │ ├── index.js
│ │ ├── models.js
│ │ ├── shaders/
│ │ │ ├── cp-100.frag
│ │ │ ├── cp-100.vert
│ │ │ ├── cp-300.frag
│ │ │ ├── cp-300.vert
│ │ │ ├── thick-edges-100.vert
│ │ │ └── thick-edges-300.vert
│ │ ├── shaders.js
│ │ └── uniforms.js
│ ├── foldedForm/
│ │ ├── arrays.js
│ │ ├── data.js
│ │ ├── index.js
│ │ ├── models.js
│ │ ├── shaders/
│ │ │ ├── model-100.frag
│ │ │ ├── model-100.vert
│ │ │ ├── model-300.frag
│ │ │ ├── model-300.vert
│ │ │ ├── outlined-model-100.frag
│ │ │ ├── outlined-model-100.vert
│ │ │ ├── outlined-model-300.frag
│ │ │ ├── outlined-model-300.vert
│ │ │ ├── simple-100.frag
│ │ │ ├── simple-300.frag
│ │ │ ├── thick-edges-100.vert
│ │ │ └── thick-edges-300.vert
│ │ ├── shaders.js
│ │ └── uniforms.js
│ ├── general/
│ │ ├── colors.js
│ │ ├── index.js
│ │ ├── model.js
│ │ ├── view.js
│ │ └── webgl.js
│ ├── index.js
│ └── readme.md
├── tests/
│ ├── axioms.axioms.test.js
│ ├── axioms.boundary.test.js
│ ├── axioms.validate.test.js
│ ├── clean.js
│ ├── convert.foldToObj.test.js
│ ├── convert.foldToSvg.origami.test.js
│ ├── convert.foldToSvg.test.js
│ ├── convert.objToFold.test.js
│ ├── convert.opxToFold.test.js
│ ├── convert.svgToFold.test.js
│ ├── diagram.arrows.axiom.test.js
│ ├── diagram.arrows.simple.test.js
│ ├── diagram.general.test.js
│ ├── docs.js
│ ├── environment.window.test.js
│ ├── files/
│ │ ├── cp/
│ │ │ ├── bird-base.cp
│ │ │ ├── square-fish.cp
│ │ │ └── windmill.cp
│ │ ├── fold/
│ │ │ ├── abstract-graph.fold
│ │ │ ├── bad-edges.fold
│ │ │ ├── bird-base-3d-cp.fold
│ │ │ ├── bird-base-3d.fold
│ │ │ ├── bird-disjoint-edges.fold
│ │ │ ├── blintz-frames.fold
│ │ │ ├── bowtie.fold
│ │ │ ├── command-strip-with-back.fold
│ │ │ ├── command-strip.fold
│ │ │ ├── crane-cp-bmvfcj-simple.fold
│ │ │ ├── crane-cp-bmvfcj.fold
│ │ │ ├── crane-cp.fold
│ │ │ ├── crane-step.fold
│ │ │ ├── crane.fold
│ │ │ ├── cube-octagon.fold
│ │ │ ├── cycles-3d.fold
│ │ │ ├── disjoint-cps.fold
│ │ │ ├── disjoint-triangles-3d.fold
│ │ │ ├── fan-cp.fold
│ │ │ ├── fan-flat-cp.fold
│ │ │ ├── fan-folded-through-cp.fold
│ │ │ ├── fish-cp-3d.fold
│ │ │ ├── flat-pleat-fish.fold
│ │ │ ├── invalid-box-pleat-3d.fold
│ │ │ ├── invalid-key-names.fold
│ │ │ ├── invalid-mismatch-length.fold
│ │ │ ├── invalid-mismatch-references.fold
│ │ │ ├── invalid-self-intersect.fold
│ │ │ ├── invalid-single-vertex-2d.fold
│ │ │ ├── invalid-single-vertex-3d.fold
│ │ │ ├── isolated-line-in-face.fold
│ │ │ ├── kabuto.fold
│ │ │ ├── kissing-squares.fold
│ │ │ ├── kraft-bird-base.fold
│ │ │ ├── layer-4-flaps.fold
│ │ │ ├── layer-solver-conflict.fold
│ │ │ ├── layers-3d-edge-edge.fold
│ │ │ ├── layers-3d-edge-face.fold
│ │ │ ├── layers-cycle-nonconvex.fold
│ │ │ ├── layers-flat-grid.fold
│ │ │ ├── layers-zipper.fold
│ │ │ ├── maze-8x8.fold
│ │ │ ├── maze-s.fold
│ │ │ ├── maze-u.fold
│ │ │ ├── moosers-train-carriage-fourth.fold
│ │ │ ├── moosers-train-carriage.fold
│ │ │ ├── moosers-train-engine.fold
│ │ │ ├── moosers-train.fold
│ │ │ ├── nested-frames.fold
│ │ │ ├── no-faces.fold
│ │ │ ├── non-flat-paper.fold
│ │ │ ├── non-planar-100-chaotic.fold
│ │ │ ├── non-planar-100-lines.fold
│ │ │ ├── non-planar-25-lines.fold
│ │ │ ├── non-planar-50-chaotic.fold
│ │ │ ├── non-planar-50-lines.fold
│ │ │ ├── non-planar-500-chaotic.fold
│ │ │ ├── non-planar-75-lines.fold
│ │ │ ├── non-planar-bird-base.fold
│ │ │ ├── non-planar-nonconvex.fold
│ │ │ ├── non-planar-polygons.fold
│ │ │ ├── non-planar-square-fish.fold
│ │ │ ├── overlapping-assignments.fold
│ │ │ ├── panels-3x3-invalid.fold
│ │ │ ├── panels-3x3.fold
│ │ │ ├── panels-4x2.fold
│ │ │ ├── panels-5.fold
│ │ │ ├── panels-6x2-90deg.fold
│ │ │ ├── panels-simple.fold
│ │ │ ├── panels-zig-zag.fold
│ │ │ ├── pleats-angle-3d.fold
│ │ │ ├── preliminary-offset-cp.fold
│ │ │ ├── randlett-flapping-bird.fold
│ │ │ ├── random-triangles-3d.fold
│ │ │ ├── resch-tess.fold
│ │ │ ├── separated-parallel-edges.fold
│ │ │ ├── square-fish-3d.fold
│ │ │ ├── square-tube-with-overlap.fold
│ │ │ ├── square-twist.fold
│ │ │ ├── strip-weave-concave.fold
│ │ │ ├── strip-weave.fold
│ │ │ ├── strip-with-angle.fold
│ │ │ ├── surrounded-square.fold
│ │ │ ├── triangle-strip-2.fold
│ │ │ ├── triangle-strip.fold
│ │ │ ├── two-bird-cp.fold
│ │ │ ├── wavy-miura-no-faces.fold
│ │ │ ├── windmill-no-edges.fold
│ │ │ ├── windmill-variations.fold
│ │ │ └── windmill.fold
│ │ ├── json/
│ │ │ ├── crane-faces-edges-overlap.json
│ │ │ ├── crane-faces-faces-overlap.json
│ │ │ ├── crane-layer-solver-no-depth.json
│ │ │ ├── crane-layer-solver.json
│ │ │ ├── cube-octagon-constraints.json
│ │ │ ├── kabuto-constraints.json
│ │ │ ├── kabuto-faces-faces-overlap.json
│ │ │ ├── kabuto-layer-solver-no-depth.json
│ │ │ ├── kabuto-layer-solver.json
│ │ │ ├── kraft-bird-faces-faces-overlap.json
│ │ │ ├── layer-table.json
│ │ │ ├── maze-u-constraints.json
│ │ │ ├── panels-3x3-layer-solver-no-depth.json
│ │ │ ├── panels-3x3-layer-solver.json
│ │ │ └── randlett-flapping-bird-layer-solver.json
│ │ ├── obj/
│ │ │ ├── sphere-with-holes.obj
│ │ │ └── stanford-bunny.obj
│ │ └── opx/
│ │ ├── bird-base-2012.opx
│ │ ├── bird-base.opx
│ │ ├── one-crease.opx
│ │ ├── square-fish.opx
│ │ ├── test.opx
│ │ └── windmill.opx
│ ├── fold.bases.test.js
│ ├── fold.colors.test.js
│ ├── fold.frames.test.js
│ ├── fold.spec.test.js
│ ├── general.array.test.js
│ ├── general.cluster.test.js
│ ├── general.get.test.js
│ ├── general.hashCode.test.js
│ ├── general.number.test.js
│ ├── general.sort.test.js
│ ├── general.string.test.js
│ ├── generate.test.js
│ ├── graph.add.edge.test.js
│ ├── graph.add.vertex.test.js
│ ├── graph.boundary.test.js
│ ├── graph.clean.test.js
│ ├── graph.connectedComponents.test.js
│ ├── graph.count.test.js
│ ├── graph.countImplied.test.js
│ ├── graph.cycles.test.js
│ ├── graph.directedGraph.test.js
│ ├── graph.disjoint.test.js
│ ├── graph.edges.circular.test.js
│ ├── graph.edges.duplicate.test.js
│ ├── graph.edges.lines.test.js
│ ├── graph.edges.overlap.test.js
│ ├── graph.explode.test.js
│ ├── graph.faces.facePoint.test.js
│ ├── graph.faces.matrix.test.js
│ ├── graph.faces.planes.getFacesPlane.test.js
│ ├── graph.faces.planes.overlapping.test.js
│ ├── graph.faces.winding.test.js
│ ├── graph.flaps.test.js
│ ├── graph.fold.flatFold.test.js
│ ├── graph.fold.foldGraph.layers.test.js
│ ├── graph.fold.foldGraph.test.js
│ ├── graph.fold.foldGraphIntoSegments.test.js
│ ├── graph.fold.foldGraphIntoSubgraph.test.js
│ ├── graph.intersect.test.js
│ ├── graph.intersect.vertices.test.js
│ ├── graph.join.test.js
│ ├── graph.make.edges.test.js
│ ├── graph.make.edgesEdges.test.js
│ ├── graph.make.edgesFaces.test.js
│ ├── graph.make.facesFaces.test.js
│ ├── graph.make.facesMatrix.test.js
│ ├── graph.make.facesVertices.test.js
│ ├── graph.make.facesWinding.test.js
│ ├── graph.make.lookup.test.js
│ ├── graph.make.verticesEdges.test.js
│ ├── graph.make.verticesFaces.test.js
│ ├── graph.make.verticesVertices.test.js
│ ├── graph.maps.test.js
│ ├── graph.nearest.test.js
│ ├── graph.normalize.test.js
│ ├── graph.normals.test.js
│ ├── graph.orders.test.js
│ ├── graph.overlap.components.test.js
│ ├── graph.overlap.edgesEdges.test.js
│ ├── graph.overlap.facesEdges.test.js
│ ├── graph.overlap.facesFaces.test.js
│ ├── graph.planarize.collinearEdges.test.js
│ ├── graph.planarize.faceMap.test.js
│ ├── graph.planarize.intersect.test.js
│ ├── graph.planarize.new.test.js
│ ├── graph.planarize.test.js
│ ├── graph.planarizeOverlap.test.js
│ ├── graph.pleat.test.js
│ ├── graph.populate.test.js
│ ├── graph.remove.test.js
│ ├── graph.rendering.test.js
│ ├── graph.replace.test.js
│ ├── graph.split.splitEdge.test.js
│ ├── graph.split.splitFace.test.js
│ ├── graph.split.splitGraph.test.js
│ ├── graph.split.splitLine.test.js
│ ├── graph.subgraph.test.js
│ ├── graph.sweep.test.js
│ ├── graph.symmetry.test.js
│ ├── graph.transfer.test.js
│ ├── graph.transform.test.js
│ ├── graph.trees.test.js
│ ├── graph.triangulate.test.js
│ ├── graph.validate.test.js
│ ├── graph.vertices.clusters.test.js
│ ├── graph.vertices.collinear.test.js
│ ├── graph.vertices.duplicate.test.js
│ ├── graph.vertices.folded.test.js
│ ├── graph.vertices.isolated.test.js
│ ├── graph.vertices.sort.test.js
│ ├── graph.walk.test.js
│ ├── index.html
│ ├── layer.constraints3DEdges.edgesFaces.test.js
│ ├── layer.constraints3DEdges.test.js
│ ├── layer.constraints3DFaces.test.js
│ ├── layer.constraints3d.test.js
│ ├── layer.constraintsFlat.test.js
│ ├── layer.facesSide.test.js
│ ├── layer.general.test.js
│ ├── layer.initialSolution.test.js
│ ├── layer.layer.solveLayerOrders.test.js
│ ├── layer.layer.solveLayerOrders3D.test.js
│ ├── layer.propagate.test.js
│ ├── layer.prototype.test.js
│ ├── layer.solver.2D.test.js
│ ├── layer.solver.3D.test.js
│ ├── layer.table.test.js
│ ├── layer.transitivity.test.js
│ ├── lineno.js
│ ├── math.algebra.matrix2.test.js
│ ├── math.algebra.matrix3.test.js
│ ├── math.algebra.matrix4.test.js
│ ├── math.algebra.quaternion.test.js
│ ├── math.algebra.vector.resize.test.js
│ ├── math.algebra.vector.test.js
│ ├── math.debug.test.js
│ ├── math.general.array.test.js
│ ├── math.general.constant.test.js
│ ├── math.general.convert.test.js
│ ├── math.general.function.test.js
│ ├── math.general.get.test.js
│ ├── math.general.sort.test.js
│ ├── math.general.typeof.test.js
│ ├── math.geometry.convexHull.test.js
│ ├── math.geometry.line.test.js
│ ├── math.geometry.nearest.test.js
│ ├── math.geometry.polygon.test.js
│ ├── math.geometry.radial.test.js
│ ├── math.geometry.straightSkeleton.test.js
│ ├── math.geometry.triangle.test.js
│ ├── math.intersect.clip.line.test.js
│ ├── math.intersect.clip.polygon.test.js
│ ├── math.intersect.encloses.test.js
│ ├── math.intersect.method.test.js
│ ├── math.intersect.overlap.test.js
│ ├── math.intersect.polyLine.test.js
│ ├── math.intersect.split.test.js
│ ├── math.intersect.test.js
│ ├── math.overlap.test.js
│ ├── math.primitives.circle.test.js
│ ├── math.primitives.clip.test.js
│ ├── math.primitives.ellipse.test.js
│ ├── math.primitives.json.test.js
│ ├── math.primitives.junction.test.js
│ ├── math.primitives.line.test.js
│ ├── math.primitives.matrix.test.js
│ ├── math.primitives.paths.test.js
│ ├── math.primitives.polygon.test.js
│ ├── math.primitives.rect.test.js
│ ├── math.primitives.types.test.js
│ ├── math.primitives.vector.test.js
│ ├── math.range.test.js
│ ├── prototypes.cp.test.js
│ ├── prototypes.graph.test.js
│ ├── prototypes.static.test.js
│ ├── singleVertex.degree4.test.js
│ ├── singleVertex.flatFoldable.test.js
│ ├── singleVertex.foldable.test.js
│ ├── singleVertex.kawasaki.test.js
│ ├── singleVertex.maekawa.test.js
│ ├── svg.arrow.test.js
│ ├── svg.attributes.test.js
│ ├── svg.circle.test.js
│ ├── svg.class.id.test.js
│ ├── svg.colors.test.js
│ ├── svg.coordinates.test.js
│ ├── svg.dom.test.js
│ ├── svg.ellipse.test.js
│ ├── svg.environment.test.js
│ ├── svg.line.test.js
│ ├── svg.nodes.test.js
│ ├── svg.object.assign.test.js
│ ├── svg.path.test.js
│ ├── svg.polygon.test.js
│ ├── svg.primitives.test.js
│ ├── svg.rect.test.js
│ ├── svg.stylesheet.test.js
│ ├── svg.svg.animation.test.js
│ ├── svg.svg.args.test.js
│ ├── svg.svg.background.test.js
│ ├── svg.svg.controls.test.js
│ ├── svg.svg.load.test.js
│ ├── svg.svg.save.test.js
│ ├── svg.svg.viewbox.test.js
│ ├── svg.transforms.test.js
│ ├── svg.types.test.js
│ ├── svg.urls.test.js
│ ├── svg.use.test.js
│ ├── svg.window.test.js
│ └── webgl.initialize.test.js
├── tsconfig.json
└── typedoc.config.json
================================================
FILE CONTENTS
================================================
================================================
FILE: .eslintrc.json
================================================
{
"env": {
"browser": true,
"es2021": true,
"node": true
},
"extends": "airbnb-base",
"ignores": ["*.d.ts"],
"parserOptions": {
"ecmaVersion": "latest",
"ecmaFeatures": { "jsx": true },
"sourceType": "module"
},
"rules": {
"arrow-parens": 0,
"camelcase": ["error", { "allow": [".*"] }],
"func-names": ["error", "never"],
"indent": ["error", "tab"],
"no-bitwise": 0,
"no-continue": 0,
"no-labels": 0,
"no-plusplus": 0,
"no-param-reassign": ["error", {
"props": true,
"ignorePropertyModificationsFor": [
"graph",
"epsilon",
"faces_edges"
]
}],
"no-sparse-arrays": 0,
"no-tabs": 0,
"no-restricted-syntax": ["error", "ForInStatement", "ForOfStatement", "WithStatement"],
"import/extensions": ["error", "always", { "ignorePackages": true }],
"import/no-relative-packages": 0,
"object-shorthand": 0,
"object-curly-newline": 0,
"import/prefer-default-export": 0,
"prefer-rest-params": 0,
"prefer-default-export": 0,
"prefer-destructuring": 0,
"quotes": ["error", "double", { "allowTemplateLiterals": true }]
}
}
================================================
FILE: .github/workflows/main.yml
================================================
name: CI
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
test:
name: run all tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- name: install dependencies
run: npm install
- name: run tests
run: npm run test
================================================
FILE: .gitignore
================================================
*.DS_Store
node_modules/
coverage/
docs/
module/
tests/tmp/
types/
package-lock.json
*.d.ts.map
================================================
FILE: .npmignore
================================================
.DS_Store
.eslintrc.js
.git
.gitignore
.travis.yml
coverage/
docs/
src/
tests/
build-shaders.py
changelog.md
contribute.md
developers.md
docs-style.css
rollup.config.js
tsconfig.json
typedoc.config.json
================================================
FILE: .travis.yml
================================================
language: node_js
node_js:
- lts/*
================================================
FILE: bundle-shaders.py
================================================
# due to the issues around loading raw text files,
# this bundler will convert the shader files into an
# es6 Javascript file with named exports of the
# raw text as strings
# IMPORTANT! this will ignore any filenames containing
# the substring "sketch". there are a few files that
# are being worked on in development we want to ignore
import re
from os import listdir
from os.path import isfile, join
# list here the locations where shader files exist, and the
# location and filename to write the bundled named export file
sources = [{
"read": "src/webgl/creasePattern/shaders/",
"write": "src/webgl/creasePattern/shaders.js"
}, {
"read": "src/webgl/foldedForm/shaders/",
"write": "src/webgl/foldedForm/shaders.js"
}]
# convert a raw text file into a javascript string which follows this format:
# export const FILENAME = `FILECONTENTS`;
# where FILENAME is the file's name but made into a valid javascript variable
def makeNamedExport(file, path):
f = open(join(path, file))
# convert the file into a valid JS variable name
variablename = re.sub("[-\.]", "_", file)
# compress multiple consecutive newlines into just one
contents = re.sub("[\n]{2,}", "\n", f.read())
string = "export const " + variablename + " = `" + contents + "`;"
f.close()
return string
# run makeNamedExport on all files in a directory and
# join them into one large newline-separated string
def makeBundle(files, path):
return "\n\n".join(map(lambda file: makeNamedExport(file, path), files)) + "\n"
# iterate over the locations from sources, convert them to bundles,
# save the stringified bundle as a new file
for source in sources:
# ignore "sketch" files
files = [f for f in listdir(source["read"]) if (isfile(join(source["read"], f)) and "sketch" not in f)]
bundle = makeBundle(files, source["read"])
with open(source["write"], 'w') as f:
f.write(bundle)
================================================
FILE: changelog.md
================================================
# 0.9.33 alpha
`pleat()` when given parallel lines will now correct for the case when the lines' vectors point in the opposite directions.
many of the intersection methods have been refactored and have small or dramatic speedups.
new method: `getEdgesRectOverlap()`
new method: `findSymmetryLines()` and `findSymmetryLine()` using the lines in the graph to uncover a line of symmetry.
new method: `getEdgesLine()` and its subroutine `clusterParallelVectors()` which performs a similar function as `clusterScalars()`.
new overlap methods:
```javascript
ear.graph.getFacesLineOverlap()
ear.graph.getFacesRayOverlap()
ear.graph.getFacesSegmentOverlap()
```
new method `ear.graph.getFramesByClassName()`
new method `ear.graph.getEdgeBetweenVertices()`
ear.graph.makePlanarFaces now returns an object already in FOLD form, instead of the data being inverted into an array of objects
All axiom methods return an *array* of lines. Before, some would and others would not. The system is now consistent.
replace `getGraphKeysWithPrefix` with `filterKeysWithPrefix`, maintaining the functionality of `getGraphKeysWithPrefix` where it will add the `_` character to match against. same with Suffix methods.
new method: `subgraph` and `subgraphWithFaces`, where *subgraphWithEdges* and *subgraphWithVertices* could be written in similar form.
Methods renamed:
- `{graph/cp/origami}.copy` -> `{graph/cp/origami}.clone`
- `fragment` -> `planarize`
- `getBoundingBox` -> `boundingBox`
- `getBoundaryVertices` -> `boundaryVertices`
- `getBoundary` -> `boundary`
- `getPlanarBoundary` -> `planarBoundary`
- `makeFacesFacesOverlap` -> `getFacesFaces2DOverlap`
- `makeFacesCenter` -> `makeFacesCentroid2D`
- `makeFacesCenterQuick` -> `makeFacesConvexCenter`
- `getDuplicateEdges` -> `duplicateEdges`
- `getCircularEdges` -> `circularEdges`
- `getVerticesClusters` -> `verticesClusters`
- `getDuplicateVertices` -> `duplicateVertices`
- `getEdgeIsolatedVertices` -> `edgeIsolatedVertices`
- `getFaceIsolatedVertices` -> `faceIsolatedVertices`
- `getIsolatedVertices` -> `isolatedVertices`
- `getCoplanarFacesGroups` -> `coplanarFacesGroups`
- `getOverlappingFacesGroups` -> `overlappingFacesGroups`
- `makeTrianglePairs` -> `chooseTwoPairs`
- `clusterArrayValues` -> `clusterScalars`
- `getDisjointedVertices` -> `disjointVerticesSets`
`makeEdgesAssignment` has been renamed to `makeEdgesAssignmentSimple` and `makeEdgesAssignment` now also assigns "B" boundary edges by checking edges_faces for # of incident faces.
new WebGL implementation. see: [readme.md](https://github.com/robbykraft/Origami/tree/master/src/webgl) and [foldfile.com](https://foldfile.com)
Various methods will now throw Errors instead of console.error or console.warn. Not all console.warn have been removed however. The distinction is that if the function is still able to generate a solution, it will console.warn. If the function generated something which contains errors or misleading information, it throws an error.
New subcategory `ear.webgl` containing at least: `createProgram`, `initialize`, `foldedForm`, `creasePattern`, `rebuildViewport`, `makeProjectionMatrix`, `makeModelMatrix`, `drawProgram`, `deallocProgram`, with many more methods specific to drawing different styles with different shaders.
new Matrix4 type. new Quaternion type. new projection matrices.
new method `ear.graph.nearest`, which was already in the `graph()` object as a prototype method. now exists in the top level.
all matrix scale methods takes an array of values instead of one number, allowing non-uniform axis scaling.
`ear.graph.getBoundingBox` will return "undefined" if the graph does not contain any vertices_coords. previously this would throw an error.
new `nudgeVerticesWithFacesLayer`, `nudgeVerticesWithFaceOrders` for nudging vertices in an exploded graph based on layer order.
`src/layer/topological.js` contains a new topological sort method. currently not being exported.
new `.convert` with the first (of many, hopefully) file conversions: `.obj` to `.fold`, which includes computing edges_foldAngle and giving them a "M" "V" assignment.
new methods `getCoplanarFacesGroups`, `getOverlappingFacesGroups` which will find all groups of faces which share the same plane in 3D space (`getCoplanarFacesGroups`), and then in the case of `getOverlappingFacesGroups` actually compute whether or not they overlap.
new method `selfRelationalUniqueIndexPairs`, given any array of self-referential data (vertices_vertices, faces_faces, etc), create a list of unique pairwise combinations of related indices.
rewrite of `getVerticesClusters`, implemented a line sweep and the runtime has been massively improved.
refactor fold/keys and fold/spec, simplify methods that get exposed in the final build.
# 0.9.32 alpha
new layer solver implementation at ear.layer.solver(), huge performance improvement. solver returns data bound to a prototype which includes methods to process and analyze the data. methods include
```javascript
count()
solution(...indices)
allSolutions()
facesLayer(...indices)
allFacesLayers()
faceOrders(...indices)
allFaceOrders()
```
ear.layer.assignmentSolver renamed to ear.layer.singleVertexAssignmentSolver.
ear.math.enclosingBoundingBoxes, new method. test if one bounding box is entirely inside another.
ear.graph.makeEdgesEdgesSimilar, answers which edges have the same endpoints (vertices) as other edges. endpoints can be in any order.
performance improvements for ear.graph.makeFacesFacesOverlap, ear.graph.makeEdgesFacesOverlap.
# 0.9.31 alpha
axiom function wrapper has changed. `validate()` is now exposed to the user, as is the `axiomInBoundary` methods. Normal-distance parameterization methods are now named as such.
new convex hull algorithm. two entrypoints: `convexHull` returns points, `convexHullIndices` returns indices of points from your points parameter array.
`onLeave` added to the other three methods `onMove` `onPress` `onRelease` for SVG elements.
# 0.9.3 alpha
no longer requiring @xmldom/xmldom as a dependency. This library now has zero dependencies! [1]
`clean()` takes no options now and performs one consistent task: removes all bad edges and vertices. if you like you can call each submethod now `removeDuplicateVertices`, `removeCircularEdges`, `removeDuplicateEdges`, `removeIsolatedVertices`.
axiom function parameters have now changed to the much simpler "point, line" to consistenly separate types. This replaces "point, origin, vector" inputs where "origin, vector" are two components which describe a line, and "point" is points... **to update: modify your axiom function parameters, whever it asks for a line, make a ear.line() objects from your previous origin/vector pairs.**
```javascript
ear.graph.getBoundaryVertices // unsorted
ear.graph.getBoundary.vertices // sorted
```
> [1] if you use Rabbit Ear in NodeJS and create a SVG elements (virtually), you will need to import @xmldom. Because this is such a unique rare case, this is left to the user. This will be explained in the documentation.
================================================
FILE: license
================================================
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
================================================
FILE: package.json
================================================
{
"name": "rabbit-ear",
"version": "0.9.4",
"description": "origami design library",
"exports": {
".": {
"import": "./module/index.js",
"require": "./rabbit-ear.js",
"types": "./types/index.d.ts"
},
"./*": {
"import": "./module/*",
"types": "./types/*"
}
},
"type": "module",
"types": "./types/index.d.ts",
"scripts": {
"build": "npm run clean && rollup -c && npm run types && npm run docs",
"clean": "node tests/clean.js",
"docs": "typedoc --options typedoc.config.json",
"test": "mkdir -p ./tests/tmp && vitest",
"types": "tsc"
},
"files": [
"./rabbit-ear.js",
"./rabbit-ear.module.js",
"./license",
"./package.json",
"./readme.md",
"./module",
"./types"
],
"license": "GPLv3",
"author": {
"name": "Maya Kraft",
"email": "maya@kraft.work",
"url": "https://kraft.work"
},
"keywords": [
"origami",
"design",
"geometry",
"paper",
"fold",
"folding",
"foldability",
"generative",
"parametric",
"diagram",
"architecture",
"creative",
"art"
],
"repository": {
"type": "git",
"url": "git://github.com/rabbit-ear/rabbit-ear.git"
},
"homepage": "https://rabbitear.org",
"bugs": {
"url": "https://github.com/rabbit-ear/rabbit-ear/issues"
},
"devDependencies": {
"@rollup/plugin-terser": "^0.4.3",
"@xmldom/xmldom": "^0.8.10",
"earcut": "^2.2.4",
"eslint": "^8.47.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.28.1",
"rollup": "^3.28.1",
"rollup-plugin-cleanup": "^3.2.1",
"typedoc": "^0.25.13",
"typedoc-github-wiki-theme": "^1.1.0",
"typedoc-plugin-markdown": "^3.17.1",
"typescript": "^5.2.2",
"vitest": "^0.34.6"
}
}
================================================
FILE: rabbit-ear.js
================================================
/* Rabbit Ear 0.9.4 alpha 2024-04-20 (c) Kraft, GNU GPLv3 License */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).ear=t()}(this,(function(){"use strict";const e="object"==typeof window&&"object"==typeof window.document,t="object"==typeof process&&"object"==typeof process.versions&&(null!=process.versions.node||null!=process.versions.bun),r="object"==typeof window&&"Deno"in window&&"object"==typeof window.Deno,s=t||r;var a="valid manifold required",o="cycle not allowed",c="replace() generated undefined",n="foldAngles cannot be determined from flat-folded faces without an assignment",i="WebGl not Supported",l="only convex faces are supported",d="window not set; if using node/deno include package @xmldom/xmldom and set ear.window = xmldom",_="non-convex triangulation requires vertices_coords",m="svgToFold found <style> in <svg>. rendering will be incomplete unless run in a major browser.",g="LayerSolver bad input. no solution possible";const v={window:void 0};e&&(v.window=window);const RabbitEarWindow$1=()=>{if(void 0===v.window)throw new Error(d);return v.window},p=1e-6,u=180/Math.PI,h=Math.PI/180,b=2*Math.PI;var y=Object.freeze({__proto__:null,D2R:h,EPSILON:p,R2D:u,TWO_PI:b});const safeAdd=(e,t)=>e+(t||0),magnitude=e=>Math.sqrt(e.map((e=>e*e)).reduce(safeAdd,0)),magnitude2=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),magnitude3=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]),magSquared2=e=>e[0]*e[0]+e[1]*e[1],magSquared=e=>e.map((e=>e*e)).reduce(safeAdd,0),normalize$2=e=>{const t=magnitude(e);return 0===t?e:e.map((e=>e/t))},normalize2=e=>{const t=magnitude2(e);return 0===t?[e[0],e[1]]:[e[0]/t,e[1]/t]},normalize3=e=>{const t=magnitude3(e);return 0===t?e:[e[0]/t,e[1]/t,e[2]/t]},scale$1=(e,t)=>e.map((e=>e*t)),scale2$1=(e,t)=>[e[0]*t,e[1]*t],scale3$1=(e,t)=>[e[0]*t,e[1]*t,e[2]*t],scaleNonUniform=(e,t)=>e.map(((e,r)=>e*t[r])),scaleNonUniform2=(e,t)=>[e[0]*t[0],e[1]*t[1]],scaleNonUniform3=(e,t)=>[e[0]*t[0],e[1]*t[1],e[2]*t[2]],add=(e,t)=>e.map(((e,r)=>e+(t[r]||0))),add2=(e,t)=>[e[0]+t[0],e[1]+t[1]],add3=(e,t)=>[e[0]+t[0],e[1]+t[1],e[2]+t[2]],subtract=(e,t)=>e.map(((e,r)=>e-(t[r]||0))),subtract2=(e,t)=>[e[0]-t[0],e[1]-t[1]],subtract3=(e,t)=>[e[0]-t[0],e[1]-t[1],e[2]-t[2]],dot=(e,t)=>e.map(((r,s)=>e[s]*t[s])).reduce(safeAdd,0),dot2=(e,t)=>e[0]*t[0]+e[1]*t[1],dot3=(e,t)=>e[0]*t[0]+e[1]*t[1]+e[2]*t[2],midpoint=(e,t)=>e.map(((e,r)=>(e+t[r])/2)),midpoint2=(e,t)=>scale2$1(add2(e,t),.5),average=(...e)=>{if(0===e.length)return;const t=e[0].length>0?e[0].length:0,r=Array(t).fill(0);return Array.from(e).forEach((e=>r.forEach(((t,s)=>{r[s]+=e[s]||0})))),r.map((t=>t/e.length))},average2=(...e)=>{if(!e||!e.length)return;const t=e.reduce(((e,t)=>add2(e,t)),[0,0]);return[t[0]/e.length,t[1]/e.length]},average3=(...e)=>{if(!e||!e.length)return;const t=e.reduce(((e,t)=>add3(e,t)),[0,0,0]);return[t[0]/e.length,t[1]/e.length,t[2]/e.length]},lerp=(e,t,r=0)=>{const s=1-r;return e.map(((e,a)=>e*s+(t[a]||0)*r))},cross2=(e,t)=>e[0]*t[1]-e[1]*t[0],cross3=(e,t)=>[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]],distance=(e,t)=>Math.sqrt(e.map(((r,s)=>(e[s]-t[s])**2)).reduce(safeAdd,0)),distance2=(e,t)=>{const r=e[0]-t[0],s=e[1]-t[1];return Math.sqrt(r*r+s*s)},distance3=(e,t)=>{const r=e[0]-t[0],s=e[1]-t[1],a=e[2]-t[2];return Math.sqrt(r*r+s*s+a*a)},flip=e=>e.map((e=>-e)),flip2=e=>[-e[0],-e[1]],flip3=e=>[-e[0],-e[1],-e[2]],rotate90=e=>[-e[1],e[0]],rotate270=e=>[e[1],-e[0]],parallelNormalized=(e,t,r=p)=>1-Math.abs(dot(e,t))<r,parallel=(e,t,r=p)=>parallelNormalized(normalize$2(e),normalize$2(t),r),parallel2=(e,t,r=p)=>Math.abs(cross2(e,t))<r,parallel3=(e,t,r=p)=>magnitude3(cross3(e,t))<r,resize=(e,t)=>t.length===e?t:Array(e).fill(0).map(((e,r)=>t[r]?t[r]:e)),resize2=e=>[e[0]||0,e[1]||0],resize3=e=>[e[0]||0,e[1]||0,e[2]||0],basisVectors2=(e=[1,0])=>{const t=normalize2(e);return[t,rotate90(t)]},basisVectors3=(e=[1,0,0])=>{const t=normalize3(e),r=[[1,0,0],[0,1,0],[0,0,1]].map((e=>cross3(e,t))),s=r.map(magnitude3).map(((e,t)=>({n:e,i:t}))).sort(((e,t)=>t.n-e.n)).map((e=>e.i)).shift(),a=normalize3(r[s]);return[t,a,cross3(t,a)]};var E=Object.freeze({__proto__:null,add:add,add2:add2,add3:add3,average:average,average2:average2,average3:average3,basisVectors:e=>2===e.length?basisVectors2([e[0],e[1]]):basisVectors3([e[0],e[1],e[2]]),basisVectors2:basisVectors2,basisVectors3:basisVectors3,cross2:cross2,cross3:cross3,degenerate:(e,t=p)=>e.map((e=>Math.abs(e))).reduce(safeAdd,0)<t,distance:distance,distance2:distance2,distance3:distance3,dot:dot,dot2:dot2,dot3:dot3,flip:flip,flip2:flip2,flip3:flip3,lerp:lerp,magSquared:magSquared,magSquared2:magSquared2,magnitude:magnitude,magnitude2:magnitude2,magnitude3:magnitude3,midpoint:midpoint,midpoint2:midpoint2,midpoint3:(e,t)=>scale3$1(add3(e,t),.5),normalize:normalize$2,normalize2:normalize2,normalize3:normalize3,parallel:parallel,parallel2:parallel2,parallel3:parallel3,parallelNormalized:parallelNormalized,resize:resize,resize2:resize2,resize3:resize3,resizeUp:(e,t)=>[e,t].map((r=>resize(Math.max(e.length,t.length),r))),rotate270:rotate270,rotate90:rotate90,scale:scale$1,scale2:scale2$1,scale3:scale3$1,scaleNonUniform:scaleNonUniform,scaleNonUniform2:scaleNonUniform2,scaleNonUniform3:scaleNonUniform3,subtract:subtract,subtract2:subtract2,subtract3:subtract3});const vectorToAngle=e=>Math.atan2(e[1],e[0]),angleToVector=e=>[Math.cos(e),Math.sin(e)],pointsToLine2=(e,t)=>({vector:subtract2(t,e),origin:resize2(e)}),pointsToLine3=(e,t)=>({vector:subtract3(t,e),origin:resize3(e)}),pointsToLine=(e,t)=>3===e.length&&3===t.length?pointsToLine3(e,t):pointsToLine2(e,t),vecLineToUniqueLine=({vector:e,origin:t})=>{const r=magnitude(e),s=rotate90([e[0],e[1]]),a=dot(t,s)/r;return{normal:scale2$1(s,1/r),distance:a}},uniqueLineToVecLine=({normal:e,distance:t})=>({vector:rotate270(e),origin:scale2$1(e,t)});var M=Object.freeze({__proto__:null,angleToVector:angleToVector,pointsToLine:pointsToLine,pointsToLine2:pointsToLine2,pointsToLine3:pointsToLine3,uniqueLineToVecLine:uniqueLineToVecLine,vecLineToUniqueLine:vecLineToUniqueLine,vectorToAngle:vectorToAngle});const epsilonEqual=(e,t,r=p)=>Math.abs(e-t)<r,epsilonCompare=(e,t,r=p)=>epsilonEqual(e,t,r)?0:Math.sign(e-t),epsilonEqualVectors=(e,t,r=p)=>{for(let s=0;s<Math.max(e.length,t.length);s+=1)if(!epsilonEqual(e[s]||0,t[s]||0,r))return!1;return!0},include=(e,t=p)=>e>-t,exclude=(e,t=p)=>e>t,includeL=(e,t)=>!0,A=include,x=exclude,includeS=(e,t=p)=>e>-t&&e<1+t,excludeS=(e,t=p)=>e>t&&e<1-t;var O=Object.freeze({__proto__:null,epsilonCompare:epsilonCompare,epsilonEqual:epsilonEqual,epsilonEqualVectors:epsilonEqualVectors,exclude:exclude,excludeL:(e,t)=>!0,excludeR:x,excludeS:excludeS,include:include,includeL:includeL,includeR:A,includeS:includeS});const isCounterClockwiseBetween=(e,t,r)=>{for(;r<t;)r+=b;for(;e>t;)e-=b;for(;e<t;)e+=b;return e<r},clockwiseAngleRadians=(e,t)=>{for(;e<0;)e+=b;for(;t<0;)t+=b;for(;e>b;)e-=b;for(;t>b;)t-=b;const r=e-t;return r>=0?r:b-(t-e)},counterClockwiseAngleRadians=(e,t)=>{for(;e<0;)e+=b;for(;t<0;)t+=b;for(;e>b;)e-=b;for(;t>b;)t-=b;const r=t-e;return r>=0?r:b-(e-t)},clockwiseAngle2=(e,t)=>{const r=t[0]*e[0]+t[1]*e[1],s=t[0]*e[1]-t[1]*e[0];let a=Math.atan2(s,r);return a<0&&(a+=b),a},counterClockwiseAngle2=(e,t)=>{const r=e[0]*t[0]+e[1]*t[1],s=e[0]*t[1]-e[1]*t[0];let a=Math.atan2(s,r);return a<0&&(a+=b),a},clockwiseBisect2=(e,t)=>angleToVector(vectorToAngle(e)-clockwiseAngle2(e,t)/2),clockwiseSubsectRadians=(e,t,r)=>{const s=clockwiseAngleRadians(e,t)/r;return Array.from(Array(r-1)).map(((t,r)=>e+s*(r+1)))},counterClockwiseSubsectRadians=(e,t,r)=>{const s=counterClockwiseAngleRadians(e,t)/r;return Array.from(Array(r-1)).map(((t,r)=>e+s*(r+1)))},counterClockwiseSubsect2=(e,t,r)=>{const s=Math.atan2(e[1],e[0]),a=Math.atan2(t[1],t[0]);return counterClockwiseSubsectRadians(s,a,r).map(angleToVector)},counterClockwiseOrderRadians=e=>{const t=e.map(((e,t)=>t)).sort(((t,r)=>e[t]-e[r]));return t.slice(t.indexOf(0),t.length).concat(t.slice(0,t.indexOf(0)))},counterClockwiseOrder2=e=>counterClockwiseOrderRadians(e.map(vectorToAngle)),counterClockwiseSectorsRadians=e=>counterClockwiseOrderRadians(e).map((t=>e[t])).map(((e,t,r)=>[e,r[(t+1)%r.length]])).map((e=>counterClockwiseAngleRadians(e[0],e[1]))),counterClockwiseSectors2=e=>counterClockwiseSectorsRadians(e.map(vectorToAngle)),threePointTurnDirection=(e,t,r,s=p)=>{const a=normalize2(subtract2(t,e)),o=normalize2(subtract2(r,e)),c=cross2(a,o);return epsilonEqual(c,0,s)?epsilonEqual(distance2(e,t)+distance2(t,r),distance2(e,r))?0:void 0:Math.sign(c)};var j=Object.freeze({__proto__:null,clockwiseAngle2:clockwiseAngle2,clockwiseAngleRadians:clockwiseAngleRadians,clockwiseBisect2:clockwiseBisect2,clockwiseSubsect2:(e,t,r)=>{const s=Math.atan2(e[1],e[0]),a=Math.atan2(t[1],t[0]);return clockwiseSubsectRadians(s,a,r).map(angleToVector)},clockwiseSubsectRadians:clockwiseSubsectRadians,counterClockwiseAngle2:counterClockwiseAngle2,counterClockwiseAngleRadians:counterClockwiseAngleRadians,counterClockwiseBisect2:(e,t)=>angleToVector(vectorToAngle(e)+counterClockwiseAngle2(e,t)/2),counterClockwiseOrder2:counterClockwiseOrder2,counterClockwiseOrderRadians:counterClockwiseOrderRadians,counterClockwiseSectors2:counterClockwiseSectors2,counterClockwiseSectorsRadians:counterClockwiseSectorsRadians,counterClockwiseSubsect2:counterClockwiseSubsect2,counterClockwiseSubsectRadians:counterClockwiseSubsectRadians,isCounterClockwiseBetween:isCounterClockwiseBetween,threePointTurnDirection:threePointTurnDirection});const clampLine=e=>e,clampSegment=e=>e<-p?0:e>1.000001?1:e,collinearPoints=(e,t,r,s=p)=>{const a=[[e,t],[t,r]].map((e=>subtract(e[1],e[0]))).map((e=>normalize$2(e)));return epsilonEqual(1,Math.abs(dot(a[0],a[1])),s)},collinearBetween=(e,t,r,s=!1,a=p)=>{if([e,r].map((e=>epsilonEqualVectors(t,e,a))).reduce(((e,t)=>e||t),!1))return s;const o=[[e,t],[t,r]].map((e=>subtract(e[1],e[0]))).map((e=>normalize$2(e)));return epsilonEqual(1,dot(o[0],o[1]),p)},collinearLines3=(e,t,r=p)=>parallel3(e.vector,t.vector,r)&¶llel3(e.vector,subtract3(t.origin,e.origin),r),pleat$2=(e,t,r,s=p)=>{const a=cross2(e.vector,t.vector),o=cross2(subtract2(t.origin,e.origin),t.vector)/a,[c,n]=[e.vector,t.vector].map(normalize2);if(Math.abs(cross2(c,n))<s)return((e,t,r)=>{const s=dot(e.vector,t.vector)<0,a=e.vector,o=s?flip(t.vector):t.vector,c=Array.from(Array(r-1)).map(((s,a)=>lerp(e.origin,t.origin,(a+1)/r))),n=Array.from(Array(r-1)).map(((e,t)=>lerp(a,o,(t+1)/r))).map(((e,t)=>({vector:[e[0],e[1]],origin:[c[t][0],c[t][1]]}))),i=[n,n];return i[s?0:1]=[],i})(e,t,r);const i=a>-s?[[e.vector,t.vector],[flip2(t.vector),e.vector]]:[[t.vector,e.vector],[flip2(e.vector),t.vector]],l=[counterClockwiseSubsect2(i[0][0],i[0][1],r),counterClockwiseSubsect2(i[1][0],i[1][1],r)],d=add2(e.origin,scale2$1(e.vector,o)),_=Array.from(Array(r-1)).map((()=>d)),[m,g]=l.map((e=>e.map(((e,t)=>({vector:e,origin:_[t]})))));return[m,g]},bisectLines2=(e,t,r=p)=>{const[s,a]=pleat$2(e,t,2,r).map((e=>e[0])),o=[s,a];return o.forEach(((e,t)=>{void 0===e&&delete o[t]})),o};var w=Object.freeze({__proto__:null,bisectLines2:bisectLines2,clampLine:clampLine,clampRay:e=>e<-p?0:e,clampSegment:clampSegment,collinearBetween:collinearBetween,collinearLines2:(e,t,r=p)=>parallel2(e.vector,t.vector,r)&¶llel2(e.vector,subtract2(t.origin,e.origin),r),collinearLines3:collinearLines3,collinearPoints:collinearPoints,pleat:pleat$2});const rangeUnion=(e,t)=>{const r=t[0]<=t[1];return e[0]<=e[1]?[Math.min(e[0],r?t[0]:t[1]),Math.max(e[1],r?t[1]:t[0])]:[Math.min(e[1],r?t[0]:t[1]),Math.max(e[0],r?t[1]:t[0])]},doRangesOverlap=(e,t,r=p)=>{const s=e[0]<e[1]?e:[e[1],e[0]],a=t[0]<t[1]?t:[t[1],t[0]];return Math.min(s[1],a[1])-Math.max(s[0],a[0])>r};var F=Object.freeze({__proto__:null,doRangesOverlap:doRangesOverlap,rangeUnion:rangeUnion});const clusterSortedGeneric=(e,t)=>{if(!e.length)return[];const r=e.map(((e,t)=>t)),s=[[r.shift()]];return r.forEach((r=>{const a=s[s.length-1],o=a[a.length-1];t(e[o],e[r])?a.push(r):s.push([r])})),s},clusterUnsortedIndices=(e,t)=>{if(!e.length)return[];const r=e.slice(),s=[[r.shift()]];return r.forEach((e=>{const r=s.map(((r,s)=>t(r[0],e)?s:void 0)).filter((e=>void 0!==e)).shift();void 0!==r?s[r].push(e):s.push([e])})),s},clusterScalars=(e,t=p)=>{const r=e.map(((e,t)=>({v:e,i:t}))).sort(((e,t)=>e.v-t.v)).map((e=>e.i)).filter((()=>!0)),s=r.map((t=>e[t]));return clusterSortedGeneric(s,((e,r)=>Math.abs(e-r)<t)).map((e=>e.map((e=>r[e]))))},clusterParallelVectors=(e,t=p)=>{const r=e.map(normalize$2),s=[[0]];e:for(let e=1;e<r.length;e+=1){for(let a=0;a<s.length;a+=1)if(parallelNormalized(r[e],r[s[a][0]],t)){s[a].push(e);continue e}s.push([e])}return s};var S=Object.freeze({__proto__:null,clusterParallelVectors:clusterParallelVectors,clusterRanges:(e,t=p)=>{const r=e.map((([e,t],r)=>({v:Math.min(e,t),i:r}))).sort(((e,t)=>e.v-t.v)).map((e=>e.i)).filter((()=>!0)),s=r.map((t=>e[t]));let a=[...s[0]];return clusterSortedGeneric(s,((e,r)=>{const s=doRangesOverlap(a,r,t);return a=s?rangeUnion(a,r):[...r],s})).map((e=>e.map((e=>r[e]))))},clusterScalars:clusterScalars,clusterSortedGeneric:clusterSortedGeneric,clusterUnsortedIndices:clusterUnsortedIndices});const intersectLineLine=(e,t,r=includeL,s=includeL,a=p)=>{const o=cross2(normalize2(e.vector),normalize2(t.vector));if(Math.abs(o)<a)return{a:void 0,b:void 0,point:void 0};const c=cross2(e.vector,t.vector),n=-c,i=[t.origin[0]-e.origin[0],t.origin[1]-e.origin[1]],l=[-i[0],-i[1]],d=cross2(i,t.vector)/c,_=cross2(l,e.vector)/n;return r(d,a/magnitude2(e.vector))&&s(_,a/magnitude2(t.vector))?{a:d,b:_,point:add2(e.origin,scale2$1(e.vector,d))}:{a:void 0,b:void 0,point:void 0}},intersectCircleLine=(e,t,r=include,s=includeL,a=p)=>{const o=t.vector[0]**2+t.vector[1]**2,c=Math.sqrt(o),n=0===c?t.vector:scale2$1(t.vector,1/c),i=rotate90(n),l=subtract2(t.origin,e.origin),d=cross2(l,n);if(Math.abs(d)>e.radius+a)return;const _=Math.sqrt(e.radius**2-d**2),f=(t,r)=>e.origin[r]-i[r]*d+n[r]*t,m=Math.abs(e.radius-Math.abs(d))<a?[_].map((e=>[f(e,0),f(e,1)])):[-_,_].map((e=>[f(e,0),f(e,1)])),g=m.map((e=>e.map(((e,r)=>e-t.origin[r])))).map((e=>e[0]*t.vector[0]+t.vector[1]*e[1])).map((e=>e/o));return m.filter(((e,t)=>s(g[t],a)))},intersectPolygonLine=(e,t,r=includeL,s=p)=>{const a=e.map(((e,t,r)=>({vector:subtract2(r[(t+1)%r.length],e),origin:resize2(e)}))).map((e=>intersectLineLine(t,e,r,includeS,s))).filter((({point:e})=>void 0!==e)).sort(((e,t)=>e.a-t.a)).map((({a:e,point:t})=>({a:e,point:t})));return clusterSortedGeneric(a,((e,t)=>epsilonEqual(e.a,t.a,s))).map((([e])=>a[e]))};var C=Object.freeze({__proto__:null,intersectCircleLine:intersectCircleLine,intersectLineLine:intersectLineLine,intersectPolygonLine:intersectPolygonLine});const cubeRootSigned=e=>e<0?-((-e)**(1/3)):e**(1/3),normalAxiom1=(e,t)=>{const r=normalize2(rotate90(subtract2(t,e)));return[{normal:r,distance:dot2(add2(e,t),r)/2}]},axiom1=(e,t)=>[{vector:normalize2(subtract2(t,e)),origin:e}],normalAxiom2=(e,t)=>{const r=normalize2(subtract2(t,e));return[{normal:r,distance:dot2(add2(e,t),r)/2}]},axiom2=(e,t)=>[{vector:normalize2(rotate90(subtract2(t,e))),origin:midpoint2(e,t)}],normalAxiom3=(e,t)=>{const r=cross2(e.normal,t.normal);if(Math.abs(r)<p)return[{normal:e.normal,distance:(e.distance+t.distance*dot2(e.normal,t.normal))/2}];const s=[(e.distance*t.normal[1]-t.distance*e.normal[1])/r,(t.distance*e.normal[0]-e.distance*t.normal[0])/r],[a,o]=[add2,subtract2].map((r=>normalize2(r(e.normal,t.normal)))).map((e=>({normal:e,distance:dot2(s,e)})));return[a,o]},axiom3=(e,t)=>bisectLines2(e,t),normalAxiom4=(e,t)=>{const r=rotate90(e.normal);return[{normal:r,distance:dot2(t,r)}]},axiom4=({vector:e},t)=>[{vector:rotate90(normalize2(e)),origin:t}],normalAxiom5=(e,t,r)=>{const s=dot2(t,e.normal),a=e.distance-s,o=distance2(t,r);if(a>o)return[];const c=Math.sqrt(o*o-a*a),n=scale2$1(e.normal,a),i=add2(t,n),l=scale2$1(rotate90(e.normal),c),d=c<p?[i]:[add2(i,l),subtract2(i,l)],[_,m]=d.map((e=>normalize2(subtract2(r,e)))).map((e=>({normal:e,distance:dot2(t,e)})));return[_,m]},axiom5=(e,t,r)=>(intersectCircleLine({radius:distance2(t,r),origin:t},e)||[]).map((e=>({vector:normalize2(rotate90(subtract2(e,r))),origin:midpoint2(r,e)}))),normalAxiom6=(e,t,r,s)=>{if(Math.abs(1-dot2(e.normal,r)/e.distance)<.02)return[];const a=rotate90(e.normal),o=subtract2(add2(r,scale2$1(e.normal,e.distance)),scale2$1(s,2)),c=subtract2(scale2$1(e.normal,e.distance),r),n=dot2(s,t.normal)-t.distance,i=2*dot2(c,a),l=dot2(c,c),d=dot2(add2(o,c),a),_=dot2(o,c),m=dot2(a,t.normal),g=dot2(c,t.normal),v=m,u=n+d*m+g,h=n*i+_*m+d*g,b=n*l+_*g;let y=[];return Math.abs(v)>p?y=[b,h,u,v]:Math.abs(u)>p?y=[b,h,u]:Math.abs(h)>p&&(y=[b,h]),(e=>{const[t,r,s,a]=e;switch(e.length){case 2:return[-t/r];case 3:{const e=r**2-4*t*s;if(e<-p)return[];const a=-r/(2*s);if(e<p)return[a];const o=Math.sqrt(e)/(2*s);return[a+o,a-o]}case 4:{const e=s/a,o=r/a,c=(9*e*o-t/a*27-2*e**3)/54,n=((3*o-e**2)/9)**3+c**2,i=-e/3;if(n>0){const e=Math.sqrt(n);return[i+cubeRootSigned(c+e)+cubeRootSigned(c-e)]}if(Math.abs(n)<p){if(c<0)return[];const e=c**(1/3);return[i+2*e,i-e]}const l=Math.sqrt(-n),d=Math.atan2(l,c)/3,_=(c**2-n)**(1/6),m=_*Math.cos(d),g=_*Math.sin(d);return[i+2*m,i-m-Math.sqrt(3)*g,i-m+Math.sqrt(3)*g]}default:return[]}})(y).map((t=>add2(scale2$1(e.normal,e.distance),scale2$1(a,t)))).map((e=>({p:e,normal:normalize2(subtract2(e,r))}))).map((e=>({normal:e.normal,distance:dot2(e.normal,midpoint2(e.p,r))})))},axiom6=(e,t,r,s)=>normalAxiom6(vecLineToUniqueLine(e),vecLineToUniqueLine(t),r,s).map(uniqueLineToVecLine),normalAxiom7=(e,t,r)=>{const s=rotate90(e.normal),a=dot2(s,t.normal);if(Math.abs(a)<p)return;const o=dot2(r,s),c=dot2(r,t.normal);return[{normal:s,distance:(t.distance+2*o*a-c)/(2*a)}]},axiom7=(e,t,r)=>{const s=intersectLineLine(e,{vector:t.vector,origin:r},includeL,includeL).point;return void 0===s?[]:[{vector:normalize2(rotate90(subtract2(s,r))),origin:midpoint2(r,s)}]};var V=Object.freeze({__proto__:null,axiom1:axiom1,axiom2:axiom2,axiom3:axiom3,axiom4:axiom4,axiom5:axiom5,axiom6:axiom6,axiom7:axiom7,normalAxiom1:normalAxiom1,normalAxiom2:normalAxiom2,normalAxiom3:normalAxiom3,normalAxiom4:normalAxiom4,normalAxiom5:normalAxiom5,normalAxiom6:normalAxiom6,normalAxiom7:normalAxiom7});const z=[1,0,0,1],T=z.concat(0,0),multiplyMatrix2Vector2=(e,t)=>[e[0]*t[0]+e[2]*t[1]+e[4],e[1]*t[0]+e[3]*t[1]+e[5]],multiplyMatrix2Line2=(e,{vector:t,origin:r})=>({vector:[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1]],origin:[e[0]*r[0]+e[2]*r[1]+e[4],e[1]*r[0]+e[3]*r[1]+e[5]]}),multiplyMatrices2=(e,t)=>[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]],determinant2=e=>e[0]*e[3]-e[1]*e[2],invertMatrix2=e=>{const t=determinant2(e);if(!(Math.abs(t)<1e-12||Number.isNaN(t))&&Number.isFinite(e[4])&&Number.isFinite(e[5]))return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[3]*e[4])/t,(e[1]*e[4]-e[0]*e[5])/t]},makeMatrix2Scale=(e=[1,1],t=[0,0])=>[e[0],0,0,e[1],e[0]*-t[0]+t[0],e[1]*-t[1]+t[1]],makeMatrix2Reflect=(e,t=[0,0])=>{const r=Math.atan2(e[1],e[0]),s=Math.cos(r),a=Math.sin(r),o=Math.cos(-r),c=Math.sin(-r),n=s*o+a*c,i=s*-c+a*o,l=a*o+-s*c,d=a*-c+-s*o;return[n,i,l,d,t[0]+n*-t[0]+-t[1]*l,t[1]+i*-t[0]+-t[1]*d]};var P=Object.freeze({__proto__:null,determinant2:determinant2,identity2x2:z,identity2x3:T,invertMatrix2:invertMatrix2,makeMatrix2Reflect:makeMatrix2Reflect,makeMatrix2Rotate:(e,t=[0,0])=>{const r=Math.cos(e),s=Math.sin(e);return[r,s,-s,r,t[0],t[1]]},makeMatrix2Scale:makeMatrix2Scale,makeMatrix2Translate:(e=0,t=0)=>z.concat(e,t),makeMatrix2UniformScale:(e=1,t=[0,0])=>makeMatrix2Scale([e,e],t),multiplyMatrices2:multiplyMatrices2,multiplyMatrix2Line2:multiplyMatrix2Line2,multiplyMatrix2Vector2:multiplyMatrix2Vector2});const overlapLinePoint=({vector:e,origin:t},r,s=includeL,a=p)=>{const o=subtract2(r,t),c=magSquared(e),n=Math.sqrt(c);if(n<a)return!1;const i=[e[0]/n,e[1]/n],l=cross2(o,i),d=dot2(o,e)/c;return Math.abs(l)<a&&s(d,a/n)},overlapConvexPolygonPoint=(e,t,r=exclude,s=p)=>{const a=e.map(((e,t,r)=>[e,r[(t+1)%r.length]])).map((([e,r])=>[subtract2(r,e),subtract2(t,e)])).map((([e,t])=>cross2(e,t))),o=Math.sign(a.reduce(((e,t)=>e+t),0));return{overlap:a.map((e=>e*o)).map((e=>r(e,s))).map(((e,t,r)=>e===r[0])).reduce(((e,t)=>e&&t),!0),t:a}},overlapConvexPolygons=(e,t,r=p)=>{for(let s=0;s<2;s+=1){const a=0===s?e:t,o=0===s?t:e;for(let e=0;e<a.length;e+=1){const t=a[e],s=rotate90(subtract2(a[(e+1)%a.length],a[e])),c=o.map((e=>subtract2(e,t))).map((e=>dot2(s,e))),n=a[(e+2)%a.length],i=dot2(s,subtract2(n,t))>0;if(c.map((e=>i?e<r:e>-r)).reduce(((e,t)=>e&&t),!0))return!1}}return!0},overlapBoundingBoxes=(e,t,r=p)=>{const s=Math.min(e.min.length,t.min.length);for(let a=0;a<s;a+=1)if(e.min[a]>t.max[a]+r||e.max[a]<t.min[a]-r)return!1;return!0};var $=Object.freeze({__proto__:null,overlapBoundingBoxes:overlapBoundingBoxes,overlapConvexPolygonPoint:overlapConvexPolygonPoint,overlapConvexPolygons:overlapConvexPolygons,overlapLinePoint:overlapLinePoint});const clipLineConvexPolygon=(e,{vector:t,origin:r},s=include,a=includeL,o=p)=>{const c=intersectPolygonLine(e,{vector:t,origin:r},includeL,o).map((({a:e})=>e));if(c.length<2)return;const n=((e,t,r)=>{if(e.length<2)return;let s=0,a=e.length-1;for(;s<a&&!t(e[s+1]-e[s],r);)s+=1;for(;a>s&&!t(e[a]-e[a-1],r);)a-=1;return s>=a?void 0:[e[s],e[a]]})(c,s,2*o/magnitude2(t));if(void 0===n)return;const i=n.map((e=>a(e)?e:e<.5?0:1));if(Math.abs(i[0]-i[1])<2*o/magnitude2(t))return;const l=add2(r,scale2$1(t,(i[0]+i[1])/2));return overlapConvexPolygonPoint(e,l,s,o).overlap?i.map((e=>add2(r,scale2$1(t,e)))):void 0},clipPolygonPolygon=(e,t,r=p)=>{const inside=(e,t,s)=>(s[0]-t[0])*(e[1]-t[1])>(s[1]-t[1])*(e[0]-t[0])+r,intersection=(e,t,r,s)=>{const a=subtract2(e,t),o=subtract2(s,r),c=cross2(e,t),n=cross2(s,r),i=1/cross2(a,o);return scale2$1(subtract2(scale2$1(o,c),scale2$1(a,n)),i)};let s=e,a=t[t.length-1];for(let e=0;e<t.length;e+=1){const r=t[e],o=s;s=[];let c=o[o.length-1];for(let e=0;e<o.length;e+=1){const t=o[e];inside(t,a,r)?(inside(c,a,r)||s.push(intersection(a,r,t,c)),s.push(t)):inside(c,a,r)&&s.push(intersection(a,r,t,c)),c=t}a=r}return 0===s.length?void 0:s};var B=Object.freeze({__proto__:null,clipLineConvexPolygon:clipLineConvexPolygon,clipPolygonPolygon:clipPolygonPolygon});const reflectPoint=(e,t)=>{const r=makeMatrix2Reflect(e.vector,e.origin);return multiplyMatrix2Vector2(r,t)},validateAxiom1And2=(e,t,r)=>[[t,r].map((t=>overlapConvexPolygonPoint(e,t,include).overlap)).reduce(((e,t)=>e&&t),!0)],validateAxiom3=(e,t,r,s)=>{const a=[r,s].map((t=>clipLineConvexPolygon(e,t,include,includeL)));if(void 0===a[0]||void 0===a[1])return[!1,!1];const o=t.map((t=>void 0===t?void 0:clipLineConvexPolygon(e,t,include,includeL))),c=[0,1].map((e=>void 0!==o[e])),n=t.map((e=>void 0===e?void 0:[reflectPoint(e,a[0][0]),reflectPoint(e,a[0][1])])),i=n.map((e=>void 0!==e&&(overlapLinePoint({vector:subtract2(a[1][1],a[1][0]),origin:a[1][0]},e[0],includeS)||overlapLinePoint({vector:subtract2(a[1][1],a[1][0]),origin:a[1][0]},e[1],includeS)||overlapLinePoint({vector:subtract2(e[1],e[0]),origin:e[0]},a[1][0],includeS)||overlapLinePoint({vector:subtract2(e[1],e[0]),origin:e[0]},a[1][1],includeS))));return[0,1].map((e=>!0===i[e]&&!0===c[e]))},validateAxiom4=(e,t,r,s)=>{const a={vector:rotate90(r.vector),origin:s},o=intersectLineLine(r,a).point;return o?[[s,o].map((t=>overlapConvexPolygonPoint(e,t,include).overlap)).reduce(((e,t)=>e&&t),!0)]:[!1]},validateAxiom5=(e,t,r,s,a)=>{if(0===t.length)return[];const o=[s,a].map((t=>overlapConvexPolygonPoint(e,t,include).overlap)).reduce(((e,t)=>e&&t),!0),c=t.map((e=>reflectPoint(e,a))).map((t=>overlapConvexPolygonPoint(e,t,include).overlap));return c.map((e=>e&&o))},validateAxiom6=function(e,t,r,s,a,o){if(0===t.length)return[];if(![a,o].map((t=>overlapConvexPolygonPoint(e,t,include).overlap)).reduce(((e,t)=>e&&t),!0))return t.map((()=>!1));const c=t.map((e=>reflectPoint(e,a))).map((t=>overlapConvexPolygonPoint(e,t,include).overlap)),n=t.map((e=>reflectPoint(e,o))).map((t=>overlapConvexPolygonPoint(e,t,include).overlap));return t.map(((e,t)=>c[t]&&n[t]))},validateAxiom7=(e,t,r,s,a)=>{const o=overlapConvexPolygonPoint(e,a,include).overlap;if(!t.length)return[!1];const c=reflectPoint(t[0],a),n=overlapConvexPolygonPoint(e,c,include).overlap,i=intersectPolygonLine(e,s,includeL).length>=2,l=intersectLineLine(s,t[0],includeL,includeL).point,d=!!l&&overlapConvexPolygonPoint(e,l,include).overlap;return[o&&n&&i&&d]};var N=Object.freeze({__proto__:null,validateAxiom1And2:validateAxiom1And2,validateAxiom3:validateAxiom3,validateAxiom4:validateAxiom4,validateAxiom5:validateAxiom5,validateAxiom6:validateAxiom6,validateAxiom7:validateAxiom7});var R=Object.freeze({__proto__:null,axiom1InPolygon:(e,t,r)=>{const s=validateAxiom1And2(e,t,r);return axiom1(t,r).filter(((e,t)=>s[t]))},axiom2InPolygon:(e,t,r)=>{const s=validateAxiom1And2(e,t,r);return axiom2(t,r).filter(((e,t)=>s[t]))},axiom3InPolygon:(e,t,r)=>{const s=axiom3(t,r),a=validateAxiom3(e,s,t,r);return s.filter(((e,t)=>a[t]))},axiom4InPolygon:(e,t,r)=>{const s=axiom4(t,r),a=validateAxiom4(e,0,t,r);return s.filter(((e,t)=>a[t]))},axiom5InPolygon:(e,t,r,s)=>{const a=axiom5(t,r,s),o=validateAxiom5(e,a,0,r,s);return a.filter(((e,t)=>o[t]))},axiom6InPolygon:(e,t,r,s,a)=>{const o=axiom6(t,r,s,a),c=validateAxiom6(e,o,0,0,s,a);return o.filter(((e,t)=>c[t]))},axiom7InPolygon:(e,t,r,s)=>{const a=axiom7(t,r,s),o=validateAxiom7(e,a,0,r,s);return a.filter(((e,t)=>o[t]))},normalAxiom1InPolygon:(e,t,r)=>{const s=validateAxiom1And2(e,t,r);return normalAxiom1(t,r).filter(((e,t)=>s[t]))},normalAxiom2InPolygon:(e,t,r)=>{const s=validateAxiom1And2(e,t,r);return normalAxiom2(t,r).filter(((e,t)=>s[t]))},normalAxiom3InPolygon:(e,t,r)=>{const s=normalAxiom3(t,r),a=validateAxiom3(e,s.map(uniqueLineToVecLine),uniqueLineToVecLine(t),uniqueLineToVecLine(r));return s.filter(((e,t)=>a[t]))},normalAxiom4InPolygon:(e,t,r)=>{const s=normalAxiom4(t,r),a=validateAxiom4(e,s.map(uniqueLineToVecLine),uniqueLineToVecLine(t),r);return s.filter(((e,t)=>a[t]))},normalAxiom5InPolygon:(e,t,r,s)=>{const a=normalAxiom5(t,r,s),o=validateAxiom5(e,a.map(uniqueLineToVecLine),uniqueLineToVecLine(t),r,s);return a.filter(((e,t)=>o[t]))},normalAxiom6InPolygon:(e,t,r,s,a)=>{const o=normalAxiom6(t,r,s,a),c=validateAxiom6(e,o.map(uniqueLineToVecLine),uniqueLineToVecLine(t),uniqueLineToVecLine(r),s,a);return o.filter(((e,t)=>c[t]))},normalAxiom7InPolygon:(e,t,r,s)=>{const a=normalAxiom7(t,r,s),o=validateAxiom7(e,a.map(uniqueLineToVecLine),uniqueLineToVecLine(t),uniqueLineToVecLine(r),s);return a.filter(((e,t)=>o[t]))}}),L={...V,...R,...N};const I="Rabbit Ear",makePairsMap=(e,t)=>{const r={};return(t||e.map(((e,t)=>t))).forEach((t=>e[t].map(((e,t,r)=>[0,1].map((e=>(t+e)%r.length)).map((e=>r[e])).join(" "))).forEach((e=>{r[e]=t})))),r},makeVerticesToEdge=({edges_vertices:e},t)=>makePairsMap(e,t),makeVerticesToFace=({faces_vertices:e},t)=>makePairsMap(e,t),makeEdgesToFace=({faces_edges:e},t)=>makePairsMap(e,t);var U=Object.freeze({__proto__:null,makeEdgesToFace:makeEdgesToFace,makeVerticesToEdge:makeVerticesToEdge,makeVerticesToFace:makeVerticesToFace});const makeVerticesEdgesUnsorted=({edges_vertices:e})=>{const t=[];return e.forEach(((e,r)=>e.forEach((e=>{void 0===t[e]&&(t[e]=[]),t[e].push(r)})))),t},makeVerticesEdges=({edges_vertices:e,vertices_vertices:t})=>{const r=makeVerticesToEdge({edges_vertices:e});return t.map(((e,t)=>e.map((e=>r[`${t} ${e}`]))))};var D=Object.freeze({__proto__:null,makeVerticesEdges:makeVerticesEdges,makeVerticesEdgesUnsorted:makeVerticesEdgesUnsorted});const uniqueElements=e=>Array.from(new Set(e)),uniqueSortedNumbers=e=>{const t={};return e.forEach((e=>{t[e]=!0})),Object.keys(t).map(parseFloat)},epsilonUniqueSortedNumbers=(e,t=p)=>{const r=e.slice().sort(((e,t)=>e-t));if(r.length<2)return r;const s=[!0];for(let e=1;e<r.length;e+=1)s[e]=!epsilonEqual(r[e],r[e-1],t);return r.filter(((e,t)=>s[t]))},rotateCircularArray=(e,t)=>t<=0?e:e.slice(t).concat(e.slice(0,t)),splitCircularArray$1=(e,t)=>(t.sort(((e,t)=>e-t)),[e.slice(t[1]).concat(e.slice(0,t[0]+1)),e.slice(t[0],t[1]+1)]),chooseTwoPairs=e=>{const t=Array(e.length*(e.length-1)/2);let r=0;for(let s=0;s<e.length-1;s+=1)for(let a=s+1;a<e.length;a+=1,r+=1)t[r]=[e[s],e[a]];return t},setDifferenceSortedEpsilonNumbers=(e,t,r=p)=>{const s=[];let a=0,o=0;for(;a<e.length&&o<t.length;)epsilonEqual(e[a],t[o],r)?a+=1:e[a]>t[o]?o+=1:t[o]>e[a]&&(s.push(e[a]),a+=1);return s},arrayMinimumIndex=(e,t)=>{if(!e.length)return;const r="function"==typeof t?e.map((e=>t(e))):e;let s=0;return r.forEach(((e,t,r)=>{e<r[s]&&(s=t)})),s},arrayMaximumIndex=(e,t)=>{if(!e.length)return;const r="function"==typeof t?e.map((e=>t(e))):e;let s=0;return r.forEach(((e,t,r)=>{e>r[s]&&(s=t)})),s},mergeArraysWithHoles=(...e)=>{const t=[];return e.forEach((e=>e.forEach(((e,r)=>{t[r]=e})))),t},clustersToReflexiveArrays=e=>{const t=[];return e.flat().forEach((e=>{t[e]=[]})),e.flatMap(chooseTwoPairs).forEach((([e,r])=>{t[e].push(r),t[r].push(e)})),t},arrayArrayToLookupArray=e=>e.map((e=>{const t=[];return e.forEach((e=>{t[e]=!0})),t}));var Q=Object.freeze({__proto__:null,arrayArrayToLookupArray:arrayArrayToLookupArray,arrayIntersection:(e,t)=>{const r={};return t.forEach((e=>{r[e]=0})),t.forEach((e=>{r[e]+=1})),e.filter((e=>r[e]>0&&(r[e]-=1,!0)))},arrayMaximumIndex:arrayMaximumIndex,arrayMinimumIndex:arrayMinimumIndex,chooseTwoPairs:chooseTwoPairs,clustersToReflexiveArrays:clustersToReflexiveArrays,epsilonUniqueSortedNumbers:epsilonUniqueSortedNumbers,lookupArrayToArrayArray:e=>e.map((e=>e.map(((e,t)=>e?t:void 0)).filter((e=>void 0!==e)))),mergeArraysWithHoles:mergeArraysWithHoles,nonUniqueElements:e=>{const t={};return e.forEach((e=>{void 0===t[e]&&(t[e]=0),t[e]+=1})),e.filter((e=>t[e]>1))},rotateCircularArray:rotateCircularArray,setDifferenceSortedEpsilonNumbers:setDifferenceSortedEpsilonNumbers,setDifferenceSortedNumbers:(e,t)=>{const r=[];let s=0,a=0;for(;s<e.length&&a<t.length;)e[s]===t[a]?s+=1:e[s]>t[a]?a+=1:t[a]>e[s]&&(r.push(e[s]),s+=1);return r},splitCircularArray:splitCircularArray$1,uniqueElements:uniqueElements,uniqueSortedNumbers:uniqueSortedNumbers});const edgeifyFaces=({vertices_coords:e,faces_vertices:t},r=0)=>t.map((t=>[t.reduce(((t,s)=>e[t][r]<e[s][r]?t:s)),t.reduce(((t,s)=>e[t][r]>e[s][r]?t:s))])),sweepValues=({edges_vertices:e,vertices_edges:t},r,s=p)=>{t||(t=makeVerticesEdgesUnsorted({edges_vertices:e}));const a=e.map((e=>e.map((e=>r[e])))),o=a.map((([e,t])=>epsilonEqual(e,t,s))),c=a.map((([e,t])=>Math.sign(e-t))),n=e.map((([e,t],r)=>o[r]?{[e]:0,[t]:0}:{[e]:c[r],[t]:-c[r]}));return clusterScalars(r,s).map((e=>e.filter((e=>t[e])))).filter((e=>e.length)).map((e=>({vertices:e,t:e.reduce(((e,t)=>e+r[t]),0)/e.length,start:uniqueElements(e.flatMap((e=>t[e].filter((t=>n[t][e]<=0))))),end:uniqueElements(e.flatMap((e=>t[e].filter((t=>n[t][e]>=0)))))})))},sweepEdges=({vertices_coords:e,edges_vertices:t,vertices_edges:r},s=0,a=p)=>sweepValues({edges_vertices:t,vertices_edges:r},e.map((e=>e[s])),a),sweepFaces=({vertices_coords:e,faces_vertices:t},r=0,s=p)=>sweepValues({edges_vertices:edgeifyFaces({vertices_coords:e,faces_vertices:t},r)},e.map((e=>e[r])),s);var W=Object.freeze({__proto__:null,sweep:({vertices_coords:e,edges_vertices:t,faces_vertices:r},s=0,a=p)=>{const o=e.map((e=>e[s])),c=edgeifyFaces({vertices_coords:e,faces_vertices:r},s),n=makeVerticesEdgesUnsorted({edges_vertices:t}),i=makeVerticesEdgesUnsorted({edges_vertices:c}),l=t.map((e=>e.map((e=>o[e])))),d=c.map((e=>e.map((e=>o[e])))),_=l.map((([e,t])=>epsilonEqual(e,t,a))),m=d.map((([e,t])=>epsilonEqual(e,t,a))),g=l.map((([e,t])=>Math.sign(e-t))),v=d.map((([e,t])=>Math.sign(e-t))),u=t.map((([e,t],r)=>_[r]?{[e]:0,[t]:0}:{[e]:g[r],[t]:-g[r]})),h=r.map((([e,t],r)=>m[r]?{[e]:0,[t]:0}:{[e]:v[r],[t]:-v[r]}));return clusterScalars(o,a).map((e=>({vertices:e,t:e.reduce(((e,t)=>e+o[t]),0)/e.length,edges:{start:uniqueElements(e.filter((e=>void 0!==n[e])).flatMap((e=>n[e].filter((t=>u[t][e]<=0))))),end:uniqueElements(e.filter((e=>void 0!==n[e])).flatMap((e=>n[e].filter((t=>u[t][e]>=0)))))},faces:{start:uniqueElements(e.filter((e=>void 0!==i[e])).flatMap((e=>i[e].filter((t=>h[t][e]<=0))))),end:uniqueElements(e.filter((e=>void 0!==i[e])).flatMap((e=>i[e].filter((t=>h[t][e]>=0)))))}})))},sweepEdges:sweepEdges,sweepFaces:sweepFaces,sweepValues:sweepValues,sweepVertices:({vertices_coords:e},t=0,r=p)=>clusterScalars(e.map((e=>e[t])),r).map((r=>({vertices:r,t:r.reduce(((r,s)=>r+e[s][t]),0)/r.length})))});const doEdgesOverlap=({vertices_coords:e,edges_vertices:t},r=p)=>{const s=(({vertices_coords:e,edges_vertices:t},r=0)=>t.map((t=>t.map((t=>e[t])))).map((([e,t])=>[Math.min(e[1],t[1])-r,Math.max(e[1],t[1])+r])).map((e=>epsilonEqual(e[0],e[1],Math.abs(2.5*r))?void 0:e)))({vertices_coords:e,edges_vertices:t},-r),a=e.map(resize2),o=t.map((e=>[a[e[0]],a[e[1]]])).map((([e,t])=>pointsToLine2(e,t))),c=[],n=sweepEdges({vertices_coords:e,edges_vertices:t});try{n.forEach((({start:e,end:t})=>{e.forEach((e=>{c[e]=!0})),Object.keys(c).map((e=>parseInt(e,10))).forEach((t=>e.forEach((e=>{if(t!==e&&(!s[t]||!s[e]||doRangesOverlap(s[t],s[e]))&&intersectLineLine(o[t],o[e],excludeS,excludeS,r).point)throw new Error})))),t.forEach((e=>{delete c[e]}))}))}catch(e){return!0}return!1};var q=Object.freeze({__proto__:null,doEdgesOverlap:doEdgesOverlap});const G={file:["file_spec","file_creator","file_author","file_title","file_description","file_classes","file_frames"],frame:["frame_author","frame_title","frame_description","frame_attributes","frame_classes","frame_unit","frame_parent","frame_inherit"],graph:["vertices_coords","vertices_vertices","vertices_edges","vertices_faces","edges_vertices","edges_faces","edges_assignment","edges_foldAngle","edges_length","faces_vertices","faces_edges","faces_faces"],orders:["edgeOrders","faceOrders"]},H=["vertices","edges","faces"],J=Array.from("BbMmVvFfJjCcUu"),Z={B:"boundary",M:"mountain",V:"valley",F:"flat",J:"join",C:"cut",U:"unassigned"};Object.keys(Z).forEach((e=>{Z[e.toLowerCase()]=Z[e]}));const Y={B:0,b:0,M:-180,m:-180,V:180,v:180,F:0,f:0,J:0,j:0,C:0,c:0,U:0,u:0},X={B:!1,b:!1,M:!0,m:!0,V:!0,v:!0,F:!1,f:!1,J:!1,j:!1,C:!1,c:!1,U:!0,u:!0},K={B:!0,b:!0,M:!1,m:!1,V:!1,v:!1,F:!1,f:!1,J:!1,j:!1,C:!0,c:!0,U:!1,u:!1},edgeAssignmentToFoldAngle=e=>Y[e]||0,edgeFoldAngleToAssignment=e=>e>p?"V":e<-p?"M":"U",edgeFoldAngleIsFlatFolded=e=>epsilonEqual(-180,e)||epsilonEqual(180,e),edgeFoldAngleIsFlat=e=>epsilonEqual(0,e)||edgeFoldAngleIsFlatFolded(e),edgesFoldAngleAreAllFlat=({edges_foldAngle:e})=>{if(!e)return!0;for(let t=0;t<e.length;t+=1)if(!edgeFoldAngleIsFlat(e[t]))return!1;return!0},filterKeys=(e,t)=>Object.keys(e).filter((e=>t(e))),filterKeysWithPrefix=(e,t)=>filterKeys(e,(e=>e.substring(0,t.length+1)===`${t}_`)),filterKeysWithSuffix=(e,t)=>filterKeys(e,(e=>e.substring(e.length-t.length-1,e.length)===`_${t}`)),getAllPrefixes=e=>{const t={};return Object.keys(e).filter((e=>e.includes("_"))).map((e=>e.substring(0,e.indexOf("_")))).forEach((e=>{t[e]=!0})),Object.keys(t)},getAllSuffixes=e=>{const t={};return Object.keys(e).filter((e=>e.includes("_"))).map((e=>e.substring(e.lastIndexOf("_")+1,e.length))).forEach((e=>{t[e]=!0})),Object.keys(t)},ee=Object.freeze([].concat(G.file).concat(G.frame).concat(G.graph).concat(G.orders)),getDimensionQuick=({vertices_coords:e})=>{if(!e||!e.length)return;if(void 0!==e[0])return e[0].length;const t=e.filter((()=>!0)).shift();return t?t.length:void 0},isFoldedForm=({vertices_coords:e,edges_vertices:t,faces_vertices:r,faces_edges:s,frame_classes:a,file_classes:o},c=p)=>{if(a&&a.includes("foldedForm")||o&&o.includes("foldedForm"))return!0;if(a&&a.includes("creasePattern")||o&&o.includes("creasePattern"))return!1;if(!e)return!1;const n=getDimensionQuick({vertices_coords:e});if(!r&&!s)return 3===n;if(t&&2===n)return doEdgesOverlap({vertices_coords:e,edges_vertices:t});for(let t=0;t<e.length;t+=1)if(e[t]&&"number"==typeof e[t][2]&&!epsilonEqual(e[t][2],0,c))return!0;return 3===n},makeEdgesIsFolded=({edges_vertices:e,edges_foldAngle:t,edges_assignment:r})=>void 0===r?void 0===t?e.map((()=>!0)):t.map((e=>e<-p||e>p)):r.map((e=>X[e])),te={M:"V",m:"v",V:"M",v:"m"},invertAssignment=e=>te[e]||e,invertAssignments=e=>(e.edges_assignment&&(e.edges_assignment=e.edges_assignment.map((e=>te[e]?te[e]:e))),e.edges_foldAngle&&(e.edges_foldAngle=e.edges_foldAngle.map((e=>-e))),e),sortEdgesByAssignment=({edges_vertices:e,edges_assignment:t=[]})=>{const r=Array.from(new Set(J.map((e=>e.toUpperCase())))),s=e.map(((e,r)=>t[r]||"U")).map((e=>e.toUpperCase())),a={};return r.forEach((e=>{a[e]=[]})),s.forEach(((e,t)=>a[e].push(t))),a};var re=Object.freeze({__proto__:null,VEF:H,assignmentCanBeFolded:X,assignmentFlatFoldAngle:Y,assignmentIsBoundary:K,edgeAssignmentToFoldAngle:edgeAssignmentToFoldAngle,edgeFoldAngleIsFlat:edgeFoldAngleIsFlat,edgeFoldAngleIsFlatFolded:edgeFoldAngleIsFlatFolded,edgeFoldAngleToAssignment:edgeFoldAngleToAssignment,edgesAssignmentNames:Z,edgesAssignmentValues:J,edgesFoldAngleAreAllFlat:edgesFoldAngleAreAllFlat,filterKeysWithPrefix:filterKeysWithPrefix,filterKeysWithSuffix:filterKeysWithSuffix,foldFileClasses:["singleModel","multiModel","animation","diagrams"],foldFrameAttributes:["2D","3D","abstract","manifold","nonManifold","orientable","nonOrientable","selfTouching","nonSelfTouching","selfIntersecting","nonSelfIntersecting"],foldFrameClasses:["creasePattern","foldedForm","graph","linkage"],foldKeys:G,getAllPrefixes:getAllPrefixes,getAllSuffixes:getAllSuffixes,getDimension:({vertices_coords:e},t=p)=>{for(let r=0;r<e.length;r+=1)if(e[r]&&3===e[r].length&&!epsilonEqual(0,e[r][2],t))return 3;return 2},getDimensionQuick:getDimensionQuick,getFileMetadata:(e={})=>{const t={};return G.file.filter((e=>"file_frames"!==e)).filter((t=>void 0!==e[t])).forEach((r=>{t[r]=e[r]})),t},invertAssignment:invertAssignment,invertAssignments:invertAssignments,isFoldObject:(e={})=>0===Object.keys(e).length?0:ee.filter((t=>e[t])).length/Object.keys(e).length,isFoldedForm:isFoldedForm,makeEdgesIsFolded:makeEdgesIsFolded,sortEdgesByAssignment:sortEdgesByAssignment,transposeGraphArrayAtIndex:(e,t,r)=>{const s=filterKeysWithPrefix(e,t);if(0===s.length)return;const a={};return s.forEach((t=>{a[t]=e[t][r]})),a},transposeGraphArrays:(e,t)=>{const r=filterKeysWithPrefix(e,t);if(0===r.length)return[];const s=Math.max(...r.map((t=>e[t].length))),a=Array.from(Array(s)).map((()=>({})));return r.forEach((t=>a.forEach(((r,s)=>{a[s][t]=e[t][s]})))),a}});const se={edges:"edgeOrders",faces:"faceOrders"},maxArraysLength=e=>Math.max(0,...e.filter((e=>void 0!==e)).map((e=>e.length))),count=(e,t)=>maxArraysLength(filterKeysWithPrefix(e,t).map((t=>e[t]))),countEdges=({edges_vertices:e,edges_faces:t})=>maxArraysLength([e,t]),countImplied=(e,t)=>Math.max((e=>{let t=-1;return e.filter((e=>void 0!==e)).forEach((e=>e.forEach((e=>e.forEach((e=>{e>t&&(t=e)})))))),t})(filterKeysWithSuffix(e,t).map((t=>e[t]))),e[se[t]]?(e=>{let t=-1;return e.forEach((e=>{e[0]>t&&(t=e[0]),e[1]>t&&(t=e[1])})),t})(e[se[t]]):-1)+1,countImpliedVertices=e=>countImplied(e,"vertices"),countImpliedEdges=e=>countImplied(e,"edges");var ae=Object.freeze({__proto__:null,count:count,countEdges:countEdges,countFaces:({faces_vertices:e,faces_edges:t,faces_faces:r})=>maxArraysLength([e,t,r]),countImplied:countImplied,countImpliedEdges:countImpliedEdges,countImpliedFaces:e=>countImplied(e,"faces"),countImpliedVertices:countImpliedVertices,countVertices:({vertices_coords:e,vertices_vertices:t,vertices_edges:r,vertices_faces:s})=>maxArraysLength([e,t,r,s])});const makeVerticesFacesUnsorted=({vertices_coords:e,vertices_edges:t,faces_vertices:r})=>{const s=e||t;if(!r)return(s||[]).map((()=>[]));const a=void 0!==s?s.map((()=>[])):Array.from(Array(countImpliedVertices({faces_vertices:r}))).map((()=>[]));return r.forEach(((e,t)=>{const r=[];e.forEach((e=>{r[e]=t})),r.forEach(((e,t)=>a[t].push(e)))})),a},makeVerticesFaces=({vertices_coords:e,vertices_vertices:t,faces_vertices:r})=>{if(!r)return e.map((()=>[]));if(!t)return makeVerticesFacesUnsorted({vertices_coords:e,faces_vertices:r});const s=makeVerticesToFace({faces_vertices:r});return t.map(((e,t)=>e.map((e=>[t,e].join(" "))))).map((e=>e.map((e=>s[e]))))};var oe=Object.freeze({__proto__:null,makeVerticesFaces:makeVerticesFaces,makeVerticesFacesUnsorted:makeVerticesFacesUnsorted});const projectPointOnPlane=(e,t=[1,0,0],r=[0,0,0])=>{const s=resize3(e),a=subtract3(s,resize3(r)),o=normalize3(resize3(t)),c=dot3(o,a),n=scale3$1(o,c);return subtract3(s,n)};var ce=Object.freeze({__proto__:null,projectPointOnPlane:projectPointOnPlane});const sortPointsAlongVector=(e,t)=>{return r=t,s=dot,e.map(((e,t)=>({i:t,n:s(e,r)}))).sort(((e,t)=>e.n-t.n)).map((e=>e.i));var r,s},radialSortUnitVectors2=e=>{const t=[[],[]];e.map((e=>e[1]>=0?0:1)).forEach(((e,r)=>t[e].push(r)));const r=[(t,r)=>e[r][0]-e[t][0],(t,r)=>e[t][0]-e[r][0]];return t.flatMap(((e,t)=>e.sort(r[t])))},radialSortVectors3=(e,t=[1,0,0],r=[0,0,0])=>{const s=basisVectors3(t),a=[s[1],s[2],s[0]],o=e.map((e=>projectPointOnPlane(e,t,r))).map((e=>subtract(e,r))).map((e=>[dot(e,a[0]),dot(e,a[1])])).map(normalize2);return radialSortUnitVectors2(o)};var ne=Object.freeze({__proto__:null,radialSortUnitVectors2:radialSortUnitVectors2,radialSortVectors3:radialSortVectors3,sortPointsAlongVector:sortPointsAlongVector});const sortVerticesCounterClockwise=({vertices_coords:e},t,r)=>t.map((t=>e[t])).map((t=>subtract(t,e[r]))).map((e=>Math.atan2(e[1],e[0]))).map((e=>e>-p?e:e+2*Math.PI)).map(((e,t)=>({a:e,i:t}))).sort(((e,t)=>e.a-t.a)).map((e=>e.i)).map((e=>t[e]));var ie=Object.freeze({__proto__:null,sortVerticesAlongVector:({vertices_coords:e},t,r)=>sortPointsAlongVector(t.map((t=>e[t])),r).map((e=>t[e])),sortVerticesCounterClockwise:sortVerticesCounterClockwise});const makeVerticesVertices2D=({vertices_coords:e,vertices_edges:t,edges_vertices:r})=>{t||(t=makeVerticesEdgesUnsorted({edges_vertices:r}));const s=t.map(((e,t)=>e.map((e=>r[e].filter((e=>e!==t)))).reduce(((e,t)=>e.concat(t)),[])));return void 0===e?s:s.map(((t,r)=>sortVerticesCounterClockwise({vertices_coords:e},t,r)))},makeVerticesVerticesFromFaces=({vertices_coords:e,vertices_faces:t,faces_vertices:r})=>{t||(t=makeVerticesFacesUnsorted({vertices_coords:e,faces_vertices:r}));const s=t.map((e=>e.map((e=>r[e])))),a=s.map(((e,t)=>e.map((e=>e.indexOf(t))))),o=s.map(((e,t)=>e.map(((e,r)=>[(a[t][r]+e.length-1)%e.length,a[t][r],(a[t][r]+1)%e.length])))),c=o.map(((e,t)=>e.map(((e,r)=>e.map((e=>s[t][r][e])))))),n=c.map((e=>{const t=e.map((e=>[[0,1],[1,2]].map((t=>t.map((t=>e[t])).join(" "))))),r={},s={};return t.forEach(((e,t)=>{r[e[0]]=t,s[e[1]]=t})),{facesVerts:t,to:s,from:r}}));return n.map((e=>{const t=Object.keys(e.to),r=t.map((e=>e.split(" ").reverse().join(" "))),s=t.filter(((t,s)=>!(r[s]in e.from)));if(s.length>2)return console.warn("vertices_vertices found an unsolvable vertex"),[];const a=s.length?s:[t[0]],o=[],c={};for(let t=0;t<a.length;t+=1){const r=a[t],s=[r];c[r]=!0;let n=!1;do{const t=s[s.length-1],r=e.to[t];if(!(r in e.facesVerts))break;let a;if(e.facesVerts[r][0]===t&&(a=e.facesVerts[r][1]),e.facesVerts[r][1]===t&&(a=e.facesVerts[r][0]),void 0===a)return[];const o=a.split(" ").reverse().join(" ");s.push(a),n=o in c,n||s.push(o),c[a]=!0,c[o]=!0}while(!n);const i=s.filter(((e,t)=>t%2==0)).map((e=>e.split(" ")[1])).map((e=>parseInt(e,10)));o.push(...i)}return o}))},makeVerticesVertices=e=>{if(!e.vertices_coords||!e.vertices_coords.length)return[];return 3===e.vertices_coords.filter((()=>!0)).shift().length?makeVerticesVerticesFromFaces(e):makeVerticesVertices2D(e)},makeVerticesVerticesUnsorted=({vertices_edges:e,edges_vertices:t})=>(e||(e=makeVerticesEdgesUnsorted({edges_vertices:t})),e.map(((e,r)=>e.flatMap((e=>t[e].filter((e=>e!==r)))))));var le=Object.freeze({__proto__:null,makeVerticesVertices:makeVerticesVertices,makeVerticesVertices2D:makeVerticesVertices2D,makeVerticesVerticesFromFaces:makeVerticesVerticesFromFaces,makeVerticesVerticesUnsorted:makeVerticesVerticesUnsorted});const makeFacesVerticesFromEdges=({edges_vertices:e,faces_edges:t})=>t.map((t=>t.map((t=>e[t])).map(((e,t,r)=>{const s=r[(t+1)%r.length];return e[0]===s[0]||e[0]===s[1]?e[1]:e[0]}))));var fe=Object.freeze({__proto__:null,makeFacesVerticesFromEdges:makeFacesVerticesFromEdges});const makeFacesEdgesFromVertices=({edges_vertices:e,faces_vertices:t})=>{const r=makeVerticesToEdge({edges_vertices:e});return t.map((e=>e.map(((e,t,r)=>[e,r[(t+1)%r.length]].join(" "))))).map((e=>e.map((e=>r[e]))))};var de=Object.freeze({__proto__:null,makeFacesEdgesFromVertices:makeFacesEdgesFromVertices});const angleArray=e=>Array.from(Array(Math.floor(e))).map(((t,r)=>b*(r/e))),anglesToVecs=(e,t)=>e.map((e=>[t*Math.cos(e),t*Math.sin(e)])),makePolygonCircumradius=(e=3,t=1)=>anglesToVecs(angleArray(e),t),makePolygonCircumradiusSide=(e=3,t=1)=>{const r=Math.PI/e,s=angleArray(e).map((e=>e+r));return anglesToVecs(s,t)},makePolygonNonCollinear=(e,t=p)=>{const r=e.map(((e,t,r)=>[e,r[(t+1)%r.length]])).map((e=>subtract(e[1],e[0]))).map(((e,t,r)=>[e,r[(t+r.length-1)%r.length]])).map((e=>!parallel(e[1],e[0],t)));return e.filter(((e,t)=>r[t]))},makePolygonNonCollinear3=(e,t=p)=>{const r=e.map(((e,t,r)=>[e,r[(t+1)%r.length]])).map((e=>subtract3(e[1],e[0]))).map(((e,t,r)=>[e,r[(t+r.length-1)%r.length]])).map((e=>!parallel(e[1],e[0],t)));return e.filter(((e,t)=>r[t]))},signedArea=e=>.5*e.map(((e,t,r)=>[e,r[(t+1)%r.length]])).map((([e,t])=>cross2(e,t))).reduce(((e,t)=>e+t),0),centroid=e=>{const t=1/(6*signedArea(e)),r=e.map(((e,t,r)=>[e,r[(t+1)%r.length]])).map((([e,t])=>scale2$1(add2(e,t),cross2(e,t)))).reduce(((e,t)=>add2(e,t)),[0,0]);return[r[0]*t,r[1]*t]},boundingBox$1=(e,t=0)=>{if(!e||!e.length)return;const r=(e=>{for(let t=0;t<e.length;t+=1)if(e[t]&&e[t].length)return e[t].length;return 0})(e),s=Array(r).fill(1/0),a=Array(r).fill(-1/0);e.filter((e=>void 0!==e)).forEach((e=>e.forEach(((e,r)=>{e<s[r]&&(s[r]=e-t),e>a[r]&&(a[r]=e+t)}))));const o=a.map(((e,t)=>e-s[t]));return{min:s,max:a,span:o}};var _e=Object.freeze({__proto__:null,boundingBox:boundingBox$1,centroid:centroid,makePolygonCircumradius:makePolygonCircumradius,makePolygonCircumradiusSide:makePolygonCircumradiusSide,makePolygonInradius:(e=3,t=1)=>makePolygonCircumradius(e,t/Math.cos(Math.PI/e)),makePolygonInradiusSide:(e=3,t=1)=>makePolygonCircumradiusSide(e,t/Math.cos(Math.PI/e)),makePolygonNonCollinear:makePolygonNonCollinear,makePolygonNonCollinear3:makePolygonNonCollinear3,makePolygonSideLength:(e=3,t=1)=>makePolygonCircumradius(e,t/2/Math.sin(Math.PI/e)),makePolygonSideLengthSide:(e=3,t=1)=>makePolygonCircumradiusSide(e,t/2/Math.sin(Math.PI/e)),signedArea:signedArea});const makeEdgesCoords=({vertices_coords:e,edges_vertices:t})=>t.map((t=>[e[t[0]],e[t[1]]])),makeEdgesVector=({vertices_coords:e,edges_vertices:t})=>{const r=2===getDimensionQuick({vertices_coords:e})?resize2:resize3;return makeEdgesCoords({vertices_coords:e,edges_vertices:t}).map((([e,t])=>r(subtract(t,e))))},makeEdgesLength=({vertices_coords:e,edges_vertices:t})=>makeEdgesVector({vertices_coords:e,edges_vertices:t}).map(magnitude);var me=Object.freeze({__proto__:null,makeEdgesBoundingBox:({vertices_coords:e,edges_vertices:t},r)=>makeEdgesCoords({vertices_coords:e,edges_vertices:t}).map((e=>boundingBox$1(e,r))),makeEdgesCoords:makeEdgesCoords,makeEdgesLength:makeEdgesLength,makeEdgesVector:makeEdgesVector});const walkSingleFace=({vertices_vertices:e,vertices_sectors:t},r,s,a={})=>{const o={};let c=r,n=s;const i={vertices:[r],edges:[`${r} ${s}`],angles:[]};for(;;){const r=e[n],s=(r.indexOf(c)+r.length-1)%r.length,l=r[s],d=`${n} ${l}`;if(a[d])return;if(o[d])return Object.assign(a,o),i.vertices.pop(),i.edges.pop(),i.angles.length||delete i.angles,i;o[d]=!0,i.vertices.push(n),i.edges.push(d),t&&i.angles.push(t[n][s]),c=n,n=l}},walkPlanarFaces=({vertices_vertices:e,vertices_sectors:t})=>{const r={},s={vertices_vertices:e,vertices_sectors:t};return e.flatMap(((e,t)=>e.map((e=>walkSingleFace(s,t,e,r))).filter((e=>void 0!==e))))},filterWalkedBoundaryFace=e=>e.filter((e=>e.angles.map((e=>Math.PI-e)).reduce(((e,t)=>e+t),0)>0));var ge=Object.freeze({__proto__:null,filterWalkedBoundaryFace:filterWalkedBoundaryFace,walkPlanarFaces:walkPlanarFaces,walkSingleFace:walkSingleFace});const makeVerticesVerticesVector=({vertices_coords:e,vertices_vertices:t,vertices_edges:r,vertices_faces:s,edges_vertices:a,edges_vector:o,faces_vertices:c})=>{o||(o=makeEdgesVector({vertices_coords:e,edges_vertices:a})),t||(t=makeVerticesVertices({vertices_coords:e,vertices_edges:r,vertices_faces:s,edges_vertices:a,faces_vertices:c}));const n={};return a.map((e=>e.join(" "))).forEach(((e,t)=>{n[e]=t})),t.map(((e,r)=>t[r].map((e=>{const t=n[`${r} ${e}`],s=n[`${e} ${r}`];return void 0!==t?resize2(o[t]):void 0!==s?flip2(o[s]):void 0}))))},makeVerticesSectors=({vertices_coords:e,vertices_vertices:t,edges_vertices:r,edges_vector:s})=>makeVerticesVerticesVector({vertices_coords:e,vertices_vertices:t,edges_vertices:r,edges_vector:s}).map((e=>1===e.length?[b]:counterClockwiseSectors2(e)));var ve=Object.freeze({__proto__:null,makeVerticesSectors:makeVerticesSectors,makeVerticesVerticesVector:makeVerticesVerticesVector});const makePlanarFaces=({vertices_coords:e,vertices_vertices:t,vertices_edges:r,vertices_sectors:s,edges_vertices:a,edges_vector:o})=>{t||(t=makeVerticesVertices({vertices_coords:e,edges_vertices:a,vertices_edges:r})),s||(s=makeVerticesSectors({vertices_coords:e,vertices_vertices:t,edges_vertices:a,edges_vector:o}));const c=makeVerticesToEdge({edges_vertices:a}),n=filterWalkedBoundaryFace(walkPlanarFaces({vertices_vertices:t,vertices_sectors:s})).map((e=>({...e,edges:e.edges.map((e=>c[e]))})));return{faces_vertices:n.map((e=>e.vertices)),faces_edges:n.map((e=>e.edges)),faces_sectors:n.map((e=>e.angles))}},makeFacesPolygon=({vertices_coords:e,faces_vertices:t},r)=>t.map((t=>t.map((t=>e[t])))).map((e=>makePolygonNonCollinear(e,r))),makeFacesPolygonQuick=({vertices_coords:e,faces_vertices:t})=>t.map((t=>t.map((t=>e[t])))),makeFacesCenter2DQuick=({vertices_coords:e,faces_vertices:t})=>makeFacesPolygonQuick({vertices_coords:e,faces_vertices:t}).map((e=>e.map(resize2))).map((e=>average2(...e))),makeFacesCenter3DQuick=({vertices_coords:e,faces_vertices:t})=>makeFacesPolygonQuick({vertices_coords:e,faces_vertices:t}).map((e=>e.map(resize3))).map((e=>average3(...e))).map((e=>Number.isNaN(e[2])?[e[0],e[1],0]:e)),makeFacesCenterQuick=({vertices_coords:e,faces_vertices:t})=>2===getDimensionQuick({vertices_coords:e})?makeFacesCenter2DQuick({vertices_coords:e,faces_vertices:t}):makeFacesCenter3DQuick({vertices_coords:e,faces_vertices:t});var pe=Object.freeze({__proto__:null,makeFacesCenter2DQuick:makeFacesCenter2DQuick,makeFacesCenter3DQuick:makeFacesCenter3DQuick,makeFacesCenterQuick:makeFacesCenterQuick,makeFacesCentroid2D:({vertices_coords:e,faces_vertices:t})=>t.map((t=>t.map((t=>e[t])))).map((e=>e.map(resize2))).map((e=>centroid(e))),makeFacesPolygon:makeFacesPolygon,makeFacesPolygonQuick:makeFacesPolygonQuick,makePlanarFaces:makePlanarFaces});const makeEdgesFacesUnsorted=({edges_vertices:e,faces_vertices:t,faces_edges:r})=>{r||(r=makeFacesEdgesFromVertices({edges_vertices:e,faces_vertices:t}));const s=void 0!==e?e.map((()=>[])):Array.from(Array(countImpliedEdges({faces_edges:r}))).map((()=>[]));return r.forEach(((e,t)=>{const r=[];e.forEach((e=>{r[e]=t})),r.forEach(((e,t)=>s[t].push(e)))})),s};var ue=Object.freeze({__proto__:null,makeEdgesFaces:({vertices_coords:e,edges_vertices:t,edges_vector:r,faces_vertices:s,faces_edges:a,faces_center:o})=>{if(!t||!s&&!a)return makeEdgesFacesUnsorted({faces_edges:a});s||(s=makeFacesVerticesFromEdges({edges_vertices:t,faces_edges:a})),a||(a=makeFacesEdgesFromVertices({edges_vertices:t,faces_vertices:s})),r||(r=makeEdgesVector({vertices_coords:e,edges_vertices:t}));const c=t.map((t=>e[t[0]]));o||(o=makeFacesCenterQuick({vertices_coords:e,faces_vertices:s}));const n=t.map((()=>[]));return a.forEach(((e,t)=>{const r=[];e.forEach((e=>{r[e]=t})),r.forEach(((e,t)=>n[t].push(e)))})),n.forEach(((e,t)=>{const s=e.map((e=>o[e])).map((e=>subtract2(e,c[t]))).map((e=>cross2(e,r[t])));e.sort(((e,t)=>s[e]-s[t]))})),n},makeEdgesFacesUnsorted:makeEdgesFacesUnsorted});const makeFacesNormal=({vertices_coords:e,faces_vertices:t})=>{const r=e.map(resize3);return t.map((e=>e.map((e=>r[e])))).map((e=>{let t,r,s=0;do{t=subtract3(e[(s+1)%e.length],e[s]),r=subtract3(e[(s+2)%e.length],e[s]),s+=1}while(s<e.length&¶llel(t,r));return normalize3(cross3(t,r))}))},makeVerticesNormal=({vertices_coords:e,faces_vertices:t,faces_normal:r})=>{r||(r=makeFacesNormal({vertices_coords:e,faces_vertices:t}));const s=e.map((()=>[0,0,0]));return t.forEach(((e,t)=>e.forEach((e=>{s[e][0]+=r[t][0],s[e][1]+=r[t][1],s[e][2]+=r[t][2]})))),s.map((e=>normalize3(e)))};var he=Object.freeze({__proto__:null,makeFacesNormal:makeFacesNormal,makeVerticesNormal:makeVerticesNormal});const be={M:-180,m:-180,V:180,v:180},makeEdgesFoldAngle=({edges_assignment:e})=>e.map((e=>be[e]||0)),makeEdgesFoldAngleFromFaces=({vertices_coords:e,edges_vertices:t,edges_faces:r,edges_assignment:s,faces_vertices:o,faces_edges:c,faces_normal:i,faces_center:l})=>(r||(c||(c=makeFacesEdgesFromVertices({edges_vertices:t,faces_vertices:o})),r=makeEdgesFacesUnsorted({edges_vertices:t,faces_edges:c})),i||(i=makeFacesNormal({vertices_coords:e,faces_vertices:o})),l||(l=makeFacesCenterQuick({vertices_coords:e,faces_vertices:o})),r.map(((e,t)=>{if(e.length>2)throw new Error(a);if(e.length<2)return 0;const r=i[e[0]],o=i[e[1]],c=normalize$2(subtract(l[e[1]],l[e[0]]));let d=Math.sign(dot(r,c));if(0===d){if(!s||!s[t])throw new Error(n);"F"!==s[t]&&"F"!==s[t]||(d=0),"M"!==s[t]&&"m"!==s[t]||(d=-1),"V"!==s[t]&&"v"!==s[t]||(d=1)}return Math.acos(dot(r,o))*(180/Math.PI)*d})));var ye=Object.freeze({__proto__:null,makeEdgesFoldAngle:makeEdgesFoldAngle,makeEdgesFoldAngleFromFaces:makeEdgesFoldAngleFromFaces});const makeEdgesAssignmentSimple=({edges_foldAngle:e})=>e.map((e=>0===e?"F":e<0?"M":"V")),makeEdgesAssignment=({edges_vertices:e,edges_foldAngle:t,edges_faces:r,faces_vertices:s,faces_edges:a})=>(e&&!r&&(!a&&s&&(a=makeFacesEdgesFromVertices({edges_vertices:e,faces_vertices:s})),a&&(r=makeEdgesFacesUnsorted({edges_vertices:e,faces_edges:a}))),t?r?t.map(((e,t)=>r[t].length<2?"B":0===e?"F":e<0?"M":"V")):makeEdgesAssignmentSimple({edges_foldAngle:t}):e.map((()=>"U")));var Ee=Object.freeze({__proto__:null,makeEdgesAssignment:makeEdgesAssignment,makeEdgesAssignmentSimple:makeEdgesAssignmentSimple});const pairify=e=>e.map(((e,t,r)=>[e,r[(t+1)%r.length]])),parseFace=e=>e.slice(1).map((e=>parseInt(e,10)-1)),parseVertex=e=>{const[t,r,s]=e.slice(1).map((e=>parseFloat(e)));return[t||0,r||0,s||0]};var Me=Object.freeze({__proto__:null,objToFold:e=>{const t=e.split("\n").map((e=>e.trim().split(/\s+/))),r={file_spec:1.2,file_creator:I,file_classes:["singleModel"],frame_classes:[],frame_attributes:[],vertices_coords:[],faces_vertices:[]},s=t.map((e=>e[0].toLowerCase()));return r.vertices_coords=t.filter(((e,t)=>"v"===s[t])).map(parseVertex),r.faces_vertices=t.filter(((e,t)=>"f"===s[t])).map(parseFace),r.edges_vertices=(({faces_vertices:e})=>{const t={},r=[];return e.flatMap(pairify).forEach((e=>{const s=[e.join(" "),`${e[1]} ${e[0]}`];s[0]in t||s[1]in t||(r.push(e),t[s[0]]=!0)})),r})(r),r.faces_edges=makeFacesEdgesFromVertices(r),r.edges_faces=makeEdgesFacesUnsorted(r),r.edges_foldAngle=makeEdgesFoldAngleFromFaces(r),r.edges_assignment=makeEdgesAssignment(r),r.vertices_vertices=makeVerticesVerticesFromFaces(r),delete r.edges_faces,(e=>{if(!e.edges_foldAngle||!e.edges_foldAngle.length)return;let t=!0;for(let r=0;r<e.edges_foldAngle.length;r+=1)if(0!==e.edges_foldAngle[r]&&-180!==e.edges_foldAngle[r]&&180!==e.edges_foldAngle[r]){t=!1;break}e.frame_classes.push(t?"creasePattern":"foldedForm"),e.frame_attributes.push(t?"2D":"3D")})(r),r}});const invertFlatMap=e=>{const t=[];return e.forEach(((e,r)=>{t[e]=r})),t},invertArrayToFlatMap=e=>{const t=[];return e.forEach(((e,r)=>e.forEach((e=>{t[e]=r})))),t},invertFlatToArrayMap=e=>{const t=[];return e.forEach(((e,r)=>{void 0===t[e]&&(t[e]=[]),t[e].push(r)})),t},invertArrayMap=e=>{const t=[];return e.forEach(((e,r)=>e.forEach((e=>{void 0===t[e]&&(t[e]=[]),t[e].push(r)})))),t},mergeFlatNextmaps=(...e)=>{if(0===e.length)return[];const t=e[0].map(((e,t)=>t));return e.forEach((e=>t.forEach(((r,s)=>{t[s]=e[r]})))),t},mergeNextmaps=(...e)=>{if(0===e.length)return[];const t=e[0].map(((e,t)=>[t]));return e.forEach((e=>{t.forEach(((r,s)=>r.forEach(((r,a)=>{t[s][a]=e[r]})))),t.forEach(((e,r)=>{t[r]=e.flat().filter((e=>void 0!==e))}))})),t},mergeBackmaps=(...e)=>{if(0===e.length)return[];let t=e[0].flat().map(((e,t)=>[t]));return e.forEach((e=>{const r=[];e.forEach(((e,s)=>{r[s]="number"==typeof e?t[e]:e.map((e=>t[e])).reduce(((e,t)=>e.concat(t)),[])})),t=r})),t},remapKey=(e,t,r)=>{const s=[];r.forEach(((e,t)=>{s[e]=void 0===s[e]?t:s[e]})),filterKeysWithSuffix(e,t).forEach((t=>e[t].forEach(((s,a)=>e[t][a].forEach(((s,o)=>{e[t][a][o]=r[s]})))))),filterKeysWithPrefix(e,t).forEach((t=>{e[t]=s.map((r=>e[t][r]))})),"faces"===t&&e.faceOrders&&(e.faceOrders=e.faceOrders.map((([e,t,s])=>[r[e],r[t],s]))),"edges"===t&&e.edgeOrders&&(e.edgeOrders=e.edgeOrders.map((([e,t,s])=>[r[e],r[t],s])))};var Ae=Object.freeze({__proto__:null,invertArrayMap:invertArrayMap,invertArrayToFlatMap:invertArrayToFlatMap,invertFlatMap:invertFlatMap,invertFlatToArrayMap:invertFlatToArrayMap,mergeBackmaps:mergeBackmaps,mergeFlatBackmaps:(...e)=>{if(0===e.length)return[];let t=e[0].map(((e,t)=>t));return e.forEach((e=>{const r=e.map((e=>t[e]));t=r})),t},mergeFlatNextmaps:mergeFlatNextmaps,mergeNextmaps:mergeNextmaps,remapKey:remapKey});const remove=(e,t,r)=>{const s=((e,t,r)=>{const s=uniqueSortedNumbers(r),a=count(e,t),o=[];for(let e=0,t=0,r=0;e<a;e+=1,t+=1){for(;e===s[r];)o[e]=void 0,e+=1,r+=1;e<a&&(o[e]=t)}return o})(e,t,r);return remapKey(e,t,s),s};var xe=Object.freeze({__proto__:null,remove:remove});const edgeIsolatedVertices=({vertices_coords:e,edges_vertices:t})=>{if(!e||!t)return[];let r=e.length;const s=Array(r).fill(!1);return t.forEach((e=>{e.filter((e=>!s[e])).forEach((e=>{s[e]=!0,r-=1}))})),s.map(((e,t)=>e?void 0:t)).filter((e=>void 0!==e))},isolatedVertices=({vertices_coords:e,edges_vertices:t,faces_vertices:r})=>{if(!e)return[];let s=e.length;const a=Array(s).fill(!1);return t&&t.forEach((e=>{e.filter((e=>!a[e])).forEach((e=>{a[e]=!0,s-=1}))})),r&&r.forEach((e=>{e.filter((e=>!a[e])).forEach((e=>{a[e]=!0,s-=1}))})),a.map(((e,t)=>e?void 0:t)).filter((e=>void 0!==e))},removeIsolatedVertices=(e,t)=>(t||(t=isolatedVertices(e)),{map:remove(e,"vertices",t),remove:t});var Oe=Object.freeze({__proto__:null,edgeIsolatedVertices:edgeIsolatedVertices,faceIsolatedVertices:({vertices_coords:e,faces_vertices:t})=>{if(!e||!t)return[];let r=e.length;const s=Array(r).fill(!1);return t.forEach((e=>{e.filter((e=>!s[e])).forEach((e=>{s[e]=!0,r-=1}))})),s.map(((e,t)=>e?void 0:t)).filter((e=>void 0!==e))},isolatedVertices:isolatedVertices,removeIsolatedVertices:removeIsolatedVertices});const getOtherVerticesInEdges=({edges_vertices:e},t,r)=>r.map((r=>e[r][0]===t?e[r][1]:e[r][0])),isVertexCollinear=({vertices_coords:e,vertices_edges:t,edges_vertices:r},s,a=p)=>{if(!e||!r)return!1;t||(t=makeVerticesEdgesUnsorted({edges_vertices:r}));const o=t[s];if(void 0===o||2!==o.length)return!1;const c=getOtherVerticesInEdges({edges_vertices:r},s,o),[n,i,l]=[c[0],s,c[1]].map((t=>e[t]));return collinearBetween(n,i,l,!1,a)};var je=Object.freeze({__proto__:null,getOtherVerticesInEdges:getOtherVerticesInEdges,isVertexCollinear:isVertexCollinear});const getVerticesClusters=({vertices_coords:e},t=p)=>{if(!e)return[];const r=getDimensionQuick({vertices_coords:e}),s=Array.from(Array(r)),a=[];let o=0;const c=e.map(((e,t)=>({i:t,d:e[0]}))).sort(((e,t)=>e.d-t.d)).map((e=>e.i)).filter((()=>!0)),n=s.map((()=>[0,0])),isInsideCluster=t=>s.map(((r,s)=>e[t][s]>n[s][0]&&e[t][s]<n[s][1])).reduce(((e,t)=>e&&t),!0);let i=0;const updateRange=s=>{const a=s[s.length-1];for(;e[a][0]-e[s[i]][0]>t;)i+=1;const o=s.slice(i,s.length).map((t=>e[t]));n[0]=[o[0][0]-t,o[o.length-1][0]+t];for(let e=1;e<r;e+=1){const r=o.map((t=>t[e]));n[e]=[Math.min(...r)-t,Math.max(...r)+t]}};for(;o<e.length&&c.length;){const t=[],r=c.shift();t.push(r),o+=1,i=0,updateRange(t);let s=0;for(;s<c.length&&e[c[s]][0]<n[0][1];)if(isInsideCluster(c[s])){const e=c.splice(s,1).shift();t.push(e),o+=1,updateRange(t)}else s+=1;a.push(t)}return a};var we=Object.freeze({__proto__:null,getVerticesClusters:getVerticesClusters});const replace=(e,t,r)=>{Object.entries(r).map((([e,t])=>[parseInt(e,10),t])).filter((([e,t])=>e<t)).forEach((([e,t])=>{delete r[e],r[t]=e}));const s=Object.keys(r).map((e=>parseInt(e,10))),a=uniqueSortedNumbers(s),o=((e,t,r,s)=>{const a=count(e,t),o=[];for(let e=0,t=0,n=0;e<a;e+=1,t+=1){for(;e===s[n];){if(o[e]=o[r[s[n]]],void 0===o[e])throw new Error(c);e+=1,n+=1}e<a&&(o[e]=t)}return o})(e,t,r,a);return remapKey(e,t,o),o};var ke=Object.freeze({__proto__:null,replace:replace});const removeDuplicateVertices=(e,t=p,r=!0)=>{const s=[],a=[],o=getVerticesClusters(e,t).filter((e=>e.length>1));o.forEach((e=>{Math.min(...e)!==e[0]&&e.sort(((e,t)=>e-t));for(let t=1;t<e.length;t+=1)s[e[t]]=e[0],a.push(e[t])}));const c=getDimensionQuick(e);return r&&o.map((t=>t.map((t=>e.vertices_coords[t])))).map((e=>average(...e))).forEach((([t,r,s],a)=>{const n=2===c?[t,r]:[t,r,s];e.vertices_coords[o[a][0]]=n})),{map:replace(e,"vertices",s),remove:a}};var Fe=Object.freeze({__proto__:null,duplicateVertices:({vertices_coords:e},t)=>getVerticesClusters({vertices_coords:e},t).filter((e=>e.length>1)),removeDuplicateVertices:removeDuplicateVertices});const nearestPointOnLine=({vector:e,origin:t},r,s=clampLine,a=p)=>{const o=resize(e.length,t),c=resize(e.length,r),n=magSquared(e),i=subtract(c,o),l=s(dot(e,i)/n,a),[d,_,m]=add(o,scale$1(e,l));return 2===e.length?[d,_]:[d,_,m]};var Se=Object.freeze({__proto__:null,nearestPoint:(e,t)=>{const r=arrayMinimumIndex(e,(e=>distance(e,t)));return void 0===r?void 0:e[r]},nearestPoint2:(e,t)=>{const r=arrayMinimumIndex(e,(e=>distance2(e,t)));return void 0===r?void 0:e[r]},nearestPointOnCircle:({radius:e,origin:t},r)=>add2(t,scale2$1(normalize2(subtract2(r,t)),e)),nearestPointOnLine:nearestPointOnLine,nearestPointOnPolygon:(e,t)=>e.map(((e,t,r)=>subtract2(r[(t+1)%r.length],e))).map(((t,r)=>({vector:t,origin:e[r]}))).map((e=>nearestPointOnLine(e,t,clampSegment))).map(((e,r)=>({point:e,edge:r,distance:distance2(e,t)}))).sort(((e,t)=>e.distance-t.distance)).shift()});const connectedComponents=e=>{const t=[],recurse=(r,s)=>void 0!==t[r]?0:(t[r]=s,e[r].forEach((e=>recurse(e,s))),1);for(let t=0,r=0;t<e.length;t+=1)t in e&&(r+=recurse(t,r));return t},connectedComponentsPairs=e=>{const t=[],r=[];return e.forEach(((e,s)=>e.forEach((e=>{s<e&&t.push([s,e]),s!==e||r[s]||(r[s]=!0,t.push([s,e]))})))),t};var Ce=Object.freeze({__proto__:null,connectedComponents:connectedComponents,connectedComponentsPairs:connectedComponentsPairs});const edgeToLine2=({vertices_coords:e,edges_vertices:t},r)=>{const[s,a]=t[r].map((t=>e[t]));return{vector:subtract2(a,s),origin:resize2(s)}},edgesToLines2=({vertices_coords:e,edges_vertices:t})=>{const r=e.map(resize2);return t.map((e=>[r[e[0]],r[e[1]]])).map((([e,t])=>pointsToLine2(e,t)))},edgesToLines3=({vertices_coords:e,edges_vertices:t})=>{const r=e.map(resize3);return t.map((e=>[r[e[0]],r[e[1]]])).map((([e,t])=>pointsToLine3(e,t)))},getEdgesLine=({vertices_coords:e,edges_vertices:t},r=p)=>{if(!e||!t||!t.length)return{edges_line:[],lines:[]};const s=edgesToLines3({vertices_coords:e,edges_vertices:t}),a=s.map((e=>nearestPointOnLine(e,[0,0,0],clampLine))).map((e=>magnitude(e))),o=clusterScalars(a,r),c=o.map((e=>e.map((e=>s[e].vector)))).map((e=>clusterParallelVectors(e,.001))).map(((e,t)=>e.map((e=>e.map((e=>o[t][e])))))).map((o=>o.map((o=>{if(Math.abs(a[o[0]])<r)return[o];const c=s[o[0]].vector,n=o.map((r=>e[t[r][0]])).map((e=>projectPointOnPlane(e,c))),i=radialSortVectors3(n,c),compareFn=(e,t)=>epsilonEqualVectors(n[e],n[t],r),remap=e=>e.map((e=>i[e])).map((e=>o[e])),l=clusterSortedGeneric(i,compareFn);if(1===l.length)return l.map(remap);const d=l[0][0],_=l[l.length-1],m=[d,_[_.length-1]].map((e=>i[e]));if(compareFn(m[0],m[1])){const e=l.pop();l[0]=e.concat(l[0])}return l.map(remap)})))).flatMap((e=>e.flatMap((e=>e)))),n=invertArrayToFlatMap(c),i=c.map((e=>e.flatMap((e=>t[e])))).map(uniqueElements),l=c.map((e=>s[e[0]].vector)),d=i.map(((t,r)=>t.map((t=>dot(e[t],l[r]))))),_=d.map(((e,t)=>i[t][arrayMinimumIndex(e)])),m=d.map(((e,t)=>i[t][arrayMaximumIndex(e)])),g=i.map(((t,r)=>subtract(e[m[r]],e[_[r]]))),v=2===getDimensionQuick({vertices_coords:e})?g.map(resize2):g.map(resize3),u=_.map((t=>e[t])),h=v.map(((e,t)=>({vector:e,origin:u[t]})));return{lines:h,edges_line:n}};var Ve=Object.freeze({__proto__:null,edgeToLine2:edgeToLine2,edgesToLines:({vertices_coords:e,edges_vertices:t})=>t.map((t=>[e[t[0]],e[t[1]]])).map((([e,t])=>pointsToLine(e,t))),edgesToLines2:edgesToLines2,edgesToLines3:edgesToLines3,getEdgesLine:getEdgesLine,getEdgesLineBruteForce:({vertices_coords:e,edges_vertices:t},r=p)=>{if(!e||!t||!t.length)return{edges_line:[],lines:[]};const s=edgesToLines3({vertices_coords:e,edges_vertices:t}),a=s.map((()=>[]));s.forEach(((e,t)=>s.forEach(((s,o)=>{o<=t||collinearLines3(e,s,r)&&(a[t].push(o),a[o].push(t))}))));const o=connectedComponents(a),c=invertFlatToArrayMap(o),n=c.map((e=>e.flatMap((e=>t[e])))).map(uniqueElements),i=c.map((e=>s[e[0]].vector)),l=n.map(((t,r)=>t.map((t=>dot(e[t],i[r]))))),d=l.map(((e,t)=>n[t][arrayMinimumIndex(e)])),_=l.map(((e,t)=>n[t][arrayMaximumIndex(e)])),m=n.map(((t,r)=>subtract(e[_[r]],e[d[r]]))),g=2===getDimensionQuick({vertices_coords:e})?m.map(resize2):m.map(resize3),v=d.map((t=>e[t])),u=g.map(((e,t)=>({vector:e,origin:v[t]})));return{lines:u,edges_line:o}}});const duplicateEdges=({edges_vertices:e})=>{if(!e)return[];const t={},r=[];return e.map((e=>e[0]<e[1]?e:e.slice().reverse())).map((e=>e.join(" "))).forEach(((e,s)=>{void 0!==t[e]?r[s]=t[e]:t[e]=s})),r},removeDuplicateEdges=(e,t)=>{t||(t=duplicateEdges(e));const r=Object.keys(t).map((e=>parseInt(e,10))),s=replace(e,"edges",t);return r.length&&(e.vertices_edges||e.vertices_vertices||e.vertices_faces)&&(e.vertices_edges=makeVerticesEdgesUnsorted(e),e.vertices_vertices=makeVerticesVertices(e),e.vertices_edges=makeVerticesEdges(e),e.vertices_faces=makeVerticesFaces(e)),{map:s,remove:r}};var ze=Object.freeze({__proto__:null,duplicateEdges:duplicateEdges,getSimilarEdges:({vertices_coords:e,vertices_edges:t,edges_vertices:r},s=p)=>{const a=getVerticesClusters({vertices_coords:e},s),o=invertArrayToFlatMap(a),comparison=(e,t)=>{const[s,a]=r[e].map((e=>o[e])),[c,n]=r[t].map((e=>o[e]));return s===c&&a===n||s===n&&a===c};return sweepEdges({vertices_coords:e,vertices_edges:t,edges_vertices:r}).map((({start:e})=>e)).flatMap((e=>clusterUnsortedIndices(e,comparison)))},removeDuplicateEdges:removeDuplicateEdges});const circularEdges=({edges_vertices:e=[]})=>e.map(((e,t)=>e[0]===e[1]?t:void 0)).filter((e=>void 0!==e)),removeCircularEdges=(e,t)=>(t||(t=circularEdges(e)),t.length&&((e,t,r)=>{const s={};r.forEach((e=>{s[e]=!0})),filterKeysWithSuffix(e,t).forEach((t=>e[t].forEach(((r,a)=>{for(let o=r.length-1;o>=0;o-=1)!0===s[r[o]]&&e[t][a].splice(o,1)}))))})(e,"edges",t),{map:remove(e,"edges",t),remove:t});var Te=Object.freeze({__proto__:null,circularEdges:circularEdges,removeCircularEdges:removeCircularEdges});const planarize$2=({vertices_coords:e,edges_vertices:t,edges_assignment:r,edges_foldAngle:s},a=p)=>{const{lines:o,edges_line:c}=getEdgesLine({vertices_coords:e,edges_vertices:t},a),n=o.map((({vector:e})=>magSquared2(e))),i=invertFlatToArrayMap(c),l=t.map(((t,r)=>t.map((t=>e[t])).map((e=>dot2(subtract2(e,o[c[r]].origin),o[c[r]].vector))))),d=i.map((e=>e.flatMap((e=>l[e])))).map((e=>epsilonUniqueSortedNumbers(e,a))),_=((e,t=p)=>{const r=e.map((({vector:e,origin:t})=>({vector:resize2(e),origin:resize2(t)}))),s=r.map((()=>[]));for(let e=0;e<r.length-1;e+=1)for(let a=e+1;a<r.length;a+=1){const{a:o,b:c,point:n}=intersectLineLine(r[e],r[a],includeS,includeS,t);void 0!==n&&(s[e].push(o),s[a].push(c))}return s})(o,a).map((e=>epsilonUniqueSortedNumbers(e,a))).map(((e,t)=>e.map((e=>e*n[t])))).map(((e,t)=>setDifferenceSortedEpsilonNumbers(e,d[t],a))),m=i.map((e=>e.flatMap((e=>l[e])))),g=i.map((e=>invertFlatMap(e).map((e=>[2*e,2*e+1])))),v=i.map(((e,t)=>sweepValues({edges_vertices:g[t]},m[t],a))),u=v.map((e=>e.map((e=>e.t)))),h=v.map((e=>{const t={},r=e.map((e=>(e.start.forEach((e=>{t[e]=!0})),e.end.forEach((e=>{delete t[e]})),Object.keys(t).map((e=>parseInt(e,10))))));return r.pop(),r}));_.forEach(((e,t)=>{const r=u[t],s=h[t];let a=0,o=0;for(;a<e.length&&o<r.length-1;){if(e[a]<=r[o])throw new Error("bad algorithm");e[a]>r[o+1]?o+=1:(r.splice(o+1,0,e[a]),s.splice(o+1,0,s[o]),a+=1)}}));const b=u.flatMap(((e,t)=>e.map((e=>e/n[t])).map((e=>add2(o[t].origin,scale2$1(o[t].vector,e))))));let y=0;const E=h.map((e=>{const t=e.map((()=>[y,++y]));return y+=1,t})).flatMap(((e,t)=>e.filter(((e,r)=>h[t][r].length)))).map(resize2),M={vertices_coords:b,edges_vertices:E};if(r||s){const e=h.flatMap((e=>e.filter((e=>e.length))));r&&(M.edges_assignment=e.map((e=>r[e[0]]))),s&&(M.edges_foldAngle=e.map((e=>s[e[0]])))}removeIsolatedVertices(M,edgeIsolatedVertices(M)),removeDuplicateVertices(M,a),removeCircularEdges(M),M.vertices_edges=makeVerticesEdgesUnsorted(M);const A=M.vertices_edges.map(((e,t)=>2===e.length?t:void 0)).filter((e=>void 0!==e)).filter((e=>isVertexCollinear(M,e,a))).reverse(),x=A.map((e=>(({edges_vertices:e,vertices_edges:t},r)=>{const s=t[r].sort(((e,t)=>e-t)),a=s.flatMap((t=>e[t])).filter((e=>e!==r)),o=[a[0],a[1]];return e[s[0]]=o,e[s[1]]=void 0,o.forEach((e=>{const r=t[e].indexOf(s[1]);-1!==r&&(t[e][r]=s[0])})),s[1]})(M,e)));remove(M,"edges",x),remove(M,"vertices",A);const O=duplicateEdges(M);return O.length&&removeDuplicateEdges(M,O),circularEdges(M).length&&console.error("planarize: found circular edges"),delete M.vertices_edges,M},planarizeGraph=(e,t)=>{const r=planarize$2(e,t);r.vertices_vertices=makeVerticesVertices(r);const s=makePlanarFaces(r);return r.faces_vertices=s.faces_vertices,r.faces_edges=s.faces_edges,delete r.vertices_edges,r};var Pe=Object.freeze({__proto__:null,planarizeGraph:planarizeGraph});const disjointGraphsIndices=e=>{const t=e.edges_vertices||[],r=e.faces_vertices||[],s=e.vertices_edges?e.vertices_edges:makeVerticesEdgesUnsorted({edges_vertices:t}),a=e.vertices_vertices?e.vertices_vertices:makeVerticesVerticesUnsorted({vertices_edges:s,edges_vertices:t}),o=e.vertices_faces?e.vertices_faces:makeVerticesFacesUnsorted({vertices_edges:s,faces_vertices:r}),c=invertFlatToArrayMap(connectedComponents(a)),n=c.map((e=>e.flatMap((e=>s[e])))).map(uniqueElements),i=c.map((e=>e.flatMap((e=>o[e])))).map(uniqueElements);return Array.from(Array(c.length)).map(((e,t)=>({vertices:c[t]||[],edges:n[t]||[],faces:i[t]||[]})))},disjointGraphs=e=>{const t=disjointGraphsIndices(e),r=filterKeysWithPrefix(e,"vertices"),s=filterKeysWithPrefix(e,"edges"),a=filterKeysWithPrefix(e,"faces");return t.map((({vertices:t,edges:o,faces:c})=>{const n={};return r.forEach((r=>{n[r]=[],t.forEach((t=>{n[r][t]=e[r][t]}))})),s.forEach((t=>{n[t]=[],o.forEach((r=>{n[t][r]=e[t][r]}))})),a.forEach((t=>{n[t]=[],c.forEach((r=>{n[t][r]=e[t][r]}))})),n}))};var $e=Object.freeze({__proto__:null,disjointGraphs:disjointGraphs,disjointGraphsIndices:disjointGraphsIndices});const boundingBox=({vertices_coords:e},t)=>boundingBox$1(e,t),boundaryVertices=({edges_vertices:e,edges_assignment:t=[]})=>uniqueElements(e.filter(((e,r)=>K[t[r]])).flat()),boundary=({vertices_edges:e,edges_vertices:t,edges_assignment:r})=>{if(!r||!t)return{vertices:[],edges:[]};e||(e=makeVerticesEdgesUnsorted({edges_vertices:t}));const s=r.map((e=>"B"===e||"b"===e)),a={},o=[],c=[];let n=s.map(((e,t)=>e?t:void 0)).filter((e=>void 0!==e)).shift();if(void 0===n)return{vertices:[],edges:[]};s[n]=!1,c.push(n),o.push(t[n][0]),a[t[n][0]]=!0;let i=t[n][1];for(;!a[i];){if(o.push(i),a[i]=!0,n=e[i].filter((e=>s[e])).shift(),void 0===n)return{vertices:[],edges:[]};t[n][0]===i?[,i]=t[n]:[i]=t[n],c.push(n),s[n]=!1}return{vertices:o,edges:c}},boundaries$1=({vertices_edges:e,edges_vertices:t,edges_assignment:r})=>{if(!r||!t)return[{vertices:[],edges:[]}];e||(e=makeVerticesEdgesUnsorted({edges_vertices:t}));const s=[...t];r.map((e=>"B"===e||"b"===e)).map(((e,t)=>e?void 0:t)).filter((e=>void 0!==e)).forEach((e=>delete s[e]));const a=makeVerticesEdgesUnsorted({edges_vertices:s}),o=makeVerticesVerticesUnsorted({vertices_edges:a,edges_vertices:s}),c=connectedComponents(o),n=invertFlatToArrayMap(c).map((e=>e[0])),i=n.map((e=>(e=>{let t,r,s=e;const a=[],filterFunc=e=>e!==t;for(;;){if(o[s]=o[s].filter(filterFunc),r=o[s].shift(),void 0===r)return a;a.push(s),t=s,s=r}})(e))),l=makeVerticesToEdge({edges_vertices:s}),d=i.map((e=>e.map(((e,t,r)=>[e,r[(t+1)%r.length]])).map((e=>l[e.join(" ")]))));return i.map(((e,t)=>({vertices:e,edges:d[t]})))},planarBoundary=({vertices_coords:e,vertices_edges:t,vertices_vertices:r,edges_vertices:s})=>{r||(r=makeVerticesVertices2D({vertices_coords:e,vertices_edges:t,edges_vertices:s}));const a=makeVerticesToEdge({edges_vertices:s}),o=[],c=[],n={vertices:c,edges:o};let i=-1/0,l=-1;if(e.forEach(((e,t)=>{e[0]>i&&(i=e[0],l=t)})),-1===l)return n;c.push(l);const d=e[l],_=r[l];if(!_)return n;const m=_.map((t=>e[t])).map((e=>[e[0]-d[0],e[1]-d[1]])).map((e=>Math.atan2(e[1],e[0]))).map((e=>e<0?e+2*Math.PI:e)).map(((e,t)=>({a:e,i:t}))).sort(((e,t)=>e.a-t.a)).shift().i,g=_[m],v=a[l<g?`${l} ${g}`:`${g} ${l}`];o.push(v);let p=l,u=g;const h={[`${p} ${u}`]:!0};for(;;){const e=r[u],t=e.indexOf(p),s=e[(t+1)%e.length],i=a[u<s?`${u} ${s}`:`${s} ${u}`];if(h[`${u} ${s}`])return i!==o[0]&&console.warn("bad boundary"),n;h[`${u} ${s}`]=!0,c.push(u),o.push(i),p=u,u=s}},planarBoundaries=({vertices_coords:e,vertices_edges:t,vertices_vertices:r,edges_vertices:s})=>(r||(r=makeVerticesVertices2D({vertices_coords:e,vertices_edges:t,edges_vertices:s})),disjointGraphs({vertices_coords:e,vertices_vertices:r,edges_vertices:s}).map(planarBoundary));var Be=Object.freeze({__proto__:null,boundaries:boundaries$1,boundary:boundary,boundaryPolygon:({vertices_coords:e,vertices_edges:t,edges_vertices:r,edges_assignment:s})=>boundary({vertices_edges:t,edges_vertices:r,edges_assignment:s}).vertices.map((t=>e[t])),boundaryPolygons:({vertices_coords:e,vertices_edges:t,edges_vertices:r,edges_assignment:s})=>boundaries$1({vertices_edges:t,edges_vertices:r,edges_assignment:s}).map((({vertices:t})=>t.map((t=>e[t])))),boundaryVertices:boundaryVertices,boundingBox:boundingBox,planarBoundaries:planarBoundaries,planarBoundary:planarBoundary});const shortestEdgeLength=({vertices_coords:e,edges_vertices:t})=>{const r=t.map((t=>t.map((t=>e[t])))).map((([e,t])=>distance(e,t))).filter((e=>e>1e-4)).reduce(((e,t)=>Math.min(e,t)),1/0);return r===1/0?void 0:r},makeEpsilon=({vertices_coords:e,edges_vertices:t})=>{const r=shortestEdgeLength({vertices_coords:e,edges_vertices:t});if(r)return Math.max(1e-4*r,1e-10);const s=boundingBox({vertices_coords:e});return s&&s.span?Math.max(1e-6*Math.max(...s.span),1e-10):1e-6},countPlaces=function(e){const t=`${e}`.match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return Math.max(0,(t[1]?t[1].length:0)-(t[2]?+t[2]:0))},cleanNumber=function(e,t=15){const r="number"==typeof e?e:parseFloat(e);if(Number.isNaN(r))return e;const s=parseFloat(r.toFixed(t));return countPlaces(s)===Math.min(t,countPlaces(r))?r:s};var Ne=Object.freeze({__proto__:null,cleanNumber:cleanNumber});const findEpsilonInObject=(e,t,r="epsilon")=>"object"==typeof t&&"number"==typeof t[r]?t[r]:"number"==typeof t?t:(({vertices_coords:e,edges_vertices:t})=>{const r=shortestEdgeLength({vertices_coords:e,edges_vertices:t}),s=boundingBox({vertices_coords:e}),a=.01*(s&&s.span?Math.max(...s.span):1),o=r/20;return void 0===r?a:Math.min(a,o)})(e),invertVertical=e=>{const t=boundingBox({vertices_coords:e}),r=t.min[1]+t.span[1]/2,s=Math.min(-t.min[1],-t.max[1]),a=Math.max(-t.min[1],-t.max[1]),o=cleanNumber(r-(s+(a-s)/2),8);for(let t=0;t<e.length;t+=1)e[t][1]=-e[t][1]+o};var Re=Object.freeze({__proto__:null,findEpsilonInObject:findEpsilonInObject,invertVertical:invertVertical});const xmlStringToDocument=(e,t="text/xml")=>(new(RabbitEarWindow$1().DOMParser)).parseFromString(e,t),getContainingValue=(e,t)=>null==e?null:Array.from(e.childNodes).filter((e=>e.attributes&&e.attributes.length)).filter((e=>void 0!==Array.from(e.attributes).filter((e=>e.nodeValue===t)).shift())).shift(),parseOriLineProxy=e=>Array.from(e.childNodes).filter((e=>"void"===e.nodeName)).filter((e=>e.childNodes)).map((e=>getContainingValue(e,"oripa.OriLineProxy"))).filter((e=>e)).map((e=>["type","x0","x1","y0","y1"].map((t=>getContainingValue(e,t))).map((e=>e?Array.from(e.childNodes):[])).map((e=>e.filter((e=>"double"===e.nodeName||"int"===e.nodeName)).shift())).map((e=>e&&e.childNodes[0]&&"data"in e.childNodes[0]?e.childNodes[0].data:"0")).map(parseFloat))),Le=["F","B","M","V","U"],makeLineGraph=e=>{const t=e.flatMap((e=>[[e[1],e[3]],[e[2],e[4]]])),r=e.map(((e,t)=>[2*t,2*t+1])),s=e.map((e=>Le[e[0]]));return{vertices_coords:t,edges_vertices:r,edges_assignment:s,edges_foldAngle:makeEdgesFoldAngle({edges_assignment:s})}};var Ie=Object.freeze({__proto__:null,opxEdgeGraph:e=>{const t=xmlStringToDocument(e,"text/xml"),r=Array.from(t.getElementsByClassName("oripa.OriLineProxy")).filter((e=>"array"===e.nodeName||"array"===e.tagName)).shift(),s=parseOriLineProxy(r);return makeLineGraph(s)},opxToFold:(e,t)=>{const r=xmlStringToDocument(e,"text/xml"),s=Array.from(r.getElementsByClassName("oripa.OriLineProxy")).filter((e=>"array"===e.nodeName||"array"===e.tagName)).shift();if(void 0===Array.from(r.getElementsByClassName("oripa.DataSet")).filter((e=>"object"===e.nodeName||"object"===e.tagName)).shift()||void 0===s)return;const a=parseOriLineProxy(s),o=(e=>{const t=Array.from(e.getElementsByTagName("string")).map((e=>Array.from(e.childNodes).map((e=>e.nodeValue)).filter((e=>""!==e)).shift())),r=t.indexOf("title"),s=t.indexOf("editorName"),a=t.indexOf("originalAuthorName"),o=t.indexOf("reference"),c=t.indexOf("memo"),n={file_spec:1.2,file_creator:"Rabbit Ear",file_classes:["singleModel"],frame_classes:["creasePattern"]},i=[],l=[];return-1!==r&&t[r+1]&&(n.file_title=t[r+1]),-1!==s&&t[s+1]&&i.push(t[s+1]),-1!==a&&t[a+1]&&i.push(t[a+1]),-1!==o&&t[o+1]&&l.push(t[o+1]),-1!==c&&t[c+1]&&l.push(t[c+1]),i.length&&(n.file_author=i.join(", ")),l.length&&(n.file_description=l.join(", ")),n})(r),c=makeLineGraph(a);t&&"object"==typeof t&&t.invertVertical&&c.vertices_coords&&invertVertical(c.vertices_coords);const n=findEpsilonInObject(c,t);return{...o,...planarizeGraph(c,n)}}});const Ue={black:"#000000",silver:"#c0c0c0",gray:"#808080",white:"#ffffff",maroon:"#800000",red:"#ff0000",purple:"#800080",fuchsia:"#ff00ff",green:"#008000",lime:"#00ff00",olive:"#808000",yellow:"#ffff00",navy:"#000080",blue:"#0000ff",teal:"#008080",aqua:"#00ffff",orange:"#ffa500",aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",blanchedalmond:"#ffebcd",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",oldlace:"#fdf5e6",olivedrab:"#6b8e23",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",whitesmoke:"#f5f5f5",yellowgreen:"#9acd32"},hslToRgb=(e,t,r,s)=>{const a=r/100,k=t=>(t+e/30)%12,o=t/100*Math.min(a,1-a),f=e=>a-o*Math.max(-1,Math.min(k(e)-3,Math.min(9-k(e),1)));return void 0===s?[255*f(0),255*f(8),255*f(4)]:[255*f(0),255*f(8),255*f(4),s]},mapHexNumbers=(e,t)=>{const r=Array.from(Array(t.length)).map(((t,r)=>e[r]||"0"));return e.length<=4?t.map((e=>r[e])).join(""):r.join("")},hexToRgb=e=>{const t=e.replace(/#(?=\S)/g,""),r=4===t.length||8===t.length,s=mapHexNumbers(t,r?[0,0,1,1,2,2,3,3]:[0,0,1,1,2,2]),a=parseInt(s,16);return r?[a>>24&255,a>>16&255,a>>8&255,(o=(255&a)/256,Math.round(100*o)/100)]:[a>>16&255,a>>8&255,255&a];var o},rgbToHex=(e,t,r,s)=>{const to16=e=>`00${Math.max(0,Math.min(Math.round(e),255)).toString(16)}`.slice(-2),a=`#${[e,t,r].map(to16).join("")}`;return void 0===s?a:`${a}${to16(255*s)}`};var De=Object.freeze({__proto__:null,hexToRgb:hexToRgb,hslToRgb:hslToRgb,rgbToHex:rgbToHex});const getParenNumbers=e=>{const t=e.match(/\(([^\)]+)\)/g);return null!=t&&t.length?t[0].substring(1,t[0].length-1).split(/[\s,]+/).map(parseFloat):[]},parseColorToRgb=e=>{if(Ue[e])return hexToRgb(Ue[e]);if("#"===e[0])return hexToRgb(e);if("rgba"===e.substring(0,4)||"rgb"===e.substring(0,3)){const t=getParenNumbers(e);return[0,1,2].filter((e=>void 0===t[e])).forEach((e=>{t[e]=0})),t}if("hsla"===e.substring(0,4)||"hsl"===e.substring(0,3)){const t=getParenNumbers(e);return[0,1,2].filter((e=>void 0===t[e])).forEach((e=>{t[e]=0})),hslToRgb(t[0],t[1],t[2],t[3])}},parseColorToHex=e=>{if(Ue[e])return Ue[e].toUpperCase();if("#"===e[0]){const[t,r,s,a]=hexToRgb(e);return rgbToHex(t,r,s,a)}if("rgba"===e.substring(0,4)||"rgb"===e.substring(0,3)){const[t,r,s,a]=getParenNumbers(e);return rgbToHex(t,r,s,a)}if("hsla"===e.substring(0,4)||"hsl"===e.substring(0,3)){const t=getParenNumbers(e);[0,1,2].filter((e=>void 0===t[e])).forEach((e=>{t[e]=0}));const[r,s,a,o]=t,[c,n,i]=hslToRgb(r,s,a,o);return rgbToHex(c,n,i,o)}};var Qe=Object.freeze({__proto__:null,parseColorToHex:parseColorToHex,parseColorToRgb:parseColorToRgb});const We="object"==typeof window&&"object"==typeof window.document;"object"==typeof process&&"object"==typeof process.versions&&(null!=process.versions.node||process.versions.bun);const qe="window not set; svg.window = @xmldom/xmldom",Ge={window:void 0};We&&(Ge.window=window);const RabbitEarWindow=()=>{if(void 0===Ge.window)throw new Error(qe);return Ge.window},svg_add2=(e,t)=>[e[0]+t[0],e[1]+t[1]],svg_sub2=(e,t)=>[e[0]-t[0],e[1]-t[1]],svg_scale2=(e,t)=>[e[0]*t,e[1]*t],svg_magnitudeSq2=e=>e[0]**2+e[1]**2,svg_magnitude2=e=>Math.sqrt(svg_magnitudeSq2(e)),svg_distanceSq2=(e,t)=>svg_magnitudeSq2(svg_sub2(e,t)),svg_distance2=(e,t)=>Math.sqrt(svg_distanceSq2(e,t)),svg_polar_to_cart=(e,t)=>[Math.cos(e)*t,Math.sin(e)*t],svg_multiplyMatrices2=(e,t)=>[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]];var He=Object.freeze({__proto__:null,svg_add2:svg_add2,svg_distance2:svg_distance2,svg_distanceSq2:svg_distanceSq2,svg_magnitude2:svg_magnitude2,svg_magnitudeSq2:svg_magnitudeSq2,svg_multiplyMatrices2:svg_multiplyMatrices2,svg_polar_to_cart:svg_polar_to_cart,svg_scale2:svg_scale2,svg_sub2:svg_sub2});const parseTransform=e=>{const t=e.match(/(\w+\((\-?\d+\.?\d*e?\-?\d*,?\s*)+\))+/g);if(!t)return[];return t.map((e=>e.match(/[\w\.\-]+/g))).map((e=>({transform:e.shift(),parameters:e.map((e=>parseFloat(e)))})))},matrixForm=function(e,t){switch(e){case"translate":return function(e){switch(e.length){case 1:return[1,0,0,1,e[0],0];case 2:return[1,0,0,1,e[0],e[1]];default:console.warn(`improper translate, ${e}`)}}(t);case"rotate":return function(e){const t=Math.cos(e[0]/(180*Math.PI)),r=Math.sin(e[0]/(180*Math.PI));switch(e.length){case 1:return[t,r,-r,t,0,0];case 3:return[t,r,-r,t,-e[1]*t+e[2]*r+e[1],-e[1]*r-e[2]*t+e[2]];default:console.warn(`improper rotate, ${e}`)}}(t);case"scale":return function(e){switch(e.length){case 1:return[e[0],0,0,e[0],0,0];case 2:return[e[0],0,0,e[1],0,0];default:console.warn(`improper scale, ${e}`)}}(t);case"skewX":return function(e){return[1,0,Math.tan(e[0]/(180*Math.PI)),1,0,0]}(t);case"skewY":return function(e){return[1,Math.tan(e[0]/(180*Math.PI)),0,1,0,0]}(t);case"matrix":return t;default:console.warn(`unknown transform type ${e}`)}},transformStringToMatrix=function(e){return parseTransform(e).map((e=>matrixForm(e.transform,e.parameters))).filter((e=>void 0!==e)).reduce(((e,t)=>svg_multiplyMatrices2(e,t)),[1,0,0,1,0,0])};var Je=Object.freeze({__proto__:null,parseTransform:parseTransform,transformStringToMatrix:transformStringToMatrix});const xmlStringToElement=(e,t="text/xml")=>{const r=(new(RabbitEarWindow().DOMParser)).parseFromString(e,t);return r?r.documentElement:null},getRootParent=e=>{let t=e;for(;t&&null!=t.parentElement;)t=t.parentElement;return t},findElementTypeInParents=(e,t)=>{if((e.nodeName||"")===t)return e;const r=e.parentElement;return r?findElementTypeInParents(r,t):null},addClass=(e,...t)=>{if(e&&t.length)return e.classList?e.classList.add(...t):((e,...t)=>{const r={},s=e.getAttribute("class"),a=s?s.split(" "):[];a.push(...t),a.forEach((e=>{r[e]=!0}));const o=Object.keys(r).join(" ");e.setAttribute("class",o)})(e,...t)},flattenDomTree=e=>null!=e.childNodes&&e.childNodes.length?Array.from(e.childNodes).flatMap((e=>flattenDomTree(e))):[e],Ze={svg:["viewBox","xmlns","version"],line:["x1","y1","x2","y2"],rect:["x","y","width","height"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],polygon:["points"],polyline:["points"],path:["d"]},attrAssign=(e,t)=>{const r=(e=>{const t={};return e.forEach((e=>{t[e.nodeName]=e.value})),t})((e=>{const t=e.attributes;if(null==t)return[];const r=Array.from(t);return Ze[e.nodeName]?r.filter((t=>!Ze[e.nodeName].includes(t.name))):r})(t));if(!r.transform&&!e.transform)return{...e,...r};const s=r.transform||"",a=e.transform||"",o=transformStringToMatrix(s),c=transformStringToMatrix(a),n=`matrix(${svg_multiplyMatrices2(c,o).join(", ")})`;return{...e,...r,transform:n}},flattenDomTreeWithStyle=(e,t={})=>null!=e.childNodes&&e.childNodes.length?Array.from(e.childNodes).flatMap((e=>flattenDomTreeWithStyle(e,attrAssign(t,e)))):[{element:e,attributes:t}];var Ye=Object.freeze({__proto__:null,addClass:addClass,findElementTypeInParents:findElementTypeInParents,flattenDomTree:flattenDomTree,flattenDomTreeWithStyle:flattenDomTreeWithStyle,getRootParent:getRootParent,xmlStringToElement:xmlStringToElement});const invisibleParent=e=>{if(!RabbitEarWindow$1().document.body)return;const t=RabbitEarWindow$1().document.createElement("div");return t.setAttribute("display","none"),RabbitEarWindow$1().document.body.appendChild(t),t.appendChild(e),t};var Xe=Object.freeze({__proto__:null,invisibleParent:invisibleParent});const Ke={B:"black",M:"crimson",V:"royalblue",F:"lightgray",J:"gold",C:"limegreen",U:"orchid"};Object.keys(Ke).forEach((e=>{Ke[e.toLowerCase()]=Ke[e]}));const et={M:[1,0,0],V:[0,0,1],J:[1,1,0],U:[1,0,1],C:[0,1,0]},rgbToAssignment=(e=0,t=0,r=0)=>{const s=scale3$1([e,t,r],1/255),a=magnitude3(s);if(a<.05)return"B";const o=s.reduce(((e,t)=>e+t),0)/3,c=distance3(s,[o,o,o]),n=Object.keys(et).map((e=>({key:e,dist:distance3(s,et[e])}))).sort(((e,t)=>e.dist-t.dist)).shift();return n.dist<4*c?n.key:a<.1?"B":"F"};var tt=Object.freeze({__proto__:null,assignmentColor:Ke,rgbToAssignment:rgbToAssignment});const colorToAssignment=(e,t)=>{const r=parseColorToHex(e).toUpperCase();return t&&t[r]?t[r]:rgbToAssignment(...parseColorToRgb(e))},opacityToFoldAngle=(e,t)=>{switch(t){case"M":case"m":return-180*e;case"V":case"v":return 180*e;default:return 0}},getEdgeStroke=(e,t)=>{const r=null!=RabbitEarWindow$1().getComputedStyle?RabbitEarWindow$1().getComputedStyle(e).stroke:"";return""!==r&&"none"!==r?r:void 0!==t.stroke?t.stroke:void 0},getEdgeOpacity=(e,t)=>{const r=null!=RabbitEarWindow$1().getComputedStyle?RabbitEarWindow$1().getComputedStyle(e).opacity:"";if(""!==r){const e=parseFloat(r);if(!Number.isNaN(e))return e}if(void 0!==t.opacity){const e=parseFloat(t.opacity);if(!Number.isNaN(e))return e}};var rt=Object.freeze({__proto__:null,colorToAssignment:colorToAssignment,getEdgeOpacity:getEdgeOpacity,getEdgeStroke:getEdgeStroke,opacityToFoldAngle:opacityToFoldAngle});const st=/[MmLlSsQqLlHhVvCcSsQqTtAaZz]/g,at=/-?[0-9]*\.?\d+/g,ot={m:"move",l:"line",v:"vertical",h:"horizontal",a:"ellipse",c:"curve",s:"smoothCurve",q:"quadCurve",t:"smoothQuadCurve",z:"close"};Object.keys(ot).forEach((e=>{const t=ot[e];ot[e.toUpperCase()]=t.charAt(0).toUpperCase()+t.slice(1)}));const add2path=(e,t)=>[e[0]+(t[0]||0),e[1]+(t[1]||0)],parsePathCommands=e=>{const t=[];let r=st.exec(e);for(;null!==r;)t.push(r),r=st.exec(e);return t.map(((t,r,s)=>({command:t[0],start:t.index,end:r===s.length-1?e.length-1:s[(r+1)%s.length].index-1}))).map((({command:t,start:r,end:s})=>{const a=e.substring(r+1,s+1).match(at);return{command:t,values:a?a.map(parseFloat):[]}}))},parsePathCommandsWithEndpoints=e=>{let t=[0,0];const r=parsePathCommands(e).map((e=>({...e,end:void 0,start:void 0})));if(!r.length)return r;r.forEach(((e,s)=>{r[s].end=((e,t,r=[0,0])=>{const s=e.toUpperCase();let a=e===s?[0,0]:r;switch("V"===e&&(a=[r[0],0]),"H"===e&&(a=[0,r[1]]),s){case"V":return add2path(a,[0,t[0]]);case"H":return add2path(a,[t[0],0]);case"M":case"L":case"T":return add2path(a,t);case"A":return add2path(a,[t[5],t[6]]);case"C":return add2path(a,[t[4],t[5]]);case"S":case"Q":return add2path(a,[t[2],t[3]]);case"Z":return;default:return a}})(e.command,e.values,t),r[s].start=0===s?t:r[s-1].end,t=r[s].end}));const s=r[r.length-1],a=r.filter((e=>"M"!==e.command.toUpperCase()&&"Z"!==e.command.toUpperCase())).shift();return"Z"===s.command.toUpperCase()&&(s.end=[...a.start]),r};var ct=Object.freeze({__proto__:null,parsePathCommands:parsePathCommands,parsePathCommandsWithEndpoints:parsePathCommandsWithEndpoints,pathCommandNames:ot});const nt={L:!0,V:!0,H:!0,Z:!0},getAttributesFloatValue=(e,t)=>t.map((t=>e.getAttribute(t))).map((e=>null==e?0:e)).map(parseFloat),lineToSegments=e=>{const[t,r,s,a]=getAttributesFloatValue(e,["x1","y1","x2","y2"]);return[[t,r,s,a]]},pathToSegments=e=>parsePathCommandsWithEndpoints(e.getAttribute("d")||"").filter((e=>nt[e.command.toUpperCase()])).map((e=>[e.start,e.end])).filter((([e,t])=>!epsilonEqualVectors(e,t))).map((([e,t])=>[e[0],e[1],t[0],t[1]])),polygonToSegments=e=>(e=>{const t=e.split(/[\s,]+/).map(parseFloat);return Array.from(Array(Math.floor(t.length/2))).map(((e,r)=>[t[2*r+0],t[2*r+1]]))})(e.getAttribute("points")||"").map(((e,t,r)=>[r[t][0],r[t][1],r[(t+1)%r.length][0],r[(t+1)%r.length][1]])),polylineToSegments=function(e){const t=polygonToSegments(e);return t.pop(),t},rectToSegments=function(e){const[t,r,s,a]=getAttributesFloatValue(e,["x","y","width","height"]);return[[t,r,t+s,r],[t+s,r,t+s,r+a],[t+s,r+a,t,r+a],[t,r+a,t,r]]};var it=Object.freeze({__proto__:null,lineToSegments:lineToSegments,pathToSegments:pathToSegments,polygonToSegments:polygonToSegments,polylineToSegments:polylineToSegments,rectToSegments:rectToSegments});const lt={line:lineToSegments,rect:rectToSegments,polygon:polygonToSegments,polyline:polylineToSegments,path:pathToSegments},flatSegments=e=>flattenDomTreeWithStyle(e).filter((e=>lt[e.element.nodeName])).flatMap((e=>lt[e.element.nodeName](e.element).map((t=>((e,t)=>{const r=[[e[0],e[1]],[e[2],e[3]]];if(!t)return r;const s=transformStringToMatrix(t);return s?r.map((e=>multiplyMatrix2Vector2(s,e))):r})(t,e.attributes.transform))).map((t=>({...e,segment:t}))))),svgSegments=e=>{const t="string"==typeof e?xmlStringToElement(e,"image/svg+xml"):e;(e=>flattenDomTree(e).map((e=>"style"===e.nodeName)).reduce(((e,t)=>e||t),!1))(t)&&s&&console.warn(m);const r=getRootParent(t)===RabbitEarWindow$1().document?void 0:invisibleParent(t),a=flatSegments(t),o=a.map((e=>({data:{assignment:e.attributes["data-assignment"],foldAngle:e.attributes["data-foldAngle"]},stroke:getEdgeStroke(e.element,e.attributes),opacity:getEdgeOpacity(e.element,e.attributes)}))).map(((e,t)=>({...a[t],...e})));return r&&r.parentNode&&r.parentNode.removeChild(r),o},makeAssignmentFoldAngle=(e,t)=>{const r=(e=>{if(!e||!e.assignments)return;const t={};return Object.keys(e.assignments).forEach((r=>{const s=parseColorToHex(r).toUpperCase();t[s]=e.assignments[r]})),t})(t);r&&e.forEach((e=>{delete e.data.assignment,delete e.data.foldAngle}));const s=e.map((e=>((e,t="#f0f",r)=>e||colorToAssignment(t,r))(e.data.assignment,e.stroke,r))),a=e.map(((e,t)=>((e,t=1,r)=>e?parseFloat(e):opacityToFoldAngle(t,r))(e.data.foldAngle,e.opacity,s[t])));return{edges_assignment:s,edges_foldAngle:a}},passthrough=e=>e,svgEdgeGraph=(e,t)=>{const r=svgSegments(e),{edges_assignment:s,edges_foldAngle:a}=makeAssignmentFoldAngle(r,t),o=t&&t.fast?passthrough:cleanNumber;return{vertices_coords:r.flatMap((e=>e.segment)).map((([e,t])=>[o(e,12),o(t,12)])),edges_vertices:r.map(((e,t)=>[2*t,2*t+1])),edges_assignment:s,edges_foldAngle:a}};var ft=Object.freeze({__proto__:null,svgEdgeGraph:svgEdgeGraph,svgSegments:svgSegments,svgToFold:(e,t)=>{const r=svgEdgeGraph(e,t),s=findEpsilonInObject(r,t);t&&t.invertVertical&&r.vertices_coords&&invertVertical(r.vertices_coords);const a=planarizeGraph(r,s),o=t&&t.fast?passthrough:cleanNumber;if(a.vertices_coords=a.vertices_coords.map((e=>e.map((e=>o(e,12))))).map(resize2),"object"!=typeof t||!1!==t.boundary){a.edges_assignment.map(((e,t)=>t)).filter((e=>"B"===a.edges_assignment[e]||"b"===a.edges_assignment[e])).forEach((e=>{a.edges_assignment[e]="F"}));const{edges:e}=planarBoundary(a);e.forEach((e=>{a.edges_assignment[e]="B"}))}return{file_spec:1.2,file_creator:I,frame_classes:["creasePattern"],...a}}});const dt="http://www.w3.org/2000/svg",_t={presentation:["color","color-interpolation","cursor","direction","display","fill","fill-opacity","fill-rule","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","image-rendering","letter-spacing","opacity","overflow","paint-order","pointer-events","preserveAspectRatio","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tabindex","transform-origin","user-select","vector-effect","visibility"],animation:["accumulate","additive","attributeName","begin","by","calcMode","dur","end","from","keyPoints","keySplines","keyTimes","max","min","repeatCount","repeatDur","restart","to","values"],effects:["azimuth","baseFrequency","bias","color-interpolation-filters","diffuseConstant","divisor","edgeMode","elevation","exponent","filter","filterRes","filterUnits","flood-color","flood-opacity","in","in2","intercept","k1","k2","k3","k4","kernelMatrix","lighting-color","limitingConeAngle","mode","numOctaves","operator","order","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","primitiveUnits","radius","result","seed","specularConstant","specularExponent","stdDeviation","stitchTiles","surfaceScale","targetX","targetY","type","xChannelSelector","yChannelSelector"],text:["dx","dy","alignment-baseline","baseline-shift","dominant-baseline","lengthAdjust","method","overline-position","overline-thickness","rotate","spacing","startOffset","strikethrough-position","strikethrough-thickness","text-anchor","text-decoration","text-rendering","textLength","underline-position","underline-thickness","word-spacing","writing-mode"],gradient:["gradientTransform","gradientUnits","spreadMethod"]},mt={svg:["svg"],defs:["defs"],header:["desc","filter","metadata","style","script","title","view"],cdata:["cdata"],group:["g"],visible:["circle","ellipse","line","path","polygon","polyline","rect","arc","arrow","curve","parabola","roundRect","wedge","origami"],text:["text"],invisible:["marker","symbol","clipPath","mask"],patterns:["linearGradient","radialGradient","pattern"],childrenOfText:["textPath","tspan"],gradients:["stop"],filter:["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]},gt="class",vt="function",pt="number",ut="string",ht="object",bt="svg",yt="path",Et="id",Mt="style",At="viewBox",xt="transform",Ot="points",jt="stroke",wt="none",kt="arrow",Ft="head",St="tail",Ct={svg:[At],line:["x1","y1","x2","y2"],rect:["x","y","width","height"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],polygon:[Ot],polyline:[Ot],path:["d"],text:["x","y"],mask:[Et],symbol:[Et],clipPath:[Et,"clip-rule"],marker:[Et,"markerHeight","markerUnits","markerWidth","orient","refX","refY"],linearGradient:["x1","x2","y1","y2"],radialGradient:["cx","cy","r","fr","fx","fy"],stop:["offset","stop-color","stop-opacity"],pattern:["patternContentUnits","patternTransform","patternUnits"]};[{nodes:[bt,"defs","g"].concat(mt.visible,mt.text),attr:_t.presentation},{nodes:["filter"],attr:_t.effects},{nodes:mt.childrenOfText.concat("text"),attr:_t.text},{nodes:mt.filter,attr:_t.effects},{nodes:mt.gradients,attr:_t.gradient}].forEach((e=>e.nodes.forEach((t=>{Ct[t]||(Ct[t]=[]),Ct[t].push(...e.attr)}))));const Vt=[mt.header,mt.invisible,mt.patterns].flat(),zt=[mt.group,mt.visible,mt.text].flat(),Tt={svg:[["svg","defs"],Vt,zt].flat(),defs:Vt,filter:mt.filter,g:zt,text:mt.childrenOfText,marker:zt,symbol:zt,clipPath:zt,mask:zt,linearGradient:mt.gradients,radialGradient:mt.gradients},Pt={cssColors:Ue,...De,...Qe},makeCDATASection=e=>(new(RabbitEarWindow().DOMParser)).parseFromString("<root></root>","text/xml").createCDATASection(e);const makeCoordinates=(...e)=>e.filter((e=>typeof e===pt)).concat(e.filter((e=>typeof e===ht&&null!==e)).map((e=>typeof e.x===pt?[e.x,e.y]:typeof e[0]===pt?[e[0],e[1]]:void 0)).filter((e=>void 0!==e)).reduce(((e,t)=>e.concat(t)),[])),makeViewBox=(...e)=>{const t=makeCoordinates(...e.flat());return 2===t.length&&t.unshift(0,0),4===t.length?function(e,t,r,s,a=0){const o=r/1-r;return[e-o-a,t-o-a,r+2*o+2*a,s+2*o+2*a].join(" ")}(t[0],t[1],t[2],t[3]):void 0},setViewBox=(e,...t)=>{const r=1===t.length&&typeof t[0]===ut?t[0]:makeViewBox(...t);return r&&e.setAttribute(At,r),e},getViewBox$1=function(e){const t=e.getAttribute(At);return null==t?void 0:t.split(" ").map((e=>parseFloat(e)))},convertToViewBox=function(e,t,r){const s=e.createSVGPoint();s.x=t,s.y=r;const a=s.matrixTransform(e.getScreenCTM().inverse());return[a.x,a.y]};const $t={...He,...Ye,...Object.freeze({__proto__:null,makeCDATASection:makeCDATASection}),...ct,...Je,...Object.freeze({__proto__:null,convertToViewBox:convertToViewBox,foldToViewBox:({vertices_coords:e})=>{if(!e)return;const t=[1/0,1/0],r=[-1/0,-1/0];return e.forEach((e=>[0,1].forEach((s=>{t[s]=Math.min(e[s],t[s]),r[s]=Math.max(e[s],r[s])})))),[t[0],t[1],r[0]-t[0],r[1]-t[1]].join(" ")},getViewBox:getViewBox$1,setViewBox:setViewBox})},getSVGFrame=function(e){const t=getViewBox$1(e);if(void 0!==t)return t;if(typeof e.getBoundingClientRect===vt){const t=e.getBoundingClientRect();return[t.x,t.y,t.width,t.height]}return[]},Bt="svg-background-rectangle",getAttr=e=>{const t=e.getAttribute(xt);return null==t||""===t?void 0:t},Nt={clearTransform:e=>(e.removeAttribute(xt),e)};["translate","rotate","scale","matrix"].forEach((e=>{Nt[e]=(t,...r)=>(t.setAttribute(xt,[getAttr(t),`${e}(${r.join(" ")})`].filter((e=>void 0!==e)).join(" ")),t)}));const makeUUID=()=>Math.random().toString(36).replace(/[^a-z]+/g,"").concat("aaaaa").substring(0,5),toCamel$1=e=>e.replace(/([-_][a-z])/gi,(e=>e.toUpperCase().replace("-","").replace("_",""))),removeChildren=e=>{for(;e.lastChild;)e.removeChild(e.lastChild);return e},appendTo=(e,t)=>(t&&t.appendChild&&t.appendChild(e),e),setAttributes=(e,t)=>(Object.keys(t).forEach((r=>e.setAttribute(r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z])([A-Z])(?=[a-z])/g,"$1-$2").toLowerCase(),t[r]))),e);var Rt=Object.freeze({__proto__:null,appendTo:appendTo,removeChildren:removeChildren,setAttributes:setAttributes});const stylesheet$1=function(e,t){let r=function(e,t){const r=e.getElementsByTagName(t);return r.length?r[0]:null}(e,Mt);return null==r&&(r=RabbitEarWindow().document.createElementNS(dt,Mt),r.setTextContent=e=>(r.textContent="",r.appendChild(makeCDATASection(e)),r),e.insertBefore(r,e.firstChild)),r.textContent="",r.appendChild(makeCDATASection(t)),r},Lt={clear:e=>(Array.from(e.attributes).filter((e=>"xmlns"!==e.name&&"version"!==e.name)).forEach((t=>e.removeAttribute(t.name))),removeChildren(e)),size:setViewBox,setViewBox:setViewBox,getViewBox:getViewBox$1,padding:function(e,t){const r=getViewBox$1(e);return void 0!==r&&setViewBox(e,...[-t,-t,2*t,2*t].map(((e,t)=>r[t]+e))),e},background:function(e,t){let r=Array.from(e.childNodes).filter((e=>e.getAttribute(gt)===Bt)).shift();return null==r&&(r=RabbitEarWindow().document.createElementNS(dt,"rect"),getSVGFrame(e).forEach(((e,t)=>r.setAttribute(Ct.rect[t],e))),r.setAttribute(gt,Bt),r.setAttribute(jt,wt),e.insertBefore(r,e.firstChild)),r.setAttribute("fill",t),e},getWidth:e=>getSVGFrame(e)[2],getHeight:e=>getSVGFrame(e)[3],stylesheet:function(e,t){return stylesheet$1.call(this,e,t)},...Nt,...Rt},It={move:["mousemove","touchmove"],press:["mousedown","touchstart"],release:["mouseup","touchend"],leave:["mouseleave","touchcancel"]},defineGetter=(e,t,r)=>Object.defineProperty(e,t,{get:()=>r,enumerable:!0,configurable:!0}),TouchEvents=function(e){const t=[];Object.keys(It).forEach((e=>{It[e].forEach((e=>{t[e]=[]}))}));Object.keys(It).forEach((r=>{var s;Object.defineProperty(e,`on${s=r,s.charAt(0).toUpperCase()+s.slice(1)}`,{set:s=>{e.addEventListener&&(null!=s?It[r].forEach((r=>{const handlerFunc=t=>{const r=null!=t.touches?t.touches[0]:t;if(void 0!==r){const{clientX:s,clientY:a}=r,[o,c]=convertToViewBox(e,s,a);defineGetter(t,"x",o),defineGetter(t,"y",c)}s(t)};t[r].push(handlerFunc),e.addEventListener(r,handlerFunc)})):(r=>{It[r].forEach((r=>t[r].forEach((t=>e.removeEventListener(r,t)))))})(r))},enumerable:!0})})),Object.defineProperty(e,"off",{value:()=>((e,t)=>Object.values(It).flat().forEach((r=>{t[r].forEach((t=>e.removeEventListener(r,t))),t[r]=[]})))(e,t)})},Ut={svg:{args:(...e)=>[makeViewBox(makeCoordinates(...e))].filter((e=>null!=e)),methods:Lt,init:(e,...t)=>{const r=RabbitEarWindow().document.createElementNS(dt,"svg");return r.setAttribute("version","1.1"),r.setAttribute("xmlns",dt),t.filter((e=>null!=e)).filter((e=>e.appendChild)).forEach((e=>e.appendChild(r))),TouchEvents(r),function(e){let t,r,s=0;const a={},stop=()=>{RabbitEarWindow().cancelAnimationFrame&&RabbitEarWindow().cancelAnimationFrame(r),Object.keys(a).forEach((e=>delete a[e]))};Object.defineProperty(e,"play",{set:e=>{if(stop(),!e||!RabbitEarWindow().requestAnimationFrame)return;t=performance.now(),s=0;const o=makeUUID();a[o]=c=>{e({time:.001*(c-t),frame:s}),s+=1,a[o]&&(r=RabbitEarWindow().requestAnimationFrame(a[o]))},r=RabbitEarWindow().requestAnimationFrame(a[o])},enumerable:!0}),Object.defineProperty(e,"stop",{value:stop,enumerable:!0})}(r),r}}},Dt={};["clip-path","mask","symbol","marker-end","marker-mid","marker-start"].forEach((e=>{Dt[toCamel$1(e)]=(t,r)=>(t.setAttribute(e,function(e){if(null==e)return"";if(typeof e===ut)return"url"===e.slice(0,3)?e:`url(#${e})`;if(null!=e.getAttribute)return`url(#${e.getAttribute(Et)})`;return""}(r)),t)}));const Qt={g:{methods:{...Nt,...Dt,...Rt}}},setRadius=(e,t)=>(e.setAttribute(Ct.circle[2],t),e),setOrigin$1=(e,t,r)=>([...makeCoordinates(...[t,r].flat()).slice(0,2)].forEach(((t,r)=>e.setAttribute(Ct.circle[r],t))),e),Wt={circle:{args:(e,t,r,s)=>{const a=makeCoordinates(...[e,t,r,s].flat());switch(a.length){case 0:case 1:return[,,...a];case 2:case 3:return a;default:return((e,t,r,s)=>[e,t,svg_distance2([e,t],[r,s])])(...a)}},methods:{radius:setRadius,setRadius:setRadius,origin:setOrigin$1,setOrigin:setOrigin$1,center:setOrigin$1,setCenter:setOrigin$1,position:setOrigin$1,setPosition:setOrigin$1,...Nt,...Dt,...Rt}}},setRadii=(e,t,r)=>([,,t,r].forEach(((t,r)=>e.setAttribute(Ct.ellipse[r],t))),e),setOrigin=(e,t,r)=>([...makeCoordinates(...[t,r].flat()).slice(0,2)].forEach(((t,r)=>e.setAttribute(Ct.ellipse[r],t))),e),qt={ellipse:{args:(e,t,r,s)=>{const a=makeCoordinates(...[e,t,r,s].flat()).slice(0,4);switch(a.length){case 0:case 1:case 2:return[,,...a];default:return a}},methods:{radius:setRadii,setRadius:setRadii,origin:setOrigin,setOrigin:setOrigin,center:setOrigin,setCenter:setOrigin,position:setOrigin,setPosition:setOrigin,...Nt,...Dt,...Rt}}},svgIsIterable=e=>null!=e&&typeof e[Symbol.iterator]===vt,svgSemiFlattenArrays=function(){switch(arguments.length){case 0:return Array.from(arguments);case 1:return svgIsIterable(arguments[0])&&typeof arguments[0]!==ut?svgSemiFlattenArrays(...arguments[0]):[arguments[0]];default:return Array.from(arguments).map((e=>svgIsIterable(e)?[...svgSemiFlattenArrays(e)]:e))}},Args$1=(...e)=>makeCoordinates(...svgSemiFlattenArrays(...e)).slice(0,4),Gt={line:{args:Args$1,methods:{setPoints:(e,...t)=>(Args$1(...t).forEach(((t,r)=>e.setAttribute(Ct.line[r],t))),e),...Nt,...Dt,...Rt}}},getD=e=>{const t=e.getAttribute("d");return null==t?"":t},appendPathCommand=(e,t,...r)=>(e.setAttribute("d",`${getD(e)}${t}${r.flat().join(" ")}`),e),getCommands=e=>parsePathCommands(getD(e)),Ht={addCommand:appendPathCommand,appendCommand:appendPathCommand,clear:e=>(e.removeAttribute("d"),e),getCommands:getCommands,get:getCommands,getD:e=>e.getAttribute("d"),...Nt,...Dt,...Rt};Object.keys(ot).forEach((e=>{Ht[ot[e]]=(t,...r)=>appendPathCommand(t,e,...r)}));const Jt={path:{methods:Ht}},setRectSize=(e,t,r)=>([,,t,r].forEach(((t,r)=>e.setAttribute(Ct.rect[r],t))),e),setRectOrigin=(e,t,r)=>([...makeCoordinates(...[t,r].flat()).slice(0,2)].forEach(((t,r)=>e.setAttribute(Ct.rect[r],t))),e),fixNegatives=function(e){return[0,1].forEach((t=>{e[2+t]<0&&(void 0===e[0+t]&&(e[0+t]=0),e[0+t]+=e[2+t],e[2+t]=-e[2+t])})),e},Zt={rect:{args:(e,t,r,s)=>{const a=makeCoordinates(...[e,t,r,s].flat()).slice(0,4);switch(a.length){case 0:case 1:case 2:case 3:return fixNegatives([,,...a]);default:return fixNegatives(a)}},methods:{origin:setRectOrigin,setOrigin:setRectOrigin,center:setRectOrigin,setCenter:setRectOrigin,size:setRectSize,setSize:setRectSize,...Nt,...Dt,...Rt}}},Yt={style:{init:(e,t)=>{const r=RabbitEarWindow().document.createElementNS(dt,"style");return r.setAttribute("type","text/css"),r.textContent="",r.appendChild(makeCDATASection(t)),r},methods:{setTextContent:(e,t)=>(e.textContent="",e.appendChild(makeCDATASection(t)),e)}}},Xt={text:{args:(e,t,r)=>makeCoordinates(...[e,t,r].flat()).slice(0,2),init:(e,t,r,s,a)=>{const o=RabbitEarWindow().document.createElementNS(dt,"text"),c=[t,r,s,a].filter((e=>typeof e===ut)).shift();return o.appendChild(RabbitEarWindow().document.createTextNode(c||"")),o},methods:{...Nt,...Dt,appendTo:appendTo,setAttributes:setAttributes}}},makeIDString=function(){return Array.from(arguments).filter((e=>typeof e===ut||e instanceof String)).shift()||makeUUID()},maskArgs=(...e)=>[makeIDString(...e)],Kt={mask:{args:maskArgs,methods:{...Nt,...Dt,...Rt}},clipPath:{args:maskArgs,methods:{...Nt,...Dt,...Rt}},symbol:{args:maskArgs,methods:{...Nt,...Dt,...Rt}},marker:{args:maskArgs,methods:{size:setViewBox,setViewBox:setViewBox,...Nt,...Dt,...Rt}}},getPoints=e=>{const t=e.getAttribute(Ot);return null==t?"":t},polyString=function(){return Array.from(Array(Math.floor(arguments.length/2))).map(((e,t)=>`${arguments[2*t+0]},${arguments[2*t+1]}`)).join(" ")},stringifyArgs=(...e)=>[polyString(...makeCoordinates(...svgSemiFlattenArrays(...e)))],setPoints$2=(e,...t)=>(e.setAttribute(Ot,stringifyArgs(...t)[0]),e),addPoint=(e,...t)=>(e.setAttribute(Ot,[getPoints(e),stringifyArgs(...t)[0]].filter((e=>""!==e)).join(" ")),e),Args=function(...e){return 1===e.length&&typeof e[0]===ut?[e[0]]:stringifyArgs(...e)},er={polyline:{args:Args,methods:{setPoints:setPoints$2,addPoint:addPoint,...Nt,...Dt,...Rt}},polygon:{args:Args,methods:{setPoints:setPoints$2,addPoint:addPoint,...Nt,...Dt,...Rt}}},arcPath=(e,t,r,s,a,o=!1)=>{if(null==a)return"";const c=svg_polar_to_cart(s,r),n=svg_polar_to_cart(a,r),i=[n[0]-c[0],n[1]-c[1]],l=c[0]*n[1]-c[1]*n[0],d=c[0]*n[0]+c[1]*n[1],_=Math.atan2(l,d)>0?0:1;let m=o?`M ${e},${t} l ${c[0]},${c[1]} `:`M ${e+c[0]},${t+c[1]} `;return m+=["a ",r,r,0,_,1,i[0],i[1]].join(" "),o&&(m+=" Z"),m},arcArguments=(e,t,r,s,a)=>[arcPath(e,t,r,s,a,!1)],tr={arc:{nodeName:yt,attributes:["d"],args:arcArguments,methods:{setArc:(e,...t)=>e.setAttribute("d",arcArguments(...t)),...Nt}}},rr=[St,Ft],stringifyPoint=e=>e.join(","),pointsToPath=e=>"M"+e.map((e=>e.join(","))).join("L")+"Z",setArrowheadOptions=(e,t,r)=>{"boolean"==typeof t?e.options[r].visible=t:typeof t===ht?(Object.assign(e.options[r],t),null==t.visible&&(e.options[r].visible=!0)):null==t&&(e.options[r].visible=!0)},setArrowStyle=(e,t={},r=Ft)=>{const s=Array.from(e.childNodes).filter((e=>e.getAttribute("class")===`${kt}-${r}`)).shift();Object.keys(t).map((e=>({key:e,fn:s[toCamel$1(e)]}))).filter((e=>typeof e.fn===vt&&"class"!==e.key)).forEach((e=>e.fn(t[e.key]))),Object.keys(t).filter((e=>"class"===e)).forEach((e=>s.classList.add(t[e])))},redraw=e=>{const t=(e=>{let t=[[e.points[0]||0,e.points[1]||0],[e.points[2]||0,e.points[3]||0]],r=svg_sub2(t[1],t[0]),s=svg_add2(t[0],svg_scale2(r,.5));const a=svg_magnitude2(r),o=rr.map((t=>e[t].visible?(1+e[t].padding)*e[t].height*2.5:0)).reduce(((e,t)=>e+t),0);if(a<o){const e=0===a?[o,0]:svg_scale2(r,o/a);t=[svg_sub2(s,svg_scale2(e,.5)),svg_add2(s,svg_scale2(e,.5))],r=svg_sub2(t[1],t[0])}let c=[r[1],-r[0]],n=svg_add2(s,svg_scale2(c,e.bend));const i=t.map((e=>svg_sub2(n,e))),l=i.map((e=>svg_magnitude2(e))),d=i.map(((e,t)=>0===l[t]?e:svg_scale2(e,1/l[t]))),_=d.map((e=>svg_scale2(e,-1))),m=[[_[0][1],-_[0][0]],[_[1][1],-_[1][0]]],g=rr.map(((t,r)=>e[t].padding?e[t].padding:e.padding?e.padding:0)),v=rr.map(((t,r)=>e[t].height*(e[t].visible?1:0))).map(((e,t)=>e+g[t])),p=t.map(((e,t)=>svg_add2(e,svg_scale2(d[t],v[t]))));r=svg_sub2(p[1],p[0]),c=[r[1],-r[0]],s=svg_add2(p[0],svg_scale2(r,.5)),n=svg_add2(s,svg_scale2(c,e.bend));const u=p.map(((t,r)=>svg_add2(t,svg_scale2(svg_sub2(n,t),e.pinch)))),h=rr.map(((t,r)=>[svg_add2(p[r],svg_scale2(_[r],e[t].height)),svg_add2(p[r],svg_scale2(m[r],e[t].width/2)),svg_add2(p[r],svg_scale2(m[r],-e[t].width/2))]));return{line:`M${stringifyPoint(p[0])}C${stringifyPoint(u[0])},${stringifyPoint(u[1])},${stringifyPoint(p[1])}`,tail:pointsToPath(h[0]),head:pointsToPath(h[1])}})(e.options);return Object.keys(t).map((t=>({path:t,element:Array.from(e.childNodes).filter((e=>e.getAttribute("class")===`${kt}-${t}`)).shift()}))).filter((e=>e.element)).map((e=>(e.element.setAttribute("d",t[e.path]),e))).filter((t=>e.options[t.path])).forEach((t=>t.element.setAttribute("visibility",e.options[t.path].visible?"visible":"hidden"))),e},setPoints$1=(e,...t)=>(e.options.points=makeCoordinates(...svgSemiFlattenArrays(...t)).slice(0,4),redraw(e)),sr={setPoints:setPoints$1,points:setPoints$1,bend:(e,t)=>(e.options.bend=t,redraw(e)),pinch:(e,t)=>(e.options.pinch=t,redraw(e)),padding:(e,t)=>(e.options.padding=t,redraw(e)),head:(e,t)=>(setArrowheadOptions(e,t,Ft),setArrowStyle(e,t,Ft),redraw(e)),tail:(e,t)=>(setArrowheadOptions(e,t,St),setArrowStyle(e,t,St),redraw(e)),getLine:e=>Array.from(e.childNodes).filter((e=>e.getAttribute("class")===`${kt}-line`)).shift(),getHead:e=>Array.from(e.childNodes).filter((e=>e.getAttribute("class")===`${kt}-${Ft}`)).shift(),getTail:e=>Array.from(e.childNodes).filter((e=>e.getAttribute("class")===`${kt}-${St}`)).shift(),...Nt},ar=Object.keys({head:{visible:!1,width:8,height:10,padding:0},tail:{visible:!1,width:8,height:10,padding:0},bend:0,padding:0,pinch:.618,points:[]}),or={arrow:{nodeName:"g",attributes:[],args:()=>[],methods:sr,init:function(e,...t){const r=RabbitEarWindow().document.createElementNS(dt,"g");r.setAttribute(gt,kt);const s=["line",St,Ft].map((e=>{const t=RabbitEarWindow().document.createElementNS(dt,yt);return t.setAttribute(gt,`${kt}-${e}`),r.appendChild(t),t}));s[0].setAttribute(Mt,"fill:none;"),s[1].setAttribute(jt,wt),s[2].setAttribute(jt,wt),r.options={head:{visible:!1,width:8,height:10,padding:0},tail:{visible:!1,width:8,height:10,padding:0},bend:0,padding:0,pinch:.618,points:[]};const a=((...e)=>{for(let t=0;t<e.length;t+=1){if(typeof e[t]!==ht)continue;const r=Object.keys(e[t]);for(let s=0;s<r.length;s+=1)if(ar.includes(r[s]))return e[t]}})(...t);return sr.setPoints(r,...a.segment||t),a&&Object.keys(a).filter((e=>sr[e])).forEach((e=>sr[e](r,a[e]))),r}}},makeCurvePath=(e=[],t=0,r=.5)=>{const s=[e[0]||0,e[1]||0],a=[e[2]||0,e[3]||0],o=svg_sub2(a,s),c=svg_add2(s,svg_scale2(o,.5)),n=[o[1],-o[0]],i=svg_add2(c,svg_scale2(n,t)),l=svg_add2(s,svg_scale2(svg_sub2(i,s),r)),d=svg_add2(a,svg_scale2(svg_sub2(i,a),r));return`M${s[0]},${s[1]}C${l[0]},${l[1]} ${d[0]},${d[1]} ${a[0]},${a[1]}`},getNumbersFromPathCommand=e=>e.slice(1).split(/[, ]+/).map((e=>parseFloat(e))),getCurveEndpoints=e=>{const t=(e=>e.match(/[Mm][(0-9), .-]+/).map((e=>getNumbersFromPathCommand(e))))(e).shift(),r=(e=>e.match(/[Cc][(0-9), .-]+/).map((e=>getNumbersFromPathCommand(e))))(e).shift();return[...t?[t[t.length-2],t[t.length-1]]:[0,0],...r?[r[r.length-2],r[r.length-1]]:[0,0]]},setPoints=(e,...t)=>{const r=makeCoordinates(...t.flat()).slice(0,4);return e.setAttribute("d",makeCurvePath(r,e._bend,e._pinch)),e},cr={setPoints:setPoints,bend:(e,t)=>(e._bend=t,setPoints(e,...getCurveEndpoints(e.getAttribute("d")))),pinch:(e,t)=>(e._pinch=t,setPoints(e,...getCurveEndpoints(e.getAttribute("d")))),...Nt},nr={curve:{nodeName:yt,attributes:["d"],args:(...e)=>[makeCurvePath(makeCoordinates(...e.flat()))],methods:cr}},wedgeArguments=(e,t,r,s,a)=>[arcPath(e,t,r,s,a,!0)],ir={wedge:{nodeName:yt,args:wedgeArguments,attributes:["d"],methods:{setArc:(e,...t)=>e.setAttribute("d",wedgeArguments(...t)),...Nt}}},lr={},getChildWithClass=(e,t)=>{const r=e?e.childNodes:void 0;return r?Array.from(r).filter((e=>e.getAttribute("class")===t)).shift():null},fr={...Ut,...Qt,...Wt,...qt,...Gt,...Jt,...Zt,...Yt,...Xt,...Kt,...er,...tr,...or,...nr,...ir,...{origami:{nodeName:"g",init:(e,t,r={})=>{const s=RabbitEarWindow().document.createElementNS(dt,"g");return lr.ear.convert.renderSVG(t,s,{viewBox:!0,strokeWidth:!0,...r}),((e,t,r,s={})=>{const a=lr.ear.graph.boundingBox(r)||{min:[0,0],max:[1,1],span:[1,1]},o=findElementTypeInParents(e,"svg");if(o&&s&&s.viewBox){const e=[a.min,a.span].flatMap((e=>[e[0],e[1]])).join(" ");o.setAttributeNS(null,"viewBox",e)}})(e,0,t,{viewBox:!0,strokeWidth:!0,...r}),s},args:()=>[],methods:{vertices:(...e)=>getChildWithClass(e[0],"vertices"),edges:(...e)=>getChildWithClass(e[0],"edges"),faces:(...e)=>getChildWithClass(e[0],"faces"),boundaries:(...e)=>getChildWithClass(e[0],"boundaries"),...Nt,...Dt,...Rt}}}},dr=Object.values(mt).flat(),passthroughArgs=(...e)=>e,Constructor=(e,t,...r)=>{const s=fr[e]&&fr[e].nodeName?fr[e].nodeName:e,{init:a,args:o,methods:c}=fr[e]||{},n=Ct[s]||[],i=Tt[s]||[],l=a?a(t,...r):RabbitEarWindow().document.createElementNS(dt,s);t&&!l.parentElement&&t.appendChild(l);return(o||passthroughArgs)(...r).forEach(((e,t)=>{l.setAttribute(Ct[s][t],e)})),c&&Object.keys(c).forEach((e=>Object.defineProperty(l,e,{value:function(){return c[e](l,...arguments)}}))),n.forEach((e=>{const t=toCamel$1(e);l[t]||Object.defineProperty(l,t,{value:function(){return l.setAttribute(e,...arguments),l}})})),i.forEach((e=>{if(l[e])return;Object.defineProperty(l,e,{value:function(){return Constructor(e,l,...arguments)}})})),l},_r={};dr.forEach((e=>{_r[e]=(...t)=>Constructor(e,null,...t)}));const mr=Object.assign(_r),gr={NS:dt,nodes_attributes:Ct,nodes_children:Tt,extensions:fr,...Pt,...$t,...mr,window:void 0},vr=Object.assign(((...e)=>{const t=Constructor(bt,null,...e),initialize=()=>e.filter((e=>"function"==typeof e)).forEach((e=>e.call(t,t)));return"loading"===RabbitEarWindow().document.readyState?RabbitEarWindow().document.addEventListener("DOMContentLoaded",initialize):initialize(),t}),gr);Object.defineProperty(vr,"window",{enumerable:!1,set:e=>(e.document||(e.document=(e=>(new e.DOMParser).parseFromString("<!DOCTYPE html><title>.</title>","text/html"))(e)),Ge.window=e,Ge.window)});const pr={min:[0,0],span:[1,1]},setKeysAndValues=(e,t={})=>Object.keys(t).forEach((r=>e.setAttributeNS(null,r,t[r]))),boundingBoxToViewBox=e=>[e.min,e.span].flatMap((e=>[e[0],e[1]])).join(" "),getNthPercentileEdgeLength=({vertices_coords:e,edges_vertices:t,edges_length:r},s=.1)=>{if(!e||!t)return;r||(r=makeEdgesLength({vertices_coords:e,edges_vertices:t}));const a=r.slice().sort(((e,t)=>e-t));return a[Math.max(0,Math.min(Math.floor(a.length*s),a.length-1))]},getStrokeWidth=(e,t)=>{const r=void 0===t?Math.max(...(boundingBox(e)||pr).span):t,s=getNthPercentileEdgeLength(e,.1);return s?.1*s:.01*r};var ur=Object.freeze({__proto__:null,boundingBoxToViewBox:boundingBoxToViewBox,getNthPercentileEdgeLength:getNthPercentileEdgeLength,getStrokeWidth:getStrokeWidth,getViewBox:e=>{const t=boundingBox(e);return void 0===t?"":boundingBoxToViewBox(t)},setKeysAndValues:setKeysAndValues});const drawVertices=(e,t={})=>{const r=vr.g();return e&&e.vertices_coords?(e.vertices_coords.map((e=>vr.circle(e[0],e[1],.01))).forEach((e=>r.appendChild(e))),setKeysAndValues(r,t),r):r};var hr=Object.freeze({__proto__:null,drawVertices:drawVertices});const clonePolyfill=function(e){let t,r;if("object"!=typeof e)return e;if(!e)return e;if("[object Array]"===Object.prototype.toString.apply(e)){for(t=[],r=0;r<e.length;r+=1)t[r]=clonePolyfill(e[r]);return t}for(r in t={},e)e.hasOwnProperty(r)&&(t[r]=clonePolyfill(e[r]));return t},br="function"==typeof structuredClone?structuredClone:clonePolyfill,yr={foldedForm:{},creasePattern:{stroke:"black"}},Er={foldedForm:{},creasePattern:{}};Object.keys(Ke).forEach((e=>{Er.creasePattern[e]={stroke:Ke[e]}}));const setDataValue=(e,t,r)=>e.setAttribute(`data-${t}`,r),edgesPathData=e=>e.vertices_coords&&e.edges_vertices?makeEdgesCoords(e).map((e=>{return`M${(t=e)[0][0]} ${t[0][1]}L${t[1][0]} ${t[1][1]}`;var t})).join(""):"",getStyles=(e,t)=>{const r=isFoldedForm(e)?"foldedForm":"creasePattern",s=br(yr[r]),a=br(Er[r]),o=(e=>{const t={boolean:!0,number:!0,string:!0},r=br(e);return Object.keys(r).filter((e=>!t[typeof r[e]])).forEach((e=>delete r[e])),r})((e=>{const t=br(e);return Object.keys(t).filter((e=>void 0!==Z[e])).forEach((e=>delete t[e])),t})(t));return Object.assign(s,o),J.forEach((e=>{a[e]={...a[e],...o}})),{groupStyle:s,edgeStyle:a}},edgesPaths=(e,t={})=>{const r=vr.g();if(!e)return r;const{groupStyle:s,edgeStyle:a}=getStyles(e,t),o=(({vertices_coords:e,edges_vertices:t,edges_assignment:r})=>{if(!e||!t)return{};if(!r)return{U:edgesPathData({vertices_coords:e,edges_vertices:t})};const s=sortEdgesByAssignment({vertices_coords:e,edges_vertices:t,edges_assignment:r});Object.keys(s).forEach((e=>{s[e].length||delete s[e]}));const a={};return Object.keys(s).forEach((r=>{const o=edgesPathData({vertices_coords:e,edges_vertices:s[r].map((e=>t[e]))});a[r]=vr.path(o)})),a})(e);return Object.keys(o).forEach((e=>{addClass(o[e],Z[e]),setKeysAndValues(o[e],a[e]),setKeysAndValues(o[e],t[e]),setKeysAndValues(o[e],t[Z[e]])})),setKeysAndValues(r,s),Object.keys(o).forEach((e=>r.appendChild(o[e]))),Object.keys(o).forEach((e=>setDataValue(o[e],"assignment",e))),Object.keys(o).forEach((e=>setDataValue(o[e],"foldAngle",Y[e]))),r},edgesLines=(e,t={})=>{const r=vr.g();if(!e)return r;const{groupStyle:s,edgeStyle:a}=getStyles(e,t),o={};Array.from(new Set(J.map((e=>e.toUpperCase())))).forEach((e=>{const r=vr.g();addClass(r,Z[e]),setKeysAndValues(r,a[e]),setKeysAndValues(r,t[e]),setKeysAndValues(r,t[Z[e]]),o[e]=r}));const c=makeEdgesCoords(e).map((e=>vr.line(e[0][0],e[0][1],e[1][0],e[1][1])));return e.edges_foldAngle&&e.edges_foldAngle.forEach(((e,t)=>setDataValue(c[t],"foldAngle",e))),e.edges_assignment&&e.edges_assignment.forEach(((e,t)=>setDataValue(c[t],"assignment",e))),e.edges_foldAngle&&c.forEach(((t,r)=>{const s=e.edges_foldAngle[r];var a;null!=s&&0!==s&&180!==s&&-180!==s&&t.setAttributeNS(null,"opacity",(a=s,String(Math.abs(a)/180)))})),e.edges_assignment?c.forEach(((t,r)=>{const s=e.edges_assignment[r]||"U";o[s].appendChild(t)})):c.forEach((e=>o.U.appendChild(e))),Object.keys(o).filter((e=>o[e].childNodes.length)).forEach((e=>r.appendChild(o[e]))),setKeysAndValues(r,s),r},drawEdges=(e,t)=>edgesFoldAngleAreAllFlat(e)?edgesPaths(e,t):edgesLines(e,t);var Mr=Object.freeze({__proto__:null,drawEdges:drawEdges,edgesLines:edgesLines,edgesPaths:edgesPaths});const makeFacesWinding=({vertices_coords:e,faces_vertices:t})=>t.map((t=>t.map((t=>e[t])).map(((e,t,r)=>[e,r[(t+1)%r.length]])).map((e=>(e[1][0]-e[0][0])*(e[1][1]+e[0][1]))).reduce(((e,t)=>e+t),0))).map((e=>e<0)),makeFacesWindingFromMatrix2=e=>e.map((e=>e[0]*e[3]-e[1]*e[2])).map((e=>e>=0));var Ar=Object.freeze({__proto__:null,makeFacesWinding:makeFacesWinding,makeFacesWindingFromMatrix:e=>e.map((e=>e[0]*e[4]-e[1]*e[3])).map((e=>e>=0)),makeFacesWindingFromMatrix2:makeFacesWindingFromMatrix2});const topologicalSortQuick=e=>{const t=uniqueSortedNumbers(e.flat()),r=[];t.forEach((e=>{r[e]=[]})),e.forEach((e=>{r[e[1]].push(e[0])}));const s=[],a={},recurse=e=>{a[e]||(a[e]=!0,r[e].forEach(recurse),s.push(e))};return t.forEach(recurse),s},topologicalSort=e=>{const t=topologicalSortQuick(e),r=invertFlatMap(t);return e.filter((([e,t])=>r[e]>r[t])).length?void 0:t};var xr=Object.freeze({__proto__:null,topologicalSort:topologicalSort,topologicalSortQuick:topologicalSortQuick});const faceOrdersSubset=(e,t)=>{const r={};return t.forEach((e=>{r[e]=!0})),e.filter((e=>r[e[0]]&&r[e[1]]))},overlappingFaceOrdersClusters=({faceOrders:e})=>{const t=connectedComponents(makeVerticesVerticesUnsorted({edges_vertices:e.map((([e,t])=>[e,t]))})),r=invertFlatToArrayMap(t),s=r.map((t=>faceOrdersSubset(e,t)));return{clusters_faces:r,clusters_faceOrders:s}},faceOrdersToDirectedEdges=({vertices_coords:e,faces_vertices:t,faceOrders:r,faces_normal:s},a)=>{if(!r||!r.length)return[];s||(s=makeFacesNormal({vertices_coords:e,faces_vertices:t}));const o=uniqueSortedNumbers(r.flatMap((([e,t])=>[e,t]))),c=void 0!==a&&o.includes(a)?s[a]:s[o[0]],n={};return o.forEach((e=>{n[e]=dot(s[e],c)>0})),r.map((e=>-1===e[2]!=!n[e[1]]?[e[0],e[1]]:[e[1],e[0]]))},linearizeFaceOrders=({vertices_coords:e,faces_vertices:t,faceOrders:r,faces_normal:s},a)=>topologicalSort(faceOrdersToDirectedEdges({vertices_coords:e,faces_vertices:t,faceOrders:r,faces_normal:s},a)),fillInMissingFaces=({faces_vertices:e},t)=>{if(!e)return t;return e.map(((e,t)=>t)).filter((e=>null==t[e])).concat(invertFlatMap(t))},linearize2DFaces=({vertices_coords:e,faces_vertices:t,faceOrders:r,faces_layer:s,faces_normal:a},o)=>{if(a||(a=makeFacesNormal({vertices_coords:e,faces_vertices:t})),r){const e=linearizeFaceOrders({faceOrders:r,faces_normal:a},o);return e?fillInMissingFaces({faces_vertices:t},invertFlatMap(e)):[]}return s?fillInMissingFaces({faces_vertices:t},s):t.map(((e,t)=>t)).filter((()=>!0))},nudgeFacesWithFaceOrders=({vertices_coords:e,faces_vertices:t,faceOrders:r,faces_normal:s})=>{const a=s?s.map(resize3):makeFacesNormal({vertices_coords:e,faces_vertices:t}),{clusters_faces:o,clusters_faceOrders:c}=overlappingFaceOrdersClusters({faceOrders:r}),n=c.map((e=>linearizeFaceOrders({faceOrders:e,faces_normal:a})));if(n.includes(void 0))return;const i=o.map((e=>a[e[0]])),l=[];return n.forEach(((e,t)=>e.forEach(((e,r)=>{l[e]={vector:i[t],layer:r}})))),l};var Or=Object.freeze({__proto__:null,faceOrdersSubset:faceOrdersSubset,faceOrdersToDirectedEdges:faceOrdersToDirectedEdges,flipFacesLayer:e=>invertArrayToFlatMap(invertFlatToArrayMap(e).reverse()),linearize2DFaces:linearize2DFaces,linearizeFaceOrders:linearizeFaceOrders,makeFacesLayer:({vertices_coords:e,faces_vertices:t,faceOrders:r,faces_normal:s})=>{s||(s=makeFacesNormal({vertices_coords:e,faces_vertices:t}));const a=linearizeFaceOrders({faceOrders:r,faces_normal:s});return a?invertFlatMap(a):[]},nudgeFacesWithFaceOrders:nudgeFacesWithFaceOrders,nudgeFacesWithFacesLayer:({faces_layer:e})=>{const t=[];return invertFlatMap(e).forEach(((e,r)=>{t[e]={vector:[0,0,1],layer:r}})),t},overlappingFaceOrdersClusters:overlappingFaceOrdersClusters});const jr=["front","back"],wr={foldedForm:{ordered:{back:{fill:"white"},front:{fill:"#ddd"}},unordered:{back:{opacity:.1},front:{opacity:.1}}},creasePattern:{}},kr={foldedForm:{ordered:{stroke:"black","stroke-linejoin":"bevel"},unordered:{stroke:"none",fill:"black","stroke-linejoin":"bevel"}},creasePattern:{fill:"none"}},finalize_faces=(e,t,r,s={})=>{const a=isFoldedForm(e),o=!(!e.faceOrders&&!e.faces_layer);makeFacesWinding(e).map((e=>e?jr[0]:jr[1])).forEach(((e,r)=>{addClass(t[r],e),t[r].setAttribute("data-side",e);const c=o?wr.foldedForm.ordered[e]:wr.foldedForm.unordered[e],n=a?c:wr.creasePattern[e];setKeysAndValues(t[r],n),setKeysAndValues(t[r],s[e])})),linearize2DFaces(e).forEach((e=>r.appendChild(t[e])));const c=o?kr.foldedForm.ordered:kr.foldedForm.unordered;return setKeysAndValues(r,a?c:kr.creasePattern),r},facesVerticesPolygon=(e,t)=>{const r=e.faces_vertices.map((t=>t.map((t=>[0,1].map((r=>e.vertices_coords[t][r])))))).map((e=>vr.polygon(e)));return r.forEach(((e,t)=>e.setAttributeNS(null,"index",t))),finalize_faces(e,r,vr.g(),t)},facesEdgesPolygon=function(e,t){const r=e.faces_edges.map((t=>t.map((t=>e.edges_vertices[t])).map(((e,t,r)=>{const s=r[(t+1)%r.length];return e[1]===s[0]||e[1]===s[1]?e[0]:e[1]})).map((t=>[0,1].map((r=>e.vertices_coords[t][r])))))).map((e=>vr.polygon(e)));return r.forEach(((e,t)=>e.setAttributeNS(null,"index",t))),finalize_faces(e,r,vr.g(),t)},drawFaces=(e,t)=>e&&e.vertices_coords&&e.faces_vertices?facesVerticesPolygon(e,t):e&&e.vertices_coords&&e.edges_vertices&&e.faces_edges?facesEdgesPolygon(e,t):vr.g();var Fr=Object.freeze({__proto__:null,drawFaces:drawFaces,facesEdgesPolygon:facesEdgesPolygon,facesVerticesPolygon:facesVerticesPolygon});const Sr={fill:"none"},Cr={stroke:"black",fill:"white"},drawBoundaries=(e,t={})=>{const r=vr.g();if(!e)return r;const s=boundaries$1(e).map((({vertices:t})=>t.map((t=>e.vertices_coords[t])))).filter((e=>e.length));return s.forEach((e=>{const t=vr.polygon(e);addClass(t,"boundary"),r.appendChild(t)})),setKeysAndValues(r,isFoldedForm(e)?Sr:Cr),setKeysAndValues(r,t),r};var Vr=Object.freeze({__proto__:null,drawBoundaries:drawBoundaries});const zr={vertices:drawVertices,edges:drawEdges,faces:drawFaces,boundaries:drawBoundaries},Tr={min:[0,0],max:[1,1],span:[1,1]},Pr=["boundaries","faces","edges","vertices"],renderSVG=(e,t,r={})=>{((e,t)=>{void 0===t.vertices&&(t.vertices=!1),isFoldedForm(e)||void 0===t.faces&&(t.faces=!1)})(e,r);const s=((e,t={})=>Pr.map((r=>!1===t[r]?vr.g():zr[r](e,t[r]))).map(((e,t)=>(addClass(e,Pr[t]),e))))(e,r);return s.filter((e=>e.childNodes.length>0)).forEach((e=>t.appendChild(e))),((e,t,r,s)=>{const a=t[3]&&t[3].childNodes.length;if(!(a||void 0!==s.strokeWidth&&!1!==s.strokeWidth||void 0!==s.viewBox&&!1!==s.viewBox))return;const o=boundingBox(r)||Tr,c=Math.max(...o.span),n=findElementTypeInParents(e,"svg");if(n&&s.viewBox){const e=boundingBoxToViewBox(o);n.setAttributeNS(null,"viewBox",e)}if(n&&s.padding){const e=n.getAttribute("viewBox");if(null!=e){const t=s.padding*c,r=e.split(" ").map((e=>parseFloat(e))),a=[-t,-t,2*t,2*t].map(((e,t)=>r[t]+e)).join(" ");n.setAttributeNS(null,"viewBox",a)}}if(s.strokeWidth||s["stroke-width"]){const t=s.strokeWidth?s.strokeWidth:s["stroke-width"],a="number"==typeof t?c*t:getStrokeWidth(r);e.setAttributeNS(null,"stroke-width",a)}if(a){const e=s.vertices&&null!=s.vertices.radius?s.vertices.radius:s.radius,r="string"==typeof e?parseFloat(e):e,a="number"!=typeof r||Number.isNaN(r)?.02*c:c*r;for(let e=0;e<t[3].childNodes.length;e+=1)t[3].childNodes[e].setAttributeNS(null,"r",a)}})(t,s,e,r),addClass(t,...[e.file_classes||[],e.frame_classes||[]].flat()),t},foldToSvg=(e,t={})=>{const r=renderSVG("string"==typeof e?JSON.parse(e):e,vr.svg(),{viewBox:!0,strokeWidth:!0,...t});return t&&t.string?(new(RabbitEarWindow$1().XMLSerializer)).serializeToString(r):r};const foldToObj=e=>{const t="string"==typeof e?JSON.parse(e):e,r=(e=>["file_title","file_author","file_description","frame_title","frame_author","frame_description"].filter((t=>e[t])).map((t=>`# ${t.split("_")[1]}: ${e[t]}`)).join("\n"))(t);return`${[r,(t.vertices_coords||[]).map((e=>e.join(" "))).map((e=>`v ${e}`)).join("\n"),(t.faces_vertices||[]).map((e=>e.map((e=>e+1)).join(" "))).map((e=>`f ${e}`)).join("\n")].filter((e=>""!==e)).join("\n")}\n`};const parseCSSStyleSheet=e=>{if(!e.cssRules)return{};const t={};for(let r=0;r<e.cssRules.length;r+=1){const s=e.cssRules[r];if("CSSStyleRule"!==s.constructor.name)continue;const a=s,o=a.selectorText.split(/,/gm).filter(Boolean).map((e=>e.trim())),c={};Object.values(a.style).forEach((e=>{c[e]=a.style[e]})),o.forEach((e=>{t[e]=c}))}return t};var $r={...Me,...Ie,...ft,...Object.freeze({__proto__:null,foldToSvg:foldToSvg,renderSVG:renderSVG}),...Object.freeze({__proto__:null,foldToObj:foldToObj}),...Xe,...Re,...Pe,...ur,...{...rt,...Vr,...hr,...Mr,...Fr,...it,...Object.freeze({__proto__:null,getStylesheetStyle:(e,t,r,s=[])=>{const a=r.class?r.class.split(/\s/).filter(Boolean).map((e=>e.trim())).map((e=>`.${e}`)):[],o=r.id?`#${r.id}`:null;if(o)for(let t=0;t<s.length;t+=1)if(s[t][o]&&s[t][o][e])return s[t][o][e];for(let r=0;r<s.length;r+=1){for(let t=0;t<a.length;t+=1)if(s[r][a[t]]&&s[r][a[t]][e])return s[r][a[t]][e];if(s[r][t]&&s[r][t][e])return s[r][t][e]}},parseCSSStyleSheet:parseCSSStyleSheet,parseStyleElement:e=>{const t="sheet"in e?e.sheet:void 0;if(t)return parseCSSStyleSheet(t);if(!(getRootParent(e).constructor===RabbitEarWindow$1().HTMLDocument)){const r=e.parentNode;null!=r&&r.removeChild(e);const s=null!=RabbitEarWindow$1().document.body?RabbitEarWindow$1().document.body:RabbitEarWindow$1().document.createElement("body");s.appendChild(e);const a=parseCSSStyleSheet(t);return s.removeChild(e),null!=r&&r.appendChild(e),a}return[]}})}};var Br={...Q,...S,...Ne,...ne,...Object.freeze({__proto__:null,capitalized:e=>e.charAt(0).toUpperCase()+e.slice(1),toCamel:e=>e.replace(/([-_][a-z])/gi,(e=>e.toUpperCase().replace("-","").replace("_",""))),toKebab:e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z])([A-Z])(?=[a-z])/g,"$1-$2").toLowerCase()})};const flattenFrame=(e,t=0)=>{if(!e.file_frames||e.file_frames.length<t)return e;const r={},s={};filterKeysWithPrefix(e,"file").filter((e=>"file_frames"!==e)).forEach((t=>{s[t]=e[t]}));const recurse=(t,s)=>{if(r[t])throw new Error(o);r[t]=!0;const a=[t].concat(s),c=t>0?{...e.file_frames[t-1]}:{...e};return c.frame_inherit&&null!=c.frame_parent?recurse(c.frame_parent,a):a},a=recurse(t,[]).map((t=>{const r=t>0?{...e.file_frames[t-1]}:{...e};return["file_frames","frame_parent","frame_inherit"].forEach((e=>delete r[e])),r})).reduce(((e,t)=>({...e,...t})),s);return br(a)},countFrames=({file_frames:e})=>e?e.length+1:1;var Nr=Object.freeze({__proto__:null,countFrames:countFrames,flattenFrame:flattenFrame,getFileFramesAsArray:e=>{if(!e)return[];if(!e.file_frames||!e.file_frames.length)return[e];const t={...e};return delete t.file_frames,[t,...e.file_frames]},getFramesByClassName:(e,t)=>Array.from(Array(countFrames(e))).map(((t,r)=>flattenFrame(e,r))).filter((e=>e.frame_classes&&e.frame_classes.includes(t)))});const addVertices=(e,t=[])=>{e.vertices_coords||(e.vertices_coords=[]);const r=t.map(((t,r)=>e.vertices_coords.length+r));return r.forEach(((r,s)=>{e.vertices_coords[r]=t[s],e.vertices_vertices&&(e.vertices_vertices[r]=[]),e.vertices_edges&&(e.vertices_edges[r]=[]),e.vertices_faces&&(e.vertices_faces[r]=[])})),r};var Rr=Object.freeze({__proto__:null,addVertex:(e,t,r=[],s=[],a=[])=>{e.vertices_coords||(e.vertices_coords=[]);const o=e.vertices_coords.length;return e.vertices_coords[o]=t,e.vertices_vertices&&(e.vertices_vertices[o]=r),e.vertices_edges&&(e.vertices_edges[o]=s),e.vertices_faces&&(e.vertices_faces[o]=a),o},addVertices:addVertices});const addEdge=(e,t,r=[],s="U",a=0)=>{e.edges_vertices||(e.edges_vertices=[]);const o=e.edges_vertices.length;return e.edges_vertices[o]=t,e.edges_faces&&(e.edges_faces[o]=r),e.edges_assignment&&(e.edges_assignment[o]=s),e.edges_foldAngle&&(e.edges_foldAngle[o]=a),o},addIsolatedEdge=(e,t,r="U",s=0)=>{const a=addEdge(e,t,[],r,s);if(e.vertices_vertices){t.filter((t=>!e.vertices_vertices[t])).forEach((t=>{e.vertices_vertices[t]=[]}));const r=[t[1],t[0]];t.forEach(((t,s)=>{e.vertices_vertices[t].push(r[s])}))}return e.vertices_edges&&(t.filter((t=>!e.vertices_edges[t])).forEach((t=>{e.vertices_edges[t]=[]})),t.forEach((t=>{e.vertices_edges[t].push(a)}))),e.vertices_faces&&t.filter((t=>!e.vertices_faces[t])).forEach((t=>{e.vertices_faces[t]=[]})),a};var Lr=Object.freeze({__proto__:null,addEdge:addEdge,addIsolatedEdge:addIsolatedEdge});const Ir=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),multiplyMatrix4Vector3=(e,t)=>[e[0]*t[0]+e[4]*t[1]+e[8]*t[2]+e[12],e[1]*t[0]+e[5]*t[1]+e[9]*t[2]+e[13],e[2]*t[0]+e[6]*t[1]+e[10]*t[2]+e[14]],multiplyMatrix4Line3=(e,t,r)=>({vector:[e[0]*t[0]+e[4]*t[1]+e[8]*t[2],e[1]*t[0]+e[5]*t[1]+e[9]*t[2],e[2]*t[0]+e[6]*t[1]+e[10]*t[2]],origin:[e[0]*r[0]+e[4]*r[1]+e[8]*r[2]+e[12],e[1]*r[0]+e[5]*r[1]+e[9]*r[2]+e[13],e[2]*r[0]+e[6]*r[1]+e[10]*r[2]+e[14]]}),multiplyMatrices4=(e,t)=>[e[0]*t[0]+e[4]*t[1]+e[8]*t[2]+e[12]*t[3],e[1]*t[0]+e[5]*t[1]+e[9]*t[2]+e[13]*t[3],e[2]*t[0]+e[6]*t[1]+e[10]*t[2]+e[14]*t[3],e[3]*t[0]+e[7]*t[1]+e[11]*t[2]+e[15]*t[3],e[0]*t[4]+e[4]*t[5]+e[8]*t[6]+e[12]*t[7],e[1]*t[4]+e[5]*t[5]+e[9]*t[6]+e[13]*t[7],e[2]*t[4]+e[6]*t[5]+e[10]*t[6]+e[14]*t[7],e[3]*t[4]+e[7]*t[5]+e[11]*t[6]+e[15]*t[7],e[0]*t[8]+e[4]*t[9]+e[8]*t[10]+e[12]*t[11],e[1]*t[8]+e[5]*t[9]+e[9]*t[10]+e[13]*t[11],e[2]*t[8]+e[6]*t[9]+e[10]*t[10]+e[14]*t[11],e[3]*t[8]+e[7]*t[9]+e[11]*t[10]+e[15]*t[11],e[0]*t[12]+e[4]*t[13]+e[8]*t[14]+e[12]*t[15],e[1]*t[12]+e[5]*t[13]+e[9]*t[14]+e[13]*t[15],e[2]*t[12]+e[6]*t[13]+e[10]*t[14]+e[14]*t[15],e[3]*t[12]+e[7]*t[13]+e[11]*t[14]+e[15]*t[15]],determinant4=e=>{const t=e[10]*e[15]-e[11]*e[14],r=e[9]*e[15]-e[11]*e[13],s=e[9]*e[14]-e[10]*e[13],a=e[8]*e[15]-e[11]*e[12],o=e[8]*e[14]-e[10]*e[12],c=e[8]*e[13]-e[9]*e[12];return e[0]*(e[5]*t-e[6]*r+e[7]*s)-e[1]*(e[4]*t-e[6]*a+e[7]*o)+e[2]*(e[4]*r-e[5]*a+e[7]*c)-e[3]*(e[4]*s-e[5]*o+e[6]*c)},invertMatrix4=e=>{const t=determinant4(e);if(Math.abs(t)<1e-12||Number.isNaN(t)||!Number.isFinite(e[12])||!Number.isFinite(e[13])||!Number.isFinite(e[14]))return;const r=e[10]*e[15]-e[11]*e[14],s=e[9]*e[15]-e[11]*e[13],a=e[9]*e[14]-e[10]*e[13],o=e[8]*e[15]-e[11]*e[12],c=e[8]*e[14]-e[10]*e[12],n=e[8]*e[13]-e[9]*e[12],i=e[6]*e[15]-e[7]*e[14],l=e[5]*e[15]-e[7]*e[13],d=e[5]*e[14]-e[6]*e[13],_=e[6]*e[11]-e[7]*e[10],m=e[5]*e[11]-e[7]*e[9],g=e[5]*e[10]-e[6]*e[9],v=e[4]*e[15]-e[7]*e[12],p=e[4]*e[14]-e[6]*e[12],u=e[4]*e[11]-e[7]*e[8],h=e[4]*e[10]-e[6]*e[8],b=e[4]*e[13]-e[5]*e[12],y=e[4]*e[9]-e[5]*e[8],E=[+(e[5]*r-e[6]*s+e[7]*a),-(e[1]*r-e[2]*s+e[3]*a),+(e[1]*i-e[2]*l+e[3]*d),-(e[1]*_-e[2]*m+e[3]*g),-(e[4]*r-e[6]*o+e[7]*c),+(e[0]*r-e[2]*o+e[3]*c),-(e[0]*i-e[2]*v+e[3]*p),+(e[0]*_-e[2]*u+e[3]*h),+(e[4]*s-e[5]*o+e[7]*n),-(e[0]*s-e[1]*o+e[3]*n),+(e[0]*l-e[1]*v+e[3]*b),-(e[0]*m-e[1]*u+e[3]*y),-(e[4]*a-e[5]*c+e[6]*n),+(e[0]*a-e[1]*c+e[2]*n),-(e[0]*d-e[1]*p+e[2]*b),+(e[0]*g-e[1]*h+e[2]*y)],M=1/t;return E.map((e=>e*M))},Ur=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0]),makeMatrix4Translate=(e=0,t=0,r=0)=>[...Ur,e,t,r,1],singleAxisRotate4=(e,t,r,s,a)=>{const o=Math.cos(e),c=Math.sin(e),n=[...Ir];n[4*r+r]=o,n[4*r+s]=(a?1:-1)*c,n[4*s+r]=(a?-1:1)*c,n[4*s+s]=o;const i=[0,1,2].map((e=>t[e]||0)),l=[...Ir],d=[...Ir];return[12,13,14].forEach(((e,t)=>{l[e]=-i[t],d[e]=i[t]})),multiplyMatrices4(d,multiplyMatrices4(n,l))},makeMatrix4Scale=(e=[1,1,1],t=[0,0,0])=>[e[0],0,0,0,0,e[1],0,0,0,0,e[2],0,e[0]*-t[0]+t[0],e[1]*-t[1]+t[1],e[2]*-t[2]+t[2],1],makePerspectiveMatrix4=(e,t,r,s)=>{const a=Math.tan(.5*Math.PI-.5*e),o=1/(r-s);return[t<1?a:a/t,0,0,0,0,t<1?a*t:a,0,0,0,0,(r+s)*o,-1,0,0,r*s*o*2,0]},makeOrthographicMatrix4=(e,t,r,s,a,o)=>[2/(t-s),0,0,0,0,2/(e-r),0,0,0,0,2/(a-o),0,(s+t)/(s-t),(r+e)/(r-e),(a+o)/(a-o),1];var Dr=Object.freeze({__proto__:null,determinant4:determinant4,identity4x4:Ir,invertMatrix4:invertMatrix4,isIdentity4x4:e=>Ir.map(((t,r)=>Math.abs(t-e[r])<p)).reduce(((e,t)=>e&&t),!0),makeLookAtMatrix4:(e,t,r)=>{const s=normalize3(subtract3(e,t)),a=normalize3(cross3(r,s)),o=normalize3(cross3(s,a));return[a[0],a[1],a[2],0,o[0],o[1],o[2],0,s[0],s[1],s[2],0,e[0],e[1],e[2],1]},makeMatrix4ReflectZ:(e,t=[0,0])=>{const r=makeMatrix2Reflect(e,t);return[r[0],r[1],0,0,r[2],r[3],0,0,0,0,1,0,r[4],r[5],0,1]},makeMatrix4Rotate:(e,t=[0,0,1],r=[0,0,0])=>{const s=[0,1,2].map((e=>r[e]||0)),[a,o,c]=resize(3,normalize$2(t)),n=Math.cos(e),i=Math.sin(e),l=1-n,d=makeMatrix4Translate(-s[0],-s[1],-s[2]),_=makeMatrix4Translate(s[0],s[1],s[2]);return multiplyMatrices4(_,multiplyMatrices4([l*a*a+n,l*o*a+c*i,l*c*a-o*i,0,l*a*o-c*i,l*o*o+n,l*c*o+a*i,0,l*a*c+o*i,l*o*c-a*i,l*c*c+n,0,0,0,0,1],d))},makeMatrix4RotateX:(e,t=[0,0,0])=>singleAxisRotate4(e,t,1,2,!0),makeMatrix4RotateY:(e,t=[0,0,0])=>singleAxisRotate4(e,t,0,2,!1),makeMatrix4RotateZ:(e,t=[0,0,0])=>singleAxisRotate4(e,t,0,1,!0),makeMatrix4Scale:makeMatrix4Scale,makeMatrix4Translate:makeMatrix4Translate,makeMatrix4UniformScale:(e=1,t=[0,0,0])=>makeMatrix4Scale([e,e,e],t),makeOrthographicMatrix4:makeOrthographicMatrix4,makePerspectiveMatrix4:makePerspectiveMatrix4,multiplyMatrices4:multiplyMatrices4,multiplyMatrix4Line3:multiplyMatrix4Line3,multiplyMatrix4Vector3:multiplyMatrix4Vector3});const quaternionFromTwoVectors=(e,t)=>{const r=cross3(e,t),s=[r[0],r[1],r[2],dot(e,t)];s[3]+=magnitude(s);const[a,o,c,n]=normalize$2(s);return[a,o,c,n]},matrix4FromQuaternion=e=>multiplyMatrices4([+e[3],+e[2],-e[1],+e[0],-e[2],+e[3],+e[0],+e[1],+e[1],-e[0],+e[3],+e[2],-e[0],-e[1],-e[2],+e[3]],[+e[3],+e[2],-e[1],-e[0],-e[2],+e[3],+e[0],-e[1],+e[1],-e[0],+e[3],-e[2],+e[0],+e[1],+e[2],+e[3]]);var Qr=Object.freeze({__proto__:null,matrix4FromQuaternion:matrix4FromQuaternion,quaternionFromTwoVectors:quaternionFromTwoVectors});const makeFacesFaces=({faces_vertices:e})=>{const t={},r=e.map((e=>e.map(((e,t,r)=>[e,r[(t+1)%r.length]])).map((e=>e.join(" ")))));return r.flat().forEach((e=>{t[e]=[]})),r.forEach(((e,r)=>e.forEach((e=>t[e].push(r))))),e.map(((e,r)=>e.map(((e,t,r)=>[r[(t+1)%r.length],e])).map((e=>e.join(" "))).map((e=>t[e])).map((e=>void 0===e?[void 0]:e)).flatMap((e=>e.filter((e=>r!==e)).shift()))))};var Wr=Object.freeze({__proto__:null,makeFacesFaces:makeFacesFaces});const selfRelationalArraySubset=(e,t)=>{const r={};t.forEach((e=>{r[e]=!0}));const s=[];return t.forEach((t=>{s[t]=e[t].filter((e=>r[e]))})),s},subgraphExclusive=(e,t={})=>{const r={vertices:[],edges:[],faces:[],...t},s=Object.keys(r),a={...e};G.graph.forEach((e=>delete a[e])),delete a.file_frames;const o={};s.forEach((e=>{o[e]={}})),s.forEach((e=>r[e].forEach((t=>{o[e][t]=!0}))));const c={};return s.forEach((t=>{filterKeysWithPrefix(e,t).forEach((e=>{c[e]={}})),filterKeysWithSuffix(e,t).forEach((e=>{c[e]={}}))})),s.forEach((t=>{filterKeysWithPrefix(e,t).forEach((e=>{c[e].prefix=t})),filterKeysWithSuffix(e,t).forEach((e=>{c[e].suffix=t}))})),Object.keys(c).forEach((e=>{a[e]=[]})),Object.keys(c).forEach((t=>{const{prefix:s,suffix:n}=c[t];s&&n?r[s].forEach((r=>{a[t][r]=e[t][r].filter((e=>o[n][e]))})):s?r[s].forEach((r=>{a[t][r]=e[t][r]})):a[t]=n?e[t].map((e=>e.filter((e=>o[n][e])))):e[t]})),a},subgraph=(e,t={})=>{const r={vertices:[],edges:[],faces:[],...t},s={vertices:{},edges:{},faces:{}};return r.vertices.forEach((e=>{s.vertices[e]=!0})),r.edges.forEach((e=>{s.edges[e]=!0})),r.edges.forEach((t=>e.edges_vertices[t].forEach((e=>{s.vertices[e]=!0})))),r.faces.forEach((e=>{s.faces[e]=!0})),r.faces.forEach((t=>e.faces_vertices[t].forEach((e=>{s.vertices[e]=!0})))),e.faces_vertices.map(((e,t)=>t)).filter((t=>e.faces_vertices[t].map((e=>s.vertices[e])).reduce(((e,t)=>e&&t),!0))).forEach((e=>{s.faces[e]=!0})),e.edges_vertices.map(((e,t)=>t)).filter((t=>e.edges_vertices[t].map((e=>s.vertices[e])).reduce(((e,t)=>e&&t),!0))).forEach((e=>{s.edges[e]=!0})),subgraphExclusive(e,{vertices:Object.keys(s.vertices),edges:Object.keys(s.edges),faces:Object.keys(s.faces)})},subgraphWithFaces=(e,t)=>{let r=[];e.faces_vertices&&(r=uniqueSortedNumbers(t.flatMap((t=>e.faces_vertices[t]))));let s=[];if(e.faces_edges)s=uniqueSortedNumbers(t.flatMap((t=>e.faces_edges[t])));else if(e.edges_vertices){const t={};r.forEach((e=>{t[e]=!0})),s=e.edges_vertices.map(((e,r)=>t[e[0]]&&t[e[1]]?r:void 0)).filter((e=>void 0!==e))}return subgraphExclusive(e,{vertices:r,edges:s,faces:t})};var qr=Object.freeze({__proto__:null,selfRelationalArraySubset:selfRelationalArraySubset,subgraph:subgraph,subgraphExclusive:subgraphExclusive,subgraphWithFaces:subgraphWithFaces,subgraphWithVertices:(e,t=[])=>{const r={vertices:[],edges:[]};return t.forEach((e=>{r.vertices[e]=!0})),e.vertices_edges&&r.vertices.forEach(((t,s)=>e.vertices_edges[s].forEach((e=>{r.edges[e]=!0})))),e.edges_vertices&&r.edges.forEach(((t,s)=>e.edges_vertices[s].forEach((e=>{r.vertices[e]=!0})))),subgraphExclusive(e,{vertices:r.vertices.map(((e,t)=>e?t:void 0)).filter((e=>void 0!==e)),edges:r.edges.map(((e,t)=>e?t:void 0)).filter((e=>void 0!==e))})}});const getFacesPlane=({vertices_coords:e,faces_vertices:t},r=p)=>{const s=makeFacesNormal({vertices_coords:e,faces_vertices:t}),a=t.map((()=>[]));for(let e=0;e<t.length-1;e+=1)for(let o=e+1;o<t.length;o+=1)parallelNormalized(s[e],s[o],r)&&(a[e].push(o),a[o].push(e));const o=connectedComponents(a),c=invertFlatToArrayMap(o),n=c.map((e=>s[e[0]])),i=[];c.forEach(((e,t)=>e.forEach((e=>{i[e]=dot3(s[e],n[t])>0}))));const l=t.map((t=>e[t[0]])).map(resize3),d=c.map(((e,t)=>e.map((e=>dot3(n[t],l[e]))))),_=d.map(((e,t)=>clusterScalars(e).map((e=>e.map((e=>c[t][e])))))),m=_.flat(),g=_.flatMap(((e,t)=>e.map((()=>n[t])))).map(resize3),v=m.map((e=>e[0])).map((e=>l[e])).map(((e,t)=>dot3(g[t],e))).map(((e,t)=>scale3$1(g[t],e))),u=m.map(((e,t)=>({normal:g[t],origin:v[t]}))),h=invertArrayToFlatMap(m),b=[0,0,1],y=u.map((({normal:e})=>Math.abs(dot(e,b)+1)<r?[1,0,0,0,0,-1,0,0,0,0,-1,0,0,0,0,1]:matrix4FromQuaternion(quaternionFromTwoVectors(e,b))));return u.forEach((({origin:e},t)=>{const r=multiplyMatrix4Vector3(y[t],flip3(e));y[t][12]=r[0],y[t][13]=r[1],y[t][14]=r[2]})),{planes:u,planes_faces:m,planes_transform:y,faces_plane:h,faces_winding:i}},getCoplanarAdjacentOverlappingFaces=({vertices_coords:e,faces_vertices:t,faces_faces:r},s=p)=>{r||(r=makeFacesFaces({faces_vertices:t}));const{planes:a,planes_faces:o,planes_transform:c,faces_plane:n,faces_winding:i}=getFacesPlane({vertices_coords:e,faces_vertices:t},s),l=e.map(resize3),d=t.map(((e,t)=>i[t]?e:e.slice().reverse())).map((e=>e.map((e=>l[e])))).map((e=>makePolygonNonCollinear3(e,s))).map(((e,t)=>e.map((e=>multiplyMatrix4Vector3(c[n[t]],e))).map(resize2))),_=o.map((e=>selfRelationalArraySubset(r,e))),m=_.map(connectedComponents),g=m.map((e=>invertFlatToArrayMap(e))),v=m.map((e=>{const t=e.map(((e,t)=>t));return e.map((r=>t.filter((t=>e[t]!==r))))})),u=g.map((e=>e.map((()=>[]))));v.forEach(((e,t)=>{const r={};e.forEach(((e,a)=>e.forEach((e=>{const o=[a,e].map((e=>m[t][e])),c=o.join(" ");if(r[c])return;if(overlapConvexPolygons(d[a],d[e],s)){const e=o.reverse().join(" ");r[c]=!0,r[e]=!0,u[t][o[0]].push(o[1]),u[t][o[1]].push(o[0])}}))))}));const h=u.map((e=>invertFlatToArrayMap(connectedComponents(e)))),b=h.flatMap(((e,t)=>e.map((()=>t)))),y=invertFlatToArrayMap(b),E=h.flatMap(((e,t)=>e.map((e=>e.flatMap((e=>g[t][e])))))),M=invertArrayToFlatMap(E);return{planes:a,planes_faces:o,planes_transform:c,planes_clusters:y,faces_winding:i,faces_plane:n,faces_cluster:M,clusters_plane:b,clusters_faces:E}};var Gr=Object.freeze({__proto__:null,getCoplanarAdjacentOverlappingFaces:getCoplanarAdjacentOverlappingFaces,getFacesPlane:getFacesPlane});const Hr=Object.freeze([1,0,0,0,1,0,0,0,1]),Jr=Object.freeze(Hr.concat(0,0,0)),multiplyMatrix3Vector3=(e,t)=>[e[0]*t[0]+e[3]*t[1]+e[6]*t[2]+e[9],e[1]*t[0]+e[4]*t[1]+e[7]*t[2]+e[10],e[2]*t[0]+e[5]*t[1]+e[8]*t[2]+e[11]],multiplyMatrices3=(e,t)=>[e[0]*t[0]+e[3]*t[1]+e[6]*t[2],e[1]*t[0]+e[4]*t[1]+e[7]*t[2],e[2]*t[0]+e[5]*t[1]+e[8]*t[2],e[0]*t[3]+e[3]*t[4]+e[6]*t[5],e[1]*t[3]+e[4]*t[4]+e[7]*t[5],e[2]*t[3]+e[5]*t[4]+e[8]*t[5],e[0]*t[6]+e[3]*t[7]+e[6]*t[8],e[1]*t[6]+e[4]*t[7]+e[7]*t[8],e[2]*t[6]+e[5]*t[7]+e[8]*t[8],e[0]*t[9]+e[3]*t[10]+e[6]*t[11]+e[9],e[1]*t[9]+e[4]*t[10]+e[7]*t[11]+e[10],e[2]*t[9]+e[5]*t[10]+e[8]*t[11]+e[11]],determinant3=e=>e[0]*e[4]*e[8]-e[0]*e[7]*e[5]-e[3]*e[1]*e[8]+e[3]*e[7]*e[2]+e[6]*e[1]*e[5]-e[6]*e[4]*e[2],invertMatrix3=e=>{const t=determinant3(e);if(Math.abs(t)<1e-12||Number.isNaN(t)||!Number.isFinite(e[9])||!Number.isFinite(e[10])||!Number.isFinite(e[11]))return;const r=[e[4]*e[8]-e[7]*e[5],-e[1]*e[8]+e[7]*e[2],e[1]*e[5]-e[4]*e[2],-e[3]*e[8]+e[6]*e[5],e[0]*e[8]-e[6]*e[2],-e[0]*e[5]+e[3]*e[2],e[3]*e[7]-e[6]*e[4],-e[0]*e[7]+e[6]*e[1],e[0]*e[4]-e[3]*e[1],-e[3]*e[7]*e[11]+e[3]*e[8]*e[10]+e[6]*e[4]*e[11]-e[6]*e[5]*e[10]-e[9]*e[4]*e[8]+e[9]*e[5]*e[7],e[0]*e[7]*e[11]-e[0]*e[8]*e[10]-e[6]*e[1]*e[11]+e[6]*e[2]*e[10]+e[9]*e[1]*e[8]-e[9]*e[2]*e[7],-e[0]*e[4]*e[11]+e[0]*e[5]*e[10]+e[3]*e[1]*e[11]-e[3]*e[2]*e[10]-e[9]*e[1]*e[5]+e[9]*e[2]*e[4]],s=1/t;return r.map((e=>e*s))},singleAxisRotate=(e,t,r,s,a)=>{const o=Math.cos(e),c=Math.sin(e),n=Hr.concat([0,0,0]);n[3*r+r]=o,n[3*r+s]=(a?1:-1)*c,n[3*s+r]=(a?-1:1)*c,n[3*s+s]=o;const i=[0,1,2].map((e=>t[e]||0)),l=Hr.concat(flip(i)),d=Hr.concat(i);return multiplyMatrices3(d,multiplyMatrices3(n,l))},makeMatrix3RotateX=(e,t=[0,0,0])=>singleAxisRotate(e,t,1,2,!0),makeMatrix3RotateY=(e,t=[0,0,0])=>singleAxisRotate(e,t,0,2,!1),makeMatrix3RotateZ=(e,t=[0,0,0])=>singleAxisRotate(e,t,0,1,!0),makeMatrix3Rotate=(e,t=[0,0,1],r=[0,0,0])=>{const s=[0,1,2].map((e=>r[e]||0)),[a,o,c]=resize(3,normalize$2(t)),n=Math.cos(e),i=Math.sin(e),l=1-n,d=Hr.concat(-s[0],-s[1],-s[2]),_=Hr.concat(s[0],s[1],s[2]);return multiplyMatrices3(_,multiplyMatrices3([l*a*a+n,l*o*a+c*i,l*c*a-o*i,l*a*o-c*i,l*o*o+n,l*c*o+a*i,l*a*c+o*i,l*o*c-a*i,l*c*c+n,0,0,0],d))},makeMatrix3Scale=(e=[1,1,1],t=[0,0,0])=>[e[0],0,0,0,e[1],0,0,0,e[2],e[0]*-t[0]+t[0],e[1]*-t[1]+t[1],e[2]*-t[2]+t[2]];var Zr=Object.freeze({__proto__:null,determinant3:determinant3,identity3x3:Hr,identity3x4:Jr,invertMatrix3:invertMatrix3,isIdentity3x4:e=>Jr.map(((t,r)=>Math.abs(t-e[r])<p)).reduce(((e,t)=>e&&t),!0),makeMatrix3ReflectZ:(e,t=[0,0])=>{const r=makeMatrix2Reflect(e,t);return[r[0],r[1],0,r[2],r[3],0,0,0,1,r[4],r[5],0]},makeMatrix3Rotate:makeMatrix3Rotate,makeMatrix3RotateX:makeMatrix3RotateX,makeMatrix3RotateY:makeMatrix3RotateY,makeMatrix3RotateZ:makeMatrix3RotateZ,makeMatrix3Scale:makeMatrix3Scale,makeMatrix3Translate:(e=0,t=0,r=0)=>Hr.concat(e,t,r),makeMatrix3UniformScale:(e=1,t=[0,0,0])=>makeMatrix3Scale([e,e,e],t),multiplyMatrices3:multiplyMatrices3,multiplyMatrix3Line3:(e,t,r)=>({vector:[e[0]*t[0]+e[3]*t[1]+e[6]*t[2],e[1]*t[0]+e[4]*t[1]+e[7]*t[2],e[2]*t[0]+e[5]*t[1]+e[8]*t[2]],origin:[e[0]*r[0]+e[3]*r[1]+e[6]*r[2]+e[9],e[1]*r[0]+e[4]*r[1]+e[7]*r[2]+e[10],e[2]*r[0]+e[5]*r[1]+e[8]*r[2]+e[11]]}),multiplyMatrix3Vector3:multiplyMatrix3Vector3});const minimumSpanningTrees=(e=[],t=[])=>{if(0===e.length)return[];const r=[],s={};e.forEach(((e,t)=>{s[t]=!0}));do{const a=t.filter((e=>s[e])).shift(),o=void 0!==a?a:parseInt(Object.keys(s).shift(),10);delete s[o];const c=[];let n=[{index:o}];do{c.push(n);const t=n.flatMap((t=>e[t.index].filter((e=>s[e]&&null!=e)).map((e=>({index:e,parent:t.index}))))),r={};t.forEach(((e,t)=>{s[e.index]||(r[t]=!0),delete s[e.index]})),n=t.filter(((e,t)=>!r[t]))}while(n.length);r.push(c)}while(Object.keys(s).length);return r};var Yr=Object.freeze({__proto__:null,minimumSpanningTrees:minimumSpanningTrees});const facesSharedEdgesVertices=(e,t)=>{const r={};t.forEach((e=>{r[e]=!0}));const s=e.map((e=>r[e]?e:void 0));return rotateCircularArray(s,s.indexOf(void 0)).map(((e,t,r)=>[e,r[(t+1)%r.length]])).filter((e=>void 0!==e[0]&&void 0!==e[1]))},Xr={U:!0,u:!0},makeFacesMatrix=({vertices_coords:e,edges_vertices:t,edges_foldAngle:r,edges_assignment:s,faces_vertices:a,faces_faces:o},c)=>{!s&&r&&(s=makeEdgesAssignmentSimple({edges_foldAngle:r})),r||(r=s?makeEdgesFoldAngle({edges_assignment:s}):Array(t.length).fill(0)),o||(o=makeFacesFaces({faces_vertices:a}));const n=makeVerticesToEdge({edges_vertices:t}),i=a.map((()=>[...Jr]));return minimumSpanningTrees(o,c).forEach((t=>t.slice(1).forEach((t=>t.forEach((t=>{const o=facesSharedEdgesVertices(a[t.index],a[t.parent]).shift(),c=o.map((t=>e[t])).map(resize3),l=o.join(" "),d=n[l],_=Xr[s[d]]?Math.PI:r[d]*Math.PI/180,m=makeMatrix3Rotate(_,subtract3(c[1],c[0]),c[0]);i[t.index]=multiplyMatrices3(i[t.parent],m)})))))),i},makeFacesMatrix2=({vertices_coords:e,edges_vertices:t,edges_foldAngle:r,edges_assignment:s,faces_vertices:a,faces_faces:o},c)=>{r||(r=s?makeEdgesFoldAngle({edges_assignment:s}):Array(t.length).fill(0)),o||(o=makeFacesFaces({faces_vertices:a}));const n=makeEdgesIsFolded({edges_vertices:t,edges_foldAngle:r,edges_assignment:s}),i=makeVerticesToEdge({edges_vertices:t}),l=a.map((()=>T));return minimumSpanningTrees(o,c).forEach((t=>t.slice(1).forEach((t=>t.forEach((t=>{const r=facesSharedEdgesVertices(a[t.index],a[t.parent]).shift(),s=r.map((t=>e[t])),o=r.join(" "),c=i[o],d=subtract2(s[1],s[0]),_=resize2(s[0]),m=n[c]?makeMatrix2Reflect(d,_):T;l[t.index]=multiplyMatrices2(l[t.parent],m)})))))),l};var Kr=Object.freeze({__proto__:null,facesSharedEdgesVertices:facesSharedE
gitextract_wpm0yi8j/ ├── .eslintrc.json ├── .github/ │ └── workflows/ │ └── main.yml ├── .gitignore ├── .npmignore ├── .travis.yml ├── bundle-shaders.py ├── changelog.md ├── license ├── package.json ├── rabbit-ear.js ├── readme.md ├── rollup.config.js ├── src/ │ ├── axioms/ │ │ ├── axioms.js │ │ ├── boundary.js │ │ ├── index.js │ │ └── validate.js │ ├── convert/ │ │ ├── foldToObj.js │ │ ├── foldToSvg.js │ │ ├── foldToSvg.md │ │ ├── general/ │ │ │ ├── dom.js │ │ │ ├── options.js │ │ │ ├── planarize.js │ │ │ └── svg.js │ │ ├── index.js │ │ ├── objToFold.js │ │ ├── opxToFold.js │ │ ├── svg/ │ │ │ ├── color.js │ │ │ ├── drawBoundaries.js │ │ │ ├── drawEdges.js │ │ │ ├── drawFaces.js │ │ │ ├── drawVertices.js │ │ │ ├── index.js │ │ │ ├── parse.js │ │ │ └── stylesheet.js │ │ ├── svgToFold.js │ │ └── svgToFold.md │ ├── diagrams/ │ │ ├── arrows.js │ │ ├── axiomArrows.js │ │ ├── general.js │ │ ├── index.js │ │ └── svgArrows.js │ ├── environment/ │ │ ├── detect.js │ │ ├── messages.js │ │ └── window.js │ ├── fold/ │ │ ├── bases.js │ │ ├── colors.js │ │ ├── frames.js │ │ ├── primitives.js │ │ ├── rabbitear.js │ │ └── spec.js │ ├── general/ │ │ ├── array.js │ │ ├── clone.js │ │ ├── cluster.js │ │ ├── get.js │ │ ├── hashCode.js │ │ ├── index.js │ │ ├── number.js │ │ ├── sort.js │ │ └── string.js │ ├── graph/ │ │ ├── add/ │ │ │ ├── edge.js │ │ │ └── vertex.js │ │ ├── boundary.js │ │ ├── clean.js │ │ ├── connectedComponents.js │ │ ├── count.js │ │ ├── cycles.js │ │ ├── directedGraph.js │ │ ├── disjoint.js │ │ ├── edges/ │ │ │ ├── circular.js │ │ │ ├── duplicate.js │ │ │ ├── lines.js │ │ │ └── overlap.js │ │ ├── epsilon.js │ │ ├── explode.js │ │ ├── faces/ │ │ │ ├── facePoint.js │ │ │ ├── matrix.js │ │ │ ├── planes.js │ │ │ └── winding.js │ │ ├── flaps.js │ │ ├── fold/ │ │ │ ├── flatFold.js │ │ │ ├── flatFoldSplitFace.js │ │ │ ├── foldGraph.js │ │ │ ├── foldGraphIntoSegments.js │ │ │ ├── foldGraphIntoSubgraph.js │ │ │ └── general.js │ │ ├── index.js │ │ ├── intersect.js │ │ ├── join.js │ │ ├── make/ │ │ │ ├── edges.js │ │ │ ├── edgesAssignment.js │ │ │ ├── edgesEdges.js │ │ │ ├── edgesFaces.js │ │ │ ├── edgesFoldAngle.js │ │ │ ├── edgesVertices.js │ │ │ ├── faces.js │ │ │ ├── facesEdges.js │ │ │ ├── facesFaces.js │ │ │ ├── facesVertices.js │ │ │ ├── index.js │ │ │ ├── lookup.js │ │ │ ├── vertices.js │ │ │ ├── verticesEdges.js │ │ │ ├── verticesFaces.js │ │ │ └── verticesVertices.js │ │ ├── maps.js │ │ ├── nearest.js │ │ ├── normalize.js │ │ ├── normals.js │ │ ├── orders.js │ │ ├── overlap.js │ │ ├── planarize/ │ │ │ ├── intersectAllEdges.js │ │ │ ├── makeFacesMap.js │ │ │ ├── planarize.js │ │ │ ├── planarizeCollinearEdges.js │ │ │ ├── planarizeCollinearVertices.js │ │ │ ├── planarizeMakeFaces.js │ │ │ └── planarizeOverlaps.js │ │ ├── planarize.js │ │ ├── pleat.js │ │ ├── populate.js │ │ ├── raycast.js │ │ ├── remove.js │ │ ├── rendering.js │ │ ├── replace.js │ │ ├── split/ │ │ │ ├── general.js │ │ │ ├── splitEdge.js │ │ │ ├── splitFace.js │ │ │ ├── splitGraph.js │ │ │ └── splitLine.js │ │ ├── subgraph.js │ │ ├── sweep.js │ │ ├── symmetry.js │ │ ├── transfer.js │ │ ├── transform.js │ │ ├── trees.js │ │ ├── triangulate.js │ │ ├── validate/ │ │ │ ├── validate.js │ │ │ ├── validateAssignments.js │ │ │ ├── validateOrders.js │ │ │ ├── validateReferences.js │ │ │ ├── validateReflexive.js │ │ │ ├── validateTypes.js │ │ │ └── validateWinding.js │ │ ├── vertices/ │ │ │ ├── clusters.js │ │ │ ├── collinear.js │ │ │ ├── duplicate.js │ │ │ ├── folded.js │ │ │ ├── isolated.js │ │ │ └── sort.js │ │ └── walk.js │ ├── index.js │ ├── layer/ │ │ ├── constraints3D.js │ │ ├── constraints3DEdges.js │ │ ├── constraints3DFaces.js │ │ ├── constraintsFlat.js │ │ ├── facesSide.js │ │ ├── general.js │ │ ├── getBranches.js │ │ ├── index.js │ │ ├── initialSolutionsFlat.js │ │ ├── layer.js │ │ ├── propagate.js │ │ ├── prototype.js │ │ ├── prototypeOneDepth.js │ │ ├── solve.js │ │ ├── solver.js │ │ ├── solverOneDepth.js │ │ ├── table.js │ │ ├── tacosTortillas.js │ │ └── transitivity.js │ ├── libTypes.d.ts │ ├── math/ │ │ ├── clip.js │ │ ├── compare.js │ │ ├── constant.js │ │ ├── convert.js │ │ ├── convexHull.js │ │ ├── encloses.js │ │ ├── index.js │ │ ├── intersect.js │ │ ├── line.js │ │ ├── matrix2.js │ │ ├── matrix3.js │ │ ├── matrix4.js │ │ ├── nearest.js │ │ ├── overlap.js │ │ ├── plane.js │ │ ├── polygon.js │ │ ├── polynomial.js │ │ ├── quaternion.js │ │ ├── radial.js │ │ ├── range.js │ │ ├── straightSkeleton.js │ │ ├── triangle.js │ │ └── vector.js │ ├── prototypes/ │ │ ├── graph.js │ │ └── index.js │ ├── singleVertex/ │ │ ├── degree4.js │ │ ├── flatFoldable.js │ │ ├── foldable.js │ │ ├── index.js │ │ ├── kawasaki.js │ │ └── maekawa.js │ ├── svg/ │ │ ├── arguments/ │ │ │ ├── makeCoordinates.js │ │ │ ├── makeViewBox.js │ │ │ └── semiFlattenArrays.js │ │ ├── colors/ │ │ │ ├── convert.js │ │ │ ├── cssColors.js │ │ │ ├── index.js │ │ │ └── parseColor.js │ │ ├── constructor/ │ │ │ ├── elements.js │ │ │ ├── extensions/ │ │ │ │ ├── arc/ │ │ │ │ │ └── index.js │ │ │ │ ├── arrow/ │ │ │ │ │ ├── index.js │ │ │ │ │ ├── init.js │ │ │ │ │ ├── makeArrowPaths.js │ │ │ │ │ ├── methods.js │ │ │ │ │ └── options.js │ │ │ │ ├── circle.js │ │ │ │ ├── curve/ │ │ │ │ │ ├── arguments.js │ │ │ │ │ ├── getCurveEndpoints.js │ │ │ │ │ ├── index.js │ │ │ │ │ ├── makeCurvePath.js │ │ │ │ │ └── methods.js │ │ │ │ ├── ellipse.js │ │ │ │ ├── g.js │ │ │ │ ├── index.js │ │ │ │ ├── line.js │ │ │ │ ├── maskTypes.js │ │ │ │ ├── origami/ │ │ │ │ │ ├── index.js │ │ │ │ │ ├── init.js │ │ │ │ │ └── methods.js │ │ │ │ ├── path.js │ │ │ │ ├── polys.js │ │ │ │ ├── rect.js │ │ │ │ ├── shared/ │ │ │ │ │ ├── dom.js │ │ │ │ │ ├── makeArcPath.js │ │ │ │ │ ├── transforms.js │ │ │ │ │ └── urls.js │ │ │ │ ├── style.js │ │ │ │ ├── svg/ │ │ │ │ │ ├── animation.js │ │ │ │ │ ├── getSVGFrame.js │ │ │ │ │ ├── index.js │ │ │ │ │ ├── makeBackground.js │ │ │ │ │ ├── methods.js │ │ │ │ │ └── touch.js │ │ │ │ ├── text.js │ │ │ │ └── wedge/ │ │ │ │ └── index.js │ │ │ └── index.js │ │ ├── environment/ │ │ │ ├── detect.js │ │ │ ├── lib.js │ │ │ ├── messages.js │ │ │ ├── strings.js │ │ │ └── window.js │ │ ├── general/ │ │ │ ├── algebra.js │ │ │ ├── cdata.js │ │ │ ├── dom.js │ │ │ ├── index.js │ │ │ ├── path.js │ │ │ ├── string.js │ │ │ ├── transforms.js │ │ │ └── viewBox.js │ │ ├── index.js │ │ └── spec/ │ │ ├── classes_attributes.js │ │ ├── classes_nodes.js │ │ ├── namespace.js │ │ ├── nodes.js │ │ ├── nodes_attributes.js │ │ └── nodes_children.js │ ├── text/ │ │ ├── axioms.json │ │ ├── edge_assignments.json │ │ ├── index.js │ │ └── instructions.json │ ├── types.js │ └── webgl/ │ ├── creasePattern/ │ │ ├── arrays.js │ │ ├── data.js │ │ ├── index.js │ │ ├── models.js │ │ ├── shaders/ │ │ │ ├── cp-100.frag │ │ │ ├── cp-100.vert │ │ │ ├── cp-300.frag │ │ │ ├── cp-300.vert │ │ │ ├── thick-edges-100.vert │ │ │ └── thick-edges-300.vert │ │ ├── shaders.js │ │ └── uniforms.js │ ├── foldedForm/ │ │ ├── arrays.js │ │ ├── data.js │ │ ├── index.js │ │ ├── models.js │ │ ├── shaders/ │ │ │ ├── model-100.frag │ │ │ ├── model-100.vert │ │ │ ├── model-300.frag │ │ │ ├── model-300.vert │ │ │ ├── outlined-model-100.frag │ │ │ ├── outlined-model-100.vert │ │ │ ├── outlined-model-300.frag │ │ │ ├── outlined-model-300.vert │ │ │ ├── simple-100.frag │ │ │ ├── simple-300.frag │ │ │ ├── thick-edges-100.vert │ │ │ └── thick-edges-300.vert │ │ ├── shaders.js │ │ └── uniforms.js │ ├── general/ │ │ ├── colors.js │ │ ├── index.js │ │ ├── model.js │ │ ├── view.js │ │ └── webgl.js │ ├── index.js │ └── readme.md ├── tests/ │ ├── axioms.axioms.test.js │ ├── axioms.boundary.test.js │ ├── axioms.validate.test.js │ ├── clean.js │ ├── convert.foldToObj.test.js │ ├── convert.foldToSvg.origami.test.js │ ├── convert.foldToSvg.test.js │ ├── convert.objToFold.test.js │ ├── convert.opxToFold.test.js │ ├── convert.svgToFold.test.js │ ├── diagram.arrows.axiom.test.js │ ├── diagram.arrows.simple.test.js │ ├── diagram.general.test.js │ ├── docs.js │ ├── environment.window.test.js │ ├── files/ │ │ ├── cp/ │ │ │ ├── bird-base.cp │ │ │ ├── square-fish.cp │ │ │ └── windmill.cp │ │ ├── fold/ │ │ │ ├── abstract-graph.fold │ │ │ ├── bad-edges.fold │ │ │ ├── bird-base-3d-cp.fold │ │ │ ├── bird-base-3d.fold │ │ │ ├── bird-disjoint-edges.fold │ │ │ ├── blintz-frames.fold │ │ │ ├── bowtie.fold │ │ │ ├── command-strip-with-back.fold │ │ │ ├── command-strip.fold │ │ │ ├── crane-cp-bmvfcj-simple.fold │ │ │ ├── crane-cp-bmvfcj.fold │ │ │ ├── crane-cp.fold │ │ │ ├── crane-step.fold │ │ │ ├── crane.fold │ │ │ ├── cube-octagon.fold │ │ │ ├── cycles-3d.fold │ │ │ ├── disjoint-cps.fold │ │ │ ├── disjoint-triangles-3d.fold │ │ │ ├── fan-cp.fold │ │ │ ├── fan-flat-cp.fold │ │ │ ├── fan-folded-through-cp.fold │ │ │ ├── fish-cp-3d.fold │ │ │ ├── flat-pleat-fish.fold │ │ │ ├── invalid-box-pleat-3d.fold │ │ │ ├── invalid-key-names.fold │ │ │ ├── invalid-mismatch-length.fold │ │ │ ├── invalid-mismatch-references.fold │ │ │ ├── invalid-self-intersect.fold │ │ │ ├── invalid-single-vertex-2d.fold │ │ │ ├── invalid-single-vertex-3d.fold │ │ │ ├── isolated-line-in-face.fold │ │ │ ├── kabuto.fold │ │ │ ├── kissing-squares.fold │ │ │ ├── kraft-bird-base.fold │ │ │ ├── layer-4-flaps.fold │ │ │ ├── layer-solver-conflict.fold │ │ │ ├── layers-3d-edge-edge.fold │ │ │ ├── layers-3d-edge-face.fold │ │ │ ├── layers-cycle-nonconvex.fold │ │ │ ├── layers-flat-grid.fold │ │ │ ├── layers-zipper.fold │ │ │ ├── maze-8x8.fold │ │ │ ├── maze-s.fold │ │ │ ├── maze-u.fold │ │ │ ├── moosers-train-carriage-fourth.fold │ │ │ ├── moosers-train-carriage.fold │ │ │ ├── moosers-train-engine.fold │ │ │ ├── moosers-train.fold │ │ │ ├── nested-frames.fold │ │ │ ├── no-faces.fold │ │ │ ├── non-flat-paper.fold │ │ │ ├── non-planar-100-chaotic.fold │ │ │ ├── non-planar-100-lines.fold │ │ │ ├── non-planar-25-lines.fold │ │ │ ├── non-planar-50-chaotic.fold │ │ │ ├── non-planar-50-lines.fold │ │ │ ├── non-planar-500-chaotic.fold │ │ │ ├── non-planar-75-lines.fold │ │ │ ├── non-planar-bird-base.fold │ │ │ ├── non-planar-nonconvex.fold │ │ │ ├── non-planar-polygons.fold │ │ │ ├── non-planar-square-fish.fold │ │ │ ├── overlapping-assignments.fold │ │ │ ├── panels-3x3-invalid.fold │ │ │ ├── panels-3x3.fold │ │ │ ├── panels-4x2.fold │ │ │ ├── panels-5.fold │ │ │ ├── panels-6x2-90deg.fold │ │ │ ├── panels-simple.fold │ │ │ ├── panels-zig-zag.fold │ │ │ ├── pleats-angle-3d.fold │ │ │ ├── preliminary-offset-cp.fold │ │ │ ├── randlett-flapping-bird.fold │ │ │ ├── random-triangles-3d.fold │ │ │ ├── resch-tess.fold │ │ │ ├── separated-parallel-edges.fold │ │ │ ├── square-fish-3d.fold │ │ │ ├── square-tube-with-overlap.fold │ │ │ ├── square-twist.fold │ │ │ ├── strip-weave-concave.fold │ │ │ ├── strip-weave.fold │ │ │ ├── strip-with-angle.fold │ │ │ ├── surrounded-square.fold │ │ │ ├── triangle-strip-2.fold │ │ │ ├── triangle-strip.fold │ │ │ ├── two-bird-cp.fold │ │ │ ├── wavy-miura-no-faces.fold │ │ │ ├── windmill-no-edges.fold │ │ │ ├── windmill-variations.fold │ │ │ └── windmill.fold │ │ ├── json/ │ │ │ ├── crane-faces-edges-overlap.json │ │ │ ├── crane-faces-faces-overlap.json │ │ │ ├── crane-layer-solver-no-depth.json │ │ │ ├── crane-layer-solver.json │ │ │ ├── cube-octagon-constraints.json │ │ │ ├── kabuto-constraints.json │ │ │ ├── kabuto-faces-faces-overlap.json │ │ │ ├── kabuto-layer-solver-no-depth.json │ │ │ ├── kabuto-layer-solver.json │ │ │ ├── kraft-bird-faces-faces-overlap.json │ │ │ ├── layer-table.json │ │ │ ├── maze-u-constraints.json │ │ │ ├── panels-3x3-layer-solver-no-depth.json │ │ │ ├── panels-3x3-layer-solver.json │ │ │ └── randlett-flapping-bird-layer-solver.json │ │ ├── obj/ │ │ │ ├── sphere-with-holes.obj │ │ │ └── stanford-bunny.obj │ │ └── opx/ │ │ ├── bird-base-2012.opx │ │ ├── bird-base.opx │ │ ├── one-crease.opx │ │ ├── square-fish.opx │ │ ├── test.opx │ │ └── windmill.opx │ ├── fold.bases.test.js │ ├── fold.colors.test.js │ ├── fold.frames.test.js │ ├── fold.spec.test.js │ ├── general.array.test.js │ ├── general.cluster.test.js │ ├── general.get.test.js │ ├── general.hashCode.test.js │ ├── general.number.test.js │ ├── general.sort.test.js │ ├── general.string.test.js │ ├── generate.test.js │ ├── graph.add.edge.test.js │ ├── graph.add.vertex.test.js │ ├── graph.boundary.test.js │ ├── graph.clean.test.js │ ├── graph.connectedComponents.test.js │ ├── graph.count.test.js │ ├── graph.countImplied.test.js │ ├── graph.cycles.test.js │ ├── graph.directedGraph.test.js │ ├── graph.disjoint.test.js │ ├── graph.edges.circular.test.js │ ├── graph.edges.duplicate.test.js │ ├── graph.edges.lines.test.js │ ├── graph.edges.overlap.test.js │ ├── graph.explode.test.js │ ├── graph.faces.facePoint.test.js │ ├── graph.faces.matrix.test.js │ ├── graph.faces.planes.getFacesPlane.test.js │ ├── graph.faces.planes.overlapping.test.js │ ├── graph.faces.winding.test.js │ ├── graph.flaps.test.js │ ├── graph.fold.flatFold.test.js │ ├── graph.fold.foldGraph.layers.test.js │ ├── graph.fold.foldGraph.test.js │ ├── graph.fold.foldGraphIntoSegments.test.js │ ├── graph.fold.foldGraphIntoSubgraph.test.js │ ├── graph.intersect.test.js │ ├── graph.intersect.vertices.test.js │ ├── graph.join.test.js │ ├── graph.make.edges.test.js │ ├── graph.make.edgesEdges.test.js │ ├── graph.make.edgesFaces.test.js │ ├── graph.make.facesFaces.test.js │ ├── graph.make.facesMatrix.test.js │ ├── graph.make.facesVertices.test.js │ ├── graph.make.facesWinding.test.js │ ├── graph.make.lookup.test.js │ ├── graph.make.verticesEdges.test.js │ ├── graph.make.verticesFaces.test.js │ ├── graph.make.verticesVertices.test.js │ ├── graph.maps.test.js │ ├── graph.nearest.test.js │ ├── graph.normalize.test.js │ ├── graph.normals.test.js │ ├── graph.orders.test.js │ ├── graph.overlap.components.test.js │ ├── graph.overlap.edgesEdges.test.js │ ├── graph.overlap.facesEdges.test.js │ ├── graph.overlap.facesFaces.test.js │ ├── graph.planarize.collinearEdges.test.js │ ├── graph.planarize.faceMap.test.js │ ├── graph.planarize.intersect.test.js │ ├── graph.planarize.new.test.js │ ├── graph.planarize.test.js │ ├── graph.planarizeOverlap.test.js │ ├── graph.pleat.test.js │ ├── graph.populate.test.js │ ├── graph.remove.test.js │ ├── graph.rendering.test.js │ ├── graph.replace.test.js │ ├── graph.split.splitEdge.test.js │ ├── graph.split.splitFace.test.js │ ├── graph.split.splitGraph.test.js │ ├── graph.split.splitLine.test.js │ ├── graph.subgraph.test.js │ ├── graph.sweep.test.js │ ├── graph.symmetry.test.js │ ├── graph.transfer.test.js │ ├── graph.transform.test.js │ ├── graph.trees.test.js │ ├── graph.triangulate.test.js │ ├── graph.validate.test.js │ ├── graph.vertices.clusters.test.js │ ├── graph.vertices.collinear.test.js │ ├── graph.vertices.duplicate.test.js │ ├── graph.vertices.folded.test.js │ ├── graph.vertices.isolated.test.js │ ├── graph.vertices.sort.test.js │ ├── graph.walk.test.js │ ├── index.html │ ├── layer.constraints3DEdges.edgesFaces.test.js │ ├── layer.constraints3DEdges.test.js │ ├── layer.constraints3DFaces.test.js │ ├── layer.constraints3d.test.js │ ├── layer.constraintsFlat.test.js │ ├── layer.facesSide.test.js │ ├── layer.general.test.js │ ├── layer.initialSolution.test.js │ ├── layer.layer.solveLayerOrders.test.js │ ├── layer.layer.solveLayerOrders3D.test.js │ ├── layer.propagate.test.js │ ├── layer.prototype.test.js │ ├── layer.solver.2D.test.js │ ├── layer.solver.3D.test.js │ ├── layer.table.test.js │ ├── layer.transitivity.test.js │ ├── lineno.js │ ├── math.algebra.matrix2.test.js │ ├── math.algebra.matrix3.test.js │ ├── math.algebra.matrix4.test.js │ ├── math.algebra.quaternion.test.js │ ├── math.algebra.vector.resize.test.js │ ├── math.algebra.vector.test.js │ ├── math.debug.test.js │ ├── math.general.array.test.js │ ├── math.general.constant.test.js │ ├── math.general.convert.test.js │ ├── math.general.function.test.js │ ├── math.general.get.test.js │ ├── math.general.sort.test.js │ ├── math.general.typeof.test.js │ ├── math.geometry.convexHull.test.js │ ├── math.geometry.line.test.js │ ├── math.geometry.nearest.test.js │ ├── math.geometry.polygon.test.js │ ├── math.geometry.radial.test.js │ ├── math.geometry.straightSkeleton.test.js │ ├── math.geometry.triangle.test.js │ ├── math.intersect.clip.line.test.js │ ├── math.intersect.clip.polygon.test.js │ ├── math.intersect.encloses.test.js │ ├── math.intersect.method.test.js │ ├── math.intersect.overlap.test.js │ ├── math.intersect.polyLine.test.js │ ├── math.intersect.split.test.js │ ├── math.intersect.test.js │ ├── math.overlap.test.js │ ├── math.primitives.circle.test.js │ ├── math.primitives.clip.test.js │ ├── math.primitives.ellipse.test.js │ ├── math.primitives.json.test.js │ ├── math.primitives.junction.test.js │ ├── math.primitives.line.test.js │ ├── math.primitives.matrix.test.js │ ├── math.primitives.paths.test.js │ ├── math.primitives.polygon.test.js │ ├── math.primitives.rect.test.js │ ├── math.primitives.types.test.js │ ├── math.primitives.vector.test.js │ ├── math.range.test.js │ ├── prototypes.cp.test.js │ ├── prototypes.graph.test.js │ ├── prototypes.static.test.js │ ├── singleVertex.degree4.test.js │ ├── singleVertex.flatFoldable.test.js │ ├── singleVertex.foldable.test.js │ ├── singleVertex.kawasaki.test.js │ ├── singleVertex.maekawa.test.js │ ├── svg.arrow.test.js │ ├── svg.attributes.test.js │ ├── svg.circle.test.js │ ├── svg.class.id.test.js │ ├── svg.colors.test.js │ ├── svg.coordinates.test.js │ ├── svg.dom.test.js │ ├── svg.ellipse.test.js │ ├── svg.environment.test.js │ ├── svg.line.test.js │ ├── svg.nodes.test.js │ ├── svg.object.assign.test.js │ ├── svg.path.test.js │ ├── svg.polygon.test.js │ ├── svg.primitives.test.js │ ├── svg.rect.test.js │ ├── svg.stylesheet.test.js │ ├── svg.svg.animation.test.js │ ├── svg.svg.args.test.js │ ├── svg.svg.background.test.js │ ├── svg.svg.controls.test.js │ ├── svg.svg.load.test.js │ ├── svg.svg.save.test.js │ ├── svg.svg.viewbox.test.js │ ├── svg.transforms.test.js │ ├── svg.types.test.js │ ├── svg.urls.test.js │ ├── svg.use.test.js │ ├── svg.window.test.js │ └── webgl.initialize.test.js ├── tsconfig.json └── typedoc.config.json
SYMBOL INDEX (53 symbols across 13 files)
FILE: bundle-shaders.py
function makeNamedExport (line 27) | def makeNamedExport(file, path):
function makeBundle (line 39) | def makeBundle(files, path):
FILE: src/convert/foldToSvg.js
constant DEFAULT_CIRCLE_RADIUS (line 44) | const DEFAULT_CIRCLE_RADIUS = 1 / 50;
FILE: src/convert/svg/drawBoundaries.js
constant BOUNDARY_FOLDED (line 14) | const BOUNDARY_FOLDED = {
constant BOUNDARY_CP (line 17) | const BOUNDARY_CP = {
FILE: src/convert/svg/drawEdges.js
constant GROUP_STYLE (line 32) | const GROUP_STYLE = {
constant EDGE_STYLE (line 40) | const EDGE_STYLE = {
FILE: src/convert/svg/drawFaces.js
constant FACE_STYLE (line 20) | const FACE_STYLE = {
constant GROUP_STYLE (line 37) | const GROUP_STYLE = {
FILE: src/fold/colors.js
constant DESATURATION_RATIO (line 33) | const DESATURATION_RATIO = 4;
FILE: src/fold/spec.js
constant VEF (line 102) | const VEF = ["vertices", "edges", "faces"];
FILE: src/graph/rendering.js
constant LAYER_NUDGE (line 46) | const LAYER_NUDGE = 5e-6;
FILE: src/libTypes.d.ts
type FOLDFrame (line 1) | type FOLDFrame = {
type FOLDInternalFrame (line 23) | type FOLDInternalFrame = FOLDFrame & {
type FOLDFileMetadata (line 27) | type FOLDFileMetadata = {
type FOLDOutOfSpec (line 36) | type FOLDOutOfSpec = {
type FOLD (line 45) | type FOLD = FOLDFileMetadata & FOLDFrame;
type FOLDExtended (line 46) | type FOLDExtended = FOLD & FOLDOutOfSpec;
type VecLine2 (line 47) | type VecLine2 = {
type VecLine3 (line 51) | type VecLine3 = {
type VecLine (line 55) | type VecLine = {
type UniqueLine (line 59) | type UniqueLine = {
type Box (line 63) | type Box = {
type Circle (line 68) | type Circle = {
type SweepEvent (line 72) | type SweepEvent = {
type LineLineEvent (line 81) | type LineLineEvent = {
type FaceVertexEvent (line 89) | type FaceVertexEvent = {
type FaceEdgeEvent (line 96) | type FaceEdgeEvent = {
type FacePointEvent (line 105) | type FacePointEvent = {
type WebGLVertexArray (line 110) | type WebGLVertexArray = {
type WebGLElementArray (line 117) | type WebGLElementArray = {
type WebGLUniform (line 122) | type WebGLUniform = {
type WebGLModel (line 126) | type WebGLModel = {
type Arrow (line 135) | type Arrow = {
type TacoTacoConstraint (line 142) | type TacoTacoConstraint = [number, number, number, number];
type TacoTortillaConstraint (line 143) | type TacoTortillaConstraint = [number, number, number];
type TortillaTortillaConstraint (line 144) | type TortillaTortillaConstraint = [number, number, number, number];
type TransitivityConstraint (line 145) | type TransitivityConstraint = [number, number, number];
type LayerBranch (line 146) | type LayerBranch = LayerFork[];
type LayerOrders (line 147) | type LayerOrders = {
type LayerFork (line 150) | type LayerFork = {
type LayerSolverSolution (line 154) | type LayerSolverSolution = LayerFork;
type FaceOrdersBranch (line 155) | type FaceOrdersBranch = FaceOrdersFork[];
type FaceOrders (line 156) | type FaceOrders = [number, number, number][];
type FaceOrdersFork (line 157) | type FaceOrdersFork = {
type FaceOrdersSolverSolution (line 161) | type FaceOrdersSolverSolution = FaceOrdersFork;
FILE: src/math/constant.js
constant EPSILON (line 10) | const EPSILON = 1e-6;
constant R2D (line 17) | const R2D = 180 / Math.PI;
constant D2R (line 24) | const D2R = Math.PI / 180;
constant TWO_PI (line 31) | const TWO_PI = Math.PI * 2;
FILE: src/svg/index.js
constant SVG (line 27) | const SVG = Object.assign(svg, library);
FILE: tests/graph.fold.foldGraph.layers.test.js
constant FOLD_ANGLE (line 5) | const FOLD_ANGLE = 90;
FILE: tests/graph.fold.foldGraph.test.js
constant FOLD_ANGLE (line 5) | const FOLD_ANGLE = 90;
Condensed preview — 632 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (3,258K chars).
[
{
"path": ".eslintrc.json",
"chars": 1171,
"preview": "{\n \"env\": {\n \"browser\": true,\n \"es2021\": true,\n \"node\": true\n },\n \"extends\": \"airbnb-base\",\n \"ignores\": [\"*"
},
{
"path": ".github/workflows/main.yml",
"chars": 559,
"preview": "name: CI\n\non:\n # Triggers the workflow on push or pull request events but only for the main branch\n push:\n branches"
},
{
"path": ".gitignore",
"chars": 96,
"preview": "*.DS_Store\nnode_modules/\ncoverage/\ndocs/\nmodule/\ntests/tmp/\ntypes/\npackage-lock.json\n*.d.ts.map\n"
},
{
"path": ".npmignore",
"chars": 205,
"preview": ".DS_Store\n.eslintrc.js\n.git\n.gitignore\n.travis.yml\n\ncoverage/\ndocs/\nsrc/\ntests/\n\nbuild-shaders.py\nchangelog.md\ncontribut"
},
{
"path": ".travis.yml",
"chars": 36,
"preview": "language: node_js\nnode_js:\n - lts/*"
},
{
"path": "bundle-shaders.py",
"chars": 1862,
"preview": "# due to the issues around loading raw text files,\n# this bundler will convert the shader files into an\n# es6 Javascript"
},
{
"path": "changelog.md",
"chars": 7059,
"preview": "# 0.9.33 alpha\n\n`pleat()` when given parallel lines will now correct for the case when the lines' vectors point in the o"
},
{
"path": "license",
"chars": 35129,
"preview": " GNU GENERAL PUBLIC LICENSE\n Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation"
},
{
"path": "package.json",
"chars": 1671,
"preview": "{\n\t\"name\": \"rabbit-ear\",\n\t\"version\": \"0.9.4\",\n\t\"description\": \"origami design library\",\n\t\"exports\": {\n\t\t\".\": {\n\t\t\t\"impor"
},
{
"path": "rabbit-ear.js",
"chars": 288989,
"preview": "/* Rabbit Ear 0.9.4 alpha 2024-04-20 (c) Kraft, GNU GPLv3 License */\n!function(e,t){\"object\"==typeof exports&&\"undefined"
},
{
"path": "readme.md",
"chars": 1279,
"preview": "# Rabbit Ear\n\nThis is a Javascript library for modeling origami.\n\n# overview\n\nThis library assists in encoding, modifyin"
},
{
"path": "rollup.config.js",
"chars": 1681,
"preview": "import cleanup from \"rollup-plugin-cleanup\";\nimport terser from \"@rollup/plugin-terser\";\n\nconst version = \"0.9.4 alpha 2"
},
{
"path": "src/axioms/axioms.js",
"chars": 13152,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"../math/constant.js\";\nimport {\n\tvecLineToUniqueLine,\n\tuniqueL"
},
{
"path": "src/axioms/boundary.js",
"chars": 7473,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\taxiom1,\n\taxiom2,\n\taxiom3,\n\taxiom4,\n\taxiom5,\n\taxiom6,\n\taxiom7,\n\tnormalAxiom1,\n\t"
},
{
"path": "src/axioms/index.js",
"chars": 243,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\n\nimport * as Axioms from \"./axioms.js\";\nimport * as AxiomsBoundary from \"./boundary.js\";"
},
{
"path": "src/axioms/validate.js",
"chars": 10791,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tinclude,\n\tincludeL,\n\tincludeS,\n} from \"../math/compare.js\";\nimport {\n\tsubtract"
},
{
"path": "src/convert/foldToObj.js",
"chars": 2228,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\n\n/**\n * @description if they exist, get any title, author, or description\n * metadata, c"
},
{
"path": "src/convert/foldToSvg.js",
"chars": 9121,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport window from \"../environment/window.js\";\nimport SVG from \"../svg/index.js\";\nimport"
},
{
"path": "src/convert/foldToSvg.md",
"chars": 2961,
"preview": "# FOLD to SVG conversion\n\nrender a FOLD object into an SVG. This includes interpreting the origami as a crease pattern o"
},
{
"path": "src/convert/general/dom.js",
"chars": 523,
"preview": "import window from \"../../environment/window.js\";\n\nexport const invisibleParent = (child) => {\n\tif (!window().document.b"
},
{
"path": "src/convert/general/options.js",
"chars": 1738,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport { getEpsilon } from \"../../graph/epsilon.js\";\nimport { boundingBox } from \"../../"
},
{
"path": "src/convert/general/planarize.js",
"chars": 772,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tplanarize,\n} from \"../../graph/planarize.js\";\nimport {\n\tmakeVerticesVertices,\n"
},
{
"path": "src/convert/general/svg.js",
"chars": 3184,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport { boundingBox } from \"../../graph/boundary.js\";\nimport { makeEdgesLength } from \""
},
{
"path": "src/convert/index.js",
"chars": 682,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport * as objToFold from \"./objToFold.js\";\nimport * as opxToFold from \"./opxToFold.js\""
},
{
"path": "src/convert/objToFold.js",
"chars": 3913,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tfile_spec,\n\tfile_creator,\n} from \"../fold/rabbitear.js\";\nimport {\n\tmakeVertice"
},
{
"path": "src/convert/opxToFold.js",
"chars": 7411,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport RabbitEarWindow from \"../environment/window.js\";\nimport {\n\tplanarizeGraph,\n} from"
},
{
"path": "src/convert/svg/color.js",
"chars": 1645,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport window from \"../../environment/window.js\";\nimport {\n\trgbToAssignment,\n} from \"../"
},
{
"path": "src/convert/svg/drawBoundaries.js",
"chars": 1221,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport SVG from \"../../svg/index.js\";\nimport { addClass } from \"../../svg/general/dom.js"
},
{
"path": "src/convert/svg/drawEdges.js",
"chars": 11137,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tassignmentFlatFoldAngle,\n\tedgesFoldAngleAreAllFlat,\n\tedgesAssignmentNames,\n\tis"
},
{
"path": "src/convert/svg/drawFaces.js",
"chars": 5366,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport { isFoldedForm } from \"../../fold/spec.js\";\nimport { makeFacesWinding } from \"../"
},
{
"path": "src/convert/svg/drawVertices.js",
"chars": 759,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport SVG from \"../../svg/index.js\";\nimport { setKeysAndValues } from \"../general/svg.j"
},
{
"path": "src/convert/svg/index.js",
"chars": 476,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport * as color from \"./color.js\";\nimport * as drawBoundaries from \"./drawBoundaries.j"
},
{
"path": "src/convert/svg/parse.js",
"chars": 3322,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tepsilonEqualVectors,\n} from \"../../math/compare.js\";\nimport {\n\tparsePathComman"
},
{
"path": "src/convert/svg/stylesheet.js",
"chars": 3960,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport window from \"../../environment/window.js\";\nimport {\n\tgetRootParent,\n} from \"../.."
},
{
"path": "src/convert/svgToFold.js",
"chars": 10753,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport window from \"../environment/window.js\";\nimport Messages from \"../environment/mess"
},
{
"path": "src/convert/svgToFold.md",
"chars": 2817,
"preview": "# SVG to FOLD\n\nConvert an SVG image into a FOLD object.\n\n```typescript\nfunction svgToFold(svg: (string | SVGElement), op"
},
{
"path": "src/diagrams/arrows.js",
"chars": 4210,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tconvexHull,\n} from \"../math/convexHull.js\";\nimport {\n\tmagnitude2,\n\tdot2,\n\tsubt"
},
{
"path": "src/diagrams/axiomArrows.js",
"chars": 8652,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tincludeS,\n} from \"../math/compare.js\";\nimport {\n\tpointsToLine2,\n} from \"../mat"
},
{
"path": "src/diagrams/general.js",
"chars": 6745,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tincludeR,\n\tincludeS,\n} from \"../math/compare.js\";\nimport {\n\tnormalize2,\n\tdot2,"
},
{
"path": "src/diagrams/index.js",
"chars": 170,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport * as arrows from \"./arrows.js\";\nimport * as axiomArrows from \"./axiomArrows.js\";\n"
},
{
"path": "src/diagrams/svgArrows.js",
"chars": 847,
"preview": "// /**\n// * Rabbit Ear (c) Kraft\n// */\n// import {\n// \tfoldLineArrow,\n// \taxiom1Arrows,\n// \taxiom2Arrows,\n// \taxiom3Ar"
},
{
"path": "src/environment/detect.js",
"chars": 599,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\n\nconst isBrowser = typeof window === \"object\"\n\t&& typeof window.document === \"object\";\n\n"
},
{
"path": "src/environment/messages.js",
"chars": 913,
"preview": "export default {\n\tplanarize: \"graph could not planarize\",\n\tmanifold: \"valid manifold required\",\n\tgraphCycle: \"cycle not "
},
{
"path": "src/environment/window.js",
"chars": 2084,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\n\n/**\n * maintain one \"window\" object for both browser and nodejs.\n * if a browser window"
},
{
"path": "src/fold/bases.js",
"chars": 7143,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tpopulate,\n} from \"../graph/populate.js\";\n\n/**\n * @description Create a blintz "
},
{
"path": "src/fold/colors.js",
"chars": 3528,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tmagnitude3,\n\tdistance3,\n\tscale3,\n} from \"../math/vector.js\";\n\n/**\n * @descript"
},
{
"path": "src/fold/frames.js",
"chars": 4776,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport Messages from \"../environment/messages.js\";\nimport {\n\tclone,\n} from \"../general/c"
},
{
"path": "src/fold/primitives.js",
"chars": 2637,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tmakePolygonCircumradius,\n} from \"../math/polygon.js\";\nimport {\n\tpopulate,\n} fr"
},
{
"path": "src/fold/rabbitear.js",
"chars": 105,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\n\nexport const file_spec = 1.2;\nexport const file_creator = \"Rabbit Ear\";\n"
},
{
"path": "src/fold/spec.js",
"chars": 17854,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"../math/constant.js\";\nimport {\n\tepsilonEqual,\n} from \"../math"
},
{
"path": "src/general/array.js",
"chars": 11440,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"../math/constant.js\";\nimport {\n\tepsilonEqual,\n} from \"../math"
},
{
"path": "src/general/clone.js",
"chars": 1189,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\n\n/**\n * @description This is a polyfill for \"structuredClone\"\n * similar to running JSON"
},
{
"path": "src/general/cluster.js",
"chars": 8943,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"../math/constant.js\";\nimport {\n\tnormalize,\n\tparallelNormalize"
},
{
"path": "src/general/get.js",
"chars": 7499,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\n// import { distance2 } from \"../algebra/vector.js\";\n// import { identity2x3 } from \"../"
},
{
"path": "src/general/hashCode.js",
"chars": 485,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\n\n/**\n * @description a javascript re-implementation of Java's .hashCode()\n * https://sta"
},
{
"path": "src/general/index.js",
"chars": 434,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport * as arrayMethods from \"./array.js\";\nimport * as clusterMethods from \"./cluster.j"
},
{
"path": "src/general/number.js",
"chars": 1131,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\n\n/**\n * @description Count the number of places deep past the decimal point.\n * @param {"
},
{
"path": "src/general/sort.js",
"chars": 4511,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tnormalize2,\n\tdot,\n\tsubtract,\n\tbasisVectors3,\n} from \"../math/vector.js\";\nimpor"
},
{
"path": "src/general/string.js",
"chars": 912,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\n\n/**\n * @description Convert a string into camel case from kebab or snake case.\n * @para"
},
{
"path": "src/graph/add/edge.js",
"chars": 4734,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\n\n/**\n * @description Add an edge to a graph, and only update the edges_ properties,\n * m"
},
{
"path": "src/graph/add/vertex.js",
"chars": 2603,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\n\n/**\n * @description Add a vertex to the graph by setting its coordinates.\n * This metho"
},
{
"path": "src/graph/boundary.js",
"chars": 15402,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tboundingBox as BoundingBox,\n} from \"../math/polygon.js\";\nimport {\n\tassignmentI"
},
{
"path": "src/graph/clean.js",
"chars": 1827,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tremoveDuplicateVertices,\n} from \"./vertices/duplicate.js\";\nimport {\n\tremoveIso"
},
{
"path": "src/graph/connectedComponents.js",
"chars": 3254,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\n\n/**\n * @description Given a self-relational array of arrays, for example,\n * vertices_v"
},
{
"path": "src/graph/count.js",
"chars": 4765,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tfilterKeysWithPrefix,\n\tfilterKeysWithSuffix,\n} from \"../fold/spec.js\";\n\nconst "
},
{
"path": "src/graph/cycles.js",
"chars": 5358,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\ttopologicalSort,\n} from \"./directedGraph.js\";\nimport {\n\tmakeFacesWinding,\n} fr"
},
{
"path": "src/graph/directedGraph.js",
"chars": 2113,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tuniqueSortedNumbers,\n} from \"../general/array.js\";\nimport {\n\tinvertFlatMap,\n} "
},
{
"path": "src/graph/disjoint.js",
"chars": 3921,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tfilterKeysWithPrefix,\n} from \"../fold/spec.js\";\nimport {\n\tuniqueElements,\n} fr"
},
{
"path": "src/graph/edges/circular.js",
"chars": 2760,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport { filterKeysWithSuffix } from \"../../fold/spec.js\";\nimport { remove } from \"../re"
},
{
"path": "src/graph/edges/duplicate.js",
"chars": 5344,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"../../math/constant.js\";\nimport {\n\tmakeVerticesEdgesUnsorted,"
},
{
"path": "src/graph/edges/lines.js",
"chars": 16561,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"../../math/constant.js\";\nimport {\n\tepsilonEqualVectors,\n} fro"
},
{
"path": "src/graph/edges/overlap.js",
"chars": 2003,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"../../math/constant.js\";\nimport {\n\tepsilonEqual,\n\texcludeS,\n}"
},
{
"path": "src/graph/epsilon.js",
"chars": 1858,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tboundingBox,\n} from \"./boundary.js\";\nimport {\n\tdistance,\n} from \"../math/vecto"
},
{
"path": "src/graph/explode.js",
"chars": 4132,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tgetDimensionQuick,\n} from \"../fold/spec.js\";\nimport {\n\tresize2,\n\tresize3,\n} fr"
},
{
"path": "src/graph/faces/facePoint.js",
"chars": 3952,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tinclude,\n\texclude,\n} from \"../../math/compare.js\";\nimport {\n\tadd2,\n\tscale2,\n} "
},
{
"path": "src/graph/faces/matrix.js",
"chars": 7301,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tmakeEdgesIsFolded,\n} from \"../../fold/spec.js\";\nimport {\n\tsubtract2,\n\tsubtract"
},
{
"path": "src/graph/faces/planes.js",
"chars": 14802,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"../../math/constant.js\";\nimport {\n\tdot,\n\tdot3,\n\tscale3,\n\tresi"
},
{
"path": "src/graph/faces/winding.js",
"chars": 1748,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\n\n/**\n * @description For every face, return a boolean if the face's vertices are\n * in c"
},
{
"path": "src/graph/flaps.js",
"chars": 4157,
"preview": "// /**\n// * Rabbit Ear (c) Kraft\n// */\n// import {\n// \tEPSILON,\n// } from \"../math/constant.js\";\n// import {\n// \texclu"
},
{
"path": "src/graph/fold/flatFold.js",
"chars": 15024,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"../../math/constant.js\";\nimport {\n\tmagnitude2,\n\tnormalize2,\n\t"
},
{
"path": "src/graph/fold/flatFoldSplitFace.js",
"chars": 19904,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport Messages from \"../../environment/messages.js\";\nimport { EPSILON } from \"../../mat"
},
{
"path": "src/graph/fold/foldGraph.js",
"chars": 12398,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"../../math/constant.js\";\nimport {\n\tincludeL,\n\tincludeR,\n\tincl"
},
{
"path": "src/graph/fold/foldGraphIntoSegments.js",
"chars": 4497,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"../../math/constant.js\";\nimport {\n\tincludeL,\n} from \"../../ma"
},
{
"path": "src/graph/fold/foldGraphIntoSubgraph.js",
"chars": 6260,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"../../math/constant.js\";\nimport {\n\tincludeL,\n} from \"../../ma"
},
{
"path": "src/graph/fold/general.js",
"chars": 11159,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tedgeFoldAngleIsFlatFolded,\n} from \"../../fold/spec.js\";\nimport {\n\tepsilonEqual"
},
{
"path": "src/graph/index.js",
"chars": 4833,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport * as foldColors from \"../fold/colors.js\";\nimport * as foldFileFrames from \"../fol"
},
{
"path": "src/graph/intersect.js",
"chars": 16438,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"../math/constant.js\";\nimport {\n\texclude,\n\tincludeL,\n\tincludeS"
},
{
"path": "src/graph/join.js",
"chars": 7018,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tcount,\n} from \"./count.js\";\nimport {\n\tclone,\n} from \"../general/clone.js\";\nimp"
},
{
"path": "src/graph/make/edges.js",
"chars": 2437,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tsubtract,\n\tmagnitude,\n\tresize2,\n\tresize3,\n} from \"../../math/vector.js\";\nimpor"
},
{
"path": "src/graph/make/edgesAssignment.js",
"chars": 1718,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tmakeFacesEdgesFromVertices,\n} from \"./facesEdges.js\";\nimport {\n\tmakeEdgesFaces"
},
{
"path": "src/graph/make/edgesEdges.js",
"chars": 652,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\n\n/**\n * @description Make `edges_edges` containing all vertex-adjacent edges.\n * This wi"
},
{
"path": "src/graph/make/edgesFaces.js",
"chars": 3585,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tsubtract2,\n\tcross2,\n} from \"../../math/vector.js\";\nimport {\n\tcountImpliedEdges"
},
{
"path": "src/graph/make/edgesFoldAngle.js",
"chars": 3359,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport Messages from \"../../environment/messages.js\";\nimport {\n\tnormalize,\n\tdot,\n\tsubtra"
},
{
"path": "src/graph/make/edgesVertices.js",
"chars": 590,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\n\n/**\n * @description Create edges_vertices from faces_vertices\n * @param {FOLD} graph a "
},
{
"path": "src/graph/make/faces.js",
"chars": 6033,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tgetDimensionQuick,\n} from \"../../fold/spec.js\";\nimport {\n\tmakePolygonNonCollin"
},
{
"path": "src/graph/make/facesEdges.js",
"chars": 572,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tmakeVerticesToEdge,\n} from \"./lookup.js\";\n\n/**\n * @description Make `faces_edg"
},
{
"path": "src/graph/make/facesFaces.js",
"chars": 4334,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\n\n/**\n * @description faces_faces is an array of edge-adjacent face indices for each face"
},
{
"path": "src/graph/make/facesVertices.js",
"chars": 535,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\n\n/**\n * @description Make `faces_vertices` from `faces_edges`.\n * @param {FOLD} graph a "
},
{
"path": "src/graph/make/index.js",
"chars": 1151,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport * as makeEdges from \"./edges.js\";\nimport * as makeEdgesAssignment from \"./edgesAs"
},
{
"path": "src/graph/make/lookup.js",
"chars": 2976,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\n\n/**\n * @description Consider an array of arrays of indices to each be cyclical,\n * conv"
},
{
"path": "src/graph/make/vertices.js",
"chars": 2671,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tTWO_PI,\n} from \"../../math/constant.js\";\nimport {\n\tresize2,\n\tflip2,\n} from \".."
},
{
"path": "src/graph/make/verticesEdges.js",
"chars": 1562,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tmakeVerticesToEdge,\n} from \"./lookup.js\";\n\n/**\n * @description Make `vertices_"
},
{
"path": "src/graph/make/verticesFaces.js",
"chars": 2704,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tcountImpliedVertices,\n} from \"../count.js\";\nimport {\n\tmakeVerticesToFace,\n} fr"
},
{
"path": "src/graph/make/verticesVertices.js",
"chars": 8203,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tmakeVerticesEdgesUnsorted,\n} from \"./verticesEdges.js\";\nimport {\n\tmakeVertices"
},
{
"path": "src/graph/maps.js",
"chars": 6427,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tfilterKeysWithSuffix,\n\tfilterKeysWithPrefix,\n} from \"../fold/spec.js\";\n\n/**\n *"
},
{
"path": "src/graph/nearest.js",
"chars": 3887,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tsubtract2,\n\tsubtract3,\n\tdistance,\n\tresize,\n} from \"../math/vector.js\";\nimport "
},
{
"path": "src/graph/normalize.js",
"chars": 1039,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tremapKey,\n} from \"./maps.js\";\n\n/**\n * @description This method will re-index a"
},
{
"path": "src/graph/normals.js",
"chars": 2621,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tnormalize3,\n\tcross3,\n\tsubtract3,\n\tparallel,\n\tresize3,\n} from \"../math/vector.j"
},
{
"path": "src/graph/orders.js",
"chars": 14572,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tdot,\n\tresize3,\n} from \"../math/vector.js\";\nimport {\n\tuniqueSortedNumbers,\n} fr"
},
{
"path": "src/graph/overlap.js",
"chars": 13801,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"../math/constant.js\";\nimport {\n\texclude,\n\texcludeS,\n} from \"."
},
{
"path": "src/graph/planarize/intersectAllEdges.js",
"chars": 1465,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"../../math/constant.js\";\nimport {\n\tincludeS,\n\tepsilonEqual,\n}"
},
{
"path": "src/graph/planarize/makeFacesMap.js",
"chars": 3935,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tchooseTwoPairs,\n\tuniqueElements,\n} from \"../../general/array.js\";\nimport {\n\tco"
},
{
"path": "src/graph/planarize/planarize.js",
"chars": 6719,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"../../math/constant.js\";\nimport {\n\tinvertArrayMap,\n\tmergeNext"
},
{
"path": "src/graph/planarize/planarizeCollinearEdges.js",
"chars": 10013,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"../../math/constant.js\";\nimport {\n\tepsilonEqual,\n} from \"../."
},
{
"path": "src/graph/planarize/planarizeCollinearVertices.js",
"chars": 3521,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"../../math/constant.js\";\nimport {\n\tisVertexCollinear,\n\t// rem"
},
{
"path": "src/graph/planarize/planarizeMakeFaces.js",
"chars": 5912,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tmakePlanarFaces,\n} from \"../make/faces.js\";\nimport {\n\tarrayIntersection,\n} fro"
},
{
"path": "src/graph/planarize/planarizeOverlaps.js",
"chars": 4707,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"../../math/constant.js\";\nimport {\n\tepsilonEqual,\n} from \"../."
},
{
"path": "src/graph/planarize.js",
"chars": 10340,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"../math/constant.js\";\nimport {\n\tincludeS,\n} from \"../math/com"
},
{
"path": "src/graph/pleat.js",
"chars": 3444,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"../math/constant.js\";\nimport {\n\tincludeL,\n\tincludeS,\n} from \""
},
{
"path": "src/graph/populate.js",
"chars": 7865,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tmakeVerticesVertices,\n} from \"./make/verticesVertices.js\";\nimport {\n\tmakeVerti"
},
{
"path": "src/graph/raycast.js",
"chars": 344,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\n\n/**\n * @todo\n * @description Cast a ray and intersect a FOLD mesh, return\n * the inters"
},
{
"path": "src/graph/remove.js",
"chars": 2140,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tcount,\n} from \"./count.js\";\nimport {\n\tuniqueSortedNumbers,\n} from \"../general/"
},
{
"path": "src/graph/rendering.js",
"chars": 6917,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tscale3,\n\tadd3,\n\tresize3,\n} from \"../math/vector.js\";\nimport {\n\tinvertMatrix4,\n"
},
{
"path": "src/graph/replace.js",
"chars": 2930,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport { uniqueSortedNumbers } from \"../general/array.js\";\nimport Messages from \"../envi"
},
{
"path": "src/graph/split/general.js",
"chars": 4605,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tuniqueElements,\n} from \"../../general/array.js\";\n\n/**\n * @description create a"
},
{
"path": "src/graph/split/splitEdge.js",
"chars": 14310,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tmidpoint,\n} from \"../../math/vector.js\";\nimport {\n\tmakeVerticesToEdge,\n\tmakeVe"
},
{
"path": "src/graph/split/splitFace.js",
"chars": 24216,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tuniqueElements,\n\tsplitCircularArray,\n} from \"../../general/array.js\";\nimport {"
},
{
"path": "src/graph/split/splitGraph.js",
"chars": 11550,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"../../math/constant.js\";\nimport {\n\tincludeL,\n\tincludeR,\n\tincl"
},
{
"path": "src/graph/split/splitLine.js",
"chars": 8375,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"../../math/constant.js\";\nimport {\n\tincludeL,\n} from \"../../ma"
},
{
"path": "src/graph/subgraph.js",
"chars": 9269,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tfoldKeys,\n\tfilterKeysWithPrefix,\n\tfilterKeysWithSuffix,\n} from \"../fold/spec.j"
},
{
"path": "src/graph/sweep.js",
"chars": 15578,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"../math/constant.js\";\nimport {\n\tepsilonEqual,\n} from \"../math"
},
{
"path": "src/graph/symmetry.js",
"chars": 8469,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"../math/constant.js\";\nimport {\n\tvecLineToUniqueLine,\n} from \""
},
{
"path": "src/graph/transfer.js",
"chars": 2570,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tdistance2,\n\tresize2,\n} from \"../math/vector.js\";\nimport {\n\tcollinearPoints,\n} "
},
{
"path": "src/graph/transform.js",
"chars": 9770,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tscale as Scale,\n\tscale2 as Scale2,\n\tscale3 as Scale3,\n\tscaleNonUniform,\n\tscale"
},
{
"path": "src/graph/trees.js",
"chars": 3557,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\n\n/**\n * @typedef BreadthFirstTreeNode\n * @type {{ index: number, parent?: number }}\n * @"
},
{
"path": "src/graph/triangulate.js",
"chars": 10736,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport Messages from \"../environment/messages.js\";\nimport { countImpliedEdges } from \"./"
},
{
"path": "src/graph/validate/validate.js",
"chars": 1422,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tvalidateTypes,\n} from \"./validateTypes.js\";\nimport {\n\tvalidateReferences,\n} fr"
},
{
"path": "src/graph/validate/validateAssignments.js",
"chars": 1159,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tassignmentFlatFoldAngle,\n} from \"../../fold/spec.js\";\n\n/**\n * @param {FOLD} gr"
},
{
"path": "src/graph/validate/validateOrders.js",
"chars": 1302,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\n\n/**\n * @param {[number, number, number][]} orders, such as faceOrders or edgeOrders\n * "
},
{
"path": "src/graph/validate/validateReferences.js",
"chars": 3651,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tfilterKeysWithPrefix,\n\tfilterKeysWithSuffix,\n\tgetAllPrefixes,\n\tgetAllSuffixes,"
},
{
"path": "src/graph/validate/validateReflexive.js",
"chars": 2941,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\n\n/**\n * @description In the case where two identical but opposite arrays exist,\n * this "
},
{
"path": "src/graph/validate/validateTypes.js",
"chars": 3114,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tfoldKeys,\n} from \"../../fold/spec.js\";\nimport {\n\tduplicateEdges,\n} from \"../ed"
},
{
"path": "src/graph/validate/validateWinding.js",
"chars": 5786,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tmakeVerticesToEdge,\n\tmakeVerticesToFace,\n\tmakeEdgesToFace,\n} from \"../make/loo"
},
{
"path": "src/graph/vertices/clusters.js",
"chars": 6388,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport { EPSILON } from \"../../math/constant.js\";\nimport { getDimensionQuick } from \"../"
},
{
"path": "src/graph/vertices/collinear.js",
"chars": 2446,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"../../math/constant.js\";\nimport {\n\tcollinearBetween,\n} from \""
},
{
"path": "src/graph/vertices/duplicate.js",
"chars": 3296,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport { EPSILON } from \"../../math/constant.js\";\nimport { average } from \"../../math/ve"
},
{
"path": "src/graph/vertices/folded.js",
"chars": 8229,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tmakeEdgesIsFolded,\n\tedgesFoldAngleAreAllFlat,\n} from \"../../fold/spec.js\";\nimp"
},
{
"path": "src/graph/vertices/isolated.js",
"chars": 3010,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tremove,\n} from \"../remove.js\";\n\n/**\n * @description Get the indices of all ver"
},
{
"path": "src/graph/vertices/sort.js",
"chars": 1706,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport { EPSILON } from \"../../math/constant.js\";\nimport { subtract } from \"../../math/v"
},
{
"path": "src/graph/walk.js",
"chars": 5913,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\n\n/**\n * @description Discover a single face by walking counter-clockwise\n * from vertex "
},
{
"path": "src/index.js",
"chars": 1207,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport { setWindow } from \"./environment/window.js\";\nimport axiom from \"./axioms/index.j"
},
{
"path": "src/layer/constraints3D.js",
"chars": 6429,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport Messages from \"../environment/messages.js\";\nimport {\n\tEPSILON,\n} from \"../math/co"
},
{
"path": "src/layer/constraints3DEdges.js",
"chars": 20485,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"../math/constant.js\";\nimport {\n\tarrayArrayToLookupArray,\n} fr"
},
{
"path": "src/layer/constraints3DFaces.js",
"chars": 5797,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"../math/constant.js\";\nimport {\n\taverage2,\n\tresize3,\n} from \"."
},
{
"path": "src/layer/constraintsFlat.js",
"chars": 5232,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"../math/constant.js\";\nimport {\n\tconnectedComponentsPairs,\n} f"
},
{
"path": "src/layer/facesSide.js",
"chars": 7006,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tcross2,\n\tsubtract2,\n\tresize3,\n} from \"../math/vector.js\";\nimport {\n\tmultiplyMa"
},
{
"path": "src/layer/general.js",
"chars": 5928,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\n\n/**\n * @constant\n * @type {string[]}\n */\nexport const tacoTypeNames = [\n\t\"taco_taco\",\n\t"
},
{
"path": "src/layer/getBranches.js",
"chars": 3323,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\ttacoTypeNames,\n\tconstraintToFacePairsStrings,\n} from \"./general.js\";\n\n/**\n * @"
},
{
"path": "src/layer/index.js",
"chars": 1082,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport * as constraints3D from \"./constraints3D.js\";\nimport * as constraints3DFaces from"
},
{
"path": "src/layer/initialSolutionsFlat.js",
"chars": 2634,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\n\n/**\n * @description Given a FOLD graph, already folded, find the layer arrangement\n * b"
},
{
"path": "src/layer/layer.js",
"chars": 1315,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tsolveFaceOrders,\n\tsolveFaceOrders3D,\n} from \"./solve.js\";\nimport {\n\tLayerProto"
},
{
"path": "src/layer/propagate.js",
"chars": 10645,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\ttable,\n} from \"./table.js\";\nimport {\n\tconstraintToFacePairs,\n\ttacoTypeNames,\n\t"
},
{
"path": "src/layer/prototype.js",
"chars": 5562,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\n\n// each \"branches\" is an \"and\" list (containing a list of \"andItem\")\n// each \"andItem\" "
},
{
"path": "src/layer/prototypeOneDepth.js",
"chars": 4197,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport { invertFlatMap } from \"../graph/maps.js\";\nimport { topologicalSort } from \"../gr"
},
{
"path": "src/layer/solve.js",
"chars": 9482,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tmakeEdgesFacesUnsorted,\n} from \"../graph/make/edgesFaces.js\";\nimport {\n\tmakeEd"
},
{
"path": "src/layer/solver.js",
"chars": 7552,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport Messages from \"../environment/messages.js\";\nimport {\n\tpropagate,\n} from \"./propag"
},
{
"path": "src/layer/solverOneDepth.js",
"chars": 8637,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport Messages from \"../environment/messages.js\";\nimport {\n\tpropagate,\n} from \"./propag"
},
{
"path": "src/layer/table.js",
"chars": 9161,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\n\n/**\n * @description each state encodes a valid layer combination. each number\n * descri"
},
{
"path": "src/layer/tacosTortillas.js",
"chars": 10570,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"../math/constant.js\";\nimport {\n\tmakeFacesCenterQuick,\n} from "
},
{
"path": "src/layer/transitivity.js",
"chars": 3920,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"../math/constant.js\";\nimport {\n\tclipPolygonPolygon,\n} from \"."
},
{
"path": "src/libTypes.d.ts",
"chars": 4064,
"preview": "type FOLDFrame = {\n frame_author?: string;\n frame_title?: string;\n frame_description?: string;\n frame_classe"
},
{
"path": "src/math/clip.js",
"chars": 5533,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"./constant.js\";\nimport {\n\tinclude,\n\tincludeL,\n} from \"./compa"
},
{
"path": "src/math/compare.js",
"chars": 3596,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport { EPSILON } from \"./constant.js\";\n\n/**\n * @description Are two inputs equal withi"
},
{
"path": "src/math/constant.js",
"chars": 489,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\n\n/**\n * @description this epsilon is used throughout the library\n * @constant {number}\n "
},
{
"path": "src/math/convert.js",
"chars": 3331,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tmagnitude,\n\tdot,\n\tscale2,\n\tsubtract2,\n\tsubtract3,\n\tresize2,\n\tresize3,\n\trotate9"
},
{
"path": "src/math/convexHull.js",
"chars": 7149,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"./constant.js\";\nimport {\n\tepsilonCompare,\n} from \"./compare.j"
},
{
"path": "src/math/encloses.js",
"chars": 1522,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport { EPSILON } from \"./constant.js\";\n\n/**\n * @description Is a point fully contained"
},
{
"path": "src/math/index.js",
"chars": 1337,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport * as constant from \"./constant.js\";\nimport * as convert from \"./convert.js\";\nimpo"
},
{
"path": "src/math/intersect.js",
"chars": 6795,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"./constant.js\";\nimport {\n\tinclude,\n\tincludeL,\n\tincludeS,\n\teps"
},
{
"path": "src/math/line.js",
"chars": 8843,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"./constant.js\";\nimport {\n\tepsilonEqual,\n\tepsilonEqualVectors,"
},
{
"path": "src/math/matrix2.js",
"chars": 5319,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\n\n/**\n * 2x3 matrix methods for two dimensional transformations.\n * the third column is a"
},
{
"path": "src/math/matrix3.js",
"chars": 11347,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"./constant.js\";\nimport {\n\tnormalize,\n\tresize,\n\tflip,\n} from \""
},
{
"path": "src/math/matrix4.js",
"chars": 13640,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"./constant.js\";\nimport {\n\tnormalize,\n\tnormalize3,\n\tsubtract3,"
},
{
"path": "src/math/nearest.js",
"chars": 3734,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"./constant.js\";\nimport {\n\tclampLine,\n\tclampSegment,\n} from \"."
},
{
"path": "src/math/overlap.js",
"chars": 5450,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"./constant.js\";\nimport {\n\texclude,\n\tincludeL,\n} from \"./compa"
},
{
"path": "src/math/plane.js",
"chars": 895,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tnormalize3,\n\tdot3,\n\tscale3,\n\tsubtract3,\n\tresize3,\n} from \"./vector.js\";\n\n/**\n "
},
{
"path": "src/math/polygon.js",
"chars": 8015,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n\tTWO_PI,\n} from \"./constant.js\";\nimport {\n\tcross2,\n\tscale2,\n\tadd2,\n\ts"
},
{
"path": "src/math/polynomial.js",
"chars": 2477,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport { EPSILON } from \"./constant.js\";\n\n/**\n * @description perform a cube root but pr"
},
{
"path": "src/math/quaternion.js",
"chars": 1332,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tdot,\n\tcross3,\n\tmagnitude,\n\tnormalize,\n} from \"./vector.js\";\nimport {\n\tmultiply"
},
{
"path": "src/math/radial.js",
"chars": 11591,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n\tTWO_PI,\n} from \"./constant.js\";\nimport {\n\tvectorToAngle,\n\tangleToVec"
},
{
"path": "src/math/range.js",
"chars": 1401,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport { EPSILON } from \"./constant.js\";\n\n/**\n * @description Get a new range that fully"
},
{
"path": "src/math/straightSkeleton.js",
"chars": 6690,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\texcludeR,\n} from \"./compare.js\";\nimport {\n\tsubtract2,\n\tdistance,\n\tflip2,\n} fro"
},
{
"path": "src/math/triangle.js",
"chars": 4169,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"./constant.js\";\nimport {\n\tmagnitude2,\n\tmagnitude3,\n\tdot2,\n\tdo"
},
{
"path": "src/math/vector.js",
"chars": 20103,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport { EPSILON } from \"./constant.js\";\n\n/**\n * This entire library operates on a vecto"
},
{
"path": "src/prototypes/graph.js",
"chars": 4416,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\n// import { count } from \"../graph/count.js\";\nimport { clone } from \"../general/clone.js"
},
{
"path": "src/prototypes/index.js",
"chars": 3900,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tfile_spec,\n\tfile_creator,\n} from \"../fold/rabbitear.js\";\nimport * as bases fro"
},
{
"path": "src/singleVertex/degree4.js",
"chars": 2341,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\n\n/**\n * @description Given an array of assignments, mountain and valley,\n * identify whi"
},
{
"path": "src/singleVertex/flatFoldable.js",
"chars": 7330,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n} from \"../math/constant.js\";\nimport {\n\tresize2,\n} from \"../math/vect"
},
{
"path": "src/singleVertex/foldable.js",
"chars": 6516,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport {\n\tEPSILON,\n\tD2R,\n} from \"../math/constant.js\";\nimport {\n\tidentity3x4,\n\tinvertMat"
},
{
"path": "src/singleVertex/index.js",
"chars": 477,
"preview": "/**\n * Rabbit Ear (c) Kraft\n */\nimport * as degree4 from \"./degree4.js\";\nimport * as flatFoldable from \"./flatFoldable.j"
}
]
// ... and 432 more files (download for full content)
About this extraction
This page contains the full source code of the robbykraft/Origami GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 632 files (2.9 MB), approximately 787.6k tokens, and a symbol index with 53 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.