WordPress/wp-includes/js/dist/url.min.js

1 line
10 KiB
JavaScript

this.wp=this.wp||{},this.wp.url=function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=299)}({15:function(e,r,t){"use strict";function n(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}t.d(r,"a",function(){return n})},176:function(e,r,t){"use strict";var n=Object.prototype.hasOwnProperty,o=function(){for(var e=[],r=0;r<256;++r)e.push("%"+((r<16?"0":"")+r.toString(16)).toUpperCase());return e}(),i=function(e,r){for(var t=r&&r.plainObjects?Object.create(null):{},n=0;n<e.length;++n)void 0!==e[n]&&(t[n]=e[n]);return t};e.exports={arrayToObject:i,assign:function(e,r){return Object.keys(r).reduce(function(e,t){return e[t]=r[t],e},e)},compact:function(e){for(var r=[{obj:{o:e},prop:"o"}],t=[],n=0;n<r.length;++n)for(var o=r[n],i=o.obj[o.prop],a=Object.keys(i),c=0;c<a.length;++c){var l=a[c],u=i[l];"object"==typeof u&&null!==u&&-1===t.indexOf(u)&&(r.push({obj:i,prop:l}),t.push(u))}return function(e){for(var r;e.length;){var t=e.pop();if(r=t.obj[t.prop],Array.isArray(r)){for(var n=[],o=0;o<r.length;++o)void 0!==r[o]&&n.push(r[o]);t.obj[t.prop]=n}}return r}(r)},decode:function(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(r){return e}},encode:function(e){if(0===e.length)return e;for(var r="string"==typeof e?e:String(e),t="",n=0;n<r.length;++n){var i=r.charCodeAt(n);45===i||46===i||95===i||126===i||i>=48&&i<=57||i>=65&&i<=90||i>=97&&i<=122?t+=r.charAt(n):i<128?t+=o[i]:i<2048?t+=o[192|i>>6]+o[128|63&i]:i<55296||i>=57344?t+=o[224|i>>12]+o[128|i>>6&63]+o[128|63&i]:(n+=1,i=65536+((1023&i)<<10|1023&r.charCodeAt(n)),t+=o[240|i>>18]+o[128|i>>12&63]+o[128|i>>6&63]+o[128|63&i])}return t},isBuffer:function(e){return null!==e&&void 0!==e&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},merge:function e(r,t,o){if(!t)return r;if("object"!=typeof t){if(Array.isArray(r))r.push(t);else{if("object"!=typeof r)return[r,t];(o.plainObjects||o.allowPrototypes||!n.call(Object.prototype,t))&&(r[t]=!0)}return r}if("object"!=typeof r)return[r].concat(t);var a=r;return Array.isArray(r)&&!Array.isArray(t)&&(a=i(r,o)),Array.isArray(r)&&Array.isArray(t)?(t.forEach(function(t,i){n.call(r,i)?r[i]&&"object"==typeof r[i]?r[i]=e(r[i],t,o):r.push(t):r[i]=t}),r):Object.keys(t).reduce(function(r,i){var a=t[i];return n.call(r,i)?r[i]=e(r[i],a,o):r[i]=a,r},a)}}},177:function(e,r,t){"use strict";var n=String.prototype.replace,o=/%20/g;e.exports={default:"RFC3986",formatters:{RFC1738:function(e){return n.call(e,o,"+")},RFC3986:function(e){return e}},RFC1738:"RFC1738",RFC3986:"RFC3986"}},299:function(e,r,t){"use strict";t.r(r),t.d(r,"isURL",function(){return l}),t.d(r,"addQueryArgs",function(){return u}),t.d(r,"getQueryArg",function(){return f}),t.d(r,"hasQueryArg",function(){return s}),t.d(r,"removeQueryArgs",function(){return p}),t.d(r,"prependHTTP",function(){return d}),t.d(r,"safeDecodeURI",function(){return y}),t.d(r,"filterURLForDisplay",function(){return b});var n=t(8),o=t(76),i=/^(?:https?:)?\/\/\S+$/i,a=/^(mailto:)?[a-z0-9._%+-]+@[a-z0-9][a-z0-9.-]*\.[a-z]{2,63}$/i,c=/^(?:[a-z]+:|#|\?|\.|\/)/i;function l(e){return i.test(e)}function u(e,r){var t=e.indexOf("?"),i=-1!==t?Object(o.parse)(e.substr(t+1)):{};return(-1!==t?e.substr(0,t):e)+"?"+Object(o.stringify)(Object(n.a)({},i,r))}function f(e,r){var t=e.indexOf("?");return(-1!==t?Object(o.parse)(e.substr(t+1)):{})[r]}function s(e,r){return void 0!==f(e,r)}function p(e){for(var r=e.indexOf("?"),t=-1!==r?Object(o.parse)(e.substr(r+1)):{},n=-1!==r?e.substr(0,r):e,i=arguments.length,a=new Array(i>1?i-1:0),c=1;c<i;c++)a[c-1]=arguments[c];return a.forEach(function(e){return delete t[e]}),n+"?"+Object(o.stringify)(t)}function d(e){return c.test(e)||a.test(e)?e:"http://"+e}function y(e){try{return decodeURI(e)}catch(r){return e}}function b(e){var r=e.replace(/^(?:https?:)\/\/(?:www\.)?/,"");return r.match(/^[^\/]+\/$/)?r.replace("/",""):r}},300:function(e,r,t){"use strict";var n=t(176),o=t(177),i={brackets:function(e){return e+"[]"},indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},a=Date.prototype.toISOString,c={delimiter:"&",encode:!0,encoder:n.encode,encodeValuesOnly:!1,serializeDate:function(e){return a.call(e)},skipNulls:!1,strictNullHandling:!1},l=function e(r,t,o,i,a,l,u,f,s,p,d,y){var b=r;if("function"==typeof u)b=u(t,b);else if(b instanceof Date)b=p(b);else if(null===b){if(i)return l&&!y?l(t,c.encoder):t;b=""}if("string"==typeof b||"number"==typeof b||"boolean"==typeof b||n.isBuffer(b))return l?[d(y?t:l(t,c.encoder))+"="+d(l(b,c.encoder))]:[d(t)+"="+d(String(b))];var v,g=[];if(void 0===b)return g;if(Array.isArray(u))v=u;else{var O=Object.keys(b);v=f?O.sort(f):O}for(var m=0;m<v.length;++m){var j=v[m];a&&null===b[j]||(g=Array.isArray(b)?g.concat(e(b[j],o(t,j),o,i,a,l,u,f,s,p,d,y)):g.concat(e(b[j],t+(s?"."+j:"["+j+"]"),o,i,a,l,u,f,s,p,d,y)))}return g};e.exports=function(e,r){var t=e,a=r?n.assign({},r):{};if(null!==a.encoder&&void 0!==a.encoder&&"function"!=typeof a.encoder)throw new TypeError("Encoder has to be a function.");var u=void 0===a.delimiter?c.delimiter:a.delimiter,f="boolean"==typeof a.strictNullHandling?a.strictNullHandling:c.strictNullHandling,s="boolean"==typeof a.skipNulls?a.skipNulls:c.skipNulls,p="boolean"==typeof a.encode?a.encode:c.encode,d="function"==typeof a.encoder?a.encoder:c.encoder,y="function"==typeof a.sort?a.sort:null,b=void 0!==a.allowDots&&a.allowDots,v="function"==typeof a.serializeDate?a.serializeDate:c.serializeDate,g="boolean"==typeof a.encodeValuesOnly?a.encodeValuesOnly:c.encodeValuesOnly;if(void 0===a.format)a.format=o.default;else if(!Object.prototype.hasOwnProperty.call(o.formatters,a.format))throw new TypeError("Unknown format option provided.");var O,m,j=o.formatters[a.format];"function"==typeof a.filter?t=(m=a.filter)("",t):Array.isArray(a.filter)&&(O=m=a.filter);var h,w=[];if("object"!=typeof t||null===t)return"";h=a.arrayFormat in i?a.arrayFormat:"indices"in a?a.indices?"indices":"repeat":"indices";var A=i[h];O||(O=Object.keys(t)),y&&O.sort(y);for(var x=0;x<O.length;++x){var P=O[x];s&&null===t[P]||(w=w.concat(l(t[P],P,A,f,s,p?d:null,m,y,b,v,j,g)))}var D=w.join(u),N=!0===a.addQueryPrefix?"?":"";return D.length>0?N+D:""}},301:function(e,r,t){"use strict";var n=t(176),o=Object.prototype.hasOwnProperty,i={allowDots:!1,allowPrototypes:!1,arrayLimit:20,decoder:n.decode,delimiter:"&",depth:5,parameterLimit:1e3,plainObjects:!1,strictNullHandling:!1},a=function(e,r,t){if(e){var n=t.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,i=/(\[[^[\]]*])/g,a=/(\[[^[\]]*])/.exec(n),c=a?n.slice(0,a.index):n,l=[];if(c){if(!t.plainObjects&&o.call(Object.prototype,c)&&!t.allowPrototypes)return;l.push(c)}for(var u=0;null!==(a=i.exec(n))&&u<t.depth;){if(u+=1,!t.plainObjects&&o.call(Object.prototype,a[1].slice(1,-1))&&!t.allowPrototypes)return;l.push(a[1])}return a&&l.push("["+n.slice(a.index)+"]"),function(e,r,t){for(var n=r,o=e.length-1;o>=0;--o){var i,a=e[o];if("[]"===a)i=(i=[]).concat(n);else{i=t.plainObjects?Object.create(null):{};var c="["===a.charAt(0)&&"]"===a.charAt(a.length-1)?a.slice(1,-1):a,l=parseInt(c,10);!isNaN(l)&&a!==c&&String(l)===c&&l>=0&&t.parseArrays&&l<=t.arrayLimit?(i=[])[l]=n:i[c]=n}n=i}return n}(l,r,t)}};e.exports=function(e,r){var t=r?n.assign({},r):{};if(null!==t.decoder&&void 0!==t.decoder&&"function"!=typeof t.decoder)throw new TypeError("Decoder has to be a function.");if(t.ignoreQueryPrefix=!0===t.ignoreQueryPrefix,t.delimiter="string"==typeof t.delimiter||n.isRegExp(t.delimiter)?t.delimiter:i.delimiter,t.depth="number"==typeof t.depth?t.depth:i.depth,t.arrayLimit="number"==typeof t.arrayLimit?t.arrayLimit:i.arrayLimit,t.parseArrays=!1!==t.parseArrays,t.decoder="function"==typeof t.decoder?t.decoder:i.decoder,t.allowDots="boolean"==typeof t.allowDots?t.allowDots:i.allowDots,t.plainObjects="boolean"==typeof t.plainObjects?t.plainObjects:i.plainObjects,t.allowPrototypes="boolean"==typeof t.allowPrototypes?t.allowPrototypes:i.allowPrototypes,t.parameterLimit="number"==typeof t.parameterLimit?t.parameterLimit:i.parameterLimit,t.strictNullHandling="boolean"==typeof t.strictNullHandling?t.strictNullHandling:i.strictNullHandling,""===e||null===e||void 0===e)return t.plainObjects?Object.create(null):{};for(var c="string"==typeof e?function(e,r){for(var t={},n=r.ignoreQueryPrefix?e.replace(/^\?/,""):e,a=r.parameterLimit===1/0?void 0:r.parameterLimit,c=n.split(r.delimiter,a),l=0;l<c.length;++l){var u,f,s=c[l],p=s.indexOf("]="),d=-1===p?s.indexOf("="):p+1;-1===d?(u=r.decoder(s,i.decoder),f=r.strictNullHandling?null:""):(u=r.decoder(s.slice(0,d),i.decoder),f=r.decoder(s.slice(d+1),i.decoder)),o.call(t,u)?t[u]=[].concat(t[u]).concat(f):t[u]=f}return t}(e,t):e,l=t.plainObjects?Object.create(null):{},u=Object.keys(c),f=0;f<u.length;++f){var s=u[f],p=a(s,c[s],t);l=n.merge(l,p,t)}return n.compact(l)}},76:function(e,r,t){"use strict";var n=t(300),o=t(301),i=t(177);e.exports={formats:i,parse:o,stringify:n}},8:function(e,r,t){"use strict";t.d(r,"a",function(){return o});var n=t(15);function o(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},o=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),o.forEach(function(r){Object(n.a)(e,r,t[r])})}return e}}});