/*! * LMV v7.99.1 * * Copyright 2024 Autodesk, Inc. * All rights reserved. * * This computer source code and related instructions and comments are the * unpublished confidential and proprietary information of Autodesk, Inc. * and are protected under Federal copyright and state trade secret law. * They may not be disclosed to, copied or used by any third party without * the prior written consent of Autodesk, Inc. * * Autodesk Viewer SDK Usage Limitations: * * The Autodesk Viewer SDK JavaScript must be delivered from an * Autodesk-hosted URL. */(()=>{var t={6986:(t,e,i)=>{"use strict";i.r(e),i.d(e,{LmvCanvasContext:()=>x,hijackContextAPI:()=>l});var n=i(8917),s=Autodesk.Viewing,r=s.Private;const o=r.VertexBufferBuilder;function l(t,e){["fillRect","strokeRect","clearRect","beginPath","closePath","moveTo","lineTo","arc","arcTo","quadraticCurveTo","bezierCurveTo","rect","fill","stroke","clip","strokeText","fillText","drawImage","save","restore","setLineDash","createPattern","beginMarkedContent","beginMarkedContentProps","endMarkedContent","setCurrentOperatorIndex","isLMVCanvasContext","beginChildGroup","endChildGroup"].forEach((i=>{t["_original"+i]=t[i],t[i]=e[i].bind(e)}))}let h=new Array(6),a=new THREE.Vector2,p=new THREE.Box2;var u=new THREE.Vector3,d=new THREE.Quaternion,c=new THREE.Vector3,f=new THREE.Vector3,y=new THREE.Matrix4;class x{static getLayerKey(t){let e;return t&&"object"==typeof t?(e=t.ocgId,void 0===e&&(e=t.name)):e=t,e}static isRef(t){return null!=t&&"number"==typeof t.num&&"number"==typeof t.gen}static refKey(t){return`${t.num}-${t.gen}`}static applyTransform(t,e){return[t[0]*e[0]+t[1]*e[2]+e[4],t[0]*e[1]+t[1]*e[3]+e[5]]}static inverseTransform(t){const e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}constructor(t,e,i,n,r,h,a){var p=s.getGlobal().document.createElement("canvas"),u=p.getContext("2d");if(p.height=t.height,p.width=t.width,u.imageSmoothingEnabled=!1,this.canvasContext=u,this.viewport=t,this.toPageUnits=e,this.meshCallback=i,1==t.clipToViewport){let i=t.offsetX||0,n=t.offsetY||0;this.bounds=new THREE.Vector4(i*e,n*e,(t.width+i)*e,(t.height+n)*e)}this.currentMeshIndex=0,this.imageNumber=0,this.currentVbb=new o(!1),this._curPath=null,this._curClip=null,this.first=!0,this.states=[],this.glyphCache={},this.usingTextLayer=r,this.precisionTolerance=.1,this.dbId=-1,this.maxDbId=0,this.consecutiveIds=!1,s.isMobileDevice()&&Autodesk.Extensions.CompGeom.SetTesselationParams(void 0,.1),this.fontEngine=n,this.lineStyle=0,this.isScreenSpace=!1,l(u,this),this.layers={},this.defaultLayerId=0,this.currentLayerId=this.defaultLayerId,this.sequencedDbId=-1,this.taggedId=null,this.defaultVPId=0,this.viewportCounter=1,this.currentVpId=this.defaultVPId,this.viewports=[this.createViewPortData((new THREE.Matrix4).makeScale(t.scale,t.scale,t.scale).elements)],this.viewportMap={},this.ocgStack=[],this.msdfRender=!0,this.fontAtlas=h,this.pdfRefMap=a||{},this.smallImageSequenceToCheck=-1,this.inSmallImageRendering=!1,this.inChildGroup=!1,this.overrideCompositeOperation="source-over",this.overrideAlpha=1}destroy(){this.canvasContext=null,this.meshCallback=null}updateDBId(){null!=this.taggedId?this.dbId=this.taggedId:this.consecutiveIds&&(this.sequencedDbId++,this.dbId=this.sequencedDbId),this.maxDbId=Math.max(this.maxDbId,this.dbId)}snapToPixel(t,e){const i=this.canvasContext.mozCurrentTransformInverse,n=this.canvasContext.mozCurrentTransform;let s=x.applyTransform([t,e],n);return s[0]=Math.round(s[0]),s[1]=Math.round(s[1]),x.applyTransform(s,i)}save(){this.states.push({clip:this._curClip,consecutiveIds:this.consecutiveIds,lineDashedDef:this.lineDashedDef,lineStyle:this.lineStyle,overrideCompositeOperation:this.overrideCompositeOperation,overrideAlpha:this.overrideAlpha,inChildGroup:this.inChildGroup}),this.canvasContext._originalsave()}restore(){let t=this.states.pop();t&&(this._curClip=t.clip,this.consecutiveIds=t.consecutiveIds,this.lineDashedDef=t.lineDashedDef,this.lineStyle=t.lineStyle,this.overrideCompositeOperation=t.overrideCompositeOperation,this.overrideAlpha=t.overrideAlpha,this.inChildGroup=t.inChildGroup),this.canvasContext._originalrestore()}flushBuffer(t,e,i){if(!this.currentVbb.vcount&&!e)return;let n="source-over";const s="source-over"!=this.overrideCompositeOperation?this.overrideCompositeOperation:this.canvasContext.globalCompositeOperation;"multiply"!==s&&"min"!==s&&"darken"!==s&&"lighten"!==s||(n=s);const r=this.currentCompositeOperation!==n;if((e||this.currentVbb.isFull(t)||r)&&this.currentVbb.vcount){const t=this.currentVbb.toMesh();t.material={skipEllipticals:!this.currentVbb.numEllipticals,skipCircles:!this.currentVbb.numCirculars,skipTriangleGeoms:!this.currentVbb.numTriangleGeoms,skipMiterLines:!this.currentVbb.numMiterLines,useInstancing:this.currentVbb.useInstancing,isScreenSpace:!this.currentImage,hasLineStyles:this.currentVbb.hasLineStyles,msdfFontTexture:!!this.hasMSDFContent,viewportBounds:this.bounds,imageUVTexture:2===i},this.currentImage&&(t.material.image=this.currentImage,t.material.image.name=this.currentImage.cacheKey||this.imageNumber++,t.material.compositeCanvasColor="#ffffff",t.material.opacity=this.canvasContext.globalAlpha,this.currentImage=null),t.material.compositeOperation=this.currentCompositeOperation,this.inChildGroup&&t.material.opacity!==this.overrideAlpha&&(t.material.hasOpacity=!!this.overrideAlpha,t.material.opacity=this.overrideAlpha),this.meshCallback(t,this.currentMeshIndex++),this.currentVbb.reset(0),this.hasMSDFContent=!1}this.currentCompositeOperation=n}addPolyTriangle(t,e,i,n,s,r){var o=this,l=null,h=this.currentVpId;function a(t,e){if(t>e){var i=t;t=e,e=i}if(l[t]){var n=l[t],s=n.lastIndexOf(e);-1==s?n.push(e):n[s]=-1}else l[t]=[e]}function p(e,r){if(e>r){var a=e;e=r,r=a}var p=l[e];p&&(-1!=p.indexOf(r)&&(o.flushBuffer(4),o.currentVbb.addSegment(t[2*e],t[2*e+1],t[2*r],t[2*r+1],o.currentLayerId,-.5,i,n,s,h,o.lineStyle)))}if(r){l=new Array(t.length/2);for(var u=0,d=e.length;u{const e=t.startPoint.slice(),i=t.endPoint.slice(),n=this.getCurrentTransform(),s=e[0],r=i[0];e[0]=this.tx(s,e[1],n),e[1]=this.ty(s,e[1],n),i[0]=this.tx(r,i[1],n),i[1]=this.ty(r,i[1],n);const o=this.viewport.scale||1;let l=1/this.toPageUnits/o,h=(this._curPath.bbox.max.x-this._curPath.bbox.min.x)*l,a=(this._curPath.bbox.max.y-this._curPath.bbox.min.y)*l;const p=Math.max(h,a,1);p>2048&&(l*=2048/p,h=(this._curPath.bbox.max.x-this._curPath.bbox.min.x)*l,a=(this._curPath.bbox.max.y-this._curPath.bbox.min.y)*l);const u=this._curPath.bbox.min.x,d=this._curPath.bbox.min.y;e[0]-=u,e[1]-=d,i[0]-=u,i[1]-=d,e[0]*=l,e[1]*=l,i[0]*=l,i[1]*=l;const c=document.createElement("canvas");c.width=Math.max(h,1),c.height=Math.max(a,1);const f=c.getContext("2d"),y=t.generateCanvasGradient(f,e,i);f.fillStyle=y,f.fillRect(0,0,c.width,c.height);const x=this.createPattern(c,"no-repeat");return x.isGradient=!0,x},e=this.canvasContext.fillStyle;if(e&&!0===e.isPattern)return e;if(e instanceof CanvasGradient){return t(new g(e))}if("string"!=typeof e)return console.warn("Unsupported fill style."),0;var i=parseInt(e.slice(1),16);return 255*this.canvasContext.globalAlpha<<24|(255&i)<<16|65280&i|i>>16&255}getStrokeColor(){let t=this.canvasContext;if(this.lastStrokeStyle===t.strokeStyle&&t.globalAlpha===this.lastAlpha)return this.lastRgb;{let i;"string"!=typeof t.strokeStyle?(console.warn("Unsupported stroke style."),i=parseInt(0,16)):i=parseInt(t.strokeStyle.slice(1),16);var e=255*t.globalAlpha<<24|(255&i)<<16|65280&i|i>>16&255;return this.lastRgb=e,this.lastStrokeStyle=t.strokeStyle,this.lastAlpha=t.globalAlpha,e}}getCurrentTransform(){let t=this.canvasContext.mozCurrentTransform;if(this.isFontChar){let e=this.invXform,i=t[0],n=t[1],s=t[2],r=t[3],o=t[4],l=t[5];return h[0]=e[0]*i+e[2]*n,h[1]=e[1]*i+e[3]*n,h[2]=e[0]*s+e[2]*r,h[3]=e[1]*s+e[3]*r,h[4]=e[0]*o+e[2]*l+e[4],h[5]=e[1]*o+e[3]*l+e[5],h}return t}getCurrentInverseTransform(){return this.canvasContext.mozCurrentTransformInverse}tx(t,e,i){return(t*(i=i||this.getCurrentTransform())[0]+e*i[2]+i[4])*(this.isFontChar?1:this.toPageUnits)}ty(t,e,i){return(t*(i=i||this.getCurrentTransform())[1]+e*i[3]+i[5])*(this.isFontChar?1:this.toPageUnits)}scaleValue(t,e){return e=e||this.getCurrentTransform(),this.toPageUnits*Math.sqrt(Math.abs(e[0]*e[3]-e[1]*e[2]))*t}transformBox(t,e,i){return e=e||this.getCurrentTransform(),p.makeEmpty(),a.set(this.tx(t.min.x,t.min.y,e),this.ty(t.min.x,t.min.y,e)),p.expandByPoint(a),a.set(this.tx(t.max.x,t.min.y,e),this.ty(t.max.x,t.min.y,e)),p.expandByPoint(a),a.set(this.tx(t.max.x,t.max.y,e),this.ty(t.max.x,t.max.y,e)),p.expandByPoint(a),a.set(this.tx(t.min.x,t.max.y,e),this.ty(t.min.x,t.max.y,e)),p.expandByPoint(a),i?(i.copy(p),i):p.clone()}fillRect(t,e,i,n){if(this.inSmallImageRendering){const s=this.snapToPixel(t,e),r=this.snapToPixel(t+i,e+n),o=r[0]-s[0],l=r[1]-s[1];this.canvasContext._originalfillRect(s[0],s[1],o,l)}else this.updateDBId(),this.rect(t,e,i,n),this.dbId=this.first?-1:this.dbId,this.first=!1,this.fill(),this.beginPath()}strokeRect(t,e,i,n){console.log("strokeRect")}clearRect(t,e,i,n){console.log("clearRect")}_beginTextChar(t,e,i,n,s){this.isFontChar=!0,this.invXform=this.canvasContext.mozCurrentTransformInverse,this.hashKey=t.codePointAt(0)+"/"+n.loadedName+"/"+s,this.cachedGlyph=this.glyphCache[this.hashKey],this.cachedGlyph?this.skipPath=!0:this.skipPath=!1}drawMSDFText(t,e,i,s,r){var o=s.name;function l(t,e,i,n,s,r){return Math.abs((r-n)*t-(s-i)*e+s*n-r*i)/Math.sqrt((r-n)*(r-n)+(s-i)*(s-i))}if(this.fontAtlas&&this.fontAtlas.charsMap&&this.fontAtlas.charsMap[o]){var h=this.fontAtlas.charsMap[o][t.charCodeAt(0)];if(null==h)return!1;{this.currentVbb.isFull(4)&&this.flushBuffer(0,!0),this.hasMSDFContent=!0;var a=this.fontAtlas.chars[h];if(a.page>0)return!1;var p=this.fontAtlas.common[a.common],u=r/this.fontAtlas.info[a.info].size,d=a.width*(u+0);let t=a.inverseYAxis?-1:1;var c=a.height*(u+i)*t,f=a.txoffset*(u+0),y=a.tyoffset*(u+i)*-t,x=[f,y,f,y+c,f+d,y+c,f+d,y],g=[];for(let t=0;t0&&"string"==typeof(arguments.length<=0?void 0:arguments[0])?this.canvasContext._originalfill(arguments.length<=0?void 0:arguments[0]):this.canvasContext._originalfill());let t=!1;if(arguments.length){var e;let i=(e=arguments.length-1)<0||arguments.length<=e?void 0:arguments[e];"boolean"==typeof i&&(t=i)}this.isFontChar&&!this.cachedGlyph&&(this.glyphCache[this.hashKey]=this._curPath,this.cachedGlyph=this._curPath,this.cachedGlyph.isFontChar=!0),this.isFontChar=!1,this.cachedGlyph?this.cachedGlyph.fill(this,this.getFillColor(),this.dbId,this.currentLayerId,this._curClip,!0):this._curPath&&this._curPath.fill(this,this.getFillColor(),this.dbId,this.currentLayerId,this._curClip,!1,t),this.skipPath=!1}stroke(){if(this.inSmallImageRendering)return void this.canvasContext._originalstroke();this.isFontChar&&!this.cachedGlyph&&(this.glyphCache[this.hashKey]=this._curPath,this.cachedGlyph=this._curPath,this.cachedGlyph.isFontChar=!0),this.updateLineDashStyle(),this.isFontChar=!1;const t=this.isScreenSpace?-1:1;this.cachedGlyph?this.cachedGlyph.stroke(this,t*this.scaleValue(this.canvasContext.lineWidth),this.getStrokeColor(),this.dbId,this.currentLayerId,this._curClip,!0,this.lineStyle,this.canvasContext.lineCap):this._curPath&&this._curPath.stroke(this,t*this.scaleValue(this.canvasContext.lineWidth),this.getStrokeColor(),this.dbId,this.currentLayerId,this._curClip,!1,this.lineStyle,this.canvasContext.lineCap),this.skipPath=!1}clip(t,e){this.inSmallImageRendering?this.canvasContext._originalclip(t):void 0!==e&&void 0!==t?(this._curClip=t,console.log("Probably unsupported use case")):(this._curClip?this._curClip=this._curClip.clip(this._curPath,t):this._curClip=this._curPath,this._curPath=null)}strokeText(t,e,i,n,s,r){let o=this.canvasContext;o.save(),o.translate(e,i),this.fontEngine.drawText(this,t,0,0,s,r),this.stroke(),o.restore()}fillText(t,e,i,n,s,r){let o=this.canvasContext;o.save(),o.translate(e,i),this.fontEngine.drawText(this,t,0,0,s,r),this.fill(),o.restore()}getRotationAndScale(t){y.elements[0]=t[0],y.elements[1]=t[1],y.elements[4]=t[2],y.elements[5]=t[3],y.elements[12]=t[4],y.elements[13]=t[5],y.decompose(u,d,c);let e=Math.sqrt(1-d.w*d.w);f.set(d.x/e,d.y/e,d.z/e);let i=2*Math.acos(Math.max(Math.min(1,d.w),-1));return d.z<0&&(i=-i),i<0&&(i+=2*Math.PI),{angle:i,scale:c}}drawImage(t,e,i,s,r,o,l,h,a){if(this.inSmallImageRendering){let n=!1;void 0===o&&(o=e,l=i,h=s,a=r,n=!0),void 0===h&&(o=e,l=i,h=t.width,a=t.height,n=!0);const p=this.snapToPixel(o,l),u=this.snapToPixel(o+h,l+a),d=u[0]-p[0],c=u[1]-p[1];return void(n?this.canvasContext._originaldrawImage(t,p[0],p[1],d,c):this.canvasContext._originaldrawImage(t,e,i,s,r,p[0],p[1],d,c))}let p=this._curClip;if(0===t.width||0===t.height)return void console.warn("Zero size image, skipping");const u=this.getCurrentTransform(),{angle:d,scale:c}=this.getRotationAndScale(u);if(void 0===o&&(o=e,l=i,h=s,a=r),void 0===h&&(h=t.width,a=t.height),h)if(p){const e=this.tx(o,l),i=this.ty(o,l),s=this.tx(o+h,l),r=this.ty(o+h,l),u=this.tx(o+h,l+a),d=this.ty(o+h,l+a),c=this.tx(o,l+a),f=this.ty(o,l+a),y=[u-c,d-f,e-c,i-f,c,f];let g={image:t,imageTransform:x.inverseTransform(y)},P=new n.Path2D(this.precisionTolerance);P.moveTo(e,i),P.lineTo(s,r),P.lineTo(u,d),P.lineTo(c,f),P.closePath(),p.fill(this,g,this.dbId,this.currentLayerId,P,!1,!1)}else{let e=this.tx(o+h/2,l+a/2),i=this.ty(o+h/2,l+a/2),n=h*c.x*this.toPageUnits,s=-a*c.y*this.toPageUnits;this.flushBuffer(0,!0),this.currentVbb.addTexturedQuad(e,i,n,s,d,4294902015,0,this.currentLayerId,0),this.currentImage=t,this.flushBuffer(0,!0,1)}else console.warn("Zero size image, skipping")}_processProperties(t){x.isRef(t)&&(t=this.pdfRefMap[x.refKey(t)]);for(let e in t)x.isRef(t[e])&&(t[e]=this.pdfRefMap[x.refKey(t[e])]);return t}beginMarkedContent(t){t&&(t=this._processProperties(t));let e=t.name||t.DBID;isNaN(e)?this.taggedId=null:this.taggedId=parseInt(e),null!==this.taggedId&&this.dbId!==this.taggedId&&this.updateDBId(),t.VP&&(this.currentVpId=this.viewportCounter++),this.ocgStack.push({taggedId:this.taggedId,viewPortId:this.currentVpId})}beginMarkedContentProps(t,e){if(e&&(e=this._processProperties(e)),"OC"===t){var i=this.layers[x.getLayerKey(e)];void 0===i&&(i=this.currentLayerId),this.currentLayerId=i,this.ocgStack.push({layerId:this.currentLayerId})}else isNaN(t)||(this.taggedId=parseInt(t),this.dbId!==this.taggedId&&this.updateDBId()),e?(e.VP&&(this.currentVpId=this.viewportCounter++),this.ocgStack.push({viewPortId:this.currentVpId,taggedId:this.taggedId})):this.ocgStack.push({})}endMarkedContent(){this.ocgStack.length>0&&this.ocgStack.pop();const t=t=>{for(let e=this.ocgStack.length-1;e>=0;--e)if(t in this.ocgStack[e])return this.ocgStack[e][t];return null};let e=t("layerId"),i=t("viewPortId"),n=t("taggedId");this.currentLayerId=null!==e?e:this.defaultLayerId,this.currentVpId=null!==i?i:this.defaultVPId;let s=n!==this.taggedId;this.taggedId=n,s&&this.updateDBId()}setLineStyleParam(t){if(!this.lineStyleInitialized){let i=r.LineStyleDefs.length,n=1;for(var e=0;e0){let i=this.getCurrentTransform(),n=[];for(var e=0;e=0){const e=this.smallImageSequences[this.smallImageSequenceToCheck];if(e.start==t){this.inSmallImageRendering=!0;const t=i(e.bbox,this.viewport.transform),n=Math.floor(t[0])-1,s=Math.floor(t[1])-1,r=Math.ceil(t[2]-t[0])+2,o=Math.ceil(t[3]-t[1])+2;this.canvasContext.save(),this.canvasContext.setTransform(1,0,0,1,0,0),this.canvasContext._originalclearRect(n,s,r,o),this.canvasContext.fillStyle="rgba(255, 255, 255, 0.005)",this.canvasContext._originalfillRect(n,s,r,o),this.canvasContext.restore()}else if(e.end==t){this.inSmallImageRendering=!1;const t=i(e.bbox,this.viewport.transform),n=Math.floor(t[0])-1,s=Math.floor(t[1])-1,r=Math.ceil(t[2]-t[0])+2,o=Math.ceil(t[3]-t[1])+2;let l=document.createElement("canvas");l.width=r,l.height=o;l.getContext("2d").drawImage(this.canvasContext.canvas,n,s,r,o,0,0,r,o),this.canvasContext.save(),this.canvasContext.setTransform(1,0,0,1,0,0),this.canvasContext.drawImage(l,n,s,r,o),this.canvasContext.restore(),this.smallImageSequenceToCheck++,this.smallImageSequenceToCheck>=this.smallImageSequences.length&&(this.smallImageSequenceToCheck=-1)}}}setSmallImageSequences(t){t&&t.length>0&&(this.smallImageSequences=t,this.smallImageSequenceToCheck=0)}setTessParams(t){this.tessParams=t}finish(){this.flushBuffer(0,!0),this.fontAtlas=null}createViewPortData(t,e,i){return{units:e||"feet and inches",transform:t,geom_metrics:this.initGeomMetrics(),precision:i}}isLMVCanvasContext(){return!0}initGeomMetrics(){return{arcs:0,circles:0,circ_arcs:0,viewports:0,clips:0,colors:0,db_ids:0,dots:0,fills:0,layers:0,line_caps:0,line_joins:0,line_patterns:0,line_pat_refs:0,plines:0,pline_points:0,line_weights:0,links:0,miters:0,ptris:0,ptri_indices:0,ptri_points:0,rasters:0,texts:0,strings:[]}}addContextCurrentTransform(){const t=this.canvasContext;t.mozCurrentTransform||(t._originalSave=t.save,t._originalRestore=t.restore,t._originalRotate=t.rotate,t._originalScale=t.scale,t._originalTranslate=t.translate,t._originalTransform=t.transform,t._originalSetTransform=t.setTransform,t._transformMatrix=t._transformMatrix||[1,0,0,1,0,0],t._transformStack=[],Object.defineProperty(t,"mozCurrentTransform",{get:function(){return this._transformMatrix}}),Object.defineProperty(t,"mozCurrentTransformInverse",{get:function(){var t=this._transformMatrix,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],o=t[5],l=e*s-i*n,h=i*n-e*s;return[s/l,i/h,n/h,e/l,(s*r-n*o)/h,(i*r-e*o)/l]}}),t.save=function(){var t=this._transformMatrix;this._transformStack.push(t),this._transformMatrix=t.slice(0,6),this._originalSave()},t.restore=function(){var t=this._transformStack.pop();t&&(this._transformMatrix=t,this._originalRestore())},t.translate=function(t,e){var i=this._transformMatrix;i[4]=i[0]*t+i[2]*e+i[4],i[5]=i[1]*t+i[3]*e+i[5],this._originalTranslate(t,e)},t.scale=function(t,e){var i=this._transformMatrix;i[0]=i[0]*t,i[1]=i[1]*t,i[2]=i[2]*e,i[3]=i[3]*e,this._originalScale(t,e)},t.transform=function(e,i,n,s,r,o){var l=this._transformMatrix;this._transformMatrix=[l[0]*e+l[2]*i,l[1]*e+l[3]*i,l[0]*n+l[2]*s,l[1]*n+l[3]*s,l[0]*r+l[2]*o+l[4],l[1]*r+l[3]*o+l[5]],t._originalTransform(e,i,n,s,r,o)},t.setTransform=function(e,i,n,s,r,o){this._transformMatrix=[e,i,n,s,r,o],t._originalSetTransform(e,i,n,s,r,o)},t.rotate=function(t){var e=Math.cos(t),i=Math.sin(t),n=this._transformMatrix;this._transformMatrix=[n[0]*e+n[2]*i,n[1]*e+n[3]*i,n[0]*-i+n[2]*e,n[1]*-i+n[3]*e,n[4],n[5]],this._originalRotate(t)})}beginChildGroup(t){return t.smask?(this.inChildGroup=!1,!1):(this.flushBuffer(0,!0),this.overrideCompositeOperation=this.canvasContext.globalCompositeOperation,this.overrideAlpha*=this.canvasContext.globalAlpha,this.inChildGroup=!0,!0)}endChildGroup(t){return!!this.inChildGroup&&(this.flushBuffer(0,!0),!0)}_getModelToViewportMatrix(t,e){let i="string"==typeof t?JSON.parse(t):t;if(e){const t=new Autodesk.Viewing.Private.LmvMatrix4(!0).fromArray(i),e=new Autodesk.Viewing.Private.LmvMatrix4(!0).makeScale(this.viewport.scale,this.viewport.scale,1);e.multiply(t),i=e.elements}return i}}class g{constructor(t){if(Object.prototype.hasOwnProperty.call(t,"rawData")){const e=t.rawData;this.type=e[1],this.colorStops=e[3],this.startPoint=e[4],this.endPoint=e[5],this.startRadius=e[6],this.endRadius=e[7]}else Object.assign(this,t)}isValid(){return!!(this.type&&this.startPoint&&this.endPoint&&this.colorStops)&&("radial"!==this.type||void 0!==this.startRadius&&void 0!==this.endRadius)}getFillStyle(t){if(!this.isValid())return;const e=t.createLinearGradient(0,0,1,1);return Object.assign(e,this),e}generateCanvasGradient(t,e,i){if(!this.isValid())return;const n=this.type,s=this.colorStops,r=e||this.startPoint,o=i||this.endPoint,l=this.startRadius,h=this.endRadius;let a=null;"axial"===n||"linear"===n?a=t.createLinearGradient(r[0],r[1],o[0],o[1]):"radial"===n&&(a=t.createRadialGradient(r[0],r[1],l,o[0],o[1],h));for(let t=0,e=s.length;t{var n=i(4813),s=function(t,e){if(this.p=t,this.q=e,t.y>e.y)this.q=t,this.p=e;else if(t.y===e.y)if(t.x>e.x)this.q=t,this.p=e;else if(t.x===e.x)throw new Error("poly2tri Invalid Edge constructor: repeated points!",[t]);this.q._p2t_edge_list||(this.q._p2t_edge_list=[]),this.q._p2t_edge_list.push(this)};n.SweepContext.prototype.initEdges=function(t,e){var i,n=t.length,r=e?t.length-1:t.length;for(i=0;i{"use strict";i.r(e),i.d(e,{DefaultTessParams:()=>n,SetTesselationParams:()=>s,TesselateCubic:()=>l,TesselateQuad:()=>h,getCubeBezierPoint:()=>a});const n={numIterations:100,minSegLenFraction:.05};function s(t,e){t&&(n.numIterations=t),e&&(n.minSegLenFraction=e)}function r(t,e,i,n){return Math.sqrt((t-i)*(t-i)+(e-n)*(e-n))}function o(t,e){if(t>4*e&&e>0){var i=Math.sqrt(t/e);t=e*(i=Math.min(4,i))}return t}function l(t,e,i,s,l,h,a,p,u,d,c,f){c=c||n;var y=r(e,i,s,l)+r(s,l,h,a)+r(h,a,p,u);f||(d=o(d,y));for(var x=(d=d||1/c.minSegLenFraction)*c.minSegLenFraction,g=1/c.numIterations,P=g*g*g,m=3*g,v=m*g,C=v+v,_=6*P,I=e-2*s+h,E=i-2*l+a,T=3*(s-h)-e+p,b=3*(l-a)-i+u,L=e,S=i,A=(s-e)*m+I*v+T*P,N=(l-i)*m+E*v+b*P,O=I*C+T*_,w=E*C+b*_,X=T*_,M=b*_,F=0,Y=0|1/g-.5,B=0;B=x&&(t.lineTo(L,S),F=0);t.lineTo(p,u)}function h(t,e,i,s,l,h,a,p,u,d){u=u||n;var c=r(e,i,s,l)+r(s,l,h,a);d||(p=o(p,c));for(var f=(p=p||1/u.minSegLenFraction)*u.minSegLenFraction,y=1/u.numIterations,x=y*y,g=e-2*s+h,P=i-2*l+a,m=e,v=i,C=2*(s-e)*y+g*x,_=2*(l-i)*y+P*x,I=2*g*x,E=2*P*x,T=0,b=0|1/y-.5,L=0;L=f&&(t.lineTo(m,v),T=0);t.lineTo(h,a)}function a(t,e,i,n,s,r,o,l,h,a){var p=a||{x:void 0,y:void 0};let u=1-t,d=u*u*u,c=3*u*u*t,f=3*u*t*t,y=t*t*t;return p.x=d*e+c*n+f*r+y*l,p.y=d*i+c*s+f*o+y*h,p}},8597:(t,e,i)=>{"use strict";i.r(e),i.d(e,{ComplexPolygon:()=>h});var n=i(6435),s=i.n(n),r=i(9318),o=i(1272),l=i(299);class h{constructor(t,e,i){this.pts=t,this.contours=[],this.customInsideChecker=e,this.bbox=i,this._tmpVec=i instanceof THREE.Box3?new THREE.Vector3:new THREE.Vector2}addContour(t){this.contours.push(t)}pointInContour(t,e,i){var n,s,r,o,l,h,a=!1,p=this.pts;r=p[i[i.length-1]].x,n=(o=p[i[i.length-1]].y)>=e;for(var u=0,d=i.length;u=e)&&(h-e)*(r-l)>=(l-t)*(o-h)==s&&(a=!a),n=s,r=l,o=h;return a}pointInPolygon(t,e){for(var i=!1,n=0;n1&&void 0!==arguments[1]?arguments[1]:{}};if(!this.contours.length)return this.triangulationFailed=!0,void(this.indices=null);this.indices=[];var i=function(t,e){let i=e.getSize(e instanceof THREE.Box3?new THREE.Vector3:new THREE.Vector2),n=e.min.x+.5*i.x,s=e.min.y+.5*i.y,r=2/i.length(),o=[];for(let e=0,i=t.length;e10&&!this.customInsideChecker&&this.createPointInPolygonChecker();let e=t.map_;for(var i=0;i0?this.indices.push(t,e,i):this.indices.push(t,i,e)}}findSegmentIntersections(t,e,i,n){if(!this.cachedEdges){this.cachedEdges=[];for(let t=0;tt.d-e.d)),l[0].d{"use strict";i.r(e),i.d(e,{ContourSet:()=>o,polygonArea:()=>s});var n=i(8597);function s(t){if(t.length<3)return 0;let e=!1;t[0]!==t[t.length-1]&&(e=!0);let i=0;for(let e=0,n=t.length-1;e{let i=t.id;void 0===i&&(i=this.contours.length+":"+e);let s=this.allPointsMap[i];void 0===s&&(s=this.allPoints.length,this.allPoints.push(t),this.allPointsMap[i]=s,r.set(t.x,t.y),this.bbox.expandByPoint(r)),n.push(s)})),0===i&&e||(this.contours.push(n),this.areas.push(i))}addContourSet(t){let e=t.contours[0],i=t.allPoints,n=e.map((t=>i[t]));this.addContour(n)}triangulate(t){if(this.polygon)return;let e=this.allPoints,i=new n.ComplexPolygon(e,t,this.bbox);i.contours=this.contours,i.triangulate(),this.polygon=i,this.triangulationFailed=this.polygon.triangulationFailed}area(){return this.areas[0]}areaNet(){let t=this.areas[0];for(let e=1;e{let i=e.map((t=>this.allPoints[t].id));i[0]===i[i.length-1]&&i.pop(),i.sort(),t.push(i)})),JSON.stringify(t)}stitchContours(){this.areas=[];let t=[];for(var e=0;e0){let i=-s[0]-1,n=s[1];e[n].pop(),Array.prototype.push.apply(e[n],e[i]),t=i}if(s[0]>0&&s[1]<0){let i=s[0],n=-s[1]-1;e[i].pop(),Array.prototype.push.apply(e[i],e[n]),t=n}if(s[0]>0&&s[1]>0){let i=s[0],n=s[1];e[i].pop(),Array.prototype.push.apply(e[i],e[n].reverse()),t=n}void 0!==t&&(e.splice(t,1),i=!0);break}}}}containsPointFrom(t){if(!t.polygon.indices||t.polygon.indices.length<3)return!1;let e=t.allPoints[t.polygon.indices[0]],i=t.allPoints[t.polygon.indices[1]],n=t.allPoints[t.polygon.indices[2]],s=(e.x+i.x+n.x)/3,r=(e.y+i.y+n.y)/3;return this.polygon&&this.polygon.pointInPolygon(s,r)}toPolygonMesh(t){return this.polygon.toPolygonMesh(t)}toExtrudedMesh(t){return this.polygon.toExtrudedMesh(t)}}},4136:(t,e,i)=>{"use strict";i.r(e),i.d(e,{DCEL:()=>u});var n=i(1272),s=i(5229),r=i(7201),o=i(5420),l=i(299);const h=Autodesk.Viewing.Private.logger;class a{constructor(t,e){this.x=t,this.y=e,this.edges=[],this.dbIds=[],this.dbIdsChanged=!1}isDegenerate(){return this.edges.length<2}addEdge(t){for(let e=0;e=0?this.edges.splice(e,1):h.warn("Failed to find edge in vertex list")}findEdgeTo(t){for(let e=0;e{let i=t.angle;t.v1!==this&&(i-=Math.PI);let n=e.angle;return e.v1!==this&&(n-=Math.PI),i-n}))}_canTraverse(t){return t.v1!==this||t.flagFwd?t.v2===this&&!t.flagRev&&(t.flagRev=1,!0):(t.flagFwd=1,!0)}findUntraversedEdge(){for(let t=0;tt.u-e.u)),this.removeDirectedEdge(t);for(let t=1;t{let e=(0,n.segmentsIntersect)(t,a,this.precisionTolerance);e&&(e.e1&&e.e1.length&&(c[t.id]=e.e1),e.e2&&e.e2.length&&d.push.apply(d,e.e2))}));for(let t in c)this.splitEdge(this.edges[parseInt(t)],c[t]);return d.length&&this.splitEdge(a,d),this.dirty=!0,u}removeDirectedEdge(t){t.v1.removeEdge(t),t.v2.removeEdge(t),this.edges[t.id]=void 0,this.quadTreeEdges.deleteItem(t)}removeDanglingPolyline(t){for(;1===t.edges.length;){let e=t.edges[0],i=e.getOppositeVertex(t);this.removeDirectedEdge(e),t=i}}cleanupFlatEdges(){let t=[];this.verts.forEach((e=>{if(!e)return;if(2!==e.edges.length)return;let i=e.edges[0],n=e.edges[1],s=Math.abs(i.angle-n.angle);(s<.002||Math.abs(s-Math.PI)<.002)&&t.push(e);let r=i.getOppositeVertex(e),o=n.getOppositeVertex(e);if(r.findEdgeTo(o)){.5*Math.abs(i.dx*n.dy-n.dx*i.dy)<.001&&t.push(e)}}));for(let e=0;e=0;t--){let e=this.closedAreas[t];if(i.containsPointFrom(e)){if(!e.isHole){i.isHole=!0,this.holes.push(i);break}i.addContourSet(e)}}i.isHole||i.triangulate(t)}for(let e=0,i=this.holes.length;e=0;t--){let e=this.holes[t];e.holeProcessFlag||i.containsPointFrom(e)&&(i.addContourSet(e),i.isHole=!1,e.holeProcessFlag=!0)}i.isHole||i.triangulate(t)}let e=[];for(let t=0;tt.sortEdges()));let i=[],n=[];this.verts.forEach((t=>{let e=t.findUntraversedEdge();if(!e)return;let s=[t],r=e.getOppositeVertex(t);do{if(s.push(r),e=r.findNextCCWEdge(e),!e)break;r=e.getOppositeVertex(r)}while(r&&r!==t);r===t?(s.push(t),i.push(s)):n.push(s)})),this.closedAreas=[];for(let t=0,e=i.length;tt.area()-e.area())),t?this._detectHolesEvenOdd(e):this._detectHolesNonZero(e),this.openAreas=[],n.length){let t=[],e=new r.ContourSet;for(let t=0,i=n.length;t{let e=(0,n.segmentsIntersect)(t,l,this.precisionTolerance);e&&e.e1&&e.e1.length&&(h[t.id]=e.e1)}));for(let t in h){let e=parseInt(t),i=this.edges[e];this.removeDirectedEdge(i),this.removeDanglingPolyline(i.v1),this.removeDanglingPolyline(i.v2)}this.dirty=!0}deleteEdgesInRectangle(t,e,i,n){let s=Math.min(t,i),r=Math.min(e,n),o=Math.max(t,i),l=Math.max(e,n),h={};this.quadTreeEdges.enumInBox(s,r,o,l,(t=>{h[t.id]=t}));for(let t in h){let e=parseInt(t),i=this.edges[e];i&&(this.removeDirectedEdge(i),this.removeDanglingPolyline(i.v1),this.removeDanglingPolyline(i.v2))}this.dirty=!0}findNearestVertex(t,e,i){"number"!=typeof i&&(i=this.precisionTolerance);let n=1/0,s=null;return this.verts.enumInBox(t-i,e-i,t+i,e+i,(i=>{let r=(i.x-t)*(i.x-t)+(i.y-e)*(i.y-e);r{(0,n.pointOnLine)(t,e,o,!0,i,s)&&s.d{"use strict";i.r(e),i.d(e,{EdgeSet:()=>d});var n,s=i(9318),r=i(299),o=i(8597);function l(t){return t[t.LMV_APP_NAMESPACE]=t[t.LMV_APP_NAMESPACE]||{}}function h(){const t="undefined"!=typeof window&&null!==window?window:"undefined"!=typeof self&&null!==self?self:i.g;return t.USE_LMV_APP_NAMESPACES?(t.globalProxy||(t.globalProxy=new Proxy({},{get(e,i){let n=t[i];return"function"==typeof n?function(t,e){return new Proxy(e,{get:(t,e)=>t[e],apply:(e,i,n)=>e.call(t||i,...n)})}(t,n):n},set:(e,i,n)=>(Object.prototype.hasOwnProperty.call(t,i)?t[i]!==n&&(t[i]=n):(l(t)[i]=n,Object.defineProperty(t,i,{get:()=>l(t)[i],set:e=>{l(t)[i]=e}})),!0)})),t.globalProxy):t}const a=h(),p=(a&&a.document,"undefined"!=typeof navigator);p&&navigator.userAgent.match(/Edge|Trident\/7\./),p&&navigator.userAgent.match(/Trident\/7\./);p&&(/ip(ad|hone|od)/.test(navigator.userAgent.toLowerCase())||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1||/^ip(ad|hone|od)$/.test(null===(n=navigator.platform)||void 0===n?void 0:n.toLowerCase()));p&&navigator.userAgent.toLowerCase().indexOf("android");const u=h();class d{constructor(t,e,i){this.edges=t,this.bbox=e,this.verts=new r.UniquePointList(e,i),this.polygon=null}getPointIndex(t,e){return this.verts.findOrAddPoint(t,e).id}snapEdges(){for(var t=0;t1){o=e;break}if(!o)for(let e in t)if(t[e].length>0){o=e;break}if(!o)break;var l=-1,h=parseInt(o),a=t[o];for(n.push(h);a&&a.length;){var p=a.shift();if(p===l&&(p=a.shift()),void 0===p){delete t[h];break}n.push(p),(0==a.length||a[0]===l)&&delete t[h],l=h,h=p,a=t[p]}n.length&&(this.contours.push(n),n=[])}var d=[];for(let t=0;t0){const t=-m[0]-1,e=m[1];x[e].pop(),Array.prototype.push.apply(x[e],x[t]),v=t}if(m[0]>0&&m[1]<0){const t=m[0],e=-m[1]-1;x[t].pop(),Array.prototype.push.apply(x[t],x[e]),v=e}if(m[0]>0&&m[1]>0){const t=m[0],e=m[1];x[t].pop(),Array.prototype.push.apply(x[t],x[e].reverse()),v=e}void 0!==v&&(x.splice(v,1),f=!0);break}}}}cleanupFlatEdges(){let t=this.verts.pts,e=this.verts.precisionTolerance;for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{},e=new s.IntervalTree(this.verts.pts,this.edges,this.bbox);e.build();let i=new o.ComplexPolygon(this.verts.pts,e,this.bbox);return i.contours=this.contours,i.triangulate(t),i}}},2324:(t,e,i)=>{"use strict";i.r(e),i.d(e,{EllipseArc:()=>u,angleInsideArc:()=>h,angleInsideArcCCW:()=>l,getAngleDelta:()=>o,getEllipseArcPoint:()=>s,getEllipsePoint:()=>n,normalizeAngle:()=>r});const n=function(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;const o=(arguments.length>6&&void 0!==arguments[6]?arguments[6]:null)||new THREE.Vector2;let l=e+n*Math.cos(t),h=i+s*Math.sin(t);if(0!==r){const t=Math.cos(r),n=Math.sin(r),s=l-e,o=h-i;l=s*t-o*n+e,h=s*n+o*t+i}return o.set(l,h)},s=function(t,e,i,s,o,l,h){let a=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,p=arguments.length>8&&void 0!==arguments[8]?arguments[8]:null,u=h-l;if(Math.abs(u)(t/=2*Math.PI,(t-=Math.trunc(t))<0&&(t+=1),2*t*Math.PI),o=(t,e,i)=>{let n=e-t;return n=r(n),i?n:2*Math.PI-n},l=(t,e,i)=>(t=r(t),(e=r(e))<(i=r(i))?t>=e&&t<=i:t>=e||t<=i),h=function(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const s=l(t,e,i);return n?s:!s},a=(t,e,i,n)=>{var s=t*i+e*n,r=Math.sqrt(t*t+e*e)*Math.sqrt(i*i+n*n),o=Math.acos(Math.max(-1,Math.min(1,s/r)));return t*n-e*i<0&&(o=-o),o},p=new THREE.Vector2;class u{constructor(t,e,i,n,s,r,o,l){this.set(t,e,i,n,s,r,o,l)}set(t,e,i,n,s,r,o,l){return this.cx=t,this.cy=e,this.rx=i,this.ry=n,this.startAngle=r,this.endAngle=o,this.ccw=l,this.rotation=s,this}setFromSvgArc(t,e,i,n,s,r,o){const l=i*Math.PI/180;if(t=Math.abs(t),e=Math.abs(e),0==t||0==e){const i=.01,n=360*p.copy(r).distanceTo(o)/i/(2*Math.PI);t=n,e=n}const h=(r.x-o.x)/2,u=(r.y-o.y)/2,d=Math.cos(l)*h+Math.sin(l)*u,c=-Math.sin(l)*h+Math.cos(l)*u;let f=t*t,y=e*e;const x=d*d,g=c*c,P=x/f+g/y;if(P>1){const i=Math.sqrt(P);f=(t*=i)*t,y=(e*=i)*e}const m=f*g+y*x,v=(f*y-m)/m;let C=Math.sqrt(Math.max(0,v));n===s&&(C=-C);const _=C*t*c/e,I=-C*e*d/t,E=Math.cos(l)*_-Math.sin(l)*I+(r.x+o.x)/2,T=Math.sin(l)*_+Math.cos(l)*I+(r.y+o.y)/2,b=a(1,0,(d-_)/t,(c-I)/e),L=a((d-_)/t,(c-I)/e,(-d-_)/t,(-c-I)/e)%(2*Math.PI);return this.cx=E,this.cy=T,this.rx=t,this.ry=e,this.rotation=l,this.startAngle=b,this.endAngle=b+L,this.ccw=s,this}getPoint(t,e){let i=this.startAngle,n=this.endAngle;return this.ccw||(i=this.endAngle,n=this.startAngle,t=1-t),s(t,this.cx,this.cy,this.rx,this.ry,i,n,this.rotation,e)}isValid(){return isFinite(this.cx)&&isFinite(this.cy)&&isFinite(this.rx)&&isFinite(this.ry)&&isFinite(this.rotation)&&isFinite(this.startAngle)&&isFinite(this.endAngle)}computeBBox(t){const e=Math.tan(this.rotation),i=-Math.atan(this.ry*e/this.rx),s=Math.PI-Math.atan(this.ry*e/this.rx),r=Math.atan(this.ry/(e*this.rx)),o=Math.PI+Math.atan(this.ry/(e*this.rx)),l=t?t.makeEmpty():new THREE.Box2,a=t=>{const e=n(t,this.cx,this.cy,this.rx,this.ry,this.rotation);l.expandByPoint(e)};return a(this.startAngle),a(this.endAngle),h(i,this.startAngle,this.endAngle,this.ccw)&&a(i),h(s,this.startAngle,this.endAngle,this.ccw)&&a(s),h(r,this.startAngle,this.endAngle,this.ccw)&&a(r),h(o,this.startAngle,this.endAngle,this.ccw)&&a(o),l}tesselate(t,e,i){const n=this.getPoint(0);for(var s=1;s{"use strict";i.r(e),i.d(e,{TOL:()=>n,isEqual:()=>r,isZero:()=>s});const n=1e-6;function s(t){return Math.abs(t){var n=Autodesk.Viewing,s=AutodeskNamespace("Autodesk.Viewing.Extensions.CompGeom");function r(e,i){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t.exports[n]=e[n],i[n]=e[n])}r(i(7201),s),r(i(2302),s),r(i(4136),s),r(i(5229),s),r(i(5420),s),r(i(2554),s),r(i(3965),s),r(i(2601),s),r(i(1272),s),r(i(6353),s),r(i(8189),s),r(i(908),s),r(i(9318),s),r(i(8597),s),r(i(299),s),r(i(6435),s),r(i(2324),s),r(i(8831),s),r(i(6986),s),r(i(8917),s);class o extends n.Extension{constructor(t,e){super(t,e)}load(){return!0}unload(){return!0}activate(){return!0}deactivate(){return!1}}n.theExtensionManager.registerExtension("Autodesk.CompGeom",o)},9318:(t,e,i)=>{"use strict";function n(){this.bbox=new THREE.Box2,this.left=null,this.right=null,this.node_edges=[]}function s(t,e,i){this.pts=t,this.edges=e,this.bbox=i,this.pipResult=!1}i.r(e),i.d(e,{IntervalTree:()=>s}),s.prototype.splitNode=function(t){if(!(t.bbox.min.y>=t.bbox.max.y||t.node_edges.length<3)){var e=.5*(t.bbox.min.y+t.bbox.max.y);t.left=new n,t.right=new n;for(var i=this.pts,s=t.node_edges,r=[],o=new THREE.Vector2,l=0;lp){var u=a;a=p,p=u}var d=null;pe?(t.right.node_edges.push(s[l]),d=t.right.bbox):r.push(s[l]),d&&(o.set(i[h.p1].x,i[h.p1].y),d.expandByPoint(o),o.set(i[h.p2].x,i[h.p2].y),d.expandByPoint(o))}t.node_edges=r,t.left.node_edges.length&&this.splitNode(t.left),t.right.node_edges.length&&this.splitNode(t.right)}},s.prototype.build=function(){this.root=new n;for(var t=this.root.node_edges,e=0;e=i)for(var n=this.pts,s=t.node_edges,r=0,o=s.length;r=i,d=n[l.p2],c=d.x,f=d.y,y=f>=i;u!=y&&(f-i)*(a-c)>=(c-e)*(p-f)==y&&(this.pipResult=!this.pipResult)}var x=t.left;x&&x.bbox.min.y<=i&&x.bbox.max.y>=i&&this.pointInPolygonRec(x,e,i);var g=t.right;g&&g.bbox.min.y<=i&&g.bbox.max.y>=i&&this.pointInPolygonRec(g,e,i)},s.prototype.pointInPolygon=function(t,e){return this.pipResult=!1,this.pointInPolygonRec(this.root,t,e),this.pipResult}},2641:t=>{!function(){"use strict";var e={version:"6.4.2.2",use_lines:!0,use_xyz:!1},i=!1;if(t.exports?(t.exports=e,i=!0):"undefined"!=typeof document?window.ClipperLib=e:self.ClipperLib=e,i){n="chrome";"Netscape"}else{var n=navigator.userAgent.toString().toLowerCase();navigator.appName}var s={};-1!=n.indexOf("chrome")&&-1==n.indexOf("chromium")?s.chrome=1:s.chrome=0,-1!=n.indexOf("chromium")?s.chromium=1:s.chromium=0,-1!=n.indexOf("safari")&&-1==n.indexOf("chrome")&&-1==n.indexOf("chromium")?s.safari=1:s.safari=0,-1!=n.indexOf("firefox")?s.firefox=1:s.firefox=0,-1!=n.indexOf("firefox/17")?s.firefox17=1:s.firefox17=0,-1!=n.indexOf("firefox/15")?s.firefox15=1:s.firefox15=0,-1!=n.indexOf("firefox/3")?s.firefox3=1:s.firefox3=0,-1!=n.indexOf("opera")?s.opera=1:s.opera=0,-1!=n.indexOf("msie 10")?s.msie10=1:s.msie10=0,-1!=n.indexOf("msie 9")?s.msie9=1:s.msie9=0,-1!=n.indexOf("msie 8")?s.msie8=1:s.msie8=0,-1!=n.indexOf("msie 7")?s.msie7=1:s.msie7=0,-1!=n.indexOf("msie ")?s.msie=1:s.msie=0;var r=function(t,e){var i;if(void 0===Object.getOwnPropertyNames){for(i in e.prototype)void 0!==t.prototype[i]&&t.prototype[i]!==Object.prototype[i]||(t.prototype[i]=e.prototype[i]);for(i in e)void 0===t[i]&&(t[i]=e[i]);t.$baseCtor=e}else{for(var n=Object.getOwnPropertyNames(e.prototype),s=0;s0?this.m_Childs[0]:this.GetNextSiblingUp()},e.PolyNode.prototype.GetNextSiblingUp=function(){return null===this.m_Parent?null:this.m_Index===this.m_Parent.m_Childs.length-1?this.m_Parent.GetNextSiblingUp():this.m_Parent.m_Childs[this.m_Index+1]},e.PolyNode.prototype.Childs=function(){return this.m_Childs},e.PolyNode.prototype.Parent=function(){return this.m_Parent},e.PolyNode.prototype.IsHole=function(){return this.IsHoleNode()},e.PolyTree=function(){this.m_AllPolys=[],e.PolyNode.call(this)},e.PolyTree.prototype.Clear=function(){for(var t=0,e=this.m_AllPolys.length;t0?this.m_Childs[0]:null},e.PolyTree.prototype.Total=function(){var t=this.m_AllPolys.length;return t>0&&this.m_Childs[0]!==this.m_AllPolys[0]&&t--,t},r(e.PolyTree,e.PolyNode),e.Clear=function(t){t.length=0},e.PI=3.141592653589793,e.PI2=6.283185307179586,e.FPoint=function(){var t=arguments,i=t.length;if(this.X=0,this.Y=0,e.use_xyz)if(this.Z=0,3===i)this.X=t[0],this.Y=t[1],this.Z=t[2];else if(2===i)this.X=t[0],this.Y=t[1],this.Z=0;else if(1===i)if(t[0]instanceof e.FPoint){var n=t[0];this.X=n.X,this.Y=n.Y,this.Z=0}else{void 0===(s=t[0]).Z&&(s.Z=0),this.X=s.X,this.Y=s.Y,this.Z=s.Z}else this.X=0,this.Y=0,this.Z=0;else if(2===i)this.X=t[0],this.Y=t[1];else if(1===i)if(t[0]instanceof e.FPoint){n=t[0];this.X=n.X,this.Y=n.Y}else{var s=t[0];this.X=s.X,this.Y=s.Y}else this.X=0,this.Y=0},e.FPoint.op_Equality=function(t,e){return t.X===e.X&&t.Y===e.Y},e.FPoint.op_Inequality=function(t,e){return t.X!==e.X||t.Y!==e.Y},e.FPoint0=function(){this.X=0,this.Y=0,e.use_xyz&&(this.Z=0)},e.FPoint0.prototype=e.FPoint.prototype,e.FPoint1=function(t){this.X=t.X,this.Y=t.Y,e.use_xyz&&(void 0===t.Z?this.Z=0:this.Z=t.Z)},e.FPoint1.prototype=e.FPoint.prototype,e.FPoint1dp=function(t){this.X=t.X,this.Y=t.Y,e.use_xyz&&(this.Z=0)},e.FPoint1dp.prototype=e.FPoint.prototype,e.FPoint2=function(t,i,n){this.X=t,this.Y=i,e.use_xyz&&(this.Z=void 0===n?0:n)},e.FPoint2.prototype=e.FPoint.prototype,e.FRect=function(){var t=arguments,e=t.length;if(4===e)this.left=t[0],this.top=t[1],this.right=t[2],this.bottom=t[3];else if(1===e){var i=t[0];this.left=i.left,this.top=i.top,this.right=i.right,this.bottom=i.bottom}else this.left=0,this.top=0,this.right=0,this.bottom=0},e.FRect0=function(){this.left=0,this.top=0,this.right=0,this.bottom=0},e.FRect0.prototype=e.FRect.prototype,e.FRect1=function(t){this.left=t.left,this.top=t.top,this.right=t.right,this.bottom=t.bottom},e.FRect1.prototype=e.FRect.prototype,e.FRect4=function(t,e,i,n){this.left=t,this.top=e,this.right=i,this.bottom=n},e.FRect4.prototype=e.FRect.prototype,e.ClipType={ctIntersection:0,ctUnion:1,ctDifference:2,ctXor:3},e.PolyType={ptSubject:0,ptClip:1},e.PolyFillType={pftEvenOdd:0,pftNonZero:1,pftPositive:2,pftNegative:3},e.JoinType={jtSquare:0,jtRound:1,jtMiter:2},e.EndType={etOpenSquare:0,etOpenRound:1,etOpenButt:2,etClosedLine:3,etClosedPolygon:4},e.EdgeSide={esLeft:0,esRight:1},e.Direction={dRightToLeft:0,dLeftToRight:1},e.TEdge=function(){this.Bot=new e.FPoint0,this.Curr=new e.FPoint0,this.Top=new e.FPoint0,this.Delta=new e.FPoint0,this.Dx=0,this.PolyTyp=e.PolyType.ptSubject,this.Side=e.EdgeSide.esLeft,this.WindDelta=0,this.WindCnt=0,this.WindCnt2=0,this.OutIdx=0,this.Next=null,this.Prev=null,this.NextInLML=null,this.NextInAEL=null,this.PrevInAEL=null,this.NextInSEL=null,this.PrevInSEL=null},e.IntersectNode=function(){this.Edge1=null,this.Edge2=null,this.Pt=new e.FPoint0},e.MyIntersectNodeSort=function(){},e.MyIntersectNodeSort.Compare=function(t,e){var i=e.Pt.Y-t.Pt.Y;return i>0?1:i<0?-1:0},e.LocalMinima=function(){this.Y=0,this.LeftBound=null,this.RightBound=null,this.Next=null},e.Scanbeam=function(){this.Y=0,this.Next=null},e.Maxima=function(){this.X=0,this.Next=null,this.Prev=null},e.OutRec=function(){this.Idx=0,this.IsHole=!1,this.IsOpen=!1,this.FirstLeft=null,this.Pts=null,this.BottomPt=null,this.PolyNode=null},e.OutPt=function(){this.Idx=0,this.Pt=new e.FPoint0,this.Next=null,this.Prev=null},e.Join=function(){this.OutPt1=null,this.OutPt2=null,this.OffPt=new e.FPoint0},e.ClipperBase=function(){this.m_MinimaList=null,this.m_CurrentLM=null,this.m_edges=new Array,this.m_HasOpenPaths=!1,this.PreserveCollinear=!1,this.m_Scanbeam=null,this.m_PolyOuts=null,this.m_ActiveEdges=null},e.ClipperBase.horizontal=-34e37,e.ClipperBase.Skip=-2,e.ClipperBase.Unassigned=-1,e.ClipperBase.tolerance=1e-20,e.ClipperBase.maxValue=Math.sqrt(Number.MAX_VALUE),e.ClipperBase.minValue=Math.sqrt(Number.MIN_VALUE),e.ClipperBase.near_zero=function(t){return t>-e.ClipperBase.tolerance&&te.X==t.Xe.Y==t.Ye.ClipperBase.maxValue||t.X<-e.ClipperBase.maxValue||t.Y>e.ClipperBase.maxValue||t.Y<-e.ClipperBase.maxValue||t.X>0&&t.X0&&t.Y-e.ClipperBase.minValue||t.Y<0&&t.Y>-e.ClipperBase.minValue)&&e.Error("Coordinate outside allowed range in RangeTest().")},e.ClipperBase.prototype.InitEdge=function(t,i,n,s){t.Next=i,t.Prev=n,t.Curr.X=s.X,t.Curr.Y=s.Y,e.use_xyz&&(t.Curr.Z=s.Z),t.OutIdx=-1},e.ClipperBase.prototype.InitEdge2=function(t,i){t.Curr.Y>=t.Next.Curr.Y?(t.Bot.X=t.Curr.X,t.Bot.Y=t.Curr.Y,e.use_xyz&&(t.Bot.Z=t.Curr.Z),t.Top.X=t.Next.Curr.X,t.Top.Y=t.Next.Curr.Y,e.use_xyz&&(t.Top.Z=t.Next.Curr.Z)):(t.Top.X=t.Curr.X,t.Top.Y=t.Curr.Y,e.use_xyz&&(t.Top.Z=t.Curr.Z),t.Bot.X=t.Next.Curr.X,t.Bot.Y=t.Next.Curr.Y,e.use_xyz&&(t.Bot.Z=t.Next.Curr.Z)),this.SetDx(t),t.PolyTyp=i},e.ClipperBase.prototype.FindNextLocMin=function(t){for(var i;;){for(;e.FPoint.op_Inequality(t.Bot,t.Prev.Bot)||e.FPoint.op_Equality(t.Curr,t.Top);)t=t.Next;if(t.Dx!==e.ClipperBase.horizontal&&t.Prev.Dx!==e.ClipperBase.horizontal)break;for(;t.Prev.Dx===e.ClipperBase.horizontal;)t=t.Prev;for(i=t;t.Dx===e.ClipperBase.horizontal;)t=t.Next;if(t.Top.Y!==t.Prev.Bot.Y){i.Prev.Bot.Xr.Next.Top.X&&(r=s.Prev)}for(;t!==r;)t.NextInLML=t.Next,t.Dx===e.ClipperBase.horizontal&&t!==n&&t.Bot.X!==t.Prev.Top.X&&this.ReverseHorizontal(t),t=t.Next;t.Dx===e.ClipperBase.horizontal&&t!==n&&t.Bot.X!==t.Prev.Top.X&&this.ReverseHorizontal(t),r=r.Next}else{for(;r.Top.Y===r.Prev.Bot.Y&&r.Prev.OutIdx!==e.ClipperBase.Skip;)r=r.Prev;if(r.Dx===e.ClipperBase.horizontal&&r.Prev.OutIdx!==e.ClipperBase.Skip){for(s=r;s.Next.Dx===e.ClipperBase.horizontal;)s=s.Next;(s.Next.Top.X===r.Prev.Top.X||s.Next.Top.X>r.Prev.Top.X)&&(r=s.Next)}for(;t!==r;)t.NextInLML=t.Prev,t.Dx===e.ClipperBase.horizontal&&t!==n&&t.Bot.X!==t.Next.Top.X&&this.ReverseHorizontal(t),t=t.Prev;t.Dx===e.ClipperBase.horizontal&&t!==n&&t.Bot.X!==t.Next.Top.X&&this.ReverseHorizontal(t),r=r.Prev}return r},e.ClipperBase.prototype.AddPath=function(t,i,n){e.use_lines?n||i!==e.PolyType.ptClip||e.Error("AddPath: Open paths must be subject."):n||e.Error("AddPath: Open paths have been disabled.");var s=t.length-1;if(n)for(;s>0&&e.FPoint.op_Equality(t[s],t[0]);)--s;for(;s>0&&e.FPoint.op_Equality(t[s],t[s-1]);)--s;if(n&&s<2||!n&&s<1)return!1;for(var r=new Array,o=0;o<=s;o++)r.push(new e.TEdge);var l=!0;r[1].Curr.X=t[1].X,r[1].Curr.Y=t[1].Y,e.use_xyz&&(r[1].Curr.Z=t[1].Z),this.RangeTest(t[0]),this.RangeTest(t[s]),this.InitEdge(r[0],r[1],r[s],t[0]),this.InitEdge(r[s],r[0],r[s-1],t[s]);for(o=s-1;o>=1;--o)this.RangeTest(t[o]),this.InitEdge(r[o],r[o+1],r[o-1],t[o]);for(var h,a=r[0],p=a,u=a;;)if(p.Curr!==p.Next.Curr||!n&&p.Next===a){if(p.Prev===p.Next)break;if(!n||!e.ClipperBase.SlopesEqual4(p.Prev.Curr,p.Curr,p.Next.Curr)||this.PreserveCollinear&&this.Pt2IsBetweenPt1AndPt3(p.Prev.Curr,p.Curr,p.Next.Curr)){if((p=p.Next)===u||!n&&p.Next===a)break}else p===a&&(a=p.Next),u=p=(p=this.RemoveEdge(p)).Prev}else{if(p===p.Next)break;p===a&&(a=p.Next),u=p=this.RemoveEdge(p)}if(!n&&p===p.Next||n&&p.Prev===p.Next)return!1;n||(this.m_HasOpenPaths=!0,a.Prev.OutIdx=e.ClipperBase.Skip),p=a;do{this.InitEdge2(p,i),p=p.Next,l&&p.Curr.Y!==a.Curr.Y&&(l=!1)}while(p!==a);if(l){if(n)return!1;for(p.Prev.OutIdx=e.ClipperBase.Skip,(c=new e.LocalMinima).Next=null,c.Y=p.Bot.Y,c.LeftBound=null,c.RightBound=p,c.RightBound.Side=e.EdgeSide.esRight,c.RightBound.WindDelta=0;p.Bot.X!==p.Prev.Top.X&&this.ReverseHorizontal(p),p.Next.OutIdx!==e.ClipperBase.Skip;)p.NextInLML=p.Next,p=p.Next;return this.InsertLocalMinima(c),this.m_edges.push(r),!0}this.m_edges.push(r);var d=null;for(e.FPoint.op_Equality(p.Prev.Bot,p.Prev.Top)&&(p=p.Next);(p=this.FindNextLocMin(p))!==d;){var c;null===d&&(d=p),(c=new e.LocalMinima).Next=null,c.Y=p.Bot.Y,p.Dxt.X==i.Xt.Y==i.Y=this.m_MinimaList.Y)t.Next=this.m_MinimaList,this.m_MinimaList=t;else{for(var e=this.m_MinimaList;null!==e.Next&&t.Ythis.m_Scanbeam.Y){var i=new e.Scanbeam;i.Y=t,i.Next=this.m_Scanbeam,this.m_Scanbeam=i}else{for(var n=this.m_Scanbeam;null!==n.Next&&t<=n.Next.Y;)n=n.Next;if(t===n.Y)return;var s=new e.Scanbeam;s.Y=t,s.Next=n.Next,n.Next=s}},e.ClipperBase.prototype.PopScanbeam=function(t){return null===this.m_Scanbeam?(t.v=0,!1):(t.v=this.m_Scanbeam.Y,this.m_Scanbeam=this.m_Scanbeam.Next,!0)},e.ClipperBase.prototype.LocalMinimaPending=function(){return null!==this.m_CurrentLM},e.ClipperBase.prototype.CreateOutRec=function(){var t=new e.OutRec;return t.Idx=e.ClipperBase.Unassigned,t.IsHole=!1,t.IsOpen=!1,t.FirstLeft=null,t.Pts=null,t.BottomPt=null,t.PolyNode=null,this.m_PolyOuts.push(t),t.Idx=this.m_PolyOuts.length-1,t},e.ClipperBase.prototype.DisposeOutRec=function(t){var e=this.m_PolyOuts[t];e.Pts=null,e=null,this.m_PolyOuts[t]=null},e.ClipperBase.prototype.UpdateEdgeIntoAEL=function(t){null===t.NextInLML&&e.Error("UpdateEdgeIntoAEL: invalid call");var i=t.PrevInAEL,n=t.NextInAEL;return t.NextInLML.OutIdx=t.OutIdx,null!==i?i.NextInAEL=t.NextInLML:this.m_ActiveEdges=t.NextInLML,null!==n&&(n.PrevInAEL=t.NextInLML),t.NextInLML.Side=t.Side,t.NextInLML.WindDelta=t.WindDelta,t.NextInLML.WindCnt=t.WindCnt,t.NextInLML.WindCnt2=t.WindCnt2,(t=t.NextInLML).Curr.X=t.Bot.X,t.Curr.Y=t.Bot.Y,t.PrevInAEL=i,t.NextInAEL=n,e.ClipperBase.IsHorizontal(t)||this.InsertScanbeam(t.Top.Y),t},e.ClipperBase.prototype.SwapPositionsInAEL=function(t,e){if(t.NextInAEL!==t.PrevInAEL&&e.NextInAEL!==e.PrevInAEL){if(t.NextInAEL===e){var i=e.NextInAEL;null!==i&&(i.PrevInAEL=t);var n=t.PrevInAEL;null!==n&&(n.NextInAEL=e),e.PrevInAEL=n,e.NextInAEL=t,t.PrevInAEL=e,t.NextInAEL=i}else if(e.NextInAEL===t){var s=t.NextInAEL;null!==s&&(s.PrevInAEL=e);var r=e.PrevInAEL;null!==r&&(r.NextInAEL=t),t.PrevInAEL=r,t.NextInAEL=e,e.PrevInAEL=t,e.NextInAEL=s}else{var o=t.NextInAEL,l=t.PrevInAEL;t.NextInAEL=e.NextInAEL,null!==t.NextInAEL&&(t.NextInAEL.PrevInAEL=t),t.PrevInAEL=e.PrevInAEL,null!==t.PrevInAEL&&(t.PrevInAEL.NextInAEL=t),e.NextInAEL=o,null!==e.NextInAEL&&(e.NextInAEL.PrevInAEL=e),e.PrevInAEL=l,null!==e.PrevInAEL&&(e.PrevInAEL.NextInAEL=e)}null===t.PrevInAEL?this.m_ActiveEdges=t:null===e.PrevInAEL&&(this.m_ActiveEdges=e)}},e.ClipperBase.prototype.DeleteFromAEL=function(t){var e=t.PrevInAEL,i=t.NextInAEL;null===e&&null===i&&t!==this.m_ActiveEdges||(null!==e?e.NextInAEL=i:this.m_ActiveEdges=i,null!==i&&(i.PrevInAEL=e),t.NextInAEL=null,t.PrevInAEL=null)},e.Clipper=function(t){void 0===t&&(t=0),this.m_PolyOuts=null,this.m_ClipType=e.ClipType.ctIntersection,this.m_Scanbeam=null,this.m_Maxima=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=null,this.m_IntersectNodeComparer=null,this.m_ExecuteLocked=!1,this.m_ClipFillType=e.PolyFillType.pftEvenOdd,this.m_SubjFillType=e.PolyFillType.pftEvenOdd,this.m_Joins=null,this.m_GhostJoins=null,this.m_UsingPolyTree=!1,this.ReverseSolution=!1,this.StrictlySimple=!1,e.ClipperBase.call(this),this.m_Scanbeam=null,this.m_Maxima=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=new Array,this.m_IntersectNodeComparer=e.MyIntersectNodeSort.Compare,this.m_ExecuteLocked=!1,this.m_UsingPolyTree=!1,this.m_PolyOuts=new Array,this.m_Joins=new Array,this.m_GhostJoins=new Array,this.ReverseSolution=!!(1&t),this.StrictlySimple=!!(2&t),this.PreserveCollinear=!!(4&t),e.use_xyz&&(this.ZFillFunction=null)},e.Clipper.ioReverseSolution=1,e.Clipper.ioStrictlySimple=2,e.Clipper.ioPreserveCollinear=4,e.Clipper.prototype.Clear=function(){0!==this.m_edges.length&&(this.DisposeAllPolyPts(),e.ClipperBase.prototype.Clear.call(this))},e.Clipper.prototype.InsertMaxima=function(t){var i=new e.Maxima;if(i.X=t,null===this.m_Maxima)this.m_Maxima=i,this.m_Maxima.Next=null,this.m_Maxima.Prev=null;else if(t=n.Next.X;)n=n.Next;if(t===n.X)return;i.Next=n.Next,i.Prev=n,null!==n.Next&&(n.Next.Prev=i),n.Next=i}},e.Clipper.prototype.Execute=function(){var t=arguments,i=t.length,n=t[1]instanceof e.PolyTree;if(4===i&&!n){var s=t[0],r=t[1],o=t[2],l=t[3];if(this.m_ExecuteLocked)return!1;this.m_HasOpenPaths&&e.Error("Error: PolyTree struct is needed for open path clipping."),this.m_ExecuteLocked=!0,e.Clear(r),this.m_SubjFillType=o,this.m_ClipFillType=l,this.m_ClipType=s,this.m_UsingPolyTree=!1;try{(a=this.ExecuteInternal())&&this.BuildResult(r)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return a}if(4===i&&n){s=t[0];var h=t[1];o=t[2],l=t[3];if(this.m_ExecuteLocked)return!1;this.m_ExecuteLocked=!0,this.m_SubjFillType=o,this.m_ClipFillType=l,this.m_ClipType=s,this.m_UsingPolyTree=!0;try{var a;(a=this.ExecuteInternal())&&this.BuildResult2(h)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return a}if(2===i&&!n){s=t[0],r=t[1];return this.Execute(s,r,e.PolyFillType.pftEvenOdd,e.PolyFillType.pftEvenOdd)}if(2===i&&n){s=t[0],h=t[1];return this.Execute(s,h,e.PolyFillType.pftEvenOdd,e.PolyFillType.pftEvenOdd)}},e.Clipper.prototype.FixHoleLinkage=function(t){if(null!==t.FirstLeft&&(t.IsHole===t.FirstLeft.IsHole||null===t.FirstLeft.Pts)){for(var e=t.FirstLeft;null!==e&&(e.IsHole===t.IsHole||null===e.Pts);)e=e.FirstLeft;t.FirstLeft=e}},e.Clipper.prototype.ExecuteInternal=function(){try{this.Reset(),this.m_SortedEdges=null,this.m_Maxima=null;var t,e,i,n={},s={};if(!this.PopScanbeam(n))return!1;for(this.InsertLocalMinimaIntoAEL(n.v);this.PopScanbeam(s)||this.LocalMinimaPending();){if(this.ProcessHorizontals(),this.m_GhostJoins.length=0,!this.ProcessIntersections(s.v))return!1;this.ProcessEdgesAtTopOfScanbeam(s.v),n.v=s.v,this.InsertLocalMinimaIntoAEL(n.v)}for(e=0,i=this.m_PolyOuts.length;e0&&this.ReversePolyPtLinks(t.Pts);for(this.JoinCommonEdges(),e=0,i=this.m_PolyOuts.length;e0&&0!==n.WindDelta)for(var o=0,l=this.m_GhostJoins.length;o=0&&null!==i.PrevInAEL&&i.PrevInAEL.Curr.X===i.Bot.X&&i.PrevInAEL.OutIdx>=0&&e.ClipperBase.SlopesEqual5(i.PrevInAEL.Curr,i.PrevInAEL.Top,i.Curr,i.Top)&&0!==i.WindDelta&&0!==i.PrevInAEL.WindDelta){var a=this.AddOutPt(i.PrevInAEL,i.Bot);this.AddJoin(r,a,i.Top)}if(i.NextInAEL!==n){if(n.OutIdx>=0&&n.PrevInAEL.OutIdx>=0&&e.ClipperBase.SlopesEqual5(n.PrevInAEL.Curr,n.PrevInAEL.Top,n.Curr,n.Top)&&0!==n.WindDelta&&0!==n.PrevInAEL.WindDelta){a=this.AddOutPt(n.PrevInAEL,n.Bot);this.AddJoin(r,a,n.Top)}var p=i.NextInAEL;if(null!==p)for(;p!==n;)this.IntersectEdges(n,p,i.Curr),p=p.NextInAEL}}}},e.Clipper.prototype.InsertEdgeIntoAEL=function(t,e){if(null===this.m_ActiveEdges)t.PrevInAEL=null,t.NextInAEL=null,this.m_ActiveEdges=t;else if(null===e&&this.E2InsertsBeforeE1(this.m_ActiveEdges,t))t.PrevInAEL=null,t.NextInAEL=this.m_ActiveEdges,this.m_ActiveEdges.PrevInAEL=t,this.m_ActiveEdges=t;else{for(null===e&&(e=this.m_ActiveEdges);null!==e.NextInAEL&&!this.E2InsertsBeforeE1(e.NextInAEL,t);)e=e.NextInAEL;t.NextInAEL=e.NextInAEL,null!==e.NextInAEL&&(e.NextInAEL.PrevInAEL=t),t.PrevInAEL=e,e.NextInAEL=t}},e.Clipper.prototype.E2InsertsBeforeE1=function(t,i){return i.Curr.X===t.Curr.X?i.Top.Y>t.Top.Y?i.Top.Xe.Clipper.TopX(i,t.Top.Y):i.Curr.X0;default:return t.WindCnt2<0}case e.ClipType.ctUnion:switch(n){case e.PolyFillType.pftEvenOdd:case e.PolyFillType.pftNonZero:return 0===t.WindCnt2;case e.PolyFillType.pftPositive:return t.WindCnt2<=0;default:return t.WindCnt2>=0}case e.ClipType.ctDifference:if(t.PolyTyp===e.PolyType.ptSubject)switch(n){case e.PolyFillType.pftEvenOdd:case e.PolyFillType.pftNonZero:return 0===t.WindCnt2;case e.PolyFillType.pftPositive:return t.WindCnt2<=0;default:return t.WindCnt2>=0}else switch(n){case e.PolyFillType.pftEvenOdd:case e.PolyFillType.pftNonZero:return 0!==t.WindCnt2;case e.PolyFillType.pftPositive:return t.WindCnt2>0;default:return t.WindCnt2<0}case e.ClipType.ctXor:if(0!==t.WindDelta)return!0;switch(n){case e.PolyFillType.pftEvenOdd:case e.PolyFillType.pftNonZero:return 0===t.WindCnt2;case e.PolyFillType.pftPositive:return t.WindCnt2<=0;default:return t.WindCnt2>=0}}return!0},e.Clipper.prototype.SetWindingCount=function(t){for(var i=t.PrevInAEL;null!==i&&(i.PolyTyp!==t.PolyTyp||0===i.WindDelta);)i=i.PrevInAEL;if(null===i){var n=t.PolyTyp===e.PolyType.ptSubject?this.m_SubjFillType:this.m_ClipFillType;0===t.WindDelta?t.WindCnt=n===e.PolyFillType.pftNegative?-1:1:t.WindCnt=t.WindDelta,t.WindCnt2=0,i=this.m_ActiveEdges}else if(0===t.WindDelta&&this.m_ClipType!==e.ClipType.ctUnion)t.WindCnt=1,t.WindCnt2=i.WindCnt2,i=i.NextInAEL;else if(this.IsEvenOddFillType(t)){if(0===t.WindDelta){for(var s=!0,r=i.PrevInAEL;null!==r;)r.PolyTyp===i.PolyTyp&&0!==r.WindDelta&&(s=!s),r=r.PrevInAEL;t.WindCnt=s?0:1}else t.WindCnt=t.WindDelta;t.WindCnt2=i.WindCnt2,i=i.NextInAEL}else i.WindCnt*i.WindDelta<0?Math.abs(i.WindCnt)>1?i.WindDelta*t.WindDelta<0?t.WindCnt=i.WindCnt:t.WindCnt=i.WindCnt+t.WindDelta:t.WindCnt=0===t.WindDelta?1:t.WindDelta:0===t.WindDelta?t.WindCnt=i.WindCnt<0?i.WindCnt-1:i.WindCnt+1:i.WindDelta*t.WindDelta<0?t.WindCnt=i.WindCnt:t.WindCnt=i.WindCnt+t.WindDelta,t.WindCnt2=i.WindCnt2,i=i.NextInAEL;if(this.IsEvenOddAltFillType(t))for(;i!==t;)0!==i.WindDelta&&(t.WindCnt2=0===t.WindCnt2?1:0),i=i.NextInAEL;else for(;i!==t;)t.WindCnt2+=i.WindDelta,i=i.NextInAEL},e.Clipper.prototype.AddEdgeToSEL=function(t){null===this.m_SortedEdges?(this.m_SortedEdges=t,t.PrevInSEL=null,t.NextInSEL=null):(t.NextInSEL=this.m_SortedEdges,t.PrevInSEL=null,this.m_SortedEdges.PrevInSEL=t,this.m_SortedEdges=t)},e.Clipper.prototype.PopEdgeFromSEL=function(t){if(t.v=this.m_SortedEdges,null===t.v)return!1;var e=t.v;return this.m_SortedEdges=t.v.NextInSEL,null!==this.m_SortedEdges&&(this.m_SortedEdges.PrevInSEL=null),e.NextInSEL=null,e.PrevInSEL=null,!0},e.Clipper.prototype.CopyAELToSEL=function(){var t=this.m_ActiveEdges;for(this.m_SortedEdges=t;null!==t;)t.PrevInSEL=t.PrevInAEL,t.NextInSEL=t.NextInAEL,t=t.NextInAEL},e.Clipper.prototype.SwapPositionsInSEL=function(t,e){if(!(null===t.NextInSEL&&null===t.PrevInSEL||null===e.NextInSEL&&null===e.PrevInSEL)){if(t.NextInSEL===e)null!==(i=e.NextInSEL)&&(i.PrevInSEL=t),null!==(n=t.PrevInSEL)&&(n.NextInSEL=e),e.PrevInSEL=n,e.NextInSEL=t,t.PrevInSEL=e,t.NextInSEL=i;else if(e.NextInSEL===t){null!==(i=t.NextInSEL)&&(i.PrevInSEL=e),null!==(n=e.PrevInSEL)&&(n.NextInSEL=t),t.PrevInSEL=n,t.NextInSEL=e,e.PrevInSEL=t,e.NextInSEL=i}else{var i=t.NextInSEL,n=t.PrevInSEL;t.NextInSEL=e.NextInSEL,null!==t.NextInSEL&&(t.NextInSEL.PrevInSEL=t),t.PrevInSEL=e.PrevInSEL,null!==t.PrevInSEL&&(t.PrevInSEL.NextInSEL=t),e.NextInSEL=i,null!==e.NextInSEL&&(e.NextInSEL.PrevInSEL=e),e.PrevInSEL=n,null!==e.PrevInSEL&&(e.PrevInSEL.NextInSEL=e)}null===t.PrevInSEL?this.m_SortedEdges=t:null===e.PrevInSEL&&(this.m_SortedEdges=e)}},e.Clipper.prototype.AddLocalMaxPoly=function(t,e,i){this.AddOutPt(t,i),0===e.WindDelta&&this.AddOutPt(e,i),t.OutIdx===e.OutIdx?(t.OutIdx=-1,e.OutIdx=-1):t.OutIdxi.Dx?(s=this.AddOutPt(t,n),i.OutIdx=t.OutIdx,t.Side=e.EdgeSide.esLeft,i.Side=e.EdgeSide.esRight,o=(r=t).PrevInAEL===i?i.PrevInAEL:r.PrevInAEL):(s=this.AddOutPt(i,n),t.OutIdx=i.OutIdx,t.Side=e.EdgeSide.esRight,i.Side=e.EdgeSide.esLeft,o=(r=i).PrevInAEL===t?t.PrevInAEL:r.PrevInAEL),null!==o&&o.OutIdx>=0&&o.Top.Ye&&(s=t,t=e,e=s),i>n&&(s=i,i=n,n=s),t=0&&0!==i.WindDelta&&(null===n?n=i:n.OutIdx===i.OutIdx&&(n=null)),i=i.PrevInAEL;null===n?(e.FirstLeft=null,e.IsHole=!1):(e.FirstLeft=this.m_PolyOuts[n.OutIdx],e.IsHole=!e.FirstLeft.IsHole)},e.Clipper.prototype.GetDx=function(t,i){return t.Y===i.Y?e.ClipperBase.horizontal:(i.X-t.X)/(i.Y-t.Y)},e.Clipper.prototype.FirstIsBottomPt=function(t,i){for(var n=t.Prev;e.FPoint.op_Equality(n.Pt,t.Pt)&&n!==t;)n=n.Prev;var s=Math.abs(this.GetDx(t.Pt,n.Pt));for(n=t.Next;e.FPoint.op_Equality(n.Pt,t.Pt)&&n!==t;)n=n.Next;var r=Math.abs(this.GetDx(t.Pt,n.Pt));for(n=i.Prev;e.FPoint.op_Equality(n.Pt,i.Pt)&&n!==i;)n=n.Prev;var o=Math.abs(this.GetDx(i.Pt,n.Pt));for(n=i.Next;e.FPoint.op_Equality(n.Pt,i.Pt)&&n!==i;)n=n.Next;var l=Math.abs(this.GetDx(i.Pt,n.Pt));return Math.max(s,r)===Math.max(o,l)&&Math.min(s,r)===Math.min(o,l)?this.Area(t)>0:s>=o&&s>=l||r>=o&&r>=l},e.Clipper.prototype.GetBottomPt=function(t){for(var i=null,n=t.Next;n!==t;)n.Pt.Y>t.Pt.Y?(t=n,i=null):n.Pt.Y===t.Pt.Y&&n.Pt.X<=t.Pt.X&&(n.Pt.Xn.Pt.Y?t:i.Pt.Yn.Pt.X||i.Next===i?e:n.Next===n||this.FirstIsBottomPt(i,n)?t:e},e.Clipper.prototype.OutRec1RightOfOutRec2=function(t,e){do{if((t=t.FirstLeft)===e)return!0}while(null!==t);return!1},e.Clipper.prototype.GetOutRec=function(t){for(var e=this.m_PolyOuts[t];e!==this.m_PolyOuts[e.Idx];)e=this.m_PolyOuts[e.Idx];return e},e.Clipper.prototype.AppendPolygon=function(t,i){var n,s=this.m_PolyOuts[t.OutIdx],r=this.m_PolyOuts[i.OutIdx];n=this.OutRec1RightOfOutRec2(s,r)?r:this.OutRec1RightOfOutRec2(r,s)?s:this.GetLowermostRec(s,r);var o=s.Pts,l=o.Prev,h=r.Pts,a=h.Prev;t.Side===e.EdgeSide.esLeft?i.Side===e.EdgeSide.esLeft?(this.ReversePolyPtLinks(h),h.Next=o,o.Prev=h,l.Next=a,a.Prev=l,s.Pts=a):(a.Next=o,o.Prev=a,h.Prev=l,l.Next=h,s.Pts=h):i.Side===e.EdgeSide.esRight?(this.ReversePolyPtLinks(h),l.Next=a,a.Prev=l,h.Next=o,o.Prev=h):(l.Next=h,h.Prev=l,o.Prev=a,a.Next=o),s.BottomPt=null,n===r&&(r.FirstLeft!==s&&(s.FirstLeft=r.FirstLeft),s.IsHole=r.IsHole),r.Pts=null,r.BottomPt=null,r.FirstLeft=s;var p=t.OutIdx,u=i.OutIdx;t.OutIdx=-1,i.OutIdx=-1;for(var d=this.m_ActiveEdges;null!==d;){if(d.OutIdx===u){d.OutIdx=p,d.Side=t.Side;break}d=d.NextInAEL}r.Idx=s.Idx},e.Clipper.prototype.ReversePolyPtLinks=function(t){if(null!==t){var e,i;e=t;do{i=e.Next,e.Next=e.Prev,e.Prev=i,e=i}while(e!==t)}},e.Clipper.SwapSides=function(t,e){var i=t.Side;t.Side=e.Side,e.Side=i},e.Clipper.SwapPolyIndexes=function(t,e){var i=t.OutIdx;t.OutIdx=e.OutIdx,e.OutIdx=i},e.Clipper.prototype.IntersectEdges=function(t,i,n){var s=t.OutIdx>=0,r=i.OutIdx>=0;if(e.use_xyz&&this.SetZ(n,t,i),!e.use_lines||0!==t.WindDelta&&0!==i.WindDelta){if(t.PolyTyp===i.PolyTyp)if(this.IsEvenOddFillType(t)){var o=t.WindCnt;t.WindCnt=i.WindCnt,i.WindCnt=o}else t.WindCnt+i.WindDelta===0?t.WindCnt=-t.WindCnt:t.WindCnt+=i.WindDelta,i.WindCnt-t.WindDelta==0?i.WindCnt=-i.WindCnt:i.WindCnt-=t.WindDelta;else this.IsEvenOddFillType(i)?t.WindCnt2=0===t.WindCnt2?1:0:t.WindCnt2+=i.WindDelta,this.IsEvenOddFillType(t)?i.WindCnt2=0===i.WindCnt2?1:0:i.WindCnt2-=t.WindDelta;var l,h,a,p,u,d;switch(t.PolyTyp===e.PolyType.ptSubject?(l=this.m_SubjFillType,a=this.m_ClipFillType):(l=this.m_ClipFillType,a=this.m_SubjFillType),i.PolyTyp===e.PolyType.ptSubject?(h=this.m_SubjFillType,p=this.m_ClipFillType):(h=this.m_ClipFillType,p=this.m_SubjFillType),l){case e.PolyFillType.pftPositive:u=t.WindCnt;break;case e.PolyFillType.pftNegative:u=-t.WindCnt;break;default:u=Math.abs(t.WindCnt)}switch(h){case e.PolyFillType.pftPositive:d=i.WindCnt;break;case e.PolyFillType.pftNegative:d=-i.WindCnt;break;default:d=Math.abs(i.WindCnt)}if(s&&r)0!==u&&1!==u||0!==d&&1!==d||t.PolyTyp!==i.PolyTyp&&this.m_ClipType!==e.ClipType.ctXor?this.AddLocalMaxPoly(t,i,n):(this.AddOutPt(t,n),this.AddOutPt(i,n),e.Clipper.SwapSides(t,i),e.Clipper.SwapPolyIndexes(t,i));else if(s)0!==d&&1!==d||(this.AddOutPt(t,n),e.Clipper.SwapSides(t,i),e.Clipper.SwapPolyIndexes(t,i));else if(r)0!==u&&1!==u||(this.AddOutPt(i,n),e.Clipper.SwapSides(t,i),e.Clipper.SwapPolyIndexes(t,i));else if(!(0!==u&&1!==u||0!==d&&1!==d)){var c,f;switch(a){case e.PolyFillType.pftPositive:c=t.WindCnt2;break;case e.PolyFillType.pftNegative:c=-t.WindCnt2;break;default:c=Math.abs(t.WindCnt2)}switch(p){case e.PolyFillType.pftPositive:f=i.WindCnt2;break;case e.PolyFillType.pftNegative:f=-i.WindCnt2;break;default:f=Math.abs(i.WindCnt2)}if(t.PolyTyp!==i.PolyTyp)this.AddLocalMinPoly(t,i,n);else if(1===u&&1===d)switch(this.m_ClipType){case e.ClipType.ctIntersection:c>0&&f>0&&this.AddLocalMinPoly(t,i,n);break;case e.ClipType.ctUnion:c<=0&&f<=0&&this.AddLocalMinPoly(t,i,n);break;case e.ClipType.ctDifference:(t.PolyTyp===e.PolyType.ptClip&&c>0&&f>0||t.PolyTyp===e.PolyType.ptSubject&&c<=0&&f<=0)&&this.AddLocalMinPoly(t,i,n);break;case e.ClipType.ctXor:this.AddLocalMinPoly(t,i,n)}else e.Clipper.SwapSides(t,i)}}else{if(0===t.WindDelta&&0===i.WindDelta)return;t.PolyTyp===i.PolyTyp&&t.WindDelta!==i.WindDelta&&this.m_ClipType===e.ClipType.ctUnion?0===t.WindDelta?r&&(this.AddOutPt(t,n),s&&(t.OutIdx=-1)):s&&(this.AddOutPt(i,n),r&&(i.OutIdx=-1)):t.PolyTyp!==i.PolyTyp&&(0!==t.WindDelta||1!==Math.abs(i.WindCnt)||this.m_ClipType===e.ClipType.ctUnion&&0!==i.WindCnt2?0!==i.WindDelta||1!==Math.abs(t.WindCnt)||this.m_ClipType===e.ClipType.ctUnion&&0!==t.WindCnt2||(this.AddOutPt(i,n),r&&(i.OutIdx=-1)):(this.AddOutPt(t,n),s&&(t.OutIdx=-1)))}},e.Clipper.prototype.DeleteFromSEL=function(t){var e=t.PrevInSEL,i=t.NextInSEL;null===e&&null===i&&t!==this.m_SortedEdges||(null!==e?e.NextInSEL=i:this.m_SortedEdges=i,null!==i&&(i.PrevInSEL=e),t.NextInSEL=null,t.PrevInSEL=null)},e.Clipper.prototype.ProcessHorizontals=function(){for(var t={};this.PopEdgeFromSEL(t);)this.ProcessHorizontal(t.v)},e.Clipper.prototype.GetHorzDirection=function(t,i){t.Bot.X=l.Top.X&&(a=null)}else{for(;null!==a.Next&&a.Next.X=0&&!o&&this.AddOutPt(t,new e.FPoint2(a.X,t.Bot.Y)),a=a.Next;else for(;null!==a&&a.X>d.Curr.X;)t.OutIdx>=0&&!o&&this.AddOutPt(t,new e.FPoint2(a.X,t.Bot.Y)),a=a.Prev;if(n===e.Direction.dLeftToRight&&d.Curr.X>r||n===e.Direction.dRightToLeft&&d.Curr.X=0&&!o){e.use_xyz&&(n===e.Direction.dLeftToRight?this.SetZ(d.Curr,t,d):this.SetZ(d.Curr,d,t)),p=this.AddOutPt(t,d.Curr);for(var c=this.m_SortedEdges;null!==c;){if(c.OutIdx>=0&&this.HorzSegmentsOverlap(t.Bot.X,t.Top.X,c.Bot.X,c.Top.X)){var f=this.GetLastOutPt(c);this.AddJoin(f,p,c.Top)}c=c.NextInSEL}this.AddGhostJoin(p,t.Bot)}if(d===h&&u)return t.OutIdx>=0&&this.AddLocalMaxPoly(t,h,t.Top),this.DeleteFromAEL(t),void this.DeleteFromAEL(h);if(n===e.Direction.dLeftToRight){var y=new e.FPoint2(d.Curr.X,t.Curr.Y);this.IntersectEdges(t,d,y)}else{y=new e.FPoint2(d.Curr.X,t.Curr.Y);this.IntersectEdges(d,t,y)}var x=this.GetNextInAEL(d,n);this.SwapPositionsInAEL(t,d),d=x}if(null===t.NextInLML||!e.ClipperBase.IsHorizontal(t.NextInLML))break;(t=this.UpdateEdgeIntoAEL(t)).OutIdx>=0&&this.AddOutPt(t,t.Bot),i={Dir:n,Left:s,Right:r},this.GetHorzDirection(t,i),n=i.Dir,s=i.Left,r=i.Right}if(t.OutIdx>=0&&null===p){p=this.GetLastOutPt(t);for(c=this.m_SortedEdges;null!==c;){if(c.OutIdx>=0&&this.HorzSegmentsOverlap(t.Bot.X,t.Top.X,c.Bot.X,c.Top.X)){f=this.GetLastOutPt(c);this.AddJoin(f,p,c.Top)}c=c.NextInSEL}this.AddGhostJoin(p,t.Top)}if(null!==t.NextInLML)if(t.OutIdx>=0){if(p=this.AddOutPt(t,t.Top),0===(t=this.UpdateEdgeIntoAEL(t)).WindDelta)return;var g=t.PrevInAEL;x=t.NextInAEL;if(null!==g&&g.Curr.X===t.Bot.X&&g.Curr.Y===t.Bot.Y&&0===g.WindDelta&&g.OutIdx>=0&&g.Curr.Y>g.Top.Y&&e.ClipperBase.SlopesEqual3(t,g)){f=this.AddOutPt(g,t.Bot);this.AddJoin(p,f,t.Top)}else if(null!==x&&x.Curr.X===t.Bot.X&&x.Curr.Y===t.Bot.Y&&0!==x.WindDelta&&x.OutIdx>=0&&x.Curr.Y>x.Top.Y&&e.ClipperBase.SlopesEqual3(t,x)){f=this.AddOutPt(x,t.Bot);this.AddJoin(p,f,t.Top)}}else t=this.UpdateEdgeIntoAEL(t);else t.OutIdx>=0&&this.AddOutPt(t,t.Top),this.DeleteFromAEL(t)},e.Clipper.prototype.GetNextInAEL=function(t,i){return i===e.Direction.dLeftToRight?t.NextInAEL:t.PrevInAEL},e.Clipper.prototype.IsMinima=function(t){return null!==t&&t.Prev.NextInLML!==t&&t.Next.NextInLML!==t},e.Clipper.prototype.IsMaxima=function(t,e){return null!==t&&t.Top.Y===e&&null===t.NextInLML},e.Clipper.prototype.IsIntermediate=function(t,e){return t.Top.Y===e&&null!==t.NextInLML},e.Clipper.prototype.GetMaximaPair=function(t){return e.FPoint.op_Equality(t.Next.Top,t.Top)&&null===t.Next.NextInLML?t.Next:e.FPoint.op_Equality(t.Prev.Top,t.Top)&&null===t.Prev.NextInLML?t.Prev:null},e.Clipper.prototype.GetMaximaPairEx=function(t){var i=this.GetMaximaPair(t);return null===i||i.OutIdx===e.ClipperBase.Skip||i.NextInAEL===i.PrevInAEL&&!e.ClipperBase.IsHorizontal(i)?null:i},e.Clipper.prototype.ProcessIntersections=function(t){if(null===this.m_ActiveEdges)return!0;try{if(this.BuildIntersectList(t),0===this.m_IntersectList.length)return!0;if(1!==this.m_IntersectList.length&&!this.FixupIntersectionOrder())return!1;this.ProcessIntersectList()}catch(t){this.m_SortedEdges=null,this.m_IntersectList.length=0,e.Error("ProcessIntersections error")}return this.m_SortedEdges=null,!0},e.Clipper.prototype.BuildIntersectList=function(t){if(null!==this.m_ActiveEdges){var i=this.m_ActiveEdges;for(this.m_SortedEdges=i;null!==i;)i.PrevInSEL=i.PrevInAEL,i.NextInSEL=i.NextInAEL,i.Curr.X=e.Clipper.TopX(i,t),i=i.NextInAEL;for(var n=!0;n&&null!==this.m_SortedEdges;){for(n=!1,i=this.m_SortedEdges;null!==i.NextInSEL;){var s=i.NextInSEL,r=new e.FPoint0;if(i.Curr.X>s.Curr.X){this.IntersectPoint(i,s,r),r.Yi.Top.Y)return n.Y=t.Top.Y,n.X=e.Clipper.TopX(i,t.Top.Y),n.Xt.Curr.Y&&(n.Y=t.Curr.Y,Math.abs(t.Dx)>Math.abs(i.Dx)?n.X=e.Clipper.TopX(i,n.Y):n.X=e.Clipper.TopX(t,n.Y))},e.Clipper.prototype.ProcessEdgesAtTopOfScanbeam=function(t){for(var i=this.m_ActiveEdges;null!==i;){var n=this.IsMaxima(i,t);if(n){var s=this.GetMaximaPairEx(i);n=null===s||!e.ClipperBase.IsHorizontal(s)}if(n){this.StrictlySimple&&this.InsertMaxima(i.Top.X);var r=i.PrevInAEL;this.DoMaxima(i),i=null===r?this.m_ActiveEdges:r.NextInAEL}else{if(this.IsIntermediate(i,t)&&e.ClipperBase.IsHorizontal(i.NextInLML)?((i=this.UpdateEdgeIntoAEL(i)).OutIdx>=0&&this.AddOutPt(i,i.Bot),this.AddEdgeToSEL(i)):(i.Curr.X=e.Clipper.TopX(i,t),i.Curr.Y=t),e.use_xyz&&(i.Top.Y===t?i.Curr.Z=i.Top.Z:i.Bot.Y===t?i.Curr.Z=i.Bot.Z:i.Curr.Z=0),this.StrictlySimple){r=i.PrevInAEL;if(i.OutIdx>=0&&0!==i.WindDelta&&null!==r&&r.OutIdx>=0&&r.Curr.X===i.Curr.X&&0!==r.WindDelta){var o=new e.FPoint1(i.Curr);e.use_xyz&&this.SetZ(o,r,i);var l=this.AddOutPt(r,o),h=this.AddOutPt(i,o);this.AddJoin(l,h,o)}}i=i.NextInAEL}}for(this.ProcessHorizontals(),this.m_Maxima=null,i=this.m_ActiveEdges;null!==i;){if(this.IsIntermediate(i,t)){l=null;i.OutIdx>=0&&(l=this.AddOutPt(i,i.Top));r=(i=this.UpdateEdgeIntoAEL(i)).PrevInAEL;var a=i.NextInAEL;if(null!==r&&r.Curr.X===i.Bot.X&&r.Curr.Y===i.Bot.Y&&null!==l&&r.OutIdx>=0&&r.Curr.Y===r.Top.Y&&e.ClipperBase.SlopesEqual5(i.Curr,i.Top,r.Curr,r.Top)&&0!==i.WindDelta&&0!==r.WindDelta){h=this.AddOutPt(ePrev2,i.Bot);this.AddJoin(l,h,i.Top)}else if(null!==a&&a.Curr.X===i.Bot.X&&a.Curr.Y===i.Bot.Y&&null!==l&&a.OutIdx>=0&&a.Curr.Y===a.Top.Y&&e.ClipperBase.SlopesEqual5(i.Curr,i.Top,a.Curr,a.Top)&&0!==i.WindDelta&&0!==a.WindDelta){h=this.AddOutPt(a,i.Bot);this.AddJoin(l,h,i.Top)}}i=i.NextInAEL}},e.Clipper.prototype.DoMaxima=function(t){var i=this.GetMaximaPairEx(t);if(null===i)return t.OutIdx>=0&&this.AddOutPt(t,t.Top),void this.DeleteFromAEL(t);for(var n=t.NextInAEL;null!==n&&n!==i;)this.IntersectEdges(t,n,t.Top),this.SwapPositionsInAEL(t,n),n=t.NextInAEL;-1===t.OutIdx&&-1===i.OutIdx?(this.DeleteFromAEL(t),this.DeleteFromAEL(i)):t.OutIdx>=0&&i.OutIdx>=0?(t.OutIdx>=0&&this.AddLocalMaxPoly(t,i,t.Top),this.DeleteFromAEL(t),this.DeleteFromAEL(i)):e.use_lines&&0===t.WindDelta?(t.OutIdx>=0&&(this.AddOutPt(t,t.Top),t.OutIdx=e.ClipperBase.Unassigned),this.DeleteFromAEL(t),i.OutIdx>=0&&(this.AddOutPt(i,t.Top),i.OutIdx=e.ClipperBase.Unassigned),this.DeleteFromAEL(i)):e.Error("DoMaxima error")},e.Clipper.ReversePaths=function(t){for(var e=0,i=t.length;e=0},e.Clipper.prototype.PointCount=function(t){if(null===t)return 0;var e=0,i=t;do{e++,i=i.Next}while(i!==t);return e},e.Clipper.prototype.BuildResult=function(t){e.Clear(t);for(var i=0,n=this.m_PolyOuts.length;ii.Pt.X?e.Direction.dRightToLeft:e.Direction.dLeftToRight,h=n.Pt.X>s.Pt.X?e.Direction.dRightToLeft:e.Direction.dLeftToRight;if(l===h)return!1;if(l===e.Direction.dLeftToRight){for(;t.Next.Pt.X<=r.X&&t.Next.Pt.X>=t.Pt.X&&t.Next.Pt.Y===r.Y;)t=t.Next;o&&t.Pt.X!==r.X&&(t=t.Next),i=this.DupOutPt(t,!o),e.FPoint.op_Inequality(i.Pt,r)&&((t=i).Pt.X=r.X,t.Pt.Y=r.Y,e.use_xyz&&(t.Pt.Z=r.Z),i=this.DupOutPt(t,!o))}else{for(;t.Next.Pt.X>=r.X&&t.Next.Pt.X<=t.Pt.X&&t.Next.Pt.Y===r.Y;)t=t.Next;o||t.Pt.X===r.X||(t=t.Next),i=this.DupOutPt(t,o),e.FPoint.op_Inequality(i.Pt,r)&&((t=i).Pt.X=r.X,t.Pt.Y=r.Y,e.use_xyz&&(t.Pt.Z=r.Z),i=this.DupOutPt(t,o))}if(h===e.Direction.dLeftToRight){for(;n.Next.Pt.X<=r.X&&n.Next.Pt.X>=n.Pt.X&&n.Next.Pt.Y===r.Y;)n=n.Next;o&&n.Pt.X!==r.X&&(n=n.Next),s=this.DupOutPt(n,!o),e.FPoint.op_Inequality(s.Pt,r)&&((n=s).Pt.X=r.X,n.Pt.Y=r.Y,e.use_xyz&&(n.Pt.Z=r.Z),s=this.DupOutPt(n,!o))}else{for(;n.Next.Pt.X>=r.X&&n.Next.Pt.X<=n.Pt.X&&n.Next.Pt.Y===r.Y;)n=n.Next;o||n.Pt.X===r.X||(n=n.Next),s=this.DupOutPt(n,o),e.FPoint.op_Inequality(s.Pt,r)&&((n=s).Pt.X=r.X,n.Pt.Y=r.Y,e.use_xyz&&(n.Pt.Z=r.Z),s=this.DupOutPt(n,o))}return l===e.Direction.dLeftToRight===o?(t.Prev=n,n.Next=t,i.Next=s,s.Prev=i):(t.Next=n,n.Prev=t,i.Prev=s,s.Next=i),!0},e.Clipper.prototype.JoinPoints=function(t,i,n){var s=t.OutPt1,r=new e.OutPt,o=t.OutPt2,l=new e.OutPt,h=t.OutPt1.Pt.Y===t.OffPt.Y;if(h&&e.FPoint.op_Equality(t.OffPt,t.OutPt1.Pt)&&e.FPoint.op_Equality(t.OffPt,t.OutPt2.Pt)){if(i!==n)return!1;for(r=t.OutPt1.Next;r!==s&&e.FPoint.op_Equality(r.Pt,t.OffPt);)r=r.Next;var a=r.Pt.Y>t.OffPt.Y;for(l=t.OutPt2.Next;l!==o&&e.FPoint.op_Equality(l.Pt,t.OffPt);)l=l.Next;return a!==l.Pt.Y>t.OffPt.Y&&(a?(r=this.DupOutPt(s,!1),l=this.DupOutPt(o,!0),s.Prev=o,o.Next=s,r.Next=l,l.Prev=r,t.OutPt1=s,t.OutPt2=r,!0):(r=this.DupOutPt(s,!0),l=this.DupOutPt(o,!1),s.Next=o,o.Prev=s,r.Prev=l,l.Next=r,t.OutPt1=s,t.OutPt2=r,!0))}if(h){for(r=s;s.Prev.Pt.Y===s.Pt.Y&&s.Prev!==r&&s.Prev!==o;)s=s.Prev;for(;r.Next.Pt.Y===r.Pt.Y&&r.Next!==s&&r.Next!==o;)r=r.Next;if(r.Next===s||r.Next===o)return!1;for(l=o;o.Prev.Pt.Y===o.Pt.Y&&o.Prev!==l&&o.Prev!==r;)o=o.Prev;for(;l.Next.Pt.Y===l.Pt.Y&&l.Next!==o&&l.Next!==s;)l=l.Next;if(l.Next===o||l.Next===s)return!1;var p={Left:null,Right:null};if(!this.GetOverlap(s.Pt.X,r.Pt.X,o.Pt.X,l.Pt.X,p))return!1;var u,d=p.Left,c=p.Right,f=new e.FPoint0;return s.Pt.X>=d&&s.Pt.X<=c?(f.X=s.Pt.X,f.Y=s.Pt.Y,e.use_xyz&&(f.Z=s.Pt.Z),u=s.Pt.X>r.Pt.X):o.Pt.X>=d&&o.Pt.X<=c?(f.X=o.Pt.X,f.Y=o.Pt.Y,e.use_xyz&&(f.Z=o.Pt.Z),u=o.Pt.X>l.Pt.X):r.Pt.X>=d&&r.Pt.X<=c?(f.X=r.Pt.X,f.Y=r.Pt.Y,e.use_xyz&&(f.Z=r.Pt.Z),u=r.Pt.X>s.Pt.X):(f.X=l.Pt.X,f.Y=l.Pt.Y,e.use_xyz&&(f.Z=l.Pt.Z),u=l.Pt.X>o.Pt.X),t.OutPt1=s,t.OutPt2=o,this.JoinHorz(s,r,o,l,f,u)}for(r=s.Next;e.FPoint.op_Equality(r.Pt,s.Pt)&&r!==s;)r=r.Next;var y=r.Pt.Y>s.Pt.Y||!e.ClipperBase.SlopesEqual4(s.Pt,r.Pt,t.OffPt);if(y){for(r=s.Prev;e.FPoint.op_Equality(r.Pt,s.Pt)&&r!==s;)r=r.Prev;if(r.Pt.Y>s.Pt.Y||!e.ClipperBase.SlopesEqual4(s.Pt,r.Pt,t.OffPt))return!1}for(l=o.Next;e.FPoint.op_Equality(l.Pt,o.Pt)&&l!==o;)l=l.Next;var x=l.Pt.Y>o.Pt.Y||!e.ClipperBase.SlopesEqual4(o.Pt,l.Pt,t.OffPt);if(x){for(l=o.Prev;e.FPoint.op_Equality(l.Pt,o.Pt)&&l!==o;)l=l.Prev;if(l.Pt.Y>o.Pt.Y||!e.ClipperBase.SlopesEqual4(o.Pt,l.Pt,t.OffPt))return!1}return r!==s&&l!==o&&r!==l&&(i!==n||y!==x)&&(y?(r=this.DupOutPt(s,!1),l=this.DupOutPt(o,!0),s.Prev=o,o.Next=s,r.Next=l,l.Prev=r,t.OutPt1=s,t.OutPt2=r,!0):(r=this.DupOutPt(s,!0),l=this.DupOutPt(o,!1),s.Next=o,o.Prev=s,r.Prev=l,l.Next=r,t.OutPt1=s,t.OutPt2=r,!0))},e.Clipper.GetBounds=function(t){for(var i=0,n=t.length;is.right&&(s.right=t[i][r].X),t[i][r].Ys.bottom&&(s.bottom=t[i][r].Y);return s},e.Clipper.prototype.GetBounds2=function(t){var i=t,n=new e.FRect;for(n.left=t.Pt.X,n.right=t.Pt.X,n.top=t.Pt.Y,n.bottom=t.Pt.Y,t=t.Next;t!==i;)t.Pt.Xn.right&&(n.right=t.Pt.X),t.Pt.Yn.bottom&&(n.bottom=t.Pt.Y),t=t.Next;return n},e.Clipper.PointInPolygon=function(t,e){var i=0,n=e.length;if(n<3)return 0;for(var s=e[0],r=1;r<=n;++r){var o=r===n?e[0]:e[r];if(o.Y===t.Y&&(o.X===t.X||s.Y===t.Y&&o.X>t.X==s.X=t.X)if(o.X>t.X)i=1-i;else{if(0===(l=(s.X-t.X)*(o.Y-t.Y)-(o.X-t.X)*(s.Y-t.Y)))return-1;l>0==o.Y>s.Y&&(i=1-i)}else if(o.X>t.X){var l;if(0===(l=(s.X-t.X)*(o.Y-t.Y)-(o.X-t.X)*(s.Y-t.Y)))return-1;l>0==o.Y>s.Y&&(i=1-i)}s=o}return i},e.Clipper.prototype.PointInPolygon=function(t,e){var i=0,n=e,s=t.X,r=t.Y,o=e.Pt.X,l=e.Pt.Y;do{var h=(e=e.Next).Pt.X,a=e.Pt.Y;if(a===r&&(h===s||l===r&&h>s==o=s)if(h>s)i=1-i;else{if(0===(p=(o-s)*(a-r)-(h-s)*(l-r)))return-1;p>0==a>l&&(i=1-i)}else if(h>s){var p;if(0===(p=(o-s)*(a-r)-(h-s)*(l-r)))return-1;p>0==a>l&&(i=1-i)}o=h,l=a}while(n!==e);return i},e.Clipper.prototype.Poly2ContainsPoly1=function(t,e){var i=t;do{var n=this.PointInPolygon(i.Pt,e);if(n>=0)return n>0;i=i.Next}while(i!==t);return!0},e.Clipper.prototype.FixupFirstLefts1=function(t,i){for(var n,s,r=0,o=this.m_PolyOuts.length;r0&&this.ReversePolyPtLinks(r.Pts)):this.Poly2ContainsPoly1(s.Pts,r.Pts)?(r.IsHole=s.IsHole,s.IsHole=!r.IsHole,r.FirstLeft=s.FirstLeft,s.FirstLeft=r,this.m_UsingPolyTree&&this.FixupFirstLefts2(s,r),(s.IsHole^this.ReverseSolution)==this.Area$1(s)>0&&this.ReversePolyPtLinks(s.Pts)):(r.IsHole=s.IsHole,r.FirstLeft=s.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(s,r))):(r.Pts=null,r.BottomPt=null,r.Idx=s.Idx,s.IsHole=i.IsHole,i===r&&(s.FirstLeft=r.FirstLeft),r.FirstLeft=s,this.m_UsingPolyTree&&this.FixupFirstLefts3(r,s)))}},e.Clipper.prototype.UpdateOutPtIdxs=function(t){var e=t.Pts;do{e.Idx=t.Idx,e=e.Prev}while(e!==t.Pts)},e.Clipper.prototype.DoSimplePolygons=function(){for(var t=0;tMath.abs(t.Y-i.Y)?t.X>i.X==t.Xt.X==i.Xi.Y==t.Yt.Y==i.Y0&&s&&n.push(t.m_polygon);for(var r=0,o=t.Childs(),l=o.length,h=o[r];r0&&e.FPoint.op_Equality(t[0],t[s]);)s--;r.m_polygon.push(t[0]);for(var o=0,l=0,h=1;h<=s;h++)e.FPoint.op_Inequality(r.m_polygon[o],t[h])&&(o++,r.m_polygon.push(t[h]),(t[h].Y>r.m_polygon[l].Y||t[h].Y===r.m_polygon[l].Y&&t[h].Xa.Y||r.m_polygon[l].Y===a.Y&&r.m_polygon[l].X=0&&!e.Clipper.Orientation(this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon))for(var t=0;t2?this.m_miterLim=2/(this.MiterLimit*this.MiterLimit):this.m_miterLim=.5,n=this.ArcTolerance<=0?e.ClipperOffset.def_arc_tolerance:this.ArcTolerance>Math.abs(t)*e.ClipperOffset.def_arc_tolerance?Math.abs(t)*e.ClipperOffset.def_arc_tolerance:this.ArcTolerance;var s=3.14159265358979/Math.acos(1-n/Math.abs(t));this.m_sin=Math.sin(e.ClipperOffset.two_pi/s),this.m_cos=Math.cos(e.ClipperOffset.two_pi/s),this.m_StepsPerRad=s/e.ClipperOffset.two_pi,t<0&&(this.m_sin=-this.m_sin);for(i=0;i0;d--)this.m_normals[d]=new e.FPoint2(-this.m_normals[d-1].X,-this.m_normals[d-1].Y);this.m_normals[0]=new e.FPoint2(-h.X,-h.Y),l=0;for(d=o-1;d>=0;d--)l=this.OffsetPoint(d,l,r.m_jointype);this.m_destPolys.push(this.m_destPoly)}else{var a;for(l=0,d=1;d0;d--)this.m_normals[d]=new e.FPoint2(-this.m_normals[d-1].X,-this.m_normals[d-1].Y);this.m_normals[0]=new e.FPoint2(-this.m_normals[1].X,-this.m_normals[1].Y);for(d=(l=o-1)-1;d>0;--d)l=this.OffsetPoint(d,l,r.m_jointype);r.m_endtype===e.EndType.etOpenButt?(a=new e.FPoint2(this.m_srcPoly[0].X-this.m_normals[0].X*t,this.m_srcPoly[0].Y-this.m_normals[0].Y*t),this.m_destPoly.push(a),a=new e.FPoint2(this.m_srcPoly[0].X+this.m_normals[0].X*t,this.m_srcPoly[0].Y+this.m_normals[0].Y*t),this.m_destPoly.push(a)):(l=1,this.m_sinA=0,r.m_endtype===e.EndType.etOpenSquare?this.DoSquare(0,1):this.DoRound(0,1)),this.m_destPolys.push(this.m_destPoly)}}else{if(r.m_jointype===e.JoinType.jtRound)for(var p=1,u=0,d=1;d<=s;d++){this.m_destPoly.push(new e.FPoint2(this.m_srcPoly[0].X+p*t,this.m_srcPoly[0].Y+u*t));var c=p;p=p*this.m_cos-this.m_sin*u,u=c*this.m_sin+u*this.m_cos}else{p=-1,u=-1;for(var d=0;d<4;++d)this.m_destPoly.push(new e.FPoint2(this.m_srcPoly[0].X+p*t,this.m_srcPoly[0].Y+u*t)),p<0?p=1:u<0?u=1:p=-1}this.m_destPolys.push(this.m_destPoly)}}}},e.ClipperOffset.prototype.Execute=function(){var t=arguments;if(t[0]instanceof e.PolyTree){o=t[1];if((r=t[0]).Clear(),this.FixOrientations(),this.DoOffset(o),(s=new e.Clipper(0)).AddPaths(this.m_destPolys,e.PolyType.ptSubject,!0),o>0)s.Execute(e.ClipType.ctUnion,r,e.PolyFillType.pftPositive,e.PolyFillType.pftPositive);else{h=e.Clipper.GetBounds(this.m_destPolys);if((l=new e.Path).push(new e.FPoint2(h.left-10,h.bottom+10)),l.push(new e.FPoint2(h.right+10,h.bottom+10)),l.push(new e.FPoint2(h.right+10,h.top-10)),l.push(new e.FPoint2(h.left-10,h.top-10)),s.AddPath(l,e.PolyType.ptSubject,!0),s.ReverseSolution=!0,s.Execute(e.ClipType.ctUnion,r,e.PolyFillType.pftNegative,e.PolyFillType.pftNegative),1===r.ChildCount()&&r.Childs()[0].ChildCount()>0){var i=r.Childs()[0];r.Childs()[0]=i.Childs()[0],r.Childs()[0].m_Parent=r;for(var n=1;n0)s.Execute(e.ClipType.ctUnion,r,e.PolyFillType.pftPositive,e.PolyFillType.pftPositive);else{var l,h=e.Clipper.GetBounds(this.m_destPolys);(l=new e.Path).push(new e.FPoint2(h.left-10,h.bottom+10)),l.push(new e.FPoint2(h.right+10,h.bottom+10)),l.push(new e.FPoint2(h.right+10,h.top-10)),l.push(new e.FPoint2(h.left-10,h.top-10)),s.AddPath(l,e.PolyType.ptSubject,!0),s.ReverseSolution=!0,s.Execute(e.ClipType.ctUnion,r,e.PolyFillType.pftNegative,e.PolyFillType.pftNegative),r.length>0&&r.splice(0,1)}}},e.ClipperOffset.prototype.OffsetPoint=function(t,i,n){if(this.m_sinA=this.m_normals[i].X*this.m_normals[t].Y-this.m_normals[t].X*this.m_normals[i].Y,0===this.m_sinA)return i;if(this.m_sinA>1?this.m_sinA=1:this.m_sinA<-1&&(this.m_sinA=-1),this.m_sinA*this.m_delta<0)this.m_destPoly.push(new e.FPoint2(this.m_srcPoly[t].X+this.m_normals[i].X*this.m_delta,this.m_srcPoly[t].Y+this.m_normals[i].Y*this.m_delta)),this.m_destPoly.push(new e.FPoint1(this.m_srcPoly[t])),this.m_destPoly.push(new e.FPoint2(this.m_srcPoly[t].X+this.m_normals[t].X*this.m_delta,this.m_srcPoly[t].Y+this.m_normals[t].Y*this.m_delta));else switch(n){case e.JoinType.jtMiter:var s=this.m_normals[t].X*this.m_normals[i].X+this.m_normals[t].Y*this.m_normals[i].Y+1;s>=this.m_miterLim?this.DoMiter(t,i,s):this.DoSquare(t,i);break;case e.JoinType.jtSquare:this.DoSquare(t,i);break;case e.JoinType.jtRound:this.DoRound(t,i)}return i=t},e.ClipperOffset.prototype.DoSquare=function(t,i){var n=Math.tan(Math.atan2(this.m_sinA,this.m_normals[i].X*this.m_normals[t].X+this.m_normals[i].Y*this.m_normals[t].Y)/4);this.m_destPoly.push(new e.FPoint2(this.m_srcPoly[t].X+this.m_delta*(this.m_normals[i].X-this.m_normals[i].Y*n),this.m_srcPoly[t].Y+this.m_delta*(this.m_normals[i].Y+this.m_normals[i].X*n))),this.m_destPoly.push(new e.FPoint2(this.m_srcPoly[t].X+this.m_delta*(this.m_normals[t].X+this.m_normals[t].Y*n),this.m_srcPoly[t].Y+this.m_delta*(this.m_normals[t].Y-this.m_normals[t].X*n)))},e.ClipperOffset.prototype.DoMiter=function(t,i,n){var s=this.m_delta/n;this.m_destPoly.push(new e.FPoint2(this.m_srcPoly[t].X+(this.m_normals[i].X+this.m_normals[t].X)*s,this.m_srcPoly[t].Y+(this.m_normals[i].Y+this.m_normals[t].Y)*s))},e.ClipperOffset.prototype.DoRound=function(t,i){for(var n,s=Math.atan2(this.m_sinA,this.m_normals[i].X*this.m_normals[t].X+this.m_normals[i].Y*this.m_normals[t].Y),r=Math.max(Math.round(this.m_StepsPerRad*Math.abs(s)),1),o=this.m_normals[i].X,l=this.m_normals[i].Y,h=0;h1?(g=p.X,P=p.Y):x>0&&(g+=f*x,P+=y*x)),(f=u.X-g)*f+(y=u.Y-P)*y<=C&&(d[s+1]=1,s++);for(l.push({X:r[0].X,Y:r[0].Y}),s=1;s2&&_.push(l)}return m||(_=_[0]),void 0===_&&(_=[]),_},e.JS.PerimeterOfPath=function(t,e){if(void 0===t)return 0;var i,n,s=Math.sqrt,r=0,o=0,l=0,h=0,a=0,p=t.length;if(p<2)return 0;for(e&&(t[p]=t[0],p++);--p;)o=(i=t[p]).X,l=i.Y,r+=s((o-(h=(n=t[p-1]).X))*(o-h)+(l-(a=n.Y))*(l-a));return e&&t.pop(),r},e.JS.PerimeterOfPaths=function(t,i){for(var n=0,s=0;s{"use strict";function e(t,e,r){r=r||2;var o,l,h,u,d,f,y,x=e&&e.length,g=x?e[0]*r:t.length,P=i(t,0,g,r,!0),m=[];if(!P||P.next===P.prev)return m;if(x&&(P=function(t,e,s,r){var o,l,h,u=[];for(o=0,l=e.length;o80*r){o=h=t[0],l=u=t[1];for(var v=r;vh&&(h=d),f>u&&(u=f);y=0!==(y=Math.max(h-o,u-l))?1/y:0}return s(P,m,r,o,l,y),m}function i(t,e,i,n,s){var r,o;if(s===b(t,e,i,n)>0)for(r=e;r=e;r-=n)o=I(r,t[r],t[r+1],o);return o&&g(o,o.next)&&(E(o),o=o.next),o}function n(t,e){if(!t)return t;e||(e=t);var i,n=t;do{if(i=!1,n.steiner||!g(n,n.next)&&0!==x(n.prev,n,n.next))n=n.next;else{if(E(n),(n=e=n.prev)===n.next)break;i=!0}}while(i||n!==e);return e}function s(t,e,i,a,p,u,c){if(t){!c&&u&&function(t,e,i,n){var s=t;do{null===s.z&&(s.z=d(s.x,s.y,e,i,n)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next}while(s!==t);s.prevZ.nextZ=null,s.prevZ=null,function(t){var e,i,n,s,r,o,l,h,a=1;do{for(i=t,t=null,r=null,o=0;i;){for(o++,n=i,l=0,e=0;e0||h>0&&n;)0!==l&&(0===h||!n||i.z<=n.z)?(s=i,i=i.nextZ,l--):(s=n,n=n.nextZ,h--),r?r.nextZ=s:t=s,s.prevZ=r,r=s;i=n}r.nextZ=null,a*=2}while(o>1)}(s)}(t,a,p,u);for(var f,y,x=t;t.prev!==t.next;)if(f=t.prev,y=t.next,u?o(t,a,p,u):r(t))e.push(f.i/i),e.push(t.i/i),e.push(y.i/i),E(t),t=y.next,x=y.next;else if((t=y)===x){c?1===c?s(t=l(n(t),e,i),e,i,a,p,u,2):2===c&&h(t,e,i,a,p,u):s(n(t),e,i,a,p,u,1);break}}}function r(t){var e=t.prev,i=t,n=t.next;if(x(e,i,n)>=0)return!1;for(var s=t.next.next;s!==t.prev;){if(f(e.x,e.y,i.x,i.y,n.x,n.y,s.x,s.y)&&x(s.prev,s,s.next)>=0)return!1;s=s.next}return!0}function o(t,e,i,n){var s=t.prev,r=t,o=t.next;if(x(s,r,o)>=0)return!1;for(var l=s.xr.x?s.x>o.x?s.x:o.x:r.x>o.x?r.x:o.x,p=s.y>r.y?s.y>o.y?s.y:o.y:r.y>o.y?r.y:o.y,u=d(l,h,e,i,n),c=d(a,p,e,i,n),y=t.prevZ,g=t.nextZ;y&&y.z>=u&&g&&g.z<=c;){if(y!==t.prev&&y!==t.next&&f(s.x,s.y,r.x,r.y,o.x,o.y,y.x,y.y)&&x(y.prev,y,y.next)>=0)return!1;if(y=y.prevZ,g!==t.prev&&g!==t.next&&f(s.x,s.y,r.x,r.y,o.x,o.y,g.x,g.y)&&x(g.prev,g,g.next)>=0)return!1;g=g.nextZ}for(;y&&y.z>=u;){if(y!==t.prev&&y!==t.next&&f(s.x,s.y,r.x,r.y,o.x,o.y,y.x,y.y)&&x(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;g&&g.z<=c;){if(g!==t.prev&&g!==t.next&&f(s.x,s.y,r.x,r.y,o.x,o.y,g.x,g.y)&&x(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function l(t,e,i){var s=t;do{var r=s.prev,o=s.next.next;!g(r,o)&&P(r,s,s.next,o)&&C(r,o)&&C(o,r)&&(e.push(r.i/i),e.push(s.i/i),e.push(o.i/i),E(s),E(s.next),s=t=o),s=s.next}while(s!==t);return n(s)}function h(t,e,i,r,o,l){var h=t;do{for(var a=h.next.next;a!==h.prev;){if(h.i!==a.i&&y(h,a)){var p=_(h,a);return h=n(h,h.next),p=n(p,p.next),s(h,e,i,r,o,l),void s(p,e,i,r,o,l)}a=a.next}h=h.next}while(h!==t)}function a(t,e){return t.x-e.x}function p(t,e){var i=function(t,e){var i,n=e,s=t.x,r=t.y,o=-1/0;do{if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){var l=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(l<=s&&l>o){if(o=l,l===s){if(r===n.y)return n;if(r===n.next.y)return n.next}i=n.x=n.x&&n.x>=p&&s!==n.x&&f(ri.x||n.x===i.x&&u(i,n)))&&(i=n,c=h)),n=n.next}while(n!==a);return i}(t,e);if(!i)return e;var s=_(i,t),r=n(i,i.next);return n(s,s.next),e===i?r:e}function u(t,e){return x(t.prev,t,e.prev)<0&&x(e.next,t,t.next)<0}function d(t,e,i,n,s){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*s)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*s)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function c(t){var e=t,i=t;do{(e.x=0&&(t-o)*(n-l)-(i-o)*(e-l)>=0&&(i-o)*(r-l)-(s-o)*(n-l)>=0}function y(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&P(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(C(t,e)&&C(e,t)&&function(t,e){var i=t,n=!1,s=(t.x+e.x)/2,r=(t.y+e.y)/2;do{i.y>r!=i.next.y>r&&i.next.y!==i.y&&s<(i.next.x-i.x)*(r-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)&&(x(t.prev,t,e.prev)||x(t,e.prev,e))||g(t,e)&&x(t.prev,t,t.next)>0&&x(e.prev,e,e.next)>0)}function x(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function g(t,e){return t.x===e.x&&t.y===e.y}function P(t,e,i,n){var s=v(x(t,e,i)),r=v(x(t,e,n)),o=v(x(i,n,t)),l=v(x(i,n,e));return s!==r&&o!==l||(!(0!==s||!m(t,i,e))||(!(0!==r||!m(t,n,e))||(!(0!==o||!m(i,t,n))||!(0!==l||!m(i,e,n)))))}function m(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function v(t){return t>0?1:t<0?-1:0}function C(t,e){return x(t.prev,t,t.next)<0?x(t,e,t.next)>=0&&x(t,t.prev,e)>=0:x(t,e,t.prev)<0||x(t,t.next,e)<0}function _(t,e){var i=new T(t.i,t.x,t.y),n=new T(e.i,e.x,e.y),s=t.next,r=e.prev;return t.next=e,e.prev=t,i.next=s,s.prev=i,n.next=i,i.prev=n,r.next=n,n.prev=r,n}function I(t,e,i,n){var s=new T(t,e,i);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function E(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function T(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function b(t,e,i,n){for(var s=0,r=e,o=i-n;r0&&(n+=t[s-1].length,i.holes.push(n))}return i}},2752:t=>{"use strict";var e=function(t,e){this.head_=t,this.tail_=e,this.search_node_=t};e.prototype.head=function(){return this.head_},e.prototype.setHead=function(t){this.head_=t},e.prototype.tail=function(){return this.tail_},e.prototype.setTail=function(t){this.tail_=t},e.prototype.search=function(){return this.search_node_},e.prototype.setSearch=function(t){this.search_node_=t},e.prototype.findSearchNode=function(){return this.search_node_},e.prototype.locateNode=function(t){var e=this.search_node_;if(t=e.value)return this.search_node_=e,e}else for(;e=e.next;)if(t{"use strict";t.exports=function(t,e){if(!t)throw new Error(e||"Assert Failed")}},1688:(t,e,i)=>{"use strict";var n=i(9071),s=function(t,e){this.x=+t||0,this.y=+e||0,this._p2t_edge_list=null};s.prototype.toString=function(){return n.toStringBase(this)},s.prototype.toJSON=function(){return{x:this.x,y:this.y}},s.prototype.clone=function(){return new s(this.x,this.y)},s.prototype.set_zero=function(){return this.x=0,this.y=0,this},s.prototype.set=function(t,e){return this.x=+t||0,this.y=+e||0,this},s.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},s.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this},s.prototype.sub=function(t){return this.x-=t.x,this.y-=t.y,this},s.prototype.mul=function(t){return this.x*=t,this.y*=t,this},s.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},s.prototype.normalize=function(){var t=this.length();return this.x/=t,this.y/=t,t},s.prototype.equals=function(t){return this.x===t.x&&this.y===t.y},s.negate=function(t){return new s(-t.x,-t.y)},s.add=function(t,e){return new s(t.x+e.x,t.y+e.y)},s.sub=function(t,e){return new s(t.x-e.x,t.y-e.y)},s.mul=function(t,e){return new s(t*e.x,t*e.y)},s.cross=function(t,e){return"number"==typeof t?"number"==typeof e?t*e:new s(-t*e.y,t*e.x):"number"==typeof e?new s(e*t.y,-e*t.x):t.x*e.y-t.y*e.x},s.toString=n.toString,s.compare=n.compare,s.cmp=n.compare,s.equals=n.equals,s.dot=function(t,e){return t.x*e.x+t.y*e.y},t.exports=s},3704:(t,e,i)=>{"use strict";var n=i(9071),s=function(t,e){this.name="PointError",this.points=e=e||[],this.message=t||"Invalid Points!";for(var i=0;i{"use strict";var n=i.g.poly2tri;e.noConflict=function(){return i.g.poly2tri=n,e},e.VERSION=i(3095).version,e.PointError=i(3704),e.Point=i(1688),e.Triangle=i(1580),e.SweepContext=i(2115);var s=i(1110);e.triangulate=s.triangulate,e.sweep={Triangulate:s.triangulate}},1110:(t,e,i)=>{"use strict";var n=i(2014),s=i(3704),r=i(1580),o=i(2752).Node,l=i(4555),h=l.EPSILON,a=l.Orientation,p=l.orient2d,u=l.inScanArea,d=l.isAngleObtuse;function c(t,e){var i=t.locateNode(e),s=function(t,e,i){var n=new r(e,i.point,i.next.point);n.markNeighbor(i.triangle),t.addToMap(n);var s=new o(e);s.next=i.next,s.prev=i,i.next.prev=s,i.next=s,P(t,n)||t.mapTriangleToNodes(n);return s}(t,e,i);return e.x<=i.point.x+h&&g(t,i),function(t,e){var i=e.next;for(;i.next&&!d(i.point,i.next.point,i.prev.point);)g(t,i),i=i.next;i=e.prev;for(;i.prev&&!d(i.point,i.next.point,i.prev.point);)g(t,i),i=i.prev;e.next&&e.next.next&&function(t){var e=t.point.x-t.next.next.point.x,i=t.point.y-t.next.next.point.y;return n(i>=0,"unordered y"),e>=0||Math.abs(e)=t.basin.bottom_node.next.point.y;)t.basin.bottom_node=t.basin.bottom_node.next;if(t.basin.bottom_node===t.basin.left_node)return;t.basin.right_node=t.basin.bottom_node;for(;t.basin.right_node.next&&t.basin.right_node.point.yt.basin.right_node.point.y,C(t,t.basin.bottom_node)}(t,e)}(t,s),s}function f(t,e,i){t.edge_event.constrained_edge=e,t.edge_event.right=e.p.x>e.q.x,x(i.triangle,e.p,e.q)||(!function(t,e,i){t.edge_event.right?function(t,e,i){for(;i.next.point.xe.p.x;)p(e.q,i.prev.point,e.p)===a.CW?T(t,e,i):i=i.prev}(t,e,i)}(t,e,i),y(t,e.p,e.q,i.triangle,e.q))}function y(t,e,i,n,r){if(!x(n,e,i)){var o=n.pointCCW(r),l=p(i,o,e);if(l===a.COLLINEAR)throw new s("poly2tri EdgeEvent: Collinear not supported!",[i,o,e]);var h=n.pointCW(r),u=p(i,h,e);if(u===a.COLLINEAR)throw new s("poly2tri EdgeEvent: Collinear not supported!",[i,h,e]);l===u?y(t,e,i,n=l===a.CW?n.neighborCCW(r):n.neighborCW(r),r):S(t,e,i,n,r)}}function x(t,e,i){var n=t.edgeIndex(e,i);if(-1!==n){t.markConstrainedEdgeByIndex(n);var s=t.getNeighbor(n);return s&&s.markConstrainedEdgeByPoints(e,i),!0}return!1}function g(t,e){var i=new r(e.prev.point,e.point,e.next.point);i.markNeighbor(e.prev.triangle),i.markNeighbor(e.triangle),t.addToMap(i),e.prev.next=e.next,e.next.prev=e.prev,P(t,i)||t.mapTriangleToNodes(i)}function P(t,e){for(var i=0;i<3;++i)if(!e.delaunay_edge[i]){var n=e.getNeighbor(i);if(n){var s=e.getPoint(i),r=n.oppositePoint(e,s),o=n.index(r);if(n.constrained_edge[o]||n.delaunay_edge[o]){e.constrained_edge[i]=n.constrained_edge[o];continue}if(m(s,e.pointCCW(s),e.pointCW(s),r)){e.delaunay_edge[i]=!0,n.delaunay_edge[o]=!0,v(e,s,n,r);var l=!P(t,e);return l&&t.mapTriangleToNodes(e),(l=!P(t,n))&&t.mapTriangleToNodes(n),e.delaunay_edge[i]=!1,n.delaunay_edge[o]=!1,!0}}}return!1}function m(t,e,i,n){var s=t.x-n.x,r=t.y-n.y,o=e.x-n.x,l=e.y-n.y,h=s*l-o*r;if(h<=0)return!1;var a=i.x-n.x,p=i.y-n.y,u=a*r-s*p;return!(u<=0)&&(s*s+r*r)*(o*p-a*l)+(o*o+l*l)*u+(a*a+p*p)*h>0}function v(t,e,i,n){var s,r,o,l,h,a,p,u,d,c,f,y;s=t.neighborCCW(e),r=t.neighborCW(e),o=i.neighborCCW(n),l=i.neighborCW(n),h=t.getConstrainedEdgeCCW(e),a=t.getConstrainedEdgeCW(e),p=i.getConstrainedEdgeCCW(n),u=i.getConstrainedEdgeCW(n),d=t.getDelaunayEdgeCCW(e),c=t.getDelaunayEdgeCW(e),f=i.getDelaunayEdgeCCW(n),y=i.getDelaunayEdgeCW(n),t.legalize(e,n),i.legalize(n,e),i.setDelaunayEdgeCCW(e,d),t.setDelaunayEdgeCW(e,c),t.setDelaunayEdgeCCW(n,f),i.setDelaunayEdgeCW(n,y),i.setConstrainedEdgeCCW(e,h),t.setConstrainedEdgeCW(e,a),t.setConstrainedEdgeCCW(n,p),i.setConstrainedEdgeCW(n,u),t.clearNeighbors(),i.clearNeighbors(),s&&i.markNeighbor(s),r&&t.markNeighbor(r),o&&t.markNeighbor(o),l&&i.markNeighbor(l),t.markNeighbor(i)}function C(t,e){if(!function(t,e){var i;i=t.basin.left_highest?t.basin.left_node.point.y-e.point.y:t.basin.right_node.point.y-e.point.y;if(t.basin.width>i)return!0;return!1}(t,e)&&(g(t,e),e.prev!==t.basin.left_node||e.next!==t.basin.right_node)){if(e.prev===t.basin.left_node){if(p(e.point,e.next.point,e.next.next.point)===a.CW)return;e=e.next}else if(e.next===t.basin.right_node){if(p(e.point,e.prev.point,e.prev.prev.point)===a.CCW)return;e=e.prev}else e=e.prev.point.ye.p.x&&(p(i.point,i.prev.point,i.prev.prev.point)===a.CW?L(t,e,i):(b(t,e,i),T(t,e,i)))}function b(t,e,i){p(i.prev.point,i.prev.prev.point,i.prev.prev.prev.point)===a.CW?L(t,e,i.prev):p(e.q,i.prev.prev.point,e.p)===a.CW&&b(t,e,i.prev)}function L(t,e,i){g(t,i.prev),i.prev.point!==e.p&&p(e.q,i.prev.point,e.p)===a.CW&&p(i.point,i.prev.point,i.prev.prev.point)===a.CW&&L(t,e,i)}function S(t,e,i,r,o){var l=r.neighborAcross(o);n(l,"FLIP failed due to missing triangle!");var h=l.oppositePoint(r,o);if(r.getConstrainedEdgeAcross(o)){var d=r.index(o);throw new s("poly2tri Intersecting Constraints",[o,h,r.getPoint((d+1)%3),r.getPoint((d+2)%3)])}u(o,r.pointCCW(o),r.pointCW(o),h)?(v(r,o,l,h),t.mapTriangleToNodes(r),t.mapTriangleToNodes(l),o===i&&h===e?i===t.edge_event.constrained_edge.q&&e===t.edge_event.constrained_edge.p&&(r.markConstrainedEdgeByPoints(e,i),l.markConstrainedEdgeByPoints(e,i),P(t,r),P(t,l)):(r=function(t,e,i,n,s,r){var o;if(e===a.CCW)return o=n.edgeIndex(s,r),n.delaunay_edge[o]=!0,P(t,n),n.clearDelaunayEdges(),i;return o=i.edgeIndex(s,r),i.delaunay_edge[o]=!0,P(t,i),i.clearDelaunayEdges(),n}(t,p(i,h,e),r,l,o,h),S(t,e,i,r,o))):(N(t,e,i,r,l,A(e,i,l,h)),y(t,e,i,r,o))}function A(t,e,i,n){var r=p(e,n,t);if(r===a.CW)return i.pointCCW(n);if(r===a.CCW)return i.pointCW(n);throw new s("poly2tri [Unsupported] nextFlipPoint: opposing point on constrained edge!",[e,n,t])}function N(t,e,i,s,r,o){var l=r.neighborAcross(o);n(l,"FLIP failed due to missing triangle");var h=l.oppositePoint(r,o);u(i,s.pointCCW(i),s.pointCW(i),h)?S(t,i,h,l,h):N(t,e,i,s,l,A(e,i,l,h))}e.triangulate=function(t){t.initTriangulation(),t.createAdvancingFront(),function(t){var e,i=t.pointCount();for(e=1;e{"use strict";var n=i(3704),s=i(1688),r=i(1580),o=i(1110),l=i(2752),h=l.Node,a=function(t,e){if(this.p=t,this.q=e,t.y>e.y)this.q=t,this.p=e;else if(t.y===e.y)if(t.x>e.x)this.q=t,this.p=e;else if(t.x===e.x)throw new n("poly2tri Invalid Edge constructor: repeated points!",[t]);this.q._p2t_edge_list||(this.q._p2t_edge_list=[]),this.q._p2t_edge_list.push(this)},p=function(){this.left_node=null,this.bottom_node=null,this.right_node=null,this.width=0,this.left_highest=!1};p.prototype.clear=function(){this.left_node=null,this.bottom_node=null,this.right_node=null,this.width=0,this.left_highest=!1};var u=function(){this.constrained_edge=null,this.right=!1},d=function(t,e){e=e||{},this.triangles_=[],this.map_=[],this.points_=e.cloneArrays?t.slice(0):t,this.edge_list=[],this.pmin_=this.pmax_=null,this.front_=null,this.head_=null,this.tail_=null,this.af_head_=null,this.af_middle_=null,this.af_tail_=null,this.basin=new p,this.edge_event=new u,this.initEdges(this.points_)};d.prototype.addHole=function(t){this.initEdges(t);var e,i=t.length;for(e=0;ee&&(e=l.x),l.xn&&(n=l.y),l.y{"use strict";var n=function(t,e,i){this.points_=[t,e,i],this.neighbors_=[null,null,null],this.interior_=!1,this.constrained_edge=[!1,!1,!1],this.delaunay_edge=[!1,!1,!1]},s=i(9071).toString;n.prototype.toString=function(){return"["+s(this.points_[0])+s(this.points_[1])+s(this.points_[2])+"]"},n.prototype.getPoint=function(t){return this.points_[t]},n.prototype.GetPoint=n.prototype.getPoint,n.prototype.getPoints=function(){return this.points_},n.prototype.getNeighbor=function(t){return this.neighbors_[t]},n.prototype.containsPoint=function(t){var e=this.points_;return t===e[0]||t===e[1]||t===e[2]},n.prototype.containsEdge=function(t){return this.containsPoint(t.p)&&this.containsPoint(t.q)},n.prototype.containsPoints=function(t,e){return this.containsPoint(t)&&this.containsPoint(e)},n.prototype.isInterior=function(){return this.interior_},n.prototype.setInterior=function(t){return this.interior_=t,this},n.prototype.markNeighborPointers=function(t,e,i){var n=this.points_;if(t===n[2]&&e===n[1]||t===n[1]&&e===n[2])this.neighbors_[0]=i;else if(t===n[0]&&e===n[2]||t===n[2]&&e===n[0])this.neighbors_[1]=i;else{if(!(t===n[0]&&e===n[1]||t===n[1]&&e===n[0]))throw new Error("poly2tri Invalid Triangle.markNeighborPointers() call");this.neighbors_[2]=i}},n.prototype.markNeighbor=function(t){var e=this.points_;t.containsPoints(e[1],e[2])?(this.neighbors_[0]=t,t.markNeighborPointers(e[1],e[2],this)):t.containsPoints(e[0],e[2])?(this.neighbors_[1]=t,t.markNeighborPointers(e[0],e[2],this)):t.containsPoints(e[0],e[1])&&(this.neighbors_[2]=t,t.markNeighborPointers(e[0],e[1],this))},n.prototype.clearNeighbors=function(){this.neighbors_[0]=null,this.neighbors_[1]=null,this.neighbors_[2]=null},n.prototype.clearDelaunayEdges=function(){this.delaunay_edge[0]=!1,this.delaunay_edge[1]=!1,this.delaunay_edge[2]=!1},n.prototype.pointCW=function(t){var e=this.points_;return t===e[0]?e[2]:t===e[1]?e[0]:t===e[2]?e[1]:null},n.prototype.pointCCW=function(t){var e=this.points_;return t===e[0]?e[1]:t===e[1]?e[2]:t===e[2]?e[0]:null},n.prototype.neighborCW=function(t){return t===this.points_[0]?this.neighbors_[1]:t===this.points_[1]?this.neighbors_[2]:this.neighbors_[0]},n.prototype.neighborCCW=function(t){return t===this.points_[0]?this.neighbors_[2]:t===this.points_[1]?this.neighbors_[0]:this.neighbors_[1]},n.prototype.getConstrainedEdgeCW=function(t){return t===this.points_[0]?this.constrained_edge[1]:t===this.points_[1]?this.constrained_edge[2]:this.constrained_edge[0]},n.prototype.getConstrainedEdgeCCW=function(t){return t===this.points_[0]?this.constrained_edge[2]:t===this.points_[1]?this.constrained_edge[0]:this.constrained_edge[1]},n.prototype.getConstrainedEdgeAcross=function(t){return t===this.points_[0]?this.constrained_edge[0]:t===this.points_[1]?this.constrained_edge[1]:this.constrained_edge[2]},n.prototype.setConstrainedEdgeCW=function(t,e){t===this.points_[0]?this.constrained_edge[1]=e:t===this.points_[1]?this.constrained_edge[2]=e:this.constrained_edge[0]=e},n.prototype.setConstrainedEdgeCCW=function(t,e){t===this.points_[0]?this.constrained_edge[2]=e:t===this.points_[1]?this.constrained_edge[0]=e:this.constrained_edge[1]=e},n.prototype.getDelaunayEdgeCW=function(t){return t===this.points_[0]?this.delaunay_edge[1]:t===this.points_[1]?this.delaunay_edge[2]:this.delaunay_edge[0]},n.prototype.getDelaunayEdgeCCW=function(t){return t===this.points_[0]?this.delaunay_edge[2]:t===this.points_[1]?this.delaunay_edge[0]:this.delaunay_edge[1]},n.prototype.setDelaunayEdgeCW=function(t,e){t===this.points_[0]?this.delaunay_edge[1]=e:t===this.points_[1]?this.delaunay_edge[2]=e:this.delaunay_edge[0]=e},n.prototype.setDelaunayEdgeCCW=function(t,e){t===this.points_[0]?this.delaunay_edge[2]=e:t===this.points_[1]?this.delaunay_edge[0]=e:this.delaunay_edge[1]=e},n.prototype.neighborAcross=function(t){return t===this.points_[0]?this.neighbors_[0]:t===this.points_[1]?this.neighbors_[1]:this.neighbors_[2]},n.prototype.oppositePoint=function(t,e){var i=t.pointCW(e);return this.pointCW(i)},n.prototype.legalize=function(t,e){var i=this.points_;if(t===i[0])i[1]=i[0],i[0]=i[2],i[2]=e;else if(t===i[1])i[2]=i[1],i[1]=i[0],i[0]=e;else{if(t!==i[2])throw new Error("poly2tri Invalid Triangle.legalize() call");i[0]=i[2],i[2]=i[1],i[1]=e}},n.prototype.index=function(t){var e=this.points_;if(t===e[0])return 0;if(t===e[1])return 1;if(t===e[2])return 2;throw new Error("poly2tri Invalid Triangle.index() call")},n.prototype.edgeIndex=function(t,e){var i=this.points_;if(t===i[0]){if(e===i[1])return 2;if(e===i[2])return 1}else if(t===i[1]){if(e===i[2])return 0;if(e===i[0])return 2}else if(t===i[2]){if(e===i[0])return 1;if(e===i[1])return 0}return-1},n.prototype.markConstrainedEdgeByIndex=function(t){this.constrained_edge[t]=!0},n.prototype.markConstrainedEdgeByEdge=function(t){this.markConstrainedEdgeByPoints(t.p,t.q)},n.prototype.markConstrainedEdgeByPoints=function(t,e){var i=this.points_;e===i[0]&&t===i[1]||e===i[1]&&t===i[0]?this.constrained_edge[2]=!0:e===i[0]&&t===i[2]||e===i[2]&&t===i[0]?this.constrained_edge[1]=!0:(e===i[1]&&t===i[2]||e===i[2]&&t===i[1])&&(this.constrained_edge[0]=!0)},t.exports=n},4555:(t,e)=>{"use strict";var i=1e-12;e.EPSILON=i;var n={CW:1,CCW:-1,COLLINEAR:0};e.Orientation=n,e.orient2d=function(t,e,s){var r=(t.x-s.x)*(e.y-s.y)-(t.y-s.y)*(e.x-s.x);return r>-1e-12&&r0?n.CCW:n.CW},e.inScanArea=function(t,e,n,s){return!((t.x-e.x)*(s.y-e.y)-(s.x-e.x)*(t.y-e.y)>=-1e-12)&&!((t.x-n.x)*(s.y-n.y)-(s.x-n.x)*(t.y-n.y)<=i)},e.isAngleObtuse=function(t,e,i){var n=e.x-t.x,s=e.y-t.y;return n*(i.x-t.x)+s*(i.y-t.y)<0}},9071:t=>{"use strict";function e(t){return"("+t.x+";"+t.y+")"}t.exports={toString:function(t){var i=t.toString();return"[object Object]"===i?e(t):i},toStringBase:e,compare:function(t,e){return t.y===e.y?t.x-e.x:t.y-e.y},equals:function(t,e){return t.x===e.x&&t.y===e.y}}},8917:(t,e,i)=>{"use strict";i.r(e),i.d(e,{Path2D:()=>c});var n=i(2641),s=i.n(n),r=i(1791),o=i.n(r),l=i(8831);let h=new THREE.Vector2,a=new THREE.Vector2,p=new THREE.Box2,u=null,d=()=>(u=u||new Autodesk.Extensions.CompGeom.EllipseArc,u);function c(t){this.segTypes=[],this.segData=[],this.hasCurves=!1,this.bbox=new THREE.Box2,this.precisionTolerance=t}c.FORCE_MITER_LINES_FOR_TESTING=!1,c.prototype.setTessParams=function(t){this.tessParams=t},c.prototype.isClosedPath=function(){return this.segTypes.length&&7===this.segTypes[this.segTypes.length-1]},c.prototype.isPoint=function(){return 2==this.segTypes.length&&0===this.segTypes[0]&&1===this.segTypes[1]&&this.segData[0]==this.segData[2]&&this.segData[1]==this.segData[3]},c.prototype.closePath=function(){this.isClosedPath()||this.segTypes.push(7)},c.prototype.moveTo=function(t,e){this.segTypes.push(0),this.segData.push(t,e),this.bbox.expandByPoint(h.set(t,e))},c.prototype.lineTo=function(t,e){this.segTypes.push(1),this.segData.push(t,e),this.bbox.expandByPoint(h.set(t,e))},c.prototype.arc=function(t,e,i,n,s,r){this.hasCurves=!0,this.segTypes.push(2),this.segData.push(t,e,i,n,s,r),this.bbox.expandByPoint(h.set(t,e))},c.prototype.arcTo=function(t,e,i,n,s){this.hasCurves=!0,this.segTypes.push(3),this.segData.push(t,e,i,n,s),this.bbox.expandByPoint(h.set(t,e)),this.bbox.expandByPoint(h.set(i,n))},c.prototype.quadraticCurveTo=function(t,e,i,n){this.hasCurves=!0,this.segTypes.push(4),this.segData.push(t,e,i,n),this.bbox.expandByPoint(h.set(t,e)),this.bbox.expandByPoint(h.set(i,n))},c.prototype.bezierCurveTo=function(t,e,i,n,s,r){this.hasCurves=!0,this.segTypes.push(5),this.segData.push(t,e,i,n,s,r),this.bbox.expandByPoint(h.set(t,e)),this.bbox.expandByPoint(h.set(i,n)),this.bbox.expandByPoint(h.set(s,r))},c.prototype.ellipse=function(t,e,i,n,s,r,o,l){this.hasCurves=!0,this.segTypes.push(6),this.segData.push(t,e,i,n,s,r,o,l);const h=d().set(t,e,i,n,s,r,o,l).computeBBox(p);this.bbox.union(h)},c.prototype.flatten=function(t){var e=new c(this.precisionTolerance),i=0,n=0,s=0,r=n,o=s,h=this.segTypes,p=this.segData;let u=this.bbox.getSize(a).length();for(var f=0;fMath.abs(s)?n>0?t[i].X-=i*e:t[i].X+=i*e:s>0?t[i].Y-=i*e:t[i].Y+=i*e}};var v=o.flattened||o.flatten(!0),C=v.toClipperPath(t,!1);y.map((o=>{var u=d.preCheckForClipping(t,v,o,l,!0);if(!u.needCancel)if(u.needClipping&&!o.isPoint()){var c=o.toClipperPath(t,l)[0];if(!c)return;s().Clipper.Orientation(c)&&c.reverse();var f=new(s().PolyTree),y=new(s().Clipper);p(c),y.AddPath(c,s().PolyType.ptSubject,!1),y.AddPaths(C,s().PolyType.ptClip,!0),y.Execute(s().ClipType.ctIntersection,f,s().PolyFillType.pftEvenOdd,s().PolyFillType.pftEvenOdd),function(s){var o=s.GetFirst();for(;o;)d.strokeClipperContour(t,o.Contour(),o.IsOpen,i,e,n,r,t.currentVpId,h,!1,a),o=o.GetNext()}(f)}else(!u.needClipping||1==C.length&&s().Clipper.PointInPolygon({X:o.segData[0],Y:o.segData[1]},C[0]))&&this.strokeFlattedPath(t,o,e,i,n,r,l,h,a)}))}else this.strokeFlattedPath(t,u,e,i,n,r,l,h,a)},c.prototype.strokeFlattedPath=function(t,e,i,n,s,r,o,l,h){let a,p=e.segData,u=e.segTypes;o&&(a=t.getCurrentTransform());const d="butt"===h;for(var f=0,y=0,x=0,g=0,P=0,m=0,v=0,C=0;C0&&0===u[C-1];if(e!==g||h!==P||I){const m=d&&I,v=Ct)return!1;s/=h,r/=h,o/=a,l/=a;let p=s*o+r*l;if(Math.abs(1+p)>e)return!1;let u=n[4]-n[2],d=n[5]-n[3],c=n[8]-n[6],f=n[9]-n[7],y=Math.sqrt(u*u+d*d),x=Math.sqrt(c*c+f*f);return!(Math.abs(y-x)>t)&&(u/=y,d/=y,c/=x,f/=x,p=u*c+d*f,!(Math.abs(1+p)>e)&&(p=s*u+r*d,!(Math.abs(p)>e)&&!(Math.abs(s)>t&&Math.abs(r))))};c.prototype.isAABBContain=function(t){return this.isAABB()?function(t,e,i){if(t.containsBox(e))return 1;let n=i;return void 0===n&&(n=.001/t.size().length()),e.min.x-t.max.x>n||e.min.y-t.min.y>n||e.max.x-t.max.x<-n||e.max.y-t.max.y<-n?2:e.min.x-t.min.x<-n||e.min.y-t.min.y<-n||e.max.x-t.max.x>n||e.max.y-t.max.y>n?4:1}(this.bbox,t,this.precisionTolerance):4},c.prototype.clip=function(t,e){var i=t.flattened||t.flatten(!0),n=this.flattened||this.flatten(!0),r=this.preCheckForClipping(null,i,n,!1,!1);if(r.needCancel)return console.warn("No overlap between nested clip regions."),new c;if(0==r.needClipping)return r.needSwapSubject?t:this;{var o=i.toClipperPath(null,!1),l=n.toClipperPath(null,!1),h=new(s().PolyTree),a=new(s().Clipper);a.AddPaths(l,s().PolyType.ptSubject,!0),a.AddPaths(o,s().PolyType.ptClip,!0),a.Execute(s().ClipType.ctIntersection,h,s().PolyFillType.pftEvenOdd,s().PolyFillType.pftEvenOdd);let t=new c(this.precisionTolerance);for(var p=h.GetFirst();p;){for(var u=p.Contour(),d=0;d{!function(s,r,o){var h=s.vertices;if(r){for(var u=t.getCurrentTransform(),d=[],c=0;c0&&(n[n.length-1].X!=s.X||n[n.length-1].Y!=s.Y)||0==n.length)&&n.push(s)}e&&(i=t.getCurrentTransform());for(var a=0;a1&&n.push(s),h(s=[],{X:o[l++],Y:o[l++]})):1==r[a]?h(s,{X:o[l++],Y:o[l++]}):7==r[a]&&(s.push({X:s[0].X,Y:s[0].Y}),n.push(s),s=[]);return s&&s.length>1&&n.push(s),n},c.prototype.hasIntersection=function(t,e,i){return!(t.max.x-e.min.x<=-i||t.max.y-e.min.y<=-i||t.min.x-e.max.x>=i||t.min.y-e.max.y>=i)},c.prototype.preCheckForClipping=function(t,e,i,n,s){var r=e.bbox,o=i.bbox;if(n){let e=t.getCurrentTransform();o=t.transformBox(o,e,p)}return this.hasIntersection(r,o,this.precisionTolerance)?e.isAABB()&&r.containsBox(o)?{needClipping:!1}:i.isAABB()&&o.containsBox(r)?s?{needCancel:!0}:{needClipping:!1,needSwapSubject:!0}:{needClipping:!0}:{needCancel:!0}},c.prototype.getPolygonFromClipperSolution=function(t){function e(t,e,i){for(var n=0;n{var i=[],n=[],r=[];if(1==t.holes.length&&Math.abs(s().JS.AreaOfPolygons(t.holes))>Math.abs(s().JS.AreaOfPolygon(t.outer))){let e=t.holes[0];t.holes[0]=t.outer,t.outer=e}e(r,i,t.outer),t.holes.map((t=>{n.push(i.length/2),e(r,i,t)}));var l=o()(i,n);return{vertices:i,indices:l,holeIndices:n,contours:r}}))},c.prototype.msdfClipping=function(t){var e=(this.flattened||this.flatten(!0)).toClipperPath(null,!1),i=t.toClipperPath(null,!1),n=new(s().PolyTree),r=new(s().Clipper);return r.AddPaths(e,s().PolyType.ptSubject,!0),r.AddPaths(i,s().PolyType.ptClip,!0),r.Execute(s().ClipType.ctIntersection,n,s().PolyFillType.pftEvenOdd,s().PolyFillType.pftEvenOdd),this.getPolygonFromClipperSolution(n)}},299:(t,e,i)=>{"use strict";i.r(e),i.d(e,{UniquePointList:()=>c});var n=i(5229),s=i(5420),r=i(6435),o=i.n(r);let l=function(t,e,i){this.x=t||0,this.y=e||0,this.z=i||0};var h,a,p,u;l.prototype={constructor:l,set:function(t,e,i){return this.x=t,this.y=e,this.z=i,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyMatrix3:function(t){var e=this.x,i=this.y,n=this.z,s=t.elements;return this.x=s[0]*e+s[3]*i+s[6]*n,this.y=s[1]*e+s[4]*i+s[7]*n,this.z=s[2]*e+s[5]*i+s[8]*n,this},applyMatrix4:function(t){var e=this.x,i=this.y,n=this.z,s=t.elements;return this.x=s[0]*e+s[4]*i+s[8]*n+s[12],this.y=s[1]*e+s[5]*i+s[9]*n+s[13],this.z=s[2]*e+s[6]*i+s[10]*n+s[14],this},applyProjection:function(t){var e=this.x,i=this.y,n=this.z,s=t.elements,r=1/(s[3]*e+s[7]*i+s[11]*n+s[15]);return this.x=(s[0]*e+s[4]*i+s[8]*n+s[12])*r,this.y=(s[1]*e+s[5]*i+s[9]*n+s[13])*r,this.z=(s[2]*e+s[6]*i+s[10]*n+s[14])*r,this},applyQuaternion:function(t){var e=this.x,i=this.y,n=this.z,s=t.x,r=t.y,o=t.z,l=t.w,h=l*e+r*n-o*i,a=l*i+o*e-s*n,p=l*n+s*i-r*e,u=-s*e-r*i-o*n;return this.x=h*l+u*-s+a*-o-p*-r,this.y=a*l+u*-r+p*-s-h*-o,this.z=p*l+u*-o+h*-r-a*-s,this},transformDirection:function(t){var e=this.x,i=this.y,n=this.z,s=t.elements;return this.x=s[0]*e+s[4]*i+s[8]*n,this.y=s[1]*e+s[5]*i+s[9]*n,this.z=s[2]*e+s[6]*i+s[10]*n,this.normalize(),this},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){if(0!==t){var e=1/t;this.x*=e,this.y*=e,this.z*=e}else this.x=0,this.y=0,this.z=0;return this},min:function(t){return this.x>t.x&&(this.x=t.x),this.y>t.y&&(this.y=t.y),this.z>t.z&&(this.z=t.z),this},max:function(t){return this.xe.x&&(this.x=e.x),this.ye.y&&(this.y=e.y),this.ze.z&&(this.z=e.z),this},clampScalar:function(t,e){return void 0===p&&(p=new l,u=new l),p.set(t,t,t),u.set(e,e,e),this.clamp(p,u)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){var e=this.length();return 0!==e&&t!==e&&this.multiplyScalar(t/e),this},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t),this},cross:function(t,e){if(void 0!==e)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e);var i=this.x,n=this.y,s=this.z;return this.x=n*t.z-s*t.y,this.y=s*t.x-i*t.z,this.z=i*t.y-n*t.x,this},crossVectors:function(t,e){var i=t.x,n=t.y,s=t.z,r=e.x,o=e.y,l=e.z;return this.x=n*l-s*o,this.y=s*r-i*l,this.z=i*o-n*r,this},projectOnVector:function(t){return void 0===h&&(h=new l),h.copy(t).normalize(),a=this.dot(h),this.copy(h).multiplyScalar(a)},projectOnPlane:function(){var t;return function(e){return void 0===t&&(t=new l),t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t;return function(e){return void 0===t&&(t=new l),this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n},setEulerFromRotationMatrix:function(t,e){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(t,e){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},getScaleFromMatrix:function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},getColumnFromMatrix:function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},setFromMatrixPosition:function(t){return this.x=t.elements[12],this.y=t.elements[13],this.z=t.elements[14],this},setFromMatrixScale:function(t){var e=this.set(t.elements[0],t.elements[1],t.elements[2]).length(),i=this.set(t.elements[4],t.elements[5],t.elements[6]).length(),n=this.set(t.elements[8],t.elements[9],t.elements[10]).length();return this.x=e,this.y=i,this.z=n,this},setFromMatrixColumn:function(t,e){var i=4*t,n=e.elements;return this.x=n[i],this.y=n[i+1],this.z=n[i+2],this},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromAttribute:function(t,e,i){return void 0===i&&(i=0),e=e*t.itemSize+i,this.x=t.array[e],this.y=t.array[e+1],this.z=t.array[e+2],this}};const d=new l;class c{constructor(t,e,i,r){this.bbox=t,this.boxSize=this.bbox.getSize(d).length(),"number"==typeof e?(this.precisionTolerance=e,this.scale=1/this.precisionTolerance):(this.precisionTolerance=n.TOL*this.boxSize,this.scale=1/this.precisionTolerance),this.precisionToleranceSq=this.precisionTolerance*this.precisionTolerance,this.snapBaseX=this.bbox.min.x,this.snapBaseY=this.bbox.min.y,this.pts=[],this.xymap=new Map,r&&(this.quadTreeVerts=new s.QuadTree(t.min.x,t.min.y,t.max.x,t.max.y,e)),this.vertexConstructor=i}findOrAddPoint(t,e,i){let n,s=0|(t-this.snapBaseX)*this.scale,r=0|(e-this.snapBaseY)*this.scale,l=1/0;for(let i=s-1;i<=s+1;i++){let s=this.xymap.get(i);if(s)for(let i=r-1;i<=r+1;i++){let r=s.get(i);if(!r)continue;let o=(r.x-t)*(r.x-t)+(r.y-e)*(r.y-e);othis.precisionToleranceSq&&(n=void 0),void 0===n){let i=this.xymap.get(s);i||(i=new Map,this.xymap.set(s,i)),n=this.vertexConstructor?new this.vertexConstructor(t,e):new(o().Point)(t,e),i.set(r,n),n.id=this.pts.length,this.pts.push(n),this.quadTreeVerts&&this.quadTreeVerts.addItem(n)}if(void 0!==i){if("number"==typeof i)-1===n.dbIds.indexOf(i)&&n.dbIds.push(i);else if(i)for(let t=0;t{"use strict";i.r(e),i.d(e,{QuadTree:()=>l});var n=i(2601),s=i(2554);let r;const o={x:0,y:0};class l{constructor(t,e,i,n,s,o){this.items=[],this.children=null,this.itemCount=0,this.extraDistance=s,this.minx=t,this.miny=e,this.maxx=i,this.maxy=n,this.itemHandler=o,r=Autodesk.Viewing.Private.logger}addItem(t){if(this.itemCount++,this.children){let e=0,i=null;for(let n=0;n<4;n++)this.children[n].intersectsItem(t)&&(i=this.children[n],e++);1===e?i.addItem(t):0!==e&&this.items.push(t)}else this.items.push(t),this.items.length>16&&this.subdivide();return this.itemCount}deleteItem(t){if(!this.intersectsItem(t))return 0;if(this.items){let e=this.items.indexOf(t);if(e>=0)return this.items.splice(e,1),this.itemCount--,1}if(this.children){let e=0,i=0;for(let n=0;n<4;n++)e+=this.children[n].deleteItem(t),i+=this.children[n].itemCount;return 1===e?(this.itemCount--,1):(r.warn("Did not find item to delete. Something is wrong.",e),0)}return 0}intersectsBox(t,e,i,n){let r=this.extraDistance;return(0,s.xBoxBox)(t,e,i,n,this.minx-r,this.miny-r,this.maxx+r,this.maxy+r)}intersectsItem(t){return this.itemHandler?this.itemHandler.intersectsBox(t,this.minx-this.extraDistance,this.miny-this.extraDistance,this.maxx+this.extraDistance,this.maxy+this.extraDistance):t.v1?(0,n.xLineBox)(t.v1.x,t.v1.y,t.v2.x,t.v2.y,this.minx-this.extraDistance,this.miny-this.extraDistance,this.maxx+this.extraDistance,this.maxy+this.extraDistance):this.intersectsBox(t.x,t.y,t.x,t.y)}findSplitPoint(){let t=[],e=[];if(this.itemHandler)for(let i=0;it-e)),e.sort(((t,e)=>t-e));let i=t[0|(t.length+1)/2]-this.extraDistance-1e-20,n=e[0|(e.length+1)/2]-this.extraDistance-1e-20;return i<=this.minx||i>=this.maxx||n<=this.miny||n>=this.maxy?null:{midx:i,midy:n}}subdivide(){if(this.children)return void r.error("Attempt to subdivide already split node");if(!this.items.length)return void r.error("Attempt to subdivide empty node");let t=this.minx,e=this.miny,i=this.maxx,n=this.maxy,s=this.findSplitPoint();if(!s)return;let{midx:o,midy:h}=s;this.children=new Array(4),this.children[0]=new l(t,e,o,h,this.extraDistance,this.itemHandler),this.children[1]=new l(o,e,i,h,this.extraDistance,this.itemHandler),this.children[2]=new l(o,h,i,n,this.extraDistance,this.itemHandler),this.children[3]=new l(t,h,o,n,this.extraDistance,this.itemHandler);let a=[];for(let t=0,e=this.items.length;t=i,o=t.v2.x,l=t.v2.y,h=l>=i;r!=h&&(l-i)*(n-o)>=(o-e)*(s-l)==h&&(this.pipResult=!this.pipResult)}pointInPolygon(t,e){return this.pipResult=!1,this.enumInBox(-1/0,e,1/0,e,(i=>{this.pointInPolygonRec(i,t,e)})),this.pipResult}}},2554:(t,e,i)=>{"use strict";function n(t,e,i,n,s,r,o,l){return t<=o&&e<=l&&i>=s&&n>=r}i.r(e),i.d(e,{xBoxBox:()=>n})},3965:(t,e,i)=>{"use strict";i.r(e),i.d(e,{xBoxPlane:()=>s});var n=new THREE.Vector3;function s(t,e){n.set(e.min.x,e.min.y,e.min.z);var i=t.distanceToPoint(n),s=Math.sign(i);n.set(e.min.x,e.min.y,e.max.z);var r=t.distanceToPoint(n);return Math.sign(r)!==s||(n.set(e.min.x,e.max.y,e.min.z),r=t.distanceToPoint(n),Math.sign(r)!==s||(n.set(e.min.x,e.max.y,e.max.z),r=t.distanceToPoint(n),Math.sign(r)!==s||(n.set(e.max.x,e.min.y,e.min.z),r=t.distanceToPoint(n),Math.sign(r)!==s||(n.set(e.max.x,e.min.y,e.max.z),r=t.distanceToPoint(n),Math.sign(r)!==s||(n.set(e.max.x,e.max.y,e.min.z),r=t.distanceToPoint(n),Math.sign(r)!==s||(n.set(e.max.x,e.max.y,e.max.z),r=t.distanceToPoint(n),Math.sign(r)!==s))))))}},2601:(t,e,i)=>{"use strict";i.r(e),i.d(e,{xLineBox:()=>a});const n=0,s=1,r=2,o=4,l=8;function h(t,e,i,h,a,p){let u;return u=n,ta&&(u|=r),ep&&(u|=l),u}function a(t,e,i,n,a,p,u,d){let c=h(t,e,a,p,u,d),f=h(i,n,a,p,u,d),y=!1;for(;;){if(!(c|f)){y=!0;break}if(c&f)break;{let y,x,g=c||f;g&l?(y=t+(i-t)*(d-e)/(n-e),x=d):g&o?(y=t+(i-t)*(p-e)/(n-e),x=p):g&r?(x=e+(n-e)*(u-t)/(i-t),y=u):g&s&&(x=e+(n-e)*(a-t)/(i-t),y=a),g===c?c=h(t=y,e=x,a,p,u,d):f=h(i=y,n=x,a,p,u,d)}}return y}},1272:(t,e,i)=>{"use strict";function n(t){return Math.abs(t)}i.r(e),i.d(e,{ONE_INTERSECTION:()=>r,OVERLAP:()=>o,pointOnLine:()=>l,segmentsIntersect:()=>h});const s=i(5229).TOL,r=4,o=5;function l(t,e,i,n,r,o){if(i.lengthi.length+r))return!1;let a=i.v1.x+h*i.dx,p=i.v1.y+h*i.dy,u=(a-t)*(a-t)+(p-e)*(p-e);return o&&(o.x=a,o.y=p,o.d=Math.sqrt(u),o.u=h),ut.length+i)return null;let c=p/h*e.length;if(c<-i||c>e.length+i)return null;let f=t.v1.x+u*t.dx,y=t.v1.y+u*t.dy;return{status:r,e1:[f,y],e2:[f,y]}}},6353:(t,e,i)=>{"use strict";i.r(e),i.d(e,{convertToPlaneCoords:()=>p,makePlaneBasis:()=>a,xMeshPlane:()=>h});var n=i(5229),s=i(908);const r=Autodesk.Viewing.Private.VertexEnumerator;var o=new THREE.Matrix4,l=new THREE.Plane;function h(t,e,i){let{geometry:n,matrixWorld:h,fragId:a}=e;if(!n)return;let p=i.length;o.copy(h).invert(),l.copy(t).applyMatrix4(o),r.enumMeshTriangles(n,(function(t,e,n,r,o,h){(0,s.xTrianglePlane)(l,t,e,n,r,o,h,i,a)}));for(let t=p,e=i.length;t{"use strict";i.r(e),i.d(e,{xPlaneSegment:()=>r});var n=i(5229);let s=new THREE.Vector3;function r(t,e,i,r,o){let l=s.subVectors(i,e),h=t.normal.dot(l);if((0,n.isZero)(h))return r.copy(e),o.copy(i),2;h=1/h;let a=-(e.dot(t.normal)*h+t.constant*h);if(a<-n.TOL||a>1+n.TOL)return 0;let p=l.multiplyScalar(a).add(e);return r.copy(p),1}},908:(t,e,i)=>{"use strict";i.r(e),i.d(e,{xTrianglePlane:()=>a});var n=i(5229),s=i(8189);const r=Autodesk.Viewing.Private.logger;function o(t,e,i,n,s,r,o){this.v1=t.clone(),this.v2=e.clone()}let l=new THREE.Vector3,h=new THREE.Vector3;function a(t,e,i,a,p,u,d,c,f){let y=t.distanceToPoint(e),x=t.distanceToPoint(i),g=t.distanceToPoint(a);if(y<-n.TOL&&x<-n.TOL&&g<-n.TOL)return null;if(y>n.TOL&&x>n.TOL&&g>n.TOL)return null;let P,m,v,C,_,I,E=Math.sign(y),T=Math.sign(x),b=Math.sign(g);if(0===E&&0===T&&0===b)return null;if(E!==T){let n=(0,s.xPlaneSegment)(t,e,i,l,h);if(2===n)return void c.push(new o(e,i,p,p,u,u,f));1===n?(v=p,C=u,P=l.clone()):r.warn("Unexpected zero intersections where at least one was expected")}if(T!==b){let e=(0,s.xPlaneSegment)(t,i,a,l,h);if(2===e)return void c.push(new o(i,a,u,u,d,d,f));1===e?P?l.distanceTo(P)>n.TOL&&(_=u,I=d,m=l.clone()):(v=u,C=d,P=l.clone()):r.warn("Unexpected zero intersections where at least one was expected")}if(b!==E){let i=(0,s.xPlaneSegment)(t,a,e,l,h);if(2===i)return void c.push(new o(a,e,d,d,p,p,f));1===i?P?l.distanceTo(P)>n.TOL&&(_=d,I=p,m=l.clone()):r.warn("Unexpected single intersection point"):r.warn("Unexpected zero intersections where at least one was expected")}P&&m&&c.push(new o(P,m,v,C,_,I,f))}},3095:t=>{"use strict";t.exports={version:"1.5.0"}}},e={};function i(n){var s=e[n];if(void 0!==s)return s.exports;var r=e[n]={exports:{}};return t[n](r,r.exports,i),r.exports}i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n=i(6082);Autodesk.Extensions.CompGeom=n})(); //# sourceMappingURL=CompGeom.min.js.map