site/node_modules/preact-render-to-string/dist/jsx-entry.js
2024-10-14 08:09:33 +02:00

3 lines
11 KiB
JavaScript

var t=require("preact");if("function"!=typeof Symbol){var e=0;Symbol=function(t){return"@@"+t+ ++e},Symbol.for=function(t){return"@@"+t}}var n=/^(?:area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,r=/[\s\n\\/='"\0<>]/,o=/^(xlink|xmlns|xml)([A-Z])/,i=/^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]/,a=/^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/,c=/["&<]/;function l(t){if(0===t.length||!1===c.test(t))return t;for(var e=0,n=0,r="",o="";n<t.length;n++){switch(t.charCodeAt(n)){case 34:o="&quot;";break;case 38:o="&amp;";break;case 60:o="&lt;";break;default:continue}n!==e&&(r+=t.slice(e,n)),r+=o,e=n+1}return n!==e&&(r+=t.slice(e,n)),r}var s=function(t,e){return String(t).replace(/(\n+)/g,"$1"+(e||"\t"))},u=function(t,e,n){return String(t).length>(e||40)||!n&&-1!==String(t).indexOf("\n")||-1!==String(t).indexOf("<")},f={},p=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"]),d=/[A-Z]/g;function g(t){var e="";for(var n in t){var r=t[n];if(null!=r&&""!==r){var o="-"==n[0]?n:f[n]||(f[n]=n.replace(d,"-$&").toLowerCase()),i=";";"number"!=typeof r||o.startsWith("--")||p.has(o)||(i="px;"),e=e+o+":"+r+i}}return e||void 0}function y(t,e){return Array.isArray(e)?e.reduce(y,t):null!=e&&!1!==e&&t.push(e),t}function b(){this.__d=!0}function v(t,e){return{__v:t,context:e,props:t.props,setState:b,forceUpdate:b,__d:!0,__h:[]}}var m=[],h=[];function _(e,n,r,o){var i=t.options.__s;t.options.__s=!0;try{return x(e,n||{},r,o)}finally{t.options.__c&&t.options.__c(e,h),t.options.__s=i,h.length=0}}function x(e,c,f,p,d,b){if(null==e||"boolean"==typeof e)return"";if("object"!=typeof e)return"function"==typeof e?"":l(e+"");var m=f.pretty,h=m&&"string"==typeof m?m:"\t";if(Array.isArray(e)){for(var _="",S=0;S<e.length;S++)m&&S>0&&(_+="\n"),_+=x(e[S],c,f,p,d,b);return _}if(void 0!==e.constructor)return"";t.options.__b&&t.options.__b(e);var k,w=e.type,A=e.props,O=!1;if("function"==typeof w){if(O=!0,!f.shallow||!p&&!1!==f.renderRootComponent){if(w===t.Fragment){var C=[];return y(C,e.props.children),x(C,c,f,!1!==f.shallowHighOrder,d,b)}var F,E=e.__c=v(e,c),$=t.options.__r,H=c,L=w.contextType;if(null!=L){var M=c[L.__c];H=M?M.props.value:L.__}if(w.prototype&&"function"==typeof w.prototype.render)(E=e.__c=new w(A,H)).__v=e,E._dirty=E.__d=!0,E.props=A,null==E.state&&(E.state={}),null==E._nextState&&null==E.__s&&(E._nextState=E.__s=E.state),E.context=H,w.getDerivedStateFromProps?E.state=Object.assign({},E.state,w.getDerivedStateFromProps(E.props,E.state)):E.componentWillMount&&(E.componentWillMount(),E.state=E._nextState!==E.state?E._nextState:E.__s!==E.state?E.__s:E.state),$&&$(e),F=E.render(E.props,E.state,E.context);else for(var I=0;E.__d&&I++<25;)E.__d=!1,$&&$(e),F=w.call(e.__c,A,H);E.getChildContext&&(c=Object.assign({},c,E.getChildContext()));var N=x(F,c,f,!1!==f.shallowHighOrder,d,b);return t.options.diffed&&t.options.diffed(e),N}w=(k=w).displayName||k!==Function&&k.name||j(k)}var D,W,U="<"+w;if(A){var Z=Object.keys(A);f&&!0===f.sortAttributes&&Z.sort();for(var P=0;P<Z.length;P++){var R=Z[P],T=A[R];if("children"!==R){if(!r.test(R)&&(f&&f.allAttributes||"key"!==R&&"ref"!==R&&"__self"!==R&&"__source"!==R)){if("defaultValue"===R)R="value";else if("defaultChecked"===R)R="checked";else if("defaultSelected"===R)R="selected";else if("className"===R){if(void 0!==A.class)continue;R="class"}else"acceptCharset"===R?R="accept-charset":"httpEquiv"===R?R="http-equiv":o.test(R)?R=R.replace(o,"$1:$2").toLowerCase():d?a.test(R)&&(R="panose1"===R?"panose-1":R.replace(/([A-Z])/g,"-$1").toLowerCase()):i.test(R)&&(R=R.toLowerCase());if("htmlFor"===R){if(A.for)continue;R="for"}"style"===R&&T&&"object"==typeof T&&(T=g(T)),"a"===R[0]&&"r"===R[1]&&"boolean"==typeof T&&(T=String(T));var q=f.attributeHook&&f.attributeHook(R,T,c,f,O);if(q||""===q)U+=q;else if("dangerouslySetInnerHTML"===R)W=T&&T.__html;else if("textarea"===w&&"value"===R)D=T;else if((T||0===T||""===T)&&"function"!=typeof T){if(!(!0!==T&&""!==T||(T=R,f&&f.xml))){U=U+" "+R;continue}if("value"===R){if("select"===w){b=T;continue}"option"===w&&b==T&&void 0===A.selected&&(U+=" selected")}U=U+" "+R+'="'+l(T+"")+'"'}}}else D=T}}if(m){var z=U.replace(/\n\s*/," ");z===U||~z.indexOf("\n")?m&&~U.indexOf("\n")&&(U+="\n"):U=z}if(U+=">",r.test(w))throw new Error(w+" is not a valid HTML tag name in "+U);var J,V=n.test(w)||f.voidElements&&f.voidElements.test(w),B=[];if(W)m&&u(W)&&(W="\n"+h+s(W,h)),U+=W;else if(null!=D&&y(J=[],D).length){for(var G=m&&~U.indexOf("\n"),K=!1,Q=0;Q<J.length;Q++){var X=J[Q];if(null!=X&&!1!==X){var Y=x(X,c,f,!0,"svg"===w||"foreignObject"!==w&&d,b);if(m&&!G&&u(Y)&&(G=!0),Y)if(m){var tt=Y.length>0&&"<"!=Y[0];K&&tt?B[B.length-1]+=Y:B.push(Y),K=tt}else B.push(Y)}}if(m&&G)for(var et=B.length;et--;)B[et]="\n"+h+s(B[et],h)}if(t.options.diffed&&t.options.diffed(e),B.length||W)U+=B.join("");else if(f&&f.xml)return U.substring(0,U.length-1)+" />";return!V||J||W?(m&&~U.indexOf("\n")&&(U+="\n"),U=U+"</"+w+">"):U=U.replace(/>$/," />"),U}function j(t){var e=(Function.prototype.toString.call(t).match(/^\s*function\s+([^( ]+)/)||"")[1];if(!e){for(var n=-1,r=m.length;r--;)if(m[r]===t){n=r;break}n<0&&(n=m.push(t)-1),e="UnnamedComponent"+n}return e}var S=/(\\|\"|\')/g,k=function(t){return t.replace(S,"\\$1")},w=Object.prototype.toString,A=Date.prototype.toISOString,O=Error.prototype.toString,C=RegExp.prototype.toString,F=Symbol.prototype.toString,E=/^Symbol\((.*)\)(.*)$/,$=/\n/gi,H=Object.getOwnPropertySymbols||function(t){return[]};function L(t){return"[object Array]"===t||"[object ArrayBuffer]"===t||"[object DataView]"===t||"[object Float32Array]"===t||"[object Float64Array]"===t||"[object Int8Array]"===t||"[object Int16Array]"===t||"[object Int32Array]"===t||"[object Uint8Array]"===t||"[object Uint8ClampedArray]"===t||"[object Uint16Array]"===t||"[object Uint32Array]"===t}function M(t){return t!=+t?"NaN":0===t&&1/t<0?"-0":""+t}function I(t){return""===t.name?"[Function anonymous]":"[Function "+t.name+"]"}function N(t){return F.call(t).replace(E,"Symbol($1)")}function D(t){return"["+O.call(t)+"]"}function W(t){if(!0===t||!1===t)return""+t;if(void 0===t)return"undefined";if(null===t)return"null";var e=typeof t;if("number"===e)return M(t);if("string"===e)return'"'+k(t)+'"';if("function"===e)return I(t);if("symbol"===e)return N(t);var n=w.call(t);return"[object WeakMap]"===n?"WeakMap {}":"[object WeakSet]"===n?"WeakSet {}":"[object Function]"===n||"[object GeneratorFunction]"===n?I(t,min):"[object Symbol]"===n?N(t):"[object Date]"===n?A.call(t):"[object Error]"===n?D(t):"[object RegExp]"===n?C.call(t):"[object Arguments]"===n&&0===t.length?"Arguments []":L(n)&&0===t.length?t.constructor.name+" []":t instanceof Error&&D(t)}function U(t,e,n,r,o,i,a,c,l,s){var u="";if(t.length){u+=o;for(var f=n+e,p=0;p<t.length;p++)u+=f+V(t[p],e,f,r,o,i,a,c,l,s),p<t.length-1&&(u+=","+r);u+=o+n}return"["+u+"]"}function Z(t,e,n,r,o,i,a,c,l,s){return(s?"":"Arguments ")+U(t,e,n,r,o,i,a,c,l,s)}function P(t,e,n,r,o,i,a,c,l,s){return(s?"":t.constructor.name+" ")+U(t,e,n,r,o,i,a,c,l,s)}function R(t,e,n,r,o,i,a,c,l,s){var u="Map {",f=t.entries(),p=f.next();if(!p.done){u+=o;for(var d=n+e;!p.done;)u+=d+V(p.value[0],e,d,r,o,i,a,c,l,s)+" => "+V(p.value[1],e,d,r,o,i,a,c,l,s),(p=f.next()).done||(u+=","+r);u+=o+n}return u+"}"}function T(t,e,n,r,o,i,a,c,l,s){var u=(s?"":t.constructor?t.constructor.name+" ":"Object ")+"{",f=Object.keys(t).sort(),p=H(t);if(p.length&&(f=f.filter(function(t){return!("symbol"==typeof t||"[object Symbol]"===w.call(t))}).concat(p)),f.length){u+=o;for(var d=n+e,g=0;g<f.length;g++){var y=f[g];u+=d+V(y,e,d,r,o,i,a,c,l,s)+": "+V(t[y],e,d,r,o,i,a,c,l,s),g<f.length-1&&(u+=","+r)}u+=o+n}return u+"}"}function q(t,e,n,r,o,i,a,c,l,s){var u="Set {",f=t.entries(),p=f.next();if(!p.done){u+=o;for(var d=n+e;!p.done;)u+=d+V(p.value[1],e,d,r,o,i,a,c,l,s),(p=f.next()).done||(u+=","+r);u+=o+n}return u+"}"}function z(t,e,n,r,o,i,a,c,l,s){if((i=i.slice()).indexOf(t)>-1)return"[Circular]";i.push(t);var u=++c>a;if(!u&&t.toJSON&&"function"==typeof t.toJSON)return V(t.toJSON(),e,n,r,o,i,a,c,l,s);var f=w.call(t);return"[object Arguments]"===f?u?"[Arguments]":Z(t,e,n,r,o,i,a,c,l,s):L(f)?u?"[Array]":P(t,e,n,r,o,i,a,c,l,s):"[object Map]"===f?u?"[Map]":R(t,e,n,r,o,i,a,c,l,s):"[object Set]"===f?u?"[Set]":q(t,e,n,r,o,i,a,c,l,s):"object"==typeof t?u?"[Object]":T(t,e,n,r,o,i,a,c,l,s):void 0}function J(t,e,n,r,o,i,a,c,l,s){for(var u,f=!1,p=0;p<l.length;p++)if((u=l[p]).test(t)){f=!0;break}return!!f&&u.print(t,function(t){return V(t,e,n,r,o,i,a,c,l,s)},function(t){var r=n+e;return r+t.replace($,"\n"+r)},{edgeSpacing:o,spacing:r})}function V(t,e,n,r,o,i,a,c,l,s){return W(t)||J(t,e,n,r,o,i,a,c,l,s)||z(t,e,n,r,o,i,a,c,l,s)}var B={indent:2,min:!1,maxDepth:Infinity,plugins:[]};function G(t){if(Object.keys(t).forEach(function(t){if(!B.hasOwnProperty(t))throw new Error("prettyFormat: Invalid option: "+t)}),t.min&&void 0!==t.indent&&0!==t.indent)throw new Error("prettyFormat: Cannot run with min option and indent")}function K(t){var e={};return Object.keys(B).forEach(function(n){return e[n]=t.hasOwnProperty(n)?t[n]:B[n]}),e.min&&(e.indent=0),e}function Q(t){return new Array(t+1).join(" ")}var X=function(t,e){var n,r;e?(G(e),e=K(e)):e=B;var o=e.min?" ":"\n",i=e.min?"":"\n";if(e&&e.plugins.length){var a=J(t,n=Q(e.indent),"",o,i,r=[],e.maxDepth,0,e.plugins,e.min);if(a)return a}return W(t)||(n||(n=Q(e.indent)),r||(r=[]),z(t,n,"",o,i,r,e.maxDepth,0,e.plugins,e.min))},Y={test:function(t){return t&&"object"==typeof t&&"type"in t&&"props"in t&&"key"in t},print:function(t,e,n){return _(t,Y.context,Y.opts,!0)}},tt={plugins:[Y]},et={attributeHook:function(t,e,n,r,o){var i=typeof e;if("dangerouslySetInnerHTML"===t)return!1;if(null==e||"function"===i&&!r.functions)return"";if(r.skipFalseAttributes&&!o&&(!1===e||("class"===t||"style"===t)&&""===e))return"";var a="string"==typeof r.pretty?r.pretty:"\t";return"string"!==i?("function"!==i||r.functionNames?(Y.context=n,Y.opts=r,~(e=X(e,tt)).indexOf("\n")&&(e=s("\n"+e,a)+"\n")):e="Function",s("\n"+t+"={"+e+"}",a)):"\n"+a+t+'="'+l(e)+'"'},jsx:!0,xml:!1,functions:!0,functionNames:!0,skipFalseAttributes:!0,pretty:" "};function nt(t,e,n){var r=Object.assign({},et,n||{});return r.jsx||(r.attributeHook=null),_(t,e,r)}var rt={shallow:!0};exports.default=nt,exports.render=nt,exports.shallowRender=function(t,e,n){return nt(t,e,Object.assign({},rt,n||{}))};
//# sourceMappingURL=jsx.js.map