@rr0/ufoathome 0.139.0 → 0.141.0

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 (81) hide show
  1. package/dist-embed-scene/AdsbLolArchiveProvider-CO4IRthj.js +1 -0
  2. package/dist-embed-scene/GLTFLoader-wJ0bjCoG.js +1 -0
  3. package/dist-embed-scene/ReferenceSystem-BdF5Ptvm.js +1 -0
  4. package/dist-embed-scene/SceneNames_es-v7tJmsVK.js +1 -0
  5. package/dist-embed-scene/SceneNames_fr-CgU7Ms5_.js +1 -0
  6. package/dist-embed-scene/SceneNames_it-DljjUVi8.js +1 -0
  7. package/dist-embed-scene/rr0-scene.mjs +571 -287
  8. package/dist-embed-scene/sightingSchema-t3YCF0eV.js +1 -0
  9. package/dist-embed-sighting/AdsbLolArchiveProvider-SLZYD2p1.js +1 -0
  10. package/dist-embed-sighting/GLTFLoader-BGUT3v5v.js +1 -0
  11. package/dist-embed-sighting/ReferenceSystem-CEn7MuVP.js +1 -0
  12. package/dist-embed-sighting/{SceneNames_es-wkWHMHet.js → SceneNames_es-CPCIUfgZ.js} +1 -1
  13. package/dist-embed-sighting/SceneNames_fr-DixomaFq.js +1 -0
  14. package/dist-embed-sighting/SceneNames_it-BTNeU7-M.js +1 -0
  15. package/dist-embed-sighting/SightingMessages_es-BL3yAPR5.js +1 -0
  16. package/dist-embed-sighting/SightingMessages_fr-DYXapaAN.js +1 -0
  17. package/dist-embed-sighting/SightingMessages_it-3b421_Dl.js +1 -0
  18. package/dist-embed-sighting/rr0-sighting.mjs +580 -296
  19. package/dist-embed-sighting/sightingSchema-t3YCF0eV.js +1 -0
  20. package/dist-embed-sighting-editor/AdsbLolArchiveProvider-CtHllfL6.js +1 -0
  21. package/dist-embed-sighting-editor/{BeamEditor-CCsp2xr2.js → BeamEditor-Bko8HBqB.js} +1 -1
  22. package/dist-embed-sighting-editor/BeamSystem-DibQnDQt.js +1 -0
  23. package/dist-embed-sighting-editor/{BodyEditor-DtBz9fVX.js → BodyEditor-3Pv5hYe4.js} +1 -1
  24. package/dist-embed-sighting-editor/ContrailSystem-CnMn7-P3.js +1 -0
  25. package/dist-embed-sighting-editor/{CoverageAssessor-DbLjQSsv.js → CoverageAssessor-ZPfl-pIr.js} +1 -1
  26. package/dist-embed-sighting-editor/GLTFLoader-BwKeFCRw.js +1 -0
  27. package/dist-embed-sighting-editor/GhostSearchView-wZJh23C7.js +1 -0
  28. package/dist-embed-sighting-editor/HeadlightSystem-CoBP2hn0.js +34 -0
  29. package/dist-embed-sighting-editor/{HynekAssessor-C6Lge7G-.js → HynekAssessor-kTvEbabz.js} +1 -1
  30. package/dist-embed-sighting-editor/{InterviewEditorElement-CJxgekiU.js → InterviewEditorElement-DBuxtdMB.js} +2 -2
  31. package/dist-embed-sighting-editor/{LaserBeam-B6u7y0-E.js → LaserBeam-BuHV0CAP.js} +1 -1
  32. package/dist-embed-sighting-editor/LaunchEditor-B-i5uD19.js +18 -0
  33. package/dist-embed-sighting-editor/ModelSource-DvO3GvYu.js +1 -0
  34. package/dist-embed-sighting-editor/ModelThumbnails-T8FwtOCM.js +1 -0
  35. package/dist-embed-sighting-editor/ModelViewer-s4OyekVX.js +1 -0
  36. package/dist-embed-sighting-editor/PanoramaxPictures-CELY3Ecc.js +1 -0
  37. package/dist-embed-sighting-editor/PictureRegistration-ZngZKmqH.js +1 -0
  38. package/dist-embed-sighting-editor/RailwaySystem-BgkkxR-M.js +41 -0
  39. package/dist-embed-sighting-editor/ReferenceSystem-8Nl1IFkX.js +1 -0
  40. package/dist-embed-sighting-editor/{RoadMarkings-xnEtzMn8.js → RoadMarkings-BME7pFh2.js} +1 -1
  41. package/dist-embed-sighting-editor/{SceneNames_es-umTyyCxN.js → SceneNames_es-CYEwepgA.js} +1 -1
  42. package/dist-embed-sighting-editor/SceneNames_fr-DcmXYPbm.js +1 -0
  43. package/dist-embed-sighting-editor/SceneNames_it-Doviz6zH.js +1 -0
  44. package/dist-embed-sighting-editor/{SightingEditorMessages_es-UiUywEk4.js → SightingEditorMessages_es-DtYML4wO.js} +1 -1
  45. package/dist-embed-sighting-editor/{SightingEditorMessages_fr-D5pajHZd.js → SightingEditorMessages_fr-Bt-2qm0Z.js} +1 -1
  46. package/dist-embed-sighting-editor/{SightingEditorMessages_it-9SduHYDB.js → SightingEditorMessages_it-DK9cF3wW.js} +1 -1
  47. package/dist-embed-sighting-editor/{SightingFileEditor-CJX1-U4q.js → SightingFileEditor-DDAzzasL.js} +1 -1
  48. package/dist-embed-sighting-editor/{TraceSystem-CArVw3Pm.js → TraceSystem-BGF0P9zl.js} +2 -2
  49. package/dist-embed-sighting-editor/WaterSystem-BKoFKdK_.js +1 -0
  50. package/dist-embed-sighting-editor/rr0-sighting-editor.mjs +662 -351
  51. package/dist-embed-sighting-editor/sightingSchema-t3YCF0eV.js +1 -0
  52. package/dist-embed-sighting-editor/{trafficRuntime-BAGbGiVc.js → trafficRuntime-BoN9h4Uo.js} +2 -2
  53. package/package.json +1 -1
  54. package/dist-embed-scene/AdsbLolArchiveProvider-HY3iCExA.js +0 -1
  55. package/dist-embed-scene/GLTFLoader-WAZoNABx.js +0 -1
  56. package/dist-embed-scene/SceneNames_es-BS2ioieu.js +0 -1
  57. package/dist-embed-scene/SceneNames_fr-B-fRwUUu.js +0 -1
  58. package/dist-embed-scene/SceneNames_it-B-QEwmuM.js +0 -1
  59. package/dist-embed-scene/sightingSchema-Dn9Nacua.js +0 -1
  60. package/dist-embed-sighting/AdsbLolArchiveProvider-Bhh3sXD9.js +0 -1
  61. package/dist-embed-sighting/GLTFLoader-Zsr9YBrz.js +0 -1
  62. package/dist-embed-sighting/SceneNames_fr-DbbzZ1bB.js +0 -1
  63. package/dist-embed-sighting/SceneNames_it-BsxnweGu.js +0 -1
  64. package/dist-embed-sighting/SightingMessages_es-B-iNzmf3.js +0 -1
  65. package/dist-embed-sighting/SightingMessages_fr-Dq30mEEs.js +0 -1
  66. package/dist-embed-sighting/SightingMessages_it-CSJFk0JC.js +0 -1
  67. package/dist-embed-sighting/sightingSchema-Dn9Nacua.js +0 -1
  68. package/dist-embed-sighting-editor/AdsbLolArchiveProvider-De-_PiBH.js +0 -1
  69. package/dist-embed-sighting-editor/BeamSystem-B3qYVuHd.js +0 -1
  70. package/dist-embed-sighting-editor/ContrailSystem-D9rPfOBE.js +0 -1
  71. package/dist-embed-sighting-editor/GLTFLoader-Clgrcwp4.js +0 -1
  72. package/dist-embed-sighting-editor/HeadlightSystem-wFRogS2e.js +0 -34
  73. package/dist-embed-sighting-editor/LaunchEditor-CPa-pltK.js +0 -18
  74. package/dist-embed-sighting-editor/ModelSource-D9Q4lorr.js +0 -1
  75. package/dist-embed-sighting-editor/ModelThumbnails-DO6uXzoW.js +0 -1
  76. package/dist-embed-sighting-editor/ModelViewer-Ct9JM_Rx.js +0 -1
  77. package/dist-embed-sighting-editor/RailwaySystem-CNhqPQHR.js +0 -41
  78. package/dist-embed-sighting-editor/SceneNames_fr-BNgnxIHx.js +0 -1
  79. package/dist-embed-sighting-editor/SceneNames_it-5UYhmJHo.js +0 -1
  80. package/dist-embed-sighting-editor/WaterSystem-B-MThsCt.js +0 -1
  81. package/dist-embed-sighting-editor/sightingSchema-Dn9Nacua.js +0 -1
@@ -1,4 +1,4 @@
1
- import{S as T,g as de,E as M,a as it,s as rt,b as O,P as ot,c as V,d as Le,F as me,e as pe,f as lt,h as at,V as Qe,D as P,R as _,i as ce,j as ct,C as L,k as Ee,l as b,r as ht,L as ut,m as ft,t as w,n as dt,o as mt,p as pt,q as ke,u as gt,v as xt,w as vt,x as We,y as Ie,z as bt,A as yt,G as Ne,W as Ot,B as wt,H as kt,I as Ce,J as Ct,K as St,M as Mt,N as Pt,O as Rt,Q as Tt,T as At,U as Lt,X as Qt,Y as Et,Z as Wt,_ as It,$ as Nt,a0 as Dt,a1 as Bt,a2 as $t,a3 as qt,a4 as Vt,a5 as Ht,a6 as Kt,a7 as jt,a8 as Xt,a9 as Gt,aa as zt,ab as Ft}from"./index-DSNA74v6.js";import Yt from"./sightingSchema-Dn9Nacua.js";const Se=typeof String.prototype.normalize=="function"?i=>i.normalize("NFKD"):i=>i;class K{constructor(e,n,t=0,s=e.length,r,l){this.test=l,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(t,s),this.bufferStart=t,this.normalize=r?o=>r(Se(o)):Se,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return lt(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let n=ct(e),t=this.bufferStart+this.bufferPos;this.bufferPos+=at(e);let s=this.normalize(n);if(s.length)for(let r=0,l=t,o=!0;;r++){let a=s.charCodeAt(r),c=this.match(a,l,o,this.bufferPos+this.bufferStart,r==s.length-1);if(c)return this.value=c,this;if(r==s.length-1)break;o&&r<n.length&&n.charCodeAt(r)==a?l++:o=!1}}}match(e,n,t,s,r){let l=null;for(let o=0;o<this.matches.length;){let a=this.matches[o],c=!1;this.query.charCodeAt(a.index)==e&&(a.index==this.query.length-1?l={from:a.from,to:s,precise:r&&a.precise}:(a.index++,c=!0)),c?o++:this.matches.splice(o,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?l={from:n,to:s,precise:t&&r}:this.matches.push({from:n,index:1,precise:t})),l&&this.test&&!this.test(l.from,l.to,this.buffer,this.bufferStart)&&(l=null),l}}typeof Symbol<"u"&&(K.prototype[Symbol.iterator]=function(){return this});const De={from:-1,to:-1,match:/.*/.exec(""),precise:!0},ge="gm"+(/x/.unicode==null?"":"u");class Be{constructor(e,n,t,s=0,r=e.length){if(this.text=e,this.to=r,this.curLine="",this.done=!1,this.value=De,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new $e(e,n,t,s,r);this.re=new RegExp(n,ge+(t?.ignoreCase?"i":"")),this.test=t?.test,this.iter=e.iter();let l=e.lineAt(s);this.curLineStart=l.from,this.matchPos=ee(e,s),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let t=this.curLineStart+n.index,s=t+n[0].length;if(this.matchPos=ee(this.text,s+(t==s?1:0)),t==this.curLineStart+this.curLine.length&&this.nextLine(),(t<s||t>this.value.to)&&(!this.test||this.test(t,s,n)))return this.value={from:t,to:s,precise:!0,match:n},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const le=new WeakMap;class ${constructor(e,n){this.from=e,this.text=n}get to(){return this.from+this.text.length}static get(e,n,t){let s=le.get(e);if(!s||s.from>=t||s.to<=n){let o=new $(n,e.sliceString(n,t));return le.set(e,o),o}if(s.from==n&&s.to==t)return s;let{text:r,from:l}=s;return l>n&&(r=e.sliceString(n,l)+r,l=n),s.to<t&&(r+=e.sliceString(s.to,t)),le.set(e,new $(l,r)),new $(n,r.slice(n-l,t-l))}}class $e{constructor(e,n,t,s,r){this.text=e,this.to=r,this.done=!1,this.value=De,this.matchPos=ee(e,s),this.re=new RegExp(n,ge+(t?.ignoreCase?"i":"")),this.test=t?.test,this.flat=$.get(e,s,this.chunkEnd(s+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let t=this.flat.from+n.index,s=t+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(t,s,n)))return this.value={from:t,to:s,precise:!0,match:n},this.matchPos=ee(this.text,s+(t==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=$.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(Be.prototype[Symbol.iterator]=$e.prototype[Symbol.iterator]=function(){return this});function Zt(i){try{return new RegExp(i,ge),!0}catch{return!1}}function ee(i,e){if(e>=i.length)return e;let n=i.lineAt(e),t;for(;e<n.to&&(t=n.text.charCodeAt(e-n.from))>=56320&&t<57344;)e++;return e}const Ut=i=>{let e=it(i,"cm-goto-line");if(e){let l=e.dom.querySelector("input[type=text]");return l&&l.select(),!0}let{state:n}=i,t=String(n.doc.lineAt(i.state.selection.main.head).number),{close:s,result:r}=rt(i,{class:"cm-goto-line",label:n.phrase("Go to line"),input:{type:"text",name:"line",value:t},focus:!0,submitLabel:n.phrase("go")});return r.then(l=>{let o=l&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(l.elements.line.value);if(!o){i.dispatch({effects:s});return}let a=n.doc.lineAt(n.selection.main.head),[,c,u,h,f]=o,d=h?+h.slice(1):0,m=u?+u:a.number;if(u&&f){let S=m/100;c&&(S=S*(c=="-"?-1:1)+a.number/n.doc.lines),m=Math.round(n.doc.lines*S)}else u&&c&&(m=m*(c=="-"?-1:1)+a.number);let g=n.doc.line(Math.max(1,Math.min(n.doc.lines,m))),x=M.cursor(g.from+Math.max(0,Math.min(d,g.length)));i.dispatch({effects:[s,O.scrollIntoView(x.from,{y:"center"})],selection:x})}),!0},Jt=({state:i,dispatch:e})=>{let{selection:n}=i,t=M.create(n.ranges.map(s=>i.wordAt(s.head)||M.cursor(s.head)),n.mainIndex);return t.eq(n)?!1:(e(i.update({selection:t})),!0)};function _t(i,e){let{main:n,ranges:t}=i.selection,s=i.wordAt(n.head),r=s&&s.from==n.from&&s.to==n.to;for(let l=!1,o=new K(i.doc,e,t[t.length-1].to);;)if(o.next(),o.done){if(l)return null;o=new K(i.doc,e,0,Math.max(0,t[t.length-1].from-1)),l=!0}else{if(l&&t.some(a=>a.from==o.value.from))continue;if(r){let a=i.wordAt(o.value.from);if(!a||a.from!=o.value.from||a.to!=o.value.to)continue}return o.value}}const en=({state:i,dispatch:e})=>{let{ranges:n}=i.selection;if(n.some(r=>r.from===r.to))return Jt({state:i,dispatch:e});let t=i.sliceDoc(n[0].from,n[0].to);if(i.selection.ranges.some(r=>i.sliceDoc(r.from,r.to)!=t))return!1;let s=_t(i,t);return s?(e(i.update({selection:i.selection.addRange(M.range(s.from,s.to),!1),effects:O.scrollIntoView(s.to)})),!0):!1},I=me.define({combine(i){return pe(i,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new gn(e),scrollToMatch:e=>O.scrollIntoView(e)})}});function tn(i){return i?[I.of(i),ue]:ue}class qe{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||Zt(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(n,t)=>t=="n"?`
1
+ import{S as T,g as de,E as M,a as it,s as rt,b as O,P as ot,c as V,d as Le,F as me,e as pe,f as lt,h as at,V as Qe,D as P,R as _,i as ce,j as ct,C as L,k as Ee,l as b,r as ht,L as ut,m as ft,t as w,n as dt,o as mt,p as pt,q as ke,u as gt,v as xt,w as vt,x as We,y as Ie,z as bt,A as yt,G as Ne,W as Ot,B as wt,H as kt,I as Ce,J as Ct,K as St,M as Mt,N as Pt,O as Rt,Q as Tt,T as At,U as Lt,X as Qt,Y as Et,Z as Wt,_ as It,$ as Nt,a0 as Dt,a1 as Bt,a2 as $t,a3 as qt,a4 as Vt,a5 as Ht,a6 as Kt,a7 as jt,a8 as Xt,a9 as Gt,aa as zt,ab as Ft}from"./index-DSNA74v6.js";import Yt from"./sightingSchema-t3YCF0eV.js";const Se=typeof String.prototype.normalize=="function"?i=>i.normalize("NFKD"):i=>i;class K{constructor(e,n,t=0,s=e.length,r,l){this.test=l,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(t,s),this.bufferStart=t,this.normalize=r?o=>r(Se(o)):Se,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return lt(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let n=ct(e),t=this.bufferStart+this.bufferPos;this.bufferPos+=at(e);let s=this.normalize(n);if(s.length)for(let r=0,l=t,o=!0;;r++){let a=s.charCodeAt(r),c=this.match(a,l,o,this.bufferPos+this.bufferStart,r==s.length-1);if(c)return this.value=c,this;if(r==s.length-1)break;o&&r<n.length&&n.charCodeAt(r)==a?l++:o=!1}}}match(e,n,t,s,r){let l=null;for(let o=0;o<this.matches.length;){let a=this.matches[o],c=!1;this.query.charCodeAt(a.index)==e&&(a.index==this.query.length-1?l={from:a.from,to:s,precise:r&&a.precise}:(a.index++,c=!0)),c?o++:this.matches.splice(o,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?l={from:n,to:s,precise:t&&r}:this.matches.push({from:n,index:1,precise:t})),l&&this.test&&!this.test(l.from,l.to,this.buffer,this.bufferStart)&&(l=null),l}}typeof Symbol<"u"&&(K.prototype[Symbol.iterator]=function(){return this});const De={from:-1,to:-1,match:/.*/.exec(""),precise:!0},ge="gm"+(/x/.unicode==null?"":"u");class Be{constructor(e,n,t,s=0,r=e.length){if(this.text=e,this.to=r,this.curLine="",this.done=!1,this.value=De,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new $e(e,n,t,s,r);this.re=new RegExp(n,ge+(t?.ignoreCase?"i":"")),this.test=t?.test,this.iter=e.iter();let l=e.lineAt(s);this.curLineStart=l.from,this.matchPos=ee(e,s),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let t=this.curLineStart+n.index,s=t+n[0].length;if(this.matchPos=ee(this.text,s+(t==s?1:0)),t==this.curLineStart+this.curLine.length&&this.nextLine(),(t<s||t>this.value.to)&&(!this.test||this.test(t,s,n)))return this.value={from:t,to:s,precise:!0,match:n},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const le=new WeakMap;class ${constructor(e,n){this.from=e,this.text=n}get to(){return this.from+this.text.length}static get(e,n,t){let s=le.get(e);if(!s||s.from>=t||s.to<=n){let o=new $(n,e.sliceString(n,t));return le.set(e,o),o}if(s.from==n&&s.to==t)return s;let{text:r,from:l}=s;return l>n&&(r=e.sliceString(n,l)+r,l=n),s.to<t&&(r+=e.sliceString(s.to,t)),le.set(e,new $(l,r)),new $(n,r.slice(n-l,t-l))}}class $e{constructor(e,n,t,s,r){this.text=e,this.to=r,this.done=!1,this.value=De,this.matchPos=ee(e,s),this.re=new RegExp(n,ge+(t?.ignoreCase?"i":"")),this.test=t?.test,this.flat=$.get(e,s,this.chunkEnd(s+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let t=this.flat.from+n.index,s=t+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(t,s,n)))return this.value={from:t,to:s,precise:!0,match:n},this.matchPos=ee(this.text,s+(t==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=$.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(Be.prototype[Symbol.iterator]=$e.prototype[Symbol.iterator]=function(){return this});function Zt(i){try{return new RegExp(i,ge),!0}catch{return!1}}function ee(i,e){if(e>=i.length)return e;let n=i.lineAt(e),t;for(;e<n.to&&(t=n.text.charCodeAt(e-n.from))>=56320&&t<57344;)e++;return e}const Ut=i=>{let e=it(i,"cm-goto-line");if(e){let l=e.dom.querySelector("input[type=text]");return l&&l.select(),!0}let{state:n}=i,t=String(n.doc.lineAt(i.state.selection.main.head).number),{close:s,result:r}=rt(i,{class:"cm-goto-line",label:n.phrase("Go to line"),input:{type:"text",name:"line",value:t},focus:!0,submitLabel:n.phrase("go")});return r.then(l=>{let o=l&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(l.elements.line.value);if(!o){i.dispatch({effects:s});return}let a=n.doc.lineAt(n.selection.main.head),[,c,u,h,f]=o,d=h?+h.slice(1):0,m=u?+u:a.number;if(u&&f){let S=m/100;c&&(S=S*(c=="-"?-1:1)+a.number/n.doc.lines),m=Math.round(n.doc.lines*S)}else u&&c&&(m=m*(c=="-"?-1:1)+a.number);let g=n.doc.line(Math.max(1,Math.min(n.doc.lines,m))),x=M.cursor(g.from+Math.max(0,Math.min(d,g.length)));i.dispatch({effects:[s,O.scrollIntoView(x.from,{y:"center"})],selection:x})}),!0},Jt=({state:i,dispatch:e})=>{let{selection:n}=i,t=M.create(n.ranges.map(s=>i.wordAt(s.head)||M.cursor(s.head)),n.mainIndex);return t.eq(n)?!1:(e(i.update({selection:t})),!0)};function _t(i,e){let{main:n,ranges:t}=i.selection,s=i.wordAt(n.head),r=s&&s.from==n.from&&s.to==n.to;for(let l=!1,o=new K(i.doc,e,t[t.length-1].to);;)if(o.next(),o.done){if(l)return null;o=new K(i.doc,e,0,Math.max(0,t[t.length-1].from-1)),l=!0}else{if(l&&t.some(a=>a.from==o.value.from))continue;if(r){let a=i.wordAt(o.value.from);if(!a||a.from!=o.value.from||a.to!=o.value.to)continue}return o.value}}const en=({state:i,dispatch:e})=>{let{ranges:n}=i.selection;if(n.some(r=>r.from===r.to))return Jt({state:i,dispatch:e});let t=i.sliceDoc(n[0].from,n[0].to);if(i.selection.ranges.some(r=>i.sliceDoc(r.from,r.to)!=t))return!1;let s=_t(i,t);return s?(e(i.update({selection:i.selection.addRange(M.range(s.from,s.to),!1),effects:O.scrollIntoView(s.to)})),!0):!1},I=me.define({combine(i){return pe(i,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new gn(e),scrollToMatch:e=>O.scrollIntoView(e)})}});function tn(i){return i?[I.of(i),ue]:ue}class qe{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||Zt(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(n,t)=>t=="n"?`
2
2
  `:t=="r"?"\r":t=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new an(this):new rn(this)}getCursor(e,n=0,t){let s=e.doc?e:ce.create({doc:e});return t==null&&(t=s.doc.length),this.regexp?B(this,s,n,t):D(this,s,n,t)}}class Ve{constructor(e){this.spec=e}}function nn(i,e,n){return(t,s,r,l)=>{if(n&&!n(t,s,r,l))return!1;let o=t>=l&&s<=l+r.length?r.slice(t-l,s-l):e.doc.sliceString(t,s);return i(o,e,t,s)}}function D(i,e,n,t){let s;return i.wholeWord&&(s=sn(e.doc,e.charCategorizer(e.selection.main.head))),i.test&&(s=nn(i.test,e,s)),new K(e.doc,i.unquoted,n,t,i.caseSensitive?void 0:r=>r.toLowerCase(),s)}function sn(i,e){return(n,t,s,r)=>((r>n||r+s.length<t)&&(r=Math.max(0,n-2),s=i.sliceString(r,Math.min(i.length,t+2))),(e(te(s,n-r))!=L.Word||e(ne(s,n-r))!=L.Word)&&(e(ne(s,t-r))!=L.Word||e(te(s,t-r))!=L.Word))}class rn extends Ve{constructor(e){super(e)}nextMatch(e,n,t){let s=D(this.spec,e,t,e.doc.length).nextOverlapping();if(s.done){let r=Math.min(e.doc.length,n+this.spec.unquoted.length);s=D(this.spec,e,0,r).nextOverlapping()}return s.done||s.value.from==n&&s.value.to==t?null:s.value}prevMatchInRange(e,n,t){for(let s=t;;){let r=Math.max(n,s-1e4-this.spec.unquoted.length),l=D(this.spec,e,r,s),o=null;for(;!l.nextOverlapping().done;)o=l.value;if(o)return o;if(r==n)return null;s-=1e4}}prevMatch(e,n,t){let s=this.prevMatchInRange(e,0,n);return s||(s=this.prevMatchInRange(e,Math.max(0,t-this.spec.unquoted.length),e.doc.length)),s&&(s.from!=n||s.to!=t)?s:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,n){let t=D(this.spec,e,0,e.doc.length),s=[];for(;!t.next().done;){if(s.length>=n)return null;s.push(t.value)}return s}highlight(e,n,t,s){let r=D(this.spec,e,Math.max(0,n-this.spec.unquoted.length),Math.min(t+this.spec.unquoted.length,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}function on(i,e,n){return(t,s,r)=>(!n||n(t,s,r))&&i(r[0],e,t,s)}function B(i,e,n,t){let s;return i.wholeWord&&(s=ln(e.charCategorizer(e.selection.main.head))),i.test&&(s=on(i.test,e,s)),new Be(e.doc,i.search,{ignoreCase:!i.caseSensitive,test:s},n,t)}function te(i,e){return i.slice(Ee(i,e,!1),e)}function ne(i,e){return i.slice(e,Ee(i,e))}function ln(i){return(e,n,t)=>!t[0].length||(i(te(t.input,t.index))!=L.Word||i(ne(t.input,t.index))!=L.Word)&&(i(ne(t.input,t.index+t[0].length))!=L.Word||i(te(t.input,t.index+t[0].length))!=L.Word)}class an extends Ve{nextMatch(e,n,t){let s=B(this.spec,e,t,e.doc.length).next();return s.done&&(s=B(this.spec,e,0,n).next()),s.done?null:s.value}prevMatchInRange(e,n,t){for(let s=1;;s++){let r=Math.max(n,t-s*1e4),l=B(this.spec,e,r,t),o=null;for(;!l.next().done;)o=l.value;if(o&&(r==n||o.from>r+10))return o;if(r==n)return null}}prevMatch(e,n,t){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,t,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,t)=>{if(t=="&")return e.match[0];if(t=="$")return"$";for(let s=t.length;s>0;s--){let r=+t.slice(0,s);if(r>0&&r<e.match.length)return e.match[r]+t.slice(s)}return n})}matchAll(e,n){let t=B(this.spec,e,0,e.doc.length),s=[];for(;!t.next().done;){if(s.length>=n)return null;s.push(t.value)}return s}highlight(e,n,t,s){let r=B(this.spec,e,Math.max(0,n-250),Math.min(t+250,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}const j=T.define(),xe=T.define(),Q=V.define({create(i){return new ae(he(i).create(),null)},update(i,e){for(let n of e.effects)n.is(j)?i=new ae(n.value.create(),i.panel):n.is(xe)&&(i=new ae(i.query,n.value?ve:null));return i},provide:i=>Le.from(i,e=>e.panel)});class ae{constructor(e,n){this.query=e,this.panel=n}}const cn=P.mark({class:"cm-searchMatch"}),hn=P.mark({class:"cm-searchMatch cm-searchMatch-selected"}),un=Qe.fromClass(class{constructor(i){this.view=i,this.decorations=this.highlight(i.state.field(Q))}update(i){let e=i.state.field(Q);(e!=i.startState.field(Q)||i.docChanged||i.selectionSet||i.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:i,panel:e}){if(!e||!i.spec.valid)return P.none;let{view:n}=this,t=new _;for(let s=0,r=n.visibleRanges,l=r.length;s<l;s++){let{from:o,to:a}=r[s];for(;s<l-1&&a>r[s+1].from-500;)a=r[++s].to;i.highlight(n.state,o,a,(c,u)=>{let h=n.state.selection.ranges.some(f=>f.from==c&&f.to==u);t.add(c,u,h?hn:cn)})}return t.finish()}},{decorations:i=>i.decorations});function z(i){return e=>{let n=e.state.field(Q,!1);return n&&n.query.spec.valid?i(e,n):be(e)}}const se=z((i,{query:e})=>{let{to:n}=i.state.selection.main,t=e.nextMatch(i.state,n,n);if(!t)return!1;let s=M.single(t.from,t.to),r=i.state.facet(I);return i.dispatch({selection:s,effects:[ye(i,t),r.scrollToMatch(s.main,i)],userEvent:"select.search"}),Ke(i),!0}),ie=z((i,{query:e})=>{let{state:n}=i,{from:t}=n.selection.main,s=e.prevMatch(n,t,t);if(!s)return!1;let r=M.single(s.from,s.to),l=i.state.facet(I);return i.dispatch({selection:r,effects:[ye(i,s),l.scrollToMatch(r.main,i)],userEvent:"select.search"}),Ke(i),!0}),fn=z((i,{query:e})=>{let n=e.matchAll(i.state,1e3);return!n||!n.length?!1:(i.dispatch({selection:M.create(n.map(t=>M.range(t.from,t.to))),userEvent:"select.search.matches"}),!0)}),dn=({state:i,dispatch:e})=>{let n=i.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:t,to:s}=n.main,r=[],l=0;for(let o=new K(i.doc,i.sliceDoc(t,s));!o.next().done;){if(r.length>1e3)return!1;o.value.from==t&&(l=r.length),r.push(M.range(o.value.from,o.value.to))}return e(i.update({selection:M.create(r,l),userEvent:"select.search.matches"})),!0},Me=z((i,{query:e})=>{let{state:n}=i,{from:t,to:s}=n.selection.main;if(n.readOnly)return!1;let r=e.nextMatch(n,t,t);if(!r)return!1;let l=r,o=[],a,c,u=[];l.precise?l.from==t&&l.to==s&&(c=n.toText(e.getReplacement(l)),o.push({from:l.from,to:l.to,insert:c}),l=e.nextMatch(n,l.from,l.to),u.push(O.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(t).number)+"."))):l=e.nextMatch(n,l.from,l.to);let h=i.state.changes(o);return l&&(a=M.single(l.from,l.to).map(h),u.push(ye(i,l)),u.push(n.facet(I).scrollToMatch(a.main,i))),i.dispatch({changes:h,selection:a,effects:u,userEvent:"input.replace"}),!0}),mn=z((i,{query:e})=>{if(i.state.readOnly)return!1;let n=[];for(let s of e.matchAll(i.state,1e9)){let{from:r,to:l,precise:o}=s;o&&n.push({from:r,to:l,insert:e.getReplacement(s)})}if(!n.length)return!1;let t=i.state.phrase("replaced $ matches",n.length)+".";return i.dispatch({changes:n,effects:O.announce.of(t),userEvent:"input.replace.all"}),!0});function ve(i){return i.state.facet(I).createPanel(i)}function he(i,e){var n,t,s,r,l;let o=i.selection.main,a=o.empty||o.to>o.from+100?"":i.sliceDoc(o.from,o.to);if(e&&!a)return e;let c=i.facet(I);return new qe({search:((n=e?.literal)!==null&&n!==void 0?n:c.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:(t=e?.caseSensitive)!==null&&t!==void 0?t:c.caseSensitive,literal:(s=e?.literal)!==null&&s!==void 0?s:c.literal,regexp:(r=e?.regexp)!==null&&r!==void 0?r:c.regexp,wholeWord:(l=e?.wholeWord)!==null&&l!==void 0?l:c.wholeWord})}function He(i){let e=de(i,ve);return e&&e.dom.querySelector("[main-field]")}function Ke(i){let e=He(i);e&&e==i.root.activeElement&&e.select()}const be=i=>{let e=i.state.field(Q,!1);if(e&&e.panel){let n=He(i);if(n&&n!=i.root.activeElement){let t=he(i.state,e.query.spec);t.valid&&i.dispatch({effects:j.of(t)}),n.focus(),n.select()}}else i.dispatch({effects:[xe.of(!0),e?j.of(he(i.state,e.query.spec)):T.appendConfig.of(ue)]});return!0},je=i=>{let e=i.state.field(Q,!1);if(!e||!e.panel)return!1;let n=de(i,ve);return n&&n.dom.contains(i.root.activeElement)&&i.focus(),i.dispatch({effects:xe.of(!1)}),!0},pn=[{key:"Mod-f",run:be,scope:"editor search-panel"},{key:"F3",run:se,shift:ie,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:se,shift:ie,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:je,scope:"editor search-panel"},{key:"Mod-Shift-l",run:dn},{key:"Mod-Alt-g",run:Ut},{key:"Mod-d",run:en,preventDefault:!0}];class gn{constructor(e){this.view=e;let n=this.query=e.state.field(Q).query.spec;this.commit=this.commit.bind(this),this.searchField=b("input",{value:n.search,placeholder:k(e,"Find"),"aria-label":k(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=b("input",{value:n.replace,placeholder:k(e,"Replace"),"aria-label":k(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=b("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=b("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=b("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function t(s,r,l){return b("button",{class:"cm-button",name:s,onclick:r,type:"button"},l)}this.dom=b("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,t("next",()=>se(e),[k(e,"next")]),t("prev",()=>ie(e),[k(e,"previous")]),t("select",()=>fn(e),[k(e,"all")]),b("label",null,[this.caseField,k(e,"match case")]),b("label",null,[this.reField,k(e,"regexp")]),b("label",null,[this.wordField,k(e,"by word")]),...e.state.readOnly?[]:[b("br"),this.replaceField,t("replace",()=>Me(e),[k(e,"replace")]),t("replaceAll",()=>mn(e),[k(e,"replace all")])],b("button",{name:"close",onclick:()=>je(e),"aria-label":k(e,"close"),type:"button"},["×"])])}commit(){let e=new qe({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:j.of(e)}))}keydown(e){ht(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?ie:se)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Me(this.view))}update(e){for(let n of e.transactions)for(let t of n.effects)t.is(j)&&!t.value.eq(this.query)&&this.setQuery(t.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(I).top}}function k(i,e){return i.state.phrase(e)}const Y=30,Z=/[\s\.,:;?!]/;function ye(i,{from:e,to:n}){let t=i.state.doc.lineAt(e),s=i.state.doc.lineAt(n).to,r=Math.max(t.from,e-Y),l=Math.min(s,n+Y),o=i.state.sliceDoc(r,l);if(r!=t.from){for(let a=0;a<Y;a++)if(!Z.test(o[a+1])&&Z.test(o[a])){o=o.slice(a);break}}if(l!=s){for(let a=o.length-1;a>o.length-Y;a--)if(!Z.test(o[a-1])&&Z.test(o[a])){o=o.slice(0,a);break}}return O.announce.of(`${i.state.phrase("current match")}. ${o} ${i.state.phrase("on line")} ${t.number}.`)}const xn=O.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),ue=[Q,ot.low(un),xn],vn=ft({String:w.string,Number:w.number,"True False":w.bool,PropertyName:w.propertyName,Null:w.null,", :":w.separator,"[ ]":w.squareBracket,"{ }":w.brace}),bn=ut.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[vn],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),yn=()=>i=>{try{JSON.parse(i.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const n=On(e,i.state.doc);return[{from:n,message:e.message,severity:"error",to:n}]}return[]};function On(i,e){let n;return(n=i.message.match(/at position (\d+)/))?Math.min(+n[1],e.length):(n=i.message.match(/at line (\d+) column (\d+)/))?Math.min(e.line(+n[1]).from+ +n[2]-1,e.length):0}const Xe=mt.define({name:"json",parser:bn.configure({props:[pt.add({Object:ke({except:/^\s*\}/}),Array:ke({except:/^\s*\]/})}),gt.add({"Object Array":xt})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function wn(){return new dt(Xe)}class Pe{constructor(e,n,t){this.from=e,this.to=n,this.diagnostic=t}}class W{constructor(e,n,t){this.diagnostics=e,this.panel=n,this.selected=t}static init(e,n,t){let s=t.facet(R).markerFilter;s&&(e=s(e,t));let r=e.slice().sort((d,m)=>d.from-m.from||d.to-m.to),l=new _,o=[],a=0,c=t.doc.iter(),u=0,h=t.doc.length;for(let d=0;;){let m=d==r.length?null:r[d];if(!m&&!o.length)break;let g,x;if(o.length)g=a,x=o.reduce((v,y)=>Math.min(v,y.to),m&&m.from>g?m.from:1e8);else{if(g=m.from,g>h)break;x=m.to,o.push(m),d++}for(;d<r.length;){let v=r[d];if(v.from==g&&(v.to>v.from||v.to==g))o.push(v),d++,x=Math.min(v.to,x);else{x=Math.min(v.from,x);break}}x=Math.min(x,h);let S=!1;if(o.some(v=>v.from==g&&(v.to==x||x==h))&&(S=g==x,!S&&x-g<10)){let v=g-(u+c.value.length);v>0&&(c.next(v),u=g);for(let y=g;;){if(y>=x){S=!0;break}if(!c.lineBreak&&u+c.value.length>y)break;y=u+c.value.length,u+=c.value.length,c.next()}}let N=_e(o);if(S)l.add(g,g,P.widget({widget:new Qn(N),diagnostics:o.slice()}));else{let v=o.reduce((y,F)=>F.markClass?y+" "+F.markClass:y,"");l.add(g,x,P.mark({class:"cm-lintRange cm-lintRange-"+N+v,diagnostics:o.slice(),inclusiveEnd:o.some(y=>y.to>x)}))}if(a=x,a==h)break;for(let v=0;v<o.length;v++)o[v].to<=a&&o.splice(v--,1)}let f=l.finish();return new W(f,n,E(f))}}function E(i,e=null,n=0){let t=null;return i.between(n,1e9,(s,r,{spec:l})=>{if(!(e&&l.diagnostics.indexOf(e)<0))if(!t)t=new Pe(s,r,e||l.diagnostics[0]);else{if(l.diagnostics.indexOf(t.diagnostic)<0)return!1;t=new Pe(t.from,r,t.diagnostic)}}),t}function Ge(i,e){let n=e.pos,t=e.end||n,s=i.state.facet(R).hideOn(i,n,t);if(s!=null)return s;let r=i.startState.doc.lineAt(e.pos);return!!(i.effects.some(l=>l.is(re))||i.changes.touchesRange(r.from,Math.max(r.to,t)))}function ze(i,e){return i.field(C,!1)?e:e.concat(T.appendConfig.of(st))}function kn(i,e){return{effects:ze(i,[re.of(e)])}}const re=T.define(),Oe=T.define(),Fe=T.define(),C=V.define({create(){return new W(P.none,null,null)},update(i,e){if(e.docChanged&&i.diagnostics.size){let n=i.diagnostics.map(e.changes),t=null,s=i.panel;if(i.selected){let r=e.changes.mapPos(i.selected.from,1);t=E(n,i.selected.diagnostic,r)||E(n,null,r)}!n.size&&s&&e.state.facet(R).autoPanel&&(s=null),i=new W(n,s,t)}for(let n of e.effects)if(n.is(re)){let t=e.state.facet(R).autoPanel?n.value.length?X.open:null:i.panel;i=W.init(n.value,t,e.state)}else n.is(Oe)?i=new W(i.diagnostics,n.value?X.open:null,i.selected):n.is(Fe)&&(i=new W(i.diagnostics,i.panel,n.value));return i},provide:i=>[Le.from(i,e=>e.panel),O.decorations.from(i,e=>e.diagnostics)]}),Cn=P.mark({class:"cm-lintRange cm-lintRange-active"});function Sn(i,e,n){let{diagnostics:t}=i.state.field(C),s,r=-1,l=-1;t.between(e-(n<0?1:0),e+(n>0?1:0),(a,c,{spec:u})=>{if(e>=a&&e<=c&&(a==c||(e>a||n>0)&&(e<c||n<0)))return s=u.diagnostics,r=a,l=c,!1});let o=i.state.facet(R).tooltipFilter;return s&&o&&(s=o(s,i.state)),s?{pos:r,end:l,above:!0,create(){return{dom:Ye(i,s)}}}:null}function Ye(i,e){return b("ul",{class:"cm-tooltip-lint"},e.map(n=>Je(i,n,!1)))}const Mn=i=>{let e=i.state.field(C,!1);(!e||!e.panel)&&i.dispatch({effects:ze(i.state,[Oe.of(!0)])});let n=de(i,X.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},Re=i=>{let e=i.state.field(C,!1);return!e||!e.panel?!1:(i.dispatch({effects:Oe.of(!1)}),!0)},Pn=i=>{let e=i.state.field(C,!1);if(!e)return!1;let n=i.state.selection.main,t=E(e.diagnostics,null,n.to+1);return!t&&(t=E(e.diagnostics,null,0),!t||t.from==n.from&&t.to==n.to)?!1:(i.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0}),vt(i,t.from,1,{tooltip:nt,until:s=>s.docChanged||s.newSelection.main.head<t.from||s.newSelection.main.head>t.to}),!0)},Rn=[{key:"Mod-Shift-m",run:Mn,preventDefault:!0},{key:"F8",run:Pn}],Ze=Qe.fromClass(class{constructor(i){this.view=i,this.timeout=-1,this.set=!0;let{delay:e}=i.state.facet(R);this.lintTime=Date.now()+e,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,e)}run(){clearTimeout(this.timeout);let i=Date.now();if(i<this.lintTime-10)this.timeout=setTimeout(this.run,this.lintTime-i);else{this.set=!1;let{state:e}=this.view,{sources:n}=e.facet(R);n.length&&Tn(n.map(t=>Promise.resolve(t(this.view))),t=>{this.view.state.doc==e.doc&&this.view.dispatch(kn(this.view.state,t.reduce((s,r)=>s.concat(r))))},t=>{wt(this.view.state,t)})}}update(i){let e=i.state.facet(R);(i.docChanged||e!=i.startState.facet(R)||e.needsRefresh&&e.needsRefresh(i))&&(this.lintTime=Date.now()+e.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,e.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}});function Tn(i,e,n){let t=[],s=-1;for(let r of i)r.then(l=>{t.push(l),clearTimeout(s),t.length==i.length?e(t):s=setTimeout(()=>e(t),200)},n)}const R=me.define({combine(i){return{sources:i.map(e=>e.source).filter(e=>e!=null),...pe(i.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Te,tooltipFilter:Te,needsRefresh:(e,n)=>e?n?t=>e(t)||n(t):e:n,hideOn:(e,n)=>e?n?(t,s,r)=>e(t,s,r)||n(t,s,r):e:n,autoPanel:(e,n)=>e||n})}}});function Te(i,e){return i?e?(n,t)=>e(i(n,t),t):i:e}function An(i,e={}){return[R.of({source:i,config:e}),Ze,st]}function Ln(i){let e=i.plugin(Ze);e&&e.force()}function Ue(i){let e=[];if(i)e:for(let{name:n}of i){for(let t=0;t<n.length;t++){let s=n[t];if(/[a-zA-Z]/.test(s)&&!e.some(r=>r.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function Je(i,e,n){var t;let s=n?Ue(e.actions):[];return b("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},b("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(i):e.message),(t=e.actions)===null||t===void 0?void 0:t.map((r,l)=>{let o=!1,a=d=>{if(d.preventDefault(),o)return;o=!0;let m=E(i.state.field(C).diagnostics,e);m&&r.apply(i,m.from,m.to)},{name:c}=r,u=s[l]?c.indexOf(s[l]):-1,h=u<0?c:[c.slice(0,u),b("u",c.slice(u,u+1)),c.slice(u+1)],f=r.markClass?" "+r.markClass:"";return b("button",{type:"button",class:"cm-diagnosticAction"+f,onclick:a,onmousedown:a,"aria-label":` Action: ${c}${u<0?"":` (access key "${s[l]})"`}.`},h)}),e.source&&b("div",{class:"cm-diagnosticSource"},e.source))}class Qn extends Ot{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return b("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class Ae{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Je(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class X{constructor(e){this.view=e,this.items=[];let n=s=>{if(!(s.ctrlKey||s.altKey||s.metaKey)){if(s.keyCode==27)Re(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:r}=this.items[this.selectedIndex],l=Ue(r.actions);for(let o=0;o<l.length;o++)if(l[o].toUpperCase().charCodeAt(0)==s.keyCode){let a=E(this.view.state.field(C).diagnostics,r);a&&r.actions[o].apply(e,a.from,a.to)}}else return;s.preventDefault()}},t=s=>{for(let r=0;r<this.items.length;r++)this.items[r].dom.contains(s.target)&&this.moveSelection(r)};this.list=b("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:t}),this.dom=b("div",{class:"cm-panel-lint"},this.list,b("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Re(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(C).selected;if(!e)return-1;for(let n=0;n<this.items.length;n++)if(this.items[n].diagnostic==e.diagnostic)return n;return-1}update(){let{diagnostics:e,selected:n}=this.view.state.field(C),t=0,s=!1,r=null,l=new Set;for(e.between(0,this.view.state.doc.length,(o,a,{spec:c})=>{for(let u of c.diagnostics){if(l.has(u))continue;l.add(u);let h=-1,f;for(let d=t;d<this.items.length;d++)if(this.items[d].diagnostic==u){h=d;break}h<0?(f=new Ae(this.view,u),this.items.splice(t,0,f),s=!0):(f=this.items[h],h>t&&(this.items.splice(t,h-t),s=!0)),n&&f.diagnostic==n.diagnostic?f.dom.hasAttribute("aria-selected")||(f.dom.setAttribute("aria-selected","true"),r=f):f.dom.hasAttribute("aria-selected")&&f.dom.removeAttribute("aria-selected"),t++}});t<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)s=!0,this.items.pop();this.items.length==0&&(this.items.push(new Ae(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),s=!0),r?(this.list.setAttribute("aria-activedescendant",r.id),this.view.requestMeasure({key:this,read:()=>({sel:r.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:o,panel:a})=>{let c=a.height/this.list.offsetHeight;o.top<a.top?this.list.scrollTop-=(a.top-o.top)/c:o.bottom>a.bottom&&(this.list.scrollTop+=(o.bottom-a.bottom)/c)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let e=this.list.firstChild;function n(){let t=e;e=t.nextSibling,t.remove()}for(let t of this.items)if(t.dom.parentNode==this.list){for(;e!=t.dom;)n();e=t.dom.nextSibling}else this.list.insertBefore(t.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(C),t=E(n.diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:Fe.of(t)})}static open(e){return new X(e)}}function J(i,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(i)}</svg>')`}function U(i){return J(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${i}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const En=O.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:U("#f11")},".cm-lintRange-warning":{backgroundImage:U("orange")},".cm-lintRange-info":{backgroundImage:U("#999")},".cm-lintRange-hint":{backgroundImage:U("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function Wn(i){return i=="error"?4:i=="warning"?3:i=="info"?2:1}function _e(i){let e="hint",n=1;for(let t of i){let s=Wn(t.severity);s>n&&(n=s,e=t.severity)}return e}class et extends Ne{constructor(e){super(),this.diagnostics=e,this.severity=_e(e)}toDOM(e){let n=document.createElement("div");n.className="cm-lint-marker cm-lint-marker-"+this.severity;let t=this.diagnostics,s=e.state.facet(oe).tooltipFilter;return s&&(t=s(t,e.state)),t.length&&(n.onmouseover=()=>Nn(e,n,t)),n}}function In(i,e){let n=t=>{let s=e.getBoundingClientRect();if(!(t.clientX>s.left-10&&t.clientX<s.right+10&&t.clientY>s.top-10&&t.clientY<s.bottom+10)){for(let r=t.target;r;r=r.parentNode)if(r.nodeType==1&&r.classList.contains("cm-tooltip-lint"))return;window.removeEventListener("mousemove",n),i.state.field(tt)&&i.dispatch({effects:we.of(null)})}};window.addEventListener("mousemove",n)}function Nn(i,e,n){function t(){let l=i.elementAtHeight(e.getBoundingClientRect().top+5-i.documentTop);i.coordsAtPos(l.from)&&i.dispatch({effects:we.of({pos:l.from,above:!1,clip:!1,create(){return{dom:Ye(i,n),getCoords:()=>e.getBoundingClientRect()}}})}),e.onmouseout=e.onmousemove=null,In(i,e)}let{hoverTime:s}=i.state.facet(oe),r=setTimeout(t,s);e.onmouseout=()=>{clearTimeout(r),e.onmouseout=e.onmousemove=null},e.onmousemove=()=>{clearTimeout(r),r=setTimeout(t,s)}}function Dn(i,e){let n=Object.create(null);for(let s of e){let r=i.lineAt(s.from);(n[r.from]||(n[r.from]=[])).push(s)}let t=[];for(let s in n)t.push(new et(n[s]).range(+s));return We.of(t,!0)}const Bn=Ie({class:"cm-gutter-lint",markers:i=>i.state.field(fe),widgetMarker:(i,e,n)=>{let t=[];return i.state.field(fe).between(n.from,n.to,(s,r,l)=>{s>n.from&&s<n.to&&t.push(...l.diagnostics)}),t.length?new et(t):null}}),fe=V.define({create(){return We.empty},update(i,e){i=i.map(e.changes);let n=e.state.facet(oe).markerFilter;for(let t of e.effects)if(t.is(re)){let s=t.value;n&&(s=n(s||[],e.state)),i=Dn(e.state.doc,s.slice(0))}return i}}),we=T.define(),tt=V.define({create(){return null},update(i,e){return i&&e.docChanged&&(i=Ge(e,i)?null:{...i,pos:e.changes.mapPos(i.pos)}),e.effects.reduce((n,t)=>t.is(we)?t.value:n,i)},provide:i=>bt.from(i)}),$n=O.baseTheme({".cm-gutter-lint":{width:"1.4em","& .cm-gutterElement":{padding:".2em"}},".cm-lint-marker":{width:"1em",height:"1em"},".cm-lint-marker-info":{content:J('<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>')},".cm-lint-marker-warning":{content:J('<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>')},".cm-lint-marker-error":{content:J('<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>')}}),nt=yt(Sn,{hideOn:Ge}),st=[C,O.decorations.compute([C],i=>{let{selected:e,panel:n}=i.field(C);return!e||!n||e.from==e.to?P.none:P.set([Cn.range(e.from,e.to)])}),nt,En],oe=me.define({combine(i){return pe(i,{hoverTime:300,markerFilter:null,tooltipFilter:null})}});function qn(i={}){return[oe.of(i),fe,Bn,$n,tt]}class H{constructor(e=[],n=H.FIELDS){this.at=e,this.format=n}static FIELDS=Yt;fieldsAt(e){let n=this.format;for(const t of e)n=n?.[t]?.fields;return n}pathTo(e,n){const t=[];for(let s=e;s;s=s.parent)if(s.name==="Property"){const r=s.getChild("PropertyName");r&&t.unshift(n.slice(r.from,r.to).replace(/^"|"$/g,""))}return[...this.at,...t]}keyCompletions(e){return Object.entries(e).map(([n,t])=>({label:`"${n}"`,apply:`"${n}": `,type:t.type==="enum"?"enum":t.type==="object"||t.type==="array"?"class":"property",detail:t.type==="enum"?t.values?.join(" | "):t.type,...t.doc===void 0?{}:{info:t.doc}}))}valueCompletions(e){return(e.values??e.suggest??[]).map(n=>({label:`"${n}"`,apply:`"${n}"`,type:"enum"}))}get source(){return e=>{const n=e.state.doc.toString(),t=kt(e.state).resolveInner(e.pos,-1),s=n.slice(0,e.pos);if(t.name==="PropertyName")return this.keys(this.pathTo(t.parent?.parent??null,n),t.from,t.to);if(t.name==="String"&&t.parent?.name==="Property")return this.values(this.fieldAt(this.pathTo(t.parent,n)),t.from,t.to);if(/:\s*$/.test(s)){const l=t.name==="Property"?t:this.propertyBefore(t,e.pos);return this.values(l?this.fieldAt(this.pathTo(l,n)):void 0,e.pos)}if(!e.explicit&&!/[{,[]\s*$/.test(s))return null;const r=t.name==="Object"?t:t.parent?.name==="Object"?t.parent:t;return this.keys(this.pathTo(r,n),e.pos)}}keys(e,n,t){const s=this.fieldsAt(e);return s===void 0?null:{from:n,...t===void 0?{}:{to:t},options:this.keyCompletions(s),validFor:H.WORD}}values(e,n,t){return e?.values===void 0&&e?.suggest===void 0?null:{from:n,...t===void 0?{}:{to:t},options:this.valueCompletions(e),validFor:H.WORD}}static WORD=/^"?[\w-]*"?$/;fieldAt(e){return this.fieldsAt(e.slice(0,-1))?.[e[e.length-1]]}propertyBefore(e,n){let t;for(let s=e.firstChild;s;s=s.nextSibling)s.name==="Property"&&s.from<n&&(t=s);return t}}class q{static at(e,n){const t=Ce(e,e.doc.length,50);if(t===null)return[];const s=[];let r=null;for(let l=t.resolveInner(n,-1);l!==null;r=l,l=l.parent)if(l.name==="Property"){const o=l.getChild("PropertyName");o!==null&&s.unshift(JSON.parse(e.sliceDoc(o.from,o.to)))}else l.name==="Array"&&r!==null&&s.unshift(q.indexOf(l,r));return s}static range(e,n){const t=Ce(e,e.doc.length,50);if(t===null)return;let s=t.topNode.firstChild,r;for(const l of n){if(s===null)return;if(typeof l=="number"){if(s.name!=="Array"||(s=q.elements(s)[l]??null,s===null))return;r={from:s.from,to:s.to}}else{if(s.name!=="Object")return;let o=null;for(let a=s.firstChild;a!==null;a=a.nextSibling){if(a.name!=="Property")continue;const c=a.getChild("PropertyName");if(c!==null&&JSON.parse(e.sliceDoc(c.from,c.to))===l){o=a;break}}if(o===null)return;r={from:o.from,to:o.to},s=o.lastChild}}return r}static elements(e){const n=[];for(let t=e.firstChild;t!==null;t=t.nextSibling)["[","]",",","LineComment","BlockComment"].includes(t.name)||n.push(t);return n}static indexOf(e,n){return q.elements(e).findIndex(t=>t.from===n.from&&t.to===n.to)}}class A{static MAX_EDITS=1500;static MAX_WORK=1e6;static changed(e,n){return A.compare(e,n).changed}static compare(e,n){let t=0;for(;t<e.length&&t<n.length&&e[t]===n[t];)t++;let s=e.length,r=n.length;for(;s>t&&r>t&&e[s-1]===n[r-1];)s--,r--;const l=e.slice(t,s),o=n.slice(t,r),a=(g,x)=>Array.from({length:Math.max(0,x-g)},(S,N)=>g+N);if(l.length===0)return{changed:a(t,t+o.length),removed:[]};if(o.length===0)return{changed:[],removed:[t]};const c=A.matchedOf(l,o);if(c===void 0){const g=A.nearOf(l,o);return{changed:g.changed.map(x=>t+x),removed:g.removed.map(x=>t+x)}}const u=[],h=[];let f=-1,d=-1;const m=(g,x)=>{g-f-1>x-d-1&&h.push(t+x)};for(let g=0;g<o.length;g++){const x=c.get(g);if(x===void 0){u.push(t+g);continue}m(x,g),f=x,d=g}return m(l.length,o.length),{changed:u,removed:h}}static LOOKAHEAD=64;static nearOf(e,n){const t=[],s=[];let r=0,l=0;const o=(a,c,u)=>{for(let h=1;h<=A.LOOKAHEAD&&c+h<a.length;h++)if(a[c+h]===u)return h;return 0};for(;r<e.length&&l<n.length;){if(e[r]===n[l]){r++,l++;continue}const a=o(n,l,e[r]),c=o(e,r,n[l]);if(a>0&&(c===0||a<=c)){for(let u=0;u<a;u++)t.push(l+u);l+=a}else c>0?(s.push(l),r+=c):(t.push(l),r++,l++)}for(;l<n.length;l++)t.push(l);return r<e.length&&s.push(n.length),{changed:t,removed:s}}static matchedOf(e,n){const t=e.length,s=n.length,r=Math.min(t+s,A.MAX_EDITS),l=r+1,o=new Int32Array(2*r+3),a=[];let c=0;for(let u=0;u<=r;u++){a.push(o.slice());for(let h=-u;h<=u;h+=2){const f=h===-u||h!==u&&o[l+h-1]<o[l+h+1];let d=f?o[l+h+1]:o[l+h-1]+1,m=d-h;for(;d<t&&m<s&&e[d]===n[m];)d++,m++;if(c+=1+d-(f?o[l+h+1]:o[l+h-1]+1),c>A.MAX_WORK)return;if(o[l+h]=d,d>=t&&m>=s)return A.walkBack(a,u,t,s,l)}}}static walkBack(e,n,t,s,r){const l=new Map;let o=t,a=s;for(let c=n;c>0;c--){const u=e[c],h=o-a,d=h===-c||h!==c&&u[r+h-1]<u[r+h+1]?h+1:h-1,m=u[r+d],g=m-d;for(;o>m&&a>g;)o--,a--,l.set(a,o);o=m,a=g}for(;o>0&&a>0;)o--,a--,l.set(a,o);return l}}class G{static CHUNK=65536;static commonPrefix(e,n){const t=Math.min(e.length,n.length),s=G.CHUNK;let r=0;for(;r+s<=t&&e.slice(r,r+s)===n.slice(r,r+s);)r+=s;for(;r<t&&e.charCodeAt(r)===n.charCodeAt(r);)r++;return r}static commonSuffix(e,n,t){const s=G.CHUNK;let r=0;for(;r+s<=t&&e.slice(e.length-r-s,e.length-r)===n.slice(n.length-r-s,n.length-r);)r+=s;for(;r<t&&e.charCodeAt(e.length-1-r)===n.charCodeAt(n.length-1-r);)r++;return r}}class p{static COLOURS=Ct.define([{tag:w.propertyName,color:"var(--file-key)"},{tag:[w.string,w.attributeValue],color:"var(--file-string)"},{tag:[w.number,w.bool,w.null],color:"var(--file-literal)"},{tag:w.invalid,color:"var(--rr0-alert)"}]);view;placement;changing=!1;cachedText;editedSinceWritten=!1;changedField;silent=!1;static SET_BASELINE=T.define();static WHOLE_TEXT=St.define();static marker(e,n){return new class extends Ne{toDOM(){const t=document.createElement("div");if(t.className=e?"cm-changed-bar":"cm-changed-none",n){const s=document.createElement("div");s.className="cm-removed-tick",t.appendChild(s)}return t}}}static JSON_LINT=yn();static CHANGED_MARKER=p.marker(!0,!1);static REMOVED_MARKER=p.marker(!1,!0);static BOTH_MARKER=p.marker(!0,!0);static REVEAL=T.define();static revealed=V.define({create:()=>null,update:(e,n)=>{for(const t of n.effects)if(t.is(p.REVEAL))return t.value;return e===null?null:{from:n.changes.mapPos(e.from,1),to:n.changes.mapPos(e.to,-1)}},provide:e=>O.decorations.compute([e],n=>{const t=n.field(e),s=new _;if(t!==null)for(let r=n.doc.lineAt(t.from).number;r<=n.doc.lineAt(Math.min(t.to,n.doc.length)).number;r++)s.add(n.doc.line(r).from,n.doc.line(r).from,P.line({class:"cm-revealed-line"}));return s.finish()})});static removedLines(e,n){return new Set([...n].map(t=>Math.min(t,e.doc.lines-1)))}static changeMarks(e){const n=o=>({text:o,doc:Ft.of(o.split(`
3
3
  `))}),t=(o,a,c)=>{const u=c??a.doc.toString(),h=p.commonPrefix(o.text,u);if(h===o.text.length&&h===u.length)return{baseline:o,changed:new Set,removed:new Set};const f=p.commonSuffix(o.text,u,Math.min(o.text.length,u.length)-h),d=a.doc.lineAt(h).number,m=o.doc.lineAt(o.text.length-f).number,g=a.doc.lineAt(u.length-f).number,x=(y,F)=>y.sliceString(y.line(d).from,y.line(F).to).split(`
4
4
  `),{changed:S,removed:N}=A.compare(x(o.doc,m),x(a.doc,g)),v=d-1;return{baseline:o,changed:new Set(S.map(y=>y+v)),removed:new Set(N.map(y=>y+v))}},s=V.define({create:o=>t(n(e),o),update:(o,a)=>{let c=o.baseline;for(const u of a.effects)u.is(p.SET_BASELINE)&&(c=n(u.value));return!a.docChanged&&c===o.baseline?o:t(c,a.state,a.annotation(p.WHOLE_TEXT))}}),r=O.decorations.compute([s],o=>{const a=o.field(s),c=p.removedLines(o,a.removed),u=new Set([...a.changed,...c]),h=new _;for(const f of[...u].sort((d,m)=>d-m)){if(f>=o.doc.lines)continue;const d=[a.changed.has(f)?"cm-changed-line":"",[...a.removed].some(m=>m===f)?"cm-removed-above":"",[...a.removed].some(m=>m>=o.doc.lines)&&f===o.doc.lines-1?"cm-removed-below":""].filter(Boolean).join(" ");h.add(o.doc.line(f+1).from,o.doc.line(f+1).from,P.line({class:d}))}return h.finish()}),l=Ie({class:"cm-changed-gutter",lineMarker:(o,a)=>{const c=o.state.field(s),u=o.state.doc.lineAt(a.from).number-1,h=c.changed.has(u),f=p.removedLines(o.state,c.removed).has(u);return h&&f?p.BOTH_MARKER:h?p.CHANGED_MARKER:f?p.REMOVED_MARKER:null},lineMarkerChange:o=>o.docChanged||o.transactions.some(a=>a.effects.some(c=>c.is(p.SET_BASELINE))),initialSpacer:()=>p.CHANGED_MARKER});return{field:s,extensions:[s,r,l]}}constructor(e,n,t,s,r={}){const l=[...Nt,...Dt,...Bt,...$t,...qt,...Rn,...pn,Vt],o=p.changeMarks(r.baseline??n);this.changedField=o.field,l.unshift({key:"F7",run:()=>this.gotoChange(1),preventDefault:!0},{key:"Shift-F7",run:()=>this.gotoChange(-1),preventDefault:!0}),this.view=new O({...p.rootOf(e),doc:n,extensions:[...o.extensions,p.revealed,Mt(),tn({top:!0}),ce.phrases.of(r.phrases??{}),Pt(),Rt(),Tt(),At(),Lt(),Qt(),Et(),Wt(),It.of(l),ce.tabSize.of(2),Ht(p.COLOURS,{fallback:!0}),wn(),Xe.data.of({autocomplete:new H([],r.schema).source}),qn(),An(a=>a.dom.isConnected?p.JSON_LINT(a):[]),O.contentAttributes.of({"aria-label":s}),O.theme({"&":{maxHeight:"28rem",fontSize:"0.82em",border:"1px solid color-mix(in srgb, currentColor 25%, transparent)",borderRadius:"4px"},"&.cm-focused":{outline:"2px solid color-mix(in srgb, currentColor 45%, transparent)"},".cm-scroller":{overflow:"auto",fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace"},".cm-tooltip":{backgroundColor:"Canvas",color:"CanvasText",border:"1px solid color-mix(in srgb, CanvasText 30%, transparent)"},".cm-tooltip-autocomplete > ul > li[aria-selected]":{backgroundColor:"Highlight",color:"HighlightText"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"currentColor"},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground":{backgroundColor:"color-mix(in srgb, currentColor 22%, transparent)"},".cm-gutters":{backgroundColor:"transparent",color:"color-mix(in srgb, currentColor 55%, transparent)",border:"none"},".cm-changed-gutter":{width:"4px"},".cm-changed-bar":{width:"3px",height:"100%",backgroundColor:"#2f81f7"},".cm-changed-gutter .cm-gutterElement":{position:"relative"},".cm-changed-none":{width:"3px",height:"100%"},".cm-removed-tick":{position:"absolute",left:"0",top:"0",width:"0",height:"0",borderTop:"4px solid transparent",borderBottom:"4px solid transparent",borderLeft:"6px solid #e5534b"},".cm-removed-above":{boxShadow:"inset 0 2px 0 #e5534b"},".cm-removed-below":{boxShadow:"inset 0 -2px 0 #e5534b"},".cm-changed-line":{backgroundColor:"color-mix(in srgb, #2f81f7 13%, transparent)"},".cm-revealed-line":{backgroundColor:"color-mix(in srgb, #f2cc60 30%, transparent)",boxShadow:"inset 3px 0 0 #f2cc60"},".cm-panels":{backgroundColor:"color-mix(in srgb, currentColor 6%, transparent)",color:"inherit",borderColor:"color-mix(in srgb, currentColor 25%, transparent)"},".cm-panel.cm-search input, .cm-panel.cm-search button":{fontSize:"inherit",color:"inherit"},".cm-panel.cm-search input[type=text], .cm-panel.cm-search input:not([type])":{backgroundColor:"color-mix(in srgb, currentColor 8%, transparent)",border:"1px solid color-mix(in srgb, currentColor 35%, transparent)",borderRadius:"3px",padding:"2px 5px"},".cm-panel.cm-search button":{backgroundImage:"none",backgroundColor:"color-mix(in srgb, currentColor 12%, transparent)",border:"1px solid color-mix(in srgb, currentColor 35%, transparent)",borderRadius:"3px"},".cm-panel.cm-search label, .cm-panel.cm-search [name=close]":{color:"inherit"},".cm-searchMatch":{backgroundColor:"color-mix(in srgb, #f2cc60 40%, transparent)"},".cm-searchMatch-selected":{backgroundColor:"color-mix(in srgb, #f2cc60 75%, transparent)"}}),O.updateListener.of(a=>{a.docChanged&&(this.cachedText=void 0),a.docChanged&&!this.changing&&(this.editedSinceWritten=!0,t(this.text)),a.selectionSet&&!this.silent&&!this.changing&&a.view.hasFocus&&(a.state.field(p.revealed)!==null&&queueMicrotask(()=>this.view.dispatch({effects:p.REVEAL.of(null)})),r.caretMoved?.(q.at(a.state,a.state.selection.main.head)))})]}),this.placement=this.placeWhileShown(e)}placeWhileShown(e){const n=()=>{e.append(this.view.dom),Ln(this.view);const{root:s}=p.rootOf(e);s&&s!==this.view.root&&this.view.setRoot(s)};if((typeof e.checkVisibility!="function"||e.checkVisibility())&&n(),typeof ResizeObserver>"u")return;const t=new ResizeObserver(s=>{const r=s[s.length-1].contentRect.width>0;r&&!this.view.dom.isConnected?(n(),this.view.requestMeasure()):!r&&this.view.dom.isConnected&&this.view.dom.remove()});return t.observe(e),t}get text(){return this.cachedText??=this.view.state.doc.toString()}get edited(){return this.editedSinceWritten}set text(e){this.replaceText(e,!1)}replaceText(e,n){const t=this.text;if(e!==t){this.changing=!0;try{const s=Math.min(this.view.state.selection.main.head,e.length);this.view.dispatch({changes:p.changesBetween(t,e),selection:{anchor:s},annotations:[Kt.of("full"),p.WHOLE_TEXT.of(e)]})}finally{this.changing=!1}this.cachedText=e,this.editedSinceWritten=!1,n&&this.revealChange(t,p.MOST_LINES_SHOWN)}}static rootOf(e){const n=e.getRootNode();return n instanceof Document||n instanceof ShadowRoot?{root:n}:{}}static changeBetween(e,n){const t=p.commonPrefix(e,n),s=p.commonSuffix(e,n,Math.min(e.length,n.length)-t);return{from:t,to:e.length-s,insert:n.slice(t,n.length-s)}}static changesBetween(e,n){const t=p.commonPrefix(e,n);if(t===e.length&&t===n.length)return[];const s=p.commonSuffix(e,n,Math.min(e.length,n.length)-t),r=e.lastIndexOf(`
@@ -1,4 +1,4 @@
1
- import{an as ee,ak as F,ao as j,ap as M,aq as te,a3 as G,a4 as $,a9 as E,ar as ie,as as O,at as J,ah as ne,au as I,a0 as se,av as B,aw as oe,ax as ae,ay as re,Y as le,af as ce,az as de,aj as fe,aA as ue,aB as pe,aC as he,aD as me,aE as V,ag as ge}from"./rr0-sighting-editor.mjs";const k=new G,P=new E;class Y extends ee{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],n=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],i=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(i),this.setAttribute("position",new F(e,3)),this.setAttribute("uv",new F(n,2))}applyMatrix4(e){const n=this.attributes.instanceStart,i=this.attributes.instanceEnd;return n!==void 0&&(n.applyMatrix4(e),i.applyMatrix4(e),n.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const i=new j(n,6,1);return this.setAttribute("instanceStart",new M(i,3,0)),this.setAttribute("instanceEnd",new M(i,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const i=new j(n,6,1);return this.setAttribute("instanceColorStart",new M(i,3,0)),this.setAttribute("instanceColorEnd",new M(i,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new te(e.geometry)),this}fromLineSegments(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new G);const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;e!==void 0&&n!==void 0&&(this.boundingBox.setFromBufferAttribute(e),k.setFromBufferAttribute(n),this.boundingBox.union(k))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new $),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(e!==void 0&&n!==void 0){const i=this.boundingSphere.center;this.boundingBox.getCenter(i);let t=0;for(let o=0,l=e.count;o<l;o++)P.fromBufferAttribute(e,o),t=Math.max(t,i.distanceToSquared(P)),P.fromBufferAttribute(n,o),t=Math.max(t,i.distanceToSquared(P));this.boundingSphere.radius=Math.sqrt(t),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}}I.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new ne},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};O.line={uniforms:J.merge([I.common,I.fog,I.line]),vertexShader:`
1
+ import{as as ee,ap as F,at as G,au as M,av as te,a9 as j,aa as $,V as E,aw as ie,ax as I,ay as J,am as ne,az as O,a6 as se,aA as B,aB as oe,o as ae,aC as re,a3 as le,ak as ce,aD as de,ao as fe,aE as ue,aF as pe,aG as he,aH as me,aI as V,al as ge}from"./rr0-sighting-editor.mjs";const k=new j,P=new E;class Q extends ee{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],n=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],i=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(i),this.setAttribute("position",new F(e,3)),this.setAttribute("uv",new F(n,2))}applyMatrix4(e){const n=this.attributes.instanceStart,i=this.attributes.instanceEnd;return n!==void 0&&(n.applyMatrix4(e),i.applyMatrix4(e),n.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const i=new G(n,6,1);return this.setAttribute("instanceStart",new M(i,3,0)),this.setAttribute("instanceEnd",new M(i,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const i=new G(n,6,1);return this.setAttribute("instanceColorStart",new M(i,3,0)),this.setAttribute("instanceColorEnd",new M(i,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new te(e.geometry)),this}fromLineSegments(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new j);const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;e!==void 0&&n!==void 0&&(this.boundingBox.setFromBufferAttribute(e),k.setFromBufferAttribute(n),this.boundingBox.union(k))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new $),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(e!==void 0&&n!==void 0){const i=this.boundingSphere.center;this.boundingBox.getCenter(i);let t=0;for(let o=0,l=e.count;o<l;o++)P.fromBufferAttribute(e,o),t=Math.max(t,i.distanceToSquared(P)),P.fromBufferAttribute(n,o),t=Math.max(t,i.distanceToSquared(P));this.boundingSphere.radius=Math.sqrt(t),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}}O.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new ne},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};I.line={uniforms:J.merge([O.common,O.fog,O.line]),vertexShader:`
2
2
  #include <common>
3
3
  #include <color_pars_vertex>
4
4
  #include <fog_pars_vertex>
@@ -390,4 +390,4 @@ import{an as ee,ak as F,ao as j,ap as M,aq as te,a3 as G,a4 as $,a9 as E,ar as i
390
390
  #include <premultiplied_alpha_fragment>
391
391
 
392
392
  }
393
- `};class N extends ie{constructor(e){super({type:"LineMaterial",uniforms:J.clone(O.line.uniforms),vertexShader:O.line.vertexShader,fragmentShader:O.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0!==this.worldUnits&&(this.needsUpdate=!0),e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}const H=new B,q=new E,X=new E,f=new B,u=new B,x=new B,W=new E,R=new ae,p=new oe,K=new E,T=new G,C=new $,S=new B;let b,z;function Z(h,e,n){return S.set(0,0,-e,1).applyMatrix4(h.projectionMatrix),S.multiplyScalar(1/S.w),S.x=z/n.width,S.y=z/n.height,S.applyMatrix4(h.projectionMatrixInverse),S.multiplyScalar(1/S.w),Math.abs(Math.max(S.x,S.y))}function ve(h,e){const n=h.matrixWorld,i=h.geometry,t=i.attributes.instanceStart,o=i.attributes.instanceEnd,l=Math.min(i.instanceCount,t.count);for(let s=0,a=l;s<a;s++){p.start.fromBufferAttribute(t,s),p.end.fromBufferAttribute(o,s),p.applyMatrix4(n);const d=new E,m=new E;b.distanceSqToSegment(p.start,p.end,m,d),m.distanceTo(d)<z*.5&&e.push({point:m,pointOnLine:d,distance:b.origin.distanceTo(m),object:h,face:null,faceIndex:s,uv:null,uv1:null})}}function ye(h,e,n){const i=e.projectionMatrix,o=h.material.resolution,l=h.matrixWorld,s=h.geometry,a=s.attributes.instanceStart,d=s.attributes.instanceEnd,m=Math.min(s.instanceCount,a.count),c=-e.near;b.at(1,x),x.w=1,x.applyMatrix4(e.matrixWorldInverse),x.applyMatrix4(i),x.multiplyScalar(1/x.w),x.x*=o.x/2,x.y*=o.y/2,x.z=0,W.copy(x),R.multiplyMatrices(e.matrixWorldInverse,l);for(let g=0,r=m;g<r;g++){if(f.fromBufferAttribute(a,g),u.fromBufferAttribute(d,g),f.w=1,u.w=1,f.applyMatrix4(R),u.applyMatrix4(R),f.z>c&&u.z>c)continue;if(f.z>c){const _=f.z-u.z,w=(f.z-c)/_;f.lerp(u,w)}else if(u.z>c){const _=u.z-f.z,w=(u.z-c)/_;u.lerp(f,w)}f.applyMatrix4(i),u.applyMatrix4(i),f.multiplyScalar(1/f.w),u.multiplyScalar(1/u.w),f.x*=o.x/2,f.y*=o.y/2,u.x*=o.x/2,u.y*=o.y/2,p.start.copy(f),p.start.z=0,p.end.copy(u),p.end.z=0;const y=p.closestPointToPointParameter(W,!0);p.at(y,K);const L=re.lerp(f.z,u.z,y),U=L>=-1&&L<=1,D=W.distanceTo(K)<z*.5;if(U&&D){p.start.fromBufferAttribute(a,g),p.end.fromBufferAttribute(d,g),p.start.applyMatrix4(l),p.end.applyMatrix4(l);const _=new E,w=new E;b.distanceSqToSegment(p.start,p.end,w,_),n.push({point:w,pointOnLine:_,distance:b.origin.distanceTo(w),object:h,face:null,faceIndex:g,uv:null,uv1:null})}}}class we extends se{constructor(e=new Y,n=new N({color:Math.random()*16777215})){super(e,n),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,n=e.attributes.instanceStart,i=e.attributes.instanceEnd,t=new Float32Array(2*n.count);for(let l=0,s=0,a=n.count;l<a;l++,s+=2)q.fromBufferAttribute(n,l),X.fromBufferAttribute(i,l),t[s]=s===0?0:t[s-1],t[s+1]=t[s]+q.distanceTo(X);const o=new j(t,2,1);return e.setAttribute("instanceDistanceStart",new M(o,1,0)),e.setAttribute("instanceDistanceEnd",new M(o,1,1)),this}raycast(e,n){const i=this.material.worldUnits,t=e.camera;if(t===null&&!i&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'),i===!1&&(this.material.resolution.x===0||this.material.resolution.y===0))return;const o=e.params.Line2!==void 0&&e.params.Line2.threshold||0;b=e.ray;const l=this.matrixWorld,s=this.geometry,a=this.material;z=a.linewidth+o,s.boundingSphere===null&&s.computeBoundingSphere(),C.copy(s.boundingSphere).applyMatrix4(l);let d;if(i)d=z*.5;else{const c=Math.max(t.near,C.distanceToPoint(b.origin));d=Z(t,c,a.resolution)}if(C.radius+=d,b.intersectsSphere(C)===!1)return;s.boundingBox===null&&s.computeBoundingBox(),T.copy(s.boundingBox).applyMatrix4(l);let m;if(i)m=z*.5;else{const c=Math.max(t.near,T.distanceToPoint(b.origin));m=Z(t,c,a.resolution)}T.expandByScalar(m),b.intersectsBox(T)!==!1&&(i?ve(this,n):ye(this,t,n))}onBeforeRender(e){const n=this.material.uniforms;n&&n.resolution&&(e.getViewport(H),this.material.uniforms.resolution.value.set(H.z,H.w))}}class Q extends Y{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const n=e.length-3,i=new Float32Array(2*n);for(let t=0;t<n;t+=3)i[2*t]=e[t],i[2*t+1]=e[t+1],i[2*t+2]=e[t+2],i[2*t+3]=e[t+3],i[2*t+4]=e[t+4],i[2*t+5]=e[t+5];return super.setPositions(i),this}setColors(e){const n=e.length-3,i=new Float32Array(2*n);for(let t=0;t<n;t+=3)i[2*t]=e[t],i[2*t+1]=e[t+1],i[2*t+2]=e[t+2],i[2*t+3]=e[t+3],i[2*t+4]=e[t+4],i[2*t+5]=e[t+5];return super.setColors(i),this}setFromPoints(e){const n=e.length-1,i=new Float32Array(6*n);for(let t=0;t<n;t++)i[6*t]=e[t].x,i[6*t+1]=e[t].y,i[6*t+2]=e[t].z||0,i[6*t+3]=e[t+1].x,i[6*t+4]=e[t+1].y,i[6*t+5]=e[t+1].z||0;return super.setPositions(i),this}fromLine(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}}class xe extends we{constructor(e=new Q,n=new N({color:Math.random()*16777215})){super(e,n),this.isLine2=!0,this.type="Line2"}}class A{constructor(e){this.layer=e,this.group.name="traces"}static LINE_WIDTH_PX=2.5;static MARKER_SIZE_PX=9;static LABEL_HEIGHT_PX=15;static STEP_M=15;static LIFT_M=.3;group=new le;materials=[];pointsMaterials=[];labels=[];viewportHeightPx=720;fovDeg=60;set(e,n,i,t,o,l){this.empty();for(const s of e){const a=this.positions(s,i,t,o,l),d=new ce(s.color??de),m=n.get(s.id);if(m&&a.length>=3&&this.addLabel(m,this.labelAnchor(a,s.kind)),s.kind==="point"){const c=new fe;c.setAttribute("position",new F(a.slice(0,3),3));const g=new ue({color:d,size:A.MARKER_SIZE_PX,sizeAttenuation:!1,depthTest:!1,fog:!1});this.pointsMaterials.push(g);const r=new pe(c,g);r.name="trace point",r.frustumCulled=!1,r.layers.set(this.layer),this.group.add(r)}else if(a.length>=6){const c=new Q;c.setPositions(s.kind==="polygon"?[...a,a[0],a[1],a[2]]:a);const g=new N({color:d.getHex(),linewidth:A.LINE_WIDTH_PX,worldUnits:!1,transparent:!0,opacity:.92,depthTest:!1,fog:!1});this.materials.push(g);const r=new xe(c,g);r.name=`trace ${s.kind}`,r.frustumCulled=!1,r.layers.set(this.layer),this.group.add(r)}}}setView(e,n){for(const i of this.materials)i.resolution.copy(e);e.y===this.viewportHeightPx&&n===this.fovDeg||(this.viewportHeightPx=e.y,this.fovDeg=n,this.scaleLabels())}get any(){return this.group.children.length>0}dispose(){this.empty()}labelAnchor(e,n){let i=0;if(n==="line"){let t=-1;for(let o=0;o+2<e.length;o+=3){const l=Math.hypot(e[o],e[o+2]);l>t&&(t=l,i=o)}}return[e[i],e[i+1],e[i+2]]}addLabel(e,n){const i=document.createElement("canvas"),t=i.getContext("2d");if(!t)return;const o="bold 30px sans-serif";t.font=o;const l=10;i.width=Math.ceil(t.measureText(e).width)+l*2,i.height=44,t.font=o,t.fillStyle="rgba(0, 0, 0, 0.6)",t.beginPath(),t.roundRect(0,0,i.width,i.height,10),t.fill(),t.fillStyle="#ffffff",t.textBaseline="middle",t.fillText(e,l,i.height/2+2);const s=new he({map:new me(i),depthTest:!1,depthWrite:!1,fog:!1,sizeAttenuation:!1}),a=new V(s);a.name="trace name",a.center.set(0,0),a.position.set(n[0],n[1],n[2]),a.frustumCulled=!1,a.layers.set(this.layer),this.labels.push({sprite:a,aspect:i.width/i.height}),this.group.add(a),this.scaleLabels()}scaleLabels(){const e=A.LABEL_HEIGHT_PX/(this.viewportHeightPx/2)*Math.tan(this.fovDeg*Math.PI/360);for(const{sprite:n,aspect:i}of this.labels)n.scale.set(e*i,e,1)}empty(){for(const e of[...this.group.children])this.group.remove(e),e instanceof V?(e.material.map?.dispose(),e.material.dispose()):e.geometry.dispose();this.labels.length=0;for(const e of this.materials.splice(0))e.dispose();for(const e of this.pointsMaterials.splice(0))e.dispose()}positions(e,n,i,t,o){const l=e.altitude??"ground",s=e.points.map(r=>{const{x:v,z:y}=ge(r.lat,r.lng,n,i);return{x:v,z:y,altM:r.altM??0}}),a=l!=="absolute",d=[],m=(r,v,y)=>l==="absolute"?y-t:o(r,v)+(l==="relative"?y:0)+A.LIFT_M,c=e.kind==="polygon",g=c?s.length:s.length-1;for(let r=0;r<Math.max(g,1);r++){const v=s[r],y=s[(r+1)%s.length],L=a&&e.kind!=="point"?Math.max(1,Math.ceil(Math.hypot(y.x-v.x,y.z-v.z)/A.STEP_M)):1;for(let U=0;U<L;U++){const D=U/L,_=v.x+(y.x-v.x)*D,w=v.z+(y.z-v.z)*D;d.push(_,m(_,w,v.altM+(y.altM-v.altM)*D),w)}}if(!c&&e.kind!=="point"){const r=s[s.length-1];d.push(r.x,m(r.x,r.z,r.altM),r.z)}return d}}export{A as TraceSystem};
393
+ `};class N extends ie{constructor(e){super({type:"LineMaterial",uniforms:J.clone(I.line.uniforms),vertexShader:I.line.vertexShader,fragmentShader:I.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0!==this.worldUnits&&(this.needsUpdate=!0),e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}const H=new B,X=new E,q=new E,f=new B,u=new B,x=new B,W=new E,R=new ae,p=new oe,K=new E,T=new j,C=new $,S=new B;let b,z;function Z(h,e,n){return S.set(0,0,-e,1).applyMatrix4(h.projectionMatrix),S.multiplyScalar(1/S.w),S.x=z/n.width,S.y=z/n.height,S.applyMatrix4(h.projectionMatrixInverse),S.multiplyScalar(1/S.w),Math.abs(Math.max(S.x,S.y))}function ve(h,e){const n=h.matrixWorld,i=h.geometry,t=i.attributes.instanceStart,o=i.attributes.instanceEnd,l=Math.min(i.instanceCount,t.count);for(let s=0,a=l;s<a;s++){p.start.fromBufferAttribute(t,s),p.end.fromBufferAttribute(o,s),p.applyMatrix4(n);const d=new E,m=new E;b.distanceSqToSegment(p.start,p.end,m,d),m.distanceTo(d)<z*.5&&e.push({point:m,pointOnLine:d,distance:b.origin.distanceTo(m),object:h,face:null,faceIndex:s,uv:null,uv1:null})}}function ye(h,e,n){const i=e.projectionMatrix,o=h.material.resolution,l=h.matrixWorld,s=h.geometry,a=s.attributes.instanceStart,d=s.attributes.instanceEnd,m=Math.min(s.instanceCount,a.count),c=-e.near;b.at(1,x),x.w=1,x.applyMatrix4(e.matrixWorldInverse),x.applyMatrix4(i),x.multiplyScalar(1/x.w),x.x*=o.x/2,x.y*=o.y/2,x.z=0,W.copy(x),R.multiplyMatrices(e.matrixWorldInverse,l);for(let g=0,r=m;g<r;g++){if(f.fromBufferAttribute(a,g),u.fromBufferAttribute(d,g),f.w=1,u.w=1,f.applyMatrix4(R),u.applyMatrix4(R),f.z>c&&u.z>c)continue;if(f.z>c){const _=f.z-u.z,w=(f.z-c)/_;f.lerp(u,w)}else if(u.z>c){const _=u.z-f.z,w=(u.z-c)/_;u.lerp(f,w)}f.applyMatrix4(i),u.applyMatrix4(i),f.multiplyScalar(1/f.w),u.multiplyScalar(1/u.w),f.x*=o.x/2,f.y*=o.y/2,u.x*=o.x/2,u.y*=o.y/2,p.start.copy(f),p.start.z=0,p.end.copy(u),p.end.z=0;const y=p.closestPointToPointParameter(W,!0);p.at(y,K);const L=re.lerp(f.z,u.z,y),U=L>=-1&&L<=1,D=W.distanceTo(K)<z*.5;if(U&&D){p.start.fromBufferAttribute(a,g),p.end.fromBufferAttribute(d,g),p.start.applyMatrix4(l),p.end.applyMatrix4(l);const _=new E,w=new E;b.distanceSqToSegment(p.start,p.end,w,_),n.push({point:w,pointOnLine:_,distance:b.origin.distanceTo(w),object:h,face:null,faceIndex:g,uv:null,uv1:null})}}}class we extends se{constructor(e=new Q,n=new N({color:Math.random()*16777215})){super(e,n),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,n=e.attributes.instanceStart,i=e.attributes.instanceEnd,t=new Float32Array(2*n.count);for(let l=0,s=0,a=n.count;l<a;l++,s+=2)X.fromBufferAttribute(n,l),q.fromBufferAttribute(i,l),t[s]=s===0?0:t[s-1],t[s+1]=t[s]+X.distanceTo(q);const o=new G(t,2,1);return e.setAttribute("instanceDistanceStart",new M(o,1,0)),e.setAttribute("instanceDistanceEnd",new M(o,1,1)),this}raycast(e,n){const i=this.material.worldUnits,t=e.camera;if(t===null&&!i&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'),i===!1&&(this.material.resolution.x===0||this.material.resolution.y===0))return;const o=e.params.Line2!==void 0&&e.params.Line2.threshold||0;b=e.ray;const l=this.matrixWorld,s=this.geometry,a=this.material;z=a.linewidth+o,s.boundingSphere===null&&s.computeBoundingSphere(),C.copy(s.boundingSphere).applyMatrix4(l);let d;if(i)d=z*.5;else{const c=Math.max(t.near,C.distanceToPoint(b.origin));d=Z(t,c,a.resolution)}if(C.radius+=d,b.intersectsSphere(C)===!1)return;s.boundingBox===null&&s.computeBoundingBox(),T.copy(s.boundingBox).applyMatrix4(l);let m;if(i)m=z*.5;else{const c=Math.max(t.near,T.distanceToPoint(b.origin));m=Z(t,c,a.resolution)}T.expandByScalar(m),b.intersectsBox(T)!==!1&&(i?ve(this,n):ye(this,t,n))}onBeforeRender(e){const n=this.material.uniforms;n&&n.resolution&&(e.getViewport(H),this.material.uniforms.resolution.value.set(H.z,H.w))}}class Y extends Q{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const n=e.length-3,i=new Float32Array(2*n);for(let t=0;t<n;t+=3)i[2*t]=e[t],i[2*t+1]=e[t+1],i[2*t+2]=e[t+2],i[2*t+3]=e[t+3],i[2*t+4]=e[t+4],i[2*t+5]=e[t+5];return super.setPositions(i),this}setColors(e){const n=e.length-3,i=new Float32Array(2*n);for(let t=0;t<n;t+=3)i[2*t]=e[t],i[2*t+1]=e[t+1],i[2*t+2]=e[t+2],i[2*t+3]=e[t+3],i[2*t+4]=e[t+4],i[2*t+5]=e[t+5];return super.setColors(i),this}setFromPoints(e){const n=e.length-1,i=new Float32Array(6*n);for(let t=0;t<n;t++)i[6*t]=e[t].x,i[6*t+1]=e[t].y,i[6*t+2]=e[t].z||0,i[6*t+3]=e[t+1].x,i[6*t+4]=e[t+1].y,i[6*t+5]=e[t+1].z||0;return super.setPositions(i),this}fromLine(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}}class xe extends we{constructor(e=new Y,n=new N({color:Math.random()*16777215})){super(e,n),this.isLine2=!0,this.type="Line2"}}class A{constructor(e){this.layer=e,this.group.name="traces"}static LINE_WIDTH_PX=2.5;static MARKER_SIZE_PX=9;static LABEL_HEIGHT_PX=15;static STEP_M=15;static LIFT_M=.3;group=new le;materials=[];pointsMaterials=[];labels=[];viewportHeightPx=720;fovDeg=60;set(e,n,i,t,o,l){this.empty();for(const s of e){const a=this.positions(s,i,t,o,l),d=new ce(s.color??de),m=n.get(s.id);if(m&&a.length>=3&&this.addLabel(m,this.labelAnchor(a,s.kind)),s.kind==="point"){const c=new fe;c.setAttribute("position",new F(a.slice(0,3),3));const g=new ue({color:d,size:A.MARKER_SIZE_PX,sizeAttenuation:!1,depthTest:!1,fog:!1});this.pointsMaterials.push(g);const r=new pe(c,g);r.name="trace point",r.frustumCulled=!1,r.layers.set(this.layer),this.group.add(r)}else if(a.length>=6){const c=new Y;c.setPositions(s.kind==="polygon"?[...a,a[0],a[1],a[2]]:a);const g=new N({color:d.getHex(),linewidth:A.LINE_WIDTH_PX,worldUnits:!1,transparent:!0,opacity:.92,depthTest:!1,fog:!1});this.materials.push(g);const r=new xe(c,g);r.name=`trace ${s.kind}`,r.frustumCulled=!1,r.layers.set(this.layer),this.group.add(r)}}}setView(e,n){for(const i of this.materials)i.resolution.copy(e);e.y===this.viewportHeightPx&&n===this.fovDeg||(this.viewportHeightPx=e.y,this.fovDeg=n,this.scaleLabels())}get any(){return this.group.children.length>0}dispose(){this.empty()}labelAnchor(e,n){let i=0;if(n==="line"){let t=-1;for(let o=0;o+2<e.length;o+=3){const l=Math.hypot(e[o],e[o+2]);l>t&&(t=l,i=o)}}return[e[i],e[i+1],e[i+2]]}addLabel(e,n){const i=document.createElement("canvas"),t=i.getContext("2d");if(!t)return;const o="bold 30px sans-serif";t.font=o;const l=10;i.width=Math.ceil(t.measureText(e).width)+l*2,i.height=44,t.font=o,t.fillStyle="rgba(0, 0, 0, 0.6)",t.beginPath(),t.roundRect(0,0,i.width,i.height,10),t.fill(),t.fillStyle="#ffffff",t.textBaseline="middle",t.fillText(e,l,i.height/2+2);const s=new he({map:new me(i),depthTest:!1,depthWrite:!1,fog:!1,sizeAttenuation:!1}),a=new V(s);a.name="trace name",a.center.set(0,0),a.position.set(n[0],n[1],n[2]),a.frustumCulled=!1,a.layers.set(this.layer),this.labels.push({sprite:a,aspect:i.width/i.height}),this.group.add(a),this.scaleLabels()}scaleLabels(){const e=A.LABEL_HEIGHT_PX/(this.viewportHeightPx/2)*Math.tan(this.fovDeg*Math.PI/360);for(const{sprite:n,aspect:i}of this.labels)n.scale.set(e*i,e,1)}empty(){for(const e of[...this.group.children])this.group.remove(e),e instanceof V?(e.material.map?.dispose(),e.material.dispose()):e.geometry.dispose();this.labels.length=0;for(const e of this.materials.splice(0))e.dispose();for(const e of this.pointsMaterials.splice(0))e.dispose()}positions(e,n,i,t,o){const l=e.altitude??"ground",s=e.points.map(r=>{const{x:v,z:y}=ge(r.lat,r.lng,n,i);return{x:v,z:y,altM:r.altM??0}}),a=l!=="absolute",d=[],m=(r,v,y)=>l==="absolute"?y-t:o(r,v)+(l==="relative"?y:0)+A.LIFT_M,c=e.kind==="polygon",g=c?s.length:s.length-1;for(let r=0;r<Math.max(g,1);r++){const v=s[r],y=s[(r+1)%s.length],L=a&&e.kind!=="point"?Math.max(1,Math.ceil(Math.hypot(y.x-v.x,y.z-v.z)/A.STEP_M)):1;for(let U=0;U<L;U++){const D=U/L,_=v.x+(y.x-v.x)*D,w=v.z+(y.z-v.z)*D;d.push(_,m(_,w,v.altM+(y.altM-v.altM)*D),w)}}if(!c&&e.kind!=="point"){const r=s[s.length-1];d.push(r.x,m(r.x,r.z,r.altM),r.z)}return d}}export{A as TraceSystem};
@@ -0,0 +1 @@
1
+ import{a3 as O,aj as w,ak as A,al as R,a6 as M,am as v,an as D,ao as N,ap as L}from"./rr0-sighting-editor.mjs";class r{static LIFT_M=.05;static RENDER_ORDER=1.04;static LEVEL_QUANTILE=.2;static BODY_ALBEDO=[.035,.045,.04];static IOR=1.33;static ROUGHNESS=.08;static MAX_SAMPLES=48;group=new O;material=new w({color:new A(...r.BODY_ALBEDO),roughness:r.ROUGHNESS,metalness:0,ior:r.IOR,polygonOffset:!0,polygonOffsetFactor:-2,polygonOffsetUnits:-2});constructor(){this.group.name="water"}set(s,e,n,p,t,o){this.clear();for(const a of s){const f=a.rings.map(i=>r.clip(i.map(h=>R(h.lat,h.lng,e,n)),t)),l=f[0];if(!l||l.length<3)continue;const g=f.slice(1).filter(i=>i.length>=3),u=r.level(l,g,p,o);if(u===void 0)continue;const c=r.geometry(l,g,u+r.LIFT_M);if(!c)continue;const x=new M(c,this.material);x.name=`water ${a.id}`,x.renderOrder=r.RENDER_ORDER,x.receiveShadow=!0,this.group.add(x)}}get count(){return this.group.children.length}clear(){for(const s of[...this.group.children])s.geometry.dispose(),this.group.remove(s)}dispose(){this.clear(),this.material.dispose()}static level(s,e,n,p){const t=s.map(i=>i.x),o=s.map(i=>i.z),[a,f,l,g]=[Math.min(...t),Math.max(...t),Math.min(...o),Math.max(...o)],u=Math.max(p,(f-a)/r.MAX_SAMPLES,(g-l)/r.MAX_SAMPLES,.5),c=[];for(let i=l+u/2;i<g;i+=u)for(let h=a+u/2;h<f;h+=u){const z={x:h,z:i};if(!r.contains(s,z)||e.some(m=>r.contains(m,z)))continue;const d=n(h,i);Number.isFinite(d)&&c.push(d)}if(c.length===0)for(const i of s)c.push(n(i.x,i.z));const x=c.filter(Number.isFinite).sort((i,h)=>i-h);if(x.length!==0)return x[Math.floor((x.length-1)*r.LEVEL_QUANTILE)]}static clip(s,e){let n=s;const p=[{inside:t=>t.x>=-e,cross:(t,o)=>r.atX(t,o,-e)},{inside:t=>t.x<=e,cross:(t,o)=>r.atX(t,o,e)},{inside:t=>t.z>=-e,cross:(t,o)=>r.atZ(t,o,-e)},{inside:t=>t.z<=e,cross:(t,o)=>r.atZ(t,o,e)}];for(const t of p){const o=[];for(let a=0;a<n.length;a++){const f=n[a],l=n[(a+n.length-1)%n.length];t.inside(f)?(t.inside(l)||o.push(t.cross(l,f)),o.push(f)):t.inside(l)&&o.push(t.cross(l,f))}if(n=o,n.length===0)break}return n}static atX(s,e,n){return{x:n,z:s.z+(e.z-s.z)*(n-s.x)/(e.x-s.x)}}static atZ(s,e,n){return{x:s.x+(e.x-s.x)*(n-s.z)/(e.z-s.z),z:n}}static contains(s,e){let n=!1;for(let p=0,t=s.length-1;p<s.length;t=p++){const o=s[p],a=s[t];o.z>e.z!=a.z>e.z&&e.x<(a.x-o.x)*(e.z-o.z)/(a.z-o.z)+o.x&&(n=!n)}return n}static geometry(s,e,n){const p=c=>new v(c.x,c.z),t=s.map(p),o=e.map(c=>c.map(p)),a=D.triangulateShape(t,o);if(a.length===0)return;const f=[...t,...o.flat()],l=[];for(const[c,x,i]of a){const[h,z,d]=[f[c],f[x],f[i]],m=(z.y-h.y)*(d.x-h.x)-(z.x-h.x)*(d.y-h.y)>0;for(const E of m?[h,z,d]:[h,d,z])l.push(E.x,n,E.y)}const g=new N;g.setAttribute("position",new L(l,3));const u=new Float32Array(l.length);for(let c=1;c<u.length;c+=3)u[c]=1;return g.setAttribute("normal",new L(u,3)),g.computeBoundingSphere(),g}}export{r as WaterSystem};