/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/@smartlyio/safe-navigation@5.1.1/dist/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const _=require("lodash"),noValue=Symbol;function hasPath(e,t){if(0===t.length)return e;const a=_.get(e,t);return null==a?noValue:a}function set(e,t,a){return hasPath(e,t)===noValue?e:0===t.length?a:_.set(clonePath(e,t),t,a)}function clonePath(e,t){let a=_.clone(e);const n=a;let r=0;for(;r<t.length&&(Array.isArray(a)||_.isObject(a));){const e=a[t[r]];if(a[t[r]]=_.clone(e),!e||!Array.isArray(e)&&!_.isObject(e))break;a=a[t[r]],r++}return n}function _safe(e){return new Proxy(e,{get(e,t){if("$"===t){const t=hasPath(e.value,e.path);return t===noValue?void 0:t}return"$set"===t?t=>set(e.value,e.path,t):"$map"===t?t=>{const a=hasPath(e.value,e.path);return a===noValue?e.value:set(e.value,e.path,t(a))}:"$pmap"===t?async t=>{const a=hasPath(e.value,e.path);return a===noValue?e.value:set(e.value,e.path,await t(a))}:_safe({value:e.value,path:[...e.path,t]})}})}function safe(e){return _safe({value:e,path:[]})}exports.default=safe;
//# sourceMappingURL=/sm/c3bbf7d48bf68a35ae531a8498ee979a9856540658434274b1ef6ac9283a64d5.map