made with requirebin
Created
August 4, 2015 07:39
-
-
Save joshski/47c09bea1a2297271ebb to your computer and use it in GitHub Desktop.
requirebin sketch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var plastiq = require('plastiq'); | |
var inspect = require('plastiq-inspect'); | |
plastiq.append(document.body, function() { | |
return inspect({ | |
x: [1,2,"three"], | |
y: { z: [4,5,6] } | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){},{}],2:[function(require,module,exports){var vtext=require("virtual-dom/vnode/vtext.js");module.exports=function(child){if(child===undefined||child===null){return undefined}else if(typeof child!="object"){return new vtext(String(child))}else if(child instanceof Date){return new vtext(String(child))}else if(child instanceof Error){return new vtext(child.toString())}else{return child}}},{"virtual-dom/vnode/vtext.js":36}],3:[function(require,module,exports){var h=require("./rendering").html;var VText=require("virtual-dom/vnode/vtext.js");var domComponent=require("./domComponent");function ComponentWidget(state,vdom){this.state=state;this.key=state.key;if(typeof vdom==="function"){this.render=function(){return vdom.apply(this.state,arguments)};this.canRefresh=true}else{vdom=vdom||new VText("");this.render=function(){return vdom}}this.cacheKey=state.cacheKey;this.component=domComponent();this.renderFinished=h.currentRender.finished}ComponentWidget.prototype.type="Widget";ComponentWidget.prototype.init=function(){var self=this;if(self.state.onbeforeadd){self.state.onbeforeadd()}var vdom=this.render(this);if(vdom instanceof Array){throw new Error("vdom returned from component cannot be an array")}var element=this.component.create(vdom);if(self.state.onadd){this.renderFinished.then(function(){self.state.onadd(element)})}if(self.state.detached){return document.createTextNode("")}else{return element}};ComponentWidget.prototype.update=function(previous){var self=this;var refresh=!this.cacheKey||this.cacheKey!==previous.cacheKey;if(refresh){if(self.state.onupdate){this.renderFinished.then(function(){self.state.onupdate(self.component.element)})}}this.component=previous.component;if(previous.state&&this.state){var keys=Object.keys(this.state);for(var n=0;n<keys.length;n++){var key=keys[n];previous.state[key]=self.state[key]}this.state=previous.state}if(refresh){var element=this.component.update(this.render(this));if(self.state.detached){return document.createTextNode("")}else{return element}}};ComponentWidget.prototype.asdfasd=4;ComponentWidget.prototype.asdfasd=function(){};ComponentWidget.prototype.refresh=function(){this.component.update(this.render(this));if(this.state.onupdate){this.state.onupdate(this.component.element)}};ComponentWidget.prototype.destroy=function(element){var self=this;if(self.state.onremove){this.renderFinished.then(function(){self.state.onremove(element)})}this.component.destroy()};module.exports=function(state,vdom){if(typeof state==="function"){return new ComponentWidget({},state)}else if(state.constructor===Object){return new ComponentWidget(state,vdom)}else{return new ComponentWidget({},state)}};module.exports.ComponentWidget=ComponentWidget},{"./domComponent":4,"./rendering":41,"virtual-dom/vnode/vtext.js":36}],4:[function(require,module,exports){var createElement=require("virtual-dom/create-element");var diff=require("virtual-dom/diff");var patch=require("virtual-dom/patch");var coerceToVdom=require("./coerceToVdom");function DomComponent(){}DomComponent.prototype.create=function(vdom){vdom=coerceToVdom(vdom);this.vdom=vdom;this.element=createElement(vdom);return this.element};DomComponent.prototype.update=function(vdom){var patches=diff(this.vdom,vdom);this.element=patch(this.element,patches);this.vdom=vdom;return this.element};DomComponent.prototype.destroy=function(options){function destroyWidgets(vdom){if(vdom.type==="Widget"){vdom.destroy()}else if(vdom.children){vdom.children.forEach(destroyWidgets)}}destroyWidgets(this.vdom);if(options&&options.removeElement&&this.element.parentNode){this.element.parentNode.removeChild(this.element)}};function domComponent(){return new DomComponent}module.exports=domComponent},{"./coerceToVdom":2,"virtual-dom/create-element":6,"virtual-dom/diff":7,"virtual-dom/patch":16}],5:[function(require,module,exports){module.exports=function(model,property){var plastiqMeta=model._plastiqMeta;if(!plastiqMeta){plastiqMeta={};Object.defineProperty(model,"_plastiqMeta",{value:plastiqMeta})}var meta=plastiqMeta[property];if(!meta){meta=plastiqMeta[property]={}}return meta}},{}],6:[function(require,module,exports){var createElement=require("./vdom/create-element.js");module.exports=createElement},{"./vdom/create-element.js":18}],7:[function(require,module,exports){var diff=require("./vtree/diff.js");module.exports=diff},{"./vtree/diff.js":38}],8:[function(require,module,exports){var h=require("./virtual-hyperscript/index.js");module.exports=h},{"./virtual-hyperscript/index.js":25}],9:[function(require,module,exports){module.exports=function split(undef){var nativeSplit=String.prototype.split,compliantExecNpcg=/()??/.exec("")[1]===undef,self;self=function(str,separator,limit){if(Object.prototype.toString.call(separator)!=="[object RegExp]"){return nativeSplit.call(str,separator,limit)}var output=[],flags=(separator.ignoreCase?"i":"")+(separator.multiline?"m":"")+(separator.extended?"x":"")+(separator.sticky?"y":""),lastLastIndex=0,separator=new RegExp(separator.source,flags+"g"),separator2,match,lastIndex,lastLength;str+="";if(!compliantExecNpcg){separator2=new RegExp("^"+separator.source+"$(?!\\s)",flags)}limit=limit===undef?-1>>>0:limit>>>0;while(match=separator.exec(str)){lastIndex=match.index+match[0].length;if(lastIndex>lastLastIndex){output.push(str.slice(lastLastIndex,match.index));if(!compliantExecNpcg&&match.length>1){match[0].replace(separator2,function(){for(var i=1;i<arguments.length-2;i++){if(arguments[i]===undef){match[i]=undef}}})}if(match.length>1&&match.index<str.length){Array.prototype.push.apply(output,match.slice(1))}lastLength=match[0].length;lastLastIndex=lastIndex;if(output.length>=limit){break}}if(separator.lastIndex===match.index){separator.lastIndex++}}if(lastLastIndex===str.length){if(lastLength||!separator.test("")){output.push("")}}else{output.push(str.slice(lastLastIndex))}return output.length>limit?output.slice(0,limit):output};return self}()},{}],10:[function(require,module,exports){"use strict";var OneVersionConstraint=require("individual/one-version");var MY_VERSION="7";OneVersionConstraint("ev-store",MY_VERSION);var hashKey="__EV_STORE_KEY@"+MY_VERSION;module.exports=EvStore;function EvStore(elem){var hash=elem[hashKey];if(!hash){hash=elem[hashKey]={}}return hash}},{"individual/one-version":12}],11:[function(require,module,exports){(function(global){"use strict";var root=typeof window!=="undefined"?window:typeof global!=="undefined"?global:{};module.exports=Individual;function Individual(key,value){if(key in root){return root[key]}root[key]=value;return value}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],12:[function(require,module,exports){"use strict";var Individual=require("./index.js");module.exports=OneVersion;function OneVersion(moduleName,version,defaultValue){var key="__INDIVIDUAL_ONE_VERSION_"+moduleName;var enforceKey=key+"_ENFORCE_SINGLETON";var versionValue=Individual(enforceKey,version);if(versionValue!==version){throw new Error("Can only have one copy of "+moduleName+".\n"+"You already have version "+versionValue+" installed.\n"+"This means you cannot install version "+version)}return Individual(key,defaultValue)}},{"./index.js":11}],13:[function(require,module,exports){(function(global){var topLevel=typeof global!=="undefined"?global:typeof window!=="undefined"?window:{};var minDoc=require("min-document");if(typeof document!=="undefined"){module.exports=document}else{var doccy=topLevel["__GLOBAL_DOCUMENT_CACHE@4"];if(!doccy){doccy=topLevel["__GLOBAL_DOCUMENT_CACHE@4"]=minDoc}module.exports=doccy}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"min-document":1}],14:[function(require,module,exports){"use strict";module.exports=function isObject(x){return typeof x==="object"&&x!==null}},{}],15:[function(require,module,exports){var nativeIsArray=Array.isArray;var toString=Object.prototype.toString;module.exports=nativeIsArray||isArray;function isArray(obj){return toString.call(obj)==="[object Array]"}},{}],16:[function(require,module,exports){var patch=require("./vdom/patch.js");module.exports=patch},{"./vdom/patch.js":21}],17:[function(require,module,exports){var isObject=require("is-object");var isHook=require("../vnode/is-vhook.js");module.exports=applyProperties;function applyProperties(node,props,previous){for(var propName in props){var propValue=props[propName];if(propValue===undefined){removeProperty(node,propName,propValue,previous)}else if(isHook(propValue)){removeProperty(node,propName,propValue,previous);if(propValue.hook){propValue.hook(node,propName,previous?previous[propName]:undefined)}}else{if(isObject(propValue)){patchObject(node,props,previous,propName,propValue)}else{node[propName]=propValue}}}}function removeProperty(node,propName,propValue,previous){if(previous){var previousValue=previous[propName];if(!isHook(previousValue)){if(propName==="attributes"){for(var attrName in previousValue){node.removeAttribute(attrName)}}else if(propName==="style"){for(var i in previousValue){node.style[i]=""}}else if(typeof previousValue==="string"){node[propName]=""}else{node[propName]=null}}else if(previousValue.unhook){previousValue.unhook(node,propName,propValue)}}}function patchObject(node,props,previous,propName,propValue){var previousValue=previous?previous[propName]:undefined;if(propName==="attributes"){for(var attrName in propValue){var attrValue=propValue[attrName];if(attrValue===undefined){node.removeAttribute(attrName)}else{node.setAttribute(attrName,attrValue)}}return}if(previousValue&&isObject(previousValue)&&getPrototype(previousValue)!==getPrototype(propValue)){node[propName]=propValue;return}if(!isObject(node[propName])){node[propName]={}}var replacer=propName==="style"?"":undefined;for(var k in propValue){var value=propValue[k];node[propName][k]=value===undefined?replacer:value}}function getPrototype(value){if(Object.getPrototypeOf){return Object.getPrototypeOf(value)}else if(value.__proto__){return value.__proto__}else if(value.constructor){return value.constructor.prototype}}},{"../vnode/is-vhook.js":29,"is-object":14}],18:[function(require,module,exports){var document=require("global/document");var applyProperties=require("./apply-properties");var isVNode=require("../vnode/is-vnode.js");var isVText=require("../vnode/is-vtext.js");var isWidget=require("../vnode/is-widget.js");var handleThunk=require("../vnode/handle-thunk.js");module.exports=createElement;function createElement(vnode,opts){var doc=opts?opts.document||document:document;var warn=opts?opts.warn:null;vnode=handleThunk(vnode).a;if(isWidget(vnode)){return vnode.init()}else if(isVText(vnode)){return doc.createTextNode(vnode.text)}else if(!isVNode(vnode)){if(warn){warn("Item is not a valid virtual dom node",vnode)}return null}var node=vnode.namespace===null?doc.createElement(vnode.tagName):doc.createElementNS(vnode.namespace,vnode.tagName);var props=vnode.properties;applyProperties(node,props);var children=vnode.children;for(var i=0;i<children.length;i++){var childNode=createElement(children[i],opts);if(childNode){node.appendChild(childNode)}}return node}},{"../vnode/handle-thunk.js":27,"../vnode/is-vnode.js":30,"../vnode/is-vtext.js":31,"../vnode/is-widget.js":32,"./apply-properties":17,"global/document":13}],19:[function(require,module,exports){var noChild={};module.exports=domIndex;function domIndex(rootNode,tree,indices,nodes){if(!indices||indices.length===0){return{}}else{indices.sort(ascending);return recurse(rootNode,tree,indices,nodes,0)}}function recurse(rootNode,tree,indices,nodes,rootIndex){nodes=nodes||{};if(rootNode){if(indexInRange(indices,rootIndex,rootIndex)){nodes[rootIndex]=rootNode}var vChildren=tree.children;if(vChildren){var childNodes=rootNode.childNodes;for(var i=0;i<tree.children.length;i++){rootIndex+=1;var vChild=vChildren[i]||noChild;var nextIndex=rootIndex+(vChild.count||0);if(indexInRange(indices,rootIndex,nextIndex)){recurse(childNodes[i],vChild,indices,nodes,rootIndex)}rootIndex=nextIndex}}}return nodes}function indexInRange(indices,left,right){if(indices.length===0){return false}var minIndex=0;var maxIndex=indices.length-1;var currentIndex;var currentItem;while(minIndex<=maxIndex){currentIndex=(maxIndex+minIndex)/2>>0;currentItem=indices[currentIndex];if(minIndex===maxIndex){return currentItem>=left&¤tItem<=right}else if(currentItem<left){minIndex=currentIndex+1}else if(currentItem>right){maxIndex=currentIndex-1}else{return true}}return false}function ascending(a,b){return a>b?1:-1}},{}],20:[function(require,module,exports){var applyProperties=require("./apply-properties");var isWidget=require("../vnode/is-widget.js");var VPatch=require("../vnode/vpatch.js");var render=require("./create-element");var updateWidget=require("./update-widget");module.exports=applyPatch;function applyPatch(vpatch,domNode,renderOptions){var type=vpatch.type;var vNode=vpatch.vNode;var patch=vpatch.patch;switch(type){case VPatch.REMOVE:return removeNode(domNode,vNode);case VPatch.INSERT:return insertNode(domNode,patch,renderOptions);case VPatch.VTEXT:return stringPatch(domNode,vNode,patch,renderOptions);case VPatch.WIDGET:return widgetPatch(domNode,vNode,patch,renderOptions);case VPatch.VNODE:return vNodePatch(domNode,vNode,patch,renderOptions);case VPatch.ORDER:reorderChildren(domNode,patch);return domNode;case VPatch.PROPS:applyProperties(domNode,patch,vNode.properties);return domNode;case VPatch.THUNK:return replaceRoot(domNode,renderOptions.patch(domNode,patch,renderOptions));default:return domNode}}function removeNode(domNode,vNode){var parentNode=domNode.parentNode;if(parentNode){parentNode.removeChild(domNode)}destroyWidget(domNode,vNode);return null}function insertNode(parentNode,vNode,renderOptions){var newNode=render(vNode,renderOptions);if(parentNode){parentNode.appendChild(newNode)}return parentNode}function stringPatch(domNode,leftVNode,vText,renderOptions){var newNode;if(domNode.nodeType===3){domNode.replaceData(0,domNode.length,vText.text);newNode=domNode}else{var parentNode=domNode.parentNode;newNode=render(vText,renderOptions);if(parentNode&&newNode!==domNode){parentNode.replaceChild(newNode,domNode)}}return newNode}function widgetPatch(domNode,leftVNode,widget,renderOptions){var updating=updateWidget(leftVNode,widget);var newNode;if(updating){newNode=widget.update(leftVNode,domNode)||domNode}else{newNode=render(widget,renderOptions)}var parentNode=domNode.parentNode;if(parentNode&&newNode!==domNode){parentNode.replaceChild(newNode,domNode)}if(!updating){destroyWidget(domNode,leftVNode)}return newNode}function vNodePatch(domNode,leftVNode,vNode,renderOptions){var parentNode=domNode.parentNode;var newNode=render(vNode,renderOptions);if(parentNode&&newNode!==domNode){parentNode.replaceChild(newNode,domNode)}return newNode}function destroyWidget(domNode,w){if(typeof w.destroy==="function"&&isWidget(w)){w.destroy(domNode)}}function reorderChildren(domNode,moves){var childNodes=domNode.childNodes;var keyMap={};var node;var remove;var insert;for(var i=0;i<moves.removes.length;i++){remove=moves.removes[i];node=childNodes[remove.from];if(remove.key){keyMap[remove.key]=node}domNode.removeChild(node)}var length=childNodes.length;for(var j=0;j<moves.inserts.length;j++){insert=moves.inserts[j];node=keyMap[insert.key];domNode.insertBefore(node,insert.to>=length++?null:childNodes[insert.to])}}function replaceRoot(oldRoot,newRoot){if(oldRoot&&newRoot&&oldRoot!==newRoot&&oldRoot.parentNode){oldRoot.parentNode.replaceChild(newRoot,oldRoot)}return newRoot}},{"../vnode/is-widget.js":32,"../vnode/vpatch.js":35,"./apply-properties":17,"./create-element":18,"./update-widget":22}],21:[function(require,module,exports){var document=require("global/document");var isArray=require("x-is-array");var domIndex=require("./dom-index");var patchOp=require("./patch-op");module.exports=patch;function patch(rootNode,patches){return patchRecursive(rootNode,patches)}function patchRecursive(rootNode,patches,renderOptions){var indices=patchIndices(patches);if(indices.length===0){return rootNode}var index=domIndex(rootNode,patches.a,indices);var ownerDocument=rootNode.ownerDocument;if(!renderOptions){renderOptions={patch:patchRecursive};if(ownerDocument!==document){renderOptions.document=ownerDocument}}for(var i=0;i<indices.length;i++){var nodeIndex=indices[i];rootNode=applyPatch(rootNode,index[nodeIndex],patches[nodeIndex],renderOptions)}return rootNode}function applyPatch(rootNode,domNode,patchList,renderOptions){if(!domNode){return rootNode}var newNode;if(isArray(patchList)){for(var i=0;i<patchList.length;i++){newNode=patchOp(patchList[i],domNode,renderOptions);if(domNode===rootNode){rootNode=newNode}}}else{newNode=patchOp(patchList,domNode,renderOptions);if(domNode===rootNode){rootNode=newNode}}return rootNode}function patchIndices(patches){var indices=[];for(var key in patches){if(key!=="a"){indices.push(Number(key))}}return indices}},{"./dom-index":19,"./patch-op":20,"global/document":13,"x-is-array":15}],22:[function(require,module,exports){var isWidget=require("../vnode/is-widget.js");module.exports=updateWidget;function updateWidget(a,b){if(isWidget(a)&&isWidget(b)){if("name"in a&&"name"in b){return a.id===b.id}else{return a.init===b.init}}return false}},{"../vnode/is-widget.js":32}],23:[function(require,module,exports){"use strict";var EvStore=require("ev-store");module.exports=EvHook;function EvHook(value){if(!(this instanceof EvHook)){return new EvHook(value)}this.value=value}EvHook.prototype.hook=function(node,propertyName){var es=EvStore(node);var propName=propertyName.substr(3);es[propName]=this.value};EvHook.prototype.unhook=function(node,propertyName){var es=EvStore(node);var propName=propertyName.substr(3);es[propName]=undefined}},{"ev-store":10}],24:[function(require,module,exports){"use strict";module.exports=SoftSetHook;function SoftSetHook(value){if(!(this instanceof SoftSetHook)){return new SoftSetHook(value)}this.value=value}SoftSetHook.prototype.hook=function(node,propertyName){if(node[propertyName]!==this.value){node[propertyName]=this.value}}},{}],25:[function(require,module,exports){"use strict";var isArray=require("x-is-array");var VNode=require("../vnode/vnode.js");var VText=require("../vnode/vtext.js");var isVNode=require("../vnode/is-vnode");var isVText=require("../vnode/is-vtext");var isWidget=require("../vnode/is-widget");var isHook=require("../vnode/is-vhook");var isVThunk=require("../vnode/is-thunk");var parseTag=require("./parse-tag.js");var softSetHook=require("./hooks/soft-set-hook.js");var evHook=require("./hooks/ev-hook.js");module.exports=h;function h(tagName,properties,children){var childNodes=[];var tag,props,key,namespace;if(!children&&isChildren(properties)){children=properties;props={}}props=props||properties||{};tag=parseTag(tagName,props);if(props.hasOwnProperty("key")){key=props.key;props.key=undefined}if(props.hasOwnProperty("namespace")){namespace=props.namespace;props.namespace=undefined}if(tag==="INPUT"&&!namespace&&props.hasOwnProperty("value")&&props.value!==undefined&&!isHook(props.value)){props.value=softSetHook(props.value)}transformProperties(props);if(children!==undefined&&children!==null){addChild(children,childNodes,tag,props)}return new VNode(tag,props,childNodes,key,namespace)}function addChild(c,childNodes,tag,props){if(typeof c==="string"){childNodes.push(new VText(c))}else if(isChild(c)){childNodes.push(c)}else if(isArray(c)){for(var i=0;i<c.length;i++){addChild(c[i],childNodes,tag,props)}}else if(c===null||c===undefined){return}else{throw UnexpectedVirtualElement({foreignObject:c,parentVnode:{tagName:tag,properties:props}})}}function transformProperties(props){for(var propName in props){if(props.hasOwnProperty(propName)){var value=props[propName];if(isHook(value)){continue}if(propName.substr(0,3)==="ev-"){props[propName]=evHook(value)}}}}function isChild(x){return isVNode(x)||isVText(x)||isWidget(x)||isVThunk(x)}function isChildren(x){return typeof x==="string"||isArray(x)||isChild(x)}function UnexpectedVirtualElement(data){var err=new Error;err.type="virtual-hyperscript.unexpected.virtual-element";err.message="Unexpected virtual child passed to h().\n"+"Expected a VNode / Vthunk / VWidget / string but:\n"+"got:\n"+errorString(data.foreignObject)+".\n"+"The parent vnode is:\n"+errorString(data.parentVnode);"\n"+"Suggested fix: change your `h(..., [ ... ])` callsite.";err.foreignObject=data.foreignObject;err.parentVnode=data.parentVnode;return err}function errorString(obj){try{return JSON.stringify(obj,null," ")}catch(e){return String(obj)}}},{"../vnode/is-thunk":28,"../vnode/is-vhook":29,"../vnode/is-vnode":30,"../vnode/is-vtext":31,"../vnode/is-widget":32,"../vnode/vnode.js":34,"../vnode/vtext.js":36,"./hooks/ev-hook.js":23,"./hooks/soft-set-hook.js":24,"./parse-tag.js":26,"x-is-array":15}],26:[function(require,module,exports){"use strict";var split=require("browser-split");var classIdSplit=/([\.#]?[a-zA-Z0-9_:-]+)/;var notClassId=/^\.|#/;module.exports=parseTag;function parseTag(tag,props){if(!tag){return"DIV"}var noId=!props.hasOwnProperty("id");var tagParts=split(tag,classIdSplit);var tagName=null;if(notClassId.test(tagParts[1])){tagName="DIV"}var classes,part,type,i;for(i=0;i<tagParts.length;i++){part=tagParts[i];if(!part){continue}type=part.charAt(0);if(!tagName){tagName=part}else if(type==="."){classes=classes||[];classes.push(part.substring(1,part.length))}else if(type==="#"&&noId){props.id=part.substring(1,part.length)}}if(classes){if(props.className){classes.push(props.className)}props.className=classes.join(" ")}return props.namespace?tagName:tagName.toUpperCase()}},{"browser-split":9}],27:[function(require,module,exports){var isVNode=require("./is-vnode");var isVText=require("./is-vtext");var isWidget=require("./is-widget");var isThunk=require("./is-thunk");module.exports=handleThunk;function handleThunk(a,b){var renderedA=a;var renderedB=b;if(isThunk(b)){renderedB=renderThunk(b,a)}if(isThunk(a)){renderedA=renderThunk(a,null)}return{a:renderedA,b:renderedB}}function renderThunk(thunk,previous){var renderedThunk=thunk.vnode;if(!renderedThunk){renderedThunk=thunk.vnode=thunk.render(previous)}if(!(isVNode(renderedThunk)||isVText(renderedThunk)||isWidget(renderedThunk))){throw new Error("thunk did not return a valid node")}return renderedThunk}},{"./is-thunk":28,"./is-vnode":30,"./is-vtext":31,"./is-widget":32}],28:[function(require,module,exports){module.exports=isThunk;function isThunk(t){return t&&t.type==="Thunk"}},{}],29:[function(require,module,exports){module.exports=isHook;function isHook(hook){return hook&&(typeof hook.hook==="function"&&!hook.hasOwnProperty("hook")||typeof hook.unhook==="function"&&!hook.hasOwnProperty("unhook"))}},{}],30:[function(require,module,exports){var version=require("./version");module.exports=isVirtualNode;function isVirtualNode(x){return x&&x.type==="VirtualNode"&&x.version===version}},{"./version":33}],31:[function(require,module,exports){var version=require("./version");module.exports=isVirtualText;function isVirtualText(x){return x&&x.type==="VirtualText"&&x.version===version}},{"./version":33}],32:[function(require,module,exports){module.exports=isWidget;function isWidget(w){return w&&w.type==="Widget"}},{}],33:[function(require,module,exports){module.exports="2"},{}],34:[function(require,module,exports){var version=require("./version");var isVNode=require("./is-vnode");var isWidget=require("./is-widget");var isThunk=require("./is-thunk");var isVHook=require("./is-vhook");module.exports=VirtualNode;var noProperties={};var noChildren=[];function VirtualNode(tagName,properties,children,key,namespace){this.tagName=tagName;this.properties=properties||noProperties;this.children=children||noChildren;this.key=key!=null?String(key):undefined;this.namespace=typeof namespace==="string"?namespace:null;var count=children&&children.length||0;var descendants=0;var hasWidgets=false;var hasThunks=false;var descendantHooks=false;var hooks;for(var propName in properties){if(properties.hasOwnProperty(propName)){var property=properties[propName];if(isVHook(property)&&property.unhook){if(!hooks){hooks={}}hooks[propName]=property}}}for(var i=0;i<count;i++){var child=children[i];if(isVNode(child)){descendants+=child.count||0;if(!hasWidgets&&child.hasWidgets){hasWidgets=true}if(!hasThunks&&child.hasThunks){hasThunks=true}if(!descendantHooks&&(child.hooks||child.descendantHooks)){descendantHooks=true}}else if(!hasWidgets&&isWidget(child)){if(typeof child.destroy==="function"){hasWidgets=true}}else if(!hasThunks&&isThunk(child)){hasThunks=true}}this.count=count+descendants;this.hasWidgets=hasWidgets;this.hasThunks=hasThunks;this.hooks=hooks;this.descendantHooks=descendantHooks}VirtualNode.prototype.version=version;VirtualNode.prototype.type="VirtualNode"},{"./is-thunk":28,"./is-vhook":29,"./is-vnode":30,"./is-widget":32,"./version":33}],35:[function(require,module,exports){var version=require("./version");VirtualPatch.NONE=0;VirtualPatch.VTEXT=1;VirtualPatch.VNODE=2;VirtualPatch.WIDGET=3;VirtualPatch.PROPS=4;VirtualPatch.ORDER=5;VirtualPatch.INSERT=6;VirtualPatch.REMOVE=7;VirtualPatch.THUNK=8;module.exports=VirtualPatch;function VirtualPatch(type,vNode,patch){this.type=Number(type);this.vNode=vNode;this.patch=patch}VirtualPatch.prototype.version=version;VirtualPatch.prototype.type="VirtualPatch"},{"./version":33}],36:[function(require,module,exports){var version=require("./version");module.exports=VirtualText;function VirtualText(text){this.text=String(text)}VirtualText.prototype.version=version;VirtualText.prototype.type="VirtualText"},{"./version":33}],37:[function(require,module,exports){var isObject=require("is-object");var isHook=require("../vnode/is-vhook");module.exports=diffProps;function diffProps(a,b){var diff;for(var aKey in a){if(!(aKey in b)){diff=diff||{};diff[aKey]=undefined}var aValue=a[aKey];var bValue=b[aKey];if(aValue===bValue){continue}else if(isObject(aValue)&&isObject(bValue)){if(getPrototype(bValue)!==getPrototype(aValue)){diff=diff||{};diff[aKey]=bValue}else if(isHook(bValue)){diff=diff||{};diff[aKey]=bValue}else{var objectDiff=diffProps(aValue,bValue);if(objectDiff){diff=diff||{};diff[aKey]=objectDiff}}}else{diff=diff||{};diff[aKey]=bValue}}for(var bKey in b){if(!(bKey in a)){diff=diff||{};diff[bKey]=b[bKey]}}return diff}function getPrototype(value){if(Object.getPrototypeOf){return Object.getPrototypeOf(value)}else if(value.__proto__){return value.__proto__}else if(value.constructor){return value.constructor.prototype}}},{"../vnode/is-vhook":29,"is-object":14}],38:[function(require,module,exports){var isArray=require("x-is-array");var VPatch=require("../vnode/vpatch");var isVNode=require("../vnode/is-vnode");var isVText=require("../vnode/is-vtext");var isWidget=require("../vnode/is-widget");var isThunk=require("../vnode/is-thunk");var handleThunk=require("../vnode/handle-thunk");var diffProps=require("./diff-props");module.exports=diff;function diff(a,b){var patch={a:a};walk(a,b,patch,0);return patch}function walk(a,b,patch,index){if(a===b){return}var apply=patch[index];var applyClear=false;if(isThunk(a)||isThunk(b)){thunks(a,b,patch,index)}else if(b==null){if(!isWidget(a)){clearState(a,patch,index);apply=patch[index]}apply=appendPatch(apply,new VPatch(VPatch.REMOVE,a,b))}else if(isVNode(b)){if(isVNode(a)){if(a.tagName===b.tagName&&a.namespace===b.namespace&&a.key===b.key){var propsPatch=diffProps(a.properties,b.properties);if(propsPatch){apply=appendPatch(apply,new VPatch(VPatch.PROPS,a,propsPatch))}apply=diffChildren(a,b,patch,apply,index)}else{apply=appendPatch(apply,new VPatch(VPatch.VNODE,a,b));applyClear=true}}else{apply=appendPatch(apply,new VPatch(VPatch.VNODE,a,b));applyClear=true}}else if(isVText(b)){if(!isVText(a)){apply=appendPatch(apply,new VPatch(VPatch.VTEXT,a,b));applyClear=true}else if(a.text!==b.text){apply=appendPatch(apply,new VPatch(VPatch.VTEXT,a,b))}}else if(isWidget(b)){if(!isWidget(a)){applyClear=true}apply=appendPatch(apply,new VPatch(VPatch.WIDGET,a,b))}if(apply){patch[index]=apply}if(applyClear){clearState(a,patch,index)}}function diffChildren(a,b,patch,apply,index){var aChildren=a.children;var orderedSet=reorder(aChildren,b.children);var bChildren=orderedSet.children;var aLen=aChildren.length;var bLen=bChildren.length;var len=aLen>bLen?aLen:bLen;for(var i=0;i<len;i++){var leftNode=aChildren[i];var rightNode=bChildren[i];index+=1;if(!leftNode){if(rightNode){apply=appendPatch(apply,new VPatch(VPatch.INSERT,null,rightNode))}}else{walk(leftNode,rightNode,patch,index)}if(isVNode(leftNode)&&leftNode.count){index+=leftNode.count}}if(orderedSet.moves){apply=appendPatch(apply,new VPatch(VPatch.ORDER,a,orderedSet.moves))}return apply}function clearState(vNode,patch,index){unhook(vNode,patch,index);destroyWidgets(vNode,patch,index)}function destroyWidgets(vNode,patch,index){if(isWidget(vNode)){if(typeof vNode.destroy==="function"){patch[index]=appendPatch(patch[index],new VPatch(VPatch.REMOVE,vNode,null))}}else if(isVNode(vNode)&&(vNode.hasWidgets||vNode.hasThunks)){var children=vNode.children;var len=children.length;for(var i=0;i<len;i++){var child=children[i];index+=1;destroyWidgets(child,patch,index);if(isVNode(child)&&child.count){index+=child.count}}}else if(isThunk(vNode)){thunks(vNode,null,patch,index)}}function thunks(a,b,patch,index){var nodes=handleThunk(a,b);var thunkPatch=diff(nodes.a,nodes.b);if(hasPatches(thunkPatch)){patch[index]=new VPatch(VPatch.THUNK,null,thunkPatch)}}function hasPatches(patch){for(var index in patch){if(index!=="a"){return true}}return false}function unhook(vNode,patch,index){if(isVNode(vNode)){if(vNode.hooks){patch[index]=appendPatch(patch[index],new VPatch(VPatch.PROPS,vNode,undefinedKeys(vNode.hooks)))}if(vNode.descendantHooks||vNode.hasThunks){var children=vNode.children;var len=children.length;for(var i=0;i<len;i++){var child=children[i];index+=1;unhook(child,patch,index);if(isVNode(child)&&child.count){index+=child.count}}}}else if(isThunk(vNode)){thunks(vNode,null,patch,index)}}function undefinedKeys(obj){var result={};for(var key in obj){result[key]=undefined}return result}function reorder(aChildren,bChildren){var bChildIndex=keyIndex(bChildren);var bKeys=bChildIndex.keys;var bFree=bChildIndex.free;if(bFree.length===bChildren.length){return{children:bChildren,moves:null}}var aChildIndex=keyIndex(aChildren);var aKeys=aChildIndex.keys;var aFree=aChildIndex.free;if(aFree.length===aChildren.length){return{children:bChildren,moves:null}}var newChildren=[];var freeIndex=0;var freeCount=bFree.length;var deletedItems=0;for(var i=0;i<aChildren.length;i++){var aItem=aChildren[i];var itemIndex;if(aItem.key){if(bKeys.hasOwnProperty(aItem.key)){itemIndex=bKeys[aItem.key];newChildren.push(bChildren[itemIndex])}else{itemIndex=i-deletedItems++;newChildren.push(null)}}else{if(freeIndex<freeCount){itemIndex=bFree[freeIndex++];newChildren.push(bChildren[itemIndex])}else{itemIndex=i-deletedItems++;newChildren.push(null)}}}var lastFreeIndex=freeIndex>=bFree.length?bChildren.length:bFree[freeIndex];for(var j=0;j<bChildren.length;j++){var newItem=bChildren[j];if(newItem.key){if(!aKeys.hasOwnProperty(newItem.key)){newChildren.push(newItem)}}else if(j>=lastFreeIndex){newChildren.push(newItem)}}var simulate=newChildren.slice();var simulateIndex=0;var removes=[];var inserts=[];var simulateItem;for(var k=0;k<bChildren.length;){var wantedItem=bChildren[k];simulateItem=simulate[simulateIndex];while(simulateItem===null&&simulate.length){removes.push(remove(simulate,simulateIndex,null)); | |
simulateItem=simulate[simulateIndex]}if(!simulateItem||simulateItem.key!==wantedItem.key){if(wantedItem.key){if(simulateItem&&simulateItem.key){if(bKeys[simulateItem.key]!==k+1){removes.push(remove(simulate,simulateIndex,simulateItem.key));simulateItem=simulate[simulateIndex];if(!simulateItem||simulateItem.key!==wantedItem.key){inserts.push({key:wantedItem.key,to:k})}else{simulateIndex++}}else{inserts.push({key:wantedItem.key,to:k})}}else{inserts.push({key:wantedItem.key,to:k})}k++}else if(simulateItem&&simulateItem.key){removes.push(remove(simulate,simulateIndex,simulateItem.key))}}else{simulateIndex++;k++}}while(simulateIndex<simulate.length){simulateItem=simulate[simulateIndex];removes.push(remove(simulate,simulateIndex,simulateItem&&simulateItem.key))}if(removes.length===deletedItems&&!inserts.length){return{children:newChildren,moves:null}}return{children:newChildren,moves:{removes:removes,inserts:inserts}}}function remove(arr,index,key){arr.splice(index,1);return{from:index,key:key}}function keyIndex(children){var keys={};var free=[];var length=children.length;for(var i=0;i<length;i++){var child=children[i];if(child.key){keys[child.key]=i}else{free.push(i)}}return{keys:keys,free:free}}function appendPatch(apply,patch){if(apply){if(isArray(apply)){apply.push(patch)}else{apply=[apply,patch]}return apply}else{return patch}}},{"../vnode/handle-thunk":27,"../vnode/is-thunk":28,"../vnode/is-vnode":30,"../vnode/is-vtext":31,"../vnode/is-widget":32,"../vnode/vpatch":35,"./diff-props":37,"x-is-array":15}],39:[function(require,module,exports){module.exports=function(obj,prop){console.log("plastiq.bind() will be deprecated in the next release, use [model, 'fieldName'] instead");return{get:function(){return obj[prop]},set:function(value){obj[prop]=value}}}},{}],40:[function(require,module,exports){var createElement=require("virtual-dom/create-element");var rendering=require("./rendering");function RawHtmlWidget(selector,options,html){this.selector=selector;this.options=options;this.html=html}RawHtmlWidget.prototype.type="Widget";RawHtmlWidget.prototype.init=function(){var element=createElement(rendering.html(this.selector,this.options));var html=this.html;element.innerHTML=html===undefined||html===null?"":html;return element};RawHtmlWidget.prototype.update=function(previous,element){if(this.html!=previous.html){element.parentNode.replaceChild(this.init(),element)}};RawHtmlWidget.prototype.destroy=function(element){};module.exports=function(selector,options,html){if(arguments.length==2){return new RawHtmlWidget(selector,undefined,options)}else{return new RawHtmlWidget(selector,options,html)}}},{"./rendering":41,"virtual-dom/create-element":6}],41:[function(require,module,exports){var h=require("virtual-dom/h");var domComponent=require("./domComponent");var simplePromise=require("./simplePromise");var bindingMeta=require("./meta");var coerceToVdom=require("./coerceToVdom");function doThenFireAfterRender(attachment,fn){try{exports.html.currentRender=attachment;exports.html.currentRender.finished=simplePromise();exports.html.refresh=function(component){if(isComponent(component)){refreshComponent(component,attachment)}else{attachment.refresh()}};fn()}finally{exports.html.currentRender.finished.fulfill();exports.html.currentRender.finished=undefined;delete exports.html.currentRender;exports.html.refresh=refreshOutOfRender}}function refreshOutOfRender(){throw new Error("Please assign plastiq.html.refresh during a render cycle if you want to use it in event handlers. See https://github.com/featurist/plastiq#refresh-outside-render-cycle")}function isComponent(component){return component&&typeof component.init==="function"&&typeof component.update==="function"&&typeof component.destroy==="function"}exports.append=function(element,render,model,options){return start(render,model,options,function(createdElement){element.appendChild(createdElement)})};var attachmentId=1;function start(render,model,options,attachToDom){var win=options&&options.window||window;var requestRender=options&&options.requestRender||win.requestAnimationFrame||win.setTimeout;var requested=false;function refresh(){if(!requested){requestRender(function(){requested=false;if(attachment.attached){doThenFireAfterRender(attachment,function(){var vdom=render(model);component.update(vdom)})}});requested=true}}var attachment={refresh:refresh,requestRender:requestRender,id:attachmentId++,attached:true};var component=domComponent();doThenFireAfterRender(attachment,function(){var vdom=render(model);attachToDom(component.create(vdom))});return{detach:function(){attachment.attached=false},remove:function(){component.destroy({removeElement:true});attachment.attached=false}}}exports.replace=function(element,render,model,options){return start(render,model,options,function(createdElement){var parent=element.parentNode;element.parentNode.replaceChild(createdElement,element)})};exports.attach=function(){console.warn("plastiq.attach has been renamed to plastiq.append, plastiq.attach will be deprecated in a future version");return exports.append.apply(this,arguments)};function refreshComponent(component,attachment){if(!component.canRefresh){throw new Error("this component cannot be refreshed, make sure that the component's view is returned from a function")}if(!component.requested){var requestRender=attachment.requestRender;requestRender(function(){doThenFireAfterRender(attachment,function(){component.requested=false;component.refresh()})});component.requested=true}}var norefresh={};function refreshify(fn,options){if(!exports.html.currentRender){throw new Error("You cannot create virtual-dom event handlers outside a render function. See https://github.com/featurist/plastiq#outside-render-cycle")}var onlyRefreshAfterPromise=options&&options.refresh=="promise";var componentToRefresh=options&&options.component;if(options&&(options.norefresh==true||options.refresh==false)){return fn}var attachment=exports.html.currentRender;var r=exports.html.currentRender.refresh;return function(){var result=fn.apply(this,arguments);function handleResult(result,promiseResult){var allowRefresh=!onlyRefreshAfterPromise||promiseResult;if(allowRefresh&&result&&typeof result=="function"){console.warn("animations are now deprecated, you should consider using plastiq.html.refresh");result(r)}else if(result&&typeof result.then=="function"){if(allowRefresh){r()}result.then(function(result){handleResult(result,onlyRefreshAfterPromise)})}else if(result&&typeof result.init==="function"&&typeof result.update==="function"&&typeof result.destroy==="function"){refreshComponent(result,attachment)}else if(componentToRefresh){refreshComponent(componentToRefresh,attachment)}else if(result===norefresh){}else if(allowRefresh){r();return result}}return handleResult(result)}}function bindTextInput(attributes,children,get,set){var textEventNames=["onkeydown","oninput","onpaste","textInput"];var bindingValue=get();if(!(bindingValue instanceof Error)){attributes.value=bindingValue!=undefined?bindingValue:""}attachEventHandler(attributes,textEventNames,function(ev){if(bindingValue!=ev.target.value){set(ev.target.value)}})}function sequenceFunctions(handler1,handler2){return function(ev){handler1(ev);return handler2(ev)}}function insertEventHandler(attributes,eventName,handler,after){var previousHandler=attributes[eventName];if(previousHandler){if(after){attributes[eventName]=sequenceFunctions(previousHandler,handler)}else{attributes[eventName]=sequenceFunctions(handler,previousHandler)}}else{attributes[eventName]=handler}}function attachEventHandler(attributes,eventNames,handler){if(eventNames instanceof Array){for(var n=0;n<eventNames.length;n++){insertEventHandler(attributes,eventNames[n],handler)}}else{insertEventHandler(attributes,eventNames,handler)}}var inputTypeBindings={text:bindTextInput,textarea:bindTextInput,checkbox:function(attributes,children,get,set){attributes.checked=get();attachEventHandler(attributes,"onclick",function(ev){set(ev.target.checked)})},radio:function(attributes,children,get,set){var value=attributes.value;attributes.checked=get()==attributes.value;attachEventHandler(attributes,"onclick",function(ev){set(value)})},select:function(attributes,children,get,set){var currentValue=get();var options=children.filter(function(child){return child.tagName.toLowerCase()=="option"});var selectedOption=options.filter(function(child){return child.properties.value==currentValue})[0];var values=options.map(function(option){return option.properties.value});for(var n=0;n<options.length;n++){var option=options[n];option.properties.selected=option==selectedOption;option.properties.value=n}attachEventHandler(attributes,"onchange",function(ev){set(values[ev.target.value])})},file:function(attributes,children,get,set){var multiple=attributes.multiple;attachEventHandler(attributes,"onchange",function(ev){if(multiple){set(ev.target.files)}else{set(ev.target.files[0])}})}};function bindModel(attributes,children,type){var bind=inputTypeBindings[type]||bindTextInput;var bindingAttr=makeBinding(attributes.binding);bind(attributes,children,bindingAttr.get,bindingAttr.set)}function inputType(selector,attributes){if(/^textarea\b/i.test(selector)){return"textarea"}else if(/^select\b/i.test(selector)){return"select"}else{return attributes.type||"text"}}function flatten(startIndex,array){var flatArray=[];function append(startIndex,array){for(var n=startIndex;n<array.length;n++){var item=array[n];if(item instanceof Array){append(0,item)}else{flatArray.push(item)}}}append(startIndex,array);return flatArray}function coerceChildren(children){return children.map(coerceToVdom)}var renames={"for":"htmlFor","class":"className",contenteditable:"contentEditable",tabindex:"tabIndex",colspan:"colSpan"};var dataAttributeRegex=/^data-/;function prepareAttributes(selector,attributes,childElements){var keys=Object.keys(attributes);var dataset;for(var k=0;k<keys.length;k++){var key=keys[k];var attribute=attributes[key];if(typeof attribute=="function"){attributes[key]=refreshify(attribute)}var rename=renames[key];if(rename){attributes[rename]=attribute;delete attributes[key];continue}if(dataAttributeRegex.test(key)){if(!dataset){dataset=attributes.dataset;if(!dataset){dataset=attributes.dataset={}}}var datakey=key.replace(dataAttributeRegex,"");dataset[datakey]=attribute;delete attributes[key];continue}}if(attributes.className){attributes.className=generateClassName(attributes.className)}if(attributes.binding){bindModel(attributes,childElements,inputType(selector,attributes));delete attributes.binding}}exports.html=function(hierarchySelector){var hasHierarchy=hierarchySelector.indexOf(" ")>=0;var selector,selectorElements;if(hasHierarchy){selectorElements=hierarchySelector.match(/\S+/g);selector=selectorElements[selectorElements.length-1]}else{selector=hierarchySelector}var attributes;var childElements;var vdom;if(arguments[1]&&arguments[1].constructor==Object){attributes=arguments[1];childElements=coerceChildren(flatten(2,arguments));prepareAttributes(selector,attributes,childElements);vdom=h(selector,attributes,childElements)}else{childElements=coerceChildren(flatten(1,arguments));vdom=h(selector,childElements)}if(hasHierarchy){for(var n=selectorElements.length-2;n>=0;n--){vdom=h(selectorElements[n],vdom)}}return vdom};exports.html.refreshify=refreshify;exports.html.refresh=refreshOutOfRender;exports.html.norefresh=norefresh;function makeBinding(b,options){var binding=b instanceof Array?bindingObject.apply(undefined,b):b;binding.set=refreshify(binding.set,options);return binding}function makeConverter(converter){if(typeof converter=="function"){return{text:function(value){return value},value:function(text){return converter(text)}}}else{return converter}}function chainConverters(startIndex,converters){if(converters.length-startIndex==1){return makeConverter(converters[startIndex])}else{var _converters;function makeConverters(){if(!_converters){_converters=new Array(converters.length-startIndex);for(var n=startIndex;n<converters.length;n++){_converters[n-startIndex]=makeConverter(converters[n])}}}return{text:function(value){makeConverters();var intermediateValue=value;for(var n=0;n<_converters.length;n++){intermediateValue=_converters[n].text(intermediateValue)}return intermediateValue},value:function(text){makeConverters();var intermediateValue=text;for(var n=_converters.length-1;n>=0;n--){intermediateValue=_converters[n].value(intermediateValue)}return intermediateValue}}}}function bindingObject(model,property,options){if(arguments.length>2){var _converter;var bindingArguments=arguments;function buildConverter(){if(!_converter){_converter=chainConverters(2,bindingArguments)}}return{get:function(){buildConverter();var meta=bindingMeta(model,property);var modelValue=model[property];if(meta.error){return meta.text}else if(meta.text===undefined){var modelText=_converter.text(modelValue);meta.text=modelText;return modelText}else{var previousValue=_converter.value(meta.text);var modelText=_converter.text(modelValue);var normalisedPreviousText=_converter.text(previousValue);if(modelText===normalisedPreviousText){return meta.text}else{meta.text=modelText;return modelText}}},set:function(text){buildConverter();var meta=bindingMeta(model,property);meta.text=text;try{model[property]=_converter.value(text,model[property]);delete meta.error}catch(e){meta.error=e}}}}else{return{get:function(){return model[property]},set:function(value){model[property]=value}}}}exports.binding=makeBinding;exports.html.binding=makeBinding;exports.html.meta=bindingMeta;function generateClassName(obj){if(typeof obj=="object"){if(obj instanceof Array){return obj.join(" ")||undefined}else{return Object.keys(obj).filter(function(key){return obj[key]}).join(" ")||undefined}}else{return obj}}},{"./coerceToVdom":2,"./domComponent":4,"./meta":5,"./simplePromise":42,"virtual-dom/h":8}],42:[function(require,module,exports){function SimplePromise(){this.listeners=[]}SimplePromise.prototype.fulfill=function(value){if(!this.isFulfilled){this.isFulfilled=true;this.value=value;this.listeners.forEach(function(listener){listener()})}};SimplePromise.prototype.then=function(success){if(this.isFulfilled){var self=this;setTimeout(function(){success(self.value)})}else{this.listeners.push(success)}};module.exports=function(){return new SimplePromise}},{}],43:[function(require,module,exports){var domComponent=require("./domComponent");var VText=require("virtual-dom/vnode/vtext.js");function WindowWidget(attributes,vdom,refreshFunction){this.attributes=attributes;this.vdom=vdom||new VText("");this.component=domComponent();var self=this;this.cache={};Object.keys(this.attributes).forEach(function(key){self.cache[key]=refreshFunction(self.attributes[key])})}function applyAttribute(attributes,name,element){if(/^on/.test(name)){element.addEventListener(name.substr(2),this[name])}}WindowWidget.prototype.type="Widget";WindowWidget.prototype.init=function(){applyPropertyDiffs(window,{},this.attributes,{},this.cache);return this.component.create(this.vdom)};function uniq(array){var sortedArray=array.slice();sortedArray.sort();var last;for(var n=0;n<sortedArray.length;){var current=sortedArray[n];if(last===current){sortedArray.splice(n,1)}else{n++}last=current}return sortedArray}function applyPropertyDiffs(element,previous,current,previousCache,currentCache){uniq(Object.keys(previous).concat(Object.keys(current))).forEach(function(key){if(/^on/.test(key)){var event=key.slice(2);var prev=previous[key];var curr=current[key];var refreshPrev=previousCache[key];var refreshCurr=currentCache[key];if(prev!==undefined&&curr===undefined){element.removeEventListener(event,refreshPrev)}else if(prev!==undefined&&curr!==undefined&&prev!==curr){element.removeEventListener(event,refreshPrev);element.addEventListener(event,refreshCurr)}else if(prev===undefined&&curr!==undefined){element.addEventListener(event,refreshCurr)}}})}WindowWidget.prototype.update=function(previous){var self=this;applyPropertyDiffs(window,previous.attributes,this.attributes,previous.cache,this.cache);this.component=previous.component;return this.component.update(this.vdom)};WindowWidget.prototype.destroy=function(){applyPropertyDiffs(window,this.attributes,{},this.cache,{});this.component.destroy()};module.exports=function(attributes,vdom,refreshFunction){return new WindowWidget(attributes,vdom,refreshFunction)}},{"./domComponent":4,"virtual-dom/vnode/vtext.js":36}],plastiq:[function(require,module,exports){var rendering=require("./rendering");exports.html=rendering.html;exports.attach=rendering.attach;exports.replace=rendering.replace;exports.append=rendering.append;exports.bind=require("./oldbind");exports.binding=rendering.binding;var windowEvents=require("./windowEvents");exports.html.window=function(attributes,vdom){return windowEvents(attributes,vdom,rendering.html.refreshify)};exports.html.rawHtml=require("./rawHtml");exports.html.component=require("./component")},{"./component":3,"./oldbind":39,"./rawHtml":40,"./rendering":41,"./windowEvents":43}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){},{}],2:[function(require,module,exports){var vtext=require("virtual-dom/vnode/vtext.js");module.exports=function(child){if(child===undefined||child===null){return undefined}else if(typeof child!="object"){return new vtext(String(child))}else if(child instanceof Date){return new vtext(String(child))}else if(child instanceof Error){return new vtext(child.toString())}else{return child}}},{"virtual-dom/vnode/vtext.js":37}],3:[function(require,module,exports){var h=require("./rendering").html;var VText=require("virtual-dom/vnode/vtext.js");var domComponent=require("./domComponent");function ComponentWidget(state,vdom){this.state=state;this.key=state.key;if(typeof vdom==="function"){this.render=function(){return vdom.apply(this.state,arguments)};this.canRefresh=true}else{vdom=vdom||new VText("");this.render=function(){return vdom}}this.cacheKey=state.cacheKey;this.component=domComponent();this.renderFinished=h.currentRender.finished}ComponentWidget.prototype.type="Widget";ComponentWidget.prototype.init=function(){var self=this;if(self.state.onbeforeadd){self.state.onbeforeadd()}var vdom=this.render(this);if(vdom instanceof Array){throw new Error("vdom returned from component cannot be an array")}var element=this.component.create(vdom);if(self.state.onadd){this.renderFinished.then(function(){self.state.onadd(element)})}if(self.state.detached){return document.createTextNode("")}else{return element}};ComponentWidget.prototype.update=function(previous){var self=this;var refresh=!this.cacheKey||this.cacheKey!==previous.cacheKey;if(refresh){if(self.state.onupdate){this.renderFinished.then(function(){self.state.onupdate(self.component.element)})}}this.component=previous.component;if(previous.state&&this.state){var keys=Object.keys(this.state);for(var n=0;n<keys.length;n++){var key=keys[n];previous.state[key]=self.state[key]}this.state=previous.state}if(refresh){var element=this.component.update(this.render(this));if(self.state.detached){return document.createTextNode("")}else{return element}}};ComponentWidget.prototype.asdfasd=4;ComponentWidget.prototype.asdfasd=function(){};ComponentWidget.prototype.refresh=function(){this.component.update(this.render(this));if(this.state.onupdate){this.state.onupdate(this.component.element)}};ComponentWidget.prototype.destroy=function(element){var self=this;if(self.state.onremove){this.renderFinished.then(function(){self.state.onremove(element)})}this.component.destroy()};module.exports=function(state,vdom){if(typeof state==="function"){return new ComponentWidget({},state)}else if(state.constructor===Object){return new ComponentWidget(state,vdom)}else{return new ComponentWidget({},state)}};module.exports.ComponentWidget=ComponentWidget},{"./domComponent":4,"./rendering":42,"virtual-dom/vnode/vtext.js":37}],4:[function(require,module,exports){var createElement=require("virtual-dom/create-element");var diff=require("virtual-dom/diff");var patch=require("virtual-dom/patch");var coerceToVdom=require("./coerceToVdom");function DomComponent(){}DomComponent.prototype.create=function(vdom){vdom=coerceToVdom(vdom);this.vdom=vdom;this.element=createElement(vdom);return this.element};DomComponent.prototype.update=function(vdom){var patches=diff(this.vdom,vdom);this.element=patch(this.element,patches);this.vdom=vdom;return this.element};DomComponent.prototype.destroy=function(options){function destroyWidgets(vdom){if(vdom.type==="Widget"){vdom.destroy()}else if(vdom.children){vdom.children.forEach(destroyWidgets)}}destroyWidgets(this.vdom);if(options&&options.removeElement&&this.element.parentNode){this.element.parentNode.removeChild(this.element)}};function domComponent(){return new DomComponent}module.exports=domComponent},{"./coerceToVdom":2,"virtual-dom/create-element":7,"virtual-dom/diff":8,"virtual-dom/patch":17}],5:[function(require,module,exports){var rendering=require("./rendering");exports.html=rendering.html;exports.attach=rendering.attach;exports.replace=rendering.replace;exports.append=rendering.append;exports.bind=require("./oldbind");exports.binding=rendering.binding;var windowEvents=require("./windowEvents");exports.html.window=function(attributes,vdom){return windowEvents(attributes,vdom,rendering.html.refreshify)};exports.html.rawHtml=require("./rawHtml");exports.html.component=require("./component")},{"./component":3,"./oldbind":40,"./rawHtml":41,"./rendering":42,"./windowEvents":44}],6:[function(require,module,exports){module.exports=function(model,property){var plastiqMeta=model._plastiqMeta;if(!plastiqMeta){plastiqMeta={};Object.defineProperty(model,"_plastiqMeta",{value:plastiqMeta})}var meta=plastiqMeta[property];if(!meta){meta=plastiqMeta[property]={}}return meta}},{}],7:[function(require,module,exports){var createElement=require("./vdom/create-element.js");module.exports=createElement},{"./vdom/create-element.js":19}],8:[function(require,module,exports){var diff=require("./vtree/diff.js");module.exports=diff},{"./vtree/diff.js":39}],9:[function(require,module,exports){var h=require("./virtual-hyperscript/index.js");module.exports=h},{"./virtual-hyperscript/index.js":26}],10:[function(require,module,exports){module.exports=function split(undef){var nativeSplit=String.prototype.split,compliantExecNpcg=/()??/.exec("")[1]===undef,self;self=function(str,separator,limit){if(Object.prototype.toString.call(separator)!=="[object RegExp]"){return nativeSplit.call(str,separator,limit)}var output=[],flags=(separator.ignoreCase?"i":"")+(separator.multiline?"m":"")+(separator.extended?"x":"")+(separator.sticky?"y":""),lastLastIndex=0,separator=new RegExp(separator.source,flags+"g"),separator2,match,lastIndex,lastLength;str+="";if(!compliantExecNpcg){separator2=new RegExp("^"+separator.source+"$(?!\\s)",flags)}limit=limit===undef?-1>>>0:limit>>>0;while(match=separator.exec(str)){lastIndex=match.index+match[0].length;if(lastIndex>lastLastIndex){output.push(str.slice(lastLastIndex,match.index));if(!compliantExecNpcg&&match.length>1){match[0].replace(separator2,function(){for(var i=1;i<arguments.length-2;i++){if(arguments[i]===undef){match[i]=undef}}})}if(match.length>1&&match.index<str.length){Array.prototype.push.apply(output,match.slice(1))}lastLength=match[0].length;lastLastIndex=lastIndex;if(output.length>=limit){break}}if(separator.lastIndex===match.index){separator.lastIndex++}}if(lastLastIndex===str.length){if(lastLength||!separator.test("")){output.push("")}}else{output.push(str.slice(lastLastIndex))}return output.length>limit?output.slice(0,limit):output};return self}()},{}],11:[function(require,module,exports){"use strict";var OneVersionConstraint=require("individual/one-version");var MY_VERSION="7";OneVersionConstraint("ev-store",MY_VERSION);var hashKey="__EV_STORE_KEY@"+MY_VERSION;module.exports=EvStore;function EvStore(elem){var hash=elem[hashKey];if(!hash){hash=elem[hashKey]={}}return hash}},{"individual/one-version":13}],12:[function(require,module,exports){(function(global){"use strict";var root=typeof window!=="undefined"?window:typeof global!=="undefined"?global:{};module.exports=Individual;function Individual(key,value){if(key in root){return root[key]}root[key]=value;return value}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],13:[function(require,module,exports){"use strict";var Individual=require("./index.js");module.exports=OneVersion;function OneVersion(moduleName,version,defaultValue){var key="__INDIVIDUAL_ONE_VERSION_"+moduleName;var enforceKey=key+"_ENFORCE_SINGLETON";var versionValue=Individual(enforceKey,version);if(versionValue!==version){throw new Error("Can only have one copy of "+moduleName+".\n"+"You already have version "+versionValue+" installed.\n"+"This means you cannot install version "+version)}return Individual(key,defaultValue)}},{"./index.js":12}],14:[function(require,module,exports){(function(global){var topLevel=typeof global!=="undefined"?global:typeof window!=="undefined"?window:{};var minDoc=require("min-document");if(typeof document!=="undefined"){module.exports=document}else{var doccy=topLevel["__GLOBAL_DOCUMENT_CACHE@4"];if(!doccy){doccy=topLevel["__GLOBAL_DOCUMENT_CACHE@4"]=minDoc}module.exports=doccy}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"min-document":1}],15:[function(require,module,exports){"use strict";module.exports=function isObject(x){return typeof x==="object"&&x!==null}},{}],16:[function(require,module,exports){var nativeIsArray=Array.isArray;var toString=Object.prototype.toString;module.exports=nativeIsArray||isArray;function isArray(obj){return toString.call(obj)==="[object Array]"}},{}],17:[function(require,module,exports){var patch=require("./vdom/patch.js");module.exports=patch},{"./vdom/patch.js":22}],18:[function(require,module,exports){var isObject=require("is-object");var isHook=require("../vnode/is-vhook.js");module.exports=applyProperties;function applyProperties(node,props,previous){for(var propName in props){var propValue=props[propName];if(propValue===undefined){removeProperty(node,propName,propValue,previous)}else if(isHook(propValue)){removeProperty(node,propName,propValue,previous);if(propValue.hook){propValue.hook(node,propName,previous?previous[propName]:undefined)}}else{if(isObject(propValue)){patchObject(node,props,previous,propName,propValue)}else{node[propName]=propValue}}}}function removeProperty(node,propName,propValue,previous){if(previous){var previousValue=previous[propName];if(!isHook(previousValue)){if(propName==="attributes"){for(var attrName in previousValue){node.removeAttribute(attrName)}}else if(propName==="style"){for(var i in previousValue){node.style[i]=""}}else if(typeof previousValue==="string"){node[propName]=""}else{node[propName]=null}}else if(previousValue.unhook){previousValue.unhook(node,propName,propValue)}}}function patchObject(node,props,previous,propName,propValue){var previousValue=previous?previous[propName]:undefined;if(propName==="attributes"){for(var attrName in propValue){var attrValue=propValue[attrName];if(attrValue===undefined){node.removeAttribute(attrName)}else{node.setAttribute(attrName,attrValue)}}return}if(previousValue&&isObject(previousValue)&&getPrototype(previousValue)!==getPrototype(propValue)){node[propName]=propValue;return}if(!isObject(node[propName])){node[propName]={}}var replacer=propName==="style"?"":undefined;for(var k in propValue){var value=propValue[k];node[propName][k]=value===undefined?replacer:value}}function getPrototype(value){if(Object.getPrototypeOf){return Object.getPrototypeOf(value)}else if(value.__proto__){return value.__proto__}else if(value.constructor){return value.constructor.prototype}}},{"../vnode/is-vhook.js":30,"is-object":15}],19:[function(require,module,exports){var document=require("global/document");var applyProperties=require("./apply-properties");var isVNode=require("../vnode/is-vnode.js");var isVText=require("../vnode/is-vtext.js");var isWidget=require("../vnode/is-widget.js");var handleThunk=require("../vnode/handle-thunk.js");module.exports=createElement;function createElement(vnode,opts){var doc=opts?opts.document||document:document;var warn=opts?opts.warn:null;vnode=handleThunk(vnode).a;if(isWidget(vnode)){return vnode.init()}else if(isVText(vnode)){return doc.createTextNode(vnode.text)}else if(!isVNode(vnode)){if(warn){warn("Item is not a valid virtual dom node",vnode)}return null}var node=vnode.namespace===null?doc.createElement(vnode.tagName):doc.createElementNS(vnode.namespace,vnode.tagName);var props=vnode.properties;applyProperties(node,props);var children=vnode.children;for(var i=0;i<children.length;i++){var childNode=createElement(children[i],opts);if(childNode){node.appendChild(childNode)}}return node}},{"../vnode/handle-thunk.js":28,"../vnode/is-vnode.js":31,"../vnode/is-vtext.js":32,"../vnode/is-widget.js":33,"./apply-properties":18,"global/document":14}],20:[function(require,module,exports){var noChild={};module.exports=domIndex;function domIndex(rootNode,tree,indices,nodes){if(!indices||indices.length===0){return{}}else{indices.sort(ascending);return recurse(rootNode,tree,indices,nodes,0)}}function recurse(rootNode,tree,indices,nodes,rootIndex){nodes=nodes||{};if(rootNode){if(indexInRange(indices,rootIndex,rootIndex)){nodes[rootIndex]=rootNode}var vChildren=tree.children;if(vChildren){var childNodes=rootNode.childNodes;for(var i=0;i<tree.children.length;i++){rootIndex+=1;var vChild=vChildren[i]||noChild;var nextIndex=rootIndex+(vChild.count||0);if(indexInRange(indices,rootIndex,nextIndex)){recurse(childNodes[i],vChild,indices,nodes,rootIndex)}rootIndex=nextIndex}}}return nodes}function indexInRange(indices,left,right){if(indices.length===0){return false}var minIndex=0;var maxIndex=indices.length-1;var currentIndex;var currentItem;while(minIndex<=maxIndex){currentIndex=(maxIndex+minIndex)/2>>0;currentItem=indices[currentIndex];if(minIndex===maxIndex){return currentItem>=left&¤tItem<=right}else if(currentItem<left){minIndex=currentIndex+1}else if(currentItem>right){maxIndex=currentIndex-1}else{return true}}return false}function ascending(a,b){return a>b?1:-1}},{}],21:[function(require,module,exports){var applyProperties=require("./apply-properties");var isWidget=require("../vnode/is-widget.js");var VPatch=require("../vnode/vpatch.js");var render=require("./create-element");var updateWidget=require("./update-widget");module.exports=applyPatch;function applyPatch(vpatch,domNode,renderOptions){var type=vpatch.type;var vNode=vpatch.vNode;var patch=vpatch.patch;switch(type){case VPatch.REMOVE:return removeNode(domNode,vNode);case VPatch.INSERT:return insertNode(domNode,patch,renderOptions);case VPatch.VTEXT:return stringPatch(domNode,vNode,patch,renderOptions);case VPatch.WIDGET:return widgetPatch(domNode,vNode,patch,renderOptions);case VPatch.VNODE:return vNodePatch(domNode,vNode,patch,renderOptions);case VPatch.ORDER:reorderChildren(domNode,patch);return domNode;case VPatch.PROPS:applyProperties(domNode,patch,vNode.properties);return domNode;case VPatch.THUNK:return replaceRoot(domNode,renderOptions.patch(domNode,patch,renderOptions));default:return domNode}}function removeNode(domNode,vNode){var parentNode=domNode.parentNode;if(parentNode){parentNode.removeChild(domNode)}destroyWidget(domNode,vNode);return null}function insertNode(parentNode,vNode,renderOptions){var newNode=render(vNode,renderOptions);if(parentNode){parentNode.appendChild(newNode); | |
}return parentNode}function stringPatch(domNode,leftVNode,vText,renderOptions){var newNode;if(domNode.nodeType===3){domNode.replaceData(0,domNode.length,vText.text);newNode=domNode}else{var parentNode=domNode.parentNode;newNode=render(vText,renderOptions);if(parentNode&&newNode!==domNode){parentNode.replaceChild(newNode,domNode)}}return newNode}function widgetPatch(domNode,leftVNode,widget,renderOptions){var updating=updateWidget(leftVNode,widget);var newNode;if(updating){newNode=widget.update(leftVNode,domNode)||domNode}else{newNode=render(widget,renderOptions)}var parentNode=domNode.parentNode;if(parentNode&&newNode!==domNode){parentNode.replaceChild(newNode,domNode)}if(!updating){destroyWidget(domNode,leftVNode)}return newNode}function vNodePatch(domNode,leftVNode,vNode,renderOptions){var parentNode=domNode.parentNode;var newNode=render(vNode,renderOptions);if(parentNode&&newNode!==domNode){parentNode.replaceChild(newNode,domNode)}return newNode}function destroyWidget(domNode,w){if(typeof w.destroy==="function"&&isWidget(w)){w.destroy(domNode)}}function reorderChildren(domNode,moves){var childNodes=domNode.childNodes;var keyMap={};var node;var remove;var insert;for(var i=0;i<moves.removes.length;i++){remove=moves.removes[i];node=childNodes[remove.from];if(remove.key){keyMap[remove.key]=node}domNode.removeChild(node)}var length=childNodes.length;for(var j=0;j<moves.inserts.length;j++){insert=moves.inserts[j];node=keyMap[insert.key];domNode.insertBefore(node,insert.to>=length++?null:childNodes[insert.to])}}function replaceRoot(oldRoot,newRoot){if(oldRoot&&newRoot&&oldRoot!==newRoot&&oldRoot.parentNode){oldRoot.parentNode.replaceChild(newRoot,oldRoot)}return newRoot}},{"../vnode/is-widget.js":33,"../vnode/vpatch.js":36,"./apply-properties":18,"./create-element":19,"./update-widget":23}],22:[function(require,module,exports){var document=require("global/document");var isArray=require("x-is-array");var domIndex=require("./dom-index");var patchOp=require("./patch-op");module.exports=patch;function patch(rootNode,patches){return patchRecursive(rootNode,patches)}function patchRecursive(rootNode,patches,renderOptions){var indices=patchIndices(patches);if(indices.length===0){return rootNode}var index=domIndex(rootNode,patches.a,indices);var ownerDocument=rootNode.ownerDocument;if(!renderOptions){renderOptions={patch:patchRecursive};if(ownerDocument!==document){renderOptions.document=ownerDocument}}for(var i=0;i<indices.length;i++){var nodeIndex=indices[i];rootNode=applyPatch(rootNode,index[nodeIndex],patches[nodeIndex],renderOptions)}return rootNode}function applyPatch(rootNode,domNode,patchList,renderOptions){if(!domNode){return rootNode}var newNode;if(isArray(patchList)){for(var i=0;i<patchList.length;i++){newNode=patchOp(patchList[i],domNode,renderOptions);if(domNode===rootNode){rootNode=newNode}}}else{newNode=patchOp(patchList,domNode,renderOptions);if(domNode===rootNode){rootNode=newNode}}return rootNode}function patchIndices(patches){var indices=[];for(var key in patches){if(key!=="a"){indices.push(Number(key))}}return indices}},{"./dom-index":20,"./patch-op":21,"global/document":14,"x-is-array":16}],23:[function(require,module,exports){var isWidget=require("../vnode/is-widget.js");module.exports=updateWidget;function updateWidget(a,b){if(isWidget(a)&&isWidget(b)){if("name"in a&&"name"in b){return a.id===b.id}else{return a.init===b.init}}return false}},{"../vnode/is-widget.js":33}],24:[function(require,module,exports){"use strict";var EvStore=require("ev-store");module.exports=EvHook;function EvHook(value){if(!(this instanceof EvHook)){return new EvHook(value)}this.value=value}EvHook.prototype.hook=function(node,propertyName){var es=EvStore(node);var propName=propertyName.substr(3);es[propName]=this.value};EvHook.prototype.unhook=function(node,propertyName){var es=EvStore(node);var propName=propertyName.substr(3);es[propName]=undefined}},{"ev-store":11}],25:[function(require,module,exports){"use strict";module.exports=SoftSetHook;function SoftSetHook(value){if(!(this instanceof SoftSetHook)){return new SoftSetHook(value)}this.value=value}SoftSetHook.prototype.hook=function(node,propertyName){if(node[propertyName]!==this.value){node[propertyName]=this.value}}},{}],26:[function(require,module,exports){"use strict";var isArray=require("x-is-array");var VNode=require("../vnode/vnode.js");var VText=require("../vnode/vtext.js");var isVNode=require("../vnode/is-vnode");var isVText=require("../vnode/is-vtext");var isWidget=require("../vnode/is-widget");var isHook=require("../vnode/is-vhook");var isVThunk=require("../vnode/is-thunk");var parseTag=require("./parse-tag.js");var softSetHook=require("./hooks/soft-set-hook.js");var evHook=require("./hooks/ev-hook.js");module.exports=h;function h(tagName,properties,children){var childNodes=[];var tag,props,key,namespace;if(!children&&isChildren(properties)){children=properties;props={}}props=props||properties||{};tag=parseTag(tagName,props);if(props.hasOwnProperty("key")){key=props.key;props.key=undefined}if(props.hasOwnProperty("namespace")){namespace=props.namespace;props.namespace=undefined}if(tag==="INPUT"&&!namespace&&props.hasOwnProperty("value")&&props.value!==undefined&&!isHook(props.value)){props.value=softSetHook(props.value)}transformProperties(props);if(children!==undefined&&children!==null){addChild(children,childNodes,tag,props)}return new VNode(tag,props,childNodes,key,namespace)}function addChild(c,childNodes,tag,props){if(typeof c==="string"){childNodes.push(new VText(c))}else if(isChild(c)){childNodes.push(c)}else if(isArray(c)){for(var i=0;i<c.length;i++){addChild(c[i],childNodes,tag,props)}}else if(c===null||c===undefined){return}else{throw UnexpectedVirtualElement({foreignObject:c,parentVnode:{tagName:tag,properties:props}})}}function transformProperties(props){for(var propName in props){if(props.hasOwnProperty(propName)){var value=props[propName];if(isHook(value)){continue}if(propName.substr(0,3)==="ev-"){props[propName]=evHook(value)}}}}function isChild(x){return isVNode(x)||isVText(x)||isWidget(x)||isVThunk(x)}function isChildren(x){return typeof x==="string"||isArray(x)||isChild(x)}function UnexpectedVirtualElement(data){var err=new Error;err.type="virtual-hyperscript.unexpected.virtual-element";err.message="Unexpected virtual child passed to h().\n"+"Expected a VNode / Vthunk / VWidget / string but:\n"+"got:\n"+errorString(data.foreignObject)+".\n"+"The parent vnode is:\n"+errorString(data.parentVnode);"\n"+"Suggested fix: change your `h(..., [ ... ])` callsite.";err.foreignObject=data.foreignObject;err.parentVnode=data.parentVnode;return err}function errorString(obj){try{return JSON.stringify(obj,null," ")}catch(e){return String(obj)}}},{"../vnode/is-thunk":29,"../vnode/is-vhook":30,"../vnode/is-vnode":31,"../vnode/is-vtext":32,"../vnode/is-widget":33,"../vnode/vnode.js":35,"../vnode/vtext.js":37,"./hooks/ev-hook.js":24,"./hooks/soft-set-hook.js":25,"./parse-tag.js":27,"x-is-array":16}],27:[function(require,module,exports){"use strict";var split=require("browser-split");var classIdSplit=/([\.#]?[a-zA-Z0-9_:-]+)/;var notClassId=/^\.|#/;module.exports=parseTag;function parseTag(tag,props){if(!tag){return"DIV"}var noId=!props.hasOwnProperty("id");var tagParts=split(tag,classIdSplit);var tagName=null;if(notClassId.test(tagParts[1])){tagName="DIV"}var classes,part,type,i;for(i=0;i<tagParts.length;i++){part=tagParts[i];if(!part){continue}type=part.charAt(0);if(!tagName){tagName=part}else if(type==="."){classes=classes||[];classes.push(part.substring(1,part.length))}else if(type==="#"&&noId){props.id=part.substring(1,part.length)}}if(classes){if(props.className){classes.push(props.className)}props.className=classes.join(" ")}return props.namespace?tagName:tagName.toUpperCase()}},{"browser-split":10}],28:[function(require,module,exports){var isVNode=require("./is-vnode");var isVText=require("./is-vtext");var isWidget=require("./is-widget");var isThunk=require("./is-thunk");module.exports=handleThunk;function handleThunk(a,b){var renderedA=a;var renderedB=b;if(isThunk(b)){renderedB=renderThunk(b,a)}if(isThunk(a)){renderedA=renderThunk(a,null)}return{a:renderedA,b:renderedB}}function renderThunk(thunk,previous){var renderedThunk=thunk.vnode;if(!renderedThunk){renderedThunk=thunk.vnode=thunk.render(previous)}if(!(isVNode(renderedThunk)||isVText(renderedThunk)||isWidget(renderedThunk))){throw new Error("thunk did not return a valid node")}return renderedThunk}},{"./is-thunk":29,"./is-vnode":31,"./is-vtext":32,"./is-widget":33}],29:[function(require,module,exports){module.exports=isThunk;function isThunk(t){return t&&t.type==="Thunk"}},{}],30:[function(require,module,exports){module.exports=isHook;function isHook(hook){return hook&&(typeof hook.hook==="function"&&!hook.hasOwnProperty("hook")||typeof hook.unhook==="function"&&!hook.hasOwnProperty("unhook"))}},{}],31:[function(require,module,exports){var version=require("./version");module.exports=isVirtualNode;function isVirtualNode(x){return x&&x.type==="VirtualNode"&&x.version===version}},{"./version":34}],32:[function(require,module,exports){var version=require("./version");module.exports=isVirtualText;function isVirtualText(x){return x&&x.type==="VirtualText"&&x.version===version}},{"./version":34}],33:[function(require,module,exports){module.exports=isWidget;function isWidget(w){return w&&w.type==="Widget"}},{}],34:[function(require,module,exports){module.exports="2"},{}],35:[function(require,module,exports){var version=require("./version");var isVNode=require("./is-vnode");var isWidget=require("./is-widget");var isThunk=require("./is-thunk");var isVHook=require("./is-vhook");module.exports=VirtualNode;var noProperties={};var noChildren=[];function VirtualNode(tagName,properties,children,key,namespace){this.tagName=tagName;this.properties=properties||noProperties;this.children=children||noChildren;this.key=key!=null?String(key):undefined;this.namespace=typeof namespace==="string"?namespace:null;var count=children&&children.length||0;var descendants=0;var hasWidgets=false;var hasThunks=false;var descendantHooks=false;var hooks;for(var propName in properties){if(properties.hasOwnProperty(propName)){var property=properties[propName];if(isVHook(property)&&property.unhook){if(!hooks){hooks={}}hooks[propName]=property}}}for(var i=0;i<count;i++){var child=children[i];if(isVNode(child)){descendants+=child.count||0;if(!hasWidgets&&child.hasWidgets){hasWidgets=true}if(!hasThunks&&child.hasThunks){hasThunks=true}if(!descendantHooks&&(child.hooks||child.descendantHooks)){descendantHooks=true}}else if(!hasWidgets&&isWidget(child)){if(typeof child.destroy==="function"){hasWidgets=true}}else if(!hasThunks&&isThunk(child)){hasThunks=true}}this.count=count+descendants;this.hasWidgets=hasWidgets;this.hasThunks=hasThunks;this.hooks=hooks;this.descendantHooks=descendantHooks}VirtualNode.prototype.version=version;VirtualNode.prototype.type="VirtualNode"},{"./is-thunk":29,"./is-vhook":30,"./is-vnode":31,"./is-widget":33,"./version":34}],36:[function(require,module,exports){var version=require("./version");VirtualPatch.NONE=0;VirtualPatch.VTEXT=1;VirtualPatch.VNODE=2;VirtualPatch.WIDGET=3;VirtualPatch.PROPS=4;VirtualPatch.ORDER=5;VirtualPatch.INSERT=6;VirtualPatch.REMOVE=7;VirtualPatch.THUNK=8;module.exports=VirtualPatch;function VirtualPatch(type,vNode,patch){this.type=Number(type);this.vNode=vNode;this.patch=patch}VirtualPatch.prototype.version=version;VirtualPatch.prototype.type="VirtualPatch"},{"./version":34}],37:[function(require,module,exports){var version=require("./version");module.exports=VirtualText;function VirtualText(text){this.text=String(text)}VirtualText.prototype.version=version;VirtualText.prototype.type="VirtualText"},{"./version":34}],38:[function(require,module,exports){var isObject=require("is-object");var isHook=require("../vnode/is-vhook");module.exports=diffProps;function diffProps(a,b){var diff;for(var aKey in a){if(!(aKey in b)){diff=diff||{};diff[aKey]=undefined}var aValue=a[aKey];var bValue=b[aKey];if(aValue===bValue){continue}else if(isObject(aValue)&&isObject(bValue)){if(getPrototype(bValue)!==getPrototype(aValue)){diff=diff||{};diff[aKey]=bValue}else if(isHook(bValue)){diff=diff||{};diff[aKey]=bValue}else{var objectDiff=diffProps(aValue,bValue);if(objectDiff){diff=diff||{};diff[aKey]=objectDiff}}}else{diff=diff||{};diff[aKey]=bValue}}for(var bKey in b){if(!(bKey in a)){diff=diff||{};diff[bKey]=b[bKey]}}return diff}function getPrototype(value){if(Object.getPrototypeOf){return Object.getPrototypeOf(value)}else if(value.__proto__){return value.__proto__}else if(value.constructor){return value.constructor.prototype}}},{"../vnode/is-vhook":30,"is-object":15}],39:[function(require,module,exports){var isArray=require("x-is-array");var VPatch=require("../vnode/vpatch");var isVNode=require("../vnode/is-vnode");var isVText=require("../vnode/is-vtext");var isWidget=require("../vnode/is-widget");var isThunk=require("../vnode/is-thunk");var handleThunk=require("../vnode/handle-thunk");var diffProps=require("./diff-props");module.exports=diff;function diff(a,b){var patch={a:a};walk(a,b,patch,0);return patch}function walk(a,b,patch,index){if(a===b){return}var apply=patch[index];var applyClear=false;if(isThunk(a)||isThunk(b)){thunks(a,b,patch,index)}else if(b==null){if(!isWidget(a)){clearState(a,patch,index);apply=patch[index]}apply=appendPatch(apply,new VPatch(VPatch.REMOVE,a,b))}else if(isVNode(b)){if(isVNode(a)){if(a.tagName===b.tagName&&a.namespace===b.namespace&&a.key===b.key){var propsPatch=diffProps(a.properties,b.properties);if(propsPatch){apply=appendPatch(apply,new VPatch(VPatch.PROPS,a,propsPatch))}apply=diffChildren(a,b,patch,apply,index)}else{apply=appendPatch(apply,new VPatch(VPatch.VNODE,a,b));applyClear=true}}else{apply=appendPatch(apply,new VPatch(VPatch.VNODE,a,b));applyClear=true}}else if(isVText(b)){if(!isVText(a)){apply=appendPatch(apply,new VPatch(VPatch.VTEXT,a,b));applyClear=true}else if(a.text!==b.text){apply=appendPatch(apply,new VPatch(VPatch.VTEXT,a,b))}}else if(isWidget(b)){if(!isWidget(a)){applyClear=true}apply=appendPatch(apply,new VPatch(VPatch.WIDGET,a,b))}if(apply){patch[index]=apply}if(applyClear){clearState(a,patch,index)}}function diffChildren(a,b,patch,apply,index){var aChildren=a.children;var orderedSet=reorder(aChildren,b.children);var bChildren=orderedSet.children;var aLen=aChildren.length;var bLen=bChildren.length;var len=aLen>bLen?aLen:bLen;for(var i=0;i<len;i++){var leftNode=aChildren[i];var rightNode=bChildren[i];index+=1;if(!leftNode){if(rightNode){apply=appendPatch(apply,new VPatch(VPatch.INSERT,null,rightNode))}}else{walk(leftNode,rightNode,patch,index)}if(isVNode(leftNode)&&leftNode.count){index+=leftNode.count}}if(orderedSet.moves){apply=appendPatch(apply,new VPatch(VPatch.ORDER,a,orderedSet.moves))}return apply}function clearState(vNode,patch,index){unhook(vNode,patch,index);destroyWidgets(vNode,patch,index)}function destroyWidgets(vNode,patch,index){if(isWidget(vNode)){if(typeof vNode.destroy==="function"){patch[index]=appendPatch(patch[index],new VPatch(VPatch.REMOVE,vNode,null))}}else if(isVNode(vNode)&&(vNode.hasWidgets||vNode.hasThunks)){var children=vNode.children;var len=children.length;for(var i=0;i<len;i++){var child=children[i];index+=1;destroyWidgets(child,patch,index);if(isVNode(child)&&child.count){index+=child.count}}}else if(isThunk(vNode)){thunks(vNode,null,patch,index)}}function thunks(a,b,patch,index){var nodes=handleThunk(a,b);var thunkPatch=diff(nodes.a,nodes.b);if(hasPatches(thunkPatch)){patch[index]=new VPatch(VPatch.THUNK,null,thunkPatch)}}function hasPatches(patch){for(var index in patch){if(index!=="a"){return true}}return false}function unhook(vNode,patch,index){if(isVNode(vNode)){if(vNode.hooks){patch[index]=appendPatch(patch[index],new VPatch(VPatch.PROPS,vNode,undefinedKeys(vNode.hooks)))}if(vNode.descendantHooks||vNode.hasThunks){var children=vNode.children;var len=children.length;for(var i=0;i<len;i++){var child=children[i];index+=1;unhook(child,patch,index);if(isVNode(child)&&child.count){index+=child.count}}}}else if(isThunk(vNode)){thunks(vNode,null,patch,index)}}function undefinedKeys(obj){var result={};for(var key in obj){result[key]=undefined}return result}function reorder(aChildren,bChildren){var bChildIndex=keyIndex(bChildren);var bKeys=bChildIndex.keys;var bFree=bChildIndex.free;if(bFree.length===bChildren.length){return{children:bChildren,moves:null}}var aChildIndex=keyIndex(aChildren);var aKeys=aChildIndex.keys;var aFree=aChildIndex.free;if(aFree.length===aChildren.length){return{children:bChildren,moves:null}}var newChildren=[];var freeIndex=0;var freeCount=bFree.length;var deletedItems=0;for(var i=0;i<aChildren.length;i++){var aItem=aChildren[i];var itemIndex;if(aItem.key){if(bKeys.hasOwnProperty(aItem.key)){itemIndex=bKeys[aItem.key];newChildren.push(bChildren[itemIndex])}else{itemIndex=i-deletedItems++;newChildren.push(null)}}else{if(freeIndex<freeCount){itemIndex=bFree[freeIndex++];newChildren.push(bChildren[itemIndex])}else{itemIndex=i-deletedItems++;newChildren.push(null)}}}var lastFreeIndex=freeIndex>=bFree.length?bChildren.length:bFree[freeIndex];for(var j=0;j<bChildren.length;j++){var newItem=bChildren[j];if(newItem.key){if(!aKeys.hasOwnProperty(newItem.key)){newChildren.push(newItem)}}else if(j>=lastFreeIndex){newChildren.push(newItem)}}var simulate=newChildren.slice();var simulateIndex=0;var removes=[];var inserts=[];var simulateItem;for(var k=0;k<bChildren.length;){var wantedItem=bChildren[k];simulateItem=simulate[simulateIndex];while(simulateItem===null&&simulate.length){removes.push(remove(simulate,simulateIndex,null));simulateItem=simulate[simulateIndex]}if(!simulateItem||simulateItem.key!==wantedItem.key){if(wantedItem.key){if(simulateItem&&simulateItem.key){if(bKeys[simulateItem.key]!==k+1){removes.push(remove(simulate,simulateIndex,simulateItem.key));simulateItem=simulate[simulateIndex];if(!simulateItem||simulateItem.key!==wantedItem.key){inserts.push({key:wantedItem.key,to:k})}else{simulateIndex++}}else{inserts.push({key:wantedItem.key,to:k})}}else{inserts.push({key:wantedItem.key,to:k})}k++}else if(simulateItem&&simulateItem.key){removes.push(remove(simulate,simulateIndex,simulateItem.key))}}else{simulateIndex++;k++}}while(simulateIndex<simulate.length){simulateItem=simulate[simulateIndex];removes.push(remove(simulate,simulateIndex,simulateItem&&simulateItem.key))}if(removes.length===deletedItems&&!inserts.length){return{children:newChildren,moves:null}}return{children:newChildren,moves:{removes:removes,inserts:inserts}}}function remove(arr,index,key){arr.splice(index,1);return{from:index,key:key}}function keyIndex(children){var keys={};var free=[];var length=children.length;for(var i=0;i<length;i++){var child=children[i];if(child.key){keys[child.key]=i}else{free.push(i)}}return{keys:keys,free:free}}function appendPatch(apply,patch){if(apply){if(isArray(apply)){apply.push(patch)}else{apply=[apply,patch]}return apply}else{return patch}}},{"../vnode/handle-thunk":28,"../vnode/is-thunk":29,"../vnode/is-vnode":31,"../vnode/is-vtext":32,"../vnode/is-widget":33,"../vnode/vpatch":36,"./diff-props":38,"x-is-array":16}],40:[function(require,module,exports){module.exports=function(obj,prop){console.log("plastiq.bind() will be deprecated in the next release, use [model, 'fieldName'] instead");return{get:function(){return obj[prop]},set:function(value){obj[prop]=value}}}},{}],41:[function(require,module,exports){var createElement=require("virtual-dom/create-element");var rendering=require("./rendering");function RawHtmlWidget(selector,options,html){this.selector=selector;this.options=options;this.html=html}RawHtmlWidget.prototype.type="Widget";RawHtmlWidget.prototype.init=function(){var element=createElement(rendering.html(this.selector,this.options));var html=this.html;element.innerHTML=html===undefined||html===null?"":html;return element};RawHtmlWidget.prototype.update=function(previous,element){if(this.html!=previous.html){element.parentNode.replaceChild(this.init(),element)}};RawHtmlWidget.prototype.destroy=function(element){};module.exports=function(selector,options,html){if(arguments.length==2){return new RawHtmlWidget(selector,undefined,options)}else{return new RawHtmlWidget(selector,options,html)}}},{"./rendering":42,"virtual-dom/create-element":7}],42:[function(require,module,exports){var h=require("virtual-dom/h");var domComponent=require("./domComponent");var simplePromise=require("./simplePromise");var bindingMeta=require("./meta");var coerceToVdom=require("./coerceToVdom");function doThenFireAfterRender(attachment,fn){try{exports.html.currentRender=attachment;exports.html.currentRender.finished=simplePromise();exports.html.refresh=function(component){if(isComponent(component)){refreshComponent(component,attachment)}else{attachment.refresh()}};fn()}finally{exports.html.currentRender.finished.fulfill();exports.html.currentRender.finished=undefined;delete exports.html.currentRender;exports.html.refresh=refreshOutOfRender}}function refreshOutOfRender(){throw new Error("Please assign plastiq.html.refresh during a render cycle if you want to use it in event handlers. See https://github.com/featurist/plastiq#refresh-outside-render-cycle")}function isComponent(component){return component&&typeof component.init==="function"&&typeof component.update==="function"&&typeof component.destroy==="function"}exports.append=function(element,render,model,options){return start(render,model,options,function(createdElement){element.appendChild(createdElement)})};var attachmentId=1;function start(render,model,options,attachToDom){var win=options&&options.window||window;var requestRender=options&&options.requestRender||win.requestAnimationFrame||win.setTimeout;var requested=false;function refresh(){if(!requested){requestRender(function(){requested=false;if(attachment.attached){doThenFireAfterRender(attachment,function(){var vdom=render(model);component.update(vdom)})}});requested=true}}var attachment={refresh:refresh,requestRender:requestRender,id:attachmentId++,attached:true};var component=domComponent();doThenFireAfterRender(attachment,function(){var vdom=render(model);attachToDom(component.create(vdom))});return{detach:function(){attachment.attached=false},remove:function(){component.destroy({removeElement:true});attachment.attached=false}}}exports.replace=function(element,render,model,options){return start(render,model,options,function(createdElement){var parent=element.parentNode;element.parentNode.replaceChild(createdElement,element)})};exports.attach=function(){console.warn("plastiq.attach has been renamed to plastiq.append, plastiq.attach will be deprecated in a future version");return exports.append.apply(this,arguments)};function refreshComponent(component,attachment){if(!component.canRefresh){throw new Error("this component cannot be refreshed, make sure that the component's view is returned from a function")}if(!component.requested){var requestRender=attachment.requestRender;requestRender(function(){doThenFireAfterRender(attachment,function(){component.requested=false;component.refresh()})});component.requested=true}}var norefresh={};function refreshify(fn,options){if(!exports.html.currentRender){throw new Error("You cannot create virtual-dom event handlers outside a render function. See https://github.com/featurist/plastiq#outside-render-cycle")}var onlyRefreshAfterPromise=options&&options.refresh=="promise";var componentToRefresh=options&&options.component;if(options&&(options.norefresh==true||options.refresh==false)){return fn}var attachment=exports.html.currentRender;var r=exports.html.currentRender.refresh;return function(){var result=fn.apply(this,arguments);function handleResult(result,promiseResult){var allowRefresh=!onlyRefreshAfterPromise||promiseResult;if(allowRefresh&&result&&typeof result=="function"){console.warn("animations are now deprecated, you should consider using plastiq.html.refresh");result(r)}else if(result&&typeof result.then=="function"){if(allowRefresh){r()}result.then(function(result){handleResult(result,onlyRefreshAfterPromise)})}else if(result&&typeof result.init==="function"&&typeof result.update==="function"&&typeof result.destroy==="function"){refreshComponent(result,attachment)}else if(componentToRefresh){refreshComponent(componentToRefresh,attachment)}else if(result===norefresh){}else if(allowRefresh){r();return result}}return handleResult(result)}}function bindTextInput(attributes,children,get,set){var textEventNames=["onkeydown","oninput","onpaste","textInput"];var bindingValue=get();if(!(bindingValue instanceof Error)){attributes.value=bindingValue!=undefined?bindingValue:""}attachEventHandler(attributes,textEventNames,function(ev){if(bindingValue!=ev.target.value){set(ev.target.value)}})}function sequenceFunctions(handler1,handler2){return function(ev){handler1(ev);return handler2(ev)}}function insertEventHandler(attributes,eventName,handler,after){var previousHandler=attributes[eventName];if(previousHandler){if(after){attributes[eventName]=sequenceFunctions(previousHandler,handler)}else{attributes[eventName]=sequenceFunctions(handler,previousHandler)}}else{attributes[eventName]=handler}}function attachEventHandler(attributes,eventNames,handler){if(eventNames instanceof Array){for(var n=0;n<eventNames.length;n++){insertEventHandler(attributes,eventNames[n],handler)}}else{insertEventHandler(attributes,eventNames,handler)}}var inputTypeBindings={text:bindTextInput,textarea:bindTextInput,checkbox:function(attributes,children,get,set){attributes.checked=get();attachEventHandler(attributes,"onclick",function(ev){set(ev.target.checked)})},radio:function(attributes,children,get,set){var value=attributes.value;attributes.checked=get()==attributes.value;attachEventHandler(attributes,"onclick",function(ev){set(value)})},select:function(attributes,children,get,set){var currentValue=get();var options=children.filter(function(child){return child.tagName.toLowerCase()=="option"});var selectedOption=options.filter(function(child){return child.properties.value==currentValue})[0];var values=options.map(function(option){return option.properties.value});for(var n=0;n<options.length;n++){var option=options[n];option.properties.selected=option==selectedOption;option.properties.value=n}attachEventHandler(attributes,"onchange",function(ev){set(values[ev.target.value])})},file:function(attributes,children,get,set){var multiple=attributes.multiple;attachEventHandler(attributes,"onchange",function(ev){if(multiple){set(ev.target.files)}else{set(ev.target.files[0])}})}};function bindModel(attributes,children,type){var bind=inputTypeBindings[type]||bindTextInput;var bindingAttr=makeBinding(attributes.binding);bind(attributes,children,bindingAttr.get,bindingAttr.set)}function inputType(selector,attributes){if(/^textarea\b/i.test(selector)){return"textarea"}else if(/^select\b/i.test(selector)){return"select"}else{return attributes.type||"text"}}function flatten(startIndex,array){var flatArray=[];function append(startIndex,array){for(var n=startIndex;n<array.length;n++){var item=array[n];if(item instanceof Array){append(0,item)}else{flatArray.push(item)}}}append(startIndex,array);return flatArray}function coerceChildren(children){return children.map(coerceToVdom)}var renames={"for":"htmlFor","class":"className",contenteditable:"contentEditable",tabindex:"tabIndex",colspan:"colSpan"};var dataAttributeRegex=/^data-/;function prepareAttributes(selector,attributes,childElements){var keys=Object.keys(attributes);var dataset;for(var k=0;k<keys.length;k++){var key=keys[k];var attribute=attributes[key];if(typeof attribute=="function"){attributes[key]=refreshify(attribute)}var rename=renames[key];if(rename){attributes[rename]=attribute;delete attributes[key];continue}if(dataAttributeRegex.test(key)){if(!dataset){dataset=attributes.dataset;if(!dataset){dataset=attributes.dataset={}}}var datakey=key.replace(dataAttributeRegex,"");dataset[datakey]=attribute;delete attributes[key];continue}}if(attributes.className){attributes.className=generateClassName(attributes.className)}if(attributes.binding){bindModel(attributes,childElements,inputType(selector,attributes));delete attributes.binding}}exports.html=function(hierarchySelector){var hasHierarchy=hierarchySelector.indexOf(" ")>=0;var selector,selectorElements;if(hasHierarchy){selectorElements=hierarchySelector.match(/\S+/g);selector=selectorElements[selectorElements.length-1]}else{selector=hierarchySelector}var attributes;var childElements;var vdom;if(arguments[1]&&arguments[1].constructor==Object){attributes=arguments[1];childElements=coerceChildren(flatten(2,arguments));prepareAttributes(selector,attributes,childElements);vdom=h(selector,attributes,childElements)}else{childElements=coerceChildren(flatten(1,arguments));vdom=h(selector,childElements)}if(hasHierarchy){for(var n=selectorElements.length-2;n>=0;n--){vdom=h(selectorElements[n],vdom)}}return vdom};exports.html.refreshify=refreshify;exports.html.refresh=refreshOutOfRender;exports.html.norefresh=norefresh;function makeBinding(b,options){var binding=b instanceof Array?bindingObject.apply(undefined,b):b;binding.set=refreshify(binding.set,options);return binding}function makeConverter(converter){if(typeof converter=="function"){return{text:function(value){return value},value:function(text){return converter(text)}}}else{return converter}}function chainConverters(startIndex,converters){if(converters.length-startIndex==1){return makeConverter(converters[startIndex])}else{var _converters;function makeConverters(){if(!_converters){_converters=new Array(converters.length-startIndex);for(var n=startIndex;n<converters.length;n++){_converters[n-startIndex]=makeConverter(converters[n])}}}return{text:function(value){makeConverters();var intermediateValue=value;for(var n=0;n<_converters.length;n++){intermediateValue=_converters[n].text(intermediateValue)}return intermediateValue},value:function(text){makeConverters();var intermediateValue=text;for(var n=_converters.length-1;n>=0;n--){intermediateValue=_converters[n].value(intermediateValue)}return intermediateValue}}}}function bindingObject(model,property,options){if(arguments.length>2){var _converter;var bindingArguments=arguments;function buildConverter(){if(!_converter){_converter=chainConverters(2,bindingArguments)}}return{get:function(){buildConverter();var meta=bindingMeta(model,property);var modelValue=model[property];if(meta.error){return meta.text}else if(meta.text===undefined){var modelText=_converter.text(modelValue);meta.text=modelText;return modelText}else{var previousValue=_converter.value(meta.text);var modelText=_converter.text(modelValue);var normalisedPreviousText=_converter.text(previousValue);if(modelText===normalisedPreviousText){return meta.text}else{meta.text=modelText;return modelText}}},set:function(text){buildConverter();var meta=bindingMeta(model,property);meta.text=text;try{model[property]=_converter.value(text,model[property]);delete meta.error}catch(e){meta.error=e}}}}else{return{get:function(){return model[property]},set:function(value){model[property]=value}}}}exports.binding=makeBinding;exports.html.binding=makeBinding;exports.html.meta=bindingMeta;function generateClassName(obj){if(typeof obj=="object"){if(obj instanceof Array){return obj.join(" ")||undefined}else{return Object.keys(obj).filter(function(key){return obj[key]}).join(" ")||undefined}}else{return obj}}},{"./coerceToVdom":2,"./domComponent":4,"./meta":6,"./simplePromise":43,"virtual-dom/h":9}],43:[function(require,module,exports){function SimplePromise(){this.listeners=[]}SimplePromise.prototype.fulfill=function(value){if(!this.isFulfilled){this.isFulfilled=true;this.value=value;this.listeners.forEach(function(listener){listener()})}};SimplePromise.prototype.then=function(success){if(this.isFulfilled){var self=this;setTimeout(function(){success(self.value)})}else{this.listeners.push(success)}};module.exports=function(){return new SimplePromise}},{}], | |
44:[function(require,module,exports){var domComponent=require("./domComponent");var VText=require("virtual-dom/vnode/vtext.js");function WindowWidget(attributes,vdom,refreshFunction){this.attributes=attributes;this.vdom=vdom||new VText("");this.component=domComponent();var self=this;this.cache={};Object.keys(this.attributes).forEach(function(key){self.cache[key]=refreshFunction(self.attributes[key])})}function applyAttribute(attributes,name,element){if(/^on/.test(name)){element.addEventListener(name.substr(2),this[name])}}WindowWidget.prototype.type="Widget";WindowWidget.prototype.init=function(){applyPropertyDiffs(window,{},this.attributes,{},this.cache);return this.component.create(this.vdom)};function uniq(array){var sortedArray=array.slice();sortedArray.sort();var last;for(var n=0;n<sortedArray.length;){var current=sortedArray[n];if(last===current){sortedArray.splice(n,1)}else{n++}last=current}return sortedArray}function applyPropertyDiffs(element,previous,current,previousCache,currentCache){uniq(Object.keys(previous).concat(Object.keys(current))).forEach(function(key){if(/^on/.test(key)){var event=key.slice(2);var prev=previous[key];var curr=current[key];var refreshPrev=previousCache[key];var refreshCurr=currentCache[key];if(prev!==undefined&&curr===undefined){element.removeEventListener(event,refreshPrev)}else if(prev!==undefined&&curr!==undefined&&prev!==curr){element.removeEventListener(event,refreshPrev);element.addEventListener(event,refreshCurr)}else if(prev===undefined&&curr!==undefined){element.addEventListener(event,refreshCurr)}}})}WindowWidget.prototype.update=function(previous){var self=this;applyPropertyDiffs(window,previous.attributes,this.attributes,previous.cache,this.cache);this.component=previous.component;return this.component.update(this.vdom)};WindowWidget.prototype.destroy=function(){applyPropertyDiffs(window,this.attributes,{},this.cache,{});this.component.destroy()};module.exports=function(attributes,vdom,refreshFunction){return new WindowWidget(attributes,vdom,refreshFunction)}},{"./domComponent":4,"virtual-dom/vnode/vtext.js":37}],"plastiq-inspect":[function(require,module,exports){module.exports=function(){var plastiq=require("plastiq");var stylesheet=function(){return[".inspect { border: none }",".inspect-array { list-style-type: none; margin-bottom: 3px; padding: 0; "," border: 1px solid gray; border-bottom: none;"," }",".inspect-array-value { border-bottom: 1px solid gray; padding: 5px; }",".inspect-object { margin: 0px; border-collapse: collapse }",".inspect-object td { border: 1px solid gray; padding: 5px; "," vertical-align: top }",".inspect-date { color: purple; } ",".inspect-string { color: green; } ",".inspect-number { color: darkblue; }",".inspect-undefined { color: darkblue; }",".inspect-error { color: red; }"]}();var h=function(plastiq){return plastiq.html}(plastiq);var inspect=function(h,stylesheet){var inspectObject=function(object){var type=typeof object;var result="";if(type=="undefined"){return h(".inspect-undefined","undefined")}else if(object.constructor==this.Date){return h(".inspect-date",object.toString())}else if(object.constructor==this.Error){return h(".inspect-error",object.toString())}else if(type=="object"){if(object instanceof this.Array){result=h("ul.inspect-array",object.map(function(n){return h("li.inspect-array-value",inspectObject(n))}))}else{result=h("table.inspect-object",Object.keys(object).map(function(k){return h("tr.inspect-object",h("td.inspect-object-key",k),h("td.inspect-object-value",inspectObject(object[k])))}))}}else if(type=="number"){return h(".inspect-number",Number(object))}else if(type=="string"){return h(".inspect-string",object.toString())}else{return h(".inspect-unknown",object.toString())}return h(".inspect",result)};return function(object){return h(".inspect",h("style",{key:"inspect-style",attributes:{type:"text/css"}},stylesheet),inspectObject(object))}}(h,stylesheet);return inspect}()},{plastiq:5}]},{},[]);var plastiq=require("plastiq");var inspect=require("plastiq-inspect");plastiq.append(document.body,function(){return inspect({x:[1,2,"three"],y:{z:[4,5,6]}})}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "requirebin-sketch", | |
"version": "1.0.0", | |
"dependencies": { | |
"plastiq": "1.20.0", | |
"plastiq-inspect": "1.0.0" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- contents of this file will be placed inside the <body> --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- contents of this file will be placed inside the <head> --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment