WordPress/wp-includes/js/dist/vendor/wp-polyfill-formdata.min.js
gziolo 2ec4c366e6 Build: Update webpack to v5.x
Update webpack version to latest version https://www.npmjs.com/package/webpack. This aligns closer with how the Gutenberg plugin handles WordPress packages. Related update in Gutenberg from August 2021: https://github.com/WordPress/gutenberg/pull/33818.

Props walbo, desrosj, mukesh27.
Fixes #51750.



Built from https://develop.svn.wordpress.org/trunk@53135


git-svn-id: http://core.svn.wordpress.org/trunk@52724 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-11 12:04:30 +00:00

1 line
8.3 KiB
JavaScript

!function(){var t;function e(t){var e=0;return function(){return e<t.length?{done:!1,value:t[e++]}:{done:!0}}}var n="function"==typeof Object.defineProperties?Object.defineProperty:function(t,e,n){return t==Array.prototype||t==Object.prototype||(t[e]=n.value),t};var r,o=function(t){t=["object"==typeof globalThis&&globalThis,t,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var e=0;e<t.length;++e){var n=t[e];if(n&&n.Math==Math)return n}throw Error("Cannot find global object")}(this);function i(t,e){if(e)t:{for(var r=o,i=t.split("."),a=0;a<i.length-1;a++){var u=i[a];if(!(u in r))break t;r=r[u]}(u=e(a=r[i=i[i.length-1]]))!=a&&null!=u&&n(r,i,{configurable:!0,writable:!0,value:u})}}function a(t){return(t={next:t})[Symbol.iterator]=function(){return this},t}function u(t){var n="undefined"!=typeof Symbol&&Symbol.iterator&&t[Symbol.iterator];return n?n.call(t):{next:e(t)}}if(i("Symbol",(function(t){function e(t,e){this.A=t,n(this,"description",{configurable:!0,writable:!0,value:e})}if(t)return t;e.prototype.toString=function(){return this.A};var r="jscomp_symbol_"+(1e9*Math.random()>>>0)+"_",o=0;return function t(n){if(this instanceof t)throw new TypeError("Symbol is not a constructor");return new e(r+(n||"")+"_"+o++,n)}})),i("Symbol.iterator",(function(t){if(t)return t;t=Symbol("Symbol.iterator");for(var r="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),i=0;i<r.length;i++){var u=o[r[i]];"function"==typeof u&&"function"!=typeof u.prototype[t]&&n(u.prototype,t,{configurable:!0,writable:!0,value:function(){return a(e(this))}})}return t})),"function"==typeof Object.setPrototypeOf)r=Object.setPrototypeOf;else{var l;t:{var s={};try{s.__proto__={a:!0},l=s.a;break t}catch(t){}l=!1}r=l?function(t,e){if(t.__proto__=e,t.__proto__!==e)throw new TypeError(t+" is not extensible");return t}:null}var f=r;function c(){this.m=!1,this.j=null,this.v=void 0,this.h=1,this.u=this.C=0,this.l=null}function h(t){if(t.m)throw new TypeError("Generator is already running");t.m=!0}function p(t,e){return t.h=3,{value:e}}function y(t){this.g=new c,this.G=t}function v(t,e,n,r){try{var o=e.call(t.g.j,n);if(!(o instanceof Object))throw new TypeError("Iterator result "+o+" is not an object");if(!o.done)return t.g.m=!1,o;var i=o.value}catch(e){return t.g.j=null,t.g.s(e),d(t)}return t.g.j=null,r.call(t.g,i),d(t)}function d(t){for(;t.g.h;)try{var e=t.G(t.g);if(e)return t.g.m=!1,{value:e.value,done:!1}}catch(e){t.g.v=void 0,t.g.s(e)}if(t.g.m=!1,t.g.l){if(e=t.g.l,t.g.l=null,e.F)throw e.D;return{value:e.return,done:!0}}return{value:void 0,done:!0}}function b(t){this.next=function(e){return t.o(e)},this.throw=function(e){return t.s(e)},this.return=function(e){return function(t,e){h(t.g);var n=t.g.j;return n?v(t,"return"in n?n.return:function(t){return{value:t,done:!0}},e,t.g.return):(t.g.return(e),d(t))}(t,e)},this[Symbol.iterator]=function(){return this}}function g(t,e){var n=new b(new y(e));return f&&t.prototype&&f(n,t.prototype),n}if(c.prototype.o=function(t){this.v=t},c.prototype.s=function(t){this.l={D:t,F:!0},this.h=this.C||this.u},c.prototype.return=function(t){this.l={return:t},this.h=this.u},y.prototype.o=function(t){return h(this.g),this.g.j?v(this,this.g.j.next,t,this.g.o):(this.g.o(t),d(this))},y.prototype.s=function(t){return h(this.g),this.g.j?v(this,this.g.j.throw,t,this.g.o):(this.g.s(t),d(this))},"undefined"!=typeof Blob&&("undefined"==typeof FormData||!FormData.prototype.keys)){var m=function(t,e){for(var n=0;n<t.length;n++)e(t[n])},w=function(t,e,n){return e instanceof Blob?[String(t),e,void 0!==n?n+"":"string"==typeof e.name?e.name:"blob"]:[String(t),String(e)]},S=function(t,e){if(t.length<e)throw new TypeError(e+" argument required, but only "+t.length+" present.")},j=function(t){var e=u(t);t=e.next().value;var n=e.next().value;return e=e.next().value,n instanceof Blob&&(n=new File([n],e,{type:n.type,lastModified:n.lastModified})),[t,n]},x="object"==typeof globalThis?globalThis:"object"==typeof window?window:"object"==typeof self?self:this,_=x.FormData,F=x.XMLHttpRequest&&x.XMLHttpRequest.prototype.send,M=x.Request&&x.fetch,A=x.navigator&&x.navigator.sendBeacon,D=x.Element&&x.Element.prototype,B=x.Symbol&&Symbol.toStringTag;B&&(Blob.prototype[B]||(Blob.prototype[B]="Blob"),"File"in x&&!File.prototype[B]&&(File.prototype[B]="File"));try{new File([],"")}catch(t){x.File=function(t,e,n){return t=new Blob(t,n),n=n&&void 0!==n.lastModified?new Date(n.lastModified):new Date,Object.defineProperties(t,{name:{value:e},lastModifiedDate:{value:n},lastModified:{value:+n},toString:{value:function(){return"[object File]"}}}),B&&Object.defineProperty(t,B,{value:"File"}),t}}var T=function(t){this.i=[];var e=this;t&&m(t.elements,(function(t){if(t.name&&!t.disabled&&"submit"!==t.type&&"button"!==t.type&&!t.matches("form fieldset[disabled] *"))if("file"===t.type){var n=t.files&&t.files.length?t.files:[new File([],"",{type:"application/octet-stream"})];m(n,(function(n){e.append(t.name,n)}))}else"select-multiple"===t.type||"select-one"===t.type?m(t.options,(function(n){!n.disabled&&n.selected&&e.append(t.name,n.value)})):"checkbox"===t.type||"radio"===t.type?t.checked&&e.append(t.name,t.value):(n="textarea"===t.type?t.value.replace(/\r\n/g,"\n").replace(/\n/g,"\r\n"):t.value,e.append(t.name,n))}))};if((t=T.prototype).append=function(t,e,n){S(arguments,2),this.i.push(w(t,e,n))},t.delete=function(t){S(arguments,1);var e=[];t=String(t),m(this.i,(function(n){n[0]!==t&&e.push(n)})),this.i=e},t.entries=function t(){var e,n=this;return g(t,(function(t){if(1==t.h&&(e=0),3!=t.h)return e<n.i.length?t=p(t,j(n.i[e])):(t.h=0,t=void 0),t;e++,t.h=2}))},t.forEach=function(t,e){S(arguments,1);for(var n=u(this),r=n.next();!r.done;r=n.next()){var o=u(r.value);r=o.next().value,o=o.next().value,t.call(e,o,r,this)}},t.get=function(t){S(arguments,1);var e=this.i;t=String(t);for(var n=0;n<e.length;n++)if(e[n][0]===t)return j(e[n])[1];return null},t.getAll=function(t){S(arguments,1);var e=[];return t=String(t),m(this.i,(function(n){n[0]===t&&e.push(j(n)[1])})),e},t.has=function(t){S(arguments,1),t=String(t);for(var e=0;e<this.i.length;e++)if(this.i[e][0]===t)return!0;return!1},t.keys=function t(){var e,n,r,o,i=this;return g(t,(function(t){if(1==t.h&&(e=u(i),n=e.next()),3!=t.h)return n.done?void(t.h=0):(r=n.value,o=u(r),p(t,o.next().value));n=e.next(),t.h=2}))},t.set=function(t,e,n){S(arguments,2),t=String(t);var r=[],o=w(t,e,n),i=!0;m(this.i,(function(e){e[0]===t?i&&(i=!r.push(o)):r.push(e)})),i&&r.push(o),this.i=r},t.values=function t(){var e,n,r,o,i=this;return g(t,(function(t){if(1==t.h&&(e=u(i),n=e.next()),3!=t.h)return n.done?void(t.h=0):(r=n.value,(o=u(r)).next(),p(t,o.next().value));n=e.next(),t.h=2}))},T.prototype._asNative=function(){for(var t=new _,e=u(this),n=e.next();!n.done;n=e.next()){var r=u(n.value);n=r.next().value,r=r.next().value,t.append(n,r)}return t},T.prototype._blob=function(){for(var t="----formdata-polyfill-"+Math.random(),e=[],n=u(this),r=n.next();!r.done;r=n.next()){var o=u(r.value);r=o.next().value,o=o.next().value,e.push("--"+t+"\r\n"),o instanceof Blob?e.push('Content-Disposition: form-data; name="'+r+'"; filename="'+o.name+'"\r\nContent-Type: '+(o.type||"application/octet-stream")+"\r\n\r\n",o,"\r\n"):e.push('Content-Disposition: form-data; name="'+r+'"\r\n\r\n'+o+"\r\n")}return e.push("--"+t+"--"),new Blob(e,{type:"multipart/form-data; boundary="+t})},T.prototype[Symbol.iterator]=function(){return this.entries()},T.prototype.toString=function(){return"[object FormData]"},D&&!D.matches&&(D.matches=D.matchesSelector||D.mozMatchesSelector||D.msMatchesSelector||D.oMatchesSelector||D.webkitMatchesSelector||function(t){for(var e=(t=(this.document||this.ownerDocument).querySelectorAll(t)).length;0<=--e&&t.item(e)!==this;);return-1<e}),B&&(T.prototype[B]="FormData"),F){var q=x.XMLHttpRequest.prototype.setRequestHeader;x.XMLHttpRequest.prototype.setRequestHeader=function(t,e){q.call(this,t,e),"content-type"===t.toLowerCase()&&(this.B=!0)},x.XMLHttpRequest.prototype.send=function(t){t instanceof T?(t=t._blob(),this.B||this.setRequestHeader("Content-Type",t.type),F.call(this,t)):F.call(this,t)}}M&&(x.fetch=function(t,e){return e&&e.body&&e.body instanceof T&&(e.body=e.body._blob()),M.call(this,t,e)}),A&&(x.navigator.sendBeacon=function(t,e){return e instanceof T&&(e=e._asNative()),A.call(this,t,e)}),x.FormData=T}}();