You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
50 KiB
13 lines
50 KiB
4 years ago
|
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=12)}([function(e,t,n){"use strict";var r=n(2),o=Object.prototype.toString;function i(e){return"[object Array]"===o.call(e)}function s(e){return void 0===e}function a(e){return null!==e&&"object"==typeof e}function u(e){return"[object Function]"===o.call(e)}function c(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),i(e))for(var n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}e.exports={isArray:i,isArrayBuffer:function(e){return"[object ArrayBuffer]"===o.call(e)},isBuffer:function(e){return null!==e&&!s(e)&&null!==e.constructor&&!s(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:a,isUndefined:s,isDate:function(e){return"[object Date]"===o.call(e)},isFile:function(e){return"[object File]"===o.call(e)},isBlob:function(e){return"[object Blob]"===o.call(e)},isFunction:u,isStream:function(e){return a(e)&&u(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:c,merge:function e(){var t={};function n(n,r){"object"==typeof t[r]&&"object"==typeof n?t[r]=e(t[r],n):t[r]=n}for(var r=0,o=arguments.length;r<o;r++)c(arguments[r],n);return t},deepMerge:function e(){var t={};function n(n,r){"object"==typeof t[r]&&"object"==typeof n?t[r]=e(t[r],n):t[r]="object"==typeof n?e({},n):n}for(var r=0,o=arguments.length;r<o;r++)c(arguments[r],n);return t},extend:function(e,t,n){return c(t,(function(t,o){e[o]=n&&"function"==typeof t?r(t,n):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}}},function(e,t,n){e.exports=n(13)},function(e,t,n){"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}}},function(e,t,n){"use strict";var r=n(0);function o(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,n){if(!t)return e;var i;if(n)i=n(t);else if(r.isURLSearchParams(t))i=t.toString();else{var s=[];r.forEach(t,(function(e,t){null!=e&&(r.isArray(e)?t+="[]":e=[e],r.forEach(e,(function(e){r.isDate(e)?e=e.toISOString():r.isObject(e)&&(e=JSON.stringify(e)),s.push(o(t)+"="+o(e))})))})),i=s.join("&")}if(i){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}},function(e,t,n){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,n){"use strict";(function(t){var r=n(0),o=n(19),i={"Content-Type":"application/x-www-f
|
||
|
/*!
|
||
|
* validate.js 0.13.1
|
||
|
*
|
||
|
* (c) 2013-2019 Nicklas Ansman, 2013 Wrapp
|
||
|
* Validate.js may be freely distributed under the MIT license.
|
||
|
* For all details and documentation:
|
||
|
* http://validatejs.org/
|
||
|
*/
|
||
|
(function(e,t,r){"use strict";var o=function(e,t,n){n=i.extend({},i.options,n);var r=i.runValidations(e,t,n);if(r.some((function(e){return i.isPromise(e.error)})))throw new Error("Use validate.async if you want support for promises");return o.processValidationResults(r,n)},i=o;i.extend=function(e){return[].slice.call(arguments,1).forEach((function(t){for(var n in t)e[n]=t[n]})),e},i.extend(o,{version:{major:0,minor:13,patch:1,metadata:null,toString:function(){var e=i.format("%{major}.%{minor}.%{patch}",i.version);return i.isEmpty(i.version.metadata)||(e+="+"+i.version.metadata),e}},Promise:"undefined"!=typeof Promise?Promise:null,EMPTY_STRING_REGEXP:/^\s*$/,runValidations:function(e,t,n){var r,o,s,a,u,c,f,l=[];for(r in(i.isDomElement(e)||i.isJqueryElement(e))&&(e=i.collectFormValues(e)),t)for(o in s=i.getDeepObjectValue(e,r),a=i.result(t[r],s,e,r,n,t)){if(!(u=i.validators[o]))throw f=i.format("Unknown validator %{name}",{name:o}),new Error(f);c=a[o],(c=i.result(c,s,e,r,n,t))&&l.push({attribute:r,value:s,validator:o,globalOptions:n,attributes:e,options:c,error:u.call(u,s,c,r,e,n)})}return l},processValidationResults:function(e,t){e=i.pruneEmptyErrors(e,t),e=i.expandMultipleErrors(e,t),e=i.convertErrorMessages(e,t);var n=t.format||"grouped";if("function"!=typeof i.formatters[n])throw new Error(i.format("Unknown format %{format}",t));return e=i.formatters[n](e),i.isEmpty(e)?void 0:e},async:function(e,t,n){var r=(n=i.extend({},i.async.options,n)).wrapErrors||function(e){return e};!1!==n.cleanAttributes&&(e=i.cleanAttributes(e,t));var o=i.runValidations(e,t,n);return new i.Promise((function(s,a){i.waitForResults(o).then((function(){var u=i.processValidationResults(o,n);u?a(new r(u,n,e,t)):s(e)}),(function(e){a(e)}))}))},single:function(e,t,n){return n=i.extend({},i.single.options,n,{format:"flat",fullMessages:!1}),i({single:e},{single:t},n)},waitForResults:function(e){return e.reduce((function(e,t){return i.isPromise(t.error)?e.then((function(){return t.error.then((function(e){t.error=e||null}))})):e}),new i.Promise((function(e){e()})))},result:function(e){var t=[].slice.call(arguments,1);return"function"==typeof e&&(e=e.apply(null,t)),e},isNumber:function(e){return"number"==typeof e&&!isNaN(e)},isFunction:function(e){return"function"==typeof e},isInteger:function(e){return i.isNumber(e)&&e%1==0},isBoolean:function(e){return"boolean"==typeof e},isObject:function(e){return e===Object(e)},isDate:function(e){return e instanceof Date},isDefined:function(e){return null!=e},isPromise:function(e){return!!e&&i.isFunction(e.then)},isJqueryElement:function(e){return e&&i.isString(e.jquery)},isDomElement:function(e){return!!e&&(!(!e.querySelectorAll||!e.querySelector)&&(!(!i.isObject(document)||e!==document)||("object"==typeof HTMLElement?e instanceof HTMLElement:e&&"object"==typeof e&&null!==e&&1===e.nodeType&&"string"==typeof e.nodeName)))},isEmpty:function(e){var t;if(!i.isDefined(e))return!0;if(i.isFunction(e))return!1;if(i.isString(e))return i.EMPTY_STRING_REGEXP.test(e);if(i.isArray(e))return 0===e.length;if(i.isDate(e))return!1;if(i.isObject(e)){for(t in e)return!1;return!0}return!1},format:i.extend((function(e,t){return i.isString(e)?e.replace(i.format.FORMAT_REGEXP,(function(e,n,r){return"%"===n?"%{"+r+"}":String(t[r])})):e}),{FORMAT_REGEXP:/(%?)%\{([^\}]+)\}/g}),prettify:function(e){return i.isNumber(e)?100*e%1==0?""+e:parseFloat(Math.round(100*e)/100).toFixed(2):i.isArray(e)?e.map((function(e){return i.prettify(e)})).join(", "):i.isObject(e)?i.isDefined(e.toString)?e.toString():JSON.stringify(e):(e=""+e).replace(/([^\s])\.([^\s])/g,"$1 $2").replace(/\\+/g,"").replace(/[_-]/g," ").replace(/([a-z])([A-Z])/g,(function(e,t,n){return t+" "+n.toLowerCase()})).toLowerCase()},stringifyValue:function(e,t){return(t&&t.prettify||i.prettify)(e)},isString:function(e){return"string"==typeof e},isArray:function(e){return"[object Array]"==={}.toString.call(e)},isHash:function(e){return i.isObject(e)&&!i.isArray(e)&&!i.isFunction(e)},contains:function(e,t){return!!i.isDefined(e)&&(i.isArray(e)?-1!==e.indexOf(t):t in e)},unique:function(e){re
|
||
|
/*! (c) 2018 Andrea Giammarchi (ISC) */function x(e,t){return typeof e===t}function E(e){const t=e.ownerSVGElement;return!!t||null===t}function O(e){return!T(e.content)}function w(e){return x(e,"function")}function N(e){return!T(e)&&x(e,"object")}function T(e){return null==e}const j=Symbol("unmount"),A=Object.seal({nodes:[],mount(e,t){return this.update(e,t)},update(e,t){const{placeholder:n,nodes:r,childrenMap:o}=this,i=e===j?null:this.evaluate(e),s=i?Array.from(i):[],a=n.parentNode,{newChildrenMap:u,batches:c,futureNodes:g}=function(e,t,n,r){const{condition:o,template:i,childrenMap:s,itemName:a,getKey:u,indexName:c,root:f,isTemplateTag:l}=r,p=new Map,d=[],h=[];return e.forEach((e,r)=>{const m=function(e,t){let{itemName:n,indexName:r,index:o,item:i}=t;e[n]=i,r&&(e[r]=o);return e}(Object.create(t),{itemName:a,indexName:c,index:r,item:e}),g=u?u(m):r,b=s.get(g);if(function(e,t){return!!e&&!1===Boolean(e(t))}(o,m))return;const v=b?b.template:i.clone(),y=b?v.el:f.cloneNode(),x=!b,E=l&&x?function(e){const t=e.dom.cloneNode(!0);return{avoidDOMInjection:!0,fragment:t,children:Array.from(t.childNodes)}}(v):{};if(x?d.push(()=>v.mount(y,m,n,E)):d.push(()=>v.update(m,n)),l){const e=E.children||v.children;h.push(...e)}else h.push(y);s.delete(g),p.set(g,{template:v,context:m,index:r})}),{newChildrenMap:p,batches:d,futureNodes:h}}(s,e,t,this);return((e,t,n,r)=>{r||(r={});const o=r.compare||l,i=r.node||p,s=null==r.before?null:i(r.before,0),a=t.length;let u=a,c=0,g=n.length,v=0;for(;c<u&&v<g&&o(t[c],n[v]);)c++,v++;for(;c<u&&v<g&&o(t[u-1],n[g-1]);)u--,g--;const y=c===u,x=v===g;if(y&&x)return n;if(y&&v<g)return f(i,e,n,v,g,h(i,t,c,a,s)),n;if(x&&c<u)return m(i,t,c,u),n;const E=u-c,O=g-v;let w=-1;if(E<O){if(w=d(n,v,g,t,c,u,o),-1<w)return f(i,e,n,v,w,i(t[c],0)),f(i,e,n,w+E,g,h(i,t,u,a,s)),n}else if(O<E&&(w=d(t,c,u,n,v,g,o),-1<w))return m(i,t,c,w),m(i,t,w+O,u),n;E<2||O<2?(f(i,e,n,v,g,i(t[c],0)),m(i,t,c,u)):E===O&&((e,t,n,r,o,i)=>{for(;r<o&&i(n[r],e[t-1]);)r++,t--;return 0===t})(n,g,t,c,u,o)?f(i,e,n,v,g,h(i,t,u,a,s)):b(i,e,n,v,g,O,t,c,u,E,a,o,s)})(a,r,g,{before:n,node:S(Array.from(o.values()),t)}),c.forEach(e=>e()),this.childrenMap=u,this.nodes=g,this},unmount(e,t){return this.update(j,t),this}});function S(e,t){return(n,r)=>{if(r<0){const n=e.pop();if(n){const{template:e,context:r}=n;e.unmount(r,t,null)}}return n}}const M=Object.seal({mount(e,t){return this.update(e,t)},update(e,t){const n=!!this.evaluate(e),r=!this.value&&n,o=this.value&&!n,i=()=>{const n=this.node.cloneNode();this.placeholder.parentNode.insertBefore(n,this.placeholder),this.template=this.template.clone(),this.template.mount(n,e,t)};switch(!0){case r:i();break;case o:this.unmount(e);break;default:n&&this.template.update(e,t)}return this.value=n,this},unmount(e,t){return this.template.unmount(e,t,!0),this}});function _(e){throw new Error(e)}function D(e){return e.reduce((e,t)=>{const{value:n,type:o}=t;switch(!0){case!t.name&&0===o:return Object.assign({},e,n);case 3===o:e.value=t.value;break;default:e[r(t.name)]=t.value}return e},{})}const P="undefined"==typeof Element?{}:Element.prototype,R=function(e){const t=new Map,n=n=>(t.has(n)||t.set(n,e.call(this,n)))&&t.get(n);return n.cache=t,n}(e=>P.hasOwnProperty(e));function C(e,t,n,r){let{name:o}=t;if(!o)return r&&function(e,t,n){const r=t?Object.keys(t):[];Object.keys(n).filter(e=>!r.includes(e)).forEach(t=>e.removeAttribute(t))}(e,n,r),void(n&&function(e,t){Object.entries(t).forEach(t=>{let[n,r]=t;return C(e,{name:n},r)})}(e,n));!R(o)&&(function(e){return x(e,"boolean")}(n)||N(n)||w(n))&&(e[o]=n),e[function(e){return T(e)||!1===e||""===e||N(e)||w(e)?"removeAttribute":"setAttribute"}(n)](o,function(e,t){return!0===t?e:t}(o,n))}const U=/^on/,L={handleEvent(e){this[e.type](e)}},k=new WeakMap;function B(e){return T(e)?"":e}const I=(e,t)=>{const n=e.childNodes[t];if(n.nodeType===Node.COMMENT_NODE){const t=document.createTextNode("");return e.replaceChild(t,n),t}return n};var z={0:C,1:function(e,t,n){let{name:r}=t;const o=r.replace(U,""),i=k.get(e)||(e=>{const t=Object.create(L);return k.set(e,t),t})(e),[s,a]=(e=>Array.isArray(e)?e:
|
||
|
/* Riot v4.13.1, @license MIT */
|
||
|
var o;return e[(o=n,o.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase())]=Ce(r),e},{})}(r.components):{}):_e;return e=>{let{slots:s,attributes:a,props:u}=e;if(r&&r[J])return function(e,t){let{slots:n,attributes:r,props:o,css:i,template:s}=t;s&&_("Pure components can not have html"),i&&_("Pure components do not have css");const a=ge(e({slots:n,attributes:r,props:o}),Se);return Re(e=>function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];if(e===H){const[e]=n;Pe(e,a)}return a[e](...n),a})}(r,{slots:s,attributes:a,props:u,css:t,template:n});const c=de(r)||{},f=Ue({css:t,template:i,componentAPI:c,name:o})({slots:s,attributes:a,props:u});return{mount:(e,t,n)=>f.mount(e,n,t),update:(e,t)=>f.update(t,e),unmount:e=>f.unmount(e)}}}function Ue(e){let{css:t,template:n,componentAPI:r,name:o}=e;return t&&o&&Te.add(o,t),function e(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return function(){for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return(o=[...r,...o]).length<t.length?e(t,...o):t(...o)}}(ke)(me(ge(r,Object.assign({},Me,{state:{}})),Object.assign({slots:null,root:null},Ae,{name:o,css:t,template:n})))}function Le(e,t){return Object.assign({},e,de(t))}function ke(e,t){let{slots:n,attributes:r,props:o}=t;return i=function(e){return[...$].reduce((e,t)=>t(e)||e,e)}(me(Object.create(e),{mount(t,i,s){return void 0===i&&(i={}),this[W]=function(e,t){void 0===t&&(t=[]);const n=t.map(t=>V(e,t)),r={};return Object.assign(r,Object.assign({expressions:n},Re(e=>t=>(n.forEach(n=>n[e](t)),r))))}(t,r).mount(s),he(this,"props",Object.freeze(Object.assign({},De(t,o),D(this[W].expressions)))),this.state=Le(this.state,i),this[Q]=this.template.createDOM(t).clone(),Pe(t,this),e.name&&function(e,t){je(e)!==t&&xe(e,"is",t)}(t,e.name),he(this,"root",t),he(this,"slots",n),this.onBeforeMount(this.props,this.state),this[Z]=s,this[Q].mount(t,this,s),this.onMounted(this.props,this.state),this},update(e,t){void 0===e&&(e={}),t&&this[W].update(t);const n=D(this[W].expressions);if(!1!==this.shouldUpdate(n,this.props))return he(this,"props",Object.freeze(Object.assign({},this.props,n))),this.state=Le(this.state,e),this.onBeforeUpdate(this.props,this.state),this[Q].update(this,this[Z]),this.onUpdated(this.props,this.state),this},unmount(e){return this.onBeforeUnmount(this.props,this.state),this[W].unmount(),this[Q].unmount(this,this[Z],null===e?null:!e),this.onUnmounted(this.props,this.state),this}})),Object.keys(e).filter(t=>w(e[t])).forEach(e=>{i[e]=i[e].bind(i)}),i;var i}const{DOM_COMPONENT_INSTANCE_PROPERTY:Be,COMPONENTS_IMPLEMENTATION_MAP:Ie,PLUGINS_SET:ze}=ee;var Fe,qe,Ve=n(1),Ke=n.n(Ve),Ye=n(11),$e=n.n(Ye);n(30);!function(e,t){let{css:n,template:r,exports:o}=t;Ie.has(e)&&_(`The component "${e}" was already registered`),Ie.set(e,Ce({name:e,css:n,template:r,exports:o}))}("notes",{css:null,exports:{state:{notes:[]},getNotes(){Ke.a.get("/api/note").then(e=>{this.state.notes=e.data,this.update()}).catch((function(e){console.log(e)}))},onBeforeMount(){this.getNotes()},handleSubmit(e){e.preventDefault();const t=$e()(e.target,{hash:!0,empty:!0});Ke.a.post("/api/note",t).then(e=>{this.getNotes()}).catch((function(e){console.log(e)}))},handleDelete(e){Ke.a.delete("/api/note/"+e._id).then(e=>{this.getNotes()}).catch((function(e){console.log(e)}))}},template:function(e,t,n,r){return e('<div class="notes"><div expr0="expr0"></div><form expr3="expr3"><label class="field__label"><textarea class="field__text" name="text"></textarea></label><button class="button" type="submit">\n send\n </button></form></div>',[{type:n.EACH,getKey:null,condition:null,template:e('<p expr1="expr1" class="panel panel__inner bordered"> </p><button expr2="expr2" class="button" type="button">delete</button>',[{redundantAttribute:"expr1",selector:"[expr1]",expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return e.note.text}}]},{redundantAttribute:"expr2",selector:"[expr2]",expressions:[{type:t.EVENT,name:"onclick",evaluate:function(e){return()=>{e.handleDelete(e.note
|