w-kriging
Version:
A tool for kriging.
8 lines (7 loc) • 27.9 kB
JavaScript
/*!
* w-kriging v1.0.17
* (c) 2018-2021 yuda-lyu(semisphere)
* Released under the MIT License.
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("path"),require("fs"),require("process"),require("child_process")):"function"==typeof define&&define.amd?define(["path","fs","process","child_process"],e):(t="undefined"!=typeof globalThis?globalThis:t||self)["w-kriging"]=e(t.path,t.fs,t.process,t.child_process)}(this,(function(t,e,r,n){"use strict";var o=Array.isArray,i="object"==typeof global&&global&&global.Object===Object&&global,u="object"==typeof self&&self&&self.Object===Object&&self,c=i||u||Function("return this")(),a=c.Symbol,s=Object.prototype,f=s.hasOwnProperty,l=s.toString,p=a?a.toStringTag:void 0;var h=Object.prototype.toString;var d="[object Null]",y="[object Undefined]",v=a?a.toStringTag:void 0;function b(t){return null==t?void 0===t?y:d:v&&v in Object(t)?function(t){var e=f.call(t,p),r=t[p];try{t[p]=void 0;var n=!0}catch(t){}var o=l.call(t);return n&&(e?t[p]=r:delete t[p]),o}(t):function(t){return h.call(t)}(t)}function g(t){return null!=t&&"object"==typeof t}var _="[object Symbol]";function j(t){return"symbol"==typeof t||g(t)&&b(t)==_}var w=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,m=/^\w*$/;function O(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}var S="[object AsyncFunction]",x="[object Function]",A="[object GeneratorFunction]",z="[object Proxy]";function k(t){if(!O(t))return!1;var e=b(t);return e==x||e==A||e==S||e==z}var $,B=c["__core-js_shared__"],P=($=/[^.]+$/.exec(B&&B.keys&&B.keys.IE_PROTO||""))?"Symbol(src)_1."+$:"";var E=Function.prototype.toString;function F(t){if(null!=t){try{return E.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var T=/^\[object .+?Constructor\]$/,I=Function.prototype,C=Object.prototype,M=I.toString,N=C.hasOwnProperty,U=RegExp("^"+M.call(N).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function D(t){return!(!O(t)||(e=t,P&&P in e))&&(k(t)?U:T).test(F(t));var e}function H(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return D(r)?r:void 0}var L=H(Object,"create");var R=Object.prototype.hasOwnProperty;var q=Object.prototype.hasOwnProperty;function V(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function W(t,e){return t===e||t!=t&&e!=e}function J(t,e){for(var r=t.length;r--;)if(W(t[r][0],e))return r;return-1}V.prototype.clear=function(){this.__data__=L?L(null):{},this.size=0},V.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},V.prototype.get=function(t){var e=this.__data__;if(L){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return R.call(e,t)?e[t]:void 0},V.prototype.has=function(t){var e=this.__data__;return L?void 0!==e[t]:q.call(e,t)},V.prototype.set=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=L&&void 0===e?"__lodash_hash_undefined__":e,this};var G=Array.prototype.splice;function K(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}K.prototype.clear=function(){this.__data__=[],this.size=0},K.prototype.delete=function(t){var e=this.__data__,r=J(e,t);return!(r<0)&&(r==e.length-1?e.pop():G.call(e,r,1),--this.size,!0)},K.prototype.get=function(t){var e=this.__data__,r=J(e,t);return r<0?void 0:e[r][1]},K.prototype.has=function(t){return J(this.__data__,t)>-1},K.prototype.set=function(t,e){var r=this.__data__,n=J(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};var X=H(c,"Map");function Y(t,e){var r,n,o=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof e?"string":"hash"]:o.map}function Z(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Z.prototype.clear=function(){this.size=0,this.__data__={hash:new V,map:new(X||K),string:new V}},Z.prototype.delete=function(t){var e=Y(this,t).delete(t);return this.size-=e?1:0,e},Z.prototype.get=function(t){return Y(this,t).get(t)},Z.prototype.has=function(t){return Y(this,t).has(t)},Z.prototype.set=function(t,e){var r=Y(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};var Q="Expected a function";function tt(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError(Q);var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var u=t.apply(this,n);return r.cache=i.set(o,u)||i,u};return r.cache=new(tt.Cache||Z),r}tt.Cache=Z;var et,rt,nt,ot=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,it=/\\(\\)?/g,ut=(et=function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(ot,(function(t,r,n,o){e.push(n?o.replace(it,"$1"):r||t)})),e},rt=tt(et,(function(t){return 500===nt.size&&nt.clear(),t})),nt=rt.cache,rt),ct=ut;var at=1/0,st=a?a.prototype:void 0,ft=st?st.toString:void 0;function lt(t){if("string"==typeof t)return t;if(o(t))return function(t,e){for(var r=-1,n=null==t?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}(t,lt)+"";if(j(t))return ft?ft.call(t):"";var e=t+"";return"0"==e&&1/t==-at?"-0":e}function pt(t){return null==t?"":lt(t)}function ht(t,e){return o(t)?t:function(t,e){if(o(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!j(t))||m.test(t)||!w.test(t)||null!=e&&t in Object(e)}(t,e)?[t]:ct(pt(t))}var dt=1/0;function yt(t){if("string"==typeof t||j(t))return t;var e=t+"";return"0"==e&&1/t==-dt?"-0":e}function vt(t,e,r){var n=null==t?void 0:function(t,e){for(var r=0,n=(e=ht(e,t)).length;null!=t&&r<n;)t=t[yt(e[r++])];return r&&r==n?t:void 0}(t,e);return void 0===n?r:n}function bt(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t}var gt,_t=function(t,e,r){for(var n=-1,o=Object(t),i=r(t),u=i.length;u--;){var c=i[gt?u:++n];if(!1===e(o[c],c,o))break}return t};function jt(t){return g(t)&&"[object Arguments]"==b(t)}var wt=Object.prototype,mt=wt.hasOwnProperty,Ot=wt.propertyIsEnumerable,St=jt(function(){return arguments}())?jt:function(t){return g(t)&&mt.call(t,"callee")&&!Ot.call(t,"callee")},xt=St;var At="object"==typeof exports&&exports&&!exports.nodeType&&exports,zt=At&&"object"==typeof module&&module&&!module.nodeType&&module,kt=zt&&zt.exports===At?c.Buffer:void 0,$t=(kt?kt.isBuffer:void 0)||function(){return!1},Bt=9007199254740991,Pt=/^(?:0|[1-9]\d*)$/;function Et(t,e){var r=typeof t;return!!(e=null==e?Bt:e)&&("number"==r||"symbol"!=r&&Pt.test(t))&&t>-1&&t%1==0&&t<e}var Ft=9007199254740991;function Tt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=Ft}var It={};It["[object Float32Array]"]=It["[object Float64Array]"]=It["[object Int8Array]"]=It["[object Int16Array]"]=It["[object Int32Array]"]=It["[object Uint8Array]"]=It["[object Uint8ClampedArray]"]=It["[object Uint16Array]"]=It["[object Uint32Array]"]=!0,It["[object Arguments]"]=It["[object Array]"]=It["[object ArrayBuffer]"]=It["[object Boolean]"]=It["[object DataView]"]=It["[object Date]"]=It["[object Error]"]=It["[object Function]"]=It["[object Map]"]=It["[object Number]"]=It["[object Object]"]=It["[object RegExp]"]=It["[object Set]"]=It["[object String]"]=It["[object WeakMap]"]=!1;var Ct="object"==typeof exports&&exports&&!exports.nodeType&&exports,Mt=Ct&&"object"==typeof module&&module&&!module.nodeType&&module,Nt=Mt&&Mt.exports===Ct&&i.process,Ut=function(){try{var t=Mt&&Mt.require&&Mt.require("util").types;return t||Nt&&Nt.binding&&Nt.binding("util")}catch(t){}}(),Dt=Ut&&Ut.isTypedArray,Ht=Dt?function(t){return function(e){return t(e)}}(Dt):function(t){return g(t)&&Tt(t.length)&&!!It[b(t)]},Lt=Ht,Rt=Object.prototype.hasOwnProperty;function qt(t,e){var r=o(t),n=!r&&xt(t),i=!r&&!n&&$t(t),u=!r&&!n&&!i&&Lt(t),c=r||n||i||u,a=c?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],s=a.length;for(var f in t)!e&&!Rt.call(t,f)||c&&("length"==f||i&&("offset"==f||"parent"==f)||u&&("buffer"==f||"byteLength"==f||"byteOffset"==f)||Et(f,s))||a.push(f);return a}var Vt=Object.prototype;var Wt=function(t,e){return function(r){return t(e(r))}}(Object.keys,Object),Jt=Wt,Gt=Object.prototype.hasOwnProperty;function Kt(t){if(r=(e=t)&&e.constructor,e!==("function"==typeof r&&r.prototype||Vt))return Jt(t);var e,r,n=[];for(var o in Object(t))Gt.call(t,o)&&"constructor"!=o&&n.push(o);return n}function Xt(t){return null!=t&&Tt(t.length)&&!k(t)}function Yt(t){return Xt(t)?qt(t):Kt(t)}var Zt=function(t,e){return function(r,n){if(null==r)return r;if(!Xt(r))return t(r,n);for(var o=r.length,i=e?o:-1,u=Object(r);(e?i--:++i<o)&&!1!==n(u[i],i,u););return r}}((function(t,e){return t&&_t(t,e,Yt)})),Qt=Zt;function te(t){return t}function ee(t,e){var r;return(o(t)?bt:Qt)(t,"function"==typeof(r=e)?r:te)}var re=/\s/;var ne=/^\s+/;function oe(t){return t?t.slice(0,function(t){for(var e=t.length;e--&&re.test(t.charAt(e)););return e}(t)+1).replace(ne,""):t}var ie=NaN,ue=/^[-+]0x[0-9a-f]+$/i,ce=/^0b[01]+$/i,ae=/^0o[0-7]+$/i,se=parseInt;function fe(t){if("number"==typeof t)return t;if(j(t))return ie;if(O(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=O(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=oe(t);var r=ce.test(t);return r||ae.test(t)?se(t.slice(2),r?2:8):ue.test(t)?ie:+t}var le=1/0,pe=17976931348623157e292;function he(t){return t?(t=fe(t))===le||t===-le?(t<0?-1:1)*pe:t==t?t:0:0===t?t:0}function de(t){var e=he(t),r=e%1;return e==e?r?e-r:e:0}function ye(t){return"[object String]"===Object.prototype.toString.call(t)}function ve(t){return!(!ye(t)||""===t)}function be(t){return t!=t}function ge(t){let e=!1;if(ve(t))e=!isNaN(Number(t));else if(function(t){return"[object Number]"===Object.prototype.toString.call(t)}(t)){if(be(t))return!1;e=!0}return e}function _e(t){if(!ge(t))return 0;return he(t)}function je(t){return!!ge(t)&&(t=_e(t),"number"==typeof(e=t)&&e==de(e));var e}var we=c.isFinite,me=Math.min;var Oe=function(t){var e=Math[t];return function(t,r){if(t=fe(t),(r=null==r?0:me(de(r),292))&&we(t)){var n=(pt(t)+"e").split("e");return+((n=(pt(e(n[0]+"e"+(+n[1]+r)))+"e").split("e"))[0]+"e"+(+n[1]-r))}return e(t)}}("round"),Se=Oe;function xe(t){if(!ge(t))return 0;t=_e(t);let e=Se(t);return"0"===String(e)?0:e}let Ae="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),ze=Ae.length;function ke(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32,e=[];var r;t=je(r=t)&&xe(r)>0?xe(t):32;for(let r=0;r<t;r++)e[r]=Ae[0|Math.random()*ze];return e.join("")}var $e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Be(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Pe(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var r=function t(){if(this instanceof t){var r=[null];return r.push.apply(r,arguments),new(Function.bind.apply(e,r))}return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,n.get?n:{enumerable:!0,get:function(){return t[e]}})})),r}var Ee={exports:{}};var Fe,Te={exports:{}},Ie=Pe(Object.freeze({__proto__:null,default:{}}));function Ce(){return Fe||(Fe=1,function(t,e){var r;t.exports=(r=r||function(t,e){var r;if("undefined"!=typeof window&&window.crypto&&(r=window.crypto),"undefined"!=typeof self&&self.crypto&&(r=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(r=globalThis.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==$e&&$e.crypto&&(r=$e.crypto),!r)try{r=Ie}catch(t){}var n=function(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function t(){}return function(e){var r;return t.prototype=e,r=new t,t.prototype=null,r}}(),i={},u=i.lib={},c=u.Base={extend:function(t){var e=o(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},a=u.WordArray=c.extend({init:function(t,r){t=this.words=t||[],this.sigBytes=r!=e?r:4*t.length},toString:function(t){return(t||f).stringify(this)},concat:function(t){var e=this.words,r=t.words,n=this.sigBytes,o=t.sigBytes;if(this.clamp(),n%4)for(var i=0;i<o;i++){var u=r[i>>>2]>>>24-i%4*8&255;e[n+i>>>2]|=u<<24-(n+i)%4*8}else for(var c=0;c<o;c+=4)e[n+c>>>2]=r[c>>>2];return this.sigBytes+=o,this},clamp:function(){var e=this.words,r=this.sigBytes;e[r>>>2]&=4294967295<<32-r%4*8,e.length=t.ceil(r/4)},clone:function(){var t=c.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],r=0;r<t;r+=4)e.push(n());return new a.init(e,t)}}),s=i.enc={},f=s.Hex={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],o=0;o<r;o++){var i=e[o>>>2]>>>24-o%4*8&255;n.push((i>>>4).toString(16)),n.push((15&i).toString(16))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;n<e;n+=2)r[n>>>3]|=parseInt(t.substr(n,2),16)<<24-n%8*4;return new a.init(r,e/2)}},l=s.Latin1={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],o=0;o<r;o++){var i=e[o>>>2]>>>24-o%4*8&255;n.push(String.fromCharCode(i))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;n<e;n++)r[n>>>2]|=(255&t.charCodeAt(n))<<24-n%4*8;return new a.init(r,e)}},p=s.Utf8={stringify:function(t){try{return decodeURIComponent(escape(l.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return l.parse(unescape(encodeURIComponent(t)))}},h=u.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new a.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=p.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var r,n=this._data,o=n.words,i=n.sigBytes,u=this.blockSize,c=i/(4*u),s=(c=e?t.ceil(c):t.max((0|c)-this._minBufferSize,0))*u,f=t.min(4*s,i);if(s){for(var l=0;l<s;l+=u)this._doProcessBlock(o,l);r=o.splice(0,s),n.sigBytes-=f}return new a.init(r,f)},clone:function(){var t=c.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});u.Hasher=h.extend({cfg:c.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){h.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,r){return new t.init(r).finalize(e)}},_createHmacHelper:function(t){return function(e,r){return new d.HMAC.init(t,r).finalize(e)}}});var d=i.algo={};return i}(Math),r)}(Te)),Te.exports}!function(t,e){t.exports=Ce().enc.Utf8}(Ee);var Me=Be(Ee.exports),Ne={exports:{}};!function(t,e){var r;t.exports=(r=Ce(),function(){var t=r,e=t.lib.WordArray;function n(t,r,n){for(var o=[],i=0,u=0;u<r;u++)if(u%4){var c=n[t.charCodeAt(u-1)]<<u%4*2|n[t.charCodeAt(u)]>>>6-u%4*2;o[i>>>2]|=c<<24-i%4*8,i++}return e.create(o,i)}t.enc.Base64={stringify:function(t){var e=t.words,r=t.sigBytes,n=this._map;t.clamp();for(var o=[],i=0;i<r;i+=3)for(var u=(e[i>>>2]>>>24-i%4*8&255)<<16|(e[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|e[i+2>>>2]>>>24-(i+2)%4*8&255,c=0;c<4&&i+.75*c<r;c++)o.push(n.charAt(u>>>6*(3-c)&63));var a=n.charAt(64);if(a)for(;o.length%4;)o.push(a);return o.join("")},parse:function(t){var e=t.length,r=this._map,o=this._reverseMap;if(!o){o=this._reverseMap=[];for(var i=0;i<r.length;i++)o[r.charCodeAt(i)]=i}var u=r.charAt(64);if(u){var c=t.indexOf(u);-1!==c&&(e=c)}return n(t,e,o)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),r.enc.Base64)}(Ne);var Ue=Be(Ne.exports);function De(t){return"[object Array]"===Object.prototype.toString.call(t)}function He(t){return"[object Object]"===Object.prototype.toString.call(t)}function Le(t){return!!function(t){return"[object Undefined]"===Object.prototype.toString.call(t)}(t)||(!!function(t){return"[object Null]"===Object.prototype.toString.call(t)}(t)||(!!function(t){if(He(t)){for(let e in t)return!1;return!0}return!1}(t)||(!!function(t){return!(!ye(t)||""!==t)}(t)||(!!function(t){return!!De(t)&&0===t.length}(t)||!!be(t)))))}function Re(t){return!!De(t)&&(0!==t.length&&(1!==t.length||!Le(t[0])))}function qe(t){if(He(t)){for(let e in t)return!0;return!1}return!1}function Ve(t){if(!(ve(t)||ge(t)||j(t)||function(t){return"[object BigInt]"===Object.prototype.toString.call(t)}(t)))return"";let e="";try{e=String(t)}catch(t){}try{e=t.toString()}catch(t){}return e}function We(t){let e=vt(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},"fs");return!!function(t){let e=vt(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},"fs"),r=!1;try{e.statSync(t),r=!0}catch{r=!1}return r}(t,{fs:e})&&(!e.lstatSync(t).isDirectory()&&!e.lstatSync(t).isSymbolicLink())}function Je(t){return We(t,{fs:e})}function Ge(){let t,e,r=new Promise((function(){t=arguments[0],e=arguments[1]}));return r.resolve=t,r.reject=e,r}var Ke="[object Boolean]";function Xe(t){return!0===(e=t)||!1===e||g(e)&&b(e)==Ke;var e}function Ye(t){let e=Object.prototype.toString.call(t);return"[object Function]"===e||"[object AsyncFunction]"===e}function Ze(t){if(!je(t))return!1;return xe(t)>=0}function Qe(t){var e=this.__data__=new K(t);this.size=e.size}Qe.prototype.clear=function(){this.__data__=new K,this.size=0},Qe.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},Qe.prototype.get=function(t){return this.__data__.get(t)},Qe.prototype.has=function(t){return this.__data__.has(t)},Qe.prototype.set=function(t,e){var r=this.__data__;if(r instanceof K){var n=r.__data__;if(!X||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Z(n)}return r.set(t,e),this.size=r.size,this};function tr(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new Z;++e<r;)this.add(t[e])}function er(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}function rr(t,e){return t.has(e)}tr.prototype.add=tr.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},tr.prototype.has=function(t){return this.__data__.has(t)};var nr=1,or=2;function ir(t,e,r,n,o,i){var u=r&nr,c=t.length,a=e.length;if(c!=a&&!(u&&a>c))return!1;var s=i.get(t),f=i.get(e);if(s&&f)return s==e&&f==t;var l=-1,p=!0,h=r&or?new tr:void 0;for(i.set(t,e),i.set(e,t);++l<c;){var d=t[l],y=e[l];if(n)var v=u?n(y,d,l,e,t,i):n(d,y,l,t,e,i);if(void 0!==v){if(v)continue;p=!1;break}if(h){if(!er(e,(function(t,e){if(!rr(h,e)&&(d===t||o(d,t,r,n,i)))return h.push(e)}))){p=!1;break}}else if(d!==y&&!o(d,y,r,n,i)){p=!1;break}}return i.delete(t),i.delete(e),p}var ur=c.Uint8Array;function cr(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}function ar(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}var sr=1,fr=2,lr="[object Boolean]",pr="[object Date]",hr="[object Error]",dr="[object Map]",yr="[object Number]",vr="[object RegExp]",br="[object Set]",gr="[object String]",_r="[object Symbol]",jr="[object ArrayBuffer]",wr="[object DataView]",mr=a?a.prototype:void 0,Or=mr?mr.valueOf:void 0;var Sr=Object.prototype.propertyIsEnumerable,xr=Object.getOwnPropertySymbols,Ar=xr?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,i=[];++r<n;){var u=t[r];e(u,r,t)&&(i[o++]=u)}return i}(xr(t),(function(e){return Sr.call(t,e)})))}:function(){return[]},zr=Ar;function kr(t){return function(t,e,r){var n=e(t);return o(t)?n:function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}(n,r(t))}(t,Yt,zr)}var $r=1,Br=Object.prototype.hasOwnProperty;var Pr=H(c,"DataView"),Er=H(c,"Promise"),Fr=H(c,"Set"),Tr=H(c,"WeakMap"),Ir="[object Map]",Cr="[object Promise]",Mr="[object Set]",Nr="[object WeakMap]",Ur="[object DataView]",Dr=F(Pr),Hr=F(X),Lr=F(Er),Rr=F(Fr),qr=F(Tr),Vr=b;(Pr&&Vr(new Pr(new ArrayBuffer(1)))!=Ur||X&&Vr(new X)!=Ir||Er&&Vr(Er.resolve())!=Cr||Fr&&Vr(new Fr)!=Mr||Tr&&Vr(new Tr)!=Nr)&&(Vr=function(t){var e=b(t),r="[object Object]"==e?t.constructor:void 0,n=r?F(r):"";if(n)switch(n){case Dr:return Ur;case Hr:return Ir;case Lr:return Cr;case Rr:return Mr;case qr:return Nr}return e});var Wr=Vr,Jr=1,Gr="[object Arguments]",Kr="[object Array]",Xr="[object Object]",Yr=Object.prototype.hasOwnProperty;function Zr(t,e,r,n,i,u){var c=o(t),a=o(e),s=c?Kr:Wr(t),f=a?Kr:Wr(e),l=(s=s==Gr?Xr:s)==Xr,p=(f=f==Gr?Xr:f)==Xr,h=s==f;if(h&&$t(t)){if(!$t(e))return!1;c=!0,l=!1}if(h&&!l)return u||(u=new Qe),c||Lt(t)?ir(t,e,r,n,i,u):function(t,e,r,n,o,i,u){switch(r){case wr:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case jr:return!(t.byteLength!=e.byteLength||!i(new ur(t),new ur(e)));case lr:case pr:case yr:return W(+t,+e);case hr:return t.name==e.name&&t.message==e.message;case vr:case gr:return t==e+"";case dr:var c=cr;case br:var a=n&sr;if(c||(c=ar),t.size!=e.size&&!a)return!1;var s=u.get(t);if(s)return s==e;n|=fr,u.set(t,e);var f=ir(c(t),c(e),n,o,i,u);return u.delete(t),f;case _r:if(Or)return Or.call(t)==Or.call(e)}return!1}(t,e,s,r,n,i,u);if(!(r&Jr)){var d=l&&Yr.call(t,"__wrapped__"),y=p&&Yr.call(e,"__wrapped__");if(d||y){var v=d?t.value():t,b=y?e.value():e;return u||(u=new Qe),i(v,b,r,n,u)}}return!!h&&(u||(u=new Qe),function(t,e,r,n,o,i){var u=r&$r,c=kr(t),a=c.length;if(a!=kr(e).length&&!u)return!1;for(var s=a;s--;){var f=c[s];if(!(u?f in e:Br.call(e,f)))return!1}var l=i.get(t),p=i.get(e);if(l&&p)return l==e&&p==t;var h=!0;i.set(t,e),i.set(e,t);for(var d=u;++s<a;){var y=t[f=c[s]],v=e[f];if(n)var b=u?n(v,y,f,e,t,i):n(y,v,f,t,e,i);if(!(void 0===b?y===v||o(y,v,r,n,i):b)){h=!1;break}d||(d="constructor"==f)}if(h&&!d){var g=t.constructor,_=e.constructor;g==_||!("constructor"in t)||!("constructor"in e)||"function"==typeof g&&g instanceof g&&"function"==typeof _&&_ instanceof _||(h=!1)}return i.delete(t),i.delete(e),h}(t,e,r,n,i,u))}function Qr(t,e,r,n,o){return t===e||(null==t||null==e||!g(t)&&!g(e)?t!=t&&e!=e:Zr(t,e,r,n,Qr,o))}var tn=n,en=tn.spawn,rn=tn.exec;function nn(t,e,r){var n={};try{Object.keys(t).forEach((function(r){t[r].forEach((function(t){n[t]||(on(t,e),n[t]=1)})),n[r]||(on(r,e),n[r]=1)}))}catch(t){if(r)return r(t);throw t}if(r)return r()}function on(t,e){try{process.kill(parseInt(t,10),e)}catch(t){if("ESRCH"!==t.code)throw t}}function un(t,e,r,n,o){var i=n(t),u="";i.stdout.on("data",(function(t){t=t.toString("ascii");u+=t}));i.on("close",(function(i){delete r[t],0==i?u.match(/\d+/g).forEach((function(i){i=parseInt(i,10),e[t].push(i),e[i]=[],r[i]=1,un(i,e,r,n,o)})):0==Object.keys(r).length&&o()}))}var cn=Be((function(t,e,r){if("function"==typeof e&&void 0===r&&(r=e,e=void 0),t=parseInt(t),Number.isNaN(t)){if(r)return r(new Error("pid must be a number"));throw new Error("pid must be a number")}var n={},o={};switch(n[t]=[],o[t]=1,process.platform){case"win32":rn("taskkill /pid "+t+" /T /F",r);break;case"darwin":un(t,n,o,(function(t){return en("pgrep",["-P",t])}),(function(){nn(n,e,r)}));break;default:un(t,n,o,(function(t){return en("ps",["-o","pid","--no-headers","--ppid",t])}),(function(){nn(n,e,r)}))}}));function an(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!Re(e)&&!ve(e))throw new Error("args is not an effective array or string");ve(e)&&(e=[e]);let o=vt(r,"mode");"spawn"!==o&&"exec"!==o&&"execFile"!==o&&(o="spawn");let i=vt(r,"cbStdout"),u=vt(r,"cbStderr"),c=vt(r,"codeCmd");ve(c)||(c="utf8");let a=vt(r,"useChcp");Xe(a)||(a=!1);let s=vt(r,"timeout");(!ge(s)||s<=0)&&(s=null);let f=Ge();if(!function(t,e){function r(t){return De(t)?t:[t]}if(Le(t))return!1;if(0===(t=r(t)).length)return!1;if(Le(t))return!1;if(0===(e=r(e)).length)return!1;for(let r=0;r<t.length;r++)for(let i=0;i<e.length;i++)if(n=t[r],o=e[i],Qr(n,o))return!0;var n,o;return!1}(o,["spawn","exec","execFile"]))return f.reject(`invalid mode[${o}]`),f;let l=null,p="";try{if("spawn"===o){let r=(d=1,ve(h=t)&&Ze(d)?0===(d=xe(d))?"":h.substring(0,d):""),o=function(t,e){if(!ve(t))return"";if(!Ze(e))return"";if(0===(e=xe(e)))return"";let r=t.length-e;return r<0&&(r=0),t.substring(r,r+e)}(t,1);if('"'===r||'"'===o||"'"===r||"'"===o)throw new Error("prog of spawn doens not need to add quotes");l=n.spawn(t,e,{windowsHide:!0,shell:!1})}else if("exec"===o){let r="";a&&(r="cmd /c chcp 65001>nul &&"),l=n.exec(`${r} ${t} ${e.join(" ")} & exit`,{windowsHide:!0,encoding:c})}else"execFile"===o&&(l=n.execFile(t,e,{windowsHide:!0,encoding:c}))}catch(t){return f.reject(t),f}var h,d;l.stdout.on("data",(t=>{let e="";e="spawn"===o?t.toString(c):t.toString(),p+=e+"\n",Ye(i)&&i(e)})),l.stderr.on("data",(t=>{let e="";e="spawn"===o?t.toString(c):t.toString(),p+=e+"\n",Ye(u)&&u(e)}));let y=null,v=!1;return null!==s&&(y=setTimeout((()=>{v=!0,l&&l.pid&&function(t){let e=Ge();return cn(Number(t),"SIGKILL",(r=>{r?e.reject(r):e.resolve(`pid[${t}] killed`)})),e}(l.pid).catch((()=>{}))}),s)),l.on("close",(t=>{null!==y&&clearTimeout(y),v?f.reject(`timeout[${s}ms]:\n${p}`):0!==t?f.reject(`code[${t}]:\n${p}`):f.resolve(p)})),l.on("error",(t=>{null!==y&&clearTimeout(y),f.reject(t)})),f}let sn=t.resolve();return async function(t,n){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=null;if("win32"!==r.platform)return Promise.reject("operating system is not windows");if(!Re(t))return Promise.reject("psSrc is not an array");if(!qe(n)&&!Re(n))return Promise.reject("psTar is not an object or array");let u=qe(n);u&&(n=[n]);let c=vt(o,"keyX");ve(c)||(c="x");let a=vt(o,"keyY");ve(a)||(a="y");let s=vt(o,"keyZ");ve(s)||(s="z");let f=vt(o,"keyV");ve(f)||(f="v");let l=t=>{let e=vt(t,c,""),r=vt(t,0,""),n=vt(t,a,""),o=vt(t,1,""),i=vt(t,s,""),u=vt(t,2,""),l=vt(t,f,""),p=vt(t,3,""),h=ge(e),d=ge(n),y=ge(i),v=ge(l);return e=h?_e(e):ge(r)?_e(r):null,n=d?_e(n):ge(o)?_e(o):null,i=y?_e(i):ge(u)?_e(u):null,l=v?_e(l):ge(p)?_e(p):null,{x:e,y:n,z:i,v:l}},p="2d";{let e=vt(t,0,{}),r=l(e);null!==r.x&&null!==r.y&&null!==r.z&&null!==r.v&&(p="3d")}let h=[];ee(t,(t=>{let e=l(t);"2d"===p?h.push([e.x,e.y,e.z]):h.push([e.x,e.y,e.z,e.v])}));let d=[];ee(n,(t=>{let e=l(t);"2d"===p?d.push([e.x,e.y]):d.push([e.x,e.y,e.z])}));let y=vt(o,"variogram_model","");ve(y)||(y="exponential");let v=vt(o,"nlags","");ge(v)||(v=9),v=xe(v);let b="kriging.exe",g="";{let t=`${sn}/src/`,e=`${sn}/node_modules/w-kriging/src/`;if(Je(`${t}${b}`))g=t;else{if(!Je(`${e}${b}`))return Promise.reject("can not find folder for kriging");g=e}}let _=`${g}${b}`,j=ke(),w=`${g}_${j}_fpIn.json`,m=`${g}_${j}_fpOut.json`,O={src:h,pred:d};e.writeFileSync(w,JSON.stringify(O),"utf8");let S={fpIn:w,fpOut:m,opt:{variogram_model:y,nlags:v}},x=function(t){if(!ve(t))return"";let e=Me.parse(t);return Ue.stringify(e)}(JSON.stringify(S));await an(_,x).catch((t=>{console.log("execProcess catch",t),i=t.toString()}));let A=null;try{let t=e.readFileSync(m,"utf8");A=function(t){if(!ve(t))return{};let e={};try{e=JSON.parse(t)}catch(t){e={}}return e}(t)}catch(t){}try{e.unlinkSync(w)}catch(t){}try{e.unlinkSync(m)}catch(t){}if(i)return Promise.reject(i);if(!De(A))return Promise.reject(`output[${Ve(A)}] is not an array`);let z=[];return ee(d,((t,e)=>{let r=vt(A,e,null);"2d"===p?z.push({[c]:t[0],[a]:t[1],[s]:r}):z.push({[c]:t[0],[a]:t[1],[s]:t[2],[f]:r})})),u&&(z=z[0]),z}}));
//# sourceMappingURL=w-kriging.umd.js.map