12345678910 |
- /**
- * vue-meta v2.4.0
- * (c) 2020
- * - Declan de Wet
- * - Sébastien Chopin (@Atinux)
- * - Pim (@pimlie)
- * - All the amazing contributors
- * @license MIT
- */
- import n from"deepmerge";function t(n){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(n)}function e(n,t){(null==t||t>n.length)&&(t=n.length);for(var e=0,r=new Array(t);e<t;e++)r[e]=n[e];return r}function r(n,t){var r;if("undefined"==typeof Symbol||null==n[Symbol.iterator]){if(Array.isArray(n)||(r=function(n,t){if(n){if("string"==typeof n)return e(n,t);var r=Object.prototype.toString.call(n).slice(8,-1);return"Object"===r&&n.constructor&&(r=n.constructor.name),"Map"===r||"Set"===r?Array.from(n):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e(n,t):void 0}}(n))||t&&n&&"number"==typeof n.length){r&&(n=r);var i=0,o=function(){};return{s:o,n:function(){return i>=n.length?{done:!0}:{done:!1,value:n[i++]}},e:function(n){throw n},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,f=!1;return{s:function(){r=n[Symbol.iterator]()},n:function(){var n=r.next();return u=n.done,n},e:function(n){f=!0,a=n},f:function(){try{u||null==r.return||r.return()}finally{if(f)throw a}}}}function i(n){return Array.isArray(n)}function o(n){return void 0===n}function a(n){return"object"===t(n)}function u(n){return"object"===t(n)&&null!==n}function f(n){return"function"==typeof n}var c=(function(){try{return!o(window)}catch(n){return!1}}()?window:global).console||{};function s(n){c&&c.warn&&c.warn(n)}var d=function(n){return s("".concat(n," is not supported in browser builds"))},l={title:void 0,titleChunk:"",titleTemplate:"%s",htmlAttrs:{},bodyAttrs:{},headAttrs:{},base:[],link:[],meta:[],style:[],script:[],noscript:[],__dangerouslyDisableSanitizers:[],__dangerouslyDisableSanitizersByTagID:{}},v="metaInfo",m="data-vue-meta",h="data-vue-meta-server-rendered",p="vmid",y="content",b="template",g=!0,w=10,A="ssr",I=Object.keys(l),T=[I[12],I[13]],N=[I[1],I[2],"changed"].concat(T),O=[I[3],I[4],I[5]],S=["link","style","script"],k=["once","skip","template"],M=["body","pbody"],j=["allowfullscreen","amp","amp-boilerplate","async","autofocus","autoplay","checked","compact","controls","declare","default","defaultchecked","defaultmuted","defaultselected","defer","disabled","enabled","formnovalidate","hidden","indeterminate","inert","ismap","itemscope","loop","multiple","muted","nohref","noresize","noshade","novalidate","nowrap","open","pauseonexit","readonly","required","reversed","scoped","seamless","selected","sortable","truespeed","typemustmatch","visible"],K=null;function _(n,t,e){var r=n.t;t._vueMeta.i||!t._vueMeta.o&&"watcher"!==e||(t._vueMeta.i=null),t._vueMeta.i&&!t._vueMeta.u&&function(n,t){if(!(t=void 0===t?10:t))return void n();clearTimeout(K),K=setTimeout((function(){n()}),t)}((function(){t.$meta().refresh()}),r)}function D(n,t,e){if(!Array.prototype.findIndex){for(var r=0;r<n.length;r++)if(t.call(e,n[r],r,n))return r;return-1}return n.findIndex(t,e)}function x(n){return Array.from?Array.from(n):Array.prototype.slice.call(n)}function V(n,t){if(!Array.prototype.includes){for(var e in n)if(n[e]===t)return!0;return!1}return n.includes(t)}var z=function(n,t){return(t||document).querySelectorAll(n)};function C(n,t){return n[t]||(n[t]=document.getElementsByTagName(t)[0]),n[t]}function J(n,t,e){var r=t.l,i=t.v,o=t.type,a=t.m;e=e||{};var u=["".concat(o,"[").concat(i,'="').concat(r,'"]'),"".concat(o,"[data-").concat(a,"]")].map((function(n){for(var t in e){var r=e[t],i=r&&!0!==r?'="'.concat(r,'"'):"";n+="[data-".concat(t).concat(i,"]")}return n}));return x(z(u.join(", "),n))}function W(n,t){n.removeAttribute(t)}function $(n){return(n=n||this)&&(!0===n._vueMeta||a(n._vueMeta))}function B(n,t){return n._vueMeta.u=!0,function(){return E(n,t)}}function E(n,t){if(n._vueMeta.u=!1,t||void 0===t)return n.$meta().refresh()}function H(n){var t=n.$router;!n._vueMeta.h&&t&&(n._vueMeta.h=!0,t.beforeEach((function(t,e,r){B(n),r()})),t.afterEach((function(){n.$nextTick((function(){var t=E(n).metaInfo;t&&f(t.afterNavigation)&&t.afterNavigation(t)}))})))}var L=1;function P(n,t){var e=["activated","deactivated","beforeMount"],r=!1;return{beforeCreate:function(){var i=this,a=this.$root,u=this.$options,c=n.config.devtools;if(Object.defineProperty(this,"_hasMetaInfo",{configurable:!0,get:function(){return c&&!a._vueMeta.p&&(s("VueMeta DeprecationWarning: _hasMetaInfo has been deprecated and will be removed in a future version. Please use hasMetaInfo(vm) instead"),a._vueMeta.p=!0),$(this)}}),this===a&&a.$once("hook:beforeMount",(function(){if(!(r=this.$el&&1===this.$el.nodeType&&this.$el.hasAttribute("data-server-rendered"))&&a._vueMeta&&1===a._vueMeta.l){var n=C({},"html");r=n&&n.hasAttribute(t.g)}})),!o(u[t.A])&&null!==u[t.A]){if(a._vueMeta||(a._vueMeta={l:L},L++,c&&a.$options[t.A]&&this.$nextTick((function(){var n=function(n,t,e){if(Array.prototype.find)return n.find(t,e);for(var r=0;r<n.length;r++)if(t.call(e,n[r],r,n))return n[r]}(a.$children,(function(n){return n.$vnode&&n.$vnode.fnOptions}));n&&n.$vnode.fnOptions[t.A]&&s("VueMeta has detected a possible global mixin which adds a ".concat(t.A," property to all Vue components on the page. This could cause severe performance issues. If possible, use $meta().addApp to add meta information instead"))}))),!this._vueMeta){this._vueMeta=!0;for(var d=this.$parent;d&&d!==a;)o(d._vueMeta)&&(d._vueMeta=!1),d=d.$parent}f(u[t.A])&&(u.computed=u.computed||{},u.computed.$metaInfo=u[t.A],this.$isServer||this.$on("hook:created",(function(){this.$watch("$metaInfo",(function(){_(t,this.$root,"watcher")}))}))),o(a._vueMeta.i)&&(a._vueMeta.i=this.$isServer,a._vueMeta.i||(a._vueMeta.initializedSsr||(a._vueMeta.initializedSsr=!0,this.$on("hook:beforeMount",(function(){var n=this.$root;r&&(n._vueMeta.l=t.j)}))),this.$on("hook:mounted",(function(){var n=this.$root;n._vueMeta.i||(n._vueMeta.o=!0,this.$nextTick((function(){var e=n.$meta().refresh(),r=e.tags,i=e.metaInfo;!1===r&&null===n._vueMeta.i&&this.$nextTick((function(){return _(t,n,"init")})),n._vueMeta.i=!0,delete n._vueMeta.o,!t.I&&i.afterNavigation&&H(n)})))})),t.I&&H(a))),this.$on("hook:destroyed",(function(){var n=this;this.$parent&&$(this)&&(delete this._hasMetaInfo,this.$nextTick((function(){if(t.O&&n.$el&&n.$el.offsetParent)var e=setInterval((function(){n.$el&&null!==n.$el.offsetParent||(clearInterval(e),_(t,n.$root,"destroyed"))}),50);else _(t,n.$root,"destroyed")})))})),this.$isServer||e.forEach((function(n){i.$on("hook:".concat(n),(function(){_(t,this.$root,n)}))}))}}}}function R(n,t){return t&&a(n)?(i(n[t])||(n[t]=[]),n):i(n)?n:[]}var U=[[/&/g,"&"],[/</g,"<"],[/>/g,">"],[/"/g,'"'],[/'/g,"'"]];function q(n,t,e){e=e||[];var r={T:function(n){return e.reduce((function(n,t){return n.replace(t[0],t[1])}),n)}};return T.forEach((function(n,e){if(0===e)R(t,n);else if(1===e)for(var i in t[n])R(t[n],i);r[n]=t[n]})),function n(t,e,r,o){var a=e.m,f=r.T,c=void 0===f?function(n){return n}:f,s={};for(var d in t){var l=t[d];if(V(N,d))s[d]=l;else{var v=T[0];if(r[v]&&V(r[v],d))s[d]=l;else{var m=t[a];if(m&&(v=T[1],r[v]&&r[v][m]&&V(r[v][m],d)))s[d]=l;else if("string"==typeof l?s[d]=c(l):i(l)?s[d]=l.map((function(t){return u(t)?n(t,e,r,!0):c(t)})):u(l)?s[d]=n(l,e,r,!0):s[d]=l,o){var h=c(d);d!==h&&(s[h]=s[d],delete s[d])}}}}return s}(t,n,r)}function F(n,t,e,r){var i=n.component,a=n.k,u=n.M;return!0!==e&&!0!==t[a]&&(o(e)&&t[a]&&(e=t[a],t[a]=!0),e?(o(r)&&(r=t[u]),t[u]=f(e)?e.call(i,r):e.replace(/%s/g,r),!0):(delete t[a],!1))}var G=!1;function Q(t,e,r){return r=r||{},void 0===e.title&&delete e.title,O.forEach((function(n){if(e[n])for(var t in e[n])t in e[n]&&void 0===e[n][t]&&(V(j,t)&&!G&&(s("VueMeta: Please note that since v2 the value undefined is not used to indicate boolean attributes anymore, see migration guide for details"),G=!0),delete e[n][t])})),n(t,e,{S:function(n,t){return function(n,t,e){var r=n.component,i=n.m,o=n.k,a=n.M,u=[];return t.length||e.length?(t.forEach((function(n,t){if(n[i]){var f=D(e,(function(t){return t[i]===n[i]})),c=e[f];if(-1!==f){if(a in c&&void 0===c[a]||"innerHTML"in c&&void 0===c.innerHTML)return u.push(n),void e.splice(f,1);if(null!==c[a]&&null!==c.innerHTML){var s=n[o];if(s){if(!c[o])return F({component:r,k:o,M:a},c,s),void(c.template=!0);c[a]||F({component:r,k:o,M:a},c,void 0,n[a])}}else e.splice(f,1)}else u.push(n)}else u.push(n)})),u.concat(e)):u}(r,n,t)}})}function X(n,t){return function n(t,e,r){if(r=r||{},e._inactive)return r;var i=(t=t||{}).A,u=e.$metaInfo,f=e.$options,c=e.$children;if(f[i]){var s=u||f[i];a(s)&&(r=Q(r,s,t))}c.length&&c.forEach((function(e){(function(n){return(n=n||this)&&!o(n._vueMeta)})(e)&&(r=n(t,e,r))}));return r}(n||{},t,l)}var Y=[];function Z(n,t,e,r){var i=n.m,o=!1;return e.forEach((function(n){n[i]&&n.callback&&(o=!0,function(n,t){1===arguments.length&&(t=n,n=""),Y.push([n,t])}("".concat(t,"[data-").concat(i,'="').concat(n[i],'"]'),n.callback))})),r&&o?nn():o}function nn(){var n;"complete"!==(n||document).readyState?document.onreadystatechange=function(){tn()}:tn()}function tn(n){Y.forEach((function(t){var e=t[0],r=t[1],i="".concat(e,'[onload="this.__vm_l=1"]'),o=[];n||(o=x(z(i))),n&&n.matches(i)&&(o=[n]),o.forEach((function(n){if(!n.__vm_cb){var t=function(){n.__vm_cb=!0,W(n,"onload"),r(n)};n.__vm_l?t():n.__vm_ev||(n.__vm_ev=!0,n.addEventListener("load",t))}}))}))}var en,rn={};function on(n,t,e,r,i){var o=(t||{}).v,a=i.getAttribute(o);a&&(rn[e]=JSON.parse(decodeURI(a)),W(i,o));var u=rn[e]||{},f=[];for(var c in u)void 0!==u[c]&&n in u[c]&&(f.push(c),r[c]||delete u[c][n]);for(var s in r){var d=u[s];d&&d[n]===r[s]||(f.push(s),void 0!==r[s]&&(u[s]=u[s]||{},u[s][n]=r[s]))}for(var l=0,v=f;l<v.length;l++){var m=v[l],h=u[m],p=[];for(var y in h)Array.prototype.push.apply(p,[].concat(h[y]));if(p.length){var b=V(j,m)&&p.some(Boolean)?"":p.filter((function(n){return void 0!==n})).join(" ");i.setAttribute(m,b)}else W(i,m)}rn[e]=u}function an(n,t,e,r,i,o){var a=t||{},u=a.v,f=a.m,c=M.slice();c.push(f);var s=[],d={l:n,v:u,type:e,m:f},l={head:J(i,d),pbody:J(o,d,{pbody:!0}),body:J(o,d,{body:!0})};if(r.length>1){var v=[];r=r.filter((function(n){var t=JSON.stringify(n),e=!V(v,t);return v.push(t),e}))}r.forEach((function(t){if(!t.skip){var r=document.createElement(e);t.once||r.setAttribute(u,n),Object.keys(t).forEach((function(n){if(!V(k,n))if("innerHTML"!==n)if("json"!==n)if("cssText"!==n)if("callback"!==n){var e=V(c,n)?"data-".concat(n):n,i=V(j,n);if(!i||t[n]){var o=i?"":t[n];r.setAttribute(e,o)}}else r.onload=function(){return t[n](r)};else r.styleSheet?r.styleSheet.cssText=t.cssText:r.appendChild(document.createTextNode(t.cssText));else r.innerHTML=JSON.stringify(t.json);else r.innerHTML=t.innerHTML}));var i,o=l[function(n){var t=n.body,e=n.pbody;return t?"body":e?"pbody":"head"}(t)];o.some((function(n,t){return i=t,r.isEqualNode(n)}))&&(i||0===i)?o.splice(i,1):s.push(r)}}));var m=[];for(var h in l)Array.prototype.push.apply(m,l[h]);return m.forEach((function(n){n.parentNode.removeChild(n)})),s.forEach((function(n){n.hasAttribute("data-body")?o.appendChild(n):n.hasAttribute("data-pbody")?o.insertBefore(n,o.firstChild):i.appendChild(n)})),{oldTags:m,newTags:s}}function un(n,t,e){var r=t=t||{},o=r.g,a=r.j,u={},f=C(u,"html");if(n===a&&f.hasAttribute(o)){W(f,o);var c=!1;return S.forEach((function(n){e[n]&&Z(t,n,e[n])&&(c=!0)})),c&&nn(),!1}var s,d={},l={};for(var v in e)if(!V(N,v))if("title"!==v){if(V(O,v)){var m=v.substr(0,4);on(n,t,v,e[v],C(u,m))}else if(i(e[v])){var h=an(n,t,v,e[v],C(u,"head"),C(u,"body")),p=h.oldTags,y=h.newTags;y.length&&(d[v]=y,l[v]=p)}}else((s=e.title)||""===s)&&(document.title=s);return{D:d,K:l}}function fn(n,t,e){return{set:function(r){return function(n,t,e,r){if(n&&n.$el)return un(t,e,r);(en=en||{})[t]=r}(n,t,e,r)},remove:function(){return function(n,t,e){if(n&&n.$el){var i,o={},a=r(O);try{for(a.s();!(i=a.n()).done;){var u=i.value,f=u.substr(0,4);on(t,e,u,{},C(o,f))}}catch(n){a.e(n)}finally{a.f()}return function(n,t){var e=n.v;x(z("[".concat(e,'="').concat(t,'"]'))).map((function(n){return n.remove()}))}(e,t)}en[t]&&(delete en[t],sn())}(n,t,e)}}}function cn(){return en}function sn(n){!n&&Object.keys(en).length||(en=void 0)}function dn(n,t){if(t=t||{},!n._vueMeta)return s("This vue app/component has no vue-meta configuration"),{};var e=function(n,t,e,r){e=e||[];var i=(n=n||{}).m;return t.title&&(t.titleChunk=t.title),t.titleTemplate&&"%s"!==t.titleTemplate&&F({component:r,M:"title"},t,t.titleTemplate,t.titleChunk||""),t.base&&(t.base=Object.keys(t.base).length?[t.base]:[]),t.meta&&(t.meta=t.meta.filter((function(n,t,e){return!n[i]||t===D(e,(function(t){return t[i]===n[i]}))})),t.meta.forEach((function(t){return F(n,t)}))),q(n,t,e)}(t,X(t,n),U,n),r=un(n._vueMeta.l,t,e);r&&f(e.changed)&&(e.changed(e,r.D,r.K),r={addedTags:r.D,removedTags:r.K});var i=cn();if(i){for(var o in i)un(o,t,i[o]),delete i[o];sn(!0)}return{vm:n,metaInfo:e,tags:r}}function ln(n){n=n||{};var t=this.$root;return{getOptions:function(){return function(n){var t={};for(var e in n)t[e]=n[e];return t}(n)},setOptions:function(e){e&&e.I&&(n.I=!!e.I,H(t));if(e&&"debounceWait"in e){var r=parseInt(e.t);isNaN(r)||(n.t=r)}e&&"waitOnDestroyed"in e&&(n.O=!!e.O)},refresh:function(){return dn(t,n)},inject:function(n){return d("inject")},pause:function(){return B(t)},resume:function(){return E(t)},addApp:function(e){return fn(t,e,n)}}}function vn(n,t){n.__vuemeta_installed||(n.__vuemeta_installed=!0,t=function(n){return{A:(n=a(n)?n:{}).keyName||v,v:n.attribute||m,g:n.ssrAttribute||h,m:n.tagIDKeyName||p,M:n.contentKeyName||y,k:n.metaTemplateKeyName||b,t:o(n.debounceWait)?w:n.debounceWait,O:o(n.waitOnDestroyed)?g:n.waitOnDestroyed,j:n.ssrAppId||A,I:!!n.refreshOnceOnNavigation}}(t),n.prototype.$meta=function(){return ln.call(this,t)},n.mixin(P(n,t)))}o(window)||o(window.Vue)||vn(window.Vue);var mn={version:"2.4.0",install:vn,generate:function(n,t){return d("generate")},hasMetaInfo:$};export default mn;
|