From 01f385122a0274a07fcd501617dcd227745ce6bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Dematt=C3=A9?= Date: Wed, 6 Sep 2023 00:00:49 +0200 Subject: [PATCH] update versions --- blick.js | 4 ++-- circular.js | 4 ++-- circular.min.js | 2 +- package.json | 2 +- schnauzer.js | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/blick.js b/blick.js index 5eed1dd..732407e 100644 --- a/blick.js +++ b/blick.js @@ -1,4 +1,4 @@ -/**! @license blick v1.0.4; Copyright (C) 2018-2023 by Peter Dematté */ +/**! @license blick v1.0.5; Copyright (C) 2018-2023 by Peter Dematté */ (function(global, factory) { if (typeof exports === 'object' && typeof module === 'object') module.exports = factory(global, require('schnauzer')); @@ -68,7 +68,7 @@ return (function(Schnauzer, cloneObject) { /* class Blick extends Schnauzer */ selected: setAttribute, } }); - this.version = { blick: '1.0.4', schnauzer: this.version }; + this.version = { blick: '1.0.5', schnauzer: this.version }; this.collector = { destroyers: {}, updaters: {}, movers: {}, helpers: {}, element: {} }; this.returnFragment = doc.createDocumentFragment(); this.dataDump = []; diff --git a/circular.js b/circular.js index d717b25..f44378f 100644 --- a/circular.js +++ b/circular.js @@ -1,4 +1,4 @@ -/**! @license CircularJS ● v2.0.3; Copyright (C) 2017-2023 by Peter Dematté */ +/**! @license CircularJS ● v2.0.4; Copyright (C) 2017-2023 by Peter Dematté */ define(['toolbox', 'blick', 'VArray', 'api', 'controller'], function(Toolbox, Blick, VArray, mixinAPI, Controller) { 'use strict'; @@ -15,7 +15,7 @@ var extend = Toolbox.cloneObject; var Circular = function Circular(name, options) { this.controls = { initPartials: false }; - this.version = '2.0.3'; + this.version = '2.0.4'; this.id = 0; this.name = ''; this.options = { diff --git a/circular.min.js b/circular.min.js index cc89f8c..bc08e9e 100644 --- a/circular.min.js +++ b/circular.min.js @@ -1,2 +1,2 @@ -!function(e){"use strict";var t=e.Math.random,n=document.createElement("a"),r=e.document.createDocumentFragment(),o=f.modules={},i={};function a(){return"_module_"+(t()+t())}function l(e){var t,r=/(?:^\!|^http[s]*:|.*\.js$)/.test(e)?"":".js";return e=(f.development[e]||f.options.devMocks&&f.mocks[e]||""||f.paths[e]||e).replace(/^[!%]/,""),t=function(e){return n.href=e,(-1!==e.indexOf(n.host)?n.origin:"")+n.pathname+n.search}((f.baseUrl||".")+"/"+e+r).replace(/^.\//,""),f.mapPath?f.mapPath(e,r,t):t}function s(e){var t={mapPath:"function",baseUrl:"string"},n=["lookaheadMap","paths","options","mapPath","baseUrl","lazyPackages","development","mocks"];if(!f[n[0]])for(var r=n.length;r--;)f[n[r]]="string"===t[n[r]]?"":"function"===t[n[r]]?null:{};for(var o in e)if(-1!==n.indexOf(o))if(t[o])f[o]=e[o];else for(var i in e[o])f[o][i]=e[o][i];return f}function c(e){var t=f.lookaheadMap[e],n=f.options.minifyPrefix;if(t&&-1===(f.development[e]||f.options.devMocks&&f.mocks[e]||""||f.paths[e]||"").indexOf(n)){f(t);for(var r=0,i=t.length;rl?i:l+t.cache:0)&&!t.resetCache&&i>l?r[e]:null)||new n.Promise(function(n,r){var o,i,a=new XMLHttpRequest,l=(t.method||t.type||"GET").toUpperCase();if(a||r("Giving up :( Cannot create an XMLHTTP instance"),t||(e=(t=e).url),a.onreadystatechange=function(){var e=function(e,t,n){try{if(e.readyState===XMLHttpRequest.DONE){if(!(e.status<200||e.status>299))return e["xml"===t?"responseXML":"raw"===t?"response":"responseText"];var r=new Error(e.statusText);r.response=e.response,n(r)}}catch(e){n("Caught Exception: "+e.stack)}}(this,t.dataType,r);if(void 0!==e){if("json"===t.dataType)try{e=JSON.parse(e)}catch(e){return void r("Caught Exception: "+e.stack)}n(e)}},a.open(l,e,t.async||!0,t.username,t.password),"raw"===t.dataType&&(a.responseType="blob"),"xml"===t.dataType&&a.setRequestHeader("Content-Type","text/xml"),"json"===t.dataType&&a.setRequestHeader("Content-Type","application/json"),"GET"!==l&&t.csrf&&a.setRequestHeader("X-XSRF-TOKEN",(o=t.csrf,(i=document.cookie.split(o+"=")[1])&&i.split(";")[0])),t.headers)for(var s in t.headers)a.setRequestHeader(s,t.headers[s]);return a.send(t.data),function(){a.abort()}}),o?(r[e]=a,r[e].time=o):delete r[e],a},errorHandler:function(e){console.error(e)},Promise:o},r={};function o(e,t){this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],this._returnFn=c(e,this),this._staticData=t}function i(e,t){for(;3===e._state;)e=e._value;0!==e._state?(e._handled=!0,setTimeout(function(){var n,r=1===e._state?t.onFulfilled:t.onRejected;if(null!==r){try{n=r(e._value)}catch(e){return void l(t.promise,e)}a(t.promise,n)}else(1===e._state?a:l)(t.promise,e._value)})):e._deferreds.push(t)}function a(e,t){try{if(t){var n=t.then;if(t instanceof o)return e._state=3,e._value=t,void s(e);if("function"==typeof n)return c(n.bind(t),e)}e._cancelFn=null,e._state=1,e._value=t,s(e)}catch(t){l(e,t)}}function l(e,t){e._state=2,e._value=t,s(e)}function s(e){2===e._state&&0===e._deferreds.length&&setTimeout(function(){e._handled||console.warn("Possible Unhandled Promise Rejection:",e._value)});for(var t=0,n=e._deferreds.length;t":">",'"':""","'":"'","/":"/","`":"`","=":"="},helpers:{},partials:{},self:"self",escapeHTML:!0,limitPartialScope:!0,loopHelper:null,renderHook:null},a(this,t||{},e)},a=function(e,t,r){"string"!=typeof r&&(t=r,r=""),s(e,(t=n(e.options,t)).tags),e.helpers=t.helpers,e.registerPartial(t.partials),void 0!==r&&e.parse(r),delete t.helpers,delete t.partials},l=i.SafeString=function(e){this.string=e};return l.prototype.toString=l.prototype.toHTML=function(){return""+this.string},i.getObjectKeys=e,i.cloneObject=n,i.concatArrays=r,i.isEmpty=function(t){return!t||(t.constructor===Array?!t.length:"object"==typeof t?!e(t).length:!t)},i.prototype={render:function(e,t){var n=u(this,"","",0,e,null,[{scope:e}]);return[this.partials[this.options.self]({blocks:{},extra:t,scopes:[{scope:e,helpers:n,level:[],values:null,alias:{}}]}),this.controls.active=!0][0]},parse:function(e){return this.registerPartial(this.options.self,e)},registerHelper:function(e,t){if("string"==typeof e)return this.helpers[e]=t;for(var n in e)this.helpers[n]=e[n]},unregisterHelper:function(e){delete this.helpers[e]},registerPartial:function(e,t){if("string"==typeof e)return this.partials[e]=this.partials[e]||(t.constructor===Function?t:function(e,t,n){var r=t.split(e.regexps.tags);n.push({text:r[0]});for(var o=1,i="",a="",l="",s=0,c="",u=[],p=[],d=/^[!-]+/,f=/^else\s*/,h={"#":"B","^":"B","/":"C",E:"E"},v={},g="",m="",y={},b=r.length;o"===i&&(u.unshift("@"+c),p.unshift("@"+a)),"E"===g&&(a=a.replace(f,"")),y="/"===i?{tag:"C",text:l,vars:a}:O(e,a,i,r[o],m,l),"^"===i&&"B"===m&&(y.alt=y.vars[0].orig),"#*"===i&&(y.isPartial=!0),n=w(e,n,y,r[o]),"C"===m&&(n[n.length-1].isPartial||u[0])&&(y=n.splice(-1,1,u[0]?O(e,p[0],">",r[o],"I",y.text):{text:y.text})[0],(v=y.children[0]).children.unshift({text:v.text}),e.registerPartial(u[0]||y.vars[0].value,v.bodyFn),u.shift(),p.shift()));if(n.parent)throw"Schnauzer Error: Missing closing tag(s)";return r=t=null,S(e,{children:n})}(this,t,[]));for(var n in e)this.registerPartial(n,e[n])},unregisterPartial:function(e){delete this.partials[e]},setTags:function(e){s(this,e)},escapeExpression:function(e){return c(this,e,!0)}},i;function s(t,n){var r=function(e){for(var t=e.length;t--;)e[t]="("+e[t]+")";return e}("{{"===n[0]?["{{2,3}","[~}]{2,4}"]:n);t.regexps={tags:new RegExp(r[0]+"([#~^/!>*-]*)\\s*([^~}]*)"+r[1]),entity:new RegExp("["+e(t.options.entityMap).join("")+"]","g")}}function c(e,t,n){return null==t?"":t.constructor===i.SafeString?t.string:n&&e.options.escapeHTML?String(t).replace(e.regexps.entity,function(t){return e.options.entityMap[t]}):t}function u(e,t,n,r,o,i,a){return r?{"@index":t,"@number":t+1,"@key":n,"@odd":t%2!=0,"@last":t===r-1,"@first":0===t,"@length":r,"@depth":e.options.limitPartialScope?void 0:a.length-2,"@loop":i,"@parent":a[1].scope,"@root":a[a.length-1].scope,this:o,".":o}:{"@parent":i,"@root":a[a.length-1].scope,this:o,".":o}}function p(e,t,o){var i=e.scopes,a=e.alias?[e.alias]:[],l=r(i[0].level,a),s=e.values,c=i[1]?n({},i[1].alias):{};return e.alias=null,e.values=null,o=o?n(c,o):c,e.scopes=r(i,[{scope:t,helpers:i[0].helpers,level:l,values:s,alias:o}]),function(){e.scopes=i}}function d(e,t){var n=e.scope;return e.scope=t||{},function(){e.scope=n}}function f(e,t,n){if("."===t.value||"this"===t.value)return{value:e,variable:t};if("key"!==t.type)return{value:t.value,variable:t};for(var r="@root"===t.path[0]?1:0,o=t.path.length;r3):r.push(h)}return r}function O(e,t,n,r,o,i){var a=t?function(e,t){var n=/\([^()]*\)/g,r=function(e){var n={vars:E(e.substring(1,e.length-1),t,[],"fn")};return n.vars.length>1&&(n.helper=n.vars.shift()),"--"+(t.push(n)-1)+"--"};for(e=e.replace(/(['"|])(?:[^\\'"]|\\+['"]|['"])*?\1/g,function(n,r){var o={type:"|"!==r?"string":"alias",value:""};return-1!==e.indexOf("["+r)||-1!==e.indexOf(r+"=")?n:(o.value=n===e?[{value:n.substring(1,n.length-1),path:[],depth:0,single:!0,type:"key"}]:E(n.substring(1,n.length-1),t,[],o.type),"--"+(t.push(o)-1)+"--")});e!==(e=e.replace(n,r)););return E(e,t,[],"")}(t,[]):[],l="^"===n?"unless":/^(?:if|each|with|unless)$/.test((a[0]||{}).value)?a.shift().value:"";return{partial:">"===n?a.shift():void 0,helper:l||(">"!==n&&a.length>1?a.shift():""),helperFn:l?b:void 0,isEscaped:r.lastIndexOf(e.options.tags[0])<1,bodyFn:null,vars:a,isInline:"B"!==o,tag:o,text:i,children:null}}function S(e,t){return t.bodyFn="B"===t.tag?void 0:function(n){return function(e,t,n){for(var r=0,o=t.length,i="";r/,{option:"select",legend:"fieldset",area:"map",param:"object",thead:"table",tr:"tbody",col:"colgroup",td:"tr",default:"div"}),i=r.createDocumentFragment();return function(e,t){var i=function(o,i){e.call(this,o,i),this.options=t(this.options,{registerLoopItem:function(e,t,n,r){},isDynamic:function(e,t,n,r,o){return!1},scanHTML:function(e,t,n,r,o,i){},loopHelperName:"loop-helper",loopFnName:"__loopFn",loopLimitsName:"__loopLimits",limiters:["{{#","{{END:","}}"],forceUpdate:!1,missingProperty:n,debugMode:"",debugLevel:2,attributes:{value:s,disabled:l,hidden:l,checked:l,autocomplete:l,contenteditable:l,readonly:l,required:l,selected:l}}),this.version={blick:"1.0.4",schnauzer:this.version},this.collector={destroyers:{},updaters:{},movers:{},helpers:{},element:{}},this.returnFragment=r.createDocumentFragment(),this.dataDump=[],this._firstTimeLoop=null,this._tempNode=null,a(this,i||{},o)},a=function(e,n,r){var o;"string"!=typeof r&&(n=r),t(n.attributes||{},e.options.attributes),t(e.options,n),delete e.options.helpers,delete e.options.partials,e.options.renderHook=h,e.options.loopHelper=C,o=e.options.limiters,e.xpath={xpath:['//text()[contains(., "'+o[0]+'") or contains(., "'+o[1]+'")]','//@*[contains(., "'+o[0]+'")]'].join(" | "),regex:new RegExp("("+o[0]+"|"+o[1]+")(\\d+)"+o[2],"g"),startTag:o[0],type:XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE}};return function(e,t){function n(){this.constructor=e}for(var r in t)t[r]&&(e[r]=t[r]);n.prototype=t.prototype,e.prototype=new n}(i,e),i.setScroll=T,t(i.prototype,{renderHTML:function(e,t){return function(e,t,n,i){var a=e.returnFragment.childNodes.length?r.createDocumentFragment():e.returnFragment;for(e.controls.active=!1,i=p(e,e.dataDump,o(e.render(t,n),!0)).childNodes;i.length;)a.appendChild(i[0]);return a}(this,e,t,[])},destroyInstance:function(e){!function(e,t){for(var n in t){for(var r in e.destroyers[n])k(e,n+":"+r);delete e.destroyers[n]}}(this.collector,e)},removeChild:function(e,t,n){return E(this,e,t,n)},moveChild:function(e,t,n,r,o,i){return function(e,t,n,r,o,i,a){var l=e.options,s=o[l.loopLimitsName],c=n!==o,u=s[r+(c||n===o&&r4)return;if(!s||!c)return;e.controls.active=!1,d=e._firstTimeLoop||p(e,e.dataDump,o(s(r,t))),e.controls.active=!0,i.scanHTML(e,d,n[t],n);for(var f=d.childNodes,h=f.length;h--;)f[h].nodeType!==a||f[h].textContent!==i.loopHelperName?(1===f[h].nodeType&&(e.collector.element[n[t]["cr-id"].split(":")[1]]=f[h]),c=c.parentNode.insertBefore(f[h],c)):(f[h].parentNode.removeChild(f[h]),l.splice(t+1,0,u=f[--h]),c=c.nextSibling?c.parentNode.insertBefore(u,c.nextSibling):c.parentNode.appendChild(u));e._firstTimeLoop&&(l.splice(1,1),e._firstTimeLoop=null);e.controls.helpers&&P(e,t,n)}(this,e,t,n)},findElement:function(e){return this.collector.element[e["cr-id"].split(":")[1]]}}).constructor}(t,t.cloneObject);function a(t,n){!t.options.debugMode||t.options.debugLevel>n||e.console&&e.console[t.options.debugMode]&&e.console[t.options.debugMode].apply(null,[].slice.call(arguments).slice(2))}function l(e,t,n){var r=-1!==n.indexOf("focus"),o=r&&-1!==n.indexOf(":end");return!0===n||"true"===n||n&&!1!==n&&"false"!==n&&!r?(e.setAttribute(t,"selected"===t?t:""),function(){e[t]=!0}):(e.removeAttribute(t),r&&e.focus(),o&&(e.selectionStart=e.selectionEnd=e.value.length),function(){e[t]=!1})}function s(e,t,n){return e.setAttribute(t,n),e.value=n,function(){}}function c(e,t){var n=r.createTextNode("");return t?e.insertBefore(n,e.childNodes[0]):e.appendChild(n)}function u(e,t,n,r,o,i,a){var l=!!n;l?t=[n[0].parentNode]:(o=c(a=(t=Array.prototype.slice.call(t))[0].parentNode,!0),e[e.length-1].node=c(a));for(var s=e.length-(l?0:1),u=(t[0],s);u--;)if("each"===r[e[u].id].tagData.helper){if(!l&&e[u].id===e[s].id){e[u].node=o;break}!l&&!e[u].isStart||l&&e[u].isStart?(a=t.pop().childNodes[0].parentNode,i=!l&&c(a,!l),e[u].node=c(a,l)):e[u].node=i||c(t[0],!l)}}function p(e,t,i,l,s){var c,p,d=t.length&&function(e,t,i,a,l){for(var s,c,p,d=r.evaluate(e.xpath,t,null,e.type,null),f=[],h=0,v=0;s=d.snapshotItem(h++);){f=[],v=0,s.textContent=s.textContent.replace(e.regex,function(t,n,r,o){return p={id:+r,isStart:n===e.startTag,index:o-v},f.push(p),v+=t.length,""}),s.nodeType===Node.ATTRIBUTE_NODE?(c=s,s=o(s.textContent,!0,!0).firstChild):c=n,(s.nextSibling&&(s.nextSibling.rows||s.parentNode.rows)&&"each"===a[p.id].tagData.helper||s.parentNode.rows)&&u(f,s.nextSibling.rows,(s.parentNode.rows||[{}])[0].cells,a);for(var g=f.length;g--;)i[(p=f[g]).id]||(i[p.id]={start:p.node||s,end:s,attr:c}),p.node?i[p.id][p.isStart?"start":"end"]=p.node:p.isStart?i[p.id].start=s.splitText(p.index).splitText(0).previousSibling:i[p.id].end=s.splitText(p.index)}return i}(e.xpath,i,[],t,e.options.loopHelperName);for(s&&d&&(e._tempNode=d[t[0].id].start);c=t.shift();)(p=d[c.id]?d[c.id].attr?O:"B"!==c.tagData.tag?S:w:null)?p(e,d[c.id],c,t,l):a(e,3,"Missing NodeElement in template:",{template:i.innerHTML});return i}function d(e,t,r){for(var o=0,i={},a=e.length;o',i.value,l.length,r):a(e,2,2===r?'Added model activity: "'+s+'" ->':'Missing model activity: "'+s+'" ->',i.value):t||e.options.missingProperty===n?t||e.options.missingProperty!==n||a(e,3,'Property "'+s+'", defined in template'+(o.helper?' by block "'+(o.helper.value||o.helper)+'"':"")+", is missing in model."):a(e,2,"Installing",i,"not supported yet if not in model")}(e,u,s,l,o,i,p),u&&r.push(o)}}function h(e,t,n,r,o,i,a,l){for(var s=e.options.limiters,c=e.dataDump.length+s[2],u="B"!==i.tag&&(i.helper&&!i.helperFn||!!i.partial),p=[],h=0,v=r.length;h",n),c&&!c[l]&&s&&Object.defineProperty(c,l,{value:o}),!c||c["cr-id"]||s||(c["cr-id"]=n.parent["cr-id"]),(r||i?"":u)+t+u):c&&c.length?"":u;!c[l]&&s&&Object.defineProperty(c,l,{value:t})}function A(e){for(var t=0;e&&e.parent;)t++,e=e.parent;return t}function P(e,t,r,o,i,a,l,s){var c,u,p=["@index","@key","@number","@odd","@first","@last","@length","@depth"],d=e.collector.helpers,f=d[(r[0]||o)["cr-id"]],h=0,v=0,g="",m=o||r[t],y=e.collector.updaters[m["cr-id"]],b=l&&l[a],x=!(!i&&f)||y["@length"],_=f&&function(e,t,r){!function(e,t,r,o){var i=e.length,a=o.length,l="",s=t;if(t)for(;a--;)t[l=o[a]]!==n&&(s=t[l],0===a?s[l]=r:1===a?s[l]=Array.isArray(e)?r:Object.keys(e)[r]:2===a?s[l]=r+1:3===a?s[l]=r%2!=0:4===a?s[l]=0===r:5===a?s[l]=r===i-1:6===a?s[l]=i:7===a&&(s[l]=A(e)))}(r,d[r[e]["cr-id"]],e-t,p)};if(f)if(i)for(h=x?0:t,v=r.length;h/g,i=t.attr.ownerElement,a=t.attr.nodeName,l=e.options.attributes[a],s=function(e){var n=e.parentNode;if(11!==n.nodeType)return l?l(i,a,n.textContent)():void(t.attr.textContent=n.textContent.replace(o,""))};return s("B"!==n.tagData.tag?S(e,t,n,r,s):w(e,t,n,r,s))}function S(e,t,n,i,a){var l=t.start;return _(e,function(e,t,n,i,a){var l=n||i?null:r.createDocumentFragment(),s=e.nextSibling;return function(r,c){var u=[],p=a?a(r,c):r[0].value,d=e,f=null;if(i||n&&!a)return s.textContent=p,i&&i(s),p;for(u=o(p+"").childNodes;d.nextSibling!==t;)u.length?(d.parentNode.replaceChild(f=u[0],d.nextSibling),d=f):d.parentNode.removeChild(d.nextSibling);if(u.length){for(;u.length;)l.appendChild(u[0]);t.parentNode.insertBefore(l,t)}}}(l,t.end,n.tagData.isEscaped,a,n.helperFn),e.collector,n.data,n.actives),l}function w(e,t,i,a,l){var s="each"===i.tagData.helper||!i.tagData.helper&&!i.data[1]&&"array"===i.data[0].type,c=t.start,u=s?[]:n,d=s?t.start.nextSibling:t.start;if(s)for(;c&&c!==t.end.nextSibling;)u.push(c),c=c.nextSibling;else i.data[0].scrollers&&T(!0,i.data[0],i.track.fnIdx,d.parentNode);return _(e,function(e,t,i,a,l,s,c,u,d){var f=[],h=l.fnIdx,v=[],g=e.options;return v[h]=r.createDocumentFragment(),f[h]=s.length>0,l.checkFn=function(t){f[t]||(e.controls.active=!1)},function(s,m,y,b){b&&T(!0,s[0],h);var x=s[0].value&&s[0].value.length,_=a(s,m,y),N=t,k=t,C=!f[l.fnIdx],A=h>l.fnIdx&&d&&f[l.fnIdx]===n,P=s[0].loop&&s[0].loop.this,E=h!==l.fnIdx;if(h!==l.fnIdx||!_)for(;(k=t.nextSibling)&&k!==i;)v[h].appendChild(k);if(h=l.fnIdx,C){for(v[h]=v[h]||r.createDocumentFragment(),N=p(e,c,o(_),u,y===g.loopHelperName),b&&T(!0,s[0],h,N);k=N.childNodes[0];)v[h].appendChild(k);f[h]=!!_}if(A&&s[0].value[g.loopLimitsName]&&x)return e._firstTimeLoop=v[h],s[0].value[g.loopLimitsName].push(t),"";C&&_&&!u&&g.scanHTML(e,v[h],P,s[0].renderArgs?s[0]:s[0].parent["__cr-id"]&&s[0].parent||s[0].value,"skip"),_&&i.parentNode.insertBefore(v[h],i),b&&_&&T(!1,s[0],h),u&&(E||(t.nextSibling.textContent=_),u(t)),c.length&&c.splice(0,c.length)}}(e,d,t.end,i.bodyFn,i.track,i.out,a,l,s),e.collector,i.data,i.actives,u),d}function T(e,t,n,r){r&&(t.scrollers[n]=r.querySelectorAll("[cr-scroll]"));for(var o=t.scrollers[n].length,i=t;o--;)i=t.scrollers[n][o],r&&i.removeAttribute("cr-scroll"),e?i.__scroll={y:i.scrollTop,x:i.scrollLeft}:(i.scrollTop=i.__scroll.y,i.scrollLeft=i.__scroll.x);return t}}),function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],function(){return t()},"VArray"):"object"==typeof exports?exports.VArray=t():e.VArray=t()}(this&&this.window||global,function(){"use strict";var e=void 0,t=Array.prototype,n=0,r={},o=function(e,t){for(var n=e.length;n--;)t.unshift(e[n]);return t},i=function(){return t=i,n=arguments,(e=[]).push.apply(e,n),Object.setPrototypeOf(e,t.prototype);var e,t,n};return i.prototype=Object.create(Array.prototype),i.prototype.constructor=Array,i.adopt=function(e,t){return v(e,t)},(e=i.prototype).shift=function(){return s(e=this,e[0]);var e},e.pop=function(){return s(e=this,e[e.length-1]);var e},e.unshift=function(){return function(e,t){for(var n=t.length;n--;)l(e,t[n],0,0===n);return e.length}(this,o(arguments,[]))},e.push=function(){return function(e,t){for(var n=0,r=t.length;ne.length&&(r=e.length);for(i+=2;i=t.length);return c}(this,o(arguments,[]))},e.sort=function(e){return a(this,e)},e.reverse=function(){return function(e){for(var n=e._onChange._options.idProperty,r={},o=e.length;o--;)r[e[o][n]]=o;return a(e,t.reverse.call(e),r)}(this)},e.fill=function(e,t,n){return function(e,t,n,r){if(n=+n||0,r=void 0===r?e.length:Math.min(+r,e.length),NaN===n||n>=r)return e;for(var o=r-n;o--;)l(e.getCleanModel(t),n,!!o);return e}(this,e,t,n)},e.copyWithin=function(e,t,n){return function(e,t,n,r){if(n=+n||0,r=void 0===r?e.length:Math.min(+r||0,e.length),NaN===n||n>=r)return e;for(var o=n;o1)||1!==a&&void 0)}(this,n,t,r,o)},removeEvent:function(e){n(this,e)},destroy:function(){var t=this;return e.keys(this.listeners).forEach(function(e){n(t,e)}),this.element=this.root=this.store=null},removeItem:function(e){delete this.store[e]}},t;function n(e,t){var n=e.listeners[t];n&&(e.listeners[t]=n(),delete e.listeners[t])}},"controller"),define(["toolbox","blick","VArray","api","controller"],function(e,t,n,r,o){"use strict";var i=0,a={},l={},s=e.$,c=e.$$,u=e.$create,p=e.isArray,d=e.keys,f=e.cloneObject,h=function(e,t){this.controls={initPartials:!1},this.version="2.0.3",this.id=0,this.name="",this.options={hash:"#",partials:{},helpers:{},attributes:{},debug:0},v(this,e,t||{})},v=function(e,t,n){var r="string"==typeof t;for(var o in r||(n=t||{}),n)e.options[o]=n[o];e.id="cr_"+i++,e.name=r?t:e.id,l[e.id]={}};return Object.defineProperties(h.prototype,r({createComponent:{value:function(e,t,n,r,o){var i=g(n["__cr-id"]),a=document.createElement(e);for(var l in t)a.setAttribute(l,t[l]);return o&&(a.innerHTML=o),(r||i.element).appendChild(a),x(i,r||i.element,e,!0),a}},hideComponent:{value:function(e){var n=e&&e._tracker||document.createTextNode(""),r=e&&g(e["cr-id"]);if(e&&(e.__scrollers=e.__scrollers?t.setScroll(!0,e.__scrollers,0):t.setScroll(!0,{scrollers:[]},0,e)),e&&e.parentNode)return e._tracker||(e._tracker=e.parentNode.insertBefore(n,e)),e.parentNode.removeChild(e),function(o){return o&&e._tracker&&o!==e._tracker.parentNode?(e._tracker.parentNode.removeChild(e._tracker),delete e._tracker):o=void 0,o?o.appendChild(e):n.parentNode.insertBefore(e,e._tracker),t.setScroll(!1,e.__scrollers,0),y(e,r),e}}},getChildComponents:{value:function(e){for(var t=e["__cr-id"].split(":"),n=l[t[0]][t[1]].children,r=[],o=n.length;o--;)t=n[o].split(":"),r.push(m(this,t[1],t[0]));return r}},getParentComponent:{value:function(e){return m(this,l[this.id][e["__cr-id"].split(":")[1]].parent.split(":")[1])}},destroyComponent:{value:function(e,t){e&&(b(e["cr-id"],g(g(e["cr-id"]).parent)),t&&e.parentNode.removeChild(e))}},getModelElement:{value:function(e,t){return l[this.id][e["__cr-id"].split(":")[1]].template.blick.findElement(t)}}},h)),Object.defineProperties(h,{Service:{value:function(e,t){}},App:{value:function(e,t){return e.selector||(e.selector="app"),e.initialize=!0,h.Component(e,t)}},Component:{value:function(t,r){var c,v,m,b,P=!!a[t.selector],w=t.circular||h.CreateInstance(),T=!P&&function(e,t){var n=d(e);e.this||(e.this=[]);for(var r=n.length,o="",i=[];r--;)if(o=n[r],!((i=o.split(":")).length<2))for(var a=i.length;a--;)a>0?t[i[a-1]]=i[a].replace(/\]/g,""):(e[i[a]]=e[o],delete e[o]);return t}(t.subscribe$||(t.subscribe$={}),{}),F=P?a[t.selector]:a[t.selector]={Klass:r,selector:t.selector,subscribe$:t.subscribe$,childNames:T,template:t.template&&t.template.blick?t.template:O(t.template||"",function(e,t){return{helpers:f(f({},e.helpers),t.helpers||{}),partials:f(f({},e.partials),t.partials||{}),attributes:f(f({},e.attributes),t.attributes||{}),forceUpdate:!0,limitPartialScope:!1,debugMode:e.debug?"warn":"",debugLevel:e.debug,registerLoopItem:k,isDynamic:A,scanHTML:C}}(w.options,t)),styles:(c=t.styles,v=t.selector,m=c?p(c)?c.join("\n"):c:"",b=m&&u("style"),b?(b.setAttribute("name",v),b.innerHTML="\n"+m+"\n",document.head.appendChild(b)):null),singleton:!1,initialize:!1,crInst:w,init:function(r,a,c,u){return t.initialize&&(F.initialised=!0),function(t,r,a,s,c,u){var f=r.crInst,h=i++,v=t["cr-id"],m=v&&!s,b=r.template,k=m?null:l[f.id][h]={instance:{},controller:{},models:[],parent:"",template:b,element:t,crInst:f,children:[],views:{},listeners:{},destroyers:[]},C=e.trim(t.innerHTML),A=f.id+":"+h,P=r.template.blick.options,w=r.template.blick.partials;if(m||r.singleton&&!s)return g(v);r.singleton=!!a.singleton||a.initialised,s||(t["cr-id"]=A,k.crInst.options.debug&&t.setAttribute("cr-id",A));C&&(t.innerHTML=function(e,t,n){var r=t.replace(/cr-src/g,"src"),o=O(r,n,!0),i=e.childComponents;e.enableEvents=e.enableEvents||o.enableEvents;for(var a=o.childComponents.length;a--;)-1===i.indexOf(o.childComponents[a])&&i.push(o.childComponents[a]);return e.blick.registerPartial("@content",r),""}(b,C,P),a.extra||(a.extra=Object.create(null)),a.extra["@content"]=w["@content"],w["@content"]=null);k.name=a.selector,k.controller=new o(t),c&&(k.parent=c["__cr-id"],g(k.parent).children.push(A));k.instance=function(e,t,n,r){return new e.Klass(t.element,function(e,n){return function(e,t,n,r){var o=n.parent&&n.parent.split(":"),i=n.parent&&(l[o[0]][o[1]]||{})||{};!1!==t&&(t=!0),S(n.element,"cr-input",function(o,a,l){!function(e,t,n,r,o,i){var a=e.split(/\s*=\s*/),l=a[1]&&(0===a[1].indexOf('"')||0===a[1].indexOf("'")),s=a[1]&&"!"===a[1].charAt(0),c=(e=s?a[1].substring(1):a[1])||a[0];e=l?e.substring(1,e.length-1):"true"===e||"false"!==e&&(+e==e?+e:void 0),hasOwnProperty.call(t,a[0])&&(void 0!==e?t[a[0]]=e:hasOwnProperty.call(r.instance,c)&&(t[a[0]]=r.instance[c],!n||l||s||function(e,t,n,r,o,i){e[o]||(e[o]={}),e[o][r]={scope:t,key:i},n.push(function(){delete e[o][r]})}(r.listeners,t,o.destroyers,i,c,a[0])))}(a,e,t,i,n,r)}),n.crInst.options.debug||n.element.removeAttribute("cr-input")}(e,n,t,r)},t.crInst)}(r,k,0,A),Object.defineProperty(k.instance,"__cr-id",{value:A}),k.models=d(r.subscribe$).sort(function(e){return"this"===e?-1:1}).reduce(function(e,t){var o=function(e,t,r){var r=r.instance,o=e.split(/[./]/),i=function(e,t){for(var n=0,r=e.length;n]+)[^>]*cr-lazy)[^/]*?>";d(r.partials||{});return n.replace(new RegExp(s,"g"),function(e,t,n,r){var o=t||n||r;o&&(i[o]=!0)}),{blick:o?null:new t(e.trim(n),r),childComponents:d(i),enableEvents:!0}}function S(e,t,n,r){for(var o=e.hasAttribute&&e.hasAttribute(t)?[e]:[],i=e.childNodes.length?c("["+t+"]",e):[],a=i.length?(o.push.apply(o,i),o):o,l={},s=a.length,u="",p=[];s--;){p=(u=a[s].getAttribute(t))?u.split(/\s*;+\s*/):[],l[u]=a[s];for(var d=p.length,f=[],h="",v="";d--;)h=(f=p[d].split(/\s*:+\s*/))[0],v=f[1]||f[0],n&&n(h,v,a[s]),r&&(v?(r[h]=r[h]||{},r[h][v]=r[h][v]||[],r[h][v].push(a[s])):(r[h]=r[h]||[],r[h].push(a[s])))}return r||l}},"circular"); +!function(e){"use strict";var t=e.Math.random,n=document.createElement("a"),r=e.document.createDocumentFragment(),o=f.modules={},i={};function a(){return"_module_"+(t()+t())}function l(e){var t,r=/(?:^\!|^http[s]*:|.*\.js$)/.test(e)?"":".js";return e=(f.development[e]||f.options.devMocks&&f.mocks[e]||""||f.paths[e]||e).replace(/^[!%]/,""),t=function(e){return n.href=e,(-1!==e.indexOf(n.host)?n.origin:"")+n.pathname+n.search}((f.baseUrl||".")+"/"+e+r).replace(/^.\//,""),f.mapPath?f.mapPath(e,r,t):t}function s(e){var t={mapPath:"function",baseUrl:"string"},n=["lookaheadMap","paths","options","mapPath","baseUrl","lazyPackages","development","mocks"];if(!f[n[0]])for(var r=n.length;r--;)f[n[r]]="string"===t[n[r]]?"":"function"===t[n[r]]?null:{};for(var o in e)if(-1!==n.indexOf(o))if(t[o])f[o]=e[o];else for(var i in e[o])f[o][i]=e[o][i];return f}function c(e){var t=f.lookaheadMap[e],n=f.options.minifyPrefix;if(t&&-1===(f.development[e]||f.options.devMocks&&f.mocks[e]||""||f.paths[e]||"").indexOf(n)){f(t);for(var r=0,i=t.length;rl?i:l+t.cache:0)&&!t.resetCache&&i>l?r[e]:null)||new n.Promise(function(n,r){var o,i,a=new XMLHttpRequest,l=(t.method||t.type||"GET").toUpperCase();if(a||r("Giving up :( Cannot create an XMLHTTP instance"),t||(e=(t=e).url),a.onreadystatechange=function(){var e=function(e,t,n){try{if(e.readyState===XMLHttpRequest.DONE){if(!(e.status<200||e.status>299))return e["xml"===t?"responseXML":"raw"===t?"response":"responseText"];var r=new Error(e.statusText);r.response=e.response,n(r)}}catch(e){n("Caught Exception: "+e.stack)}}(this,t.dataType,r);if(void 0!==e){if("json"===t.dataType)try{e=JSON.parse(e)}catch(e){return void r("Caught Exception: "+e.stack)}n(e)}},a.open(l,e,t.async||!0,t.username,t.password),"raw"===t.dataType&&(a.responseType="blob"),"xml"===t.dataType&&a.setRequestHeader("Content-Type","text/xml"),"json"===t.dataType&&a.setRequestHeader("Content-Type","application/json"),"GET"!==l&&t.csrf&&a.setRequestHeader("X-XSRF-TOKEN",(o=t.csrf,(i=document.cookie.split(o+"=")[1])&&i.split(";")[0])),t.headers)for(var s in t.headers)a.setRequestHeader(s,t.headers[s]);return a.send(t.data),function(){a.abort()}}),o?(r[e]=a,r[e].time=o):delete r[e],a},errorHandler:function(e){console.error(e)},Promise:o},r={};function o(e,t){this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],this._returnFn=c(e,this),this._staticData=t}function i(e,t){for(;3===e._state;)e=e._value;0!==e._state?(e._handled=!0,setTimeout(function(){var n,r=1===e._state?t.onFulfilled:t.onRejected;if(null!==r){try{n=r(e._value)}catch(e){return void l(t.promise,e)}a(t.promise,n)}else(1===e._state?a:l)(t.promise,e._value)})):e._deferreds.push(t)}function a(e,t){try{if(t){var n=t.then;if(t instanceof o)return e._state=3,e._value=t,void s(e);if("function"==typeof n)return c(n.bind(t),e)}e._cancelFn=null,e._state=1,e._value=t,s(e)}catch(t){l(e,t)}}function l(e,t){e._state=2,e._value=t,s(e)}function s(e){2===e._state&&0===e._deferreds.length&&setTimeout(function(){e._handled||console.warn("Possible Unhandled Promise Rejection:",e._value)});for(var t=0,n=e._deferreds.length;t":">",'"':""","'":"'","/":"/","`":"`","=":"="},helpers:{},partials:{},self:"self",escapeHTML:!0,limitPartialScope:!0,loopHelper:null,renderHook:null},a(this,t||{},e)},a=function(e,t,r){"string"!=typeof r&&(t=r,r=""),s(e,(t=n(e.options,t)).tags),e.helpers=t.helpers,e.registerPartial(t.partials),void 0!==r&&e.parse(r),delete t.helpers,delete t.partials},l=i.SafeString=function(e){this.string=e};return l.prototype.toString=l.prototype.toHTML=function(){return""+this.string},i.getObjectKeys=e,i.cloneObject=n,i.concatArrays=r,i.isEmpty=function(t){return!t||(t.constructor===Array?!t.length:"object"==typeof t?!e(t).length:!t)},i.prototype={render:function(e,t){var n=u(this,"","",0,e,null,[{scope:e}]);return[this.partials[this.options.self]({blocks:{},extra:t,scopes:[{scope:e,helpers:n,level:[],values:null,alias:{}}]}),this.controls.active=!0][0]},parse:function(e){return this.registerPartial(this.options.self,e)},registerHelper:function(e,t){if("string"==typeof e)return this.helpers[e]=t;for(var n in e)this.helpers[n]=e[n]},unregisterHelper:function(e){delete this.helpers[e]},registerPartial:function(e,t){if("string"==typeof e)return this.partials[e]=this.partials[e]||(t.constructor===Function?t:function(e,t,n){var r=t.split(e.regexps.tags);n.push({text:r[0]});for(var o=1,i="",a="",l="",s=0,c="",u=[],p=[],d=/^[!-]+/,f=/^else\s*/,h={"#":"B","^":"B","/":"C",E:"E"},v={},g="",m="",y={},b=r.length;o"===i&&(u.unshift("@"+c),p.unshift("@"+a)),"E"===g&&(a=a.replace(f,"")),y="/"===i?{tag:"C",text:l,vars:a}:O(e,a,i,r[o],m,l),"^"===i&&"B"===m&&(y.alt=y.vars[0].orig),"#*"===i&&(y.isPartial=!0),n=w(e,n,y,r[o]),"C"===m&&(n[n.length-1].isPartial||u[0])&&(y=n.splice(-1,1,u[0]?O(e,p[0],">",r[o],"I",y.text):{text:y.text})[0],(v=y.children[0]).children.unshift({text:v.text}),e.registerPartial(u[0]||y.vars[0].value,v.bodyFn),u.shift(),p.shift()));if(n.parent)throw"Schnauzer Error: Missing closing tag(s)";return r=t=null,S(e,{children:n})}(this,t,[]));for(var n in e)this.registerPartial(n,e[n])},unregisterPartial:function(e){delete this.partials[e]},setTags:function(e){s(this,e)},escapeExpression:function(e){return c(this,e,!0)}},i;function s(t,n){var r=function(e){for(var t=e.length;t--;)e[t]="("+e[t]+")";return e}("{{"===n[0]?["{{2,3}","[~}]{2,4}"]:n);t.regexps={tags:new RegExp(r[0]+"([#~^/!>*-]*)\\s*([^~}]*)"+r[1]),entity:new RegExp("["+e(t.options.entityMap).join("")+"]","g")}}function c(e,t,n){return null==t?"":t.constructor===i.SafeString?t.string:n&&e.options.escapeHTML?String(t).replace(e.regexps.entity,function(t){return e.options.entityMap[t]}):t}function u(e,t,n,r,o,i,a){return r?{"@index":t,"@number":t+1,"@key":n,"@odd":t%2!=0,"@last":t===r-1,"@first":0===t,"@length":r,"@depth":e.options.limitPartialScope?void 0:a.length-2,"@loop":i,"@parent":a[1].scope,"@root":a[a.length-1].scope,this:o,".":o}:{"@parent":i,"@root":a[a.length-1].scope,this:o,".":o}}function p(e,t,o){var i=e.scopes,a=e.alias?[e.alias]:[],l=r(i[0].level,a),s=e.values,c=i[1]?n({},i[1].alias):{};return e.alias=null,e.values=null,o=o?n(c,o):c,e.scopes=r(i,[{scope:t,helpers:i[0].helpers,level:l,values:s,alias:o}]),function(){e.scopes=i}}function d(e,t){var n=e.scope;return e.scope=t||{},function(){e.scope=n}}function f(e,t,n){if("."===t.value||"this"===t.value)return{value:e,variable:t};if("key"!==t.type)return{value:t.value,variable:t};for(var r="@root"===t.path[0]?1:0,o=t.path.length;r3):r.push(h)}return r}function O(e,t,n,r,o,i){var a=t?function(e,t){var n=/\([^()]*\)/g,r=function(e){var n={vars:E(e.substring(1,e.length-1),t,[],"fn")};return n.vars.length>1&&(n.helper=n.vars.shift()),"--"+(t.push(n)-1)+"--"};for(e=e.replace(/(['"|])(?:[^\\'"]|\\+['"]|['"])*?\1/g,function(n,r){var o={type:"|"!==r?"string":"alias",value:""};return-1!==e.indexOf("["+r)||-1!==e.indexOf(r+"=")?n:(o.value=n===e?[{value:n.substring(1,n.length-1),path:[],depth:0,single:!0,type:"key"}]:E(n.substring(1,n.length-1),t,[],o.type),"--"+(t.push(o)-1)+"--")});e!==(e=e.replace(n,r)););return E(e,t,[],"")}(t,[]):[],l="^"===n?"unless":/^(?:if|each|with|unless)$/.test((a[0]||{}).value)?a.shift().value:"";return{partial:">"===n?a.shift():void 0,helper:l||(">"!==n&&a.length>1?a.shift():""),helperFn:l?b:void 0,isEscaped:r.lastIndexOf(e.options.tags[0])<1,bodyFn:null,vars:a,isInline:"B"!==o,tag:o,text:i,children:null}}function S(e,t){return t.bodyFn="B"===t.tag?void 0:function(n){return function(e,t,n){for(var r=0,o=t.length,i="";r/,{option:"select",legend:"fieldset",area:"map",param:"object",thead:"table",tr:"tbody",col:"colgroup",td:"tr",default:"div"}),i=r.createDocumentFragment();return function(e,t){var i=function(o,i){e.call(this,o,i),this.options=t(this.options,{registerLoopItem:function(e,t,n,r){},isDynamic:function(e,t,n,r,o){return!1},scanHTML:function(e,t,n,r,o,i){},loopHelperName:"loop-helper",loopFnName:"__loopFn",loopLimitsName:"__loopLimits",limiters:["{{#","{{END:","}}"],forceUpdate:!1,missingProperty:n,debugMode:"",debugLevel:2,attributes:{value:s,disabled:l,hidden:l,checked:l,autocomplete:l,contenteditable:l,readonly:l,required:l,selected:l}}),this.version={blick:"1.0.5",schnauzer:this.version},this.collector={destroyers:{},updaters:{},movers:{},helpers:{},element:{}},this.returnFragment=r.createDocumentFragment(),this.dataDump=[],this._firstTimeLoop=null,this._tempNode=null,a(this,i||{},o)},a=function(e,n,r){var o;"string"!=typeof r&&(n=r),t(n.attributes||{},e.options.attributes),t(e.options,n),delete e.options.helpers,delete e.options.partials,e.options.renderHook=h,e.options.loopHelper=C,o=e.options.limiters,e.xpath={xpath:['//text()[contains(., "'+o[0]+'") or contains(., "'+o[1]+'")]','//@*[contains(., "'+o[0]+'")]'].join(" | "),regex:new RegExp("("+o[0]+"|"+o[1]+")(\\d+)"+o[2],"g"),startTag:o[0],type:XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE}};return function(e,t){function n(){this.constructor=e}for(var r in t)t[r]&&(e[r]=t[r]);n.prototype=t.prototype,e.prototype=new n}(i,e),i.setScroll=T,t(i.prototype,{renderHTML:function(e,t){return function(e,t,n,i){var a=e.returnFragment.childNodes.length?r.createDocumentFragment():e.returnFragment;for(e.controls.active=!1,i=p(e,e.dataDump,o(e.render(t,n),!0)).childNodes;i.length;)a.appendChild(i[0]);return a}(this,e,t,[])},destroyInstance:function(e){!function(e,t){for(var n in t){for(var r in e.destroyers[n])k(e,n+":"+r);delete e.destroyers[n]}}(this.collector,e)},removeChild:function(e,t,n){return E(this,e,t,n)},moveChild:function(e,t,n,r,o,i){return function(e,t,n,r,o,i,a){var l=e.options,s=o[l.loopLimitsName],c=n!==o,u=s[r+(c||n===o&&r4)return;if(!s||!c)return;e.controls.active=!1,d=e._firstTimeLoop||p(e,e.dataDump,o(s(r,t))),e.controls.active=!0,i.scanHTML(e,d,n[t],n);for(var f=d.childNodes,h=f.length;h--;)f[h].nodeType!==a||f[h].textContent!==i.loopHelperName?(1===f[h].nodeType&&(e.collector.element[n[t]["cr-id"].split(":")[1]]=f[h]),c=c.parentNode.insertBefore(f[h],c)):(f[h].parentNode.removeChild(f[h]),l.splice(t+1,0,u=f[--h]),c=c.nextSibling?c.parentNode.insertBefore(u,c.nextSibling):c.parentNode.appendChild(u));e._firstTimeLoop&&(l.splice(1,1),e._firstTimeLoop=null);e.controls.helpers&&P(e,t,n)}(this,e,t,n)},findElement:function(e){return this.collector.element[e["cr-id"].split(":")[1]]}}).constructor}(t,t.cloneObject);function a(t,n){!t.options.debugMode||t.options.debugLevel>n||e.console&&e.console[t.options.debugMode]&&e.console[t.options.debugMode].apply(null,[].slice.call(arguments).slice(2))}function l(e,t,n){var r=-1!==n.indexOf("focus"),o=r&&-1!==n.indexOf(":end");return!0===n||"true"===n||n&&!1!==n&&"false"!==n&&!r?(e.setAttribute(t,"selected"===t?t:""),function(){e[t]=!0}):(e.removeAttribute(t),r&&e.focus(),o&&(e.selectionStart=e.selectionEnd=e.value.length),function(){e[t]=!1})}function s(e,t,n){return e.setAttribute(t,n),e.value=n,function(){}}function c(e,t){var n=r.createTextNode("");return t?e.insertBefore(n,e.childNodes[0]):e.appendChild(n)}function u(e,t,n,r,o,i,a){var l=!!n;l?t=[n[0].parentNode]:(o=c(a=(t=Array.prototype.slice.call(t))[0].parentNode,!0),e[e.length-1].node=c(a));for(var s=e.length-(l?0:1),u=(t[0],s);u--;)if("each"===r[e[u].id].tagData.helper){if(!l&&e[u].id===e[s].id){e[u].node=o;break}!l&&!e[u].isStart||l&&e[u].isStart?(a=t.pop().childNodes[0].parentNode,i=!l&&c(a,!l),e[u].node=c(a,l)):e[u].node=i||c(t[0],!l)}}function p(e,t,i,l,s){var c,p,d=t.length&&function(e,t,i,a,l){for(var s,c,p,d=r.evaluate(e.xpath,t,null,e.type,null),f=[],h=0,v=0;s=d.snapshotItem(h++);){f=[],v=0,s.textContent=s.textContent.replace(e.regex,function(t,n,r,o){return p={id:+r,isStart:n===e.startTag,index:o-v},f.push(p),v+=t.length,""}),s.nodeType===Node.ATTRIBUTE_NODE?(c=s,s=o(s.textContent,!0,!0).firstChild):c=n,(s.nextSibling&&(s.nextSibling.rows||s.parentNode.rows)&&"each"===a[p.id].tagData.helper||s.parentNode.rows)&&u(f,s.nextSibling.rows,(s.parentNode.rows||[{}])[0].cells,a);for(var g=f.length;g--;)i[(p=f[g]).id]||(i[p.id]={start:p.node||s,end:s,attr:c}),p.node?i[p.id][p.isStart?"start":"end"]=p.node:p.isStart?i[p.id].start=s.splitText(p.index).splitText(0).previousSibling:i[p.id].end=s.splitText(p.index)}return i}(e.xpath,i,[],t,e.options.loopHelperName);for(s&&d&&(e._tempNode=d[t[0].id].start);c=t.shift();)(p=d[c.id]?d[c.id].attr?O:"B"!==c.tagData.tag?S:w:null)?p(e,d[c.id],c,t,l):a(e,3,"Missing NodeElement in template:",{template:i.innerHTML});return i}function d(e,t,r){for(var o=0,i={},a=e.length;o',i.value,l.length,r):a(e,2,2===r?'Added model activity: "'+s+'" ->':'Missing model activity: "'+s+'" ->',i.value):t||e.options.missingProperty===n?t||e.options.missingProperty!==n||a(e,3,'Property "'+s+'", defined in template'+(o.helper?' by block "'+(o.helper.value||o.helper)+'"':"")+", is missing in model."):a(e,2,"Installing",i,"not supported yet if not in model")}(e,u,s,l,o,i,p),u&&r.push(o)}}function h(e,t,n,r,o,i,a,l){for(var s=e.options.limiters,c=e.dataDump.length+s[2],u="B"!==i.tag&&(i.helper&&!i.helperFn||!!i.partial),p=[],h=0,v=r.length;h",n),c&&!c[l]&&s&&Object.defineProperty(c,l,{value:o}),!c||c["cr-id"]||s||(c["cr-id"]=n.parent["cr-id"]),(r||i?"":u)+t+u):c&&c.length?"":u;!c[l]&&s&&Object.defineProperty(c,l,{value:t})}function A(e){for(var t=0;e&&e.parent;)t++,e=e.parent;return t}function P(e,t,r,o,i,a,l,s){var c,u,p=["@index","@key","@number","@odd","@first","@last","@length","@depth"],d=e.collector.helpers,f=d[(r[0]||o)["cr-id"]],h=0,v=0,g="",m=o||r[t],y=e.collector.updaters[m["cr-id"]],b=l&&l[a],x=!(!i&&f)||y["@length"],_=f&&function(e,t,r){!function(e,t,r,o){var i=e.length,a=o.length,l="",s=t;if(t)for(;a--;)t[l=o[a]]!==n&&(s=t[l],0===a?s[l]=r:1===a?s[l]=Array.isArray(e)?r:Object.keys(e)[r]:2===a?s[l]=r+1:3===a?s[l]=r%2!=0:4===a?s[l]=0===r:5===a?s[l]=r===i-1:6===a?s[l]=i:7===a&&(s[l]=A(e)))}(r,d[r[e]["cr-id"]],e-t,p)};if(f)if(i)for(h=x?0:t,v=r.length;h/g,i=t.attr.ownerElement,a=t.attr.nodeName,l=e.options.attributes[a],s=function(e){var n=e.parentNode;if(11!==n.nodeType)return l?l(i,a,n.textContent)():void(t.attr.textContent=n.textContent.replace(o,""))};return s("B"!==n.tagData.tag?S(e,t,n,r,s):w(e,t,n,r,s))}function S(e,t,n,i,a){var l=t.start;return _(e,function(e,t,n,i,a){var l=n||i?null:r.createDocumentFragment(),s=e.nextSibling;return function(r,c){var u=[],p=a?a(r,c):r[0].value,d=e,f=null;if(i||n&&!a)return s.textContent=p,i&&i(s),p;for(u=o(p+"").childNodes;d.nextSibling!==t;)u.length?(d.parentNode.replaceChild(f=u[0],d.nextSibling),d=f):d.parentNode.removeChild(d.nextSibling);if(u.length){for(;u.length;)l.appendChild(u[0]);t.parentNode.insertBefore(l,t)}}}(l,t.end,n.tagData.isEscaped,a,n.helperFn),e.collector,n.data,n.actives),l}function w(e,t,i,a,l){var s="each"===i.tagData.helper||!i.tagData.helper&&!i.data[1]&&"array"===i.data[0].type,c=t.start,u=s?[]:n,d=s?t.start.nextSibling:t.start;if(s)for(;c&&c!==t.end.nextSibling;)u.push(c),c=c.nextSibling;else i.data[0].scrollers&&T(!0,i.data[0],i.track.fnIdx,d.parentNode);return _(e,function(e,t,i,a,l,s,c,u,d){var f=[],h=l.fnIdx,v=[],g=e.options;return v[h]=r.createDocumentFragment(),f[h]=s.length>0,l.checkFn=function(t){f[t]||(e.controls.active=!1)},function(s,m,y,b){b&&T(!0,s[0],h);var x=s[0].value&&s[0].value.length,_=a(s,m,y),N=t,k=t,C=!f[l.fnIdx],A=h>l.fnIdx&&d&&f[l.fnIdx]===n,P=s[0].loop&&s[0].loop.this,E=h!==l.fnIdx;if(h!==l.fnIdx||!_)for(;(k=t.nextSibling)&&k!==i;)v[h].appendChild(k);if(h=l.fnIdx,C){for(v[h]=v[h]||r.createDocumentFragment(),N=p(e,c,o(_),u,y===g.loopHelperName),b&&T(!0,s[0],h,N);k=N.childNodes[0];)v[h].appendChild(k);f[h]=!!_}if(A&&s[0].value[g.loopLimitsName]&&x)return e._firstTimeLoop=v[h],s[0].value[g.loopLimitsName].push(t),"";C&&_&&!u&&g.scanHTML(e,v[h],P,s[0].renderArgs?s[0]:s[0].parent["__cr-id"]&&s[0].parent||s[0].value,"skip"),_&&i.parentNode.insertBefore(v[h],i),b&&_&&T(!1,s[0],h),u&&(E||(t.nextSibling.textContent=_),u(t)),c.length&&c.splice(0,c.length)}}(e,d,t.end,i.bodyFn,i.track,i.out,a,l,s),e.collector,i.data,i.actives,u),d}function T(e,t,n,r){r&&(t.scrollers[n]=r.querySelectorAll("[cr-scroll]"));for(var o=t.scrollers[n].length,i=t;o--;)i=t.scrollers[n][o],r&&i.removeAttribute("cr-scroll"),e?i.__scroll={y:i.scrollTop,x:i.scrollLeft}:(i.scrollTop=i.__scroll.y,i.scrollLeft=i.__scroll.x);return t}}),function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],function(){return t()},"VArray"):"object"==typeof exports?exports.VArray=t():e.VArray=t()}(this&&this.window||global,function(){"use strict";var e=void 0,t=Array.prototype,n=0,r={},o=function(e,t){for(var n=e.length;n--;)t.unshift(e[n]);return t},i=function(){return t=i,n=arguments,(e=[]).push.apply(e,n),Object.setPrototypeOf(e,t.prototype);var e,t,n};return i.prototype=Object.create(Array.prototype),i.prototype.constructor=Array,i.adopt=function(e,t){return v(e,t)},(e=i.prototype).shift=function(){return s(e=this,e[0]);var e},e.pop=function(){return s(e=this,e[e.length-1]);var e},e.unshift=function(){return function(e,t){for(var n=t.length;n--;)l(e,t[n],0,0===n);return e.length}(this,o(arguments,[]))},e.push=function(){return function(e,t){for(var n=0,r=t.length;ne.length&&(r=e.length);for(i+=2;i=t.length);return c}(this,o(arguments,[]))},e.sort=function(e){return a(this,e)},e.reverse=function(){return function(e){for(var n=e._onChange._options.idProperty,r={},o=e.length;o--;)r[e[o][n]]=o;return a(e,t.reverse.call(e),r)}(this)},e.fill=function(e,t,n){return function(e,t,n,r){if(n=+n||0,r=void 0===r?e.length:Math.min(+r,e.length),NaN===n||n>=r)return e;for(var o=r-n;o--;)l(e.getCleanModel(t),n,!!o);return e}(this,e,t,n)},e.copyWithin=function(e,t,n){return function(e,t,n,r){if(n=+n||0,r=void 0===r?e.length:Math.min(+r||0,e.length),NaN===n||n>=r)return e;for(var o=n;o1)||1!==a&&void 0)}(this,n,t,r,o)},removeEvent:function(e){n(this,e)},destroy:function(){var t=this;return e.keys(this.listeners).forEach(function(e){n(t,e)}),this.element=this.root=this.store=null},removeItem:function(e){delete this.store[e]}},t;function n(e,t){var n=e.listeners[t];n&&(e.listeners[t]=n(),delete e.listeners[t])}},"controller"),define(["toolbox","blick","VArray","api","controller"],function(e,t,n,r,o){"use strict";var i=0,a={},l={},s=e.$,c=e.$$,u=e.$create,p=e.isArray,d=e.keys,f=e.cloneObject,h=function(e,t){this.controls={initPartials:!1},this.version="2.0.4",this.id=0,this.name="",this.options={hash:"#",partials:{},helpers:{},attributes:{},debug:0},v(this,e,t||{})},v=function(e,t,n){var r="string"==typeof t;for(var o in r||(n=t||{}),n)e.options[o]=n[o];e.id="cr_"+i++,e.name=r?t:e.id,l[e.id]={}};return Object.defineProperties(h.prototype,r({createComponent:{value:function(e,t,n,r,o){var i=g(n["__cr-id"]),a=document.createElement(e);for(var l in t)a.setAttribute(l,t[l]);return o&&(a.innerHTML=o),(r||i.element).appendChild(a),x(i,r||i.element,e,!0),a}},hideComponent:{value:function(e){var n=e&&e._tracker||document.createTextNode(""),r=e&&g(e["cr-id"]);if(e&&(e.__scrollers=e.__scrollers?t.setScroll(!0,e.__scrollers,0):t.setScroll(!0,{scrollers:[]},0,e)),e&&e.parentNode)return e._tracker||(e._tracker=e.parentNode.insertBefore(n,e)),e.parentNode.removeChild(e),function(o){return o&&e._tracker&&o!==e._tracker.parentNode?(e._tracker.parentNode.removeChild(e._tracker),delete e._tracker):o=void 0,o?o.appendChild(e):n.parentNode.insertBefore(e,e._tracker),t.setScroll(!1,e.__scrollers,0),y(e,r),e}}},getChildComponents:{value:function(e){for(var t=e["__cr-id"].split(":"),n=l[t[0]][t[1]].children,r=[],o=n.length;o--;)t=n[o].split(":"),r.push(m(this,t[1],t[0]));return r}},getParentComponent:{value:function(e){return m(this,l[this.id][e["__cr-id"].split(":")[1]].parent.split(":")[1])}},destroyComponent:{value:function(e,t){e&&(b(e["cr-id"],g(g(e["cr-id"]).parent)),t&&e.parentNode.removeChild(e))}},getModelElement:{value:function(e,t){return l[this.id][e["__cr-id"].split(":")[1]].template.blick.findElement(t)}}},h)),Object.defineProperties(h,{Service:{value:function(e,t){}},App:{value:function(e,t){return e.selector||(e.selector="app"),e.initialize=!0,h.Component(e,t)}},Component:{value:function(t,r){var c,v,m,b,P=!!a[t.selector],w=t.circular||h.CreateInstance(),T=!P&&function(e,t){var n=d(e);e.this||(e.this=[]);for(var r=n.length,o="",i=[];r--;)if(o=n[r],!((i=o.split(":")).length<2))for(var a=i.length;a--;)a>0?t[i[a-1]]=i[a].replace(/\]/g,""):(e[i[a]]=e[o],delete e[o]);return t}(t.subscribe$||(t.subscribe$={}),{}),F=P?a[t.selector]:a[t.selector]={Klass:r,selector:t.selector,subscribe$:t.subscribe$,childNames:T,template:t.template&&t.template.blick?t.template:O(t.template||"",function(e,t){return{helpers:f(f({},e.helpers),t.helpers||{}),partials:f(f({},e.partials),t.partials||{}),attributes:f(f({},e.attributes),t.attributes||{}),forceUpdate:!0,limitPartialScope:!1,debugMode:e.debug?"warn":"",debugLevel:e.debug,registerLoopItem:k,isDynamic:A,scanHTML:C}}(w.options,t)),styles:(c=t.styles,v=t.selector,m=c?p(c)?c.join("\n"):c:"",b=m&&u("style"),b?(b.setAttribute("name",v),b.innerHTML="\n"+m+"\n",document.head.appendChild(b)):null),singleton:!1,initialize:!1,crInst:w,init:function(r,a,c,u){return t.initialize&&(F.initialised=!0),function(t,r,a,s,c,u){var f=r.crInst,h=i++,v=t["cr-id"],m=v&&!s,b=r.template,k=m?null:l[f.id][h]={instance:{},controller:{},models:[],parent:"",template:b,element:t,crInst:f,children:[],views:{},listeners:{},destroyers:[]},C=e.trim(t.innerHTML),A=f.id+":"+h,P=r.template.blick.options,w=r.template.blick.partials;if(m||r.singleton&&!s)return g(v);r.singleton=!!a.singleton||a.initialised,s||(t["cr-id"]=A,k.crInst.options.debug&&t.setAttribute("cr-id",A));C&&(t.innerHTML=function(e,t,n){var r=t.replace(/cr-src/g,"src"),o=O(r,n,!0),i=e.childComponents;e.enableEvents=e.enableEvents||o.enableEvents;for(var a=o.childComponents.length;a--;)-1===i.indexOf(o.childComponents[a])&&i.push(o.childComponents[a]);return e.blick.registerPartial("@content",r),""}(b,C,P),a.extra||(a.extra=Object.create(null)),a.extra["@content"]=w["@content"],w["@content"]=null);k.name=a.selector,k.controller=new o(t),c&&(k.parent=c["__cr-id"],g(k.parent).children.push(A));k.instance=function(e,t,n,r){return new e.Klass(t.element,function(e,n){return function(e,t,n,r){var o=n.parent&&n.parent.split(":"),i=n.parent&&(l[o[0]][o[1]]||{})||{};!1!==t&&(t=!0),S(n.element,"cr-input",function(o,a,l){!function(e,t,n,r,o,i){var a=e.split(/\s*=\s*/),l=a[1]&&(0===a[1].indexOf('"')||0===a[1].indexOf("'")),s=a[1]&&"!"===a[1].charAt(0),c=(e=s?a[1].substring(1):a[1])||a[0];e=l?e.substring(1,e.length-1):"true"===e||"false"!==e&&(+e==e?+e:void 0),hasOwnProperty.call(t,a[0])&&(void 0!==e?t[a[0]]=e:hasOwnProperty.call(r.instance,c)&&(t[a[0]]=r.instance[c],!n||l||s||function(e,t,n,r,o,i){e[o]||(e[o]={}),e[o][r]={scope:t,key:i},n.push(function(){delete e[o][r]})}(r.listeners,t,o.destroyers,i,c,a[0])))}(a,e,t,i,n,r)}),n.crInst.options.debug||n.element.removeAttribute("cr-input")}(e,n,t,r)},t.crInst)}(r,k,0,A),Object.defineProperty(k.instance,"__cr-id",{value:A}),k.models=d(r.subscribe$).sort(function(e){return"this"===e?-1:1}).reduce(function(e,t){var o=function(e,t,r){var r=r.instance,o=e.split(/[./]/),i=function(e,t){for(var n=0,r=e.length;n]+)[^>]*cr-lazy)[^/]*?>";d(r.partials||{});return n.replace(new RegExp(s,"g"),function(e,t,n,r){var o=t||n||r;o&&(i[o]=!0)}),{blick:o?null:new t(e.trim(n),r),childComponents:d(i),enableEvents:!0}}function S(e,t,n,r){for(var o=e.hasAttribute&&e.hasAttribute(t)?[e]:[],i=e.childNodes.length?c("["+t+"]",e):[],a=i.length?(o.push.apply(o,i),o):o,l={},s=a.length,u="",p=[];s--;){p=(u=a[s].getAttribute(t))?u.split(/\s*;+\s*/):[],l[u]=a[s];for(var d=p.length,f=[],h="",v="";d--;)h=(f=p[d].split(/\s*:+\s*/))[0],v=f[1]||f[0],n&&n(h,v,a[s]),r&&(v?(r[h]=r[h]||{},r[h][v]=r[h][v]||[],r[h][v].push(a[s])):(r[h]=r[h]||[],r[h].push(a[s])))}return r||l}},"circular"); //# sourceMappingURL=circular.min.js.map \ No newline at end of file diff --git a/package.json b/package.json index 6d28518..da87673 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "circularjs", - "version": "2.0.3", + "version": "2.0.4", "description": "Tiny and fast SPA creation tool (MVC like framework with templating engine, router, pubsub, etc.)", "main": "circular.js", "scripts": { diff --git a/schnauzer.js b/schnauzer.js index b529a59..395373a 100644 --- a/schnauzer.js +++ b/schnauzer.js @@ -1,4 +1,4 @@ -/**! @license schnauzer v2.0.8; Copyright (C) 2017-2023 by Peter Dematté */ +/**! @license schnauzer v2.0.9; Copyright (C) 2017-2023 by Peter Dematté */ (function(global, factory) { if (typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if (typeof define === 'function' && define.amd) @@ -21,7 +21,7 @@ var concatArrays = function(array, host) { return host.push.apply(host, array), var trims = { start: /^\s*/, all: /^\s*|\s*$/g, end: /\s*$/ }; var Schnauzer = function(templateOrOptions, options) { - this.version = '2.0.8'; + this.version = '2.0.9'; this.partials = {}; this.helpers = {}; this.regexps = {};