1(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{};e.SENTRY_RELEASE={id:`[email protected]+d0fb5ba`};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`fa8d6e29-389f-4627-8af9-7be9d3795383`,e._sentryDebugIdIdentifier=`sentry-dbid-fa8d6e29-389f-4627-8af9-7be9d3795383`)}catch{}})();import{a as e,r as t}from"./chunk-CME6nArf.js";import{fn as n,un as r,xn as i}from"./environment-Br76g2hu.js";import{r as a,t as o}from"./interceptor-C0qcXwOa.js";import{a as s,d as c,i as l,r as u,t as d}from"./esm-BK0hXUFE.js";import{c as f,d as p,f as m,u as h}from"./coordinates-CV57stJm.js";import{t as g}from"./lib-B9zeYMgB.js";var _=e(g()),v=e=>e,y={validPosition:(e,t)=>e!=null&&e>=-90&&e<=90&&t!=null&&t>=-180&&t<=180,convertToKm:(e,t)=>(0,_.default)(e).from(v(t)).to(`km`),convertToMeters:(e,t)=>(0,_.default)(e).from(v(t)).to(`m`),getLineRouteDataSource:e=>({type:`Feature`,properties:{},geometry:{type:`LineString`,coordinates:e}}),getBoundingBox:(e,t)=>{let n={xMin:180,xMax:-180,yMin:90,yMax:-90},r,i,a,o=t||0;if(e&&e.length){for(let t=0;t<e.length;t++)r=e[t],a=r[0],i=r[1],n.xMin=n.xMin<a?n.xMin:a,n.xMax=n.xMax>a?n.xMax:a,n.yMin=n.yMin<i?n.yMin:i,n.yMax=n.yMax>i?n.yMax:i;n.xMin&&(n.xMin+=-o),n.xMax&&(n.xMax+=o),n.yMin&&(n.yMin+=-o),n.yMax&&(n.yMax+=o)}return n},tryParseGeometry:e=>{try{return e?JSON.parse(e):null}catch{return null}}},b=11102230246251565e-32,x=134217729,S=3.000000000000001*b;function C(e,t,n,r,i){let a,o,s,c,l=t[0],u=r[0],d=0,f=0;u>l==u>-l?(a=l,l=t[++d]):(a=u,u=r[++f]);let p=0;if(d<e&&f<n)for(u>l==u>-l?(o=l+a,s=a-(o-l),l=t[++d]):(o=u+a,s=a-(o-u),u=r[++f]),a=o,s!==0&&(i[p++]=s);d<e&&f<n;)u>l==u>-l?(o=a+l,c=o-a,s=a-(o-c)+(l-c),l=t[++d]):(o=a+u,c=o-a,s=a-(o-c)+(u-c),u=r[++f]),a=o,s!==0&&(i[p++]=s);for(;d<e;)o=a+l,c=o-a,s=a-(o-c)+(l-c),l=t[++d],a=o,s!==0&&(i[p++]=s);for(;f<n;)o=a+u,c=o-a,s=a-(o-c)+(u-c),u=r[++f],a=o,s!==0&&(i[p++]=s);return(a!==0||p===0)&&(i[p++]=a),p}function ee(e,t){let n=t[0];for(let r=1;r<e;r++)n+=t[r];return n}function w(e){return new Float64Array(e)}var T=(3+16*b)*b,te=(2+12*b)*b,E=(9+64*b)*b*b,D=w(4),O=w(8),k=w(12),A=w(16),j=w(4);function M(e,t,n,r,i,a,o){let s,c,l,u,d,f,p,m,h,g,_,v,y,b,w,T,M,N,P=e-i,F=n-i,I=t-a,L=r-a;b=P*L,f=x*P,p=f-(f-P),m=P-p,f=x*L,h=f-(f-L),g=L-h,w=m*g-(b-p*h-m*h-p*g),T=I*F,f=x*I,p=f-(f-I),m=I-p,f=x*F,h=f-(f-F),g=F-h,M=m*g-(T-p*h-m*h-p*g),_=w-M,d=w-_,D[0]=w-(_+d)+(d-M),v=b+_,d=v-b,y=b-(v-d)+(_-d),_=y-T,d=y-_,D[1]=y-(_+d)+(d-T),N=v+_,d=N-v,D[2]=v-(N-d)+(_-d),D[3]=N;let R=ee(4,D),z=te*o;if(R>=z||-R>=z||(d=e-P,s=e-(P+d)+(d-i),d=n-F,l=n-(F+d)+(d-i),d=t-I,c=t-(I+d)+(d-a),d=r-L,u=r-(L+d)+(d-a),s===0&&c===0&&l===0&&u===0)||(z=E*o+S*Math.abs(R),R+=P*u+L*s-(I*l+F*c),R>=z||-R>=z))return R;b=s*L,f=x*s,p=f-(f-s),m=s-p,f=x*L,h=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44+576*b)*b*b,w(4),w(4),w(4),w(4),w(4),w(4),w(4),w(4),w(8),w(8),w(8),w(8),w(8),w(8),w(8),w(8),w(8),w(4),w(4),w(4),w(8),w(16),w(16),w(16),w(32),w(32),w(48),w(64),w(1152),w(1152),(16+224*b)*b,(5+72*b)*b,(71+1408*b)*b*b,w(4),w(4),w(4),w(4),w(4),w(4),w(4),w(4),w(4),w(4),w(24),w(24),w(24),w(24),w(24),w(24),w(24),w(24),w(24),w(24),w(1152),w(1152),w(1152),w(1152),w(1152),w(2304),w(2304),w(3456),w(5760),w(8),w(8),w(8),w(16),w(24),w(48),w(48),w(96),w(192),w(384),w(384),w(384),w(768),w(96),w(96),w(96),w(1152);function P(e,t){var n,r,i=0,a,o,s,c,l,u,d,f=e[0],p=e[1],m=t.length;for(n=0;n<m;n++){r=0;var h=t[n],g=h.length-1;if(u=h[0],u[0]!==h[g][0]&&u[1]!==h[g][1])throw Error(`First and last coordinates in a ring must be the same`);for(o=u[0]-f,s=u[1]-p;r<g;
1r++){if(d=h[r+1],c=d[0]-f,l=d[1]-p,s===0&&l===0){if(c<=0&&o>=0||o<=0&&c>=0)return 0}else if(l>=0&&s<=0||l<=0&&s>=0){if(a=N(o,c,s,l,0,0),a===0)return 0;(a>0&&l>0&&s<=0||a<0&&l<=0&&s>0)&&i++}u=d,s=l,o=c}}return i%2!=0}function F(e,t,n={}){if(!e)throw Error(`point is required`);if(!t)throw Error(`polygon is required`);let r=u(e),i=s(t),a=i.type,o=t.bbox,c=i.coordinates;if(o&&I(r,o)===!1)return!1;a===`Polygon`&&(c=[c]);let l=!1;for(var d=0;d<c.length;++d){let e=P(r,c[d]);if(e===0)return!n.ignoreBoundary;e&&(l=!0)}return l}function I(e,t){return t[0]<=e[0]&&t[1]<=e[1]&&t[2]>=e[0]&&t[3]>=e[1]}function L(e,t,n={}){let r=u(e),i=l(t);for(let e=0;e<i.length-1;e++){let t=!1;if(n.ignoreEndVertices&&(e===0&&(t=`start`),e===i.length-2&&(t=`end`),e===0&&e+1===i.length-1&&(t=`both`)),R(i[e],i[e+1],r,t,n.epsilon===void 0?null:n.epsilon))return!0}return!1}function R(e,t,n,r,i){let a=n[0],o=n[1],s=e[0],c=e[1],l=t[0],u=t[1],d=n[0]-s,f=n[1]-c,p=l-s,m=u-c,h=d*m-f*p;if(i!==null){if(Math.abs(h)>i)return!1}else if(h!==0)return!1;return Math.abs(p)===Math.abs(m)&&Math.abs(p)===0?r?!1:n[0]===e[0]&&n[1]===e[1]:r?r===`start`?Math.abs(p)>=Math.abs(m)?p>0?s<a&&a<=l:l<=a&&a<s:m>0?c<o&&o<=u:u<=o&&o<c:r===`end`?Math.abs(p)>=Math.abs(m)?p>0?s<=a&&a<l:l<a&&a<=s:m>0?c<=o&&o<u:u<o&&o<=c:r===`both`?Math.abs(p)>=Math.abs(m)?p>0?s<a&&a<l:l<a&&a<s:m>0?c<o&&o<u:u<o&&o<c:!1:Math.abs(p)>=Math.abs(m)?p>0?s<=a&&a<=l:l<=a&&a<=s:m>0?c<=o&&o<=u:u<=o&&o<=c}function z(e,t){let n=s(e),r=s(t),i=n.type,a=r.type,o=n.coordinates,c=r.coordinates;switch(i){case`Point`:switch(a){case`Point`:return G(o,c);default:throw Error(`feature2 `+a+` geometry not supported`)}case`MultiPoint`:switch(a){case`Point`:return V(n,r);case`MultiPoint`:return H(n,r);default:throw Error(`feature2 `+a+` geometry not supported`)}case`LineString`:switch(a){case`Point`:return L(r,n,{ignoreEndVertices:!0});case`LineString`:return ie(n,r);case`MultiPoint`:return ne(n,r);default:throw Error(`feature2 `+a+` geometry not supported`)}case`Polygon`:switch(a){case`Point`:return F(r,n,{ignoreBoundary:!0});case`LineString`:return ae(n,r);case`Polygon`:return U(n,r);case`MultiPoint`:return re(n,r);default:throw Error(`feature2 `+a+` geometry not supported`)}case`MultiPolygon`:switch(a){case`Polygon`:return B(n,r);default:throw Error(`feature2 `+a+` geometry not supported`)}default:throw Error(`feature1 `+i+` geometry not supported`)}}function B(e,t){return e.coordinates.some(e=>U({type:`Polygon`,coordinates:e},t))}function V(e,t){let n,r=!1;for(n=0;n<e.coordinates.length;n++)if(G(e.coordinates[n],t.coordinates)){r=!0;break}return r}function H(e,t){for(let n of t.coordinates){let t=!1;for(let r of e.coordinates)if(G(n,r)){t=!0;break}if(!t)return!1}return!0}function ne(e,t){let n=!1;for(let r of t.coordinates)if(L(r,e,{ignoreEndVertices:!0})&&(n=!0),!L(r,e))return!1;return!!n}function re(e,t){for(let n of t.coordinates)if(!F(n,e,{ignoreBoundary:!0}))return!1;return!0}function ie(e,t){let n=!1;for(let r of t.coordinates)if(L({type:`Point`,coordinates:r},e,{ignoreEndVertices:!0})&&(n=!0),!L({type:`Point`,coordinates:r},e,{ignoreEndVertices:!1}))return!1;return n}function ae(e,t){let n=!1,r=0;if(!W(m(e),m(t)))return!1;for(;r<t.coordinates.length-1;r++)if(F({type:`Point`,coordinates:K(t.coordinates[r],t.coordinates[r+1])},e,{ignoreBoundary:!0})){n=!0;break}return n}function U(e,t){if(e.type===`Feature`&&e.geometry===null||t.type===`Feature`&&t.geometry===null||!W(m(e),m(t)))return!1;let n=s(t).coordinates;for(let t of n)for(let n of t)if(!F(n,e))return!1;return!0}function W(e,t){return!(e[0]>t[0]||e[2]<t[2]||e[1]>t[1]||e[3]<t[3])}function G(e,t){return e[0]===t[0]&&e[1]===t[1]}function K(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2]}function q(e){let t,n,r={type:`FeatureCollection`,features:[]};if(n=e.type===`Feature`?e.geometry:e,n.type===`LineString`)t=[n.coordinates];else if(n.type===`MultiLineString`)t=n.coordinates;else if(n.type===`MultiPolygon`)t=[].concat(...n.coordinates);else if(n.type===`Polygon`)t=n.coordinates;else throw Error(`Input must be a LineString, MultiLineString, Polygon, or MultiPolygon Feature or Geometry`);
1return t.forEach(e=>{t.forEach(t=>{for(let n=0;n<e.length-1;n++)for(let i=n;i<t.length-1;i++){if(e===t&&(Math.abs(n-i)===1||n===0&&i===e.length-2&&e[n][0]===e[e.length-1][0]&&e[n][1]===e[e.length-1][1]))continue;let a=oe(e[n][0],e[n][1],e[n+1][0],e[n+1][1],t[i][0],t[i][1],t[i+1][0],t[i+1][1]);a&&r.features.push(c([a[0],a[1]]))}})}),r}function oe(e,t,n,r,i,a,o,s){let c,l,u,d,f,p={x:null,y:null,onLine1:!1,onLine2:!1};return c=(s-a)*(n-e)-(o-i)*(r-t),c===0?p.x!==null&&p.y!==null?p:!1:(l=t-a,u=e-i,d=(o-i)*l-(s-a)*u,f=(n-e)*l-(r-t)*u,l=d/c,u=f/c,p.x=e+l*(n-e),p.y=t+l*(r-t),l>=0&&l<=1&&(p.onLine1=!0),u>=0&&u<=1&&(p.onLine2=!0),p.onLine1&&p.onLine2?[p.x,p.y]:!1)}var se=e=>{let[t,n,r,i]=e.length===6?[e[0],e[1],e[3],e[4]]:e;return[[t,n],[r,i]]},J=e=>JSON.stringify(e),Y=e=>{try{return e?JSON.parse(e):null}catch{return null}},X=e=>{try{if(!e)return null;let t=p(e);return t?.geometry?.coordinates?.length?{lon:t.geometry.coordinates[0],lat:t.geometry.coordinates[1]}:null}catch{return null}},ce=e=>({type:`Feature`,geometry:{type:`Polygon`,coordinates:e.map(e=>{if(e.length<3)return e;let t=e[0],n=e[e.length-1];return Math.abs(t[0]-n[0])<1e-10&&Math.abs(t[1]-n[1])<1e-10?e:[...e,t]})},properties:{}}),le=(e,t)=>{try{return F(e,t)}catch{let n=`geometry`in t?t.geometry:t;if(n.type===`Polygon`)try{return F(e,ce(n.coordinates))}catch(e){console.warn(`Failed to check point in polygon:`,e)}return!1}},Z=(e,t,n)=>{let r=c([e.status.longitude,e.status.latitude]);return t.type===`C`||t.parsedGeometry?.properties?.isCircle?h(r,c([t.centerLon,t.centerLat]),{units:`meters`})<=t.radius:t.type===`P`&&n?le(r,n):!1},ue=(e,t)=>{let n={};return t.forEach(e=>{n[e.id]=[]}),e.forEach(e=>{let r=e?.status?.latitude,i=e?.status?.longitude;f(i,r)&&t.forEach(t=>{let{bbox:a,parsedGeometry:o,id:s}=t;a&&(i<a[0]||i>a[2]||r<a[1]||r>a[3])||Z(e,t,o)&&n[s].push(e)})}),n};function de(e){if(e.geometry){let t=Y(e.geometry);if(e.parsedGeometry=t,t?.properties?.isCircle?e.type=n.Circle:e.type=n.Polygon,!e.centerLat||!e.centerLon)if(t?.properties?.isCircle&&t?.properties?.center&&t?.properties?.center.length)e.centerLon=t?.properties?.center[0],e.centerLat=t?.properties?.center[1];else{let n=X(t);n&&(e.centerLat=n.lat,e.centerLon=n.lon)}}else{let t={isCircle:!0,center:[e.centerLon,e.centerLat],radiusInKm:y.convertToKm(e.radius,`m`)},n=d(t.center,t.radiusInKm);n.properties=t,e.geometry=J(n),e.parsedGeometry=n}if(e.parsedGeometry)try{e.bbox=m(e.parsedGeometry)}catch(e){console.error(`Error adapting boundary`,e)}return e.color=e.color||r.DefaultBoundary.Stroke,e.stroke=e.color,e}function fe(e,t,n){let r=y.convertToKm(n,`m`),i=d([e,t],Math.max(r,.01));return i.properties={isCircle:!0,center:[e,t],radiusInKm:r},J(i)}function pe(e){return J({type:`Feature`,geometry:{type:`Polygon`,coordinates:[[...e.map(([e,t])=>[t,e]),[e[0][1],e[0][0]]]]},properties:{}})}function me(e){let t=e.geometry;return t?.type===`Feature`?J(t):J({type:`Feature`,geometry:t,properties:{}})}function he(e,t){return e.name.toLowerCase()>t.name.toLowerCase()?1:-1}var ge=t({boundariesAPI:()=>$}),_e=i().boundaryapi,Q=a.create({baseURL:_e});Q.interceptors.request.use(o);var $={getBoundaries:(e={})=>Q.get(`/listing`,{params:{tagIdList:e?.tagId,withSecurityGroupTag:e?.withSecurityGroupTag,index:e?.index,pageSize:e?.pageSize}}).then(e=>e.data.result.map(de)),deleteBoundary:e=>Q.delete(`/delete`,{data:{id:e.boundaryId,uuid:e.userId}}).then(e=>e.data.result),saveBoundary:({boundary:e,clientId:t,userId:n})=>Q.post(`save`,{boundary:e,clientId:t,modifiedBy:n}).then(e=>e.data.result),deviceBoundariesReportStats:async({imei:e,...t})=>{let n=Object.fromEntries(Object.entries(t).filter(([e,t])=>t!==void 0&&t!==``));return Q.get(`device-report/${e}/stats`,{params:n}).then(e=>e.data.result)},deviceBoundariesReportVisits:async({imei:e,...t})=>{let n=Object.fromEntries(Object.entries(t).filter(([e,t])=>t!==void 0&&t!==``));return Q.get(`device-report/${e}/visits`,{params:n}).then(e=>e.data.result)},boundaryReportStats:async({boundaryId:e,...t})=>{let n=Object.fromEntries(Object.entries(t).filter(([e,t])=>t!==void 0&&t!==``));return Q.get(`report/${e}/stats`,{params:n}).then(e=>e.data.result)},stats:async({boundaryIds:e,...t})=>{let n={...Object.fromEntries(Object.entries(t).filter(([e,t])=>t!==void 0&&t!==``)),...e?.length?{boundaryIds:e.join(`,`)}:{}};return Q.get(`stats`,{params:n}).then(e=>e.data.result)},statsById:async({boundaryId:e,...t})=>{let n=Object.fromEntries(Object.entries(t).filter(([e,t])=>t!==void 0&&t!==``));return Q.get(`stats/${e}`,{params:n}).then(e=>e.data.result)},boundaryReportVisits:async({boundaryId:e,...t})=>{let n=Object.fromEntries(Object.entries(t).filter(([e,t])=>t!==void 0&&t!==``));return Q.get(`report/${e}/visits`,{params:n}).then(e=>e.data.result)},exportBoundaryReportVisitsToS3:e=>Q.get(`report/${e.boundaryId}
1/visits`,{params:{startDate:e.startDate,endDate:e.endDate,exportToS3:!0}}).then(e=>e.data.result),exportDeviceReportVisitsToS3:e=>Q.get(`device-report/${e.imei}/visits`,{params:{startDate:e.startDate,endDate:e.endDate,exportToS3:!0}}).then(e=>e.data.result),getPlaceCategories:()=>Q.get(`place-categories`).then(e=>e.data.result),createPlaceTypes:e=>Q.post(`place-types`,{placeTypes:e}).then(e=>e.data.result)};export{he as a,X as c,q as d,z as f,pe as i,ue as l,ge as n,me as o,fe as r,se as s,$ as t,Y as u}; 2//# sourceMappingURL=boundaries-DFevgeAa.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.