WordPress/wp-includes/js/dist/url.min.js
gziolo 6e4458c935 Build: Use hashed/deterministic moduleIDs in webpack config
Props peterwilsoncc, desrosj.
Fixes #53192.


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


git-svn-id: http://core.svn.wordpress.org/trunk@50549 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-20 12:20:04 +00:00

2 lines
5.0 KiB
JavaScript

/*! This file is auto-generated */
this.wp=this.wp||{},this.wp.url=function(t){var n={};function e(r){if(n[r])return n[r].exports;var u=n[r]={i:r,l:!1,exports:{}};return t[r].call(u.exports,u,u.exports,e),u.l=!0,u.exports}return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var u in t)e.d(r,u,function(n){return t[n]}.bind(null,u));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s="./node_modules/@wordpress/url/build-module/index.js")}({"./node_modules/@wordpress/url/build-module/index.js":function(t,n,e){"use strict";function r(t){try{return new URL(t),!0}catch{return!1}}e.r(n),e.d(n,"isURL",(function(){return r})),e.d(n,"isEmail",(function(){return o})),e.d(n,"getProtocol",(function(){return i})),e.d(n,"isValidProtocol",(function(){return c})),e.d(n,"getAuthority",(function(){return s})),e.d(n,"isValidAuthority",(function(){return f})),e.d(n,"getPath",(function(){return l})),e.d(n,"isValidPath",(function(){return d})),e.d(n,"getQueryString",(function(){return a})),e.d(n,"buildQueryString",(function(){return p})),e.d(n,"isValidQueryString",(function(){return g})),e.d(n,"getPathAndQueryString",(function(){return y})),e.d(n,"getFragment",(function(){return h})),e.d(n,"isValidFragment",(function(){return b})),e.d(n,"addQueryArgs",(function(){return j})),e.d(n,"getQueryArg",(function(){return O})),e.d(n,"getQueryArgs",(function(){return m})),e.d(n,"hasQueryArg",(function(){return w})),e.d(n,"removeQueryArgs",(function(){return x})),e.d(n,"prependHTTP",(function(){return A})),e.d(n,"safeDecodeURI",(function(){return S})),e.d(n,"safeDecodeURIComponent",(function(){return P})),e.d(n,"filterURLForDisplay",(function(){return $})),e.d(n,"cleanForSlug",(function(){return U}));const u=/^(mailto:)?[a-z0-9._%+-]+@[a-z0-9][a-z0-9.-]*\.[a-z]{2,63}$/i;function o(t){return u.test(t)}function i(t){const n=/^([^\s:]+:)/.exec(t);if(n)return n[1]}function c(t){return!!t&&/^[a-z\-.\+]+[0-9]*:$/i.test(t)}function s(t){const n=/^[^\/\s:]+:(?:\/\/)?\/?([^\/\s#?]+)[\/#?]{0,1}\S*$/.exec(t);if(n)return n[1]}function f(t){return!!t&&/^[^\s#?]+$/.test(t)}function l(t){const n=/^[^\/\s:]+:(?:\/\/)?[^\/\s#?]+[\/]([^\s#?]+)[#?]{0,1}\S*$/.exec(t);if(n)return n[1]}function d(t){return!!t&&/^[^\s#?]+$/.test(t)}function a(t){let n;try{n=new URL(t,"http://example.com").search.substring(1)}catch(t){}if(n)return n}function p(t){let n="";const e=Object.entries(t);let r;for(;r=e.shift();){let[t,u]=r;if(Array.isArray(u)||u&&u.constructor===Object){const n=Object.entries(u).reverse();for(const[r,u]of n)e.unshift([`${t}[${r}]`,u])}else void 0!==u&&(null===u&&(u=""),n+="&"+[t,u].map(encodeURIComponent).join("="))}return n.substr(1)}function g(t){return!!t&&/^[^\s#?\/]+$/.test(t)}function y(t){const n=l(t),e=a(t);let r="/";return n&&(r+=n),e&&(r+="?"+e),r}function h(t){const n=/^\S+?(#[^\s\?]*)/.exec(t);if(n)return n[1]}function b(t){return!!t&&/^#[^\s#?\/]*$/.test(t)}function m(t){return(a(t)||"").replace(/\+/g,"%20").split("&").reduce((t,n)=>{const[e,r=""]=n.split("=").filter(Boolean).map(decodeURIComponent);if(e){!function(t,n,e){const r=n.length,u=r-1;for(let o=0;o<r;o++){let r=n[o];!r&&Array.isArray(t)&&(r=t.length.toString());const i=!isNaN(Number(n[o+1]));t[r]=o===u?e:t[r]||(i?[]:{}),Array.isArray(t[r])&&!i&&(t[r]={...t[r]}),t=t[r]}}(t,e.replace(/\]/g,"").split("["),r)}return t},{})}function j(t="",n){if(!n||!Object.keys(n).length)return t;let e=t;const r=t.indexOf("?");return-1!==r&&(n=Object.assign(m(t),n),e=e.substr(0,r)),e+"?"+p(n)}function O(t,n){return m(t)[n]}function w(t,n){return void 0!==O(t,n)}function x(t,...n){const e=t.indexOf("?");if(-1===e)return t;const r=m(t),u=t.substr(0,e);n.forEach(t=>delete r[t]);const o=p(r);return o?u+"?"+o:u}const v=/^(?:[a-z]+:|#|\?|\.|\/)/i;function A(t){return t?(t=t.trim(),v.test(t)||o(t)?t:"http://"+t):t}function S(t){try{return decodeURI(t)}catch(n){return t}}function P(t){try{return decodeURIComponent(t)}catch(n){return t}}function $(t,n=null){let e=t.replace(/^(?:https?:)\/\/(?:www\.)?/,"");e.match(/^[^\/]+\/$/)&&(e=e.replace("/",""));if(!n||e.length<=n||!e.match(/([\w|:])*\.(?:jpg|jpeg|gif|png|svg)/))return e;e=e.split("?")[0];const r=e.split("/"),u=r[r.length-1];if(u.length<=n)return"…"+e.slice(-n);const o=u.lastIndexOf("."),[i,c]=[u.slice(0,o),u.slice(o+1)],s=i.slice(-3)+"."+c;return u.slice(0,n-s.length-1)+"…"+s}var R=e("lodash");function U(t){return t?Object(R.trim)(Object(R.deburr)(t).replace(/[\s\./]+/g,"-").replace(/[^\w-]+/g,"").toLowerCase(),"-"):""}},lodash:function(t,n){t.exports=window.lodash}});