/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/jscalpel@2.0.0/dist/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).jscalpel={})}(this,(function(t){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function n(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var r=Object.prototype.toString,a=function(t){return"[object Object]"===r.call(t)},o=function t(e){var n={},a=[];return"[object Object]"===r.call(e)?(Object.keys(e).forEach((function(o,u){Array.isArray(e[o])?(e[o].forEach((function(t,e){a.push(t)})),n[o]=a,a=[]):r.call("[object Object]"===e[o])&&(n[o]=t(e[o]))})),n):e},u=function(){function t(e){var n=e.target,r=e.returnedValue,a=e.error;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._target=n,this._error=a,this._returnedValue=r}var e,o,u;return e=t,o=[{key:"_getValueByPath",value:function(t){for(var e=void 0,n=this._target,r=this._fallbackpath(t).split("."),a=0,o=r.length;a<o;a++)try{e=e?e[r[a]]:n[r[a]]}catch(t){return}return e}},{key:"_getValue",value:function(t){var e=void 0;this._target;var n=[],a=this;return"string"==typeof t&&t.length>0?this._getValueByPath(t):"[object Array]"===r.call(t)?(t.forEach((function(t,r){"string"==typeof t&&(e=a._getValueByPath(t),n.push(e))})),0===n.length?null:n):null}},{key:"get",value:function(t){return t?this._getValueByPath(t):this._returnedValue}},{key:"_fallbackpath",value:function(t){return"string"!=typeof t?"":t.replace(/\s/g,"")}},{key:"_extend",value:function(t,e){if(a(t))for(var n=t,r=e.split("."),o=r.length,u=0;u<o;u++)void 0===n[r[u]]&&(n[r[u]]={}),n=(arguments.length<=2?0:arguments.length-2)>0&&u===o-1?n[r[u]]=arguments.length<=2?void 0:arguments[2]:n[r[u]]}},{key:"_setOrDel",value:function(t,e){var n=this._fallbackpath(t);""!==n?this._extend(this._target,n,e):"function"==typeof this._error&&this._error(this._target,t)}},{key:"set",value:function(t,e){var n=this;a(t)?Object.keys(t).forEach((function(e,r){n._setOrDel(e,t[e])})):this._setOrDel(t,e)}},{key:"has",value:function(t){return!!this._getValueByPath(t)}},{key:"del",value:function(t){var e=this;t&&(Array.isArray(t)?t.forEach((function(t,n){e._setOrDel(t,void 0)})):e._setOrDel(t,void 0))}}],o&&n(e.prototype,o),u&&n(e,u),t}(),c=function(t,e){var n=t.target,a=t.path,c=t.keys,i=t.dynamicKeys,l=t.prefix,f=t.callback,s=t.success,y=t.deep,p=t.plugins,h=t.error,g=s||f,v=!!l,d=function(t){var e=t.path,n=t.target;t.plugins,t.index;for(var r=n,a=function(t){return"".concat(l&&v?"".concat(l,".").concat(t):"".concat(t))}(e).split("."),o=0,u=a.length;o<u;o++)try{r=r[a[o]]}catch(t){return}return r},b=function(t){var e=t.plugins,n=t.name,r={value:t.value,name:n};e&&Array.isArray(e)&&e.length&&e.forEach((function(t,e){t(r)}))},_=void 0,m=void 0,j=function(t){var e=null;try{if(e="string"==typeof t?JSON.parse(t):t,y&&(e=o(e)),"[object Object]"!==r.call(e)&&!Array.isArray(e))return void("function"==typeof h&&h(e))}catch(t){return void("function"==typeof h&&h(e,t))}return e}(n),O=[],k=g?function(t){var e=t.toString().replace(/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm,"").replace(/=>.*$/gm,"").replace(/=[^,]+/gm,""),n=e.slice(e.indexOf("(")+1,e.indexOf(")")).match(/([^\s,]+)/g);return null===n?[]:n}(g):[];return a=function(t){var e=t.path,n=void 0===e?"":e,r=t.keys,a=t.dynamicKeys;return r||"function"==typeof a?n=r||a(l):"function"==typeof n&&(n=n(l)),n}({path:a,keys:c,dynamicKeys:i}),"string"==typeof a&&a.length>0?(m=d({path:a,target:n}),b({plugins:p,name:k[0],value:m}),_=g&&"function"==typeof g?g.call(null,m,j,a,e):g):"[object Array]"===r.call(a)&&(a.forEach((function(t,e){"string"==typeof t&&(m=d({path:t,target:n}),b({plugins:p,value:m,name:k[e]}),O.push(m)),m=void 0})),O.push(j,a,e),_=g&&"function"==typeof g?g.apply(null,O):g),"function"==typeof f||"function"==typeof s?_:new u({target:j,error:h})};t.default=c,t.get=function(t,e,n){var r=c({target:t}).get(e);return void 0===r?n:r},t.jscalpelLogic=function(t){return function(e){var n=e.value,r=e.name;return t[r]&&c({target:t,prefix:"".concat(r),path:["match","success"],callback:function(t,e){return t({value:n,name:r})&&e({value:n,name:r}),n}}),n}},t.jscalpelORM=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;if(!a(t))return console.error("source为".concat(t,",不是对象")),n;if(!a(e))return console.error("rules为".concat(e,",不是对象")),n;try{var r=Object.keys(e),o=e._extraInfo||{},u={},i=c({target:u}),l=c({target:t});return r.forEach((function(t,n){"_extraInfo"!==t&&i.set(t,void 0===l.get(t)?l.get(e[t]):l.get(t))})),Object.assign(u,o)}catch(t){return console.error("请检查source和rules配置，两者都必须为对象!"),n}},t.jscalpelType=function(t){var n=t.value,r=t.name;return-1!==["string","undefined","function","number","boolean"].indexOf(e(n))?{value:n,type:e(n)}:n+""=="null"?{value:n,type:"null"}:Array.isArray(n)?{value:n,type:"array",length:n.length}:"[object Object]"===Object.prototype.toString.call(n)?{value:n,name:r,type:"object",keys:Object.keys(n),values:Object.values(n)}:void 0},t.set=function(t,e,n){return c({target:t}).set(e,n)},t.toCopy=o,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=/sm/dd7e84e5fa57fe015c462b9f00afac5bdc3c32fcbf5e1f1360e63704005b3d90.map