1 | "use strict"
|
2 | Object.defineProperty(exports,"__esModule",{value:!0})
|
3 | exports.fn=exports.params=exports.description=exports.active=exports.type=exports.name=void 0
|
4 | exports.name="removeHiddenElems"
|
5 | exports.type="perItem"
|
6 | exports.active=!0
|
7 | exports.description="removes hidden elements (zero sized, with absent attributes)"
|
8 | exports.params={isHidden:!0,displayNone:!0,opacity0:!0,circleR0:!0,ellipseRX0:!0,ellipseRY0:!0,rectWidth0:!0,rectHeight0:!0,patternWidth0:!0,patternHeight0:!0,imageWidth0:!0,imageHeight0:!0,pathEmptyD:!0,polylineEmptyPoints:!0,polygonEmptyPoints:!0}
|
9 | const t=/M\s*(?:[-+]?(?:\d*\.\d+|\d+(?:\.|(?!\.)))([eE][-+]?\d+)?(?!\d)\s*,?\s*){2}\D*\d/i
|
10 | exports.fn=function(e,i){if(e.elem){if(i.isHidden&&e.hasAttr("visibility","hidden"))return!1
|
11 | if(i.displayNone&&e.hasAttr("display","none"))return!1
|
12 | if(i.opacity0&&e.hasAttr("opacity","0"))return!1
|
13 | if(i.circleR0&&e.isElem("circle")&&e.isEmpty()&&e.hasAttr("r","0"))return!1
|
14 | if(i.ellipseRX0&&e.isElem("ellipse")&&e.isEmpty()&&e.hasAttr("rx","0"))return!1
|
15 | if(i.ellipseRY0&&e.isElem("ellipse")&&e.isEmpty()&&e.hasAttr("ry","0"))return!1
|
16 | if(i.rectWidth0&&e.isElem("rect")&&e.isEmpty()&&e.hasAttr("width","0"))return!1
|
17 | if(i.rectHeight0&&i.rectWidth0&&e.isElem("rect")&&e.isEmpty()&&e.hasAttr("height","0"))return!1
|
18 | if(i.patternWidth0&&e.isElem("pattern")&&e.hasAttr("width","0"))return!1
|
19 | if(i.patternHeight0&&e.isElem("pattern")&&e.hasAttr("height","0"))return!1
|
20 | if(i.imageWidth0&&e.isElem("image")&&e.hasAttr("width","0"))return!1
|
21 | if(i.imageHeight0&&e.isElem("image")&&e.hasAttr("height","0"))return!1
|
22 | if(i.pathEmptyD&&e.isElem("path")&&(!e.hasAttr("d")||!t.test(e.attr("d").value)))return!1
|
23 | if(i.polylineEmptyPoints&&e.isElem("polyline")&&!e.hasAttr("points"))return!1
|
24 | if(i.polygonEmptyPoints&&e.isElem("polygon")&&!e.hasAttr("points"))return!1}}
|