PageSourceSearch

https://astenflow.com.br/assets/fast-json-patch-2Vrxhmch.js

js astenflow.com.br collected 2026-10-06 04:47:17 UTC 10,654 bytes, 10 lines download raw bytes

vendor: 10,654 bytes, lines 1-10
1/*!
2 * https://github.com/Starcounter-Jack/JSON-Patch
3 * (c) 2017-2022 Joachim Wester
4 * MIT licensed
5 */var J=function(){var e=function(r,t){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,f){n.__proto__=f}||function(n,f){for(var i in f)f.hasOwnProperty(i)&&(n[i]=f[i])},e(r,t)};return function(r,t){e(r,t);function n(){this.constructor=r}r.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),H=Object.prototype.hasOwnProperty;function N(e,r){return H.call(e,r)}function g(e){if(Array.isArray(e)){for(var r=new Array(e.length),t=0;t<r.length;t++)r[t]=""+t;return r}if(Object.keys)return Object.keys(e);var n=[];for(var f in e)N(e,f)&&n.push(f);return n}function h(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function P(e){for(var r=0,t=e.length,n;r<t;){if(n=e.charCodeAt(r),n>=48&&n<=57){r++;continue}return!1}return!0}function w(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function U(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function R(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var r=0,t=e.length;r<t;r++)if(R(e[r]))return!0}else if(typeof e=="object"){for(var n=g(e),f=n.length,i=0;i<f;i++)if(R(e[n[i]]))return!0}}return!1}function S(e,r){var t=[e];for(var n in r){var f=typeof r[n]=="object"?JSON.stringify(r[n],null,2):r[n];typeof f<"u"&&t.push(n+": "+f)}return t.join(`
6`)}var M=function(e){J(r,e);function r(t,n,f,i,s){var o=this.constructor,v=e.call(this,S(t,{name:n,index:f,operation:i,tree:s}))||this;return v.name=n,v.index=f,v.operation=i,v.tree=s,Object.setPrototypeOf(v,o.prototype),v.message=S(t,{name:n,index:f,operation:i,tree:s}),v}return r}(Error),a=M,B=h,_={add:function(e,r,t){return e[r]=this.value,{newDocument:t}},remove:function(e,r,t){var n=e[r];return delete e[r],{newDocument:t,removed:n}},replace:function(e,r,t){var n=e[r];return e[r]=this.value,{newDocument:t,removed:n}},move:function(e,r,t){var n=E(t,this.path);n&&(n=h(n));var f=O(t,{op:"remove",path:this.from}).removed;return O(t,{op:"add",path:this.path,value:f}),{newDocument:t,removed:n}},copy:function(e,r,t){var n=E(t,this.from);return O(t,{op:"add",path:this.path,value:h(n)}),{newDocument:t}},test:function(e,r,t){return{newDocument:t,test:d(e[r],this.value)}},_get:function(e,r,t){return this.value=e[r],{newDocument:t}}},F={add:function(e,r,t){return P(r)?e.splice(r,0,this.value):e[r]=this.value,{newDocument:t,index:r}},remove:function(e,r,t){var n=e.splice(r,1);return{newDocument:t,removed:n[0]}},replace:function(e,r,t){var n=e[r];return e[r]=this.value,{newDocument:t,removed:n}},move:_.move,copy:_.copy,test:_.test,_get:_._get};function E(e,r){if(r=="")return e;var t={op:"_get",path:r};return O(e,t),t.value}function O(e,r,t,n,f,i){if(t===void 0&&(t=!1),n===void 0&&(n=!0),f===void 0&&(f=!0),i===void 0&&(i=0),t&&(typeof t=="function"?t(r,0,e,r.path):y(r,0)),r.path===""){var s={newDocument:e};if(r.op==="add")return s.newDocument=r.value,s;if(r.op==="replace")return s.newDocument=r.value,s.removed=e,s;if(r.op==="move"||r.op==="copy")return s.newDocument=E(e,r.from),r.op==="move"&&(s.removed=e),s;if(r.op==="test"){if(s.test=d(e,r.value),s.test===!1)throw new a("Test operation failed","TEST_OPERATION_FAILED",i,r,e);return s.newDocument=e,s}else{if(r.op==="remove")return s.removed=e,s.newDocument=null,s;if(r.op==="_get")return r.value=e,s;if(t)throw new a("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,r,e);return s}}else{n||(e=h(e));var o=r.path||"",v=o.split("/"),u=e,p=1,c=v.length,A=void 0,l=void 0,T=void 0;for(typeof t=="function"?T=t:T=y;;){if(l=v[p],l&&l.indexOf("~")!=-1&&(l=U(l)),f&&(l=="__proto__"||l=="prototype"&&p>0&&v[p-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(t&&A===void 0&&(u[l]===void 0?A=v.slice(0,p).join("/"):p==c-1&&(A=r.path),A!==void 0&&T(r,0,e,A)),p++,Array.isArray(u)){if(l==="-")l=u.length;else{if(t&&!P(l))throw new a("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",i,r,e);P(l)&&(l=~~l)}if(p>=c){if(t&&r.op==="add"&&l>u.length)throw new a("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,r,e);var s=F[r.op].call(r,u,l,e);if(s.test===!1)throw new a("Test operation failed","TEST_OPERATION_FAILED",i,r,e);return s}}else if(p>=c){var s=_[r.op].call(r,u,l,e);if(s.test===!1)throw new a("Test operation failed","TEST_OPERATION_FAILED",i,r,e);return s}if(u=u[l],t&&p<c&&(!u||typeof u!="object"))throw new a("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,r,e)}}}function D(e,r,t,n,f){if(n===void 0&&(n=!0),f===void 0&&(f=!0),t&&!Array.isArray(r))throw new a("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=h(e));for(var i=new Array(r.length),s=0,o=r.length;s<o;s++)i[s]=O(e,r[s],t,!0,f,s),e=i[s].newDocument;return i.newDocument=e,i}function Q(e,r,t){var n=O(e,r);if(n.test===!1)throw new a("Test operation failed","TEST_OPERATION_FAILED",t,r,e);return n.newDocument}function y(e,r,t,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new a("Operation is not an object","OPERATION_NOT_AN_OBJECT",r,e,t);if(_[e.op]){if(typeof e.path!="string")throw new a("Operation `path` property is not a string","OPERATION_PATH_INVALID",r,e,t);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new a('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",r,e,t);if((e.op==="move"||e.op==="copy")&&typeof e.from!="string")throw new a("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",r,e,t);if((e.op==="add"||e.op==="replace"||e.op==="test")&&e.value===void 0)throw new a("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",r,e,t);if((e.op==="add"||e.op==="replace"||e.op==="test")&&R(e.value))throw new a("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",r,e,t);if(t){if(e.op=="add"){var f=e.path.split("/").length,i=n.split("/").length;if(f!==i+1&&f!==i)throw new a("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",r,e,t)}else if(e.op==="replace"||e.op==="remove"||e.op==="_get"){if(e.path!==n)throw new a("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",r,e,t)}else if(e.op==="move"||e.op==="copy"){var s={op:"_get",path:e.from,value:void 0},o=C([s],t);if(o&&o.name==="OPERATION_PATH_UNRESOLVABLE")throw new a("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",r,e,t)}}}else throw new a("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",r,e,t)}function C(e,r,t){try{if(!Array.isArray(e))throw new a("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(r)D(h(r),h(e),t||!0);else{t=t||y;for(var n=0;n<e.length;n++)t(e[n],n,r,void 0)}}catch(f){if(f instanceof a)return f;throw f}}function d(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){var t=Array.isArray(e),n=Array.isArray(r),f,i,s;if(t&&n){if(i=e.length,i!=r.length)return!1;for(f=i;f--!==0;)if(!d(e[f],r[f]))return!1;return!0}if(t!=n)return!1;var o=Object.keys(e);if(i=o.length,i!==Object.keys(r).length)return!1;for(f=i;f--!==0;)if(!r.hasOwnProperty(o[f]))return!1;for(f=i;f--!==0;)if(s=o[f],!d(e[s],r[s]))return!1;return!0}return e!==e&&r!==r}const z=Object.freeze(Object.defineProperty({__proto__:null,JsonPatchError:a,_areEquals:d,applyOperation:O,applyPatch:D,applyReducer:Q,deepClone:B,getValueByPointer:E,validate:C,validator:y},Symbol.toStringTag,{value:"Module"}));/*!
7 * https://github.com/Starcounter-Jack/JSON-Patch
8 * (c) 2017-2021 Joachim Wester
9 * MIT license
10 */var L=new WeakMap,Y=function(){function e(r){this.observers=new Map,this.obj=r}return e}(),K=function(){function e(r,t){this.callback=r,this.observer=t}return e}();function G(e){return L.get(e)}function W(e,r){return e.observers.get(r)}function X(e,r){e.observers.delete(r.callback)}function q(e,r){r.unobserve()}function Z(e,r){var t=[],n,f=G(e);if(!f)f=new Y(e),L.set(e,f);else{var i=W(f,r);n=i&&i.observer}if(n)return n;if(n={},f.value=h(e),r){n.callback=r,n.next=null;var s=function(){I(n)},o=function(){clearTimeout(n.next),n.next=setTimeout(s)};typeof window<"u"&&(window.addEventListener("mouseup",o),window.addEventListener("keyup",o),window.addEventListener("mousedown",o),window.addEventListener("keydown",o),window.addEventListener("change",o))}return n.patches=t,n.object=e,n.unobserve=function(){I(n),clearTimeout(n.next),X(f,n),typeof window<"u"&&(window.removeEventListener("mouseup",o),window.removeEventListener("keyup",o),window.removeEventListener("mousedown",o),window.removeEventListener("keydown",o),window.removeEventListener("change",o))},f.observers.set(r,new K(r,n)),n}function I(e,r){r===void 0&&(r=!1);var t=L.get(e.object);m(t.value,e.object,e.patches,"",r),e.patches.length&&D(t.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function m(e,r,t,n,f){if(r!==e){typeof r.toJSON=="function"&&(r=r.toJSON());for(var i=g(r),s=g(e),o=!1,v=s.length-1;v>=0;v--){var u=s[v],p=e[u];if(N(r,u)&&!(r[u]===void 0&&p!==void 0&&Array.isArray(r)===!1)){var c=r[u];typeof p=="object"&&p!=null&&typeof c=="object"&&c!=null&&Array.isArray(p)===Array.isArray(c)?m(p,c,t,n+"/"+w(u),f):p!==c&&(f&&t.push({op:"test",path:n+"/"+w(u),value:h(p)}),t.push({op:"replace",path:n+"/"+w(u),value:h(c)}))}else Array.isArray(e)===Array.isArray(r)?(f&&t.push({op:"test",path:n+"/"+w(u),value:h(p)}),t.push({op:"remove",path:n+"/"+w(u)}),o=!0):(f&&t.push({op:"test",path:n,value:e}),t.push({op:"replace",path:n,value:r}))}if(!(!o&&i.length==s.length))for(var v=0;v<i.length;v++){var u=i[v];!N(e,u)&&r[u]!==void 0&&t.push({op:"add",path:n+"/"+w(u),value:h(r[u])})}}}function $(e,r,t){t===void 0&&(t=!1);var n=[];return m(e,r,n,"",t),n}const x=Object.freeze(Object.defineProperty({__proto__:null,compare:$,generate:I,observe:Z,unobserve:q},Symbol.toStringTag,{value:"Module"}));Object.assign({},z,x,{JsonPatchError:M,deepClone:h,escapePathComponent:w,unescapePathComponent:U});export{D as a,E as g};

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.