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

1 line
11 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)}({179: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 u=a[c],l=i[u];"object"==typeof l&&null!==l&&-1===t.indexOf(l)&&(r.push({obj:i,prop:u}),t.push(l))}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)}}},180: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 c}),t.d(r,"getProtocol",function(){return u}),t.d(r,"isValidProtocol",function(){return l}),t.d(r,"getAuthority",function(){return s}),t.d(r,"isValidAuthority",function(){return f}),t.d(r,"getPath",function(){return p}),t.d(r,"isValidPath",function(){return d}),t.d(r,"getQueryString",function(){return y}),t.d(r,"isValidQueryString",function(){return b}),t.d(r,"getFragment",function(){return g}),t.d(r,"isValidFragment",function(){return v}),t.d(r,"addQueryArgs",function(){return h}),t.d(r,"getQueryArg",function(){return m}),t.d(r,"hasQueryArg",function(){return O}),t.d(r,"removeQueryArgs",function(){return j}),t.d(r,"prependHTTP",function(){return w}),t.d(r,"safeDecodeURI",function(){return A}),t.d(r,"filterURLForDisplay",function(){return x});var n=t(76),o=/^(?:https?:)?\/\/\S+$/i,i=/^(mailto:)?[a-z0-9._%+-]+@[a-z0-9][a-z0-9.-]*\.[a-z]{2,63}$/i,a=/^(?:[a-z]+:|#|\?|\.|\/)/i;function c(e){return o.test(e)}function u(e){var r=/^([^\s:]+:)/.exec(e);if(r)return r[1]}function l(e){return!!e&&/^[a-z\-.\+]+[0-9]*:$/i.test(e)}function s(e){var r=/^[^\/\s:]+:(?:\/\/)?\/?([^\/\s#?]+)[\/#?]{0,1}\S*$/.exec(e);if(r)return r[1]}function f(e){return!!e&&/^[^\s#?]+$/.test(e)}function p(e){var r=/^[^\/\s:]+:(?:\/\/)?[^\/\s#?]+[\/]([^\s#?]+)[#?]{0,1}\S*$/.exec(e);if(r)return r[1]}function d(e){return!!e&&/^[^\s#?]+$/.test(e)}function y(e){var r=/^\S+?\?([^\s#]+)/.exec(e);if(r)return r[1]}function b(e){return!!e&&/^[^\s#?\/]+$/.test(e)}function g(e){var r=/^\S+?(#[^\s\?]*)/.exec(e);if(r)return r[1]}function v(e){return!!e&&/^#[^\s#?\/]*$/.test(e)}function h(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1?arguments[1]:void 0,t=e,o=e.indexOf("?");return-1!==o&&(r=Object.assign(Object(n.parse)(e.substr(o+1)),r),t=t.substr(0,o)),t+"?"+Object(n.stringify)(r)}function m(e,r){var t=e.indexOf("?");return(-1!==t?Object(n.parse)(e.substr(t+1)):{})[r]}function O(e,r){return void 0!==m(e,r)}function j(e){for(var r=e.indexOf("?"),t=-1!==r?Object(n.parse)(e.substr(r+1)):{},o=-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]}),o+"?"+Object(n.stringify)(t)}function w(e){return a.test(e)||i.test(e)?e:"http://"+e}function A(e){try{return decodeURI(e)}catch(r){return e}}function x(e){var r=e.replace(/^(?:https?:)\/\/(?:www\.)?/,"");return r.match(/^[^\/]+\/$/)?r.replace("/",""):r}},300:function(e,r,t){"use strict";var n=t(179),o=t(180),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},u=function e(r,t,o,i,a,u,l,s,f,p,d,y){var b=r;if("function"==typeof l)b=l(t,b);else if(b instanceof Date)b=p(b);else if(null===b){if(i)return u&&!y?u(t,c.encoder):t;b=""}if("string"==typeof b||"number"==typeof b||"boolean"==typeof b||n.isBuffer(b))return u?[d(y?t:u(t,c.encoder))+"="+d(u(b,c.encoder))]:[d(t)+"="+d(String(b))];var g,v=[];if(void 0===b)return v;if(Array.isArray(l))g=l;else{var h=Object.keys(b);g=s?h.sort(s):h}for(var m=0;m<g.length;++m){var O=g[m];a&&null===b[O]||(v=Array.isArray(b)?v.concat(e(b[O],o(t,O),o,i,a,u,l,s,f,p,d,y)):v.concat(e(b[O],t+(f?"."+O:"["+O+"]"),o,i,a,u,l,s,f,p,d,y)))}return v};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 l=void 0===a.delimiter?c.delimiter:a.delimiter,s="boolean"==typeof a.strictNullHandling?a.strictNullHandling:c.strictNullHandling,f="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,g="function"==typeof a.serializeDate?a.serializeDate:c.serializeDate,v="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 h,m,O=o.formatters[a.format];"function"==typeof a.filter?t=(m=a.filter)("",t):Array.isArray(a.filter)&&(h=m=a.filter);var j,w=[];if("object"!=typeof t||null===t)return"";j=a.arrayFormat in i?a.arrayFormat:"indices"in a?a.indices?"indices":"repeat":"indices";var A=i[j];h||(h=Object.keys(t)),y&&h.sort(y);for(var x=0;x<h.length;++x){var P=h[x];f&&null===t[P]||(w=w.concat(u(t[P],P,A,s,f,p?d:null,m,y,b,g,O,v)))}var S=w.join(l),D=!0===a.addQueryPrefix?"?":"";return S.length>0?D+S:""}},301:function(e,r,t){"use strict";var n=t(179),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,u=[];if(c){if(!t.plainObjects&&o.call(Object.prototype,c)&&!t.allowPrototypes)return;u.push(c)}for(var l=0;null!==(a=i.exec(n))&&l<t.depth;){if(l+=1,!t.plainObjects&&o.call(Object.prototype,a[1].slice(1,-1))&&!t.allowPrototypes)return;u.push(a[1])}return a&&u.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,u=parseInt(c,10);!isNaN(u)&&a!==c&&String(u)===c&&u>=0&&t.parseArrays&&u<=t.arrayLimit?(i=[])[u]=n:i[c]=n}n=i}return n}(u,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),u=0;u<c.length;++u){var l,s,f=c[u],p=f.indexOf("]="),d=-1===p?f.indexOf("="):p+1;-1===d?(l=r.decoder(f,i.decoder),s=r.strictNullHandling?null:""):(l=r.decoder(f.slice(0,d),i.decoder),s=r.decoder(f.slice(d+1),i.decoder)),o.call(t,l)?t[l]=[].concat(t[l]).concat(s):t[l]=s}return t}(e,t):e,u=t.plainObjects?Object.create(null):{},l=Object.keys(c),s=0;s<l.length;++s){var f=l[s],p=a(f,c[f],t);u=n.merge(u,p,t)}return n.compact(u)}},76:function(e,r,t){"use strict";var n=t(300),o=t(301),i=t(180);e.exports={formats:i,parse:o,stringify:n}}});