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

3 lines
11 KiB
JavaScript

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