woocommerce/packages/woocommerce-admin/dist/navigation/index.js

1 line
24 KiB
JavaScript
Raw Permalink Normal View History

2021-12-10 12:03:04 +00:00
this.wc=this.wc||{},this.wc.navigation=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=467)}({0:function(e,t){e.exports=window.wp.element},15:function(e,t){e.exports=window.wp.url},23:function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}n.d(t,"a",(function(){return r}))},3:function(e,t){e.exports=window.wp.components},30:function(e,t){e.exports=window.wp.hooks},32:function(e,t,n){"use strict";var r=n(67),o=n(68),i=n(39);e.exports={formats:i,parse:o,stringify:r}},39:function(e,t,n){"use strict";var r=String.prototype.replace,o=/%20/g,i="RFC1738",a="RFC3986";e.exports={default:a,formatters:{RFC1738:function(e){return r.call(e,o,"+")},RFC3986:function(e){return String(e)}},RFC1738:i,RFC3986:a}},4:function(e,t){e.exports=window.lodash},41:function(e,t,n){"use strict";t.a=function(e,t){if(!e)throw new Error("Invariant failed")}},467:function(e,t,n){"use strict";n.r(t),n.d(t,"getHistory",(function(){return f})),n.d(t,"flattenFilters",(function(){return p})),n.d(t,"getActiveFiltersFromQuery",(function(){return d})),n.d(t,"getDefaultOptionValue",(function(){return h})),n.d(t,"getQueryFromActiveFilters",(function(){return y})),n.d(t,"getUrlKey",(function(){return v})),n.d(t,"getPath",(function(){return m})),n.d(t,"getPersistedQuery",(function(){return g})),n.d(t,"getQueryExcludedScreens",(function(){return w})),n.d(t,"pathIsExcluded",(function(){return b})),n.d(t,"getScreenFromPath",(function(){return O})),n.d(t,"getIdsFromQuery",(function(){return j})),n.d(t,"getSetOfIdsFromQuery",(function(){return x})),n.d(t,"getSearchWords",(function(){return P})),n.d(t,"getNewPath",(function(){return k})),n.d(t,"getQuery",(function(){return E})),n.d(t,"onQueryChange",(function(){return S})),n.d(t,"updateQueryString",(function(){return A})),n.d(t,"addHistoryListener",(function(){return L})),n.d(t,"WooNavigationItem",(function(){return N}));var r=n(0),o=n(15),i=n(32),a=n(4),c=n(30),u=n(3),s=n(52);let l;function f(){if(!l){const e=document.location.pathname,t=Object(s.a)({basename:e.substring(0,e.lastIndexOf("/"))});l={get length(){return t.length},get action(){return t.action},get location(){const{location:e}=t,n=Object(i.parse)(e.search.substring(1)).path||"/";return{...e,pathname:n}},createHref:(...e)=>t.createHref.apply(t,e),push:(...e)=>t.push.apply(t,e),replace:(...e)=>t.replace.apply(t,e),go:(...e)=>t.go.apply(t,e),goBack:(...e)=>t.goBack.apply(t,e),goForward:(...e)=>t.goForward.apply(t,e),block:(...e)=>t.block.apply(t,e),listen(e){return t.listen(()=>{e(this.location,this.action)})}}}return l}function p(e){const t=[];return e.forEach(e=>{if(e.subFilters){t.push(Object(a.omit)(e,"subFilters"));const n=p(e.subFilters);t.push(...n)}else t.push(e)}),t}function d(e,t){return Object.keys(t).reduce((n,r)=>{const o=t[r];if(o.rules){const t=o.rules.filter(t=>e.hasOwnProperty(v(r,t.value)));if(t.length)if(o.allowMultiple)t.forEach(t=>{e[v(r,t.value)].forEach(e=>{n.push({key:r,rule:t.value,value:e})})});else{const o=e[v(r,t[0].value)];n.push({key:r,rule:t[0].value,value:o})}}else if(e[r])if(o.allowMultiple){e[r].forEac