This repository has been archived by the owner on Apr 17, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathtree.min.js
11 lines (9 loc) · 7.87 KB
/
tree.min.js
1
2
3
4
5
6
7
8
9
10
11
/**
* This file is generated. Don't modify it directly. (c)
*/
/**
* @license almond 0.2.9 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: http://github.com/jrburke/almond for details
*/
(function(e,t){typeof define=="function"&&define.amd?define(t):typeof exports=="object"?module.exports=t():e.Tree=t()})(this,function(){var e,t,n;return function(r){function v(e,t){return h.call(e,t)}function m(e,t){var n,r,i,s,o,u,a,f,c,h,p,v=t&&t.split("/"),m=l.map,g=m&&m["*"]||{};if(e&&e.charAt(0)===".")if(t){v=v.slice(0,v.length-1),e=e.split("/"),o=e.length-1,l.nodeIdCompat&&d.test(e[o])&&(e[o]=e[o].replace(d,"")),e=v.concat(e);for(c=0;c<e.length;c+=1){p=e[c];if(p===".")e.splice(c,1),c-=1;else if(p===".."){if(c===1&&(e[2]===".."||e[0]===".."))break;c>0&&(e.splice(c-1,2),c-=2)}}e=e.join("/")}else e.indexOf("./")===0&&(e=e.substring(2));if((v||g)&&m){n=e.split("/");for(c=n.length;c>0;c-=1){r=n.slice(0,c).join("/");if(v)for(h=v.length;h>0;h-=1){i=m[v.slice(0,h).join("/")];if(i){i=i[r];if(i){s=i,u=c;break}}}if(s)break;!a&&g&&g[r]&&(a=g[r],f=c)}!s&&a&&(s=a,u=f),s&&(n.splice(0,u,s),e=n.join("/"))}return e}function g(e,t){return function(){return s.apply(r,p.call(arguments,0).concat([e,t]))}}function y(e){return function(t){return m(t,e)}}function b(e){return function(t){a[e]=t}}function w(e){if(v(f,e)){var t=f[e];delete f[e],c[e]=!0,i.apply(r,t)}if(!v(a,e)&&!v(c,e))throw new Error("No "+e);return a[e]}function E(e){var t,n=e?e.indexOf("!"):-1;return n>-1&&(t=e.substring(0,n),e=e.substring(n+1,e.length)),[t,e]}function S(e){return function(){return l&&l.config&&l.config[e]||{}}}var i,s,o,u,a={},f={},l={},c={},h=Object.prototype.hasOwnProperty,p=[].slice,d=/\.js$/;o=function(e,t){var n,r=E(e),i=r[0];return e=r[1],i&&(i=m(i,t),n=w(i)),i?n&&n.normalize?e=n.normalize(e,y(t)):e=m(e,t):(e=m(e,t),r=E(e),i=r[0],e=r[1],i&&(n=w(i))),{f:i?i+"!"+e:e,n:e,pr:i,p:n}},u={require:function(e){return g(e)},exports:function(e){var t=a[e];return typeof t!="undefined"?t:a[e]={}},module:function(e){return{id:e,uri:"",exports:a[e],config:S(e)}}},i=function(e,t,n,i){var s,l,h,p,d,m=[],y=typeof n,E;i=i||e;if(y==="undefined"||y==="function"){t=!t.length&&n.length?["require","exports","module"]:t;for(d=0;d<t.length;d+=1){p=o(t[d],i),l=p.f;if(l==="require")m[d]=u.require(e);else if(l==="exports")m[d]=u.exports(e),E=!0;else if(l==="module")s=m[d]=u.module(e);else if(v(a,l)||v(f,l)||v(c,l))m[d]=w(l);else{if(!p.p)throw new Error(e+" missing "+l);p.p.load(p.n,g(i,!0),b(l),{}),m[d]=a[l]}}h=n?n.apply(a[e],m):undefined;if(e)if(s&&s.exports!==r&&s.exports!==a[e])a[e]=s.exports;else if(h!==r||!E)a[e]=h}else e&&(a[e]=n)},e=t=s=function(e,t,n,a,f){if(typeof e=="string")return u[e]?u[e](t):w(o(e,t).f);if(!e.splice){l=e,l.deps&&s(l.deps,l.callback);if(!t)return;t.splice?(e=t,t=n,n=null):e=r}return t=t||function(){},typeof n=="function"&&(n=a,a=f),a?i(r,e,t,n):setTimeout(function(){i(r,e,t,n)},4),s},s.config=function(e){return s(e)},e._defined=a,n=function(e,t,n){t.splice||(n=t,t=[]),!v(a,e)&&!v(f,e)&&(f[e]=[e,t,n])},n.amd={jQuery:!0}}(),n("../bower_components/almond/almond.js",function(){}),n("util/configurable",["require"],function(e){function t(e,t){for(var n in t)t.hasOwnProperty(n)&&function(n){e[n]=function(r){return arguments.length?(t[n]=r,e):t[n]}}(n)}return t}),n("model/tree",["require","../util/configurable"],function(e){function n(e,t){var n=function(e,t){t&&(e._parent=t);if(e.children&&e.children.length>0)for(var r in e.children)e.children.hasOwnProperty(r)&&n(e.children[r],e)};n(e,t)}var t=e("../util/configurable");return function r(e){var i={data:e};n(e);var s={find:function(e){var t=function(e,n){if(e.length>0){if(n.children)for(var i in n.children)if(n.children.hasOwnProperty(i)&&n.children[i]&&e[0]===n.children[i].name)return e.shift(),t(e,n.children[i]);return undefined}return r(n)},n=e.split("/");return e==="/"?n=[]:n.shift(),t(n,i.data)},append:function(e){i.data.children||(i.data.children=[]);var t=e.data();return n(t,i.data),i.data.children.push(t),r(t)},remove:function(){if(!i.data._parent)return undefined;var e=i.data._parent.children;return e.splice(e.indexOf(s.data()),1),i.data._parent.children=e,s.parent()},moveTo:function(e){var t=s.parent();return t?(t.find("/"+i.data.name).remove(),e.append(s),s):undefined},children:function(){return i.data.children?i.data.children.map(function(e){return r(e)}):[]},parent:function(){return i.data._parent?r(i.data._parent):undefined},path:function(){var e=i.data._parent?[i.data.name]:[],t=function(n){n._parent&&n._parent._parent&&(e.unshift(n._parent.name),t(n._parent))};return t(i.data),"/"+e.join("/")},name:function(){return i.data.name},attr:function(e,t){return t===undefined?i.data[e]:(i.data[e]=t,s)},clone:function(){var e=function(e){return r(JSON.parse(JSON.stringify(e,function(e,t){return e==="_parent"?undefined:t})))},t=e(i.data);return n(t),t},factory:function(){return r},visitor:function(){return function(e){var t=function(n){if(n.children)for(var i in n.children)n.children.hasOwnProperty(i)&&n.children[i]&&t(n.children[i]);e(r(n))};t(i.data)}},stringify:function(){return JSON.stringify(e,function(t,n){return t==="_parent"?undefined:n})}};return t(s,i),s}}),n("model/hookable",["require","../util/configurable"],function(e){var t=e("../util/configurable");return function n(e,r,i){function o(t,n){return n=n||[],e[t].apply(e,n)}function u(e){return function(t){return f(e).then(function(){return s.promiseFactory.reject(t)})}}function f(t,n){return r[t]?r[t].reduce(function(t,r){return t.then(function(){var t=s.promiseFactory.fcall(function(){return r.apply(e,n)});return s.timeout>0&&(t=t.timeout(s.timeout)),t})},s.promiseFactory()):s.promiseFactory.resolve()}var s={promiseFactory:i||window.Q,timeout:3e4};r=r||{};var a={HOOK_PRE_APPEND:0,HOOK_POST_APPEND:1,HOOK_ERROR_APPEND:2,HOOK_PRE_REMOVE:10,HOOK_POST_REMOVE:11,HOOK_ERROR_REMOVE:12,HOOK_PRE_MOVE:20,HOOK_POST_MOVE:21,HOOK_ERROR_MOVE:22,HOOK_PRE_CLONE:30,HOOK_POST_CLONE:31,HOOK_ERROR_CLONE:32,registerListener:function(e,t){r[e]||(r[e]=[]),r[e].push(t)},data:function(e){return o("data",e?[e]:[])},find:function(e){var t=o("find",[e]);return t?n(t,r,s.promiseFactory):t},append:function(e){return f(a.HOOK_PRE_APPEND,[e]).then(function(){if(typeof e.tree=="function"&&typeof e.listeners=="function"){var t=e.listeners();for(var n in t)if(t.hasOwnProperty(n))for(var r in t[n])t[n].hasOwnProperty(r)&&a.registerListener(n,t[n][r]);return o("append",[e.tree()])}return o("append",[e])}).then(function(t){return f(a.HOOK_POST_APPEND,[e]).then(function(){return n(t,r,s.promiseFactory)})}).catch(u(a.HOOK_ERROR_APPEND))},remove:function(){return f(a.HOOK_PRE_REMOVE).then(function(){return o("remove")}).then(function(e){return f(a.HOOK_POST_REMOVE).then(function(){return e?n(e,r,s.promiseFactory):e})}).catch(u(a.HOOK_ERROR_REMOVE))},moveTo:function(e){return f(a.HOOK_PRE_MOVE,[e]).then(function(){return typeof e.tree=="function"&&typeof e.listeners=="function"?o("moveTo",[e.tree()]):o("moveTo",[e])}).then(function(t){return f(a.HOOK_POST_MOVE,[e]).then(function(){return t?n(t,r,s.promiseFactory):t})}).catch(u(a.HOOK_ERROR_MOVE))},children:function(){return o("children").map(function(e){return n(e)})},parent:function(){var e=o("parent");return e?n(e,r,s.promiseFactory):e},path:function(){return o("path")},name:function(){return o("name")},attr:function(e,t){var i=o("attr",t!==undefined?[e,t]:[e]);return i!==undefined&&t!==undefined?n(i,r,s.promiseFactory):i},clone:function(){return f(a.HOOK_PRE_CLONE).then(function(){return o("clone")}).then(function(e){return f(a.HOOK_POST_CLONE).then(function(){return n(e,r,s.promiseFactory)})}).catch(u(a.HOOK_ERROR_CLONE))},factory:function(){return n},tree:function(){return e},listeners:function(){return r},visitor:function(){return o("visitor")},stringify:function(){return o("stringify")}};return t(a,s),a}}),n("main",["require","model/tree","model/hookable"],function(e){return{tree:e("model/tree"),hookable:e("model/hookable")}}),t(["main"]),t("main")});