github.com/jgarto/itcv@v0.0.0-20180826224514-4eea09c1aa0d/internal/preact/preact.inc.js (about) 1 // preact@8.1.0 2 !function() { 3 'use strict'; 4 function VNode() {} 5 function h(nodeName, attributes) { 6 var lastSimple, child, simple, i, children = EMPTY_CHILDREN; 7 for (i = arguments.length; i-- > 2; ) stack.push(arguments[i]); 8 if (attributes && null != attributes.children) { 9 if (!stack.length) stack.push(attributes.children); 10 delete attributes.children; 11 } 12 while (stack.length) if ((child = stack.pop()) && void 0 !== child.pop) for (i = child.length; i--; ) stack.push(child[i]); else { 13 if (child === !0 || child === !1) child = null; 14 if (simple = 'function' != typeof nodeName) if (null == child) child = ''; else if ('number' == typeof child) child = String(child); else if ('string' != typeof child) simple = !1; 15 if (simple && lastSimple) children[children.length - 1] += child; else if (children === EMPTY_CHILDREN) children = [ child ]; else children.push(child); 16 lastSimple = simple; 17 } 18 var p = new VNode(); 19 p.nodeName = nodeName; 20 p.children = children; 21 p.attributes = null == attributes ? void 0 : attributes; 22 p.key = null == attributes ? void 0 : attributes.key; 23 if (void 0 !== options.vnode) options.vnode(p); 24 return p; 25 } 26 function extend(obj, props) { 27 for (var i in props) obj[i] = props[i]; 28 return obj; 29 } 30 function cloneElement(vnode, props) { 31 return h(vnode.nodeName, extend(extend({}, vnode.attributes), props), arguments.length > 2 ? [].slice.call(arguments, 2) : vnode.children); 32 } 33 function enqueueRender(component) { 34 if (!component.__d && (component.__d = !0) && 1 == items.push(component)) (options.debounceRendering || setTimeout)(rerender); 35 } 36 function rerender() { 37 var p, list = items; 38 items = []; 39 while (p = list.pop()) if (p.__d) renderComponent(p); 40 } 41 function isSameNodeType(node, vnode, hydrating) { 42 if ('string' == typeof vnode || 'number' == typeof vnode) return void 0 !== node.splitText; 43 if ('string' == typeof vnode.nodeName) return !node._componentConstructor && isNamedNode(node, vnode.nodeName); else return hydrating || node._componentConstructor === vnode.nodeName; 44 } 45 function isNamedNode(node, nodeName) { 46 return node.__n === nodeName || node.nodeName.toLowerCase() === nodeName.toLowerCase(); 47 } 48 function getNodeProps(vnode) { 49 var props = extend({}, vnode.attributes); 50 props.children = vnode.children; 51 var defaultProps = vnode.nodeName.defaultProps; 52 if (void 0 !== defaultProps) for (var i in defaultProps) if (void 0 === props[i]) props[i] = defaultProps[i]; 53 return props; 54 } 55 function createNode(nodeName, isSvg) { 56 var node = isSvg ? document.createElementNS('http://www.w3.org/2000/svg', nodeName) : document.createElement(nodeName); 57 node.__n = nodeName; 58 return node; 59 } 60 function removeNode(node) { 61 if (node.parentNode) node.parentNode.removeChild(node); 62 } 63 function setAccessor(node, name, old, value, isSvg) { 64 if ('className' === name) name = 'class'; 65 if ('key' === name) ; else if ('ref' === name) { 66 if (old) old(null); 67 if (value) value(node); 68 } else if ('class' === name && !isSvg) node.className = value || ''; else if ('style' === name) { 69 if (!value || 'string' == typeof value || 'string' == typeof old) node.style.cssText = value || ''; 70 if (value && 'object' == typeof value) { 71 if ('string' != typeof old) for (var i in old) if (!(i in value)) node.style[i] = ''; 72 for (var i in value) node.style[i] = 'number' == typeof value[i] && IS_NON_DIMENSIONAL.test(i) === !1 ? value[i] + 'px' : value[i]; 73 } 74 } else if ('dangerouslySetInnerHTML' === name) { 75 if (value) node.innerHTML = value.__html || ''; 76 } else if ('o' == name[0] && 'n' == name[1]) { 77 var useCapture = name !== (name = name.replace(/Capture$/, '')); 78 name = name.toLowerCase().substring(2); 79 if (value) { 80 if (!old) node.addEventListener(name, eventProxy, useCapture); 81 } else node.removeEventListener(name, eventProxy, useCapture); 82 (node.__l || (node.__l = {}))[name] = value; 83 } else if ('list' !== name && 'type' !== name && !isSvg && name in node) { 84 setProperty(node, name, null == value ? '' : value); 85 if (null == value || value === !1) node.removeAttribute(name); 86 } else { 87 var ns = isSvg && name !== (name = name.replace(/^xlink\:?/, '')); 88 if (null == value || value === !1) if (ns) node.removeAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase()); else node.removeAttribute(name); else if ('function' != typeof value) if (ns) node.setAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase(), value); else node.setAttribute(name, value); 89 } 90 } 91 function setProperty(node, name, value) { 92 try { 93 node[name] = value; 94 } catch (e) {} 95 } 96 function eventProxy(e) { 97 return this.__l[e.type](options.event && options.event(e) || e); 98 } 99 function flushMounts() { 100 var c; 101 while (c = mounts.pop()) { 102 if (options.afterMount) options.afterMount(c); 103 if (c.componentDidMount) c.componentDidMount(); 104 } 105 } 106 function diff(dom, vnode, context, mountAll, parent, componentRoot) { 107 if (!diffLevel++) { 108 isSvgMode = null != parent && void 0 !== parent.ownerSVGElement; 109 hydrating = null != dom && !('__preactattr_' in dom); 110 } 111 var ret = idiff(dom, vnode, context, mountAll, componentRoot); 112 if (parent && ret.parentNode !== parent) parent.appendChild(ret); 113 if (!--diffLevel) { 114 hydrating = !1; 115 if (!componentRoot) flushMounts(); 116 } 117 return ret; 118 } 119 function idiff(dom, vnode, context, mountAll, componentRoot) { 120 var out = dom, prevSvgMode = isSvgMode; 121 if (null == vnode) vnode = ''; 122 if ('string' == typeof vnode) { 123 if (dom && void 0 !== dom.splitText && dom.parentNode && (!dom._component || componentRoot)) { 124 if (dom.nodeValue != vnode) dom.nodeValue = vnode; 125 } else { 126 out = document.createTextNode(vnode); 127 if (dom) { 128 if (dom.parentNode) dom.parentNode.replaceChild(out, dom); 129 recollectNodeTree(dom, !0); 130 } 131 } 132 out.__preactattr_ = !0; 133 return out; 134 } 135 if ('function' == typeof vnode.nodeName) return buildComponentFromVNode(dom, vnode, context, mountAll); 136 isSvgMode = 'svg' === vnode.nodeName ? !0 : 'foreignObject' === vnode.nodeName ? !1 : isSvgMode; 137 if (!dom || !isNamedNode(dom, String(vnode.nodeName))) { 138 out = createNode(String(vnode.nodeName), isSvgMode); 139 if (dom) { 140 while (dom.firstChild) out.appendChild(dom.firstChild); 141 if (dom.parentNode) dom.parentNode.replaceChild(out, dom); 142 recollectNodeTree(dom, !0); 143 } 144 } 145 var fc = out.firstChild, props = out.__preactattr_ || (out.__preactattr_ = {}), vchildren = vnode.children; 146 if (!hydrating && vchildren && 1 === vchildren.length && 'string' == typeof vchildren[0] && null != fc && void 0 !== fc.splitText && null == fc.nextSibling) { 147 if (fc.nodeValue != vchildren[0]) fc.nodeValue = vchildren[0]; 148 } else if (vchildren && vchildren.length || null != fc) innerDiffNode(out, vchildren, context, mountAll, hydrating || null != props.dangerouslySetInnerHTML); 149 diffAttributes(out, vnode.attributes, props); 150 isSvgMode = prevSvgMode; 151 return out; 152 } 153 function innerDiffNode(dom, vchildren, context, mountAll, isHydrating) { 154 var j, c, vchild, child, originalChildren = dom.childNodes, children = [], keyed = {}, keyedLen = 0, min = 0, len = originalChildren.length, childrenLen = 0, vlen = vchildren ? vchildren.length : 0; 155 if (0 !== len) for (var i = 0; i < len; i++) { 156 var _child = originalChildren[i], props = _child.__preactattr_, key = vlen && props ? _child._component ? _child._component.__k : props.key : null; 157 if (null != key) { 158 keyedLen++; 159 keyed[key] = _child; 160 } else if (props || (void 0 !== _child.splitText ? isHydrating ? _child.nodeValue.trim() : !0 : isHydrating)) children[childrenLen++] = _child; 161 } 162 if (0 !== vlen) for (var i = 0; i < vlen; i++) { 163 vchild = vchildren[i]; 164 child = null; 165 var key = vchild.key; 166 if (null != key) { 167 if (keyedLen && void 0 !== keyed[key]) { 168 child = keyed[key]; 169 keyed[key] = void 0; 170 keyedLen--; 171 } 172 } else if (!child && min < childrenLen) for (j = min; j < childrenLen; j++) if (void 0 !== children[j] && isSameNodeType(c = children[j], vchild, isHydrating)) { 173 child = c; 174 children[j] = void 0; 175 if (j === childrenLen - 1) childrenLen--; 176 if (j === min) min++; 177 break; 178 } 179 child = idiff(child, vchild, context, mountAll); 180 if (child && child !== dom) if (i >= len) dom.appendChild(child); else if (child !== originalChildren[i]) if (child === originalChildren[i + 1]) removeNode(originalChildren[i]); else dom.insertBefore(child, originalChildren[i] || null); 181 } 182 if (keyedLen) for (var i in keyed) if (void 0 !== keyed[i]) recollectNodeTree(keyed[i], !1); 183 while (min <= childrenLen) if (void 0 !== (child = children[childrenLen--])) recollectNodeTree(child, !1); 184 } 185 function recollectNodeTree(node, unmountOnly) { 186 var component = node._component; 187 if (component) unmountComponent(component); else { 188 if (null != node.__preactattr_ && node.__preactattr_.ref) node.__preactattr_.ref(null); 189 if (unmountOnly === !1 || null == node.__preactattr_) removeNode(node); 190 removeChildren(node); 191 } 192 } 193 function removeChildren(node) { 194 node = node.lastChild; 195 while (node) { 196 var next = node.previousSibling; 197 recollectNodeTree(node, !0); 198 node = next; 199 } 200 } 201 function diffAttributes(dom, attrs, old) { 202 var name; 203 for (name in old) if ((!attrs || null == attrs[name]) && null != old[name]) setAccessor(dom, name, old[name], old[name] = void 0, isSvgMode); 204 for (name in attrs) if (!('children' === name || 'innerHTML' === name || name in old && attrs[name] === ('value' === name || 'checked' === name ? dom[name] : old[name]))) setAccessor(dom, name, old[name], old[name] = attrs[name], isSvgMode); 205 } 206 function collectComponent(component) { 207 var name = component.constructor.name; 208 (components[name] || (components[name] = [])).push(component); 209 } 210 function createComponent(Ctor, props, context) { 211 var inst, list = components[Ctor.name]; 212 if (Ctor.prototype && Ctor.prototype.render) { 213 inst = new Ctor(props, context); 214 Component.call(inst, props, context); 215 } else { 216 inst = new Component(props, context); 217 inst.constructor = Ctor; 218 inst.render = doRender; 219 } 220 if (list) for (var i = list.length; i--; ) if (list[i].constructor === Ctor) { 221 inst.__b = list[i].__b; 222 list.splice(i, 1); 223 break; 224 } 225 return inst; 226 } 227 function doRender(props, state, context) { 228 return this.constructor(props, context); 229 } 230 function setComponentProps(component, props, opts, context, mountAll) { 231 if (!component.__x) { 232 component.__x = !0; 233 if (component.__r = props.ref) delete props.ref; 234 if (component.__k = props.key) delete props.key; 235 if (!component.base || mountAll) { 236 if (component.componentWillMount) component.componentWillMount(); 237 } else if (component.componentWillReceiveProps) component.componentWillReceiveProps(props, context); 238 if (context && context !== component.context) { 239 if (!component.__c) component.__c = component.context; 240 component.context = context; 241 } 242 if (!component.__p) component.__p = component.props; 243 component.props = props; 244 component.__x = !1; 245 if (0 !== opts) if (1 === opts || options.syncComponentUpdates !== !1 || !component.base) renderComponent(component, 1, mountAll); else enqueueRender(component); 246 if (component.__r) component.__r(component); 247 } 248 } 249 function renderComponent(component, opts, mountAll, isChild) { 250 if (!component.__x) { 251 var rendered, inst, cbase, props = component.props, state = component.state, context = component.context, previousProps = component.__p || props, previousState = component.__s || state, previousContext = component.__c || context, isUpdate = component.base, nextBase = component.__b, initialBase = isUpdate || nextBase, initialChildComponent = component._component, skip = !1; 252 if (isUpdate) { 253 component.props = previousProps; 254 component.state = previousState; 255 component.context = previousContext; 256 if (2 !== opts && component.shouldComponentUpdate && component.shouldComponentUpdate(props, state, context) === !1) skip = !0; else if (component.componentWillUpdate) component.componentWillUpdate(props, state, context); 257 component.props = props; 258 component.state = state; 259 component.context = context; 260 } 261 component.__p = component.__s = component.__c = component.__b = null; 262 component.__d = !1; 263 if (!skip) { 264 rendered = component.render(props, state, context); 265 if (component.getChildContext) context = extend(extend({}, context), component.getChildContext()); 266 var toUnmount, base, childComponent = rendered && rendered.nodeName; 267 if ('function' == typeof childComponent) { 268 var childProps = getNodeProps(rendered); 269 inst = initialChildComponent; 270 if (inst && inst.constructor === childComponent && childProps.key == inst.__k) setComponentProps(inst, childProps, 1, context, !1); else { 271 toUnmount = inst; 272 component._component = inst = createComponent(childComponent, childProps, context); 273 inst.__b = inst.__b || nextBase; 274 inst.__u = component; 275 setComponentProps(inst, childProps, 0, context, !1); 276 renderComponent(inst, 1, mountAll, !0); 277 } 278 base = inst.base; 279 } else { 280 cbase = initialBase; 281 toUnmount = initialChildComponent; 282 if (toUnmount) cbase = component._component = null; 283 if (initialBase || 1 === opts) { 284 if (cbase) cbase._component = null; 285 base = diff(cbase, rendered, context, mountAll || !isUpdate, initialBase && initialBase.parentNode, !0); 286 } 287 } 288 if (initialBase && base !== initialBase && inst !== initialChildComponent) { 289 var baseParent = initialBase.parentNode; 290 if (baseParent && base !== baseParent) { 291 baseParent.replaceChild(base, initialBase); 292 if (!toUnmount) { 293 initialBase._component = null; 294 recollectNodeTree(initialBase, !1); 295 } 296 } 297 } 298 if (toUnmount) unmountComponent(toUnmount); 299 component.base = base; 300 if (base && !isChild) { 301 var componentRef = component, t = component; 302 while (t = t.__u) (componentRef = t).base = base; 303 base._component = componentRef; 304 base._componentConstructor = componentRef.constructor; 305 } 306 } 307 if (!isUpdate || mountAll) mounts.unshift(component); else if (!skip) { 308 flushMounts(); 309 if (component.componentDidUpdate) component.componentDidUpdate(previousProps, previousState, previousContext); 310 if (options.afterUpdate) options.afterUpdate(component); 311 } 312 if (null != component.__h) while (component.__h.length) component.__h.pop().call(component); 313 if (!diffLevel && !isChild) flushMounts(); 314 } 315 } 316 function buildComponentFromVNode(dom, vnode, context, mountAll) { 317 var c = dom && dom._component, originalComponent = c, oldDom = dom, isDirectOwner = c && dom._componentConstructor === vnode.nodeName, isOwner = isDirectOwner, props = getNodeProps(vnode); 318 while (c && !isOwner && (c = c.__u)) isOwner = c.constructor === vnode.nodeName; 319 if (c && isOwner && (!mountAll || c._component)) { 320 setComponentProps(c, props, 3, context, mountAll); 321 dom = c.base; 322 } else { 323 if (originalComponent && !isDirectOwner) { 324 unmountComponent(originalComponent); 325 dom = oldDom = null; 326 } 327 c = createComponent(vnode.nodeName, props, context); 328 if (dom && !c.__b) { 329 c.__b = dom; 330 oldDom = null; 331 } 332 setComponentProps(c, props, 1, context, mountAll); 333 dom = c.base; 334 if (oldDom && dom !== oldDom) { 335 oldDom._component = null; 336 recollectNodeTree(oldDom, !1); 337 } 338 } 339 return dom; 340 } 341 function unmountComponent(component) { 342 if (options.beforeUnmount) options.beforeUnmount(component); 343 var base = component.base; 344 component.__x = !0; 345 if (component.componentWillUnmount) component.componentWillUnmount(); 346 component.base = null; 347 var inner = component._component; 348 if (inner) unmountComponent(inner); else if (base) { 349 if (base.__preactattr_ && base.__preactattr_.ref) base.__preactattr_.ref(null); 350 component.__b = base; 351 removeNode(base); 352 collectComponent(component); 353 removeChildren(base); 354 } 355 if (component.__r) component.__r(null); 356 } 357 function Component(props, context) { 358 this.__d = !0; 359 this.context = context; 360 this.props = props; 361 this.state = this.state || {}; 362 } 363 function render(vnode, parent, merge) { 364 return diff(merge, vnode, {}, !1, parent, !1); 365 } 366 var options = {}; 367 var stack = []; 368 var EMPTY_CHILDREN = []; 369 var IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i; 370 var items = []; 371 var mounts = []; 372 var diffLevel = 0; 373 var isSvgMode = !1; 374 var hydrating = !1; 375 var components = {}; 376 extend(Component.prototype, { 377 setState: function(state, callback) { 378 var s = this.state; 379 if (!this.__s) this.__s = extend({}, s); 380 extend(s, 'function' == typeof state ? state(s, this.props) : state); 381 if (callback) (this.__h = this.__h || []).push(callback); 382 enqueueRender(this); 383 }, 384 forceUpdate: function(callback) { 385 if (callback) (this.__h = this.__h || []).push(callback); 386 renderComponent(this, 2); 387 }, 388 render: function() {} 389 }); 390 var preact = { 391 h: h, 392 createElement: h, 393 cloneElement: cloneElement, 394 Component: Component, 395 render: render, 396 rerender: rerender, 397 options: options 398 }; 399 if ('undefined' != typeof module) module.exports = preact; else self.preact = preact; 400 }(); 401 402 // proptypes@0.14.4 403 (function (global, factory) { 404 if (typeof define === 'function' && define.amd) { 405 define('PropTypes', ['exports', 'module'], factory); 406 } else if (typeof exports !== 'undefined' && typeof module !== 'undefined') { 407 factory(exports, module); 408 } else { 409 var mod = { 410 exports: {} 411 }; 412 factory(mod.exports, mod); 413 global.PropTypes = mod.exports; 414 } 415 })(this, function (exports, module) { 416 417 'use strict'; 418 419 var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7; 420 421 var ReactElement = {}; 422 423 ReactElement.isValidElement = function (object) { 424 return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; 425 }; 426 427 var ReactPropTypeLocationNames = { 428 prop: 'prop', 429 context: 'context', 430 childContext: 'child context' 431 }; 432 433 var emptyFunction = { 434 thatReturns: function thatReturns(what) { 435 return function () { 436 return what; 437 }; 438 } 439 }; 440 441 var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; 442 var FAUX_ITERATOR_SYMBOL = '@@iterator'; 443 function getIteratorFn(maybeIterable) { 444 var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); 445 if (typeof iteratorFn === 'function') { 446 return iteratorFn; 447 } 448 } 449 450 var ANONYMOUS = '<<anonymous>>'; 451 452 var ReactPropTypes = { 453 array: createPrimitiveTypeChecker('array'), 454 bool: createPrimitiveTypeChecker('boolean'), 455 func: createPrimitiveTypeChecker('function'), 456 number: createPrimitiveTypeChecker('number'), 457 object: createPrimitiveTypeChecker('object'), 458 string: createPrimitiveTypeChecker('string'), 459 symbol: createPrimitiveTypeChecker('symbol'), 460 461 any: createAnyTypeChecker(), 462 arrayOf: createArrayOfTypeChecker, 463 element: createElementTypeChecker(), 464 instanceOf: createInstanceTypeChecker, 465 node: createNodeChecker(), 466 objectOf: createObjectOfTypeChecker, 467 oneOf: createEnumTypeChecker, 468 oneOfType: createUnionTypeChecker, 469 shape: createShapeTypeChecker 470 }; 471 472 function createChainableTypeChecker(validate) { 473 function checkType(isRequired, props, propName, componentName, location, propFullName) { 474 componentName = componentName || ANONYMOUS; 475 propFullName = propFullName || propName; 476 if (props[propName] == null) { 477 var locationName = ReactPropTypeLocationNames[location]; 478 if (isRequired) { 479 return new Error('Required ' + locationName + ' `' + propFullName + '` was not specified in ' + ('`' + componentName + '`.')); 480 } 481 return null; 482 } else { 483 return validate(props, propName, componentName, location, propFullName); 484 } 485 } 486 487 var chainedCheckType = checkType.bind(null, false); 488 chainedCheckType.isRequired = checkType.bind(null, true); 489 490 return chainedCheckType; 491 } 492 493 function createPrimitiveTypeChecker(expectedType) { 494 function validate(props, propName, componentName, location, propFullName) { 495 var propValue = props[propName]; 496 var propType = getPropType(propValue); 497 if (propType !== expectedType) { 498 var locationName = ReactPropTypeLocationNames[location]; 499 500 var preciseType = getPreciseType(propValue); 501 502 return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); 503 } 504 return null; 505 } 506 return createChainableTypeChecker(validate); 507 } 508 509 function createAnyTypeChecker() { 510 return createChainableTypeChecker(emptyFunction.thatReturns(null)); 511 } 512 513 function createArrayOfTypeChecker(typeChecker) { 514 function validate(props, propName, componentName, location, propFullName) { 515 var propValue = props[propName]; 516 if (!Array.isArray(propValue)) { 517 var locationName = ReactPropTypeLocationNames[location]; 518 var propType = getPropType(propValue); 519 return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.')); 520 } 521 for (var i = 0; i < propValue.length; i++) { 522 var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']'); 523 if (error instanceof Error) { 524 return error; 525 } 526 } 527 return null; 528 } 529 return createChainableTypeChecker(validate); 530 } 531 532 function createElementTypeChecker() { 533 function validate(props, propName, componentName, location, propFullName) { 534 if (!ReactElement.isValidElement(props[propName])) { 535 var locationName = ReactPropTypeLocationNames[location]; 536 return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a single ReactElement.')); 537 } 538 return null; 539 } 540 return createChainableTypeChecker(validate); 541 } 542 543 function createInstanceTypeChecker(expectedClass) { 544 function validate(props, propName, componentName, location, propFullName) { 545 if (!(props[propName] instanceof expectedClass)) { 546 var locationName = ReactPropTypeLocationNames[location]; 547 var expectedClassName = expectedClass.name || ANONYMOUS; 548 var actualClassName = getClassName(props[propName]); 549 return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.')); 550 } 551 return null; 552 } 553 return createChainableTypeChecker(validate); 554 } 555 556 function createEnumTypeChecker(expectedValues) { 557 if (!Array.isArray(expectedValues)) { 558 return createChainableTypeChecker(function () { 559 return new Error('Invalid argument supplied to oneOf, expected an instance of array.'); 560 }); 561 } 562 563 function validate(props, propName, componentName, location, propFullName) { 564 var propValue = props[propName]; 565 for (var i = 0; i < expectedValues.length; i++) { 566 if (propValue === expectedValues[i]) { 567 return null; 568 } 569 } 570 571 var locationName = ReactPropTypeLocationNames[location]; 572 var valuesString = JSON.stringify(expectedValues); 573 return new Error('Invalid ' + locationName + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); 574 } 575 return createChainableTypeChecker(validate); 576 } 577 578 function createObjectOfTypeChecker(typeChecker) { 579 function validate(props, propName, componentName, location, propFullName) { 580 var propValue = props[propName]; 581 var propType = getPropType(propValue); 582 if (propType !== 'object') { 583 var locationName = ReactPropTypeLocationNames[location]; 584 return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); 585 } 586 for (var key in propValue) { 587 if (propValue.hasOwnProperty(key)) { 588 var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key); 589 if (error instanceof Error) { 590 return error; 591 } 592 } 593 } 594 return null; 595 } 596 return createChainableTypeChecker(validate); 597 } 598 599 function createUnionTypeChecker(arrayOfTypeCheckers) { 600 if (!Array.isArray(arrayOfTypeCheckers)) { 601 return createChainableTypeChecker(function () { 602 return new Error('Invalid argument supplied to oneOfType, expected an instance of array.'); 603 }); 604 } 605 606 function validate(props, propName, componentName, location, propFullName) { 607 for (var i = 0; i < arrayOfTypeCheckers.length; i++) { 608 var checker = arrayOfTypeCheckers[i]; 609 if (checker(props, propName, componentName, location, propFullName) == null) { 610 return null; 611 } 612 } 613 614 var locationName = ReactPropTypeLocationNames[location]; 615 return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.')); 616 } 617 return createChainableTypeChecker(validate); 618 } 619 620 function createNodeChecker() { 621 function validate(props, propName, componentName, location, propFullName) { 622 if (!isNode(props[propName])) { 623 var locationName = ReactPropTypeLocationNames[location]; 624 return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); 625 } 626 return null; 627 } 628 return createChainableTypeChecker(validate); 629 } 630 631 function createShapeTypeChecker(shapeTypes) { 632 function validate(props, propName, componentName, location, propFullName) { 633 var propValue = props[propName]; 634 var propType = getPropType(propValue); 635 if (propType !== 'object') { 636 var locationName = ReactPropTypeLocationNames[location]; 637 return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); 638 } 639 for (var key in shapeTypes) { 640 var checker = shapeTypes[key]; 641 if (!checker) { 642 continue; 643 } 644 var error = checker(propValue, key, componentName, location, propFullName + '.' + key); 645 if (error) { 646 return error; 647 } 648 } 649 return null; 650 } 651 return createChainableTypeChecker(validate); 652 } 653 654 function isNode(propValue) { 655 switch (typeof propValue) { 656 case 'number': 657 case 'string': 658 case 'undefined': 659 return true; 660 case 'boolean': 661 return !propValue; 662 case 'object': 663 if (Array.isArray(propValue)) { 664 return propValue.every(isNode); 665 } 666 if (propValue === null || ReactElement.isValidElement(propValue)) { 667 return true; 668 } 669 670 var iteratorFn = getIteratorFn(propValue); 671 if (iteratorFn) { 672 var iterator = iteratorFn.call(propValue); 673 var step; 674 if (iteratorFn !== propValue.entries) { 675 while (!(step = iterator.next()).done) { 676 if (!isNode(step.value)) { 677 return false; 678 } 679 } 680 } else { 681 while (!(step = iterator.next()).done) { 682 var entry = step.value; 683 if (entry) { 684 if (!isNode(entry[1])) { 685 return false; 686 } 687 } 688 } 689 } 690 } else { 691 return false; 692 } 693 694 return true; 695 default: 696 return false; 697 } 698 } 699 700 function isSymbol(propType, propValue) { 701 if (propType === 'symbol') { 702 return true; 703 } 704 705 if (propValue['@@toStringTag'] === 'Symbol') { 706 return true; 707 } 708 709 if (typeof Symbol === 'function' && propValue instanceof Symbol) { 710 return true; 711 } 712 713 return false; 714 } 715 716 function getPropType(propValue) { 717 var propType = typeof propValue; 718 if (Array.isArray(propValue)) { 719 return 'array'; 720 } 721 if (propValue instanceof RegExp) { 722 return 'object'; 723 } 724 if (isSymbol(propType, propValue)) { 725 return 'symbol'; 726 } 727 return propType; 728 } 729 730 function getPreciseType(propValue) { 731 var propType = getPropType(propValue); 732 if (propType === 'object') { 733 if (propValue instanceof Date) { 734 return 'date'; 735 } else if (propValue instanceof RegExp) { 736 return 'regexp'; 737 } 738 } 739 return propType; 740 } 741 742 function getClassName(propValue) { 743 if (!propValue.constructor || !propValue.constructor.name) { 744 return ANONYMOUS; 745 } 746 return propValue.constructor.name; 747 } 748 749 module.exports = ReactPropTypes; 750 }); 751 752 753 // preact-compat@3.15.0 754 (function (global, factory) { 755 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('prop-types'), require('preact')) : 756 typeof define === 'function' && define.amd ? define(['prop-types', 'preact'], factory) : 757 (global.preactCompat = factory(global.PropTypes,global.preact)); 758 }(this, (function (PropTypes,preact) { 759 760 PropTypes = 'default' in PropTypes ? PropTypes['default'] : PropTypes; 761 762 var version = '15.1.0'; // trick libraries to think we are react 763 764 var ELEMENTS = 'a abbr address area article aside audio b base bdi bdo big blockquote body br button canvas caption cite code col colgroup data datalist dd del details dfn dialog div dl dt em embed fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 head header hgroup hr html i iframe img input ins kbd keygen label legend li link main map mark menu menuitem meta meter nav noscript object ol optgroup option output p param picture pre progress q rp rt ruby s samp script section select small source span strong style sub summary sup table tbody td textarea tfoot th thead time title tr track u ul var video wbr circle clipPath defs ellipse g image line linearGradient mask path pattern polygon polyline radialGradient rect stop svg text tspan'.split(' '); 765 766 var REACT_ELEMENT_TYPE = (typeof Symbol!=='undefined' && Symbol.for && Symbol.for('react.element')) || 0xeac7; 767 768 var COMPONENT_WRAPPER_KEY = typeof Symbol!=='undefined' ? Symbol.for('__preactCompatWrapper') : '__preactCompatWrapper'; 769 770 // don't autobind these methods since they already have guaranteed context. 771 var AUTOBIND_BLACKLIST = { 772 constructor: 1, 773 render: 1, 774 shouldComponentUpdate: 1, 775 componentWillReceiveProps: 1, 776 componentWillUpdate: 1, 777 componentDidUpdate: 1, 778 componentWillMount: 1, 779 componentDidMount: 1, 780 componentWillUnmount: 1, 781 componentDidUnmount: 1 782 }; 783 784 785 var CAMEL_PROPS = /^(?:accent|alignment|arabic|baseline|cap|clip|color|fill|flood|font|glyph|horiz|marker|overline|paint|stop|strikethrough|stroke|text|underline|unicode|units|v|vert|word|writing|x)[A-Z]/; 786 787 788 var BYPASS_HOOK = {}; 789 790 /*global process*/ 791 var DEV = typeof process==='undefined' || !process.env || process.env.NODE_ENV!=='production'; 792 793 // a component that renders nothing. Used to replace components for unmountComponentAtNode. 794 function EmptyComponent() { return null; } 795 796 797 798 // make react think we're react. 799 var VNode = preact.h('a', null).constructor; 800 VNode.prototype.$$typeof = REACT_ELEMENT_TYPE; 801 VNode.prototype.preactCompatUpgraded = false; 802 VNode.prototype.preactCompatNormalized = false; 803 804 Object.defineProperty(VNode.prototype, 'type', { 805 get: function() { return this.nodeName; }, 806 set: function(v) { this.nodeName = v; }, 807 configurable:true 808 }); 809 810 Object.defineProperty(VNode.prototype, 'props', { 811 get: function() { return this.attributes; }, 812 set: function(v) { this.attributes = v; }, 813 configurable:true 814 }); 815 816 817 818 var oldEventHook = preact.options.event; 819 preact.options.event = function (e) { 820 if (oldEventHook) { e = oldEventHook(e); } 821 e.persist = Object; 822 e.nativeEvent = e; 823 return e; 824 }; 825 826 827 var oldVnodeHook = preact.options.vnode; 828 preact.options.vnode = function (vnode) { 829 if (!vnode.preactCompatUpgraded) { 830 vnode.preactCompatUpgraded = true; 831 832 var tag = vnode.nodeName, 833 attrs = vnode.attributes = extend({}, vnode.attributes); 834 835 if (typeof tag==='function') { 836 if (tag[COMPONENT_WRAPPER_KEY]===true || (tag.prototype && 'isReactComponent' in tag.prototype)) { 837 if (vnode.children && String(vnode.children)==='') { vnode.children = undefined; } 838 if (vnode.children) { attrs.children = vnode.children; } 839 840 if (!vnode.preactCompatNormalized) { 841 normalizeVNode(vnode); 842 } 843 handleComponentVNode(vnode); 844 } 845 } 846 else { 847 if (vnode.children && String(vnode.children)==='') { vnode.children = undefined; } 848 if (vnode.children) { attrs.children = vnode.children; } 849 850 if (attrs.defaultValue) { 851 if (!attrs.value && attrs.value!==0) { 852 attrs.value = attrs.defaultValue; 853 } 854 delete attrs.defaultValue; 855 } 856 857 handleElementVNode(vnode, attrs); 858 } 859 } 860 861 if (oldVnodeHook) { oldVnodeHook(vnode); } 862 }; 863 864 function handleComponentVNode(vnode) { 865 var tag = vnode.nodeName, 866 a = vnode.attributes; 867 868 vnode.attributes = {}; 869 if (tag.defaultProps) { extend(vnode.attributes, tag.defaultProps); } 870 if (a) { extend(vnode.attributes, a); } 871 } 872 873 function handleElementVNode(vnode, a) { 874 var shouldSanitize, attrs, i; 875 if (a) { 876 for (i in a) { if ((shouldSanitize = CAMEL_PROPS.test(i))) { break; } } 877 if (shouldSanitize) { 878 attrs = vnode.attributes = {}; 879 for (i in a) { 880 if (a.hasOwnProperty(i)) { 881 attrs[ CAMEL_PROPS.test(i) ? i.replace(/([A-Z0-9])/, '-$1').toLowerCase() : i ] = a[i]; 882 } 883 } 884 } 885 } 886 } 887 888 889 890 // proxy render() since React returns a Component reference. 891 function render$1(vnode, parent, callback) { 892 var prev = parent && parent._preactCompatRendered && parent._preactCompatRendered.base; 893 894 // ignore impossible previous renders 895 if (prev && prev.parentNode!==parent) { prev = null; } 896 897 // default to first Element child 898 if (!prev) { prev = parent.children[0]; } 899 900 // remove unaffected siblings 901 for (var i=parent.childNodes.length; i--; ) { 902 if (parent.childNodes[i]!==prev) { 903 parent.removeChild(parent.childNodes[i]); 904 } 905 } 906 907 var out = preact.render(vnode, parent, prev); 908 if (parent) { parent._preactCompatRendered = out && (out._component || { base: out }); } 909 if (typeof callback==='function') { callback(); } 910 return out && out._component || out; 911 } 912 913 914 var ContextProvider = function () {}; 915 916 ContextProvider.prototype.getChildContext = function () { 917 return this.props.context; 918 }; 919 ContextProvider.prototype.render = function (props) { 920 return props.children[0]; 921 }; 922 923 function renderSubtreeIntoContainer(parentComponent, vnode, container, callback) { 924 var wrap = preact.h(ContextProvider, { context: parentComponent.context }, vnode); 925 var c = render$1(wrap, container); 926 if (callback) { callback(c); } 927 return c._component || c.base; 928 } 929 930 931 function unmountComponentAtNode(container) { 932 var existing = container._preactCompatRendered && container._preactCompatRendered.base; 933 if (existing && existing.parentNode===container) { 934 preact.render(preact.h(EmptyComponent), container, existing); 935 return true; 936 } 937 return false; 938 } 939 940 941 942 var ARR = []; 943 944 // This API is completely unnecessary for Preact, so it's basically passthrough. 945 var Children = { 946 map: function(children, fn, ctx) { 947 if (children == null) { return null; } 948 children = Children.toArray(children); 949 if (ctx && ctx!==children) { fn = fn.bind(ctx); } 950 return children.map(fn); 951 }, 952 forEach: function(children, fn, ctx) { 953 if (children == null) { return null; } 954 children = Children.toArray(children); 955 if (ctx && ctx!==children) { fn = fn.bind(ctx); } 956 children.forEach(fn); 957 }, 958 count: function(children) { 959 return children && children.length || 0; 960 }, 961 only: function(children) { 962 children = Children.toArray(children); 963 if (children.length!==1) { throw new Error('Children.only() expects only one child.'); } 964 return children[0]; 965 }, 966 toArray: function(children) { 967 if (children == null) { return []; } 968 return Array.isArray && Array.isArray(children) ? children : ARR.concat(children); 969 } 970 }; 971 972 973 /** Track current render() component for ref assignment */ 974 var currentComponent; 975 976 977 function createFactory(type) { 978 return createElement.bind(null, type); 979 } 980 981 982 var DOM = {}; 983 for (var i=ELEMENTS.length; i--; ) { 984 DOM[ELEMENTS[i]] = createFactory(ELEMENTS[i]); 985 } 986 987 function upgradeToVNodes(arr, offset) { 988 for (var i=offset || 0; i<arr.length; i++) { 989 var obj = arr[i]; 990 if (Array.isArray(obj)) { 991 upgradeToVNodes(obj); 992 } 993 else if (obj && typeof obj==='object' && !isValidElement(obj) && ((obj.props && obj.type) || (obj.attributes && obj.nodeName) || obj.children)) { 994 arr[i] = createElement(obj.type || obj.nodeName, obj.props || obj.attributes, obj.children); 995 } 996 } 997 } 998 999 function isStatelessComponent(c) { 1000 return typeof c==='function' && !(c.prototype && c.prototype.render); 1001 } 1002 1003 1004 // wraps stateless functional components in a PropTypes validator 1005 function wrapStatelessComponent(WrappedComponent) { 1006 return createClass({ 1007 displayName: WrappedComponent.displayName || WrappedComponent.name, 1008 render: function() { 1009 return WrappedComponent(this.props, this.context); 1010 } 1011 }); 1012 } 1013 1014 1015 function statelessComponentHook(Ctor) { 1016 var Wrapped = Ctor[COMPONENT_WRAPPER_KEY]; 1017 if (Wrapped) { return Wrapped===true ? Ctor : Wrapped; } 1018 1019 Wrapped = wrapStatelessComponent(Ctor); 1020 1021 Object.defineProperty(Wrapped, COMPONENT_WRAPPER_KEY, { configurable:true, value:true }); 1022 Wrapped.displayName = Ctor.displayName; 1023 Wrapped.propTypes = Ctor.propTypes; 1024 Wrapped.defaultProps = Ctor.defaultProps; 1025 1026 Object.defineProperty(Ctor, COMPONENT_WRAPPER_KEY, { configurable:true, value:Wrapped }); 1027 1028 return Wrapped; 1029 } 1030 1031 1032 function createElement() { 1033 var args = [], len = arguments.length; 1034 while ( len-- ) args[ len ] = arguments[ len ]; 1035 1036 upgradeToVNodes(args, 2); 1037 return normalizeVNode(preact.h.apply(void 0, args)); 1038 } 1039 1040 1041 function normalizeVNode(vnode) { 1042 vnode.preactCompatNormalized = true; 1043 1044 applyClassName(vnode); 1045 1046 if (isStatelessComponent(vnode.nodeName)) { 1047 vnode.nodeName = statelessComponentHook(vnode.nodeName); 1048 } 1049 1050 var ref = vnode.attributes.ref, 1051 type = ref && typeof ref; 1052 if (currentComponent && (type==='string' || type==='number')) { 1053 vnode.attributes.ref = createStringRefProxy(ref, currentComponent); 1054 } 1055 1056 applyEventNormalization(vnode); 1057 1058 return vnode; 1059 } 1060 1061 1062 function cloneElement$1(element, props) { 1063 var children = [], len = arguments.length - 2; 1064 while ( len-- > 0 ) children[ len ] = arguments[ len + 2 ]; 1065 1066 if (!isValidElement(element)) { return element; } 1067 var elementProps = element.attributes || element.props; 1068 var node = preact.h( 1069 element.nodeName || element.type, 1070 elementProps, 1071 element.children || elementProps && elementProps.children 1072 ); 1073 // Only provide the 3rd argument if needed. 1074 // Arguments 3+ overwrite element.children in preactCloneElement 1075 var cloneArgs = [node, props]; 1076 if (children && children.length) { 1077 cloneArgs.push(children); 1078 } 1079 else if (props && props.children) { 1080 cloneArgs.push(props.children); 1081 } 1082 return normalizeVNode(preact.cloneElement.apply(void 0, cloneArgs)); 1083 } 1084 1085 1086 function isValidElement(element) { 1087 return element && ((element instanceof VNode) || element.$$typeof===REACT_ELEMENT_TYPE); 1088 } 1089 1090 1091 function createStringRefProxy(name, component) { 1092 return component._refProxies[name] || (component._refProxies[name] = function (resolved) { 1093 if (component && component.refs) { 1094 component.refs[name] = resolved; 1095 if (resolved===null) { 1096 delete component._refProxies[name]; 1097 component = null; 1098 } 1099 } 1100 }); 1101 } 1102 1103 1104 function applyEventNormalization(ref) { 1105 var nodeName = ref.nodeName; 1106 var attributes = ref.attributes; 1107 1108 if (!attributes || typeof nodeName!=='string') { return; } 1109 var props = {}; 1110 for (var i in attributes) { 1111 props[i.toLowerCase()] = i; 1112 } 1113 if (props.ondoubleclick) { 1114 attributes.ondblclick = attributes[props.ondoubleclick]; 1115 delete attributes[props.ondoubleclick]; 1116 } 1117 // for *textual inputs* (incl textarea), normalize `onChange` -> `onInput`: 1118 if (props.onchange && (nodeName==='textarea' || (nodeName.toLowerCase()==='input' && !/^fil|che|rad/i.test(attributes.type)))) { 1119 var normalized = props.oninput || 'oninput'; 1120 if (!attributes[normalized]) { 1121 attributes[normalized] = multihook([attributes[normalized], attributes[props.onchange]]); 1122 delete attributes[props.onchange]; 1123 } 1124 } 1125 } 1126 1127 1128 function applyClassName(ref) { 1129 var attributes = ref.attributes; 1130 1131 if (!attributes) { return; } 1132 var cl = attributes.className || attributes.class; 1133 if (cl) { attributes.className = cl; } 1134 } 1135 1136 1137 function extend(base, props) { 1138 for (var key in props) { 1139 if (props.hasOwnProperty(key)) { 1140 base[key] = props[key]; 1141 } 1142 } 1143 return base; 1144 } 1145 1146 1147 function shallowDiffers(a, b) { 1148 for (var i in a) { if (!(i in b)) { return true; } } 1149 for (var i$1 in b) { if (a[i$1]!==b[i$1]) { return true; } } 1150 return false; 1151 } 1152 1153 1154 function findDOMNode(component) { 1155 return component && component.base || component; 1156 } 1157 1158 1159 function F(){} 1160 1161 function createClass(obj) { 1162 function cl(props, context) { 1163 bindAll(this); 1164 Component$1.call(this, props, context, BYPASS_HOOK); 1165 newComponentHook.call(this, props, context); 1166 } 1167 1168 obj = extend({ constructor: cl }, obj); 1169 1170 // We need to apply mixins here so that getDefaultProps is correctly mixed 1171 if (obj.mixins) { 1172 applyMixins(obj, collateMixins(obj.mixins)); 1173 } 1174 if (obj.statics) { 1175 extend(cl, obj.statics); 1176 } 1177 if (obj.propTypes) { 1178 cl.propTypes = obj.propTypes; 1179 } 1180 if (obj.defaultProps) { 1181 cl.defaultProps = obj.defaultProps; 1182 } 1183 if (obj.getDefaultProps) { 1184 cl.defaultProps = obj.getDefaultProps(); 1185 } 1186 1187 F.prototype = Component$1.prototype; 1188 cl.prototype = extend(new F(), obj); 1189 1190 cl.displayName = obj.displayName || 'Component'; 1191 1192 return cl; 1193 } 1194 1195 1196 // Flatten an Array of mixins to a map of method name to mixin implementations 1197 function collateMixins(mixins) { 1198 var keyed = {}; 1199 for (var i=0; i<mixins.length; i++) { 1200 var mixin = mixins[i]; 1201 for (var key in mixin) { 1202 if (mixin.hasOwnProperty(key) && typeof mixin[key]==='function') { 1203 (keyed[key] || (keyed[key]=[])).push(mixin[key]); 1204 } 1205 } 1206 } 1207 return keyed; 1208 } 1209 1210 1211 // apply a mapping of Arrays of mixin methods to a component prototype 1212 function applyMixins(proto, mixins) { 1213 for (var key in mixins) { if (mixins.hasOwnProperty(key)) { 1214 proto[key] = multihook( 1215 mixins[key].concat(proto[key] || ARR), 1216 key==='getDefaultProps' || key==='getInitialState' || key==='getChildContext' 1217 ); 1218 } } 1219 } 1220 1221 1222 function bindAll(ctx) { 1223 for (var i in ctx) { 1224 var v = ctx[i]; 1225 if (typeof v==='function' && !v.__bound && !AUTOBIND_BLACKLIST.hasOwnProperty(i)) { 1226 (ctx[i] = v.bind(ctx)).__bound = true; 1227 } 1228 } 1229 } 1230 1231 1232 function callMethod(ctx, m, args) { 1233 if (typeof m==='string') { 1234 m = ctx.constructor.prototype[m]; 1235 } 1236 if (typeof m==='function') { 1237 return m.apply(ctx, args); 1238 } 1239 } 1240 1241 function multihook(hooks, skipDuplicates) { 1242 return function() { 1243 var arguments$1 = arguments; 1244 var this$1 = this; 1245 1246 var ret; 1247 for (var i=0; i<hooks.length; i++) { 1248 var r = callMethod(this$1, hooks[i], arguments$1); 1249 1250 if (skipDuplicates && r!=null) { 1251 if (!ret) { ret = {}; } 1252 for (var key in r) { if (r.hasOwnProperty(key)) { 1253 ret[key] = r[key]; 1254 } } 1255 } 1256 else if (typeof r!=='undefined') { ret = r; } 1257 } 1258 return ret; 1259 }; 1260 } 1261 1262 1263 function newComponentHook(props, context) { 1264 propsHook.call(this, props, context); 1265 this.componentWillReceiveProps = multihook([propsHook, this.componentWillReceiveProps || 'componentWillReceiveProps']); 1266 this.render = multihook([propsHook, beforeRender, this.render || 'render', afterRender]); 1267 } 1268 1269 1270 function propsHook(props, context) { 1271 if (!props) { return; } 1272 1273 // React annoyingly special-cases single children, and some react components are ridiculously strict about this. 1274 var c = props.children; 1275 if (c && Array.isArray(c) && c.length===1) { 1276 props.children = c[0]; 1277 1278 // but its totally still going to be an Array. 1279 if (props.children && typeof props.children==='object') { 1280 props.children.length = 1; 1281 props.children[0] = props.children; 1282 } 1283 } 1284 1285 // add proptype checking 1286 if (DEV) { 1287 var ctor = typeof this==='function' ? this : this.constructor, 1288 propTypes = this.propTypes || ctor.propTypes; 1289 var displayName = this.displayName || ctor.name; 1290 1291 if (propTypes) { 1292 PropTypes.checkPropTypes(propTypes, props, 'prop', displayName); 1293 } 1294 } 1295 } 1296 1297 1298 function beforeRender(props) { 1299 currentComponent = this; 1300 } 1301 1302 function afterRender() { 1303 if (currentComponent===this) { 1304 currentComponent = null; 1305 } 1306 } 1307 1308 1309 1310 function Component$1(props, context, opts) { 1311 preact.Component.call(this, props, context); 1312 this.state = this.getInitialState ? this.getInitialState() : {}; 1313 this.refs = {}; 1314 this._refProxies = {}; 1315 if (opts!==BYPASS_HOOK) { 1316 newComponentHook.call(this, props, context); 1317 } 1318 } 1319 extend(Component$1.prototype = new preact.Component(), { 1320 constructor: Component$1, 1321 1322 isReactComponent: {}, 1323 1324 replaceState: function(state, callback) { 1325 var this$1 = this; 1326 1327 this.setState(state, callback); 1328 for (var i in this$1.state) { 1329 if (!(i in state)) { 1330 delete this$1.state[i]; 1331 } 1332 } 1333 }, 1334 1335 getDOMNode: function() { 1336 return this.base; 1337 }, 1338 1339 isMounted: function() { 1340 return !!this.base; 1341 } 1342 }); 1343 1344 1345 1346 function PureComponent(props, context) { 1347 Component$1.call(this, props, context); 1348 } 1349 F.prototype = Component$1.prototype; 1350 PureComponent.prototype = new F(); 1351 PureComponent.prototype.shouldComponentUpdate = function(props, state) { 1352 return shallowDiffers(this.props, props) || shallowDiffers(this.state, state); 1353 }; 1354 1355 1356 1357 var index = { 1358 version: version, 1359 DOM: DOM, 1360 PropTypes: PropTypes, 1361 Children: Children, 1362 render: render$1, 1363 createClass: createClass, 1364 createFactory: createFactory, 1365 createElement: createElement, 1366 cloneElement: cloneElement$1, 1367 isValidElement: isValidElement, 1368 findDOMNode: findDOMNode, 1369 unmountComponentAtNode: unmountComponentAtNode, 1370 Component: Component$1, 1371 PureComponent: PureComponent, 1372 unstable_renderSubtreeIntoContainer: renderSubtreeIntoContainer 1373 }; 1374 1375 return index; 1376 1377 }))); 1378 1379 window.React = preactCompat; 1380 window.ReactDOM = preactCompat;