3 lines
8.2 KiB
JavaScript
3 lines
8.2 KiB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("preact")):"function"==typeof define&&define.amd?define(["exports","preact"],t):t((e||self).preactRenderToString={},e.preact)}(this,function(e,t){var n=/[\s\n\\/='"\0<>]/,r=/^(xlink|xmlns|xml)([A-Z])/,o=/^accessK|^auto[A-Z]|^ch|^col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|readO|rowS|spellC|src[A-Z]|tabI|item[A-Z]/,i=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,a=/["&<]/;function s(e){if(0===e.length||!1===a.test(e))return e;for(var t=0,n=0,r="",o="";n<e.length;n++){switch(e.charCodeAt(n)){case 34:o=""";break;case 38:o="&";break;case 60:o="<";break;default:continue}n!==t&&(r+=e.slice(t,n)),r+=o,t=n+1}return n!==t&&(r+=e.slice(t,n)),r}var c={},l=new Set(["animation-iteration-count","border-image-outset","border-image-slice","border-image-width","box-flex","box-flex-group","box-ordinal-group","column-count","fill-opacity","flex","flex-grow","flex-negative","flex-order","flex-positive","flex-shrink","flood-opacity","font-weight","grid-column","grid-row","line-clamp","line-height","opacity","order","orphans","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","widows","z-index","zoom"]),u=/[A-Z]/g;function f(e){var t="";for(var n in e){var r=e[n];if(null!=r&&""!==r){var o="-"==n[0]?n:c[n]||(c[n]=n.replace(u,"-$&").toLowerCase()),i=";";"number"!=typeof r||o.startsWith("--")||l.has(o)||(i="px;"),t=t+o+":"+r+i}}return t||void 0}function p(e,t,n){if(!e.s){if(n instanceof h){if(!n.s)return void(n.o=p.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(p.bind(null,e,t),p.bind(null,e,2));e.s=t,e.v=n;const r=e.o;r&&r(e)}}var h=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){var r=new e,o=this.s;if(o){var i=1&o?t:n;if(i){try{p(r,1,i(this.v))}catch(e){p(r,2,e)}return r}return this}return this.o=function(e){try{var o=e.v;1&e.s?p(r,1,t?t(o):o):n?p(r,1,n(o)):p(r,2,o)}catch(e){p(r,2,e)}},r},e}();function d(e){return e instanceof h&&1&e.s}function _(e,t,n){for(var r;;){var o=e();if(d(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!d(i)){r=1;break}i=i.s}if(t){var a=t();if(a&&a.then&&!d(a)){r=2;break}}}var s=new h,c=p.bind(null,s,2);return(0===r?o.then(u):1===r?i.then(l):a.then(f)).then(void 0,c),s;function l(r){i=r;do{if(t&&(a=t())&&a.then&&!d(a))return void a.then(f).then(void 0,c);if(!(o=e())||d(o)&&!o.v)return void p(s,1,i);if(o.then)return void o.then(u).then(void 0,c);d(i=n())&&(i=i.v)}while(!i||!i.then);i.then(l).then(void 0,c)}function u(e){e?(i=n())&&i.then?i.then(l).then(void 0,c):l(i):p(s,1,i)}function f(){(o=e())?o.then?o.then(u).then(void 0,c):u(o):p(s,1,i)}}function v(e,t){try{var n=e()}catch(e){return t(!0,e)}return n&&n.then?n.then(t.bind(null,!1),t.bind(null,!0)):t(!1,n)}var m,y,g,b,k=[],x=Array.isArray,w=Object.assign;function A(e,n){var r=t.options.__s;t.options.__s=!0,m=t.options.__b,y=t.options.diffed,g=t.options.__r,b=t.options.unmount;var o=t.h(t.Fragment,null);o.__k=[e];try{return F(e,n||S,!1,void 0,o,!1)}catch(e){if(e.then)throw new Error('Use "renderToStringAsync" for suspenseful rendering.');throw e}finally{t.options.__c&&t.options.__c(e,k),t.options.__s=r,k.length=0}}function C(){this.__d=!0}var S={};function T(e,t){var n,r=e.type,o=!0;return e.__c?(o=!1,(n=e.__c).state=n.__s):n=new r(e.props,t),e.__c=n,n.__v=e,n.props=e.props,n.context=t,n.__d=!0,null==n.state&&(n.state=S),null==n.__s&&(n.__s=n.state),r.getDerivedStateFromProps?n.state=w({},n.state,r.getDerivedStateFromProps(n.props,n.state)):o&&n.componentWillMount?(n.componentWillMount(),n.state=n.__s!==n.state?n.__s:n.state):!o&&n.componentWillUpdate&&n.componentWillUpdate(),g&&g(e),n.render(n.props,n.state,t)}function F(e,a,c,l,u,p){if(null==e||!0===e||!1===e||""===e)return"";if("object"!=typeof e)return"function"==typeof e?"":s(e+"");if(x(e)){var h,d="";u.__k=e;for(var _=0;_<e.length;_++){var v=e[_];if(null!=v&&"boolean"!=typeof v){var k,A=F(v,a,c,l,u,p);"string"==typeof A?d+=A:(h=h||[],d&&h.push(d),d="",Array.isArray(A)?(k=h).push.apply(k,A):h.push(A))}}return h?(d&&h.push(d),h):d}if(void 0!==e.constructor)return"";e.__=u,m&&m(e);var S,j,D,E=e.type,P=e.props,U=a;if("function"==typeof E){if(E===t.Fragment){if(P.tpl){for(var Z="",M=0;M<P.tpl.length;M++)if(Z+=P.tpl[M],P.exprs&&M<P.exprs.length){var W=P.exprs[M];if(null==W)continue;"object"!=typeof W||void 0!==W.constructor&&!x(W)?Z+=W:Z+=F(W,a,c,l,e,p)}return Z}if(P.UNSTABLE_comment)return"\x3c!--"+s(P.UNSTABLE_comment||"")+"--\x3e";j=P.children}else{if(null!=(S=E.contextType)){var $=a[S.__c];U=$?$.props.value:S.__}if(E.prototype&&"function"==typeof E.prototype.render)j=T(e,U),D=e.__c;else{e.__c=D={__v:e,props:P,context:U,setState:C,forceUpdate:C,__d:!0,__h:[]};for(var q=0;D.__d&&q++<25;)D.__d=!1,g&&g(e),j=E.call(D,P,U);D.__d=!0}if(null!=D.getChildContext&&(a=w({},a,D.getChildContext())),(E.getDerivedStateFromError||D.componentDidCatch)&&t.options.errorBoundaries){var z="";j=null!=j&&j.type===t.Fragment&&null==j.key?j.props.children:j;try{return z=F(j,a,c,l,e,p)}catch(n){return E.getDerivedStateFromError&&(D.__s=E.getDerivedStateFromError(n)),D.componentDidCatch&&D.componentDidCatch(n,{}),D.__d&&(j=T(e,a),null!=(D=e.__c).getChildContext&&(a=w({},a,D.getChildContext())),z=F(j=null!=j&&j.type===t.Fragment&&null==j.key?j.props.children:j,a,c,l,e,p)),z}finally{y&&y(e),e.__=null,b&&b(e)}}}j=null!=j&&j.type===t.Fragment&&null==j.key&&null==j.props.tpl?j.props.children:j;try{var H=F(j,a,c,l,e,p);return y&&y(e),e.__=null,b&&b(e),H}catch(t){if(!p)throw t;if(!t||"function"!=typeof t.then)throw t;var B=function t(){try{return F(j,a,c,l,e,p)}catch(n){if(!n||"function"!=typeof n.then)throw n;return n.then(function(){return F(j,a,c,l,e,p)},function(){return t()})}};return t.then(function(){return B()})}}var I,N="<"+E,O="";for(var R in P){var V=P[R];switch(R){case"children":I=V;continue;case"key":case"ref":case"__self":case"__source":continue;case"htmlFor":if("for"in P)continue;R="for";break;case"className":if("class"in P)continue;R="class";break;case"defaultChecked":R="checked";break;case"defaultSelected":R="selected";break;case"defaultValue":case"value":switch(R="value",E){case"textarea":I=V;continue;case"select":l=V;continue;case"option":l!=V||"selected"in P||(N+=" selected")}break;case"dangerouslySetInnerHTML":O=V&&V.__html;continue;case"style":"object"==typeof V&&(V=f(V));break;case"acceptCharset":R="accept-charset";break;case"httpEquiv":R="http-equiv";break;default:if(r.test(R))R=R.replace(r,"$1:$2").toLowerCase();else{if(n.test(R))continue;"-"!==R[4]&&"draggable"!==R||null==V?c?i.test(R)&&(R="panose1"===R?"panose-1":R.replace(/([A-Z])/g,"-$1").toLowerCase()):o.test(R)&&(R=R.toLowerCase()):V+=""}}null!=V&&!1!==V&&"function"!=typeof V&&(N=!0===V||""===V?N+" "+R:N+" "+R+'="'+s(V+"")+'"')}if(n.test(E))throw new Error(E+" is not a valid HTML tag name in "+N+">");if(O||("string"==typeof I?O=s(I):null!=I&&!1!==I&&!0!==I&&(O=F(I,a,"svg"===E||"foreignObject"!==E&&c,l,e,p))),y&&y(e),e.__=null,b&&b(e),!O&&L.has(E))return N+"/>";var K="</"+E+">",G=N+">";return Array.isArray(O)?[G].concat(O,[K]):"string"!=typeof O?[G,O,K]:G+O+K}var L=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),j=A,D=A;e.default=A,e.render=j,e.renderToStaticMarkup=D,e.renderToString=A,e.renderToStringAsync=function(e,n){try{var r,o=t.options.__s;t.options.__s=!0,m=t.options.__b,y=t.options.diffed,g=t.options.__r,b=t.options.unmount;var i=t.h(t.Fragment,null);return i.__k=[e],Promise.resolve(v(function(){var t=F(e,n||S,!1,void 0,i,!0),o=function(){if(Array.isArray(t)){var e=function(){var e=o.join("");return r=1,e},n=0,o=t,i=_(function(){return!!o.some(function(e){return"function"==typeof e.then})&&n++<25},void 0,function(){return Promise.resolve(Promise.all(o)).then(function(e){o=e.flat()})});return i&&i.then?i.then(e):e()}}();return o&&o.then?o.then(function(e){return r?e:t}):r?o:t},function(n,r){if(t.options.__c&&t.options.__c(e,k),t.options.__s=o,k.length=0,n)throw r;return r}))}catch(e){return Promise.reject(e)}}});
|
|
//# sourceMappingURL=index.umd.js.map
|