/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../../../core/number","../csv/csv"],(function(e,t,n){"use strict";function r(e){const t=e.map((e=>e.toLowerCase()));return{longitudeFieldName:e[t.indexOf(c.find((e=>t.includes(e))))],latitudeFieldName:e[t.indexOf(d.find((e=>t.includes(e))))]}}function i(e,t,r,i){const a=[],o=n.parseRows(e,r,t),u=[];for(const n of o){if(10===u.length)break;u.push(n)}for(const n of r)if(n===i.longitudeFieldName||n===i.latitudeFieldName)a.push({name:n,type:"esriFieldTypeDouble",alias:n});else{const e=l(u.map((e=>e[n]))),t={name:n,type:null,alias:n};switch(e){case"integer":t.type="esriFieldTypeInteger";break;case"double":t.type="esriFieldTypeDouble";break;case"date":t.type="esriFieldTypeDate",t.length=36;break;default:t.type="esriFieldTypeString",t.length=255}a.push(t)}return a}function l(e){if(!e.length)return"string";const t=/[^+-.,0-9]/;return e.map((e=>{let n=!1;if(""!==e){if(t.test(e))n=!0;else{let t=o(e);if(!isNaN(t))return/[.,]/.test(e)||!Number.isInteger(t)||t>214783647||t<-214783648?"double":"integer";if(e.includes("E")){if(t=Number(e),!isNaN(t))return"double";if(e.includes(",")){if(e=e.replace(",","."),t=Number(e),!isNaN(t))return"double";n=!0}else n=!0}else n=!0}if(n){if(!/^[-]?\d*[.,]?\d*$/.test(e)){return a(new Date(e),e)?"date":"string"}return"string"}return"string"}})).reduce(((e,t)=>void 0===e||e===t?t:"string"===e||"string"===t?"string":"double"===e||"double"===t?"double":void 0))}function a(e,t){if(!e||"[object Date]"!==Object.prototype.toString.call(e)||isNaN(e.getTime()))return!1;let n=!0;if(!s&&/\d+\W*$/.test(t)){const e=t.match(/[a-zA-Z]{2,}/);if(e){let t=!1,r=0;for(;!t&&r<=e.length;)t=!u.test(e[r]),r++;n=!t}}return n}const o=function(){const e=t._parseInfo(),n=new RegExp("^"+e.regexp+"$"),r=new RegExp("["+e.group+"\\s\\xa0]","g"),i=e.factor;return t=>{const l=n.exec(t);if(e.factor=i,!l)return NaN;let a=l[1];if(!l[1]){if(!l[2])return NaN;a=l[2],e.factor*=-1}return a=a.replace(r,"").replace(e.decimal,"."),+a*e.factor}}(),u=/^((jan(uary)?)|(feb(ruary)?)|(mar(ch)?)|(apr(il)?)|(may)|(jun(e)?)|(jul(y)?)|(aug(ust)?)|(sep(tember)?)|(oct(ober)?)|(nov(ember)?)|(dec(ember)?)|(am)|(pm)|(gmt)|(utc))$/i,s=Number.isNaN(new Date("technology 10").getTime()),d=["lat","latitude","latitude83","latdecdeg","lat_dd","y","ycenter","point-y"],c=["lon","lng","long","longitude","longitude83","longdecdeg","long_dd","x","xcenter","point-x"];e.inferFieldType=l,e.inferFields=i,e.inferLocationInfo=r,e.isValidDate=a,e.parseNumber=o,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
