/* @preserve POLYDIV v1.0.1 ---------------------------------------------------- git repo: https://github.com/radiium/polydiv Description: Clipping html element in random polygon */ !function(t,n){"function"==typeof define&&define.amd?define([],n(t)):"object"==typeof exports?module.exports=n(t):t.Polydiv=n(t)}("undefined"!=typeof global?global:this.window||this.global,function(t){"use strict";return function(t){var n={items:[],settings:{}},i={query:".polydiv"};function o(t){for(var n=[],e=function(t){if(t.sort(f),t.length<=1)return t.slice();for(var n=[],e=0;e=(o.y-r.y)*(i.x-r.x)))break;n.pop()}n.push(i)}n.pop();for(var s=[],e=t.length-1;0<=e;e--){for(var i=t[e];2<=s.length;){var o=s[s.length-1],r=s[s.length-2];if(!((o.x-r.x)*(i.y-r.y)>=(o.y-r.y)*(i.x-r.x)))break;s.pop()}s.push(i)}return s.pop(),1==n.length&&1==s.length&&n[0].x==s[0].x&&n[0].y==s[0].y?n:n.concat(s)}(t),i=0;in.x?1:t.yn.y?1:0}function s(t,n){return Math.floor(Math.random()*(n-t+1)+t)}return n.init=function(t,n){var e;this.settings=Object.assign({},i,t||{}),this.items=(e=t.query,document.querySelectorAll(e)),n&&"function"==typeof n&&n()},n.destroy=function(t){this.settings=Object.assign({},i),this.unClipItems(),this.items=[],t&&"function"==typeof t&&t()},n.clipItems=function(t){for(var n=0;n