@thibezer/ui-components-kit 2.20.0 → 2.22.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 (125) hide show
  1. package/CHANGELOG.md +147 -0
  2. package/README.md +2 -2
  3. package/dist/camadas.cjs +1 -1
  4. package/dist/camadas.js +1 -1
  5. package/dist/canvas.cjs +80 -80
  6. package/dist/canvas.js +2962 -3442
  7. package/dist/components/ui-barra-ferramentas/paleta-ajuste.d.ts +43 -0
  8. package/dist/components/ui-barra-ferramentas/paleta-excesso.d.ts +8 -0
  9. package/dist/components/ui-barra-ferramentas/ribbon-colapso.d.ts +61 -0
  10. package/dist/components/ui-barra-ferramentas/ribbon-render.d.ts +5 -0
  11. package/dist/components/ui-barra-ferramentas/tipos.d.ts +15 -0
  12. package/dist/components/ui-barra-ferramentas/ui-paleta-ferramentas.d.ts +47 -6
  13. package/dist/components/ui-barra-ferramentas/ui-ribbon.d.ts +42 -1
  14. package/dist/components/ui-canvas-prancha/index.d.ts +11 -0
  15. package/dist/components/ui-canvas-prancha/prancha-acessibilidade.d.ts +5 -0
  16. package/dist/components/ui-canvas-prancha/prancha-atributos-sync.d.ts +5 -0
  17. package/dist/components/ui-canvas-prancha/prancha-bus.d.ts +5 -0
  18. package/dist/components/ui-canvas-prancha/prancha-comandos-organizacao.d.ts +45 -0
  19. package/dist/components/ui-canvas-prancha/prancha-comandos-pathfinder.d.ts +3 -0
  20. package/dist/components/ui-canvas-prancha/prancha-comandos-propriedades.d.ts +12 -0
  21. package/dist/components/ui-canvas-prancha/prancha-comandos.d.ts +27 -0
  22. package/dist/components/ui-canvas-prancha/prancha-controlador.d.ts +115 -0
  23. package/dist/components/ui-canvas-prancha/prancha-cores.d.ts +23 -0
  24. package/dist/components/ui-canvas-prancha/prancha-documento.d.ts +53 -0
  25. package/dist/components/ui-canvas-prancha/prancha-estado-ui.d.ts +45 -0
  26. package/dist/components/ui-canvas-prancha/prancha-ferramentas-edicao.d.ts +7 -0
  27. package/dist/components/ui-canvas-prancha/prancha-ferramentas.d.ts +38 -0
  28. package/dist/components/ui-canvas-prancha/prancha-gestos.d.ts +88 -0
  29. package/dist/components/ui-canvas-prancha/prancha-interacao.d.ts +31 -0
  30. package/dist/components/ui-canvas-prancha/prancha-medidor-texto.d.ts +6 -0
  31. package/dist/components/ui-canvas-prancha/prancha-painel-camadas.d.ts +43 -0
  32. package/dist/components/ui-canvas-prancha/prancha-painel-propriedades.d.ts +32 -0
  33. package/dist/components/ui-canvas-prancha/prancha-paleta.d.ts +13 -0
  34. package/dist/components/ui-canvas-prancha/prancha-pintura.d.ts +48 -0
  35. package/dist/components/ui-canvas-prancha/prancha-reguas.d.ts +26 -0
  36. package/dist/components/ui-canvas-prancha/prancha-render.d.ts +35 -0
  37. package/dist/components/ui-canvas-prancha/prancha-teclado.d.ts +10 -0
  38. package/dist/components/ui-canvas-prancha/prancha-template.d.ts +1 -0
  39. package/dist/components/ui-canvas-prancha/prancha-vista.d.ts +29 -0
  40. package/dist/components/ui-canvas-prancha/tipos.d.ts +120 -0
  41. package/dist/components/ui-canvas-prancha/ui-canvas-prancha-base.d.ts +121 -0
  42. package/dist/components/ui-canvas-prancha/ui-canvas-prancha.d.ts +111 -0
  43. package/dist/cores-utils-BmkzhA1v.cjs +1 -0
  44. package/dist/cores-utils-BrdynxRd.js +54 -0
  45. package/dist/cores.cjs +1 -1
  46. package/dist/cores.js +12 -11
  47. package/dist/custom-elements.json +27225 -17835
  48. package/dist/feature_caixa-CnYPKVFS.cjs +1 -0
  49. package/dist/feature_caixa-DCs9ZeSk.js +1038 -0
  50. package/dist/geometria-px-Cyi_oPD6.cjs +1 -0
  51. package/dist/geometria-px-DKrWq_XY.js +639 -0
  52. package/dist/gerencigeo-canvas/booleanas/classificacao.d.ts +41 -0
  53. package/dist/gerencigeo-canvas/booleanas/index.d.ts +10 -0
  54. package/dist/gerencigeo-canvas/booleanas/montagem.d.ts +23 -0
  55. package/dist/gerencigeo-canvas/booleanas/segmentos.d.ts +38 -0
  56. package/dist/gerencigeo-canvas/booleanas/tipos.d.ts +44 -0
  57. package/dist/gerencigeo-canvas/espaco/espaco_geografico.d.ts +2 -0
  58. package/dist/gerencigeo-canvas/espaco/espaco_matriz.d.ts +58 -0
  59. package/dist/gerencigeo-canvas/espaco/espaco_plano.d.ts +13 -0
  60. package/dist/gerencigeo-canvas/espaco/espaco_tipos.d.ts +35 -0
  61. package/dist/gerencigeo-canvas/espaco/index.d.ts +4 -0
  62. package/dist/gerencigeo-canvas/feature_algoritmos.d.ts +12 -8
  63. package/dist/gerencigeo-canvas/feature_amostra.d.ts +2 -1
  64. package/dist/gerencigeo-canvas/feature_caixa.d.ts +3 -2
  65. package/dist/gerencigeo-canvas/feature_curvas.d.ts +9 -2
  66. package/dist/gerencigeo-canvas/feature_desenho.d.ts +23 -2
  67. package/dist/gerencigeo-canvas/feature_edicao_nos.d.ts +68 -0
  68. package/dist/gerencigeo-canvas/feature_edicao_ops.d.ts +28 -8
  69. package/dist/gerencigeo-canvas/feature_editor_painel_no.d.ts +40 -0
  70. package/dist/gerencigeo-canvas/feature_editor_vertices.d.ts +46 -0
  71. package/dist/gerencigeo-canvas/feature_formas.d.ts +7 -3
  72. package/dist/gerencigeo-canvas/feature_historico.d.ts +41 -0
  73. package/dist/gerencigeo-canvas/feature_indice.d.ts +10 -2
  74. package/dist/gerencigeo-canvas/feature_metricas.d.ts +15 -4
  75. package/dist/gerencigeo-canvas/feature_types.d.ts +14 -2
  76. package/dist/gerencigeo-canvas/motor/geometria-px.d.ts +2 -0
  77. package/dist/gerencigeo-canvas/prancha/aparencia_estilo.d.ts +86 -0
  78. package/dist/gerencigeo-canvas/prancha/camadas.d.ts +14 -0
  79. package/dist/gerencigeo-canvas/prancha/cantos_vivos.d.ts +18 -0
  80. package/dist/gerencigeo-canvas/prancha/elemento_consulta.d.ts +63 -0
  81. package/dist/gerencigeo-canvas/prancha/elemento_criacao.d.ts +27 -0
  82. package/dist/gerencigeo-canvas/prancha/elemento_edicao.d.ts +24 -0
  83. package/dist/gerencigeo-canvas/prancha/elemento_geometria.d.ts +60 -0
  84. package/dist/gerencigeo-canvas/prancha/elemento_predefinicoes.d.ts +55 -0
  85. package/dist/gerencigeo-canvas/prancha/elemento_snap.d.ts +39 -0
  86. package/dist/gerencigeo-canvas/prancha/elemento_transformacao.d.ts +65 -0
  87. package/dist/gerencigeo-canvas/prancha/elemento_validacao.d.ts +27 -0
  88. package/dist/gerencigeo-canvas/prancha/exportar_svg.d.ts +18 -0
  89. package/dist/gerencigeo-canvas/prancha/guias_inteligentes.d.ts +21 -0
  90. package/dist/gerencigeo-canvas/prancha/index.d.ts +23 -0
  91. package/dist/gerencigeo-canvas/prancha/operacoes_caminho.d.ts +35 -0
  92. package/dist/gerencigeo-canvas/prancha/organizacao.d.ts +46 -0
  93. package/dist/gerencigeo-canvas/prancha/pathfinder.d.ts +17 -0
  94. package/dist/gerencigeo-canvas/prancha/pintura_canvas.d.ts +78 -0
  95. package/dist/gerencigeo-canvas/prancha/pintura_formas.d.ts +32 -0
  96. package/dist/gerencigeo-canvas/prancha/pintura_plano.d.ts +126 -0
  97. package/dist/gerencigeo-canvas/prancha/propriedades.d.ts +15 -0
  98. package/dist/gerencigeo-canvas/prancha/tipos.d.ts +228 -0
  99. package/dist/index.cjs +1 -1
  100. package/dist/index.d.ts +5 -0
  101. package/dist/index.js +257 -255
  102. package/dist/motor.cjs +1 -1
  103. package/dist/motor.js +822 -57
  104. package/dist/prancha-paleta-BZ-9QDgh.js +5276 -0
  105. package/dist/prancha-paleta-Bb24vP71.cjs +17 -0
  106. package/dist/prancha.cjs +1 -0
  107. package/dist/prancha.d.ts +10 -0
  108. package/dist/prancha.js +200 -0
  109. package/dist/register.cjs +1 -1
  110. package/dist/register.js +7 -5
  111. package/dist/tipos-elementos.d.ts +47 -1
  112. package/dist/tipos-react.d.ts +2 -0
  113. package/dist/tipos-vue.d.ts +46 -1
  114. package/dist/tools.cjs +1 -1
  115. package/dist/tools.js +1 -1
  116. package/dist/ui-controle-cores-BcH9k2Fa.js +292 -0
  117. package/dist/ui-controle-cores-CvSTP6gJ.cjs +32 -0
  118. package/dist/ui-kit.css +1 -1
  119. package/dist/ui-paleta-ferramentas-DebHYiwd.js +1615 -0
  120. package/dist/ui-paleta-ferramentas-Dgejtluh.js +1423 -0
  121. package/dist/ui-paleta-ferramentas-hzyo8wBt.cjs +22 -0
  122. package/dist/ui-paleta-ferramentas-jWuICjW8.cjs +22 -0
  123. package/dist/ui-seletor-cor-0RLjcME6.cjs +83 -0
  124. package/dist/ui-seletor-cor-Cd8jkzXG.js +354 -0
  125. package/package.json +6 -1
@@ -0,0 +1 @@
1
+ "use strict";var Ft=Object.defineProperty;var wt=(t,n,o)=>n in t?Ft(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o;var x=(t,n,o)=>wt(t,typeof n!="symbol"?n+"":n,o);function g(t){return t.partes&&t.partes.length>1?t.partes:[t.coordenadas]}function Rt(t){return t.tipo==="LineString"&&!!t.partes&&t.partes.length>1}function ut(t){return t.length>1?{tipo:"LineString",coordenadas:t[0],partes:t}:{tipo:"LineString",coordenadas:t[0]}}const C=6378137,O=1/298.257222101,W=O*(2-O),m=t=>t*Math.PI/180;function q(t){const n=Math.sin(m(t)),o=1-W*n*n;return{N:C/Math.sqrt(o),M:C*(1-W)/(o*Math.sqrt(o))}}function $t(t){const{M:n,N:o}=q(t);return{lat:m(1)*n,lng:m(1)*o*Math.cos(m(t))}}function Ut(t,n){const o=C*(1-O),i=O,a=m(n[1]-t[1]),e=Math.atan((1-i)*Math.tan(m(t[0]))),s=Math.atan((1-i)*Math.tan(m(n[0]))),r=Math.sin(e),c=Math.cos(e),u=Math.sin(s),h=Math.cos(s);let d=a,l=0,f=0,A=0,p=0,M=0;for(let y=0;y<100;y++){const Q=Math.sin(d),K=Math.cos(d);if(l=Math.hypot(h*Q,c*u-r*h*K),l===0)return 0;f=r*u+c*h*K,A=Math.atan2(l,f);const F=c*h*Q/l;p=1-F*F,M=p===0?0:f-2*r*u/p;const w=i/16*p*(4+i*(4-3*p)),_t=d;if(d=a+(1-w)*i*F*(A+w*l*(M+w*f*(-1+2*M*M))),Math.abs(d-_t)<1e-12)break}const L=p*(C*C-o*o)/(o*o),_=1+L/16384*(4096+L*(-768+L*(320-175*L))),S=L/1024*(256+L*(-128+L*(74-47*L))),I=S*l*(M+S/4*(f*(-1+2*M*M)-S/6*M*(-3+4*l*l)*(-3+4*M*M)));return o*_*(A-I)}function U(t,n){const o=n[0]-t[0],i=n[1]-t[1];if(Math.abs(o)<.1&&Math.abs(i)<.1){const{M:a,N:e}=q((t[0]+n[0])/2),s=m(o)*a,r=m(i)*e*Math.cos(m((t[0]+n[0])/2));return Math.hypot(r,s)}return Ut(t,n)}function lt(t,n=!1){let o=0;for(let i=1;i<t.length;i++)o+=U(t[i-1],t[i]);return n&&t.length>2&&(o+=U(t[t.length-1],t[0])),o}function tt(t){const n=t.length;if(n<3)return 0;let o=0,i=0;for(let r=0;r<n;r++){const c=t[(r-1+n)%n],u=t[r],h=t[(r+1)%n];o+=m(h[1]-c[1])*Math.sin(m(u[0])),i+=u[0]}const{M:a,N:e}=q(i/n),s=Math.abs(o*a*e/2);return Number.isFinite(s)?s:0}function ht(t){const[n,...o]=t;return n?Math.max(0,tt(n)-o.reduce((i,a)=>i+tt(a),0)):0}const kt=new Intl.NumberFormat("pt-BR",{minimumFractionDigits:4,maximumFractionDigits:4}),nt=new Intl.NumberFormat("pt-BR",{minimumFractionDigits:2,maximumFractionDigits:2});function dt(t){return`${kt.format(t/1e4)} ha`}function ft(t){return t>=1e3?`${nt.format(t/1e3)} km`:`${nt.format(t)} m`}function mt(t,n){return t.tipo==="Polygon"?n?n.area(t.aneis):ht(t.aneis):t.tipo==="Circle"?Math.PI*t.raioMetros**2:null}function pt(t,n){const o=(i,a=!1)=>n?n.comprimento(i,a):lt(i,a);return t.tipo==="LineString"?g(t).reduce((i,a)=>i+o(a),0):t.tipo==="Polygon"?o(t.aneis[0]??[],!0):t.tipo==="Circle"?2*Math.PI*t.raioMetros:null}function Gt(t,n){var a;const o=n??"name";if(o==="area"){const e=mt(t.geometria);return e===null?"":dt(e)}if(o==="extensao"){const e=pt(t.geometria);return e===null?"":ft(e)}if(o==="id")return t.id;const i=(a=t.propriedades)==null?void 0:a[o];return i!=null&&i!==""?String(i):n?"":t.id}function Mt(t,n){const o=n/111320,i=o/Math.max(.01,Math.cos(m(t[0])));return[[t[0]-o,t[1]-i],[t[0]+o,t[1]+i]]}function Lt(t,n){let o;switch(t.tipo){case"Point":case"Text":o=[t.coordenada];break;case"LineString":o=g(t).flat();break;case"Polygon":o=t.aneis.flat();break;case"Circle":o=n?n.extremosDoCirculo(t.centro,t.raioMetros):Mt(t.centro,t.raioMetros);break}const i=o.map(e=>e[0]),a=o.map(e=>e[1]);return[[Math.min(...i),Math.min(...a)],[Math.max(...i),Math.max(...a)]]}const N=16,zt=256;function k(t,n){const[[o,i],[a,e]]=Lt(t.geometria,n);return{minLon:i,minLat:o,maxLon:e,maxLat:a}}function b(t,n){return t.minLon<=n.maxLon&&t.maxLon>=n.minLon&&t.minLat<=n.maxLat&&t.maxLat>=n.minLat}function ot(t){let n=1/0,o=1/0,i=-1/0,a=-1/0;for(const e of t)e.minLon<n&&(n=e.minLon),e.minLat<o&&(o=e.minLat),e.maxLon>i&&(i=e.maxLon),e.maxLat>a&&(a=e.maxLat);return{minLon:n,minLat:o,maxLon:i,maxLat:a}}function it(t){const n=t.length,o=Math.ceil(n/N),a=Math.ceil(Math.sqrt(o))*N,e=[...t].sort((r,c)=>r.minLon+r.maxLon-(c.minLon+c.maxLon)),s=[];for(let r=0;r<n;r+=a){const c=e.slice(r,r+a).sort((u,h)=>u.minLat+u.maxLat-(h.minLat+h.maxLat));for(let u=0;u<c.length;u+=N)s.push(c.slice(u,u+N))}return s}function Vt(t){if(t.length===0)return null;let n=it(t).map(o=>({...ot(o),folhas:o}));for(;n.length>1;)n=it(n).map(o=>({...ot(o),filhos:o}));return n[0]}class Ht{constructor(n){x(this,"raiz",null);x(this,"itens",new Map);x(this,"delta",new Map);x(this,"obsoletos",new Set);this.espaco=n}get tamanho(){return this.itens.size}construir(n){this.itens.clear();for(const o of n)o.excluida||this.itens.set(o.id,{id:o.id,...k(o,this.espaco)});this.remontar()}inserir(n){this.atualizar(n)}atualizar(n){if(n.excluida){this.remover(n.id);return}const o={id:n.id,...k(n,this.espaco)};this.itens.has(n.id)&&this.obsoletos.add(n.id),this.itens.set(n.id,o),this.delta.set(n.id,o),this.compactarSeNecessario()}remover(n){this.itens.delete(n)&&(this.obsoletos.add(n),this.delta.delete(n),this.compactarSeNecessario())}limpar(){this.itens.clear(),this.remontar()}consultar(n){const o=[],i=this.raiz?[this.raiz]:[];for(;i.length>0;){const a=i.pop();if(b(a,n))if(a.folhas)for(const e of a.folhas)!this.obsoletos.has(e.id)&&b(e,n)&&o.push(e.id);else a.filhos&&i.push(...a.filhos)}for(const a of this.delta.values())b(a,n)&&o.push(a.id);return o}intersecta(n){return this.consultar(n).length>0}caixaDe(n){return this.itens.get(n)}compactarSeNecessario(){this.delta.size+this.obsoletos.size>Math.max(zt,this.itens.size*.1)&&this.remontar()}remontar(){this.raiz=Vt([...this.itens.values()]),this.delta.clear(),this.obsoletos.clear()}}const At=17,xt=9,Zt=1.2;function vt(t){return!Number.isFinite(t)||t>=At?0:360/(256*2**t)*Zt}function G(t){return Number.isFinite(t)?1/Math.max(.05,Math.cos(Math.max(-85,Math.min(85,t))*Math.PI/180)):1}function qt(t,n,o,i){const a=o[1]-n[1],e=(o[0]-n[0])*i,s=a*a+e*e,r=(t[0]-n[0])*i;let c=s===0?0:((t[1]-n[1])*a+r*e)/s;return c=Math.max(0,Math.min(1,c)),Math.hypot(t[1]-(n[1]+c*a),r-c*e)}function X(t,n,o=1){if(!(n>0)||t.length<3)return t;const i=Number.isFinite(o)&&o>0?o:1,a=new Uint8Array(t.length);a[0]=1,a[t.length-1]=1;const e=[[0,t.length-1]];for(;e.length>0;){const[s,r]=e.pop();let c=0,u=-1;for(let h=s+1;h<r;h++){const d=qt(t[h],t[s],t[r],i);d>c&&(c=d,u=h)}u!==-1&&c>n&&(a[u]=1,e.push([s,u],[u,r]))}return t.filter((s,r)=>a[r]===1)}function It(t,n,o=1){if(!(n>0)||t.length<4)return t;const i=[...t,t[0]],a=X(i,n,o);return a.pop(),a.length>=3?a:t}function Pt(t){return(t.tipo==="LineString"||t.tipo==="Polygon")&&t.curva?0:t.tipo==="LineString"?g(t).reduce((n,o)=>n+o.length,0):t.tipo==="Polygon"?t.aneis.reduce((n,o)=>n+o.length,0):0}function Xt(t,n){var i,a,e,s;const o=vt(n);if(o===0||Pt(t)<xt)return t;if(t.tipo==="LineString"){const r=g(t),c=G(((a=(i=r[0])==null?void 0:i[0])==null?void 0:a[0])??NaN);return ut(r.map(u=>X(u,o,c)))}if(t.tipo==="Polygon"){const r=G(((s=(e=t.aneis[0])==null?void 0:e[0])==null?void 0:s[0])??NaN);return{tipo:"Polygon",aneis:t.aneis.map(c=>It(c,o,r))}}return t}const Bt=new Set(["previa","prévia","preview","rascunho","draft","proposta"]);function j(t){var o,i;const n=[t.status,(o=t.propriedades)==null?void 0:o.status,(i=t.propriedades)==null?void 0:i.tipo_geometria];for(const a of n)if(typeof a=="string"&&Bt.has(a.trim().toLowerCase()))return"previa";return"oficial"}function T(t){var o;const n=t.entidadeId??((o=t.propriedades)==null?void 0:o.entidadeId);return typeof n=="string"||typeof n=="number"?String(n):t.id}const R=(t,n)=>`${t}\0${n}`;class Yt{constructor(){x(this,"global",!1);x(this,"individuais",new Set)}alternarIndividual(n,o){const i=R(n,o);return this.individuais.has(i)?this.individuais.delete(i):this.individuais.add(i),this.individuais.has(i)}definirIndividual(n,o,i){const a=R(n,o);i?this.individuais.add(a):this.individuais.delete(a)}individualAtiva(n,o){return this.individuais.has(R(n,o))}static oficiais(n){const o=new Set;for(const i of n)!i.excluida&&j(i)==="oficial"&&o.add(T(i));return o}visivel(n,o){if(j(n)==="oficial")return!0;const i=T(n);return this.global||!o.has(i)||this.individualAtiva(n.camadaId,i)}previaSolicitada(n){return this.global||this.individualAtiva(n.camadaId,T(n))}}const St=new Set(["simetrico","suave","livre"]),at=1e-6;function Jt(t){if(!t.entrada&&!t.saida)return"canto";if(t.modo&&St.has(t.modo))return t.modo;if(!t.entrada||!t.saida)return"simetrico";const n=t.ponto[0]-t.entrada[0],o=t.ponto[1]-t.entrada[1],i=t.saida[0]-t.ponto[0],a=t.saida[1]-t.ponto[1],e=Math.hypot(n,o),s=Math.hypot(i,a);return e===0||s===0||!(Math.abs(n*a-o*i)<=at*e*s&&n*i+o*a>0)?"livre":Math.abs(e-s)<=at*Math.max(e,s)?"simetrico":"suave"}const Qt=24,Kt=2,et=t=>typeof t=="number"&&Number.isFinite(t),$=t=>Array.isArray(t)&&t.length===2&&et(t[0])&&et(t[1]);function Wt(t,n){return[2*t[0]-n[0],2*t[1]-n[1]]}function yt(t){return t.some(n=>n.entrada!==void 0||n.saida!==void 0)}function B(t,n){return[t.saida??t.ponto,n.entrada??n.ponto]}function Ct(t,n){const o=[];for(let i=0;i<t-1;i++)o.push([i,i+1]);return n&&t>2&&o.push([t-1,0]),o}function gt(t,n,o,i,a){const e=1-a,s=e*e*e,r=3*e*e*a,c=3*e*a*a,u=a*a*a;return[s*t[0]+r*n[0]+c*o[0]+u*i[0],s*t[1]+r*n[1]+c*o[1]+u*i[1]]}function tn(t,n=!1,o=Qt){if(t.length===0)return[];const i=[[t[0].ponto[0],t[0].ponto[1]]];for(const[a,e]of Ct(t.length,n)){const s=t[a],r=t[e];if(!(s.saida===void 0&&r.entrada===void 0)){const[u,h]=B(s,r);for(let d=1;d<o;d++)i.push(gt(s.ponto,u,h,r.ponto,d/o))}e!==0&&i.push([r.ponto[0],r.ponto[1]])}return i}function Dt(t,n){if(t.length===0)return[];const o=[{cmd:"M",pts:[t[0].ponto]}];for(const[i,a]of Ct(t.length,n)){const e=t[i],s=t[a];if(e.saida===void 0&&s.entrada===void 0)o.push({cmd:"L",pts:[s.ponto]});else{const[r,c]=B(e,s);o.push({cmd:"C",pts:[r,c,s.ponto]})}}return o}function nn(t,n,o){const i=e=>String(Math.round(e*100)/100),a=Dt(t,n).map(e=>e.cmd+e.pts.map(s=>{const r=o(s);return`${i(r.x)} ${i(r.y)}`}).join(" ")).join("");return a&&n?`${a}Z`:a}function on(t,n=Kt){if(!Array.isArray(t)||t.length<n)return null;const o=[];for(const i of t){if(!i||typeof i!="object"||!$(i.ponto))return null;const a=i,e={ponto:[a.ponto[0],a.ponto[1]]};$(a.entrada)&&(e.entrada=[a.entrada[0],a.entrada[1]]),$(a.saida)&&(e.saida=[a.saida[0],a.saida[1]]),typeof a.modo=="string"&&St.has(a.modo)&&(e.entrada||e.saida)&&(e.modo=a.modo),o.push(e)}return yt(o)?o:null}function an(t,n){return t.map(o=>{const i={ponto:n(o.ponto)};return o.entrada&&(i.entrada=n(o.entrada)),o.saida&&(i.saida=n(o.saida)),o.modo&&(i.modo=o.modo),i})}function en(t){return t.tipo==="LineString"?t.curva&&t.curva.length>=2&&!(t.partes&&t.partes.length>1)?t.curva:null:t.tipo==="Polygon"&&t.curva&&t.curva.length>=3&&t.aneis.length===1?t.curva:null}const Nt=["continua","tracejada","tracejada-curta","tracejada-longa","pontilhada","traco-ponto","traco-ponto-ponto","oculta","centro","fantasma","divisa"],rn={tracejada:[12,6],"tracejada-curta":[6,4],"tracejada-longa":[24,8],pontilhada:[0,4],"traco-ponto":[12,4,0,4],"traco-ponto-ponto":[12,4,0,4,0,4],oculta:[6,3],centro:[24,4,6,4],fantasma:[24,4,6,4,6,4],divisa:[12,4,12,4,0,4]},rt={arredondada:"round",reta:"butt",quadrada:"square"},st={arredondada:"round",chanfrada:"bevel",angular:"miter"},sn=.05,cn=100,ct={continuous:"continua",dashed:"tracejada",dashed2:"tracejada-curta",dashedx2:"tracejada-longa",dot:"pontilhada",dotted:"pontilhada",dashdot:"traco-ponto",divide:"traco-ponto-ponto",hidden:"oculta",center:"centro",phantom:"fantasma",border:"divisa"};function z(t){return typeof t=="string"&&Nt.includes(t)}function Y(t){if(z(t))return t;if(typeof t!="string")return;const n=t.trim().toLowerCase();return z(n)?n:Object.prototype.hasOwnProperty.call(ct,n)?ct[n]:void 0}function V(t){return typeof t=="string"&&Object.prototype.hasOwnProperty.call(rt,t)?rt[t]:void 0}function H(t){return typeof t=="string"&&Object.prototype.hasOwnProperty.call(st,t)?st[t]:void 0}function bt(t){return typeof t!="number"||!Number.isFinite(t)||t<=0?1:Math.min(cn,Math.max(sn,t))}function Z(t,n,o=1,i="round"){const a=Y(t);if(!a||a==="continua")return;const e=Number.isFinite(n)&&n>0?n:1,s=bt(o)*Math.max(1,e/2),r=i==="butt"?e:0,c=i==="butt"?0:e;return rn[a].map((u,h)=>{const d=h%2===0?u===0?r:u*s:u*s+c;return Math.round(d*100)/100}).join(" ")}const Tt="#38bdf8",Et="#38bdf8",un=/^(#[0-9a-f]{3,8}|(rgb|hsl)a?\([0-9.,%\s\/-]+\)|[a-z]{3,20})$/i;function E(t,n){return typeof t=="string"&&un.test(t.trim())?t.trim():n}const v=t=>typeof t=="number"&&Number.isFinite(t);function ln(t,n,o=!1){const i=t.estilo??{},a=E(i.corTraco??n.corPrimaria,Tt),e=t.geometria.tipo,s=e==="Polygon"||e==="Circle",r=e==="Point",c=r&&E(i.corContorno,"")||a,u=r&&v(i.espessuraContorno)&&i.espessuraContorno>=0?i.espessuraContorno:void 0,h=u??(v(i.espessuraTraco)?i.espessuraTraco:void 0)??(v(n.espessuraLinha)?n.espessuraLinha:2),d=v(i.opacidadePreenchimento)?i.opacidadePreenchimento:s?.2:.85,l=o?h+2:h,f=V(i.terminacaoTraco)??V(n.terminacaoLinha)??"round",A=v(i.opacidadeTraco)?i.opacidadeTraco:v(n.opacidadeLinha)?n.opacidadeLinha:1;return{cor:o?Et:c,traco:!(u===0&&!o),peso:l,dash:hn(t,n,l,f),opacidadeTraco:o?1:Math.min(1,Math.max(0,A)),terminacao:f,juncao:H(i.juncaoTraco)??H(n.juncaoLinha)??"round",deslocamentoDash:v(i.deslocamentoTracejado)?i.deslocamentoTracejado:0,preencher:s||r,corPreenchimento:E(i.corPreenchimento,a),opacidadePreenchimento:o?Math.min(1,d+.18):d}}function hn(t,n,o,i){const a=t.estilo??{};if(a.dashArray)return a.dashArray;if(a.tipoLinha!==void 0&&a.tipoLinha!==null){const e=Z(a.tipoLinha,o,a.escalaTipoLinha??n.escalaTipoLinha,i);if(e||Y(a.tipoLinha)==="continua")return e}return j(t)==="previa"?"6 4":n.dashArray?n.dashArray:Z(n.tipoLinha,o,n.escalaTipoLinha,i)}function dn(t,n){var i;const o=((i=t.estilo)==null?void 0:i.tamanhoIcone)??n.tamanhoMarcador??8;return(v(o)&&o>0?o:8)/2}class fn{constructor(){x(this,"porChave",new Map)}interno(n){const o=`${n.cor}|${n.traco?1:0}|${n.peso}|${n.dash??""}|${n.opacidadeTraco??1}|${n.terminacao??""}|${n.juncao??""}|${n.deslocamentoDash??0}|${n.preencher?1:0}|${n.corPreenchimento}|${n.opacidadePreenchimento}`,i=this.porChave.get(o);return i||(this.porChave.set(o,n),n)}limpar(){this.porChave.clear()}}const mn=256,P=85.0511287798,pn=4007501668557849e-8;function J(t,n,o,i,a){const e=o>P?P:o<-P?-P:o,s=Math.sin(e*Math.PI/180);t[n]=(i+180)/360*a,t[n+1]=(.5-Math.log((1+s)/(1-s))/(4*Math.PI))*a}const D=t=>mn*2**t;function Mn(t,n,o){const i=D(o);return[Math.atan(Math.sinh(Math.PI*(1-2*n/i)))*180/Math.PI,t/i*360-180]}function Ln(t,n){const o=D(n),i=new Float64Array(t.length*2);for(let a=0;a<t.length;a++){const e=t[a];J(i,a*2,e[0],e[1],o)}return i}function An(t,n,o){const i=new Float64Array(2);return J(i,0,t,n,D(o)),i}function Ot(t,n){const o=Math.max(-P,Math.min(P,t));return pn*Math.cos(o*Math.PI/180)/D(n)}function xn(t,n,o){const i=Ot(t,o),a=n/i;return Number.isFinite(a)&&a>=0?a:0}function vn(t){let n=1/0,o=1/0,i=-1/0,a=-1/0;for(const e of t)for(let s=0;s+1<e.length;s+=2){const r=e[s],c=e[s+1];Number.isFinite(r)&&Number.isFinite(c)&&(r<n&&(n=r),r>i&&(i=r),c<o&&(o=c),c>a&&(a=c))}return n<=i&&o<=a?{minX:n,minY:o,maxX:i,maxY:a}:null}function jt(t,n,o,i,a,e){const s=a-o,r=e-i,c=s*s+r*r;let u=c===0?0:((t-o)*s+(n-i)*r)/c;return u=u<0?0:u>1?1:u,Math.hypot(t-(o+u*s),n-(i+u*r))}function In(t,n,o){const i=t.length>>1;if(!(n>0)||i<3)return t;let a=t,e=i;o&&(a=new Float64Array((i+1)*2),a.set(t),a[i*2]=t[0],a[i*2+1]=t[1],e=i+1);const s=new Uint8Array(e);s[0]=1,s[e-1]=1;const r=[0,e-1];for(;r.length>0;){const l=r.pop(),f=r.pop();let A=0,p=-1;const M=a[f*2],L=a[f*2+1],_=a[l*2],S=a[l*2+1];for(let I=f+1;I<l;I++){const y=jt(a[I*2],a[I*2+1],M,L,_,S);y>A&&(A=y,p=I)}p!==-1&&A>n&&(s[p]=1,r.push(f,p,p,l))}const c=o?e-1:e;let u=0;for(let l=0;l<c;l++)s[l]&&u++;if(o&&u<3||u===c)return t;const h=new Float64Array(u*2);let d=0;for(let l=0;l<c;l++)s[l]&&(h[d++]=a[l*2],h[d++]=a[l*2+1]);return h}exports.COR_PADRAO=Tt;exports.COR_SELECAO=Et;exports.IndiceEspacial=Ht;exports.InternadorEstilos=fn;exports.MIN_VERTICES_SIMPLIFICAR=xt;exports.RegraVersoes=Yt;exports.TIPOS_LINHA=Nt;exports.ZOOM_SEM_SIMPLIFICACAO=At;exports.amostrarCurva=tn;exports.areaDaGeometria=mt;exports.areaMetros2=ht;exports.caixaDaFeicao=k;exports.caixaPx=vn;exports.caixasSeTocam=b;exports.caminhoSvg=nn;exports.comprimentoMetros=lt;exports.controlesDoSegmento=B;exports.corSegura=E;exports.criarLinha=ut;exports.dashTipoLinha=Z;exports.distSegmentoPx=jt;exports.distanciaMetros=U;exports.ehMultilinha=Rt;exports.ehTipoLinha=z;exports.entidadeDe=T;exports.escalaDoZoom=D;exports.escalaLatitude=G;exports.escalaTipoLinhaSegura=bt;exports.espelhoDaAlca=Wt;exports.estiloVetorDe=ln;exports.extensaoDaGeometria=pt;exports.extremosDoCirculoGeografico=Mt;exports.formatarArea=dt;exports.formatarExtensao=ft;exports.juncaoCanvas=H;exports.latLonDoMundo=Mn;exports.limitesDaGeometria=Lt;exports.metrosPorGrau=$t;exports.metrosPorPixel=Ot;exports.moverNos=an;exports.normalizarNos=on;exports.normalizarTipoLinha=Y;exports.nosDaGeometria=en;exports.partesDaLinha=g;exports.passosDaCurva=Dt;exports.pontoDaCubica=gt;exports.projetarCentro=An;exports.projetarEm=J;exports.projetarVertices=Ln;exports.raioCirculoPx=xn;exports.raioPontoPx=dn;exports.simplificarAnel=It;exports.simplificarGeometria=Xt;exports.simplificarLinha=X;exports.simplificarPx=In;exports.statusDe=j;exports.temAlcas=yt;exports.terminacaoCanvas=V;exports.textoRotulo=Gt;exports.tipoDoNo=Jt;exports.toleranciaPorZoom=vt;exports.vertices=Pt;
@@ -0,0 +1,639 @@
1
+ var lt = Object.defineProperty;
2
+ var ft = (t, n, o) => n in t ? lt(t, n, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[n] = o;
3
+ var y = (t, n, o) => ft(t, typeof n != "symbol" ? n + "" : n, o);
4
+ function N(t) {
5
+ return t.partes && t.partes.length > 1 ? t.partes : [t.coordenadas];
6
+ }
7
+ function tn(t) {
8
+ return t.tipo === "LineString" && !!t.partes && t.partes.length > 1;
9
+ }
10
+ function mt(t) {
11
+ return t.length > 1 ? { tipo: "LineString", coordenadas: t[0], partes: t } : { tipo: "LineString", coordenadas: t[0] };
12
+ }
13
+ const P = 6378137, b = 1 / 298.257222101, G = b * (2 - b), m = (t) => t * Math.PI / 180;
14
+ function U(t) {
15
+ const n = Math.sin(m(t)), o = 1 - G * n * n;
16
+ return { N: P / Math.sqrt(o), M: P * (1 - G) / (o * Math.sqrt(o)) };
17
+ }
18
+ function nn(t) {
19
+ const { M: n, N: o } = U(t);
20
+ return { lat: m(1) * n, lng: m(1) * o * Math.cos(m(t)) };
21
+ }
22
+ function pt(t, n) {
23
+ const o = P * (1 - b), a = b, i = m(n[1] - t[1]), r = Math.atan((1 - a) * Math.tan(m(t[0]))), s = Math.atan((1 - a) * Math.tan(m(n[0]))), e = Math.sin(r), c = Math.cos(r), u = Math.sin(s), d = Math.cos(s);
24
+ let l = i, h = 0, f = 0, A = 0, p = 0, M = 0;
25
+ for (let S = 0; S < 100; S++) {
26
+ const k = Math.sin(l), z = Math.cos(l);
27
+ if (h = Math.hypot(d * k, c * u - e * d * z), h === 0) return 0;
28
+ f = e * u + c * d * z, A = Math.atan2(h, f);
29
+ const O = c * d * k / h;
30
+ p = 1 - O * O, M = p === 0 ? 0 : f - 2 * e * u / p;
31
+ const E = a / 16 * p * (4 + a * (4 - 3 * p)), dt = l;
32
+ if (l = i + (1 - E) * a * O * (A + E * h * (M + E * f * (-1 + 2 * M * M))), Math.abs(l - dt) < 1e-12) break;
33
+ }
34
+ const L = p * (P * P - o * o) / (o * o), D = 1 + L / 16384 * (4096 + L * (-768 + L * (320 - 175 * L))), g = L / 1024 * (256 + L * (-128 + L * (74 - 47 * L))), x = g * h * (M + g / 4 * (f * (-1 + 2 * M * M) - g / 6 * M * (-3 + 4 * h * h) * (-3 + 4 * M * M)));
35
+ return o * D * (A - x);
36
+ }
37
+ function V(t, n) {
38
+ const o = n[0] - t[0], a = n[1] - t[1];
39
+ if (Math.abs(o) < 0.1 && Math.abs(a) < 0.1) {
40
+ const { M: i, N: r } = U((t[0] + n[0]) / 2), s = m(o) * i, e = m(a) * r * Math.cos(m((t[0] + n[0]) / 2));
41
+ return Math.hypot(e, s);
42
+ }
43
+ return pt(t, n);
44
+ }
45
+ function Mt(t, n = !1) {
46
+ let o = 0;
47
+ for (let a = 1; a < t.length; a++) o += V(t[a - 1], t[a]);
48
+ return n && t.length > 2 && (o += V(t[t.length - 1], t[0])), o;
49
+ }
50
+ function q(t) {
51
+ const n = t.length;
52
+ if (n < 3) return 0;
53
+ let o = 0, a = 0;
54
+ for (let e = 0; e < n; e++) {
55
+ const c = t[(e - 1 + n) % n], u = t[e], d = t[(e + 1) % n];
56
+ o += m(d[1] - c[1]) * Math.sin(m(u[0])), a += u[0];
57
+ }
58
+ const { M: i, N: r } = U(a / n), s = Math.abs(o * i * r / 2);
59
+ return Number.isFinite(s) ? s : 0;
60
+ }
61
+ function Lt(t) {
62
+ const [n, ...o] = t;
63
+ return n ? Math.max(0, q(n) - o.reduce((a, i) => a + q(i), 0)) : 0;
64
+ }
65
+ const At = new Intl.NumberFormat("pt-BR", { minimumFractionDigits: 4, maximumFractionDigits: 4 }), H = new Intl.NumberFormat("pt-BR", { minimumFractionDigits: 2, maximumFractionDigits: 2 });
66
+ function yt(t) {
67
+ return `${At.format(t / 1e4)} ha`;
68
+ }
69
+ function vt(t) {
70
+ return t >= 1e3 ? `${H.format(t / 1e3)} km` : `${H.format(t)} m`;
71
+ }
72
+ function xt(t, n) {
73
+ return t.tipo === "Polygon" ? n ? n.area(t.aneis) : Lt(t.aneis) : t.tipo === "Circle" ? Math.PI * t.raioMetros ** 2 : null;
74
+ }
75
+ function It(t, n) {
76
+ const o = (a, i = !1) => n ? n.comprimento(a, i) : Mt(a, i);
77
+ return t.tipo === "LineString" ? N(t).reduce((a, i) => a + o(i), 0) : t.tipo === "Polygon" ? o(t.aneis[0] ?? [], !0) : t.tipo === "Circle" ? 2 * Math.PI * t.raioMetros : null;
78
+ }
79
+ function on(t, n) {
80
+ var i;
81
+ const o = n ?? "name";
82
+ if (o === "area") {
83
+ const r = xt(t.geometria);
84
+ return r === null ? "" : yt(r);
85
+ }
86
+ if (o === "extensao") {
87
+ const r = It(t.geometria);
88
+ return r === null ? "" : vt(r);
89
+ }
90
+ if (o === "id") return t.id;
91
+ const a = (i = t.propriedades) == null ? void 0 : i[o];
92
+ return a != null && a !== "" ? String(a) : n ? "" : t.id;
93
+ }
94
+ function gt(t, n) {
95
+ const o = n / 111320, a = o / Math.max(0.01, Math.cos(m(t[0])));
96
+ return [[t[0] - o, t[1] - a], [t[0] + o, t[1] + a]];
97
+ }
98
+ function St(t, n) {
99
+ let o;
100
+ switch (t.tipo) {
101
+ case "Point":
102
+ case "Text":
103
+ o = [t.coordenada];
104
+ break;
105
+ case "LineString":
106
+ o = N(t).flat();
107
+ break;
108
+ case "Polygon":
109
+ o = t.aneis.flat();
110
+ break;
111
+ case "Circle":
112
+ o = n ? n.extremosDoCirculo(t.centro, t.raioMetros) : gt(t.centro, t.raioMetros);
113
+ break;
114
+ }
115
+ const a = o.map((r) => r[0]), i = o.map((r) => r[1]);
116
+ return [[Math.min(...a), Math.min(...i)], [Math.max(...a), Math.max(...i)]];
117
+ }
118
+ const C = 16, Pt = 256;
119
+ function X(t, n) {
120
+ const [[o, a], [i, r]] = St(t.geometria, n);
121
+ return { minLon: a, minLat: o, maxLon: r, maxLat: i };
122
+ }
123
+ function j(t, n) {
124
+ return t.minLon <= n.maxLon && t.maxLon >= n.minLon && t.minLat <= n.maxLat && t.maxLat >= n.minLat;
125
+ }
126
+ function B(t) {
127
+ let n = 1 / 0, o = 1 / 0, a = -1 / 0, i = -1 / 0;
128
+ for (const r of t)
129
+ r.minLon < n && (n = r.minLon), r.minLat < o && (o = r.minLat), r.maxLon > a && (a = r.maxLon), r.maxLat > i && (i = r.maxLat);
130
+ return { minLon: n, minLat: o, maxLon: a, maxLat: i };
131
+ }
132
+ function Z(t) {
133
+ const n = t.length, o = Math.ceil(n / C), i = Math.ceil(Math.sqrt(o)) * C, r = [...t].sort((e, c) => e.minLon + e.maxLon - (c.minLon + c.maxLon)), s = [];
134
+ for (let e = 0; e < n; e += i) {
135
+ const c = r.slice(e, e + i).sort((u, d) => u.minLat + u.maxLat - (d.minLat + d.maxLat));
136
+ for (let u = 0; u < c.length; u += C) s.push(c.slice(u, u + C));
137
+ }
138
+ return s;
139
+ }
140
+ function Ct(t) {
141
+ if (t.length === 0) return null;
142
+ let n = Z(t).map((o) => ({ ...B(o), folhas: o }));
143
+ for (; n.length > 1; )
144
+ n = Z(n).map((o) => ({ ...B(o), filhos: o }));
145
+ return n[0];
146
+ }
147
+ class an {
148
+ /** `espaco` define o envelope do círculo (sem ele, o geográfico de sempre). */
149
+ constructor(n) {
150
+ y(this, "raiz", null);
151
+ /** Itens vivos: a fonte da verdade (a árvore pode conter itens já removidos/atualizados). */
152
+ y(this, "itens", /* @__PURE__ */ new Map());
153
+ /** Itens que entraram ou mudaram depois da última montagem. */
154
+ y(this, "delta", /* @__PURE__ */ new Map());
155
+ /** Ids que estão na árvore mas foram removidos ou substituídos. */
156
+ y(this, "obsoletos", /* @__PURE__ */ new Set());
157
+ this.espaco = n;
158
+ }
159
+ get tamanho() {
160
+ return this.itens.size;
161
+ }
162
+ construir(n) {
163
+ this.itens.clear();
164
+ for (const o of n)
165
+ o.excluida || this.itens.set(o.id, { id: o.id, ...X(o, this.espaco) });
166
+ this.remontar();
167
+ }
168
+ inserir(n) {
169
+ this.atualizar(n);
170
+ }
171
+ /** Insere ou substitui; feição `excluida` sai do índice. */
172
+ atualizar(n) {
173
+ if (n.excluida) {
174
+ this.remover(n.id);
175
+ return;
176
+ }
177
+ const o = { id: n.id, ...X(n, this.espaco) };
178
+ this.itens.has(n.id) && this.obsoletos.add(n.id), this.itens.set(n.id, o), this.delta.set(n.id, o), this.compactarSeNecessario();
179
+ }
180
+ remover(n) {
181
+ this.itens.delete(n) && (this.obsoletos.add(n), this.delta.delete(n), this.compactarSeNecessario());
182
+ }
183
+ limpar() {
184
+ this.itens.clear(), this.remontar();
185
+ }
186
+ /** Ids das feições cujo envelope toca `caixa`. */
187
+ consultar(n) {
188
+ const o = [], a = this.raiz ? [this.raiz] : [];
189
+ for (; a.length > 0; ) {
190
+ const i = a.pop();
191
+ if (j(i, n))
192
+ if (i.folhas)
193
+ for (const r of i.folhas)
194
+ !this.obsoletos.has(r.id) && j(r, n) && o.push(r.id);
195
+ else i.filhos && a.push(...i.filhos);
196
+ }
197
+ for (const i of this.delta.values()) j(i, n) && o.push(i.id);
198
+ return o;
199
+ }
200
+ intersecta(n) {
201
+ return this.consultar(n).length > 0;
202
+ }
203
+ /** Envelope da feição indexada, se houver. */
204
+ caixaDe(n) {
205
+ return this.itens.get(n);
206
+ }
207
+ compactarSeNecessario() {
208
+ this.delta.size + this.obsoletos.size > Math.max(Pt, this.itens.size * 0.1) && this.remontar();
209
+ }
210
+ remontar() {
211
+ this.raiz = Ct([...this.itens.values()]), this.delta.clear(), this.obsoletos.clear();
212
+ }
213
+ }
214
+ const bt = 17, Nt = 9, Tt = 1.2;
215
+ function Dt(t) {
216
+ return !Number.isFinite(t) || t >= bt ? 0 : 360 / (256 * 2 ** t) * Tt;
217
+ }
218
+ function Y(t) {
219
+ return Number.isFinite(t) ? 1 / Math.max(0.05, Math.cos(Math.max(-85, Math.min(85, t)) * Math.PI / 180)) : 1;
220
+ }
221
+ function Ot(t, n, o, a) {
222
+ const i = o[1] - n[1], r = (o[0] - n[0]) * a, s = i * i + r * r, e = (t[0] - n[0]) * a;
223
+ let c = s === 0 ? 0 : ((t[1] - n[1]) * i + e * r) / s;
224
+ return c = Math.max(0, Math.min(1, c)), Math.hypot(t[1] - (n[1] + c * i), e - c * r);
225
+ }
226
+ function rt(t, n, o = 1) {
227
+ if (!(n > 0) || t.length < 3) return t;
228
+ const a = Number.isFinite(o) && o > 0 ? o : 1, i = new Uint8Array(t.length);
229
+ i[0] = 1, i[t.length - 1] = 1;
230
+ const r = [[0, t.length - 1]];
231
+ for (; r.length > 0; ) {
232
+ const [s, e] = r.pop();
233
+ let c = 0, u = -1;
234
+ for (let d = s + 1; d < e; d++) {
235
+ const l = Ot(t[d], t[s], t[e], a);
236
+ l > c && (c = l, u = d);
237
+ }
238
+ u !== -1 && c > n && (i[u] = 1, r.push([s, u], [u, e]));
239
+ }
240
+ return t.filter((s, e) => i[e] === 1);
241
+ }
242
+ function Et(t, n, o = 1) {
243
+ if (!(n > 0) || t.length < 4) return t;
244
+ const a = [...t, t[0]], i = rt(a, n, o);
245
+ return i.pop(), i.length >= 3 ? i : t;
246
+ }
247
+ function jt(t) {
248
+ return (t.tipo === "LineString" || t.tipo === "Polygon") && t.curva ? 0 : t.tipo === "LineString" ? N(t).reduce((n, o) => n + o.length, 0) : t.tipo === "Polygon" ? t.aneis.reduce((n, o) => n + o.length, 0) : 0;
249
+ }
250
+ function rn(t, n) {
251
+ var a, i, r, s;
252
+ const o = Dt(n);
253
+ if (o === 0 || jt(t) < Nt) return t;
254
+ if (t.tipo === "LineString") {
255
+ const e = N(t), c = Y(((i = (a = e[0]) == null ? void 0 : a[0]) == null ? void 0 : i[0]) ?? NaN);
256
+ return mt(e.map((u) => rt(u, o, c)));
257
+ }
258
+ if (t.tipo === "Polygon") {
259
+ const e = Y(((s = (r = t.aneis[0]) == null ? void 0 : r[0]) == null ? void 0 : s[0]) ?? NaN);
260
+ return { tipo: "Polygon", aneis: t.aneis.map((c) => Et(c, o, e)) };
261
+ }
262
+ return t;
263
+ }
264
+ const wt = /* @__PURE__ */ new Set(["previa", "prévia", "preview", "rascunho", "draft", "proposta"]);
265
+ function $(t) {
266
+ var o, a;
267
+ const n = [t.status, (o = t.propriedades) == null ? void 0 : o.status, (a = t.propriedades) == null ? void 0 : a.tipo_geometria];
268
+ for (const i of n)
269
+ if (typeof i == "string" && wt.has(i.trim().toLowerCase())) return "previa";
270
+ return "oficial";
271
+ }
272
+ function w(t) {
273
+ var o;
274
+ const n = t.entidadeId ?? ((o = t.propriedades) == null ? void 0 : o.entidadeId);
275
+ return typeof n == "string" || typeof n == "number" ? String(n) : t.id;
276
+ }
277
+ const F = (t, n) => `${t}\0${n}`;
278
+ class en {
279
+ constructor() {
280
+ /** Mostra as prévias de todas as entidades. */
281
+ y(this, "global", !1);
282
+ y(this, "individuais", /* @__PURE__ */ new Set());
283
+ }
284
+ alternarIndividual(n, o) {
285
+ const a = F(n, o);
286
+ return this.individuais.has(a) ? this.individuais.delete(a) : this.individuais.add(a), this.individuais.has(a);
287
+ }
288
+ definirIndividual(n, o, a) {
289
+ const i = F(n, o);
290
+ a ? this.individuais.add(i) : this.individuais.delete(i);
291
+ }
292
+ individualAtiva(n, o) {
293
+ return this.individuais.has(F(n, o));
294
+ }
295
+ /** Entidades da camada que têm geometria oficial. */
296
+ static oficiais(n) {
297
+ const o = /* @__PURE__ */ new Set();
298
+ for (const a of n) !a.excluida && $(a) === "oficial" && o.add(w(a));
299
+ return o;
300
+ }
301
+ /** A feição aparece? `comOficial` = entidades da camada com geometria oficial (ver `oficiais`). */
302
+ visivel(n, o) {
303
+ if ($(n) === "oficial") return !0;
304
+ const a = w(n);
305
+ return this.global || !o.has(a) || this.individualAtiva(n.camadaId, a);
306
+ }
307
+ /** A prévia está sendo mostrada por pedido (global ou individual), e não só por falta de oficial? */
308
+ previaSolicitada(n) {
309
+ return this.global || this.individualAtiva(n.camadaId, w(n));
310
+ }
311
+ }
312
+ const et = /* @__PURE__ */ new Set(["simetrico", "suave", "livre"]), J = 1e-6;
313
+ function sn(t) {
314
+ if (!t.entrada && !t.saida) return "canto";
315
+ if (t.modo && et.has(t.modo)) return t.modo;
316
+ if (!t.entrada || !t.saida) return "simetrico";
317
+ const n = t.ponto[0] - t.entrada[0], o = t.ponto[1] - t.entrada[1], a = t.saida[0] - t.ponto[0], i = t.saida[1] - t.ponto[1], r = Math.hypot(n, o), s = Math.hypot(a, i);
318
+ return r === 0 || s === 0 || !(Math.abs(n * i - o * a) <= J * r * s && n * a + o * i > 0) ? "livre" : Math.abs(r - s) <= J * Math.max(r, s) ? "simetrico" : "suave";
319
+ }
320
+ const Ft = 24, _t = 2, Q = (t) => typeof t == "number" && Number.isFinite(t), _ = (t) => Array.isArray(t) && t.length === 2 && Q(t[0]) && Q(t[1]);
321
+ function cn(t, n) {
322
+ return [2 * t[0] - n[0], 2 * t[1] - n[1]];
323
+ }
324
+ function Rt(t) {
325
+ return t.some((n) => n.entrada !== void 0 || n.saida !== void 0);
326
+ }
327
+ function st(t, n) {
328
+ return [t.saida ?? t.ponto, n.entrada ?? n.ponto];
329
+ }
330
+ function ct(t, n) {
331
+ const o = [];
332
+ for (let a = 0; a < t - 1; a++) o.push([a, a + 1]);
333
+ return n && t > 2 && o.push([t - 1, 0]), o;
334
+ }
335
+ function $t(t, n, o, a, i) {
336
+ const r = 1 - i, s = r * r * r, e = 3 * r * r * i, c = 3 * r * i * i, u = i * i * i;
337
+ return [s * t[0] + e * n[0] + c * o[0] + u * a[0], s * t[1] + e * n[1] + c * o[1] + u * a[1]];
338
+ }
339
+ function un(t, n = !1, o = Ft) {
340
+ if (t.length === 0) return [];
341
+ const a = [[t[0].ponto[0], t[0].ponto[1]]];
342
+ for (const [i, r] of ct(t.length, n)) {
343
+ const s = t[i], e = t[r];
344
+ if (!(s.saida === void 0 && e.entrada === void 0)) {
345
+ const [u, d] = st(s, e);
346
+ for (let l = 1; l < o; l++) a.push($t(s.ponto, u, d, e.ponto, l / o));
347
+ }
348
+ r !== 0 && a.push([e.ponto[0], e.ponto[1]]);
349
+ }
350
+ return a;
351
+ }
352
+ function Ut(t, n) {
353
+ if (t.length === 0) return [];
354
+ const o = [{ cmd: "M", pts: [t[0].ponto] }];
355
+ for (const [a, i] of ct(t.length, n)) {
356
+ const r = t[a], s = t[i];
357
+ if (r.saida === void 0 && s.entrada === void 0)
358
+ o.push({ cmd: "L", pts: [s.ponto] });
359
+ else {
360
+ const [e, c] = st(r, s);
361
+ o.push({ cmd: "C", pts: [e, c, s.ponto] });
362
+ }
363
+ }
364
+ return o;
365
+ }
366
+ function hn(t, n, o) {
367
+ const a = (r) => String(Math.round(r * 100) / 100), i = Ut(t, n).map((r) => r.cmd + r.pts.map((s) => {
368
+ const e = o(s);
369
+ return `${a(e.x)} ${a(e.y)}`;
370
+ }).join(" ")).join("");
371
+ return i && n ? `${i}Z` : i;
372
+ }
373
+ function dn(t, n = _t) {
374
+ if (!Array.isArray(t) || t.length < n) return null;
375
+ const o = [];
376
+ for (const a of t) {
377
+ if (!a || typeof a != "object" || !_(a.ponto)) return null;
378
+ const i = a, r = { ponto: [i.ponto[0], i.ponto[1]] };
379
+ _(i.entrada) && (r.entrada = [i.entrada[0], i.entrada[1]]), _(i.saida) && (r.saida = [i.saida[0], i.saida[1]]), typeof i.modo == "string" && et.has(i.modo) && (r.entrada || r.saida) && (r.modo = i.modo), o.push(r);
380
+ }
381
+ return Rt(o) ? o : null;
382
+ }
383
+ function ln(t, n) {
384
+ return t.map((o) => {
385
+ const a = { ponto: n(o.ponto) };
386
+ return o.entrada && (a.entrada = n(o.entrada)), o.saida && (a.saida = n(o.saida)), o.modo && (a.modo = o.modo), a;
387
+ });
388
+ }
389
+ function fn(t) {
390
+ return t.tipo === "LineString" ? t.curva && t.curva.length >= 2 && !(t.partes && t.partes.length > 1) ? t.curva : null : t.tipo === "Polygon" && t.curva && t.curva.length >= 3 && t.aneis.length === 1 ? t.curva : null;
391
+ }
392
+ const kt = [
393
+ "continua",
394
+ "tracejada",
395
+ "tracejada-curta",
396
+ "tracejada-longa",
397
+ "pontilhada",
398
+ "traco-ponto",
399
+ "traco-ponto-ponto",
400
+ "oculta",
401
+ "centro",
402
+ "fantasma",
403
+ "divisa"
404
+ ], zt = {
405
+ tracejada: [12, 6],
406
+ "tracejada-curta": [6, 4],
407
+ "tracejada-longa": [24, 8],
408
+ pontilhada: [0, 4],
409
+ "traco-ponto": [12, 4, 0, 4],
410
+ "traco-ponto-ponto": [12, 4, 0, 4, 0, 4],
411
+ oculta: [6, 3],
412
+ centro: [24, 4, 6, 4],
413
+ fantasma: [24, 4, 6, 4, 6, 4],
414
+ divisa: [12, 4, 12, 4, 0, 4]
415
+ }, K = { arredondada: "round", reta: "butt", quadrada: "square" }, W = { arredondada: "round", chanfrada: "bevel", angular: "miter" }, Gt = 0.05, Vt = 100, tt = {
416
+ continuous: "continua",
417
+ dashed: "tracejada",
418
+ dashed2: "tracejada-curta",
419
+ dashedx2: "tracejada-longa",
420
+ dot: "pontilhada",
421
+ dotted: "pontilhada",
422
+ dashdot: "traco-ponto",
423
+ divide: "traco-ponto-ponto",
424
+ hidden: "oculta",
425
+ center: "centro",
426
+ phantom: "fantasma",
427
+ border: "divisa"
428
+ };
429
+ function nt(t) {
430
+ return typeof t == "string" && kt.includes(t);
431
+ }
432
+ function ut(t) {
433
+ if (nt(t)) return t;
434
+ if (typeof t != "string") return;
435
+ const n = t.trim().toLowerCase();
436
+ return nt(n) ? n : Object.prototype.hasOwnProperty.call(tt, n) ? tt[n] : void 0;
437
+ }
438
+ function ot(t) {
439
+ return typeof t == "string" && Object.prototype.hasOwnProperty.call(K, t) ? K[t] : void 0;
440
+ }
441
+ function at(t) {
442
+ return typeof t == "string" && Object.prototype.hasOwnProperty.call(W, t) ? W[t] : void 0;
443
+ }
444
+ function qt(t) {
445
+ return typeof t != "number" || !Number.isFinite(t) || t <= 0 ? 1 : Math.min(Vt, Math.max(Gt, t));
446
+ }
447
+ function it(t, n, o = 1, a = "round") {
448
+ const i = ut(t);
449
+ if (!i || i === "continua") return;
450
+ const r = Number.isFinite(n) && n > 0 ? n : 1, s = qt(o) * Math.max(1, r / 2), e = a === "butt" ? r : 0, c = a === "butt" ? 0 : r;
451
+ return zt[i].map((u, d) => {
452
+ const l = d % 2 === 0 ? u === 0 ? e : u * s : u * s + c;
453
+ return Math.round(l * 100) / 100;
454
+ }).join(" ");
455
+ }
456
+ const Ht = "#38bdf8", Xt = "#38bdf8", Bt = /^(#[0-9a-f]{3,8}|(rgb|hsl)a?\([0-9.,%\s\/-]+\)|[a-z]{3,20})$/i;
457
+ function R(t, n) {
458
+ return typeof t == "string" && Bt.test(t.trim()) ? t.trim() : n;
459
+ }
460
+ const v = (t) => typeof t == "number" && Number.isFinite(t);
461
+ function mn(t, n, o = !1) {
462
+ const a = t.estilo ?? {}, i = R(a.corTraco ?? n.corPrimaria, Ht), r = t.geometria.tipo, s = r === "Polygon" || r === "Circle", e = r === "Point", c = e && R(a.corContorno, "") || i, u = e && v(a.espessuraContorno) && a.espessuraContorno >= 0 ? a.espessuraContorno : void 0, d = u ?? (v(a.espessuraTraco) ? a.espessuraTraco : void 0) ?? (v(n.espessuraLinha) ? n.espessuraLinha : 2), l = v(a.opacidadePreenchimento) ? a.opacidadePreenchimento : s ? 0.2 : 0.85, h = o ? d + 2 : d, f = ot(a.terminacaoTraco) ?? ot(n.terminacaoLinha) ?? "round", A = v(a.opacidadeTraco) ? a.opacidadeTraco : v(n.opacidadeLinha) ? n.opacidadeLinha : 1;
463
+ return {
464
+ cor: o ? Xt : c,
465
+ traco: !(u === 0 && !o),
466
+ peso: h,
467
+ dash: Zt(t, n, h, f),
468
+ // selecionada fica opaca: a seleção precisa aparecer mesmo numa linha quase transparente
469
+ opacidadeTraco: o ? 1 : Math.min(1, Math.max(0, A)),
470
+ terminacao: f,
471
+ juncao: at(a.juncaoTraco) ?? at(n.juncaoLinha) ?? "round",
472
+ deslocamentoDash: v(a.deslocamentoTracejado) ? a.deslocamentoTracejado : 0,
473
+ preencher: s || e,
474
+ corPreenchimento: R(a.corPreenchimento, i),
475
+ opacidadePreenchimento: o ? Math.min(1, l + 0.18) : l
476
+ };
477
+ }
478
+ function Zt(t, n, o, a) {
479
+ const i = t.estilo ?? {};
480
+ if (i.dashArray) return i.dashArray;
481
+ if (i.tipoLinha !== void 0 && i.tipoLinha !== null) {
482
+ const r = it(i.tipoLinha, o, i.escalaTipoLinha ?? n.escalaTipoLinha, a);
483
+ if (r || ut(i.tipoLinha) === "continua") return r;
484
+ }
485
+ return $(t) === "previa" ? "6 4" : n.dashArray ? n.dashArray : it(n.tipoLinha, o, n.escalaTipoLinha, a);
486
+ }
487
+ function pn(t, n) {
488
+ var a;
489
+ const o = ((a = t.estilo) == null ? void 0 : a.tamanhoIcone) ?? n.tamanhoMarcador ?? 8;
490
+ return (v(o) && o > 0 ? o : 8) / 2;
491
+ }
492
+ class Mn {
493
+ constructor() {
494
+ y(this, "porChave", /* @__PURE__ */ new Map());
495
+ }
496
+ interno(n) {
497
+ const o = `${n.cor}|${n.traco ? 1 : 0}|${n.peso}|${n.dash ?? ""}|${n.opacidadeTraco ?? 1}|${n.terminacao ?? ""}|${n.juncao ?? ""}|${n.deslocamentoDash ?? 0}|${n.preencher ? 1 : 0}|${n.corPreenchimento}|${n.opacidadePreenchimento}`, a = this.porChave.get(o);
498
+ return a || (this.porChave.set(o, n), n);
499
+ }
500
+ limpar() {
501
+ this.porChave.clear();
502
+ }
503
+ }
504
+ const Yt = 256, I = 85.0511287798, Jt = 4007501668557849e-8;
505
+ function ht(t, n, o, a, i) {
506
+ const r = o > I ? I : o < -I ? -I : o, s = Math.sin(r * Math.PI / 180);
507
+ t[n] = (a + 180) / 360 * i, t[n + 1] = (0.5 - Math.log((1 + s) / (1 - s)) / (4 * Math.PI)) * i;
508
+ }
509
+ const T = (t) => Yt * 2 ** t;
510
+ function Ln(t, n, o) {
511
+ const a = T(o);
512
+ return [Math.atan(Math.sinh(Math.PI * (1 - 2 * n / a))) * 180 / Math.PI, t / a * 360 - 180];
513
+ }
514
+ function An(t, n) {
515
+ const o = T(n), a = new Float64Array(t.length * 2);
516
+ for (let i = 0; i < t.length; i++) {
517
+ const r = t[i];
518
+ ht(a, i * 2, r[0], r[1], o);
519
+ }
520
+ return a;
521
+ }
522
+ function yn(t, n, o) {
523
+ const a = new Float64Array(2);
524
+ return ht(a, 0, t, n, T(o)), a;
525
+ }
526
+ function Qt(t, n) {
527
+ const o = Math.max(-I, Math.min(I, t));
528
+ return Jt * Math.cos(o * Math.PI / 180) / T(n);
529
+ }
530
+ function vn(t, n, o) {
531
+ const a = Qt(t, o), i = n / a;
532
+ return Number.isFinite(i) && i >= 0 ? i : 0;
533
+ }
534
+ function xn(t) {
535
+ let n = 1 / 0, o = 1 / 0, a = -1 / 0, i = -1 / 0;
536
+ for (const r of t)
537
+ for (let s = 0; s + 1 < r.length; s += 2) {
538
+ const e = r[s], c = r[s + 1];
539
+ Number.isFinite(e) && Number.isFinite(c) && (e < n && (n = e), e > a && (a = e), c < o && (o = c), c > i && (i = c));
540
+ }
541
+ return n <= a && o <= i ? { minX: n, minY: o, maxX: a, maxY: i } : null;
542
+ }
543
+ function Kt(t, n, o, a, i, r) {
544
+ const s = i - o, e = r - a, c = s * s + e * e;
545
+ let u = c === 0 ? 0 : ((t - o) * s + (n - a) * e) / c;
546
+ return u = u < 0 ? 0 : u > 1 ? 1 : u, Math.hypot(t - (o + u * s), n - (a + u * e));
547
+ }
548
+ function In(t, n, o) {
549
+ const a = t.length >> 1;
550
+ if (!(n > 0) || a < 3) return t;
551
+ let i = t, r = a;
552
+ o && (i = new Float64Array((a + 1) * 2), i.set(t), i[a * 2] = t[0], i[a * 2 + 1] = t[1], r = a + 1);
553
+ const s = new Uint8Array(r);
554
+ s[0] = 1, s[r - 1] = 1;
555
+ const e = [0, r - 1];
556
+ for (; e.length > 0; ) {
557
+ const h = e.pop(), f = e.pop();
558
+ let A = 0, p = -1;
559
+ const M = i[f * 2], L = i[f * 2 + 1], D = i[h * 2], g = i[h * 2 + 1];
560
+ for (let x = f + 1; x < h; x++) {
561
+ const S = Kt(i[x * 2], i[x * 2 + 1], M, L, D, g);
562
+ S > A && (A = S, p = x);
563
+ }
564
+ p !== -1 && A > n && (s[p] = 1, e.push(f, p, p, h));
565
+ }
566
+ const c = o ? r - 1 : r;
567
+ let u = 0;
568
+ for (let h = 0; h < c; h++) s[h] && u++;
569
+ if (o && u < 3 || u === c) return t;
570
+ const d = new Float64Array(u * 2);
571
+ let l = 0;
572
+ for (let h = 0; h < c; h++)
573
+ s[h] && (d[l++] = i[h * 2], d[l++] = i[h * 2 + 1]);
574
+ return d;
575
+ }
576
+ export {
577
+ T as $,
578
+ Et as A,
579
+ rt as B,
580
+ hn as C,
581
+ Ht as D,
582
+ Xt as E,
583
+ $ as F,
584
+ w as G,
585
+ jt as H,
586
+ an as I,
587
+ rn as J,
588
+ j as K,
589
+ mn as L,
590
+ Nt as M,
591
+ pn as N,
592
+ on as O,
593
+ Ln as P,
594
+ xt as Q,
595
+ It as R,
596
+ yt as S,
597
+ kt as T,
598
+ vt as U,
599
+ en as V,
600
+ Mn as W,
601
+ X,
602
+ xn as Y,
603
+ bt as Z,
604
+ nt as _,
605
+ Lt as a,
606
+ Y as a0,
607
+ Qt as a1,
608
+ yn as a2,
609
+ ht as a3,
610
+ An as a4,
611
+ vn as a5,
612
+ In as a6,
613
+ Dt as a7,
614
+ tn as b,
615
+ Mt as c,
616
+ V as d,
617
+ gt as e,
618
+ ln as f,
619
+ mt as g,
620
+ st as h,
621
+ $t as i,
622
+ un as j,
623
+ cn as k,
624
+ Rt as l,
625
+ nn as m,
626
+ St as n,
627
+ ot as o,
628
+ N as p,
629
+ ut as q,
630
+ at as r,
631
+ qt as s,
632
+ sn as t,
633
+ R as u,
634
+ it as v,
635
+ Kt as w,
636
+ fn as x,
637
+ Ut as y,
638
+ dn as z
639
+ };