aitu-app 0.6.21 → 0.6.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/README.md +3 -3
  2. package/assets/{ChatMessagesArea-Bc7FkjZo.js → ChatMessagesArea-63H9tZtG.js} +3 -3
  3. package/assets/{KnowledgeBaseContent-BLIcG9KK.js → KnowledgeBaseContent-5j70f-FP.js} +4 -4
  4. package/assets/{ModelBenchmarkWorkbench-CGztJD2j.js → ModelBenchmarkWorkbench-OdGWsh0T.js} +1 -1
  5. package/assets/{ResizableDivider-DfqWs8LM.js → ResizableDivider-DUn2YRJi.js} +1 -1
  6. package/assets/{ToolboxDrawer-B9g_w8pc.js → ToolboxDrawer-DDAFUdNA.js} +1 -1
  7. package/assets/{VideoAnalyzer-KdlQiqKF.js → VideoAnalyzer-C7mAfG_a.js} +1 -1
  8. package/assets/{ai-analyze-D51W4jnj.js → ai-analyze-CJsLcVP0.js} +1 -1
  9. package/assets/{arc-DVIrWwbE.js → arc-BwiBrwsC.js} +1 -1
  10. package/assets/{arc-BqtXmYwJ.js → arc-bU0RTLO_.js} +1 -1
  11. package/assets/{batch-image-generation-DEC8rrCP.js → batch-image-generation-se7md6Xz.js} +1 -1
  12. package/assets/{blockDiagram-38ab4fdb-BgPS1CyJ.js → blockDiagram-38ab4fdb-C-J430-U.js} +1 -1
  13. package/assets/{blockDiagram-38ab4fdb-CMoyjTgm.js → blockDiagram-38ab4fdb-CRlC08-f.js} +1 -1
  14. package/assets/{c4Diagram-3d4e48cf-wjCA-CL-.js → c4Diagram-3d4e48cf-CZXHUfLE.js} +1 -1
  15. package/assets/{c4Diagram-3d4e48cf-CIeKmCwa.js → c4Diagram-3d4e48cf-CjnnPMdb.js} +1 -1
  16. package/assets/channel-C0300EYS.js +1 -0
  17. package/assets/channel-CFKYr4PJ.js +1 -0
  18. package/assets/{classDiagram-70f12bd4-vizVZzUd.js → classDiagram-70f12bd4-CHHFCLtW.js} +1 -1
  19. package/assets/{classDiagram-70f12bd4-DfTNrA1t.js → classDiagram-70f12bd4-Cka5pz9E.js} +1 -1
  20. package/assets/{classDiagram-v2-f2320105-LutY6jPP.js → classDiagram-v2-f2320105-BoY5QpGK.js} +1 -1
  21. package/assets/{classDiagram-v2-f2320105-DO7izSAk.js → classDiagram-v2-f2320105-DhMOYQPM.js} +1 -1
  22. package/assets/{clipper-D3zP18nj.js → clipper-ZDte_DyN.js} +1 -1
  23. package/assets/clone-B4wQMor7.js +1 -0
  24. package/assets/clone-DTNvy75S.js +1 -0
  25. package/assets/{createText-2e5e7dd3-CtWg9f_f.js → createText-2e5e7dd3-CouAisK8.js} +1 -1
  26. package/assets/{createText-2e5e7dd3-iSllMU05.js → createText-2e5e7dd3-DQiR2iFi.js} +1 -1
  27. package/assets/{edges-e0da2a9e-B8N3S4AD.js → edges-e0da2a9e-D5w5n92i.js} +1 -1
  28. package/assets/{edges-e0da2a9e-B9APkBSa.js → edges-e0da2a9e-dJImi3XC.js} +1 -1
  29. package/assets/{erDiagram-9861fffd-Dnp1WpmL.js → erDiagram-9861fffd-9WI5iVS2.js} +1 -1
  30. package/assets/{erDiagram-9861fffd-B1x-ZWfU.js → erDiagram-9861fffd-IyJNqdw_.js} +1 -1
  31. package/assets/{flowDb-956e92f1-BT8eaBZE.js → flowDb-956e92f1-DltT8K-M.js} +1 -1
  32. package/assets/{flowDb-956e92f1-5caTHN1T.js → flowDb-956e92f1-FUMkFpNV.js} +1 -1
  33. package/assets/{flowDiagram-66a62f08-B5xcjVie.js → flowDiagram-66a62f08-Dbc4Nx93.js} +1 -1
  34. package/assets/{flowDiagram-66a62f08-Cx_V_MoA.js → flowDiagram-66a62f08-nXDkz0Ug.js} +1 -1
  35. package/assets/flowDiagram-v2-96b9c2cf-BVOhfZw2.js +1 -0
  36. package/assets/flowDiagram-v2-96b9c2cf-j5LlfdZR.js +1 -0
  37. package/assets/{flowchart-elk-definition-4a651766-Cjgywupa.js → flowchart-elk-definition-4a651766-B6rzHwEw.js} +1 -1
  38. package/assets/{flowchart-elk-definition-4a651766-CwIA9l-O.js → flowchart-elk-definition-4a651766-gZ7Jh0C4.js} +1 -1
  39. package/assets/{ganttDiagram-c361ad54-6zSjhOJy.js → ganttDiagram-c361ad54-B9Sd11GI.js} +1 -1
  40. package/assets/{ganttDiagram-c361ad54-oySKvDa4.js → ganttDiagram-c361ad54-CItnWrDi.js} +1 -1
  41. package/assets/{gitGraphDiagram-72cf32ee-BK7TWB1s.js → gitGraphDiagram-72cf32ee-CYyEomwm.js} +1 -1
  42. package/assets/{gitGraphDiagram-72cf32ee-BnNAY3pp.js → gitGraphDiagram-72cf32ee-Dd5nG_11.js} +1 -1
  43. package/assets/{graph-B_MH2EY9.js → graph-BHlg4sFb.js} +1 -1
  44. package/assets/{graph-BPS27gwv.js → graph-Cy6oe2k_.js} +1 -1
  45. package/assets/{grid-image-DLa8OQhL.js → grid-image-C-msrN1B.js} +1 -1
  46. package/assets/{has-D0S1Zmzg.js → has-CWNO02CD.js} +1 -1
  47. package/assets/{hasIn-De9yBkgj.js → hasIn-Bs6kQ8q7.js} +1 -1
  48. package/assets/{index-3862675e-FzFTrzJW.js → index-3862675e-BKpqGoRu.js} +1 -1
  49. package/assets/{index-3862675e-D6LCgHcS.js → index-3862675e-DsPsD_QS.js} +1 -1
  50. package/assets/{index-T5OF1JP4.js → index-B-A2026m.js} +1 -1
  51. package/assets/{index-Bjr6SLmW.js → index-BC5aP94k.js} +1 -1
  52. package/assets/{index-Cb_6lq4r.js → index-BEFGFeiI.js} +1 -1
  53. package/assets/{index-Dgs_9LtJ.js → index-BTRvm9gy.js} +1 -1
  54. package/assets/{index-B8Cp8ZAq.js → index-B_ECxmtW.js} +1 -1
  55. package/assets/{index-CGUpUzSI.js → index-BcM3gyCR.js} +1 -1
  56. package/assets/{index-Ia_xKhIZ.js → index-BdH171U0.js} +5 -5
  57. package/assets/{index-sARZWo5n.js → index-Br38Ej3g.js} +1 -1
  58. package/assets/{index-CU-f8hlX.js → index-C-wf0YcU.js} +1 -1
  59. package/assets/{index-Ctlb8bi0.js → index-C1X4nHa1.js} +1 -1
  60. package/assets/{index-Br6iEGLw.js → index-CCzr4Dqs.js} +1 -1
  61. package/assets/{index-DYQtOpt_.js → index-CMfdA3Eb.js} +1 -1
  62. package/assets/{index-B1Qj7KmK.js → index-CRvF4JAy.js} +1 -1
  63. package/assets/{index-GP_0iNEx.js → index-CUYzOOe1.js} +1 -1
  64. package/assets/{index-rrHZbeHC.js → index-CnVvluBH.js} +1 -1
  65. package/assets/{index-Ddc6oDDk.js → index-D4JTX52h.js} +1 -1
  66. package/assets/{index-BdrYk4gf.js → index-DB9eHDVM.js} +1 -1
  67. package/assets/{index-DFgRlr0t.js → index-DGVrURNm.js} +1 -1
  68. package/assets/{index-CG_qIHbM.js → index-Dczi3BkD.js} +1 -1
  69. package/assets/{index-CSxjkKUk.js → index-DtJW2qel.js} +1 -1
  70. package/assets/{index-6opHRfWl.js → index-DysS6hq1.js} +1 -1
  71. package/assets/{index-C6mW2Bug.js → index-KJVd0B2z.js} +1 -1
  72. package/assets/{index-BIv91qW9.js → index-T9dstNa6.js} +16 -16
  73. package/assets/{index-B3GMIqjJ.js → index-TQu9hYF9.js} +1 -1
  74. package/assets/{index-CAghokCh.js → index-Y5c26X-0.js} +1 -1
  75. package/assets/{index-BR5Ge2w3.js → index-YBixVTkA.js} +1 -1
  76. package/assets/{index-CqeciDtE.js → index-ZRpcXeUi.js} +1 -1
  77. package/assets/{index-DUFh_idy.js → index-byQfZx9Y.js} +1 -1
  78. package/assets/{index-DJhDtQwz.js → index-hmLPqXUT.js} +1 -1
  79. package/assets/{index-BUde8Mm7.js → index-iDwZIVzi.js} +1 -1
  80. package/assets/{index-B_TY0tLT.js → index-sRNe5iWo.js} +1 -1
  81. package/assets/{index-CoNiRHcD.js → index-w0J-N3Bz.js} +1 -1
  82. package/assets/{index-CIsTR1zp.js → index-xSQSiTqU.js} +1 -1
  83. package/assets/{infoDiagram-f8f76790-C5lK_OdP.js → infoDiagram-f8f76790-D3aFK43x.js} +1 -1
  84. package/assets/{infoDiagram-f8f76790-DqxLIqvx.js → infoDiagram-f8f76790-plyhvVln.js} +1 -1
  85. package/assets/{inspiration-board-DELLwhlH.js → inspiration-board-WeHubIbH.js} +1 -1
  86. package/assets/{isEmpty-DF_ugZHw.js → isEmpty-DZgnI1Gi.js} +1 -1
  87. package/assets/{journeyDiagram-49397b02-f6bVwxyz.js → journeyDiagram-49397b02-BUEu9YZl.js} +1 -1
  88. package/assets/{journeyDiagram-49397b02-BJ9tbMfk.js → journeyDiagram-49397b02-CJLyWjZc.js} +1 -1
  89. package/assets/{layers-DAOrLzwi.js → layers-BZ-h9vGA.js} +1 -1
  90. package/assets/{layout-yMh6DKYs.js → layout-CB3iLEN-.js} +1 -1
  91. package/assets/{layout-fmUyEip8.js → layout-CfIv6ys6.js} +1 -1
  92. package/assets/{line-DANa88VO.js → line-Cl2IINpY.js} +1 -1
  93. package/assets/{line-DXiCFjwk.js → line-DEMH00tR.js} +1 -1
  94. package/assets/{linear-5iY8Cy-H.js → linear-CAlPBLIZ.js} +1 -1
  95. package/assets/{linear-ctDXkzM_.js → linear-CYligRij.js} +1 -1
  96. package/assets/{mermaid.core-Dgk12NKe.js → mermaid.core-HRa8_3iy.js} +5 -5
  97. package/assets/{mindmap-definition-fc14e90a-C7BlMhzr.js → mindmap-definition-fc14e90a-BE_BelNq.js} +1 -1
  98. package/assets/{mindmap-definition-fc14e90a-DLlf6Rx9.js → mindmap-definition-fc14e90a-BjEfE1ER.js} +1 -1
  99. package/assets/{model-benchmark-launcher-fleyPbmY.js → model-benchmark-launcher-DGhnqUWi.js} +1 -1
  100. package/assets/{photo-wall-splitter-xpPO2k5T.js → photo-wall-splitter-CEBkekUS.js} +1 -1
  101. package/assets/{pick-VCZntyna.js → pick-BDzXufGU.js} +1 -1
  102. package/assets/{pieDiagram-8a3498a8-BBnaNSJ-.js → pieDiagram-8a3498a8-BOz79K-l.js} +1 -1
  103. package/assets/{pieDiagram-8a3498a8-BvSfbq65.js → pieDiagram-8a3498a8-BXg1_0zb.js} +1 -1
  104. package/assets/{quadrantDiagram-120e2f19-Bnh-DNQv.js → quadrantDiagram-120e2f19-BNSax4Yv.js} +1 -1
  105. package/assets/{quadrantDiagram-120e2f19-Cm8pCCM5.js → quadrantDiagram-120e2f19-BW0c6246.js} +1 -1
  106. package/assets/{requirementDiagram-deff3bca-CDm-DECv.js → requirementDiagram-deff3bca-BdKQCBBh.js} +1 -1
  107. package/assets/{requirementDiagram-deff3bca-DMRUc1cx.js → requirementDiagram-deff3bca-DLC9wibM.js} +1 -1
  108. package/assets/{sankeyDiagram-04a897e0-CXC5R9JG.js → sankeyDiagram-04a897e0-gzh6unx3.js} +1 -1
  109. package/assets/{sankeyDiagram-04a897e0-BMtXJIXg.js → sankeyDiagram-04a897e0-mnwYvtIk.js} +1 -1
  110. package/assets/{sequenceDiagram-704730f1-D42qglAv.js → sequenceDiagram-704730f1-9WzL_6Og.js} +1 -1
  111. package/assets/{sequenceDiagram-704730f1-CNMmBUQx.js → sequenceDiagram-704730f1-CPrfOGmY.js} +1 -1
  112. package/assets/{settings-dialog-2ODvctTh.js → settings-dialog-DKi0S3Fj.js} +1 -1
  113. package/assets/{shard-sync-service-D3USLllH.js → shard-sync-service-DMBoL8-S.js} +1 -1
  114. package/assets/{stateDiagram-587899a1-DqPLyMub.js → stateDiagram-587899a1-D0lAIKBU.js} +1 -1
  115. package/assets/{stateDiagram-587899a1-DsEPR5ou.js → stateDiagram-587899a1-DHfaNuxL.js} +1 -1
  116. package/assets/{stateDiagram-v2-d93cdb3a-DrlPKA21.js → stateDiagram-v2-d93cdb3a-BW2UOJGd.js} +1 -1
  117. package/assets/{stateDiagram-v2-d93cdb3a-Bf_7sDs_.js → stateDiagram-v2-d93cdb3a-BkSMcdnU.js} +1 -1
  118. package/assets/{styles-6aaf32cf-YHAPMNO9.js → styles-6aaf32cf-BzV4m8wn.js} +1 -1
  119. package/assets/{styles-6aaf32cf-Bj2sDHb0.js → styles-6aaf32cf-DbLx1dQP.js} +1 -1
  120. package/assets/{styles-9a916d00-7jELss6_.js → styles-9a916d00-BWvAJ5en.js} +1 -1
  121. package/assets/{styles-9a916d00-CZUDnhpb.js → styles-9a916d00-DfAvsjKD.js} +1 -1
  122. package/assets/{styles-c10674c1-DC9073pI.js → styles-c10674c1-CeFiajQK.js} +1 -1
  123. package/assets/{styles-c10674c1-DLuj745u.js → styles-c10674c1-DOM3WQ5r.js} +1 -1
  124. package/assets/{svgDrawCommon-08f97a94-CrWF0HaY.js → svgDrawCommon-08f97a94-BVgqbMeh.js} +1 -1
  125. package/assets/{svgDrawCommon-08f97a94-D2AO9i1k.js → svgDrawCommon-08f97a94-BlKKsIl4.js} +1 -1
  126. package/assets/{timeline-definition-85554ec2-leTEuD1Q.js → timeline-definition-85554ec2-9aW1_D2N.js} +1 -1
  127. package/assets/{timeline-definition-85554ec2-7KS0GPh6.js → timeline-definition-85554ec2-DzpdYs0t.js} +1 -1
  128. package/assets/ttd-dialog-DEnnfHyO.js +115 -0
  129. package/assets/{upload-CQNwOcX2.js → upload-DNNZ8L4F.js} +1 -1
  130. package/assets/{video-recovery-service-BQIopXWm.js → video-recovery-service-CbVWiAGn.js} +1 -1
  131. package/assets/{xychartDiagram-e933f94c-BCEY4mIx.js → xychartDiagram-e933f94c-DNl2ns7z.js} +1 -1
  132. package/assets/{xychartDiagram-e933f94c-B_6b1Ojq.js → xychartDiagram-e933f94c-d54TQLOU.js} +1 -1
  133. package/changelog.json +13 -0
  134. package/package.json +1 -1
  135. package/precache-manifest.json +277 -277
  136. package/sw.js +1 -1
  137. package/version.json +3 -7
  138. package/assets/channel-Ckduo0Rh.js +0 -1
  139. package/assets/channel-DXN87Isu.js +0 -1
  140. package/assets/clone-CuD87pDT.js +0 -1
  141. package/assets/clone-DOLqw3Mb.js +0 -1
  142. package/assets/flowDiagram-v2-96b9c2cf-BaJg3X7e.js +0 -1
  143. package/assets/flowDiagram-v2-96b9c2cf-bslUZjmZ.js +0 -1
  144. package/assets/ttd-dialog-DZzhIaYG.js +0 -115
@@ -1 +1 @@
1
- import{b6 as ki}from"./index-BIv91qW9.js";function Hi(B,n){for(var w=0;w<n.length;w++){const O=n[w];if(typeof O!="string"&&!Array.isArray(O)){for(const x in O)if(x!=="default"&&!(x in B)){const d=Object.getOwnPropertyDescriptor(O,x);d&&Object.defineProperty(B,x,d.get?d:{enumerable:!0,get:()=>O[x]})}}}return Object.freeze(Object.defineProperty(B,Symbol.toStringTag,{value:"Module"}))}var U={exports:{}},K;function Ji(){return K||(K=1,(function(B){(function(){var n={};n.version="6.4.2.2",n.use_lines=!0,n.use_xyz=!1;var w=!1;B.exports?(B.exports=n,w=!0):typeof document<"u"?window.ClipperLib=n:self.ClipperLib=n;var O;if(w){var x="chrome";O="Netscape"}else{var x=navigator.userAgent.toString().toLowerCase();O=navigator.appName}var d={};x.indexOf("chrome")!=-1&&x.indexOf("chromium")==-1?d.chrome=1:d.chrome=0,x.indexOf("chromium")!=-1?d.chromium=1:d.chromium=0,x.indexOf("safari")!=-1&&x.indexOf("chrome")==-1&&x.indexOf("chromium")==-1?d.safari=1:d.safari=0,x.indexOf("firefox")!=-1?d.firefox=1:d.firefox=0,x.indexOf("firefox/17")!=-1?d.firefox17=1:d.firefox17=0,x.indexOf("firefox/15")!=-1?d.firefox15=1:d.firefox15=0,x.indexOf("firefox/3")!=-1?d.firefox3=1:d.firefox3=0,x.indexOf("opera")!=-1?d.opera=1:d.opera=0,x.indexOf("msie 10")!=-1?d.msie10=1:d.msie10=0,x.indexOf("msie 9")!=-1?d.msie9=1:d.msie9=0,x.indexOf("msie 8")!=-1?d.msie8=1:d.msie8=0,x.indexOf("msie 7")!=-1?d.msie7=1:d.msie7=0,x.indexOf("msie ")!=-1?d.msie=1:d.msie=0,n.biginteger_used=null;var N;function p(t,i,e){n.biginteger_used=1,t!=null&&(typeof t=="number"&&typeof i>"u"?this.fromInt(t):typeof t=="number"?this.fromNumber(t,i,e):i==null&&typeof t!="string"?this.fromString(t,256):this.fromString(t,i))}function I(){return new p(null,void 0,void 0)}function $(t,i,e,r,s,l){for(;--l>=0;){var o=i*this[t++]+e[r]+s;s=Math.floor(o/67108864),e[r++]=o&67108863}return s}function j(t,i,e,r,s,l){for(var o=i&32767,u=i>>15;--l>=0;){var f=this[t]&32767,h=this[t++]>>15,P=u*f+h*o;f=o*f+((P&32767)<<15)+e[r]+(s&1073741823),s=(f>>>30)+(P>>>15)+u*h+(s>>>30),e[r++]=f&1073741823}return s}function tt(t,i,e,r,s,l){for(var o=i&16383,u=i>>14;--l>=0;){var f=this[t]&16383,h=this[t++]>>14,P=u*f+h*o;f=o*f+((P&16383)<<14)+e[r]+s,s=(f>>28)+(P>>14)+u*h,e[r++]=f&268435455}return s}O=="Microsoft Internet Explorer"?(p.prototype.am=j,N=30):O!="Netscape"?(p.prototype.am=$,N=26):(p.prototype.am=tt,N=28),p.prototype.DB=N,p.prototype.DM=(1<<N)-1,p.prototype.DV=1<<N;var Z=52;p.prototype.FV=Math.pow(2,Z),p.prototype.F1=Z-N,p.prototype.F2=2*N-Z;var it="0123456789abcdefghijklmnopqrstuvwxyz",W=new Array,D,X;for(D=48,X=0;X<=9;++X)W[D++]=X;for(D=97,X=10;X<36;++X)W[D++]=X;for(D=65,X=10;X<36;++X)W[D++]=X;function k(t){return it.charAt(t)}function H(t,i){var e=W[t.charCodeAt(i)];return e??-1}function et(t){for(var i=this.t-1;i>=0;--i)t[i]=this[i];t.t=this.t,t.s=this.s}function nt(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0}function S(t){var i=I();return i.fromInt(t),i}function rt(t,i){var e;if(i==16)e=4;else if(i==8)e=3;else if(i==256)e=8;else if(i==2)e=1;else if(i==32)e=5;else if(i==4)e=2;else{this.fromRadix(t,i);return}this.t=0,this.s=0;for(var r=t.length,s=!1,l=0;--r>=0;){var o=e==8?t[r]&255:H(t,r);if(o<0){t.charAt(r)=="-"&&(s=!0);continue}s=!1,l==0?this[this.t++]=o:l+e>this.DB?(this[this.t-1]|=(o&(1<<this.DB-l)-1)<<l,this[this.t++]=o>>this.DB-l):this[this.t-1]|=o<<l,l+=e,l>=this.DB&&(l-=this.DB)}e==8&&(t[0]&128)!=0&&(this.s=-1,l>0&&(this[this.t-1]|=(1<<this.DB-l)-1<<l)),this.clamp(),s&&p.ZERO.subTo(this,this)}function st(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t}function lt(t){if(this.s<0)return"-"+this.negate().toString(t);var i;if(t==16)i=4;else if(t==8)i=3;else if(t==2)i=1;else if(t==32)i=5;else if(t==4)i=2;else return this.toRadix(t);var e=(1<<i)-1,r,s=!1,l="",o=this.t,u=this.DB-o*this.DB%i;if(o-- >0)for(u<this.DB&&(r=this[o]>>u)>0&&(s=!0,l=k(r));o>=0;)u<i?(r=(this[o]&(1<<u)-1)<<i-u,r|=this[--o]>>(u+=this.DB-i)):(r=this[o]>>(u-=i)&e,u<=0&&(u+=this.DB,--o)),r>0&&(s=!0),s&&(l+=k(r));return s?l:"0"}function ot(){var t=I();return p.ZERO.subTo(this,t),t}function ut(){return this.s<0?this.negate():this}function ft(t){var i=this.s-t.s;if(i!=0)return i;var e=this.t;if(i=e-t.t,i!=0)return this.s<0?-i:i;for(;--e>=0;)if((i=this[e]-t[e])!=0)return i;return 0}function R(t){var i=1,e;return(e=t>>>16)!=0&&(t=e,i+=16),(e=t>>8)!=0&&(t=e,i+=8),(e=t>>4)!=0&&(t=e,i+=4),(e=t>>2)!=0&&(t=e,i+=2),(e=t>>1)!=0&&(t=e,i+=1),i}function ht(){return this.t<=0?0:this.DB*(this.t-1)+R(this[this.t-1]^this.s&this.DM)}function at(t,i){var e;for(e=this.t-1;e>=0;--e)i[e+t]=this[e];for(e=t-1;e>=0;--e)i[e]=0;i.t=this.t+t,i.s=this.s}function pt(t,i){for(var e=t;e<this.t;++e)i[e-t]=this[e];i.t=Math.max(this.t-t,0),i.s=this.s}function Pt(t,i){var e=t%this.DB,r=this.DB-e,s=(1<<r)-1,l=Math.floor(t/this.DB),o=this.s<<e&this.DM,u;for(u=this.t-1;u>=0;--u)i[u+l+1]=this[u]>>r|o,o=(this[u]&s)<<e;for(u=l-1;u>=0;--u)i[u]=0;i[l]=o,i.t=this.t+l+1,i.s=this.s,i.clamp()}function mt(t,i){i.s=this.s;var e=Math.floor(t/this.DB);if(e>=this.t){i.t=0;return}var r=t%this.DB,s=this.DB-r,l=(1<<r)-1;i[0]=this[e]>>r;for(var o=e+1;o<this.t;++o)i[o-e-1]|=(this[o]&l)<<s,i[o-e]=this[o]>>r;r>0&&(i[this.t-e-1]|=(this.s&l)<<s),i.t=this.t-e,i.clamp()}function yt(t,i){for(var e=0,r=0,s=Math.min(t.t,this.t);e<s;)r+=this[e]-t[e],i[e++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r-=t.s;e<this.t;)r+=this[e],i[e++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;e<t.t;)r-=t[e],i[e++]=r&this.DM,r>>=this.DB;r-=t.s}i.s=r<0?-1:0,r<-1?i[e++]=this.DV+r:r>0&&(i[e++]=r),i.t=e,i.clamp()}function dt(t,i){var e=this.abs(),r=t.abs(),s=e.t;for(i.t=s+r.t;--s>=0;)i[s]=0;for(s=0;s<r.t;++s)i[s+e.t]=e.am(0,r[s],i,s,0,e.t);i.s=0,i.clamp(),this.s!=t.s&&p.ZERO.subTo(i,i)}function vt(t){for(var i=this.abs(),e=t.t=2*i.t;--e>=0;)t[e]=0;for(e=0;e<i.t-1;++e){var r=i.am(e,i[e],t,2*e,0,1);(t[e+i.t]+=i.am(e+1,2*i[e],t,2*e+1,r,i.t-e-1))>=i.DV&&(t[e+i.t]-=i.DV,t[e+i.t+1]=1)}t.t>0&&(t[t.t-1]+=i.am(e,i[e],t,2*e,0,1)),t.s=0,t.clamp()}function Ct(t,i,e){var r=t.abs();if(!(r.t<=0)){var s=this.abs();if(s.t<r.t){i!=null&&i.fromInt(0),e!=null&&this.copyTo(e);return}e==null&&(e=I());var l=I(),o=this.s,u=t.s,f=this.DB-R(r[r.t-1]);f>0?(r.lShiftTo(f,l),s.lShiftTo(f,e)):(r.copyTo(l),s.copyTo(e));var h=l.t,P=l[h-1];if(P!=0){var a=P*(1<<this.F1)+(h>1?l[h-2]>>this.F2:0),m=this.FV/a,y=(1<<this.F1)/a,C=1<<this.F2,c=e.t,_=c-h,L=i??I();for(l.dlShiftTo(_,L),e.compareTo(L)>=0&&(e[e.t++]=1,e.subTo(L,e)),p.ONE.dlShiftTo(h,L),L.subTo(l,l);l.t<h;)l[l.t++]=0;for(;--_>=0;){var Y=e[--c]==P?this.DM:Math.floor(e[c]*m+(e[c-1]+C)*y);if((e[c]+=l.am(0,Y,e,_,0,h))<Y)for(l.dlShiftTo(_,L),e.subTo(L,e);e[c]<--Y;)e.subTo(L,e)}i!=null&&(e.drShiftTo(h,i),o!=u&&p.ZERO.subTo(i,i)),e.t=h,e.clamp(),f>0&&e.rShiftTo(f,e),o<0&&p.ZERO.subTo(e,e)}}}function ct(t){var i=I();return this.abs().divRemTo(t,null,i),this.s<0&&i.compareTo(p.ZERO)>0&&t.subTo(i,i),i}function A(t){this.m=t}function It(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function _t(t){return t}function xt(t){t.divRemTo(this.m,null,t)}function Tt(t,i,e){t.multiplyTo(i,e),this.reduce(e)}function Lt(t,i){t.squareTo(i),this.reduce(i)}A.prototype.convert=It,A.prototype.revert=_t,A.prototype.reduce=xt,A.prototype.mulTo=Tt,A.prototype.sqrTo=Lt;function Xt(){if(this.t<1)return 0;var t=this[0];if((t&1)==0)return 0;var i=t&3;return i=i*(2-(t&15)*i)&15,i=i*(2-(t&255)*i)&255,i=i*(2-((t&65535)*i&65535))&65535,i=i*(2-t*i%this.DV)%this.DV,i>0?this.DV-i:-i}function E(t){this.m=t,this.mp=t.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function Ot(t){var i=I();return t.abs().dlShiftTo(this.m.t,i),i.divRemTo(this.m,null,i),t.s<0&&i.compareTo(p.ZERO)>0&&this.m.subTo(i,i),i}function Yt(t){var i=I();return t.copyTo(i),this.reduce(i),i}function Nt(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var i=0;i<this.m.t;++i){var e=t[i]&32767,r=e*this.mpl+((e*this.mph+(t[i]>>15)*this.mpl&this.um)<<15)&t.DM;for(e=i+this.m.t,t[e]+=this.m.am(0,r,t,i,0,this.m.t);t[e]>=t.DV;)t[e]-=t.DV,t[++e]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)}function St(t,i){t.squareTo(i),this.reduce(i)}function At(t,i,e){t.multiplyTo(i,e),this.reduce(e)}E.prototype.convert=Ot,E.prototype.revert=Yt,E.prototype.reduce=Nt,E.prototype.mulTo=At,E.prototype.sqrTo=St;function Et(){return(this.t>0?this[0]&1:this.s)==0}function Bt(t,i){if(t>4294967295||t<1)return p.ONE;var e=I(),r=I(),s=i.convert(this),l=R(t)-1;for(s.copyTo(e);--l>=0;)if(i.sqrTo(e,r),(t&1<<l)>0)i.mulTo(r,s,e);else{var o=e;e=r,r=o}return i.revert(e)}function wt(t,i){var e;return t<256||i.isEven()?e=new A(i):e=new E(i),this.exp(t,e)}p.prototype.copyTo=et,p.prototype.fromInt=nt,p.prototype.fromString=rt,p.prototype.clamp=st,p.prototype.dlShiftTo=at,p.prototype.drShiftTo=pt,p.prototype.lShiftTo=Pt,p.prototype.rShiftTo=mt,p.prototype.subTo=yt,p.prototype.multiplyTo=dt,p.prototype.squareTo=vt,p.prototype.divRemTo=Ct,p.prototype.invDigit=Xt,p.prototype.isEven=Et,p.prototype.exp=Bt,p.prototype.toString=lt,p.prototype.negate=ot,p.prototype.abs=ut,p.prototype.compareTo=ft,p.prototype.bitLength=ht,p.prototype.mod=ct,p.prototype.modPowInt=wt,p.ZERO=S(0),p.ONE=S(1);function Dt(){var t=I();return this.copyTo(t),t}function bt(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function Mt(){return this.t==0?this.s:this[0]<<24>>24}function Ft(){return this.t==0?this.s:this[0]<<16>>16}function gt(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}function Wt(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function Rt(t){if(t==null&&(t=10),this.signum()==0||t<2||t>36)return"0";var i=this.chunkSize(t),e=Math.pow(t,i),r=S(e),s=I(),l=I(),o="";for(this.divRemTo(r,s,l);s.signum()>0;)o=(e+l.intValue()).toString(t).substr(1)+o,s.divRemTo(r,s,l);return l.intValue().toString(t)+o}function Zt(t,i){this.fromInt(0),i==null&&(i=10);for(var e=this.chunkSize(i),r=Math.pow(i,e),s=!1,l=0,o=0,u=0;u<t.length;++u){var f=H(t,u);if(f<0){t.charAt(u)=="-"&&this.signum()==0&&(s=!0);continue}o=i*o+f,++l>=e&&(this.dMultiply(r),this.dAddOffset(o,0),l=0,o=0)}l>0&&(this.dMultiply(Math.pow(i,l)),this.dAddOffset(o,0)),s&&p.ZERO.subTo(this,this)}function qt(t,i,e){if(typeof i=="number")if(t<2)this.fromInt(1);else for(this.fromNumber(t,e),this.testBit(t-1)||this.bitwiseTo(p.ONE.shiftLeft(t-1),q,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(i);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(p.ONE.shiftLeft(t-1),this);else{var r=new Array,s=t&7;r.length=(t>>3)+1,i.nextBytes(r),s>0?r[0]&=(1<<s)-1:r[0]=0,this.fromString(r,256)}}function Ut(){var t=this.t,i=new Array;i[0]=this.s;var e=this.DB-t*this.DB%8,r,s=0;if(t-- >0)for(e<this.DB&&(r=this[t]>>e)!=(this.s&this.DM)>>e&&(i[s++]=r|this.s<<this.DB-e);t>=0;)e<8?(r=(this[t]&(1<<e)-1)<<8-e,r|=this[--t]>>(e+=this.DB-8)):(r=this[t]>>(e-=8)&255,e<=0&&(e+=this.DB,--t)),(r&128)!=0&&(r|=-256),s==0&&(this.s&128)!=(r&128)&&++s,(s>0||r!=this.s)&&(i[s++]=r);return i}function kt(t){return this.compareTo(t)==0}function Ht(t){return this.compareTo(t)<0?this:t}function Jt(t){return this.compareTo(t)>0?this:t}function Gt(t,i,e){var r,s,l=Math.min(t.t,this.t);for(r=0;r<l;++r)e[r]=i(this[r],t[r]);if(t.t<this.t){for(s=t.s&this.DM,r=l;r<this.t;++r)e[r]=i(this[r],s);e.t=this.t}else{for(s=this.s&this.DM,r=l;r<t.t;++r)e[r]=i(s,t[r]);e.t=t.t}e.s=i(this.s,t.s),e.clamp()}function Vt(t,i){return t&i}function zt(t){var i=I();return this.bitwiseTo(t,Vt,i),i}function q(t,i){return t|i}function Kt(t){var i=I();return this.bitwiseTo(t,q,i),i}function J(t,i){return t^i}function Qt(t){var i=I();return this.bitwiseTo(t,J,i),i}function G(t,i){return t&~i}function $t(t){var i=I();return this.bitwiseTo(t,G,i),i}function jt(){for(var t=I(),i=0;i<this.t;++i)t[i]=this.DM&~this[i];return t.t=this.t,t.s=~this.s,t}function ti(t){var i=I();return t<0?this.rShiftTo(-t,i):this.lShiftTo(t,i),i}function ii(t){var i=I();return t<0?this.lShiftTo(-t,i):this.rShiftTo(t,i),i}function ei(t){if(t==0)return-1;var i=0;return(t&65535)==0&&(t>>=16,i+=16),(t&255)==0&&(t>>=8,i+=8),(t&15)==0&&(t>>=4,i+=4),(t&3)==0&&(t>>=2,i+=2),(t&1)==0&&++i,i}function ni(){for(var t=0;t<this.t;++t)if(this[t]!=0)return t*this.DB+ei(this[t]);return this.s<0?this.t*this.DB:-1}function ri(t){for(var i=0;t!=0;)t&=t-1,++i;return i}function si(){for(var t=0,i=this.s&this.DM,e=0;e<this.t;++e)t+=ri(this[e]^i);return t}function li(t){var i=Math.floor(t/this.DB);return i>=this.t?this.s!=0:(this[i]&1<<t%this.DB)!=0}function oi(t,i){var e=p.ONE.shiftLeft(t);return this.bitwiseTo(e,i,e),e}function ui(t){return this.changeBit(t,q)}function fi(t){return this.changeBit(t,G)}function hi(t){return this.changeBit(t,J)}function ai(t,i){for(var e=0,r=0,s=Math.min(t.t,this.t);e<s;)r+=this[e]+t[e],i[e++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r+=t.s;e<this.t;)r+=this[e],i[e++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;e<t.t;)r+=t[e],i[e++]=r&this.DM,r>>=this.DB;r+=t.s}i.s=r<0?-1:0,r>0?i[e++]=r:r<-1&&(i[e++]=this.DV+r),i.t=e,i.clamp()}function pi(t){var i=I();return this.addTo(t,i),i}function Pi(t){var i=I();return this.subTo(t,i),i}function mi(t){var i=I();return this.multiplyTo(t,i),i}function yi(){var t=I();return this.squareTo(t),t}function di(t){var i=I();return this.divRemTo(t,i,null),i}function vi(t){var i=I();return this.divRemTo(t,null,i),i}function Ci(t){var i=I(),e=I();return this.divRemTo(t,i,e),new Array(i,e)}function ci(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}function Ii(t,i){if(t!=0){for(;this.t<=i;)this[this.t++]=0;for(this[i]+=t;this[i]>=this.DV;)this[i]-=this.DV,++i>=this.t&&(this[this.t++]=0),++this[i]}}function g(){}function V(t){return t}function _i(t,i,e){t.multiplyTo(i,e)}function xi(t,i){t.squareTo(i)}g.prototype.convert=V,g.prototype.revert=V,g.prototype.mulTo=_i,g.prototype.sqrTo=xi;function Ti(t){return this.exp(t,new g)}function Li(t,i,e){var r=Math.min(this.t+t.t,i);for(e.s=0,e.t=r;r>0;)e[--r]=0;var s;for(s=e.t-this.t;r<s;++r)e[r+this.t]=this.am(0,t[r],e,r,0,this.t);for(s=Math.min(t.t,i);r<s;++r)this.am(0,t[r],e,r,0,i-r);e.clamp()}function Xi(t,i,e){--i;var r=e.t=this.t+t.t-i;for(e.s=0;--r>=0;)e[r]=0;for(r=Math.max(i-this.t,0);r<t.t;++r)e[this.t+r-i]=this.am(i-r,t[r],e,0,0,this.t+r-i);e.clamp(),e.drShiftTo(1,e)}function b(t){this.r2=I(),this.q3=I(),p.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}function Oi(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var i=I();return t.copyTo(i),this.reduce(i),i}function Yi(t){return t}function Ni(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)}function Si(t,i){t.squareTo(i),this.reduce(i)}function Ai(t,i,e){t.multiplyTo(i,e),this.reduce(e)}b.prototype.convert=Oi,b.prototype.revert=Yi,b.prototype.reduce=Ni,b.prototype.mulTo=Ai,b.prototype.sqrTo=Si;function Ei(t,i){var e=t.bitLength(),r,s=S(1),l;if(e<=0)return s;e<18?r=1:e<48?r=3:e<144?r=4:e<768?r=5:r=6,e<8?l=new A(i):i.isEven()?l=new b(i):l=new E(i);var o=new Array,u=3,f=r-1,h=(1<<r)-1;if(o[1]=l.convert(this),r>1){var P=I();for(l.sqrTo(o[1],P);u<=h;)o[u]=I(),l.mulTo(P,o[u-2],o[u]),u+=2}var a=t.t-1,m,y=!0,C=I(),c;for(e=R(t[a])-1;a>=0;){for(e>=f?m=t[a]>>e-f&h:(m=(t[a]&(1<<e+1)-1)<<f-e,a>0&&(m|=t[a-1]>>this.DB+e-f)),u=r;(m&1)==0;)m>>=1,--u;if((e-=u)<0&&(e+=this.DB,--a),y)o[m].copyTo(s),y=!1;else{for(;u>1;)l.sqrTo(s,C),l.sqrTo(C,s),u-=2;u>0?l.sqrTo(s,C):(c=s,s=C,C=c),l.mulTo(C,o[m],s)}for(;a>=0&&(t[a]&1<<e)==0;)l.sqrTo(s,C),c=s,s=C,C=c,--e<0&&(e=this.DB-1,--a)}return l.revert(s)}function Bi(t){var i=this.s<0?this.negate():this.clone(),e=t.s<0?t.negate():t.clone();if(i.compareTo(e)<0){var r=i;i=e,e=r}var s=i.getLowestSetBit(),l=e.getLowestSetBit();if(l<0)return i;for(s<l&&(l=s),l>0&&(i.rShiftTo(l,i),e.rShiftTo(l,e));i.signum()>0;)(s=i.getLowestSetBit())>0&&i.rShiftTo(s,i),(s=e.getLowestSetBit())>0&&e.rShiftTo(s,e),i.compareTo(e)>=0?(i.subTo(e,i),i.rShiftTo(1,i)):(e.subTo(i,e),e.rShiftTo(1,e));return l>0&&e.lShiftTo(l,e),e}function wi(t){if(t<=0)return 0;var i=this.DV%t,e=this.s<0?t-1:0;if(this.t>0)if(i==0)e=this[0]%t;else for(var r=this.t-1;r>=0;--r)e=(i*e+this[r])%t;return e}function Di(t){var i=t.isEven();if(this.isEven()&&i||t.signum()==0)return p.ZERO;for(var e=t.clone(),r=this.clone(),s=S(1),l=S(0),o=S(0),u=S(1);e.signum()!=0;){for(;e.isEven();)e.rShiftTo(1,e),i?((!s.isEven()||!l.isEven())&&(s.addTo(this,s),l.subTo(t,l)),s.rShiftTo(1,s)):l.isEven()||l.subTo(t,l),l.rShiftTo(1,l);for(;r.isEven();)r.rShiftTo(1,r),i?((!o.isEven()||!u.isEven())&&(o.addTo(this,o),u.subTo(t,u)),o.rShiftTo(1,o)):u.isEven()||u.subTo(t,u),u.rShiftTo(1,u);e.compareTo(r)>=0?(e.subTo(r,e),i&&s.subTo(o,s),l.subTo(u,l)):(r.subTo(e,r),i&&o.subTo(s,o),u.subTo(l,u))}if(r.compareTo(p.ONE)!=0)return p.ZERO;if(u.compareTo(t)>=0)return u.subtract(t);if(u.signum()<0)u.addTo(t,u);else return u;return u.signum()<0?u.add(t):u}var T=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],bi=(1<<26)/T[T.length-1];function Mi(t){var i,e=this.abs();if(e.t==1&&e[0]<=T[T.length-1]){for(i=0;i<T.length;++i)if(e[0]==T[i])return!0;return!1}if(e.isEven())return!1;for(i=1;i<T.length;){for(var r=T[i],s=i+1;s<T.length&&r<bi;)r*=T[s++];for(r=e.modInt(r);i<s;)if(r%T[i++]==0)return!1}return e.millerRabin(t)}function Fi(t){var i=this.subtract(p.ONE),e=i.getLowestSetBit();if(e<=0)return!1;var r=i.shiftRight(e);t=t+1>>1,t>T.length&&(t=T.length);for(var s=I(),l=0;l<t;++l){s.fromInt(T[Math.floor(Math.random()*T.length)]);var o=s.modPow(r,this);if(o.compareTo(p.ONE)!=0&&o.compareTo(i)!=0){for(var u=1;u++<e&&o.compareTo(i)!=0;)if(o=o.modPowInt(2,this),o.compareTo(p.ONE)==0)return!1;if(o.compareTo(i)!=0)return!1}}return!0}p.prototype.chunkSize=gt,p.prototype.toRadix=Rt,p.prototype.fromRadix=Zt,p.prototype.fromNumber=qt,p.prototype.bitwiseTo=Gt,p.prototype.changeBit=oi,p.prototype.addTo=ai,p.prototype.dMultiply=ci,p.prototype.dAddOffset=Ii,p.prototype.multiplyLowerTo=Li,p.prototype.multiplyUpperTo=Xi,p.prototype.modInt=wi,p.prototype.millerRabin=Fi,p.prototype.clone=Dt,p.prototype.intValue=bt,p.prototype.byteValue=Mt,p.prototype.shortValue=Ft,p.prototype.signum=Wt,p.prototype.toByteArray=Ut,p.prototype.equals=kt,p.prototype.min=Ht,p.prototype.max=Jt,p.prototype.and=zt,p.prototype.or=Kt,p.prototype.xor=Qt,p.prototype.andNot=$t,p.prototype.not=jt,p.prototype.shiftLeft=ti,p.prototype.shiftRight=ii,p.prototype.getLowestSetBit=ni,p.prototype.bitCount=si,p.prototype.testBit=li,p.prototype.setBit=ui,p.prototype.clearBit=fi,p.prototype.flipBit=hi,p.prototype.add=pi,p.prototype.subtract=Pi,p.prototype.multiply=mi,p.prototype.divide=di,p.prototype.remainder=vi,p.prototype.divideAndRemainder=Ci,p.prototype.modPow=Ei,p.prototype.modInverse=Di,p.prototype.pow=Ti,p.prototype.gcd=Bi,p.prototype.isProbablePrime=Mi,p.prototype.square=yi;var v=p;v.prototype.IsNegative=function(){return this.compareTo(v.ZERO)==-1},v.op_Equality=function(t,i){return t.compareTo(i)==0},v.op_Inequality=function(t,i){return t.compareTo(i)!=0},v.op_GreaterThan=function(t,i){return t.compareTo(i)>0},v.op_LessThan=function(t,i){return t.compareTo(i)<0},v.op_Addition=function(t,i){return new v(t,void 0,void 0).add(new v(i,void 0,void 0))},v.op_Subtraction=function(t,i){return new v(t,void 0,void 0).subtract(new v(i,void 0,void 0))},v.Int128Mul=function(t,i){return new v(t,void 0,void 0).multiply(new v(i,void 0,void 0))},v.op_Division=function(t,i){return t.divide(i)},v.prototype.ToDouble=function(){return parseFloat(this.toString())};var z=function(t,i){var e;if(typeof Object.getOwnPropertyNames>"u"){for(e in i.prototype)(typeof t.prototype[e]>"u"||t.prototype[e]===Object.prototype[e])&&(t.prototype[e]=i.prototype[e]);for(e in i)typeof t[e]>"u"&&(t[e]=i[e]);t.$baseCtor=i}else{for(var r=Object.getOwnPropertyNames(i.prototype),s=0;s<r.length;s++)typeof Object.getOwnPropertyDescriptor(t.prototype,r[s])>"u"&&Object.defineProperty(t.prototype,r[s],Object.getOwnPropertyDescriptor(i.prototype,r[s]));for(e in i)typeof t[e]>"u"&&(t[e]=i[e]);t.$baseCtor=i}};n.Path=function(){return[]},n.Path.prototype.push=Array.prototype.push,n.Paths=function(){return[]},n.Paths.prototype.push=Array.prototype.push,n.DoublePoint=function(){var t=arguments;this.X=0,this.Y=0,t.length===1?(this.X=t[0].X,this.Y=t[0].Y):t.length===2&&(this.X=t[0],this.Y=t[1])},n.DoublePoint0=function(){this.X=0,this.Y=0},n.DoublePoint0.prototype=n.DoublePoint.prototype,n.DoublePoint1=function(t){this.X=t.X,this.Y=t.Y},n.DoublePoint1.prototype=n.DoublePoint.prototype,n.DoublePoint2=function(t,i){this.X=t,this.Y=i},n.DoublePoint2.prototype=n.DoublePoint.prototype,n.PolyNode=function(){this.m_Parent=null,this.m_polygon=new n.Path,this.m_Index=0,this.m_jointype=0,this.m_endtype=0,this.m_Childs=[],this.IsOpen=!1},n.PolyNode.prototype.IsHoleNode=function(){for(var t=!0,i=this.m_Parent;i!==null;)t=!t,i=i.m_Parent;return t},n.PolyNode.prototype.ChildCount=function(){return this.m_Childs.length},n.PolyNode.prototype.Contour=function(){return this.m_polygon},n.PolyNode.prototype.AddChild=function(t){var i=this.m_Childs.length;this.m_Childs.push(t),t.m_Parent=this,t.m_Index=i},n.PolyNode.prototype.GetNext=function(){return this.m_Childs.length>0?this.m_Childs[0]:this.GetNextSiblingUp()},n.PolyNode.prototype.GetNextSiblingUp=function(){return this.m_Parent===null?null:this.m_Index===this.m_Parent.m_Childs.length-1?this.m_Parent.GetNextSiblingUp():this.m_Parent.m_Childs[this.m_Index+1]},n.PolyNode.prototype.Childs=function(){return this.m_Childs},n.PolyNode.prototype.Parent=function(){return this.m_Parent},n.PolyNode.prototype.IsHole=function(){return this.IsHoleNode()},n.PolyTree=function(){this.m_AllPolys=[],n.PolyNode.call(this)},n.PolyTree.prototype.Clear=function(){for(var t=0,i=this.m_AllPolys.length;t<i;t++)this.m_AllPolys[t]=null;this.m_AllPolys.length=0,this.m_Childs.length=0},n.PolyTree.prototype.GetFirst=function(){return this.m_Childs.length>0?this.m_Childs[0]:null},n.PolyTree.prototype.Total=function(){var t=this.m_AllPolys.length;return t>0&&this.m_Childs[0]!==this.m_AllPolys[0]&&t--,t},z(n.PolyTree,n.PolyNode),n.Math_Abs_Int64=n.Math_Abs_Int32=n.Math_Abs_Double=function(t){return Math.abs(t)},n.Math_Max_Int32_Int32=function(t,i){return Math.max(t,i)},d.msie||d.opera||d.safari?n.Cast_Int32=function(t){return t|0}:n.Cast_Int32=function(t){return~~t},typeof Number.toInteger>"u"&&(Number.toInteger=null),d.chrome?n.Cast_Int64=function(t){return t<-2147483648||t>2147483647?t<0?Math.ceil(t):Math.floor(t):~~t}:d.firefox&&typeof Number.toInteger=="function"?n.Cast_Int64=function(t){return Number.toInteger(t)}:d.msie7||d.msie8?n.Cast_Int64=function(t){return parseInt(t,10)}:d.msie?n.Cast_Int64=function(t){return t<-2147483648||t>2147483647?t<0?Math.ceil(t):Math.floor(t):t|0}:n.Cast_Int64=function(t){return t<0?Math.ceil(t):Math.floor(t)},n.Clear=function(t){t.length=0},n.PI=3.141592653589793,n.PI2=2*3.141592653589793,n.IntPoint=function(){var t=arguments,i=t.length;if(this.X=0,this.Y=0,n.use_xyz)if(this.Z=0,i===3)this.X=t[0],this.Y=t[1],this.Z=t[2];else if(i===2)this.X=t[0],this.Y=t[1],this.Z=0;else if(i===1)if(t[0]instanceof n.DoublePoint){var e=t[0];this.X=n.Clipper.Round(e.X),this.Y=n.Clipper.Round(e.Y),this.Z=0}else{var r=t[0];typeof r.Z>"u"&&(r.Z=0),this.X=r.X,this.Y=r.Y,this.Z=r.Z}else this.X=0,this.Y=0,this.Z=0;else if(i===2)this.X=t[0],this.Y=t[1];else if(i===1)if(t[0]instanceof n.DoublePoint){var e=t[0];this.X=n.Clipper.Round(e.X),this.Y=n.Clipper.Round(e.Y)}else{var r=t[0];this.X=r.X,this.Y=r.Y}else this.X=0,this.Y=0},n.IntPoint.op_Equality=function(t,i){return t.X===i.X&&t.Y===i.Y},n.IntPoint.op_Inequality=function(t,i){return t.X!==i.X||t.Y!==i.Y},n.IntPoint0=function(){this.X=0,this.Y=0,n.use_xyz&&(this.Z=0)},n.IntPoint0.prototype=n.IntPoint.prototype,n.IntPoint1=function(t){this.X=t.X,this.Y=t.Y,n.use_xyz&&(typeof t.Z>"u"?this.Z=0:this.Z=t.Z)},n.IntPoint1.prototype=n.IntPoint.prototype,n.IntPoint1dp=function(t){this.X=n.Clipper.Round(t.X),this.Y=n.Clipper.Round(t.Y),n.use_xyz&&(this.Z=0)},n.IntPoint1dp.prototype=n.IntPoint.prototype,n.IntPoint2=function(t,i,e){this.X=t,this.Y=i,n.use_xyz&&(typeof e>"u"?this.Z=0:this.Z=e)},n.IntPoint2.prototype=n.IntPoint.prototype,n.IntRect=function(){var t=arguments,i=t.length;if(i===4)this.left=t[0],this.top=t[1],this.right=t[2],this.bottom=t[3];else if(i===1){var e=t[0];this.left=e.left,this.top=e.top,this.right=e.right,this.bottom=e.bottom}else this.left=0,this.top=0,this.right=0,this.bottom=0},n.IntRect0=function(){this.left=0,this.top=0,this.right=0,this.bottom=0},n.IntRect0.prototype=n.IntRect.prototype,n.IntRect1=function(t){this.left=t.left,this.top=t.top,this.right=t.right,this.bottom=t.bottom},n.IntRect1.prototype=n.IntRect.prototype,n.IntRect4=function(t,i,e,r){this.left=t,this.top=i,this.right=e,this.bottom=r},n.IntRect4.prototype=n.IntRect.prototype,n.ClipType={ctIntersection:0,ctUnion:1,ctDifference:2,ctXor:3},n.PolyType={ptSubject:0,ptClip:1},n.PolyFillType={pftEvenOdd:0,pftNonZero:1,pftPositive:2,pftNegative:3},n.JoinType={jtSquare:0,jtRound:1,jtMiter:2},n.EndType={etOpenSquare:0,etOpenRound:1,etOpenButt:2,etClosedLine:3,etClosedPolygon:4},n.EdgeSide={esLeft:0,esRight:1},n.Direction={dRightToLeft:0,dLeftToRight:1},n.TEdge=function(){this.Bot=new n.IntPoint0,this.Curr=new n.IntPoint0,this.Top=new n.IntPoint0,this.Delta=new n.IntPoint0,this.Dx=0,this.PolyTyp=n.PolyType.ptSubject,this.Side=n.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},n.IntersectNode=function(){this.Edge1=null,this.Edge2=null,this.Pt=new n.IntPoint0},n.MyIntersectNodeSort=function(){},n.MyIntersectNodeSort.Compare=function(t,i){var e=i.Pt.Y-t.Pt.Y;return e>0?1:e<0?-1:0},n.LocalMinima=function(){this.Y=0,this.LeftBound=null,this.RightBound=null,this.Next=null},n.Scanbeam=function(){this.Y=0,this.Next=null},n.Maxima=function(){this.X=0,this.Next=null,this.Prev=null},n.OutRec=function(){this.Idx=0,this.IsHole=!1,this.IsOpen=!1,this.FirstLeft=null,this.Pts=null,this.BottomPt=null,this.PolyNode=null},n.OutPt=function(){this.Idx=0,this.Pt=new n.IntPoint0,this.Next=null,this.Prev=null},n.Join=function(){this.OutPt1=null,this.OutPt2=null,this.OffPt=new n.IntPoint0},n.ClipperBase=function(){this.m_MinimaList=null,this.m_CurrentLM=null,this.m_edges=new Array,this.m_UseFullRange=!1,this.m_HasOpenPaths=!1,this.PreserveCollinear=!1,this.m_Scanbeam=null,this.m_PolyOuts=null,this.m_ActiveEdges=null},n.ClipperBase.horizontal=-9007199254740992,n.ClipperBase.Skip=-2,n.ClipperBase.Unassigned=-1,n.ClipperBase.tolerance=1e-20,n.ClipperBase.loRange=47453132,n.ClipperBase.hiRange=0xfffffffffffff,n.ClipperBase.near_zero=function(t){return t>-n.ClipperBase.tolerance&&t<n.ClipperBase.tolerance},n.ClipperBase.IsHorizontal=function(t){return t.Delta.Y===0},n.ClipperBase.prototype.PointIsVertex=function(t,i){var e=i;do{if(n.IntPoint.op_Equality(e.Pt,t))return!0;e=e.Next}while(e!==i);return!1},n.ClipperBase.prototype.PointOnLineSegment=function(t,i,e,r){return r?t.X===i.X&&t.Y===i.Y||t.X===e.X&&t.Y===e.Y||t.X>i.X==t.X<e.X&&t.Y>i.Y==t.Y<e.Y&&v.op_Equality(v.Int128Mul(t.X-i.X,e.Y-i.Y),v.Int128Mul(e.X-i.X,t.Y-i.Y)):t.X===i.X&&t.Y===i.Y||t.X===e.X&&t.Y===e.Y||t.X>i.X==t.X<e.X&&t.Y>i.Y==t.Y<e.Y&&(t.X-i.X)*(e.Y-i.Y)===(e.X-i.X)*(t.Y-i.Y)},n.ClipperBase.prototype.PointOnPolygon=function(t,i,e){for(var r=i;;){if(this.PointOnLineSegment(t,r.Pt,r.Next.Pt,e))return!0;if(r=r.Next,r===i)break}return!1},n.ClipperBase.prototype.SlopesEqual=n.ClipperBase.SlopesEqual=function(){var t=arguments,i=t.length,e,r,s,l,o,u,f;return i===3?(e=t[0],r=t[1],f=t[2],f?v.op_Equality(v.Int128Mul(e.Delta.Y,r.Delta.X),v.Int128Mul(e.Delta.X,r.Delta.Y)):n.Cast_Int64(e.Delta.Y*r.Delta.X)===n.Cast_Int64(e.Delta.X*r.Delta.Y)):i===4?(s=t[0],l=t[1],o=t[2],f=t[3],f?v.op_Equality(v.Int128Mul(s.Y-l.Y,l.X-o.X),v.Int128Mul(s.X-l.X,l.Y-o.Y)):n.Cast_Int64((s.Y-l.Y)*(l.X-o.X))-n.Cast_Int64((s.X-l.X)*(l.Y-o.Y))===0):(s=t[0],l=t[1],o=t[2],u=t[3],f=t[4],f?v.op_Equality(v.Int128Mul(s.Y-l.Y,o.X-u.X),v.Int128Mul(s.X-l.X,o.Y-u.Y)):n.Cast_Int64((s.Y-l.Y)*(o.X-u.X))-n.Cast_Int64((s.X-l.X)*(o.Y-u.Y))===0)},n.ClipperBase.SlopesEqual3=function(t,i,e){return e?v.op_Equality(v.Int128Mul(t.Delta.Y,i.Delta.X),v.Int128Mul(t.Delta.X,i.Delta.Y)):n.Cast_Int64(t.Delta.Y*i.Delta.X)===n.Cast_Int64(t.Delta.X*i.Delta.Y)},n.ClipperBase.SlopesEqual4=function(t,i,e,r){return r?v.op_Equality(v.Int128Mul(t.Y-i.Y,i.X-e.X),v.Int128Mul(t.X-i.X,i.Y-e.Y)):n.Cast_Int64((t.Y-i.Y)*(i.X-e.X))-n.Cast_Int64((t.X-i.X)*(i.Y-e.Y))===0},n.ClipperBase.SlopesEqual5=function(t,i,e,r,s){return s?v.op_Equality(v.Int128Mul(t.Y-i.Y,e.X-r.X),v.Int128Mul(t.X-i.X,e.Y-r.Y)):n.Cast_Int64((t.Y-i.Y)*(e.X-r.X))-n.Cast_Int64((t.X-i.X)*(e.Y-r.Y))===0},n.ClipperBase.prototype.Clear=function(){this.DisposeLocalMinimaList();for(var t=0,i=this.m_edges.length;t<i;++t){for(var e=0,r=this.m_edges[t].length;e<r;++e)this.m_edges[t][e]=null;n.Clear(this.m_edges[t])}n.Clear(this.m_edges),this.m_UseFullRange=!1,this.m_HasOpenPaths=!1},n.ClipperBase.prototype.DisposeLocalMinimaList=function(){for(;this.m_MinimaList!==null;){var t=this.m_MinimaList.Next;this.m_MinimaList=null,this.m_MinimaList=t}this.m_CurrentLM=null},n.ClipperBase.prototype.RangeTest=function(t,i){i.Value?(t.X>n.ClipperBase.hiRange||t.Y>n.ClipperBase.hiRange||-t.X>n.ClipperBase.hiRange||-t.Y>n.ClipperBase.hiRange)&&n.Error("Coordinate outside allowed range in RangeTest()."):(t.X>n.ClipperBase.loRange||t.Y>n.ClipperBase.loRange||-t.X>n.ClipperBase.loRange||-t.Y>n.ClipperBase.loRange)&&(i.Value=!0,this.RangeTest(t,i))},n.ClipperBase.prototype.InitEdge=function(t,i,e,r){t.Next=i,t.Prev=e,t.Curr.X=r.X,t.Curr.Y=r.Y,n.use_xyz&&(t.Curr.Z=r.Z),t.OutIdx=-1},n.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,n.use_xyz&&(t.Bot.Z=t.Curr.Z),t.Top.X=t.Next.Curr.X,t.Top.Y=t.Next.Curr.Y,n.use_xyz&&(t.Top.Z=t.Next.Curr.Z)):(t.Top.X=t.Curr.X,t.Top.Y=t.Curr.Y,n.use_xyz&&(t.Top.Z=t.Curr.Z),t.Bot.X=t.Next.Curr.X,t.Bot.Y=t.Next.Curr.Y,n.use_xyz&&(t.Bot.Z=t.Next.Curr.Z)),this.SetDx(t),t.PolyTyp=i},n.ClipperBase.prototype.FindNextLocMin=function(t){for(var i;;){for(;n.IntPoint.op_Inequality(t.Bot,t.Prev.Bot)||n.IntPoint.op_Equality(t.Curr,t.Top);)t=t.Next;if(t.Dx!==n.ClipperBase.horizontal&&t.Prev.Dx!==n.ClipperBase.horizontal)break;for(;t.Prev.Dx===n.ClipperBase.horizontal;)t=t.Prev;for(i=t;t.Dx===n.ClipperBase.horizontal;)t=t.Next;if(t.Top.Y!==t.Prev.Bot.Y){i.Prev.Bot.X<t.Bot.X&&(t=i);break}}return t},n.ClipperBase.prototype.ProcessBound=function(t,i){var e,r=t,s;if(r.OutIdx===n.ClipperBase.Skip){if(t=r,i){for(;t.Top.Y===t.Next.Bot.Y;)t=t.Next;for(;t!==r&&t.Dx===n.ClipperBase.horizontal;)t=t.Prev}else{for(;t.Top.Y===t.Prev.Bot.Y;)t=t.Prev;for(;t!==r&&t.Dx===n.ClipperBase.horizontal;)t=t.Next}if(t===r)i?r=t.Next:r=t.Prev;else{i?t=r.Next:t=r.Prev;var l=new n.LocalMinima;l.Next=null,l.Y=t.Bot.Y,l.LeftBound=null,l.RightBound=t,t.WindDelta=0,r=this.ProcessBound(t,i),this.InsertLocalMinima(l)}return r}if(t.Dx===n.ClipperBase.horizontal&&(i?e=t.Prev:e=t.Next,e.Dx===n.ClipperBase.horizontal?e.Bot.X!==t.Bot.X&&e.Top.X!==t.Bot.X&&this.ReverseHorizontal(t):e.Bot.X!==t.Bot.X&&this.ReverseHorizontal(t)),e=t,i){for(;r.Top.Y===r.Next.Bot.Y&&r.Next.OutIdx!==n.ClipperBase.Skip;)r=r.Next;if(r.Dx===n.ClipperBase.horizontal&&r.Next.OutIdx!==n.ClipperBase.Skip){for(s=r;s.Prev.Dx===n.ClipperBase.horizontal;)s=s.Prev;s.Prev.Top.X>r.Next.Top.X&&(r=s.Prev)}for(;t!==r;)t.NextInLML=t.Next,t.Dx===n.ClipperBase.horizontal&&t!==e&&t.Bot.X!==t.Prev.Top.X&&this.ReverseHorizontal(t),t=t.Next;t.Dx===n.ClipperBase.horizontal&&t!==e&&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!==n.ClipperBase.Skip;)r=r.Prev;if(r.Dx===n.ClipperBase.horizontal&&r.Prev.OutIdx!==n.ClipperBase.Skip){for(s=r;s.Next.Dx===n.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===n.ClipperBase.horizontal&&t!==e&&t.Bot.X!==t.Next.Top.X&&this.ReverseHorizontal(t),t=t.Prev;t.Dx===n.ClipperBase.horizontal&&t!==e&&t.Bot.X!==t.Next.Top.X&&this.ReverseHorizontal(t),r=r.Prev}return r},n.ClipperBase.prototype.AddPath=function(t,i,e){n.use_lines?!e&&i===n.PolyType.ptClip&&n.Error("AddPath: Open paths must be subject."):e||n.Error("AddPath: Open paths have been disabled.");var r=t.length-1;if(e)for(;r>0&&n.IntPoint.op_Equality(t[r],t[0]);)--r;for(;r>0&&n.IntPoint.op_Equality(t[r],t[r-1]);)--r;if(e&&r<2||!e&&r<1)return!1;for(var s=new Array,l=0;l<=r;l++)s.push(new n.TEdge);var o=!0;s[1].Curr.X=t[1].X,s[1].Curr.Y=t[1].Y,n.use_xyz&&(s[1].Curr.Z=t[1].Z);var u={Value:this.m_UseFullRange};this.RangeTest(t[0],u),this.m_UseFullRange=u.Value,u.Value=this.m_UseFullRange,this.RangeTest(t[r],u),this.m_UseFullRange=u.Value,this.InitEdge(s[0],s[1],s[r],t[0]),this.InitEdge(s[r],s[0],s[r-1],t[r]);for(var l=r-1;l>=1;--l)u.Value=this.m_UseFullRange,this.RangeTest(t[l],u),this.m_UseFullRange=u.Value,this.InitEdge(s[l],s[l+1],s[l-1],t[l]);for(var f=s[0],h=f,P=f;;){if(h.Curr===h.Next.Curr&&(e||h.Next!==f)){if(h===h.Next)break;h===f&&(f=h.Next),h=this.RemoveEdge(h),P=h;continue}if(h.Prev===h.Next)break;if(e&&n.ClipperBase.SlopesEqual4(h.Prev.Curr,h.Curr,h.Next.Curr,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(h.Prev.Curr,h.Curr,h.Next.Curr))){h===f&&(f=h.Next),h=this.RemoveEdge(h),h=h.Prev,P=h;continue}if(h=h.Next,h===P||!e&&h.Next===f)break}if(!e&&h===h.Next||e&&h.Prev===h.Next)return!1;e||(this.m_HasOpenPaths=!0,f.Prev.OutIdx=n.ClipperBase.Skip),h=f;do this.InitEdge2(h,i),h=h.Next,o&&h.Curr.Y!==f.Curr.Y&&(o=!1);while(h!==f);if(o){if(e)return!1;h.Prev.OutIdx=n.ClipperBase.Skip;var a=new n.LocalMinima;for(a.Next=null,a.Y=h.Bot.Y,a.LeftBound=null,a.RightBound=h,a.RightBound.Side=n.EdgeSide.esRight,a.RightBound.WindDelta=0;h.Bot.X!==h.Prev.Top.X&&this.ReverseHorizontal(h),h.Next.OutIdx!==n.ClipperBase.Skip;)h.NextInLML=h.Next,h=h.Next;return this.InsertLocalMinima(a),this.m_edges.push(s),!0}this.m_edges.push(s);var m,y=null;for(n.IntPoint.op_Equality(h.Prev.Bot,h.Prev.Top)&&(h=h.Next);h=this.FindNextLocMin(h),h!==y;){y===null&&(y=h);var a=new n.LocalMinima;a.Next=null,a.Y=h.Bot.Y,h.Dx<h.Prev.Dx?(a.LeftBound=h.Prev,a.RightBound=h,m=!1):(a.LeftBound=h,a.RightBound=h.Prev,m=!0),a.LeftBound.Side=n.EdgeSide.esLeft,a.RightBound.Side=n.EdgeSide.esRight,e?a.LeftBound.Next===a.RightBound?a.LeftBound.WindDelta=-1:a.LeftBound.WindDelta=1:a.LeftBound.WindDelta=0,a.RightBound.WindDelta=-a.LeftBound.WindDelta,h=this.ProcessBound(a.LeftBound,m),h.OutIdx===n.ClipperBase.Skip&&(h=this.ProcessBound(h,m));var C=this.ProcessBound(a.RightBound,!m);C.OutIdx===n.ClipperBase.Skip&&(C=this.ProcessBound(C,!m)),a.LeftBound.OutIdx===n.ClipperBase.Skip?a.LeftBound=null:a.RightBound.OutIdx===n.ClipperBase.Skip&&(a.RightBound=null),this.InsertLocalMinima(a),m||(h=C)}return!0},n.ClipperBase.prototype.AddPaths=function(t,i,e){for(var r=!1,s=0,l=t.length;s<l;++s)this.AddPath(t[s],i,e)&&(r=!0);return r},n.ClipperBase.prototype.Pt2IsBetweenPt1AndPt3=function(t,i,e){return n.IntPoint.op_Equality(t,e)||n.IntPoint.op_Equality(t,i)||n.IntPoint.op_Equality(e,i)?!1:t.X!==e.X?i.X>t.X==i.X<e.X:i.Y>t.Y==i.Y<e.Y},n.ClipperBase.prototype.RemoveEdge=function(t){t.Prev.Next=t.Next,t.Next.Prev=t.Prev;var i=t.Next;return t.Prev=null,i},n.ClipperBase.prototype.SetDx=function(t){t.Delta.X=t.Top.X-t.Bot.X,t.Delta.Y=t.Top.Y-t.Bot.Y,t.Delta.Y===0?t.Dx=n.ClipperBase.horizontal:t.Dx=t.Delta.X/t.Delta.Y},n.ClipperBase.prototype.InsertLocalMinima=function(t){if(this.m_MinimaList===null)this.m_MinimaList=t;else if(t.Y>=this.m_MinimaList.Y)t.Next=this.m_MinimaList,this.m_MinimaList=t;else{for(var i=this.m_MinimaList;i.Next!==null&&t.Y<i.Next.Y;)i=i.Next;t.Next=i.Next,i.Next=t}},n.ClipperBase.prototype.PopLocalMinima=function(t,i){return i.v=this.m_CurrentLM,this.m_CurrentLM!==null&&this.m_CurrentLM.Y===t?(this.m_CurrentLM=this.m_CurrentLM.Next,!0):!1},n.ClipperBase.prototype.ReverseHorizontal=function(t){var i=t.Top.X;t.Top.X=t.Bot.X,t.Bot.X=i,n.use_xyz&&(i=t.Top.Z,t.Top.Z=t.Bot.Z,t.Bot.Z=i)},n.ClipperBase.prototype.Reset=function(){if(this.m_CurrentLM=this.m_MinimaList,this.m_CurrentLM!==null){this.m_Scanbeam=null;for(var t=this.m_MinimaList;t!==null;){this.InsertScanbeam(t.Y);var i=t.LeftBound;i!==null&&(i.Curr.X=i.Bot.X,i.Curr.Y=i.Bot.Y,n.use_xyz&&(i.Curr.Z=i.Bot.Z),i.OutIdx=n.ClipperBase.Unassigned),i=t.RightBound,i!==null&&(i.Curr.X=i.Bot.X,i.Curr.Y=i.Bot.Y,n.use_xyz&&(i.Curr.Z=i.Bot.Z),i.OutIdx=n.ClipperBase.Unassigned),t=t.Next}this.m_ActiveEdges=null}},n.ClipperBase.prototype.InsertScanbeam=function(t){if(this.m_Scanbeam===null)this.m_Scanbeam=new n.Scanbeam,this.m_Scanbeam.Next=null,this.m_Scanbeam.Y=t;else if(t>this.m_Scanbeam.Y){var i=new n.Scanbeam;i.Y=t,i.Next=this.m_Scanbeam,this.m_Scanbeam=i}else{for(var e=this.m_Scanbeam;e.Next!==null&&t<=e.Next.Y;)e=e.Next;if(t===e.Y)return;var r=new n.Scanbeam;r.Y=t,r.Next=e.Next,e.Next=r}},n.ClipperBase.prototype.PopScanbeam=function(t){return this.m_Scanbeam===null?(t.v=0,!1):(t.v=this.m_Scanbeam.Y,this.m_Scanbeam=this.m_Scanbeam.Next,!0)},n.ClipperBase.prototype.LocalMinimaPending=function(){return this.m_CurrentLM!==null},n.ClipperBase.prototype.CreateOutRec=function(){var t=new n.OutRec;return t.Idx=n.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},n.ClipperBase.prototype.DisposeOutRec=function(t){var i=this.m_PolyOuts[t];i.Pts=null,i=null,this.m_PolyOuts[t]=null},n.ClipperBase.prototype.UpdateEdgeIntoAEL=function(t){t.NextInLML===null&&n.Error("UpdateEdgeIntoAEL: invalid call");var i=t.PrevInAEL,e=t.NextInAEL;return t.NextInLML.OutIdx=t.OutIdx,i!==null?i.NextInAEL=t.NextInLML:this.m_ActiveEdges=t.NextInLML,e!==null&&(e.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,t.Curr.X=t.Bot.X,t.Curr.Y=t.Bot.Y,t.PrevInAEL=i,t.NextInAEL=e,n.ClipperBase.IsHorizontal(t)||this.InsertScanbeam(t.Top.Y),t},n.ClipperBase.prototype.SwapPositionsInAEL=function(t,i){if(!(t.NextInAEL===t.PrevInAEL||i.NextInAEL===i.PrevInAEL)){if(t.NextInAEL===i){var e=i.NextInAEL;e!==null&&(e.PrevInAEL=t);var r=t.PrevInAEL;r!==null&&(r.NextInAEL=i),i.PrevInAEL=r,i.NextInAEL=t,t.PrevInAEL=i,t.NextInAEL=e}else if(i.NextInAEL===t){var s=t.NextInAEL;s!==null&&(s.PrevInAEL=i);var l=i.PrevInAEL;l!==null&&(l.NextInAEL=t),t.PrevInAEL=l,t.NextInAEL=i,i.PrevInAEL=t,i.NextInAEL=s}else{var o=t.NextInAEL,u=t.PrevInAEL;t.NextInAEL=i.NextInAEL,t.NextInAEL!==null&&(t.NextInAEL.PrevInAEL=t),t.PrevInAEL=i.PrevInAEL,t.PrevInAEL!==null&&(t.PrevInAEL.NextInAEL=t),i.NextInAEL=o,i.NextInAEL!==null&&(i.NextInAEL.PrevInAEL=i),i.PrevInAEL=u,i.PrevInAEL!==null&&(i.PrevInAEL.NextInAEL=i)}t.PrevInAEL===null?this.m_ActiveEdges=t:i.PrevInAEL===null&&(this.m_ActiveEdges=i)}},n.ClipperBase.prototype.DeleteFromAEL=function(t){var i=t.PrevInAEL,e=t.NextInAEL;i===null&&e===null&&t!==this.m_ActiveEdges||(i!==null?i.NextInAEL=e:this.m_ActiveEdges=e,e!==null&&(e.PrevInAEL=i),t.NextInAEL=null,t.PrevInAEL=null)},n.Clipper=function(t){typeof t>"u"&&(t=0),this.m_PolyOuts=null,this.m_ClipType=n.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=n.PolyFillType.pftEvenOdd,this.m_SubjFillType=n.PolyFillType.pftEvenOdd,this.m_Joins=null,this.m_GhostJoins=null,this.m_UsingPolyTree=!1,this.ReverseSolution=!1,this.StrictlySimple=!1,n.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=n.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)!==0,this.StrictlySimple=(2&t)!==0,this.PreserveCollinear=(4&t)!==0,n.use_xyz&&(this.ZFillFunction=null)},n.Clipper.ioReverseSolution=1,n.Clipper.ioStrictlySimple=2,n.Clipper.ioPreserveCollinear=4,n.Clipper.prototype.Clear=function(){this.m_edges.length!==0&&(this.DisposeAllPolyPts(),n.ClipperBase.prototype.Clear.call(this))},n.Clipper.prototype.InsertMaxima=function(t){var i=new n.Maxima;if(i.X=t,this.m_Maxima===null)this.m_Maxima=i,this.m_Maxima.Next=null,this.m_Maxima.Prev=null;else if(t<this.m_Maxima.X)i.Next=this.m_Maxima,i.Prev=null,this.m_Maxima=i;else{for(var e=this.m_Maxima;e.Next!==null&&t>=e.Next.X;)e=e.Next;if(t===e.X)return;i.Next=e.Next,i.Prev=e,e.Next!==null&&(e.Next.Prev=i),e.Next=i}},n.Clipper.prototype.Execute=function(){var t=arguments,i=t.length,e=t[1]instanceof n.PolyTree;if(i===4&&!e){var r=t[0],s=t[1],l=t[2],o=t[3];if(this.m_ExecuteLocked)return!1;this.m_HasOpenPaths&&n.Error("Error: PolyTree struct is needed for open path clipping."),this.m_ExecuteLocked=!0,n.Clear(s),this.m_SubjFillType=l,this.m_ClipFillType=o,this.m_ClipType=r,this.m_UsingPolyTree=!1;try{var u=this.ExecuteInternal();u&&this.BuildResult(s)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return u}else if(i===4&&e){var r=t[0],f=t[1],l=t[2],o=t[3];if(this.m_ExecuteLocked)return!1;this.m_ExecuteLocked=!0,this.m_SubjFillType=l,this.m_ClipFillType=o,this.m_ClipType=r,this.m_UsingPolyTree=!0;try{var u=this.ExecuteInternal();u&&this.BuildResult2(f)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return u}else if(i===2&&!e){var r=t[0],s=t[1];return this.Execute(r,s,n.PolyFillType.pftEvenOdd,n.PolyFillType.pftEvenOdd)}else if(i===2&&e){var r=t[0],f=t[1];return this.Execute(r,f,n.PolyFillType.pftEvenOdd,n.PolyFillType.pftEvenOdd)}},n.Clipper.prototype.FixHoleLinkage=function(t){if(!(t.FirstLeft===null||t.IsHole!==t.FirstLeft.IsHole&&t.FirstLeft.Pts!==null)){for(var i=t.FirstLeft;i!==null&&(i.IsHole===t.IsHole||i.Pts===null);)i=i.FirstLeft;t.FirstLeft=i}},n.Clipper.prototype.ExecuteInternal=function(){try{this.Reset(),this.m_SortedEdges=null,this.m_Maxima=null;var t={},i={};if(!this.PopScanbeam(t))return!1;for(this.InsertLocalMinimaIntoAEL(t.v);this.PopScanbeam(i)||this.LocalMinimaPending();){if(this.ProcessHorizontals(),this.m_GhostJoins.length=0,!this.ProcessIntersections(i.v))return!1;this.ProcessEdgesAtTopOfScanbeam(i.v),t.v=i.v,this.InsertLocalMinimaIntoAEL(t.v)}var e,r,s;for(r=0,s=this.m_PolyOuts.length;r<s;r++)e=this.m_PolyOuts[r],!(e.Pts===null||e.IsOpen)&&(e.IsHole^this.ReverseSolution)==this.Area$1(e)>0&&this.ReversePolyPtLinks(e.Pts);for(this.JoinCommonEdges(),r=0,s=this.m_PolyOuts.length;r<s;r++)e=this.m_PolyOuts[r],e.Pts!==null&&(e.IsOpen?this.FixupOutPolyline(e):this.FixupOutPolygon(e));return this.StrictlySimple&&this.DoSimplePolygons(),!0}finally{this.m_Joins.length=0,this.m_GhostJoins.length=0}},n.Clipper.prototype.DisposeAllPolyPts=function(){for(var t=0,i=this.m_PolyOuts.length;t<i;++t)this.DisposeOutRec(t);n.Clear(this.m_PolyOuts)},n.Clipper.prototype.AddJoin=function(t,i,e){var r=new n.Join;r.OutPt1=t,r.OutPt2=i,r.OffPt.X=e.X,r.OffPt.Y=e.Y,n.use_xyz&&(r.OffPt.Z=e.Z),this.m_Joins.push(r)},n.Clipper.prototype.AddGhostJoin=function(t,i){var e=new n.Join;e.OutPt1=t,e.OffPt.X=i.X,e.OffPt.Y=i.Y,n.use_xyz&&(e.OffPt.Z=i.Z),this.m_GhostJoins.push(e)},n.Clipper.prototype.SetZ=function(t,i,e){if(this.ZFillFunction!==null){if(t.Z!==0||this.ZFillFunction===null)return;n.IntPoint.op_Equality(t,i.Bot)?t.Z=i.Bot.Z:n.IntPoint.op_Equality(t,i.Top)?t.Z=i.Top.Z:n.IntPoint.op_Equality(t,e.Bot)?t.Z=e.Bot.Z:n.IntPoint.op_Equality(t,e.Top)?t.Z=e.Top.Z:this.ZFillFunction(i.Bot,i.Top,e.Bot,e.Top,t)}},n.Clipper.prototype.InsertLocalMinimaIntoAEL=function(t){for(var i={},e,r;this.PopLocalMinima(t,i);){e=i.v.LeftBound,r=i.v.RightBound;var s=null;if(e===null?(this.InsertEdgeIntoAEL(r,null),this.SetWindingCount(r),this.IsContributing(r)&&(s=this.AddOutPt(r,r.Bot))):r===null?(this.InsertEdgeIntoAEL(e,null),this.SetWindingCount(e),this.IsContributing(e)&&(s=this.AddOutPt(e,e.Bot)),this.InsertScanbeam(e.Top.Y)):(this.InsertEdgeIntoAEL(e,null),this.InsertEdgeIntoAEL(r,e),this.SetWindingCount(e),r.WindCnt=e.WindCnt,r.WindCnt2=e.WindCnt2,this.IsContributing(e)&&(s=this.AddLocalMinPoly(e,r,e.Bot)),this.InsertScanbeam(e.Top.Y)),r!==null&&(n.ClipperBase.IsHorizontal(r)?(r.NextInLML!==null&&this.InsertScanbeam(r.NextInLML.Top.Y),this.AddEdgeToSEL(r)):this.InsertScanbeam(r.Top.Y)),!(e===null||r===null)){if(s!==null&&n.ClipperBase.IsHorizontal(r)&&this.m_GhostJoins.length>0&&r.WindDelta!==0)for(var l=0,o=this.m_GhostJoins.length;l<o;l++){var u=this.m_GhostJoins[l];this.HorzSegmentsOverlap(u.OutPt1.Pt.X,u.OffPt.X,r.Bot.X,r.Top.X)&&this.AddJoin(u.OutPt1,s,u.OffPt)}if(e.OutIdx>=0&&e.PrevInAEL!==null&&e.PrevInAEL.Curr.X===e.Bot.X&&e.PrevInAEL.OutIdx>=0&&n.ClipperBase.SlopesEqual5(e.PrevInAEL.Curr,e.PrevInAEL.Top,e.Curr,e.Top,this.m_UseFullRange)&&e.WindDelta!==0&&e.PrevInAEL.WindDelta!==0){var f=this.AddOutPt(e.PrevInAEL,e.Bot);this.AddJoin(s,f,e.Top)}if(e.NextInAEL!==r){if(r.OutIdx>=0&&r.PrevInAEL.OutIdx>=0&&n.ClipperBase.SlopesEqual5(r.PrevInAEL.Curr,r.PrevInAEL.Top,r.Curr,r.Top,this.m_UseFullRange)&&r.WindDelta!==0&&r.PrevInAEL.WindDelta!==0){var f=this.AddOutPt(r.PrevInAEL,r.Bot);this.AddJoin(s,f,r.Top)}var h=e.NextInAEL;if(h!==null)for(;h!==r;)this.IntersectEdges(r,h,e.Curr),h=h.NextInAEL}}}},n.Clipper.prototype.InsertEdgeIntoAEL=function(t,i){if(this.m_ActiveEdges===null)t.PrevInAEL=null,t.NextInAEL=null,this.m_ActiveEdges=t;else if(i===null&&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(i===null&&(i=this.m_ActiveEdges);i.NextInAEL!==null&&!this.E2InsertsBeforeE1(i.NextInAEL,t);)i=i.NextInAEL;t.NextInAEL=i.NextInAEL,i.NextInAEL!==null&&(i.NextInAEL.PrevInAEL=t),t.PrevInAEL=i,i.NextInAEL=t}},n.Clipper.prototype.E2InsertsBeforeE1=function(t,i){return i.Curr.X===t.Curr.X?i.Top.Y>t.Top.Y?i.Top.X<n.Clipper.TopX(t,i.Top.Y):t.Top.X>n.Clipper.TopX(i,t.Top.Y):i.Curr.X<t.Curr.X},n.Clipper.prototype.IsEvenOddFillType=function(t){return t.PolyTyp===n.PolyType.ptSubject?this.m_SubjFillType===n.PolyFillType.pftEvenOdd:this.m_ClipFillType===n.PolyFillType.pftEvenOdd},n.Clipper.prototype.IsEvenOddAltFillType=function(t){return t.PolyTyp===n.PolyType.ptSubject?this.m_ClipFillType===n.PolyFillType.pftEvenOdd:this.m_SubjFillType===n.PolyFillType.pftEvenOdd},n.Clipper.prototype.IsContributing=function(t){var i,e;switch(t.PolyTyp===n.PolyType.ptSubject?(i=this.m_SubjFillType,e=this.m_ClipFillType):(i=this.m_ClipFillType,e=this.m_SubjFillType),i){case n.PolyFillType.pftEvenOdd:if(t.WindDelta===0&&t.WindCnt!==1)return!1;break;case n.PolyFillType.pftNonZero:if(Math.abs(t.WindCnt)!==1)return!1;break;case n.PolyFillType.pftPositive:if(t.WindCnt!==1)return!1;break;default:if(t.WindCnt!==-1)return!1;break}switch(this.m_ClipType){case n.ClipType.ctIntersection:switch(e){case n.PolyFillType.pftEvenOdd:case n.PolyFillType.pftNonZero:return t.WindCnt2!==0;case n.PolyFillType.pftPositive:return t.WindCnt2>0;default:return t.WindCnt2<0}case n.ClipType.ctUnion:switch(e){case n.PolyFillType.pftEvenOdd:case n.PolyFillType.pftNonZero:return t.WindCnt2===0;case n.PolyFillType.pftPositive:return t.WindCnt2<=0;default:return t.WindCnt2>=0}case n.ClipType.ctDifference:if(t.PolyTyp===n.PolyType.ptSubject)switch(e){case n.PolyFillType.pftEvenOdd:case n.PolyFillType.pftNonZero:return t.WindCnt2===0;case n.PolyFillType.pftPositive:return t.WindCnt2<=0;default:return t.WindCnt2>=0}else switch(e){case n.PolyFillType.pftEvenOdd:case n.PolyFillType.pftNonZero:return t.WindCnt2!==0;case n.PolyFillType.pftPositive:return t.WindCnt2>0;default:return t.WindCnt2<0}case n.ClipType.ctXor:if(t.WindDelta===0)switch(e){case n.PolyFillType.pftEvenOdd:case n.PolyFillType.pftNonZero:return t.WindCnt2===0;case n.PolyFillType.pftPositive:return t.WindCnt2<=0;default:return t.WindCnt2>=0}else return!0}return!0},n.Clipper.prototype.SetWindingCount=function(t){for(var i=t.PrevInAEL;i!==null&&(i.PolyTyp!==t.PolyTyp||i.WindDelta===0);)i=i.PrevInAEL;if(i===null){var e=t.PolyTyp===n.PolyType.ptSubject?this.m_SubjFillType:this.m_ClipFillType;t.WindDelta===0?t.WindCnt=e===n.PolyFillType.pftNegative?-1:1:t.WindCnt=t.WindDelta,t.WindCnt2=0,i=this.m_ActiveEdges}else if(t.WindDelta===0&&this.m_ClipType!==n.ClipType.ctUnion)t.WindCnt=1,t.WindCnt2=i.WindCnt2,i=i.NextInAEL;else if(this.IsEvenOddFillType(t)){if(t.WindDelta===0){for(var r=!0,s=i.PrevInAEL;s!==null;)s.PolyTyp===i.PolyTyp&&s.WindDelta!==0&&(r=!r),s=s.PrevInAEL;t.WindCnt=r?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=t.WindDelta===0?1:t.WindDelta:t.WindDelta===0?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;)i.WindDelta!==0&&(t.WindCnt2=t.WindCnt2===0?1:0),i=i.NextInAEL;else for(;i!==t;)t.WindCnt2+=i.WindDelta,i=i.NextInAEL},n.Clipper.prototype.AddEdgeToSEL=function(t){this.m_SortedEdges===null?(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)},n.Clipper.prototype.PopEdgeFromSEL=function(t){if(t.v=this.m_SortedEdges,t.v===null)return!1;var i=t.v;return this.m_SortedEdges=t.v.NextInSEL,this.m_SortedEdges!==null&&(this.m_SortedEdges.PrevInSEL=null),i.NextInSEL=null,i.PrevInSEL=null,!0},n.Clipper.prototype.CopyAELToSEL=function(){var t=this.m_ActiveEdges;for(this.m_SortedEdges=t;t!==null;)t.PrevInSEL=t.PrevInAEL,t.NextInSEL=t.NextInAEL,t=t.NextInAEL},n.Clipper.prototype.SwapPositionsInSEL=function(t,i){if(!(t.NextInSEL===null&&t.PrevInSEL===null)&&!(i.NextInSEL===null&&i.PrevInSEL===null)){if(t.NextInSEL===i){var e=i.NextInSEL;e!==null&&(e.PrevInSEL=t);var r=t.PrevInSEL;r!==null&&(r.NextInSEL=i),i.PrevInSEL=r,i.NextInSEL=t,t.PrevInSEL=i,t.NextInSEL=e}else if(i.NextInSEL===t){var e=t.NextInSEL;e!==null&&(e.PrevInSEL=i);var r=i.PrevInSEL;r!==null&&(r.NextInSEL=t),t.PrevInSEL=r,t.NextInSEL=i,i.PrevInSEL=t,i.NextInSEL=e}else{var e=t.NextInSEL,r=t.PrevInSEL;t.NextInSEL=i.NextInSEL,t.NextInSEL!==null&&(t.NextInSEL.PrevInSEL=t),t.PrevInSEL=i.PrevInSEL,t.PrevInSEL!==null&&(t.PrevInSEL.NextInSEL=t),i.NextInSEL=e,i.NextInSEL!==null&&(i.NextInSEL.PrevInSEL=i),i.PrevInSEL=r,i.PrevInSEL!==null&&(i.PrevInSEL.NextInSEL=i)}t.PrevInSEL===null?this.m_SortedEdges=t:i.PrevInSEL===null&&(this.m_SortedEdges=i)}},n.Clipper.prototype.AddLocalMaxPoly=function(t,i,e){this.AddOutPt(t,e),i.WindDelta===0&&this.AddOutPt(i,e),t.OutIdx===i.OutIdx?(t.OutIdx=-1,i.OutIdx=-1):t.OutIdx<i.OutIdx?this.AppendPolygon(t,i):this.AppendPolygon(i,t)},n.Clipper.prototype.AddLocalMinPoly=function(t,i,e){var r,s,l;if(n.ClipperBase.IsHorizontal(i)||t.Dx>i.Dx?(r=this.AddOutPt(t,e),i.OutIdx=t.OutIdx,t.Side=n.EdgeSide.esLeft,i.Side=n.EdgeSide.esRight,s=t,s.PrevInAEL===i?l=i.PrevInAEL:l=s.PrevInAEL):(r=this.AddOutPt(i,e),t.OutIdx=i.OutIdx,t.Side=n.EdgeSide.esRight,i.Side=n.EdgeSide.esLeft,s=i,s.PrevInAEL===t?l=t.PrevInAEL:l=s.PrevInAEL),l!==null&&l.OutIdx>=0&&l.Top.Y<e.Y&&s.Top.Y<e.Y){var o=n.Clipper.TopX(l,e.Y),u=n.Clipper.TopX(s,e.Y);if(o===u&&s.WindDelta!==0&&l.WindDelta!==0&&n.ClipperBase.SlopesEqual5(new n.IntPoint2(o,e.Y),l.Top,new n.IntPoint2(u,e.Y),s.Top,this.m_UseFullRange)){var f=this.AddOutPt(l,e);this.AddJoin(r,f,s.Top)}}return r},n.Clipper.prototype.AddOutPt=function(t,i){if(t.OutIdx<0){var e=this.CreateOutRec();e.IsOpen=t.WindDelta===0;var r=new n.OutPt;return e.Pts=r,r.Idx=e.Idx,r.Pt.X=i.X,r.Pt.Y=i.Y,n.use_xyz&&(r.Pt.Z=i.Z),r.Next=r,r.Prev=r,e.IsOpen||this.SetHoleState(t,e),t.OutIdx=e.Idx,r}else{var e=this.m_PolyOuts[t.OutIdx],s=e.Pts,l=t.Side===n.EdgeSide.esLeft;if(l&&n.IntPoint.op_Equality(i,s.Pt))return s;if(!l&&n.IntPoint.op_Equality(i,s.Prev.Pt))return s.Prev;var r=new n.OutPt;return r.Idx=e.Idx,r.Pt.X=i.X,r.Pt.Y=i.Y,n.use_xyz&&(r.Pt.Z=i.Z),r.Next=s,r.Prev=s.Prev,r.Prev.Next=r,s.Prev=r,l&&(e.Pts=r),r}},n.Clipper.prototype.GetLastOutPt=function(t){var i=this.m_PolyOuts[t.OutIdx];return t.Side===n.EdgeSide.esLeft?i.Pts:i.Pts.Prev},n.Clipper.prototype.SwapPoints=function(t,i){var e=new n.IntPoint1(t.Value);t.Value.X=i.Value.X,t.Value.Y=i.Value.Y,n.use_xyz&&(t.Value.Z=i.Value.Z),i.Value.X=e.X,i.Value.Y=e.Y,n.use_xyz&&(i.Value.Z=e.Z)},n.Clipper.prototype.HorzSegmentsOverlap=function(t,i,e,r){var s;return t>i&&(s=t,t=i,i=s),e>r&&(s=e,e=r,r=s),t<r&&e<i},n.Clipper.prototype.SetHoleState=function(t,i){for(var e=t.PrevInAEL,r=null;e!==null;)e.OutIdx>=0&&e.WindDelta!==0&&(r===null?r=e:r.OutIdx===e.OutIdx&&(r=null)),e=e.PrevInAEL;r===null?(i.FirstLeft=null,i.IsHole=!1):(i.FirstLeft=this.m_PolyOuts[r.OutIdx],i.IsHole=!i.FirstLeft.IsHole)},n.Clipper.prototype.GetDx=function(t,i){return t.Y===i.Y?n.ClipperBase.horizontal:(i.X-t.X)/(i.Y-t.Y)},n.Clipper.prototype.FirstIsBottomPt=function(t,i){for(var e=t.Prev;n.IntPoint.op_Equality(e.Pt,t.Pt)&&e!==t;)e=e.Prev;var r=Math.abs(this.GetDx(t.Pt,e.Pt));for(e=t.Next;n.IntPoint.op_Equality(e.Pt,t.Pt)&&e!==t;)e=e.Next;var s=Math.abs(this.GetDx(t.Pt,e.Pt));for(e=i.Prev;n.IntPoint.op_Equality(e.Pt,i.Pt)&&e!==i;)e=e.Prev;var l=Math.abs(this.GetDx(i.Pt,e.Pt));for(e=i.Next;n.IntPoint.op_Equality(e.Pt,i.Pt)&&e!==i;)e=e.Next;var o=Math.abs(this.GetDx(i.Pt,e.Pt));return Math.max(r,s)===Math.max(l,o)&&Math.min(r,s)===Math.min(l,o)?this.Area(t)>0:r>=l&&r>=o||s>=l&&s>=o},n.Clipper.prototype.GetBottomPt=function(t){for(var i=null,e=t.Next;e!==t;)e.Pt.Y>t.Pt.Y?(t=e,i=null):e.Pt.Y===t.Pt.Y&&e.Pt.X<=t.Pt.X&&(e.Pt.X<t.Pt.X?(i=null,t=e):e.Next!==t&&e.Prev!==t&&(i=e)),e=e.Next;if(i!==null)for(;i!==e;)for(this.FirstIsBottomPt(e,i)||(t=i),i=i.Next;n.IntPoint.op_Inequality(i.Pt,t.Pt);)i=i.Next;return t},n.Clipper.prototype.GetLowermostRec=function(t,i){t.BottomPt===null&&(t.BottomPt=this.GetBottomPt(t.Pts)),i.BottomPt===null&&(i.BottomPt=this.GetBottomPt(i.Pts));var e=t.BottomPt,r=i.BottomPt;return e.Pt.Y>r.Pt.Y?t:e.Pt.Y<r.Pt.Y?i:e.Pt.X<r.Pt.X?t:e.Pt.X>r.Pt.X||e.Next===e?i:r.Next===r||this.FirstIsBottomPt(e,r)?t:i},n.Clipper.prototype.OutRec1RightOfOutRec2=function(t,i){do if(t=t.FirstLeft,t===i)return!0;while(t!==null);return!1},n.Clipper.prototype.GetOutRec=function(t){for(var i=this.m_PolyOuts[t];i!==this.m_PolyOuts[i.Idx];)i=this.m_PolyOuts[i.Idx];return i},n.Clipper.prototype.AppendPolygon=function(t,i){var e=this.m_PolyOuts[t.OutIdx],r=this.m_PolyOuts[i.OutIdx],s;this.OutRec1RightOfOutRec2(e,r)?s=r:this.OutRec1RightOfOutRec2(r,e)?s=e:s=this.GetLowermostRec(e,r);var l=e.Pts,o=l.Prev,u=r.Pts,f=u.Prev;t.Side===n.EdgeSide.esLeft?i.Side===n.EdgeSide.esLeft?(this.ReversePolyPtLinks(u),u.Next=l,l.Prev=u,o.Next=f,f.Prev=o,e.Pts=f):(f.Next=l,l.Prev=f,u.Prev=o,o.Next=u,e.Pts=u):i.Side===n.EdgeSide.esRight?(this.ReversePolyPtLinks(u),o.Next=f,f.Prev=o,u.Next=l,l.Prev=u):(o.Next=u,u.Prev=o,l.Prev=f,f.Next=l),e.BottomPt=null,s===r&&(r.FirstLeft!==e&&(e.FirstLeft=r.FirstLeft),e.IsHole=r.IsHole),r.Pts=null,r.BottomPt=null,r.FirstLeft=e;var h=t.OutIdx,P=i.OutIdx;t.OutIdx=-1,i.OutIdx=-1;for(var a=this.m_ActiveEdges;a!==null;){if(a.OutIdx===P){a.OutIdx=h,a.Side=t.Side;break}a=a.NextInAEL}r.Idx=e.Idx},n.Clipper.prototype.ReversePolyPtLinks=function(t){if(t!==null){var i,e;i=t;do e=i.Next,i.Next=i.Prev,i.Prev=e,i=e;while(i!==t)}},n.Clipper.SwapSides=function(t,i){var e=t.Side;t.Side=i.Side,i.Side=e},n.Clipper.SwapPolyIndexes=function(t,i){var e=t.OutIdx;t.OutIdx=i.OutIdx,i.OutIdx=e},n.Clipper.prototype.IntersectEdges=function(t,i,e){var r=t.OutIdx>=0,s=i.OutIdx>=0;if(n.use_xyz&&this.SetZ(e,t,i),n.use_lines&&(t.WindDelta===0||i.WindDelta===0)){if(t.WindDelta===0&&i.WindDelta===0)return;t.PolyTyp===i.PolyTyp&&t.WindDelta!==i.WindDelta&&this.m_ClipType===n.ClipType.ctUnion?t.WindDelta===0?s&&(this.AddOutPt(t,e),r&&(t.OutIdx=-1)):r&&(this.AddOutPt(i,e),s&&(i.OutIdx=-1)):t.PolyTyp!==i.PolyTyp&&(t.WindDelta===0&&Math.abs(i.WindCnt)===1&&(this.m_ClipType!==n.ClipType.ctUnion||i.WindCnt2===0)?(this.AddOutPt(t,e),r&&(t.OutIdx=-1)):i.WindDelta===0&&Math.abs(t.WindCnt)===1&&(this.m_ClipType!==n.ClipType.ctUnion||t.WindCnt2===0)&&(this.AddOutPt(i,e),s&&(i.OutIdx=-1)));return}if(t.PolyTyp===i.PolyTyp)if(this.IsEvenOddFillType(t)){var l=t.WindCnt;t.WindCnt=i.WindCnt,i.WindCnt=l}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=t.WindCnt2===0?1:0:t.WindCnt2+=i.WindDelta,this.IsEvenOddFillType(t)?i.WindCnt2=i.WindCnt2===0?1:0:i.WindCnt2-=t.WindDelta;var o,u,f,h;t.PolyTyp===n.PolyType.ptSubject?(o=this.m_SubjFillType,f=this.m_ClipFillType):(o=this.m_ClipFillType,f=this.m_SubjFillType),i.PolyTyp===n.PolyType.ptSubject?(u=this.m_SubjFillType,h=this.m_ClipFillType):(u=this.m_ClipFillType,h=this.m_SubjFillType);var P,a;switch(o){case n.PolyFillType.pftPositive:P=t.WindCnt;break;case n.PolyFillType.pftNegative:P=-t.WindCnt;break;default:P=Math.abs(t.WindCnt);break}switch(u){case n.PolyFillType.pftPositive:a=i.WindCnt;break;case n.PolyFillType.pftNegative:a=-i.WindCnt;break;default:a=Math.abs(i.WindCnt);break}if(r&&s)P!==0&&P!==1||a!==0&&a!==1||t.PolyTyp!==i.PolyTyp&&this.m_ClipType!==n.ClipType.ctXor?this.AddLocalMaxPoly(t,i,e):(this.AddOutPt(t,e),this.AddOutPt(i,e),n.Clipper.SwapSides(t,i),n.Clipper.SwapPolyIndexes(t,i));else if(r)(a===0||a===1)&&(this.AddOutPt(t,e),n.Clipper.SwapSides(t,i),n.Clipper.SwapPolyIndexes(t,i));else if(s)(P===0||P===1)&&(this.AddOutPt(i,e),n.Clipper.SwapSides(t,i),n.Clipper.SwapPolyIndexes(t,i));else if((P===0||P===1)&&(a===0||a===1)){var m,y;switch(f){case n.PolyFillType.pftPositive:m=t.WindCnt2;break;case n.PolyFillType.pftNegative:m=-t.WindCnt2;break;default:m=Math.abs(t.WindCnt2);break}switch(h){case n.PolyFillType.pftPositive:y=i.WindCnt2;break;case n.PolyFillType.pftNegative:y=-i.WindCnt2;break;default:y=Math.abs(i.WindCnt2);break}if(t.PolyTyp!==i.PolyTyp)this.AddLocalMinPoly(t,i,e);else if(P===1&&a===1)switch(this.m_ClipType){case n.ClipType.ctIntersection:m>0&&y>0&&this.AddLocalMinPoly(t,i,e);break;case n.ClipType.ctUnion:m<=0&&y<=0&&this.AddLocalMinPoly(t,i,e);break;case n.ClipType.ctDifference:(t.PolyTyp===n.PolyType.ptClip&&m>0&&y>0||t.PolyTyp===n.PolyType.ptSubject&&m<=0&&y<=0)&&this.AddLocalMinPoly(t,i,e);break;case n.ClipType.ctXor:this.AddLocalMinPoly(t,i,e);break}else n.Clipper.SwapSides(t,i)}},n.Clipper.prototype.DeleteFromSEL=function(t){var i=t.PrevInSEL,e=t.NextInSEL;i===null&&e===null&&t!==this.m_SortedEdges||(i!==null?i.NextInSEL=e:this.m_SortedEdges=e,e!==null&&(e.PrevInSEL=i),t.NextInSEL=null,t.PrevInSEL=null)},n.Clipper.prototype.ProcessHorizontals=function(){for(var t={};this.PopEdgeFromSEL(t);)this.ProcessHorizontal(t.v)},n.Clipper.prototype.GetHorzDirection=function(t,i){t.Bot.X<t.Top.X?(i.Left=t.Bot.X,i.Right=t.Top.X,i.Dir=n.Direction.dLeftToRight):(i.Left=t.Top.X,i.Right=t.Bot.X,i.Dir=n.Direction.dRightToLeft)},n.Clipper.prototype.ProcessHorizontal=function(t){var i={Dir:null,Left:null,Right:null};this.GetHorzDirection(t,i);for(var e=i.Dir,r=i.Left,s=i.Right,l=t.WindDelta===0,o=t,u=null;o.NextInLML!==null&&n.ClipperBase.IsHorizontal(o.NextInLML);)o=o.NextInLML;o.NextInLML===null&&(u=this.GetMaximaPair(o));var f=this.m_Maxima;if(f!==null)if(e===n.Direction.dLeftToRight){for(;f!==null&&f.X<=t.Bot.X;)f=f.Next;f!==null&&f.X>=o.Top.X&&(f=null)}else{for(;f.Next!==null&&f.Next.X<t.Bot.X;)f=f.Next;f.X<=o.Top.X&&(f=null)}for(var h=null;;){for(var P=t===o,a=this.GetNextInAEL(t,e);a!==null;){if(f!==null)if(e===n.Direction.dLeftToRight)for(;f!==null&&f.X<a.Curr.X;)t.OutIdx>=0&&!l&&this.AddOutPt(t,new n.IntPoint2(f.X,t.Bot.Y)),f=f.Next;else for(;f!==null&&f.X>a.Curr.X;)t.OutIdx>=0&&!l&&this.AddOutPt(t,new n.IntPoint2(f.X,t.Bot.Y)),f=f.Prev;if(e===n.Direction.dLeftToRight&&a.Curr.X>s||e===n.Direction.dRightToLeft&&a.Curr.X<r||a.Curr.X===t.Top.X&&t.NextInLML!==null&&a.Dx<t.NextInLML.Dx)break;if(t.OutIdx>=0&&!l){n.use_xyz&&(e===n.Direction.dLeftToRight?this.SetZ(a.Curr,t,a):this.SetZ(a.Curr,a,t)),h=this.AddOutPt(t,a.Curr);for(var m=this.m_SortedEdges;m!==null;){if(m.OutIdx>=0&&this.HorzSegmentsOverlap(t.Bot.X,t.Top.X,m.Bot.X,m.Top.X)){var y=this.GetLastOutPt(m);this.AddJoin(y,h,m.Top)}m=m.NextInSEL}this.AddGhostJoin(h,t.Bot)}if(a===u&&P){t.OutIdx>=0&&this.AddLocalMaxPoly(t,u,t.Top),this.DeleteFromAEL(t),this.DeleteFromAEL(u);return}if(e===n.Direction.dLeftToRight){var C=new n.IntPoint2(a.Curr.X,t.Curr.Y);this.IntersectEdges(t,a,C)}else{var C=new n.IntPoint2(a.Curr.X,t.Curr.Y);this.IntersectEdges(a,t,C)}var c=this.GetNextInAEL(a,e);this.SwapPositionsInAEL(t,a),a=c}if(t.NextInLML===null||!n.ClipperBase.IsHorizontal(t.NextInLML))break;t=this.UpdateEdgeIntoAEL(t),t.OutIdx>=0&&this.AddOutPt(t,t.Bot),i={Dir:e,Left:r,Right:s},this.GetHorzDirection(t,i),e=i.Dir,r=i.Left,s=i.Right}if(t.OutIdx>=0&&h===null){h=this.GetLastOutPt(t);for(var m=this.m_SortedEdges;m!==null;){if(m.OutIdx>=0&&this.HorzSegmentsOverlap(t.Bot.X,t.Top.X,m.Bot.X,m.Top.X)){var y=this.GetLastOutPt(m);this.AddJoin(y,h,m.Top)}m=m.NextInSEL}this.AddGhostJoin(h,t.Top)}if(t.NextInLML!==null)if(t.OutIdx>=0){if(h=this.AddOutPt(t,t.Top),t=this.UpdateEdgeIntoAEL(t),t.WindDelta===0)return;var _=t.PrevInAEL,c=t.NextInAEL;if(_!==null&&_.Curr.X===t.Bot.X&&_.Curr.Y===t.Bot.Y&&_.WindDelta===0&&_.OutIdx>=0&&_.Curr.Y>_.Top.Y&&n.ClipperBase.SlopesEqual3(t,_,this.m_UseFullRange)){var y=this.AddOutPt(_,t.Bot);this.AddJoin(h,y,t.Top)}else if(c!==null&&c.Curr.X===t.Bot.X&&c.Curr.Y===t.Bot.Y&&c.WindDelta!==0&&c.OutIdx>=0&&c.Curr.Y>c.Top.Y&&n.ClipperBase.SlopesEqual3(t,c,this.m_UseFullRange)){var y=this.AddOutPt(c,t.Bot);this.AddJoin(h,y,t.Top)}}else t=this.UpdateEdgeIntoAEL(t);else t.OutIdx>=0&&this.AddOutPt(t,t.Top),this.DeleteFromAEL(t)},n.Clipper.prototype.GetNextInAEL=function(t,i){return i===n.Direction.dLeftToRight?t.NextInAEL:t.PrevInAEL},n.Clipper.prototype.IsMinima=function(t){return t!==null&&t.Prev.NextInLML!==t&&t.Next.NextInLML!==t},n.Clipper.prototype.IsMaxima=function(t,i){return t!==null&&t.Top.Y===i&&t.NextInLML===null},n.Clipper.prototype.IsIntermediate=function(t,i){return t.Top.Y===i&&t.NextInLML!==null},n.Clipper.prototype.GetMaximaPair=function(t){return n.IntPoint.op_Equality(t.Next.Top,t.Top)&&t.Next.NextInLML===null?t.Next:n.IntPoint.op_Equality(t.Prev.Top,t.Top)&&t.Prev.NextInLML===null?t.Prev:null},n.Clipper.prototype.GetMaximaPairEx=function(t){var i=this.GetMaximaPair(t);return i===null||i.OutIdx===n.ClipperBase.Skip||i.NextInAEL===i.PrevInAEL&&!n.ClipperBase.IsHorizontal(i)?null:i},n.Clipper.prototype.ProcessIntersections=function(t){if(this.m_ActiveEdges===null)return!0;try{if(this.BuildIntersectList(t),this.m_IntersectList.length===0)return!0;if(this.m_IntersectList.length===1||this.FixupIntersectionOrder())this.ProcessIntersectList();else return!1}catch{this.m_SortedEdges=null,this.m_IntersectList.length=0,n.Error("ProcessIntersections error")}return this.m_SortedEdges=null,!0},n.Clipper.prototype.BuildIntersectList=function(t){if(this.m_ActiveEdges!==null){var i=this.m_ActiveEdges;for(this.m_SortedEdges=i;i!==null;)i.PrevInSEL=i.PrevInAEL,i.NextInSEL=i.NextInAEL,i.Curr.X=n.Clipper.TopX(i,t),i=i.NextInAEL;for(var e=!0;e&&this.m_SortedEdges!==null;){for(e=!1,i=this.m_SortedEdges;i.NextInSEL!==null;){var r=i.NextInSEL,s=new n.IntPoint0;if(i.Curr.X>r.Curr.X){this.IntersectPoint(i,r,s),s.Y<t&&(s=new n.IntPoint2(n.Clipper.TopX(i,t),t));var l=new n.IntersectNode;l.Edge1=i,l.Edge2=r,l.Pt.X=s.X,l.Pt.Y=s.Y,n.use_xyz&&(l.Pt.Z=s.Z),this.m_IntersectList.push(l),this.SwapPositionsInSEL(i,r),e=!0}else i=r}if(i.PrevInSEL!==null)i.PrevInSEL.NextInSEL=null;else break}this.m_SortedEdges=null}},n.Clipper.prototype.EdgesAdjacent=function(t){return t.Edge1.NextInSEL===t.Edge2||t.Edge1.PrevInSEL===t.Edge2},n.Clipper.IntersectNodeSort=function(t,i){return i.Pt.Y-t.Pt.Y},n.Clipper.prototype.FixupIntersectionOrder=function(){this.m_IntersectList.sort(this.m_IntersectNodeComparer),this.CopyAELToSEL();for(var t=this.m_IntersectList.length,i=0;i<t;i++){if(!this.EdgesAdjacent(this.m_IntersectList[i])){for(var e=i+1;e<t&&!this.EdgesAdjacent(this.m_IntersectList[e]);)e++;if(e===t)return!1;var r=this.m_IntersectList[i];this.m_IntersectList[i]=this.m_IntersectList[e],this.m_IntersectList[e]=r}this.SwapPositionsInSEL(this.m_IntersectList[i].Edge1,this.m_IntersectList[i].Edge2)}return!0},n.Clipper.prototype.ProcessIntersectList=function(){for(var t=0,i=this.m_IntersectList.length;t<i;t++){var e=this.m_IntersectList[t];this.IntersectEdges(e.Edge1,e.Edge2,e.Pt),this.SwapPositionsInAEL(e.Edge1,e.Edge2)}this.m_IntersectList.length=0};var gi=function(t){return t<0?Math.ceil(t-.5):Math.round(t)},Wi=function(t){return t<0?Math.ceil(t-.5):Math.floor(t+.5)},Ri=function(t){return t<0?-Math.round(Math.abs(t)):Math.round(t)},Zi=function(t){return t<0?(t-=.5,t<-2147483648?Math.ceil(t):t|0):(t+=.5,t>2147483647?Math.floor(t):t|0)};d.msie?n.Clipper.Round=gi:d.chromium?n.Clipper.Round=Ri:d.safari?n.Clipper.Round=Zi:n.Clipper.Round=Wi,n.Clipper.TopX=function(t,i){return i===t.Top.Y?t.Top.X:t.Bot.X+n.Clipper.Round(t.Dx*(i-t.Bot.Y))},n.Clipper.prototype.IntersectPoint=function(t,i,e){e.X=0,e.Y=0;var r,s;if(t.Dx===i.Dx){e.Y=t.Curr.Y,e.X=n.Clipper.TopX(t,e.Y);return}if(t.Delta.X===0)e.X=t.Bot.X,n.ClipperBase.IsHorizontal(i)?e.Y=i.Bot.Y:(s=i.Bot.Y-i.Bot.X/i.Dx,e.Y=n.Clipper.Round(e.X/i.Dx+s));else if(i.Delta.X===0)e.X=i.Bot.X,n.ClipperBase.IsHorizontal(t)?e.Y=t.Bot.Y:(r=t.Bot.Y-t.Bot.X/t.Dx,e.Y=n.Clipper.Round(e.X/t.Dx+r));else{r=t.Bot.X-t.Bot.Y*t.Dx,s=i.Bot.X-i.Bot.Y*i.Dx;var l=(s-r)/(t.Dx-i.Dx);e.Y=n.Clipper.Round(l),Math.abs(t.Dx)<Math.abs(i.Dx)?e.X=n.Clipper.Round(t.Dx*l+r):e.X=n.Clipper.Round(i.Dx*l+s)}if(e.Y<t.Top.Y||e.Y<i.Top.Y){if(t.Top.Y>i.Top.Y)return e.Y=t.Top.Y,e.X=n.Clipper.TopX(i,t.Top.Y),e.X<t.Top.X;e.Y=i.Top.Y,Math.abs(t.Dx)<Math.abs(i.Dx)?e.X=n.Clipper.TopX(t,e.Y):e.X=n.Clipper.TopX(i,e.Y)}e.Y>t.Curr.Y&&(e.Y=t.Curr.Y,Math.abs(t.Dx)>Math.abs(i.Dx)?e.X=n.Clipper.TopX(i,e.Y):e.X=n.Clipper.TopX(t,e.Y))},n.Clipper.prototype.ProcessEdgesAtTopOfScanbeam=function(t){for(var i=this.m_ActiveEdges;i!==null;){var e=this.IsMaxima(i,t);if(e){var r=this.GetMaximaPairEx(i);e=r===null||!n.ClipperBase.IsHorizontal(r)}if(e){this.StrictlySimple&&this.InsertMaxima(i.Top.X);var s=i.PrevInAEL;this.DoMaxima(i),s===null?i=this.m_ActiveEdges:i=s.NextInAEL}else{if(this.IsIntermediate(i,t)&&n.ClipperBase.IsHorizontal(i.NextInLML)?(i=this.UpdateEdgeIntoAEL(i),i.OutIdx>=0&&this.AddOutPt(i,i.Bot),this.AddEdgeToSEL(i)):(i.Curr.X=n.Clipper.TopX(i,t),i.Curr.Y=t),n.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){var s=i.PrevInAEL;if(i.OutIdx>=0&&i.WindDelta!==0&&s!==null&&s.OutIdx>=0&&s.Curr.X===i.Curr.X&&s.WindDelta!==0){var l=new n.IntPoint1(i.Curr);n.use_xyz&&this.SetZ(l,s,i);var o=this.AddOutPt(s,l),u=this.AddOutPt(i,l);this.AddJoin(o,u,l)}}i=i.NextInAEL}}for(this.ProcessHorizontals(),this.m_Maxima=null,i=this.m_ActiveEdges;i!==null;){if(this.IsIntermediate(i,t)){var o=null;i.OutIdx>=0&&(o=this.AddOutPt(i,i.Top)),i=this.UpdateEdgeIntoAEL(i);var s=i.PrevInAEL,f=i.NextInAEL;if(s!==null&&s.Curr.X===i.Bot.X&&s.Curr.Y===i.Bot.Y&&o!==null&&s.OutIdx>=0&&s.Curr.Y===s.Top.Y&&n.ClipperBase.SlopesEqual5(i.Curr,i.Top,s.Curr,s.Top,this.m_UseFullRange)&&i.WindDelta!==0&&s.WindDelta!==0){var u=this.AddOutPt(ePrev2,i.Bot);this.AddJoin(o,u,i.Top)}else if(f!==null&&f.Curr.X===i.Bot.X&&f.Curr.Y===i.Bot.Y&&o!==null&&f.OutIdx>=0&&f.Curr.Y===f.Top.Y&&n.ClipperBase.SlopesEqual5(i.Curr,i.Top,f.Curr,f.Top,this.m_UseFullRange)&&i.WindDelta!==0&&f.WindDelta!==0){var u=this.AddOutPt(f,i.Bot);this.AddJoin(o,u,i.Top)}}i=i.NextInAEL}},n.Clipper.prototype.DoMaxima=function(t){var i=this.GetMaximaPairEx(t);if(i===null){t.OutIdx>=0&&this.AddOutPt(t,t.Top),this.DeleteFromAEL(t);return}for(var e=t.NextInAEL;e!==null&&e!==i;)this.IntersectEdges(t,e,t.Top),this.SwapPositionsInAEL(t,e),e=t.NextInAEL;t.OutIdx===-1&&i.OutIdx===-1?(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)):n.use_lines&&t.WindDelta===0?(t.OutIdx>=0&&(this.AddOutPt(t,t.Top),t.OutIdx=n.ClipperBase.Unassigned),this.DeleteFromAEL(t),i.OutIdx>=0&&(this.AddOutPt(i,t.Top),i.OutIdx=n.ClipperBase.Unassigned),this.DeleteFromAEL(i)):n.Error("DoMaxima error")},n.Clipper.ReversePaths=function(t){for(var i=0,e=t.length;i<e;i++)t[i].reverse()},n.Clipper.Orientation=function(t){return n.Clipper.Area(t)>=0},n.Clipper.prototype.PointCount=function(t){if(t===null)return 0;var i=0,e=t;do i++,e=e.Next;while(e!==t);return i},n.Clipper.prototype.BuildResult=function(t){n.Clear(t);for(var i=0,e=this.m_PolyOuts.length;i<e;i++){var r=this.m_PolyOuts[i];if(r.Pts!==null){var s=r.Pts.Prev,l=this.PointCount(s);if(!(l<2)){for(var o=new Array(l),u=0;u<l;u++)o[u]=s.Pt,s=s.Prev;t.push(o)}}}},n.Clipper.prototype.BuildResult2=function(t){t.Clear();for(var i=0,e=this.m_PolyOuts.length;i<e;i++){var r=this.m_PolyOuts[i],s=this.PointCount(r.Pts);if(!(r.IsOpen&&s<2||!r.IsOpen&&s<3)){this.FixHoleLinkage(r);var l=new n.PolyNode;t.m_AllPolys.push(l),r.PolyNode=l,l.m_polygon.length=s;for(var o=r.Pts.Prev,u=0;u<s;u++)l.m_polygon[u]=o.Pt,o=o.Prev}}for(var i=0,e=this.m_PolyOuts.length;i<e;i++){var r=this.m_PolyOuts[i];r.PolyNode!==null&&(r.IsOpen?(r.PolyNode.IsOpen=!0,t.AddChild(r.PolyNode)):r.FirstLeft!==null&&r.FirstLeft.PolyNode!==null?r.FirstLeft.PolyNode.AddChild(r.PolyNode):t.AddChild(r.PolyNode))}},n.Clipper.prototype.FixupOutPolyline=function(t){for(var i=t.Pts,e=i.Prev;i!==e;)if(i=i.Next,n.IntPoint.op_Equality(i.Pt,i.Prev.Pt)){i===e&&(e=i.Prev);var r=i.Prev;r.Next=i.Next,i.Next.Prev=r,i=r}i===i.Prev&&(t.Pts=null)},n.Clipper.prototype.FixupOutPolygon=function(t){var i=null;t.BottomPt=null;for(var e=t.Pts,r=this.PreserveCollinear||this.StrictlySimple;;){if(e.Prev===e||e.Prev===e.Next){t.Pts=null;return}if(n.IntPoint.op_Equality(e.Pt,e.Next.Pt)||n.IntPoint.op_Equality(e.Pt,e.Prev.Pt)||n.ClipperBase.SlopesEqual4(e.Prev.Pt,e.Pt,e.Next.Pt,this.m_UseFullRange)&&(!r||!this.Pt2IsBetweenPt1AndPt3(e.Prev.Pt,e.Pt,e.Next.Pt)))i=null,e.Prev.Next=e.Next,e.Next.Prev=e.Prev,e=e.Prev;else{if(e===i)break;i===null&&(i=e),e=e.Next}}t.Pts=e},n.Clipper.prototype.DupOutPt=function(t,i){var e=new n.OutPt;return e.Pt.X=t.Pt.X,e.Pt.Y=t.Pt.Y,n.use_xyz&&(e.Pt.Z=t.Pt.Z),e.Idx=t.Idx,i?(e.Next=t.Next,e.Prev=t,t.Next.Prev=e,t.Next=e):(e.Prev=t.Prev,e.Next=t,t.Prev.Next=e,t.Prev=e),e},n.Clipper.prototype.GetOverlap=function(t,i,e,r,s){return t<i?e<r?(s.Left=Math.max(t,e),s.Right=Math.min(i,r)):(s.Left=Math.max(t,r),s.Right=Math.min(i,e)):e<r?(s.Left=Math.max(i,e),s.Right=Math.min(t,r)):(s.Left=Math.max(i,r),s.Right=Math.min(t,e)),s.Left<s.Right},n.Clipper.prototype.JoinHorz=function(t,i,e,r,s,l){var o=t.Pt.X>i.Pt.X?n.Direction.dRightToLeft:n.Direction.dLeftToRight,u=e.Pt.X>r.Pt.X?n.Direction.dRightToLeft:n.Direction.dLeftToRight;if(o===u)return!1;if(o===n.Direction.dLeftToRight){for(;t.Next.Pt.X<=s.X&&t.Next.Pt.X>=t.Pt.X&&t.Next.Pt.Y===s.Y;)t=t.Next;l&&t.Pt.X!==s.X&&(t=t.Next),i=this.DupOutPt(t,!l),n.IntPoint.op_Inequality(i.Pt,s)&&(t=i,t.Pt.X=s.X,t.Pt.Y=s.Y,n.use_xyz&&(t.Pt.Z=s.Z),i=this.DupOutPt(t,!l))}else{for(;t.Next.Pt.X>=s.X&&t.Next.Pt.X<=t.Pt.X&&t.Next.Pt.Y===s.Y;)t=t.Next;!l&&t.Pt.X!==s.X&&(t=t.Next),i=this.DupOutPt(t,l),n.IntPoint.op_Inequality(i.Pt,s)&&(t=i,t.Pt.X=s.X,t.Pt.Y=s.Y,n.use_xyz&&(t.Pt.Z=s.Z),i=this.DupOutPt(t,l))}if(u===n.Direction.dLeftToRight){for(;e.Next.Pt.X<=s.X&&e.Next.Pt.X>=e.Pt.X&&e.Next.Pt.Y===s.Y;)e=e.Next;l&&e.Pt.X!==s.X&&(e=e.Next),r=this.DupOutPt(e,!l),n.IntPoint.op_Inequality(r.Pt,s)&&(e=r,e.Pt.X=s.X,e.Pt.Y=s.Y,n.use_xyz&&(e.Pt.Z=s.Z),r=this.DupOutPt(e,!l))}else{for(;e.Next.Pt.X>=s.X&&e.Next.Pt.X<=e.Pt.X&&e.Next.Pt.Y===s.Y;)e=e.Next;!l&&e.Pt.X!==s.X&&(e=e.Next),r=this.DupOutPt(e,l),n.IntPoint.op_Inequality(r.Pt,s)&&(e=r,e.Pt.X=s.X,e.Pt.Y=s.Y,n.use_xyz&&(e.Pt.Z=s.Z),r=this.DupOutPt(e,l))}return o===n.Direction.dLeftToRight===l?(t.Prev=e,e.Next=t,i.Next=r,r.Prev=i):(t.Next=e,e.Prev=t,i.Prev=r,r.Next=i),!0},n.Clipper.prototype.JoinPoints=function(t,i,e){var r=t.OutPt1,s=new n.OutPt,l=t.OutPt2,o=new n.OutPt,u=t.OutPt1.Pt.Y===t.OffPt.Y;if(u&&n.IntPoint.op_Equality(t.OffPt,t.OutPt1.Pt)&&n.IntPoint.op_Equality(t.OffPt,t.OutPt2.Pt)){if(i!==e)return!1;for(s=t.OutPt1.Next;s!==r&&n.IntPoint.op_Equality(s.Pt,t.OffPt);)s=s.Next;var f=s.Pt.Y>t.OffPt.Y;for(o=t.OutPt2.Next;o!==l&&n.IntPoint.op_Equality(o.Pt,t.OffPt);)o=o.Next;var h=o.Pt.Y>t.OffPt.Y;return f===h?!1:f?(s=this.DupOutPt(r,!1),o=this.DupOutPt(l,!0),r.Prev=l,l.Next=r,s.Next=o,o.Prev=s,t.OutPt1=r,t.OutPt2=s,!0):(s=this.DupOutPt(r,!0),o=this.DupOutPt(l,!1),r.Next=l,l.Prev=r,s.Prev=o,o.Next=s,t.OutPt1=r,t.OutPt2=s,!0)}else if(u){for(s=r;r.Prev.Pt.Y===r.Pt.Y&&r.Prev!==s&&r.Prev!==l;)r=r.Prev;for(;s.Next.Pt.Y===s.Pt.Y&&s.Next!==r&&s.Next!==l;)s=s.Next;if(s.Next===r||s.Next===l)return!1;for(o=l;l.Prev.Pt.Y===l.Pt.Y&&l.Prev!==o&&l.Prev!==s;)l=l.Prev;for(;o.Next.Pt.Y===o.Pt.Y&&o.Next!==l&&o.Next!==r;)o=o.Next;if(o.Next===l||o.Next===r)return!1;var P={Left:null,Right:null};if(!this.GetOverlap(r.Pt.X,s.Pt.X,l.Pt.X,o.Pt.X,P))return!1;var a=P.Left,m=P.Right,y=new n.IntPoint0,C;return r.Pt.X>=a&&r.Pt.X<=m?(y.X=r.Pt.X,y.Y=r.Pt.Y,n.use_xyz&&(y.Z=r.Pt.Z),C=r.Pt.X>s.Pt.X):l.Pt.X>=a&&l.Pt.X<=m?(y.X=l.Pt.X,y.Y=l.Pt.Y,n.use_xyz&&(y.Z=l.Pt.Z),C=l.Pt.X>o.Pt.X):s.Pt.X>=a&&s.Pt.X<=m?(y.X=s.Pt.X,y.Y=s.Pt.Y,n.use_xyz&&(y.Z=s.Pt.Z),C=s.Pt.X>r.Pt.X):(y.X=o.Pt.X,y.Y=o.Pt.Y,n.use_xyz&&(y.Z=o.Pt.Z),C=o.Pt.X>l.Pt.X),t.OutPt1=r,t.OutPt2=l,this.JoinHorz(r,s,l,o,y,C)}else{for(s=r.Next;n.IntPoint.op_Equality(s.Pt,r.Pt)&&s!==r;)s=s.Next;var c=s.Pt.Y>r.Pt.Y||!n.ClipperBase.SlopesEqual4(r.Pt,s.Pt,t.OffPt,this.m_UseFullRange);if(c){for(s=r.Prev;n.IntPoint.op_Equality(s.Pt,r.Pt)&&s!==r;)s=s.Prev;if(s.Pt.Y>r.Pt.Y||!n.ClipperBase.SlopesEqual4(r.Pt,s.Pt,t.OffPt,this.m_UseFullRange))return!1}for(o=l.Next;n.IntPoint.op_Equality(o.Pt,l.Pt)&&o!==l;)o=o.Next;var _=o.Pt.Y>l.Pt.Y||!n.ClipperBase.SlopesEqual4(l.Pt,o.Pt,t.OffPt,this.m_UseFullRange);if(_){for(o=l.Prev;n.IntPoint.op_Equality(o.Pt,l.Pt)&&o!==l;)o=o.Prev;if(o.Pt.Y>l.Pt.Y||!n.ClipperBase.SlopesEqual4(l.Pt,o.Pt,t.OffPt,this.m_UseFullRange))return!1}return s===r||o===l||s===o||i===e&&c===_?!1:c?(s=this.DupOutPt(r,!1),o=this.DupOutPt(l,!0),r.Prev=l,l.Next=r,s.Next=o,o.Prev=s,t.OutPt1=r,t.OutPt2=s,!0):(s=this.DupOutPt(r,!0),o=this.DupOutPt(l,!1),r.Next=l,l.Prev=r,s.Prev=o,o.Next=s,t.OutPt1=r,t.OutPt2=s,!0)}},n.Clipper.GetBounds=function(t){for(var i=0,e=t.length;i<e&&t[i].length===0;)i++;if(i===e)return new n.IntRect(0,0,0,0);var r=new n.IntRect;for(r.left=t[i][0].X,r.right=r.left,r.top=t[i][0].Y,r.bottom=r.top;i<e;i++)for(var s=0,l=t[i].length;s<l;s++)t[i][s].X<r.left?r.left=t[i][s].X:t[i][s].X>r.right&&(r.right=t[i][s].X),t[i][s].Y<r.top?r.top=t[i][s].Y:t[i][s].Y>r.bottom&&(r.bottom=t[i][s].Y);return r},n.Clipper.prototype.GetBounds2=function(t){var i=t,e=new n.IntRect;for(e.left=t.Pt.X,e.right=t.Pt.X,e.top=t.Pt.Y,e.bottom=t.Pt.Y,t=t.Next;t!==i;)t.Pt.X<e.left&&(e.left=t.Pt.X),t.Pt.X>e.right&&(e.right=t.Pt.X),t.Pt.Y<e.top&&(e.top=t.Pt.Y),t.Pt.Y>e.bottom&&(e.bottom=t.Pt.Y),t=t.Next;return e},n.Clipper.PointInPolygon=function(t,i){var e=0,r=i.length;if(r<3)return 0;for(var s=i[0],l=1;l<=r;++l){var o=l===r?i[0]:i[l];if(o.Y===t.Y&&(o.X===t.X||s.Y===t.Y&&o.X>t.X==s.X<t.X))return-1;if(s.Y<t.Y!=o.Y<t.Y){if(s.X>=t.X)if(o.X>t.X)e=1-e;else{var u=(s.X-t.X)*(o.Y-t.Y)-(o.X-t.X)*(s.Y-t.Y);if(u===0)return-1;u>0==o.Y>s.Y&&(e=1-e)}else if(o.X>t.X){var u=(s.X-t.X)*(o.Y-t.Y)-(o.X-t.X)*(s.Y-t.Y);if(u===0)return-1;u>0==o.Y>s.Y&&(e=1-e)}}s=o}return e},n.Clipper.prototype.PointInPolygon=function(t,i){var e=0,r=i,s=t.X,l=t.Y,o=i.Pt.X,u=i.Pt.Y;do{i=i.Next;var f=i.Pt.X,h=i.Pt.Y;if(h===l&&(f===s||u===l&&f>s==o<s))return-1;if(u<l!=h<l){if(o>=s)if(f>s)e=1-e;else{var P=(o-s)*(h-l)-(f-s)*(u-l);if(P===0)return-1;P>0==h>u&&(e=1-e)}else if(f>s){var P=(o-s)*(h-l)-(f-s)*(u-l);if(P===0)return-1;P>0==h>u&&(e=1-e)}}o=f,u=h}while(r!==i);return e},n.Clipper.prototype.Poly2ContainsPoly1=function(t,i){var e=t;do{var r=this.PointInPolygon(e.Pt,i);if(r>=0)return r>0;e=e.Next}while(e!==t);return!0},n.Clipper.prototype.FixupFirstLefts1=function(t,i){for(var e,r,s=0,l=this.m_PolyOuts.length;s<l;s++)e=this.m_PolyOuts[s],r=n.Clipper.ParseFirstLeft(e.FirstLeft),e.Pts!==null&&r===t&&this.Poly2ContainsPoly1(e.Pts,i.Pts)&&(e.FirstLeft=i)},n.Clipper.prototype.FixupFirstLefts2=function(t,i){for(var e=i.FirstLeft,r,s,l=0,o=this.m_PolyOuts.length;l<o;l++)r=this.m_PolyOuts[l],!(r.Pts===null||r===i||r===t)&&(s=n.Clipper.ParseFirstLeft(r.FirstLeft),!(s!==e&&s!==t&&s!==i)&&(this.Poly2ContainsPoly1(r.Pts,t.Pts)?r.FirstLeft=t:this.Poly2ContainsPoly1(r.Pts,i.Pts)?r.FirstLeft=i:(r.FirstLeft===t||r.FirstLeft===i)&&(r.FirstLeft=e)))},n.Clipper.prototype.FixupFirstLefts3=function(t,i){for(var e,r,s=0,l=this.m_PolyOuts.length;s<l;s++)e=this.m_PolyOuts[s],r=n.Clipper.ParseFirstLeft(e.FirstLeft),e.Pts!==null&&r===t&&(e.FirstLeft=i)},n.Clipper.ParseFirstLeft=function(t){for(;t!==null&&t.Pts===null;)t=t.FirstLeft;return t},n.Clipper.prototype.JoinCommonEdges=function(){for(var t=0,i=this.m_Joins.length;t<i;t++){var e=this.m_Joins[t],r=this.GetOutRec(e.OutPt1.Idx),s=this.GetOutRec(e.OutPt2.Idx);if(!(r.Pts===null||s.Pts===null)&&!(r.IsOpen||s.IsOpen)){var l;r===s?l=r:this.OutRec1RightOfOutRec2(r,s)?l=s:this.OutRec1RightOfOutRec2(s,r)?l=r:l=this.GetLowermostRec(r,s),this.JoinPoints(e,r,s)&&(r===s?(r.Pts=e.OutPt1,r.BottomPt=null,s=this.CreateOutRec(),s.Pts=e.OutPt2,this.UpdateOutPtIdxs(s),this.Poly2ContainsPoly1(s.Pts,r.Pts)?(s.IsHole=!r.IsHole,s.FirstLeft=r,this.m_UsingPolyTree&&this.FixupFirstLefts2(s,r),(s.IsHole^this.ReverseSolution)==this.Area$1(s)>0&&this.ReversePolyPtLinks(s.Pts)):this.Poly2ContainsPoly1(r.Pts,s.Pts)?(s.IsHole=r.IsHole,r.IsHole=!s.IsHole,s.FirstLeft=r.FirstLeft,r.FirstLeft=s,this.m_UsingPolyTree&&this.FixupFirstLefts2(r,s),(r.IsHole^this.ReverseSolution)==this.Area$1(r)>0&&this.ReversePolyPtLinks(r.Pts)):(s.IsHole=r.IsHole,s.FirstLeft=r.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(r,s))):(s.Pts=null,s.BottomPt=null,s.Idx=r.Idx,r.IsHole=l.IsHole,l===s&&(r.FirstLeft=s.FirstLeft),s.FirstLeft=r,this.m_UsingPolyTree&&this.FixupFirstLefts3(s,r)))}}},n.Clipper.prototype.UpdateOutPtIdxs=function(t){var i=t.Pts;do i.Idx=t.Idx,i=i.Prev;while(i!==t.Pts)},n.Clipper.prototype.DoSimplePolygons=function(){for(var t=0;t<this.m_PolyOuts.length;){var i=this.m_PolyOuts[t++],e=i.Pts;if(!(e===null||i.IsOpen))do{for(var r=e.Next;r!==i.Pts;){if(n.IntPoint.op_Equality(e.Pt,r.Pt)&&r.Next!==e&&r.Prev!==e){var s=e.Prev,l=r.Prev;e.Prev=l,l.Next=e,r.Prev=s,s.Next=r,i.Pts=e;var o=this.CreateOutRec();o.Pts=r,this.UpdateOutPtIdxs(o),this.Poly2ContainsPoly1(o.Pts,i.Pts)?(o.IsHole=!i.IsHole,o.FirstLeft=i,this.m_UsingPolyTree&&this.FixupFirstLefts2(o,i)):this.Poly2ContainsPoly1(i.Pts,o.Pts)?(o.IsHole=i.IsHole,i.IsHole=!o.IsHole,o.FirstLeft=i.FirstLeft,i.FirstLeft=o,this.m_UsingPolyTree&&this.FixupFirstLefts2(i,o)):(o.IsHole=i.IsHole,o.FirstLeft=i.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(i,o)),r=e}r=r.Next}e=e.Next}while(e!==i.Pts)}},n.Clipper.Area=function(t){if(!Array.isArray(t))return 0;var i=t.length;if(i<3)return 0;for(var e=0,r=0,s=i-1;r<i;++r)e+=(t[s].X+t[r].X)*(t[s].Y-t[r].Y),s=r;return-e*.5},n.Clipper.prototype.Area=function(t){var i=t;if(t===null)return 0;var e=0;do e=e+(t.Prev.Pt.X+t.Pt.X)*(t.Prev.Pt.Y-t.Pt.Y),t=t.Next;while(t!==i);return e*.5},n.Clipper.prototype.Area$1=function(t){return this.Area(t.Pts)},n.Clipper.SimplifyPolygon=function(t,i){var e=new Array,r=new n.Clipper(0);return r.StrictlySimple=!0,r.AddPath(t,n.PolyType.ptSubject,!0),r.Execute(n.ClipType.ctUnion,e,i,i),e},n.Clipper.SimplifyPolygons=function(t,i){typeof i>"u"&&(i=n.PolyFillType.pftEvenOdd);var e=new Array,r=new n.Clipper(0);return r.StrictlySimple=!0,r.AddPaths(t,n.PolyType.ptSubject,!0),r.Execute(n.ClipType.ctUnion,e,i,i),e},n.Clipper.DistanceSqrd=function(t,i){var e=t.X-i.X,r=t.Y-i.Y;return e*e+r*r},n.Clipper.DistanceFromLineSqrd=function(t,i,e){var r=i.Y-e.Y,s=e.X-i.X,l=r*i.X+s*i.Y;return l=r*t.X+s*t.Y-l,l*l/(r*r+s*s)},n.Clipper.SlopesNearCollinear=function(t,i,e,r){return Math.abs(t.X-i.X)>Math.abs(t.Y-i.Y)?t.X>i.X==t.X<e.X?n.Clipper.DistanceFromLineSqrd(t,i,e)<r:i.X>t.X==i.X<e.X?n.Clipper.DistanceFromLineSqrd(i,t,e)<r:n.Clipper.DistanceFromLineSqrd(e,t,i)<r:t.Y>i.Y==t.Y<e.Y?n.Clipper.DistanceFromLineSqrd(t,i,e)<r:i.Y>t.Y==i.Y<e.Y?n.Clipper.DistanceFromLineSqrd(i,t,e)<r:n.Clipper.DistanceFromLineSqrd(e,t,i)<r},n.Clipper.PointsAreClose=function(t,i,e){var r=t.X-i.X,s=t.Y-i.Y;return r*r+s*s<=e},n.Clipper.ExcludeOp=function(t){var i=t.Prev;return i.Next=t.Next,t.Next.Prev=i,i.Idx=0,i},n.Clipper.CleanPolygon=function(t,i){typeof i>"u"&&(i=1.415);var e=t.length;if(e===0)return new Array;for(var r=new Array(e),s=0;s<e;++s)r[s]=new n.OutPt;for(var s=0;s<e;++s)r[s].Pt=t[s],r[s].Next=r[(s+1)%e],r[s].Next.Prev=r[s],r[s].Idx=0;for(var l=i*i,o=r[0];o.Idx===0&&o.Next!==o.Prev;)n.Clipper.PointsAreClose(o.Pt,o.Prev.Pt,l)?(o=n.Clipper.ExcludeOp(o),e--):n.Clipper.PointsAreClose(o.Prev.Pt,o.Next.Pt,l)?(n.Clipper.ExcludeOp(o.Next),o=n.Clipper.ExcludeOp(o),e-=2):n.Clipper.SlopesNearCollinear(o.Prev.Pt,o.Pt,o.Next.Pt,l)?(o=n.Clipper.ExcludeOp(o),e--):(o.Idx=1,o=o.Next);e<3&&(e=0);for(var u=new Array(e),s=0;s<e;++s)u[s]=new n.IntPoint1(o.Pt),o=o.Next;return r=null,u},n.Clipper.CleanPolygons=function(t,i){for(var e=new Array(t.length),r=0,s=t.length;r<s;r++)e[r]=n.Clipper.CleanPolygon(t[r],i);return e},n.Clipper.Minkowski=function(t,i,e,r){var s=r?1:0,l=t.length,o=i.length,u=new Array;if(e)for(var f=0;f<o;f++){for(var h=new Array(l),P=0,a=t.length,m=t[P];P<a;P++,m=t[P])h[P]=new n.IntPoint2(i[f].X+m.X,i[f].Y+m.Y);u.push(h)}else for(var f=0;f<o;f++){for(var h=new Array(l),P=0,a=t.length,m=t[P];P<a;P++,m=t[P])h[P]=new n.IntPoint2(i[f].X-m.X,i[f].Y-m.Y);u.push(h)}for(var y=new Array,f=0;f<o-1+s;f++)for(var P=0;P<l;P++){var C=new Array;C.push(u[f%o][P%l]),C.push(u[(f+1)%o][P%l]),C.push(u[(f+1)%o][(P+1)%l]),C.push(u[f%o][(P+1)%l]),n.Clipper.Orientation(C)||C.reverse(),y.push(C)}return y},n.Clipper.MinkowskiSum=function(t,i,e){if(i[0]instanceof Array){for(var s=i,o=new n.Paths,l=new n.Clipper,u=0;u<s.length;++u){var f=n.Clipper.Minkowski(t,s[u],!0,e);if(l.AddPaths(f,n.PolyType.ptSubject,!0),e){var r=n.Clipper.TranslatePath(s[u],t[0]);l.AddPath(r,n.PolyType.ptClip,!0)}}return l.Execute(n.ClipType.ctUnion,o,n.PolyFillType.pftNonZero,n.PolyFillType.pftNonZero),o}else{var r=i,s=n.Clipper.Minkowski(t,r,!0,e),l=new n.Clipper;return l.AddPaths(s,n.PolyType.ptSubject,!0),l.Execute(n.ClipType.ctUnion,s,n.PolyFillType.pftNonZero,n.PolyFillType.pftNonZero),s}},n.Clipper.TranslatePath=function(t,i){for(var e=new n.Path,r=0;r<t.length;r++)e.push(new n.IntPoint2(t[r].X+i.X,t[r].Y+i.Y));return e},n.Clipper.MinkowskiDiff=function(t,i){var e=n.Clipper.Minkowski(t,i,!1,!0),r=new n.Clipper;return r.AddPaths(e,n.PolyType.ptSubject,!0),r.Execute(n.ClipType.ctUnion,e,n.PolyFillType.pftNonZero,n.PolyFillType.pftNonZero),e},n.Clipper.PolyTreeToPaths=function(t){var i=new Array;return n.Clipper.AddPolyNodeToPaths(t,n.Clipper.NodeType.ntAny,i),i},n.Clipper.AddPolyNodeToPaths=function(t,i,e){var r=!0;switch(i){case n.Clipper.NodeType.ntOpen:return;case n.Clipper.NodeType.ntClosed:r=!t.IsOpen;break}t.m_polygon.length>0&&r&&e.push(t.m_polygon);for(var s=0,l=t.Childs(),o=l.length,u=l[s];s<o;s++,u=l[s])n.Clipper.AddPolyNodeToPaths(u,i,e)},n.Clipper.OpenPathsFromPolyTree=function(t){for(var i=new n.Paths,e=0,r=t.ChildCount();e<r;e++)t.Childs()[e].IsOpen&&i.push(t.Childs()[e].m_polygon);return i},n.Clipper.ClosedPathsFromPolyTree=function(t){var i=new n.Paths;return n.Clipper.AddPolyNodeToPaths(t,n.Clipper.NodeType.ntClosed,i),i},z(n.Clipper,n.ClipperBase),n.Clipper.NodeType={ntAny:0,ntOpen:1,ntClosed:2},n.ClipperOffset=function(t,i){typeof t>"u"&&(t=2),typeof i>"u"&&(i=n.ClipperOffset.def_arc_tolerance),this.m_destPolys=new n.Paths,this.m_srcPoly=new n.Path,this.m_destPoly=new n.Path,this.m_normals=new Array,this.m_delta=0,this.m_sinA=0,this.m_sin=0,this.m_cos=0,this.m_miterLim=0,this.m_StepsPerRad=0,this.m_lowest=new n.IntPoint0,this.m_polyNodes=new n.PolyNode,this.MiterLimit=t,this.ArcTolerance=i,this.m_lowest.X=-1},n.ClipperOffset.two_pi=6.28318530717959,n.ClipperOffset.def_arc_tolerance=.25,n.ClipperOffset.prototype.Clear=function(){n.Clear(this.m_polyNodes.Childs()),this.m_lowest.X=-1},n.ClipperOffset.Round=n.Clipper.Round,n.ClipperOffset.prototype.AddPath=function(t,i,e){var r=t.length-1;if(!(r<0)){var s=new n.PolyNode;if(s.m_jointype=i,s.m_endtype=e,e===n.EndType.etClosedLine||e===n.EndType.etClosedPolygon)for(;r>0&&n.IntPoint.op_Equality(t[0],t[r]);)r--;s.m_polygon.push(t[0]);for(var l=0,o=0,u=1;u<=r;u++)n.IntPoint.op_Inequality(s.m_polygon[l],t[u])&&(l++,s.m_polygon.push(t[u]),(t[u].Y>s.m_polygon[o].Y||t[u].Y===s.m_polygon[o].Y&&t[u].X<s.m_polygon[o].X)&&(o=l));if(!(e===n.EndType.etClosedPolygon&&l<2)&&(this.m_polyNodes.AddChild(s),e===n.EndType.etClosedPolygon))if(this.m_lowest.X<0)this.m_lowest=new n.IntPoint2(this.m_polyNodes.ChildCount()-1,o);else{var f=this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon[this.m_lowest.Y];(s.m_polygon[o].Y>f.Y||s.m_polygon[o].Y===f.Y&&s.m_polygon[o].X<f.X)&&(this.m_lowest=new n.IntPoint2(this.m_polyNodes.ChildCount()-1,o))}}},n.ClipperOffset.prototype.AddPaths=function(t,i,e){for(var r=0,s=t.length;r<s;r++)this.AddPath(t[r],i,e)},n.ClipperOffset.prototype.FixOrientations=function(){if(this.m_lowest.X>=0&&!n.Clipper.Orientation(this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon))for(var t=0;t<this.m_polyNodes.ChildCount();t++){var i=this.m_polyNodes.Childs()[t];(i.m_endtype===n.EndType.etClosedPolygon||i.m_endtype===n.EndType.etClosedLine&&n.Clipper.Orientation(i.m_polygon))&&i.m_polygon.reverse()}else for(var t=0;t<this.m_polyNodes.ChildCount();t++){var i=this.m_polyNodes.Childs()[t];i.m_endtype===n.EndType.etClosedLine&&!n.Clipper.Orientation(i.m_polygon)&&i.m_polygon.reverse()}},n.ClipperOffset.GetUnitNormal=function(t,i){var e=i.X-t.X,r=i.Y-t.Y;if(e===0&&r===0)return new n.DoublePoint2(0,0);var s=1/Math.sqrt(e*e+r*r);return e*=s,r*=s,new n.DoublePoint2(r,-e)},n.ClipperOffset.prototype.DoOffset=function(t){if(this.m_destPolys=new Array,this.m_delta=t,n.ClipperBase.near_zero(t)){for(var i=0;i<this.m_polyNodes.ChildCount();i++){var e=this.m_polyNodes.Childs()[i];e.m_endtype===n.EndType.etClosedPolygon&&this.m_destPolys.push(e.m_polygon)}return}this.MiterLimit>2?this.m_miterLim=2/(this.MiterLimit*this.MiterLimit):this.m_miterLim=.5;var r;this.ArcTolerance<=0?r=n.ClipperOffset.def_arc_tolerance:this.ArcTolerance>Math.abs(t)*n.ClipperOffset.def_arc_tolerance?r=Math.abs(t)*n.ClipperOffset.def_arc_tolerance:r=this.ArcTolerance;var s=3.14159265358979/Math.acos(1-r/Math.abs(t));this.m_sin=Math.sin(n.ClipperOffset.two_pi/s),this.m_cos=Math.cos(n.ClipperOffset.two_pi/s),this.m_StepsPerRad=s/n.ClipperOffset.two_pi,t<0&&(this.m_sin=-this.m_sin);for(var i=0;i<this.m_polyNodes.ChildCount();i++){var e=this.m_polyNodes.Childs()[i];this.m_srcPoly=e.m_polygon;var l=this.m_srcPoly.length;if(!(l===0||t<=0&&(l<3||e.m_endtype!==n.EndType.etClosedPolygon))){if(this.m_destPoly=new Array,l===1){if(e.m_jointype===n.JoinType.jtRound)for(var o=1,u=0,f=1;f<=s;f++){this.m_destPoly.push(new n.IntPoint2(n.ClipperOffset.Round(this.m_srcPoly[0].X+o*t),n.ClipperOffset.Round(this.m_srcPoly[0].Y+u*t)));var h=o;o=o*this.m_cos-this.m_sin*u,u=h*this.m_sin+u*this.m_cos}else for(var o=-1,u=-1,f=0;f<4;++f)this.m_destPoly.push(new n.IntPoint2(n.ClipperOffset.Round(this.m_srcPoly[0].X+o*t),n.ClipperOffset.Round(this.m_srcPoly[0].Y+u*t))),o<0?o=1:u<0?u=1:o=-1;this.m_destPolys.push(this.m_destPoly);continue}this.m_normals.length=0;for(var f=0;f<l-1;f++)this.m_normals.push(n.ClipperOffset.GetUnitNormal(this.m_srcPoly[f],this.m_srcPoly[f+1]));if(e.m_endtype===n.EndType.etClosedLine||e.m_endtype===n.EndType.etClosedPolygon?this.m_normals.push(n.ClipperOffset.GetUnitNormal(this.m_srcPoly[l-1],this.m_srcPoly[0])):this.m_normals.push(new n.DoublePoint1(this.m_normals[l-2])),e.m_endtype===n.EndType.etClosedPolygon){for(var P=l-1,f=0;f<l;f++)P=this.OffsetPoint(f,P,e.m_jointype);this.m_destPolys.push(this.m_destPoly)}else if(e.m_endtype===n.EndType.etClosedLine){for(var P=l-1,f=0;f<l;f++)P=this.OffsetPoint(f,P,e.m_jointype);this.m_destPolys.push(this.m_destPoly),this.m_destPoly=new Array;for(var a=this.m_normals[l-1],f=l-1;f>0;f--)this.m_normals[f]=new n.DoublePoint2(-this.m_normals[f-1].X,-this.m_normals[f-1].Y);this.m_normals[0]=new n.DoublePoint2(-a.X,-a.Y),P=0;for(var f=l-1;f>=0;f--)P=this.OffsetPoint(f,P,e.m_jointype);this.m_destPolys.push(this.m_destPoly)}else{for(var P=0,f=1;f<l-1;++f)P=this.OffsetPoint(f,P,e.m_jointype);var m;if(e.m_endtype===n.EndType.etOpenButt){var f=l-1;m=new n.IntPoint2(n.ClipperOffset.Round(this.m_srcPoly[f].X+this.m_normals[f].X*t),n.ClipperOffset.Round(this.m_srcPoly[f].Y+this.m_normals[f].Y*t)),this.m_destPoly.push(m),m=new n.IntPoint2(n.ClipperOffset.Round(this.m_srcPoly[f].X-this.m_normals[f].X*t),n.ClipperOffset.Round(this.m_srcPoly[f].Y-this.m_normals[f].Y*t)),this.m_destPoly.push(m)}else{var f=l-1;P=l-2,this.m_sinA=0,this.m_normals[f]=new n.DoublePoint2(-this.m_normals[f].X,-this.m_normals[f].Y),e.m_endtype===n.EndType.etOpenSquare?this.DoSquare(f,P):this.DoRound(f,P)}for(var f=l-1;f>0;f--)this.m_normals[f]=new n.DoublePoint2(-this.m_normals[f-1].X,-this.m_normals[f-1].Y);this.m_normals[0]=new n.DoublePoint2(-this.m_normals[1].X,-this.m_normals[1].Y),P=l-1;for(var f=P-1;f>0;--f)P=this.OffsetPoint(f,P,e.m_jointype);e.m_endtype===n.EndType.etOpenButt?(m=new n.IntPoint2(n.ClipperOffset.Round(this.m_srcPoly[0].X-this.m_normals[0].X*t),n.ClipperOffset.Round(this.m_srcPoly[0].Y-this.m_normals[0].Y*t)),this.m_destPoly.push(m),m=new n.IntPoint2(n.ClipperOffset.Round(this.m_srcPoly[0].X+this.m_normals[0].X*t),n.ClipperOffset.Round(this.m_srcPoly[0].Y+this.m_normals[0].Y*t)),this.m_destPoly.push(m)):(P=1,this.m_sinA=0,e.m_endtype===n.EndType.etOpenSquare?this.DoSquare(0,1):this.DoRound(0,1)),this.m_destPolys.push(this.m_destPoly)}}}},n.ClipperOffset.prototype.Execute=function(){var t=arguments,i=t[0]instanceof n.PolyTree;if(i){var e=t[0],r=t[1];e.Clear(),this.FixOrientations(),this.DoOffset(r);var s=new n.Clipper(0);if(s.AddPaths(this.m_destPolys,n.PolyType.ptSubject,!0),r>0)s.Execute(n.ClipType.ctUnion,e,n.PolyFillType.pftPositive,n.PolyFillType.pftPositive);else{var l=n.Clipper.GetBounds(this.m_destPolys),o=new n.Path;if(o.push(new n.IntPoint2(l.left-10,l.bottom+10)),o.push(new n.IntPoint2(l.right+10,l.bottom+10)),o.push(new n.IntPoint2(l.right+10,l.top-10)),o.push(new n.IntPoint2(l.left-10,l.top-10)),s.AddPath(o,n.PolyType.ptSubject,!0),s.ReverseSolution=!0,s.Execute(n.ClipType.ctUnion,e,n.PolyFillType.pftNegative,n.PolyFillType.pftNegative),e.ChildCount()===1&&e.Childs()[0].ChildCount()>0){var u=e.Childs()[0];e.Childs()[0]=u.Childs()[0],e.Childs()[0].m_Parent=e;for(var f=1;f<u.ChildCount();f++)e.AddChild(u.Childs()[f])}else e.Clear()}}else{var e=t[0],r=t[1];n.Clear(e),this.FixOrientations(),this.DoOffset(r);var s=new n.Clipper(0);if(s.AddPaths(this.m_destPolys,n.PolyType.ptSubject,!0),r>0)s.Execute(n.ClipType.ctUnion,e,n.PolyFillType.pftPositive,n.PolyFillType.pftPositive);else{var l=n.Clipper.GetBounds(this.m_destPolys),o=new n.Path;o.push(new n.IntPoint2(l.left-10,l.bottom+10)),o.push(new n.IntPoint2(l.right+10,l.bottom+10)),o.push(new n.IntPoint2(l.right+10,l.top-10)),o.push(new n.IntPoint2(l.left-10,l.top-10)),s.AddPath(o,n.PolyType.ptSubject,!0),s.ReverseSolution=!0,s.Execute(n.ClipType.ctUnion,e,n.PolyFillType.pftNegative,n.PolyFillType.pftNegative),e.length>0&&e.splice(0,1)}}},n.ClipperOffset.prototype.OffsetPoint=function(t,i,e){if(this.m_sinA=this.m_normals[i].X*this.m_normals[t].Y-this.m_normals[t].X*this.m_normals[i].Y,Math.abs(this.m_sinA*this.m_delta)<1){var r=this.m_normals[i].X*this.m_normals[t].X+this.m_normals[t].Y*this.m_normals[i].Y;if(r>0)return this.m_destPoly.push(new n.IntPoint2(n.ClipperOffset.Round(this.m_srcPoly[t].X+this.m_normals[i].X*this.m_delta),n.ClipperOffset.Round(this.m_srcPoly[t].Y+this.m_normals[i].Y*this.m_delta))),i}else this.m_sinA>1?this.m_sinA=1:this.m_sinA<-1&&(this.m_sinA=-1);if(this.m_sinA*this.m_delta<0)this.m_destPoly.push(new n.IntPoint2(n.ClipperOffset.Round(this.m_srcPoly[t].X+this.m_normals[i].X*this.m_delta),n.ClipperOffset.Round(this.m_srcPoly[t].Y+this.m_normals[i].Y*this.m_delta))),this.m_destPoly.push(new n.IntPoint1(this.m_srcPoly[t])),this.m_destPoly.push(new n.IntPoint2(n.ClipperOffset.Round(this.m_srcPoly[t].X+this.m_normals[t].X*this.m_delta),n.ClipperOffset.Round(this.m_srcPoly[t].Y+this.m_normals[t].Y*this.m_delta)));else switch(e){case n.JoinType.jtMiter:{var s=1+(this.m_normals[t].X*this.m_normals[i].X+this.m_normals[t].Y*this.m_normals[i].Y);s>=this.m_miterLim?this.DoMiter(t,i,s):this.DoSquare(t,i);break}case n.JoinType.jtSquare:this.DoSquare(t,i);break;case n.JoinType.jtRound:this.DoRound(t,i);break}return i=t,i},n.ClipperOffset.prototype.DoSquare=function(t,i){var e=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 n.IntPoint2(n.ClipperOffset.Round(this.m_srcPoly[t].X+this.m_delta*(this.m_normals[i].X-this.m_normals[i].Y*e)),n.ClipperOffset.Round(this.m_srcPoly[t].Y+this.m_delta*(this.m_normals[i].Y+this.m_normals[i].X*e)))),this.m_destPoly.push(new n.IntPoint2(n.ClipperOffset.Round(this.m_srcPoly[t].X+this.m_delta*(this.m_normals[t].X+this.m_normals[t].Y*e)),n.ClipperOffset.Round(this.m_srcPoly[t].Y+this.m_delta*(this.m_normals[t].Y-this.m_normals[t].X*e))))},n.ClipperOffset.prototype.DoMiter=function(t,i,e){var r=this.m_delta/e;this.m_destPoly.push(new n.IntPoint2(n.ClipperOffset.Round(this.m_srcPoly[t].X+(this.m_normals[i].X+this.m_normals[t].X)*r),n.ClipperOffset.Round(this.m_srcPoly[t].Y+(this.m_normals[i].Y+this.m_normals[t].Y)*r)))},n.ClipperOffset.prototype.DoRound=function(t,i){for(var e=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(n.Cast_Int32(n.ClipperOffset.Round(this.m_StepsPerRad*Math.abs(e))),1),s=this.m_normals[i].X,l=this.m_normals[i].Y,o,u=0;u<r;++u)this.m_destPoly.push(new n.IntPoint2(n.ClipperOffset.Round(this.m_srcPoly[t].X+s*this.m_delta),n.ClipperOffset.Round(this.m_srcPoly[t].Y+l*this.m_delta))),o=s,s=s*this.m_cos-this.m_sin*l,l=o*this.m_sin+l*this.m_cos;this.m_destPoly.push(new n.IntPoint2(n.ClipperOffset.Round(this.m_srcPoly[t].X+this.m_normals[t].X*this.m_delta),n.ClipperOffset.Round(this.m_srcPoly[t].Y+this.m_normals[t].Y*this.m_delta)))},n.Error=function(t){try{throw new Error(t)}catch(i){alert(i.message)}},n.JS={},n.JS.AreaOfPolygon=function(t,i){return i||(i=1),n.Clipper.Area(t)/(i*i)},n.JS.AreaOfPolygons=function(t,i){i||(i=1);for(var e=0,r=0;r<t.length;r++)e+=n.Clipper.Area(t[r]);return e/(i*i)},n.JS.BoundsOfPath=function(t,i){return n.JS.BoundsOfPaths([t],i)},n.JS.BoundsOfPaths=function(t,i){i||(i=1);var e=n.Clipper.GetBounds(t);return e.left/=i,e.bottom/=i,e.right/=i,e.top/=i,e},n.JS.Clean=function(r,i){if(!(r instanceof Array))return[];var e=r[0]instanceof Array,r=n.JS.Clone(r);if(typeof i!="number"||i===null)return n.Error("Delta is not a number in Clean()."),r;if(r.length===0||r.length===1&&r[0].length===0||i<0)return r;e||(r=[r]);for(var s=r.length,l,o,u,f,h,P,a,m=[],y=0;y<s;y++)if(o=r[y],l=o.length,l!==0){if(l<3){u=o,m.push(u);continue}for(u=o,f=i*i,h=o[0],P=1,a=1;a<l;a++)(o[a].X-h.X)*(o[a].X-h.X)+(o[a].Y-h.Y)*(o[a].Y-h.Y)<=f||(u[P]=o[a],h=o[a],P++);h=o[P-1],(o[0].X-h.X)*(o[0].X-h.X)+(o[0].Y-h.Y)*(o[0].Y-h.Y)<=f&&P--,P<l&&u.splice(P,l-P),u.length&&m.push(u)}return!e&&m.length?m=m[0]:!e&&m.length===0?m=[]:e&&m.length===0&&(m=[[]]),m},n.JS.Clone=function(t){if(!(t instanceof Array))return[];if(t.length===0)return[];if(t.length===1&&t[0].length===0)return[[]];var i=t[0]instanceof Array;i||(t=[t]);var e=t.length,r,s,l,o,u=new Array(e);for(s=0;s<e;s++){for(r=t[s].length,o=new Array(r),l=0;l<r;l++)o[l]={X:t[s][l].X,Y:t[s][l].Y};u[s]=o}return i||(u=u[0]),u},n.JS.Lighten=function(t,i){if(!(t instanceof Array))return[];if(typeof i!="number"||i===null)return n.Error("Tolerance is not a number in Lighten()."),n.JS.Clone(t);if(t.length===0||t.length===1&&t[0].length===0||i<0)return n.JS.Clone(t);var e=t[0]instanceof Array;e||(t=[t]);var r,s,l,o,u,f,h,P,a,m,y,C,c,_,L,Y,M,qi=t.length,Ui=i*i,F=[];for(r=0;r<qi;r++)if(l=t[r],f=l.length,f!==0){for(o=0;o<1e6;o++){for(u=[],f=l.length,l[f-1].X!==l[0].X||l[f-1].Y!==l[0].Y?(C=1,l.push({X:l[0].X,Y:l[0].Y}),f=l.length):C=0,y=[],s=0;s<f-2;s++)h=l[s],a=l[s+1],P=l[s+2],Y=h.X,M=h.Y,c=P.X-Y,_=P.Y-M,(c!==0||_!==0)&&(L=((a.X-Y)*c+(a.Y-M)*_)/(c*c+_*_),L>1?(Y=P.X,M=P.Y):L>0&&(Y+=c*L,M+=_*L)),c=a.X-Y,_=a.Y-M,m=c*c+_*_,m<=Ui&&(y[s+1]=1,s++);for(u.push({X:l[0].X,Y:l[0].Y}),s=1;s<f-1;s++)y[s]||u.push({X:l[s].X,Y:l[s].Y});if(u.push({X:l[f-1].X,Y:l[f-1].Y}),C&&l.pop(),y.length)l=u;else break}f=u.length,u[f-1].X===u[0].X&&u[f-1].Y===u[0].Y&&u.pop(),u.length>2&&F.push(u)}return e||(F=F[0]),typeof F>"u"&&(F=[]),F},n.JS.PerimeterOfPath=function(t,i,e){if(typeof t>"u")return 0;var r=Math.sqrt,s=0,l,o,u=0,f=0,h=0,P=0,a=t.length;if(a<2)return 0;for(i&&(t[a]=t[0],a++);--a;)l=t[a],u=l.X,f=l.Y,o=t[a-1],h=o.X,P=o.Y,s+=r((u-h)*(u-h)+(f-P)*(f-P));return i&&t.pop(),s/e},n.JS.PerimeterOfPaths=function(t,i,e){e||(e=1);for(var r=0,s=0;s<t.length;s++)r+=n.JS.PerimeterOfPath(t[s],i,e);return r},n.JS.ScaleDownPath=function(t,i){var e,r;for(i||(i=1),e=t.length;e--;)r=t[e],r.X=r.X/i,r.Y=r.Y/i},n.JS.ScaleDownPaths=function(t,i){var e,r,s;for(i||(i=1),e=t.length;e--;)for(r=t[e].length;r--;)s=t[e][r],s.X=s.X/i,s.Y=s.Y/i},n.JS.ScaleUpPath=function(t,i){var e,r,s=Math.round;for(i||(i=1),e=t.length;e--;)r=t[e],r.X=s(r.X*i),r.Y=s(r.Y*i)},n.JS.ScaleUpPaths=function(t,i){var e,r,s,l=Math.round;for(i||(i=1),e=t.length;e--;)for(r=t[e].length;r--;)s=t[e][r],s.X=l(s.X*i),s.Y=l(s.Y*i)},n.ExPolygons=function(){return[]},n.ExPolygon=function(){this.outer=null,this.holes=null},n.JS.AddOuterPolyNodeToExPolygons=function(t,i){var e=new n.ExPolygon;e.outer=t.Contour();var r=t.Childs(),s=r.length;e.holes=new Array(s);var l,o,u,f,h,P;for(u=0;u<s;u++)for(l=r[u],e.holes[u]=l.Contour(),f=0,h=l.Childs(),P=h.length;f<P;f++)o=h[f],n.JS.AddOuterPolyNodeToExPolygons(o,i);i.push(e)},n.JS.ExPolygonsToPaths=function(t){var i,e,r,s,l=new n.Paths;for(i=0,r=t.length;i<r;i++)for(l.push(t[i].outer),e=0,s=t[i].holes.length;e<s;e++)l.push(t[i].holes[e]);return l},n.JS.PolyTreeToExPolygons=function(t){var i=new n.ExPolygons,e,r,s,l;for(r=0,s=t.Childs(),l=s.length;r<l;r++)e=s[r],n.JS.AddOuterPolyNodeToExPolygons(e,i);return i}})()})(U)),U.exports}var Q=Ji();const Gi=ki(Q),zi=Hi({__proto__:null,default:Gi},[Q]);export{zi as c};
1
+ import{b6 as ki}from"./index-T9dstNa6.js";function Hi(B,n){for(var w=0;w<n.length;w++){const O=n[w];if(typeof O!="string"&&!Array.isArray(O)){for(const x in O)if(x!=="default"&&!(x in B)){const d=Object.getOwnPropertyDescriptor(O,x);d&&Object.defineProperty(B,x,d.get?d:{enumerable:!0,get:()=>O[x]})}}}return Object.freeze(Object.defineProperty(B,Symbol.toStringTag,{value:"Module"}))}var U={exports:{}},K;function Ji(){return K||(K=1,(function(B){(function(){var n={};n.version="6.4.2.2",n.use_lines=!0,n.use_xyz=!1;var w=!1;B.exports?(B.exports=n,w=!0):typeof document<"u"?window.ClipperLib=n:self.ClipperLib=n;var O;if(w){var x="chrome";O="Netscape"}else{var x=navigator.userAgent.toString().toLowerCase();O=navigator.appName}var d={};x.indexOf("chrome")!=-1&&x.indexOf("chromium")==-1?d.chrome=1:d.chrome=0,x.indexOf("chromium")!=-1?d.chromium=1:d.chromium=0,x.indexOf("safari")!=-1&&x.indexOf("chrome")==-1&&x.indexOf("chromium")==-1?d.safari=1:d.safari=0,x.indexOf("firefox")!=-1?d.firefox=1:d.firefox=0,x.indexOf("firefox/17")!=-1?d.firefox17=1:d.firefox17=0,x.indexOf("firefox/15")!=-1?d.firefox15=1:d.firefox15=0,x.indexOf("firefox/3")!=-1?d.firefox3=1:d.firefox3=0,x.indexOf("opera")!=-1?d.opera=1:d.opera=0,x.indexOf("msie 10")!=-1?d.msie10=1:d.msie10=0,x.indexOf("msie 9")!=-1?d.msie9=1:d.msie9=0,x.indexOf("msie 8")!=-1?d.msie8=1:d.msie8=0,x.indexOf("msie 7")!=-1?d.msie7=1:d.msie7=0,x.indexOf("msie ")!=-1?d.msie=1:d.msie=0,n.biginteger_used=null;var N;function p(t,i,e){n.biginteger_used=1,t!=null&&(typeof t=="number"&&typeof i>"u"?this.fromInt(t):typeof t=="number"?this.fromNumber(t,i,e):i==null&&typeof t!="string"?this.fromString(t,256):this.fromString(t,i))}function I(){return new p(null,void 0,void 0)}function $(t,i,e,r,s,l){for(;--l>=0;){var o=i*this[t++]+e[r]+s;s=Math.floor(o/67108864),e[r++]=o&67108863}return s}function j(t,i,e,r,s,l){for(var o=i&32767,u=i>>15;--l>=0;){var f=this[t]&32767,h=this[t++]>>15,P=u*f+h*o;f=o*f+((P&32767)<<15)+e[r]+(s&1073741823),s=(f>>>30)+(P>>>15)+u*h+(s>>>30),e[r++]=f&1073741823}return s}function tt(t,i,e,r,s,l){for(var o=i&16383,u=i>>14;--l>=0;){var f=this[t]&16383,h=this[t++]>>14,P=u*f+h*o;f=o*f+((P&16383)<<14)+e[r]+s,s=(f>>28)+(P>>14)+u*h,e[r++]=f&268435455}return s}O=="Microsoft Internet Explorer"?(p.prototype.am=j,N=30):O!="Netscape"?(p.prototype.am=$,N=26):(p.prototype.am=tt,N=28),p.prototype.DB=N,p.prototype.DM=(1<<N)-1,p.prototype.DV=1<<N;var Z=52;p.prototype.FV=Math.pow(2,Z),p.prototype.F1=Z-N,p.prototype.F2=2*N-Z;var it="0123456789abcdefghijklmnopqrstuvwxyz",W=new Array,D,X;for(D=48,X=0;X<=9;++X)W[D++]=X;for(D=97,X=10;X<36;++X)W[D++]=X;for(D=65,X=10;X<36;++X)W[D++]=X;function k(t){return it.charAt(t)}function H(t,i){var e=W[t.charCodeAt(i)];return e??-1}function et(t){for(var i=this.t-1;i>=0;--i)t[i]=this[i];t.t=this.t,t.s=this.s}function nt(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0}function S(t){var i=I();return i.fromInt(t),i}function rt(t,i){var e;if(i==16)e=4;else if(i==8)e=3;else if(i==256)e=8;else if(i==2)e=1;else if(i==32)e=5;else if(i==4)e=2;else{this.fromRadix(t,i);return}this.t=0,this.s=0;for(var r=t.length,s=!1,l=0;--r>=0;){var o=e==8?t[r]&255:H(t,r);if(o<0){t.charAt(r)=="-"&&(s=!0);continue}s=!1,l==0?this[this.t++]=o:l+e>this.DB?(this[this.t-1]|=(o&(1<<this.DB-l)-1)<<l,this[this.t++]=o>>this.DB-l):this[this.t-1]|=o<<l,l+=e,l>=this.DB&&(l-=this.DB)}e==8&&(t[0]&128)!=0&&(this.s=-1,l>0&&(this[this.t-1]|=(1<<this.DB-l)-1<<l)),this.clamp(),s&&p.ZERO.subTo(this,this)}function st(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t}function lt(t){if(this.s<0)return"-"+this.negate().toString(t);var i;if(t==16)i=4;else if(t==8)i=3;else if(t==2)i=1;else if(t==32)i=5;else if(t==4)i=2;else return this.toRadix(t);var e=(1<<i)-1,r,s=!1,l="",o=this.t,u=this.DB-o*this.DB%i;if(o-- >0)for(u<this.DB&&(r=this[o]>>u)>0&&(s=!0,l=k(r));o>=0;)u<i?(r=(this[o]&(1<<u)-1)<<i-u,r|=this[--o]>>(u+=this.DB-i)):(r=this[o]>>(u-=i)&e,u<=0&&(u+=this.DB,--o)),r>0&&(s=!0),s&&(l+=k(r));return s?l:"0"}function ot(){var t=I();return p.ZERO.subTo(this,t),t}function ut(){return this.s<0?this.negate():this}function ft(t){var i=this.s-t.s;if(i!=0)return i;var e=this.t;if(i=e-t.t,i!=0)return this.s<0?-i:i;for(;--e>=0;)if((i=this[e]-t[e])!=0)return i;return 0}function R(t){var i=1,e;return(e=t>>>16)!=0&&(t=e,i+=16),(e=t>>8)!=0&&(t=e,i+=8),(e=t>>4)!=0&&(t=e,i+=4),(e=t>>2)!=0&&(t=e,i+=2),(e=t>>1)!=0&&(t=e,i+=1),i}function ht(){return this.t<=0?0:this.DB*(this.t-1)+R(this[this.t-1]^this.s&this.DM)}function at(t,i){var e;for(e=this.t-1;e>=0;--e)i[e+t]=this[e];for(e=t-1;e>=0;--e)i[e]=0;i.t=this.t+t,i.s=this.s}function pt(t,i){for(var e=t;e<this.t;++e)i[e-t]=this[e];i.t=Math.max(this.t-t,0),i.s=this.s}function Pt(t,i){var e=t%this.DB,r=this.DB-e,s=(1<<r)-1,l=Math.floor(t/this.DB),o=this.s<<e&this.DM,u;for(u=this.t-1;u>=0;--u)i[u+l+1]=this[u]>>r|o,o=(this[u]&s)<<e;for(u=l-1;u>=0;--u)i[u]=0;i[l]=o,i.t=this.t+l+1,i.s=this.s,i.clamp()}function mt(t,i){i.s=this.s;var e=Math.floor(t/this.DB);if(e>=this.t){i.t=0;return}var r=t%this.DB,s=this.DB-r,l=(1<<r)-1;i[0]=this[e]>>r;for(var o=e+1;o<this.t;++o)i[o-e-1]|=(this[o]&l)<<s,i[o-e]=this[o]>>r;r>0&&(i[this.t-e-1]|=(this.s&l)<<s),i.t=this.t-e,i.clamp()}function yt(t,i){for(var e=0,r=0,s=Math.min(t.t,this.t);e<s;)r+=this[e]-t[e],i[e++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r-=t.s;e<this.t;)r+=this[e],i[e++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;e<t.t;)r-=t[e],i[e++]=r&this.DM,r>>=this.DB;r-=t.s}i.s=r<0?-1:0,r<-1?i[e++]=this.DV+r:r>0&&(i[e++]=r),i.t=e,i.clamp()}function dt(t,i){var e=this.abs(),r=t.abs(),s=e.t;for(i.t=s+r.t;--s>=0;)i[s]=0;for(s=0;s<r.t;++s)i[s+e.t]=e.am(0,r[s],i,s,0,e.t);i.s=0,i.clamp(),this.s!=t.s&&p.ZERO.subTo(i,i)}function vt(t){for(var i=this.abs(),e=t.t=2*i.t;--e>=0;)t[e]=0;for(e=0;e<i.t-1;++e){var r=i.am(e,i[e],t,2*e,0,1);(t[e+i.t]+=i.am(e+1,2*i[e],t,2*e+1,r,i.t-e-1))>=i.DV&&(t[e+i.t]-=i.DV,t[e+i.t+1]=1)}t.t>0&&(t[t.t-1]+=i.am(e,i[e],t,2*e,0,1)),t.s=0,t.clamp()}function Ct(t,i,e){var r=t.abs();if(!(r.t<=0)){var s=this.abs();if(s.t<r.t){i!=null&&i.fromInt(0),e!=null&&this.copyTo(e);return}e==null&&(e=I());var l=I(),o=this.s,u=t.s,f=this.DB-R(r[r.t-1]);f>0?(r.lShiftTo(f,l),s.lShiftTo(f,e)):(r.copyTo(l),s.copyTo(e));var h=l.t,P=l[h-1];if(P!=0){var a=P*(1<<this.F1)+(h>1?l[h-2]>>this.F2:0),m=this.FV/a,y=(1<<this.F1)/a,C=1<<this.F2,c=e.t,_=c-h,L=i??I();for(l.dlShiftTo(_,L),e.compareTo(L)>=0&&(e[e.t++]=1,e.subTo(L,e)),p.ONE.dlShiftTo(h,L),L.subTo(l,l);l.t<h;)l[l.t++]=0;for(;--_>=0;){var Y=e[--c]==P?this.DM:Math.floor(e[c]*m+(e[c-1]+C)*y);if((e[c]+=l.am(0,Y,e,_,0,h))<Y)for(l.dlShiftTo(_,L),e.subTo(L,e);e[c]<--Y;)e.subTo(L,e)}i!=null&&(e.drShiftTo(h,i),o!=u&&p.ZERO.subTo(i,i)),e.t=h,e.clamp(),f>0&&e.rShiftTo(f,e),o<0&&p.ZERO.subTo(e,e)}}}function ct(t){var i=I();return this.abs().divRemTo(t,null,i),this.s<0&&i.compareTo(p.ZERO)>0&&t.subTo(i,i),i}function A(t){this.m=t}function It(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function _t(t){return t}function xt(t){t.divRemTo(this.m,null,t)}function Tt(t,i,e){t.multiplyTo(i,e),this.reduce(e)}function Lt(t,i){t.squareTo(i),this.reduce(i)}A.prototype.convert=It,A.prototype.revert=_t,A.prototype.reduce=xt,A.prototype.mulTo=Tt,A.prototype.sqrTo=Lt;function Xt(){if(this.t<1)return 0;var t=this[0];if((t&1)==0)return 0;var i=t&3;return i=i*(2-(t&15)*i)&15,i=i*(2-(t&255)*i)&255,i=i*(2-((t&65535)*i&65535))&65535,i=i*(2-t*i%this.DV)%this.DV,i>0?this.DV-i:-i}function E(t){this.m=t,this.mp=t.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function Ot(t){var i=I();return t.abs().dlShiftTo(this.m.t,i),i.divRemTo(this.m,null,i),t.s<0&&i.compareTo(p.ZERO)>0&&this.m.subTo(i,i),i}function Yt(t){var i=I();return t.copyTo(i),this.reduce(i),i}function Nt(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var i=0;i<this.m.t;++i){var e=t[i]&32767,r=e*this.mpl+((e*this.mph+(t[i]>>15)*this.mpl&this.um)<<15)&t.DM;for(e=i+this.m.t,t[e]+=this.m.am(0,r,t,i,0,this.m.t);t[e]>=t.DV;)t[e]-=t.DV,t[++e]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)}function St(t,i){t.squareTo(i),this.reduce(i)}function At(t,i,e){t.multiplyTo(i,e),this.reduce(e)}E.prototype.convert=Ot,E.prototype.revert=Yt,E.prototype.reduce=Nt,E.prototype.mulTo=At,E.prototype.sqrTo=St;function Et(){return(this.t>0?this[0]&1:this.s)==0}function Bt(t,i){if(t>4294967295||t<1)return p.ONE;var e=I(),r=I(),s=i.convert(this),l=R(t)-1;for(s.copyTo(e);--l>=0;)if(i.sqrTo(e,r),(t&1<<l)>0)i.mulTo(r,s,e);else{var o=e;e=r,r=o}return i.revert(e)}function wt(t,i){var e;return t<256||i.isEven()?e=new A(i):e=new E(i),this.exp(t,e)}p.prototype.copyTo=et,p.prototype.fromInt=nt,p.prototype.fromString=rt,p.prototype.clamp=st,p.prototype.dlShiftTo=at,p.prototype.drShiftTo=pt,p.prototype.lShiftTo=Pt,p.prototype.rShiftTo=mt,p.prototype.subTo=yt,p.prototype.multiplyTo=dt,p.prototype.squareTo=vt,p.prototype.divRemTo=Ct,p.prototype.invDigit=Xt,p.prototype.isEven=Et,p.prototype.exp=Bt,p.prototype.toString=lt,p.prototype.negate=ot,p.prototype.abs=ut,p.prototype.compareTo=ft,p.prototype.bitLength=ht,p.prototype.mod=ct,p.prototype.modPowInt=wt,p.ZERO=S(0),p.ONE=S(1);function Dt(){var t=I();return this.copyTo(t),t}function bt(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function Mt(){return this.t==0?this.s:this[0]<<24>>24}function Ft(){return this.t==0?this.s:this[0]<<16>>16}function gt(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}function Wt(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function Rt(t){if(t==null&&(t=10),this.signum()==0||t<2||t>36)return"0";var i=this.chunkSize(t),e=Math.pow(t,i),r=S(e),s=I(),l=I(),o="";for(this.divRemTo(r,s,l);s.signum()>0;)o=(e+l.intValue()).toString(t).substr(1)+o,s.divRemTo(r,s,l);return l.intValue().toString(t)+o}function Zt(t,i){this.fromInt(0),i==null&&(i=10);for(var e=this.chunkSize(i),r=Math.pow(i,e),s=!1,l=0,o=0,u=0;u<t.length;++u){var f=H(t,u);if(f<0){t.charAt(u)=="-"&&this.signum()==0&&(s=!0);continue}o=i*o+f,++l>=e&&(this.dMultiply(r),this.dAddOffset(o,0),l=0,o=0)}l>0&&(this.dMultiply(Math.pow(i,l)),this.dAddOffset(o,0)),s&&p.ZERO.subTo(this,this)}function qt(t,i,e){if(typeof i=="number")if(t<2)this.fromInt(1);else for(this.fromNumber(t,e),this.testBit(t-1)||this.bitwiseTo(p.ONE.shiftLeft(t-1),q,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(i);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(p.ONE.shiftLeft(t-1),this);else{var r=new Array,s=t&7;r.length=(t>>3)+1,i.nextBytes(r),s>0?r[0]&=(1<<s)-1:r[0]=0,this.fromString(r,256)}}function Ut(){var t=this.t,i=new Array;i[0]=this.s;var e=this.DB-t*this.DB%8,r,s=0;if(t-- >0)for(e<this.DB&&(r=this[t]>>e)!=(this.s&this.DM)>>e&&(i[s++]=r|this.s<<this.DB-e);t>=0;)e<8?(r=(this[t]&(1<<e)-1)<<8-e,r|=this[--t]>>(e+=this.DB-8)):(r=this[t]>>(e-=8)&255,e<=0&&(e+=this.DB,--t)),(r&128)!=0&&(r|=-256),s==0&&(this.s&128)!=(r&128)&&++s,(s>0||r!=this.s)&&(i[s++]=r);return i}function kt(t){return this.compareTo(t)==0}function Ht(t){return this.compareTo(t)<0?this:t}function Jt(t){return this.compareTo(t)>0?this:t}function Gt(t,i,e){var r,s,l=Math.min(t.t,this.t);for(r=0;r<l;++r)e[r]=i(this[r],t[r]);if(t.t<this.t){for(s=t.s&this.DM,r=l;r<this.t;++r)e[r]=i(this[r],s);e.t=this.t}else{for(s=this.s&this.DM,r=l;r<t.t;++r)e[r]=i(s,t[r]);e.t=t.t}e.s=i(this.s,t.s),e.clamp()}function Vt(t,i){return t&i}function zt(t){var i=I();return this.bitwiseTo(t,Vt,i),i}function q(t,i){return t|i}function Kt(t){var i=I();return this.bitwiseTo(t,q,i),i}function J(t,i){return t^i}function Qt(t){var i=I();return this.bitwiseTo(t,J,i),i}function G(t,i){return t&~i}function $t(t){var i=I();return this.bitwiseTo(t,G,i),i}function jt(){for(var t=I(),i=0;i<this.t;++i)t[i]=this.DM&~this[i];return t.t=this.t,t.s=~this.s,t}function ti(t){var i=I();return t<0?this.rShiftTo(-t,i):this.lShiftTo(t,i),i}function ii(t){var i=I();return t<0?this.lShiftTo(-t,i):this.rShiftTo(t,i),i}function ei(t){if(t==0)return-1;var i=0;return(t&65535)==0&&(t>>=16,i+=16),(t&255)==0&&(t>>=8,i+=8),(t&15)==0&&(t>>=4,i+=4),(t&3)==0&&(t>>=2,i+=2),(t&1)==0&&++i,i}function ni(){for(var t=0;t<this.t;++t)if(this[t]!=0)return t*this.DB+ei(this[t]);return this.s<0?this.t*this.DB:-1}function ri(t){for(var i=0;t!=0;)t&=t-1,++i;return i}function si(){for(var t=0,i=this.s&this.DM,e=0;e<this.t;++e)t+=ri(this[e]^i);return t}function li(t){var i=Math.floor(t/this.DB);return i>=this.t?this.s!=0:(this[i]&1<<t%this.DB)!=0}function oi(t,i){var e=p.ONE.shiftLeft(t);return this.bitwiseTo(e,i,e),e}function ui(t){return this.changeBit(t,q)}function fi(t){return this.changeBit(t,G)}function hi(t){return this.changeBit(t,J)}function ai(t,i){for(var e=0,r=0,s=Math.min(t.t,this.t);e<s;)r+=this[e]+t[e],i[e++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r+=t.s;e<this.t;)r+=this[e],i[e++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;e<t.t;)r+=t[e],i[e++]=r&this.DM,r>>=this.DB;r+=t.s}i.s=r<0?-1:0,r>0?i[e++]=r:r<-1&&(i[e++]=this.DV+r),i.t=e,i.clamp()}function pi(t){var i=I();return this.addTo(t,i),i}function Pi(t){var i=I();return this.subTo(t,i),i}function mi(t){var i=I();return this.multiplyTo(t,i),i}function yi(){var t=I();return this.squareTo(t),t}function di(t){var i=I();return this.divRemTo(t,i,null),i}function vi(t){var i=I();return this.divRemTo(t,null,i),i}function Ci(t){var i=I(),e=I();return this.divRemTo(t,i,e),new Array(i,e)}function ci(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}function Ii(t,i){if(t!=0){for(;this.t<=i;)this[this.t++]=0;for(this[i]+=t;this[i]>=this.DV;)this[i]-=this.DV,++i>=this.t&&(this[this.t++]=0),++this[i]}}function g(){}function V(t){return t}function _i(t,i,e){t.multiplyTo(i,e)}function xi(t,i){t.squareTo(i)}g.prototype.convert=V,g.prototype.revert=V,g.prototype.mulTo=_i,g.prototype.sqrTo=xi;function Ti(t){return this.exp(t,new g)}function Li(t,i,e){var r=Math.min(this.t+t.t,i);for(e.s=0,e.t=r;r>0;)e[--r]=0;var s;for(s=e.t-this.t;r<s;++r)e[r+this.t]=this.am(0,t[r],e,r,0,this.t);for(s=Math.min(t.t,i);r<s;++r)this.am(0,t[r],e,r,0,i-r);e.clamp()}function Xi(t,i,e){--i;var r=e.t=this.t+t.t-i;for(e.s=0;--r>=0;)e[r]=0;for(r=Math.max(i-this.t,0);r<t.t;++r)e[this.t+r-i]=this.am(i-r,t[r],e,0,0,this.t+r-i);e.clamp(),e.drShiftTo(1,e)}function b(t){this.r2=I(),this.q3=I(),p.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}function Oi(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var i=I();return t.copyTo(i),this.reduce(i),i}function Yi(t){return t}function Ni(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)}function Si(t,i){t.squareTo(i),this.reduce(i)}function Ai(t,i,e){t.multiplyTo(i,e),this.reduce(e)}b.prototype.convert=Oi,b.prototype.revert=Yi,b.prototype.reduce=Ni,b.prototype.mulTo=Ai,b.prototype.sqrTo=Si;function Ei(t,i){var e=t.bitLength(),r,s=S(1),l;if(e<=0)return s;e<18?r=1:e<48?r=3:e<144?r=4:e<768?r=5:r=6,e<8?l=new A(i):i.isEven()?l=new b(i):l=new E(i);var o=new Array,u=3,f=r-1,h=(1<<r)-1;if(o[1]=l.convert(this),r>1){var P=I();for(l.sqrTo(o[1],P);u<=h;)o[u]=I(),l.mulTo(P,o[u-2],o[u]),u+=2}var a=t.t-1,m,y=!0,C=I(),c;for(e=R(t[a])-1;a>=0;){for(e>=f?m=t[a]>>e-f&h:(m=(t[a]&(1<<e+1)-1)<<f-e,a>0&&(m|=t[a-1]>>this.DB+e-f)),u=r;(m&1)==0;)m>>=1,--u;if((e-=u)<0&&(e+=this.DB,--a),y)o[m].copyTo(s),y=!1;else{for(;u>1;)l.sqrTo(s,C),l.sqrTo(C,s),u-=2;u>0?l.sqrTo(s,C):(c=s,s=C,C=c),l.mulTo(C,o[m],s)}for(;a>=0&&(t[a]&1<<e)==0;)l.sqrTo(s,C),c=s,s=C,C=c,--e<0&&(e=this.DB-1,--a)}return l.revert(s)}function Bi(t){var i=this.s<0?this.negate():this.clone(),e=t.s<0?t.negate():t.clone();if(i.compareTo(e)<0){var r=i;i=e,e=r}var s=i.getLowestSetBit(),l=e.getLowestSetBit();if(l<0)return i;for(s<l&&(l=s),l>0&&(i.rShiftTo(l,i),e.rShiftTo(l,e));i.signum()>0;)(s=i.getLowestSetBit())>0&&i.rShiftTo(s,i),(s=e.getLowestSetBit())>0&&e.rShiftTo(s,e),i.compareTo(e)>=0?(i.subTo(e,i),i.rShiftTo(1,i)):(e.subTo(i,e),e.rShiftTo(1,e));return l>0&&e.lShiftTo(l,e),e}function wi(t){if(t<=0)return 0;var i=this.DV%t,e=this.s<0?t-1:0;if(this.t>0)if(i==0)e=this[0]%t;else for(var r=this.t-1;r>=0;--r)e=(i*e+this[r])%t;return e}function Di(t){var i=t.isEven();if(this.isEven()&&i||t.signum()==0)return p.ZERO;for(var e=t.clone(),r=this.clone(),s=S(1),l=S(0),o=S(0),u=S(1);e.signum()!=0;){for(;e.isEven();)e.rShiftTo(1,e),i?((!s.isEven()||!l.isEven())&&(s.addTo(this,s),l.subTo(t,l)),s.rShiftTo(1,s)):l.isEven()||l.subTo(t,l),l.rShiftTo(1,l);for(;r.isEven();)r.rShiftTo(1,r),i?((!o.isEven()||!u.isEven())&&(o.addTo(this,o),u.subTo(t,u)),o.rShiftTo(1,o)):u.isEven()||u.subTo(t,u),u.rShiftTo(1,u);e.compareTo(r)>=0?(e.subTo(r,e),i&&s.subTo(o,s),l.subTo(u,l)):(r.subTo(e,r),i&&o.subTo(s,o),u.subTo(l,u))}if(r.compareTo(p.ONE)!=0)return p.ZERO;if(u.compareTo(t)>=0)return u.subtract(t);if(u.signum()<0)u.addTo(t,u);else return u;return u.signum()<0?u.add(t):u}var T=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],bi=(1<<26)/T[T.length-1];function Mi(t){var i,e=this.abs();if(e.t==1&&e[0]<=T[T.length-1]){for(i=0;i<T.length;++i)if(e[0]==T[i])return!0;return!1}if(e.isEven())return!1;for(i=1;i<T.length;){for(var r=T[i],s=i+1;s<T.length&&r<bi;)r*=T[s++];for(r=e.modInt(r);i<s;)if(r%T[i++]==0)return!1}return e.millerRabin(t)}function Fi(t){var i=this.subtract(p.ONE),e=i.getLowestSetBit();if(e<=0)return!1;var r=i.shiftRight(e);t=t+1>>1,t>T.length&&(t=T.length);for(var s=I(),l=0;l<t;++l){s.fromInt(T[Math.floor(Math.random()*T.length)]);var o=s.modPow(r,this);if(o.compareTo(p.ONE)!=0&&o.compareTo(i)!=0){for(var u=1;u++<e&&o.compareTo(i)!=0;)if(o=o.modPowInt(2,this),o.compareTo(p.ONE)==0)return!1;if(o.compareTo(i)!=0)return!1}}return!0}p.prototype.chunkSize=gt,p.prototype.toRadix=Rt,p.prototype.fromRadix=Zt,p.prototype.fromNumber=qt,p.prototype.bitwiseTo=Gt,p.prototype.changeBit=oi,p.prototype.addTo=ai,p.prototype.dMultiply=ci,p.prototype.dAddOffset=Ii,p.prototype.multiplyLowerTo=Li,p.prototype.multiplyUpperTo=Xi,p.prototype.modInt=wi,p.prototype.millerRabin=Fi,p.prototype.clone=Dt,p.prototype.intValue=bt,p.prototype.byteValue=Mt,p.prototype.shortValue=Ft,p.prototype.signum=Wt,p.prototype.toByteArray=Ut,p.prototype.equals=kt,p.prototype.min=Ht,p.prototype.max=Jt,p.prototype.and=zt,p.prototype.or=Kt,p.prototype.xor=Qt,p.prototype.andNot=$t,p.prototype.not=jt,p.prototype.shiftLeft=ti,p.prototype.shiftRight=ii,p.prototype.getLowestSetBit=ni,p.prototype.bitCount=si,p.prototype.testBit=li,p.prototype.setBit=ui,p.prototype.clearBit=fi,p.prototype.flipBit=hi,p.prototype.add=pi,p.prototype.subtract=Pi,p.prototype.multiply=mi,p.prototype.divide=di,p.prototype.remainder=vi,p.prototype.divideAndRemainder=Ci,p.prototype.modPow=Ei,p.prototype.modInverse=Di,p.prototype.pow=Ti,p.prototype.gcd=Bi,p.prototype.isProbablePrime=Mi,p.prototype.square=yi;var v=p;v.prototype.IsNegative=function(){return this.compareTo(v.ZERO)==-1},v.op_Equality=function(t,i){return t.compareTo(i)==0},v.op_Inequality=function(t,i){return t.compareTo(i)!=0},v.op_GreaterThan=function(t,i){return t.compareTo(i)>0},v.op_LessThan=function(t,i){return t.compareTo(i)<0},v.op_Addition=function(t,i){return new v(t,void 0,void 0).add(new v(i,void 0,void 0))},v.op_Subtraction=function(t,i){return new v(t,void 0,void 0).subtract(new v(i,void 0,void 0))},v.Int128Mul=function(t,i){return new v(t,void 0,void 0).multiply(new v(i,void 0,void 0))},v.op_Division=function(t,i){return t.divide(i)},v.prototype.ToDouble=function(){return parseFloat(this.toString())};var z=function(t,i){var e;if(typeof Object.getOwnPropertyNames>"u"){for(e in i.prototype)(typeof t.prototype[e]>"u"||t.prototype[e]===Object.prototype[e])&&(t.prototype[e]=i.prototype[e]);for(e in i)typeof t[e]>"u"&&(t[e]=i[e]);t.$baseCtor=i}else{for(var r=Object.getOwnPropertyNames(i.prototype),s=0;s<r.length;s++)typeof Object.getOwnPropertyDescriptor(t.prototype,r[s])>"u"&&Object.defineProperty(t.prototype,r[s],Object.getOwnPropertyDescriptor(i.prototype,r[s]));for(e in i)typeof t[e]>"u"&&(t[e]=i[e]);t.$baseCtor=i}};n.Path=function(){return[]},n.Path.prototype.push=Array.prototype.push,n.Paths=function(){return[]},n.Paths.prototype.push=Array.prototype.push,n.DoublePoint=function(){var t=arguments;this.X=0,this.Y=0,t.length===1?(this.X=t[0].X,this.Y=t[0].Y):t.length===2&&(this.X=t[0],this.Y=t[1])},n.DoublePoint0=function(){this.X=0,this.Y=0},n.DoublePoint0.prototype=n.DoublePoint.prototype,n.DoublePoint1=function(t){this.X=t.X,this.Y=t.Y},n.DoublePoint1.prototype=n.DoublePoint.prototype,n.DoublePoint2=function(t,i){this.X=t,this.Y=i},n.DoublePoint2.prototype=n.DoublePoint.prototype,n.PolyNode=function(){this.m_Parent=null,this.m_polygon=new n.Path,this.m_Index=0,this.m_jointype=0,this.m_endtype=0,this.m_Childs=[],this.IsOpen=!1},n.PolyNode.prototype.IsHoleNode=function(){for(var t=!0,i=this.m_Parent;i!==null;)t=!t,i=i.m_Parent;return t},n.PolyNode.prototype.ChildCount=function(){return this.m_Childs.length},n.PolyNode.prototype.Contour=function(){return this.m_polygon},n.PolyNode.prototype.AddChild=function(t){var i=this.m_Childs.length;this.m_Childs.push(t),t.m_Parent=this,t.m_Index=i},n.PolyNode.prototype.GetNext=function(){return this.m_Childs.length>0?this.m_Childs[0]:this.GetNextSiblingUp()},n.PolyNode.prototype.GetNextSiblingUp=function(){return this.m_Parent===null?null:this.m_Index===this.m_Parent.m_Childs.length-1?this.m_Parent.GetNextSiblingUp():this.m_Parent.m_Childs[this.m_Index+1]},n.PolyNode.prototype.Childs=function(){return this.m_Childs},n.PolyNode.prototype.Parent=function(){return this.m_Parent},n.PolyNode.prototype.IsHole=function(){return this.IsHoleNode()},n.PolyTree=function(){this.m_AllPolys=[],n.PolyNode.call(this)},n.PolyTree.prototype.Clear=function(){for(var t=0,i=this.m_AllPolys.length;t<i;t++)this.m_AllPolys[t]=null;this.m_AllPolys.length=0,this.m_Childs.length=0},n.PolyTree.prototype.GetFirst=function(){return this.m_Childs.length>0?this.m_Childs[0]:null},n.PolyTree.prototype.Total=function(){var t=this.m_AllPolys.length;return t>0&&this.m_Childs[0]!==this.m_AllPolys[0]&&t--,t},z(n.PolyTree,n.PolyNode),n.Math_Abs_Int64=n.Math_Abs_Int32=n.Math_Abs_Double=function(t){return Math.abs(t)},n.Math_Max_Int32_Int32=function(t,i){return Math.max(t,i)},d.msie||d.opera||d.safari?n.Cast_Int32=function(t){return t|0}:n.Cast_Int32=function(t){return~~t},typeof Number.toInteger>"u"&&(Number.toInteger=null),d.chrome?n.Cast_Int64=function(t){return t<-2147483648||t>2147483647?t<0?Math.ceil(t):Math.floor(t):~~t}:d.firefox&&typeof Number.toInteger=="function"?n.Cast_Int64=function(t){return Number.toInteger(t)}:d.msie7||d.msie8?n.Cast_Int64=function(t){return parseInt(t,10)}:d.msie?n.Cast_Int64=function(t){return t<-2147483648||t>2147483647?t<0?Math.ceil(t):Math.floor(t):t|0}:n.Cast_Int64=function(t){return t<0?Math.ceil(t):Math.floor(t)},n.Clear=function(t){t.length=0},n.PI=3.141592653589793,n.PI2=2*3.141592653589793,n.IntPoint=function(){var t=arguments,i=t.length;if(this.X=0,this.Y=0,n.use_xyz)if(this.Z=0,i===3)this.X=t[0],this.Y=t[1],this.Z=t[2];else if(i===2)this.X=t[0],this.Y=t[1],this.Z=0;else if(i===1)if(t[0]instanceof n.DoublePoint){var e=t[0];this.X=n.Clipper.Round(e.X),this.Y=n.Clipper.Round(e.Y),this.Z=0}else{var r=t[0];typeof r.Z>"u"&&(r.Z=0),this.X=r.X,this.Y=r.Y,this.Z=r.Z}else this.X=0,this.Y=0,this.Z=0;else if(i===2)this.X=t[0],this.Y=t[1];else if(i===1)if(t[0]instanceof n.DoublePoint){var e=t[0];this.X=n.Clipper.Round(e.X),this.Y=n.Clipper.Round(e.Y)}else{var r=t[0];this.X=r.X,this.Y=r.Y}else this.X=0,this.Y=0},n.IntPoint.op_Equality=function(t,i){return t.X===i.X&&t.Y===i.Y},n.IntPoint.op_Inequality=function(t,i){return t.X!==i.X||t.Y!==i.Y},n.IntPoint0=function(){this.X=0,this.Y=0,n.use_xyz&&(this.Z=0)},n.IntPoint0.prototype=n.IntPoint.prototype,n.IntPoint1=function(t){this.X=t.X,this.Y=t.Y,n.use_xyz&&(typeof t.Z>"u"?this.Z=0:this.Z=t.Z)},n.IntPoint1.prototype=n.IntPoint.prototype,n.IntPoint1dp=function(t){this.X=n.Clipper.Round(t.X),this.Y=n.Clipper.Round(t.Y),n.use_xyz&&(this.Z=0)},n.IntPoint1dp.prototype=n.IntPoint.prototype,n.IntPoint2=function(t,i,e){this.X=t,this.Y=i,n.use_xyz&&(typeof e>"u"?this.Z=0:this.Z=e)},n.IntPoint2.prototype=n.IntPoint.prototype,n.IntRect=function(){var t=arguments,i=t.length;if(i===4)this.left=t[0],this.top=t[1],this.right=t[2],this.bottom=t[3];else if(i===1){var e=t[0];this.left=e.left,this.top=e.top,this.right=e.right,this.bottom=e.bottom}else this.left=0,this.top=0,this.right=0,this.bottom=0},n.IntRect0=function(){this.left=0,this.top=0,this.right=0,this.bottom=0},n.IntRect0.prototype=n.IntRect.prototype,n.IntRect1=function(t){this.left=t.left,this.top=t.top,this.right=t.right,this.bottom=t.bottom},n.IntRect1.prototype=n.IntRect.prototype,n.IntRect4=function(t,i,e,r){this.left=t,this.top=i,this.right=e,this.bottom=r},n.IntRect4.prototype=n.IntRect.prototype,n.ClipType={ctIntersection:0,ctUnion:1,ctDifference:2,ctXor:3},n.PolyType={ptSubject:0,ptClip:1},n.PolyFillType={pftEvenOdd:0,pftNonZero:1,pftPositive:2,pftNegative:3},n.JoinType={jtSquare:0,jtRound:1,jtMiter:2},n.EndType={etOpenSquare:0,etOpenRound:1,etOpenButt:2,etClosedLine:3,etClosedPolygon:4},n.EdgeSide={esLeft:0,esRight:1},n.Direction={dRightToLeft:0,dLeftToRight:1},n.TEdge=function(){this.Bot=new n.IntPoint0,this.Curr=new n.IntPoint0,this.Top=new n.IntPoint0,this.Delta=new n.IntPoint0,this.Dx=0,this.PolyTyp=n.PolyType.ptSubject,this.Side=n.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},n.IntersectNode=function(){this.Edge1=null,this.Edge2=null,this.Pt=new n.IntPoint0},n.MyIntersectNodeSort=function(){},n.MyIntersectNodeSort.Compare=function(t,i){var e=i.Pt.Y-t.Pt.Y;return e>0?1:e<0?-1:0},n.LocalMinima=function(){this.Y=0,this.LeftBound=null,this.RightBound=null,this.Next=null},n.Scanbeam=function(){this.Y=0,this.Next=null},n.Maxima=function(){this.X=0,this.Next=null,this.Prev=null},n.OutRec=function(){this.Idx=0,this.IsHole=!1,this.IsOpen=!1,this.FirstLeft=null,this.Pts=null,this.BottomPt=null,this.PolyNode=null},n.OutPt=function(){this.Idx=0,this.Pt=new n.IntPoint0,this.Next=null,this.Prev=null},n.Join=function(){this.OutPt1=null,this.OutPt2=null,this.OffPt=new n.IntPoint0},n.ClipperBase=function(){this.m_MinimaList=null,this.m_CurrentLM=null,this.m_edges=new Array,this.m_UseFullRange=!1,this.m_HasOpenPaths=!1,this.PreserveCollinear=!1,this.m_Scanbeam=null,this.m_PolyOuts=null,this.m_ActiveEdges=null},n.ClipperBase.horizontal=-9007199254740992,n.ClipperBase.Skip=-2,n.ClipperBase.Unassigned=-1,n.ClipperBase.tolerance=1e-20,n.ClipperBase.loRange=47453132,n.ClipperBase.hiRange=0xfffffffffffff,n.ClipperBase.near_zero=function(t){return t>-n.ClipperBase.tolerance&&t<n.ClipperBase.tolerance},n.ClipperBase.IsHorizontal=function(t){return t.Delta.Y===0},n.ClipperBase.prototype.PointIsVertex=function(t,i){var e=i;do{if(n.IntPoint.op_Equality(e.Pt,t))return!0;e=e.Next}while(e!==i);return!1},n.ClipperBase.prototype.PointOnLineSegment=function(t,i,e,r){return r?t.X===i.X&&t.Y===i.Y||t.X===e.X&&t.Y===e.Y||t.X>i.X==t.X<e.X&&t.Y>i.Y==t.Y<e.Y&&v.op_Equality(v.Int128Mul(t.X-i.X,e.Y-i.Y),v.Int128Mul(e.X-i.X,t.Y-i.Y)):t.X===i.X&&t.Y===i.Y||t.X===e.X&&t.Y===e.Y||t.X>i.X==t.X<e.X&&t.Y>i.Y==t.Y<e.Y&&(t.X-i.X)*(e.Y-i.Y)===(e.X-i.X)*(t.Y-i.Y)},n.ClipperBase.prototype.PointOnPolygon=function(t,i,e){for(var r=i;;){if(this.PointOnLineSegment(t,r.Pt,r.Next.Pt,e))return!0;if(r=r.Next,r===i)break}return!1},n.ClipperBase.prototype.SlopesEqual=n.ClipperBase.SlopesEqual=function(){var t=arguments,i=t.length,e,r,s,l,o,u,f;return i===3?(e=t[0],r=t[1],f=t[2],f?v.op_Equality(v.Int128Mul(e.Delta.Y,r.Delta.X),v.Int128Mul(e.Delta.X,r.Delta.Y)):n.Cast_Int64(e.Delta.Y*r.Delta.X)===n.Cast_Int64(e.Delta.X*r.Delta.Y)):i===4?(s=t[0],l=t[1],o=t[2],f=t[3],f?v.op_Equality(v.Int128Mul(s.Y-l.Y,l.X-o.X),v.Int128Mul(s.X-l.X,l.Y-o.Y)):n.Cast_Int64((s.Y-l.Y)*(l.X-o.X))-n.Cast_Int64((s.X-l.X)*(l.Y-o.Y))===0):(s=t[0],l=t[1],o=t[2],u=t[3],f=t[4],f?v.op_Equality(v.Int128Mul(s.Y-l.Y,o.X-u.X),v.Int128Mul(s.X-l.X,o.Y-u.Y)):n.Cast_Int64((s.Y-l.Y)*(o.X-u.X))-n.Cast_Int64((s.X-l.X)*(o.Y-u.Y))===0)},n.ClipperBase.SlopesEqual3=function(t,i,e){return e?v.op_Equality(v.Int128Mul(t.Delta.Y,i.Delta.X),v.Int128Mul(t.Delta.X,i.Delta.Y)):n.Cast_Int64(t.Delta.Y*i.Delta.X)===n.Cast_Int64(t.Delta.X*i.Delta.Y)},n.ClipperBase.SlopesEqual4=function(t,i,e,r){return r?v.op_Equality(v.Int128Mul(t.Y-i.Y,i.X-e.X),v.Int128Mul(t.X-i.X,i.Y-e.Y)):n.Cast_Int64((t.Y-i.Y)*(i.X-e.X))-n.Cast_Int64((t.X-i.X)*(i.Y-e.Y))===0},n.ClipperBase.SlopesEqual5=function(t,i,e,r,s){return s?v.op_Equality(v.Int128Mul(t.Y-i.Y,e.X-r.X),v.Int128Mul(t.X-i.X,e.Y-r.Y)):n.Cast_Int64((t.Y-i.Y)*(e.X-r.X))-n.Cast_Int64((t.X-i.X)*(e.Y-r.Y))===0},n.ClipperBase.prototype.Clear=function(){this.DisposeLocalMinimaList();for(var t=0,i=this.m_edges.length;t<i;++t){for(var e=0,r=this.m_edges[t].length;e<r;++e)this.m_edges[t][e]=null;n.Clear(this.m_edges[t])}n.Clear(this.m_edges),this.m_UseFullRange=!1,this.m_HasOpenPaths=!1},n.ClipperBase.prototype.DisposeLocalMinimaList=function(){for(;this.m_MinimaList!==null;){var t=this.m_MinimaList.Next;this.m_MinimaList=null,this.m_MinimaList=t}this.m_CurrentLM=null},n.ClipperBase.prototype.RangeTest=function(t,i){i.Value?(t.X>n.ClipperBase.hiRange||t.Y>n.ClipperBase.hiRange||-t.X>n.ClipperBase.hiRange||-t.Y>n.ClipperBase.hiRange)&&n.Error("Coordinate outside allowed range in RangeTest()."):(t.X>n.ClipperBase.loRange||t.Y>n.ClipperBase.loRange||-t.X>n.ClipperBase.loRange||-t.Y>n.ClipperBase.loRange)&&(i.Value=!0,this.RangeTest(t,i))},n.ClipperBase.prototype.InitEdge=function(t,i,e,r){t.Next=i,t.Prev=e,t.Curr.X=r.X,t.Curr.Y=r.Y,n.use_xyz&&(t.Curr.Z=r.Z),t.OutIdx=-1},n.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,n.use_xyz&&(t.Bot.Z=t.Curr.Z),t.Top.X=t.Next.Curr.X,t.Top.Y=t.Next.Curr.Y,n.use_xyz&&(t.Top.Z=t.Next.Curr.Z)):(t.Top.X=t.Curr.X,t.Top.Y=t.Curr.Y,n.use_xyz&&(t.Top.Z=t.Curr.Z),t.Bot.X=t.Next.Curr.X,t.Bot.Y=t.Next.Curr.Y,n.use_xyz&&(t.Bot.Z=t.Next.Curr.Z)),this.SetDx(t),t.PolyTyp=i},n.ClipperBase.prototype.FindNextLocMin=function(t){for(var i;;){for(;n.IntPoint.op_Inequality(t.Bot,t.Prev.Bot)||n.IntPoint.op_Equality(t.Curr,t.Top);)t=t.Next;if(t.Dx!==n.ClipperBase.horizontal&&t.Prev.Dx!==n.ClipperBase.horizontal)break;for(;t.Prev.Dx===n.ClipperBase.horizontal;)t=t.Prev;for(i=t;t.Dx===n.ClipperBase.horizontal;)t=t.Next;if(t.Top.Y!==t.Prev.Bot.Y){i.Prev.Bot.X<t.Bot.X&&(t=i);break}}return t},n.ClipperBase.prototype.ProcessBound=function(t,i){var e,r=t,s;if(r.OutIdx===n.ClipperBase.Skip){if(t=r,i){for(;t.Top.Y===t.Next.Bot.Y;)t=t.Next;for(;t!==r&&t.Dx===n.ClipperBase.horizontal;)t=t.Prev}else{for(;t.Top.Y===t.Prev.Bot.Y;)t=t.Prev;for(;t!==r&&t.Dx===n.ClipperBase.horizontal;)t=t.Next}if(t===r)i?r=t.Next:r=t.Prev;else{i?t=r.Next:t=r.Prev;var l=new n.LocalMinima;l.Next=null,l.Y=t.Bot.Y,l.LeftBound=null,l.RightBound=t,t.WindDelta=0,r=this.ProcessBound(t,i),this.InsertLocalMinima(l)}return r}if(t.Dx===n.ClipperBase.horizontal&&(i?e=t.Prev:e=t.Next,e.Dx===n.ClipperBase.horizontal?e.Bot.X!==t.Bot.X&&e.Top.X!==t.Bot.X&&this.ReverseHorizontal(t):e.Bot.X!==t.Bot.X&&this.ReverseHorizontal(t)),e=t,i){for(;r.Top.Y===r.Next.Bot.Y&&r.Next.OutIdx!==n.ClipperBase.Skip;)r=r.Next;if(r.Dx===n.ClipperBase.horizontal&&r.Next.OutIdx!==n.ClipperBase.Skip){for(s=r;s.Prev.Dx===n.ClipperBase.horizontal;)s=s.Prev;s.Prev.Top.X>r.Next.Top.X&&(r=s.Prev)}for(;t!==r;)t.NextInLML=t.Next,t.Dx===n.ClipperBase.horizontal&&t!==e&&t.Bot.X!==t.Prev.Top.X&&this.ReverseHorizontal(t),t=t.Next;t.Dx===n.ClipperBase.horizontal&&t!==e&&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!==n.ClipperBase.Skip;)r=r.Prev;if(r.Dx===n.ClipperBase.horizontal&&r.Prev.OutIdx!==n.ClipperBase.Skip){for(s=r;s.Next.Dx===n.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===n.ClipperBase.horizontal&&t!==e&&t.Bot.X!==t.Next.Top.X&&this.ReverseHorizontal(t),t=t.Prev;t.Dx===n.ClipperBase.horizontal&&t!==e&&t.Bot.X!==t.Next.Top.X&&this.ReverseHorizontal(t),r=r.Prev}return r},n.ClipperBase.prototype.AddPath=function(t,i,e){n.use_lines?!e&&i===n.PolyType.ptClip&&n.Error("AddPath: Open paths must be subject."):e||n.Error("AddPath: Open paths have been disabled.");var r=t.length-1;if(e)for(;r>0&&n.IntPoint.op_Equality(t[r],t[0]);)--r;for(;r>0&&n.IntPoint.op_Equality(t[r],t[r-1]);)--r;if(e&&r<2||!e&&r<1)return!1;for(var s=new Array,l=0;l<=r;l++)s.push(new n.TEdge);var o=!0;s[1].Curr.X=t[1].X,s[1].Curr.Y=t[1].Y,n.use_xyz&&(s[1].Curr.Z=t[1].Z);var u={Value:this.m_UseFullRange};this.RangeTest(t[0],u),this.m_UseFullRange=u.Value,u.Value=this.m_UseFullRange,this.RangeTest(t[r],u),this.m_UseFullRange=u.Value,this.InitEdge(s[0],s[1],s[r],t[0]),this.InitEdge(s[r],s[0],s[r-1],t[r]);for(var l=r-1;l>=1;--l)u.Value=this.m_UseFullRange,this.RangeTest(t[l],u),this.m_UseFullRange=u.Value,this.InitEdge(s[l],s[l+1],s[l-1],t[l]);for(var f=s[0],h=f,P=f;;){if(h.Curr===h.Next.Curr&&(e||h.Next!==f)){if(h===h.Next)break;h===f&&(f=h.Next),h=this.RemoveEdge(h),P=h;continue}if(h.Prev===h.Next)break;if(e&&n.ClipperBase.SlopesEqual4(h.Prev.Curr,h.Curr,h.Next.Curr,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(h.Prev.Curr,h.Curr,h.Next.Curr))){h===f&&(f=h.Next),h=this.RemoveEdge(h),h=h.Prev,P=h;continue}if(h=h.Next,h===P||!e&&h.Next===f)break}if(!e&&h===h.Next||e&&h.Prev===h.Next)return!1;e||(this.m_HasOpenPaths=!0,f.Prev.OutIdx=n.ClipperBase.Skip),h=f;do this.InitEdge2(h,i),h=h.Next,o&&h.Curr.Y!==f.Curr.Y&&(o=!1);while(h!==f);if(o){if(e)return!1;h.Prev.OutIdx=n.ClipperBase.Skip;var a=new n.LocalMinima;for(a.Next=null,a.Y=h.Bot.Y,a.LeftBound=null,a.RightBound=h,a.RightBound.Side=n.EdgeSide.esRight,a.RightBound.WindDelta=0;h.Bot.X!==h.Prev.Top.X&&this.ReverseHorizontal(h),h.Next.OutIdx!==n.ClipperBase.Skip;)h.NextInLML=h.Next,h=h.Next;return this.InsertLocalMinima(a),this.m_edges.push(s),!0}this.m_edges.push(s);var m,y=null;for(n.IntPoint.op_Equality(h.Prev.Bot,h.Prev.Top)&&(h=h.Next);h=this.FindNextLocMin(h),h!==y;){y===null&&(y=h);var a=new n.LocalMinima;a.Next=null,a.Y=h.Bot.Y,h.Dx<h.Prev.Dx?(a.LeftBound=h.Prev,a.RightBound=h,m=!1):(a.LeftBound=h,a.RightBound=h.Prev,m=!0),a.LeftBound.Side=n.EdgeSide.esLeft,a.RightBound.Side=n.EdgeSide.esRight,e?a.LeftBound.Next===a.RightBound?a.LeftBound.WindDelta=-1:a.LeftBound.WindDelta=1:a.LeftBound.WindDelta=0,a.RightBound.WindDelta=-a.LeftBound.WindDelta,h=this.ProcessBound(a.LeftBound,m),h.OutIdx===n.ClipperBase.Skip&&(h=this.ProcessBound(h,m));var C=this.ProcessBound(a.RightBound,!m);C.OutIdx===n.ClipperBase.Skip&&(C=this.ProcessBound(C,!m)),a.LeftBound.OutIdx===n.ClipperBase.Skip?a.LeftBound=null:a.RightBound.OutIdx===n.ClipperBase.Skip&&(a.RightBound=null),this.InsertLocalMinima(a),m||(h=C)}return!0},n.ClipperBase.prototype.AddPaths=function(t,i,e){for(var r=!1,s=0,l=t.length;s<l;++s)this.AddPath(t[s],i,e)&&(r=!0);return r},n.ClipperBase.prototype.Pt2IsBetweenPt1AndPt3=function(t,i,e){return n.IntPoint.op_Equality(t,e)||n.IntPoint.op_Equality(t,i)||n.IntPoint.op_Equality(e,i)?!1:t.X!==e.X?i.X>t.X==i.X<e.X:i.Y>t.Y==i.Y<e.Y},n.ClipperBase.prototype.RemoveEdge=function(t){t.Prev.Next=t.Next,t.Next.Prev=t.Prev;var i=t.Next;return t.Prev=null,i},n.ClipperBase.prototype.SetDx=function(t){t.Delta.X=t.Top.X-t.Bot.X,t.Delta.Y=t.Top.Y-t.Bot.Y,t.Delta.Y===0?t.Dx=n.ClipperBase.horizontal:t.Dx=t.Delta.X/t.Delta.Y},n.ClipperBase.prototype.InsertLocalMinima=function(t){if(this.m_MinimaList===null)this.m_MinimaList=t;else if(t.Y>=this.m_MinimaList.Y)t.Next=this.m_MinimaList,this.m_MinimaList=t;else{for(var i=this.m_MinimaList;i.Next!==null&&t.Y<i.Next.Y;)i=i.Next;t.Next=i.Next,i.Next=t}},n.ClipperBase.prototype.PopLocalMinima=function(t,i){return i.v=this.m_CurrentLM,this.m_CurrentLM!==null&&this.m_CurrentLM.Y===t?(this.m_CurrentLM=this.m_CurrentLM.Next,!0):!1},n.ClipperBase.prototype.ReverseHorizontal=function(t){var i=t.Top.X;t.Top.X=t.Bot.X,t.Bot.X=i,n.use_xyz&&(i=t.Top.Z,t.Top.Z=t.Bot.Z,t.Bot.Z=i)},n.ClipperBase.prototype.Reset=function(){if(this.m_CurrentLM=this.m_MinimaList,this.m_CurrentLM!==null){this.m_Scanbeam=null;for(var t=this.m_MinimaList;t!==null;){this.InsertScanbeam(t.Y);var i=t.LeftBound;i!==null&&(i.Curr.X=i.Bot.X,i.Curr.Y=i.Bot.Y,n.use_xyz&&(i.Curr.Z=i.Bot.Z),i.OutIdx=n.ClipperBase.Unassigned),i=t.RightBound,i!==null&&(i.Curr.X=i.Bot.X,i.Curr.Y=i.Bot.Y,n.use_xyz&&(i.Curr.Z=i.Bot.Z),i.OutIdx=n.ClipperBase.Unassigned),t=t.Next}this.m_ActiveEdges=null}},n.ClipperBase.prototype.InsertScanbeam=function(t){if(this.m_Scanbeam===null)this.m_Scanbeam=new n.Scanbeam,this.m_Scanbeam.Next=null,this.m_Scanbeam.Y=t;else if(t>this.m_Scanbeam.Y){var i=new n.Scanbeam;i.Y=t,i.Next=this.m_Scanbeam,this.m_Scanbeam=i}else{for(var e=this.m_Scanbeam;e.Next!==null&&t<=e.Next.Y;)e=e.Next;if(t===e.Y)return;var r=new n.Scanbeam;r.Y=t,r.Next=e.Next,e.Next=r}},n.ClipperBase.prototype.PopScanbeam=function(t){return this.m_Scanbeam===null?(t.v=0,!1):(t.v=this.m_Scanbeam.Y,this.m_Scanbeam=this.m_Scanbeam.Next,!0)},n.ClipperBase.prototype.LocalMinimaPending=function(){return this.m_CurrentLM!==null},n.ClipperBase.prototype.CreateOutRec=function(){var t=new n.OutRec;return t.Idx=n.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},n.ClipperBase.prototype.DisposeOutRec=function(t){var i=this.m_PolyOuts[t];i.Pts=null,i=null,this.m_PolyOuts[t]=null},n.ClipperBase.prototype.UpdateEdgeIntoAEL=function(t){t.NextInLML===null&&n.Error("UpdateEdgeIntoAEL: invalid call");var i=t.PrevInAEL,e=t.NextInAEL;return t.NextInLML.OutIdx=t.OutIdx,i!==null?i.NextInAEL=t.NextInLML:this.m_ActiveEdges=t.NextInLML,e!==null&&(e.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,t.Curr.X=t.Bot.X,t.Curr.Y=t.Bot.Y,t.PrevInAEL=i,t.NextInAEL=e,n.ClipperBase.IsHorizontal(t)||this.InsertScanbeam(t.Top.Y),t},n.ClipperBase.prototype.SwapPositionsInAEL=function(t,i){if(!(t.NextInAEL===t.PrevInAEL||i.NextInAEL===i.PrevInAEL)){if(t.NextInAEL===i){var e=i.NextInAEL;e!==null&&(e.PrevInAEL=t);var r=t.PrevInAEL;r!==null&&(r.NextInAEL=i),i.PrevInAEL=r,i.NextInAEL=t,t.PrevInAEL=i,t.NextInAEL=e}else if(i.NextInAEL===t){var s=t.NextInAEL;s!==null&&(s.PrevInAEL=i);var l=i.PrevInAEL;l!==null&&(l.NextInAEL=t),t.PrevInAEL=l,t.NextInAEL=i,i.PrevInAEL=t,i.NextInAEL=s}else{var o=t.NextInAEL,u=t.PrevInAEL;t.NextInAEL=i.NextInAEL,t.NextInAEL!==null&&(t.NextInAEL.PrevInAEL=t),t.PrevInAEL=i.PrevInAEL,t.PrevInAEL!==null&&(t.PrevInAEL.NextInAEL=t),i.NextInAEL=o,i.NextInAEL!==null&&(i.NextInAEL.PrevInAEL=i),i.PrevInAEL=u,i.PrevInAEL!==null&&(i.PrevInAEL.NextInAEL=i)}t.PrevInAEL===null?this.m_ActiveEdges=t:i.PrevInAEL===null&&(this.m_ActiveEdges=i)}},n.ClipperBase.prototype.DeleteFromAEL=function(t){var i=t.PrevInAEL,e=t.NextInAEL;i===null&&e===null&&t!==this.m_ActiveEdges||(i!==null?i.NextInAEL=e:this.m_ActiveEdges=e,e!==null&&(e.PrevInAEL=i),t.NextInAEL=null,t.PrevInAEL=null)},n.Clipper=function(t){typeof t>"u"&&(t=0),this.m_PolyOuts=null,this.m_ClipType=n.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=n.PolyFillType.pftEvenOdd,this.m_SubjFillType=n.PolyFillType.pftEvenOdd,this.m_Joins=null,this.m_GhostJoins=null,this.m_UsingPolyTree=!1,this.ReverseSolution=!1,this.StrictlySimple=!1,n.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=n.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)!==0,this.StrictlySimple=(2&t)!==0,this.PreserveCollinear=(4&t)!==0,n.use_xyz&&(this.ZFillFunction=null)},n.Clipper.ioReverseSolution=1,n.Clipper.ioStrictlySimple=2,n.Clipper.ioPreserveCollinear=4,n.Clipper.prototype.Clear=function(){this.m_edges.length!==0&&(this.DisposeAllPolyPts(),n.ClipperBase.prototype.Clear.call(this))},n.Clipper.prototype.InsertMaxima=function(t){var i=new n.Maxima;if(i.X=t,this.m_Maxima===null)this.m_Maxima=i,this.m_Maxima.Next=null,this.m_Maxima.Prev=null;else if(t<this.m_Maxima.X)i.Next=this.m_Maxima,i.Prev=null,this.m_Maxima=i;else{for(var e=this.m_Maxima;e.Next!==null&&t>=e.Next.X;)e=e.Next;if(t===e.X)return;i.Next=e.Next,i.Prev=e,e.Next!==null&&(e.Next.Prev=i),e.Next=i}},n.Clipper.prototype.Execute=function(){var t=arguments,i=t.length,e=t[1]instanceof n.PolyTree;if(i===4&&!e){var r=t[0],s=t[1],l=t[2],o=t[3];if(this.m_ExecuteLocked)return!1;this.m_HasOpenPaths&&n.Error("Error: PolyTree struct is needed for open path clipping."),this.m_ExecuteLocked=!0,n.Clear(s),this.m_SubjFillType=l,this.m_ClipFillType=o,this.m_ClipType=r,this.m_UsingPolyTree=!1;try{var u=this.ExecuteInternal();u&&this.BuildResult(s)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return u}else if(i===4&&e){var r=t[0],f=t[1],l=t[2],o=t[3];if(this.m_ExecuteLocked)return!1;this.m_ExecuteLocked=!0,this.m_SubjFillType=l,this.m_ClipFillType=o,this.m_ClipType=r,this.m_UsingPolyTree=!0;try{var u=this.ExecuteInternal();u&&this.BuildResult2(f)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return u}else if(i===2&&!e){var r=t[0],s=t[1];return this.Execute(r,s,n.PolyFillType.pftEvenOdd,n.PolyFillType.pftEvenOdd)}else if(i===2&&e){var r=t[0],f=t[1];return this.Execute(r,f,n.PolyFillType.pftEvenOdd,n.PolyFillType.pftEvenOdd)}},n.Clipper.prototype.FixHoleLinkage=function(t){if(!(t.FirstLeft===null||t.IsHole!==t.FirstLeft.IsHole&&t.FirstLeft.Pts!==null)){for(var i=t.FirstLeft;i!==null&&(i.IsHole===t.IsHole||i.Pts===null);)i=i.FirstLeft;t.FirstLeft=i}},n.Clipper.prototype.ExecuteInternal=function(){try{this.Reset(),this.m_SortedEdges=null,this.m_Maxima=null;var t={},i={};if(!this.PopScanbeam(t))return!1;for(this.InsertLocalMinimaIntoAEL(t.v);this.PopScanbeam(i)||this.LocalMinimaPending();){if(this.ProcessHorizontals(),this.m_GhostJoins.length=0,!this.ProcessIntersections(i.v))return!1;this.ProcessEdgesAtTopOfScanbeam(i.v),t.v=i.v,this.InsertLocalMinimaIntoAEL(t.v)}var e,r,s;for(r=0,s=this.m_PolyOuts.length;r<s;r++)e=this.m_PolyOuts[r],!(e.Pts===null||e.IsOpen)&&(e.IsHole^this.ReverseSolution)==this.Area$1(e)>0&&this.ReversePolyPtLinks(e.Pts);for(this.JoinCommonEdges(),r=0,s=this.m_PolyOuts.length;r<s;r++)e=this.m_PolyOuts[r],e.Pts!==null&&(e.IsOpen?this.FixupOutPolyline(e):this.FixupOutPolygon(e));return this.StrictlySimple&&this.DoSimplePolygons(),!0}finally{this.m_Joins.length=0,this.m_GhostJoins.length=0}},n.Clipper.prototype.DisposeAllPolyPts=function(){for(var t=0,i=this.m_PolyOuts.length;t<i;++t)this.DisposeOutRec(t);n.Clear(this.m_PolyOuts)},n.Clipper.prototype.AddJoin=function(t,i,e){var r=new n.Join;r.OutPt1=t,r.OutPt2=i,r.OffPt.X=e.X,r.OffPt.Y=e.Y,n.use_xyz&&(r.OffPt.Z=e.Z),this.m_Joins.push(r)},n.Clipper.prototype.AddGhostJoin=function(t,i){var e=new n.Join;e.OutPt1=t,e.OffPt.X=i.X,e.OffPt.Y=i.Y,n.use_xyz&&(e.OffPt.Z=i.Z),this.m_GhostJoins.push(e)},n.Clipper.prototype.SetZ=function(t,i,e){if(this.ZFillFunction!==null){if(t.Z!==0||this.ZFillFunction===null)return;n.IntPoint.op_Equality(t,i.Bot)?t.Z=i.Bot.Z:n.IntPoint.op_Equality(t,i.Top)?t.Z=i.Top.Z:n.IntPoint.op_Equality(t,e.Bot)?t.Z=e.Bot.Z:n.IntPoint.op_Equality(t,e.Top)?t.Z=e.Top.Z:this.ZFillFunction(i.Bot,i.Top,e.Bot,e.Top,t)}},n.Clipper.prototype.InsertLocalMinimaIntoAEL=function(t){for(var i={},e,r;this.PopLocalMinima(t,i);){e=i.v.LeftBound,r=i.v.RightBound;var s=null;if(e===null?(this.InsertEdgeIntoAEL(r,null),this.SetWindingCount(r),this.IsContributing(r)&&(s=this.AddOutPt(r,r.Bot))):r===null?(this.InsertEdgeIntoAEL(e,null),this.SetWindingCount(e),this.IsContributing(e)&&(s=this.AddOutPt(e,e.Bot)),this.InsertScanbeam(e.Top.Y)):(this.InsertEdgeIntoAEL(e,null),this.InsertEdgeIntoAEL(r,e),this.SetWindingCount(e),r.WindCnt=e.WindCnt,r.WindCnt2=e.WindCnt2,this.IsContributing(e)&&(s=this.AddLocalMinPoly(e,r,e.Bot)),this.InsertScanbeam(e.Top.Y)),r!==null&&(n.ClipperBase.IsHorizontal(r)?(r.NextInLML!==null&&this.InsertScanbeam(r.NextInLML.Top.Y),this.AddEdgeToSEL(r)):this.InsertScanbeam(r.Top.Y)),!(e===null||r===null)){if(s!==null&&n.ClipperBase.IsHorizontal(r)&&this.m_GhostJoins.length>0&&r.WindDelta!==0)for(var l=0,o=this.m_GhostJoins.length;l<o;l++){var u=this.m_GhostJoins[l];this.HorzSegmentsOverlap(u.OutPt1.Pt.X,u.OffPt.X,r.Bot.X,r.Top.X)&&this.AddJoin(u.OutPt1,s,u.OffPt)}if(e.OutIdx>=0&&e.PrevInAEL!==null&&e.PrevInAEL.Curr.X===e.Bot.X&&e.PrevInAEL.OutIdx>=0&&n.ClipperBase.SlopesEqual5(e.PrevInAEL.Curr,e.PrevInAEL.Top,e.Curr,e.Top,this.m_UseFullRange)&&e.WindDelta!==0&&e.PrevInAEL.WindDelta!==0){var f=this.AddOutPt(e.PrevInAEL,e.Bot);this.AddJoin(s,f,e.Top)}if(e.NextInAEL!==r){if(r.OutIdx>=0&&r.PrevInAEL.OutIdx>=0&&n.ClipperBase.SlopesEqual5(r.PrevInAEL.Curr,r.PrevInAEL.Top,r.Curr,r.Top,this.m_UseFullRange)&&r.WindDelta!==0&&r.PrevInAEL.WindDelta!==0){var f=this.AddOutPt(r.PrevInAEL,r.Bot);this.AddJoin(s,f,r.Top)}var h=e.NextInAEL;if(h!==null)for(;h!==r;)this.IntersectEdges(r,h,e.Curr),h=h.NextInAEL}}}},n.Clipper.prototype.InsertEdgeIntoAEL=function(t,i){if(this.m_ActiveEdges===null)t.PrevInAEL=null,t.NextInAEL=null,this.m_ActiveEdges=t;else if(i===null&&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(i===null&&(i=this.m_ActiveEdges);i.NextInAEL!==null&&!this.E2InsertsBeforeE1(i.NextInAEL,t);)i=i.NextInAEL;t.NextInAEL=i.NextInAEL,i.NextInAEL!==null&&(i.NextInAEL.PrevInAEL=t),t.PrevInAEL=i,i.NextInAEL=t}},n.Clipper.prototype.E2InsertsBeforeE1=function(t,i){return i.Curr.X===t.Curr.X?i.Top.Y>t.Top.Y?i.Top.X<n.Clipper.TopX(t,i.Top.Y):t.Top.X>n.Clipper.TopX(i,t.Top.Y):i.Curr.X<t.Curr.X},n.Clipper.prototype.IsEvenOddFillType=function(t){return t.PolyTyp===n.PolyType.ptSubject?this.m_SubjFillType===n.PolyFillType.pftEvenOdd:this.m_ClipFillType===n.PolyFillType.pftEvenOdd},n.Clipper.prototype.IsEvenOddAltFillType=function(t){return t.PolyTyp===n.PolyType.ptSubject?this.m_ClipFillType===n.PolyFillType.pftEvenOdd:this.m_SubjFillType===n.PolyFillType.pftEvenOdd},n.Clipper.prototype.IsContributing=function(t){var i,e;switch(t.PolyTyp===n.PolyType.ptSubject?(i=this.m_SubjFillType,e=this.m_ClipFillType):(i=this.m_ClipFillType,e=this.m_SubjFillType),i){case n.PolyFillType.pftEvenOdd:if(t.WindDelta===0&&t.WindCnt!==1)return!1;break;case n.PolyFillType.pftNonZero:if(Math.abs(t.WindCnt)!==1)return!1;break;case n.PolyFillType.pftPositive:if(t.WindCnt!==1)return!1;break;default:if(t.WindCnt!==-1)return!1;break}switch(this.m_ClipType){case n.ClipType.ctIntersection:switch(e){case n.PolyFillType.pftEvenOdd:case n.PolyFillType.pftNonZero:return t.WindCnt2!==0;case n.PolyFillType.pftPositive:return t.WindCnt2>0;default:return t.WindCnt2<0}case n.ClipType.ctUnion:switch(e){case n.PolyFillType.pftEvenOdd:case n.PolyFillType.pftNonZero:return t.WindCnt2===0;case n.PolyFillType.pftPositive:return t.WindCnt2<=0;default:return t.WindCnt2>=0}case n.ClipType.ctDifference:if(t.PolyTyp===n.PolyType.ptSubject)switch(e){case n.PolyFillType.pftEvenOdd:case n.PolyFillType.pftNonZero:return t.WindCnt2===0;case n.PolyFillType.pftPositive:return t.WindCnt2<=0;default:return t.WindCnt2>=0}else switch(e){case n.PolyFillType.pftEvenOdd:case n.PolyFillType.pftNonZero:return t.WindCnt2!==0;case n.PolyFillType.pftPositive:return t.WindCnt2>0;default:return t.WindCnt2<0}case n.ClipType.ctXor:if(t.WindDelta===0)switch(e){case n.PolyFillType.pftEvenOdd:case n.PolyFillType.pftNonZero:return t.WindCnt2===0;case n.PolyFillType.pftPositive:return t.WindCnt2<=0;default:return t.WindCnt2>=0}else return!0}return!0},n.Clipper.prototype.SetWindingCount=function(t){for(var i=t.PrevInAEL;i!==null&&(i.PolyTyp!==t.PolyTyp||i.WindDelta===0);)i=i.PrevInAEL;if(i===null){var e=t.PolyTyp===n.PolyType.ptSubject?this.m_SubjFillType:this.m_ClipFillType;t.WindDelta===0?t.WindCnt=e===n.PolyFillType.pftNegative?-1:1:t.WindCnt=t.WindDelta,t.WindCnt2=0,i=this.m_ActiveEdges}else if(t.WindDelta===0&&this.m_ClipType!==n.ClipType.ctUnion)t.WindCnt=1,t.WindCnt2=i.WindCnt2,i=i.NextInAEL;else if(this.IsEvenOddFillType(t)){if(t.WindDelta===0){for(var r=!0,s=i.PrevInAEL;s!==null;)s.PolyTyp===i.PolyTyp&&s.WindDelta!==0&&(r=!r),s=s.PrevInAEL;t.WindCnt=r?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=t.WindDelta===0?1:t.WindDelta:t.WindDelta===0?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;)i.WindDelta!==0&&(t.WindCnt2=t.WindCnt2===0?1:0),i=i.NextInAEL;else for(;i!==t;)t.WindCnt2+=i.WindDelta,i=i.NextInAEL},n.Clipper.prototype.AddEdgeToSEL=function(t){this.m_SortedEdges===null?(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)},n.Clipper.prototype.PopEdgeFromSEL=function(t){if(t.v=this.m_SortedEdges,t.v===null)return!1;var i=t.v;return this.m_SortedEdges=t.v.NextInSEL,this.m_SortedEdges!==null&&(this.m_SortedEdges.PrevInSEL=null),i.NextInSEL=null,i.PrevInSEL=null,!0},n.Clipper.prototype.CopyAELToSEL=function(){var t=this.m_ActiveEdges;for(this.m_SortedEdges=t;t!==null;)t.PrevInSEL=t.PrevInAEL,t.NextInSEL=t.NextInAEL,t=t.NextInAEL},n.Clipper.prototype.SwapPositionsInSEL=function(t,i){if(!(t.NextInSEL===null&&t.PrevInSEL===null)&&!(i.NextInSEL===null&&i.PrevInSEL===null)){if(t.NextInSEL===i){var e=i.NextInSEL;e!==null&&(e.PrevInSEL=t);var r=t.PrevInSEL;r!==null&&(r.NextInSEL=i),i.PrevInSEL=r,i.NextInSEL=t,t.PrevInSEL=i,t.NextInSEL=e}else if(i.NextInSEL===t){var e=t.NextInSEL;e!==null&&(e.PrevInSEL=i);var r=i.PrevInSEL;r!==null&&(r.NextInSEL=t),t.PrevInSEL=r,t.NextInSEL=i,i.PrevInSEL=t,i.NextInSEL=e}else{var e=t.NextInSEL,r=t.PrevInSEL;t.NextInSEL=i.NextInSEL,t.NextInSEL!==null&&(t.NextInSEL.PrevInSEL=t),t.PrevInSEL=i.PrevInSEL,t.PrevInSEL!==null&&(t.PrevInSEL.NextInSEL=t),i.NextInSEL=e,i.NextInSEL!==null&&(i.NextInSEL.PrevInSEL=i),i.PrevInSEL=r,i.PrevInSEL!==null&&(i.PrevInSEL.NextInSEL=i)}t.PrevInSEL===null?this.m_SortedEdges=t:i.PrevInSEL===null&&(this.m_SortedEdges=i)}},n.Clipper.prototype.AddLocalMaxPoly=function(t,i,e){this.AddOutPt(t,e),i.WindDelta===0&&this.AddOutPt(i,e),t.OutIdx===i.OutIdx?(t.OutIdx=-1,i.OutIdx=-1):t.OutIdx<i.OutIdx?this.AppendPolygon(t,i):this.AppendPolygon(i,t)},n.Clipper.prototype.AddLocalMinPoly=function(t,i,e){var r,s,l;if(n.ClipperBase.IsHorizontal(i)||t.Dx>i.Dx?(r=this.AddOutPt(t,e),i.OutIdx=t.OutIdx,t.Side=n.EdgeSide.esLeft,i.Side=n.EdgeSide.esRight,s=t,s.PrevInAEL===i?l=i.PrevInAEL:l=s.PrevInAEL):(r=this.AddOutPt(i,e),t.OutIdx=i.OutIdx,t.Side=n.EdgeSide.esRight,i.Side=n.EdgeSide.esLeft,s=i,s.PrevInAEL===t?l=t.PrevInAEL:l=s.PrevInAEL),l!==null&&l.OutIdx>=0&&l.Top.Y<e.Y&&s.Top.Y<e.Y){var o=n.Clipper.TopX(l,e.Y),u=n.Clipper.TopX(s,e.Y);if(o===u&&s.WindDelta!==0&&l.WindDelta!==0&&n.ClipperBase.SlopesEqual5(new n.IntPoint2(o,e.Y),l.Top,new n.IntPoint2(u,e.Y),s.Top,this.m_UseFullRange)){var f=this.AddOutPt(l,e);this.AddJoin(r,f,s.Top)}}return r},n.Clipper.prototype.AddOutPt=function(t,i){if(t.OutIdx<0){var e=this.CreateOutRec();e.IsOpen=t.WindDelta===0;var r=new n.OutPt;return e.Pts=r,r.Idx=e.Idx,r.Pt.X=i.X,r.Pt.Y=i.Y,n.use_xyz&&(r.Pt.Z=i.Z),r.Next=r,r.Prev=r,e.IsOpen||this.SetHoleState(t,e),t.OutIdx=e.Idx,r}else{var e=this.m_PolyOuts[t.OutIdx],s=e.Pts,l=t.Side===n.EdgeSide.esLeft;if(l&&n.IntPoint.op_Equality(i,s.Pt))return s;if(!l&&n.IntPoint.op_Equality(i,s.Prev.Pt))return s.Prev;var r=new n.OutPt;return r.Idx=e.Idx,r.Pt.X=i.X,r.Pt.Y=i.Y,n.use_xyz&&(r.Pt.Z=i.Z),r.Next=s,r.Prev=s.Prev,r.Prev.Next=r,s.Prev=r,l&&(e.Pts=r),r}},n.Clipper.prototype.GetLastOutPt=function(t){var i=this.m_PolyOuts[t.OutIdx];return t.Side===n.EdgeSide.esLeft?i.Pts:i.Pts.Prev},n.Clipper.prototype.SwapPoints=function(t,i){var e=new n.IntPoint1(t.Value);t.Value.X=i.Value.X,t.Value.Y=i.Value.Y,n.use_xyz&&(t.Value.Z=i.Value.Z),i.Value.X=e.X,i.Value.Y=e.Y,n.use_xyz&&(i.Value.Z=e.Z)},n.Clipper.prototype.HorzSegmentsOverlap=function(t,i,e,r){var s;return t>i&&(s=t,t=i,i=s),e>r&&(s=e,e=r,r=s),t<r&&e<i},n.Clipper.prototype.SetHoleState=function(t,i){for(var e=t.PrevInAEL,r=null;e!==null;)e.OutIdx>=0&&e.WindDelta!==0&&(r===null?r=e:r.OutIdx===e.OutIdx&&(r=null)),e=e.PrevInAEL;r===null?(i.FirstLeft=null,i.IsHole=!1):(i.FirstLeft=this.m_PolyOuts[r.OutIdx],i.IsHole=!i.FirstLeft.IsHole)},n.Clipper.prototype.GetDx=function(t,i){return t.Y===i.Y?n.ClipperBase.horizontal:(i.X-t.X)/(i.Y-t.Y)},n.Clipper.prototype.FirstIsBottomPt=function(t,i){for(var e=t.Prev;n.IntPoint.op_Equality(e.Pt,t.Pt)&&e!==t;)e=e.Prev;var r=Math.abs(this.GetDx(t.Pt,e.Pt));for(e=t.Next;n.IntPoint.op_Equality(e.Pt,t.Pt)&&e!==t;)e=e.Next;var s=Math.abs(this.GetDx(t.Pt,e.Pt));for(e=i.Prev;n.IntPoint.op_Equality(e.Pt,i.Pt)&&e!==i;)e=e.Prev;var l=Math.abs(this.GetDx(i.Pt,e.Pt));for(e=i.Next;n.IntPoint.op_Equality(e.Pt,i.Pt)&&e!==i;)e=e.Next;var o=Math.abs(this.GetDx(i.Pt,e.Pt));return Math.max(r,s)===Math.max(l,o)&&Math.min(r,s)===Math.min(l,o)?this.Area(t)>0:r>=l&&r>=o||s>=l&&s>=o},n.Clipper.prototype.GetBottomPt=function(t){for(var i=null,e=t.Next;e!==t;)e.Pt.Y>t.Pt.Y?(t=e,i=null):e.Pt.Y===t.Pt.Y&&e.Pt.X<=t.Pt.X&&(e.Pt.X<t.Pt.X?(i=null,t=e):e.Next!==t&&e.Prev!==t&&(i=e)),e=e.Next;if(i!==null)for(;i!==e;)for(this.FirstIsBottomPt(e,i)||(t=i),i=i.Next;n.IntPoint.op_Inequality(i.Pt,t.Pt);)i=i.Next;return t},n.Clipper.prototype.GetLowermostRec=function(t,i){t.BottomPt===null&&(t.BottomPt=this.GetBottomPt(t.Pts)),i.BottomPt===null&&(i.BottomPt=this.GetBottomPt(i.Pts));var e=t.BottomPt,r=i.BottomPt;return e.Pt.Y>r.Pt.Y?t:e.Pt.Y<r.Pt.Y?i:e.Pt.X<r.Pt.X?t:e.Pt.X>r.Pt.X||e.Next===e?i:r.Next===r||this.FirstIsBottomPt(e,r)?t:i},n.Clipper.prototype.OutRec1RightOfOutRec2=function(t,i){do if(t=t.FirstLeft,t===i)return!0;while(t!==null);return!1},n.Clipper.prototype.GetOutRec=function(t){for(var i=this.m_PolyOuts[t];i!==this.m_PolyOuts[i.Idx];)i=this.m_PolyOuts[i.Idx];return i},n.Clipper.prototype.AppendPolygon=function(t,i){var e=this.m_PolyOuts[t.OutIdx],r=this.m_PolyOuts[i.OutIdx],s;this.OutRec1RightOfOutRec2(e,r)?s=r:this.OutRec1RightOfOutRec2(r,e)?s=e:s=this.GetLowermostRec(e,r);var l=e.Pts,o=l.Prev,u=r.Pts,f=u.Prev;t.Side===n.EdgeSide.esLeft?i.Side===n.EdgeSide.esLeft?(this.ReversePolyPtLinks(u),u.Next=l,l.Prev=u,o.Next=f,f.Prev=o,e.Pts=f):(f.Next=l,l.Prev=f,u.Prev=o,o.Next=u,e.Pts=u):i.Side===n.EdgeSide.esRight?(this.ReversePolyPtLinks(u),o.Next=f,f.Prev=o,u.Next=l,l.Prev=u):(o.Next=u,u.Prev=o,l.Prev=f,f.Next=l),e.BottomPt=null,s===r&&(r.FirstLeft!==e&&(e.FirstLeft=r.FirstLeft),e.IsHole=r.IsHole),r.Pts=null,r.BottomPt=null,r.FirstLeft=e;var h=t.OutIdx,P=i.OutIdx;t.OutIdx=-1,i.OutIdx=-1;for(var a=this.m_ActiveEdges;a!==null;){if(a.OutIdx===P){a.OutIdx=h,a.Side=t.Side;break}a=a.NextInAEL}r.Idx=e.Idx},n.Clipper.prototype.ReversePolyPtLinks=function(t){if(t!==null){var i,e;i=t;do e=i.Next,i.Next=i.Prev,i.Prev=e,i=e;while(i!==t)}},n.Clipper.SwapSides=function(t,i){var e=t.Side;t.Side=i.Side,i.Side=e},n.Clipper.SwapPolyIndexes=function(t,i){var e=t.OutIdx;t.OutIdx=i.OutIdx,i.OutIdx=e},n.Clipper.prototype.IntersectEdges=function(t,i,e){var r=t.OutIdx>=0,s=i.OutIdx>=0;if(n.use_xyz&&this.SetZ(e,t,i),n.use_lines&&(t.WindDelta===0||i.WindDelta===0)){if(t.WindDelta===0&&i.WindDelta===0)return;t.PolyTyp===i.PolyTyp&&t.WindDelta!==i.WindDelta&&this.m_ClipType===n.ClipType.ctUnion?t.WindDelta===0?s&&(this.AddOutPt(t,e),r&&(t.OutIdx=-1)):r&&(this.AddOutPt(i,e),s&&(i.OutIdx=-1)):t.PolyTyp!==i.PolyTyp&&(t.WindDelta===0&&Math.abs(i.WindCnt)===1&&(this.m_ClipType!==n.ClipType.ctUnion||i.WindCnt2===0)?(this.AddOutPt(t,e),r&&(t.OutIdx=-1)):i.WindDelta===0&&Math.abs(t.WindCnt)===1&&(this.m_ClipType!==n.ClipType.ctUnion||t.WindCnt2===0)&&(this.AddOutPt(i,e),s&&(i.OutIdx=-1)));return}if(t.PolyTyp===i.PolyTyp)if(this.IsEvenOddFillType(t)){var l=t.WindCnt;t.WindCnt=i.WindCnt,i.WindCnt=l}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=t.WindCnt2===0?1:0:t.WindCnt2+=i.WindDelta,this.IsEvenOddFillType(t)?i.WindCnt2=i.WindCnt2===0?1:0:i.WindCnt2-=t.WindDelta;var o,u,f,h;t.PolyTyp===n.PolyType.ptSubject?(o=this.m_SubjFillType,f=this.m_ClipFillType):(o=this.m_ClipFillType,f=this.m_SubjFillType),i.PolyTyp===n.PolyType.ptSubject?(u=this.m_SubjFillType,h=this.m_ClipFillType):(u=this.m_ClipFillType,h=this.m_SubjFillType);var P,a;switch(o){case n.PolyFillType.pftPositive:P=t.WindCnt;break;case n.PolyFillType.pftNegative:P=-t.WindCnt;break;default:P=Math.abs(t.WindCnt);break}switch(u){case n.PolyFillType.pftPositive:a=i.WindCnt;break;case n.PolyFillType.pftNegative:a=-i.WindCnt;break;default:a=Math.abs(i.WindCnt);break}if(r&&s)P!==0&&P!==1||a!==0&&a!==1||t.PolyTyp!==i.PolyTyp&&this.m_ClipType!==n.ClipType.ctXor?this.AddLocalMaxPoly(t,i,e):(this.AddOutPt(t,e),this.AddOutPt(i,e),n.Clipper.SwapSides(t,i),n.Clipper.SwapPolyIndexes(t,i));else if(r)(a===0||a===1)&&(this.AddOutPt(t,e),n.Clipper.SwapSides(t,i),n.Clipper.SwapPolyIndexes(t,i));else if(s)(P===0||P===1)&&(this.AddOutPt(i,e),n.Clipper.SwapSides(t,i),n.Clipper.SwapPolyIndexes(t,i));else if((P===0||P===1)&&(a===0||a===1)){var m,y;switch(f){case n.PolyFillType.pftPositive:m=t.WindCnt2;break;case n.PolyFillType.pftNegative:m=-t.WindCnt2;break;default:m=Math.abs(t.WindCnt2);break}switch(h){case n.PolyFillType.pftPositive:y=i.WindCnt2;break;case n.PolyFillType.pftNegative:y=-i.WindCnt2;break;default:y=Math.abs(i.WindCnt2);break}if(t.PolyTyp!==i.PolyTyp)this.AddLocalMinPoly(t,i,e);else if(P===1&&a===1)switch(this.m_ClipType){case n.ClipType.ctIntersection:m>0&&y>0&&this.AddLocalMinPoly(t,i,e);break;case n.ClipType.ctUnion:m<=0&&y<=0&&this.AddLocalMinPoly(t,i,e);break;case n.ClipType.ctDifference:(t.PolyTyp===n.PolyType.ptClip&&m>0&&y>0||t.PolyTyp===n.PolyType.ptSubject&&m<=0&&y<=0)&&this.AddLocalMinPoly(t,i,e);break;case n.ClipType.ctXor:this.AddLocalMinPoly(t,i,e);break}else n.Clipper.SwapSides(t,i)}},n.Clipper.prototype.DeleteFromSEL=function(t){var i=t.PrevInSEL,e=t.NextInSEL;i===null&&e===null&&t!==this.m_SortedEdges||(i!==null?i.NextInSEL=e:this.m_SortedEdges=e,e!==null&&(e.PrevInSEL=i),t.NextInSEL=null,t.PrevInSEL=null)},n.Clipper.prototype.ProcessHorizontals=function(){for(var t={};this.PopEdgeFromSEL(t);)this.ProcessHorizontal(t.v)},n.Clipper.prototype.GetHorzDirection=function(t,i){t.Bot.X<t.Top.X?(i.Left=t.Bot.X,i.Right=t.Top.X,i.Dir=n.Direction.dLeftToRight):(i.Left=t.Top.X,i.Right=t.Bot.X,i.Dir=n.Direction.dRightToLeft)},n.Clipper.prototype.ProcessHorizontal=function(t){var i={Dir:null,Left:null,Right:null};this.GetHorzDirection(t,i);for(var e=i.Dir,r=i.Left,s=i.Right,l=t.WindDelta===0,o=t,u=null;o.NextInLML!==null&&n.ClipperBase.IsHorizontal(o.NextInLML);)o=o.NextInLML;o.NextInLML===null&&(u=this.GetMaximaPair(o));var f=this.m_Maxima;if(f!==null)if(e===n.Direction.dLeftToRight){for(;f!==null&&f.X<=t.Bot.X;)f=f.Next;f!==null&&f.X>=o.Top.X&&(f=null)}else{for(;f.Next!==null&&f.Next.X<t.Bot.X;)f=f.Next;f.X<=o.Top.X&&(f=null)}for(var h=null;;){for(var P=t===o,a=this.GetNextInAEL(t,e);a!==null;){if(f!==null)if(e===n.Direction.dLeftToRight)for(;f!==null&&f.X<a.Curr.X;)t.OutIdx>=0&&!l&&this.AddOutPt(t,new n.IntPoint2(f.X,t.Bot.Y)),f=f.Next;else for(;f!==null&&f.X>a.Curr.X;)t.OutIdx>=0&&!l&&this.AddOutPt(t,new n.IntPoint2(f.X,t.Bot.Y)),f=f.Prev;if(e===n.Direction.dLeftToRight&&a.Curr.X>s||e===n.Direction.dRightToLeft&&a.Curr.X<r||a.Curr.X===t.Top.X&&t.NextInLML!==null&&a.Dx<t.NextInLML.Dx)break;if(t.OutIdx>=0&&!l){n.use_xyz&&(e===n.Direction.dLeftToRight?this.SetZ(a.Curr,t,a):this.SetZ(a.Curr,a,t)),h=this.AddOutPt(t,a.Curr);for(var m=this.m_SortedEdges;m!==null;){if(m.OutIdx>=0&&this.HorzSegmentsOverlap(t.Bot.X,t.Top.X,m.Bot.X,m.Top.X)){var y=this.GetLastOutPt(m);this.AddJoin(y,h,m.Top)}m=m.NextInSEL}this.AddGhostJoin(h,t.Bot)}if(a===u&&P){t.OutIdx>=0&&this.AddLocalMaxPoly(t,u,t.Top),this.DeleteFromAEL(t),this.DeleteFromAEL(u);return}if(e===n.Direction.dLeftToRight){var C=new n.IntPoint2(a.Curr.X,t.Curr.Y);this.IntersectEdges(t,a,C)}else{var C=new n.IntPoint2(a.Curr.X,t.Curr.Y);this.IntersectEdges(a,t,C)}var c=this.GetNextInAEL(a,e);this.SwapPositionsInAEL(t,a),a=c}if(t.NextInLML===null||!n.ClipperBase.IsHorizontal(t.NextInLML))break;t=this.UpdateEdgeIntoAEL(t),t.OutIdx>=0&&this.AddOutPt(t,t.Bot),i={Dir:e,Left:r,Right:s},this.GetHorzDirection(t,i),e=i.Dir,r=i.Left,s=i.Right}if(t.OutIdx>=0&&h===null){h=this.GetLastOutPt(t);for(var m=this.m_SortedEdges;m!==null;){if(m.OutIdx>=0&&this.HorzSegmentsOverlap(t.Bot.X,t.Top.X,m.Bot.X,m.Top.X)){var y=this.GetLastOutPt(m);this.AddJoin(y,h,m.Top)}m=m.NextInSEL}this.AddGhostJoin(h,t.Top)}if(t.NextInLML!==null)if(t.OutIdx>=0){if(h=this.AddOutPt(t,t.Top),t=this.UpdateEdgeIntoAEL(t),t.WindDelta===0)return;var _=t.PrevInAEL,c=t.NextInAEL;if(_!==null&&_.Curr.X===t.Bot.X&&_.Curr.Y===t.Bot.Y&&_.WindDelta===0&&_.OutIdx>=0&&_.Curr.Y>_.Top.Y&&n.ClipperBase.SlopesEqual3(t,_,this.m_UseFullRange)){var y=this.AddOutPt(_,t.Bot);this.AddJoin(h,y,t.Top)}else if(c!==null&&c.Curr.X===t.Bot.X&&c.Curr.Y===t.Bot.Y&&c.WindDelta!==0&&c.OutIdx>=0&&c.Curr.Y>c.Top.Y&&n.ClipperBase.SlopesEqual3(t,c,this.m_UseFullRange)){var y=this.AddOutPt(c,t.Bot);this.AddJoin(h,y,t.Top)}}else t=this.UpdateEdgeIntoAEL(t);else t.OutIdx>=0&&this.AddOutPt(t,t.Top),this.DeleteFromAEL(t)},n.Clipper.prototype.GetNextInAEL=function(t,i){return i===n.Direction.dLeftToRight?t.NextInAEL:t.PrevInAEL},n.Clipper.prototype.IsMinima=function(t){return t!==null&&t.Prev.NextInLML!==t&&t.Next.NextInLML!==t},n.Clipper.prototype.IsMaxima=function(t,i){return t!==null&&t.Top.Y===i&&t.NextInLML===null},n.Clipper.prototype.IsIntermediate=function(t,i){return t.Top.Y===i&&t.NextInLML!==null},n.Clipper.prototype.GetMaximaPair=function(t){return n.IntPoint.op_Equality(t.Next.Top,t.Top)&&t.Next.NextInLML===null?t.Next:n.IntPoint.op_Equality(t.Prev.Top,t.Top)&&t.Prev.NextInLML===null?t.Prev:null},n.Clipper.prototype.GetMaximaPairEx=function(t){var i=this.GetMaximaPair(t);return i===null||i.OutIdx===n.ClipperBase.Skip||i.NextInAEL===i.PrevInAEL&&!n.ClipperBase.IsHorizontal(i)?null:i},n.Clipper.prototype.ProcessIntersections=function(t){if(this.m_ActiveEdges===null)return!0;try{if(this.BuildIntersectList(t),this.m_IntersectList.length===0)return!0;if(this.m_IntersectList.length===1||this.FixupIntersectionOrder())this.ProcessIntersectList();else return!1}catch{this.m_SortedEdges=null,this.m_IntersectList.length=0,n.Error("ProcessIntersections error")}return this.m_SortedEdges=null,!0},n.Clipper.prototype.BuildIntersectList=function(t){if(this.m_ActiveEdges!==null){var i=this.m_ActiveEdges;for(this.m_SortedEdges=i;i!==null;)i.PrevInSEL=i.PrevInAEL,i.NextInSEL=i.NextInAEL,i.Curr.X=n.Clipper.TopX(i,t),i=i.NextInAEL;for(var e=!0;e&&this.m_SortedEdges!==null;){for(e=!1,i=this.m_SortedEdges;i.NextInSEL!==null;){var r=i.NextInSEL,s=new n.IntPoint0;if(i.Curr.X>r.Curr.X){this.IntersectPoint(i,r,s),s.Y<t&&(s=new n.IntPoint2(n.Clipper.TopX(i,t),t));var l=new n.IntersectNode;l.Edge1=i,l.Edge2=r,l.Pt.X=s.X,l.Pt.Y=s.Y,n.use_xyz&&(l.Pt.Z=s.Z),this.m_IntersectList.push(l),this.SwapPositionsInSEL(i,r),e=!0}else i=r}if(i.PrevInSEL!==null)i.PrevInSEL.NextInSEL=null;else break}this.m_SortedEdges=null}},n.Clipper.prototype.EdgesAdjacent=function(t){return t.Edge1.NextInSEL===t.Edge2||t.Edge1.PrevInSEL===t.Edge2},n.Clipper.IntersectNodeSort=function(t,i){return i.Pt.Y-t.Pt.Y},n.Clipper.prototype.FixupIntersectionOrder=function(){this.m_IntersectList.sort(this.m_IntersectNodeComparer),this.CopyAELToSEL();for(var t=this.m_IntersectList.length,i=0;i<t;i++){if(!this.EdgesAdjacent(this.m_IntersectList[i])){for(var e=i+1;e<t&&!this.EdgesAdjacent(this.m_IntersectList[e]);)e++;if(e===t)return!1;var r=this.m_IntersectList[i];this.m_IntersectList[i]=this.m_IntersectList[e],this.m_IntersectList[e]=r}this.SwapPositionsInSEL(this.m_IntersectList[i].Edge1,this.m_IntersectList[i].Edge2)}return!0},n.Clipper.prototype.ProcessIntersectList=function(){for(var t=0,i=this.m_IntersectList.length;t<i;t++){var e=this.m_IntersectList[t];this.IntersectEdges(e.Edge1,e.Edge2,e.Pt),this.SwapPositionsInAEL(e.Edge1,e.Edge2)}this.m_IntersectList.length=0};var gi=function(t){return t<0?Math.ceil(t-.5):Math.round(t)},Wi=function(t){return t<0?Math.ceil(t-.5):Math.floor(t+.5)},Ri=function(t){return t<0?-Math.round(Math.abs(t)):Math.round(t)},Zi=function(t){return t<0?(t-=.5,t<-2147483648?Math.ceil(t):t|0):(t+=.5,t>2147483647?Math.floor(t):t|0)};d.msie?n.Clipper.Round=gi:d.chromium?n.Clipper.Round=Ri:d.safari?n.Clipper.Round=Zi:n.Clipper.Round=Wi,n.Clipper.TopX=function(t,i){return i===t.Top.Y?t.Top.X:t.Bot.X+n.Clipper.Round(t.Dx*(i-t.Bot.Y))},n.Clipper.prototype.IntersectPoint=function(t,i,e){e.X=0,e.Y=0;var r,s;if(t.Dx===i.Dx){e.Y=t.Curr.Y,e.X=n.Clipper.TopX(t,e.Y);return}if(t.Delta.X===0)e.X=t.Bot.X,n.ClipperBase.IsHorizontal(i)?e.Y=i.Bot.Y:(s=i.Bot.Y-i.Bot.X/i.Dx,e.Y=n.Clipper.Round(e.X/i.Dx+s));else if(i.Delta.X===0)e.X=i.Bot.X,n.ClipperBase.IsHorizontal(t)?e.Y=t.Bot.Y:(r=t.Bot.Y-t.Bot.X/t.Dx,e.Y=n.Clipper.Round(e.X/t.Dx+r));else{r=t.Bot.X-t.Bot.Y*t.Dx,s=i.Bot.X-i.Bot.Y*i.Dx;var l=(s-r)/(t.Dx-i.Dx);e.Y=n.Clipper.Round(l),Math.abs(t.Dx)<Math.abs(i.Dx)?e.X=n.Clipper.Round(t.Dx*l+r):e.X=n.Clipper.Round(i.Dx*l+s)}if(e.Y<t.Top.Y||e.Y<i.Top.Y){if(t.Top.Y>i.Top.Y)return e.Y=t.Top.Y,e.X=n.Clipper.TopX(i,t.Top.Y),e.X<t.Top.X;e.Y=i.Top.Y,Math.abs(t.Dx)<Math.abs(i.Dx)?e.X=n.Clipper.TopX(t,e.Y):e.X=n.Clipper.TopX(i,e.Y)}e.Y>t.Curr.Y&&(e.Y=t.Curr.Y,Math.abs(t.Dx)>Math.abs(i.Dx)?e.X=n.Clipper.TopX(i,e.Y):e.X=n.Clipper.TopX(t,e.Y))},n.Clipper.prototype.ProcessEdgesAtTopOfScanbeam=function(t){for(var i=this.m_ActiveEdges;i!==null;){var e=this.IsMaxima(i,t);if(e){var r=this.GetMaximaPairEx(i);e=r===null||!n.ClipperBase.IsHorizontal(r)}if(e){this.StrictlySimple&&this.InsertMaxima(i.Top.X);var s=i.PrevInAEL;this.DoMaxima(i),s===null?i=this.m_ActiveEdges:i=s.NextInAEL}else{if(this.IsIntermediate(i,t)&&n.ClipperBase.IsHorizontal(i.NextInLML)?(i=this.UpdateEdgeIntoAEL(i),i.OutIdx>=0&&this.AddOutPt(i,i.Bot),this.AddEdgeToSEL(i)):(i.Curr.X=n.Clipper.TopX(i,t),i.Curr.Y=t),n.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){var s=i.PrevInAEL;if(i.OutIdx>=0&&i.WindDelta!==0&&s!==null&&s.OutIdx>=0&&s.Curr.X===i.Curr.X&&s.WindDelta!==0){var l=new n.IntPoint1(i.Curr);n.use_xyz&&this.SetZ(l,s,i);var o=this.AddOutPt(s,l),u=this.AddOutPt(i,l);this.AddJoin(o,u,l)}}i=i.NextInAEL}}for(this.ProcessHorizontals(),this.m_Maxima=null,i=this.m_ActiveEdges;i!==null;){if(this.IsIntermediate(i,t)){var o=null;i.OutIdx>=0&&(o=this.AddOutPt(i,i.Top)),i=this.UpdateEdgeIntoAEL(i);var s=i.PrevInAEL,f=i.NextInAEL;if(s!==null&&s.Curr.X===i.Bot.X&&s.Curr.Y===i.Bot.Y&&o!==null&&s.OutIdx>=0&&s.Curr.Y===s.Top.Y&&n.ClipperBase.SlopesEqual5(i.Curr,i.Top,s.Curr,s.Top,this.m_UseFullRange)&&i.WindDelta!==0&&s.WindDelta!==0){var u=this.AddOutPt(ePrev2,i.Bot);this.AddJoin(o,u,i.Top)}else if(f!==null&&f.Curr.X===i.Bot.X&&f.Curr.Y===i.Bot.Y&&o!==null&&f.OutIdx>=0&&f.Curr.Y===f.Top.Y&&n.ClipperBase.SlopesEqual5(i.Curr,i.Top,f.Curr,f.Top,this.m_UseFullRange)&&i.WindDelta!==0&&f.WindDelta!==0){var u=this.AddOutPt(f,i.Bot);this.AddJoin(o,u,i.Top)}}i=i.NextInAEL}},n.Clipper.prototype.DoMaxima=function(t){var i=this.GetMaximaPairEx(t);if(i===null){t.OutIdx>=0&&this.AddOutPt(t,t.Top),this.DeleteFromAEL(t);return}for(var e=t.NextInAEL;e!==null&&e!==i;)this.IntersectEdges(t,e,t.Top),this.SwapPositionsInAEL(t,e),e=t.NextInAEL;t.OutIdx===-1&&i.OutIdx===-1?(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)):n.use_lines&&t.WindDelta===0?(t.OutIdx>=0&&(this.AddOutPt(t,t.Top),t.OutIdx=n.ClipperBase.Unassigned),this.DeleteFromAEL(t),i.OutIdx>=0&&(this.AddOutPt(i,t.Top),i.OutIdx=n.ClipperBase.Unassigned),this.DeleteFromAEL(i)):n.Error("DoMaxima error")},n.Clipper.ReversePaths=function(t){for(var i=0,e=t.length;i<e;i++)t[i].reverse()},n.Clipper.Orientation=function(t){return n.Clipper.Area(t)>=0},n.Clipper.prototype.PointCount=function(t){if(t===null)return 0;var i=0,e=t;do i++,e=e.Next;while(e!==t);return i},n.Clipper.prototype.BuildResult=function(t){n.Clear(t);for(var i=0,e=this.m_PolyOuts.length;i<e;i++){var r=this.m_PolyOuts[i];if(r.Pts!==null){var s=r.Pts.Prev,l=this.PointCount(s);if(!(l<2)){for(var o=new Array(l),u=0;u<l;u++)o[u]=s.Pt,s=s.Prev;t.push(o)}}}},n.Clipper.prototype.BuildResult2=function(t){t.Clear();for(var i=0,e=this.m_PolyOuts.length;i<e;i++){var r=this.m_PolyOuts[i],s=this.PointCount(r.Pts);if(!(r.IsOpen&&s<2||!r.IsOpen&&s<3)){this.FixHoleLinkage(r);var l=new n.PolyNode;t.m_AllPolys.push(l),r.PolyNode=l,l.m_polygon.length=s;for(var o=r.Pts.Prev,u=0;u<s;u++)l.m_polygon[u]=o.Pt,o=o.Prev}}for(var i=0,e=this.m_PolyOuts.length;i<e;i++){var r=this.m_PolyOuts[i];r.PolyNode!==null&&(r.IsOpen?(r.PolyNode.IsOpen=!0,t.AddChild(r.PolyNode)):r.FirstLeft!==null&&r.FirstLeft.PolyNode!==null?r.FirstLeft.PolyNode.AddChild(r.PolyNode):t.AddChild(r.PolyNode))}},n.Clipper.prototype.FixupOutPolyline=function(t){for(var i=t.Pts,e=i.Prev;i!==e;)if(i=i.Next,n.IntPoint.op_Equality(i.Pt,i.Prev.Pt)){i===e&&(e=i.Prev);var r=i.Prev;r.Next=i.Next,i.Next.Prev=r,i=r}i===i.Prev&&(t.Pts=null)},n.Clipper.prototype.FixupOutPolygon=function(t){var i=null;t.BottomPt=null;for(var e=t.Pts,r=this.PreserveCollinear||this.StrictlySimple;;){if(e.Prev===e||e.Prev===e.Next){t.Pts=null;return}if(n.IntPoint.op_Equality(e.Pt,e.Next.Pt)||n.IntPoint.op_Equality(e.Pt,e.Prev.Pt)||n.ClipperBase.SlopesEqual4(e.Prev.Pt,e.Pt,e.Next.Pt,this.m_UseFullRange)&&(!r||!this.Pt2IsBetweenPt1AndPt3(e.Prev.Pt,e.Pt,e.Next.Pt)))i=null,e.Prev.Next=e.Next,e.Next.Prev=e.Prev,e=e.Prev;else{if(e===i)break;i===null&&(i=e),e=e.Next}}t.Pts=e},n.Clipper.prototype.DupOutPt=function(t,i){var e=new n.OutPt;return e.Pt.X=t.Pt.X,e.Pt.Y=t.Pt.Y,n.use_xyz&&(e.Pt.Z=t.Pt.Z),e.Idx=t.Idx,i?(e.Next=t.Next,e.Prev=t,t.Next.Prev=e,t.Next=e):(e.Prev=t.Prev,e.Next=t,t.Prev.Next=e,t.Prev=e),e},n.Clipper.prototype.GetOverlap=function(t,i,e,r,s){return t<i?e<r?(s.Left=Math.max(t,e),s.Right=Math.min(i,r)):(s.Left=Math.max(t,r),s.Right=Math.min(i,e)):e<r?(s.Left=Math.max(i,e),s.Right=Math.min(t,r)):(s.Left=Math.max(i,r),s.Right=Math.min(t,e)),s.Left<s.Right},n.Clipper.prototype.JoinHorz=function(t,i,e,r,s,l){var o=t.Pt.X>i.Pt.X?n.Direction.dRightToLeft:n.Direction.dLeftToRight,u=e.Pt.X>r.Pt.X?n.Direction.dRightToLeft:n.Direction.dLeftToRight;if(o===u)return!1;if(o===n.Direction.dLeftToRight){for(;t.Next.Pt.X<=s.X&&t.Next.Pt.X>=t.Pt.X&&t.Next.Pt.Y===s.Y;)t=t.Next;l&&t.Pt.X!==s.X&&(t=t.Next),i=this.DupOutPt(t,!l),n.IntPoint.op_Inequality(i.Pt,s)&&(t=i,t.Pt.X=s.X,t.Pt.Y=s.Y,n.use_xyz&&(t.Pt.Z=s.Z),i=this.DupOutPt(t,!l))}else{for(;t.Next.Pt.X>=s.X&&t.Next.Pt.X<=t.Pt.X&&t.Next.Pt.Y===s.Y;)t=t.Next;!l&&t.Pt.X!==s.X&&(t=t.Next),i=this.DupOutPt(t,l),n.IntPoint.op_Inequality(i.Pt,s)&&(t=i,t.Pt.X=s.X,t.Pt.Y=s.Y,n.use_xyz&&(t.Pt.Z=s.Z),i=this.DupOutPt(t,l))}if(u===n.Direction.dLeftToRight){for(;e.Next.Pt.X<=s.X&&e.Next.Pt.X>=e.Pt.X&&e.Next.Pt.Y===s.Y;)e=e.Next;l&&e.Pt.X!==s.X&&(e=e.Next),r=this.DupOutPt(e,!l),n.IntPoint.op_Inequality(r.Pt,s)&&(e=r,e.Pt.X=s.X,e.Pt.Y=s.Y,n.use_xyz&&(e.Pt.Z=s.Z),r=this.DupOutPt(e,!l))}else{for(;e.Next.Pt.X>=s.X&&e.Next.Pt.X<=e.Pt.X&&e.Next.Pt.Y===s.Y;)e=e.Next;!l&&e.Pt.X!==s.X&&(e=e.Next),r=this.DupOutPt(e,l),n.IntPoint.op_Inequality(r.Pt,s)&&(e=r,e.Pt.X=s.X,e.Pt.Y=s.Y,n.use_xyz&&(e.Pt.Z=s.Z),r=this.DupOutPt(e,l))}return o===n.Direction.dLeftToRight===l?(t.Prev=e,e.Next=t,i.Next=r,r.Prev=i):(t.Next=e,e.Prev=t,i.Prev=r,r.Next=i),!0},n.Clipper.prototype.JoinPoints=function(t,i,e){var r=t.OutPt1,s=new n.OutPt,l=t.OutPt2,o=new n.OutPt,u=t.OutPt1.Pt.Y===t.OffPt.Y;if(u&&n.IntPoint.op_Equality(t.OffPt,t.OutPt1.Pt)&&n.IntPoint.op_Equality(t.OffPt,t.OutPt2.Pt)){if(i!==e)return!1;for(s=t.OutPt1.Next;s!==r&&n.IntPoint.op_Equality(s.Pt,t.OffPt);)s=s.Next;var f=s.Pt.Y>t.OffPt.Y;for(o=t.OutPt2.Next;o!==l&&n.IntPoint.op_Equality(o.Pt,t.OffPt);)o=o.Next;var h=o.Pt.Y>t.OffPt.Y;return f===h?!1:f?(s=this.DupOutPt(r,!1),o=this.DupOutPt(l,!0),r.Prev=l,l.Next=r,s.Next=o,o.Prev=s,t.OutPt1=r,t.OutPt2=s,!0):(s=this.DupOutPt(r,!0),o=this.DupOutPt(l,!1),r.Next=l,l.Prev=r,s.Prev=o,o.Next=s,t.OutPt1=r,t.OutPt2=s,!0)}else if(u){for(s=r;r.Prev.Pt.Y===r.Pt.Y&&r.Prev!==s&&r.Prev!==l;)r=r.Prev;for(;s.Next.Pt.Y===s.Pt.Y&&s.Next!==r&&s.Next!==l;)s=s.Next;if(s.Next===r||s.Next===l)return!1;for(o=l;l.Prev.Pt.Y===l.Pt.Y&&l.Prev!==o&&l.Prev!==s;)l=l.Prev;for(;o.Next.Pt.Y===o.Pt.Y&&o.Next!==l&&o.Next!==r;)o=o.Next;if(o.Next===l||o.Next===r)return!1;var P={Left:null,Right:null};if(!this.GetOverlap(r.Pt.X,s.Pt.X,l.Pt.X,o.Pt.X,P))return!1;var a=P.Left,m=P.Right,y=new n.IntPoint0,C;return r.Pt.X>=a&&r.Pt.X<=m?(y.X=r.Pt.X,y.Y=r.Pt.Y,n.use_xyz&&(y.Z=r.Pt.Z),C=r.Pt.X>s.Pt.X):l.Pt.X>=a&&l.Pt.X<=m?(y.X=l.Pt.X,y.Y=l.Pt.Y,n.use_xyz&&(y.Z=l.Pt.Z),C=l.Pt.X>o.Pt.X):s.Pt.X>=a&&s.Pt.X<=m?(y.X=s.Pt.X,y.Y=s.Pt.Y,n.use_xyz&&(y.Z=s.Pt.Z),C=s.Pt.X>r.Pt.X):(y.X=o.Pt.X,y.Y=o.Pt.Y,n.use_xyz&&(y.Z=o.Pt.Z),C=o.Pt.X>l.Pt.X),t.OutPt1=r,t.OutPt2=l,this.JoinHorz(r,s,l,o,y,C)}else{for(s=r.Next;n.IntPoint.op_Equality(s.Pt,r.Pt)&&s!==r;)s=s.Next;var c=s.Pt.Y>r.Pt.Y||!n.ClipperBase.SlopesEqual4(r.Pt,s.Pt,t.OffPt,this.m_UseFullRange);if(c){for(s=r.Prev;n.IntPoint.op_Equality(s.Pt,r.Pt)&&s!==r;)s=s.Prev;if(s.Pt.Y>r.Pt.Y||!n.ClipperBase.SlopesEqual4(r.Pt,s.Pt,t.OffPt,this.m_UseFullRange))return!1}for(o=l.Next;n.IntPoint.op_Equality(o.Pt,l.Pt)&&o!==l;)o=o.Next;var _=o.Pt.Y>l.Pt.Y||!n.ClipperBase.SlopesEqual4(l.Pt,o.Pt,t.OffPt,this.m_UseFullRange);if(_){for(o=l.Prev;n.IntPoint.op_Equality(o.Pt,l.Pt)&&o!==l;)o=o.Prev;if(o.Pt.Y>l.Pt.Y||!n.ClipperBase.SlopesEqual4(l.Pt,o.Pt,t.OffPt,this.m_UseFullRange))return!1}return s===r||o===l||s===o||i===e&&c===_?!1:c?(s=this.DupOutPt(r,!1),o=this.DupOutPt(l,!0),r.Prev=l,l.Next=r,s.Next=o,o.Prev=s,t.OutPt1=r,t.OutPt2=s,!0):(s=this.DupOutPt(r,!0),o=this.DupOutPt(l,!1),r.Next=l,l.Prev=r,s.Prev=o,o.Next=s,t.OutPt1=r,t.OutPt2=s,!0)}},n.Clipper.GetBounds=function(t){for(var i=0,e=t.length;i<e&&t[i].length===0;)i++;if(i===e)return new n.IntRect(0,0,0,0);var r=new n.IntRect;for(r.left=t[i][0].X,r.right=r.left,r.top=t[i][0].Y,r.bottom=r.top;i<e;i++)for(var s=0,l=t[i].length;s<l;s++)t[i][s].X<r.left?r.left=t[i][s].X:t[i][s].X>r.right&&(r.right=t[i][s].X),t[i][s].Y<r.top?r.top=t[i][s].Y:t[i][s].Y>r.bottom&&(r.bottom=t[i][s].Y);return r},n.Clipper.prototype.GetBounds2=function(t){var i=t,e=new n.IntRect;for(e.left=t.Pt.X,e.right=t.Pt.X,e.top=t.Pt.Y,e.bottom=t.Pt.Y,t=t.Next;t!==i;)t.Pt.X<e.left&&(e.left=t.Pt.X),t.Pt.X>e.right&&(e.right=t.Pt.X),t.Pt.Y<e.top&&(e.top=t.Pt.Y),t.Pt.Y>e.bottom&&(e.bottom=t.Pt.Y),t=t.Next;return e},n.Clipper.PointInPolygon=function(t,i){var e=0,r=i.length;if(r<3)return 0;for(var s=i[0],l=1;l<=r;++l){var o=l===r?i[0]:i[l];if(o.Y===t.Y&&(o.X===t.X||s.Y===t.Y&&o.X>t.X==s.X<t.X))return-1;if(s.Y<t.Y!=o.Y<t.Y){if(s.X>=t.X)if(o.X>t.X)e=1-e;else{var u=(s.X-t.X)*(o.Y-t.Y)-(o.X-t.X)*(s.Y-t.Y);if(u===0)return-1;u>0==o.Y>s.Y&&(e=1-e)}else if(o.X>t.X){var u=(s.X-t.X)*(o.Y-t.Y)-(o.X-t.X)*(s.Y-t.Y);if(u===0)return-1;u>0==o.Y>s.Y&&(e=1-e)}}s=o}return e},n.Clipper.prototype.PointInPolygon=function(t,i){var e=0,r=i,s=t.X,l=t.Y,o=i.Pt.X,u=i.Pt.Y;do{i=i.Next;var f=i.Pt.X,h=i.Pt.Y;if(h===l&&(f===s||u===l&&f>s==o<s))return-1;if(u<l!=h<l){if(o>=s)if(f>s)e=1-e;else{var P=(o-s)*(h-l)-(f-s)*(u-l);if(P===0)return-1;P>0==h>u&&(e=1-e)}else if(f>s){var P=(o-s)*(h-l)-(f-s)*(u-l);if(P===0)return-1;P>0==h>u&&(e=1-e)}}o=f,u=h}while(r!==i);return e},n.Clipper.prototype.Poly2ContainsPoly1=function(t,i){var e=t;do{var r=this.PointInPolygon(e.Pt,i);if(r>=0)return r>0;e=e.Next}while(e!==t);return!0},n.Clipper.prototype.FixupFirstLefts1=function(t,i){for(var e,r,s=0,l=this.m_PolyOuts.length;s<l;s++)e=this.m_PolyOuts[s],r=n.Clipper.ParseFirstLeft(e.FirstLeft),e.Pts!==null&&r===t&&this.Poly2ContainsPoly1(e.Pts,i.Pts)&&(e.FirstLeft=i)},n.Clipper.prototype.FixupFirstLefts2=function(t,i){for(var e=i.FirstLeft,r,s,l=0,o=this.m_PolyOuts.length;l<o;l++)r=this.m_PolyOuts[l],!(r.Pts===null||r===i||r===t)&&(s=n.Clipper.ParseFirstLeft(r.FirstLeft),!(s!==e&&s!==t&&s!==i)&&(this.Poly2ContainsPoly1(r.Pts,t.Pts)?r.FirstLeft=t:this.Poly2ContainsPoly1(r.Pts,i.Pts)?r.FirstLeft=i:(r.FirstLeft===t||r.FirstLeft===i)&&(r.FirstLeft=e)))},n.Clipper.prototype.FixupFirstLefts3=function(t,i){for(var e,r,s=0,l=this.m_PolyOuts.length;s<l;s++)e=this.m_PolyOuts[s],r=n.Clipper.ParseFirstLeft(e.FirstLeft),e.Pts!==null&&r===t&&(e.FirstLeft=i)},n.Clipper.ParseFirstLeft=function(t){for(;t!==null&&t.Pts===null;)t=t.FirstLeft;return t},n.Clipper.prototype.JoinCommonEdges=function(){for(var t=0,i=this.m_Joins.length;t<i;t++){var e=this.m_Joins[t],r=this.GetOutRec(e.OutPt1.Idx),s=this.GetOutRec(e.OutPt2.Idx);if(!(r.Pts===null||s.Pts===null)&&!(r.IsOpen||s.IsOpen)){var l;r===s?l=r:this.OutRec1RightOfOutRec2(r,s)?l=s:this.OutRec1RightOfOutRec2(s,r)?l=r:l=this.GetLowermostRec(r,s),this.JoinPoints(e,r,s)&&(r===s?(r.Pts=e.OutPt1,r.BottomPt=null,s=this.CreateOutRec(),s.Pts=e.OutPt2,this.UpdateOutPtIdxs(s),this.Poly2ContainsPoly1(s.Pts,r.Pts)?(s.IsHole=!r.IsHole,s.FirstLeft=r,this.m_UsingPolyTree&&this.FixupFirstLefts2(s,r),(s.IsHole^this.ReverseSolution)==this.Area$1(s)>0&&this.ReversePolyPtLinks(s.Pts)):this.Poly2ContainsPoly1(r.Pts,s.Pts)?(s.IsHole=r.IsHole,r.IsHole=!s.IsHole,s.FirstLeft=r.FirstLeft,r.FirstLeft=s,this.m_UsingPolyTree&&this.FixupFirstLefts2(r,s),(r.IsHole^this.ReverseSolution)==this.Area$1(r)>0&&this.ReversePolyPtLinks(r.Pts)):(s.IsHole=r.IsHole,s.FirstLeft=r.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(r,s))):(s.Pts=null,s.BottomPt=null,s.Idx=r.Idx,r.IsHole=l.IsHole,l===s&&(r.FirstLeft=s.FirstLeft),s.FirstLeft=r,this.m_UsingPolyTree&&this.FixupFirstLefts3(s,r)))}}},n.Clipper.prototype.UpdateOutPtIdxs=function(t){var i=t.Pts;do i.Idx=t.Idx,i=i.Prev;while(i!==t.Pts)},n.Clipper.prototype.DoSimplePolygons=function(){for(var t=0;t<this.m_PolyOuts.length;){var i=this.m_PolyOuts[t++],e=i.Pts;if(!(e===null||i.IsOpen))do{for(var r=e.Next;r!==i.Pts;){if(n.IntPoint.op_Equality(e.Pt,r.Pt)&&r.Next!==e&&r.Prev!==e){var s=e.Prev,l=r.Prev;e.Prev=l,l.Next=e,r.Prev=s,s.Next=r,i.Pts=e;var o=this.CreateOutRec();o.Pts=r,this.UpdateOutPtIdxs(o),this.Poly2ContainsPoly1(o.Pts,i.Pts)?(o.IsHole=!i.IsHole,o.FirstLeft=i,this.m_UsingPolyTree&&this.FixupFirstLefts2(o,i)):this.Poly2ContainsPoly1(i.Pts,o.Pts)?(o.IsHole=i.IsHole,i.IsHole=!o.IsHole,o.FirstLeft=i.FirstLeft,i.FirstLeft=o,this.m_UsingPolyTree&&this.FixupFirstLefts2(i,o)):(o.IsHole=i.IsHole,o.FirstLeft=i.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(i,o)),r=e}r=r.Next}e=e.Next}while(e!==i.Pts)}},n.Clipper.Area=function(t){if(!Array.isArray(t))return 0;var i=t.length;if(i<3)return 0;for(var e=0,r=0,s=i-1;r<i;++r)e+=(t[s].X+t[r].X)*(t[s].Y-t[r].Y),s=r;return-e*.5},n.Clipper.prototype.Area=function(t){var i=t;if(t===null)return 0;var e=0;do e=e+(t.Prev.Pt.X+t.Pt.X)*(t.Prev.Pt.Y-t.Pt.Y),t=t.Next;while(t!==i);return e*.5},n.Clipper.prototype.Area$1=function(t){return this.Area(t.Pts)},n.Clipper.SimplifyPolygon=function(t,i){var e=new Array,r=new n.Clipper(0);return r.StrictlySimple=!0,r.AddPath(t,n.PolyType.ptSubject,!0),r.Execute(n.ClipType.ctUnion,e,i,i),e},n.Clipper.SimplifyPolygons=function(t,i){typeof i>"u"&&(i=n.PolyFillType.pftEvenOdd);var e=new Array,r=new n.Clipper(0);return r.StrictlySimple=!0,r.AddPaths(t,n.PolyType.ptSubject,!0),r.Execute(n.ClipType.ctUnion,e,i,i),e},n.Clipper.DistanceSqrd=function(t,i){var e=t.X-i.X,r=t.Y-i.Y;return e*e+r*r},n.Clipper.DistanceFromLineSqrd=function(t,i,e){var r=i.Y-e.Y,s=e.X-i.X,l=r*i.X+s*i.Y;return l=r*t.X+s*t.Y-l,l*l/(r*r+s*s)},n.Clipper.SlopesNearCollinear=function(t,i,e,r){return Math.abs(t.X-i.X)>Math.abs(t.Y-i.Y)?t.X>i.X==t.X<e.X?n.Clipper.DistanceFromLineSqrd(t,i,e)<r:i.X>t.X==i.X<e.X?n.Clipper.DistanceFromLineSqrd(i,t,e)<r:n.Clipper.DistanceFromLineSqrd(e,t,i)<r:t.Y>i.Y==t.Y<e.Y?n.Clipper.DistanceFromLineSqrd(t,i,e)<r:i.Y>t.Y==i.Y<e.Y?n.Clipper.DistanceFromLineSqrd(i,t,e)<r:n.Clipper.DistanceFromLineSqrd(e,t,i)<r},n.Clipper.PointsAreClose=function(t,i,e){var r=t.X-i.X,s=t.Y-i.Y;return r*r+s*s<=e},n.Clipper.ExcludeOp=function(t){var i=t.Prev;return i.Next=t.Next,t.Next.Prev=i,i.Idx=0,i},n.Clipper.CleanPolygon=function(t,i){typeof i>"u"&&(i=1.415);var e=t.length;if(e===0)return new Array;for(var r=new Array(e),s=0;s<e;++s)r[s]=new n.OutPt;for(var s=0;s<e;++s)r[s].Pt=t[s],r[s].Next=r[(s+1)%e],r[s].Next.Prev=r[s],r[s].Idx=0;for(var l=i*i,o=r[0];o.Idx===0&&o.Next!==o.Prev;)n.Clipper.PointsAreClose(o.Pt,o.Prev.Pt,l)?(o=n.Clipper.ExcludeOp(o),e--):n.Clipper.PointsAreClose(o.Prev.Pt,o.Next.Pt,l)?(n.Clipper.ExcludeOp(o.Next),o=n.Clipper.ExcludeOp(o),e-=2):n.Clipper.SlopesNearCollinear(o.Prev.Pt,o.Pt,o.Next.Pt,l)?(o=n.Clipper.ExcludeOp(o),e--):(o.Idx=1,o=o.Next);e<3&&(e=0);for(var u=new Array(e),s=0;s<e;++s)u[s]=new n.IntPoint1(o.Pt),o=o.Next;return r=null,u},n.Clipper.CleanPolygons=function(t,i){for(var e=new Array(t.length),r=0,s=t.length;r<s;r++)e[r]=n.Clipper.CleanPolygon(t[r],i);return e},n.Clipper.Minkowski=function(t,i,e,r){var s=r?1:0,l=t.length,o=i.length,u=new Array;if(e)for(var f=0;f<o;f++){for(var h=new Array(l),P=0,a=t.length,m=t[P];P<a;P++,m=t[P])h[P]=new n.IntPoint2(i[f].X+m.X,i[f].Y+m.Y);u.push(h)}else for(var f=0;f<o;f++){for(var h=new Array(l),P=0,a=t.length,m=t[P];P<a;P++,m=t[P])h[P]=new n.IntPoint2(i[f].X-m.X,i[f].Y-m.Y);u.push(h)}for(var y=new Array,f=0;f<o-1+s;f++)for(var P=0;P<l;P++){var C=new Array;C.push(u[f%o][P%l]),C.push(u[(f+1)%o][P%l]),C.push(u[(f+1)%o][(P+1)%l]),C.push(u[f%o][(P+1)%l]),n.Clipper.Orientation(C)||C.reverse(),y.push(C)}return y},n.Clipper.MinkowskiSum=function(t,i,e){if(i[0]instanceof Array){for(var s=i,o=new n.Paths,l=new n.Clipper,u=0;u<s.length;++u){var f=n.Clipper.Minkowski(t,s[u],!0,e);if(l.AddPaths(f,n.PolyType.ptSubject,!0),e){var r=n.Clipper.TranslatePath(s[u],t[0]);l.AddPath(r,n.PolyType.ptClip,!0)}}return l.Execute(n.ClipType.ctUnion,o,n.PolyFillType.pftNonZero,n.PolyFillType.pftNonZero),o}else{var r=i,s=n.Clipper.Minkowski(t,r,!0,e),l=new n.Clipper;return l.AddPaths(s,n.PolyType.ptSubject,!0),l.Execute(n.ClipType.ctUnion,s,n.PolyFillType.pftNonZero,n.PolyFillType.pftNonZero),s}},n.Clipper.TranslatePath=function(t,i){for(var e=new n.Path,r=0;r<t.length;r++)e.push(new n.IntPoint2(t[r].X+i.X,t[r].Y+i.Y));return e},n.Clipper.MinkowskiDiff=function(t,i){var e=n.Clipper.Minkowski(t,i,!1,!0),r=new n.Clipper;return r.AddPaths(e,n.PolyType.ptSubject,!0),r.Execute(n.ClipType.ctUnion,e,n.PolyFillType.pftNonZero,n.PolyFillType.pftNonZero),e},n.Clipper.PolyTreeToPaths=function(t){var i=new Array;return n.Clipper.AddPolyNodeToPaths(t,n.Clipper.NodeType.ntAny,i),i},n.Clipper.AddPolyNodeToPaths=function(t,i,e){var r=!0;switch(i){case n.Clipper.NodeType.ntOpen:return;case n.Clipper.NodeType.ntClosed:r=!t.IsOpen;break}t.m_polygon.length>0&&r&&e.push(t.m_polygon);for(var s=0,l=t.Childs(),o=l.length,u=l[s];s<o;s++,u=l[s])n.Clipper.AddPolyNodeToPaths(u,i,e)},n.Clipper.OpenPathsFromPolyTree=function(t){for(var i=new n.Paths,e=0,r=t.ChildCount();e<r;e++)t.Childs()[e].IsOpen&&i.push(t.Childs()[e].m_polygon);return i},n.Clipper.ClosedPathsFromPolyTree=function(t){var i=new n.Paths;return n.Clipper.AddPolyNodeToPaths(t,n.Clipper.NodeType.ntClosed,i),i},z(n.Clipper,n.ClipperBase),n.Clipper.NodeType={ntAny:0,ntOpen:1,ntClosed:2},n.ClipperOffset=function(t,i){typeof t>"u"&&(t=2),typeof i>"u"&&(i=n.ClipperOffset.def_arc_tolerance),this.m_destPolys=new n.Paths,this.m_srcPoly=new n.Path,this.m_destPoly=new n.Path,this.m_normals=new Array,this.m_delta=0,this.m_sinA=0,this.m_sin=0,this.m_cos=0,this.m_miterLim=0,this.m_StepsPerRad=0,this.m_lowest=new n.IntPoint0,this.m_polyNodes=new n.PolyNode,this.MiterLimit=t,this.ArcTolerance=i,this.m_lowest.X=-1},n.ClipperOffset.two_pi=6.28318530717959,n.ClipperOffset.def_arc_tolerance=.25,n.ClipperOffset.prototype.Clear=function(){n.Clear(this.m_polyNodes.Childs()),this.m_lowest.X=-1},n.ClipperOffset.Round=n.Clipper.Round,n.ClipperOffset.prototype.AddPath=function(t,i,e){var r=t.length-1;if(!(r<0)){var s=new n.PolyNode;if(s.m_jointype=i,s.m_endtype=e,e===n.EndType.etClosedLine||e===n.EndType.etClosedPolygon)for(;r>0&&n.IntPoint.op_Equality(t[0],t[r]);)r--;s.m_polygon.push(t[0]);for(var l=0,o=0,u=1;u<=r;u++)n.IntPoint.op_Inequality(s.m_polygon[l],t[u])&&(l++,s.m_polygon.push(t[u]),(t[u].Y>s.m_polygon[o].Y||t[u].Y===s.m_polygon[o].Y&&t[u].X<s.m_polygon[o].X)&&(o=l));if(!(e===n.EndType.etClosedPolygon&&l<2)&&(this.m_polyNodes.AddChild(s),e===n.EndType.etClosedPolygon))if(this.m_lowest.X<0)this.m_lowest=new n.IntPoint2(this.m_polyNodes.ChildCount()-1,o);else{var f=this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon[this.m_lowest.Y];(s.m_polygon[o].Y>f.Y||s.m_polygon[o].Y===f.Y&&s.m_polygon[o].X<f.X)&&(this.m_lowest=new n.IntPoint2(this.m_polyNodes.ChildCount()-1,o))}}},n.ClipperOffset.prototype.AddPaths=function(t,i,e){for(var r=0,s=t.length;r<s;r++)this.AddPath(t[r],i,e)},n.ClipperOffset.prototype.FixOrientations=function(){if(this.m_lowest.X>=0&&!n.Clipper.Orientation(this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon))for(var t=0;t<this.m_polyNodes.ChildCount();t++){var i=this.m_polyNodes.Childs()[t];(i.m_endtype===n.EndType.etClosedPolygon||i.m_endtype===n.EndType.etClosedLine&&n.Clipper.Orientation(i.m_polygon))&&i.m_polygon.reverse()}else for(var t=0;t<this.m_polyNodes.ChildCount();t++){var i=this.m_polyNodes.Childs()[t];i.m_endtype===n.EndType.etClosedLine&&!n.Clipper.Orientation(i.m_polygon)&&i.m_polygon.reverse()}},n.ClipperOffset.GetUnitNormal=function(t,i){var e=i.X-t.X,r=i.Y-t.Y;if(e===0&&r===0)return new n.DoublePoint2(0,0);var s=1/Math.sqrt(e*e+r*r);return e*=s,r*=s,new n.DoublePoint2(r,-e)},n.ClipperOffset.prototype.DoOffset=function(t){if(this.m_destPolys=new Array,this.m_delta=t,n.ClipperBase.near_zero(t)){for(var i=0;i<this.m_polyNodes.ChildCount();i++){var e=this.m_polyNodes.Childs()[i];e.m_endtype===n.EndType.etClosedPolygon&&this.m_destPolys.push(e.m_polygon)}return}this.MiterLimit>2?this.m_miterLim=2/(this.MiterLimit*this.MiterLimit):this.m_miterLim=.5;var r;this.ArcTolerance<=0?r=n.ClipperOffset.def_arc_tolerance:this.ArcTolerance>Math.abs(t)*n.ClipperOffset.def_arc_tolerance?r=Math.abs(t)*n.ClipperOffset.def_arc_tolerance:r=this.ArcTolerance;var s=3.14159265358979/Math.acos(1-r/Math.abs(t));this.m_sin=Math.sin(n.ClipperOffset.two_pi/s),this.m_cos=Math.cos(n.ClipperOffset.two_pi/s),this.m_StepsPerRad=s/n.ClipperOffset.two_pi,t<0&&(this.m_sin=-this.m_sin);for(var i=0;i<this.m_polyNodes.ChildCount();i++){var e=this.m_polyNodes.Childs()[i];this.m_srcPoly=e.m_polygon;var l=this.m_srcPoly.length;if(!(l===0||t<=0&&(l<3||e.m_endtype!==n.EndType.etClosedPolygon))){if(this.m_destPoly=new Array,l===1){if(e.m_jointype===n.JoinType.jtRound)for(var o=1,u=0,f=1;f<=s;f++){this.m_destPoly.push(new n.IntPoint2(n.ClipperOffset.Round(this.m_srcPoly[0].X+o*t),n.ClipperOffset.Round(this.m_srcPoly[0].Y+u*t)));var h=o;o=o*this.m_cos-this.m_sin*u,u=h*this.m_sin+u*this.m_cos}else for(var o=-1,u=-1,f=0;f<4;++f)this.m_destPoly.push(new n.IntPoint2(n.ClipperOffset.Round(this.m_srcPoly[0].X+o*t),n.ClipperOffset.Round(this.m_srcPoly[0].Y+u*t))),o<0?o=1:u<0?u=1:o=-1;this.m_destPolys.push(this.m_destPoly);continue}this.m_normals.length=0;for(var f=0;f<l-1;f++)this.m_normals.push(n.ClipperOffset.GetUnitNormal(this.m_srcPoly[f],this.m_srcPoly[f+1]));if(e.m_endtype===n.EndType.etClosedLine||e.m_endtype===n.EndType.etClosedPolygon?this.m_normals.push(n.ClipperOffset.GetUnitNormal(this.m_srcPoly[l-1],this.m_srcPoly[0])):this.m_normals.push(new n.DoublePoint1(this.m_normals[l-2])),e.m_endtype===n.EndType.etClosedPolygon){for(var P=l-1,f=0;f<l;f++)P=this.OffsetPoint(f,P,e.m_jointype);this.m_destPolys.push(this.m_destPoly)}else if(e.m_endtype===n.EndType.etClosedLine){for(var P=l-1,f=0;f<l;f++)P=this.OffsetPoint(f,P,e.m_jointype);this.m_destPolys.push(this.m_destPoly),this.m_destPoly=new Array;for(var a=this.m_normals[l-1],f=l-1;f>0;f--)this.m_normals[f]=new n.DoublePoint2(-this.m_normals[f-1].X,-this.m_normals[f-1].Y);this.m_normals[0]=new n.DoublePoint2(-a.X,-a.Y),P=0;for(var f=l-1;f>=0;f--)P=this.OffsetPoint(f,P,e.m_jointype);this.m_destPolys.push(this.m_destPoly)}else{for(var P=0,f=1;f<l-1;++f)P=this.OffsetPoint(f,P,e.m_jointype);var m;if(e.m_endtype===n.EndType.etOpenButt){var f=l-1;m=new n.IntPoint2(n.ClipperOffset.Round(this.m_srcPoly[f].X+this.m_normals[f].X*t),n.ClipperOffset.Round(this.m_srcPoly[f].Y+this.m_normals[f].Y*t)),this.m_destPoly.push(m),m=new n.IntPoint2(n.ClipperOffset.Round(this.m_srcPoly[f].X-this.m_normals[f].X*t),n.ClipperOffset.Round(this.m_srcPoly[f].Y-this.m_normals[f].Y*t)),this.m_destPoly.push(m)}else{var f=l-1;P=l-2,this.m_sinA=0,this.m_normals[f]=new n.DoublePoint2(-this.m_normals[f].X,-this.m_normals[f].Y),e.m_endtype===n.EndType.etOpenSquare?this.DoSquare(f,P):this.DoRound(f,P)}for(var f=l-1;f>0;f--)this.m_normals[f]=new n.DoublePoint2(-this.m_normals[f-1].X,-this.m_normals[f-1].Y);this.m_normals[0]=new n.DoublePoint2(-this.m_normals[1].X,-this.m_normals[1].Y),P=l-1;for(var f=P-1;f>0;--f)P=this.OffsetPoint(f,P,e.m_jointype);e.m_endtype===n.EndType.etOpenButt?(m=new n.IntPoint2(n.ClipperOffset.Round(this.m_srcPoly[0].X-this.m_normals[0].X*t),n.ClipperOffset.Round(this.m_srcPoly[0].Y-this.m_normals[0].Y*t)),this.m_destPoly.push(m),m=new n.IntPoint2(n.ClipperOffset.Round(this.m_srcPoly[0].X+this.m_normals[0].X*t),n.ClipperOffset.Round(this.m_srcPoly[0].Y+this.m_normals[0].Y*t)),this.m_destPoly.push(m)):(P=1,this.m_sinA=0,e.m_endtype===n.EndType.etOpenSquare?this.DoSquare(0,1):this.DoRound(0,1)),this.m_destPolys.push(this.m_destPoly)}}}},n.ClipperOffset.prototype.Execute=function(){var t=arguments,i=t[0]instanceof n.PolyTree;if(i){var e=t[0],r=t[1];e.Clear(),this.FixOrientations(),this.DoOffset(r);var s=new n.Clipper(0);if(s.AddPaths(this.m_destPolys,n.PolyType.ptSubject,!0),r>0)s.Execute(n.ClipType.ctUnion,e,n.PolyFillType.pftPositive,n.PolyFillType.pftPositive);else{var l=n.Clipper.GetBounds(this.m_destPolys),o=new n.Path;if(o.push(new n.IntPoint2(l.left-10,l.bottom+10)),o.push(new n.IntPoint2(l.right+10,l.bottom+10)),o.push(new n.IntPoint2(l.right+10,l.top-10)),o.push(new n.IntPoint2(l.left-10,l.top-10)),s.AddPath(o,n.PolyType.ptSubject,!0),s.ReverseSolution=!0,s.Execute(n.ClipType.ctUnion,e,n.PolyFillType.pftNegative,n.PolyFillType.pftNegative),e.ChildCount()===1&&e.Childs()[0].ChildCount()>0){var u=e.Childs()[0];e.Childs()[0]=u.Childs()[0],e.Childs()[0].m_Parent=e;for(var f=1;f<u.ChildCount();f++)e.AddChild(u.Childs()[f])}else e.Clear()}}else{var e=t[0],r=t[1];n.Clear(e),this.FixOrientations(),this.DoOffset(r);var s=new n.Clipper(0);if(s.AddPaths(this.m_destPolys,n.PolyType.ptSubject,!0),r>0)s.Execute(n.ClipType.ctUnion,e,n.PolyFillType.pftPositive,n.PolyFillType.pftPositive);else{var l=n.Clipper.GetBounds(this.m_destPolys),o=new n.Path;o.push(new n.IntPoint2(l.left-10,l.bottom+10)),o.push(new n.IntPoint2(l.right+10,l.bottom+10)),o.push(new n.IntPoint2(l.right+10,l.top-10)),o.push(new n.IntPoint2(l.left-10,l.top-10)),s.AddPath(o,n.PolyType.ptSubject,!0),s.ReverseSolution=!0,s.Execute(n.ClipType.ctUnion,e,n.PolyFillType.pftNegative,n.PolyFillType.pftNegative),e.length>0&&e.splice(0,1)}}},n.ClipperOffset.prototype.OffsetPoint=function(t,i,e){if(this.m_sinA=this.m_normals[i].X*this.m_normals[t].Y-this.m_normals[t].X*this.m_normals[i].Y,Math.abs(this.m_sinA*this.m_delta)<1){var r=this.m_normals[i].X*this.m_normals[t].X+this.m_normals[t].Y*this.m_normals[i].Y;if(r>0)return this.m_destPoly.push(new n.IntPoint2(n.ClipperOffset.Round(this.m_srcPoly[t].X+this.m_normals[i].X*this.m_delta),n.ClipperOffset.Round(this.m_srcPoly[t].Y+this.m_normals[i].Y*this.m_delta))),i}else this.m_sinA>1?this.m_sinA=1:this.m_sinA<-1&&(this.m_sinA=-1);if(this.m_sinA*this.m_delta<0)this.m_destPoly.push(new n.IntPoint2(n.ClipperOffset.Round(this.m_srcPoly[t].X+this.m_normals[i].X*this.m_delta),n.ClipperOffset.Round(this.m_srcPoly[t].Y+this.m_normals[i].Y*this.m_delta))),this.m_destPoly.push(new n.IntPoint1(this.m_srcPoly[t])),this.m_destPoly.push(new n.IntPoint2(n.ClipperOffset.Round(this.m_srcPoly[t].X+this.m_normals[t].X*this.m_delta),n.ClipperOffset.Round(this.m_srcPoly[t].Y+this.m_normals[t].Y*this.m_delta)));else switch(e){case n.JoinType.jtMiter:{var s=1+(this.m_normals[t].X*this.m_normals[i].X+this.m_normals[t].Y*this.m_normals[i].Y);s>=this.m_miterLim?this.DoMiter(t,i,s):this.DoSquare(t,i);break}case n.JoinType.jtSquare:this.DoSquare(t,i);break;case n.JoinType.jtRound:this.DoRound(t,i);break}return i=t,i},n.ClipperOffset.prototype.DoSquare=function(t,i){var e=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 n.IntPoint2(n.ClipperOffset.Round(this.m_srcPoly[t].X+this.m_delta*(this.m_normals[i].X-this.m_normals[i].Y*e)),n.ClipperOffset.Round(this.m_srcPoly[t].Y+this.m_delta*(this.m_normals[i].Y+this.m_normals[i].X*e)))),this.m_destPoly.push(new n.IntPoint2(n.ClipperOffset.Round(this.m_srcPoly[t].X+this.m_delta*(this.m_normals[t].X+this.m_normals[t].Y*e)),n.ClipperOffset.Round(this.m_srcPoly[t].Y+this.m_delta*(this.m_normals[t].Y-this.m_normals[t].X*e))))},n.ClipperOffset.prototype.DoMiter=function(t,i,e){var r=this.m_delta/e;this.m_destPoly.push(new n.IntPoint2(n.ClipperOffset.Round(this.m_srcPoly[t].X+(this.m_normals[i].X+this.m_normals[t].X)*r),n.ClipperOffset.Round(this.m_srcPoly[t].Y+(this.m_normals[i].Y+this.m_normals[t].Y)*r)))},n.ClipperOffset.prototype.DoRound=function(t,i){for(var e=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(n.Cast_Int32(n.ClipperOffset.Round(this.m_StepsPerRad*Math.abs(e))),1),s=this.m_normals[i].X,l=this.m_normals[i].Y,o,u=0;u<r;++u)this.m_destPoly.push(new n.IntPoint2(n.ClipperOffset.Round(this.m_srcPoly[t].X+s*this.m_delta),n.ClipperOffset.Round(this.m_srcPoly[t].Y+l*this.m_delta))),o=s,s=s*this.m_cos-this.m_sin*l,l=o*this.m_sin+l*this.m_cos;this.m_destPoly.push(new n.IntPoint2(n.ClipperOffset.Round(this.m_srcPoly[t].X+this.m_normals[t].X*this.m_delta),n.ClipperOffset.Round(this.m_srcPoly[t].Y+this.m_normals[t].Y*this.m_delta)))},n.Error=function(t){try{throw new Error(t)}catch(i){alert(i.message)}},n.JS={},n.JS.AreaOfPolygon=function(t,i){return i||(i=1),n.Clipper.Area(t)/(i*i)},n.JS.AreaOfPolygons=function(t,i){i||(i=1);for(var e=0,r=0;r<t.length;r++)e+=n.Clipper.Area(t[r]);return e/(i*i)},n.JS.BoundsOfPath=function(t,i){return n.JS.BoundsOfPaths([t],i)},n.JS.BoundsOfPaths=function(t,i){i||(i=1);var e=n.Clipper.GetBounds(t);return e.left/=i,e.bottom/=i,e.right/=i,e.top/=i,e},n.JS.Clean=function(r,i){if(!(r instanceof Array))return[];var e=r[0]instanceof Array,r=n.JS.Clone(r);if(typeof i!="number"||i===null)return n.Error("Delta is not a number in Clean()."),r;if(r.length===0||r.length===1&&r[0].length===0||i<0)return r;e||(r=[r]);for(var s=r.length,l,o,u,f,h,P,a,m=[],y=0;y<s;y++)if(o=r[y],l=o.length,l!==0){if(l<3){u=o,m.push(u);continue}for(u=o,f=i*i,h=o[0],P=1,a=1;a<l;a++)(o[a].X-h.X)*(o[a].X-h.X)+(o[a].Y-h.Y)*(o[a].Y-h.Y)<=f||(u[P]=o[a],h=o[a],P++);h=o[P-1],(o[0].X-h.X)*(o[0].X-h.X)+(o[0].Y-h.Y)*(o[0].Y-h.Y)<=f&&P--,P<l&&u.splice(P,l-P),u.length&&m.push(u)}return!e&&m.length?m=m[0]:!e&&m.length===0?m=[]:e&&m.length===0&&(m=[[]]),m},n.JS.Clone=function(t){if(!(t instanceof Array))return[];if(t.length===0)return[];if(t.length===1&&t[0].length===0)return[[]];var i=t[0]instanceof Array;i||(t=[t]);var e=t.length,r,s,l,o,u=new Array(e);for(s=0;s<e;s++){for(r=t[s].length,o=new Array(r),l=0;l<r;l++)o[l]={X:t[s][l].X,Y:t[s][l].Y};u[s]=o}return i||(u=u[0]),u},n.JS.Lighten=function(t,i){if(!(t instanceof Array))return[];if(typeof i!="number"||i===null)return n.Error("Tolerance is not a number in Lighten()."),n.JS.Clone(t);if(t.length===0||t.length===1&&t[0].length===0||i<0)return n.JS.Clone(t);var e=t[0]instanceof Array;e||(t=[t]);var r,s,l,o,u,f,h,P,a,m,y,C,c,_,L,Y,M,qi=t.length,Ui=i*i,F=[];for(r=0;r<qi;r++)if(l=t[r],f=l.length,f!==0){for(o=0;o<1e6;o++){for(u=[],f=l.length,l[f-1].X!==l[0].X||l[f-1].Y!==l[0].Y?(C=1,l.push({X:l[0].X,Y:l[0].Y}),f=l.length):C=0,y=[],s=0;s<f-2;s++)h=l[s],a=l[s+1],P=l[s+2],Y=h.X,M=h.Y,c=P.X-Y,_=P.Y-M,(c!==0||_!==0)&&(L=((a.X-Y)*c+(a.Y-M)*_)/(c*c+_*_),L>1?(Y=P.X,M=P.Y):L>0&&(Y+=c*L,M+=_*L)),c=a.X-Y,_=a.Y-M,m=c*c+_*_,m<=Ui&&(y[s+1]=1,s++);for(u.push({X:l[0].X,Y:l[0].Y}),s=1;s<f-1;s++)y[s]||u.push({X:l[s].X,Y:l[s].Y});if(u.push({X:l[f-1].X,Y:l[f-1].Y}),C&&l.pop(),y.length)l=u;else break}f=u.length,u[f-1].X===u[0].X&&u[f-1].Y===u[0].Y&&u.pop(),u.length>2&&F.push(u)}return e||(F=F[0]),typeof F>"u"&&(F=[]),F},n.JS.PerimeterOfPath=function(t,i,e){if(typeof t>"u")return 0;var r=Math.sqrt,s=0,l,o,u=0,f=0,h=0,P=0,a=t.length;if(a<2)return 0;for(i&&(t[a]=t[0],a++);--a;)l=t[a],u=l.X,f=l.Y,o=t[a-1],h=o.X,P=o.Y,s+=r((u-h)*(u-h)+(f-P)*(f-P));return i&&t.pop(),s/e},n.JS.PerimeterOfPaths=function(t,i,e){e||(e=1);for(var r=0,s=0;s<t.length;s++)r+=n.JS.PerimeterOfPath(t[s],i,e);return r},n.JS.ScaleDownPath=function(t,i){var e,r;for(i||(i=1),e=t.length;e--;)r=t[e],r.X=r.X/i,r.Y=r.Y/i},n.JS.ScaleDownPaths=function(t,i){var e,r,s;for(i||(i=1),e=t.length;e--;)for(r=t[e].length;r--;)s=t[e][r],s.X=s.X/i,s.Y=s.Y/i},n.JS.ScaleUpPath=function(t,i){var e,r,s=Math.round;for(i||(i=1),e=t.length;e--;)r=t[e],r.X=s(r.X*i),r.Y=s(r.Y*i)},n.JS.ScaleUpPaths=function(t,i){var e,r,s,l=Math.round;for(i||(i=1),e=t.length;e--;)for(r=t[e].length;r--;)s=t[e][r],s.X=l(s.X*i),s.Y=l(s.Y*i)},n.ExPolygons=function(){return[]},n.ExPolygon=function(){this.outer=null,this.holes=null},n.JS.AddOuterPolyNodeToExPolygons=function(t,i){var e=new n.ExPolygon;e.outer=t.Contour();var r=t.Childs(),s=r.length;e.holes=new Array(s);var l,o,u,f,h,P;for(u=0;u<s;u++)for(l=r[u],e.holes[u]=l.Contour(),f=0,h=l.Childs(),P=h.length;f<P;f++)o=h[f],n.JS.AddOuterPolyNodeToExPolygons(o,i);i.push(e)},n.JS.ExPolygonsToPaths=function(t){var i,e,r,s,l=new n.Paths;for(i=0,r=t.length;i<r;i++)for(l.push(t[i].outer),e=0,s=t[i].holes.length;e<s;e++)l.push(t[i].holes[e]);return l},n.JS.PolyTreeToExPolygons=function(t){var i=new n.ExPolygons,e,r,s,l;for(r=0,s=t.Childs(),l=s.length;r<l;r++)e=s[r],n.JS.AddOuterPolyNodeToExPolygons(e,i);return i}})()})(U)),U.exports}var Q=Ji();const Gi=ki(Q),zi=Hi({__proto__:null,default:Gi},[Q]);export{zi as c};
@@ -0,0 +1 @@
1
+ import{b as r}from"./graph-BHlg4sFb.js";var e=4;function a(o){return r(o,e)}export{a as c};
@@ -0,0 +1 @@
1
+ import{aa as o}from"./index-T9dstNa6.js";var r=4;function n(a){return o(a,r)}export{n as c};
@@ -1,4 +1,4 @@
1
- import{l as b,x as T,y as W}from"./index-Ia_xKhIZ.js";import{f as x}from"./index-B_TY0tLT.js";function E(n){const t=n.replace(/\n{2,}/g,`
1
+ import{l as b,x as T,y as W}from"./index-BdH171U0.js";import{f as x}from"./index-sRNe5iWo.js";function E(n){const t=n.replace(/\n{2,}/g,`
2
2
  `);return W(t)}function w(n){const t=E(n),{children:e}=x(t),o=[[]];let s=0;function i(r,a="normal"){r.type==="text"?r.value.split(`
3
3
  `).forEach((l,p)=>{p!==0&&(s++,o.push([])),l.split(" ").forEach(f=>{f&&o[s].push({content:f,type:a})})}):(r.type==="strong"||r.type==="emphasis")&&r.children.forEach(c=>{i(c,r.type)})}return e.forEach(r=>{r.type==="paragraph"&&r.children.forEach(a=>{i(a)})}),o}function S(n){const{children:t}=x(n);function e(o){return o.type==="text"?o.value.replace(/\n/g,"<br/>"):o.type==="strong"?`<strong>${o.children.map(e).join("")}</strong>`:o.type==="emphasis"?`<em>${o.children.map(e).join("")}</em>`:o.type==="paragraph"?`<p>${o.children.map(e).join("")}</p>`:`Unsupported markdown: ${o.type}`}return t.map(e).join("")}function j(n){return Intl.Segmenter?[...new Intl.Segmenter().segment(n)].map(t=>t.segment):[...n]}function v(n,t){const e=j(t.content);return g(n,[],e,t.type)}function g(n,t,e,o){if(e.length===0)return[{content:t.join(""),type:o},{content:"",type:o}];const[s,...i]=e,r=[...t,s];return n([{content:r.join(""),type:o}])?g(n,r,i,o):(t.length===0&&s&&(t.push(s),e.shift()),[{content:t.join(""),type:o},{content:e.join(""),type:o}])}function L(n,t){if(n.some(({content:e})=>e.includes(`
4
4
  `)))throw new Error("splitLineToFitWidth does not support newlines in the line");return h(n,t)}function h(n,t,e=[],o=[]){if(n.length===0)return o.length>0&&e.push(o),e.length>0?e:[];let s="";n[0].content===" "&&(s=" ",n.shift());const i=n.shift()??{content:" ",type:"normal"},r=[...o];if(s!==""&&r.push({content:s,type:"normal"}),r.push(i),t(r))return h(n,t,e,r);if(o.length>0)e.push(o),n.unshift(i);else if(i.content){const[a,c]=v(t,i);e.push([a]),c.content&&n.unshift(c)}return h(n,t,e)}function $(n,t){t&&n.attr("style",t)}function k(n,t,e,o,s=!1){const i=n.append("foreignObject"),r=i.append("xhtml:div"),a=t.label,c=t.isNode?"nodeLabel":"edgeLabel";r.html(`