@haxtheweb/haxcms-nodejs
Version:
HAXcms single and multisite nodejs server, api, and administration
10 lines • 19.1 kB
JavaScript
/**
@license @nocompile
Copyright (c) 2018 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/
(function(){var t=window.Document.prototype.createElement,n=window.Document.prototype.createElementNS,o=window.Document.prototype.importNode,r=window.Document.prototype.prepend,i=window.Document.prototype.append,a=window.DocumentFragment.prototype.prepend,l=window.DocumentFragment.prototype.append,c=window.Node.prototype.cloneNode,s=window.Node.prototype.appendChild,u=window.Node.prototype.insertBefore,h=window.Node.prototype.removeChild,p=window.Node.prototype.replaceChild,m=Object.getOwnPropertyDescriptor(window.Node.prototype,"textContent"),y=window.Element.prototype.attachShadow,w=Object.getOwnPropertyDescriptor(window.Element.prototype,"innerHTML"),v=window.Element.prototype.getAttribute,E=window.Element.prototype.setAttribute,_=window.Element.prototype.removeAttribute,C=window.Element.prototype.toggleAttribute,D=window.Element.prototype.getAttributeNS,k=window.Element.prototype.setAttributeNS,A=window.Element.prototype.removeAttributeNS,F=window.Element.prototype.insertAdjacentElement,O=window.Element.prototype.insertAdjacentHTML,j=window.Element.prototype.prepend,x=window.Element.prototype.append,H=window.Element.prototype.before,I=window.Element.prototype.after,B=window.Element.prototype.replaceWith,z=window.Element.prototype.remove,G=window.HTMLElement,q=Object.getOwnPropertyDescriptor(window.HTMLElement.prototype,"innerHTML"),$=window.HTMLElement.prototype.insertAdjacentElement,tt=window.HTMLElement.prototype.insertAdjacentHTML,et=new Set;function ra(t){var n=et.has(t);return t=/^[a-z][.0-9_a-z]*-[-.0-9_a-z]*$/.test(t),!n&&t}"annotation-xml color-profile font-face font-face-src font-face-uri font-face-format font-face-name missing-glyph".split(" ").forEach((function(t){return et.add(t)}));var nt=document.contains?document.contains.bind(document):document.documentElement.contains.bind(document.documentElement);function J(t){var n=t.isConnected;if(void 0!==n)return n;if(nt(t))return!0;for(;t&&!(t.__CE_isImportDocument||t instanceof Document);)t=t.parentNode||(window.ShadowRoot&&t instanceof ShadowRoot?t.host:void 0);return!(!t||!(t.__CE_isImportDocument||t instanceof Document))}function K(t){var n=t.children;if(n)return Array.prototype.slice.call(n);for(n=[],t=t.firstChild;t;t=t.nextSibling)t.nodeType===Node.ELEMENT_NODE&&n.push(t);return n}function L(t,n){for(;n&&n!==t&&!n.nextSibling;)n=n.parentNode;return n&&n!==t?n.nextSibling:null}function M(t,n,o){for(var r=t;r;){if(r.nodeType===Node.ELEMENT_NODE){var i=r;n(i);var a=i.localName;if("link"===a&&"import"===i.getAttribute("rel")){if(r=i.import,void 0===o&&(o=new Set),r instanceof Node&&!o.has(r))for(o.add(r),r=r.firstChild;r;r=r.nextSibling)M(r,n,o);r=L(t,i);continue}if("template"===a){r=L(t,i);continue}if(i=i.__CE_shadowRoot)for(i=i.firstChild;i;i=i.nextSibling)M(i,n,o)}r=r.firstChild?r.firstChild:L(t,r)}}function N(){var t=!(null==rt||!rt.noDocumentConstructionObserver),n=!(null==rt||!rt.shadyDomFastWalk);this.m=[],this.g=[],this.j=!1,this.shadyDomFastWalk=n,this.I=!t}function P(t,n,o,r){var i=window.ShadyDOM;if(t.shadyDomFastWalk&&i&&i.inUse){if(n.nodeType===Node.ELEMENT_NODE&&o(n),n.querySelectorAll)for(t=i.nativeMethods.querySelectorAll.call(n,"*"),n=0;n<t.length;n++)o(t[n])}else M(n,o,r)}function Q(t,n){t.j&&P(t,n,(function(n){return R(t,n)}))}function R(t,n){if(t.j&&!n.__CE_patched){n.__CE_patched=!0;for(var o=0;o<t.m.length;o++)t.m[o](n);for(o=0;o<t.g.length;o++)t.g[o](n)}}function S(t,n){var o=[];for(P(t,n,(function(t){return o.push(t)})),n=0;n<o.length;n++){var r=o[n];1===r.__CE_state?t.connectedCallback(r):T(t,r)}}function U(t,n){var o=[];for(P(t,n,(function(t){return o.push(t)})),n=0;n<o.length;n++){var r=o[n];1===r.__CE_state&&t.disconnectedCallback(r)}}function V(t,n,o){var r=(o=void 0===o?{}:o).J,i=o.upgrade||function(n){return T(t,n)},a=[];for(P(t,n,(function(n){if(t.j&&R(t,n),"link"===n.localName&&"import"===n.getAttribute("rel")){var o=n.import;o instanceof Node&&(o.__CE_isImportDocument=!0,o.__CE_registry=document.__CE_registry),o&&"complete"===o.readyState?o.__CE_documentLoadHandled=!0:n.addEventListener("load",(function(){var o=n.import;if(!o.__CE_documentLoadHandled){o.__CE_documentLoadHandled=!0;var a=new Set;r&&(r.forEach((function(t){return a.add(t)})),a.delete(o)),V(t,o,{J:a,upgrade:i})}}))}else a.push(n)}),r),n=0;n<a.length;n++)i(a[n])}function T(t,n){try{var o=n.ownerDocument,r=o.__CE_registry,i=r&&(o.defaultView||o.__CE_isImportDocument)?W(r,n.localName):void 0;if(i&&void 0===n.__CE_state){i.constructionStack.push(n);try{try{if(new i.constructorFunction!==n)throw Error("The custom element constructor did not produce the element being upgraded.")}finally{i.constructionStack.pop()}}catch(t){throw n.__CE_state=2,t}if(n.__CE_state=1,n.__CE_definition=i,i.attributeChangedCallback&&n.hasAttributes()){var a=i.observedAttributes;for(i=0;i<a.length;i++){var l=a[i],c=n.getAttribute(l);null!==c&&t.attributeChangedCallback(n,l,null,c,null)}}J(n)&&t.connectedCallback(n)}}catch(t){X(t)}}function va(o,r,i,a){var l=r.__CE_registry;if(l&&(null===a||"http://www.w3.org/1999/xhtml"===a)&&(l=W(l,i)))try{var c=new l.constructorFunction;if(void 0===c.__CE_state||void 0===c.__CE_definition)throw Error("Failed to construct '"+i+"': The returned value was not constructed with the HTMLElement constructor.");if("http://www.w3.org/1999/xhtml"!==c.namespaceURI)throw Error("Failed to construct '"+i+"': The constructed element's namespace must be the HTML namespace.");if(c.hasAttributes())throw Error("Failed to construct '"+i+"': The constructed element must not have any attributes.");if(null!==c.firstChild)throw Error("Failed to construct '"+i+"': The constructed element must not have any children.");if(null!==c.parentNode)throw Error("Failed to construct '"+i+"': The constructed element must not have a parent node.");if(c.ownerDocument!==r)throw Error("Failed to construct '"+i+"': The constructed element's owner document is incorrect.");if(c.localName!==i)throw Error("Failed to construct '"+i+"': The constructed element's local name is incorrect.");return c}catch(l){return X(l),r=null===a?t.call(r,i):n.call(r,a,i),Object.setPrototypeOf(r,HTMLUnknownElement.prototype),r.__CE_state=2,r.__CE_definition=void 0,R(o,r),r}return R(o,r=null===a?t.call(r,i):n.call(r,a,i)),r}function X(t){var n="",o="",r=0,i=0;t instanceof Error?(n=t.message,o=t.sourceURL||t.fileName||"",r=t.line||t.lineNumber||0,i=t.column||t.columnNumber||0):n="Uncaught "+String(t);var a=void 0;void 0===ErrorEvent.prototype.initErrorEvent?a=new ErrorEvent("error",{cancelable:!0,message:n,filename:o,lineno:r,colno:i,error:t}):((a=document.createEvent("ErrorEvent")).initErrorEvent("error",!1,!0,n,o,r),a.preventDefault=function(){Object.defineProperty(this,"defaultPrevented",{configurable:!0,get:function(){return!0}})}),void 0===a.error&&Object.defineProperty(a,"error",{configurable:!0,enumerable:!0,get:function(){return t}}),window.dispatchEvent(a),a.defaultPrevented||console.error(t)}function wa(){var t=this;this.g=void 0,this.F=new Promise((function(n){t.l=n}))}function xa(t){var n=document;this.l=void 0,this.h=t,this.g=n,V(this.h,this.g),"loading"===this.g.readyState&&(this.l=new MutationObserver(this.G.bind(this)),this.l.observe(this.g,{childList:!0,subtree:!0}))}function ya(t){t.l&&t.l.disconnect()}function Y(t){this.s=new Map,this.u=new Map,this.C=new Map,this.A=!1,this.B=new Map,this.o=function(t){return t()},this.i=!1,this.v=[],this.h=t,this.D=t.I?new xa(t):void 0}function za(t,n){if(!ra(n))throw new SyntaxError("The element name '"+n+"' is not valid.");if(W(t,n))throw Error("A custom element with name '"+n+"' has already been defined.");if(t.A)throw Error("A custom element is already being defined.")}function Ba(t,n,o){var r;t.A=!0;try{var i=o.prototype;if(!(i instanceof Object))throw new TypeError("The custom element constructor's prototype is not an object.");var e=function(t){var n=i[t];if(void 0!==n&&!(n instanceof Function))throw Error("The '"+t+"' callback must be a function.");return n},a=e("connectedCallback"),l=e("disconnectedCallback"),c=e("adoptedCallback"),s=(r=e("attributeChangedCallback"))&&o.observedAttributes||[]}catch(t){throw t}finally{t.A=!1}return o={localName:n,constructorFunction:o,connectedCallback:a,disconnectedCallback:l,adoptedCallback:c,attributeChangedCallback:r,observedAttributes:s,constructionStack:[]},t.u.set(n,o),t.C.set(o.constructorFunction,o),o}function Aa(t){if(!1!==t.i){t.i=!1;for(var n=[],o=t.v,r=new Map,i=0;i<o.length;i++)r.set(o[i],[]);for(V(t.h,document,{upgrade:function(o){if(void 0===o.__CE_state){var i=o.localName,a=r.get(i);a?a.push(o):t.u.has(i)&&n.push(o)}}}),i=0;i<n.length;i++)T(t.h,n[i]);for(i=0;i<o.length;i++){for(var a=o[i],l=r.get(a),c=0;c<l.length;c++)T(t.h,l[c]);(a=t.B.get(a))&&a.resolve(void 0)}o.length=0}}function W(t,n){var o=t.u.get(n);if(o)return o;if(o=t.s.get(n)){t.s.delete(n);try{return Ba(t,n,o())}catch(t){X(t)}}}function Z(t,n,o){function f(n){return function(o){for(var r=[],i=0;i<arguments.length;++i)r[i]=arguments[i];i=[];for(var a=[],l=0;l<r.length;l++){var c=r[l];if(c instanceof Element&&J(c)&&a.push(c),c instanceof DocumentFragment)for(c=c.firstChild;c;c=c.nextSibling)i.push(c);else i.push(c)}for(n.apply(this,r),r=0;r<a.length;r++)U(t,a[r]);if(J(this))for(r=0;r<i.length;r++)(a=i[r])instanceof Element&&S(t,a)}}void 0!==o.prepend&&(n.prepend=f(o.prepend)),void 0!==o.append&&(n.append=f(o.append))}function Ea(t){function b(n,o){Object.defineProperty(n,"innerHTML",{enumerable:o.enumerable,configurable:!0,get:o.get,set:function(n){var r=this,i=void 0;if(J(this)&&(i=[],P(t,this,(function(t){t!==r&&i.push(t)}))),o.set.call(this,n),i)for(var a=0;a<i.length;a++){var l=i[a];1===l.__CE_state&&t.disconnectedCallback(l)}return this.ownerDocument.__CE_registry?V(t,this):Q(t,this),n}})}function d(n,o){n.insertAdjacentElement=function(n,r){var i=J(r);return n=o.call(this,n,r),i&&U(t,r),J(n)&&S(t,r),n}}function f(n,o){function g(n,o){for(var r=[];n!==o;n=n.nextSibling)r.push(n);for(o=0;o<r.length;o++)V(t,r[o])}n.insertAdjacentHTML=function(t,n){if("beforebegin"===(t=t.toLowerCase())){var r=this.previousSibling;o.call(this,t,n),g(r||this.parentNode.firstChild,this)}else if("afterbegin"===t)r=this.firstChild,o.call(this,t,n),g(this.firstChild,r);else if("beforeend"===t)r=this.lastChild,o.call(this,t,n),g(r||this.firstChild,null);else{if("afterend"!==t)throw new SyntaxError("The value provided ("+String(t)+") is not one of 'beforebegin', 'afterbegin', 'beforeend', or 'afterend'.");r=this.nextSibling,o.call(this,t,n),g(this.nextSibling,r)}}}y&&(Element.prototype.attachShadow=function(n){if(n=y.call(this,n),t.j&&!n.__CE_patched){n.__CE_patched=!0;for(var o=0;o<t.m.length;o++)t.m[o](n)}return this.__CE_shadowRoot=n}),w&&w.get?b(Element.prototype,w):q&&q.get?b(HTMLElement.prototype,q):function ua(t,n){t.j=!0,t.g.push(n)}(t,(function(t){b(t,{enumerable:!0,configurable:!0,get:function(){return c.call(this,!0).innerHTML},set:function(t){var o="template"===this.localName,r=o?this.content:this,i=n.call(document,this.namespaceURI,this.localName);for(i.innerHTML=t;0<r.childNodes.length;)h.call(r,r.childNodes[0]);for(t=o?i.content:i;0<t.childNodes.length;)s.call(r,t.childNodes[0])}})})),Element.prototype.setAttribute=function(n,o){if(1!==this.__CE_state)return E.call(this,n,o);var r=v.call(this,n);E.call(this,n,o),o=v.call(this,n),t.attributeChangedCallback(this,n,r,o,null)},Element.prototype.setAttributeNS=function(n,o,r){if(1!==this.__CE_state)return k.call(this,n,o,r);var i=D.call(this,n,o);k.call(this,n,o,r),r=D.call(this,n,o),t.attributeChangedCallback(this,o,i,r,n)},Element.prototype.removeAttribute=function(n){if(1!==this.__CE_state)return _.call(this,n);var o=v.call(this,n);_.call(this,n),null!==o&&t.attributeChangedCallback(this,n,o,null,null)},C&&(Element.prototype.toggleAttribute=function(n,o){if(1!==this.__CE_state)return C.call(this,n,o);var r=v.call(this,n);return null!==r!==(o=C.call(this,n,o))&&t.attributeChangedCallback(this,n,r,o?"":null,null),o}),Element.prototype.removeAttributeNS=function(n,o){if(1!==this.__CE_state)return A.call(this,n,o);var r=D.call(this,n,o);A.call(this,n,o);var i=D.call(this,n,o);r!==i&&t.attributeChangedCallback(this,o,r,i,n)},$?d(HTMLElement.prototype,$):F&&d(Element.prototype,F),tt?f(HTMLElement.prototype,tt):O&&f(Element.prototype,O),Z(t,Element.prototype,{prepend:j,append:x}),function Da(t){function b(n){return function(o){for(var r=[],i=0;i<arguments.length;++i)r[i]=arguments[i];i=[];for(var a=[],l=0;l<r.length;l++){var c=r[l];if(c instanceof Element&&J(c)&&a.push(c),c instanceof DocumentFragment)for(c=c.firstChild;c;c=c.nextSibling)i.push(c);else i.push(c)}for(n.apply(this,r),r=0;r<a.length;r++)U(t,a[r]);if(J(this))for(r=0;r<i.length;r++)(a=i[r])instanceof Element&&S(t,a)}}var n=Element.prototype;void 0!==H&&(n.before=b(H)),void 0!==I&&(n.after=b(I)),void 0!==B&&(n.replaceWith=function(n){for(var o=[],r=0;r<arguments.length;++r)o[r]=arguments[r];r=[];for(var i=[],a=0;a<o.length;a++){var l=o[a];if(l instanceof Element&&J(l)&&i.push(l),l instanceof DocumentFragment)for(l=l.firstChild;l;l=l.nextSibling)r.push(l);else r.push(l)}for(a=J(this),B.apply(this,o),o=0;o<i.length;o++)U(t,i[o]);if(a)for(U(t,this),o=0;o<r.length;o++)(i=r[o])instanceof Element&&S(t,i)}),void 0!==z&&(n.remove=function(){var n=J(this);z.call(this),n&&U(t,this)})}(t)}N.prototype.connectedCallback=function(t){var n=t.__CE_definition;if(n.connectedCallback)try{n.connectedCallback.call(t)}catch(t){X(t)}},N.prototype.disconnectedCallback=function(t){var n=t.__CE_definition;if(n.disconnectedCallback)try{n.disconnectedCallback.call(t)}catch(t){X(t)}},N.prototype.attributeChangedCallback=function(t,n,o,r,i){var a=t.__CE_definition;if(a.attributeChangedCallback&&-1<a.observedAttributes.indexOf(n))try{a.attributeChangedCallback.call(t,n,o,r,i)}catch(t){X(t)}},wa.prototype.resolve=function(t){if(this.g)throw Error("Already resolved.");this.g=t,this.l(t)},xa.prototype.G=function(t){var n=this.g.readyState;for("interactive"!==n&&"complete"!==n||ya(this),n=0;n<t.length;n++)for(var o=t[n].addedNodes,r=0;r<o.length;r++)V(this.h,o[r])},Y.prototype.H=function(t,n){var o=this;if(!(n instanceof Function))throw new TypeError("Custom element constructor getters must be functions.");za(this,t),this.s.set(t,n),this.v.push(t),this.i||(this.i=!0,this.o((function(){return Aa(o)})))},Y.prototype.define=function(t,n){var o=this;if(!(n instanceof Function))throw new TypeError("Custom element constructors must be functions.");za(this,t),Ba(this,t,n),this.v.push(t),this.i||(this.i=!0,this.o((function(){return Aa(o)})))},Y.prototype.upgrade=function(t){V(this.h,t)},Y.prototype.get=function(t){if(t=W(this,t))return t.constructorFunction},Y.prototype.whenDefined=function(t){if(!ra(t))return Promise.reject(new SyntaxError("'"+t+"' is not a valid custom element name."));var n=this.B.get(t);if(n)return n.F;n=new wa,this.B.set(t,n);var o=this.u.has(t)||this.s.has(t);return t=-1===this.v.indexOf(t),o&&t&&n.resolve(void 0),n.F},Y.prototype.polyfillWrapFlushCallback=function(t){this.D&&ya(this.D);var n=this.o;this.o=function(o){return t((function(){return n(o)}))}},Y.prototype.define=Y.prototype.define,Y.prototype.upgrade=Y.prototype.upgrade,Y.prototype.get=Y.prototype.get,Y.prototype.whenDefined=Y.prototype.whenDefined,Y.prototype.polyfillDefineLazy=Y.prototype.H,Y.prototype.polyfillWrapFlushCallback=Y.prototype.polyfillWrapFlushCallback;var ot={};var rt=window.customElements;function Ia(){var n=new N;!function Ga(n){function b(){var o=this.constructor,r=document.__CE_registry.C.get(o);if(!r)throw Error("Failed to construct a custom element: The constructor was not registered with `customElements`.");var i=r.constructionStack;if(0===i.length)return i=t.call(document,r.localName),Object.setPrototypeOf(i,o.prototype),i.__CE_state=1,i.__CE_definition=r,R(n,i),i;var a=i.length-1,l=i[a];if(l===ot)throw Error("Failed to construct '"+r.localName+"': This element was already constructed.");return i[a]=ot,Object.setPrototypeOf(l,o.prototype),R(n,l),l}b.prototype=G.prototype,Object.defineProperty(HTMLElement.prototype,"constructor",{writable:!0,configurable:!0,enumerable:!1,value:b}),window.HTMLElement=b}(n),function Ca(t){Document.prototype.createElement=function(n){return va(t,this,n,null)},Document.prototype.importNode=function(n,r){return n=o.call(this,n,!!r),this.__CE_registry?V(t,n):Q(t,n),n},Document.prototype.createElementNS=function(n,o){return va(t,this,o,n)},Z(t,Document.prototype,{prepend:r,append:i})}(n),Z(n,DocumentFragment.prototype,{prepend:a,append:l}),function Ha(t){function b(n,o){Object.defineProperty(n,"textContent",{enumerable:o.enumerable,configurable:!0,get:o.get,set:function(n){if(this.nodeType===Node.TEXT_NODE)o.set.call(this,n);else{var r=void 0;if(this.firstChild){var i=this.childNodes,a=i.length;if(0<a&&J(this)){r=Array(a);for(var l=0;l<a;l++)r[l]=i[l]}}if(o.set.call(this,n),r)for(n=0;n<r.length;n++)U(t,r[n])}}})}Node.prototype.insertBefore=function(n,o){if(n instanceof DocumentFragment){var r=K(n);if(n=u.call(this,n,o),J(this))for(o=0;o<r.length;o++)S(t,r[o]);return n}return r=n instanceof Element&&J(n),o=u.call(this,n,o),r&&U(t,n),J(this)&&S(t,n),o},Node.prototype.appendChild=function(n){if(n instanceof DocumentFragment){var o=K(n);if(n=s.call(this,n),J(this))for(var r=0;r<o.length;r++)S(t,o[r]);return n}return o=n instanceof Element&&J(n),r=s.call(this,n),o&&U(t,n),J(this)&&S(t,n),r},Node.prototype.cloneNode=function(n){return n=c.call(this,!!n),this.ownerDocument.__CE_registry?V(t,n):Q(t,n),n},Node.prototype.removeChild=function(n){var o=n instanceof Element&&J(n),r=h.call(this,n);return o&&U(t,n),r},Node.prototype.replaceChild=function(n,o){if(n instanceof DocumentFragment){var r=K(n);if(n=p.call(this,n,o),J(this))for(U(t,o),o=0;o<r.length;o++)S(t,r[o]);return n}r=n instanceof Element&&J(n);var i=p.call(this,n,o),a=J(this);return a&&U(t,o),r&&U(t,n),a&&S(t,n),i},m&&m.get?b(Node.prototype,m):function ta(t,n){t.j=!0,t.m.push(n)}(t,(function(t){b(t,{enumerable:!0,configurable:!0,get:function(){for(var t=[],n=this.firstChild;n;n=n.nextSibling)n.nodeType!==Node.COMMENT_NODE&&t.push(n.textContent);return t.join("")},set:function(t){for(;this.firstChild;)h.call(this,this.firstChild);null!=t&&""!==t&&s.call(this,document.createTextNode(t))}})}))}(n),Ea(n),window.CustomElementRegistry=Y,n=new Y(n),document.__CE_registry=n,Object.defineProperty(window,"customElements",{configurable:!0,enumerable:!0,value:n})}rt&&!rt.forcePolyfill&&"function"==typeof rt.define&&"function"==typeof rt.get||Ia(),window.__CE_installPolyfill=Ia}).call(this);